From: support Date: Wed, 25 Jan 2023 17:45:44 +0000 (+0000) Subject: Built motion from commit 58b0471d.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/fonts.googleapis.com/icon?a=commitdiff_plain;h=ebb02424aa30a698e1c00fe2f62395f4061d0f2a;p=motion2.git Built motion from commit 58b0471d.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index cd210e6..0a2aeac 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-25T17:20:34.827Z", + "time": "2023-01-25T17:37:23.117Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4af5a90..b6222c6 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-25T17:20:34.827Z", + "time": "2023-01-25T17:37:23.117Z", "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 86f468a..41963db 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 _0x5f50=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward'];(function(_0xfb4621,_0x2a1f46){var _0x1a7ee8=function(_0x4bb8da){while(--_0x4bb8da){_0xfb4621['push'](_0xfb4621['shift']());}};_0x1a7ee8(++_0x2a1f46);}(_0x5f50,0xbb));var _0x05f5=function(_0x20962b,_0x5a8c41){_0x20962b=_0x20962b-0x0;var _0x3f6ef1=_0x5f50[_0x20962b];return _0x3f6ef1;};'use strict';var Sequelize=require(_0x05f5('0x0'));module[_0x05f5('0x1')]={'name':{'type':Sequelize[_0x05f5('0x2')],'get':function(_0x205831){return this[_0x05f5('0x3')](_0x05f5('0x4'));}},'action':{'type':Sequelize[_0x05f5('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x05f5('0x6'),_0x05f5('0x7'),_0x05f5('0x8'),_0x05f5('0x9'),_0x05f5('0xa'),_0x05f5('0xb'),_0x05f5('0xc'),_0x05f5('0xd')]],'msg':_0x05f5('0xe')}},'comment':_0x05f5('0xe')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x05f5('0xf')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x05f5('0x10')},'data3':{'type':Sequelize[_0x05f5('0x5')](0x1000),'comment':_0x05f5('0x11')},'data4':{'type':Sequelize[_0x05f5('0x5')](0x1000),'comments':_0x05f5('0x12')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x05f5('0x13')},'data7':{'type':Sequelize[_0x05f5('0x14')],'comments':_0x05f5('0x15')}}; \ No newline at end of file +var _0xad37=['VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','bot','script','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]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports'];(function(_0x417b73,_0x4dc044){var _0x2ca8bc=function(_0x2b61aa){while(--_0x2b61aa){_0x417b73['push'](_0x417b73['shift']());}};_0x2ca8bc(++_0x4dc044);}(_0xad37,0xfb));var _0x7ad3=function(_0x1c2fe9,_0x44d300){_0x1c2fe9=_0x1c2fe9-0x0;var _0x57dc0f=_0xad37[_0x1c2fe9];return _0x57dc0f;};'use strict';var Sequelize=require('sequelize');module[_0x7ad3('0x0')]={'name':{'type':Sequelize[_0x7ad3('0x1')],'get':function(_0x17eeef){return this[_0x7ad3('0x2')](_0x7ad3('0x3'));}},'action':{'type':Sequelize[_0x7ad3('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7ad3('0x5'),_0x7ad3('0x6'),_0x7ad3('0x7'),_0x7ad3('0x8'),'urlForward','browser',_0x7ad3('0x9'),_0x7ad3('0xa')]],'msg':_0x7ad3('0xb')}},'comment':_0x7ad3('0xb')},'data1':{'type':Sequelize['STRING'](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[_0x7ad3('0x4')](0x1000),'comment':_0x7ad3('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x7ad3('0xd')},'data4':{'type':Sequelize[_0x7ad3('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x7ad3('0xe')},'data6':{'type':Sequelize[_0x7ad3('0x4')],'comments':_0x7ad3('0xf')},'data7':{'type':Sequelize[_0x7ad3('0x10')],'comments':_0x7ad3('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index de620ce..b72e305 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 _0x77e8=['body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x357a04,_0x34d70a){var _0xec3d57=function(_0x219b0b){while(--_0x219b0b){_0x357a04['push'](_0x357a04['shift']());}};_0xec3d57(++_0x34d70a);}(_0x77e8,0x1c7));var _0x877e=function(_0x2f454b,_0x4f0132){_0x2f454b=_0x2f454b-0x0;var _0x3077ab=_0x77e8[_0x2f454b];return _0x3077ab;};'use strict';var emlformat=require(_0x877e('0x0'));var rimraf=require(_0x877e('0x1'));var zipdir=require(_0x877e('0x2'));var jsonpatch=require(_0x877e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x877e('0x4'));var Mustache=require(_0x877e('0x5'));var util=require(_0x877e('0x6'));var path=require(_0x877e('0x7'));var sox=require(_0x877e('0x8'));var csv=require('to-csv');var ejs=require(_0x877e('0x9'));var fs=require('fs');var fs_extra=require(_0x877e('0xa'));var _=require(_0x877e('0xb'));var squel=require(_0x877e('0xc'));var crypto=require(_0x877e('0xd'));var jsforce=require(_0x877e('0xe'));var deskjs=require(_0x877e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x877e('0x10'));var Papa=require(_0x877e('0x11'));var Redis=require(_0x877e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x877e('0x13'))(_0x877e('0x14'));var utils=require(_0x877e('0x15'));var config=require(_0x877e('0x16'));var licenseUtil=require(_0x877e('0x17'));var db=require(_0x877e('0x18'))['db'];function respondWithStatusCode(_0x3a9c14,_0x46dbe9){_0x46dbe9=_0x46dbe9||0xcc;return function(_0x518487){if(_0x518487){return _0x3a9c14[_0x877e('0x19')](_0x46dbe9);}return _0x3a9c14[_0x877e('0x1a')](_0x46dbe9)[_0x877e('0x1b')]();};}function respondWithResult(_0x313a19,_0x2aa64a){_0x2aa64a=_0x2aa64a||0xc8;return function(_0x2bd559){if(_0x2bd559){return _0x313a19[_0x877e('0x1a')](_0x2aa64a)['json'](_0x2bd559);}};}function respondWithFilteredResult(_0xebcd52,_0xdf81f0){return function(_0x625881){if(_0x625881){var _0x325683=typeof _0xdf81f0['offset']===_0x877e('0x1c')&&typeof _0xdf81f0[_0x877e('0x1d')]===_0x877e('0x1c');var _0x4108ce=_0x625881[_0x877e('0x1e')];var _0x372693=_0x325683?0x0:_0xdf81f0[_0x877e('0x1f')];var _0x1e4d0f=_0x325683?_0x625881[_0x877e('0x1e')]:_0xdf81f0['offset']+_0xdf81f0[_0x877e('0x1d')];var _0x1aa752;if(_0x1e4d0f>=_0x4108ce){_0x1e4d0f=_0x4108ce;_0x1aa752=0xc8;}else{_0x1aa752=0xce;}_0xebcd52[_0x877e('0x1a')](_0x1aa752);return _0xebcd52[_0x877e('0x20')](_0x877e('0x21'),_0x372693+'-'+_0x1e4d0f+'/'+_0x4108ce)[_0x877e('0x22')](_0x625881);}return null;};}function patchUpdates(_0x42e045){return function(_0x117c26){try{jsonpatch[_0x877e('0x23')](_0x117c26,_0x42e045,!![]);}catch(_0x410ac2){return BPromise[_0x877e('0x24')](_0x410ac2);}return _0x117c26[_0x877e('0x25')]();};}function saveUpdates(_0x5c7af9,_0x46e7b6){return function(_0x15d108){if(_0x15d108){return _0x15d108[_0x877e('0x26')](_0x5c7af9)[_0x877e('0x27')](function(_0xcc5ff5){return _0xcc5ff5;});}return null;};}function removeEntity(_0x2c8ae9,_0xbf9437){return function(_0x43d23b){if(_0x43d23b){return _0x43d23b[_0x877e('0x28')]()[_0x877e('0x27')](function(){_0x2c8ae9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3557c4,_0x4fb98f){return function(_0x95b6b1){if(!_0x95b6b1){_0x3557c4[_0x877e('0x19')](0x194);}return _0x95b6b1;};}function handleError(_0x4fc0ce,_0xdce543){_0xdce543=_0xdce543||0x1f4;return function(_0x16438b){logger[_0x877e('0x29')](_0x16438b[_0x877e('0x2a')]);if(_0x16438b['name']){delete _0x16438b[_0x877e('0x2b')];}_0x4fc0ce[_0x877e('0x1a')](_0xdce543)[_0x877e('0x2c')](_0x16438b);};}exports['update']=function(_0x1ff1aa,_0x3c5765){if(_0x1ff1aa['body']['id']){delete _0x1ff1aa[_0x877e('0x2d')]['id'];}return db[_0x877e('0x2e')][_0x877e('0x2f')]({'where':{'id':_0x1ff1aa[_0x877e('0x30')]['id']}})[_0x877e('0x27')](handleEntityNotFound(_0x3c5765,null))['then'](saveUpdates(_0x1ff1aa['body'],null))[_0x877e('0x27')](respondWithResult(_0x3c5765,null))[_0x877e('0x31')](handleError(_0x3c5765,null));};exports[_0x877e('0x28')]=function(_0xd3d021,_0x5892a5){return db[_0x877e('0x2e')][_0x877e('0x2f')]({'where':{'id':_0xd3d021[_0x877e('0x30')]['id']}})[_0x877e('0x27')](handleEntityNotFound(_0x5892a5,null))[_0x877e('0x27')](removeEntity(_0x5892a5,null))[_0x877e('0x31')](handleError(_0x5892a5,null));}; \ No newline at end of file +var _0xf630=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','Content-Range','apply','update','destroy','then','error','stack','name','send','body','Action','find','params','catch','eml-format'];(function(_0x2c8df0,_0x32e64b){var _0x5753b1=function(_0x279686){while(--_0x279686){_0x2c8df0['push'](_0x2c8df0['shift']());}};_0x5753b1(++_0x32e64b);}(_0xf630,0x19d));var _0x0f63=function(_0xca10ea,_0x82cb23){_0xca10ea=_0xca10ea-0x0;var _0x2db36d=_0xf630[_0xca10ea];return _0x2db36d;};'use strict';var emlformat=require(_0x0f63('0x0'));var rimraf=require(_0x0f63('0x1'));var zipdir=require(_0x0f63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f63('0x3'));var moment=require(_0x0f63('0x4'));var BPromise=require(_0x0f63('0x5'));var Mustache=require(_0x0f63('0x6'));var util=require('util');var path=require(_0x0f63('0x7'));var sox=require(_0x0f63('0x8'));var csv=require('to-csv');var ejs=require(_0x0f63('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0f63('0xa'));var crypto=require(_0x0f63('0xb'));var jsforce=require(_0x0f63('0xc'));var deskjs=require(_0x0f63('0xd'));var toCsv=require(_0x0f63('0xe'));var querystring=require('querystring');var Papa=require(_0x0f63('0xf'));var Redis=require(_0x0f63('0x10'));var authService=require(_0x0f63('0x11'));var qs=require(_0x0f63('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f63('0x13'));var logger=require(_0x0f63('0x14'))(_0x0f63('0x15'));var utils=require('../../config/utils');var config=require(_0x0f63('0x16'));var licenseUtil=require(_0x0f63('0x17'));var db=require(_0x0f63('0x18'))['db'];function respondWithStatusCode(_0x4336a9,_0x56f0a8){_0x56f0a8=_0x56f0a8||0xcc;return function(_0x57b834){if(_0x57b834){return _0x4336a9[_0x0f63('0x19')](_0x56f0a8);}return _0x4336a9['status'](_0x56f0a8)[_0x0f63('0x1a')]();};}function respondWithResult(_0x1df140,_0x7ac41){_0x7ac41=_0x7ac41||0xc8;return function(_0x3fe954){if(_0x3fe954){return _0x1df140['status'](_0x7ac41)[_0x0f63('0x1b')](_0x3fe954);}};}function respondWithFilteredResult(_0x3ec2ec,_0x35ea96){return function(_0x7b7184){if(_0x7b7184){var _0x1475c2=typeof _0x35ea96[_0x0f63('0x1c')]==='undefined'&&typeof _0x35ea96[_0x0f63('0x1d')]==='undefined';var _0x567319=_0x7b7184[_0x0f63('0x1e')];var _0x1d75ac=_0x1475c2?0x0:_0x35ea96['offset'];var _0x4714d3=_0x1475c2?_0x7b7184[_0x0f63('0x1e')]:_0x35ea96['offset']+_0x35ea96[_0x0f63('0x1d')];var _0x2515e2;if(_0x4714d3>=_0x567319){_0x4714d3=_0x567319;_0x2515e2=0xc8;}else{_0x2515e2=0xce;}_0x3ec2ec[_0x0f63('0x1f')](_0x2515e2);return _0x3ec2ec['set'](_0x0f63('0x20'),_0x1d75ac+'-'+_0x4714d3+'/'+_0x567319)[_0x0f63('0x1b')](_0x7b7184);}return null;};}function patchUpdates(_0x3707b1){return function(_0x2392ff){try{jsonpatch[_0x0f63('0x21')](_0x2392ff,_0x3707b1,!![]);}catch(_0x14f6ec){return BPromise['reject'](_0x14f6ec);}return _0x2392ff['save']();};}function saveUpdates(_0x17291e,_0x203137){return function(_0x3b0632){if(_0x3b0632){return _0x3b0632[_0x0f63('0x22')](_0x17291e)['then'](function(_0x1de58a){return _0x1de58a;});}return null;};}function removeEntity(_0xbcaa99,_0xf672ef){return function(_0x50bff2){if(_0x50bff2){return _0x50bff2[_0x0f63('0x23')]()[_0x0f63('0x24')](function(){_0xbcaa99[_0x0f63('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf98bad,_0x4b682a){return function(_0x25fd95){if(!_0x25fd95){_0xf98bad[_0x0f63('0x19')](0x194);}return _0x25fd95;};}function handleError(_0x24460f,_0x553288){_0x553288=_0x553288||0x1f4;return function(_0x11cf0b){logger[_0x0f63('0x25')](_0x11cf0b[_0x0f63('0x26')]);if(_0x11cf0b[_0x0f63('0x27')]){delete _0x11cf0b[_0x0f63('0x27')];}_0x24460f['status'](_0x553288)[_0x0f63('0x28')](_0x11cf0b);};}exports['update']=function(_0x4bfae2,_0x45bbcb){if(_0x4bfae2[_0x0f63('0x29')]['id']){delete _0x4bfae2['body']['id'];}return db[_0x0f63('0x2a')][_0x0f63('0x2b')]({'where':{'id':_0x4bfae2[_0x0f63('0x2c')]['id']}})[_0x0f63('0x24')](handleEntityNotFound(_0x45bbcb,null))[_0x0f63('0x24')](saveUpdates(_0x4bfae2[_0x0f63('0x29')],null))[_0x0f63('0x24')](respondWithResult(_0x45bbcb,null))[_0x0f63('0x2d')](handleError(_0x45bbcb,null));};exports[_0x0f63('0x23')]=function(_0x5119ed,_0x2f1b06){return db[_0x0f63('0x2a')][_0x0f63('0x2b')]({'where':{'id':_0x5119ed[_0x0f63('0x2c')]['id']}})[_0x0f63('0x24')](handleEntityNotFound(_0x2f1b06,null))[_0x0f63('0x24')](removeEntity(_0x2f1b06,null))[_0x0f63('0x2d')](handleError(_0x2f1b06,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index df7211b..1fbdffa 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 _0x7c4a=['path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7c4a,0xf1));var _0xa7c4=function(_0x2a6571,_0xf1567c){_0x2a6571=_0x2a6571-0x0;var _0xdf7731=_0x7c4a[_0x2a6571];return _0xdf7731;};'use strict';var _=require(_0xa7c4('0x0'));var util=require(_0xa7c4('0x1'));var logger=require(_0xa7c4('0x2'))(_0xa7c4('0x3'));var moment=require(_0xa7c4('0x4'));var BPromise=require(_0xa7c4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7c4('0x6'));var rimraf=require(_0xa7c4('0x7'));var config=require(_0xa7c4('0x8'));var attributes=require(_0xa7c4('0x9'));module[_0xa7c4('0xa')]=function(_0x4a3942,_0x3eed9e){return _0x4a3942[_0xa7c4('0xb')](_0xa7c4('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe766=['request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util','moment'];(function(_0x245c9f,_0x1d9e8c){var _0x276b79=function(_0x2bdbd7){while(--_0x2bdbd7){_0x245c9f['push'](_0x245c9f['shift']());}};_0x276b79(++_0x1d9e8c);}(_0xe766,0x17e));var _0x6e76=function(_0x298374,_0x4d34c4){_0x298374=_0x298374-0x0;var _0x42ada1=_0xe766[_0x298374];return _0x42ada1;};'use strict';var _=require(_0x6e76('0x0'));var util=require(_0x6e76('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6e76('0x2'));var BPromise=require('bluebird');var rp=require(_0x6e76('0x3'));var fs=require('fs');var path=require(_0x6e76('0x4'));var rimraf=require(_0x6e76('0x5'));var config=require(_0x6e76('0x6'));var attributes=require(_0x6e76('0x7'));module[_0x6e76('0x8')]=function(_0x1fdf23,_0x171b50){return _0x1fdf23[_0x6e76('0x9')](_0x6e76('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 3c2dc3e..083757d 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x53ec,0x192));var _0xc53e=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x53ec[_0x1ac6ec];return _0x48a489;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x1cb9,0x14e));var _0x91cb=function(_0x483a57,_0x1621eb){_0x483a57=_0x483a57-0x0;var _0x6313c9=_0x1cb9[_0x483a57];return _0x6313c9;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 852eb68..091b426 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 _0xef6c=['express','Router','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout'];(function(_0x1bc3b7,_0x46e54f){var _0x54c160=function(_0x6e66a8){while(--_0x6e66a8){_0x1bc3b7['push'](_0x1bc3b7['shift']());}};_0x54c160(++_0x46e54f);}(_0xef6c,0x6c));var _0xcef6=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xef6c[_0x421263];return _0x34e4b5;};'use strict';var multer=require(_0xcef6('0x0'));var util=require(_0xcef6('0x1'));var path=require(_0xcef6('0x2'));var timeout=require(_0xcef6('0x3'));var express=require(_0xcef6('0x4'));var router=express[_0xcef6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcef6('0x6'));var config=require(_0xcef6('0x7'));var controller=require(_0xcef6('0x8'));router[_0xcef6('0x9')](_0xcef6('0xa'),auth[_0xcef6('0xb')](),controller[_0xcef6('0xc')]);router['delete'](_0xcef6('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xcef6('0xd')]=router; \ No newline at end of file +var _0x1e34=['update','delete','isAuthenticated','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','./action.controller','/:id'];(function(_0x289a90,_0x1839c8){var _0x5162d2=function(_0x4db7d8){while(--_0x4db7d8){_0x289a90['push'](_0x289a90['shift']());}};_0x5162d2(++_0x1839c8);}(_0x1e34,0xb9));var _0x41e3=function(_0x40d6ea,_0x523827){_0x40d6ea=_0x40d6ea-0x0;var _0xab0828=_0x1e34[_0x40d6ea];return _0xab0828;};'use strict';var multer=require(_0x41e3('0x0'));var util=require('util');var path=require(_0x41e3('0x1'));var timeout=require(_0x41e3('0x2'));var express=require('express');var router=express[_0x41e3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x41e3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x41e3('0x5'));router['put'](_0x41e3('0x6'),auth['isAuthenticated'](),controller[_0x41e3('0x7')]);router[_0x41e3('0x8')](_0x41e3('0x6'),auth[_0x41e3('0x9')](),controller[_0x41e3('0xa')]);module[_0x41e3('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0840107..4379355 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x231744,_0x1a2cc7){var _0x5e2cd=function(_0x5d07cd){while(--_0x5d07cd){_0x231744['push'](_0x231744['shift']());}};_0x5e2cd(++_0x1a2cc7);}(_0x98a8,0x12c));var _0x898a=function(_0x59a09a,_0x4e02fc){_0x59a09a=_0x59a09a-0x0;var _0x5e786e=_0x98a8[_0x59a09a];return _0x5e786e;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5d58=['TEXT','STRING'];(function(_0x3ec6f5,_0x31886b){var _0x43415d=function(_0x5e19cf){while(--_0x5e19cf){_0x3ec6f5['push'](_0x3ec6f5['shift']());}};_0x43415d(++_0x31886b);}(_0x5d58,0x187));var _0x85d5=function(_0x479603,_0x300af1){_0x479603=_0x479603-0x0;var _0x37ce3d=_0x5d58[_0x479603];return _0x37ce3d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 63e0b11..ca93e56 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 _0xb1b3=['UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','length','operator','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','MetricId','metric','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','getFields','AnalyticMetric','select','order','clone','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','parse','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','then','get','CustomReports','UserProfileResource','stack','name','send','AnalyticCustomReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)'];(function(_0x19e7ae,_0x1c44fc){var _0x3801c1=function(_0x44e502){while(--_0x44e502){_0x19e7ae['push'](_0x19e7ae['shift']());}};_0x3801c1(++_0x1c44fc);}(_0xb1b3,0xe8));var _0x3b1b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb1b3[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b1b('0x0'));var zipdir=require(_0x3b1b('0x1'));var jsonpatch=require(_0x3b1b('0x2'));var rp=require('request-promise');var moment=require(_0x3b1b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3b1b('0x4'));var util=require(_0x3b1b('0x5'));var path=require(_0x3b1b('0x6'));var sox=require('sox');var csv=require(_0x3b1b('0x7'));var ejs=require(_0x3b1b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b1b('0x9'));var squel=require(_0x3b1b('0xa'));var crypto=require(_0x3b1b('0xb'));var jsforce=require(_0x3b1b('0xc'));var deskjs=require(_0x3b1b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3b1b('0xe'));var qs=require(_0x3b1b('0xf'));var as=require(_0x3b1b('0x10'));var hardwareService=require(_0x3b1b('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3b1b('0x12'));var config=require(_0x3b1b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b1b('0x14'))['db'];var dbH=require(_0x3b1b('0x14'))[_0x3b1b('0x15')];function respondWithStatusCode(_0x1d9b2d,_0x1ef3c4){_0x1ef3c4=_0x1ef3c4||0xcc;return function(_0x52bb4c){if(_0x52bb4c){return _0x1d9b2d[_0x3b1b('0x16')](_0x1ef3c4);}return _0x1d9b2d[_0x3b1b('0x17')](_0x1ef3c4)['end']();};}function respondWithResult(_0x299b21,_0x5a9879){_0x5a9879=_0x5a9879||0xc8;return function(_0x36776e){if(_0x36776e){return _0x299b21[_0x3b1b('0x17')](_0x5a9879)[_0x3b1b('0x18')](_0x36776e);}};}function respondWithFilteredResult(_0x4873fe,_0x4ff7fe){return function(_0x116b4e){if(_0x116b4e){var _0x4633f6=typeof _0x4ff7fe['offset']==='undefined'&&typeof _0x4ff7fe[_0x3b1b('0x19')]===_0x3b1b('0x1a');var _0x28d91a=_0x116b4e[_0x3b1b('0x1b')];var _0x3d9114=_0x4633f6?0x0:_0x4ff7fe['offset'];var _0x3cd79d=_0x4633f6?_0x116b4e[_0x3b1b('0x1b')]:_0x4ff7fe[_0x3b1b('0x1c')]+_0x4ff7fe[_0x3b1b('0x19')];var _0x11e1a3;if(_0x3cd79d>=_0x28d91a){_0x3cd79d=_0x28d91a;_0x11e1a3=0xc8;}else{_0x11e1a3=0xce;}_0x4873fe[_0x3b1b('0x17')](_0x11e1a3);return _0x4873fe[_0x3b1b('0x1d')](_0x3b1b('0x1e'),_0x3d9114+'-'+_0x3cd79d+'/'+_0x28d91a)[_0x3b1b('0x18')](_0x116b4e);}return null;};}function patchUpdates(_0x1e3a79){return function(_0x5ea7f7){try{jsonpatch[_0x3b1b('0x1f')](_0x5ea7f7,_0x1e3a79,!![]);}catch(_0x50e412){return BPromise['reject'](_0x50e412);}return _0x5ea7f7[_0x3b1b('0x20')]();};}function saveUpdates(_0x3a8ef9,_0x2b91c2){return function(_0x3a5f90){if(_0x3a5f90){return _0x3a5f90[_0x3b1b('0x21')](_0x3a8ef9)['then'](function(_0x28d66a){return _0x28d66a;});}return null;};}function removeEntity(_0x1696ac,_0x58a2ea){return function(_0x55ab05){if(_0x55ab05){return _0x55ab05[_0x3b1b('0x22')]()[_0x3b1b('0x23')](function(){var _0x48b469=_0x55ab05[_0x3b1b('0x24')]({'plain':!![]});var _0x262426=_0x3b1b('0x25');return db[_0x3b1b('0x26')][_0x3b1b('0x22')]({'where':{'type':_0x262426,'resourceId':_0x48b469['id']}})[_0x3b1b('0x23')](function(){return _0x55ab05;});})[_0x3b1b('0x23')](function(){_0x1696ac[_0x3b1b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb3db,_0x344b12){return function(_0x56aad8){if(!_0x56aad8){_0x5cb3db[_0x3b1b('0x16')](0x194);}return _0x56aad8;};}function handleError(_0x49d60a,_0x2b2e46){_0x2b2e46=_0x2b2e46||0x1f4;return function(_0x5544c1){logger['error'](_0x5544c1[_0x3b1b('0x27')]);if(_0x5544c1[_0x3b1b('0x28')]){delete _0x5544c1[_0x3b1b('0x28')];}_0x49d60a[_0x3b1b('0x17')](_0x2b2e46)[_0x3b1b('0x29')](_0x5544c1);};}exports['index']=function(_0x234a81,_0x4d39a2){var _0x281853={},_0x1576b4={},_0x2be27d={'count':0x0,'rows':[]};var _0x3114c2=_['map'](db[_0x3b1b('0x2a')]['rawAttributes'],function(_0xac9551){return{'name':_0xac9551[_0x3b1b('0x2b')],'type':_0xac9551[_0x3b1b('0x2c')][_0x3b1b('0x2d')]};});_0x1576b4['model']=_['map'](_0x3114c2,_0x3b1b('0x28'));_0x1576b4[_0x3b1b('0x2e')]=_[_0x3b1b('0x2f')](_0x234a81[_0x3b1b('0x2e')]);_0x1576b4['filters']=_[_0x3b1b('0x30')](_0x1576b4[_0x3b1b('0x31')],_0x1576b4['query']);_0x281853[_0x3b1b('0x32')]=_['intersection'](_0x1576b4['model'],qs[_0x3b1b('0x33')](_0x234a81[_0x3b1b('0x2e')][_0x3b1b('0x33')]));_0x281853[_0x3b1b('0x32')]=_0x281853[_0x3b1b('0x32')]['length']?_0x281853[_0x3b1b('0x32')]:_0x1576b4['model'];if(!_0x234a81[_0x3b1b('0x2e')][_0x3b1b('0x34')](_0x3b1b('0x35'))){_0x281853[_0x3b1b('0x19')]=qs[_0x3b1b('0x19')](_0x234a81[_0x3b1b('0x2e')][_0x3b1b('0x19')]);_0x281853[_0x3b1b('0x1c')]=qs['offset'](_0x234a81['query'][_0x3b1b('0x1c')]);}_0x281853['order']=qs[_0x3b1b('0x36')](_0x234a81[_0x3b1b('0x2e')]['sort']);_0x281853[_0x3b1b('0x37')]=qs['filters'](_[_0x3b1b('0x38')](_0x234a81[_0x3b1b('0x2e')],_0x1576b4[_0x3b1b('0x39')]),_0x3114c2);if(_0x234a81['query'][_0x3b1b('0x3a')]){_0x281853[_0x3b1b('0x37')]=_[_0x3b1b('0x3b')](_0x281853['where'],{'$or':_[_0x3b1b('0x3c')](_0x3114c2,function(_0x303bc5){if(_0x303bc5[_0x3b1b('0x2c')]!==_0x3b1b('0x3d')){var _0x4edac9={};_0x4edac9[_0x303bc5['name']]={'$like':'%'+_0x234a81[_0x3b1b('0x2e')][_0x3b1b('0x3a')]+'%'};return _0x4edac9;}})});}_0x281853=_[_0x3b1b('0x3b')]({},_0x281853,_0x234a81[_0x3b1b('0x3e')]);var _0x31ef36={'where':_0x281853['where']};return db[_0x3b1b('0x2a')]['count'](_0x31ef36)[_0x3b1b('0x23')](function(_0xaa287f){_0x2be27d['count']=_0xaa287f;if(_0x234a81[_0x3b1b('0x2e')][_0x3b1b('0x3f')]){_0x281853[_0x3b1b('0x40')]=[{'all':!![]}];}return db[_0x3b1b('0x2a')][_0x3b1b('0x41')](_0x281853);})[_0x3b1b('0x23')](function(_0x1a3cd3){_0x2be27d[_0x3b1b('0x42')]=_0x1a3cd3;return _0x2be27d;})[_0x3b1b('0x23')](respondWithFilteredResult(_0x4d39a2,_0x281853))[_0x3b1b('0x43')](handleError(_0x4d39a2,null));};exports['show']=function(_0x577c8e,_0x1254fc){var _0x427398={'raw':![],'where':{'id':_0x577c8e[_0x3b1b('0x44')]['id']}},_0x67a43b={};_0x67a43b[_0x3b1b('0x31')]=_[_0x3b1b('0x2f')](db[_0x3b1b('0x2a')][_0x3b1b('0x45')]);_0x67a43b[_0x3b1b('0x2e')]=_['keys'](_0x577c8e['query']);_0x67a43b[_0x3b1b('0x39')]=_[_0x3b1b('0x30')](_0x67a43b[_0x3b1b('0x31')],_0x67a43b['query']);_0x427398['attributes']=_[_0x3b1b('0x30')](_0x67a43b['model'],qs[_0x3b1b('0x33')](_0x577c8e['query'][_0x3b1b('0x33')]));_0x427398[_0x3b1b('0x32')]=_0x427398['attributes']['length']?_0x427398[_0x3b1b('0x32')]:_0x67a43b[_0x3b1b('0x31')];if(_0x577c8e[_0x3b1b('0x2e')]['includeAll']){_0x427398['include']=[{'all':!![]}];}_0x427398=_[_0x3b1b('0x3b')]({},_0x427398,_0x577c8e[_0x3b1b('0x3e')]);return db[_0x3b1b('0x2a')][_0x3b1b('0x46')](_0x427398)['then'](handleEntityNotFound(_0x1254fc,null))[_0x3b1b('0x23')](respondWithResult(_0x1254fc,null))[_0x3b1b('0x43')](handleError(_0x1254fc,null));};exports['create']=function(_0x3dc24d,_0x56b461){return db[_0x3b1b('0x2a')]['create'](_0x3dc24d[_0x3b1b('0x47')],{})['then'](function(_0x5d0dbe){var _0x2d1c87=_0x3dc24d[_0x3b1b('0x48')][_0x3b1b('0x24')]({'plain':!![]});if(!_0x2d1c87)throw new Error(_0x3b1b('0x49'));if(_0x2d1c87[_0x3b1b('0x4a')]===_0x3b1b('0x48')){var _0x47fb56=_0x5d0dbe['get']({'plain':!![]});var _0x559007='Reports';return db[_0x3b1b('0x4b')][_0x3b1b('0x46')]({'where':{'name':_0x559007,'userProfileId':_0x2d1c87['userProfileId']},'raw':!![]})[_0x3b1b('0x23')](function(_0x5a1d33){if(_0x5a1d33&&_0x5a1d33['autoAssociation']===0x0){return db[_0x3b1b('0x26')][_0x3b1b('0x4c')]({'name':_0x47fb56[_0x3b1b('0x28')],'resourceId':_0x47fb56['id'],'type':_0x3b1b('0x25'),'sectionId':_0x5a1d33['id']},{})['then'](function(){return _0x5d0dbe;});}else{return _0x5d0dbe;}})[_0x3b1b('0x43')](function(_0x309cc8){logger[_0x3b1b('0x4d')](_0x3b1b('0x4e'),_0x309cc8);throw _0x309cc8;});}return _0x5d0dbe;})['then'](respondWithResult(_0x56b461,0xc9))['catch'](handleError(_0x56b461,null));};exports[_0x3b1b('0x21')]=function(_0x46bd65,_0x25dc74){if(_0x46bd65['body']['id']){delete _0x46bd65['body']['id'];}return db['AnalyticCustomReport'][_0x3b1b('0x46')]({'where':{'id':_0x46bd65[_0x3b1b('0x44')]['id']}})[_0x3b1b('0x23')](handleEntityNotFound(_0x25dc74,null))[_0x3b1b('0x23')](saveUpdates(_0x46bd65['body'],null))[_0x3b1b('0x23')](respondWithResult(_0x25dc74,null))[_0x3b1b('0x43')](handleError(_0x25dc74,null));};exports[_0x3b1b('0x22')]=function(_0x1033b5,_0x434507){return db[_0x3b1b('0x2a')][_0x3b1b('0x46')]({'where':{'id':_0x1033b5[_0x3b1b('0x44')]['id']}})['then'](handleEntityNotFound(_0x434507,null))[_0x3b1b('0x23')](removeEntity(_0x434507,null))[_0x3b1b('0x43')](handleError(_0x434507,null));};exports['preview']=function(_0x62ff1d,_0x5862c6){var _0x348de8=0xa;var _0x5845a5=[_0x3b1b('0x4f'),_0x3b1b('0x50'),_0x3b1b('0x51'),_0x3b1b('0x52')];var _0x17b16f={'SUM':_0x3b1b('0x53'),'COUNT':_0x3b1b('0x54'),'COUNT DISTINCT':_0x3b1b('0x55'),'MAX':_0x3b1b('0x56'),'MIN':'MIN(%s)','AVG':_0x3b1b('0x57'),'GROUP_CONCAT':_0x3b1b('0x58'),'GROUP_CONCAT ASC':_0x3b1b('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2266f7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3b1b('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x3b1b('0x5b'),'UNIX_TIMESTAMP':_0x3b1b('0x5c')};var _0x472a38=function(_0x417fa5){return!_['includes']([_0x3b1b('0x5d'),'IS\x20NOT\x20NULL',_0x3b1b('0x5e'),'IS\x20NOT\x20EMPTY'],_0x417fa5);};var _0x3cbf9d=function(_0x398716){if(!_0x398716||!_0x398716[_0x3b1b('0x5f')]['length']){return'';}for(var _0x3b84ab='(',_0xfd0432=0x0;_0xfd0432<_0x398716['rules'][_0x3b1b('0x60')];_0xfd0432+=0x1){_0xfd0432>0x0&&(_0x3b84ab+='\x20'+_0x398716[_0x3b1b('0x61')]+'\x20');_0x3b84ab+=_0x398716['rules'][_0xfd0432]['group']?_0x3cbf9d(_0x398716[_0x3b1b('0x5f')][_0xfd0432]['group']):_0x398716[_0x3b1b('0x5f')][_0xfd0432][_0x3b1b('0x62')]+'\x20'+_0x398716[_0x3b1b('0x5f')][_0xfd0432]['condition']+(_0x472a38(_0x398716['rules'][_0xfd0432][_0x3b1b('0x63')])?'\x20'+_0x398716['rules'][_0xfd0432][_0x3b1b('0x64')]:'');}return _0x3b84ab+')';};var _0x1fe399={'where':{'id':_0x62ff1d[_0x3b1b('0x44')]['id']}},_0x2eb7c1,_0x3b7520,_0x34bc03,_0x2cd63f,_0x43c41c;_0x1fe399=_[_0x3b1b('0x3b')]({},_0x1fe399,_0x62ff1d[_0x3b1b('0x3e')]);return db[_0x3b1b('0x2a')]['find'](_0x1fe399)[_0x3b1b('0x23')](function(_0x313072){if(_0x313072){_0x2eb7c1=_0x313072;return _0x313072['getFields']();}return null;})[_0x3b1b('0x23')](function(_0x4e291b){if(_0x4e291b){if(!_0x4e291b['length']){throw new db[(_0x3b1b('0x65'))][(_0x3b1b('0x66'))](_0x3b1b('0x67'),0x193);}_0x3b7520=_0x4e291b;return db['AnalyticMetric'][_0x3b1b('0x41')]({'raw':!![]});}return null;})[_0x3b1b('0x23')](function(_0x43d16b){if(_0x43d16b){_0x34bc03=_[_0x3b1b('0x68')](_0x43d16b,'id');var _0x36c495;var _0xb92c43=squel['select']();_0xb92c43[_0x3b1b('0x69')](_0x2eb7c1['table']);for(var _0x46bca9=0x0;_0x46bca9<_0x3b7520[_0x3b1b('0x60')];_0x46bca9+=0x1){_0x36c495=_0x3b7520[_0x46bca9]['MetricId']?_0x34bc03[_0x3b7520[_0x46bca9][_0x3b1b('0x6a')]][_0x3b1b('0x6b')]:_0x3b7520[_0x46bca9]['field'];_0x36c495=_0x3b7520[_0x46bca9][_0x3b1b('0x6c')]?_[_0x3b1b('0x6d')](_0x17b16f[_0x3b7520[_0x46bca9][_0x3b1b('0x6c')]],'%s',_0x36c495):_0x36c495;_0x36c495=_0x3b7520[_0x46bca9][_0x3b1b('0x6e')]?_[_0x3b1b('0x6d')](_0x2266f7[_0x3b7520[_0x46bca9][_0x3b1b('0x6e')]],'%s',_0x36c495):_0x36c495;if(_0x3b7520[_0x46bca9][_0x3b1b('0x6f')]){_0xb92c43[_0x3b1b('0x70')](_0x36c495);}_0x3b7520[_0x46bca9][_0x3b1b('0x71')]&&_0xb92c43['order'](_0x36c495,_0x3b7520[_0x46bca9]['orderBy']===_0x3b1b('0x72')?![]:!![]);_0xb92c43['field'](_0x36c495,_0x3b7520[_0x46bca9][_0x3b1b('0x73')]||_0x36c495);}if(_0x2eb7c1['joins']){_0x2eb7c1[_0x3b1b('0x74')]=JSON['parse'](_0x2eb7c1[_0x3b1b('0x74')]);for(var _0xce1b2f=0x0;_0xce1b2f<_0x2eb7c1[_0x3b1b('0x74')][_0x3b1b('0x60')];_0xce1b2f+=0x1){if(_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f]['type']&&_['includes'](_0x5845a5,_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f][_0x3b1b('0x2c')])&&_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f][_0x3b1b('0x75')]&&_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f]['foreignTable']&&_0x2eb7c1['joins'][_0xce1b2f][_0x3b1b('0x76')]){_0xb92c43[_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f][_0x3b1b('0x2c')]](_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f][_0x3b1b('0x77')],null,util[_0x3b1b('0x6e')](_0x3b1b('0x78'),_0x2eb7c1[_0x3b1b('0x79')],_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f][_0x3b1b('0x75')],_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f][_0x3b1b('0x77')],_0x2eb7c1[_0x3b1b('0x74')][_0xce1b2f]['foreignKey']));}}}if(_0x2eb7c1[_0x3b1b('0x7a')]){_0x2eb7c1['conditions']=JSON['parse'](_0x2eb7c1[_0x3b1b('0x7a')]);_0xb92c43[_0x3b1b('0x37')](_0x3cbf9d(_0x2eb7c1[_0x3b1b('0x7a')]['group']));}_0x43c41c=_0xb92c43['clone']();_0xb92c43[_0x3b1b('0x19')](_0x348de8);_0xb92c43['offset'](0x0);logger[_0x3b1b('0x7b')](_0x3b1b('0x7c'),_0xb92c43['toString']());return dbH[_0x3b1b('0x7d')]['query'](_0xb92c43[_0x3b1b('0x7e')](),{'type':dbH[_0x3b1b('0x7d')][_0x3b1b('0x7f')][_0x3b1b('0x80')]});}})[_0x3b1b('0x23')](respondWithResult(_0x5862c6,null))['catch'](handleError(_0x5862c6,null));};function runReport(_0x381f0e,_0xd0b313,_0x959b81){var _0x34c041=_0xd0b313[_0x3b1b('0x28')];var _0x2d059b=0xa;var _0x5f53e0=['join',_0x3b1b('0x50'),_0x3b1b('0x51'),_0x3b1b('0x52')];var _0x36c12d={'SUM':_0x3b1b('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3b1b('0x55'),'MAX':'MAX(%s)','MIN':_0x3b1b('0x81'),'AVG':_0x3b1b('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3b1b('0x59'),'GROUP_CONCAT DESC':_0x3b1b('0x82')};var _0x5a3b17={'SEC_TO_TIME':_0x3b1b('0x83'),'DATE':_0x3b1b('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x582f68=function(_0x3329e5){return!_[_0x3b1b('0x84')](['IS\x20NULL',_0x3b1b('0x85'),_0x3b1b('0x5e'),_0x3b1b('0x86')],_0x3329e5);};var _0x360a7c=function(_0x152c71){if(!_0x152c71||!_0x152c71['rules'][_0x3b1b('0x60')]){return'';}for(var _0x37bab5='(',_0x5c75b2=0x0;_0x5c75b2<_0x152c71['rules'][_0x3b1b('0x60')];_0x5c75b2+=0x1){_0x5c75b2>0x0&&(_0x37bab5+='\x20'+_0x152c71['operator']+'\x20');_0x37bab5+=_0x152c71[_0x3b1b('0x5f')][_0x5c75b2]['group']?_0x360a7c(_0x152c71[_0x3b1b('0x5f')][_0x5c75b2][_0x3b1b('0x70')]):_0x152c71[_0x3b1b('0x5f')][_0x5c75b2][_0x3b1b('0x62')]+'\x20'+_0x152c71[_0x3b1b('0x5f')][_0x5c75b2][_0x3b1b('0x63')]+(_0x582f68(_0x152c71[_0x3b1b('0x5f')][_0x5c75b2][_0x3b1b('0x63')])?'\x20'+_0x152c71[_0x3b1b('0x5f')][_0x5c75b2][_0x3b1b('0x64')]:'');}return _0x37bab5+')';};var _0x439557={'where':{'id':_0x381f0e['id']}},_0x1f6407,_0x123519,_0x5227c2,_0x18064f,_0x19a8fb;_0x439557=_['merge']({},_0x439557,_0x959b81);return db[_0x3b1b('0x2a')][_0x3b1b('0x46')](_0x439557)[_0x3b1b('0x23')](function(_0x525aac){if(_0x525aac){_0x1f6407=_0x525aac;return _0x525aac[_0x3b1b('0x87')]();}return null;})[_0x3b1b('0x23')](function(_0x31cbbb){if(_0x31cbbb){if(!_0x31cbbb[_0x3b1b('0x60')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x123519=_0x31cbbb;return db[_0x3b1b('0x88')]['findAll']({'raw':!![]});}return null;})[_0x3b1b('0x23')](function(_0x59d7b9){if(_0x59d7b9){_0x5227c2=_[_0x3b1b('0x68')](_0x59d7b9,'id');var _0x281c77;var _0x155ef=squel[_0x3b1b('0x89')]();_0x155ef[_0x3b1b('0x69')](_0x1f6407[_0x3b1b('0x79')]);for(var _0x3319df=0x0;_0x3319df<_0x123519[_0x3b1b('0x60')];_0x3319df+=0x1){_0x281c77=_0x123519[_0x3319df][_0x3b1b('0x6a')]?_0x5227c2[_0x123519[_0x3319df][_0x3b1b('0x6a')]]['metric']:_0x123519[_0x3319df][_0x3b1b('0x62')];_0x281c77=_0x123519[_0x3319df][_0x3b1b('0x6c')]?_[_0x3b1b('0x6d')](_0x36c12d[_0x123519[_0x3319df][_0x3b1b('0x6c')]],'%s',_0x281c77):_0x281c77;_0x281c77=_0x123519[_0x3319df][_0x3b1b('0x6e')]?_[_0x3b1b('0x6d')](_0x5a3b17[_0x123519[_0x3319df][_0x3b1b('0x6e')]],'%s',_0x281c77):_0x281c77;if(_0x123519[_0x3319df]['groupBy']){_0x155ef[_0x3b1b('0x70')](_0x281c77);}_0x123519[_0x3319df][_0x3b1b('0x71')]&&_0x155ef[_0x3b1b('0x8a')](_0x281c77,_0x123519[_0x3319df][_0x3b1b('0x71')]===_0x3b1b('0x72')?![]:!![]);_0x155ef[_0x3b1b('0x62')](_0x281c77,_0x123519[_0x3319df]['alias']||_0x281c77);}if(_0x1f6407[_0x3b1b('0x74')]){_0x1f6407[_0x3b1b('0x74')]=JSON['parse'](_0x1f6407[_0x3b1b('0x74')]);for(var _0x20463b=0x0;_0x20463b<_0x1f6407['joins'][_0x3b1b('0x60')];_0x20463b+=0x1){if(_0x1f6407[_0x3b1b('0x74')][_0x20463b]['type']&&_[_0x3b1b('0x84')](_0x5f53e0,_0x1f6407[_0x3b1b('0x74')][_0x20463b][_0x3b1b('0x2c')])&&_0x1f6407[_0x3b1b('0x74')][_0x20463b]['parentKey']&&_0x1f6407[_0x3b1b('0x74')][_0x20463b]['foreignTable']&&_0x1f6407['joins'][_0x20463b][_0x3b1b('0x76')]){_0x155ef[_0x1f6407[_0x3b1b('0x74')][_0x20463b]['type']](_0x1f6407['joins'][_0x20463b]['foreignTable'],null,util[_0x3b1b('0x6e')](_0x3b1b('0x78'),_0x1f6407[_0x3b1b('0x79')],_0x1f6407[_0x3b1b('0x74')][_0x20463b][_0x3b1b('0x75')],_0x1f6407['joins'][_0x20463b][_0x3b1b('0x77')],_0x1f6407[_0x3b1b('0x74')][_0x20463b][_0x3b1b('0x76')]));}}}if(_0x1f6407[_0x3b1b('0x7a')]){_0x1f6407[_0x3b1b('0x7a')]=JSON['parse'](_0x1f6407[_0x3b1b('0x7a')]);_0x155ef[_0x3b1b('0x37')](_0x360a7c(_0x1f6407[_0x3b1b('0x7a')][_0x3b1b('0x70')]));}_0x19a8fb=_0x155ef[_0x3b1b('0x8b')]();_0x155ef[_0x3b1b('0x19')](_0x2d059b);_0x155ef[_0x3b1b('0x1c')](0x0);return;}})['then'](function(){if(_0xd0b313[_0x3b1b('0x8c')]===_0x3b1b('0x8d')){return null;}var _0xbcc82b=_[_0x3b1b('0x3b')](_0xd0b313,{'name':_0xd0b313[_0x3b1b('0x8e')]||_0xd0b313[_0x3b1b('0x28')]||_0x1f6407[_0x3b1b('0x28')],'basename':_0x34c041,'savename':util[_0x3b1b('0x6e')](_0x3b1b('0x8f'),_0xd0b313[_0x3b1b('0x28')]||_0x1f6407['name'],require(_0x3b1b('0x90'))['generate'](0x4),_0xd0b313['output']||_0x3b1b('0x91')),'reportId':_0x1f6407['id'],'reportType':_0x3b1b('0x92')});return db[_0x3b1b('0x93')][_0x3b1b('0x4c')](_0xbcc82b,{'raw':!![]});})[_0x3b1b('0x23')](function(_0x5216a4){if(_0x1f6407['table']===_0x3b1b('0x94')){_0x19a8fb[_0x3b1b('0x37')](_0x1f6407[_0x3b1b('0x79')]+_0x3b1b('0x95'),_0xd0b313[_0x3b1b('0x96')],_0xd0b313[_0x3b1b('0x97')]);}else{_0x19a8fb[_0x3b1b('0x37')](_0x1f6407[_0x3b1b('0x79')]+_0x3b1b('0x98'),_0xd0b313[_0x3b1b('0x96')],_0xd0b313[_0x3b1b('0x97')]);}if(_0x5216a4){logger[_0x3b1b('0x99')](_0x3b1b('0x9a'),_0x19a8fb[_0x3b1b('0x7e')]());require('child_process')['fork'](path[_0x3b1b('0x4f')](__dirname,_0x3b1b('0x9b'),_0x5216a4[_0x3b1b('0x8c')]),[_0x5216a4['id'],_0x19a8fb[_0x3b1b('0x7e')](),path[_0x3b1b('0x4f')](__dirname,_0x3b1b('0x9c'),_0x5216a4[_0x3b1b('0x9d')]),_0x34c041]);return _0x5216a4;}else{var _0x5ad4f2=squel[_0x3b1b('0x89')]();_0x5ad4f2[_0x3b1b('0x69')]('('+_0x19a8fb['toString']()+')',_0x3b1b('0x9e'));_0x5ad4f2['field'](_0x3b1b('0x9f'),_0x3b1b('0x1b'));_0x19a8fb[_0x3b1b('0x19')](_0xd0b313[_0x3b1b('0x19')]||_0x2d059b);_0x19a8fb[_0x3b1b('0x1c')](_0xd0b313['offset']||0x0);return dbH['sequelize']['query'](_0x5ad4f2['toString'](),{'type':dbH[_0x3b1b('0x7d')][_0x3b1b('0x7f')][_0x3b1b('0x80')]})[_0x3b1b('0x23')](function(_0x1b0dc8){if(!_0x1b0dc8[_0x3b1b('0x60')]){_0x18064f=0x0;}else{_0x18064f=_0x1b0dc8[0x0][_0x3b1b('0x1b')]||0x0;}return dbH[_0x3b1b('0x7d')][_0x3b1b('0x2e')](_0x19a8fb[_0x3b1b('0x7e')](),{'type':dbH[_0x3b1b('0x7d')][_0x3b1b('0x7f')]['SELECT']});})[_0x3b1b('0x23')](function(_0xc3c283){return{'rows':_0xc3c283||[],'count':_0x18064f};});}});}exports[_0x3b1b('0xa0')]=function(_0x5b89cf,_0x31549f){return runReport(_0x5b89cf[_0x3b1b('0x44')],_0x5b89cf[_0x3b1b('0x2e')],_0x5b89cf[_0x3b1b('0x3e')])[_0x3b1b('0x23')](respondWithResult(_0x31549f,null))[_0x3b1b('0x43')](handleError(_0x31549f,null));};exports['runReport']=runReport;exports['query']=function(_0x43e244,_0x403952){var _0x243caf=0xa;var _0x238941=[_0x3b1b('0x4f'),_0x3b1b('0x50'),_0x3b1b('0x51'),'cross_join'];var _0x6e64d9={'SUM':_0x3b1b('0x53'),'COUNT':_0x3b1b('0x54'),'COUNT DISTINCT':_0x3b1b('0x55'),'MAX':_0x3b1b('0x56'),'MIN':_0x3b1b('0x81'),'AVG':_0x3b1b('0x57'),'GROUP_CONCAT':_0x3b1b('0x58'),'GROUP_CONCAT ASC':_0x3b1b('0x59'),'GROUP_CONCAT DESC':_0x3b1b('0x82')};var _0x12231a={'SEC_TO_TIME':_0x3b1b('0x83'),'DATE':_0x3b1b('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x3b1b('0x5b'),'UNIX_TIMESTAMP':_0x3b1b('0x5c')};var _0x443134=function(_0x83742f){return!_['includes']([_0x3b1b('0x5d'),'IS\x20NOT\x20NULL',_0x3b1b('0x5e'),_0x3b1b('0x86')],_0x83742f);};var _0x533068=function(_0xec6b00){if(!_0xec6b00||!_0xec6b00[_0x3b1b('0x5f')][_0x3b1b('0x60')]){return'';}for(var _0x3bba03='(',_0x4812e9=0x0;_0x4812e9<_0xec6b00[_0x3b1b('0x5f')][_0x3b1b('0x60')];_0x4812e9+=0x1){_0x4812e9>0x0&&(_0x3bba03+='\x20'+_0xec6b00[_0x3b1b('0x61')]+'\x20');_0x3bba03+=_0xec6b00[_0x3b1b('0x5f')][_0x4812e9]['group']?_0x533068(_0xec6b00[_0x3b1b('0x5f')][_0x4812e9][_0x3b1b('0x70')]):_0xec6b00['rules'][_0x4812e9][_0x3b1b('0x62')]+'\x20'+_0xec6b00[_0x3b1b('0x5f')][_0x4812e9]['condition']+(_0x443134(_0xec6b00[_0x3b1b('0x5f')][_0x4812e9][_0x3b1b('0x63')])?'\x20'+_0xec6b00[_0x3b1b('0x5f')][_0x4812e9][_0x3b1b('0x64')]:'');}return _0x3bba03+')';};var _0x1c49d3={'where':{'id':_0x43e244['params']['id']}},_0x359669,_0x8b215e,_0x12b788,_0x3460dc,_0x4113c6;_0x1c49d3=_[_0x3b1b('0x3b')]({},_0x1c49d3,_0x43e244[_0x3b1b('0x3e')]);return db[_0x3b1b('0x2a')][_0x3b1b('0x46')](_0x1c49d3)[_0x3b1b('0x23')](function(_0x569902){if(_0x569902){_0x359669=_0x569902;return _0x569902[_0x3b1b('0x87')]();}return null;})['then'](function(_0x331285){if(_0x331285){if(!_0x331285[_0x3b1b('0x60')]){throw new db[(_0x3b1b('0x65'))][(_0x3b1b('0x66'))](_0x3b1b('0x67'),0x193);}_0x8b215e=_0x331285;return db['AnalyticMetric'][_0x3b1b('0x41')]({'raw':!![]});}return null;})['then'](function(_0x1cb56b){if(_0x1cb56b){_0x12b788=_['keyBy'](_0x1cb56b,'id');var _0x5c53ee;var _0x21ea23=squel[_0x3b1b('0x89')]();_0x21ea23[_0x3b1b('0x69')](_0x359669[_0x3b1b('0x79')]);for(var _0x411e04=0x0;_0x411e04<_0x8b215e[_0x3b1b('0x60')];_0x411e04+=0x1){_0x5c53ee=_0x8b215e[_0x411e04][_0x3b1b('0x6a')]?_0x12b788[_0x8b215e[_0x411e04]['MetricId']][_0x3b1b('0x6b')]:_0x8b215e[_0x411e04]['field'];_0x5c53ee=_0x8b215e[_0x411e04][_0x3b1b('0x6c')]?_[_0x3b1b('0x6d')](_0x6e64d9[_0x8b215e[_0x411e04][_0x3b1b('0x6c')]],'%s',_0x5c53ee):_0x5c53ee;_0x5c53ee=_0x8b215e[_0x411e04][_0x3b1b('0x6e')]?_[_0x3b1b('0x6d')](_0x12231a[_0x8b215e[_0x411e04][_0x3b1b('0x6e')]],'%s',_0x5c53ee):_0x5c53ee;if(_0x8b215e[_0x411e04]['groupBy']){_0x21ea23[_0x3b1b('0x70')](_0x5c53ee);}_0x8b215e[_0x411e04][_0x3b1b('0x71')]&&_0x21ea23[_0x3b1b('0x8a')](_0x5c53ee,_0x8b215e[_0x411e04][_0x3b1b('0x71')]===_0x3b1b('0x72')?![]:!![]);_0x21ea23[_0x3b1b('0x62')](_0x5c53ee,_0x8b215e[_0x411e04][_0x3b1b('0x73')]||_0x5c53ee);}if(_0x359669[_0x3b1b('0x74')]){_0x359669['joins']=JSON[_0x3b1b('0xa1')](_0x359669[_0x3b1b('0x74')]);for(var _0x13b215=0x0;_0x13b215<_0x359669[_0x3b1b('0x74')]['length'];_0x13b215+=0x1){if(_0x359669[_0x3b1b('0x74')][_0x13b215]['type']&&_[_0x3b1b('0x84')](_0x238941,_0x359669['joins'][_0x13b215][_0x3b1b('0x2c')])&&_0x359669[_0x3b1b('0x74')][_0x13b215][_0x3b1b('0x75')]&&_0x359669[_0x3b1b('0x74')][_0x13b215]['foreignTable']&&_0x359669[_0x3b1b('0x74')][_0x13b215]['foreignKey']){_0x21ea23[_0x359669[_0x3b1b('0x74')][_0x13b215]['type']](_0x359669[_0x3b1b('0x74')][_0x13b215][_0x3b1b('0x77')],null,util[_0x3b1b('0x6e')](_0x3b1b('0x78'),_0x359669[_0x3b1b('0x79')],_0x359669['joins'][_0x13b215][_0x3b1b('0x75')],_0x359669[_0x3b1b('0x74')][_0x13b215][_0x3b1b('0x77')],_0x359669['joins'][_0x13b215]['foreignKey']));}}}if(_0x359669[_0x3b1b('0x7a')]){_0x359669['conditions']=JSON[_0x3b1b('0xa1')](_0x359669[_0x3b1b('0x7a')]);_0x21ea23[_0x3b1b('0x37')](_0x533068(_0x359669[_0x3b1b('0x7a')][_0x3b1b('0x70')]));}_0x4113c6=_0x21ea23[_0x3b1b('0x8b')]();_0x21ea23['limit'](_0x243caf);_0x21ea23[_0x3b1b('0x1c')](0x0);logger[_0x3b1b('0x7b')](_0x3b1b('0x7c'),_0x21ea23[_0x3b1b('0x7e')]());return dbH[_0x3b1b('0x7d')][_0x3b1b('0x2e')](_0x21ea23[_0x3b1b('0x7e')](),{'type':dbH[_0x3b1b('0x7d')][_0x3b1b('0x7f')][_0x3b1b('0x80')]});}})[_0x3b1b('0x23')](function(){return{'sql':_0x4113c6[_0x3b1b('0x7e')]()};})[_0x3b1b('0x23')](respondWithResult(_0x403952,null))[_0x3b1b('0x43')](handleError(_0x403952,null));}; \ No newline at end of file +var _0x4e98=['../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','AnalyticCustomReport','count','includeAll','include','rows','params','keys','intersection','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','right_join','cross_join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20NULL','IS\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','orderBy','parse','web','%s-%s.%s','randomstring','output','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','Sequelize','Limited\x20Query:','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x5be2a3,_0x339d9a){var _0x3157e3=function(_0x570fc0){while(--_0x570fc0){_0x5be2a3['push'](_0x5be2a3['shift']());}};_0x3157e3(++_0x339d9a);}(_0x4e98,0x8f));var _0x84e9=function(_0x2177fd,_0x49448e){_0x2177fd=_0x2177fd-0x0;var _0x5bd5d7=_0x4e98[_0x2177fd];return _0x5bd5d7;};'use strict';var emlformat=require(_0x84e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84e9('0x1'));var jsonpatch=require(_0x84e9('0x2'));var rp=require('request-promise');var moment=require(_0x84e9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x84e9('0x4'));var util=require(_0x84e9('0x5'));var path=require(_0x84e9('0x6'));var sox=require(_0x84e9('0x7'));var csv=require(_0x84e9('0x8'));var ejs=require(_0x84e9('0x9'));var fs=require('fs');var fs_extra=require(_0x84e9('0xa'));var _=require('lodash');var squel=require(_0x84e9('0xb'));var crypto=require('crypto');var jsforce=require(_0x84e9('0xc'));var deskjs=require(_0x84e9('0xd'));var toCsv=require(_0x84e9('0x8'));var querystring=require(_0x84e9('0xe'));var Papa=require(_0x84e9('0xf'));var Redis=require(_0x84e9('0x10'));var authService=require(_0x84e9('0x11'));var qs=require(_0x84e9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84e9('0x13'));var logger=require(_0x84e9('0x14'))(_0x84e9('0x15'));var utils=require('../../config/utils');var config=require(_0x84e9('0x16'));var licenseUtil=require(_0x84e9('0x17'));var db=require(_0x84e9('0x18'))['db'];var dbH=require('../../mysqldb')[_0x84e9('0x19')];function respondWithStatusCode(_0x1d8f9a,_0xce7fb3){_0xce7fb3=_0xce7fb3||0xcc;return function(_0x7b2aa){if(_0x7b2aa){return _0x1d8f9a[_0x84e9('0x1a')](_0xce7fb3);}return _0x1d8f9a[_0x84e9('0x1b')](_0xce7fb3)[_0x84e9('0x1c')]();};}function respondWithResult(_0x220c8a,_0x1a9676){_0x1a9676=_0x1a9676||0xc8;return function(_0x2b30b7){if(_0x2b30b7){return _0x220c8a[_0x84e9('0x1b')](_0x1a9676)[_0x84e9('0x1d')](_0x2b30b7);}};}function respondWithFilteredResult(_0x11fa66,_0x1dbe71){return function(_0x5a1934){if(_0x5a1934){var _0x2baeeb=typeof _0x1dbe71[_0x84e9('0x1e')]===_0x84e9('0x1f')&&typeof _0x1dbe71[_0x84e9('0x20')]===_0x84e9('0x1f');var _0x1e68b9=_0x5a1934['count'];var _0x24291b=_0x2baeeb?0x0:_0x1dbe71[_0x84e9('0x1e')];var _0x543746=_0x2baeeb?_0x5a1934['count']:_0x1dbe71['offset']+_0x1dbe71[_0x84e9('0x20')];var _0x57b756;if(_0x543746>=_0x1e68b9){_0x543746=_0x1e68b9;_0x57b756=0xc8;}else{_0x57b756=0xce;}_0x11fa66[_0x84e9('0x1b')](_0x57b756);return _0x11fa66[_0x84e9('0x21')](_0x84e9('0x22'),_0x24291b+'-'+_0x543746+'/'+_0x1e68b9)[_0x84e9('0x1d')](_0x5a1934);}return null;};}function patchUpdates(_0x575f4a){return function(_0xb403f6){try{jsonpatch[_0x84e9('0x23')](_0xb403f6,_0x575f4a,!![]);}catch(_0x278216){return BPromise[_0x84e9('0x24')](_0x278216);}return _0xb403f6[_0x84e9('0x25')]();};}function saveUpdates(_0x15681b,_0x14ccf5){return function(_0x225e83){if(_0x225e83){return _0x225e83[_0x84e9('0x26')](_0x15681b)[_0x84e9('0x27')](function(_0x567fd8){return _0x567fd8;});}return null;};}function removeEntity(_0x29eff9,_0x34491c){return function(_0x4c3823){if(_0x4c3823){return _0x4c3823[_0x84e9('0x28')]()[_0x84e9('0x27')](function(){var _0x3a7539=_0x4c3823[_0x84e9('0x29')]({'plain':!![]});var _0x4b8881='CustomReports';return db['UserProfileResource'][_0x84e9('0x28')]({'where':{'type':_0x4b8881,'resourceId':_0x3a7539['id']}})['then'](function(){return _0x4c3823;});})[_0x84e9('0x27')](function(){_0x29eff9[_0x84e9('0x1b')](0xcc)[_0x84e9('0x1c')]();});}};}function handleEntityNotFound(_0x1942ad,_0x5b77e7){return function(_0x5df331){if(!_0x5df331){_0x1942ad[_0x84e9('0x1a')](0x194);}return _0x5df331;};}function handleError(_0x4b98d3,_0x1d8b02){_0x1d8b02=_0x1d8b02||0x1f4;return function(_0x211bb8){logger[_0x84e9('0x2a')](_0x211bb8[_0x84e9('0x2b')]);if(_0x211bb8[_0x84e9('0x2c')]){delete _0x211bb8[_0x84e9('0x2c')];}_0x4b98d3[_0x84e9('0x1b')](_0x1d8b02)['send'](_0x211bb8);};}exports[_0x84e9('0x2d')]=function(_0x4c952e,_0x41c255){var _0x122767={},_0x5c6137={},_0x3da6ff={'count':0x0,'rows':[]};var _0x56517c=_['map'](db['AnalyticCustomReport'][_0x84e9('0x2e')],function(_0x404848){return{'name':_0x404848[_0x84e9('0x2f')],'type':_0x404848[_0x84e9('0x30')][_0x84e9('0x31')]};});_0x5c6137[_0x84e9('0x32')]=_[_0x84e9('0x33')](_0x56517c,_0x84e9('0x2c'));_0x5c6137[_0x84e9('0x34')]=_['keys'](_0x4c952e[_0x84e9('0x34')]);_0x5c6137['filters']=_['intersection'](_0x5c6137[_0x84e9('0x32')],_0x5c6137[_0x84e9('0x34')]);_0x122767[_0x84e9('0x35')]=_['intersection'](_0x5c6137[_0x84e9('0x32')],qs[_0x84e9('0x36')](_0x4c952e[_0x84e9('0x34')]['fields']));_0x122767[_0x84e9('0x35')]=_0x122767[_0x84e9('0x35')][_0x84e9('0x37')]?_0x122767[_0x84e9('0x35')]:_0x5c6137[_0x84e9('0x32')];if(!_0x4c952e['query'][_0x84e9('0x38')](_0x84e9('0x39'))){_0x122767[_0x84e9('0x20')]=qs[_0x84e9('0x20')](_0x4c952e[_0x84e9('0x34')][_0x84e9('0x20')]);_0x122767['offset']=qs[_0x84e9('0x1e')](_0x4c952e[_0x84e9('0x34')][_0x84e9('0x1e')]);}_0x122767[_0x84e9('0x3a')]=qs[_0x84e9('0x3b')](_0x4c952e[_0x84e9('0x34')]['sort']);_0x122767[_0x84e9('0x3c')]=qs[_0x84e9('0x3d')](_[_0x84e9('0x3e')](_0x4c952e[_0x84e9('0x34')],_0x5c6137[_0x84e9('0x3d')]),_0x56517c);if(_0x4c952e[_0x84e9('0x34')][_0x84e9('0x3f')]){_0x122767['where']=_[_0x84e9('0x40')](_0x122767[_0x84e9('0x3c')],{'$or':_[_0x84e9('0x33')](_0x56517c,function(_0x1fc8b7){if(_0x1fc8b7[_0x84e9('0x30')]!=='VIRTUAL'){var _0x53efc0={};_0x53efc0[_0x1fc8b7[_0x84e9('0x2c')]]={'$like':'%'+_0x4c952e[_0x84e9('0x34')]['filter']+'%'};return _0x53efc0;}})});}_0x122767=_['merge']({},_0x122767,_0x4c952e[_0x84e9('0x41')]);var _0x3875d2={'where':_0x122767[_0x84e9('0x3c')]};return db[_0x84e9('0x42')]['count'](_0x3875d2)[_0x84e9('0x27')](function(_0x32c30d){_0x3da6ff[_0x84e9('0x43')]=_0x32c30d;if(_0x4c952e[_0x84e9('0x34')][_0x84e9('0x44')]){_0x122767[_0x84e9('0x45')]=[{'all':!![]}];}return db[_0x84e9('0x42')]['findAll'](_0x122767);})[_0x84e9('0x27')](function(_0x496fb5){_0x3da6ff[_0x84e9('0x46')]=_0x496fb5;return _0x3da6ff;})[_0x84e9('0x27')](respondWithFilteredResult(_0x41c255,_0x122767))['catch'](handleError(_0x41c255,null));};exports['show']=function(_0x1211c5,_0x295c7e){var _0x58357f={'raw':![],'where':{'id':_0x1211c5[_0x84e9('0x47')]['id']}},_0x3dc52f={};_0x3dc52f['model']=_[_0x84e9('0x48')](db[_0x84e9('0x42')][_0x84e9('0x2e')]);_0x3dc52f[_0x84e9('0x34')]=_['keys'](_0x1211c5[_0x84e9('0x34')]);_0x3dc52f['filters']=_[_0x84e9('0x49')](_0x3dc52f[_0x84e9('0x32')],_0x3dc52f[_0x84e9('0x34')]);_0x58357f[_0x84e9('0x35')]=_[_0x84e9('0x49')](_0x3dc52f[_0x84e9('0x32')],qs['fields'](_0x1211c5[_0x84e9('0x34')][_0x84e9('0x36')]));_0x58357f[_0x84e9('0x35')]=_0x58357f[_0x84e9('0x35')][_0x84e9('0x37')]?_0x58357f[_0x84e9('0x35')]:_0x3dc52f[_0x84e9('0x32')];if(_0x1211c5[_0x84e9('0x34')][_0x84e9('0x44')]){_0x58357f['include']=[{'all':!![]}];}_0x58357f=_['merge']({},_0x58357f,_0x1211c5[_0x84e9('0x41')]);return db['AnalyticCustomReport']['find'](_0x58357f)[_0x84e9('0x27')](handleEntityNotFound(_0x295c7e,null))[_0x84e9('0x27')](respondWithResult(_0x295c7e,null))[_0x84e9('0x4a')](handleError(_0x295c7e,null));};exports['create']=function(_0x11c052,_0x835779){return db['AnalyticCustomReport'][_0x84e9('0x4b')](_0x11c052[_0x84e9('0x4c')],{})[_0x84e9('0x27')](function(_0x15ee4a){var _0x3bb939=_0x11c052[_0x84e9('0x4d')][_0x84e9('0x29')]({'plain':!![]});if(!_0x3bb939)throw new Error(_0x84e9('0x4e'));if(_0x3bb939[_0x84e9('0x4f')]===_0x84e9('0x4d')){var _0x28b6c3=_0x15ee4a['get']({'plain':!![]});var _0x305cfe=_0x84e9('0x50');return db[_0x84e9('0x51')][_0x84e9('0x52')]({'where':{'name':_0x305cfe,'userProfileId':_0x3bb939[_0x84e9('0x53')]},'raw':!![]})[_0x84e9('0x27')](function(_0x24c214){if(_0x24c214&&_0x24c214[_0x84e9('0x54')]===0x0){return db[_0x84e9('0x55')][_0x84e9('0x4b')]({'name':_0x28b6c3[_0x84e9('0x2c')],'resourceId':_0x28b6c3['id'],'type':_0x84e9('0x56'),'sectionId':_0x24c214['id']},{})[_0x84e9('0x27')](function(){return _0x15ee4a;});}else{return _0x15ee4a;}})[_0x84e9('0x4a')](function(_0x2637d1){logger[_0x84e9('0x2a')](_0x84e9('0x57'),_0x2637d1);throw _0x2637d1;});}return _0x15ee4a;})['then'](respondWithResult(_0x835779,0xc9))['catch'](handleError(_0x835779,null));};exports[_0x84e9('0x26')]=function(_0x2087cb,_0x3a56e3){if(_0x2087cb['body']['id']){delete _0x2087cb[_0x84e9('0x4c')]['id'];}return db[_0x84e9('0x42')][_0x84e9('0x52')]({'where':{'id':_0x2087cb['params']['id']}})[_0x84e9('0x27')](handleEntityNotFound(_0x3a56e3,null))[_0x84e9('0x27')](saveUpdates(_0x2087cb[_0x84e9('0x4c')],null))[_0x84e9('0x27')](respondWithResult(_0x3a56e3,null))[_0x84e9('0x4a')](handleError(_0x3a56e3,null));};exports['destroy']=function(_0x227f32,_0x5c30ea){return db[_0x84e9('0x42')]['find']({'where':{'id':_0x227f32['params']['id']}})[_0x84e9('0x27')](handleEntityNotFound(_0x5c30ea,null))[_0x84e9('0x27')](removeEntity(_0x5c30ea,null))[_0x84e9('0x4a')](handleError(_0x5c30ea,null));};exports[_0x84e9('0x58')]=function(_0x23eae0,_0x3c86ad){var _0x544db3=0xa;var _0x2d1545=[_0x84e9('0x59'),_0x84e9('0x5a'),'right_join','cross_join'];var _0x1a8bdd={'SUM':_0x84e9('0x5b'),'COUNT':_0x84e9('0x5c'),'COUNT DISTINCT':_0x84e9('0x5d'),'MAX':_0x84e9('0x5e'),'MIN':_0x84e9('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x84e9('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x84e9('0x61')};var _0x553bf7={'SEC_TO_TIME':_0x84e9('0x62'),'DATE':'DATE(%s)','HOUR':_0x84e9('0x63'),'ROUND':_0x84e9('0x64'),'UNIX_TIMESTAMP':_0x84e9('0x65')};var _0x4a0c10=function(_0x248c0e){return!_[_0x84e9('0x66')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x84e9('0x67')],_0x248c0e);};var _0x57d1a7=function(_0x5e58ca){if(!_0x5e58ca||!_0x5e58ca[_0x84e9('0x68')][_0x84e9('0x37')]){return'';}for(var _0x1a0190='(',_0x13ad3d=0x0;_0x13ad3d<_0x5e58ca[_0x84e9('0x68')][_0x84e9('0x37')];_0x13ad3d+=0x1){_0x13ad3d>0x0&&(_0x1a0190+='\x20'+_0x5e58ca[_0x84e9('0x69')]+'\x20');_0x1a0190+=_0x5e58ca['rules'][_0x13ad3d][_0x84e9('0x6a')]?_0x57d1a7(_0x5e58ca['rules'][_0x13ad3d][_0x84e9('0x6a')]):_0x5e58ca[_0x84e9('0x68')][_0x13ad3d][_0x84e9('0x6b')]+'\x20'+_0x5e58ca[_0x84e9('0x68')][_0x13ad3d][_0x84e9('0x6c')]+(_0x4a0c10(_0x5e58ca[_0x84e9('0x68')][_0x13ad3d][_0x84e9('0x6c')])?'\x20'+_0x5e58ca[_0x84e9('0x68')][_0x13ad3d][_0x84e9('0x6d')]:'');}return _0x1a0190+')';};var _0x10281f={'where':{'id':_0x23eae0[_0x84e9('0x47')]['id']}},_0x3e7424,_0x179d39,_0x49279b,_0x129d60,_0x313a29;_0x10281f=_['merge']({},_0x10281f,_0x23eae0[_0x84e9('0x41')]);return db[_0x84e9('0x42')][_0x84e9('0x52')](_0x10281f)[_0x84e9('0x27')](function(_0x19a5c7){if(_0x19a5c7){_0x3e7424=_0x19a5c7;return _0x19a5c7[_0x84e9('0x6e')]();}return null;})[_0x84e9('0x27')](function(_0x5ad5dd){if(_0x5ad5dd){if(!_0x5ad5dd['length']){throw new db['Sequelize'][(_0x84e9('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x179d39=_0x5ad5dd;return db['AnalyticMetric'][_0x84e9('0x70')]({'raw':!![]});}return null;})[_0x84e9('0x27')](function(_0x5e22df){if(_0x5e22df){_0x49279b=_[_0x84e9('0x71')](_0x5e22df,'id');var _0x228f54;var _0x46dde0=squel[_0x84e9('0x72')]();_0x46dde0[_0x84e9('0x73')](_0x3e7424[_0x84e9('0x74')]);for(var _0xf6457d=0x0;_0xf6457d<_0x179d39[_0x84e9('0x37')];_0xf6457d+=0x1){_0x228f54=_0x179d39[_0xf6457d][_0x84e9('0x75')]?_0x49279b[_0x179d39[_0xf6457d][_0x84e9('0x75')]][_0x84e9('0x76')]:_0x179d39[_0xf6457d][_0x84e9('0x6b')];_0x228f54=_0x179d39[_0xf6457d][_0x84e9('0x77')]?_['replace'](_0x1a8bdd[_0x179d39[_0xf6457d]['function']],'%s',_0x228f54):_0x228f54;_0x228f54=_0x179d39[_0xf6457d][_0x84e9('0x78')]?_[_0x84e9('0x79')](_0x553bf7[_0x179d39[_0xf6457d][_0x84e9('0x78')]],'%s',_0x228f54):_0x228f54;if(_0x179d39[_0xf6457d][_0x84e9('0x7a')]){_0x46dde0[_0x84e9('0x6a')](_0x228f54);}_0x179d39[_0xf6457d]['orderBy']&&_0x46dde0[_0x84e9('0x3a')](_0x228f54,_0x179d39[_0xf6457d]['orderBy']===_0x84e9('0x7b')?![]:!![]);_0x46dde0[_0x84e9('0x6b')](_0x228f54,_0x179d39[_0xf6457d][_0x84e9('0x7c')]||_0x228f54);}if(_0x3e7424[_0x84e9('0x7d')]){_0x3e7424[_0x84e9('0x7d')]=JSON['parse'](_0x3e7424[_0x84e9('0x7d')]);for(var _0x419cf7=0x0;_0x419cf7<_0x3e7424[_0x84e9('0x7d')]['length'];_0x419cf7+=0x1){if(_0x3e7424['joins'][_0x419cf7][_0x84e9('0x30')]&&_[_0x84e9('0x66')](_0x2d1545,_0x3e7424[_0x84e9('0x7d')][_0x419cf7][_0x84e9('0x30')])&&_0x3e7424[_0x84e9('0x7d')][_0x419cf7][_0x84e9('0x7e')]&&_0x3e7424[_0x84e9('0x7d')][_0x419cf7][_0x84e9('0x7f')]&&_0x3e7424[_0x84e9('0x7d')][_0x419cf7][_0x84e9('0x80')]){_0x46dde0[_0x3e7424[_0x84e9('0x7d')][_0x419cf7]['type']](_0x3e7424[_0x84e9('0x7d')][_0x419cf7][_0x84e9('0x7f')],null,util[_0x84e9('0x78')](_0x84e9('0x81'),_0x3e7424['table'],_0x3e7424[_0x84e9('0x7d')][_0x419cf7][_0x84e9('0x7e')],_0x3e7424[_0x84e9('0x7d')][_0x419cf7][_0x84e9('0x7f')],_0x3e7424[_0x84e9('0x7d')][_0x419cf7][_0x84e9('0x80')]));}}}if(_0x3e7424[_0x84e9('0x82')]){_0x3e7424['conditions']=JSON['parse'](_0x3e7424[_0x84e9('0x82')]);_0x46dde0[_0x84e9('0x3c')](_0x57d1a7(_0x3e7424[_0x84e9('0x82')][_0x84e9('0x6a')]));}_0x313a29=_0x46dde0[_0x84e9('0x83')]();_0x46dde0[_0x84e9('0x20')](_0x544db3);_0x46dde0[_0x84e9('0x1e')](0x0);logger[_0x84e9('0x84')]('Limited\x20Query:',_0x46dde0[_0x84e9('0x85')]());return dbH[_0x84e9('0x86')][_0x84e9('0x34')](_0x46dde0[_0x84e9('0x85')](),{'type':dbH['sequelize'][_0x84e9('0x87')][_0x84e9('0x88')]});}})['then'](respondWithResult(_0x3c86ad,null))['catch'](handleError(_0x3c86ad,null));};function runReport(_0x3bad74,_0x3f5e84,_0x32533a){var _0x2048f1=_0x3f5e84[_0x84e9('0x2c')];var _0xc5b5f2=0xa;var _0x22bcde=[_0x84e9('0x59'),_0x84e9('0x5a'),_0x84e9('0x89'),_0x84e9('0x8a')];var _0x53e4d7={'SUM':_0x84e9('0x5b'),'COUNT':_0x84e9('0x5c'),'COUNT DISTINCT':_0x84e9('0x5d'),'MAX':_0x84e9('0x5e'),'MIN':_0x84e9('0x5f'),'AVG':_0x84e9('0x8b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x84e9('0x8c'),'GROUP_CONCAT DESC':_0x84e9('0x61')};var _0x483d66={'SEC_TO_TIME':_0x84e9('0x62'),'DATE':_0x84e9('0x8d'),'HOUR':_0x84e9('0x63'),'ROUND':_0x84e9('0x64'),'UNIX_TIMESTAMP':_0x84e9('0x65')};var _0x4fabf6=function(_0x1ff906){return!_[_0x84e9('0x66')]([_0x84e9('0x8e'),'IS\x20NOT\x20NULL',_0x84e9('0x8f'),_0x84e9('0x67')],_0x1ff906);};var _0x220499=function(_0x2570b5){if(!_0x2570b5||!_0x2570b5[_0x84e9('0x68')][_0x84e9('0x37')]){return'';}for(var _0x2ac9bf='(',_0x334270=0x0;_0x334270<_0x2570b5[_0x84e9('0x68')][_0x84e9('0x37')];_0x334270+=0x1){_0x334270>0x0&&(_0x2ac9bf+='\x20'+_0x2570b5['operator']+'\x20');_0x2ac9bf+=_0x2570b5['rules'][_0x334270]['group']?_0x220499(_0x2570b5['rules'][_0x334270][_0x84e9('0x6a')]):_0x2570b5[_0x84e9('0x68')][_0x334270][_0x84e9('0x6b')]+'\x20'+_0x2570b5[_0x84e9('0x68')][_0x334270][_0x84e9('0x6c')]+(_0x4fabf6(_0x2570b5['rules'][_0x334270]['condition'])?'\x20'+_0x2570b5['rules'][_0x334270][_0x84e9('0x6d')]:'');}return _0x2ac9bf+')';};var _0x38e0a2={'where':{'id':_0x3bad74['id']}},_0x3d68cf,_0x44e769,_0x32272a,_0x4ed413,_0x45c6b8;_0x38e0a2=_[_0x84e9('0x40')]({},_0x38e0a2,_0x32533a);return db['AnalyticCustomReport'][_0x84e9('0x52')](_0x38e0a2)[_0x84e9('0x27')](function(_0x37bb78){if(_0x37bb78){_0x3d68cf=_0x37bb78;return _0x37bb78[_0x84e9('0x6e')]();}return null;})[_0x84e9('0x27')](function(_0x11483c){if(_0x11483c){if(!_0x11483c[_0x84e9('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0x84e9('0x90'),0x193);}_0x44e769=_0x11483c;return db[_0x84e9('0x91')][_0x84e9('0x70')]({'raw':!![]});}return null;})[_0x84e9('0x27')](function(_0x558d13){if(_0x558d13){_0x32272a=_[_0x84e9('0x71')](_0x558d13,'id');var _0x3c8d9c;var _0x5e426f=squel[_0x84e9('0x72')]();_0x5e426f[_0x84e9('0x73')](_0x3d68cf[_0x84e9('0x74')]);for(var _0x29d2ad=0x0;_0x29d2ad<_0x44e769[_0x84e9('0x37')];_0x29d2ad+=0x1){_0x3c8d9c=_0x44e769[_0x29d2ad]['MetricId']?_0x32272a[_0x44e769[_0x29d2ad][_0x84e9('0x75')]][_0x84e9('0x76')]:_0x44e769[_0x29d2ad][_0x84e9('0x6b')];_0x3c8d9c=_0x44e769[_0x29d2ad]['function']?_[_0x84e9('0x79')](_0x53e4d7[_0x44e769[_0x29d2ad][_0x84e9('0x77')]],'%s',_0x3c8d9c):_0x3c8d9c;_0x3c8d9c=_0x44e769[_0x29d2ad]['format']?_['replace'](_0x483d66[_0x44e769[_0x29d2ad][_0x84e9('0x78')]],'%s',_0x3c8d9c):_0x3c8d9c;if(_0x44e769[_0x29d2ad]['groupBy']){_0x5e426f[_0x84e9('0x6a')](_0x3c8d9c);}_0x44e769[_0x29d2ad][_0x84e9('0x92')]&&_0x5e426f[_0x84e9('0x3a')](_0x3c8d9c,_0x44e769[_0x29d2ad][_0x84e9('0x92')]===_0x84e9('0x7b')?![]:!![]);_0x5e426f[_0x84e9('0x6b')](_0x3c8d9c,_0x44e769[_0x29d2ad][_0x84e9('0x7c')]||_0x3c8d9c);}if(_0x3d68cf[_0x84e9('0x7d')]){_0x3d68cf[_0x84e9('0x7d')]=JSON[_0x84e9('0x93')](_0x3d68cf[_0x84e9('0x7d')]);for(var _0x2821ce=0x0;_0x2821ce<_0x3d68cf[_0x84e9('0x7d')]['length'];_0x2821ce+=0x1){if(_0x3d68cf[_0x84e9('0x7d')][_0x2821ce]['type']&&_[_0x84e9('0x66')](_0x22bcde,_0x3d68cf['joins'][_0x2821ce][_0x84e9('0x30')])&&_0x3d68cf[_0x84e9('0x7d')][_0x2821ce][_0x84e9('0x7e')]&&_0x3d68cf[_0x84e9('0x7d')][_0x2821ce][_0x84e9('0x7f')]&&_0x3d68cf[_0x84e9('0x7d')][_0x2821ce][_0x84e9('0x80')]){_0x5e426f[_0x3d68cf[_0x84e9('0x7d')][_0x2821ce][_0x84e9('0x30')]](_0x3d68cf[_0x84e9('0x7d')][_0x2821ce][_0x84e9('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3d68cf[_0x84e9('0x74')],_0x3d68cf[_0x84e9('0x7d')][_0x2821ce]['parentKey'],_0x3d68cf['joins'][_0x2821ce][_0x84e9('0x7f')],_0x3d68cf['joins'][_0x2821ce][_0x84e9('0x80')]));}}}if(_0x3d68cf[_0x84e9('0x82')]){_0x3d68cf[_0x84e9('0x82')]=JSON[_0x84e9('0x93')](_0x3d68cf[_0x84e9('0x82')]);_0x5e426f['where'](_0x220499(_0x3d68cf[_0x84e9('0x82')][_0x84e9('0x6a')]));}_0x45c6b8=_0x5e426f[_0x84e9('0x83')]();_0x5e426f[_0x84e9('0x20')](_0xc5b5f2);_0x5e426f[_0x84e9('0x1e')](0x0);return;}})[_0x84e9('0x27')](function(){if(_0x3f5e84['output']===_0x84e9('0x94')){return null;}var _0x467bcf=_[_0x84e9('0x40')](_0x3f5e84,{'name':_0x3f5e84['fullPath']||_0x3f5e84['name']||_0x3d68cf[_0x84e9('0x2c')],'basename':_0x2048f1,'savename':util[_0x84e9('0x78')](_0x84e9('0x95'),_0x3f5e84[_0x84e9('0x2c')]||_0x3d68cf[_0x84e9('0x2c')],require(_0x84e9('0x96'))['generate'](0x4),_0x3f5e84[_0x84e9('0x97')]||_0x84e9('0x98')),'reportId':_0x3d68cf['id'],'reportType':'custom'});return db['AnalyticExtractedReport']['create'](_0x467bcf,{'raw':!![]});})['then'](function(_0x51b2a4){if(_0x3d68cf[_0x84e9('0x74')]===_0x84e9('0x99')){_0x45c6b8[_0x84e9('0x3c')](_0x3d68cf[_0x84e9('0x74')]+_0x84e9('0x9a'),_0x3f5e84[_0x84e9('0x9b')],_0x3f5e84[_0x84e9('0x9c')]);}else{_0x45c6b8[_0x84e9('0x3c')](_0x3d68cf[_0x84e9('0x74')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3f5e84['startDate'],_0x3f5e84[_0x84e9('0x9c')]);}if(_0x51b2a4){logger[_0x84e9('0x9d')]('Run\x20Query:',_0x45c6b8['toString']());require(_0x84e9('0x9e'))['fork'](path[_0x84e9('0x59')](__dirname,_0x84e9('0x9f'),_0x51b2a4[_0x84e9('0x97')]),[_0x51b2a4['id'],_0x45c6b8['toString'](),path[_0x84e9('0x59')](__dirname,_0x84e9('0xa0'),_0x51b2a4[_0x84e9('0xa1')]),_0x2048f1]);return _0x51b2a4;}else{var _0x34c536=squel[_0x84e9('0x72')]();_0x34c536[_0x84e9('0x73')]('('+_0x45c6b8[_0x84e9('0x85')]()+')','countTable');_0x34c536[_0x84e9('0x6b')](_0x84e9('0xa2'),'count');_0x45c6b8['limit'](_0x3f5e84[_0x84e9('0x20')]||_0xc5b5f2);_0x45c6b8[_0x84e9('0x1e')](_0x3f5e84['offset']||0x0);return dbH[_0x84e9('0x86')][_0x84e9('0x34')](_0x34c536[_0x84e9('0x85')](),{'type':dbH['sequelize'][_0x84e9('0x87')]['SELECT']})[_0x84e9('0x27')](function(_0x3982c2){if(!_0x3982c2[_0x84e9('0x37')]){_0x4ed413=0x0;}else{_0x4ed413=_0x3982c2[0x0]['count']||0x0;}return dbH[_0x84e9('0x86')][_0x84e9('0x34')](_0x45c6b8[_0x84e9('0x85')](),{'type':dbH['sequelize'][_0x84e9('0x87')][_0x84e9('0x88')]});})[_0x84e9('0x27')](function(_0x3263ca){return{'rows':_0x3263ca||[],'count':_0x4ed413};});}});}exports[_0x84e9('0xa3')]=function(_0x5588aa,_0x646dca){return runReport(_0x5588aa[_0x84e9('0x47')],_0x5588aa['query'],_0x5588aa[_0x84e9('0x41')])[_0x84e9('0x27')](respondWithResult(_0x646dca,null))[_0x84e9('0x4a')](handleError(_0x646dca,null));};exports[_0x84e9('0xa4')]=runReport;exports[_0x84e9('0x34')]=function(_0x4ad1e7,_0xa4cd6b){var _0xdc7e1c=0xa;var _0x1aaf7f=['join','left_join',_0x84e9('0x89'),_0x84e9('0x8a')];var _0x5291b3={'SUM':_0x84e9('0x5b'),'COUNT':_0x84e9('0x5c'),'COUNT DISTINCT':_0x84e9('0x5d'),'MAX':'MAX(%s)','MIN':_0x84e9('0x5f'),'AVG':_0x84e9('0x8b'),'GROUP_CONCAT':_0x84e9('0x60'),'GROUP_CONCAT ASC':_0x84e9('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x27ceea={'SEC_TO_TIME':_0x84e9('0x62'),'DATE':_0x84e9('0x8d'),'HOUR':_0x84e9('0x63'),'ROUND':_0x84e9('0x64'),'UNIX_TIMESTAMP':_0x84e9('0x65')};var _0x563688=function(_0xfaf5){return!_[_0x84e9('0x66')]([_0x84e9('0x8e'),'IS\x20NOT\x20NULL',_0x84e9('0x8f'),_0x84e9('0x67')],_0xfaf5);};var _0x1e4295=function(_0x2f370f){if(!_0x2f370f||!_0x2f370f[_0x84e9('0x68')][_0x84e9('0x37')]){return'';}for(var _0x805d12='(',_0x22c94f=0x0;_0x22c94f<_0x2f370f[_0x84e9('0x68')][_0x84e9('0x37')];_0x22c94f+=0x1){_0x22c94f>0x0&&(_0x805d12+='\x20'+_0x2f370f[_0x84e9('0x69')]+'\x20');_0x805d12+=_0x2f370f[_0x84e9('0x68')][_0x22c94f]['group']?_0x1e4295(_0x2f370f[_0x84e9('0x68')][_0x22c94f][_0x84e9('0x6a')]):_0x2f370f['rules'][_0x22c94f][_0x84e9('0x6b')]+'\x20'+_0x2f370f[_0x84e9('0x68')][_0x22c94f][_0x84e9('0x6c')]+(_0x563688(_0x2f370f[_0x84e9('0x68')][_0x22c94f][_0x84e9('0x6c')])?'\x20'+_0x2f370f['rules'][_0x22c94f]['value']:'');}return _0x805d12+')';};var _0x4185a9={'where':{'id':_0x4ad1e7[_0x84e9('0x47')]['id']}},_0x1a109f,_0x3759e3,_0x541e19,_0x1efeca,_0x1d3d07;_0x4185a9=_['merge']({},_0x4185a9,_0x4ad1e7[_0x84e9('0x41')]);return db['AnalyticCustomReport'][_0x84e9('0x52')](_0x4185a9)['then'](function(_0x49699c){if(_0x49699c){_0x1a109f=_0x49699c;return _0x49699c[_0x84e9('0x6e')]();}return null;})[_0x84e9('0x27')](function(_0x2d77c2){if(_0x2d77c2){if(!_0x2d77c2[_0x84e9('0x37')]){throw new db[(_0x84e9('0xa5'))]['ValidationErrorItem'](_0x84e9('0x90'),0x193);}_0x3759e3=_0x2d77c2;return db[_0x84e9('0x91')][_0x84e9('0x70')]({'raw':!![]});}return null;})[_0x84e9('0x27')](function(_0x588cb4){if(_0x588cb4){_0x541e19=_['keyBy'](_0x588cb4,'id');var _0x23cc5d;var _0x2cefab=squel[_0x84e9('0x72')]();_0x2cefab[_0x84e9('0x73')](_0x1a109f[_0x84e9('0x74')]);for(var _0x34c9c6=0x0;_0x34c9c6<_0x3759e3[_0x84e9('0x37')];_0x34c9c6+=0x1){_0x23cc5d=_0x3759e3[_0x34c9c6][_0x84e9('0x75')]?_0x541e19[_0x3759e3[_0x34c9c6]['MetricId']]['metric']:_0x3759e3[_0x34c9c6]['field'];_0x23cc5d=_0x3759e3[_0x34c9c6]['function']?_[_0x84e9('0x79')](_0x5291b3[_0x3759e3[_0x34c9c6][_0x84e9('0x77')]],'%s',_0x23cc5d):_0x23cc5d;_0x23cc5d=_0x3759e3[_0x34c9c6]['format']?_[_0x84e9('0x79')](_0x27ceea[_0x3759e3[_0x34c9c6][_0x84e9('0x78')]],'%s',_0x23cc5d):_0x23cc5d;if(_0x3759e3[_0x34c9c6][_0x84e9('0x7a')]){_0x2cefab[_0x84e9('0x6a')](_0x23cc5d);}_0x3759e3[_0x34c9c6][_0x84e9('0x92')]&&_0x2cefab[_0x84e9('0x3a')](_0x23cc5d,_0x3759e3[_0x34c9c6][_0x84e9('0x92')]===_0x84e9('0x7b')?![]:!![]);_0x2cefab['field'](_0x23cc5d,_0x3759e3[_0x34c9c6][_0x84e9('0x7c')]||_0x23cc5d);}if(_0x1a109f['joins']){_0x1a109f[_0x84e9('0x7d')]=JSON['parse'](_0x1a109f[_0x84e9('0x7d')]);for(var _0x246c1c=0x0;_0x246c1c<_0x1a109f[_0x84e9('0x7d')][_0x84e9('0x37')];_0x246c1c+=0x1){if(_0x1a109f[_0x84e9('0x7d')][_0x246c1c]['type']&&_[_0x84e9('0x66')](_0x1aaf7f,_0x1a109f['joins'][_0x246c1c][_0x84e9('0x30')])&&_0x1a109f[_0x84e9('0x7d')][_0x246c1c][_0x84e9('0x7e')]&&_0x1a109f[_0x84e9('0x7d')][_0x246c1c]['foreignTable']&&_0x1a109f[_0x84e9('0x7d')][_0x246c1c]['foreignKey']){_0x2cefab[_0x1a109f['joins'][_0x246c1c][_0x84e9('0x30')]](_0x1a109f[_0x84e9('0x7d')][_0x246c1c][_0x84e9('0x7f')],null,util['format'](_0x84e9('0x81'),_0x1a109f[_0x84e9('0x74')],_0x1a109f[_0x84e9('0x7d')][_0x246c1c][_0x84e9('0x7e')],_0x1a109f['joins'][_0x246c1c][_0x84e9('0x7f')],_0x1a109f[_0x84e9('0x7d')][_0x246c1c][_0x84e9('0x80')]));}}}if(_0x1a109f[_0x84e9('0x82')]){_0x1a109f['conditions']=JSON[_0x84e9('0x93')](_0x1a109f['conditions']);_0x2cefab[_0x84e9('0x3c')](_0x1e4295(_0x1a109f['conditions']['group']));}_0x1d3d07=_0x2cefab[_0x84e9('0x83')]();_0x2cefab['limit'](_0xdc7e1c);_0x2cefab[_0x84e9('0x1e')](0x0);logger[_0x84e9('0x84')](_0x84e9('0xa6'),_0x2cefab[_0x84e9('0x85')]());return dbH['sequelize'][_0x84e9('0x34')](_0x2cefab[_0x84e9('0x85')](),{'type':dbH[_0x84e9('0x86')][_0x84e9('0x87')][_0x84e9('0x88')]});}})['then'](function(){return{'sql':_0x1d3d07[_0x84e9('0x85')]()};})['then'](respondWithResult(_0xa4cd6b,null))[_0x84e9('0x4a')](handleError(_0xa4cd6b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ca00891..06215dd 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 _0xf4a2=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf4a2,0x136));var _0x2f4a=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0xf4a2[_0x2eec1f];return _0x543075;};'use strict';var _=require(_0x2f4a('0x0'));var util=require('util');var logger=require(_0x2f4a('0x1'))(_0x2f4a('0x2'));var moment=require(_0x2f4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f4a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f4a('0x5'));var config=require(_0x2f4a('0x6'));var attributes=require(_0x2f4a('0x7'));module['exports']=function(_0xbc29d,_0x28421f){return _0xbc29d[_0x2f4a('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0x2f4a('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ccb=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x9f1e14,_0x24eb57){var _0x274468=function(_0xe2d3ef){while(--_0xe2d3ef){_0x9f1e14['push'](_0x9f1e14['shift']());}};_0x274468(++_0x24eb57);}(_0x1ccb,0x172));var _0xb1cc=function(_0x5947dc,_0x168496){_0x5947dc=_0x5947dc-0x0;var _0x4f51a3=_0x1ccb[_0x5947dc];return _0x4f51a3;};'use strict';var _=require(_0xb1cc('0x0'));var util=require(_0xb1cc('0x1'));var logger=require(_0xb1cc('0x2'))(_0xb1cc('0x3'));var moment=require(_0xb1cc('0x4'));var BPromise=require(_0xb1cc('0x5'));var rp=require(_0xb1cc('0x6'));var fs=require('fs');var path=require(_0xb1cc('0x7'));var rimraf=require(_0xb1cc('0x8'));var config=require(_0xb1cc('0x9'));var attributes=require(_0xb1cc('0xa'));module[_0xb1cc('0xb')]=function(_0x4e3ece,_0x4d3e9b){return _0x4e3ece['define'](_0xb1cc('0xc'),attributes,{'tableName':_0xb1cc('0xd'),'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 c57b4f4..7abf726 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 _0x929c=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x929c,0x6b));var _0xc929=function(_0x518141,_0x2f3ae7){_0x518141=_0x518141-0x0;var _0x14e45c=_0x929c[_0x518141];return _0x14e45c;};'use strict';var _=require(_0xc929('0x0'));var util=require(_0xc929('0x1'));var moment=require(_0xc929('0x2'));var BPromise=require(_0xc929('0x3'));var rs=require(_0xc929('0x4'));var fs=require('fs');var Redis=require(_0xc929('0x5'));var db=require(_0xc929('0x6'))['db'];var utils=require(_0xc929('0x7'));var logger=require(_0xc929('0x8'))(_0xc929('0x9'));var config=require(_0xc929('0xa'));var jayson=require(_0xc929('0xb'));var client=jayson[_0xc929('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47dff9,_0x236b9e,_0x1d6d07){return new BPromise(function(_0x140b27,_0x484d83){return client[_0xc929('0xd')](_0x47dff9,_0x1d6d07)[_0xc929('0xe')](function(_0x3e5062){logger['info'](_0xc929('0xf'),_0x236b9e,_0xc929('0x10'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x236b9e,_0xc929('0x10'),JSON['stringify'](_0x3e5062));if(_0x3e5062['error']){if(_0x3e5062[_0xc929('0x11')][_0xc929('0x12')]===0x1f4){logger[_0xc929('0x11')](_0xc929('0xf'),_0x236b9e,_0x3e5062[_0xc929('0x11')]['message']);return _0x484d83(_0x3e5062[_0xc929('0x11')][_0xc929('0x13')]);}logger[_0xc929('0x11')](_0xc929('0xf'),_0x236b9e,_0x3e5062[_0xc929('0x11')][_0xc929('0x13')]);return _0x140b27(_0x3e5062[_0xc929('0x11')]['message']);}else{logger['info'](_0xc929('0xf'),_0x236b9e,_0xc929('0x10'));_0x140b27(_0x3e5062[_0xc929('0x14')]['message']);}})['catch'](function(_0x190488){logger[_0xc929('0x11')](_0xc929('0xf'),_0x236b9e,_0x190488);_0x484d83(_0x190488);});});} \ No newline at end of file +var _0x10ca=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','client','http','request','then'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x10ca,0x1c4));var _0xa10c=function(_0x1c0a79,_0x4223d8){_0x1c0a79=_0x1c0a79-0x0;var _0xc22ee5=_0x10ca[_0x1c0a79];return _0xc22ee5;};'use strict';var _=require(_0xa10c('0x0'));var util=require('util');var moment=require(_0xa10c('0x1'));var BPromise=require(_0xa10c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa10c('0x3'))['db'];var utils=require(_0xa10c('0x4'));var logger=require('../../config/logger')(_0xa10c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa10c('0x6')][_0xa10c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4daab7,_0x4d67d1,_0x4531ea){return new BPromise(function(_0x5e05bb,_0x292fbb){return client[_0xa10c('0x8')](_0x4daab7,_0x4531ea)[_0xa10c('0x9')](function(_0xcc9523){logger[_0xa10c('0xa')](_0xa10c('0xb'),_0x4d67d1,_0xa10c('0xc'));logger[_0xa10c('0xd')](_0xa10c('0xe'),_0x4d67d1,'request\x20sent',JSON[_0xa10c('0xf')](_0xcc9523));if(_0xcc9523[_0xa10c('0x10')]){if(_0xcc9523['error'][_0xa10c('0x11')]===0x1f4){logger[_0xa10c('0x10')](_0xa10c('0xb'),_0x4d67d1,_0xcc9523[_0xa10c('0x10')][_0xa10c('0x12')]);return _0x292fbb(_0xcc9523['error'][_0xa10c('0x12')]);}logger[_0xa10c('0x10')](_0xa10c('0xb'),_0x4d67d1,_0xcc9523[_0xa10c('0x10')][_0xa10c('0x12')]);return _0x5e05bb(_0xcc9523['error'][_0xa10c('0x12')]);}else{logger[_0xa10c('0xa')](_0xa10c('0xb'),_0x4d67d1,_0xa10c('0xc'));_0x5e05bb(_0xcc9523[_0xa10c('0x13')]['message']);}})[_0xa10c('0x14')](function(_0x25fb30){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4d67d1,_0x25fb30);_0x292fbb(_0x25fb30);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 876cc14..6d98497 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 _0x7314=['/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x7314,0x1b6));var _0x4731=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7314[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4731('0x0'));var util=require(_0x4731('0x1'));var path=require(_0x4731('0x2'));var timeout=require('connect-timeout');var express=require(_0x4731('0x3'));var router=express[_0x4731('0x4')]();var fs_extra=require(_0x4731('0x5'));var auth=require(_0x4731('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4731('0x7'));var controller=require(_0x4731('0x8'));router['get']('/',auth[_0x4731('0x9')](),controller[_0x4731('0xa')]);router[_0x4731('0xb')](_0x4731('0xc'),auth[_0x4731('0x9')](),controller[_0x4731('0xd')]);router['get'](_0x4731('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0x4731('0xb')](_0x4731('0xf'),auth[_0x4731('0x9')](),controller[_0x4731('0x10')]);router['get'](_0x4731('0x11'),auth['isAuthenticated'](),controller[_0x4731('0x12')]);router[_0x4731('0x13')]('/',auth['isAuthenticated'](),controller[_0x4731('0x14')]);router[_0x4731('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4731('0x16')](_0x4731('0xc'),auth[_0x4731('0x9')](),controller[_0x4731('0x17')]);module[_0x4731('0x18')]=router; \ No newline at end of file +var _0x26aa=['/:id/run','run','/:id/query','query','post','create','put','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/preview','preview'];(function(_0x2cfd8b,_0x4ee0ec){var _0x52277e=function(_0x514a8d){while(--_0x514a8d){_0x2cfd8b['push'](_0x2cfd8b['shift']());}};_0x52277e(++_0x4ee0ec);}(_0x26aa,0xa2));var _0xa26a=function(_0xe381b2,_0x10299c){_0xe381b2=_0xe381b2-0x0;var _0xf9105c=_0x26aa[_0xe381b2];return _0xf9105c;};'use strict';var multer=require('multer');var util=require(_0xa26a('0x0'));var path=require(_0xa26a('0x1'));var timeout=require(_0xa26a('0x2'));var express=require(_0xa26a('0x3'));var router=express['Router']();var fs_extra=require(_0xa26a('0x4'));var auth=require(_0xa26a('0x5'));var interaction=require(_0xa26a('0x6'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xa26a('0x7')](),controller[_0xa26a('0x8')]);router[_0xa26a('0x9')](_0xa26a('0xa'),auth[_0xa26a('0x7')](),controller[_0xa26a('0xb')]);router[_0xa26a('0x9')](_0xa26a('0xc'),auth[_0xa26a('0x7')](),controller[_0xa26a('0xd')]);router[_0xa26a('0x9')](_0xa26a('0xe'),auth['isAuthenticated'](),controller[_0xa26a('0xf')]);router['get'](_0xa26a('0x10'),auth[_0xa26a('0x7')](),controller[_0xa26a('0x11')]);router[_0xa26a('0x12')]('/',auth[_0xa26a('0x7')](),controller[_0xa26a('0x13')]);router[_0xa26a('0x14')](_0xa26a('0xa'),auth[_0xa26a('0x7')](),controller['update']);router['delete'](_0xa26a('0xa'),auth[_0xa26a('0x7')](),controller['destroy']);module[_0xa26a('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 739b9bb..c65f75e 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x440c6a,_0x3dc4a6){_0x440c6a=_0x440c6a-0x0;var _0x347b07=_0xdc97[_0x440c6a];return _0x347b07;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 42693dc..240f714 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x15718e,_0x2f5096){var _0xf3b1d2=function(_0x718af1){while(--_0x718af1){_0x15718e['push'](_0x15718e['shift']());}};_0xf3b1d2(++_0x2f5096);}(_0x46ed,0x168));var _0xd46e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x46ed[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0x6d38=['Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','sequelize','run','SEC_TO_TIME(%s)','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticDefaultReport','findAll','rows','show','keys','fields','find','catch','create','body','user','role','Reports','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d38,0x1ef));var _0x86d3=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6d38[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];var dbH=require(_0x86d3('0x13'))[_0x86d3('0x14')];function respondWithStatusCode(_0x26d64c,_0xe1b3d7){_0xe1b3d7=_0xe1b3d7||0xcc;return function(_0x1b8d0a){if(_0x1b8d0a){return _0x26d64c[_0x86d3('0x15')](_0xe1b3d7);}return _0x26d64c[_0x86d3('0x16')](_0xe1b3d7)['end']();};}function respondWithResult(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xc8;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x16')](_0x1f35cf)[_0x86d3('0x17')](_0x356e7d);}};}function respondWithFilteredResult(_0x34fb3b,_0x1ff008){return function(_0x44436d){if(_0x44436d){var _0x53b437=typeof _0x1ff008[_0x86d3('0x18')]===_0x86d3('0x19')&&typeof _0x1ff008[_0x86d3('0x1a')]===_0x86d3('0x19');var _0x46feec=_0x44436d[_0x86d3('0x1b')];var _0x33e459=_0x53b437?0x0:_0x1ff008[_0x86d3('0x18')];var _0x9b76f2=_0x53b437?_0x44436d['count']:_0x1ff008[_0x86d3('0x18')]+_0x1ff008['limit'];var _0x6ced9e;if(_0x9b76f2>=_0x46feec){_0x9b76f2=_0x46feec;_0x6ced9e=0xc8;}else{_0x6ced9e=0xce;}_0x34fb3b['status'](_0x6ced9e);return _0x34fb3b['set'](_0x86d3('0x1c'),_0x33e459+'-'+_0x9b76f2+'/'+_0x46feec)[_0x86d3('0x17')](_0x44436d);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1d')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x1e')](_0x3fdf67)[_0x86d3('0x1f')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x1f')](function(){var _0x1bea5e=_0x26262a[_0x86d3('0x20')]({'plain':!![]});var _0x3c5fe4='DefaultReports';return db['UserProfileResource'][_0x86d3('0x21')]({'where':{'type':_0x3c5fe4,'resourceId':_0x1bea5e['id']}})[_0x86d3('0x1f')](function(){return _0x26262a;});})['then'](function(){_0x4bf5b8[_0x86d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42413c,_0x41e2f0){return function(_0x287b96){if(!_0x287b96){_0x42413c[_0x86d3('0x15')](0x194);}return _0x287b96;};}function handleError(_0x11a6fd,_0x14c9ff){_0x14c9ff=_0x14c9ff||0x1f4;return function(_0x1f203e){logger[_0x86d3('0x22')](_0x1f203e[_0x86d3('0x23')]);if(_0x1f203e[_0x86d3('0x24')]){delete _0x1f203e[_0x86d3('0x24')];}_0x11a6fd[_0x86d3('0x16')](_0x14c9ff)[_0x86d3('0x25')](_0x1f203e);};}exports[_0x86d3('0x26')]=function(_0x5b09f6,_0x120a0c){var _0x403be3={},_0x2bda35={},_0x31cefe={'count':0x0,'rows':[]};var _0x7709f0=_[_0x86d3('0x27')](db['AnalyticDefaultReport'][_0x86d3('0x28')],function(_0x5c71df){return{'name':_0x5c71df['fieldName'],'type':_0x5c71df[_0x86d3('0x29')][_0x86d3('0x2a')]};});_0x2bda35[_0x86d3('0x2b')]=_['map'](_0x7709f0,_0x86d3('0x24'));_0x2bda35[_0x86d3('0x2c')]=_['keys'](_0x5b09f6[_0x86d3('0x2c')]);_0x2bda35[_0x86d3('0x2d')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],_0x2bda35[_0x86d3('0x2c')]);_0x403be3[_0x86d3('0x2f')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],qs['fields'](_0x5b09f6['query']['fields']));_0x403be3[_0x86d3('0x2f')]=_0x403be3['attributes'][_0x86d3('0x30')]?_0x403be3['attributes']:_0x2bda35[_0x86d3('0x2b')];if(!_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x31')](_0x86d3('0x32'))){_0x403be3[_0x86d3('0x1a')]=qs[_0x86d3('0x1a')](_0x5b09f6[_0x86d3('0x2c')]['limit']);_0x403be3[_0x86d3('0x18')]=qs[_0x86d3('0x18')](_0x5b09f6['query'][_0x86d3('0x18')]);}_0x403be3[_0x86d3('0x33')]=qs[_0x86d3('0x34')](_0x5b09f6[_0x86d3('0x2c')]['sort']);_0x403be3[_0x86d3('0x35')]=qs[_0x86d3('0x2d')](_[_0x86d3('0x36')](_0x5b09f6['query'],_0x2bda35[_0x86d3('0x2d')]),_0x7709f0);if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x37')]){_0x403be3[_0x86d3('0x35')]=_[_0x86d3('0x38')](_0x403be3[_0x86d3('0x35')],{'$or':_[_0x86d3('0x27')](_0x7709f0,function(_0x436065){if(_0x436065['type']!==_0x86d3('0x39')){var _0x470978={};_0x470978[_0x436065[_0x86d3('0x24')]]={'$like':'%'+_0x5b09f6[_0x86d3('0x2c')]['filter']+'%'};return _0x470978;}})});}_0x403be3=_[_0x86d3('0x38')]({},_0x403be3,_0x5b09f6[_0x86d3('0x3a')]);var _0x6f72be={'where':_0x403be3[_0x86d3('0x35')]};return db['AnalyticDefaultReport']['count'](_0x6f72be)[_0x86d3('0x1f')](function(_0x4f422b){_0x31cefe['count']=_0x4f422b;if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x403be3[_0x86d3('0x3c')]=[{'all':!![]}];}return db[_0x86d3('0x3d')][_0x86d3('0x3e')](_0x403be3);})['then'](function(_0x2a5f6c){_0x31cefe[_0x86d3('0x3f')]=_0x2a5f6c;return _0x31cefe;})[_0x86d3('0x1f')](respondWithFilteredResult(_0x120a0c,_0x403be3))['catch'](handleError(_0x120a0c,null));};exports[_0x86d3('0x40')]=function(_0x810d10,_0x5dfae8){var _0x369f68={'raw':!![],'where':{'id':_0x810d10['params']['id']}},_0xcf6c9e={};_0xcf6c9e['model']=_['keys'](db[_0x86d3('0x3d')][_0x86d3('0x28')]);_0xcf6c9e[_0x86d3('0x2c')]=_[_0x86d3('0x41')](_0x810d10[_0x86d3('0x2c')]);_0xcf6c9e[_0x86d3('0x2d')]=_['intersection'](_0xcf6c9e[_0x86d3('0x2b')],_0xcf6c9e[_0x86d3('0x2c')]);_0x369f68['attributes']=_[_0x86d3('0x2e')](_0xcf6c9e[_0x86d3('0x2b')],qs[_0x86d3('0x42')](_0x810d10[_0x86d3('0x2c')][_0x86d3('0x42')]));_0x369f68[_0x86d3('0x2f')]=_0x369f68['attributes'][_0x86d3('0x30')]?_0x369f68[_0x86d3('0x2f')]:_0xcf6c9e['model'];if(_0x810d10[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x369f68[_0x86d3('0x3c')]=[{'all':!![]}];}_0x369f68=_[_0x86d3('0x38')]({},_0x369f68,_0x810d10[_0x86d3('0x3a')]);return db['AnalyticDefaultReport'][_0x86d3('0x43')](_0x369f68)[_0x86d3('0x1f')](handleEntityNotFound(_0x5dfae8,null))[_0x86d3('0x1f')](respondWithResult(_0x5dfae8,null))[_0x86d3('0x44')](handleError(_0x5dfae8,null));};exports[_0x86d3('0x45')]=function(_0x7af7b3,_0x1a4345){return db[_0x86d3('0x3d')][_0x86d3('0x45')](_0x7af7b3[_0x86d3('0x46')],{})[_0x86d3('0x1f')](function(_0x1236ea){var _0x4ea940=_0x7af7b3[_0x86d3('0x47')][_0x86d3('0x20')]({'plain':!![]});if(!_0x4ea940)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ea940[_0x86d3('0x48')]===_0x86d3('0x47')){var _0x197047=_0x1236ea[_0x86d3('0x20')]({'plain':!![]});var _0x1dcff0=_0x86d3('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x1dcff0,'userProfileId':_0x4ea940['userProfileId']},'raw':!![]})['then'](function(_0x159253){if(_0x159253&&_0x159253[_0x86d3('0x4a')]===0x0){return db[_0x86d3('0x4b')][_0x86d3('0x45')]({'name':_0x197047[_0x86d3('0x24')],'resourceId':_0x197047['id'],'type':_0x86d3('0x4c'),'sectionId':_0x159253['id']},{})[_0x86d3('0x1f')](function(){return _0x1236ea;});}else{return _0x1236ea;}})['catch'](function(_0x2afb07){logger[_0x86d3('0x22')](_0x86d3('0x4d'),_0x2afb07);throw _0x2afb07;});}return _0x1236ea;})[_0x86d3('0x1f')](respondWithResult(_0x1a4345,0xc9))[_0x86d3('0x44')](handleError(_0x1a4345,null));};exports[_0x86d3('0x1e')]=function(_0x34935f,_0x4c8828){if(_0x34935f[_0x86d3('0x46')]['id']){delete _0x34935f['body']['id'];}return db[_0x86d3('0x3d')][_0x86d3('0x43')]({'where':{'id':_0x34935f[_0x86d3('0x4e')]['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4c8828,null))[_0x86d3('0x1f')](saveUpdates(_0x34935f['body'],null))[_0x86d3('0x1f')](respondWithResult(_0x4c8828,null))[_0x86d3('0x44')](handleError(_0x4c8828,null));};exports[_0x86d3('0x21')]=function(_0x4e10d9,_0x4ad164){return db['AnalyticDefaultReport'][_0x86d3('0x43')]({'where':{'id':_0x4e10d9['params']['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4ad164,null))[_0x86d3('0x1f')](removeEntity(_0x4ad164,null))[_0x86d3('0x44')](handleError(_0x4ad164,null));};exports[_0x86d3('0x4f')]=function(_0x5963bb,_0x4cd835){var _0x551806=0xa;var _0x28655a=[_0x86d3('0x50'),'left_join',_0x86d3('0x51'),_0x86d3('0x52')];var _0xa085b2={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x86d3('0x59')};var _0x41fad7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x86d3('0x5a'),'HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':_0x86d3('0x5d')};var _0x4598d4=function(_0x4029a4){return!_[_0x86d3('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x86d3('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4029a4);};var _0x528ca8=function(_0x58e4b6){if(!_0x58e4b6||!_0x58e4b6[_0x86d3('0x60')]['length']){return'';}for(var _0x254ac3='(',_0x5f2ed6=0x0;_0x5f2ed6<_0x58e4b6[_0x86d3('0x60')][_0x86d3('0x30')];_0x5f2ed6+=0x1){_0x5f2ed6>0x0&&(_0x254ac3+='\x20'+_0x58e4b6[_0x86d3('0x61')]+'\x20');_0x254ac3+=_0x58e4b6['rules'][_0x5f2ed6]['group']?_0x528ca8(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x62')]):_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x63')]+'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')]+(_0x4598d4(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')])?'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x65')]:'');}return _0x254ac3+')';};var _0x1e3479={'where':{'id':_0x5963bb[_0x86d3('0x4e')]['id']}},_0x265beb,_0xfaf168,_0xf0dbbb,_0x3f978c,_0x5e1835;_0x1e3479=_[_0x86d3('0x38')]({},_0x1e3479,_0x5963bb['options']);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x1e3479)[_0x86d3('0x1f')](function(_0x52dc99){if(_0x52dc99){_0x265beb=_0x52dc99;return _0x52dc99[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x45e8d9){if(_0x45e8d9){if(!_0x45e8d9[_0x86d3('0x30')]){throw new db['Sequelize'][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xfaf168=_0x45e8d9;return db[_0x86d3('0x68')][_0x86d3('0x3e')]({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2d4bc1){if(_0x2d4bc1){_0xf0dbbb=_[_0x86d3('0x69')](_0x2d4bc1,'id');var _0x56fd96;var _0x3cc1d8=squel['select']();_0x3cc1d8[_0x86d3('0x6a')](_0x265beb[_0x86d3('0x6b')]);for(var _0x5866fe=0x0;_0x5866fe<_0xfaf168[_0x86d3('0x30')];_0x5866fe+=0x1){_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6c')]?_0xf0dbbb[_0xfaf168[_0x5866fe][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0xfaf168[_0x5866fe][_0x86d3('0x63')];_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0xa085b2[_0xfaf168[_0x5866fe]['function']],'%s',_0x56fd96):_0x56fd96;_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x41fad7[_0xfaf168[_0x5866fe][_0x86d3('0x70')]],'%s',_0x56fd96):_0x56fd96;if(_0xfaf168[_0x5866fe][_0x86d3('0x71')]){_0x3cc1d8[_0x86d3('0x62')](_0x56fd96);}_0xfaf168[_0x5866fe]['orderBy']&&_0x3cc1d8[_0x86d3('0x33')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x72')]==='DESC'?![]:!![]);_0x3cc1d8[_0x86d3('0x63')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x73')]||_0x56fd96);}if(_0x265beb[_0x86d3('0x74')]){_0x265beb[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x265beb[_0x86d3('0x74')]);for(var _0x1bf5ba=0x0;_0x1bf5ba<_0x265beb[_0x86d3('0x74')][_0x86d3('0x30')];_0x1bf5ba+=0x1){if(_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x28655a,_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')])&&_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba]['foreignKey']){_0x3cc1d8[_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]](_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x265beb[_0x86d3('0x6b')],_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')],_0x265beb['joins'][_0x1bf5ba]['foreignTable'],_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x78')]));}}}if(_0x265beb[_0x86d3('0x79')]){_0x265beb[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x265beb['conditions']);_0x3cc1d8[_0x86d3('0x35')](_0x528ca8(_0x265beb[_0x86d3('0x79')]['group']));}_0x5e1835=_0x3cc1d8[_0x86d3('0x7a')]();_0x3cc1d8[_0x86d3('0x1a')](_0x551806);_0x3cc1d8['offset'](0x0);logger[_0x86d3('0x7b')]('Limited\x20Query:',_0x3cc1d8[_0x86d3('0x7c')]());return dbH['sequelize']['query'](_0x3cc1d8[_0x86d3('0x7c')](),{'type':dbH['sequelize'][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})[_0x86d3('0x1f')](respondWithResult(_0x4cd835,null))[_0x86d3('0x44')](handleError(_0x4cd835,null));};function runReport(_0x3193d5,_0x3a1acc,_0x268c93){var _0x3b989c=_0x3a1acc['name'];var _0x245b39=0xa;var _0x158f56=[_0x86d3('0x50'),_0x86d3('0x7f'),_0x86d3('0x51'),'cross_join'];var _0x3d8b35={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xca2e0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1b503a=function(_0x24410c){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x24410c);};var _0x5f4a38=function(_0x593b85){if(!_0x593b85||!_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x3fac94='(',_0x28d98e=0x0;_0x28d98e<_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')];_0x28d98e+=0x1){_0x28d98e>0x0&&(_0x3fac94+='\x20'+_0x593b85['operator']+'\x20');_0x3fac94+=_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]?_0x5f4a38(_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]):_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x63')]+'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x64')]+(_0x1b503a(_0x593b85[_0x86d3('0x60')][_0x28d98e]['condition'])?'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x65')]:'');}return _0x3fac94+')';};var _0x4b871b={'where':{'id':_0x3193d5['id']}},_0x584a57,_0x36ee46,_0x1cbc3a,_0x682a6d,_0x5004cd;_0x4b871b=_[_0x86d3('0x38')]({},_0x4b871b,_0x268c93);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x4b871b)[_0x86d3('0x1f')](function(_0x3d3e7f){if(_0x3d3e7f){_0x584a57=_0x3d3e7f;return _0x3d3e7f['getFields']();}return null;})[_0x86d3('0x1f')](function(_0x1aaf08){if(_0x1aaf08){if(!_0x1aaf08['length']){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))](_0x86d3('0x86'),0x193);}_0x36ee46=_0x1aaf08;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2896e1){if(_0x2896e1){_0x1cbc3a=_[_0x86d3('0x69')](_0x2896e1,'id');var _0x18295c;var _0x44af1c=squel['select']();_0x44af1c[_0x86d3('0x6a')](_0x584a57[_0x86d3('0x6b')]);for(var _0x3582a2=0x0;_0x3582a2<_0x36ee46[_0x86d3('0x30')];_0x3582a2+=0x1){_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6c')]?_0x1cbc3a[_0x36ee46[_0x3582a2][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x36ee46[_0x3582a2][_0x86d3('0x63')];_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0x3d8b35[_0x36ee46[_0x3582a2]['function']],'%s',_0x18295c):_0x18295c;_0x18295c=_0x36ee46[_0x3582a2]['format']?_[_0x86d3('0x6f')](_0xca2e0[_0x36ee46[_0x3582a2][_0x86d3('0x70')]],'%s',_0x18295c):_0x18295c;if(_0x36ee46[_0x3582a2]['groupBy']){_0x44af1c[_0x86d3('0x62')](_0x18295c);}_0x36ee46[_0x3582a2][_0x86d3('0x72')]&&_0x44af1c[_0x86d3('0x33')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x72')]===_0x86d3('0x87')?![]:!![]);_0x44af1c[_0x86d3('0x63')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x73')]||_0x18295c);}if(_0x584a57[_0x86d3('0x74')]){_0x584a57[_0x86d3('0x74')]=JSON['parse'](_0x584a57['joins']);for(var _0x48a6d7=0x0;_0x48a6d7<_0x584a57['joins'][_0x86d3('0x30')];_0x48a6d7+=0x1){if(_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x158f56,_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')])&&_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey']&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x77')]&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x78')]){_0x44af1c[_0x584a57['joins'][_0x48a6d7][_0x86d3('0x29')]](_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],null,util[_0x86d3('0x70')](_0x86d3('0x88'),_0x584a57[_0x86d3('0x6b')],_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey'],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x78')]));}}}if(_0x584a57['conditions']){_0x584a57[_0x86d3('0x79')]=JSON['parse'](_0x584a57['conditions']);_0x44af1c[_0x86d3('0x35')](_0x5f4a38(_0x584a57[_0x86d3('0x79')][_0x86d3('0x62')]));}_0x5004cd=_0x44af1c[_0x86d3('0x7a')]();_0x44af1c[_0x86d3('0x1a')](_0x245b39);_0x44af1c[_0x86d3('0x18')](0x0);return;}})[_0x86d3('0x1f')](function(){if(_0x3a1acc[_0x86d3('0x89')]===_0x86d3('0x8a')){return null;}var _0x120a85=_[_0x86d3('0x38')](_0x3a1acc,{'name':_0x3a1acc[_0x86d3('0x8b')]||_0x3a1acc[_0x86d3('0x24')]||_0x584a57[_0x86d3('0x24')],'basename':_0x3b989c,'savename':util[_0x86d3('0x70')]('%s-%s.%s',_0x3a1acc['name']||_0x584a57['name'],require(_0x86d3('0x8c'))[_0x86d3('0x8d')](0x4),_0x3a1acc[_0x86d3('0x89')]||_0x86d3('0x8e')),'reportId':_0x584a57['id'],'reportType':_0x86d3('0x8f')});return db[_0x86d3('0x90')][_0x86d3('0x45')](_0x120a85,{'raw':!![]});})[_0x86d3('0x1f')](function(_0x10e23d){if(_0x584a57[_0x86d3('0x6b')]===_0x86d3('0x91')){_0x5004cd['where'](_0x584a57[_0x86d3('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}else{_0x5004cd[_0x86d3('0x35')](_0x584a57[_0x86d3('0x6b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}if(_0x10e23d){logger[_0x86d3('0x94')](_0x86d3('0x95'),_0x5004cd[_0x86d3('0x7c')]());require(_0x86d3('0x96'))[_0x86d3('0x97')](path[_0x86d3('0x50')](__dirname,_0x86d3('0x98'),_0x10e23d[_0x86d3('0x89')]),[_0x10e23d['id'],_0x5004cd[_0x86d3('0x7c')](),path[_0x86d3('0x50')](__dirname,_0x86d3('0x99'),_0x10e23d[_0x86d3('0x9a')]),_0x3b989c]);return _0x10e23d;}else{var _0x428b11=squel[_0x86d3('0x9b')]();_0x428b11[_0x86d3('0x6a')]('('+_0x5004cd['toString']()+')',_0x86d3('0x9c'));_0x428b11[_0x86d3('0x63')](_0x86d3('0x9d'),_0x86d3('0x1b'));_0x5004cd['limit'](_0x3a1acc[_0x86d3('0x1a')]||_0x245b39);_0x5004cd['offset'](_0x3a1acc['offset']||0x0);return dbH[_0x86d3('0x9e')][_0x86d3('0x2c')](_0x428b11[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]})[_0x86d3('0x1f')](function(_0x4777f1){if(!_0x4777f1['length']){_0x682a6d=0x0;}else{_0x682a6d=_0x4777f1[0x0]['count']||0x0;}return dbH['sequelize'][_0x86d3('0x2c')](_0x5004cd[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')]['QueryTypes'][_0x86d3('0x7e')]});})['then'](function(_0x435b8e){return{'rows':_0x435b8e||[],'count':_0x682a6d};});}});}exports[_0x86d3('0x9f')]=function(_0x73b8e6,_0x2c98e1){return runReport(_0x73b8e6['params'],_0x73b8e6[_0x86d3('0x2c')],_0x73b8e6[_0x86d3('0x3a')])[_0x86d3('0x1f')](respondWithResult(_0x2c98e1,null))['catch'](handleError(_0x2c98e1,null));};exports['runReport']=runReport;exports['query']=function(_0x458997,_0x1e3559){var _0x49a101=0xa;var _0x38d724=['join',_0x86d3('0x7f'),_0x86d3('0x51'),_0x86d3('0x52')];var _0x56ff91={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f347e={'SEC_TO_TIME':_0x86d3('0xa0'),'DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45b210=function(_0x144e43){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x144e43);};var _0xdc7c21=function(_0x2e0397){if(!_0x2e0397||!_0x2e0397[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x2cc617='(',_0x25339c=0x0;_0x25339c<_0x2e0397['rules'][_0x86d3('0x30')];_0x25339c+=0x1){_0x25339c>0x0&&(_0x2cc617+='\x20'+_0x2e0397[_0x86d3('0x61')]+'\x20');_0x2cc617+=_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]?_0xdc7c21(_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]):_0x2e0397['rules'][_0x25339c][_0x86d3('0x63')]+'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x64')]+(_0x45b210(_0x2e0397[_0x86d3('0x60')][_0x25339c]['condition'])?'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x65')]:'');}return _0x2cc617+')';};var _0x2c0070={'where':{'id':_0x458997[_0x86d3('0x4e')]['id']}},_0x31d436,_0x56e713,_0x525559,_0x3b9e1e,_0x1d8d7c;_0x2c0070=_['merge']({},_0x2c0070,_0x458997[_0x86d3('0x3a')]);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x2c0070)[_0x86d3('0x1f')](function(_0x1f80be){if(_0x1f80be){_0x31d436=_0x1f80be;return _0x1f80be[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x3dddbe){if(_0x3dddbe){if(!_0x3dddbe[_0x86d3('0x30')]){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56e713=_0x3dddbe;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d7e83){if(_0x1d7e83){_0x525559=_[_0x86d3('0x69')](_0x1d7e83,'id');var _0x5d9385;var _0x49a499=squel[_0x86d3('0x9b')]();_0x49a499[_0x86d3('0x6a')](_0x31d436[_0x86d3('0x6b')]);for(var _0x33e0a5=0x0;_0x33e0a5<_0x56e713['length'];_0x33e0a5+=0x1){_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6c')]?_0x525559[_0x56e713[_0x33e0a5][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x56e713[_0x33e0a5][_0x86d3('0x63')];_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6e')]?_['replace'](_0x56ff91[_0x56e713[_0x33e0a5][_0x86d3('0x6e')]],'%s',_0x5d9385):_0x5d9385;_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x1f347e[_0x56e713[_0x33e0a5]['format']],'%s',_0x5d9385):_0x5d9385;if(_0x56e713[_0x33e0a5][_0x86d3('0x71')]){_0x49a499['group'](_0x5d9385);}_0x56e713[_0x33e0a5][_0x86d3('0x72')]&&_0x49a499[_0x86d3('0x33')](_0x5d9385,_0x56e713[_0x33e0a5]['orderBy']===_0x86d3('0x87')?![]:!![]);_0x49a499[_0x86d3('0x63')](_0x5d9385,_0x56e713[_0x33e0a5][_0x86d3('0x73')]||_0x5d9385);}if(_0x31d436[_0x86d3('0x74')]){_0x31d436[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x31d436['joins']);for(var _0x10af91=0x0;_0x10af91<_0x31d436['joins'][_0x86d3('0x30')];_0x10af91+=0x1){if(_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x38d724,_0x31d436['joins'][_0x10af91][_0x86d3('0x29')])&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')]&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x77')]&&_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignKey']){_0x49a499[_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]](_0x31d436['joins'][_0x10af91]['foreignTable'],null,util[_0x86d3('0x70')]('%s.%s\x20=\x20%s.%s',_0x31d436['table'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')],_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignTable'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x78')]));}}}if(_0x31d436[_0x86d3('0x79')]){_0x31d436[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x31d436['conditions']);_0x49a499[_0x86d3('0x35')](_0xdc7c21(_0x31d436[_0x86d3('0x79')]['group']));}_0x1d8d7c=_0x49a499['clone']();_0x49a499['limit'](_0x49a101);_0x49a499[_0x86d3('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x49a499[_0x86d3('0x7c')]());return dbH[_0x86d3('0x9e')]['query'](_0x49a499['toString'](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})['then'](function(){return{'sql':_0x1d8d7c[_0x86d3('0x7c')]()};})[_0x86d3('0x1f')](respondWithResult(_0x1e3559,null))[_0x86d3('0x44')](handleError(_0x1e3559,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3b1d95a..c71cf31 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 _0x28a5=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x379974,_0x55c3ca){var _0x48ca25=function(_0x5bf4b8){while(--_0x5bf4b8){_0x379974['push'](_0x379974['shift']());}};_0x48ca25(++_0x55c3ca);}(_0x28a5,0xba));var _0x528a=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x28a5[_0x2e3545];return _0xcf18f;};'use strict';var _=require(_0x528a('0x0'));var util=require(_0x528a('0x1'));var logger=require(_0x528a('0x2'))('api');var moment=require(_0x528a('0x3'));var BPromise=require(_0x528a('0x4'));var rp=require(_0x528a('0x5'));var fs=require('fs');var path=require(_0x528a('0x6'));var rimraf=require(_0x528a('0x7'));var config=require(_0x528a('0x8'));var attributes=require(_0x528a('0x9'));module[_0x528a('0xa')]=function(_0xef35d2,_0xfac010){return _0xef35d2[_0x528a('0xb')](_0x528a('0xc'),attributes,{'tableName':_0x528a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9ef=['./analyticDefaultReport.attributes','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1dd7d8,_0x9ba9c9){var _0x81acc9=function(_0x1373b9){while(--_0x1373b9){_0x1dd7d8['push'](_0x1dd7d8['shift']());}};_0x81acc9(++_0x9ba9c9);}(_0xc9ef,0x1c5));var _0xfc9e=function(_0x5149f7,_0xfb6955){_0x5149f7=_0x5149f7-0x0;var _0x534292=_0xc9ef[_0x5149f7];return _0x534292;};'use strict';var _=require(_0xfc9e('0x0'));var util=require(_0xfc9e('0x1'));var logger=require('../../config/logger')(_0xfc9e('0x2'));var moment=require(_0xfc9e('0x3'));var BPromise=require(_0xfc9e('0x4'));var rp=require(_0xfc9e('0x5'));var fs=require('fs');var path=require(_0xfc9e('0x6'));var rimraf=require(_0xfc9e('0x7'));var config=require(_0xfc9e('0x8'));var attributes=require(_0xfc9e('0x9'));module['exports']=function(_0x21ab68,_0x81e10c){return _0x21ab68[_0xfc9e('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','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 6ba5266..2623e85 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 _0x8560=['request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x18c054,_0x455e7b){var _0x5ca622=function(_0x1ccd3a){while(--_0x1ccd3a){_0x18c054['push'](_0x18c054['shift']());}};_0x5ca622(++_0x455e7b);}(_0x8560,0x1d5));var _0x0856=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x8560[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x0856('0x0'));var util=require('util');var moment=require(_0x0856('0x1'));var BPromise=require(_0x0856('0x2'));var rs=require(_0x0856('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0856('0x4'))['db'];var utils=require(_0x0856('0x5'));var logger=require(_0x0856('0x6'))(_0x0856('0x7'));var config=require(_0x0856('0x8'));var jayson=require(_0x0856('0x9'));var client=jayson['client'][_0x0856('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55b9ec,_0x312800,_0x1dea67){return new BPromise(function(_0xffc590,_0x52304d){return client[_0x0856('0xb')](_0x55b9ec,_0x1dea67)[_0x0856('0xc')](function(_0x5976f1){logger[_0x0856('0xd')](_0x0856('0xe'),_0x312800,_0x0856('0xf'));logger[_0x0856('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x312800,'request\x20sent',JSON[_0x0856('0x11')](_0x5976f1));if(_0x5976f1['error']){if(_0x5976f1[_0x0856('0x12')][_0x0856('0x13')]===0x1f4){logger['error'](_0x0856('0xe'),_0x312800,_0x5976f1[_0x0856('0x12')][_0x0856('0x14')]);return _0x52304d(_0x5976f1[_0x0856('0x12')][_0x0856('0x14')]);}logger[_0x0856('0x12')](_0x0856('0xe'),_0x312800,_0x5976f1[_0x0856('0x12')][_0x0856('0x14')]);return _0xffc590(_0x5976f1[_0x0856('0x12')][_0x0856('0x14')]);}else{logger[_0x0856('0xd')](_0x0856('0xe'),_0x312800,_0x0856('0xf'));_0xffc590(_0x5976f1['result'][_0x0856('0x14')]);}})[_0x0856('0x15')](function(_0x2a8c07){logger[_0x0856('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x312800,_0x2a8c07);_0x52304d(_0x2a8c07);});});} \ No newline at end of file +var _0xa6a8=['rpc','../../config/environment','jayson/promise','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46bfdd,_0x342b59){var _0x5e42c5=function(_0x4fe725){while(--_0x4fe725){_0x46bfdd['push'](_0x46bfdd['shift']());}};_0x5e42c5(++_0x342b59);}(_0xa6a8,0xc6));var _0x8a6a=function(_0x4aa3fe,_0x4ba8d0){_0x4aa3fe=_0x4aa3fe-0x0;var _0x582ba8=_0xa6a8[_0x4aa3fe];return _0x582ba8;};'use strict';var _=require(_0x8a6a('0x0'));var util=require(_0x8a6a('0x1'));var moment=require(_0x8a6a('0x2'));var BPromise=require(_0x8a6a('0x3'));var rs=require(_0x8a6a('0x4'));var fs=require('fs');var Redis=require(_0x8a6a('0x5'));var db=require(_0x8a6a('0x6'))['db'];var utils=require(_0x8a6a('0x7'));var logger=require(_0x8a6a('0x8'))(_0x8a6a('0x9'));var config=require(_0x8a6a('0xa'));var jayson=require(_0x8a6a('0xb'));var client=jayson[_0x8a6a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54418e,_0x360e11,_0x266242){return new BPromise(function(_0x102ce5,_0x1ca8bb){return client['request'](_0x54418e,_0x266242)[_0x8a6a('0xd')](function(_0x49c723){logger[_0x8a6a('0xe')](_0x8a6a('0xf'),_0x360e11,_0x8a6a('0x10'));logger[_0x8a6a('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x360e11,_0x8a6a('0x10'),JSON['stringify'](_0x49c723));if(_0x49c723[_0x8a6a('0x12')]){if(_0x49c723[_0x8a6a('0x12')][_0x8a6a('0x13')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x360e11,_0x49c723[_0x8a6a('0x12')]['message']);return _0x1ca8bb(_0x49c723['error']['message']);}logger[_0x8a6a('0x12')](_0x8a6a('0xf'),_0x360e11,_0x49c723['error'][_0x8a6a('0x14')]);return _0x102ce5(_0x49c723['error'][_0x8a6a('0x14')]);}else{logger[_0x8a6a('0xe')](_0x8a6a('0xf'),_0x360e11,_0x8a6a('0x10'));_0x102ce5(_0x49c723[_0x8a6a('0x15')][_0x8a6a('0x14')]);}})[_0x8a6a('0x16')](function(_0x5ae307){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x360e11,_0x5ae307);_0x1ca8bb(_0x5ae307);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index afe8830..25c7a0e 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 _0xc96a=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','preview','run','query','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x575bd0,_0x85b617){var _0x35940f=function(_0x544b35){while(--_0x544b35){_0x575bd0['push'](_0x575bd0['shift']());}};_0x35940f(++_0x85b617);}(_0xc96a,0x14a));var _0xac96=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xc96a[_0x257642];return _0x3d813b;};'use strict';var multer=require(_0xac96('0x0'));var util=require(_0xac96('0x1'));var path=require(_0xac96('0x2'));var timeout=require(_0xac96('0x3'));var express=require(_0xac96('0x4'));var router=express['Router']();var fs_extra=require(_0xac96('0x5'));var auth=require(_0xac96('0x6'));var interaction=require(_0xac96('0x7'));var config=require(_0xac96('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0xac96('0x9')]('/',auth['isAuthenticated'](),controller[_0xac96('0xa')]);router[_0xac96('0x9')]('/:id',auth[_0xac96('0xb')](),controller[_0xac96('0xc')]);router[_0xac96('0x9')]('/:id/preview',auth[_0xac96('0xb')](),controller[_0xac96('0xd')]);router['get']('/:id/run',auth[_0xac96('0xb')](),controller[_0xac96('0xe')]);router['get']('/:id/query',auth[_0xac96('0xb')](),controller[_0xac96('0xf')]);router['post']('/',auth[_0xac96('0xb')](),controller['create']);router[_0xac96('0x10')](_0xac96('0x11'),auth[_0xac96('0xb')](),controller[_0xac96('0x12')]);router['delete']('/:id',auth[_0xac96('0xb')](),controller[_0xac96('0x13')]);module[_0xac96('0x14')]=router; \ No newline at end of file +var _0x83fc=['util','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x83fc,0x1c7));var _0xc83f=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x83fc[_0x556bb1];return _0x45455f;};'use strict';var multer=require(_0xc83f('0x0'));var util=require(_0xc83f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc83f('0x2')]();var fs_extra=require(_0xc83f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc83f('0x4'));var config=require(_0xc83f('0x5'));var controller=require(_0xc83f('0x6'));router[_0xc83f('0x7')]('/',auth[_0xc83f('0x8')](),controller[_0xc83f('0x9')]);router[_0xc83f('0x7')](_0xc83f('0xa'),auth[_0xc83f('0x8')](),controller[_0xc83f('0xb')]);router[_0xc83f('0x7')](_0xc83f('0xc'),auth['isAuthenticated'](),controller[_0xc83f('0xd')]);router[_0xc83f('0x7')](_0xc83f('0xe'),auth[_0xc83f('0x8')](),controller['run']);router['get'](_0xc83f('0xf'),auth['isAuthenticated'](),controller[_0xc83f('0x10')]);router[_0xc83f('0x11')]('/',auth[_0xc83f('0x8')](),controller[_0xc83f('0x12')]);router[_0xc83f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xc83f('0x14')]);router[_0xc83f('0x15')]('/:id',auth[_0xc83f('0x8')](),controller[_0xc83f('0x16')]);module[_0xc83f('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 68fbe80..e8ff665 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 _0x3b9f=['sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x345a17,_0x3b9d2a){var _0xd0f947=function(_0x519fcd){while(--_0x519fcd){_0x345a17['push'](_0x345a17['shift']());}};_0xd0f947(++_0x3b9d2a);}(_0x3b9f,0x118));var _0xf3b9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3b9f[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xf3b9('0x0'));var moment=require(_0xf3b9('0x1'));module[_0xf3b9('0x2')]={'name':{'type':Sequelize[_0xf3b9('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xf3b9('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xf3b9('0x4'),_0xf3b9('0x5'),_0xf3b9('0x6')),'allowNull':![],'defaultValue':_0xf3b9('0x4')},'savename':{'type':Sequelize[_0xf3b9('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xf3b9('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xf3b9('0x8')},'type':{'type':Sequelize[_0xf3b9('0x9')](_0xf3b9('0xa'),_0xf3b9('0xb')),'allowNull':![],'defaultValue':_0xf3b9('0xa')},'reportId':{'type':Sequelize[_0xf3b9('0xc')](0xb)[_0xf3b9('0xd')]},'reportType':{'type':Sequelize[_0xf3b9('0x3')]}}; \ No newline at end of file +var _0x5438=['moment','STRING','ENUM','csv','pdf','xlsx','DATE','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x4183de,_0x146a40){var _0x29b5b3=function(_0x251b90){while(--_0x251b90){_0x4183de['push'](_0x4183de['shift']());}};_0x29b5b3(++_0x146a40);}(_0x5438,0x83));var _0x8543=function(_0x191227,_0x53604f){_0x191227=_0x191227-0x0;var _0x1133b8=_0x5438[_0x191227];return _0x1133b8;};'use strict';var Sequelize=require(_0x8543('0x0'));var moment=require(_0x8543('0x1'));module['exports']={'name':{'type':Sequelize[_0x8543('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x8543('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x8543('0x3')](_0x8543('0x4'),_0x8543('0x5'),_0x8543('0x6')),'allowNull':![],'defaultValue':_0x8543('0x4')},'savename':{'type':Sequelize[_0x8543('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8543('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x8543('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x8543('0x3')](_0x8543('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x8543('0x9')](0xb)[_0x8543('0xa')]},'reportType':{'type':Sequelize[_0x8543('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index a1358b8..a2e9fdf 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 _0xa067=['reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','user','role','get','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x20c27c,_0x191b06){var _0x3bbc05=function(_0x300bc6){while(--_0x300bc6){_0x20c27c['push'](_0x20c27c['shift']());}};_0x3bbc05(++_0x191b06);}(_0xa067,0x100));var _0x7a06=function(_0x53247f,_0x51d86e){_0x53247f=_0x53247f-0x0;var _0x2d5f1f=_0xa067[_0x53247f];return _0x2d5f1f;};'use strict';var emlformat=require(_0x7a06('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a06('0x1'));var jsonpatch=require(_0x7a06('0x2'));var rp=require('request-promise');var moment=require(_0x7a06('0x3'));var BPromise=require(_0x7a06('0x4'));var Mustache=require(_0x7a06('0x5'));var util=require(_0x7a06('0x6'));var path=require(_0x7a06('0x7'));var sox=require(_0x7a06('0x8'));var csv=require(_0x7a06('0x9'));var ejs=require(_0x7a06('0xa'));var fs=require('fs');var fs_extra=require(_0x7a06('0xb'));var _=require(_0x7a06('0xc'));var squel=require(_0x7a06('0xd'));var crypto=require(_0x7a06('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7a06('0xf'));var toCsv=require(_0x7a06('0x9'));var querystring=require(_0x7a06('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a06('0x11'));var qs=require(_0x7a06('0x12'));var as=require(_0x7a06('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a06('0x14'))('api');var utils=require(_0x7a06('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7a06('0x16'));var db=require(_0x7a06('0x17'))['db'];function respondWithStatusCode(_0x133160,_0x294356){_0x294356=_0x294356||0xcc;return function(_0x2143ea){if(_0x2143ea){return _0x133160[_0x7a06('0x18')](_0x294356);}return _0x133160[_0x7a06('0x19')](_0x294356)[_0x7a06('0x1a')]();};}function respondWithResult(_0x9c4e9,_0x4d35f7){_0x4d35f7=_0x4d35f7||0xc8;return function(_0x46c13f){if(_0x46c13f){return _0x9c4e9[_0x7a06('0x19')](_0x4d35f7)[_0x7a06('0x1b')](_0x46c13f);}};}function respondWithFilteredResult(_0x1e2502,_0x28c218){return function(_0x54fcd7){if(_0x54fcd7){var _0x208de2=typeof _0x28c218['offset']===_0x7a06('0x1c')&&typeof _0x28c218[_0x7a06('0x1d')]==='undefined';var _0x41dae3=_0x54fcd7[_0x7a06('0x1e')];var _0x225d87=_0x208de2?0x0:_0x28c218[_0x7a06('0x1f')];var _0x41076f=_0x208de2?_0x54fcd7[_0x7a06('0x1e')]:_0x28c218[_0x7a06('0x1f')]+_0x28c218[_0x7a06('0x1d')];var _0x125570;if(_0x41076f>=_0x41dae3){_0x41076f=_0x41dae3;_0x125570=0xc8;}else{_0x125570=0xce;}_0x1e2502[_0x7a06('0x19')](_0x125570);return _0x1e2502[_0x7a06('0x20')](_0x7a06('0x21'),_0x225d87+'-'+_0x41076f+'/'+_0x41dae3)['json'](_0x54fcd7);}return null;};}function patchUpdates(_0x4b08f2){return function(_0x4b8271){try{jsonpatch[_0x7a06('0x22')](_0x4b8271,_0x4b08f2,!![]);}catch(_0x2dff20){return BPromise[_0x7a06('0x23')](_0x2dff20);}return _0x4b8271[_0x7a06('0x24')]();};}function saveUpdates(_0x4aba93,_0x1e0e05){return function(_0x28ad19){if(_0x28ad19){return _0x28ad19[_0x7a06('0x25')](_0x4aba93)[_0x7a06('0x26')](function(_0x586ed6){return _0x586ed6;});}return null;};}function removeEntity(_0x5aabf9,_0xa57287){return function(_0x1bd3fa){if(_0x1bd3fa){return _0x1bd3fa[_0x7a06('0x27')]()[_0x7a06('0x26')](function(){var _0x5ef636=_0x1bd3fa['get']({'plain':!![]});var _0xdc7dfc='ExtractedReports';return db[_0x7a06('0x28')][_0x7a06('0x27')]({'where':{'type':_0xdc7dfc,'resourceId':_0x5ef636['id']}})[_0x7a06('0x26')](function(){return _0x1bd3fa;});})['then'](function(){_0x5aabf9[_0x7a06('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x328e45,_0xb6eab4){return function(_0x1bc745){if(!_0x1bc745){_0x328e45[_0x7a06('0x18')](0x194);}return _0x1bc745;};}function handleError(_0x1dca9c,_0x5b2450){_0x5b2450=_0x5b2450||0x1f4;return function(_0x3275bc){logger[_0x7a06('0x29')](_0x3275bc[_0x7a06('0x2a')]);if(_0x3275bc[_0x7a06('0x2b')]){delete _0x3275bc[_0x7a06('0x2b')];}_0x1dca9c[_0x7a06('0x19')](_0x5b2450)[_0x7a06('0x2c')](_0x3275bc);};}exports[_0x7a06('0x2d')]=function(_0x5276b6,_0x22f360){var _0x2df6ab={},_0x19d40e={},_0x3128b2={'count':0x0,'rows':[]};var _0x30e450=_['map'](db[_0x7a06('0x2e')]['rawAttributes'],function(_0x312aae){return{'name':_0x312aae[_0x7a06('0x2f')],'type':_0x312aae[_0x7a06('0x30')][_0x7a06('0x31')]};});_0x19d40e[_0x7a06('0x32')]=_[_0x7a06('0x33')](_0x30e450,_0x7a06('0x2b'));_0x19d40e[_0x7a06('0x34')]=_[_0x7a06('0x35')](_0x5276b6[_0x7a06('0x34')]);_0x19d40e[_0x7a06('0x36')]=_[_0x7a06('0x37')](_0x19d40e[_0x7a06('0x32')],_0x19d40e[_0x7a06('0x34')]);_0x2df6ab[_0x7a06('0x38')]=_[_0x7a06('0x37')](_0x19d40e['model'],qs[_0x7a06('0x39')](_0x5276b6[_0x7a06('0x34')][_0x7a06('0x39')]));_0x2df6ab['attributes']=_0x2df6ab[_0x7a06('0x38')][_0x7a06('0x3a')]?_0x2df6ab[_0x7a06('0x38')]:_0x19d40e['model'];if(!_0x5276b6[_0x7a06('0x34')][_0x7a06('0x3b')]('nolimit')){_0x2df6ab[_0x7a06('0x1d')]=qs['limit'](_0x5276b6[_0x7a06('0x34')][_0x7a06('0x1d')]);_0x2df6ab[_0x7a06('0x1f')]=qs[_0x7a06('0x1f')](_0x5276b6['query']['offset']);}_0x2df6ab['order']=qs[_0x7a06('0x3c')](_0x5276b6[_0x7a06('0x34')]['sort']);_0x2df6ab['where']=qs[_0x7a06('0x36')](_[_0x7a06('0x3d')](_0x5276b6[_0x7a06('0x34')],_0x19d40e[_0x7a06('0x36')]),_0x30e450);if(_0x5276b6['query'][_0x7a06('0x3e')]){_0x2df6ab[_0x7a06('0x3f')]=_[_0x7a06('0x40')](_0x2df6ab[_0x7a06('0x3f')],{'$or':_[_0x7a06('0x33')](_0x30e450,function(_0x4bdc51){if(_0x4bdc51[_0x7a06('0x30')]!==_0x7a06('0x41')){var _0x506f46={};_0x506f46[_0x4bdc51['name']]={'$like':'%'+_0x5276b6['query'][_0x7a06('0x3e')]+'%'};return _0x506f46;}})});}_0x2df6ab=_[_0x7a06('0x40')]({},_0x2df6ab,_0x5276b6[_0x7a06('0x42')]);var _0x2c0114={'where':_0x2df6ab[_0x7a06('0x3f')]};return db[_0x7a06('0x2e')]['count'](_0x2c0114)[_0x7a06('0x26')](function(_0x49c6a9){_0x3128b2[_0x7a06('0x1e')]=_0x49c6a9;if(_0x5276b6[_0x7a06('0x34')][_0x7a06('0x43')]){_0x2df6ab[_0x7a06('0x44')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7a06('0x45')](_0x2df6ab);})['then'](function(_0x270d12){_0x3128b2[_0x7a06('0x46')]=_0x270d12;return _0x3128b2;})[_0x7a06('0x26')](respondWithFilteredResult(_0x22f360,_0x2df6ab))[_0x7a06('0x47')](handleError(_0x22f360,null));};exports['show']=function(_0x5b71ef,_0x334d16){var _0x40d4e4={'raw':!![],'where':{'id':_0x5b71ef[_0x7a06('0x48')]['id']}},_0x45ede2={};_0x45ede2[_0x7a06('0x32')]=_[_0x7a06('0x35')](db[_0x7a06('0x2e')][_0x7a06('0x49')]);_0x45ede2[_0x7a06('0x34')]=_['keys'](_0x5b71ef[_0x7a06('0x34')]);_0x45ede2[_0x7a06('0x36')]=_[_0x7a06('0x37')](_0x45ede2[_0x7a06('0x32')],_0x45ede2['query']);_0x40d4e4[_0x7a06('0x38')]=_[_0x7a06('0x37')](_0x45ede2['model'],qs[_0x7a06('0x39')](_0x5b71ef[_0x7a06('0x34')][_0x7a06('0x39')]));_0x40d4e4[_0x7a06('0x38')]=_0x40d4e4['attributes'][_0x7a06('0x3a')]?_0x40d4e4['attributes']:_0x45ede2['model'];if(_0x5b71ef[_0x7a06('0x34')][_0x7a06('0x43')]){_0x40d4e4['include']=[{'all':!![]}];}_0x40d4e4=_[_0x7a06('0x40')]({},_0x40d4e4,_0x5b71ef[_0x7a06('0x42')]);return db['AnalyticExtractedReport'][_0x7a06('0x4a')](_0x40d4e4)[_0x7a06('0x26')](handleEntityNotFound(_0x334d16,null))[_0x7a06('0x26')](respondWithResult(_0x334d16,null))[_0x7a06('0x47')](handleError(_0x334d16,null));};exports[_0x7a06('0x4b')]=function(_0x1f317e,_0x57ad84){return db[_0x7a06('0x2e')]['create'](_0x1f317e['body'],{})[_0x7a06('0x26')](function(_0x2f8bcd){var _0x45eaa0=_0x1f317e[_0x7a06('0x4c')]['get']({'plain':!![]});if(!_0x45eaa0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45eaa0[_0x7a06('0x4d')]===_0x7a06('0x4c')){var _0x2b6af4=_0x2f8bcd[_0x7a06('0x4e')]({'plain':!![]});var _0x28dff6=_0x7a06('0x4f');return db[_0x7a06('0x50')][_0x7a06('0x4a')]({'where':{'name':_0x28dff6,'userProfileId':_0x45eaa0[_0x7a06('0x51')]},'raw':!![]})[_0x7a06('0x26')](function(_0x39ab66){if(_0x39ab66&&_0x39ab66[_0x7a06('0x52')]===0x0){return db[_0x7a06('0x28')]['create']({'name':_0x2b6af4[_0x7a06('0x2b')],'resourceId':_0x2b6af4['id'],'type':_0x39ab66[_0x7a06('0x2b')],'sectionId':_0x39ab66['id']},{})[_0x7a06('0x26')](function(){return _0x2f8bcd;});}else{return _0x2f8bcd;}})[_0x7a06('0x47')](function(_0x150144){logger[_0x7a06('0x29')](_0x7a06('0x53'),_0x150144);throw _0x150144;});}return _0x2f8bcd;})[_0x7a06('0x26')](respondWithResult(_0x57ad84,0xc9))[_0x7a06('0x47')](handleError(_0x57ad84,null));};exports[_0x7a06('0x25')]=function(_0x5f58ad,_0xf786f7){if(_0x5f58ad[_0x7a06('0x54')]['id']){delete _0x5f58ad['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5f58ad[_0x7a06('0x48')]['id']}})[_0x7a06('0x26')](handleEntityNotFound(_0xf786f7,null))[_0x7a06('0x26')](saveUpdates(_0x5f58ad[_0x7a06('0x54')],null))['then'](respondWithResult(_0xf786f7,null))[_0x7a06('0x47')](handleError(_0xf786f7,null));};exports['destroy']=function(_0x4e46d8,_0x6728a3){return db['AnalyticExtractedReport'][_0x7a06('0x4a')]({'where':{'id':_0x4e46d8[_0x7a06('0x48')]['id']}})['then'](handleEntityNotFound(_0x6728a3,null))['then'](removeEntity(_0x6728a3,null))[_0x7a06('0x47')](handleError(_0x6728a3,null));};exports[_0x7a06('0x55')]=function(_0x3d530e,_0x5c046b,_0x5af665){return db['AnalyticExtractedReport'][_0x7a06('0x4a')]({'where':{'id':_0x3d530e[_0x7a06('0x48')]['id']},'attributes':[_0x7a06('0x2b'),'basename',_0x7a06('0x56'),_0x7a06('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x5c046b,null))[_0x7a06('0x26')](function(_0x58a2fc){if(_0x58a2fc){if(!fs[_0x7a06('0x58')](path[_0x7a06('0x59')](config[_0x7a06('0x5a')],_0x7a06('0x5b'),_0x58a2fc[_0x7a06('0x56')]))){throw new db[(_0x7a06('0x5c'))]['ValidationError'](_0x7a06('0x5d'));}if(_0x3d530e[_0x7a06('0x34')][_0x7a06('0x5e')]){return _0x5c046b[_0x7a06('0x18')](0xc8);}return _0x5c046b[_0x7a06('0x55')](path[_0x7a06('0x59')](config[_0x7a06('0x5a')],_0x7a06('0x5b'),_0x58a2fc[_0x7a06('0x56')]),util['format'](_0x7a06('0x5f'),_0x58a2fc['basename']||_0x58a2fc[_0x7a06('0x2b')],_0x58a2fc[_0x7a06('0x57')][_0x7a06('0x60')]()));}})[_0x7a06('0x47')](handleError(_0x5c046b,null));}; \ No newline at end of file +var _0x16c9=['rows','catch','show','params','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','download','basename','output','join','root','server/files/reports','savename','Sequelize','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','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','Content-Range','apply','save','destroy','get','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','findAll'];(function(_0x424f96,_0x30514e){var _0x3f838e=function(_0x4e8429){while(--_0x4e8429){_0x424f96['push'](_0x424f96['shift']());}};_0x3f838e(++_0x30514e);}(_0x16c9,0x138));var _0x916c=function(_0x5dfd8b,_0x5081ce){_0x5dfd8b=_0x5dfd8b-0x0;var _0x39d6e2=_0x16c9[_0x5dfd8b];return _0x39d6e2;};'use strict';var emlformat=require(_0x916c('0x0'));var rimraf=require(_0x916c('0x1'));var zipdir=require(_0x916c('0x2'));var jsonpatch=require(_0x916c('0x3'));var rp=require(_0x916c('0x4'));var moment=require(_0x916c('0x5'));var BPromise=require(_0x916c('0x6'));var Mustache=require(_0x916c('0x7'));var util=require(_0x916c('0x8'));var path=require(_0x916c('0x9'));var sox=require(_0x916c('0xa'));var csv=require(_0x916c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x916c('0xc'));var _=require(_0x916c('0xd'));var squel=require(_0x916c('0xe'));var crypto=require('crypto');var jsforce=require(_0x916c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x916c('0x10'));var authService=require(_0x916c('0x11'));var qs=require(_0x916c('0x12'));var as=require(_0x916c('0x13'));var hardwareService=require(_0x916c('0x14'));var logger=require('../../config/logger')(_0x916c('0x15'));var utils=require(_0x916c('0x16'));var config=require(_0x916c('0x17'));var licenseUtil=require(_0x916c('0x18'));var db=require(_0x916c('0x19'))['db'];function respondWithStatusCode(_0x92b23a,_0xed001e){_0xed001e=_0xed001e||0xcc;return function(_0x25efcb){if(_0x25efcb){return _0x92b23a[_0x916c('0x1a')](_0xed001e);}return _0x92b23a[_0x916c('0x1b')](_0xed001e)[_0x916c('0x1c')]();};}function respondWithResult(_0xc26a0d,_0x523578){_0x523578=_0x523578||0xc8;return function(_0x3f727a){if(_0x3f727a){return _0xc26a0d[_0x916c('0x1b')](_0x523578)[_0x916c('0x1d')](_0x3f727a);}};}function respondWithFilteredResult(_0x418f0e,_0x383885){return function(_0x45fff2){if(_0x45fff2){var _0xd6f0bf=typeof _0x383885[_0x916c('0x1e')]===_0x916c('0x1f')&&typeof _0x383885[_0x916c('0x20')]===_0x916c('0x1f');var _0xffdeed=_0x45fff2[_0x916c('0x21')];var _0x36c884=_0xd6f0bf?0x0:_0x383885['offset'];var _0x1f13cd=_0xd6f0bf?_0x45fff2[_0x916c('0x21')]:_0x383885[_0x916c('0x1e')]+_0x383885[_0x916c('0x20')];var _0x1f6ef6;if(_0x1f13cd>=_0xffdeed){_0x1f13cd=_0xffdeed;_0x1f6ef6=0xc8;}else{_0x1f6ef6=0xce;}_0x418f0e[_0x916c('0x1b')](_0x1f6ef6);return _0x418f0e[_0x916c('0x22')](_0x916c('0x23'),_0x36c884+'-'+_0x1f13cd+'/'+_0xffdeed)[_0x916c('0x1d')](_0x45fff2);}return null;};}function patchUpdates(_0x454647){return function(_0x20e91a){try{jsonpatch[_0x916c('0x24')](_0x20e91a,_0x454647,!![]);}catch(_0xeab388){return BPromise['reject'](_0xeab388);}return _0x20e91a[_0x916c('0x25')]();};}function saveUpdates(_0x188ed7,_0x59d3aa){return function(_0x1e281a){if(_0x1e281a){return _0x1e281a['update'](_0x188ed7)['then'](function(_0xddab4f){return _0xddab4f;});}return null;};}function removeEntity(_0xf26c05,_0x354976){return function(_0x45354a){if(_0x45354a){return _0x45354a[_0x916c('0x26')]()['then'](function(){var _0x4db852=_0x45354a[_0x916c('0x27')]({'plain':!![]});var _0x45f1ec='ExtractedReports';return db['UserProfileResource'][_0x916c('0x26')]({'where':{'type':_0x45f1ec,'resourceId':_0x4db852['id']}})[_0x916c('0x28')](function(){return _0x45354a;});})['then'](function(){_0xf26c05[_0x916c('0x1b')](0xcc)[_0x916c('0x1c')]();});}};}function handleEntityNotFound(_0x13ab85,_0x45586c){return function(_0x3e4c7d){if(!_0x3e4c7d){_0x13ab85[_0x916c('0x1a')](0x194);}return _0x3e4c7d;};}function handleError(_0x30a2eb,_0x4673cd){_0x4673cd=_0x4673cd||0x1f4;return function(_0x4ffc7a){logger[_0x916c('0x29')](_0x4ffc7a[_0x916c('0x2a')]);if(_0x4ffc7a[_0x916c('0x2b')]){delete _0x4ffc7a[_0x916c('0x2b')];}_0x30a2eb[_0x916c('0x1b')](_0x4673cd)[_0x916c('0x2c')](_0x4ffc7a);};}exports[_0x916c('0x2d')]=function(_0x4954ac,_0x48e435){var _0x35f94c={},_0x587e7d={},_0x5a4380={'count':0x0,'rows':[]};var _0xcf829e=_['map'](db['AnalyticExtractedReport'][_0x916c('0x2e')],function(_0x5c42b8){return{'name':_0x5c42b8[_0x916c('0x2f')],'type':_0x5c42b8[_0x916c('0x30')]['key']};});_0x587e7d[_0x916c('0x31')]=_[_0x916c('0x32')](_0xcf829e,_0x916c('0x2b'));_0x587e7d[_0x916c('0x33')]=_[_0x916c('0x34')](_0x4954ac['query']);_0x587e7d['filters']=_['intersection'](_0x587e7d['model'],_0x587e7d[_0x916c('0x33')]);_0x35f94c[_0x916c('0x35')]=_['intersection'](_0x587e7d[_0x916c('0x31')],qs[_0x916c('0x36')](_0x4954ac[_0x916c('0x33')][_0x916c('0x36')]));_0x35f94c[_0x916c('0x35')]=_0x35f94c['attributes'][_0x916c('0x37')]?_0x35f94c[_0x916c('0x35')]:_0x587e7d[_0x916c('0x31')];if(!_0x4954ac[_0x916c('0x33')]['hasOwnProperty']('nolimit')){_0x35f94c[_0x916c('0x20')]=qs[_0x916c('0x20')](_0x4954ac[_0x916c('0x33')][_0x916c('0x20')]);_0x35f94c[_0x916c('0x1e')]=qs[_0x916c('0x1e')](_0x4954ac[_0x916c('0x33')][_0x916c('0x1e')]);}_0x35f94c[_0x916c('0x38')]=qs[_0x916c('0x39')](_0x4954ac[_0x916c('0x33')][_0x916c('0x39')]);_0x35f94c[_0x916c('0x3a')]=qs[_0x916c('0x3b')](_[_0x916c('0x3c')](_0x4954ac['query'],_0x587e7d['filters']),_0xcf829e);if(_0x4954ac[_0x916c('0x33')][_0x916c('0x3d')]){_0x35f94c['where']=_[_0x916c('0x3e')](_0x35f94c[_0x916c('0x3a')],{'$or':_[_0x916c('0x32')](_0xcf829e,function(_0x1d8f21){if(_0x1d8f21[_0x916c('0x30')]!==_0x916c('0x3f')){var _0x466f68={};_0x466f68[_0x1d8f21['name']]={'$like':'%'+_0x4954ac[_0x916c('0x33')][_0x916c('0x3d')]+'%'};return _0x466f68;}})});}_0x35f94c=_[_0x916c('0x3e')]({},_0x35f94c,_0x4954ac[_0x916c('0x40')]);var _0x2ffe0f={'where':_0x35f94c[_0x916c('0x3a')]};return db[_0x916c('0x41')][_0x916c('0x21')](_0x2ffe0f)[_0x916c('0x28')](function(_0x38a4cb){_0x5a4380['count']=_0x38a4cb;if(_0x4954ac[_0x916c('0x33')][_0x916c('0x42')]){_0x35f94c['include']=[{'all':!![]}];}return db[_0x916c('0x41')][_0x916c('0x43')](_0x35f94c);})[_0x916c('0x28')](function(_0x138fdd){_0x5a4380[_0x916c('0x44')]=_0x138fdd;return _0x5a4380;})[_0x916c('0x28')](respondWithFilteredResult(_0x48e435,_0x35f94c))[_0x916c('0x45')](handleError(_0x48e435,null));};exports[_0x916c('0x46')]=function(_0x5a1d36,_0x51a027){var _0x34e108={'raw':!![],'where':{'id':_0x5a1d36[_0x916c('0x47')]['id']}},_0x1d0c36={};_0x1d0c36[_0x916c('0x31')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x1d0c36[_0x916c('0x33')]=_[_0x916c('0x34')](_0x5a1d36['query']);_0x1d0c36[_0x916c('0x3b')]=_[_0x916c('0x48')](_0x1d0c36[_0x916c('0x31')],_0x1d0c36[_0x916c('0x33')]);_0x34e108['attributes']=_['intersection'](_0x1d0c36[_0x916c('0x31')],qs[_0x916c('0x36')](_0x5a1d36[_0x916c('0x33')]['fields']));_0x34e108[_0x916c('0x35')]=_0x34e108['attributes'][_0x916c('0x37')]?_0x34e108['attributes']:_0x1d0c36[_0x916c('0x31')];if(_0x5a1d36[_0x916c('0x33')][_0x916c('0x42')]){_0x34e108[_0x916c('0x49')]=[{'all':!![]}];}_0x34e108=_['merge']({},_0x34e108,_0x5a1d36[_0x916c('0x40')]);return db[_0x916c('0x41')]['find'](_0x34e108)[_0x916c('0x28')](handleEntityNotFound(_0x51a027,null))[_0x916c('0x28')](respondWithResult(_0x51a027,null))[_0x916c('0x45')](handleError(_0x51a027,null));};exports[_0x916c('0x4a')]=function(_0x770a17,_0x5b5bd1){return db[_0x916c('0x41')][_0x916c('0x4a')](_0x770a17[_0x916c('0x4b')],{})[_0x916c('0x28')](function(_0x4ec03b){var _0x190ca1=_0x770a17[_0x916c('0x4c')]['get']({'plain':!![]});if(!_0x190ca1)throw new Error(_0x916c('0x4d'));if(_0x190ca1['role']===_0x916c('0x4c')){var _0x1aa655=_0x4ec03b[_0x916c('0x27')]({'plain':!![]});var _0x493300=_0x916c('0x4e');return db[_0x916c('0x4f')]['find']({'where':{'name':_0x493300,'userProfileId':_0x190ca1[_0x916c('0x50')]},'raw':!![]})[_0x916c('0x28')](function(_0x3ffd8f){if(_0x3ffd8f&&_0x3ffd8f[_0x916c('0x51')]===0x0){return db[_0x916c('0x52')][_0x916c('0x4a')]({'name':_0x1aa655[_0x916c('0x2b')],'resourceId':_0x1aa655['id'],'type':_0x3ffd8f[_0x916c('0x2b')],'sectionId':_0x3ffd8f['id']},{})['then'](function(){return _0x4ec03b;});}else{return _0x4ec03b;}})[_0x916c('0x45')](function(_0x2a87e5){logger[_0x916c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a87e5);throw _0x2a87e5;});}return _0x4ec03b;})['then'](respondWithResult(_0x5b5bd1,0xc9))[_0x916c('0x45')](handleError(_0x5b5bd1,null));};exports['update']=function(_0x32a7f9,_0x2aa2ef){if(_0x32a7f9['body']['id']){delete _0x32a7f9['body']['id'];}return db[_0x916c('0x41')][_0x916c('0x53')]({'where':{'id':_0x32a7f9[_0x916c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2aa2ef,null))[_0x916c('0x28')](saveUpdates(_0x32a7f9[_0x916c('0x4b')],null))[_0x916c('0x28')](respondWithResult(_0x2aa2ef,null))[_0x916c('0x45')](handleError(_0x2aa2ef,null));};exports[_0x916c('0x26')]=function(_0x1f8bf1,_0x4918fd){return db[_0x916c('0x41')][_0x916c('0x53')]({'where':{'id':_0x1f8bf1['params']['id']}})[_0x916c('0x28')](handleEntityNotFound(_0x4918fd,null))[_0x916c('0x28')](removeEntity(_0x4918fd,null))[_0x916c('0x45')](handleError(_0x4918fd,null));};exports[_0x916c('0x54')]=function(_0x410996,_0x1e93d2,_0x278a70){return db['AnalyticExtractedReport'][_0x916c('0x53')]({'where':{'id':_0x410996['params']['id']},'attributes':[_0x916c('0x2b'),_0x916c('0x55'),'savename',_0x916c('0x56')],'raw':!![]})[_0x916c('0x28')](handleEntityNotFound(_0x1e93d2,null))['then'](function(_0x55b093){if(_0x55b093){if(!fs['existsSync'](path[_0x916c('0x57')](config[_0x916c('0x58')],_0x916c('0x59'),_0x55b093[_0x916c('0x5a')]))){throw new db[(_0x916c('0x5b'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x410996[_0x916c('0x33')]['exists']){return _0x1e93d2[_0x916c('0x1a')](0xc8);}return _0x1e93d2['download'](path['join'](config[_0x916c('0x58')],_0x916c('0x59'),_0x55b093[_0x916c('0x5a')]),util[_0x916c('0x5c')](_0x916c('0x5d'),_0x55b093['basename']||_0x55b093['name'],_0x55b093[_0x916c('0x56')][_0x916c('0x5e')]()));}})[_0x916c('0x45')](handleError(_0x1e93d2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7771259..8f116eb 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 _0x0f0a=['api','moment','bluebird','request-promise','path','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger'];(function(_0xb4d870,_0x98779e){var _0x47ab29=function(_0x483625){while(--_0x483625){_0xb4d870['push'](_0xb4d870['shift']());}};_0x47ab29(++_0x98779e);}(_0x0f0a,0x1aa));var _0xa0f0=function(_0x23bc17,_0x12336c){_0x23bc17=_0x23bc17-0x0;var _0x3afcde=_0x0f0a[_0x23bc17];return _0x3afcde;};'use strict';var _=require(_0xa0f0('0x0'));var util=require(_0xa0f0('0x1'));var logger=require(_0xa0f0('0x2'))(_0xa0f0('0x3'));var moment=require(_0xa0f0('0x4'));var BPromise=require(_0xa0f0('0x5'));var rp=require(_0xa0f0('0x6'));var fs=require('fs');var path=require(_0xa0f0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa0f0('0x8'));module['exports']=function(_0x411bb9,_0x5600ce){return _0x411bb9['define'](_0xa0f0('0x9'),attributes,{'tableName':_0xa0f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76d5=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4f98eb,_0x3ffbc7){var _0x4e9b8c=function(_0x2815c2){while(--_0x2815c2){_0x4f98eb['push'](_0x4f98eb['shift']());}};_0x4e9b8c(++_0x3ffbc7);}(_0x76d5,0xbd));var _0x576d=function(_0x37786a,_0x266737){_0x37786a=_0x37786a-0x0;var _0x136d66=_0x76d5[_0x37786a];return _0x136d66;};'use strict';var _=require(_0x576d('0x0'));var util=require(_0x576d('0x1'));var logger=require(_0x576d('0x2'))(_0x576d('0x3'));var moment=require(_0x576d('0x4'));var BPromise=require(_0x576d('0x5'));var rp=require(_0x576d('0x6'));var fs=require('fs');var path=require(_0x576d('0x7'));var rimraf=require(_0x576d('0x8'));var config=require(_0x576d('0x9'));var attributes=require(_0x576d('0xa'));module[_0x576d('0xb')]=function(_0x2a626e,_0x14faa1){return _0x2a626e[_0x576d('0xc')](_0x576d('0xd'),attributes,{'tableName':_0x576d('0xe'),'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 60fa7f5..ec58b22 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 _0x5d84=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d84,0x82));var _0x45d8=function(_0x4c63e7,_0xff354e){_0x4c63e7=_0x4c63e7-0x0;var _0x59735f=_0x5d84[_0x4c63e7];return _0x59735f;};'use strict';var _=require(_0x45d8('0x0'));var util=require(_0x45d8('0x1'));var moment=require(_0x45d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x45d8('0x3'));var fs=require('fs');var Redis=require(_0x45d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x45d8('0x5'));var logger=require(_0x45d8('0x6'))(_0x45d8('0x7'));var config=require(_0x45d8('0x8'));var jayson=require(_0x45d8('0x9'));var client=jayson[_0x45d8('0xa')][_0x45d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cf177,_0x6fe875,_0x128284){return new BPromise(function(_0x5d10a1,_0x343556){return client[_0x45d8('0xc')](_0x1cf177,_0x128284)[_0x45d8('0xd')](function(_0x4d2693){logger[_0x45d8('0xe')](_0x45d8('0xf'),_0x6fe875,_0x45d8('0x10'));logger[_0x45d8('0x11')](_0x45d8('0x12'),_0x6fe875,'request\x20sent',JSON['stringify'](_0x4d2693));if(_0x4d2693[_0x45d8('0x13')]){if(_0x4d2693['error']['code']===0x1f4){logger[_0x45d8('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x6fe875,_0x4d2693[_0x45d8('0x13')][_0x45d8('0x14')]);return _0x343556(_0x4d2693[_0x45d8('0x13')][_0x45d8('0x14')]);}logger[_0x45d8('0x13')](_0x45d8('0xf'),_0x6fe875,_0x4d2693[_0x45d8('0x13')][_0x45d8('0x14')]);return _0x5d10a1(_0x4d2693[_0x45d8('0x13')][_0x45d8('0x14')]);}else{logger[_0x45d8('0xe')](_0x45d8('0xf'),_0x6fe875,_0x45d8('0x10'));_0x5d10a1(_0x4d2693[_0x45d8('0x15')][_0x45d8('0x14')]);}})['catch'](function(_0x134bfa){logger[_0x45d8('0x13')](_0x45d8('0xf'),_0x6fe875,_0x134bfa);_0x343556(_0x134bfa);});});} \ No newline at end of file +var _0xbb2d=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x467c5,_0x1b883c){var _0x2b70cb=function(_0x4a574b){while(--_0x4a574b){_0x467c5['push'](_0x467c5['shift']());}};_0x2b70cb(++_0x1b883c);}(_0xbb2d,0x87));var _0xdbb2=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0xbb2d[_0x34ad72];return _0x5c9aa8;};'use strict';var _=require(_0xdbb2('0x0'));var util=require('util');var moment=require(_0xdbb2('0x1'));var BPromise=require('bluebird');var rs=require(_0xdbb2('0x2'));var fs=require('fs');var Redis=require(_0xdbb2('0x3'));var db=require(_0xdbb2('0x4'))['db'];var utils=require(_0xdbb2('0x5'));var logger=require(_0xdbb2('0x6'))('rpc');var config=require(_0xdbb2('0x7'));var jayson=require(_0xdbb2('0x8'));var client=jayson['client'][_0xdbb2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f89c9,_0x2f3861,_0x15394e){return new BPromise(function(_0x2a9dd5,_0x27d0d0){return client[_0xdbb2('0xa')](_0x2f89c9,_0x15394e)['then'](function(_0x42a1cc){logger[_0xdbb2('0xb')](_0xdbb2('0xc'),_0x2f3861,_0xdbb2('0xd'));logger['debug'](_0xdbb2('0xe'),_0x2f3861,_0xdbb2('0xd'),JSON['stringify'](_0x42a1cc));if(_0x42a1cc[_0xdbb2('0xf')]){if(_0x42a1cc[_0xdbb2('0xf')]['code']===0x1f4){logger[_0xdbb2('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f3861,_0x42a1cc[_0xdbb2('0xf')][_0xdbb2('0x10')]);return _0x27d0d0(_0x42a1cc[_0xdbb2('0xf')][_0xdbb2('0x10')]);}logger[_0xdbb2('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f3861,_0x42a1cc['error'][_0xdbb2('0x10')]);return _0x2a9dd5(_0x42a1cc[_0xdbb2('0xf')][_0xdbb2('0x10')]);}else{logger['info'](_0xdbb2('0xc'),_0x2f3861,_0xdbb2('0xd'));_0x2a9dd5(_0x42a1cc[_0xdbb2('0x11')]['message']);}})[_0xdbb2('0x12')](function(_0x1c7b75){logger[_0xdbb2('0xf')](_0xdbb2('0xc'),_0x2f3861,_0x1c7b75);_0x27d0d0(_0x1c7b75);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index cb805ca..bd7eb0f 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 _0x9999=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x9999,0x6b));var _0x9999=function(_0x1a1f45,_0x382389){_0x1a1f45=_0x1a1f45-0x0;var _0x2bc637=_0x9999[_0x1a1f45];return _0x2bc637;};'use strict';var multer=require(_0x9999('0x0'));var util=require(_0x9999('0x1'));var path=require(_0x9999('0x2'));var timeout=require(_0x9999('0x3'));var express=require(_0x9999('0x4'));var router=express[_0x9999('0x5')]();var fs_extra=require(_0x9999('0x6'));var auth=require(_0x9999('0x7'));var interaction=require(_0x9999('0x8'));var config=require(_0x9999('0x9'));var controller=require(_0x9999('0xa'));router[_0x9999('0xb')]('/',auth[_0x9999('0xc')](),controller[_0x9999('0xd')]);router[_0x9999('0xb')](_0x9999('0xe'),auth[_0x9999('0xc')](),controller['show']);router[_0x9999('0xb')](_0x9999('0xf'),auth[_0x9999('0xc')](),controller[_0x9999('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9999('0x11')]);router[_0x9999('0x12')]('/:id',auth[_0x9999('0xc')](),controller[_0x9999('0x13')]);router[_0x9999('0x14')](_0x9999('0xe'),auth[_0x9999('0xc')](),controller[_0x9999('0x15')]);module[_0x9999('0x16')]=router; \ No newline at end of file +var _0x90e2=['show','/:id/download','post','put','update','delete','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x592c73,_0x1d4254){var _0x200a36=function(_0x3e26c8){while(--_0x3e26c8){_0x592c73['push'](_0x592c73['shift']());}};_0x200a36(++_0x1d4254);}(_0x90e2,0x8e));var _0x290e=function(_0x22c93f,_0x3ad7c0){_0x22c93f=_0x22c93f-0x0;var _0xf5c9fe=_0x90e2[_0x22c93f];return _0xf5c9fe;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x290e('0x0'));var express=require(_0x290e('0x1'));var router=express[_0x290e('0x2')]();var fs_extra=require(_0x290e('0x3'));var auth=require(_0x290e('0x4'));var interaction=require(_0x290e('0x5'));var config=require(_0x290e('0x6'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x290e('0x7')](),controller[_0x290e('0x8')]);router[_0x290e('0x9')](_0x290e('0xa'),auth[_0x290e('0x7')](),controller[_0x290e('0xb')]);router['get'](_0x290e('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x290e('0xd')]('/',auth[_0x290e('0x7')](),controller['create']);router[_0x290e('0xe')](_0x290e('0xa'),auth[_0x290e('0x7')](),controller[_0x290e('0xf')]);router[_0x290e('0x10')](_0x290e('0xa'),auth[_0x290e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1c44742..a4c303f 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 _0x19dc=['exports','TEXT','STRING','BOOLEAN'];(function(_0xff0ad3,_0x3f2deb){var _0xbc863b=function(_0x1f2c39){while(--_0x1f2c39){_0xff0ad3['push'](_0xff0ad3['shift']());}};_0xbc863b(++_0x3f2deb);}(_0x19dc,0xa8));var _0xc19d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc19d('0x0')]={'field':{'type':Sequelize[_0xc19d('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xc19d('0x2')]},'format':{'type':Sequelize[_0xc19d('0x2')]},'groupBy':{'type':Sequelize[_0xc19d('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc19d('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0706=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x5ef107,_0x2a176c){var _0x579b7e=function(_0x456f82){while(--_0x456f82){_0x5ef107['push'](_0x5ef107['shift']());}};_0x579b7e(++_0x2a176c);}(_0x0706,0xf5));var _0x6070=function(_0x371ce7,_0x24ec74){_0x371ce7=_0x371ce7-0x0;var _0x2c99d6=_0x0706[_0x371ce7];return _0x2c99d6;};'use strict';var Sequelize=require(_0x6070('0x0'));module[_0x6070('0x1')]={'field':{'type':Sequelize[_0x6070('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x6070('0x3')]},'format':{'type':Sequelize[_0x6070('0x3')]},'groupBy':{'type':Sequelize[_0x6070('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x6070('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e1c3f9d..2df3039 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 _0x402d=['apply','save','update','then','destroy','error','name','send','map','AnalyticFieldReport','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','intersection','length','includeAll','find','create','bulkCreate','body','bulkDestroy','ids','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json'];(function(_0x17fa50,_0x13e1cd){var _0x3bf833=function(_0x5dd548){while(--_0x5dd548){_0x17fa50['push'](_0x17fa50['shift']());}};_0x3bf833(++_0x13e1cd);}(_0x402d,0x175));var _0xd402=function(_0x336cf8,_0x7d9f33){_0x336cf8=_0x336cf8-0x0;var _0x2a2a86=_0x402d[_0x336cf8];return _0x2a2a86;};'use strict';var emlformat=require(_0xd402('0x0'));var rimraf=require(_0xd402('0x1'));var zipdir=require(_0xd402('0x2'));var jsonpatch=require(_0xd402('0x3'));var rp=require(_0xd402('0x4'));var moment=require('moment');var BPromise=require(_0xd402('0x5'));var Mustache=require(_0xd402('0x6'));var util=require(_0xd402('0x7'));var path=require(_0xd402('0x8'));var sox=require(_0xd402('0x9'));var csv=require(_0xd402('0xa'));var ejs=require(_0xd402('0xb'));var fs=require('fs');var fs_extra=require(_0xd402('0xc'));var _=require(_0xd402('0xd'));var squel=require(_0xd402('0xe'));var crypto=require(_0xd402('0xf'));var jsforce=require(_0xd402('0x10'));var deskjs=require(_0xd402('0x11'));var toCsv=require(_0xd402('0xa'));var querystring=require(_0xd402('0x12'));var Papa=require(_0xd402('0x13'));var Redis=require(_0xd402('0x14'));var authService=require(_0xd402('0x15'));var qs=require(_0xd402('0x16'));var as=require(_0xd402('0x17'));var hardwareService=require(_0xd402('0x18'));var logger=require(_0xd402('0x19'))('api');var utils=require('../../config/utils');var config=require(_0xd402('0x1a'));var licenseUtil=require(_0xd402('0x1b'));var db=require(_0xd402('0x1c'))['db'];function respondWithStatusCode(_0x1ce274,_0x2e2409){_0x2e2409=_0x2e2409||0xcc;return function(_0x4e5563){if(_0x4e5563){return _0x1ce274[_0xd402('0x1d')](_0x2e2409);}return _0x1ce274[_0xd402('0x1e')](_0x2e2409)[_0xd402('0x1f')]();};}function respondWithResult(_0x179cf4,_0x3dc8d5){_0x3dc8d5=_0x3dc8d5||0xc8;return function(_0x5e3bb4){if(_0x5e3bb4){return _0x179cf4['status'](_0x3dc8d5)['json'](_0x5e3bb4);}};}function respondWithFilteredResult(_0x2c4d13,_0x103aba){return function(_0x413355){if(_0x413355){var _0x1453b1=typeof _0x103aba[_0xd402('0x20')]===_0xd402('0x21')&&typeof _0x103aba['limit']===_0xd402('0x21');var _0x1662aa=_0x413355[_0xd402('0x22')];var _0x2ca404=_0x1453b1?0x0:_0x103aba[_0xd402('0x20')];var _0x1a6467=_0x1453b1?_0x413355['count']:_0x103aba[_0xd402('0x20')]+_0x103aba['limit'];var _0x23d22a;if(_0x1a6467>=_0x1662aa){_0x1a6467=_0x1662aa;_0x23d22a=0xc8;}else{_0x23d22a=0xce;}_0x2c4d13[_0xd402('0x1e')](_0x23d22a);return _0x2c4d13['set'](_0xd402('0x23'),_0x2ca404+'-'+_0x1a6467+'/'+_0x1662aa)[_0xd402('0x24')](_0x413355);}return null;};}function patchUpdates(_0xb43ade){return function(_0x1f2b4d){try{jsonpatch[_0xd402('0x25')](_0x1f2b4d,_0xb43ade,!![]);}catch(_0xcbb5c7){return BPromise['reject'](_0xcbb5c7);}return _0x1f2b4d[_0xd402('0x26')]();};}function saveUpdates(_0x40f912,_0x17f7cd){return function(_0xb8937c){if(_0xb8937c){return _0xb8937c[_0xd402('0x27')](_0x40f912)[_0xd402('0x28')](function(_0x3e0225){return _0x3e0225;});}return null;};}function removeEntity(_0x1a9b7c,_0x3ae6c6){return function(_0x2ef26b){if(_0x2ef26b){return _0x2ef26b[_0xd402('0x29')]()['then'](function(){_0x1a9b7c[_0xd402('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x412147,_0xcb46b2){return function(_0xe3a326){if(!_0xe3a326){_0x412147['sendStatus'](0x194);}return _0xe3a326;};}function handleError(_0x7a21d,_0x27c22e){_0x27c22e=_0x27c22e||0x1f4;return function(_0x56c2a5){logger[_0xd402('0x2a')](_0x56c2a5['stack']);if(_0x56c2a5[_0xd402('0x2b')]){delete _0x56c2a5[_0xd402('0x2b')];}_0x7a21d[_0xd402('0x1e')](_0x27c22e)[_0xd402('0x2c')](_0x56c2a5);};}exports['index']=function(_0x5a885f,_0x52ad00){var _0xc4cc0a={},_0x573245={},_0x4597f6={'count':0x0,'rows':[]};var _0x2201d8=_[_0xd402('0x2d')](db[_0xd402('0x2e')]['rawAttributes'],function(_0x2efd64){return{'name':_0x2efd64['fieldName'],'type':_0x2efd64[_0xd402('0x2f')][_0xd402('0x30')]};});_0x573245[_0xd402('0x31')]=_[_0xd402('0x2d')](_0x2201d8,_0xd402('0x2b'));_0x573245[_0xd402('0x32')]=_[_0xd402('0x33')](_0x5a885f[_0xd402('0x32')]);_0x573245['filters']=_['intersection'](_0x573245['model'],_0x573245[_0xd402('0x32')]);_0xc4cc0a[_0xd402('0x34')]=_['intersection'](_0x573245[_0xd402('0x31')],qs[_0xd402('0x35')](_0x5a885f['query']['fields']));_0xc4cc0a[_0xd402('0x34')]=_0xc4cc0a['attributes']['length']?_0xc4cc0a['attributes']:_0x573245[_0xd402('0x31')];if(!_0x5a885f[_0xd402('0x32')][_0xd402('0x36')](_0xd402('0x37'))){_0xc4cc0a[_0xd402('0x38')]=qs[_0xd402('0x38')](_0x5a885f[_0xd402('0x32')][_0xd402('0x38')]);_0xc4cc0a[_0xd402('0x20')]=qs[_0xd402('0x20')](_0x5a885f[_0xd402('0x32')]['offset']);}_0xc4cc0a[_0xd402('0x39')]=qs['sort'](_0x5a885f['query']['sort']);_0xc4cc0a[_0xd402('0x3a')]=qs[_0xd402('0x3b')](_[_0xd402('0x3c')](_0x5a885f['query'],_0x573245[_0xd402('0x3b')]),_0x2201d8);if(_0x5a885f[_0xd402('0x32')][_0xd402('0x3d')]){_0xc4cc0a[_0xd402('0x3a')]=_[_0xd402('0x3e')](_0xc4cc0a[_0xd402('0x3a')],{'$or':_['map'](_0x2201d8,function(_0x339577){if(_0x339577[_0xd402('0x2f')]!==_0xd402('0x3f')){var _0x264718={};_0x264718[_0x339577['name']]={'$like':'%'+_0x5a885f[_0xd402('0x32')][_0xd402('0x3d')]+'%'};return _0x264718;}})});}_0xc4cc0a=_[_0xd402('0x3e')]({},_0xc4cc0a,_0x5a885f[_0xd402('0x40')]);var _0x247399={'where':_0xc4cc0a[_0xd402('0x3a')]};return db['AnalyticFieldReport'][_0xd402('0x22')](_0x247399)[_0xd402('0x28')](function(_0x2a3dab){_0x4597f6['count']=_0x2a3dab;if(_0x5a885f['query']['includeAll']){_0xc4cc0a[_0xd402('0x41')]=[{'all':!![]}];}return db[_0xd402('0x2e')][_0xd402('0x42')](_0xc4cc0a);})['then'](function(_0x162f91){_0x4597f6[_0xd402('0x43')]=_0x162f91;return _0x4597f6;})[_0xd402('0x28')](respondWithFilteredResult(_0x52ad00,_0xc4cc0a))[_0xd402('0x44')](handleError(_0x52ad00,null));};exports['show']=function(_0x2e8bb3,_0x1b0b9f){var _0x417142={'raw':![],'where':{'id':_0x2e8bb3[_0xd402('0x45')]['id']}},_0x30e288={};_0x30e288[_0xd402('0x31')]=_['keys'](db[_0xd402('0x2e')][_0xd402('0x46')]);_0x30e288[_0xd402('0x32')]=_['keys'](_0x2e8bb3[_0xd402('0x32')]);_0x30e288['filters']=_[_0xd402('0x47')](_0x30e288[_0xd402('0x31')],_0x30e288[_0xd402('0x32')]);_0x417142['attributes']=_[_0xd402('0x47')](_0x30e288[_0xd402('0x31')],qs[_0xd402('0x35')](_0x2e8bb3[_0xd402('0x32')][_0xd402('0x35')]));_0x417142['attributes']=_0x417142[_0xd402('0x34')][_0xd402('0x48')]?_0x417142[_0xd402('0x34')]:_0x30e288[_0xd402('0x31')];if(_0x2e8bb3[_0xd402('0x32')][_0xd402('0x49')]){_0x417142[_0xd402('0x41')]=[{'all':!![]}];}_0x417142=_[_0xd402('0x3e')]({},_0x417142,_0x2e8bb3[_0xd402('0x40')]);return db[_0xd402('0x2e')][_0xd402('0x4a')](_0x417142)[_0xd402('0x28')](handleEntityNotFound(_0x1b0b9f,null))['then'](respondWithResult(_0x1b0b9f,null))[_0xd402('0x44')](handleError(_0x1b0b9f,null));};exports[_0xd402('0x4b')]=function(_0x4a953a,_0x19651f){return db[_0xd402('0x2e')][_0xd402('0x4b')](_0x4a953a['body'],{})['then'](respondWithResult(_0x19651f,0xc9))[_0xd402('0x44')](handleError(_0x19651f,null));};exports[_0xd402('0x4c')]=function(_0x2c4b96,_0x3e0814){return db[_0xd402('0x2e')]['bulkCreate'](_0x2c4b96[_0xd402('0x4d')],{'raw':![],'individualHooks':!![]})[_0xd402('0x28')](respondWithResult(_0x3e0814,0xc9))['catch'](handleError(_0x3e0814,null));};exports[_0xd402('0x27')]=function(_0x122d23,_0x3eb8ff){if(_0x122d23[_0xd402('0x4d')]['id']){delete _0x122d23['body']['id'];}return db[_0xd402('0x2e')][_0xd402('0x4a')]({'where':{'id':_0x122d23[_0xd402('0x45')]['id']}})[_0xd402('0x28')](handleEntityNotFound(_0x3eb8ff,null))[_0xd402('0x28')](saveUpdates(_0x122d23[_0xd402('0x4d')],null))['then'](respondWithResult(_0x3eb8ff,null))[_0xd402('0x44')](handleError(_0x3eb8ff,null));};exports[_0xd402('0x29')]=function(_0x1856e6,_0x82df4e){return db[_0xd402('0x2e')][_0xd402('0x4a')]({'where':{'id':_0x1856e6[_0xd402('0x45')]['id']}})[_0xd402('0x28')](handleEntityNotFound(_0x82df4e,null))[_0xd402('0x28')](removeEntity(_0x82df4e,null))['catch'](handleError(_0x82df4e,null));};exports[_0xd402('0x4e')]=function(_0x361e75,_0x2cb1a1){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x361e75[_0xd402('0x32')][_0xd402('0x4f')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2cb1a1,0xcc))[_0xd402('0x44')](handleError(_0x2cb1a1,null));};exports['addFields']=function(_0x337bed,_0x88b666,_0x3cde70){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x337bed[_0xd402('0x45')]['id']}})[_0xd402('0x28')](handleEntityNotFound(_0x88b666,null))[_0xd402('0x28')](function(_0x16a5c9){if(_0x16a5c9){return db['sequelize'][_0xd402('0x50')](function(_0x3728b9){return db[_0xd402('0x2e')][_0xd402('0x29')]({'where':{'CustomReportId':_0x337bed[_0xd402('0x45')]['id']},'transaction':_0x3728b9})[_0xd402('0x28')](function(_0x10a93c){var _0x43feeb=_[_0xd402('0x2d')](_0x337bed[_0xd402('0x4d')],function(_0x30a882){delete _0x30a882['id'];_0x30a882[_0xd402('0x51')]=_0x337bed['params']['id'];return _0x30a882;});return db[_0xd402('0x2e')][_0xd402('0x4c')](_0x43feeb,{'transaction':_0x3728b9});});})[_0xd402('0x28')](function(){return db[_0xd402('0x2e')][_0xd402('0x42')]({'where':{'CustomReportId':_0x337bed[_0xd402('0x45')]['id']}});});}})[_0xd402('0x28')](respondWithResult(_0x88b666,null))['catch'](handleError(_0x88b666,null));}; \ No newline at end of file +var _0x1117=['sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','AnalyticFieldReport','include','findAll','then','rows','catch','params','find','create','body','bulkCreate','update','bulkDestroy','ids','sequelize','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1117,0x1c3));var _0x7111=function(_0x1d5a32,_0x47974a){_0x1d5a32=_0x1d5a32-0x0;var _0x361ca0=_0x1117[_0x1d5a32];return _0x361ca0;};'use strict';var emlformat=require(_0x7111('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7111('0x1'));var jsonpatch=require(_0x7111('0x2'));var rp=require(_0x7111('0x3'));var moment=require(_0x7111('0x4'));var BPromise=require(_0x7111('0x5'));var Mustache=require('mustache');var util=require(_0x7111('0x6'));var path=require(_0x7111('0x7'));var sox=require(_0x7111('0x8'));var csv=require(_0x7111('0x9'));var ejs=require(_0x7111('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7111('0xb'));var jsforce=require(_0x7111('0xc'));var deskjs=require(_0x7111('0xd'));var toCsv=require(_0x7111('0x9'));var querystring=require('querystring');var Papa=require(_0x7111('0xe'));var Redis=require(_0x7111('0xf'));var authService=require(_0x7111('0x10'));var qs=require(_0x7111('0x11'));var as=require(_0x7111('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7111('0x13'))('api');var utils=require(_0x7111('0x14'));var config=require(_0x7111('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7111('0x16'))['db'];function respondWithStatusCode(_0x230811,_0x8e6b3a){_0x8e6b3a=_0x8e6b3a||0xcc;return function(_0x12102e){if(_0x12102e){return _0x230811[_0x7111('0x17')](_0x8e6b3a);}return _0x230811['status'](_0x8e6b3a)[_0x7111('0x18')]();};}function respondWithResult(_0x45e9bd,_0x34d633){_0x34d633=_0x34d633||0xc8;return function(_0x260a77){if(_0x260a77){return _0x45e9bd['status'](_0x34d633)[_0x7111('0x19')](_0x260a77);}};}function respondWithFilteredResult(_0x294b74,_0x2309c7){return function(_0x491dfb){if(_0x491dfb){var _0x5a6de9=typeof _0x2309c7[_0x7111('0x1a')]===_0x7111('0x1b')&&typeof _0x2309c7[_0x7111('0x1c')]===_0x7111('0x1b');var _0xd6e6eb=_0x491dfb[_0x7111('0x1d')];var _0x16212d=_0x5a6de9?0x0:_0x2309c7[_0x7111('0x1a')];var _0x4ab08f=_0x5a6de9?_0x491dfb['count']:_0x2309c7[_0x7111('0x1a')]+_0x2309c7['limit'];var _0x2b7973;if(_0x4ab08f>=_0xd6e6eb){_0x4ab08f=_0xd6e6eb;_0x2b7973=0xc8;}else{_0x2b7973=0xce;}_0x294b74[_0x7111('0x1e')](_0x2b7973);return _0x294b74[_0x7111('0x1f')](_0x7111('0x20'),_0x16212d+'-'+_0x4ab08f+'/'+_0xd6e6eb)[_0x7111('0x19')](_0x491dfb);}return null;};}function patchUpdates(_0x2d7345){return function(_0x1d1b8a){try{jsonpatch[_0x7111('0x21')](_0x1d1b8a,_0x2d7345,!![]);}catch(_0x4654dd){return BPromise[_0x7111('0x22')](_0x4654dd);}return _0x1d1b8a[_0x7111('0x23')]();};}function saveUpdates(_0x34f43c,_0x54cd4f){return function(_0x333838){if(_0x333838){return _0x333838['update'](_0x34f43c)['then'](function(_0x55a09e){return _0x55a09e;});}return null;};}function removeEntity(_0x1afb2e,_0x5bc112){return function(_0x4b5105){if(_0x4b5105){return _0x4b5105[_0x7111('0x24')]()['then'](function(){_0x1afb2e[_0x7111('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4f40,_0x2d5543){return function(_0x50ccf5){if(!_0x50ccf5){_0x4f4f40[_0x7111('0x17')](0x194);}return _0x50ccf5;};}function handleError(_0x172f5c,_0x3c76d4){_0x3c76d4=_0x3c76d4||0x1f4;return function(_0x16e41f){logger[_0x7111('0x25')](_0x16e41f['stack']);if(_0x16e41f[_0x7111('0x26')]){delete _0x16e41f[_0x7111('0x26')];}_0x172f5c[_0x7111('0x1e')](_0x3c76d4)[_0x7111('0x27')](_0x16e41f);};}exports[_0x7111('0x28')]=function(_0x108b1d,_0x5ceef3){var _0x5f3a31={},_0x1e3406={},_0x3b46e4={'count':0x0,'rows':[]};var _0x5db06c=_[_0x7111('0x29')](db['AnalyticFieldReport'][_0x7111('0x2a')],function(_0x1ff34f){return{'name':_0x1ff34f[_0x7111('0x2b')],'type':_0x1ff34f['type'][_0x7111('0x2c')]};});_0x1e3406['model']=_[_0x7111('0x29')](_0x5db06c,_0x7111('0x26'));_0x1e3406[_0x7111('0x2d')]=_[_0x7111('0x2e')](_0x108b1d[_0x7111('0x2d')]);_0x1e3406[_0x7111('0x2f')]=_['intersection'](_0x1e3406[_0x7111('0x30')],_0x1e3406[_0x7111('0x2d')]);_0x5f3a31[_0x7111('0x31')]=_[_0x7111('0x32')](_0x1e3406[_0x7111('0x30')],qs[_0x7111('0x33')](_0x108b1d[_0x7111('0x2d')][_0x7111('0x33')]));_0x5f3a31[_0x7111('0x31')]=_0x5f3a31[_0x7111('0x31')][_0x7111('0x34')]?_0x5f3a31['attributes']:_0x1e3406[_0x7111('0x30')];if(!_0x108b1d[_0x7111('0x2d')]['hasOwnProperty'](_0x7111('0x35'))){_0x5f3a31[_0x7111('0x1c')]=qs[_0x7111('0x1c')](_0x108b1d['query'][_0x7111('0x1c')]);_0x5f3a31['offset']=qs['offset'](_0x108b1d['query'][_0x7111('0x1a')]);}_0x5f3a31[_0x7111('0x36')]=qs[_0x7111('0x37')](_0x108b1d[_0x7111('0x2d')]['sort']);_0x5f3a31[_0x7111('0x38')]=qs[_0x7111('0x2f')](_[_0x7111('0x39')](_0x108b1d['query'],_0x1e3406[_0x7111('0x2f')]),_0x5db06c);if(_0x108b1d['query']['filter']){_0x5f3a31[_0x7111('0x38')]=_['merge'](_0x5f3a31[_0x7111('0x38')],{'$or':_[_0x7111('0x29')](_0x5db06c,function(_0x5ddbee){if(_0x5ddbee[_0x7111('0x3a')]!==_0x7111('0x3b')){var _0x2ef714={};_0x2ef714[_0x5ddbee[_0x7111('0x26')]]={'$like':'%'+_0x108b1d[_0x7111('0x2d')][_0x7111('0x3c')]+'%'};return _0x2ef714;}})});}_0x5f3a31=_[_0x7111('0x3d')]({},_0x5f3a31,_0x108b1d[_0x7111('0x3e')]);var _0x3dc0e6={'where':_0x5f3a31[_0x7111('0x38')]};return db[_0x7111('0x3f')]['count'](_0x3dc0e6)['then'](function(_0xacf940){_0x3b46e4[_0x7111('0x1d')]=_0xacf940;if(_0x108b1d[_0x7111('0x2d')]['includeAll']){_0x5f3a31[_0x7111('0x40')]=[{'all':!![]}];}return db[_0x7111('0x3f')][_0x7111('0x41')](_0x5f3a31);})[_0x7111('0x42')](function(_0x40b86f){_0x3b46e4[_0x7111('0x43')]=_0x40b86f;return _0x3b46e4;})['then'](respondWithFilteredResult(_0x5ceef3,_0x5f3a31))[_0x7111('0x44')](handleError(_0x5ceef3,null));};exports['show']=function(_0x1662b1,_0x5c2c29){var _0x4607ff={'raw':![],'where':{'id':_0x1662b1[_0x7111('0x45')]['id']}},_0x55134={};_0x55134[_0x7111('0x30')]=_[_0x7111('0x2e')](db['AnalyticFieldReport'][_0x7111('0x2a')]);_0x55134['query']=_['keys'](_0x1662b1[_0x7111('0x2d')]);_0x55134['filters']=_[_0x7111('0x32')](_0x55134[_0x7111('0x30')],_0x55134[_0x7111('0x2d')]);_0x4607ff[_0x7111('0x31')]=_[_0x7111('0x32')](_0x55134[_0x7111('0x30')],qs[_0x7111('0x33')](_0x1662b1[_0x7111('0x2d')]['fields']));_0x4607ff['attributes']=_0x4607ff['attributes'][_0x7111('0x34')]?_0x4607ff[_0x7111('0x31')]:_0x55134[_0x7111('0x30')];if(_0x1662b1['query']['includeAll']){_0x4607ff['include']=[{'all':!![]}];}_0x4607ff=_[_0x7111('0x3d')]({},_0x4607ff,_0x1662b1[_0x7111('0x3e')]);return db['AnalyticFieldReport'][_0x7111('0x46')](_0x4607ff)[_0x7111('0x42')](handleEntityNotFound(_0x5c2c29,null))[_0x7111('0x42')](respondWithResult(_0x5c2c29,null))[_0x7111('0x44')](handleError(_0x5c2c29,null));};exports['create']=function(_0x30b69e,_0x5e5193){return db[_0x7111('0x3f')][_0x7111('0x47')](_0x30b69e[_0x7111('0x48')],{})[_0x7111('0x42')](respondWithResult(_0x5e5193,0xc9))['catch'](handleError(_0x5e5193,null));};exports[_0x7111('0x49')]=function(_0x44f628,_0x83ed52){return db['AnalyticFieldReport'][_0x7111('0x49')](_0x44f628['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x83ed52,0xc9))[_0x7111('0x44')](handleError(_0x83ed52,null));};exports[_0x7111('0x4a')]=function(_0x3c9706,_0x507456){if(_0x3c9706[_0x7111('0x48')]['id']){delete _0x3c9706['body']['id'];}return db['AnalyticFieldReport'][_0x7111('0x46')]({'where':{'id':_0x3c9706[_0x7111('0x45')]['id']}})[_0x7111('0x42')](handleEntityNotFound(_0x507456,null))[_0x7111('0x42')](saveUpdates(_0x3c9706['body'],null))[_0x7111('0x42')](respondWithResult(_0x507456,null))[_0x7111('0x44')](handleError(_0x507456,null));};exports[_0x7111('0x24')]=function(_0x256df1,_0x4dbf9e){return db[_0x7111('0x3f')]['find']({'where':{'id':_0x256df1['params']['id']}})['then'](handleEntityNotFound(_0x4dbf9e,null))[_0x7111('0x42')](removeEntity(_0x4dbf9e,null))[_0x7111('0x44')](handleError(_0x4dbf9e,null));};exports[_0x7111('0x4b')]=function(_0x214c82,_0x481717){return db['AnalyticFieldReport'][_0x7111('0x24')]({'where':{'id':_0x214c82['query'][_0x7111('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x7111('0x42')](respondWithResult(_0x481717,0xcc))['catch'](handleError(_0x481717,null));};exports['addFields']=function(_0x583640,_0x20bb16,_0xb0d695){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x583640[_0x7111('0x45')]['id']}})[_0x7111('0x42')](handleEntityNotFound(_0x20bb16,null))[_0x7111('0x42')](function(_0x4cca44){if(_0x4cca44){return db[_0x7111('0x4d')]['transaction'](function(_0x5d96f4){return db[_0x7111('0x3f')][_0x7111('0x24')]({'where':{'CustomReportId':_0x583640[_0x7111('0x45')]['id']},'transaction':_0x5d96f4})[_0x7111('0x42')](function(_0x28adad){var _0x56cc2a=_['map'](_0x583640['body'],function(_0xafacad){delete _0xafacad['id'];_0xafacad[_0x7111('0x4e')]=_0x583640[_0x7111('0x45')]['id'];return _0xafacad;});return db['AnalyticFieldReport'][_0x7111('0x49')](_0x56cc2a,{'transaction':_0x5d96f4});});})[_0x7111('0x42')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x583640[_0x7111('0x45')]['id']}});});}})['then'](respondWithResult(_0x20bb16,null))['catch'](handleError(_0x20bb16,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 86dc42c..c63e9b8 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 _0x2739=['../../config/logger','bluebird','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x482cfc,_0x5b02b7){var _0x26775d=function(_0x2e392a){while(--_0x2e392a){_0x482cfc['push'](_0x482cfc['shift']());}};_0x26775d(++_0x5b02b7);}(_0x2739,0xda));var _0x9273=function(_0xe24605,_0xd6f3d9){_0xe24605=_0xe24605-0x0;var _0x55ef21=_0x2739[_0xe24605];return _0x55ef21;};'use strict';var _=require(_0x9273('0x0'));var util=require(_0x9273('0x1'));var logger=require(_0x9273('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9273('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9273('0x4'));var rimraf=require('rimraf');var config=require(_0x9273('0x5'));var attributes=require(_0x9273('0x6'));module[_0x9273('0x7')]=function(_0x5a6fa3,_0x37a9f8){return _0x5a6fa3[_0x9273('0x8')](_0x9273('0x9'),attributes,{'tableName':_0x9273('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d53=['bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','lodash','util','../../config/logger','api','moment'];(function(_0x45c706,_0x25451f){var _0x441e5f=function(_0x1ca3a6){while(--_0x1ca3a6){_0x45c706['push'](_0x45c706['shift']());}};_0x441e5f(++_0x25451f);}(_0x0d53,0x11b));var _0x30d5=function(_0x28678e,_0x50e269){_0x28678e=_0x28678e-0x0;var _0x544ad7=_0x0d53[_0x28678e];return _0x544ad7;};'use strict';var _=require(_0x30d5('0x0'));var util=require(_0x30d5('0x1'));var logger=require(_0x30d5('0x2'))(_0x30d5('0x3'));var moment=require(_0x30d5('0x4'));var BPromise=require(_0x30d5('0x5'));var rp=require(_0x30d5('0x6'));var fs=require('fs');var path=require(_0x30d5('0x7'));var rimraf=require('rimraf');var config=require(_0x30d5('0x8'));var attributes=require(_0x30d5('0x9'));module[_0x30d5('0xa')]=function(_0x1f6c5c,_0x1a76b3){return _0x1f6c5c['define'](_0x30d5('0xb'),attributes,{'tableName':'analytics_report_fields','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 d9ed492..912ae06 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 _0x9aa8=['request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x50a700,_0x5901b1){var _0x3abf0c=function(_0x4f1d86){while(--_0x4f1d86){_0x50a700['push'](_0x50a700['shift']());}};_0x3abf0c(++_0x5901b1);}(_0x9aa8,0xbb));var _0x89aa=function(_0x22ec1c,_0x2af494){_0x22ec1c=_0x22ec1c-0x0;var _0x478820=_0x9aa8[_0x22ec1c];return _0x478820;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x89aa('0x0'));var BPromise=require('bluebird');var rs=require(_0x89aa('0x1'));var fs=require('fs');var Redis=require(_0x89aa('0x2'));var db=require(_0x89aa('0x3'))['db'];var utils=require(_0x89aa('0x4'));var logger=require(_0x89aa('0x5'))('rpc');var config=require(_0x89aa('0x6'));var jayson=require(_0x89aa('0x7'));var client=jayson[_0x89aa('0x8')][_0x89aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19bd9c,_0x464058,_0x23ef99){return new BPromise(function(_0x3c44ee,_0x118be7){return client[_0x89aa('0xa')](_0x19bd9c,_0x23ef99)['then'](function(_0x55284e){logger[_0x89aa('0xb')](_0x89aa('0xc'),_0x464058,_0x89aa('0xd'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x464058,_0x89aa('0xd'),JSON[_0x89aa('0xe')](_0x55284e));if(_0x55284e[_0x89aa('0xf')]){if(_0x55284e[_0x89aa('0xf')][_0x89aa('0x10')]===0x1f4){logger[_0x89aa('0xf')](_0x89aa('0xc'),_0x464058,_0x55284e['error'][_0x89aa('0x11')]);return _0x118be7(_0x55284e['error'][_0x89aa('0x11')]);}logger[_0x89aa('0xf')](_0x89aa('0xc'),_0x464058,_0x55284e['error'][_0x89aa('0x11')]);return _0x3c44ee(_0x55284e[_0x89aa('0xf')][_0x89aa('0x11')]);}else{logger[_0x89aa('0xb')](_0x89aa('0xc'),_0x464058,'request\x20sent');_0x3c44ee(_0x55284e[_0x89aa('0x12')][_0x89aa('0x11')]);}})[_0x89aa('0x13')](function(_0x18bc51){logger[_0x89aa('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x464058,_0x18bc51);_0x118be7(_0x18bc51);});});} \ No newline at end of file +var _0x9c9c=['request','then','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x54b8fc,_0x159ae0){var _0x54345c=function(_0x5b371f){while(--_0x5b371f){_0x54b8fc['push'](_0x54b8fc['shift']());}};_0x54345c(++_0x159ae0);}(_0x9c9c,0x1ad));var _0xc9c9=function(_0x4bec28,_0x3138a9){_0x4bec28=_0x4bec28-0x0;var _0x36cd6e=_0x9c9c[_0x4bec28];return _0x36cd6e;};'use strict';var _=require(_0xc9c9('0x0'));var util=require(_0xc9c9('0x1'));var moment=require(_0xc9c9('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9c9('0x4'))['db'];var utils=require(_0xc9c9('0x5'));var logger=require(_0xc9c9('0x6'))(_0xc9c9('0x7'));var config=require(_0xc9c9('0x8'));var jayson=require(_0xc9c9('0x9'));var client=jayson[_0xc9c9('0xa')][_0xc9c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcd84c5,_0x3d3916,_0xe92291){return new BPromise(function(_0x12850f,_0x29ab19){return client[_0xc9c9('0xc')](_0xcd84c5,_0xe92291)[_0xc9c9('0xd')](function(_0x13c975){logger['info'](_0xc9c9('0xe'),_0x3d3916,'request\x20sent');logger['debug'](_0xc9c9('0xf'),_0x3d3916,_0xc9c9('0x10'),JSON['stringify'](_0x13c975));if(_0x13c975[_0xc9c9('0x11')]){if(_0x13c975[_0xc9c9('0x11')]['code']===0x1f4){logger[_0xc9c9('0x11')](_0xc9c9('0xe'),_0x3d3916,_0x13c975[_0xc9c9('0x11')]['message']);return _0x29ab19(_0x13c975[_0xc9c9('0x11')][_0xc9c9('0x12')]);}logger['error'](_0xc9c9('0xe'),_0x3d3916,_0x13c975[_0xc9c9('0x11')][_0xc9c9('0x12')]);return _0x12850f(_0x13c975[_0xc9c9('0x11')][_0xc9c9('0x12')]);}else{logger[_0xc9c9('0x13')](_0xc9c9('0xe'),_0x3d3916,'request\x20sent');_0x12850f(_0x13c975['result'][_0xc9c9('0x12')]);}})[_0xc9c9('0x14')](function(_0x4be945){logger['error'](_0xc9c9('0xe'),_0x3d3916,_0x4be945);_0x29ab19(_0x4be945);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c3ba64c..c01b53e 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(_0x352bd6,_0x5e3566){var _0x341a52=function(_0x4f3b56){while(--_0x4f3b56){_0x352bd6['push'](_0x352bd6['shift']());}};_0x341a52(++_0x5e3566);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0xf902ad,_0x44d587){var _0x3dda32=function(_0x390cfd){while(--_0x390cfd){_0xf902ad['push'](_0xf902ad['shift']());}};_0x3dda32(++_0x44d587);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 e8bb923..99b372f 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 _0x38d0=['STRING','name','TEXT','exports'];(function(_0x43f6f4,_0x3d6f9c){var _0x40f183=function(_0x8d9b08){while(--_0x8d9b08){_0x43f6f4['push'](_0x43f6f4['shift']());}};_0x40f183(++_0x3d6f9c);}(_0x38d0,0x123));var _0x038d=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x38d0[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require('sequelize');module[_0x038d('0x0')]={'name':{'type':Sequelize[_0x038d('0x1')],'allowNull':![],'unique':_0x038d('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x038d('0x3')]},'description':{'type':Sequelize[_0x038d('0x1')]}}; \ No newline at end of file +var _0x9a86=['name','STRING','TEXT','sequelize','exports'];(function(_0x2695b3,_0x369355){var _0x1b95c7=function(_0x4555c4){while(--_0x4555c4){_0x2695b3['push'](_0x2695b3['shift']());}};_0x1b95c7(++_0x369355);}(_0x9a86,0x1ed));var _0x69a8=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x9a86[_0x2077c2];return _0x312f9f;};'use strict';var Sequelize=require(_0x69a8('0x0'));module[_0x69a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x69a8('0x2')},'table':{'type':Sequelize[_0x69a8('0x3')]},'metric':{'type':Sequelize[_0x69a8('0x4')]},'description':{'type':Sequelize[_0x69a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 6ba766d..0660a0d 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x204c59,_0x5614ee){var _0x4cd35b=function(_0xf20241){while(--_0xf20241){_0x204c59['push'](_0x204c59['shift']());}};_0x4cd35b(++_0x5614ee);}(_0x008c,0x188));var _0xc008=function(_0x13b228,_0x348b33){_0x13b228=_0x13b228-0x0;var _0xa6567d=_0x008c[_0x13b228];return _0xa6567d;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2942ef,_0x4a7861){var _0xef5cd=function(_0x23030d){while(--_0x23030d){_0x2942ef['push'](_0x2942ef['shift']());}};_0xef5cd(++_0x4a7861);}(_0x4b84,0x1cc));var _0x44b8=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0x4b84[_0x531e48];return _0x202971;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 0d1c2ba..ea4a66d 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 _0x90ec=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x90ec,0x1d4));var _0xc90e=function(_0x21a7aa,_0x2248dc){_0x21a7aa=_0x21a7aa-0x0;var _0x20c622=_0x90ec[_0x21a7aa];return _0x20c622;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var logger=require('../../config/logger')(_0xc90e('0x2'));var moment=require(_0xc90e('0x3'));var BPromise=require(_0xc90e('0x4'));var rp=require(_0xc90e('0x5'));var fs=require('fs');var path=require(_0xc90e('0x6'));var rimraf=require('rimraf');var config=require(_0xc90e('0x7'));var attributes=require(_0xc90e('0x8'));module[_0xc90e('0x9')]=function(_0x54a0a8,_0x259c62){return _0x54a0a8['define'](_0xc90e('0xa'),attributes,{'tableName':_0xc90e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1751=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x135e1c,_0x4fee5a){var _0x4ac460=function(_0x181352){while(--_0x181352){_0x135e1c['push'](_0x135e1c['shift']());}};_0x4ac460(++_0x4fee5a);}(_0x1751,0x76));var _0x1175=function(_0xd7f412,_0x1ed5c2){_0xd7f412=_0xd7f412-0x0;var _0x207a07=_0x1751[_0xd7f412];return _0x207a07;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var logger=require(_0x1175('0x2'))(_0x1175('0x3'));var moment=require('moment');var BPromise=require(_0x1175('0x4'));var rp=require(_0x1175('0x5'));var fs=require('fs');var path=require(_0x1175('0x6'));var rimraf=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var attributes=require(_0x1175('0x9'));module[_0x1175('0xa')]=function(_0x171756,_0x3f99ca){return _0x171756[_0x1175('0xb')](_0x1175('0xc'),attributes,{'tableName':_0x1175('0xd'),'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 47e9199..1c51fb5 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 _0x7c86=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5f1f4a,_0x1a534f){var _0xe99e7a=function(_0x16177a){while(--_0x16177a){_0x5f1f4a['push'](_0x5f1f4a['shift']());}};_0xe99e7a(++_0x1a534f);}(_0x7c86,0xa2));var _0x67c8=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7c86[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x67c8('0x0'));var util=require('util');var moment=require(_0x67c8('0x1'));var BPromise=require(_0x67c8('0x2'));var rs=require(_0x67c8('0x3'));var fs=require('fs');var Redis=require(_0x67c8('0x4'));var db=require(_0x67c8('0x5'))['db'];var utils=require(_0x67c8('0x6'));var logger=require(_0x67c8('0x7'))(_0x67c8('0x8'));var config=require('../../config/environment');var jayson=require(_0x67c8('0x9'));var client=jayson['client'][_0x67c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40f77b,_0x3ed23a,_0x29a61b){return new BPromise(function(_0x40fc1a,_0x5bb56d){return client[_0x67c8('0xb')](_0x40f77b,_0x29a61b)[_0x67c8('0xc')](function(_0x55c01e){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3ed23a,_0x67c8('0xd'));logger[_0x67c8('0xe')](_0x67c8('0xf'),_0x3ed23a,_0x67c8('0xd'),JSON[_0x67c8('0x10')](_0x55c01e));if(_0x55c01e[_0x67c8('0x11')]){if(_0x55c01e[_0x67c8('0x11')][_0x67c8('0x12')]===0x1f4){logger[_0x67c8('0x11')](_0x67c8('0x13'),_0x3ed23a,_0x55c01e[_0x67c8('0x11')][_0x67c8('0x14')]);return _0x5bb56d(_0x55c01e[_0x67c8('0x11')][_0x67c8('0x14')]);}logger[_0x67c8('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x3ed23a,_0x55c01e[_0x67c8('0x11')][_0x67c8('0x14')]);return _0x40fc1a(_0x55c01e[_0x67c8('0x11')][_0x67c8('0x14')]);}else{logger[_0x67c8('0x15')](_0x67c8('0x13'),_0x3ed23a,'request\x20sent');_0x40fc1a(_0x55c01e[_0x67c8('0x16')][_0x67c8('0x14')]);}})[_0x67c8('0x17')](function(_0x1d6d43){logger['error'](_0x67c8('0x13'),_0x3ed23a,_0x1d6d43);_0x5bb56d(_0x1d6d43);});});} \ No newline at end of file +var _0xcc60=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x1c27d6,_0x51cba0){var _0x41caac=function(_0x2b828b){while(--_0x2b828b){_0x1c27d6['push'](_0x1c27d6['shift']());}};_0x41caac(++_0x51cba0);}(_0xcc60,0x10e));var _0x0cc6=function(_0x67dd88,_0x4c5e0f){_0x67dd88=_0x67dd88-0x0;var _0x58ccce=_0xcc60[_0x67dd88];return _0x58ccce;};'use strict';var _=require(_0x0cc6('0x0'));var util=require(_0x0cc6('0x1'));var moment=require(_0x0cc6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0cc6('0x3'));var fs=require('fs');var Redis=require(_0x0cc6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0cc6('0x5'))(_0x0cc6('0x6'));var config=require(_0x0cc6('0x7'));var jayson=require(_0x0cc6('0x8'));var client=jayson[_0x0cc6('0x9')][_0x0cc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2da820,_0x1148f0,_0x4ff6b9){return new BPromise(function(_0x5ed568,_0x21bf0a){return client[_0x0cc6('0xb')](_0x2da820,_0x4ff6b9)[_0x0cc6('0xc')](function(_0x314928){logger[_0x0cc6('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x1148f0,_0x0cc6('0xe'));logger[_0x0cc6('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1148f0,_0x0cc6('0xe'),JSON['stringify'](_0x314928));if(_0x314928[_0x0cc6('0x10')]){if(_0x314928[_0x0cc6('0x10')][_0x0cc6('0x11')]===0x1f4){logger[_0x0cc6('0x10')](_0x0cc6('0x12'),_0x1148f0,_0x314928[_0x0cc6('0x10')]['message']);return _0x21bf0a(_0x314928['error']['message']);}logger['error'](_0x0cc6('0x12'),_0x1148f0,_0x314928['error'][_0x0cc6('0x13')]);return _0x5ed568(_0x314928[_0x0cc6('0x10')][_0x0cc6('0x13')]);}else{logger['info'](_0x0cc6('0x12'),_0x1148f0,_0x0cc6('0xe'));_0x5ed568(_0x314928['result'][_0x0cc6('0x13')]);}})[_0x0cc6('0x14')](function(_0x453e8e){logger[_0x0cc6('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1148f0,_0x453e8e);_0x21bf0a(_0x453e8e);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3cc7af3..7e5e416 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 _0x9829=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x79200a,_0x594db2){var _0x2afae4=function(_0x2729ee){while(--_0x2729ee){_0x79200a['push'](_0x79200a['shift']());}};_0x2afae4(++_0x594db2);}(_0x9829,0xc4));var _0x9982=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0x9829[_0x587ba2];return _0x50ec73;};'use strict';var multer=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var path=require(_0x9982('0x2'));var timeout=require(_0x9982('0x3'));var express=require(_0x9982('0x4'));var router=express['Router']();var fs_extra=require(_0x9982('0x5'));var auth=require(_0x9982('0x6'));var interaction=require(_0x9982('0x7'));var config=require('../../config/environment');var controller=require(_0x9982('0x8'));router[_0x9982('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9982('0x9')](_0x9982('0xa'),auth['isAuthenticated'](),controller[_0x9982('0xb')]);router[_0x9982('0xc')]('/',auth[_0x9982('0xd')](),controller[_0x9982('0xe')]);router[_0x9982('0xf')](_0x9982('0xa'),auth[_0x9982('0xd')](),controller[_0x9982('0x10')]);router[_0x9982('0x11')](_0x9982('0xa'),auth[_0x9982('0xd')](),controller[_0x9982('0x12')]);module[_0x9982('0x13')]=router; \ No newline at end of file +var _0x8c79=['express','fs-extra','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','create','put','update','destroy','exports','multer'];(function(_0x10f063,_0x397cf4){var _0x5a7a1e=function(_0x5781f6){while(--_0x5781f6){_0x10f063['push'](_0x10f063['shift']());}};_0x5a7a1e(++_0x397cf4);}(_0x8c79,0xa8));var _0x98c7=function(_0x21ed1f,_0xabbc54){_0x21ed1f=_0x21ed1f-0x0;var _0x2d8da9=_0x8c79[_0x21ed1f];return _0x2d8da9;};'use strict';var multer=require(_0x98c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98c7('0x1'));var router=express['Router']();var fs_extra=require(_0x98c7('0x2'));var auth=require(_0x98c7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x98c7('0x4'));var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x98c7('0x5')]);router['get'](_0x98c7('0x6'),auth[_0x98c7('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x98c7('0x8')]);router[_0x98c7('0x9')](_0x98c7('0x6'),auth['isAuthenticated'](),controller[_0x98c7('0xa')]);router['delete'](_0x98c7('0x6'),auth[_0x98c7('0x7')](),controller[_0x98c7('0xb')]);module[_0x98c7('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ceb0a12..68c3955 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 _0x8a3d=['sequelize','exports','TEXT'];(function(_0x1f73f5,_0x52f9ca){var _0xd739d=function(_0x45c8bb){while(--_0x45c8bb){_0x1f73f5['push'](_0x1f73f5['shift']());}};_0xd739d(++_0x52f9ca);}(_0x8a3d,0x183));var _0xd8a3=function(_0x36a17c,_0x1c2dbc){_0x36a17c=_0x36a17c-0x0;var _0x55e639=_0x8a3d[_0x36a17c];return _0x55e639;};'use strict';var Sequelize=require(_0xd8a3('0x0'));module[_0xd8a3('0x1')]={'tree':{'type':Sequelize[_0xd8a3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x34f6=['sequelize','exports'];(function(_0x51b928,_0x50cc23){var _0x2a229d=function(_0x503afb){while(--_0x503afb){_0x51b928['push'](_0x51b928['shift']());}};_0x2a229d(++_0x50cc23);}(_0x34f6,0x7e));var _0x634f=function(_0x345e4c,_0x3e73ba){_0x345e4c=_0x345e4c-0x0;var _0x40c41c=_0x34f6[_0x345e4c];return _0x40c41c;};'use strict';var Sequelize=require(_0x634f('0x0'));module[_0x634f('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 22df148..5388d34 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 _0xcf45=['then','destroy','end','error','stack','name','index','map','AnalyticTreeReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update'];(function(_0x1408f1,_0xfbd1d9){var _0x2d98a7=function(_0x5a8e5d){while(--_0x5a8e5d){_0x1408f1['push'](_0x1408f1['shift']());}};_0x2d98a7(++_0xfbd1d9);}(_0xcf45,0xb8));var _0x5cf4=function(_0x20db2b,_0x2f4eb4){_0x20db2b=_0x20db2b-0x0;var _0x219fbf=_0xcf45[_0x20db2b];return _0x219fbf;};'use strict';var emlformat=require(_0x5cf4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5cf4('0x1'));var jsonpatch=require(_0x5cf4('0x2'));var rp=require(_0x5cf4('0x3'));var moment=require('moment');var BPromise=require(_0x5cf4('0x4'));var Mustache=require(_0x5cf4('0x5'));var util=require(_0x5cf4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5cf4('0x7'));var ejs=require(_0x5cf4('0x8'));var fs=require('fs');var fs_extra=require(_0x5cf4('0x9'));var _=require('lodash');var squel=require(_0x5cf4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5cf4('0xb'));var toCsv=require(_0x5cf4('0x7'));var querystring=require(_0x5cf4('0xc'));var Papa=require(_0x5cf4('0xd'));var Redis=require(_0x5cf4('0xe'));var authService=require(_0x5cf4('0xf'));var qs=require(_0x5cf4('0x10'));var as=require(_0x5cf4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cf4('0x12'))('api');var utils=require(_0x5cf4('0x13'));var config=require(_0x5cf4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5cf4('0x15'))['db'];function respondWithStatusCode(_0x156f78,_0x307d94){_0x307d94=_0x307d94||0xcc;return function(_0x130d07){if(_0x130d07){return _0x156f78[_0x5cf4('0x16')](_0x307d94);}return _0x156f78[_0x5cf4('0x17')](_0x307d94)['end']();};}function respondWithResult(_0x140175,_0x239389){_0x239389=_0x239389||0xc8;return function(_0x5bcdc9){if(_0x5bcdc9){return _0x140175[_0x5cf4('0x17')](_0x239389)['json'](_0x5bcdc9);}};}function respondWithFilteredResult(_0x379a27,_0x478029){return function(_0x31434a){if(_0x31434a){var _0x3cb974=typeof _0x478029['offset']===_0x5cf4('0x18')&&typeof _0x478029[_0x5cf4('0x19')]==='undefined';var _0xbcdabc=_0x31434a[_0x5cf4('0x1a')];var _0x187bc9=_0x3cb974?0x0:_0x478029[_0x5cf4('0x1b')];var _0x4c812e=_0x3cb974?_0x31434a[_0x5cf4('0x1a')]:_0x478029[_0x5cf4('0x1b')]+_0x478029['limit'];var _0x53e1c0;if(_0x4c812e>=_0xbcdabc){_0x4c812e=_0xbcdabc;_0x53e1c0=0xc8;}else{_0x53e1c0=0xce;}_0x379a27[_0x5cf4('0x17')](_0x53e1c0);return _0x379a27[_0x5cf4('0x1c')](_0x5cf4('0x1d'),_0x187bc9+'-'+_0x4c812e+'/'+_0xbcdabc)[_0x5cf4('0x1e')](_0x31434a);}return null;};}function patchUpdates(_0x405c2c){return function(_0x2bcf4f){try{jsonpatch[_0x5cf4('0x1f')](_0x2bcf4f,_0x405c2c,!![]);}catch(_0x2eaffd){return BPromise[_0x5cf4('0x20')](_0x2eaffd);}return _0x2bcf4f[_0x5cf4('0x21')]();};}function saveUpdates(_0x56e5e1,_0x12d498){return function(_0x3ce50e){if(_0x3ce50e){return _0x3ce50e[_0x5cf4('0x22')](_0x56e5e1)[_0x5cf4('0x23')](function(_0x2234d0){return _0x2234d0;});}return null;};}function removeEntity(_0x1390fd,_0x558b49){return function(_0x2ec110){if(_0x2ec110){return _0x2ec110[_0x5cf4('0x24')]()[_0x5cf4('0x23')](function(){_0x1390fd[_0x5cf4('0x17')](0xcc)[_0x5cf4('0x25')]();});}};}function handleEntityNotFound(_0x11b435,_0x5a0075){return function(_0x2adc65){if(!_0x2adc65){_0x11b435['sendStatus'](0x194);}return _0x2adc65;};}function handleError(_0x2e5454,_0x455b3d){_0x455b3d=_0x455b3d||0x1f4;return function(_0x19cf5e){logger[_0x5cf4('0x26')](_0x19cf5e[_0x5cf4('0x27')]);if(_0x19cf5e[_0x5cf4('0x28')]){delete _0x19cf5e[_0x5cf4('0x28')];}_0x2e5454['status'](_0x455b3d)['send'](_0x19cf5e);};}exports[_0x5cf4('0x29')]=function(_0x7bea95,_0x36cebb){var _0x5c90d7={},_0x2fef03={},_0xb15152={'count':0x0,'rows':[]};var _0x397b1f=_[_0x5cf4('0x2a')](db[_0x5cf4('0x2b')]['rawAttributes'],function(_0x389033){return{'name':_0x389033[_0x5cf4('0x2c')],'type':_0x389033[_0x5cf4('0x2d')][_0x5cf4('0x2e')]};});_0x2fef03[_0x5cf4('0x2f')]=_[_0x5cf4('0x2a')](_0x397b1f,_0x5cf4('0x28'));_0x2fef03['query']=_['keys'](_0x7bea95[_0x5cf4('0x30')]);_0x2fef03[_0x5cf4('0x31')]=_['intersection'](_0x2fef03['model'],_0x2fef03[_0x5cf4('0x30')]);_0x5c90d7[_0x5cf4('0x32')]=_[_0x5cf4('0x33')](_0x2fef03[_0x5cf4('0x2f')],qs[_0x5cf4('0x34')](_0x7bea95[_0x5cf4('0x30')][_0x5cf4('0x34')]));_0x5c90d7[_0x5cf4('0x32')]=_0x5c90d7[_0x5cf4('0x32')][_0x5cf4('0x35')]?_0x5c90d7['attributes']:_0x2fef03['model'];if(!_0x7bea95[_0x5cf4('0x30')][_0x5cf4('0x36')](_0x5cf4('0x37'))){_0x5c90d7[_0x5cf4('0x19')]=qs[_0x5cf4('0x19')](_0x7bea95[_0x5cf4('0x30')]['limit']);_0x5c90d7[_0x5cf4('0x1b')]=qs['offset'](_0x7bea95['query'][_0x5cf4('0x1b')]);}_0x5c90d7[_0x5cf4('0x38')]=qs[_0x5cf4('0x39')](_0x7bea95[_0x5cf4('0x30')][_0x5cf4('0x39')]);_0x5c90d7[_0x5cf4('0x3a')]=qs[_0x5cf4('0x31')](_[_0x5cf4('0x3b')](_0x7bea95[_0x5cf4('0x30')],_0x2fef03['filters']),_0x397b1f);if(_0x7bea95[_0x5cf4('0x30')]['filter']){_0x5c90d7[_0x5cf4('0x3a')]=_[_0x5cf4('0x3c')](_0x5c90d7[_0x5cf4('0x3a')],{'$or':_[_0x5cf4('0x2a')](_0x397b1f,function(_0x245b5c){if(_0x245b5c[_0x5cf4('0x2d')]!=='VIRTUAL'){var _0x5e82e6={};_0x5e82e6[_0x245b5c[_0x5cf4('0x28')]]={'$like':'%'+_0x7bea95[_0x5cf4('0x30')][_0x5cf4('0x3d')]+'%'};return _0x5e82e6;}})});}_0x5c90d7=_[_0x5cf4('0x3c')]({},_0x5c90d7,_0x7bea95[_0x5cf4('0x3e')]);var _0x1a28cf={'where':_0x5c90d7[_0x5cf4('0x3a')]};return db[_0x5cf4('0x2b')][_0x5cf4('0x1a')](_0x1a28cf)[_0x5cf4('0x23')](function(_0x508ee2){_0xb15152[_0x5cf4('0x1a')]=_0x508ee2;if(_0x7bea95[_0x5cf4('0x30')][_0x5cf4('0x3f')]){_0x5c90d7[_0x5cf4('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x5cf4('0x41')](_0x5c90d7);})[_0x5cf4('0x23')](function(_0x1054f9){_0xb15152['rows']=_0x1054f9;return _0xb15152;})[_0x5cf4('0x23')](respondWithFilteredResult(_0x36cebb,_0x5c90d7))[_0x5cf4('0x42')](handleError(_0x36cebb,null));};exports['show']=function(_0x16024d,_0x1e796e){var _0x23454c={'raw':!![],'where':{'id':_0x16024d[_0x5cf4('0x43')]['id']}},_0x470ed2={};_0x470ed2[_0x5cf4('0x2f')]=_[_0x5cf4('0x44')](db['AnalyticTreeReport'][_0x5cf4('0x45')]);_0x470ed2[_0x5cf4('0x30')]=_[_0x5cf4('0x44')](_0x16024d[_0x5cf4('0x30')]);_0x470ed2[_0x5cf4('0x31')]=_['intersection'](_0x470ed2[_0x5cf4('0x2f')],_0x470ed2['query']);_0x23454c[_0x5cf4('0x32')]=_[_0x5cf4('0x33')](_0x470ed2[_0x5cf4('0x2f')],qs[_0x5cf4('0x34')](_0x16024d[_0x5cf4('0x30')][_0x5cf4('0x34')]));_0x23454c[_0x5cf4('0x32')]=_0x23454c[_0x5cf4('0x32')][_0x5cf4('0x35')]?_0x23454c[_0x5cf4('0x32')]:_0x470ed2[_0x5cf4('0x2f')];if(_0x16024d[_0x5cf4('0x30')]['includeAll']){_0x23454c[_0x5cf4('0x40')]=[{'all':!![]}];}_0x23454c=_[_0x5cf4('0x3c')]({},_0x23454c,_0x16024d['options']);return db['AnalyticTreeReport'][_0x5cf4('0x46')](_0x23454c)['then'](handleEntityNotFound(_0x1e796e,null))[_0x5cf4('0x23')](respondWithResult(_0x1e796e,null))[_0x5cf4('0x42')](handleError(_0x1e796e,null));};exports[_0x5cf4('0x47')]=function(_0x4a71e1,_0x95f0d2){return db['AnalyticTreeReport']['create'](_0x4a71e1['body'],{})[_0x5cf4('0x23')](respondWithResult(_0x95f0d2,0xc9))[_0x5cf4('0x42')](handleError(_0x95f0d2,null));};exports[_0x5cf4('0x22')]=function(_0x282e48,_0x3e9e7c){if(_0x282e48[_0x5cf4('0x48')]['id']){delete _0x282e48[_0x5cf4('0x48')]['id'];}return db['AnalyticTreeReport'][_0x5cf4('0x46')]({'where':{'id':_0x282e48['params']['id']}})[_0x5cf4('0x23')](handleEntityNotFound(_0x3e9e7c,null))[_0x5cf4('0x23')](saveUpdates(_0x282e48[_0x5cf4('0x48')],null))['then'](respondWithResult(_0x3e9e7c,null))[_0x5cf4('0x42')](handleError(_0x3e9e7c,null));};exports['destroy']=function(_0x33eb40,_0x51003f){return db['AnalyticTreeReport'][_0x5cf4('0x46')]({'where':{'id':_0x33eb40[_0x5cf4('0x43')]['id']}})[_0x5cf4('0x23')](handleEntityNotFound(_0x51003f,null))[_0x5cf4('0x23')](removeEntity(_0x51003f,null))[_0x5cf4('0x42')](handleError(_0x51003f,null));}; \ No newline at end of file +var _0xf426=['find','create','body','params','destroy','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','AnalyticTreeReport','includeAll','findAll','rows','catch','show','include'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xf426,0xe3));var _0x6f42=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0xf426[_0x2a453b];return _0x132f79;};'use strict';var emlformat=require(_0x6f42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f42('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f42('0x2'));var moment=require(_0x6f42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f42('0x4'));var util=require(_0x6f42('0x5'));var path=require('path');var sox=require(_0x6f42('0x6'));var csv=require(_0x6f42('0x7'));var ejs=require(_0x6f42('0x8'));var fs=require('fs');var fs_extra=require(_0x6f42('0x9'));var _=require(_0x6f42('0xa'));var squel=require(_0x6f42('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f42('0xc'));var deskjs=require(_0x6f42('0xd'));var toCsv=require(_0x6f42('0x7'));var querystring=require(_0x6f42('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6f42('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6f42('0x10'));var hardwareService=require(_0x6f42('0x11'));var logger=require(_0x6f42('0x12'))(_0x6f42('0x13'));var utils=require(_0x6f42('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f42('0x15'))['db'];function respondWithStatusCode(_0xd56b58,_0x14ca9f){_0x14ca9f=_0x14ca9f||0xcc;return function(_0xc9beae){if(_0xc9beae){return _0xd56b58[_0x6f42('0x16')](_0x14ca9f);}return _0xd56b58[_0x6f42('0x17')](_0x14ca9f)[_0x6f42('0x18')]();};}function respondWithResult(_0x5bdef4,_0x437198){_0x437198=_0x437198||0xc8;return function(_0x337e67){if(_0x337e67){return _0x5bdef4[_0x6f42('0x17')](_0x437198)[_0x6f42('0x19')](_0x337e67);}};}function respondWithFilteredResult(_0x50dbae,_0x182a95){return function(_0x53637b){if(_0x53637b){var _0x385300=typeof _0x182a95[_0x6f42('0x1a')]===_0x6f42('0x1b')&&typeof _0x182a95[_0x6f42('0x1c')]===_0x6f42('0x1b');var _0x361481=_0x53637b[_0x6f42('0x1d')];var _0x10d5c1=_0x385300?0x0:_0x182a95['offset'];var _0x21fec0=_0x385300?_0x53637b[_0x6f42('0x1d')]:_0x182a95[_0x6f42('0x1a')]+_0x182a95['limit'];var _0x3c4e47;if(_0x21fec0>=_0x361481){_0x21fec0=_0x361481;_0x3c4e47=0xc8;}else{_0x3c4e47=0xce;}_0x50dbae[_0x6f42('0x17')](_0x3c4e47);return _0x50dbae[_0x6f42('0x1e')](_0x6f42('0x1f'),_0x10d5c1+'-'+_0x21fec0+'/'+_0x361481)['json'](_0x53637b);}return null;};}function patchUpdates(_0x3e64d1){return function(_0x375e18){try{jsonpatch[_0x6f42('0x20')](_0x375e18,_0x3e64d1,!![]);}catch(_0x58e8e7){return BPromise[_0x6f42('0x21')](_0x58e8e7);}return _0x375e18[_0x6f42('0x22')]();};}function saveUpdates(_0x131d5a,_0x3a8872){return function(_0x360bbc){if(_0x360bbc){return _0x360bbc[_0x6f42('0x23')](_0x131d5a)['then'](function(_0x3914df){return _0x3914df;});}return null;};}function removeEntity(_0x313a0e,_0x182f19){return function(_0x318fb6){if(_0x318fb6){return _0x318fb6['destroy']()[_0x6f42('0x24')](function(){_0x313a0e[_0x6f42('0x17')](0xcc)[_0x6f42('0x18')]();});}};}function handleEntityNotFound(_0x35cbc1,_0xe86be8){return function(_0xa7783e){if(!_0xa7783e){_0x35cbc1[_0x6f42('0x16')](0x194);}return _0xa7783e;};}function handleError(_0x11e1e8,_0x127588){_0x127588=_0x127588||0x1f4;return function(_0xe56898){logger[_0x6f42('0x25')](_0xe56898[_0x6f42('0x26')]);if(_0xe56898[_0x6f42('0x27')]){delete _0xe56898['name'];}_0x11e1e8[_0x6f42('0x17')](_0x127588)['send'](_0xe56898);};}exports[_0x6f42('0x28')]=function(_0x20279f,_0x38ddac){var _0x4762ac={},_0x42198a={},_0x2327de={'count':0x0,'rows':[]};var _0x454187=_[_0x6f42('0x29')](db['AnalyticTreeReport'][_0x6f42('0x2a')],function(_0x730e0b){return{'name':_0x730e0b[_0x6f42('0x2b')],'type':_0x730e0b[_0x6f42('0x2c')][_0x6f42('0x2d')]};});_0x42198a[_0x6f42('0x2e')]=_[_0x6f42('0x29')](_0x454187,_0x6f42('0x27'));_0x42198a['query']=_[_0x6f42('0x2f')](_0x20279f[_0x6f42('0x30')]);_0x42198a[_0x6f42('0x31')]=_['intersection'](_0x42198a['model'],_0x42198a[_0x6f42('0x30')]);_0x4762ac[_0x6f42('0x32')]=_[_0x6f42('0x33')](_0x42198a[_0x6f42('0x2e')],qs[_0x6f42('0x34')](_0x20279f['query']['fields']));_0x4762ac[_0x6f42('0x32')]=_0x4762ac['attributes'][_0x6f42('0x35')]?_0x4762ac[_0x6f42('0x32')]:_0x42198a[_0x6f42('0x2e')];if(!_0x20279f['query'][_0x6f42('0x36')](_0x6f42('0x37'))){_0x4762ac[_0x6f42('0x1c')]=qs[_0x6f42('0x1c')](_0x20279f[_0x6f42('0x30')][_0x6f42('0x1c')]);_0x4762ac['offset']=qs[_0x6f42('0x1a')](_0x20279f[_0x6f42('0x30')][_0x6f42('0x1a')]);}_0x4762ac[_0x6f42('0x38')]=qs[_0x6f42('0x39')](_0x20279f['query'][_0x6f42('0x39')]);_0x4762ac['where']=qs[_0x6f42('0x31')](_['pick'](_0x20279f[_0x6f42('0x30')],_0x42198a[_0x6f42('0x31')]),_0x454187);if(_0x20279f[_0x6f42('0x30')][_0x6f42('0x3a')]){_0x4762ac[_0x6f42('0x3b')]=_[_0x6f42('0x3c')](_0x4762ac[_0x6f42('0x3b')],{'$or':_['map'](_0x454187,function(_0x2e458c){if(_0x2e458c[_0x6f42('0x2c')]!=='VIRTUAL'){var _0x19e37d={};_0x19e37d[_0x2e458c[_0x6f42('0x27')]]={'$like':'%'+_0x20279f['query'][_0x6f42('0x3a')]+'%'};return _0x19e37d;}})});}_0x4762ac=_[_0x6f42('0x3c')]({},_0x4762ac,_0x20279f[_0x6f42('0x3d')]);var _0x523fb6={'where':_0x4762ac[_0x6f42('0x3b')]};return db[_0x6f42('0x3e')][_0x6f42('0x1d')](_0x523fb6)[_0x6f42('0x24')](function(_0x494d55){_0x2327de[_0x6f42('0x1d')]=_0x494d55;if(_0x20279f[_0x6f42('0x30')][_0x6f42('0x3f')]){_0x4762ac['include']=[{'all':!![]}];}return db[_0x6f42('0x3e')][_0x6f42('0x40')](_0x4762ac);})[_0x6f42('0x24')](function(_0x191c71){_0x2327de[_0x6f42('0x41')]=_0x191c71;return _0x2327de;})[_0x6f42('0x24')](respondWithFilteredResult(_0x38ddac,_0x4762ac))[_0x6f42('0x42')](handleError(_0x38ddac,null));};exports[_0x6f42('0x43')]=function(_0x52ca75,_0x242e50){var _0x115821={'raw':!![],'where':{'id':_0x52ca75['params']['id']}},_0x45fdf5={};_0x45fdf5[_0x6f42('0x2e')]=_[_0x6f42('0x2f')](db[_0x6f42('0x3e')][_0x6f42('0x2a')]);_0x45fdf5[_0x6f42('0x30')]=_[_0x6f42('0x2f')](_0x52ca75[_0x6f42('0x30')]);_0x45fdf5[_0x6f42('0x31')]=_['intersection'](_0x45fdf5[_0x6f42('0x2e')],_0x45fdf5['query']);_0x115821['attributes']=_[_0x6f42('0x33')](_0x45fdf5[_0x6f42('0x2e')],qs['fields'](_0x52ca75[_0x6f42('0x30')][_0x6f42('0x34')]));_0x115821[_0x6f42('0x32')]=_0x115821[_0x6f42('0x32')][_0x6f42('0x35')]?_0x115821[_0x6f42('0x32')]:_0x45fdf5['model'];if(_0x52ca75['query'][_0x6f42('0x3f')]){_0x115821[_0x6f42('0x44')]=[{'all':!![]}];}_0x115821=_[_0x6f42('0x3c')]({},_0x115821,_0x52ca75[_0x6f42('0x3d')]);return db[_0x6f42('0x3e')][_0x6f42('0x45')](_0x115821)[_0x6f42('0x24')](handleEntityNotFound(_0x242e50,null))[_0x6f42('0x24')](respondWithResult(_0x242e50,null))[_0x6f42('0x42')](handleError(_0x242e50,null));};exports[_0x6f42('0x46')]=function(_0x558661,_0xf7ad5b){return db['AnalyticTreeReport'][_0x6f42('0x46')](_0x558661[_0x6f42('0x47')],{})[_0x6f42('0x24')](respondWithResult(_0xf7ad5b,0xc9))[_0x6f42('0x42')](handleError(_0xf7ad5b,null));};exports[_0x6f42('0x23')]=function(_0x564930,_0x1148c6){if(_0x564930[_0x6f42('0x47')]['id']){delete _0x564930[_0x6f42('0x47')]['id'];}return db['AnalyticTreeReport'][_0x6f42('0x45')]({'where':{'id':_0x564930[_0x6f42('0x48')]['id']}})[_0x6f42('0x24')](handleEntityNotFound(_0x1148c6,null))['then'](saveUpdates(_0x564930[_0x6f42('0x47')],null))[_0x6f42('0x24')](respondWithResult(_0x1148c6,null))['catch'](handleError(_0x1148c6,null));};exports[_0x6f42('0x49')]=function(_0x3a579b,_0x1620e6){return db[_0x6f42('0x3e')]['find']({'where':{'id':_0x3a579b[_0x6f42('0x48')]['id']}})['then'](handleEntityNotFound(_0x1620e6,null))[_0x6f42('0x24')](removeEntity(_0x1620e6,null))['catch'](handleError(_0x1620e6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 885ba53..a94c38c 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 _0xee67=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0xee67,0x1d3));var _0x7ee6=function(_0x52ff60,_0x3eccef){_0x52ff60=_0x52ff60-0x0;var _0x2f5846=_0xee67[_0x52ff60];return _0x2f5846;};'use strict';var _=require(_0x7ee6('0x0'));var util=require(_0x7ee6('0x1'));var logger=require(_0x7ee6('0x2'))(_0x7ee6('0x3'));var moment=require(_0x7ee6('0x4'));var BPromise=require(_0x7ee6('0x5'));var rp=require(_0x7ee6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ee6('0x7'));var attributes=require(_0x7ee6('0x8'));module['exports']=function(_0x5a722d,_0x3f13f4){return _0x5a722d[_0x7ee6('0x9')](_0x7ee6('0xa'),attributes,{'tableName':_0x7ee6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dfe=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x10dcd7,_0x582de7){var _0x1bc336=function(_0xa7b0b8){while(--_0xa7b0b8){_0x10dcd7['push'](_0x10dcd7['shift']());}};_0x1bc336(++_0x582de7);}(_0x1dfe,0xa1));var _0xe1df=function(_0x120b68,_0x456bea){_0x120b68=_0x120b68-0x0;var _0x30e5a5=_0x1dfe[_0x120b68];return _0x30e5a5;};'use strict';var _=require(_0xe1df('0x0'));var util=require(_0xe1df('0x1'));var logger=require('../../config/logger')(_0xe1df('0x2'));var moment=require(_0xe1df('0x3'));var BPromise=require(_0xe1df('0x4'));var rp=require(_0xe1df('0x5'));var fs=require('fs');var path=require(_0xe1df('0x6'));var rimraf=require('rimraf');var config=require(_0xe1df('0x7'));var attributes=require(_0xe1df('0x8'));module[_0xe1df('0x9')]=function(_0x2ac1ac,_0x27514e){return _0x2ac1ac[_0xe1df('0xa')](_0xe1df('0xb'),attributes,{'tableName':'analytics_report_trees','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 097d2de..81525c1 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x2ef3,0xba));var _0x32ef=function(_0x30c355,_0x314ccf){_0x30c355=_0x30c355-0x0;var _0x930a47=_0x2ef3[_0x30c355];return _0x930a47;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x22d483,_0x31f29f){var _0x586dda=function(_0x46df19){while(--_0x46df19){_0x22d483['push'](_0x22d483['shift']());}};_0x586dda(++_0x31f29f);}(_0xdb28,0x106));var _0x8db2=function(_0xc5067a,_0x3f1ad2){_0xc5067a=_0xc5067a-0x0;var _0x39e793=_0xdb28[_0xc5067a];return _0x39e793;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d3fc417..f5015a7 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 _0xaa61=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','post','create','update','delete','multer','util','path','express','Router'];(function(_0x2b365f,_0x17aa37){var _0x26b060=function(_0x5e0a39){while(--_0x5e0a39){_0x2b365f['push'](_0x2b365f['shift']());}};_0x26b060(++_0x17aa37);}(_0xaa61,0x9d));var _0x1aa6=function(_0x4edd73,_0x31c9f4){_0x4edd73=_0x4edd73-0x0;var _0x60a855=_0xaa61[_0x4edd73];return _0x60a855;};'use strict';var multer=require(_0x1aa6('0x0'));var util=require(_0x1aa6('0x1'));var path=require(_0x1aa6('0x2'));var timeout=require('connect-timeout');var express=require(_0x1aa6('0x3'));var router=express[_0x1aa6('0x4')]();var fs_extra=require(_0x1aa6('0x5'));var auth=require(_0x1aa6('0x6'));var interaction=require(_0x1aa6('0x7'));var config=require(_0x1aa6('0x8'));var controller=require(_0x1aa6('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1aa6('0xa')](_0x1aa6('0xb'),auth[_0x1aa6('0xc')](),controller[_0x1aa6('0xd')]);router[_0x1aa6('0xe')]('/',auth['isAuthenticated'](),controller[_0x1aa6('0xf')]);router['put'](_0x1aa6('0xb'),auth[_0x1aa6('0xc')](),controller[_0x1aa6('0x10')]);router[_0x1aa6('0x11')](_0x1aa6('0xb'),auth[_0x1aa6('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfca2=['isAuthenticated','show','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id'];(function(_0x253f0e,_0x3d2fe7){var _0x5d231a=function(_0x1f7f33){while(--_0x1f7f33){_0x253f0e['push'](_0x253f0e['shift']());}};_0x5d231a(++_0x3d2fe7);}(_0xfca2,0x103));var _0x2fca=function(_0x32f193,_0x612afc){_0x32f193=_0x32f193-0x0;var _0x5bb92e=_0xfca2[_0x32f193];return _0x5bb92e;};'use strict';var multer=require(_0x2fca('0x0'));var util=require(_0x2fca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2fca('0x2'));var router=express[_0x2fca('0x3')]();var fs_extra=require(_0x2fca('0x4'));var auth=require(_0x2fca('0x5'));var interaction=require(_0x2fca('0x6'));var config=require(_0x2fca('0x7'));var controller=require(_0x2fca('0x8'));router[_0x2fca('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2fca('0x9')](_0x2fca('0xa'),auth[_0x2fca('0xb')](),controller[_0x2fca('0xc')]);router['post']('/',auth[_0x2fca('0xb')](),controller[_0x2fca('0xd')]);router[_0x2fca('0xe')](_0x2fca('0xa'),auth[_0x2fca('0xb')](),controller[_0x2fca('0xf')]);router[_0x2fca('0x10')](_0x2fca('0xa'),auth[_0x2fca('0xb')](),controller['destroy']);module[_0x2fca('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0cd9de8..2b5dcb5 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 _0x1df5=['STRING','sequelize','exports'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0x1df5,0xfd));var _0x51df=function(_0x11d1df,_0x3783b3){_0x11d1df=_0x11d1df-0x0;var _0x453ced=_0x1df5[_0x11d1df];return _0x453ced;};'use strict';var Sequelize=require(_0x51df('0x0'));module[_0x51df('0x1')]={'name':{'type':Sequelize[_0x51df('0x2')]},'basename':{'type':Sequelize[_0x51df('0x2')]},'type':{'type':Sequelize[_0x51df('0x2')]}}; \ No newline at end of file +var _0x2123=['STRING','sequelize','exports'];(function(_0x15a465,_0x5cf3ed){var _0x2fe181=function(_0x5cdf58){while(--_0x5cdf58){_0x15a465['push'](_0x15a465['shift']());}};_0x2fe181(++_0x5cf3ed);}(_0x2123,0x190));var _0x3212=function(_0x4f49af,_0x1bf29a){_0x4f49af=_0x4f49af-0x0;var _0x2d65ae=_0x2123[_0x4f49af];return _0x2d65ae;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'name':{'type':Sequelize[_0x3212('0x2')]},'basename':{'type':Sequelize[_0x3212('0x2')]},'type':{'type':Sequelize[_0x3212('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a306de9..446d9c4 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 _0x6bf6=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','save','update','then','error','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','Attachment','includeAll','include','findAll','rows','catch','show','find','clone','get','omit','createdAt','updatedAt','body','params','destroy','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x6bf6,0x1d2));var _0x66bf=function(_0x11c4b6,_0x572fdb){_0x11c4b6=_0x11c4b6-0x0;var _0x2cb405=_0x6bf6[_0x11c4b6];return _0x2cb405;};'use strict';var emlformat=require(_0x66bf('0x0'));var rimraf=require(_0x66bf('0x1'));var zipdir=require(_0x66bf('0x2'));var jsonpatch=require(_0x66bf('0x3'));var rp=require('request-promise');var moment=require(_0x66bf('0x4'));var BPromise=require(_0x66bf('0x5'));var Mustache=require(_0x66bf('0x6'));var util=require(_0x66bf('0x7'));var path=require(_0x66bf('0x8'));var sox=require(_0x66bf('0x9'));var csv=require('to-csv');var ejs=require(_0x66bf('0xa'));var fs=require('fs');var fs_extra=require(_0x66bf('0xb'));var _=require(_0x66bf('0xc'));var squel=require(_0x66bf('0xd'));var crypto=require(_0x66bf('0xe'));var jsforce=require(_0x66bf('0xf'));var deskjs=require(_0x66bf('0x10'));var toCsv=require(_0x66bf('0x11'));var querystring=require(_0x66bf('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x66bf('0x13'));var qs=require(_0x66bf('0x14'));var as=require(_0x66bf('0x15'));var hardwareService=require(_0x66bf('0x16'));var logger=require(_0x66bf('0x17'))(_0x66bf('0x18'));var utils=require(_0x66bf('0x19'));var config=require(_0x66bf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x66bf('0x1b'))['db'];function respondWithStatusCode(_0x17f69d,_0x57b75a){_0x57b75a=_0x57b75a||0xcc;return function(_0x258c3d){if(_0x258c3d){return _0x17f69d[_0x66bf('0x1c')](_0x57b75a);}return _0x17f69d['status'](_0x57b75a)[_0x66bf('0x1d')]();};}function respondWithResult(_0x52f6ed,_0x5a46f4){_0x5a46f4=_0x5a46f4||0xc8;return function(_0x361403){if(_0x361403){return _0x52f6ed[_0x66bf('0x1e')](_0x5a46f4)[_0x66bf('0x1f')](_0x361403);}};}function respondWithFilteredResult(_0x2303ff,_0x2d5388){return function(_0x2077f0){if(_0x2077f0){var _0x4f5135=typeof _0x2d5388[_0x66bf('0x20')]===_0x66bf('0x21')&&typeof _0x2d5388['limit']===_0x66bf('0x21');var _0xaca9c9=_0x2077f0[_0x66bf('0x22')];var _0x277f79=_0x4f5135?0x0:_0x2d5388[_0x66bf('0x20')];var _0x1a0125=_0x4f5135?_0x2077f0[_0x66bf('0x22')]:_0x2d5388[_0x66bf('0x20')]+_0x2d5388['limit'];var _0x31d19c;if(_0x1a0125>=_0xaca9c9){_0x1a0125=_0xaca9c9;_0x31d19c=0xc8;}else{_0x31d19c=0xce;}_0x2303ff['status'](_0x31d19c);return _0x2303ff[_0x66bf('0x23')](_0x66bf('0x24'),_0x277f79+'-'+_0x1a0125+'/'+_0xaca9c9)['json'](_0x2077f0);}return null;};}function patchUpdates(_0x627e6f){return function(_0x5f0334){try{jsonpatch['apply'](_0x5f0334,_0x627e6f,!![]);}catch(_0x2c9268){return BPromise['reject'](_0x2c9268);}return _0x5f0334[_0x66bf('0x25')]();};}function saveUpdates(_0x15b3d9,_0x471539){return function(_0x2fbba6){if(_0x2fbba6){return _0x2fbba6[_0x66bf('0x26')](_0x15b3d9)[_0x66bf('0x27')](function(_0x1171c8){return _0x1171c8;});}return null;};}function removeEntity(_0x531d65,_0x31efe1){return function(_0x260951){if(_0x260951){return _0x260951['destroy']()['then'](function(){_0x531d65[_0x66bf('0x1e')](0xcc)[_0x66bf('0x1d')]();});}};}function handleEntityNotFound(_0x4aacaa,_0x54e5e9){return function(_0x2fed90){if(!_0x2fed90){_0x4aacaa[_0x66bf('0x1c')](0x194);}return _0x2fed90;};}function handleError(_0x39868a,_0x4e611e){_0x4e611e=_0x4e611e||0x1f4;return function(_0x56dd34){logger[_0x66bf('0x28')](_0x56dd34['stack']);if(_0x56dd34[_0x66bf('0x29')]){delete _0x56dd34[_0x66bf('0x29')];}_0x39868a[_0x66bf('0x1e')](_0x4e611e)[_0x66bf('0x2a')](_0x56dd34);};}exports[_0x66bf('0x2b')]=function(_0x16d559,_0x11bf58){var _0x38ae18={},_0x510877={},_0x64c417={'count':0x0,'rows':[]};var _0x23915f=_['map'](db['Attachment'][_0x66bf('0x2c')],function(_0x458a39){return{'name':_0x458a39['fieldName'],'type':_0x458a39[_0x66bf('0x2d')][_0x66bf('0x2e')]};});_0x510877[_0x66bf('0x2f')]=_[_0x66bf('0x30')](_0x23915f,_0x66bf('0x29'));_0x510877[_0x66bf('0x31')]=_[_0x66bf('0x32')](_0x16d559[_0x66bf('0x31')]);_0x510877[_0x66bf('0x33')]=_[_0x66bf('0x34')](_0x510877[_0x66bf('0x2f')],_0x510877[_0x66bf('0x31')]);_0x38ae18['attributes']=_[_0x66bf('0x34')](_0x510877[_0x66bf('0x2f')],qs[_0x66bf('0x35')](_0x16d559[_0x66bf('0x31')][_0x66bf('0x35')]));_0x38ae18[_0x66bf('0x36')]=_0x38ae18['attributes'][_0x66bf('0x37')]?_0x38ae18[_0x66bf('0x36')]:_0x510877[_0x66bf('0x2f')];if(!_0x16d559[_0x66bf('0x31')][_0x66bf('0x38')](_0x66bf('0x39'))){_0x38ae18[_0x66bf('0x3a')]=qs[_0x66bf('0x3a')](_0x16d559[_0x66bf('0x31')][_0x66bf('0x3a')]);_0x38ae18[_0x66bf('0x20')]=qs[_0x66bf('0x20')](_0x16d559['query'][_0x66bf('0x20')]);}_0x38ae18[_0x66bf('0x3b')]=qs[_0x66bf('0x3c')](_0x16d559[_0x66bf('0x31')][_0x66bf('0x3c')]);_0x38ae18['where']=qs[_0x66bf('0x33')](_[_0x66bf('0x3d')](_0x16d559[_0x66bf('0x31')],_0x510877[_0x66bf('0x33')]),_0x23915f);if(_0x16d559[_0x66bf('0x31')][_0x66bf('0x3e')]){_0x38ae18[_0x66bf('0x3f')]=_[_0x66bf('0x40')](_0x38ae18[_0x66bf('0x3f')],{'$or':_[_0x66bf('0x30')](_0x23915f,function(_0x434f23){if(_0x434f23[_0x66bf('0x2d')]!==_0x66bf('0x41')){var _0x135bb3={};_0x135bb3[_0x434f23['name']]={'$like':'%'+_0x16d559[_0x66bf('0x31')][_0x66bf('0x3e')]+'%'};return _0x135bb3;}})});}_0x38ae18=_[_0x66bf('0x40')]({},_0x38ae18,_0x16d559[_0x66bf('0x42')]);var _0x238e43={'where':_0x38ae18[_0x66bf('0x3f')]};return db[_0x66bf('0x43')][_0x66bf('0x22')](_0x238e43)['then'](function(_0x4732a9){_0x64c417[_0x66bf('0x22')]=_0x4732a9;if(_0x16d559['query'][_0x66bf('0x44')]){_0x38ae18[_0x66bf('0x45')]=[{'all':!![]}];}return db[_0x66bf('0x43')][_0x66bf('0x46')](_0x38ae18);})[_0x66bf('0x27')](function(_0xb2c768){_0x64c417[_0x66bf('0x47')]=_0xb2c768;return _0x64c417;})[_0x66bf('0x27')](respondWithFilteredResult(_0x11bf58,_0x38ae18))[_0x66bf('0x48')](handleError(_0x11bf58,null));};exports[_0x66bf('0x49')]=function(_0x1f6e1e,_0x168beb){var _0x416976={'raw':!![],'where':{'id':_0x1f6e1e['params']['id']}},_0x2d252c={};_0x2d252c['model']=_[_0x66bf('0x32')](db[_0x66bf('0x43')][_0x66bf('0x2c')]);_0x2d252c[_0x66bf('0x31')]=_[_0x66bf('0x32')](_0x1f6e1e[_0x66bf('0x31')]);_0x2d252c['filters']=_[_0x66bf('0x34')](_0x2d252c['model'],_0x2d252c['query']);_0x416976[_0x66bf('0x36')]=_[_0x66bf('0x34')](_0x2d252c[_0x66bf('0x2f')],qs[_0x66bf('0x35')](_0x1f6e1e[_0x66bf('0x31')][_0x66bf('0x35')]));_0x416976[_0x66bf('0x36')]=_0x416976[_0x66bf('0x36')][_0x66bf('0x37')]?_0x416976[_0x66bf('0x36')]:_0x2d252c[_0x66bf('0x2f')];if(_0x1f6e1e[_0x66bf('0x31')]['includeAll']){_0x416976[_0x66bf('0x45')]=[{'all':!![]}];}_0x416976=_[_0x66bf('0x40')]({},_0x416976,_0x1f6e1e['options']);return db[_0x66bf('0x43')][_0x66bf('0x4a')](_0x416976)[_0x66bf('0x27')](handleEntityNotFound(_0x168beb,null))['then'](respondWithResult(_0x168beb,null))[_0x66bf('0x48')](handleError(_0x168beb,null));};exports[_0x66bf('0x4b')]=function(_0x160f0a,_0x27ecb0){var _0x541f76={'where':{'id':_0x160f0a['params']['id']}},_0x4eebf9={};_0x4eebf9[_0x66bf('0x2f')]=_['keys'](db[_0x66bf('0x43')][_0x66bf('0x2c')]);_0x541f76[_0x66bf('0x36')]=_['intersection'](_0x4eebf9[_0x66bf('0x2f')],qs[_0x66bf('0x35')](_0x160f0a[_0x66bf('0x31')]['fields']));_0x541f76['attributes']=_0x541f76['attributes'][_0x66bf('0x37')]?_0x541f76[_0x66bf('0x36')]:_0x4eebf9[_0x66bf('0x2f')];if(_0x160f0a[_0x66bf('0x31')][_0x66bf('0x44')]){_0x541f76[_0x66bf('0x45')]=[{'all':!![]}];}_0x541f76=_['merge']({},_0x541f76,_0x160f0a[_0x66bf('0x42')]);return db[_0x66bf('0x43')][_0x66bf('0x4a')](_0x541f76)[_0x66bf('0x27')](handleEntityNotFound(_0x27ecb0,null))[_0x66bf('0x27')](function(_0x43ef94){if(_0x43ef94){var _0x45ad36=_0x43ef94[_0x66bf('0x4c')]({'plain':!![]});_0x45ad36=qs[_0x66bf('0x4d')](_0x45ad36,['id',_0x66bf('0x4e'),_0x66bf('0x4f')]);_0x160f0a[_0x66bf('0x50')]=_['omit'](_0x160f0a[_0x66bf('0x50')],['id','createdAt','updatedAt']);return db['Attachment']['create'](_['merge'](_0x45ad36,_0x160f0a[_0x66bf('0x50')]),{'include':_0x160f0a[_0x66bf('0x31')][_0x66bf('0x44')]?[{'all':!![]}]:undefined});}})[_0x66bf('0x27')](respondWithResult(_0x27ecb0,0xc9))[_0x66bf('0x48')](handleError(_0x27ecb0,null));};exports[_0x66bf('0x26')]=function(_0x7f5e38,_0x39f6c3){if(_0x7f5e38['body']['id']){delete _0x7f5e38['body']['id'];}return db[_0x66bf('0x43')][_0x66bf('0x4a')]({'where':{'id':_0x7f5e38[_0x66bf('0x51')]['id']}})[_0x66bf('0x27')](handleEntityNotFound(_0x39f6c3,null))[_0x66bf('0x27')](saveUpdates(_0x7f5e38['body'],null))[_0x66bf('0x27')](respondWithResult(_0x39f6c3,null))[_0x66bf('0x48')](handleError(_0x39f6c3,null));};exports[_0x66bf('0x52')]=function(_0x3acdb5,_0x20f181){return db[_0x66bf('0x43')][_0x66bf('0x4a')]({'where':{'id':_0x3acdb5[_0x66bf('0x51')]['id']}})[_0x66bf('0x27')](handleEntityNotFound(_0x20f181,null))[_0x66bf('0x27')](removeEntity(_0x20f181,null))[_0x66bf('0x48')](handleError(_0x20f181,null));};exports[_0x66bf('0x53')]=function(_0x468bb5,_0x3604ee,_0x369075){_0x468bb5[_0x66bf('0x50')]['name']=_0x468bb5[_0x66bf('0x54')][_0x66bf('0x55')];_0x468bb5[_0x66bf('0x50')][_0x66bf('0x56')]=_0x468bb5['file'][_0x66bf('0x57')];_0x468bb5['body'][_0x66bf('0x2d')]=_0x468bb5['file'][_0x66bf('0x58')];return db[_0x66bf('0x43')]['create'](_0x468bb5['body'])['then'](respondWithResult(_0x3604ee,0xc9))[_0x66bf('0x48')](handleError(_0x3604ee,null));};exports[_0x66bf('0x59')]=function(_0x27c8f1,_0x5e3097,_0x50354c){return db[_0x66bf('0x43')][_0x66bf('0x5a')]({'where':{'id':_0x27c8f1[_0x66bf('0x51')]['id']},'raw':!![]})[_0x66bf('0x27')](handleEntityNotFound(_0x5e3097,null))[_0x66bf('0x27')](function(_0x90aa80){if(_0x90aa80){var _0x50185e=_0x90aa80[_0x66bf('0x5b')]!==null;var _0x5e5a21=path['join'](config['root'],_0x66bf('0x5c'));if(_0x50185e){_0x5e5a21=path[_0x66bf('0x5d')](_0x5e5a21,_0x66bf('0x5e'));}var _0x38e769=path[_0x66bf('0x5d')](_0x5e5a21,_0x90aa80[_0x66bf('0x56')]);return _0x5e3097['download'](_0x38e769);}})[_0x66bf('0x48')](handleError(_0x5e3097,null));}; \ No newline at end of file +var _0xeb8d=['json','undefined','limit','offset','count','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','rawAttributes','find','omit','updatedAt','body','createdAt','create','basename','file','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xeb8d,0x137));var _0xdeb8=function(_0x512e41,_0x4a7db2){_0x512e41=_0x512e41-0x0;var _0x5aa4c0=_0xeb8d[_0x512e41];return _0x5aa4c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdeb8('0x0'));var zipdir=require(_0xdeb8('0x1'));var jsonpatch=require(_0xdeb8('0x2'));var rp=require(_0xdeb8('0x3'));var moment=require(_0xdeb8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdeb8('0x5'));var sox=require(_0xdeb8('0x6'));var csv=require('to-csv');var ejs=require(_0xdeb8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdeb8('0x8'));var crypto=require(_0xdeb8('0x9'));var jsforce=require(_0xdeb8('0xa'));var deskjs=require(_0xdeb8('0xb'));var toCsv=require(_0xdeb8('0xc'));var querystring=require('querystring');var Papa=require(_0xdeb8('0xd'));var Redis=require(_0xdeb8('0xe'));var authService=require(_0xdeb8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdeb8('0x10'));var hardwareService=require(_0xdeb8('0x11'));var logger=require(_0xdeb8('0x12'))(_0xdeb8('0x13'));var utils=require(_0xdeb8('0x14'));var config=require(_0xdeb8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdeb8('0x16'))['db'];function respondWithStatusCode(_0x1db08e,_0x5699f9){_0x5699f9=_0x5699f9||0xcc;return function(_0x416beb){if(_0x416beb){return _0x1db08e['sendStatus'](_0x5699f9);}return _0x1db08e[_0xdeb8('0x17')](_0x5699f9)[_0xdeb8('0x18')]();};}function respondWithResult(_0x23e954,_0x5aada6){_0x5aada6=_0x5aada6||0xc8;return function(_0x5ba811){if(_0x5ba811){return _0x23e954[_0xdeb8('0x17')](_0x5aada6)[_0xdeb8('0x19')](_0x5ba811);}};}function respondWithFilteredResult(_0x273819,_0x2fe5f1){return function(_0x77b5ab){if(_0x77b5ab){var _0x1606bd=typeof _0x2fe5f1['offset']===_0xdeb8('0x1a')&&typeof _0x2fe5f1[_0xdeb8('0x1b')]===_0xdeb8('0x1a');var _0x3f00be=_0x77b5ab['count'];var _0x38baca=_0x1606bd?0x0:_0x2fe5f1[_0xdeb8('0x1c')];var _0x5c729a=_0x1606bd?_0x77b5ab[_0xdeb8('0x1d')]:_0x2fe5f1[_0xdeb8('0x1c')]+_0x2fe5f1[_0xdeb8('0x1b')];var _0x29f25b;if(_0x5c729a>=_0x3f00be){_0x5c729a=_0x3f00be;_0x29f25b=0xc8;}else{_0x29f25b=0xce;}_0x273819[_0xdeb8('0x17')](_0x29f25b);return _0x273819['set'](_0xdeb8('0x1e'),_0x38baca+'-'+_0x5c729a+'/'+_0x3f00be)['json'](_0x77b5ab);}return null;};}function patchUpdates(_0x39bc9b){return function(_0x404ba1){try{jsonpatch['apply'](_0x404ba1,_0x39bc9b,!![]);}catch(_0xe695a8){return BPromise[_0xdeb8('0x1f')](_0xe695a8);}return _0x404ba1['save']();};}function saveUpdates(_0x7ea9a8,_0x538d84){return function(_0x3cf25b){if(_0x3cf25b){return _0x3cf25b[_0xdeb8('0x20')](_0x7ea9a8)[_0xdeb8('0x21')](function(_0x2dbec3){return _0x2dbec3;});}return null;};}function removeEntity(_0x392727,_0x47158d){return function(_0x3a4c7f){if(_0x3a4c7f){return _0x3a4c7f[_0xdeb8('0x22')]()[_0xdeb8('0x21')](function(){_0x392727[_0xdeb8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe6396b,_0x1b6896){return function(_0x1f3bc8){if(!_0x1f3bc8){_0xe6396b[_0xdeb8('0x23')](0x194);}return _0x1f3bc8;};}function handleError(_0x507d41,_0x359056){_0x359056=_0x359056||0x1f4;return function(_0x5a441a){logger[_0xdeb8('0x24')](_0x5a441a[_0xdeb8('0x25')]);if(_0x5a441a[_0xdeb8('0x26')]){delete _0x5a441a[_0xdeb8('0x26')];}_0x507d41[_0xdeb8('0x17')](_0x359056)[_0xdeb8('0x27')](_0x5a441a);};}exports[_0xdeb8('0x28')]=function(_0x35b8d5,_0x796c06){var _0x22b1ee={},_0x252283={},_0x242aa2={'count':0x0,'rows':[]};var _0x2f0e6f=_[_0xdeb8('0x29')](db[_0xdeb8('0x2a')]['rawAttributes'],function(_0x87639b){return{'name':_0x87639b[_0xdeb8('0x2b')],'type':_0x87639b[_0xdeb8('0x2c')][_0xdeb8('0x2d')]};});_0x252283['model']=_['map'](_0x2f0e6f,_0xdeb8('0x26'));_0x252283[_0xdeb8('0x2e')]=_[_0xdeb8('0x2f')](_0x35b8d5[_0xdeb8('0x2e')]);_0x252283[_0xdeb8('0x30')]=_[_0xdeb8('0x31')](_0x252283[_0xdeb8('0x32')],_0x252283[_0xdeb8('0x2e')]);_0x22b1ee[_0xdeb8('0x33')]=_[_0xdeb8('0x31')](_0x252283[_0xdeb8('0x32')],qs[_0xdeb8('0x34')](_0x35b8d5['query']['fields']));_0x22b1ee[_0xdeb8('0x33')]=_0x22b1ee[_0xdeb8('0x33')][_0xdeb8('0x35')]?_0x22b1ee[_0xdeb8('0x33')]:_0x252283[_0xdeb8('0x32')];if(!_0x35b8d5[_0xdeb8('0x2e')][_0xdeb8('0x36')]('nolimit')){_0x22b1ee[_0xdeb8('0x1b')]=qs[_0xdeb8('0x1b')](_0x35b8d5[_0xdeb8('0x2e')][_0xdeb8('0x1b')]);_0x22b1ee[_0xdeb8('0x1c')]=qs[_0xdeb8('0x1c')](_0x35b8d5[_0xdeb8('0x2e')]['offset']);}_0x22b1ee[_0xdeb8('0x37')]=qs[_0xdeb8('0x38')](_0x35b8d5[_0xdeb8('0x2e')][_0xdeb8('0x38')]);_0x22b1ee[_0xdeb8('0x39')]=qs[_0xdeb8('0x30')](_[_0xdeb8('0x3a')](_0x35b8d5[_0xdeb8('0x2e')],_0x252283['filters']),_0x2f0e6f);if(_0x35b8d5[_0xdeb8('0x2e')][_0xdeb8('0x3b')]){_0x22b1ee['where']=_['merge'](_0x22b1ee['where'],{'$or':_[_0xdeb8('0x29')](_0x2f0e6f,function(_0x3138ef){if(_0x3138ef['type']!==_0xdeb8('0x3c')){var _0xe32ce1={};_0xe32ce1[_0x3138ef['name']]={'$like':'%'+_0x35b8d5[_0xdeb8('0x2e')][_0xdeb8('0x3b')]+'%'};return _0xe32ce1;}})});}_0x22b1ee=_[_0xdeb8('0x3d')]({},_0x22b1ee,_0x35b8d5[_0xdeb8('0x3e')]);var _0x3e98e4={'where':_0x22b1ee[_0xdeb8('0x39')]};return db[_0xdeb8('0x2a')][_0xdeb8('0x1d')](_0x3e98e4)[_0xdeb8('0x21')](function(_0x110687){_0x242aa2[_0xdeb8('0x1d')]=_0x110687;if(_0x35b8d5[_0xdeb8('0x2e')][_0xdeb8('0x3f')]){_0x22b1ee[_0xdeb8('0x40')]=[{'all':!![]}];}return db[_0xdeb8('0x2a')]['findAll'](_0x22b1ee);})['then'](function(_0x5dc51c){_0x242aa2['rows']=_0x5dc51c;return _0x242aa2;})[_0xdeb8('0x21')](respondWithFilteredResult(_0x796c06,_0x22b1ee))[_0xdeb8('0x41')](handleError(_0x796c06,null));};exports[_0xdeb8('0x42')]=function(_0x1a4b5c,_0x590cf5){var _0x1a4f46={'raw':!![],'where':{'id':_0x1a4b5c[_0xdeb8('0x43')]['id']}},_0x573d8a={};_0x573d8a[_0xdeb8('0x32')]=_['keys'](db[_0xdeb8('0x2a')][_0xdeb8('0x44')]);_0x573d8a[_0xdeb8('0x2e')]=_[_0xdeb8('0x2f')](_0x1a4b5c[_0xdeb8('0x2e')]);_0x573d8a[_0xdeb8('0x30')]=_[_0xdeb8('0x31')](_0x573d8a['model'],_0x573d8a['query']);_0x1a4f46[_0xdeb8('0x33')]=_['intersection'](_0x573d8a[_0xdeb8('0x32')],qs['fields'](_0x1a4b5c[_0xdeb8('0x2e')][_0xdeb8('0x34')]));_0x1a4f46['attributes']=_0x1a4f46['attributes']['length']?_0x1a4f46[_0xdeb8('0x33')]:_0x573d8a[_0xdeb8('0x32')];if(_0x1a4b5c['query'][_0xdeb8('0x3f')]){_0x1a4f46[_0xdeb8('0x40')]=[{'all':!![]}];}_0x1a4f46=_['merge']({},_0x1a4f46,_0x1a4b5c['options']);return db[_0xdeb8('0x2a')]['find'](_0x1a4f46)[_0xdeb8('0x21')](handleEntityNotFound(_0x590cf5,null))[_0xdeb8('0x21')](respondWithResult(_0x590cf5,null))[_0xdeb8('0x41')](handleError(_0x590cf5,null));};exports['clone']=function(_0x2c10dc,_0x4966f5){var _0x10af25={'where':{'id':_0x2c10dc['params']['id']}},_0x4496fb={};_0x4496fb[_0xdeb8('0x32')]=_[_0xdeb8('0x2f')](db['Attachment'][_0xdeb8('0x44')]);_0x10af25[_0xdeb8('0x33')]=_[_0xdeb8('0x31')](_0x4496fb[_0xdeb8('0x32')],qs[_0xdeb8('0x34')](_0x2c10dc[_0xdeb8('0x2e')][_0xdeb8('0x34')]));_0x10af25['attributes']=_0x10af25[_0xdeb8('0x33')]['length']?_0x10af25[_0xdeb8('0x33')]:_0x4496fb['model'];if(_0x2c10dc['query'][_0xdeb8('0x3f')]){_0x10af25[_0xdeb8('0x40')]=[{'all':!![]}];}_0x10af25=_['merge']({},_0x10af25,_0x2c10dc[_0xdeb8('0x3e')]);return db['Attachment'][_0xdeb8('0x45')](_0x10af25)[_0xdeb8('0x21')](handleEntityNotFound(_0x4966f5,null))['then'](function(_0x3e26e3){if(_0x3e26e3){var _0x168945=_0x3e26e3['get']({'plain':!![]});_0x168945=qs[_0xdeb8('0x46')](_0x168945,['id','createdAt',_0xdeb8('0x47')]);_0x2c10dc[_0xdeb8('0x48')]=_[_0xdeb8('0x46')](_0x2c10dc[_0xdeb8('0x48')],['id',_0xdeb8('0x49'),_0xdeb8('0x47')]);return db[_0xdeb8('0x2a')][_0xdeb8('0x4a')](_[_0xdeb8('0x3d')](_0x168945,_0x2c10dc[_0xdeb8('0x48')]),{'include':_0x2c10dc['query'][_0xdeb8('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4966f5,0xc9))['catch'](handleError(_0x4966f5,null));};exports[_0xdeb8('0x20')]=function(_0x1bfc55,_0x4d3987){if(_0x1bfc55[_0xdeb8('0x48')]['id']){delete _0x1bfc55[_0xdeb8('0x48')]['id'];}return db['Attachment'][_0xdeb8('0x45')]({'where':{'id':_0x1bfc55[_0xdeb8('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d3987,null))['then'](saveUpdates(_0x1bfc55[_0xdeb8('0x48')],null))[_0xdeb8('0x21')](respondWithResult(_0x4d3987,null))[_0xdeb8('0x41')](handleError(_0x4d3987,null));};exports[_0xdeb8('0x22')]=function(_0x363cc2,_0x2f44b5){return db['Attachment'][_0xdeb8('0x45')]({'where':{'id':_0x363cc2[_0xdeb8('0x43')]['id']}})[_0xdeb8('0x21')](handleEntityNotFound(_0x2f44b5,null))[_0xdeb8('0x21')](removeEntity(_0x2f44b5,null))['catch'](handleError(_0x2f44b5,null));};exports[_0xdeb8('0x4a')]=function(_0x5f486a,_0x270114,_0x179395){_0x5f486a[_0xdeb8('0x48')][_0xdeb8('0x26')]=_0x5f486a['file']['originalname'];_0x5f486a[_0xdeb8('0x48')][_0xdeb8('0x4b')]=_0x5f486a[_0xdeb8('0x4c')][_0xdeb8('0x4d')];_0x5f486a[_0xdeb8('0x48')][_0xdeb8('0x2c')]=_0x5f486a[_0xdeb8('0x4c')]['mimetype'];return db[_0xdeb8('0x2a')][_0xdeb8('0x4a')](_0x5f486a[_0xdeb8('0x48')])[_0xdeb8('0x21')](respondWithResult(_0x270114,0xc9))[_0xdeb8('0x41')](handleError(_0x270114,null));};exports[_0xdeb8('0x4e')]=function(_0xcc4a4,_0x3c4e84,_0x5721b2){return db[_0xdeb8('0x2a')][_0xdeb8('0x4f')]({'where':{'id':_0xcc4a4[_0xdeb8('0x43')]['id']},'raw':!![]})[_0xdeb8('0x21')](handleEntityNotFound(_0x3c4e84,null))['then'](function(_0x5b11e2){if(_0x5b11e2){var _0x1e64c9=_0x5b11e2[_0xdeb8('0x50')]!==null;var _0x4a181a=path[_0xdeb8('0x51')](config[_0xdeb8('0x52')],_0xdeb8('0x53'));if(_0x1e64c9){_0x4a181a=path['join'](_0x4a181a,'offline-chat/');}var _0x471da6=path[_0xdeb8('0x51')](_0x4a181a,_0x5b11e2[_0xdeb8('0x4b')]);return _0x3c4e84[_0xdeb8('0x4e')](_0x471da6);}})[_0xdeb8('0x41')](handleError(_0x3c4e84,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 190d220..5a1f3e2 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 _0x3438=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','Attachment'];(function(_0x88b51f,_0x3701a2){var _0x4495b8=function(_0x2b1831){while(--_0x2b1831){_0x88b51f['push'](_0x88b51f['shift']());}};_0x4495b8(++_0x3701a2);}(_0x3438,0x14d));var _0x8343=function(_0x56a262,_0xc62957){_0x56a262=_0x56a262-0x0;var _0x50272d=_0x3438[_0x56a262];return _0x50272d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8343('0x0'))(_0x8343('0x1'));var moment=require(_0x8343('0x2'));var BPromise=require('bluebird');var rp=require(_0x8343('0x3'));var fs=require('fs');var path=require(_0x8343('0x4'));var rimraf=require('rimraf');var config=require(_0x8343('0x5'));var attributes=require('./attachment.attributes');module[_0x8343('0x6')]=function(_0x3fdd53,_0x13dc46){return _0x3fdd53[_0x8343('0x7')](_0x8343('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x070e=['bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','util','../../config/logger','api','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x070e,0x1d5));var _0xe070=function(_0x49b50c,_0x4f4f51){_0x49b50c=_0x49b50c-0x0;var _0x30b4a8=_0x070e[_0x49b50c];return _0x30b4a8;};'use strict';var _=require('lodash');var util=require(_0xe070('0x0'));var logger=require(_0xe070('0x1'))(_0xe070('0x2'));var moment=require(_0xe070('0x3'));var BPromise=require(_0xe070('0x4'));var rp=require(_0xe070('0x5'));var fs=require('fs');var path=require(_0xe070('0x6'));var rimraf=require(_0xe070('0x7'));var config=require(_0xe070('0x8'));var attributes=require(_0xe070('0x9'));module[_0xe070('0xa')]=function(_0x17b7be,_0x5e3ca6){return _0x17b7be['define']('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 cfe5c3e..62a0cc9 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 _0x83f1=['CreateAttachment','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','Attachment','create','options','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x83f1,0x1cc));var _0x183f=function(_0x4ca056,_0x5cf0a0){_0x4ca056=_0x4ca056-0x0;var _0x27d6e3=_0x83f1[_0x4ca056];return _0x27d6e3;};'use strict';var _=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var moment=require(_0x183f('0x2'));var BPromise=require(_0x183f('0x3'));var rs=require(_0x183f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x183f('0x5'));var logger=require(_0x183f('0x6'))(_0x183f('0x7'));var config=require(_0x183f('0x8'));var jayson=require(_0x183f('0x9'));var client=jayson['client'][_0x183f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf702f5,_0x364cc4,_0x5c75c3){return new BPromise(function(_0x434be2,_0x5bdf95){return client[_0x183f('0xb')](_0xf702f5,_0x5c75c3)[_0x183f('0xc')](function(_0x37ed60){logger[_0x183f('0xd')](_0x183f('0xe'),_0x364cc4,_0x183f('0xf'));logger[_0x183f('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x364cc4,_0x183f('0xf'),JSON[_0x183f('0x11')](_0x37ed60));if(_0x37ed60[_0x183f('0x12')]){if(_0x37ed60[_0x183f('0x12')][_0x183f('0x13')]===0x1f4){logger[_0x183f('0x12')](_0x183f('0xe'),_0x364cc4,_0x37ed60['error'][_0x183f('0x14')]);return _0x5bdf95(_0x37ed60['error']['message']);}logger[_0x183f('0x12')](_0x183f('0xe'),_0x364cc4,_0x37ed60[_0x183f('0x12')][_0x183f('0x14')]);return _0x434be2(_0x37ed60[_0x183f('0x12')]['message']);}else{logger[_0x183f('0xd')]('Attachment,\x20%s,\x20%s',_0x364cc4,_0x183f('0xf'));_0x434be2(_0x37ed60[_0x183f('0x15')][_0x183f('0x14')]);}})['catch'](function(_0xe9c5d9){logger[_0x183f('0x12')](_0x183f('0xe'),_0x364cc4,_0xe9c5d9);_0x5bdf95(_0xe9c5d9);});});}exports['CreateAttachment']=function(_0x284244){var _0x2b819e=this;return new Promise(function(_0x2c3468,_0x3f713f){return db[_0x183f('0x16')][_0x183f('0x17')](_0x284244['body'],{'raw':_0x284244[_0x183f('0x18')]?_0x284244[_0x183f('0x18')][_0x183f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x26a103){logger['info'](_0x183f('0x1a'),_0x284244);logger[_0x183f('0x10')](_0x183f('0x1a'),_0x284244,JSON[_0x183f('0x11')](_0x26a103));_0x2c3468(_0x26a103);})['catch'](function(_0x3a1bec){logger[_0x183f('0x12')](_0x183f('0x1a'),_0x3a1bec[_0x183f('0x14')],_0x284244);_0x3f713f(_0x2b819e[_0x183f('0x12')](0x1f4,_0x3a1bec[_0x183f('0x14')]));});});}; \ No newline at end of file +var _0xb248=['request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x36263f,_0x1e71a1){var _0x2b9530=function(_0x24ceb7){while(--_0x24ceb7){_0x36263f['push'](_0x36263f['shift']());}};_0x2b9530(++_0x1e71a1);}(_0xb248,0xc6));var _0x8b24=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xb248[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var moment=require(_0x8b24('0x1'));var BPromise=require(_0x8b24('0x2'));var rs=require(_0x8b24('0x3'));var fs=require('fs');var Redis=require(_0x8b24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b24('0x5'));var logger=require(_0x8b24('0x6'))('rpc');var config=require(_0x8b24('0x7'));var jayson=require(_0x8b24('0x8'));var client=jayson['client'][_0x8b24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4705e0,_0x588ca8,_0x3198a2){return new BPromise(function(_0x51bbad,_0x43b851){return client[_0x8b24('0xa')](_0x4705e0,_0x3198a2)[_0x8b24('0xb')](function(_0x4ad0db){logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x588ca8,_0x8b24('0xe'));logger[_0x8b24('0xf')](_0x8b24('0x10'),_0x588ca8,_0x8b24('0xe'),JSON[_0x8b24('0x11')](_0x4ad0db));if(_0x4ad0db[_0x8b24('0x12')]){if(_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x13')]===0x1f4){logger[_0x8b24('0x12')](_0x8b24('0xd'),_0x588ca8,_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);return _0x43b851(_0x4ad0db['error']['message']);}logger[_0x8b24('0x12')](_0x8b24('0xd'),_0x588ca8,_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);return _0x51bbad(_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);}else{logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x588ca8,'request\x20sent');_0x51bbad(_0x4ad0db['result']['message']);}})[_0x8b24('0x15')](function(_0x523863){logger['error'](_0x8b24('0xd'),_0x588ca8,_0x523863);_0x43b851(_0x523863);});});}exports[_0x8b24('0x16')]=function(_0x527af7){var _0x1bafdf=this;return new Promise(function(_0x5e3c52,_0x3b4805){return db['Attachment'][_0x8b24('0x17')](_0x527af7['body'],{'raw':_0x527af7[_0x8b24('0x18')]?_0x527af7[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![]})[_0x8b24('0xb')](function(_0x2a4f2d){logger[_0x8b24('0xc')](_0x8b24('0x16'),_0x527af7);logger['debug'](_0x8b24('0x16'),_0x527af7,JSON[_0x8b24('0x11')](_0x2a4f2d));_0x5e3c52(_0x2a4f2d);})['catch'](function(_0xd9b96){logger[_0x8b24('0x12')](_0x8b24('0x16'),_0xd9b96[_0x8b24('0x14')],_0x527af7);_0x3b4805(_0x1bafdf[_0x8b24('0x12')](0x1f4,_0xd9b96[_0x8b24('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index c319aa7..c029fac 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x45014e,_0x301564){var _0x5b3970=function(_0x1ba85c){while(--_0x1ba85c){_0x45014e['push'](_0x45014e['shift']());}};_0x5b3970(++_0x301564);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5759fe,_0x45b251){_0x5759fe=_0x5759fe-0x0;var _0xffcaec=_0x5f2f[_0x5759fe];return _0xffcaec;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x56fd2a,_0x848fb4){var _0xb2341f=function(_0x49f494){while(--_0x49f494){_0x56fd2a['push'](_0x56fd2a['shift']());}};_0xb2341f(++_0x848fb4);}(_0x757a,0xde));var _0xa757=function(_0x23029c,_0x187b9b){_0x23029c=_0x23029c-0x0;var _0x332dfd=_0x757a[_0x23029c];return _0x332dfd;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index b720c7a..c45624e 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 _0x3080=['bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','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','adSsoEnabled','then','findOne','name','password','salt','role','disabled','blockedAt','admin','user','agent','blockDuration','add','minutes','getLicense','catch','status','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','User','passport','passport-local','Strategy','moment','activedirectory2'];(function(_0x2f6a98,_0x218fb5){var _0x4acd3b=function(_0x151c42){while(--_0x151c42){_0x2f6a98['push'](_0x2f6a98['shift']());}};_0x4acd3b(++_0x218fb5);}(_0x3080,0x8b));var _0x0308=function(_0x478603,_0x412813){_0x478603=_0x478603-0x0;var _0x12610d=_0x3080[_0x478603];return _0x12610d;};'use strict';var passport=require(_0x0308('0x0'));var LocalStrategy=require(_0x0308('0x1'))[_0x0308('0x2')];var moment=require(_0x0308('0x3'));var ActiveDirectory=require(_0x0308('0x4'));var BPromise=require(_0x0308('0x5'));var util=require(_0x0308('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x0308('0x7'));var utils=require(_0x0308('0x8'));var config=require(_0x0308('0x9'));var logger=require(_0x0308('0xa'))(_0x0308('0xb'));function isActiveDirectoryConfigured(_0x4f76d6){var _0x6d4883=![];if(typeof _0x4f76d6[_0x0308('0xc')]!==_0x0308('0xd')){_0x6d4883=_0x4f76d6[_0x0308('0xc')][_0x0308('0xe')]&&_0x4f76d6['activedirectory']['url']&&_0x4f76d6['activedirectory'][_0x0308('0xf')];}return _0x6d4883;}function adAuthenticate(_0x43a856,_0x878f6f,_0x67ae4b){return new BPromise(function(_0x1e830d,_0x2ffe99){try{var _0x4058a9=new ActiveDirectory(_0x43a856);_0x4058a9[_0x0308('0x10')](_0x878f6f,_0x67ae4b,function(_0x1ec015,_0x447b80){if(_0x1ec015){logger[_0x0308('0x11')](_0x0308('0x12'),_0x878f6f,util[_0x0308('0x13')](_0x1ec015,{'showHidden':![],'depth':null}));_0x2ffe99(_0x0308('0x14'));}else if(!_0x447b80){logger['error'](_0x0308('0x15'),_0x878f6f);_0x2ffe99(_0x0308('0x14'));}else{_0x1e830d(_0x447b80);}});}catch(_0xd6eac5){_0x2ffe99(_0xd6eac5);}});}function ActiveDirectoryAuthenticate(_0x1cc181,_0x4d9716,_0x18529d,_0x4d0424){var _0x5437b4,_0x37bf2c;if(!isActiveDirectoryConfigured(config)){logger[_0x0308('0x11')](_0x0308('0x16'),_0x4d9716);return _0x4d0424(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x0308('0x17')]['findOne']({'where':{'id':0x1},'attributes':[_0x0308('0x18'),'blockDuration'],'raw':!![]})[_0x0308('0x19')](function(_0x423155){_0x5437b4=_0x423155;if(!_0x5437b4[_0x0308('0x18')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x4d9716);throw new Error(_0x0308('0x14'));}return _0x1cc181[_0x0308('0x1a')]({'attributes':['id',_0x0308('0x1b'),_0x0308('0x1c'),_0x0308('0x1d'),_0x0308('0x1e'),_0x0308('0x1f'),'blocked',_0x0308('0x20'),'online'],'where':{'name':_0x4d9716,'role':{'$or':[_0x0308('0x21'),_0x0308('0x22'),_0x0308('0x23')]},'adSsoEnabled':!![]}});})[_0x0308('0x19')](function(_0x2a6aeb){if(!_0x2a6aeb||_0x2a6aeb&&_0x2a6aeb['name']!==_0x4d9716){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x37bf2c=_0x2a6aeb;var _0x3d11ab=_0x37bf2c[_0x0308('0x1b')]+'@'+config[_0x0308('0xc')][_0x0308('0xf')];return adAuthenticate(config['activedirectory'],_0x3d11ab,_0x18529d);})[_0x0308('0x19')](function(_0x52061a){if(_0x37bf2c[_0x0308('0x1f')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x5437b4[_0x0308('0x24')]>0x0){if(_0x37bf2c['blocked']){if(moment(_0x37bf2c[_0x0308('0x20')])[_0x0308('0x25')](_0x5437b4[_0x0308('0x24')],_0x0308('0x26'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x37bf2c,0x0,![],null)[_0x0308('0x19')](function(){return utils[_0x0308('0x27')](_0x37bf2c);})['then'](function(){return _0x4d0424(null,_0x37bf2c);});}else{return utils[_0x0308('0x27')](_0x37bf2c)[_0x0308('0x19')](function(){return _0x4d0424(null,_0x37bf2c);});}}else{return utils['getLicense'](_0x37bf2c)[_0x0308('0x19')](function(){return _0x4d0424(null,_0x37bf2c);});}})[_0x0308('0x28')](function(_0x2d2d47){return _0x4d0424(null,![],_0x2d2d47);});}function handleError(_0x592fc8,_0x304ab,_0x49b651){return _0x592fc8[_0x0308('0x29')](_0x304ab||0x1f4)['send']({'message':_0x49b651?_0x49b651['message']||_0x49b651:''});}exports[_0x0308('0x2a')]=function(_0x5d7d84,_0x41ebd5,_0x2b80eb){passport[_0x0308('0x10')](_0x0308('0x2b'),function(_0x56407b,_0x150b77,_0x42b2e6){var _0x37d4f6=_0x56407b||_0x42b2e6;if(_0x37d4f6){return handleError(_0x41ebd5,0x191,_0x37d4f6);}if(!_0x150b77){return handleError(_0x41ebd5,0x194,{'message':_0x0308('0x2c')});}else{var _0x1d8dc7={'payload':{'id':_0x150b77['id'],'role':_0x150b77[_0x0308('0x1e')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1d8dc7)['then'](function(_0x5722cb){_0x41ebd5[_0x0308('0x2d')]({'id':_0x150b77['id'],'token':_0x5722cb,'statusCall':'','isAlreadyLogged':_0x150b77[_0x0308('0x2e')]});});}})(_0x5d7d84,_0x41ebd5,_0x2b80eb);};passport['use'](_0x0308('0x2b'),new LocalStrategy({'usernameField':_0x0308('0x1b'),'passwordField':_0x0308('0x1c')},function(_0x5d63e2,_0x5a7ad3,_0x2c9175){return ActiveDirectoryAuthenticate(db[_0x0308('0x2f')],_0x5d63e2,_0x5a7ad3,_0x2c9175);})); \ No newline at end of file +var _0x4783=['error','Error\x20authenticate\x20%s:\x20%s','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','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','blockedAt','online','admin','user','agent','then','domain','add','minutes','clearBlockUser','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','User','passport','passport-local','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN','url','authenticate'];(function(_0xf4ba12,_0x22b7ae){var _0x49886a=function(_0xe5cb20){while(--_0xe5cb20){_0xf4ba12['push'](_0xf4ba12['shift']());}};_0x49886a(++_0x22b7ae);}(_0x4783,0xbe));var _0x3478=function(_0xd983d1,_0x59cc82){_0xd983d1=_0xd983d1-0x0;var _0x21c435=_0x4783[_0xd983d1];return _0x21c435;};'use strict';var passport=require(_0x3478('0x0'));var LocalStrategy=require(_0x3478('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0x3478('0x2'));var BPromise=require(_0x3478('0x3'));var util=require('util');var db=require(_0x3478('0x4'))['db'];var authService=require(_0x3478('0x5'));var utils=require(_0x3478('0x6'));var config=require('../../config/environment');var logger=require(_0x3478('0x7'))(_0x3478('0x8'));function isActiveDirectoryConfigured(_0x1225b8){var _0x37445c=![];if(typeof _0x1225b8[_0x3478('0x9')]!==_0x3478('0xa')){_0x37445c=_0x1225b8['activedirectory'][_0x3478('0xb')]&&_0x1225b8[_0x3478('0x9')][_0x3478('0xc')]&&_0x1225b8[_0x3478('0x9')]['domain'];}return _0x37445c;}function adAuthenticate(_0x416cb8,_0x265da1,_0x5a0e9d){return new BPromise(function(_0x4e860a,_0x1e60cc){try{var _0x350d3a=new ActiveDirectory(_0x416cb8);_0x350d3a[_0x3478('0xd')](_0x265da1,_0x5a0e9d,function(_0x1c08cb,_0x5a7332){if(_0x1c08cb){logger[_0x3478('0xe')](_0x3478('0xf'),_0x265da1,util['inspect'](_0x1c08cb,{'showHidden':![],'depth':null}));_0x1e60cc(_0x3478('0x10'));}else if(!_0x5a7332){logger[_0x3478('0xe')](_0x3478('0x11'),_0x265da1);_0x1e60cc(_0x3478('0x10'));}else{_0x4e860a(_0x5a7332);}});}catch(_0x5b301c){_0x1e60cc(_0x5b301c);}});}function ActiveDirectoryAuthenticate(_0x33a280,_0xbf2b01,_0x39109b,_0xb1866f){var _0x1204be,_0x2e937b;if(!isActiveDirectoryConfigured(config)){logger[_0x3478('0xe')](_0x3478('0x12'),_0xbf2b01);return _0xb1866f(null,![],{'message':_0x3478('0x10')});}return db[_0x3478('0x13')][_0x3478('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x3478('0x15')],'raw':!![]})['then'](function(_0x394079){_0x1204be=_0x394079;if(!_0x1204be[_0x3478('0x16')]){logger[_0x3478('0xe')](_0x3478('0x17'),_0xbf2b01);throw new Error(_0x3478('0x10'));}return _0x33a280[_0x3478('0x14')]({'attributes':['id',_0x3478('0x18'),_0x3478('0x19'),_0x3478('0x1a'),'role',_0x3478('0x1b'),_0x3478('0x1c'),_0x3478('0x1d'),_0x3478('0x1e')],'where':{'name':_0xbf2b01,'role':{'$or':[_0x3478('0x1f'),_0x3478('0x20'),_0x3478('0x21')]},'adSsoEnabled':!![]}});})[_0x3478('0x22')](function(_0x3248e6){if(!_0x3248e6||_0x3248e6&&_0x3248e6[_0x3478('0x18')]!==_0xbf2b01){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2e937b=_0x3248e6;var _0x3f6565=_0x2e937b[_0x3478('0x18')]+'@'+config[_0x3478('0x9')][_0x3478('0x23')];return adAuthenticate(config[_0x3478('0x9')],_0x3f6565,_0x39109b);})[_0x3478('0x22')](function(_0x53cc48){if(_0x2e937b[_0x3478('0x1b')]){throw new Error(_0x3478('0x10'));}if(_0x1204be[_0x3478('0x15')]>0x0){if(_0x2e937b['blocked']){if(moment(_0x2e937b[_0x3478('0x1d')])[_0x3478('0x24')](_0x1204be['blockDuration'],_0x3478('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x3478('0x26')](_0x2e937b,0x0,![],null)[_0x3478('0x22')](function(){return utils['getLicense'](_0x2e937b);})[_0x3478('0x22')](function(){return _0xb1866f(null,_0x2e937b);});}else{return utils[_0x3478('0x27')](_0x2e937b)[_0x3478('0x22')](function(){return _0xb1866f(null,_0x2e937b);});}}else{return utils['getLicense'](_0x2e937b)[_0x3478('0x22')](function(){return _0xb1866f(null,_0x2e937b);});}})[_0x3478('0x28')](function(_0x59ad52){return _0xb1866f(null,![],_0x59ad52);});}function handleError(_0x56134e,_0x530ed4,_0x277cbc){return _0x56134e['status'](_0x530ed4||0x1f4)[_0x3478('0x29')]({'message':_0x277cbc?_0x277cbc[_0x3478('0x2a')]||_0x277cbc:''});}exports[_0x3478('0x2b')]=function(_0x50e4df,_0x5e76cd,_0x1b8d69){passport[_0x3478('0xd')](_0x3478('0x2c'),function(_0x4875ef,_0x105459,_0x1a473a){var _0x1f0a6a=_0x4875ef||_0x1a473a;if(_0x1f0a6a){return handleError(_0x5e76cd,0x191,_0x1f0a6a);}if(!_0x105459){return handleError(_0x5e76cd,0x194,{'message':_0x3478('0x2d')});}else{var _0x2f7fff={'payload':{'id':_0x105459['id'],'role':_0x105459[_0x3478('0x2e')]},'options':{'expiresIn':0x15180}};return authService[_0x3478('0x2f')](_0x2f7fff)['then'](function(_0xf432ca){_0x5e76cd[_0x3478('0x30')]({'id':_0x105459['id'],'token':_0xf432ca,'statusCall':'','isAlreadyLogged':_0x105459['online']});});}})(_0x50e4df,_0x5e76cd,_0x1b8d69);};passport[_0x3478('0x31')](_0x3478('0x2c'),new LocalStrategy({'usernameField':_0x3478('0x18'),'passwordField':'password'},function(_0x46d738,_0x35e6cc,_0x4afd8f){return ActiveDirectoryAuthenticate(db[_0x3478('0x32')],_0x46d738,_0x35e6cc,_0x4afd8f);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index f53a133..b889c30 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 _0xd46d=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x3aa302,_0x624b3){var _0x2e9fc1=function(_0x19c381){while(--_0x19c381){_0x3aa302['push'](_0x3aa302['shift']());}};_0x2e9fc1(++_0x624b3);}(_0xd46d,0x130));var _0xdd46=function(_0x3b26e7,_0x4b3fb7){_0x3b26e7=_0x3b26e7-0x0;var _0x48b03c=_0xd46d[_0x3b26e7];return _0x48b03c;};'use strict';var express=require(_0xdd46('0x0'));var router=express[_0xdd46('0x1')]();var controller=require(_0xdd46('0x2'));router[_0xdd46('0x3')]('/',controller[_0xdd46('0x4')]);module[_0xdd46('0x5')]=router; \ No newline at end of file +var _0x29f8=['express','Router','./authActiveDirectory.controller','exports'];(function(_0x41d986,_0x194166){var _0x29a975=function(_0x4dbcb1){while(--_0x4dbcb1){_0x41d986['push'](_0x41d986['shift']());}};_0x29a975(++_0x194166);}(_0x29f8,0xd0));var _0x829f=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x29f8[_0x4dbaad];return _0x226c72;};'use strict';var express=require(_0x829f('0x0'));var router=express[_0x829f('0x1')]();var controller=require(_0x829f('0x2'));router['post']('/',controller['login']);module[_0x829f('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d0b8f2d..313c909 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(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x7a54,0x106));var _0x47a5=function(_0x26dfba,_0x20d240){_0x26dfba=_0x26dfba-0x0;var _0xa59164=_0x7a54[_0x26dfba];return _0xa59164;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x504c8e,_0xc12a61){var _0x12180c=function(_0x4d8f5c){while(--_0x4d8f5c){_0x504c8e['push'](_0x504c8e['shift']());}};_0x12180c(++_0xc12a61);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 3fda30e..57d6617 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 _0x3dc2=['passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','express'];(function(_0x4fc8dd,_0x44239a){var _0xfa6052=function(_0x199dff){while(--_0x199dff){_0x4fc8dd['push'](_0x4fc8dd['shift']());}};_0xfa6052(++_0x44239a);}(_0x3dc2,0x1d5));var _0x23dc=function(_0x4cc244,_0x2662d8){_0x4cc244=_0x4cc244-0x0;var _0x5c7315=_0x3dc2[_0x4cc244];return _0x5c7315;};'use strict';var express=require(_0x23dc('0x0'));var passport=require(_0x23dc('0x1'));var router=express['Router']();var controller=require(_0x23dc('0x2'));var userController=require(_0x23dc('0x3'));var authService=require(_0x23dc('0x4'));router[_0x23dc('0x5')]('/',controller[_0x23dc('0x6')]);router[_0x23dc('0x5')](_0x23dc('0x7'),controller[_0x23dc('0x8')],authService[_0x23dc('0x9')],userController[_0x23dc('0x6')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x3212=['get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x3212,0x6f));var _0x2321=function(_0x1cd63b,_0x5ea58e){_0x1cd63b=_0x1cd63b-0x0;var _0x22631=_0x3212[_0x1cd63b];return _0x22631;};'use strict';var express=require(_0x2321('0x0'));var passport=require(_0x2321('0x1'));var router=express[_0x2321('0x2')]();var controller=require(_0x2321('0x3'));var userController=require(_0x2321('0x4'));var authService=require(_0x2321('0x5'));router[_0x2321('0x6')]('/',controller[_0x2321('0x7')]);router[_0x2321('0x6')](_0x2321('0x8'),controller[_0x2321('0x9')],authService[_0x2321('0xa')],userController['login'],authService[_0x2321('0xb')]);module[_0x2321('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0245ca2..a35d6cb 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 _0x77d2=['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://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','password','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','format','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x42f247,_0x5bbeca){var _0x411317=function(_0x240bd6){while(--_0x240bd6){_0x42f247['push'](_0x42f247['shift']());}};_0x411317(++_0x5bbeca);}(_0x77d2,0x1de));var _0x277d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x77d2[_0x27af45];return _0x18df21;};'use strict';var util=require(_0x277d('0x0'));var passport=require('passport');var LocalStrategy=require(_0x277d('0x1'))[_0x277d('0x2')];var jayson=require(_0x277d('0x3'));var _=require(_0x277d('0x4'));var rs=require('randomstring');var moment=require(_0x277d('0x5'));var db=require(_0x277d('0x6'))['db'];var authService=require(_0x277d('0x7'));var utils=require('../../config/utils');var client=jayson['client'][_0x277d('0x8')]({'port':0x232b});function localAuthenticate(_0x1bde23,_0x6924df,_0x2fcf0b,_0x10f0f1){var _0x3967b7,_0x4bab89;return db[_0x277d('0x9')][_0x277d('0xa')]({'where':{'id':0x1},'attributes':[_0x277d('0xb'),_0x277d('0xc')],'raw':!![]})[_0x277d('0xd')](function(_0x50099e){_0x3967b7=_0x50099e;return _0x1bde23[_0x277d('0xa')]({'attributes':['id',_0x277d('0xe'),'password','salt','role',_0x277d('0xf'),_0x277d('0x10'),_0x277d('0x11'),_0x277d('0x12')],'where':{'name':_0x6924df,'role':{'$or':[_0x277d('0x13'),_0x277d('0x14'),'agent']}}});})[_0x277d('0xd')](function(_0x336486){if(!_0x336486||_0x336486&&_0x336486[_0x277d('0xe')]!==_0x6924df){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4bab89=_0x336486;return _0x4bab89;}})[_0x277d('0xd')](function(){_0x4bab89['authenticate'](_0x2fcf0b,function(_0x36cbb2,_0x91c98f){var _0xd0ab76=_0x4bab89[_0x277d('0x12')]+0x1;if(_0x36cbb2){return _0x10f0f1(_0x36cbb2);}else if(!_0x91c98f){if(_0x4bab89[_0x277d('0xf')]){return _0x10f0f1(null,![],{'message':_0x277d('0x15')});}else if(_0x3967b7['allowedLoginAttempts']>0x0){if(_0x4bab89[_0x277d('0x10')]){if(_0x3967b7[_0x277d('0xc')]>0x0){if(moment(_0x4bab89[_0x277d('0x11')])[_0x277d('0x16')](_0x3967b7[_0x277d('0xc')],_0x277d('0x17'))>moment()){return _0x10f0f1(null,![],{'message':_0x277d('0x15')});}else{return utils[_0x277d('0x18')](_0x4bab89,_0xd0ab76,![],null)[_0x277d('0xd')](function(){return _0x10f0f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x10f0f1(null,![],{'message':_0x277d('0x15')});}}else{if(_0xd0ab76>=_0x3967b7[_0x277d('0xb')]){return utils['clearBlockUser'](_0x4bab89,0x0,!![],moment())['then'](function(){return _0x10f0f1(null,![],{'message':_0x277d('0x15')});});}else{return utils[_0x277d('0x18')](_0x4bab89,_0xd0ab76,![],null)['then'](function(){return _0x10f0f1(null,![],{'message':_0x277d('0x15')});});}}}else{return _0x10f0f1(null,![],{'message':_0x277d('0x15')});}}else{if(_0x4bab89['disabled']){return _0x10f0f1(null,![],{'message':_0x277d('0x15')});}else if(_0x3967b7['allowedLoginAttempts']>0x0){if(_0x4bab89[_0x277d('0x10')]){if(_0x3967b7[_0x277d('0xc')]>0x0){if(moment(_0x4bab89[_0x277d('0x11')])[_0x277d('0x16')](_0x3967b7[_0x277d('0xc')],_0x277d('0x17'))>moment()){return _0x10f0f1(null,![],{'message':_0x277d('0x15')});}else{return utils[_0x277d('0x18')](_0x4bab89,0x0,![],null)[_0x277d('0xd')](function(){return utils[_0x277d('0x19')](_0x4bab89);})['then'](function(){return _0x10f0f1(null,_0x4bab89);});}}else{return _0x10f0f1(null,![],{'message':_0x277d('0x15')});}}else{return utils[_0x277d('0x18')](_0x4bab89,0x0,![],null)[_0x277d('0xd')](function(){return utils[_0x277d('0x19')](_0x4bab89);})[_0x277d('0xd')](function(){return _0x10f0f1(null,_0x4bab89);})['catch'](function(_0x2b24ac){return _0x10f0f1(null,![],_0x2b24ac);});}}else{if(_0x4bab89[_0x277d('0x10')]){return _0x10f0f1(null,![],{'message':_0x277d('0x15')});}else{return utils['getLicense'](_0x4bab89)[_0x277d('0xd')](function(){return _0x10f0f1(null,_0x4bab89);});}}}});})[_0x277d('0x1a')](function(_0x2d5d0d){return _0x10f0f1(null,![],_0x2d5d0d);});}function sendServiceMail(_0x164e4e){return db[_0x277d('0x1b')][_0x277d('0x1c')]({'where':{'service':!![]},'attributes':['id','name',_0x277d('0x1d')],'include':[{'model':db[_0x277d('0x1e')],'as':_0x277d('0x1f'),'include':[{'model':db[_0x277d('0x20')],'as':_0x277d('0x20')}]}]})[_0x277d('0xd')](function(_0x5c4acd){if(!_0x5c4acd){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x48d4ea=_0x5c4acd[_0x277d('0x21')]();var _0x23570c={'account':_0x48d4ea,'message':_['merge']({'from':util[_0x277d('0x22')]('\x22%s\x22\x20<%s>',_0x5c4acd['name'],_0x5c4acd[_0x277d('0x1d')]||_0x5c4acd[_0x277d('0x1f')][_0x277d('0x14')])},_0x164e4e)};return client['request'](_0x277d('0x23'),_0x23570c);})[_0x277d('0xd')](function(_0x2b7fd8){if(_0x2b7fd8[_0x277d('0x24')]){throw new Error(util[_0x277d('0x22')](_0x277d('0x25'),_0x2b7fd8[_0x277d('0x24')]['message']||JSON['stringify'](_0x2b7fd8[_0x277d('0x24')])));}return!![];});}function handleError(_0x1eebe4,_0x491e95,_0x2c6218){return _0x1eebe4['status'](_0x491e95||0x1f4)['send']({'message':_0x2c6218?_0x2c6218[_0x277d('0x26')]||_0x2c6218:''});}exports[_0x277d('0x27')]=function(_0x253641,_0x57b000,_0x4fe75c){passport[_0x277d('0x28')](_0x277d('0x29'),function(_0xf991c7,_0x5a0fc7,_0xcb166d){var _0x522fa5=_0xf991c7||_0xcb166d;if(_0x522fa5){return handleError(_0x57b000,0x191,_0x522fa5);}if(!_0x5a0fc7){return handleError(_0x57b000,0x194,{'message':_0x277d('0x2a')});}else{var _0x31a751={'payload':{'id':_0x5a0fc7['id'],'role':_0x5a0fc7[_0x277d('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0x277d('0x2c')](_0x31a751)['then'](function(_0x5aac48){_0x57b000[_0x277d('0x2d')]({'id':_0x5a0fc7['id'],'token':_0x5aac48,'statusCall':'','isAlreadyLogged':_0x5a0fc7['online']});});}})(_0x253641,_0x57b000,_0x4fe75c);};exports[_0x277d('0x2e')]=function(_0x34bd7a,_0x47cb4b){if(!_0x34bd7a['body'][_0x277d('0x1d')]){return handleError(_0x47cb4b,0x1f4,{'message':_0x277d('0x2f')});}var _0x3235a8=rs[_0x277d('0x30')]();_0x34bd7a[_0x277d('0x31')][_0x277d('0x1d')]=_0x34bd7a[_0x277d('0x31')][_0x277d('0x1d')][_0x277d('0x32')]()['toLowerCase']();var _0x30d336;return db[_0x277d('0x9')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x277d('0xc')],'raw':!![]})[_0x277d('0xd')](function(_0x1e6e19){_0x30d336=_0x1e6e19;return db[_0x277d('0x33')][_0x277d('0x1c')]({'where':{'email':_0x34bd7a[_0x277d('0x31')][_0x277d('0x1d')]}});})[_0x277d('0xd')](function(_0x29b72e){if(!_0x29b72e){throw new Error(_0x277d('0x34'));}if(_0x29b72e[_0x277d('0xf')]){throw new Error(_0x277d('0x35'));}if(_0x29b72e[_0x277d('0x10')]){if(moment(_0x29b72e[_0x277d('0x11')])[_0x277d('0x16')](_0x30d336[_0x277d('0xc')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x29b72e[_0x277d('0x10')]=![];_0x29b72e['blockedAt']=null;}}_0x29b72e['resetPasswordToken']=_0x3235a8;_0x29b72e['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x29b72e[_0x277d('0x36')]();})[_0x277d('0xd')](function(){return sendServiceMail({'to':_0x34bd7a[_0x277d('0x31')]['email'],'subject':_0x277d('0x37'),'text':_0x277d('0x38')+_0x277d('0x39')+_0x277d('0x3a')+_0x34bd7a['headers']['host']+'/reset/'+_0x3235a8+'\x0a\x0a'+_0x277d('0x3b')});})[_0x277d('0xd')](function(){_0x47cb4b[_0x277d('0x3c')](0xc8)[_0x277d('0x3d')]({'message':'Reset\x20Email\x20sent!'});})[_0x277d('0x1a')](function(_0x3b44a7){return handleError(_0x47cb4b,0x1f4,_0x3b44a7);});};exports['reset']=function(_0x4cd41b,_0x3e4f09){return db['User'][_0x277d('0x1c')]({'where':{'resetPasswordToken':_0x4cd41b[_0x277d('0x3e')][_0x277d('0x3f')],'resetPasswordExpires':{'$gt':Date[_0x277d('0x40')]()}}})[_0x277d('0xd')](function(_0x19f368){if(!_0x19f368){throw new Error(_0x277d('0x41'));}return db['Setting'][_0x277d('0xa')]({'attributes':['id',_0x277d('0x42'),'enforcePasswordHistory',_0x277d('0x43')]})[_0x277d('0xd')](function(_0x187c69){if(_0x187c69['securePassword'])authService['validatePasswordPattern'](_0x4cd41b[_0x277d('0x31')]['password']);if(!_0x187c69[_0x277d('0x44')]||!_0x19f368[_0x277d('0x45')])return _0x19f368;authService[_0x277d('0x46')](_0x4cd41b[_0x277d('0x31')][_0x277d('0x47')],_0x19f368['previousPasswords'],_0x187c69[_0x277d('0x43')]);return _0x19f368;})[_0x277d('0xd')](function(){_0x19f368[_0x277d('0x47')]=_0x4cd41b[_0x277d('0x31')][_0x277d('0x47')];_0x19f368[_0x277d('0x48')]=null;_0x19f368[_0x277d('0x49')]=null;return _0x19f368['save']();});})['then'](function(){_0x3e4f09[_0x277d('0x3c')](0xc8)['send']({'message':_0x277d('0x4a')});})['catch'](function(_0x1f2cb3){return handleError(_0x3e4f09,0x1f4,_0x1f2cb3);});};passport[_0x277d('0x4b')]('local-login',new LocalStrategy({'usernameField':_0x277d('0xe'),'passwordField':_0x277d('0x47')},function(_0x256835,_0x37468c,_0x503e12){return localAuthenticate(db['User'],_0x256835,_0x37468c,_0x503e12);})); \ No newline at end of file +var _0xb4be=['Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','save','use','local-login','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','client','http','Setting','findOne','blockDuration','then','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','CloudProvider'];(function(_0x1e403a,_0x47abde){var _0x583989=function(_0x4fdd54){while(--_0x4fdd54){_0x1e403a['push'](_0x1e403a['shift']());}};_0x583989(++_0x47abde);}(_0xb4be,0x11a));var _0xeb4b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4be[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xeb4b('0x0'));var passport=require(_0xeb4b('0x1'));var LocalStrategy=require(_0xeb4b('0x2'))[_0xeb4b('0x3')];var jayson=require(_0xeb4b('0x4'));var _=require(_0xeb4b('0x5'));var rs=require(_0xeb4b('0x6'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xeb4b('0x7')][_0xeb4b('0x8')]({'port':0x232b});function localAuthenticate(_0x58b48a,_0xf876a6,_0x3cefdf,_0x3d9590){var _0x2e15e9,_0x313958;return db[_0xeb4b('0x9')][_0xeb4b('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xeb4b('0xb')],'raw':!![]})[_0xeb4b('0xc')](function(_0x3997ca){_0x2e15e9=_0x3997ca;return _0x58b48a['findOne']({'attributes':['id',_0xeb4b('0xd'),_0xeb4b('0xe'),_0xeb4b('0xf'),_0xeb4b('0x10'),_0xeb4b('0x11'),_0xeb4b('0x12'),'blockedAt',_0xeb4b('0x13')],'where':{'name':_0xf876a6,'role':{'$or':[_0xeb4b('0x14'),_0xeb4b('0x15'),'agent']}}});})['then'](function(_0x236b20){if(!_0x236b20||_0x236b20&&_0x236b20[_0xeb4b('0xd')]!==_0xf876a6){throw new Error(_0xeb4b('0x16'));}else{_0x313958=_0x236b20;return _0x313958;}})['then'](function(){_0x313958['authenticate'](_0x3cefdf,function(_0x488276,_0x307999){var _0x24ab07=_0x313958[_0xeb4b('0x13')]+0x1;if(_0x488276){return _0x3d9590(_0x488276);}else if(!_0x307999){if(_0x313958[_0xeb4b('0x11')]){return _0x3d9590(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2e15e9[_0xeb4b('0x17')]>0x0){if(_0x313958[_0xeb4b('0x12')]){if(_0x2e15e9[_0xeb4b('0xb')]>0x0){if(moment(_0x313958[_0xeb4b('0x18')])[_0xeb4b('0x19')](_0x2e15e9['blockDuration'],_0xeb4b('0x1a'))>moment()){return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});}else{return utils[_0xeb4b('0x1b')](_0x313958,_0x24ab07,![],null)[_0xeb4b('0xc')](function(){return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});});}}else{return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});}}else{if(_0x24ab07>=_0x2e15e9[_0xeb4b('0x17')]){return utils[_0xeb4b('0x1b')](_0x313958,0x0,!![],moment())['then'](function(){return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});});}else{return utils[_0xeb4b('0x1b')](_0x313958,_0x24ab07,![],null)[_0xeb4b('0xc')](function(){return _0x3d9590(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});}}else{if(_0x313958['disabled']){return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});}else if(_0x2e15e9['allowedLoginAttempts']>0x0){if(_0x313958[_0xeb4b('0x12')]){if(_0x2e15e9[_0xeb4b('0xb')]>0x0){if(moment(_0x313958[_0xeb4b('0x18')])[_0xeb4b('0x19')](_0x2e15e9[_0xeb4b('0xb')],_0xeb4b('0x1a'))>moment()){return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});}else{return utils[_0xeb4b('0x1b')](_0x313958,0x0,![],null)[_0xeb4b('0xc')](function(){return utils['getLicense'](_0x313958);})['then'](function(){return _0x3d9590(null,_0x313958);});}}else{return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});}}else{return utils['clearBlockUser'](_0x313958,0x0,![],null)[_0xeb4b('0xc')](function(){return utils[_0xeb4b('0x1c')](_0x313958);})[_0xeb4b('0xc')](function(){return _0x3d9590(null,_0x313958);})[_0xeb4b('0x1d')](function(_0x57fdf8){return _0x3d9590(null,![],_0x57fdf8);});}}else{if(_0x313958[_0xeb4b('0x12')]){return _0x3d9590(null,![],{'message':_0xeb4b('0x16')});}else{return utils[_0xeb4b('0x1c')](_0x313958)[_0xeb4b('0xc')](function(){return _0x3d9590(null,_0x313958);});}}}});})[_0xeb4b('0x1d')](function(_0x3f0a7f){return _0x3d9590(null,![],_0x3f0a7f);});}function sendServiceMail(_0x3400cd){return db['MailAccount'][_0xeb4b('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xeb4b('0xd'),_0xeb4b('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0xeb4b('0x20'),'include':[{'model':db['CloudProvider'],'as':_0xeb4b('0x21')}]}]})[_0xeb4b('0xc')](function(_0x5383cd){if(!_0x5383cd){throw new Error(_0xeb4b('0x22'));}var _0x414cb2=_0x5383cd[_0xeb4b('0x23')]();var _0x3033a7={'account':_0x414cb2,'message':_[_0xeb4b('0x24')]({'from':util[_0xeb4b('0x25')](_0xeb4b('0x26'),_0x5383cd[_0xeb4b('0xd')],_0x5383cd[_0xeb4b('0x1f')]||_0x5383cd['Smtp'][_0xeb4b('0x15')])},_0x3400cd)};return client[_0xeb4b('0x27')]('SendMail',_0x3033a7);})[_0xeb4b('0xc')](function(_0x2e0e86){if(_0x2e0e86[_0xeb4b('0x28')]){throw new Error(util['format'](_0xeb4b('0x29'),_0x2e0e86[_0xeb4b('0x28')][_0xeb4b('0x2a')]||JSON['stringify'](_0x2e0e86[_0xeb4b('0x28')])));}return!![];});}function handleError(_0x2a2564,_0x39d101,_0x4f994b){return _0x2a2564[_0xeb4b('0x2b')](_0x39d101||0x1f4)[_0xeb4b('0x2c')]({'message':_0x4f994b?_0x4f994b['message']||_0x4f994b:''});}exports['login']=function(_0x4fa36c,_0x413e26,_0x162d9b){passport['authenticate']('local-login',function(_0x4ecaca,_0x540a12,_0x46f365){var _0x3963e0=_0x4ecaca||_0x46f365;if(_0x3963e0){return handleError(_0x413e26,0x191,_0x3963e0);}if(!_0x540a12){return handleError(_0x413e26,0x194,{'message':_0xeb4b('0x2d')});}else{var _0x3c7b6d={'payload':{'id':_0x540a12['id'],'role':_0x540a12['role']},'options':{'expiresIn':0x15180}};return authService[_0xeb4b('0x2e')](_0x3c7b6d)['then'](function(_0x1e3679){_0x413e26[_0xeb4b('0x2f')]({'id':_0x540a12['id'],'token':_0x1e3679,'statusCall':'','isAlreadyLogged':_0x540a12['online']});});}})(_0x4fa36c,_0x413e26,_0x162d9b);};exports['forgot']=function(_0x3cdb46,_0x40f528){if(!_0x3cdb46[_0xeb4b('0x30')][_0xeb4b('0x1f')]){return handleError(_0x40f528,0x1f4,{'message':_0xeb4b('0x31')});}var _0x57a217=rs[_0xeb4b('0x32')]();_0x3cdb46[_0xeb4b('0x30')][_0xeb4b('0x1f')]=_0x3cdb46[_0xeb4b('0x30')]['email'][_0xeb4b('0x33')]()[_0xeb4b('0x34')]();var _0x4416cf;return db[_0xeb4b('0x9')][_0xeb4b('0xa')]({'where':{'id':0x1},'attributes':[_0xeb4b('0x17'),_0xeb4b('0xb')],'raw':!![]})['then'](function(_0x13cec5){_0x4416cf=_0x13cec5;return db[_0xeb4b('0x35')]['find']({'where':{'email':_0x3cdb46['body'][_0xeb4b('0x1f')]}});})['then'](function(_0x32e4bf){if(!_0x32e4bf){throw new Error(_0xeb4b('0x36'));}if(_0x32e4bf[_0xeb4b('0x11')]){throw new Error(_0xeb4b('0x37'));}if(_0x32e4bf['blocked']){if(moment(_0x32e4bf['blockedAt'])[_0xeb4b('0x19')](_0x4416cf[_0xeb4b('0xb')],'minutes')>moment()){throw new Error(_0xeb4b('0x38'));}else{_0x32e4bf[_0xeb4b('0x12')]=![];_0x32e4bf['blockedAt']=null;}}_0x32e4bf['resetPasswordToken']=_0x57a217;_0x32e4bf[_0xeb4b('0x39')]=Date[_0xeb4b('0x3a')]()+0x36ee80;return _0x32e4bf['save']();})[_0xeb4b('0xc')](function(){return sendServiceMail({'to':_0x3cdb46[_0xeb4b('0x30')]['email'],'subject':_0xeb4b('0x3b'),'text':_0xeb4b('0x3c')+_0xeb4b('0x3d')+'https://'+_0x3cdb46[_0xeb4b('0x3e')][_0xeb4b('0x3f')]+_0xeb4b('0x40')+_0x57a217+'\x0a\x0a'+_0xeb4b('0x41')});})[_0xeb4b('0xc')](function(){_0x40f528[_0xeb4b('0x2b')](0xc8)['send']({'message':_0xeb4b('0x42')});})['catch'](function(_0x589dec){return handleError(_0x40f528,0x1f4,_0x589dec);});};exports['reset']=function(_0x343099,_0x988d13){return db[_0xeb4b('0x35')]['find']({'where':{'resetPasswordToken':_0x343099[_0xeb4b('0x43')][_0xeb4b('0x44')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x4ac6a2){if(!_0x4ac6a2){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xeb4b('0xa')]({'attributes':['id',_0xeb4b('0x45'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xeb4b('0xc')](function(_0x2ca642){if(_0x2ca642['securePassword'])authService[_0xeb4b('0x46')](_0x343099[_0xeb4b('0x30')]['password']);if(!_0x2ca642[_0xeb4b('0x47')]||!_0x4ac6a2[_0xeb4b('0x48')])return _0x4ac6a2;authService[_0xeb4b('0x49')](_0x343099[_0xeb4b('0x30')][_0xeb4b('0xe')],_0x4ac6a2[_0xeb4b('0x48')],_0x2ca642[_0xeb4b('0x4a')]);return _0x4ac6a2;})[_0xeb4b('0xc')](function(){_0x4ac6a2['password']=_0x343099[_0xeb4b('0x30')][_0xeb4b('0xe')];_0x4ac6a2[_0xeb4b('0x4b')]=null;_0x4ac6a2['resetPasswordExpires']=null;return _0x4ac6a2[_0xeb4b('0x4c')]();});})[_0xeb4b('0xc')](function(){_0x988d13[_0xeb4b('0x2b')](0xc8)['send']({'message':'Password\x20reset!'});})['catch'](function(_0x1a04eb){return handleError(_0x988d13,0x1f4,_0x1a04eb);});};passport[_0xeb4b('0x4d')](_0xeb4b('0x4e'),new LocalStrategy({'usernameField':_0xeb4b('0xd'),'passwordField':_0xeb4b('0xe')},function(_0x4caa84,_0x1c5941,_0x2fac87){return localAuthenticate(db['User'],_0x4caa84,_0x1c5941,_0x2fac87);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 9909a07..994fad9 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 _0x2b91=['Router','forgot','reset','exports','express'];(function(_0xb7786,_0x2d1ba9){var _0x24d444=function(_0x4bf5ef){while(--_0x4bf5ef){_0xb7786['push'](_0xb7786['shift']());}};_0x24d444(++_0x2d1ba9);}(_0x2b91,0x103));var _0x12b9=function(_0x3aae41,_0x456e3b){_0x3aae41=_0x3aae41-0x0;var _0x2efa3f=_0x2b91[_0x3aae41];return _0x2efa3f;};'use strict';var express=require(_0x12b9('0x0'));var router=express[_0x12b9('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router['post']('/forgot',controller[_0x12b9('0x2')]);router['post']('/reset/:token',controller[_0x12b9('0x3')]);module[_0x12b9('0x4')]=router; \ No newline at end of file +var _0xee0f=['login','/forgot','/reset/:token','exports','express','Router','post'];(function(_0x48d02f,_0x367e46){var _0x690e62=function(_0x2a6312){while(--_0x2a6312){_0x48d02f['push'](_0x48d02f['shift']());}};_0x690e62(++_0x367e46);}(_0xee0f,0x74));var _0xfee0=function(_0x2b9324,_0x32f260){_0x2b9324=_0x2b9324-0x0;var _0x5063a4=_0xee0f[_0x2b9324];return _0x5063a4;};'use strict';var express=require(_0xfee0('0x0'));var router=express[_0xfee0('0x1')]();var controller=require('./authLocal.controller');router[_0xfee0('0x2')]('/',controller[_0xfee0('0x3')]);router[_0xfee0('0x2')](_0xfee0('0x4'),controller['forgot']);router[_0xfee0('0x2')](_0xfee0('0x5'),controller['reset']);module[_0xfee0('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 8fdff1b..59df6a3 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 _0xe7c4=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xe7c4,0x1e4));var _0x4e7c=function(_0x162538,_0x35e708){_0x162538=_0x162538-0x0;var _0x16e665=_0xe7c4[_0x162538];return _0x16e665;};'use strict';var Sequelize=require(_0x4e7c('0x0'));module[_0x4e7c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x4e7c('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x4e7c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4e7c('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xa80e=['STRING','BOOLEAN','sequelize'];(function(_0x43b1df,_0x2b2126){var _0x369932=function(_0x125a3d){while(--_0x125a3d){_0x43b1df['push'](_0x43b1df['shift']());}};_0x369932(++_0x2b2126);}(_0xa80e,0x188));var _0xea80=function(_0x3d8bee,_0x2fabfc){_0x3d8bee=_0x3d8bee-0x0;var _0x92cb0d=_0xa80e[_0x3d8bee];return _0x92cb0d;};'use strict';var Sequelize=require(_0xea80('0x0'));module['exports']={'name':{'type':Sequelize[_0xea80('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xea80('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xea80('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 0bcbc71..e324b8c 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 _0xd2a4=['offset','count','limit','status','set','Content-Range','json','apply','reject','save','destroy','name','send','index','map','Automation','type','key','model','keys','filters','intersection','query','attributes','fields','length','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','params','rawAttributes','catch','create','body','update','find','addConditions','omit','ids','getConditions','findOne','Condition','order','nolimit','addActions','getActions','Action','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0xd2a4,0x131));var _0x4d2a=function(_0x1bda7d,_0x803618){_0x1bda7d=_0x1bda7d-0x0;var _0x7ebf01=_0xd2a4[_0x1bda7d];return _0x7ebf01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d2a('0x0'));var zipdir=require(_0x4d2a('0x1'));var jsonpatch=require(_0x4d2a('0x2'));var rp=require(_0x4d2a('0x3'));var moment=require(_0x4d2a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4d2a('0x5'));var util=require('util');var path=require(_0x4d2a('0x6'));var sox=require(_0x4d2a('0x7'));var csv=require(_0x4d2a('0x8'));var ejs=require(_0x4d2a('0x9'));var fs=require('fs');var fs_extra=require(_0x4d2a('0xa'));var _=require(_0x4d2a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d2a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d2a('0xd'));var Redis=require(_0x4d2a('0xe'));var authService=require(_0x4d2a('0xf'));var qs=require(_0x4d2a('0x10'));var as=require(_0x4d2a('0x11'));var hardwareService=require(_0x4d2a('0x12'));var logger=require(_0x4d2a('0x13'))('api');var utils=require(_0x4d2a('0x14'));var config=require(_0x4d2a('0x15'));var licenseUtil=require(_0x4d2a('0x16'));var db=require(_0x4d2a('0x17'))['db'];function respondWithStatusCode(_0x1c0aa8,_0x4de3fd){_0x4de3fd=_0x4de3fd||0xcc;return function(_0x1c98b6){if(_0x1c98b6){return _0x1c0aa8[_0x4d2a('0x18')](_0x4de3fd);}return _0x1c0aa8['status'](_0x4de3fd)[_0x4d2a('0x19')]();};}function respondWithResult(_0x2bd21a,_0x4d3c66){_0x4d3c66=_0x4d3c66||0xc8;return function(_0x8d55c2){if(_0x8d55c2){return _0x2bd21a['status'](_0x4d3c66)['json'](_0x8d55c2);}};}function respondWithFilteredResult(_0xa9a4e2,_0x43a8dc){return function(_0x5da917){if(_0x5da917){var _0x2d75da=typeof _0x43a8dc['offset']===_0x4d2a('0x1a')&&typeof _0x43a8dc['limit']===_0x4d2a('0x1a');var _0x11f5f3=_0x5da917['count'];var _0x474500=_0x2d75da?0x0:_0x43a8dc[_0x4d2a('0x1b')];var _0x5eaa6f=_0x2d75da?_0x5da917[_0x4d2a('0x1c')]:_0x43a8dc[_0x4d2a('0x1b')]+_0x43a8dc[_0x4d2a('0x1d')];var _0x3942cc;if(_0x5eaa6f>=_0x11f5f3){_0x5eaa6f=_0x11f5f3;_0x3942cc=0xc8;}else{_0x3942cc=0xce;}_0xa9a4e2[_0x4d2a('0x1e')](_0x3942cc);return _0xa9a4e2[_0x4d2a('0x1f')](_0x4d2a('0x20'),_0x474500+'-'+_0x5eaa6f+'/'+_0x11f5f3)[_0x4d2a('0x21')](_0x5da917);}return null;};}function patchUpdates(_0x382458){return function(_0x133339){try{jsonpatch[_0x4d2a('0x22')](_0x133339,_0x382458,!![]);}catch(_0x438cbd){return BPromise[_0x4d2a('0x23')](_0x438cbd);}return _0x133339[_0x4d2a('0x24')]();};}function saveUpdates(_0x2f89b9,_0x271ac8){return function(_0x3e0830){if(_0x3e0830){return _0x3e0830['update'](_0x2f89b9)['then'](function(_0x390dba){return _0x390dba;});}return null;};}function removeEntity(_0x1fbac0,_0xfc30b8){return function(_0x429233){if(_0x429233){return _0x429233[_0x4d2a('0x25')]()['then'](function(){_0x1fbac0[_0x4d2a('0x1e')](0xcc)[_0x4d2a('0x19')]();});}};}function handleEntityNotFound(_0x695b8,_0x3b09cc){return function(_0x54522e){if(!_0x54522e){_0x695b8['sendStatus'](0x194);}return _0x54522e;};}function handleError(_0x3ad114,_0x518cc0){_0x518cc0=_0x518cc0||0x1f4;return function(_0x1ee354){logger['error'](_0x1ee354['stack']);if(_0x1ee354['name']){delete _0x1ee354[_0x4d2a('0x26')];}_0x3ad114['status'](_0x518cc0)[_0x4d2a('0x27')](_0x1ee354);};}exports[_0x4d2a('0x28')]=function(_0x48975f,_0x1432db){var _0x10fa63={},_0x3ea775={},_0x2b77db={'count':0x0,'rows':[]};var _0x31bead=_[_0x4d2a('0x29')](db[_0x4d2a('0x2a')]['rawAttributes'],function(_0x3b4f76){return{'name':_0x3b4f76['fieldName'],'type':_0x3b4f76[_0x4d2a('0x2b')][_0x4d2a('0x2c')]};});_0x3ea775[_0x4d2a('0x2d')]=_[_0x4d2a('0x29')](_0x31bead,_0x4d2a('0x26'));_0x3ea775['query']=_[_0x4d2a('0x2e')](_0x48975f['query']);_0x3ea775[_0x4d2a('0x2f')]=_[_0x4d2a('0x30')](_0x3ea775['model'],_0x3ea775[_0x4d2a('0x31')]);_0x10fa63[_0x4d2a('0x32')]=_[_0x4d2a('0x30')](_0x3ea775[_0x4d2a('0x2d')],qs['fields'](_0x48975f[_0x4d2a('0x31')][_0x4d2a('0x33')]));_0x10fa63[_0x4d2a('0x32')]=_0x10fa63['attributes'][_0x4d2a('0x34')]?_0x10fa63[_0x4d2a('0x32')]:_0x3ea775['model'];if(!_0x48975f['query']['hasOwnProperty']('nolimit')){_0x10fa63['limit']=qs[_0x4d2a('0x1d')](_0x48975f[_0x4d2a('0x31')][_0x4d2a('0x1d')]);_0x10fa63['offset']=qs[_0x4d2a('0x1b')](_0x48975f[_0x4d2a('0x31')][_0x4d2a('0x1b')]);}_0x10fa63['order']=qs[_0x4d2a('0x35')](_0x48975f[_0x4d2a('0x31')][_0x4d2a('0x35')]);_0x10fa63[_0x4d2a('0x36')]=qs[_0x4d2a('0x2f')](_[_0x4d2a('0x37')](_0x48975f['query'],_0x3ea775[_0x4d2a('0x2f')]),_0x31bead);if(_0x48975f['query'][_0x4d2a('0x38')]){_0x10fa63[_0x4d2a('0x36')]=_[_0x4d2a('0x39')](_0x10fa63[_0x4d2a('0x36')],{'$or':_['map'](_0x31bead,function(_0x2b96a4){if(_0x2b96a4[_0x4d2a('0x2b')]!=='VIRTUAL'){var _0x5636d5={};_0x5636d5[_0x2b96a4['name']]={'$like':'%'+_0x48975f[_0x4d2a('0x31')][_0x4d2a('0x38')]+'%'};return _0x5636d5;}})});}_0x10fa63=_[_0x4d2a('0x39')]({},_0x10fa63,_0x48975f[_0x4d2a('0x3a')]);var _0x2d3e71={'where':_0x10fa63[_0x4d2a('0x36')]};return db[_0x4d2a('0x2a')][_0x4d2a('0x1c')](_0x2d3e71)[_0x4d2a('0x3b')](function(_0x3cea88){_0x2b77db[_0x4d2a('0x1c')]=_0x3cea88;if(_0x48975f[_0x4d2a('0x31')][_0x4d2a('0x3c')]){_0x10fa63[_0x4d2a('0x3d')]=[{'all':!![]}];}return db['Automation'][_0x4d2a('0x3e')](_0x10fa63);})[_0x4d2a('0x3b')](function(_0x204b2e){_0x2b77db[_0x4d2a('0x3f')]=_0x204b2e;return _0x2b77db;})['then'](respondWithFilteredResult(_0x1432db,_0x10fa63))['catch'](handleError(_0x1432db,null));};exports['show']=function(_0x4369f8,_0x4c6f5d){var _0x647ced={'raw':![],'where':{'id':_0x4369f8[_0x4d2a('0x40')]['id']}},_0x450b73={};_0x450b73[_0x4d2a('0x2d')]=_[_0x4d2a('0x2e')](db['Automation'][_0x4d2a('0x41')]);_0x450b73[_0x4d2a('0x31')]=_[_0x4d2a('0x2e')](_0x4369f8[_0x4d2a('0x31')]);_0x450b73[_0x4d2a('0x2f')]=_[_0x4d2a('0x30')](_0x450b73[_0x4d2a('0x2d')],_0x450b73[_0x4d2a('0x31')]);_0x647ced[_0x4d2a('0x32')]=_['intersection'](_0x450b73['model'],qs['fields'](_0x4369f8['query'][_0x4d2a('0x33')]));_0x647ced[_0x4d2a('0x32')]=_0x647ced['attributes'][_0x4d2a('0x34')]?_0x647ced['attributes']:_0x450b73['model'];if(_0x4369f8['query'][_0x4d2a('0x3c')]){_0x647ced[_0x4d2a('0x3d')]=[{'all':!![]}];}_0x647ced=_[_0x4d2a('0x39')]({},_0x647ced,_0x4369f8['options']);return db[_0x4d2a('0x2a')]['find'](_0x647ced)[_0x4d2a('0x3b')](handleEntityNotFound(_0x4c6f5d,null))['then'](respondWithResult(_0x4c6f5d,null))[_0x4d2a('0x42')](handleError(_0x4c6f5d,null));};exports[_0x4d2a('0x43')]=function(_0x45f685,_0x294c49){return db[_0x4d2a('0x2a')]['create'](_0x45f685[_0x4d2a('0x44')],{})['then'](respondWithResult(_0x294c49,0xc9))[_0x4d2a('0x42')](handleError(_0x294c49,null));};exports[_0x4d2a('0x45')]=function(_0x48b72e,_0x10de41){if(_0x48b72e[_0x4d2a('0x44')]['id']){delete _0x48b72e['body']['id'];}return db[_0x4d2a('0x2a')][_0x4d2a('0x46')]({'where':{'id':_0x48b72e[_0x4d2a('0x40')]['id']}})[_0x4d2a('0x3b')](handleEntityNotFound(_0x10de41,null))['then'](saveUpdates(_0x48b72e[_0x4d2a('0x44')],null))[_0x4d2a('0x3b')](respondWithResult(_0x10de41,null))['catch'](handleError(_0x10de41,null));};exports[_0x4d2a('0x25')]=function(_0x4e4064,_0x394da4){return db['Automation']['find']({'where':{'id':_0x4e4064['params']['id']}})[_0x4d2a('0x3b')](handleEntityNotFound(_0x394da4,null))[_0x4d2a('0x3b')](removeEntity(_0x394da4,null))[_0x4d2a('0x42')](handleError(_0x394da4,null));};exports[_0x4d2a('0x47')]=function(_0x4f9649,_0x5b1750,_0x216799){return db['Condition'][_0x4d2a('0x46')]({'where':{'id':_0x4f9649[_0x4d2a('0x40')]['id']}})[_0x4d2a('0x3b')](handleEntityNotFound(_0x5b1750,null))['then'](function(_0x2faffe){if(_0x2faffe){return _0x2faffe['addConditions'](_0x4f9649['body']['ids'],_[_0x4d2a('0x48')](_0x4f9649[_0x4d2a('0x44')],[_0x4d2a('0x49'),'id'])||{});}})[_0x4d2a('0x3b')](respondWithResult(_0x5b1750,null))[_0x4d2a('0x42')](handleError(_0x5b1750,null));};exports[_0x4d2a('0x4a')]=function(_0x26efa5,_0xda873,_0x228574){var _0x12e346={};var _0xe7cbaf={};var _0x1bf131;var _0x3d105b;return db['Automation'][_0x4d2a('0x4b')]({'where':{'id':_0x26efa5['params']['id']}})['then'](handleEntityNotFound(_0xda873,null))[_0x4d2a('0x3b')](function(_0x3fde96){if(_0x3fde96){_0x1bf131=_0x3fde96;_0xe7cbaf['model']=_[_0x4d2a('0x2e')](db[_0x4d2a('0x4c')]['rawAttributes']);_0xe7cbaf[_0x4d2a('0x31')]=_[_0x4d2a('0x2e')](_0x26efa5['query']);_0xe7cbaf[_0x4d2a('0x2f')]=_['intersection'](_0xe7cbaf[_0x4d2a('0x2d')],_0xe7cbaf[_0x4d2a('0x31')]);_0x12e346[_0x4d2a('0x32')]=_['intersection'](_0xe7cbaf[_0x4d2a('0x2d')],qs[_0x4d2a('0x33')](_0x26efa5[_0x4d2a('0x31')][_0x4d2a('0x33')]));_0x12e346[_0x4d2a('0x32')]=_0x12e346['attributes'][_0x4d2a('0x34')]?_0x12e346[_0x4d2a('0x32')]:_0xe7cbaf[_0x4d2a('0x2d')];_0x12e346[_0x4d2a('0x4d')]=qs[_0x4d2a('0x35')](_0x26efa5[_0x4d2a('0x31')]['sort']);_0x12e346[_0x4d2a('0x36')]=qs[_0x4d2a('0x2f')](_['pick'](_0x26efa5[_0x4d2a('0x31')],_0xe7cbaf[_0x4d2a('0x2f')]));if(_0x26efa5['query'][_0x4d2a('0x38')]){_0x12e346[_0x4d2a('0x36')]=_['merge'](_0x12e346['where'],{'$or':_[_0x4d2a('0x29')](_0x12e346['attributes'],function(_0x418fac){var _0x5da157={};_0x5da157[_0x418fac]={'$like':'%'+_0x26efa5['query']['filter']+'%'};return _0x5da157;})});}_0x12e346=_['merge']({},_0x12e346,_0x26efa5[_0x4d2a('0x3a')]);return _0x1bf131['getConditions'](_0x12e346);}})['then'](function(_0x1a3b6b){if(_0x1a3b6b){_0x3d105b=_0x1a3b6b[_0x4d2a('0x34')];if(!_0x26efa5[_0x4d2a('0x31')]['hasOwnProperty'](_0x4d2a('0x4e'))){_0x12e346['limit']=qs[_0x4d2a('0x1d')](_0x26efa5['query'][_0x4d2a('0x1d')]);_0x12e346[_0x4d2a('0x1b')]=qs[_0x4d2a('0x1b')](_0x26efa5[_0x4d2a('0x31')][_0x4d2a('0x1b')]);}return _0x1bf131[_0x4d2a('0x4a')](_0x12e346);}})[_0x4d2a('0x3b')](function(_0x11abea){if(_0x11abea){return _0x11abea?{'count':_0x3d105b,'rows':_0x11abea}:null;}})[_0x4d2a('0x3b')](respondWithResult(_0xda873,null))['catch'](handleError(_0xda873,null));};exports[_0x4d2a('0x4f')]=function(_0x497d0a,_0x3a8220,_0x3dc91d){return db['Action'][_0x4d2a('0x46')]({'where':{'id':_0x497d0a['params']['id']}})['then'](handleEntityNotFound(_0x3a8220,null))['then'](function(_0x249d84){if(_0x249d84){return _0x249d84['addActions'](_0x497d0a[_0x4d2a('0x44')][_0x4d2a('0x49')],_[_0x4d2a('0x48')](_0x497d0a[_0x4d2a('0x44')],['ids','id'])||{});}})['then'](respondWithResult(_0x3a8220,null))['catch'](handleError(_0x3a8220,null));};exports[_0x4d2a('0x50')]=function(_0x136ad0,_0xf3d8d0,_0x255b47){var _0x1e3e08={};var _0x47b76e={};var _0x23a48a;var _0x3c334a;return db[_0x4d2a('0x2a')]['findOne']({'where':{'id':_0x136ad0[_0x4d2a('0x40')]['id']}})[_0x4d2a('0x3b')](handleEntityNotFound(_0xf3d8d0,null))['then'](function(_0x248768){if(_0x248768){_0x23a48a=_0x248768;_0x47b76e[_0x4d2a('0x2d')]=_['keys'](db[_0x4d2a('0x51')][_0x4d2a('0x41')]);_0x47b76e['query']=_['keys'](_0x136ad0[_0x4d2a('0x31')]);_0x47b76e[_0x4d2a('0x2f')]=_[_0x4d2a('0x30')](_0x47b76e[_0x4d2a('0x2d')],_0x47b76e[_0x4d2a('0x31')]);_0x1e3e08[_0x4d2a('0x32')]=_[_0x4d2a('0x30')](_0x47b76e[_0x4d2a('0x2d')],qs[_0x4d2a('0x33')](_0x136ad0[_0x4d2a('0x31')][_0x4d2a('0x33')]));_0x1e3e08[_0x4d2a('0x32')]=_0x1e3e08[_0x4d2a('0x32')][_0x4d2a('0x34')]?_0x1e3e08[_0x4d2a('0x32')]:_0x47b76e['model'];_0x1e3e08[_0x4d2a('0x4d')]=qs[_0x4d2a('0x35')](_0x136ad0[_0x4d2a('0x31')][_0x4d2a('0x35')]);_0x1e3e08[_0x4d2a('0x36')]=qs[_0x4d2a('0x2f')](_[_0x4d2a('0x37')](_0x136ad0['query'],_0x47b76e[_0x4d2a('0x2f')]));if(_0x136ad0[_0x4d2a('0x31')][_0x4d2a('0x38')]){_0x1e3e08[_0x4d2a('0x36')]=_['merge'](_0x1e3e08['where'],{'$or':_[_0x4d2a('0x29')](_0x1e3e08[_0x4d2a('0x32')],function(_0x98df94){var _0x2db73f={};_0x2db73f[_0x98df94]={'$like':'%'+_0x136ad0[_0x4d2a('0x31')][_0x4d2a('0x38')]+'%'};return _0x2db73f;})});}_0x1e3e08=_[_0x4d2a('0x39')]({},_0x1e3e08,_0x136ad0['options']);return _0x23a48a[_0x4d2a('0x50')](_0x1e3e08);}})[_0x4d2a('0x3b')](function(_0xb280dd){if(_0xb280dd){_0x3c334a=_0xb280dd[_0x4d2a('0x34')];if(!_0x136ad0[_0x4d2a('0x31')][_0x4d2a('0x52')](_0x4d2a('0x4e'))){_0x1e3e08[_0x4d2a('0x1d')]=qs[_0x4d2a('0x1d')](_0x136ad0['query'][_0x4d2a('0x1d')]);_0x1e3e08['offset']=qs[_0x4d2a('0x1b')](_0x136ad0[_0x4d2a('0x31')]['offset']);}return _0x23a48a[_0x4d2a('0x50')](_0x1e3e08);}})[_0x4d2a('0x3b')](function(_0x197068){if(_0x197068){return _0x197068?{'count':_0x3c334a,'rows':_0x197068}:null;}})[_0x4d2a('0x3b')](respondWithResult(_0xf3d8d0,null))[_0x4d2a('0x42')](handleError(_0xf3d8d0,null));}; \ No newline at end of file +var _0x20f7=['offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','create','body','params','find','Condition','addConditions','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x8e7bd2,_0x3870d7){var _0xa4e60f=function(_0x151499){while(--_0x151499){_0x8e7bd2['push'](_0x8e7bd2['shift']());}};_0xa4e60f(++_0x3870d7);}(_0x20f7,0xef));var _0x720f=function(_0x489b4d,_0x4ddcbe){_0x489b4d=_0x489b4d-0x0;var _0x17f1ba=_0x20f7[_0x489b4d];return _0x17f1ba;};'use strict';var emlformat=require(_0x720f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x720f('0x1'));var jsonpatch=require(_0x720f('0x2'));var rp=require(_0x720f('0x3'));var moment=require(_0x720f('0x4'));var BPromise=require(_0x720f('0x5'));var Mustache=require(_0x720f('0x6'));var util=require(_0x720f('0x7'));var path=require(_0x720f('0x8'));var sox=require(_0x720f('0x9'));var csv=require('to-csv');var ejs=require(_0x720f('0xa'));var fs=require('fs');var fs_extra=require(_0x720f('0xb'));var _=require(_0x720f('0xc'));var squel=require(_0x720f('0xd'));var crypto=require(_0x720f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x720f('0xf'));var toCsv=require(_0x720f('0x10'));var querystring=require(_0x720f('0x11'));var Papa=require(_0x720f('0x12'));var Redis=require(_0x720f('0x13'));var authService=require(_0x720f('0x14'));var qs=require(_0x720f('0x15'));var as=require(_0x720f('0x16'));var hardwareService=require(_0x720f('0x17'));var logger=require(_0x720f('0x18'))(_0x720f('0x19'));var utils=require('../../config/utils');var config=require(_0x720f('0x1a'));var licenseUtil=require(_0x720f('0x1b'));var db=require(_0x720f('0x1c'))['db'];function respondWithStatusCode(_0x431d2b,_0x1770e6){_0x1770e6=_0x1770e6||0xcc;return function(_0x24192f){if(_0x24192f){return _0x431d2b[_0x720f('0x1d')](_0x1770e6);}return _0x431d2b[_0x720f('0x1e')](_0x1770e6)['end']();};}function respondWithResult(_0x574824,_0x410e86){_0x410e86=_0x410e86||0xc8;return function(_0xe90c13){if(_0xe90c13){return _0x574824['status'](_0x410e86)['json'](_0xe90c13);}};}function respondWithFilteredResult(_0x1e2907,_0x19c34c){return function(_0xfe470){if(_0xfe470){var _0x490e68=typeof _0x19c34c[_0x720f('0x1f')]===_0x720f('0x20')&&typeof _0x19c34c['limit']===_0x720f('0x20');var _0x31f3c6=_0xfe470[_0x720f('0x21')];var _0x1818bb=_0x490e68?0x0:_0x19c34c[_0x720f('0x1f')];var _0x7c897d=_0x490e68?_0xfe470['count']:_0x19c34c[_0x720f('0x1f')]+_0x19c34c[_0x720f('0x22')];var _0x85440e;if(_0x7c897d>=_0x31f3c6){_0x7c897d=_0x31f3c6;_0x85440e=0xc8;}else{_0x85440e=0xce;}_0x1e2907[_0x720f('0x1e')](_0x85440e);return _0x1e2907[_0x720f('0x23')](_0x720f('0x24'),_0x1818bb+'-'+_0x7c897d+'/'+_0x31f3c6)[_0x720f('0x25')](_0xfe470);}return null;};}function patchUpdates(_0x320246){return function(_0x34aeb5){try{jsonpatch[_0x720f('0x26')](_0x34aeb5,_0x320246,!![]);}catch(_0x1eef02){return BPromise[_0x720f('0x27')](_0x1eef02);}return _0x34aeb5[_0x720f('0x28')]();};}function saveUpdates(_0x514cec,_0x3ec8da){return function(_0x5a80ad){if(_0x5a80ad){return _0x5a80ad[_0x720f('0x29')](_0x514cec)['then'](function(_0x1c3d10){return _0x1c3d10;});}return null;};}function removeEntity(_0x5a8006,_0x57c461){return function(_0x32f6cf){if(_0x32f6cf){return _0x32f6cf[_0x720f('0x2a')]()[_0x720f('0x2b')](function(){_0x5a8006[_0x720f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48db4e,_0x228611){return function(_0xa4d630){if(!_0xa4d630){_0x48db4e['sendStatus'](0x194);}return _0xa4d630;};}function handleError(_0x1c615d,_0x33ddfd){_0x33ddfd=_0x33ddfd||0x1f4;return function(_0x44d64e){logger['error'](_0x44d64e[_0x720f('0x2c')]);if(_0x44d64e['name']){delete _0x44d64e[_0x720f('0x2d')];}_0x1c615d['status'](_0x33ddfd)[_0x720f('0x2e')](_0x44d64e);};}exports[_0x720f('0x2f')]=function(_0x763793,_0x4ae0d3){var _0x37cba7={},_0xb05d93={},_0x3c371d={'count':0x0,'rows':[]};var _0x232e39=_[_0x720f('0x30')](db[_0x720f('0x31')][_0x720f('0x32')],function(_0x274fed){return{'name':_0x274fed[_0x720f('0x33')],'type':_0x274fed[_0x720f('0x34')][_0x720f('0x35')]};});_0xb05d93['model']=_[_0x720f('0x30')](_0x232e39,'name');_0xb05d93[_0x720f('0x36')]=_['keys'](_0x763793[_0x720f('0x36')]);_0xb05d93[_0x720f('0x37')]=_[_0x720f('0x38')](_0xb05d93[_0x720f('0x39')],_0xb05d93[_0x720f('0x36')]);_0x37cba7['attributes']=_[_0x720f('0x38')](_0xb05d93[_0x720f('0x39')],qs['fields'](_0x763793[_0x720f('0x36')][_0x720f('0x3a')]));_0x37cba7['attributes']=_0x37cba7['attributes'][_0x720f('0x3b')]?_0x37cba7[_0x720f('0x3c')]:_0xb05d93[_0x720f('0x39')];if(!_0x763793[_0x720f('0x36')][_0x720f('0x3d')](_0x720f('0x3e'))){_0x37cba7[_0x720f('0x22')]=qs[_0x720f('0x22')](_0x763793[_0x720f('0x36')]['limit']);_0x37cba7[_0x720f('0x1f')]=qs[_0x720f('0x1f')](_0x763793[_0x720f('0x36')][_0x720f('0x1f')]);}_0x37cba7[_0x720f('0x3f')]=qs['sort'](_0x763793['query'][_0x720f('0x40')]);_0x37cba7[_0x720f('0x41')]=qs[_0x720f('0x37')](_[_0x720f('0x42')](_0x763793['query'],_0xb05d93[_0x720f('0x37')]),_0x232e39);if(_0x763793[_0x720f('0x36')]['filter']){_0x37cba7['where']=_[_0x720f('0x43')](_0x37cba7[_0x720f('0x41')],{'$or':_[_0x720f('0x30')](_0x232e39,function(_0x42b154){if(_0x42b154['type']!==_0x720f('0x44')){var _0x3c6629={};_0x3c6629[_0x42b154[_0x720f('0x2d')]]={'$like':'%'+_0x763793[_0x720f('0x36')][_0x720f('0x45')]+'%'};return _0x3c6629;}})});}_0x37cba7=_[_0x720f('0x43')]({},_0x37cba7,_0x763793[_0x720f('0x46')]);var _0x4e7d72={'where':_0x37cba7[_0x720f('0x41')]};return db['Automation'][_0x720f('0x21')](_0x4e7d72)[_0x720f('0x2b')](function(_0x123b8a){_0x3c371d['count']=_0x123b8a;if(_0x763793['query'][_0x720f('0x47')]){_0x37cba7[_0x720f('0x48')]=[{'all':!![]}];}return db[_0x720f('0x31')][_0x720f('0x49')](_0x37cba7);})[_0x720f('0x2b')](function(_0x1c265e){_0x3c371d[_0x720f('0x4a')]=_0x1c265e;return _0x3c371d;})['then'](respondWithFilteredResult(_0x4ae0d3,_0x37cba7))[_0x720f('0x4b')](handleError(_0x4ae0d3,null));};exports['show']=function(_0x10d6ff,_0x39fb25){var _0x510a60={'raw':![],'where':{'id':_0x10d6ff['params']['id']}},_0x5190c6={};_0x5190c6[_0x720f('0x39')]=_['keys'](db[_0x720f('0x31')]['rawAttributes']);_0x5190c6[_0x720f('0x36')]=_[_0x720f('0x4c')](_0x10d6ff[_0x720f('0x36')]);_0x5190c6[_0x720f('0x37')]=_[_0x720f('0x38')](_0x5190c6[_0x720f('0x39')],_0x5190c6['query']);_0x510a60[_0x720f('0x3c')]=_[_0x720f('0x38')](_0x5190c6[_0x720f('0x39')],qs['fields'](_0x10d6ff[_0x720f('0x36')]['fields']));_0x510a60[_0x720f('0x3c')]=_0x510a60[_0x720f('0x3c')][_0x720f('0x3b')]?_0x510a60[_0x720f('0x3c')]:_0x5190c6[_0x720f('0x39')];if(_0x10d6ff[_0x720f('0x36')][_0x720f('0x47')]){_0x510a60[_0x720f('0x48')]=[{'all':!![]}];}_0x510a60=_[_0x720f('0x43')]({},_0x510a60,_0x10d6ff[_0x720f('0x46')]);return db[_0x720f('0x31')]['find'](_0x510a60)[_0x720f('0x2b')](handleEntityNotFound(_0x39fb25,null))[_0x720f('0x2b')](respondWithResult(_0x39fb25,null))[_0x720f('0x4b')](handleError(_0x39fb25,null));};exports[_0x720f('0x4d')]=function(_0x23dca5,_0x63a649){return db['Automation'][_0x720f('0x4d')](_0x23dca5[_0x720f('0x4e')],{})[_0x720f('0x2b')](respondWithResult(_0x63a649,0xc9))[_0x720f('0x4b')](handleError(_0x63a649,null));};exports[_0x720f('0x29')]=function(_0x486416,_0x1a6293){if(_0x486416[_0x720f('0x4e')]['id']){delete _0x486416['body']['id'];}return db['Automation']['find']({'where':{'id':_0x486416[_0x720f('0x4f')]['id']}})[_0x720f('0x2b')](handleEntityNotFound(_0x1a6293,null))[_0x720f('0x2b')](saveUpdates(_0x486416['body'],null))[_0x720f('0x2b')](respondWithResult(_0x1a6293,null))[_0x720f('0x4b')](handleError(_0x1a6293,null));};exports['destroy']=function(_0x365c98,_0x151651){return db[_0x720f('0x31')][_0x720f('0x50')]({'where':{'id':_0x365c98['params']['id']}})['then'](handleEntityNotFound(_0x151651,null))[_0x720f('0x2b')](removeEntity(_0x151651,null))['catch'](handleError(_0x151651,null));};exports['addConditions']=function(_0x254183,_0x503103,_0xcdd107){return db[_0x720f('0x51')][_0x720f('0x50')]({'where':{'id':_0x254183[_0x720f('0x4f')]['id']}})[_0x720f('0x2b')](handleEntityNotFound(_0x503103,null))[_0x720f('0x2b')](function(_0x4e56b3){if(_0x4e56b3){return _0x4e56b3[_0x720f('0x52')](_0x254183[_0x720f('0x4e')][_0x720f('0x53')],_[_0x720f('0x54')](_0x254183['body'],['ids','id'])||{});}})[_0x720f('0x2b')](respondWithResult(_0x503103,null))[_0x720f('0x4b')](handleError(_0x503103,null));};exports[_0x720f('0x55')]=function(_0xf61a6c,_0x3667ba,_0x123da6){var _0x11dc35={};var _0x2717f2={};var _0x38a0fc;var _0x199210;return db['Automation'][_0x720f('0x56')]({'where':{'id':_0xf61a6c[_0x720f('0x4f')]['id']}})[_0x720f('0x2b')](handleEntityNotFound(_0x3667ba,null))[_0x720f('0x2b')](function(_0x435337){if(_0x435337){_0x38a0fc=_0x435337;_0x2717f2[_0x720f('0x39')]=_[_0x720f('0x4c')](db[_0x720f('0x51')][_0x720f('0x32')]);_0x2717f2[_0x720f('0x36')]=_[_0x720f('0x4c')](_0xf61a6c['query']);_0x2717f2['filters']=_['intersection'](_0x2717f2[_0x720f('0x39')],_0x2717f2[_0x720f('0x36')]);_0x11dc35[_0x720f('0x3c')]=_[_0x720f('0x38')](_0x2717f2[_0x720f('0x39')],qs[_0x720f('0x3a')](_0xf61a6c[_0x720f('0x36')][_0x720f('0x3a')]));_0x11dc35[_0x720f('0x3c')]=_0x11dc35[_0x720f('0x3c')]['length']?_0x11dc35[_0x720f('0x3c')]:_0x2717f2['model'];_0x11dc35[_0x720f('0x3f')]=qs[_0x720f('0x40')](_0xf61a6c['query'][_0x720f('0x40')]);_0x11dc35[_0x720f('0x41')]=qs[_0x720f('0x37')](_[_0x720f('0x42')](_0xf61a6c['query'],_0x2717f2['filters']));if(_0xf61a6c[_0x720f('0x36')][_0x720f('0x45')]){_0x11dc35[_0x720f('0x41')]=_[_0x720f('0x43')](_0x11dc35['where'],{'$or':_[_0x720f('0x30')](_0x11dc35[_0x720f('0x3c')],function(_0x2fa57b){var _0x5b03a6={};_0x5b03a6[_0x2fa57b]={'$like':'%'+_0xf61a6c['query'][_0x720f('0x45')]+'%'};return _0x5b03a6;})});}_0x11dc35=_[_0x720f('0x43')]({},_0x11dc35,_0xf61a6c[_0x720f('0x46')]);return _0x38a0fc[_0x720f('0x55')](_0x11dc35);}})['then'](function(_0x40cbd3){if(_0x40cbd3){_0x199210=_0x40cbd3[_0x720f('0x3b')];if(!_0xf61a6c['query']['hasOwnProperty'](_0x720f('0x3e'))){_0x11dc35[_0x720f('0x22')]=qs[_0x720f('0x22')](_0xf61a6c[_0x720f('0x36')][_0x720f('0x22')]);_0x11dc35['offset']=qs['offset'](_0xf61a6c[_0x720f('0x36')]['offset']);}return _0x38a0fc[_0x720f('0x55')](_0x11dc35);}})[_0x720f('0x2b')](function(_0x5a0bc9){if(_0x5a0bc9){return _0x5a0bc9?{'count':_0x199210,'rows':_0x5a0bc9}:null;}})[_0x720f('0x2b')](respondWithResult(_0x3667ba,null))[_0x720f('0x4b')](handleError(_0x3667ba,null));};exports[_0x720f('0x57')]=function(_0x4057ae,_0xa08799,_0x171c2f){return db[_0x720f('0x58')][_0x720f('0x50')]({'where':{'id':_0x4057ae[_0x720f('0x4f')]['id']}})[_0x720f('0x2b')](handleEntityNotFound(_0xa08799,null))[_0x720f('0x2b')](function(_0x55449e){if(_0x55449e){return _0x55449e[_0x720f('0x57')](_0x4057ae['body'][_0x720f('0x53')],_['omit'](_0x4057ae[_0x720f('0x4e')],['ids','id'])||{});}})[_0x720f('0x2b')](respondWithResult(_0xa08799,null))[_0x720f('0x4b')](handleError(_0xa08799,null));};exports[_0x720f('0x59')]=function(_0x43e656,_0x468148,_0x5d9ee6){var _0x10f810={};var _0x53d9f4={};var _0x143bb7;var _0x546312;return db[_0x720f('0x31')][_0x720f('0x56')]({'where':{'id':_0x43e656['params']['id']}})['then'](handleEntityNotFound(_0x468148,null))['then'](function(_0x5bd676){if(_0x5bd676){_0x143bb7=_0x5bd676;_0x53d9f4[_0x720f('0x39')]=_[_0x720f('0x4c')](db[_0x720f('0x58')][_0x720f('0x32')]);_0x53d9f4[_0x720f('0x36')]=_['keys'](_0x43e656[_0x720f('0x36')]);_0x53d9f4[_0x720f('0x37')]=_[_0x720f('0x38')](_0x53d9f4[_0x720f('0x39')],_0x53d9f4['query']);_0x10f810[_0x720f('0x3c')]=_[_0x720f('0x38')](_0x53d9f4['model'],qs[_0x720f('0x3a')](_0x43e656['query']['fields']));_0x10f810[_0x720f('0x3c')]=_0x10f810[_0x720f('0x3c')][_0x720f('0x3b')]?_0x10f810[_0x720f('0x3c')]:_0x53d9f4[_0x720f('0x39')];_0x10f810[_0x720f('0x3f')]=qs['sort'](_0x43e656['query']['sort']);_0x10f810[_0x720f('0x41')]=qs[_0x720f('0x37')](_['pick'](_0x43e656[_0x720f('0x36')],_0x53d9f4[_0x720f('0x37')]));if(_0x43e656[_0x720f('0x36')][_0x720f('0x45')]){_0x10f810[_0x720f('0x41')]=_['merge'](_0x10f810[_0x720f('0x41')],{'$or':_[_0x720f('0x30')](_0x10f810[_0x720f('0x3c')],function(_0x390f34){var _0x2adc8f={};_0x2adc8f[_0x390f34]={'$like':'%'+_0x43e656[_0x720f('0x36')][_0x720f('0x45')]+'%'};return _0x2adc8f;})});}_0x10f810=_['merge']({},_0x10f810,_0x43e656[_0x720f('0x46')]);return _0x143bb7[_0x720f('0x59')](_0x10f810);}})[_0x720f('0x2b')](function(_0xb850cc){if(_0xb850cc){_0x546312=_0xb850cc[_0x720f('0x3b')];if(!_0x43e656['query'][_0x720f('0x3d')](_0x720f('0x3e'))){_0x10f810['limit']=qs[_0x720f('0x22')](_0x43e656['query'][_0x720f('0x22')]);_0x10f810['offset']=qs[_0x720f('0x1f')](_0x43e656[_0x720f('0x36')]['offset']);}return _0x143bb7[_0x720f('0x59')](_0x10f810);}})[_0x720f('0x2b')](function(_0x13a578){if(_0x13a578){return _0x13a578?{'count':_0x546312,'rows':_0x13a578}:null;}})[_0x720f('0x2b')](respondWithResult(_0x468148,null))[_0x720f('0x4b')](handleError(_0x468148,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 296e7c4..f2ffb97 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 _0x58eb=['api','moment','request-promise','path','rimraf','./automation.attributes','exports','Automation','tools_automations','lodash','util'];(function(_0x20b0b0,_0x489fc8){var _0x3cb3a6=function(_0x30e392){while(--_0x30e392){_0x20b0b0['push'](_0x20b0b0['shift']());}};_0x3cb3a6(++_0x489fc8);}(_0x58eb,0x1d7));var _0xb58e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x58eb[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0xb58e('0x0'));var util=require(_0xb58e('0x1'));var logger=require('../../config/logger')(_0xb58e('0x2'));var moment=require(_0xb58e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb58e('0x4'));var fs=require('fs');var path=require(_0xb58e('0x5'));var rimraf=require(_0xb58e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb58e('0x7'));module[_0xb58e('0x8')]=function(_0x284d33,_0x5e5978){return _0x284d33['define'](_0xb58e('0x9'),attributes,{'tableName':_0xb58e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc111=['moment','request-promise','exports','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x4826e8,_0x1c9779){var _0x56663d=function(_0x4901b0){while(--_0x4901b0){_0x4826e8['push'](_0x4826e8['shift']());}};_0x56663d(++_0x1c9779);}(_0xc111,0xdd));var _0x1c11=function(_0x1ea74b,_0x4bd060){_0x1ea74b=_0x1ea74b-0x0;var _0x10d0aa=_0xc111[_0x1ea74b];return _0x10d0aa;};'use strict';var _=require(_0x1c11('0x0'));var util=require(_0x1c11('0x1'));var logger=require(_0x1c11('0x2'))('api');var moment=require(_0x1c11('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x1c11('0x5')]=function(_0x5d6563,_0x11800a){return _0x5d6563['define'](_0x1c11('0x6'),attributes,{'tableName':_0x1c11('0x7'),'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 bdea27a..1384023 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 _0x0f97=['request','then','info','request\x20sent','stringify','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0x0f97,0x196));var _0x70f9=function(_0x252884,_0x117ddf){_0x252884=_0x252884-0x0;var _0x4de0e6=_0x0f97[_0x252884];return _0x4de0e6;};'use strict';var _=require(_0x70f9('0x0'));var util=require(_0x70f9('0x1'));var moment=require(_0x70f9('0x2'));var BPromise=require(_0x70f9('0x3'));var rs=require(_0x70f9('0x4'));var fs=require('fs');var Redis=require(_0x70f9('0x5'));var db=require(_0x70f9('0x6'))['db'];var utils=require(_0x70f9('0x7'));var logger=require(_0x70f9('0x8'))(_0x70f9('0x9'));var config=require(_0x70f9('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x70f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17531e,_0x2e1ac7,_0x2fdeb5){return new BPromise(function(_0x59933c,_0x523d32){return client[_0x70f9('0xc')](_0x17531e,_0x2fdeb5)[_0x70f9('0xd')](function(_0x2265a8){logger[_0x70f9('0xe')]('Automation,\x20%s,\x20%s',_0x2e1ac7,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x2e1ac7,_0x70f9('0xf'),JSON[_0x70f9('0x10')](_0x2265a8));if(_0x2265a8[_0x70f9('0x11')]){if(_0x2265a8[_0x70f9('0x11')]['code']===0x1f4){logger[_0x70f9('0x11')](_0x70f9('0x12'),_0x2e1ac7,_0x2265a8[_0x70f9('0x11')][_0x70f9('0x13')]);return _0x523d32(_0x2265a8[_0x70f9('0x11')]['message']);}logger[_0x70f9('0x11')]('Automation,\x20%s,\x20%s',_0x2e1ac7,_0x2265a8['error']['message']);return _0x59933c(_0x2265a8['error'][_0x70f9('0x13')]);}else{logger['info'](_0x70f9('0x12'),_0x2e1ac7,_0x70f9('0xf'));_0x59933c(_0x2265a8[_0x70f9('0x14')][_0x70f9('0x13')]);}})[_0x70f9('0x15')](function(_0x2d2226){logger[_0x70f9('0x11')](_0x70f9('0x12'),_0x2e1ac7,_0x2d2226);_0x523d32(_0x2d2226);});});} \ No newline at end of file +var _0x20d8=['stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x47847f,_0x324018){var _0x884cc7=function(_0x5db627){while(--_0x5db627){_0x47847f['push'](_0x47847f['shift']());}};_0x884cc7(++_0x324018);}(_0x20d8,0xee));var _0x820d=function(_0x4133d9,_0x18835a){_0x4133d9=_0x4133d9-0x0;var _0x1b972e=_0x20d8[_0x4133d9];return _0x1b972e;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var moment=require(_0x820d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x820d('0x3'));var db=require(_0x820d('0x4'))['db'];var utils=require(_0x820d('0x5'));var logger=require(_0x820d('0x6'))(_0x820d('0x7'));var config=require('../../config/environment');var jayson=require(_0x820d('0x8'));var client=jayson[_0x820d('0x9')][_0x820d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e23e3,_0x435a84,_0xa2751d){return new BPromise(function(_0x3b084c,_0x485bde){return client[_0x820d('0xb')](_0x4e23e3,_0xa2751d)['then'](function(_0x45fdd7){logger['info']('Automation,\x20%s,\x20%s',_0x435a84,_0x820d('0xc'));logger['debug'](_0x820d('0xd'),_0x435a84,_0x820d('0xc'),JSON[_0x820d('0xe')](_0x45fdd7));if(_0x45fdd7['error']){if(_0x45fdd7[_0x820d('0xf')][_0x820d('0x10')]===0x1f4){logger['error'](_0x820d('0x11'),_0x435a84,_0x45fdd7['error'][_0x820d('0x12')]);return _0x485bde(_0x45fdd7[_0x820d('0xf')][_0x820d('0x12')]);}logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x45fdd7[_0x820d('0xf')]['message']);return _0x3b084c(_0x45fdd7['error'][_0x820d('0x12')]);}else{logger['info'](_0x820d('0x11'),_0x435a84,_0x820d('0xc'));_0x3b084c(_0x45fdd7[_0x820d('0x13')]['message']);}})[_0x820d('0x14')](function(_0x3466c1){logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x3466c1);_0x485bde(_0x3466c1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index baf47e4..6ea67fc 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 _0xc300=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','/:id/actions','getActions','post','addActions','put','delete','/:id','destroy','exports','multer','util'];(function(_0x3cffd4,_0x5f55b9){var _0x3c5da5=function(_0x275f51){while(--_0x275f51){_0x3cffd4['push'](_0x3cffd4['shift']());}};_0x3c5da5(++_0x5f55b9);}(_0xc300,0x132));var _0x0c30=function(_0x203822,_0xb42247){_0x203822=_0x203822-0x0;var _0xf7948c=_0xc300[_0x203822];return _0xf7948c;};'use strict';var multer=require(_0x0c30('0x0'));var util=require(_0x0c30('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c30('0x2'));var router=express[_0x0c30('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c30('0x4'));var interaction=require(_0x0c30('0x5'));var config=require(_0x0c30('0x6'));var controller=require(_0x0c30('0x7'));router[_0x0c30('0x8')]('/',auth[_0x0c30('0x9')](),controller[_0x0c30('0xa')]);router[_0x0c30('0x8')]('/:id',auth[_0x0c30('0x9')](),controller[_0x0c30('0xb')]);router['get'](_0x0c30('0xc'),auth[_0x0c30('0x9')](),controller['getConditions']);router[_0x0c30('0x8')](_0x0c30('0xd'),auth[_0x0c30('0x9')](),controller[_0x0c30('0xe')]);router[_0x0c30('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0c30('0xf')](_0x0c30('0xc'),auth['isAuthenticated'](),controller['addConditions']);router[_0x0c30('0xf')](_0x0c30('0xd'),auth[_0x0c30('0x9')](),controller[_0x0c30('0x10')]);router[_0x0c30('0x11')]('/:id',auth[_0x0c30('0x9')](),controller['update']);router[_0x0c30('0x12')](_0x0c30('0x13'),auth[_0x0c30('0x9')](),controller[_0x0c30('0x14')]);module[_0x0c30('0x15')]=router; \ No newline at end of file +var _0xd0ba=['index','/:id','getConditions','/:id/actions','post','create','addConditions','addActions','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x516cbe,_0xcbbfb7){var _0x141f6a=function(_0x51575c){while(--_0x51575c){_0x516cbe['push'](_0x516cbe['shift']());}};_0x141f6a(++_0xcbbfb7);}(_0xd0ba,0x17c));var _0xad0b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xd0ba[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require('multer');var util=require(_0xad0b('0x0'));var path=require(_0xad0b('0x1'));var timeout=require(_0xad0b('0x2'));var express=require(_0xad0b('0x3'));var router=express[_0xad0b('0x4')]();var fs_extra=require(_0xad0b('0x5'));var auth=require(_0xad0b('0x6'));var interaction=require(_0xad0b('0x7'));var config=require(_0xad0b('0x8'));var controller=require('./automation.controller');router[_0xad0b('0x9')]('/',auth[_0xad0b('0xa')](),controller[_0xad0b('0xb')]);router['get'](_0xad0b('0xc'),auth[_0xad0b('0xa')](),controller['show']);router['get']('/:id/conditions',auth['isAuthenticated'](),controller[_0xad0b('0xd')]);router['get'](_0xad0b('0xe'),auth[_0xad0b('0xa')](),controller['getActions']);router[_0xad0b('0xf')]('/',auth[_0xad0b('0xa')](),controller[_0xad0b('0x10')]);router[_0xad0b('0xf')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xad0b('0x11')]);router[_0xad0b('0xf')](_0xad0b('0xe'),auth[_0xad0b('0xa')](),controller[_0xad0b('0x12')]);router[_0xad0b('0x13')](_0xad0b('0xc'),auth[_0xad0b('0xa')](),controller[_0xad0b('0x14')]);router[_0xad0b('0x15')]('/:id',auth[_0xad0b('0xa')](),controller[_0xad0b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 13f02c0..ee6111e 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 _0xa44c=['INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.'];(function(_0x2c145e,_0x3d05d2){var _0x5b81d5=function(_0x1f3878){while(--_0x1f3878){_0x2c145e['push'](_0x2c145e['shift']());}};_0x5b81d5(++_0x3d05d2);}(_0xa44c,0x18d));var _0xca44=function(_0x4a9204,_0x77a66b){_0x4a9204=_0x4a9204-0x0;var _0x26428b=_0xa44c[_0x4a9204];return _0x26428b;};'use strict';var Sequelize=require(_0xca44('0x0'));module[_0xca44('0x1')]={'name':{'type':Sequelize[_0xca44('0x2')],'unique':_0xca44('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xca44('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xca44('0x5')},'description':{'type':Sequelize[_0xca44('0x2')]},'active':{'type':Sequelize[_0xca44('0x6')],'defaultValue':0x0,'comment':_0xca44('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xca44('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xca44('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xca44('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xca44('0xa')](0x3)[_0xca44('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca44('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xca44('0xa')](0x3)[_0xca44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca44('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xca44('0xa')](0x5)[_0xca44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xca44('0xa')](0x3)[_0xca44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca44('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xca44('0xa')](0x5)[_0xca44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca44('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xca44('0xa')](0x3)[_0xca44('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xca44('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca44('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xca44('0xa')](0x3)[_0xca44('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xca44('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xca44('0x2')],'defaultValue':_0xca44('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xca44('0x4')](_0xca44('0x11'),_0xca44('0x12'),_0xca44('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xca44('0x6')],'defaultValue':0x0,'comment':_0xca44('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xca44('0xa')](0x9)[_0xca44('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xca44('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xca44('0xa')](0x9)[_0xca44('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xca44('0xa')](0x9)[_0xca44('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xca44('0xa')](0x9)[_0xca44('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xca44('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xca44('0xa')](0x9)[_0xca44('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xca44('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xca44('0xa')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xca44('0xa')](0x5)[_0xca44('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xca44('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xca44('0xa')](0x9)[_0xca44('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xca44('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xca44('0x19')),'defaultValue':_0xca44('0x1a')},'dialPrefix':{'type':Sequelize[_0xca44('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xca44('0xa')](0x3)[_0xca44('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xca44('0xa')](0x3)[_0xca44('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xca44('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xca44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca44('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xca44('0xa')](0x5)[_0xca44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca44('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca44('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xca44('0xa')](0x5)[_0xca44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca44('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xca44('0xa')](0x3)[_0xca44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xca44('0xa')](0x5)[_0xca44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca44('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xca44('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca44('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xca44('0xa')](0x5)[_0xca44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca44('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xca44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca44('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xca44('0xa')](0x5)[_0xca44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca44('0x24')}}; \ No newline at end of file +var _0xf759=['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)','sequelize','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','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)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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)'];(function(_0x4f63fe,_0xc1efaf){var _0x2c7706=function(_0x596314){while(--_0x596314){_0x4f63fe['push'](_0x4f63fe['shift']());}};_0x2c7706(++_0xc1efaf);}(_0xf759,0x106));var _0x9f75=function(_0x1548e5,_0x39f15a){_0x1548e5=_0x1548e5-0x0;var _0x5f25af=_0xf759[_0x1548e5];return _0x5f25af;};'use strict';var Sequelize=require(_0x9f75('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9f75('0x1')](_0x9f75('0x2')),'allowNull':![],'defaultValue':_0x9f75('0x2')},'description':{'type':Sequelize[_0x9f75('0x3')]},'active':{'type':Sequelize[_0x9f75('0x4')],'defaultValue':0x0,'comment':_0x9f75('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x9f75('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x9f75('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9f75('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0x9f75('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f75('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9f75('0x7')](0x3)[_0x9f75('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f75('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9f75('0x7')](0x5)[_0x9f75('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f75('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f75('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f75('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9f75('0x7')](0x5)[_0x9f75('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f75('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f75('0x6')],'defaultValue':0x3,'comment':_0x9f75('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9f75('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f75('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9f75('0x7')](0x3)[_0x9f75('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9f75('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9f75('0x3')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x9f75('0x1')](_0x9f75('0x10'),_0x9f75('0x11'),_0x9f75('0x12')),'defaultValue':_0x9f75('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9f75('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9f75('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9f75('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x9f75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9f75('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9f75('0x7')](0x9)[_0x9f75('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9f75('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9f75('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x9f75('0x7')](0x9)[_0x9f75('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9f75('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9f75('0x7')](0x9)[_0x9f75('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9f75('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9f75('0x7')](0x9)[_0x9f75('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9f75('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9f75('0x7')](0x5)[_0x9f75('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9f75('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x9f75('0x1')]('DESC',_0x9f75('0x1a')),'defaultValue':_0x9f75('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9f75('0x7')](0x3)[_0x9f75('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9f75('0x1c')},'dialCutDigit':{'type':Sequelize[_0x9f75('0x7')](0x3)[_0x9f75('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9f75('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9f75('0x7')](0x3)[_0x9f75('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f75('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9f75('0x7')](0x5)[_0x9f75('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f75('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f75('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x9f75('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f75('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f75('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9f75('0x7')](0x5)[_0x9f75('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f75('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x9f75('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9f75('0x7')](0x5)[_0x9f75('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f75('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f75('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f75('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f75('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7e16099..f7d02f0 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 _0x4517=['../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Campaign','include','rows','catch','show','params','includeAll','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','clone','omit','body','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','pick','CampaignId','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','rimraf','zip-dir','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'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0x4517,0x112));var _0x7451=function(_0x17d25a,_0x425934){_0x17d25a=_0x17d25a-0x0;var _0x586944=_0x4517[_0x17d25a];return _0x586944;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7451('0x0'));var zipdir=require(_0x7451('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7451('0x2'));var moment=require(_0x7451('0x3'));var BPromise=require(_0x7451('0x4'));var Mustache=require(_0x7451('0x5'));var util=require(_0x7451('0x6'));var path=require(_0x7451('0x7'));var sox=require(_0x7451('0x8'));var csv=require(_0x7451('0x9'));var ejs=require(_0x7451('0xa'));var fs=require('fs');var fs_extra=require(_0x7451('0xb'));var _=require(_0x7451('0xc'));var squel=require(_0x7451('0xd'));var crypto=require(_0x7451('0xe'));var jsforce=require(_0x7451('0xf'));var deskjs=require(_0x7451('0x10'));var toCsv=require(_0x7451('0x9'));var querystring=require(_0x7451('0x11'));var Papa=require('papaparse');var Redis=require(_0x7451('0x12'));var authService=require(_0x7451('0x13'));var qs=require(_0x7451('0x14'));var as=require(_0x7451('0x15'));var hardwareService=require(_0x7451('0x16'));var logger=require(_0x7451('0x17'))(_0x7451('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7451('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450463,_0x2cb40b){_0x2cb40b=_0x2cb40b||0xcc;return function(_0x4a14dc){if(_0x4a14dc){return _0x450463[_0x7451('0x1a')](_0x2cb40b);}return _0x450463[_0x7451('0x1b')](_0x2cb40b)['end']();};}function respondWithResult(_0x46811e,_0x282128){_0x282128=_0x282128||0xc8;return function(_0x110ed6){if(_0x110ed6){return _0x46811e[_0x7451('0x1b')](_0x282128)['json'](_0x110ed6);}};}function respondWithFilteredResult(_0x357ea9,_0x313385){return function(_0x408336){if(_0x408336){var _0x58c0cd=typeof _0x313385['offset']===_0x7451('0x1c')&&typeof _0x313385[_0x7451('0x1d')]===_0x7451('0x1c');var _0xa8a121=_0x408336[_0x7451('0x1e')];var _0xd47ee4=_0x58c0cd?0x0:_0x313385[_0x7451('0x1f')];var _0x1120b1=_0x58c0cd?_0x408336[_0x7451('0x1e')]:_0x313385['offset']+_0x313385[_0x7451('0x1d')];var _0x32e250;if(_0x1120b1>=_0xa8a121){_0x1120b1=_0xa8a121;_0x32e250=0xc8;}else{_0x32e250=0xce;}_0x357ea9[_0x7451('0x1b')](_0x32e250);return _0x357ea9['set'](_0x7451('0x20'),_0xd47ee4+'-'+_0x1120b1+'/'+_0xa8a121)[_0x7451('0x21')](_0x408336);}return null;};}function patchUpdates(_0x3ffb08){return function(_0x3b5d59){try{jsonpatch[_0x7451('0x22')](_0x3b5d59,_0x3ffb08,!![]);}catch(_0x293e29){return BPromise[_0x7451('0x23')](_0x293e29);}return _0x3b5d59['save']();};}function saveUpdates(_0x3a0c1e,_0x309be0){return function(_0x561e12){if(_0x561e12){return _0x561e12[_0x7451('0x24')](_0x3a0c1e)[_0x7451('0x25')](function(_0x2962f8){return _0x2962f8;});}return null;};}function removeEntity(_0x57cc15,_0x19e33b){return function(_0x21dd67){if(_0x21dd67){return _0x21dd67[_0x7451('0x26')]()[_0x7451('0x25')](function(){var _0x37bc47=_0x21dd67[_0x7451('0x27')]({'plain':!![]});var _0x3c56f1=_0x7451('0x28');return db[_0x7451('0x29')]['destroy']({'where':{'type':_0x3c56f1,'resourceId':_0x37bc47['id']}})[_0x7451('0x25')](function(){return _0x21dd67;});})[_0x7451('0x25')](function(){_0x57cc15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc793e,_0x1edcf2){return function(_0x248d83){if(!_0x248d83){_0xcc793e[_0x7451('0x1a')](0x194);}return _0x248d83;};}function handleError(_0x30ef36,_0x19547e){_0x19547e=_0x19547e||0x1f4;return function(_0x4b5b26){logger[_0x7451('0x2a')](_0x4b5b26['stack']);if(_0x4b5b26[_0x7451('0x2b')]){delete _0x4b5b26[_0x7451('0x2b')];}_0x30ef36['status'](_0x19547e)[_0x7451('0x2c')](_0x4b5b26);};}exports[_0x7451('0x2d')]=function(_0x40b6c3,_0x3a397e){var _0x17d52c={},_0x4e24f7={},_0x2071e5={'count':0x0,'rows':[]};var _0x43d305=_[_0x7451('0x2e')](db['Campaign'][_0x7451('0x2f')],function(_0x4654e7){return{'name':_0x4654e7['fieldName'],'type':_0x4654e7['type'][_0x7451('0x30')]};});_0x4e24f7[_0x7451('0x31')]=_['map'](_0x43d305,'name');_0x4e24f7[_0x7451('0x32')]=_[_0x7451('0x33')](_0x40b6c3[_0x7451('0x32')]);_0x4e24f7[_0x7451('0x34')]=_[_0x7451('0x35')](_0x4e24f7[_0x7451('0x31')],_0x4e24f7[_0x7451('0x32')]);_0x17d52c[_0x7451('0x36')]=_['intersection'](_0x4e24f7[_0x7451('0x31')],qs[_0x7451('0x37')](_0x40b6c3['query'][_0x7451('0x37')]));_0x17d52c[_0x7451('0x36')]=_0x17d52c[_0x7451('0x36')][_0x7451('0x38')]?_0x17d52c[_0x7451('0x36')]:_0x4e24f7[_0x7451('0x31')];if(!_0x40b6c3['query'][_0x7451('0x39')](_0x7451('0x3a'))){_0x17d52c['limit']=qs[_0x7451('0x1d')](_0x40b6c3[_0x7451('0x32')]['limit']);_0x17d52c['offset']=qs['offset'](_0x40b6c3['query']['offset']);}_0x17d52c[_0x7451('0x3b')]=qs[_0x7451('0x3c')](_0x40b6c3[_0x7451('0x32')][_0x7451('0x3c')]);_0x17d52c[_0x7451('0x3d')]=qs['filters'](_['pick'](_0x40b6c3['query'],_0x4e24f7['filters']),_0x43d305);if(_0x40b6c3['query'][_0x7451('0x3e')]){_0x17d52c[_0x7451('0x3d')]=_[_0x7451('0x3f')](_0x17d52c[_0x7451('0x3d')],{'$or':_[_0x7451('0x2e')](_0x43d305,function(_0xfa0b5a){if(_0xfa0b5a[_0x7451('0x40')]!==_0x7451('0x41')){var _0x201d96={};_0x201d96[_0xfa0b5a[_0x7451('0x2b')]]={'$like':'%'+_0x40b6c3[_0x7451('0x32')]['filter']+'%'};return _0x201d96;}})});}_0x17d52c=_['merge']({},_0x17d52c,_0x40b6c3[_0x7451('0x42')]);var _0x57f1b2={'where':_0x17d52c[_0x7451('0x3d')]};return db[_0x7451('0x43')]['count'](_0x57f1b2)['then'](function(_0x1f5bf3){_0x2071e5['count']=_0x1f5bf3;if(_0x40b6c3[_0x7451('0x32')]['includeAll']){_0x17d52c[_0x7451('0x44')]=[{'all':!![]}];}return db[_0x7451('0x43')]['findAll'](_0x17d52c);})[_0x7451('0x25')](function(_0x4c326d){_0x2071e5[_0x7451('0x45')]=_0x4c326d;return _0x2071e5;})[_0x7451('0x25')](respondWithFilteredResult(_0x3a397e,_0x17d52c))[_0x7451('0x46')](handleError(_0x3a397e,null));};exports[_0x7451('0x47')]=function(_0x44e636,_0x1d2b1e){var _0x387279={'raw':![],'where':{'id':_0x44e636[_0x7451('0x48')]['id']}},_0x1fcae7={};_0x1fcae7[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x43')][_0x7451('0x2f')]);_0x1fcae7[_0x7451('0x32')]=_['keys'](_0x44e636[_0x7451('0x32')]);_0x1fcae7[_0x7451('0x34')]=_[_0x7451('0x35')](_0x1fcae7[_0x7451('0x31')],_0x1fcae7['query']);_0x387279[_0x7451('0x36')]=_['intersection'](_0x1fcae7['model'],qs['fields'](_0x44e636['query']['fields']));_0x387279[_0x7451('0x36')]=_0x387279[_0x7451('0x36')][_0x7451('0x38')]?_0x387279['attributes']:_0x1fcae7[_0x7451('0x31')];if(_0x44e636[_0x7451('0x32')][_0x7451('0x49')]){_0x387279[_0x7451('0x44')]=[{'all':!![]}];}_0x387279=_[_0x7451('0x3f')]({},_0x387279,_0x44e636[_0x7451('0x42')]);return db[_0x7451('0x43')][_0x7451('0x4a')](_0x387279)[_0x7451('0x25')](handleEntityNotFound(_0x1d2b1e,null))['then'](respondWithResult(_0x1d2b1e,null))['catch'](handleError(_0x1d2b1e,null));};exports['create']=function(_0xd26beb,_0x3acf1d){return db[_0x7451('0x43')]['create'](_0xd26beb['body'],{})['then'](function(_0x7c23ad){var _0x55761d=_0xd26beb['user'][_0x7451('0x27')]({'plain':!![]});if(!_0x55761d)throw new Error(_0x7451('0x4b'));if(_0x55761d[_0x7451('0x4c')]===_0x7451('0x4d')){var _0x24e028=_0x7c23ad['get']({'plain':!![]});var _0x2d39f0='IvrCampaigns';return db[_0x7451('0x4e')][_0x7451('0x4a')]({'where':{'name':_0x2d39f0,'userProfileId':_0x55761d[_0x7451('0x4f')]},'raw':!![]})[_0x7451('0x25')](function(_0x123d8f){if(_0x123d8f&&_0x123d8f[_0x7451('0x50')]===0x0){return db[_0x7451('0x29')][_0x7451('0x51')]({'name':_0x24e028[_0x7451('0x2b')],'resourceId':_0x24e028['id'],'type':_0x123d8f['name'],'sectionId':_0x123d8f['id']},{})['then'](function(){return _0x7c23ad;});}else{return _0x7c23ad;}})[_0x7451('0x46')](function(_0x94f802){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x94f802);throw _0x94f802;});}return _0x7c23ad;})['then'](respondWithResult(_0x3acf1d,0xc9))[_0x7451('0x46')](handleError(_0x3acf1d,null));};exports[_0x7451('0x52')]=function(_0x454a88,_0x22c4db){var _0x2e4f1f={'where':{'id':_0x454a88['params']['id']}},_0x9f5737={};_0x9f5737[_0x7451('0x31')]=_['keys'](db['Campaign']['rawAttributes']);_0x2e4f1f[_0x7451('0x36')]=_[_0x7451('0x35')](_0x9f5737[_0x7451('0x31')],qs[_0x7451('0x37')](_0x454a88[_0x7451('0x32')][_0x7451('0x37')]));_0x2e4f1f[_0x7451('0x36')]=_0x2e4f1f['attributes'][_0x7451('0x38')]?_0x2e4f1f[_0x7451('0x36')]:_0x9f5737[_0x7451('0x31')];if(_0x454a88[_0x7451('0x32')][_0x7451('0x49')]){_0x2e4f1f[_0x7451('0x44')]=[{'all':!![]}];}_0x2e4f1f=_[_0x7451('0x3f')]({},_0x2e4f1f,_0x454a88['options']);return db[_0x7451('0x43')][_0x7451('0x4a')](_0x2e4f1f)[_0x7451('0x25')](handleEntityNotFound(_0x22c4db,null))[_0x7451('0x25')](function(_0x2d2150){if(_0x2d2150){var _0x381d34=_0x2d2150['get']({'plain':!![]});_0x381d34=qs[_0x7451('0x53')](_0x381d34,['id','createdAt','updatedAt']);_0x454a88[_0x7451('0x54')]=_[_0x7451('0x53')](_0x454a88[_0x7451('0x54')],['id',_0x7451('0x55'),_0x7451('0x56')]);return db[_0x7451('0x43')]['create'](_[_0x7451('0x3f')](_0x381d34,_0x454a88['body']),{'include':_0x454a88[_0x7451('0x32')][_0x7451('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x4ec362){var _0x4d9bfa=_0x454a88['user'][_0x7451('0x27')]({'plain':!![]});if(!_0x4d9bfa)throw new Error(_0x7451('0x4b'));if(_0x4d9bfa[_0x7451('0x4c')]===_0x7451('0x4d')){var _0x1ba928=_0x4ec362[_0x7451('0x27')]({'plain':!![]});var _0x47a038=_0x7451('0x28');return db['UserProfileSection'][_0x7451('0x4a')]({'where':{'name':_0x47a038,'userProfileId':_0x4d9bfa[_0x7451('0x4f')]},'raw':!![]})[_0x7451('0x25')](function(_0x518f9c){if(_0x518f9c&&_0x518f9c['autoAssociation']===0x0){return db[_0x7451('0x29')][_0x7451('0x51')]({'name':_0x1ba928[_0x7451('0x2b')],'resourceId':_0x1ba928['id'],'type':_0x518f9c[_0x7451('0x2b')],'sectionId':_0x518f9c['id']},{})[_0x7451('0x25')](function(){return _0x4ec362;});}else{return _0x4ec362;}})[_0x7451('0x46')](function(_0x248c6c){logger[_0x7451('0x2a')](_0x7451('0x57'),_0x248c6c);throw _0x248c6c;});}return _0x4ec362;});}})[_0x7451('0x25')](respondWithResult(_0x22c4db,0xc9))['catch'](handleError(_0x22c4db,null));};exports['update']=function(_0x309b9b,_0x20ebb3){if(_0x309b9b[_0x7451('0x54')]['id']){delete _0x309b9b['body']['id'];}return db[_0x7451('0x43')][_0x7451('0x4a')]({'where':{'id':_0x309b9b[_0x7451('0x48')]['id']}})['then'](handleEntityNotFound(_0x20ebb3,null))[_0x7451('0x25')](saveUpdates(_0x309b9b[_0x7451('0x54')],null))['then'](respondWithResult(_0x20ebb3,null))['catch'](handleError(_0x20ebb3,null));};exports[_0x7451('0x26')]=function(_0x373ad2,_0x55d485){return db[_0x7451('0x43')][_0x7451('0x4a')]({'where':{'id':_0x373ad2['params']['id']}})['then'](handleEntityNotFound(_0x55d485,null))['then'](removeEntity(_0x55d485,null))[_0x7451('0x46')](handleError(_0x55d485,null));};exports[_0x7451('0x58')]=function(_0x2021c7,_0x1a6666,_0xf0dd25){var _0x37ed5e={'raw':!![],'where':{}};var _0xd2f69e={};var _0x1158b4={'count':0x0,'rows':[]};return db[_0x7451('0x43')][_0x7451('0x59')]({'where':{'id':_0x2021c7[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x1a6666,null))[_0x7451('0x25')](function(_0x5116fa){if(_0x5116fa){_0xd2f69e[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x5a')][_0x7451('0x2f')]);_0xd2f69e['query']=_[_0x7451('0x33')](_0x2021c7['query']);_0xd2f69e['filters']=_[_0x7451('0x35')](_0xd2f69e[_0x7451('0x31')],_0xd2f69e['query']);_0x37ed5e[_0x7451('0x36')]=_['intersection'](_0xd2f69e[_0x7451('0x31')],qs[_0x7451('0x37')](_0x2021c7[_0x7451('0x32')][_0x7451('0x37')]));_0x37ed5e[_0x7451('0x36')]=_0x37ed5e[_0x7451('0x36')][_0x7451('0x38')]?_0x37ed5e['attributes']:_0xd2f69e['model'];if(!_0x2021c7['query'][_0x7451('0x39')](_0x7451('0x3a'))){_0x37ed5e[_0x7451('0x1d')]=qs[_0x7451('0x1d')](_0x2021c7[_0x7451('0x32')][_0x7451('0x1d')]);_0x37ed5e['offset']=qs['offset'](_0x2021c7[_0x7451('0x32')][_0x7451('0x1f')]);}_0x37ed5e[_0x7451('0x3b')]=qs['sort'](_0x2021c7[_0x7451('0x32')][_0x7451('0x3c')]);_0x37ed5e['where']=qs['filters'](_[_0x7451('0x5b')](_0x2021c7[_0x7451('0x32')],_0xd2f69e[_0x7451('0x34')]));_0x37ed5e[_0x7451('0x3d')][_0x7451('0x5c')]=_0x5116fa['id'];if(_0x2021c7[_0x7451('0x32')][_0x7451('0x3e')]){_0x37ed5e[_0x7451('0x3d')]=_[_0x7451('0x3f')](_0x37ed5e[_0x7451('0x3d')],{'$or':_[_0x7451('0x2e')](_0x37ed5e['attributes'],function(_0x591a81){var _0x4f7641={};_0x4f7641[_0x591a81]={'$like':'%'+_0x2021c7[_0x7451('0x32')][_0x7451('0x3e')]+'%'};return _0x4f7641;})});}_0x37ed5e=_['merge']({},_0x37ed5e,_0x2021c7[_0x7451('0x42')]);return db[_0x7451('0x5a')][_0x7451('0x1e')]({'where':_0x37ed5e[_0x7451('0x3d')]})[_0x7451('0x25')](function(_0x27af89){_0x1158b4[_0x7451('0x1e')]=_0x27af89;if(_0x2021c7[_0x7451('0x32')][_0x7451('0x49')]){_0x37ed5e[_0x7451('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0x7451('0x5d')](_0x37ed5e);})[_0x7451('0x25')](function(_0x51a7ed){_0x1158b4['rows']=_0x51a7ed;return _0x1158b4;});}})['then'](respondWithFilteredResult(_0x1a6666,_0x37ed5e))['catch'](handleError(_0x1a6666,null));};exports[_0x7451('0x5e')]=function(_0x5f850e,_0x2cb5e3,_0x57453e){var _0x360555={'raw':!![],'where':{}};var _0x39d146={};var _0x5e28aa={'count':0x0,'rows':[]};return db[_0x7451('0x43')][_0x7451('0x59')]({'where':{'id':_0x5f850e[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x2cb5e3,null))[_0x7451('0x25')](function(_0x1fea7e){if(_0x1fea7e){_0x39d146[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x5f')][_0x7451('0x2f')]);_0x39d146[_0x7451('0x32')]=_[_0x7451('0x33')](_0x5f850e[_0x7451('0x32')]);_0x39d146[_0x7451('0x34')]=_['intersection'](_0x39d146[_0x7451('0x31')],_0x39d146[_0x7451('0x32')]);_0x360555[_0x7451('0x36')]=_[_0x7451('0x35')](_0x39d146[_0x7451('0x31')],qs[_0x7451('0x37')](_0x5f850e['query'][_0x7451('0x37')]));_0x360555[_0x7451('0x36')]=_0x360555[_0x7451('0x36')]['length']?_0x360555[_0x7451('0x36')]:_0x39d146['model'];if(!_0x5f850e[_0x7451('0x32')]['hasOwnProperty'](_0x7451('0x3a'))){_0x360555[_0x7451('0x1d')]=qs['limit'](_0x5f850e[_0x7451('0x32')]['limit']);_0x360555[_0x7451('0x1f')]=qs[_0x7451('0x1f')](_0x5f850e['query'][_0x7451('0x1f')]);}_0x360555[_0x7451('0x3b')]=qs[_0x7451('0x3c')](_0x5f850e[_0x7451('0x32')][_0x7451('0x3c')]);_0x360555[_0x7451('0x3d')]=qs['filters'](_[_0x7451('0x5b')](_0x5f850e[_0x7451('0x32')],_0x39d146[_0x7451('0x34')]));_0x360555[_0x7451('0x3d')][_0x7451('0x5c')]=_0x1fea7e['id'];if(_0x5f850e[_0x7451('0x32')][_0x7451('0x3e')]){_0x360555[_0x7451('0x3d')]=_[_0x7451('0x3f')](_0x360555[_0x7451('0x3d')],{'$or':_['map'](_0x360555[_0x7451('0x36')],function(_0x45b532){var _0x55c63d={};_0x55c63d[_0x45b532]={'$like':'%'+_0x5f850e['query'][_0x7451('0x3e')]+'%'};return _0x55c63d;})});}_0x360555=_[_0x7451('0x3f')]({},_0x360555,_0x5f850e['options']);return db['CmHopperHistory']['count']({'where':_0x360555[_0x7451('0x3d')]})[_0x7451('0x25')](function(_0x34c76d){_0x5e28aa[_0x7451('0x1e')]=_0x34c76d;if(_0x5f850e[_0x7451('0x32')][_0x7451('0x49')]){_0x360555[_0x7451('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7451('0x5d')](_0x360555);})[_0x7451('0x25')](function(_0x49fb7e){_0x5e28aa[_0x7451('0x45')]=_0x49fb7e;return _0x5e28aa;});}})['then'](respondWithFilteredResult(_0x2cb5e3,_0x360555))[_0x7451('0x46')](handleError(_0x2cb5e3,null));};exports['getHopperFinals']=function(_0x46074c,_0x31c753,_0x253b7f){var _0x36ecae={'raw':!![],'where':{}};var _0x1ce8c1={};var _0x4c6695={'count':0x0,'rows':[]};return db[_0x7451('0x43')][_0x7451('0x59')]({'where':{'id':_0x46074c[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x31c753,null))['then'](function(_0x4c27a9){if(_0x4c27a9){_0x1ce8c1[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x60')][_0x7451('0x2f')]);_0x1ce8c1['query']=_[_0x7451('0x33')](_0x46074c[_0x7451('0x32')]);_0x1ce8c1[_0x7451('0x34')]=_[_0x7451('0x35')](_0x1ce8c1[_0x7451('0x31')],_0x1ce8c1[_0x7451('0x32')]);_0x36ecae[_0x7451('0x36')]=_[_0x7451('0x35')](_0x1ce8c1[_0x7451('0x31')],qs['fields'](_0x46074c['query']['fields']));_0x36ecae['attributes']=_0x36ecae[_0x7451('0x36')]['length']?_0x36ecae[_0x7451('0x36')]:_0x1ce8c1['model'];if(!_0x46074c['query'][_0x7451('0x39')](_0x7451('0x3a'))){_0x36ecae[_0x7451('0x1d')]=qs[_0x7451('0x1d')](_0x46074c['query'][_0x7451('0x1d')]);_0x36ecae[_0x7451('0x1f')]=qs[_0x7451('0x1f')](_0x46074c['query'][_0x7451('0x1f')]);}_0x36ecae[_0x7451('0x3b')]=qs[_0x7451('0x3c')](_0x46074c['query']['sort']);_0x36ecae['where']=qs[_0x7451('0x34')](_[_0x7451('0x5b')](_0x46074c[_0x7451('0x32')],_0x1ce8c1[_0x7451('0x34')]));_0x36ecae['where'][_0x7451('0x5c')]=_0x4c27a9['id'];if(_0x46074c['query'][_0x7451('0x3e')]){_0x36ecae['where']=_[_0x7451('0x3f')](_0x36ecae[_0x7451('0x3d')],{'$or':_[_0x7451('0x2e')](_0x36ecae[_0x7451('0x36')],function(_0x40e431){var _0x599357={};_0x599357[_0x40e431]={'$like':'%'+_0x46074c[_0x7451('0x32')][_0x7451('0x3e')]+'%'};return _0x599357;})});}_0x36ecae=_[_0x7451('0x3f')]({},_0x36ecae,_0x46074c[_0x7451('0x42')]);return db[_0x7451('0x60')]['count']({'where':_0x36ecae[_0x7451('0x3d')]})['then'](function(_0x621325){_0x4c6695[_0x7451('0x1e')]=_0x621325;if(_0x46074c[_0x7451('0x32')][_0x7451('0x49')]){_0x36ecae[_0x7451('0x44')]=[{'all':!![]}];}return db[_0x7451('0x60')][_0x7451('0x5d')](_0x36ecae);})[_0x7451('0x25')](function(_0x4c5b20){_0x4c6695[_0x7451('0x45')]=_0x4c5b20;return _0x4c6695;});}})[_0x7451('0x25')](respondWithFilteredResult(_0x31c753,_0x36ecae))[_0x7451('0x46')](handleError(_0x31c753,null));};exports[_0x7451('0x61')]=function(_0x499cca,_0x3b9f9c,_0x2d43aa){var _0x2d2cdc={'raw':!![],'where':{}};var _0x29f5f1={};var _0x20cc38={'count':0x0,'rows':[]};return db[_0x7451('0x43')][_0x7451('0x59')]({'where':{'id':_0x499cca[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x3b9f9c,null))[_0x7451('0x25')](function(_0x3218b7){if(_0x3218b7){_0x29f5f1[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x62')][_0x7451('0x2f')]);_0x29f5f1[_0x7451('0x32')]=_[_0x7451('0x33')](_0x499cca[_0x7451('0x32')]);_0x29f5f1[_0x7451('0x34')]=_[_0x7451('0x35')](_0x29f5f1[_0x7451('0x31')],_0x29f5f1[_0x7451('0x32')]);_0x2d2cdc[_0x7451('0x36')]=_[_0x7451('0x35')](_0x29f5f1[_0x7451('0x31')],qs[_0x7451('0x37')](_0x499cca[_0x7451('0x32')][_0x7451('0x37')]));_0x2d2cdc[_0x7451('0x36')]=_0x2d2cdc['attributes']['length']?_0x2d2cdc[_0x7451('0x36')]:_0x29f5f1[_0x7451('0x31')];if(!_0x499cca[_0x7451('0x32')][_0x7451('0x39')](_0x7451('0x3a'))){_0x2d2cdc[_0x7451('0x1d')]=qs['limit'](_0x499cca[_0x7451('0x32')][_0x7451('0x1d')]);_0x2d2cdc[_0x7451('0x1f')]=qs['offset'](_0x499cca[_0x7451('0x32')][_0x7451('0x1f')]);}_0x2d2cdc[_0x7451('0x3b')]=qs[_0x7451('0x3c')](_0x499cca[_0x7451('0x32')][_0x7451('0x3c')]);_0x2d2cdc[_0x7451('0x3d')]=qs[_0x7451('0x34')](_[_0x7451('0x5b')](_0x499cca[_0x7451('0x32')],_0x29f5f1['filters']));_0x2d2cdc['where']['CampaignId']=_0x3218b7['id'];if(_0x499cca[_0x7451('0x32')][_0x7451('0x3e')]){_0x2d2cdc['where']=_[_0x7451('0x3f')](_0x2d2cdc[_0x7451('0x3d')],{'$or':_[_0x7451('0x2e')](_0x2d2cdc[_0x7451('0x36')],function(_0x4dc291){var _0x7d613d={};_0x7d613d[_0x4dc291]={'$like':'%'+_0x499cca[_0x7451('0x32')]['filter']+'%'};return _0x7d613d;})});}_0x2d2cdc=_[_0x7451('0x3f')]({},_0x2d2cdc,_0x499cca[_0x7451('0x42')]);return db[_0x7451('0x62')][_0x7451('0x1e')]({'where':_0x2d2cdc[_0x7451('0x3d')]})[_0x7451('0x25')](function(_0x4b610){_0x20cc38[_0x7451('0x1e')]=_0x4b610;if(_0x499cca[_0x7451('0x32')]['includeAll']){_0x2d2cdc[_0x7451('0x44')]=[{'all':!![]}];}return db[_0x7451('0x62')][_0x7451('0x5d')](_0x2d2cdc);})['then'](function(_0xea53d4){_0x20cc38[_0x7451('0x45')]=_0xea53d4;return _0x20cc38;});}})[_0x7451('0x25')](respondWithFilteredResult(_0x3b9f9c,_0x2d2cdc))[_0x7451('0x46')](handleError(_0x3b9f9c,null));};exports['getLists']=function(_0x3d0309,_0x338263,_0x432390){var _0x21b79f={};var _0x3d5e5d={};var _0x5452ec;var _0x59ca2a;return db['Campaign']['findOne']({'where':{'id':_0x3d0309[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x338263,null))['then'](function(_0x4fc914){if(_0x4fc914){_0x5452ec=_0x4fc914;_0x3d5e5d[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x63')]['rawAttributes']);_0x3d5e5d['query']=_[_0x7451('0x33')](_0x3d0309[_0x7451('0x32')]);_0x3d5e5d[_0x7451('0x34')]=_[_0x7451('0x35')](_0x3d5e5d['model'],_0x3d5e5d[_0x7451('0x32')]);_0x21b79f['attributes']=_['intersection'](_0x3d5e5d['model'],qs['fields'](_0x3d0309[_0x7451('0x32')]['fields']));_0x21b79f['attributes']=_0x21b79f[_0x7451('0x36')][_0x7451('0x38')]?_0x21b79f[_0x7451('0x36')]:_0x3d5e5d[_0x7451('0x31')];_0x21b79f[_0x7451('0x3b')]=qs[_0x7451('0x3c')](_0x3d0309[_0x7451('0x32')][_0x7451('0x3c')]);_0x21b79f[_0x7451('0x3d')]=qs[_0x7451('0x34')](_[_0x7451('0x5b')](_0x3d0309['query'],_0x3d5e5d['filters']));if(_0x3d0309[_0x7451('0x32')][_0x7451('0x3e')]){_0x21b79f[_0x7451('0x3d')]=_['merge'](_0x21b79f[_0x7451('0x3d')],{'$or':_[_0x7451('0x2e')](_0x21b79f[_0x7451('0x36')],function(_0x41424c){var _0x2a0a97={};_0x2a0a97[_0x41424c]={'$like':'%'+_0x3d0309[_0x7451('0x32')][_0x7451('0x3e')]+'%'};return _0x2a0a97;})});}_0x21b79f=_['merge']({},_0x21b79f,_0x3d0309[_0x7451('0x42')]);return _0x5452ec[_0x7451('0x64')](_0x21b79f);}})[_0x7451('0x25')](function(_0x474092){if(_0x474092){_0x59ca2a=_0x474092[_0x7451('0x38')];if(!_0x3d0309[_0x7451('0x32')][_0x7451('0x39')]('nolimit')){_0x21b79f[_0x7451('0x1d')]=qs[_0x7451('0x1d')](_0x3d0309[_0x7451('0x32')][_0x7451('0x1d')]);_0x21b79f[_0x7451('0x1f')]=qs['offset'](_0x3d0309[_0x7451('0x32')][_0x7451('0x1f')]);}return _0x5452ec[_0x7451('0x64')](_0x21b79f);}})['then'](function(_0x2e1d8b){if(_0x2e1d8b){return _0x2e1d8b?{'count':_0x59ca2a,'rows':_0x2e1d8b}:null;}})[_0x7451('0x25')](respondWithResult(_0x338263,null))[_0x7451('0x46')](handleError(_0x338263,null));};exports[_0x7451('0x65')]=function(_0x2c632c,_0x197cc6,_0xf62a85){var _0x3a6fae,_0x29d420;var _0x33e344=[];var _0x5c7fa9=moment()[_0x7451('0x66')](_0x7451('0x67'));return db[_0x7451('0x43')]['find']({'where':{'id':_0x2c632c['params']['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x197cc6,null))['then'](function(_0x4672de){if(_0x4672de){_0x29d420=_0x4672de;return _0x4672de[_0x7451('0x65')](_0x2c632c['body'][_0x7451('0x68')],_[_0x7451('0x53')](_0x2c632c[_0x7451('0x54')],['ids','id'])||{});}return null;})['spread'](function(_0x107182){var _0x4eda52;var _0x55adac;_0x3a6fae=_0x107182||[];var _0x230956=[];if(_0x107182){for(var _0x1ee97f=0x0;_0x1ee97f<_0x107182[_0x7451('0x38')];_0x1ee97f+=0x1){var _0xf184f3=_0x107182[_0x1ee97f]['get']({'plain':!![]});_0x29d420[_0x7451('0x69')]=_0x2c632c[_0x7451('0x54')]['dialCheckDuplicateType']?_0x2c632c[_0x7451('0x54')][_0x7451('0x69')]:_0x29d420['dialCheckDuplicateType'];switch(_0x29d420[_0x7451('0x69')]){case'always':_0x4eda52=squel[_0x7451('0x6a')]()[_0x7451('0x6b')](_0x7451('0x6c'))[_0x7451('0x6d')]([_0x7451('0x6e'),'scheduledAt',_0x7451('0x6f'),_0x7451('0x70'),'CampaignId',_0x7451('0x55'),_0x7451('0x56')],squel[_0x7451('0x71')]()[_0x7451('0x72')](_0x7451('0x6e'),_0x7451('0x6e'))[_0x7451('0x72')](_0x7451('0x73'),_0x7451('0x74'))[_0x7451('0x72')]('id',_0x7451('0x6f'))[_0x7451('0x72')](_0xf184f3[_0x7451('0x75')][_0x7451('0x76')](),_0x7451('0x70'))['field'](_0x2c632c['params']['id'][_0x7451('0x76')](),_0x7451('0x5c'))[_0x7451('0x72')]('\x27'+_0x5c7fa9+'\x27',_0x7451('0x55'))[_0x7451('0x72')]('\x27'+_0x5c7fa9+'\x27',_0x7451('0x56'))[_0x7451('0x77')](_0x7451('0x78'))[_0x7451('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0x7451('0x79'),_0xf184f3['CmListId']['toString']())[_0x7451('0x3d')](_0x7451('0x7a'))[_0x7451('0x3d')](_0x7451('0x7b'),squel['select']()[_0x7451('0x72')](_0x7451('0x7c'))['from'](_0x7451('0x7d'))[_0x7451('0x3d')](_0x7451('0x7e'),_0x2c632c[_0x7451('0x48')]['id'][_0x7451('0x76')]()))[_0x7451('0x3d')](_0x7451('0x7b'),squel[_0x7451('0x71')]()[_0x7451('0x72')]('COALESCE(phone,\x27\x27)')['from'](_0x7451('0x6c'))['where']('CampaignId\x20=\x20?',_0x2c632c[_0x7451('0x48')]['id'][_0x7451('0x76')]())))[_0x7451('0x76')]();break;case _0x7451('0x7f'):_0x4eda52=squel[_0x7451('0x6a')]()[_0x7451('0x6b')](_0x7451('0x6c'))[_0x7451('0x6d')]([_0x7451('0x6e'),_0x7451('0x74'),_0x7451('0x6f'),_0x7451('0x70'),'CampaignId',_0x7451('0x55'),_0x7451('0x56')],squel['select']()[_0x7451('0x72')]('phone',_0x7451('0x6e'))[_0x7451('0x72')]('NOW()','scheduledAt')['field']('id',_0x7451('0x6f'))[_0x7451('0x72')](_0xf184f3['CmListId'][_0x7451('0x76')](),'ListId')[_0x7451('0x72')](_0x2c632c[_0x7451('0x48')]['id'][_0x7451('0x76')](),_0x7451('0x5c'))[_0x7451('0x72')]('\x27'+_0x5c7fa9+'\x27',_0x7451('0x55'))[_0x7451('0x72')]('\x27'+_0x5c7fa9+'\x27','updatedAt')['from'](_0x7451('0x78'))[_0x7451('0x3d')](_0x7451('0x80'))[_0x7451('0x3d')](_0x7451('0x79'),_0xf184f3[_0x7451('0x75')][_0x7451('0x76')]())[_0x7451('0x3d')](_0x7451('0x7a'))[_0x7451('0x3d')](_0x7451('0x7b'),squel['select']()[_0x7451('0x72')](_0x7451('0x81'))[_0x7451('0x77')](_0x7451('0x6c'))[_0x7451('0x3d')](_0x7451('0x7e'),_0x2c632c['params']['id']['toString']())))[_0x7451('0x76')]();break;default:_0x4eda52=squel[_0x7451('0x6a')]()[_0x7451('0x6b')](_0x7451('0x6c'))[_0x7451('0x6d')]([_0x7451('0x6e'),'scheduledAt',_0x7451('0x6f'),_0x7451('0x70'),_0x7451('0x5c'),_0x7451('0x55'),_0x7451('0x56')],squel[_0x7451('0x71')]()[_0x7451('0x72')](_0x7451('0x6e'),_0x7451('0x6e'))[_0x7451('0x72')](_0x7451('0x73'),_0x7451('0x74'))[_0x7451('0x72')]('id','ContactId')[_0x7451('0x72')](_0xf184f3['CmListId'][_0x7451('0x76')](),_0x7451('0x70'))['field'](_0x2c632c[_0x7451('0x48')]['id']['toString'](),_0x7451('0x5c'))[_0x7451('0x72')]('\x27'+_0x5c7fa9+'\x27','createdAt')['field']('\x27'+_0x5c7fa9+'\x27','updatedAt')['from'](_0x7451('0x78'))['where'](_0x7451('0x80'))[_0x7451('0x3d')]('ListId\x20=\x20?',_0xf184f3[_0x7451('0x75')][_0x7451('0x76')]())['where'](_0x7451('0x7a')))[_0x7451('0x76')]();}_0x55adac=squel['insert']()['into'](_0x7451('0x82'))['fromQuery']([_0x7451('0x83'),_0x7451('0x74'),_0x7451('0x6e'),'OrderBy',_0x7451('0x55'),_0x7451('0x56')],squel[_0x7451('0x71')]()[_0x7451('0x72')](_0x7451('0x84'),'id')['field'](_0x7451('0x73'),_0x7451('0x74'))[_0x7451('0x72')](_0x7451('0x85'),_0x7451('0x6e'))[_0x7451('0x72')](_0x7451('0x86'),_0x7451('0x87'))[_0x7451('0x72')]('\x27'+_0x5c7fa9+'\x27',_0x7451('0x55'))[_0x7451('0x72')]('\x27'+_0x5c7fa9+'\x27','updatedAt')[_0x7451('0x77')](_0x7451('0x88'),'ci')['join'](_0x7451('0x6c'),'h',_0x7451('0x89'))[_0x7451('0x3d')](_0x7451('0x8a'),_0xf184f3[_0x7451('0x75')][_0x7451('0x76')]())[_0x7451('0x3d')](_0x7451('0x8b'),_0x2c632c['params']['id'][_0x7451('0x76')]())['where'](_0x7451('0x8c'),_0x5c7fa9))[_0x7451('0x76')]();_0x230956['push'](db[_0x7451('0x8d')][_0x7451('0x32')](_0x4eda52));_0x33e344[_0x7451('0x8e')](db[_0x7451('0x8d')]['query'](_0x55adac));}return BPromise[_0x7451('0x8f')](_0x230956);}})[_0x7451('0x25')](function(){return BPromise[_0x7451('0x8f')](_0x33e344);})[_0x7451('0x25')](function(){return _0x3a6fae;})['then'](respondWithResult(_0x197cc6,null))[_0x7451('0x46')](handleError(_0x197cc6,null));};exports[_0x7451('0x90')]=function(_0x20b2cf,_0x498083,_0x4c32d9){return db['Campaign'][_0x7451('0x4a')]({'where':{'id':_0x20b2cf[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x498083,null))[_0x7451('0x25')](function(_0x15eb6d){if(_0x15eb6d){return _0x15eb6d[_0x7451('0x90')](_0x20b2cf[_0x7451('0x32')][_0x7451('0x68')]);}})[_0x7451('0x25')](function(_0x5881ec){if(_0x5881ec){return db[_0x7451('0x5a')][_0x7451('0x26')]({'where':{'ListId':_0x20b2cf['query'][_0x7451('0x68')],'CampaignId':_0x20b2cf[_0x7451('0x48')]['id']}})[_0x7451('0x25')](function(){return _0x5881ec;});}})['then'](respondWithStatusCode(_0x498083,null))[_0x7451('0x46')](handleError(_0x498083,null));};exports[_0x7451('0x91')]=function(_0x21c831,_0x5af9d3,_0x59049f){var _0x31c337={};var _0x2d6932={};var _0x425d85;var _0x2ec2bd;return db[_0x7451('0x43')][_0x7451('0x59')]({'where':{'id':_0x21c831['params']['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x5af9d3,null))['then'](function(_0x1c7e3c){if(_0x1c7e3c){_0x425d85=_0x1c7e3c;_0x2d6932['model']=_[_0x7451('0x33')](db[_0x7451('0x63')][_0x7451('0x2f')]);_0x2d6932[_0x7451('0x32')]=_['keys'](_0x21c831[_0x7451('0x32')]);_0x2d6932['filters']=_['intersection'](_0x2d6932['model'],_0x2d6932['query']);_0x31c337[_0x7451('0x36')]=_[_0x7451('0x35')](_0x2d6932['model'],qs['fields'](_0x21c831[_0x7451('0x32')][_0x7451('0x37')]));_0x31c337[_0x7451('0x36')]=_0x31c337[_0x7451('0x36')][_0x7451('0x38')]?_0x31c337[_0x7451('0x36')]:_0x2d6932[_0x7451('0x31')];_0x31c337[_0x7451('0x3b')]=qs[_0x7451('0x3c')](_0x21c831['query'][_0x7451('0x3c')]);_0x31c337[_0x7451('0x3d')]=qs[_0x7451('0x34')](_[_0x7451('0x5b')](_0x21c831['query'],_0x2d6932[_0x7451('0x34')]));if(_0x21c831[_0x7451('0x32')][_0x7451('0x3e')]){_0x31c337['where']=_[_0x7451('0x3f')](_0x31c337['where'],{'$or':_[_0x7451('0x2e')](_0x31c337[_0x7451('0x36')],function(_0x246d10){var _0x2598cb={};_0x2598cb[_0x246d10]={'$like':'%'+_0x21c831['query'][_0x7451('0x3e')]+'%'};return _0x2598cb;})});}_0x31c337=_[_0x7451('0x3f')]({},_0x31c337,_0x21c831[_0x7451('0x42')]);return _0x425d85[_0x7451('0x91')](_0x31c337);}})[_0x7451('0x25')](function(_0x563bf4){if(_0x563bf4){_0x2ec2bd=_0x563bf4['length'];if(!_0x21c831[_0x7451('0x32')][_0x7451('0x39')](_0x7451('0x3a'))){_0x31c337['limit']=qs['limit'](_0x21c831[_0x7451('0x32')][_0x7451('0x1d')]);_0x31c337[_0x7451('0x1f')]=qs[_0x7451('0x1f')](_0x21c831[_0x7451('0x32')][_0x7451('0x1f')]);}return _0x425d85['getBlackLists'](_0x31c337);}})[_0x7451('0x25')](function(_0x16201b){if(_0x16201b){return _0x16201b?{'count':_0x2ec2bd,'rows':_0x16201b}:null;}})[_0x7451('0x25')](respondWithResult(_0x5af9d3,null))[_0x7451('0x46')](handleError(_0x5af9d3,null));};exports[_0x7451('0x92')]=function(_0x4830c9,_0x37997b,_0x4a6e9f){var _0x391961,_0x1cd71e;var _0x264282=[];var _0x5be6f8=moment()[_0x7451('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign']['find']({'where':{'id':_0x4830c9[_0x7451('0x48')]['id']}})['then'](handleEntityNotFound(_0x37997b,null))[_0x7451('0x25')](function(_0x41a623){if(_0x41a623){_0x1cd71e=_0x41a623;return _0x41a623[_0x7451('0x92')](_0x4830c9['body'][_0x7451('0x68')],_[_0x7451('0x53')](_0x4830c9[_0x7451('0x54')],[_0x7451('0x68'),'id'])||{});}return null;})['spread'](function(_0x45d379){var _0x44d06d;var _0xb0ccb9;_0x391961=_0x45d379||[];var _0x4658f7=[];if(_0x45d379){for(var _0xb4d0f6=0x0;_0xb4d0f6<_0x45d379[_0x7451('0x38')];_0xb4d0f6+=0x1){var _0x33e467=_0x45d379[_0xb4d0f6][_0x7451('0x27')]({'plain':!![]});_0x44d06d=squel['insert']()[_0x7451('0x6b')]('cm_hopper_black')[_0x7451('0x6d')]([_0x7451('0x6e'),_0x7451('0x6f'),'ListId','CampaignId',_0x7451('0x55'),_0x7451('0x56')],squel[_0x7451('0x71')]()[_0x7451('0x72')]('phone',_0x7451('0x6e'))[_0x7451('0x72')]('id',_0x7451('0x6f'))[_0x7451('0x72')](_0x33e467[_0x7451('0x75')][_0x7451('0x76')](),'ListId')[_0x7451('0x72')](_0x4830c9[_0x7451('0x48')]['id'][_0x7451('0x76')](),_0x7451('0x5c'))['field'](_0x7451('0x73'),_0x7451('0x55'))['field'](_0x7451('0x73'),_0x7451('0x56'))['from'](_0x7451('0x78'))[_0x7451('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0x7451('0x79'),_0x33e467[_0x7451('0x75')][_0x7451('0x76')]())[_0x7451('0x3d')](_0x7451('0x7a')))['toString']();_0x4658f7['push'](db[_0x7451('0x8d')][_0x7451('0x32')](_0x44d06d));}return BPromise[_0x7451('0x8f')](_0x4658f7);}})[_0x7451('0x25')](function(){return _0x391961;})[_0x7451('0x25')](respondWithResult(_0x37997b,null))['catch'](handleError(_0x37997b,null));};exports[_0x7451('0x93')]=function(_0x3dff42,_0x3cfd14,_0x5ca0bc){return db[_0x7451('0x43')]['find']({'where':{'id':_0x3dff42[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x3cfd14,null))[_0x7451('0x25')](function(_0x4345ad){if(_0x4345ad){return _0x4345ad[_0x7451('0x93')](_0x3dff42[_0x7451('0x32')][_0x7451('0x68')]);}})[_0x7451('0x25')](function(_0x338952){if(_0x338952){return db[_0x7451('0x62')]['destroy']({'where':{'ListId':_0x3dff42[_0x7451('0x32')][_0x7451('0x68')],'CampaignId':_0x3dff42[_0x7451('0x48')]['id']}})[_0x7451('0x25')](function(){return _0x338952;});}})['then'](respondWithStatusCode(_0x3cfd14,null))[_0x7451('0x46')](handleError(_0x3cfd14,null));}; \ No newline at end of file +var _0x4227=['crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','show','params','fields','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','CmHopper','hasOwnProperty','CampaignId','findAll','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','insert','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.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x4227,0x89));var _0x7422=function(_0x1fee3b,_0x2c538d){_0x1fee3b=_0x1fee3b-0x0;var _0x5c97de=_0x4227[_0x1fee3b];return _0x5c97de;};'use strict';var emlformat=require(_0x7422('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7422('0x1'));var rp=require('request-promise');var moment=require(_0x7422('0x2'));var BPromise=require(_0x7422('0x3'));var Mustache=require(_0x7422('0x4'));var util=require('util');var path=require(_0x7422('0x5'));var sox=require(_0x7422('0x6'));var csv=require(_0x7422('0x7'));var ejs=require(_0x7422('0x8'));var fs=require('fs');var fs_extra=require(_0x7422('0x9'));var _=require(_0x7422('0xa'));var squel=require(_0x7422('0xb'));var crypto=require(_0x7422('0xc'));var jsforce=require(_0x7422('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7422('0x7'));var querystring=require(_0x7422('0xe'));var Papa=require(_0x7422('0xf'));var Redis=require('ioredis');var authService=require(_0x7422('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7422('0x11'));var hardwareService=require(_0x7422('0x12'));var logger=require(_0x7422('0x13'))(_0x7422('0x14'));var utils=require(_0x7422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7422('0x16'));var db=require(_0x7422('0x17'))['db'];function respondWithStatusCode(_0x575c47,_0xb06dc6){_0xb06dc6=_0xb06dc6||0xcc;return function(_0x2acd6c){if(_0x2acd6c){return _0x575c47['sendStatus'](_0xb06dc6);}return _0x575c47[_0x7422('0x18')](_0xb06dc6)[_0x7422('0x19')]();};}function respondWithResult(_0x555082,_0x4d3f91){_0x4d3f91=_0x4d3f91||0xc8;return function(_0xeafd58){if(_0xeafd58){return _0x555082['status'](_0x4d3f91)[_0x7422('0x1a')](_0xeafd58);}};}function respondWithFilteredResult(_0x788829,_0x487c93){return function(_0x149c50){if(_0x149c50){var _0x39c31c=typeof _0x487c93[_0x7422('0x1b')]===_0x7422('0x1c')&&typeof _0x487c93[_0x7422('0x1d')]===_0x7422('0x1c');var _0x4e2b60=_0x149c50[_0x7422('0x1e')];var _0xa7ff41=_0x39c31c?0x0:_0x487c93[_0x7422('0x1b')];var _0x30656d=_0x39c31c?_0x149c50['count']:_0x487c93[_0x7422('0x1b')]+_0x487c93['limit'];var _0x22a1c8;if(_0x30656d>=_0x4e2b60){_0x30656d=_0x4e2b60;_0x22a1c8=0xc8;}else{_0x22a1c8=0xce;}_0x788829[_0x7422('0x18')](_0x22a1c8);return _0x788829[_0x7422('0x1f')]('Content-Range',_0xa7ff41+'-'+_0x30656d+'/'+_0x4e2b60)[_0x7422('0x1a')](_0x149c50);}return null;};}function patchUpdates(_0xacaad1){return function(_0x368e96){try{jsonpatch[_0x7422('0x20')](_0x368e96,_0xacaad1,!![]);}catch(_0x55f98f){return BPromise['reject'](_0x55f98f);}return _0x368e96[_0x7422('0x21')]();};}function saveUpdates(_0x380ef7,_0x20c1e3){return function(_0x7d34f2){if(_0x7d34f2){return _0x7d34f2[_0x7422('0x22')](_0x380ef7)[_0x7422('0x23')](function(_0xe4f174){return _0xe4f174;});}return null;};}function removeEntity(_0x596b89,_0x24ce62){return function(_0x46b927){if(_0x46b927){return _0x46b927['destroy']()[_0x7422('0x23')](function(){var _0x23fb68=_0x46b927[_0x7422('0x24')]({'plain':!![]});var _0x3eeb9c='IvrCampaigns';return db[_0x7422('0x25')][_0x7422('0x26')]({'where':{'type':_0x3eeb9c,'resourceId':_0x23fb68['id']}})[_0x7422('0x23')](function(){return _0x46b927;});})[_0x7422('0x23')](function(){_0x596b89[_0x7422('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34f1b0,_0x9c29c0){return function(_0x81c27e){if(!_0x81c27e){_0x34f1b0[_0x7422('0x27')](0x194);}return _0x81c27e;};}function handleError(_0x5ae0f7,_0x474aa8){_0x474aa8=_0x474aa8||0x1f4;return function(_0x20f71e){logger[_0x7422('0x28')](_0x20f71e[_0x7422('0x29')]);if(_0x20f71e['name']){delete _0x20f71e[_0x7422('0x2a')];}_0x5ae0f7[_0x7422('0x18')](_0x474aa8)['send'](_0x20f71e);};}exports['index']=function(_0x2baac6,_0x2fb125){var _0x5e08f7={},_0x1d5ae5={},_0x194a5e={'count':0x0,'rows':[]};var _0x3f577e=_[_0x7422('0x2b')](db[_0x7422('0x2c')][_0x7422('0x2d')],function(_0x212a66){return{'name':_0x212a66[_0x7422('0x2e')],'type':_0x212a66[_0x7422('0x2f')][_0x7422('0x30')]};});_0x1d5ae5[_0x7422('0x31')]=_['map'](_0x3f577e,_0x7422('0x2a'));_0x1d5ae5[_0x7422('0x32')]=_[_0x7422('0x33')](_0x2baac6[_0x7422('0x32')]);_0x1d5ae5['filters']=_[_0x7422('0x34')](_0x1d5ae5[_0x7422('0x31')],_0x1d5ae5[_0x7422('0x32')]);_0x5e08f7['attributes']=_['intersection'](_0x1d5ae5[_0x7422('0x31')],qs['fields'](_0x2baac6[_0x7422('0x32')]['fields']));_0x5e08f7[_0x7422('0x35')]=_0x5e08f7['attributes'][_0x7422('0x36')]?_0x5e08f7['attributes']:_0x1d5ae5['model'];if(!_0x2baac6[_0x7422('0x32')]['hasOwnProperty'](_0x7422('0x37'))){_0x5e08f7[_0x7422('0x1d')]=qs[_0x7422('0x1d')](_0x2baac6[_0x7422('0x32')][_0x7422('0x1d')]);_0x5e08f7[_0x7422('0x1b')]=qs[_0x7422('0x1b')](_0x2baac6['query'][_0x7422('0x1b')]);}_0x5e08f7[_0x7422('0x38')]=qs[_0x7422('0x39')](_0x2baac6[_0x7422('0x32')][_0x7422('0x39')]);_0x5e08f7['where']=qs[_0x7422('0x3a')](_[_0x7422('0x3b')](_0x2baac6['query'],_0x1d5ae5[_0x7422('0x3a')]),_0x3f577e);if(_0x2baac6['query'][_0x7422('0x3c')]){_0x5e08f7['where']=_['merge'](_0x5e08f7[_0x7422('0x3d')],{'$or':_[_0x7422('0x2b')](_0x3f577e,function(_0x2bcd3c){if(_0x2bcd3c['type']!==_0x7422('0x3e')){var _0x39f194={};_0x39f194[_0x2bcd3c['name']]={'$like':'%'+_0x2baac6[_0x7422('0x32')]['filter']+'%'};return _0x39f194;}})});}_0x5e08f7=_[_0x7422('0x3f')]({},_0x5e08f7,_0x2baac6[_0x7422('0x40')]);var _0x45ce6d={'where':_0x5e08f7[_0x7422('0x3d')]};return db[_0x7422('0x2c')][_0x7422('0x1e')](_0x45ce6d)[_0x7422('0x23')](function(_0x50b48f){_0x194a5e[_0x7422('0x1e')]=_0x50b48f;if(_0x2baac6[_0x7422('0x32')]['includeAll']){_0x5e08f7[_0x7422('0x41')]=[{'all':!![]}];}return db[_0x7422('0x2c')]['findAll'](_0x5e08f7);})[_0x7422('0x23')](function(_0x4e2cd4){_0x194a5e[_0x7422('0x42')]=_0x4e2cd4;return _0x194a5e;})['then'](respondWithFilteredResult(_0x2fb125,_0x5e08f7))[_0x7422('0x43')](handleError(_0x2fb125,null));};exports[_0x7422('0x44')]=function(_0xcea170,_0x2b5d09){var _0x451ebb={'raw':![],'where':{'id':_0xcea170[_0x7422('0x45')]['id']}},_0x208e72={};_0x208e72[_0x7422('0x31')]=_[_0x7422('0x33')](db[_0x7422('0x2c')]['rawAttributes']);_0x208e72[_0x7422('0x32')]=_['keys'](_0xcea170['query']);_0x208e72[_0x7422('0x3a')]=_[_0x7422('0x34')](_0x208e72['model'],_0x208e72[_0x7422('0x32')]);_0x451ebb[_0x7422('0x35')]=_[_0x7422('0x34')](_0x208e72[_0x7422('0x31')],qs[_0x7422('0x46')](_0xcea170[_0x7422('0x32')][_0x7422('0x46')]));_0x451ebb['attributes']=_0x451ebb[_0x7422('0x35')][_0x7422('0x36')]?_0x451ebb[_0x7422('0x35')]:_0x208e72[_0x7422('0x31')];if(_0xcea170['query'][_0x7422('0x47')]){_0x451ebb[_0x7422('0x41')]=[{'all':!![]}];}_0x451ebb=_[_0x7422('0x3f')]({},_0x451ebb,_0xcea170['options']);return db[_0x7422('0x2c')][_0x7422('0x48')](_0x451ebb)['then'](handleEntityNotFound(_0x2b5d09,null))['then'](respondWithResult(_0x2b5d09,null))['catch'](handleError(_0x2b5d09,null));};exports[_0x7422('0x49')]=function(_0xbbc9ab,_0x5b4694){return db[_0x7422('0x2c')]['create'](_0xbbc9ab[_0x7422('0x4a')],{})[_0x7422('0x23')](function(_0x2986ec){var _0x2a9ad4=_0xbbc9ab['user']['get']({'plain':!![]});if(!_0x2a9ad4)throw new Error(_0x7422('0x4b'));if(_0x2a9ad4[_0x7422('0x4c')]==='user'){var _0x121983=_0x2986ec[_0x7422('0x24')]({'plain':!![]});var _0x5034f8=_0x7422('0x4d');return db[_0x7422('0x4e')][_0x7422('0x48')]({'where':{'name':_0x5034f8,'userProfileId':_0x2a9ad4[_0x7422('0x4f')]},'raw':!![]})[_0x7422('0x23')](function(_0x2c6257){if(_0x2c6257&&_0x2c6257[_0x7422('0x50')]===0x0){return db[_0x7422('0x25')][_0x7422('0x49')]({'name':_0x121983[_0x7422('0x2a')],'resourceId':_0x121983['id'],'type':_0x2c6257['name'],'sectionId':_0x2c6257['id']},{})[_0x7422('0x23')](function(){return _0x2986ec;});}else{return _0x2986ec;}})[_0x7422('0x43')](function(_0x253e3d){logger['error'](_0x7422('0x51'),_0x253e3d);throw _0x253e3d;});}return _0x2986ec;})[_0x7422('0x23')](respondWithResult(_0x5b4694,0xc9))[_0x7422('0x43')](handleError(_0x5b4694,null));};exports[_0x7422('0x52')]=function(_0x3e64f3,_0x3d2cd4){var _0x55efae={'where':{'id':_0x3e64f3[_0x7422('0x45')]['id']}},_0x281e14={};_0x281e14[_0x7422('0x31')]=_[_0x7422('0x33')](db[_0x7422('0x2c')][_0x7422('0x2d')]);_0x55efae[_0x7422('0x35')]=_['intersection'](_0x281e14[_0x7422('0x31')],qs['fields'](_0x3e64f3['query'][_0x7422('0x46')]));_0x55efae['attributes']=_0x55efae[_0x7422('0x35')][_0x7422('0x36')]?_0x55efae[_0x7422('0x35')]:_0x281e14['model'];if(_0x3e64f3[_0x7422('0x32')][_0x7422('0x47')]){_0x55efae[_0x7422('0x41')]=[{'all':!![]}];}_0x55efae=_[_0x7422('0x3f')]({},_0x55efae,_0x3e64f3['options']);return db['Campaign'][_0x7422('0x48')](_0x55efae)[_0x7422('0x23')](handleEntityNotFound(_0x3d2cd4,null))['then'](function(_0x5e8802){if(_0x5e8802){var _0x3606ce=_0x5e8802[_0x7422('0x24')]({'plain':!![]});_0x3606ce=qs[_0x7422('0x53')](_0x3606ce,['id',_0x7422('0x54'),_0x7422('0x55')]);_0x3e64f3[_0x7422('0x4a')]=_[_0x7422('0x53')](_0x3e64f3[_0x7422('0x4a')],['id',_0x7422('0x54'),_0x7422('0x55')]);return db['Campaign'][_0x7422('0x49')](_[_0x7422('0x3f')](_0x3606ce,_0x3e64f3[_0x7422('0x4a')]),{'include':_0x3e64f3[_0x7422('0x32')][_0x7422('0x47')]?[{'all':!![]}]:undefined})[_0x7422('0x23')](function(_0x485654){var _0x2a7bf0=_0x3e64f3[_0x7422('0x56')][_0x7422('0x24')]({'plain':!![]});if(!_0x2a7bf0)throw new Error(_0x7422('0x4b'));if(_0x2a7bf0[_0x7422('0x4c')]===_0x7422('0x56')){var _0xe6d00c=_0x485654[_0x7422('0x24')]({'plain':!![]});var _0x529c48='IvrCampaigns';return db[_0x7422('0x4e')][_0x7422('0x48')]({'where':{'name':_0x529c48,'userProfileId':_0x2a7bf0[_0x7422('0x4f')]},'raw':!![]})['then'](function(_0x405238){if(_0x405238&&_0x405238['autoAssociation']===0x0){return db['UserProfileResource'][_0x7422('0x49')]({'name':_0xe6d00c['name'],'resourceId':_0xe6d00c['id'],'type':_0x405238[_0x7422('0x2a')],'sectionId':_0x405238['id']},{})[_0x7422('0x23')](function(){return _0x485654;});}else{return _0x485654;}})[_0x7422('0x43')](function(_0x108e72){logger[_0x7422('0x28')](_0x7422('0x51'),_0x108e72);throw _0x108e72;});}return _0x485654;});}})[_0x7422('0x23')](respondWithResult(_0x3d2cd4,0xc9))[_0x7422('0x43')](handleError(_0x3d2cd4,null));};exports[_0x7422('0x22')]=function(_0x26f729,_0x2b7023){if(_0x26f729['body']['id']){delete _0x26f729[_0x7422('0x4a')]['id'];}return db[_0x7422('0x2c')][_0x7422('0x48')]({'where':{'id':_0x26f729[_0x7422('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b7023,null))[_0x7422('0x23')](saveUpdates(_0x26f729['body'],null))[_0x7422('0x23')](respondWithResult(_0x2b7023,null))['catch'](handleError(_0x2b7023,null));};exports[_0x7422('0x26')]=function(_0x1de215,_0x5b2ed3){return db[_0x7422('0x2c')][_0x7422('0x48')]({'where':{'id':_0x1de215[_0x7422('0x45')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x5b2ed3,null))[_0x7422('0x23')](removeEntity(_0x5b2ed3,null))[_0x7422('0x43')](handleError(_0x5b2ed3,null));};exports['getHoppers']=function(_0x1fdfa9,_0x2012f0,_0x5e7973){var _0x122df8={'raw':!![],'where':{}};var _0x9ef112={};var _0x50ff6f={'count':0x0,'rows':[]};return db[_0x7422('0x2c')]['findOne']({'where':{'id':_0x1fdfa9[_0x7422('0x45')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x2012f0,null))[_0x7422('0x23')](function(_0x1b9ce9){if(_0x1b9ce9){_0x9ef112[_0x7422('0x31')]=_[_0x7422('0x33')](db[_0x7422('0x57')]['rawAttributes']);_0x9ef112[_0x7422('0x32')]=_['keys'](_0x1fdfa9[_0x7422('0x32')]);_0x9ef112[_0x7422('0x3a')]=_['intersection'](_0x9ef112[_0x7422('0x31')],_0x9ef112[_0x7422('0x32')]);_0x122df8[_0x7422('0x35')]=_[_0x7422('0x34')](_0x9ef112['model'],qs['fields'](_0x1fdfa9[_0x7422('0x32')][_0x7422('0x46')]));_0x122df8[_0x7422('0x35')]=_0x122df8[_0x7422('0x35')][_0x7422('0x36')]?_0x122df8[_0x7422('0x35')]:_0x9ef112[_0x7422('0x31')];if(!_0x1fdfa9[_0x7422('0x32')][_0x7422('0x58')]('nolimit')){_0x122df8[_0x7422('0x1d')]=qs['limit'](_0x1fdfa9['query'][_0x7422('0x1d')]);_0x122df8['offset']=qs['offset'](_0x1fdfa9[_0x7422('0x32')][_0x7422('0x1b')]);}_0x122df8[_0x7422('0x38')]=qs[_0x7422('0x39')](_0x1fdfa9[_0x7422('0x32')][_0x7422('0x39')]);_0x122df8[_0x7422('0x3d')]=qs[_0x7422('0x3a')](_['pick'](_0x1fdfa9[_0x7422('0x32')],_0x9ef112[_0x7422('0x3a')]));_0x122df8[_0x7422('0x3d')][_0x7422('0x59')]=_0x1b9ce9['id'];if(_0x1fdfa9['query'][_0x7422('0x3c')]){_0x122df8[_0x7422('0x3d')]=_[_0x7422('0x3f')](_0x122df8[_0x7422('0x3d')],{'$or':_['map'](_0x122df8[_0x7422('0x35')],function(_0xcc17f7){var _0xdc8f78={};_0xdc8f78[_0xcc17f7]={'$like':'%'+_0x1fdfa9['query'][_0x7422('0x3c')]+'%'};return _0xdc8f78;})});}_0x122df8=_[_0x7422('0x3f')]({},_0x122df8,_0x1fdfa9[_0x7422('0x40')]);return db[_0x7422('0x57')][_0x7422('0x1e')]({'where':_0x122df8[_0x7422('0x3d')]})[_0x7422('0x23')](function(_0x4e63a0){_0x50ff6f[_0x7422('0x1e')]=_0x4e63a0;if(_0x1fdfa9[_0x7422('0x32')][_0x7422('0x47')]){_0x122df8[_0x7422('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0x7422('0x5a')](_0x122df8);})['then'](function(_0x86b363){_0x50ff6f[_0x7422('0x42')]=_0x86b363;return _0x50ff6f;});}})[_0x7422('0x23')](respondWithFilteredResult(_0x2012f0,_0x122df8))['catch'](handleError(_0x2012f0,null));};exports[_0x7422('0x5b')]=function(_0x171e0a,_0xd69503,_0x5ec62f){var _0x1effdf={'raw':!![],'where':{}};var _0x1eed19={};var _0x44e8d4={'count':0x0,'rows':[]};return db['Campaign'][_0x7422('0x5c')]({'where':{'id':_0x171e0a[_0x7422('0x45')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0xd69503,null))[_0x7422('0x23')](function(_0x27219a){if(_0x27219a){_0x1eed19[_0x7422('0x31')]=_[_0x7422('0x33')](db['CmHopperHistory'][_0x7422('0x2d')]);_0x1eed19[_0x7422('0x32')]=_[_0x7422('0x33')](_0x171e0a[_0x7422('0x32')]);_0x1eed19[_0x7422('0x3a')]=_[_0x7422('0x34')](_0x1eed19[_0x7422('0x31')],_0x1eed19[_0x7422('0x32')]);_0x1effdf[_0x7422('0x35')]=_[_0x7422('0x34')](_0x1eed19[_0x7422('0x31')],qs[_0x7422('0x46')](_0x171e0a[_0x7422('0x32')][_0x7422('0x46')]));_0x1effdf[_0x7422('0x35')]=_0x1effdf[_0x7422('0x35')]['length']?_0x1effdf[_0x7422('0x35')]:_0x1eed19[_0x7422('0x31')];if(!_0x171e0a[_0x7422('0x32')][_0x7422('0x58')]('nolimit')){_0x1effdf[_0x7422('0x1d')]=qs[_0x7422('0x1d')](_0x171e0a['query'][_0x7422('0x1d')]);_0x1effdf[_0x7422('0x1b')]=qs['offset'](_0x171e0a[_0x7422('0x32')][_0x7422('0x1b')]);}_0x1effdf[_0x7422('0x38')]=qs[_0x7422('0x39')](_0x171e0a['query'][_0x7422('0x39')]);_0x1effdf[_0x7422('0x3d')]=qs[_0x7422('0x3a')](_['pick'](_0x171e0a[_0x7422('0x32')],_0x1eed19[_0x7422('0x3a')]));_0x1effdf[_0x7422('0x3d')]['CampaignId']=_0x27219a['id'];if(_0x171e0a[_0x7422('0x32')][_0x7422('0x3c')]){_0x1effdf[_0x7422('0x3d')]=_[_0x7422('0x3f')](_0x1effdf[_0x7422('0x3d')],{'$or':_['map'](_0x1effdf[_0x7422('0x35')],function(_0x461d4f){var _0x1bff7f={};_0x1bff7f[_0x461d4f]={'$like':'%'+_0x171e0a['query'][_0x7422('0x3c')]+'%'};return _0x1bff7f;})});}_0x1effdf=_[_0x7422('0x3f')]({},_0x1effdf,_0x171e0a[_0x7422('0x40')]);return db[_0x7422('0x5d')]['count']({'where':_0x1effdf[_0x7422('0x3d')]})[_0x7422('0x23')](function(_0x5a0ff5){_0x44e8d4[_0x7422('0x1e')]=_0x5a0ff5;if(_0x171e0a[_0x7422('0x32')][_0x7422('0x47')]){_0x1effdf[_0x7422('0x41')]=[{'all':!![]}];}return db[_0x7422('0x5d')][_0x7422('0x5a')](_0x1effdf);})[_0x7422('0x23')](function(_0x2961d8){_0x44e8d4['rows']=_0x2961d8;return _0x44e8d4;});}})[_0x7422('0x23')](respondWithFilteredResult(_0xd69503,_0x1effdf))[_0x7422('0x43')](handleError(_0xd69503,null));};exports[_0x7422('0x5e')]=function(_0x4ee0c9,_0x388952,_0x8adc32){var _0xf0ae3f={'raw':!![],'where':{}};var _0x2402fb={};var _0x368554={'count':0x0,'rows':[]};return db[_0x7422('0x2c')][_0x7422('0x5c')]({'where':{'id':_0x4ee0c9['params']['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x388952,null))[_0x7422('0x23')](function(_0x3e4e8e){if(_0x3e4e8e){_0x2402fb[_0x7422('0x31')]=_[_0x7422('0x33')](db[_0x7422('0x5f')][_0x7422('0x2d')]);_0x2402fb[_0x7422('0x32')]=_[_0x7422('0x33')](_0x4ee0c9['query']);_0x2402fb['filters']=_[_0x7422('0x34')](_0x2402fb['model'],_0x2402fb[_0x7422('0x32')]);_0xf0ae3f[_0x7422('0x35')]=_[_0x7422('0x34')](_0x2402fb[_0x7422('0x31')],qs[_0x7422('0x46')](_0x4ee0c9[_0x7422('0x32')][_0x7422('0x46')]));_0xf0ae3f[_0x7422('0x35')]=_0xf0ae3f[_0x7422('0x35')][_0x7422('0x36')]?_0xf0ae3f['attributes']:_0x2402fb[_0x7422('0x31')];if(!_0x4ee0c9[_0x7422('0x32')][_0x7422('0x58')]('nolimit')){_0xf0ae3f[_0x7422('0x1d')]=qs['limit'](_0x4ee0c9[_0x7422('0x32')][_0x7422('0x1d')]);_0xf0ae3f[_0x7422('0x1b')]=qs['offset'](_0x4ee0c9[_0x7422('0x32')][_0x7422('0x1b')]);}_0xf0ae3f[_0x7422('0x38')]=qs[_0x7422('0x39')](_0x4ee0c9[_0x7422('0x32')][_0x7422('0x39')]);_0xf0ae3f[_0x7422('0x3d')]=qs[_0x7422('0x3a')](_[_0x7422('0x3b')](_0x4ee0c9['query'],_0x2402fb['filters']));_0xf0ae3f[_0x7422('0x3d')][_0x7422('0x59')]=_0x3e4e8e['id'];if(_0x4ee0c9[_0x7422('0x32')][_0x7422('0x3c')]){_0xf0ae3f[_0x7422('0x3d')]=_[_0x7422('0x3f')](_0xf0ae3f['where'],{'$or':_[_0x7422('0x2b')](_0xf0ae3f['attributes'],function(_0x410c97){var _0x424e06={};_0x424e06[_0x410c97]={'$like':'%'+_0x4ee0c9[_0x7422('0x32')]['filter']+'%'};return _0x424e06;})});}_0xf0ae3f=_[_0x7422('0x3f')]({},_0xf0ae3f,_0x4ee0c9[_0x7422('0x40')]);return db[_0x7422('0x5f')]['count']({'where':_0xf0ae3f['where']})[_0x7422('0x23')](function(_0x5ad29c){_0x368554['count']=_0x5ad29c;if(_0x4ee0c9[_0x7422('0x32')][_0x7422('0x47')]){_0xf0ae3f[_0x7422('0x41')]=[{'all':!![]}];}return db[_0x7422('0x5f')][_0x7422('0x5a')](_0xf0ae3f);})[_0x7422('0x23')](function(_0x19a3fb){_0x368554[_0x7422('0x42')]=_0x19a3fb;return _0x368554;});}})[_0x7422('0x23')](respondWithFilteredResult(_0x388952,_0xf0ae3f))[_0x7422('0x43')](handleError(_0x388952,null));};exports['getHopperBlacks']=function(_0x328631,_0x4ebc0c,_0x1dfc8d){var _0x49dc8d={'raw':!![],'where':{}};var _0x3d561c={};var _0xa76f45={'count':0x0,'rows':[]};return db['Campaign'][_0x7422('0x5c')]({'where':{'id':_0x328631[_0x7422('0x45')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x4ebc0c,null))[_0x7422('0x23')](function(_0x414197){if(_0x414197){_0x3d561c[_0x7422('0x31')]=_['keys'](db[_0x7422('0x60')][_0x7422('0x2d')]);_0x3d561c['query']=_[_0x7422('0x33')](_0x328631['query']);_0x3d561c[_0x7422('0x3a')]=_[_0x7422('0x34')](_0x3d561c[_0x7422('0x31')],_0x3d561c[_0x7422('0x32')]);_0x49dc8d[_0x7422('0x35')]=_['intersection'](_0x3d561c[_0x7422('0x31')],qs[_0x7422('0x46')](_0x328631[_0x7422('0x32')][_0x7422('0x46')]));_0x49dc8d['attributes']=_0x49dc8d['attributes'][_0x7422('0x36')]?_0x49dc8d[_0x7422('0x35')]:_0x3d561c[_0x7422('0x31')];if(!_0x328631[_0x7422('0x32')][_0x7422('0x58')](_0x7422('0x37'))){_0x49dc8d[_0x7422('0x1d')]=qs[_0x7422('0x1d')](_0x328631[_0x7422('0x32')][_0x7422('0x1d')]);_0x49dc8d[_0x7422('0x1b')]=qs['offset'](_0x328631[_0x7422('0x32')]['offset']);}_0x49dc8d[_0x7422('0x38')]=qs[_0x7422('0x39')](_0x328631[_0x7422('0x32')][_0x7422('0x39')]);_0x49dc8d[_0x7422('0x3d')]=qs['filters'](_[_0x7422('0x3b')](_0x328631[_0x7422('0x32')],_0x3d561c[_0x7422('0x3a')]));_0x49dc8d[_0x7422('0x3d')][_0x7422('0x59')]=_0x414197['id'];if(_0x328631['query'][_0x7422('0x3c')]){_0x49dc8d[_0x7422('0x3d')]=_[_0x7422('0x3f')](_0x49dc8d[_0x7422('0x3d')],{'$or':_[_0x7422('0x2b')](_0x49dc8d[_0x7422('0x35')],function(_0x3c4ff0){var _0x4c5828={};_0x4c5828[_0x3c4ff0]={'$like':'%'+_0x328631['query']['filter']+'%'};return _0x4c5828;})});}_0x49dc8d=_[_0x7422('0x3f')]({},_0x49dc8d,_0x328631[_0x7422('0x40')]);return db[_0x7422('0x60')][_0x7422('0x1e')]({'where':_0x49dc8d[_0x7422('0x3d')]})[_0x7422('0x23')](function(_0xe0be85){_0xa76f45['count']=_0xe0be85;if(_0x328631[_0x7422('0x32')][_0x7422('0x47')]){_0x49dc8d[_0x7422('0x41')]=[{'all':!![]}];}return db[_0x7422('0x60')][_0x7422('0x5a')](_0x49dc8d);})['then'](function(_0x250e85){_0xa76f45[_0x7422('0x42')]=_0x250e85;return _0xa76f45;});}})[_0x7422('0x23')](respondWithFilteredResult(_0x4ebc0c,_0x49dc8d))[_0x7422('0x43')](handleError(_0x4ebc0c,null));};exports['getLists']=function(_0xa629d5,_0x579e50,_0x1f687c){var _0x5b575={};var _0x511c8b={};var _0x1fe025;var _0x3def08;return db[_0x7422('0x2c')]['findOne']({'where':{'id':_0xa629d5[_0x7422('0x45')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x579e50,null))[_0x7422('0x23')](function(_0x48f4fd){if(_0x48f4fd){_0x1fe025=_0x48f4fd;_0x511c8b['model']=_[_0x7422('0x33')](db[_0x7422('0x61')]['rawAttributes']);_0x511c8b[_0x7422('0x32')]=_[_0x7422('0x33')](_0xa629d5[_0x7422('0x32')]);_0x511c8b[_0x7422('0x3a')]=_[_0x7422('0x34')](_0x511c8b[_0x7422('0x31')],_0x511c8b[_0x7422('0x32')]);_0x5b575[_0x7422('0x35')]=_[_0x7422('0x34')](_0x511c8b['model'],qs[_0x7422('0x46')](_0xa629d5[_0x7422('0x32')][_0x7422('0x46')]));_0x5b575[_0x7422('0x35')]=_0x5b575[_0x7422('0x35')][_0x7422('0x36')]?_0x5b575[_0x7422('0x35')]:_0x511c8b[_0x7422('0x31')];_0x5b575[_0x7422('0x38')]=qs[_0x7422('0x39')](_0xa629d5[_0x7422('0x32')][_0x7422('0x39')]);_0x5b575[_0x7422('0x3d')]=qs['filters'](_['pick'](_0xa629d5[_0x7422('0x32')],_0x511c8b[_0x7422('0x3a')]));if(_0xa629d5[_0x7422('0x32')][_0x7422('0x3c')]){_0x5b575[_0x7422('0x3d')]=_[_0x7422('0x3f')](_0x5b575['where'],{'$or':_[_0x7422('0x2b')](_0x5b575[_0x7422('0x35')],function(_0x31e320){var _0x212ab3={};_0x212ab3[_0x31e320]={'$like':'%'+_0xa629d5[_0x7422('0x32')][_0x7422('0x3c')]+'%'};return _0x212ab3;})});}_0x5b575=_[_0x7422('0x3f')]({},_0x5b575,_0xa629d5['options']);return _0x1fe025[_0x7422('0x62')](_0x5b575);}})[_0x7422('0x23')](function(_0x5c70f1){if(_0x5c70f1){_0x3def08=_0x5c70f1[_0x7422('0x36')];if(!_0xa629d5[_0x7422('0x32')]['hasOwnProperty']('nolimit')){_0x5b575[_0x7422('0x1d')]=qs[_0x7422('0x1d')](_0xa629d5['query'][_0x7422('0x1d')]);_0x5b575[_0x7422('0x1b')]=qs['offset'](_0xa629d5[_0x7422('0x32')][_0x7422('0x1b')]);}return _0x1fe025[_0x7422('0x62')](_0x5b575);}})[_0x7422('0x23')](function(_0x2ee967){if(_0x2ee967){return _0x2ee967?{'count':_0x3def08,'rows':_0x2ee967}:null;}})[_0x7422('0x23')](respondWithResult(_0x579e50,null))[_0x7422('0x43')](handleError(_0x579e50,null));};exports[_0x7422('0x63')]=function(_0xd9f8ec,_0x1d5fa7,_0xb08d5a){var _0x184712,_0x5c9764;var _0x2bc57b=[];var _0x1a9529=moment()[_0x7422('0x64')](_0x7422('0x65'));return db[_0x7422('0x2c')]['find']({'where':{'id':_0xd9f8ec['params']['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x1d5fa7,null))['then'](function(_0x11e767){if(_0x11e767){_0x5c9764=_0x11e767;return _0x11e767[_0x7422('0x63')](_0xd9f8ec[_0x7422('0x4a')]['ids'],_[_0x7422('0x53')](_0xd9f8ec[_0x7422('0x4a')],['ids','id'])||{});}return null;})[_0x7422('0x66')](function(_0x239bff){var _0x4d28c1;var _0x45c092;_0x184712=_0x239bff||[];var _0x23bec2=[];if(_0x239bff){for(var _0x313379=0x0;_0x313379<_0x239bff[_0x7422('0x36')];_0x313379+=0x1){var _0x273428=_0x239bff[_0x313379][_0x7422('0x24')]({'plain':!![]});_0x5c9764[_0x7422('0x67')]=_0xd9f8ec[_0x7422('0x4a')][_0x7422('0x67')]?_0xd9f8ec[_0x7422('0x4a')][_0x7422('0x67')]:_0x5c9764[_0x7422('0x67')];switch(_0x5c9764['dialCheckDuplicateType']){case _0x7422('0x68'):_0x4d28c1=squel['insert']()[_0x7422('0x69')](_0x7422('0x6a'))[_0x7422('0x6b')]([_0x7422('0x6c'),'scheduledAt',_0x7422('0x6d'),_0x7422('0x6e'),_0x7422('0x59'),'createdAt',_0x7422('0x55')],squel[_0x7422('0x6f')]()[_0x7422('0x70')]('phone',_0x7422('0x6c'))['field'](_0x7422('0x71'),_0x7422('0x72'))[_0x7422('0x70')]('id','ContactId')[_0x7422('0x70')](_0x273428[_0x7422('0x73')][_0x7422('0x74')](),_0x7422('0x6e'))[_0x7422('0x70')](_0xd9f8ec[_0x7422('0x45')]['id']['toString'](),_0x7422('0x59'))[_0x7422('0x70')]('\x27'+_0x1a9529+'\x27','createdAt')[_0x7422('0x70')]('\x27'+_0x1a9529+'\x27','updatedAt')['from']('cm_contacts')['where'](_0x7422('0x75'))[_0x7422('0x3d')](_0x7422('0x76'),_0x273428[_0x7422('0x73')][_0x7422('0x74')]())[_0x7422('0x3d')](_0x7422('0x77'))[_0x7422('0x3d')](_0x7422('0x78'),squel[_0x7422('0x6f')]()['field'](_0x7422('0x79'))[_0x7422('0x7a')](_0x7422('0x7b'))[_0x7422('0x3d')]('CampaignId\x20=\x20?',_0xd9f8ec[_0x7422('0x45')]['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x7422('0x6f')]()[_0x7422('0x70')](_0x7422('0x7c'))[_0x7422('0x7a')](_0x7422('0x6a'))[_0x7422('0x3d')](_0x7422('0x7d'),_0xd9f8ec[_0x7422('0x45')]['id']['toString']())))[_0x7422('0x74')]();break;case _0x7422('0x7e'):_0x4d28c1=squel['insert']()[_0x7422('0x69')](_0x7422('0x6a'))[_0x7422('0x6b')]([_0x7422('0x6c'),_0x7422('0x72'),_0x7422('0x6d'),'ListId',_0x7422('0x59'),'createdAt',_0x7422('0x55')],squel['select']()[_0x7422('0x70')](_0x7422('0x6c'),_0x7422('0x6c'))['field']('NOW()',_0x7422('0x72'))['field']('id',_0x7422('0x6d'))[_0x7422('0x70')](_0x273428['CmListId']['toString'](),_0x7422('0x6e'))[_0x7422('0x70')](_0xd9f8ec[_0x7422('0x45')]['id'][_0x7422('0x74')](),_0x7422('0x59'))[_0x7422('0x70')]('\x27'+_0x1a9529+'\x27',_0x7422('0x54'))['field']('\x27'+_0x1a9529+'\x27',_0x7422('0x55'))[_0x7422('0x7a')](_0x7422('0x7f'))['where'](_0x7422('0x75'))[_0x7422('0x3d')]('ListId\x20=\x20?',_0x273428['CmListId'][_0x7422('0x74')]())[_0x7422('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x7422('0x78'),squel[_0x7422('0x6f')]()['field']('COALESCE(phone,\x27\x27)')[_0x7422('0x7a')](_0x7422('0x6a'))[_0x7422('0x3d')](_0x7422('0x7d'),_0xd9f8ec[_0x7422('0x45')]['id'][_0x7422('0x74')]())))[_0x7422('0x74')]();break;default:_0x4d28c1=squel[_0x7422('0x80')]()[_0x7422('0x69')](_0x7422('0x6a'))[_0x7422('0x6b')]([_0x7422('0x6c'),_0x7422('0x72'),_0x7422('0x6d'),_0x7422('0x6e'),'CampaignId',_0x7422('0x54'),'updatedAt'],squel['select']()[_0x7422('0x70')](_0x7422('0x6c'),'phone')[_0x7422('0x70')](_0x7422('0x71'),_0x7422('0x72'))[_0x7422('0x70')]('id',_0x7422('0x6d'))[_0x7422('0x70')](_0x273428[_0x7422('0x73')][_0x7422('0x74')](),'ListId')[_0x7422('0x70')](_0xd9f8ec[_0x7422('0x45')]['id'][_0x7422('0x74')](),'CampaignId')[_0x7422('0x70')]('\x27'+_0x1a9529+'\x27',_0x7422('0x54'))[_0x7422('0x70')]('\x27'+_0x1a9529+'\x27',_0x7422('0x55'))['from'](_0x7422('0x7f'))[_0x7422('0x3d')]('deletedAt\x20IS\x20NULL')[_0x7422('0x3d')](_0x7422('0x76'),_0x273428[_0x7422('0x73')][_0x7422('0x74')]())[_0x7422('0x3d')](_0x7422('0x77')))[_0x7422('0x74')]();}_0x45c092=squel['insert']()[_0x7422('0x69')](_0x7422('0x81'))[_0x7422('0x6b')]([_0x7422('0x82'),'scheduledAt',_0x7422('0x6c'),_0x7422('0x83'),_0x7422('0x54'),_0x7422('0x55')],squel[_0x7422('0x6f')]()[_0x7422('0x70')](_0x7422('0x84'),'id')['field'](_0x7422('0x71'),_0x7422('0x72'))[_0x7422('0x70')](_0x7422('0x85'),_0x7422('0x6c'))[_0x7422('0x70')](_0x7422('0x86'),_0x7422('0x83'))['field']('\x27'+_0x1a9529+'\x27',_0x7422('0x54'))[_0x7422('0x70')]('\x27'+_0x1a9529+'\x27','updatedAt')[_0x7422('0x7a')](_0x7422('0x87'),'ci')[_0x7422('0x88')]('cm_hopper','h',_0x7422('0x89'))[_0x7422('0x3d')](_0x7422('0x8a'),_0x273428['CmListId'][_0x7422('0x74')]())['where']('h.CampaignId=?',_0xd9f8ec[_0x7422('0x45')]['id'][_0x7422('0x74')]())[_0x7422('0x3d')](_0x7422('0x8b'),_0x1a9529))[_0x7422('0x74')]();_0x23bec2[_0x7422('0x8c')](db[_0x7422('0x8d')]['query'](_0x4d28c1));_0x2bc57b['push'](db[_0x7422('0x8d')][_0x7422('0x32')](_0x45c092));}return BPromise[_0x7422('0x8e')](_0x23bec2);}})['then'](function(){return BPromise['all'](_0x2bc57b);})[_0x7422('0x23')](function(){return _0x184712;})[_0x7422('0x23')](respondWithResult(_0x1d5fa7,null))[_0x7422('0x43')](handleError(_0x1d5fa7,null));};exports[_0x7422('0x8f')]=function(_0x22b576,_0x55e595,_0x24bbdf){return db[_0x7422('0x2c')][_0x7422('0x48')]({'where':{'id':_0x22b576[_0x7422('0x45')]['id']}})['then'](handleEntityNotFound(_0x55e595,null))[_0x7422('0x23')](function(_0x34e9ba){if(_0x34e9ba){return _0x34e9ba['removeLists'](_0x22b576[_0x7422('0x32')][_0x7422('0x90')]);}})[_0x7422('0x23')](function(_0x4cfacb){if(_0x4cfacb){return db[_0x7422('0x57')][_0x7422('0x26')]({'where':{'ListId':_0x22b576[_0x7422('0x32')][_0x7422('0x90')],'CampaignId':_0x22b576[_0x7422('0x45')]['id']}})[_0x7422('0x23')](function(){return _0x4cfacb;});}})[_0x7422('0x23')](respondWithStatusCode(_0x55e595,null))[_0x7422('0x43')](handleError(_0x55e595,null));};exports[_0x7422('0x91')]=function(_0x1126d3,_0x19aff7,_0x58499d){var _0x2b463d={};var _0x27773c={};var _0x233030;var _0x2bced9;return db['Campaign'][_0x7422('0x5c')]({'where':{'id':_0x1126d3[_0x7422('0x45')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x19aff7,null))[_0x7422('0x23')](function(_0x2d6403){if(_0x2d6403){_0x233030=_0x2d6403;_0x27773c[_0x7422('0x31')]=_[_0x7422('0x33')](db[_0x7422('0x61')][_0x7422('0x2d')]);_0x27773c[_0x7422('0x32')]=_[_0x7422('0x33')](_0x1126d3[_0x7422('0x32')]);_0x27773c['filters']=_[_0x7422('0x34')](_0x27773c[_0x7422('0x31')],_0x27773c[_0x7422('0x32')]);_0x2b463d['attributes']=_['intersection'](_0x27773c[_0x7422('0x31')],qs[_0x7422('0x46')](_0x1126d3['query']['fields']));_0x2b463d[_0x7422('0x35')]=_0x2b463d[_0x7422('0x35')][_0x7422('0x36')]?_0x2b463d[_0x7422('0x35')]:_0x27773c[_0x7422('0x31')];_0x2b463d[_0x7422('0x38')]=qs[_0x7422('0x39')](_0x1126d3[_0x7422('0x32')]['sort']);_0x2b463d[_0x7422('0x3d')]=qs[_0x7422('0x3a')](_[_0x7422('0x3b')](_0x1126d3[_0x7422('0x32')],_0x27773c['filters']));if(_0x1126d3[_0x7422('0x32')]['filter']){_0x2b463d[_0x7422('0x3d')]=_[_0x7422('0x3f')](_0x2b463d['where'],{'$or':_[_0x7422('0x2b')](_0x2b463d[_0x7422('0x35')],function(_0xcedcf1){var _0x188915={};_0x188915[_0xcedcf1]={'$like':'%'+_0x1126d3[_0x7422('0x32')][_0x7422('0x3c')]+'%'};return _0x188915;})});}_0x2b463d=_[_0x7422('0x3f')]({},_0x2b463d,_0x1126d3[_0x7422('0x40')]);return _0x233030[_0x7422('0x91')](_0x2b463d);}})[_0x7422('0x23')](function(_0x4b6765){if(_0x4b6765){_0x2bced9=_0x4b6765[_0x7422('0x36')];if(!_0x1126d3[_0x7422('0x32')][_0x7422('0x58')](_0x7422('0x37'))){_0x2b463d[_0x7422('0x1d')]=qs[_0x7422('0x1d')](_0x1126d3['query'][_0x7422('0x1d')]);_0x2b463d['offset']=qs[_0x7422('0x1b')](_0x1126d3[_0x7422('0x32')][_0x7422('0x1b')]);}return _0x233030[_0x7422('0x91')](_0x2b463d);}})[_0x7422('0x23')](function(_0x197aba){if(_0x197aba){return _0x197aba?{'count':_0x2bced9,'rows':_0x197aba}:null;}})[_0x7422('0x23')](respondWithResult(_0x19aff7,null))[_0x7422('0x43')](handleError(_0x19aff7,null));};exports[_0x7422('0x92')]=function(_0x423af4,_0x478fca,_0x30a642){var _0x491cbb,_0x50fbdc;var _0x7d925c=[];var _0x1e6d1e=moment()[_0x7422('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x7422('0x2c')][_0x7422('0x48')]({'where':{'id':_0x423af4[_0x7422('0x45')]['id']}})['then'](handleEntityNotFound(_0x478fca,null))['then'](function(_0x21fe46){if(_0x21fe46){_0x50fbdc=_0x21fe46;return _0x21fe46[_0x7422('0x92')](_0x423af4[_0x7422('0x4a')][_0x7422('0x90')],_[_0x7422('0x53')](_0x423af4[_0x7422('0x4a')],[_0x7422('0x90'),'id'])||{});}return null;})[_0x7422('0x66')](function(_0x1552ea){var _0x317d2f;var _0x2c1c97;_0x491cbb=_0x1552ea||[];var _0xac898d=[];if(_0x1552ea){for(var _0xd9c618=0x0;_0xd9c618<_0x1552ea['length'];_0xd9c618+=0x1){var _0xf02f27=_0x1552ea[_0xd9c618][_0x7422('0x24')]({'plain':!![]});_0x317d2f=squel[_0x7422('0x80')]()['into'](_0x7422('0x93'))[_0x7422('0x6b')](['phone',_0x7422('0x6d'),_0x7422('0x6e'),'CampaignId',_0x7422('0x54'),_0x7422('0x55')],squel[_0x7422('0x6f')]()[_0x7422('0x70')](_0x7422('0x6c'),_0x7422('0x6c'))['field']('id',_0x7422('0x6d'))[_0x7422('0x70')](_0xf02f27[_0x7422('0x73')]['toString'](),_0x7422('0x6e'))[_0x7422('0x70')](_0x423af4[_0x7422('0x45')]['id']['toString'](),_0x7422('0x59'))['field'](_0x7422('0x71'),_0x7422('0x54'))[_0x7422('0x70')](_0x7422('0x71'),_0x7422('0x55'))[_0x7422('0x7a')]('cm_contacts')[_0x7422('0x3d')]('deletedAt\x20IS\x20NULL')[_0x7422('0x3d')](_0x7422('0x76'),_0xf02f27[_0x7422('0x73')][_0x7422('0x74')]())[_0x7422('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x7422('0x74')]();_0xac898d[_0x7422('0x8c')](db['sequelize'][_0x7422('0x32')](_0x317d2f));}return BPromise[_0x7422('0x8e')](_0xac898d);}})['then'](function(){return _0x491cbb;})['then'](respondWithResult(_0x478fca,null))[_0x7422('0x43')](handleError(_0x478fca,null));};exports[_0x7422('0x94')]=function(_0x3d064a,_0x68302d,_0x2dab10){return db['Campaign'][_0x7422('0x48')]({'where':{'id':_0x3d064a[_0x7422('0x45')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x68302d,null))[_0x7422('0x23')](function(_0x4245ed){if(_0x4245ed){return _0x4245ed[_0x7422('0x94')](_0x3d064a[_0x7422('0x32')][_0x7422('0x90')]);}})[_0x7422('0x23')](function(_0x3ebe68){if(_0x3ebe68){return db[_0x7422('0x60')][_0x7422('0x26')]({'where':{'ListId':_0x3d064a[_0x7422('0x32')]['ids'],'CampaignId':_0x3d064a[_0x7422('0x45')]['id']}})[_0x7422('0x23')](function(){return _0x3ebe68;});}})[_0x7422('0x23')](respondWithStatusCode(_0x68302d,null))[_0x7422('0x43')](handleError(_0x68302d,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 4f101b8..741b999 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(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index e9f3ff6..6f79a16 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 _0xb6b1=['rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','Campaign,\x20%s,\x20%s','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x21c254,_0x51d2ff){var _0x442f28=function(_0x1ecbe7){while(--_0x1ecbe7){_0x21c254['push'](_0x21c254['shift']());}};_0x442f28(++_0x51d2ff);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x375325,_0x57a850){_0x375325=_0x375325-0x0;var _0x228f57=_0xb6b1[_0x375325];return _0x228f57;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var moment=require(_0x1b6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6b('0x2'));var fs=require('fs');var Redis=require(_0x1b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b6b('0x4'));var logger=require('../../config/logger')(_0x1b6b('0x5'));var config=require(_0x1b6b('0x6'));var jayson=require(_0x1b6b('0x7'));var client=jayson[_0x1b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d09e,_0x51cfed,_0xae4115){return new BPromise(function(_0x5042f7,_0x21f403){return client[_0x1b6b('0x9')](_0x41d09e,_0xae4115)[_0x1b6b('0xa')](function(_0x29258a){logger['info']('Campaign,\x20%s,\x20%s',_0x51cfed,_0x1b6b('0xb'));logger[_0x1b6b('0xc')](_0x1b6b('0xd'),_0x51cfed,_0x1b6b('0xb'),JSON[_0x1b6b('0xe')](_0x29258a));if(_0x29258a[_0x1b6b('0xf')]){if(_0x29258a[_0x1b6b('0xf')]['code']===0x1f4){logger[_0x1b6b('0xf')](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')]['message']);return _0x21f403(_0x29258a[_0x1b6b('0xf')]['message']);}logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);return _0x5042f7(_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);}else{logger[_0x1b6b('0x12')](_0x1b6b('0x10'),_0x51cfed,'request\x20sent');_0x5042f7(_0x29258a[_0x1b6b('0x13')][_0x1b6b('0x11')]);}})[_0x1b6b('0x14')](function(_0x33dc7e){logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x33dc7e);_0x21f403(_0x33dc7e);});});}exports[_0x1b6b('0x15')]=function(_0x2e608b){var _0x59e671=this;return new Promise(function(_0x923711,_0x15d44b){return db[_0x1b6b('0x16')][_0x1b6b('0x17')]({'raw':_0x2e608b[_0x1b6b('0x18')]?_0x2e608b[_0x1b6b('0x18')][_0x1b6b('0x19')]===undefined?!![]:![]:!![],'where':_0x2e608b[_0x1b6b('0x18')]?_0x2e608b[_0x1b6b('0x18')][_0x1b6b('0x1a')]||null:null,'attributes':_0x2e608b['options']?_0x2e608b[_0x1b6b('0x18')][_0x1b6b('0x1b')]||null:null,'limit':_0x2e608b[_0x1b6b('0x18')]?_0x2e608b[_0x1b6b('0x18')][_0x1b6b('0x1c')]||null:null,'include':_0x2e608b[_0x1b6b('0x18')]?_0x2e608b[_0x1b6b('0x18')][_0x1b6b('0x1d')]?_[_0x1b6b('0x1e')](_0x2e608b['options'][_0x1b6b('0x1d')],function(_0x489e7a){return{'model':db[_0x489e7a['model']],'as':_0x489e7a['as'],'attributes':_0x489e7a['attributes'],'include':_0x489e7a[_0x1b6b('0x1d')]?_[_0x1b6b('0x1e')](_0x489e7a['include'],function(_0x6a317c){return{'model':db[_0x6a317c['model']],'as':_0x6a317c['as'],'attributes':_0x6a317c[_0x1b6b('0x1b')],'include':_0x6a317c[_0x1b6b('0x1d')]?_[_0x1b6b('0x1e')](_0x6a317c[_0x1b6b('0x1d')],function(_0xd41b04){return{'model':db[_0xd41b04[_0x1b6b('0x1f')]],'as':_0xd41b04['as'],'attributes':_0xd41b04['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b6b('0xa')](function(_0x1bb7f3){logger[_0x1b6b('0x12')](_0x1b6b('0x15'),_0x2e608b);logger['debug'](_0x1b6b('0x15'),_0x2e608b,JSON['stringify'](_0x1bb7f3));_0x923711(_0x1bb7f3);})['catch'](function(_0x39b055){logger['error'](_0x1b6b('0x15'),_0x39b055[_0x1b6b('0x11')],_0x2e608b);_0x15d44b(_0x59e671['error'](0x1f4,_0x39b055['message']));});});}; \ No newline at end of file +var _0x20ce=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCampaign','Campaign','options','raw','attributes','limit','include','model','map','lodash','util','moment'];(function(_0x363881,_0x27fdef){var _0x534d23=function(_0x5972ba){while(--_0x5972ba){_0x363881['push'](_0x363881['shift']());}};_0x534d23(++_0x27fdef);}(_0x20ce,0x10d));var _0xe20c=function(_0x1a4523,_0x45c321){_0x1a4523=_0x1a4523-0x0;var _0x20b568=_0x20ce[_0x1a4523];return _0x20b568;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var moment=require(_0xe20c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe20c('0x3'));var fs=require('fs');var Redis=require(_0xe20c('0x4'));var db=require(_0xe20c('0x5'))['db'];var utils=require(_0xe20c('0x6'));var logger=require(_0xe20c('0x7'))(_0xe20c('0x8'));var config=require(_0xe20c('0x9'));var jayson=require(_0xe20c('0xa'));var client=jayson[_0xe20c('0xb')][_0xe20c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x893e48,_0x26b9be,_0x2d88b5){return new BPromise(function(_0x8f79ad,_0x290fb5){return client[_0xe20c('0xd')](_0x893e48,_0x2d88b5)[_0xe20c('0xe')](function(_0x385d61){logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,_0xe20c('0x11'));logger[_0xe20c('0x12')](_0xe20c('0x13'),_0x26b9be,_0xe20c('0x11'),JSON['stringify'](_0x385d61));if(_0x385d61[_0xe20c('0x14')]){if(_0x385d61[_0xe20c('0x14')][_0xe20c('0x15')]===0x1f4){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61['error'][_0xe20c('0x16')]);return _0x290fb5(_0x385d61[_0xe20c('0x14')]['message']);}logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61[_0xe20c('0x14')]['message']);return _0x8f79ad(_0x385d61[_0xe20c('0x14')][_0xe20c('0x16')]);}else{logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,'request\x20sent');_0x8f79ad(_0x385d61[_0xe20c('0x17')]['message']);}})[_0xe20c('0x18')](function(_0x4061ed){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x4061ed);_0x290fb5(_0x4061ed);});});}exports[_0xe20c('0x19')]=function(_0x2d58a7){var _0x2a4292=this;return new Promise(function(_0x3d8df5,_0x305f2f){return db[_0xe20c('0x1a')]['findAll']({'raw':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7['options']['where']||null:null,'attributes':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1d')]||null:null,'limit':_0x2d58a7['options']?_0x2d58a7['options'][_0xe20c('0x1e')]||null:null,'include':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1f')]?_['map'](_0x2d58a7[_0xe20c('0x1b')]['include'],function(_0x13bf33){return{'model':db[_0x13bf33[_0xe20c('0x20')]],'as':_0x13bf33['as'],'attributes':_0x13bf33[_0xe20c('0x1d')],'include':_0x13bf33[_0xe20c('0x1f')]?_[_0xe20c('0x21')](_0x13bf33[_0xe20c('0x1f')],function(_0x12846c){return{'model':db[_0x12846c['model']],'as':_0x12846c['as'],'attributes':_0x12846c[_0xe20c('0x1d')],'include':_0x12846c[_0xe20c('0x1f')]?_[_0xe20c('0x21')](_0x12846c[_0xe20c('0x1f')],function(_0x2dd621){return{'model':db[_0x2dd621[_0xe20c('0x20')]],'as':_0x2dd621['as'],'attributes':_0x2dd621[_0xe20c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe20c('0xe')](function(_0x562e52){logger[_0xe20c('0xf')](_0xe20c('0x19'),_0x2d58a7);logger[_0xe20c('0x12')](_0xe20c('0x19'),_0x2d58a7,JSON['stringify'](_0x562e52));_0x3d8df5(_0x562e52);})[_0xe20c('0x18')](function(_0x54df97){logger['error'](_0xe20c('0x19'),_0x54df97[_0xe20c('0x16')],_0x2d58a7);_0x305f2f(_0x2a4292[_0xe20c('0x14')](0x1f4,_0x54df97['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 31e7205..1dad0b6 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 _0x85ff=['delete','removeBlackLists','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','addLists','put','/:id','update','destroy','/:id/lists','removeLists'];(function(_0x1632d2,_0x311f76){var _0x50d357=function(_0x2929bc){while(--_0x2929bc){_0x1632d2['push'](_0x1632d2['shift']());}};_0x50d357(++_0x311f76);}(_0x85ff,0x1d1));var _0xf85f=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x85ff[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0xf85f('0x0'));var util=require(_0xf85f('0x1'));var path=require('path');var timeout=require(_0xf85f('0x2'));var express=require(_0xf85f('0x3'));var router=express[_0xf85f('0x4')]();var fs_extra=require(_0xf85f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf85f('0x6'));var config=require(_0xf85f('0x7'));var controller=require(_0xf85f('0x8'));router[_0xf85f('0x9')]('/',auth[_0xf85f('0xa')](),controller[_0xf85f('0xb')]);router[_0xf85f('0x9')]('/:id',auth[_0xf85f('0xa')](),controller[_0xf85f('0xc')]);router[_0xf85f('0x9')](_0xf85f('0xd'),auth[_0xf85f('0xa')](),controller[_0xf85f('0xe')]);router[_0xf85f('0x9')](_0xf85f('0xf'),auth[_0xf85f('0xa')](),controller['getHopperHistories']);router[_0xf85f('0x9')](_0xf85f('0x10'),auth[_0xf85f('0xa')](),controller['getHopperFinals']);router[_0xf85f('0x9')]('/:id/hopper_black',auth[_0xf85f('0xa')](),controller['getHopperBlacks']);router['get']('/:id/lists',auth[_0xf85f('0xa')](),controller[_0xf85f('0x11')]);router['get'](_0xf85f('0x12'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf85f('0x14')]);router[_0xf85f('0x15')](_0xf85f('0x16'),auth[_0xf85f('0xa')](),controller['clone']);router[_0xf85f('0x15')]('/:id/lists',auth['isAuthenticated'](),controller[_0xf85f('0x17')]);router[_0xf85f('0x15')]('/:id/blacklists',auth[_0xf85f('0xa')](),controller['addBlackLists']);router[_0xf85f('0x18')](_0xf85f('0x19'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x1a')]);router['delete'](_0xf85f('0x19'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x1b')]);router['delete'](_0xf85f('0x1c'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x1d')]);router[_0xf85f('0x1e')](_0xf85f('0x12'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x1f')]);module[_0xf85f('0x20')]=router; \ No newline at end of file +var _0xe893=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','clone','/:id/lists','addLists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','util','path'];(function(_0x5de1b3,_0x179529){var _0x1a77e9=function(_0x420218){while(--_0x420218){_0x5de1b3['push'](_0x5de1b3['shift']());}};_0x1a77e9(++_0x179529);}(_0xe893,0xbe));var _0x3e89=function(_0xe08054,_0x22c584){_0xe08054=_0xe08054-0x0;var _0x5c3e9d=_0xe893[_0xe08054];return _0x5c3e9d;};'use strict';var multer=require('multer');var util=require(_0x3e89('0x0'));var path=require(_0x3e89('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e89('0x2'));var router=express[_0x3e89('0x3')]();var fs_extra=require(_0x3e89('0x4'));var auth=require(_0x3e89('0x5'));var interaction=require(_0x3e89('0x6'));var config=require('../../config/environment');var controller=require(_0x3e89('0x7'));router[_0x3e89('0x8')]('/',auth[_0x3e89('0x9')](),controller['index']);router[_0x3e89('0x8')](_0x3e89('0xa'),auth[_0x3e89('0x9')](),controller[_0x3e89('0xb')]);router['get'](_0x3e89('0xc'),auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0x3e89('0xd'),auth[_0x3e89('0x9')](),controller['getHopperHistories']);router['get'](_0x3e89('0xe'),auth['isAuthenticated'](),controller[_0x3e89('0xf')]);router[_0x3e89('0x8')]('/:id/hopper_black',auth[_0x3e89('0x9')](),controller[_0x3e89('0x10')]);router[_0x3e89('0x8')]('/:id/lists',auth[_0x3e89('0x9')](),controller[_0x3e89('0x11')]);router[_0x3e89('0x8')](_0x3e89('0x12'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x13')]);router[_0x3e89('0x14')]('/',auth['isAuthenticated'](),controller[_0x3e89('0x15')]);router[_0x3e89('0x14')]('/:id/clone',auth[_0x3e89('0x9')](),controller[_0x3e89('0x16')]);router[_0x3e89('0x14')](_0x3e89('0x17'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x18')]);router[_0x3e89('0x14')](_0x3e89('0x12'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x19')]);router['put'](_0x3e89('0xa'),auth['isAuthenticated'](),controller[_0x3e89('0x1a')]);router[_0x3e89('0x1b')](_0x3e89('0xa'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x1c')]);router[_0x3e89('0x1b')](_0x3e89('0x17'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x1d')]);router[_0x3e89('0x1b')](_0x3e89('0x12'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x1e')]);module[_0x3e89('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 6e3218b..81fc566 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 _0x9e45=['sequelize','exports','STRING','getDataValue','key'];(function(_0x57ccef,_0x4df192){var _0x1b0f01=function(_0x41b2b6){while(--_0x41b2b6){_0x57ccef['push'](_0x57ccef['shift']());}};_0x1b0f01(++_0x4df192);}(_0x9e45,0x1a4));var _0x59e4=function(_0x588e08,_0x494086){_0x588e08=_0x588e08-0x0;var _0x2d1902=_0x9e45[_0x588e08];return _0x2d1902;};'use strict';var Sequelize=require(_0x59e4('0x0'));module[_0x59e4('0x1')]={'key':{'type':Sequelize[_0x59e4('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x59e4('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x59e4('0x3')](_0x59e4('0x4'));}}}; \ No newline at end of file +var _0xd654=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x1ce3fd,_0x3538c1){var _0x4f46d1=function(_0x336320){while(--_0x336320){_0x1ce3fd['push'](_0x1ce3fd['shift']());}};_0x4f46d1(++_0x3538c1);}(_0xd654,0x163));var _0x4d65=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd654[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x4d65('0x0'));module[_0x4d65('0x1')]={'key':{'type':Sequelize[_0x4d65('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x4d65('0x3')],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x4d65('0x4')],'get':function(){return this[_0x4d65('0x5')](_0x4d65('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d545ce6..bc08ef1 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 _0x7f5f=['merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','limit','undefined','offset','count','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x1c31f2,_0x5a487d){var _0xb2e9e1=function(_0x230001){while(--_0x230001){_0x1c31f2['push'](_0x1c31f2['shift']());}};_0xb2e9e1(++_0x5a487d);}(_0x7f5f,0x1cf));var _0xf7f5=function(_0x24273c,_0x55e945){_0x24273c=_0x24273c-0x0;var _0x3b0bba=_0x7f5f[_0x24273c];return _0x3b0bba;};'use strict';var emlformat=require(_0xf7f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7f5('0x1'));var jsonpatch=require(_0xf7f5('0x2'));var rp=require(_0xf7f5('0x3'));var moment=require(_0xf7f5('0x4'));var BPromise=require(_0xf7f5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf7f5('0x6'));var sox=require(_0xf7f5('0x7'));var csv=require('to-csv');var ejs=require(_0xf7f5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7f5('0x9'));var squel=require(_0xf7f5('0xa'));var crypto=require(_0xf7f5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf7f5('0xc'));var querystring=require('querystring');var Papa=require(_0xf7f5('0xd'));var Redis=require(_0xf7f5('0xe'));var authService=require(_0xf7f5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf7f5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7f5('0x11'))(_0xf7f5('0x12'));var utils=require(_0xf7f5('0x13'));var config=require(_0xf7f5('0x14'));var licenseUtil=require(_0xf7f5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b7d2,_0x3eccf4){_0x3eccf4=_0x3eccf4||0xcc;return function(_0x2e7fbf){if(_0x2e7fbf){return _0x14b7d2['sendStatus'](_0x3eccf4);}return _0x14b7d2['status'](_0x3eccf4)[_0xf7f5('0x16')]();};}function respondWithResult(_0x502beb,_0x24662e){_0x24662e=_0x24662e||0xc8;return function(_0xdd5122){if(_0xdd5122){return _0x502beb[_0xf7f5('0x17')](_0x24662e)[_0xf7f5('0x18')](_0xdd5122);}};}function respondWithFilteredResult(_0x2a5cff,_0x196d79){return function(_0x2715cb){if(_0x2715cb){var _0x5cd17e=typeof _0x196d79['offset']==='undefined'&&typeof _0x196d79[_0xf7f5('0x19')]===_0xf7f5('0x1a');var _0x5dec79=_0x2715cb['count'];var _0x47b995=_0x5cd17e?0x0:_0x196d79[_0xf7f5('0x1b')];var _0xc00d22=_0x5cd17e?_0x2715cb[_0xf7f5('0x1c')]:_0x196d79['offset']+_0x196d79[_0xf7f5('0x19')];var _0x55156d;if(_0xc00d22>=_0x5dec79){_0xc00d22=_0x5dec79;_0x55156d=0xc8;}else{_0x55156d=0xce;}_0x2a5cff[_0xf7f5('0x17')](_0x55156d);return _0x2a5cff['set'](_0xf7f5('0x1d'),_0x47b995+'-'+_0xc00d22+'/'+_0x5dec79)[_0xf7f5('0x18')](_0x2715cb);}return null;};}function patchUpdates(_0x2a9a0c){return function(_0x47ca0f){try{jsonpatch[_0xf7f5('0x1e')](_0x47ca0f,_0x2a9a0c,!![]);}catch(_0x262186){return BPromise[_0xf7f5('0x1f')](_0x262186);}return _0x47ca0f[_0xf7f5('0x20')]();};}function saveUpdates(_0x3b28df,_0xc8e463){return function(_0x232311){if(_0x232311){return _0x232311[_0xf7f5('0x21')](_0x3b28df)[_0xf7f5('0x22')](function(_0xe3516c){return _0xe3516c;});}return null;};}function removeEntity(_0x20f55e,_0x2cc859){return function(_0x5f4783){if(_0x5f4783){return _0x5f4783[_0xf7f5('0x23')]()[_0xf7f5('0x22')](function(){var _0x4e8d6a=_0x5f4783[_0xf7f5('0x24')]({'plain':!![]});var _0x38fb57=_0xf7f5('0x25');return db[_0xf7f5('0x26')][_0xf7f5('0x23')]({'where':{'type':_0x38fb57,'resourceId':_0x4e8d6a['id']}})[_0xf7f5('0x22')](function(){return _0x5f4783;});})['then'](function(){_0x20f55e[_0xf7f5('0x17')](0xcc)[_0xf7f5('0x16')]();});}};}function handleEntityNotFound(_0x20395e,_0x8b642a){return function(_0x491872){if(!_0x491872){_0x20395e[_0xf7f5('0x27')](0x194);}return _0x491872;};}function handleError(_0x39968a,_0x48eac7){_0x48eac7=_0x48eac7||0x1f4;return function(_0x19f457){logger[_0xf7f5('0x28')](_0x19f457[_0xf7f5('0x29')]);if(_0x19f457['name']){delete _0x19f457[_0xf7f5('0x2a')];}_0x39968a['status'](_0x48eac7)[_0xf7f5('0x2b')](_0x19f457);};}exports[_0xf7f5('0x2c')]=function(_0x536241,_0x47b900){var _0x55ff11={},_0x13f904={},_0x492007={'count':0x0,'rows':[]};var _0x22aea7=_[_0xf7f5('0x2d')](db[_0xf7f5('0x2e')][_0xf7f5('0x2f')],function(_0xd93428){return{'name':_0xd93428[_0xf7f5('0x30')],'type':_0xd93428[_0xf7f5('0x31')][_0xf7f5('0x32')]};});_0x13f904[_0xf7f5('0x33')]=_[_0xf7f5('0x2d')](_0x22aea7,'name');_0x13f904[_0xf7f5('0x34')]=_['keys'](_0x536241['query']);_0x13f904[_0xf7f5('0x35')]=_[_0xf7f5('0x36')](_0x13f904['model'],_0x13f904[_0xf7f5('0x34')]);_0x55ff11[_0xf7f5('0x37')]=_[_0xf7f5('0x36')](_0x13f904[_0xf7f5('0x33')],qs[_0xf7f5('0x38')](_0x536241['query'][_0xf7f5('0x38')]));_0x55ff11[_0xf7f5('0x37')]=_0x55ff11['attributes'][_0xf7f5('0x39')]?_0x55ff11['attributes']:_0x13f904[_0xf7f5('0x33')];if(!_0x536241['query'][_0xf7f5('0x3a')](_0xf7f5('0x3b'))){_0x55ff11[_0xf7f5('0x19')]=qs[_0xf7f5('0x19')](_0x536241[_0xf7f5('0x34')][_0xf7f5('0x19')]);_0x55ff11[_0xf7f5('0x1b')]=qs[_0xf7f5('0x1b')](_0x536241[_0xf7f5('0x34')]['offset']);}_0x55ff11[_0xf7f5('0x3c')]=qs[_0xf7f5('0x3d')](_0x536241[_0xf7f5('0x34')][_0xf7f5('0x3d')]);_0x55ff11[_0xf7f5('0x3e')]=qs[_0xf7f5('0x35')](_[_0xf7f5('0x3f')](_0x536241[_0xf7f5('0x34')],_0x13f904['filters']),_0x22aea7);if(_0x536241[_0xf7f5('0x34')][_0xf7f5('0x40')]){_0x55ff11['where']=_[_0xf7f5('0x41')](_0x55ff11['where'],{'$or':[{'key':{'$like':'%'+_0x536241['query'][_0xf7f5('0x40')]+'%'}},{'value':{'$like':'%'+_0x536241['query'][_0xf7f5('0x40')]+'%'}}]});}_0x55ff11=_['merge']({},_0x55ff11,_0x536241[_0xf7f5('0x42')]);var _0x59213e={'where':_0x55ff11[_0xf7f5('0x3e')]};return db[_0xf7f5('0x2e')]['count'](_0x59213e)[_0xf7f5('0x22')](function(_0x28a9b2){_0x492007[_0xf7f5('0x1c')]=_0x28a9b2;if(_0x536241['query'][_0xf7f5('0x43')]){_0x55ff11[_0xf7f5('0x44')]=[{'all':!![]}];}return db[_0xf7f5('0x2e')][_0xf7f5('0x45')](_0x55ff11);})['then'](function(_0x5ee287){_0x492007[_0xf7f5('0x46')]=_0x5ee287;return _0x492007;})[_0xf7f5('0x22')](respondWithFilteredResult(_0x47b900,_0x55ff11))[_0xf7f5('0x47')](handleError(_0x47b900,null));};exports[_0xf7f5('0x48')]=function(_0x3b3e80,_0x30273d){var _0x1b4e08={'raw':!![],'where':{'id':_0x3b3e80[_0xf7f5('0x49')]['id']}},_0x2f6744={};_0x2f6744['model']=_[_0xf7f5('0x4a')](db[_0xf7f5('0x2e')][_0xf7f5('0x2f')]);_0x2f6744[_0xf7f5('0x34')]=_['keys'](_0x3b3e80[_0xf7f5('0x34')]);_0x2f6744['filters']=_[_0xf7f5('0x36')](_0x2f6744[_0xf7f5('0x33')],_0x2f6744[_0xf7f5('0x34')]);_0x1b4e08[_0xf7f5('0x37')]=_[_0xf7f5('0x36')](_0x2f6744[_0xf7f5('0x33')],qs[_0xf7f5('0x38')](_0x3b3e80[_0xf7f5('0x34')][_0xf7f5('0x38')]));_0x1b4e08[_0xf7f5('0x37')]=_0x1b4e08['attributes'][_0xf7f5('0x39')]?_0x1b4e08[_0xf7f5('0x37')]:_0x2f6744[_0xf7f5('0x33')];if(_0x3b3e80[_0xf7f5('0x34')]['includeAll']){_0x1b4e08['include']=[{'all':!![]}];}_0x1b4e08=_[_0xf7f5('0x41')]({},_0x1b4e08,_0x3b3e80[_0xf7f5('0x42')]);return db[_0xf7f5('0x2e')][_0xf7f5('0x4b')](_0x1b4e08)[_0xf7f5('0x22')](handleEntityNotFound(_0x30273d,null))[_0xf7f5('0x22')](respondWithResult(_0x30273d,null))[_0xf7f5('0x47')](handleError(_0x30273d,null));};exports[_0xf7f5('0x21')]=function(_0x118053,_0x1f5158){if(_0x118053[_0xf7f5('0x4c')]['id']){delete _0x118053[_0xf7f5('0x4c')]['id'];}return db[_0xf7f5('0x2e')]['find']({'where':{'id':_0x118053[_0xf7f5('0x49')]['id']}})[_0xf7f5('0x22')](handleEntityNotFound(_0x1f5158,null))[_0xf7f5('0x22')](saveUpdates(_0x118053['body'],null))[_0xf7f5('0x22')](respondWithResult(_0x1f5158,null))[_0xf7f5('0x47')](handleError(_0x1f5158,null));};exports[_0xf7f5('0x23')]=function(_0x330d0d,_0x1d61f6){return db['CannedAnswer'][_0xf7f5('0x4b')]({'where':{'id':_0x330d0d['params']['id']}})[_0xf7f5('0x22')](handleEntityNotFound(_0x1d61f6,null))[_0xf7f5('0x22')](removeEntity(_0x1d61f6,null))['catch'](handleError(_0x1d61f6,null));};exports[_0xf7f5('0x4d')]=function(_0x536036,_0x4d35a3){var _0x5d6ebe={'key':_0x536036[_0xf7f5('0x4c')][_0xf7f5('0x32')]};if(_0x536036[_0xf7f5('0x4c')][_0xf7f5('0x4e')]){_0x5d6ebe[_0xf7f5('0x4e')]=_0x536036[_0xf7f5('0x4c')][_0xf7f5('0x4e')];}else if(_0x536036['body'][_0xf7f5('0x4f')]){_0x5d6ebe[_0xf7f5('0x4f')]=_0x536036[_0xf7f5('0x4c')][_0xf7f5('0x4f')];}else if(_0x536036[_0xf7f5('0x4c')][_0xf7f5('0x50')]){_0x5d6ebe[_0xf7f5('0x50')]=_0x536036['body'][_0xf7f5('0x50')];}else if(_0x536036[_0xf7f5('0x4c')]['ChatWebsiteId']){_0x5d6ebe[_0xf7f5('0x51')]=_0x536036[_0xf7f5('0x4c')][_0xf7f5('0x51')];}return db[_0xf7f5('0x2e')]['find']({'where':_0x5d6ebe})[_0xf7f5('0x22')](function(_0x57cffd){if(_0x57cffd){throw new db[(_0xf7f5('0x52'))]['ValidationError'](_0xf7f5('0x53'));}return db[_0xf7f5('0x2e')][_0xf7f5('0x4d')](_0x536036['body']);})['then'](function(_0xf4de58){var _0x442824=_0x536036[_0xf7f5('0x54')][_0xf7f5('0x24')]({'plain':!![]});if(!_0x442824)throw new Error(_0xf7f5('0x55'));if(_0x442824['role']===_0xf7f5('0x54')){var _0x45114c=_0xf4de58[_0xf7f5('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xf7f5('0x4b')]({'where':{'name':_0xf7f5('0x25'),'userProfileId':_0x442824['userProfileId']},'raw':!![]})[_0xf7f5('0x22')](function(_0x39975d){if(_0x39975d&&_0x39975d[_0xf7f5('0x56')]===0x0){return db[_0xf7f5('0x26')][_0xf7f5('0x4d')]({'name':_0x45114c[_0xf7f5('0x2a')],'resourceId':_0x45114c['id'],'type':_0x39975d[_0xf7f5('0x2a')],'sectionId':_0x39975d['id']},{})[_0xf7f5('0x22')](function(){return _0xf4de58;});}else{return _0xf4de58;}})['catch'](function(_0x11b296){logger[_0xf7f5('0x28')](_0xf7f5('0x57'),_0x11b296);throw _0x11b296;});}return _0xf4de58;})[_0xf7f5('0x22')](respondWithResult(_0x4d35a3,0xc9))['catch'](handleError(_0x4d35a3,null));}; \ No newline at end of file +var _0x115e=['send','map','CannedAnswer','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','body','params','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','reject','save','destroy','then','CannedAnswers','UserProfileResource','sendStatus','error','stack','name'];(function(_0x5e55aa,_0x253978){var _0x3e46a7=function(_0x4ecbb3){while(--_0x4ecbb3){_0x5e55aa['push'](_0x5e55aa['shift']());}};_0x3e46a7(++_0x253978);}(_0x115e,0x1e4));var _0xe115=function(_0x13452,_0x4d9e74){_0x13452=_0x13452-0x0;var _0x56e1e0=_0x115e[_0x13452];return _0x56e1e0;};'use strict';var emlformat=require(_0xe115('0x0'));var rimraf=require(_0xe115('0x1'));var zipdir=require(_0xe115('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe115('0x3'));var util=require(_0xe115('0x4'));var path=require(_0xe115('0x5'));var sox=require(_0xe115('0x6'));var csv=require(_0xe115('0x7'));var ejs=require(_0xe115('0x8'));var fs=require('fs');var fs_extra=require(_0xe115('0x9'));var _=require(_0xe115('0xa'));var squel=require(_0xe115('0xb'));var crypto=require(_0xe115('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe115('0xd'));var toCsv=require(_0xe115('0x7'));var querystring=require(_0xe115('0xe'));var Papa=require(_0xe115('0xf'));var Redis=require(_0xe115('0x10'));var authService=require(_0xe115('0x11'));var qs=require(_0xe115('0x12'));var as=require(_0xe115('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe115('0x14'))(_0xe115('0x15'));var utils=require(_0xe115('0x16'));var config=require(_0xe115('0x17'));var licenseUtil=require(_0xe115('0x18'));var db=require(_0xe115('0x19'))['db'];function respondWithStatusCode(_0xc45213,_0x5999c2){_0x5999c2=_0x5999c2||0xcc;return function(_0x40c073){if(_0x40c073){return _0xc45213['sendStatus'](_0x5999c2);}return _0xc45213[_0xe115('0x1a')](_0x5999c2)[_0xe115('0x1b')]();};}function respondWithResult(_0x33f310,_0x4c1dde){_0x4c1dde=_0x4c1dde||0xc8;return function(_0x35c27d){if(_0x35c27d){return _0x33f310['status'](_0x4c1dde)[_0xe115('0x1c')](_0x35c27d);}};}function respondWithFilteredResult(_0xa20c2c,_0x72762d){return function(_0x5b4a20){if(_0x5b4a20){var _0x3c9e8d=typeof _0x72762d[_0xe115('0x1d')]===_0xe115('0x1e')&&typeof _0x72762d['limit']==='undefined';var _0x176800=_0x5b4a20[_0xe115('0x1f')];var _0x1b2280=_0x3c9e8d?0x0:_0x72762d[_0xe115('0x1d')];var _0x82812e=_0x3c9e8d?_0x5b4a20[_0xe115('0x1f')]:_0x72762d[_0xe115('0x1d')]+_0x72762d['limit'];var _0x30e64d;if(_0x82812e>=_0x176800){_0x82812e=_0x176800;_0x30e64d=0xc8;}else{_0x30e64d=0xce;}_0xa20c2c[_0xe115('0x1a')](_0x30e64d);return _0xa20c2c[_0xe115('0x20')](_0xe115('0x21'),_0x1b2280+'-'+_0x82812e+'/'+_0x176800)[_0xe115('0x1c')](_0x5b4a20);}return null;};}function patchUpdates(_0x102918){return function(_0x80d017){try{jsonpatch['apply'](_0x80d017,_0x102918,!![]);}catch(_0x22e7d2){return BPromise[_0xe115('0x22')](_0x22e7d2);}return _0x80d017[_0xe115('0x23')]();};}function saveUpdates(_0x28c457,_0x58afc5){return function(_0x2c36a4){if(_0x2c36a4){return _0x2c36a4['update'](_0x28c457)['then'](function(_0x541858){return _0x541858;});}return null;};}function removeEntity(_0x20fb71,_0x3480f4){return function(_0x5cb3c9){if(_0x5cb3c9){return _0x5cb3c9[_0xe115('0x24')]()[_0xe115('0x25')](function(){var _0x2ca325=_0x5cb3c9['get']({'plain':!![]});var _0x49ba65=_0xe115('0x26');return db[_0xe115('0x27')][_0xe115('0x24')]({'where':{'type':_0x49ba65,'resourceId':_0x2ca325['id']}})['then'](function(){return _0x5cb3c9;});})[_0xe115('0x25')](function(){_0x20fb71['status'](0xcc)[_0xe115('0x1b')]();});}};}function handleEntityNotFound(_0x108161,_0x597a2a){return function(_0x4494e0){if(!_0x4494e0){_0x108161[_0xe115('0x28')](0x194);}return _0x4494e0;};}function handleError(_0x301a8e,_0x9d288f){_0x9d288f=_0x9d288f||0x1f4;return function(_0x31954b){logger[_0xe115('0x29')](_0x31954b[_0xe115('0x2a')]);if(_0x31954b[_0xe115('0x2b')]){delete _0x31954b[_0xe115('0x2b')];}_0x301a8e[_0xe115('0x1a')](_0x9d288f)[_0xe115('0x2c')](_0x31954b);};}exports['index']=function(_0x31343b,_0x3c7277){var _0x5b596e={},_0x18e492={},_0x477360={'count':0x0,'rows':[]};var _0x3b1ea7=_[_0xe115('0x2d')](db[_0xe115('0x2e')]['rawAttributes'],function(_0x2e4050){return{'name':_0x2e4050[_0xe115('0x2f')],'type':_0x2e4050[_0xe115('0x30')]['key']};});_0x18e492[_0xe115('0x31')]=_[_0xe115('0x2d')](_0x3b1ea7,'name');_0x18e492[_0xe115('0x32')]=_['keys'](_0x31343b[_0xe115('0x32')]);_0x18e492[_0xe115('0x33')]=_[_0xe115('0x34')](_0x18e492[_0xe115('0x31')],_0x18e492[_0xe115('0x32')]);_0x5b596e['attributes']=_[_0xe115('0x34')](_0x18e492[_0xe115('0x31')],qs[_0xe115('0x35')](_0x31343b[_0xe115('0x32')][_0xe115('0x35')]));_0x5b596e[_0xe115('0x36')]=_0x5b596e['attributes'][_0xe115('0x37')]?_0x5b596e[_0xe115('0x36')]:_0x18e492[_0xe115('0x31')];if(!_0x31343b[_0xe115('0x32')][_0xe115('0x38')](_0xe115('0x39'))){_0x5b596e[_0xe115('0x3a')]=qs[_0xe115('0x3a')](_0x31343b[_0xe115('0x32')][_0xe115('0x3a')]);_0x5b596e[_0xe115('0x1d')]=qs[_0xe115('0x1d')](_0x31343b[_0xe115('0x32')][_0xe115('0x1d')]);}_0x5b596e['order']=qs[_0xe115('0x3b')](_0x31343b[_0xe115('0x32')][_0xe115('0x3b')]);_0x5b596e[_0xe115('0x3c')]=qs[_0xe115('0x33')](_['pick'](_0x31343b['query'],_0x18e492[_0xe115('0x33')]),_0x3b1ea7);if(_0x31343b[_0xe115('0x32')][_0xe115('0x3d')]){_0x5b596e['where']=_[_0xe115('0x3e')](_0x5b596e[_0xe115('0x3c')],{'$or':[{'key':{'$like':'%'+_0x31343b['query'][_0xe115('0x3d')]+'%'}},{'value':{'$like':'%'+_0x31343b['query'][_0xe115('0x3d')]+'%'}}]});}_0x5b596e=_[_0xe115('0x3e')]({},_0x5b596e,_0x31343b['options']);var _0x4dc4e2={'where':_0x5b596e[_0xe115('0x3c')]};return db[_0xe115('0x2e')]['count'](_0x4dc4e2)['then'](function(_0x4eb82a){_0x477360[_0xe115('0x1f')]=_0x4eb82a;if(_0x31343b['query'][_0xe115('0x3f')]){_0x5b596e[_0xe115('0x40')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe115('0x41')](_0x5b596e);})[_0xe115('0x25')](function(_0x5b6a93){_0x477360[_0xe115('0x42')]=_0x5b6a93;return _0x477360;})['then'](respondWithFilteredResult(_0x3c7277,_0x5b596e))[_0xe115('0x43')](handleError(_0x3c7277,null));};exports['show']=function(_0x27f16c,_0x47a5e2){var _0x1fea93={'raw':!![],'where':{'id':_0x27f16c['params']['id']}},_0x5aec97={};_0x5aec97[_0xe115('0x31')]=_[_0xe115('0x44')](db['CannedAnswer'][_0xe115('0x45')]);_0x5aec97[_0xe115('0x32')]=_[_0xe115('0x44')](_0x27f16c['query']);_0x5aec97[_0xe115('0x33')]=_[_0xe115('0x34')](_0x5aec97[_0xe115('0x31')],_0x5aec97[_0xe115('0x32')]);_0x1fea93[_0xe115('0x36')]=_['intersection'](_0x5aec97[_0xe115('0x31')],qs['fields'](_0x27f16c[_0xe115('0x32')][_0xe115('0x35')]));_0x1fea93[_0xe115('0x36')]=_0x1fea93[_0xe115('0x36')][_0xe115('0x37')]?_0x1fea93['attributes']:_0x5aec97[_0xe115('0x31')];if(_0x27f16c[_0xe115('0x32')][_0xe115('0x3f')]){_0x1fea93[_0xe115('0x40')]=[{'all':!![]}];}_0x1fea93=_['merge']({},_0x1fea93,_0x27f16c['options']);return db[_0xe115('0x2e')][_0xe115('0x46')](_0x1fea93)[_0xe115('0x25')](handleEntityNotFound(_0x47a5e2,null))[_0xe115('0x25')](respondWithResult(_0x47a5e2,null))['catch'](handleError(_0x47a5e2,null));};exports['update']=function(_0x320ebc,_0x17dcaf){if(_0x320ebc['body']['id']){delete _0x320ebc[_0xe115('0x47')]['id'];}return db['CannedAnswer'][_0xe115('0x46')]({'where':{'id':_0x320ebc[_0xe115('0x48')]['id']}})['then'](handleEntityNotFound(_0x17dcaf,null))['then'](saveUpdates(_0x320ebc[_0xe115('0x47')],null))['then'](respondWithResult(_0x17dcaf,null))[_0xe115('0x43')](handleError(_0x17dcaf,null));};exports['destroy']=function(_0x281ffe,_0x39006e){return db[_0xe115('0x2e')][_0xe115('0x46')]({'where':{'id':_0x281ffe[_0xe115('0x48')]['id']}})[_0xe115('0x25')](handleEntityNotFound(_0x39006e,null))['then'](removeEntity(_0x39006e,null))[_0xe115('0x43')](handleError(_0x39006e,null));};exports['create']=function(_0x1418ea,_0x131709){var _0x479158={'key':_0x1418ea[_0xe115('0x47')][_0xe115('0x49')]};if(_0x1418ea['body']['MailAccountId']){_0x479158[_0xe115('0x4a')]=_0x1418ea[_0xe115('0x47')]['MailAccountId'];}else if(_0x1418ea[_0xe115('0x47')]['SmsAccountId']){_0x479158[_0xe115('0x4b')]=_0x1418ea[_0xe115('0x47')][_0xe115('0x4b')];}else if(_0x1418ea['body'][_0xe115('0x4c')]){_0x479158['OpenchannelAccountId']=_0x1418ea['body'][_0xe115('0x4c')];}else if(_0x1418ea[_0xe115('0x47')][_0xe115('0x4d')]){_0x479158[_0xe115('0x4d')]=_0x1418ea['body']['ChatWebsiteId'];}return db[_0xe115('0x2e')][_0xe115('0x46')]({'where':_0x479158})[_0xe115('0x25')](function(_0x54f9ff){if(_0x54f9ff){throw new db[(_0xe115('0x4e'))][(_0xe115('0x4f'))](_0xe115('0x50'));}return db['CannedAnswer']['create'](_0x1418ea['body']);})[_0xe115('0x25')](function(_0x510740){var _0xc61e3e=_0x1418ea[_0xe115('0x51')][_0xe115('0x52')]({'plain':!![]});if(!_0xc61e3e)throw new Error(_0xe115('0x53'));if(_0xc61e3e['role']===_0xe115('0x51')){var _0x46da2a=_0x510740[_0xe115('0x52')]({'plain':!![]});return db['UserProfileSection'][_0xe115('0x46')]({'where':{'name':_0xe115('0x26'),'userProfileId':_0xc61e3e[_0xe115('0x54')]},'raw':!![]})[_0xe115('0x25')](function(_0xb5c25c){if(_0xb5c25c&&_0xb5c25c[_0xe115('0x55')]===0x0){return db['UserProfileResource'][_0xe115('0x56')]({'name':_0x46da2a['name'],'resourceId':_0x46da2a['id'],'type':_0xb5c25c[_0xe115('0x2b')],'sectionId':_0xb5c25c['id']},{})[_0xe115('0x25')](function(){return _0x510740;});}else{return _0x510740;}})['catch'](function(_0x405a47){logger[_0xe115('0x29')](_0xe115('0x57'),_0x405a47);throw _0x405a47;});}return _0x510740;})[_0xe115('0x25')](respondWithResult(_0x131709,0xc9))[_0xe115('0x43')](handleError(_0x131709,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index adc04fb..c61922a 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 _0x94fd=['bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x123f6b,_0x52a359){var _0x4d8666=function(_0x8b74b3){while(--_0x8b74b3){_0x123f6b['push'](_0x123f6b['shift']());}};_0x4d8666(++_0x52a359);}(_0x94fd,0x14c));var _0xd94f=function(_0x3e77ac,_0x28d7d2){_0x3e77ac=_0x3e77ac-0x0;var _0x33306d=_0x94fd[_0x3e77ac];return _0x33306d;};'use strict';var _=require(_0xd94f('0x0'));var util=require('util');var logger=require(_0xd94f('0x1'))(_0xd94f('0x2'));var moment=require(_0xd94f('0x3'));var BPromise=require(_0xd94f('0x4'));var rp=require(_0xd94f('0x5'));var fs=require('fs');var path=require(_0xd94f('0x6'));var rimraf=require(_0xd94f('0x7'));var config=require('../../config/environment');var attributes=require(_0xd94f('0x8'));module[_0xd94f('0x9')]=function(_0x272a59,_0x567dff){return _0x272a59[_0xd94f('0xa')](_0xd94f('0xb'),attributes,{'tableName':_0xd94f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd94f('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc91e=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x373bd6,_0x5d6ac8){var _0x328371=function(_0x305c8f){while(--_0x305c8f){_0x373bd6['push'](_0x373bd6['shift']());}};_0x328371(++_0x5d6ac8);}(_0xc91e,0xf3));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xec91('0x0'));var logger=require(_0xec91('0x1'))(_0xec91('0x2'));var moment=require(_0xec91('0x3'));var BPromise=require(_0xec91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec91('0x5'));var rimraf=require(_0xec91('0x6'));var config=require(_0xec91('0x7'));var attributes=require(_0xec91('0x8'));module[_0xec91('0x9')]=function(_0xc3a2a1,_0x4c78af){return _0xc3a2a1[_0xec91('0xa')](_0xec91('0xb'),attributes,{'tableName':_0xec91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xec91('0xd'),'collate':_0xec91('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f095cd2..ccd553a 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(_0x4f6f37,_0x5d615e){var _0x436f14=function(_0x3b7a40){while(--_0x3b7a40){_0x4f6f37['push'](_0x4f6f37['shift']());}};_0x436f14(++_0x5d615e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x472833,_0x1720f4){var _0x1365c0=function(_0x1f2ba5){while(--_0x1f2ba5){_0x472833['push'](_0x472833['shift']());}};_0x1365c0(++_0x1720f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 76aeb77..8995103 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 _0x2a8d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0xac15c3,_0x2451ea){var _0x3ef3db=function(_0x361906){while(--_0x361906){_0xac15c3['push'](_0xac15c3['shift']());}};_0x3ef3db(++_0x2451ea);}(_0x2a8d,0xa0));var _0xd2a8=function(_0x455f19,_0x4f8f3a){_0x455f19=_0x455f19-0x0;var _0x422f21=_0x2a8d[_0x455f19];return _0x422f21;};'use strict';var multer=require(_0xd2a8('0x0'));var util=require(_0xd2a8('0x1'));var path=require(_0xd2a8('0x2'));var timeout=require(_0xd2a8('0x3'));var express=require(_0xd2a8('0x4'));var router=express[_0xd2a8('0x5')]();var fs_extra=require(_0xd2a8('0x6'));var auth=require(_0xd2a8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd2a8('0x8'));var controller=require('./cannedAnswer.controller');router[_0xd2a8('0x9')]('/',auth[_0xd2a8('0xa')](),controller['index']);router[_0xd2a8('0x9')](_0xd2a8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd2a8('0xc')]('/',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0xd')]);router[_0xd2a8('0xe')](_0xd2a8('0xb'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0xf')]);router[_0xd2a8('0x10')](_0xd2a8('0xb'),auth['isAuthenticated'](),controller[_0xd2a8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd5e5=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x121985,_0x252db3){var _0x20bc79=function(_0x30889b){while(--_0x30889b){_0x121985['push'](_0x121985['shift']());}};_0x20bc79(++_0x252db3);}(_0xd5e5,0xd9));var _0x5d5e=function(_0x193372,_0x10ecce){_0x193372=_0x193372-0x0;var _0x9c8117=_0xd5e5[_0x193372];return _0x9c8117;};'use strict';var multer=require(_0x5d5e('0x0'));var util=require(_0x5d5e('0x1'));var path=require(_0x5d5e('0x2'));var timeout=require(_0x5d5e('0x3'));var express=require(_0x5d5e('0x4'));var router=express[_0x5d5e('0x5')]();var fs_extra=require(_0x5d5e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5d5e('0x7'));var config=require(_0x5d5e('0x8'));var controller=require(_0x5d5e('0x9'));router[_0x5d5e('0xa')]('/',auth[_0x5d5e('0xb')](),controller['index']);router[_0x5d5e('0xa')](_0x5d5e('0xc'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0xd')]);router[_0x5d5e('0xe')]('/',auth[_0x5d5e('0xb')](),controller[_0x5d5e('0xf')]);router[_0x5d5e('0x10')](_0x5d5e('0xc'),auth[_0x5d5e('0xb')](),controller['update']);router[_0x5d5e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5d5e('0x12')]);module[_0x5d5e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ec15f13..5042c4e 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 _0xd49c=['exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x3b2a1a,_0x41cc9c){var _0x342ec8=function(_0x338faf){while(--_0x338faf){_0x3b2a1a['push'](_0x3b2a1a['shift']());}};_0x342ec8(++_0x41cc9c);}(_0xd49c,0x1d8));var _0xcd49=function(_0xc10a65,_0x3ccf9a){_0xc10a65=_0xc10a65-0x0;var _0x28bd31=_0xd49c[_0xc10a65];return _0x28bd31;};'use strict';var Sequelize=require('sequelize');module[_0xcd49('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xcd49('0x1')},'clid':{'type':Sequelize[_0xcd49('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xcd49('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcd49('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xcd49('0x2')]},'lastdata':{'type':Sequelize[_0xcd49('0x2')]},'duration':{'type':Sequelize[_0xcd49('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xcd49('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcd49('0x2')]},'amaflags':{'type':Sequelize[_0xcd49('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xcd49('0x2')]},'userfield':{'type':Sequelize[_0xcd49('0x2')]},'uniqueid':{'type':Sequelize[_0xcd49('0x2')]},'linkedid':{'type':Sequelize[_0xcd49('0x2')]},'sequence':{'type':Sequelize[_0xcd49('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcd49('0x2')]},'tag':{'type':Sequelize[_0xcd49('0x2')]}}; \ No newline at end of file +var _0x16c1=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x16c1,0x66));var _0x116c=function(_0x154303,_0x4449fa){_0x154303=_0x154303-0x0;var _0x4295fb=_0x16c1[_0x154303];return _0x4295fb;};'use strict';var Sequelize=require(_0x116c('0x0'));module[_0x116c('0x1')]={'calldate':{'type':Sequelize[_0x116c('0x2')],'allowNull':![],'defaultValue':_0x116c('0x3')},'clid':{'type':Sequelize[_0x116c('0x4')]},'src':{'type':Sequelize[_0x116c('0x4')]},'dst':{'type':Sequelize[_0x116c('0x4')]},'dcontext':{'type':Sequelize[_0x116c('0x4')]},'channel':{'type':Sequelize[_0x116c('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x116c('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x116c('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x116c('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x116c('0x4')]},'amaflags':{'type':Sequelize[_0x116c('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x116c('0x4')]},'userfield':{'type':Sequelize[_0x116c('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x116c('0x4')]},'sequence':{'type':Sequelize[_0x116c('0x4')]},'peeraccount':{'type':Sequelize[_0x116c('0x4')]},'type':{'type':Sequelize[_0x116c('0x4')]},'tag':{'type':Sequelize[_0x116c('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 06dd275..f8f2fac 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 _0x9fd4=['../../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','destroy','then','error','stack','name','index','map','Cdr','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3a49ed,_0x5942c0){_0x3a49ed=_0x3a49ed-0x0;var _0xfc681=_0x9fd4[_0x3a49ed];return _0xfc681;};'use strict';var emlformat=require(_0x49fd('0x0'));var rimraf=require(_0x49fd('0x1'));var zipdir=require(_0x49fd('0x2'));var jsonpatch=require(_0x49fd('0x3'));var rp=require(_0x49fd('0x4'));var moment=require(_0x49fd('0x5'));var BPromise=require(_0x49fd('0x6'));var Mustache=require(_0x49fd('0x7'));var util=require(_0x49fd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x49fd('0x9'));var ejs=require(_0x49fd('0xa'));var fs=require('fs');var fs_extra=require(_0x49fd('0xb'));var _=require(_0x49fd('0xc'));var squel=require('squel');var crypto=require(_0x49fd('0xd'));var jsforce=require(_0x49fd('0xe'));var deskjs=require(_0x49fd('0xf'));var toCsv=require(_0x49fd('0x9'));var querystring=require(_0x49fd('0x10'));var Papa=require('papaparse');var Redis=require(_0x49fd('0x11'));var authService=require(_0x49fd('0x12'));var qs=require(_0x49fd('0x13'));var as=require(_0x49fd('0x14'));var hardwareService=require(_0x49fd('0x15'));var logger=require(_0x49fd('0x16'))(_0x49fd('0x17'));var utils=require('../../config/utils');var config=require(_0x49fd('0x18'));var licenseUtil=require(_0x49fd('0x19'));var db=require(_0x49fd('0x1a'))['db'];function respondWithStatusCode(_0x40d1b0,_0x15dabd){_0x15dabd=_0x15dabd||0xcc;return function(_0x206bd8){if(_0x206bd8){return _0x40d1b0[_0x49fd('0x1b')](_0x15dabd);}return _0x40d1b0[_0x49fd('0x1c')](_0x15dabd)[_0x49fd('0x1d')]();};}function respondWithResult(_0x652890,_0x157b09){_0x157b09=_0x157b09||0xc8;return function(_0x44c18c){if(_0x44c18c){return _0x652890[_0x49fd('0x1c')](_0x157b09)[_0x49fd('0x1e')](_0x44c18c);}};}function respondWithFilteredResult(_0x264ab1,_0x201109){return function(_0x2859f2){if(_0x2859f2){var _0x3ca675=typeof _0x201109[_0x49fd('0x1f')]===_0x49fd('0x20')&&typeof _0x201109[_0x49fd('0x21')]===_0x49fd('0x20');var _0x320fe5=_0x2859f2[_0x49fd('0x22')];var _0xb55d24=_0x3ca675?0x0:_0x201109[_0x49fd('0x1f')];var _0x598793=_0x3ca675?_0x2859f2[_0x49fd('0x22')]:_0x201109[_0x49fd('0x1f')]+_0x201109['limit'];var _0x5c323a;if(_0x598793>=_0x320fe5){_0x598793=_0x320fe5;_0x5c323a=0xc8;}else{_0x5c323a=0xce;}_0x264ab1[_0x49fd('0x1c')](_0x5c323a);return _0x264ab1['set'](_0x49fd('0x23'),_0xb55d24+'-'+_0x598793+'/'+_0x320fe5)[_0x49fd('0x1e')](_0x2859f2);}return null;};}function patchUpdates(_0x599315){return function(_0xf7efcf){try{jsonpatch[_0x49fd('0x24')](_0xf7efcf,_0x599315,!![]);}catch(_0x5ae3bc){return BPromise[_0x49fd('0x25')](_0x5ae3bc);}return _0xf7efcf[_0x49fd('0x26')]();};}function saveUpdates(_0x2e1c40,_0x290f59){return function(_0x20fa0d){if(_0x20fa0d){return _0x20fa0d[_0x49fd('0x27')](_0x2e1c40)['then'](function(_0x46019d){return _0x46019d;});}return null;};}function removeEntity(_0xd43815,_0x8f202b){return function(_0x4bf811){if(_0x4bf811){return _0x4bf811[_0x49fd('0x28')]()[_0x49fd('0x29')](function(){_0xd43815[_0x49fd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597161,_0x497469){return function(_0x13c5a8){if(!_0x13c5a8){_0x597161[_0x49fd('0x1b')](0x194);}return _0x13c5a8;};}function handleError(_0x4ec190,_0x302ab2){_0x302ab2=_0x302ab2||0x1f4;return function(_0x9587b9){logger[_0x49fd('0x2a')](_0x9587b9[_0x49fd('0x2b')]);if(_0x9587b9[_0x49fd('0x2c')]){delete _0x9587b9['name'];}_0x4ec190[_0x49fd('0x1c')](_0x302ab2)['send'](_0x9587b9);};}exports[_0x49fd('0x2d')]=function(_0x89badc,_0x54acb5){var _0x203038={},_0x2c8568={},_0x23374c={'count':0x0,'rows':[]};var _0x43826f=_[_0x49fd('0x2e')](db[_0x49fd('0x2f')][_0x49fd('0x30')],function(_0x242203){return{'name':_0x242203['fieldName'],'type':_0x242203[_0x49fd('0x31')]['key']};});_0x2c8568[_0x49fd('0x32')]=_['map'](_0x43826f,_0x49fd('0x2c'));_0x2c8568[_0x49fd('0x33')]=_[_0x49fd('0x34')](_0x89badc['query']);_0x2c8568['filters']=_['intersection'](_0x2c8568[_0x49fd('0x32')],_0x2c8568[_0x49fd('0x33')]);_0x203038['attributes']=_[_0x49fd('0x35')](_0x2c8568['model'],qs['fields'](_0x89badc[_0x49fd('0x33')][_0x49fd('0x36')]));_0x203038[_0x49fd('0x37')]=_0x203038[_0x49fd('0x37')][_0x49fd('0x38')]?_0x203038['attributes']:_0x2c8568['model'];if(!_0x89badc[_0x49fd('0x33')][_0x49fd('0x39')](_0x49fd('0x3a'))){_0x203038[_0x49fd('0x21')]=qs['limit'](_0x89badc[_0x49fd('0x33')][_0x49fd('0x21')]);_0x203038[_0x49fd('0x1f')]=qs[_0x49fd('0x1f')](_0x89badc[_0x49fd('0x33')][_0x49fd('0x1f')]);}_0x203038[_0x49fd('0x3b')]=qs[_0x49fd('0x3c')](_0x89badc[_0x49fd('0x33')][_0x49fd('0x3c')]);_0x203038[_0x49fd('0x3d')]=qs['filters'](_[_0x49fd('0x3e')](_0x89badc[_0x49fd('0x33')],_0x2c8568[_0x49fd('0x3f')]),_0x43826f);if(_0x89badc[_0x49fd('0x33')][_0x49fd('0x40')]){_0x203038[_0x49fd('0x3d')]=_[_0x49fd('0x41')](_0x203038[_0x49fd('0x3d')],{'$or':_[_0x49fd('0x2e')](_0x43826f,function(_0x4a1856){if(_0x4a1856[_0x49fd('0x31')]!=='VIRTUAL'){var _0x46e84c={};_0x46e84c[_0x4a1856[_0x49fd('0x2c')]]={'$like':'%'+_0x89badc['query'][_0x49fd('0x40')]+'%'};return _0x46e84c;}})});}_0x203038=_[_0x49fd('0x41')]({},_0x203038,_0x89badc['options']);var _0x1f9a65={'where':_0x203038['where']};return db['Cdr']['count'](_0x1f9a65)[_0x49fd('0x29')](function(_0x32982e){_0x23374c[_0x49fd('0x22')]=_0x32982e;if(_0x89badc[_0x49fd('0x33')]['includeAll']){_0x203038[_0x49fd('0x42')]=[{'all':!![]}];}return db[_0x49fd('0x2f')][_0x49fd('0x43')](_0x203038);})[_0x49fd('0x29')](function(_0x115c5a){_0x23374c[_0x49fd('0x44')]=_0x115c5a;return _0x23374c;})[_0x49fd('0x29')](respondWithFilteredResult(_0x54acb5,_0x203038))[_0x49fd('0x45')](handleError(_0x54acb5,null));};exports['show']=function(_0x255a73,_0x2c8ab1){var _0x4dce94={'raw':!![],'where':{'id':_0x255a73[_0x49fd('0x46')]['id']}},_0x3be41b={};_0x3be41b['model']=_[_0x49fd('0x34')](db['Cdr'][_0x49fd('0x30')]);_0x3be41b[_0x49fd('0x33')]=_[_0x49fd('0x34')](_0x255a73[_0x49fd('0x33')]);_0x3be41b['filters']=_['intersection'](_0x3be41b[_0x49fd('0x32')],_0x3be41b['query']);_0x4dce94[_0x49fd('0x37')]=_[_0x49fd('0x35')](_0x3be41b[_0x49fd('0x32')],qs[_0x49fd('0x36')](_0x255a73['query'][_0x49fd('0x36')]));_0x4dce94[_0x49fd('0x37')]=_0x4dce94[_0x49fd('0x37')][_0x49fd('0x38')]?_0x4dce94[_0x49fd('0x37')]:_0x3be41b[_0x49fd('0x32')];if(_0x255a73[_0x49fd('0x33')][_0x49fd('0x47')]){_0x4dce94[_0x49fd('0x42')]=[{'all':!![]}];}_0x4dce94=_[_0x49fd('0x41')]({},_0x4dce94,_0x255a73[_0x49fd('0x48')]);return db[_0x49fd('0x2f')][_0x49fd('0x49')](_0x4dce94)[_0x49fd('0x29')](handleEntityNotFound(_0x2c8ab1,null))['then'](respondWithResult(_0x2c8ab1,null))['catch'](handleError(_0x2c8ab1,null));};exports[_0x49fd('0x4a')]=function(_0xa3518f,_0x42287e){return db[_0x49fd('0x2f')]['create'](_0xa3518f[_0x49fd('0x4b')],{})[_0x49fd('0x29')](respondWithResult(_0x42287e,0xc9))['catch'](handleError(_0x42287e,null));};exports[_0x49fd('0x27')]=function(_0x270360,_0xaac56f){if(_0x270360[_0x49fd('0x4b')]['id']){delete _0x270360[_0x49fd('0x4b')]['id'];}return db[_0x49fd('0x2f')][_0x49fd('0x49')]({'where':{'id':_0x270360[_0x49fd('0x46')]['id']}})[_0x49fd('0x29')](handleEntityNotFound(_0xaac56f,null))[_0x49fd('0x29')](saveUpdates(_0x270360[_0x49fd('0x4b')],null))['then'](respondWithResult(_0xaac56f,null))[_0x49fd('0x45')](handleError(_0xaac56f,null));};exports[_0x49fd('0x28')]=function(_0x32694b,_0x263cf3){return db[_0x49fd('0x2f')][_0x49fd('0x49')]({'where':{'id':_0x32694b['params']['id']}})['then'](handleEntityNotFound(_0x263cf3,null))[_0x49fd('0x29')](removeEntity(_0x263cf3,null))[_0x49fd('0x45')](handleError(_0x263cf3,null));};exports[_0x49fd('0x4c')]=function(_0x5c34c0,_0x31783f){return db[_0x49fd('0x2f')]['describe']()['then'](respondWithResult(_0x31783f,null))['catch'](handleError(_0x31783f,null));}; \ No newline at end of file +var _0x207c=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','Cdr','rawAttributes'];(function(_0x505e3b,_0x5530b5){var _0x23a117=function(_0x5d35c8){while(--_0x5d35c8){_0x505e3b['push'](_0x505e3b['shift']());}};_0x23a117(++_0x5530b5);}(_0x207c,0x1e8));var _0xc207=function(_0x34ecbf,_0x210898){_0x34ecbf=_0x34ecbf-0x0;var _0x115f8a=_0x207c[_0x34ecbf];return _0x115f8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x29')](_0x1bec3f,'name');_0x463ac8[_0xc207('0x30')]=_[_0xc207('0x31')](_0x6a653d[_0xc207('0x30')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x463ac8[_0xc207('0x2f')],_0x463ac8['query']);_0xe5e848[_0xc207('0x34')]=_[_0xc207('0x33')](_0x463ac8[_0xc207('0x2f')],qs[_0xc207('0x35')](_0x6a653d['query'][_0xc207('0x35')]));_0xe5e848[_0xc207('0x34')]=_0xe5e848[_0xc207('0x34')][_0xc207('0x36')]?_0xe5e848[_0xc207('0x34')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x30')][_0xc207('0x37')](_0xc207('0x38'))){_0xe5e848['limit']=qs['limit'](_0x6a653d[_0xc207('0x30')][_0xc207('0x1c')]);_0xe5e848[_0xc207('0x1a')]=qs[_0xc207('0x1a')](_0x6a653d['query'][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d[_0xc207('0x30')][_0xc207('0x3a')]);_0xe5e848['where']=qs[_0xc207('0x32')](_[_0xc207('0x3b')](_0x6a653d['query'],_0x463ac8[_0xc207('0x32')]),_0x1bec3f);if(_0x6a653d['query'][_0xc207('0x3c')]){_0xe5e848[_0xc207('0x3d')]=_['merge'](_0xe5e848[_0xc207('0x3d')],{'$or':_[_0xc207('0x29')](_0x1bec3f,function(_0x3313b1){if(_0x3313b1['type']!=='VIRTUAL'){var _0x37cc19={};_0x37cc19[_0x3313b1[_0xc207('0x26')]]={'$like':'%'+_0x6a653d[_0xc207('0x30')][_0xc207('0x3c')]+'%'};return _0x37cc19;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d[_0xc207('0x3e')]);var _0x47cdc4={'where':_0xe5e848['where']};return db['Cdr']['count'](_0x47cdc4)[_0xc207('0x23')](function(_0x370d0d){_0x6223ef[_0xc207('0x1d')]=_0x370d0d;if(_0x6a653d['query'][_0xc207('0x3f')]){_0xe5e848[_0xc207('0x40')]=[{'all':!![]}];}return db[_0xc207('0x2a')][_0xc207('0x41')](_0xe5e848);})['then'](function(_0x47d43a){_0x6223ef[_0xc207('0x42')]=_0x47d43a;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))[_0xc207('0x43')](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x58537e,_0x122883){var _0x19a67d={'raw':!![],'where':{'id':_0x58537e[_0xc207('0x45')]['id']}},_0x3a935a={};_0x3a935a[_0xc207('0x2f')]=_[_0xc207('0x31')](db[_0xc207('0x2a')][_0xc207('0x2b')]);_0x3a935a[_0xc207('0x30')]=_['keys'](_0x58537e[_0xc207('0x30')]);_0x3a935a[_0xc207('0x32')]=_['intersection'](_0x3a935a[_0xc207('0x2f')],_0x3a935a[_0xc207('0x30')]);_0x19a67d[_0xc207('0x34')]=_[_0xc207('0x33')](_0x3a935a[_0xc207('0x2f')],qs['fields'](_0x58537e[_0xc207('0x30')][_0xc207('0x35')]));_0x19a67d[_0xc207('0x34')]=_0x19a67d['attributes'][_0xc207('0x36')]?_0x19a67d[_0xc207('0x34')]:_0x3a935a[_0xc207('0x2f')];if(_0x58537e[_0xc207('0x30')]['includeAll']){_0x19a67d['include']=[{'all':!![]}];}_0x19a67d=_[_0xc207('0x46')]({},_0x19a67d,_0x58537e[_0xc207('0x3e')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x19a67d)[_0xc207('0x23')](handleEntityNotFound(_0x122883,null))[_0xc207('0x23')](respondWithResult(_0x122883,null))[_0xc207('0x43')](handleError(_0x122883,null));};exports[_0xc207('0x48')]=function(_0x20edff,_0x212552){return db[_0xc207('0x2a')][_0xc207('0x48')](_0x20edff['body'],{})['then'](respondWithResult(_0x212552,0xc9))[_0xc207('0x43')](handleError(_0x212552,null));};exports[_0xc207('0x49')]=function(_0x2468d0,_0x480f12){if(_0x2468d0[_0xc207('0x4a')]['id']){delete _0x2468d0[_0xc207('0x4a')]['id'];}return db[_0xc207('0x2a')][_0xc207('0x47')]({'where':{'id':_0x2468d0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x480f12,null))['then'](saveUpdates(_0x2468d0[_0xc207('0x4a')],null))['then'](respondWithResult(_0x480f12,null))['catch'](handleError(_0x480f12,null));};exports[_0xc207('0x24')]=function(_0x30f02e,_0x4eeb63){return db['Cdr']['find']({'where':{'id':_0x30f02e[_0xc207('0x45')]['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x4eeb63,null))[_0xc207('0x23')](removeEntity(_0x4eeb63,null))[_0xc207('0x43')](handleError(_0x4eeb63,null));};exports[_0xc207('0x4b')]=function(_0x35e967,_0x3dc457){return db[_0xc207('0x2a')]['describe']()[_0xc207('0x23')](respondWithResult(_0x3dc457,null))[_0xc207('0x43')](handleError(_0x3dc457,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 01a24a1..85006ff 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x167e22,_0x43c02d){var _0x1a9494=function(_0x5aeeb5){while(--_0x5aeeb5){_0x167e22['push'](_0x167e22['shift']());}};_0x1a9494(++_0x43c02d);}(_0x7a54,0x106));var _0x47a5=function(_0x39ba0c,_0x4dfac9){_0x39ba0c=_0x39ba0c-0x0;var _0x122d85=_0x7a54[_0x39ba0c];return _0x122d85;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x411236,_0x559275){var _0x45c32a=function(_0x12bc4f){while(--_0x12bc4f){_0x411236['push'](_0x411236['shift']());}};_0x45c32a(++_0x559275);}(_0x7a54,0x106));var _0x47a5=function(_0x47dc76,_0x1db92e){_0x47dc76=_0x47dc76-0x0;var _0x1aee55=_0x7a54[_0x47dc76];return _0x1aee55;};'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 2258699..6af4cd2 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 _0xf4ed=['client','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','code','error','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x113e59,_0x3b8150){var _0x5571a5=function(_0x3deb97){while(--_0x3deb97){_0x113e59['push'](_0x113e59['shift']());}};_0x5571a5(++_0x3b8150);}(_0xf4ed,0x16b));var _0xdf4e=function(_0x596e98,_0xc326c9){_0x596e98=_0x596e98-0x0;var _0x1c09ac=_0xf4ed[_0x596e98];return _0x1c09ac;};'use strict';var _=require(_0xdf4e('0x0'));var util=require(_0xdf4e('0x1'));var moment=require(_0xdf4e('0x2'));var BPromise=require(_0xdf4e('0x3'));var rs=require(_0xdf4e('0x4'));var fs=require('fs');var Redis=require(_0xdf4e('0x5'));var db=require(_0xdf4e('0x6'))['db'];var utils=require(_0xdf4e('0x7'));var logger=require(_0xdf4e('0x8'))(_0xdf4e('0x9'));var config=require(_0xdf4e('0xa'));var jayson=require(_0xdf4e('0xb'));var client=jayson[_0xdf4e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6b792d,_0x47387c,_0x10a1a4){return new BPromise(function(_0x26d240,_0x3455ba){return client[_0xdf4e('0xd')](_0x6b792d,_0x10a1a4)[_0xdf4e('0xe')](function(_0x540a6a){logger[_0xdf4e('0xf')]('Cdr,\x20%s,\x20%s',_0x47387c,_0xdf4e('0x10'));logger[_0xdf4e('0x11')](_0xdf4e('0x12'),_0x47387c,_0xdf4e('0x10'),JSON['stringify'](_0x540a6a));if(_0x540a6a['error']){if(_0x540a6a['error'][_0xdf4e('0x13')]===0x1f4){logger[_0xdf4e('0x14')](_0xdf4e('0x15'),_0x47387c,_0x540a6a['error']['message']);return _0x3455ba(_0x540a6a[_0xdf4e('0x14')][_0xdf4e('0x16')]);}logger[_0xdf4e('0x14')]('Cdr,\x20%s,\x20%s',_0x47387c,_0x540a6a[_0xdf4e('0x14')]['message']);return _0x26d240(_0x540a6a[_0xdf4e('0x14')][_0xdf4e('0x16')]);}else{logger[_0xdf4e('0xf')](_0xdf4e('0x15'),_0x47387c,_0xdf4e('0x10'));_0x26d240(_0x540a6a[_0xdf4e('0x17')][_0xdf4e('0x16')]);}})[_0xdf4e('0x18')](function(_0x1f1662){logger[_0xdf4e('0x14')](_0xdf4e('0x15'),_0x47387c,_0x1f1662);_0x3455ba(_0x1f1662);});});} \ No newline at end of file +var _0x26ce=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x26ce,0x9b));var _0xe26c=function(_0x21e3d5,_0x443510){_0x21e3d5=_0x21e3d5-0x0;var _0x37fff5=_0x26ce[_0x21e3d5];return _0x37fff5;};'use strict';var _=require(_0xe26c('0x0'));var util=require(_0xe26c('0x1'));var moment=require(_0xe26c('0x2'));var BPromise=require(_0xe26c('0x3'));var rs=require(_0xe26c('0x4'));var fs=require('fs');var Redis=require(_0xe26c('0x5'));var db=require(_0xe26c('0x6'))['db'];var utils=require(_0xe26c('0x7'));var logger=require(_0xe26c('0x8'))(_0xe26c('0x9'));var config=require('../../config/environment');var jayson=require(_0xe26c('0xa'));var client=jayson[_0xe26c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa25f,_0x46e84c,_0xa988d5){return new BPromise(function(_0x15f8cd,_0x4d6769){return client[_0xe26c('0xc')](_0x5aa25f,_0xa988d5)[_0xe26c('0xd')](function(_0x40e2e2){logger['info'](_0xe26c('0xe'),_0x46e84c,_0xe26c('0xf'));logger[_0xe26c('0x10')](_0xe26c('0x11'),_0x46e84c,_0xe26c('0xf'),JSON[_0xe26c('0x12')](_0x40e2e2));if(_0x40e2e2[_0xe26c('0x13')]){if(_0x40e2e2[_0xe26c('0x13')][_0xe26c('0x14')]===0x1f4){logger[_0xe26c('0x13')](_0xe26c('0xe'),_0x46e84c,_0x40e2e2[_0xe26c('0x13')][_0xe26c('0x15')]);return _0x4d6769(_0x40e2e2['error'][_0xe26c('0x15')]);}logger[_0xe26c('0x13')](_0xe26c('0xe'),_0x46e84c,_0x40e2e2['error']['message']);return _0x15f8cd(_0x40e2e2[_0xe26c('0x13')]['message']);}else{logger[_0xe26c('0x16')]('Cdr,\x20%s,\x20%s',_0x46e84c,_0xe26c('0xf'));_0x15f8cd(_0x40e2e2[_0xe26c('0x17')][_0xe26c('0x15')]);}})[_0xe26c('0x18')](function(_0x239a33){logger[_0xe26c('0x13')](_0xe26c('0xe'),_0x46e84c,_0x239a33);_0x4d6769(_0x239a33);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f106626..de2e7c7 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3db0ba,_0x2be65c){var _0x2d8e9a=function(_0x780700){while(--_0x780700){_0x3db0ba['push'](_0x3db0ba['shift']());}};_0x2d8e9a(++_0x2be65c);}(_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 +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(_0x227c9b,_0x34d983){var _0x37f247=function(_0x1adc5a){while(--_0x1adc5a){_0x227c9b['push'](_0x227c9b['shift']());}};_0x37f247(++_0x34d983);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));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 698823d..94ab5a7 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 _0x5165=['TEXT','STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x3657d9,_0x3de284){var _0x4e5b18=function(_0x586dea){while(--_0x586dea){_0x3657d9['push'](_0x3657d9['shift']());}};_0x4e5b18(++_0x3de284);}(_0x5165,0x189));var _0x5516=function(_0x57c029,_0x302ebd){_0x57c029=_0x57c029-0x0;var _0x6b7d44=_0x5165[_0x57c029];return _0x6b7d44;};'use strict';var Sequelize=require(_0x5516('0x0'));module[_0x5516('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5516('0x2')},'appdata':{'type':Sequelize[_0x5516('0x3')]()},'description':{'type':Sequelize[_0x5516('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5516('0x5')}}; \ No newline at end of file +var _0xf3f9=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0xf3f9,0xca));var _0x9f3f=function(_0x2d95bf,_0xf46b30){_0x2d95bf=_0x2d95bf-0x0;var _0x375984=_0xf3f9[_0x2d95bf];return _0x375984;};'use strict';var Sequelize=require(_0x9f3f('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9f3f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9f3f('0x2')],'allowNull':![],'defaultValue':_0x9f3f('0x3')},'appdata':{'type':Sequelize[_0x9f3f('0x4')]()},'description':{'type':Sequelize[_0x9f3f('0x2')]},'interval':{'type':Sequelize[_0x9f3f('0x2')],'defaultValue':_0x9f3f('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 21ed934..68a2dc8 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 _0x3ce4=['sendStatus','status','json','offset','undefined','limit','count','reject','save','then','destroy','stack','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','ChatApplication','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x449539,_0x1f1d60){var _0x508ae1=function(_0x17ecbd){while(--_0x17ecbd){_0x449539['push'](_0x449539['shift']());}};_0x508ae1(++_0x1f1d60);}(_0x3ce4,0xcb));var _0x43ce=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x3ce4[_0x57d13b];return _0x467696;};'use strict';var emlformat=require(_0x43ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43ce('0x2'));var moment=require(_0x43ce('0x3'));var BPromise=require(_0x43ce('0x4'));var Mustache=require(_0x43ce('0x5'));var util=require(_0x43ce('0x6'));var path=require('path');var sox=require(_0x43ce('0x7'));var csv=require(_0x43ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43ce('0x9'));var _=require('lodash');var squel=require(_0x43ce('0xa'));var crypto=require(_0x43ce('0xb'));var jsforce=require(_0x43ce('0xc'));var deskjs=require(_0x43ce('0xd'));var toCsv=require('to-csv');var querystring=require(_0x43ce('0xe'));var Papa=require(_0x43ce('0xf'));var Redis=require(_0x43ce('0x10'));var authService=require(_0x43ce('0x11'));var qs=require(_0x43ce('0x12'));var as=require(_0x43ce('0x13'));var hardwareService=require(_0x43ce('0x14'));var logger=require(_0x43ce('0x15'))('api');var utils=require(_0x43ce('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x43ce('0x17'));var db=require(_0x43ce('0x18'))['db'];function respondWithStatusCode(_0x84300e,_0x472b54){_0x472b54=_0x472b54||0xcc;return function(_0x2be282){if(_0x2be282){return _0x84300e[_0x43ce('0x19')](_0x472b54);}return _0x84300e[_0x43ce('0x1a')](_0x472b54)['end']();};}function respondWithResult(_0x3fb780,_0x57eb00){_0x57eb00=_0x57eb00||0xc8;return function(_0x1a02f8){if(_0x1a02f8){return _0x3fb780[_0x43ce('0x1a')](_0x57eb00)[_0x43ce('0x1b')](_0x1a02f8);}};}function respondWithFilteredResult(_0x5ebcef,_0x14e2b2){return function(_0x14e906){if(_0x14e906){var _0x298771=typeof _0x14e2b2[_0x43ce('0x1c')]===_0x43ce('0x1d')&&typeof _0x14e2b2[_0x43ce('0x1e')]===_0x43ce('0x1d');var _0xfb7e97=_0x14e906[_0x43ce('0x1f')];var _0x2f679=_0x298771?0x0:_0x14e2b2[_0x43ce('0x1c')];var _0x1b7f2=_0x298771?_0x14e906[_0x43ce('0x1f')]:_0x14e2b2[_0x43ce('0x1c')]+_0x14e2b2[_0x43ce('0x1e')];var _0x202459;if(_0x1b7f2>=_0xfb7e97){_0x1b7f2=_0xfb7e97;_0x202459=0xc8;}else{_0x202459=0xce;}_0x5ebcef[_0x43ce('0x1a')](_0x202459);return _0x5ebcef['set']('Content-Range',_0x2f679+'-'+_0x1b7f2+'/'+_0xfb7e97)[_0x43ce('0x1b')](_0x14e906);}return null;};}function patchUpdates(_0x2f8d63){return function(_0x34db72){try{jsonpatch['apply'](_0x34db72,_0x2f8d63,!![]);}catch(_0x4c31e3){return BPromise[_0x43ce('0x20')](_0x4c31e3);}return _0x34db72[_0x43ce('0x21')]();};}function saveUpdates(_0x42b4a3,_0x439063){return function(_0x550013){if(_0x550013){return _0x550013['update'](_0x42b4a3)[_0x43ce('0x22')](function(_0x5cb18c){return _0x5cb18c;});}return null;};}function removeEntity(_0x115ba2,_0x2bce6d){return function(_0x2a74ec){if(_0x2a74ec){return _0x2a74ec[_0x43ce('0x23')]()[_0x43ce('0x22')](function(){_0x115ba2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x151777,_0x25d398){return function(_0x258a0f){if(!_0x258a0f){_0x151777[_0x43ce('0x19')](0x194);}return _0x258a0f;};}function handleError(_0x5f1f3c,_0x356bc5){_0x356bc5=_0x356bc5||0x1f4;return function(_0x2edd59){logger['error'](_0x2edd59[_0x43ce('0x24')]);if(_0x2edd59['name']){delete _0x2edd59['name'];}_0x5f1f3c[_0x43ce('0x1a')](_0x356bc5)[_0x43ce('0x25')](_0x2edd59);};}exports[_0x43ce('0x26')]=function(_0xefecdf,_0x202b0d){var _0x5a1607={'raw':!![],'where':{'id':_0xefecdf[_0x43ce('0x27')]['id']}},_0x306853={};_0x306853[_0x43ce('0x28')]=_[_0x43ce('0x29')](db['ChatApplication'][_0x43ce('0x2a')]);_0x306853[_0x43ce('0x2b')]=_[_0x43ce('0x29')](_0xefecdf[_0x43ce('0x2b')]);_0x306853[_0x43ce('0x2c')]=_[_0x43ce('0x2d')](_0x306853[_0x43ce('0x28')],_0x306853[_0x43ce('0x2b')]);_0x5a1607[_0x43ce('0x2e')]=_['intersection'](_0x306853[_0x43ce('0x28')],qs[_0x43ce('0x2f')](_0xefecdf[_0x43ce('0x2b')][_0x43ce('0x2f')]));_0x5a1607[_0x43ce('0x2e')]=_0x5a1607[_0x43ce('0x2e')][_0x43ce('0x30')]?_0x5a1607['attributes']:_0x306853[_0x43ce('0x28')];if(_0xefecdf[_0x43ce('0x2b')][_0x43ce('0x31')]){_0x5a1607[_0x43ce('0x32')]=[{'all':!![]}];}_0x5a1607=_[_0x43ce('0x33')]({},_0x5a1607,_0xefecdf[_0x43ce('0x34')]);return db['ChatApplication'][_0x43ce('0x35')](_0x5a1607)['then'](handleEntityNotFound(_0x202b0d,null))[_0x43ce('0x22')](respondWithResult(_0x202b0d,null))[_0x43ce('0x36')](handleError(_0x202b0d,null));};exports['update']=function(_0x329558,_0x4c6275){if(_0x329558['body']['id']){delete _0x329558[_0x43ce('0x37')]['id'];}return db[_0x43ce('0x38')][_0x43ce('0x35')]({'where':{'id':_0x329558[_0x43ce('0x27')]['id']}})[_0x43ce('0x22')](handleEntityNotFound(_0x4c6275,null))[_0x43ce('0x22')](saveUpdates(_0x329558[_0x43ce('0x37')],null))[_0x43ce('0x22')](respondWithResult(_0x4c6275,null))['catch'](handleError(_0x4c6275,null));};exports['destroy']=function(_0x1d01b0,_0x1f8f9d){return db[_0x43ce('0x38')][_0x43ce('0x35')]({'where':{'id':_0x1d01b0['params']['id']}})[_0x43ce('0x22')](handleEntityNotFound(_0x1f8f9d,null))[_0x43ce('0x22')](removeEntity(_0x1f8f9d,null))['catch'](handleError(_0x1f8f9d,null));}; \ No newline at end of file +var _0x195e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','params','ChatApplication','rawAttributes','query','keys','filters','model','attributes','fields','length','includeAll','include','merge','options','catch','body','find','eml-format'];(function(_0x4817f3,_0x2c1916){var _0x5a89b2=function(_0x50a456){while(--_0x50a456){_0x4817f3['push'](_0x4817f3['shift']());}};_0x5a89b2(++_0x2c1916);}(_0x195e,0xfb));var _0xe195=function(_0x144724,_0x3dc1d2){_0x144724=_0x144724-0x0;var _0x422d9a=_0x195e[_0x144724];return _0x422d9a;};'use strict';var emlformat=require(_0xe195('0x0'));var rimraf=require(_0xe195('0x1'));var zipdir=require(_0xe195('0x2'));var jsonpatch=require(_0xe195('0x3'));var rp=require(_0xe195('0x4'));var moment=require(_0xe195('0x5'));var BPromise=require(_0xe195('0x6'));var Mustache=require(_0xe195('0x7'));var util=require(_0xe195('0x8'));var path=require(_0xe195('0x9'));var sox=require(_0xe195('0xa'));var csv=require(_0xe195('0xb'));var ejs=require(_0xe195('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe195('0xd'));var squel=require(_0xe195('0xe'));var crypto=require(_0xe195('0xf'));var jsforce=require(_0xe195('0x10'));var deskjs=require(_0xe195('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe195('0x12'));var authService=require(_0xe195('0x13'));var qs=require(_0xe195('0x14'));var as=require(_0xe195('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe195('0x16'))(_0xe195('0x17'));var utils=require(_0xe195('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe195('0x19'));var db=require(_0xe195('0x1a'))['db'];function respondWithStatusCode(_0x5ae615,_0x3da7d9){_0x3da7d9=_0x3da7d9||0xcc;return function(_0x12fa0f){if(_0x12fa0f){return _0x5ae615[_0xe195('0x1b')](_0x3da7d9);}return _0x5ae615[_0xe195('0x1c')](_0x3da7d9)['end']();};}function respondWithResult(_0x52217d,_0x2e82d1){_0x2e82d1=_0x2e82d1||0xc8;return function(_0x555a6a){if(_0x555a6a){return _0x52217d['status'](_0x2e82d1)[_0xe195('0x1d')](_0x555a6a);}};}function respondWithFilteredResult(_0x5c444f,_0x232c57){return function(_0x542ac7){if(_0x542ac7){var _0x534879=typeof _0x232c57[_0xe195('0x1e')]===_0xe195('0x1f')&&typeof _0x232c57[_0xe195('0x20')]===_0xe195('0x1f');var _0x3a042f=_0x542ac7[_0xe195('0x21')];var _0x4784b1=_0x534879?0x0:_0x232c57[_0xe195('0x1e')];var _0x9c8ba5=_0x534879?_0x542ac7[_0xe195('0x21')]:_0x232c57['offset']+_0x232c57[_0xe195('0x20')];var _0x317d8b;if(_0x9c8ba5>=_0x3a042f){_0x9c8ba5=_0x3a042f;_0x317d8b=0xc8;}else{_0x317d8b=0xce;}_0x5c444f[_0xe195('0x1c')](_0x317d8b);return _0x5c444f[_0xe195('0x22')](_0xe195('0x23'),_0x4784b1+'-'+_0x9c8ba5+'/'+_0x3a042f)[_0xe195('0x1d')](_0x542ac7);}return null;};}function patchUpdates(_0x496722){return function(_0x1c5ac8){try{jsonpatch[_0xe195('0x24')](_0x1c5ac8,_0x496722,!![]);}catch(_0x334b4a){return BPromise[_0xe195('0x25')](_0x334b4a);}return _0x1c5ac8['save']();};}function saveUpdates(_0x4dab1a,_0x4e5f13){return function(_0x57ee33){if(_0x57ee33){return _0x57ee33[_0xe195('0x26')](_0x4dab1a)[_0xe195('0x27')](function(_0x2cb019){return _0x2cb019;});}return null;};}function removeEntity(_0x199148,_0x46b15b){return function(_0x40c6a2){if(_0x40c6a2){return _0x40c6a2[_0xe195('0x28')]()[_0xe195('0x27')](function(){_0x199148[_0xe195('0x1c')](0xcc)[_0xe195('0x29')]();});}};}function handleEntityNotFound(_0x55be2d,_0x36a566){return function(_0x58ea75){if(!_0x58ea75){_0x55be2d[_0xe195('0x1b')](0x194);}return _0x58ea75;};}function handleError(_0x334cb8,_0x147563){_0x147563=_0x147563||0x1f4;return function(_0x2a0504){logger[_0xe195('0x2a')](_0x2a0504[_0xe195('0x2b')]);if(_0x2a0504[_0xe195('0x2c')]){delete _0x2a0504[_0xe195('0x2c')];}_0x334cb8[_0xe195('0x1c')](_0x147563)[_0xe195('0x2d')](_0x2a0504);};}exports['show']=function(_0x33a08d,_0x3e228f){var _0x3199d0={'raw':!![],'where':{'id':_0x33a08d[_0xe195('0x2e')]['id']}},_0x1f72a2={};_0x1f72a2['model']=_['keys'](db[_0xe195('0x2f')][_0xe195('0x30')]);_0x1f72a2[_0xe195('0x31')]=_[_0xe195('0x32')](_0x33a08d[_0xe195('0x31')]);_0x1f72a2[_0xe195('0x33')]=_['intersection'](_0x1f72a2[_0xe195('0x34')],_0x1f72a2[_0xe195('0x31')]);_0x3199d0[_0xe195('0x35')]=_['intersection'](_0x1f72a2[_0xe195('0x34')],qs['fields'](_0x33a08d[_0xe195('0x31')][_0xe195('0x36')]));_0x3199d0['attributes']=_0x3199d0[_0xe195('0x35')][_0xe195('0x37')]?_0x3199d0[_0xe195('0x35')]:_0x1f72a2['model'];if(_0x33a08d[_0xe195('0x31')][_0xe195('0x38')]){_0x3199d0[_0xe195('0x39')]=[{'all':!![]}];}_0x3199d0=_[_0xe195('0x3a')]({},_0x3199d0,_0x33a08d[_0xe195('0x3b')]);return db[_0xe195('0x2f')]['find'](_0x3199d0)[_0xe195('0x27')](handleEntityNotFound(_0x3e228f,null))[_0xe195('0x27')](respondWithResult(_0x3e228f,null))[_0xe195('0x3c')](handleError(_0x3e228f,null));};exports[_0xe195('0x26')]=function(_0x478236,_0x2ce341){if(_0x478236[_0xe195('0x3d')]['id']){delete _0x478236['body']['id'];}return db[_0xe195('0x2f')][_0xe195('0x3e')]({'where':{'id':_0x478236['params']['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x2ce341,null))[_0xe195('0x27')](saveUpdates(_0x478236['body'],null))[_0xe195('0x27')](respondWithResult(_0x2ce341,null))['catch'](handleError(_0x2ce341,null));};exports[_0xe195('0x28')]=function(_0x3fc4c6,_0x37afe2){return db[_0xe195('0x2f')][_0xe195('0x3e')]({'where':{'id':_0x3fc4c6[_0xe195('0x2e')]['id']}})['then'](handleEntityNotFound(_0x37afe2,null))[_0xe195('0x27')](removeEntity(_0x37afe2,null))[_0xe195('0x3c')](handleError(_0x37afe2,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fbe23f3..810d499 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 _0xf211=['../../config/logger','moment','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x53e198,_0x4e0e84){var _0x3fae6f=function(_0x8e3943){while(--_0x8e3943){_0x53e198['push'](_0x53e198['shift']());}};_0x3fae6f(++_0x4e0e84);}(_0xf211,0x6e));var _0x1f21=function(_0x25a7e6,_0x18de96){_0x25a7e6=_0x25a7e6-0x0;var _0x592645=_0xf211[_0x25a7e6];return _0x592645;};'use strict';var _=require(_0x1f21('0x0'));var util=require(_0x1f21('0x1'));var logger=require(_0x1f21('0x2'))('api');var moment=require(_0x1f21('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f21('0x4'));var rimraf=require(_0x1f21('0x5'));var config=require(_0x1f21('0x6'));var attributes=require(_0x1f21('0x7'));module[_0x1f21('0x8')]=function(_0xb24d0e,_0x5f430d){return _0xb24d0e[_0x1f21('0x9')](_0x1f21('0xa'),attributes,{'tableName':_0x1f21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f21('0xc'),'collate':_0x1f21('0xd')});}; \ No newline at end of file +var _0x29a5=['util','../../config/logger','moment','bluebird','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash'];(function(_0x1a52fd,_0x5a6548){var _0x5cea5c=function(_0x5ac809){while(--_0x5ac809){_0x1a52fd['push'](_0x1a52fd['shift']());}};_0x5cea5c(++_0x5a6548);}(_0x29a5,0x1e0));var _0x529a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x29a5[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x529a('0x0'));var util=require(_0x529a('0x1'));var logger=require(_0x529a('0x2'))('api');var moment=require(_0x529a('0x3'));var BPromise=require(_0x529a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x529a('0x5'));var rimraf=require(_0x529a('0x6'));var config=require('../../config/environment');var attributes=require(_0x529a('0x7'));module[_0x529a('0x8')]=function(_0x177641,_0x12717d){return _0x177641[_0x529a('0x9')](_0x529a('0xa'),attributes,{'tableName':_0x529a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x529a('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 25a79e2..8100c73 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 _0xbd9d=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x5e1297,_0x4a2705){var _0x7f80d=function(_0x4dedf5){while(--_0x4dedf5){_0x5e1297['push'](_0x5e1297['shift']());}};_0x7f80d(++_0x4a2705);}(_0xbd9d,0x1a0));var _0xdbd9=function(_0xa349c2,_0x1c3d39){_0xa349c2=_0xa349c2-0x0;var _0x3d4eff=_0xbd9d[_0xa349c2];return _0x3d4eff;};'use strict';var _=require(_0xdbd9('0x0'));var util=require(_0xdbd9('0x1'));var moment=require('moment');var BPromise=require(_0xdbd9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbd9('0x3'));var db=require(_0xdbd9('0x4'))['db'];var utils=require(_0xdbd9('0x5'));var logger=require(_0xdbd9('0x6'))('rpc');var config=require(_0xdbd9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdbd9('0x8')][_0xdbd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9a376,_0x4f102b,_0x4a31e6){return new BPromise(function(_0x4599d8,_0x3b2927){return client[_0xdbd9('0xa')](_0x9a376,_0x4a31e6)[_0xdbd9('0xb')](function(_0x2b73db){logger['info'](_0xdbd9('0xc'),_0x4f102b,_0xdbd9('0xd'));logger[_0xdbd9('0xe')](_0xdbd9('0xf'),_0x4f102b,'request\x20sent',JSON[_0xdbd9('0x10')](_0x2b73db));if(_0x2b73db['error']){if(_0x2b73db[_0xdbd9('0x11')][_0xdbd9('0x12')]===0x1f4){logger[_0xdbd9('0x11')]('ChatApplication,\x20%s,\x20%s',_0x4f102b,_0x2b73db['error']['message']);return _0x3b2927(_0x2b73db[_0xdbd9('0x11')]['message']);}logger[_0xdbd9('0x11')](_0xdbd9('0xc'),_0x4f102b,_0x2b73db['error'][_0xdbd9('0x13')]);return _0x4599d8(_0x2b73db['error'][_0xdbd9('0x13')]);}else{logger[_0xdbd9('0x14')]('ChatApplication,\x20%s,\x20%s',_0x4f102b,_0xdbd9('0xd'));_0x4599d8(_0x2b73db[_0xdbd9('0x15')][_0xdbd9('0x13')]);}})[_0xdbd9('0x16')](function(_0x3df631){logger[_0xdbd9('0x11')]('ChatApplication,\x20%s,\x20%s',_0x4f102b,_0x3df631);_0x3b2927(_0x3df631);});});} \ No newline at end of file +var _0x9f22=['jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3918a3,_0x3e3db8){var _0x4f252f=function(_0x3a0c56){while(--_0x3a0c56){_0x3918a3['push'](_0x3918a3['shift']());}};_0x4f252f(++_0x3e3db8);}(_0x9f22,0x183));var _0x29f2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9f22[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x29f2('0x0'));var util=require(_0x29f2('0x1'));var moment=require(_0x29f2('0x2'));var BPromise=require('bluebird');var rs=require(_0x29f2('0x3'));var fs=require('fs');var Redis=require(_0x29f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29f2('0x5'));var logger=require(_0x29f2('0x6'))(_0x29f2('0x7'));var config=require(_0x29f2('0x8'));var jayson=require(_0x29f2('0x9'));var client=jayson[_0x29f2('0xa')][_0x29f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd2e8b,_0x57b73c,_0x552ed0){return new BPromise(function(_0x17d0c9,_0x20ebe6){return client[_0x29f2('0xc')](_0xfd2e8b,_0x552ed0)[_0x29f2('0xd')](function(_0x475311){logger['info'](_0x29f2('0xe'),_0x57b73c,_0x29f2('0xf'));logger['debug'](_0x29f2('0x10'),_0x57b73c,_0x29f2('0xf'),JSON['stringify'](_0x475311));if(_0x475311[_0x29f2('0x11')]){if(_0x475311[_0x29f2('0x11')][_0x29f2('0x12')]===0x1f4){logger[_0x29f2('0x11')](_0x29f2('0xe'),_0x57b73c,_0x475311[_0x29f2('0x11')][_0x29f2('0x13')]);return _0x20ebe6(_0x475311[_0x29f2('0x11')][_0x29f2('0x13')]);}logger['error'](_0x29f2('0xe'),_0x57b73c,_0x475311[_0x29f2('0x11')][_0x29f2('0x13')]);return _0x17d0c9(_0x475311[_0x29f2('0x11')][_0x29f2('0x13')]);}else{logger['info'](_0x29f2('0xe'),_0x57b73c,_0x29f2('0xf'));_0x17d0c9(_0x475311[_0x29f2('0x14')][_0x29f2('0x13')]);}})[_0x29f2('0x15')](function(_0x438aa3){logger[_0x29f2('0x11')](_0x29f2('0xe'),_0x57b73c,_0x438aa3);_0x20ebe6(_0x438aa3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c46b913..a66fdcb 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 _0x0948=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0xf104db,_0x3bb494){var _0xab56c5=function(_0x53083c){while(--_0x53083c){_0xf104db['push'](_0xf104db['shift']());}};_0xab56c5(++_0x3bb494);}(_0x0948,0x95));var _0x8094=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x0948[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0x8094('0x0'));var util=require(_0x8094('0x1'));var path=require(_0x8094('0x2'));var timeout=require(_0x8094('0x3'));var express=require(_0x8094('0x4'));var router=express[_0x8094('0x5')]();var fs_extra=require(_0x8094('0x6'));var auth=require(_0x8094('0x7'));var interaction=require(_0x8094('0x8'));var config=require(_0x8094('0x9'));var controller=require('./chatApplication.controller');router[_0x8094('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8094('0xb')]);router[_0x8094('0xc')](_0x8094('0xd'),auth[_0x8094('0xe')](),controller[_0x8094('0xf')]);router[_0x8094('0x10')]('/:id',auth[_0x8094('0xe')](),controller[_0x8094('0x11')]);module[_0x8094('0x12')]=router; \ No newline at end of file +var _0x0bc2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','put','isAuthenticated','destroy','util','path','connect-timeout','express','Router'];(function(_0x5678c2,_0xd8cb89){var _0x263105=function(_0x4bb4e9){while(--_0x4bb4e9){_0x5678c2['push'](_0x5678c2['shift']());}};_0x263105(++_0xd8cb89);}(_0x0bc2,0x121));var _0x20bc=function(_0x194bd9,_0x28481c){_0x194bd9=_0x194bd9-0x0;var _0x573226=_0x0bc2[_0x194bd9];return _0x573226;};'use strict';var multer=require('multer');var util=require(_0x20bc('0x0'));var path=require(_0x20bc('0x1'));var timeout=require(_0x20bc('0x2'));var express=require(_0x20bc('0x3'));var router=express[_0x20bc('0x4')]();var fs_extra=require(_0x20bc('0x5'));var auth=require(_0x20bc('0x6'));var interaction=require(_0x20bc('0x7'));var config=require(_0x20bc('0x8'));var controller=require('./chatApplication.controller');router['get'](_0x20bc('0x9'),auth['isAuthenticated'](),controller[_0x20bc('0xa')]);router[_0x20bc('0xb')](_0x20bc('0x9'),auth[_0x20bc('0xc')](),controller['update']);router['delete'](_0x20bc('0x9'),auth['isAuthenticated'](),controller[_0x20bc('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5a8677c..3468893 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 _0xbc37=['STRING','BOOLEAN','sequelize','exports'];(function(_0x26471b,_0x47ef13){var _0xdb719b=function(_0x5e7582){while(--_0x5e7582){_0x26471b['push'](_0x26471b['shift']());}};_0xdb719b(++_0x47ef13);}(_0xbc37,0x11a));var _0x7bc3=function(_0x29260a,_0x59398a){_0x29260a=_0x29260a-0x0;var _0xcdb779=_0xbc37[_0x29260a];return _0xcdb779;};'use strict';var Sequelize=require(_0x7bc3('0x0'));module[_0x7bc3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7bc3('0x2')]},'write':{'type':Sequelize[_0x7bc3('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x52a8=['STRING'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x52a8,0x141));var _0x852a=function(_0xfbbdd0,_0x69ec5){_0xfbbdd0=_0xfbbdd0-0x0;var _0x46289e=_0x52a8[_0xfbbdd0];return _0x46289e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x852a('0x0')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index a541722..af3fe6f 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 _0xc812=['api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','update','destroy','then','error','name','send','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','ChatGroup','include','rows','catch','params','find','create','body','describe','user','toInteger','addMembers','findOne','User','pick','getMembers','nolimit','removeMembers','ids','addMessage','ChatInternalMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x291514,_0xd031d){var _0xb29b7d=function(_0x46b190){while(--_0x46b190){_0x291514['push'](_0x291514['shift']());}};_0xb29b7d(++_0xd031d);}(_0xc812,0x9f));var _0x2c81=function(_0x2af7a3,_0x7bfdb5){_0x2af7a3=_0x2af7a3-0x0;var _0x2a513c=_0xc812[_0x2af7a3];return _0x2a513c;};'use strict';var emlformat=require(_0x2c81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c81('0x1'));var jsonpatch=require(_0x2c81('0x2'));var rp=require(_0x2c81('0x3'));var moment=require(_0x2c81('0x4'));var BPromise=require(_0x2c81('0x5'));var Mustache=require(_0x2c81('0x6'));var util=require(_0x2c81('0x7'));var path=require(_0x2c81('0x8'));var sox=require(_0x2c81('0x9'));var csv=require(_0x2c81('0xa'));var ejs=require(_0x2c81('0xb'));var fs=require('fs');var fs_extra=require(_0x2c81('0xc'));var _=require('lodash');var squel=require(_0x2c81('0xd'));var crypto=require(_0x2c81('0xe'));var jsforce=require(_0x2c81('0xf'));var deskjs=require(_0x2c81('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2c81('0x11'));var Papa=require(_0x2c81('0x12'));var Redis=require(_0x2c81('0x13'));var authService=require(_0x2c81('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2c81('0x15'));var hardwareService=require(_0x2c81('0x16'));var logger=require('../../config/logger')(_0x2c81('0x17'));var utils=require(_0x2c81('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c81('0x19'))['db'];config['redis']=_[_0x2c81('0x1a')](config[_0x2c81('0x1b')],{'host':_0x2c81('0x1c'),'port':0x18eb});var socket=require(_0x2c81('0x1d'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x2f8029,_0x13ff05){_0x13ff05=_0x13ff05||0xcc;return function(_0x1c4398){if(_0x1c4398){return _0x2f8029[_0x2c81('0x1e')](_0x13ff05);}return _0x2f8029[_0x2c81('0x1f')](_0x13ff05)['end']();};}function respondWithResult(_0x45ea23,_0x521b2b){_0x521b2b=_0x521b2b||0xc8;return function(_0x2032c2){if(_0x2032c2){return _0x45ea23[_0x2c81('0x1f')](_0x521b2b)['json'](_0x2032c2);}};}function respondWithFilteredResult(_0x2b6c8e,_0x344e22){return function(_0x727a09){if(_0x727a09){var _0x1dfad=typeof _0x344e22['offset']===_0x2c81('0x20')&&typeof _0x344e22[_0x2c81('0x21')]==='undefined';var _0x56f907=_0x727a09['count'];var _0x301234=_0x1dfad?0x0:_0x344e22[_0x2c81('0x22')];var _0x51f6d2=_0x1dfad?_0x727a09[_0x2c81('0x23')]:_0x344e22[_0x2c81('0x22')]+_0x344e22[_0x2c81('0x21')];var _0x5b6133;if(_0x51f6d2>=_0x56f907){_0x51f6d2=_0x56f907;_0x5b6133=0xc8;}else{_0x5b6133=0xce;}_0x2b6c8e[_0x2c81('0x1f')](_0x5b6133);return _0x2b6c8e[_0x2c81('0x24')](_0x2c81('0x25'),_0x301234+'-'+_0x51f6d2+'/'+_0x56f907)[_0x2c81('0x26')](_0x727a09);}return null;};}function patchUpdates(_0x397ec5){return function(_0x27e428){try{jsonpatch[_0x2c81('0x27')](_0x27e428,_0x397ec5,!![]);}catch(_0x19e422){return BPromise['reject'](_0x19e422);}return _0x27e428['save']();};}function saveUpdates(_0x42091c,_0x554689){return function(_0x3e3cc5){if(_0x3e3cc5){return _0x3e3cc5[_0x2c81('0x28')](_0x42091c)['then'](function(_0x3b6d90){return _0x3b6d90;});}return null;};}function removeEntity(_0x509a6a,_0x36bdb0){return function(_0x3c4b2e){if(_0x3c4b2e){return _0x3c4b2e[_0x2c81('0x29')]()[_0x2c81('0x2a')](function(){_0x509a6a[_0x2c81('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35faae,_0x45ea66){return function(_0x391a8f){if(!_0x391a8f){_0x35faae[_0x2c81('0x1e')](0x194);}return _0x391a8f;};}function handleError(_0x31ed74,_0x2ff1df){_0x2ff1df=_0x2ff1df||0x1f4;return function(_0xeb3ecb){logger[_0x2c81('0x2b')](_0xeb3ecb['stack']);if(_0xeb3ecb['name']){delete _0xeb3ecb[_0x2c81('0x2c')];}_0x31ed74[_0x2c81('0x1f')](_0x2ff1df)[_0x2c81('0x2d')](_0xeb3ecb);};}exports['index']=function(_0x5a6632,_0x494edc){var _0x3c307f={},_0x57c0bb={},_0x47957d={'count':0x0,'rows':[]};var _0x40a5a6=_[_0x2c81('0x2e')](db['ChatGroup'][_0x2c81('0x2f')],function(_0x4785e2){return{'name':_0x4785e2['fieldName'],'type':_0x4785e2[_0x2c81('0x30')][_0x2c81('0x31')]};});_0x57c0bb[_0x2c81('0x32')]=_['map'](_0x40a5a6,_0x2c81('0x2c'));_0x57c0bb[_0x2c81('0x33')]=_[_0x2c81('0x34')](_0x5a6632['query']);_0x57c0bb['filters']=_[_0x2c81('0x35')](_0x57c0bb[_0x2c81('0x32')],_0x57c0bb[_0x2c81('0x33')]);_0x3c307f['attributes']=_['intersection'](_0x57c0bb[_0x2c81('0x32')],qs[_0x2c81('0x36')](_0x5a6632[_0x2c81('0x33')][_0x2c81('0x36')]));_0x3c307f['attributes']=_0x3c307f[_0x2c81('0x37')][_0x2c81('0x38')]?_0x3c307f['attributes']:_0x57c0bb[_0x2c81('0x32')];if(!_0x5a6632[_0x2c81('0x33')][_0x2c81('0x39')]('nolimit')){_0x3c307f['limit']=qs[_0x2c81('0x21')](_0x5a6632[_0x2c81('0x33')][_0x2c81('0x21')]);_0x3c307f[_0x2c81('0x22')]=qs[_0x2c81('0x22')](_0x5a6632['query']['offset']);}_0x3c307f[_0x2c81('0x3a')]=qs[_0x2c81('0x3b')](_0x5a6632['query']['sort']);_0x3c307f[_0x2c81('0x3c')]=qs[_0x2c81('0x3d')](_['pick'](_0x5a6632[_0x2c81('0x33')],_0x57c0bb[_0x2c81('0x3d')]),_0x40a5a6);if(_0x5a6632['query'][_0x2c81('0x3e')]){_0x3c307f['where']=_[_0x2c81('0x3f')](_0x3c307f[_0x2c81('0x3c')],{'$or':_[_0x2c81('0x2e')](_0x40a5a6,function(_0x2917de){if(_0x2917de[_0x2c81('0x30')]!==_0x2c81('0x40')){var _0x116322={};_0x116322[_0x2917de[_0x2c81('0x2c')]]={'$like':'%'+_0x5a6632[_0x2c81('0x33')][_0x2c81('0x3e')]+'%'};return _0x116322;}})});}_0x3c307f=_[_0x2c81('0x3f')]({},_0x3c307f,_0x5a6632[_0x2c81('0x41')]);var _0x46eac1={'where':_0x3c307f[_0x2c81('0x3c')]};return db[_0x2c81('0x42')][_0x2c81('0x23')](_0x46eac1)[_0x2c81('0x2a')](function(_0x18620a){_0x47957d[_0x2c81('0x23')]=_0x18620a;if(_0x5a6632[_0x2c81('0x33')]['includeAll']){_0x3c307f[_0x2c81('0x43')]=[{'all':!![]}];}return db[_0x2c81('0x42')]['findAll'](_0x3c307f);})[_0x2c81('0x2a')](function(_0x3e7af5){_0x47957d[_0x2c81('0x44')]=_0x3e7af5;return _0x47957d;})[_0x2c81('0x2a')](respondWithFilteredResult(_0x494edc,_0x3c307f))[_0x2c81('0x45')](handleError(_0x494edc,null));};exports['show']=function(_0x401545,_0x434d2f){var _0x2ea0a2={'raw':!![],'where':{'id':_0x401545[_0x2c81('0x46')]['id']}},_0x471e80={};_0x471e80['model']=_[_0x2c81('0x34')](db[_0x2c81('0x42')][_0x2c81('0x2f')]);_0x471e80['query']=_['keys'](_0x401545[_0x2c81('0x33')]);_0x471e80[_0x2c81('0x3d')]=_[_0x2c81('0x35')](_0x471e80['model'],_0x471e80[_0x2c81('0x33')]);_0x2ea0a2['attributes']=_[_0x2c81('0x35')](_0x471e80[_0x2c81('0x32')],qs[_0x2c81('0x36')](_0x401545[_0x2c81('0x33')][_0x2c81('0x36')]));_0x2ea0a2[_0x2c81('0x37')]=_0x2ea0a2[_0x2c81('0x37')][_0x2c81('0x38')]?_0x2ea0a2[_0x2c81('0x37')]:_0x471e80[_0x2c81('0x32')];if(_0x401545[_0x2c81('0x33')]['includeAll']){_0x2ea0a2[_0x2c81('0x43')]=[{'all':!![]}];}_0x2ea0a2=_[_0x2c81('0x3f')]({},_0x2ea0a2,_0x401545[_0x2c81('0x41')]);return db['ChatGroup'][_0x2c81('0x47')](_0x2ea0a2)['then'](handleEntityNotFound(_0x434d2f,null))[_0x2c81('0x2a')](respondWithResult(_0x434d2f,null))['catch'](handleError(_0x434d2f,null));};exports['create']=function(_0x57c2bd,_0x4b572a){return db[_0x2c81('0x42')][_0x2c81('0x48')](_0x57c2bd['body'],{})['then'](respondWithResult(_0x4b572a,0xc9))[_0x2c81('0x45')](handleError(_0x4b572a,null));};exports['update']=function(_0x297cc4,_0x320eac){if(_0x297cc4[_0x2c81('0x49')]['id']){delete _0x297cc4[_0x2c81('0x49')]['id'];}return db[_0x2c81('0x42')]['find']({'where':{'id':_0x297cc4[_0x2c81('0x46')]['id']}})[_0x2c81('0x2a')](handleEntityNotFound(_0x320eac,null))['then'](saveUpdates(_0x297cc4['body'],null))[_0x2c81('0x2a')](respondWithResult(_0x320eac,null))['catch'](handleError(_0x320eac,null));};exports[_0x2c81('0x29')]=function(_0x578e2f,_0x56fbd1){return db[_0x2c81('0x42')][_0x2c81('0x47')]({'where':{'id':_0x578e2f[_0x2c81('0x46')]['id']}})['then'](handleEntityNotFound(_0x56fbd1,null))[_0x2c81('0x2a')](removeEntity(_0x56fbd1,null))[_0x2c81('0x45')](handleError(_0x56fbd1,null));};exports[_0x2c81('0x4a')]=function(_0x5483c2,_0x2207bf){return db[_0x2c81('0x42')][_0x2c81('0x4a')]()[_0x2c81('0x2a')](respondWithResult(_0x2207bf,null))[_0x2c81('0x45')](handleError(_0x2207bf,null));};exports['getUnread']=function(_0x20e31c,_0x57eff1,_0x43d518){return db['ChatInternalMessage'][_0x2c81('0x23')]({'where':{'ChatGroupId':_0x20e31c['params']['id'],'ToId':_0x20e31c[_0x2c81('0x4b')]['id'],'read':![]}})[_0x2c81('0x2a')](function(_0x10bfcc){return{'id':_[_0x2c81('0x4c')](_0x20e31c[_0x2c81('0x46')]['id']),'count':_0x10bfcc};})['then'](respondWithResult(_0x57eff1,null))[_0x2c81('0x45')](handleError(_0x57eff1,null));};exports[_0x2c81('0x4d')]=function(_0x4faa20,_0x1899a6,_0x43969f){return db[_0x2c81('0x42')][_0x2c81('0x47')]({'where':{'id':_0x4faa20['params']['id']}})['then'](handleEntityNotFound(_0x1899a6,null))[_0x2c81('0x2a')](function(_0x2c943c){if(_0x2c943c){return _0x2c943c[_0x2c81('0x4d')](_0x4faa20[_0x2c81('0x49')]['ids'],_['omit'](_0x4faa20['body'],['ids','id'])||{});}})[_0x2c81('0x2a')](respondWithResult(_0x1899a6,null))[_0x2c81('0x45')](handleError(_0x1899a6,null));};exports['getMembers']=function(_0x86ab84,_0x2a6872,_0x251317){var _0x38670c={};var _0x318f44={};var _0x15ac7f;var _0x928c9c;return db[_0x2c81('0x42')][_0x2c81('0x4e')]({'where':{'id':_0x86ab84[_0x2c81('0x46')]['id']}})[_0x2c81('0x2a')](handleEntityNotFound(_0x2a6872,null))['then'](function(_0x2d3451){if(_0x2d3451){_0x15ac7f=_0x2d3451;_0x318f44['model']=_[_0x2c81('0x34')](db[_0x2c81('0x4f')][_0x2c81('0x2f')]);_0x318f44[_0x2c81('0x33')]=_['keys'](_0x86ab84[_0x2c81('0x33')]);_0x318f44[_0x2c81('0x3d')]=_[_0x2c81('0x35')](_0x318f44['model'],_0x318f44[_0x2c81('0x33')]);_0x38670c[_0x2c81('0x37')]=_[_0x2c81('0x35')](_0x318f44[_0x2c81('0x32')],qs[_0x2c81('0x36')](_0x86ab84[_0x2c81('0x33')]['fields']));_0x38670c[_0x2c81('0x37')]=_0x38670c[_0x2c81('0x37')]['length']?_0x38670c[_0x2c81('0x37')]:_0x318f44[_0x2c81('0x32')];_0x38670c[_0x2c81('0x3a')]=qs[_0x2c81('0x3b')](_0x86ab84[_0x2c81('0x33')][_0x2c81('0x3b')]);_0x38670c['where']=qs[_0x2c81('0x3d')](_[_0x2c81('0x50')](_0x86ab84[_0x2c81('0x33')],_0x318f44[_0x2c81('0x3d')]));if(_0x86ab84[_0x2c81('0x33')][_0x2c81('0x3e')]){_0x38670c[_0x2c81('0x3c')]=_[_0x2c81('0x3f')](_0x38670c[_0x2c81('0x3c')],{'$or':_[_0x2c81('0x2e')](_0x38670c[_0x2c81('0x37')],function(_0x4bb08b){var _0x54de0e={};_0x54de0e[_0x4bb08b]={'$like':'%'+_0x86ab84[_0x2c81('0x33')][_0x2c81('0x3e')]+'%'};return _0x54de0e;})});}_0x38670c=_[_0x2c81('0x3f')]({},_0x38670c,_0x86ab84[_0x2c81('0x41')]);return _0x15ac7f[_0x2c81('0x51')](_0x38670c);}})[_0x2c81('0x2a')](function(_0x3fe14c){if(_0x3fe14c){_0x928c9c=_0x3fe14c[_0x2c81('0x38')];if(!_0x86ab84[_0x2c81('0x33')][_0x2c81('0x39')](_0x2c81('0x52'))){_0x38670c['limit']=qs[_0x2c81('0x21')](_0x86ab84['query']['limit']);_0x38670c[_0x2c81('0x22')]=qs[_0x2c81('0x22')](_0x86ab84['query']['offset']);}return _0x15ac7f[_0x2c81('0x51')](_0x38670c);}})['then'](function(_0x4cdbe6){if(_0x4cdbe6){return _0x4cdbe6?{'count':_0x928c9c,'rows':_0x4cdbe6}:null;}})['then'](respondWithResult(_0x2a6872,null))[_0x2c81('0x45')](handleError(_0x2a6872,null));};exports['removeMembers']=function(_0x49dd46,_0x5b6712,_0xd4eb1c){return db[_0x2c81('0x42')][_0x2c81('0x47')]({'where':{'id':_0x49dd46[_0x2c81('0x46')]['id']}})[_0x2c81('0x2a')](handleEntityNotFound(_0x5b6712,null))[_0x2c81('0x2a')](function(_0x21b299){if(_0x21b299){return _0x21b299[_0x2c81('0x53')](_0x49dd46['query'][_0x2c81('0x54')]);}})['then'](respondWithStatusCode(_0x5b6712,null))[_0x2c81('0x45')](handleError(_0x5b6712,null));};exports[_0x2c81('0x55')]=function(_0x577529,_0x3ec586,_0x30d259){if(_0x577529[_0x2c81('0x49')]['id']){delete _0x577529['body']['id'];}return db[_0x2c81('0x42')][_0x2c81('0x47')]({'where':{'id':_0x577529['params']['id']}})[_0x2c81('0x2a')](handleEntityNotFound(_0x3ec586,null))[_0x2c81('0x2a')](function(_0x32d981){if(_0x32d981){_0x577529['body']['ChatGroupId']=_0x32d981['id'];return db[_0x2c81('0x56')][_0x2c81('0x48')](_0x577529[_0x2c81('0x49')]);}})[_0x2c81('0x2a')](respondWithResult(_0x3ec586,null))[_0x2c81('0x45')](handleError(_0x3ec586,null));};exports[_0x2c81('0x57')]=function(_0x161eeb,_0x31a1d6,_0x3e2b08){var _0x2436f0={};var _0x213331={};var _0x41b1f9;var _0x310b6d;return db[_0x2c81('0x42')]['findOne']({'where':{'id':_0x161eeb[_0x2c81('0x46')]['id']}})['then'](handleEntityNotFound(_0x31a1d6,null))[_0x2c81('0x2a')](function(_0x43cfd4){if(_0x43cfd4){_0x41b1f9=_0x43cfd4;_0x213331[_0x2c81('0x32')]=_[_0x2c81('0x34')](db[_0x2c81('0x56')][_0x2c81('0x2f')]);_0x213331['query']=_[_0x2c81('0x34')](_0x161eeb[_0x2c81('0x33')]);_0x213331[_0x2c81('0x3d')]=_[_0x2c81('0x35')](_0x213331['model'],_0x213331['query']);_0x2436f0['attributes']=_[_0x2c81('0x35')](_0x213331[_0x2c81('0x32')],qs[_0x2c81('0x36')](_0x161eeb['query']['fields']));_0x2436f0[_0x2c81('0x37')]=_0x2436f0[_0x2c81('0x37')][_0x2c81('0x38')]?_0x2436f0[_0x2c81('0x37')]:_0x213331[_0x2c81('0x32')];_0x2436f0[_0x2c81('0x3a')]=qs[_0x2c81('0x3b')](_0x161eeb['query'][_0x2c81('0x3b')]);_0x2436f0[_0x2c81('0x3c')]=qs['filters'](_['pick'](_0x161eeb['query'],_0x213331[_0x2c81('0x3d')]));if(_0x161eeb['query'][_0x2c81('0x3e')]){_0x2436f0[_0x2c81('0x3c')]=_[_0x2c81('0x3f')](_0x2436f0[_0x2c81('0x3c')],{'$or':_['map'](_0x2436f0[_0x2c81('0x37')],function(_0x497655){var _0x57dfd2={};_0x57dfd2[_0x497655]={'$like':'%'+_0x161eeb['query']['filter']+'%'};return _0x57dfd2;})});}if(_0x161eeb[_0x2c81('0x33')][_0x2c81('0x58')]){var _0x401b83=_0x161eeb[_0x2c81('0x33')][_0x2c81('0x58')][_0x2c81('0x59')](',');var _0x260077={};_0x260077[_0x401b83[0x0]]={'$gte':moment(_0x401b83[0x1])['format'](_0x2c81('0x5a'))};_0x2436f0[_0x2c81('0x3c')]=_[_0x2c81('0x3f')](_0x2436f0[_0x2c81('0x3c')],_0x260077);}_0x2436f0=_[_0x2c81('0x3f')]({},_0x2436f0,_0x161eeb[_0x2c81('0x41')]);return _0x41b1f9[_0x2c81('0x57')](_0x2436f0);}})[_0x2c81('0x2a')](function(_0x59f8a5){if(_0x59f8a5){_0x310b6d=_0x59f8a5[_0x2c81('0x38')];if(!_0x161eeb[_0x2c81('0x33')][_0x2c81('0x39')](_0x2c81('0x52'))){_0x2436f0['limit']=qs[_0x2c81('0x21')](_0x161eeb[_0x2c81('0x33')][_0x2c81('0x21')]);_0x2436f0[_0x2c81('0x22')]=qs[_0x2c81('0x22')](_0x161eeb[_0x2c81('0x33')][_0x2c81('0x22')]);}return _0x41b1f9[_0x2c81('0x57')](_0x2436f0);}})[_0x2c81('0x2a')](function(_0x8e79ea){if(_0x8e79ea){return _0x8e79ea?{'count':_0x310b6d,'rows':_0x8e79ea}:null;}})[_0x2c81('0x2a')](respondWithResult(_0x31a1d6,null))[_0x2c81('0x45')](handleError(_0x31a1d6,null));}; \ No newline at end of file +var _0x6e58=['removeMembers','addMessage','ChatGroupId','getMessages','ChatInternalMessage','rawAttributes','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','error','stack','name','index','map','ChatGroup','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','nolimit'];(function(_0x1ed388,_0x4c1474){var _0x356c7f=function(_0x19b7e1){while(--_0x19b7e1){_0x1ed388['push'](_0x1ed388['shift']());}};_0x356c7f(++_0x4c1474);}(_0x6e58,0xcf));var _0x86e5=function(_0x14e75e,_0x43a34d){_0x14e75e=_0x14e75e-0x0;var _0x5fc83b=_0x6e58[_0x14e75e];return _0x5fc83b;};'use strict';var emlformat=require(_0x86e5('0x0'));var rimraf=require(_0x86e5('0x1'));var zipdir=require(_0x86e5('0x2'));var jsonpatch=require(_0x86e5('0x3'));var rp=require(_0x86e5('0x4'));var moment=require(_0x86e5('0x5'));var BPromise=require(_0x86e5('0x6'));var Mustache=require(_0x86e5('0x7'));var util=require('util');var path=require(_0x86e5('0x8'));var sox=require(_0x86e5('0x9'));var csv=require(_0x86e5('0xa'));var ejs=require(_0x86e5('0xb'));var fs=require('fs');var fs_extra=require(_0x86e5('0xc'));var _=require(_0x86e5('0xd'));var squel=require('squel');var crypto=require(_0x86e5('0xe'));var jsforce=require(_0x86e5('0xf'));var deskjs=require(_0x86e5('0x10'));var toCsv=require(_0x86e5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x86e5('0x11'));var authService=require(_0x86e5('0x12'));var qs=require(_0x86e5('0x13'));var as=require(_0x86e5('0x14'));var hardwareService=require(_0x86e5('0x15'));var logger=require('../../config/logger')(_0x86e5('0x16'));var utils=require(_0x86e5('0x17'));var config=require(_0x86e5('0x18'));var licenseUtil=require(_0x86e5('0x19'));var db=require(_0x86e5('0x1a'))['db'];config[_0x86e5('0x1b')]=_[_0x86e5('0x1c')](config['redis'],{'host':_0x86e5('0x1d'),'port':0x18eb});var socket=require(_0x86e5('0x1e'))(new Redis(config[_0x86e5('0x1b')]));require('./chatGroup.socket')[_0x86e5('0x1f')](socket);function respondWithStatusCode(_0x2c6207,_0x343a4b){_0x343a4b=_0x343a4b||0xcc;return function(_0x46f25f){if(_0x46f25f){return _0x2c6207[_0x86e5('0x20')](_0x343a4b);}return _0x2c6207[_0x86e5('0x21')](_0x343a4b)[_0x86e5('0x22')]();};}function respondWithResult(_0x1c452a,_0x4da150){_0x4da150=_0x4da150||0xc8;return function(_0x1038cf){if(_0x1038cf){return _0x1c452a[_0x86e5('0x21')](_0x4da150)[_0x86e5('0x23')](_0x1038cf);}};}function respondWithFilteredResult(_0x4d2d95,_0x52a247){return function(_0x3bef9f){if(_0x3bef9f){var _0x1835ff=typeof _0x52a247['offset']===_0x86e5('0x24')&&typeof _0x52a247[_0x86e5('0x25')]===_0x86e5('0x24');var _0x3c1e8a=_0x3bef9f[_0x86e5('0x26')];var _0x73eed6=_0x1835ff?0x0:_0x52a247[_0x86e5('0x27')];var _0x37407b=_0x1835ff?_0x3bef9f[_0x86e5('0x26')]:_0x52a247[_0x86e5('0x27')]+_0x52a247['limit'];var _0x3893ef;if(_0x37407b>=_0x3c1e8a){_0x37407b=_0x3c1e8a;_0x3893ef=0xc8;}else{_0x3893ef=0xce;}_0x4d2d95[_0x86e5('0x21')](_0x3893ef);return _0x4d2d95['set'](_0x86e5('0x28'),_0x73eed6+'-'+_0x37407b+'/'+_0x3c1e8a)[_0x86e5('0x23')](_0x3bef9f);}return null;};}function patchUpdates(_0x545c3e){return function(_0x258bcf){try{jsonpatch['apply'](_0x258bcf,_0x545c3e,!![]);}catch(_0x57c8a3){return BPromise['reject'](_0x57c8a3);}return _0x258bcf[_0x86e5('0x29')]();};}function saveUpdates(_0x437551,_0x16bed4){return function(_0x48dad5){if(_0x48dad5){return _0x48dad5[_0x86e5('0x2a')](_0x437551)[_0x86e5('0x2b')](function(_0x59f10c){return _0x59f10c;});}return null;};}function removeEntity(_0x12f0ed,_0x18d496){return function(_0x5d428e){if(_0x5d428e){return _0x5d428e[_0x86e5('0x2c')]()[_0x86e5('0x2b')](function(){_0x12f0ed[_0x86e5('0x21')](0xcc)[_0x86e5('0x22')]();});}};}function handleEntityNotFound(_0x5899e1,_0x249551){return function(_0x4ef4fd){if(!_0x4ef4fd){_0x5899e1[_0x86e5('0x20')](0x194);}return _0x4ef4fd;};}function handleError(_0x523f13,_0x11b4cc){_0x11b4cc=_0x11b4cc||0x1f4;return function(_0x4052a8){logger[_0x86e5('0x2d')](_0x4052a8[_0x86e5('0x2e')]);if(_0x4052a8[_0x86e5('0x2f')]){delete _0x4052a8[_0x86e5('0x2f')];}_0x523f13[_0x86e5('0x21')](_0x11b4cc)['send'](_0x4052a8);};}exports[_0x86e5('0x30')]=function(_0x3ac82a,_0x14c095){var _0x1ecc21={},_0x2bec91={},_0x107c98={'count':0x0,'rows':[]};var _0x38c3ba=_[_0x86e5('0x31')](db[_0x86e5('0x32')]['rawAttributes'],function(_0x329ba3){return{'name':_0x329ba3['fieldName'],'type':_0x329ba3[_0x86e5('0x33')][_0x86e5('0x34')]};});_0x2bec91['model']=_[_0x86e5('0x31')](_0x38c3ba,_0x86e5('0x2f'));_0x2bec91[_0x86e5('0x35')]=_[_0x86e5('0x36')](_0x3ac82a[_0x86e5('0x35')]);_0x2bec91['filters']=_[_0x86e5('0x37')](_0x2bec91[_0x86e5('0x38')],_0x2bec91[_0x86e5('0x35')]);_0x1ecc21[_0x86e5('0x39')]=_[_0x86e5('0x37')](_0x2bec91['model'],qs[_0x86e5('0x3a')](_0x3ac82a['query'][_0x86e5('0x3a')]));_0x1ecc21['attributes']=_0x1ecc21[_0x86e5('0x39')][_0x86e5('0x3b')]?_0x1ecc21['attributes']:_0x2bec91[_0x86e5('0x38')];if(!_0x3ac82a['query'][_0x86e5('0x3c')]('nolimit')){_0x1ecc21[_0x86e5('0x25')]=qs[_0x86e5('0x25')](_0x3ac82a['query'][_0x86e5('0x25')]);_0x1ecc21[_0x86e5('0x27')]=qs[_0x86e5('0x27')](_0x3ac82a[_0x86e5('0x35')][_0x86e5('0x27')]);}_0x1ecc21[_0x86e5('0x3d')]=qs[_0x86e5('0x3e')](_0x3ac82a[_0x86e5('0x35')][_0x86e5('0x3e')]);_0x1ecc21['where']=qs[_0x86e5('0x3f')](_[_0x86e5('0x40')](_0x3ac82a['query'],_0x2bec91[_0x86e5('0x3f')]),_0x38c3ba);if(_0x3ac82a['query'][_0x86e5('0x41')]){_0x1ecc21[_0x86e5('0x42')]=_[_0x86e5('0x43')](_0x1ecc21[_0x86e5('0x42')],{'$or':_['map'](_0x38c3ba,function(_0x4b1550){if(_0x4b1550[_0x86e5('0x33')]!==_0x86e5('0x44')){var _0x239de0={};_0x239de0[_0x4b1550[_0x86e5('0x2f')]]={'$like':'%'+_0x3ac82a[_0x86e5('0x35')][_0x86e5('0x41')]+'%'};return _0x239de0;}})});}_0x1ecc21=_[_0x86e5('0x43')]({},_0x1ecc21,_0x3ac82a[_0x86e5('0x45')]);var _0x52e0f3={'where':_0x1ecc21['where']};return db[_0x86e5('0x32')][_0x86e5('0x26')](_0x52e0f3)[_0x86e5('0x2b')](function(_0x1a708d){_0x107c98['count']=_0x1a708d;if(_0x3ac82a[_0x86e5('0x35')][_0x86e5('0x46')]){_0x1ecc21[_0x86e5('0x47')]=[{'all':!![]}];}return db[_0x86e5('0x32')]['findAll'](_0x1ecc21);})[_0x86e5('0x2b')](function(_0x36f1a7){_0x107c98[_0x86e5('0x48')]=_0x36f1a7;return _0x107c98;})[_0x86e5('0x2b')](respondWithFilteredResult(_0x14c095,_0x1ecc21))[_0x86e5('0x49')](handleError(_0x14c095,null));};exports[_0x86e5('0x4a')]=function(_0x3223a0,_0x3c2348){var _0x6af459={'raw':!![],'where':{'id':_0x3223a0['params']['id']}},_0x3b2b22={};_0x3b2b22[_0x86e5('0x38')]=_[_0x86e5('0x36')](db[_0x86e5('0x32')]['rawAttributes']);_0x3b2b22[_0x86e5('0x35')]=_[_0x86e5('0x36')](_0x3223a0[_0x86e5('0x35')]);_0x3b2b22[_0x86e5('0x3f')]=_[_0x86e5('0x37')](_0x3b2b22[_0x86e5('0x38')],_0x3b2b22[_0x86e5('0x35')]);_0x6af459['attributes']=_['intersection'](_0x3b2b22[_0x86e5('0x38')],qs[_0x86e5('0x3a')](_0x3223a0['query']['fields']));_0x6af459[_0x86e5('0x39')]=_0x6af459[_0x86e5('0x39')][_0x86e5('0x3b')]?_0x6af459[_0x86e5('0x39')]:_0x3b2b22[_0x86e5('0x38')];if(_0x3223a0[_0x86e5('0x35')][_0x86e5('0x46')]){_0x6af459['include']=[{'all':!![]}];}_0x6af459=_[_0x86e5('0x43')]({},_0x6af459,_0x3223a0[_0x86e5('0x45')]);return db['ChatGroup'][_0x86e5('0x4b')](_0x6af459)[_0x86e5('0x2b')](handleEntityNotFound(_0x3c2348,null))[_0x86e5('0x2b')](respondWithResult(_0x3c2348,null))['catch'](handleError(_0x3c2348,null));};exports[_0x86e5('0x4c')]=function(_0x3fd59d,_0x21c190){return db[_0x86e5('0x32')]['create'](_0x3fd59d[_0x86e5('0x4d')],{})['then'](respondWithResult(_0x21c190,0xc9))[_0x86e5('0x49')](handleError(_0x21c190,null));};exports[_0x86e5('0x2a')]=function(_0x5f24f7,_0x3585c1){if(_0x5f24f7['body']['id']){delete _0x5f24f7[_0x86e5('0x4d')]['id'];}return db[_0x86e5('0x32')]['find']({'where':{'id':_0x5f24f7[_0x86e5('0x4e')]['id']}})[_0x86e5('0x2b')](handleEntityNotFound(_0x3585c1,null))[_0x86e5('0x2b')](saveUpdates(_0x5f24f7[_0x86e5('0x4d')],null))[_0x86e5('0x2b')](respondWithResult(_0x3585c1,null))[_0x86e5('0x49')](handleError(_0x3585c1,null));};exports['destroy']=function(_0xb72206,_0x38270c){return db[_0x86e5('0x32')]['find']({'where':{'id':_0xb72206[_0x86e5('0x4e')]['id']}})[_0x86e5('0x2b')](handleEntityNotFound(_0x38270c,null))['then'](removeEntity(_0x38270c,null))[_0x86e5('0x49')](handleError(_0x38270c,null));};exports[_0x86e5('0x4f')]=function(_0x3816ba,_0x39ad1f){return db[_0x86e5('0x32')][_0x86e5('0x4f')]()[_0x86e5('0x2b')](respondWithResult(_0x39ad1f,null))[_0x86e5('0x49')](handleError(_0x39ad1f,null));};exports[_0x86e5('0x50')]=function(_0x74e4a2,_0x1d8345,_0x3637b3){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x74e4a2[_0x86e5('0x4e')]['id'],'ToId':_0x74e4a2[_0x86e5('0x51')]['id'],'read':![]}})['then'](function(_0x5e4091){return{'id':_[_0x86e5('0x52')](_0x74e4a2['params']['id']),'count':_0x5e4091};})[_0x86e5('0x2b')](respondWithResult(_0x1d8345,null))[_0x86e5('0x49')](handleError(_0x1d8345,null));};exports[_0x86e5('0x53')]=function(_0x134784,_0x5124b5,_0x35ca02){return db[_0x86e5('0x32')][_0x86e5('0x4b')]({'where':{'id':_0x134784[_0x86e5('0x4e')]['id']}})[_0x86e5('0x2b')](handleEntityNotFound(_0x5124b5,null))['then'](function(_0xb038f9){if(_0xb038f9){return _0xb038f9['addMembers'](_0x134784['body'][_0x86e5('0x54')],_[_0x86e5('0x55')](_0x134784[_0x86e5('0x4d')],[_0x86e5('0x54'),'id'])||{});}})['then'](respondWithResult(_0x5124b5,null))['catch'](handleError(_0x5124b5,null));};exports[_0x86e5('0x56')]=function(_0x5860d3,_0x545f5a,_0x6f8a4c){var _0x371f99={};var _0x2331c0={};var _0x265234;var _0x2c345a;return db['ChatGroup'][_0x86e5('0x57')]({'where':{'id':_0x5860d3['params']['id']}})[_0x86e5('0x2b')](handleEntityNotFound(_0x545f5a,null))['then'](function(_0x165a8e){if(_0x165a8e){_0x265234=_0x165a8e;_0x2331c0['model']=_[_0x86e5('0x36')](db[_0x86e5('0x58')]['rawAttributes']);_0x2331c0[_0x86e5('0x35')]=_[_0x86e5('0x36')](_0x5860d3['query']);_0x2331c0[_0x86e5('0x3f')]=_['intersection'](_0x2331c0[_0x86e5('0x38')],_0x2331c0[_0x86e5('0x35')]);_0x371f99[_0x86e5('0x39')]=_[_0x86e5('0x37')](_0x2331c0[_0x86e5('0x38')],qs[_0x86e5('0x3a')](_0x5860d3[_0x86e5('0x35')][_0x86e5('0x3a')]));_0x371f99['attributes']=_0x371f99[_0x86e5('0x39')][_0x86e5('0x3b')]?_0x371f99[_0x86e5('0x39')]:_0x2331c0[_0x86e5('0x38')];_0x371f99[_0x86e5('0x3d')]=qs[_0x86e5('0x3e')](_0x5860d3[_0x86e5('0x35')][_0x86e5('0x3e')]);_0x371f99[_0x86e5('0x42')]=qs[_0x86e5('0x3f')](_['pick'](_0x5860d3[_0x86e5('0x35')],_0x2331c0[_0x86e5('0x3f')]));if(_0x5860d3[_0x86e5('0x35')][_0x86e5('0x41')]){_0x371f99[_0x86e5('0x42')]=_[_0x86e5('0x43')](_0x371f99['where'],{'$or':_[_0x86e5('0x31')](_0x371f99[_0x86e5('0x39')],function(_0x41fa6c){var _0x178805={};_0x178805[_0x41fa6c]={'$like':'%'+_0x5860d3[_0x86e5('0x35')][_0x86e5('0x41')]+'%'};return _0x178805;})});}_0x371f99=_[_0x86e5('0x43')]({},_0x371f99,_0x5860d3[_0x86e5('0x45')]);return _0x265234[_0x86e5('0x56')](_0x371f99);}})[_0x86e5('0x2b')](function(_0x23eff2){if(_0x23eff2){_0x2c345a=_0x23eff2['length'];if(!_0x5860d3['query'][_0x86e5('0x3c')](_0x86e5('0x59'))){_0x371f99[_0x86e5('0x25')]=qs['limit'](_0x5860d3[_0x86e5('0x35')]['limit']);_0x371f99[_0x86e5('0x27')]=qs[_0x86e5('0x27')](_0x5860d3['query'][_0x86e5('0x27')]);}return _0x265234[_0x86e5('0x56')](_0x371f99);}})[_0x86e5('0x2b')](function(_0x2e88b5){if(_0x2e88b5){return _0x2e88b5?{'count':_0x2c345a,'rows':_0x2e88b5}:null;}})[_0x86e5('0x2b')](respondWithResult(_0x545f5a,null))[_0x86e5('0x49')](handleError(_0x545f5a,null));};exports[_0x86e5('0x5a')]=function(_0x23298b,_0x1a955a,_0x441f15){return db['ChatGroup'][_0x86e5('0x4b')]({'where':{'id':_0x23298b[_0x86e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1a955a,null))[_0x86e5('0x2b')](function(_0x17b450){if(_0x17b450){return _0x17b450[_0x86e5('0x5a')](_0x23298b[_0x86e5('0x35')][_0x86e5('0x54')]);}})['then'](respondWithStatusCode(_0x1a955a,null))[_0x86e5('0x49')](handleError(_0x1a955a,null));};exports[_0x86e5('0x5b')]=function(_0x409d4c,_0x236fa7,_0x1a3132){if(_0x409d4c['body']['id']){delete _0x409d4c[_0x86e5('0x4d')]['id'];}return db[_0x86e5('0x32')][_0x86e5('0x4b')]({'where':{'id':_0x409d4c['params']['id']}})[_0x86e5('0x2b')](handleEntityNotFound(_0x236fa7,null))[_0x86e5('0x2b')](function(_0x23ca04){if(_0x23ca04){_0x409d4c[_0x86e5('0x4d')][_0x86e5('0x5c')]=_0x23ca04['id'];return db['ChatInternalMessage'][_0x86e5('0x4c')](_0x409d4c[_0x86e5('0x4d')]);}})[_0x86e5('0x2b')](respondWithResult(_0x236fa7,null))[_0x86e5('0x49')](handleError(_0x236fa7,null));};exports[_0x86e5('0x5d')]=function(_0x4ebf08,_0x592d6e,_0x558302){var _0x13ffb2={};var _0x2802a3={};var _0xe01413;var _0x2efbea;return db[_0x86e5('0x32')][_0x86e5('0x57')]({'where':{'id':_0x4ebf08['params']['id']}})['then'](handleEntityNotFound(_0x592d6e,null))['then'](function(_0x80c441){if(_0x80c441){_0xe01413=_0x80c441;_0x2802a3[_0x86e5('0x38')]=_[_0x86e5('0x36')](db[_0x86e5('0x5e')][_0x86e5('0x5f')]);_0x2802a3[_0x86e5('0x35')]=_['keys'](_0x4ebf08[_0x86e5('0x35')]);_0x2802a3['filters']=_[_0x86e5('0x37')](_0x2802a3[_0x86e5('0x38')],_0x2802a3[_0x86e5('0x35')]);_0x13ffb2[_0x86e5('0x39')]=_[_0x86e5('0x37')](_0x2802a3[_0x86e5('0x38')],qs[_0x86e5('0x3a')](_0x4ebf08[_0x86e5('0x35')][_0x86e5('0x3a')]));_0x13ffb2[_0x86e5('0x39')]=_0x13ffb2[_0x86e5('0x39')][_0x86e5('0x3b')]?_0x13ffb2['attributes']:_0x2802a3[_0x86e5('0x38')];_0x13ffb2[_0x86e5('0x3d')]=qs[_0x86e5('0x3e')](_0x4ebf08[_0x86e5('0x35')][_0x86e5('0x3e')]);_0x13ffb2[_0x86e5('0x42')]=qs[_0x86e5('0x3f')](_[_0x86e5('0x40')](_0x4ebf08[_0x86e5('0x35')],_0x2802a3[_0x86e5('0x3f')]));if(_0x4ebf08[_0x86e5('0x35')][_0x86e5('0x41')]){_0x13ffb2['where']=_[_0x86e5('0x43')](_0x13ffb2['where'],{'$or':_[_0x86e5('0x31')](_0x13ffb2[_0x86e5('0x39')],function(_0x1d0075){var _0x4cfc69={};_0x4cfc69[_0x1d0075]={'$like':'%'+_0x4ebf08[_0x86e5('0x35')][_0x86e5('0x41')]+'%'};return _0x4cfc69;})});}if(_0x4ebf08['query'][_0x86e5('0x60')]){var _0x203261=_0x4ebf08['query'][_0x86e5('0x60')][_0x86e5('0x61')](',');var _0x3d8109={};_0x3d8109[_0x203261[0x0]]={'$gte':moment(_0x203261[0x1])[_0x86e5('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13ffb2[_0x86e5('0x42')]=_[_0x86e5('0x43')](_0x13ffb2[_0x86e5('0x42')],_0x3d8109);}_0x13ffb2=_['merge']({},_0x13ffb2,_0x4ebf08[_0x86e5('0x45')]);return _0xe01413['getMessages'](_0x13ffb2);}})[_0x86e5('0x2b')](function(_0x114554){if(_0x114554){_0x2efbea=_0x114554[_0x86e5('0x3b')];if(!_0x4ebf08[_0x86e5('0x35')]['hasOwnProperty'](_0x86e5('0x59'))){_0x13ffb2[_0x86e5('0x25')]=qs[_0x86e5('0x25')](_0x4ebf08['query']['limit']);_0x13ffb2[_0x86e5('0x27')]=qs['offset'](_0x4ebf08['query']['offset']);}return _0xe01413[_0x86e5('0x5d')](_0x13ffb2);}})['then'](function(_0x5bbe0e){if(_0x5bbe0e){return _0x5bbe0e?{'count':_0x2efbea,'rows':_0x5bbe0e}:null;}})['then'](respondWithResult(_0x592d6e,null))[_0x86e5('0x49')](handleError(_0x592d6e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5f9fd8d..aad3355 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 _0xf4a9=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x427fad,_0x4fbada){var _0x5d133b=function(_0x4d4e49){while(--_0x4d4e49){_0x427fad['push'](_0x427fad['shift']());}};_0x5d133b(++_0x4fbada);}(_0xf4a9,0x164));var _0x9f4a=function(_0x1b29b2,_0x3b6b11){_0x1b29b2=_0x1b29b2-0x0;var _0x560b68=_0xf4a9[_0x1b29b2];return _0x560b68;};'use strict';var EventEmitter=require(_0x9f4a('0x0'));var ChatGroup=require(_0x9f4a('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9f4a('0x2')](0x0);var events={'afterCreate':_0x9f4a('0x3'),'afterUpdate':'update','afterDestroy':_0x9f4a('0x4')};function emitEvent(_0x1f186a){return function(_0xc376df,_0x1cef82,_0x253cbe){ChatGroupEvents[_0x9f4a('0x5')](_0x1f186a+':'+_0xc376df['id'],_0xc376df);ChatGroupEvents[_0x9f4a('0x5')](_0x1f186a,_0xc376df);_0x253cbe(null);};}for(var e in events){if(events[_0x9f4a('0x6')](e)){var event=events[e];ChatGroup[_0x9f4a('0x7')](e,emitEvent(event));}}module[_0x9f4a('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xa8cb=['hasOwnProperty','exports','events','../../mysqldb','save','update','emit'];(function(_0x37c187,_0x264ec6){var _0x5aaa16=function(_0x23fcb3){while(--_0x23fcb3){_0x37c187['push'](_0x37c187['shift']());}};_0x5aaa16(++_0x264ec6);}(_0xa8cb,0x1de));var _0xba8c=function(_0x279aa4,_0xe42760){_0x279aa4=_0x279aa4-0x0;var _0x18b2b5=_0xa8cb[_0x279aa4];return _0x18b2b5;};'use strict';var EventEmitter=require(_0xba8c('0x0'));var ChatGroup=require(_0xba8c('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xba8c('0x2'),'afterUpdate':_0xba8c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x440c80){return function(_0x2e14c5,_0x240f3e,_0x401d89){ChatGroupEvents[_0xba8c('0x4')](_0x440c80+':'+_0x2e14c5['id'],_0x2e14c5);ChatGroupEvents['emit'](_0x440c80,_0x2e14c5);_0x401d89(null);};}for(var e in events){if(events[_0xba8c('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xba8c('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 89e0e17..ce4b773 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 _0x59ef=['moment','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api'];(function(_0x1ea2a7,_0x18b80a){var _0x5d3f1f=function(_0x4c138c){while(--_0x4c138c){_0x1ea2a7['push'](_0x1ea2a7['shift']());}};_0x5d3f1f(++_0x18b80a);}(_0x59ef,0xf3));var _0xf59e=function(_0x159670,_0x55aa84){_0x159670=_0x159670-0x0;var _0x3a2519=_0x59ef[_0x159670];return _0x3a2519;};'use strict';var _=require(_0xf59e('0x0'));var util=require(_0xf59e('0x1'));var logger=require(_0xf59e('0x2'))(_0xf59e('0x3'));var moment=require(_0xf59e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf59e('0x5'));var fs=require('fs');var path=require(_0xf59e('0x6'));var rimraf=require(_0xf59e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf59e('0x8'));module[_0xf59e('0x9')]=function(_0x4883e3,_0x5407dd){return _0x4883e3[_0xf59e('0xa')](_0xf59e('0xb'),attributes,{'tableName':_0xf59e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8797=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','chat_groups'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8797,0xc0));var _0x7879=function(_0x3cc651,_0x55e349){_0x3cc651=_0x3cc651-0x0;var _0x2b0f17=_0x8797[_0x3cc651];return _0x2b0f17;};'use strict';var _=require(_0x7879('0x0'));var util=require(_0x7879('0x1'));var logger=require(_0x7879('0x2'))(_0x7879('0x3'));var moment=require(_0x7879('0x4'));var BPromise=require(_0x7879('0x5'));var rp=require(_0x7879('0x6'));var fs=require('fs');var path=require(_0x7879('0x7'));var rimraf=require(_0x7879('0x8'));var config=require(_0x7879('0x9'));var attributes=require('./chatGroup.attributes');module[_0x7879('0xa')]=function(_0x1f8fc2,_0x128b31){return _0x1f8fc2['define']('ChatGroup',attributes,{'tableName':_0x7879('0xb'),'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 7b104a0..ad28129 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 _0xd51f=['error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x504b6c,_0x7f5149){var _0x3fbd8a=function(_0x309402){while(--_0x309402){_0x504b6c['push'](_0x504b6c['shift']());}};_0x3fbd8a(++_0x7f5149);}(_0xd51f,0xf0));var _0xfd51=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd51f[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var moment=require('moment');var BPromise=require(_0xfd51('0x2'));var rs=require(_0xfd51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd51('0x4'))['db'];var utils=require(_0xfd51('0x5'));var logger=require('../../config/logger')(_0xfd51('0x6'));var config=require(_0xfd51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd51('0x8')][_0xfd51('0x9')]({'port':0x232a});config['redis']=_[_0xfd51('0xa')](config[_0xfd51('0xb')],{'host':_0xfd51('0xc'),'port':0x18eb});var socket=require(_0xfd51('0xd'))(new Redis(config[_0xfd51('0xb')]));require('./chatGroup.socket')[_0xfd51('0xe')](socket);function respondWithRpcPromise(_0x444385,_0x2878c6,_0x5cc2a8){return new BPromise(function(_0x19d70e,_0x5a6fcc){return client['request'](_0x444385,_0x5cc2a8)[_0xfd51('0xf')](function(_0xfc313b){logger[_0xfd51('0x10')]('ChatGroup,\x20%s,\x20%s',_0x2878c6,'request\x20sent');logger['debug'](_0xfd51('0x11'),_0x2878c6,_0xfd51('0x12'),JSON[_0xfd51('0x13')](_0xfc313b));if(_0xfc313b[_0xfd51('0x14')]){if(_0xfc313b[_0xfd51('0x14')][_0xfd51('0x15')]===0x1f4){logger[_0xfd51('0x14')]('ChatGroup,\x20%s,\x20%s',_0x2878c6,_0xfc313b[_0xfd51('0x14')][_0xfd51('0x16')]);return _0x5a6fcc(_0xfc313b[_0xfd51('0x14')][_0xfd51('0x16')]);}logger[_0xfd51('0x14')](_0xfd51('0x17'),_0x2878c6,_0xfc313b[_0xfd51('0x14')][_0xfd51('0x16')]);return _0x19d70e(_0xfc313b['error'][_0xfd51('0x16')]);}else{logger['info'](_0xfd51('0x17'),_0x2878c6,_0xfd51('0x12'));_0x19d70e(_0xfc313b[_0xfd51('0x18')][_0xfd51('0x16')]);}})[_0xfd51('0x19')](function(_0x22b2d0){logger[_0xfd51('0x14')](_0xfd51('0x17'),_0x2878c6,_0x22b2d0);_0x5a6fcc(_0x22b2d0);});});} \ No newline at end of file +var _0x45c9=['rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3520b8,_0x2d2034){var _0x262768=function(_0xd3aab){while(--_0xd3aab){_0x3520b8['push'](_0x3520b8['shift']());}};_0x262768(++_0x2d2034);}(_0x45c9,0x96));var _0x945c=function(_0x34d0f5,_0x5c9066){_0x34d0f5=_0x34d0f5-0x0;var _0x4f5918=_0x45c9[_0x34d0f5];return _0x4f5918;};'use strict';var _=require('lodash');var util=require(_0x945c('0x0'));var moment=require('moment');var BPromise=require(_0x945c('0x1'));var rs=require(_0x945c('0x2'));var fs=require('fs');var Redis=require(_0x945c('0x3'));var db=require(_0x945c('0x4'))['db'];var utils=require(_0x945c('0x5'));var logger=require('../../config/logger')(_0x945c('0x6'));var config=require('../../config/environment');var jayson=require(_0x945c('0x7'));var client=jayson[_0x945c('0x8')][_0x945c('0x9')]({'port':0x232a});config[_0x945c('0xa')]=_[_0x945c('0xb')](config[_0x945c('0xa')],{'host':_0x945c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x945c('0xa')]));require('./chatGroup.socket')[_0x945c('0xd')](socket);function respondWithRpcPromise(_0x569568,_0x3e46e1,_0x4e0f64){return new BPromise(function(_0x2a8d86,_0x11c8ce){return client[_0x945c('0xe')](_0x569568,_0x4e0f64)[_0x945c('0xf')](function(_0x1a6954){logger[_0x945c('0x10')](_0x945c('0x11'),_0x3e46e1,_0x945c('0x12'));logger[_0x945c('0x13')](_0x945c('0x14'),_0x3e46e1,_0x945c('0x12'),JSON[_0x945c('0x15')](_0x1a6954));if(_0x1a6954[_0x945c('0x16')]){if(_0x1a6954[_0x945c('0x16')]['code']===0x1f4){logger[_0x945c('0x16')](_0x945c('0x11'),_0x3e46e1,_0x1a6954[_0x945c('0x16')][_0x945c('0x17')]);return _0x11c8ce(_0x1a6954[_0x945c('0x16')][_0x945c('0x17')]);}logger[_0x945c('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3e46e1,_0x1a6954[_0x945c('0x16')][_0x945c('0x17')]);return _0x2a8d86(_0x1a6954[_0x945c('0x16')]['message']);}else{logger[_0x945c('0x10')](_0x945c('0x11'),_0x3e46e1,_0x945c('0x12'));_0x2a8d86(_0x1a6954[_0x945c('0x18')][_0x945c('0x17')]);}})[_0x945c('0x19')](function(_0x59f759){logger[_0x945c('0x16')](_0x945c('0x11'),_0x3e46e1,_0x59f759);_0x11c8ce(_0x59f759);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a2c5d4c..07de168 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 _0xda60=['save','update','emit','register','chatGroup:','./chatGroup.events'];(function(_0xf46f5f,_0x3be12f){var _0x465a17=function(_0x30a2a3){while(--_0x30a2a3){_0xf46f5f['push'](_0xf46f5f['shift']());}};_0x465a17(++_0x3be12f);}(_0xda60,0x167));var _0x0da6=function(_0x9f0bdf,_0x14e6ca){_0x9f0bdf=_0x9f0bdf-0x0;var _0x523eca=_0xda60[_0x9f0bdf];return _0x523eca;};'use strict';var ChatGroupEvents=require(_0x0da6('0x0'));var events=[_0x0da6('0x1'),'remove',_0x0da6('0x2')];function createListener(_0x35eb65,_0x24ee48){return function(_0x4555db){_0x24ee48[_0x0da6('0x3')](_0x35eb65,_0x4555db);};}function removeListener(_0x375f9e,_0x29a905){return function(){ChatGroupEvents['removeListener'](_0x375f9e,_0x29a905);};}exports[_0x0da6('0x4')]=function(_0x4d5119){for(var _0x454f72=0x0,_0x217163=events['length'];_0x454f72<_0x217163;_0x454f72++){var _0x371757=events[_0x454f72];var _0x45ce53=createListener(_0x0da6('0x5')+_0x371757,_0x4d5119);ChatGroupEvents['on'](_0x371757,_0x45ce53);}}; \ No newline at end of file +var _0x166d=['./chatGroup.events','remove','update','emit','register','length','chatGroup:'];(function(_0x2169d3,_0x333b7c){var _0x49551c=function(_0x1e057e){while(--_0x1e057e){_0x2169d3['push'](_0x2169d3['shift']());}};_0x49551c(++_0x333b7c);}(_0x166d,0x17a));var _0xd166=function(_0x467e4f,_0x4a8d31){_0x467e4f=_0x467e4f-0x0;var _0x56c826=_0x166d[_0x467e4f];return _0x56c826;};'use strict';var ChatGroupEvents=require(_0xd166('0x0'));var events=['save',_0xd166('0x1'),_0xd166('0x2')];function createListener(_0x44a702,_0x1d4458){return function(_0x286dc5){_0x1d4458[_0xd166('0x3')](_0x44a702,_0x286dc5);};}function removeListener(_0x2fc285,_0x32f3d9){return function(){ChatGroupEvents['removeListener'](_0x2fc285,_0x32f3d9);};}exports[_0xd166('0x4')]=function(_0x5f1c68){for(var _0x21021c=0x0,_0x2ebd74=events[_0xd166('0x5')];_0x21021c<_0x2ebd74;_0x21021c++){var _0x27e89a=events[_0x21021c];var _0x2f3d3a=createListener(_0xd166('0x6')+_0x27e89a,_0x5f1c68);ChatGroupEvents['on'](_0x27e89a,_0x2f3d3a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6272f9f..48e226c 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 _0x6b17=['./chatGroup.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x67c8b7,_0x5bbb42){var _0x1c8ef0=function(_0x55d359){while(--_0x55d359){_0x67c8b7['push'](_0x67c8b7['shift']());}};_0x1c8ef0(++_0x5bbb42);}(_0x6b17,0x83));var _0x76b1=function(_0x135d2a,_0x546cd1){_0x135d2a=_0x135d2a-0x0;var _0xae488=_0x6b17[_0x135d2a];return _0xae488;};'use strict';var multer=require(_0x76b1('0x0'));var util=require(_0x76b1('0x1'));var path=require(_0x76b1('0x2'));var timeout=require(_0x76b1('0x3'));var express=require(_0x76b1('0x4'));var router=express[_0x76b1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x76b1('0x6'));var interaction=require(_0x76b1('0x7'));var config=require(_0x76b1('0x8'));var controller=require(_0x76b1('0x9'));router['get']('/',auth[_0x76b1('0xa')](),controller[_0x76b1('0xb')]);router['get'](_0x76b1('0xc'),auth[_0x76b1('0xa')](),controller[_0x76b1('0xd')]);router[_0x76b1('0xe')](_0x76b1('0xf'),auth[_0x76b1('0xa')](),controller[_0x76b1('0x10')]);router[_0x76b1('0xe')]('/:id/unread',auth[_0x76b1('0xa')](),controller[_0x76b1('0x11')]);router[_0x76b1('0xe')](_0x76b1('0x12'),auth[_0x76b1('0xa')](),controller[_0x76b1('0x13')]);router[_0x76b1('0xe')](_0x76b1('0x14'),auth[_0x76b1('0xa')](),controller[_0x76b1('0x15')]);router['post']('/',auth[_0x76b1('0xa')](),controller['create']);router[_0x76b1('0x16')]('/:id/members',auth[_0x76b1('0xa')](),controller[_0x76b1('0x17')]);router[_0x76b1('0x16')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['put'](_0x76b1('0xf'),auth[_0x76b1('0xa')](),controller[_0x76b1('0x18')]);router[_0x76b1('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x76b1('0x19')](_0x76b1('0x12'),auth[_0x76b1('0xa')](),controller[_0x76b1('0x1a')]);module[_0x76b1('0x1b')]=router; \ No newline at end of file +var _0x8054=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','delete','destroy','exports','multer','util'];(function(_0x3e39a3,_0x32aec1){var _0x2fd399=function(_0x122fdf){while(--_0x122fdf){_0x3e39a3['push'](_0x3e39a3['shift']());}};_0x2fd399(++_0x32aec1);}(_0x8054,0xbb));var _0x4805=function(_0x547dce,_0x41e204){_0x547dce=_0x547dce-0x0;var _0x38dd8b=_0x8054[_0x547dce];return _0x38dd8b;};'use strict';var multer=require(_0x4805('0x0'));var util=require(_0x4805('0x1'));var path=require('path');var timeout=require(_0x4805('0x2'));var express=require('express');var router=express[_0x4805('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4805('0x4'));var interaction=require(_0x4805('0x5'));var config=require(_0x4805('0x6'));var controller=require(_0x4805('0x7'));router[_0x4805('0x8')]('/',auth['isAuthenticated'](),controller[_0x4805('0x9')]);router[_0x4805('0x8')](_0x4805('0xa'),auth[_0x4805('0xb')](),controller[_0x4805('0xc')]);router[_0x4805('0x8')](_0x4805('0xd'),auth[_0x4805('0xb')](),controller[_0x4805('0xe')]);router[_0x4805('0x8')](_0x4805('0xf'),auth[_0x4805('0xb')](),controller[_0x4805('0x10')]);router['get'](_0x4805('0x11'),auth[_0x4805('0xb')](),controller['getMembers']);router[_0x4805('0x8')](_0x4805('0x12'),auth[_0x4805('0xb')](),controller[_0x4805('0x13')]);router[_0x4805('0x14')]('/',auth[_0x4805('0xb')](),controller[_0x4805('0x15')]);router[_0x4805('0x14')](_0x4805('0x11'),auth[_0x4805('0xb')](),controller[_0x4805('0x16')]);router[_0x4805('0x14')](_0x4805('0x12'),auth[_0x4805('0xb')](),controller[_0x4805('0x17')]);router['put'](_0x4805('0xd'),auth[_0x4805('0xb')](),controller['update']);router[_0x4805('0x18')](_0x4805('0xd'),auth['isAuthenticated'](),controller[_0x4805('0x19')]);router[_0x4805('0x18')](_0x4805('0x11'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x4805('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 57d1f13..456ca02 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 _0x81f6=['out','INTEGER','sequelize','BOOLEAN','star','TEXT','DATE','STRING','long'];(function(_0x13cd99,_0x50bd8d){var _0x1d42c7=function(_0x1fa433){while(--_0x1fa433){_0x13cd99['push'](_0x13cd99['shift']());}};_0x1d42c7(++_0x50bd8d);}(_0x81f6,0xd1));var _0x681f=function(_0x1826c2,_0x18b5ea){_0x1826c2=_0x1826c2-0x0;var _0x5234de=_0x81f6[_0x1826c2];return _0x5234de;};'use strict';var Sequelize=require(_0x681f('0x0'));module['exports']={'closed':{'type':Sequelize[_0x681f('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x681f('0x2'),'thumb'),'defaultValue':_0x681f('0x2')},'ratingMessage':{'type':Sequelize[_0x681f('0x3')]},'pathTranscript':{'type':Sequelize[_0x681f('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x681f('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x681f('0x5')]},'browserName':{'type':Sequelize[_0x681f('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x681f('0x5')]},'osVersion':{'type':Sequelize[_0x681f('0x5')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x681f('0x5')]},'deviceType':{'type':Sequelize[_0x681f('0x5')]},'referer':{'type':Sequelize[_0x681f('0x3')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x681f('0x3')](_0x681f('0x6'))},'read1stAt':{'type':Sequelize[_0x681f('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x681f('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x681f('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x681f('0x8')]}}; \ No newline at end of file +var _0x8217=['DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8217,0xf2));var _0x7821=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x8217[_0x581249];return _0x284bae;};'use strict';var Sequelize=require(_0x7821('0x0'));module[_0x7821('0x1')]={'closed':{'type':Sequelize[_0x7821('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7821('0x3')]},'ratingType':{'type':Sequelize[_0x7821('0x4')](_0x7821('0x5'),_0x7821('0x6')),'defaultValue':_0x7821('0x5')},'ratingMessage':{'type':Sequelize[_0x7821('0x7')]},'pathTranscript':{'type':Sequelize[_0x7821('0x7')]},'mailTranscript':{'type':Sequelize[_0x7821('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7821('0x8')]},'secondDisposition':{'type':Sequelize[_0x7821('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x7821('0x8')]},'browserVersion':{'type':Sequelize[_0x7821('0x8')]},'osName':{'type':Sequelize[_0x7821('0x8')]},'osVersion':{'type':Sequelize[_0x7821('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x7821('0x8')]},'deviceType':{'type':Sequelize[_0x7821('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x7821('0x8')]},'formData':{'type':Sequelize[_0x7821('0x7')](_0x7821('0x9'))},'read1stAt':{'type':Sequelize[_0x7821('0xa')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7821('0x4')]('in',_0x7821('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7821('0x8')]},'customerPort':{'type':Sequelize[_0x7821('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x7821('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x7821('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7821('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0dd6693..bfea1a8 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 _0xee63=['UserId','System','customer','%s%d','Visitor','agentIdentifier','agentAlias','agent_alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','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','ChatMessage','omit','ids','getMessages','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','options','includeAll','getMyMessages','secret','includeAgent','push','addTags','spread','Tag','color','emit','removeTags','files','tmp','server','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','createdAt','read','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','toString','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','request-promise','moment','bluebird','mustache','util','path','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','code','error','message','result','status','end','json','undefined','limit','count','offset','Content-Range','update','sendStatus','stack','name','send','body','contact','agent','interaction','index','map','rawAttributes','getOptions','findAll','chat','query','user','catch','show','params','model','keys','ChatInteraction','filters','attributes','intersection','fields','length','include','merge','find','create','destroy','describe','ChatWebsite','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','account','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','Attachment','attachmentDownload','ChatOfflineMessageId','join','offline-chat/','download','close','mailTranscript','root','format','transcript-%s.txt','now','pathTranscript','Messages','User'];(function(_0x5af039,_0x4c4109){var _0x13cecf=function(_0x24b7bd){while(--_0x24b7bd){_0x5af039['push'](_0x5af039['shift']());}};_0x13cecf(++_0x4c4109);}(_0xee63,0x1e3));var _0x3ee6=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xee63[_0x4382bc];return _0x13c82a;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x3ee6('0x0'));var moment=require(_0x3ee6('0x1'));var BPromise=require(_0x3ee6('0x2'));var Mustache=require(_0x3ee6('0x3'));var util=require(_0x3ee6('0x4'));var path=require(_0x3ee6('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x3ee6('0x6'));var interaction=require(_0x3ee6('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x3ee6('0x8'));var logger=require(_0x3ee6('0x9'))('api');var config=require(_0x3ee6('0xa'));var db=require(_0x3ee6('0xb'))['db'];config[_0x3ee6('0xc')]=_[_0x3ee6('0xd')](config[_0x3ee6('0xc')],{'host':_0x3ee6('0xe'),'port':0x18eb});var socket=require(_0x3ee6('0xf'))(new Redis(config[_0x3ee6('0xc')]));require(_0x3ee6('0x10'))[_0x3ee6('0x11')](socket);var jayson=require(_0x3ee6('0x12'));var client=jayson[_0x3ee6('0x13')][_0x3ee6('0x14')]({'port':0x232b});var client9004=jayson[_0x3ee6('0x13')][_0x3ee6('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x438186,_0x749e05,_0x40cda7,_0x310e8c){return new BPromise(function(_0x2887b1,_0x4ad5d3){var _0x38de05=_0x310e8c||client;return _0x38de05['request'](_0x438186,_0x40cda7)[_0x3ee6('0x15')](function(_0x2e2e23){logger[_0x3ee6('0x16')](_0x3ee6('0x17'),_0x749e05,_0x3ee6('0x18'));logger[_0x3ee6('0x19')](_0x3ee6('0x1a'),_0x749e05,_0x3ee6('0x18'),JSON['stringify'](_0x2e2e23));if(_0x2e2e23['error']){if(_0x2e2e23['error'][_0x3ee6('0x1b')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x749e05,_0x2e2e23[_0x3ee6('0x1c')][_0x3ee6('0x1d')]);return _0x4ad5d3(_0x2e2e23[_0x3ee6('0x1c')][_0x3ee6('0x1d')]);}logger[_0x3ee6('0x1c')](_0x3ee6('0x17'),_0x749e05,_0x2e2e23[_0x3ee6('0x1c')][_0x3ee6('0x1d')]);return _0x2887b1(_0x2e2e23[_0x3ee6('0x1c')][_0x3ee6('0x1d')]);}else{logger[_0x3ee6('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x749e05,'request\x20sent');_0x2887b1(_0x2e2e23[_0x3ee6('0x1e')][_0x3ee6('0x1d')]);}})['catch'](function(_0x3d3c98){logger[_0x3ee6('0x1c')](_0x3ee6('0x17'),_0x749e05,_0x3d3c98);_0x4ad5d3(_0x3d3c98);});});}function respondWithStatusCode(_0x48679e,_0x47fafb){_0x47fafb=_0x47fafb||0xcc;return function(_0x21827b){if(_0x21827b){return _0x48679e['sendStatus'](_0x47fafb);}return _0x48679e[_0x3ee6('0x1f')](_0x47fafb)[_0x3ee6('0x20')]();};}function respondWithResult(_0x4449dd,_0x47dd7b){_0x47dd7b=_0x47dd7b||0xc8;return function(_0x25b55e){if(_0x25b55e){return _0x4449dd[_0x3ee6('0x1f')](_0x47dd7b)[_0x3ee6('0x21')](_0x25b55e);}};}function respondWithFilteredResult(_0x1bfd3a,_0x100376){return function(_0x5b0bfa){if(_0x5b0bfa){var _0x4b4e96=typeof _0x100376['offset']===_0x3ee6('0x22')&&typeof _0x100376[_0x3ee6('0x23')]===_0x3ee6('0x22');var _0x2ae89b=_0x5b0bfa[_0x3ee6('0x24')];var _0x12d2a8=_0x4b4e96?0x0:_0x100376['offset'];var _0x505910=_0x4b4e96?_0x5b0bfa[_0x3ee6('0x24')]:_0x100376[_0x3ee6('0x25')]+_0x100376[_0x3ee6('0x23')];var _0x4c33b5;if(_0x505910>=_0x2ae89b){_0x505910=_0x2ae89b;_0x4c33b5=0xc8;}else{_0x4c33b5=0xce;}_0x1bfd3a[_0x3ee6('0x1f')](_0x4c33b5);return _0x1bfd3a['set'](_0x3ee6('0x26'),_0x12d2a8+'-'+_0x505910+'/'+_0x2ae89b)[_0x3ee6('0x21')](_0x5b0bfa);}return null;};}function saveUpdates(_0x55304d){return function(_0x3aa770){if(_0x3aa770){return _0x3aa770[_0x3ee6('0x27')](_0x55304d)[_0x3ee6('0x15')](function(_0x1d0e7c){return _0x1d0e7c;});}return null;};}function removeEntity(_0x173cd7){return function(_0x2ebcdb){if(_0x2ebcdb){return _0x2ebcdb['destroy']()[_0x3ee6('0x15')](function(){_0x173cd7[_0x3ee6('0x1f')](0xcc)[_0x3ee6('0x20')]();});}};}function handleEntityNotFound(_0x43cbac){return function(_0x8626e5){if(!_0x8626e5){_0x43cbac[_0x3ee6('0x28')](0x194);}return _0x8626e5;};}function handleError(_0x18321e,_0x46dcf5){_0x46dcf5=_0x46dcf5||0x1f4;return function(_0x1d0a39){logger[_0x3ee6('0x1c')](_0x1d0a39[_0x3ee6('0x29')]);if(_0x1d0a39[_0x3ee6('0x2a')]){delete _0x1d0a39[_0x3ee6('0x2a')];}_0x18321e[_0x3ee6('0x1f')](_0x46dcf5)[_0x3ee6('0x2b')](_0x1d0a39);};}function getMustacheRender(_0x3e1fb1,_0xf85c1d){return Mustache['render'](_0x3e1fb1,_['merge'](_0xf85c1d[_0x3ee6('0x2c')],{'contact':_0xf85c1d[_0x3ee6('0x2d')],'message':_0xf85c1d[_0x3ee6('0x1d')],'agent':_0xf85c1d[_0x3ee6('0x2e')],'interaction':_0xf85c1d[_0x3ee6('0x2f')],'account':_0xf85c1d['account']}))||'';}exports[_0x3ee6('0x30')]=function(_0x87367b,_0x15dcda){var _0x1e39ce={};var _0x12a277=_[_0x3ee6('0x31')](db['ChatInteraction'][_0x3ee6('0x32')],function(_0x2113bd){return{'name':_0x2113bd['fieldName'],'type':_0x2113bd['type']['key']};});_0x1e39ce=qs[_0x3ee6('0x33')](_0x12a277,_0x87367b);return interaction[_0x3ee6('0x34')](_0x3ee6('0x35'),_0x87367b[_0x3ee6('0x36')],_0x87367b[_0x3ee6('0x37')],_0x1e39ce,_0x12a277)[_0x3ee6('0x15')](respondWithFilteredResult(_0x15dcda,_0x1e39ce))[_0x3ee6('0x38')](handleError(_0x15dcda,null));};exports[_0x3ee6('0x39')]=function(_0x465ef5,_0x511974){var _0x117712={'raw':![],'where':{'id':_0x465ef5[_0x3ee6('0x3a')]['id']}},_0x59f91c={};_0x59f91c[_0x3ee6('0x3b')]=_[_0x3ee6('0x3c')](db[_0x3ee6('0x3d')]['rawAttributes']);_0x59f91c['query']=_[_0x3ee6('0x3c')](_0x465ef5[_0x3ee6('0x36')]);_0x59f91c[_0x3ee6('0x3e')]=_['intersection'](_0x59f91c[_0x3ee6('0x3b')],_0x59f91c[_0x3ee6('0x36')]);_0x117712[_0x3ee6('0x3f')]=_[_0x3ee6('0x40')](_0x59f91c[_0x3ee6('0x3b')],qs['fields'](_0x465ef5[_0x3ee6('0x36')][_0x3ee6('0x41')]));_0x117712[_0x3ee6('0x3f')]=_0x117712[_0x3ee6('0x3f')][_0x3ee6('0x42')]?_0x117712[_0x3ee6('0x3f')]:_0x59f91c[_0x3ee6('0x3b')];if(_0x465ef5['query']['includeAll']){_0x117712[_0x3ee6('0x43')]=[{'all':!![]}];}_0x117712=_[_0x3ee6('0x44')]({},_0x117712,_0x465ef5['options']);return db['ChatInteraction'][_0x3ee6('0x45')](_0x117712)['then'](handleEntityNotFound(_0x511974,null))['then'](respondWithResult(_0x511974,null))['catch'](handleError(_0x511974,null));};exports[_0x3ee6('0x46')]=function(_0x283c1a,_0x4d572a){return db[_0x3ee6('0x3d')][_0x3ee6('0x46')](_0x283c1a[_0x3ee6('0x2c')],{})[_0x3ee6('0x15')](respondWithResult(_0x4d572a,0xc9))['catch'](handleError(_0x4d572a,null));};exports[_0x3ee6('0x27')]=function(_0x3df686,_0x295430){if(_0x3df686[_0x3ee6('0x2c')]['id']){delete _0x3df686[_0x3ee6('0x2c')]['id'];}return db[_0x3ee6('0x3d')][_0x3ee6('0x45')]({'where':{'id':_0x3df686[_0x3ee6('0x3a')]['id']}})[_0x3ee6('0x15')](handleEntityNotFound(_0x295430,null))[_0x3ee6('0x15')](saveUpdates(_0x3df686[_0x3ee6('0x2c')],null))[_0x3ee6('0x15')](respondWithResult(_0x295430,null))[_0x3ee6('0x38')](handleError(_0x295430,null));};exports[_0x3ee6('0x47')]=function(_0x18596b,_0x37b96c){return db['ChatInteraction'][_0x3ee6('0x45')]({'where':{'id':_0x18596b[_0x3ee6('0x3a')]['id']}})[_0x3ee6('0x15')](handleEntityNotFound(_0x37b96c,null))[_0x3ee6('0x15')](removeEntity(_0x37b96c,null))['catch'](handleError(_0x37b96c,null));};exports[_0x3ee6('0x48')]=function(_0x54ceb3,_0x5522aa){return db[_0x3ee6('0x3d')]['describe']()[_0x3ee6('0x15')](respondWithResult(_0x5522aa,null))[_0x3ee6('0x38')](handleError(_0x5522aa,null));};exports['createVidaooSession']=function(_0x5de856,_0x4f401d){var _0x5da34e=_0x5de856[_0x3ee6('0x3a')]['id'];var _0x4664e7;var _0x53be69;var _0x4a0226;return db[_0x3ee6('0x3d')]['findOne']({'where':{'id':_0x5da34e}})['then'](function(_0x37b208){_0x4664e7=_0x37b208;return db[_0x3ee6('0x49')][_0x3ee6('0x4a')]({'where':{'id':_0x37b208[_0x3ee6('0x4b')]},'attributes':['id','vidaooApiKey',_0x3ee6('0x4c'),_0x3ee6('0x4d'),_0x3ee6('0x4e'),_0x3ee6('0x4f')],'raw':!![]});})[_0x3ee6('0x15')](function(_0x3af6cf){if(_0x3af6cf&&_0x3af6cf[_0x3ee6('0x50')]&&_0x3af6cf[_0x3ee6('0x4c')]){_0x53be69=_0x3af6cf;var _0x2b5662={'interaction':{'id':_0x5da34e},'agent':{'id':_0x5de856[_0x3ee6('0x37')]['id'],'name':_0x5de856[_0x3ee6('0x37')]['name'],'fullname':_0x5de856[_0x3ee6('0x37')]['fullname'],'email':_0x5de856[_0x3ee6('0x37')][_0x3ee6('0x51')]},'contact':_0x5de856[_0x3ee6('0x2c')][_0x3ee6('0x2d')],'account':_0x5de856[_0x3ee6('0x2c')][_0x3ee6('0x52')]};var _0x2fd526={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3af6cf[_0x3ee6('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5de856['user'][_0x3ee6('0x51')]],'buttons':null,'topic':_0x53be69['vidaooTopic'],'note':_[_0x3ee6('0x53')](_0x53be69[_0x3ee6('0x4e')])?null:getMustacheRender(_0x53be69[_0x3ee6('0x4e')],_0x2b5662),'metadata':null},'redirect':_0x3ee6('0x54'),'json':!![]};try{if(!_[_0x3ee6('0x53')](_0x53be69['vidaooMetadata'])){var _0x537d4c=getMustacheRender(_0x53be69[_0x3ee6('0x4f')],_0x2b5662);var _0x1ac3ef=JSON['parse'](_0x537d4c);_0x2fd526[_0x3ee6('0x2c')]['metadata']=_0x1ac3ef;}}catch(_0x5b4133){throw new db['Sequelize'][(_0x3ee6('0x55'))](_0x3ee6('0x56'));}return rp(_0x2fd526);}else{throw new db['Sequelize'][(_0x3ee6('0x55'))](_0x3ee6('0x57'));}})[_0x3ee6('0x15')](function(_0x472a6e){_0x4a0226=_0x472a6e;if(_0x4a0226['id']){var _0xb94afc={'body':_0x4a0226[_0x3ee6('0x58')],'ChatWebsiteId':_0x53be69['id'],'ChatInteractionId':_0x4664e7['id'],'direction':_0x3ee6('0x59'),'UserId':_0x5de856[_0x3ee6('0x37')]['id']};return db['ChatMessage'][_0x3ee6('0x46')](_0xb94afc,{});}else{throw new db[(_0x3ee6('0x5a'))][(_0x3ee6('0x55'))](_0x3ee6('0x5b'));}})[_0x3ee6('0x15')](function(){return _0x4664e7['updateAttributes']({'vidaooSessionId':_0x4a0226['id']});})[_0x3ee6('0x15')](respondWithResult(_0x4f401d,null))[_0x3ee6('0x38')](handleError(_0x4f401d,null));};exports[_0x3ee6('0x5c')]=function(_0x164965,_0x2b9291){if(_0x164965[_0x3ee6('0x2c')]['id']){delete _0x164965['body']['id'];}return db[_0x3ee6('0x3d')][_0x3ee6('0x45')]({'where':{'id':_0x164965[_0x3ee6('0x3a')]['id']},'include':[{'model':db[_0x3ee6('0x5d')],'as':'Contact'}]})[_0x3ee6('0x15')](handleEntityNotFound(_0x2b9291,null))['then'](saveUpdates(_0x164965['body'],null))[_0x3ee6('0x15')](respondWithResult(_0x2b9291,null))[_0x3ee6('0x38')](handleError(_0x2b9291,null));};exports[_0x3ee6('0x5e')]=function(_0x396b17,_0x43403a){if(_0x396b17[_0x3ee6('0x2c')]['id']){delete _0x396b17[_0x3ee6('0x2c')]['id'];}return db[_0x3ee6('0x3d')][_0x3ee6('0x45')]({'where':{'id':_0x396b17[_0x3ee6('0x3a')]['id']}})['then'](function(_0x172584){if(!_0x172584){logger[_0x3ee6('0x1c')](_0x3ee6('0x5f'),_0x3ee6('0x5e'),0x194,_0x3ee6('0x60'));_0x43403a[_0x3ee6('0x28')](0x194);}else{if(_0x172584['UserId']){throw new db['Sequelize'][(_0x3ee6('0x55'))](_0x3ee6('0x61'));}}return _0x172584;})[_0x3ee6('0x15')](function(_0x45d66c){if(_0x45d66c){return _0x45d66c[_0x3ee6('0x27')]({'closed':_0x396b17[_0x3ee6('0x2c')][_0x3ee6('0x62')],'disposition':_0x396b17[_0x3ee6('0x2c')][_0x3ee6('0x63')]})['then'](function(_0x26e820){return _0x26e820;});}})['then'](function(){return respondWithRpcPromise(_0x3ee6('0x64'),_0x3ee6('0x5e'),_0x396b17['body'],client9004);})[_0x3ee6('0x15')](respondWithResult(_0x43403a,null))[_0x3ee6('0x38')](handleError(_0x43403a,null));};exports['attachmentUpload']=function(_0x2ca197,_0x566fe9){_0x2ca197[_0x3ee6('0x2c')][_0x3ee6('0x2a')]=_0x2ca197[_0x3ee6('0x65')][_0x3ee6('0x66')];_0x2ca197[_0x3ee6('0x2c')][_0x3ee6('0x67')]=_0x2ca197[_0x3ee6('0x65')][_0x3ee6('0x68')];_0x2ca197[_0x3ee6('0x2c')]['type']=_0x2ca197[_0x3ee6('0x65')]['mimetype'];return db[_0x3ee6('0x69')][_0x3ee6('0x46')](_0x2ca197[_0x3ee6('0x2c')])[_0x3ee6('0x15')](respondWithResult(_0x566fe9,0xc9))[_0x3ee6('0x38')](handleError(_0x566fe9,null));};exports[_0x3ee6('0x6a')]=function(_0x447014,_0x14bf50){return db[_0x3ee6('0x3d')][_0x3ee6('0x4a')]({'where':{'id':_0x447014['params']['id']},'raw':!![]})[_0x3ee6('0x15')](handleEntityNotFound(_0x14bf50,null))[_0x3ee6('0x15')](function(_0xc2b9b5){if(_0xc2b9b5){if(_0xc2b9b5[_0x3ee6('0x62')]){return _0x14bf50['status'](0x193)[_0x3ee6('0x21')]({'status':0x193,'message':'Unauthorized'});}return db[_0x3ee6('0x69')][_0x3ee6('0x4a')]({'where':{'id':_0x447014[_0x3ee6('0x36')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x14bf50,null));}})['then'](function(_0x2b41ae){if(_0x2b41ae){var _0x4db681=_0x2b41ae[_0x3ee6('0x6b')]!==null;var _0x423492=path[_0x3ee6('0x6c')](config['root'],'server/files/attachments/');if(_0x4db681){_0x423492=path['join'](_0x423492,_0x3ee6('0x6d'));}var _0x29ee02=path[_0x3ee6('0x6c')](_0x423492,_0x2b41ae['basename']);return _0x14bf50[_0x3ee6('0x6e')](_0x29ee02);}})['catch'](handleError(_0x14bf50,null));};exports[_0x3ee6('0x6f')]=function(_0x124a34,_0xf667f9){var _0x2f80e7=null;var _0x556d78=null;var _0x4d9b18=null;if(_0x124a34[_0x3ee6('0x2c')]['id']){delete _0x124a34['body']['id'];}if(_0x124a34[_0x3ee6('0x2c')][_0x3ee6('0x70')]){_0x4d9b18=path[_0x3ee6('0x6c')](config[_0x3ee6('0x71')],'server/files/chat/upload/',util[_0x3ee6('0x72')](_0x3ee6('0x73'),Date[_0x3ee6('0x74')]()));_0x124a34[_0x3ee6('0x2c')][_0x3ee6('0x75')]=_0x4d9b18;}return db[_0x3ee6('0x3d')]['find']({'where':{'id':_0x124a34[_0x3ee6('0x3a')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x3ee6('0x76'),'include':[{'model':db[_0x3ee6('0x77')],'as':'User'}]}]})[_0x3ee6('0x15')](handleEntityNotFound(_0xf667f9,null))[_0x3ee6('0x15')](saveUpdates(_0x124a34[_0x3ee6('0x2c')],null))[_0x3ee6('0x15')](function(_0x3a276c){if(_0x3a276c){_0x2f80e7=_0x3a276c;return db[_0x3ee6('0x49')][_0x3ee6('0x45')]({'where':{'id':_0x2f80e7[_0x3ee6('0x4b')]}});}})['then'](function(_0x234556){if(_0x234556){_0x556d78=_0x234556;return db[_0x3ee6('0x5d')][_0x3ee6('0x45')]({'where':{'id':_0x2f80e7['ContactId']}});}})['then'](function(_0x5203bc){if(_0x5203bc){if(_0x4d9b18){var _0x3e79d9=null;for(var _0x4b3369=0x1;_0x4b3369<_0x2f80e7[_0x3ee6('0x76')][_0x3ee6('0x42')];++_0x4b3369){_0x3e79d9=_0x2f80e7[_0x3ee6('0x76')][_0x4b3369];var _0x170088=_0x3e79d9['UserId']?util[_0x3ee6('0x72')]('%s%d',_0x556d78['agentAlias'],_0x3e79d9[_0x3ee6('0x78')]):_0x3ee6('0x79');var _0x20d09a=_0x124a34['body'][_0x3ee6('0x7a')]||util[_0x3ee6('0x72')](_0x3ee6('0x7b'),_0x3ee6('0x7c'),_0x3e79d9['ContactId']);switch(_0x556d78[_0x3ee6('0x7d')]){case'website_alias':_0x170088=_0x3e79d9[_0x3ee6('0x78')]?util[_0x3ee6('0x72')]('%s%d',_0x556d78[_0x3ee6('0x7e')],_0x3e79d9[_0x3ee6('0x78')]):_0x3ee6('0x79');break;case _0x3ee6('0x7f'):_0x170088=_0x3e79d9[_0x3ee6('0x78')]?_0x3e79d9['User']['alias']||_0x3e79d9[_0x3ee6('0x77')][_0x3ee6('0x80')]:_0x3ee6('0x79');break;case _0x3ee6('0x81'):_0x170088=_0x3e79d9['UserId']?_0x3e79d9[_0x3ee6('0x77')]['fullname']:_0x3ee6('0x79');break;default:_0x170088=_0x3e79d9[_0x3ee6('0x78')]?util[_0x3ee6('0x72')](_0x3ee6('0x7b'),_0x556d78['agentAlias'],_0x3e79d9[_0x3ee6('0x78')]):_0x3ee6('0x79');}var _0x3fbafd=util['format'](_0x3ee6('0x82'),moment(_0x3e79d9['createdAt'])[_0x3ee6('0x72')]('MM/DD/YYYY\x20HH:mm:ss'),_0x3e79d9[_0x3ee6('0x83')]==='in'?_0x20d09a:_0x170088,_0x3e79d9[_0x3ee6('0x2c')]);if(!_0x3e79d9['secret']){fs[_0x3ee6('0x84')](_0x4d9b18,_0x3fbafd);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x3ee6('0x85'),'raw':!![],'include':[{'model':db[_0x3ee6('0x86')],'as':_0x3ee6('0x86'),'raw':!![]}]}]});}}})[_0x3ee6('0x15')](function(_0x4be965){if(!_0x4be965||!_0x4be965[_0x3ee6('0x85')]||!_0x124a34[_0x3ee6('0x2c')])return _0x2f80e7;var _0x28086d=_0x4be965[_0x3ee6('0x87')]();return respondWithRpcPromise(_0x3ee6('0x88'),_0x3ee6('0x89'),{'account':_0x28086d,'message':{'from':util['format'](_0x3ee6('0x8a'),_0x4be965[_0x3ee6('0x2a')],_0x4be965[_0x3ee6('0x51')]||_0x4be965['Smtp'][_0x3ee6('0x37')]),'to':_0x124a34[_0x3ee6('0x2c')][_0x3ee6('0x70')],'subject':_0x3ee6('0x8b'),'text':util[_0x3ee6('0x72')](_0x3ee6('0x8c'),_0x124a34[_0x3ee6('0x2c')][_0x3ee6('0x70')]),'attachments':[{'path':_0x4d9b18}]}})[_0x3ee6('0x15')](function(){return _0x2f80e7;})[_0x3ee6('0x38')](function(_0x1134b1){logger[_0x3ee6('0x1c')](_0x1134b1);});})[_0x3ee6('0x15')](respondWithStatusCode(_0xf667f9,0xc8))[_0x3ee6('0x38')](handleError(_0xf667f9,null));};exports[_0x3ee6('0x8d')]=function(_0x4961a4,_0x38772b){return db[_0x3ee6('0x8e')][_0x3ee6('0x45')]({'where':{'id':_0x4961a4[_0x3ee6('0x3a')]['id']}})[_0x3ee6('0x15')](handleEntityNotFound(_0x38772b,null))[_0x3ee6('0x15')](function(_0x255b9d){if(_0x255b9d){return _0x255b9d['addMessage'](_0x4961a4[_0x3ee6('0x2c')]['ids'],_[_0x3ee6('0x8f')](_0x4961a4['body'],[_0x3ee6('0x90'),'id'])||{});}})[_0x3ee6('0x15')](respondWithResult(_0x38772b,null))[_0x3ee6('0x38')](handleError(_0x38772b,null));};exports[_0x3ee6('0x91')]=function(_0x414c3e,_0x1d7fdc){var _0x581178={'raw':![],'where':{}};var _0x841f2b={};var _0x516f95={'count':0x0,'rows':[]};return db[_0x3ee6('0x3d')][_0x3ee6('0x4a')]({'where':{'id':_0x414c3e[_0x3ee6('0x3a')]['id']}})[_0x3ee6('0x15')](handleEntityNotFound(_0x1d7fdc,null))[_0x3ee6('0x15')](function(_0x22ec4e){if(_0x22ec4e){_0x841f2b[_0x3ee6('0x3b')]=_[_0x3ee6('0x3c')](db[_0x3ee6('0x8e')][_0x3ee6('0x32')]);_0x841f2b[_0x3ee6('0x36')]=_['keys'](_0x414c3e[_0x3ee6('0x36')]);_0x841f2b[_0x3ee6('0x3e')]=_[_0x3ee6('0x40')](_0x841f2b[_0x3ee6('0x3b')],_0x841f2b[_0x3ee6('0x36')]);_0x581178[_0x3ee6('0x3f')]=_[_0x3ee6('0x40')](_0x841f2b[_0x3ee6('0x3b')],qs[_0x3ee6('0x41')](_0x414c3e[_0x3ee6('0x36')][_0x3ee6('0x41')]));_0x581178[_0x3ee6('0x3f')]=_0x581178[_0x3ee6('0x3f')][_0x3ee6('0x42')]?_0x581178['attributes']:_0x841f2b[_0x3ee6('0x3b')];if(!_0x414c3e['query'][_0x3ee6('0x92')]('nolimit')){_0x581178[_0x3ee6('0x23')]=qs[_0x3ee6('0x23')](_0x414c3e['query'][_0x3ee6('0x23')]);_0x581178['offset']=qs[_0x3ee6('0x25')](_0x414c3e[_0x3ee6('0x36')]['offset']);}_0x581178[_0x3ee6('0x93')]=qs[_0x3ee6('0x94')](_0x414c3e[_0x3ee6('0x36')][_0x3ee6('0x94')]);_0x581178[_0x3ee6('0x95')]=qs['filters'](_[_0x3ee6('0x96')](_0x414c3e['query'],_0x841f2b[_0x3ee6('0x3e')]));_0x581178[_0x3ee6('0x95')][_0x3ee6('0x97')]=_0x22ec4e['id'];if(_0x414c3e[_0x3ee6('0x36')][_0x3ee6('0x98')]){_0x581178[_0x3ee6('0x95')]=_['merge'](_0x581178[_0x3ee6('0x95')],{'$or':_[_0x3ee6('0x31')](_0x581178['attributes'],function(_0x54fccd){var _0x20c6ca={};_0x20c6ca[_0x54fccd]={'$like':'%'+_0x414c3e[_0x3ee6('0x36')]['filter']+'%'};return _0x20c6ca;})});}if(_0x414c3e[_0x3ee6('0x36')][_0x3ee6('0x99')]){var _0x1cd676=_0x414c3e[_0x3ee6('0x36')][_0x3ee6('0x99')]['split'](',');var _0x347ef6={};_0x347ef6[_0x1cd676[0x0]]={'$gte':moment(_0x1cd676[0x1])[_0x3ee6('0x72')]('YYYY-MM-DD\x20HH:mm:ss')};_0x581178[_0x3ee6('0x95')]=_['merge'](_0x581178[_0x3ee6('0x95')],_0x347ef6);}_0x581178=_[_0x3ee6('0x44')]({},_0x581178,_0x414c3e[_0x3ee6('0x9a')]);return db['ChatMessage'][_0x3ee6('0x24')]({'where':_0x581178[_0x3ee6('0x95')]})[_0x3ee6('0x15')](function(_0x517359){_0x516f95[_0x3ee6('0x24')]=_0x517359;if(_0x414c3e[_0x3ee6('0x36')][_0x3ee6('0x9b')]){_0x581178[_0x3ee6('0x43')]=[{'all':!![]}];}return db[_0x3ee6('0x8e')][_0x3ee6('0x34')](_0x581178);})[_0x3ee6('0x15')](function(_0xd6e7e5){_0x516f95['rows']=_0xd6e7e5;return _0x516f95;});}})[_0x3ee6('0x15')](respondWithFilteredResult(_0x1d7fdc,_0x581178))[_0x3ee6('0x38')](handleError(_0x1d7fdc,null));};exports[_0x3ee6('0x9c')]=function(_0x186c8f,_0x2d5289){var _0x572010={'where':{}},_0x1d8a76={},_0x21f72d={'count':0x0,'rows':[]};return db[_0x3ee6('0x3d')]['findOne']({'where':{'id':_0x186c8f[_0x3ee6('0x3a')]['id']}})[_0x3ee6('0x15')](handleEntityNotFound(_0x2d5289,null))[_0x3ee6('0x15')](function(_0x38ea7a){if(_0x38ea7a){_0x1d8a76['model']=_[_0x3ee6('0x3c')](db[_0x3ee6('0x8e')][_0x3ee6('0x32')]);_0x1d8a76['query']=_[_0x3ee6('0x3c')](_0x186c8f[_0x3ee6('0x36')]);_0x1d8a76[_0x3ee6('0x3e')]=_[_0x3ee6('0x40')](_0x1d8a76[_0x3ee6('0x3b')],_0x1d8a76[_0x3ee6('0x36')]);_0x572010[_0x3ee6('0x3f')]=_[_0x3ee6('0x40')](_0x1d8a76[_0x3ee6('0x3b')],qs[_0x3ee6('0x41')](_0x186c8f[_0x3ee6('0x36')][_0x3ee6('0x41')]));_0x572010['attributes']=_0x572010[_0x3ee6('0x3f')][_0x3ee6('0x42')]?_0x572010['attributes']:_0x1d8a76[_0x3ee6('0x3b')];if(!_0x186c8f[_0x3ee6('0x36')][_0x3ee6('0x92')]('nolimit')){_0x572010['limit']=qs['limit'](_0x186c8f[_0x3ee6('0x36')][_0x3ee6('0x23')]);_0x572010[_0x3ee6('0x25')]=qs[_0x3ee6('0x25')](_0x186c8f[_0x3ee6('0x36')]['offset']);}_0x572010['order']=qs['sort'](_0x186c8f[_0x3ee6('0x36')][_0x3ee6('0x94')]);_0x572010['where']=qs['filters'](_['pick'](_0x186c8f[_0x3ee6('0x36')],_0x1d8a76[_0x3ee6('0x3e')]));_0x572010[_0x3ee6('0x95')][_0x3ee6('0x97')]=_0x38ea7a['id'];if(_0x186c8f['query'][_0x3ee6('0x98')]){_0x572010[_0x3ee6('0x95')]=_[_0x3ee6('0x44')](_0x572010['where'],{'$or':_['map'](_0x572010[_0x3ee6('0x3f')],function(_0x33bcc5){var _0x36a7c7={};_0x36a7c7[_0x33bcc5]={'$like':'%'+_0x186c8f[_0x3ee6('0x36')]['filter']+'%'};return _0x36a7c7;})});}_0x572010[_0x3ee6('0x95')][_0x3ee6('0x9d')]=![];if(_0x186c8f[_0x3ee6('0x36')]['id']){_0x572010['where']['id']={'$gt':_0x186c8f[_0x3ee6('0x36')]['id']};}_0x572010=_['merge']({},_0x572010,_0x186c8f[_0x3ee6('0x9a')]);return db['ChatMessage']['count']({'where':_0x572010[_0x3ee6('0x95')]})[_0x3ee6('0x15')](function(_0x549af6){_0x21f72d['count']=_0x549af6;_0x572010[_0x3ee6('0x43')]=[];if(_0x186c8f[_0x3ee6('0x36')][_0x3ee6('0x9e')]){_0x572010[_0x3ee6('0x43')][_0x3ee6('0x9f')]({'model':db[_0x3ee6('0x77')],'as':'User','attributes':['id',_0x3ee6('0x80'),'alias']});}if(_0x186c8f[_0x3ee6('0x36')][_0x3ee6('0x9b')]){_0x572010['include']=[{'all':!![]}];}return db[_0x3ee6('0x8e')][_0x3ee6('0x34')](_0x572010);})[_0x3ee6('0x15')](function(_0x5b1bd8){_0x21f72d['rows']=_0x5b1bd8;return _0x21f72d;});}})['then'](respondWithFilteredResult(_0x2d5289,_0x572010))['catch'](handleError(_0x2d5289,null));};exports[_0x3ee6('0xa0')]=function(_0x2b684e,_0x33ad20){return db[_0x3ee6('0x3d')][_0x3ee6('0x45')]({'where':{'id':_0x2b684e[_0x3ee6('0x3a')]['id']}})['then'](handleEntityNotFound(_0x33ad20,null))[_0x3ee6('0x15')](function(_0x248628){if(_0x248628){return _0x248628['setTags'](_0x2b684e['body'][_0x3ee6('0x90')],_[_0x3ee6('0x8f')](_0x2b684e[_0x3ee6('0x2c')],[_0x3ee6('0x90'),'id'])||{})[_0x3ee6('0xa1')](function(){return db[_0x3ee6('0xa2')][_0x3ee6('0x34')]({'attributes':['id',_0x3ee6('0x2a'),_0x3ee6('0xa3')],'where':{'id':_0x2b684e[_0x3ee6('0x2c')][_0x3ee6('0x90')]}});})[_0x3ee6('0x15')](function(_0x2fcc2f){socket[_0x3ee6('0xa4')]('chatInteractionTags:save',{'id':Number(_0x2b684e[_0x3ee6('0x3a')]['id']),'tags':_0x2fcc2f||[]});return{'id':Number(_0x2b684e['params']['id']),'tags':_0x2fcc2f||[]};});}})[_0x3ee6('0x15')](respondWithResult(_0x33ad20,null))[_0x3ee6('0x38')](handleError(_0x33ad20,null));};exports['removeTags']=function(_0x4ca419,_0x111037){return db[_0x3ee6('0x3d')][_0x3ee6('0x45')]({'where':{'id':_0x4ca419['params']['id']}})[_0x3ee6('0x15')](handleEntityNotFound(_0x111037,null))['then'](function(_0xdc1f4){if(_0xdc1f4){return _0xdc1f4[_0x3ee6('0xa5')](_0x4ca419[_0x3ee6('0x36')][_0x3ee6('0x90')]);}})[_0x3ee6('0x15')](respondWithStatusCode(_0x111037,null))[_0x3ee6('0x38')](handleError(_0x111037,null));};exports[_0x3ee6('0x6e')]=function(_0x3d8f61,_0x36fef5){var _0x2f61e9=moment()['unix']()['toString']();var _0x1dba75=path[_0x3ee6('0x6c')](config[_0x3ee6('0x71')],'server',_0x3ee6('0xa6'),_0x3ee6('0xa7'));var _0x592041=path[_0x3ee6('0x6c')](config['root'],_0x3ee6('0xa8'),'files',_0x3ee6('0xa9'));var _0x5c067d=path[_0x3ee6('0x6c')](_0x1dba75,_0x2f61e9);var _0x43aa7d=util[_0x3ee6('0x72')](_0x3ee6('0xaa'),_0x3d8f61['params']['id'],_0x2f61e9);var _0x3e0609=path['join'](_0x1dba75,_0x43aa7d);var _0x336530=[];_0x336530[_0x3ee6('0x9f')]({'model':db['User'],'as':_0x3ee6('0x77'),'attributes':['id',_0x3ee6('0x80')],'raw':!![]});_0x336530['push']({'model':db['CmContact'],'as':_0x3ee6('0xab'),'attributes':['id',_0x3ee6('0xac'),_0x3ee6('0xad')],'raw':!![]});if(_0x3d8f61[_0x3ee6('0x36')][_0x3ee6('0xa9')]){_0x336530[_0x3ee6('0x9f')]({'model':db['Attachment'],'as':_0x3ee6('0x69'),'raw':!![]});}var _0x5f4fdb=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x3ee6('0x2c'),_0x3ee6('0xae'),_0x3ee6('0x83'),_0x3ee6('0x9d'),_0x3ee6('0xaf')],'include':_0x336530}];_0x5f4fdb[_0x3ee6('0x9f')]({'model':db['ChatWebsite'],'as':_0x3ee6('0xb0'),'attributes':['id',_0x3ee6('0x2a')]});_0x5f4fdb['push']({'model':db[_0x3ee6('0x77')],'as':_0x3ee6('0xb1'),'attributes':['id',_0x3ee6('0x80')]});return db[_0x3ee6('0x3d')][_0x3ee6('0x45')]({'where':{'id':_0x3d8f61['params']['id']},'include':_0x5f4fdb})['then'](handleEntityNotFound(_0x36fef5,null))['then'](function(_0x2a1d36){if(_0x2a1d36){var _0x1d8ead=_0x2a1d36[_0x3ee6('0xb2')]({'plain':!![]});fs[_0x3ee6('0xb3')](_0x5c067d);var _0x49b410={'channel':_0x3ee6('0xb4'),'account':_0x1d8ead[_0x3ee6('0xb0')][_0x3ee6('0x2a')],'agent':_0x1d8ead['Owner']?_0x1d8ead['Owner'][_0x3ee6('0x80')]:_0x3ee6('0xb5'),'createdAt':moment(_0x1d8ead['createdAt'])[_0x3ee6('0x72')](_0x3ee6('0xb6'))['toString'](),'closedAt':_0x1d8ead[_0x3ee6('0x62')]?moment(_0x1d8ead[_0x3ee6('0xb7')])[_0x3ee6('0x72')](_0x3ee6('0xb6'))['toString']():'','disposition':_0x1d8ead[_0x3ee6('0x63')],'chatInfo':{'browser':_0x1d8ead[_0x3ee6('0xb8')],'os':_0x1d8ead['osName'],'referer':_0x1d8ead[_0x3ee6('0xb9')],'customerIp':_0x1d8ead[_0x3ee6('0xba')],'customerPort':_0x1d8ead[_0x3ee6('0xbb')]?_0x1d8ead['customerPort']:_0x3ee6('0xb5')},'messages':_(_0x1d8ead[_0x3ee6('0x76')])[_0x3ee6('0xbc')]()[_0x3ee6('0x98')]({'secret':![]})[_0x3ee6('0x31')](function(_0x150201){if(_0x150201[_0x3ee6('0x69')]){var _0x38b379=path[_0x3ee6('0x6c')](_0x592041,_0x150201['Attachment'][_0x3ee6('0x67')]);if(fs['existsSync'](_0x38b379)){fs[_0x3ee6('0xbd')](_0x38b379)[_0x3ee6('0xbe')](fs[_0x3ee6('0xbf')](path['join'](_0x5c067d,_0x150201['Attachment'][_0x3ee6('0x67')])));}}return{'date':moment(_0x150201[_0x3ee6('0xae')])[_0x3ee6('0x72')](_0x3ee6('0xb6'))[_0x3ee6('0xc0')](),'sender':_0x150201[_0x3ee6('0x83')]===_0x3ee6('0x59')?_0x150201[_0x3ee6('0x77')]?_0x150201[_0x3ee6('0x77')]['fullname']:'System':_0x150201[_0x3ee6('0xab')][_0x3ee6('0xac')]+(_0x150201[_0x3ee6('0xab')][_0x3ee6('0xad')]?'\x20'+_0x150201['Contact'][_0x3ee6('0xad')]:''),'body':_0x150201['Attachment']?_0x150201[_0x3ee6('0x69')][_0x3ee6('0x67')]:_0x150201[_0x3ee6('0x2c')],'direction':_0x150201[_0x3ee6('0x83')]===_0x3ee6('0x59')?'A':'C','secret':_0x150201[_0x3ee6('0x9d')],'read':_0x150201['read'],'attachment':_0x150201[_0x3ee6('0x69')]};})[_0x3ee6('0xc1')]()};return ejs[_0x3ee6('0xc2')](path[_0x3ee6('0x6c')](config[_0x3ee6('0x71')],'server',_0x3ee6('0xc3'),_0x3ee6('0xc4')),{'interaction':_0x49b410})[_0x3ee6('0x15')](function(_0x4677e6){var _0x463cb5=path['join'](_0x5c067d,_0x3ee6('0xc5')+_0x1d8ead['id']+'-'+_0x2f61e9+_0x3ee6('0xc6'));var _0x5754b6={'path':_0x463cb5,'channel':_0x3ee6('0xb4'),'interactionId':_0x1d8ead['id']};return pdf['createPdfFromHTML'](_0x4677e6,_0x5754b6);})[_0x3ee6('0x15')](function(){return new Promise(function(_0x724e27,_0x409dee){zipdir(_0x5c067d,{'saveTo':_0x3e0609},function(_0x1da157,_0x11a8dc){if(_0x1da157)return _0x409dee(_0x1da157);return _0x724e27(_0x11a8dc);});})[_0x3ee6('0x15')](function(){return new BPromise(function(_0x7158a9,_0x538d18){rimraf(_0x5c067d,function(_0x3b7de9){if(_0x3b7de9)_0x538d18(_0x3b7de9);return _0x7158a9();});});})[_0x3ee6('0x15')](function(){return _0x36fef5[_0x3ee6('0x6e')](_0x3e0609,_0x43aa7d,function(_0x4dc37d){if(_0x4dc37d){logger['error'](_0x3ee6('0xc7'),_0x4dc37d);}else{fs[_0x3ee6('0xc8')](_0x3e0609);}});});});}else{return _0x36fef5[_0x3ee6('0x28')](0xc8);}})[_0x3ee6('0x38')](handleError(_0x36fef5,null));}; \ No newline at end of file +var _0x0143=['root','server/files/attachments/','join','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','ChatMessage','User','ChatWebsite','ContactId','Messages','format','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','keys','hasOwnProperty','nolimit','order','sort','filters','pick','where','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','getMyMessages','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','toString','server','tmp','files','attachments','transcript-%d-%s.zip','push','Contact','firstName','lastName','createdAt','direction','read','Account','Owner','get','Chat','closedAt','browserName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','render','merge','body','contact','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','getOptions','findAll','chat','query','show','params','intersection','model','fields','attributes','length','include','create','find','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooApiKey','user','fullname','https://api-vidaoo.xcally.com/api/v1/meetings','email','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','basename','type','mimetype','closed','Unauthorized','Attachment','ChatOfflineMessageId'];(function(_0x589847,_0x15affb){var _0x5d16d2=function(_0x45d885){while(--_0x45d885){_0x589847['push'](_0x589847['shift']());}};_0x5d16d2(++_0x15affb);}(_0x0143,0x134));var _0x3014=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0143[_0x397e5f];return _0x5302b8;};'use strict';var rimraf=require(_0x3014('0x0'));var zipdir=require(_0x3014('0x1'));var rp=require(_0x3014('0x2'));var moment=require(_0x3014('0x3'));var BPromise=require(_0x3014('0x4'));var Mustache=require(_0x3014('0x5'));var util=require(_0x3014('0x6'));var path=require(_0x3014('0x7'));var ejs=require(_0x3014('0x8'));var fs=require('fs');var _=require(_0x3014('0x9'));var Redis=require(_0x3014('0xa'));var interaction=require(_0x3014('0xb'));var qs=require(_0x3014('0xc'));var pdf=require(_0x3014('0xd'));var logger=require(_0x3014('0xe'))(_0x3014('0xf'));var config=require(_0x3014('0x10'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x3014('0x11')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3014('0x12'))[_0x3014('0x13')](socket);var jayson=require(_0x3014('0x14'));var client=jayson[_0x3014('0x15')][_0x3014('0x16')]({'port':0x232b});var client9004=jayson[_0x3014('0x15')][_0x3014('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x325b04,_0x14857c,_0x5ad278,_0x2e0ed2){return new BPromise(function(_0x28285c,_0x4a3bd7){var _0x559ff0=_0x2e0ed2||client;return _0x559ff0[_0x3014('0x17')](_0x325b04,_0x5ad278)[_0x3014('0x18')](function(_0x76dd1f){logger[_0x3014('0x19')](_0x3014('0x1a'),_0x14857c,_0x3014('0x1b'));logger[_0x3014('0x1c')](_0x3014('0x1d'),_0x14857c,_0x3014('0x1b'),JSON['stringify'](_0x76dd1f));if(_0x76dd1f[_0x3014('0x1e')]){if(_0x76dd1f[_0x3014('0x1e')][_0x3014('0x1f')]===0x1f4){logger[_0x3014('0x1e')](_0x3014('0x1a'),_0x14857c,_0x76dd1f[_0x3014('0x1e')]['message']);return _0x4a3bd7(_0x76dd1f[_0x3014('0x1e')]['message']);}logger[_0x3014('0x1e')](_0x3014('0x1a'),_0x14857c,_0x76dd1f[_0x3014('0x1e')][_0x3014('0x20')]);return _0x28285c(_0x76dd1f[_0x3014('0x1e')][_0x3014('0x20')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x14857c,'request\x20sent');_0x28285c(_0x76dd1f[_0x3014('0x21')][_0x3014('0x20')]);}})[_0x3014('0x22')](function(_0x8442bd){logger[_0x3014('0x1e')](_0x3014('0x1a'),_0x14857c,_0x8442bd);_0x4a3bd7(_0x8442bd);});});}function respondWithStatusCode(_0x19eabb,_0x4d5307){_0x4d5307=_0x4d5307||0xcc;return function(_0x111491){if(_0x111491){return _0x19eabb['sendStatus'](_0x4d5307);}return _0x19eabb[_0x3014('0x23')](_0x4d5307)[_0x3014('0x24')]();};}function respondWithResult(_0x52918b,_0x34424c){_0x34424c=_0x34424c||0xc8;return function(_0x57d145){if(_0x57d145){return _0x52918b['status'](_0x34424c)[_0x3014('0x25')](_0x57d145);}};}function respondWithFilteredResult(_0x47d590,_0x121923){return function(_0x30fd28){if(_0x30fd28){var _0xda4ff3=typeof _0x121923[_0x3014('0x26')]==='undefined'&&typeof _0x121923[_0x3014('0x27')]===_0x3014('0x28');var _0x1aa067=_0x30fd28[_0x3014('0x29')];var _0x32a367=_0xda4ff3?0x0:_0x121923['offset'];var _0x340699=_0xda4ff3?_0x30fd28[_0x3014('0x29')]:_0x121923[_0x3014('0x26')]+_0x121923[_0x3014('0x27')];var _0x3261f6;if(_0x340699>=_0x1aa067){_0x340699=_0x1aa067;_0x3261f6=0xc8;}else{_0x3261f6=0xce;}_0x47d590[_0x3014('0x23')](_0x3261f6);return _0x47d590[_0x3014('0x2a')](_0x3014('0x2b'),_0x32a367+'-'+_0x340699+'/'+_0x1aa067)[_0x3014('0x25')](_0x30fd28);}return null;};}function saveUpdates(_0x18eecd){return function(_0x51f298){if(_0x51f298){return _0x51f298[_0x3014('0x2c')](_0x18eecd)[_0x3014('0x18')](function(_0x13b9db){return _0x13b9db;});}return null;};}function removeEntity(_0x4a197f){return function(_0x32bc35){if(_0x32bc35){return _0x32bc35[_0x3014('0x2d')]()['then'](function(){_0x4a197f[_0x3014('0x23')](0xcc)[_0x3014('0x24')]();});}};}function handleEntityNotFound(_0x617c92){return function(_0x55afa0){if(!_0x55afa0){_0x617c92[_0x3014('0x2e')](0x194);}return _0x55afa0;};}function handleError(_0x4be132,_0x50c69a){_0x50c69a=_0x50c69a||0x1f4;return function(_0x5501cd){logger[_0x3014('0x1e')](_0x5501cd[_0x3014('0x2f')]);if(_0x5501cd[_0x3014('0x30')]){delete _0x5501cd[_0x3014('0x30')];}_0x4be132[_0x3014('0x23')](_0x50c69a)[_0x3014('0x31')](_0x5501cd);};}function getMustacheRender(_0x23fe90,_0x37e0a7){return Mustache[_0x3014('0x32')](_0x23fe90,_[_0x3014('0x33')](_0x37e0a7[_0x3014('0x34')],{'contact':_0x37e0a7[_0x3014('0x35')],'message':_0x37e0a7[_0x3014('0x20')],'agent':_0x37e0a7['agent'],'interaction':_0x37e0a7[_0x3014('0x36')],'account':_0x37e0a7[_0x3014('0x37')]}))||'';}exports[_0x3014('0x38')]=function(_0x2c63e8,_0x47932f){var _0x3f600e={};var _0x5137b5=_[_0x3014('0x39')](db[_0x3014('0x3a')][_0x3014('0x3b')],function(_0x1523c8){return{'name':_0x1523c8[_0x3014('0x3c')],'type':_0x1523c8['type']['key']};});_0x3f600e=qs[_0x3014('0x3d')](_0x5137b5,_0x2c63e8);return interaction[_0x3014('0x3e')](_0x3014('0x3f'),_0x2c63e8[_0x3014('0x40')],_0x2c63e8['user'],_0x3f600e,_0x5137b5)[_0x3014('0x18')](respondWithFilteredResult(_0x47932f,_0x3f600e))['catch'](handleError(_0x47932f,null));};exports[_0x3014('0x41')]=function(_0x54e49c,_0x35cd0f){var _0x125f02={'raw':![],'where':{'id':_0x54e49c[_0x3014('0x42')]['id']}},_0x460f16={};_0x460f16['model']=_['keys'](db['ChatInteraction'][_0x3014('0x3b')]);_0x460f16[_0x3014('0x40')]=_['keys'](_0x54e49c['query']);_0x460f16['filters']=_[_0x3014('0x43')](_0x460f16[_0x3014('0x44')],_0x460f16[_0x3014('0x40')]);_0x125f02['attributes']=_[_0x3014('0x43')](_0x460f16[_0x3014('0x44')],qs[_0x3014('0x45')](_0x54e49c[_0x3014('0x40')][_0x3014('0x45')]));_0x125f02['attributes']=_0x125f02[_0x3014('0x46')][_0x3014('0x47')]?_0x125f02[_0x3014('0x46')]:_0x460f16[_0x3014('0x44')];if(_0x54e49c[_0x3014('0x40')]['includeAll']){_0x125f02[_0x3014('0x48')]=[{'all':!![]}];}_0x125f02=_[_0x3014('0x33')]({},_0x125f02,_0x54e49c['options']);return db[_0x3014('0x3a')]['find'](_0x125f02)['then'](handleEntityNotFound(_0x35cd0f,null))[_0x3014('0x18')](respondWithResult(_0x35cd0f,null))[_0x3014('0x22')](handleError(_0x35cd0f,null));};exports[_0x3014('0x49')]=function(_0x24779b,_0x481cee){return db[_0x3014('0x3a')][_0x3014('0x49')](_0x24779b[_0x3014('0x34')],{})[_0x3014('0x18')](respondWithResult(_0x481cee,0xc9))['catch'](handleError(_0x481cee,null));};exports[_0x3014('0x2c')]=function(_0x1e9c09,_0x12fa8f){if(_0x1e9c09[_0x3014('0x34')]['id']){delete _0x1e9c09[_0x3014('0x34')]['id'];}return db[_0x3014('0x3a')][_0x3014('0x4a')]({'where':{'id':_0x1e9c09['params']['id']}})[_0x3014('0x18')](handleEntityNotFound(_0x12fa8f,null))['then'](saveUpdates(_0x1e9c09[_0x3014('0x34')],null))[_0x3014('0x18')](respondWithResult(_0x12fa8f,null))[_0x3014('0x22')](handleError(_0x12fa8f,null));};exports['destroy']=function(_0x174566,_0x16df8f){return db['ChatInteraction'][_0x3014('0x4a')]({'where':{'id':_0x174566[_0x3014('0x42')]['id']}})[_0x3014('0x18')](handleEntityNotFound(_0x16df8f,null))['then'](removeEntity(_0x16df8f,null))[_0x3014('0x22')](handleError(_0x16df8f,null));};exports[_0x3014('0x4b')]=function(_0x58c9d3,_0x209edd){return db[_0x3014('0x3a')]['describe']()['then'](respondWithResult(_0x209edd,null))[_0x3014('0x22')](handleError(_0x209edd,null));};exports[_0x3014('0x4c')]=function(_0x3677ab,_0x257e61){var _0x333447=_0x3677ab[_0x3014('0x42')]['id'];var _0x16f529;var _0x306f0e;var _0x2146a0;return db[_0x3014('0x3a')][_0x3014('0x4d')]({'where':{'id':_0x333447}})['then'](function(_0xda2bc0){_0x16f529=_0xda2bc0;return db['ChatWebsite'][_0x3014('0x4d')]({'where':{'id':_0xda2bc0[_0x3014('0x4e')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x3014('0x4f'),_0x3014('0x50'),'vidaooMetadata'],'raw':!![]});})[_0x3014('0x18')](function(_0x3232e4){if(_0x3232e4&&_0x3232e4[_0x3014('0x51')]&&_0x3232e4['vidaooEscalation']){_0x306f0e=_0x3232e4;var _0x67ccb={'interaction':{'id':_0x333447},'agent':{'id':_0x3677ab[_0x3014('0x52')]['id'],'name':_0x3677ab[_0x3014('0x52')]['name'],'fullname':_0x3677ab[_0x3014('0x52')][_0x3014('0x53')],'email':_0x3677ab[_0x3014('0x52')]['email']},'contact':_0x3677ab[_0x3014('0x34')][_0x3014('0x35')],'account':_0x3677ab[_0x3014('0x34')]['account']};var _0x1e23c3={'rejectUnauthorized':![],'method':'POST','url':_0x3014('0x54'),'headers':{'X-APIKEY':_0x3232e4[_0x3014('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3677ab[_0x3014('0x52')][_0x3014('0x55')]],'buttons':null,'topic':_0x306f0e[_0x3014('0x4f')],'note':_['isNull'](_0x306f0e[_0x3014('0x50')])?null:getMustacheRender(_0x306f0e[_0x3014('0x50')],_0x67ccb),'metadata':null},'redirect':_0x3014('0x56'),'json':!![]};try{if(!_['isNull'](_0x306f0e[_0x3014('0x57')])){var _0x491edc=getMustacheRender(_0x306f0e[_0x3014('0x57')],_0x67ccb);var _0x28b0f9=JSON[_0x3014('0x58')](_0x491edc);_0x1e23c3[_0x3014('0x34')][_0x3014('0x59')]=_0x28b0f9;}}catch(_0xbecd03){throw new db[(_0x3014('0x5a'))][(_0x3014('0x5b'))](_0x3014('0x5c'));}return rp(_0x1e23c3);}else{throw new db[(_0x3014('0x5a'))][(_0x3014('0x5b'))](_0x3014('0x5d'));}})['then'](function(_0x3f71ac){_0x2146a0=_0x3f71ac;if(_0x2146a0['id']){var _0x3843ea={'body':_0x2146a0[_0x3014('0x5e')],'ChatWebsiteId':_0x306f0e['id'],'ChatInteractionId':_0x16f529['id'],'direction':_0x3014('0x5f'),'UserId':_0x3677ab[_0x3014('0x52')]['id']};return db['ChatMessage'][_0x3014('0x49')](_0x3843ea,{});}else{throw new db['Sequelize'][(_0x3014('0x5b'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x3014('0x18')](function(){return _0x16f529[_0x3014('0x60')]({'vidaooSessionId':_0x2146a0['id']});})[_0x3014('0x18')](respondWithResult(_0x257e61,null))[_0x3014('0x22')](handleError(_0x257e61,null));};exports['customUpdate']=function(_0x2d0da9,_0x5b4d93){if(_0x2d0da9[_0x3014('0x34')]['id']){delete _0x2d0da9['body']['id'];}return db[_0x3014('0x3a')]['find']({'where':{'id':_0x2d0da9[_0x3014('0x42')]['id']},'include':[{'model':db[_0x3014('0x61')],'as':'Contact'}]})[_0x3014('0x18')](handleEntityNotFound(_0x5b4d93,null))[_0x3014('0x18')](saveUpdates(_0x2d0da9['body'],null))['then'](respondWithResult(_0x5b4d93,null))[_0x3014('0x22')](handleError(_0x5b4d93,null));};exports[_0x3014('0x62')]=function(_0x4ba818,_0x3b42d7){if(_0x4ba818[_0x3014('0x34')]['id']){delete _0x4ba818[_0x3014('0x34')]['id'];}return db[_0x3014('0x3a')][_0x3014('0x4a')]({'where':{'id':_0x4ba818[_0x3014('0x42')]['id']}})[_0x3014('0x18')](function(_0x5f157a){if(!_0x5f157a){logger['error'](_0x3014('0x63'),'abandon',0x194,_0x3014('0x64'));_0x3b42d7['sendStatus'](0x194);}else{if(_0x5f157a[_0x3014('0x65')]){throw new db['Sequelize'][(_0x3014('0x5b'))](_0x3014('0x66'));}}return _0x5f157a;})[_0x3014('0x18')](function(_0x1dee63){if(_0x1dee63){return _0x1dee63[_0x3014('0x2c')]({'closed':_0x4ba818[_0x3014('0x34')]['closed'],'disposition':_0x4ba818[_0x3014('0x34')][_0x3014('0x67')]})[_0x3014('0x18')](function(_0x3873d1){return _0x3873d1;});}})[_0x3014('0x18')](function(){return respondWithRpcPromise(_0x3014('0x68'),_0x3014('0x62'),_0x4ba818['body'],client9004);})[_0x3014('0x18')](respondWithResult(_0x3b42d7,null))['catch'](handleError(_0x3b42d7,null));};exports[_0x3014('0x69')]=function(_0xdd5d9b,_0x458325){_0xdd5d9b[_0x3014('0x34')][_0x3014('0x30')]=_0xdd5d9b[_0x3014('0x6a')]['originalname'];_0xdd5d9b[_0x3014('0x34')][_0x3014('0x6b')]=_0xdd5d9b[_0x3014('0x6a')]['filename'];_0xdd5d9b[_0x3014('0x34')][_0x3014('0x6c')]=_0xdd5d9b[_0x3014('0x6a')][_0x3014('0x6d')];return db['Attachment'][_0x3014('0x49')](_0xdd5d9b[_0x3014('0x34')])[_0x3014('0x18')](respondWithResult(_0x458325,0xc9))['catch'](handleError(_0x458325,null));};exports['attachmentDownload']=function(_0x47a6a3,_0x1e3f79){return db['ChatInteraction'][_0x3014('0x4d')]({'where':{'id':_0x47a6a3[_0x3014('0x42')]['id']},'raw':!![]})[_0x3014('0x18')](handleEntityNotFound(_0x1e3f79,null))['then'](function(_0xff8e85){if(_0xff8e85){if(_0xff8e85[_0x3014('0x6e')]){return _0x1e3f79[_0x3014('0x23')](0x193)['json']({'status':0x193,'message':_0x3014('0x6f')});}return db[_0x3014('0x70')][_0x3014('0x4d')]({'where':{'id':_0x47a6a3[_0x3014('0x40')]['attachId']},'raw':!![]})[_0x3014('0x18')](handleEntityNotFound(_0x1e3f79,null));}})[_0x3014('0x18')](function(_0x5a7ec7){if(_0x5a7ec7){var _0x2816d8=_0x5a7ec7[_0x3014('0x71')]!==null;var _0x1261df=path['join'](config[_0x3014('0x72')],_0x3014('0x73'));if(_0x2816d8){_0x1261df=path[_0x3014('0x74')](_0x1261df,'offline-chat/');}var _0x130b77=path[_0x3014('0x74')](_0x1261df,_0x5a7ec7[_0x3014('0x6b')]);return _0x1e3f79['download'](_0x130b77);}})[_0x3014('0x22')](handleError(_0x1e3f79,null));};exports['close']=function(_0x216a37,_0x7f5680){var _0x1e9b4f=null;var _0x45c34c=null;var _0x13fd84=null;if(_0x216a37[_0x3014('0x34')]['id']){delete _0x216a37[_0x3014('0x34')]['id'];}if(_0x216a37[_0x3014('0x34')][_0x3014('0x75')]){_0x13fd84=path['join'](config[_0x3014('0x72')],_0x3014('0x76'),util['format'](_0x3014('0x77'),Date['now']()));_0x216a37[_0x3014('0x34')][_0x3014('0x78')]=_0x13fd84;}return db[_0x3014('0x3a')]['find']({'where':{'id':_0x216a37[_0x3014('0x42')]['id']},'include':[{'model':db[_0x3014('0x79')],'as':'Messages','include':[{'model':db[_0x3014('0x7a')],'as':_0x3014('0x7a')}]}]})[_0x3014('0x18')](handleEntityNotFound(_0x7f5680,null))[_0x3014('0x18')](saveUpdates(_0x216a37[_0x3014('0x34')],null))[_0x3014('0x18')](function(_0x52e234){if(_0x52e234){_0x1e9b4f=_0x52e234;return db[_0x3014('0x7b')][_0x3014('0x4a')]({'where':{'id':_0x1e9b4f[_0x3014('0x4e')]}});}})['then'](function(_0x312735){if(_0x312735){_0x45c34c=_0x312735;return db[_0x3014('0x61')][_0x3014('0x4a')]({'where':{'id':_0x1e9b4f[_0x3014('0x7c')]}});}})[_0x3014('0x18')](function(_0x103d85){if(_0x103d85){if(_0x13fd84){var _0x3af5c6=null;for(var _0x45732e=0x1;_0x45732e<_0x1e9b4f[_0x3014('0x7d')][_0x3014('0x47')];++_0x45732e){_0x3af5c6=_0x1e9b4f[_0x3014('0x7d')][_0x45732e];var _0x5f3374=_0x3af5c6['UserId']?util[_0x3014('0x7e')](_0x3014('0x7f'),_0x45c34c[_0x3014('0x80')],_0x3af5c6[_0x3014('0x65')]):_0x3014('0x81');var _0x595366=_0x216a37['body'][_0x3014('0x82')]||util[_0x3014('0x7e')]('%s%d',_0x3014('0x83'),_0x3af5c6['ContactId']);switch(_0x45c34c['agentIdentifier']){case _0x3014('0x84'):_0x5f3374=_0x3af5c6[_0x3014('0x65')]?util[_0x3014('0x7e')](_0x3014('0x7f'),_0x45c34c['agentAlias'],_0x3af5c6[_0x3014('0x65')]):_0x3014('0x81');break;case _0x3014('0x85'):_0x5f3374=_0x3af5c6[_0x3014('0x65')]?_0x3af5c6[_0x3014('0x7a')][_0x3014('0x86')]||_0x3af5c6['User'][_0x3014('0x53')]:_0x3014('0x81');break;case _0x3014('0x87'):_0x5f3374=_0x3af5c6[_0x3014('0x65')]?_0x3af5c6['User'][_0x3014('0x53')]:_0x3014('0x81');break;default:_0x5f3374=_0x3af5c6[_0x3014('0x65')]?util[_0x3014('0x7e')]('%s%d',_0x45c34c['agentAlias'],_0x3af5c6[_0x3014('0x65')]):_0x3014('0x81');}var _0x220e58=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x3af5c6['createdAt'])[_0x3014('0x7e')](_0x3014('0x88')),_0x3af5c6['direction']==='in'?_0x595366:_0x5f3374,_0x3af5c6[_0x3014('0x34')]);if(!_0x3af5c6[_0x3014('0x89')]){fs[_0x3014('0x8a')](_0x13fd84,_0x220e58);}}return db[_0x3014('0x8b')][_0x3014('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x3014('0x8c')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x3014('0x8d')],'as':_0x3014('0x8d'),'raw':!![]}]}]});}}})['then'](function(_0x2ee431){if(!_0x2ee431||!_0x2ee431[_0x3014('0x8e')]||!_0x216a37[_0x3014('0x34')])return _0x1e9b4f;var _0x5681da=_0x2ee431['getSmtpOptions']();return respondWithRpcPromise(_0x3014('0x8f'),_0x3014('0x90'),{'account':_0x5681da,'message':{'from':util['format'](_0x3014('0x91'),_0x2ee431[_0x3014('0x30')],_0x2ee431[_0x3014('0x55')]||_0x2ee431['Smtp']['user']),'to':_0x216a37[_0x3014('0x34')][_0x3014('0x75')],'subject':'Mail\x20Transcript','text':util[_0x3014('0x7e')](_0x3014('0x92'),_0x216a37[_0x3014('0x34')][_0x3014('0x75')]),'attachments':[{'path':_0x13fd84}]}})['then'](function(){return _0x1e9b4f;})[_0x3014('0x22')](function(_0x3f02f4){logger[_0x3014('0x1e')](_0x3f02f4);});})['then'](respondWithStatusCode(_0x7f5680,0xc8))['catch'](handleError(_0x7f5680,null));};exports[_0x3014('0x93')]=function(_0x3a678b,_0x2f9faf){return db['ChatMessage'][_0x3014('0x4a')]({'where':{'id':_0x3a678b['params']['id']}})[_0x3014('0x18')](handleEntityNotFound(_0x2f9faf,null))['then'](function(_0x43331e){if(_0x43331e){return _0x43331e[_0x3014('0x93')](_0x3a678b[_0x3014('0x34')][_0x3014('0x94')],_[_0x3014('0x95')](_0x3a678b[_0x3014('0x34')],[_0x3014('0x94'),'id'])||{});}})[_0x3014('0x18')](respondWithResult(_0x2f9faf,null))[_0x3014('0x22')](handleError(_0x2f9faf,null));};exports[_0x3014('0x96')]=function(_0x420ceb,_0xe55de0){var _0x407390={'raw':![],'where':{}};var _0x515aaa={};var _0x11f792={'count':0x0,'rows':[]};return db[_0x3014('0x3a')]['findOne']({'where':{'id':_0x420ceb['params']['id']}})[_0x3014('0x18')](handleEntityNotFound(_0xe55de0,null))[_0x3014('0x18')](function(_0x27dab4){if(_0x27dab4){_0x515aaa[_0x3014('0x44')]=_[_0x3014('0x97')](db['ChatMessage'][_0x3014('0x3b')]);_0x515aaa['query']=_['keys'](_0x420ceb[_0x3014('0x40')]);_0x515aaa['filters']=_['intersection'](_0x515aaa[_0x3014('0x44')],_0x515aaa[_0x3014('0x40')]);_0x407390[_0x3014('0x46')]=_['intersection'](_0x515aaa[_0x3014('0x44')],qs[_0x3014('0x45')](_0x420ceb[_0x3014('0x40')][_0x3014('0x45')]));_0x407390['attributes']=_0x407390[_0x3014('0x46')][_0x3014('0x47')]?_0x407390['attributes']:_0x515aaa[_0x3014('0x44')];if(!_0x420ceb[_0x3014('0x40')][_0x3014('0x98')](_0x3014('0x99'))){_0x407390[_0x3014('0x27')]=qs[_0x3014('0x27')](_0x420ceb[_0x3014('0x40')][_0x3014('0x27')]);_0x407390[_0x3014('0x26')]=qs[_0x3014('0x26')](_0x420ceb[_0x3014('0x40')][_0x3014('0x26')]);}_0x407390[_0x3014('0x9a')]=qs[_0x3014('0x9b')](_0x420ceb[_0x3014('0x40')]['sort']);_0x407390['where']=qs[_0x3014('0x9c')](_[_0x3014('0x9d')](_0x420ceb[_0x3014('0x40')],_0x515aaa[_0x3014('0x9c')]));_0x407390[_0x3014('0x9e')][_0x3014('0x9f')]=_0x27dab4['id'];if(_0x420ceb[_0x3014('0x40')][_0x3014('0xa0')]){_0x407390[_0x3014('0x9e')]=_[_0x3014('0x33')](_0x407390[_0x3014('0x9e')],{'$or':_[_0x3014('0x39')](_0x407390[_0x3014('0x46')],function(_0x7f368f){var _0x130197={};_0x130197[_0x7f368f]={'$like':'%'+_0x420ceb[_0x3014('0x40')]['filter']+'%'};return _0x130197;})});}if(_0x420ceb['query'][_0x3014('0xa1')]){var _0x8edcac=_0x420ceb[_0x3014('0x40')][_0x3014('0xa1')]['split'](',');var _0x5a09f6={};_0x5a09f6[_0x8edcac[0x0]]={'$gte':moment(_0x8edcac[0x1])['format'](_0x3014('0xa2'))};_0x407390[_0x3014('0x9e')]=_[_0x3014('0x33')](_0x407390['where'],_0x5a09f6);}_0x407390=_['merge']({},_0x407390,_0x420ceb[_0x3014('0xa3')]);return db[_0x3014('0x79')]['count']({'where':_0x407390[_0x3014('0x9e')]})[_0x3014('0x18')](function(_0x1931eb){_0x11f792[_0x3014('0x29')]=_0x1931eb;if(_0x420ceb['query'][_0x3014('0xa4')]){_0x407390[_0x3014('0x48')]=[{'all':!![]}];}return db[_0x3014('0x79')]['findAll'](_0x407390);})[_0x3014('0x18')](function(_0x4bfa81){_0x11f792[_0x3014('0xa5')]=_0x4bfa81;return _0x11f792;});}})['then'](respondWithFilteredResult(_0xe55de0,_0x407390))[_0x3014('0x22')](handleError(_0xe55de0,null));};exports[_0x3014('0xa6')]=function(_0x25ecfa,_0x3bbe49){var _0x1b2f5b={'where':{}},_0x4d7156={},_0x9d97a7={'count':0x0,'rows':[]};return db[_0x3014('0x3a')][_0x3014('0x4d')]({'where':{'id':_0x25ecfa[_0x3014('0x42')]['id']}})[_0x3014('0x18')](handleEntityNotFound(_0x3bbe49,null))['then'](function(_0x5c06ea){if(_0x5c06ea){_0x4d7156[_0x3014('0x44')]=_['keys'](db[_0x3014('0x79')][_0x3014('0x3b')]);_0x4d7156['query']=_[_0x3014('0x97')](_0x25ecfa[_0x3014('0x40')]);_0x4d7156['filters']=_[_0x3014('0x43')](_0x4d7156['model'],_0x4d7156[_0x3014('0x40')]);_0x1b2f5b[_0x3014('0x46')]=_['intersection'](_0x4d7156[_0x3014('0x44')],qs['fields'](_0x25ecfa[_0x3014('0x40')][_0x3014('0x45')]));_0x1b2f5b['attributes']=_0x1b2f5b[_0x3014('0x46')][_0x3014('0x47')]?_0x1b2f5b['attributes']:_0x4d7156['model'];if(!_0x25ecfa[_0x3014('0x40')][_0x3014('0x98')](_0x3014('0x99'))){_0x1b2f5b[_0x3014('0x27')]=qs[_0x3014('0x27')](_0x25ecfa[_0x3014('0x40')][_0x3014('0x27')]);_0x1b2f5b['offset']=qs[_0x3014('0x26')](_0x25ecfa[_0x3014('0x40')][_0x3014('0x26')]);}_0x1b2f5b[_0x3014('0x9a')]=qs[_0x3014('0x9b')](_0x25ecfa[_0x3014('0x40')]['sort']);_0x1b2f5b[_0x3014('0x9e')]=qs['filters'](_['pick'](_0x25ecfa[_0x3014('0x40')],_0x4d7156[_0x3014('0x9c')]));_0x1b2f5b[_0x3014('0x9e')][_0x3014('0x9f')]=_0x5c06ea['id'];if(_0x25ecfa['query'][_0x3014('0xa0')]){_0x1b2f5b[_0x3014('0x9e')]=_[_0x3014('0x33')](_0x1b2f5b[_0x3014('0x9e')],{'$or':_[_0x3014('0x39')](_0x1b2f5b[_0x3014('0x46')],function(_0x225164){var _0x4db8a4={};_0x4db8a4[_0x225164]={'$like':'%'+_0x25ecfa['query']['filter']+'%'};return _0x4db8a4;})});}_0x1b2f5b[_0x3014('0x9e')][_0x3014('0x89')]=![];if(_0x25ecfa['query']['id']){_0x1b2f5b['where']['id']={'$gt':_0x25ecfa[_0x3014('0x40')]['id']};}_0x1b2f5b=_[_0x3014('0x33')]({},_0x1b2f5b,_0x25ecfa[_0x3014('0xa3')]);return db[_0x3014('0x79')]['count']({'where':_0x1b2f5b[_0x3014('0x9e')]})[_0x3014('0x18')](function(_0x7d969f){_0x9d97a7['count']=_0x7d969f;_0x1b2f5b['include']=[];if(_0x25ecfa[_0x3014('0x40')]['includeAgent']){_0x1b2f5b[_0x3014('0x48')]['push']({'model':db[_0x3014('0x7a')],'as':_0x3014('0x7a'),'attributes':['id',_0x3014('0x53'),_0x3014('0x86')]});}if(_0x25ecfa[_0x3014('0x40')][_0x3014('0xa4')]){_0x1b2f5b[_0x3014('0x48')]=[{'all':!![]}];}return db['ChatMessage'][_0x3014('0x3e')](_0x1b2f5b);})['then'](function(_0x1ae356){_0x9d97a7[_0x3014('0xa5')]=_0x1ae356;return _0x9d97a7;});}})['then'](respondWithFilteredResult(_0x3bbe49,_0x1b2f5b))[_0x3014('0x22')](handleError(_0x3bbe49,null));};exports['addTags']=function(_0x43bae8,_0x4b9ee4){return db[_0x3014('0x3a')][_0x3014('0x4a')]({'where':{'id':_0x43bae8[_0x3014('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b9ee4,null))[_0x3014('0x18')](function(_0x41164c){if(_0x41164c){return _0x41164c[_0x3014('0xa7')](_0x43bae8[_0x3014('0x34')][_0x3014('0x94')],_[_0x3014('0x95')](_0x43bae8[_0x3014('0x34')],['ids','id'])||{})[_0x3014('0xa8')](function(){return db[_0x3014('0xa9')][_0x3014('0x3e')]({'attributes':['id',_0x3014('0x30'),_0x3014('0xaa')],'where':{'id':_0x43bae8[_0x3014('0x34')][_0x3014('0x94')]}});})[_0x3014('0x18')](function(_0x7f8222){socket[_0x3014('0xab')](_0x3014('0xac'),{'id':Number(_0x43bae8[_0x3014('0x42')]['id']),'tags':_0x7f8222||[]});return{'id':Number(_0x43bae8[_0x3014('0x42')]['id']),'tags':_0x7f8222||[]};});}})[_0x3014('0x18')](respondWithResult(_0x4b9ee4,null))[_0x3014('0x22')](handleError(_0x4b9ee4,null));};exports['removeTags']=function(_0x527c35,_0xea1435){return db[_0x3014('0x3a')][_0x3014('0x4a')]({'where':{'id':_0x527c35[_0x3014('0x42')]['id']}})['then'](handleEntityNotFound(_0xea1435,null))[_0x3014('0x18')](function(_0x3e0efe){if(_0x3e0efe){return _0x3e0efe[_0x3014('0xad')](_0x527c35[_0x3014('0x40')][_0x3014('0x94')]);}})[_0x3014('0x18')](respondWithStatusCode(_0xea1435,null))['catch'](handleError(_0xea1435,null));};exports['download']=function(_0x143084,_0x156505){var _0x1f5bbb=moment()['unix']()[_0x3014('0xae')]();var _0x14b079=path[_0x3014('0x74')](config[_0x3014('0x72')],_0x3014('0xaf'),'files',_0x3014('0xb0'));var _0x29d7f2=path[_0x3014('0x74')](config[_0x3014('0x72')],_0x3014('0xaf'),_0x3014('0xb1'),_0x3014('0xb2'));var _0x4d5795=path[_0x3014('0x74')](_0x14b079,_0x1f5bbb);var _0x17bfc8=util[_0x3014('0x7e')](_0x3014('0xb3'),_0x143084[_0x3014('0x42')]['id'],_0x1f5bbb);var _0x169489=path[_0x3014('0x74')](_0x14b079,_0x17bfc8);var _0x1bbda3=[];_0x1bbda3[_0x3014('0xb4')]({'model':db[_0x3014('0x7a')],'as':_0x3014('0x7a'),'attributes':['id','fullname'],'raw':!![]});_0x1bbda3['push']({'model':db[_0x3014('0x61')],'as':_0x3014('0xb5'),'attributes':['id',_0x3014('0xb6'),_0x3014('0xb7')],'raw':!![]});if(_0x143084['query']['attachments']){_0x1bbda3['push']({'model':db[_0x3014('0x70')],'as':_0x3014('0x70'),'raw':!![]});}var _0x1e8286=[{'model':db['ChatMessage'],'as':_0x3014('0x7d'),'attributes':['id','body',_0x3014('0xb8'),_0x3014('0xb9'),'secret',_0x3014('0xba')],'include':_0x1bbda3}];_0x1e8286[_0x3014('0xb4')]({'model':db[_0x3014('0x7b')],'as':_0x3014('0xbb'),'attributes':['id',_0x3014('0x30')]});_0x1e8286['push']({'model':db[_0x3014('0x7a')],'as':_0x3014('0xbc'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x3014('0x4a')]({'where':{'id':_0x143084[_0x3014('0x42')]['id']},'include':_0x1e8286})[_0x3014('0x18')](handleEntityNotFound(_0x156505,null))[_0x3014('0x18')](function(_0x183a9d){if(_0x183a9d){var _0x40c22e=_0x183a9d[_0x3014('0xbd')]({'plain':!![]});fs['mkdirSync'](_0x4d5795);var _0x12007c={'channel':_0x3014('0xbe'),'account':_0x40c22e[_0x3014('0xbb')][_0x3014('0x30')],'agent':_0x40c22e[_0x3014('0xbc')]?_0x40c22e[_0x3014('0xbc')][_0x3014('0x53')]:'N.A.','createdAt':moment(_0x40c22e[_0x3014('0xb8')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3014('0xae')](),'closedAt':_0x40c22e[_0x3014('0x6e')]?moment(_0x40c22e[_0x3014('0xbf')])[_0x3014('0x7e')](_0x3014('0xa2'))[_0x3014('0xae')]():'','disposition':_0x40c22e['disposition'],'chatInfo':{'browser':_0x40c22e[_0x3014('0xc0')],'os':_0x40c22e['osName'],'referer':_0x40c22e[_0x3014('0xc1')],'customerIp':_0x40c22e[_0x3014('0xc2')],'customerPort':_0x40c22e[_0x3014('0xc3')]?_0x40c22e[_0x3014('0xc3')]:_0x3014('0xc4')},'messages':_(_0x40c22e[_0x3014('0x7d')])[_0x3014('0xc5')]()['filter']({'secret':![]})[_0x3014('0x39')](function(_0x155a99){if(_0x155a99[_0x3014('0x70')]){var _0x2c9e5e=path[_0x3014('0x74')](_0x29d7f2,_0x155a99[_0x3014('0x70')]['basename']);if(fs[_0x3014('0xc6')](_0x2c9e5e)){fs[_0x3014('0xc7')](_0x2c9e5e)[_0x3014('0xc8')](fs[_0x3014('0xc9')](path[_0x3014('0x74')](_0x4d5795,_0x155a99[_0x3014('0x70')][_0x3014('0x6b')])));}}return{'date':moment(_0x155a99[_0x3014('0xb8')])['format'](_0x3014('0xa2'))['toString'](),'sender':_0x155a99[_0x3014('0xb9')]==='out'?_0x155a99['User']?_0x155a99[_0x3014('0x7a')]['fullname']:_0x3014('0x81'):_0x155a99[_0x3014('0xb5')][_0x3014('0xb6')]+(_0x155a99[_0x3014('0xb5')][_0x3014('0xb7')]?'\x20'+_0x155a99['Contact'][_0x3014('0xb7')]:''),'body':_0x155a99[_0x3014('0x70')]?_0x155a99[_0x3014('0x70')][_0x3014('0x6b')]:_0x155a99[_0x3014('0x34')],'direction':_0x155a99[_0x3014('0xb9')]==='out'?'A':'C','secret':_0x155a99[_0x3014('0x89')],'read':_0x155a99[_0x3014('0xba')],'attachment':_0x155a99['Attachment']};})['value']()};return ejs[_0x3014('0xca')](path['join'](config[_0x3014('0x72')],_0x3014('0xaf'),_0x3014('0xcb'),_0x3014('0xcc')),{'interaction':_0x12007c})['then'](function(_0x19a487){var _0x22e7ef=path[_0x3014('0x74')](_0x4d5795,_0x3014('0xcd')+_0x40c22e['id']+'-'+_0x1f5bbb+_0x3014('0xce'));var _0xa60c68={'path':_0x22e7ef,'channel':_0x3014('0xbe'),'interactionId':_0x40c22e['id']};return pdf[_0x3014('0xcf')](_0x19a487,_0xa60c68);})[_0x3014('0x18')](function(){return new Promise(function(_0x5849b2,_0x16667b){zipdir(_0x4d5795,{'saveTo':_0x169489},function(_0x3e61b7,_0x49d261){if(_0x3e61b7)return _0x16667b(_0x3e61b7);return _0x5849b2(_0x49d261);});})['then'](function(){return new BPromise(function(_0x1062b8,_0x403e55){rimraf(_0x4d5795,function(_0xcd900f){if(_0xcd900f)_0x403e55(_0xcd900f);return _0x1062b8();});});})['then'](function(){return _0x156505[_0x3014('0xd0')](_0x169489,_0x17bfc8,function(_0x4f1715){if(_0x4f1715){logger[_0x3014('0x1e')](_0x3014('0xd1'),_0x4f1715);}else{fs[_0x3014('0xd2')](_0x169489);}});});});}else{return _0x156505[_0x3014('0x2e')](0xc8);}})['catch'](handleError(_0x156505,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 66b1904..b7c60e6 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 _0x3a10=['setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','setMaxListeners','remove','getUsers','then'];(function(_0x543a8a,_0x339a68){var _0x38babe=function(_0x331b15){while(--_0x331b15){_0x543a8a['push'](_0x543a8a['shift']());}};_0x38babe(++_0x339a68);}(_0x3a10,0xf9));var _0x03a1=function(_0x734ea0,_0x2e21d1){_0x734ea0=_0x734ea0-0x0;var _0x4161f6=_0x3a10[_0x734ea0];return _0x4161f6;};'use strict';var EventEmitter=require(_0x03a1('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x03a1('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x03a1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x03a1('0x3')};function emitEvent(_0x169ad6){return function(_0x3bd856,_0x26c5bc,_0x3dbbcc){_0x3bd856[_0x03a1('0x4')]({'attributes':['id'],'raw':!![]})[_0x03a1('0x5')](function(_0x2db9af){_0x3bd856[_0x03a1('0x6')](_0x03a1('0x7'),_0x2db9af[_0x03a1('0x8')](function(_0xa504d1){return{'id':_0xa504d1['id']};}));return ChatMessage[_0x03a1('0x9')]({'where':{'ChatInteractionId':_0x3bd856['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2ebaac){_0x3bd856[_0x03a1('0x6')]('unreadMessages',_0x2ebaac['length']);ChatInteractionEvents['emit'](_0x169ad6+':'+_0x3bd856['id'],_0x3bd856);ChatInteractionEvents[_0x03a1('0xa')](_0x169ad6,_0x3bd856);_0x3dbbcc(null);})[_0x03a1('0xb')](_0x3dbbcc(null));};}for(var e in events){if(events[_0x03a1('0xc')](e)){var event=events[e];ChatInteraction[_0x03a1('0xd')](e,emitEvent(event));}}module[_0x03a1('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x8c46=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8c46,0x144));var _0x68c4=function(_0x43a1ba,_0x1909f7){_0x43a1ba=_0x43a1ba-0x0;var _0x55adf6=_0x8c46[_0x43a1ba];return _0x55adf6;};'use strict';var EventEmitter=require(_0x68c4('0x0'));var ChatInteraction=require(_0x68c4('0x1'))['db'][_0x68c4('0x2')];var ChatMessage=require(_0x68c4('0x1'))['db'][_0x68c4('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x68c4('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x68c4('0x5'),'afterDestroy':_0x68c4('0x6')};function emitEvent(_0x527c90){return function(_0x427a2d,_0x4cd0fc,_0x3e08c8){_0x427a2d[_0x68c4('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x44f280){_0x427a2d[_0x68c4('0x8')](_0x68c4('0x9'),_0x44f280[_0x68c4('0xa')](function(_0x4ad715){return{'id':_0x4ad715['id']};}));return ChatMessage[_0x68c4('0xb')]({'where':{'ChatInteractionId':_0x427a2d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x68c4('0xc')](function(_0x1acec4){_0x427a2d['setDataValue']('unreadMessages',_0x1acec4[_0x68c4('0xd')]);ChatInteractionEvents[_0x68c4('0xe')](_0x527c90+':'+_0x427a2d['id'],_0x427a2d);ChatInteractionEvents[_0x68c4('0xe')](_0x527c90,_0x427a2d);_0x3e08c8(null);})[_0x68c4('0xf')](_0x3e08c8(null));};}for(var e in events){if(events[_0x68c4('0x10')](e)){var event=events[e];ChatInteraction[_0x68c4('0x11')](e,emitEvent(event));}}module[_0x68c4('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 20ea27b..adb5050 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 _0x0b19=['utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','define','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x22a194,_0xea3723){var _0x1b8a30=function(_0x7ecb78){while(--_0x7ecb78){_0x22a194['push'](_0x22a194['shift']());}};_0x1b8a30(++_0xea3723);}(_0x0b19,0x11f));var _0x90b1=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0x0b19[_0x91384];return _0x44daa0;};'use strict';var _=require(_0x90b1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x90b1('0x1'));var rp=require(_0x90b1('0x2'));var fs=require('fs');var path=require(_0x90b1('0x3'));var rimraf=require(_0x90b1('0x4'));var config=require('../../config/environment');var attributes=require(_0x90b1('0x5'));module['exports']=function(_0xd8d815,_0x1489b0){return _0xd8d815[_0x90b1('0x6')](_0x90b1('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f267d,_0x557b01,_0x3cde01){if(_0x2f267d[_0x90b1('0x8')](_0x90b1('0x9'))){_0x2f267d[_0x90b1('0xa')]=moment()[_0x90b1('0xb')](_0x90b1('0xc'));}_0x3cde01(null,_0x2f267d);}},'charset':_0x90b1('0xd'),'collate':_0x90b1('0xe')});}; \ No newline at end of file +var _0xf60e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x20cfbd,_0x2fd684){var _0x4c4f3a=function(_0x293679){while(--_0x293679){_0x20cfbd['push'](_0x20cfbd['shift']());}};_0x4c4f3a(++_0x2fd684);}(_0xf60e,0x114));var _0xef60=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xf60e[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0xef60('0x0'));var util=require(_0xef60('0x1'));var logger=require(_0xef60('0x2'))(_0xef60('0x3'));var moment=require(_0xef60('0x4'));var BPromise=require(_0xef60('0x5'));var rp=require(_0xef60('0x6'));var fs=require('fs');var path=require(_0xef60('0x7'));var rimraf=require(_0xef60('0x8'));var config=require(_0xef60('0x9'));var attributes=require(_0xef60('0xa'));module[_0xef60('0xb')]=function(_0x4e85bf,_0x22e972){return _0x4e85bf[_0xef60('0xc')](_0xef60('0xd'),attributes,{'tableName':_0xef60('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x136c1e,_0x52f427,_0xb8ae7e){if(_0x136c1e[_0xef60('0xf')]('closed')){_0x136c1e[_0xef60('0x10')]=moment()[_0xef60('0x11')](_0xef60('0x12'));}_0xb8ae7e(null,_0x136c1e);}},'charset':_0xef60('0x13'),'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 b02418e..77be952 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 _0xbe7e=['AddTagsToChatInteraction','omit','spread','AddTags','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','then'];(function(_0x8f1756,_0x237d92){var _0x32d229=function(_0x386a28){while(--_0x386a28){_0x8f1756['push'](_0x8f1756['shift']());}};_0x32d229(++_0x237d92);}(_0xbe7e,0x124));var _0xebe7=function(_0x32ac54,_0x432558){_0x32ac54=_0x32ac54-0x0;var _0x423a40=_0xbe7e[_0x32ac54];return _0x423a40;};'use strict';var _=require(_0xebe7('0x0'));var util=require(_0xebe7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xebe7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebe7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xebe7('0x4'))(_0xebe7('0x5'));var config=require(_0xebe7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xebe7('0x7')][_0xebe7('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xebe7('0x9')],{'host':_0xebe7('0xa'),'port':0x18eb});var socket=require(_0xebe7('0xb'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xebe7('0xc')](socket);function respondWithRpcPromise(_0x5c3c25,_0x4fa005,_0x24e9ed){return new BPromise(function(_0x9c47a,_0x249c5c){return client['request'](_0x5c3c25,_0x24e9ed)['then'](function(_0xbd419){logger['info'](_0xebe7('0xd'),_0x4fa005,'request\x20sent');logger[_0xebe7('0xe')](_0xebe7('0xf'),_0x4fa005,_0xebe7('0x10'),JSON[_0xebe7('0x11')](_0xbd419));if(_0xbd419[_0xebe7('0x12')]){if(_0xbd419['error']['code']===0x1f4){logger[_0xebe7('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x4fa005,_0xbd419[_0xebe7('0x12')][_0xebe7('0x13')]);return _0x249c5c(_0xbd419[_0xebe7('0x12')][_0xebe7('0x13')]);}logger[_0xebe7('0x12')](_0xebe7('0xd'),_0x4fa005,_0xbd419['error'][_0xebe7('0x13')]);return _0x9c47a(_0xbd419[_0xebe7('0x12')][_0xebe7('0x13')]);}else{logger[_0xebe7('0x14')](_0xebe7('0xd'),_0x4fa005,_0xebe7('0x10'));_0x9c47a(_0xbd419[_0xebe7('0x15')][_0xebe7('0x13')]);}})[_0xebe7('0x16')](function(_0x5b31de){logger[_0xebe7('0x12')](_0xebe7('0xd'),_0x4fa005,_0x5b31de);_0x249c5c(_0x5b31de);});});}exports[_0xebe7('0x17')]=function(_0x412e95){var _0x285293=this;return new Promise(function(_0x807925,_0x38608a){return db[_0xebe7('0x18')][_0xebe7('0x19')](_0x412e95[_0xebe7('0x1a')],{'raw':_0x412e95[_0xebe7('0x1b')]?_0x412e95['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x412e95[_0xebe7('0x1b')]?_0x412e95[_0xebe7('0x1b')][_0xebe7('0x1c')]||null:null,'attributes':_0x412e95[_0xebe7('0x1b')]?_0x412e95['options'][_0xebe7('0x1d')]||null:null,'limit':_0x412e95[_0xebe7('0x1b')]?_0x412e95['options'][_0xebe7('0x1e')]||null:null})[_0xebe7('0x1f')](function(_0x3a8ac9){logger[_0xebe7('0x14')]('UpdateChatInteraction',_0x412e95);logger[_0xebe7('0xe')](_0xebe7('0x17'),_0x412e95,JSON[_0xebe7('0x11')](_0x3a8ac9));_0x807925(_0x3a8ac9);})[_0xebe7('0x16')](function(_0x21c942){logger[_0xebe7('0x12')](_0xebe7('0x17'),_0x21c942[_0xebe7('0x13')],_0x412e95);_0x38608a(_0x285293[_0xebe7('0x12')](0x1f4,_0x21c942['message']));});});};exports[_0xebe7('0x20')]=function(_0x38c2f8){return new Promise(function(_0x4ab317,_0x257e14){return db[_0xebe7('0x18')]['find']({'where':_0x38c2f8['options']?_0x38c2f8[_0xebe7('0x1b')][_0xebe7('0x1c')]||null:null})['then'](function(_0x5a78d1){if(_0x5a78d1){return _0x5a78d1['addTags'](_0x38c2f8[_0xebe7('0x1a')]['ids'],_[_0xebe7('0x21')](_0x38c2f8['body'],['ids','id'])||{});}})[_0xebe7('0x22')](function(_0x23924a){logger['info']('AddTags',_0x38c2f8);logger[_0xebe7('0xe')](_0xebe7('0x23'),_0x38c2f8,JSON['stringify'](_0x23924a));_0x4ab317(_0x23924a);})[_0xebe7('0x16')](function(_0x5ea49d){logger['error'](_0xebe7('0x23'),_0x5ea49d[_0xebe7('0x13')],_0x38c2f8);_0x257e14(_this[_0xebe7('0x12')](0x1f4,_0x5ea49d['message']));});});}; \ No newline at end of file +var _0xc64e=['body','options','raw','where','attributes','limit','then','stringify','catch','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','info','request\x20sent','debug','error','code','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','ChatInteraction','update'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xc64e,0x1f3));var _0xec64=function(_0x513a5f,_0x320ebd){_0x513a5f=_0x513a5f-0x0;var _0x54372b=_0xc64e[_0x513a5f];return _0x54372b;};'use strict';var _=require(_0xec64('0x0'));var util=require(_0xec64('0x1'));var moment=require(_0xec64('0x2'));var BPromise=require(_0xec64('0x3'));var rs=require(_0xec64('0x4'));var fs=require('fs');var Redis=require(_0xec64('0x5'));var db=require(_0xec64('0x6'))['db'];var utils=require(_0xec64('0x7'));var logger=require(_0xec64('0x8'))(_0xec64('0x9'));var config=require(_0xec64('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xec64('0xb')][_0xec64('0xc')]({'port':0x232a});config[_0xec64('0xd')]=_['defaults'](config[_0xec64('0xd')],{'host':_0xec64('0xe'),'port':0x18eb});var socket=require(_0xec64('0xf'))(new Redis(config[_0xec64('0xd')]));require(_0xec64('0x10'))['register'](socket);function respondWithRpcPromise(_0x48b80e,_0x28528c,_0x4e9b3a){return new BPromise(function(_0xc77e73,_0x184a0f){return client[_0xec64('0x11')](_0x48b80e,_0x4e9b3a)['then'](function(_0x9ec789){logger[_0xec64('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x28528c,_0xec64('0x13'));logger[_0xec64('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x28528c,_0xec64('0x13'),JSON['stringify'](_0x9ec789));if(_0x9ec789[_0xec64('0x15')]){if(_0x9ec789[_0xec64('0x15')][_0xec64('0x16')]===0x1f4){logger[_0xec64('0x15')](_0xec64('0x17'),_0x28528c,_0x9ec789['error'][_0xec64('0x18')]);return _0x184a0f(_0x9ec789[_0xec64('0x15')][_0xec64('0x18')]);}logger[_0xec64('0x15')](_0xec64('0x17'),_0x28528c,_0x9ec789['error'][_0xec64('0x18')]);return _0xc77e73(_0x9ec789[_0xec64('0x15')][_0xec64('0x18')]);}else{logger[_0xec64('0x12')](_0xec64('0x17'),_0x28528c,'request\x20sent');_0xc77e73(_0x9ec789[_0xec64('0x19')]['message']);}})['catch'](function(_0x349d0a){logger[_0xec64('0x15')](_0xec64('0x17'),_0x28528c,_0x349d0a);_0x184a0f(_0x349d0a);});});}exports[_0xec64('0x1a')]=function(_0x2e13dc){var _0x148231=this;return new Promise(function(_0x3da258,_0x1647fa){return db[_0xec64('0x1b')][_0xec64('0x1c')](_0x2e13dc[_0xec64('0x1d')],{'raw':_0x2e13dc[_0xec64('0x1e')]?_0x2e13dc[_0xec64('0x1e')][_0xec64('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e13dc['options']?_0x2e13dc[_0xec64('0x1e')][_0xec64('0x20')]||null:null,'attributes':_0x2e13dc[_0xec64('0x1e')]?_0x2e13dc[_0xec64('0x1e')][_0xec64('0x21')]||null:null,'limit':_0x2e13dc[_0xec64('0x1e')]?_0x2e13dc[_0xec64('0x1e')][_0xec64('0x22')]||null:null})[_0xec64('0x23')](function(_0xbd783f){logger[_0xec64('0x12')](_0xec64('0x1a'),_0x2e13dc);logger['debug'](_0xec64('0x1a'),_0x2e13dc,JSON[_0xec64('0x24')](_0xbd783f));_0x3da258(_0xbd783f);})[_0xec64('0x25')](function(_0x2cea17){logger[_0xec64('0x15')](_0xec64('0x1a'),_0x2cea17['message'],_0x2e13dc);_0x1647fa(_0x148231['error'](0x1f4,_0x2cea17[_0xec64('0x18')]));});});};exports[_0xec64('0x26')]=function(_0x190563){return new Promise(function(_0xa76657,_0x2f3faa){return db[_0xec64('0x1b')][_0xec64('0x27')]({'where':_0x190563[_0xec64('0x1e')]?_0x190563['options'][_0xec64('0x20')]||null:null})[_0xec64('0x23')](function(_0x36e610){if(_0x36e610){return _0x36e610[_0xec64('0x28')](_0x190563[_0xec64('0x1d')][_0xec64('0x29')],_['omit'](_0x190563[_0xec64('0x1d')],['ids','id'])||{});}})[_0xec64('0x2a')](function(_0x240c42){logger[_0xec64('0x12')](_0xec64('0x2b'),_0x190563);logger['debug'](_0xec64('0x2b'),_0x190563,JSON[_0xec64('0x24')](_0x240c42));_0xa76657(_0x240c42);})[_0xec64('0x25')](function(_0x32752e){logger['error'](_0xec64('0x2b'),_0x32752e[_0xec64('0x18')],_0x190563);_0x2f3faa(_this[_0xec64('0x15')](0x1f4,_0x32752e[_0xec64('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0168b23..8fec920 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 _0xc19f=['removeListener','register','./chatInteraction.events','remove','update','emit'];(function(_0x39d9ec,_0x4ed6e5){var _0x499ff0=function(_0x565eaf){while(--_0x565eaf){_0x39d9ec['push'](_0x39d9ec['shift']());}};_0x499ff0(++_0x4ed6e5);}(_0xc19f,0xbc));var _0xfc19=function(_0x35f978,_0x1b898a){_0x35f978=_0x35f978-0x0;var _0x36988a=_0xc19f[_0x35f978];return _0x36988a;};'use strict';var ChatInteractionEvents=require(_0xfc19('0x0'));var events=['save',_0xfc19('0x1'),_0xfc19('0x2')];function createListener(_0x429615,_0x1161bc){return function(_0x2cddab){_0x1161bc[_0xfc19('0x3')](_0x429615,_0x2cddab);};}function removeListener(_0x2ec201,_0x419838){return function(){ChatInteractionEvents[_0xfc19('0x4')](_0x2ec201,_0x419838);};}exports[_0xfc19('0x5')]=function(_0x323713){for(var _0x45e897=0x0,_0x10528d=events['length'];_0x45e897<_0x10528d;_0x45e897++){var _0x1e74ea=events[_0x45e897];var _0x2ee390=createListener('chatInteraction:'+_0x1e74ea,_0x323713);ChatInteractionEvents['on'](_0x1e74ea,_0x2ee390);}}; \ No newline at end of file +var _0x7b23=['chatInteraction:','remove','update','removeListener','register','length'];(function(_0x557429,_0x15fd9f){var _0x40aa09=function(_0x5013bf){while(--_0x5013bf){_0x557429['push'](_0x557429['shift']());}};_0x40aa09(++_0x15fd9f);}(_0x7b23,0xf1));var _0x37b2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7b23[_0xa464c9];return _0x3d73c4;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x37b2('0x0'),_0x37b2('0x1')];function createListener(_0x21d5ed,_0x12e81b){return function(_0x2a5714){_0x12e81b['emit'](_0x21d5ed,_0x2a5714);};}function removeListener(_0x304646,_0x4a7e51){return function(){ChatInteractionEvents[_0x37b2('0x2')](_0x304646,_0x4a7e51);};}exports[_0x37b2('0x3')]=function(_0x35675a){for(var _0x3c6bc6=0x0,_0x64a25a=events[_0x37b2('0x4')];_0x3c6bc6<_0x64a25a;_0x3c6bc6++){var _0x33465e=events[_0x3c6bc6];var _0x3c5a3a=createListener(_0x37b2('0x5')+_0x33465e,_0x35675a);ChatInteractionEvents['on'](_0x33465e,_0x3c5a3a);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2f6f4d3..26dd1ff 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 _0x49dd=['root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','join'];(function(_0x229be5,_0x9156f6){var _0x326189=function(_0x2cca17){while(--_0x2cca17){_0x229be5['push'](_0x229be5['shift']());}};_0x326189(++_0x9156f6);}(_0x49dd,0x165));var _0xd49d=function(_0x5c19af,_0x191732){_0x5c19af=_0x5c19af-0x0;var _0x26f095=_0x49dd[_0x5c19af];return _0x26f095;};'use strict';var multer=require(_0xd49d('0x0'));var util=require(_0xd49d('0x1'));var path=require(_0xd49d('0x2'));var timeout=require(_0xd49d('0x3'));var express=require(_0xd49d('0x4'));var router=express[_0xd49d('0x5')]();var fs_extra=require(_0xd49d('0x6'));var auth=require(_0xd49d('0x7'));var interaction=require(_0xd49d('0x8'));var config=require(_0xd49d('0x9'));var controller=require(_0xd49d('0xa'));router[_0xd49d('0xb')]('/',auth[_0xd49d('0xc')](),controller['index']);router[_0xd49d('0xb')](_0xd49d('0xd'),auth['isAuthenticated'](),controller[_0xd49d('0xe')]);router[_0xd49d('0xb')](_0xd49d('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xd49d('0x10')]);router['get'](_0xd49d('0x11'),auth[_0xd49d('0x12')](),controller[_0xd49d('0x13')]);router[_0xd49d('0xb')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xd49d('0xb')](_0xd49d('0x14'),auth['isChatInteractionAuthorized'](),controller[_0xd49d('0x15')]);router[_0xd49d('0xb')](_0xd49d('0x16'),auth[_0xd49d('0xc')](),controller['download']);router[_0xd49d('0x17')]('/',auth[_0xd49d('0xc')](),controller[_0xd49d('0x18')]);router['post'](_0xd49d('0x19'),auth[_0xd49d('0xc')](),controller[_0xd49d('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x24d8ad,_0x3e1c96,_0x8fc63d){_0x8fc63d(null,path[_0xd49d('0x1b')](config[_0xd49d('0x1c')],_0xd49d('0x1d')));},'filename':function(_0x57918c,_0x5ac819,_0x122bf0){_0x122bf0(null,util['format'](_0xd49d('0x1e'),Date[_0xd49d('0x1f')](),_0x5ac819[_0xd49d('0x20')][_0xd49d('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd49d('0x17')](_0xd49d('0x22'),upload[_0xd49d('0x23')]('file'),controller[_0xd49d('0x24')]);router['post']('/:id/messages',auth[_0xd49d('0x12')](),controller[_0xd49d('0x25')]);router[_0xd49d('0x17')](_0xd49d('0x26'),auth[_0xd49d('0xc')](),interaction['tracked'](_0xd49d('0x27'),_0xd49d('0x28')),controller[_0xd49d('0x29')]);router[_0xd49d('0x2a')](_0xd49d('0xf'),auth['isAuthenticated'](),interaction[_0xd49d('0x2b')](_0xd49d('0x27'),_0xd49d('0x2c')),controller[_0xd49d('0x2d')]);router[_0xd49d('0x2a')](_0xd49d('0x2e'),controller[_0xd49d('0x2f')]);router[_0xd49d('0x2a')](_0xd49d('0x30'),auth[_0xd49d('0x12')](),controller[_0xd49d('0x31')]);router[_0xd49d('0x2a')](_0xd49d('0x32'),controller[_0xd49d('0x33')]);router[_0xd49d('0x34')]('/:id',auth[_0xd49d('0xc')](),interaction[_0xd49d('0x2b')](_0xd49d('0x27'),_0xd49d('0x35')),controller['destroy']);router['delete']('/:id/tags',auth[_0xd49d('0xc')](),controller[_0xd49d('0x36')]);module['exports']=router; \ No newline at end of file +var _0xcc1a=['addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags'];(function(_0x4c7e00,_0x56856b){var _0x36225d=function(_0x1cd0f9){while(--_0x1cd0f9){_0x4c7e00['push'](_0x4c7e00['shift']());}};_0x36225d(++_0x56856b);}(_0xcc1a,0xb5));var _0xacc1=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xcc1a[_0x1f1e31];return _0x229b56;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacc1('0x0'));var timeout=require(_0xacc1('0x1'));var express=require(_0xacc1('0x2'));var router=express[_0xacc1('0x3')]();var fs_extra=require(_0xacc1('0x4'));var auth=require(_0xacc1('0x5'));var interaction=require(_0xacc1('0x6'));var config=require('../../config/environment');var controller=require(_0xacc1('0x7'));router[_0xacc1('0x8')]('/',auth[_0xacc1('0x9')](),controller[_0xacc1('0xa')]);router[_0xacc1('0x8')](_0xacc1('0xb'),auth[_0xacc1('0x9')](),controller[_0xacc1('0xc')]);router['get'](_0xacc1('0xd'),auth[_0xacc1('0xe')](),controller[_0xacc1('0xf')]);router['get'](_0xacc1('0x10'),auth[_0xacc1('0xe')](),controller[_0xacc1('0x11')]);router[_0xacc1('0x8')](_0xacc1('0x12'),auth[_0xacc1('0x9')](),controller['getMessages']);router[_0xacc1('0x8')](_0xacc1('0x13'),auth[_0xacc1('0xe')](),controller[_0xacc1('0x14')]);router[_0xacc1('0x8')]('/:id/download',auth[_0xacc1('0x9')](),controller[_0xacc1('0x15')]);router[_0xacc1('0x16')]('/',auth[_0xacc1('0x9')](),controller[_0xacc1('0x17')]);router['post'](_0xacc1('0x18'),auth['isAuthenticated'](),controller[_0xacc1('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x328014,_0x3763dc,_0x599e4e){_0x599e4e(null,path[_0xacc1('0x1a')](config[_0xacc1('0x1b')],_0xacc1('0x1c')));},'filename':function(_0x1cae2f,_0x195da9,_0x5729a4){_0x5729a4(null,util[_0xacc1('0x1d')](_0xacc1('0x1e'),Date[_0xacc1('0x1f')](),_0x195da9[_0xacc1('0x20')][_0xacc1('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xacc1('0x16')](_0xacc1('0x22'),upload[_0xacc1('0x23')](_0xacc1('0x24')),controller[_0xacc1('0x25')]);router[_0xacc1('0x16')](_0xacc1('0x12'),auth['isChatInteractionAuthorized'](),controller[_0xacc1('0x26')]);router[_0xacc1('0x16')](_0xacc1('0x27'),auth[_0xacc1('0x9')](),interaction[_0xacc1('0x28')](_0xacc1('0x29'),_0xacc1('0x2a')),controller[_0xacc1('0x2b')]);router[_0xacc1('0x2c')](_0xacc1('0xd'),auth[_0xacc1('0x9')](),interaction[_0xacc1('0x28')](_0xacc1('0x29'),_0xacc1('0x2d')),controller[_0xacc1('0x2e')]);router['put'](_0xacc1('0x2f'),controller[_0xacc1('0x30')]);router[_0xacc1('0x2c')](_0xacc1('0x31'),auth[_0xacc1('0xe')](),controller[_0xacc1('0x32')]);router[_0xacc1('0x2c')](_0xacc1('0x33'),controller[_0xacc1('0x34')]);router[_0xacc1('0x35')](_0xacc1('0xd'),auth[_0xacc1('0x9')](),interaction[_0xacc1('0x28')](_0xacc1('0x29'),_0xacc1('0x36')),controller['destroy']);router[_0xacc1('0x35')](_0xacc1('0x27'),auth['isAuthenticated'](),controller[_0xacc1('0x37')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index bce801d..77e8e69 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 _0x9dd6=['exports','TEXT','medium','BOOLEAN','sequelize'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9dd6,0x153));var _0x69dd=function(_0x289d7d,_0x2e8583){_0x289d7d=_0x289d7d-0x0;var _0x275d6e=_0x9dd6[_0x289d7d];return _0x275d6e;};'use strict';var Sequelize=require(_0x69dd('0x0'));module[_0x69dd('0x1')]={'body':{'type':Sequelize[_0x69dd('0x2')](_0x69dd('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x69dd('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8538=['INTEGER','sequelize','exports','medium'];(function(_0x5aab2f,_0xebb98c){var _0x29ef56=function(_0x489353){while(--_0x489353){_0x5aab2f['push'](_0x5aab2f['shift']());}};_0x29ef56(++_0xebb98c);}(_0x8538,0x71));var _0x8853=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8538[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8853('0x0'));module[_0x8853('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8853('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8853('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8e06ab7..63f871c 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 _0xd85c=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','update','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','get','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','agent','push','createdAt','FromId','read','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','json','offset','count','limit','set','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','send','index','map','ChatInternalMessage'];(function(_0x5577bb,_0x4bedd7){var _0x2d8422=function(_0x14bb86){while(--_0x14bb86){_0x5577bb['push'](_0x5577bb['shift']());}};_0x2d8422(++_0x4bedd7);}(_0xd85c,0x119));var _0xcd85=function(_0x10a7b2,_0x37587c){_0x10a7b2=_0x10a7b2-0x0;var _0x5cf00e=_0xd85c[_0x10a7b2];return _0x5cf00e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd85('0x0'));var zipdir=require(_0xcd85('0x1'));var jsonpatch=require(_0xcd85('0x2'));var rp=require(_0xcd85('0x3'));var moment=require(_0xcd85('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd85('0x5'));var util=require(_0xcd85('0x6'));var path=require(_0xcd85('0x7'));var sox=require(_0xcd85('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd85('0x9'));var _=require(_0xcd85('0xa'));var squel=require(_0xcd85('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcd85('0xc'));var querystring=require(_0xcd85('0xd'));var Papa=require(_0xcd85('0xe'));var Redis=require(_0xcd85('0xf'));var authService=require(_0xcd85('0x10'));var qs=require(_0xcd85('0x11'));var as=require(_0xcd85('0x12'));var hardwareService=require(_0xcd85('0x13'));var logger=require(_0xcd85('0x14'))(_0xcd85('0x15'));var utils=require(_0xcd85('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd85('0x17'))['db'];config[_0xcd85('0x18')]=_[_0xcd85('0x19')](config[_0xcd85('0x18')],{'host':_0xcd85('0x1a'),'port':0x18eb});var socket=require(_0xcd85('0x1b'))(new Redis(config[_0xcd85('0x18')]));require(_0xcd85('0x1c'))['register'](socket);function respondWithStatusCode(_0x8558b5,_0x511fae){_0x511fae=_0x511fae||0xcc;return function(_0x4f32ad){if(_0x4f32ad){return _0x8558b5['sendStatus'](_0x511fae);}return _0x8558b5['status'](_0x511fae)['end']();};}function respondWithResult(_0x5472d2,_0x1e6097){_0x1e6097=_0x1e6097||0xc8;return function(_0x11c6f8){if(_0x11c6f8){return _0x5472d2[_0xcd85('0x1d')](_0x1e6097)[_0xcd85('0x1e')](_0x11c6f8);}};}function respondWithFilteredResult(_0x32a1c9,_0x522ae4){return function(_0x36b9dc){if(_0x36b9dc){var _0x8a21f7=typeof _0x522ae4[_0xcd85('0x1f')]==='undefined'&&typeof _0x522ae4['limit']==='undefined';var _0x22ae9e=_0x36b9dc[_0xcd85('0x20')];var _0x340c28=_0x8a21f7?0x0:_0x522ae4[_0xcd85('0x1f')];var _0x42d6c9=_0x8a21f7?_0x36b9dc[_0xcd85('0x20')]:_0x522ae4[_0xcd85('0x1f')]+_0x522ae4[_0xcd85('0x21')];var _0xdd0bd5;if(_0x42d6c9>=_0x22ae9e){_0x42d6c9=_0x22ae9e;_0xdd0bd5=0xc8;}else{_0xdd0bd5=0xce;}_0x32a1c9[_0xcd85('0x1d')](_0xdd0bd5);return _0x32a1c9[_0xcd85('0x22')]('Content-Range',_0x340c28+'-'+_0x42d6c9+'/'+_0x22ae9e)['json'](_0x36b9dc);}return null;};}function patchUpdates(_0x2afe03){return function(_0x5c3a9b){try{jsonpatch[_0xcd85('0x23')](_0x5c3a9b,_0x2afe03,!![]);}catch(_0x5eaa2d){return BPromise[_0xcd85('0x24')](_0x5eaa2d);}return _0x5c3a9b[_0xcd85('0x25')]();};}function saveUpdates(_0x549942,_0x43ab8e){return function(_0xfaf86a){if(_0xfaf86a){return _0xfaf86a['update'](_0x549942)['then'](function(_0x45ffa6){return _0x45ffa6;});}return null;};}function removeEntity(_0x420bde,_0x38a2eb){return function(_0x615b9d){if(_0x615b9d){return _0x615b9d[_0xcd85('0x26')]()[_0xcd85('0x27')](function(){_0x420bde[_0xcd85('0x1d')](0xcc)[_0xcd85('0x28')]();});}};}function handleEntityNotFound(_0x1354b2,_0xa7816d){return function(_0x556547){if(!_0x556547){_0x1354b2[_0xcd85('0x29')](0x194);}return _0x556547;};}function handleError(_0x2f76a0,_0x1fdaae){_0x1fdaae=_0x1fdaae||0x1f4;return function(_0x2c08bf){logger[_0xcd85('0x2a')](_0x2c08bf[_0xcd85('0x2b')]);if(_0x2c08bf['name']){delete _0x2c08bf[_0xcd85('0x2c')];}_0x2f76a0[_0xcd85('0x1d')](_0x1fdaae)[_0xcd85('0x2d')](_0x2c08bf);};}exports[_0xcd85('0x2e')]=function(_0x333ce3,_0x242106){var _0x59d893={},_0x1b37e4={},_0x40b628={'count':0x0,'rows':[]};var _0x4b283a=_[_0xcd85('0x2f')](db[_0xcd85('0x30')][_0xcd85('0x31')],function(_0x3c98e3){return{'name':_0x3c98e3[_0xcd85('0x32')],'type':_0x3c98e3[_0xcd85('0x33')][_0xcd85('0x34')]};});_0x1b37e4[_0xcd85('0x35')]=_['map'](_0x4b283a,_0xcd85('0x2c'));_0x1b37e4[_0xcd85('0x36')]=_['keys'](_0x333ce3['query']);_0x1b37e4[_0xcd85('0x37')]=_[_0xcd85('0x38')](_0x1b37e4['model'],_0x1b37e4[_0xcd85('0x36')]);_0x59d893[_0xcd85('0x39')]=_[_0xcd85('0x38')](_0x1b37e4['model'],qs['fields'](_0x333ce3[_0xcd85('0x36')][_0xcd85('0x3a')]));_0x59d893[_0xcd85('0x39')]=_0x59d893[_0xcd85('0x39')][_0xcd85('0x3b')]?_0x59d893[_0xcd85('0x39')]:_0x1b37e4['model'];if(!_0x333ce3[_0xcd85('0x36')][_0xcd85('0x3c')](_0xcd85('0x3d'))){_0x59d893[_0xcd85('0x21')]=qs[_0xcd85('0x21')](_0x333ce3[_0xcd85('0x36')][_0xcd85('0x21')]);_0x59d893['offset']=qs[_0xcd85('0x1f')](_0x333ce3[_0xcd85('0x36')][_0xcd85('0x1f')]);}_0x59d893['order']=qs['sort'](_0x333ce3[_0xcd85('0x36')][_0xcd85('0x3e')]);_0x59d893[_0xcd85('0x3f')]=qs[_0xcd85('0x37')](_[_0xcd85('0x40')](_0x333ce3[_0xcd85('0x36')],_0x1b37e4[_0xcd85('0x37')]),_0x4b283a);if(_0x333ce3[_0xcd85('0x36')][_0xcd85('0x41')]){_0x59d893[_0xcd85('0x3f')]=_[_0xcd85('0x42')](_0x59d893[_0xcd85('0x3f')],{'$or':_[_0xcd85('0x2f')](_0x4b283a,function(_0x23094e){if(_0x23094e[_0xcd85('0x33')]!==_0xcd85('0x43')){var _0x26c5e4={};_0x26c5e4[_0x23094e[_0xcd85('0x2c')]]={'$like':'%'+_0x333ce3[_0xcd85('0x36')]['filter']+'%'};return _0x26c5e4;}})});}_0x59d893=_[_0xcd85('0x42')]({},_0x59d893,_0x333ce3[_0xcd85('0x44')]);var _0xaee007={'where':_0x59d893[_0xcd85('0x3f')]};return db[_0xcd85('0x30')]['count'](_0xaee007)['then'](function(_0x254d70){_0x40b628[_0xcd85('0x20')]=_0x254d70;if(_0x333ce3['query'][_0xcd85('0x45')]){_0x59d893[_0xcd85('0x46')]=[{'all':!![]}];}return db[_0xcd85('0x30')]['findAll'](_0x59d893);})['then'](function(_0x319602){_0x40b628['rows']=_0x319602;return _0x40b628;})[_0xcd85('0x27')](respondWithFilteredResult(_0x242106,_0x59d893))[_0xcd85('0x47')](handleError(_0x242106,null));};exports[_0xcd85('0x48')]=function(_0x2c565a,_0x162199){var _0x168117={'raw':!![],'where':{'id':_0x2c565a[_0xcd85('0x49')]['id']}},_0x5a47b7={};_0x5a47b7['model']=_[_0xcd85('0x4a')](db[_0xcd85('0x30')][_0xcd85('0x31')]);_0x5a47b7[_0xcd85('0x36')]=_['keys'](_0x2c565a[_0xcd85('0x36')]);_0x5a47b7['filters']=_['intersection'](_0x5a47b7[_0xcd85('0x35')],_0x5a47b7[_0xcd85('0x36')]);_0x168117[_0xcd85('0x39')]=_['intersection'](_0x5a47b7['model'],qs[_0xcd85('0x3a')](_0x2c565a[_0xcd85('0x36')][_0xcd85('0x3a')]));_0x168117[_0xcd85('0x39')]=_0x168117[_0xcd85('0x39')]['length']?_0x168117[_0xcd85('0x39')]:_0x5a47b7[_0xcd85('0x35')];if(_0x2c565a[_0xcd85('0x36')]['includeAll']){_0x168117[_0xcd85('0x46')]=[{'all':!![]}];}_0x168117=_[_0xcd85('0x42')]({},_0x168117,_0x2c565a[_0xcd85('0x44')]);return db['ChatInternalMessage'][_0xcd85('0x4b')](_0x168117)[_0xcd85('0x27')](handleEntityNotFound(_0x162199,null))[_0xcd85('0x27')](respondWithResult(_0x162199,null))[_0xcd85('0x47')](handleError(_0x162199,null));};exports['create']=function(_0x3261b4,_0x12c204){return db[_0xcd85('0x30')][_0xcd85('0x4c')](_0x3261b4[_0xcd85('0x4d')],{})[_0xcd85('0x27')](respondWithResult(_0x12c204,0xc9))[_0xcd85('0x47')](handleError(_0x12c204,null));};exports[_0xcd85('0x4e')]=function(_0x3f8206,_0x27691c){if(_0x3f8206[_0xcd85('0x4d')]['id']){delete _0x3f8206[_0xcd85('0x4d')]['id'];}return db[_0xcd85('0x30')][_0xcd85('0x4b')]({'where':{'id':_0x3f8206[_0xcd85('0x49')]['id']}})['then'](handleEntityNotFound(_0x27691c,null))['then'](saveUpdates(_0x3f8206[_0xcd85('0x4d')],null))[_0xcd85('0x27')](respondWithResult(_0x27691c,null))[_0xcd85('0x47')](handleError(_0x27691c,null));};exports['destroy']=function(_0x1fcd15,_0x5f8065){return db[_0xcd85('0x30')][_0xcd85('0x4b')]({'where':{'id':_0x1fcd15[_0xcd85('0x49')]['id']}})[_0xcd85('0x27')](handleEntityNotFound(_0x5f8065,null))[_0xcd85('0x27')](removeEntity(_0x5f8065,null))[_0xcd85('0x47')](handleError(_0x5f8065,null));};exports[_0xcd85('0x4f')]=function(_0x544ec5,_0x46af01){return db['ChatInternalMessage']['describe']()[_0xcd85('0x27')](respondWithResult(_0x46af01,null))[_0xcd85('0x47')](handleError(_0x46af01,null));};function wrapUser(_0x44448a){return function(_0x3e3d69){var _0x5a8b3c=_0x44448a['get']({'plain':!![]});_0x5a8b3c[_0xcd85('0x50')]=[];if(_0x3e3d69){_0x5a8b3c[_0xcd85('0x51')]=_0x3e3d69['createdAt'];_0x5a8b3c[_0xcd85('0x52')]=_0x3e3d69;}else{_0x5a8b3c[_0xcd85('0x51')]=moment(0x0)[_0xcd85('0x53')](_0xcd85('0x54'));_0x5a8b3c[_0xcd85('0x52')]={};}return _0x5a8b3c;};}exports[_0xcd85('0x55')]=function(_0x404ad8,_0x5567e4,_0x1bb91f){var _0x500a67=[];return db[_0xcd85('0x56')][_0xcd85('0x57')]({'where':{'role':['agent',_0xcd85('0x58'),_0xcd85('0x59')]},'attributes':['id',_0xcd85('0x5a'),_0xcd85('0x2c'),_0xcd85('0x5b'),_0xcd85('0x5c'),_0xcd85('0x5d'),'online',_0xcd85('0x5e'),_0xcd85('0x5f'),_0xcd85('0x60')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xcd85('0x61'),'attributes':['id','name',_0xcd85('0x33')],'through':{'attributes':[]}}]})[_0xcd85('0x27')](function(_0x202885){if(_0x202885){var _0x7a702b=_0x404ad8[_0xcd85('0x59')][_0xcd85('0x62')]({'plain':!![]});if(!_0x7a702b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7a702b[_0xcd85('0x5b')]===_0xcd85('0x59')){return db[_0xcd85('0x63')][_0xcd85('0x4b')]({'where':{'name':_0xcd85('0x64'),'userProfileId':_0x7a702b[_0xcd85('0x65')]},'raw':!![]})[_0xcd85('0x27')](function(_0x41a268){if(_0x41a268){if(_0x41a268[_0xcd85('0x66')]===0x0){return db['UserProfileResource'][_0xcd85('0x57')]({'where':{'sectionId':_0x41a268['id']},'raw':!![]})[_0xcd85('0x27')](function(_0x34bf34){var _0x2f75b9=[];if(_[_0xcd85('0x67')](_0x34bf34)){_0x2f75b9=_[_0xcd85('0x41')](_0x202885,function(_0x366e57){if(_0x366e57['role']!=='agent'){return _0x366e57;}});return _0x2f75b9;}else{for(var _0x36557f=0x0;_0x36557f<_0x202885[_0xcd85('0x3b')];_0x36557f++){var _0x4a0722=_0x202885[_0x36557f];if(_0x4a0722[_0xcd85('0x5b')]===_0xcd85('0x68')){var _0x66c7d=_[_0xcd85('0x4b')](_0x34bf34,function(_0x5b2f5f){return _0x5b2f5f['resourceId']===_0x4a0722['id'];});if(_0x66c7d)_0x2f75b9[_0xcd85('0x69')](_0x4a0722);}else{_0x2f75b9[_0xcd85('0x69')](_0x4a0722);}}return _0x2f75b9;}});}else{return _0x202885;}}else{var _0xa16783=_[_0xcd85('0x41')](_0x202885,function(_0x16937f){if(_0x16937f[_0xcd85('0x5b')]!==_0xcd85('0x68')){return _0x16937f;}});return _0xa16783;}});}else{return _0x202885;}}})[_0xcd85('0x27')](function(_0x3bbed2){var _0x497686=[];if(_0x3bbed2){_0x500a67=_0x3bbed2;for(var _0x1eb301=0x0;_0x1eb301<_0x3bbed2[_0xcd85('0x3b')];_0x1eb301+=0x1){_0x500a67[_0x1eb301]['messages']=[];_0x497686['push'](db[_0xcd85('0x30')][_0xcd85('0x4b')]({'where':{'FromId':[_0x404ad8[_0xcd85('0x59')]['id'],_0x3bbed2[_0x1eb301]['id']],'ToId':[_0x404ad8[_0xcd85('0x59')]['id'],_0x3bbed2[_0x1eb301]['id']],'ChatGroupId':null},'attributes':['id',_0xcd85('0x6a'),_0xcd85('0x6b'),'ToId',_0xcd85('0x6c'),'body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xcd85('0x27')](wrapUser(_0x3bbed2[_0x1eb301])));}return BPromise[_0xcd85('0x6d')](_0x497686);}return[];})[_0xcd85('0x27')](function(_0x514085){return{'rows':_0x514085,'count':_0x514085['length']};})[_0xcd85('0x27')](respondWithResult(_0x5567e4,null))['catch'](handleError(_0x5567e4,null));}; \ No newline at end of file +var _0x15d6=['util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','name','index','map','ChatInternalMessage','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','order','where','filters','pick','merge','filter','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','User','admin','user','role','userpic','online','lastLoginAt','showWebBar','sort','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','resourceId','push','agent','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x594bdc,_0x59dec6){var _0xaa15a8=function(_0x432ba3){while(--_0x432ba3){_0x594bdc['push'](_0x594bdc['shift']());}};_0xaa15a8(++_0x59dec6);}(_0x15d6,0x1a1));var _0x615d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x15d6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x615d('0x0'));var rimraf=require(_0x615d('0x1'));var zipdir=require(_0x615d('0x2'));var jsonpatch=require(_0x615d('0x3'));var rp=require('request-promise');var moment=require(_0x615d('0x4'));var BPromise=require(_0x615d('0x5'));var Mustache=require(_0x615d('0x6'));var util=require(_0x615d('0x7'));var path=require(_0x615d('0x8'));var sox=require(_0x615d('0x9'));var csv=require(_0x615d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x615d('0xb'));var _=require(_0x615d('0xc'));var squel=require(_0x615d('0xd'));var crypto=require('crypto');var jsforce=require(_0x615d('0xe'));var deskjs=require(_0x615d('0xf'));var toCsv=require(_0x615d('0xa'));var querystring=require(_0x615d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x615d('0x11'));var qs=require(_0x615d('0x12'));var as=require(_0x615d('0x13'));var hardwareService=require(_0x615d('0x14'));var logger=require(_0x615d('0x15'))(_0x615d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x615d('0x17'));var db=require(_0x615d('0x18'))['db'];config[_0x615d('0x19')]=_[_0x615d('0x1a')](config[_0x615d('0x19')],{'host':_0x615d('0x1b'),'port':0x18eb});var socket=require(_0x615d('0x1c'))(new Redis(config[_0x615d('0x19')]));require(_0x615d('0x1d'))[_0x615d('0x1e')](socket);function respondWithStatusCode(_0x12b939,_0xfae288){_0xfae288=_0xfae288||0xcc;return function(_0x2f92c9){if(_0x2f92c9){return _0x12b939[_0x615d('0x1f')](_0xfae288);}return _0x12b939[_0x615d('0x20')](_0xfae288)[_0x615d('0x21')]();};}function respondWithResult(_0x4cad8b,_0x24cf06){_0x24cf06=_0x24cf06||0xc8;return function(_0x590ab8){if(_0x590ab8){return _0x4cad8b[_0x615d('0x20')](_0x24cf06)[_0x615d('0x22')](_0x590ab8);}};}function respondWithFilteredResult(_0x50361b,_0x228ee9){return function(_0x1eb7c1){if(_0x1eb7c1){var _0x2948a3=typeof _0x228ee9[_0x615d('0x23')]===_0x615d('0x24')&&typeof _0x228ee9[_0x615d('0x25')]===_0x615d('0x24');var _0x4bfc23=_0x1eb7c1['count'];var _0x3c5981=_0x2948a3?0x0:_0x228ee9[_0x615d('0x23')];var _0x24788a=_0x2948a3?_0x1eb7c1[_0x615d('0x26')]:_0x228ee9['offset']+_0x228ee9[_0x615d('0x25')];var _0x27c6c4;if(_0x24788a>=_0x4bfc23){_0x24788a=_0x4bfc23;_0x27c6c4=0xc8;}else{_0x27c6c4=0xce;}_0x50361b[_0x615d('0x20')](_0x27c6c4);return _0x50361b['set']('Content-Range',_0x3c5981+'-'+_0x24788a+'/'+_0x4bfc23)[_0x615d('0x22')](_0x1eb7c1);}return null;};}function patchUpdates(_0x433b2a){return function(_0x2d2f04){try{jsonpatch[_0x615d('0x27')](_0x2d2f04,_0x433b2a,!![]);}catch(_0x33384a){return BPromise[_0x615d('0x28')](_0x33384a);}return _0x2d2f04['save']();};}function saveUpdates(_0x535d90,_0xfb1cf0){return function(_0x140d1a){if(_0x140d1a){return _0x140d1a[_0x615d('0x29')](_0x535d90)[_0x615d('0x2a')](function(_0x11d966){return _0x11d966;});}return null;};}function removeEntity(_0x3b4e0f,_0x1d16fd){return function(_0x57d985){if(_0x57d985){return _0x57d985[_0x615d('0x2b')]()[_0x615d('0x2a')](function(){_0x3b4e0f[_0x615d('0x20')](0xcc)[_0x615d('0x21')]();});}};}function handleEntityNotFound(_0x4bc6ab,_0x1d5b2d){return function(_0x36d357){if(!_0x36d357){_0x4bc6ab[_0x615d('0x1f')](0x194);}return _0x36d357;};}function handleError(_0x475909,_0x4c3bb4){_0x4c3bb4=_0x4c3bb4||0x1f4;return function(_0x15909a){logger[_0x615d('0x2c')](_0x15909a['stack']);if(_0x15909a[_0x615d('0x2d')]){delete _0x15909a['name'];}_0x475909[_0x615d('0x20')](_0x4c3bb4)['send'](_0x15909a);};}exports[_0x615d('0x2e')]=function(_0x10339c,_0x5edd37){var _0x1229fa={},_0x12dd5={},_0xbcc10e={'count':0x0,'rows':[]};var _0x2e7e37=_[_0x615d('0x2f')](db[_0x615d('0x30')]['rawAttributes'],function(_0x334dbe){return{'name':_0x334dbe[_0x615d('0x31')],'type':_0x334dbe[_0x615d('0x32')][_0x615d('0x33')]};});_0x12dd5['model']=_[_0x615d('0x2f')](_0x2e7e37,_0x615d('0x2d'));_0x12dd5['query']=_['keys'](_0x10339c[_0x615d('0x34')]);_0x12dd5['filters']=_[_0x615d('0x35')](_0x12dd5[_0x615d('0x36')],_0x12dd5[_0x615d('0x34')]);_0x1229fa[_0x615d('0x37')]=_[_0x615d('0x35')](_0x12dd5[_0x615d('0x36')],qs[_0x615d('0x38')](_0x10339c[_0x615d('0x34')][_0x615d('0x38')]));_0x1229fa['attributes']=_0x1229fa[_0x615d('0x37')][_0x615d('0x39')]?_0x1229fa['attributes']:_0x12dd5[_0x615d('0x36')];if(!_0x10339c[_0x615d('0x34')]['hasOwnProperty'](_0x615d('0x3a'))){_0x1229fa[_0x615d('0x25')]=qs[_0x615d('0x25')](_0x10339c[_0x615d('0x34')][_0x615d('0x25')]);_0x1229fa[_0x615d('0x23')]=qs[_0x615d('0x23')](_0x10339c['query'][_0x615d('0x23')]);}_0x1229fa[_0x615d('0x3b')]=qs['sort'](_0x10339c[_0x615d('0x34')]['sort']);_0x1229fa[_0x615d('0x3c')]=qs[_0x615d('0x3d')](_[_0x615d('0x3e')](_0x10339c['query'],_0x12dd5[_0x615d('0x3d')]),_0x2e7e37);if(_0x10339c['query']['filter']){_0x1229fa[_0x615d('0x3c')]=_[_0x615d('0x3f')](_0x1229fa[_0x615d('0x3c')],{'$or':_[_0x615d('0x2f')](_0x2e7e37,function(_0x1b8e12){if(_0x1b8e12[_0x615d('0x32')]!=='VIRTUAL'){var _0x33529c={};_0x33529c[_0x1b8e12[_0x615d('0x2d')]]={'$like':'%'+_0x10339c[_0x615d('0x34')][_0x615d('0x40')]+'%'};return _0x33529c;}})});}_0x1229fa=_[_0x615d('0x3f')]({},_0x1229fa,_0x10339c['options']);var _0x1a097b={'where':_0x1229fa[_0x615d('0x3c')]};return db['ChatInternalMessage'][_0x615d('0x26')](_0x1a097b)[_0x615d('0x2a')](function(_0x5d00f0){_0xbcc10e[_0x615d('0x26')]=_0x5d00f0;if(_0x10339c[_0x615d('0x34')][_0x615d('0x41')]){_0x1229fa[_0x615d('0x42')]=[{'all':!![]}];}return db[_0x615d('0x30')][_0x615d('0x43')](_0x1229fa);})[_0x615d('0x2a')](function(_0xb59501){_0xbcc10e[_0x615d('0x44')]=_0xb59501;return _0xbcc10e;})['then'](respondWithFilteredResult(_0x5edd37,_0x1229fa))[_0x615d('0x45')](handleError(_0x5edd37,null));};exports[_0x615d('0x46')]=function(_0x5e1e86,_0x402fdb){var _0x3b07be={'raw':!![],'where':{'id':_0x5e1e86['params']['id']}},_0x3f6adb={};_0x3f6adb['model']=_[_0x615d('0x47')](db[_0x615d('0x30')]['rawAttributes']);_0x3f6adb[_0x615d('0x34')]=_[_0x615d('0x47')](_0x5e1e86[_0x615d('0x34')]);_0x3f6adb[_0x615d('0x3d')]=_[_0x615d('0x35')](_0x3f6adb[_0x615d('0x36')],_0x3f6adb[_0x615d('0x34')]);_0x3b07be['attributes']=_[_0x615d('0x35')](_0x3f6adb[_0x615d('0x36')],qs[_0x615d('0x38')](_0x5e1e86['query'][_0x615d('0x38')]));_0x3b07be[_0x615d('0x37')]=_0x3b07be[_0x615d('0x37')][_0x615d('0x39')]?_0x3b07be[_0x615d('0x37')]:_0x3f6adb['model'];if(_0x5e1e86[_0x615d('0x34')][_0x615d('0x41')]){_0x3b07be['include']=[{'all':!![]}];}_0x3b07be=_[_0x615d('0x3f')]({},_0x3b07be,_0x5e1e86[_0x615d('0x48')]);return db[_0x615d('0x30')][_0x615d('0x49')](_0x3b07be)['then'](handleEntityNotFound(_0x402fdb,null))[_0x615d('0x2a')](respondWithResult(_0x402fdb,null))[_0x615d('0x45')](handleError(_0x402fdb,null));};exports[_0x615d('0x4a')]=function(_0x483757,_0x1e0674){return db[_0x615d('0x30')][_0x615d('0x4a')](_0x483757[_0x615d('0x4b')],{})['then'](respondWithResult(_0x1e0674,0xc9))['catch'](handleError(_0x1e0674,null));};exports['update']=function(_0x5ec666,_0x2f13ef){if(_0x5ec666['body']['id']){delete _0x5ec666['body']['id'];}return db[_0x615d('0x30')][_0x615d('0x49')]({'where':{'id':_0x5ec666[_0x615d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f13ef,null))['then'](saveUpdates(_0x5ec666[_0x615d('0x4b')],null))[_0x615d('0x2a')](respondWithResult(_0x2f13ef,null))[_0x615d('0x45')](handleError(_0x2f13ef,null));};exports[_0x615d('0x2b')]=function(_0x387a99,_0x518956){return db['ChatInternalMessage'][_0x615d('0x49')]({'where':{'id':_0x387a99[_0x615d('0x4c')]['id']}})[_0x615d('0x2a')](handleEntityNotFound(_0x518956,null))[_0x615d('0x2a')](removeEntity(_0x518956,null))[_0x615d('0x45')](handleError(_0x518956,null));};exports[_0x615d('0x4d')]=function(_0x9c1b53,_0x152baa){return db[_0x615d('0x30')][_0x615d('0x4d')]()[_0x615d('0x2a')](respondWithResult(_0x152baa,null))[_0x615d('0x45')](handleError(_0x152baa,null));};function wrapUser(_0x9ca57f){return function(_0xc6a4c){var _0x1c0d31=_0x9ca57f[_0x615d('0x4e')]({'plain':!![]});_0x1c0d31[_0x615d('0x4f')]=[];if(_0xc6a4c){_0x1c0d31[_0x615d('0x50')]=_0xc6a4c[_0x615d('0x51')];_0x1c0d31[_0x615d('0x52')]=_0xc6a4c;}else{_0x1c0d31[_0x615d('0x50')]=moment(0x0)[_0x615d('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c0d31[_0x615d('0x52')]={};}return _0x1c0d31;};}exports['getUsers']=function(_0x370ce2,_0x25bcec,_0x898519){var _0x4eb26e=[];return db[_0x615d('0x54')]['findAll']({'where':{'role':['agent',_0x615d('0x55'),_0x615d('0x56')]},'attributes':['id','fullname',_0x615d('0x2d'),_0x615d('0x57'),_0x615d('0x58'),'internal',_0x615d('0x59'),_0x615d('0x5a'),'allowmessenger',_0x615d('0x5b')],'order':qs[_0x615d('0x5c')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x615d('0x5d'),'attributes':['id',_0x615d('0x2d'),_0x615d('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x848e35){if(_0x848e35){var _0x30c339=_0x370ce2['user'][_0x615d('0x4e')]({'plain':!![]});if(!_0x30c339)throw new Error(_0x615d('0x5e'));if(_0x30c339['role']==='user'){return db[_0x615d('0x5f')]['find']({'where':{'name':'Agents','userProfileId':_0x30c339[_0x615d('0x60')]},'raw':!![]})[_0x615d('0x2a')](function(_0x2bc3c9){if(_0x2bc3c9){if(_0x2bc3c9[_0x615d('0x61')]===0x0){return db[_0x615d('0x62')][_0x615d('0x43')]({'where':{'sectionId':_0x2bc3c9['id']},'raw':!![]})[_0x615d('0x2a')](function(_0x18077a){var _0x1f1535=[];if(_['isEmpty'](_0x18077a)){_0x1f1535=_[_0x615d('0x40')](_0x848e35,function(_0x36e7c5){if(_0x36e7c5['role']!=='agent'){return _0x36e7c5;}});return _0x1f1535;}else{for(var _0x5d6399=0x0;_0x5d6399<_0x848e35[_0x615d('0x39')];_0x5d6399++){var _0x5199e8=_0x848e35[_0x5d6399];if(_0x5199e8[_0x615d('0x57')]==='agent'){var _0x50a168=_[_0x615d('0x49')](_0x18077a,function(_0x18fb3a){return _0x18fb3a[_0x615d('0x63')]===_0x5199e8['id'];});if(_0x50a168)_0x1f1535['push'](_0x5199e8);}else{_0x1f1535[_0x615d('0x64')](_0x5199e8);}}return _0x1f1535;}});}else{return _0x848e35;}}else{var _0x5cc25c=_[_0x615d('0x40')](_0x848e35,function(_0x420cd2){if(_0x420cd2['role']!==_0x615d('0x65')){return _0x420cd2;}});return _0x5cc25c;}});}else{return _0x848e35;}}})['then'](function(_0xbd6ed3){var _0x165ff7=[];if(_0xbd6ed3){_0x4eb26e=_0xbd6ed3;for(var _0x1a26ba=0x0;_0x1a26ba<_0xbd6ed3[_0x615d('0x39')];_0x1a26ba+=0x1){_0x4eb26e[_0x1a26ba]['messages']=[];_0x165ff7[_0x615d('0x64')](db[_0x615d('0x30')][_0x615d('0x49')]({'where':{'FromId':[_0x370ce2['user']['id'],_0xbd6ed3[_0x1a26ba]['id']],'ToId':[_0x370ce2[_0x615d('0x56')]['id'],_0xbd6ed3[_0x1a26ba]['id']],'ChatGroupId':null},'attributes':['id',_0x615d('0x51'),_0x615d('0x66'),_0x615d('0x67'),_0x615d('0x68'),_0x615d('0x4b')],'order':qs[_0x615d('0x5c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x615d('0x2a')](wrapUser(_0xbd6ed3[_0x1a26ba])));}return BPromise[_0x615d('0x69')](_0x165ff7);}return[];})[_0x615d('0x2a')](function(_0x44fda0){return{'rows':_0x44fda0,'count':_0x44fda0[_0x615d('0x39')]};})[_0x615d('0x2a')](respondWithResult(_0x25bcec,null))[_0x615d('0x45')](handleError(_0x25bcec,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a64ee07..8bfc7cb 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 _0x9727=['save','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x42582c,_0x1cb457){var _0x310852=function(_0x305036){while(--_0x305036){_0x42582c['push'](_0x42582c['shift']());}};_0x310852(++_0x1cb457);}(_0x9727,0xcd));var _0x7972=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x9727[_0x4e6eb2];return _0x4e0c1c;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x7972('0x0'))['db'][_0x7972('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x7972('0x2')](0x0);var events={'afterCreate':_0x7972('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1132eb){return function(_0x160751,_0x4e4a69,_0x485134){ChatInternalMessageEvents['emit'](_0x1132eb+':'+_0x160751['id'],_0x160751);ChatInternalMessageEvents[_0x7972('0x4')](_0x1132eb,_0x160751);_0x485134(null);};}for(var e in events){if(events[_0x7972('0x5')](e)){var event=events[e];ChatInternalMessage[_0x7972('0x6')](e,emitEvent(event));}}module[_0x7972('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x38fe=['hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','emit'];(function(_0x31f001,_0x5230fa){var _0x5d293e=function(_0x219b95){while(--_0x219b95){_0x31f001['push'](_0x31f001['shift']());}};_0x5d293e(++_0x5230fa);}(_0x38fe,0xfa));var _0xe38f=function(_0x50aa1e,_0x808adb){_0x50aa1e=_0x50aa1e-0x0;var _0x42a829=_0x38fe[_0x50aa1e];return _0x42a829;};'use strict';var EventEmitter=require(_0xe38f('0x0'));var ChatInternalMessage=require(_0xe38f('0x1'))['db'][_0xe38f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe38f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe38f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4490f0){return function(_0x39a4dc,_0x31e260,_0x5dd65f){ChatInternalMessageEvents[_0xe38f('0x5')](_0x4490f0+':'+_0x39a4dc['id'],_0x39a4dc);ChatInternalMessageEvents[_0xe38f('0x5')](_0x4490f0,_0x39a4dc);_0x5dd65f(null);};}for(var e in events){if(events[_0xe38f('0x6')](e)){var event=events[e];ChatInternalMessage[_0xe38f('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8f9525e..867e6ee 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 _0x81f5=['utf8mb4','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x81f5,0xcd));var _0x581f=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x81f5[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var util=require(_0x581f('0x0'));var logger=require(_0x581f('0x1'))(_0x581f('0x2'));var moment=require('moment');var BPromise=require(_0x581f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x581f('0x4'));var rimraf=require(_0x581f('0x5'));var config=require(_0x581f('0x6'));var attributes=require(_0x581f('0x7'));module[_0x581f('0x8')]=function(_0x21ac48,_0x19c789){return _0x21ac48[_0x581f('0x9')](_0x581f('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x581f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1595=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x1595,0xdd));var _0x5159=function(_0x28886c,_0x21ff2c){_0x28886c=_0x28886c-0x0;var _0x2f6dcc=_0x1595[_0x28886c];return _0x2f6dcc;};'use strict';var _=require(_0x5159('0x0'));var util=require('util');var logger=require(_0x5159('0x1'))(_0x5159('0x2'));var moment=require(_0x5159('0x3'));var BPromise=require('bluebird');var rp=require(_0x5159('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5159('0x5'));var config=require(_0x5159('0x6'));var attributes=require(_0x5159('0x7'));module[_0x5159('0x8')]=function(_0x19c1da,_0x56c799){return _0x19c1da[_0x5159('0x9')](_0x5159('0xa'),attributes,{'tableName':_0x5159('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5159('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 324c640..bbf6a7d 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 _0x8630=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','info','catch'];(function(_0x246a3f,_0x5ec46d){var _0x390359=function(_0x53f8a0){while(--_0x53f8a0){_0x246a3f['push'](_0x246a3f['shift']());}};_0x390359(++_0x5ec46d);}(_0x8630,0x177));var _0x0863=function(_0x509532,_0x49cae7){_0x509532=_0x509532-0x0;var _0x393ae7=_0x8630[_0x509532];return _0x393ae7;};'use strict';var _=require(_0x0863('0x0'));var util=require(_0x0863('0x1'));var moment=require(_0x0863('0x2'));var BPromise=require(_0x0863('0x3'));var rs=require(_0x0863('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0863('0x5'));var logger=require(_0x0863('0x6'))(_0x0863('0x7'));var config=require(_0x0863('0x8'));var jayson=require(_0x0863('0x9'));var client=jayson[_0x0863('0xa')][_0x0863('0xb')]({'port':0x232a});config[_0x0863('0xc')]=_['defaults'](config[_0x0863('0xc')],{'host':_0x0863('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0863('0xc')]));require('./chatInternalMessage.socket')[_0x0863('0xe')](socket);function respondWithRpcPromise(_0x39b154,_0x5e9dc9,_0x48305e){return new BPromise(function(_0x2d00d2,_0xf811b5){return client[_0x0863('0xf')](_0x39b154,_0x48305e)[_0x0863('0x10')](function(_0x361dd7){logger['info'](_0x0863('0x11'),_0x5e9dc9,_0x0863('0x12'));logger[_0x0863('0x13')](_0x0863('0x14'),_0x5e9dc9,_0x0863('0x12'),JSON['stringify'](_0x361dd7));if(_0x361dd7[_0x0863('0x15')]){if(_0x361dd7[_0x0863('0x15')]['code']===0x1f4){logger[_0x0863('0x15')](_0x0863('0x11'),_0x5e9dc9,_0x361dd7[_0x0863('0x15')][_0x0863('0x16')]);return _0xf811b5(_0x361dd7['error']['message']);}logger[_0x0863('0x15')](_0x0863('0x11'),_0x5e9dc9,_0x361dd7['error'][_0x0863('0x16')]);return _0x2d00d2(_0x361dd7[_0x0863('0x15')][_0x0863('0x16')]);}else{logger[_0x0863('0x17')](_0x0863('0x11'),_0x5e9dc9,'request\x20sent');_0x2d00d2(_0x361dd7['result']['message']);}})[_0x0863('0x18')](function(_0x7b79bd){logger['error'](_0x0863('0x11'),_0x5e9dc9,_0x7b79bd);_0xf811b5(_0x7b79bd);});});} \ No newline at end of file +var _0x6a5c=['localhost','register','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x50fef1,_0x1c06a1){var _0x2c19a6=function(_0x157d21){while(--_0x157d21){_0x50fef1['push'](_0x50fef1['shift']());}};_0x2c19a6(++_0x1c06a1);}(_0x6a5c,0x9d));var _0xc6a5=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0x6a5c[_0x5c4d27];return _0x1dda1a;};'use strict';var _=require('lodash');var util=require(_0xc6a5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc6a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6a5('0x2'))['db'];var utils=require(_0xc6a5('0x3'));var logger=require(_0xc6a5('0x4'))(_0xc6a5('0x5'));var config=require(_0xc6a5('0x6'));var jayson=require(_0xc6a5('0x7'));var client=jayson[_0xc6a5('0x8')]['http']({'port':0x232a});config[_0xc6a5('0x9')]=_[_0xc6a5('0xa')](config['redis'],{'host':_0xc6a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xc6a5('0xc')](socket);function respondWithRpcPromise(_0x25a9a7,_0x343355,_0x20c0cf){return new BPromise(function(_0x45f517,_0x25d88a){return client['request'](_0x25a9a7,_0x20c0cf)[_0xc6a5('0xd')](function(_0x3e1165){logger[_0xc6a5('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x343355,_0xc6a5('0xf'));logger[_0xc6a5('0x10')](_0xc6a5('0x11'),_0x343355,_0xc6a5('0xf'),JSON[_0xc6a5('0x12')](_0x3e1165));if(_0x3e1165['error']){if(_0x3e1165[_0xc6a5('0x13')][_0xc6a5('0x14')]===0x1f4){logger[_0xc6a5('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x343355,_0x3e1165['error']['message']);return _0x25d88a(_0x3e1165['error'][_0xc6a5('0x15')]);}logger['error'](_0xc6a5('0x16'),_0x343355,_0x3e1165[_0xc6a5('0x13')][_0xc6a5('0x15')]);return _0x45f517(_0x3e1165[_0xc6a5('0x13')][_0xc6a5('0x15')]);}else{logger['info'](_0xc6a5('0x16'),_0x343355,_0xc6a5('0xf'));_0x45f517(_0x3e1165[_0xc6a5('0x17')][_0xc6a5('0x15')]);}})['catch'](function(_0x2efade){logger[_0xc6a5('0x13')](_0xc6a5('0x16'),_0x343355,_0x2efade);_0x25d88a(_0x2efade);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 37c2146..c94bee9 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 _0xa136=['chatInternalMessage:','save','remove','removeListener'];(function(_0x341da6,_0x56f1c9){var _0x42e233=function(_0x1dc352){while(--_0x1dc352){_0x341da6['push'](_0x341da6['shift']());}};_0x42e233(++_0x56f1c9);}(_0xa136,0xe5));var _0x6a13=function(_0x26ac6b,_0x3e0e21){_0x26ac6b=_0x26ac6b-0x0;var _0x1972ec=_0xa136[_0x26ac6b];return _0x1972ec;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x6a13('0x0'),_0x6a13('0x1'),'update'];function createListener(_0xaaf092,_0x2b1256){return function(_0x551695){_0x2b1256['emit'](_0xaaf092,_0x551695);};}function removeListener(_0x48be4c,_0x58a557){return function(){ChatInternalMessageEvents[_0x6a13('0x2')](_0x48be4c,_0x58a557);};}exports['register']=function(_0x53ff4c){for(var _0x206c94=0x0,_0x321fcf=events['length'];_0x206c94<_0x321fcf;_0x206c94++){var _0x53c5a3=events[_0x206c94];var _0x7079fd=createListener(_0x6a13('0x3')+_0x53c5a3,_0x53ff4c);ChatInternalMessageEvents['on'](_0x53c5a3,_0x7079fd);}}; \ No newline at end of file +var _0x29f4=['emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save','update'];(function(_0x2d5b18,_0x417b77){var _0xec7fb1=function(_0x5e3da9){while(--_0x5e3da9){_0x2d5b18['push'](_0x2d5b18['shift']());}};_0xec7fb1(++_0x417b77);}(_0x29f4,0x193));var _0x429f=function(_0x1cdae4,_0x1fb738){_0x1cdae4=_0x1cdae4-0x0;var _0x362f6e=_0x29f4[_0x1cdae4];return _0x362f6e;};'use strict';var ChatInternalMessageEvents=require(_0x429f('0x0'));var events=[_0x429f('0x1'),'remove',_0x429f('0x2')];function createListener(_0x458518,_0x10fd4b){return function(_0x268f41){_0x10fd4b[_0x429f('0x3')](_0x458518,_0x268f41);};}function removeListener(_0x3df8f1,_0x12ce71){return function(){ChatInternalMessageEvents[_0x429f('0x4')](_0x3df8f1,_0x12ce71);};}exports[_0x429f('0x5')]=function(_0x4aede8){for(var _0x272d27=0x0,_0x33c85f=events['length'];_0x272d27<_0x33c85f;_0x272d27++){var _0x12253f=events[_0x272d27];var _0x399db2=createListener(_0x429f('0x6')+_0x12253f,_0x4aede8);ChatInternalMessageEvents['on'](_0x12253f,_0x399db2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c7ba2d4..0553d67 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 _0xc55c=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/users','post','put','/:id'];(function(_0x5454ad,_0x4b396f){var _0x398a2d=function(_0xc2460){while(--_0xc2460){_0x5454ad['push'](_0x5454ad['shift']());}};_0x398a2d(++_0x4b396f);}(_0xc55c,0x10d));var _0xcc55=function(_0x470089,_0x5ce6dd){_0x470089=_0x470089-0x0;var _0x13dbb7=_0xc55c[_0x470089];return _0x13dbb7;};'use strict';var multer=require(_0xcc55('0x0'));var util=require(_0xcc55('0x1'));var path=require(_0xcc55('0x2'));var timeout=require(_0xcc55('0x3'));var express=require(_0xcc55('0x4'));var router=express[_0xcc55('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc55('0x6'));var interaction=require(_0xcc55('0x7'));var config=require(_0xcc55('0x8'));var controller=require('./chatInternalMessage.controller');router[_0xcc55('0x9')]('/',auth[_0xcc55('0xa')](),controller['index']);router[_0xcc55('0x9')](_0xcc55('0xb'),auth[_0xcc55('0xa')](),controller['describe']);router[_0xcc55('0x9')](_0xcc55('0xc'),auth[_0xcc55('0xa')](),controller['getUsers']);router['get']('/:id',auth[_0xcc55('0xa')](),controller['show']);router[_0xcc55('0xd')]('/',auth[_0xcc55('0xa')](),controller['create']);router[_0xcc55('0xe')](_0xcc55('0xf'),controller['update']);router[_0xcc55('0x10')](_0xcc55('0xf'),auth[_0xcc55('0xa')](),controller[_0xcc55('0x11')]);module[_0xcc55('0x12')]=router; \ No newline at end of file +var _0x3f31=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','delete','exports','multer','util','express'];(function(_0x564224,_0x596272){var _0x1a9c0a=function(_0x47021a){while(--_0x47021a){_0x564224['push'](_0x564224['shift']());}};_0x1a9c0a(++_0x596272);}(_0x3f31,0x95));var _0x13f3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3f31[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x13f3('0x0'));var util=require(_0x13f3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x13f3('0x2'));var router=express[_0x13f3('0x3')]();var fs_extra=require(_0x13f3('0x4'));var auth=require(_0x13f3('0x5'));var interaction=require(_0x13f3('0x6'));var config=require(_0x13f3('0x7'));var controller=require(_0x13f3('0x8'));router[_0x13f3('0x9')]('/',auth[_0x13f3('0xa')](),controller['index']);router[_0x13f3('0x9')](_0x13f3('0xb'),auth[_0x13f3('0xa')](),controller[_0x13f3('0xc')]);router['get']('/users',auth[_0x13f3('0xa')](),controller['getUsers']);router['get'](_0x13f3('0xd'),auth[_0x13f3('0xa')](),controller[_0x13f3('0xe')]);router[_0x13f3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x13f3('0x10')](_0x13f3('0xd'),controller['update']);router[_0x13f3('0x11')](_0x13f3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x13f3('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 396bd0e..67bd652 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 _0x082b=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x1637ff,_0x13cc42){var _0x3f6d4d=function(_0x162bb6){while(--_0x162bb6){_0x1637ff['push'](_0x1637ff['shift']());}};_0x3f6d4d(++_0x13cc42);}(_0x082b,0x1ec));var _0xb082=function(_0x5b7327,_0x3da7cc){_0x5b7327=_0x5b7327-0x0;var _0x1518a1=_0x082b[_0x5b7327];return _0x1518a1;};'use strict';var Sequelize=require(_0xb082('0x0'));module[_0xb082('0x1')]={'body':{'type':Sequelize[_0xb082('0x2')](_0xb082('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb082('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb082('0x5')]('in','out'),'defaultValue':_0xb082('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb082('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb082('0x2')]}}; \ No newline at end of file +var _0xdaa8=['TEXT','medium','STRING','sequelize','exports'];(function(_0x9b11f0,_0x82f350){var _0x246d2d=function(_0x11caf8){while(--_0x11caf8){_0x9b11f0['push'](_0x9b11f0['shift']());}};_0x246d2d(++_0x82f350);}(_0xdaa8,0xe4));var _0x8daa=function(_0x1744f4,_0x34e39){_0x1744f4=_0x1744f4-0x0;var _0x508288=_0xdaa8[_0x1744f4];return _0x508288;};'use strict';var Sequelize=require(_0x8daa('0x0'));module[_0x8daa('0x1')]={'body':{'type':Sequelize[_0x8daa('0x2')](_0x8daa('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x8daa('0x4')]},'providerResponse':{'type':Sequelize[_0x8daa('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index ee04a71..ba4e868 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 _0x89ea=['motionChannel','event','EventManager','acceptmessage','parse','formData','reject','RejectMessage','rejectMessage','Sequelize','contact','rejectmessage','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','set','json','apply','save','update','destroy','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel'];(function(_0x57440f,_0x50abb8){var _0x4fdd62=function(_0x132dfd){while(--_0x132dfd){_0x57440f['push'](_0x57440f['shift']());}};_0x4fdd62(++_0x50abb8);}(_0x89ea,0x189));var _0xa89e=function(_0x18b9a8,_0x1770b6){_0x18b9a8=_0x18b9a8-0x0;var _0x4a0a8f=_0x89ea[_0x18b9a8];return _0x4a0a8f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa89e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa89e('0x1'));var moment=require(_0xa89e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa89e('0x3'));var path=require(_0xa89e('0x4'));var sox=require(_0xa89e('0x5'));var csv=require(_0xa89e('0x6'));var ejs=require(_0xa89e('0x7'));var fs=require('fs');var fs_extra=require(_0xa89e('0x8'));var _=require('lodash');var squel=require(_0xa89e('0x9'));var crypto=require(_0xa89e('0xa'));var jsforce=require(_0xa89e('0xb'));var deskjs=require(_0xa89e('0xc'));var toCsv=require(_0xa89e('0x6'));var querystring=require('querystring');var Papa=require(_0xa89e('0xd'));var Redis=require(_0xa89e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa89e('0xf'));var as=require(_0xa89e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa89e('0x11'));var config=require(_0xa89e('0x12'));var licenseUtil=require(_0xa89e('0x13'));var db=require('../../mysqldb')['db'];config[_0xa89e('0x14')]=_[_0xa89e('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa89e('0x16'))(new Redis(config[_0xa89e('0x14')]));require('./chatMessage.socket')[_0xa89e('0x17')](socket);var jayson=require(_0xa89e('0x18'));var client=jayson['client'][_0xa89e('0x19')]({'port':0x232c});var client9002=jayson['client'][_0xa89e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3945e6,_0x2078c4,_0x46e087,_0x53baab){return new BPromise(function(_0x42b169,_0x18793c){var _0x31901f=_0x53baab||client;return _0x31901f[_0xa89e('0x1a')](_0x3945e6,_0x46e087)[_0xa89e('0x1b')](function(_0x1a61a1){logger[_0xa89e('0x1c')](_0xa89e('0x1d'),_0x2078c4,_0xa89e('0x1e'));logger[_0xa89e('0x1f')](_0xa89e('0x20'),_0x2078c4,_0xa89e('0x1e'),JSON[_0xa89e('0x21')](_0x1a61a1));if(_0x1a61a1[_0xa89e('0x22')]){if(_0x1a61a1[_0xa89e('0x22')][_0xa89e('0x23')]===0x1f4){logger['error'](_0xa89e('0x1d'),_0x2078c4,_0x1a61a1['error']['message']);return _0x18793c(_0x1a61a1['error'][_0xa89e('0x24')]);}logger['error'](_0xa89e('0x1d'),_0x2078c4,_0x1a61a1[_0xa89e('0x22')]['message']);return _0x42b169(_0x1a61a1[_0xa89e('0x22')][_0xa89e('0x24')]);}else{logger[_0xa89e('0x1c')]('ChatMessage,\x20%s,\x20%s',_0x2078c4,_0xa89e('0x1e'));_0x42b169(_0x1a61a1[_0xa89e('0x25')][_0xa89e('0x24')]);}})[_0xa89e('0x26')](function(_0x4d643f){logger[_0xa89e('0x22')](_0xa89e('0x1d'),_0x2078c4,_0x4d643f);_0x18793c(_0x4d643f);});});}function respondWithStatusCode(_0x2f9d1a,_0x19aaf6){_0x19aaf6=_0x19aaf6||0xcc;return function(_0x2d1879){if(_0x2d1879){return _0x2f9d1a['sendStatus'](_0x19aaf6);}return _0x2f9d1a[_0xa89e('0x27')](_0x19aaf6)[_0xa89e('0x28')]();};}function respondWithResult(_0x258d11,_0x46157d){_0x46157d=_0x46157d||0xc8;return function(_0x2c7f7a){if(_0x2c7f7a){return _0x258d11[_0xa89e('0x27')](_0x46157d)['json'](_0x2c7f7a);}};}function respondWithFilteredResult(_0x3002d4,_0xbdea57){return function(_0x5e8945){if(_0x5e8945){var _0x3af510=typeof _0xbdea57[_0xa89e('0x29')]===_0xa89e('0x2a')&&typeof _0xbdea57['limit']===_0xa89e('0x2a');var _0x4c6652=_0x5e8945[_0xa89e('0x2b')];var _0x2e4f50=_0x3af510?0x0:_0xbdea57[_0xa89e('0x29')];var _0x503c31=_0x3af510?_0x5e8945[_0xa89e('0x2b')]:_0xbdea57['offset']+_0xbdea57[_0xa89e('0x2c')];var _0x47cbc0;if(_0x503c31>=_0x4c6652){_0x503c31=_0x4c6652;_0x47cbc0=0xc8;}else{_0x47cbc0=0xce;}_0x3002d4[_0xa89e('0x27')](_0x47cbc0);return _0x3002d4[_0xa89e('0x2d')]('Content-Range',_0x2e4f50+'-'+_0x503c31+'/'+_0x4c6652)[_0xa89e('0x2e')](_0x5e8945);}return null;};}function patchUpdates(_0x5c1275){return function(_0x4f3e13){try{jsonpatch[_0xa89e('0x2f')](_0x4f3e13,_0x5c1275,!![]);}catch(_0x3ea06e){return BPromise['reject'](_0x3ea06e);}return _0x4f3e13[_0xa89e('0x30')]();};}function saveUpdates(_0x31406f,_0x1538d5){return function(_0x3db15e){if(_0x3db15e){return _0x3db15e[_0xa89e('0x31')](_0x31406f)[_0xa89e('0x1b')](function(_0x1de665){return _0x1de665;});}return null;};}function removeEntity(_0x4525bd,_0x32d8ec){return function(_0x164ea9){if(_0x164ea9){return _0x164ea9[_0xa89e('0x32')]()[_0xa89e('0x1b')](function(){_0x4525bd[_0xa89e('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd472,_0x111002){return function(_0x40a7dc){if(!_0x40a7dc){_0x3cd472[_0xa89e('0x33')](0x194);}return _0x40a7dc;};}function handleError(_0x23d973,_0x242d55){_0x242d55=_0x242d55||0x1f4;return function(_0x2bc582){logger[_0xa89e('0x22')](_0x2bc582[_0xa89e('0x34')]);if(_0x2bc582[_0xa89e('0x35')]){delete _0x2bc582['name'];}_0x23d973[_0xa89e('0x27')](_0x242d55)[_0xa89e('0x36')](_0x2bc582);};}exports[_0xa89e('0x37')]=function(_0x397448,_0x2662cc){var _0x56726d={},_0x147207={},_0x79ca20={'count':0x0,'rows':[]};var _0x5a11f5=_[_0xa89e('0x38')](db[_0xa89e('0x39')][_0xa89e('0x3a')],function(_0x1f2e48){return{'name':_0x1f2e48[_0xa89e('0x3b')],'type':_0x1f2e48[_0xa89e('0x3c')][_0xa89e('0x3d')]};});_0x147207[_0xa89e('0x3e')]=_[_0xa89e('0x38')](_0x5a11f5,_0xa89e('0x35'));_0x147207[_0xa89e('0x3f')]=_['keys'](_0x397448[_0xa89e('0x3f')]);_0x147207[_0xa89e('0x40')]=_[_0xa89e('0x41')](_0x147207[_0xa89e('0x3e')],_0x147207[_0xa89e('0x3f')]);_0x56726d['attributes']=_[_0xa89e('0x41')](_0x147207[_0xa89e('0x3e')],qs['fields'](_0x397448[_0xa89e('0x3f')][_0xa89e('0x42')]));_0x56726d[_0xa89e('0x43')]=_0x56726d[_0xa89e('0x43')]['length']?_0x56726d[_0xa89e('0x43')]:_0x147207[_0xa89e('0x3e')];if(!_0x397448[_0xa89e('0x3f')][_0xa89e('0x44')](_0xa89e('0x45'))){_0x56726d[_0xa89e('0x2c')]=qs[_0xa89e('0x2c')](_0x397448[_0xa89e('0x3f')][_0xa89e('0x2c')]);_0x56726d[_0xa89e('0x29')]=qs['offset'](_0x397448[_0xa89e('0x3f')][_0xa89e('0x29')]);}_0x56726d['order']=qs[_0xa89e('0x46')](_0x397448[_0xa89e('0x3f')][_0xa89e('0x46')]);_0x56726d[_0xa89e('0x47')]=qs['filters'](_[_0xa89e('0x48')](_0x397448[_0xa89e('0x3f')],_0x147207['filters']),_0x5a11f5);if(_0x397448[_0xa89e('0x3f')][_0xa89e('0x49')]){_0x56726d[_0xa89e('0x47')]=_[_0xa89e('0x4a')](_0x56726d['where'],{'$or':_[_0xa89e('0x38')](_0x5a11f5,function(_0x3e08ee){if(_0x3e08ee[_0xa89e('0x3c')]!=='VIRTUAL'){var _0x1ed615={};_0x1ed615[_0x3e08ee['name']]={'$like':'%'+_0x397448[_0xa89e('0x3f')][_0xa89e('0x49')]+'%'};return _0x1ed615;}})});}_0x56726d=_[_0xa89e('0x4a')]({},_0x56726d,_0x397448[_0xa89e('0x4b')]);var _0x51e3bc={'where':_0x56726d[_0xa89e('0x47')]};return db[_0xa89e('0x39')]['count'](_0x51e3bc)[_0xa89e('0x1b')](function(_0x3265bf){_0x79ca20['count']=_0x3265bf;if(_0x397448['query'][_0xa89e('0x4c')]){_0x56726d[_0xa89e('0x4d')]=[{'all':!![]}];}return db[_0xa89e('0x39')][_0xa89e('0x4e')](_0x56726d);})[_0xa89e('0x1b')](function(_0x21245b){_0x79ca20[_0xa89e('0x4f')]=_0x21245b;return _0x79ca20;})[_0xa89e('0x1b')](respondWithFilteredResult(_0x2662cc,_0x56726d))[_0xa89e('0x26')](handleError(_0x2662cc,null));};exports['show']=function(_0xbdf256,_0xc9061c){var _0x2d5437={'raw':!![],'where':{'id':_0xbdf256[_0xa89e('0x50')]['id']}},_0x1254d6={};_0x1254d6[_0xa89e('0x3e')]=_[_0xa89e('0x51')](db[_0xa89e('0x39')][_0xa89e('0x3a')]);_0x1254d6[_0xa89e('0x3f')]=_['keys'](_0xbdf256[_0xa89e('0x3f')]);_0x1254d6[_0xa89e('0x40')]=_['intersection'](_0x1254d6[_0xa89e('0x3e')],_0x1254d6['query']);_0x2d5437['attributes']=_[_0xa89e('0x41')](_0x1254d6['model'],qs[_0xa89e('0x42')](_0xbdf256[_0xa89e('0x3f')][_0xa89e('0x42')]));_0x2d5437['attributes']=_0x2d5437[_0xa89e('0x43')]['length']?_0x2d5437[_0xa89e('0x43')]:_0x1254d6[_0xa89e('0x3e')];if(_0xbdf256['query'][_0xa89e('0x4c')]){_0x2d5437['include']=[{'all':!![]}];}_0x2d5437=_['merge']({},_0x2d5437,_0xbdf256['options']);return db['ChatMessage'][_0xa89e('0x52')](_0x2d5437)['then'](handleEntityNotFound(_0xc9061c,null))[_0xa89e('0x1b')](respondWithResult(_0xc9061c,null))[_0xa89e('0x26')](handleError(_0xc9061c,null));};exports[_0xa89e('0x53')]=function(_0x4cb583,_0x4831e9){return db['ChatMessage'][_0xa89e('0x53')](_0x4cb583[_0xa89e('0x54')],{})[_0xa89e('0x1b')](respondWithResult(_0x4831e9,0xc9))[_0xa89e('0x26')](handleError(_0x4831e9,null));};exports[_0xa89e('0x31')]=function(_0x4b9412,_0x505ced){if(_0x4b9412[_0xa89e('0x54')]['id']){delete _0x4b9412['body']['id'];}return db['ChatMessage'][_0xa89e('0x52')]({'where':{'id':_0x4b9412['params']['id']}})[_0xa89e('0x1b')](handleEntityNotFound(_0x505ced,null))[_0xa89e('0x1b')](saveUpdates(_0x4b9412['body'],null))[_0xa89e('0x1b')](respondWithResult(_0x505ced,null))[_0xa89e('0x26')](handleError(_0x505ced,null));};exports[_0xa89e('0x32')]=function(_0x30d694,_0x5abe76){return db[_0xa89e('0x39')][_0xa89e('0x52')]({'where':{'id':_0x30d694['params']['id']}})[_0xa89e('0x1b')](handleEntityNotFound(_0x5abe76,null))[_0xa89e('0x1b')](removeEntity(_0x5abe76,null))['catch'](handleError(_0x5abe76,null));};exports[_0xa89e('0x55')]=function(_0x13a92b,_0x4343a4){return db[_0xa89e('0x39')]['describe']()[_0xa89e('0x1b')](respondWithResult(_0x4343a4,null))[_0xa89e('0x26')](handleError(_0x4343a4,null));};var interaction_log=require('../../config/logger')(_0xa89e('0x56'));exports[_0xa89e('0x57')]=function(_0x45ef61,_0x46c573,_0x1fc787){var _0x8ba592={'agent':{},'channel':_0xa89e('0x58')};if(_0x45ef61[_0xa89e('0x54')]['id']){delete _0x45ef61['body']['id'];}_0x45ef61[_0xa89e('0x54')]['read']=!![];_0x45ef61[_0xa89e('0x54')][_0xa89e('0x59')]=moment()[_0xa89e('0x5a')](_0xa89e('0x5b'));_0x45ef61['body'][_0xa89e('0x5c')]=_0x45ef61[_0xa89e('0x54')][_0xa89e('0x5c')]||_0x45ef61[_0xa89e('0x5d')]['id'];_0x8ba592[_0xa89e('0x5e')]['id']=_0x45ef61[_0xa89e('0x54')][_0xa89e('0x5c')];return db[_0xa89e('0x39')]['find']({'where':{'id':_0x45ef61[_0xa89e('0x50')]['id'],'UserId':null}})[_0xa89e('0x1b')](handleEntityNotFound(_0x46c573,null))[_0xa89e('0x1b')](saveUpdates(_0x45ef61[_0xa89e('0x54')],null))[_0xa89e('0x1b')](function(_0x31be4c){if(_0x31be4c){_0x8ba592[_0xa89e('0x24')]=_0x31be4c[_0xa89e('0x5f')]({'plain':!![]});return db[_0xa89e('0x60')][_0xa89e('0x52')]({'where':{'id':_0x31be4c[_0xa89e('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x46c573,null))[_0xa89e('0x1b')](function(_0x260d57){if(_0x260d57){return _0x260d57[_0xa89e('0x31')]({'UserId':_0x45ef61[_0xa89e('0x54')][_0xa89e('0x5c')],'read1stAt':_['isNil'](_0x260d57[_0xa89e('0x62')])?moment()[_0xa89e('0x5a')](_0xa89e('0x5b')):undefined});}return null;})[_0xa89e('0x1b')](function(_0x2c045e){if(_0x2c045e){_0x8ba592[_0xa89e('0x63')]=_0x2c045e['get']({'plain':!![]});interaction_log[_0xa89e('0x1c')](_0xa89e('0x64'),_0x45ef61['user']['id'],_0x45ef61[_0xa89e('0x5d')][_0xa89e('0x35')],_0x45ef61[_0xa89e('0x5d')][_0xa89e('0x65')],_0x8ba592[_0xa89e('0x63')]['id'],_0x45ef61[_0xa89e('0x54')]?JSON[_0xa89e('0x21')](_0x45ef61['body']):'null');return respondWithRpcPromise('AcceptMessage',_0xa89e('0x66'),_0x8ba592);}return null;})[_0xa89e('0x1b')](function(_0x4e5086){var _0x59f4cf=_0xa89e('0x67')+_0x4e5086[_0xa89e('0x24')][_0xa89e('0x68')];return db[_0xa89e('0x69')][_0xa89e('0x3f')](_0x59f4cf,{'type':db['Sequelize'][_0xa89e('0x6a')][_0xa89e('0x6b')],'raw':!![]})[_0xa89e('0x1b')](function(_0x5d08a6){return _0x5d08a6;});})[_0xa89e('0x1b')](function(_0x29c6e4){if(_0x29c6e4){_0x8ba592[_0xa89e('0x24')]['contact']=_0x29c6e4[0x0];if(!_0x45ef61[_0xa89e('0x54')]['UserId'])return;return db[_0xa89e('0x6c')][_0xa89e('0x52')]({'where':{'id':_0x45ef61[_0xa89e('0x54')][_0xa89e('0x5c')],'role':_0xa89e('0x5e')},'attributes':['id',_0xa89e('0x35'),_0xa89e('0x6d'),_0xa89e('0x6e'),'internal'],'raw':!![]});}return null;})[_0xa89e('0x1b')](function(_0x30ab6c){if(!_0x30ab6c)return null;_0x8ba592[_0xa89e('0x24')]['agent']=_0x30ab6c;return _0x8ba592;})[_0xa89e('0x1b')](function(_0x154cb3){if(_0x154cb3){if(_0x45ef61[_0xa89e('0x54')][_0xa89e('0x6f')]){_0x8ba592[_0xa89e('0x24')][_0xa89e('0x70')]=util['format'](_0xa89e('0x71'),_0x45ef61[_0xa89e('0x5d')]['name']);_0x8ba592[_0xa89e('0x24')][_0xa89e('0x72')]=_0x8ba592[_0xa89e('0x72')];_0x8ba592[_0xa89e('0x24')][_0xa89e('0x73')]=_0x8ba592[_0xa89e('0x72')];_0x8ba592[_0xa89e('0x24')][_0xa89e('0x74')]=_0xa89e('0x57');return respondWithRpcPromise(_0xa89e('0x75'),_0xa89e('0x75'),{'event':_0xa89e('0x76'),'message':_[_0xa89e('0x4a')](_0x8ba592['message'],JSON[_0xa89e('0x77')](_0x8ba592[_0xa89e('0x63')][_0xa89e('0x78')]))},client9002)[_0xa89e('0x1b')](function(){return _0x8ba592;});}return _0x8ba592;}return null;})[_0xa89e('0x1b')](respondWithResult(_0x46c573,null))[_0xa89e('0x26')](handleError(_0x46c573,null));};var interaction_log=require('../../config/logger')(_0xa89e('0x56'));exports[_0xa89e('0x79')]=function(_0x5e205c,_0x3567ca,_0x205999){var _0x1f167b={'agent':{},'channel':_0xa89e('0x58')};if(_0x5e205c['body']['id']){delete _0x5e205c[_0xa89e('0x54')]['id'];}_0x5e205c['body'][_0xa89e('0x5c')]=_0x5e205c[_0xa89e('0x54')][_0xa89e('0x5c')]||_0x5e205c[_0xa89e('0x5d')]['id'];_0x1f167b['agent']['id']=_0x5e205c[_0xa89e('0x54')]['UserId'];return db[_0xa89e('0x39')][_0xa89e('0x52')]({'where':{'id':_0x5e205c[_0xa89e('0x50')]['id'],'UserId':null}})[_0xa89e('0x1b')](handleEntityNotFound(_0x3567ca,null))['then'](function(_0x558dc0){if(_0x558dc0){_0x1f167b[_0xa89e('0x24')]=_0x558dc0[_0xa89e('0x5f')]({'plain':!![]});return db[_0xa89e('0x60')][_0xa89e('0x52')]({'where':{'id':_0x558dc0[_0xa89e('0x61')]}});}return null;})[_0xa89e('0x1b')](handleEntityNotFound(_0x3567ca,null))['then'](function(_0x2310a6){if(_0x2310a6){_0x1f167b[_0xa89e('0x63')]=_0x2310a6[_0xa89e('0x5f')]({'plain':!![]});interaction_log[_0xa89e('0x1c')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e205c[_0xa89e('0x5d')]['id'],_0x5e205c[_0xa89e('0x5d')][_0xa89e('0x35')],_0x5e205c[_0xa89e('0x5d')][_0xa89e('0x65')],_0x1f167b[_0xa89e('0x63')]['id'],_0x5e205c[_0xa89e('0x54')]?JSON[_0xa89e('0x21')](_0x5e205c['body']):'null');return respondWithRpcPromise(_0xa89e('0x7a'),_0xa89e('0x7b'),_0x1f167b);}return null;})[_0xa89e('0x1b')](function(_0x31e442){var _0x3f6435=_0xa89e('0x67')+_0x31e442[_0xa89e('0x24')][_0xa89e('0x68')];return db[_0xa89e('0x69')][_0xa89e('0x3f')](_0x3f6435,{'type':db[_0xa89e('0x7c')][_0xa89e('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x5ec801){return _0x5ec801;});})[_0xa89e('0x1b')](function(_0x5ee1eb){if(_0x5ee1eb){_0x1f167b[_0xa89e('0x24')][_0xa89e('0x7d')]=_0x5ee1eb[0x0];if(!_0x5e205c[_0xa89e('0x54')][_0xa89e('0x5c')])return;return db['User']['find']({'where':{'id':_0x5e205c[_0xa89e('0x54')][_0xa89e('0x5c')],'role':_0xa89e('0x5e')},'attributes':['id','name',_0xa89e('0x6d'),_0xa89e('0x6e'),'internal'],'raw':!![]});}return null;})[_0xa89e('0x1b')](function(_0x5cabaa){if(!_0x5cabaa)return null;_0x1f167b['message'][_0xa89e('0x5e')]=_0x5cabaa;return _0x1f167b;})[_0xa89e('0x1b')](function(_0xb72a10){if(_0xb72a10){_0xb72a10[_0xa89e('0x24')]['interface']=util[_0xa89e('0x5a')](_0xa89e('0x71'),_0x5e205c[_0xa89e('0x5d')][_0xa89e('0x35')]);_0xb72a10['message'][_0xa89e('0x72')]=_0x1f167b['channel'];_0xb72a10[_0xa89e('0x24')]['motionChannel']=_0x1f167b[_0xa89e('0x72')];_0xb72a10[_0xa89e('0x24')][_0xa89e('0x74')]=_0xa89e('0x79');respondWithRpcPromise(_0xa89e('0x75'),_0xa89e('0x75'),{'event':_0xa89e('0x7e'),'message':_[_0xa89e('0x4a')](_0x1f167b['message'],JSON[_0xa89e('0x77')](_0x1f167b['interaction'][_0xa89e('0x78')]))},client9002);return _0x1f167b;}return null;})[_0xa89e('0x1b')](respondWithResult(_0x3567ca,null))[_0xa89e('0x26')](handleError(_0x3567ca,null));}; \ No newline at end of file +var _0x6adb=['format','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','acceptmessage','parse','formData','chat','get','role','null','RejectMessage','rejectMessage','contact','internal','EventManager','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../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','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','end','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','create','body','find','describe','../../config/logger','chat-interactions','read','readAt','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x6adb,0x134));var _0xb6ad=function(_0x459172,_0x38b0ff){_0x459172=_0x459172-0x0;var _0x353bf9=_0x6adb[_0x459172];return _0x353bf9;};'use strict';var emlformat=require(_0xb6ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb6ad('0x1'));var jsonpatch=require(_0xb6ad('0x2'));var rp=require(_0xb6ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb6ad('0x4'));var util=require(_0xb6ad('0x5'));var path=require(_0xb6ad('0x6'));var sox=require(_0xb6ad('0x7'));var csv=require(_0xb6ad('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6ad('0x9'));var _=require(_0xb6ad('0xa'));var squel=require(_0xb6ad('0xb'));var crypto=require(_0xb6ad('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb6ad('0xd'));var toCsv=require(_0xb6ad('0x8'));var querystring=require(_0xb6ad('0xe'));var Papa=require(_0xb6ad('0xf'));var Redis=require(_0xb6ad('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb6ad('0x11'));var as=require(_0xb6ad('0x12'));var hardwareService=require(_0xb6ad('0x13'));var logger=require('../../config/logger')(_0xb6ad('0x14'));var utils=require(_0xb6ad('0x15'));var config=require(_0xb6ad('0x16'));var licenseUtil=require(_0xb6ad('0x17'));var db=require(_0xb6ad('0x18'))['db'];config[_0xb6ad('0x19')]=_[_0xb6ad('0x1a')](config['redis'],{'host':_0xb6ad('0x1b'),'port':0x18eb});var socket=require(_0xb6ad('0x1c'))(new Redis(config[_0xb6ad('0x19')]));require(_0xb6ad('0x1d'))[_0xb6ad('0x1e')](socket);var jayson=require(_0xb6ad('0x1f'));var client=jayson[_0xb6ad('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xb6ad('0x20')][_0xb6ad('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1a5bd9,_0x523ec0,_0x570f09,_0xc252b4){return new BPromise(function(_0x373839,_0x3435a8){var _0x2201fc=_0xc252b4||client;return _0x2201fc[_0xb6ad('0x22')](_0x1a5bd9,_0x570f09)[_0xb6ad('0x23')](function(_0x1739d0){logger[_0xb6ad('0x24')](_0xb6ad('0x25'),_0x523ec0,_0xb6ad('0x26'));logger['debug'](_0xb6ad('0x27'),_0x523ec0,_0xb6ad('0x26'),JSON[_0xb6ad('0x28')](_0x1739d0));if(_0x1739d0[_0xb6ad('0x29')]){if(_0x1739d0['error'][_0xb6ad('0x2a')]===0x1f4){logger[_0xb6ad('0x29')](_0xb6ad('0x25'),_0x523ec0,_0x1739d0['error'][_0xb6ad('0x2b')]);return _0x3435a8(_0x1739d0['error'][_0xb6ad('0x2b')]);}logger[_0xb6ad('0x29')](_0xb6ad('0x25'),_0x523ec0,_0x1739d0[_0xb6ad('0x29')]['message']);return _0x373839(_0x1739d0[_0xb6ad('0x29')][_0xb6ad('0x2b')]);}else{logger['info'](_0xb6ad('0x25'),_0x523ec0,_0xb6ad('0x26'));_0x373839(_0x1739d0[_0xb6ad('0x2c')][_0xb6ad('0x2b')]);}})['catch'](function(_0x12dcbc){logger['error'](_0xb6ad('0x25'),_0x523ec0,_0x12dcbc);_0x3435a8(_0x12dcbc);});});}function respondWithStatusCode(_0x1e9d9a,_0x3e48f2){_0x3e48f2=_0x3e48f2||0xcc;return function(_0x4f7a03){if(_0x4f7a03){return _0x1e9d9a[_0xb6ad('0x2d')](_0x3e48f2);}return _0x1e9d9a[_0xb6ad('0x2e')](_0x3e48f2)['end']();};}function respondWithResult(_0x451190,_0x446223){_0x446223=_0x446223||0xc8;return function(_0x1a469d){if(_0x1a469d){return _0x451190[_0xb6ad('0x2e')](_0x446223)['json'](_0x1a469d);}};}function respondWithFilteredResult(_0x1bd051,_0x2e81ce){return function(_0x401c25){if(_0x401c25){var _0x4576eb=typeof _0x2e81ce[_0xb6ad('0x2f')]===_0xb6ad('0x30')&&typeof _0x2e81ce[_0xb6ad('0x31')]===_0xb6ad('0x30');var _0x1d586d=_0x401c25['count'];var _0x90789d=_0x4576eb?0x0:_0x2e81ce[_0xb6ad('0x2f')];var _0x3f940a=_0x4576eb?_0x401c25[_0xb6ad('0x32')]:_0x2e81ce['offset']+_0x2e81ce[_0xb6ad('0x31')];var _0x122ccf;if(_0x3f940a>=_0x1d586d){_0x3f940a=_0x1d586d;_0x122ccf=0xc8;}else{_0x122ccf=0xce;}_0x1bd051[_0xb6ad('0x2e')](_0x122ccf);return _0x1bd051[_0xb6ad('0x33')](_0xb6ad('0x34'),_0x90789d+'-'+_0x3f940a+'/'+_0x1d586d)['json'](_0x401c25);}return null;};}function patchUpdates(_0x45f76c){return function(_0x29198f){try{jsonpatch[_0xb6ad('0x35')](_0x29198f,_0x45f76c,!![]);}catch(_0x3dcb9c){return BPromise[_0xb6ad('0x36')](_0x3dcb9c);}return _0x29198f['save']();};}function saveUpdates(_0x4b93c7,_0x996ea2){return function(_0x298354){if(_0x298354){return _0x298354['update'](_0x4b93c7)[_0xb6ad('0x23')](function(_0x179288){return _0x179288;});}return null;};}function removeEntity(_0x5d60d0,_0xc71c53){return function(_0x3e0870){if(_0x3e0870){return _0x3e0870[_0xb6ad('0x37')]()[_0xb6ad('0x23')](function(){_0x5d60d0[_0xb6ad('0x2e')](0xcc)[_0xb6ad('0x38')]();});}};}function handleEntityNotFound(_0x354d3e,_0x72153d){return function(_0x3b2f50){if(!_0x3b2f50){_0x354d3e[_0xb6ad('0x2d')](0x194);}return _0x3b2f50;};}function handleError(_0x1b2390,_0x5c8d82){_0x5c8d82=_0x5c8d82||0x1f4;return function(_0x3a581e){logger['error'](_0x3a581e['stack']);if(_0x3a581e[_0xb6ad('0x39')]){delete _0x3a581e[_0xb6ad('0x39')];}_0x1b2390[_0xb6ad('0x2e')](_0x5c8d82)['send'](_0x3a581e);};}exports[_0xb6ad('0x3a')]=function(_0x225df5,_0x2a5add){var _0x549805={},_0x2442ad={},_0x687a3c={'count':0x0,'rows':[]};var _0x272f64=_[_0xb6ad('0x3b')](db[_0xb6ad('0x3c')][_0xb6ad('0x3d')],function(_0x3a81d3){return{'name':_0x3a81d3[_0xb6ad('0x3e')],'type':_0x3a81d3[_0xb6ad('0x3f')][_0xb6ad('0x40')]};});_0x2442ad[_0xb6ad('0x41')]=_[_0xb6ad('0x3b')](_0x272f64,_0xb6ad('0x39'));_0x2442ad['query']=_[_0xb6ad('0x42')](_0x225df5[_0xb6ad('0x43')]);_0x2442ad[_0xb6ad('0x44')]=_[_0xb6ad('0x45')](_0x2442ad['model'],_0x2442ad[_0xb6ad('0x43')]);_0x549805['attributes']=_[_0xb6ad('0x45')](_0x2442ad[_0xb6ad('0x41')],qs['fields'](_0x225df5['query'][_0xb6ad('0x46')]));_0x549805[_0xb6ad('0x47')]=_0x549805[_0xb6ad('0x47')][_0xb6ad('0x48')]?_0x549805[_0xb6ad('0x47')]:_0x2442ad['model'];if(!_0x225df5[_0xb6ad('0x43')][_0xb6ad('0x49')](_0xb6ad('0x4a'))){_0x549805[_0xb6ad('0x31')]=qs[_0xb6ad('0x31')](_0x225df5['query']['limit']);_0x549805[_0xb6ad('0x2f')]=qs['offset'](_0x225df5[_0xb6ad('0x43')][_0xb6ad('0x2f')]);}_0x549805[_0xb6ad('0x4b')]=qs['sort'](_0x225df5[_0xb6ad('0x43')][_0xb6ad('0x4c')]);_0x549805[_0xb6ad('0x4d')]=qs[_0xb6ad('0x44')](_[_0xb6ad('0x4e')](_0x225df5[_0xb6ad('0x43')],_0x2442ad[_0xb6ad('0x44')]),_0x272f64);if(_0x225df5[_0xb6ad('0x43')]['filter']){_0x549805[_0xb6ad('0x4d')]=_['merge'](_0x549805[_0xb6ad('0x4d')],{'$or':_[_0xb6ad('0x3b')](_0x272f64,function(_0x39f019){if(_0x39f019['type']!==_0xb6ad('0x4f')){var _0x449f26={};_0x449f26[_0x39f019[_0xb6ad('0x39')]]={'$like':'%'+_0x225df5['query']['filter']+'%'};return _0x449f26;}})});}_0x549805=_[_0xb6ad('0x50')]({},_0x549805,_0x225df5[_0xb6ad('0x51')]);var _0x1efc2d={'where':_0x549805[_0xb6ad('0x4d')]};return db['ChatMessage'][_0xb6ad('0x32')](_0x1efc2d)[_0xb6ad('0x23')](function(_0x520169){_0x687a3c[_0xb6ad('0x32')]=_0x520169;if(_0x225df5[_0xb6ad('0x43')]['includeAll']){_0x549805[_0xb6ad('0x52')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x549805);})[_0xb6ad('0x23')](function(_0x5c1179){_0x687a3c[_0xb6ad('0x53')]=_0x5c1179;return _0x687a3c;})[_0xb6ad('0x23')](respondWithFilteredResult(_0x2a5add,_0x549805))[_0xb6ad('0x54')](handleError(_0x2a5add,null));};exports[_0xb6ad('0x55')]=function(_0x5cd301,_0x19729e){var _0x354ad9={'raw':!![],'where':{'id':_0x5cd301[_0xb6ad('0x56')]['id']}},_0x4f5087={};_0x4f5087[_0xb6ad('0x41')]=_['keys'](db[_0xb6ad('0x3c')]['rawAttributes']);_0x4f5087[_0xb6ad('0x43')]=_[_0xb6ad('0x42')](_0x5cd301['query']);_0x4f5087[_0xb6ad('0x44')]=_[_0xb6ad('0x45')](_0x4f5087[_0xb6ad('0x41')],_0x4f5087[_0xb6ad('0x43')]);_0x354ad9[_0xb6ad('0x47')]=_[_0xb6ad('0x45')](_0x4f5087[_0xb6ad('0x41')],qs[_0xb6ad('0x46')](_0x5cd301['query'][_0xb6ad('0x46')]));_0x354ad9[_0xb6ad('0x47')]=_0x354ad9[_0xb6ad('0x47')]['length']?_0x354ad9[_0xb6ad('0x47')]:_0x4f5087[_0xb6ad('0x41')];if(_0x5cd301[_0xb6ad('0x43')][_0xb6ad('0x57')]){_0x354ad9[_0xb6ad('0x52')]=[{'all':!![]}];}_0x354ad9=_[_0xb6ad('0x50')]({},_0x354ad9,_0x5cd301[_0xb6ad('0x51')]);return db['ChatMessage']['find'](_0x354ad9)[_0xb6ad('0x23')](handleEntityNotFound(_0x19729e,null))[_0xb6ad('0x23')](respondWithResult(_0x19729e,null))[_0xb6ad('0x54')](handleError(_0x19729e,null));};exports[_0xb6ad('0x58')]=function(_0x233c36,_0x4cd491){return db['ChatMessage'][_0xb6ad('0x58')](_0x233c36[_0xb6ad('0x59')],{})[_0xb6ad('0x23')](respondWithResult(_0x4cd491,0xc9))[_0xb6ad('0x54')](handleError(_0x4cd491,null));};exports['update']=function(_0x40ebd7,_0x303c20){if(_0x40ebd7['body']['id']){delete _0x40ebd7[_0xb6ad('0x59')]['id'];}return db[_0xb6ad('0x3c')][_0xb6ad('0x5a')]({'where':{'id':_0x40ebd7[_0xb6ad('0x56')]['id']}})[_0xb6ad('0x23')](handleEntityNotFound(_0x303c20,null))[_0xb6ad('0x23')](saveUpdates(_0x40ebd7[_0xb6ad('0x59')],null))[_0xb6ad('0x23')](respondWithResult(_0x303c20,null))[_0xb6ad('0x54')](handleError(_0x303c20,null));};exports[_0xb6ad('0x37')]=function(_0x4e5512,_0x3b80a5){return db[_0xb6ad('0x3c')][_0xb6ad('0x5a')]({'where':{'id':_0x4e5512[_0xb6ad('0x56')]['id']}})[_0xb6ad('0x23')](handleEntityNotFound(_0x3b80a5,null))[_0xb6ad('0x23')](removeEntity(_0x3b80a5,null))[_0xb6ad('0x54')](handleError(_0x3b80a5,null));};exports[_0xb6ad('0x5b')]=function(_0x1f87a1,_0x5c411d){return db[_0xb6ad('0x3c')][_0xb6ad('0x5b')]()[_0xb6ad('0x23')](respondWithResult(_0x5c411d,null))[_0xb6ad('0x54')](handleError(_0x5c411d,null));};var interaction_log=require(_0xb6ad('0x5c'))(_0xb6ad('0x5d'));exports['accept']=function(_0x3e8939,_0x134f29,_0x5c6ee3){var _0x5f069a={'agent':{},'channel':'chat'};if(_0x3e8939[_0xb6ad('0x59')]['id']){delete _0x3e8939[_0xb6ad('0x59')]['id'];}_0x3e8939[_0xb6ad('0x59')][_0xb6ad('0x5e')]=!![];_0x3e8939[_0xb6ad('0x59')][_0xb6ad('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3e8939[_0xb6ad('0x59')]['UserId']=_0x3e8939[_0xb6ad('0x59')][_0xb6ad('0x60')]||_0x3e8939[_0xb6ad('0x61')]['id'];_0x5f069a[_0xb6ad('0x62')]['id']=_0x3e8939[_0xb6ad('0x59')][_0xb6ad('0x60')];return db['ChatMessage']['find']({'where':{'id':_0x3e8939[_0xb6ad('0x56')]['id'],'UserId':null}})[_0xb6ad('0x23')](handleEntityNotFound(_0x134f29,null))[_0xb6ad('0x23')](saveUpdates(_0x3e8939['body'],null))[_0xb6ad('0x23')](function(_0x75c643){if(_0x75c643){_0x5f069a[_0xb6ad('0x2b')]=_0x75c643['get']({'plain':!![]});return db[_0xb6ad('0x63')][_0xb6ad('0x5a')]({'where':{'id':_0x75c643[_0xb6ad('0x64')]}});}return null;})[_0xb6ad('0x23')](handleEntityNotFound(_0x134f29,null))['then'](function(_0x2c6e90){if(_0x2c6e90){return _0x2c6e90['update']({'UserId':_0x3e8939[_0xb6ad('0x59')]['UserId'],'read1stAt':_[_0xb6ad('0x65')](_0x2c6e90[_0xb6ad('0x66')])?moment()[_0xb6ad('0x67')](_0xb6ad('0x68')):undefined});}return null;})[_0xb6ad('0x23')](function(_0x511fd0){if(_0x511fd0){_0x5f069a['interaction']=_0x511fd0['get']({'plain':!![]});interaction_log[_0xb6ad('0x24')](_0xb6ad('0x69'),_0x3e8939[_0xb6ad('0x61')]['id'],_0x3e8939[_0xb6ad('0x61')][_0xb6ad('0x39')],_0x3e8939[_0xb6ad('0x61')]['role'],_0x5f069a[_0xb6ad('0x6a')]['id'],_0x3e8939[_0xb6ad('0x59')]?JSON[_0xb6ad('0x28')](_0x3e8939[_0xb6ad('0x59')]):'null');return respondWithRpcPromise(_0xb6ad('0x6b'),_0xb6ad('0x6c'),_0x5f069a);}return null;})[_0xb6ad('0x23')](function(_0x4e9ffc){var _0x38bb6f=_0xb6ad('0x6d')+_0x4e9ffc[_0xb6ad('0x2b')][_0xb6ad('0x6e')];return db[_0xb6ad('0x6f')][_0xb6ad('0x43')](_0x38bb6f,{'type':db[_0xb6ad('0x70')][_0xb6ad('0x71')][_0xb6ad('0x72')],'raw':!![]})[_0xb6ad('0x23')](function(_0x21124c){return _0x21124c;});})['then'](function(_0x3b9583){if(_0x3b9583){_0x5f069a[_0xb6ad('0x2b')]['contact']=_0x3b9583[0x0];if(!_0x3e8939[_0xb6ad('0x59')]['UserId'])return;return db['User'][_0xb6ad('0x5a')]({'where':{'id':_0x3e8939[_0xb6ad('0x59')][_0xb6ad('0x60')],'role':_0xb6ad('0x62')},'attributes':['id',_0xb6ad('0x39'),_0xb6ad('0x73'),_0xb6ad('0x74'),'internal'],'raw':!![]});}return null;})[_0xb6ad('0x23')](function(_0x453310){if(!_0x453310)return null;_0x5f069a[_0xb6ad('0x2b')][_0xb6ad('0x62')]=_0x453310;return _0x5f069a;})[_0xb6ad('0x23')](function(_0x3750b8){if(_0x3750b8){if(_0x3e8939[_0xb6ad('0x59')][_0xb6ad('0x75')]){_0x5f069a[_0xb6ad('0x2b')][_0xb6ad('0x76')]=util[_0xb6ad('0x67')](_0xb6ad('0x77'),_0x3e8939['user'][_0xb6ad('0x39')]);_0x5f069a[_0xb6ad('0x2b')][_0xb6ad('0x78')]=_0x5f069a[_0xb6ad('0x78')];_0x5f069a[_0xb6ad('0x2b')][_0xb6ad('0x79')]=_0x5f069a[_0xb6ad('0x78')];_0x5f069a['message'][_0xb6ad('0x7a')]=_0xb6ad('0x7b');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xb6ad('0x7c'),'message':_['merge'](_0x5f069a[_0xb6ad('0x2b')],JSON[_0xb6ad('0x7d')](_0x5f069a[_0xb6ad('0x6a')][_0xb6ad('0x7e')]))},client9002)[_0xb6ad('0x23')](function(){return _0x5f069a;});}return _0x5f069a;}return null;})[_0xb6ad('0x23')](respondWithResult(_0x134f29,null))[_0xb6ad('0x54')](handleError(_0x134f29,null));};var interaction_log=require(_0xb6ad('0x5c'))(_0xb6ad('0x5d'));exports[_0xb6ad('0x36')]=function(_0x126afe,_0x57d60d,_0x5f330a){var _0x5cdc78={'agent':{},'channel':_0xb6ad('0x7f')};if(_0x126afe[_0xb6ad('0x59')]['id']){delete _0x126afe[_0xb6ad('0x59')]['id'];}_0x126afe['body']['UserId']=_0x126afe[_0xb6ad('0x59')][_0xb6ad('0x60')]||_0x126afe[_0xb6ad('0x61')]['id'];_0x5cdc78[_0xb6ad('0x62')]['id']=_0x126afe['body'][_0xb6ad('0x60')];return db[_0xb6ad('0x3c')]['find']({'where':{'id':_0x126afe['params']['id'],'UserId':null}})[_0xb6ad('0x23')](handleEntityNotFound(_0x57d60d,null))[_0xb6ad('0x23')](function(_0x1cd163){if(_0x1cd163){_0x5cdc78['message']=_0x1cd163[_0xb6ad('0x80')]({'plain':!![]});return db[_0xb6ad('0x63')][_0xb6ad('0x5a')]({'where':{'id':_0x1cd163[_0xb6ad('0x64')]}});}return null;})[_0xb6ad('0x23')](handleEntityNotFound(_0x57d60d,null))[_0xb6ad('0x23')](function(_0x54396f){if(_0x54396f){_0x5cdc78[_0xb6ad('0x6a')]=_0x54396f[_0xb6ad('0x80')]({'plain':!![]});interaction_log[_0xb6ad('0x24')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x126afe[_0xb6ad('0x61')]['id'],_0x126afe[_0xb6ad('0x61')][_0xb6ad('0x39')],_0x126afe[_0xb6ad('0x61')][_0xb6ad('0x81')],_0x5cdc78[_0xb6ad('0x6a')]['id'],_0x126afe[_0xb6ad('0x59')]?JSON['stringify'](_0x126afe[_0xb6ad('0x59')]):_0xb6ad('0x82'));return respondWithRpcPromise(_0xb6ad('0x83'),_0xb6ad('0x84'),_0x5cdc78);}return null;})[_0xb6ad('0x23')](function(_0x1c2d45){var _0x30c1fd=_0xb6ad('0x6d')+_0x1c2d45[_0xb6ad('0x2b')]['ContactId'];return db[_0xb6ad('0x6f')][_0xb6ad('0x43')](_0x30c1fd,{'type':db[_0xb6ad('0x70')]['QueryTypes'][_0xb6ad('0x72')],'raw':!![]})[_0xb6ad('0x23')](function(_0x22a397){return _0x22a397;});})[_0xb6ad('0x23')](function(_0x4e0ebd){if(_0x4e0ebd){_0x5cdc78[_0xb6ad('0x2b')][_0xb6ad('0x85')]=_0x4e0ebd[0x0];if(!_0x126afe[_0xb6ad('0x59')][_0xb6ad('0x60')])return;return db['User'][_0xb6ad('0x5a')]({'where':{'id':_0x126afe[_0xb6ad('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0xb6ad('0x39'),_0xb6ad('0x73'),_0xb6ad('0x74'),_0xb6ad('0x86')],'raw':!![]});}return null;})['then'](function(_0x58aaa8){if(!_0x58aaa8)return null;_0x5cdc78[_0xb6ad('0x2b')]['agent']=_0x58aaa8;return _0x5cdc78;})[_0xb6ad('0x23')](function(_0x5cb3c3){if(_0x5cb3c3){_0x5cb3c3[_0xb6ad('0x2b')][_0xb6ad('0x76')]=util['format']('SIP/%s',_0x126afe[_0xb6ad('0x61')][_0xb6ad('0x39')]);_0x5cb3c3[_0xb6ad('0x2b')][_0xb6ad('0x78')]=_0x5cdc78[_0xb6ad('0x78')];_0x5cb3c3[_0xb6ad('0x2b')][_0xb6ad('0x79')]=_0x5cdc78[_0xb6ad('0x78')];_0x5cb3c3['message'][_0xb6ad('0x7a')]='reject';respondWithRpcPromise('EventManager',_0xb6ad('0x87'),{'event':_0xb6ad('0x88'),'message':_[_0xb6ad('0x50')](_0x5cdc78[_0xb6ad('0x2b')],JSON[_0xb6ad('0x7d')](_0x5cdc78[_0xb6ad('0x6a')][_0xb6ad('0x7e')]))},client9002);return _0x5cdc78;}return null;})[_0xb6ad('0x23')](respondWithResult(_0x57d60d,null))[_0xb6ad('0x54')](handleError(_0x57d60d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a12700c..efc83fe 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 _0x51a1=['hook','exports','events','../../mysqldb','ChatMessage','save','remove','emit','hasOwnProperty'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x51a1,0x13d));var _0x151a=function(_0x445292,_0x160021){_0x445292=_0x445292-0x0;var _0x39cabf=_0x51a1[_0x445292];return _0x39cabf;};'use strict';var EventEmitter=require(_0x151a('0x0'));var ChatMessage=require(_0x151a('0x1'))['db'][_0x151a('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x151a('0x3'),'afterUpdate':'update','afterDestroy':_0x151a('0x4')};function emitEvent(_0x475694){return function(_0x446e25,_0x2e5ddb,_0x500c9c){ChatMessageEvents[_0x151a('0x5')](_0x475694+':'+_0x446e25['id'],_0x446e25);ChatMessageEvents[_0x151a('0x5')](_0x475694,_0x446e25);_0x500c9c(null);};}for(var e in events){if(events[_0x151a('0x6')](e)){var event=events[e];ChatMessage[_0x151a('0x7')](e,emitEvent(event));}}module[_0x151a('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x2312=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','update'];(function(_0x3e8d75,_0x4fe725){var _0x541ddd=function(_0x4e2b5f){while(--_0x4e2b5f){_0x3e8d75['push'](_0x3e8d75['shift']());}};_0x541ddd(++_0x4fe725);}(_0x2312,0x1d1));var _0x2231=function(_0x32f593,_0x1400b7){_0x32f593=_0x32f593-0x0;var _0x387d1b=_0x2312[_0x32f593];return _0x387d1b;};'use strict';var EventEmitter=require(_0x2231('0x0'));var ChatMessage=require(_0x2231('0x1'))['db'][_0x2231('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2231('0x3'),'afterDestroy':'remove'};function emitEvent(_0x49b17a){return function(_0x3108b6,_0x212391,_0x184cd3){ChatMessageEvents[_0x2231('0x4')](_0x49b17a+':'+_0x3108b6['id'],_0x3108b6);ChatMessageEvents['emit'](_0x49b17a,_0x3108b6);_0x184cd3(null);};}for(var e in events){if(events[_0x2231('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x2231('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a8efcf1..e085921 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 _0x65c8=['then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction'];(function(_0x134ebf,_0x4a0fd3){var _0x1e0ea0=function(_0x4330a4){while(--_0x4330a4){_0x134ebf['push'](_0x134ebf['shift']());}};_0x1e0ea0(++_0x4a0fd3);}(_0x65c8,0xe6));var _0x865c=function(_0x163a35,_0x4d21dc){_0x163a35=_0x163a35-0x0;var _0x1b48e2=_0x65c8[_0x163a35];return _0x1b48e2;};'use strict';var _=require('lodash');var util=require(_0x865c('0x0'));var logger=require('../../config/logger')(_0x865c('0x1'));var moment=require(_0x865c('0x2'));var BPromise=require('bluebird');var rp=require(_0x865c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x865c('0x4'));var config=require(_0x865c('0x5'));var attributes=require(_0x865c('0x6'));module[_0x865c('0x7')]=function(_0x2eec44,_0x394ecd){return _0x2eec44[_0x865c('0x8')](_0x865c('0x9'),attributes,{'tableName':_0x865c('0xa'),'paranoid':![],'indexes':[{'name':_0x865c('0xb'),'fields':[_0x865c('0xc')],'type':_0x865c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8bc984,_0xdbd3d4,_0x17a2c0){var _0x43cf81=_0x2eec44[_0x865c('0xe')];var _0x596752=_0x8bc984[_0x865c('0xf')]({'plain':!![]});if(_0x596752[_0x865c('0x10')][_0x865c('0x11')]()==='in'||_0x596752['direction'][_0x865c('0x11')]()===_0x865c('0x12')&&!_0x596752[_0x865c('0x13')]&&!_['isNil'](_0x596752[_0x865c('0x14')])){_0x43cf81[_0x865c('0x15')]['findOne']({'where':{'id':_0x596752['ChatInteractionId']}})[_0x865c('0x16')](function(_0x2587a7){if(_0x2587a7){_0x2587a7[_0x865c('0x17')]({'lastMsgAt':_0x596752['createdAt'],'lastMsgDirection':_0x596752[_0x865c('0x10')][_0x865c('0x11')]()});}})[_0x865c('0x18')](function(_0x27c313){console[_0x865c('0x19')](_0x27c313);});}_0x17a2c0();}},'charset':_0x865c('0x1a'),'collate':_0x865c('0x1b')});}; \ No newline at end of file +var _0x2d05=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0xa78901,_0x5c559e){var _0x38e312=function(_0x7c8465){while(--_0x7c8465){_0xa78901['push'](_0xa78901['shift']());}};_0x38e312(++_0x5c559e);}(_0x2d05,0x144));var _0x52d0=function(_0x1559bb,_0x7cb081){_0x1559bb=_0x1559bb-0x0;var _0x3a7cca=_0x2d05[_0x1559bb];return _0x3a7cca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52d0('0x0'))(_0x52d0('0x1'));var moment=require(_0x52d0('0x2'));var BPromise=require(_0x52d0('0x3'));var rp=require(_0x52d0('0x4'));var fs=require('fs');var path=require(_0x52d0('0x5'));var rimraf=require(_0x52d0('0x6'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0x52d0('0x7')]=function(_0x20e4b7,_0x44d4e0){return _0x20e4b7[_0x52d0('0x8')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x52d0('0x9')],'type':_0x52d0('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc91415,_0xc7021f,_0x10eec0){var _0x18bd68=_0x20e4b7[_0x52d0('0xb')];var _0xb48e42=_0xc91415['get']({'plain':!![]});if(_0xb48e42[_0x52d0('0xc')][_0x52d0('0xd')]()==='in'||_0xb48e42[_0x52d0('0xc')][_0x52d0('0xd')]()===_0x52d0('0xe')&&!_0xb48e42[_0x52d0('0xf')]&&!_[_0x52d0('0x10')](_0xb48e42[_0x52d0('0x11')])){_0x18bd68[_0x52d0('0x12')][_0x52d0('0x13')]({'where':{'id':_0xb48e42[_0x52d0('0x14')]}})['then'](function(_0x48fbdd){if(_0x48fbdd){_0x48fbdd[_0x52d0('0x15')]({'lastMsgAt':_0xb48e42[_0x52d0('0x16')],'lastMsgDirection':_0xb48e42[_0x52d0('0xc')][_0x52d0('0xd')]()});}})[_0x52d0('0x17')](function(_0x371485){console[_0x52d0('0x18')](_0x371485);});}_0x10eec0();}},'charset':_0x52d0('0x19'),'collate':_0x52d0('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e353308..93f7ee6 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 _0xaf37=['redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateChatMessage','ChatMessage','create','body','options','raw','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xaf37,0xa1));var _0x7af3=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xaf37[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0x7af3('0x0'));var moment=require(_0x7af3('0x1'));var BPromise=require(_0x7af3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7af3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7af3('0x4'));var logger=require('../../config/logger')(_0x7af3('0x5'));var config=require(_0x7af3('0x6'));var jayson=require(_0x7af3('0x7'));var client=jayson['client'][_0x7af3('0x8')]({'port':0x232a});config[_0x7af3('0x9')]=_[_0x7af3('0xa')](config[_0x7af3('0x9')],{'host':_0x7af3('0xb'),'port':0x18eb});var socket=require(_0x7af3('0xc'))(new Redis(config[_0x7af3('0x9')]));require(_0x7af3('0xd'))[_0x7af3('0xe')](socket);function respondWithRpcPromise(_0xef7cbf,_0x2e6991,_0x22e94a){return new BPromise(function(_0x136135,_0x9fa908){return client[_0x7af3('0xf')](_0xef7cbf,_0x22e94a)[_0x7af3('0x10')](function(_0x3c06bc){logger['info'](_0x7af3('0x11'),_0x2e6991,_0x7af3('0x12'));logger[_0x7af3('0x13')](_0x7af3('0x14'),_0x2e6991,'request\x20sent',JSON[_0x7af3('0x15')](_0x3c06bc));if(_0x3c06bc[_0x7af3('0x16')]){if(_0x3c06bc[_0x7af3('0x16')][_0x7af3('0x17')]===0x1f4){logger['error'](_0x7af3('0x11'),_0x2e6991,_0x3c06bc[_0x7af3('0x16')]['message']);return _0x9fa908(_0x3c06bc[_0x7af3('0x16')][_0x7af3('0x18')]);}logger[_0x7af3('0x16')](_0x7af3('0x11'),_0x2e6991,_0x3c06bc[_0x7af3('0x16')]['message']);return _0x136135(_0x3c06bc[_0x7af3('0x16')][_0x7af3('0x18')]);}else{logger[_0x7af3('0x19')](_0x7af3('0x11'),_0x2e6991,'request\x20sent');_0x136135(_0x3c06bc[_0x7af3('0x1a')][_0x7af3('0x18')]);}})['catch'](function(_0x35feb2){logger['error'](_0x7af3('0x11'),_0x2e6991,_0x35feb2);_0x9fa908(_0x35feb2);});});}exports[_0x7af3('0x1b')]=function(_0x52417a){var _0x5257c6=this;return new Promise(function(_0x1e05c8,_0x32a8f6){return db[_0x7af3('0x1c')][_0x7af3('0x1d')](_0x52417a[_0x7af3('0x1e')],{'raw':_0x52417a[_0x7af3('0x1f')]?_0x52417a[_0x7af3('0x1f')][_0x7af3('0x20')]===undefined?!![]:![]:!![]})[_0x7af3('0x10')](function(_0x25747e){logger['info'](_0x7af3('0x1b'),_0x52417a);logger[_0x7af3('0x13')](_0x7af3('0x1b'),_0x52417a,JSON[_0x7af3('0x15')](_0x25747e));_0x1e05c8(_0x25747e);})[_0x7af3('0x21')](function(_0x1ca06d){logger[_0x7af3('0x16')](_0x7af3('0x1b'),_0x1ca06d[_0x7af3('0x18')],_0x52417a);_0x32a8f6(_0x5257c6['error'](0x1f4,_0x1ca06d[_0x7af3('0x18')]));});});}; \ No newline at end of file +var _0x2707=['./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateChatMessage','create','options','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x26bc23,_0x23404c){var _0x521e72=function(_0x37f0e4){while(--_0x37f0e4){_0x26bc23['push'](_0x26bc23['shift']());}};_0x521e72(++_0x23404c);}(_0x2707,0x65));var _0x7270=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x2707[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x7270('0x0'));var util=require(_0x7270('0x1'));var moment=require('moment');var BPromise=require(_0x7270('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7270('0x3'));var db=require(_0x7270('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7270('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7270('0x6'));var client=jayson['client'][_0x7270('0x7')]({'port':0x232a});config[_0x7270('0x8')]=_['defaults'](config[_0x7270('0x8')],{'host':_0x7270('0x9'),'port':0x18eb});var socket=require(_0x7270('0xa'))(new Redis(config[_0x7270('0x8')]));require(_0x7270('0xb'))['register'](socket);function respondWithRpcPromise(_0x16ca42,_0x1efb41,_0x289604){return new BPromise(function(_0x46df3c,_0x273e80){return client['request'](_0x16ca42,_0x289604)[_0x7270('0xc')](function(_0x496ea6){logger[_0x7270('0xd')](_0x7270('0xe'),_0x1efb41,'request\x20sent');logger[_0x7270('0xf')](_0x7270('0x10'),_0x1efb41,'request\x20sent',JSON['stringify'](_0x496ea6));if(_0x496ea6['error']){if(_0x496ea6[_0x7270('0x11')][_0x7270('0x12')]===0x1f4){logger[_0x7270('0x11')](_0x7270('0xe'),_0x1efb41,_0x496ea6[_0x7270('0x11')][_0x7270('0x13')]);return _0x273e80(_0x496ea6['error'][_0x7270('0x13')]);}logger[_0x7270('0x11')](_0x7270('0xe'),_0x1efb41,_0x496ea6[_0x7270('0x11')][_0x7270('0x13')]);return _0x46df3c(_0x496ea6[_0x7270('0x11')]['message']);}else{logger[_0x7270('0xd')](_0x7270('0xe'),_0x1efb41,_0x7270('0x14'));_0x46df3c(_0x496ea6[_0x7270('0x15')]['message']);}})[_0x7270('0x16')](function(_0xa6b273){logger[_0x7270('0x11')]('ChatMessage,\x20%s,\x20%s',_0x1efb41,_0xa6b273);_0x273e80(_0xa6b273);});});}exports[_0x7270('0x17')]=function(_0x50e2e7){var _0x1aaf85=this;return new Promise(function(_0xe4f45b,_0x29b102){return db['ChatMessage'][_0x7270('0x18')](_0x50e2e7['body'],{'raw':_0x50e2e7['options']?_0x50e2e7[_0x7270('0x19')][_0x7270('0x1a')]===undefined?!![]:![]:!![]})[_0x7270('0xc')](function(_0x243b36){logger['info'](_0x7270('0x17'),_0x50e2e7);logger[_0x7270('0xf')](_0x7270('0x17'),_0x50e2e7,JSON[_0x7270('0x1b')](_0x243b36));_0xe4f45b(_0x243b36);})[_0x7270('0x16')](function(_0x5703d6){logger[_0x7270('0x11')]('CreateChatMessage',_0x5703d6[_0x7270('0x13')],_0x50e2e7);_0x29b102(_0x1aaf85[_0x7270('0x11')](0x1f4,_0x5703d6['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2c37aa7..b15a40c 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 _0x9d92=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x554118,_0x3adde7){var _0x38b1a4=function(_0x2e9c85){while(--_0x2e9c85){_0x554118['push'](_0x554118['shift']());}};_0x38b1a4(++_0x3adde7);}(_0x9d92,0xdf));var _0x29d9=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x9d92[_0x31df6f];return _0x31e353;};'use strict';var ChatMessageEvents=require(_0x29d9('0x0'));var events=['save','remove',_0x29d9('0x1')];function createListener(_0x3d33ba,_0x48fe57){return function(_0x3dbd9e){_0x48fe57[_0x29d9('0x2')](_0x3d33ba,_0x3dbd9e);};}function removeListener(_0x18371b,_0x6e12eb){return function(){ChatMessageEvents[_0x29d9('0x3')](_0x18371b,_0x6e12eb);};}exports[_0x29d9('0x4')]=function(_0x27d032){for(var _0x52932b=0x0,_0x209595=events[_0x29d9('0x5')];_0x52932b<_0x209595;_0x52932b++){var _0x392265=events[_0x52932b];var _0x5aeb53=createListener(_0x29d9('0x6')+_0x392265,_0x27d032);ChatMessageEvents['on'](_0x392265,_0x5aeb53);}}; \ No newline at end of file +var _0x0ec6=['register','chatMessage:','./chatMessage.events','update','emit'];(function(_0x35892a,_0x492402){var _0x435f11=function(_0x5d745a){while(--_0x5d745a){_0x35892a['push'](_0x35892a['shift']());}};_0x435f11(++_0x492402);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x32b784,_0x28379f){_0x32b784=_0x32b784-0x0;var _0x2e58e8=_0x0ec6[_0x32b784];return _0x2e58e8;};'use strict';var ChatMessageEvents=require(_0x60ec('0x0'));var events=['save','remove',_0x60ec('0x1')];function createListener(_0x21264a,_0x2ee4a3){return function(_0x13a3a5){_0x2ee4a3[_0x60ec('0x2')](_0x21264a,_0x13a3a5);};}function removeListener(_0x262ed6,_0x392a91){return function(){ChatMessageEvents['removeListener'](_0x262ed6,_0x392a91);};}exports[_0x60ec('0x3')]=function(_0xb4a258){for(var _0x1d8fb5=0x0,_0x74adc4=events['length'];_0x1d8fb5<_0x74adc4;_0x1d8fb5++){var _0xcb974c=events[_0x1d8fb5];var _0x488ab8=createListener(_0x60ec('0x4')+_0xcb974c,_0xb4a258);ChatMessageEvents['on'](_0xcb974c,_0x488ab8);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ee19fc8..bddd537 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 _0xe6b2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','show','post','tracked','chatmessage:create','put','/:id','update','accept','/:id/reject','reject','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe6b2,0xdc));var _0x2e6b=function(_0x778b72,_0x19857f){_0x778b72=_0x778b72-0x0;var _0x4528ab=_0xe6b2[_0x778b72];return _0x4528ab;};'use strict';var multer=require(_0x2e6b('0x0'));var util=require(_0x2e6b('0x1'));var path=require(_0x2e6b('0x2'));var timeout=require(_0x2e6b('0x3'));var express=require(_0x2e6b('0x4'));var router=express[_0x2e6b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2e6b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2e6b('0x7'));router[_0x2e6b('0x8')]('/',auth[_0x2e6b('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2e6b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2e6b('0xa')]);router[_0x2e6b('0xb')]('/',auth['isAuthenticated'](),interaction[_0x2e6b('0xc')]('chat',_0x2e6b('0xd')),controller['create']);router[_0x2e6b('0xe')](_0x2e6b('0xf'),controller[_0x2e6b('0x10')]);router[_0x2e6b('0xe')]('/:id/accept',auth[_0x2e6b('0x9')](),controller[_0x2e6b('0x11')]);router[_0x2e6b('0xe')](_0x2e6b('0x12'),auth['isAuthenticated'](),controller[_0x2e6b('0x13')]);router[_0x2e6b('0x14')](_0x2e6b('0xf'),auth[_0x2e6b('0x9')](),controller[_0x2e6b('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc3fd=['isAuthenticated','/describe','describe','/:id','show','chatmessage:create','put','update','/:id/accept','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get'];(function(_0x220fa9,_0x4255fb){var _0x518ed5=function(_0x280cd9){while(--_0x280cd9){_0x220fa9['push'](_0x220fa9['shift']());}};_0x518ed5(++_0x4255fb);}(_0xc3fd,0x12a));var _0xdc3f=function(_0x48b8dd,_0x3481d5){_0x48b8dd=_0x48b8dd-0x0;var _0x543922=_0xc3fd[_0x48b8dd];return _0x543922;};'use strict';var multer=require(_0xdc3f('0x0'));var util=require(_0xdc3f('0x1'));var path=require(_0xdc3f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdc3f('0x3')]();var fs_extra=require(_0xdc3f('0x4'));var auth=require(_0xdc3f('0x5'));var interaction=require(_0xdc3f('0x6'));var config=require(_0xdc3f('0x7'));var controller=require(_0xdc3f('0x8'));router[_0xdc3f('0x9')]('/',auth[_0xdc3f('0xa')](),controller['index']);router[_0xdc3f('0x9')](_0xdc3f('0xb'),auth[_0xdc3f('0xa')](),controller[_0xdc3f('0xc')]);router[_0xdc3f('0x9')](_0xdc3f('0xd'),auth['isAuthenticated'](),controller[_0xdc3f('0xe')]);router['post']('/',auth[_0xdc3f('0xa')](),interaction['tracked']('chat',_0xdc3f('0xf')),controller['create']);router[_0xdc3f('0x10')](_0xdc3f('0xd'),controller[_0xdc3f('0x11')]);router[_0xdc3f('0x10')](_0xdc3f('0x12'),auth['isAuthenticated'](),controller['accept']);router[_0xdc3f('0x10')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xdc3f('0x13')](_0xdc3f('0xd'),auth[_0xdc3f('0xa')](),controller[_0xdc3f('0x14')]);module[_0xdc3f('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 8430ae3..0f2009b 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','TEXT'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x757a,0xde));var _0xa757=function(_0x43cb41,_0x57a514){_0x43cb41=_0x43cb41-0x0;var _0x5c4839=_0x757a[_0x43cb41];return _0x5c4839;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x214643,_0x344d7c){var _0x11b191=function(_0x109a6d){while(--_0x109a6d){_0x214643['push'](_0x214643['shift']());}};_0x11b191(++_0x344d7c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 1889029..0338bf1 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(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x7a54,0x106));var _0x47a5=function(_0xb9cc05,_0x449875){_0xb9cc05=_0xb9cc05-0x0;var _0x5d97c0=_0x7a54[_0xb9cc05];return _0x5d97c0;};'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(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x7a54,0x106));var _0x47a5=function(_0x3747c0,_0x1c3c5f){_0x3747c0=_0x3747c0-0x0;var _0x34569f=_0x7a54[_0x3747c0];return _0x34569f;};'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 3968975..6940a9a 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 _0x9f20=['emit','hasOwnProperty','hook','../../mysqldb','ChatOfflineMessage','save','update','remove'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x9f20,0x153));var _0x09f2=function(_0x3dbccb,_0xf4761c){_0x3dbccb=_0x3dbccb-0x0;var _0x1250aa=_0x9f20[_0x3dbccb];return _0x1250aa;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x09f2('0x0'))['db'][_0x09f2('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x09f2('0x2'),'afterUpdate':_0x09f2('0x3'),'afterDestroy':_0x09f2('0x4')};function emitEvent(_0x4e5837){return function(_0x18cf32,_0x11ba0a,_0x37c40a){ChatOfflineMessageEvents[_0x09f2('0x5')](_0x4e5837+':'+_0x18cf32['id'],_0x18cf32);ChatOfflineMessageEvents[_0x09f2('0x5')](_0x4e5837,_0x18cf32);_0x37c40a(null);};}for(var e in events){if(events[_0x09f2('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x09f2('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x5327=['remove','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0x146ac4,_0xb7aeaa){var _0xa48042=function(_0x14e923){while(--_0x14e923){_0x146ac4['push'](_0x146ac4['shift']());}};_0xa48042(++_0xb7aeaa);}(_0x5327,0x1bc));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7532('0x0'));var ChatOfflineMessage=require(_0x7532('0x1'))['db'][_0x7532('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7532('0x3')](0x0);var events={'afterCreate':_0x7532('0x4'),'afterUpdate':_0x7532('0x5'),'afterDestroy':_0x7532('0x6')};function emitEvent(_0x2e0dd5){return function(_0x16004b,_0x382999,_0xac8c8c){ChatOfflineMessageEvents['emit'](_0x2e0dd5+':'+_0x16004b['id'],_0x16004b);ChatOfflineMessageEvents['emit'](_0x2e0dd5,_0x16004b);_0xac8c8c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x7532('0x7')](e,emitEvent(event));}}module[_0x7532('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 8a4cc3e..f4ac36e 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 _0x88ad=['ChatOfflineMessage','exports','define'];(function(_0x40b807,_0x119dbc){var _0x286ece=function(_0x5c1985){while(--_0x5c1985){_0x40b807['push'](_0x40b807['shift']());}};_0x286ece(++_0x119dbc);}(_0x88ad,0x1b1));var _0xd88a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x88ad[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xd88a('0x0')]=function(_0x1a76c0){return _0x1a76c0[_0xd88a('0x1')](_0xd88a('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x25a2=['utf8mb4_unicode_ci','exports','define','utf8mb4'];(function(_0x4ed454,_0x238af4){var _0x9f72b9=function(_0x3e550a){while(--_0x3e550a){_0x4ed454['push'](_0x4ed454['shift']());}};_0x9f72b9(++_0x238af4);}(_0x25a2,0x1a9));var _0x225a=function(_0x413b60,_0x274e45){_0x413b60=_0x413b60-0x0;var _0xde760a=_0x25a2[_0x413b60];return _0xde760a;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x225a('0x0')]=function(_0x732a43){return _0x732a43[_0x225a('0x1')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x225a('0x2'),'collate':_0x225a('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4171b09..988ab88 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 _0x7a72=['../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0x7a72,0xbe));var _0x27a7=function(_0x32cd64,_0x863c26){_0x32cd64=_0x32cd64-0x0;var _0x33fcf3=_0x7a72[_0x32cd64];return _0x33fcf3;};'use strict';var _=require('lodash');var util=require(_0x27a7('0x0'));var moment=require(_0x27a7('0x1'));var BPromise=require(_0x27a7('0x2'));var rs=require(_0x27a7('0x3'));var fs=require('fs');var Redis=require(_0x27a7('0x4'));var db=require(_0x27a7('0x5'))['db'];var utils=require(_0x27a7('0x6'));var logger=require(_0x27a7('0x7'))('rpc');var config=require(_0x27a7('0x8'));var jayson=require(_0x27a7('0x9'));var client=jayson['client'][_0x27a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x600ec5,_0x12ffc1,_0x1f7114){return new BPromise(function(_0x33114f,_0x514825){return client[_0x27a7('0xb')](_0x600ec5,_0x1f7114)[_0x27a7('0xc')](function(_0x4cf062){logger[_0x27a7('0xd')](_0x27a7('0xe'),_0x12ffc1,_0x27a7('0xf'));logger['debug'](_0x27a7('0x10'),_0x12ffc1,_0x27a7('0xf'),JSON[_0x27a7('0x11')](_0x4cf062));if(_0x4cf062[_0x27a7('0x12')]){if(_0x4cf062['error']['code']===0x1f4){logger[_0x27a7('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x12ffc1,_0x4cf062[_0x27a7('0x12')][_0x27a7('0x13')]);return _0x514825(_0x4cf062['error'][_0x27a7('0x13')]);}logger[_0x27a7('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x12ffc1,_0x4cf062[_0x27a7('0x12')]['message']);return _0x33114f(_0x4cf062[_0x27a7('0x12')][_0x27a7('0x13')]);}else{logger['info'](_0x27a7('0xe'),_0x12ffc1,_0x27a7('0xf'));_0x33114f(_0x4cf062[_0x27a7('0x14')][_0x27a7('0x13')]);}})[_0x27a7('0x15')](function(_0x32d892){logger[_0x27a7('0x12')](_0x27a7('0xe'),_0x12ffc1,_0x32d892);_0x514825(_0x32d892);});});} \ No newline at end of file +var _0x220b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util'];(function(_0x4a3708,_0x24f24c){var _0x135cf0=function(_0xf1fa20){while(--_0xf1fa20){_0x4a3708['push'](_0x4a3708['shift']());}};_0x135cf0(++_0x24f24c);}(_0x220b,0x1b7));var _0xb220=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0x220b[_0x51ed62];return _0x34aee3;};'use strict';var _=require('lodash');var util=require(_0xb220('0x0'));var moment=require(_0xb220('0x1'));var BPromise=require(_0xb220('0x2'));var rs=require(_0xb220('0x3'));var fs=require('fs');var Redis=require(_0xb220('0x4'));var db=require(_0xb220('0x5'))['db'];var utils=require(_0xb220('0x6'));var logger=require(_0xb220('0x7'))(_0xb220('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb220('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5943d3,_0x588e99,_0x4bde5e){return new BPromise(function(_0x49c4ea,_0x3dfe0a){return client[_0xb220('0xa')](_0x5943d3,_0x4bde5e)[_0xb220('0xb')](function(_0x11769a){logger['info'](_0xb220('0xc'),_0x588e99,_0xb220('0xd'));logger[_0xb220('0xe')](_0xb220('0xf'),_0x588e99,_0xb220('0xd'),JSON[_0xb220('0x10')](_0x11769a));if(_0x11769a['error']){if(_0x11769a[_0xb220('0x11')]['code']===0x1f4){logger[_0xb220('0x11')](_0xb220('0xc'),_0x588e99,_0x11769a[_0xb220('0x11')][_0xb220('0x12')]);return _0x3dfe0a(_0x11769a['error']['message']);}logger[_0xb220('0x11')](_0xb220('0xc'),_0x588e99,_0x11769a[_0xb220('0x11')][_0xb220('0x12')]);return _0x49c4ea(_0x11769a[_0xb220('0x11')][_0xb220('0x12')]);}else{logger[_0xb220('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x588e99,_0xb220('0xd'));_0x49c4ea(_0x11769a[_0xb220('0x14')][_0xb220('0x12')]);}})[_0xb220('0x15')](function(_0x1b5fcd){logger[_0xb220('0x11')](_0xb220('0xc'),_0x588e99,_0x1b5fcd);_0x3dfe0a(_0x1b5fcd);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 332f755..9fa7b52 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 _0xb596=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb596,0x1ad));var _0x6b59=function(_0x3c778e,_0x319e81){_0x3c778e=_0x3c778e-0x0;var _0xecf5f3=_0xb596[_0x3c778e];return _0xecf5f3;};'use strict';var multer=require(_0x6b59('0x0'));var util=require(_0x6b59('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6b59('0x2')]();var fs_extra=require(_0x6b59('0x3'));var auth=require(_0x6b59('0x4'));var interaction=require(_0x6b59('0x5'));var config=require(_0x6b59('0x6'));var controller=require(_0x6b59('0x7'));router[_0x6b59('0x8')]('/',auth[_0x6b59('0x9')](),controller[_0x6b59('0xa')]);router[_0x6b59('0x8')](_0x6b59('0xb'),auth['isAuthenticated'](),controller[_0x6b59('0xc')]);router[_0x6b59('0x8')](_0x6b59('0xd'),auth['isAuthenticated'](),controller[_0x6b59('0xe')]);router[_0x6b59('0xf')]('/',auth[_0x6b59('0x9')](),controller[_0x6b59('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6b59('0x11')]);router[_0x6b59('0x12')]('/:id',auth[_0x6b59('0x9')](),controller[_0x6b59('0x13')]);module[_0x6b59('0x14')]=router; \ No newline at end of file +var _0xbcd5=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0xbcd5,0x163));var _0x5bcd=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbcd5[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x5bcd('0x0'));var util=require(_0x5bcd('0x1'));var path=require(_0x5bcd('0x2'));var timeout=require(_0x5bcd('0x3'));var express=require(_0x5bcd('0x4'));var router=express[_0x5bcd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5bcd('0x6'));var interaction=require(_0x5bcd('0x7'));var config=require(_0x5bcd('0x8'));var controller=require(_0x5bcd('0x9'));router[_0x5bcd('0xa')]('/',auth[_0x5bcd('0xb')](),controller[_0x5bcd('0xc')]);router[_0x5bcd('0xa')]('/describe',auth[_0x5bcd('0xb')](),controller[_0x5bcd('0xd')]);router[_0x5bcd('0xa')](_0x5bcd('0xe'),auth['isAuthenticated'](),controller[_0x5bcd('0xf')]);router['post']('/',auth[_0x5bcd('0xb')](),controller[_0x5bcd('0x10')]);router[_0x5bcd('0x11')]('/:id',auth[_0x5bcd('0xb')](),controller[_0x5bcd('0x12')]);router[_0x5bcd('0x13')]('/:id',auth[_0x5bcd('0xb')](),controller[_0x5bcd('0x14')]);module[_0x5bcd('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 16b217d..d953297 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 _0x3b4e=['INTEGER','sequelize','STRING','ENUM','mouseOver','timeout'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x3b4e,0x199));var _0xe3b4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b4e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe3b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe3b4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe3b4('0x2')](_0xe3b4('0x3'),_0xe3b4('0x4')),'defaultValue':_0xe3b4('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe3b4('0x5')]}}; \ No newline at end of file +var _0x976d=['sequelize','exports','STRING','ENUM','timeout','mouseOver','INTEGER'];(function(_0x4c8cd7,_0xd8abf0){var _0x4bb28b=function(_0x3cfdc5){while(--_0x3cfdc5){_0x4c8cd7['push'](_0x4c8cd7['shift']());}};_0x4bb28b(++_0xd8abf0);}(_0x976d,0x111));var _0xd976=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x976d[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require(_0xd976('0x0'));module[_0xd976('0x1')]={'name':{'type':Sequelize[_0xd976('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd976('0x3')]('mouseOver',_0xd976('0x4')),'defaultValue':_0xd976('0x5')},'selector':{'type':Sequelize[_0xd976('0x2')]},'timeout':{'type':Sequelize[_0xd976('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 06bd9ce..a035c8d 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 _0x207c=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update'];(function(_0x1b3892,_0x418dc2){var _0x2ba023=function(_0x4d0e1d){while(--_0x4d0e1d){_0x1b3892['push'](_0x1b3892['shift']());}};_0x2ba023(++_0x418dc2);}(_0x207c,0x1e8));var _0xc207=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0x207c[_0x2f16e5];return _0x5d082a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={'raw':!![],'where':{'id':_0x6a653d[_0xc207('0x29')]['id']}},_0x463ac8={};_0x463ac8[_0xc207('0x2a')]=_[_0xc207('0x2b')](db[_0xc207('0x2c')][_0xc207('0x2d')]);_0x463ac8[_0xc207('0x2e')]=_[_0xc207('0x2b')](_0x6a653d[_0xc207('0x2e')]);_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_0x463ac8[_0xc207('0x2a')],_0x463ac8['query']);_0xe5e848[_0xc207('0x31')]=_[_0xc207('0x30')](_0x463ac8[_0xc207('0x2a')],qs[_0xc207('0x32')](_0x6a653d[_0xc207('0x2e')][_0xc207('0x32')]));_0xe5e848['attributes']=_0xe5e848[_0xc207('0x31')][_0xc207('0x33')]?_0xe5e848[_0xc207('0x31')]:_0x463ac8[_0xc207('0x2a')];if(_0x6a653d['query'][_0xc207('0x34')]){_0xe5e848[_0xc207('0x35')]=[{'all':!![]}];}_0xe5e848=_[_0xc207('0x36')]({},_0xe5e848,_0x6a653d[_0xc207('0x37')]);return db[_0xc207('0x2c')][_0xc207('0x38')](_0xe5e848)[_0xc207('0x23')](handleEntityNotFound(_0x478af7,null))[_0xc207('0x23')](respondWithResult(_0x478af7,null))[_0xc207('0x39')](handleError(_0x478af7,null));};exports['create']=function(_0x48d8a4,_0x188c39){return db[_0xc207('0x2c')][_0xc207('0x3a')](_0x48d8a4[_0xc207('0x3b')],{})['then'](respondWithResult(_0x188c39,0xc9))[_0xc207('0x39')](handleError(_0x188c39,null));};exports[_0xc207('0x3c')]=function(_0x20a5eb,_0x2a1c60){if(_0x20a5eb[_0xc207('0x3b')]['id']){delete _0x20a5eb['body']['id'];}return db[_0xc207('0x2c')][_0xc207('0x38')]({'where':{'id':_0x20a5eb['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x2a1c60,null))['then'](saveUpdates(_0x20a5eb[_0xc207('0x3b')],null))[_0xc207('0x23')](respondWithResult(_0x2a1c60,null))['catch'](handleError(_0x2a1c60,null));};exports[_0xc207('0x24')]=function(_0x95e166,_0x3313b1){return db['ChatProactiveAction']['find']({'where':{'id':_0x95e166[_0xc207('0x29')]['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3313b1,null))[_0xc207('0x23')](removeEntity(_0x3313b1,null))[_0xc207('0x39')](handleError(_0x3313b1,null));}; \ No newline at end of file +var _0xca9e=['query','keys','filters','intersection','model','attributes','fields','length','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','show','ChatProactiveAction'];(function(_0x51d7f9,_0x3aeba7){var _0x39b813=function(_0x702bfa){while(--_0x702bfa){_0x51d7f9['push'](_0x51d7f9['shift']());}};_0x39b813(++_0x3aeba7);}(_0xca9e,0x136));var _0xeca9=function(_0x430f80,_0x174517){_0x430f80=_0x430f80-0x0;var _0xbc09ec=_0xca9e[_0x430f80];return _0xbc09ec;};'use strict';var emlformat=require(_0xeca9('0x0'));var rimraf=require(_0xeca9('0x1'));var zipdir=require(_0xeca9('0x2'));var jsonpatch=require(_0xeca9('0x3'));var rp=require(_0xeca9('0x4'));var moment=require(_0xeca9('0x5'));var BPromise=require(_0xeca9('0x6'));var Mustache=require(_0xeca9('0x7'));var util=require(_0xeca9('0x8'));var path=require(_0xeca9('0x9'));var sox=require(_0xeca9('0xa'));var csv=require(_0xeca9('0xb'));var ejs=require(_0xeca9('0xc'));var fs=require('fs');var fs_extra=require(_0xeca9('0xd'));var _=require('lodash');var squel=require(_0xeca9('0xe'));var crypto=require(_0xeca9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeca9('0xb'));var querystring=require(_0xeca9('0x10'));var Papa=require(_0xeca9('0x11'));var Redis=require('ioredis');var authService=require(_0xeca9('0x12'));var qs=require(_0xeca9('0x13'));var as=require(_0xeca9('0x14'));var hardwareService=require(_0xeca9('0x15'));var logger=require(_0xeca9('0x16'))(_0xeca9('0x17'));var utils=require('../../config/utils');var config=require(_0xeca9('0x18'));var licenseUtil=require(_0xeca9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27ca6f,_0x4b2ae1){_0x4b2ae1=_0x4b2ae1||0xcc;return function(_0x3c6cc7){if(_0x3c6cc7){return _0x27ca6f[_0xeca9('0x1a')](_0x4b2ae1);}return _0x27ca6f['status'](_0x4b2ae1)[_0xeca9('0x1b')]();};}function respondWithResult(_0x384ae2,_0x1ba9e9){_0x1ba9e9=_0x1ba9e9||0xc8;return function(_0x4d65ee){if(_0x4d65ee){return _0x384ae2[_0xeca9('0x1c')](_0x1ba9e9)[_0xeca9('0x1d')](_0x4d65ee);}};}function respondWithFilteredResult(_0x910814,_0x6e9fd4){return function(_0x551393){if(_0x551393){var _0x520411=typeof _0x6e9fd4[_0xeca9('0x1e')]===_0xeca9('0x1f')&&typeof _0x6e9fd4['limit']===_0xeca9('0x1f');var _0x11bf78=_0x551393['count'];var _0x517060=_0x520411?0x0:_0x6e9fd4['offset'];var _0x132008=_0x520411?_0x551393[_0xeca9('0x20')]:_0x6e9fd4[_0xeca9('0x1e')]+_0x6e9fd4['limit'];var _0xf1ef9f;if(_0x132008>=_0x11bf78){_0x132008=_0x11bf78;_0xf1ef9f=0xc8;}else{_0xf1ef9f=0xce;}_0x910814['status'](_0xf1ef9f);return _0x910814['set'](_0xeca9('0x21'),_0x517060+'-'+_0x132008+'/'+_0x11bf78)['json'](_0x551393);}return null;};}function patchUpdates(_0x31720b){return function(_0x1c4dd6){try{jsonpatch['apply'](_0x1c4dd6,_0x31720b,!![]);}catch(_0x5a2cca){return BPromise[_0xeca9('0x22')](_0x5a2cca);}return _0x1c4dd6['save']();};}function saveUpdates(_0x3647ed,_0x5279d0){return function(_0x3a3608){if(_0x3a3608){return _0x3a3608[_0xeca9('0x23')](_0x3647ed)[_0xeca9('0x24')](function(_0x5c3495){return _0x5c3495;});}return null;};}function removeEntity(_0x3fcfb8,_0x466883){return function(_0x515e63){if(_0x515e63){return _0x515e63[_0xeca9('0x25')]()[_0xeca9('0x24')](function(){_0x3fcfb8[_0xeca9('0x1c')](0xcc)[_0xeca9('0x1b')]();});}};}function handleEntityNotFound(_0x498f4a,_0x32699b){return function(_0x57e190){if(!_0x57e190){_0x498f4a[_0xeca9('0x1a')](0x194);}return _0x57e190;};}function handleError(_0x251ce4,_0x1702fb){_0x1702fb=_0x1702fb||0x1f4;return function(_0x3e41df){logger[_0xeca9('0x26')](_0x3e41df[_0xeca9('0x27')]);if(_0x3e41df[_0xeca9('0x28')]){delete _0x3e41df[_0xeca9('0x28')];}_0x251ce4[_0xeca9('0x1c')](_0x1702fb)[_0xeca9('0x29')](_0x3e41df);};}exports[_0xeca9('0x2a')]=function(_0x3b0aab,_0x424f7b){var _0x1436d0={'raw':!![],'where':{'id':_0x3b0aab['params']['id']}},_0x8d9a8d={};_0x8d9a8d['model']=_['keys'](db[_0xeca9('0x2b')]['rawAttributes']);_0x8d9a8d[_0xeca9('0x2c')]=_[_0xeca9('0x2d')](_0x3b0aab[_0xeca9('0x2c')]);_0x8d9a8d[_0xeca9('0x2e')]=_[_0xeca9('0x2f')](_0x8d9a8d[_0xeca9('0x30')],_0x8d9a8d['query']);_0x1436d0[_0xeca9('0x31')]=_['intersection'](_0x8d9a8d[_0xeca9('0x30')],qs[_0xeca9('0x32')](_0x3b0aab[_0xeca9('0x2c')]['fields']));_0x1436d0[_0xeca9('0x31')]=_0x1436d0[_0xeca9('0x31')][_0xeca9('0x33')]?_0x1436d0[_0xeca9('0x31')]:_0x8d9a8d['model'];if(_0x3b0aab[_0xeca9('0x2c')]['includeAll']){_0x1436d0[_0xeca9('0x34')]=[{'all':!![]}];}_0x1436d0=_[_0xeca9('0x35')]({},_0x1436d0,_0x3b0aab[_0xeca9('0x36')]);return db[_0xeca9('0x2b')][_0xeca9('0x37')](_0x1436d0)[_0xeca9('0x24')](handleEntityNotFound(_0x424f7b,null))['then'](respondWithResult(_0x424f7b,null))[_0xeca9('0x38')](handleError(_0x424f7b,null));};exports[_0xeca9('0x39')]=function(_0x27c88a,_0xc01337){return db[_0xeca9('0x2b')][_0xeca9('0x39')](_0x27c88a[_0xeca9('0x3a')],{})['then'](respondWithResult(_0xc01337,0xc9))[_0xeca9('0x38')](handleError(_0xc01337,null));};exports[_0xeca9('0x23')]=function(_0x859deb,_0x178bd4){if(_0x859deb[_0xeca9('0x3a')]['id']){delete _0x859deb[_0xeca9('0x3a')]['id'];}return db['ChatProactiveAction'][_0xeca9('0x37')]({'where':{'id':_0x859deb['params']['id']}})[_0xeca9('0x24')](handleEntityNotFound(_0x178bd4,null))['then'](saveUpdates(_0x859deb[_0xeca9('0x3a')],null))[_0xeca9('0x24')](respondWithResult(_0x178bd4,null))['catch'](handleError(_0x178bd4,null));};exports[_0xeca9('0x25')]=function(_0x47a649,_0x2a249b){return db['ChatProactiveAction'][_0xeca9('0x37')]({'where':{'id':_0x47a649['params']['id']}})[_0xeca9('0x24')](handleEntityNotFound(_0x2a249b,null))[_0xeca9('0x24')](removeEntity(_0x2a249b,null))['catch'](handleError(_0x2a249b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 555da21..446fae9 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 _0xb716=['request-promise','path','rimraf','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0xb716,0x146));var _0x6b71=function(_0x4412e2,_0x2fa288){_0x4412e2=_0x4412e2-0x0;var _0x153bb4=_0xb716[_0x4412e2];return _0x153bb4;};'use strict';var _=require(_0x6b71('0x0'));var util=require('util');var logger=require(_0x6b71('0x1'))(_0x6b71('0x2'));var moment=require(_0x6b71('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b71('0x4'));var fs=require('fs');var path=require(_0x6b71('0x5'));var rimraf=require(_0x6b71('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x5b9c31,_0xed02f5){return _0x5b9c31[_0x6b71('0x7')](_0x6b71('0x8'),attributes,{'tableName':_0x6b71('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f1f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x28a879,_0x1e704a){var _0x2f24ba=function(_0xde54aa){while(--_0xde54aa){_0x28a879['push'](_0x28a879['shift']());}};_0x2f24ba(++_0x1e704a);}(_0x7f1f,0xb2));var _0xf7f1=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7f1f[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xf7f1('0x0'));var util=require(_0xf7f1('0x1'));var logger=require(_0xf7f1('0x2'))(_0xf7f1('0x3'));var moment=require(_0xf7f1('0x4'));var BPromise=require(_0xf7f1('0x5'));var rp=require(_0xf7f1('0x6'));var fs=require('fs');var path=require(_0xf7f1('0x7'));var rimraf=require(_0xf7f1('0x8'));var config=require(_0xf7f1('0x9'));var attributes=require(_0xf7f1('0xa'));module[_0xf7f1('0xb')]=function(_0x39e1db,_0x6aed69){return _0x39e1db[_0xf7f1('0xc')]('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 012e548..7023fed 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 _0xe70f=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe70f,0x10b));var _0xfe70=function(_0x20966b,_0x3491e0){_0x20966b=_0x20966b-0x0;var _0x2cb809=_0xe70f[_0x20966b];return _0x2cb809;};'use strict';var _=require(_0xfe70('0x0'));var util=require(_0xfe70('0x1'));var moment=require(_0xfe70('0x2'));var BPromise=require(_0xfe70('0x3'));var rs=require(_0xfe70('0x4'));var fs=require('fs');var Redis=require(_0xfe70('0x5'));var db=require(_0xfe70('0x6'))['db'];var utils=require(_0xfe70('0x7'));var logger=require(_0xfe70('0x8'))(_0xfe70('0x9'));var config=require(_0xfe70('0xa'));var jayson=require(_0xfe70('0xb'));var client=jayson[_0xfe70('0xc')][_0xfe70('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4dd348,_0x14822b,_0xda059c){return new BPromise(function(_0x862827,_0x334de4){return client[_0xfe70('0xe')](_0x4dd348,_0xda059c)[_0xfe70('0xf')](function(_0x1306b5){logger[_0xfe70('0x10')](_0xfe70('0x11'),_0x14822b,_0xfe70('0x12'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x14822b,_0xfe70('0x12'),JSON[_0xfe70('0x13')](_0x1306b5));if(_0x1306b5[_0xfe70('0x14')]){if(_0x1306b5[_0xfe70('0x14')][_0xfe70('0x15')]===0x1f4){logger[_0xfe70('0x14')](_0xfe70('0x11'),_0x14822b,_0x1306b5[_0xfe70('0x14')][_0xfe70('0x16')]);return _0x334de4(_0x1306b5[_0xfe70('0x14')][_0xfe70('0x16')]);}logger[_0xfe70('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x14822b,_0x1306b5[_0xfe70('0x14')]['message']);return _0x862827(_0x1306b5[_0xfe70('0x14')][_0xfe70('0x16')]);}else{logger[_0xfe70('0x10')](_0xfe70('0x11'),_0x14822b,'request\x20sent');_0x862827(_0x1306b5['result']['message']);}})[_0xfe70('0x17')](function(_0x382791){logger[_0xfe70('0x14')](_0xfe70('0x11'),_0x14822b,_0x382791);_0x334de4(_0x382791);});});} \ No newline at end of file +var _0xa863=['info','result','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0x57be17,_0x2fec3b){var _0x123632=function(_0x26eba0){while(--_0x26eba0){_0x57be17['push'](_0x57be17['shift']());}};_0x123632(++_0x2fec3b);}(_0xa863,0x1d0));var _0x3a86=function(_0x17da7,_0x2942af){_0x17da7=_0x17da7-0x0;var _0x2c8043=_0xa863[_0x17da7];return _0x2c8043;};'use strict';var _=require('lodash');var util=require(_0x3a86('0x0'));var moment=require('moment');var BPromise=require(_0x3a86('0x1'));var rs=require(_0x3a86('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a86('0x3'));var logger=require(_0x3a86('0x4'))(_0x3a86('0x5'));var config=require(_0x3a86('0x6'));var jayson=require(_0x3a86('0x7'));var client=jayson[_0x3a86('0x8')][_0x3a86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f6ad2,_0x22c8ef,_0x149229){return new BPromise(function(_0x4bbc1c,_0x4e090c){return client[_0x3a86('0xa')](_0x2f6ad2,_0x149229)[_0x3a86('0xb')](function(_0x29d1da){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x22c8ef,_0x3a86('0xc'));logger['debug'](_0x3a86('0xd'),_0x22c8ef,_0x3a86('0xc'),JSON[_0x3a86('0xe')](_0x29d1da));if(_0x29d1da[_0x3a86('0xf')]){if(_0x29d1da[_0x3a86('0xf')][_0x3a86('0x10')]===0x1f4){logger[_0x3a86('0xf')](_0x3a86('0x11'),_0x22c8ef,_0x29d1da[_0x3a86('0xf')][_0x3a86('0x12')]);return _0x4e090c(_0x29d1da[_0x3a86('0xf')]['message']);}logger[_0x3a86('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x22c8ef,_0x29d1da['error']['message']);return _0x4bbc1c(_0x29d1da['error']['message']);}else{logger[_0x3a86('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x22c8ef,_0x3a86('0xc'));_0x4bbc1c(_0x29d1da[_0x3a86('0x14')]['message']);}})['catch'](function(_0x2d491e){logger[_0x3a86('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x22c8ef,_0x2d491e);_0x4e090c(_0x2d491e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index dbee54f..6e0883c 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 _0x2eb2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','delete','util'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2eb2,0x19f));var _0x22eb=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x2eb2[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x22eb('0x7')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xa')]);router[_0x22eb('0xb')]('/',auth[_0x22eb('0x9')](),controller[_0x22eb('0xc')]);router[_0x22eb('0xd')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xe')]);router[_0x22eb('0xf')]('/:id',auth[_0x22eb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5d17=['create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post'];(function(_0x3f08cc,_0x232b96){var _0x4c9ee=function(_0x4bcfa3){while(--_0x4bcfa3){_0x3f08cc['push'](_0x3f08cc['shift']());}};_0x4c9ee(++_0x232b96);}(_0x5d17,0x114));var _0x75d1=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x5d17[_0x483e3a];return _0x43fca9;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/:id',auth[_0x75d1('0x9')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x9')](),controller[_0x75d1('0xc')]);router[_0x75d1('0xd')](_0x75d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x75d1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0x10')]);module[_0x75d1('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 235c634..1a6db14 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 _0x40c0=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x2e0416,_0x4be6a8){var _0x3b9336=function(_0x5b33ea){while(--_0x5b33ea){_0x2e0416['push'](_0x2e0416['shift']());}};_0x3b9336(++_0x4be6a8);}(_0x40c0,0x9c));var _0x040c=function(_0x2e9ad9,_0x124a5e){_0x2e9ad9=_0x2e9ad9-0x0;var _0x359589=_0x40c0[_0x2e9ad9];return _0x359589;};'use strict';var Sequelize=require(_0x040c('0x0'));module[_0x040c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x040c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x040c('0x3')]},'timeout':{'type':Sequelize[_0x040c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x040c('0x5')](_0x040c('0x6'),_0x040c('0x7'),_0x040c('0x8'))}}; \ No newline at end of file +var _0x3617=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x3617,0xf4));var _0x7361=function(_0x5729cb,_0xd09145){_0x5729cb=_0x5729cb-0x0;var _0x124104=_0x3617[_0x5729cb];return _0x124104;};'use strict';var Sequelize=require(_0x7361('0x0'));module[_0x7361('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7361('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7361('0x3')]},'timeout':{'type':Sequelize[_0x7361('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7361('0x5')](_0x7361('0x6'),_0x7361('0x7'),_0x7361('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a14a2a2..4bd2615 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 _0xc152=['%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','forEach','emit','removeTeams','ids','select','field','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','sequelize','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','bluebird','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','rawAttributes','where','include','query','findAll','rows','catch','params','model','keys','filters','intersection','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','chatPause','updatedAt','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc152,0x187));var _0x2c15=function(_0x4b6993,_0x4e2252){_0x4b6993=_0x4b6993-0x0;var _0x3679d1=_0xc152[_0x4b6993];return _0x3679d1;};'use strict';var BPromise=require(_0x2c15('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x2c15('0x1'));var Redis=require(_0x2c15('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x2c15('0x3'))('api');var config=require(_0x2c15('0x4'));var db=require(_0x2c15('0x5'))['db'];config['redis']=_[_0x2c15('0x6')](config[_0x2c15('0x7')],{'host':_0x2c15('0x8'),'port':0x18eb});var socket=require(_0x2c15('0x9'))(new Redis(config[_0x2c15('0x7')]));require('./chatQueue.socket')[_0x2c15('0xa')](socket);function respondWithStatusCode(_0x1a30f4,_0x5cf65b){_0x5cf65b=_0x5cf65b||0xcc;return function(_0x29aa74){if(_0x29aa74){return _0x1a30f4[_0x2c15('0xb')](_0x5cf65b);}return _0x1a30f4[_0x2c15('0xc')](_0x5cf65b)[_0x2c15('0xd')]();};}function respondWithResult(_0x1ea989,_0x3a68ba){_0x3a68ba=_0x3a68ba||0xc8;return function(_0xbb9b68){if(_0xbb9b68){return _0x1ea989[_0x2c15('0xc')](_0x3a68ba)[_0x2c15('0xe')](_0xbb9b68);}};}function respondWithFilteredResult(_0x19904d,_0x41c3b6){return function(_0xb06d41){if(_0xb06d41){var _0x597a91=typeof _0x41c3b6[_0x2c15('0xf')]===_0x2c15('0x10')&&typeof _0x41c3b6[_0x2c15('0x11')]===_0x2c15('0x10');var _0x58d5be=_0xb06d41[_0x2c15('0x12')];var _0x34bb73=_0x597a91?0x0:_0x41c3b6['offset'];var _0x3ebe53=_0x597a91?_0xb06d41['count']:_0x41c3b6['offset']+_0x41c3b6[_0x2c15('0x11')];var _0x5488d2;if(_0x3ebe53>=_0x58d5be){_0x3ebe53=_0x58d5be;_0x5488d2=0xc8;}else{_0x5488d2=0xce;}_0x19904d['status'](_0x5488d2);return _0x19904d[_0x2c15('0x13')](_0x2c15('0x14'),_0x34bb73+'-'+_0x3ebe53+'/'+_0x58d5be)['json'](_0xb06d41);}return null;};}function saveUpdates(_0x27a753){return function(_0x342726){if(_0x342726){return _0x342726[_0x2c15('0x15')](_0x27a753)[_0x2c15('0x16')](function(_0x1da2a7){return _0x1da2a7;});}return null;};}function removeEntity(_0x2e1258){return function(_0xaebab1){if(_0xaebab1){return _0xaebab1[_0x2c15('0x17')]()['then'](function(){var _0xc79045=_0xaebab1[_0x2c15('0x18')]({'plain':!![]});var _0x17339e=_0x2c15('0x19');return db[_0x2c15('0x1a')][_0x2c15('0x17')]({'where':{'type':_0x17339e,'resourceId':_0xc79045['id']}})[_0x2c15('0x16')](function(){return _0xaebab1;});})[_0x2c15('0x16')](function(){_0x2e1258[_0x2c15('0xc')](0xcc)[_0x2c15('0xd')]();});}};}function handleEntityNotFound(_0x3f8db6){return function(_0x8cf318){if(!_0x8cf318){_0x3f8db6[_0x2c15('0xb')](0x194);}return _0x8cf318;};}function handleError(_0x6d79d3,_0x5c7892){_0x5c7892=_0x5c7892||0x1f4;return function(_0x513e33){logger[_0x2c15('0x1b')](_0x513e33[_0x2c15('0x1c')]);if(_0x513e33[_0x2c15('0x1d')]){delete _0x513e33[_0x2c15('0x1d')];}_0x6d79d3[_0x2c15('0xc')](_0x5c7892)[_0x2c15('0x1e')](_0x513e33);};}exports[_0x2c15('0x1f')]=function(_0x43f1c7,_0x7cbd27){var _0x3ec325={};var _0xe9ca67={'count':0x0,'rows':[]};var _0x4a169c=_[_0x2c15('0x20')](db[_0x2c15('0x21')][_0x2c15('0x22')],function(_0x549fba){return{'name':_0x549fba['fieldName'],'type':_0x549fba['type']['key']};});_0x3ec325=qs['getOptions'](_0x4a169c,_0x43f1c7);var _0x327e2e={'where':_0x3ec325[_0x2c15('0x23')]};return db['ChatQueue'][_0x2c15('0x12')](_0x327e2e)[_0x2c15('0x16')](function(_0xf28872){_0xe9ca67[_0x2c15('0x12')]=_0xf28872;_0x3ec325[_0x2c15('0x24')]=qs['include'](_0x43f1c7[_0x2c15('0x25')]);return db['ChatQueue'][_0x2c15('0x26')](_0x3ec325);})[_0x2c15('0x16')](function(_0x5b85d6){_0xe9ca67[_0x2c15('0x27')]=_0x5b85d6;return _0xe9ca67;})['then'](respondWithFilteredResult(_0x7cbd27,_0x3ec325))[_0x2c15('0x28')](handleError(_0x7cbd27,null));};exports['show']=function(_0xe58be2,_0x3a39b8){var _0x260872={'raw':!![],'where':{'id':_0xe58be2[_0x2c15('0x29')]['id']}},_0x5a8a1e={};_0x5a8a1e[_0x2c15('0x2a')]=_[_0x2c15('0x2b')](db['ChatQueue']['rawAttributes']);_0x5a8a1e[_0x2c15('0x25')]=_[_0x2c15('0x2b')](_0xe58be2[_0x2c15('0x25')]);_0x5a8a1e[_0x2c15('0x2c')]=_[_0x2c15('0x2d')](_0x5a8a1e[_0x2c15('0x2a')],_0x5a8a1e[_0x2c15('0x25')]);_0x260872[_0x2c15('0x2e')]=_['intersection'](_0x5a8a1e[_0x2c15('0x2a')],qs[_0x2c15('0x2f')](_0xe58be2['query'][_0x2c15('0x2f')]));_0x260872[_0x2c15('0x2e')]=_0x260872[_0x2c15('0x2e')][_0x2c15('0x30')]?_0x260872[_0x2c15('0x2e')]:_0x5a8a1e['model'];if(_0xe58be2[_0x2c15('0x25')]['includeAll']){_0x260872[_0x2c15('0x24')]=[{'all':!![]}];}_0x260872=_[_0x2c15('0x31')]({},_0x260872,_0xe58be2[_0x2c15('0x32')]);return db['ChatQueue'][_0x2c15('0x33')](_0x260872)[_0x2c15('0x16')](handleEntityNotFound(_0x3a39b8,null))[_0x2c15('0x16')](respondWithResult(_0x3a39b8,null))['catch'](handleError(_0x3a39b8,null));};exports[_0x2c15('0x34')]=function(_0x30cd0b,_0x58727b){return db[_0x2c15('0x21')]['create'](_0x30cd0b[_0x2c15('0x35')],{})[_0x2c15('0x16')](function(_0x9cd1bc){var _0x21617c=_0x30cd0b[_0x2c15('0x36')][_0x2c15('0x18')]({'plain':!![]});if(!_0x21617c)throw new Error(_0x2c15('0x37'));if(_0x21617c[_0x2c15('0x38')]==='user'){var _0x8e5e1a=_0x9cd1bc[_0x2c15('0x18')]({'plain':!![]});var _0x4f77f8='ChatQueues';return db['UserProfileSection'][_0x2c15('0x33')]({'where':{'name':_0x4f77f8,'userProfileId':_0x21617c['userProfileId']},'raw':!![]})[_0x2c15('0x16')](function(_0x4a9958){if(_0x4a9958&&_0x4a9958['autoAssociation']===0x0){return db[_0x2c15('0x1a')][_0x2c15('0x34')]({'name':_0x8e5e1a['name'],'resourceId':_0x8e5e1a['id'],'type':_0x4a9958['name'],'sectionId':_0x4a9958['id']},{})[_0x2c15('0x16')](function(){return _0x9cd1bc;});}else{return _0x9cd1bc;}})['catch'](function(_0x9f4c40){logger['error'](_0x2c15('0x39'),_0x9f4c40);throw _0x9f4c40;});}return _0x9cd1bc;})['then'](respondWithResult(_0x58727b,0xc9))[_0x2c15('0x28')](handleError(_0x58727b,null));};exports[_0x2c15('0x15')]=function(_0x4146d7,_0x55a8e9){if(_0x4146d7[_0x2c15('0x35')]['id']){delete _0x4146d7[_0x2c15('0x35')]['id'];}return db[_0x2c15('0x21')][_0x2c15('0x33')]({'where':{'id':_0x4146d7[_0x2c15('0x29')]['id']}})[_0x2c15('0x16')](handleEntityNotFound(_0x55a8e9,null))['then'](saveUpdates(_0x4146d7[_0x2c15('0x35')],null))[_0x2c15('0x16')](respondWithResult(_0x55a8e9,null))[_0x2c15('0x28')](handleError(_0x55a8e9,null));};exports[_0x2c15('0x17')]=function(_0x28c4e3,_0x4dc2fe){return db[_0x2c15('0x21')][_0x2c15('0x33')]({'where':{'id':_0x28c4e3[_0x2c15('0x29')]['id']}})[_0x2c15('0x16')](handleEntityNotFound(_0x4dc2fe,null))['then'](removeEntity(_0x4dc2fe,null))['catch'](handleError(_0x4dc2fe,null));};exports[_0x2c15('0x3a')]=function(_0x690a90,_0x39639a){return db[_0x2c15('0x21')][_0x2c15('0x3a')]()['then'](respondWithResult(_0x39639a,null))[_0x2c15('0x28')](handleError(_0x39639a,null));};exports['getMembers']=function(_0x1a58a8,_0x25825a){var _0xb8a8d2={'raw':!![],'where':{}},_0x59a6fb={},_0x38e8f8;return db[_0x2c15('0x21')]['findOne']({'where':{'id':_0x1a58a8[_0x2c15('0x29')]['id']}})[_0x2c15('0x16')](handleEntityNotFound(_0x25825a,null))[_0x2c15('0x16')](function(_0x487eac){if(_0x487eac){_0x38e8f8=_0x487eac['get']({'plain':!![]});_0x59a6fb[_0x2c15('0x2a')]=_[_0x2c15('0x2b')](db[_0x2c15('0x3b')][_0x2c15('0x22')]);_0x59a6fb[_0x2c15('0x25')]=_[_0x2c15('0x2b')](_0x1a58a8['query']);_0x59a6fb['filters']=_[_0x2c15('0x2d')](_0x59a6fb[_0x2c15('0x2a')],_0x59a6fb[_0x2c15('0x25')]);_0xb8a8d2[_0x2c15('0x2e')]=_[_0x2c15('0x2d')](_0x59a6fb['model'],qs[_0x2c15('0x2f')](_0x1a58a8[_0x2c15('0x25')][_0x2c15('0x2f')]));_0xb8a8d2[_0x2c15('0x2e')]=_0xb8a8d2[_0x2c15('0x2e')]['length']?_0xb8a8d2[_0x2c15('0x2e')]:_0x59a6fb[_0x2c15('0x2a')];if(!_0x1a58a8[_0x2c15('0x25')][_0x2c15('0x3c')](_0x2c15('0x3d'))){_0xb8a8d2[_0x2c15('0x11')]=qs['limit'](_0x1a58a8[_0x2c15('0x25')][_0x2c15('0x11')]);_0xb8a8d2['offset']=qs[_0x2c15('0xf')](_0x1a58a8[_0x2c15('0x25')]['offset']);}_0xb8a8d2[_0x2c15('0x3e')]=qs[_0x2c15('0x3f')](_0x1a58a8[_0x2c15('0x25')][_0x2c15('0x3f')]);_0xb8a8d2[_0x2c15('0x23')]=qs['filters'](_[_0x2c15('0x40')](_0x1a58a8[_0x2c15('0x25')],_0x59a6fb[_0x2c15('0x2c')]));_0xb8a8d2[_0x2c15('0x23')][_0x2c15('0x41')]=_0x487eac['id'];if(_0x1a58a8['query'][_0x2c15('0x42')]){_0xb8a8d2[_0x2c15('0x23')]=_[_0x2c15('0x31')](_0xb8a8d2[_0x2c15('0x23')],{'$or':_[_0x2c15('0x20')](_0xb8a8d2[_0x2c15('0x2e')],function(_0x3ab00b){var _0x1782e9={};_0x1782e9[_0x3ab00b]={'$like':'%'+_0x1a58a8['query'][_0x2c15('0x42')]+'%'};return _0x1782e9;})});}_0xb8a8d2=_[_0x2c15('0x31')]({},_0xb8a8d2,_0x1a58a8[_0x2c15('0x32')]);return db[_0x2c15('0x3b')]['findAll'](_0xb8a8d2);}})[_0x2c15('0x16')](function(_0x49d34f){if(_0x49d34f){return db[_0x2c15('0x43')][_0x2c15('0x44')]({'where':{'id':_['map'](_0x49d34f,_0x2c15('0x45')),'role':'agent'},'attributes':['id',_0x2c15('0x1d'),_0x2c15('0x46'),_0x2c15('0x47'),'createdAt']});}})[_0x2c15('0x16')](function(_0x417d62){if(_0x417d62){return{'count':_0x417d62[_0x2c15('0x12')],'rows':_['map'](_0x417d62['rows'],function(_0x238cd0){return{'membername':_0x238cd0[_0x2c15('0x1d')],'UserId':_0x238cd0['id'],'queue_name':_0x38e8f8[_0x2c15('0x1d')],'ChatQueueId':_0x38e8f8['id'],'interface':util[_0x2c15('0x48')](_0x2c15('0x49'),_0x2c15('0x4a'),_0x238cd0[_0x2c15('0x1d')]),'penalty':0x0,'paused':_0x238cd0[_0x2c15('0x46')],'createdAt':_0x238cd0[_0x2c15('0x4b')],'updatedAt':_0x238cd0[_0x2c15('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2c15('0x16')](respondWithFilteredResult(_0x25825a,_0xb8a8d2))[_0x2c15('0x28')](handleError(_0x25825a,null));};exports[_0x2c15('0x4c')]=function(_0x3cece5,_0x4e7655){var _0xf6354e={};var _0x5eb3b7={};var _0x3e693a;var _0x29429b;return db[_0x2c15('0x21')][_0x2c15('0x4d')]({'where':{'id':_0x3cece5[_0x2c15('0x29')]['id']}})[_0x2c15('0x16')](handleEntityNotFound(_0x4e7655,null))[_0x2c15('0x16')](function(_0x22373d){if(_0x22373d){_0x3e693a=_0x22373d;_0x5eb3b7[_0x2c15('0x2a')]=_[_0x2c15('0x2b')](db[_0x2c15('0x4e')]['rawAttributes']);_0x5eb3b7[_0x2c15('0x25')]=_['keys'](_0x3cece5['query']);_0x5eb3b7[_0x2c15('0x2c')]=_['intersection'](_0x5eb3b7[_0x2c15('0x2a')],_0x5eb3b7[_0x2c15('0x25')]);_0xf6354e['attributes']=_['intersection'](_0x5eb3b7[_0x2c15('0x2a')],qs[_0x2c15('0x2f')](_0x3cece5[_0x2c15('0x25')][_0x2c15('0x2f')]));_0xf6354e[_0x2c15('0x2e')]=_0xf6354e[_0x2c15('0x2e')][_0x2c15('0x30')]?_0xf6354e[_0x2c15('0x2e')]:_0x5eb3b7[_0x2c15('0x2a')];_0xf6354e[_0x2c15('0x3e')]=qs[_0x2c15('0x3f')](_0x3cece5['query'][_0x2c15('0x3f')]);_0xf6354e[_0x2c15('0x23')]=qs['filters'](_['pick'](_0x3cece5['query'],_0x5eb3b7['filters']));if(_0x3cece5[_0x2c15('0x25')][_0x2c15('0x42')]){_0xf6354e[_0x2c15('0x23')]=_[_0x2c15('0x31')](_0xf6354e[_0x2c15('0x23')],{'$or':_['map'](_0xf6354e[_0x2c15('0x2e')],function(_0x6a45d){var _0x30e843={};_0x30e843[_0x6a45d]={'$like':'%'+_0x3cece5[_0x2c15('0x25')][_0x2c15('0x42')]+'%'};return _0x30e843;})});}_0xf6354e=_[_0x2c15('0x31')]({},_0xf6354e,_0x3cece5[_0x2c15('0x32')]);return _0x3e693a['getTeams'](_0xf6354e);}})['then'](function(_0x2d5683){if(_0x2d5683){_0x29429b=_0x2d5683[_0x2c15('0x30')];if(!_0x3cece5[_0x2c15('0x25')][_0x2c15('0x3c')](_0x2c15('0x3d'))){_0xf6354e['limit']=qs[_0x2c15('0x11')](_0x3cece5[_0x2c15('0x25')][_0x2c15('0x11')]);_0xf6354e[_0x2c15('0xf')]=qs['offset'](_0x3cece5[_0x2c15('0x25')][_0x2c15('0xf')]);}return _0x3e693a[_0x2c15('0x4c')](_0xf6354e);}})[_0x2c15('0x16')](function(_0x10a253){if(_0x10a253){return _0x10a253?{'count':_0x29429b,'rows':_0x10a253}:null;}})[_0x2c15('0x16')](respondWithResult(_0x4e7655,null))[_0x2c15('0x28')](handleError(_0x4e7655,null));};exports[_0x2c15('0x4f')]=function(_0x4559b4,_0x253c11){var _0x12910f=_0x4559b4[_0x2c15('0x35')]['ids'];return db[_0x2c15('0x4e')][_0x2c15('0x26')]({'where':{'id':_0x12910f},'attributes':['id'],'include':[{'model':db[_0x2c15('0x43')],'as':_0x2c15('0x50'),'attributes':['id','name',_0x2c15('0x51'),_0x2c15('0x52'),_0x2c15('0x53')],'raw':!![]}]})[_0x2c15('0x16')](function(_0x6b5b34){if(_0x6b5b34){var _0x247ee9=_[_0x2c15('0x54')](_0x6b5b34,function(_0xe6e34e){var _0x54b1bd=_0xe6e34e[_0x2c15('0x18')]({'plain':!![]});return _0x54b1bd[_0x2c15('0x50')];});return db[_0x2c15('0x21')][_0x2c15('0x33')]({'where':{'id':_0x4559b4['params']['id']}})[_0x2c15('0x16')](function(_0x172895){return db['sequelize'][_0x2c15('0x55')](function(_0xc15f5d){return _0x172895['addTeams'](_0x12910f,{'transaction':_0xc15f5d})[_0x2c15('0x16')](function(){return BPromise['each'](_0x247ee9,function(_0x510559){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x510559['id'],'ChatQueueId':_0x4559b4[_0x2c15('0x29')]['id']},'transaction':_0xc15f5d});});})[_0x2c15('0x16')](function(){_0x247ee9[_0x2c15('0x56')](function(_0x4a3e08){socket[_0x2c15('0x57')]('userChatQueue:save',{'UserId':_0x4a3e08['id'],'ChatQueueId':_0x172895['id']});});});});});}})['then'](respondWithStatusCode(_0x253c11,null))['catch'](handleError(_0x253c11,null));};exports[_0x2c15('0x58')]=function(_0x43a1a4,_0x28a6b2){return db[_0x2c15('0x4e')][_0x2c15('0x26')]({'where':{'id':_0x43a1a4['query'][_0x2c15('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2c15('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2c15('0x16')](handleEntityNotFound(_0x28a6b2,null))[_0x2c15('0x16')](function(_0x1c3147){var _0x296145=_[_0x2c15('0x20')](_0x1c3147,'id');var _0x5d0cde=[];var _0x52c6f4=[];var _0xf49b11=squel[_0x2c15('0x5a')]();_0xf49b11[_0x2c15('0x5b')]('tq.TeamId')[_0x2c15('0x5c')](_0x2c15('0x5d'),'tq')[_0x2c15('0x5e')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2c15('0x5f'),_0x43a1a4[_0x2c15('0x29')]['id']);for(var _0x3edaa4=0x0;_0x3edaa4<_0x1c3147['length'];_0x3edaa4+=0x1){let _0x1409a4=_0x1c3147[_0x3edaa4];for(var _0x18460f=0x0;_0x18460f<_0x1409a4[_0x2c15('0x50')][_0x2c15('0x30')];_0x18460f+=0x1){let _0x39fb31=_0x1409a4[_0x2c15('0x50')][_0x18460f];var _0x3ca30c=_0xf49b11[_0x2c15('0x60')]();_0x3ca30c[_0x2c15('0x23')]('ut.UserId\x20=\x20?',_0x39fb31['id']);_0x52c6f4[_0x2c15('0x61')](db['sequelize'][_0x2c15('0x25')](_0x3ca30c[_0x2c15('0x62')](),{'type':db['sequelize'][_0x2c15('0x63')][_0x2c15('0x64')]})[_0x2c15('0x16')](function(_0x2a5b7f){if(_0x2a5b7f['length']===0x1){return _0x39fb31['id'];}else{var _0x87e9e8=_['every'](_['map'](_0x2a5b7f,_0x2c15('0x65')),function(_0x9a9c0b){return _[_0x2c15('0x66')](_0x296145,_0x9a9c0b);});if(_0x87e9e8){return _0x39fb31['id'];}}}));}}return BPromise[_0x2c15('0x67')](_0x52c6f4)[_0x2c15('0x16')](function(_0x49ee50){_0x5d0cde=_(_0x5d0cde)[_0x2c15('0x68')](_0x49ee50)[_0x2c15('0x69')]()['value']();return db[_0x2c15('0x21')][_0x2c15('0x33')]({'where':{'id':_0x43a1a4['params']['id']}})[_0x2c15('0x16')](function(_0x3eac12){return db[_0x2c15('0x6a')][_0x2c15('0x55')](function(_0x480844){return _0x3eac12['removeTeams'](_0x43a1a4[_0x2c15('0x25')][_0x2c15('0x59')],{'transaction':_0x480844})[_0x2c15('0x16')](function(){if(!_[_0x2c15('0x6b')](_0x5d0cde)){return _0x3eac12[_0x2c15('0x6c')](_0x5d0cde,{'transaction':_0x480844});}})[_0x2c15('0x16')](function(){_0x5d0cde['forEach'](function(_0x34aaa1){socket[_0x2c15('0x57')](_0x2c15('0x6d'),{'UserId':_0x34aaa1,'ChatQueueId':_0x3eac12['id']});});});});});});})[_0x2c15('0x16')](respondWithStatusCode(_0x28a6b2,null))['catch'](handleError(_0x28a6b2,null));};exports['addAgents']=function(_0x2ebb9c,_0x1ab350){return db[_0x2c15('0x21')][_0x2c15('0x33')]({'where':{'id':_0x2ebb9c[_0x2c15('0x29')]['id']}})[_0x2c15('0x16')](handleEntityNotFound(_0x1ab350,null))['then'](function(_0x2b1354){if(_0x2b1354){return _0x2b1354[_0x2c15('0x6e')](_0x2ebb9c[_0x2c15('0x35')]['ids'],_[_0x2c15('0x6f')](_0x2ebb9c['body'],[_0x2c15('0x59'),'id'])||{})[_0x2c15('0x70')](function(_0x365183){for(var _0xd4300f=0x0;_0xd4300f<_0x2ebb9c['body'][_0x2c15('0x59')][_0x2c15('0x30')];_0xd4300f+=0x1){socket[_0x2c15('0x57')](_0x2c15('0x71'),{'UserId':Number(_0x2ebb9c[_0x2c15('0x35')]['ids'][_0xd4300f]),'ChatQueueId':Number(_0x2ebb9c[_0x2c15('0x29')]['id'])});}return _0x365183;});}})[_0x2c15('0x16')](respondWithResult(_0x1ab350,null))[_0x2c15('0x28')](handleError(_0x1ab350,null));};exports[_0x2c15('0x6c')]=function(_0x1314df,_0x39a3dc){return db['ChatQueue'][_0x2c15('0x33')]({'where':{'id':_0x1314df['params']['id']}})['then'](handleEntityNotFound(_0x39a3dc,null))[_0x2c15('0x16')](function(_0x28ff12){if(_0x28ff12){return _0x28ff12[_0x2c15('0x6c')](_0x1314df[_0x2c15('0x25')][_0x2c15('0x59')])[_0x2c15('0x16')](function(){if(_[_0x2c15('0x72')](_0x1314df[_0x2c15('0x25')][_0x2c15('0x59')])){for(var _0x47f059=0x0;_0x47f059<_0x1314df[_0x2c15('0x25')][_0x2c15('0x59')]['length'];_0x47f059+=0x1){socket[_0x2c15('0x57')]('userChatQueue:remove',{'UserId':Number(_0x1314df[_0x2c15('0x25')][_0x2c15('0x59')][_0x47f059]),'ChatQueueId':Number(_0x1314df[_0x2c15('0x29')]['id'])});}}else{socket['emit'](_0x2c15('0x6d'),{'UserId':Number(_0x1314df[_0x2c15('0x25')]['ids']),'ChatQueueId':Number(_0x1314df[_0x2c15('0x29')]['id'])});}});}})[_0x2c15('0x16')](respondWithStatusCode(_0x39a3dc,null))[_0x2c15('0x28')](handleError(_0x39a3dc,null));};exports[_0x2c15('0x73')]=function(_0x864b7b,_0x15265d){var _0x35d894={};var _0x26981a={};var _0x1d2a7c;var _0x55ea01;return db[_0x2c15('0x21')][_0x2c15('0x4d')]({'where':{'id':_0x864b7b[_0x2c15('0x29')]['id']}})['then'](handleEntityNotFound(_0x15265d,null))[_0x2c15('0x16')](function(_0x51d069){if(_0x51d069){_0x1d2a7c=_0x51d069;_0x26981a['model']=_[_0x2c15('0x2b')](db[_0x2c15('0x43')][_0x2c15('0x22')]);_0x26981a[_0x2c15('0x25')]=_[_0x2c15('0x2b')](_0x864b7b[_0x2c15('0x25')]);_0x26981a[_0x2c15('0x2c')]=_[_0x2c15('0x2d')](_0x26981a[_0x2c15('0x2a')],_0x26981a[_0x2c15('0x25')]);_0x35d894[_0x2c15('0x2e')]=_[_0x2c15('0x2d')](_0x26981a[_0x2c15('0x2a')],qs[_0x2c15('0x2f')](_0x864b7b[_0x2c15('0x25')][_0x2c15('0x2f')]));_0x35d894[_0x2c15('0x2e')]=_0x35d894[_0x2c15('0x2e')]['length']?_0x35d894[_0x2c15('0x2e')]:_0x26981a['model'];_0x35d894[_0x2c15('0x3e')]=qs[_0x2c15('0x3f')](_0x864b7b[_0x2c15('0x25')][_0x2c15('0x3f')]);_0x35d894[_0x2c15('0x23')]=qs[_0x2c15('0x2c')](_[_0x2c15('0x40')](_0x864b7b[_0x2c15('0x25')],_0x26981a[_0x2c15('0x2c')]));if(_0x864b7b[_0x2c15('0x25')][_0x2c15('0x42')]){_0x35d894[_0x2c15('0x23')]=_[_0x2c15('0x31')](_0x35d894[_0x2c15('0x23')],{'$or':_[_0x2c15('0x20')](_0x35d894['attributes'],function(_0x1fae34){var _0x10332f={};_0x10332f[_0x1fae34]={'$like':'%'+_0x864b7b[_0x2c15('0x25')][_0x2c15('0x42')]+'%'};return _0x10332f;})});}_0x35d894=_[_0x2c15('0x31')]({},_0x35d894,_0x864b7b[_0x2c15('0x32')]);return _0x1d2a7c[_0x2c15('0x73')](_0x35d894);}})['then'](function(_0x2bb79c){if(_0x2bb79c){_0x55ea01=_0x2bb79c[_0x2c15('0x30')];if(!_0x864b7b[_0x2c15('0x25')][_0x2c15('0x3c')](_0x2c15('0x3d'))){_0x35d894['limit']=qs[_0x2c15('0x11')](_0x864b7b[_0x2c15('0x25')][_0x2c15('0x11')]);_0x35d894[_0x2c15('0xf')]=qs[_0x2c15('0xf')](_0x864b7b[_0x2c15('0x25')][_0x2c15('0xf')]);}return _0x1d2a7c[_0x2c15('0x73')](_0x35d894);}})[_0x2c15('0x16')](function(_0x4a4e02){if(_0x4a4e02){return _0x4a4e02?{'count':_0x55ea01,'rows':_0x4a4e02}:null;}})[_0x2c15('0x16')](respondWithResult(_0x15265d,null))[_0x2c15('0x28')](handleError(_0x15265d,null));}; \ No newline at end of file +var _0xde1b=['findOne','params','UserChatQueue','hasOwnProperty','nolimit','limit','order','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','%s/%s','SIP','createdAt','getTeams','addTeams','Team','voicePause','flatMap','sequelize','transaction','each','emit','userChatQueue:save','removeTeams','ids','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','get','destroy','error','name','send','map','rawAttributes','fieldName','type','key','getOptions','where','ChatQueue','include','query','findAll','catch','show','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe'];(function(_0x37ef92,_0x232630){var _0x4170d9=function(_0x3a169d){while(--_0x3a169d){_0x37ef92['push'](_0x37ef92['shift']());}};_0x4170d9(++_0x232630);}(_0xde1b,0x1ad));var _0xbde1=function(_0x1ecebb,_0x1e5587){_0x1ecebb=_0x1ecebb-0x0;var _0x414707=_0xde1b[_0x1ecebb];return _0x414707;};'use strict';var BPromise=require(_0xbde1('0x0'));var util=require(_0xbde1('0x1'));var _=require(_0xbde1('0x2'));var squel=require(_0xbde1('0x3'));var Redis=require('ioredis');var qs=require(_0xbde1('0x4'));var logger=require(_0xbde1('0x5'))(_0xbde1('0x6'));var config=require(_0xbde1('0x7'));var db=require(_0xbde1('0x8'))['db'];config[_0xbde1('0x9')]=_[_0xbde1('0xa')](config['redis'],{'host':_0xbde1('0xb'),'port':0x18eb});var socket=require(_0xbde1('0xc'))(new Redis(config[_0xbde1('0x9')]));require('./chatQueue.socket')[_0xbde1('0xd')](socket);function respondWithStatusCode(_0x270371,_0x3b76a2){_0x3b76a2=_0x3b76a2||0xcc;return function(_0x4bdad4){if(_0x4bdad4){return _0x270371[_0xbde1('0xe')](_0x3b76a2);}return _0x270371[_0xbde1('0xf')](_0x3b76a2)[_0xbde1('0x10')]();};}function respondWithResult(_0x52c8f6,_0x2b47f9){_0x2b47f9=_0x2b47f9||0xc8;return function(_0x9d4f14){if(_0x9d4f14){return _0x52c8f6[_0xbde1('0xf')](_0x2b47f9)[_0xbde1('0x11')](_0x9d4f14);}};}function respondWithFilteredResult(_0x30757d,_0x2def31){return function(_0x3d6ca2){if(_0x3d6ca2){var _0x36ac04=typeof _0x2def31[_0xbde1('0x12')]===_0xbde1('0x13')&&typeof _0x2def31['limit']===_0xbde1('0x13');var _0x5a53c9=_0x3d6ca2['count'];var _0x1312a7=_0x36ac04?0x0:_0x2def31[_0xbde1('0x12')];var _0x47b007=_0x36ac04?_0x3d6ca2[_0xbde1('0x14')]:_0x2def31[_0xbde1('0x12')]+_0x2def31['limit'];var _0x1b7fcc;if(_0x47b007>=_0x5a53c9){_0x47b007=_0x5a53c9;_0x1b7fcc=0xc8;}else{_0x1b7fcc=0xce;}_0x30757d[_0xbde1('0xf')](_0x1b7fcc);return _0x30757d[_0xbde1('0x15')](_0xbde1('0x16'),_0x1312a7+'-'+_0x47b007+'/'+_0x5a53c9)[_0xbde1('0x11')](_0x3d6ca2);}return null;};}function saveUpdates(_0xc230b9){return function(_0x2da993){if(_0x2da993){return _0x2da993[_0xbde1('0x17')](_0xc230b9)['then'](function(_0x1ae6f1){return _0x1ae6f1;});}return null;};}function removeEntity(_0xfd1c86){return function(_0x337fee){if(_0x337fee){return _0x337fee['destroy']()[_0xbde1('0x18')](function(){var _0x4afc2c=_0x337fee[_0xbde1('0x19')]({'plain':!![]});var _0x4c8e0f='ChatQueues';return db['UserProfileResource'][_0xbde1('0x1a')]({'where':{'type':_0x4c8e0f,'resourceId':_0x4afc2c['id']}})['then'](function(){return _0x337fee;});})[_0xbde1('0x18')](function(){_0xfd1c86['status'](0xcc)[_0xbde1('0x10')]();});}};}function handleEntityNotFound(_0x2e9148){return function(_0x5c3c2b){if(!_0x5c3c2b){_0x2e9148[_0xbde1('0xe')](0x194);}return _0x5c3c2b;};}function handleError(_0x2e7327,_0xdb6f0f){_0xdb6f0f=_0xdb6f0f||0x1f4;return function(_0x5166f5){logger[_0xbde1('0x1b')](_0x5166f5['stack']);if(_0x5166f5[_0xbde1('0x1c')]){delete _0x5166f5[_0xbde1('0x1c')];}_0x2e7327[_0xbde1('0xf')](_0xdb6f0f)[_0xbde1('0x1d')](_0x5166f5);};}exports['index']=function(_0x35034e,_0x582ec3){var _0x8da818={};var _0x45d1f2={'count':0x0,'rows':[]};var _0x260b5c=_[_0xbde1('0x1e')](db['ChatQueue'][_0xbde1('0x1f')],function(_0x5eb64b){return{'name':_0x5eb64b[_0xbde1('0x20')],'type':_0x5eb64b[_0xbde1('0x21')][_0xbde1('0x22')]};});_0x8da818=qs[_0xbde1('0x23')](_0x260b5c,_0x35034e);var _0x3bcf23={'where':_0x8da818[_0xbde1('0x24')]};return db[_0xbde1('0x25')]['count'](_0x3bcf23)[_0xbde1('0x18')](function(_0x18b5d8){_0x45d1f2[_0xbde1('0x14')]=_0x18b5d8;_0x8da818[_0xbde1('0x26')]=qs[_0xbde1('0x26')](_0x35034e[_0xbde1('0x27')]);return db['ChatQueue'][_0xbde1('0x28')](_0x8da818);})['then'](function(_0x4437ed){_0x45d1f2['rows']=_0x4437ed;return _0x45d1f2;})['then'](respondWithFilteredResult(_0x582ec3,_0x8da818))[_0xbde1('0x29')](handleError(_0x582ec3,null));};exports[_0xbde1('0x2a')]=function(_0x2df4c6,_0x57173d){var _0x588df8={'raw':!![],'where':{'id':_0x2df4c6['params']['id']}},_0x42836a={};_0x42836a[_0xbde1('0x2b')]=_[_0xbde1('0x2c')](db[_0xbde1('0x25')][_0xbde1('0x1f')]);_0x42836a[_0xbde1('0x27')]=_[_0xbde1('0x2c')](_0x2df4c6[_0xbde1('0x27')]);_0x42836a[_0xbde1('0x2d')]=_[_0xbde1('0x2e')](_0x42836a[_0xbde1('0x2b')],_0x42836a[_0xbde1('0x27')]);_0x588df8['attributes']=_[_0xbde1('0x2e')](_0x42836a[_0xbde1('0x2b')],qs[_0xbde1('0x2f')](_0x2df4c6[_0xbde1('0x27')]['fields']));_0x588df8['attributes']=_0x588df8[_0xbde1('0x30')][_0xbde1('0x31')]?_0x588df8['attributes']:_0x42836a['model'];if(_0x2df4c6[_0xbde1('0x27')][_0xbde1('0x32')]){_0x588df8[_0xbde1('0x26')]=[{'all':!![]}];}_0x588df8=_[_0xbde1('0x33')]({},_0x588df8,_0x2df4c6[_0xbde1('0x34')]);return db['ChatQueue']['find'](_0x588df8)['then'](handleEntityNotFound(_0x57173d,null))[_0xbde1('0x18')](respondWithResult(_0x57173d,null))[_0xbde1('0x29')](handleError(_0x57173d,null));};exports['create']=function(_0x192bee,_0x5d490f){return db[_0xbde1('0x25')]['create'](_0x192bee[_0xbde1('0x35')],{})[_0xbde1('0x18')](function(_0x49dfb2){var _0x47fabe=_0x192bee[_0xbde1('0x36')][_0xbde1('0x19')]({'plain':!![]});if(!_0x47fabe)throw new Error(_0xbde1('0x37'));if(_0x47fabe['role']===_0xbde1('0x36')){var _0x5b77ba=_0x49dfb2[_0xbde1('0x19')]({'plain':!![]});var _0x683d49=_0xbde1('0x38');return db['UserProfileSection']['find']({'where':{'name':_0x683d49,'userProfileId':_0x47fabe[_0xbde1('0x39')]},'raw':!![]})['then'](function(_0x1c227b){if(_0x1c227b&&_0x1c227b['autoAssociation']===0x0){return db[_0xbde1('0x3a')][_0xbde1('0x3b')]({'name':_0x5b77ba[_0xbde1('0x1c')],'resourceId':_0x5b77ba['id'],'type':_0x1c227b[_0xbde1('0x1c')],'sectionId':_0x1c227b['id']},{})[_0xbde1('0x18')](function(){return _0x49dfb2;});}else{return _0x49dfb2;}})[_0xbde1('0x29')](function(_0x5f058f){logger[_0xbde1('0x1b')](_0xbde1('0x3c'),_0x5f058f);throw _0x5f058f;});}return _0x49dfb2;})[_0xbde1('0x18')](respondWithResult(_0x5d490f,0xc9))['catch'](handleError(_0x5d490f,null));};exports[_0xbde1('0x17')]=function(_0x311b97,_0x4219f3){if(_0x311b97['body']['id']){delete _0x311b97[_0xbde1('0x35')]['id'];}return db[_0xbde1('0x25')][_0xbde1('0x3d')]({'where':{'id':_0x311b97['params']['id']}})[_0xbde1('0x18')](handleEntityNotFound(_0x4219f3,null))[_0xbde1('0x18')](saveUpdates(_0x311b97['body'],null))['then'](respondWithResult(_0x4219f3,null))[_0xbde1('0x29')](handleError(_0x4219f3,null));};exports['destroy']=function(_0x45f5c9,_0x3fea7a){return db[_0xbde1('0x25')]['find']({'where':{'id':_0x45f5c9['params']['id']}})[_0xbde1('0x18')](handleEntityNotFound(_0x3fea7a,null))[_0xbde1('0x18')](removeEntity(_0x3fea7a,null))[_0xbde1('0x29')](handleError(_0x3fea7a,null));};exports[_0xbde1('0x3e')]=function(_0x565c21,_0x526c82){return db[_0xbde1('0x25')][_0xbde1('0x3e')]()[_0xbde1('0x18')](respondWithResult(_0x526c82,null))[_0xbde1('0x29')](handleError(_0x526c82,null));};exports['getMembers']=function(_0x54100e,_0x116793){var _0xdda028={'raw':!![],'where':{}},_0x1e3a97={},_0x1f717d;return db[_0xbde1('0x25')][_0xbde1('0x3f')]({'where':{'id':_0x54100e[_0xbde1('0x40')]['id']}})[_0xbde1('0x18')](handleEntityNotFound(_0x116793,null))['then'](function(_0x5bb5fb){if(_0x5bb5fb){_0x1f717d=_0x5bb5fb[_0xbde1('0x19')]({'plain':!![]});_0x1e3a97[_0xbde1('0x2b')]=_['keys'](db[_0xbde1('0x41')][_0xbde1('0x1f')]);_0x1e3a97[_0xbde1('0x27')]=_[_0xbde1('0x2c')](_0x54100e[_0xbde1('0x27')]);_0x1e3a97[_0xbde1('0x2d')]=_[_0xbde1('0x2e')](_0x1e3a97[_0xbde1('0x2b')],_0x1e3a97[_0xbde1('0x27')]);_0xdda028[_0xbde1('0x30')]=_['intersection'](_0x1e3a97['model'],qs['fields'](_0x54100e['query']['fields']));_0xdda028[_0xbde1('0x30')]=_0xdda028[_0xbde1('0x30')]['length']?_0xdda028['attributes']:_0x1e3a97[_0xbde1('0x2b')];if(!_0x54100e[_0xbde1('0x27')][_0xbde1('0x42')](_0xbde1('0x43'))){_0xdda028[_0xbde1('0x44')]=qs[_0xbde1('0x44')](_0x54100e[_0xbde1('0x27')][_0xbde1('0x44')]);_0xdda028['offset']=qs[_0xbde1('0x12')](_0x54100e['query'][_0xbde1('0x12')]);}_0xdda028[_0xbde1('0x45')]=qs[_0xbde1('0x46')](_0x54100e[_0xbde1('0x27')][_0xbde1('0x46')]);_0xdda028[_0xbde1('0x24')]=qs[_0xbde1('0x2d')](_[_0xbde1('0x47')](_0x54100e[_0xbde1('0x27')],_0x1e3a97[_0xbde1('0x2d')]));_0xdda028[_0xbde1('0x24')][_0xbde1('0x48')]=_0x5bb5fb['id'];if(_0x54100e[_0xbde1('0x27')][_0xbde1('0x49')]){_0xdda028['where']=_[_0xbde1('0x33')](_0xdda028['where'],{'$or':_[_0xbde1('0x1e')](_0xdda028['attributes'],function(_0x27c4dc){var _0x1cbee5={};_0x1cbee5[_0x27c4dc]={'$like':'%'+_0x54100e[_0xbde1('0x27')]['filter']+'%'};return _0x1cbee5;})});}_0xdda028=_[_0xbde1('0x33')]({},_0xdda028,_0x54100e['options']);return db[_0xbde1('0x41')]['findAll'](_0xdda028);}})[_0xbde1('0x18')](function(_0x10d0fd){if(_0x10d0fd){return db[_0xbde1('0x4a')][_0xbde1('0x4b')]({'where':{'id':_['map'](_0x10d0fd,_0xbde1('0x4c')),'role':_0xbde1('0x4d')},'attributes':['id',_0xbde1('0x1c'),_0xbde1('0x4e'),'updatedAt','createdAt']});}})['then'](function(_0x3f37f4){if(_0x3f37f4){return{'count':_0x3f37f4[_0xbde1('0x14')],'rows':_[_0xbde1('0x1e')](_0x3f37f4['rows'],function(_0x1d3dbe){return{'membername':_0x1d3dbe[_0xbde1('0x1c')],'UserId':_0x1d3dbe['id'],'queue_name':_0x1f717d[_0xbde1('0x1c')],'ChatQueueId':_0x1f717d['id'],'interface':util['format'](_0xbde1('0x4f'),_0xbde1('0x50'),_0x1d3dbe[_0xbde1('0x1c')]),'penalty':0x0,'paused':_0x1d3dbe['chatPause'],'createdAt':_0x1d3dbe[_0xbde1('0x51')],'updatedAt':_0x1d3dbe['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbde1('0x18')](respondWithFilteredResult(_0x116793,_0xdda028))[_0xbde1('0x29')](handleError(_0x116793,null));};exports[_0xbde1('0x52')]=function(_0x2f79b6,_0x49339b){var _0x1fcdee={};var _0x50a4bb={};var _0x2a1b2c;var _0x24eb78;return db['ChatQueue'][_0xbde1('0x3f')]({'where':{'id':_0x2f79b6[_0xbde1('0x40')]['id']}})[_0xbde1('0x18')](handleEntityNotFound(_0x49339b,null))[_0xbde1('0x18')](function(_0x3aadc1){if(_0x3aadc1){_0x2a1b2c=_0x3aadc1;_0x50a4bb[_0xbde1('0x2b')]=_[_0xbde1('0x2c')](db['Team']['rawAttributes']);_0x50a4bb[_0xbde1('0x27')]=_['keys'](_0x2f79b6[_0xbde1('0x27')]);_0x50a4bb['filters']=_['intersection'](_0x50a4bb[_0xbde1('0x2b')],_0x50a4bb[_0xbde1('0x27')]);_0x1fcdee[_0xbde1('0x30')]=_[_0xbde1('0x2e')](_0x50a4bb[_0xbde1('0x2b')],qs[_0xbde1('0x2f')](_0x2f79b6[_0xbde1('0x27')]['fields']));_0x1fcdee[_0xbde1('0x30')]=_0x1fcdee[_0xbde1('0x30')][_0xbde1('0x31')]?_0x1fcdee[_0xbde1('0x30')]:_0x50a4bb[_0xbde1('0x2b')];_0x1fcdee['order']=qs[_0xbde1('0x46')](_0x2f79b6[_0xbde1('0x27')][_0xbde1('0x46')]);_0x1fcdee[_0xbde1('0x24')]=qs['filters'](_[_0xbde1('0x47')](_0x2f79b6[_0xbde1('0x27')],_0x50a4bb[_0xbde1('0x2d')]));if(_0x2f79b6['query'][_0xbde1('0x49')]){_0x1fcdee['where']=_[_0xbde1('0x33')](_0x1fcdee[_0xbde1('0x24')],{'$or':_[_0xbde1('0x1e')](_0x1fcdee['attributes'],function(_0x32a1fa){var _0x1d4890={};_0x1d4890[_0x32a1fa]={'$like':'%'+_0x2f79b6['query'][_0xbde1('0x49')]+'%'};return _0x1d4890;})});}_0x1fcdee=_['merge']({},_0x1fcdee,_0x2f79b6[_0xbde1('0x34')]);return _0x2a1b2c[_0xbde1('0x52')](_0x1fcdee);}})[_0xbde1('0x18')](function(_0x1327cf){if(_0x1327cf){_0x24eb78=_0x1327cf[_0xbde1('0x31')];if(!_0x2f79b6[_0xbde1('0x27')]['hasOwnProperty'](_0xbde1('0x43'))){_0x1fcdee[_0xbde1('0x44')]=qs[_0xbde1('0x44')](_0x2f79b6[_0xbde1('0x27')]['limit']);_0x1fcdee[_0xbde1('0x12')]=qs[_0xbde1('0x12')](_0x2f79b6['query'][_0xbde1('0x12')]);}return _0x2a1b2c['getTeams'](_0x1fcdee);}})['then'](function(_0x31ae6a){if(_0x31ae6a){return _0x31ae6a?{'count':_0x24eb78,'rows':_0x31ae6a}:null;}})[_0xbde1('0x18')](respondWithResult(_0x49339b,null))['catch'](handleError(_0x49339b,null));};exports[_0xbde1('0x53')]=function(_0x416e19,_0x1a4630){var _0x4c4e28=_0x416e19['body']['ids'];return db[_0xbde1('0x54')][_0xbde1('0x28')]({'where':{'id':_0x4c4e28},'attributes':['id'],'include':[{'model':db[_0xbde1('0x4a')],'as':'Agents','attributes':['id',_0xbde1('0x1c'),'online',_0xbde1('0x55'),'interface'],'raw':!![]}]})['then'](function(_0x1d2d35){if(_0x1d2d35){var _0x1ee899=_[_0xbde1('0x56')](_0x1d2d35,function(_0x145f5c){var _0x197109=_0x145f5c[_0xbde1('0x19')]({'plain':!![]});return _0x197109['Agents'];});return db[_0xbde1('0x25')][_0xbde1('0x3d')]({'where':{'id':_0x416e19[_0xbde1('0x40')]['id']}})[_0xbde1('0x18')](function(_0x1ba5fd){return db[_0xbde1('0x57')][_0xbde1('0x58')](function(_0x58f315){return _0x1ba5fd[_0xbde1('0x53')](_0x4c4e28,{'transaction':_0x58f315})[_0xbde1('0x18')](function(){return BPromise[_0xbde1('0x59')](_0x1ee899,function(_0x4049f2){return db[_0xbde1('0x41')]['findOrCreate']({'where':{'UserId':_0x4049f2['id'],'ChatQueueId':_0x416e19[_0xbde1('0x40')]['id']},'transaction':_0x58f315});});})['then'](function(){_0x1ee899['forEach'](function(_0x1461d2){socket[_0xbde1('0x5a')](_0xbde1('0x5b'),{'UserId':_0x1461d2['id'],'ChatQueueId':_0x1ba5fd['id']});});});});});}})[_0xbde1('0x18')](respondWithStatusCode(_0x1a4630,null))[_0xbde1('0x29')](handleError(_0x1a4630,null));};exports[_0xbde1('0x5c')]=function(_0x43247c,_0x24234a){return db['Team'][_0xbde1('0x28')]({'where':{'id':_0x43247c[_0xbde1('0x27')][_0xbde1('0x5d')]},'attributes':['id'],'include':[{'model':db[_0xbde1('0x4a')],'as':_0xbde1('0x5e'),'attributes':['id'],'raw':!![]}]})[_0xbde1('0x18')](handleEntityNotFound(_0x24234a,null))[_0xbde1('0x18')](function(_0x3e4aec){var _0x4051c0=_[_0xbde1('0x1e')](_0x3e4aec,'id');var _0x46db78=[];var _0x5d71b2=[];var _0x134d1a=squel[_0xbde1('0x5f')]();_0x134d1a[_0xbde1('0x60')](_0xbde1('0x61'))[_0xbde1('0x62')](_0xbde1('0x63'),'tq')[_0xbde1('0x64')]('user_has_teams','ut',_0xbde1('0x65'))[_0xbde1('0x24')](_0xbde1('0x66'),_0x43247c[_0xbde1('0x40')]['id']);for(var _0x36db53=0x0;_0x36db53<_0x3e4aec['length'];_0x36db53+=0x1){let _0x521e11=_0x3e4aec[_0x36db53];for(var _0x2ad644=0x0;_0x2ad644<_0x521e11[_0xbde1('0x5e')][_0xbde1('0x31')];_0x2ad644+=0x1){let _0x291ce7=_0x521e11[_0xbde1('0x5e')][_0x2ad644];var _0x36723a=_0x134d1a[_0xbde1('0x67')]();_0x36723a['where'](_0xbde1('0x68'),_0x291ce7['id']);_0x5d71b2[_0xbde1('0x69')](db[_0xbde1('0x57')][_0xbde1('0x27')](_0x36723a[_0xbde1('0x6a')](),{'type':db[_0xbde1('0x57')][_0xbde1('0x6b')][_0xbde1('0x6c')]})[_0xbde1('0x18')](function(_0x194c26){if(_0x194c26[_0xbde1('0x31')]===0x1){return _0x291ce7['id'];}else{var _0x5048e3=_[_0xbde1('0x6d')](_[_0xbde1('0x1e')](_0x194c26,_0xbde1('0x6e')),function(_0x151031){return _[_0xbde1('0x6f')](_0x4051c0,_0x151031);});if(_0x5048e3){return _0x291ce7['id'];}}}));}}return BPromise[_0xbde1('0x70')](_0x5d71b2)['then'](function(_0x516a56){_0x46db78=_(_0x46db78)['union'](_0x516a56)['compact']()[_0xbde1('0x71')]();return db[_0xbde1('0x25')][_0xbde1('0x3d')]({'where':{'id':_0x43247c[_0xbde1('0x40')]['id']}})[_0xbde1('0x18')](function(_0x4df3e1){return db['sequelize'][_0xbde1('0x58')](function(_0x136429){return _0x4df3e1[_0xbde1('0x5c')](_0x43247c['query'][_0xbde1('0x5d')],{'transaction':_0x136429})[_0xbde1('0x18')](function(){if(!_[_0xbde1('0x72')](_0x46db78)){return _0x4df3e1[_0xbde1('0x73')](_0x46db78,{'transaction':_0x136429});}})['then'](function(){_0x46db78[_0xbde1('0x74')](function(_0x29e162){socket[_0xbde1('0x5a')](_0xbde1('0x75'),{'UserId':_0x29e162,'ChatQueueId':_0x4df3e1['id']});});});});});});})[_0xbde1('0x18')](respondWithStatusCode(_0x24234a,null))['catch'](handleError(_0x24234a,null));};exports[_0xbde1('0x76')]=function(_0x3135fb,_0x425518){return db[_0xbde1('0x25')][_0xbde1('0x3d')]({'where':{'id':_0x3135fb[_0xbde1('0x40')]['id']}})[_0xbde1('0x18')](handleEntityNotFound(_0x425518,null))[_0xbde1('0x18')](function(_0x413f4b){if(_0x413f4b){return _0x413f4b[_0xbde1('0x76')](_0x3135fb[_0xbde1('0x35')][_0xbde1('0x5d')],_[_0xbde1('0x77')](_0x3135fb[_0xbde1('0x35')],[_0xbde1('0x5d'),'id'])||{})[_0xbde1('0x78')](function(_0x37fc30){for(var _0x192c44=0x0;_0x192c44<_0x3135fb[_0xbde1('0x35')][_0xbde1('0x5d')][_0xbde1('0x31')];_0x192c44+=0x1){socket[_0xbde1('0x5a')]('userChatQueue:save',{'UserId':Number(_0x3135fb[_0xbde1('0x35')][_0xbde1('0x5d')][_0x192c44]),'ChatQueueId':Number(_0x3135fb[_0xbde1('0x40')]['id'])});}return _0x37fc30;});}})[_0xbde1('0x18')](respondWithResult(_0x425518,null))[_0xbde1('0x29')](handleError(_0x425518,null));};exports['removeAgents']=function(_0x17153c,_0x45dc86){return db[_0xbde1('0x25')][_0xbde1('0x3d')]({'where':{'id':_0x17153c[_0xbde1('0x40')]['id']}})['then'](handleEntityNotFound(_0x45dc86,null))['then'](function(_0x394759){if(_0x394759){return _0x394759[_0xbde1('0x73')](_0x17153c['query'][_0xbde1('0x5d')])[_0xbde1('0x18')](function(){if(_[_0xbde1('0x79')](_0x17153c[_0xbde1('0x27')]['ids'])){for(var _0x38a76e=0x0;_0x38a76e<_0x17153c['query'][_0xbde1('0x5d')][_0xbde1('0x31')];_0x38a76e+=0x1){socket[_0xbde1('0x5a')](_0xbde1('0x75'),{'UserId':Number(_0x17153c['query'][_0xbde1('0x5d')][_0x38a76e]),'ChatQueueId':Number(_0x17153c['params']['id'])});}}else{socket['emit'](_0xbde1('0x75'),{'UserId':Number(_0x17153c['query'][_0xbde1('0x5d')]),'ChatQueueId':Number(_0x17153c[_0xbde1('0x40')]['id'])});}});}})['then'](respondWithStatusCode(_0x45dc86,null))[_0xbde1('0x29')](handleError(_0x45dc86,null));};exports[_0xbde1('0x7a')]=function(_0x39ca29,_0x41b7df){var _0x437e8b={};var _0x4db417={};var _0x48e417;var _0x3b177e;return db[_0xbde1('0x25')]['findOne']({'where':{'id':_0x39ca29['params']['id']}})[_0xbde1('0x18')](handleEntityNotFound(_0x41b7df,null))['then'](function(_0x1d37ad){if(_0x1d37ad){_0x48e417=_0x1d37ad;_0x4db417[_0xbde1('0x2b')]=_[_0xbde1('0x2c')](db['User']['rawAttributes']);_0x4db417[_0xbde1('0x27')]=_['keys'](_0x39ca29[_0xbde1('0x27')]);_0x4db417[_0xbde1('0x2d')]=_[_0xbde1('0x2e')](_0x4db417[_0xbde1('0x2b')],_0x4db417[_0xbde1('0x27')]);_0x437e8b[_0xbde1('0x30')]=_['intersection'](_0x4db417[_0xbde1('0x2b')],qs['fields'](_0x39ca29[_0xbde1('0x27')][_0xbde1('0x2f')]));_0x437e8b[_0xbde1('0x30')]=_0x437e8b['attributes']['length']?_0x437e8b[_0xbde1('0x30')]:_0x4db417[_0xbde1('0x2b')];_0x437e8b[_0xbde1('0x45')]=qs[_0xbde1('0x46')](_0x39ca29[_0xbde1('0x27')][_0xbde1('0x46')]);_0x437e8b['where']=qs[_0xbde1('0x2d')](_[_0xbde1('0x47')](_0x39ca29[_0xbde1('0x27')],_0x4db417['filters']));if(_0x39ca29[_0xbde1('0x27')][_0xbde1('0x49')]){_0x437e8b['where']=_[_0xbde1('0x33')](_0x437e8b[_0xbde1('0x24')],{'$or':_[_0xbde1('0x1e')](_0x437e8b[_0xbde1('0x30')],function(_0x1aba43){var _0x3a566c={};_0x3a566c[_0x1aba43]={'$like':'%'+_0x39ca29[_0xbde1('0x27')][_0xbde1('0x49')]+'%'};return _0x3a566c;})});}_0x437e8b=_['merge']({},_0x437e8b,_0x39ca29['options']);return _0x48e417[_0xbde1('0x7a')](_0x437e8b);}})[_0xbde1('0x18')](function(_0x5c4f97){if(_0x5c4f97){_0x3b177e=_0x5c4f97[_0xbde1('0x31')];if(!_0x39ca29['query'][_0xbde1('0x42')](_0xbde1('0x43'))){_0x437e8b[_0xbde1('0x44')]=qs[_0xbde1('0x44')](_0x39ca29[_0xbde1('0x27')]['limit']);_0x437e8b[_0xbde1('0x12')]=qs['offset'](_0x39ca29['query']['offset']);}return _0x48e417[_0xbde1('0x7a')](_0x437e8b);}})['then'](function(_0x45728e){if(_0x45728e){return _0x45728e?{'count':_0x3b177e,'rows':_0x45728e}:null;}})[_0xbde1('0x18')](respondWithResult(_0x41b7df,null))['catch'](handleError(_0x41b7df,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a2e9952..e1ffcce 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 _0x2029=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2e0eaf,_0xb4f35a){var _0x1a1504=function(_0x370fe6){while(--_0x370fe6){_0x2e0eaf['push'](_0x2e0eaf['shift']());}};_0x1a1504(++_0xb4f35a);}(_0x2029,0x171));var _0x9202=function(_0x492b97,_0x5cb6bf){_0x492b97=_0x492b97-0x0;var _0x4e2d6c=_0x2029[_0x492b97];return _0x4e2d6c;};'use strict';var EventEmitter=require(_0x9202('0x0'));var ChatQueue=require(_0x9202('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9202('0x2')](0x0);var events={'afterCreate':_0x9202('0x3'),'afterUpdate':_0x9202('0x4'),'afterDestroy':_0x9202('0x5')};function emitEvent(_0x39fa99){return function(_0x81709f,_0x858200,_0x45d53d){ChatQueueEvents[_0x9202('0x6')](_0x39fa99+':'+_0x81709f['id'],_0x81709f);ChatQueueEvents[_0x9202('0x6')](_0x39fa99,_0x81709f);_0x45d53d(null);};}for(var e in events){if(events[_0x9202('0x7')](e)){var event=events[e];ChatQueue[_0x9202('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x956a=['hasOwnProperty','exports','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x19624a,_0x25172b){var _0x249608=function(_0xcfa170){while(--_0xcfa170){_0x19624a['push'](_0x19624a['shift']());}};_0x249608(++_0x25172b);}(_0x956a,0xb6));var _0xa956=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x956a[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xa956('0x0'))['db'][_0xa956('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa956('0x2')](0x0);var events={'afterCreate':_0xa956('0x3'),'afterUpdate':_0xa956('0x4'),'afterDestroy':_0xa956('0x5')};function emitEvent(_0x331696){return function(_0x38c808,_0x48bb8a,_0x49251d){ChatQueueEvents[_0xa956('0x6')](_0x331696+':'+_0x38c808['id'],_0x38c808);ChatQueueEvents[_0xa956('0x6')](_0x331696,_0x38c808);_0x49251d(null);};}for(var e in events){if(events[_0xa956('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xa956('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 778e8de..9901285 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 _0x8efb=['ChatQueue','chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8efb,0xaa));var _0xb8ef=function(_0x4ef846,_0x4e5eef){_0x4ef846=_0x4ef846-0x0;var _0x14a853=_0x8efb[_0x4ef846];return _0x14a853;};'use strict';var _=require(_0xb8ef('0x0'));var util=require(_0xb8ef('0x1'));var logger=require(_0xb8ef('0x2'))(_0xb8ef('0x3'));var moment=require('moment');var BPromise=require(_0xb8ef('0x4'));var rp=require(_0xb8ef('0x5'));var fs=require('fs');var path=require(_0xb8ef('0x6'));var rimraf=require(_0xb8ef('0x7'));var config=require(_0xb8ef('0x8'));var attributes=require('./chatQueue.attributes');module[_0xb8ef('0x9')]=function(_0x262737,_0x5743f1){return _0x262737['define'](_0xb8ef('0xa'),attributes,{'tableName':_0xb8ef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e16=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','chat_queues','lodash','util','api'];(function(_0x3a445e,_0x109c51){var _0x7639d9=function(_0x8ff595){while(--_0x8ff595){_0x3a445e['push'](_0x3a445e['shift']());}};_0x7639d9(++_0x109c51);}(_0x5e16,0x101));var _0x65e1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5e16[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x65e1('0x0'));var util=require(_0x65e1('0x1'));var logger=require('../../config/logger')(_0x65e1('0x2'));var moment=require(_0x65e1('0x3'));var BPromise=require(_0x65e1('0x4'));var rp=require(_0x65e1('0x5'));var fs=require('fs');var path=require(_0x65e1('0x6'));var rimraf=require(_0x65e1('0x7'));var config=require(_0x65e1('0x8'));var attributes=require(_0x65e1('0x9'));module[_0x65e1('0xa')]=function(_0x1aa1f5,_0xad5c87){return _0x1aa1f5[_0x65e1('0xb')]('ChatQueue',attributes,{'tableName':_0x65e1('0xc'),'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 dbf81db..c2b0067 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 _0x1619=['map','model','attributes','info','debug','find','raw','ShowChatQueue','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','localhost','register','request','then','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','request\x20sent','catch','GetChatQueue','ChatQueue','findAll','options','where','limit','include'];(function(_0x2a880e,_0x44beb7){var _0x45e0ce=function(_0x10cbc2){while(--_0x10cbc2){_0x2a880e['push'](_0x2a880e['shift']());}};_0x45e0ce(++_0x44beb7);}(_0x1619,0x189));var _0x9161=function(_0x27fffe,_0x2ec37c){_0x27fffe=_0x27fffe-0x0;var _0x43e20a=_0x1619[_0x27fffe];return _0x43e20a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9161('0x0'));var BPromise=require('bluebird');var rs=require(_0x9161('0x1'));var fs=require('fs');var Redis=require(_0x9161('0x2'));var db=require(_0x9161('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9161('0x4'))('rpc');var config=require(_0x9161('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9161('0x6')]({'port':0x232a});config[_0x9161('0x7')]=_['defaults'](config[_0x9161('0x7')],{'host':_0x9161('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9161('0x7')]));require('./chatQueue.socket')[_0x9161('0x9')](socket);function respondWithRpcPromise(_0x571c28,_0x191452,_0x321b97){return new BPromise(function(_0x20526d,_0x251ee2){return client[_0x9161('0xa')](_0x571c28,_0x321b97)[_0x9161('0xb')](function(_0x32ef57){logger['info']('ChatQueue,\x20%s,\x20%s',_0x191452,'request\x20sent');logger['debug'](_0x9161('0xc'),_0x191452,'request\x20sent',JSON[_0x9161('0xd')](_0x32ef57));if(_0x32ef57[_0x9161('0xe')]){if(_0x32ef57[_0x9161('0xe')][_0x9161('0xf')]===0x1f4){logger[_0x9161('0xe')](_0x9161('0x10'),_0x191452,_0x32ef57[_0x9161('0xe')][_0x9161('0x11')]);return _0x251ee2(_0x32ef57['error'][_0x9161('0x11')]);}logger[_0x9161('0xe')](_0x9161('0x10'),_0x191452,_0x32ef57['error'][_0x9161('0x11')]);return _0x20526d(_0x32ef57[_0x9161('0xe')][_0x9161('0x11')]);}else{logger['info'](_0x9161('0x10'),_0x191452,_0x9161('0x12'));_0x20526d(_0x32ef57['result'][_0x9161('0x11')]);}})[_0x9161('0x13')](function(_0x1b89f3){logger[_0x9161('0xe')](_0x9161('0x10'),_0x191452,_0x1b89f3);_0x251ee2(_0x1b89f3);});});}exports[_0x9161('0x14')]=function(_0x1171fc){var _0x4fd55d=this;return new Promise(function(_0x73d1cc,_0x53b67e){return db[_0x9161('0x15')][_0x9161('0x16')]({'raw':_0x1171fc[_0x9161('0x17')]?_0x1171fc['options']['raw']===undefined?!![]:![]:!![],'where':_0x1171fc['options']?_0x1171fc[_0x9161('0x17')][_0x9161('0x18')]||null:null,'attributes':_0x1171fc['options']?_0x1171fc['options']['attributes']||null:null,'limit':_0x1171fc['options']?_0x1171fc[_0x9161('0x17')][_0x9161('0x19')]||null:null,'include':_0x1171fc[_0x9161('0x17')]?_0x1171fc[_0x9161('0x17')][_0x9161('0x1a')]?_[_0x9161('0x1b')](_0x1171fc[_0x9161('0x17')]['include'],function(_0x8c4949){return{'model':db[_0x8c4949[_0x9161('0x1c')]],'as':_0x8c4949['as'],'attributes':_0x8c4949[_0x9161('0x1d')],'include':_0x8c4949[_0x9161('0x1a')]?_[_0x9161('0x1b')](_0x8c4949[_0x9161('0x1a')],function(_0x3102f7){return{'model':db[_0x3102f7[_0x9161('0x1c')]],'as':_0x3102f7['as'],'attributes':_0x3102f7[_0x9161('0x1d')],'include':_0x3102f7[_0x9161('0x1a')]?_[_0x9161('0x1b')](_0x3102f7['include'],function(_0x13bf83){return{'model':db[_0x13bf83[_0x9161('0x1c')]],'as':_0x13bf83['as'],'attributes':_0x13bf83['attributes']};}):[]};}):[]};}):[]:[]})[_0x9161('0xb')](function(_0x374f81){logger[_0x9161('0x1e')](_0x9161('0x14'),_0x1171fc);logger[_0x9161('0x1f')](_0x9161('0x14'),_0x1171fc,JSON['stringify'](_0x374f81));_0x73d1cc(_0x374f81);})[_0x9161('0x13')](function(_0x11cbbc){logger[_0x9161('0xe')]('GetChatQueue',_0x11cbbc[_0x9161('0x11')],_0x1171fc);_0x53b67e(_0x4fd55d[_0x9161('0xe')](0x1f4,_0x11cbbc[_0x9161('0x11')]));});});};exports['ShowChatQueue']=function(_0x3ed469){var _0x27959f=this;return new Promise(function(_0x187825,_0x207519){return db[_0x9161('0x15')][_0x9161('0x20')]({'raw':_0x3ed469[_0x9161('0x17')]?_0x3ed469[_0x9161('0x17')][_0x9161('0x21')]===undefined?!![]:![]:!![],'where':_0x3ed469[_0x9161('0x17')]?_0x3ed469[_0x9161('0x17')][_0x9161('0x18')]||null:null,'attributes':_0x3ed469[_0x9161('0x17')]?_0x3ed469[_0x9161('0x17')][_0x9161('0x1d')]||null:null,'include':_0x3ed469[_0x9161('0x17')]?_0x3ed469[_0x9161('0x17')][_0x9161('0x1a')]?_[_0x9161('0x1b')](_0x3ed469[_0x9161('0x17')][_0x9161('0x1a')],function(_0x2a5262){return{'model':db[_0x2a5262['model']],'as':_0x2a5262['as'],'attributes':_0x2a5262['attributes'],'include':_0x2a5262['include']?_[_0x9161('0x1b')](_0x2a5262[_0x9161('0x1a')],function(_0x16706b){return{'model':db[_0x16706b[_0x9161('0x1c')]],'as':_0x16706b['as'],'attributes':_0x16706b[_0x9161('0x1d')],'include':_0x16706b['include']?_[_0x9161('0x1b')](_0x16706b['include'],function(_0x47b714){return{'model':db[_0x47b714[_0x9161('0x1c')]],'as':_0x47b714['as'],'attributes':_0x47b714[_0x9161('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e9ce3){logger[_0x9161('0x1e')]('ShowChatQueue',_0x3ed469);logger[_0x9161('0x1f')]('ShowChatQueue',_0x3ed469,JSON['stringify'](_0x1e9ce3));_0x187825(_0x1e9ce3);})[_0x9161('0x13')](function(_0x4a3b3a){logger[_0x9161('0xe')](_0x9161('0x22'),_0x4a3b3a['message'],_0x3ed469);_0x207519(_0x27959f['error'](0x1f4,_0x4a3b3a[_0x9161('0x11')]));});});}; \ No newline at end of file +var _0xc224=['../../config/utils','rpc','jayson/promise','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','attributes','limit','map','include','model','GetChatQueue','catch','ChatQueue','find','raw','where','then','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1b708d,_0x549f08){var _0x45d59b=function(_0x2e1c73){while(--_0x2e1c73){_0x1b708d['push'](_0x1b708d['shift']());}};_0x45d59b(++_0x549f08);}(_0xc224,0xe4));var _0x4c22=function(_0x1d379d,_0xa5084e){_0x1d379d=_0x1d379d-0x0;var _0x4a6c13=_0xc224[_0x1d379d];return _0x4a6c13;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var moment=require(_0x4c22('0x2'));var BPromise=require(_0x4c22('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c22('0x4'));var db=require(_0x4c22('0x5'))['db'];var utils=require(_0x4c22('0x6'));var logger=require('../../config/logger')(_0x4c22('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c22('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x4c22('0x9')]=_[_0x4c22('0xa')](config[_0x4c22('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c22('0xb'))(new Redis(config[_0x4c22('0x9')]));require(_0x4c22('0xc'))[_0x4c22('0xd')](socket);function respondWithRpcPromise(_0x44f9a8,_0x248a5c,_0x2e6d23){return new BPromise(function(_0x563300,_0x4e7619){return client[_0x4c22('0xe')](_0x44f9a8,_0x2e6d23)['then'](function(_0x396f4c){logger[_0x4c22('0xf')](_0x4c22('0x10'),_0x248a5c,_0x4c22('0x11'));logger[_0x4c22('0x12')](_0x4c22('0x13'),_0x248a5c,_0x4c22('0x11'),JSON[_0x4c22('0x14')](_0x396f4c));if(_0x396f4c['error']){if(_0x396f4c[_0x4c22('0x15')][_0x4c22('0x16')]===0x1f4){logger['error'](_0x4c22('0x10'),_0x248a5c,_0x396f4c['error'][_0x4c22('0x17')]);return _0x4e7619(_0x396f4c[_0x4c22('0x15')][_0x4c22('0x17')]);}logger['error'](_0x4c22('0x10'),_0x248a5c,_0x396f4c[_0x4c22('0x15')][_0x4c22('0x17')]);return _0x563300(_0x396f4c[_0x4c22('0x15')][_0x4c22('0x17')]);}else{logger[_0x4c22('0xf')](_0x4c22('0x10'),_0x248a5c,'request\x20sent');_0x563300(_0x396f4c[_0x4c22('0x18')][_0x4c22('0x17')]);}})['catch'](function(_0xaf2343){logger[_0x4c22('0x15')](_0x4c22('0x10'),_0x248a5c,_0xaf2343);_0x4e7619(_0xaf2343);});});}exports['GetChatQueue']=function(_0x3868c5){var _0x3c5d1a=this;return new Promise(function(_0x1b0f56,_0x5e38cb){return db['ChatQueue']['findAll']({'raw':_0x3868c5[_0x4c22('0x19')]?_0x3868c5[_0x4c22('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3868c5[_0x4c22('0x19')]?_0x3868c5[_0x4c22('0x19')]['where']||null:null,'attributes':_0x3868c5[_0x4c22('0x19')]?_0x3868c5[_0x4c22('0x19')][_0x4c22('0x1a')]||null:null,'limit':_0x3868c5['options']?_0x3868c5[_0x4c22('0x19')][_0x4c22('0x1b')]||null:null,'include':_0x3868c5[_0x4c22('0x19')]?_0x3868c5[_0x4c22('0x19')]['include']?_[_0x4c22('0x1c')](_0x3868c5[_0x4c22('0x19')][_0x4c22('0x1d')],function(_0x16beb2){return{'model':db[_0x16beb2[_0x4c22('0x1e')]],'as':_0x16beb2['as'],'attributes':_0x16beb2[_0x4c22('0x1a')],'include':_0x16beb2[_0x4c22('0x1d')]?_[_0x4c22('0x1c')](_0x16beb2[_0x4c22('0x1d')],function(_0x28ca5a){return{'model':db[_0x28ca5a['model']],'as':_0x28ca5a['as'],'attributes':_0x28ca5a['attributes'],'include':_0x28ca5a['include']?_['map'](_0x28ca5a[_0x4c22('0x1d')],function(_0x328284){return{'model':db[_0x328284[_0x4c22('0x1e')]],'as':_0x328284['as'],'attributes':_0x328284[_0x4c22('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55eeb9){logger[_0x4c22('0xf')]('GetChatQueue',_0x3868c5);logger[_0x4c22('0x12')](_0x4c22('0x1f'),_0x3868c5,JSON[_0x4c22('0x14')](_0x55eeb9));_0x1b0f56(_0x55eeb9);})[_0x4c22('0x20')](function(_0x26f311){logger[_0x4c22('0x15')](_0x4c22('0x1f'),_0x26f311['message'],_0x3868c5);_0x5e38cb(_0x3c5d1a[_0x4c22('0x15')](0x1f4,_0x26f311[_0x4c22('0x17')]));});});};exports['ShowChatQueue']=function(_0x11216e){var _0x36a70f=this;return new Promise(function(_0xcb9deb,_0x550d90){return db[_0x4c22('0x21')][_0x4c22('0x22')]({'raw':_0x11216e[_0x4c22('0x19')]?_0x11216e[_0x4c22('0x19')][_0x4c22('0x23')]===undefined?!![]:![]:!![],'where':_0x11216e[_0x4c22('0x19')]?_0x11216e[_0x4c22('0x19')][_0x4c22('0x24')]||null:null,'attributes':_0x11216e[_0x4c22('0x19')]?_0x11216e[_0x4c22('0x19')][_0x4c22('0x1a')]||null:null,'include':_0x11216e[_0x4c22('0x19')]?_0x11216e[_0x4c22('0x19')][_0x4c22('0x1d')]?_[_0x4c22('0x1c')](_0x11216e[_0x4c22('0x19')]['include'],function(_0x4caed8){return{'model':db[_0x4caed8[_0x4c22('0x1e')]],'as':_0x4caed8['as'],'attributes':_0x4caed8[_0x4c22('0x1a')],'include':_0x4caed8[_0x4c22('0x1d')]?_['map'](_0x4caed8['include'],function(_0x9fc1dc){return{'model':db[_0x9fc1dc[_0x4c22('0x1e')]],'as':_0x9fc1dc['as'],'attributes':_0x9fc1dc['attributes'],'include':_0x9fc1dc['include']?_['map'](_0x9fc1dc[_0x4c22('0x1d')],function(_0x338a45){return{'model':db[_0x338a45['model']],'as':_0x338a45['as'],'attributes':_0x338a45[_0x4c22('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4c22('0x25')](function(_0x91379){logger[_0x4c22('0xf')](_0x4c22('0x26'),_0x11216e);logger['debug'](_0x4c22('0x26'),_0x11216e,JSON['stringify'](_0x91379));_0xcb9deb(_0x91379);})['catch'](function(_0x492251){logger[_0x4c22('0x15')](_0x4c22('0x26'),_0x492251['message'],_0x11216e);_0x550d90(_0x36a70f['error'](0x1f4,_0x492251['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2970209..cde10dc 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 _0x0c02=['save','remove','emit','removeListener','register','chatQueue:'];(function(_0x251ab0,_0x46e532){var _0x11848c=function(_0x78e3a2){while(--_0x78e3a2){_0x251ab0['push'](_0x251ab0['shift']());}};_0x11848c(++_0x46e532);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x20c0('0x0'),_0x20c0('0x1'),'update'];function createListener(_0x1338cf,_0x5c8750){return function(_0x454922){_0x5c8750[_0x20c0('0x2')](_0x1338cf,_0x454922);};}function removeListener(_0x38022e,_0x2e9d65){return function(){ChatQueueEvents[_0x20c0('0x3')](_0x38022e,_0x2e9d65);};}exports[_0x20c0('0x4')]=function(_0x13312d){for(var _0xd25ee8=0x0,_0x5d6408=events['length'];_0xd25ee8<_0x5d6408;_0xd25ee8++){var _0x5da127=events[_0xd25ee8];var _0x4db532=createListener(_0x20c0('0x5')+_0x5da127,_0x13312d);ChatQueueEvents['on'](_0x5da127,_0x4db532);}}; \ No newline at end of file +var _0x425d=['./chatQueue.events','remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x425d,0x1e0));var _0xd425=function(_0x3765ff,_0x16916e){_0x3765ff=_0x3765ff-0x0;var _0x333f28=_0x425d[_0x3765ff];return _0x333f28;};'use strict';var ChatQueueEvents=require(_0xd425('0x0'));var events=['save',_0xd425('0x1'),_0xd425('0x2')];function createListener(_0x314a2b,_0x97e370){return function(_0x183caa){_0x97e370[_0xd425('0x3')](_0x314a2b,_0x183caa);};}function removeListener(_0x47043f,_0x596be7){return function(){ChatQueueEvents[_0xd425('0x4')](_0x47043f,_0x596be7);};}exports[_0xd425('0x5')]=function(_0xc4e080){for(var _0x36866e=0x0,_0x1d97d9=events[_0xd425('0x6')];_0x36866e<_0x1d97d9;_0x36866e++){var _0x50b061=events[_0x36866e];var _0xb6ba8e=createListener(_0xd425('0x7')+_0x50b061,_0xc4e080);ChatQueueEvents['on'](_0x50b061,_0xb6ba8e);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c7616bb..44bf616 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x164a87,_0x3fe796){_0x164a87=_0x164a87-0x0;var _0x414fe8=_0x3e74[_0x164a87];return _0x414fe8;};'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('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x28435b,_0x14639d){var _0x2d0063=function(_0x54aa48){while(--_0x54aa48){_0x28435b['push'](_0x28435b['shift']());}};_0x2d0063(++_0x14639d);}(_0x55ca,0x126));var _0xa55c=function(_0x58cf07,_0x2e3858){_0x58cf07=_0x58cf07-0x0;var _0x42afe0=_0x55ca[_0x58cf07];return _0x42afe0;};'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['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 2887517..7335a36 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 _0x1539=['DATE','sequelize','exports','STRING'];(function(_0x295514,_0x4b8749){var _0xbeb65e=function(_0x3a5984){while(--_0x3a5984){_0x295514['push'](_0x295514['shift']());}};_0xbeb65e(++_0x4b8749);}(_0x1539,0x139));var _0x9153=function(_0x513d3e,_0x111f48){_0x513d3e=_0x513d3e-0x0;var _0x4d2ece=_0x1539[_0x513d3e];return _0x4d2ece;};'use strict';var moment=require('moment');var Sequelize=require(_0x9153('0x0'));module[_0x9153('0x1')]={'uniqueid':{'type':Sequelize[_0x9153('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9153('0x3')]},'leaveAt':{'type':Sequelize[_0x9153('0x3')]},'acceptAt':{'type':Sequelize[_0x9153('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9153('0x2')]}}; \ No newline at end of file +var _0x4496=['STRING','DATE','moment','sequelize','exports'];(function(_0x26cbbb,_0x3b0194){var _0x56ecc8=function(_0x173d29){while(--_0x173d29){_0x26cbbb['push'](_0x26cbbb['shift']());}};_0x56ecc8(++_0x3b0194);}(_0x4496,0x142));var _0x6449=function(_0x174b0d,_0x4ac493){_0x174b0d=_0x174b0d-0x0;var _0x471328=_0x4496[_0x174b0d];return _0x471328;};'use strict';var moment=require(_0x6449('0x0'));var Sequelize=require(_0x6449('0x1'));module[_0x6449('0x2')]={'uniqueid':{'type':Sequelize[_0x6449('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6449('0x3')]},'joinAt':{'type':Sequelize[_0x6449('0x4')]},'leaveAt':{'type':Sequelize[_0x6449('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6449('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index cc3721e..cdc34fb 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 _0x99a0=['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','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','then','destroy','error','name','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','fields','includeAll','find','body','update','describe','eml-format','rimraf','bluebird','mustache','path','sox','to-csv'];(function(_0x473931,_0x22a4c3){var _0x5b19bf=function(_0x455025){while(--_0x455025){_0x473931['push'](_0x473931['shift']());}};_0x5b19bf(++_0x22a4c3);}(_0x99a0,0x121));var _0x099a=function(_0x408fee,_0x409b97){_0x408fee=_0x408fee-0x0;var _0x89e8ab=_0x99a0[_0x408fee];return _0x89e8ab;};'use strict';var emlformat=require(_0x099a('0x0'));var rimraf=require(_0x099a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x099a('0x2'));var Mustache=require(_0x099a('0x3'));var util=require('util');var path=require(_0x099a('0x4'));var sox=require(_0x099a('0x5'));var csv=require(_0x099a('0x6'));var ejs=require(_0x099a('0x7'));var fs=require('fs');var fs_extra=require(_0x099a('0x8'));var _=require(_0x099a('0x9'));var squel=require('squel');var crypto=require(_0x099a('0xa'));var jsforce=require(_0x099a('0xb'));var deskjs=require(_0x099a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x099a('0xd'));var Papa=require(_0x099a('0xe'));var Redis=require(_0x099a('0xf'));var authService=require(_0x099a('0x10'));var qs=require(_0x099a('0x11'));var as=require(_0x099a('0x12'));var hardwareService=require(_0x099a('0x13'));var logger=require(_0x099a('0x14'))(_0x099a('0x15'));var utils=require(_0x099a('0x16'));var config=require(_0x099a('0x17'));var licenseUtil=require(_0x099a('0x18'));var db=require(_0x099a('0x19'))['db'];function respondWithStatusCode(_0x1e9dc1,_0x2e8afc){_0x2e8afc=_0x2e8afc||0xcc;return function(_0x4bd3ee){if(_0x4bd3ee){return _0x1e9dc1[_0x099a('0x1a')](_0x2e8afc);}return _0x1e9dc1['status'](_0x2e8afc)[_0x099a('0x1b')]();};}function respondWithResult(_0x4f2dbe,_0x249392){_0x249392=_0x249392||0xc8;return function(_0x3a134e){if(_0x3a134e){return _0x4f2dbe[_0x099a('0x1c')](_0x249392)[_0x099a('0x1d')](_0x3a134e);}};}function respondWithFilteredResult(_0x23a5fd,_0x3b4bdf){return function(_0x5086d8){if(_0x5086d8){var _0x443eea=typeof _0x3b4bdf[_0x099a('0x1e')]===_0x099a('0x1f')&&typeof _0x3b4bdf[_0x099a('0x20')]==='undefined';var _0x2831a2=_0x5086d8['count'];var _0x1d3924=_0x443eea?0x0:_0x3b4bdf[_0x099a('0x1e')];var _0x295e92=_0x443eea?_0x5086d8['count']:_0x3b4bdf[_0x099a('0x1e')]+_0x3b4bdf[_0x099a('0x20')];var _0x1c5314;if(_0x295e92>=_0x2831a2){_0x295e92=_0x2831a2;_0x1c5314=0xc8;}else{_0x1c5314=0xce;}_0x23a5fd[_0x099a('0x1c')](_0x1c5314);return _0x23a5fd[_0x099a('0x21')]('Content-Range',_0x1d3924+'-'+_0x295e92+'/'+_0x2831a2)['json'](_0x5086d8);}return null;};}function patchUpdates(_0x2ec23b){return function(_0x851d2){try{jsonpatch[_0x099a('0x22')](_0x851d2,_0x2ec23b,!![]);}catch(_0x470df6){return BPromise[_0x099a('0x23')](_0x470df6);}return _0x851d2[_0x099a('0x24')]();};}function saveUpdates(_0x2b2b9b,_0x23558b){return function(_0x545830){if(_0x545830){return _0x545830['update'](_0x2b2b9b)[_0x099a('0x25')](function(_0x38dd6a){return _0x38dd6a;});}return null;};}function removeEntity(_0x2c9033,_0x7cd361){return function(_0x1d1e5f){if(_0x1d1e5f){return _0x1d1e5f[_0x099a('0x26')]()[_0x099a('0x25')](function(){_0x2c9033[_0x099a('0x1c')](0xcc)[_0x099a('0x1b')]();});}};}function handleEntityNotFound(_0x42ee18,_0x21a937){return function(_0x4d63d5){if(!_0x4d63d5){_0x42ee18[_0x099a('0x1a')](0x194);}return _0x4d63d5;};}function handleError(_0x5e316b,_0x2a5417){_0x2a5417=_0x2a5417||0x1f4;return function(_0x39f520){logger[_0x099a('0x27')](_0x39f520['stack']);if(_0x39f520[_0x099a('0x28')]){delete _0x39f520[_0x099a('0x28')];}_0x5e316b[_0x099a('0x1c')](_0x2a5417)['send'](_0x39f520);};}exports['index']=function(_0x560fdb,_0x2b1597){var _0x1938d0={},_0x4a1663={},_0x2ab9a5={'count':0x0,'rows':[]};var _0x2e403e=_[_0x099a('0x29')](db[_0x099a('0x2a')][_0x099a('0x2b')],function(_0x36c1b4){return{'name':_0x36c1b4['fieldName'],'type':_0x36c1b4[_0x099a('0x2c')][_0x099a('0x2d')]};});_0x4a1663[_0x099a('0x2e')]=_[_0x099a('0x29')](_0x2e403e,_0x099a('0x28'));_0x4a1663[_0x099a('0x2f')]=_[_0x099a('0x30')](_0x560fdb[_0x099a('0x2f')]);_0x4a1663['filters']=_[_0x099a('0x31')](_0x4a1663[_0x099a('0x2e')],_0x4a1663[_0x099a('0x2f')]);_0x1938d0[_0x099a('0x32')]=_[_0x099a('0x31')](_0x4a1663[_0x099a('0x2e')],qs['fields'](_0x560fdb[_0x099a('0x2f')]['fields']));_0x1938d0[_0x099a('0x32')]=_0x1938d0[_0x099a('0x32')]['length']?_0x1938d0[_0x099a('0x32')]:_0x4a1663[_0x099a('0x2e')];if(!_0x560fdb[_0x099a('0x2f')][_0x099a('0x33')](_0x099a('0x34'))){_0x1938d0['limit']=qs[_0x099a('0x20')](_0x560fdb[_0x099a('0x2f')]['limit']);_0x1938d0[_0x099a('0x1e')]=qs[_0x099a('0x1e')](_0x560fdb[_0x099a('0x2f')]['offset']);}_0x1938d0[_0x099a('0x35')]=qs[_0x099a('0x36')](_0x560fdb[_0x099a('0x2f')][_0x099a('0x36')]);_0x1938d0[_0x099a('0x37')]=qs[_0x099a('0x38')](_['pick'](_0x560fdb[_0x099a('0x2f')],_0x4a1663['filters']),_0x2e403e);if(_0x560fdb[_0x099a('0x2f')][_0x099a('0x39')]){_0x1938d0['where']=_[_0x099a('0x3a')](_0x1938d0[_0x099a('0x37')],{'$or':_[_0x099a('0x29')](_0x2e403e,function(_0x434cee){if(_0x434cee[_0x099a('0x2c')]!==_0x099a('0x3b')){var _0x1386cb={};_0x1386cb[_0x434cee[_0x099a('0x28')]]={'$like':'%'+_0x560fdb[_0x099a('0x2f')]['filter']+'%'};return _0x1386cb;}})});}_0x1938d0=_[_0x099a('0x3a')]({},_0x1938d0,_0x560fdb[_0x099a('0x3c')]);var _0x2efb31={'where':_0x1938d0[_0x099a('0x37')]};return db[_0x099a('0x2a')][_0x099a('0x3d')](_0x2efb31)['then'](function(_0x482e9e){_0x2ab9a5[_0x099a('0x3d')]=_0x482e9e;if(_0x560fdb[_0x099a('0x2f')]['includeAll']){_0x1938d0[_0x099a('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x099a('0x3f')](_0x1938d0);})[_0x099a('0x25')](function(_0x13070f){_0x2ab9a5[_0x099a('0x40')]=_0x13070f;return _0x2ab9a5;})[_0x099a('0x25')](respondWithFilteredResult(_0x2b1597,_0x1938d0))[_0x099a('0x41')](handleError(_0x2b1597,null));};exports[_0x099a('0x42')]=function(_0x430e12,_0x49fc09){var _0x2640da={'raw':!![],'where':{'id':_0x430e12[_0x099a('0x43')]['id']}},_0x4a4a76={};_0x4a4a76['model']=_[_0x099a('0x30')](db[_0x099a('0x2a')][_0x099a('0x2b')]);_0x4a4a76[_0x099a('0x2f')]=_['keys'](_0x430e12[_0x099a('0x2f')]);_0x4a4a76[_0x099a('0x38')]=_['intersection'](_0x4a4a76[_0x099a('0x2e')],_0x4a4a76['query']);_0x2640da[_0x099a('0x32')]=_[_0x099a('0x31')](_0x4a4a76[_0x099a('0x2e')],qs[_0x099a('0x44')](_0x430e12[_0x099a('0x2f')][_0x099a('0x44')]));_0x2640da[_0x099a('0x32')]=_0x2640da[_0x099a('0x32')]['length']?_0x2640da[_0x099a('0x32')]:_0x4a4a76['model'];if(_0x430e12[_0x099a('0x2f')][_0x099a('0x45')]){_0x2640da[_0x099a('0x3e')]=[{'all':!![]}];}_0x2640da=_[_0x099a('0x3a')]({},_0x2640da,_0x430e12[_0x099a('0x3c')]);return db[_0x099a('0x2a')][_0x099a('0x46')](_0x2640da)['then'](handleEntityNotFound(_0x49fc09,null))[_0x099a('0x25')](respondWithResult(_0x49fc09,null))[_0x099a('0x41')](handleError(_0x49fc09,null));};exports['create']=function(_0x1c31ff,_0x213c03){return db[_0x099a('0x2a')]['create'](_0x1c31ff[_0x099a('0x47')],{})[_0x099a('0x25')](respondWithResult(_0x213c03,0xc9))[_0x099a('0x41')](handleError(_0x213c03,null));};exports[_0x099a('0x48')]=function(_0x503d44,_0x288ed9){if(_0x503d44['body']['id']){delete _0x503d44[_0x099a('0x47')]['id'];}return db[_0x099a('0x2a')]['find']({'where':{'id':_0x503d44['params']['id']}})[_0x099a('0x25')](handleEntityNotFound(_0x288ed9,null))[_0x099a('0x25')](saveUpdates(_0x503d44[_0x099a('0x47')],null))['then'](respondWithResult(_0x288ed9,null))[_0x099a('0x41')](handleError(_0x288ed9,null));};exports[_0x099a('0x26')]=function(_0x2b956d,_0x56b1e0){return db[_0x099a('0x2a')]['find']({'where':{'id':_0x2b956d['params']['id']}})[_0x099a('0x25')](handleEntityNotFound(_0x56b1e0,null))['then'](removeEntity(_0x56b1e0,null))['catch'](handleError(_0x56b1e0,null));};exports[_0x099a('0x49')]=function(_0x3fb887,_0x4c24b0){return db[_0x099a('0x2a')][_0x099a('0x49')]()[_0x099a('0x25')](respondWithResult(_0x4c24b0,null))['catch'](handleError(_0x4c24b0,null));}; \ No newline at end of file +var _0x1921=['rows','catch','show','length','options','create','body','find','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','update','then','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x1921,0xf2));var _0x1192=function(_0x1db4c0,_0x91ca1e){_0x1db4c0=_0x1db4c0-0x0;var _0x4e097b=_0x1921[_0x1db4c0];return _0x4e097b;};'use strict';var emlformat=require(_0x1192('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1192('0x1'));var jsonpatch=require(_0x1192('0x2'));var rp=require(_0x1192('0x3'));var moment=require(_0x1192('0x4'));var BPromise=require(_0x1192('0x5'));var Mustache=require(_0x1192('0x6'));var util=require(_0x1192('0x7'));var path=require(_0x1192('0x8'));var sox=require(_0x1192('0x9'));var csv=require(_0x1192('0xa'));var ejs=require(_0x1192('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1192('0xc'));var crypto=require(_0x1192('0xd'));var jsforce=require(_0x1192('0xe'));var deskjs=require(_0x1192('0xf'));var toCsv=require(_0x1192('0xa'));var querystring=require(_0x1192('0x10'));var Papa=require(_0x1192('0x11'));var Redis=require(_0x1192('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1192('0x13'));var hardwareService=require(_0x1192('0x14'));var logger=require(_0x1192('0x15'))(_0x1192('0x16'));var utils=require(_0x1192('0x17'));var config=require(_0x1192('0x18'));var licenseUtil=require(_0x1192('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b997,_0x594596){_0x594596=_0x594596||0xcc;return function(_0x3b7ba7){if(_0x3b7ba7){return _0x33b997[_0x1192('0x1a')](_0x594596);}return _0x33b997['status'](_0x594596)[_0x1192('0x1b')]();};}function respondWithResult(_0x1e5fcc,_0x406b97){_0x406b97=_0x406b97||0xc8;return function(_0x4c17d3){if(_0x4c17d3){return _0x1e5fcc[_0x1192('0x1c')](_0x406b97)[_0x1192('0x1d')](_0x4c17d3);}};}function respondWithFilteredResult(_0x55755b,_0x2021f2){return function(_0x3397d1){if(_0x3397d1){var _0x2a162b=typeof _0x2021f2['offset']===_0x1192('0x1e')&&typeof _0x2021f2['limit']===_0x1192('0x1e');var _0x4757bb=_0x3397d1[_0x1192('0x1f')];var _0x13a5ca=_0x2a162b?0x0:_0x2021f2[_0x1192('0x20')];var _0x24c2e1=_0x2a162b?_0x3397d1['count']:_0x2021f2['offset']+_0x2021f2[_0x1192('0x21')];var _0x1b46e2;if(_0x24c2e1>=_0x4757bb){_0x24c2e1=_0x4757bb;_0x1b46e2=0xc8;}else{_0x1b46e2=0xce;}_0x55755b[_0x1192('0x1c')](_0x1b46e2);return _0x55755b[_0x1192('0x22')]('Content-Range',_0x13a5ca+'-'+_0x24c2e1+'/'+_0x4757bb)[_0x1192('0x1d')](_0x3397d1);}return null;};}function patchUpdates(_0x2da521){return function(_0x141c9b){try{jsonpatch['apply'](_0x141c9b,_0x2da521,!![]);}catch(_0x1cfcd6){return BPromise[_0x1192('0x23')](_0x1cfcd6);}return _0x141c9b['save']();};}function saveUpdates(_0x40bee5,_0x22f4c8){return function(_0x402e64){if(_0x402e64){return _0x402e64[_0x1192('0x24')](_0x40bee5)['then'](function(_0x4ad6b4){return _0x4ad6b4;});}return null;};}function removeEntity(_0x406c87,_0x5a7774){return function(_0x3cc973){if(_0x3cc973){return _0x3cc973['destroy']()[_0x1192('0x25')](function(){_0x406c87['status'](0xcc)[_0x1192('0x1b')]();});}};}function handleEntityNotFound(_0x18e4cc,_0x572d29){return function(_0x40bdb5){if(!_0x40bdb5){_0x18e4cc[_0x1192('0x1a')](0x194);}return _0x40bdb5;};}function handleError(_0x1e198c,_0x148c22){_0x148c22=_0x148c22||0x1f4;return function(_0x288ac6){logger[_0x1192('0x26')](_0x288ac6['stack']);if(_0x288ac6[_0x1192('0x27')]){delete _0x288ac6[_0x1192('0x27')];}_0x1e198c[_0x1192('0x1c')](_0x148c22)[_0x1192('0x28')](_0x288ac6);};}exports[_0x1192('0x29')]=function(_0x3a0736,_0x469fcd){var _0x2c7c9b={},_0x3d2c78={},_0x3c2d80={'count':0x0,'rows':[]};var _0x51e8bd=_[_0x1192('0x2a')](db['ChatQueueReport']['rawAttributes'],function(_0x7218dc){return{'name':_0x7218dc[_0x1192('0x2b')],'type':_0x7218dc[_0x1192('0x2c')][_0x1192('0x2d')]};});_0x3d2c78[_0x1192('0x2e')]=_[_0x1192('0x2a')](_0x51e8bd,_0x1192('0x27'));_0x3d2c78[_0x1192('0x2f')]=_[_0x1192('0x30')](_0x3a0736[_0x1192('0x2f')]);_0x3d2c78[_0x1192('0x31')]=_[_0x1192('0x32')](_0x3d2c78[_0x1192('0x2e')],_0x3d2c78[_0x1192('0x2f')]);_0x2c7c9b[_0x1192('0x33')]=_[_0x1192('0x32')](_0x3d2c78[_0x1192('0x2e')],qs[_0x1192('0x34')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x34')]));_0x2c7c9b[_0x1192('0x33')]=_0x2c7c9b['attributes']['length']?_0x2c7c9b['attributes']:_0x3d2c78[_0x1192('0x2e')];if(!_0x3a0736[_0x1192('0x2f')][_0x1192('0x35')](_0x1192('0x36'))){_0x2c7c9b['limit']=qs[_0x1192('0x21')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x21')]);_0x2c7c9b[_0x1192('0x20')]=qs[_0x1192('0x20')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x20')]);}_0x2c7c9b[_0x1192('0x37')]=qs['sort'](_0x3a0736['query'][_0x1192('0x38')]);_0x2c7c9b[_0x1192('0x39')]=qs[_0x1192('0x31')](_[_0x1192('0x3a')](_0x3a0736[_0x1192('0x2f')],_0x3d2c78[_0x1192('0x31')]),_0x51e8bd);if(_0x3a0736['query'][_0x1192('0x3b')]){_0x2c7c9b[_0x1192('0x39')]=_[_0x1192('0x3c')](_0x2c7c9b[_0x1192('0x39')],{'$or':_[_0x1192('0x2a')](_0x51e8bd,function(_0x40ca5a){if(_0x40ca5a['type']!==_0x1192('0x3d')){var _0x3229f7={};_0x3229f7[_0x40ca5a['name']]={'$like':'%'+_0x3a0736[_0x1192('0x2f')][_0x1192('0x3b')]+'%'};return _0x3229f7;}})});}_0x2c7c9b=_[_0x1192('0x3c')]({},_0x2c7c9b,_0x3a0736['options']);var _0x57f4d2={'where':_0x2c7c9b['where']};return db[_0x1192('0x3e')][_0x1192('0x1f')](_0x57f4d2)['then'](function(_0x2974a1){_0x3c2d80[_0x1192('0x1f')]=_0x2974a1;if(_0x3a0736[_0x1192('0x2f')][_0x1192('0x3f')]){_0x2c7c9b[_0x1192('0x40')]=[{'all':!![]}];}return db[_0x1192('0x3e')][_0x1192('0x41')](_0x2c7c9b);})[_0x1192('0x25')](function(_0x1c4198){_0x3c2d80[_0x1192('0x42')]=_0x1c4198;return _0x3c2d80;})[_0x1192('0x25')](respondWithFilteredResult(_0x469fcd,_0x2c7c9b))[_0x1192('0x43')](handleError(_0x469fcd,null));};exports[_0x1192('0x44')]=function(_0xbae0b2,_0x17cc55){var _0x290a87={'raw':!![],'where':{'id':_0xbae0b2['params']['id']}},_0x553896={};_0x553896[_0x1192('0x2e')]=_[_0x1192('0x30')](db[_0x1192('0x3e')]['rawAttributes']);_0x553896[_0x1192('0x2f')]=_[_0x1192('0x30')](_0xbae0b2[_0x1192('0x2f')]);_0x553896['filters']=_[_0x1192('0x32')](_0x553896[_0x1192('0x2e')],_0x553896['query']);_0x290a87[_0x1192('0x33')]=_[_0x1192('0x32')](_0x553896[_0x1192('0x2e')],qs['fields'](_0xbae0b2[_0x1192('0x2f')][_0x1192('0x34')]));_0x290a87[_0x1192('0x33')]=_0x290a87[_0x1192('0x33')][_0x1192('0x45')]?_0x290a87['attributes']:_0x553896['model'];if(_0xbae0b2[_0x1192('0x2f')]['includeAll']){_0x290a87[_0x1192('0x40')]=[{'all':!![]}];}_0x290a87=_[_0x1192('0x3c')]({},_0x290a87,_0xbae0b2[_0x1192('0x46')]);return db[_0x1192('0x3e')]['find'](_0x290a87)[_0x1192('0x25')](handleEntityNotFound(_0x17cc55,null))[_0x1192('0x25')](respondWithResult(_0x17cc55,null))[_0x1192('0x43')](handleError(_0x17cc55,null));};exports[_0x1192('0x47')]=function(_0x2ecd11,_0x144149){return db[_0x1192('0x3e')]['create'](_0x2ecd11[_0x1192('0x48')],{})[_0x1192('0x25')](respondWithResult(_0x144149,0xc9))['catch'](handleError(_0x144149,null));};exports[_0x1192('0x24')]=function(_0x2ad1cf,_0x2822f8){if(_0x2ad1cf[_0x1192('0x48')]['id']){delete _0x2ad1cf[_0x1192('0x48')]['id'];}return db[_0x1192('0x3e')][_0x1192('0x49')]({'where':{'id':_0x2ad1cf['params']['id']}})[_0x1192('0x25')](handleEntityNotFound(_0x2822f8,null))[_0x1192('0x25')](saveUpdates(_0x2ad1cf[_0x1192('0x48')],null))['then'](respondWithResult(_0x2822f8,null))[_0x1192('0x43')](handleError(_0x2822f8,null));};exports[_0x1192('0x4a')]=function(_0xcdda33,_0x5b735c){return db['ChatQueueReport']['find']({'where':{'id':_0xcdda33[_0x1192('0x4b')]['id']}})[_0x1192('0x25')](handleEntityNotFound(_0x5b735c,null))[_0x1192('0x25')](removeEntity(_0x5b735c,null))['catch'](handleError(_0x5b735c,null));};exports['describe']=function(_0x5e2c2e,_0x239b6c){return db['ChatQueueReport'][_0x1192('0x4c')]()[_0x1192('0x25')](respondWithResult(_0x239b6c,null))[_0x1192('0x43')](handleError(_0x239b6c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b48a395..76c9e8e 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x2dda17,_0x2cf9eb){var _0x1412b7=function(_0x4c4311){while(--_0x4c4311){_0x2dda17['push'](_0x2dda17['shift']());}};_0x1412b7(++_0x2cf9eb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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 +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x514846,_0x34ac8d){var _0x2627a8=function(_0x3f503b){while(--_0x3f503b){_0x514846['push'](_0x514846['shift']());}};_0x2627a8(++_0x34ac8d);}(_0xb10b,0x12a));var _0xbb10=function(_0xeefaee,_0x4c8038){_0xeefaee=_0xeefaee-0x0;var _0x225a0e=_0xb10b[_0xeefaee];return _0x225a0e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 2e5afb6..6dced10 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 _0x23c6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','create','options','raw','CreateChatQueueReport','stringify','catch','UpdateChatQueueReport','ChatQueueReport','update','where','lodash','util','moment','bluebird'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x23c6,0x19c));var _0x623c=function(_0x198f83,_0xfcb471){_0x198f83=_0x198f83-0x0;var _0x3f362a=_0x23c6[_0x198f83];return _0x3f362a;};'use strict';var _=require(_0x623c('0x0'));var util=require(_0x623c('0x1'));var moment=require(_0x623c('0x2'));var BPromise=require(_0x623c('0x3'));var rs=require(_0x623c('0x4'));var fs=require('fs');var Redis=require(_0x623c('0x5'));var db=require(_0x623c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x623c('0x7'))(_0x623c('0x8'));var config=require(_0x623c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x623c('0xa')][_0x623c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5737e0,_0x13eb1a,_0x25fbcd){return new BPromise(function(_0x103012,_0x10dc1e){return client[_0x623c('0xc')](_0x5737e0,_0x25fbcd)[_0x623c('0xd')](function(_0x531d8d){logger[_0x623c('0xe')](_0x623c('0xf'),_0x13eb1a,_0x623c('0x10'));logger[_0x623c('0x11')](_0x623c('0x12'),_0x13eb1a,_0x623c('0x10'),JSON['stringify'](_0x531d8d));if(_0x531d8d['error']){if(_0x531d8d[_0x623c('0x13')]['code']===0x1f4){logger[_0x623c('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x13eb1a,_0x531d8d[_0x623c('0x13')][_0x623c('0x14')]);return _0x10dc1e(_0x531d8d[_0x623c('0x13')][_0x623c('0x14')]);}logger[_0x623c('0x13')](_0x623c('0xf'),_0x13eb1a,_0x531d8d[_0x623c('0x13')]['message']);return _0x103012(_0x531d8d[_0x623c('0x13')][_0x623c('0x14')]);}else{logger[_0x623c('0xe')](_0x623c('0xf'),_0x13eb1a,'request\x20sent');_0x103012(_0x531d8d[_0x623c('0x15')][_0x623c('0x14')]);}})['catch'](function(_0x2edcbd){logger[_0x623c('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x13eb1a,_0x2edcbd);_0x10dc1e(_0x2edcbd);});});}exports['CreateChatQueueReport']=function(_0x1d4a75){var _0x545122=this;return new Promise(function(_0x557b6a,_0x5e7fb7){return db['ChatQueueReport'][_0x623c('0x16')](_0x1d4a75['body'],{'raw':_0x1d4a75[_0x623c('0x17')]?_0x1d4a75[_0x623c('0x17')][_0x623c('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x43e0ef){logger['info']('CreateChatQueueReport',_0x1d4a75);logger[_0x623c('0x11')](_0x623c('0x19'),_0x1d4a75,JSON[_0x623c('0x1a')](_0x43e0ef));_0x557b6a(_0x43e0ef);})[_0x623c('0x1b')](function(_0x4c8e7a){logger[_0x623c('0x13')](_0x623c('0x19'),_0x4c8e7a['message'],_0x1d4a75);_0x5e7fb7(_0x545122[_0x623c('0x13')](0x1f4,_0x4c8e7a[_0x623c('0x14')]));});});};exports[_0x623c('0x1c')]=function(_0x1d80a2){var _0x3d6f38=this;return new Promise(function(_0x2113d2,_0x1212c1){return db[_0x623c('0x1d')][_0x623c('0x1e')](_0x1d80a2['body'],{'raw':_0x1d80a2[_0x623c('0x17')]?_0x1d80a2['options'][_0x623c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d80a2[_0x623c('0x17')]?_0x1d80a2[_0x623c('0x17')][_0x623c('0x1f')]||null:null,'attributes':_0x1d80a2[_0x623c('0x17')]?_0x1d80a2[_0x623c('0x17')]['attributes']||null:null,'limit':_0x1d80a2[_0x623c('0x17')]?_0x1d80a2[_0x623c('0x17')]['limit']||null:null})[_0x623c('0xd')](function(_0x4e575b){logger[_0x623c('0xe')](_0x623c('0x1c'),_0x1d80a2);logger[_0x623c('0x11')](_0x623c('0x1c'),_0x1d80a2,JSON[_0x623c('0x1a')](_0x4e575b));_0x2113d2(_0x4e575b);})[_0x623c('0x1b')](function(_0x4ad44a){logger['error']('UpdateChatQueueReport',_0x4ad44a[_0x623c('0x14')],_0x1d80a2);_0x1212c1(_0x3d6f38[_0x623c('0x13')](0x1f4,_0x4ad44a['message']));});});}; \ No newline at end of file +var _0x1c2a=['../../config/environment','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','create','body','options','raw','then','ChatQueueReport','where','attributes','limit','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x1bc59a,_0x22d2c3){var _0x3ab7a4=function(_0x1282a1){while(--_0x1282a1){_0x1bc59a['push'](_0x1bc59a['shift']());}};_0x3ab7a4(++_0x22d2c3);}(_0x1c2a,0xbf));var _0xa1c2=function(_0x3ff48f,_0x2bb7d7){_0x3ff48f=_0x3ff48f-0x0;var _0x28be9b=_0x1c2a[_0x3ff48f];return _0x28be9b;};'use strict';var _=require(_0xa1c2('0x0'));var util=require('util');var moment=require(_0xa1c2('0x1'));var BPromise=require(_0xa1c2('0x2'));var rs=require(_0xa1c2('0x3'));var fs=require('fs');var Redis=require(_0xa1c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1c2('0x5'));var logger=require('../../config/logger')(_0xa1c2('0x6'));var config=require(_0xa1c2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa1c2('0x8')][_0xa1c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x153c7f,_0x4f0c47,_0x15c816){return new BPromise(function(_0x378994,_0x4ab272){return client[_0xa1c2('0xa')](_0x153c7f,_0x15c816)['then'](function(_0x41d7b3){logger[_0xa1c2('0xb')](_0xa1c2('0xc'),_0x4f0c47,_0xa1c2('0xd'));logger[_0xa1c2('0xe')](_0xa1c2('0xf'),_0x4f0c47,_0xa1c2('0xd'),JSON[_0xa1c2('0x10')](_0x41d7b3));if(_0x41d7b3['error']){if(_0x41d7b3[_0xa1c2('0x11')][_0xa1c2('0x12')]===0x1f4){logger['error'](_0xa1c2('0xc'),_0x4f0c47,_0x41d7b3[_0xa1c2('0x11')][_0xa1c2('0x13')]);return _0x4ab272(_0x41d7b3[_0xa1c2('0x11')][_0xa1c2('0x13')]);}logger[_0xa1c2('0x11')](_0xa1c2('0xc'),_0x4f0c47,_0x41d7b3[_0xa1c2('0x11')][_0xa1c2('0x13')]);return _0x378994(_0x41d7b3[_0xa1c2('0x11')][_0xa1c2('0x13')]);}else{logger[_0xa1c2('0xb')](_0xa1c2('0xc'),_0x4f0c47,_0xa1c2('0xd'));_0x378994(_0x41d7b3[_0xa1c2('0x14')][_0xa1c2('0x13')]);}})[_0xa1c2('0x15')](function(_0x21ee35){logger['error'](_0xa1c2('0xc'),_0x4f0c47,_0x21ee35);_0x4ab272(_0x21ee35);});});}exports[_0xa1c2('0x16')]=function(_0x4b3d8d){var _0x33ef05=this;return new Promise(function(_0x484881,_0x2af994){return db['ChatQueueReport'][_0xa1c2('0x17')](_0x4b3d8d[_0xa1c2('0x18')],{'raw':_0x4b3d8d[_0xa1c2('0x19')]?_0x4b3d8d[_0xa1c2('0x19')][_0xa1c2('0x1a')]===undefined?!![]:![]:!![]})[_0xa1c2('0x1b')](function(_0x5d11c4){logger[_0xa1c2('0xb')](_0xa1c2('0x16'),_0x4b3d8d);logger[_0xa1c2('0xe')](_0xa1c2('0x16'),_0x4b3d8d,JSON[_0xa1c2('0x10')](_0x5d11c4));_0x484881(_0x5d11c4);})[_0xa1c2('0x15')](function(_0x2663b4){logger[_0xa1c2('0x11')](_0xa1c2('0x16'),_0x2663b4[_0xa1c2('0x13')],_0x4b3d8d);_0x2af994(_0x33ef05['error'](0x1f4,_0x2663b4[_0xa1c2('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x386b7d){var _0x18eec9=this;return new Promise(function(_0x46f76d,_0x30ca7f){return db[_0xa1c2('0x1c')]['update'](_0x386b7d[_0xa1c2('0x18')],{'raw':_0x386b7d[_0xa1c2('0x19')]?_0x386b7d[_0xa1c2('0x19')][_0xa1c2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x386b7d['options']?_0x386b7d[_0xa1c2('0x19')][_0xa1c2('0x1d')]||null:null,'attributes':_0x386b7d[_0xa1c2('0x19')]?_0x386b7d[_0xa1c2('0x19')][_0xa1c2('0x1e')]||null:null,'limit':_0x386b7d[_0xa1c2('0x19')]?_0x386b7d['options'][_0xa1c2('0x1f')]||null:null})['then'](function(_0x56324f){logger[_0xa1c2('0xb')]('UpdateChatQueueReport',_0x386b7d);logger[_0xa1c2('0xe')](_0xa1c2('0x20'),_0x386b7d,JSON[_0xa1c2('0x10')](_0x56324f));_0x46f76d(_0x56324f);})[_0xa1c2('0x15')](function(_0x24203b){logger[_0xa1c2('0x11')]('UpdateChatQueueReport',_0x24203b[_0xa1c2('0x13')],_0x386b7d);_0x30ca7f(_0x18eec9[_0xa1c2('0x11')](0x1f4,_0x24203b[_0xa1c2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6fe48e3..1753eac 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 _0x3d47=['/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xbea4e1,_0x1b3616){var _0x16369f=function(_0xfbffa3){while(--_0xfbffa3){_0xbea4e1['push'](_0xbea4e1['shift']());}};_0x16369f(++_0x1b3616);}(_0x3d47,0xf9));var _0x73d4=function(_0x32e0b5,_0xfec795){_0x32e0b5=_0x32e0b5-0x0;var _0x345b0e=_0x3d47[_0x32e0b5];return _0x345b0e;};'use strict';var multer=require(_0x73d4('0x0'));var util=require(_0x73d4('0x1'));var path=require(_0x73d4('0x2'));var timeout=require(_0x73d4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x73d4('0x4'));var auth=require(_0x73d4('0x5'));var interaction=require(_0x73d4('0x6'));var config=require(_0x73d4('0x7'));var controller=require('./chatQueueReport.controller');router[_0x73d4('0x8')]('/',auth[_0x73d4('0x9')](),controller[_0x73d4('0xa')]);router[_0x73d4('0x8')](_0x73d4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x73d4('0x8')](_0x73d4('0xc'),auth[_0x73d4('0x9')](),controller[_0x73d4('0xd')]);router[_0x73d4('0xe')]('/',auth[_0x73d4('0x9')](),controller['create']);router[_0x73d4('0xf')](_0x73d4('0xc'),auth[_0x73d4('0x9')](),controller[_0x73d4('0x10')]);router[_0x73d4('0x11')](_0x73d4('0xc'),auth[_0x73d4('0x9')](),controller[_0x73d4('0x12')]);module[_0x73d4('0x13')]=router; \ No newline at end of file +var _0xdf89=['get','isAuthenticated','index','describe','/:id','create','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x666330,_0x430164){var _0x223185=function(_0x4239d4){while(--_0x4239d4){_0x666330['push'](_0x666330['shift']());}};_0x223185(++_0x430164);}(_0xdf89,0xd9));var _0x9df8=function(_0x24173d,_0x5ddfbd){_0x24173d=_0x24173d-0x0;var _0x5f2a67=_0xdf89[_0x24173d];return _0x5f2a67;};'use strict';var multer=require(_0x9df8('0x0'));var util=require(_0x9df8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9df8('0x2'));var router=express[_0x9df8('0x3')]();var fs_extra=require(_0x9df8('0x4'));var auth=require(_0x9df8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9df8('0x6'));var controller=require('./chatQueueReport.controller');router[_0x9df8('0x7')]('/',auth[_0x9df8('0x8')](),controller[_0x9df8('0x9')]);router[_0x9df8('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9df8('0xa')]);router[_0x9df8('0x7')](_0x9df8('0xb'),auth[_0x9df8('0x8')](),controller['show']);router['post']('/',auth[_0x9df8('0x8')](),controller[_0x9df8('0xc')]);router[_0x9df8('0xd')]('/:id',auth[_0x9df8('0x8')](),controller[_0x9df8('0xe')]);router[_0x9df8('0xf')](_0x9df8('0xb'),auth[_0x9df8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 5f6d574..2776828 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2f8a22,_0x143d0e){var _0x7d7ae5=function(_0x3a68ad){while(--_0x3a68ad){_0x2f8a22['push'](_0x2f8a22['shift']());}};_0x7d7ae5(++_0x143d0e);}(_0x34e8,0x12c));var _0x834e=function(_0x58d526,_0xa2417a){_0x58d526=_0x58d526-0x0;var _0x6f2751=_0x34e8[_0x58d526];return _0x6f2751;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x355911,_0x14a9c1){var _0x1f9e3c=function(_0x36272a){while(--_0x36272a){_0x355911['push'](_0x355911['shift']());}};_0x1f9e3c(++_0x14a9c1);}(_0xedd9,0xfc));var _0x9edd=function(_0x38fa77,_0x1aaaa8){_0x38fa77=_0x38fa77-0x0;var _0x32d69b=_0xedd9[_0x38fa77];return _0x32d69b;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index e524bf4..0053387 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 _0x23d8=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','length','include','find','create','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x83d21c,_0x5d2fbb){var _0x86d0bc=function(_0x3431a5){while(--_0x3431a5){_0x83d21c['push'](_0x83d21c['shift']());}};_0x86d0bc(++_0x5d2fbb);}(_0x23d8,0x16c));var _0x823d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x23d8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x823d('0x0'));var rimraf=require(_0x823d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x823d('0x2'));var rp=require('request-promise');var moment=require(_0x823d('0x3'));var BPromise=require(_0x823d('0x4'));var Mustache=require(_0x823d('0x5'));var util=require(_0x823d('0x6'));var path=require(_0x823d('0x7'));var sox=require(_0x823d('0x8'));var csv=require(_0x823d('0x9'));var ejs=require(_0x823d('0xa'));var fs=require('fs');var fs_extra=require(_0x823d('0xb'));var _=require('lodash');var squel=require(_0x823d('0xc'));var crypto=require(_0x823d('0xd'));var jsforce=require(_0x823d('0xe'));var deskjs=require(_0x823d('0xf'));var toCsv=require(_0x823d('0x9'));var querystring=require(_0x823d('0x10'));var Papa=require(_0x823d('0x11'));var Redis=require(_0x823d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x823d('0x13'));var as=require(_0x823d('0x14'));var hardwareService=require(_0x823d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x823d('0x16'));var config=require(_0x823d('0x17'));var licenseUtil=require(_0x823d('0x18'));var db=require(_0x823d('0x19'))['db'];function respondWithStatusCode(_0x23c706,_0x5f5aba){_0x5f5aba=_0x5f5aba||0xcc;return function(_0x3982ac){if(_0x3982ac){return _0x23c706[_0x823d('0x1a')](_0x5f5aba);}return _0x23c706[_0x823d('0x1b')](_0x5f5aba)[_0x823d('0x1c')]();};}function respondWithResult(_0x18efed,_0x31041e){_0x31041e=_0x31041e||0xc8;return function(_0x5e3e1d){if(_0x5e3e1d){return _0x18efed[_0x823d('0x1b')](_0x31041e)[_0x823d('0x1d')](_0x5e3e1d);}};}function respondWithFilteredResult(_0x33488d,_0x5e62cf){return function(_0x24b0c6){if(_0x24b0c6){var _0x4f30d5=typeof _0x5e62cf[_0x823d('0x1e')]===_0x823d('0x1f')&&typeof _0x5e62cf[_0x823d('0x20')]===_0x823d('0x1f');var _0x58d0cc=_0x24b0c6['count'];var _0x58d92a=_0x4f30d5?0x0:_0x5e62cf['offset'];var _0xba34a6=_0x4f30d5?_0x24b0c6['count']:_0x5e62cf['offset']+_0x5e62cf[_0x823d('0x20')];var _0x16f3b6;if(_0xba34a6>=_0x58d0cc){_0xba34a6=_0x58d0cc;_0x16f3b6=0xc8;}else{_0x16f3b6=0xce;}_0x33488d[_0x823d('0x1b')](_0x16f3b6);return _0x33488d[_0x823d('0x21')](_0x823d('0x22'),_0x58d92a+'-'+_0xba34a6+'/'+_0x58d0cc)[_0x823d('0x1d')](_0x24b0c6);}return null;};}function patchUpdates(_0x15a783){return function(_0x5565b8){try{jsonpatch['apply'](_0x5565b8,_0x15a783,!![]);}catch(_0x4da3d5){return BPromise[_0x823d('0x23')](_0x4da3d5);}return _0x5565b8['save']();};}function saveUpdates(_0xcde57e,_0x830f3a){return function(_0x397080){if(_0x397080){return _0x397080[_0x823d('0x24')](_0xcde57e)[_0x823d('0x25')](function(_0x45af7a){return _0x45af7a;});}return null;};}function removeEntity(_0x306832,_0x137e38){return function(_0x1fb710){if(_0x1fb710){return _0x1fb710[_0x823d('0x26')]()[_0x823d('0x25')](function(){_0x306832[_0x823d('0x1b')](0xcc)[_0x823d('0x1c')]();});}};}function handleEntityNotFound(_0xe4c3a,_0x2b5185){return function(_0x46f864){if(!_0x46f864){_0xe4c3a[_0x823d('0x1a')](0x194);}return _0x46f864;};}function handleError(_0x77e48d,_0x41ba14){_0x41ba14=_0x41ba14||0x1f4;return function(_0x3cd7d3){logger[_0x823d('0x27')](_0x3cd7d3[_0x823d('0x28')]);if(_0x3cd7d3[_0x823d('0x29')]){delete _0x3cd7d3['name'];}_0x77e48d['status'](_0x41ba14)[_0x823d('0x2a')](_0x3cd7d3);};}exports[_0x823d('0x2b')]=function(_0x4a849b,_0x1e09fa){var _0x8101b1={},_0xc5c32b={},_0x96193f={'count':0x0,'rows':[]};var _0x33fe29=_[_0x823d('0x2c')](db[_0x823d('0x2d')][_0x823d('0x2e')],function(_0x5f3619){return{'name':_0x5f3619[_0x823d('0x2f')],'type':_0x5f3619[_0x823d('0x30')][_0x823d('0x31')]};});_0xc5c32b[_0x823d('0x32')]=_[_0x823d('0x2c')](_0x33fe29,'name');_0xc5c32b['query']=_[_0x823d('0x33')](_0x4a849b[_0x823d('0x34')]);_0xc5c32b[_0x823d('0x35')]=_[_0x823d('0x36')](_0xc5c32b[_0x823d('0x32')],_0xc5c32b[_0x823d('0x34')]);_0x8101b1[_0x823d('0x37')]=_['intersection'](_0xc5c32b[_0x823d('0x32')],qs[_0x823d('0x38')](_0x4a849b['query']['fields']));_0x8101b1[_0x823d('0x37')]=_0x8101b1[_0x823d('0x37')]['length']?_0x8101b1[_0x823d('0x37')]:_0xc5c32b[_0x823d('0x32')];if(!_0x4a849b[_0x823d('0x34')][_0x823d('0x39')](_0x823d('0x3a'))){_0x8101b1[_0x823d('0x20')]=qs['limit'](_0x4a849b[_0x823d('0x34')][_0x823d('0x20')]);_0x8101b1[_0x823d('0x1e')]=qs['offset'](_0x4a849b[_0x823d('0x34')][_0x823d('0x1e')]);}_0x8101b1['order']=qs['sort'](_0x4a849b[_0x823d('0x34')]['sort']);_0x8101b1[_0x823d('0x3b')]=qs['filters'](_[_0x823d('0x3c')](_0x4a849b['query'],_0xc5c32b[_0x823d('0x35')]),_0x33fe29);if(_0x4a849b[_0x823d('0x34')][_0x823d('0x3d')]){_0x8101b1[_0x823d('0x3b')]=_[_0x823d('0x3e')](_0x8101b1[_0x823d('0x3b')],{'$or':_['map'](_0x33fe29,function(_0x3c99b5){if(_0x3c99b5[_0x823d('0x30')]!==_0x823d('0x3f')){var _0x405195={};_0x405195[_0x3c99b5['name']]={'$like':'%'+_0x4a849b['query'][_0x823d('0x3d')]+'%'};return _0x405195;}})});}_0x8101b1=_[_0x823d('0x3e')]({},_0x8101b1,_0x4a849b[_0x823d('0x40')]);var _0x5bcc44={'where':_0x8101b1[_0x823d('0x3b')]};return db[_0x823d('0x2d')][_0x823d('0x41')](_0x5bcc44)[_0x823d('0x25')](function(_0x42de9d){_0x96193f['count']=_0x42de9d;if(_0x4a849b['query'][_0x823d('0x42')]){_0x8101b1['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x823d('0x43')](_0x8101b1);})[_0x823d('0x25')](function(_0x35117b){_0x96193f[_0x823d('0x44')]=_0x35117b;return _0x96193f;})[_0x823d('0x25')](respondWithFilteredResult(_0x1e09fa,_0x8101b1))[_0x823d('0x45')](handleError(_0x1e09fa,null));};exports[_0x823d('0x46')]=function(_0x4ba13e,_0x1b88dd){var _0x34b65a={'raw':!![],'where':{'id':_0x4ba13e[_0x823d('0x47')]['id']}},_0xa8e2c0={};_0xa8e2c0[_0x823d('0x32')]=_[_0x823d('0x33')](db[_0x823d('0x2d')]['rawAttributes']);_0xa8e2c0[_0x823d('0x34')]=_[_0x823d('0x33')](_0x4ba13e[_0x823d('0x34')]);_0xa8e2c0['filters']=_[_0x823d('0x36')](_0xa8e2c0[_0x823d('0x32')],_0xa8e2c0['query']);_0x34b65a['attributes']=_[_0x823d('0x36')](_0xa8e2c0[_0x823d('0x32')],qs['fields'](_0x4ba13e[_0x823d('0x34')]['fields']));_0x34b65a[_0x823d('0x37')]=_0x34b65a['attributes'][_0x823d('0x48')]?_0x34b65a[_0x823d('0x37')]:_0xa8e2c0[_0x823d('0x32')];if(_0x4ba13e['query'][_0x823d('0x42')]){_0x34b65a[_0x823d('0x49')]=[{'all':!![]}];}_0x34b65a=_['merge']({},_0x34b65a,_0x4ba13e[_0x823d('0x40')]);return db[_0x823d('0x2d')][_0x823d('0x4a')](_0x34b65a)['then'](handleEntityNotFound(_0x1b88dd,null))[_0x823d('0x25')](respondWithResult(_0x1b88dd,null))[_0x823d('0x45')](handleError(_0x1b88dd,null));};exports[_0x823d('0x4b')]=function(_0x51c690,_0x50cfe9){return db[_0x823d('0x2d')][_0x823d('0x4b')](_0x51c690['body'],{})[_0x823d('0x25')](respondWithResult(_0x50cfe9,0xc9))[_0x823d('0x45')](handleError(_0x50cfe9,null));};exports[_0x823d('0x24')]=function(_0x4d0152,_0x6e2eec){if(_0x4d0152['body']['id']){delete _0x4d0152['body']['id'];}return db[_0x823d('0x2d')][_0x823d('0x4a')]({'where':{'id':_0x4d0152['params']['id']}})[_0x823d('0x25')](handleEntityNotFound(_0x6e2eec,null))[_0x823d('0x25')](saveUpdates(_0x4d0152['body'],null))[_0x823d('0x25')](respondWithResult(_0x6e2eec,null))['catch'](handleError(_0x6e2eec,null));};exports['destroy']=function(_0x59d992,_0x3ef973){return db[_0x823d('0x2d')][_0x823d('0x4a')]({'where':{'id':_0x59d992['params']['id']}})[_0x823d('0x25')](handleEntityNotFound(_0x3ef973,null))['then'](removeEntity(_0x3ef973,null))['catch'](handleError(_0x3ef973,null));};exports[_0x823d('0x4c')]=function(_0x2f5d69,_0x2b7210){return db[_0x823d('0x2d')][_0x823d('0x4c')]()[_0x823d('0x25')](respondWithResult(_0x2b7210,null))[_0x823d('0x45')](handleError(_0x2b7210,null));}; \ No newline at end of file +var _0x2a35=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x3b1444,_0x18c659){var _0x2e9da3=function(_0x46c227){while(--_0x46c227){_0x3b1444['push'](_0x3b1444['shift']());}};_0x2e9da3(++_0x18c659);}(_0x2a35,0xce));var _0x52a3=function(_0x28dd50,_0x3904f9){_0x28dd50=_0x28dd50-0x0;var _0x5a2c29=_0x2a35[_0x28dd50];return _0x5a2c29;};'use strict';var emlformat=require(_0x52a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x52a3('0x1'));var jsonpatch=require(_0x52a3('0x2'));var rp=require(_0x52a3('0x3'));var moment=require('moment');var BPromise=require(_0x52a3('0x4'));var Mustache=require(_0x52a3('0x5'));var util=require(_0x52a3('0x6'));var path=require(_0x52a3('0x7'));var sox=require(_0x52a3('0x8'));var csv=require(_0x52a3('0x9'));var ejs=require(_0x52a3('0xa'));var fs=require('fs');var fs_extra=require(_0x52a3('0xb'));var _=require(_0x52a3('0xc'));var squel=require(_0x52a3('0xd'));var crypto=require(_0x52a3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x52a3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x52a3('0x10'));var Redis=require(_0x52a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x52a3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52a3('0x13'));var logger=require('../../config/logger')(_0x52a3('0x14'));var utils=require(_0x52a3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x52a3('0x16'));var db=require(_0x52a3('0x17'))['db'];function respondWithStatusCode(_0x45ef6f,_0x3a4e38){_0x3a4e38=_0x3a4e38||0xcc;return function(_0x473240){if(_0x473240){return _0x45ef6f[_0x52a3('0x18')](_0x3a4e38);}return _0x45ef6f[_0x52a3('0x19')](_0x3a4e38)[_0x52a3('0x1a')]();};}function respondWithResult(_0x1b7d4e,_0x2b74b6){_0x2b74b6=_0x2b74b6||0xc8;return function(_0x2993d7){if(_0x2993d7){return _0x1b7d4e['status'](_0x2b74b6)[_0x52a3('0x1b')](_0x2993d7);}};}function respondWithFilteredResult(_0x21ca41,_0x2c70d9){return function(_0x32225e){if(_0x32225e){var _0x291b06=typeof _0x2c70d9[_0x52a3('0x1c')]==='undefined'&&typeof _0x2c70d9[_0x52a3('0x1d')]===_0x52a3('0x1e');var _0xd38c11=_0x32225e[_0x52a3('0x1f')];var _0x4abfcc=_0x291b06?0x0:_0x2c70d9['offset'];var _0x320104=_0x291b06?_0x32225e[_0x52a3('0x1f')]:_0x2c70d9['offset']+_0x2c70d9['limit'];var _0x5a6199;if(_0x320104>=_0xd38c11){_0x320104=_0xd38c11;_0x5a6199=0xc8;}else{_0x5a6199=0xce;}_0x21ca41[_0x52a3('0x19')](_0x5a6199);return _0x21ca41[_0x52a3('0x20')](_0x52a3('0x21'),_0x4abfcc+'-'+_0x320104+'/'+_0xd38c11)['json'](_0x32225e);}return null;};}function patchUpdates(_0x50b589){return function(_0x1feaa2){try{jsonpatch[_0x52a3('0x22')](_0x1feaa2,_0x50b589,!![]);}catch(_0x405879){return BPromise[_0x52a3('0x23')](_0x405879);}return _0x1feaa2[_0x52a3('0x24')]();};}function saveUpdates(_0x4c0fc3,_0x32e156){return function(_0x37c207){if(_0x37c207){return _0x37c207[_0x52a3('0x25')](_0x4c0fc3)['then'](function(_0xcc4fc5){return _0xcc4fc5;});}return null;};}function removeEntity(_0x272a66,_0x25fb39){return function(_0x34831f){if(_0x34831f){return _0x34831f[_0x52a3('0x26')]()[_0x52a3('0x27')](function(){_0x272a66['status'](0xcc)[_0x52a3('0x1a')]();});}};}function handleEntityNotFound(_0x508859,_0x3a2ebc){return function(_0x6324f2){if(!_0x6324f2){_0x508859[_0x52a3('0x18')](0x194);}return _0x6324f2;};}function handleError(_0x2067d8,_0xe7bee6){_0xe7bee6=_0xe7bee6||0x1f4;return function(_0x4ea303){logger[_0x52a3('0x28')](_0x4ea303[_0x52a3('0x29')]);if(_0x4ea303[_0x52a3('0x2a')]){delete _0x4ea303[_0x52a3('0x2a')];}_0x2067d8[_0x52a3('0x19')](_0xe7bee6)[_0x52a3('0x2b')](_0x4ea303);};}exports['index']=function(_0x309a90,_0x2586a4){var _0x5b99db={},_0x9d167a={},_0x21e82e={'count':0x0,'rows':[]};var _0x33b9a9=_[_0x52a3('0x2c')](db[_0x52a3('0x2d')][_0x52a3('0x2e')],function(_0x578746){return{'name':_0x578746[_0x52a3('0x2f')],'type':_0x578746[_0x52a3('0x30')][_0x52a3('0x31')]};});_0x9d167a[_0x52a3('0x32')]=_['map'](_0x33b9a9,_0x52a3('0x2a'));_0x9d167a[_0x52a3('0x33')]=_[_0x52a3('0x34')](_0x309a90['query']);_0x9d167a['filters']=_['intersection'](_0x9d167a[_0x52a3('0x32')],_0x9d167a[_0x52a3('0x33')]);_0x5b99db[_0x52a3('0x35')]=_['intersection'](_0x9d167a[_0x52a3('0x32')],qs[_0x52a3('0x36')](_0x309a90[_0x52a3('0x33')]['fields']));_0x5b99db['attributes']=_0x5b99db[_0x52a3('0x35')][_0x52a3('0x37')]?_0x5b99db[_0x52a3('0x35')]:_0x9d167a[_0x52a3('0x32')];if(!_0x309a90['query'][_0x52a3('0x38')](_0x52a3('0x39'))){_0x5b99db[_0x52a3('0x1d')]=qs[_0x52a3('0x1d')](_0x309a90[_0x52a3('0x33')][_0x52a3('0x1d')]);_0x5b99db[_0x52a3('0x1c')]=qs[_0x52a3('0x1c')](_0x309a90[_0x52a3('0x33')][_0x52a3('0x1c')]);}_0x5b99db[_0x52a3('0x3a')]=qs['sort'](_0x309a90['query'][_0x52a3('0x3b')]);_0x5b99db[_0x52a3('0x3c')]=qs[_0x52a3('0x3d')](_['pick'](_0x309a90[_0x52a3('0x33')],_0x9d167a[_0x52a3('0x3d')]),_0x33b9a9);if(_0x309a90[_0x52a3('0x33')][_0x52a3('0x3e')]){_0x5b99db['where']=_[_0x52a3('0x3f')](_0x5b99db[_0x52a3('0x3c')],{'$or':_['map'](_0x33b9a9,function(_0x54065f){if(_0x54065f[_0x52a3('0x30')]!==_0x52a3('0x40')){var _0x500878={};_0x500878[_0x54065f[_0x52a3('0x2a')]]={'$like':'%'+_0x309a90['query']['filter']+'%'};return _0x500878;}})});}_0x5b99db=_[_0x52a3('0x3f')]({},_0x5b99db,_0x309a90[_0x52a3('0x41')]);var _0x1cd5aa={'where':_0x5b99db['where']};return db[_0x52a3('0x2d')][_0x52a3('0x1f')](_0x1cd5aa)[_0x52a3('0x27')](function(_0x277f52){_0x21e82e[_0x52a3('0x1f')]=_0x277f52;if(_0x309a90[_0x52a3('0x33')][_0x52a3('0x42')]){_0x5b99db[_0x52a3('0x43')]=[{'all':!![]}];}return db[_0x52a3('0x2d')]['findAll'](_0x5b99db);})[_0x52a3('0x27')](function(_0x2238d9){_0x21e82e[_0x52a3('0x44')]=_0x2238d9;return _0x21e82e;})[_0x52a3('0x27')](respondWithFilteredResult(_0x2586a4,_0x5b99db))[_0x52a3('0x45')](handleError(_0x2586a4,null));};exports['show']=function(_0x1067b5,_0x396ffc){var _0x2df91c={'raw':!![],'where':{'id':_0x1067b5[_0x52a3('0x46')]['id']}},_0x5a2024={};_0x5a2024['model']=_['keys'](db[_0x52a3('0x2d')][_0x52a3('0x2e')]);_0x5a2024[_0x52a3('0x33')]=_[_0x52a3('0x34')](_0x1067b5['query']);_0x5a2024['filters']=_[_0x52a3('0x47')](_0x5a2024[_0x52a3('0x32')],_0x5a2024[_0x52a3('0x33')]);_0x2df91c[_0x52a3('0x35')]=_[_0x52a3('0x47')](_0x5a2024['model'],qs[_0x52a3('0x36')](_0x1067b5[_0x52a3('0x33')]['fields']));_0x2df91c['attributes']=_0x2df91c[_0x52a3('0x35')][_0x52a3('0x37')]?_0x2df91c[_0x52a3('0x35')]:_0x5a2024[_0x52a3('0x32')];if(_0x1067b5[_0x52a3('0x33')][_0x52a3('0x42')]){_0x2df91c[_0x52a3('0x43')]=[{'all':!![]}];}_0x2df91c=_[_0x52a3('0x3f')]({},_0x2df91c,_0x1067b5[_0x52a3('0x41')]);return db[_0x52a3('0x2d')][_0x52a3('0x48')](_0x2df91c)['then'](handleEntityNotFound(_0x396ffc,null))[_0x52a3('0x27')](respondWithResult(_0x396ffc,null))[_0x52a3('0x45')](handleError(_0x396ffc,null));};exports[_0x52a3('0x49')]=function(_0x49f2e8,_0x475dbd){return db[_0x52a3('0x2d')][_0x52a3('0x49')](_0x49f2e8[_0x52a3('0x4a')],{})[_0x52a3('0x27')](respondWithResult(_0x475dbd,0xc9))[_0x52a3('0x45')](handleError(_0x475dbd,null));};exports[_0x52a3('0x25')]=function(_0x4e7c3f,_0x201041){if(_0x4e7c3f[_0x52a3('0x4a')]['id']){delete _0x4e7c3f[_0x52a3('0x4a')]['id'];}return db[_0x52a3('0x2d')]['find']({'where':{'id':_0x4e7c3f[_0x52a3('0x46')]['id']}})[_0x52a3('0x27')](handleEntityNotFound(_0x201041,null))[_0x52a3('0x27')](saveUpdates(_0x4e7c3f[_0x52a3('0x4a')],null))[_0x52a3('0x27')](respondWithResult(_0x201041,null))['catch'](handleError(_0x201041,null));};exports[_0x52a3('0x26')]=function(_0x43b443,_0x38409b){return db[_0x52a3('0x2d')][_0x52a3('0x48')]({'where':{'id':_0x43b443[_0x52a3('0x46')]['id']}})[_0x52a3('0x27')](handleEntityNotFound(_0x38409b,null))[_0x52a3('0x27')](removeEntity(_0x38409b,null))[_0x52a3('0x45')](handleError(_0x38409b,null));};exports[_0x52a3('0x4b')]=function(_0x492f75,_0x4f1439){return db['ChatTransferReport'][_0x52a3('0x4b')]()[_0x52a3('0x27')](respondWithResult(_0x4f1439,null))['catch'](handleError(_0x4f1439,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index cdceb0e..06fb495 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 _0x5849=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0xa275db,_0x3ce17e){var _0x1102e3=function(_0x556f8d){while(--_0x556f8d){_0xa275db['push'](_0xa275db['shift']());}};_0x1102e3(++_0x3ce17e);}(_0x5849,0xb8));var _0x9584=function(_0x125f1e,_0x58659f){_0x125f1e=_0x125f1e-0x0;var _0x210e95=_0x5849[_0x125f1e];return _0x210e95;};'use strict';var _=require(_0x9584('0x0'));var util=require(_0x9584('0x1'));var logger=require(_0x9584('0x2'))(_0x9584('0x3'));var moment=require(_0x9584('0x4'));var BPromise=require(_0x9584('0x5'));var rp=require(_0x9584('0x6'));var fs=require('fs');var path=require(_0x9584('0x7'));var rimraf=require(_0x9584('0x8'));var config=require(_0x9584('0x9'));var attributes=require(_0x9584('0xa'));module['exports']=function(_0x2d2475,_0x6a0f58){return _0x2d2475[_0x9584('0xb')](_0x9584('0xc'),attributes,{'tableName':_0x9584('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9584('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd9f=['../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x345d47,_0x52a4dc){var _0x1e7361=function(_0x5d2746){while(--_0x5d2746){_0x345d47['push'](_0x345d47['shift']());}};_0x1e7361(++_0x52a4dc);}(_0xcd9f,0x11a));var _0xfcd9=function(_0x2cb0fe,_0x23f390){_0x2cb0fe=_0x2cb0fe-0x0;var _0xcf38ab=_0xcd9f[_0x2cb0fe];return _0xcf38ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfcd9('0x0'))(_0xfcd9('0x1'));var moment=require(_0xfcd9('0x2'));var BPromise=require(_0xfcd9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcd9('0x4'));var rimraf=require(_0xfcd9('0x5'));var config=require(_0xfcd9('0x6'));var attributes=require(_0xfcd9('0x7'));module[_0xfcd9('0x8')]=function(_0xb5cb41,_0x279c9a){return _0xb5cb41[_0xfcd9('0x9')]('ChatTransferReport',attributes,{'tableName':_0xfcd9('0xa'),'paranoid':![],'indexes':[{'name':_0xfcd9('0xb'),'fields':[_0xfcd9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 3be6035..211089d 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 _0xdd50=['../../config/logger','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x35d665,_0x38d379){var _0x13d109=function(_0x498ae9){while(--_0x498ae9){_0x35d665['push'](_0x35d665['shift']());}};_0x13d109(++_0x38d379);}(_0xdd50,0x123));var _0x0dd5=function(_0x475191,_0x5bce86){_0x475191=_0x475191-0x0;var _0x189e96=_0xdd50[_0x475191];return _0x189e96;};'use strict';var _=require(_0x0dd5('0x0'));var util=require(_0x0dd5('0x1'));var moment=require(_0x0dd5('0x2'));var BPromise=require(_0x0dd5('0x3'));var rs=require(_0x0dd5('0x4'));var fs=require('fs');var Redis=require(_0x0dd5('0x5'));var db=require(_0x0dd5('0x6'))['db'];var utils=require(_0x0dd5('0x7'));var logger=require(_0x0dd5('0x8'))('rpc');var config=require(_0x0dd5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0dd5('0xa')][_0x0dd5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22984c,_0x230fe5,_0x303452){return new BPromise(function(_0x32e4e6,_0x2ffb48){return client[_0x0dd5('0xc')](_0x22984c,_0x303452)[_0x0dd5('0xd')](function(_0x508849){logger[_0x0dd5('0xe')](_0x0dd5('0xf'),_0x230fe5,_0x0dd5('0x10'));logger[_0x0dd5('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x230fe5,_0x0dd5('0x10'),JSON['stringify'](_0x508849));if(_0x508849['error']){if(_0x508849['error'][_0x0dd5('0x12')]===0x1f4){logger[_0x0dd5('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x230fe5,_0x508849['error'][_0x0dd5('0x14')]);return _0x2ffb48(_0x508849[_0x0dd5('0x13')][_0x0dd5('0x14')]);}logger['error'](_0x0dd5('0xf'),_0x230fe5,_0x508849[_0x0dd5('0x13')]['message']);return _0x32e4e6(_0x508849[_0x0dd5('0x13')][_0x0dd5('0x14')]);}else{logger[_0x0dd5('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x230fe5,_0x0dd5('0x10'));_0x32e4e6(_0x508849[_0x0dd5('0x15')][_0x0dd5('0x14')]);}})[_0x0dd5('0x16')](function(_0x503467){logger[_0x0dd5('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x230fe5,_0x503467);_0x2ffb48(_0x503467);});});} \ No newline at end of file +var _0x542e=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x6132ec,_0x277e60){var _0x1b0d6f=function(_0x4a6afc){while(--_0x4a6afc){_0x6132ec['push'](_0x6132ec['shift']());}};_0x1b0d6f(++_0x277e60);}(_0x542e,0xd0));var _0xe542=function(_0x491483,_0x156eb5){_0x491483=_0x491483-0x0;var _0x4d2d44=_0x542e[_0x491483];return _0x4d2d44;};'use strict';var _=require(_0xe542('0x0'));var util=require('util');var moment=require(_0xe542('0x1'));var BPromise=require('bluebird');var rs=require(_0xe542('0x2'));var fs=require('fs');var Redis=require(_0xe542('0x3'));var db=require(_0xe542('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe542('0x5'))('rpc');var config=require(_0xe542('0x6'));var jayson=require(_0xe542('0x7'));var client=jayson[_0xe542('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11c419,_0x3cf040,_0x213cef){return new BPromise(function(_0xdac389,_0x390b60){return client[_0xe542('0x9')](_0x11c419,_0x213cef)[_0xe542('0xa')](function(_0x465fe4){logger[_0xe542('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x3cf040,_0xe542('0xc'));logger[_0xe542('0xd')](_0xe542('0xe'),_0x3cf040,'request\x20sent',JSON[_0xe542('0xf')](_0x465fe4));if(_0x465fe4[_0xe542('0x10')]){if(_0x465fe4[_0xe542('0x10')][_0xe542('0x11')]===0x1f4){logger[_0xe542('0x10')](_0xe542('0x12'),_0x3cf040,_0x465fe4[_0xe542('0x10')]['message']);return _0x390b60(_0x465fe4[_0xe542('0x10')][_0xe542('0x13')]);}logger[_0xe542('0x10')](_0xe542('0x12'),_0x3cf040,_0x465fe4[_0xe542('0x10')][_0xe542('0x13')]);return _0xdac389(_0x465fe4['error'][_0xe542('0x13')]);}else{logger[_0xe542('0xb')](_0xe542('0x12'),_0x3cf040,_0xe542('0xc'));_0xdac389(_0x465fe4[_0xe542('0x14')][_0xe542('0x13')]);}})[_0xe542('0x15')](function(_0x169413){logger[_0xe542('0x10')](_0xe542('0x12'),_0x3cf040,_0x169413);_0x390b60(_0x169413);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index f0fd189..f6dc017 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 _0x2b1a=['./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xdd8d43,_0x26147b){var _0x2abf27=function(_0x1c16a9){while(--_0x1c16a9){_0xdd8d43['push'](_0xdd8d43['shift']());}};_0x2abf27(++_0x26147b);}(_0x2b1a,0x7a));var _0xa2b1=function(_0x518a93,_0x330c7c){_0x518a93=_0x518a93-0x0;var _0x41bfbf=_0x2b1a[_0x518a93];return _0x41bfbf;};'use strict';var multer=require(_0xa2b1('0x0'));var util=require(_0xa2b1('0x1'));var path=require(_0xa2b1('0x2'));var timeout=require(_0xa2b1('0x3'));var express=require('express');var router=express[_0xa2b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa2b1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa2b1('0x6'));router['get']('/',auth[_0xa2b1('0x7')](),controller[_0xa2b1('0x8')]);router[_0xa2b1('0x9')](_0xa2b1('0xa'),auth[_0xa2b1('0x7')](),controller[_0xa2b1('0xb')]);router[_0xa2b1('0x9')](_0xa2b1('0xc'),auth[_0xa2b1('0x7')](),controller[_0xa2b1('0xd')]);router[_0xa2b1('0xe')]('/',auth[_0xa2b1('0x7')](),controller['create']);router['put'](_0xa2b1('0xc'),auth[_0xa2b1('0x7')](),controller['update']);router['delete'](_0xa2b1('0xc'),auth[_0xa2b1('0x7')](),controller['destroy']);module[_0xa2b1('0xf')]=router; \ No newline at end of file +var _0xb4d1=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x67af21,_0x178341){var _0x2831ed=function(_0x2b58df){while(--_0x2b58df){_0x67af21['push'](_0x67af21['shift']());}};_0x2831ed(++_0x178341);}(_0xb4d1,0x122));var _0x1b4d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xb4d1[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x1b4d('0x0'));var util=require('util');var path=require(_0x1b4d('0x1'));var timeout=require(_0x1b4d('0x2'));var express=require(_0x1b4d('0x3'));var router=express[_0x1b4d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b4d('0x5'));var config=require(_0x1b4d('0x6'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x1b4d('0x7')](),controller[_0x1b4d('0x8')]);router[_0x1b4d('0x9')](_0x1b4d('0xa'),auth['isAuthenticated'](),controller[_0x1b4d('0xb')]);router[_0x1b4d('0x9')](_0x1b4d('0xc'),auth[_0x1b4d('0x7')](),controller[_0x1b4d('0xd')]);router[_0x1b4d('0xe')]('/',auth[_0x1b4d('0x7')](),controller[_0x1b4d('0xf')]);router[_0x1b4d('0x10')](_0x1b4d('0xc'),auth[_0x1b4d('0x7')](),controller[_0x1b4d('0x11')]);router[_0x1b4d('0x12')](_0x1b4d('0xc'),auth[_0x1b4d('0x7')](),controller[_0x1b4d('0x13')]);module[_0x1b4d('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 0e17930..11e9ca7 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 _0xde9c=['Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','address','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','name','parse','getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'];(function(_0x192ff9,_0x164ff7){var _0x14b57f=function(_0x132657){while(--_0x132657){_0x192ff9['push'](_0x192ff9['shift']());}};_0x14b57f(++_0x164ff7);}(_0xde9c,0x119));var _0xcde9=function(_0xbb313f,_0x236685){_0xbb313f=_0xbb313f-0x0;var _0x395ff6=_0xde9c[_0xbb313f];return _0x395ff6;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xcde9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcde9('0x1')},'description':{'type':Sequelize[_0xcde9('0x2')]},'mapKey':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x3')},'mapKeyOffline':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x3')},'key':{'type':Sequelize[_0xcde9('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xcde9('0x2')],'allowNull':![],'defaultValue':_0xcde9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xcde9('0x2')],'allowNull':![],'defaultValue':_0xcde9('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xcde9('0x2')],'allowNull':![],'defaultValue':_0xcde9('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xcde9('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcde9('0x9')]('rounded',_0xcde9('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0xb')},'start_chat_button':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0xc')},'offline_chat_button':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0xd')},'header_offline':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xcde9('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xcde9('0xf')]},'closingQuestion':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcde9('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x12')},'noteTitle':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x13')},'placeholderMessage':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x16')},'ratingType':{'type':Sequelize[_0xcde9('0x9')](_0xcde9('0x17'),_0xcde9('0x18')),'defaultValue':_0xcde9('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xcde9('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xcde9('0xf')],'defaultValue':function(){return JSON[_0xcde9('0x19')]({'items':[{'type':_0xcde9('0x1a'),'variable':null,'config':{'placeholder':_0xcde9('0x1b'),'type':'text','required':!![]},'props':{'title':_0xcde9('0x1b'),'helpText':''}},{'type':_0xcde9('0x1a'),'props':{'title':_0xcde9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xcde9('0x3'),'type':_0xcde9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xcde9('0x1c')](this[_0xcde9('0x1d')](_0xcde9('0x1e'))):{};},'set':function(_0x4fc54e){return this[_0xcde9('0x1f')](_0xcde9('0x1e'),JSON[_0xcde9('0x19')](_0x4fc54e));}},'offlineForm':{'type':Sequelize[_0xcde9('0xf')],'defaultValue':function(){return JSON[_0xcde9('0x19')]({'items':[{'type':_0xcde9('0x1a'),'props':{'title':_0xcde9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xcde9('0x3')},'variable':null},{'type':_0xcde9('0x20'),'config':{'placeholder':_0xcde9('0x21')},'props':{'title':_0xcde9('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xcde9('0x1d')]('offlineForm')?JSON[_0xcde9('0x1c')](this[_0xcde9('0x1d')]('offlineForm')):{};},'set':function(_0x5f5b19){return this['setDataValue'](_0xcde9('0x22'),JSON['stringify'](_0x5f5b19));}},'token':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':function(){return rs[_0xcde9('0x23')]();}},'autoclose':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xcde9('0x2')]},'forwardOffline':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xcde9('0x2')]},'waitingTitle':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x24')},'waitingMessage':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x26')},'offlineMessageBody':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x28')},'skipUnmanaged':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x15')},'sendUnmanaged':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xcde9('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xcde9('0x2')]},'notificationTemplate':{'type':Sequelize[_0xcde9('0xf')],'defaultValue':function(){return _0xcde9('0x29');}},'notificationSound':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x2a')},'verticalAlignment':{'type':Sequelize[_0xcde9('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x2b')},'messagesAlignment':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x2c')},'defaultTitle':{'type':Sequelize[_0xcde9('0x2')]},'customerAvatar':{'type':Sequelize[_0xcde9('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xcde9('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xcde9('0x2')],'allowNull':![],'defaultValue':_0xcde9('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcde9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcde9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':_0xcde9('0x2e')},'systemAvatar':{'type':Sequelize[_0xcde9('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcde9('0x7')],'comment':_0xcde9('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcde9('0x30'),'set':function(_0x497790){if(!_0x497790)this['setDataValue'](_0xcde9('0x31'),null);this[_0xcde9('0x1f')](_0xcde9('0x32'),_0x497790);}},'vidaooEscalation':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcde9('0x33')},'vidaooNote':{'type':Sequelize[_0xcde9('0x2')],'defaultValue':function(){return _0xcde9('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xcde9('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xcde9('0xf')]}}; \ No newline at end of file +var _0x55df=['Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','stringify','name','input','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x55df,0x9e));var _0xf55d=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x55df[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0xf55d('0x0'));var rs=require(_0xf55d('0x1'));module[_0xf55d('0x2')]={'name':{'type':Sequelize[_0xf55d('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xf55d('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xf55d('0x3')]},'mapKey':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x4')},'mapKeyOffline':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x4')},'key':{'type':Sequelize[_0xf55d('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x5')},'customerAlias':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf55d('0x3')],'allowNull':![],'defaultValue':_0xf55d('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf55d('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf55d('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf55d('0x3')],'allowNull':![],'defaultValue':_0xf55d('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf55d('0x3')]},'animation':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf55d('0x9'),_0xf55d('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0xb')},'start_chat_button':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0xc')},'download_transcript':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf55d('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf55d('0xf')]},'closingQuestion':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf55d('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x12')},'noteTitle':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x13')},'placeholderMessage':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf55d('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf55d('0x16')},'conditionAgreement':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x17')},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0xf55d('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xf55d('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf55d('0xf')],'defaultValue':function(){return JSON[_0xf55d('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xf55d('0x1a'),'type':'text','required':!![]},'props':{'title':_0xf55d('0x1a'),'helpText':''}},{'type':_0xf55d('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf55d('0x4'),'type':_0xf55d('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf55d('0x1c')](_0xf55d('0x1d'))?JSON['parse'](this[_0xf55d('0x1c')]('onlineForm')):{};},'set':function(_0x29eba3){return this[_0xf55d('0x1e')](_0xf55d('0x1d'),JSON[_0xf55d('0x19')](_0x29eba3));}},'offlineForm':{'type':Sequelize[_0xf55d('0xf')],'defaultValue':function(){return JSON[_0xf55d('0x19')]({'items':[{'type':_0xf55d('0x1b'),'props':{'title':_0xf55d('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xf55d('0x4'),'type':'email'},'variable':null},{'type':_0xf55d('0x1f'),'config':{'placeholder':_0xf55d('0x20')},'props':{'title':_0xf55d('0x20'),'helpText':_0xf55d('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xf55d('0x1c')]('offlineForm')?JSON['parse'](this['getDataValue'](_0xf55d('0x22'))):{};},'set':function(_0x45d2ba){return this[_0xf55d('0x1e')](_0xf55d('0x22'),JSON[_0xf55d('0x19')](_0x45d2ba));}},'token':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':function(){return rs[_0xf55d('0x23')]();}},'autoclose':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf55d('0x3')]},'forwardOffline':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf55d('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf55d('0x24')},'waitingMessage':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x26')},'offlineMessageBody':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x27')},'skipUnmanaged':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf55d('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf55d('0xf')],'defaultValue':function(){return _0xf55d('0x28');}},'notificationSound':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xf55d('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf55d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xf55d('0xd')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x2a')},'messagesAlignment':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x2b')},'defaultTitle':{'type':Sequelize[_0xf55d('0x3')]},'customerAvatar':{'type':Sequelize[_0xf55d('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf55d('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf55d('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf55d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf55d('0x3')],'defaultValue':_0xf55d('0x2d')},'systemAvatar':{'type':Sequelize[_0xf55d('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf55d('0xd')],'comment':_0xf55d('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![],'comment':_0xf55d('0x2f'),'set':function(_0x409a6d){if(!_0x409a6d)this['setDataValue'](_0xf55d('0x30'),null);this['setDataValue'](_0xf55d('0x31'),_0x409a6d);}},'vidaooEscalation':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf55d('0x3')]},'vidaooTopic':{'type':Sequelize[_0xf55d('0x3')],'allowNull':![],'defaultValue':_0xf55d('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xf55d('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xf55d('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf55d('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf55d('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index dfe23c1..9ac3a29 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 _0xd1f9=['join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','root','download','getAvatar','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','Interval','resolve','timezone','ifTime','notify','chat','from','mapKey','Body\x20is\x20mandatory','createdAt','includes','updatedAt','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','List','CmContact','DESC','ChatApplication','Applications','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','asc','account','list','Contacts','contact','headers','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','interaction','messageId','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','EventManager','offline','Sequelize','ValidationError','CompanyId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','getSnippet','Intervals','getProactiveActions','virtual','License','increment','server/files/chat/iframe.ejs','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','connection','replace','alignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','fs-extra','lodash','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','handleError','APIConflictError','./helpers/wildcard-expressions','url','redis','defaults','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','count','set','Content-Range','json','update','then','destroy','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','type','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','merge','filter','options','ChatWebsite','includeAll','include','findAll','rows','params','find','create','body','split','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','address','forEach','testWildcardValidity','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','pick','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','sitepic','file','agentAvatar','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xd1f9,0xa3));var _0x9d1f=function(_0x134058,_0x423995){_0x134058=_0x134058-0x0;var _0x14a1a9=_0xd1f9[_0x134058];return _0x14a1a9;};'use strict';var Mustache=require(_0x9d1f('0x0'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d1f('0x1'));var _=require(_0x9d1f('0x2'));var querystring=require('querystring');var htmlToText=require(_0x9d1f('0x3'));var Redis=require(_0x9d1f('0x4'));var jayson=require(_0x9d1f('0x5'));var qs=require(_0x9d1f('0x6'));var logger=require('../../config/logger')(_0x9d1f('0x7'));var config=require(_0x9d1f('0x8'));var APIBadRequestError=require('../../errors/api')[_0x9d1f('0x9')];var APINotFoundError=require(_0x9d1f('0xa'))[_0x9d1f('0xb')];var APIOutOfIntervalError=require(_0x9d1f('0xa'))['APIOutOfIntervalError'];var APIHandleError=require(_0x9d1f('0xa'))[_0x9d1f('0xc')];var APIConflictError=require(_0x9d1f('0xa'))[_0x9d1f('0xd')];var wildcardUtils=require(_0x9d1f('0xe'));var URL=require(_0x9d1f('0xf'))['URL'];var db=require('../../mysqldb')['db'];config[_0x9d1f('0x10')]=_[_0x9d1f('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d1f('0x10')]));require(_0x9d1f('0x12'))['register'](socket);var client=jayson[_0x9d1f('0x13')][_0x9d1f('0x14')]({'port':0x232c});var client9002=jayson[_0x9d1f('0x13')][_0x9d1f('0x14')]({'port':0x232a});var client9003=jayson[_0x9d1f('0x13')][_0x9d1f('0x14')]({'port':0x232b});var client9001=jayson[_0x9d1f('0x13')][_0x9d1f('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x558f62,_0x9f6fc6,_0x5b3794,_0x236542){return new Promise(function(_0x2f3c9d,_0x2300a9){var _0x41af1f=_0x236542||client;return _0x41af1f[_0x9d1f('0x15')](_0x558f62,_0x5b3794)['then'](function(_0x33b71f){logger[_0x9d1f('0x16')](_0x9d1f('0x17'),_0x9f6fc6,_0x9d1f('0x18'));logger[_0x9d1f('0x19')](_0x9d1f('0x1a'),_0x9f6fc6,'request\x20sent',JSON[_0x9d1f('0x1b')](_0x33b71f));if(_0x33b71f[_0x9d1f('0x1c')]){if(_0x33b71f['error'][_0x9d1f('0x1d')]===0x1f4){logger['error'](_0x9d1f('0x17'),_0x9f6fc6,_0x33b71f[_0x9d1f('0x1c')][_0x9d1f('0x1e')]);return _0x2300a9(_0x33b71f[_0x9d1f('0x1c')][_0x9d1f('0x1e')]);}logger[_0x9d1f('0x1c')](_0x9d1f('0x17'),_0x9f6fc6,_0x33b71f[_0x9d1f('0x1c')]['message']);return _0x2f3c9d(_0x33b71f[_0x9d1f('0x1c')][_0x9d1f('0x1e')]);}else{logger[_0x9d1f('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x9f6fc6,'request\x20sent');_0x2f3c9d(_0x33b71f[_0x9d1f('0x1f')]['message']);}})[_0x9d1f('0x20')](function(_0x4eb050){logger[_0x9d1f('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x9f6fc6,_0x4eb050);_0x2300a9(_0x4eb050);});});}function respondWithStatusCode(_0x567392,_0x4c399e){_0x4c399e=_0x4c399e||0xcc;return function(_0x5a9572){if(_0x5a9572){return _0x567392[_0x9d1f('0x21')](_0x4c399e);}return _0x567392[_0x9d1f('0x22')](_0x4c399e)['end']();};}function respondWithResult(_0x1c4986,_0x52b631){_0x52b631=_0x52b631||0xc8;return function(_0x11ada3){if(_0x11ada3){return _0x1c4986[_0x9d1f('0x22')](_0x52b631)['json'](_0x11ada3);}};}function respondWithFilteredResult(_0x21c0c0,_0x30782){return function(_0x338c0e){if(_0x338c0e){var _0x40b343=typeof _0x30782[_0x9d1f('0x23')]===_0x9d1f('0x24')&&typeof _0x30782['limit']===_0x9d1f('0x24');var _0x280efe=_0x338c0e[_0x9d1f('0x25')];var _0x22e606=_0x40b343?0x0:_0x30782[_0x9d1f('0x23')];var _0x1b8561=_0x40b343?_0x338c0e[_0x9d1f('0x25')]:_0x30782[_0x9d1f('0x23')]+_0x30782['limit'];var _0x35f59d;if(_0x1b8561>=_0x280efe){_0x1b8561=_0x280efe;_0x35f59d=0xc8;}else{_0x35f59d=0xce;}_0x21c0c0[_0x9d1f('0x22')](_0x35f59d);return _0x21c0c0[_0x9d1f('0x26')](_0x9d1f('0x27'),_0x22e606+'-'+_0x1b8561+'/'+_0x280efe)[_0x9d1f('0x28')](_0x338c0e);}return null;};}function saveUpdates(_0x555fb9){return function(_0x11fe04){if(_0x11fe04){return _0x11fe04[_0x9d1f('0x29')](_0x555fb9)[_0x9d1f('0x2a')](function(_0x1924a8){return _0x1924a8;});}return null;};}function removeEntity(_0x2e87ee){return function(_0x3cdb29){if(_0x3cdb29){return _0x3cdb29[_0x9d1f('0x2b')]()[_0x9d1f('0x2a')](function(){var _0x419024=_0x3cdb29['get']({'plain':!![]});var _0x4a34ac='ChatWebsites';return db[_0x9d1f('0x2c')]['destroy']({'where':{'type':_0x4a34ac,'resourceId':_0x419024['id']}})[_0x9d1f('0x2a')](function(){return _0x3cdb29;});})[_0x9d1f('0x2a')](function(){_0x2e87ee[_0x9d1f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57888e){return function(_0x2fcd97){if(!_0x2fcd97){_0x57888e[_0x9d1f('0x21')](0x194);}return _0x2fcd97;};}function handleError(_0x37a582,_0x26b8b6){_0x26b8b6=_0x26b8b6||0x1f4;return function(_0x5cd448){logger['error'](_0x5cd448[_0x9d1f('0x2d')]);if(_0x5cd448['name']){delete _0x5cd448[_0x9d1f('0x2e')];}_0x37a582[_0x9d1f('0x22')](_0x26b8b6)[_0x9d1f('0x2f')](_0x5cd448);};}function createInteractionObject(_0x173657,_0x55370c,_0x30b397,_0x245877){var _0x3f6253=require(_0x9d1f('0x30'));var _0x1dbd1a=new _0x3f6253();var _0x255a15=_0x1dbd1a[_0x9d1f('0x31')](_0x30b397[_0x9d1f('0x32')])[_0x9d1f('0x33')]();var _0x10afb4=_0x55370c[_0x9d1f('0x34')];if(_0x30b397[_0x9d1f('0x35')]){_0x10afb4=_0x30b397[_0x9d1f('0x35')];}else if(_0x30b397[_0x9d1f('0x36')]){_0x10afb4=_[_0x9d1f('0x37')](_0x30b397[_0x9d1f('0x36')]['split'](','));}return{'ContactId':_0x245877['id'],'ChatWebsiteId':_0x173657,'from':(_0x245877[_0x9d1f('0x38')]||'')+'\x20'+(_0x245877[_0x9d1f('0x39')]||''),'customerIp':_0x10afb4,'customerPort':_0x30b397['x-real-port']?_0x30b397['x-real-port']:null,'referer':_0x55370c[_0x9d1f('0x3a')],'browserName':_0x255a15[_0x9d1f('0x3b')][_0x9d1f('0x2e')]&&_0x255a15['browser'][_0x9d1f('0x3c')]?util[_0x9d1f('0x3d')](_0x9d1f('0x3e'),_0x255a15[_0x9d1f('0x3b')][_0x9d1f('0x2e')],_0x255a15['browser'][_0x9d1f('0x3c')]):'unknown','browserVersion':_0x255a15[_0x9d1f('0x3b')]['version']||_0x9d1f('0x3f'),'osName':util['format']('%s\x20%s',_0x255a15['os'][_0x9d1f('0x2e')],_0x255a15['os'][_0x9d1f('0x3c')]),'osVersion':_0x255a15['os']['version'],'deviceModel':_0x255a15[_0x9d1f('0x40')]['model']&&_0x255a15['device']['vendor']?util[_0x9d1f('0x3d')]('%s\x20%s\x20%s',_0x255a15['device'][_0x9d1f('0x41')],_0x255a15[_0x9d1f('0x40')][_0x9d1f('0x42')],_0x255a15['device'][_0x9d1f('0x43')]):null,'deviceVendor':_0x255a15[_0x9d1f('0x40')][_0x9d1f('0x42')],'deviceType':_0x255a15['device'][_0x9d1f('0x43')],'formData':JSON[_0x9d1f('0x1b')](_0x55370c)};}exports[_0x9d1f('0x44')]=function(_0x1bd8ae,_0x182617){var _0x167e90={'include':[{'model':db[_0x9d1f('0x45')],'as':_0x9d1f('0x46')}]},_0x102496={},_0x25bf5f={'count':0x0,'rows':[]};var _0x11ea41=_[_0x9d1f('0x47')](db['ChatWebsite'][_0x9d1f('0x48')],function(_0x233c1d){return{'name':_0x233c1d[_0x9d1f('0x49')],'type':_0x233c1d[_0x9d1f('0x43')][_0x9d1f('0x4a')]};});_0x102496[_0x9d1f('0x41')]=_['map'](_0x11ea41,'name');_0x102496[_0x9d1f('0x4b')]=_[_0x9d1f('0x4c')](_0x1bd8ae[_0x9d1f('0x4b')]);_0x102496[_0x9d1f('0x4d')]=_[_0x9d1f('0x4e')](_0x102496[_0x9d1f('0x41')],_0x102496['query']);_0x167e90['attributes']=_[_0x9d1f('0x4e')](_0x102496['model'],qs[_0x9d1f('0x4f')](_0x1bd8ae[_0x9d1f('0x4b')][_0x9d1f('0x4f')]));_0x167e90[_0x9d1f('0x50')]=_0x167e90[_0x9d1f('0x50')][_0x9d1f('0x51')]?_0x167e90['attributes']:_0x102496[_0x9d1f('0x41')];if(!_0x1bd8ae[_0x9d1f('0x4b')]['hasOwnProperty'](_0x9d1f('0x52'))){_0x167e90[_0x9d1f('0x53')]=qs[_0x9d1f('0x53')](_0x1bd8ae[_0x9d1f('0x4b')]['limit']);_0x167e90[_0x9d1f('0x23')]=qs[_0x9d1f('0x23')](_0x1bd8ae[_0x9d1f('0x4b')][_0x9d1f('0x23')]);}_0x167e90[_0x9d1f('0x54')]=qs[_0x9d1f('0x55')](_0x1bd8ae[_0x9d1f('0x4b')][_0x9d1f('0x55')]);_0x167e90[_0x9d1f('0x56')]=qs[_0x9d1f('0x4d')](_['pick'](_0x1bd8ae['query'],_0x102496[_0x9d1f('0x4d')]),_0x11ea41);if(_0x1bd8ae[_0x9d1f('0x4b')]['filter']){_0x167e90[_0x9d1f('0x56')]=_[_0x9d1f('0x57')](_0x167e90[_0x9d1f('0x56')],{'$or':_['map'](_0x11ea41,function(_0x13c5c1){if(_0x13c5c1[_0x9d1f('0x43')]!=='VIRTUAL'){var _0x3a69bc={};_0x3a69bc[_0x13c5c1[_0x9d1f('0x2e')]]={'$like':'%'+_0x1bd8ae[_0x9d1f('0x4b')][_0x9d1f('0x58')]+'%'};return _0x3a69bc;}})});}_0x167e90=_[_0x9d1f('0x57')]({},_0x167e90,_0x1bd8ae[_0x9d1f('0x59')]);var _0x55f8ab={'where':_0x167e90[_0x9d1f('0x56')]};return db[_0x9d1f('0x5a')]['count'](_0x55f8ab)[_0x9d1f('0x2a')](function(_0x7b21a3){_0x25bf5f[_0x9d1f('0x25')]=_0x7b21a3;if(_0x1bd8ae[_0x9d1f('0x4b')][_0x9d1f('0x5b')]){_0x167e90[_0x9d1f('0x5c')]=[{'all':!![]}];}return db[_0x9d1f('0x5a')][_0x9d1f('0x5d')](_0x167e90);})[_0x9d1f('0x2a')](function(_0x3826a7){_0x25bf5f[_0x9d1f('0x5e')]=_0x3826a7;return _0x25bf5f;})['then'](respondWithFilteredResult(_0x182617,_0x167e90))[_0x9d1f('0x20')](handleError(_0x182617,null));};exports['show']=function(_0x350b17,_0x4a909f){var _0xf21b43={'raw':![],'where':{'id':_0x350b17[_0x9d1f('0x5f')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1dc30={};_0x1dc30['model']=_[_0x9d1f('0x4c')](db['ChatWebsite'][_0x9d1f('0x48')]);_0x1dc30[_0x9d1f('0x4b')]=_[_0x9d1f('0x4c')](_0x350b17[_0x9d1f('0x4b')]);_0x1dc30[_0x9d1f('0x4d')]=_[_0x9d1f('0x4e')](_0x1dc30[_0x9d1f('0x41')],_0x1dc30[_0x9d1f('0x4b')]);_0xf21b43[_0x9d1f('0x50')]=_[_0x9d1f('0x4e')](_0x1dc30['model'],qs[_0x9d1f('0x4f')](_0x350b17[_0x9d1f('0x4b')][_0x9d1f('0x4f')]));_0xf21b43['attributes']=_0xf21b43[_0x9d1f('0x50')][_0x9d1f('0x51')]?_0xf21b43['attributes']:_0x1dc30[_0x9d1f('0x41')];if(_0x350b17[_0x9d1f('0x4b')][_0x9d1f('0x5b')]){_0xf21b43[_0x9d1f('0x5c')]=[{'all':!![]}];}_0xf21b43=_['merge']({},_0xf21b43,_0x350b17[_0x9d1f('0x59')]);return db[_0x9d1f('0x5a')][_0x9d1f('0x60')](_0xf21b43)[_0x9d1f('0x2a')](handleEntityNotFound(_0x4a909f,null))[_0x9d1f('0x2a')](respondWithResult(_0x4a909f,null))[_0x9d1f('0x20')](handleError(_0x4a909f,null));};exports[_0x9d1f('0x61')]=function(_0xe68dbb,_0x4536a4){var _0x1641b7=null;_0xe68dbb[_0x9d1f('0x62')]['address'][_0x9d1f('0x63')](',')['forEach'](_0x5bb6ae=>{if(_0x5bb6ae[_0x9d1f('0x64')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x5bb6ae['trim']())){_0x1641b7=new APIBadRequestError('\x22'+_0x5bb6ae[_0x9d1f('0x64')]()+_0x9d1f('0x65'));}});if(_0x1641b7){return handleError(_0x4536a4,null)(_0x1641b7);}return db['ChatWebsite'][_0x9d1f('0x61')](_0xe68dbb[_0x9d1f('0x62')],{})[_0x9d1f('0x2a')](function(_0x5a5904){var _0x276c8f=_0xe68dbb[_0x9d1f('0x66')][_0x9d1f('0x67')]({'plain':!![]});if(!_0x276c8f)throw new Error(_0x9d1f('0x68'));if(_0x276c8f['role']==='user'){var _0x1f3ef5=_0x5a5904['get']({'plain':!![]});var _0x434995=_0x9d1f('0x69');return db[_0x9d1f('0x6a')][_0x9d1f('0x60')]({'where':{'name':_0x434995,'userProfileId':_0x276c8f[_0x9d1f('0x6b')]},'raw':!![]})['then'](function(_0x3933a0){if(_0x3933a0&&_0x3933a0['autoAssociation']===0x0){return db[_0x9d1f('0x2c')]['create']({'name':_0x1f3ef5[_0x9d1f('0x2e')],'resourceId':_0x1f3ef5['id'],'type':_0x3933a0['name'],'sectionId':_0x3933a0['id']},{})['then'](function(){return _0x5a5904;});}else{return _0x5a5904;}})[_0x9d1f('0x20')](function(_0x39f5cf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39f5cf);throw _0x39f5cf;});}return _0x5a5904;})['then'](respondWithResult(_0x4536a4,0xc9))['catch'](handleError(_0x4536a4,null));};exports[_0x9d1f('0x29')]=function(_0x13805c,_0x3dd90a){var _0x27edf2=null;_0x13805c['body'][_0x9d1f('0x6c')][_0x9d1f('0x63')](',')[_0x9d1f('0x6d')](_0x108d64=>{if(_0x108d64['trim']()!==''&&!wildcardUtils[_0x9d1f('0x6e')](_0x108d64['trim']())){_0x27edf2=new APIBadRequestError('\x22'+_0x108d64[_0x9d1f('0x64')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x27edf2){return handleError(_0x3dd90a,null)(_0x27edf2);}if(_0x13805c['body']['id']){delete _0x13805c[_0x9d1f('0x62')]['id'];}return db[_0x9d1f('0x5a')]['find']({'where':{'id':_0x13805c[_0x9d1f('0x5f')]['id']},'include':[{'model':db[_0x9d1f('0x45')],'as':_0x9d1f('0x46')}]})[_0x9d1f('0x2a')](handleEntityNotFound(_0x3dd90a,null))[_0x9d1f('0x2a')](saveUpdates(_0x13805c['body'],null))['then'](respondWithResult(_0x3dd90a,null))['catch'](handleError(_0x3dd90a,null));};exports[_0x9d1f('0x2b')]=function(_0x309192,_0x511117){return db[_0x9d1f('0x5a')]['find']({'where':{'id':_0x309192[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x511117,null))[_0x9d1f('0x2a')](removeEntity(_0x511117,null))[_0x9d1f('0x20')](handleError(_0x511117,null));};exports[_0x9d1f('0x6f')]=function(_0x1d2c40,_0x489c93){return db['ChatWebsite'][_0x9d1f('0x6f')]()[_0x9d1f('0x2a')](respondWithResult(_0x489c93,null))['catch'](handleError(_0x489c93,null));};exports[_0x9d1f('0x70')]=function(_0x528073,_0x44ee5c){if(_0x528073[_0x9d1f('0x62')]['id']){delete _0x528073[_0x9d1f('0x62')]['id'];}return db[_0x9d1f('0x5a')][_0x9d1f('0x60')]({'where':{'id':_0x528073[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x44ee5c,null))[_0x9d1f('0x2a')](function(_0x13232d){if(_0x13232d){_0x528073[_0x9d1f('0x62')][_0x9d1f('0x71')]=_0x13232d['id'];return db[_0x9d1f('0x72')][_0x9d1f('0x61')](_0x528073[_0x9d1f('0x62')]);}})[_0x9d1f('0x2a')](respondWithResult(_0x44ee5c,null))[_0x9d1f('0x20')](handleError(_0x44ee5c,null));};exports[_0x9d1f('0x73')]=function(_0x5749ad,_0x4019f7){var _0x13837d={'raw':![],'where':{}};var _0x2fde25={};var _0x2293ad={'count':0x0,'rows':[]};return db[_0x9d1f('0x5a')][_0x9d1f('0x74')]({'where':{'id':_0x5749ad[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x4019f7,null))['then'](function(_0x41bdaf){if(_0x41bdaf){_0x2fde25[_0x9d1f('0x41')]=_[_0x9d1f('0x4c')](db[_0x9d1f('0x72')][_0x9d1f('0x48')]);_0x2fde25['query']=_[_0x9d1f('0x4c')](_0x5749ad[_0x9d1f('0x4b')]);_0x2fde25['filters']=_['intersection'](_0x2fde25[_0x9d1f('0x41')],_0x2fde25[_0x9d1f('0x4b')]);_0x13837d[_0x9d1f('0x50')]=_[_0x9d1f('0x4e')](_0x2fde25[_0x9d1f('0x41')],qs[_0x9d1f('0x4f')](_0x5749ad[_0x9d1f('0x4b')]['fields']));_0x13837d[_0x9d1f('0x50')]=_0x13837d[_0x9d1f('0x50')][_0x9d1f('0x51')]?_0x13837d['attributes']:_0x2fde25[_0x9d1f('0x41')];if(!_0x5749ad['query'][_0x9d1f('0x75')](_0x9d1f('0x52'))){_0x13837d[_0x9d1f('0x53')]=qs[_0x9d1f('0x53')](_0x5749ad[_0x9d1f('0x4b')][_0x9d1f('0x53')]);_0x13837d[_0x9d1f('0x23')]=qs['offset'](_0x5749ad[_0x9d1f('0x4b')]['offset']);}_0x13837d[_0x9d1f('0x54')]=qs['sort'](_0x5749ad['query']['sort']);_0x13837d[_0x9d1f('0x56')]=qs[_0x9d1f('0x4d')](_[_0x9d1f('0x76')](_0x5749ad['query'],_0x2fde25[_0x9d1f('0x4d')]));_0x13837d[_0x9d1f('0x56')][_0x9d1f('0x71')]=_0x41bdaf['id'];if(_0x5749ad[_0x9d1f('0x4b')][_0x9d1f('0x58')]){_0x13837d['where']=_['merge'](_0x13837d['where'],{'$or':_[_0x9d1f('0x47')](_0x13837d[_0x9d1f('0x50')],function(_0x543ecb){var _0x54628f={};_0x54628f[_0x543ecb]={'$like':'%'+_0x5749ad[_0x9d1f('0x4b')][_0x9d1f('0x58')]+'%'};return _0x54628f;})});}_0x13837d=_[_0x9d1f('0x57')]({},_0x13837d,_0x5749ad[_0x9d1f('0x59')]);return db[_0x9d1f('0x72')][_0x9d1f('0x25')]({'where':_0x13837d['where']})[_0x9d1f('0x2a')](function(_0x127575){_0x2293ad[_0x9d1f('0x25')]=_0x127575;if(_0x5749ad[_0x9d1f('0x4b')][_0x9d1f('0x5b')]){_0x13837d['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x13837d);})['then'](function(_0x1a0792){_0x2293ad[_0x9d1f('0x5e')]=_0x1a0792;return _0x2293ad;});}})[_0x9d1f('0x2a')](respondWithFilteredResult(_0x4019f7,_0x13837d))[_0x9d1f('0x20')](handleError(_0x4019f7,null));};exports[_0x9d1f('0x77')]=function(_0xf9c5a5,_0x42678b){return db['ChatWebsite'][_0x9d1f('0x60')]({'where':{'id':_0xf9c5a5[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x42678b,null))[_0x9d1f('0x2a')](function(_0x25b5b8){if(_0x25b5b8){return _0x25b5b8[_0x9d1f('0x77')](_0xf9c5a5[_0x9d1f('0x4b')]['ids']);}})[_0x9d1f('0x2a')](respondWithStatusCode(_0x42678b,null))['catch'](handleError(_0x42678b,null));};exports[_0x9d1f('0x78')]=function(_0xb92c1,_0x1939d0){if(_0xb92c1[_0x9d1f('0x62')]['id']){delete _0xb92c1[_0x9d1f('0x62')]['id'];}return db['ChatWebsite'][_0x9d1f('0x60')]({'where':{'id':_0xb92c1['params']['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x1939d0,null))[_0x9d1f('0x2a')](function(_0x10faaf){if(_0x10faaf){_0xb92c1[_0x9d1f('0x62')]['ChatWebsiteId']=_0x10faaf['id'];return db[_0x9d1f('0x79')]['create'](_0xb92c1['body']);}})['then'](respondWithResult(_0x1939d0,null))[_0x9d1f('0x20')](handleError(_0x1939d0,null));};exports['getAnswers']=function(_0x4af9de,_0x2db13b){var _0x219c9f={'raw':![],'where':{}};var _0x40e3ef={};var _0x53b1d9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9d1f('0x74')]({'where':{'id':_0x4af9de[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x2db13b,null))['then'](function(_0x516fdd){if(_0x516fdd){_0x40e3ef[_0x9d1f('0x41')]=_[_0x9d1f('0x4c')](db['CannedAnswer'][_0x9d1f('0x48')]);_0x40e3ef[_0x9d1f('0x4b')]=_[_0x9d1f('0x4c')](_0x4af9de['query']);_0x40e3ef[_0x9d1f('0x4d')]=_[_0x9d1f('0x4e')](_0x40e3ef[_0x9d1f('0x41')],_0x40e3ef[_0x9d1f('0x4b')]);_0x219c9f[_0x9d1f('0x50')]=_[_0x9d1f('0x4e')](_0x40e3ef['model'],qs[_0x9d1f('0x4f')](_0x4af9de[_0x9d1f('0x4b')]['fields']));_0x219c9f['attributes']=_0x219c9f[_0x9d1f('0x50')][_0x9d1f('0x51')]?_0x219c9f[_0x9d1f('0x50')]:_0x40e3ef['model'];if(!_0x4af9de[_0x9d1f('0x4b')][_0x9d1f('0x75')]('nolimit')){_0x219c9f[_0x9d1f('0x53')]=qs[_0x9d1f('0x53')](_0x4af9de['query'][_0x9d1f('0x53')]);_0x219c9f['offset']=qs[_0x9d1f('0x23')](_0x4af9de['query'][_0x9d1f('0x23')]);}_0x219c9f[_0x9d1f('0x54')]=qs[_0x9d1f('0x55')](_0x4af9de[_0x9d1f('0x4b')][_0x9d1f('0x55')]);_0x219c9f['where']=qs['filters'](_[_0x9d1f('0x76')](_0x4af9de['query'],_0x40e3ef[_0x9d1f('0x4d')]));_0x219c9f[_0x9d1f('0x56')][_0x9d1f('0x71')]=_0x516fdd['id'];if(_0x4af9de[_0x9d1f('0x4b')][_0x9d1f('0x58')]){_0x219c9f[_0x9d1f('0x56')]=_[_0x9d1f('0x57')](_0x219c9f[_0x9d1f('0x56')],{'$or':_[_0x9d1f('0x47')](_0x219c9f[_0x9d1f('0x50')],function(_0x4bca1f){var _0x335a6d={};_0x335a6d[_0x4bca1f]={'$like':'%'+_0x4af9de[_0x9d1f('0x4b')][_0x9d1f('0x58')]+'%'};return _0x335a6d;})});}_0x219c9f=_['merge']({},_0x219c9f,_0x4af9de[_0x9d1f('0x59')]);return db[_0x9d1f('0x79')][_0x9d1f('0x25')]({'where':_0x219c9f[_0x9d1f('0x56')]})[_0x9d1f('0x2a')](function(_0x40e972){_0x53b1d9['count']=_0x40e972;if(_0x4af9de['query'][_0x9d1f('0x5b')]){_0x219c9f[_0x9d1f('0x5c')]=[{'all':!![]}];}return db[_0x9d1f('0x79')]['findAll'](_0x219c9f);})[_0x9d1f('0x2a')](function(_0xaa0287){_0x53b1d9[_0x9d1f('0x5e')]=_0xaa0287;return _0x53b1d9;});}})[_0x9d1f('0x2a')](respondWithFilteredResult(_0x2db13b,_0x219c9f))['catch'](handleError(_0x2db13b,null));};exports['removeAnswers']=function(_0x576626,_0xc497f3){return db['ChatWebsite']['find']({'where':{'id':_0x576626[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0xc497f3,null))[_0x9d1f('0x2a')](function(_0xd1d2e7){if(_0xd1d2e7){return _0xd1d2e7[_0x9d1f('0x7a')](_0x576626[_0x9d1f('0x4b')][_0x9d1f('0x7b')]);}})[_0x9d1f('0x2a')](respondWithStatusCode(_0xc497f3,null))['catch'](handleError(_0xc497f3,null));};exports['addLogo']=function(_0x5e236c,_0x5ba1c0){_0x5e236c['body'][_0x9d1f('0x7c')]=_0x5e236c[_0x9d1f('0x7d')]['filename'];return db[_0x9d1f('0x5a')]['find']({'where':{'id':_0x5e236c[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x5ba1c0,null))[_0x9d1f('0x2a')](saveUpdates(_0x5e236c['body'],null))[_0x9d1f('0x2a')](respondWithResult(_0x5ba1c0,null))['catch'](handleError(_0x5ba1c0,null));};exports['addAvatar']=function(_0x244b87,_0xcc8b7b){_0x244b87[_0x9d1f('0x62')][_0x9d1f('0x7e')]=_0x244b87[_0x9d1f('0x7d')][_0x9d1f('0x7f')];return db[_0x9d1f('0x5a')][_0x9d1f('0x60')]({'where':{'id':_0x244b87[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0xcc8b7b,null))[_0x9d1f('0x2a')](saveUpdates(_0x244b87['body'],null))[_0x9d1f('0x2a')](respondWithResult(_0xcc8b7b,null))[_0x9d1f('0x20')](handleError(_0xcc8b7b,null));};exports['addCustomerAvatar']=function(_0x354bf2,_0x4d0972){_0x354bf2[_0x9d1f('0x62')][_0x9d1f('0x80')]=_0x354bf2[_0x9d1f('0x7d')][_0x9d1f('0x7f')];return db['ChatWebsite']['find']({'where':{'id':_0x354bf2[_0x9d1f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4d0972,null))[_0x9d1f('0x2a')](saveUpdates(_0x354bf2['body'],null))[_0x9d1f('0x2a')](respondWithResult(_0x4d0972,null))[_0x9d1f('0x20')](handleError(_0x4d0972,null));};exports[_0x9d1f('0x81')]=function(_0x2482b7,_0x49fcb3){_0x2482b7[_0x9d1f('0x62')][_0x9d1f('0x82')]=_0x2482b7[_0x9d1f('0x7d')][_0x9d1f('0x7f')];return db[_0x9d1f('0x5a')][_0x9d1f('0x60')]({'where':{'id':_0x2482b7['params']['id']}})['then'](handleEntityNotFound(_0x49fcb3,null))[_0x9d1f('0x2a')](saveUpdates(_0x2482b7[_0x9d1f('0x62')],null))[_0x9d1f('0x2a')](respondWithResult(_0x49fcb3,null))['catch'](handleError(_0x49fcb3,null));};exports[_0x9d1f('0x83')]=function(_0x43d420,_0x2e09b2){var _0x37ba7f=path[_0x9d1f('0x84')](config['root'],_0x9d1f('0x85'));var _0x585672={'where':{'id':_0x43d420[_0x9d1f('0x5f')]['id']},'attributes':['id',_0x9d1f('0x7c')],'raw':!![]};var _0x3f47c6=![];return require(_0x9d1f('0x86'))[_0x9d1f('0x87')]()['then'](function(_0xe7ad35){if(_0xe7ad35){_0x3f47c6=_0xe7ad35[_0x9d1f('0x88')];}})[_0x9d1f('0x2a')](function(){return db['ChatWebsite'][_0x9d1f('0x60')](_0x585672);})[_0x9d1f('0x2a')](handleEntityNotFound(_0x2e09b2,null))[_0x9d1f('0x2a')](function(_0x2cc589){if(_0x2cc589){if(!_[_0x9d1f('0x89')](_0x2cc589['sitepic'])){if(fs['existsSync'](path[_0x9d1f('0x84')](config['root'],_0x9d1f('0x8a'),_0x2cc589[_0x9d1f('0x7c')]))&&_0x3f47c6){_0x37ba7f=path['join'](config[_0x9d1f('0x8b')],_0x9d1f('0x8a'),_0x2cc589[_0x9d1f('0x7c')]);}}return _0x2e09b2[_0x9d1f('0x8c')](_0x37ba7f);}})['catch'](handleError(_0x2e09b2,null));};exports[_0x9d1f('0x8d')]=function(_0xce1b05,_0x4b587d){var _0x13c3f4=path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],'server/files/images/avatars/default_avatar.png');var _0x34ea70={'where':{'id':_0xce1b05[_0x9d1f('0x5f')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x9d1f('0x5a')][_0x9d1f('0x60')](_0x34ea70)[_0x9d1f('0x2a')](handleEntityNotFound(_0x4b587d,null))[_0x9d1f('0x2a')](function(_0x39eaf4){if(_0x39eaf4){if(!_[_0x9d1f('0x89')](_0x39eaf4[_0x9d1f('0x7e')])){if(fs[_0x9d1f('0x8e')](path['join'](config['root'],_0x9d1f('0x8f'),_0x39eaf4[_0x9d1f('0x7e')]))){_0x13c3f4=path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],'server/files/images/avatars/',_0x39eaf4[_0x9d1f('0x7e')]);}}return _0x4b587d[_0x9d1f('0x8c')](_0x13c3f4);}})[_0x9d1f('0x20')](handleError(_0x4b587d,null));};exports['getCustomerAvatar']=function(_0x49d9e3,_0x42358e){var _0x446dca=path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],_0x9d1f('0x90'));var _0x28e24f={'where':{'id':_0x49d9e3[_0x9d1f('0x5f')]['id']},'attributes':['id',_0x9d1f('0x80'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x28e24f)[_0x9d1f('0x2a')](handleEntityNotFound(_0x42358e,null))[_0x9d1f('0x2a')](function(_0x187104){if(_0x187104){if(!_[_0x9d1f('0x89')](_0x187104['customerAvatar'])){if(fs[_0x9d1f('0x8e')](path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],_0x9d1f('0x8f'),_0x187104[_0x9d1f('0x80')]))&&_0x187104[_0x9d1f('0x91')]){_0x446dca=path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],_0x9d1f('0x8f'),_0x187104[_0x9d1f('0x80')]);}}return _0x42358e['download'](_0x446dca);}})['catch'](handleError(_0x42358e,null));};exports['getSystemAvatar']=function(_0x46e8f5,_0x36ead4){var _0x58805f=path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],'server/files/images/avatars/system_avatar.png');var _0x5b0329={'where':{'id':_0x46e8f5[_0x9d1f('0x5f')]['id']},'attributes':['id',_0x9d1f('0x82')],'raw':!![]};return db[_0x9d1f('0x5a')]['find'](_0x5b0329)['then'](handleEntityNotFound(_0x36ead4,null))[_0x9d1f('0x2a')](function(_0x298654){if(_0x298654){if(!_[_0x9d1f('0x89')](_0x298654['systemAvatar'])){if(fs[_0x9d1f('0x8e')](path['join'](config[_0x9d1f('0x8b')],_0x9d1f('0x8f'),_0x298654[_0x9d1f('0x82')]))){_0x58805f=path[_0x9d1f('0x84')](config['root'],_0x9d1f('0x8f'),_0x298654[_0x9d1f('0x82')]);}}return _0x36ead4['download'](_0x58805f);}})['catch'](handleError(_0x36ead4,null));};function checkWebsiteInterval(_0x5abd0f){var _0x35a2bd=_0x5abd0f[_0x9d1f('0x92')];if(!_0x35a2bd){return Promise[_0x9d1f('0x93')](_0x5abd0f);}var _0x541618=_0x5abd0f[_0x9d1f('0x94')]||undefined;return _0x35a2bd[_0x9d1f('0x95')](_0x541618)['then'](function(_0x4832ef){if(!_0x4832ef){throw new APIOutOfIntervalError();}return _0x5abd0f;});}exports[_0x9d1f('0x96')]=function(_0xc9982e,_0x1af568){var _0x1bd0de={'body':_0xc9982e[_0x9d1f('0x62')],'channel':_0x9d1f('0x97')};var _0x1aca84=[];var _0x434adc=[];var _0x73e72c={};var _0xf947c8=![];if(_0xc9982e['body']['id']){delete _0xc9982e[_0x9d1f('0x62')]['id'];}if(_[_0x9d1f('0x89')](_0xc9982e['body'][_0x9d1f('0x98')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x9d1f('0x89')](_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x99')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_['isEmpty'](_0xc9982e['body'][_0x9d1f('0x62')])){throw new APIBadRequestError(_0x9d1f('0x9a'));}var _0x53a594=_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x34')]&&_0xc9982e['body'][_0x9d1f('0x3a')];return db['CmContact']['describe']()[_0x9d1f('0x2a')](function(_0xf4a4ea){if(!_0xf4a4ea){throw new Error('No\x20available\x20attributes');}_0x1aca84=Object[_0x9d1f('0x4c')](_0xf4a4ea)[_0x9d1f('0x58')](function(_0x4a4e86){return![_0x9d1f('0x9b'),'updatedAt'][_0x9d1f('0x9c')](_0x4a4e86);});_0x434adc=Object[_0x9d1f('0x4c')](_0xf4a4ea)[_0x9d1f('0x58')](function(_0x75cc63){return![_0x9d1f('0x9b'),_0x9d1f('0x9d'),'CompanyId',_0x9d1f('0x9e')][_0x9d1f('0x9c')](_0x75cc63);});if(!_['includes'](_0x434adc,_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x99')])){throw new APIBadRequestError(_0x9d1f('0x9f')+_0x434adc['join'](',\x20'));}_0x73e72c[_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x99')]]=_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x98')];})[_0x9d1f('0x2a')](function(){return db[_0x9d1f('0x5a')]['find']({'where':{'id':_0xc9982e[_0x9d1f('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x9d1f('0xa0'),'include':[{'model':db[_0x9d1f('0xa1')],'as':'Contacts','where':_0x73e72c,'limit':0x1,'order':[['updatedAt',_0x9d1f('0xa2')]]}]},{'model':db[_0x9d1f('0xa3')],'as':_0x9d1f('0xa4')},{'model':db[_0x9d1f('0x92')],'as':_0x9d1f('0x92'),'include':[{'model':db[_0x9d1f('0x92')],'as':'Intervals','attributes':['id',_0x9d1f('0xa5')],'raw':!![]}]}]});})[_0x9d1f('0x2a')](function(_0x2c9740){if(!_0x2c9740){throw new APINotFoundError(util[_0x9d1f('0x3d')](_0x9d1f('0xa6'),_0xc9982e[_0x9d1f('0x5f')]['id']));}if(_0x53a594){return checkWebsiteInterval(_0x2c9740);}return _0x2c9740;})[_0x9d1f('0x2a')](function(_0x313a90){_0x1bd0de['account']=_0x313a90;_0x1bd0de[_0x9d1f('0xa7')]=_[_0x9d1f('0xa8')](_0x313a90[_0x9d1f('0xa4')],['priority'],[_0x9d1f('0xa9')]);if(_0x1bd0de['account']['Applications']){delete _0x1bd0de[_0x9d1f('0xaa')][_0x9d1f('0xa4')];}_0x1bd0de[_0x9d1f('0xab')]=_0x313a90[_0x9d1f('0xa0')]||{'id':_0x313a90[_0x9d1f('0x9e')]};if(_0x1bd0de[_0x9d1f('0xab')]&&_0x1bd0de[_0x9d1f('0xab')]['Contacts']['length']){return _0x1bd0de['list'][_0x9d1f('0xac')][0x0];}var _0x59525b=_[_0x9d1f('0x11')](_0xc9982e[_0x9d1f('0x62')],{'firstName':_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x98')],'ListId':_0x313a90[_0x9d1f('0x9e')]});_0x59525b[_0xc9982e[_0x9d1f('0x62')]['mapKey']]=_0xc9982e[_0x9d1f('0x62')]['from'];return db['CmContact'][_0x9d1f('0x61')](_0x59525b,{'fields':_0x1aca84,'raw':!![]});})[_0x9d1f('0x2a')](function(_0x464ee1){_0x1bd0de[_0x9d1f('0xad')]=_0x464ee1;var _0x280e2f=createInteractionObject(_0xc9982e[_0x9d1f('0x5f')]['id'],_0xc9982e[_0x9d1f('0x62')],_0xc9982e[_0x9d1f('0xae')],_0x464ee1);var _0xfcb06e={'ChatWebsiteId':_0xc9982e[_0x9d1f('0x5f')]['id']};if(_0xc9982e[_0x9d1f('0x62')]['threadId']){_0xfcb06e[_0x9d1f('0xaf')]=_0xc9982e[_0x9d1f('0x62')]['threadId'];_0xfcb06e['closed']=![];return db['ChatInteraction']['find']({'where':_0xfcb06e})[_0x9d1f('0x2a')](function(_0x3f03e9){var _0x308ecb=_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x34')]&&_0xc9982e['body'][_0x9d1f('0x3a')];if(_0x3f03e9){_0xf947c8=!![];return _0x3f03e9;}else if(!_0x308ecb&&_0x3f03e9&&_0x3f03e9[_0x9d1f('0xb0')]){throw new APIConflictError(_0x9d1f('0xb1'));}_0x280e2f[_0x9d1f('0xaf')]=_0xc9982e['body'][_0x9d1f('0xaf')];_0x280e2f[_0x9d1f('0xb2')]=_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xb2')];return db[_0x9d1f('0xb3')][_0x9d1f('0x61')](_0x280e2f);});}_0xfcb06e['ContactId']=_0x464ee1['id'];if(_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xb4')]&&_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xb4')]['id']){_0xfcb06e['id']=_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xb4')]['id'];return db[_0x9d1f('0xb3')][_0x9d1f('0x60')]({'where':_0xfcb06e})[_0x9d1f('0x2a')](function(_0x4c32c7){var _0x4b1af2=_0xc9982e[_0x9d1f('0x62')]['customerIp']&&_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x3a')];if(!_0x4b1af2&&_0x4c32c7&&_0x4c32c7['closed']){throw new APIConflictError(_0x9d1f('0xb1'));}else if(_0x4c32c7){_0xf947c8=!![];return _0x4c32c7;}else{return db[_0x9d1f('0xb3')][_0x9d1f('0x61')](_0x280e2f);}});}return db[_0x9d1f('0xb3')]['create'](_0x280e2f);})['then'](function(_0x20c3b2){if(!_0xf947c8){return _0x20c3b2;}var _0x248aab={'from':(_0x1bd0de[_0x9d1f('0xad')]['firstName']||'')+'\x20'+(_0x1bd0de[_0x9d1f('0xad')][_0x9d1f('0x39')]||'')};if(_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xaf')]&&_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xb5')]&&_0xc9982e['body']['threadId']!=_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xb5')]){_0x248aab[_0x9d1f('0xaf')]=_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xb5')];}return _0x20c3b2[_0x9d1f('0x29')](_0x248aab);})['then'](function(_0x63be26){_0x1bd0de[_0x9d1f('0xb4')]=_0x63be26[_0x9d1f('0x67')]({'plain':!![]});_0x1bd0de[_0x9d1f('0xb4')]['created']=!_0xf947c8;if(_0x1bd0de[_0x9d1f('0xb4')]['created']){if(_0x1bd0de['account'][_0x9d1f('0xb6')]){_0x1bd0de['applications']['push']({'id':0x0,'priority':_0x1bd0de[_0x9d1f('0xa7')][_0x9d1f('0x51')]+0x1,'app':_0x9d1f('0xb7'),'appdata':_0x9d1f('0xb8'),'interval':_0x9d1f('0xb9')});}}return db[_0x9d1f('0xba')][_0x9d1f('0x61')]({'body':_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0x62')],'ChatWebsiteId':_0xc9982e[_0x9d1f('0x5f')]['id'],'ChatInteractionId':_0x63be26['id'],'direction':'in','ContactId':_0x1bd0de[_0x9d1f('0xad')]['id'],'AttachmentId':_0xc9982e[_0x9d1f('0x62')][_0x9d1f('0xbb')]});})[_0x9d1f('0x2a')](function(_0x3c78ea){_0x1bd0de[_0x9d1f('0x1e')]=_0x3c78ea;if(!_0x1bd0de[_0x9d1f('0xb4')][_0x9d1f('0xbc')]){return;}return db[_0x9d1f('0xbd')]['find']({'attributes':['id',_0x9d1f('0x2e')],'where':{'id':_0x1bd0de[_0x9d1f('0xb4')][_0x9d1f('0xbc')]}});})[_0x9d1f('0x2a')](function(_0x5199e1){if(_0x5199e1){_0x1bd0de[_0x9d1f('0xa7')][_0x9d1f('0xbe')]({'id':0x0,'priority':0x0,'app':_0x9d1f('0xbf'),'appdata':_0x5199e1[_0x9d1f('0x2e')]+','+(_0x1bd0de[_0x9d1f('0xaa')][_0x9d1f('0xc0')]||0xa),'interval':_0x9d1f('0xb9')});_0x1bd0de['forcedOwnership']=!![];}if(!_0x1bd0de[_0x9d1f('0xb4')][_0x9d1f('0xc1')]){return;}return db['ChatQueue']['find']({'attributes':['id','name'],'where':{'id':_0x1bd0de[_0x9d1f('0xb4')]['queueId']}});})[_0x9d1f('0x2a')](function(_0x5e62c9){if(_0x5e62c9){_0x1bd0de[_0x9d1f('0xa7')][_0x9d1f('0xbe')]({'id':0x0,'priority':0x1,'app':_0x9d1f('0xc2'),'appdata':_0x5e62c9['name']+','+(_0x1bd0de['account'][_0x9d1f('0xc3')]||0x12c),'interval':_0x9d1f('0xb9')});}return respondWithRpcPromise('Start','startRouting',_0x1bd0de);})[_0x9d1f('0x2a')](function(_0x423fee){respondWithRpcPromise(_0x9d1f('0xc4'),'EventManager',{'event':_0x9d1f('0x96'),'message':_0x423fee},client9002);return _0x423fee;})[_0x9d1f('0x2a')](respondWithResult(_0x1af568,null))['catch'](APIHandleError(_0x1af568));};exports[_0x9d1f('0xc5')]=function(_0x4dbd09,_0xd6bc77){var _0x1fe7ad,_0x39bad0,_0x405f1c;var _0x1177b2=[];var _0x39268e={};var _0x3ea968=_0x4dbd09['files']||[];var _0x2dcff4=[];var _0x10f1bb;return db[_0x9d1f('0xa1')][_0x9d1f('0x6f')]()[_0x9d1f('0x2a')](function(_0x5e82fb){if(!_0x5e82fb){throw new db[(_0x9d1f('0xc6'))][(_0x9d1f('0xc7'))]('no\x20available\x20attributes');}_0x1177b2=_['difference'](_[_0x9d1f('0x4c')](_0x5e82fb),[_0x9d1f('0x9b'),_0x9d1f('0x9d'),_0x9d1f('0xc8'),_0x9d1f('0x9e')]);if(_0x4dbd09[_0x9d1f('0x62')]['id']){delete _0x4dbd09[_0x9d1f('0x62')]['id'];}if(_[_0x9d1f('0x89')](_0x4dbd09[_0x9d1f('0x62')][_0x9d1f('0x98')])){throw _0xd6bc77[_0x9d1f('0x22')](0x1f4)[_0x9d1f('0x2f')](new db[(_0x9d1f('0xc6'))]['ValidationError'](_0x9d1f('0xc9')));}if(_[_0x9d1f('0x89')](_0x4dbd09['body'][_0x9d1f('0x62')])||_0x4dbd09['body']['body']===''){throw _0xd6bc77[_0x9d1f('0x22')](0x1f4)['send'](new db[(_0x9d1f('0xc6'))][(_0x9d1f('0xc7'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x4dbd09['body'][_0x9d1f('0xca')])){throw _0xd6bc77[_0x9d1f('0x22')](0x1f4)['send'](new db[(_0x9d1f('0xc6'))][(_0x9d1f('0xc7'))](_0x9d1f('0xcb')+_0x1177b2));}if(!_['includes'](_0x1177b2,_0x4dbd09[_0x9d1f('0x62')]['mapKeyOffline'])){throw _0xd6bc77[_0x9d1f('0x22')](0x1f4)[_0x9d1f('0x2f')](new db[(_0x9d1f('0xc6'))][(_0x9d1f('0xc7'))](_0x9d1f('0xcc')+_0x1177b2));}_0x39268e[_0x4dbd09[_0x9d1f('0x62')]['mapKeyOffline']]=_0x4dbd09[_0x9d1f('0x62')][_0x9d1f('0x98')];})[_0x9d1f('0x2a')](function(){return db[_0x9d1f('0x5a')][_0x9d1f('0x60')]({'where':{'id':_0x4dbd09[_0x9d1f('0x5f')]['id']},'include':[{'model':db[_0x9d1f('0xcd')],'as':_0x9d1f('0xa0')},{'model':db[_0x9d1f('0xce')],'as':'MailAccount'}]});})[_0x9d1f('0x2a')](handleEntityNotFound(_0xd6bc77,null))[_0x9d1f('0x2a')](function(_0x4dfeb9){if(_0x4dfeb9&&_0x4dfeb9['List']){_0x39bad0=_0x4dfeb9;var _0x5ba089=_['defaults'](_0x4dbd09[_0x9d1f('0x62')],{'firstName':_0x4dbd09[_0x9d1f('0x62')]['from'],'phone':_0x4dbd09[_0x9d1f('0x62')][_0x9d1f('0x98')],'ListId':_0x4dfeb9[_0x9d1f('0x9e')]});_0x5ba089[_0x4dbd09['body'][_0x9d1f('0xca')]]=_0x4dbd09['body'][_0x9d1f('0x98')];return db['CmContact']['findOrCreate']({'where':_0x39268e,'defaults':_0x5ba089});}})['spread'](function(_0x169c94){if(_0x169c94){_0x405f1c=_0x169c94;var _0x56949b=fs[_0x9d1f('0xcf')](path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],'server/files/templates/chatOfflineMessage.ejs'),_0x9d1f('0xd0'));var _0x1a4025=ejs[_0x9d1f('0xd1')](_0x56949b,{'body':_[_0x9d1f('0xd2')](_0x4dbd09[_0x9d1f('0x62')][_0x9d1f('0x62')]),'bodyTitle':_0x39bad0[_0x9d1f('0xd3')]});return db[_0x9d1f('0xd4')][_0x9d1f('0x61')]({'body':_0x1a4025,'plainBody':htmlToText[_0x9d1f('0xd5')](_0x1a4025),'ContactId':_0x169c94['id'],'ChatWebsiteId':_0x39bad0['id']});}})[_0x9d1f('0x2a')](function(_0x215122){_0x10f1bb=_0x215122;if(_0x3ea968[_0x9d1f('0x51')]){var _0x56ed79=_0x3ea968[_0x9d1f('0x47')](function(_0x1f07a1){return{'name':_0x1f07a1[_0x9d1f('0xd6')],'basename':_0x1f07a1['filename'],'type':_0x1f07a1[_0x9d1f('0xd7')],'ChatOfflineMessageId':_0x215122['id']};});_0x2dcff4=_0x56ed79[_0x9d1f('0x47')](_0x88f799=>{var _0x5a383b={'filename':_0x88f799[_0x9d1f('0x2e')],'path':path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],_0x9d1f('0xd8'),_0x9d1f('0xd9'),_0x9d1f('0xda'),_0x9d1f('0xdb'),_0x88f799[_0x9d1f('0xdc')])};return _0x5a383b;});if(!_0x39bad0[_0x9d1f('0xdd')]){return db[_0x9d1f('0xde')][_0x9d1f('0xdf')](function(_0x56903d){return db[_0x9d1f('0xe0')][_0x9d1f('0xe1')](_0x56ed79,{'transaction':_0x56903d});});}}})['then'](function(){if(_0x10f1bb){_0x1fe7ad=_0x10f1bb;return db[_0x9d1f('0xce')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x9d1f('0xe2')],'as':_0x9d1f('0xe3'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x9d1f('0x2a')](function(_0xf8b77b){if(_0xf8b77b&&_0xf8b77b[_0x9d1f('0xe3')]&&_0x39bad0[_0x9d1f('0xe4')]&&_0x39bad0[_0x9d1f('0xe5')]){var _0x3770e9=_0xf8b77b[_0x9d1f('0xe6')]();return respondWithRpcPromise(_0x9d1f('0xe7'),'sendMail',{'account':_0x3770e9,'message':{'from':util['format'](_0x9d1f('0xe8'),_0xf8b77b[_0x9d1f('0x2e')],_0xf8b77b[_0x9d1f('0xe9')]||_0xf8b77b[_0x9d1f('0xe3')][_0x9d1f('0x66')]),'to':_0x39bad0[_0x9d1f('0xe5')],'subject':_0x39bad0[_0x9d1f('0xea')],'html':_0x1fe7ad[_0x9d1f('0x62')],'attachments':_0x2dcff4}},client9003)[_0x9d1f('0x2a')](function(){return _0x1fe7ad;})['catch'](function(_0x473e32){logger[_0x9d1f('0x1c')](_0x473e32);});}})[_0x9d1f('0x2a')](function(){if(_0x39bad0&&_0x39bad0[_0x9d1f('0xdd')]&&_0x39bad0['MailAccountId']){var _0x29e4ef=[];if(_0x3ea968[_0x9d1f('0x51')]){_0x29e4ef=_0x3ea968[_0x9d1f('0x47')](function(_0x4ebac1){return{'name':_0x4ebac1[_0x9d1f('0xd6')],'basename':_0x4ebac1[_0x9d1f('0x7f')],'type':_0x4ebac1['mimetype'],'ChatOfflineMessageId':_0x10f1bb['id']};});}var _0x5d0d45;if(!_[_0x9d1f('0x89')](_0x39bad0[_0x9d1f('0xeb')])){var _0x35d3c6=_[_0x9d1f('0x47')](_0x4dbd09[_0x9d1f('0x62')],function(_0x54f661){return _0x54f661;});var _0x4cf74d=_[_0x9d1f('0xec')](_0x35d3c6)[0x0];var _0x1fb240=_['mapValues'](_0x4cf74d,function(_0x3b803d){return _0x3b803d;});_0x5d0d45=_0x1fb240[0x1][_0x39bad0['subjectOffline']];}var _0x22ff0b={'from':_0x405f1c['email'],'firstName':_0x405f1c[_0x9d1f('0x38')],'lastName':_0x405f1c['lastName'],'mapKey':'email','message':{'from':_0x405f1c[_0x9d1f('0xe9')],'to':_0x39bad0[_0x9d1f('0xce')][_0x9d1f('0xe9')],'cc':'','subject':_['isNil'](_0x5d0d45)?_0x39bad0['offlineMessageSubject']:_0x5d0d45,'messageId':'','sentAt':new Date(),'attach':_0x29e4ef[_0x9d1f('0x51')],'attachments':_0x29e4ef,'originChannel':'Chat','ChatWebsiteId':_0x39bad0['id'],'ChatOfflineMessageId':_0x1fe7ad['id'],'originTo':_0x39bad0[_0x9d1f('0xce')][_0x9d1f('0xe9')]},'body':_0x1fe7ad[_0x9d1f('0x62')]};var _0x25783f={'account':{'id':_0x39bad0['MailAccountId']},'body':_0x22ff0b,'log':_0x9d1f('0xed')};return respondWithRpcPromise('NotifyMailAccount',_0x9d1f('0xee'),_0x25783f,client9001)[_0x9d1f('0x2a')](function(){return _0x1fe7ad;})[_0x9d1f('0x20')](function(_0xb08ad3){logger[_0x9d1f('0x1c')](_0xb08ad3);});}return;})[_0x9d1f('0x2a')](function(){if(_0x1fe7ad){return _0x1fe7ad;}})['then'](respondWithResult(_0xd6bc77,null))[_0x9d1f('0x20')](function(){for(var _0x301201 of _0x3ea968){var _0x51d841=path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],_0x9d1f('0xd8'),_0x9d1f('0xd9'),'attachments',_0x9d1f('0xdb'),_0x301201[_0x9d1f('0x7f')]);fs_extra[_0x9d1f('0xef')](_0x51d841)[_0x9d1f('0x20')](function(_0x567f84){logger[_0x9d1f('0x1c')]('Could\x20not\x20remove\x20attachment\x20file',_0x51d841,_0x567f84);});}});};exports[_0x9d1f('0xf0')]=function(_0x2db706,_0x3a692b){return db[_0x9d1f('0xb3')][_0x9d1f('0x60')]({'where':{'id':_0x2db706[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x3a692b,null))[_0x9d1f('0x2a')](function(_0x158db9){if(_0x158db9){return _0x158db9[_0x9d1f('0xf0')](_0x2db706['body']['ids'],_[_0x9d1f('0xf1')](_0x2db706['body'],[_0x9d1f('0x7b'),'id'])||{});}})[_0x9d1f('0x2a')](respondWithResult(_0x3a692b,null))[_0x9d1f('0x20')](handleError(_0x3a692b,null));};exports[_0x9d1f('0xf2')]=function(_0x29aa43,_0x96d4c3){var _0x111cf0={'raw':![],'where':{}};var _0x66632e={};var _0x262b24={'count':0x0,'rows':[]};return db[_0x9d1f('0x5a')][_0x9d1f('0x74')]({'where':{'id':_0x29aa43[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x96d4c3,null))['then'](function(_0x4508e1){if(_0x4508e1){_0x66632e[_0x9d1f('0x41')]=_['keys'](db[_0x9d1f('0xb3')][_0x9d1f('0x48')]);_0x66632e['query']=_['keys'](_0x29aa43[_0x9d1f('0x4b')]);_0x66632e[_0x9d1f('0x4d')]=_[_0x9d1f('0x4e')](_0x66632e[_0x9d1f('0x41')],_0x66632e[_0x9d1f('0x4b')]);_0x111cf0[_0x9d1f('0x50')]=_['intersection'](_0x66632e['model'],qs[_0x9d1f('0x4f')](_0x29aa43['query'][_0x9d1f('0x4f')]));_0x111cf0[_0x9d1f('0x50')]=_0x111cf0[_0x9d1f('0x50')]['length']?_0x111cf0['attributes']:_0x66632e[_0x9d1f('0x41')];if(!_0x29aa43[_0x9d1f('0x4b')][_0x9d1f('0x75')]('nolimit')){_0x111cf0[_0x9d1f('0x53')]=qs[_0x9d1f('0x53')](_0x29aa43[_0x9d1f('0x4b')][_0x9d1f('0x53')]);_0x111cf0[_0x9d1f('0x23')]=qs['offset'](_0x29aa43['query'][_0x9d1f('0x23')]);}_0x111cf0[_0x9d1f('0x54')]=qs['sort'](_0x29aa43[_0x9d1f('0x4b')][_0x9d1f('0x55')]);_0x111cf0[_0x9d1f('0x56')]=qs[_0x9d1f('0x4d')](_[_0x9d1f('0x76')](_0x29aa43[_0x9d1f('0x4b')],_0x66632e[_0x9d1f('0x4d')]));_0x111cf0['where'][_0x9d1f('0x71')]=_0x4508e1['id'];if(_0x29aa43[_0x9d1f('0x4b')][_0x9d1f('0x58')]){_0x111cf0[_0x9d1f('0x56')]=_['merge'](_0x111cf0[_0x9d1f('0x56')],{'$or':_['map'](_0x111cf0[_0x9d1f('0x50')],function(_0x5bb89b){var _0x46d3bc={};_0x46d3bc[_0x5bb89b]={'$like':'%'+_0x29aa43[_0x9d1f('0x4b')]['filter']+'%'};return _0x46d3bc;})});}_0x111cf0=_['merge']({},_0x111cf0,_0x29aa43[_0x9d1f('0x59')]);return db['ChatInteraction'][_0x9d1f('0x25')]({'where':_0x111cf0['where']})[_0x9d1f('0x2a')](function(_0x18b1a6){_0x262b24[_0x9d1f('0x25')]=_0x18b1a6;if(_0x29aa43[_0x9d1f('0x4b')][_0x9d1f('0x5b')]){_0x111cf0[_0x9d1f('0x5c')]=[{'model':db[_0x9d1f('0xa1')],'as':_0x9d1f('0xf3'),'required':![]},{'model':db[_0x9d1f('0xbd')],'as':'Owner','attributes':[_0x9d1f('0x2e'),_0x9d1f('0xf4'),_0x9d1f('0xf5')],'required':![]},{'model':db[_0x9d1f('0xf6')],'as':_0x9d1f('0xf7'),'attributes':['id',_0x9d1f('0x2e'),_0x9d1f('0xf8')],'where':_0x29aa43[_0x9d1f('0x4b')][_0x9d1f('0xf9')]?{'id':_0x29aa43['query'][_0x9d1f('0xf9')]}:undefined,'required':_0x29aa43[_0x9d1f('0x4b')]['tag']?!![]:![]}];}return db[_0x9d1f('0xb3')][_0x9d1f('0x5d')](_0x111cf0);})[_0x9d1f('0x2a')](function(_0x37d861){_0x262b24[_0x9d1f('0x5e')]=_0x37d861;return _0x262b24;});}})[_0x9d1f('0x2a')](respondWithFilteredResult(_0x96d4c3,_0x111cf0))[_0x9d1f('0x20')](handleError(_0x96d4c3,null));};exports[_0x9d1f('0xfa')]=function(_0x55c9e9,_0x51ad57){var _0x35da77=0x0;var _0x38f358=0x0;var _0x2ec814=![];var _0x203bea;var _0x3d6384;return db[_0x9d1f('0x5a')]['find']({'where':{'id':_0x55c9e9[_0x9d1f('0x5f')]['id']},'include':[{'model':db[_0x9d1f('0x92')],'as':_0x9d1f('0x92'),'include':[{'model':db[_0x9d1f('0x92')],'as':_0x9d1f('0xfb'),'attributes':['id',_0x9d1f('0xa5')]}]}]})['then'](handleEntityNotFound(_0x51ad57,null))[_0x9d1f('0x2a')](function(_0x4fcff2){if(_0x4fcff2){_0x203bea=_0x4fcff2;return _0x4fcff2[_0x9d1f('0xfc')]({'raw':!![]});}})[_0x9d1f('0x2a')](function(_0x1d54c4){if(_0x203bea){if(_0x1d54c4){_0x3d6384=_0x1d54c4;}}return require(_0x9d1f('0x86'))[_0x9d1f('0x87')]();})[_0x9d1f('0x2a')](function(_0x353f65){if(_0x353f65){_0x38f358=_0x353f65[_0x9d1f('0xfd')];_0x2ec814=_0x353f65[_0x9d1f('0x88')];}})['then'](function(){return db[_0x9d1f('0xb3')][_0x9d1f('0x25')]({'where':{'closed':![]}});})['then'](function(_0x36f200){_0x35da77=_0x36f200;if(_0x38f358&&_0x36f200>_0x38f358){return db[_0x9d1f('0xfe')]['findOne']({'where':{'id':0x1}})[_0x9d1f('0x2a')](function(_0x3171b7){if(_0x3171b7){_0x3171b7[_0x9d1f('0xff')]('chatLicenseExceeded');}});}})[_0x9d1f('0x2a')](function(){var _0x39059d=_0x203bea['Interval'];var _0x28594b=_0x203bea['timezone']||undefined;return _0x39059d?_0x39059d['ifTime'](_0x28594b):!![];})['then'](function(_0x36b647){var _0x85cca8=fs[_0x9d1f('0xcf')](path[_0x9d1f('0x84')](config[_0x9d1f('0x8b')],_0x9d1f('0x100')),_0x9d1f('0xd0'));var _0x354984='3.9.0';var _0x471fcb=![];var _0x265067,_0x2e665c;if(_0x55c9e9[_0x9d1f('0xae')][_0x9d1f('0x3a')]){_0x265067=new URL(_0x55c9e9['headers'][_0x9d1f('0x3a')])[_0x9d1f('0x101')];}else if(_0x55c9e9['headers'][_0x9d1f('0x101')]){_0x265067=new URL(_0x55c9e9[_0x9d1f('0xae')][_0x9d1f('0x101')])['origin'];}else{_0x265067=_0x9d1f('0x102');}_0x2e665c=typeof _0x203bea[_0x9d1f('0x6c')][_0x9d1f('0x63')](',')[_0x9d1f('0x60')](function(_0x47d7d7){return wildcardUtils[_0x9d1f('0x103')](_0x47d7d7,_0x265067);})!==_0x9d1f('0x24');var _0x16fdde={'chatVersion':_0x354984,'chatWebsiteAddressOrigin':_0x2e665c?_0x265067:_0x203bea[_0x9d1f('0x6c')],'remote':_0x203bea['remote'],'query':querystring['stringify'](_[_0x9d1f('0x57')](_0x203bea[_0x9d1f('0x67')]({'plain':!![]}),{'customerIp':_0x55c9e9[_0x9d1f('0xae')][_0x9d1f('0x36')]||_0x55c9e9['headers'][_0x9d1f('0x104')]||_0x55c9e9[_0x9d1f('0x105')]['remoteAddress']||_0x55c9e9['ip'],'referer':_0x55c9e9[_0x9d1f('0xae')][_0x9d1f('0x3a')],'openedInteractions':_0x35da77,'maxInteractions':_0x38f358,'virtual':_0x2ec814[_0x9d1f('0xfd')],'online':_0x36b647,'custom':_0x2ec814,'address':_0x2e665c?_0x265067:null}))[_0x9d1f('0x106')](/'/g,'\x5c\x27')};_0x51ad57[_0x9d1f('0x2f')](ejs[_0x9d1f('0xd1')](Mustache[_0x9d1f('0xd1')](_0x85cca8,_0x16fdde),{'proactiveActions':_0x3d6384,'alignment':_0x203bea[_0x9d1f('0x107')],'verticalAlignment':_0x203bea['verticalAlignment'],'div_color':_0x203bea[_0x9d1f('0xf8')],'labelText':_0x203bea[_0x9d1f('0x108')],'text_color':_0x203bea[_0x9d1f('0x109')],'text_button_color':_0x203bea[_0x9d1f('0x10a')],'button_color':_0x203bea[_0x9d1f('0x10b')],'background_color':_0x203bea[_0x9d1f('0x10c')],'hideWhenOffline':_0x203bea[_0x9d1f('0x10d')],'intervalId':_0x203bea[_0x9d1f('0x10e')],'isDevelopment':_0x471fcb,'chatVersion':_0x354984}));})[_0x9d1f('0x20')](handleError(_0x51ad57,null));};exports[_0x9d1f('0x10f')]=function(_0x280ce5,_0x464266){var _0x3831f7=_0x280ce5[_0x9d1f('0x5f')]['id'];var _0x3454f0=_0x280ce5[_0x9d1f('0x62')];var _0x2ab4dc=0xc8;var _0x5404ac=null;return db[_0x9d1f('0xde')][_0x9d1f('0xdf')]({'isolationLevel':db[_0x9d1f('0xde')][_0x9d1f('0x110')][_0x9d1f('0x111')][_0x9d1f('0x112')]},function(_0x1beb64){return db[_0x9d1f('0x5a')][_0x9d1f('0x74')]({'where':{'id':_0x3831f7},'transaction':_0x1beb64})[_0x9d1f('0x2a')](function(_0x4518eb){if(_0x4518eb){return db[_0x9d1f('0xa3')][_0x9d1f('0x2b')]({'where':{'ChatWebsiteId':_0x3831f7},'transaction':_0x1beb64})['then'](function(){var _0x5929f5=_[_0x9d1f('0x47')](_0x3454f0,function(_0x519488){_0x519488['ChatWebsiteId']=_0x3831f7;return _0x519488;});return db[_0x9d1f('0xa3')][_0x9d1f('0xe1')](_0x5929f5,{'transaction':_0x1beb64});});}else{_0x2ab4dc=0x194;_0x5404ac=[];}});})[_0x9d1f('0x2a')](function(){if(_0x2ab4dc!==0x194){return db[_0x9d1f('0xa3')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x3831f7},'order':'priority'})['then'](function(_0x4b6538){_0x5404ac=_0x4b6538;});}})[_0x9d1f('0x20')](function(_0x28deca){_0x2ab4dc=0x1f4;logger[_0x9d1f('0x1c')](_0x28deca[_0x9d1f('0x2d')]);if(_0x28deca[_0x9d1f('0x2e')]){delete _0x28deca['name'];}_0x5404ac=_0x28deca;})[_0x9d1f('0x113')](function(){if(_0x5404ac===null){_0x464266['sendStatus'](_0x2ab4dc);}else{if(_0x2ab4dc===0x1f4){_0x464266['status'](_0x2ab4dc)[_0x9d1f('0x2f')](_0x5404ac);}else{_0x464266[_0x9d1f('0x22')](_0x2ab4dc)[_0x9d1f('0x28')](_0x5404ac);}}});};exports[_0x9d1f('0x114')]=function(_0x2f4a26,_0x39e889){var _0x4e0488={};var _0x34ba7d={};var _0x2f3c48;var _0x5c48d5;return db[_0x9d1f('0x5a')][_0x9d1f('0x74')]({'where':{'id':_0x2f4a26[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x39e889,null))[_0x9d1f('0x2a')](function(_0x4e5d2b){if(_0x4e5d2b){_0x2f3c48=_0x4e5d2b;_0x34ba7d[_0x9d1f('0x41')]=_[_0x9d1f('0x4c')](db['ChatApplication'][_0x9d1f('0x48')]);_0x34ba7d['query']=_['keys'](_0x2f4a26[_0x9d1f('0x4b')]);_0x34ba7d[_0x9d1f('0x4d')]=_[_0x9d1f('0x4e')](_0x34ba7d[_0x9d1f('0x41')],_0x34ba7d[_0x9d1f('0x4b')]);_0x4e0488[_0x9d1f('0x50')]=_['intersection'](_0x34ba7d[_0x9d1f('0x41')],qs[_0x9d1f('0x4f')](_0x2f4a26['query']['fields']));_0x4e0488[_0x9d1f('0x50')]=_0x4e0488[_0x9d1f('0x50')][_0x9d1f('0x51')]?_0x4e0488[_0x9d1f('0x50')]:_0x34ba7d['model'];_0x4e0488['order']=qs[_0x9d1f('0x55')](_0x2f4a26['query'][_0x9d1f('0x55')]);_0x4e0488['where']=qs['filters'](_[_0x9d1f('0x76')](_0x2f4a26[_0x9d1f('0x4b')],_0x34ba7d[_0x9d1f('0x4d')]));if(_0x2f4a26['query']['filter']){_0x4e0488['where']=_[_0x9d1f('0x57')](_0x4e0488[_0x9d1f('0x56')],{'$or':_[_0x9d1f('0x47')](_0x4e0488[_0x9d1f('0x50')],function(_0x329eff){var _0x3e0294={};_0x3e0294[_0x329eff]={'$like':'%'+_0x2f4a26[_0x9d1f('0x4b')][_0x9d1f('0x58')]+'%'};return _0x3e0294;})});}_0x4e0488=_[_0x9d1f('0x57')]({},_0x4e0488,_0x2f4a26[_0x9d1f('0x59')]);return _0x2f3c48['getApplications'](_0x4e0488);}})[_0x9d1f('0x2a')](function(_0x232cbd){if(_0x232cbd){_0x5c48d5=_0x232cbd[_0x9d1f('0x51')];if(!_0x2f4a26[_0x9d1f('0x4b')][_0x9d1f('0x75')](_0x9d1f('0x52'))){_0x4e0488[_0x9d1f('0x53')]=qs['limit'](_0x2f4a26['query'][_0x9d1f('0x53')]);_0x4e0488[_0x9d1f('0x23')]=qs[_0x9d1f('0x23')](_0x2f4a26[_0x9d1f('0x4b')][_0x9d1f('0x23')]);}return _0x2f3c48[_0x9d1f('0x114')](_0x4e0488);}})['then'](function(_0xb0569a){if(_0xb0569a){return _0xb0569a?{'count':_0x5c48d5,'rows':_0xb0569a}:null;}})[_0x9d1f('0x2a')](respondWithResult(_0x39e889,null))[_0x9d1f('0x20')](handleError(_0x39e889,null));};exports[_0x9d1f('0x115')]=function(_0x541a4f,_0x3e1bda){return db['chatProactiveAction'][_0x9d1f('0x60')]({'where':{'id':_0x541a4f[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x3e1bda,null))['then'](function(_0x57f1f3){if(_0x57f1f3){return _0x57f1f3['addProactiveActions'](_0x541a4f['body'][_0x9d1f('0x7b')],_['omit'](_0x541a4f[_0x9d1f('0x62')],[_0x9d1f('0x7b'),'id'])||{});}})['then'](respondWithResult(_0x3e1bda,null))[_0x9d1f('0x20')](handleError(_0x3e1bda,null));};exports['getProactiveActions']=function(_0x20d2af,_0x32286f){var _0x352257={};var _0x1d7832={};var _0x932ea5;var _0x39bb32;return db[_0x9d1f('0x5a')][_0x9d1f('0x74')]({'where':{'id':_0x20d2af[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x32286f,null))[_0x9d1f('0x2a')](function(_0x53d5c1){if(_0x53d5c1){_0x932ea5=_0x53d5c1;_0x1d7832['model']=_['keys'](db[_0x9d1f('0x116')][_0x9d1f('0x48')]);_0x1d7832[_0x9d1f('0x4b')]=_[_0x9d1f('0x4c')](_0x20d2af[_0x9d1f('0x4b')]);_0x1d7832[_0x9d1f('0x4d')]=_[_0x9d1f('0x4e')](_0x1d7832[_0x9d1f('0x41')],_0x1d7832[_0x9d1f('0x4b')]);_0x352257[_0x9d1f('0x50')]=_[_0x9d1f('0x4e')](_0x1d7832['model'],qs['fields'](_0x20d2af['query'][_0x9d1f('0x4f')]));_0x352257[_0x9d1f('0x50')]=_0x352257[_0x9d1f('0x50')][_0x9d1f('0x51')]?_0x352257['attributes']:_0x1d7832[_0x9d1f('0x41')];_0x352257[_0x9d1f('0x54')]=qs['sort'](_0x20d2af[_0x9d1f('0x4b')]['sort']);_0x352257['where']=qs[_0x9d1f('0x4d')](_['pick'](_0x20d2af[_0x9d1f('0x4b')],_0x1d7832[_0x9d1f('0x4d')]));if(_0x20d2af[_0x9d1f('0x4b')][_0x9d1f('0x58')]){_0x352257[_0x9d1f('0x56')]=_[_0x9d1f('0x57')](_0x352257[_0x9d1f('0x56')],{'$or':_[_0x9d1f('0x47')](_0x352257['attributes'],function(_0x212dbf){var _0x2c5be4={};_0x2c5be4[_0x212dbf]={'$like':'%'+_0x20d2af[_0x9d1f('0x4b')][_0x9d1f('0x58')]+'%'};return _0x2c5be4;})});}_0x352257=_[_0x9d1f('0x57')]({},_0x352257,_0x20d2af[_0x9d1f('0x59')]);return _0x932ea5[_0x9d1f('0xfc')](_0x352257);}})[_0x9d1f('0x2a')](function(_0x394148){if(_0x394148){_0x39bb32=_0x394148[_0x9d1f('0x51')];if(!_0x20d2af['query'][_0x9d1f('0x75')](_0x9d1f('0x52'))){_0x352257[_0x9d1f('0x53')]=qs[_0x9d1f('0x53')](_0x20d2af['query'][_0x9d1f('0x53')]);_0x352257[_0x9d1f('0x23')]=qs[_0x9d1f('0x23')](_0x20d2af[_0x9d1f('0x4b')][_0x9d1f('0x23')]);}return _0x932ea5[_0x9d1f('0xfc')](_0x352257);}})[_0x9d1f('0x2a')](function(_0x173717){if(_0x173717){return _0x173717?{'count':_0x39bb32,'rows':_0x173717}:null;}})[_0x9d1f('0x2a')](respondWithResult(_0x32286f,null))[_0x9d1f('0x20')](handleError(_0x32286f,null));};exports[_0x9d1f('0x117')]=function(_0x3b7cf7,_0x543c69){var _0x3f5fcf=_0x3b7cf7[_0x9d1f('0x4b')][_0x9d1f('0x118')]===_0x9d1f('0x119')?_0x9d1f('0x11a'):_0x9d1f('0x11b');return db['ChatWebsite'][_0x9d1f('0x60')]({'attributes':['id',_0x3f5fcf],'where':{'id':_0x3b7cf7['params']['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x543c69,null))[_0x9d1f('0x2a')](function(_0x42442f){if(_0x42442f){var _0x4606be=_0x42442f[_0x3f5fcf];var _0x4b1ea8=_0x4606be&&_0x4606be[_0x9d1f('0x11c')]?_0x4606be[_0x9d1f('0x11c')]:[];_0x543c69[_0x9d1f('0x2f')]({'fromKey':_['isNil'](_0x4606be[_0x9d1f('0x11d')])?undefined:_0x4606be[_0x9d1f('0x11d')],'count':_0x4b1ea8[_0x9d1f('0x51')],'rows':_0x4b1ea8});}})['catch'](handleError(_0x543c69,null));};exports[_0x9d1f('0x11e')]=function(_0x4586b2,_0xc9d848){var _0xe71551={'raw':![],'where':{}};var _0x421ba9={};var _0x2f26cd={'count':0x0,'rows':[]};return db[_0x9d1f('0x5a')][_0x9d1f('0x74')]({'where':{'id':_0x4586b2[_0x9d1f('0x5f')]['id']}})['then'](handleEntityNotFound(_0xc9d848,null))[_0x9d1f('0x2a')](function(_0x231e36){if(_0x231e36){_0x421ba9['model']=_['keys'](db[_0x9d1f('0xd4')][_0x9d1f('0x48')]);_0x421ba9[_0x9d1f('0x4b')]=_[_0x9d1f('0x4c')](_0x4586b2[_0x9d1f('0x4b')]);_0x421ba9[_0x9d1f('0x4d')]=_[_0x9d1f('0x4e')](_0x421ba9[_0x9d1f('0x41')],_0x421ba9[_0x9d1f('0x4b')]);_0xe71551[_0x9d1f('0x50')]=_[_0x9d1f('0x4e')](_0x421ba9[_0x9d1f('0x41')],qs[_0x9d1f('0x4f')](_0x4586b2['query'][_0x9d1f('0x4f')]));_0xe71551[_0x9d1f('0x50')]=_0xe71551['attributes']['length']?_0xe71551['attributes']:_0x421ba9[_0x9d1f('0x41')];if(!_0x4586b2[_0x9d1f('0x4b')]['hasOwnProperty']('nolimit')){_0xe71551[_0x9d1f('0x53')]=qs[_0x9d1f('0x53')](_0x4586b2[_0x9d1f('0x4b')][_0x9d1f('0x53')]);_0xe71551[_0x9d1f('0x23')]=qs['offset'](_0x4586b2[_0x9d1f('0x4b')][_0x9d1f('0x23')]);}_0xe71551['order']=qs[_0x9d1f('0x55')](_0x4586b2[_0x9d1f('0x4b')][_0x9d1f('0x55')]);_0xe71551[_0x9d1f('0x56')]=qs[_0x9d1f('0x4d')](_[_0x9d1f('0x76')](_0x4586b2['query'],_0x421ba9[_0x9d1f('0x4d')]));_0xe71551[_0x9d1f('0x56')][_0x9d1f('0x71')]=_0x231e36['id'];if(_0x4586b2[_0x9d1f('0x4b')][_0x9d1f('0x58')]){_0xe71551[_0x9d1f('0x56')]=_[_0x9d1f('0x57')](_0xe71551[_0x9d1f('0x56')],{'$or':_['map'](_0xe71551['attributes'],function(_0x1b7a6c){var _0x3ce6fd={};_0x3ce6fd[_0x1b7a6c]={'$like':'%'+_0x4586b2[_0x9d1f('0x4b')][_0x9d1f('0x58')]+'%'};return _0x3ce6fd;})});}_0xe71551=_[_0x9d1f('0x57')]({},_0xe71551,_0x4586b2[_0x9d1f('0x59')]);return db[_0x9d1f('0xd4')][_0x9d1f('0x25')]({'where':_0xe71551[_0x9d1f('0x56')]})[_0x9d1f('0x2a')](function(_0xc049d7){_0x2f26cd['count']=_0xc049d7;if(_0x4586b2[_0x9d1f('0x4b')][_0x9d1f('0x5b')]){_0xe71551[_0x9d1f('0x5c')]=[{'all':!![]}];}else{_0xe71551[_0x9d1f('0x5c')]=[{'model':db[_0x9d1f('0xa1')],'as':_0x9d1f('0xf3'),'required':![]},{'model':db[_0x9d1f('0xe0')],'as':_0x9d1f('0x11f'),'required':![]}];}return db['ChatOfflineMessage'][_0x9d1f('0x5d')](_0xe71551);})['then'](function(_0x2488db){_0x2f26cd[_0x9d1f('0x5e')]=_0x2488db;return _0x2f26cd;});}})[_0x9d1f('0x2a')](respondWithFilteredResult(_0xc9d848,_0xe71551))[_0x9d1f('0x20')](handleError(_0xc9d848,null));};exports[_0x9d1f('0x120')]=function(_0x2c29b6,_0x5558da){return db[_0x9d1f('0x5a')][_0x9d1f('0x60')]({'where':{'id':_0x2c29b6['params']['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x5558da,null))[_0x9d1f('0x2a')](function(_0x192c4f){if(_0x192c4f){return _0x192c4f[_0x9d1f('0x120')](_0x2c29b6[_0x9d1f('0x62')][_0x9d1f('0x7b')],_['omit'](_0x2c29b6[_0x9d1f('0x62')],[_0x9d1f('0x7b'),'id'])||{})['spread'](function(_0x3d9674){for(var _0x3a8322=0x0;_0x3a8322<_0x2c29b6[_0x9d1f('0x62')]['ids']['length'];_0x3a8322+=0x1){socket[_0x9d1f('0x121')](_0x9d1f('0x122'),{'UserId':Number(_0x2c29b6[_0x9d1f('0x62')][_0x9d1f('0x7b')][_0x3a8322]),'ChatWebsiteId':Number(_0x2c29b6[_0x9d1f('0x5f')]['id'])});}return _0x3d9674;});}})[_0x9d1f('0x2a')](respondWithResult(_0x5558da,null))[_0x9d1f('0x20')](handleError(_0x5558da,null));};exports[_0x9d1f('0x123')]=function(_0x52dbef,_0x12a1d6){return db[_0x9d1f('0x5a')][_0x9d1f('0x60')]({'where':{'id':_0x52dbef[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x12a1d6,null))[_0x9d1f('0x2a')](function(_0x4e4766){if(_0x4e4766){return _0x4e4766[_0x9d1f('0x123')](_0x52dbef[_0x9d1f('0x4b')][_0x9d1f('0x7b')])[_0x9d1f('0x2a')](function(){if(_[_0x9d1f('0x124')](_0x52dbef[_0x9d1f('0x4b')][_0x9d1f('0x7b')])){for(var _0x4bfbc1=0x0;_0x4bfbc1<_0x52dbef[_0x9d1f('0x4b')][_0x9d1f('0x7b')][_0x9d1f('0x51')];_0x4bfbc1+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x52dbef['query']['ids'][_0x4bfbc1]),'ChatWebsiteId':Number(_0x52dbef['params']['id'])});}}else{socket[_0x9d1f('0x121')](_0x9d1f('0x125'),{'UserId':Number(_0x52dbef['query']['ids']),'ChatWebsiteId':Number(_0x52dbef['params']['id'])});}});}})[_0x9d1f('0x2a')](respondWithStatusCode(_0x12a1d6,null))[_0x9d1f('0x20')](handleError(_0x12a1d6,null));};exports[_0x9d1f('0x126')]=function(_0x291989,_0x420465){var _0x47d3d1={};var _0x10b029={};var _0xdcc107;var _0x286e29;return db['ChatWebsite']['findOne']({'where':{'id':_0x291989[_0x9d1f('0x5f')]['id']}})[_0x9d1f('0x2a')](handleEntityNotFound(_0x420465,null))[_0x9d1f('0x2a')](function(_0x27218a){if(_0x27218a){_0xdcc107=_0x27218a;_0x10b029[_0x9d1f('0x41')]=_[_0x9d1f('0x4c')](db[_0x9d1f('0xbd')]['rawAttributes']);_0x10b029['query']=_[_0x9d1f('0x4c')](_0x291989['query']);_0x10b029[_0x9d1f('0x4d')]=_[_0x9d1f('0x4e')](_0x10b029[_0x9d1f('0x41')],_0x10b029['query']);_0x47d3d1[_0x9d1f('0x50')]=_['intersection'](_0x10b029[_0x9d1f('0x41')],qs['fields'](_0x291989['query'][_0x9d1f('0x4f')]));_0x47d3d1['attributes']=_0x47d3d1[_0x9d1f('0x50')][_0x9d1f('0x51')]?_0x47d3d1[_0x9d1f('0x50')]:_0x10b029[_0x9d1f('0x41')];_0x47d3d1[_0x9d1f('0x54')]=qs[_0x9d1f('0x55')](_0x291989['query'][_0x9d1f('0x55')]);_0x47d3d1['where']=qs[_0x9d1f('0x4d')](_[_0x9d1f('0x76')](_0x291989['query'],_0x10b029[_0x9d1f('0x4d')]));if(_0x291989[_0x9d1f('0x4b')][_0x9d1f('0x58')]){_0x47d3d1[_0x9d1f('0x56')]=_[_0x9d1f('0x57')](_0x47d3d1[_0x9d1f('0x56')],{'$or':_[_0x9d1f('0x47')](_0x47d3d1[_0x9d1f('0x50')],function(_0xa65e02){var _0x32342b={};_0x32342b[_0xa65e02]={'$like':'%'+_0x291989[_0x9d1f('0x4b')][_0x9d1f('0x58')]+'%'};return _0x32342b;})});}_0x47d3d1=_['merge']({},_0x47d3d1,_0x291989[_0x9d1f('0x59')]);return _0xdcc107[_0x9d1f('0x126')](_0x47d3d1);}})[_0x9d1f('0x2a')](function(_0x1a876b){if(_0x1a876b){_0x286e29=_0x1a876b[_0x9d1f('0x51')];if(!_0x291989['query'][_0x9d1f('0x75')](_0x9d1f('0x52'))){_0x47d3d1[_0x9d1f('0x53')]=qs[_0x9d1f('0x53')](_0x291989['query'][_0x9d1f('0x53')]);_0x47d3d1[_0x9d1f('0x23')]=qs[_0x9d1f('0x23')](_0x291989[_0x9d1f('0x4b')]['offset']);}return _0xdcc107[_0x9d1f('0x126')](_0x47d3d1);}})[_0x9d1f('0x2a')](function(_0x5a4838){if(_0x5a4838){return _0x5a4838?{'count':_0x286e29,'rows':_0x5a4838}:null;}})[_0x9d1f('0x2a')](respondWithResult(_0x420465,null))[_0x9d1f('0x20')](handleError(_0x420465,null));}; \ No newline at end of file +var _0x1d67=['systemAvatar','timezone','ifTime','chat','from','From\x20is\x20mandatory','mapKey','Body\x20is\x20mandatory','referer','CmContact','createdAt','updatedAt','includes','CompanyId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Contacts','DESC','ChatApplication','Applications','Interval','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','list','List','ListId','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','ChatInteraction','contact','messageId','created','autoclose','push','close','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queueId','queue','Start','startRouting','EventManager','notify','offline','files','ValidationError','no\x20available\x20attributes','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','fromString','originalname','mimetype','attachments','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','toPairsIn','firstName','offlineMessageSubject','NotifyMailAccount','server','offline-chat','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','Intervals','getProactiveActions','getLicense','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','3.9.0','origin','headers','http://localhost:9000','testWebsiteWithWildcard','remote','connection','remoteAddress','replace','render','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','ejs','fs-extra','lodash','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','x-real-port','browser','version','%s\x20%s','unknown','format','model','vendor','%s\x20%s\x20%s','device','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','create','body','address','split','forEach','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','ChatWebsiteId','removeDispositions','ids','CannedAnswer','getAnswers','findOne','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','root','../../config/license/util','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar'];(function(_0x26a33a,_0x21c459){var _0x2cd414=function(_0x49eca3){while(--_0x49eca3){_0x26a33a['push'](_0x26a33a['shift']());}};_0x2cd414(++_0x21c459);}(_0x1d67,0x9f));var _0x71d6=function(_0x9f421a,_0x3bb8d9){_0x9f421a=_0x9f421a-0x0;var _0x2d5046=_0x1d67[_0x9f421a];return _0x2d5046;};'use strict';var Mustache=require(_0x71d6('0x0'));var util=require('util');var path=require('path');var ejs=require(_0x71d6('0x1'));var fs=require('fs');var fs_extra=require(_0x71d6('0x2'));var _=require(_0x71d6('0x3'));var querystring=require('querystring');var htmlToText=require(_0x71d6('0x4'));var Redis=require(_0x71d6('0x5'));var jayson=require(_0x71d6('0x6'));var qs=require(_0x71d6('0x7'));var logger=require(_0x71d6('0x8'))(_0x71d6('0x9'));var config=require(_0x71d6('0xa'));var APIBadRequestError=require(_0x71d6('0xb'))[_0x71d6('0xc')];var APINotFoundError=require('../../errors/api')[_0x71d6('0xd')];var APIOutOfIntervalError=require(_0x71d6('0xb'))[_0x71d6('0xe')];var APIHandleError=require(_0x71d6('0xb'))[_0x71d6('0xf')];var APIConflictError=require(_0x71d6('0xb'))[_0x71d6('0x10')];var wildcardUtils=require(_0x71d6('0x11'));var URL=require(_0x71d6('0x12'))[_0x71d6('0x13')];var db=require(_0x71d6('0x14'))['db'];config[_0x71d6('0x15')]=_[_0x71d6('0x16')](config[_0x71d6('0x15')],{'host':_0x71d6('0x17'),'port':0x18eb});var socket=require(_0x71d6('0x18'))(new Redis(config[_0x71d6('0x15')]));require(_0x71d6('0x19'))[_0x71d6('0x1a')](socket);var client=jayson[_0x71d6('0x1b')][_0x71d6('0x1c')]({'port':0x232c});var client9002=jayson[_0x71d6('0x1b')][_0x71d6('0x1c')]({'port':0x232a});var client9003=jayson[_0x71d6('0x1b')][_0x71d6('0x1c')]({'port':0x232b});var client9001=jayson['client'][_0x71d6('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x473b7e,_0x281a1e,_0x209860,_0x1c0094){return new Promise(function(_0x136c8b,_0x327c37){var _0x501551=_0x1c0094||client;return _0x501551['request'](_0x473b7e,_0x209860)[_0x71d6('0x1d')](function(_0x4668b5){logger[_0x71d6('0x1e')](_0x71d6('0x1f'),_0x281a1e,_0x71d6('0x20'));logger[_0x71d6('0x21')](_0x71d6('0x22'),_0x281a1e,_0x71d6('0x20'),JSON[_0x71d6('0x23')](_0x4668b5));if(_0x4668b5[_0x71d6('0x24')]){if(_0x4668b5[_0x71d6('0x24')][_0x71d6('0x25')]===0x1f4){logger['error'](_0x71d6('0x1f'),_0x281a1e,_0x4668b5['error']['message']);return _0x327c37(_0x4668b5[_0x71d6('0x24')]['message']);}logger[_0x71d6('0x24')](_0x71d6('0x1f'),_0x281a1e,_0x4668b5['error'][_0x71d6('0x26')]);return _0x136c8b(_0x4668b5[_0x71d6('0x24')]['message']);}else{logger[_0x71d6('0x1e')](_0x71d6('0x1f'),_0x281a1e,_0x71d6('0x20'));_0x136c8b(_0x4668b5['result']['message']);}})[_0x71d6('0x27')](function(_0x4728cc){logger[_0x71d6('0x24')](_0x71d6('0x1f'),_0x281a1e,_0x4728cc);_0x327c37(_0x4728cc);});});}function respondWithStatusCode(_0xf2f129,_0xc77d83){_0xc77d83=_0xc77d83||0xcc;return function(_0x104971){if(_0x104971){return _0xf2f129[_0x71d6('0x28')](_0xc77d83);}return _0xf2f129[_0x71d6('0x29')](_0xc77d83)[_0x71d6('0x2a')]();};}function respondWithResult(_0x41adc1,_0x337482){_0x337482=_0x337482||0xc8;return function(_0x4e0027){if(_0x4e0027){return _0x41adc1['status'](_0x337482)[_0x71d6('0x2b')](_0x4e0027);}};}function respondWithFilteredResult(_0x2728d8,_0x3240ab){return function(_0x2d3a73){if(_0x2d3a73){var _0xf50ca=typeof _0x3240ab[_0x71d6('0x2c')]===_0x71d6('0x2d')&&typeof _0x3240ab[_0x71d6('0x2e')]===_0x71d6('0x2d');var _0x13bb07=_0x2d3a73['count'];var _0x9fbf57=_0xf50ca?0x0:_0x3240ab[_0x71d6('0x2c')];var _0x233660=_0xf50ca?_0x2d3a73[_0x71d6('0x2f')]:_0x3240ab[_0x71d6('0x2c')]+_0x3240ab[_0x71d6('0x2e')];var _0x305a32;if(_0x233660>=_0x13bb07){_0x233660=_0x13bb07;_0x305a32=0xc8;}else{_0x305a32=0xce;}_0x2728d8['status'](_0x305a32);return _0x2728d8[_0x71d6('0x30')](_0x71d6('0x31'),_0x9fbf57+'-'+_0x233660+'/'+_0x13bb07)[_0x71d6('0x2b')](_0x2d3a73);}return null;};}function saveUpdates(_0x11d371){return function(_0x39521d){if(_0x39521d){return _0x39521d[_0x71d6('0x32')](_0x11d371)[_0x71d6('0x1d')](function(_0x1bbbf5){return _0x1bbbf5;});}return null;};}function removeEntity(_0x1b7282){return function(_0x378b8c){if(_0x378b8c){return _0x378b8c[_0x71d6('0x33')]()[_0x71d6('0x1d')](function(){var _0x1bcb0d=_0x378b8c[_0x71d6('0x34')]({'plain':!![]});var _0x1627c3='ChatWebsites';return db[_0x71d6('0x35')]['destroy']({'where':{'type':_0x1627c3,'resourceId':_0x1bcb0d['id']}})[_0x71d6('0x1d')](function(){return _0x378b8c;});})[_0x71d6('0x1d')](function(){_0x1b7282['status'](0xcc)[_0x71d6('0x2a')]();});}};}function handleEntityNotFound(_0x22491a){return function(_0xca2e48){if(!_0xca2e48){_0x22491a['sendStatus'](0x194);}return _0xca2e48;};}function handleError(_0x1794ae,_0x16e83f){_0x16e83f=_0x16e83f||0x1f4;return function(_0x2e24fc){logger[_0x71d6('0x24')](_0x2e24fc[_0x71d6('0x36')]);if(_0x2e24fc[_0x71d6('0x37')]){delete _0x2e24fc[_0x71d6('0x37')];}_0x1794ae[_0x71d6('0x29')](_0x16e83f)[_0x71d6('0x38')](_0x2e24fc);};}function createInteractionObject(_0x33dac8,_0x37b488,_0x5d0001,_0x43290e){var _0x4908a0=require('user-agent-parser');var _0x330317=new _0x4908a0();var _0x488b21=_0x330317[_0x71d6('0x39')](_0x5d0001['user-agent'])[_0x71d6('0x3a')]();var _0x5de034=_0x37b488[_0x71d6('0x3b')];if(_0x5d0001[_0x71d6('0x3c')]){_0x5de034=_0x5d0001[_0x71d6('0x3c')];}else if(_0x5d0001[_0x71d6('0x3d')]){_0x5de034=_[_0x71d6('0x3e')](_0x5d0001[_0x71d6('0x3d')]['split'](','));}return{'ContactId':_0x43290e['id'],'ChatWebsiteId':_0x33dac8,'from':(_0x43290e['firstName']||'')+'\x20'+(_0x43290e['lastName']||''),'customerIp':_0x5de034,'customerPort':_0x5d0001['x-real-port']?_0x5d0001[_0x71d6('0x3f')]:null,'referer':_0x37b488['referer'],'browserName':_0x488b21[_0x71d6('0x40')][_0x71d6('0x37')]&&_0x488b21[_0x71d6('0x40')][_0x71d6('0x41')]?util['format'](_0x71d6('0x42'),_0x488b21[_0x71d6('0x40')]['name'],_0x488b21[_0x71d6('0x40')][_0x71d6('0x41')]):_0x71d6('0x43'),'browserVersion':_0x488b21['browser']['version']||_0x71d6('0x43'),'osName':util[_0x71d6('0x44')](_0x71d6('0x42'),_0x488b21['os'][_0x71d6('0x37')],_0x488b21['os'][_0x71d6('0x41')]),'osVersion':_0x488b21['os'][_0x71d6('0x41')],'deviceModel':_0x488b21['device'][_0x71d6('0x45')]&&_0x488b21['device'][_0x71d6('0x46')]?util[_0x71d6('0x44')](_0x71d6('0x47'),_0x488b21[_0x71d6('0x48')][_0x71d6('0x45')],_0x488b21[_0x71d6('0x48')]['vendor'],_0x488b21[_0x71d6('0x48')][_0x71d6('0x49')]):null,'deviceVendor':_0x488b21[_0x71d6('0x48')][_0x71d6('0x46')],'deviceType':_0x488b21[_0x71d6('0x48')]['type'],'formData':JSON[_0x71d6('0x23')](_0x37b488)};}exports[_0x71d6('0x4a')]=function(_0x1ba4b3,_0x249e81){var _0x346836={'include':[{'model':db[_0x71d6('0x4b')],'as':_0x71d6('0x4c')}]},_0x559f40={},_0x4f8f53={'count':0x0,'rows':[]};var _0x56381c=_[_0x71d6('0x4d')](db[_0x71d6('0x4e')][_0x71d6('0x4f')],function(_0x3f605b){return{'name':_0x3f605b[_0x71d6('0x50')],'type':_0x3f605b[_0x71d6('0x49')]['key']};});_0x559f40[_0x71d6('0x45')]=_[_0x71d6('0x4d')](_0x56381c,'name');_0x559f40['query']=_[_0x71d6('0x51')](_0x1ba4b3[_0x71d6('0x52')]);_0x559f40[_0x71d6('0x53')]=_[_0x71d6('0x54')](_0x559f40[_0x71d6('0x45')],_0x559f40[_0x71d6('0x52')]);_0x346836[_0x71d6('0x55')]=_[_0x71d6('0x54')](_0x559f40[_0x71d6('0x45')],qs[_0x71d6('0x56')](_0x1ba4b3['query'][_0x71d6('0x56')]));_0x346836[_0x71d6('0x55')]=_0x346836[_0x71d6('0x55')][_0x71d6('0x57')]?_0x346836['attributes']:_0x559f40[_0x71d6('0x45')];if(!_0x1ba4b3[_0x71d6('0x52')][_0x71d6('0x58')](_0x71d6('0x59'))){_0x346836[_0x71d6('0x2e')]=qs[_0x71d6('0x2e')](_0x1ba4b3[_0x71d6('0x52')][_0x71d6('0x2e')]);_0x346836[_0x71d6('0x2c')]=qs[_0x71d6('0x2c')](_0x1ba4b3[_0x71d6('0x52')][_0x71d6('0x2c')]);}_0x346836[_0x71d6('0x5a')]=qs[_0x71d6('0x5b')](_0x1ba4b3[_0x71d6('0x52')][_0x71d6('0x5b')]);_0x346836[_0x71d6('0x5c')]=qs['filters'](_[_0x71d6('0x5d')](_0x1ba4b3[_0x71d6('0x52')],_0x559f40[_0x71d6('0x53')]),_0x56381c);if(_0x1ba4b3[_0x71d6('0x52')][_0x71d6('0x5e')]){_0x346836['where']=_[_0x71d6('0x5f')](_0x346836[_0x71d6('0x5c')],{'$or':_[_0x71d6('0x4d')](_0x56381c,function(_0x894cb8){if(_0x894cb8['type']!=='VIRTUAL'){var _0x3f924b={};_0x3f924b[_0x894cb8['name']]={'$like':'%'+_0x1ba4b3[_0x71d6('0x52')][_0x71d6('0x5e')]+'%'};return _0x3f924b;}})});}_0x346836=_[_0x71d6('0x5f')]({},_0x346836,_0x1ba4b3[_0x71d6('0x60')]);var _0x4da702={'where':_0x346836[_0x71d6('0x5c')]};return db[_0x71d6('0x4e')]['count'](_0x4da702)[_0x71d6('0x1d')](function(_0x3ff4f2){_0x4f8f53['count']=_0x3ff4f2;if(_0x1ba4b3[_0x71d6('0x52')]['includeAll']){_0x346836[_0x71d6('0x61')]=[{'all':!![]}];}return db[_0x71d6('0x4e')][_0x71d6('0x62')](_0x346836);})[_0x71d6('0x1d')](function(_0x6ee7a4){_0x4f8f53[_0x71d6('0x63')]=_0x6ee7a4;return _0x4f8f53;})[_0x71d6('0x1d')](respondWithFilteredResult(_0x249e81,_0x346836))[_0x71d6('0x27')](handleError(_0x249e81,null));};exports[_0x71d6('0x64')]=function(_0x13f19d,_0x381bc5){var _0x141e7e={'raw':![],'where':{'id':_0x13f19d[_0x71d6('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x71d6('0x4c')}]},_0x1bbc36={};_0x1bbc36['model']=_[_0x71d6('0x51')](db[_0x71d6('0x4e')]['rawAttributes']);_0x1bbc36['query']=_[_0x71d6('0x51')](_0x13f19d['query']);_0x1bbc36[_0x71d6('0x53')]=_[_0x71d6('0x54')](_0x1bbc36['model'],_0x1bbc36[_0x71d6('0x52')]);_0x141e7e[_0x71d6('0x55')]=_['intersection'](_0x1bbc36[_0x71d6('0x45')],qs[_0x71d6('0x56')](_0x13f19d[_0x71d6('0x52')][_0x71d6('0x56')]));_0x141e7e[_0x71d6('0x55')]=_0x141e7e[_0x71d6('0x55')][_0x71d6('0x57')]?_0x141e7e[_0x71d6('0x55')]:_0x1bbc36[_0x71d6('0x45')];if(_0x13f19d[_0x71d6('0x52')][_0x71d6('0x66')]){_0x141e7e['include']=[{'all':!![]}];}_0x141e7e=_[_0x71d6('0x5f')]({},_0x141e7e,_0x13f19d[_0x71d6('0x60')]);return db['ChatWebsite']['find'](_0x141e7e)['then'](handleEntityNotFound(_0x381bc5,null))['then'](respondWithResult(_0x381bc5,null))[_0x71d6('0x27')](handleError(_0x381bc5,null));};exports[_0x71d6('0x67')]=function(_0x5f3157,_0x3965a2){var _0x4d4d35=null;_0x5f3157[_0x71d6('0x68')][_0x71d6('0x69')][_0x71d6('0x6a')](',')[_0x71d6('0x6b')](_0x9a2ae0=>{if(_0x9a2ae0['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x9a2ae0['trim']())){_0x4d4d35=new APIBadRequestError('\x22'+_0x9a2ae0[_0x71d6('0x6c')]()+_0x71d6('0x6d'));}});if(_0x4d4d35){return handleError(_0x3965a2,null)(_0x4d4d35);}return db['ChatWebsite'][_0x71d6('0x67')](_0x5f3157['body'],{})[_0x71d6('0x1d')](function(_0x513d55){var _0x4b3307=_0x5f3157[_0x71d6('0x6e')][_0x71d6('0x34')]({'plain':!![]});if(!_0x4b3307)throw new Error(_0x71d6('0x6f'));if(_0x4b3307[_0x71d6('0x70')]===_0x71d6('0x6e')){var _0x2d6619=_0x513d55['get']({'plain':!![]});var _0x4a552a=_0x71d6('0x71');return db[_0x71d6('0x72')][_0x71d6('0x73')]({'where':{'name':_0x4a552a,'userProfileId':_0x4b3307[_0x71d6('0x74')]},'raw':!![]})[_0x71d6('0x1d')](function(_0x332b18){if(_0x332b18&&_0x332b18[_0x71d6('0x75')]===0x0){return db[_0x71d6('0x35')][_0x71d6('0x67')]({'name':_0x2d6619[_0x71d6('0x37')],'resourceId':_0x2d6619['id'],'type':_0x332b18['name'],'sectionId':_0x332b18['id']},{})[_0x71d6('0x1d')](function(){return _0x513d55;});}else{return _0x513d55;}})[_0x71d6('0x27')](function(_0x42f710){logger['error'](_0x71d6('0x76'),_0x42f710);throw _0x42f710;});}return _0x513d55;})[_0x71d6('0x1d')](respondWithResult(_0x3965a2,0xc9))[_0x71d6('0x27')](handleError(_0x3965a2,null));};exports[_0x71d6('0x32')]=function(_0x44b779,_0x3e9547){var _0xf1ab53=null;_0x44b779['body']['address'][_0x71d6('0x6a')](',')[_0x71d6('0x6b')](_0x59a021=>{if(_0x59a021[_0x71d6('0x6c')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x59a021[_0x71d6('0x6c')]())){_0xf1ab53=new APIBadRequestError('\x22'+_0x59a021['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0xf1ab53){return handleError(_0x3e9547,null)(_0xf1ab53);}if(_0x44b779[_0x71d6('0x68')]['id']){delete _0x44b779[_0x71d6('0x68')]['id'];}return db[_0x71d6('0x4e')]['find']({'where':{'id':_0x44b779['params']['id']},'include':[{'model':db[_0x71d6('0x4b')],'as':_0x71d6('0x4c')}]})['then'](handleEntityNotFound(_0x3e9547,null))['then'](saveUpdates(_0x44b779['body'],null))[_0x71d6('0x1d')](respondWithResult(_0x3e9547,null))['catch'](handleError(_0x3e9547,null));};exports[_0x71d6('0x33')]=function(_0x480c28,_0xf36c9){return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x480c28[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0xf36c9,null))[_0x71d6('0x1d')](removeEntity(_0xf36c9,null))[_0x71d6('0x27')](handleError(_0xf36c9,null));};exports['describe']=function(_0x1e5ebb,_0x3a9861){return db[_0x71d6('0x4e')][_0x71d6('0x77')]()['then'](respondWithResult(_0x3a9861,null))[_0x71d6('0x27')](handleError(_0x3a9861,null));};exports[_0x71d6('0x78')]=function(_0x28c2a8,_0x2c78fe){if(_0x28c2a8[_0x71d6('0x68')]['id']){delete _0x28c2a8[_0x71d6('0x68')]['id'];}return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x28c2a8[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x2c78fe,null))['then'](function(_0x39c297){if(_0x39c297){_0x28c2a8[_0x71d6('0x68')]['ChatWebsiteId']=_0x39c297['id'];return db[_0x71d6('0x79')]['create'](_0x28c2a8[_0x71d6('0x68')]);}})['then'](respondWithResult(_0x2c78fe,null))[_0x71d6('0x27')](handleError(_0x2c78fe,null));};exports['getDispositions']=function(_0x49e520,_0x25c11e){var _0x3d5359={'raw':![],'where':{}};var _0x77c64f={};var _0xf81edc={'count':0x0,'rows':[]};return db[_0x71d6('0x4e')]['findOne']({'where':{'id':_0x49e520[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x25c11e,null))[_0x71d6('0x1d')](function(_0x16e0a5){if(_0x16e0a5){_0x77c64f[_0x71d6('0x45')]=_[_0x71d6('0x51')](db[_0x71d6('0x79')][_0x71d6('0x4f')]);_0x77c64f[_0x71d6('0x52')]=_[_0x71d6('0x51')](_0x49e520[_0x71d6('0x52')]);_0x77c64f[_0x71d6('0x53')]=_[_0x71d6('0x54')](_0x77c64f['model'],_0x77c64f[_0x71d6('0x52')]);_0x3d5359['attributes']=_[_0x71d6('0x54')](_0x77c64f[_0x71d6('0x45')],qs[_0x71d6('0x56')](_0x49e520[_0x71d6('0x52')][_0x71d6('0x56')]));_0x3d5359[_0x71d6('0x55')]=_0x3d5359[_0x71d6('0x55')][_0x71d6('0x57')]?_0x3d5359['attributes']:_0x77c64f[_0x71d6('0x45')];if(!_0x49e520[_0x71d6('0x52')][_0x71d6('0x58')](_0x71d6('0x59'))){_0x3d5359[_0x71d6('0x2e')]=qs[_0x71d6('0x2e')](_0x49e520[_0x71d6('0x52')][_0x71d6('0x2e')]);_0x3d5359['offset']=qs['offset'](_0x49e520[_0x71d6('0x52')][_0x71d6('0x2c')]);}_0x3d5359['order']=qs[_0x71d6('0x5b')](_0x49e520[_0x71d6('0x52')]['sort']);_0x3d5359[_0x71d6('0x5c')]=qs[_0x71d6('0x53')](_['pick'](_0x49e520[_0x71d6('0x52')],_0x77c64f[_0x71d6('0x53')]));_0x3d5359[_0x71d6('0x5c')][_0x71d6('0x7a')]=_0x16e0a5['id'];if(_0x49e520[_0x71d6('0x52')][_0x71d6('0x5e')]){_0x3d5359[_0x71d6('0x5c')]=_[_0x71d6('0x5f')](_0x3d5359[_0x71d6('0x5c')],{'$or':_[_0x71d6('0x4d')](_0x3d5359['attributes'],function(_0x22ce61){var _0x284f7d={};_0x284f7d[_0x22ce61]={'$like':'%'+_0x49e520[_0x71d6('0x52')][_0x71d6('0x5e')]+'%'};return _0x284f7d;})});}_0x3d5359=_[_0x71d6('0x5f')]({},_0x3d5359,_0x49e520[_0x71d6('0x60')]);return db['Disposition'][_0x71d6('0x2f')]({'where':_0x3d5359[_0x71d6('0x5c')]})['then'](function(_0x1d9355){_0xf81edc[_0x71d6('0x2f')]=_0x1d9355;if(_0x49e520[_0x71d6('0x52')]['includeAll']){_0x3d5359[_0x71d6('0x61')]=[{'all':!![]}];}return db[_0x71d6('0x79')]['findAll'](_0x3d5359);})[_0x71d6('0x1d')](function(_0x4b3f2c){_0xf81edc['rows']=_0x4b3f2c;return _0xf81edc;});}})['then'](respondWithFilteredResult(_0x25c11e,_0x3d5359))['catch'](handleError(_0x25c11e,null));};exports[_0x71d6('0x7b')]=function(_0x394ca9,_0x202884){return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x394ca9['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x202884,null))['then'](function(_0x1901d1){if(_0x1901d1){return _0x1901d1[_0x71d6('0x7b')](_0x394ca9[_0x71d6('0x52')][_0x71d6('0x7c')]);}})[_0x71d6('0x1d')](respondWithStatusCode(_0x202884,null))[_0x71d6('0x27')](handleError(_0x202884,null));};exports['addAnswer']=function(_0x3f814f,_0x29345e){if(_0x3f814f[_0x71d6('0x68')]['id']){delete _0x3f814f[_0x71d6('0x68')]['id'];}return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x3f814f['params']['id']}})['then'](handleEntityNotFound(_0x29345e,null))['then'](function(_0x381e8f){if(_0x381e8f){_0x3f814f[_0x71d6('0x68')][_0x71d6('0x7a')]=_0x381e8f['id'];return db[_0x71d6('0x7d')]['create'](_0x3f814f['body']);}})[_0x71d6('0x1d')](respondWithResult(_0x29345e,null))[_0x71d6('0x27')](handleError(_0x29345e,null));};exports[_0x71d6('0x7e')]=function(_0x40ac9f,_0x130e6c){var _0x3dc09f={'raw':![],'where':{}};var _0x5978d6={};var _0x33850b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x71d6('0x7f')]({'where':{'id':_0x40ac9f['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x130e6c,null))[_0x71d6('0x1d')](function(_0x5cc0ef){if(_0x5cc0ef){_0x5978d6[_0x71d6('0x45')]=_[_0x71d6('0x51')](db[_0x71d6('0x7d')][_0x71d6('0x4f')]);_0x5978d6[_0x71d6('0x52')]=_[_0x71d6('0x51')](_0x40ac9f[_0x71d6('0x52')]);_0x5978d6[_0x71d6('0x53')]=_[_0x71d6('0x54')](_0x5978d6[_0x71d6('0x45')],_0x5978d6[_0x71d6('0x52')]);_0x3dc09f[_0x71d6('0x55')]=_['intersection'](_0x5978d6[_0x71d6('0x45')],qs[_0x71d6('0x56')](_0x40ac9f[_0x71d6('0x52')][_0x71d6('0x56')]));_0x3dc09f['attributes']=_0x3dc09f[_0x71d6('0x55')][_0x71d6('0x57')]?_0x3dc09f['attributes']:_0x5978d6[_0x71d6('0x45')];if(!_0x40ac9f['query']['hasOwnProperty']('nolimit')){_0x3dc09f['limit']=qs[_0x71d6('0x2e')](_0x40ac9f[_0x71d6('0x52')]['limit']);_0x3dc09f['offset']=qs[_0x71d6('0x2c')](_0x40ac9f[_0x71d6('0x52')][_0x71d6('0x2c')]);}_0x3dc09f[_0x71d6('0x5a')]=qs[_0x71d6('0x5b')](_0x40ac9f[_0x71d6('0x52')]['sort']);_0x3dc09f[_0x71d6('0x5c')]=qs['filters'](_[_0x71d6('0x5d')](_0x40ac9f[_0x71d6('0x52')],_0x5978d6[_0x71d6('0x53')]));_0x3dc09f[_0x71d6('0x5c')]['ChatWebsiteId']=_0x5cc0ef['id'];if(_0x40ac9f[_0x71d6('0x52')]['filter']){_0x3dc09f[_0x71d6('0x5c')]=_[_0x71d6('0x5f')](_0x3dc09f[_0x71d6('0x5c')],{'$or':_[_0x71d6('0x4d')](_0x3dc09f[_0x71d6('0x55')],function(_0x593b43){var _0x17b91e={};_0x17b91e[_0x593b43]={'$like':'%'+_0x40ac9f[_0x71d6('0x52')][_0x71d6('0x5e')]+'%'};return _0x17b91e;})});}_0x3dc09f=_[_0x71d6('0x5f')]({},_0x3dc09f,_0x40ac9f['options']);return db[_0x71d6('0x7d')][_0x71d6('0x2f')]({'where':_0x3dc09f['where']})[_0x71d6('0x1d')](function(_0x4c7067){_0x33850b[_0x71d6('0x2f')]=_0x4c7067;if(_0x40ac9f['query'][_0x71d6('0x66')]){_0x3dc09f[_0x71d6('0x61')]=[{'all':!![]}];}return db[_0x71d6('0x7d')][_0x71d6('0x62')](_0x3dc09f);})[_0x71d6('0x1d')](function(_0x53f031){_0x33850b[_0x71d6('0x63')]=_0x53f031;return _0x33850b;});}})['then'](respondWithFilteredResult(_0x130e6c,_0x3dc09f))[_0x71d6('0x27')](handleError(_0x130e6c,null));};exports['removeAnswers']=function(_0x597407,_0x11fed9){return db['ChatWebsite'][_0x71d6('0x73')]({'where':{'id':_0x597407[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x11fed9,null))[_0x71d6('0x1d')](function(_0x386afd){if(_0x386afd){return _0x386afd['removeAnswers'](_0x597407['query'][_0x71d6('0x7c')]);}})['then'](respondWithStatusCode(_0x11fed9,null))[_0x71d6('0x27')](handleError(_0x11fed9,null));};exports[_0x71d6('0x80')]=function(_0x504208,_0xd2fd34){_0x504208['body'][_0x71d6('0x81')]=_0x504208[_0x71d6('0x82')][_0x71d6('0x83')];return db['ChatWebsite'][_0x71d6('0x73')]({'where':{'id':_0x504208['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0xd2fd34,null))[_0x71d6('0x1d')](saveUpdates(_0x504208[_0x71d6('0x68')],null))['then'](respondWithResult(_0xd2fd34,null))[_0x71d6('0x27')](handleError(_0xd2fd34,null));};exports[_0x71d6('0x84')]=function(_0x23a326,_0x1bcc4a){_0x23a326[_0x71d6('0x68')][_0x71d6('0x85')]=_0x23a326[_0x71d6('0x82')]['filename'];return db['ChatWebsite'][_0x71d6('0x73')]({'where':{'id':_0x23a326['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x1bcc4a,null))[_0x71d6('0x1d')](saveUpdates(_0x23a326[_0x71d6('0x68')],null))['then'](respondWithResult(_0x1bcc4a,null))[_0x71d6('0x27')](handleError(_0x1bcc4a,null));};exports[_0x71d6('0x86')]=function(_0x2e3055,_0x17066b){_0x2e3055[_0x71d6('0x68')][_0x71d6('0x87')]=_0x2e3055[_0x71d6('0x82')][_0x71d6('0x83')];return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x2e3055['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x17066b,null))[_0x71d6('0x1d')](saveUpdates(_0x2e3055[_0x71d6('0x68')],null))[_0x71d6('0x1d')](respondWithResult(_0x17066b,null))[_0x71d6('0x27')](handleError(_0x17066b,null));};exports[_0x71d6('0x88')]=function(_0x570630,_0x35486e){_0x570630[_0x71d6('0x68')]['systemAvatar']=_0x570630[_0x71d6('0x82')][_0x71d6('0x83')];return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x570630[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x35486e,null))[_0x71d6('0x1d')](saveUpdates(_0x570630[_0x71d6('0x68')],null))[_0x71d6('0x1d')](respondWithResult(_0x35486e,null))['catch'](handleError(_0x35486e,null));};exports[_0x71d6('0x89')]=function(_0x462121,_0x5ee8cb){var _0x2e8cfb=path['join'](config[_0x71d6('0x8a')],'server/files/images/logos/default_logo.svg');var _0x25057e={'where':{'id':_0x462121[_0x71d6('0x65')]['id']},'attributes':['id',_0x71d6('0x81')],'raw':!![]};var _0x5a23d2=![];return require(_0x71d6('0x8b'))['getLicense']()['then'](function(_0x4a95e5){if(_0x4a95e5){_0x5a23d2=_0x4a95e5['custom'];}})[_0x71d6('0x1d')](function(){return db['ChatWebsite']['find'](_0x25057e);})[_0x71d6('0x1d')](handleEntityNotFound(_0x5ee8cb,null))[_0x71d6('0x1d')](function(_0x137d1a){if(_0x137d1a){if(!_[_0x71d6('0x8c')](_0x137d1a[_0x71d6('0x81')])){if(fs[_0x71d6('0x8d')](path[_0x71d6('0x8e')](config[_0x71d6('0x8a')],_0x71d6('0x8f'),_0x137d1a[_0x71d6('0x81')]))&&_0x5a23d2){_0x2e8cfb=path[_0x71d6('0x8e')](config[_0x71d6('0x8a')],'server/files/images/logos/',_0x137d1a[_0x71d6('0x81')]);}}return _0x5ee8cb[_0x71d6('0x90')](_0x2e8cfb);}})['catch'](handleError(_0x5ee8cb,null));};exports[_0x71d6('0x91')]=function(_0x1c662b,_0x4ee5cc){var _0x5492ea=path[_0x71d6('0x8e')](config[_0x71d6('0x8a')],_0x71d6('0x92'));var _0x24960e={'where':{'id':_0x1c662b[_0x71d6('0x65')]['id']},'attributes':['id',_0x71d6('0x85')],'raw':!![]};return db['ChatWebsite']['find'](_0x24960e)[_0x71d6('0x1d')](handleEntityNotFound(_0x4ee5cc,null))[_0x71d6('0x1d')](function(_0x5fc232){if(_0x5fc232){if(!_[_0x71d6('0x8c')](_0x5fc232[_0x71d6('0x85')])){if(fs[_0x71d6('0x8d')](path[_0x71d6('0x8e')](config['root'],_0x71d6('0x93'),_0x5fc232[_0x71d6('0x85')]))){_0x5492ea=path['join'](config[_0x71d6('0x8a')],_0x71d6('0x93'),_0x5fc232[_0x71d6('0x85')]);}}return _0x4ee5cc[_0x71d6('0x90')](_0x5492ea);}})[_0x71d6('0x27')](handleError(_0x4ee5cc,null));};exports[_0x71d6('0x94')]=function(_0x47da53,_0x7b9c09){var _0x184a9c=path[_0x71d6('0x8e')](config[_0x71d6('0x8a')],_0x71d6('0x95'));var _0x2ad475={'where':{'id':_0x47da53[_0x71d6('0x65')]['id']},'attributes':['id','customerAvatar',_0x71d6('0x96')],'raw':!![]};return db[_0x71d6('0x4e')]['find'](_0x2ad475)[_0x71d6('0x1d')](handleEntityNotFound(_0x7b9c09,null))[_0x71d6('0x1d')](function(_0x46f848){if(_0x46f848){if(!_[_0x71d6('0x8c')](_0x46f848[_0x71d6('0x87')])){if(fs[_0x71d6('0x8d')](path[_0x71d6('0x8e')](config[_0x71d6('0x8a')],_0x71d6('0x93'),_0x46f848[_0x71d6('0x87')]))&&_0x46f848[_0x71d6('0x96')]){_0x184a9c=path['join'](config[_0x71d6('0x8a')],_0x71d6('0x93'),_0x46f848[_0x71d6('0x87')]);}}return _0x7b9c09['download'](_0x184a9c);}})['catch'](handleError(_0x7b9c09,null));};exports[_0x71d6('0x97')]=function(_0x26eab4,_0x2f3605){var _0x61aa8b=path['join'](config[_0x71d6('0x8a')],'server/files/images/avatars/system_avatar.png');var _0x3a7270={'where':{'id':_0x26eab4['params']['id']},'attributes':['id',_0x71d6('0x98')],'raw':!![]};return db[_0x71d6('0x4e')]['find'](_0x3a7270)[_0x71d6('0x1d')](handleEntityNotFound(_0x2f3605,null))[_0x71d6('0x1d')](function(_0xd656d2){if(_0xd656d2){if(!_[_0x71d6('0x8c')](_0xd656d2[_0x71d6('0x98')])){if(fs[_0x71d6('0x8d')](path['join'](config[_0x71d6('0x8a')],_0x71d6('0x93'),_0xd656d2[_0x71d6('0x98')]))){_0x61aa8b=path['join'](config[_0x71d6('0x8a')],_0x71d6('0x93'),_0xd656d2['systemAvatar']);}}return _0x2f3605[_0x71d6('0x90')](_0x61aa8b);}})[_0x71d6('0x27')](handleError(_0x2f3605,null));};function checkWebsiteInterval(_0x4e22da){var _0x2f3281=_0x4e22da['Interval'];if(!_0x2f3281){return Promise['resolve'](_0x4e22da);}var _0x2ea5cc=_0x4e22da[_0x71d6('0x99')]||undefined;return _0x2f3281[_0x71d6('0x9a')](_0x2ea5cc)['then'](function(_0xf71482){if(!_0xf71482){throw new APIOutOfIntervalError();}return _0x4e22da;});}exports['notify']=function(_0x501253,_0xd6ddc2){var _0x5272cc={'body':_0x501253['body'],'channel':_0x71d6('0x9b')};var _0x109b29=[];var _0x1766fe=[];var _0x2b0924={};var _0x44a531=![];if(_0x501253['body']['id']){delete _0x501253[_0x71d6('0x68')]['id'];}if(_[_0x71d6('0x8c')](_0x501253[_0x71d6('0x68')][_0x71d6('0x9c')])){throw new APIBadRequestError(_0x71d6('0x9d'));}if(_[_0x71d6('0x8c')](_0x501253[_0x71d6('0x68')][_0x71d6('0x9e')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_['isEmpty'](_0x501253[_0x71d6('0x68')][_0x71d6('0x68')])){throw new APIBadRequestError(_0x71d6('0x9f'));}var _0x990f04=_0x501253[_0x71d6('0x68')][_0x71d6('0x3b')]&&_0x501253[_0x71d6('0x68')][_0x71d6('0xa0')];return db[_0x71d6('0xa1')][_0x71d6('0x77')]()[_0x71d6('0x1d')](function(_0x4640b6){if(!_0x4640b6){throw new Error('No\x20available\x20attributes');}_0x109b29=Object[_0x71d6('0x51')](_0x4640b6)[_0x71d6('0x5e')](function(_0x5e78ec){return![_0x71d6('0xa2'),_0x71d6('0xa3')][_0x71d6('0xa4')](_0x5e78ec);});_0x1766fe=Object['keys'](_0x4640b6)['filter'](function(_0x201154){return![_0x71d6('0xa2'),_0x71d6('0xa3'),_0x71d6('0xa5'),'ListId']['includes'](_0x201154);});if(!_[_0x71d6('0xa4')](_0x1766fe,_0x501253['body'][_0x71d6('0x9e')])){throw new APIBadRequestError(_0x71d6('0xa6')+_0x1766fe[_0x71d6('0x8e')](',\x20'));}_0x2b0924[_0x501253['body'][_0x71d6('0x9e')]]=_0x501253['body']['from'];})[_0x71d6('0x1d')](function(){return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x501253[_0x71d6('0x65')]['id']},'include':[{'model':db[_0x71d6('0xa7')],'as':'List','include':[{'model':db[_0x71d6('0xa1')],'as':_0x71d6('0xa8'),'where':_0x2b0924,'limit':0x1,'order':[[_0x71d6('0xa3'),_0x71d6('0xa9')]]}]},{'model':db[_0x71d6('0xaa')],'as':_0x71d6('0xab')},{'model':db[_0x71d6('0xac')],'as':'Interval','include':[{'model':db[_0x71d6('0xac')],'as':'Intervals','attributes':['id',_0x71d6('0xad')],'raw':!![]}]}]});})[_0x71d6('0x1d')](function(_0x494f54){if(!_0x494f54){throw new APINotFoundError(util[_0x71d6('0x44')](_0x71d6('0xae'),_0x501253[_0x71d6('0x65')]['id']));}if(_0x990f04){return checkWebsiteInterval(_0x494f54);}return _0x494f54;})['then'](function(_0x41bd56){_0x5272cc[_0x71d6('0xaf')]=_0x41bd56;_0x5272cc[_0x71d6('0xb0')]=_[_0x71d6('0xb1')](_0x41bd56[_0x71d6('0xab')],[_0x71d6('0xb2')],['asc']);if(_0x5272cc[_0x71d6('0xaf')][_0x71d6('0xab')]){delete _0x5272cc[_0x71d6('0xaf')][_0x71d6('0xab')];}_0x5272cc[_0x71d6('0xb3')]=_0x41bd56[_0x71d6('0xb4')]||{'id':_0x41bd56[_0x71d6('0xb5')]};if(_0x5272cc[_0x71d6('0xb3')]&&_0x5272cc[_0x71d6('0xb3')][_0x71d6('0xa8')][_0x71d6('0x57')]){return _0x5272cc['list'][_0x71d6('0xa8')][0x0];}var _0x464402=_[_0x71d6('0x16')](_0x501253[_0x71d6('0x68')],{'firstName':_0x501253[_0x71d6('0x68')][_0x71d6('0x9c')],'ListId':_0x41bd56[_0x71d6('0xb5')]});_0x464402[_0x501253[_0x71d6('0x68')][_0x71d6('0x9e')]]=_0x501253['body']['from'];return db[_0x71d6('0xa1')][_0x71d6('0x67')](_0x464402,{'fields':_0x109b29,'raw':!![]});})[_0x71d6('0x1d')](function(_0x3a72ee){_0x5272cc['contact']=_0x3a72ee;var _0x6ef245=createInteractionObject(_0x501253['params']['id'],_0x501253['body'],_0x501253['headers'],_0x3a72ee);var _0x257732={'ChatWebsiteId':_0x501253['params']['id']};if(_0x501253[_0x71d6('0x68')][_0x71d6('0xb6')]){_0x257732['threadId']=_0x501253[_0x71d6('0x68')][_0x71d6('0xb6')];_0x257732['closed']=![];return db['ChatInteraction'][_0x71d6('0x73')]({'where':_0x257732})[_0x71d6('0x1d')](function(_0x4a99e1){var _0x13a33c=_0x501253['body'][_0x71d6('0x3b')]&&_0x501253[_0x71d6('0x68')][_0x71d6('0xa0')];if(_0x4a99e1){_0x44a531=!![];return _0x4a99e1;}else if(!_0x13a33c&&_0x4a99e1&&_0x4a99e1[_0x71d6('0xb7')]){throw new APIConflictError(_0x71d6('0xb8'));}_0x6ef245[_0x71d6('0xb6')]=_0x501253[_0x71d6('0x68')][_0x71d6('0xb6')];_0x6ef245[_0x71d6('0xb9')]=_0x501253[_0x71d6('0x68')]['externalUrl'];return db['ChatInteraction']['create'](_0x6ef245);});}_0x257732[_0x71d6('0xba')]=_0x3a72ee['id'];if(_0x501253['body'][_0x71d6('0xbb')]&&_0x501253[_0x71d6('0x68')][_0x71d6('0xbb')]['id']){_0x257732['id']=_0x501253[_0x71d6('0x68')][_0x71d6('0xbb')]['id'];return db[_0x71d6('0xbc')][_0x71d6('0x73')]({'where':_0x257732})[_0x71d6('0x1d')](function(_0x2d78c9){var _0x1b4cc0=_0x501253[_0x71d6('0x68')]['customerIp']&&_0x501253[_0x71d6('0x68')][_0x71d6('0xa0')];if(!_0x1b4cc0&&_0x2d78c9&&_0x2d78c9[_0x71d6('0xb7')]){throw new APIConflictError(_0x71d6('0xb8'));}else if(_0x2d78c9){_0x44a531=!![];return _0x2d78c9;}else{return db[_0x71d6('0xbc')]['create'](_0x6ef245);}});}return db[_0x71d6('0xbc')]['create'](_0x6ef245);})[_0x71d6('0x1d')](function(_0x8831e1){if(!_0x44a531){return _0x8831e1;}var _0xaf9118={'from':(_0x5272cc[_0x71d6('0xbd')]['firstName']||'')+'\x20'+(_0x5272cc[_0x71d6('0xbd')]['lastName']||'')};if(_0x501253[_0x71d6('0x68')][_0x71d6('0xb6')]&&_0x501253[_0x71d6('0x68')][_0x71d6('0xbe')]&&_0x501253[_0x71d6('0x68')][_0x71d6('0xb6')]!=_0x501253[_0x71d6('0x68')][_0x71d6('0xbe')]){_0xaf9118['threadId']=_0x501253['body'][_0x71d6('0xbe')];}return _0x8831e1[_0x71d6('0x32')](_0xaf9118);})[_0x71d6('0x1d')](function(_0x498ab5){_0x5272cc['interaction']=_0x498ab5[_0x71d6('0x34')]({'plain':!![]});_0x5272cc[_0x71d6('0xbb')][_0x71d6('0xbf')]=!_0x44a531;if(_0x5272cc[_0x71d6('0xbb')][_0x71d6('0xbf')]){if(_0x5272cc[_0x71d6('0xaf')][_0x71d6('0xc0')]){_0x5272cc[_0x71d6('0xb0')][_0x71d6('0xc1')]({'id':0x0,'priority':_0x5272cc[_0x71d6('0xb0')][_0x71d6('0x57')]+0x1,'app':_0x71d6('0xc2'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x71d6('0xc3')][_0x71d6('0x67')]({'body':_0x501253[_0x71d6('0x68')]['body'],'ChatWebsiteId':_0x501253[_0x71d6('0x65')]['id'],'ChatInteractionId':_0x498ab5['id'],'direction':'in','ContactId':_0x5272cc[_0x71d6('0xbd')]['id'],'AttachmentId':_0x501253[_0x71d6('0x68')][_0x71d6('0xc4')]});})[_0x71d6('0x1d')](function(_0x53079f){_0x5272cc[_0x71d6('0x26')]=_0x53079f;if(!_0x5272cc['interaction'][_0x71d6('0xc5')]){return;}return db[_0x71d6('0xc6')]['find']({'attributes':['id',_0x71d6('0x37')],'where':{'id':_0x5272cc[_0x71d6('0xbb')][_0x71d6('0xc5')]}});})[_0x71d6('0x1d')](function(_0x1d834d){if(_0x1d834d){_0x5272cc[_0x71d6('0xb0')][_0x71d6('0xc7')]({'id':0x0,'priority':0x0,'app':_0x71d6('0xc8'),'appdata':_0x1d834d[_0x71d6('0x37')]+','+(_0x5272cc[_0x71d6('0xaf')][_0x71d6('0xc9')]||0xa),'interval':_0x71d6('0xca')});_0x5272cc[_0x71d6('0xcb')]=!![];}if(!_0x5272cc[_0x71d6('0xbb')]['queueId']){return;}return db[_0x71d6('0xcc')][_0x71d6('0x73')]({'attributes':['id',_0x71d6('0x37')],'where':{'id':_0x5272cc['interaction'][_0x71d6('0xcd')]}});})[_0x71d6('0x1d')](function(_0x51d3d2){if(_0x51d3d2){_0x5272cc[_0x71d6('0xb0')][_0x71d6('0xc7')]({'id':0x0,'priority':0x1,'app':_0x71d6('0xce'),'appdata':_0x51d3d2[_0x71d6('0x37')]+','+(_0x5272cc[_0x71d6('0xaf')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x71d6('0xcf'),_0x71d6('0xd0'),_0x5272cc);})['then'](function(_0x45078c){respondWithRpcPromise(_0x71d6('0xd1'),_0x71d6('0xd1'),{'event':_0x71d6('0xd2'),'message':_0x45078c},client9002);return _0x45078c;})[_0x71d6('0x1d')](respondWithResult(_0xd6ddc2,null))['catch'](APIHandleError(_0xd6ddc2));};exports[_0x71d6('0xd3')]=function(_0x4ccef4,_0x2b4cb9){var _0x1115fb,_0x285e39,_0x41451e;var _0x393200=[];var _0x49c495={};var _0x404a9a=_0x4ccef4[_0x71d6('0xd4')]||[];var _0x1b9e7c=[];var _0x25a803;return db[_0x71d6('0xa1')][_0x71d6('0x77')]()[_0x71d6('0x1d')](function(_0x39f37b){if(!_0x39f37b){throw new db['Sequelize'][(_0x71d6('0xd5'))](_0x71d6('0xd6'));}_0x393200=_['difference'](_['keys'](_0x39f37b),[_0x71d6('0xa2'),'updatedAt',_0x71d6('0xa5'),'ListId']);if(_0x4ccef4['body']['id']){delete _0x4ccef4['body']['id'];}if(_['isNil'](_0x4ccef4[_0x71d6('0x68')][_0x71d6('0x9c')])){throw _0x2b4cb9[_0x71d6('0x29')](0x1f4)['send'](new db[(_0x71d6('0xd7'))][(_0x71d6('0xd5'))](_0x71d6('0xd8')));}if(_[_0x71d6('0x8c')](_0x4ccef4[_0x71d6('0x68')][_0x71d6('0x68')])||_0x4ccef4[_0x71d6('0x68')][_0x71d6('0x68')]===''){throw _0x2b4cb9['status'](0x1f4)[_0x71d6('0x38')](new db['Sequelize'][(_0x71d6('0xd5'))](_0x71d6('0xd9')));}if(_[_0x71d6('0x8c')](_0x4ccef4[_0x71d6('0x68')][_0x71d6('0xda')])){throw _0x2b4cb9['status'](0x1f4)[_0x71d6('0x38')](new db[(_0x71d6('0xd7'))][(_0x71d6('0xd5'))](_0x71d6('0xdb')+_0x393200));}if(!_['includes'](_0x393200,_0x4ccef4['body'][_0x71d6('0xda')])){throw _0x2b4cb9[_0x71d6('0x29')](0x1f4)['send'](new db[(_0x71d6('0xd7'))][(_0x71d6('0xd5'))](_0x71d6('0xdc')+_0x393200));}_0x49c495[_0x4ccef4[_0x71d6('0x68')][_0x71d6('0xda')]]=_0x4ccef4[_0x71d6('0x68')][_0x71d6('0x9c')];})[_0x71d6('0x1d')](function(){return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x4ccef4[_0x71d6('0x65')]['id']},'include':[{'model':db[_0x71d6('0xa7')],'as':'List'},{'model':db[_0x71d6('0xdd')],'as':_0x71d6('0xdd')}]});})[_0x71d6('0x1d')](handleEntityNotFound(_0x2b4cb9,null))['then'](function(_0x45ea01){if(_0x45ea01&&_0x45ea01[_0x71d6('0xb4')]){_0x285e39=_0x45ea01;var _0x4755d5=_['defaults'](_0x4ccef4[_0x71d6('0x68')],{'firstName':_0x4ccef4[_0x71d6('0x68')][_0x71d6('0x9c')],'phone':_0x4ccef4[_0x71d6('0x68')][_0x71d6('0x9c')],'ListId':_0x45ea01[_0x71d6('0xb5')]});_0x4755d5[_0x4ccef4[_0x71d6('0x68')][_0x71d6('0xda')]]=_0x4ccef4['body'][_0x71d6('0x9c')];return db[_0x71d6('0xa1')]['findOrCreate']({'where':_0x49c495,'defaults':_0x4755d5});}})['spread'](function(_0x163085){if(_0x163085){_0x41451e=_0x163085;var _0x3fb5e6=fs[_0x71d6('0xde')](path[_0x71d6('0x8e')](config[_0x71d6('0x8a')],_0x71d6('0xdf')),'utf8');var _0x446817=ejs['render'](_0x3fb5e6,{'body':_[_0x71d6('0xe0')](_0x4ccef4[_0x71d6('0x68')]['body']),'bodyTitle':_0x285e39['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x446817,'plainBody':htmlToText[_0x71d6('0xe1')](_0x446817),'ContactId':_0x163085['id'],'ChatWebsiteId':_0x285e39['id']});}})['then'](function(_0x157ec2){_0x25a803=_0x157ec2;if(_0x404a9a[_0x71d6('0x57')]){var _0x31d453=_0x404a9a[_0x71d6('0x4d')](function(_0x32fda7){return{'name':_0x32fda7[_0x71d6('0xe2')],'basename':_0x32fda7[_0x71d6('0x83')],'type':_0x32fda7[_0x71d6('0xe3')],'ChatOfflineMessageId':_0x157ec2['id']};});_0x1b9e7c=_0x31d453[_0x71d6('0x4d')](_0x4205bc=>{var _0x10be2d={'filename':_0x4205bc[_0x71d6('0x37')],'path':path[_0x71d6('0x8e')](config[_0x71d6('0x8a')],'server','files',_0x71d6('0xe4'),'offline-chat',_0x4205bc['basename'])};return _0x10be2d;});if(!_0x285e39['openNewInteraction']){return db[_0x71d6('0xe5')][_0x71d6('0xe6')](function(_0x102953){return db[_0x71d6('0xe7')][_0x71d6('0xe8')](_0x31d453,{'transaction':_0x102953});});}}})[_0x71d6('0x1d')](function(){if(_0x25a803){_0x1115fb=_0x25a803;return db[_0x71d6('0xdd')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x71d6('0xe9')],'as':_0x71d6('0xea'),'raw':!![],'include':[{'model':db[_0x71d6('0xeb')],'as':_0x71d6('0xeb'),'raw':!![]}]}]});}})[_0x71d6('0x1d')](function(_0x25effa){if(_0x25effa&&_0x25effa[_0x71d6('0xea')]&&_0x285e39['forwardOffline']&&_0x285e39[_0x71d6('0xec')]){var _0x34c258=_0x25effa['getSmtpOptions']();return respondWithRpcPromise(_0x71d6('0xed'),_0x71d6('0xee'),{'account':_0x34c258,'message':{'from':util[_0x71d6('0x44')](_0x71d6('0xef'),_0x25effa['name'],_0x25effa[_0x71d6('0xf0')]||_0x25effa[_0x71d6('0xea')][_0x71d6('0x6e')]),'to':_0x285e39[_0x71d6('0xec')],'subject':_0x285e39['offlineMessageSubject'],'html':_0x1115fb['body'],'attachments':_0x1b9e7c}},client9003)[_0x71d6('0x1d')](function(){return _0x1115fb;})['catch'](function(_0x1266eb){logger[_0x71d6('0x24')](_0x1266eb);});}})[_0x71d6('0x1d')](function(){if(_0x285e39&&_0x285e39['openNewInteraction']&&_0x285e39[_0x71d6('0xf1')]){var _0x5a1b4c=[];if(_0x404a9a[_0x71d6('0x57')]){_0x5a1b4c=_0x404a9a[_0x71d6('0x4d')](function(_0x383db5){return{'name':_0x383db5['originalname'],'basename':_0x383db5[_0x71d6('0x83')],'type':_0x383db5[_0x71d6('0xe3')],'ChatOfflineMessageId':_0x25a803['id']};});}var _0x266101;if(!_['isNil'](_0x285e39['subjectOffline'])){var _0xcdebcc=_['map'](_0x4ccef4[_0x71d6('0x68')],function(_0x51136f){return _0x51136f;});var _0x45fece=_[_0x71d6('0xf2')](_0xcdebcc)[0x0];var _0x43d351=_['mapValues'](_0x45fece,function(_0xa18a79){return _0xa18a79;});_0x266101=_0x43d351[0x1][_0x285e39['subjectOffline']];}var _0x3af45f={'from':_0x41451e['email'],'firstName':_0x41451e[_0x71d6('0xf3')],'lastName':_0x41451e['lastName'],'mapKey':_0x71d6('0xf0'),'message':{'from':_0x41451e[_0x71d6('0xf0')],'to':_0x285e39[_0x71d6('0xdd')][_0x71d6('0xf0')],'cc':'','subject':_[_0x71d6('0x8c')](_0x266101)?_0x285e39[_0x71d6('0xf4')]:_0x266101,'messageId':'','sentAt':new Date(),'attach':_0x5a1b4c[_0x71d6('0x57')],'attachments':_0x5a1b4c,'originChannel':'Chat','ChatWebsiteId':_0x285e39['id'],'ChatOfflineMessageId':_0x1115fb['id'],'originTo':_0x285e39['MailAccount']['email']},'body':_0x1115fb['body']};var _0x50a036={'account':{'id':_0x285e39['MailAccountId']},'body':_0x3af45f,'log':_0x71d6('0xf5')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x50a036,client9001)['then'](function(){return _0x1115fb;})['catch'](function(_0x1446a0){logger[_0x71d6('0x24')](_0x1446a0);});}return;})[_0x71d6('0x1d')](function(){if(_0x1115fb){return _0x1115fb;}})[_0x71d6('0x1d')](respondWithResult(_0x2b4cb9,null))['catch'](function(){for(var _0x59c9db of _0x404a9a){var _0x4a5d34=path[_0x71d6('0x8e')](config['root'],_0x71d6('0xf6'),_0x71d6('0xd4'),_0x71d6('0xe4'),_0x71d6('0xf7'),_0x59c9db[_0x71d6('0x83')]);fs_extra['remove'](_0x4a5d34)[_0x71d6('0x27')](function(_0x8e30bc){logger['error'](_0x71d6('0xf8'),_0x4a5d34,_0x8e30bc);});}});};exports[_0x71d6('0xf9')]=function(_0x78004a,_0x272f47){return db['ChatInteraction'][_0x71d6('0x73')]({'where':{'id':_0x78004a['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x272f47,null))['then'](function(_0x1588d1){if(_0x1588d1){return _0x1588d1[_0x71d6('0xf9')](_0x78004a['body']['ids'],_[_0x71d6('0xfa')](_0x78004a[_0x71d6('0x68')],[_0x71d6('0x7c'),'id'])||{});}})[_0x71d6('0x1d')](respondWithResult(_0x272f47,null))[_0x71d6('0x27')](handleError(_0x272f47,null));};exports[_0x71d6('0xfb')]=function(_0x14b62f,_0x826f4a){var _0x58798e={'raw':![],'where':{}};var _0x154d34={};var _0x252d78={'count':0x0,'rows':[]};return db[_0x71d6('0x4e')][_0x71d6('0x7f')]({'where':{'id':_0x14b62f[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x826f4a,null))['then'](function(_0xc62f87){if(_0xc62f87){_0x154d34[_0x71d6('0x45')]=_[_0x71d6('0x51')](db[_0x71d6('0xbc')]['rawAttributes']);_0x154d34[_0x71d6('0x52')]=_[_0x71d6('0x51')](_0x14b62f[_0x71d6('0x52')]);_0x154d34[_0x71d6('0x53')]=_[_0x71d6('0x54')](_0x154d34[_0x71d6('0x45')],_0x154d34[_0x71d6('0x52')]);_0x58798e['attributes']=_['intersection'](_0x154d34[_0x71d6('0x45')],qs[_0x71d6('0x56')](_0x14b62f[_0x71d6('0x52')]['fields']));_0x58798e['attributes']=_0x58798e[_0x71d6('0x55')][_0x71d6('0x57')]?_0x58798e['attributes']:_0x154d34[_0x71d6('0x45')];if(!_0x14b62f[_0x71d6('0x52')][_0x71d6('0x58')](_0x71d6('0x59'))){_0x58798e[_0x71d6('0x2e')]=qs[_0x71d6('0x2e')](_0x14b62f[_0x71d6('0x52')][_0x71d6('0x2e')]);_0x58798e[_0x71d6('0x2c')]=qs[_0x71d6('0x2c')](_0x14b62f[_0x71d6('0x52')][_0x71d6('0x2c')]);}_0x58798e['order']=qs[_0x71d6('0x5b')](_0x14b62f['query'][_0x71d6('0x5b')]);_0x58798e[_0x71d6('0x5c')]=qs[_0x71d6('0x53')](_[_0x71d6('0x5d')](_0x14b62f[_0x71d6('0x52')],_0x154d34[_0x71d6('0x53')]));_0x58798e[_0x71d6('0x5c')]['ChatWebsiteId']=_0xc62f87['id'];if(_0x14b62f[_0x71d6('0x52')][_0x71d6('0x5e')]){_0x58798e[_0x71d6('0x5c')]=_[_0x71d6('0x5f')](_0x58798e[_0x71d6('0x5c')],{'$or':_[_0x71d6('0x4d')](_0x58798e[_0x71d6('0x55')],function(_0x2c94ac){var _0x2c65c5={};_0x2c65c5[_0x2c94ac]={'$like':'%'+_0x14b62f[_0x71d6('0x52')][_0x71d6('0x5e')]+'%'};return _0x2c65c5;})});}_0x58798e=_['merge']({},_0x58798e,_0x14b62f[_0x71d6('0x60')]);return db[_0x71d6('0xbc')]['count']({'where':_0x58798e[_0x71d6('0x5c')]})[_0x71d6('0x1d')](function(_0x5e133c){_0x252d78[_0x71d6('0x2f')]=_0x5e133c;if(_0x14b62f[_0x71d6('0x52')][_0x71d6('0x66')]){_0x58798e[_0x71d6('0x61')]=[{'model':db[_0x71d6('0xa1')],'as':_0x71d6('0xfc'),'required':![]},{'model':db[_0x71d6('0xc6')],'as':_0x71d6('0xfd'),'attributes':['name',_0x71d6('0xfe'),'internal'],'required':![]},{'model':db[_0x71d6('0xff')],'as':_0x71d6('0x100'),'attributes':['id',_0x71d6('0x37'),_0x71d6('0x101')],'where':_0x14b62f[_0x71d6('0x52')][_0x71d6('0x102')]?{'id':_0x14b62f[_0x71d6('0x52')][_0x71d6('0x102')]}:undefined,'required':_0x14b62f[_0x71d6('0x52')][_0x71d6('0x102')]?!![]:![]}];}return db[_0x71d6('0xbc')][_0x71d6('0x62')](_0x58798e);})[_0x71d6('0x1d')](function(_0x2e823c){_0x252d78[_0x71d6('0x63')]=_0x2e823c;return _0x252d78;});}})[_0x71d6('0x1d')](respondWithFilteredResult(_0x826f4a,_0x58798e))[_0x71d6('0x27')](handleError(_0x826f4a,null));};exports['getSnippet']=function(_0x301aaf,_0x27f1ec){var _0x5ce100=0x0;var _0x5e17a0=0x0;var _0x483819=![];var _0x310185;var _0x399055;return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x301aaf[_0x71d6('0x65')]['id']},'include':[{'model':db[_0x71d6('0xac')],'as':_0x71d6('0xac'),'include':[{'model':db[_0x71d6('0xac')],'as':_0x71d6('0x103'),'attributes':['id',_0x71d6('0xad')]}]}]})['then'](handleEntityNotFound(_0x27f1ec,null))['then'](function(_0x462556){if(_0x462556){_0x310185=_0x462556;return _0x462556[_0x71d6('0x104')]({'raw':!![]});}})['then'](function(_0x1b4188){if(_0x310185){if(_0x1b4188){_0x399055=_0x1b4188;}}return require(_0x71d6('0x8b'))[_0x71d6('0x105')]();})['then'](function(_0x5ca131){if(_0x5ca131){_0x5e17a0=_0x5ca131[_0x71d6('0x106')];_0x483819=_0x5ca131[_0x71d6('0x107')];}})[_0x71d6('0x1d')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x71d6('0x1d')](function(_0x54c213){_0x5ce100=_0x54c213;if(_0x5e17a0&&_0x54c213>_0x5e17a0){return db[_0x71d6('0x108')][_0x71d6('0x7f')]({'where':{'id':0x1}})[_0x71d6('0x1d')](function(_0x5c31e8){if(_0x5c31e8){_0x5c31e8[_0x71d6('0x109')](_0x71d6('0x10a'));}});}})['then'](function(){var _0x320890=_0x310185[_0x71d6('0xac')];var _0x29d73e=_0x310185['timezone']||undefined;return _0x320890?_0x320890[_0x71d6('0x9a')](_0x29d73e):!![];})[_0x71d6('0x1d')](function(_0x414f6f){var _0x21b0de=fs[_0x71d6('0xde')](path[_0x71d6('0x8e')](config[_0x71d6('0x8a')],_0x71d6('0x10b')),_0x71d6('0x10c'));var _0x478f4f=_0x71d6('0x10d');var _0x2b2a97=![];var _0x3ce56d,_0x1a5552;if(_0x301aaf['headers'][_0x71d6('0xa0')]){_0x3ce56d=new URL(_0x301aaf['headers'][_0x71d6('0xa0')])[_0x71d6('0x10e')];}else if(_0x301aaf[_0x71d6('0x10f')]['origin']){_0x3ce56d=new URL(_0x301aaf[_0x71d6('0x10f')][_0x71d6('0x10e')])[_0x71d6('0x10e')];}else{_0x3ce56d=_0x71d6('0x110');}_0x1a5552=typeof _0x310185['address'][_0x71d6('0x6a')](',')[_0x71d6('0x73')](function(_0x255c56){return wildcardUtils[_0x71d6('0x111')](_0x255c56,_0x3ce56d);})!==_0x71d6('0x2d');var _0xffcb98={'chatVersion':_0x478f4f,'chatWebsiteAddressOrigin':_0x1a5552?_0x3ce56d:_0x310185['address'],'remote':_0x310185[_0x71d6('0x112')],'query':querystring['stringify'](_[_0x71d6('0x5f')](_0x310185[_0x71d6('0x34')]({'plain':!![]}),{'customerIp':_0x301aaf[_0x71d6('0x10f')][_0x71d6('0x3d')]||_0x301aaf['headers']['x-real-ip']||_0x301aaf[_0x71d6('0x113')][_0x71d6('0x114')]||_0x301aaf['ip'],'referer':_0x301aaf[_0x71d6('0x10f')][_0x71d6('0xa0')],'openedInteractions':_0x5ce100,'maxInteractions':_0x5e17a0,'virtual':_0x483819[_0x71d6('0x106')],'online':_0x414f6f,'custom':_0x483819,'address':_0x1a5552?_0x3ce56d:null}))[_0x71d6('0x115')](/'/g,'\x5c\x27')};_0x27f1ec[_0x71d6('0x38')](ejs['render'](Mustache[_0x71d6('0x116')](_0x21b0de,_0xffcb98),{'proactiveActions':_0x399055,'alignment':_0x310185['alignment'],'verticalAlignment':_0x310185[_0x71d6('0x117')],'div_color':_0x310185[_0x71d6('0x101')],'labelText':_0x310185[_0x71d6('0x118')],'text_color':_0x310185['textColor'],'text_button_color':_0x310185[_0x71d6('0x119')],'button_color':_0x310185[_0x71d6('0x11a')],'background_color':_0x310185[_0x71d6('0x11b')],'hideWhenOffline':_0x310185[_0x71d6('0x11c')],'intervalId':_0x310185['IntervalId'],'isDevelopment':_0x2b2a97,'chatVersion':_0x478f4f}));})[_0x71d6('0x27')](handleError(_0x27f1ec,null));};exports[_0x71d6('0x11d')]=function(_0x231136,_0x50f8e1){var _0x571431=_0x231136[_0x71d6('0x65')]['id'];var _0x58c8f7=_0x231136['body'];var _0x157609=0xc8;var _0x5cd17a=null;return db['sequelize'][_0x71d6('0xe6')]({'isolationLevel':db[_0x71d6('0xe5')][_0x71d6('0x11e')][_0x71d6('0x11f')][_0x71d6('0x120')]},function(_0x30b6e1){return db['ChatWebsite'][_0x71d6('0x7f')]({'where':{'id':_0x571431},'transaction':_0x30b6e1})[_0x71d6('0x1d')](function(_0x440388){if(_0x440388){return db[_0x71d6('0xaa')][_0x71d6('0x33')]({'where':{'ChatWebsiteId':_0x571431},'transaction':_0x30b6e1})['then'](function(){var _0x2a9e5f=_[_0x71d6('0x4d')](_0x58c8f7,function(_0x261744){_0x261744[_0x71d6('0x7a')]=_0x571431;return _0x261744;});return db[_0x71d6('0xaa')][_0x71d6('0xe8')](_0x2a9e5f,{'transaction':_0x30b6e1});});}else{_0x157609=0x194;_0x5cd17a=[];}});})[_0x71d6('0x1d')](function(){if(_0x157609!==0x194){return db['ChatApplication'][_0x71d6('0x121')]({'where':{'ChatWebsiteId':_0x571431},'order':_0x71d6('0xb2')})['then'](function(_0x2344bc){_0x5cd17a=_0x2344bc;});}})[_0x71d6('0x27')](function(_0x20b491){_0x157609=0x1f4;logger[_0x71d6('0x24')](_0x20b491[_0x71d6('0x36')]);if(_0x20b491['name']){delete _0x20b491[_0x71d6('0x37')];}_0x5cd17a=_0x20b491;})[_0x71d6('0x122')](function(){if(_0x5cd17a===null){_0x50f8e1['sendStatus'](_0x157609);}else{if(_0x157609===0x1f4){_0x50f8e1[_0x71d6('0x29')](_0x157609)['send'](_0x5cd17a);}else{_0x50f8e1[_0x71d6('0x29')](_0x157609)[_0x71d6('0x2b')](_0x5cd17a);}}});};exports[_0x71d6('0x123')]=function(_0x542d05,_0x2893ba){var _0x11de10={};var _0x38c814={};var _0x3994a9;var _0x47cb42;return db[_0x71d6('0x4e')][_0x71d6('0x7f')]({'where':{'id':_0x542d05['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x2893ba,null))[_0x71d6('0x1d')](function(_0x3ebab2){if(_0x3ebab2){_0x3994a9=_0x3ebab2;_0x38c814[_0x71d6('0x45')]=_[_0x71d6('0x51')](db[_0x71d6('0xaa')][_0x71d6('0x4f')]);_0x38c814[_0x71d6('0x52')]=_[_0x71d6('0x51')](_0x542d05[_0x71d6('0x52')]);_0x38c814[_0x71d6('0x53')]=_[_0x71d6('0x54')](_0x38c814['model'],_0x38c814[_0x71d6('0x52')]);_0x11de10['attributes']=_['intersection'](_0x38c814[_0x71d6('0x45')],qs['fields'](_0x542d05['query'][_0x71d6('0x56')]));_0x11de10[_0x71d6('0x55')]=_0x11de10['attributes'][_0x71d6('0x57')]?_0x11de10['attributes']:_0x38c814['model'];_0x11de10[_0x71d6('0x5a')]=qs[_0x71d6('0x5b')](_0x542d05[_0x71d6('0x52')][_0x71d6('0x5b')]);_0x11de10[_0x71d6('0x5c')]=qs[_0x71d6('0x53')](_[_0x71d6('0x5d')](_0x542d05[_0x71d6('0x52')],_0x38c814[_0x71d6('0x53')]));if(_0x542d05[_0x71d6('0x52')]['filter']){_0x11de10[_0x71d6('0x5c')]=_['merge'](_0x11de10[_0x71d6('0x5c')],{'$or':_[_0x71d6('0x4d')](_0x11de10[_0x71d6('0x55')],function(_0x5db338){var _0x480726={};_0x480726[_0x5db338]={'$like':'%'+_0x542d05['query'][_0x71d6('0x5e')]+'%'};return _0x480726;})});}_0x11de10=_['merge']({},_0x11de10,_0x542d05[_0x71d6('0x60')]);return _0x3994a9['getApplications'](_0x11de10);}})[_0x71d6('0x1d')](function(_0x3527ce){if(_0x3527ce){_0x47cb42=_0x3527ce[_0x71d6('0x57')];if(!_0x542d05['query'][_0x71d6('0x58')](_0x71d6('0x59'))){_0x11de10[_0x71d6('0x2e')]=qs[_0x71d6('0x2e')](_0x542d05['query'][_0x71d6('0x2e')]);_0x11de10[_0x71d6('0x2c')]=qs['offset'](_0x542d05[_0x71d6('0x52')][_0x71d6('0x2c')]);}return _0x3994a9['getApplications'](_0x11de10);}})[_0x71d6('0x1d')](function(_0x37ae6f){if(_0x37ae6f){return _0x37ae6f?{'count':_0x47cb42,'rows':_0x37ae6f}:null;}})['then'](respondWithResult(_0x2893ba,null))[_0x71d6('0x27')](handleError(_0x2893ba,null));};exports['addProactiveActions']=function(_0x79cdd,_0x48a458){return db[_0x71d6('0x124')][_0x71d6('0x73')]({'where':{'id':_0x79cdd[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x48a458,null))[_0x71d6('0x1d')](function(_0xea8c0b){if(_0xea8c0b){return _0xea8c0b[_0x71d6('0x125')](_0x79cdd[_0x71d6('0x68')][_0x71d6('0x7c')],_[_0x71d6('0xfa')](_0x79cdd['body'],['ids','id'])||{});}})[_0x71d6('0x1d')](respondWithResult(_0x48a458,null))['catch'](handleError(_0x48a458,null));};exports['getProactiveActions']=function(_0xa0140c,_0x5a58d1){var _0x460149={};var _0x15765c={};var _0x310c19;var _0x142385;return db['ChatWebsite'][_0x71d6('0x7f')]({'where':{'id':_0xa0140c[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x5a58d1,null))['then'](function(_0x424bd8){if(_0x424bd8){_0x310c19=_0x424bd8;_0x15765c['model']=_[_0x71d6('0x51')](db[_0x71d6('0x126')][_0x71d6('0x4f')]);_0x15765c['query']=_['keys'](_0xa0140c[_0x71d6('0x52')]);_0x15765c[_0x71d6('0x53')]=_[_0x71d6('0x54')](_0x15765c[_0x71d6('0x45')],_0x15765c['query']);_0x460149[_0x71d6('0x55')]=_[_0x71d6('0x54')](_0x15765c[_0x71d6('0x45')],qs['fields'](_0xa0140c[_0x71d6('0x52')]['fields']));_0x460149[_0x71d6('0x55')]=_0x460149['attributes']['length']?_0x460149[_0x71d6('0x55')]:_0x15765c[_0x71d6('0x45')];_0x460149[_0x71d6('0x5a')]=qs[_0x71d6('0x5b')](_0xa0140c['query']['sort']);_0x460149['where']=qs['filters'](_[_0x71d6('0x5d')](_0xa0140c[_0x71d6('0x52')],_0x15765c[_0x71d6('0x53')]));if(_0xa0140c[_0x71d6('0x52')]['filter']){_0x460149[_0x71d6('0x5c')]=_['merge'](_0x460149['where'],{'$or':_[_0x71d6('0x4d')](_0x460149['attributes'],function(_0xc5fe){var _0x15197b={};_0x15197b[_0xc5fe]={'$like':'%'+_0xa0140c[_0x71d6('0x52')][_0x71d6('0x5e')]+'%'};return _0x15197b;})});}_0x460149=_['merge']({},_0x460149,_0xa0140c[_0x71d6('0x60')]);return _0x310c19[_0x71d6('0x104')](_0x460149);}})[_0x71d6('0x1d')](function(_0x4e6e5d){if(_0x4e6e5d){_0x142385=_0x4e6e5d[_0x71d6('0x57')];if(!_0xa0140c[_0x71d6('0x52')]['hasOwnProperty']('nolimit')){_0x460149[_0x71d6('0x2e')]=qs[_0x71d6('0x2e')](_0xa0140c['query'][_0x71d6('0x2e')]);_0x460149[_0x71d6('0x2c')]=qs[_0x71d6('0x2c')](_0xa0140c[_0x71d6('0x52')][_0x71d6('0x2c')]);}return _0x310c19['getProactiveActions'](_0x460149);}})[_0x71d6('0x1d')](function(_0xc90d4){if(_0xc90d4){return _0xc90d4?{'count':_0x142385,'rows':_0xc90d4}:null;}})['then'](respondWithResult(_0x5a58d1,null))['catch'](handleError(_0x5a58d1,null));};exports[_0x71d6('0x127')]=function(_0x43e1ae,_0x376c58){var _0x52ff4f=_0x43e1ae[_0x71d6('0x52')]['online']==='false'?_0x71d6('0x128'):_0x71d6('0x129');return db[_0x71d6('0x4e')]['find']({'attributes':['id',_0x52ff4f],'where':{'id':_0x43e1ae['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x376c58,null))['then'](function(_0x388b31){if(_0x388b31){var _0x2dfd03=_0x388b31[_0x52ff4f];var _0x97e577=_0x2dfd03&&_0x2dfd03[_0x71d6('0x12a')]?_0x2dfd03[_0x71d6('0x12a')]:[];_0x376c58[_0x71d6('0x38')]({'fromKey':_[_0x71d6('0x8c')](_0x2dfd03[_0x71d6('0x12b')])?undefined:_0x2dfd03[_0x71d6('0x12b')],'count':_0x97e577[_0x71d6('0x57')],'rows':_0x97e577});}})[_0x71d6('0x27')](handleError(_0x376c58,null));};exports[_0x71d6('0x12c')]=function(_0x5e2104,_0x25c17f){var _0x240931={'raw':![],'where':{}};var _0x3259db={};var _0x4e1581={'count':0x0,'rows':[]};return db[_0x71d6('0x4e')]['findOne']({'where':{'id':_0x5e2104[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x25c17f,null))[_0x71d6('0x1d')](function(_0xffad9e){if(_0xffad9e){_0x3259db[_0x71d6('0x45')]=_[_0x71d6('0x51')](db[_0x71d6('0x12d')][_0x71d6('0x4f')]);_0x3259db[_0x71d6('0x52')]=_[_0x71d6('0x51')](_0x5e2104[_0x71d6('0x52')]);_0x3259db['filters']=_[_0x71d6('0x54')](_0x3259db[_0x71d6('0x45')],_0x3259db[_0x71d6('0x52')]);_0x240931[_0x71d6('0x55')]=_[_0x71d6('0x54')](_0x3259db[_0x71d6('0x45')],qs['fields'](_0x5e2104['query'][_0x71d6('0x56')]));_0x240931[_0x71d6('0x55')]=_0x240931['attributes'][_0x71d6('0x57')]?_0x240931[_0x71d6('0x55')]:_0x3259db[_0x71d6('0x45')];if(!_0x5e2104[_0x71d6('0x52')][_0x71d6('0x58')](_0x71d6('0x59'))){_0x240931[_0x71d6('0x2e')]=qs[_0x71d6('0x2e')](_0x5e2104[_0x71d6('0x52')][_0x71d6('0x2e')]);_0x240931[_0x71d6('0x2c')]=qs[_0x71d6('0x2c')](_0x5e2104[_0x71d6('0x52')][_0x71d6('0x2c')]);}_0x240931['order']=qs[_0x71d6('0x5b')](_0x5e2104[_0x71d6('0x52')]['sort']);_0x240931['where']=qs['filters'](_[_0x71d6('0x5d')](_0x5e2104[_0x71d6('0x52')],_0x3259db[_0x71d6('0x53')]));_0x240931[_0x71d6('0x5c')][_0x71d6('0x7a')]=_0xffad9e['id'];if(_0x5e2104['query']['filter']){_0x240931[_0x71d6('0x5c')]=_[_0x71d6('0x5f')](_0x240931['where'],{'$or':_['map'](_0x240931[_0x71d6('0x55')],function(_0xdd2a84){var _0x304108={};_0x304108[_0xdd2a84]={'$like':'%'+_0x5e2104['query'][_0x71d6('0x5e')]+'%'};return _0x304108;})});}_0x240931=_[_0x71d6('0x5f')]({},_0x240931,_0x5e2104[_0x71d6('0x60')]);return db[_0x71d6('0x12d')][_0x71d6('0x2f')]({'where':_0x240931[_0x71d6('0x5c')]})['then'](function(_0x52601b){_0x4e1581['count']=_0x52601b;if(_0x5e2104[_0x71d6('0x52')][_0x71d6('0x66')]){_0x240931[_0x71d6('0x61')]=[{'all':!![]}];}else{_0x240931['include']=[{'model':db['CmContact'],'as':_0x71d6('0xfc'),'required':![]},{'model':db[_0x71d6('0xe7')],'as':_0x71d6('0x12e'),'required':![]}];}return db[_0x71d6('0x12d')][_0x71d6('0x62')](_0x240931);})[_0x71d6('0x1d')](function(_0x1132ca){_0x4e1581[_0x71d6('0x63')]=_0x1132ca;return _0x4e1581;});}})[_0x71d6('0x1d')](respondWithFilteredResult(_0x25c17f,_0x240931))[_0x71d6('0x27')](handleError(_0x25c17f,null));};exports[_0x71d6('0x12f')]=function(_0x948058,_0x3be68b){return db[_0x71d6('0x4e')][_0x71d6('0x73')]({'where':{'id':_0x948058[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x3be68b,null))[_0x71d6('0x1d')](function(_0x487bc9){if(_0x487bc9){return _0x487bc9[_0x71d6('0x12f')](_0x948058['body'][_0x71d6('0x7c')],_['omit'](_0x948058['body'],[_0x71d6('0x7c'),'id'])||{})[_0x71d6('0x130')](function(_0x45206c){for(var _0x57c6ad=0x0;_0x57c6ad<_0x948058[_0x71d6('0x68')]['ids'][_0x71d6('0x57')];_0x57c6ad+=0x1){socket[_0x71d6('0x131')](_0x71d6('0x132'),{'UserId':Number(_0x948058[_0x71d6('0x68')][_0x71d6('0x7c')][_0x57c6ad]),'ChatWebsiteId':Number(_0x948058[_0x71d6('0x65')]['id'])});}return _0x45206c;});}})[_0x71d6('0x1d')](respondWithResult(_0x3be68b,null))['catch'](handleError(_0x3be68b,null));};exports[_0x71d6('0x133')]=function(_0x51ce0a,_0x17b21b){return db[_0x71d6('0x4e')]['find']({'where':{'id':_0x51ce0a[_0x71d6('0x65')]['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x17b21b,null))[_0x71d6('0x1d')](function(_0x29c6d9){if(_0x29c6d9){return _0x29c6d9[_0x71d6('0x133')](_0x51ce0a[_0x71d6('0x52')]['ids'])[_0x71d6('0x1d')](function(){if(_[_0x71d6('0x134')](_0x51ce0a['query'][_0x71d6('0x7c')])){for(var _0x39617d=0x0;_0x39617d<_0x51ce0a[_0x71d6('0x52')][_0x71d6('0x7c')]['length'];_0x39617d+=0x1){socket[_0x71d6('0x131')](_0x71d6('0x135'),{'UserId':Number(_0x51ce0a['query'][_0x71d6('0x7c')][_0x39617d]),'ChatWebsiteId':Number(_0x51ce0a[_0x71d6('0x65')]['id'])});}}else{socket[_0x71d6('0x131')](_0x71d6('0x135'),{'UserId':Number(_0x51ce0a[_0x71d6('0x52')][_0x71d6('0x7c')]),'ChatWebsiteId':Number(_0x51ce0a[_0x71d6('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x17b21b,null))[_0x71d6('0x27')](handleError(_0x17b21b,null));};exports[_0x71d6('0x136')]=function(_0x406b5e,_0x54f6b5){var _0xd05181={};var _0x207a00={};var _0x3a0ceb;var _0x293ee9;return db['ChatWebsite']['findOne']({'where':{'id':_0x406b5e['params']['id']}})[_0x71d6('0x1d')](handleEntityNotFound(_0x54f6b5,null))['then'](function(_0x474a68){if(_0x474a68){_0x3a0ceb=_0x474a68;_0x207a00[_0x71d6('0x45')]=_[_0x71d6('0x51')](db[_0x71d6('0xc6')]['rawAttributes']);_0x207a00['query']=_[_0x71d6('0x51')](_0x406b5e[_0x71d6('0x52')]);_0x207a00[_0x71d6('0x53')]=_['intersection'](_0x207a00[_0x71d6('0x45')],_0x207a00[_0x71d6('0x52')]);_0xd05181['attributes']=_['intersection'](_0x207a00[_0x71d6('0x45')],qs['fields'](_0x406b5e[_0x71d6('0x52')][_0x71d6('0x56')]));_0xd05181[_0x71d6('0x55')]=_0xd05181[_0x71d6('0x55')][_0x71d6('0x57')]?_0xd05181[_0x71d6('0x55')]:_0x207a00[_0x71d6('0x45')];_0xd05181['order']=qs[_0x71d6('0x5b')](_0x406b5e[_0x71d6('0x52')][_0x71d6('0x5b')]);_0xd05181[_0x71d6('0x5c')]=qs['filters'](_['pick'](_0x406b5e[_0x71d6('0x52')],_0x207a00[_0x71d6('0x53')]));if(_0x406b5e[_0x71d6('0x52')][_0x71d6('0x5e')]){_0xd05181[_0x71d6('0x5c')]=_[_0x71d6('0x5f')](_0xd05181[_0x71d6('0x5c')],{'$or':_[_0x71d6('0x4d')](_0xd05181[_0x71d6('0x55')],function(_0x12d381){var _0x3eab3b={};_0x3eab3b[_0x12d381]={'$like':'%'+_0x406b5e[_0x71d6('0x52')][_0x71d6('0x5e')]+'%'};return _0x3eab3b;})});}_0xd05181=_[_0x71d6('0x5f')]({},_0xd05181,_0x406b5e[_0x71d6('0x60')]);return _0x3a0ceb[_0x71d6('0x136')](_0xd05181);}})[_0x71d6('0x1d')](function(_0x45ecfe){if(_0x45ecfe){_0x293ee9=_0x45ecfe[_0x71d6('0x57')];if(!_0x406b5e[_0x71d6('0x52')][_0x71d6('0x58')]('nolimit')){_0xd05181[_0x71d6('0x2e')]=qs[_0x71d6('0x2e')](_0x406b5e['query']['limit']);_0xd05181[_0x71d6('0x2c')]=qs[_0x71d6('0x2c')](_0x406b5e[_0x71d6('0x52')]['offset']);}return _0x3a0ceb[_0x71d6('0x136')](_0xd05181);}})[_0x71d6('0x1d')](function(_0x37b838){if(_0x37b838){return _0x37b838?{'count':_0x293ee9,'rows':_0x37b838}:null;}})[_0x71d6('0x1d')](respondWithResult(_0x54f6b5,null))[_0x71d6('0x27')](handleError(_0x54f6b5,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 838a839..22821d8 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 _0x6597=['ChatWebsite','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x14dd17,_0x3de3e2){var _0x6614b6=function(_0x58c886){while(--_0x58c886){_0x14dd17['push'](_0x14dd17['shift']());}};_0x6614b6(++_0x3de3e2);}(_0x6597,0x16e));var _0x7659=function(_0x34617a,_0x303563){_0x34617a=_0x34617a-0x0;var _0xf95099=_0x6597[_0x34617a];return _0xf95099;};'use strict';var EventEmitter=require(_0x7659('0x0'));var ChatWebsite=require(_0x7659('0x1'))['db'][_0x7659('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7659('0x3'),'afterUpdate':'update','afterDestroy':_0x7659('0x4')};function emitEvent(_0x4f5b89){return function(_0x5e96ed,_0x576e8b,_0xbcb138){ChatWebsiteEvents[_0x7659('0x5')](_0x4f5b89+':'+_0x5e96ed['id'],_0x5e96ed);ChatWebsiteEvents[_0x7659('0x5')](_0x4f5b89,_0x5e96ed);_0xbcb138(null);};}for(var e in events){if(events[_0x7659('0x6')](e)){var event=events[e];ChatWebsite[_0x7659('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xc906=['save','update','emit','events','../../mysqldb','setMaxListeners'];(function(_0x23e97f,_0x507ec6){var _0x594cb5=function(_0x146e34){while(--_0x146e34){_0x23e97f['push'](_0x23e97f['shift']());}};_0x594cb5(++_0x507ec6);}(_0xc906,0x1ad));var _0x6c90=function(_0xd72e2d,_0x28debd){_0xd72e2d=_0xd72e2d-0x0;var _0x49a3b4=_0xc906[_0xd72e2d];return _0x49a3b4;};'use strict';var EventEmitter=require(_0x6c90('0x0'));var ChatWebsite=require(_0x6c90('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6c90('0x2')](0x0);var events={'afterCreate':_0x6c90('0x3'),'afterUpdate':_0x6c90('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b57e1){return function(_0x237d5d,_0x3bb133,_0x395867){ChatWebsiteEvents[_0x6c90('0x5')](_0x3b57e1+':'+_0x237d5d['id'],_0x237d5d);ChatWebsiteEvents[_0x6c90('0x5')](_0x3b57e1,_0x237d5d);_0x395867(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](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 7b9768b..51d9660 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 _0x21de=['./chatWebsite.attributes','ChatWebsite','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xb40f40,_0x41708a){var _0x55c108=function(_0x5c4f7b){while(--_0x5c4f7b){_0xb40f40['push'](_0xb40f40['shift']());}};_0x55c108(++_0x41708a);}(_0x21de,0xb6));var _0xe21d=function(_0x2b8729,_0x163ea0){_0x2b8729=_0x2b8729-0x0;var _0x30e6bd=_0x21de[_0x2b8729];return _0x30e6bd;};'use strict';var _=require(_0xe21d('0x0'));var util=require(_0xe21d('0x1'));var logger=require('../../config/logger')(_0xe21d('0x2'));var moment=require(_0xe21d('0x3'));var BPromise=require(_0xe21d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe21d('0x5'));var rimraf=require(_0xe21d('0x6'));var config=require(_0xe21d('0x7'));var attributes=require(_0xe21d('0x8'));module['exports']=function(_0x4447ba,_0x3a0d00){return _0x4447ba['define'](_0xe21d('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dee=['chat_websites','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x508b0a,_0x4f825b){var _0x4b695d=function(_0x4bf946){while(--_0x4bf946){_0x508b0a['push'](_0x508b0a['shift']());}};_0x4b695d(++_0x4f825b);}(_0x6dee,0x1b9));var _0xe6de=function(_0x333087,_0x2747ee){_0x333087=_0x333087-0x0;var _0x263ea9=_0x6dee[_0x333087];return _0x263ea9;};'use strict';var _=require(_0xe6de('0x0'));var util=require(_0xe6de('0x1'));var logger=require(_0xe6de('0x2'))(_0xe6de('0x3'));var moment=require(_0xe6de('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe6de('0x5'));var config=require(_0xe6de('0x6'));var attributes=require(_0xe6de('0x7'));module[_0xe6de('0x8')]=function(_0x453764,_0x26b8b8){return _0x453764[_0xe6de('0x9')]('ChatWebsite',attributes,{'tableName':_0xe6de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index e294e02..2c80e58 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 _0x5656=['request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x5656,0x9c));var _0x6565=function(_0x1d8e01,_0x482d5b){_0x1d8e01=_0x1d8e01-0x0;var _0x2753ea=_0x5656[_0x1d8e01];return _0x2753ea;};'use strict';var _=require(_0x6565('0x0'));var util=require(_0x6565('0x1'));var moment=require('moment');var BPromise=require(_0x6565('0x2'));var rs=require(_0x6565('0x3'));var fs=require('fs');var Redis=require(_0x6565('0x4'));var db=require(_0x6565('0x5'))['db'];var utils=require(_0x6565('0x6'));var logger=require(_0x6565('0x7'))(_0x6565('0x8'));var config=require(_0x6565('0x9'));var jayson=require(_0x6565('0xa'));var client=jayson['client'][_0x6565('0xb')]({'port':0x232a});config[_0x6565('0xc')]=_[_0x6565('0xd')](config[_0x6565('0xc')],{'host':_0x6565('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6565('0xc')]));require(_0x6565('0xf'))['register'](socket);function respondWithRpcPromise(_0x3c7d30,_0x438165,_0x4597fc){return new BPromise(function(_0x197696,_0xbc2418){return client[_0x6565('0x10')](_0x3c7d30,_0x4597fc)['then'](function(_0x437290){logger[_0x6565('0x11')](_0x6565('0x12'),_0x438165,_0x6565('0x13'));logger[_0x6565('0x14')](_0x6565('0x15'),_0x438165,'request\x20sent',JSON['stringify'](_0x437290));if(_0x437290[_0x6565('0x16')]){if(_0x437290[_0x6565('0x16')]['code']===0x1f4){logger[_0x6565('0x16')](_0x6565('0x12'),_0x438165,_0x437290['error']['message']);return _0xbc2418(_0x437290['error'][_0x6565('0x17')]);}logger[_0x6565('0x16')](_0x6565('0x12'),_0x438165,_0x437290['error'][_0x6565('0x17')]);return _0x197696(_0x437290[_0x6565('0x16')][_0x6565('0x17')]);}else{logger[_0x6565('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x438165,'request\x20sent');_0x197696(_0x437290[_0x6565('0x18')][_0x6565('0x17')]);}})['catch'](function(_0x5edbbd){logger[_0x6565('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x438165,_0x5edbbd);_0xbc2418(_0x5edbbd);});});} \ No newline at end of file +var _0x83c2=['ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment','randomstring'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x83c2,0x189));var _0x283c=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x83c2[_0x3a19d4];return _0x5b858b;};'use strict';var _=require('lodash');var util=require(_0x283c('0x0'));var moment=require(_0x283c('0x1'));var BPromise=require('bluebird');var rs=require(_0x283c('0x2'));var fs=require('fs');var Redis=require(_0x283c('0x3'));var db=require(_0x283c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x283c('0x5'));var config=require(_0x283c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x283c('0x7')][_0x283c('0x8')]({'port':0x232a});config[_0x283c('0x9')]=_[_0x283c('0xa')](config['redis'],{'host':_0x283c('0xb'),'port':0x18eb});var socket=require(_0x283c('0xc'))(new Redis(config[_0x283c('0x9')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x50da0f,_0x3b4d67,_0xd61462){return new BPromise(function(_0x48808,_0x1ae504){return client[_0x283c('0xd')](_0x50da0f,_0xd61462)[_0x283c('0xe')](function(_0x24016a){logger[_0x283c('0xf')](_0x283c('0x10'),_0x3b4d67,_0x283c('0x11'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3b4d67,_0x283c('0x11'),JSON[_0x283c('0x12')](_0x24016a));if(_0x24016a[_0x283c('0x13')]){if(_0x24016a[_0x283c('0x13')]['code']===0x1f4){logger[_0x283c('0x13')](_0x283c('0x10'),_0x3b4d67,_0x24016a[_0x283c('0x13')][_0x283c('0x14')]);return _0x1ae504(_0x24016a[_0x283c('0x13')][_0x283c('0x14')]);}logger['error'](_0x283c('0x10'),_0x3b4d67,_0x24016a[_0x283c('0x13')]['message']);return _0x48808(_0x24016a[_0x283c('0x13')][_0x283c('0x14')]);}else{logger[_0x283c('0xf')](_0x283c('0x10'),_0x3b4d67,_0x283c('0x11'));_0x48808(_0x24016a[_0x283c('0x15')][_0x283c('0x14')]);}})['catch'](function(_0x4889f0){logger['error'](_0x283c('0x10'),_0x3b4d67,_0x4889f0);_0x1ae504(_0x4889f0);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 29d3c2b..da2c047 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 _0xc529=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0xe67a97,_0x4fcfd7){var _0x3a0a25=function(_0x598209){while(--_0x598209){_0xe67a97['push'](_0xe67a97['shift']());}};_0x3a0a25(++_0x4fcfd7);}(_0xc529,0x188));var _0x9c52=function(_0x452985,_0x1ca4af){_0x452985=_0x452985-0x0;var _0x115294=_0xc529[_0x452985];return _0x115294;};'use strict';var ChatWebsiteEvents=require(_0x9c52('0x0'));var events=[_0x9c52('0x1'),_0x9c52('0x2'),_0x9c52('0x3')];function createListener(_0x111591,_0xdf53f2){return function(_0x283dfa){_0xdf53f2[_0x9c52('0x4')](_0x111591,_0x283dfa);};}function removeListener(_0x5e142a,_0x1629e1){return function(){ChatWebsiteEvents[_0x9c52('0x5')](_0x5e142a,_0x1629e1);};}exports[_0x9c52('0x6')]=function(_0x6389cd){for(var _0x5bdca5=0x0,_0x30f5c9=events[_0x9c52('0x7')];_0x5bdca5<_0x30f5c9;_0x5bdca5++){var _0x19c470=events[_0x5bdca5];var _0x11f811=createListener(_0x9c52('0x8')+_0x19c470,_0x6389cd);ChatWebsiteEvents['on'](_0x19c470,_0x11f811);}}; \ No newline at end of file +var _0x6aa9=['save','remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x46162d,_0x377646){var _0x375832=function(_0x5d23f0){while(--_0x5d23f0){_0x46162d['push'](_0x46162d['shift']());}};_0x375832(++_0x377646);}(_0x6aa9,0x18b));var _0x96aa=function(_0x3e0461,_0x45d88c){_0x3e0461=_0x3e0461-0x0;var _0x34dc85=_0x6aa9[_0x3e0461];return _0x34dc85;};'use strict';var ChatWebsiteEvents=require(_0x96aa('0x0'));var events=[_0x96aa('0x1'),_0x96aa('0x2'),_0x96aa('0x3')];function createListener(_0x1afa39,_0x2e6baa){return function(_0x2f3496){_0x2e6baa[_0x96aa('0x4')](_0x1afa39,_0x2f3496);};}function removeListener(_0x502266,_0x1a3d35){return function(){ChatWebsiteEvents[_0x96aa('0x5')](_0x502266,_0x1a3d35);};}exports[_0x96aa('0x6')]=function(_0x36c382){for(var _0x35d335=0x0,_0x3f411d=events[_0x96aa('0x7')];_0x35d335<_0x3f411d;_0x35d335++){var _0x5377e9=events[_0x35d335];var _0x3e9bcf=createListener(_0x96aa('0x8')+_0x5377e9,_0x36c382);ChatWebsiteEvents['on'](_0x5377e9,_0x3e9bcf);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 9e06825..497938d 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaf2=['exports','../../../utils/misc','escapeRegExp','url','URL','replace','localhost','test','trim','([\x5cw]+)'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xfaf2,0x169));var _0x2faf=function(_0xf9fa3c,_0x516842){_0xf9fa3c=_0xf9fa3c-0x0;var _0x1a49eb=_0xfaf2[_0xf9fa3c];return _0x1a49eb;};var escapeRegExp=require(_0x2faf('0x0'))[_0x2faf('0x1')];var URL=require(_0x2faf('0x2'))[_0x2faf('0x3')];function testWildcardValidity(_0x2f673c){var _0x4b9362=!![];try{new URL(_0x2f673c[_0x2faf('0x4')]('*',_0x2faf('0x5')));}catch(_0x1be5d0){_0x4b9362=![];}return _0x4b9362&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2faf('0x6')](_0x2f673c);}function testWebsiteWithWildcard(_0x1b9f32,_0x579955){var _0x4eacb2;var _0x5cf241=escapeRegExp(_0x1b9f32[_0x2faf('0x7')]()[_0x2faf('0x4')](/\/$/,''))[_0x2faf('0x4')]('\x5c*',_0x2faf('0x8'));try{new URL(_0x1b9f32[_0x2faf('0x4')]('\x5c*','localhost'));_0x4eacb2=new RegExp(_0x5cf241)['test'](_0x579955);}catch(_0x9c958c){_0x4eacb2=![];}return _0x4eacb2;}module[_0x2faf('0x9')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x7da6=['localhost','test','trim','([\x5cw]+)','exports','url','URL'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7da6,0x124));var _0x67da=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0x7da6[_0x47f7ec];return _0x415101;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require(_0x67da('0x0'))[_0x67da('0x1')];function testWildcardValidity(_0xb594a8){var _0x3d2962=!![];try{new URL(_0xb594a8['replace']('*',_0x67da('0x2')));}catch(_0x282a52){_0x3d2962=![];}return _0x3d2962&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x67da('0x3')](_0xb594a8);}function testWebsiteWithWildcard(_0x2d4937,_0x314da7){var _0x40d5f8;var _0x59af9a=escapeRegExp(_0x2d4937[_0x67da('0x4')]()['replace'](/\/$/,''))['replace']('\x5c*',_0x67da('0x5'));try{new URL(_0x2d4937['replace']('\x5c*',_0x67da('0x2')));_0x40d5f8=new RegExp(_0x59af9a)['test'](_0x314da7);}catch(_0x1e8a4c){_0x40d5f8=![];}return _0x40d5f8;}module[_0x67da('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ac1dcdd..5c421e9 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 _0xa128=['getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','addDisposition','addAnswer','diskStorage','root','%s-%s','originalname','post','single','file','addLogo','server/files/images/avatars/','now','/:id/avatar','addAvatar','join','format','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addProactiveActions','/:id/users','addAgents','put','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa128,0xc4));var _0x8a12=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xa128[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0x8a12('0x0'));var util=require(_0x8a12('0x1'));var path=require('path');var timeout=require(_0x8a12('0x2'));var express=require('express');var router=express[_0x8a12('0x3')]();var fs_extra=require(_0x8a12('0x4'));var auth=require(_0x8a12('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8a12('0x6'));var controller=require(_0x8a12('0x7'));router[_0x8a12('0x8')]('/',auth['isAuthenticated'](),controller[_0x8a12('0x9')]);router[_0x8a12('0x8')](_0x8a12('0xa'),auth[_0x8a12('0xb')](),controller[_0x8a12('0xc')]);router[_0x8a12('0x8')](_0x8a12('0xd'),auth[_0x8a12('0xb')](),controller[_0x8a12('0xe')]);router[_0x8a12('0x8')](_0x8a12('0xf'),auth[_0x8a12('0xb')](),controller[_0x8a12('0x10')]);router[_0x8a12('0x8')]('/:id/canned_answers',auth[_0x8a12('0xb')](),controller[_0x8a12('0x11')]);router[_0x8a12('0x8')](_0x8a12('0x12'),controller[_0x8a12('0x13')]);router[_0x8a12('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x8a12('0x8')](_0x8a12('0x14'),controller[_0x8a12('0x15')]);router[_0x8a12('0x8')](_0x8a12('0x16'),controller[_0x8a12('0x17')]);router[_0x8a12('0x8')](_0x8a12('0x18'),auth[_0x8a12('0xb')](),controller[_0x8a12('0x19')]);router['get'](_0x8a12('0x1a'),controller[_0x8a12('0x1b')]);router['get'](_0x8a12('0x1c'),auth[_0x8a12('0xb')](),controller[_0x8a12('0x1d')]);router[_0x8a12('0x8')](_0x8a12('0x1e'),auth['isAuthenticated'](),controller[_0x8a12('0x1f')]);router['get']('/:id/fields',controller[_0x8a12('0x20')]);router['get'](_0x8a12('0x21'),auth[_0x8a12('0xb')](),controller[_0x8a12('0x22')]);router[_0x8a12('0x8')]('/:id/users',auth[_0x8a12('0xb')](),controller[_0x8a12('0x23')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a12('0x24')]);router['post']('/:id/dispositions',auth[_0x8a12('0xb')](),controller[_0x8a12('0x25')]);router['post']('/:id/canned_answers',auth[_0x8a12('0xb')](),controller[_0x8a12('0x26')]);var upload=multer({'storage':multer[_0x8a12('0x27')]({'destination':function(_0xa0b3df,_0x175e28,_0x5b7fae){_0x5b7fae(null,path['join'](config[_0x8a12('0x28')],'server/files/images/logos/'));},'filename':function(_0x33aed1,_0x2997c0,_0x1d84c1){_0x1d84c1(null,util['format'](_0x8a12('0x29'),Date['now'](),_0x2997c0[_0x8a12('0x2a')]));}})});router[_0x8a12('0x2b')](_0x8a12('0x12'),upload[_0x8a12('0x2c')](_0x8a12('0x2d')),controller[_0x8a12('0x2e')]);var upload=multer({'storage':multer[_0x8a12('0x27')]({'destination':function(_0x4ff834,_0x3e9856,_0x447d21){_0x447d21(null,path['join'](config[_0x8a12('0x28')],_0x8a12('0x2f')));},'filename':function(_0x3ff18f,_0x1995fb,_0x507240){_0x507240(null,util['format'](_0x8a12('0x29'),Date[_0x8a12('0x30')](),_0x1995fb[_0x8a12('0x2a')]));}})});router[_0x8a12('0x2b')](_0x8a12('0x31'),upload['single'](_0x8a12('0x2d')),controller[_0x8a12('0x32')]);var upload=multer({'storage':multer[_0x8a12('0x27')]({'destination':function(_0x1adf37,_0x4be489,_0x1bdda1){_0x1bdda1(null,path[_0x8a12('0x33')](config[_0x8a12('0x28')],_0x8a12('0x2f')));},'filename':function(_0x303210,_0x5f3c78,_0x3555eb){_0x3555eb(null,util[_0x8a12('0x34')](_0x8a12('0x29'),Date[_0x8a12('0x30')](),_0x5f3c78[_0x8a12('0x2a')]));}})});router[_0x8a12('0x2b')](_0x8a12('0x14'),upload[_0x8a12('0x2c')]('file'),controller[_0x8a12('0x35')]);var upload=multer({'storage':multer[_0x8a12('0x27')]({'destination':function(_0x215138,_0x5bb730,_0xd9ea87){_0xd9ea87(null,path[_0x8a12('0x33')](config[_0x8a12('0x28')],'server/files/images/avatars/'));},'filename':function(_0x2da887,_0x14e4b0,_0x36c72f){_0x36c72f(null,util[_0x8a12('0x34')](_0x8a12('0x29'),Date['now'](),_0x14e4b0[_0x8a12('0x2a')]));}})});router['post']('/:id/system_avatar',upload[_0x8a12('0x2c')](_0x8a12('0x2d')),controller[_0x8a12('0x36')]);router[_0x8a12('0x2b')](_0x8a12('0x37'),controller[_0x8a12('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0x8a12('0x27')]({'destination':function(_0x33eda7,_0x1ef9fd,_0x432d69){const _0x12e3a8=path[_0x8a12('0x33')](config[_0x8a12('0x28')],_0x8a12('0x39'),'attachments','offline-chat');fs_extra[_0x8a12('0x3a')](_0x12e3a8,function(){_0x432d69(null,_0x12e3a8);});},'filename':function(_0x185dd1,_0x3dd5af,_0x3922e4){const _0xe743aa=_0x3dd5af[_0x8a12('0x2a')][_0x8a12('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x13eb6c=path[_0x8a12('0x3c')](_0xe743aa);const _0xb1a518=Date['now']()+'-'+_0xe743aa[_0x8a12('0x3b')](_0x13eb6c,'')+_0x13eb6c;_0x3922e4(null,_0xb1a518);}})});router[_0x8a12('0x2b')](_0x8a12('0x3d'),offlineUploadMulter['any'](),controller[_0x8a12('0x3e')]);router[_0x8a12('0x2b')](_0x8a12('0x18'),auth[_0x8a12('0xb')](),controller[_0x8a12('0x3f')]);router[_0x8a12('0x2b')]('/:id/applications',auth[_0x8a12('0xb')](),controller['addApplications']);router[_0x8a12('0x2b')](_0x8a12('0x1e'),auth[_0x8a12('0xb')](),controller[_0x8a12('0x40')]);router[_0x8a12('0x2b')](_0x8a12('0x41'),auth[_0x8a12('0xb')](),controller[_0x8a12('0x42')]);router[_0x8a12('0x43')]('/:id',auth[_0x8a12('0xb')](),controller['update']);router['delete']('/:id',auth[_0x8a12('0xb')](),controller[_0x8a12('0x44')]);router['delete']('/:id/dispositions',auth[_0x8a12('0xb')](),controller['removeDispositions']);router[_0x8a12('0x45')]('/:id/canned_answers',auth[_0x8a12('0xb')](),controller['removeAnswers']);router[_0x8a12('0x45')]('/:id/users',auth[_0x8a12('0xb')](),controller['removeAgents']);module[_0x8a12('0x46')]=router; \ No newline at end of file +var _0xd7cb=['/:id/offline','any','offline','/:id/interactions','addInteraction','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','single','file','addLogo','server/files/images/avatars/','/:id/avatar','%s-%s','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace'];(function(_0x1221eb,_0x424ac7){var _0xad59c4=function(_0x40c702){while(--_0x40c702){_0x1221eb['push'](_0x1221eb['shift']());}};_0xad59c4(++_0x424ac7);}(_0xd7cb,0x129));var _0xbd7c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd7cb[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xbd7c('0x0'));var util=require(_0xbd7c('0x1'));var path=require(_0xbd7c('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd7c('0x3'));var router=express[_0xbd7c('0x4')]();var fs_extra=require(_0xbd7c('0x5'));var auth=require(_0xbd7c('0x6'));var interaction=require(_0xbd7c('0x7'));var config=require(_0xbd7c('0x8'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0xbd7c('0x9')](),controller[_0xbd7c('0xa')]);router['get'](_0xbd7c('0xb'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0xc')]);router['get'](_0xbd7c('0xd'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0xe')]);router[_0xbd7c('0xf')](_0xbd7c('0x10'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x11')]);router[_0xbd7c('0xf')](_0xbd7c('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/logo',controller[_0xbd7c('0x13')]);router['get']('/:id/avatar',controller[_0xbd7c('0x14')]);router[_0xbd7c('0xf')](_0xbd7c('0x15'),controller[_0xbd7c('0x16')]);router[_0xbd7c('0xf')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x17')]);router['get'](_0xbd7c('0x18'),controller['getSnippet']);router[_0xbd7c('0xf')](_0xbd7c('0x19'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x1a')]);router[_0xbd7c('0xf')](_0xbd7c('0x1b'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x1c')]);router[_0xbd7c('0xf')](_0xbd7c('0x1d'),controller['getFields']);router['get'](_0xbd7c('0x1e'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x1f')]);router[_0xbd7c('0xf')](_0xbd7c('0x20'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x21')]);router[_0xbd7c('0x22')]('/',auth[_0xbd7c('0x9')](),controller['create']);router[_0xbd7c('0x22')](_0xbd7c('0x10'),auth[_0xbd7c('0x9')](),controller['addDisposition']);router[_0xbd7c('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbd7c('0x23')]);var upload=multer({'storage':multer[_0xbd7c('0x24')]({'destination':function(_0x13896b,_0x40ddf1,_0x2e4240){_0x2e4240(null,path[_0xbd7c('0x25')](config[_0xbd7c('0x26')],_0xbd7c('0x27')));},'filename':function(_0x4ca4bf,_0x31853b,_0x2cac8a){_0x2cac8a(null,util[_0xbd7c('0x28')]('%s-%s',Date[_0xbd7c('0x29')](),_0x31853b[_0xbd7c('0x2a')]));}})});router[_0xbd7c('0x22')]('/:id/logo',upload[_0xbd7c('0x2b')](_0xbd7c('0x2c')),controller[_0xbd7c('0x2d')]);var upload=multer({'storage':multer[_0xbd7c('0x24')]({'destination':function(_0x206682,_0x200e64,_0x100e4f){_0x100e4f(null,path[_0xbd7c('0x25')](config[_0xbd7c('0x26')],_0xbd7c('0x2e')));},'filename':function(_0x7ae5d5,_0x26aa7a,_0x3c4110){_0x3c4110(null,util[_0xbd7c('0x28')]('%s-%s',Date[_0xbd7c('0x29')](),_0x26aa7a[_0xbd7c('0x2a')]));}})});router[_0xbd7c('0x22')](_0xbd7c('0x2f'),upload[_0xbd7c('0x2b')](_0xbd7c('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0xbd7c('0x24')]({'destination':function(_0x31cc7b,_0x25a0b6,_0x1b9453){_0x1b9453(null,path['join'](config[_0xbd7c('0x26')],_0xbd7c('0x2e')));},'filename':function(_0x2a7605,_0x3059d0,_0x176dbe){_0x176dbe(null,util[_0xbd7c('0x28')](_0xbd7c('0x30'),Date['now'](),_0x3059d0[_0xbd7c('0x2a')]));}})});router[_0xbd7c('0x22')]('/:id/customer_avatar',upload[_0xbd7c('0x2b')](_0xbd7c('0x2c')),controller[_0xbd7c('0x31')]);var upload=multer({'storage':multer[_0xbd7c('0x24')]({'destination':function(_0x5684fa,_0x48081b,_0x4d3381){_0x4d3381(null,path[_0xbd7c('0x25')](config[_0xbd7c('0x26')],'server/files/images/avatars/'));},'filename':function(_0x5357ba,_0x538e05,_0x23c848){_0x23c848(null,util[_0xbd7c('0x28')]('%s-%s',Date[_0xbd7c('0x29')](),_0x538e05[_0xbd7c('0x2a')]));}})});router[_0xbd7c('0x22')](_0xbd7c('0x32'),upload[_0xbd7c('0x2b')](_0xbd7c('0x2c')),controller[_0xbd7c('0x33')]);router[_0xbd7c('0x22')](_0xbd7c('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xbd7c('0x24')]({'destination':function(_0x494edb,_0x21c796,_0x257c3a){const _0x5230bc=path[_0xbd7c('0x25')](config[_0xbd7c('0x26')],_0xbd7c('0x35'),_0xbd7c('0x36'),_0xbd7c('0x37'));fs_extra[_0xbd7c('0x38')](_0x5230bc,function(){_0x257c3a(null,_0x5230bc);});},'filename':function(_0x1c6f3e,_0x22af26,_0x4f9a46){const _0x558ae3=_0x22af26[_0xbd7c('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1fdd4f=path['extname'](_0x558ae3);const _0x700bb9=Date[_0xbd7c('0x29')]()+'-'+_0x558ae3[_0xbd7c('0x39')](_0x1fdd4f,'')+_0x1fdd4f;_0x4f9a46(null,_0x700bb9);}})});router['post'](_0xbd7c('0x3a'),offlineUploadMulter[_0xbd7c('0x3b')](),controller[_0xbd7c('0x3c')]);router[_0xbd7c('0x22')](_0xbd7c('0x3d'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x3e')]);router['post'](_0xbd7c('0x19'),auth[_0xbd7c('0x9')](),controller['addApplications']);router[_0xbd7c('0x22')](_0xbd7c('0x1b'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xbd7c('0x22')](_0xbd7c('0x20'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x3f')]);router[_0xbd7c('0x40')](_0xbd7c('0xd'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x41')]);router['delete'](_0xbd7c('0xd'),auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x42')]);router[_0xbd7c('0x43')](_0xbd7c('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xbd7c('0x43')](_0xbd7c('0x12'),auth['isAuthenticated'](),controller[_0xbd7c('0x44')]);router[_0xbd7c('0x43')]('/:id/users',auth[_0xbd7c('0x9')](),controller[_0xbd7c('0x45')]);module[_0xbd7c('0x46')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index b91a23c..b94b202 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 _0x448b=['beaver-logger/server','express','../components/auth/service','env','app','client-side-logger','isAuthenticated','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x448b,0x1b8));var _0xb448=function(_0xdc6f35,_0x3bad6c){_0xdc6f35=_0xdc6f35-0x0;var _0x1a3efa=_0x448b[_0xdc6f35];return _0x1a3efa;};var beaverLogger=require(_0xb448('0x0'));var express=require(_0xb448('0x1'));var auth=require(_0xb448('0x2'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0xb448('0x3')]==='production'||![];function clientSideLogs(_0x5471a7,_0x3ff414,_0x464940){var _0x1d15b7=_0x5471a7[_0xb448('0x4')]['get'](_0xb448('0x5'));if(!_0x1d15b7){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x1d15b7,'enableCors':!isProduction})(_0x5471a7,_0x3ff414,_0x464940);}router['use'](auth[_0xb448('0x6')](),clientSideLogs);module[_0xb448('0x7')]=router; \ No newline at end of file +var _0xae6c=['app','get','client-side-logger','/client-logs','use','exports','express','../components/auth/service','../config/environment','Router','env'];(function(_0x4911ed,_0x476941){var _0x230288=function(_0xcaa9c0){while(--_0xcaa9c0){_0x4911ed['push'](_0x4911ed['shift']());}};_0x230288(++_0x476941);}(_0xae6c,0x95));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};var beaverLogger=require('beaver-logger/server');var express=require(_0xcae6('0x0'));var auth=require(_0xcae6('0x1'));var config=require(_0xcae6('0x2'));var router=express[_0xcae6('0x3')]();var isProduction=config[_0xcae6('0x4')]==='production'||![];function clientSideLogs(_0x1e5c30,_0x3e524b,_0x13e356){var _0x5795cc=_0x1e5c30[_0xcae6('0x5')][_0xcae6('0x6')](_0xcae6('0x7'));if(!_0x5795cc){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0xcae6('0x8'),'logger':_0x5795cc,'enableCors':!isProduction})(_0x1e5c30,_0x3e524b,_0x13e356);}router[_0xcae6('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0xcae6('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 183ea11..1b8fc06 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 _0xd15b=['exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0xd15b,0x1a3));var _0xbd15=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd15b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xbd15('0x0'));module[_0xbd15('0x1')]={'name':{'type':Sequelize[_0xbd15('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xbd15('0x3')]('AmazonAWS',_0xbd15('0x4'),_0xbd15('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xbd15('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0xbd15('0x2')],'comment':_0xbd15('0x7')},'data2':{'type':Sequelize['STRING'],'comment':_0xbd15('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0xbd15('0x9')},'data4':{'type':Sequelize[_0xbd15('0x2')],'comment':_0xbd15('0xa')},'data5':{'type':Sequelize[_0xbd15('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0xbd15('0xc')},'data7':{'type':Sequelize[_0xbd15('0xb')],'comment':_0xbd15('0xd')}}; \ No newline at end of file +var _0xf97a=['Google','MicrosoftAzure','Dynamics365','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','ENUM','AmazonAWS'];(function(_0x399712,_0x2f76b3){var _0x48cc7a=function(_0x56d666){while(--_0x56d666){_0x399712['push'](_0x399712['shift']());}};_0x48cc7a(++_0x2f76b3);}(_0xf97a,0x15a));var _0xaf97=function(_0x335b5f,_0x196e67){_0x335b5f=_0x335b5f-0x0;var _0x4b8c96=_0xf97a[_0x335b5f];return _0x4b8c96;};'use strict';var Sequelize=require(_0xaf97('0x0'));module[_0xaf97('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xaf97('0x2')](_0xaf97('0x3'),_0xaf97('0x4'),_0xaf97('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xaf97('0x2')]('Outlook365',_0xaf97('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xaf97('0x7')],'comment':_0xaf97('0x8')},'data3':{'type':Sequelize[_0xaf97('0x7')],'comment':_0xaf97('0x9')},'data4':{'type':Sequelize[_0xaf97('0x7')],'comment':_0xaf97('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xaf97('0xb')},'data6':{'type':Sequelize[_0xaf97('0xc')],'comment':_0xaf97('0xd')},'data7':{'type':Sequelize[_0xaf97('0xc')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 9422e33..e70e49d 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 _0xcada=['count','limit','set','destroy','then','error','name','send','padEnd','slice','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','CloudProvider','findAll','rows','service','MicrosoftAzure','show','length','includeAll','find','decryptString','data3','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','update','params','catch','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','code','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined'];(function(_0x4a265d,_0x26c674){var _0x207e21=function(_0xea27bf){while(--_0xea27bf){_0x4a265d['push'](_0x4a265d['shift']());}};_0x207e21(++_0x26c674);}(_0xcada,0x10c));var _0xacad=function(_0x29ac1a,_0x275272){_0x29ac1a=_0x29ac1a-0x0;var _0x5490c0=_0xcada[_0x29ac1a];return _0x5490c0;};'use strict';var _=require('lodash');var Redis=require(_0xacad('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xacad('0x1'));var config=require(_0xacad('0x2'));var logger=require(_0xacad('0x3'))(_0xacad('0x4'));var db=require(_0xacad('0x5'))['db'];var oauth=require(_0xacad('0x6'));config[_0xacad('0x7')]=_[_0xacad('0x8')](config[_0xacad('0x7')],{'host':_0xacad('0x9'),'port':0x18eb});var socket=require(_0xacad('0xa'))(new Redis(config[_0xacad('0x7')]));var redis=new Redis(config[_0xacad('0x7')]);function respondWithStatusCode(_0x4909ab,_0x4262d5){_0x4262d5=_0x4262d5||0xcc;return function(_0x3870df){if(_0x3870df){return _0x4909ab[_0xacad('0xb')](_0x4262d5);}return _0x4909ab['status'](_0x4262d5)[_0xacad('0xc')]();};}function respondWithResult(_0x2fd9d6,_0x5c0b77){_0x5c0b77=_0x5c0b77||0xc8;return function(_0x3a9093){if(_0x3a9093){return _0x2fd9d6[_0xacad('0xd')](_0x5c0b77)[_0xacad('0xe')](_0x3a9093);}};}function respondWithFilteredResult(_0x4bb495,_0x1a6805){return function(_0x2d2b3b){if(_0x2d2b3b){var _0x4dac13=typeof _0x1a6805[_0xacad('0xf')]===_0xacad('0x10')&&typeof _0x1a6805['limit']==='undefined';var _0x1a97e9=_0x2d2b3b[_0xacad('0x11')];var _0x46303a=_0x4dac13?0x0:_0x1a6805[_0xacad('0xf')];var _0x1b4f7e=_0x4dac13?_0x2d2b3b[_0xacad('0x11')]:_0x1a6805['offset']+_0x1a6805[_0xacad('0x12')];var _0x561a18;if(_0x1b4f7e>=_0x1a97e9){_0x1b4f7e=_0x1a97e9;_0x561a18=0xc8;}else{_0x561a18=0xce;}_0x4bb495[_0xacad('0xd')](_0x561a18);return _0x4bb495[_0xacad('0x13')]('Content-Range',_0x46303a+'-'+_0x1b4f7e+'/'+_0x1a97e9)[_0xacad('0xe')](_0x2d2b3b);}return null;};}function saveUpdates(_0xbccc4d){return function(_0x47eb91){if(_0x47eb91){return _0x47eb91['update'](_0xbccc4d)['then'](function(_0x54ea3d){return _0x54ea3d;});}return null;};}function removeEntity(_0x42bc17){return function(_0x20b48a){if(_0x20b48a){return _0x20b48a[_0xacad('0x14')]()[_0xacad('0x15')](function(){_0x42bc17['status'](0xcc)[_0xacad('0xc')]();});}};}function handleEntityNotFound(_0x39d452){return function(_0x3bb70d){if(!_0x3bb70d){_0x39d452[_0xacad('0xb')](0x194);}return _0x3bb70d;};}function handleError(_0x294982,_0x43ce66){_0x43ce66=_0x43ce66||0x1f4;return function(_0x1d0fda){logger[_0xacad('0x16')](_0x1d0fda['stack']);if(_0x1d0fda[_0xacad('0x17')]){delete _0x1d0fda[_0xacad('0x17')];}_0x294982[_0xacad('0xd')](_0x43ce66)[_0xacad('0x18')](_0x1d0fda);};}function maskClientSecret(_0x306790){return _[_0xacad('0x19')](_0x306790[_0xacad('0x1a')](0x0,0x3),0x14,'*');}exports[_0xacad('0x1b')]=function(_0x22c715,_0x516471){var _0x53e9c7={},_0x62f551={},_0x16d455={'count':0x0,'rows':[]};var _0xe8d9b9=_['map'](db['CloudProvider'][_0xacad('0x1c')],function(_0x233ac7){return{'name':_0x233ac7[_0xacad('0x1d')],'type':_0x233ac7[_0xacad('0x1e')][_0xacad('0x1f')]};});_0x62f551[_0xacad('0x20')]=_[_0xacad('0x21')](_0xe8d9b9,_0xacad('0x17'));_0x62f551[_0xacad('0x22')]=_[_0xacad('0x23')](_0x22c715[_0xacad('0x22')]);_0x62f551['filters']=_[_0xacad('0x24')](_0x62f551['model'],_0x62f551[_0xacad('0x22')]);_0x53e9c7[_0xacad('0x25')]=_['intersection'](_0x62f551['model'],qs['fields'](_0x22c715[_0xacad('0x22')][_0xacad('0x26')]));_0x53e9c7[_0xacad('0x25')]=_0x53e9c7[_0xacad('0x25')]['length']?_0x53e9c7[_0xacad('0x25')]:_0x62f551['model'];if(!_0x22c715[_0xacad('0x22')]['hasOwnProperty'](_0xacad('0x27'))){_0x53e9c7[_0xacad('0x12')]=qs[_0xacad('0x12')](_0x22c715['query'][_0xacad('0x12')]);_0x53e9c7[_0xacad('0xf')]=qs[_0xacad('0xf')](_0x22c715[_0xacad('0x22')][_0xacad('0xf')]);}_0x53e9c7[_0xacad('0x28')]=qs[_0xacad('0x29')](_0x22c715[_0xacad('0x22')][_0xacad('0x29')]);_0x53e9c7[_0xacad('0x2a')]=qs[_0xacad('0x2b')](_[_0xacad('0x2c')](_0x22c715[_0xacad('0x22')],_0x62f551['filters']),_0xe8d9b9);if(_0x22c715[_0xacad('0x22')][_0xacad('0x2d')]){_0x53e9c7[_0xacad('0x2a')]=_[_0xacad('0x2e')](_0x53e9c7[_0xacad('0x2a')],{'$or':_[_0xacad('0x21')](_0xe8d9b9,function(_0x4b98ae){if(_0x4b98ae[_0xacad('0x1e')]!==_0xacad('0x2f')){var _0x54404b={};_0x54404b[_0x4b98ae[_0xacad('0x17')]]={'$like':'%'+_0x22c715[_0xacad('0x22')][_0xacad('0x2d')]+'%'};return _0x54404b;}})});}_0x53e9c7=_[_0xacad('0x2e')]({},_0x53e9c7,_0x22c715[_0xacad('0x30')]);var _0x34fca9={'where':_0x53e9c7[_0xacad('0x2a')]};return db['CloudProvider'][_0xacad('0x11')](_0x34fca9)['then'](function(_0x4ea5fd){_0x16d455['count']=_0x4ea5fd;if(_0x22c715[_0xacad('0x22')]['includeAll']){_0x53e9c7[_0xacad('0x31')]=[{'all':!![]}];}return db[_0xacad('0x32')][_0xacad('0x33')](_0x53e9c7);})[_0xacad('0x15')](function(_0x5c55d3){_0x16d455[_0xacad('0x34')]=_['map'](_0x5c55d3,function(_0x2fa036){if(_0x2fa036[_0xacad('0x35')]===_0xacad('0x36')){var _0x256fd7=encryptor['decryptString'](_0x2fa036['data3']);_0x2fa036['data3']=maskClientSecret(_0x256fd7);}return _0x2fa036;});return _0x16d455;})['then'](respondWithFilteredResult(_0x516471,_0x53e9c7))['catch'](handleError(_0x516471,null));};exports[_0xacad('0x37')]=function(_0x9423be,_0x433187){var _0x55e2e2={'raw':!![],'where':{'id':_0x9423be['params']['id']}},_0x2d5d87={};_0x2d5d87['model']=_[_0xacad('0x23')](db[_0xacad('0x32')][_0xacad('0x1c')]);_0x2d5d87[_0xacad('0x22')]=_[_0xacad('0x23')](_0x9423be[_0xacad('0x22')]);_0x2d5d87[_0xacad('0x2b')]=_['intersection'](_0x2d5d87['model'],_0x2d5d87[_0xacad('0x22')]);_0x55e2e2[_0xacad('0x25')]=_['intersection'](_0x2d5d87[_0xacad('0x20')],qs[_0xacad('0x26')](_0x9423be[_0xacad('0x22')]['fields']));_0x55e2e2[_0xacad('0x25')]=_0x55e2e2[_0xacad('0x25')][_0xacad('0x38')]?_0x55e2e2[_0xacad('0x25')]:_0x2d5d87[_0xacad('0x20')];if(_0x9423be[_0xacad('0x22')][_0xacad('0x39')]){_0x55e2e2['include']=[{'all':!![]}];}_0x55e2e2=_['merge']({},_0x55e2e2,_0x9423be['options']);return db[_0xacad('0x32')][_0xacad('0x3a')](_0x55e2e2)[_0xacad('0x15')](handleEntityNotFound(_0x433187,null))[_0xacad('0x15')](function(_0x2bdd22){if(_0x2bdd22['service']==='MicrosoftAzure'){var _0x15fab6=encryptor[_0xacad('0x3b')](_0x2bdd22[_0xacad('0x3c')]);_0x2bdd22[_0xacad('0x3c')]=maskClientSecret(_0x15fab6);}return _0x2bdd22;})['then'](respondWithResult(_0x433187,null))['catch'](handleError(_0x433187,null));};exports[_0xacad('0x3d')]=function(_0x35251d,_0x4c6762){if(!_0x35251d[_0xacad('0x3e')]['name'])throw new Error(_0xacad('0x3f'));if(!_0x35251d['body'][_0xacad('0x35')])throw new Error(_0xacad('0x40'));var _0x5f1fe7=db['CloudProvider'][_0xacad('0x1c')][_0xacad('0x35')]['values'];if(!_0x5f1fe7[_0xacad('0x41')](_0x35251d[_0xacad('0x3e')]['service']))throw new Error(_0xacad('0x42')+_0x5f1fe7['join'](',\x20'));if(_0x35251d['body'][_0xacad('0x35')]===_0xacad('0x36')&&_0x35251d['body'][_0xacad('0x3c')]){_0x35251d[_0xacad('0x3e')][_0xacad('0x3c')]=encryptor[_0xacad('0x43')](_0x35251d[_0xacad('0x3e')]['data3']);}return db[_0xacad('0x32')][_0xacad('0x3d')](_0x35251d['body'],{})[_0xacad('0x15')](respondWithResult(_0x4c6762,0xc9))['catch'](handleError(_0x4c6762,null));};exports[_0xacad('0x44')]=function(_0x53ff46,_0x257d95){if(_0x53ff46[_0xacad('0x3e')]['id']){delete _0x53ff46['body']['id'];}return db[_0xacad('0x32')][_0xacad('0x3a')]({'where':{'id':_0x53ff46[_0xacad('0x45')]['id']}})[_0xacad('0x15')](handleEntityNotFound(_0x257d95,null))[_0xacad('0x15')](function(_0x1069a5){if(_0x1069a5['service']===_0xacad('0x36')&&_0x53ff46[_0xacad('0x3e')]['data3']){_0x53ff46['body'][_0xacad('0x3c')]=encryptor[_0xacad('0x43')](_0x53ff46[_0xacad('0x3e')][_0xacad('0x3c')]);}return _0x1069a5;})[_0xacad('0x15')](saveUpdates(_0x53ff46[_0xacad('0x3e')],null))['then'](respondWithResult(_0x257d95,null))[_0xacad('0x46')](handleError(_0x257d95,null));};exports[_0xacad('0x14')]=function(_0x56d472,_0x4f5dd5){return db[_0xacad('0x32')][_0xacad('0x3a')]({'where':{'id':_0x56d472[_0xacad('0x45')]['id']}})[_0xacad('0x15')](handleEntityNotFound(_0x4f5dd5,null))['then'](removeEntity(_0x4f5dd5,null))[_0xacad('0x46')](handleError(_0x4f5dd5,null));};exports[_0xacad('0x47')]=function(_0x17665d,_0x1d23e0){return db['CloudProvider']['findOne']({'where':{'id':_0x17665d[_0xacad('0x45')]['id']},'raw':!![]})[_0xacad('0x15')](function(_0x25f909){if(!_0x25f909)return _0x1d23e0[_0xacad('0xb')](0x194);return{'url':oauth[_0xacad('0x48')](_0x25f909,_0x17665d[_0xacad('0x49')]['id'])};})['then'](respondWithResult(_0x1d23e0,null))[_0xacad('0x46')](handleError(_0x1d23e0,null));};exports[_0xacad('0x4a')]=function(_0x529fb3,_0x542c17){var _0x57ddd1=_0x529fb3['body'];var _0x5596cb;var _0xdd82b1;if(_0x57ddd1[_0xacad('0x16')])throw _0x57ddd1;redis[_0xacad('0x4b')](_0x57ddd1['state'])['then'](function(_0x2bdb22){if(!_0x2bdb22)throw new Error('Invalid\x20state\x20parameter');_0x5596cb=JSON[_0xacad('0x4c')](_0x2bdb22);var _0x3b4673=Buffer[_0xacad('0x4d')](_0x57ddd1[_0xacad('0x4e')],_0xacad('0x4f'))[_0xacad('0x50')](_0xacad('0x51'));_0xdd82b1=JSON[_0xacad('0x4c')](_0x3b4673);if(!oauth[_0xacad('0x52')](_0x57ddd1[_0xacad('0x53')],_0x5596cb['oauth2Claims']))throw new Error(_0xacad('0x54'));redis[_0xacad('0x55')](_0x57ddd1[_0xacad('0x4e')]);return oauth['getOauth2MicrosoftAccessToken'](_0x57ddd1[_0xacad('0x56')],_0x5596cb);})[_0xacad('0x15')](function(_0x11aac2){_0x5596cb['data5']=_0x11aac2[_0xacad('0x57')];_0x5596cb[_0xacad('0x58')]=_0x11aac2[_0xacad('0x59')];return db[_0xacad('0x32')][_0xacad('0x44')]({'data5':_0x5596cb['data5'],'data6':_0x5596cb['data6']},{'where':{'id':_0x5596cb['id']}});})[_0xacad('0x15')](function(){oauth[_0xacad('0x5a')](_0x5596cb);socket[_0xacad('0x5b')]('microsoftAuthorization:success',{'id':_0xdd82b1['id']});return;})[_0xacad('0x15')](respondWithStatusCode(_0x542c17,null))[_0xacad('0x46')](function(_0x343503){if(_0xdd82b1){socket[_0xacad('0x5b')](_0xacad('0x5c'),{'id':_0xdd82b1['id']});}if(!_0x5596cb){logger[_0xacad('0x16')](_0xacad('0x5d'),_0x343503);return _0x542c17[_0xacad('0xd')](0x1f4)[_0xacad('0x18')](_0x343503[_0xacad('0x5e')]);}logger[_0xacad('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x5596cb['id'],JSON['stringify'](_0x343503));});}; \ No newline at end of file +var _0xc2fa=['send','map','CloudProvider','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','length','includeAll','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','params','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','name'];(function(_0x5db928,_0x113065){var _0x4b9e2c=function(_0x252bc1){while(--_0x252bc1){_0x5db928['push'](_0x5db928['shift']());}};_0x4b9e2c(++_0x113065);}(_0xc2fa,0x15e));var _0xac2f=function(_0x112973,_0x3a73a5){_0x112973=_0x112973-0x0;var _0x31084d=_0xc2fa[_0x112973];return _0x31084d;};'use strict';var _=require(_0xac2f('0x0'));var Redis=require(_0xac2f('0x1'));var qs=require(_0xac2f('0x2'));var encryptor=require(_0xac2f('0x3'));var config=require(_0xac2f('0x4'));var logger=require(_0xac2f('0x5'))(_0xac2f('0x6'));var db=require(_0xac2f('0x7'))['db'];var oauth=require(_0xac2f('0x8'));config[_0xac2f('0x9')]=_[_0xac2f('0xa')](config[_0xac2f('0x9')],{'host':_0xac2f('0xb'),'port':0x18eb});var socket=require(_0xac2f('0xc'))(new Redis(config[_0xac2f('0x9')]));var redis=new Redis(config[_0xac2f('0x9')]);function respondWithStatusCode(_0x43b27e,_0x359af2){_0x359af2=_0x359af2||0xcc;return function(_0x285fc0){if(_0x285fc0){return _0x43b27e[_0xac2f('0xd')](_0x359af2);}return _0x43b27e['status'](_0x359af2)['end']();};}function respondWithResult(_0x4b0285,_0xf0d75c){_0xf0d75c=_0xf0d75c||0xc8;return function(_0x516370){if(_0x516370){return _0x4b0285[_0xac2f('0xe')](_0xf0d75c)[_0xac2f('0xf')](_0x516370);}};}function respondWithFilteredResult(_0x3c72a7,_0x31c831){return function(_0x19aa65){if(_0x19aa65){var _0x398351=typeof _0x31c831[_0xac2f('0x10')]===_0xac2f('0x11')&&typeof _0x31c831[_0xac2f('0x12')]===_0xac2f('0x11');var _0x154090=_0x19aa65[_0xac2f('0x13')];var _0x59dcf2=_0x398351?0x0:_0x31c831['offset'];var _0x144d63=_0x398351?_0x19aa65['count']:_0x31c831['offset']+_0x31c831[_0xac2f('0x12')];var _0x1ed9a8;if(_0x144d63>=_0x154090){_0x144d63=_0x154090;_0x1ed9a8=0xc8;}else{_0x1ed9a8=0xce;}_0x3c72a7[_0xac2f('0xe')](_0x1ed9a8);return _0x3c72a7[_0xac2f('0x14')](_0xac2f('0x15'),_0x59dcf2+'-'+_0x144d63+'/'+_0x154090)['json'](_0x19aa65);}return null;};}function saveUpdates(_0x182391){return function(_0x486e48){if(_0x486e48){return _0x486e48['update'](_0x182391)[_0xac2f('0x16')](function(_0x19193){return _0x19193;});}return null;};}function removeEntity(_0xe692a3){return function(_0x213fd3){if(_0x213fd3){return _0x213fd3[_0xac2f('0x17')]()[_0xac2f('0x16')](function(){_0xe692a3['status'](0xcc)[_0xac2f('0x18')]();});}};}function handleEntityNotFound(_0x3bc3aa){return function(_0x27d7a8){if(!_0x27d7a8){_0x3bc3aa['sendStatus'](0x194);}return _0x27d7a8;};}function handleError(_0x517fcb,_0x151d78){_0x151d78=_0x151d78||0x1f4;return function(_0x21ecb7){logger['error'](_0x21ecb7['stack']);if(_0x21ecb7[_0xac2f('0x19')]){delete _0x21ecb7[_0xac2f('0x19')];}_0x517fcb[_0xac2f('0xe')](_0x151d78)[_0xac2f('0x1a')](_0x21ecb7);};}function maskClientSecret(_0x3c1716){return _['padEnd'](_0x3c1716['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x117174,_0x3e7b7f){var _0x1261f1={},_0xa8e350={},_0x7f8772={'count':0x0,'rows':[]};var _0x103f60=_[_0xac2f('0x1b')](db[_0xac2f('0x1c')][_0xac2f('0x1d')],function(_0xb7616f){return{'name':_0xb7616f[_0xac2f('0x1e')],'type':_0xb7616f['type'][_0xac2f('0x1f')]};});_0xa8e350[_0xac2f('0x20')]=_[_0xac2f('0x1b')](_0x103f60,'name');_0xa8e350['query']=_[_0xac2f('0x21')](_0x117174['query']);_0xa8e350[_0xac2f('0x22')]=_[_0xac2f('0x23')](_0xa8e350[_0xac2f('0x20')],_0xa8e350[_0xac2f('0x24')]);_0x1261f1[_0xac2f('0x25')]=_['intersection'](_0xa8e350['model'],qs[_0xac2f('0x26')](_0x117174['query'][_0xac2f('0x26')]));_0x1261f1[_0xac2f('0x25')]=_0x1261f1[_0xac2f('0x25')]['length']?_0x1261f1['attributes']:_0xa8e350[_0xac2f('0x20')];if(!_0x117174[_0xac2f('0x24')]['hasOwnProperty'](_0xac2f('0x27'))){_0x1261f1['limit']=qs[_0xac2f('0x12')](_0x117174[_0xac2f('0x24')][_0xac2f('0x12')]);_0x1261f1[_0xac2f('0x10')]=qs[_0xac2f('0x10')](_0x117174[_0xac2f('0x24')][_0xac2f('0x10')]);}_0x1261f1[_0xac2f('0x28')]=qs[_0xac2f('0x29')](_0x117174['query'][_0xac2f('0x29')]);_0x1261f1[_0xac2f('0x2a')]=qs[_0xac2f('0x22')](_[_0xac2f('0x2b')](_0x117174[_0xac2f('0x24')],_0xa8e350[_0xac2f('0x22')]),_0x103f60);if(_0x117174[_0xac2f('0x24')][_0xac2f('0x2c')]){_0x1261f1[_0xac2f('0x2a')]=_[_0xac2f('0x2d')](_0x1261f1[_0xac2f('0x2a')],{'$or':_[_0xac2f('0x1b')](_0x103f60,function(_0x202741){if(_0x202741['type']!==_0xac2f('0x2e')){var _0x4b0acd={};_0x4b0acd[_0x202741[_0xac2f('0x19')]]={'$like':'%'+_0x117174[_0xac2f('0x24')][_0xac2f('0x2c')]+'%'};return _0x4b0acd;}})});}_0x1261f1=_[_0xac2f('0x2d')]({},_0x1261f1,_0x117174[_0xac2f('0x2f')]);var _0x3c3c62={'where':_0x1261f1[_0xac2f('0x2a')]};return db[_0xac2f('0x1c')][_0xac2f('0x13')](_0x3c3c62)['then'](function(_0x3b4ce2){_0x7f8772[_0xac2f('0x13')]=_0x3b4ce2;if(_0x117174[_0xac2f('0x24')]['includeAll']){_0x1261f1[_0xac2f('0x30')]=[{'all':!![]}];}return db[_0xac2f('0x1c')][_0xac2f('0x31')](_0x1261f1);})[_0xac2f('0x16')](function(_0x1c826c){_0x7f8772[_0xac2f('0x32')]=_[_0xac2f('0x1b')](_0x1c826c,function(_0x9e6ac9){if(_0x9e6ac9[_0xac2f('0x33')]===_0xac2f('0x34')){var _0x4df9b3=encryptor[_0xac2f('0x35')](_0x9e6ac9[_0xac2f('0x36')]);_0x9e6ac9['data3']=maskClientSecret(_0x4df9b3);}return _0x9e6ac9;});return _0x7f8772;})[_0xac2f('0x16')](respondWithFilteredResult(_0x3e7b7f,_0x1261f1))[_0xac2f('0x37')](handleError(_0x3e7b7f,null));};exports[_0xac2f('0x38')]=function(_0x2cedcb,_0x2ddaa6){var _0x532ec8={'raw':!![],'where':{'id':_0x2cedcb['params']['id']}},_0x33d472={};_0x33d472[_0xac2f('0x20')]=_[_0xac2f('0x21')](db['CloudProvider'][_0xac2f('0x1d')]);_0x33d472[_0xac2f('0x24')]=_['keys'](_0x2cedcb[_0xac2f('0x24')]);_0x33d472[_0xac2f('0x22')]=_[_0xac2f('0x23')](_0x33d472['model'],_0x33d472[_0xac2f('0x24')]);_0x532ec8['attributes']=_[_0xac2f('0x23')](_0x33d472[_0xac2f('0x20')],qs[_0xac2f('0x26')](_0x2cedcb[_0xac2f('0x24')][_0xac2f('0x26')]));_0x532ec8[_0xac2f('0x25')]=_0x532ec8[_0xac2f('0x25')][_0xac2f('0x39')]?_0x532ec8[_0xac2f('0x25')]:_0x33d472[_0xac2f('0x20')];if(_0x2cedcb[_0xac2f('0x24')][_0xac2f('0x3a')]){_0x532ec8[_0xac2f('0x30')]=[{'all':!![]}];}_0x532ec8=_[_0xac2f('0x2d')]({},_0x532ec8,_0x2cedcb[_0xac2f('0x2f')]);return db[_0xac2f('0x1c')][_0xac2f('0x3b')](_0x532ec8)[_0xac2f('0x16')](handleEntityNotFound(_0x2ddaa6,null))[_0xac2f('0x16')](function(_0x27b7a1){if(_0x27b7a1[_0xac2f('0x33')]===_0xac2f('0x34')){var _0x5d9191=encryptor[_0xac2f('0x35')](_0x27b7a1['data3']);_0x27b7a1[_0xac2f('0x36')]=maskClientSecret(_0x5d9191);}return _0x27b7a1;})['then'](respondWithResult(_0x2ddaa6,null))['catch'](handleError(_0x2ddaa6,null));};exports[_0xac2f('0x3c')]=function(_0x532498,_0x584418){if(!_0x532498[_0xac2f('0x3d')][_0xac2f('0x19')])throw new Error(_0xac2f('0x3e'));if(!_0x532498[_0xac2f('0x3d')][_0xac2f('0x33')])throw new Error(_0xac2f('0x3f'));var _0x219189=db[_0xac2f('0x1c')][_0xac2f('0x1d')][_0xac2f('0x33')][_0xac2f('0x40')];if(!_0x219189['includes'](_0x532498[_0xac2f('0x3d')][_0xac2f('0x33')]))throw new Error(_0xac2f('0x41')+_0x219189[_0xac2f('0x42')](',\x20'));if(_0x532498['body']['service']===_0xac2f('0x34')&&_0x532498[_0xac2f('0x3d')][_0xac2f('0x36')]){_0x532498[_0xac2f('0x3d')][_0xac2f('0x36')]=encryptor[_0xac2f('0x43')](_0x532498['body']['data3']);}return db['CloudProvider'][_0xac2f('0x3c')](_0x532498[_0xac2f('0x3d')],{})[_0xac2f('0x16')](respondWithResult(_0x584418,0xc9))[_0xac2f('0x37')](handleError(_0x584418,null));};exports[_0xac2f('0x44')]=function(_0x2b3231,_0x43f627){if(_0x2b3231[_0xac2f('0x3d')]['id']){delete _0x2b3231[_0xac2f('0x3d')]['id'];}return db[_0xac2f('0x1c')]['find']({'where':{'id':_0x2b3231[_0xac2f('0x45')]['id']}})[_0xac2f('0x16')](handleEntityNotFound(_0x43f627,null))[_0xac2f('0x16')](function(_0x2410fb){if(_0x2410fb[_0xac2f('0x33')]===_0xac2f('0x34')&&_0x2b3231[_0xac2f('0x3d')][_0xac2f('0x36')]){_0x2b3231[_0xac2f('0x3d')][_0xac2f('0x36')]=encryptor['encryptString'](_0x2b3231['body'][_0xac2f('0x36')]);}return _0x2410fb;})['then'](saveUpdates(_0x2b3231[_0xac2f('0x3d')],null))['then'](respondWithResult(_0x43f627,null))['catch'](handleError(_0x43f627,null));};exports[_0xac2f('0x17')]=function(_0x495431,_0x47c490){return db[_0xac2f('0x1c')]['find']({'where':{'id':_0x495431[_0xac2f('0x45')]['id']}})[_0xac2f('0x16')](handleEntityNotFound(_0x47c490,null))[_0xac2f('0x16')](removeEntity(_0x47c490,null))[_0xac2f('0x37')](handleError(_0x47c490,null));};exports[_0xac2f('0x46')]=function(_0x53d87e,_0x1ca280){return db['CloudProvider'][_0xac2f('0x47')]({'where':{'id':_0x53d87e[_0xac2f('0x45')]['id']},'raw':!![]})[_0xac2f('0x16')](function(_0x4c68c7){if(!_0x4c68c7)return _0x1ca280[_0xac2f('0xd')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x4c68c7,_0x53d87e[_0xac2f('0x48')]['id'])};})[_0xac2f('0x16')](respondWithResult(_0x1ca280,null))[_0xac2f('0x37')](handleError(_0x1ca280,null));};exports[_0xac2f('0x49')]=function(_0x1b29db,_0x284471){var _0x475de4=_0x1b29db[_0xac2f('0x3d')];var _0x544d68;var _0x118b71;if(_0x475de4[_0xac2f('0x4a')])throw _0x475de4;redis[_0xac2f('0x4b')](_0x475de4[_0xac2f('0x4c')])['then'](function(_0x4d3076){if(!_0x4d3076)throw new Error(_0xac2f('0x4d'));_0x544d68=JSON[_0xac2f('0x4e')](_0x4d3076);var _0x1a0f3a=Buffer[_0xac2f('0x4f')](_0x475de4[_0xac2f('0x4c')],'base64')[_0xac2f('0x50')](_0xac2f('0x51'));_0x118b71=JSON[_0xac2f('0x4e')](_0x1a0f3a);if(!oauth[_0xac2f('0x52')](_0x475de4[_0xac2f('0x53')],_0x544d68[_0xac2f('0x54')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xac2f('0x55')](_0x475de4[_0xac2f('0x4c')]);return oauth[_0xac2f('0x56')](_0x475de4[_0xac2f('0x57')],_0x544d68);})['then'](function(_0x149dc1){_0x544d68[_0xac2f('0x58')]=_0x149dc1['access_token'];_0x544d68['data6']=_0x149dc1['refresh_token'];return db[_0xac2f('0x1c')][_0xac2f('0x44')]({'data5':_0x544d68[_0xac2f('0x58')],'data6':_0x544d68[_0xac2f('0x59')]},{'where':{'id':_0x544d68['id']}});})[_0xac2f('0x16')](function(){oauth[_0xac2f('0x5a')](_0x544d68);socket[_0xac2f('0x5b')](_0xac2f('0x5c'),{'id':_0x118b71['id']});return;})[_0xac2f('0x16')](respondWithStatusCode(_0x284471,null))[_0xac2f('0x37')](function(_0xa8432d){if(_0x118b71){socket['emit']('microsoftAuthorization:error',{'id':_0x118b71['id']});}if(!_0x544d68){logger[_0xac2f('0x4a')]('Invalid\x20authentication\x20state\x20parameter',_0xa8432d);return _0x284471[_0xac2f('0xe')](0x1f4)[_0xac2f('0x1a')](_0xa8432d['message']);}logger[_0xac2f('0x4a')](_0xac2f('0x5d'),_0x544d68['id'],JSON['stringify'](_0xa8432d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index c99263c..7ce1707 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 _0x6bd8=['exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x5a0e1d,_0x261edc){var _0x320dc0=function(_0x2fef8a){while(--_0x2fef8a){_0x5a0e1d['push'](_0x5a0e1d['shift']());}};_0x320dc0(++_0x261edc);}(_0x6bd8,0x146));var _0x86bd=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x6bd8[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x86bd('0x0'));var util=require(_0x86bd('0x1'));var logger=require(_0x86bd('0x2'))(_0x86bd('0x3'));var moment=require('moment');var BPromise=require(_0x86bd('0x4'));var rp=require(_0x86bd('0x5'));var fs=require('fs');var path=require(_0x86bd('0x6'));var rimraf=require(_0x86bd('0x7'));var config=require(_0x86bd('0x8'));var attributes=require(_0x86bd('0x9'));module[_0x86bd('0xa')]=function(_0x12e5d8,_0x3a16da){return _0x12e5d8[_0x86bd('0xb')](_0x86bd('0xc'),attributes,{'tableName':_0x86bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x770b=['../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','CloudProvider','cloud_providers','util'];(function(_0x1ba00b,_0x59b50c){var _0x4c4e84=function(_0x256dff){while(--_0x256dff){_0x1ba00b['push'](_0x1ba00b['shift']());}};_0x4c4e84(++_0x59b50c);}(_0x770b,0x81));var _0xb770=function(_0x3512b2,_0x2cb54a){_0x3512b2=_0x3512b2-0x0;var _0x16c6e8=_0x770b[_0x3512b2];return _0x16c6e8;};'use strict';var _=require('lodash');var util=require(_0xb770('0x0'));var logger=require(_0xb770('0x1'))('api');var moment=require(_0xb770('0x2'));var BPromise=require(_0xb770('0x3'));var rp=require(_0xb770('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb770('0x5'));var attributes=require('./cloudProvider.attributes');module[_0xb770('0x6')]=function(_0x2a171b,_0x301245){return _0x2a171b[_0xb770('0x7')](_0xb770('0x8'),attributes,{'tableName':_0xb770('0x9'),'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 148c173..6be9b56 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 _0x6344=['audience','isAfter','resolve','then','data3','CloudProvider','refresh_token','data6','POST','access_token','update','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','map','type','Dynamics365','push','data7','/.default','join','replace','{TENANT_ID}','data2','code','id_token','from','randomBytes','hex','client_id','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','login','key','value','data1','stringify','decode','payload','issuer','aud'];(function(_0xc6e78e,_0x1fbd19){var _0x1dac61=function(_0x137f2e){while(--_0x137f2e){_0xc6e78e['push'](_0xc6e78e['shift']());}};_0x1dac61(++_0x1fbd19);}(_0x6344,0x1e5));var _0x4634=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x6344[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x4634('0x0'));var crypto=require(_0x4634('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x4634('0x2'));var Redis=require(_0x4634('0x3'));var rp=require(_0x4634('0x4'));var util=require(_0x4634('0x5'));var encryptor=require(_0x4634('0x6'));var config=require(_0x4634('0x7'));var logger=require(_0x4634('0x8'))('api');var schedule=require(_0x4634('0x9'));var db=require(_0x4634('0xa'))['db'];config[_0x4634('0xb')]=_[_0x4634('0xc')](config['redis'],{'host':_0x4634('0xd'),'port':0x18eb});var redis=new Redis(config[_0x4634('0xb')]);var MICROSOFT_AUTH_URL=_0x4634('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x4634('0xf'),_0x4634('0x10'),'email','offline_access',_0x4634('0x11'),_0x4634('0x12'),_0x4634('0x13')],'Dynamics365':['openid',_0x4634('0x14')]};var MICROSOFT_AUTH_ENDPOINT=_0x4634('0x15');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4a83e6){var _0xd238fa=_[_0x4634('0x16')](AZURE_AUTH_SCOPES[_0x4a83e6['type']]);if(_0x4a83e6[_0x4634('0x17')]===_0x4634('0x18'))_0xd238fa[_0x4634('0x19')](_0x4a83e6[_0x4634('0x1a')]+_0x4634('0x1b'));return _0xd238fa[_0x4634('0x1c')]('\x20');}function getAccessTokenScope(_0x15c1bf){if(_0x15c1bf[_0x4634('0x17')]==='Outlook365')return _0x4634('0x11');if(_0x15c1bf[_0x4634('0x17')]===_0x4634('0x18'))return _0x15c1bf[_0x4634('0x1a')]+_0x4634('0x1b');}function generateMicrosoftAuthorizationUrl(_0xa4f597,_0x577ea1){var _0x3e21e3=MICROSOFT_AUTH_URL[_0x4634('0x1d')](_0x4634('0x1e'),_0xa4f597[_0x4634('0x1f')]);var _0x1bc0f7=[_0x4634('0x20'),_0x4634('0x21')];var _0x32205a=Buffer[_0x4634('0x22')](JSON['stringify']({'id':_0x577ea1}))['toString']('base64');var _0x3d8453=crypto[_0x4634('0x23')](0x10)['toString'](_0x4634('0x24'));var _0x156b45=getAuthorizationScopes(_0xa4f597);var _0x17cdbb=[{'key':_0x4634('0x25'),'value':_0xa4f597['data1']},{'key':'response_type','value':encodeURIComponent(_0x1bc0f7[_0x4634('0x1c')]('\x20'))},{'key':_0x4634('0x26'),'value':_0xa4f597[_0x4634('0x27')]},{'key':_0x4634('0x28'),'value':_0x4634('0x29')},{'key':_0x4634('0x2a'),'value':encodeURIComponent(_0x156b45)},{'key':'state','value':_0x32205a},{'key':_0x4634('0x2b'),'value':_0x3d8453},{'key':_0x4634('0x2c'),'value':_0x4634('0x2d')}];var _0x3c31d3=_0x3e21e3+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4634('0x16')](_0x17cdbb,function(_0x253238){return _0x253238[_0x4634('0x2e')]+'='+_0x253238[_0x4634('0x2f')];})[_0x4634('0x1c')]('&');_0xa4f597['oauth2Claims']={'issuer':_0x3e21e3[_0x4634('0x1d')]('oauth2/',''),'audience':_0xa4f597[_0x4634('0x30')],'state':_0x32205a,'nonce':_0x3d8453};redis['set'](_0x32205a,JSON[_0x4634('0x31')](_0xa4f597));return _0x3c31d3;}function isValidIdToken(_0x43481c,_0x4c0228){try{var _0x3a6c27=jwt[_0x4634('0x32')](_0x43481c,{'complete':!![]});var _0x25c30e=_0x3a6c27[_0x4634('0x33')];if(_0x25c30e['iss']!==_0x4c0228[_0x4634('0x34')])return![];if(_0x25c30e[_0x4634('0x35')]!==_0x4c0228[_0x4634('0x36')])return![];if(_0x25c30e[_0x4634('0x2b')]!==_0x4c0228[_0x4634('0x2b')])return![];if(moment()[_0x4634('0x37')](moment['unix'](_0x25c30e['exp'])))return![];return!![];}catch(_0x5c03da){throw _0x5c03da;}}function refreshOauth2MicrosoftAccessToken(_0x43dcc6){return Promise[_0x4634('0x38')]()[_0x4634('0x39')](function(){if(_0x43dcc6[_0x4634('0x3a')])return _0x43dcc6;return db[_0x4634('0x3b')]['findOne']({'where':{'id':_0x43dcc6['id']},'raw':!![]});})[_0x4634('0x39')](function(_0x13776f){var _0x5e993c={'grant_type':_0x4634('0x3c'),'refresh_token':_0x13776f[_0x4634('0x3d')],'scope':getAccessTokenScope(_0x13776f),'redirect_uri':_0x13776f[_0x4634('0x27')],'client_id':_0x13776f['data1'],'client_secret':encryptor['decryptString'](_0x13776f[_0x4634('0x3a')])};var _0x466215={'method':_0x4634('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x4634('0x1d')](_0x4634('0x1e'),_0x13776f[_0x4634('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5e993c,'json':!![]};return rp(_0x466215);})[_0x4634('0x39')](function(_0x11b1ad){_0x43dcc6['data5']=_0x11b1ad[_0x4634('0x3f')];_0x43dcc6[_0x4634('0x3d')]=_0x11b1ad[_0x4634('0x3c')];return db[_0x4634('0x3b')][_0x4634('0x40')]({'data5':_0x43dcc6[_0x4634('0x41')],'data6':_0x43dcc6[_0x4634('0x3d')]},{'where':{'id':_0x43dcc6['id']}});})[_0x4634('0x39')](function(){return _0x43dcc6;})['catch'](function(_0x27cff6){logger[_0x4634('0x42')](_0x4634('0x43'),_0x43dcc6['id'],_0x27cff6);});}function getOauth2MicrosoftAccessToken(_0x46e3d2,_0x5ba823){var _0x118298={'grant_type':_0x4634('0x44'),'code':_0x46e3d2,'scope':getAccessTokenScope(_0x5ba823),'redirect_uri':_0x5ba823[_0x4634('0x27')],'client_id':_0x5ba823['data1'],'client_secret':encryptor[_0x4634('0x45')](_0x5ba823[_0x4634('0x3a')])};var _0x149125={'method':_0x4634('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x4634('0x1d')](_0x4634('0x1e'),_0x5ba823[_0x4634('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x118298,'json':!![]};return rp(_0x149125);}function startRefreshInterval(_0x12a1be){var _0x384dc5=schedule[_0x4634('0x46')];if(_0x384dc5[_0x12a1be['id']])clearInterval(_0x384dc5[_0x12a1be['id']]);_0x384dc5[_0x12a1be['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x4634('0x47')](this,{'id':_0x12a1be['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x4634('0x46')]=_0x384dc5;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x4634('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x25854e){var _0x47a92d=_0x25854e['map'](function(_0x15006d){return refreshOauth2MicrosoftAccessToken(_0x15006d)['then'](function(_0x72c988){startRefreshInterval(_0x72c988);});});return Promise[_0x4634('0x49')](_0x47a92d);})[_0x4634('0x4a')](function(_0xb63ef9){var _0x1c6e71=_0xb63ef9?util['inspect'](_0xb63ef9,{'showHidden':![],'depth':null}):'';logger[_0x4634('0x42')](_0x4634('0x4b'),_0x1c6e71);});}module[_0x4634('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xc7fa=['data7','join','/.default','replace','{TENANT_ID}','code','id_token','from','stringify','toString','hex','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','prompt','value','decode','iss','aud','audience','isAfter','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data2','data5','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','defaults','redis','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','push'];(function(_0x4a8893,_0x38f6ee){var _0x2b6e06=function(_0xe5acdb){while(--_0xe5acdb){_0x4a8893['push'](_0x4a8893['shift']());}};_0x2b6e06(++_0x38f6ee);}(_0xc7fa,0xc4));var _0xac7f=function(_0x1aa379,_0x2cb1a9){_0x1aa379=_0x1aa379-0x0;var _0x251e22=_0xc7fa[_0x1aa379];return _0x251e22;};'use strict';var _=require(_0xac7f('0x0'));var crypto=require(_0xac7f('0x1'));var jwt=require(_0xac7f('0x2'));var moment=require(_0xac7f('0x3'));var Redis=require('ioredis');var rp=require(_0xac7f('0x4'));var util=require(_0xac7f('0x5'));var encryptor=require(_0xac7f('0x6'));var config=require(_0xac7f('0x7'));var logger=require(_0xac7f('0x8'))(_0xac7f('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config['redis']=_[_0xac7f('0xa')](config[_0xac7f('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xac7f('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xac7f('0xc'),'profile',_0xac7f('0xd'),_0xac7f('0xe'),_0xac7f('0xf'),_0xac7f('0x10'),_0xac7f('0x11')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xac7f('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x125a31){var _0x48f4e9=_[_0xac7f('0x13')](AZURE_AUTH_SCOPES[_0x125a31[_0xac7f('0x14')]]);if(_0x125a31['type']===_0xac7f('0x15'))_0x48f4e9[_0xac7f('0x16')](_0x125a31[_0xac7f('0x17')]+'/.default');return _0x48f4e9[_0xac7f('0x18')]('\x20');}function getAccessTokenScope(_0x4291f6){if(_0x4291f6[_0xac7f('0x14')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x4291f6[_0xac7f('0x14')]==='Dynamics365')return _0x4291f6[_0xac7f('0x17')]+_0xac7f('0x19');}function generateMicrosoftAuthorizationUrl(_0x64fd89,_0x44a746){var _0xe8e9a8=MICROSOFT_AUTH_URL[_0xac7f('0x1a')](_0xac7f('0x1b'),_0x64fd89['data2']);var _0x28e3ce=[_0xac7f('0x1c'),_0xac7f('0x1d')];var _0x59815f=Buffer[_0xac7f('0x1e')](JSON[_0xac7f('0x1f')]({'id':_0x44a746}))['toString']('base64');var _0x21ba29=crypto['randomBytes'](0x10)[_0xac7f('0x20')](_0xac7f('0x21'));var _0x1412fe=getAuthorizationScopes(_0x64fd89);var _0x540be5=[{'key':'client_id','value':_0x64fd89[_0xac7f('0x22')]},{'key':_0xac7f('0x23'),'value':encodeURIComponent(_0x28e3ce['join']('\x20'))},{'key':_0xac7f('0x24'),'value':_0x64fd89[_0xac7f('0x25')]},{'key':'response_mode','value':_0xac7f('0x26')},{'key':_0xac7f('0x27'),'value':encodeURIComponent(_0x1412fe)},{'key':_0xac7f('0x28'),'value':_0x59815f},{'key':_0xac7f('0x29'),'value':_0x21ba29},{'key':_0xac7f('0x2a'),'value':'login'}];var _0xda99e3=_0xe8e9a8+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xac7f('0x13')](_0x540be5,function(_0x5727eb){return _0x5727eb['key']+'='+_0x5727eb[_0xac7f('0x2b')];})[_0xac7f('0x18')]('&');_0x64fd89['oauth2Claims']={'issuer':_0xe8e9a8[_0xac7f('0x1a')]('oauth2/',''),'audience':_0x64fd89['data1'],'state':_0x59815f,'nonce':_0x21ba29};redis['set'](_0x59815f,JSON[_0xac7f('0x1f')](_0x64fd89));return _0xda99e3;}function isValidIdToken(_0x697668,_0x16c813){try{var _0x27921f=jwt[_0xac7f('0x2c')](_0x697668,{'complete':!![]});var _0x134383=_0x27921f['payload'];if(_0x134383[_0xac7f('0x2d')]!==_0x16c813['issuer'])return![];if(_0x134383[_0xac7f('0x2e')]!==_0x16c813[_0xac7f('0x2f')])return![];if(_0x134383[_0xac7f('0x29')]!==_0x16c813[_0xac7f('0x29')])return![];if(moment()[_0xac7f('0x30')](moment['unix'](_0x134383[_0xac7f('0x31')])))return![];return!![];}catch(_0x38a323){throw _0x38a323;}}function refreshOauth2MicrosoftAccessToken(_0xb3d591){return Promise[_0xac7f('0x32')]()[_0xac7f('0x33')](function(){if(_0xb3d591[_0xac7f('0x34')])return _0xb3d591;return db[_0xac7f('0x35')][_0xac7f('0x36')]({'where':{'id':_0xb3d591['id']},'raw':!![]});})[_0xac7f('0x33')](function(_0x3b195f){var _0x3650c1={'grant_type':_0xac7f('0x37'),'refresh_token':_0x3b195f[_0xac7f('0x38')],'scope':getAccessTokenScope(_0x3b195f),'redirect_uri':_0x3b195f[_0xac7f('0x25')],'client_id':_0x3b195f[_0xac7f('0x22')],'client_secret':encryptor[_0xac7f('0x39')](_0x3b195f[_0xac7f('0x34')])};var _0x3782f2={'method':_0xac7f('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xac7f('0x1a')](_0xac7f('0x1b'),_0x3b195f[_0xac7f('0x3b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3650c1,'json':!![]};return rp(_0x3782f2);})['then'](function(_0x38b0a5){_0xb3d591[_0xac7f('0x3c')]=_0x38b0a5['access_token'];_0xb3d591[_0xac7f('0x38')]=_0x38b0a5[_0xac7f('0x37')];return db[_0xac7f('0x35')][_0xac7f('0x3d')]({'data5':_0xb3d591[_0xac7f('0x3c')],'data6':_0xb3d591['data6']},{'where':{'id':_0xb3d591['id']}});})['then'](function(){return _0xb3d591;})[_0xac7f('0x3e')](function(_0x5ad132){logger['error'](_0xac7f('0x3f'),_0xb3d591['id'],_0x5ad132);});}function getOauth2MicrosoftAccessToken(_0x43c7c2,_0x12a194){var _0x3a5b1b={'grant_type':_0xac7f('0x40'),'code':_0x43c7c2,'scope':getAccessTokenScope(_0x12a194),'redirect_uri':_0x12a194['data4'],'client_id':_0x12a194[_0xac7f('0x22')],'client_secret':encryptor['decryptString'](_0x12a194[_0xac7f('0x34')])};var _0x114acc={'method':_0xac7f('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xac7f('0x1a')](_0xac7f('0x1b'),_0x12a194[_0xac7f('0x3b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3a5b1b,'json':!![]};return rp(_0x114acc);}function startRefreshInterval(_0x180c3e){var _0x4857d4=schedule[_0xac7f('0x41')];if(_0x4857d4[_0x180c3e['id']])clearInterval(_0x4857d4[_0x180c3e['id']]);_0x4857d4[_0x180c3e['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xac7f('0x42')](this,{'id':_0x180c3e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4857d4;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xac7f('0x43')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xac7f('0x33')](function(_0x3a2afb){var _0x56b309=_0x3a2afb[_0xac7f('0x13')](function(_0x28c84b){return refreshOauth2MicrosoftAccessToken(_0x28c84b)[_0xac7f('0x33')](function(_0x52cd10){startRefreshInterval(_0x52cd10);});});return Promise[_0xac7f('0x44')](_0x56b309);})[_0xac7f('0x3e')](function(_0x425c4e){var _0x201dd3=_0x425c4e?util[_0xac7f('0x45')](_0x425c4e,{'showHidden':![],'depth':null}):'';logger[_0xac7f('0x46')](_0xac7f('0x47'),_0x201dd3);});}module[_0xac7f('0x48')]={'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 0c1b8e2..586b4e9 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 _0x9f37=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x3ea766,_0x17b572){var _0x46c872=function(_0x19e0d0){while(--_0x19e0d0){_0x3ea766['push'](_0x3ea766['shift']());}};_0x46c872(++_0x17b572);}(_0x9f37,0xd1));var _0x79f3=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x9f37[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require('moment');var BPromise=require(_0x79f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79f3('0x3'))['db'];var utils=require(_0x79f3('0x4'));var logger=require(_0x79f3('0x5'))('rpc');var config=require(_0x79f3('0x6'));var jayson=require(_0x79f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x171940,_0x42b440,_0x2ad818){return new BPromise(function(_0xe4ed49,_0x59efc6){return client[_0x79f3('0x8')](_0x171940,_0x2ad818)[_0x79f3('0x9')](function(_0x4b4562){logger[_0x79f3('0xa')](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));logger[_0x79f3('0xd')](_0x79f3('0xe'),_0x42b440,'request\x20sent',JSON[_0x79f3('0xf')](_0x4b4562));if(_0x4b4562[_0x79f3('0x10')]){if(_0x4b4562['error']['code']===0x1f4){logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0x59efc6(_0x4b4562['error'][_0x79f3('0x11')]);}logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0xe4ed49(_0x4b4562[_0x79f3('0x10')]['message']);}else{logger['info'](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));_0xe4ed49(_0x4b4562['result'][_0x79f3('0x11')]);}})[_0x79f3('0x12')](function(_0x23874b){logger[_0x79f3('0x10')]('CloudProvider,\x20%s,\x20%s',_0x42b440,_0x23874b);_0x59efc6(_0x23874b);});});} \ No newline at end of file +var _0xdcdb=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','catch'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdcdb,0x64));var _0xbdcd=function(_0x304383,_0x566b94){_0x304383=_0x304383-0x0;var _0x56dfe4=_0xdcdb[_0x304383];return _0x56dfe4;};'use strict';var _=require(_0xbdcd('0x0'));var util=require(_0xbdcd('0x1'));var moment=require(_0xbdcd('0x2'));var BPromise=require(_0xbdcd('0x3'));var rs=require(_0xbdcd('0x4'));var fs=require('fs');var Redis=require(_0xbdcd('0x5'));var db=require(_0xbdcd('0x6'))['db'];var utils=require(_0xbdcd('0x7'));var logger=require(_0xbdcd('0x8'))(_0xbdcd('0x9'));var config=require(_0xbdcd('0xa'));var jayson=require(_0xbdcd('0xb'));var client=jayson[_0xbdcd('0xc')][_0xbdcd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3f2bbc,_0x8744ad,_0xbccbe2){return new BPromise(function(_0x338a29,_0x201493){return client[_0xbdcd('0xe')](_0x3f2bbc,_0xbccbe2)['then'](function(_0x6d798a){logger[_0xbdcd('0xf')]('CloudProvider,\x20%s,\x20%s',_0x8744ad,_0xbdcd('0x10'));logger[_0xbdcd('0x11')](_0xbdcd('0x12'),_0x8744ad,_0xbdcd('0x10'),JSON[_0xbdcd('0x13')](_0x6d798a));if(_0x6d798a[_0xbdcd('0x14')]){if(_0x6d798a[_0xbdcd('0x14')][_0xbdcd('0x15')]===0x1f4){logger['error'](_0xbdcd('0x16'),_0x8744ad,_0x6d798a['error'][_0xbdcd('0x17')]);return _0x201493(_0x6d798a['error']['message']);}logger[_0xbdcd('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8744ad,_0x6d798a[_0xbdcd('0x14')][_0xbdcd('0x17')]);return _0x338a29(_0x6d798a['error'][_0xbdcd('0x17')]);}else{logger[_0xbdcd('0xf')](_0xbdcd('0x16'),_0x8744ad,_0xbdcd('0x10'));_0x338a29(_0x6d798a['result'][_0xbdcd('0x17')]);}})[_0xbdcd('0x18')](function(_0x2893d7){logger[_0xbdcd('0x14')](_0xbdcd('0x16'),_0x8744ad,_0x2893d7);_0x201493(_0x2893d7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b6ca25e..87307f9 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x31c763,_0xfdf52){var _0x517655=function(_0x40cf11){while(--_0x40cf11){_0x31c763['push'](_0x31c763['shift']());}};_0x517655(++_0xfdf52);}(_0xadb5,0xad));var _0x5adb=function(_0x383bf9,_0x269903){_0x383bf9=_0x383bf9-0x0;var _0x7d44fc=_0xadb5[_0x383bf9];return _0x7d44fc;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x374394,_0x19a872){var _0x5ec3ef=function(_0x1210ec){while(--_0x1210ec){_0x374394['push'](_0x374394['shift']());}};_0x5ec3ef(++_0x19a872);}(_0xdb28,0x106));var _0x8db2=function(_0x54b3d8,_0x3a4830){_0x54b3d8=_0x54b3d8-0x0;var _0x2d4354=_0xdb28[_0x54b3d8];return _0x2d4354;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 097523d..b4d4bad 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 _0x4820=['exports','STRING','name','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4820,0x83));var _0x0482=function(_0x1418fa,_0x338bfe){_0x1418fa=_0x1418fa-0x0;var _0x2bc92c=_0x4820[_0x1418fa];return _0x2bc92c;};'use strict';var Sequelize=require(_0x0482('0x0'));module[_0x0482('0x1')]={'name':{'type':Sequelize[_0x0482('0x2')],'unique':_0x0482('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0482('0x2')]},'companyId':{'type':Sequelize[_0x0482('0x2')]},'website':{'type':Sequelize[_0x0482('0x2')]},'phone':{'type':Sequelize[_0x0482('0x2')]},'fax':{'type':Sequelize[_0x0482('0x2')]},'type':{'type':Sequelize[_0x0482('0x2')]},'street':{'type':Sequelize[_0x0482('0x2')]},'postalCode':{'type':Sequelize[_0x0482('0x2')]},'city':{'type':Sequelize[_0x0482('0x2')]},'country':{'type':Sequelize[_0x0482('0x2')]},'email':{'type':Sequelize[_0x0482('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0482('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x0482('0x2')]},'sCity':{'type':Sequelize[_0x0482('0x2')]},'sCountry':{'type':Sequelize[_0x0482('0x2')]},'description':{'type':Sequelize[_0x0482('0x2')]}}; \ No newline at end of file +var _0x1257=['STRING'];(function(_0x2d0a70,_0x28fe51){var _0x127de3=function(_0x58b165){while(--_0x58b165){_0x2d0a70['push'](_0x2d0a70['shift']());}};_0x127de3(++_0x28fe51);}(_0x1257,0x17d));var _0x7125=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x1257[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7125('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7125('0x0')]},'fax':{'type':Sequelize[_0x7125('0x0')]},'type':{'type':Sequelize[_0x7125('0x0')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7125('0x0')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x7125('0x0')]},'sPostalCode':{'type':Sequelize[_0x7125('0x0')]},'sCity':{'type':Sequelize[_0x7125('0x0')]},'sCountry':{'type':Sequelize[_0x7125('0x0')]},'description':{'type':Sequelize[_0x7125('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c94b645..bedd59a 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 _0x311a=['findAll','rows','catch','show','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','getContacts','CmContact','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','update','then','get','UserProfileResource','destroy','end','sendStatus','error','name','CmCompany','describe','model','keys','query','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','map','options','where','includeAll'];(function(_0x57b0aa,_0xbc94c8){var _0x3bc7bd=function(_0x3cf85e){while(--_0x3cf85e){_0x57b0aa['push'](_0x57b0aa['shift']());}};_0x3bc7bd(++_0xbc94c8);}(_0x311a,0xc0));var _0xa311=function(_0x280d42,_0x43ae2f){_0x280d42=_0x280d42-0x0;var _0x25877b=_0x311a[_0x280d42];return _0x25877b;};'use strict';var emlformat=require(_0xa311('0x0'));var rimraf=require(_0xa311('0x1'));var zipdir=require(_0xa311('0x2'));var jsonpatch=require(_0xa311('0x3'));var rp=require(_0xa311('0x4'));var moment=require(_0xa311('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa311('0x6'));var path=require(_0xa311('0x7'));var sox=require(_0xa311('0x8'));var csv=require('to-csv');var ejs=require(_0xa311('0x9'));var fs=require('fs');var fs_extra=require(_0xa311('0xa'));var _=require(_0xa311('0xb'));var squel=require(_0xa311('0xc'));var crypto=require(_0xa311('0xd'));var jsforce=require(_0xa311('0xe'));var deskjs=require(_0xa311('0xf'));var toCsv=require(_0xa311('0x10'));var querystring=require(_0xa311('0x11'));var Papa=require(_0xa311('0x12'));var Redis=require('ioredis');var authService=require(_0xa311('0x13'));var qs=require(_0xa311('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa311('0x15'));var logger=require('../../config/logger')(_0xa311('0x16'));var utils=require(_0xa311('0x17'));var config=require(_0xa311('0x18'));var licenseUtil=require(_0xa311('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2de7c5,_0x15a37d){_0x15a37d=_0x15a37d||0xcc;return function(_0x292eab){if(_0x292eab){return _0x2de7c5['sendStatus'](_0x15a37d);}return _0x2de7c5[_0xa311('0x1a')](_0x15a37d)['end']();};}function respondWithResult(_0x50b7d9,_0x3b4c34){_0x3b4c34=_0x3b4c34||0xc8;return function(_0x5d9714){if(_0x5d9714){return _0x50b7d9['status'](_0x3b4c34)[_0xa311('0x1b')](_0x5d9714);}};}function respondWithFilteredResult(_0x5c04c9,_0x5dc51c){return function(_0x3d2297){if(_0x3d2297){var _0x100adf=typeof _0x5dc51c[_0xa311('0x1c')]===_0xa311('0x1d')&&typeof _0x5dc51c[_0xa311('0x1e')]===_0xa311('0x1d');var _0x4e6e85=_0x3d2297[_0xa311('0x1f')];var _0x48ff7a=_0x100adf?0x0:_0x5dc51c[_0xa311('0x1c')];var _0x53f183=_0x100adf?_0x3d2297[_0xa311('0x1f')]:_0x5dc51c[_0xa311('0x1c')]+_0x5dc51c[_0xa311('0x1e')];var _0x1020ae;if(_0x53f183>=_0x4e6e85){_0x53f183=_0x4e6e85;_0x1020ae=0xc8;}else{_0x1020ae=0xce;}_0x5c04c9[_0xa311('0x1a')](_0x1020ae);return _0x5c04c9[_0xa311('0x20')]('Content-Range',_0x48ff7a+'-'+_0x53f183+'/'+_0x4e6e85)[_0xa311('0x1b')](_0x3d2297);}return null;};}function patchUpdates(_0x281404){return function(_0x4b9ccc){try{jsonpatch[_0xa311('0x21')](_0x4b9ccc,_0x281404,!![]);}catch(_0x53ddc3){return BPromise[_0xa311('0x22')](_0x53ddc3);}return _0x4b9ccc['save']();};}function saveUpdates(_0x360f71,_0xe1cc57){return function(_0x14fbbf){if(_0x14fbbf){return _0x14fbbf[_0xa311('0x23')](_0x360f71)['then'](function(_0x1bda7c){return _0x1bda7c;});}return null;};}function removeEntity(_0x5eaadd,_0x27bbaf){return function(_0xba20b4){if(_0xba20b4){return _0xba20b4['destroy']()[_0xa311('0x24')](function(){var _0x299399=_0xba20b4[_0xa311('0x25')]({'plain':!![]});var _0xef7db6='Companies';return db[_0xa311('0x26')][_0xa311('0x27')]({'where':{'type':_0xef7db6,'resourceId':_0x299399['id']}})[_0xa311('0x24')](function(){return _0xba20b4;});})[_0xa311('0x24')](function(){_0x5eaadd['status'](0xcc)[_0xa311('0x28')]();});}};}function handleEntityNotFound(_0xd84d9c,_0x4bf31f){return function(_0x2c28ac){if(!_0x2c28ac){_0xd84d9c[_0xa311('0x29')](0x194);}return _0x2c28ac;};}function handleError(_0x2a6ec7,_0x4b8d1a){_0x4b8d1a=_0x4b8d1a||0x1f4;return function(_0x31648f){logger[_0xa311('0x2a')](_0x31648f['stack']);if(_0x31648f['name']){delete _0x31648f[_0xa311('0x2b')];}_0x2a6ec7['status'](_0x4b8d1a)['send'](_0x31648f);};}exports['index']=function(_0x5209c6,_0x21edde){var _0x2d3df0={},_0x49d3e5={},_0x1fc2f1={'count':0x0,'rows':[]};return db[_0xa311('0x2c')][_0xa311('0x2d')]()[_0xa311('0x24')](function(_0x255c0a){_0x49d3e5[_0xa311('0x2e')]=_[_0xa311('0x2f')](_0x255c0a);_0x49d3e5[_0xa311('0x30')]=_[_0xa311('0x2f')](_0x5209c6[_0xa311('0x30')]);_0x49d3e5['filters']=_['intersection'](_0x49d3e5[_0xa311('0x2e')],_0x49d3e5[_0xa311('0x30')]);_0x2d3df0[_0xa311('0x31')]=_['intersection'](_0x49d3e5[_0xa311('0x2e')],qs[_0xa311('0x32')](_0x5209c6[_0xa311('0x30')][_0xa311('0x32')]));_0x2d3df0['attributes']=_0x2d3df0[_0xa311('0x31')][_0xa311('0x33')]?_0x2d3df0[_0xa311('0x31')]:_0x49d3e5[_0xa311('0x2e')];if(!_0x5209c6[_0xa311('0x30')]['hasOwnProperty'](_0xa311('0x34'))){_0x2d3df0['limit']=qs['limit'](_0x5209c6[_0xa311('0x30')]['limit']);_0x2d3df0[_0xa311('0x1c')]=qs[_0xa311('0x1c')](_0x5209c6[_0xa311('0x30')]['offset']);}_0x2d3df0[_0xa311('0x35')]=qs[_0xa311('0x36')](_0x5209c6[_0xa311('0x30')][_0xa311('0x36')]);_0x2d3df0['where']=qs[_0xa311('0x37')](_[_0xa311('0x38')](_0x5209c6['query'],_0x49d3e5['filters']),_0x255c0a);if(_0x5209c6['query'][_0xa311('0x39')]){_0x2d3df0['where']=_[_0xa311('0x3a')](_0x2d3df0['where'],{'$or':_[_0xa311('0x3b')](_0x2d3df0[_0xa311('0x31')],function(_0x4197e2){var _0x51b084={};_0x51b084[_0x4197e2]={'$like':'%'+_0x5209c6[_0xa311('0x30')]['filter']+'%'};return _0x51b084;})});}_0x2d3df0=_[_0xa311('0x3a')]({},_0x2d3df0,_0x5209c6[_0xa311('0x3c')]);var _0x2b7104={'where':_0x2d3df0[_0xa311('0x3d')]};return db[_0xa311('0x2c')][_0xa311('0x1f')](_0x2b7104)[_0xa311('0x24')](function(_0x522a52){_0x1fc2f1[_0xa311('0x1f')]=_0x522a52;if(_0x5209c6['query'][_0xa311('0x3e')]){_0x2d3df0['include']=[{'all':!![]}];}return db['CmCompany'][_0xa311('0x3f')](_0x2d3df0);})[_0xa311('0x24')](function(_0x40e0b8){_0x1fc2f1[_0xa311('0x40')]=_0x40e0b8;return _0x1fc2f1;})[_0xa311('0x24')](respondWithFilteredResult(_0x21edde,_0x2d3df0))[_0xa311('0x41')](handleError(_0x21edde,null));})[_0xa311('0x41')](handleError(_0x21edde,null));};exports[_0xa311('0x42')]=function(_0xbf35f8,_0x564925){var _0x179031={'raw':![],'where':{'id':_0xbf35f8['params']['id']}},_0x187ec1={};_0x187ec1['model']=_[_0xa311('0x2f')](db[_0xa311('0x2c')][_0xa311('0x43')]);_0x187ec1[_0xa311('0x30')]=_['keys'](_0xbf35f8['query']);_0x187ec1[_0xa311('0x37')]=_[_0xa311('0x44')](_0x187ec1[_0xa311('0x2e')],_0x187ec1[_0xa311('0x30')]);_0x179031[_0xa311('0x31')]=_[_0xa311('0x44')](_0x187ec1['model'],qs[_0xa311('0x32')](_0xbf35f8[_0xa311('0x30')][_0xa311('0x32')]));_0x179031[_0xa311('0x31')]=_0x179031[_0xa311('0x31')]['length']?_0x179031[_0xa311('0x31')]:_0x187ec1[_0xa311('0x2e')];if(_0xbf35f8[_0xa311('0x30')]['includeAll']){_0x179031['include']=[{'all':!![]}];}_0x179031=_[_0xa311('0x3a')]({},_0x179031,_0xbf35f8[_0xa311('0x3c')]);return db['CmCompany'][_0xa311('0x45')](_0x179031)[_0xa311('0x24')](handleEntityNotFound(_0x564925,null))[_0xa311('0x24')](respondWithResult(_0x564925,null))[_0xa311('0x41')](handleError(_0x564925,null));};exports[_0xa311('0x46')]=function(_0x580224,_0x2a1975){return db[_0xa311('0x2c')][_0xa311('0x46')](_0x580224[_0xa311('0x47')],{})[_0xa311('0x24')](function(_0x5bc022){var _0x4e11aa=_0x580224[_0xa311('0x48')][_0xa311('0x25')]({'plain':!![]});if(!_0x4e11aa)throw new Error(_0xa311('0x49'));if(_0x4e11aa[_0xa311('0x4a')]==='user'){var _0x6d4f09=_0x5bc022[_0xa311('0x25')]({'plain':!![]});var _0xa7c579=_0xa311('0x4b');return db[_0xa311('0x4c')][_0xa311('0x45')]({'where':{'name':_0xa7c579,'userProfileId':_0x4e11aa[_0xa311('0x4d')]},'raw':!![]})[_0xa311('0x24')](function(_0x3983d8){if(_0x3983d8&&_0x3983d8['autoAssociation']===0x0){return db[_0xa311('0x26')]['create']({'name':_0x6d4f09[_0xa311('0x2b')],'resourceId':_0x6d4f09['id'],'type':_0x3983d8['name'],'sectionId':_0x3983d8['id']},{})[_0xa311('0x24')](function(){return _0x5bc022;});}else{return _0x5bc022;}})[_0xa311('0x41')](function(_0x2d80ef){logger['error'](_0xa311('0x4e'),_0x2d80ef);throw _0x2d80ef;});}return _0x5bc022;})[_0xa311('0x24')](respondWithResult(_0x2a1975,0xc9))[_0xa311('0x41')](handleError(_0x2a1975,null));};exports[_0xa311('0x23')]=function(_0x24e1d2,_0x111bc4){if(_0x24e1d2[_0xa311('0x47')]['id']){delete _0x24e1d2['body']['id'];}return db['CmCompany']['find']({'where':{'id':_0x24e1d2[_0xa311('0x4f')]['id']}})[_0xa311('0x24')](handleEntityNotFound(_0x111bc4,null))['then'](saveUpdates(_0x24e1d2[_0xa311('0x47')],null))[_0xa311('0x24')](respondWithResult(_0x111bc4,null))['catch'](handleError(_0x111bc4,null));};exports[_0xa311('0x27')]=function(_0x469bac,_0x3076e0){return db[_0xa311('0x2c')][_0xa311('0x45')]({'where':{'id':_0x469bac['params']['id']}})[_0xa311('0x24')](handleEntityNotFound(_0x3076e0,null))[_0xa311('0x24')](removeEntity(_0x3076e0,null))[_0xa311('0x41')](handleError(_0x3076e0,null));};exports[_0xa311('0x2d')]=function(_0x360517,_0x4aee0c){return db[_0xa311('0x2c')][_0xa311('0x2d')]()[_0xa311('0x24')](respondWithResult(_0x4aee0c,null))[_0xa311('0x41')](handleError(_0x4aee0c,null));};exports['addContacts']=function(_0x489e58,_0x3ce2dc,_0xdf8304){return db['CmContact'][_0xa311('0x45')]({'where':{'id':_0x489e58[_0xa311('0x4f')]['id']}})[_0xa311('0x24')](handleEntityNotFound(_0x3ce2dc,null))[_0xa311('0x24')](function(_0x372eb8){if(_0x372eb8){return _0x372eb8[_0xa311('0x50')](_0x489e58[_0xa311('0x47')]['ids'],_['omit'](_0x489e58['body'],[_0xa311('0x51'),'id'])||{});}})[_0xa311('0x24')](respondWithResult(_0x3ce2dc,null))['catch'](handleError(_0x3ce2dc,null));};exports[_0xa311('0x52')]=function(_0x101085,_0x33d1d4,_0x15b678){var _0x1a543d={};var _0x4b601e={};var _0x58eec0;var _0x3527ca;return db[_0xa311('0x2c')]['findOne']({'where':{'id':_0x101085[_0xa311('0x4f')]['id']}})[_0xa311('0x24')](handleEntityNotFound(_0x33d1d4,null))[_0xa311('0x24')](function(_0x6e3e51){if(_0x6e3e51){_0x58eec0=_0x6e3e51;_0x4b601e['model']=_[_0xa311('0x2f')](db[_0xa311('0x53')][_0xa311('0x43')]);_0x4b601e[_0xa311('0x30')]=_['keys'](_0x101085['query']);_0x4b601e[_0xa311('0x37')]=_[_0xa311('0x44')](_0x4b601e[_0xa311('0x2e')],_0x4b601e[_0xa311('0x30')]);_0x1a543d['attributes']=_[_0xa311('0x44')](_0x4b601e[_0xa311('0x2e')],qs[_0xa311('0x32')](_0x101085[_0xa311('0x30')][_0xa311('0x32')]));_0x1a543d[_0xa311('0x31')]=_0x1a543d[_0xa311('0x31')]['length']?_0x1a543d[_0xa311('0x31')]:_0x4b601e[_0xa311('0x2e')];_0x1a543d[_0xa311('0x35')]=qs[_0xa311('0x36')](_0x101085['query'][_0xa311('0x36')]);_0x1a543d['where']=qs['filters'](_['pick'](_0x101085['query'],_0x4b601e[_0xa311('0x37')]));if(_0x101085[_0xa311('0x30')][_0xa311('0x39')]){_0x1a543d['where']=_[_0xa311('0x3a')](_0x1a543d[_0xa311('0x3d')],{'$or':_[_0xa311('0x3b')](_0x1a543d['attributes'],function(_0x461d95){var _0x418a71={};_0x418a71[_0x461d95]={'$like':'%'+_0x101085[_0xa311('0x30')][_0xa311('0x39')]+'%'};return _0x418a71;})});}_0x1a543d=_[_0xa311('0x3a')]({},_0x1a543d,_0x101085['options']);return _0x58eec0['getContacts'](_0x1a543d);}})['then'](function(_0xa3dbe0){if(_0xa3dbe0){_0x3527ca=_0xa3dbe0['length'];if(!_0x101085['query'][_0xa311('0x54')](_0xa311('0x34'))){_0x1a543d[_0xa311('0x1e')]=qs['limit'](_0x101085[_0xa311('0x30')][_0xa311('0x1e')]);_0x1a543d[_0xa311('0x1c')]=qs[_0xa311('0x1c')](_0x101085[_0xa311('0x30')][_0xa311('0x1c')]);}return _0x58eec0[_0xa311('0x52')](_0x1a543d);}})[_0xa311('0x24')](function(_0x39d0fe){if(_0x39d0fe){return _0x39d0fe?{'count':_0x3527ca,'rows':_0x39d0fe}:null;}})[_0xa311('0x24')](respondWithResult(_0x33d1d4,null))[_0xa311('0x41')](handleError(_0x33d1d4,null));}; \ No newline at end of file +var _0xf737=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Companies','UserProfileResource','end','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','addContacts','ids','omit','getContacts','findOne','CmContact','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xf737,0x19f));var _0x7f73=function(_0x5c12d9,_0x441d5f){_0x5c12d9=_0x5c12d9-0x0;var _0x47acaf=_0xf737[_0x5c12d9];return _0x47acaf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f73('0x0'));var jsonpatch=require(_0x7f73('0x1'));var rp=require(_0x7f73('0x2'));var moment=require(_0x7f73('0x3'));var BPromise=require(_0x7f73('0x4'));var Mustache=require('mustache');var util=require(_0x7f73('0x5'));var path=require(_0x7f73('0x6'));var sox=require(_0x7f73('0x7'));var csv=require(_0x7f73('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f73('0x9'));var squel=require(_0x7f73('0xa'));var crypto=require(_0x7f73('0xb'));var jsforce=require(_0x7f73('0xc'));var deskjs=require(_0x7f73('0xd'));var toCsv=require(_0x7f73('0x8'));var querystring=require('querystring');var Papa=require(_0x7f73('0xe'));var Redis=require(_0x7f73('0xf'));var authService=require(_0x7f73('0x10'));var qs=require(_0x7f73('0x11'));var as=require(_0x7f73('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f73('0x13'));var utils=require(_0x7f73('0x14'));var config=require(_0x7f73('0x15'));var licenseUtil=require(_0x7f73('0x16'));var db=require(_0x7f73('0x17'))['db'];function respondWithStatusCode(_0x414e53,_0x29fca0){_0x29fca0=_0x29fca0||0xcc;return function(_0x332ea7){if(_0x332ea7){return _0x414e53[_0x7f73('0x18')](_0x29fca0);}return _0x414e53['status'](_0x29fca0)['end']();};}function respondWithResult(_0x2d0aec,_0x7a0ff2){_0x7a0ff2=_0x7a0ff2||0xc8;return function(_0x3e343b){if(_0x3e343b){return _0x2d0aec[_0x7f73('0x19')](_0x7a0ff2)[_0x7f73('0x1a')](_0x3e343b);}};}function respondWithFilteredResult(_0x1855fd,_0x44a8e6){return function(_0x529715){if(_0x529715){var _0x1c0eab=typeof _0x44a8e6[_0x7f73('0x1b')]===_0x7f73('0x1c')&&typeof _0x44a8e6[_0x7f73('0x1d')]==='undefined';var _0x557c80=_0x529715[_0x7f73('0x1e')];var _0x2cb1bc=_0x1c0eab?0x0:_0x44a8e6['offset'];var _0x26a984=_0x1c0eab?_0x529715[_0x7f73('0x1e')]:_0x44a8e6[_0x7f73('0x1b')]+_0x44a8e6[_0x7f73('0x1d')];var _0x256335;if(_0x26a984>=_0x557c80){_0x26a984=_0x557c80;_0x256335=0xc8;}else{_0x256335=0xce;}_0x1855fd['status'](_0x256335);return _0x1855fd[_0x7f73('0x1f')](_0x7f73('0x20'),_0x2cb1bc+'-'+_0x26a984+'/'+_0x557c80)[_0x7f73('0x1a')](_0x529715);}return null;};}function patchUpdates(_0x28558d){return function(_0x50be1){try{jsonpatch[_0x7f73('0x21')](_0x50be1,_0x28558d,!![]);}catch(_0x2f7f19){return BPromise['reject'](_0x2f7f19);}return _0x50be1[_0x7f73('0x22')]();};}function saveUpdates(_0x530b6b,_0x1fe8bb){return function(_0x4d7ea5){if(_0x4d7ea5){return _0x4d7ea5[_0x7f73('0x23')](_0x530b6b)['then'](function(_0x5a03be){return _0x5a03be;});}return null;};}function removeEntity(_0x4ee7bc,_0x5c4151){return function(_0x216269){if(_0x216269){return _0x216269[_0x7f73('0x24')]()[_0x7f73('0x25')](function(){var _0x37b722=_0x216269[_0x7f73('0x26')]({'plain':!![]});var _0x338cb4=_0x7f73('0x27');return db[_0x7f73('0x28')][_0x7f73('0x24')]({'where':{'type':_0x338cb4,'resourceId':_0x37b722['id']}})['then'](function(){return _0x216269;});})['then'](function(){_0x4ee7bc['status'](0xcc)[_0x7f73('0x29')]();});}};}function handleEntityNotFound(_0xe7f542,_0x126711){return function(_0x199db4){if(!_0x199db4){_0xe7f542[_0x7f73('0x18')](0x194);}return _0x199db4;};}function handleError(_0x576705,_0x3a4794){_0x3a4794=_0x3a4794||0x1f4;return function(_0x43a05e){logger[_0x7f73('0x2a')](_0x43a05e[_0x7f73('0x2b')]);if(_0x43a05e[_0x7f73('0x2c')]){delete _0x43a05e['name'];}_0x576705[_0x7f73('0x19')](_0x3a4794)[_0x7f73('0x2d')](_0x43a05e);};}exports[_0x7f73('0x2e')]=function(_0xb55660,_0x41802c){var _0x3e4626={},_0x3060c8={},_0x59b23a={'count':0x0,'rows':[]};return db[_0x7f73('0x2f')][_0x7f73('0x30')]()[_0x7f73('0x25')](function(_0x57c803){_0x3060c8[_0x7f73('0x31')]=_[_0x7f73('0x32')](_0x57c803);_0x3060c8['query']=_['keys'](_0xb55660[_0x7f73('0x33')]);_0x3060c8[_0x7f73('0x34')]=_[_0x7f73('0x35')](_0x3060c8[_0x7f73('0x31')],_0x3060c8[_0x7f73('0x33')]);_0x3e4626[_0x7f73('0x36')]=_[_0x7f73('0x35')](_0x3060c8[_0x7f73('0x31')],qs['fields'](_0xb55660['query'][_0x7f73('0x37')]));_0x3e4626['attributes']=_0x3e4626[_0x7f73('0x36')][_0x7f73('0x38')]?_0x3e4626['attributes']:_0x3060c8['model'];if(!_0xb55660[_0x7f73('0x33')][_0x7f73('0x39')](_0x7f73('0x3a'))){_0x3e4626[_0x7f73('0x1d')]=qs[_0x7f73('0x1d')](_0xb55660[_0x7f73('0x33')][_0x7f73('0x1d')]);_0x3e4626[_0x7f73('0x1b')]=qs[_0x7f73('0x1b')](_0xb55660[_0x7f73('0x33')]['offset']);}_0x3e4626['order']=qs[_0x7f73('0x3b')](_0xb55660['query'][_0x7f73('0x3b')]);_0x3e4626['where']=qs[_0x7f73('0x34')](_[_0x7f73('0x3c')](_0xb55660[_0x7f73('0x33')],_0x3060c8[_0x7f73('0x34')]),_0x57c803);if(_0xb55660['query'][_0x7f73('0x3d')]){_0x3e4626[_0x7f73('0x3e')]=_[_0x7f73('0x3f')](_0x3e4626[_0x7f73('0x3e')],{'$or':_[_0x7f73('0x40')](_0x3e4626['attributes'],function(_0x316236){var _0x34d3e7={};_0x34d3e7[_0x316236]={'$like':'%'+_0xb55660[_0x7f73('0x33')]['filter']+'%'};return _0x34d3e7;})});}_0x3e4626=_[_0x7f73('0x3f')]({},_0x3e4626,_0xb55660[_0x7f73('0x41')]);var _0x5acade={'where':_0x3e4626[_0x7f73('0x3e')]};return db[_0x7f73('0x2f')][_0x7f73('0x1e')](_0x5acade)[_0x7f73('0x25')](function(_0x555a59){_0x59b23a[_0x7f73('0x1e')]=_0x555a59;if(_0xb55660[_0x7f73('0x33')][_0x7f73('0x42')]){_0x3e4626[_0x7f73('0x43')]=[{'all':!![]}];}return db[_0x7f73('0x2f')][_0x7f73('0x44')](_0x3e4626);})['then'](function(_0x52fcc2){_0x59b23a[_0x7f73('0x45')]=_0x52fcc2;return _0x59b23a;})[_0x7f73('0x25')](respondWithFilteredResult(_0x41802c,_0x3e4626))[_0x7f73('0x46')](handleError(_0x41802c,null));})[_0x7f73('0x46')](handleError(_0x41802c,null));};exports[_0x7f73('0x47')]=function(_0x5dc546,_0x4ec9fb){var _0x511d03={'raw':![],'where':{'id':_0x5dc546[_0x7f73('0x48')]['id']}},_0x35fd7a={};_0x35fd7a[_0x7f73('0x31')]=_[_0x7f73('0x32')](db[_0x7f73('0x2f')][_0x7f73('0x49')]);_0x35fd7a['query']=_[_0x7f73('0x32')](_0x5dc546[_0x7f73('0x33')]);_0x35fd7a[_0x7f73('0x34')]=_['intersection'](_0x35fd7a[_0x7f73('0x31')],_0x35fd7a[_0x7f73('0x33')]);_0x511d03[_0x7f73('0x36')]=_[_0x7f73('0x35')](_0x35fd7a[_0x7f73('0x31')],qs['fields'](_0x5dc546[_0x7f73('0x33')]['fields']));_0x511d03['attributes']=_0x511d03['attributes'][_0x7f73('0x38')]?_0x511d03[_0x7f73('0x36')]:_0x35fd7a[_0x7f73('0x31')];if(_0x5dc546['query'][_0x7f73('0x42')]){_0x511d03['include']=[{'all':!![]}];}_0x511d03=_['merge']({},_0x511d03,_0x5dc546['options']);return db['CmCompany'][_0x7f73('0x4a')](_0x511d03)[_0x7f73('0x25')](handleEntityNotFound(_0x4ec9fb,null))[_0x7f73('0x25')](respondWithResult(_0x4ec9fb,null))[_0x7f73('0x46')](handleError(_0x4ec9fb,null));};exports[_0x7f73('0x4b')]=function(_0x162476,_0x5f1f27){return db[_0x7f73('0x2f')]['create'](_0x162476[_0x7f73('0x4c')],{})['then'](function(_0x489f5d){var _0xf084a6=_0x162476[_0x7f73('0x4d')][_0x7f73('0x26')]({'plain':!![]});if(!_0xf084a6)throw new Error(_0x7f73('0x4e'));if(_0xf084a6['role']===_0x7f73('0x4d')){var _0x4ac6bd=_0x489f5d[_0x7f73('0x26')]({'plain':!![]});var _0x31d175=_0x7f73('0x27');return db['UserProfileSection'][_0x7f73('0x4a')]({'where':{'name':_0x31d175,'userProfileId':_0xf084a6[_0x7f73('0x4f')]},'raw':!![]})[_0x7f73('0x25')](function(_0x12aaf1){if(_0x12aaf1&&_0x12aaf1['autoAssociation']===0x0){return db[_0x7f73('0x28')][_0x7f73('0x4b')]({'name':_0x4ac6bd[_0x7f73('0x2c')],'resourceId':_0x4ac6bd['id'],'type':_0x12aaf1[_0x7f73('0x2c')],'sectionId':_0x12aaf1['id']},{})[_0x7f73('0x25')](function(){return _0x489f5d;});}else{return _0x489f5d;}})[_0x7f73('0x46')](function(_0x1bb3ec){logger[_0x7f73('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bb3ec);throw _0x1bb3ec;});}return _0x489f5d;})[_0x7f73('0x25')](respondWithResult(_0x5f1f27,0xc9))[_0x7f73('0x46')](handleError(_0x5f1f27,null));};exports[_0x7f73('0x23')]=function(_0x209cae,_0x21d3a7){if(_0x209cae[_0x7f73('0x4c')]['id']){delete _0x209cae[_0x7f73('0x4c')]['id'];}return db[_0x7f73('0x2f')]['find']({'where':{'id':_0x209cae[_0x7f73('0x48')]['id']}})[_0x7f73('0x25')](handleEntityNotFound(_0x21d3a7,null))[_0x7f73('0x25')](saveUpdates(_0x209cae[_0x7f73('0x4c')],null))['then'](respondWithResult(_0x21d3a7,null))[_0x7f73('0x46')](handleError(_0x21d3a7,null));};exports[_0x7f73('0x24')]=function(_0x27417a,_0x4df4d7){return db['CmCompany']['find']({'where':{'id':_0x27417a[_0x7f73('0x48')]['id']}})[_0x7f73('0x25')](handleEntityNotFound(_0x4df4d7,null))[_0x7f73('0x25')](removeEntity(_0x4df4d7,null))['catch'](handleError(_0x4df4d7,null));};exports[_0x7f73('0x30')]=function(_0x38da40,_0xd888e3){return db[_0x7f73('0x2f')]['describe']()[_0x7f73('0x25')](respondWithResult(_0xd888e3,null))[_0x7f73('0x46')](handleError(_0xd888e3,null));};exports[_0x7f73('0x50')]=function(_0x4d4db5,_0xbd6d3b,_0x50cd0c){return db['CmContact'][_0x7f73('0x4a')]({'where':{'id':_0x4d4db5[_0x7f73('0x48')]['id']}})['then'](handleEntityNotFound(_0xbd6d3b,null))['then'](function(_0x2b645e){if(_0x2b645e){return _0x2b645e['addContacts'](_0x4d4db5[_0x7f73('0x4c')][_0x7f73('0x51')],_[_0x7f73('0x52')](_0x4d4db5['body'],[_0x7f73('0x51'),'id'])||{});}})['then'](respondWithResult(_0xbd6d3b,null))[_0x7f73('0x46')](handleError(_0xbd6d3b,null));};exports[_0x7f73('0x53')]=function(_0x4eb7a4,_0xf6a43e,_0x43aa28){var _0x5977ed={};var _0x147573={};var _0x28c3ce;var _0x4f3c94;return db[_0x7f73('0x2f')][_0x7f73('0x54')]({'where':{'id':_0x4eb7a4[_0x7f73('0x48')]['id']}})[_0x7f73('0x25')](handleEntityNotFound(_0xf6a43e,null))['then'](function(_0x5a53d2){if(_0x5a53d2){_0x28c3ce=_0x5a53d2;_0x147573['model']=_[_0x7f73('0x32')](db[_0x7f73('0x55')]['rawAttributes']);_0x147573[_0x7f73('0x33')]=_[_0x7f73('0x32')](_0x4eb7a4[_0x7f73('0x33')]);_0x147573['filters']=_[_0x7f73('0x35')](_0x147573[_0x7f73('0x31')],_0x147573['query']);_0x5977ed['attributes']=_[_0x7f73('0x35')](_0x147573[_0x7f73('0x31')],qs['fields'](_0x4eb7a4[_0x7f73('0x33')]['fields']));_0x5977ed[_0x7f73('0x36')]=_0x5977ed['attributes']['length']?_0x5977ed[_0x7f73('0x36')]:_0x147573[_0x7f73('0x31')];_0x5977ed['order']=qs[_0x7f73('0x3b')](_0x4eb7a4['query']['sort']);_0x5977ed[_0x7f73('0x3e')]=qs[_0x7f73('0x34')](_['pick'](_0x4eb7a4['query'],_0x147573[_0x7f73('0x34')]));if(_0x4eb7a4[_0x7f73('0x33')][_0x7f73('0x3d')]){_0x5977ed[_0x7f73('0x3e')]=_[_0x7f73('0x3f')](_0x5977ed[_0x7f73('0x3e')],{'$or':_[_0x7f73('0x40')](_0x5977ed[_0x7f73('0x36')],function(_0x3d45eb){var _0x395392={};_0x395392[_0x3d45eb]={'$like':'%'+_0x4eb7a4[_0x7f73('0x33')][_0x7f73('0x3d')]+'%'};return _0x395392;})});}_0x5977ed=_[_0x7f73('0x3f')]({},_0x5977ed,_0x4eb7a4[_0x7f73('0x41')]);return _0x28c3ce['getContacts'](_0x5977ed);}})[_0x7f73('0x25')](function(_0x2acd49){if(_0x2acd49){_0x4f3c94=_0x2acd49['length'];if(!_0x4eb7a4[_0x7f73('0x33')][_0x7f73('0x39')](_0x7f73('0x3a'))){_0x5977ed[_0x7f73('0x1d')]=qs[_0x7f73('0x1d')](_0x4eb7a4['query'][_0x7f73('0x1d')]);_0x5977ed[_0x7f73('0x1b')]=qs[_0x7f73('0x1b')](_0x4eb7a4[_0x7f73('0x33')][_0x7f73('0x1b')]);}return _0x28c3ce[_0x7f73('0x53')](_0x5977ed);}})[_0x7f73('0x25')](function(_0x485fcf){if(_0x485fcf){return _0x485fcf?{'count':_0x4f3c94,'rows':_0x485fcf}:null;}})[_0x7f73('0x25')](respondWithResult(_0xf6a43e,null))[_0x7f73('0x46')](handleError(_0xf6a43e,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 12884bf..33d22ed 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 _0x5d76=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','CmCompany','lodash','util'];(function(_0x487c8f,_0x332921){var _0x675878=function(_0x559eed){while(--_0x559eed){_0x487c8f['push'](_0x487c8f['shift']());}};_0x675878(++_0x332921);}(_0x5d76,0x8d));var _0x65d7=function(_0x49471e,_0x319f36){_0x49471e=_0x49471e-0x0;var _0x113f10=_0x5d76[_0x49471e];return _0x113f10;};'use strict';var _=require(_0x65d7('0x0'));var util=require(_0x65d7('0x1'));var logger=require(_0x65d7('0x2'))(_0x65d7('0x3'));var moment=require(_0x65d7('0x4'));var BPromise=require(_0x65d7('0x5'));var rp=require(_0x65d7('0x6'));var fs=require('fs');var path=require(_0x65d7('0x7'));var rimraf=require(_0x65d7('0x8'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x65d7('0x9')]=function(_0x607192,_0x4d915d){return _0x607192['define'](_0x65d7('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfee8=['cm_companies','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x4aa3c0,_0x188440){var _0x1a33fd=function(_0x983408){while(--_0x983408){_0x4aa3c0['push'](_0x4aa3c0['shift']());}};_0x1a33fd(++_0x188440);}(_0xfee8,0x15d));var _0x8fee=function(_0x5ab20a,_0x9677a0){_0x5ab20a=_0x5ab20a-0x0;var _0x2414c4=_0xfee8[_0x5ab20a];return _0x2414c4;};'use strict';var _=require(_0x8fee('0x0'));var util=require(_0x8fee('0x1'));var logger=require(_0x8fee('0x2'))(_0x8fee('0x3'));var moment=require('moment');var BPromise=require(_0x8fee('0x4'));var rp=require(_0x8fee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8fee('0x6'));var config=require(_0x8fee('0x7'));var attributes=require(_0x8fee('0x8'));module[_0x8fee('0x9')]=function(_0x543ebe,_0x8dc407){return _0x543ebe[_0x8fee('0xa')]('CmCompany',attributes,{'tableName':_0x8fee('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 b1931e0..aa919c5 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 _0x7009=['jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x7009,0x173));var _0x9700=function(_0x1ea065,_0x55b88e){_0x1ea065=_0x1ea065-0x0;var _0x574cbc=_0x7009[_0x1ea065];return _0x574cbc;};'use strict';var _=require('lodash');var util=require(_0x9700('0x0'));var moment=require('moment');var BPromise=require(_0x9700('0x1'));var rs=require(_0x9700('0x2'));var fs=require('fs');var Redis=require(_0x9700('0x3'));var db=require(_0x9700('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9700('0x5'))(_0x9700('0x6'));var config=require('../../config/environment');var jayson=require(_0x9700('0x7'));var client=jayson[_0x9700('0x8')][_0x9700('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c9b2e,_0x5cbb15,_0x1b58b9){return new BPromise(function(_0x2f6952,_0x4f8e5d){return client[_0x9700('0xa')](_0x5c9b2e,_0x1b58b9)['then'](function(_0x284ca9){logger[_0x9700('0xb')](_0x9700('0xc'),_0x5cbb15,_0x9700('0xd'));logger[_0x9700('0xe')](_0x9700('0xf'),_0x5cbb15,_0x9700('0xd'),JSON['stringify'](_0x284ca9));if(_0x284ca9[_0x9700('0x10')]){if(_0x284ca9[_0x9700('0x10')][_0x9700('0x11')]===0x1f4){logger[_0x9700('0x10')](_0x9700('0xc'),_0x5cbb15,_0x284ca9[_0x9700('0x10')][_0x9700('0x12')]);return _0x4f8e5d(_0x284ca9[_0x9700('0x10')][_0x9700('0x12')]);}logger[_0x9700('0x10')](_0x9700('0xc'),_0x5cbb15,_0x284ca9['error']['message']);return _0x2f6952(_0x284ca9[_0x9700('0x10')]['message']);}else{logger[_0x9700('0xb')](_0x9700('0xc'),_0x5cbb15,_0x9700('0xd'));_0x2f6952(_0x284ca9[_0x9700('0x13')]['message']);}})[_0x9700('0x14')](function(_0x19d20c){logger[_0x9700('0x10')](_0x9700('0xc'),_0x5cbb15,_0x19d20c);_0x4f8e5d(_0x19d20c);});});} \ No newline at end of file +var _0xd14d=['jayson/promise','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xd14d,0x103));var _0xdd14=function(_0x58b542,_0x2dc849){_0x58b542=_0x58b542-0x0;var _0x423500=_0xd14d[_0x58b542];return _0x423500;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdd14('0x0'));var BPromise=require(_0xdd14('0x1'));var rs=require(_0xdd14('0x2'));var fs=require('fs');var Redis=require(_0xdd14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd14('0x4'));var logger=require(_0xdd14('0x5'))(_0xdd14('0x6'));var config=require('../../config/environment');var jayson=require(_0xdd14('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e2478,_0x38c480,_0x571073){return new BPromise(function(_0x3dcd00,_0x3a37b7){return client[_0xdd14('0x8')](_0x5e2478,_0x571073)['then'](function(_0x234fc9){logger[_0xdd14('0x9')](_0xdd14('0xa'),_0x38c480,_0xdd14('0xb'));logger[_0xdd14('0xc')](_0xdd14('0xd'),_0x38c480,'request\x20sent',JSON[_0xdd14('0xe')](_0x234fc9));if(_0x234fc9[_0xdd14('0xf')]){if(_0x234fc9['error'][_0xdd14('0x10')]===0x1f4){logger['error'](_0xdd14('0xa'),_0x38c480,_0x234fc9[_0xdd14('0xf')][_0xdd14('0x11')]);return _0x3a37b7(_0x234fc9['error'][_0xdd14('0x11')]);}logger[_0xdd14('0xf')](_0xdd14('0xa'),_0x38c480,_0x234fc9[_0xdd14('0xf')][_0xdd14('0x11')]);return _0x3dcd00(_0x234fc9[_0xdd14('0xf')]['message']);}else{logger['info'](_0xdd14('0xa'),_0x38c480,'request\x20sent');_0x3dcd00(_0x234fc9[_0xdd14('0x12')][_0xdd14('0x11')]);}})['catch'](function(_0x147008){logger[_0xdd14('0xf')](_0xdd14('0xa'),_0x38c480,_0x147008);_0x3a37b7(_0x147008);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 076d938..2514c6f 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 _0x9e47=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','get','/:id','show','/:id/contacts','post','addContacts','put','update','delete','destroy','exports'];(function(_0x43d635,_0x3405be){var _0x3e739d=function(_0x15a7b0){while(--_0x15a7b0){_0x43d635['push'](_0x43d635['shift']());}};_0x3e739d(++_0x3405be);}(_0x9e47,0x17a));var _0x79e4=function(_0x101960,_0x21ae89){_0x101960=_0x101960-0x0;var _0x46aadd=_0x9e47[_0x101960];return _0x46aadd;};'use strict';var multer=require(_0x79e4('0x0'));var util=require(_0x79e4('0x1'));var path=require(_0x79e4('0x2'));var timeout=require('connect-timeout');var express=require(_0x79e4('0x3'));var router=express[_0x79e4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x79e4('0x5'));var interaction=require(_0x79e4('0x6'));var config=require(_0x79e4('0x7'));var controller=require(_0x79e4('0x8'));router['get']('/',auth[_0x79e4('0x9')](),controller['index']);router[_0x79e4('0xa')]('/describe',auth[_0x79e4('0x9')](),controller['describe']);router[_0x79e4('0xa')](_0x79e4('0xb'),auth[_0x79e4('0x9')](),controller[_0x79e4('0xc')]);router[_0x79e4('0xa')](_0x79e4('0xd'),auth[_0x79e4('0x9')](),controller['getContacts']);router[_0x79e4('0xe')]('/',auth[_0x79e4('0x9')](),controller['create']);router[_0x79e4('0xe')](_0x79e4('0xd'),auth['isAuthenticated'](),controller[_0x79e4('0xf')]);router[_0x79e4('0x10')](_0x79e4('0xb'),auth[_0x79e4('0x9')](),controller[_0x79e4('0x11')]);router[_0x79e4('0x12')]('/:id',auth[_0x79e4('0x9')](),controller[_0x79e4('0x13')]);module[_0x79e4('0x14')]=router; \ No newline at end of file +var _0xd5df=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','destroy','exports','multer'];(function(_0xbdf31b,_0x3fcc5f){var _0x451220=function(_0x2e4946){while(--_0x2e4946){_0xbdf31b['push'](_0xbdf31b['shift']());}};_0x451220(++_0x3fcc5f);}(_0xd5df,0xe5));var _0xfd5d=function(_0x1e15a1,_0x37ee49){_0x1e15a1=_0x1e15a1-0x0;var _0x3ce71e=_0xd5df[_0x1e15a1];return _0x3ce71e;};'use strict';var multer=require(_0xfd5d('0x0'));var util=require('util');var path=require(_0xfd5d('0x1'));var timeout=require(_0xfd5d('0x2'));var express=require(_0xfd5d('0x3'));var router=express[_0xfd5d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfd5d('0x5'));var interaction=require(_0xfd5d('0x6'));var config=require(_0xfd5d('0x7'));var controller=require(_0xfd5d('0x8'));router[_0xfd5d('0x9')]('/',auth[_0xfd5d('0xa')](),controller[_0xfd5d('0xb')]);router[_0xfd5d('0x9')](_0xfd5d('0xc'),auth[_0xfd5d('0xa')](),controller[_0xfd5d('0xd')]);router[_0xfd5d('0x9')](_0xfd5d('0xe'),auth[_0xfd5d('0xa')](),controller[_0xfd5d('0xf')]);router['get'](_0xfd5d('0x10'),auth[_0xfd5d('0xa')](),controller[_0xfd5d('0x11')]);router['post']('/',auth[_0xfd5d('0xa')](),controller['create']);router[_0xfd5d('0x12')](_0xfd5d('0x10'),auth[_0xfd5d('0xa')](),controller[_0xfd5d('0x13')]);router[_0xfd5d('0x14')](_0xfd5d('0xe'),auth[_0xfd5d('0xa')](),controller['update']);router['delete']('/:id',auth[_0xfd5d('0xa')](),controller[_0xfd5d('0x15')]);module[_0xfd5d('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 118dc5c..9103936 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 _0x3316=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x3316,0x1c6));var _0x6331=function(_0x13a5e2,_0x4e2d46){_0x13a5e2=_0x13a5e2-0x0;var _0x42c586=_0x3316[_0x13a5e2];return _0x42c586;};'use strict';var _=require(_0x6331('0x0'));var Sequelize=require(_0x6331('0x1'));module[_0x6331('0x2')]={'firstName':{'type':Sequelize[_0x6331('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6331('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x6331('0x3')]},'city':{'type':Sequelize[_0x6331('0x3')]},'country':{'type':Sequelize[_0x6331('0x3')]},'dateOfBirth':{'type':Sequelize[_0x6331('0x3')]},'description':{'type':Sequelize[_0x6331('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6331('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6331('0x3')]},'url':{'type':Sequelize[_0x6331('0x3')]},'facebook':{'type':Sequelize[_0x6331('0x3')]},'fb_data':{'type':Sequelize[_0x6331('0x3')]},'twitter':{'type':Sequelize[_0x6331('0x3')]},'skype':{'type':Sequelize[_0x6331('0x3')]},'teams':{'type':Sequelize[_0x6331('0x3')]},'viber':{'type':Sequelize[_0x6331('0x3')]},'line':{'type':Sequelize[_0x6331('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x6331('0x3')]},'UserId':{'type':Sequelize[_0x6331('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x6331('0x3')]},'priority':{'type':Sequelize[_0x6331('0x5')](0x2)[_0x6331('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6331('0x7')],'defaultValue':Sequelize[_0x6331('0x8')]},'dialTimezone':{'type':Sequelize[_0x6331('0x3')]},'utcOffset':{'type':Sequelize[_0x6331('0x5')]}}; \ No newline at end of file +var _0x47fd=['lodash','sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW'];(function(_0x47888a,_0x7d2f3a){var _0x2b15a4=function(_0x12a3e9){while(--_0x12a3e9){_0x47888a['push'](_0x47888a['shift']());}};_0x2b15a4(++_0x7d2f3a);}(_0x47fd,0x68));var _0xd47f=function(_0x12ff2c,_0x4cab86){_0x12ff2c=_0x12ff2c-0x0;var _0x2467a3=_0x47fd[_0x12ff2c];return _0x2467a3;};'use strict';var _=require(_0xd47f('0x0'));var Sequelize=require(_0xd47f('0x1'));module[_0xd47f('0x2')]={'firstName':{'type':Sequelize[_0xd47f('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd47f('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xd47f('0x3')]},'country':{'type':Sequelize[_0xd47f('0x3')]},'dateOfBirth':{'type':Sequelize[_0xd47f('0x3')]},'description':{'type':Sequelize[_0xd47f('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd47f('0x3')]},'fax':{'type':Sequelize[_0xd47f('0x3')]},'email':{'type':Sequelize[_0xd47f('0x3')]},'url':{'type':Sequelize[_0xd47f('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xd47f('0x3')]},'skype':{'type':Sequelize[_0xd47f('0x3')]},'teams':{'type':Sequelize[_0xd47f('0x3')]},'viber':{'type':Sequelize[_0xd47f('0x3')]},'line':{'type':Sequelize[_0xd47f('0x3')]},'wechat':{'type':Sequelize[_0xd47f('0x3')]},'telegram':{'type':Sequelize[_0xd47f('0x3')]},'UserId':{'type':Sequelize[_0xd47f('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xd47f('0x3')]},'priority':{'type':Sequelize[_0xd47f('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd47f('0x6')],'defaultValue':Sequelize[_0xd47f('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xd47f('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a9715ef..941cfc5 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 _0x059d=['cf_%d','pickBy','isEmpty','cm_contacts','setFields','id\x20=\x20?','sequelize','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','filter','options','nolimit','setTags','ids','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','PHONE','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','pick','ContactId','include','rows','getHopperHistories','includeAll','getJscriptySessions','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','zipObject','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','User','binding','firstName','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','error\x20child\x20process','importUpdates','agent','No\x20phone\x20column\x20specified','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','callerid','starttime','endtime','duration','note','userDisposition','userThirdDisposition','UserId','fullname','alias','createdAt','DESC','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','customerPort','ratingValue','subject','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','moment','util','path','lodash','squel','papaparse','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','sendStatus','stack','send','index','describe','getOptions','findAll','query','user','CmContact','find','keys','length','startsWith','cf_','columnName','analytics','CmCustomField','displayName','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','join','info','CmHopper','CmHopperBlack','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','catch','create','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','params','Tag','Tags','name','color','literal','Phones.OrderBy','$and','omit','map','format'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x059d,0x187));var _0xd059=function(_0x13e347,_0x101ce9){_0x13e347=_0x13e347-0x0;var _0x70417c=_0x059d[_0x13e347];return _0x70417c;};'use strict';var moment=require(_0xd059('0x0'));var BPromise=require('bluebird');var util=require(_0xd059('0x1'));var path=require(_0xd059('0x2'));var fs=require('fs');var _=require(_0xd059('0x3'));var squel=require(_0xd059('0x4'));var Papa=require(_0xd059('0x5'));var Redis=require('ioredis');var contacts=require(_0xd059('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xd059('0x7'))(_0xd059('0x8'));var config=require(_0xd059('0x9'));var shared=require(_0xd059('0xa'));var db=require(_0xd059('0xb'))['db'];config[_0xd059('0xc')]=_[_0xd059('0xd')](config['redis'],{'host':_0xd059('0xe'),'port':0x18eb});var socket=require(_0xd059('0xf'))(new Redis(config[_0xd059('0xc')]));require(_0xd059('0x10'))[_0xd059('0x11')](socket);function respondWithResult(_0x414bbb,_0x4ccd08){_0x4ccd08=_0x4ccd08||0xc8;return function(_0x2a00a9){if(_0x2a00a9){return _0x414bbb[_0xd059('0x12')](_0x4ccd08)[_0xd059('0x13')](_0x2a00a9);}};}function respondWithFilteredResult(_0x1297ac,_0x3d0991){return function(_0x2196c6){if(_0x2196c6){var _0x2fbff8=typeof _0x3d0991['offset']===_0xd059('0x14')&&typeof _0x3d0991['limit']===_0xd059('0x14');var _0x9046b3=_0x2196c6[_0xd059('0x15')];var _0x215979=_0x2fbff8?0x0:_0x3d0991[_0xd059('0x16')];var _0x33f40c=_0x2fbff8?_0x2196c6[_0xd059('0x15')]:_0x3d0991[_0xd059('0x16')]+_0x3d0991[_0xd059('0x17')];var _0x2d826d;if(_0x33f40c>=_0x9046b3){_0x33f40c=_0x9046b3;_0x2d826d=0xc8;}else{_0x2d826d=0xce;}_0x1297ac[_0xd059('0x12')](_0x2d826d);return _0x1297ac[_0xd059('0x18')](_0xd059('0x19'),_0x215979+'-'+_0x33f40c+'/'+_0x9046b3)[_0xd059('0x13')](_0x2196c6);}return null;};}function saveUpdates(_0x34cfc0){return function(_0x532af1){if(_0x532af1){return _0x532af1[_0xd059('0x1a')](_0x34cfc0)[_0xd059('0x1b')](function(_0x655ca){return _0x655ca;});}return null;};}function removeEntity(_0x47a5f6){return function(_0x3ee61e){if(_0x3ee61e){return _0x3ee61e[_0xd059('0x1c')]()['then'](function(){_0x47a5f6[_0xd059('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37f2f5){return function(_0x480a7f){if(!_0x480a7f){_0x37f2f5[_0xd059('0x1d')](0x194);}return _0x480a7f;};}function handleError(_0x499f41,_0x5afc10){_0x5afc10=_0x5afc10||0x1f4;return function(_0x26c316){logger['error'](_0x26c316[_0xd059('0x1e')]);if(_0x26c316['name']){delete _0x26c316['name'];}_0x499f41[_0xd059('0x12')](_0x5afc10)[_0xd059('0x1f')](_0x26c316);};}exports[_0xd059('0x20')]=function(_0x3ff6c3,_0x11407e){var _0x505412={};return contacts[_0xd059('0x21')]()[_0xd059('0x1b')](function(_0xa3d52b){_0x505412=qs[_0xd059('0x22')](_0xa3d52b,_0x3ff6c3);return contacts[_0xd059('0x23')](_0x3ff6c3[_0xd059('0x24')],_0x3ff6c3[_0xd059('0x25')],_0x505412,_0xa3d52b);})['then'](respondWithFilteredResult(_0x11407e,_0x505412))['catch'](handleError(_0x11407e,null));};exports['destroy']=function(_0x113079,_0x37db5d){return db[_0xd059('0x26')][_0xd059('0x27')]({'where':{'id':_0x113079['params']['id']}})[_0xd059('0x1b')](handleEntityNotFound(_0x37db5d,null))[_0xd059('0x1b')](removeEntity(_0x37db5d,null))['catch'](handleError(_0x37db5d,null));};exports[_0xd059('0x21')]=function(_0x39305a,_0x2aea59){return db[_0xd059('0x26')]['describe']()['then'](function(_0xf628b1){delete _0xf628b1['tags'];for(var _0x52c338=0x0;_0x52c3380x0){return new Promise(function(_0x37db32){var _0x2a8989=[];for(var _0x1d4bf8=0x0;_0x1d4bf8<_0x1bbfc0[_0xd059('0x29')];_0x1d4bf8++){_0x2a8989[_0xd059('0x62')](insertAdditionalPhones(_0x1bbfc0[_0x1d4bf8]['contact'],_0x1bbfc0[_0x1d4bf8][_0xd059('0x5d')]));}Promise[_0xd059('0x66')](_0x2a8989)[_0xd059('0x1b')](function(){_0x37db32(0x1);});})[_0xd059('0x1b')](function(){return{'success':_0x1bc31e,'failure':_0x9267f6,'duplicates':_0x35783c};});}else{return{'success':_0x1bc31e,'failure':_0x9267f6,'duplicates':_0x35783c};}}})[_0xd059('0x1b')](respondWithResult(_0x53e4f4,0xc9))[_0xd059('0x57')](handleError(_0x53e4f4,null));};exports[_0xd059('0x67')]=function(_0x2fc531,_0x38542d){var _0x2b87d1;return db['CmContact'][_0xd059('0x21')]()['then'](function(_0x1c51f2){return db[_0xd059('0x26')]['find']({'where':{'id':_0x2fc531[_0xd059('0x68')]['id']},'include':[{'model':db[_0xd059('0x69')],'as':_0xd059('0x6a'),'attributes':['id',_0xd059('0x6b'),_0xd059('0x6c')],'required':_0x2fc531[_0xd059('0x24')]['tag']?!![]:![]},{'model':db[_0xd059('0x4a')],'as':'Phones','where':{'CmContactId':_0x2fc531[_0xd059('0x68')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':'ItemType'}]}],'order':[db['sequelize'][_0xd059('0x6d')](_0xd059('0x6e'))],'attributes':_['keys'](_0x1c51f2)});})['then'](function(_0x404f21){if(!_[_0xd059('0x59')](_0x404f21)){_0x2b87d1=_0x404f21[_0xd059('0x39')]({'plain':!![]});var _0x270979={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x404f21&&_0x404f21[_0xd059('0x63')]){if(_0x404f21['ListId']){_0x270979[_0xd059('0x60')][_0xd059('0x6f')][_0xd059('0x62')]({'ListId':{'$ne':_0x404f21['ListId']}});}}return db['CmCustomField'][_0xd059('0x23')](_0x270979);}})[_0xd059('0x1b')](function(_0xf3714){if(!_[_0xd059('0x59')](_0xf3714)){return _[_0xd059('0x70')](_0x2b87d1,_[_0xd059('0x71')](_0xf3714,function(_0x2a1135){return util[_0xd059('0x72')](_0xd059('0x73'),_0x2a1135['id']);}));}})[_0xd059('0x1b')](handleEntityNotFound(_0x38542d,null))[_0xd059('0x1b')](respondWithResult(_0x38542d,null))['catch'](handleError(_0x38542d,null));};exports['update']=function(_0x51e34b,_0x567549){var _0x3b7474;if(_0x51e34b['body']['id']){delete _0x51e34b[_0xd059('0x37')]['id'];}if(!_[_0xd059('0x59')](_0x51e34b['body'][_0xd059('0x5a')])){var _0x3754a6=_0x51e34b[_0xd059('0x37')][_0xd059('0x5a')];if(!_[_0xd059('0x59')](shared[_0xd059('0x5b')][_0x3754a6]))_0x51e34b[_0xd059('0x37')][_0xd059('0x5c')]=shared['timezones'][_0x3754a6][_0xd059('0x5c')];}return db['CmContact'][_0xd059('0x27')]({'where':{'id':_0x51e34b['params']['id']}})['then'](handleEntityNotFound(_0x567549,null))[_0xd059('0x1b')](saveUpdates(_0x51e34b[_0xd059('0x37')],null))[_0xd059('0x1b')](function(_0x4d96cc){_0x3b7474=_0x4d96cc;var _0x192ddb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4d96cc&&_0x4d96cc[_0xd059('0x63')]){if(_0x4d96cc['ListId']){_0x192ddb[_0xd059('0x60')][_0xd059('0x6f')][_0xd059('0x62')]({'ListId':{'$ne':_0x4d96cc['ListId']}});}}return db[_0xd059('0x2e')]['findAll'](_0x192ddb);})[_0xd059('0x1b')](function(_0xfaaa01){if(_0xfaaa01){return _[_0xd059('0x70')](_[_0xd059('0x74')](_0x51e34b[_0xd059('0x37')],function(_0x1368b0,_0x5937e1){return _[_0xd059('0x2a')](_0x5937e1,_0xd059('0x2b'));}),_[_0xd059('0x71')](_0xfaaa01,function(_0x13d1b3){return util[_0xd059('0x72')]('cf_%d',_0x13d1b3['id']);}));}})[_0xd059('0x1b')](function(_0x5807c0){if(_0x5807c0&&!_[_0xd059('0x75')](_0x5807c0)){var _0x58ae1f=squel[_0xd059('0x1a')]()['table'](_0xd059('0x76'))[_0xd059('0x77')](_0x5807c0)[_0xd059('0x60')](_0xd059('0x78'),_0x51e34b['params']['id'])['toParam']();return db[_0xd059('0x79')][_0xd059('0x24')](_0x58ae1f[_0xd059('0x7a')],{'replacements':_0x58ae1f[_0xd059('0x32')]});}})['then'](function(){if(_0x51e34b[_0xd059('0x37')][_0xd059('0x7b')]&&_0x3b7474){return db[_0xd059('0x3f')][_0xd059('0x1a')]({'phone':_0x51e34b[_0xd059('0x37')][_0xd059('0x7b')],'OrderBy':0x0},{'where':{'ContactId':_0x3b7474['id']}});}})[_0xd059('0x1b')](function(){return _0x3b7474;})['then'](respondWithResult(_0x567549,null))['catch'](handleError(_0x567549,null));};exports[_0xd059('0x7c')]=function(_0x2c2558,_0x23d8a0){var _0x492bb2={};var _0x42b405={};var _0x130299;var _0x309278;return db[_0xd059('0x26')][_0xd059('0x7d')]({'where':{'id':_0x2c2558[_0xd059('0x68')]['id']}})[_0xd059('0x1b')](handleEntityNotFound(_0x23d8a0,null))[_0xd059('0x1b')](function(_0x5a621f){if(_0x5a621f){_0x130299=_0x5a621f;_0x42b405[_0xd059('0x7e')]=_['keys'](db[_0xd059('0x69')][_0xd059('0x7f')]);_0x42b405[_0xd059('0x24')]=_[_0xd059('0x28')](_0x2c2558[_0xd059('0x24')]);_0x42b405[_0xd059('0x80')]=_[_0xd059('0x81')](_0x42b405[_0xd059('0x7e')],_0x42b405[_0xd059('0x24')]);_0x492bb2[_0xd059('0x82')]=_[_0xd059('0x81')](_0x42b405[_0xd059('0x7e')],qs[_0xd059('0x83')](_0x2c2558[_0xd059('0x24')][_0xd059('0x83')]));_0x492bb2[_0xd059('0x82')]=_0x492bb2['attributes'][_0xd059('0x29')]?_0x492bb2[_0xd059('0x82')]:_0x42b405['model'];_0x492bb2[_0xd059('0x84')]=qs[_0xd059('0x85')](_0x2c2558['query']['sort']);_0x492bb2[_0xd059('0x60')]=qs[_0xd059('0x80')](_['pick'](_0x2c2558[_0xd059('0x24')],_0x42b405['filters']));if(_0x2c2558[_0xd059('0x24')][_0xd059('0x86')]){_0x492bb2['where']=_[_0xd059('0x36')](_0x492bb2['where'],{'$or':_['map'](_0x492bb2[_0xd059('0x82')],function(_0x232da7){var _0x5bd069={};_0x5bd069[_0x232da7]={'$like':'%'+_0x2c2558[_0xd059('0x24')][_0xd059('0x86')]+'%'};return _0x5bd069;})});}_0x492bb2=_['merge']({},_0x492bb2,_0x2c2558[_0xd059('0x87')]);return _0x130299[_0xd059('0x7c')](_0x492bb2);}})[_0xd059('0x1b')](function(_0x48ecb6){if(_0x48ecb6){_0x309278=_0x48ecb6[_0xd059('0x29')];if(!_0x2c2558[_0xd059('0x24')][_0xd059('0x35')](_0xd059('0x88'))){_0x492bb2['limit']=qs['limit'](_0x2c2558['query']['limit']);_0x492bb2[_0xd059('0x16')]=qs[_0xd059('0x16')](_0x2c2558[_0xd059('0x24')][_0xd059('0x16')]);}return _0x130299[_0xd059('0x7c')](_0x492bb2);}})[_0xd059('0x1b')](function(_0x31873f){if(_0x31873f){return _0x31873f?{'count':_0x309278,'rows':_0x31873f}:null;}})[_0xd059('0x1b')](respondWithResult(_0x23d8a0,null))['catch'](handleError(_0x23d8a0,null));};exports[_0xd059('0x89')]=function(_0x4c2373,_0x58d04c){if(_0x4c2373[_0xd059('0x37')]['id']){delete _0x4c2373[_0xd059('0x37')]['id'];}return db[_0xd059('0x26')][_0xd059('0x7d')]({'where':{'id':_0x4c2373['params']['id']}})[_0xd059('0x1b')](handleEntityNotFound(_0x58d04c,null))[_0xd059('0x1b')](function(_0x4dab2c){if(_0x4dab2c){return _0x4dab2c[_0xd059('0x89')](_0x4c2373[_0xd059('0x37')][_0xd059('0x8a')]||[]);}return null;})['then'](respondWithResult(_0x58d04c,null))[_0xd059('0x57')](handleError(_0x58d04c,null));};exports['setAdditionalPhones']=function(_0x57c028,_0x22e3f1){var _0x48404e=[];_0x48404e['push'](addAdditionalPhones(_0x57c028[_0xd059('0x37')]));Promise[_0xd059('0x66')](_0x48404e)['then'](function(){_0x48404e=[];_0x48404e['push'](deleteCmHopperPhones(_0x57c028[_0xd059('0x37')]['id']));_0x48404e[_0xd059('0x62')](addCmHopperPhones(_0x57c028[_0xd059('0x37')]['id']));Promise[_0xd059('0x66')](_0x48404e)[_0xd059('0x1b')](function(){return[0x1];})[_0xd059('0x1b')](respondWithResult(_0x22e3f1,null));});};function addAdditionalPhones(_0xbb4e81){var _0x132f80;return new Promise(function(_0x4fc724){return db[_0xd059('0x4a')][_0xd059('0x1c')]({'where':{'CmContactId':_0xbb4e81['id']}})[_0xd059('0x1b')](function(){db[_0xd059('0x8b')][_0xd059('0x23')]({'raw':!![],'attributes':['id',_0xd059('0x8c')]})['then'](function(_0x15156){var _0x54f100=[];for(var _0x27b528=0x0;_0x27b528<_0xbb4e81[_0xd059('0x8d')][_0xd059('0x29')];_0x27b528++){var _0x378b4d=_0xbb4e81[_0xd059('0x8e')]?_[_0xd059('0x59')](_0xbb4e81[_0xd059('0x8e')][_0x27b528])?'':_0xbb4e81[_0xd059('0x8e')][_0x27b528]:_0xbb4e81['items'][_0x27b528]['ItemTypeId']?_0xbb4e81[_0xd059('0x8d')][_0x27b528][_0xd059('0x8f')]:'';var _0x2eec7e=_[_0xd059('0x59')](_0xbb4e81[_0xd059('0x8d')][_0x27b528][_0xd059('0x90')])?'':_0xbb4e81[_0xd059('0x8d')][_0x27b528]['description'];var _0x41e3e1=_0x378b4d+':'+_0xbb4e81[_0xd059('0x8d')][_0x27b528][_0xd059('0x7b')]+'§'+_0x2eec7e;if(_[_0xd059('0x59')](_0x132f80))_0x132f80=_0x41e3e1;else _0x132f80+=';'+_0x41e3e1;var _0x1840e5=null;var _0x485ab3=null;if(_0xbb4e81['item_types']){if(!_[_0xd059('0x59')](_0xbb4e81['item_types'][_0x27b528])){_0x485ab3=_[_0xd059('0x27')](_0x15156,function(_0x7d173f){return _0x7d173f['id']===_0xbb4e81['item_types'][_0x27b528];});if(!_[_0xd059('0x59')](_0x485ab3)){_0x1840e5=_0x485ab3[_0xd059('0x8c')];}}}else{if(!_['isNil'](_0xbb4e81[_0xd059('0x8d')][_0x27b528])){_0x485ab3=_[_0xd059('0x27')](_0x15156,function(_0x46fe3b){return _0x46fe3b['id']===_0xbb4e81[_0xd059('0x8d')][_0x27b528][_0xd059('0x8f')];});if(!_[_0xd059('0x59')](_0x485ab3)){_0x1840e5=_0x27b528;}}}if(_['isNil'](_0x1840e5)){_0x1840e5=0x64;}_0x54f100['push'](addAdditionalPhone(_0xbb4e81['id'],_0xbb4e81['items'][_0x27b528][_0xd059('0x7b')],_0xbb4e81[_0xd059('0x8e')]?_[_0xd059('0x59')](_0xbb4e81['item_types'][_0x27b528])?null:_0xbb4e81['item_types'][_0x27b528]:_0xbb4e81[_0xd059('0x8d')][_0x27b528][_0xd059('0x8f')]?_0xbb4e81[_0xd059('0x8d')][_0x27b528][_0xd059('0x8f')]:null,_0x1840e5,_0x2eec7e));}Promise[_0xd059('0x66')](_0x54f100)[_0xd059('0x1b')](function(){db['CmContact']['update']({'AdditionalPhones':_0x132f80},{'where':{'id':_0xbb4e81['id']}})[_0xd059('0x1b')](function(){_0x4fc724(0x1);});});});});});}function addAdditionalPhone(_0x2b5c3e,_0x5339bb,_0x2cc2e0,_0x223b0e,_0x9c737e){return db[_0xd059('0x4a')]['find']({'where':{'CmContactId':_0x2b5c3e,'item':_0x5339bb}})['then'](function(_0x438a85){if(_0x438a85)logger['info']('contact\x20phone\x20exists',_0x438a85);else{db[_0xd059('0x4a')]['create']({'CmContactId':_0x2b5c3e,'item':_0x5339bb,'ItemTypeId':_0x2cc2e0,'OrderBy':_0x223b0e,'ItemClass':_0xd059('0x91'),'description':_0x9c737e});}});}function deleteCmHopperPhones(_0x2369b0){return new Promise(function(_0x153bdd){return db['CmHopper'][_0xd059('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2369b0}})[_0xd059('0x1b')](function(_0x1b4805){db['CmHopperAdditionalPhone'][_0xd059('0x1c')]({'where':{'CmHopperId':{'$in':_[_0xd059('0x71')](_0x1b4805,'id')}}});})[_0xd059('0x1b')](function(){_0x153bdd(0x1);});});}function addCmHopperPhones(_0x2564b2){return new Promise(function(_0x1292f4){return db[_0xd059('0x3f')][_0xd059('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2564b2}})[_0xd059('0x1b')](function(_0x445634){var _0x376d5f=[];_['map'](_0x445634,function(_0x840f8a){_0x376d5f[_0xd059('0x62')](createCmHopperPhone(_0x2564b2,_0x840f8a['id']));});Promise[_0xd059('0x66')](_0x376d5f)[_0xd059('0x1b')](function(){_0x1292f4(0x1);});});});}function createCmHopperPhone(_0x19c206,_0x36a295){return new Promise(function(_0x57dbe0){db[_0xd059('0x4a')][_0xd059('0x23')]({'raw':!![],'attributes':[_0xd059('0x92'),_0xd059('0x8c')],'where':{'CmContactId':_0x19c206,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0xd059('0x8c')],'as':_0xd059('0x93')}],'order':[_0xd059('0x8c'),db[_0xd059('0x79')]['literal'](_0xd059('0x94'))]})[_0xd059('0x1b')](function(_0xfeef5f){var _0x2961c9=0x1;var _0x5eafa1=_[_0xd059('0x71')](_0xfeef5f,function(_0x17f622){_0x17f622[_0xd059('0x95')]=_0x36a295;_0x17f622['phone']=_0x17f622['item'];_0x17f622[_0xd059('0x8c')]=_0x2961c9;delete _0x17f622[_0xd059('0x96')];_0x2961c9=_0x2961c9+0x1;return _0x17f622;});return db[_0xd059('0x97')][_0xd059('0x5e')](_0x5eafa1,{});})[_0xd059('0x1b')](function(){_0x57dbe0(0x1);});});}function insertAdditionalPhones(_0x384d70,_0x3122dd){return new Promise(function(_0x4bb651){var _0xdb1f7e=[];for(var _0x31527a=0x0;_0x31527a<_0x3122dd['length'];_0x31527a++){var _0x259191=_0x3122dd[_0x31527a];_0xdb1f7e[_0xd059('0x62')](parseContactItemType(_0x259191));}Promise[_0xd059('0x66')](_0xdb1f7e)[_0xd059('0x1b')](function(){var _0x4da0a6={'id':_0x384d70['id'],'items':_0x3122dd};return addAdditionalPhones(_0x4da0a6)[_0xd059('0x1b')](function(){return addCmHopperPhones(_0x384d70['id']);});})[_0xd059('0x1b')](function(){_0x4bb651(_0x384d70);});});}function parseContactItemType(_0x34ec19){return new Promise(function(_0x49ef23){if(_0x34ec19[_0xd059('0x35')]('ItemTypeId')){_0x49ef23(_0x34ec19);}else{return db['ContactItemType'][_0xd059('0x27')]({'where':{'name':_0x34ec19['ItemType']}})[_0xd059('0x1b')](function(_0x4a092e){if(_[_0xd059('0x59')](_0x4a092e))_0x34ec19[_0xd059('0x8f')]=null;else _0x34ec19[_0xd059('0x8f')]=_0x4a092e['id'];_0x49ef23(_0x34ec19);});}});}exports[_0xd059('0x98')]=function(_0x566453,_0x210980){return db[_0xd059('0x4a')][_0xd059('0x23')]({'raw':!![],'where':{'CmContactId':_0x566453[_0xd059('0x68')]['id'],'ItemClass':_0xd059('0x91')},'include':[{'model':db[_0xd059('0x8b')],'as':_0xd059('0x93')}],'order':[[_0xd059('0x8c')],[db['sequelize'][_0xd059('0x6d')](_0xd059('0x94'))]]})[_0xd059('0x1b')](function(_0x511346){return _0x511346;})[_0xd059('0x1b')](respondWithResult(_0x210980,null))['catch'](handleError(_0x210980,null));};exports[_0xd059('0x99')]=function(_0x86f9f1,_0x4fb69f){return db[_0xd059('0x4a')][_0xd059('0x23')]({'raw':!![],'where':{'CmContactId':_0x86f9f1[_0xd059('0x37')][_0xd059('0x9a')]}})[_0xd059('0x1b')](function(_0x3d3bee){var _0x5aa0a9=_['map'](_0x3d3bee,function(_0x2218fc){_0x2218fc[_0xd059('0x9b')]=_0x86f9f1[_0xd059('0x37')][_0xd059('0x9c')];return _0x2218fc;});return db[_0xd059('0x4a')][_0xd059('0x5e')](_0x5aa0a9,{});})[_0xd059('0x1b')](function(){return addCmHopperPhones(_0x86f9f1[_0xd059('0x37')][_0xd059('0x9c')]);})['then'](function(){return['ok'];})[_0xd059('0x1b')](respondWithResult(_0x4fb69f,null))[_0xd059('0x57')](handleError(_0x4fb69f,null));};exports['rescheduleAdditionalPhones']=function(_0x144ebc,_0x2813eb){var _0x592ca1=[];_0x592ca1[_0xd059('0x62')](createCmHopperPhone(_0x144ebc[_0xd059('0x37')]['id'],_0x144ebc['body'][_0xd059('0x9d')]));Promise[_0xd059('0x66')](_0x592ca1)['then'](function(){return[0x1];})['then'](respondWithResult(_0x2813eb,null));};exports['getHoppers']=function(_0x165d93,_0x2303df){var _0x2a16b7={'raw':![],'where':{}};var _0x4c2cc7={};var _0x9887ff={'count':0x0,'rows':[]};return db[_0xd059('0x26')][_0xd059('0x7d')]({'where':{'id':_0x165d93[_0xd059('0x68')]['id']}})[_0xd059('0x1b')](handleEntityNotFound(_0x2303df,null))[_0xd059('0x1b')](function(_0x40b484){if(_0x40b484){_0x4c2cc7['model']=_[_0xd059('0x28')](db['CmHopper'][_0xd059('0x7f')]);_0x4c2cc7[_0xd059('0x24')]=_[_0xd059('0x28')](_0x165d93['query']);_0x4c2cc7[_0xd059('0x80')]=_['intersection'](_0x4c2cc7['model'],_0x4c2cc7['query']);_0x2a16b7[_0xd059('0x82')]=_[_0xd059('0x81')](_0x4c2cc7['model'],qs[_0xd059('0x83')](_0x165d93[_0xd059('0x24')]['fields']));_0x2a16b7[_0xd059('0x82')]=_0x2a16b7[_0xd059('0x82')][_0xd059('0x29')]?_0x2a16b7['attributes']:_0x4c2cc7[_0xd059('0x7e')];if(!_0x165d93['query'][_0xd059('0x35')](_0xd059('0x88'))){_0x2a16b7[_0xd059('0x17')]=qs[_0xd059('0x17')](_0x165d93['query'][_0xd059('0x17')]);_0x2a16b7[_0xd059('0x16')]=qs['offset'](_0x165d93[_0xd059('0x24')][_0xd059('0x16')]);}_0x2a16b7['order']=qs[_0xd059('0x85')](_0x165d93['query'][_0xd059('0x85')]);_0x2a16b7[_0xd059('0x60')]=qs[_0xd059('0x80')](_[_0xd059('0x9e')](_0x165d93[_0xd059('0x24')],_0x4c2cc7['filters']));_0x2a16b7[_0xd059('0x60')][_0xd059('0x9f')]=_0x40b484['id'];if(_0x165d93[_0xd059('0x24')][_0xd059('0x86')]){_0x2a16b7[_0xd059('0x60')]=_[_0xd059('0x36')](_0x2a16b7['where'],{'$or':_[_0xd059('0x71')](_0x2a16b7[_0xd059('0x82')],function(_0x3d6a0d){var _0x27883d={};_0x27883d[_0x3d6a0d]={'$like':'%'+_0x165d93[_0xd059('0x24')]['filter']+'%'};return _0x27883d;})});}_0x2a16b7=_[_0xd059('0x36')]({},_0x2a16b7,_0x165d93[_0xd059('0x87')]);return db['CmHopper'][_0xd059('0x15')]({'where':_0x2a16b7[_0xd059('0x60')]})[_0xd059('0x1b')](function(_0x545afe){_0x9887ff[_0xd059('0x15')]=_0x545afe;if(_0x165d93[_0xd059('0x24')]['includeAll']){_0x2a16b7[_0xd059('0xa0')]=[{'all':!![]}];}return db[_0xd059('0x3f')][_0xd059('0x23')](_0x2a16b7);})[_0xd059('0x1b')](function(_0x332699){_0x9887ff[_0xd059('0xa1')]=_0x332699;return _0x9887ff;});}})[_0xd059('0x1b')](respondWithFilteredResult(_0x2303df,_0x2a16b7))['catch'](handleError(_0x2303df,null));};exports[_0xd059('0xa2')]=function(_0xb631ad,_0x28a547){var _0xf8b0d4={'raw':!![],'where':{}};var _0x5714c4={};var _0x30d799={'count':0x0,'rows':[]};return db[_0xd059('0x26')][_0xd059('0x7d')]({'where':{'id':_0xb631ad['params']['id']}})[_0xd059('0x1b')](handleEntityNotFound(_0x28a547,null))[_0xd059('0x1b')](function(_0x28286a){if(_0x28286a){_0x5714c4['model']=_['keys'](db[_0xd059('0x4c')]['rawAttributes']);_0x5714c4[_0xd059('0x24')]=_[_0xd059('0x28')](_0xb631ad[_0xd059('0x24')]);_0x5714c4[_0xd059('0x80')]=_['intersection'](_0x5714c4['model'],_0x5714c4['query']);_0xf8b0d4['attributes']=_[_0xd059('0x81')](_0x5714c4[_0xd059('0x7e')],qs[_0xd059('0x83')](_0xb631ad[_0xd059('0x24')]['fields']));_0xf8b0d4[_0xd059('0x82')]=_0xf8b0d4[_0xd059('0x82')][_0xd059('0x29')]?_0xf8b0d4['attributes']:_0x5714c4[_0xd059('0x7e')];if(!_0xb631ad['query'][_0xd059('0x35')](_0xd059('0x88'))){_0xf8b0d4[_0xd059('0x17')]=qs[_0xd059('0x17')](_0xb631ad['query'][_0xd059('0x17')]);_0xf8b0d4['offset']=qs[_0xd059('0x16')](_0xb631ad[_0xd059('0x24')][_0xd059('0x16')]);}_0xf8b0d4[_0xd059('0x84')]=qs['sort'](_0xb631ad[_0xd059('0x24')][_0xd059('0x85')]);_0xf8b0d4[_0xd059('0x60')]=qs['filters'](_[_0xd059('0x9e')](_0xb631ad[_0xd059('0x24')],_0x5714c4[_0xd059('0x80')]));_0xf8b0d4[_0xd059('0x60')]['ContactId']=_0x28286a['id'];if(_0xb631ad['query'][_0xd059('0x86')]){_0xf8b0d4[_0xd059('0x60')]=_[_0xd059('0x36')](_0xf8b0d4[_0xd059('0x60')],{'$or':_['map'](_0xf8b0d4['attributes'],function(_0x3d650d){var _0x280225={};_0x280225[_0x3d650d]={'$like':'%'+_0xb631ad[_0xd059('0x24')][_0xd059('0x86')]+'%'};return _0x280225;})});}_0xf8b0d4=_['merge']({},_0xf8b0d4,_0xb631ad[_0xd059('0x87')]);return db[_0xd059('0x4c')]['count']({'where':_0xf8b0d4[_0xd059('0x60')]})['then'](function(_0x2dde2c){_0x30d799['count']=_0x2dde2c;if(_0xb631ad[_0xd059('0x24')][_0xd059('0xa3')]){_0xf8b0d4[_0xd059('0xa0')]=[{'all':!![]}];}return db[_0xd059('0x4c')][_0xd059('0x23')](_0xf8b0d4);})['then'](function(_0xdfd2b8){_0x30d799['rows']=_0xdfd2b8;return _0x30d799;});}})[_0xd059('0x1b')](respondWithFilteredResult(_0x28a547,_0xf8b0d4))[_0xd059('0x57')](handleError(_0x28a547,null));};exports['getHopperFinals']=function(_0x2bb7e5,_0x51cd4c){var _0x28db0c={'raw':!![],'where':{}};var _0x4a407f={};var _0x5864a6={'count':0x0,'rows':[]};return db['CmContact'][_0xd059('0x7d')]({'where':{'id':_0x2bb7e5['params']['id']}})[_0xd059('0x1b')](handleEntityNotFound(_0x51cd4c,null))['then'](function(_0x1d3324){if(_0x1d3324){_0x4a407f[_0xd059('0x7e')]=_['keys'](db[_0xd059('0x4b')]['rawAttributes']);_0x4a407f[_0xd059('0x24')]=_['keys'](_0x2bb7e5['query']);_0x4a407f[_0xd059('0x80')]=_[_0xd059('0x81')](_0x4a407f[_0xd059('0x7e')],_0x4a407f['query']);_0x28db0c[_0xd059('0x82')]=_[_0xd059('0x81')](_0x4a407f[_0xd059('0x7e')],qs[_0xd059('0x83')](_0x2bb7e5['query'][_0xd059('0x83')]));_0x28db0c[_0xd059('0x82')]=_0x28db0c['attributes'][_0xd059('0x29')]?_0x28db0c['attributes']:_0x4a407f[_0xd059('0x7e')];if(!_0x2bb7e5[_0xd059('0x24')][_0xd059('0x35')]('nolimit')){_0x28db0c[_0xd059('0x17')]=qs[_0xd059('0x17')](_0x2bb7e5[_0xd059('0x24')][_0xd059('0x17')]);_0x28db0c[_0xd059('0x16')]=qs[_0xd059('0x16')](_0x2bb7e5[_0xd059('0x24')][_0xd059('0x16')]);}_0x28db0c[_0xd059('0x84')]=qs[_0xd059('0x85')](_0x2bb7e5[_0xd059('0x24')][_0xd059('0x85')]);_0x28db0c[_0xd059('0x60')]=qs[_0xd059('0x80')](_[_0xd059('0x9e')](_0x2bb7e5['query'],_0x4a407f['filters']));_0x28db0c[_0xd059('0x60')]['ContactId']=_0x1d3324['id'];if(_0x2bb7e5[_0xd059('0x24')][_0xd059('0x86')]){_0x28db0c['where']=_[_0xd059('0x36')](_0x28db0c['where'],{'$or':_[_0xd059('0x71')](_0x28db0c['attributes'],function(_0x15623a){var _0x500cfc={};_0x500cfc[_0x15623a]={'$like':'%'+_0x2bb7e5['query'][_0xd059('0x86')]+'%'};return _0x500cfc;})});}_0x28db0c=_[_0xd059('0x36')]({},_0x28db0c,_0x2bb7e5[_0xd059('0x87')]);return db[_0xd059('0x4b')][_0xd059('0x15')]({'where':_0x28db0c[_0xd059('0x60')]})[_0xd059('0x1b')](function(_0x3800dd){_0x5864a6['count']=_0x3800dd;if(_0x2bb7e5[_0xd059('0x24')][_0xd059('0xa3')]){_0x28db0c[_0xd059('0xa0')]=[{'all':!![]}];}return db[_0xd059('0x4b')][_0xd059('0x23')](_0x28db0c);})[_0xd059('0x1b')](function(_0xb5e07b){_0x5864a6[_0xd059('0xa1')]=_0xb5e07b;return _0x5864a6;});}})[_0xd059('0x1b')](respondWithFilteredResult(_0x51cd4c,_0x28db0c))[_0xd059('0x57')](handleError(_0x51cd4c,null));};exports[_0xd059('0xa4')]=function(_0x113e5d,_0x572eab){var _0x5754f2={'raw':!![],'where':{}};var _0x46bffd={};var _0x19b288={'count':0x0,'rows':[]};return db[_0xd059('0x26')][_0xd059('0x7d')]({'where':{'id':_0x113e5d[_0xd059('0x68')]['id']}})[_0xd059('0x1b')](handleEntityNotFound(_0x572eab,null))['then'](function(_0x51e5d4){if(_0x51e5d4){_0x46bffd[_0xd059('0x7e')]=_[_0xd059('0x28')](db[_0xd059('0x53')][_0xd059('0x7f')]);_0x46bffd[_0xd059('0x24')]=_[_0xd059('0x28')](_0x113e5d[_0xd059('0x24')]);_0x46bffd[_0xd059('0x80')]=_[_0xd059('0x81')](_0x46bffd[_0xd059('0x7e')],_0x46bffd[_0xd059('0x24')]);_0x5754f2[_0xd059('0x82')]=_[_0xd059('0x81')](_0x46bffd[_0xd059('0x7e')],qs[_0xd059('0x83')](_0x113e5d['query']['fields']));_0x5754f2[_0xd059('0x82')]=_0x5754f2['attributes'][_0xd059('0x29')]?_0x5754f2[_0xd059('0x82')]:_0x46bffd[_0xd059('0x7e')];if(!_0x113e5d[_0xd059('0x24')][_0xd059('0x35')](_0xd059('0x88'))){_0x5754f2[_0xd059('0x17')]=qs['limit'](_0x113e5d[_0xd059('0x24')][_0xd059('0x17')]);_0x5754f2[_0xd059('0x16')]=qs[_0xd059('0x16')](_0x113e5d[_0xd059('0x24')]['offset']);}_0x5754f2[_0xd059('0x84')]=qs['sort'](_0x113e5d[_0xd059('0x24')][_0xd059('0x85')]);_0x5754f2['where']=qs[_0xd059('0x80')](_['pick'](_0x113e5d[_0xd059('0x24')],_0x46bffd[_0xd059('0x80')]));_0x5754f2[_0xd059('0x60')][_0xd059('0x9f')]=_0x51e5d4['id'];if(_0x113e5d[_0xd059('0x24')][_0xd059('0x86')]){_0x5754f2[_0xd059('0x60')]=_[_0xd059('0x36')](_0x5754f2[_0xd059('0x60')],{'$or':_[_0xd059('0x71')](_0x5754f2[_0xd059('0x82')],function(_0x30e6b2){var _0x33623a={};_0x33623a[_0x30e6b2]={'$like':'%'+_0x113e5d[_0xd059('0x24')][_0xd059('0x86')]+'%'};return _0x33623a;})});}_0x5754f2=_[_0xd059('0x36')]({},_0x5754f2,_0x113e5d[_0xd059('0x87')]);return db[_0xd059('0x53')][_0xd059('0x15')]({'where':_0x5754f2[_0xd059('0x60')]})['then'](function(_0x331b34){_0x19b288['count']=_0x331b34;if(_0x113e5d['query'][_0xd059('0xa3')]){_0x5754f2[_0xd059('0xa0')]=[{'all':!![]}];}return db[_0xd059('0x53')][_0xd059('0x23')](_0x5754f2);})['then'](function(_0x5c74dd){_0x19b288[_0xd059('0xa1')]=_0x5c74dd;return _0x19b288;});}})[_0xd059('0x1b')](respondWithFilteredResult(_0x572eab,_0x5754f2))[_0xd059('0x57')](handleError(_0x572eab,null));};exports['uploadCsv']=function(_0x5e5c97,_0x5d99d6){try{if(!_0x5e5c97[_0xd059('0x37')]['ListId']){throw new Error(_0xd059('0xa5'));}if(!_0x5e5c97[_0xd059('0x37')][_0xd059('0xa6')]){throw new Error(_0xd059('0xa7'));}if(!_0x5e5c97['body'][_0xd059('0xa8')]){throw new Error(_0xd059('0xa9'));}if(!_0x5e5c97[_0xd059('0x37')][_0xd059('0xaa')]){throw new Error(_0xd059('0xab'));}var _0x1ce8eb=_0x5e5c97[_0xd059('0x37')][_0xd059('0xa6')][_0xd059('0xac')](',');var _0x4feba7=_0x5e5c97['body'][_0xd059('0xa8')][_0xd059('0xac')](',');if(!_0x1ce8eb['length']||!_0x4feba7[_0xd059('0x29')]||_0x1ce8eb[_0xd059('0x29')]!==_0x4feba7[_0xd059('0x29')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x5e5c97[_0xd059('0x37')]['fields']=_[_0xd059('0xad')](_0x1ce8eb,_0x4feba7);if(!_0x5e5c97['body'][_0xd059('0x83')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5e5c97[_0xd059('0x37')][_0xd059('0x83')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x1d0f3f=path[_0xd059('0x3d')](config['root'],_0xd059('0xae'),_0x5e5c97[_0xd059('0xaf')][_0xd059('0xb0')]);fs[_0xd059('0xb1')](_0x1d0f3f,parseInt('0777',0x8));var _0x420f40=require(_0xd059('0xb2'))[_0xd059('0xb3')](path[_0xd059('0x3d')](__dirname,_0xd059('0xb4')),[_0x1d0f3f,_0x5e5c97[_0xd059('0x37')]['binding_keys'],_0x5e5c97['body']['binding_values'],_0x5e5c97[_0xd059('0x37')][_0xd059('0x63')],_0x5e5c97[_0xd059('0x37')][_0xd059('0xb5')],_0x5e5c97['body'][_0xd059('0x5f')],_0x5e5c97[_0xd059('0x37')][_0xd059('0xaa')]]);return _0x5d99d6[_0xd059('0x12')](0xc8)[_0xd059('0x13')]({'message':_0xd059('0xb6'),'pid':_0x420f40[_0xd059('0xb7')]});}catch(_0x4540c8){return _0x5d99d6[_0xd059('0x12')](0x1f4)[_0xd059('0x1f')](_0x4540c8);}};exports[_0xd059('0xb8')]=function(_0x14cfe7,_0x192712){var _0x3e7eb7=fs[_0xd059('0xb9')](_0x14cfe7[_0xd059('0xaf')][_0xd059('0x2')]);Papa[_0xd059('0xba')](_0x3e7eb7,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x36b2c0){return _0x192712['status'](0xc8)[_0xd059('0x13')]({'file':_0x14cfe7[_0xd059('0xaf')],'fields':_0x36b2c0['meta']['fields']});}});};exports[_0xd059('0xbb')]=function(_0x2a706b,_0x16566b){return db[_0xd059('0xbc')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xd059('0x1b')](function(_0x4256e8){var _0x13eca2=![];if(!_0x2a706b[_0xd059('0x37')][_0xd059('0x63')]){throw new Error(_0xd059('0xa5'));}if(!_0x2a706b[_0xd059('0x37')][_0xd059('0xbd')][_0xd059('0x7b')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2a706b[_0xd059('0x37')][_0xd059('0xbd')][_0xd059('0xbe')]){throw new Error(_0xd059('0xbf'));}if(!_0x2a706b[_0xd059('0x37')][_0xd059('0xaa')]){throw new Error(_0xd059('0xab'));}var _0xf06b0c=require(_0xd059('0xb2'))[_0xd059('0xb3')](path[_0xd059('0x3d')](__dirname,_0xd059('0xc0')),[_0x2a706b[_0xd059('0x68')]['id'],JSON[_0xd059('0xc1')](_0x2a706b[_0xd059('0x37')]),JSON[_0xd059('0xc1')](_0x4256e8)]);_0xf06b0c['on'](_0xd059('0xc2'),function(){_0x13eca2=!![];return _0x16566b[_0xd059('0x12')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0xf06b0c[_0xd059('0xb7')]});});_0xf06b0c['on']('exit',function(_0xfdb91){if(_0xfdb91&&!_0x13eca2){return _0x16566b[_0xd059('0x12')](0x1f4)[_0xd059('0x13')]({'message':_0xd059('0xc3'),'pid':_0xf06b0c[_0xd059('0xb7')]});}});})[_0xd059('0x57')](handleError(_0x16566b,null));};exports[_0xd059('0xc4')]=function(_0x386faa,_0x301f3b){return db[_0xd059('0xbc')][_0xd059('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd059('0xc5')}})[_0xd059('0x1b')](function(_0x364353){var _0x26158d=![];if(!_0x386faa[_0xd059('0x37')][_0xd059('0x63')]){throw new Error('No\x20ListId\x20specified');}if(!_0x386faa[_0xd059('0x37')][_0xd059('0xbd')][_0xd059('0x7b')]){throw new Error(_0xd059('0xc6'));}if(!_0x386faa[_0xd059('0x37')]['binding'][_0xd059('0xbe')]){throw new Error(_0xd059('0xbf'));}if(!_0x386faa[_0xd059('0x37')][_0xd059('0xaa')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3b41b5=require(_0xd059('0xb2'))[_0xd059('0xb3')](path[_0xd059('0x3d')](__dirname,_0xd059('0xc7')),[_0x386faa[_0xd059('0x68')]['id'],JSON[_0xd059('0xc1')](_0x386faa[_0xd059('0x37')]),JSON['stringify'](_0x364353)]);_0x3b41b5['on'](_0xd059('0xc2'),function(){_0x26158d=!![];return _0x301f3b[_0xd059('0x12')](0xc8)['json']({'message':_0xd059('0xc8'),'pid':_0x3b41b5[_0xd059('0xb7')]});});_0x3b41b5['on'](_0xd059('0xc9'),function(_0x331f63){if(_0x331f63&&!_0x26158d){return _0x301f3b[_0xd059('0x12')](0x1f4)[_0xd059('0x13')]({'message':_0xd059('0xc3'),'pid':_0x3b41b5[_0xd059('0xb7')]});}});})[_0xd059('0x57')](handleError(_0x301f3b,null));};exports[_0xd059('0xca')]=function(_0x276ced,_0x548c5f){var _0x6b90b8=[_0xd059('0xcb'),_0xd059('0xcc'),_0xd059('0xcd'),_0xd059('0xce'),_0xd059('0xcf'),_0xd059('0xd0'),'voice'];var _0x44efb8={'offset':0x0,'order':qs[_0xd059('0x85')](_0xd059('0xd1'))},_0x14a822={'count':0x0,'rows':[]};Promise[_0xd059('0xd2')]()[_0xd059('0x1b')](function(){if(_0x276ced['query'][_0xd059('0xd3')]){if(!_['includes'](_0x6b90b8,_0x276ced[_0xd059('0x24')][_0xd059('0xd3')][_0xd059('0xd4')]())){throw new Error('Invalid\x20channel');}_0x6b90b8=[_0x276ced['query'][_0xd059('0xd3')][_0xd059('0xd4')]()];}if(_0x276ced[_0xd059('0x24')][_0xd059('0xd5')]){try{var _0x4d500b=JSON['parse'](_0x276ced[_0xd059('0x24')]['range']);if(!moment(_0x4d500b['from'])[_0xd059('0xd6')]()){throw new Error(_0xd059('0xd7'));}if(!moment(_0x4d500b['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3fe6e9){throw new Error(_0xd059('0xd8'));}}if(!_0x276ced['query'][_0xd059('0x35')](_0xd059('0x88'))){_0x44efb8['limit']=qs[_0xd059('0x17')](_0x276ced['query'][_0xd059('0x17')]||0xa);_0x44efb8['offset']=qs[_0xd059('0x16')](_0x276ced['query']['offset']);}var _0x105d45=_0x6b90b8[_0xd059('0x71')](function(_0x4fd152){if(_0x4fd152===_0xd059('0xd9')){var _0x154130={'attributes':['id',_0xd059('0xda'),_0xd059('0x31'),_0xd059('0xdb'),'destination',_0xd059('0xdc'),_0xd059('0xdd'),_0xd059('0xde'),_0xd059('0xdf'),_0xd059('0xe0'),'createdAt',_0xd059('0xe1'),'userSecondDisposition',_0xd059('0xe2'),_0xd059('0xe3')],'where':{'ContactId':_0x276ced[_0xd059('0x68')]['id']},'include':[{'model':db[_0xd059('0xbc')],'as':_0xd059('0xbc'),'attributes':['id',_0xd059('0x6b'),_0xd059('0xe4'),_0xd059('0xe5')]}],'order':[[_0xd059('0xe6'),_0xd059('0xe7')]]};if(_0x276ced[_0xd059('0x24')][_0xd059('0xd5')]){_0x154130[_0xd059('0x60')][_0xd059('0xe6')]={'$gte':_0x4d500b[_0xd059('0x38')],'$lte':_0x4d500b['to']};}return db[_0xd059('0x4e')][_0xd059('0xe8')](_0x154130)[_0xd059('0x1b')](function(_0x5c18ae){_0x14a822[_0xd059('0x15')]+=_0x5c18ae[_0xd059('0x15')];return _['map'](_0x5c18ae[_0xd059('0xa1')],function(_0x1e7842){var _0x2134c0=_0x1e7842[_0xd059('0x39')]({'plain':!![]});_0x2134c0[_0xd059('0xd3')]=_0x4fd152;if(_0x2134c0[_0xd059('0xbc')]){_0x2134c0[_0xd059('0xbc')]={'id':_0x2134c0['User']['id'],'name':_0x2134c0[_0xd059('0xbc')][_0xd059('0x6b')],'fullname':_0x2134c0[_0xd059('0xbc')][_0xd059('0xe4')],'alias':_0x2134c0[_0xd059('0xbc')][_0xd059('0xe5')]};}return _0x2134c0;});});}else{var _0x3eb790=_[_0xd059('0xe9')](_0x4fd152)+(_0x4fd152==='chat'?_0xd059('0xea'):_0xd059('0xeb'));var _0x1de8e1={'attributes':['id',_0xd059('0xec'),_0xd059('0xed'),_0xd059('0xe6'),'note',_0xd059('0xee'),_0xd059('0xef'),_0xd059('0xf0'),_0xd059('0xe3'),_0x3eb790+'Id'],'where':{'ContactId':_0x276ced[_0xd059('0x68')]['id']},'include':[{'model':db[_0x3eb790],'as':_0xd059('0xeb'),'attributes':['id',_0xd059('0x6b'),_0xd059('0xf1')]},{'model':db['User'],'as':_0xd059('0xf2'),'attributes':['id','name',_0xd059('0xe4')]},{'model':db[_0xd059('0x69')],'as':'Tags','attributes':['id','name',_0xd059('0x6c')],'through':{'attributes':[]}}],'order':[[_0xd059('0xe6'),_0xd059('0xe7')]]};if(_0x276ced['query'][_0xd059('0xd5')]){_0x1de8e1[_0xd059('0x60')][_0xd059('0xe6')]={'$gte':_0x4d500b['from'],'$lte':_0x4d500b['to']};}switch(_0x4fd152){case _0xd059('0xcc'):_0x1de8e1[_0xd059('0x82')][_0xd059('0x62')]('browserName','customerIp',_0xd059('0xf3'),'deviceModel','osName','ratingMessage','ratingType',_0xd059('0xf4'),'referer');break;case'mail':_0x1de8e1[_0xd059('0x82')][_0xd059('0x62')](_0xd059('0xf5'),_0xd059('0xf6'));break;case'openchannel':_0x1de8e1[_0xd059('0x82')]['push'](_0xd059('0xf7'),_0xd059('0xf8'));break;}return db[_['startCase'](_0x4fd152)+_0xd059('0xf9')]['findAndCountAll'](_0x1de8e1)['then'](function(_0x3fb705){_0x14a822['count']+=_0x3fb705[_0xd059('0x15')];return _['map'](_0x3fb705[_0xd059('0xa1')],function(_0xa01e12){var _0x1c3dbc=_0xa01e12[_0xd059('0x39')]({'plain':!![]});_0x1c3dbc['channel']=_0x4fd152;if(_0x1c3dbc[_0xd059('0xf2')]){_0x1c3dbc['Owner']={'id':_0x1c3dbc[_0xd059('0xf2')]['id'],'name':_0x1c3dbc[_0xd059('0xf2')][_0xd059('0x6b')],'fullname':_0x1c3dbc[_0xd059('0xf2')][_0xd059('0xe4')]};}return _0x1c3dbc;});});}});return Promise[_0xd059('0x66')](_0x105d45);})[_0xd059('0x1b')](function(_0x453e9b){return _(_0x453e9b)[_0xd059('0xfa')]()[_0xd059('0xfb')](_0xd059('0xe6'))[_0xd059('0xfc')]()['value']();})[_0xd059('0x1b')](function(_0xf12ac8){_0x14a822[_0xd059('0xa1')]=_0x44efb8[_0xd059('0x17')]?_0xf12ac8['slice'](_0x44efb8[_0xd059('0x16')],_0x44efb8[_0xd059('0x16')]+_0x44efb8[_0xd059('0x17')]):_0xf12ac8;return _0x14a822;})[_0xd059('0x1b')](respondWithFilteredResult(_0x548c5f,_0x44efb8))[_0xd059('0x57')](handleError(_0x548c5f,null));}; \ No newline at end of file +var _0x23c6=['ListId','findOrCreate','hasOwnProperty','contact','all','show','Tags','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','startsWith','cf_','isEmpty','table','setFields','id\x20=\x20?','toParam','sequelize','text','CmHopper','phone','getTags','model','Tag','rawAttributes','intersection','fields','attributes','sort','filters','pick','options','nolimit','setTags','findOne','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','OrderBy','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','ContactId','includeAll','include','rows','getHopperHistories','filter','getHopperFinals','getJscriptySessions','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','No\x20ListId\x20specified','binding','child_process','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','userThirdDisposition','fullname','createdAt','DESC','VoiceCallReport','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','thirdDisposition','key','Owner','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','squel','papaparse','../../components/contacts','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','query','catch','CmContact','find','params','tags','length','keys','displayName','analytics','CmCustomField','columnName','alias','type','values','info','forEach','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailMessage','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','duplicates','where','$or','push'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x23c6,0x1a5));var _0x623c=function(_0x1c9c2d,_0x549e4e){_0x1c9c2d=_0x1c9c2d-0x0;var _0x4c218d=_0x23c6[_0x1c9c2d];return _0x4c218d;};'use strict';var moment=require(_0x623c('0x0'));var BPromise=require(_0x623c('0x1'));var util=require(_0x623c('0x2'));var path=require(_0x623c('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x623c('0x4'));var Papa=require(_0x623c('0x5'));var Redis=require('ioredis');var contacts=require(_0x623c('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x623c('0x7'))('api');var config=require(_0x623c('0x8'));var shared=require(_0x623c('0x9'));var db=require(_0x623c('0xa'))['db'];config[_0x623c('0xb')]=_[_0x623c('0xc')](config[_0x623c('0xb')],{'host':_0x623c('0xd'),'port':0x18eb});var socket=require(_0x623c('0xe'))(new Redis(config['redis']));require(_0x623c('0xf'))[_0x623c('0x10')](socket);function respondWithResult(_0x41c3d1,_0x5209da){_0x5209da=_0x5209da||0xc8;return function(_0x350880){if(_0x350880){return _0x41c3d1[_0x623c('0x11')](_0x5209da)['json'](_0x350880);}};}function respondWithFilteredResult(_0x1cb3bc,_0x58509d){return function(_0x4a9358){if(_0x4a9358){var _0x57c203=typeof _0x58509d[_0x623c('0x12')]===_0x623c('0x13')&&typeof _0x58509d[_0x623c('0x14')]===_0x623c('0x13');var _0x5ab50f=_0x4a9358[_0x623c('0x15')];var _0x7a8ae0=_0x57c203?0x0:_0x58509d['offset'];var _0x116aaf=_0x57c203?_0x4a9358['count']:_0x58509d[_0x623c('0x12')]+_0x58509d['limit'];var _0x2eafa9;if(_0x116aaf>=_0x5ab50f){_0x116aaf=_0x5ab50f;_0x2eafa9=0xc8;}else{_0x2eafa9=0xce;}_0x1cb3bc[_0x623c('0x11')](_0x2eafa9);return _0x1cb3bc[_0x623c('0x16')](_0x623c('0x17'),_0x7a8ae0+'-'+_0x116aaf+'/'+_0x5ab50f)[_0x623c('0x18')](_0x4a9358);}return null;};}function saveUpdates(_0x149415){return function(_0x4dbe10){if(_0x4dbe10){return _0x4dbe10[_0x623c('0x19')](_0x149415)[_0x623c('0x1a')](function(_0x23771a){return _0x23771a;});}return null;};}function removeEntity(_0x119100){return function(_0x3056a4){if(_0x3056a4){return _0x3056a4[_0x623c('0x1b')]()[_0x623c('0x1a')](function(){_0x119100['status'](0xcc)[_0x623c('0x1c')]();});}};}function handleEntityNotFound(_0x4a22c3){return function(_0x96b7b9){if(!_0x96b7b9){_0x4a22c3[_0x623c('0x1d')](0x194);}return _0x96b7b9;};}function handleError(_0x2bd9fb,_0x3a9574){_0x3a9574=_0x3a9574||0x1f4;return function(_0x1e0864){logger[_0x623c('0x1e')](_0x1e0864[_0x623c('0x1f')]);if(_0x1e0864[_0x623c('0x20')]){delete _0x1e0864['name'];}_0x2bd9fb[_0x623c('0x11')](_0x3a9574)[_0x623c('0x21')](_0x1e0864);};}exports[_0x623c('0x22')]=function(_0x443e45,_0x451c84){var _0x39440b={};return contacts[_0x623c('0x23')]()[_0x623c('0x1a')](function(_0x42db6e){_0x39440b=qs[_0x623c('0x24')](_0x42db6e,_0x443e45);return contacts[_0x623c('0x25')](_0x443e45[_0x623c('0x26')],_0x443e45['user'],_0x39440b,_0x42db6e);})['then'](respondWithFilteredResult(_0x451c84,_0x39440b))[_0x623c('0x27')](handleError(_0x451c84,null));};exports[_0x623c('0x1b')]=function(_0x58e5db,_0x6c1f8b){return db[_0x623c('0x28')][_0x623c('0x29')]({'where':{'id':_0x58e5db[_0x623c('0x2a')]['id']}})[_0x623c('0x1a')](handleEntityNotFound(_0x6c1f8b,null))[_0x623c('0x1a')](removeEntity(_0x6c1f8b,null))[_0x623c('0x27')](handleError(_0x6c1f8b,null));};exports[_0x623c('0x23')]=function(_0x5a7402,_0x383efc){return db[_0x623c('0x28')]['describe']()[_0x623c('0x1a')](function(_0x4fa2ed){delete _0x4fa2ed[_0x623c('0x2b')];for(var _0x33530f=0x0;_0x33530f0x0){return new Promise(function(_0x384153){var _0x1ac8bb=[];for(var _0x5940c5=0x0;_0x5940c5<_0xe8d8cb[_0x623c('0x2c')];_0x5940c5++){_0x1ac8bb['push'](insertAdditionalPhones(_0xe8d8cb[_0x5940c5][_0x623c('0x62')],_0xe8d8cb[_0x5940c5]['additionalPhones']));}Promise[_0x623c('0x63')](_0x1ac8bb)[_0x623c('0x1a')](function(){_0x384153(0x1);});})[_0x623c('0x1a')](function(){return{'success':_0xc9e5a6,'failure':_0x6a5b2d,'duplicates':_0x681b88};});}else{return{'success':_0xc9e5a6,'failure':_0x6a5b2d,'duplicates':_0x681b88};}}})[_0x623c('0x1a')](respondWithResult(_0x2e802b,0xc9))['catch'](handleError(_0x2e802b,null));};exports[_0x623c('0x64')]=function(_0x444306,_0x567be5){var _0x28e664;return db[_0x623c('0x28')][_0x623c('0x23')]()[_0x623c('0x1a')](function(_0x1e927e){return db['CmContact'][_0x623c('0x29')]({'where':{'id':_0x444306['params']['id']},'include':[{'model':db['Tag'],'as':_0x623c('0x65'),'attributes':['id',_0x623c('0x20'),_0x623c('0x66')],'required':_0x444306[_0x623c('0x26')][_0x623c('0x67')]?!![]:![]},{'model':db[_0x623c('0x49')],'as':_0x623c('0x68'),'where':{'CmContactId':_0x444306[_0x623c('0x2a')]['id']},'required':![],'include':[{'model':db[_0x623c('0x69')],'as':_0x623c('0x6a')}]}],'order':[db['sequelize'][_0x623c('0x6b')](_0x623c('0x6c'))],'attributes':_[_0x623c('0x2d')](_0x1e927e)});})[_0x623c('0x1a')](function(_0xfd0a84){if(!_[_0x623c('0x55')](_0xfd0a84)){_0x28e664=_0xfd0a84[_0x623c('0x3a')]({'plain':!![]});var _0x2b3524={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xfd0a84&&_0xfd0a84['ListId']){if(_0xfd0a84['ListId']){_0x2b3524[_0x623c('0x5c')][_0x623c('0x6d')][_0x623c('0x5e')]({'ListId':{'$ne':_0xfd0a84[_0x623c('0x5f')]}});}}return db['CmCustomField'][_0x623c('0x25')](_0x2b3524);}})[_0x623c('0x1a')](function(_0x465464){if(!_[_0x623c('0x55')](_0x465464)){return _[_0x623c('0x6e')](_0x28e664,_[_0x623c('0x6f')](_0x465464,function(_0x2b37ad){return util[_0x623c('0x70')](_0x623c('0x71'),_0x2b37ad['id']);}));}})[_0x623c('0x1a')](handleEntityNotFound(_0x567be5,null))[_0x623c('0x1a')](respondWithResult(_0x567be5,null))[_0x623c('0x27')](handleError(_0x567be5,null));};exports['update']=function(_0x3d5332,_0x4837db){var _0x3bf38d;if(_0x3d5332[_0x623c('0x38')]['id']){delete _0x3d5332[_0x623c('0x38')]['id'];}if(!_[_0x623c('0x55')](_0x3d5332['body'][_0x623c('0x56')])){var _0x373824=_0x3d5332[_0x623c('0x38')][_0x623c('0x56')];if(!_['isNil'](shared[_0x623c('0x58')][_0x373824]))_0x3d5332[_0x623c('0x38')][_0x623c('0x57')]=shared['timezones'][_0x373824][_0x623c('0x57')];}return db['CmContact']['find']({'where':{'id':_0x3d5332[_0x623c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4837db,null))[_0x623c('0x1a')](saveUpdates(_0x3d5332['body'],null))['then'](function(_0x31954f){_0x3bf38d=_0x31954f;var _0x3bd0da={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x31954f&&_0x31954f[_0x623c('0x5f')]){if(_0x31954f[_0x623c('0x5f')]){_0x3bd0da[_0x623c('0x5c')][_0x623c('0x6d')]['push']({'ListId':{'$ne':_0x31954f['ListId']}});}}return db[_0x623c('0x30')][_0x623c('0x25')](_0x3bd0da);})[_0x623c('0x1a')](function(_0x48b6cd){if(_0x48b6cd){return _[_0x623c('0x6e')](_[_0x623c('0x72')](_0x3d5332['body'],function(_0x252794,_0x4a4a77){return _[_0x623c('0x73')](_0x4a4a77,_0x623c('0x74'));}),_[_0x623c('0x6f')](_0x48b6cd,function(_0x11c4ca){return util[_0x623c('0x70')]('cf_%d',_0x11c4ca['id']);}));}})[_0x623c('0x1a')](function(_0x5384ca){if(_0x5384ca&&!_[_0x623c('0x75')](_0x5384ca)){var _0x3a5882=squel[_0x623c('0x19')]()[_0x623c('0x76')]('cm_contacts')[_0x623c('0x77')](_0x5384ca)['where'](_0x623c('0x78'),_0x3d5332[_0x623c('0x2a')]['id'])[_0x623c('0x79')]();return db[_0x623c('0x7a')][_0x623c('0x26')](_0x3a5882[_0x623c('0x7b')],{'replacements':_0x3a5882['values']});}})['then'](function(){if(_0x3d5332[_0x623c('0x38')]['phone']&&_0x3bf38d){return db[_0x623c('0x7c')][_0x623c('0x19')]({'phone':_0x3d5332[_0x623c('0x38')][_0x623c('0x7d')],'OrderBy':0x0},{'where':{'ContactId':_0x3bf38d['id']}});}})[_0x623c('0x1a')](function(){return _0x3bf38d;})[_0x623c('0x1a')](respondWithResult(_0x4837db,null))[_0x623c('0x27')](handleError(_0x4837db,null));};exports[_0x623c('0x7e')]=function(_0x49e1a7,_0x16e058){var _0x374701={};var _0x1fc6e5={};var _0x3b283e;var _0x449fca;return db['CmContact']['findOne']({'where':{'id':_0x49e1a7[_0x623c('0x2a')]['id']}})[_0x623c('0x1a')](handleEntityNotFound(_0x16e058,null))[_0x623c('0x1a')](function(_0x38433f){if(_0x38433f){_0x3b283e=_0x38433f;_0x1fc6e5[_0x623c('0x7f')]=_[_0x623c('0x2d')](db[_0x623c('0x80')][_0x623c('0x81')]);_0x1fc6e5['query']=_[_0x623c('0x2d')](_0x49e1a7[_0x623c('0x26')]);_0x1fc6e5['filters']=_[_0x623c('0x82')](_0x1fc6e5[_0x623c('0x7f')],_0x1fc6e5['query']);_0x374701['attributes']=_[_0x623c('0x82')](_0x1fc6e5['model'],qs[_0x623c('0x83')](_0x49e1a7[_0x623c('0x26')]['fields']));_0x374701[_0x623c('0x84')]=_0x374701[_0x623c('0x84')][_0x623c('0x2c')]?_0x374701[_0x623c('0x84')]:_0x1fc6e5['model'];_0x374701['order']=qs['sort'](_0x49e1a7[_0x623c('0x26')][_0x623c('0x85')]);_0x374701[_0x623c('0x5c')]=qs[_0x623c('0x86')](_[_0x623c('0x87')](_0x49e1a7['query'],_0x1fc6e5['filters']));if(_0x49e1a7[_0x623c('0x26')]['filter']){_0x374701[_0x623c('0x5c')]=_[_0x623c('0x37')](_0x374701[_0x623c('0x5c')],{'$or':_[_0x623c('0x6f')](_0x374701[_0x623c('0x84')],function(_0x22b9cd){var _0x264e6f={};_0x264e6f[_0x22b9cd]={'$like':'%'+_0x49e1a7['query']['filter']+'%'};return _0x264e6f;})});}_0x374701=_[_0x623c('0x37')]({},_0x374701,_0x49e1a7[_0x623c('0x88')]);return _0x3b283e[_0x623c('0x7e')](_0x374701);}})['then'](function(_0x3dbe46){if(_0x3dbe46){_0x449fca=_0x3dbe46['length'];if(!_0x49e1a7['query']['hasOwnProperty'](_0x623c('0x89'))){_0x374701[_0x623c('0x14')]=qs[_0x623c('0x14')](_0x49e1a7[_0x623c('0x26')][_0x623c('0x14')]);_0x374701['offset']=qs[_0x623c('0x12')](_0x49e1a7['query'][_0x623c('0x12')]);}return _0x3b283e['getTags'](_0x374701);}})['then'](function(_0x554027){if(_0x554027){return _0x554027?{'count':_0x449fca,'rows':_0x554027}:null;}})[_0x623c('0x1a')](respondWithResult(_0x16e058,null))['catch'](handleError(_0x16e058,null));};exports[_0x623c('0x8a')]=function(_0x130812,_0x9d4bc){if(_0x130812[_0x623c('0x38')]['id']){delete _0x130812[_0x623c('0x38')]['id'];}return db['CmContact'][_0x623c('0x8b')]({'where':{'id':_0x130812[_0x623c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x9d4bc,null))[_0x623c('0x1a')](function(_0x2d14d4){if(_0x2d14d4){return _0x2d14d4[_0x623c('0x8a')](_0x130812[_0x623c('0x38')][_0x623c('0x8c')]||[]);}return null;})['then'](respondWithResult(_0x9d4bc,null))[_0x623c('0x27')](handleError(_0x9d4bc,null));};exports[_0x623c('0x8d')]=function(_0x184300,_0x2e2d45){var _0x506db7=[];_0x506db7[_0x623c('0x5e')](addAdditionalPhones(_0x184300[_0x623c('0x38')]));Promise[_0x623c('0x63')](_0x506db7)[_0x623c('0x1a')](function(){_0x506db7=[];_0x506db7[_0x623c('0x5e')](deleteCmHopperPhones(_0x184300['body']['id']));_0x506db7[_0x623c('0x5e')](addCmHopperPhones(_0x184300['body']['id']));Promise[_0x623c('0x63')](_0x506db7)[_0x623c('0x1a')](function(){return[0x1];})[_0x623c('0x1a')](respondWithResult(_0x2e2d45,null));});};function addAdditionalPhones(_0x54c9b7){var _0x2ac32c;return new Promise(function(_0x27bb14){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x54c9b7['id']}})[_0x623c('0x1a')](function(){db['ContactItemType'][_0x623c('0x25')]({'raw':!![],'attributes':['id','OrderBy']})[_0x623c('0x1a')](function(_0x10f7f6){var _0x49b387=[];for(var _0x2a2c2e=0x0;_0x2a2c2e<_0x54c9b7[_0x623c('0x8e')][_0x623c('0x2c')];_0x2a2c2e++){var _0x3e680c=_0x54c9b7['item_types']?_[_0x623c('0x55')](_0x54c9b7[_0x623c('0x8f')][_0x2a2c2e])?'':_0x54c9b7[_0x623c('0x8f')][_0x2a2c2e]:_0x54c9b7[_0x623c('0x8e')][_0x2a2c2e][_0x623c('0x90')]?_0x54c9b7[_0x623c('0x8e')][_0x2a2c2e][_0x623c('0x90')]:'';var _0x277d6f=_[_0x623c('0x55')](_0x54c9b7[_0x623c('0x8e')][_0x2a2c2e][_0x623c('0x91')])?'':_0x54c9b7[_0x623c('0x8e')][_0x2a2c2e][_0x623c('0x91')];var _0x37788e=_0x3e680c+':'+_0x54c9b7[_0x623c('0x8e')][_0x2a2c2e][_0x623c('0x7d')]+'§'+_0x277d6f;if(_[_0x623c('0x55')](_0x2ac32c))_0x2ac32c=_0x37788e;else _0x2ac32c+=';'+_0x37788e;var _0x498ec6=null;var _0x340352=null;if(_0x54c9b7[_0x623c('0x8f')]){if(!_['isNil'](_0x54c9b7['item_types'][_0x2a2c2e])){_0x340352=_['find'](_0x10f7f6,function(_0x3c3d27){return _0x3c3d27['id']===_0x54c9b7[_0x623c('0x8f')][_0x2a2c2e];});if(!_['isNil'](_0x340352)){_0x498ec6=_0x340352['OrderBy'];}}}else{if(!_[_0x623c('0x55')](_0x54c9b7[_0x623c('0x8e')][_0x2a2c2e])){_0x340352=_[_0x623c('0x29')](_0x10f7f6,function(_0x31127f){return _0x31127f['id']===_0x54c9b7[_0x623c('0x8e')][_0x2a2c2e][_0x623c('0x90')];});if(!_[_0x623c('0x55')](_0x340352)){_0x498ec6=_0x2a2c2e;}}}if(_[_0x623c('0x55')](_0x498ec6)){_0x498ec6=0x64;}_0x49b387[_0x623c('0x5e')](addAdditionalPhone(_0x54c9b7['id'],_0x54c9b7['items'][_0x2a2c2e][_0x623c('0x7d')],_0x54c9b7['item_types']?_['isNil'](_0x54c9b7[_0x623c('0x8f')][_0x2a2c2e])?null:_0x54c9b7[_0x623c('0x8f')][_0x2a2c2e]:_0x54c9b7['items'][_0x2a2c2e][_0x623c('0x90')]?_0x54c9b7[_0x623c('0x8e')][_0x2a2c2e][_0x623c('0x90')]:null,_0x498ec6,_0x277d6f));}Promise[_0x623c('0x63')](_0x49b387)[_0x623c('0x1a')](function(){db[_0x623c('0x28')][_0x623c('0x19')]({'AdditionalPhones':_0x2ac32c},{'where':{'id':_0x54c9b7['id']}})[_0x623c('0x1a')](function(){_0x27bb14(0x1);});});});});});}function addAdditionalPhone(_0x5e2227,_0x45a9c9,_0x4ba321,_0x3eb7d0,_0x38ea57){return db[_0x623c('0x49')][_0x623c('0x29')]({'where':{'CmContactId':_0x5e2227,'item':_0x45a9c9}})[_0x623c('0x1a')](function(_0xf880a4){if(_0xf880a4)logger['info'](_0x623c('0x92'),_0xf880a4);else{db[_0x623c('0x49')]['create']({'CmContactId':_0x5e2227,'item':_0x45a9c9,'ItemTypeId':_0x4ba321,'OrderBy':_0x3eb7d0,'ItemClass':_0x623c('0x93'),'description':_0x38ea57});}});}function deleteCmHopperPhones(_0x5b2c4e){return new Promise(function(_0x1d435e){return db[_0x623c('0x7c')][_0x623c('0x25')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5b2c4e}})[_0x623c('0x1a')](function(_0x17d78a){db[_0x623c('0x94')][_0x623c('0x1b')]({'where':{'CmHopperId':{'$in':_[_0x623c('0x6f')](_0x17d78a,'id')}}});})[_0x623c('0x1a')](function(){_0x1d435e(0x1);});});}function addCmHopperPhones(_0x30da8b){return new Promise(function(_0x2662e3){return db[_0x623c('0x7c')][_0x623c('0x25')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x30da8b}})[_0x623c('0x1a')](function(_0x42abd3){var _0x3bf3f9=[];_['map'](_0x42abd3,function(_0xf5555f){_0x3bf3f9[_0x623c('0x5e')](createCmHopperPhone(_0x30da8b,_0xf5555f['id']));});Promise['all'](_0x3bf3f9)['then'](function(){_0x2662e3(0x1);});});});}function createCmHopperPhone(_0x46a73d,_0x3bcef7){return new Promise(function(_0x26ea4a){db[_0x623c('0x49')][_0x623c('0x25')]({'raw':!![],'attributes':['item',_0x623c('0x95')],'where':{'CmContactId':_0x46a73d,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0x623c('0x95')],'as':'ItemType'}],'order':[_0x623c('0x95'),db[_0x623c('0x7a')][_0x623c('0x6b')](_0x623c('0x96'))]})['then'](function(_0x64bd3d){var _0x316394=0x1;var _0x2ae774=_[_0x623c('0x6f')](_0x64bd3d,function(_0x1fb57b){_0x1fb57b[_0x623c('0x97')]=_0x3bcef7;_0x1fb57b['phone']=_0x1fb57b[_0x623c('0x98')];_0x1fb57b[_0x623c('0x95')]=_0x316394;delete _0x1fb57b[_0x623c('0x99')];_0x316394=_0x316394+0x1;return _0x1fb57b;});return db['CmHopperAdditionalPhone'][_0x623c('0x5a')](_0x2ae774,{});})[_0x623c('0x1a')](function(){_0x26ea4a(0x1);});});}function insertAdditionalPhones(_0x4d747c,_0x19ece1){return new Promise(function(_0x3e3bc2){var _0x1fbc96=[];for(var _0x33bf01=0x0;_0x33bf01<_0x19ece1[_0x623c('0x2c')];_0x33bf01++){var _0x474810=_0x19ece1[_0x33bf01];_0x1fbc96[_0x623c('0x5e')](parseContactItemType(_0x474810));}Promise['all'](_0x1fbc96)[_0x623c('0x1a')](function(){var _0x43939d={'id':_0x4d747c['id'],'items':_0x19ece1};return addAdditionalPhones(_0x43939d)[_0x623c('0x1a')](function(){return addCmHopperPhones(_0x4d747c['id']);});})[_0x623c('0x1a')](function(){_0x3e3bc2(_0x4d747c);});});}function parseContactItemType(_0xa0426b){return new Promise(function(_0x267403){if(_0xa0426b[_0x623c('0x61')](_0x623c('0x90'))){_0x267403(_0xa0426b);}else{return db[_0x623c('0x69')]['find']({'where':{'name':_0xa0426b[_0x623c('0x6a')]}})[_0x623c('0x1a')](function(_0x5e0285){if(_[_0x623c('0x55')](_0x5e0285))_0xa0426b[_0x623c('0x90')]=null;else _0xa0426b['ItemTypeId']=_0x5e0285['id'];_0x267403(_0xa0426b);});}});}exports[_0x623c('0x9a')]=function(_0x56844e,_0x45328c){return db[_0x623c('0x49')]['findAll']({'raw':!![],'where':{'CmContactId':_0x56844e[_0x623c('0x2a')]['id'],'ItemClass':_0x623c('0x93')},'include':[{'model':db[_0x623c('0x69')],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x623c('0x7a')]['literal'](_0x623c('0x96'))]]})[_0x623c('0x1a')](function(_0x98c4b7){return _0x98c4b7;})[_0x623c('0x1a')](respondWithResult(_0x45328c,null))['catch'](handleError(_0x45328c,null));};exports[_0x623c('0x9b')]=function(_0x5ee7fa,_0x5bfbd8){return db[_0x623c('0x49')][_0x623c('0x25')]({'raw':!![],'where':{'CmContactId':_0x5ee7fa[_0x623c('0x38')][_0x623c('0x9c')]}})[_0x623c('0x1a')](function(_0x359795){var _0x264b33=_['map'](_0x359795,function(_0x2d7a6c){_0x2d7a6c['CmContactId']=_0x5ee7fa[_0x623c('0x38')][_0x623c('0x9d')];return _0x2d7a6c;});return db[_0x623c('0x49')][_0x623c('0x5a')](_0x264b33,{});})[_0x623c('0x1a')](function(){return addCmHopperPhones(_0x5ee7fa[_0x623c('0x38')][_0x623c('0x9d')]);})[_0x623c('0x1a')](function(){return['ok'];})[_0x623c('0x1a')](respondWithResult(_0x5bfbd8,null))[_0x623c('0x27')](handleError(_0x5bfbd8,null));};exports[_0x623c('0x9e')]=function(_0x72642e,_0x4407d5){var _0x5862a7=[];_0x5862a7[_0x623c('0x5e')](createCmHopperPhone(_0x72642e[_0x623c('0x38')]['id'],_0x72642e[_0x623c('0x38')][_0x623c('0x9f')]));Promise[_0x623c('0x63')](_0x5862a7)[_0x623c('0x1a')](function(){return[0x1];})[_0x623c('0x1a')](respondWithResult(_0x4407d5,null));};exports[_0x623c('0xa0')]=function(_0x472271,_0x160bba){var _0x5e6f67={'raw':![],'where':{}};var _0x34fb1e={};var _0x1161ee={'count':0x0,'rows':[]};return db[_0x623c('0x28')][_0x623c('0x8b')]({'where':{'id':_0x472271[_0x623c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x160bba,null))[_0x623c('0x1a')](function(_0x109d7a){if(_0x109d7a){_0x34fb1e[_0x623c('0x7f')]=_[_0x623c('0x2d')](db[_0x623c('0x7c')][_0x623c('0x81')]);_0x34fb1e['query']=_[_0x623c('0x2d')](_0x472271[_0x623c('0x26')]);_0x34fb1e[_0x623c('0x86')]=_[_0x623c('0x82')](_0x34fb1e[_0x623c('0x7f')],_0x34fb1e['query']);_0x5e6f67[_0x623c('0x84')]=_['intersection'](_0x34fb1e[_0x623c('0x7f')],qs[_0x623c('0x83')](_0x472271['query'][_0x623c('0x83')]));_0x5e6f67[_0x623c('0x84')]=_0x5e6f67[_0x623c('0x84')]['length']?_0x5e6f67['attributes']:_0x34fb1e[_0x623c('0x7f')];if(!_0x472271[_0x623c('0x26')][_0x623c('0x61')]('nolimit')){_0x5e6f67['limit']=qs[_0x623c('0x14')](_0x472271[_0x623c('0x26')][_0x623c('0x14')]);_0x5e6f67[_0x623c('0x12')]=qs[_0x623c('0x12')](_0x472271['query'][_0x623c('0x12')]);}_0x5e6f67[_0x623c('0xa1')]=qs[_0x623c('0x85')](_0x472271[_0x623c('0x26')]['sort']);_0x5e6f67[_0x623c('0x5c')]=qs[_0x623c('0x86')](_[_0x623c('0x87')](_0x472271[_0x623c('0x26')],_0x34fb1e[_0x623c('0x86')]));_0x5e6f67[_0x623c('0x5c')][_0x623c('0xa2')]=_0x109d7a['id'];if(_0x472271[_0x623c('0x26')]['filter']){_0x5e6f67[_0x623c('0x5c')]=_[_0x623c('0x37')](_0x5e6f67[_0x623c('0x5c')],{'$or':_[_0x623c('0x6f')](_0x5e6f67['attributes'],function(_0x2d77ca){var _0x24b8d7={};_0x24b8d7[_0x2d77ca]={'$like':'%'+_0x472271['query']['filter']+'%'};return _0x24b8d7;})});}_0x5e6f67=_[_0x623c('0x37')]({},_0x5e6f67,_0x472271[_0x623c('0x88')]);return db[_0x623c('0x7c')][_0x623c('0x15')]({'where':_0x5e6f67['where']})[_0x623c('0x1a')](function(_0x353a39){_0x1161ee[_0x623c('0x15')]=_0x353a39;if(_0x472271[_0x623c('0x26')][_0x623c('0xa3')]){_0x5e6f67[_0x623c('0xa4')]=[{'all':!![]}];}return db[_0x623c('0x7c')][_0x623c('0x25')](_0x5e6f67);})[_0x623c('0x1a')](function(_0x61b19d){_0x1161ee[_0x623c('0xa5')]=_0x61b19d;return _0x1161ee;});}})[_0x623c('0x1a')](respondWithFilteredResult(_0x160bba,_0x5e6f67))[_0x623c('0x27')](handleError(_0x160bba,null));};exports[_0x623c('0xa6')]=function(_0x18fc0b,_0x8448e6){var _0x3a3a3a={'raw':!![],'where':{}};var _0x12851c={};var _0x594986={'count':0x0,'rows':[]};return db['CmContact'][_0x623c('0x8b')]({'where':{'id':_0x18fc0b[_0x623c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x8448e6,null))[_0x623c('0x1a')](function(_0x18c399){if(_0x18c399){_0x12851c['model']=_[_0x623c('0x2d')](db[_0x623c('0x4b')]['rawAttributes']);_0x12851c[_0x623c('0x26')]=_[_0x623c('0x2d')](_0x18fc0b['query']);_0x12851c[_0x623c('0x86')]=_['intersection'](_0x12851c[_0x623c('0x7f')],_0x12851c[_0x623c('0x26')]);_0x3a3a3a[_0x623c('0x84')]=_[_0x623c('0x82')](_0x12851c[_0x623c('0x7f')],qs['fields'](_0x18fc0b[_0x623c('0x26')][_0x623c('0x83')]));_0x3a3a3a[_0x623c('0x84')]=_0x3a3a3a[_0x623c('0x84')][_0x623c('0x2c')]?_0x3a3a3a[_0x623c('0x84')]:_0x12851c[_0x623c('0x7f')];if(!_0x18fc0b[_0x623c('0x26')][_0x623c('0x61')](_0x623c('0x89'))){_0x3a3a3a['limit']=qs[_0x623c('0x14')](_0x18fc0b[_0x623c('0x26')][_0x623c('0x14')]);_0x3a3a3a[_0x623c('0x12')]=qs[_0x623c('0x12')](_0x18fc0b['query'][_0x623c('0x12')]);}_0x3a3a3a[_0x623c('0xa1')]=qs[_0x623c('0x85')](_0x18fc0b[_0x623c('0x26')]['sort']);_0x3a3a3a['where']=qs[_0x623c('0x86')](_[_0x623c('0x87')](_0x18fc0b[_0x623c('0x26')],_0x12851c[_0x623c('0x86')]));_0x3a3a3a['where'][_0x623c('0xa2')]=_0x18c399['id'];if(_0x18fc0b[_0x623c('0x26')][_0x623c('0xa7')]){_0x3a3a3a[_0x623c('0x5c')]=_[_0x623c('0x37')](_0x3a3a3a[_0x623c('0x5c')],{'$or':_[_0x623c('0x6f')](_0x3a3a3a['attributes'],function(_0x154323){var _0x225c00={};_0x225c00[_0x154323]={'$like':'%'+_0x18fc0b['query']['filter']+'%'};return _0x225c00;})});}_0x3a3a3a=_[_0x623c('0x37')]({},_0x3a3a3a,_0x18fc0b[_0x623c('0x88')]);return db[_0x623c('0x4b')][_0x623c('0x15')]({'where':_0x3a3a3a['where']})[_0x623c('0x1a')](function(_0x1ea3a2){_0x594986[_0x623c('0x15')]=_0x1ea3a2;if(_0x18fc0b[_0x623c('0x26')][_0x623c('0xa3')]){_0x3a3a3a[_0x623c('0xa4')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3a3a3a);})[_0x623c('0x1a')](function(_0x40936c){_0x594986[_0x623c('0xa5')]=_0x40936c;return _0x594986;});}})[_0x623c('0x1a')](respondWithFilteredResult(_0x8448e6,_0x3a3a3a))[_0x623c('0x27')](handleError(_0x8448e6,null));};exports[_0x623c('0xa8')]=function(_0x2a1151,_0x114e2a){var _0x4e7cb7={'raw':!![],'where':{}};var _0x406203={};var _0x2e1305={'count':0x0,'rows':[]};return db[_0x623c('0x28')][_0x623c('0x8b')]({'where':{'id':_0x2a1151[_0x623c('0x2a')]['id']}})[_0x623c('0x1a')](handleEntityNotFound(_0x114e2a,null))[_0x623c('0x1a')](function(_0x12bab7){if(_0x12bab7){_0x406203[_0x623c('0x7f')]=_[_0x623c('0x2d')](db[_0x623c('0x4a')][_0x623c('0x81')]);_0x406203[_0x623c('0x26')]=_[_0x623c('0x2d')](_0x2a1151[_0x623c('0x26')]);_0x406203[_0x623c('0x86')]=_[_0x623c('0x82')](_0x406203[_0x623c('0x7f')],_0x406203[_0x623c('0x26')]);_0x4e7cb7[_0x623c('0x84')]=_[_0x623c('0x82')](_0x406203[_0x623c('0x7f')],qs[_0x623c('0x83')](_0x2a1151[_0x623c('0x26')]['fields']));_0x4e7cb7[_0x623c('0x84')]=_0x4e7cb7['attributes'][_0x623c('0x2c')]?_0x4e7cb7[_0x623c('0x84')]:_0x406203[_0x623c('0x7f')];if(!_0x2a1151['query'][_0x623c('0x61')](_0x623c('0x89'))){_0x4e7cb7['limit']=qs[_0x623c('0x14')](_0x2a1151['query'][_0x623c('0x14')]);_0x4e7cb7[_0x623c('0x12')]=qs[_0x623c('0x12')](_0x2a1151[_0x623c('0x26')][_0x623c('0x12')]);}_0x4e7cb7[_0x623c('0xa1')]=qs['sort'](_0x2a1151[_0x623c('0x26')][_0x623c('0x85')]);_0x4e7cb7[_0x623c('0x5c')]=qs[_0x623c('0x86')](_['pick'](_0x2a1151[_0x623c('0x26')],_0x406203['filters']));_0x4e7cb7[_0x623c('0x5c')][_0x623c('0xa2')]=_0x12bab7['id'];if(_0x2a1151[_0x623c('0x26')]['filter']){_0x4e7cb7[_0x623c('0x5c')]=_[_0x623c('0x37')](_0x4e7cb7[_0x623c('0x5c')],{'$or':_[_0x623c('0x6f')](_0x4e7cb7[_0x623c('0x84')],function(_0x211008){var _0x47e1bc={};_0x47e1bc[_0x211008]={'$like':'%'+_0x2a1151[_0x623c('0x26')][_0x623c('0xa7')]+'%'};return _0x47e1bc;})});}_0x4e7cb7=_[_0x623c('0x37')]({},_0x4e7cb7,_0x2a1151['options']);return db[_0x623c('0x4a')][_0x623c('0x15')]({'where':_0x4e7cb7[_0x623c('0x5c')]})['then'](function(_0x259140){_0x2e1305[_0x623c('0x15')]=_0x259140;if(_0x2a1151['query'][_0x623c('0xa3')]){_0x4e7cb7[_0x623c('0xa4')]=[{'all':!![]}];}return db[_0x623c('0x4a')]['findAll'](_0x4e7cb7);})['then'](function(_0x44aff3){_0x2e1305[_0x623c('0xa5')]=_0x44aff3;return _0x2e1305;});}})[_0x623c('0x1a')](respondWithFilteredResult(_0x114e2a,_0x4e7cb7))['catch'](handleError(_0x114e2a,null));};exports[_0x623c('0xa9')]=function(_0x5a2e21,_0x4088a3){var _0x4eedb2={'raw':!![],'where':{}};var _0x322d88={};var _0x16fc7b={'count':0x0,'rows':[]};return db[_0x623c('0x28')][_0x623c('0x8b')]({'where':{'id':_0x5a2e21[_0x623c('0x2a')]['id']}})[_0x623c('0x1a')](handleEntityNotFound(_0x4088a3,null))['then'](function(_0x1b8281){if(_0x1b8281){_0x322d88[_0x623c('0x7f')]=_[_0x623c('0x2d')](db[_0x623c('0x51')][_0x623c('0x81')]);_0x322d88['query']=_['keys'](_0x5a2e21[_0x623c('0x26')]);_0x322d88[_0x623c('0x86')]=_['intersection'](_0x322d88[_0x623c('0x7f')],_0x322d88[_0x623c('0x26')]);_0x4eedb2['attributes']=_[_0x623c('0x82')](_0x322d88[_0x623c('0x7f')],qs[_0x623c('0x83')](_0x5a2e21[_0x623c('0x26')][_0x623c('0x83')]));_0x4eedb2['attributes']=_0x4eedb2[_0x623c('0x84')][_0x623c('0x2c')]?_0x4eedb2[_0x623c('0x84')]:_0x322d88[_0x623c('0x7f')];if(!_0x5a2e21[_0x623c('0x26')]['hasOwnProperty']('nolimit')){_0x4eedb2[_0x623c('0x14')]=qs['limit'](_0x5a2e21[_0x623c('0x26')]['limit']);_0x4eedb2['offset']=qs[_0x623c('0x12')](_0x5a2e21[_0x623c('0x26')]['offset']);}_0x4eedb2[_0x623c('0xa1')]=qs['sort'](_0x5a2e21[_0x623c('0x26')][_0x623c('0x85')]);_0x4eedb2[_0x623c('0x5c')]=qs[_0x623c('0x86')](_[_0x623c('0x87')](_0x5a2e21['query'],_0x322d88[_0x623c('0x86')]));_0x4eedb2[_0x623c('0x5c')][_0x623c('0xa2')]=_0x1b8281['id'];if(_0x5a2e21[_0x623c('0x26')]['filter']){_0x4eedb2['where']=_[_0x623c('0x37')](_0x4eedb2[_0x623c('0x5c')],{'$or':_[_0x623c('0x6f')](_0x4eedb2[_0x623c('0x84')],function(_0x545ba5){var _0x227d4e={};_0x227d4e[_0x545ba5]={'$like':'%'+_0x5a2e21['query'][_0x623c('0xa7')]+'%'};return _0x227d4e;})});}_0x4eedb2=_[_0x623c('0x37')]({},_0x4eedb2,_0x5a2e21['options']);return db[_0x623c('0x51')][_0x623c('0x15')]({'where':_0x4eedb2['where']})[_0x623c('0x1a')](function(_0x29e5e0){_0x16fc7b[_0x623c('0x15')]=_0x29e5e0;if(_0x5a2e21['query'][_0x623c('0xa3')]){_0x4eedb2[_0x623c('0xa4')]=[{'all':!![]}];}return db[_0x623c('0x51')][_0x623c('0x25')](_0x4eedb2);})[_0x623c('0x1a')](function(_0x3da66c){_0x16fc7b[_0x623c('0xa5')]=_0x3da66c;return _0x16fc7b;});}})['then'](respondWithFilteredResult(_0x4088a3,_0x4eedb2))[_0x623c('0x27')](handleError(_0x4088a3,null));};exports['uploadCsv']=function(_0x31b4c2,_0x259de3){try{if(!_0x31b4c2['body'][_0x623c('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x31b4c2[_0x623c('0x38')][_0x623c('0xaa')]){throw new Error(_0x623c('0xab'));}if(!_0x31b4c2[_0x623c('0x38')][_0x623c('0xac')]){throw new Error(_0x623c('0xad'));}if(!_0x31b4c2[_0x623c('0x38')][_0x623c('0xae')]){throw new Error(_0x623c('0xaf'));}var _0x551634=_0x31b4c2['body']['binding_keys']['split'](',');var _0x178369=_0x31b4c2[_0x623c('0x38')][_0x623c('0xac')]['split'](',');if(!_0x551634[_0x623c('0x2c')]||!_0x178369[_0x623c('0x2c')]||_0x551634['length']!==_0x178369[_0x623c('0x2c')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x31b4c2[_0x623c('0x38')][_0x623c('0x83')]=_[_0x623c('0xb0')](_0x551634,_0x178369);if(!_0x31b4c2[_0x623c('0x38')][_0x623c('0x83')][_0x623c('0x7d')]){throw new Error(_0x623c('0xb1'));}if(!_0x31b4c2[_0x623c('0x38')][_0x623c('0x83')][_0x623c('0xb2')]){throw new Error(_0x623c('0xb3'));}var _0xa81daf=path[_0x623c('0x3d')](config[_0x623c('0xb4')],'server/files/tmp',_0x31b4c2[_0x623c('0xb5')][_0x623c('0xb6')]);fs[_0x623c('0xb7')](_0xa81daf,parseInt(_0x623c('0xb8'),0x8));var _0x12eb84=require('child_process')[_0x623c('0xb9')](path[_0x623c('0x3d')](__dirname,_0x623c('0xba')),[_0xa81daf,_0x31b4c2[_0x623c('0x38')][_0x623c('0xaa')],_0x31b4c2['body']['binding_values'],_0x31b4c2['body'][_0x623c('0x5f')],_0x31b4c2[_0x623c('0x38')]['CompanyId'],_0x31b4c2[_0x623c('0x38')][_0x623c('0x5b')],_0x31b4c2[_0x623c('0x38')][_0x623c('0xae')]]);return _0x259de3[_0x623c('0x11')](0xc8)['json']({'message':_0x623c('0xbb'),'pid':_0x12eb84[_0x623c('0xbc')]});}catch(_0x457525){return _0x259de3[_0x623c('0x11')](0x1f4)[_0x623c('0x21')](_0x457525);}};exports[_0x623c('0xbd')]=function(_0x308f19,_0xad45c6){var _0x6899b4=fs[_0x623c('0xbe')](_0x308f19[_0x623c('0xb5')][_0x623c('0x3')]);Papa[_0x623c('0xbf')](_0x6899b4,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x25ae44){return _0xad45c6[_0x623c('0x11')](0xc8)['json']({'file':_0x308f19[_0x623c('0xb5')],'fields':_0x25ae44[_0x623c('0xc0')][_0x623c('0x83')]});}});};exports[_0x623c('0xc1')]=function(_0x249ccf,_0x428802){return db[_0x623c('0xc2')][_0x623c('0x25')]({'raw':!![],'attributes':['id'],'where':{'role':_0x623c('0xc3')}})[_0x623c('0x1a')](function(_0xd12c7){var _0x28a796=![];if(!_0x249ccf[_0x623c('0x38')][_0x623c('0x5f')]){throw new Error(_0x623c('0xc4'));}if(!_0x249ccf[_0x623c('0x38')][_0x623c('0xc5')][_0x623c('0x7d')]){throw new Error(_0x623c('0xb1'));}if(!_0x249ccf['body']['binding']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x249ccf['body'][_0x623c('0xae')]){throw new Error(_0x623c('0xaf'));}var _0x2e8efa=require(_0x623c('0xc6'))['fork'](path[_0x623c('0x3d')](__dirname,_0x623c('0xc7')),[_0x249ccf['params']['id'],JSON[_0x623c('0xc8')](_0x249ccf[_0x623c('0x38')]),JSON[_0x623c('0xc8')](_0xd12c7)]);_0x2e8efa['on'](_0x623c('0xc9'),function(){_0x28a796=!![];return _0x428802[_0x623c('0x11')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x2e8efa['pid']});});_0x2e8efa['on'](_0x623c('0xca'),function(_0x3144b2){if(_0x3144b2&&!_0x28a796){return _0x428802['status'](0x1f4)['json']({'message':_0x623c('0xcb'),'pid':_0x2e8efa['pid']});}});})['catch'](handleError(_0x428802,null));};exports['importUpdates']=function(_0x4cca72,_0x5c9ded){return db[_0x623c('0xc2')][_0x623c('0x25')]({'raw':!![],'attributes':['id'],'where':{'role':_0x623c('0xc3')}})[_0x623c('0x1a')](function(_0x35862d){var _0x33d0e2=![];if(!_0x4cca72[_0x623c('0x38')][_0x623c('0x5f')]){throw new Error(_0x623c('0xc4'));}if(!_0x4cca72[_0x623c('0x38')][_0x623c('0xc5')][_0x623c('0x7d')]){throw new Error(_0x623c('0xb1'));}if(!_0x4cca72[_0x623c('0x38')]['binding'][_0x623c('0xb2')]){throw new Error(_0x623c('0xb3'));}if(!_0x4cca72[_0x623c('0x38')][_0x623c('0xae')]){throw new Error(_0x623c('0xaf'));}var _0x1bd03d=require(_0x623c('0xc6'))[_0x623c('0xb9')](path['join'](__dirname,_0x623c('0xcc')),[_0x4cca72['params']['id'],JSON['stringify'](_0x4cca72[_0x623c('0x38')]),JSON[_0x623c('0xc8')](_0x35862d)]);_0x1bd03d['on'](_0x623c('0xc9'),function(){_0x33d0e2=!![];return _0x5c9ded[_0x623c('0x11')](0xc8)[_0x623c('0x18')]({'message':_0x623c('0xcd'),'pid':_0x1bd03d[_0x623c('0xbc')]});});_0x1bd03d['on'](_0x623c('0xca'),function(_0x11f31d){if(_0x11f31d&&!_0x33d0e2){return _0x5c9ded['status'](0x1f4)[_0x623c('0x18')]({'message':_0x623c('0xcb'),'pid':_0x1bd03d['pid']});}});})[_0x623c('0x27')](handleError(_0x5c9ded,null));};exports[_0x623c('0xce')]=function(_0x1fd0f3,_0x33c69a){var _0x442297=[_0x623c('0xcf'),_0x623c('0xd0'),_0x623c('0xd1'),_0x623c('0xd2'),_0x623c('0xd3'),_0x623c('0xd4'),_0x623c('0xd5')];var _0x406312={'offset':0x0,'order':qs[_0x623c('0x85')](_0x623c('0xd6'))},_0x505fc5={'count':0x0,'rows':[]};Promise['resolve']()[_0x623c('0x1a')](function(){if(_0x1fd0f3[_0x623c('0x26')][_0x623c('0xd7')]){if(!_[_0x623c('0xd8')](_0x442297,_0x1fd0f3[_0x623c('0x26')][_0x623c('0xd7')][_0x623c('0xd9')]())){throw new Error(_0x623c('0xda'));}_0x442297=[_0x1fd0f3[_0x623c('0x26')][_0x623c('0xd7')][_0x623c('0xd9')]()];}if(_0x1fd0f3[_0x623c('0x26')][_0x623c('0xdb')]){try{var _0x587637=JSON['parse'](_0x1fd0f3[_0x623c('0x26')]['range']);if(!moment(_0x587637[_0x623c('0x39')])['isValid']()){throw new Error(_0x623c('0xdc'));}if(!moment(_0x587637['to'])[_0x623c('0xdd')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x38670c){throw new Error(_0x623c('0xde'));}}if(!_0x1fd0f3['query'][_0x623c('0x61')](_0x623c('0x89'))){_0x406312['limit']=qs['limit'](_0x1fd0f3[_0x623c('0x26')][_0x623c('0x14')]||0xa);_0x406312[_0x623c('0x12')]=qs[_0x623c('0x12')](_0x1fd0f3[_0x623c('0x26')][_0x623c('0x12')]);}var _0x3ee274=_0x442297['map'](function(_0x34a8f8){if(_0x34a8f8===_0x623c('0xd5')){var _0x4dd44b={'attributes':['id',_0x623c('0xdf'),_0x623c('0x33'),_0x623c('0xe0'),_0x623c('0xe1'),'callerid',_0x623c('0xe2'),_0x623c('0xe3'),_0x623c('0xe4'),_0x623c('0xe5'),'createdAt','userDisposition','userSecondDisposition',_0x623c('0xe6'),'UserId'],'where':{'ContactId':_0x1fd0f3['params']['id']},'include':[{'model':db[_0x623c('0xc2')],'as':_0x623c('0xc2'),'attributes':['id',_0x623c('0x20'),_0x623c('0xe7'),_0x623c('0x32')]}],'order':[[_0x623c('0xe8'),_0x623c('0xe9')]]};if(_0x1fd0f3[_0x623c('0x26')][_0x623c('0xdb')]){_0x4dd44b[_0x623c('0x5c')][_0x623c('0xe8')]={'$gte':_0x587637['from'],'$lte':_0x587637['to']};}return db[_0x623c('0xea')][_0x623c('0xeb')](_0x4dd44b)[_0x623c('0x1a')](function(_0x428e37){_0x505fc5['count']+=_0x428e37[_0x623c('0x15')];return _[_0x623c('0x6f')](_0x428e37[_0x623c('0xa5')],function(_0x4f1663){var _0xe13140=_0x4f1663[_0x623c('0x3a')]({'plain':!![]});_0xe13140[_0x623c('0xd7')]=_0x34a8f8;if(_0xe13140[_0x623c('0xc2')]){_0xe13140[_0x623c('0xc2')]={'id':_0xe13140[_0x623c('0xc2')]['id'],'name':_0xe13140[_0x623c('0xc2')]['name'],'fullname':_0xe13140[_0x623c('0xc2')][_0x623c('0xe7')],'alias':_0xe13140[_0x623c('0xc2')][_0x623c('0x32')]};}return _0xe13140;});});}else{var _0xd1eda9=_[_0x623c('0xec')](_0x34a8f8)+(_0x34a8f8==='chat'?_0x623c('0xed'):_0x623c('0xee'));var _0x7c6690={'attributes':['id',_0x623c('0xef'),_0x623c('0xf0'),_0x623c('0xe8'),_0x623c('0xe5'),_0x623c('0xf1'),'secondDisposition',_0x623c('0xf2'),'UserId',_0xd1eda9+'Id'],'where':{'ContactId':_0x1fd0f3[_0x623c('0x2a')]['id']},'include':[{'model':db[_0xd1eda9],'as':'Account','attributes':['id',_0x623c('0x20'),_0x623c('0xf3')]},{'model':db[_0x623c('0xc2')],'as':_0x623c('0xf4'),'attributes':['id',_0x623c('0x20'),_0x623c('0xe7')]},{'model':db[_0x623c('0x80')],'as':_0x623c('0x65'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[['createdAt',_0x623c('0xe9')]]};if(_0x1fd0f3[_0x623c('0x26')][_0x623c('0xdb')]){_0x7c6690[_0x623c('0x5c')][_0x623c('0xe8')]={'$gte':_0x587637[_0x623c('0x39')],'$lte':_0x587637['to']};}switch(_0x34a8f8){case _0x623c('0xd0'):_0x7c6690[_0x623c('0x84')][_0x623c('0x5e')]('browserName','customerIp','customerPort','deviceModel',_0x623c('0xf5'),_0x623c('0xf6'),'ratingType',_0x623c('0xf7'),_0x623c('0xf8'));break;case'mail':_0x7c6690[_0x623c('0x84')]['push'](_0x623c('0xf9'),_0x623c('0xfa'));break;case _0x623c('0xd2'):_0x7c6690[_0x623c('0x84')][_0x623c('0x5e')](_0x623c('0xfb'),'threadId');break;}return db[_[_0x623c('0xec')](_0x34a8f8)+_0x623c('0xfc')][_0x623c('0xeb')](_0x7c6690)[_0x623c('0x1a')](function(_0x45de18){_0x505fc5[_0x623c('0x15')]+=_0x45de18[_0x623c('0x15')];return _[_0x623c('0x6f')](_0x45de18[_0x623c('0xa5')],function(_0x518b58){var _0x180adc=_0x518b58[_0x623c('0x3a')]({'plain':!![]});_0x180adc['channel']=_0x34a8f8;if(_0x180adc['Owner']){_0x180adc[_0x623c('0xf4')]={'id':_0x180adc[_0x623c('0xf4')]['id'],'name':_0x180adc[_0x623c('0xf4')][_0x623c('0x20')],'fullname':_0x180adc[_0x623c('0xf4')][_0x623c('0xe7')]};}return _0x180adc;});});}});return Promise[_0x623c('0x63')](_0x3ee274);})['then'](function(_0x425443){return _(_0x425443)[_0x623c('0xfd')]()[_0x623c('0xfe')]('createdAt')[_0x623c('0xff')]()[_0x623c('0x100')]();})[_0x623c('0x1a')](function(_0x11adf4){_0x505fc5[_0x623c('0xa5')]=_0x406312[_0x623c('0x14')]?_0x11adf4[_0x623c('0x101')](_0x406312[_0x623c('0x12')],_0x406312['offset']+_0x406312[_0x623c('0x14')]):_0x11adf4;return _0x505fc5;})[_0x623c('0x1a')](respondWithFilteredResult(_0x33c69a,_0x406312))[_0x623c('0x27')](handleError(_0x33c69a,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 456f736..1f658be 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 _0x9f90=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','remove','emit'];(function(_0x118658,_0x58210f){var _0x406827=function(_0x435022){while(--_0x435022){_0x118658['push'](_0x118658['shift']());}};_0x406827(++_0x58210f);}(_0x9f90,0xc1));var _0x09f9=function(_0x2f60a9,_0x1288bd){_0x2f60a9=_0x2f60a9-0x0;var _0x55cd63=_0x9f90[_0x2f60a9];return _0x55cd63;};'use strict';var EventEmitter=require(_0x09f9('0x0'));var CmContact=require(_0x09f9('0x1'))['db'][_0x09f9('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x09f9('0x3')](0x0);var events={'afterCreate':_0x09f9('0x4'),'afterUpdate':'update','afterDestroy':_0x09f9('0x5')};function emitEvent(_0x413dc6){return function(_0x53086c,_0x26e2ef,_0x464804){CmContactEvents[_0x09f9('0x6')](_0x413dc6+':'+_0x53086c['id'],_0x53086c);CmContactEvents[_0x09f9('0x6')](_0x413dc6,_0x53086c);_0x464804(null);};}for(var e in events){if(events[_0x09f9('0x7')](e)){var event=events[e];CmContact[_0x09f9('0x8')](e,emitEvent(event));}}module[_0x09f9('0x9')]=CmContactEvents; \ No newline at end of file +var _0x90d6=['../../mysqldb','CmContact','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x56a793,_0x215870){var _0x568f87=function(_0x55fcf1){while(--_0x55fcf1){_0x56a793['push'](_0x56a793['shift']());}};_0x568f87(++_0x215870);}(_0x90d6,0x6d));var _0x690d=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x90d6[_0x3826ad];return _0x17b900;};'use strict';var EventEmitter=require(_0x690d('0x0'));var CmContact=require(_0x690d('0x1'))['db'][_0x690d('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x690d('0x3')](0x0);var events={'afterCreate':_0x690d('0x4'),'afterUpdate':_0x690d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x427aa6){return function(_0x48923a,_0x5476fa,_0x45388f){CmContactEvents['emit'](_0x427aa6+':'+_0x48923a['id'],_0x48923a);CmContactEvents[_0x690d('0x6')](_0x427aa6,_0x48923a);_0x45388f(null);};}for(var e in events){if(events[_0x690d('0x7')](e)){var event=events[e];CmContact[_0x690d('0x8')](e,emitEvent(event));}}module[_0x690d('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 a4a432f..fde3915 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 _0xa005=['isEmpty','destroy','ContactId','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','../../config/environment/shared','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','utcOffset','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','create','dialCheckDuplicateType','always','onlyIfOpen','findAll','outbound','CmList','map','all','Lists','BlackLists','CmHopperBlack','exports','define','cm_contacts','fti_cm_contacts','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xa005,0x187));var _0x5a00=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0xa005[_0x17e771];return _0x1f3a6d;};'use strict';var _=require(_0x5a00('0x0'));var util=require(_0x5a00('0x1'));var logger=require(_0x5a00('0x2'))(_0x5a00('0x3'));var moment=require(_0x5a00('0x4'));var shared=require(_0x5a00('0x5'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x187b53,_0x34e976,_0x466a43,_0x2e6d05){var _0x34aec6=_0x2e6d05?_0x5a00('0x6'):_0x5a00('0x7');var _0x36f87c=_0x466a43[_0x5a00('0x8')]?_0x466a43[_0x5a00('0x8')]:moment()[_0x5a00('0x9')](_0x5a00('0xa'));if(_[_0x5a00('0xb')](_0x466a43[_0x5a00('0xc')])){return Promise[_0x5a00('0xd')](_0x36f87c);}return _0x187b53[_0x34aec6][_0x5a00('0xe')]({'where':{'id':_0x34e976}})[_0x5a00('0xf')](function(_0x317201){if(_['isNil'](_0x317201)||_[_0x5a00('0xb')](_0x317201[_0x5a00('0xc')])){return Promise[_0x5a00('0xd')](_0x36f87c);}var _0x5a02a9=shared['timezones'];var _0x1d95e9=_0x5a02a9[_0x317201[_0x5a00('0xc')]];var _0xbe6ca6=_0x5a02a9[_0x466a43[_0x5a00('0xc')]];if(_[_0x5a00('0xb')](_0x1d95e9)&&_[_0x5a00('0xb')](_0xbe6ca6)){return Promise[_0x5a00('0xd')](_0x36f87c);}var _0x4b27ae=_0x1d95e9[_0x5a00('0x10')]-_0xbe6ca6[_0x5a00('0x10')];var _0x24bc15=_0x466a43[_0x5a00('0x8')]?_0x466a43[_0x5a00('0x8')]:moment();_0x36f87c=moment(_0x24bc15)['add'](_0x4b27ae,_0x5a00('0x11'))[_0x5a00('0x9')](_0x5a00('0xa'));return Promise['resolve'](_0x36f87c);});}function getNewHopperPayload(_0x5e0f0d){return{'phone':_0x5e0f0d[_0x5a00('0x12')],'ContactId':_0x5e0f0d['id'],'ListId':_0x5e0f0d[_0x5a00('0x13')],'scheduledat':_0x5e0f0d[_0x5a00('0x8')]?_0x5e0f0d[_0x5a00('0x8')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5e0f0d['priority']?_0x5e0f0d[_0x5a00('0x14')]:0x2,'callback':_0x5e0f0d[_0x5a00('0x15')]?!![]:![],'callbackuniqueid':_0x5e0f0d[_0x5a00('0x15')]?_0x5e0f0d[_0x5a00('0x15')]:undefined,'callbackat':_0x5e0f0d[_0x5a00('0x15')]?moment()[_0x5a00('0x9')](_0x5a00('0xa')):undefined};}function handleAlwaysCheckDuplicate(_0x51b790,_0x329bbe,_0x3493dc,_0x6ac99){var _0x240037={'phone':_0x3493dc[_0x5a00('0x12')]};var _0x172962={'calleridnum':_0x3493dc[_0x5a00('0x12')]};if(_0x6ac99){Object['assign'](_0x240037,{'CampaignId':_0x329bbe['id']});Object[_0x5a00('0x16')](_0x172962,{'CampaignId':_0x329bbe['id']});}else{Object[_0x5a00('0x16')](_0x240037,{'VoiceQueueId':_0x329bbe['id']});Object[_0x5a00('0x16')](_0x172962,{'VoiceQueueId':_0x329bbe['id']});}return _0x51b790[_0x5a00('0x17')][_0x5a00('0xe')]({'where':_0x240037})[_0x5a00('0xf')](function(_0x518993){if(_0x518993){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x3493dc[_0x5a00('0x12')]+_0x5a00('0x18')+_0x329bbe['id']);}return _0x51b790['CmHopperFinal'][_0x5a00('0xe')]({'where':_0x172962});})['then'](function(_0x16e278){if(_0x16e278){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x3493dc['phone']+_0x5a00('0x18')+_0x329bbe['id']);}var _0xc4b116=getNewHopperPayload(_0x3493dc);if(_0x6ac99){_0xc4b116[_0x5a00('0x19')]=_0x329bbe['id'];}else{_0xc4b116[_0x5a00('0x1a')]=_0x329bbe['id'];}return _0x51b790[_0x5a00('0x17')][_0x5a00('0x1b')](_0xc4b116);});}function handleOnlyIfOpenCheckDuplicate(_0x1e9a55,_0x44d21a,_0x1fb75e,_0x38f9ff){var _0x5235e={'phone':_0x1fb75e[_0x5a00('0x12')]};if(_0x38f9ff){Object[_0x5a00('0x16')](_0x5235e,{'CampaignId':_0x44d21a['id']});}else{Object[_0x5a00('0x16')](_0x5235e,{'VoiceQueueId':_0x44d21a['id']});}return _0x1e9a55[_0x5a00('0x17')][_0x5a00('0xe')]({'where':_0x5235e})[_0x5a00('0xf')](function(_0x242e43){if(_0x242e43){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x1fb75e[_0x5a00('0x12')]+_0x5a00('0x18')+_0x44d21a['id']);}var _0x2bb100=getNewHopperPayload(_0x1fb75e);if(_0x38f9ff){_0x2bb100[_0x5a00('0x19')]=_0x44d21a['id'];}else{_0x2bb100[_0x5a00('0x1a')]=_0x44d21a['id'];}return _0x1e9a55[_0x5a00('0x17')][_0x5a00('0x1b')](_0x2bb100);});}function handleNeverCheckDuplicate(_0x4b4066,_0x1b1aa6,_0x1741ba){var _0xe2d412=getNewHopperPayload(_0x1741ba);_0xe2d412[_0x5a00('0x1a')]=_0x1b1aa6['id'];return _0x4b4066[_0x5a00('0x17')]['create'](_0xe2d412);}function handleCheckDuplicate(_0x4397e6,_0x3ca629,_0x505090,_0x9bd5f7){return getTimezoneCallbackAt(_0x4397e6,_0x3ca629,_0x505090,_0x9bd5f7)[_0x5a00('0xf')](function(_0xcefd72){_0x505090['scheduledat']=_0xcefd72;switch(_0x3ca629[_0x5a00('0x1c')]){case _0x5a00('0x1d'):return handleAlwaysCheckDuplicate(_0x4397e6,_0x3ca629,_0x505090,_0x9bd5f7);case _0x5a00('0x1e'):return handleOnlyIfOpenCheckDuplicate(_0x4397e6,_0x3ca629,_0x505090,_0x9bd5f7);default:return handleNeverCheckDuplicate(_0x4397e6,_0x3ca629,_0x505090);}});}function createHopperForVoiceQueues(_0x2b9f99,_0x5629f1){return _0x2b9f99[_0x5a00('0x7')][_0x5a00('0x1f')]({'where':{'type':_0x5a00('0x20')},'attributes':['id',_0x5a00('0x1c'),_0x5a00('0xc')],'include':[{'model':_0x2b9f99[_0x5a00('0x21')],'as':'Lists','where':{'id':_0x5629f1['ListId']}}],'raw':!![]})[_0x5a00('0xf')](function(_0x383f8a){var _0x5f1e63=_0x383f8a[_0x5a00('0x22')](function(_0x2cdec6){return handleCheckDuplicate(_0x2b9f99,_0x2cdec6,_0x5629f1,![]);});return Promise[_0x5a00('0x23')](_0x5f1e63);});}function createHopperForCampaigns(_0xc00375,_0x5d95cb){return _0xc00375[_0x5a00('0x6')][_0x5a00('0x1f')]({'attributes':['id',_0x5a00('0x1c'),_0x5a00('0xc')],'include':[{'model':_0xc00375['CmList'],'as':_0x5a00('0x24'),'where':{'id':_0x5d95cb[_0x5a00('0x13')]}}],'raw':!![]})[_0x5a00('0xf')](function(_0x23219e){var _0x53d4a1=_0x23219e['map'](function(_0x1a3308){return handleCheckDuplicate(_0xc00375,_0x1a3308,_0x5d95cb,!![]);});return Promise[_0x5a00('0x23')](_0x53d4a1);});}function createHopperBlackForVoiceQueues(_0x20ce40,_0x5c9927){return _0x20ce40['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x20ce40['CmList'],'as':_0x5a00('0x25'),'where':{'id':_0x5c9927[_0x5a00('0x13')]}}],'raw':!![]})[_0x5a00('0xf')](function(_0x3942ce){var _0x5a4d4e=_0x3942ce[_0x5a00('0x22')](function(_0x1599e2){return _0x20ce40[_0x5a00('0x26')][_0x5a00('0x1b')]({'phone':_0x5c9927['phone'],'ContactId':_0x5c9927['id'],'ListId':_0x5c9927['ListId'],'VoiceQueueId':_0x1599e2['id']});});return Promise['all'](_0x5a4d4e);});}function createHopperBlackForCampaigns(_0x50a274,_0x1db6b8){return _0x50a274['Campaign'][_0x5a00('0x1f')]({'attributes':['id'],'include':[{'model':_0x50a274['CmList'],'as':_0x5a00('0x25'),'where':{'id':_0x1db6b8[_0x5a00('0x13')]}}],'raw':!![]})[_0x5a00('0xf')](function(_0x4c5b04){var _0xd1fbd2=_0x4c5b04[_0x5a00('0x22')](function(_0x117fb1){return _0x50a274['CmHopperBlack']['create']({'phone':_0x1db6b8[_0x5a00('0x12')],'ContactId':_0x1db6b8['id'],'ListId':_0x1db6b8[_0x5a00('0x13')],'CampaignId':_0x117fb1['id']});});return Promise[_0x5a00('0x23')](_0xd1fbd2);});}module[_0x5a00('0x27')]=function(_0x3d7c47){return _0x3d7c47[_0x5a00('0x28')]('CmContact',attributes,{'tableName':_0x5a00('0x29'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0x5a00('0x2a'),'fields':['firstName',_0x5a00('0x2b'),'phone',_0x5a00('0x2c'),_0x5a00('0x2d'),_0x5a00('0x2e')],'type':_0x5a00('0x2f')}],'timestamps':!![],'charset':_0x5a00('0x30'),'collate':_0x5a00('0x31'),'hooks':{'afterCreate':function(_0x214e21,_0x18d49e,_0x37a08c){var _0x436eab=_0x3d7c47[_0x5a00('0x32')];var _0x10c6d8=_0x214e21[_0x5a00('0x33')]({'plain':!![]});if(!_0x10c6d8['ListId']){logger[_0x5a00('0x34')](_0x5a00('0x35')+_0x10c6d8['id']);return _0x37a08c();}if(!_0x10c6d8[_0x5a00('0x12')]){return _0x37a08c();}return createHopperForVoiceQueues(_0x436eab,_0x10c6d8)[_0x5a00('0xf')](function(){return createHopperBlackForVoiceQueues(_0x436eab,_0x10c6d8);})['then'](function(){return createHopperForCampaigns(_0x436eab,_0x10c6d8);})['then'](function(){return createHopperBlackForCampaigns(_0x436eab,_0x10c6d8);})[_0x5a00('0xf')](function(){return _0x37a08c();})[_0x5a00('0x36')](function(_0x13afa5){logger[_0x5a00('0x34')](_0x5a00('0x37'),_0x13afa5[_0x5a00('0x38')]);_0x37a08c();});},'afterDestroy':function(_0x2e6680,_0x2f9657,_0xf6fba4){var _0x49f728=_0x3d7c47[_0x5a00('0x32')];var _0xa77a86=_0x2e6680[_0x5a00('0x33')]({'plain':!![]});return _0x49f728['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0xa77a86[_0x5a00('0x13')],'ContactId':_0xa77a86['id']}})[_0x5a00('0xf')](function(_0x3866ec){if(!_[_0x5a00('0x39')](_0x3866ec)){var _0xda03d9=[];for(var _0x18e818=0x0;_0x18e818<_0x3866ec['length'];_0x18e818+=0x1){var _0x23eae9=_0x49f728[_0x5a00('0x17')][_0x5a00('0x3a')]({'where':{'ListId':_0x3866ec[_0x18e818][_0x5a00('0x13')],'ContactId':_0x3866ec[_0x18e818][_0x5a00('0x3b')],'VoiceQueueId':_0x3866ec[_0x18e818][_0x5a00('0x1a')],'CampaignId':_0x3866ec[_0x18e818]['CampaignId']}});_0xda03d9['push'](_0x23eae9);}return Promise[_0x5a00('0x23')](_0xda03d9);}})[_0x5a00('0xf')](function(_0x5d2caf){logger[_0x5a00('0x3c')](_0x5a00('0x3d'),util[_0x5a00('0x3e')](_0x5d2caf,{'showHidden':![],'depth':null}));_0xf6fba4();})[_0x5a00('0x36')](function(_0x1ab1c5){logger['error'](_0x5a00('0x3f'),util[_0x5a00('0x3e')](_0x1ab1c5,{'showHidden':![],'depth':null}));_0xf6fba4(_0x1ab1c5);});}}});}; \ No newline at end of file +var _0x8270=['map','all','findAll','BlackLists','exports','define','CmContact','fti_cm_contacts','firstName','lastName','mobile','fax','email','get','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','error','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','../../config/logger','api','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','then','isNil','utcOffset','phone','ListId','priority','callbackUniqueid','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','dialCheckDuplicateType','always','onlyIfOpen','outbound','CmList'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8270,0x110));var _0x0827=function(_0xd85d9e,_0x22bef1){_0xd85d9e=_0xd85d9e-0x0;var _0x3f1e51=_0x8270[_0xd85d9e];return _0x3f1e51;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0827('0x0'))(_0x0827('0x1'));var moment=require('moment');var shared=require('../../config/environment/shared');var attributes=require(_0x0827('0x2'));function getTimezoneCallbackAt(_0x196e2b,_0xb6501f,_0x57161a,_0x83a572){var _0x475444=_0x83a572?_0x0827('0x3'):_0x0827('0x4');var _0x1f9d96=_0x57161a[_0x0827('0x5')]?_0x57161a['scheduledat']:moment()[_0x0827('0x6')](_0x0827('0x7'));if(_['isNil'](_0x57161a[_0x0827('0x8')])){return Promise[_0x0827('0x9')](_0x1f9d96);}return _0x196e2b[_0x475444]['findOne']({'where':{'id':_0xb6501f}})[_0x0827('0xa')](function(_0x53b9f8){if(_[_0x0827('0xb')](_0x53b9f8)||_[_0x0827('0xb')](_0x53b9f8[_0x0827('0x8')])){return Promise[_0x0827('0x9')](_0x1f9d96);}var _0x427bdc=shared['timezones'];var _0x3857b1=_0x427bdc[_0x53b9f8['dialTimezone']];var _0x956a57=_0x427bdc[_0x57161a[_0x0827('0x8')]];if(_[_0x0827('0xb')](_0x3857b1)&&_[_0x0827('0xb')](_0x956a57)){return Promise[_0x0827('0x9')](_0x1f9d96);}var _0x59f382=_0x3857b1['utcOffset']-_0x956a57[_0x0827('0xc')];var _0xd07d92=_0x57161a[_0x0827('0x5')]?_0x57161a[_0x0827('0x5')]:moment();_0x1f9d96=moment(_0xd07d92)['add'](_0x59f382,'minutes')[_0x0827('0x6')]('YYYY-MM-DD\x20HH:mm:ss');return Promise[_0x0827('0x9')](_0x1f9d96);});}function getNewHopperPayload(_0x5cbc96){return{'phone':_0x5cbc96[_0x0827('0xd')],'ContactId':_0x5cbc96['id'],'ListId':_0x5cbc96[_0x0827('0xe')],'scheduledat':_0x5cbc96['scheduledat']?_0x5cbc96['scheduledat']:moment()[_0x0827('0x6')](_0x0827('0x7')),'priority':_0x5cbc96[_0x0827('0xf')]?_0x5cbc96[_0x0827('0xf')]:0x2,'callback':_0x5cbc96[_0x0827('0x10')]?!![]:![],'callbackuniqueid':_0x5cbc96['callbackUniqueid']?_0x5cbc96[_0x0827('0x10')]:undefined,'callbackat':_0x5cbc96[_0x0827('0x10')]?moment()[_0x0827('0x6')](_0x0827('0x7')):undefined};}function handleAlwaysCheckDuplicate(_0x5879fa,_0x42cf2c,_0x2a740a,_0x132602){var _0x502bc8={'phone':_0x2a740a[_0x0827('0xd')]};var _0x34f522={'calleridnum':_0x2a740a['phone']};if(_0x132602){Object[_0x0827('0x11')](_0x502bc8,{'CampaignId':_0x42cf2c['id']});Object[_0x0827('0x11')](_0x34f522,{'CampaignId':_0x42cf2c['id']});}else{Object[_0x0827('0x11')](_0x502bc8,{'VoiceQueueId':_0x42cf2c['id']});Object[_0x0827('0x11')](_0x34f522,{'VoiceQueueId':_0x42cf2c['id']});}return _0x5879fa[_0x0827('0x12')][_0x0827('0x13')]({'where':_0x502bc8})[_0x0827('0xa')](function(_0x20c6c2){if(_0x20c6c2){throw new Error(_0x0827('0x14')+_0x2a740a['phone']+_0x0827('0x15')+_0x42cf2c['id']);}return _0x5879fa[_0x0827('0x16')][_0x0827('0x13')]({'where':_0x34f522});})[_0x0827('0xa')](function(_0x2e60fd){if(_0x2e60fd){throw new Error(_0x0827('0x17')+_0x2a740a['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x42cf2c['id']);}var _0x1d419e=getNewHopperPayload(_0x2a740a);if(_0x132602){_0x1d419e[_0x0827('0x18')]=_0x42cf2c['id'];}else{_0x1d419e[_0x0827('0x19')]=_0x42cf2c['id'];}return _0x5879fa[_0x0827('0x12')]['create'](_0x1d419e);});}function handleOnlyIfOpenCheckDuplicate(_0x1a2ef4,_0x1311f6,_0xa198f2,_0x4a866b){var _0x351358={'phone':_0xa198f2[_0x0827('0xd')]};if(_0x4a866b){Object[_0x0827('0x11')](_0x351358,{'CampaignId':_0x1311f6['id']});}else{Object[_0x0827('0x11')](_0x351358,{'VoiceQueueId':_0x1311f6['id']});}return _0x1a2ef4['CmHopper'][_0x0827('0x13')]({'where':_0x351358})['then'](function(_0x1441d5){if(_0x1441d5){throw new Error(_0x0827('0x1a')+_0xa198f2['phone']+_0x0827('0x15')+_0x1311f6['id']);}var _0x412c09=getNewHopperPayload(_0xa198f2);if(_0x4a866b){_0x412c09['CampaignId']=_0x1311f6['id'];}else{_0x412c09['VoiceQueueId']=_0x1311f6['id'];}return _0x1a2ef4[_0x0827('0x12')]['create'](_0x412c09);});}function handleNeverCheckDuplicate(_0x5bd117,_0x3e2e22,_0x4dfe54){var _0x5a9b98=getNewHopperPayload(_0x4dfe54);_0x5a9b98[_0x0827('0x19')]=_0x3e2e22['id'];return _0x5bd117[_0x0827('0x12')][_0x0827('0x1b')](_0x5a9b98);}function handleCheckDuplicate(_0xd85f92,_0x4dbe9d,_0xca67b,_0x15410a){return getTimezoneCallbackAt(_0xd85f92,_0x4dbe9d,_0xca67b,_0x15410a)[_0x0827('0xa')](function(_0x5614b2){_0xca67b['scheduledat']=_0x5614b2;switch(_0x4dbe9d[_0x0827('0x1c')]){case _0x0827('0x1d'):return handleAlwaysCheckDuplicate(_0xd85f92,_0x4dbe9d,_0xca67b,_0x15410a);case _0x0827('0x1e'):return handleOnlyIfOpenCheckDuplicate(_0xd85f92,_0x4dbe9d,_0xca67b,_0x15410a);default:return handleNeverCheckDuplicate(_0xd85f92,_0x4dbe9d,_0xca67b);}});}function createHopperForVoiceQueues(_0xda7135,_0x3df643){return _0xda7135['VoiceQueue']['findAll']({'where':{'type':_0x0827('0x1f')},'attributes':['id',_0x0827('0x1c'),_0x0827('0x8')],'include':[{'model':_0xda7135[_0x0827('0x20')],'as':'Lists','where':{'id':_0x3df643['ListId']}}],'raw':!![]})['then'](function(_0x3e68a6){var _0x4b949e=_0x3e68a6[_0x0827('0x21')](function(_0x1de033){return handleCheckDuplicate(_0xda7135,_0x1de033,_0x3df643,![]);});return Promise[_0x0827('0x22')](_0x4b949e);});}function createHopperForCampaigns(_0x33e281,_0x28c683){return _0x33e281[_0x0827('0x3')][_0x0827('0x23')]({'attributes':['id',_0x0827('0x1c'),_0x0827('0x8')],'include':[{'model':_0x33e281[_0x0827('0x20')],'as':'Lists','where':{'id':_0x28c683[_0x0827('0xe')]}}],'raw':!![]})[_0x0827('0xa')](function(_0x57aafc){var _0x119888=_0x57aafc['map'](function(_0xb87f94){return handleCheckDuplicate(_0x33e281,_0xb87f94,_0x28c683,!![]);});return Promise[_0x0827('0x22')](_0x119888);});}function createHopperBlackForVoiceQueues(_0x46cf59,_0x166c00){return _0x46cf59[_0x0827('0x4')][_0x0827('0x23')]({'where':{'type':_0x0827('0x1f')},'attributes':['id'],'include':[{'model':_0x46cf59['CmList'],'as':_0x0827('0x24'),'where':{'id':_0x166c00[_0x0827('0xe')]}}],'raw':!![]})[_0x0827('0xa')](function(_0x1239fa){var _0x55a07b=_0x1239fa['map'](function(_0x45605b){return _0x46cf59['CmHopperBlack']['create']({'phone':_0x166c00['phone'],'ContactId':_0x166c00['id'],'ListId':_0x166c00[_0x0827('0xe')],'VoiceQueueId':_0x45605b['id']});});return Promise[_0x0827('0x22')](_0x55a07b);});}function createHopperBlackForCampaigns(_0x1cd62e,_0x5a9e16){return _0x1cd62e['Campaign'][_0x0827('0x23')]({'attributes':['id'],'include':[{'model':_0x1cd62e[_0x0827('0x20')],'as':_0x0827('0x24'),'where':{'id':_0x5a9e16['ListId']}}],'raw':!![]})[_0x0827('0xa')](function(_0x15d9ab){var _0x5a85d2=_0x15d9ab[_0x0827('0x21')](function(_0xcb6f12){return _0x1cd62e['CmHopperBlack'][_0x0827('0x1b')]({'phone':_0x5a9e16[_0x0827('0xd')],'ContactId':_0x5a9e16['id'],'ListId':_0x5a9e16[_0x0827('0xe')],'CampaignId':_0xcb6f12['id']});});return Promise['all'](_0x5a85d2);});}module[_0x0827('0x25')]=function(_0x6c1f4c){return _0x6c1f4c[_0x0827('0x26')](_0x0827('0x27'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0x0827('0x28'),'fields':[_0x0827('0x29'),_0x0827('0x2a'),_0x0827('0xd'),_0x0827('0x2b'),_0x0827('0x2c'),_0x0827('0x2d')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x507258,_0x19daa6,_0x2441e9){var _0x14489e=_0x6c1f4c['models'];var _0x26f991=_0x507258[_0x0827('0x2e')]({'plain':!![]});if(!_0x26f991['ListId']){logger['error'](_0x0827('0x2f')+_0x26f991['id']);return _0x2441e9();}if(!_0x26f991['phone']){return _0x2441e9();}return createHopperForVoiceQueues(_0x14489e,_0x26f991)[_0x0827('0xa')](function(){return createHopperBlackForVoiceQueues(_0x14489e,_0x26f991);})[_0x0827('0xa')](function(){return createHopperForCampaigns(_0x14489e,_0x26f991);})['then'](function(){return createHopperBlackForCampaigns(_0x14489e,_0x26f991);})[_0x0827('0xa')](function(){return _0x2441e9();})[_0x0827('0x30')](function(_0x565290){logger[_0x0827('0x31')](_0x0827('0x32'),_0x565290[_0x0827('0x33')]);_0x2441e9();});},'afterDestroy':function(_0x55a0b4,_0x5e370e,_0x4f1960){var _0x3835aa=_0x6c1f4c['models'];var _0x4ba987=_0x55a0b4[_0x0827('0x2e')]({'plain':!![]});return _0x3835aa[_0x0827('0x12')][_0x0827('0x23')]({'raw':!![],'where':{'ListId':_0x4ba987[_0x0827('0xe')],'ContactId':_0x4ba987['id']}})[_0x0827('0xa')](function(_0x12e7a9){if(!_[_0x0827('0x34')](_0x12e7a9)){var _0x58db97=[];for(var _0x3dcc27=0x0;_0x3dcc27<_0x12e7a9[_0x0827('0x35')];_0x3dcc27+=0x1){var _0x349b1e=_0x3835aa[_0x0827('0x12')][_0x0827('0x36')]({'where':{'ListId':_0x12e7a9[_0x3dcc27][_0x0827('0xe')],'ContactId':_0x12e7a9[_0x3dcc27][_0x0827('0x37')],'VoiceQueueId':_0x12e7a9[_0x3dcc27][_0x0827('0x19')],'CampaignId':_0x12e7a9[_0x3dcc27][_0x0827('0x18')]}});_0x58db97[_0x0827('0x38')](_0x349b1e);}return Promise[_0x0827('0x22')](_0x58db97);}})['then'](function(_0x3f57e2){logger[_0x0827('0x39')](_0x0827('0x3a'),util[_0x0827('0x3b')](_0x3f57e2,{'showHidden':![],'depth':null}));_0x4f1960();})[_0x0827('0x30')](function(_0x2e3ab6){logger[_0x0827('0x31')](_0x0827('0x3c'),util['inspect'](_0x2e3ab6,{'showHidden':![],'depth':null}));_0x4f1960(_0x2e3ab6);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index c7f13ec..7f0a6f2 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x4561f9,_0x22ab64){var _0x5d8bb5=function(_0x4e1bbe){while(--_0x4e1bbe){_0x4561f9['push'](_0x4561f9['shift']());}};_0x5d8bb5(++_0x22ab64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/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 715c4d8..2364c8f 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 _0x13c0=['STRING','sequelize','exports','INTEGER'];(function(_0x571648,_0x5f3f1b){var _0x35be5c=function(_0x1f93b0){while(--_0x1f93b0){_0x571648['push'](_0x571648['shift']());}};_0x35be5c(++_0x5f3f1b);}(_0x13c0,0x79));var _0x013c=function(_0x4b095c,_0x266c55){_0x4b095c=_0x4b095c-0x0;var _0x4495e2=_0x13c0[_0x4b095c];return _0x4495e2;};'use strict';var Sequelize=require(_0x013c('0x0'));module[_0x013c('0x1')]={'CmContactId':{'type':Sequelize[_0x013c('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x013c('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x013c('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x013c('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xf25a=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x237d2d,_0x470601){var _0x173a19=function(_0x3f169f){while(--_0x3f169f){_0x237d2d['push'](_0x237d2d['shift']());}};_0x173a19(++_0x470601);}(_0xf25a,0x195));var _0xaf25=function(_0x3dcdff,_0x290e29){_0x3dcdff=_0x3dcdff-0x0;var _0xdd2bf9=_0xf25a[_0x3dcdff];return _0xdd2bf9;};'use strict';var Sequelize=require(_0xaf25('0x0'));module[_0xaf25('0x1')]={'CmContactId':{'type':Sequelize[_0xaf25('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xaf25('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xaf25('0x3')],'defaultValue':_0xaf25('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xaf25('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 9db4371..707578d 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 _0xb64a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','destroy','get','CmContactHasItems','UserProfileResource','then','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0xbec51e,_0x205cd5){var _0x150e50=function(_0xe9ecb4){while(--_0xe9ecb4){_0xbec51e['push'](_0xbec51e['shift']());}};_0x150e50(++_0x205cd5);}(_0xb64a,0x185));var _0xab64=function(_0x3ae093,_0x3e2a42){_0x3ae093=_0x3ae093-0x0;var _0x58720e=_0xb64a[_0x3ae093];return _0x58720e;};'use strict';var emlformat=require(_0xab64('0x0'));var rimraf=require(_0xab64('0x1'));var zipdir=require(_0xab64('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab64('0x3'));var moment=require(_0xab64('0x4'));var BPromise=require(_0xab64('0x5'));var Mustache=require(_0xab64('0x6'));var util=require(_0xab64('0x7'));var path=require(_0xab64('0x8'));var sox=require(_0xab64('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab64('0xa'));var squel=require(_0xab64('0xb'));var crypto=require(_0xab64('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xab64('0xd'));var toCsv=require('to-csv');var querystring=require(_0xab64('0xe'));var Papa=require(_0xab64('0xf'));var Redis=require(_0xab64('0x10'));var authService=require(_0xab64('0x11'));var qs=require(_0xab64('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab64('0x13'))(_0xab64('0x14'));var utils=require(_0xab64('0x15'));var config=require(_0xab64('0x16'));var licenseUtil=require(_0xab64('0x17'));var db=require(_0xab64('0x18'))['db'];function respondWithStatusCode(_0x368b96,_0x4d4e24){_0x4d4e24=_0x4d4e24||0xcc;return function(_0x57192c){if(_0x57192c){return _0x368b96[_0xab64('0x19')](_0x4d4e24);}return _0x368b96[_0xab64('0x1a')](_0x4d4e24)[_0xab64('0x1b')]();};}function respondWithResult(_0x31088a,_0x626cb){_0x626cb=_0x626cb||0xc8;return function(_0x16f628){if(_0x16f628){return _0x31088a[_0xab64('0x1a')](_0x626cb)['json'](_0x16f628);}};}function respondWithFilteredResult(_0x25c67,_0x3fceff){return function(_0x4151d4){if(_0x4151d4){var _0x102380=typeof _0x3fceff['offset']===_0xab64('0x1c')&&typeof _0x3fceff[_0xab64('0x1d')]===_0xab64('0x1c');var _0x2b414e=_0x4151d4['count'];var _0x13eb1c=_0x102380?0x0:_0x3fceff[_0xab64('0x1e')];var _0x165d1a=_0x102380?_0x4151d4[_0xab64('0x1f')]:_0x3fceff['offset']+_0x3fceff[_0xab64('0x1d')];var _0x32fe1a;if(_0x165d1a>=_0x2b414e){_0x165d1a=_0x2b414e;_0x32fe1a=0xc8;}else{_0x32fe1a=0xce;}_0x25c67[_0xab64('0x1a')](_0x32fe1a);return _0x25c67[_0xab64('0x20')](_0xab64('0x21'),_0x13eb1c+'-'+_0x165d1a+'/'+_0x2b414e)[_0xab64('0x22')](_0x4151d4);}return null;};}function patchUpdates(_0x598617){return function(_0x146c51){try{jsonpatch[_0xab64('0x23')](_0x146c51,_0x598617,!![]);}catch(_0x3a0353){return BPromise[_0xab64('0x24')](_0x3a0353);}return _0x146c51['save']();};}function saveUpdates(_0x3e24ec,_0x5a254b){return function(_0x203407){if(_0x203407){return _0x203407[_0xab64('0x25')](_0x3e24ec)['then'](function(_0x396552){return _0x396552;});}return null;};}function removeEntity(_0x22c588,_0x56343e){return function(_0x182493){if(_0x182493){return _0x182493[_0xab64('0x26')]()['then'](function(){var _0xf1177=_0x182493[_0xab64('0x27')]({'plain':!![]});var _0x5cc895=_0xab64('0x28');return db[_0xab64('0x29')][_0xab64('0x26')]({'where':{'type':_0x5cc895,'resourceId':_0xf1177['id']}})[_0xab64('0x2a')](function(){return _0x182493;});})[_0xab64('0x2a')](function(){_0x22c588[_0xab64('0x1a')](0xcc)[_0xab64('0x1b')]();});}};}function handleEntityNotFound(_0x4791e5,_0x3b29b3){return function(_0x14a61b){if(!_0x14a61b){_0x4791e5[_0xab64('0x19')](0x194);}return _0x14a61b;};}function handleError(_0x5d6d52,_0x5b742b){_0x5b742b=_0x5b742b||0x1f4;return function(_0x5d7450){logger['error'](_0x5d7450[_0xab64('0x2b')]);if(_0x5d7450[_0xab64('0x2c')]){delete _0x5d7450['name'];}_0x5d6d52[_0xab64('0x1a')](_0x5b742b)[_0xab64('0x2d')](_0x5d7450);};}exports[_0xab64('0x2e')]=function(_0x285b41,_0x415738){var _0x28e233={},_0x568971={},_0xe0d6bc={'count':0x0,'rows':[]};var _0xc7f086=_[_0xab64('0x2f')](db[_0xab64('0x30')][_0xab64('0x31')],function(_0x1580d9){return{'name':_0x1580d9[_0xab64('0x32')],'type':_0x1580d9[_0xab64('0x33')][_0xab64('0x34')]};});_0x568971[_0xab64('0x35')]=_['map'](_0xc7f086,_0xab64('0x2c'));_0x568971[_0xab64('0x36')]=_['keys'](_0x285b41[_0xab64('0x36')]);_0x568971[_0xab64('0x37')]=_[_0xab64('0x38')](_0x568971[_0xab64('0x35')],_0x568971[_0xab64('0x36')]);_0x28e233[_0xab64('0x39')]=_[_0xab64('0x38')](_0x568971[_0xab64('0x35')],qs['fields'](_0x285b41[_0xab64('0x36')][_0xab64('0x3a')]));_0x28e233['attributes']=_0x28e233[_0xab64('0x39')]['length']?_0x28e233[_0xab64('0x39')]:_0x568971[_0xab64('0x35')];if(!_0x285b41[_0xab64('0x36')]['hasOwnProperty'](_0xab64('0x3b'))){_0x28e233[_0xab64('0x1d')]=qs[_0xab64('0x1d')](_0x285b41['query'][_0xab64('0x1d')]);_0x28e233['offset']=qs[_0xab64('0x1e')](_0x285b41[_0xab64('0x36')][_0xab64('0x1e')]);}_0x28e233[_0xab64('0x3c')]=qs[_0xab64('0x3d')](_0x285b41[_0xab64('0x36')][_0xab64('0x3d')]);_0x28e233[_0xab64('0x3e')]=qs[_0xab64('0x37')](_['pick'](_0x285b41['query'],_0x568971[_0xab64('0x37')]),_0xc7f086);if(_0x285b41[_0xab64('0x36')][_0xab64('0x3f')]){_0x28e233[_0xab64('0x3e')]=_[_0xab64('0x40')](_0x28e233[_0xab64('0x3e')],{'$or':_[_0xab64('0x2f')](_0xc7f086,function(_0x2fd5c0){if(_0x2fd5c0[_0xab64('0x33')]!=='VIRTUAL'){var _0x173687={};_0x173687[_0x2fd5c0['name']]={'$like':'%'+_0x285b41[_0xab64('0x36')]['filter']+'%'};return _0x173687;}})});}_0x28e233=_[_0xab64('0x40')]({},_0x28e233,_0x285b41[_0xab64('0x41')]);var _0x493283={'where':_0x28e233[_0xab64('0x3e')]};return db[_0xab64('0x30')][_0xab64('0x1f')](_0x493283)[_0xab64('0x2a')](function(_0x54725e){_0xe0d6bc[_0xab64('0x1f')]=_0x54725e;if(_0x285b41[_0xab64('0x36')][_0xab64('0x42')]){_0x28e233[_0xab64('0x43')]=[{'all':!![]}];}return db[_0xab64('0x30')]['findAll'](_0x28e233);})[_0xab64('0x2a')](function(_0x143d80){_0xe0d6bc['rows']=_0x143d80;return _0xe0d6bc;})['then'](respondWithFilteredResult(_0x415738,_0x28e233))[_0xab64('0x44')](handleError(_0x415738,null));};exports[_0xab64('0x45')]=function(_0x2f1958,_0x4a430d){var _0x26cdae={'raw':!![],'where':{'id':_0x2f1958[_0xab64('0x46')]['id']}},_0x91eebd={};_0x91eebd[_0xab64('0x35')]=_['keys'](db[_0xab64('0x30')]['rawAttributes']);_0x91eebd[_0xab64('0x36')]=_['keys'](_0x2f1958[_0xab64('0x36')]);_0x91eebd[_0xab64('0x37')]=_['intersection'](_0x91eebd[_0xab64('0x35')],_0x91eebd[_0xab64('0x36')]);_0x26cdae['attributes']=_[_0xab64('0x38')](_0x91eebd[_0xab64('0x35')],qs[_0xab64('0x3a')](_0x2f1958['query'][_0xab64('0x3a')]));_0x26cdae[_0xab64('0x39')]=_0x26cdae['attributes'][_0xab64('0x47')]?_0x26cdae['attributes']:_0x91eebd[_0xab64('0x35')];if(_0x2f1958[_0xab64('0x36')][_0xab64('0x42')]){_0x26cdae[_0xab64('0x43')]=[{'all':!![]}];}_0x26cdae=_[_0xab64('0x40')]({},_0x26cdae,_0x2f1958[_0xab64('0x41')]);return db[_0xab64('0x30')][_0xab64('0x48')](_0x26cdae)[_0xab64('0x2a')](handleEntityNotFound(_0x4a430d,null))[_0xab64('0x2a')](respondWithResult(_0x4a430d,null))[_0xab64('0x44')](handleError(_0x4a430d,null));};exports[_0xab64('0x49')]=function(_0x3e7d4d,_0x43b329){return db[_0xab64('0x30')]['create'](_0x3e7d4d['body'],{})[_0xab64('0x2a')](function(_0x15ea43){var _0x2407b6=_0x3e7d4d[_0xab64('0x4a')][_0xab64('0x27')]({'plain':!![]});if(!_0x2407b6)throw new Error(_0xab64('0x4b'));if(_0x2407b6[_0xab64('0x4c')]===_0xab64('0x4a')){var _0x4a6302=_0x15ea43['get']({'plain':!![]});var _0x467b12=_0xab64('0x28');return db['UserProfileSection'][_0xab64('0x48')]({'where':{'name':_0x467b12,'userProfileId':_0x2407b6[_0xab64('0x4d')]},'raw':!![]})[_0xab64('0x2a')](function(_0x2222d4){if(_0x2222d4&&_0x2222d4[_0xab64('0x4e')]===0x0){return db[_0xab64('0x29')][_0xab64('0x49')]({'name':_0x4a6302[_0xab64('0x2c')],'resourceId':_0x4a6302['id'],'type':_0x2222d4[_0xab64('0x2c')],'sectionId':_0x2222d4['id']},{})[_0xab64('0x2a')](function(){return _0x15ea43;});}else{return _0x15ea43;}})['catch'](function(_0x135f96){logger[_0xab64('0x4f')](_0xab64('0x50'),_0x135f96);throw _0x135f96;});}return _0x15ea43;})[_0xab64('0x2a')](respondWithResult(_0x43b329,0xc9))[_0xab64('0x44')](handleError(_0x43b329,null));};exports[_0xab64('0x25')]=function(_0x5cfa69,_0x1c2903){if(_0x5cfa69[_0xab64('0x51')]['id']){delete _0x5cfa69[_0xab64('0x51')]['id'];}return db[_0xab64('0x30')][_0xab64('0x48')]({'where':{'id':_0x5cfa69[_0xab64('0x46')]['id']}})[_0xab64('0x2a')](handleEntityNotFound(_0x1c2903,null))[_0xab64('0x2a')](saveUpdates(_0x5cfa69[_0xab64('0x51')],null))['then'](respondWithResult(_0x1c2903,null))[_0xab64('0x44')](handleError(_0x1c2903,null));};exports[_0xab64('0x26')]=function(_0x1aee0d,_0x1f62d1){return db[_0xab64('0x30')][_0xab64('0x48')]({'where':{'id':_0x1aee0d[_0xab64('0x46')]['id']}})[_0xab64('0x2a')](handleEntityNotFound(_0x1f62d1,null))[_0xab64('0x2a')](removeEntity(_0x1f62d1,null))['catch'](handleError(_0x1f62d1,null));}; \ No newline at end of file +var _0x50b5=['attributes','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','name','send','index','map','CmContactHasItem','rawAttributes','type','key','model','query','keys','filters','intersection','fields'];(function(_0x19616a,_0x545c46){var _0x57bfb4=function(_0x9ab37b){while(--_0x9ab37b){_0x19616a['push'](_0x19616a['shift']());}};_0x57bfb4(++_0x545c46);}(_0x50b5,0xbf));var _0x550b=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x50b5[_0x22f8ab];return _0x2a70e5;};'use strict';var emlformat=require(_0x550b('0x0'));var rimraf=require(_0x550b('0x1'));var zipdir=require(_0x550b('0x2'));var jsonpatch=require(_0x550b('0x3'));var rp=require('request-promise');var moment=require(_0x550b('0x4'));var BPromise=require(_0x550b('0x5'));var Mustache=require('mustache');var util=require(_0x550b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x550b('0x7'));var ejs=require(_0x550b('0x8'));var fs=require('fs');var fs_extra=require(_0x550b('0x9'));var _=require(_0x550b('0xa'));var squel=require(_0x550b('0xb'));var crypto=require(_0x550b('0xc'));var jsforce=require(_0x550b('0xd'));var deskjs=require(_0x550b('0xe'));var toCsv=require(_0x550b('0x7'));var querystring=require(_0x550b('0xf'));var Papa=require(_0x550b('0x10'));var Redis=require(_0x550b('0x11'));var authService=require(_0x550b('0x12'));var qs=require(_0x550b('0x13'));var as=require(_0x550b('0x14'));var hardwareService=require(_0x550b('0x15'));var logger=require('../../config/logger')(_0x550b('0x16'));var utils=require(_0x550b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x550b('0x18'));var db=require(_0x550b('0x19'))['db'];function respondWithStatusCode(_0x31c3e6,_0x407cf8){_0x407cf8=_0x407cf8||0xcc;return function(_0x5ccee9){if(_0x5ccee9){return _0x31c3e6[_0x550b('0x1a')](_0x407cf8);}return _0x31c3e6['status'](_0x407cf8)[_0x550b('0x1b')]();};}function respondWithResult(_0x5268e2,_0x386edc){_0x386edc=_0x386edc||0xc8;return function(_0x48e54b){if(_0x48e54b){return _0x5268e2[_0x550b('0x1c')](_0x386edc)[_0x550b('0x1d')](_0x48e54b);}};}function respondWithFilteredResult(_0x3d10fb,_0x341a2a){return function(_0x76953c){if(_0x76953c){var _0x3eec57=typeof _0x341a2a[_0x550b('0x1e')]===_0x550b('0x1f')&&typeof _0x341a2a[_0x550b('0x20')]===_0x550b('0x1f');var _0x4d0311=_0x76953c[_0x550b('0x21')];var _0x43a8b6=_0x3eec57?0x0:_0x341a2a[_0x550b('0x1e')];var _0x27a77b=_0x3eec57?_0x76953c['count']:_0x341a2a[_0x550b('0x1e')]+_0x341a2a[_0x550b('0x20')];var _0x18c946;if(_0x27a77b>=_0x4d0311){_0x27a77b=_0x4d0311;_0x18c946=0xc8;}else{_0x18c946=0xce;}_0x3d10fb[_0x550b('0x1c')](_0x18c946);return _0x3d10fb[_0x550b('0x22')]('Content-Range',_0x43a8b6+'-'+_0x27a77b+'/'+_0x4d0311)[_0x550b('0x1d')](_0x76953c);}return null;};}function patchUpdates(_0x33e1aa){return function(_0x408dd0){try{jsonpatch['apply'](_0x408dd0,_0x33e1aa,!![]);}catch(_0x2ec607){return BPromise[_0x550b('0x23')](_0x2ec607);}return _0x408dd0[_0x550b('0x24')]();};}function saveUpdates(_0x33b336,_0x398106){return function(_0x8727de){if(_0x8727de){return _0x8727de[_0x550b('0x25')](_0x33b336)[_0x550b('0x26')](function(_0x327b08){return _0x327b08;});}return null;};}function removeEntity(_0x50e779,_0x55f431){return function(_0x14a2f3){if(_0x14a2f3){return _0x14a2f3['destroy']()['then'](function(){var _0x55e150=_0x14a2f3[_0x550b('0x27')]({'plain':!![]});var _0x4f64cc=_0x550b('0x28');return db[_0x550b('0x29')][_0x550b('0x2a')]({'where':{'type':_0x4f64cc,'resourceId':_0x55e150['id']}})[_0x550b('0x26')](function(){return _0x14a2f3;});})[_0x550b('0x26')](function(){_0x50e779[_0x550b('0x1c')](0xcc)[_0x550b('0x1b')]();});}};}function handleEntityNotFound(_0x546206,_0x4475a1){return function(_0x356613){if(!_0x356613){_0x546206['sendStatus'](0x194);}return _0x356613;};}function handleError(_0x20a74b,_0x392cb0){_0x392cb0=_0x392cb0||0x1f4;return function(_0x368693){logger[_0x550b('0x2b')](_0x368693['stack']);if(_0x368693[_0x550b('0x2c')]){delete _0x368693[_0x550b('0x2c')];}_0x20a74b[_0x550b('0x1c')](_0x392cb0)[_0x550b('0x2d')](_0x368693);};}exports[_0x550b('0x2e')]=function(_0x467e21,_0x476921){var _0x306ccf={},_0x450d13={},_0x1f8df8={'count':0x0,'rows':[]};var _0x507c5c=_[_0x550b('0x2f')](db[_0x550b('0x30')][_0x550b('0x31')],function(_0x1037fc){return{'name':_0x1037fc['fieldName'],'type':_0x1037fc[_0x550b('0x32')][_0x550b('0x33')]};});_0x450d13[_0x550b('0x34')]=_[_0x550b('0x2f')](_0x507c5c,_0x550b('0x2c'));_0x450d13[_0x550b('0x35')]=_[_0x550b('0x36')](_0x467e21[_0x550b('0x35')]);_0x450d13[_0x550b('0x37')]=_[_0x550b('0x38')](_0x450d13['model'],_0x450d13[_0x550b('0x35')]);_0x306ccf['attributes']=_[_0x550b('0x38')](_0x450d13[_0x550b('0x34')],qs[_0x550b('0x39')](_0x467e21[_0x550b('0x35')]['fields']));_0x306ccf[_0x550b('0x3a')]=_0x306ccf['attributes']['length']?_0x306ccf[_0x550b('0x3a')]:_0x450d13[_0x550b('0x34')];if(!_0x467e21[_0x550b('0x35')]['hasOwnProperty'](_0x550b('0x3b'))){_0x306ccf[_0x550b('0x20')]=qs[_0x550b('0x20')](_0x467e21[_0x550b('0x35')]['limit']);_0x306ccf[_0x550b('0x1e')]=qs[_0x550b('0x1e')](_0x467e21[_0x550b('0x35')][_0x550b('0x1e')]);}_0x306ccf[_0x550b('0x3c')]=qs['sort'](_0x467e21[_0x550b('0x35')][_0x550b('0x3d')]);_0x306ccf['where']=qs[_0x550b('0x37')](_['pick'](_0x467e21[_0x550b('0x35')],_0x450d13['filters']),_0x507c5c);if(_0x467e21['query'][_0x550b('0x3e')]){_0x306ccf['where']=_[_0x550b('0x3f')](_0x306ccf[_0x550b('0x40')],{'$or':_[_0x550b('0x2f')](_0x507c5c,function(_0x1c04f4){if(_0x1c04f4[_0x550b('0x32')]!==_0x550b('0x41')){var _0x385167={};_0x385167[_0x1c04f4[_0x550b('0x2c')]]={'$like':'%'+_0x467e21[_0x550b('0x35')][_0x550b('0x3e')]+'%'};return _0x385167;}})});}_0x306ccf=_[_0x550b('0x3f')]({},_0x306ccf,_0x467e21[_0x550b('0x42')]);var _0x4a352f={'where':_0x306ccf['where']};return db[_0x550b('0x30')]['count'](_0x4a352f)[_0x550b('0x26')](function(_0x4dc55f){_0x1f8df8[_0x550b('0x21')]=_0x4dc55f;if(_0x467e21[_0x550b('0x35')][_0x550b('0x43')]){_0x306ccf[_0x550b('0x44')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x550b('0x45')](_0x306ccf);})[_0x550b('0x26')](function(_0x1f02f8){_0x1f8df8[_0x550b('0x46')]=_0x1f02f8;return _0x1f8df8;})[_0x550b('0x26')](respondWithFilteredResult(_0x476921,_0x306ccf))[_0x550b('0x47')](handleError(_0x476921,null));};exports[_0x550b('0x48')]=function(_0x5a7678,_0x30f324){var _0x7302ee={'raw':!![],'where':{'id':_0x5a7678[_0x550b('0x49')]['id']}},_0x34676a={};_0x34676a[_0x550b('0x34')]=_[_0x550b('0x36')](db[_0x550b('0x30')][_0x550b('0x31')]);_0x34676a['query']=_['keys'](_0x5a7678['query']);_0x34676a[_0x550b('0x37')]=_['intersection'](_0x34676a[_0x550b('0x34')],_0x34676a['query']);_0x7302ee[_0x550b('0x3a')]=_[_0x550b('0x38')](_0x34676a['model'],qs[_0x550b('0x39')](_0x5a7678[_0x550b('0x35')][_0x550b('0x39')]));_0x7302ee[_0x550b('0x3a')]=_0x7302ee['attributes'][_0x550b('0x4a')]?_0x7302ee[_0x550b('0x3a')]:_0x34676a['model'];if(_0x5a7678[_0x550b('0x35')][_0x550b('0x43')]){_0x7302ee[_0x550b('0x44')]=[{'all':!![]}];}_0x7302ee=_[_0x550b('0x3f')]({},_0x7302ee,_0x5a7678[_0x550b('0x42')]);return db['CmContactHasItem']['find'](_0x7302ee)['then'](handleEntityNotFound(_0x30f324,null))[_0x550b('0x26')](respondWithResult(_0x30f324,null))[_0x550b('0x47')](handleError(_0x30f324,null));};exports[_0x550b('0x4b')]=function(_0x1ae5e5,_0x531f56){return db['CmContactHasItem'][_0x550b('0x4b')](_0x1ae5e5[_0x550b('0x4c')],{})[_0x550b('0x26')](function(_0x3db35c){var _0x3552cc=_0x1ae5e5[_0x550b('0x4d')][_0x550b('0x27')]({'plain':!![]});if(!_0x3552cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3552cc[_0x550b('0x4e')]===_0x550b('0x4d')){var _0x4e700d=_0x3db35c[_0x550b('0x27')]({'plain':!![]});var _0x1f3743=_0x550b('0x28');return db['UserProfileSection'][_0x550b('0x4f')]({'where':{'name':_0x1f3743,'userProfileId':_0x3552cc[_0x550b('0x50')]},'raw':!![]})[_0x550b('0x26')](function(_0x2d049e){if(_0x2d049e&&_0x2d049e[_0x550b('0x51')]===0x0){return db['UserProfileResource'][_0x550b('0x4b')]({'name':_0x4e700d[_0x550b('0x2c')],'resourceId':_0x4e700d['id'],'type':_0x2d049e[_0x550b('0x2c')],'sectionId':_0x2d049e['id']},{})[_0x550b('0x26')](function(){return _0x3db35c;});}else{return _0x3db35c;}})[_0x550b('0x47')](function(_0xcf6ac6){logger[_0x550b('0x2b')](_0x550b('0x52'),_0xcf6ac6);throw _0xcf6ac6;});}return _0x3db35c;})[_0x550b('0x26')](respondWithResult(_0x531f56,0xc9))[_0x550b('0x47')](handleError(_0x531f56,null));};exports[_0x550b('0x25')]=function(_0x1baed2,_0x59014d){if(_0x1baed2['body']['id']){delete _0x1baed2[_0x550b('0x4c')]['id'];}return db['CmContactHasItem'][_0x550b('0x4f')]({'where':{'id':_0x1baed2[_0x550b('0x49')]['id']}})['then'](handleEntityNotFound(_0x59014d,null))['then'](saveUpdates(_0x1baed2[_0x550b('0x4c')],null))['then'](respondWithResult(_0x59014d,null))[_0x550b('0x47')](handleError(_0x59014d,null));};exports[_0x550b('0x2a')]=function(_0x208b86,_0x3a9056){return db['CmContactHasItem'][_0x550b('0x4f')]({'where':{'id':_0x208b86[_0x550b('0x49')]['id']}})[_0x550b('0x26')](handleEntityNotFound(_0x3a9056,null))[_0x550b('0x26')](removeEntity(_0x3a9056,null))[_0x550b('0x47')](handleError(_0x3a9056,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 71c6f42..b4c49c3 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 _0x7368=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4c8b00,_0x16c38a){var _0x406a86=function(_0x93805a){while(--_0x93805a){_0x4c8b00['push'](_0x4c8b00['shift']());}};_0x406a86(++_0x16c38a);}(_0x7368,0xfc));var _0x8736=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7368[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x8736('0x0'));var util=require(_0x8736('0x1'));var logger=require(_0x8736('0x2'))(_0x8736('0x3'));var moment=require(_0x8736('0x4'));var BPromise=require(_0x8736('0x5'));var rp=require(_0x8736('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8736('0x7'));var attributes=require(_0x8736('0x8'));module[_0x8736('0x9')]=function(_0x5c3756,_0x5ee2e4){return _0x5c3756[_0x8736('0xa')](_0x8736('0xb'),attributes,{'tableName':_0x8736('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9db7=['CmContactHasItem','cm_contact_has_items','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x25fa6a,_0x4ee33f){var _0x5b904a=function(_0xd857a5){while(--_0xd857a5){_0x25fa6a['push'](_0x25fa6a['shift']());}};_0x5b904a(++_0x4ee33f);}(_0x9db7,0x1d6));var _0x79db=function(_0x2c758e,_0x15c81f){_0x2c758e=_0x2c758e-0x0;var _0xcf3994=_0x9db7[_0x2c758e];return _0xcf3994;};'use strict';var _=require('lodash');var util=require(_0x79db('0x0'));var logger=require(_0x79db('0x1'))('api');var moment=require('moment');var BPromise=require(_0x79db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79db('0x3'));var rimraf=require(_0x79db('0x4'));var config=require(_0x79db('0x5'));var attributes=require(_0x79db('0x6'));module['exports']=function(_0x19f425,_0x51b23b){return _0x19f425['define'](_0x79db('0x7'),attributes,{'tableName':_0x79db('0x8'),'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 f428eff..05ca217 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 _0x3e72=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x23ed34,_0x391f45){var _0x14a616=function(_0x4d4b5b){while(--_0x4d4b5b){_0x23ed34['push'](_0x23ed34['shift']());}};_0x14a616(++_0x391f45);}(_0x3e72,0x18e));var _0x23e7=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x3e72[_0x3e32a8];return _0x2997b0;};'use strict';var _=require(_0x23e7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x23e7('0x1'));var rs=require(_0x23e7('0x2'));var fs=require('fs');var Redis=require(_0x23e7('0x3'));var db=require(_0x23e7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23e7('0x5'));var config=require(_0x23e7('0x6'));var jayson=require(_0x23e7('0x7'));var client=jayson[_0x23e7('0x8')][_0x23e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f2961,_0x4c82f6,_0x51ab98){return new BPromise(function(_0x26f0b2,_0x58d31b){return client[_0x23e7('0xa')](_0x4f2961,_0x51ab98)['then'](function(_0x1d424c){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4c82f6,_0x23e7('0xb'));logger[_0x23e7('0xc')](_0x23e7('0xd'),_0x4c82f6,_0x23e7('0xb'),JSON[_0x23e7('0xe')](_0x1d424c));if(_0x1d424c[_0x23e7('0xf')]){if(_0x1d424c[_0x23e7('0xf')][_0x23e7('0x10')]===0x1f4){logger[_0x23e7('0xf')](_0x23e7('0x11'),_0x4c82f6,_0x1d424c['error'][_0x23e7('0x12')]);return _0x58d31b(_0x1d424c[_0x23e7('0xf')][_0x23e7('0x12')]);}logger[_0x23e7('0xf')](_0x23e7('0x11'),_0x4c82f6,_0x1d424c[_0x23e7('0xf')][_0x23e7('0x12')]);return _0x26f0b2(_0x1d424c[_0x23e7('0xf')][_0x23e7('0x12')]);}else{logger[_0x23e7('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x4c82f6,_0x23e7('0xb'));_0x26f0b2(_0x1d424c[_0x23e7('0x14')][_0x23e7('0x12')]);}})['catch'](function(_0x157010){logger[_0x23e7('0xf')](_0x23e7('0x11'),_0x4c82f6,_0x157010);_0x58d31b(_0x157010);});});} \ No newline at end of file +var _0xcb99=['stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x420a7c,_0x3ef0bc){var _0x311c52=function(_0x217b82){while(--_0x217b82){_0x420a7c['push'](_0x420a7c['shift']());}};_0x311c52(++_0x3ef0bc);}(_0xcb99,0x14f));var _0x9cb9=function(_0x4befae,_0x55b079){_0x4befae=_0x4befae-0x0;var _0x76c573=_0xcb99[_0x4befae];return _0x76c573;};'use strict';var _=require(_0x9cb9('0x0'));var util=require(_0x9cb9('0x1'));var moment=require('moment');var BPromise=require(_0x9cb9('0x2'));var rs=require(_0x9cb9('0x3'));var fs=require('fs');var Redis=require(_0x9cb9('0x4'));var db=require(_0x9cb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cb9('0x6'))(_0x9cb9('0x7'));var config=require('../../config/environment');var jayson=require(_0x9cb9('0x8'));var client=jayson[_0x9cb9('0x9')][_0x9cb9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23a65e,_0x4e717a,_0x424597){return new BPromise(function(_0x323e46,_0x20f93a){return client['request'](_0x23a65e,_0x424597)[_0x9cb9('0xb')](function(_0x36f404){logger[_0x9cb9('0xc')](_0x9cb9('0xd'),_0x4e717a,_0x9cb9('0xe'));logger[_0x9cb9('0xf')](_0x9cb9('0x10'),_0x4e717a,_0x9cb9('0xe'),JSON[_0x9cb9('0x11')](_0x36f404));if(_0x36f404['error']){if(_0x36f404[_0x9cb9('0x12')]['code']===0x1f4){logger[_0x9cb9('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x4e717a,_0x36f404['error']['message']);return _0x20f93a(_0x36f404[_0x9cb9('0x12')][_0x9cb9('0x13')]);}logger[_0x9cb9('0x12')](_0x9cb9('0xd'),_0x4e717a,_0x36f404['error'][_0x9cb9('0x13')]);return _0x323e46(_0x36f404[_0x9cb9('0x12')][_0x9cb9('0x13')]);}else{logger[_0x9cb9('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x4e717a,_0x9cb9('0xe'));_0x323e46(_0x36f404[_0x9cb9('0x14')][_0x9cb9('0x13')]);}})[_0x9cb9('0x15')](function(_0x440f9a){logger[_0x9cb9('0x12')](_0x9cb9('0xd'),_0x4e717a,_0x440f9a);_0x20f93a(_0x440f9a);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index e5ecc37..2f3a6b4 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 _0xf77d=['post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','index','isAuthenticated','show'];(function(_0x53afcf,_0xe3678d){var _0x1cce79=function(_0x276492){while(--_0x276492){_0x53afcf['push'](_0x53afcf['shift']());}};_0x1cce79(++_0xe3678d);}(_0xf77d,0x15c));var _0xdf77=function(_0x227c55,_0x49db56){_0x227c55=_0x227c55-0x0;var _0x49e02b=_0xf77d[_0x227c55];return _0x49e02b;};'use strict';var multer=require(_0xdf77('0x0'));var util=require(_0xdf77('0x1'));var path=require(_0xdf77('0x2'));var timeout=require(_0xdf77('0x3'));var express=require(_0xdf77('0x4'));var router=express[_0xdf77('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf77('0x6'));var interaction=require(_0xdf77('0x7'));var config=require('../../config/environment');var controller=require(_0xdf77('0x8'));router[_0xdf77('0x9')]('/',auth['isAuthenticated'](),controller[_0xdf77('0xa')]);router[_0xdf77('0x9')]('/:id',auth[_0xdf77('0xb')](),controller[_0xdf77('0xc')]);router[_0xdf77('0xd')]('/',auth[_0xdf77('0xb')](),controller['create']);router[_0xdf77('0xe')](_0xdf77('0xf'),auth['isAuthenticated'](),controller[_0xdf77('0x10')]);router[_0xdf77('0x11')](_0xdf77('0xf'),auth[_0xdf77('0xb')](),controller[_0xdf77('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7822=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7822,0xc6));var _0x2782=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7822[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2782('0x0'));var util=require(_0x2782('0x1'));var path=require(_0x2782('0x2'));var timeout=require(_0x2782('0x3'));var express=require(_0x2782('0x4'));var router=express[_0x2782('0x5')]();var fs_extra=require(_0x2782('0x6'));var auth=require(_0x2782('0x7'));var interaction=require(_0x2782('0x8'));var config=require(_0x2782('0x9'));var controller=require(_0x2782('0xa'));router[_0x2782('0xb')]('/',auth[_0x2782('0xc')](),controller[_0x2782('0xd')]);router[_0x2782('0xb')](_0x2782('0xe'),auth[_0x2782('0xc')](),controller[_0x2782('0xf')]);router[_0x2782('0x10')]('/',auth[_0x2782('0xc')](),controller['create']);router[_0x2782('0x11')](_0x2782('0xe'),auth['isAuthenticated'](),controller[_0x2782('0x12')]);router[_0x2782('0x13')](_0x2782('0xe'),auth[_0x2782('0xc')](),controller[_0x2782('0x14')]);module[_0x2782('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7689369..cc2a3f6 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 _0x3f39=['VIRTUAL','getDataValue','STRING','setDataValue','TEXT','select','values','isArray','voice','sequelize','lodash','exports'];(function(_0x578f44,_0x358f5e){var _0x209f62=function(_0x8958b3){while(--_0x8958b3){_0x578f44['push'](_0x578f44['shift']());}};_0x209f62(++_0x358f5e);}(_0x3f39,0x1b9));var _0x93f3=function(_0x44cc58,_0x359bf4){_0x44cc58=_0x44cc58-0x0;var _0x4aa1e4=_0x3f39[_0x44cc58];return _0x4aa1e4;};'use strict';var Sequelize=require(_0x93f3('0x0'));var _=require(_0x93f3('0x1'));module[_0x93f3('0x2')]={'name':{'type':Sequelize[_0x93f3('0x3')],'get':function(_0x50dfa4){return this[_0x93f3('0x4')]('alias');}},'alias':{'type':Sequelize[_0x93f3('0x5')],'allowNull':![],'set':function(_0x25d6a2){this[_0x93f3('0x6')]('alias',_0x25d6a2?_0x25d6a2:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x93f3('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x93f3('0x7')]('long'),'get':function(){if(this[_0x93f3('0x4')]('type')===_0x93f3('0x8')){return JSON['parse'](this['getDataValue'](_0x93f3('0x9')));}else{return this[_0x93f3('0x4')](_0x93f3('0x9'));}},'set':function(_0x446a23){if(Array[_0x93f3('0xa')](_0x446a23)){this[_0x93f3('0x6')]('values',JSON['stringify'](_0x446a23));}else{this[_0x93f3('0x6')](_0x93f3('0x9'),_0x446a23);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x93f3('0xb'))}}; \ No newline at end of file +var _0x0cae=['values','BOOLEAN','ENUM','lodash','exports','alias','STRING','setDataValue','getDataValue','name','long','type','select','parse'];(function(_0x56fef9,_0x382cfb){var _0x352d6b=function(_0x384fca){while(--_0x384fca){_0x56fef9['push'](_0x56fef9['shift']());}};_0x352d6b(++_0x382cfb);}(_0x0cae,0xff));var _0xe0ca=function(_0x6aad15,_0x586e9c){_0x6aad15=_0x6aad15-0x0;var _0x10af5a=_0x0cae[_0x6aad15];return _0x10af5a;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe0ca('0x0'));module[_0xe0ca('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x529420){return this['getDataValue'](_0xe0ca('0x2'));}},'alias':{'type':Sequelize[_0xe0ca('0x3')],'allowNull':![],'set':function(_0x5befe7){this[_0xe0ca('0x4')]('alias',_0x5befe7?_0x5befe7:this[_0xe0ca('0x5')](_0xe0ca('0x6')));}},'type':{'type':Sequelize[_0xe0ca('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xe0ca('0x7')),'get':function(){if(this[_0xe0ca('0x5')](_0xe0ca('0x8'))===_0xe0ca('0x9')){return JSON[_0xe0ca('0xa')](this[_0xe0ca('0x5')]('values'));}else{return this['getDataValue'](_0xe0ca('0xb'));}},'set':function(_0x20ed02){if(Array['isArray'](_0x20ed02)){this[_0xe0ca('0x4')]('values',JSON['stringify'](_0x20ed02));}else{this[_0xe0ca('0x4')]('values',_0x20ed02);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe0ca('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe0ca('0xd')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a46a3b2..db5319c 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 _0x47e4=['show','params','includeAll','find','update','body','create','sequelize','TEXT','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','sendStatus','error','map','CmCustomField','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','options','rows','catch'];(function(_0x5b8fd2,_0x46de96){var _0x9acfec=function(_0x2f5411){while(--_0x2f5411){_0x5b8fd2['push'](_0x5b8fd2['shift']());}};_0x9acfec(++_0x46de96);}(_0x47e4,0x196));var _0x447e=function(_0x302d1a,_0x387081){_0x302d1a=_0x302d1a-0x0;var _0xd82ca=_0x47e4[_0x302d1a];return _0xd82ca;};'use strict';var emlformat=require(_0x447e('0x0'));var rimraf=require(_0x447e('0x1'));var zipdir=require(_0x447e('0x2'));var jsonpatch=require(_0x447e('0x3'));var rp=require(_0x447e('0x4'));var moment=require(_0x447e('0x5'));var BPromise=require(_0x447e('0x6'));var Mustache=require('mustache');var util=require(_0x447e('0x7'));var path=require(_0x447e('0x8'));var sox=require('sox');var csv=require(_0x447e('0x9'));var ejs=require(_0x447e('0xa'));var fs=require('fs');var fs_extra=require(_0x447e('0xb'));var _=require(_0x447e('0xc'));var squel=require(_0x447e('0xd'));var crypto=require(_0x447e('0xe'));var jsforce=require(_0x447e('0xf'));var deskjs=require(_0x447e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x447e('0x11'));var Papa=require(_0x447e('0x12'));var Redis=require(_0x447e('0x13'));var authService=require(_0x447e('0x14'));var qs=require(_0x447e('0x15'));var as=require(_0x447e('0x16'));var hardwareService=require(_0x447e('0x17'));var logger=require(_0x447e('0x18'))('api');var utils=require(_0x447e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x447e('0x1a'))['db'];function respondWithStatusCode(_0x27e23a,_0x4dd89f){_0x4dd89f=_0x4dd89f||0xcc;return function(_0x24d408){if(_0x24d408){return _0x27e23a['sendStatus'](_0x4dd89f);}return _0x27e23a[_0x447e('0x1b')](_0x4dd89f)['end']();};}function respondWithResult(_0x2e2535,_0x36a443){_0x36a443=_0x36a443||0xc8;return function(_0x364859){if(_0x364859){return _0x2e2535['status'](_0x36a443)[_0x447e('0x1c')](_0x364859);}};}function respondWithFilteredResult(_0x58f5e4,_0x1e8d6f){return function(_0x2879c8){if(_0x2879c8){var _0x3bd605=typeof _0x1e8d6f['offset']===_0x447e('0x1d')&&typeof _0x1e8d6f[_0x447e('0x1e')]===_0x447e('0x1d');var _0x3a5d13=_0x2879c8[_0x447e('0x1f')];var _0x387740=_0x3bd605?0x0:_0x1e8d6f[_0x447e('0x20')];var _0x12ff62=_0x3bd605?_0x2879c8['count']:_0x1e8d6f[_0x447e('0x20')]+_0x1e8d6f[_0x447e('0x1e')];var _0x3a3be4;if(_0x12ff62>=_0x3a5d13){_0x12ff62=_0x3a5d13;_0x3a3be4=0xc8;}else{_0x3a3be4=0xce;}_0x58f5e4['status'](_0x3a3be4);return _0x58f5e4['set'](_0x447e('0x21'),_0x387740+'-'+_0x12ff62+'/'+_0x3a5d13)[_0x447e('0x1c')](_0x2879c8);}return null;};}function patchUpdates(_0x5d7387){return function(_0x1a78b4){try{jsonpatch[_0x447e('0x22')](_0x1a78b4,_0x5d7387,!![]);}catch(_0x28205c){return BPromise['reject'](_0x28205c);}return _0x1a78b4[_0x447e('0x23')]();};}function saveUpdates(_0x328799,_0x8bcec7){return function(_0x1c07b2){if(_0x1c07b2){return _0x1c07b2['update'](_0x328799)[_0x447e('0x24')](function(_0x67142e){return _0x67142e;});}return null;};}function removeEntity(_0x3719da,_0x5d0935){return function(_0xdb9d93){if(_0xdb9d93){return _0xdb9d93[_0x447e('0x25')]()['then'](function(){_0x3719da[_0x447e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48da37,_0x5e711d){return function(_0x481472){if(!_0x481472){_0x48da37[_0x447e('0x26')](0x194);}return _0x481472;};}function handleError(_0x13881a,_0x315e06){_0x315e06=_0x315e06||0x1f4;return function(_0x1d33f8){logger[_0x447e('0x27')](_0x1d33f8['stack']);if(_0x1d33f8['name']){delete _0x1d33f8['name'];}_0x13881a[_0x447e('0x1b')](_0x315e06)['send'](_0x1d33f8);};}exports['index']=function(_0x3b40f4,_0x586a10){var _0x4ad1b4={},_0x425eeb={},_0x4a071e={'count':0x0,'rows':[]};var _0x35cb31=_[_0x447e('0x28')](db[_0x447e('0x29')][_0x447e('0x2a')],function(_0x35b617){return{'name':_0x35b617[_0x447e('0x2b')],'type':_0x35b617[_0x447e('0x2c')]['key']};});_0x425eeb[_0x447e('0x2d')]=_['differenceBy'](_['map'](_0x35cb31,_0x447e('0x2e')),[_0x447e('0x2e')]);_0x425eeb[_0x447e('0x2f')]=_[_0x447e('0x30')](_0x3b40f4[_0x447e('0x2f')]);_0x425eeb[_0x447e('0x31')]=_[_0x447e('0x32')](_0x425eeb[_0x447e('0x2d')],_0x425eeb[_0x447e('0x2f')]);_0x4ad1b4['attributes']=_[_0x447e('0x32')](_0x425eeb[_0x447e('0x2d')],qs[_0x447e('0x33')](_0x3b40f4[_0x447e('0x2f')][_0x447e('0x33')]));_0x4ad1b4[_0x447e('0x34')]=_0x4ad1b4[_0x447e('0x34')][_0x447e('0x35')]?_0x4ad1b4['attributes']:_0x425eeb['model'];if(!_0x3b40f4[_0x447e('0x2f')][_0x447e('0x36')]('nolimit')){_0x4ad1b4[_0x447e('0x1e')]=qs['limit'](_0x3b40f4[_0x447e('0x2f')][_0x447e('0x1e')]);_0x4ad1b4[_0x447e('0x20')]=qs['offset'](_0x3b40f4[_0x447e('0x2f')]['offset']);}_0x4ad1b4[_0x447e('0x37')]=qs['sort'](_0x3b40f4['query']['sort']);_0x4ad1b4[_0x447e('0x38')]=qs[_0x447e('0x31')](_[_0x447e('0x39')](_0x3b40f4[_0x447e('0x2f')],_0x425eeb[_0x447e('0x31')]),_0x35cb31);if(_0x3b40f4[_0x447e('0x2f')]['filter']){_0x4ad1b4[_0x447e('0x38')]=_[_0x447e('0x3a')](_0x4ad1b4['where'],{'$or':_[_0x447e('0x28')](_0x35cb31,function(_0x5f4ee0){if(_0x5f4ee0[_0x447e('0x2c')]!=='VIRTUAL'){var _0x30cbd9={};_0x30cbd9[_0x5f4ee0[_0x447e('0x2e')]]={'$like':'%'+_0x3b40f4[_0x447e('0x2f')]['filter']+'%'};return _0x30cbd9;}})});}_0x4ad1b4=_[_0x447e('0x3a')]({},_0x4ad1b4,_0x3b40f4[_0x447e('0x3b')]);var _0x394551={'where':_0x4ad1b4['where']};return db[_0x447e('0x29')][_0x447e('0x1f')](_0x394551)['then'](function(_0x1650d0){_0x4a071e[_0x447e('0x1f')]=_0x1650d0;if(_0x3b40f4[_0x447e('0x2f')]['includeAll']){_0x4ad1b4['include']=[{'all':!![]}];}return db[_0x447e('0x29')]['findAll'](_0x4ad1b4);})[_0x447e('0x24')](function(_0x154914){_0x4a071e[_0x447e('0x3c')]=_0x154914;return _0x4a071e;})['then'](respondWithFilteredResult(_0x586a10,_0x4ad1b4))[_0x447e('0x3d')](handleError(_0x586a10,null));};exports[_0x447e('0x3e')]=function(_0x1246fc,_0xa0b982){var _0x12dabf={'raw':!![],'where':{'id':_0x1246fc[_0x447e('0x3f')]['id']}},_0x2203bc={};_0x2203bc['model']=_[_0x447e('0x30')](db[_0x447e('0x29')][_0x447e('0x2a')]);_0x2203bc[_0x447e('0x2f')]=_['keys'](_0x1246fc[_0x447e('0x2f')]);_0x2203bc[_0x447e('0x31')]=_['intersection'](_0x2203bc['model'],_0x2203bc[_0x447e('0x2f')]);_0x12dabf[_0x447e('0x34')]=_[_0x447e('0x32')](_0x2203bc['model'],qs[_0x447e('0x33')](_0x1246fc[_0x447e('0x2f')][_0x447e('0x33')]));_0x12dabf['attributes']=_0x12dabf[_0x447e('0x34')][_0x447e('0x35')]?_0x12dabf[_0x447e('0x34')]:_0x2203bc[_0x447e('0x2d')];if(_0x1246fc['query'][_0x447e('0x40')]){_0x12dabf['include']=[{'all':!![]}];}_0x12dabf=_['merge']({},_0x12dabf,_0x1246fc[_0x447e('0x3b')]);return db[_0x447e('0x29')][_0x447e('0x41')](_0x12dabf)[_0x447e('0x24')](handleEntityNotFound(_0xa0b982,null))[_0x447e('0x24')](respondWithResult(_0xa0b982,null))[_0x447e('0x3d')](handleError(_0xa0b982,null));};exports[_0x447e('0x42')]=function(_0x33ec9f,_0x45dd63){if(_0x33ec9f[_0x447e('0x43')]['id']){delete _0x33ec9f['body']['id'];}return db[_0x447e('0x29')][_0x447e('0x41')]({'where':{'id':_0x33ec9f[_0x447e('0x3f')]['id']}})[_0x447e('0x24')](handleEntityNotFound(_0x45dd63,null))['then'](saveUpdates(_0x33ec9f[_0x447e('0x43')],null))['then'](respondWithResult(_0x45dd63,null))['catch'](handleError(_0x45dd63,null));};exports[_0x447e('0x25')]=function(_0x364547,_0x3ebfaa){return db[_0x447e('0x29')][_0x447e('0x41')]({'where':{'id':_0x364547[_0x447e('0x3f')]['id']}})[_0x447e('0x24')](handleEntityNotFound(_0x3ebfaa,null))[_0x447e('0x24')](removeEntity(_0x3ebfaa,null))[_0x447e('0x3d')](handleError(_0x3ebfaa,null));};exports[_0x447e('0x44')]=function(_0x495370,_0x2ead8b){var _0x5f455e;return db[_0x447e('0x45')]['transaction'](function(_0x25452c){return db['CmCustomField'][_0x447e('0x44')](_0x495370[_0x447e('0x43')],{'transaction':_0x25452c})['then'](function(_0x3dad1e){_0x5f455e=_0x3dad1e;var _0x454977={'type':db['Sequelize'][_0x447e('0x46')],'transaction':_0x25452c};switch(_0x495370[_0x447e('0x43')][_0x447e('0x2c')]){case'text':_0x454977['type']=db[_0x447e('0x47')][_0x447e('0x46')];break;case'number':_0x454977[_0x447e('0x2c')]=db['Sequelize'][_0x447e('0x48')];break;case _0x447e('0x49'):_0x454977[_0x447e('0x2c')]=db['Sequelize'][_0x447e('0x4a')];_0x454977[_0x447e('0x4b')]=![];break;default:}return db[_0x447e('0x45')][_0x447e('0x4c')][_0x447e('0x4d')]('cm_contacts',util['format']('cf_%d',_0x5f455e['id']),_0x454977);})[_0x447e('0x24')](function(){return _0x5f455e;});})[_0x447e('0x24')](respondWithResult(_0x2ead8b,0xc9))[_0x447e('0x3d')](handleError(_0x2ead8b,null));}; \ No newline at end of file +var _0xb197=['order','sort','where','filter','merge','VIRTUAL','options','CmCustomField','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','send','index','fieldName','type','key','model','differenceBy','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x254b22,_0x27159f){var _0x1279db=function(_0x3ca06f){while(--_0x3ca06f){_0x254b22['push'](_0x254b22['shift']());}};_0x1279db(++_0x27159f);}(_0xb197,0xd0));var _0x7b19=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0xb197[_0x631a3c];return _0x2bdfa3;};'use strict';var emlformat=require(_0x7b19('0x0'));var rimraf=require(_0x7b19('0x1'));var zipdir=require(_0x7b19('0x2'));var jsonpatch=require(_0x7b19('0x3'));var rp=require(_0x7b19('0x4'));var moment=require(_0x7b19('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7b19('0x6'));var util=require(_0x7b19('0x7'));var path=require('path');var sox=require(_0x7b19('0x8'));var csv=require(_0x7b19('0x9'));var ejs=require(_0x7b19('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7b19('0xb'));var crypto=require(_0x7b19('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b19('0xd'));var toCsv=require(_0x7b19('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b19('0xe'));var qs=require(_0x7b19('0xf'));var as=require(_0x7b19('0x10'));var hardwareService=require(_0x7b19('0x11'));var logger=require('../../config/logger')(_0x7b19('0x12'));var utils=require(_0x7b19('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b19('0x14'))['db'];function respondWithStatusCode(_0x587afc,_0x299563){_0x299563=_0x299563||0xcc;return function(_0x560e85){if(_0x560e85){return _0x587afc['sendStatus'](_0x299563);}return _0x587afc['status'](_0x299563)[_0x7b19('0x15')]();};}function respondWithResult(_0x5389e4,_0x308c0d){_0x308c0d=_0x308c0d||0xc8;return function(_0x4b20fe){if(_0x4b20fe){return _0x5389e4[_0x7b19('0x16')](_0x308c0d)[_0x7b19('0x17')](_0x4b20fe);}};}function respondWithFilteredResult(_0x1ae8c9,_0x45ec24){return function(_0x2efe75){if(_0x2efe75){var _0x4f032d=typeof _0x45ec24[_0x7b19('0x18')]==='undefined'&&typeof _0x45ec24[_0x7b19('0x19')]==='undefined';var _0x1b4624=_0x2efe75['count'];var _0x59ef2c=_0x4f032d?0x0:_0x45ec24['offset'];var _0x343c3f=_0x4f032d?_0x2efe75[_0x7b19('0x1a')]:_0x45ec24['offset']+_0x45ec24[_0x7b19('0x19')];var _0x49142d;if(_0x343c3f>=_0x1b4624){_0x343c3f=_0x1b4624;_0x49142d=0xc8;}else{_0x49142d=0xce;}_0x1ae8c9[_0x7b19('0x16')](_0x49142d);return _0x1ae8c9[_0x7b19('0x1b')](_0x7b19('0x1c'),_0x59ef2c+'-'+_0x343c3f+'/'+_0x1b4624)['json'](_0x2efe75);}return null;};}function patchUpdates(_0x3784d4){return function(_0x34f595){try{jsonpatch[_0x7b19('0x1d')](_0x34f595,_0x3784d4,!![]);}catch(_0x3609ea){return BPromise[_0x7b19('0x1e')](_0x3609ea);}return _0x34f595['save']();};}function saveUpdates(_0x505b5c,_0x5dc79a){return function(_0x5d7b34){if(_0x5d7b34){return _0x5d7b34[_0x7b19('0x1f')](_0x505b5c)[_0x7b19('0x20')](function(_0x1977ef){return _0x1977ef;});}return null;};}function removeEntity(_0xa0669f,_0x4d4ced){return function(_0x2c059d){if(_0x2c059d){return _0x2c059d[_0x7b19('0x21')]()[_0x7b19('0x20')](function(){_0xa0669f[_0x7b19('0x16')](0xcc)[_0x7b19('0x15')]();});}};}function handleEntityNotFound(_0x2cf283,_0x23fdaa){return function(_0x3ef456){if(!_0x3ef456){_0x2cf283[_0x7b19('0x22')](0x194);}return _0x3ef456;};}function handleError(_0x14a074,_0x9d15d2){_0x9d15d2=_0x9d15d2||0x1f4;return function(_0x339856){logger[_0x7b19('0x23')](_0x339856[_0x7b19('0x24')]);if(_0x339856['name']){delete _0x339856['name'];}_0x14a074[_0x7b19('0x16')](_0x9d15d2)[_0x7b19('0x25')](_0x339856);};}exports[_0x7b19('0x26')]=function(_0x3a2456,_0x54b0d9){var _0x31dae2={},_0x2744d2={},_0x4c246d={'count':0x0,'rows':[]};var _0x11ffce=_['map'](db['CmCustomField']['rawAttributes'],function(_0x3c9198){return{'name':_0x3c9198[_0x7b19('0x27')],'type':_0x3c9198[_0x7b19('0x28')][_0x7b19('0x29')]};});_0x2744d2[_0x7b19('0x2a')]=_[_0x7b19('0x2b')](_['map'](_0x11ffce,_0x7b19('0x2c')),['name']);_0x2744d2[_0x7b19('0x2d')]=_[_0x7b19('0x2e')](_0x3a2456['query']);_0x2744d2[_0x7b19('0x2f')]=_[_0x7b19('0x30')](_0x2744d2[_0x7b19('0x2a')],_0x2744d2[_0x7b19('0x2d')]);_0x31dae2[_0x7b19('0x31')]=_[_0x7b19('0x30')](_0x2744d2[_0x7b19('0x2a')],qs[_0x7b19('0x32')](_0x3a2456[_0x7b19('0x2d')]['fields']));_0x31dae2[_0x7b19('0x31')]=_0x31dae2[_0x7b19('0x31')]['length']?_0x31dae2[_0x7b19('0x31')]:_0x2744d2[_0x7b19('0x2a')];if(!_0x3a2456[_0x7b19('0x2d')][_0x7b19('0x33')](_0x7b19('0x34'))){_0x31dae2[_0x7b19('0x19')]=qs['limit'](_0x3a2456[_0x7b19('0x2d')][_0x7b19('0x19')]);_0x31dae2[_0x7b19('0x18')]=qs[_0x7b19('0x18')](_0x3a2456[_0x7b19('0x2d')][_0x7b19('0x18')]);}_0x31dae2[_0x7b19('0x35')]=qs[_0x7b19('0x36')](_0x3a2456['query']['sort']);_0x31dae2[_0x7b19('0x37')]=qs[_0x7b19('0x2f')](_['pick'](_0x3a2456['query'],_0x2744d2[_0x7b19('0x2f')]),_0x11ffce);if(_0x3a2456[_0x7b19('0x2d')][_0x7b19('0x38')]){_0x31dae2[_0x7b19('0x37')]=_[_0x7b19('0x39')](_0x31dae2[_0x7b19('0x37')],{'$or':_['map'](_0x11ffce,function(_0x54b6b2){if(_0x54b6b2[_0x7b19('0x28')]!==_0x7b19('0x3a')){var _0x59bd14={};_0x59bd14[_0x54b6b2[_0x7b19('0x2c')]]={'$like':'%'+_0x3a2456['query']['filter']+'%'};return _0x59bd14;}})});}_0x31dae2=_[_0x7b19('0x39')]({},_0x31dae2,_0x3a2456[_0x7b19('0x3b')]);var _0xfc2453={'where':_0x31dae2[_0x7b19('0x37')]};return db[_0x7b19('0x3c')][_0x7b19('0x1a')](_0xfc2453)[_0x7b19('0x20')](function(_0x3b0907){_0x4c246d[_0x7b19('0x1a')]=_0x3b0907;if(_0x3a2456[_0x7b19('0x2d')][_0x7b19('0x3d')]){_0x31dae2['include']=[{'all':!![]}];}return db[_0x7b19('0x3c')][_0x7b19('0x3e')](_0x31dae2);})[_0x7b19('0x20')](function(_0x4d6e67){_0x4c246d[_0x7b19('0x3f')]=_0x4d6e67;return _0x4c246d;})['then'](respondWithFilteredResult(_0x54b0d9,_0x31dae2))[_0x7b19('0x40')](handleError(_0x54b0d9,null));};exports[_0x7b19('0x41')]=function(_0x1bc9c6,_0x185d20){var _0x4330c2={'raw':!![],'where':{'id':_0x1bc9c6[_0x7b19('0x42')]['id']}},_0x5cc4a1={};_0x5cc4a1[_0x7b19('0x2a')]=_[_0x7b19('0x2e')](db[_0x7b19('0x3c')][_0x7b19('0x43')]);_0x5cc4a1['query']=_[_0x7b19('0x2e')](_0x1bc9c6[_0x7b19('0x2d')]);_0x5cc4a1[_0x7b19('0x2f')]=_[_0x7b19('0x30')](_0x5cc4a1[_0x7b19('0x2a')],_0x5cc4a1[_0x7b19('0x2d')]);_0x4330c2[_0x7b19('0x31')]=_[_0x7b19('0x30')](_0x5cc4a1[_0x7b19('0x2a')],qs[_0x7b19('0x32')](_0x1bc9c6[_0x7b19('0x2d')][_0x7b19('0x32')]));_0x4330c2[_0x7b19('0x31')]=_0x4330c2[_0x7b19('0x31')][_0x7b19('0x44')]?_0x4330c2[_0x7b19('0x31')]:_0x5cc4a1[_0x7b19('0x2a')];if(_0x1bc9c6['query'][_0x7b19('0x3d')]){_0x4330c2[_0x7b19('0x45')]=[{'all':!![]}];}_0x4330c2=_[_0x7b19('0x39')]({},_0x4330c2,_0x1bc9c6[_0x7b19('0x3b')]);return db[_0x7b19('0x3c')]['find'](_0x4330c2)[_0x7b19('0x20')](handleEntityNotFound(_0x185d20,null))[_0x7b19('0x20')](respondWithResult(_0x185d20,null))[_0x7b19('0x40')](handleError(_0x185d20,null));};exports[_0x7b19('0x1f')]=function(_0x2f79b9,_0x52f764){if(_0x2f79b9['body']['id']){delete _0x2f79b9[_0x7b19('0x46')]['id'];}return db[_0x7b19('0x3c')][_0x7b19('0x47')]({'where':{'id':_0x2f79b9[_0x7b19('0x42')]['id']}})[_0x7b19('0x20')](handleEntityNotFound(_0x52f764,null))[_0x7b19('0x20')](saveUpdates(_0x2f79b9[_0x7b19('0x46')],null))[_0x7b19('0x20')](respondWithResult(_0x52f764,null))[_0x7b19('0x40')](handleError(_0x52f764,null));};exports[_0x7b19('0x21')]=function(_0x27fa0c,_0x629bb1){return db[_0x7b19('0x3c')]['find']({'where':{'id':_0x27fa0c[_0x7b19('0x42')]['id']}})[_0x7b19('0x20')](handleEntityNotFound(_0x629bb1,null))[_0x7b19('0x20')](removeEntity(_0x629bb1,null))['catch'](handleError(_0x629bb1,null));};exports[_0x7b19('0x48')]=function(_0x3fa8b4,_0x3e204c){var _0x5e3b04;return db[_0x7b19('0x49')][_0x7b19('0x4a')](function(_0x3e614a){return db[_0x7b19('0x3c')][_0x7b19('0x48')](_0x3fa8b4[_0x7b19('0x46')],{'transaction':_0x3e614a})[_0x7b19('0x20')](function(_0x4a25fe){_0x5e3b04=_0x4a25fe;var _0x3d1831={'type':db[_0x7b19('0x4b')][_0x7b19('0x4c')],'transaction':_0x3e614a};switch(_0x3fa8b4[_0x7b19('0x46')][_0x7b19('0x28')]){case _0x7b19('0x4d'):_0x3d1831[_0x7b19('0x28')]=db[_0x7b19('0x4b')][_0x7b19('0x4c')];break;case _0x7b19('0x4e'):_0x3d1831[_0x7b19('0x28')]=db[_0x7b19('0x4b')][_0x7b19('0x4f')];break;case _0x7b19('0x50'):_0x3d1831[_0x7b19('0x28')]=db[_0x7b19('0x4b')][_0x7b19('0x51')];_0x3d1831[_0x7b19('0x52')]=![];break;default:}return db[_0x7b19('0x49')][_0x7b19('0x53')]['addColumn'](_0x7b19('0x54'),util[_0x7b19('0x55')](_0x7b19('0x56'),_0x5e3b04['id']),_0x3d1831);})[_0x7b19('0x20')](function(){return _0x5e3b04;});})[_0x7b19('0x20')](respondWithResult(_0x3e204c,0xc9))[_0x7b19('0x40')](handleError(_0x3e204c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9f61db8..23823bd 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 _0x2473=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x3113ee,_0xf9b6b9){var _0x167ae4=function(_0x230c37){while(--_0x230c37){_0x3113ee['push'](_0x3113ee['shift']());}};_0x167ae4(++_0xf9b6b9);}(_0x2473,0x1ed));var _0x3247=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2473[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x3247('0x0'));var util=require(_0x3247('0x1'));var logger=require(_0x3247('0x2'))(_0x3247('0x3'));var moment=require(_0x3247('0x4'));var BPromise=require(_0x3247('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3247('0x6'));var rimraf=require(_0x3247('0x7'));var config=require(_0x3247('0x8'));var attributes=require(_0x3247('0x9'));module[_0x3247('0xa')]=function(_0x3f4a26,_0x51f27a){return _0x3f4a26[_0x3247('0xb')](_0x3247('0xc'),attributes,{'tableName':_0x3247('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cb7=['CmCustomField','cm_custom_fields','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x440090,_0x131699){var _0x512ae5=function(_0x2a2776){while(--_0x2a2776){_0x440090['push'](_0x440090['shift']());}};_0x512ae5(++_0x131699);}(_0x7cb7,0xe9));var _0x77cb=function(_0x19c90d,_0x2514f7){_0x19c90d=_0x19c90d-0x0;var _0x1ee547=_0x7cb7[_0x19c90d];return _0x1ee547;};'use strict';var _=require(_0x77cb('0x0'));var util=require('util');var logger=require(_0x77cb('0x1'))(_0x77cb('0x2'));var moment=require('moment');var BPromise=require(_0x77cb('0x3'));var rp=require(_0x77cb('0x4'));var fs=require('fs');var path=require(_0x77cb('0x5'));var rimraf=require(_0x77cb('0x6'));var config=require(_0x77cb('0x7'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x4eeec0,_0x3ab558){return _0x4eeec0[_0x77cb('0x8')](_0x77cb('0x9'),attributes,{'tableName':_0x77cb('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 7ff03ac..7e81618 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 _0x6177=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x170a07,_0x4917dc){var _0x4525f7=function(_0x5b3d4e){while(--_0x5b3d4e){_0x170a07['push'](_0x170a07['shift']());}};_0x4525f7(++_0x4917dc);}(_0x6177,0x16b));var _0x7617=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6177[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x7617('0x0'));var util=require(_0x7617('0x1'));var moment=require(_0x7617('0x2'));var BPromise=require(_0x7617('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7617('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7617('0x5'));var logger=require(_0x7617('0x6'))(_0x7617('0x7'));var config=require(_0x7617('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7617('0x9')][_0x7617('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55828a,_0x5d049c,_0x201487){return new BPromise(function(_0x2fba66,_0xfeced0){return client[_0x7617('0xb')](_0x55828a,_0x201487)[_0x7617('0xc')](function(_0x8f7686){logger[_0x7617('0xd')]('CmCustomField,\x20%s,\x20%s',_0x5d049c,_0x7617('0xe'));logger[_0x7617('0xf')](_0x7617('0x10'),_0x5d049c,_0x7617('0xe'),JSON[_0x7617('0x11')](_0x8f7686));if(_0x8f7686['error']){if(_0x8f7686[_0x7617('0x12')][_0x7617('0x13')]===0x1f4){logger[_0x7617('0x12')](_0x7617('0x14'),_0x5d049c,_0x8f7686[_0x7617('0x12')][_0x7617('0x15')]);return _0xfeced0(_0x8f7686[_0x7617('0x12')][_0x7617('0x15')]);}logger[_0x7617('0x12')](_0x7617('0x14'),_0x5d049c,_0x8f7686[_0x7617('0x12')][_0x7617('0x15')]);return _0x2fba66(_0x8f7686[_0x7617('0x12')][_0x7617('0x15')]);}else{logger['info'](_0x7617('0x14'),_0x5d049c,_0x7617('0xe'));_0x2fba66(_0x8f7686['result']['message']);}})[_0x7617('0x16')](function(_0x2930b9){logger['error'](_0x7617('0x14'),_0x5d049c,_0x2930b9);_0xfeced0(_0x2930b9);});});} \ No newline at end of file +var _0xa9ce=['request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x17b59d,_0x545965){var _0x4629ec=function(_0x2aeb91){while(--_0x2aeb91){_0x17b59d['push'](_0x17b59d['shift']());}};_0x4629ec(++_0x545965);}(_0xa9ce,0xd8));var _0xea9c=function(_0x233855,_0x2de003){_0x233855=_0x233855-0x0;var _0xba66da=_0xa9ce[_0x233855];return _0xba66da;};'use strict';var _=require('lodash');var util=require(_0xea9c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xea9c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea9c('0x2'))['db'];var utils=require(_0xea9c('0x3'));var logger=require(_0xea9c('0x4'))(_0xea9c('0x5'));var config=require(_0xea9c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xea9c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29416d,_0x252471,_0x43f480){return new BPromise(function(_0x32ec5b,_0x3d1bc6){return client[_0xea9c('0x8')](_0x29416d,_0x43f480)['then'](function(_0x14c1f5){logger[_0xea9c('0x9')](_0xea9c('0xa'),_0x252471,_0xea9c('0xb'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x252471,_0xea9c('0xb'),JSON['stringify'](_0x14c1f5));if(_0x14c1f5[_0xea9c('0xc')]){if(_0x14c1f5[_0xea9c('0xc')]['code']===0x1f4){logger[_0xea9c('0xc')](_0xea9c('0xa'),_0x252471,_0x14c1f5[_0xea9c('0xc')][_0xea9c('0xd')]);return _0x3d1bc6(_0x14c1f5[_0xea9c('0xc')][_0xea9c('0xd')]);}logger[_0xea9c('0xc')](_0xea9c('0xa'),_0x252471,_0x14c1f5[_0xea9c('0xc')][_0xea9c('0xd')]);return _0x32ec5b(_0x14c1f5['error'][_0xea9c('0xd')]);}else{logger['info'](_0xea9c('0xa'),_0x252471,_0xea9c('0xb'));_0x32ec5b(_0x14c1f5[_0xea9c('0xe')][_0xea9c('0xd')]);}})[_0xea9c('0xf')](function(_0x5c4dc5){logger[_0xea9c('0xc')](_0xea9c('0xa'),_0x252471,_0x5c4dc5);_0x3d1bc6(_0x5c4dc5);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 397b17c..68a23e2 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 _0x10af=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','exports','multer','path','connect-timeout'];(function(_0x336c75,_0x234d58){var _0x5e37fd=function(_0x26480e){while(--_0x26480e){_0x336c75['push'](_0x336c75['shift']());}};_0x5e37fd(++_0x234d58);}(_0x10af,0xfc));var _0xf10a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x10af[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0xf10a('0x0'));var util=require('util');var path=require(_0xf10a('0x1'));var timeout=require(_0xf10a('0x2'));var express=require(_0xf10a('0x3'));var router=express[_0xf10a('0x4')]();var fs_extra=require(_0xf10a('0x5'));var auth=require(_0xf10a('0x6'));var interaction=require(_0xf10a('0x7'));var config=require(_0xf10a('0x8'));var controller=require('./cmCustomField.controller');router[_0xf10a('0x9')]('/',auth[_0xf10a('0xa')](),controller['index']);router['get'](_0xf10a('0xb'),auth[_0xf10a('0xa')](),controller[_0xf10a('0xc')]);router[_0xf10a('0xd')]('/',auth['isAuthenticated'](),controller[_0xf10a('0xe')]);router['put'](_0xf10a('0xb'),auth['isAuthenticated'](),controller[_0xf10a('0xf')]);router['delete']('/:id',auth[_0xf10a('0xa')](),controller['destroy']);module[_0xf10a('0x10')]=router; \ No newline at end of file +var _0x088e=['../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4d4da2,_0x3a5402){var _0x41185a=function(_0x1029e5){while(--_0x1029e5){_0x4d4da2['push'](_0x4d4da2['shift']());}};_0x41185a(++_0x3a5402);}(_0x088e,0x172));var _0xe088=function(_0x6c2a02,_0x52d4bb){_0x6c2a02=_0x6c2a02-0x0;var _0x2473a1=_0x088e[_0x6c2a02];return _0x2473a1;};'use strict';var multer=require(_0xe088('0x0'));var util=require(_0xe088('0x1'));var path=require(_0xe088('0x2'));var timeout=require('connect-timeout');var express=require(_0xe088('0x3'));var router=express[_0xe088('0x4')]();var fs_extra=require(_0xe088('0x5'));var auth=require(_0xe088('0x6'));var interaction=require(_0xe088('0x7'));var config=require(_0xe088('0x8'));var controller=require(_0xe088('0x9'));router['get']('/',auth[_0xe088('0xa')](),controller[_0xe088('0xb')]);router['get'](_0xe088('0xc'),auth[_0xe088('0xa')](),controller[_0xe088('0xd')]);router[_0xe088('0xe')]('/',auth['isAuthenticated'](),controller[_0xe088('0xf')]);router[_0xe088('0x10')](_0xe088('0xc'),auth['isAuthenticated'](),controller[_0xe088('0x11')]);router[_0xe088('0x12')](_0xe088('0xc'),auth[_0xe088('0xa')](),controller[_0xe088('0x13')]);module[_0xe088('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 509aeef..c93cd82 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 _0xce69=['exports','STRING','BOOLEAN','DATE','format','INTEGER','contactListQueue'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xce69,0x1d5));var _0x9ce6=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0xce69[_0x580971];return _0x16d873;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9ce6('0x0')]={'phone':{'type':Sequelize[_0x9ce6('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x9ce6('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9ce6('0x3')],'defaultValue':moment()[_0x9ce6('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9ce6('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9ce6('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9ce6('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9ce6('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9ce6('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9ce6('0x5')],'unique':_0x9ce6('0x6')},'ListId':{'type':Sequelize[_0x9ce6('0x5')],'unique':_0x9ce6('0x6')},'UserId':{'type':Sequelize[_0x9ce6('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x9ce6('0x5')],'unique':_0x9ce6('0x6')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9ce6('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9ce6('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9ce6('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9ce6('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9ce6('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9ce6('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x9ce6('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7032=['UNSIGNED','contactListQueue','moment','sequelize','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE'];(function(_0x113ec1,_0x4cd3c1){var _0x3e9fab=function(_0x35c2a7){while(--_0x35c2a7){_0x113ec1['push'](_0x113ec1['shift']());}};_0x3e9fab(++_0x4cd3c1);}(_0x7032,0x1a6));var _0x2703=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0x7032[_0x1196bd];return _0x26014f;};'use strict';var moment=require(_0x2703('0x0'));var Sequelize=require(_0x2703('0x1'));module['exports']={'phone':{'type':Sequelize[_0x2703('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x2703('0x3')](_0x2703('0x4'))},'countbusyretry':{'type':Sequelize[_0x2703('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2703('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2703('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2703('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2703('0x7')]},'priority':{'type':Sequelize[_0x2703('0x5')](0x2)[_0x2703('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x2703('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x2703('0x5')],'unique':_0x2703('0x9')},'ListId':{'type':Sequelize[_0x2703('0x5')],'unique':_0x2703('0x9')},'UserId':{'type':Sequelize[_0x2703('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x2703('0x9')},'CampaignId':{'type':Sequelize[_0x2703('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x2703('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2703('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2703('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2703('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x2703('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2703('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 2e9e1fa..10d4bf8 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 _0x00bb=['find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','preview','dialPreviewAutoRecallMe','format','value','direction','prev','isEmpty','ASC','dialOrderByScheduledAt','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','hopperIds','priority','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getPreviewRecall','transaction','recallme','getOpenContacts','outbound','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','api','../../mysqldb','status','offset','undefined','limit','count','json','update','then','sendStatus','error','name','send','index','CmHopper','rawAttributes','type','model','map','query','intersection','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$between','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys'];(function(_0x2fb0e5,_0x45e57a){var _0x584d1f=function(_0x551080){while(--_0x551080){_0x2fb0e5['push'](_0x2fb0e5['shift']());}};_0x584d1f(++_0x45e57a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00bb[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var qs=require(_0xb00b('0x2'));var logger=require('../../config/logger')(_0xb00b('0x3'));var shared=require('../../config/environment');var db=require(_0xb00b('0x4'))['db'];function respondWithResult(_0x464fe7,_0x582ef9){_0x582ef9=_0x582ef9||0xc8;return function(_0x14b5d0){if(_0x14b5d0){return _0x464fe7[_0xb00b('0x5')](_0x582ef9)['json'](_0x14b5d0);}};}function respondWithFilteredResult(_0x574cf8,_0x532ffb){return function(_0x36e363){if(_0x36e363){var _0xf737d0=typeof _0x532ffb[_0xb00b('0x6')]===_0xb00b('0x7')&&typeof _0x532ffb[_0xb00b('0x8')]===_0xb00b('0x7');var _0x5b0c03=_0x36e363['count'];var _0x5154d9=_0xf737d0?0x0:_0x532ffb[_0xb00b('0x6')];var _0x5851d4=_0xf737d0?_0x36e363[_0xb00b('0x9')]:_0x532ffb[_0xb00b('0x6')]+_0x532ffb['limit'];var _0x3182db;if(_0x5851d4>=_0x5b0c03){_0x5851d4=_0x5b0c03;_0x3182db=0xc8;}else{_0x3182db=0xce;}_0x574cf8['status'](_0x3182db);return _0x574cf8['set']('Content-Range',_0x5154d9+'-'+_0x5851d4+'/'+_0x5b0c03)[_0xb00b('0xa')](_0x36e363);}return null;};}function saveUpdates(_0x2d8ddf,_0x1be8aa){return function(_0x466b9b){if(_0x466b9b){return _0x466b9b[_0xb00b('0xb')](_0x2d8ddf)[_0xb00b('0xc')](function(_0x4ada81){return _0x4ada81;});}return null;};}function handleEntityNotFound(_0x218de2,_0xb0d42e){return function(_0x482fe6){if(!_0x482fe6){_0x218de2[_0xb00b('0xd')](0x194);}return _0x482fe6;};}function handleError(_0x1084a6,_0x540b79){_0x540b79=_0x540b79||0x1f4;return function(_0x5da36b){logger[_0xb00b('0xe')](_0x5da36b['stack']);if(_0x5da36b['name']){delete _0x5da36b[_0xb00b('0xf')];}_0x1084a6[_0xb00b('0x5')](_0x540b79)[_0xb00b('0x10')](_0x5da36b);};}exports[_0xb00b('0x11')]=function(_0x58d65f,_0x2a7231){var _0x599347={},_0x415f91={},_0x5aa9a0={'count':0x0,'rows':[]};var _0x25d7a0=_['map'](db[_0xb00b('0x12')][_0xb00b('0x13')],function(_0x53ee68){return{'name':_0x53ee68['fieldName'],'type':_0x53ee68[_0xb00b('0x14')]['key']};});_0x415f91[_0xb00b('0x15')]=_[_0xb00b('0x16')](_0x25d7a0,_0xb00b('0xf'));_0x415f91[_0xb00b('0x17')]=_['keys'](_0x58d65f[_0xb00b('0x17')]);_0x415f91['filters']=_[_0xb00b('0x18')](_0x415f91[_0xb00b('0x15')],_0x415f91['query']);_0x415f91[_0xb00b('0x19')]=_[_0xb00b('0x1a')](_0x415f91['filters'],[_0xb00b('0x1b'),_0xb00b('0x1c'),'$gt',_0xb00b('0x1d'),_0xb00b('0x1e'),_0xb00b('0x1f'),_0xb00b('0x20'),'$eq','$not',_0xb00b('0x21'),'$notBetween','$in','$notIn',_0xb00b('0x22'),_0xb00b('0x23'),_0xb00b('0x24'),_0xb00b('0x25'),_0xb00b('0x22'),_0xb00b('0x26'),_0xb00b('0x27'),'$contained',_0xb00b('0x28')]);_0x599347['attributes']=_[_0xb00b('0x18')](_0x415f91[_0xb00b('0x15')],qs[_0xb00b('0x29')](_0x58d65f['query'][_0xb00b('0x29')]));_0x599347[_0xb00b('0x2a')]=_0x599347[_0xb00b('0x2a')][_0xb00b('0x2b')]?_0x599347[_0xb00b('0x2a')]:_0x415f91[_0xb00b('0x15')];if(!_0x58d65f[_0xb00b('0x17')][_0xb00b('0x2c')](_0xb00b('0x2d'))){_0x599347['limit']=qs[_0xb00b('0x8')](_0x58d65f[_0xb00b('0x17')]['limit']);_0x599347[_0xb00b('0x6')]=qs[_0xb00b('0x6')](_0x58d65f['query'][_0xb00b('0x6')]);}_0x599347['order']=qs[_0xb00b('0x2e')](_0x58d65f[_0xb00b('0x17')][_0xb00b('0x2e')]);_0x599347[_0xb00b('0x2f')]=qs[_0xb00b('0x19')](_[_0xb00b('0x30')](_0x58d65f[_0xb00b('0x17')],_0x415f91['filters']),_0x25d7a0);if(_0x58d65f['query']['filter']){_0x599347[_0xb00b('0x2f')]=_[_0xb00b('0x31')](_0x599347[_0xb00b('0x2f')],{'$or':_[_0xb00b('0x16')](_0x25d7a0,function(_0x5cfa60){if(_0x5cfa60[_0xb00b('0x14')]!==_0xb00b('0x32')){var _0x341f46={};_0x341f46[_0x5cfa60[_0xb00b('0xf')]]={'$like':'%'+_0x58d65f[_0xb00b('0x17')][_0xb00b('0x33')]+'%'};return _0x341f46;}})});}_0x599347=_[_0xb00b('0x31')]({},_0x599347,_0x58d65f[_0xb00b('0x34')]);var _0x5efc18={'where':_0x599347['where']};return db[_0xb00b('0x12')]['count'](_0x5efc18)[_0xb00b('0xc')](function(_0x1c5400){_0x5aa9a0[_0xb00b('0x9')]=_0x1c5400;if(_0x58d65f[_0xb00b('0x17')][_0xb00b('0x35')]){_0x599347[_0xb00b('0x36')]=[{'all':!![]}];}return db[_0xb00b('0x12')]['findAll'](_0x599347);})[_0xb00b('0xc')](function(_0x25578e){_0x5aa9a0[_0xb00b('0x37')]=_0x25578e;return _0x5aa9a0;})[_0xb00b('0xc')](respondWithFilteredResult(_0x2a7231,_0x599347))[_0xb00b('0x38')](handleError(_0x2a7231,null));};exports[_0xb00b('0x39')]=function(_0x59fb00,_0x36980a){var _0x3beb8f={'raw':!![],'where':{'id':_0x59fb00[_0xb00b('0x3a')]['id']}},_0x4801e7={};_0x4801e7[_0xb00b('0x15')]=_[_0xb00b('0x3b')](db[_0xb00b('0x12')][_0xb00b('0x13')]);_0x4801e7['query']=_[_0xb00b('0x3b')](_0x59fb00[_0xb00b('0x17')]);_0x4801e7[_0xb00b('0x19')]=_[_0xb00b('0x18')](_0x4801e7['model'],_0x4801e7['query']);_0x3beb8f[_0xb00b('0x2a')]=_[_0xb00b('0x18')](_0x4801e7[_0xb00b('0x15')],qs[_0xb00b('0x29')](_0x59fb00[_0xb00b('0x17')][_0xb00b('0x29')]));_0x3beb8f[_0xb00b('0x2a')]=_0x3beb8f['attributes'][_0xb00b('0x2b')]?_0x3beb8f[_0xb00b('0x2a')]:_0x4801e7[_0xb00b('0x15')];if(_0x59fb00[_0xb00b('0x17')][_0xb00b('0x35')]){_0x3beb8f[_0xb00b('0x36')]=[{'all':!![]}];}_0x3beb8f=_[_0xb00b('0x31')]({},_0x3beb8f,_0x59fb00[_0xb00b('0x34')]);return db[_0xb00b('0x12')][_0xb00b('0x3c')](_0x3beb8f)[_0xb00b('0xc')](handleEntityNotFound(_0x36980a,null))[_0xb00b('0xc')](respondWithResult(_0x36980a,null))['catch'](handleError(_0x36980a,null));};exports[_0xb00b('0x3d')]=function(_0x35a0ba,_0xd07fb8){return db[_0xb00b('0x12')][_0xb00b('0x3d')](_0x35a0ba[_0xb00b('0x3e')],{})[_0xb00b('0xc')](respondWithResult(_0xd07fb8,0xc9))[_0xb00b('0x38')](handleError(_0xd07fb8,null));};exports[_0xb00b('0xb')]=function(_0x103320,_0x1eec12){if(_0x103320[_0xb00b('0x3e')]['id']){delete _0x103320['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x103320[_0xb00b('0x3a')]['id']}})[_0xb00b('0xc')](handleEntityNotFound(_0x1eec12,null))['then'](saveUpdates(_0x103320[_0xb00b('0x3e')],null))[_0xb00b('0xc')](respondWithResult(_0x1eec12,null))[_0xb00b('0x38')](handleError(_0x1eec12,null));};exports[_0xb00b('0x3f')]=function(_0x4b62b3,_0x58e9cb){return db[_0xb00b('0x12')][_0xb00b('0x3f')]()['then'](respondWithResult(_0x58e9cb,null))['catch'](handleError(_0x58e9cb,null));};exports[_0xb00b('0x40')]=function(_0x3a205d,_0x4e0be4){var _0x2228e9;var _0x47a814=_0x3a205d['params']['id'];return db['CmHopper'][_0xb00b('0x3c')]({'where':{'id':_0x3a205d['params']['id']}})[_0xb00b('0xc')](handleEntityNotFound(_0x4e0be4,null))[_0xb00b('0xc')](function(_0x4b6482){if(_0x4b6482){return _0x4b6482[_0xb00b('0x40')]()[_0xb00b('0xc')](function(_0xda60ca){return _0xda60ca;});}})['then'](function(_0x5bd40c){_0x2228e9=_0x5bd40c;if(_0x5bd40c){if(_0x5bd40c[_0xb00b('0x41')]||_0x5bd40c[_0xb00b('0x42')]){return db[_0x5bd40c['VoiceQueueId']?_0xb00b('0x43'):_0xb00b('0x44')]['find']({'where':{'id':_0x5bd40c[_0xb00b('0x41')]?_0x5bd40c[_0xb00b('0x41')]:_0x5bd40c[_0xb00b('0x42')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x19f907){var _0x398deb={};if(_0x19f907){_[_0xb00b('0x31')](_0x398deb,_[_0xb00b('0x45')](_0x2228e9['dataValues'],[_0xb00b('0x46'),_0xb00b('0x47'),'id']));_0x398deb['state']=0x15;_0x398deb['statedesc']=_0xb00b('0x48');_0x398deb['campaign']=_0x19f907[_0xb00b('0xf')];_0x398deb[_0xb00b('0x49')]=_0x3a205d[_0xb00b('0x4a')][_0xb00b('0xf')];_0x398deb[_0xb00b('0x4b')]=_0x3a205d[_0xb00b('0x4a')]['id'];_0x398deb['deleted']=!![];_0x398deb[_0xb00b('0x4c')]=moment()['format'](_0xb00b('0x4d'));_0x398deb[_0xb00b('0x4e')]=_0x2228e9[_0xb00b('0x4f')];_0x398deb['campaigntype']=_0x2228e9[_0xb00b('0x41')]?_0xb00b('0x50'):_0xb00b('0x51');return db['CmContact'][_0xb00b('0x3c')]({'where':{'id':_0x398deb[_0xb00b('0x52')]},'attributes':[_0xb00b('0x53'),_0xb00b('0x54')]})[_0xb00b('0xc')](function(_0x279467){if(!_[_0xb00b('0x55')](_0x4e0be4)&&!_[_0xb00b('0x55')](_0x279467['firstName'])){_0x398deb[_0xb00b('0x56')]=_0x279467[_0xb00b('0x53')];if(!_[_0xb00b('0x55')](_0x279467['lastName'])){_0x398deb[_0xb00b('0x56')]+='\x20'+_0x279467[_0xb00b('0x54')];}}})[_0xb00b('0x57')](function(){return db[_0xb00b('0x58')][_0xb00b('0x3d')](_0x398deb);});}})['then'](function(_0xfd4ecc){return db[_0xb00b('0x59')][_0xb00b('0x40')]({'where':{'CmHopperId':_0x47a814}});})[_0xb00b('0xc')](function(){return _0x4e0be4['status'](0xcc)[_0xb00b('0x5a')]();})[_0xb00b('0x38')](handleError(_0x4e0be4,null));};exports[_0xb00b('0x5b')]=function(_0x2d73bb,_0x161216){var _0x1e5ed8=[];return db[_0xb00b('0x5c')]['describe']()[_0xb00b('0xc')](function(_0x502822){_0x1e5ed8=_[_0xb00b('0x3b')](_0x502822);return _0x2d73bb['user'][_0xb00b('0x5d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xb00b('0x5e')},'attributes':['id','dialOrderByScheduledAt',_0xb00b('0x5f')],'raw':!![]});})[_0xb00b('0xc')](function(_0x3bae02){if(_0x3bae02&&_0x3bae02['length']){return db['sequelize']['transaction'](function(_0x21a53d){var _0x3126be={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb00b('0x60')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xb00b('0x16')](_0x3bae02,'id')},'$or':[{'UserId':null},{'UserId':_0x2d73bb[_0xb00b('0x4a')]['id']}]};var _0xca87d4={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3bae02)[_0xb00b('0x33')]([_0xb00b('0x5f'),0x0])['map']('id')[_0xb00b('0x61')]()},'$or':[{'UserId':null},{'UserId':_0x2d73bb[_0xb00b('0x4a')]['id']}]};var _0x5622a4={'$or':[_0x3126be,_0xca87d4]};var _0xe1316d=[];if(_0x2d73bb[_0xb00b('0x3e')][_0xb00b('0x62')]&&_0x2d73bb['body']['direction']===_0xb00b('0x63')){if(!_[_0xb00b('0x64')](_0x2d73bb[_0xb00b('0x3e')]['hopperIds'])){_0x5622a4['id']={'$in':_0x2d73bb['body']['hopperIds']};}_0xe1316d=[['priority',_0xb00b('0x65')],['scheduledAt',_0x3bae02[0x0][_0xb00b('0x66')]===_0xb00b('0x65')?'DESC':_0xb00b('0x65')],db[_0xb00b('0x67')][_0xb00b('0x68')](_0xb00b('0x69')),['id',_0xb00b('0x6a')]];}else{if(!_['isEmpty'](_0x2d73bb[_0xb00b('0x3e')][_0xb00b('0x6b')])){_0x5622a4['id']={'$notIn':_0x2d73bb[_0xb00b('0x3e')][_0xb00b('0x6b')]};}_0xe1316d=[[_0xb00b('0x6c'),_0xb00b('0x6a')],[_0xb00b('0x6d'),_0x3bae02[0x0]['dialOrderByScheduledAt']],db[_0xb00b('0x67')][_0xb00b('0x68')](_0xb00b('0x6e')),['id',_0xb00b('0x65')]];}return db[_0xb00b('0x12')][_0xb00b('0x6f')]({'attributes':['id',_0xb00b('0x70'),_0xb00b('0x4f'),'recallme'],'where':_0x5622a4,'order':_0xe1316d,'transaction':_0x21a53d,'lock':_0x21a53d[_0xb00b('0x71')][_0xb00b('0x72')],'include':[{'model':db[_0xb00b('0x5c')],'as':_0xb00b('0x73'),'attributes':_0x1e5ed8,'include':[{'model':db[_0xb00b('0x74')],'as':_0xb00b('0x75'),'attributes':['id',_0xb00b('0xf')]}]},{'model':db[_0xb00b('0x76')],'as':'List','attributes':['id',_0xb00b('0xf')]},{'model':db[_0xb00b('0x43')],'as':_0xb00b('0x77'),'attributes':['id',_0xb00b('0xf'),_0xb00b('0x78')]}]})[_0xb00b('0xc')](function(_0x26461a){if(_0x26461a){return _0x26461a['update']({'UserId':_0x2d73bb[_0xb00b('0x4a')]['id']},{'transaction':_0x21a53d});}});});}})[_0xb00b('0xc')](handleEntityNotFound(_0x161216,null))[_0xb00b('0xc')](respondWithResult(_0x161216,null))[_0xb00b('0x38')](handleError(_0x161216,null));};exports[_0xb00b('0x79')]=function(_0x14ccaf,_0x4930f3,_0x39bb6c){var _0x4e95c7=[];var _0x135cbf=_0x14ccaf['params']['id'];var _0x1b255d=_0x14ccaf[_0xb00b('0x4a')]['id'];return db[_0xb00b('0x5c')]['describe']()['then'](function(_0x9ad1c6){_0x4e95c7=_[_0xb00b('0x3b')](_0x9ad1c6);return db[_0xb00b('0x67')][_0xb00b('0x7a')](function(_0x36b3a2){const _0x13e875={'id':_0x135cbf};return db[_0xb00b('0x12')][_0xb00b('0x6f')]({'attributes':['id',_0xb00b('0x70'),_0xb00b('0x7b')],'where':_0x13e875,'transaction':_0x36b3a2,'lock':_0x36b3a2[_0xb00b('0x71')][_0xb00b('0x72')],'include':[{'model':db[_0xb00b('0x5c')],'as':_0xb00b('0x73'),'attributes':_0x4e95c7,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xb00b('0xf')]}]},{'model':db[_0xb00b('0x76')],'as':'List','attributes':['id','name']},{'model':db[_0xb00b('0x43')],'as':_0xb00b('0x77'),'attributes':['id',_0xb00b('0xf'),'dialActive']}]})[_0xb00b('0xc')](function(_0x3f415a){if(_0x3f415a){return _0x3f415a[_0xb00b('0xb')]({'UserId':_0x1b255d},{'transaction':_0x36b3a2});}});});})[_0xb00b('0xc')](handleEntityNotFound(_0x4930f3,null))[_0xb00b('0xc')](respondWithResult(_0x4930f3,null))[_0xb00b('0x38')](handleError(_0x4930f3,null));};exports[_0xb00b('0x7c')]=function(_0x4a9125,_0x4168cf){return _0x4a9125['user'][_0xb00b('0x5d')]({'where':{'type':_0xb00b('0x7d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xb00b('0xc')](function(_0x1099cb){if(_0x1099cb&&_0x1099cb[_0xb00b('0x2b')]){return db[_0xb00b('0x12')][_0xb00b('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb00b('0x60')](_0xb00b('0x4d'))},'VoiceQueueId':{'$in':_[_0xb00b('0x16')](_0x1099cb,'id')},'$or':[{'UserId':null},{'UserId':_0x4a9125[_0xb00b('0x4a')]['id']}]}});}return 0x0;})[_0xb00b('0xc')](function(_0x2ec3f2){if(!_[_0xb00b('0x55')](_0x2ec3f2)&&_['isNumber'](_0x2ec3f2)){return _0x4168cf[_0xb00b('0x5')](0xc8)[_0xb00b('0xa')]({'contacts':_0x2ec3f2});}else{logger[_0xb00b('0xe')](_0xb00b('0x7e'),'getOpenContacts',0x194,_0xb00b('0x7f'));_0x4168cf[_0xb00b('0xd')](0x194);}})[_0xb00b('0x38')](handleError(_0x4168cf,null));};exports[_0xb00b('0x80')]=function(_0x21471a,_0x5b4d38){var _0x2f1096=shared[_0xb00b('0x81')];var _0xa4fe1e=[];_[_0xb00b('0x16')](_0x2f1096,function(_0x4fb982){_0xa4fe1e[_0xb00b('0x82')]({'id':_0x4fb982['name'],'name':_0x4fb982[_0xb00b('0xf')],'utcOffset':_0x4fb982[_0xb00b('0x83')]});});return _0x5b4d38[_0xb00b('0x5')](0xc8)[_0xb00b('0xa')]({'tz':_0xa4fe1e});};exports[_0xb00b('0x84')]=function(_0x27e051,_0x430e8a){var _0x319977=shared[_0xb00b('0x81')];var _0x1cd071={};if(!_[_0xb00b('0x55')](_0x319977[_0x27e051['body']['id']]))_0x1cd071=_0x319977[_0x27e051[_0xb00b('0x3e')]['id']];return _0x430e8a[_0xb00b('0x5')](0xc8)[_0xb00b('0xa')](_0x1cd071);}; \ No newline at end of file +var _0xe132=['merge','options','CmHopper','include','findAll','rows','catch','show','params','keys','length','includeAll','body','find','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','updatedAt','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','create','CmHopperAdditionalPhone','end','getVoiceQueues','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','sequelize','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','CmCompany','Company','CmList','List','Queue','LOCK','Contact','dialActive','getOpenContacts','outbound','preview','format','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','offset','undefined','limit','count','status','Content-Range','json','update','then','stack','name','index','map','rawAttributes','fieldName','type','filters','intersection','model','query','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','order','sort','where','pick','filter'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xe132,0x162));var _0x2e13=function(_0x331256,_0x1e1e72){_0x331256=_0x331256-0x0;var _0x4961c2=_0xe132[_0x331256];return _0x4961c2;};'use strict';var moment=require(_0x2e13('0x0'));var _=require('lodash');var qs=require(_0x2e13('0x1'));var logger=require(_0x2e13('0x2'))(_0x2e13('0x3'));var shared=require(_0x2e13('0x4'));var db=require(_0x2e13('0x5'))['db'];function respondWithResult(_0x4b87a6,_0x1ae6a9){_0x1ae6a9=_0x1ae6a9||0xc8;return function(_0x3f01fe){if(_0x3f01fe){return _0x4b87a6['status'](_0x1ae6a9)['json'](_0x3f01fe);}};}function respondWithFilteredResult(_0x260dc1,_0x2f9d00){return function(_0x1c670b){if(_0x1c670b){var _0x71f9d3=typeof _0x2f9d00[_0x2e13('0x6')]===_0x2e13('0x7')&&typeof _0x2f9d00[_0x2e13('0x8')]===_0x2e13('0x7');var _0xd031e9=_0x1c670b[_0x2e13('0x9')];var _0x5122a2=_0x71f9d3?0x0:_0x2f9d00[_0x2e13('0x6')];var _0x20fe3e=_0x71f9d3?_0x1c670b[_0x2e13('0x9')]:_0x2f9d00[_0x2e13('0x6')]+_0x2f9d00[_0x2e13('0x8')];var _0x1a871d;if(_0x20fe3e>=_0xd031e9){_0x20fe3e=_0xd031e9;_0x1a871d=0xc8;}else{_0x1a871d=0xce;}_0x260dc1[_0x2e13('0xa')](_0x1a871d);return _0x260dc1['set'](_0x2e13('0xb'),_0x5122a2+'-'+_0x20fe3e+'/'+_0xd031e9)[_0x2e13('0xc')](_0x1c670b);}return null;};}function saveUpdates(_0x320303,_0x299dd3){return function(_0x424e58){if(_0x424e58){return _0x424e58[_0x2e13('0xd')](_0x320303)[_0x2e13('0xe')](function(_0x51f1a3){return _0x51f1a3;});}return null;};}function handleEntityNotFound(_0xb70eb8,_0xea6c20){return function(_0xfaca18){if(!_0xfaca18){_0xb70eb8['sendStatus'](0x194);}return _0xfaca18;};}function handleError(_0x4d7fa3,_0x2a58e5){_0x2a58e5=_0x2a58e5||0x1f4;return function(_0x433bbd){logger['error'](_0x433bbd[_0x2e13('0xf')]);if(_0x433bbd[_0x2e13('0x10')]){delete _0x433bbd[_0x2e13('0x10')];}_0x4d7fa3['status'](_0x2a58e5)['send'](_0x433bbd);};}exports[_0x2e13('0x11')]=function(_0x2c026d,_0x336a10){var _0x3cdefc={},_0x399ce2={},_0x32ce2f={'count':0x0,'rows':[]};var _0x2496ee=_[_0x2e13('0x12')](db['CmHopper'][_0x2e13('0x13')],function(_0x9c37a9){return{'name':_0x9c37a9[_0x2e13('0x14')],'type':_0x9c37a9[_0x2e13('0x15')]['key']};});_0x399ce2['model']=_[_0x2e13('0x12')](_0x2496ee,_0x2e13('0x10'));_0x399ce2['query']=_['keys'](_0x2c026d['query']);_0x399ce2[_0x2e13('0x16')]=_[_0x2e13('0x17')](_0x399ce2[_0x2e13('0x18')],_0x399ce2[_0x2e13('0x19')]);_0x399ce2[_0x2e13('0x16')]=_[_0x2e13('0x1a')](_0x399ce2['filters'],[_0x2e13('0x1b'),_0x2e13('0x1c'),_0x2e13('0x1d'),_0x2e13('0x1e'),_0x2e13('0x1f'),_0x2e13('0x20'),'$ne',_0x2e13('0x21'),_0x2e13('0x22'),'$between','$notBetween',_0x2e13('0x23'),_0x2e13('0x24'),_0x2e13('0x25'),'$notLike',_0x2e13('0x26'),_0x2e13('0x27'),_0x2e13('0x25'),_0x2e13('0x28'),_0x2e13('0x29'),_0x2e13('0x2a'),_0x2e13('0x2b')]);_0x3cdefc[_0x2e13('0x2c')]=_[_0x2e13('0x17')](_0x399ce2[_0x2e13('0x18')],qs[_0x2e13('0x2d')](_0x2c026d[_0x2e13('0x19')][_0x2e13('0x2d')]));_0x3cdefc[_0x2e13('0x2c')]=_0x3cdefc[_0x2e13('0x2c')]['length']?_0x3cdefc[_0x2e13('0x2c')]:_0x399ce2[_0x2e13('0x18')];if(!_0x2c026d[_0x2e13('0x19')]['hasOwnProperty']('nolimit')){_0x3cdefc[_0x2e13('0x8')]=qs[_0x2e13('0x8')](_0x2c026d[_0x2e13('0x19')][_0x2e13('0x8')]);_0x3cdefc[_0x2e13('0x6')]=qs[_0x2e13('0x6')](_0x2c026d['query']['offset']);}_0x3cdefc[_0x2e13('0x2e')]=qs[_0x2e13('0x2f')](_0x2c026d[_0x2e13('0x19')][_0x2e13('0x2f')]);_0x3cdefc[_0x2e13('0x30')]=qs[_0x2e13('0x16')](_[_0x2e13('0x31')](_0x2c026d[_0x2e13('0x19')],_0x399ce2['filters']),_0x2496ee);if(_0x2c026d[_0x2e13('0x19')][_0x2e13('0x32')]){_0x3cdefc[_0x2e13('0x30')]=_[_0x2e13('0x33')](_0x3cdefc[_0x2e13('0x30')],{'$or':_['map'](_0x2496ee,function(_0x28e6de){if(_0x28e6de[_0x2e13('0x15')]!=='VIRTUAL'){var _0x750ee2={};_0x750ee2[_0x28e6de[_0x2e13('0x10')]]={'$like':'%'+_0x2c026d[_0x2e13('0x19')]['filter']+'%'};return _0x750ee2;}})});}_0x3cdefc=_[_0x2e13('0x33')]({},_0x3cdefc,_0x2c026d[_0x2e13('0x34')]);var _0x4bfb50={'where':_0x3cdefc[_0x2e13('0x30')]};return db[_0x2e13('0x35')]['count'](_0x4bfb50)[_0x2e13('0xe')](function(_0x5c17bb){_0x32ce2f[_0x2e13('0x9')]=_0x5c17bb;if(_0x2c026d[_0x2e13('0x19')]['includeAll']){_0x3cdefc[_0x2e13('0x36')]=[{'all':!![]}];}return db[_0x2e13('0x35')][_0x2e13('0x37')](_0x3cdefc);})[_0x2e13('0xe')](function(_0x20ae95){_0x32ce2f[_0x2e13('0x38')]=_0x20ae95;return _0x32ce2f;})[_0x2e13('0xe')](respondWithFilteredResult(_0x336a10,_0x3cdefc))[_0x2e13('0x39')](handleError(_0x336a10,null));};exports[_0x2e13('0x3a')]=function(_0x1cca7f,_0x4ffb30){var _0x24ebb6={'raw':!![],'where':{'id':_0x1cca7f[_0x2e13('0x3b')]['id']}},_0xd2e8ae={};_0xd2e8ae[_0x2e13('0x18')]=_[_0x2e13('0x3c')](db['CmHopper'][_0x2e13('0x13')]);_0xd2e8ae['query']=_[_0x2e13('0x3c')](_0x1cca7f[_0x2e13('0x19')]);_0xd2e8ae['filters']=_[_0x2e13('0x17')](_0xd2e8ae['model'],_0xd2e8ae[_0x2e13('0x19')]);_0x24ebb6[_0x2e13('0x2c')]=_[_0x2e13('0x17')](_0xd2e8ae[_0x2e13('0x18')],qs[_0x2e13('0x2d')](_0x1cca7f['query'][_0x2e13('0x2d')]));_0x24ebb6['attributes']=_0x24ebb6[_0x2e13('0x2c')][_0x2e13('0x3d')]?_0x24ebb6[_0x2e13('0x2c')]:_0xd2e8ae[_0x2e13('0x18')];if(_0x1cca7f[_0x2e13('0x19')][_0x2e13('0x3e')]){_0x24ebb6['include']=[{'all':!![]}];}_0x24ebb6=_['merge']({},_0x24ebb6,_0x1cca7f[_0x2e13('0x34')]);return db[_0x2e13('0x35')]['find'](_0x24ebb6)[_0x2e13('0xe')](handleEntityNotFound(_0x4ffb30,null))[_0x2e13('0xe')](respondWithResult(_0x4ffb30,null))[_0x2e13('0x39')](handleError(_0x4ffb30,null));};exports['create']=function(_0x5c6a9a,_0xd44b46){return db['CmHopper']['create'](_0x5c6a9a[_0x2e13('0x3f')],{})[_0x2e13('0xe')](respondWithResult(_0xd44b46,0xc9))[_0x2e13('0x39')](handleError(_0xd44b46,null));};exports['update']=function(_0x20b444,_0x16bdf2){if(_0x20b444[_0x2e13('0x3f')]['id']){delete _0x20b444[_0x2e13('0x3f')]['id'];}return db['CmHopper'][_0x2e13('0x40')]({'where':{'id':_0x20b444['params']['id']}})[_0x2e13('0xe')](handleEntityNotFound(_0x16bdf2,null))[_0x2e13('0xe')](saveUpdates(_0x20b444[_0x2e13('0x3f')],null))[_0x2e13('0xe')](respondWithResult(_0x16bdf2,null))[_0x2e13('0x39')](handleError(_0x16bdf2,null));};exports[_0x2e13('0x41')]=function(_0x961af7,_0x8e8b86){return db[_0x2e13('0x35')][_0x2e13('0x41')]()['then'](respondWithResult(_0x8e8b86,null))[_0x2e13('0x39')](handleError(_0x8e8b86,null));};exports[_0x2e13('0x42')]=function(_0x4780b7,_0x1d13ec){var _0x426e75;var _0xcc5495=_0x4780b7[_0x2e13('0x3b')]['id'];return db[_0x2e13('0x35')][_0x2e13('0x40')]({'where':{'id':_0x4780b7[_0x2e13('0x3b')]['id']}})[_0x2e13('0xe')](handleEntityNotFound(_0x1d13ec,null))[_0x2e13('0xe')](function(_0x532689){if(_0x532689){return _0x532689[_0x2e13('0x42')]()[_0x2e13('0xe')](function(_0x39cef0){return _0x39cef0;});}})[_0x2e13('0xe')](function(_0x13374a){_0x426e75=_0x13374a;if(_0x13374a){if(_0x13374a[_0x2e13('0x43')]||_0x13374a['CampaignId']){return db[_0x13374a[_0x2e13('0x43')]?_0x2e13('0x44'):_0x2e13('0x45')][_0x2e13('0x40')]({'where':{'id':_0x13374a[_0x2e13('0x43')]?_0x13374a[_0x2e13('0x43')]:_0x13374a[_0x2e13('0x46')]},'attributes':['id','name'],'raw':!![]});}}})[_0x2e13('0xe')](function(_0x3a1a9c){var _0x252b14={};if(_0x3a1a9c){_['merge'](_0x252b14,_[_0x2e13('0x47')](_0x426e75[_0x2e13('0x48')],['createdAt',_0x2e13('0x49'),'id']));_0x252b14['state']=0x15;_0x252b14['statedesc']=_0x2e13('0x4a');_0x252b14[_0x2e13('0x4b')]=_0x3a1a9c[_0x2e13('0x10')];_0x252b14[_0x2e13('0x4c')]=_0x4780b7[_0x2e13('0x4d')]['name'];_0x252b14[_0x2e13('0x4e')]=_0x4780b7['user']['id'];_0x252b14['deleted']=!![];_0x252b14[_0x2e13('0x4f')]=moment()['format'](_0x2e13('0x50'));_0x252b14[_0x2e13('0x51')]=_0x426e75[_0x2e13('0x52')];_0x252b14[_0x2e13('0x53')]=_0x426e75[_0x2e13('0x43')]?_0x2e13('0x54'):_0x2e13('0x55');return db[_0x2e13('0x56')]['find']({'where':{'id':_0x252b14[_0x2e13('0x57')]},'attributes':[_0x2e13('0x58'),'lastName']})['then'](function(_0xbfecec){if(!_[_0x2e13('0x59')](_0x1d13ec)&&!_[_0x2e13('0x59')](_0xbfecec['firstName'])){_0x252b14[_0x2e13('0x5a')]=_0xbfecec['firstName'];if(!_[_0x2e13('0x59')](_0xbfecec[_0x2e13('0x5b')])){_0x252b14[_0x2e13('0x5a')]+='\x20'+_0xbfecec['lastName'];}}})[_0x2e13('0x5c')](function(){return db['CmHopperFinal'][_0x2e13('0x5d')](_0x252b14);});}})[_0x2e13('0xe')](function(_0x3de3fc){return db[_0x2e13('0x5e')][_0x2e13('0x42')]({'where':{'CmHopperId':_0xcc5495}});})[_0x2e13('0xe')](function(){return _0x1d13ec['status'](0xcc)[_0x2e13('0x5f')]();})[_0x2e13('0x39')](handleError(_0x1d13ec,null));};exports['getPreview']=function(_0x591065,_0x446643){var _0x1c8862=[];return db['CmContact']['describe']()[_0x2e13('0xe')](function(_0x4b0481){_0x1c8862=_[_0x2e13('0x3c')](_0x4b0481);return _0x591065[_0x2e13('0x4d')][_0x2e13('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x2e13('0x61'),_0x2e13('0x62')],'raw':!![]});})[_0x2e13('0xe')](function(_0x52ee42){if(_0x52ee42&&_0x52ee42[_0x2e13('0x3d')]){return db['sequelize'][_0x2e13('0x63')](function(_0x571fd9){var _0x5d09c4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x2e13('0x50'))},'VoiceQueueId':{'$in':_[_0x2e13('0x12')](_0x52ee42,'id')},'$or':[{'UserId':null},{'UserId':_0x591065[_0x2e13('0x4d')]['id']}]};var _0x1a1cc0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x52ee42)[_0x2e13('0x32')]([_0x2e13('0x62'),0x0])[_0x2e13('0x12')]('id')[_0x2e13('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x591065['user']['id']}]};var _0x1ac435={'$or':[_0x5d09c4,_0x1a1cc0]};var _0x2c75b2=[];if(_0x591065[_0x2e13('0x3f')][_0x2e13('0x65')]&&_0x591065[_0x2e13('0x3f')]['direction']===_0x2e13('0x66')){if(!_[_0x2e13('0x67')](_0x591065['body'][_0x2e13('0x68')])){_0x1ac435['id']={'$in':_0x591065['body'][_0x2e13('0x68')]};}_0x2c75b2=[[_0x2e13('0x69'),_0x2e13('0x6a')],[_0x2e13('0x6b'),_0x52ee42[0x0][_0x2e13('0x61')]===_0x2e13('0x6a')?'DESC':_0x2e13('0x6a')],db[_0x2e13('0x6c')][_0x2e13('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x2e13('0x6e')]];}else{if(!_[_0x2e13('0x67')](_0x591065[_0x2e13('0x3f')][_0x2e13('0x68')])){_0x1ac435['id']={'$notIn':_0x591065['body'][_0x2e13('0x68')]};}_0x2c75b2=[[_0x2e13('0x69'),_0x2e13('0x6e')],[_0x2e13('0x6b'),_0x52ee42[0x0]['dialOrderByScheduledAt']],db[_0x2e13('0x6c')][_0x2e13('0x6d')](_0x2e13('0x6f')),['id','ASC']];}return db[_0x2e13('0x35')][_0x2e13('0x70')]({'attributes':['id',_0x2e13('0x71'),_0x2e13('0x52'),_0x2e13('0x72')],'where':_0x1ac435,'order':_0x2c75b2,'transaction':_0x571fd9,'lock':_0x571fd9['LOCK'][_0x2e13('0x73')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x1c8862,'include':[{'model':db[_0x2e13('0x74')],'as':_0x2e13('0x75'),'attributes':['id',_0x2e13('0x10')]}]},{'model':db[_0x2e13('0x76')],'as':_0x2e13('0x77'),'attributes':['id','name']},{'model':db[_0x2e13('0x44')],'as':_0x2e13('0x78'),'attributes':['id',_0x2e13('0x10'),'dialActive']}]})[_0x2e13('0xe')](function(_0xec435e){if(_0xec435e){return _0xec435e[_0x2e13('0xd')]({'UserId':_0x591065[_0x2e13('0x4d')]['id']},{'transaction':_0x571fd9});}});});}})['then'](handleEntityNotFound(_0x446643,null))[_0x2e13('0xe')](respondWithResult(_0x446643,null))['catch'](handleError(_0x446643,null));};exports['getPreviewRecall']=function(_0x22f345,_0x27ccff,_0xa7c844){var _0x5e110e=[];var _0x101e3b=_0x22f345[_0x2e13('0x3b')]['id'];var _0x55f9ae=_0x22f345[_0x2e13('0x4d')]['id'];return db[_0x2e13('0x56')][_0x2e13('0x41')]()[_0x2e13('0xe')](function(_0x5f50d3){_0x5e110e=_[_0x2e13('0x3c')](_0x5f50d3);return db['sequelize'][_0x2e13('0x63')](function(_0x94d5af){const _0x33e627={'id':_0x101e3b};return db[_0x2e13('0x35')][_0x2e13('0x70')]({'attributes':['id','scheduledat',_0x2e13('0x72')],'where':_0x33e627,'transaction':_0x94d5af,'lock':_0x94d5af[_0x2e13('0x79')][_0x2e13('0x73')],'include':[{'model':db['CmContact'],'as':_0x2e13('0x7a'),'attributes':_0x5e110e,'include':[{'model':db['CmCompany'],'as':_0x2e13('0x75'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x2e13('0x77'),'attributes':['id',_0x2e13('0x10')]},{'model':db[_0x2e13('0x44')],'as':_0x2e13('0x78'),'attributes':['id',_0x2e13('0x10'),_0x2e13('0x7b')]}]})[_0x2e13('0xe')](function(_0x5c8f68){if(_0x5c8f68){return _0x5c8f68[_0x2e13('0xd')]({'UserId':_0x55f9ae},{'transaction':_0x94d5af});}});});})[_0x2e13('0xe')](handleEntityNotFound(_0x27ccff,null))['then'](respondWithResult(_0x27ccff,null))[_0x2e13('0x39')](handleError(_0x27ccff,null));};exports[_0x2e13('0x7c')]=function(_0x466858,_0x2f79e2){return _0x466858[_0x2e13('0x4d')][_0x2e13('0x60')]({'where':{'type':_0x2e13('0x7d'),'dialActive':!![],'dialMethod':_0x2e13('0x7e')},'attributes':['id'],'raw':!![]})[_0x2e13('0xe')](function(_0x3be5a8){if(_0x3be5a8&&_0x3be5a8[_0x2e13('0x3d')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2e13('0x7f')](_0x2e13('0x50'))},'VoiceQueueId':{'$in':_[_0x2e13('0x12')](_0x3be5a8,'id')},'$or':[{'UserId':null},{'UserId':_0x466858[_0x2e13('0x4d')]['id']}]}});}return 0x0;})[_0x2e13('0xe')](function(_0x29f599){if(!_[_0x2e13('0x59')](_0x29f599)&&_['isNumber'](_0x29f599)){return _0x2f79e2[_0x2e13('0xa')](0xc8)[_0x2e13('0xc')]({'contacts':_0x29f599});}else{logger['error'](_0x2e13('0x80'),_0x2e13('0x7c'),0x194,_0x2e13('0x81'));_0x2f79e2[_0x2e13('0x82')](0x194);}})[_0x2e13('0x39')](handleError(_0x2f79e2,null));};exports[_0x2e13('0x83')]=function(_0x373100,_0x4c897b){var _0x2ee8d0=shared['timezones'];var _0x1369ff=[];_[_0x2e13('0x12')](_0x2ee8d0,function(_0x42be7d){_0x1369ff[_0x2e13('0x84')]({'id':_0x42be7d['name'],'name':_0x42be7d[_0x2e13('0x10')],'utcOffset':_0x42be7d['utcOffset']});});return _0x4c897b['status'](0xc8)[_0x2e13('0xc')]({'tz':_0x1369ff});};exports[_0x2e13('0x85')]=function(_0x47d8fe,_0x12fbe3){var _0x56a094=shared[_0x2e13('0x86')];var _0x5d1927={};if(!_['isNil'](_0x56a094[_0x47d8fe[_0x2e13('0x3f')]['id']]))_0x5d1927=_0x56a094[_0x47d8fe[_0x2e13('0x3f')]['id']];return _0x12fbe3[_0x2e13('0xa')](0xc8)['json'](_0x5d1927);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c7c32e3..edb5273 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 _0x038b=['util','../../config/logger','api','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','phone'];(function(_0x6d0c9d,_0x1901be){var _0x26938e=function(_0x3643b4){while(--_0x3643b4){_0x6d0c9d['push'](_0x6d0c9d['shift']());}};_0x26938e(++_0x1901be);}(_0x038b,0x114));var _0xb038=function(_0x578a4e,_0x45671c){_0x578a4e=_0x578a4e-0x0;var _0x395d3c=_0x038b[_0x578a4e];return _0x395d3c;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xb038('0xb'),'fields':[_0xb038('0xb')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','api'];(function(_0x2e2ac2,_0x26a03d){var _0x5c03ec=function(_0x2c61e2){while(--_0x2c61e2){_0x2e2ac2['push'](_0x2e2ac2['shift']());}};_0x5c03ec(++_0x26a03d);}(_0xfcf0,0x138));var _0x0fcf=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0xfcf0[_0x349a9e];return _0x24c207;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xc')]},{'name':_0x0fcf('0xd'),'fields':['phone']},{'name':_0x0fcf('0xe'),'fields':[_0x0fcf('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 24b91dd..13701dd 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 _0x38c1=['CreateCmHopper','create','body','debug','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','CmContact','describe','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','push','includes','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','stringify','catch','message','error','ShowCmHopper','CmHopper','find'];(function(_0x221a0f,_0x3970f6){var _0x30309e=function(_0x2a6cf4){while(--_0x2a6cf4){_0x221a0f['push'](_0x221a0f['shift']());}};_0x30309e(++_0x3970f6);}(_0x38c1,0x195));var _0x138c=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x38c1[_0x41bdd4];return _0x5c03a6;};'use strict';var _=require(_0x138c('0x0'));var util=require(_0x138c('0x1'));var moment=require(_0x138c('0x2'));var BPromise=require(_0x138c('0x3'));var db=require(_0x138c('0x4'))['db'];var logger=require('../../config/logger')(_0x138c('0x5'));exports[_0x138c('0x6')]=function(_0x4787b8){var _0x294563=this;return new Promise(function(_0x402460,_0x40ef11){return db['CmHopper'][_0x138c('0x7')]({'raw':_0x4787b8['options']?_0x4787b8[_0x138c('0x8')][_0x138c('0x9')]===undefined?!![]:![]:!![],'where':_0x4787b8[_0x138c('0x8')]?_0x4787b8[_0x138c('0x8')][_0x138c('0xa')]||null:null,'attributes':_0x4787b8['options']?_0x4787b8[_0x138c('0x8')][_0x138c('0xb')]||null:null,'limit':_0x4787b8[_0x138c('0x8')]?_0x4787b8['options'][_0x138c('0xc')]||null:null,'include':_0x4787b8[_0x138c('0x8')]?_0x4787b8['options']['include']?_['map'](_0x4787b8['options'][_0x138c('0xd')],function(_0x5d11d3){return{'model':db[_0x5d11d3[_0x138c('0xe')]],'as':_0x5d11d3['as'],'attributes':_0x5d11d3[_0x138c('0xb')],'include':_0x5d11d3[_0x138c('0xd')]?_[_0x138c('0xf')](_0x5d11d3['include'],function(_0x24074c){return{'model':db[_0x24074c[_0x138c('0xe')]],'as':_0x24074c['as'],'attributes':_0x24074c[_0x138c('0xb')],'include':_0x24074c[_0x138c('0xd')]?_[_0x138c('0xf')](_0x24074c['include'],function(_0x42d13a){return{'model':db[_0x42d13a[_0x138c('0xe')]],'as':_0x42d13a['as'],'attributes':_0x42d13a['attributes']};}):[]};}):[]};}):[]:[]})[_0x138c('0x10')](function(_0x30ae3c){logger[_0x138c('0x11')]('GetCmHopper',_0x4787b8);logger['debug'](_0x138c('0x6'),_0x4787b8,JSON[_0x138c('0x12')](_0x30ae3c));_0x402460(_0x30ae3c);})[_0x138c('0x13')](function(_0x136b6c){logger['error'](_0x138c('0x6'),_0x136b6c[_0x138c('0x14')],_0x4787b8);_0x40ef11(_0x294563[_0x138c('0x15')](0x1f4,_0x136b6c[_0x138c('0x14')]));});});};exports[_0x138c('0x16')]=function(_0x7ae4c2){var _0x1f3e79=this;return new Promise(function(_0x2f854a,_0x81ff8c){return db[_0x138c('0x17')][_0x138c('0x18')]({'raw':_0x7ae4c2[_0x138c('0x8')]?_0x7ae4c2[_0x138c('0x8')][_0x138c('0x9')]===undefined?!![]:![]:!![],'where':_0x7ae4c2[_0x138c('0x8')]?_0x7ae4c2['options'][_0x138c('0xa')]||null:null,'attributes':_0x7ae4c2[_0x138c('0x8')]?_0x7ae4c2[_0x138c('0x8')][_0x138c('0xb')]||null:null,'include':_0x7ae4c2[_0x138c('0x8')]?_0x7ae4c2[_0x138c('0x8')][_0x138c('0xd')]?_['map'](_0x7ae4c2[_0x138c('0x8')][_0x138c('0xd')],function(_0x6755a3){return{'model':db[_0x6755a3[_0x138c('0xe')]],'as':_0x6755a3['as'],'attributes':_0x6755a3[_0x138c('0xb')],'include':_0x6755a3[_0x138c('0xd')]?_[_0x138c('0xf')](_0x6755a3[_0x138c('0xd')],function(_0x22211a){return{'model':db[_0x22211a[_0x138c('0xe')]],'as':_0x22211a['as'],'attributes':_0x22211a[_0x138c('0xb')],'include':_0x22211a[_0x138c('0xd')]?_[_0x138c('0xf')](_0x22211a[_0x138c('0xd')],function(_0x2dc1ac){return{'model':db[_0x2dc1ac[_0x138c('0xe')]],'as':_0x2dc1ac['as'],'attributes':_0x2dc1ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x138c('0x10')](function(_0xc1910d){logger['info'](_0x138c('0x16'),_0x7ae4c2);logger['debug']('ShowCmHopper',_0x7ae4c2,JSON[_0x138c('0x12')](_0xc1910d));_0x2f854a(_0xc1910d);})[_0x138c('0x13')](function(_0x423830){logger[_0x138c('0x15')]('ShowCmHopper',_0x423830[_0x138c('0x14')],_0x7ae4c2);_0x81ff8c(_0x1f3e79[_0x138c('0x15')](0x1f4,_0x423830[_0x138c('0x14')]));});});};exports[_0x138c('0x19')]=function(_0x377c65){var _0x3c6301=this;return new Promise(function(_0x3da0f4,_0x1934f){return db['CmHopper'][_0x138c('0x1a')](_0x377c65[_0x138c('0x1b')],{'raw':_0x377c65[_0x138c('0x8')]?_0x377c65[_0x138c('0x8')]['raw']===undefined?!![]:![]:!![]})[_0x138c('0x10')](function(_0x124dd8){logger[_0x138c('0x11')](_0x138c('0x19'),_0x377c65);logger[_0x138c('0x1c')](_0x138c('0x19'),_0x377c65,JSON[_0x138c('0x12')](_0x124dd8));_0x3da0f4(_0x124dd8);})[_0x138c('0x13')](function(_0x2ce62b){logger[_0x138c('0x15')](_0x138c('0x19'),_0x2ce62b[_0x138c('0x14')],_0x377c65);_0x1934f(_0x3c6301[_0x138c('0x15')](0x1f4,_0x2ce62b[_0x138c('0x14')]));});});};exports[_0x138c('0x1d')]=function(_0x2219f3){var _0x1e9494=this;return new Promise(function(_0x72241a,_0x386487){return db[_0x138c('0x17')][_0x138c('0x1e')](_0x2219f3['body'],{'raw':_0x2219f3['options']?_0x2219f3[_0x138c('0x8')][_0x138c('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2219f3[_0x138c('0x8')]?_0x2219f3[_0x138c('0x8')][_0x138c('0xa')]||null:null,'attributes':_0x2219f3['options']?_0x2219f3[_0x138c('0x8')]['attributes']||null:null,'limit':_0x2219f3[_0x138c('0x8')]?_0x2219f3[_0x138c('0x8')][_0x138c('0xc')]||null:null})['then'](function(_0x45b6de){logger[_0x138c('0x11')](_0x138c('0x1d'),_0x2219f3);logger[_0x138c('0x11')](_0x138c('0x1f'),JSON[_0x138c('0x12')](_0x2219f3[_0x138c('0x8')]['where']),_0x2219f3[_0x138c('0x1b')][_0x138c('0x20')]);logger[_0x138c('0x1c')](_0x138c('0x1d'),_0x2219f3,JSON[_0x138c('0x12')](_0x45b6de));_0x72241a(_0x45b6de);})['catch'](function(_0x34b2b5){logger[_0x138c('0x15')]('UpdateCmHopper',_0x34b2b5[_0x138c('0x14')],_0x2219f3);_0x386487(_0x1e9494[_0x138c('0x15')](0x1f4,_0x34b2b5[_0x138c('0x14')]));});});};exports['DestroyCmHopper']=function(_0x3bee0a){var _0x4f28a1=this;return new Promise(function(_0x18631c,_0x494f1e){return db['CmHopper'][_0x138c('0x21')]({'where':_0x3bee0a[_0x138c('0x8')]?_0x3bee0a[_0x138c('0x8')][_0x138c('0xa')]||null:null})[_0x138c('0x10')](function(_0x5e2078){logger[_0x138c('0x11')]('DestroyCmHopper',_0x3bee0a);logger[_0x138c('0x1c')](_0x138c('0x22'),_0x3bee0a,JSON[_0x138c('0x12')](_0x5e2078));_0x18631c(_0x5e2078);})['catch'](function(_0x559e93){logger[_0x138c('0x15')]('DestroyCmHopper',_0x559e93[_0x138c('0x14')],_0x3bee0a);_0x494f1e(_0x4f28a1['error'](0x1f4,_0x559e93['message']));});});};exports['GetContactDialer']=function(_0x2cf60e){var _0x3163d1=this;return new Promise(function(_0x5b5d14,_0x1e8aff){return db[_0x138c('0x23')][_0x138c('0x24')]()[_0x138c('0x10')](function(_0x1555e2){return db['sequelize']['transaction'](function(_0x5425bc){return db[_0x138c('0x17')][_0x138c('0x7')]({'where':_0x2cf60e[_0x138c('0x8')]?_0x2cf60e[_0x138c('0x8')][_0x138c('0xa')]||null:null,'attributes':_0x2cf60e['options']?_0x2cf60e[_0x138c('0x8')][_0x138c('0xb')]||null:null,'limit':_0x2cf60e[_0x138c('0x8')]?_0x2cf60e[_0x138c('0x8')][_0x138c('0xc')]||null:null,'order':_0x2cf60e[_0x138c('0x8')]?_0x2cf60e[_0x138c('0x8')][_0x138c('0x25')]||null:null,'transaction':_0x5425bc,'lock':_0x5425bc[_0x138c('0x26')][_0x138c('0x27')],'include':[{'model':db[_0x138c('0x23')],'as':_0x138c('0x28'),'attributes':_[_0x138c('0x29')](_0x1555e2)},{'model':db[_0x138c('0x2a')],'as':_0x138c('0x2b'),'attributes':['id',_0x138c('0x2c'),_0x138c('0x2d')]}]})[_0x138c('0x10')](function(_0x5964f7){var _0x82c9ad=[];var _0x4fbdec=[];for(var _0x52a5ab=0x0;_0x52a5ab<_0x5964f7['length'];_0x52a5ab+=0x1){var _0x26e56=_0x5964f7[_0x52a5ab]['UserId'];if(_0x26e56===null){_0x82c9ad[_0x138c('0x2e')](_0x5964f7[_0x52a5ab][_0x138c('0x1e')](_0x2cf60e[_0x138c('0x1b')],{'transaction':_0x5425bc}));}else if(!_0x4fbdec[_0x138c('0x2f')](_0x26e56)){_0x4fbdec[_0x138c('0x2e')](_0x26e56);_0x82c9ad[_0x138c('0x2e')](_0x5964f7[_0x52a5ab][_0x138c('0x1e')](_0x2cf60e[_0x138c('0x1b')],{'transaction':_0x5425bc}));}}return BPromise[_0x138c('0x30')](_0x82c9ad);});})[_0x138c('0x10')](function(_0x17adca){logger[_0x138c('0x11')](_0x138c('0x31'),_0x2cf60e);if(_0x17adca[_0x138c('0x32')]>0x0){logger[_0x138c('0x11')](_0x138c('0x33'),_0x17adca[0x0][_0x138c('0x34')]['id'],_0x17adca[0x0][_0x138c('0x34')][_0x138c('0x35')],_0x17adca[0x0][_0x138c('0x34')][_0x138c('0x20')]);}logger[_0x138c('0x1c')](_0x138c('0x31'),_0x2cf60e,JSON[_0x138c('0x12')](_0x17adca));_0x5b5d14(_0x17adca);})[_0x138c('0x13')](function(_0x5cc8c8){logger[_0x138c('0x15')](_0x138c('0x31'),_0x5cc8c8['message'],_0x2cf60e);_0x1e8aff(_0x3163d1[_0x138c('0x15')](0x1f4,_0x5cc8c8[_0x138c('0x14')]));});});});};exports[_0x138c('0x36')]=function(_0xff178f){var _0xce5db7=this;return new Promise(function(_0x29f0ae,_0x310ee8){return db[_0x138c('0x37')][_0x138c('0x38')](function(_0x4ac8f1){return db[_0x138c('0x39')][_0x138c('0x1a')](_0xff178f[_0x138c('0x1b')],{'raw':_0xff178f['options']?_0xff178f[_0x138c('0x8')][_0x138c('0x9')]===undefined?!![]:![]:!![],'transaction':_0x4ac8f1})['then'](function(){logger[_0x138c('0x11')](_0x138c('0x3a'),JSON[_0x138c('0x12')](_0xff178f[_0x138c('0x8')][_0x138c('0xa')]),_0xff178f[_0x138c('0x8')][_0x138c('0xa')][_0x138c('0x20')]);return db[_0x138c('0x17')]['destroy']({'where':_0xff178f[_0x138c('0x8')]?_0xff178f[_0x138c('0x8')][_0x138c('0xa')]||null:null,'transaction':_0x4ac8f1});});})[_0x138c('0x10')](function(_0x25f01e){logger[_0x138c('0x11')](_0x138c('0x36'),_0xff178f);logger[_0x138c('0x1c')](_0x138c('0x36'),_0xff178f,JSON[_0x138c('0x12')](_0x25f01e));_0x29f0ae(_0x25f01e);})[_0x138c('0x13')](function(_0x2ff71b){logger[_0x138c('0x15')](_0x138c('0x36'),_0x2ff71b[_0x138c('0x14')],_0xff178f);_0x310ee8(_0xce5db7['error'](0x1f4,_0x2ff71b[_0x138c('0x14')]));});});};exports[_0x138c('0x3b')]=function(_0x3f23fe){var _0x3a64f2=this;return new Promise(function(_0x1f36f0,_0xad68c3){return db['CmHopper']['findAll']({'raw':_0x3f23fe['options']?_0x3f23fe[_0x138c('0x8')][_0x138c('0x9')]===undefined?!![]:![]:!![],'where':_0x3f23fe[_0x138c('0x8')]?_0x3f23fe[_0x138c('0x8')][_0x138c('0xa')]||null:null,'attributes':[[db[_0x138c('0x37')]['fn']('COUNT',db[_0x138c('0x37')]['fn']('IF',db['sequelize'][_0x138c('0x3c')](_0x138c('0x3d')+util[_0x138c('0x3e')](_0x138c('0x3f'),moment()[_0x138c('0x3e')](_0x138c('0x40')))+_0x138c('0x41')))),_0x138c('0x42')]]})['then'](function(_0x3d2b27){logger['info']('CountReScheduled',_0x3f23fe);logger['debug'](_0x138c('0x3b'),_0x3f23fe,JSON[_0x138c('0x12')](_0x3d2b27));_0x1f36f0(_0x3d2b27);})[_0x138c('0x13')](function(_0x144636){logger[_0x138c('0x15')](_0x138c('0x3b'),_0x144636['message'],_0x3f23fe);_0xad68c3(_0x3a64f2[_0x138c('0x15')](0x1f4,_0x144636[_0x138c('0x14')]));});});};exports[_0x138c('0x43')]=function(_0x2e34a8){var _0x2b6e19=this;return new Promise(function(_0x2add1e,_0x1fd749){return db['CmContact'][_0x138c('0x24')]()['then'](function(){return db[_0x138c('0x37')][_0x138c('0x38')](function(_0x490f71){return db[_0x138c('0x17')][_0x138c('0x7')]({'where':_0x2e34a8[_0x138c('0x8')]?_0x2e34a8[_0x138c('0x8')][_0x138c('0xa')]||null:null,'attributes':_0x2e34a8[_0x138c('0x8')]?_0x2e34a8['options']['attributes']||null:null,'limit':0x1,'order':_0x2e34a8[_0x138c('0x8')]?_0x2e34a8[_0x138c('0x8')][_0x138c('0x25')]||null:null,'group':db[_0x138c('0x17')][_0x138c('0x44')],'transaction':_0x490f71,'lock':_0x490f71['LOCK'][_0x138c('0x27')],'include':_0x2e34a8[_0x138c('0x8')]?_0x2e34a8[_0x138c('0x8')]['include']?_[_0x138c('0xf')](_0x2e34a8[_0x138c('0x8')][_0x138c('0xd')],function(_0x445f4d){return{'model':db[_0x445f4d[_0x138c('0xe')]],'as':_0x445f4d['as'],'attributes':_0x445f4d['attributes'],'include':_0x445f4d[_0x138c('0xd')]?_[_0x138c('0xf')](_0x445f4d['include'],function(_0x3968f1){return{'model':db[_0x3968f1[_0x138c('0xe')]],'as':_0x3968f1['as'],'attributes':_0x3968f1[_0x138c('0xb')],'include':_0x3968f1[_0x138c('0xd')]?_[_0x138c('0xf')](_0x3968f1[_0x138c('0xd')],function(_0x4a9403){return{'model':db[_0x4a9403['model']],'as':_0x4a9403['as'],'attributes':_0x4a9403['attributes']};}):[]};}):[]};}):[]:[]})[_0x138c('0x10')](function(_0x3f89fb){var _0x1c02cf=[];for(var _0xc0d35=0x0;_0xc0d35<_0x3f89fb[_0x138c('0x32')];_0xc0d35+=0x1){_0x1c02cf[_0x138c('0x2e')](_0x3f89fb[_0xc0d35]['update'](_0x2e34a8[_0x138c('0x1b')],{'transaction':_0x490f71}));}return BPromise[_0x138c('0x30')](_0x1c02cf);});})[_0x138c('0x10')](function(_0x580590){logger[_0x138c('0x11')](_0x138c('0x43'),_0x2e34a8);logger[_0x138c('0x1c')](_0x138c('0x43'),_0x2e34a8,JSON[_0x138c('0x12')](_0x580590));_0x2add1e(_0x580590);})['catch'](function(_0x328a80){logger[_0x138c('0x15')](_0x138c('0x43'),_0x328a80[_0x138c('0x14')],_0x2e34a8);_0x1fd749(_0x2b6e19[_0x138c('0x15')](0x1f4,_0x328a80['message']));});});});};exports[_0x138c('0x45')]=function(_0x236068){var _0x5f0a8a=this;return new Promise(function(_0x293824,_0x97bcc6){db[_0x138c('0x23')][_0x138c('0x24')]()['then'](function(_0x54d1fc){return db[_0x138c('0x17')][_0x138c('0x7')]({'raw':_0x236068['options']?_0x236068[_0x138c('0x8')][_0x138c('0x9')]===undefined?!![]:![]:!![],'where':_0x236068[_0x138c('0x8')]?_0x236068[_0x138c('0x8')]['where']||null:null,'attributes':_0x236068[_0x138c('0x8')]?_0x236068[_0x138c('0x8')][_0x138c('0xb')]||null:null,'limit':_0x236068[_0x138c('0x8')]?_0x236068[_0x138c('0x8')][_0x138c('0xc')]||null:null,'include':_0x236068[_0x138c('0x8')]?_0x236068['options'][_0x138c('0xd')]?_[_0x138c('0xf')](_0x236068[_0x138c('0x8')][_0x138c('0xd')],function(_0x14c6fb){return{'model':db[_0x14c6fb[_0x138c('0xe')]],'as':_0x14c6fb['as'],'attributes':_0x14c6fb['as']==='Contact'?_['keys'](_0x54d1fc):_0x14c6fb['attributes'],'include':_0x14c6fb[_0x138c('0xd')]?_[_0x138c('0xf')](_0x14c6fb[_0x138c('0xd')],function(_0x23f2ed){return{'model':db[_0x23f2ed[_0x138c('0xe')]],'as':_0x23f2ed['as'],'attributes':_0x23f2ed[_0x138c('0xb')],'include':_0x23f2ed['include']?_[_0x138c('0xf')](_0x23f2ed[_0x138c('0xd')],function(_0x3f6fcd){return{'model':db[_0x3f6fcd['model']],'as':_0x3f6fcd['as'],'attributes':_0x3f6fcd[_0x138c('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x346495){logger[_0x138c('0x11')](_0x138c('0x6'),_0x236068);logger[_0x138c('0x1c')](_0x138c('0x6'),_0x236068,JSON[_0x138c('0x12')](_0x346495));_0x293824(_0x346495);})[_0x138c('0x13')](function(_0x5b235b){logger[_0x138c('0x15')](_0x138c('0x6'),_0x5b235b[_0x138c('0x14')],_0x236068);_0x97bcc6(_0x5f0a8a['error'](0x1f4,_0x5b235b[_0x138c('0x14')]));});});});};exports[_0x138c('0x46')]=function(_0x136fb2){var _0x57f7a3=this;return new Promise(function(_0x517d2d,_0x5a1994){return db[_0x138c('0x23')][_0x138c('0x47')]({'raw':!![],'where':{'phone':_0x136fb2[_0x138c('0x8')][_0x138c('0xa')][_0x138c('0x48')]},'attributes':['id',_0x138c('0x49')],'order':[['id',_0x138c('0x4a')]]})[_0x138c('0x10')](function(_0x3823ae){logger[_0x138c('0x11')](_0x138c('0x4b'),_0x136fb2);logger[_0x138c('0x1c')](_0x138c('0x4b'),_0x136fb2,JSON[_0x138c('0x12')](_0x3823ae));_0x517d2d(_0x3823ae);})[_0x138c('0x13')](function(_0x10bf51){logger['error']('getContactByPhone',_0x10bf51['message'],_0x136fb2);_0x5a1994(_0x57f7a3[_0x138c('0x15')](0x1f4,_0x10bf51[_0x138c('0x14')]));});});};exports['ResetActiveCalls']=function(_0x344204){var _0xf0a7=this;return new Promise(function(_0x298ecc,_0x3c6139){return db[_0x138c('0x37')][_0x138c('0x38')](function(_0x4fdf1a){var _0x3f8308=_0x344204['options']&&_0x344204['options'][_0x138c('0xa')]?_0x344204[_0x138c('0x8')][_0x138c('0xa')]:{};return db[_0x138c('0x17')][_0x138c('0x1e')](_0x344204['body'],{'where':_0x3f8308,'transaction':_0x4fdf1a})[_0x138c('0x10')](function(_0x38f00b){logger[_0x138c('0x11')](_0x138c('0x4c'),_0x344204);logger[_0x138c('0x1c')](_0x138c('0x4c'),_0x344204,JSON[_0x138c('0x12')](_0x38f00b));_0x298ecc(_0x38f00b);})[_0x138c('0x13')](function(_0x470a31){logger[_0x138c('0x15')](_0x138c('0x4c'),_0x470a31[_0x138c('0x14')],_0x344204);_0x3c6139(_0xf0a7[_0x138c('0x15')](0x1f4,_0x470a31[_0x138c('0x14')]));});});});};exports[_0x138c('0x4d')]=function(_0x1de277){var _0x48aee6=this;var _0x1b34ec=_0x1de277[_0x138c('0x1b')]['where'][_0x138c('0x4e')];var _0x446333=_0x1de277['body'][_0x138c('0xa')][_0x138c('0x4f')];var _0x2b3a44=_0x1de277[_0x138c('0x1b')]['where'][_0x138c('0x50')];return new Promise(function(_0x41091b,_0x143576){return db[_0x138c('0x17')][_0x138c('0x7')]({'where':{'voiceQueueId':{'$in':_0x1b34ec},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x138c('0x37')][_0x138c('0x3c')](_0x138c('0x51')+_0x446333+_0x138c('0x52')),'$gt':db[_0x138c('0x37')][_0x138c('0x3c')](_0x138c('0x53'))}},'UserId':{'$in':_0x2b3a44}},'include':[{'model':db['CmContact'],'as':_0x138c('0x28')},{'model':db[_0x138c('0x2a')],'as':_0x138c('0x2b'),'attributes':['id',_0x138c('0x2c'),_0x138c('0x2d')]},{'model':db[_0x138c('0x54')],'as':_0x138c('0x55')}]})[_0x138c('0x10')](function(_0x815272){if(_0x815272['length']>0x0){return db['sequelize'][_0x138c('0x38')](function(_0x57eb7b){return db[_0x138c('0x17')]['update']({'recallmeNotifiedDate':db['sequelize'][_0x138c('0x3c')](_0x138c('0x53'))},{'where':{'id':{'$in':_[_0x138c('0xf')](_0x815272,'id')}},'transaction':_0x57eb7b})[_0x138c('0x10')](function(){_0x41091b(_0x815272);})[_0x138c('0x13')](function(_0x58e557){logger[_0x138c('0x15')](_0x138c('0x4d'),_0x58e557['message'],_0x1de277);_0x143576(_0x48aee6['error'](0x1f4,_0x58e557[_0x138c('0x14')]));});})[_0x138c('0x13')](function(_0x36cb6e){logger['error'](_0x138c('0x4d'),_0x36cb6e[_0x138c('0x14')],_0x1de277);_0x143576(_0x48aee6[_0x138c('0x15')](0x1f4,_0x36cb6e['message']));});}else{_0x41091b(_0x815272);}});});}; \ No newline at end of file +var _0x1a8b=['UserId','push','all','length','dataValues','ContactId','MoveContactManagedDialer','sequelize','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','lodash','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','CreateCmHopper','raw','UpdateCmHopper','update','body','limit','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause'];(function(_0x18cec0,_0x55feaf){var _0x53c59a=function(_0x521285){while(--_0x521285){_0x18cec0['push'](_0x18cec0['shift']());}};_0x53c59a(++_0x55feaf);}(_0x1a8b,0xbd));var _0xb1a8=function(_0x1d7e72,_0x2af5ba){_0x1d7e72=_0x1d7e72-0x0;var _0x267b52=_0x1a8b[_0x1d7e72];return _0x267b52;};'use strict';var _=require(_0xb1a8('0x0'));var util=require('util');var moment=require(_0xb1a8('0x1'));var BPromise=require('bluebird');var db=require(_0xb1a8('0x2'))['db'];var logger=require(_0xb1a8('0x3'))(_0xb1a8('0x4'));exports[_0xb1a8('0x5')]=function(_0x3220f5){var _0x413f20=this;return new Promise(function(_0x4501e3,_0x564c60){return db[_0xb1a8('0x6')][_0xb1a8('0x7')]({'raw':_0x3220f5[_0xb1a8('0x8')]?_0x3220f5['options']['raw']===undefined?!![]:![]:!![],'where':_0x3220f5[_0xb1a8('0x8')]?_0x3220f5[_0xb1a8('0x8')][_0xb1a8('0x9')]||null:null,'attributes':_0x3220f5[_0xb1a8('0x8')]?_0x3220f5[_0xb1a8('0x8')][_0xb1a8('0xa')]||null:null,'limit':_0x3220f5[_0xb1a8('0x8')]?_0x3220f5[_0xb1a8('0x8')]['limit']||null:null,'include':_0x3220f5[_0xb1a8('0x8')]?_0x3220f5[_0xb1a8('0x8')][_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x3220f5[_0xb1a8('0x8')]['include'],function(_0x7bf787){return{'model':db[_0x7bf787[_0xb1a8('0xd')]],'as':_0x7bf787['as'],'attributes':_0x7bf787[_0xb1a8('0xa')],'include':_0x7bf787[_0xb1a8('0xb')]?_['map'](_0x7bf787['include'],function(_0x10666b){return{'model':db[_0x10666b[_0xb1a8('0xd')]],'as':_0x10666b['as'],'attributes':_0x10666b[_0xb1a8('0xa')],'include':_0x10666b[_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x10666b['include'],function(_0x1bdf03){return{'model':db[_0x1bdf03[_0xb1a8('0xd')]],'as':_0x1bdf03['as'],'attributes':_0x1bdf03[_0xb1a8('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb1a8('0xe')](function(_0x2546d9){logger[_0xb1a8('0xf')](_0xb1a8('0x5'),_0x3220f5);logger[_0xb1a8('0x10')](_0xb1a8('0x5'),_0x3220f5,JSON[_0xb1a8('0x11')](_0x2546d9));_0x4501e3(_0x2546d9);})[_0xb1a8('0x12')](function(_0x5a7839){logger['error']('GetCmHopper',_0x5a7839[_0xb1a8('0x13')],_0x3220f5);_0x564c60(_0x413f20[_0xb1a8('0x14')](0x1f4,_0x5a7839[_0xb1a8('0x13')]));});});};exports[_0xb1a8('0x15')]=function(_0x5275b5){var _0x23b97e=this;return new Promise(function(_0x1c13d9,_0x2215e9){return db[_0xb1a8('0x6')][_0xb1a8('0x16')]({'raw':_0x5275b5[_0xb1a8('0x8')]?_0x5275b5[_0xb1a8('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x5275b5['options']?_0x5275b5[_0xb1a8('0x8')][_0xb1a8('0x9')]||null:null,'attributes':_0x5275b5[_0xb1a8('0x8')]?_0x5275b5[_0xb1a8('0x8')][_0xb1a8('0xa')]||null:null,'include':_0x5275b5['options']?_0x5275b5['options'][_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x5275b5[_0xb1a8('0x8')][_0xb1a8('0xb')],function(_0xb095ce){return{'model':db[_0xb095ce[_0xb1a8('0xd')]],'as':_0xb095ce['as'],'attributes':_0xb095ce[_0xb1a8('0xa')],'include':_0xb095ce[_0xb1a8('0xb')]?_['map'](_0xb095ce[_0xb1a8('0xb')],function(_0x2d1c02){return{'model':db[_0x2d1c02[_0xb1a8('0xd')]],'as':_0x2d1c02['as'],'attributes':_0x2d1c02[_0xb1a8('0xa')],'include':_0x2d1c02['include']?_['map'](_0x2d1c02['include'],function(_0xf59022){return{'model':db[_0xf59022[_0xb1a8('0xd')]],'as':_0xf59022['as'],'attributes':_0xf59022[_0xb1a8('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49b5b6){logger[_0xb1a8('0xf')]('ShowCmHopper',_0x5275b5);logger['debug'](_0xb1a8('0x15'),_0x5275b5,JSON[_0xb1a8('0x11')](_0x49b5b6));_0x1c13d9(_0x49b5b6);})[_0xb1a8('0x12')](function(_0x1ff431){logger[_0xb1a8('0x14')](_0xb1a8('0x15'),_0x1ff431[_0xb1a8('0x13')],_0x5275b5);_0x2215e9(_0x23b97e['error'](0x1f4,_0x1ff431[_0xb1a8('0x13')]));});});};exports[_0xb1a8('0x17')]=function(_0x425756){var _0x25b3f0=this;return new Promise(function(_0x523ed1,_0x22ae21){return db[_0xb1a8('0x6')]['create'](_0x425756['body'],{'raw':_0x425756[_0xb1a8('0x8')]?_0x425756[_0xb1a8('0x8')][_0xb1a8('0x18')]===undefined?!![]:![]:!![]})[_0xb1a8('0xe')](function(_0x4d2666){logger[_0xb1a8('0xf')](_0xb1a8('0x17'),_0x425756);logger[_0xb1a8('0x10')](_0xb1a8('0x17'),_0x425756,JSON[_0xb1a8('0x11')](_0x4d2666));_0x523ed1(_0x4d2666);})[_0xb1a8('0x12')](function(_0x1ca7ad){logger[_0xb1a8('0x14')](_0xb1a8('0x17'),_0x1ca7ad[_0xb1a8('0x13')],_0x425756);_0x22ae21(_0x25b3f0[_0xb1a8('0x14')](0x1f4,_0x1ca7ad['message']));});});};exports[_0xb1a8('0x19')]=function(_0x5b4f21){var _0x995b4=this;return new Promise(function(_0x586549,_0x852533){return db[_0xb1a8('0x6')][_0xb1a8('0x1a')](_0x5b4f21[_0xb1a8('0x1b')],{'raw':_0x5b4f21[_0xb1a8('0x8')]?_0x5b4f21['options'][_0xb1a8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b4f21[_0xb1a8('0x8')]?_0x5b4f21[_0xb1a8('0x8')][_0xb1a8('0x9')]||null:null,'attributes':_0x5b4f21[_0xb1a8('0x8')]?_0x5b4f21[_0xb1a8('0x8')]['attributes']||null:null,'limit':_0x5b4f21['options']?_0x5b4f21['options'][_0xb1a8('0x1c')]||null:null})[_0xb1a8('0xe')](function(_0x161e91){logger[_0xb1a8('0xf')](_0xb1a8('0x19'),_0x5b4f21);logger[_0xb1a8('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xb1a8('0x11')](_0x5b4f21[_0xb1a8('0x8')][_0xb1a8('0x9')]),_0x5b4f21['body'][_0xb1a8('0x1d')]);logger['debug'](_0xb1a8('0x19'),_0x5b4f21,JSON['stringify'](_0x161e91));_0x586549(_0x161e91);})[_0xb1a8('0x12')](function(_0x28c718){logger[_0xb1a8('0x14')]('UpdateCmHopper',_0x28c718[_0xb1a8('0x13')],_0x5b4f21);_0x852533(_0x995b4[_0xb1a8('0x14')](0x1f4,_0x28c718[_0xb1a8('0x13')]));});});};exports['DestroyCmHopper']=function(_0x3c132d){var _0x4a839c=this;return new Promise(function(_0x8c61e0,_0x971ce6){return db[_0xb1a8('0x6')][_0xb1a8('0x1e')]({'where':_0x3c132d[_0xb1a8('0x8')]?_0x3c132d[_0xb1a8('0x8')][_0xb1a8('0x9')]||null:null})['then'](function(_0x26d8f4){logger[_0xb1a8('0xf')]('DestroyCmHopper',_0x3c132d);logger[_0xb1a8('0x10')](_0xb1a8('0x1f'),_0x3c132d,JSON[_0xb1a8('0x11')](_0x26d8f4));_0x8c61e0(_0x26d8f4);})[_0xb1a8('0x12')](function(_0x47ffec){logger[_0xb1a8('0x14')]('DestroyCmHopper',_0x47ffec['message'],_0x3c132d);_0x971ce6(_0x4a839c[_0xb1a8('0x14')](0x1f4,_0x47ffec[_0xb1a8('0x13')]));});});};exports[_0xb1a8('0x20')]=function(_0x2150c0){var _0xad948=this;return new Promise(function(_0xd0b786,_0x1cefe6){return db[_0xb1a8('0x21')][_0xb1a8('0x22')]()[_0xb1a8('0xe')](function(_0x3b2a2c){return db['sequelize'][_0xb1a8('0x23')](function(_0x51afcd){return db[_0xb1a8('0x6')]['findAll']({'where':_0x2150c0[_0xb1a8('0x8')]?_0x2150c0[_0xb1a8('0x8')][_0xb1a8('0x9')]||null:null,'attributes':_0x2150c0[_0xb1a8('0x8')]?_0x2150c0[_0xb1a8('0x8')]['attributes']||null:null,'limit':_0x2150c0['options']?_0x2150c0[_0xb1a8('0x8')][_0xb1a8('0x1c')]||null:null,'order':_0x2150c0[_0xb1a8('0x8')]?_0x2150c0[_0xb1a8('0x8')][_0xb1a8('0x24')]||null:null,'transaction':_0x51afcd,'lock':_0x51afcd[_0xb1a8('0x25')][_0xb1a8('0x26')],'include':[{'model':db[_0xb1a8('0x21')],'as':_0xb1a8('0x27'),'attributes':_[_0xb1a8('0x28')](_0x3b2a2c)},{'model':db[_0xb1a8('0x29')],'as':_0xb1a8('0x2a'),'attributes':['id',_0xb1a8('0x2b'),_0xb1a8('0x2c')]}]})[_0xb1a8('0xe')](function(_0x134804){var _0x99df5d=[];var _0x37abdf=[];for(var _0x5218ee=0x0;_0x5218ee<_0x134804['length'];_0x5218ee+=0x1){var _0x38516c=_0x134804[_0x5218ee][_0xb1a8('0x2d')];if(_0x38516c===null){_0x99df5d['push'](_0x134804[_0x5218ee][_0xb1a8('0x1a')](_0x2150c0[_0xb1a8('0x1b')],{'transaction':_0x51afcd}));}else if(!_0x37abdf['includes'](_0x38516c)){_0x37abdf[_0xb1a8('0x2e')](_0x38516c);_0x99df5d[_0xb1a8('0x2e')](_0x134804[_0x5218ee][_0xb1a8('0x1a')](_0x2150c0[_0xb1a8('0x1b')],{'transaction':_0x51afcd}));}}return BPromise[_0xb1a8('0x2f')](_0x99df5d);});})[_0xb1a8('0xe')](function(_0x4ae2bf){logger['info'](_0xb1a8('0x20'),_0x2150c0);if(_0x4ae2bf[_0xb1a8('0x30')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x4ae2bf[0x0][_0xb1a8('0x31')]['id'],_0x4ae2bf[0x0][_0xb1a8('0x31')][_0xb1a8('0x32')],_0x4ae2bf[0x0]['dataValues']['active']);}logger['debug']('GetContactDialer',_0x2150c0,JSON[_0xb1a8('0x11')](_0x4ae2bf));_0xd0b786(_0x4ae2bf);})[_0xb1a8('0x12')](function(_0x172afb){logger[_0xb1a8('0x14')](_0xb1a8('0x20'),_0x172afb[_0xb1a8('0x13')],_0x2150c0);_0x1cefe6(_0xad948[_0xb1a8('0x14')](0x1f4,_0x172afb[_0xb1a8('0x13')]));});});});};exports[_0xb1a8('0x33')]=function(_0x1e0518){var _0xded953=this;return new Promise(function(_0x143c62,_0x1ee7fd){return db[_0xb1a8('0x34')][_0xb1a8('0x23')](function(_0x3e7cd6){return db['CmHopperFinal'][_0xb1a8('0x35')](_0x1e0518[_0xb1a8('0x1b')],{'raw':_0x1e0518[_0xb1a8('0x8')]?_0x1e0518[_0xb1a8('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x3e7cd6})['then'](function(){logger[_0xb1a8('0xf')](_0xb1a8('0x36'),JSON['stringify'](_0x1e0518[_0xb1a8('0x8')][_0xb1a8('0x9')]),_0x1e0518[_0xb1a8('0x8')]['where']['active']);return db[_0xb1a8('0x6')][_0xb1a8('0x1e')]({'where':_0x1e0518[_0xb1a8('0x8')]?_0x1e0518['options'][_0xb1a8('0x9')]||null:null,'transaction':_0x3e7cd6});});})['then'](function(_0x2f1f41){logger[_0xb1a8('0xf')](_0xb1a8('0x33'),_0x1e0518);logger[_0xb1a8('0x10')](_0xb1a8('0x33'),_0x1e0518,JSON[_0xb1a8('0x11')](_0x2f1f41));_0x143c62(_0x2f1f41);})[_0xb1a8('0x12')](function(_0x1a3ee8){logger[_0xb1a8('0x14')](_0xb1a8('0x33'),_0x1a3ee8[_0xb1a8('0x13')],_0x1e0518);_0x1ee7fd(_0xded953[_0xb1a8('0x14')](0x1f4,_0x1a3ee8['message']));});});};exports[_0xb1a8('0x37')]=function(_0x4f68f2){var _0x232896=this;return new Promise(function(_0xd443b2,_0x418073){return db[_0xb1a8('0x6')][_0xb1a8('0x7')]({'raw':_0x4f68f2[_0xb1a8('0x8')]?_0x4f68f2[_0xb1a8('0x8')][_0xb1a8('0x18')]===undefined?!![]:![]:!![],'where':_0x4f68f2['options']?_0x4f68f2[_0xb1a8('0x8')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xb1a8('0x38'),db[_0xb1a8('0x34')]['fn']('IF',db[_0xb1a8('0x34')][_0xb1a8('0x39')]('`scheduledat`\x20>=\x20'+util[_0xb1a8('0x3a')]('\x22%s\x22',moment()[_0xb1a8('0x3a')](_0xb1a8('0x3b')))+_0xb1a8('0x3c')))),_0xb1a8('0x3d')]]})[_0xb1a8('0xe')](function(_0x52e7e2){logger[_0xb1a8('0xf')]('CountReScheduled',_0x4f68f2);logger[_0xb1a8('0x10')](_0xb1a8('0x37'),_0x4f68f2,JSON[_0xb1a8('0x11')](_0x52e7e2));_0xd443b2(_0x52e7e2);})[_0xb1a8('0x12')](function(_0xc4d567){logger['error'](_0xb1a8('0x37'),_0xc4d567[_0xb1a8('0x13')],_0x4f68f2);_0x418073(_0x232896[_0xb1a8('0x14')](0x1f4,_0xc4d567['message']));});});};exports['GetContactRecallMe']=function(_0x176d26){var _0xa08b60=this;return new Promise(function(_0x5668fd,_0x5907e7){return db[_0xb1a8('0x21')]['describe']()[_0xb1a8('0xe')](function(){return db[_0xb1a8('0x34')]['transaction'](function(_0x1d9926){return db['CmHopper'][_0xb1a8('0x7')]({'where':_0x176d26[_0xb1a8('0x8')]?_0x176d26['options'][_0xb1a8('0x9')]||null:null,'attributes':_0x176d26[_0xb1a8('0x8')]?_0x176d26[_0xb1a8('0x8')][_0xb1a8('0xa')]||null:null,'limit':0x1,'order':_0x176d26[_0xb1a8('0x8')]?_0x176d26[_0xb1a8('0x8')][_0xb1a8('0x24')]||null:null,'group':db['CmHopper'][_0xb1a8('0x2d')],'transaction':_0x1d9926,'lock':_0x1d9926[_0xb1a8('0x25')][_0xb1a8('0x26')],'include':_0x176d26[_0xb1a8('0x8')]?_0x176d26[_0xb1a8('0x8')][_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x176d26['options'][_0xb1a8('0xb')],function(_0x1cac91){return{'model':db[_0x1cac91[_0xb1a8('0xd')]],'as':_0x1cac91['as'],'attributes':_0x1cac91['attributes'],'include':_0x1cac91[_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x1cac91[_0xb1a8('0xb')],function(_0x51c357){return{'model':db[_0x51c357[_0xb1a8('0xd')]],'as':_0x51c357['as'],'attributes':_0x51c357[_0xb1a8('0xa')],'include':_0x51c357[_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x51c357[_0xb1a8('0xb')],function(_0x24980f){return{'model':db[_0x24980f[_0xb1a8('0xd')]],'as':_0x24980f['as'],'attributes':_0x24980f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1a8('0xe')](function(_0x3bf3aa){var _0x106aa7=[];for(var _0x1b1524=0x0;_0x1b1524<_0x3bf3aa[_0xb1a8('0x30')];_0x1b1524+=0x1){_0x106aa7[_0xb1a8('0x2e')](_0x3bf3aa[_0x1b1524][_0xb1a8('0x1a')](_0x176d26[_0xb1a8('0x1b')],{'transaction':_0x1d9926}));}return BPromise[_0xb1a8('0x2f')](_0x106aa7);});})[_0xb1a8('0xe')](function(_0xbbadc3){logger['info']('GetContactRecallMe',_0x176d26);logger[_0xb1a8('0x10')](_0xb1a8('0x3e'),_0x176d26,JSON['stringify'](_0xbbadc3));_0x5668fd(_0xbbadc3);})[_0xb1a8('0x12')](function(_0x38d270){logger[_0xb1a8('0x14')](_0xb1a8('0x3e'),_0x38d270['message'],_0x176d26);_0x5907e7(_0xa08b60['error'](0x1f4,_0x38d270['message']));});});});};exports[_0xb1a8('0x3f')]=function(_0x557455){var _0x527a8b=this;return new Promise(function(_0x86b0f7,_0x20a177){db[_0xb1a8('0x21')]['describe']()['then'](function(_0x580bb7){return db[_0xb1a8('0x6')]['findAll']({'raw':_0x557455[_0xb1a8('0x8')]?_0x557455['options'][_0xb1a8('0x18')]===undefined?!![]:![]:!![],'where':_0x557455[_0xb1a8('0x8')]?_0x557455[_0xb1a8('0x8')]['where']||null:null,'attributes':_0x557455['options']?_0x557455[_0xb1a8('0x8')][_0xb1a8('0xa')]||null:null,'limit':_0x557455['options']?_0x557455[_0xb1a8('0x8')][_0xb1a8('0x1c')]||null:null,'include':_0x557455[_0xb1a8('0x8')]?_0x557455[_0xb1a8('0x8')][_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x557455['options'][_0xb1a8('0xb')],function(_0x118008){return{'model':db[_0x118008[_0xb1a8('0xd')]],'as':_0x118008['as'],'attributes':_0x118008['as']===_0xb1a8('0x27')?_['keys'](_0x580bb7):_0x118008['attributes'],'include':_0x118008[_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x118008['include'],function(_0x27f1ca){return{'model':db[_0x27f1ca['model']],'as':_0x27f1ca['as'],'attributes':_0x27f1ca['attributes'],'include':_0x27f1ca[_0xb1a8('0xb')]?_[_0xb1a8('0xc')](_0x27f1ca[_0xb1a8('0xb')],function(_0x1a5ea1){return{'model':db[_0x1a5ea1[_0xb1a8('0xd')]],'as':_0x1a5ea1['as'],'attributes':_0x1a5ea1[_0xb1a8('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb1a8('0xe')](function(_0x1dc69e){logger[_0xb1a8('0xf')](_0xb1a8('0x5'),_0x557455);logger[_0xb1a8('0x10')](_0xb1a8('0x5'),_0x557455,JSON[_0xb1a8('0x11')](_0x1dc69e));_0x86b0f7(_0x1dc69e);})['catch'](function(_0x4eee1c){logger[_0xb1a8('0x14')]('GetCmHopper',_0x4eee1c[_0xb1a8('0x13')],_0x557455);_0x20a177(_0x527a8b[_0xb1a8('0x14')](0x1f4,_0x4eee1c[_0xb1a8('0x13')]));});});});};exports[_0xb1a8('0x40')]=function(_0x4d0aab){var _0x3da323=this;return new Promise(function(_0x179f00,_0x1c7476){return db['CmContact'][_0xb1a8('0x41')]({'raw':!![],'where':{'phone':_0x4d0aab['options'][_0xb1a8('0x9')][_0xb1a8('0x42')]},'attributes':['id',_0xb1a8('0x43')],'order':[['id','DESC']]})[_0xb1a8('0xe')](function(_0x1ffc4c){logger[_0xb1a8('0xf')](_0xb1a8('0x44'),_0x4d0aab);logger[_0xb1a8('0x10')]('getContactByPhone',_0x4d0aab,JSON['stringify'](_0x1ffc4c));_0x179f00(_0x1ffc4c);})[_0xb1a8('0x12')](function(_0x4667e1){logger['error']('getContactByPhone',_0x4667e1['message'],_0x4d0aab);_0x1c7476(_0x3da323[_0xb1a8('0x14')](0x1f4,_0x4667e1[_0xb1a8('0x13')]));});});};exports['ResetActiveCalls']=function(_0x355905){var _0x521729=this;return new Promise(function(_0x43aeaf,_0x206437){return db[_0xb1a8('0x34')][_0xb1a8('0x23')](function(_0x3b6ca7){var _0x558e43=_0x355905[_0xb1a8('0x8')]&&_0x355905[_0xb1a8('0x8')][_0xb1a8('0x9')]?_0x355905[_0xb1a8('0x8')]['where']:{};return db[_0xb1a8('0x6')][_0xb1a8('0x1a')](_0x355905['body'],{'where':_0x558e43,'transaction':_0x3b6ca7})[_0xb1a8('0xe')](function(_0x594019){logger[_0xb1a8('0xf')]('ResetActiveCalls',_0x355905);logger[_0xb1a8('0x10')](_0xb1a8('0x45'),_0x355905,JSON[_0xb1a8('0x11')](_0x594019));_0x43aeaf(_0x594019);})[_0xb1a8('0x12')](function(_0x4dc288){logger[_0xb1a8('0x14')](_0xb1a8('0x45'),_0x4dc288[_0xb1a8('0x13')],_0x355905);_0x206437(_0x521729[_0xb1a8('0x14')](0x1f4,_0x4dc288[_0xb1a8('0x13')]));});});});};exports[_0xb1a8('0x46')]=function(_0x46fa40){var _0x10ceae=this;var _0x15b764=_0x46fa40[_0xb1a8('0x1b')][_0xb1a8('0x9')][_0xb1a8('0x47')];var _0x193d56=_0x46fa40[_0xb1a8('0x1b')][_0xb1a8('0x9')][_0xb1a8('0x48')];var _0x7f7efa=_0x46fa40[_0xb1a8('0x1b')][_0xb1a8('0x9')][_0xb1a8('0x49')];return new Promise(function(_0x392435,_0x4affa1){return db[_0xb1a8('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x15b764},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xb1a8('0x34')][_0xb1a8('0x39')](_0xb1a8('0x4a')+_0x193d56+'\x20MINUTE'),'$gt':db['sequelize'][_0xb1a8('0x39')](_0xb1a8('0x4b'))}},'UserId':{'$in':_0x7f7efa}},'include':[{'model':db[_0xb1a8('0x21')],'as':'Contact'},{'model':db[_0xb1a8('0x29')],'as':_0xb1a8('0x2a'),'attributes':['id',_0xb1a8('0x2b'),_0xb1a8('0x2c')]},{'model':db[_0xb1a8('0x4c')],'as':_0xb1a8('0x4d')}]})[_0xb1a8('0xe')](function(_0x39cad){if(_0x39cad[_0xb1a8('0x30')]>0x0){return db[_0xb1a8('0x34')][_0xb1a8('0x23')](function(_0x1be24e){return db['CmHopper'][_0xb1a8('0x1a')]({'recallmeNotifiedDate':db[_0xb1a8('0x34')][_0xb1a8('0x39')]('NOW()')},{'where':{'id':{'$in':_[_0xb1a8('0xc')](_0x39cad,'id')}},'transaction':_0x1be24e})['then'](function(){_0x392435(_0x39cad);})[_0xb1a8('0x12')](function(_0x5edd1b){logger['error'](_0xb1a8('0x46'),_0x5edd1b[_0xb1a8('0x13')],_0x46fa40);_0x4affa1(_0x10ceae['error'](0x1f4,_0x5edd1b[_0xb1a8('0x13')]));});})[_0xb1a8('0x12')](function(_0x187ea1){logger[_0xb1a8('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x187ea1[_0xb1a8('0x13')],_0x46fa40);_0x4affa1(_0x10ceae[_0xb1a8('0x14')](0x1f4,_0x187ea1[_0xb1a8('0x13')]));});}else{_0x392435(_0x39cad);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0e9b72b..0fef50e 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 _0x86ea=['getPreview','/timezone','put','delete','/:id','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','create','/preview'];(function(_0x549cad,_0xc32566){var _0x5a9eed=function(_0x553000){while(--_0x553000){_0x549cad['push'](_0x549cad['shift']());}};_0x5a9eed(++_0xc32566);}(_0x86ea,0x18d));var _0xa86e=function(_0x366bdd,_0x2f9a4d){_0x366bdd=_0x366bdd-0x0;var _0x455c57=_0x86ea[_0x366bdd];return _0x455c57;};'use strict';var express=require(_0xa86e('0x0'));var router=express[_0xa86e('0x1')]();var auth=require(_0xa86e('0x2'));var controller=require(_0xa86e('0x3'));router[_0xa86e('0x4')]('/',auth[_0xa86e('0x5')](),controller[_0xa86e('0x6')]);router[_0xa86e('0x4')](_0xa86e('0x7'),auth[_0xa86e('0x5')](),controller['describe']);router['get'](_0xa86e('0x8'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xa86e('0x4')](_0xa86e('0x9'),auth[_0xa86e('0x5')](),controller[_0xa86e('0xa')]);router['get']('/:id',auth[_0xa86e('0x5')](),controller[_0xa86e('0xb')]);router['get'](_0xa86e('0xc'),auth[_0xa86e('0x5')](),controller[_0xa86e('0xd')]);router[_0xa86e('0xe')]('/',auth[_0xa86e('0x5')](),controller[_0xa86e('0xf')]);router['post'](_0xa86e('0x10'),auth[_0xa86e('0x5')](),controller[_0xa86e('0x11')]);router['post'](_0xa86e('0x12'),auth['isAuthenticated'](),controller['getTimezone']);router[_0xa86e('0x13')]('/:id',auth[_0xa86e('0x5')](),controller['update']);router[_0xa86e('0x14')](_0xa86e('0x15'),auth[_0xa86e('0x5')](),controller['destroy']);module[_0xa86e('0x16')]=router; \ No newline at end of file +var _0x56d4=['describe','/opencontacts','getOpenContacts','get','/timezones','getTimezones','/:id/previewrecall','getPreviewRecall','post','create','/timezone','put','/:id','update','delete','destroy','exports','express','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','/describe'];(function(_0x138ce0,_0x5a34be){var _0x3c5db4=function(_0x3427d2){while(--_0x3427d2){_0x138ce0['push'](_0x138ce0['shift']());}};_0x3c5db4(++_0x5a34be);}(_0x56d4,0x1dd));var _0x456d=function(_0x564d84,_0x43c927){_0x564d84=_0x564d84-0x0;var _0x2aa130=_0x56d4[_0x564d84];return _0x2aa130;};'use strict';var express=require(_0x456d('0x0'));var router=express['Router']();var auth=require(_0x456d('0x1'));var controller=require(_0x456d('0x2'));router['get']('/',auth[_0x456d('0x3')](),controller[_0x456d('0x4')]);router['get'](_0x456d('0x5'),auth[_0x456d('0x3')](),controller[_0x456d('0x6')]);router['get'](_0x456d('0x7'),auth[_0x456d('0x3')](),controller[_0x456d('0x8')]);router[_0x456d('0x9')](_0x456d('0xa'),auth[_0x456d('0x3')](),controller[_0x456d('0xb')]);router[_0x456d('0x9')]('/:id',auth[_0x456d('0x3')](),controller['show']);router[_0x456d('0x9')](_0x456d('0xc'),auth[_0x456d('0x3')](),controller[_0x456d('0xd')]);router[_0x456d('0xe')]('/',auth['isAuthenticated'](),controller[_0x456d('0xf')]);router[_0x456d('0xe')]('/preview',auth[_0x456d('0x3')](),controller['getPreview']);router['post'](_0x456d('0x10'),auth[_0x456d('0x3')](),controller['getTimezone']);router[_0x456d('0x11')](_0x456d('0x12'),auth['isAuthenticated'](),controller[_0x456d('0x13')]);router[_0x456d('0x14')](_0x456d('0x12'),auth[_0x456d('0x3')](),controller[_0x456d('0x15')]);module[_0x456d('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 949d84d..3f7c761 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 _0xdf3d=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x4f0b0f,_0x386460){var _0x1e075d=function(_0x139ba2){while(--_0x139ba2){_0x4f0b0f['push'](_0x4f0b0f['shift']());}};_0x1e075d(++_0x386460);}(_0xdf3d,0x12a));var _0xddf3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdf3d[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require(_0xddf3('0x0'));var Sequelize=require(_0xddf3('0x1'));module[_0xddf3('0x2')]={'CmHopperId':{'type':Sequelize[_0xddf3('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xddf3('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xddf3('0x4')],'defaultValue':moment()[_0xddf3('0x5')](_0xddf3('0x6'))},'countbusyretry':{'type':Sequelize[_0xddf3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xddf3('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xddf3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xddf3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xddf3('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xddf3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xddf3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe82e=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING'];(function(_0x242f3b,_0x4121f7){var _0x5bd25d=function(_0xbdaf5f){while(--_0xbdaf5f){_0x242f3b['push'](_0x242f3b['shift']());}};_0x5bd25d(++_0x4121f7);}(_0xe82e,0x6b));var _0xee82=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xe82e[_0x5f3f88];return _0xd08119;};'use strict';var moment=require(_0xee82('0x0'));var Sequelize=require(_0xee82('0x1'));module[_0xee82('0x2')]={'CmHopperId':{'type':Sequelize[_0xee82('0x3')]},'phone':{'type':Sequelize[_0xee82('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xee82('0x5')],'defaultValue':moment()[_0xee82('0x6')](_0xee82('0x7'))},'countbusyretry':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xee82('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index a243e34..858ec86 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 _0x9f6c=['moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','set','apply','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','include','catch','show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch'];(function(_0x9008bd,_0x16a66b){var _0x408d9f=function(_0x5a70b9){while(--_0x5a70b9){_0x9008bd['push'](_0x9008bd['shift']());}};_0x408d9f(++_0x16a66b);}(_0x9f6c,0xf4));var _0xc9f6=function(_0x1fe092,_0x2082ef){_0x1fe092=_0x1fe092-0x0;var _0x10a587=_0x9f6c[_0x1fe092];return _0x10a587;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc9f6('0x0'));var jsonpatch=require(_0xc9f6('0x1'));var rp=require('request-promise');var moment=require(_0xc9f6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9f6('0x3'));var util=require(_0xc9f6('0x4'));var path=require('path');var sox=require(_0xc9f6('0x5'));var csv=require(_0xc9f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9f6('0x7'));var _=require(_0xc9f6('0x8'));var squel=require(_0xc9f6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc9f6('0xa'));var deskjs=require(_0xc9f6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc9f6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc9f6('0xd'));var authService=require(_0xc9f6('0xe'));var qs=require(_0xc9f6('0xf'));var as=require(_0xc9f6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9f6('0x11'))('api');var utils=require(_0xc9f6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc9f6('0x13'));var db=require(_0xc9f6('0x14'))['db'];function respondWithStatusCode(_0x341d77,_0x313015){_0x313015=_0x313015||0xcc;return function(_0x4207fe){if(_0x4207fe){return _0x341d77['sendStatus'](_0x313015);}return _0x341d77['status'](_0x313015)[_0xc9f6('0x15')]();};}function respondWithResult(_0x3783d4,_0x5984e8){_0x5984e8=_0x5984e8||0xc8;return function(_0x1531bf){if(_0x1531bf){return _0x3783d4[_0xc9f6('0x16')](_0x5984e8)[_0xc9f6('0x17')](_0x1531bf);}};}function respondWithFilteredResult(_0x52e771,_0x532433){return function(_0x1ef87b){if(_0x1ef87b){var _0x8eeca6=typeof _0x532433[_0xc9f6('0x18')]==='undefined'&&typeof _0x532433[_0xc9f6('0x19')]===_0xc9f6('0x1a');var _0x34b48c=_0x1ef87b['count'];var _0x189e61=_0x8eeca6?0x0:_0x532433['offset'];var _0x3508f6=_0x8eeca6?_0x1ef87b['count']:_0x532433['offset']+_0x532433['limit'];var _0x3bffaf;if(_0x3508f6>=_0x34b48c){_0x3508f6=_0x34b48c;_0x3bffaf=0xc8;}else{_0x3bffaf=0xce;}_0x52e771[_0xc9f6('0x16')](_0x3bffaf);return _0x52e771[_0xc9f6('0x1b')]('Content-Range',_0x189e61+'-'+_0x3508f6+'/'+_0x34b48c)[_0xc9f6('0x17')](_0x1ef87b);}return null;};}function patchUpdates(_0x4efce2){return function(_0x39e531){try{jsonpatch[_0xc9f6('0x1c')](_0x39e531,_0x4efce2,!![]);}catch(_0x5bb87b){return BPromise[_0xc9f6('0x1d')](_0x5bb87b);}return _0x39e531[_0xc9f6('0x1e')]();};}function saveUpdates(_0x3b1b58,_0x575183){return function(_0x5835ae){if(_0x5835ae){return _0x5835ae[_0xc9f6('0x1f')](_0x3b1b58)['then'](function(_0x247fb3){return _0x247fb3;});}return null;};}function removeEntity(_0x421a02,_0x333a97){return function(_0x5f477d){if(_0x5f477d){return _0x5f477d[_0xc9f6('0x20')]()['then'](function(){var _0x1cb3d5=_0x5f477d[_0xc9f6('0x21')]({'plain':!![]});var _0x2eab83='CmHopperAdditionalPhones';return db[_0xc9f6('0x22')][_0xc9f6('0x20')]({'where':{'type':_0x2eab83,'resourceId':_0x1cb3d5['id']}})[_0xc9f6('0x23')](function(){return _0x5f477d;});})[_0xc9f6('0x23')](function(){_0x421a02[_0xc9f6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2766ae,_0x408723){return function(_0x2d284e){if(!_0x2d284e){_0x2766ae[_0xc9f6('0x24')](0x194);}return _0x2d284e;};}function handleError(_0x63069c,_0x3495ce){_0x3495ce=_0x3495ce||0x1f4;return function(_0x1e9cb0){logger[_0xc9f6('0x25')](_0x1e9cb0[_0xc9f6('0x26')]);if(_0x1e9cb0[_0xc9f6('0x27')]){delete _0x1e9cb0[_0xc9f6('0x27')];}_0x63069c[_0xc9f6('0x16')](_0x3495ce)[_0xc9f6('0x28')](_0x1e9cb0);};}exports[_0xc9f6('0x29')]=function(_0x2612d7,_0x5e0338){var _0x2fc8bb={},_0x4d6f10={},_0x1769b2={'count':0x0,'rows':[]};var _0x3c50fb=_[_0xc9f6('0x2a')](db[_0xc9f6('0x2b')][_0xc9f6('0x2c')],function(_0x34e0d4){return{'name':_0x34e0d4[_0xc9f6('0x2d')],'type':_0x34e0d4[_0xc9f6('0x2e')][_0xc9f6('0x2f')]};});_0x4d6f10[_0xc9f6('0x30')]=_['map'](_0x3c50fb,_0xc9f6('0x27'));_0x4d6f10['query']=_['keys'](_0x2612d7['query']);_0x4d6f10[_0xc9f6('0x31')]=_[_0xc9f6('0x32')](_0x4d6f10[_0xc9f6('0x30')],_0x4d6f10[_0xc9f6('0x33')]);_0x2fc8bb[_0xc9f6('0x34')]=_[_0xc9f6('0x32')](_0x4d6f10[_0xc9f6('0x30')],qs[_0xc9f6('0x35')](_0x2612d7[_0xc9f6('0x33')][_0xc9f6('0x35')]));_0x2fc8bb[_0xc9f6('0x34')]=_0x2fc8bb['attributes'][_0xc9f6('0x36')]?_0x2fc8bb[_0xc9f6('0x34')]:_0x4d6f10[_0xc9f6('0x30')];if(!_0x2612d7['query'][_0xc9f6('0x37')](_0xc9f6('0x38'))){_0x2fc8bb[_0xc9f6('0x19')]=qs[_0xc9f6('0x19')](_0x2612d7[_0xc9f6('0x33')][_0xc9f6('0x19')]);_0x2fc8bb[_0xc9f6('0x18')]=qs['offset'](_0x2612d7[_0xc9f6('0x33')][_0xc9f6('0x18')]);}_0x2fc8bb[_0xc9f6('0x39')]=qs[_0xc9f6('0x3a')](_0x2612d7[_0xc9f6('0x33')]['sort']);_0x2fc8bb[_0xc9f6('0x3b')]=qs['filters'](_[_0xc9f6('0x3c')](_0x2612d7[_0xc9f6('0x33')],_0x4d6f10['filters']),_0x3c50fb);if(_0x2612d7[_0xc9f6('0x33')][_0xc9f6('0x3d')]){_0x2fc8bb[_0xc9f6('0x3b')]=_['merge'](_0x2fc8bb[_0xc9f6('0x3b')],{'$or':_[_0xc9f6('0x2a')](_0x3c50fb,function(_0x135569){if(_0x135569[_0xc9f6('0x2e')]!==_0xc9f6('0x3e')){var _0x3bb339={};_0x3bb339[_0x135569[_0xc9f6('0x27')]]={'$like':'%'+_0x2612d7[_0xc9f6('0x33')][_0xc9f6('0x3d')]+'%'};return _0x3bb339;}})});}_0x2fc8bb=_[_0xc9f6('0x3f')]({},_0x2fc8bb,_0x2612d7['options']);var _0x30040={'where':_0x2fc8bb[_0xc9f6('0x3b')]};return db['CmHopperAdditionalPhone']['count'](_0x30040)[_0xc9f6('0x23')](function(_0x55970b){_0x1769b2[_0xc9f6('0x40')]=_0x55970b;if(_0x2612d7[_0xc9f6('0x33')]['includeAll']){_0x2fc8bb[_0xc9f6('0x41')]=[{'all':!![]}];}return db[_0xc9f6('0x2b')]['findAll'](_0x2fc8bb);})['then'](function(_0x261780){_0x1769b2['rows']=_0x261780;return _0x1769b2;})['then'](respondWithFilteredResult(_0x5e0338,_0x2fc8bb))[_0xc9f6('0x42')](handleError(_0x5e0338,null));};exports[_0xc9f6('0x43')]=function(_0x4cde82,_0x4bfb1b){var _0x2fb2fd={'raw':!![],'where':{'id':_0x4cde82['params']['id']}},_0xfe751f={};_0xfe751f[_0xc9f6('0x30')]=_[_0xc9f6('0x44')](db[_0xc9f6('0x2b')][_0xc9f6('0x2c')]);_0xfe751f[_0xc9f6('0x33')]=_[_0xc9f6('0x44')](_0x4cde82[_0xc9f6('0x33')]);_0xfe751f[_0xc9f6('0x31')]=_['intersection'](_0xfe751f['model'],_0xfe751f[_0xc9f6('0x33')]);_0x2fb2fd['attributes']=_[_0xc9f6('0x32')](_0xfe751f['model'],qs[_0xc9f6('0x35')](_0x4cde82[_0xc9f6('0x33')][_0xc9f6('0x35')]));_0x2fb2fd[_0xc9f6('0x34')]=_0x2fb2fd[_0xc9f6('0x34')][_0xc9f6('0x36')]?_0x2fb2fd['attributes']:_0xfe751f[_0xc9f6('0x30')];if(_0x4cde82[_0xc9f6('0x33')]['includeAll']){_0x2fb2fd[_0xc9f6('0x41')]=[{'all':!![]}];}_0x2fb2fd=_[_0xc9f6('0x3f')]({},_0x2fb2fd,_0x4cde82[_0xc9f6('0x45')]);return db[_0xc9f6('0x2b')][_0xc9f6('0x46')](_0x2fb2fd)['then'](handleEntityNotFound(_0x4bfb1b,null))[_0xc9f6('0x23')](respondWithResult(_0x4bfb1b,null))[_0xc9f6('0x42')](handleError(_0x4bfb1b,null));};exports[_0xc9f6('0x47')]=function(_0x3025e3,_0x4b9917){return db[_0xc9f6('0x2b')][_0xc9f6('0x47')](_0x3025e3[_0xc9f6('0x48')],{})['then'](function(_0x5e6bab){var _0x3ff06f=_0x3025e3[_0xc9f6('0x49')]['get']({'plain':!![]});if(!_0x3ff06f)throw new Error(_0xc9f6('0x4a'));if(_0x3ff06f[_0xc9f6('0x4b')]==='user'){var _0x354f32=_0x5e6bab['get']({'plain':!![]});var _0x332a5e=_0xc9f6('0x4c');return db[_0xc9f6('0x4d')][_0xc9f6('0x46')]({'where':{'name':_0x332a5e,'userProfileId':_0x3ff06f[_0xc9f6('0x4e')]},'raw':!![]})['then'](function(_0x174e31){if(_0x174e31&&_0x174e31[_0xc9f6('0x4f')]===0x0){return db[_0xc9f6('0x22')]['create']({'name':_0x354f32[_0xc9f6('0x27')],'resourceId':_0x354f32['id'],'type':_0x174e31[_0xc9f6('0x27')],'sectionId':_0x174e31['id']},{})[_0xc9f6('0x23')](function(){return _0x5e6bab;});}else{return _0x5e6bab;}})['catch'](function(_0x4f22ab){logger[_0xc9f6('0x25')](_0xc9f6('0x50'),_0x4f22ab);throw _0x4f22ab;});}return _0x5e6bab;})[_0xc9f6('0x23')](respondWithResult(_0x4b9917,0xc9))[_0xc9f6('0x42')](handleError(_0x4b9917,null));};exports[_0xc9f6('0x1f')]=function(_0x5748a3,_0x3bc836){if(_0x5748a3['body']['id']){delete _0x5748a3[_0xc9f6('0x48')]['id'];}return db[_0xc9f6('0x2b')][_0xc9f6('0x46')]({'where':{'id':_0x5748a3[_0xc9f6('0x51')]['id']}})[_0xc9f6('0x23')](handleEntityNotFound(_0x3bc836,null))[_0xc9f6('0x23')](saveUpdates(_0x5748a3['body'],null))[_0xc9f6('0x23')](respondWithResult(_0x3bc836,null))[_0xc9f6('0x42')](handleError(_0x3bc836,null));};exports[_0xc9f6('0x20')]=function(_0x3f3b84,_0x3186d4){return db['CmHopperAdditionalPhone'][_0xc9f6('0x46')]({'where':{'id':_0x3f3b84[_0xc9f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x3186d4,null))[_0xc9f6('0x23')](removeEntity(_0x3186d4,null))[_0xc9f6('0x42')](handleError(_0x3186d4,null));}; \ No newline at end of file +var _0x772e=['map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','CmHopperAdditionalPhone','includeAll','findAll','rows','catch','params','find','create','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','CmHopperAdditionalPhones','error','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x772e,0x1dc));var _0xe772=function(_0x49a75d,_0x21a75d){_0x49a75d=_0x49a75d-0x0;var _0x5f302a=_0x772e[_0x49a75d];return _0x5f302a;};'use strict';var emlformat=require(_0xe772('0x0'));var rimraf=require(_0xe772('0x1'));var zipdir=require(_0xe772('0x2'));var jsonpatch=require(_0xe772('0x3'));var rp=require(_0xe772('0x4'));var moment=require(_0xe772('0x5'));var BPromise=require(_0xe772('0x6'));var Mustache=require(_0xe772('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe772('0x8'));var ejs=require(_0xe772('0x9'));var fs=require('fs');var fs_extra=require(_0xe772('0xa'));var _=require('lodash');var squel=require(_0xe772('0xb'));var crypto=require(_0xe772('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe772('0xd'));var toCsv=require(_0xe772('0x8'));var querystring=require(_0xe772('0xe'));var Papa=require(_0xe772('0xf'));var Redis=require(_0xe772('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe772('0x11'));var as=require(_0xe772('0x12'));var hardwareService=require(_0xe772('0x13'));var logger=require(_0xe772('0x14'))(_0xe772('0x15'));var utils=require(_0xe772('0x16'));var config=require(_0xe772('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2910ba,_0x417173){_0x417173=_0x417173||0xcc;return function(_0x41e74d){if(_0x41e74d){return _0x2910ba[_0xe772('0x18')](_0x417173);}return _0x2910ba[_0xe772('0x19')](_0x417173)[_0xe772('0x1a')]();};}function respondWithResult(_0x631732,_0x3e0494){_0x3e0494=_0x3e0494||0xc8;return function(_0x56cfa1){if(_0x56cfa1){return _0x631732[_0xe772('0x19')](_0x3e0494)[_0xe772('0x1b')](_0x56cfa1);}};}function respondWithFilteredResult(_0xa7c6d1,_0x381484){return function(_0x50cdb8){if(_0x50cdb8){var _0x34c220=typeof _0x381484[_0xe772('0x1c')]===_0xe772('0x1d')&&typeof _0x381484[_0xe772('0x1e')]==='undefined';var _0x220617=_0x50cdb8[_0xe772('0x1f')];var _0x14fe14=_0x34c220?0x0:_0x381484['offset'];var _0x44dbbf=_0x34c220?_0x50cdb8[_0xe772('0x1f')]:_0x381484['offset']+_0x381484[_0xe772('0x1e')];var _0x152bc9;if(_0x44dbbf>=_0x220617){_0x44dbbf=_0x220617;_0x152bc9=0xc8;}else{_0x152bc9=0xce;}_0xa7c6d1[_0xe772('0x19')](_0x152bc9);return _0xa7c6d1[_0xe772('0x20')](_0xe772('0x21'),_0x14fe14+'-'+_0x44dbbf+'/'+_0x220617)[_0xe772('0x1b')](_0x50cdb8);}return null;};}function patchUpdates(_0x1d3a19){return function(_0x53f38){try{jsonpatch['apply'](_0x53f38,_0x1d3a19,!![]);}catch(_0x1ab79c){return BPromise['reject'](_0x1ab79c);}return _0x53f38[_0xe772('0x22')]();};}function saveUpdates(_0x2e9b40,_0x2b6931){return function(_0x534dde){if(_0x534dde){return _0x534dde[_0xe772('0x23')](_0x2e9b40)['then'](function(_0x105fc9){return _0x105fc9;});}return null;};}function removeEntity(_0x50a59f,_0x3495db){return function(_0x29127b){if(_0x29127b){return _0x29127b[_0xe772('0x24')]()[_0xe772('0x25')](function(){var _0x2aad62=_0x29127b[_0xe772('0x26')]({'plain':!![]});var _0xc45f1d=_0xe772('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0xc45f1d,'resourceId':_0x2aad62['id']}})[_0xe772('0x25')](function(){return _0x29127b;});})[_0xe772('0x25')](function(){_0x50a59f['status'](0xcc)[_0xe772('0x1a')]();});}};}function handleEntityNotFound(_0x50d7ce,_0xacb09f){return function(_0x47310e){if(!_0x47310e){_0x50d7ce[_0xe772('0x18')](0x194);}return _0x47310e;};}function handleError(_0x2993d,_0x227c37){_0x227c37=_0x227c37||0x1f4;return function(_0x35c4c9){logger[_0xe772('0x28')](_0x35c4c9['stack']);if(_0x35c4c9[_0xe772('0x29')]){delete _0x35c4c9[_0xe772('0x29')];}_0x2993d[_0xe772('0x19')](_0x227c37)['send'](_0x35c4c9);};}exports['index']=function(_0x3c3cb5,_0x3acaa0){var _0x558d52={},_0x17a7ea={},_0x4075bd={'count':0x0,'rows':[]};var _0x4fdeb5=_[_0xe772('0x2a')](db['CmHopperAdditionalPhone'][_0xe772('0x2b')],function(_0xf17bd8){return{'name':_0xf17bd8['fieldName'],'type':_0xf17bd8[_0xe772('0x2c')]['key']};});_0x17a7ea[_0xe772('0x2d')]=_[_0xe772('0x2a')](_0x4fdeb5,_0xe772('0x29'));_0x17a7ea[_0xe772('0x2e')]=_[_0xe772('0x2f')](_0x3c3cb5[_0xe772('0x2e')]);_0x17a7ea[_0xe772('0x30')]=_[_0xe772('0x31')](_0x17a7ea[_0xe772('0x2d')],_0x17a7ea[_0xe772('0x2e')]);_0x558d52[_0xe772('0x32')]=_[_0xe772('0x31')](_0x17a7ea[_0xe772('0x2d')],qs[_0xe772('0x33')](_0x3c3cb5['query'][_0xe772('0x33')]));_0x558d52[_0xe772('0x32')]=_0x558d52[_0xe772('0x32')][_0xe772('0x34')]?_0x558d52[_0xe772('0x32')]:_0x17a7ea[_0xe772('0x2d')];if(!_0x3c3cb5['query']['hasOwnProperty']('nolimit')){_0x558d52[_0xe772('0x1e')]=qs[_0xe772('0x1e')](_0x3c3cb5['query'][_0xe772('0x1e')]);_0x558d52['offset']=qs[_0xe772('0x1c')](_0x3c3cb5[_0xe772('0x2e')]['offset']);}_0x558d52[_0xe772('0x35')]=qs[_0xe772('0x36')](_0x3c3cb5['query'][_0xe772('0x36')]);_0x558d52[_0xe772('0x37')]=qs['filters'](_[_0xe772('0x38')](_0x3c3cb5[_0xe772('0x2e')],_0x17a7ea['filters']),_0x4fdeb5);if(_0x3c3cb5[_0xe772('0x2e')]['filter']){_0x558d52[_0xe772('0x37')]=_['merge'](_0x558d52[_0xe772('0x37')],{'$or':_[_0xe772('0x2a')](_0x4fdeb5,function(_0x16e7a5){if(_0x16e7a5[_0xe772('0x2c')]!=='VIRTUAL'){var _0x185313={};_0x185313[_0x16e7a5[_0xe772('0x29')]]={'$like':'%'+_0x3c3cb5[_0xe772('0x2e')][_0xe772('0x39')]+'%'};return _0x185313;}})});}_0x558d52=_[_0xe772('0x3a')]({},_0x558d52,_0x3c3cb5[_0xe772('0x3b')]);var _0x45e48a={'where':_0x558d52[_0xe772('0x37')]};return db[_0xe772('0x3c')][_0xe772('0x1f')](_0x45e48a)[_0xe772('0x25')](function(_0x6db76){_0x4075bd[_0xe772('0x1f')]=_0x6db76;if(_0x3c3cb5['query'][_0xe772('0x3d')]){_0x558d52['include']=[{'all':!![]}];}return db[_0xe772('0x3c')][_0xe772('0x3e')](_0x558d52);})[_0xe772('0x25')](function(_0x1e627c){_0x4075bd[_0xe772('0x3f')]=_0x1e627c;return _0x4075bd;})[_0xe772('0x25')](respondWithFilteredResult(_0x3acaa0,_0x558d52))[_0xe772('0x40')](handleError(_0x3acaa0,null));};exports['show']=function(_0x15e847,_0x13bfaa){var _0xd1ddc={'raw':!![],'where':{'id':_0x15e847[_0xe772('0x41')]['id']}},_0x4e9578={};_0x4e9578[_0xe772('0x2d')]=_[_0xe772('0x2f')](db[_0xe772('0x3c')][_0xe772('0x2b')]);_0x4e9578['query']=_[_0xe772('0x2f')](_0x15e847[_0xe772('0x2e')]);_0x4e9578['filters']=_['intersection'](_0x4e9578[_0xe772('0x2d')],_0x4e9578[_0xe772('0x2e')]);_0xd1ddc[_0xe772('0x32')]=_['intersection'](_0x4e9578[_0xe772('0x2d')],qs[_0xe772('0x33')](_0x15e847[_0xe772('0x2e')][_0xe772('0x33')]));_0xd1ddc[_0xe772('0x32')]=_0xd1ddc['attributes']['length']?_0xd1ddc[_0xe772('0x32')]:_0x4e9578[_0xe772('0x2d')];if(_0x15e847['query'][_0xe772('0x3d')]){_0xd1ddc['include']=[{'all':!![]}];}_0xd1ddc=_[_0xe772('0x3a')]({},_0xd1ddc,_0x15e847[_0xe772('0x3b')]);return db[_0xe772('0x3c')][_0xe772('0x42')](_0xd1ddc)[_0xe772('0x25')](handleEntityNotFound(_0x13bfaa,null))[_0xe772('0x25')](respondWithResult(_0x13bfaa,null))['catch'](handleError(_0x13bfaa,null));};exports[_0xe772('0x43')]=function(_0x3a4e40,_0x2e1001){return db['CmHopperAdditionalPhone'][_0xe772('0x43')](_0x3a4e40[_0xe772('0x44')],{})[_0xe772('0x25')](function(_0x2dc30a){var _0x4d7850=_0x3a4e40['user'][_0xe772('0x26')]({'plain':!![]});if(!_0x4d7850)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d7850[_0xe772('0x45')]===_0xe772('0x46')){var _0x18e91c=_0x2dc30a[_0xe772('0x26')]({'plain':!![]});var _0x28b896='CmHopperAdditionalPhones';return db[_0xe772('0x47')][_0xe772('0x42')]({'where':{'name':_0x28b896,'userProfileId':_0x4d7850['userProfileId']},'raw':!![]})[_0xe772('0x25')](function(_0x34f7c8){if(_0x34f7c8&&_0x34f7c8[_0xe772('0x48')]===0x0){return db[_0xe772('0x49')][_0xe772('0x43')]({'name':_0x18e91c[_0xe772('0x29')],'resourceId':_0x18e91c['id'],'type':_0x34f7c8[_0xe772('0x29')],'sectionId':_0x34f7c8['id']},{})['then'](function(){return _0x2dc30a;});}else{return _0x2dc30a;}})['catch'](function(_0x12c540){logger[_0xe772('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12c540);throw _0x12c540;});}return _0x2dc30a;})['then'](respondWithResult(_0x2e1001,0xc9))[_0xe772('0x40')](handleError(_0x2e1001,null));};exports[_0xe772('0x23')]=function(_0x4767d8,_0x361b8a){if(_0x4767d8['body']['id']){delete _0x4767d8[_0xe772('0x44')]['id'];}return db[_0xe772('0x3c')][_0xe772('0x42')]({'where':{'id':_0x4767d8[_0xe772('0x41')]['id']}})[_0xe772('0x25')](handleEntityNotFound(_0x361b8a,null))['then'](saveUpdates(_0x4767d8['body'],null))[_0xe772('0x25')](respondWithResult(_0x361b8a,null))['catch'](handleError(_0x361b8a,null));};exports[_0xe772('0x24')]=function(_0x4bb034,_0x15aed0){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x4bb034['params']['id']}})[_0xe772('0x25')](handleEntityNotFound(_0x15aed0,null))[_0xe772('0x25')](removeEntity(_0x15aed0,null))[_0xe772('0x40')](handleError(_0x15aed0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index cf93374..8a69293 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 _0xa258=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa258,0x78));var _0x8a25=function(_0x5670ad,_0x300b24){_0x5670ad=_0x5670ad-0x0;var _0x583792=_0xa258[_0x5670ad];return _0x583792;};'use strict';var _=require(_0x8a25('0x0'));var util=require(_0x8a25('0x1'));var logger=require(_0x8a25('0x2'))(_0x8a25('0x3'));var moment=require('moment');var BPromise=require(_0x8a25('0x4'));var rp=require(_0x8a25('0x5'));var fs=require('fs');var path=require(_0x8a25('0x6'));var rimraf=require(_0x8a25('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a25('0x8'));module[_0x8a25('0x9')]=function(_0x4f82d9,_0x3f7df5){return _0x4f82d9[_0x8a25('0xa')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x8a25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95a8=['exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0x95a8,0x1dc));var _0x895a=function(_0x2c9d30,_0xb7653e){_0x2c9d30=_0x2c9d30-0x0;var _0x2ca878=_0x95a8[_0x2c9d30];return _0x2ca878;};'use strict';var _=require(_0x895a('0x0'));var util=require('util');var logger=require(_0x895a('0x1'))('api');var moment=require(_0x895a('0x2'));var BPromise=require('bluebird');var rp=require(_0x895a('0x3'));var fs=require('fs');var path=require(_0x895a('0x4'));var rimraf=require(_0x895a('0x5'));var config=require(_0x895a('0x6'));var attributes=require(_0x895a('0x7'));module[_0x895a('0x8')]=function(_0x25677c,_0x77a662){return _0x25677c['define'](_0x895a('0x9'),attributes,{'tableName':_0x895a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 41c98f3..9b301bc 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 _0xe360=['waitTime','duration','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','CmHopper','field','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','VerifyAdditionalPhones','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','entity','catch','SwapAdditionalPhones'];(function(_0x2da4c8,_0x1c85a6){var _0x5aece4=function(_0x115d22){while(--_0x115d22){_0x2da4c8['push'](_0x2da4c8['shift']());}};_0x5aece4(++_0x1c85a6);}(_0xe360,0x1b7));var _0x0e36=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xe360[_0x9729d7];return _0x3c4ac6;};'use strict';var _=require(_0x0e36('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0e36('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e36('0x2'))(_0x0e36('0x3'));var config=require(_0x0e36('0x4'));var jayson=require(_0x0e36('0x5'));var client=jayson[_0x0e36('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x553c6b,_0x300a38,_0x2751a6){return new BPromise(function(_0x9c7e75,_0x3d9351){return client['request'](_0x553c6b,_0x2751a6)[_0x0e36('0x7')](function(_0x5afa5c){logger['info'](_0x0e36('0x8'),_0x300a38,_0x0e36('0x9'));logger[_0x0e36('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x300a38,_0x0e36('0x9'),JSON[_0x0e36('0xb')](_0x5afa5c));if(_0x5afa5c[_0x0e36('0xc')]){if(_0x5afa5c['error'][_0x0e36('0xd')]===0x1f4){logger[_0x0e36('0xc')](_0x0e36('0x8'),_0x300a38,_0x5afa5c[_0x0e36('0xc')][_0x0e36('0xe')]);return _0x3d9351(_0x5afa5c[_0x0e36('0xc')][_0x0e36('0xe')]);}logger['error'](_0x0e36('0x8'),_0x300a38,_0x5afa5c[_0x0e36('0xc')][_0x0e36('0xe')]);return _0x9c7e75(_0x5afa5c[_0x0e36('0xc')][_0x0e36('0xe')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x300a38,_0x0e36('0x9'));_0x9c7e75(_0x5afa5c[_0x0e36('0xf')][_0x0e36('0xe')]);}})['catch'](function(_0x18ea63){logger[_0x0e36('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x300a38,_0x18ea63);_0x3d9351(_0x18ea63);});});}exports[_0x0e36('0x10')]=function(_0x5e83ba){var _0x42f25c=this;return new Promise(function(_0x4e49b4,_0x3fdc1f){return db['CmHopper'][_0x0e36('0x11')]({'raw':!![],'where':{'ContactId':_0x5e83ba['body'][_0x0e36('0x12')],'ListId':_0x5e83ba[_0x0e36('0x13')][_0x0e36('0x14')],'VoiceQueueId':_0x5e83ba[_0x0e36('0x13')]['VoiceQueueId']===undefined?null:_0x5e83ba[_0x0e36('0x13')][_0x0e36('0x15')],'CampaignId':_0x5e83ba[_0x0e36('0x13')][_0x0e36('0x16')]===undefined?null:_0x5e83ba['body']['CampaignId']}})['then'](function(_0x56bfdf){if(_0x56bfdf!=null){return db[_0x0e36('0x17')][_0x0e36('0x11')]({'raw':!![],'where':{'CmHopperId':_0x56bfdf['id'],'OrderBy':{'$gt':_0x56bfdf[_0x0e36('0x18')]}},'order':[[_0x0e36('0x18'),_0x0e36('0x19')]]})[_0x0e36('0x7')](function(_0x1192d2){var _0x8ff1e2=0x0;if(_0x1192d2){if(_0x1192d2[_0x0e36('0x1a')]+_0x1192d2[_0x0e36('0x1b')]+_0x1192d2[_0x0e36('0x1c')]+_0x1192d2[_0x0e36('0x1d')]+_0x1192d2[_0x0e36('0x1e')]+_0x1192d2[_0x0e36('0x1f')]+_0x1192d2[_0x0e36('0x20')]+_0x1192d2[_0x0e36('0x21')]<_0x5e83ba['entity'][_0x0e36('0x22')])_0x8ff1e2=0x1;_0x4e49b4({'additional':_0x8ff1e2});}else{return db[_0x0e36('0x17')][_0x0e36('0x11')]({'raw':!![],'where':{'CmHopperId':_0x56bfdf['id']},'order':[['OrderBy','ASC']]})[_0x0e36('0x7')](function(_0xe3395f){var _0x3e9dba=0x0;if(_0xe3395f){if(_0xe3395f[_0x0e36('0x1a')]+_0xe3395f[_0x0e36('0x1b')]+_0xe3395f[_0x0e36('0x1c')]+_0xe3395f[_0x0e36('0x1d')]+_0xe3395f[_0x0e36('0x1e')]+_0xe3395f['countabandonedretry']+_0xe3395f[_0x0e36('0x20')]+_0xe3395f[_0x0e36('0x21')]<_0x5e83ba[_0x0e36('0x23')][_0x0e36('0x22')])_0x3e9dba=0x1;_0x4e49b4({'additional':_0x3e9dba});}else{_0x4e49b4({'additional':0x0});}})[_0x0e36('0x24')](function(_0x389986){logger[_0x0e36('0xc')]('VerifyAdditionalPhones',_0x389986[_0x0e36('0xe')]);_0x3fdc1f(_0x42f25c[_0x0e36('0xc')](0x1f4,_0x389986[_0x0e36('0xe')]));});}})[_0x0e36('0x24')](function(_0x9745dd){logger[_0x0e36('0xc')](_0x0e36('0x10'),_0x9745dd['message']);_0x3fdc1f(_0x42f25c['error'](0x1f4,_0x9745dd['message']));});}else _0x4e49b4({'additional':0x0});});});};exports[_0x0e36('0x25')]=function(_0x50fe3c){var _0x3bf156=this;return new Promise(function(_0x69ab31,_0x454255){return db['CmHopper'][_0x0e36('0x11')]({'raw':!![],'where':{'ContactId':_0x50fe3c[_0x0e36('0x13')]['ContactId'],'ListId':_0x50fe3c[_0x0e36('0x13')][_0x0e36('0x14')],'VoiceQueueId':_0x50fe3c[_0x0e36('0x13')][_0x0e36('0x15')]===undefined?null:_0x50fe3c[_0x0e36('0x13')][_0x0e36('0x15')],'CampaignId':_0x50fe3c['body'][_0x0e36('0x16')]===undefined?null:_0x50fe3c['body'][_0x0e36('0x16')]}})[_0x0e36('0x7')](function(_0x1bf8a6){if(_0x1bf8a6!=null){return db[_0x0e36('0x17')][_0x0e36('0x11')]({'raw':!![],'where':{'CmHopperId':_0x1bf8a6['id'],'OrderBy':{'$gte':_0x1bf8a6[_0x0e36('0x18')]}},'order':[[_0x0e36('0x18'),_0x0e36('0x19')]]})[_0x0e36('0x7')](function(_0x332095){if(_0x332095)return activateAdditionalPhone(_0x1bf8a6,_0x50fe3c[_0x0e36('0x13')],_0x332095,_0x50fe3c['duration'],_0x50fe3c[_0x0e36('0x26')])[_0x0e36('0x7')](function(_0x4eef21){_0x69ab31(_0x4eef21);});else{return db['CmHopperAdditionalPhone'][_0x0e36('0x11')]({'raw':!![],'where':{'CmHopperId':_0x1bf8a6['id']},'order':[[_0x0e36('0x18'),_0x0e36('0x19')]]})[_0x0e36('0x7')](function(_0x4080c3){if(_0x4080c3)return activateAdditionalPhone(_0x1bf8a6,_0x50fe3c[_0x0e36('0x13')],_0x4080c3,_0x50fe3c[_0x0e36('0x27')],_0x50fe3c['waitTime'])[_0x0e36('0x7')](function(_0x2a38e3){_0x69ab31(_0x2a38e3);});else{_0x69ab31({'id':_0x1bf8a6['id'],'phone':''});}})[_0x0e36('0x24')](function(_0x590e7b){logger[_0x0e36('0xc')](_0x0e36('0x10'),_0x590e7b[_0x0e36('0xe')]);_0x454255(_0x3bf156['error'](0x1f4,_0x590e7b[_0x0e36('0xe')]));});}})[_0x0e36('0x24')](function(_0x5371bc){logger['error'](_0x0e36('0x10'),_0x5371bc[_0x0e36('0xe')]);_0x454255(_0x3bf156[_0x0e36('0xc')](0x1f4,_0x5371bc[_0x0e36('0xe')]));});}else _0x69ab31(0x1);});});};function activateAdditionalPhone(_0x20620d,_0x4b4abc,_0x4a1d75,_0x171080,_0x3ccfba){return new Promise(function(_0x5b3a32,_0x52102c){var _0x2b32ea;if(_['isNil'](_0x4a1d75[_0x0e36('0x28')])){_0x4a1d75[_0x0e36('0x28')]=moment();}if(moment()>moment(_0x4a1d75[_0x0e36('0x28')])){_0x2b32ea=moment()[_0x0e36('0x29')](_0x3ccfba||0x3,_0x0e36('0x2a'));}else{if(_0x4a1d75[_0x0e36('0x18')]==0x0){_0x2b32ea=moment(_0x4a1d75['scheduledat']);}else{_0x2b32ea=moment()[_0x0e36('0x29')](_0x3ccfba||0x3,'minutes');}}if(_[_0x0e36('0x2b')](_0x2b32ea)){_0x2b32ea=moment()['add'](_0x3ccfba||0x3,'minutes');}var _0xecfdb5={'phone':_0x20620d[_0x0e36('0x2c')],'active':0x0,'OrderBy':_[_0x0e36('0x2b')](_0x20620d[_0x0e36('0x18')])?0x0:_0x20620d[_0x0e36('0x18')],'scheduledat':moment()[_0x0e36('0x29')](_0x171080||0x1,_0x0e36('0x2a')),'countbusyretry':_0x4b4abc[_0x0e36('0x1a')],'countcongestionretry':_0x4b4abc[_0x0e36('0x1b')],'countnoanswerretry':_0x4b4abc[_0x0e36('0x1c')],'countnosuchnumberretry':_0x4b4abc[_0x0e36('0x1d')],'countdropretry':_0x4b4abc['countdropretry'],'countabandonedretry':_0x4b4abc['countabandonedretry'],'countmachineretry':_0x4b4abc[_0x0e36('0x20')],'countagentrejectretry':_0x4b4abc[_0x0e36('0x21')],'createdAt':_0x4b4abc[_0x0e36('0x2d')],'updatedAt':_0x4b4abc[_0x0e36('0x2e')]};var _0x30980c={'CmHopperId':_0x20620d['id'],'phone':_0x4a1d75[_0x0e36('0x2c')],'active':0x0,'OrderBy':_[_0x0e36('0x2b')](_0x4a1d75[_0x0e36('0x18')])?0x0:_0x4a1d75[_0x0e36('0x18')],'scheduledat':_0x2b32ea,'countbusyretry':_0x4a1d75[_0x0e36('0x1a')],'countcongestionretry':_0x4a1d75[_0x0e36('0x1b')],'countnoanswerretry':_0x4a1d75[_0x0e36('0x1c')],'countnosuchnumberretry':_0x4a1d75[_0x0e36('0x1d')],'countdropretry':_0x4a1d75[_0x0e36('0x1e')],'countabandonedretry':_0x4a1d75[_0x0e36('0x1f')],'countmachineretry':_0x4a1d75['countmachineretry'],'countagentrejectretry':_0x4a1d75[_0x0e36('0x21')],'createdAt':_0x4a1d75[_0x0e36('0x2d')],'updatedAt':_0x4a1d75[_0x0e36('0x2e')]};return db['sequelize'][_0x0e36('0x2f')](function(_0x4e98a5){return db[_0x0e36('0x17')][_0x0e36('0x30')](_0xecfdb5,{'where':{'id':_0x4a1d75['id']}},{'transaction':_0x4e98a5})['then'](function(){return db['CmHopper'][_0x0e36('0x30')](_0x30980c,{'where':{'id':_0x20620d['id']}},{'transaction':_0x4e98a5});});})[_0x0e36('0x7')](function(_0x187631){_0x5b3a32({'id':_0x20620d['id'],'phone':_0x4a1d75[_0x0e36('0x2c')]});})[_0x0e36('0x24')](function(_0x1b5556){logger[_0x0e36('0xc')](_0x0e36('0x31'),_0x1b5556[_0x0e36('0xe')]);_0x52102c({'error':_0x1b5556['message']});});});}exports[_0x0e36('0x32')]=function(_0x8132dc){var _0x3a871e=this;return new Promise(function(_0x85b1b5,_0x45a5ba){return db[_0x0e36('0x33')][_0x0e36('0x30')](_0x8132dc['body'][_0x0e36('0x34')],{'where':{'id':_0x8132dc[_0x0e36('0x13')]['id']}})[_0x0e36('0x7')](function(_0x252d32){_0x85b1b5(_0x252d32);})[_0x0e36('0x24')](function(_0x157ce0){logger[_0x0e36('0xc')]('IncrementPreviewCounters',_0x157ce0['message']);_0x45a5ba(_0x3a871e[_0x0e36('0xc')](0x1f4,_0x157ce0[_0x0e36('0xe')]));});});}; \ No newline at end of file +var _0xa52d=['update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','findOne','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','add','minutes','isNil','phone','countcongestionretry','createdAt','updatedAt'];(function(_0x8b6b,_0x4bb6f9){var _0x58791d=function(_0x5b6bc2){while(--_0x5b6bc2){_0x8b6b['push'](_0x8b6b['shift']());}};_0x58791d(++_0x4bb6f9);}(_0xa52d,0x6e));var _0xda52=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xa52d[_0x2f57b2];return _0x5ace77;};'use strict';var _=require(_0xda52('0x0'));var util=require('util');var moment=require(_0xda52('0x1'));var BPromise=require(_0xda52('0x2'));var rs=require(_0xda52('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda52('0x4'))['db'];var utils=require(_0xda52('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xda52('0x6'));var client=jayson[_0xda52('0x7')][_0xda52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x198bd7,_0xbc4cd4,_0x23c16c){return new BPromise(function(_0xf186db,_0x571134){return client['request'](_0x198bd7,_0x23c16c)['then'](function(_0xd615b3){logger[_0xda52('0x9')](_0xda52('0xa'),_0xbc4cd4,'request\x20sent');logger[_0xda52('0xb')](_0xda52('0xc'),_0xbc4cd4,'request\x20sent',JSON['stringify'](_0xd615b3));if(_0xd615b3[_0xda52('0xd')]){if(_0xd615b3[_0xda52('0xd')]['code']===0x1f4){logger[_0xda52('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xbc4cd4,_0xd615b3[_0xda52('0xd')]['message']);return _0x571134(_0xd615b3[_0xda52('0xd')][_0xda52('0xe')]);}logger['error'](_0xda52('0xa'),_0xbc4cd4,_0xd615b3[_0xda52('0xd')][_0xda52('0xe')]);return _0xf186db(_0xd615b3['error'][_0xda52('0xe')]);}else{logger[_0xda52('0x9')](_0xda52('0xa'),_0xbc4cd4,_0xda52('0xf'));_0xf186db(_0xd615b3[_0xda52('0x10')]['message']);}})[_0xda52('0x11')](function(_0x2ac8cb){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xbc4cd4,_0x2ac8cb);_0x571134(_0x2ac8cb);});});}exports['VerifyAdditionalPhones']=function(_0x4f9614){var _0xc86fae=this;return new Promise(function(_0x14b27d,_0x3a7940){return db['CmHopper'][_0xda52('0x12')]({'raw':!![],'where':{'ContactId':_0x4f9614[_0xda52('0x13')]['ContactId'],'ListId':_0x4f9614[_0xda52('0x13')][_0xda52('0x14')],'VoiceQueueId':_0x4f9614['body'][_0xda52('0x15')]===undefined?null:_0x4f9614[_0xda52('0x13')]['VoiceQueueId'],'CampaignId':_0x4f9614['body']['CampaignId']===undefined?null:_0x4f9614[_0xda52('0x13')][_0xda52('0x16')]}})[_0xda52('0x17')](function(_0x439844){if(_0x439844!=null){return db[_0xda52('0x18')][_0xda52('0x12')]({'raw':!![],'where':{'CmHopperId':_0x439844['id'],'OrderBy':{'$gt':_0x439844[_0xda52('0x19')]}},'order':[[_0xda52('0x19'),_0xda52('0x1a')]]})[_0xda52('0x17')](function(_0x232e6){var _0x39a78a=0x0;if(_0x232e6){if(_0x232e6[_0xda52('0x1b')]+_0x232e6['countcongestionretry']+_0x232e6[_0xda52('0x1c')]+_0x232e6[_0xda52('0x1d')]+_0x232e6[_0xda52('0x1e')]+_0x232e6[_0xda52('0x1f')]+_0x232e6[_0xda52('0x20')]+_0x232e6[_0xda52('0x21')]<_0x4f9614[_0xda52('0x22')][_0xda52('0x23')])_0x39a78a=0x1;_0x14b27d({'additional':_0x39a78a});}else{return db[_0xda52('0x18')][_0xda52('0x12')]({'raw':!![],'where':{'CmHopperId':_0x439844['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x1200cf){var _0x14ba47=0x0;if(_0x1200cf){if(_0x1200cf[_0xda52('0x1b')]+_0x1200cf['countcongestionretry']+_0x1200cf[_0xda52('0x1c')]+_0x1200cf[_0xda52('0x1d')]+_0x1200cf[_0xda52('0x1e')]+_0x1200cf[_0xda52('0x1f')]+_0x1200cf[_0xda52('0x20')]+_0x1200cf[_0xda52('0x21')]<_0x4f9614[_0xda52('0x22')][_0xda52('0x23')])_0x14ba47=0x1;_0x14b27d({'additional':_0x14ba47});}else{_0x14b27d({'additional':0x0});}})[_0xda52('0x11')](function(_0x5f5b72){logger[_0xda52('0xd')](_0xda52('0x24'),_0x5f5b72[_0xda52('0xe')]);_0x3a7940(_0xc86fae['error'](0x1f4,_0x5f5b72[_0xda52('0xe')]));});}})[_0xda52('0x11')](function(_0x10ef4f){logger[_0xda52('0xd')]('VerifyAdditionalPhones',_0x10ef4f['message']);_0x3a7940(_0xc86fae[_0xda52('0xd')](0x1f4,_0x10ef4f[_0xda52('0xe')]));});}else _0x14b27d({'additional':0x0});});});};exports[_0xda52('0x25')]=function(_0x5029ea){var _0x1cdd3b=this;return new Promise(function(_0xb62c4,_0x5b06ea){return db[_0xda52('0x26')][_0xda52('0x12')]({'raw':!![],'where':{'ContactId':_0x5029ea[_0xda52('0x13')]['ContactId'],'ListId':_0x5029ea[_0xda52('0x13')][_0xda52('0x14')],'VoiceQueueId':_0x5029ea['body'][_0xda52('0x15')]===undefined?null:_0x5029ea[_0xda52('0x13')][_0xda52('0x15')],'CampaignId':_0x5029ea[_0xda52('0x13')][_0xda52('0x16')]===undefined?null:_0x5029ea['body'][_0xda52('0x16')]}})[_0xda52('0x17')](function(_0x15afd0){if(_0x15afd0!=null){return db[_0xda52('0x18')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x15afd0['id'],'OrderBy':{'$gte':_0x15afd0[_0xda52('0x19')]}},'order':[[_0xda52('0x19'),_0xda52('0x1a')]]})[_0xda52('0x17')](function(_0xa9865e){if(_0xa9865e)return activateAdditionalPhone(_0x15afd0,_0x5029ea[_0xda52('0x13')],_0xa9865e,_0x5029ea[_0xda52('0x27')],_0x5029ea[_0xda52('0x28')])[_0xda52('0x17')](function(_0x569339){_0xb62c4(_0x569339);});else{return db['CmHopperAdditionalPhone'][_0xda52('0x12')]({'raw':!![],'where':{'CmHopperId':_0x15afd0['id']},'order':[[_0xda52('0x19'),'ASC']]})[_0xda52('0x17')](function(_0x4c9a29){if(_0x4c9a29)return activateAdditionalPhone(_0x15afd0,_0x5029ea[_0xda52('0x13')],_0x4c9a29,_0x5029ea[_0xda52('0x27')],_0x5029ea[_0xda52('0x28')])['then'](function(_0x3c5e73){_0xb62c4(_0x3c5e73);});else{_0xb62c4({'id':_0x15afd0['id'],'phone':''});}})[_0xda52('0x11')](function(_0x1bb655){logger[_0xda52('0xd')](_0xda52('0x24'),_0x1bb655['message']);_0x5b06ea(_0x1cdd3b[_0xda52('0xd')](0x1f4,_0x1bb655[_0xda52('0xe')]));});}})[_0xda52('0x11')](function(_0xea8325){logger[_0xda52('0xd')](_0xda52('0x24'),_0xea8325['message']);_0x5b06ea(_0x1cdd3b[_0xda52('0xd')](0x1f4,_0xea8325[_0xda52('0xe')]));});}else _0xb62c4(0x1);});});};function activateAdditionalPhone(_0x8e01e3,_0x19faba,_0x480a48,_0xf9956e,_0x113da4){return new Promise(function(_0x59ba67,_0x2dafd8){var _0x2940d9;if(_['isNil'](_0x480a48[_0xda52('0x29')])){_0x480a48[_0xda52('0x29')]=moment();}if(moment()>moment(_0x480a48[_0xda52('0x29')])){_0x2940d9=moment()[_0xda52('0x2a')](_0x113da4||0x3,'minutes');}else{if(_0x480a48[_0xda52('0x19')]==0x0){_0x2940d9=moment(_0x480a48[_0xda52('0x29')]);}else{_0x2940d9=moment()[_0xda52('0x2a')](_0x113da4||0x3,_0xda52('0x2b'));}}if(_[_0xda52('0x2c')](_0x2940d9)){_0x2940d9=moment()[_0xda52('0x2a')](_0x113da4||0x3,_0xda52('0x2b'));}var _0xd3dd8={'phone':_0x8e01e3[_0xda52('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x8e01e3[_0xda52('0x19')])?0x0:_0x8e01e3[_0xda52('0x19')],'scheduledat':moment()[_0xda52('0x2a')](_0xf9956e||0x1,_0xda52('0x2b')),'countbusyretry':_0x19faba['countbusyretry'],'countcongestionretry':_0x19faba[_0xda52('0x2e')],'countnoanswerretry':_0x19faba[_0xda52('0x1c')],'countnosuchnumberretry':_0x19faba[_0xda52('0x1d')],'countdropretry':_0x19faba[_0xda52('0x1e')],'countabandonedretry':_0x19faba['countabandonedretry'],'countmachineretry':_0x19faba[_0xda52('0x20')],'countagentrejectretry':_0x19faba['countagentrejectretry'],'createdAt':_0x19faba[_0xda52('0x2f')],'updatedAt':_0x19faba[_0xda52('0x30')]};var _0x2548fc={'CmHopperId':_0x8e01e3['id'],'phone':_0x480a48[_0xda52('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x480a48['OrderBy'])?0x0:_0x480a48[_0xda52('0x19')],'scheduledat':_0x2940d9,'countbusyretry':_0x480a48[_0xda52('0x1b')],'countcongestionretry':_0x480a48[_0xda52('0x2e')],'countnoanswerretry':_0x480a48[_0xda52('0x1c')],'countnosuchnumberretry':_0x480a48[_0xda52('0x1d')],'countdropretry':_0x480a48[_0xda52('0x1e')],'countabandonedretry':_0x480a48[_0xda52('0x1f')],'countmachineretry':_0x480a48[_0xda52('0x20')],'countagentrejectretry':_0x480a48[_0xda52('0x21')],'createdAt':_0x480a48[_0xda52('0x2f')],'updatedAt':_0x480a48['updatedAt']};return db['sequelize']['transaction'](function(_0x507e60){return db[_0xda52('0x18')][_0xda52('0x31')](_0xd3dd8,{'where':{'id':_0x480a48['id']}},{'transaction':_0x507e60})[_0xda52('0x17')](function(){return db[_0xda52('0x26')][_0xda52('0x31')](_0x2548fc,{'where':{'id':_0x8e01e3['id']}},{'transaction':_0x507e60});});})[_0xda52('0x17')](function(_0xd91676){_0x59ba67({'id':_0x8e01e3['id'],'phone':_0x480a48['phone']});})[_0xda52('0x11')](function(_0x171e1d){logger['error'](_0xda52('0x32'),_0x171e1d[_0xda52('0xe')]);_0x2dafd8({'error':_0x171e1d[_0xda52('0xe')]});});});}exports[_0xda52('0x33')]=function(_0x18e7fc){var _0x5706b6=this;return new Promise(function(_0x605d69,_0x44dbab){return db[_0xda52('0x26')][_0xda52('0x31')](_0x18e7fc[_0xda52('0x13')][_0xda52('0x34')],{'where':{'id':_0x18e7fc['body']['id']}})[_0xda52('0x17')](function(_0x3aea68){_0x605d69(_0x3aea68);})[_0xda52('0x11')](function(_0x18e490){logger['error'](_0xda52('0x33'),_0x18e490[_0xda52('0xe')]);_0x44dbab(_0x5706b6[_0xda52('0xd')](0x1f4,_0x18e490[_0xda52('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1c32b14..ab01618 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 _0xc06e=['/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x5b35a3,_0x24fb74){var _0x4c4ccd=function(_0x363cb0){while(--_0x363cb0){_0x5b35a3['push'](_0x5b35a3['shift']());}};_0x4c4ccd(++_0x24fb74);}(_0xc06e,0xd5));var _0xec06=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0xc06e[_0x212bf5];return _0xfcad21;};'use strict';var multer=require(_0xec06('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec06('0x1'));var express=require(_0xec06('0x2'));var router=express[_0xec06('0x3')]();var fs_extra=require(_0xec06('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec06('0x5'));var config=require(_0xec06('0x6'));var controller=require(_0xec06('0x7'));router[_0xec06('0x8')]('/',auth[_0xec06('0x9')](),controller[_0xec06('0xa')]);router['get']('/:id',auth[_0xec06('0x9')](),controller[_0xec06('0xb')]);router[_0xec06('0xc')]('/',auth['isAuthenticated'](),controller[_0xec06('0xd')]);router[_0xec06('0xe')](_0xec06('0xf'),auth[_0xec06('0x9')](),controller[_0xec06('0x10')]);router[_0xec06('0x11')](_0xec06('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xec06('0x12')]=router; \ No newline at end of file +var _0x09e4=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','update','delete'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x09e4,0x1ce));var _0x409e=function(_0x2a8fae,_0x54fd0d){_0x2a8fae=_0x2a8fae-0x0;var _0x29a1fa=_0x09e4[_0x2a8fae];return _0x29a1fa;};'use strict';var multer=require(_0x409e('0x0'));var util=require(_0x409e('0x1'));var path=require(_0x409e('0x2'));var timeout=require(_0x409e('0x3'));var express=require(_0x409e('0x4'));var router=express[_0x409e('0x5')]();var fs_extra=require(_0x409e('0x6'));var auth=require(_0x409e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x409e('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x409e('0x9')](),controller[_0x409e('0xa')]);router[_0x409e('0xb')](_0x409e('0xc'),auth['isAuthenticated'](),controller[_0x409e('0xd')]);router[_0x409e('0xe')]('/',auth[_0x409e('0x9')](),controller[_0x409e('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x409e('0x10')]);router[_0x409e('0x11')](_0x409e('0xc'),auth['isAuthenticated'](),controller[_0x409e('0x12')]);module[_0x409e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ae02835..1a666c8 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 _0xbdb9=['STRING','INTEGER','moment','sequelize','exports'];(function(_0x209cc0,_0x59bb37){var _0x3c5029=function(_0x39c02f){while(--_0x39c02f){_0x209cc0['push'](_0x209cc0['shift']());}};_0x3c5029(++_0x59bb37);}(_0xbdb9,0xac));var _0x9bdb=function(_0x468895,_0x4f3be9){_0x468895=_0x468895-0x0;var _0x25578d=_0xbdb9[_0x468895];return _0x25578d;};'use strict';var moment=require(_0x9bdb('0x0'));var Sequelize=require(_0x9bdb('0x1'));module[_0x9bdb('0x2')]={'phone':{'type':Sequelize[_0x9bdb('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9bdb('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9bdb('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x603f=['contactListQueue','moment','exports','STRING','INTEGER'];(function(_0x401199,_0x2a107d){var _0x4205a8=function(_0x58cbb2){while(--_0x58cbb2){_0x401199['push'](_0x401199['shift']());}};_0x4205a8(++_0x2a107d);}(_0x603f,0x65));var _0xf603=function(_0x26b22a,_0xbe44a8){_0x26b22a=_0x26b22a-0x0;var _0x1cf0d0=_0x603f[_0x26b22a];return _0x1cf0d0;};'use strict';var moment=require(_0xf603('0x0'));var Sequelize=require('sequelize');module[_0xf603('0x1')]={'phone':{'type':Sequelize[_0xf603('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf603('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xf603('0x3')],'unique':_0xf603('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xf603('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c1b68c7..4194954 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 _0xab47=['json','save','then','destroy','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','update','body','find','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xab47,0xb1));var _0x7ab4=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xab47[_0x39872b];return _0x55fa18;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7ab4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ab4('0x1'));var moment=require(_0x7ab4('0x2'));var BPromise=require(_0x7ab4('0x3'));var Mustache=require(_0x7ab4('0x4'));var util=require(_0x7ab4('0x5'));var path=require(_0x7ab4('0x6'));var sox=require(_0x7ab4('0x7'));var csv=require(_0x7ab4('0x8'));var ejs=require(_0x7ab4('0x9'));var fs=require('fs');var fs_extra=require(_0x7ab4('0xa'));var _=require(_0x7ab4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ab4('0xc'));var deskjs=require(_0x7ab4('0xd'));var toCsv=require(_0x7ab4('0x8'));var querystring=require(_0x7ab4('0xe'));var Papa=require(_0x7ab4('0xf'));var Redis=require(_0x7ab4('0x10'));var authService=require(_0x7ab4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ab4('0x12'));var logger=require('../../config/logger')(_0x7ab4('0x13'));var utils=require('../../config/utils');var config=require(_0x7ab4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ab4('0x15'))['db'];function respondWithStatusCode(_0x4d394c,_0x5cfb0a){_0x5cfb0a=_0x5cfb0a||0xcc;return function(_0x504b89){if(_0x504b89){return _0x4d394c[_0x7ab4('0x16')](_0x5cfb0a);}return _0x4d394c[_0x7ab4('0x17')](_0x5cfb0a)[_0x7ab4('0x18')]();};}function respondWithResult(_0x5df9ab,_0x50a2d3){_0x50a2d3=_0x50a2d3||0xc8;return function(_0x93312b){if(_0x93312b){return _0x5df9ab[_0x7ab4('0x17')](_0x50a2d3)['json'](_0x93312b);}};}function respondWithFilteredResult(_0x3cf75a,_0xa1c5f7){return function(_0x300f1d){if(_0x300f1d){var _0x4c2162=typeof _0xa1c5f7[_0x7ab4('0x19')]===_0x7ab4('0x1a')&&typeof _0xa1c5f7[_0x7ab4('0x1b')]==='undefined';var _0x4b7da9=_0x300f1d['count'];var _0x58fe44=_0x4c2162?0x0:_0xa1c5f7[_0x7ab4('0x19')];var _0x4a662d=_0x4c2162?_0x300f1d[_0x7ab4('0x1c')]:_0xa1c5f7['offset']+_0xa1c5f7[_0x7ab4('0x1b')];var _0x3d42c6;if(_0x4a662d>=_0x4b7da9){_0x4a662d=_0x4b7da9;_0x3d42c6=0xc8;}else{_0x3d42c6=0xce;}_0x3cf75a['status'](_0x3d42c6);return _0x3cf75a['set'](_0x7ab4('0x1d'),_0x58fe44+'-'+_0x4a662d+'/'+_0x4b7da9)[_0x7ab4('0x1e')](_0x300f1d);}return null;};}function patchUpdates(_0xe50487){return function(_0x2eb20a){try{jsonpatch['apply'](_0x2eb20a,_0xe50487,!![]);}catch(_0x1ccc3e){return BPromise['reject'](_0x1ccc3e);}return _0x2eb20a[_0x7ab4('0x1f')]();};}function saveUpdates(_0x36b532,_0x307021){return function(_0x144850){if(_0x144850){return _0x144850['update'](_0x36b532)[_0x7ab4('0x20')](function(_0x1dbcdb){return _0x1dbcdb;});}return null;};}function removeEntity(_0x4d511f,_0x2aa5c5){return function(_0x41d72b){if(_0x41d72b){return _0x41d72b[_0x7ab4('0x21')]()[_0x7ab4('0x20')](function(){_0x4d511f[_0x7ab4('0x17')](0xcc)[_0x7ab4('0x18')]();});}};}function handleEntityNotFound(_0x1a2e52,_0x4763bd){return function(_0x529497){if(!_0x529497){_0x1a2e52['sendStatus'](0x194);}return _0x529497;};}function handleError(_0x5bd319,_0x42dc68){_0x42dc68=_0x42dc68||0x1f4;return function(_0x5c07bc){logger[_0x7ab4('0x22')](_0x5c07bc[_0x7ab4('0x23')]);if(_0x5c07bc[_0x7ab4('0x24')]){delete _0x5c07bc['name'];}_0x5bd319[_0x7ab4('0x17')](_0x42dc68)[_0x7ab4('0x25')](_0x5c07bc);};}exports[_0x7ab4('0x26')]=function(_0x5283c6,_0x25e7ae){var _0xabafa2={},_0x217d07={},_0xed2a3f={'count':0x0,'rows':[]};var _0x1da2ec=_[_0x7ab4('0x27')](db[_0x7ab4('0x28')]['rawAttributes'],function(_0x29d929){return{'name':_0x29d929[_0x7ab4('0x29')],'type':_0x29d929[_0x7ab4('0x2a')]['key']};});_0x217d07[_0x7ab4('0x2b')]=_[_0x7ab4('0x27')](_0x1da2ec,_0x7ab4('0x24'));_0x217d07[_0x7ab4('0x2c')]=_['keys'](_0x5283c6['query']);_0x217d07[_0x7ab4('0x2d')]=_[_0x7ab4('0x2e')](_0x217d07['model'],_0x217d07[_0x7ab4('0x2c')]);_0xabafa2[_0x7ab4('0x2f')]=_[_0x7ab4('0x2e')](_0x217d07[_0x7ab4('0x2b')],qs[_0x7ab4('0x30')](_0x5283c6[_0x7ab4('0x2c')]['fields']));_0xabafa2['attributes']=_0xabafa2[_0x7ab4('0x2f')][_0x7ab4('0x31')]?_0xabafa2['attributes']:_0x217d07['model'];if(!_0x5283c6['query'][_0x7ab4('0x32')](_0x7ab4('0x33'))){_0xabafa2[_0x7ab4('0x1b')]=qs[_0x7ab4('0x1b')](_0x5283c6[_0x7ab4('0x2c')]['limit']);_0xabafa2[_0x7ab4('0x19')]=qs['offset'](_0x5283c6[_0x7ab4('0x2c')][_0x7ab4('0x19')]);}_0xabafa2[_0x7ab4('0x34')]=qs[_0x7ab4('0x35')](_0x5283c6[_0x7ab4('0x2c')]['sort']);_0xabafa2[_0x7ab4('0x36')]=qs[_0x7ab4('0x2d')](_['pick'](_0x5283c6[_0x7ab4('0x2c')],_0x217d07[_0x7ab4('0x2d')]),_0x1da2ec);if(_0x5283c6[_0x7ab4('0x2c')][_0x7ab4('0x37')]){_0xabafa2['where']=_[_0x7ab4('0x38')](_0xabafa2[_0x7ab4('0x36')],{'$or':_[_0x7ab4('0x27')](_0x1da2ec,function(_0x35b115){if(_0x35b115[_0x7ab4('0x2a')]!=='VIRTUAL'){var _0x4f1c35={};_0x4f1c35[_0x35b115[_0x7ab4('0x24')]]={'$like':'%'+_0x5283c6[_0x7ab4('0x2c')]['filter']+'%'};return _0x4f1c35;}})});}_0xabafa2=_['merge']({},_0xabafa2,_0x5283c6[_0x7ab4('0x39')]);var _0x121128={'where':_0xabafa2['where']};return db[_0x7ab4('0x28')][_0x7ab4('0x1c')](_0x121128)[_0x7ab4('0x20')](function(_0x47a2f5){_0xed2a3f[_0x7ab4('0x1c')]=_0x47a2f5;if(_0x5283c6[_0x7ab4('0x2c')][_0x7ab4('0x3a')]){_0xabafa2[_0x7ab4('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7ab4('0x3c')](_0xabafa2);})[_0x7ab4('0x20')](function(_0xa986b8){_0xed2a3f[_0x7ab4('0x3d')]=_0xa986b8;return _0xed2a3f;})[_0x7ab4('0x20')](respondWithFilteredResult(_0x25e7ae,_0xabafa2))[_0x7ab4('0x3e')](handleError(_0x25e7ae,null));};exports['show']=function(_0xf7dd12,_0x14308b){var _0x6f21dc={'raw':!![],'where':{'id':_0xf7dd12[_0x7ab4('0x3f')]['id']}},_0x17d6f2={};_0x17d6f2[_0x7ab4('0x2b')]=_['keys'](db[_0x7ab4('0x28')][_0x7ab4('0x40')]);_0x17d6f2['query']=_['keys'](_0xf7dd12[_0x7ab4('0x2c')]);_0x17d6f2[_0x7ab4('0x2d')]=_[_0x7ab4('0x2e')](_0x17d6f2[_0x7ab4('0x2b')],_0x17d6f2[_0x7ab4('0x2c')]);_0x6f21dc[_0x7ab4('0x2f')]=_[_0x7ab4('0x2e')](_0x17d6f2[_0x7ab4('0x2b')],qs[_0x7ab4('0x30')](_0xf7dd12['query']['fields']));_0x6f21dc['attributes']=_0x6f21dc[_0x7ab4('0x2f')][_0x7ab4('0x31')]?_0x6f21dc[_0x7ab4('0x2f')]:_0x17d6f2[_0x7ab4('0x2b')];if(_0xf7dd12['query'][_0x7ab4('0x3a')]){_0x6f21dc['include']=[{'all':!![]}];}_0x6f21dc=_[_0x7ab4('0x38')]({},_0x6f21dc,_0xf7dd12[_0x7ab4('0x39')]);return db['CmHopperBlack']['find'](_0x6f21dc)['then'](handleEntityNotFound(_0x14308b,null))[_0x7ab4('0x20')](respondWithResult(_0x14308b,null))[_0x7ab4('0x3e')](handleError(_0x14308b,null));};exports[_0x7ab4('0x41')]=function(_0x3666e3,_0x3a6664){if(_0x3666e3[_0x7ab4('0x42')]['id']){delete _0x3666e3[_0x7ab4('0x42')]['id'];}return db[_0x7ab4('0x28')][_0x7ab4('0x43')]({'where':{'id':_0x3666e3[_0x7ab4('0x3f')]['id']}})[_0x7ab4('0x20')](handleEntityNotFound(_0x3a6664,null))[_0x7ab4('0x20')](saveUpdates(_0x3666e3[_0x7ab4('0x42')],null))[_0x7ab4('0x20')](respondWithResult(_0x3a6664,null))['catch'](handleError(_0x3a6664,null));};exports[_0x7ab4('0x21')]=function(_0x409f96,_0x1b2236){return db[_0x7ab4('0x28')][_0x7ab4('0x43')]({'where':{'id':_0x409f96['params']['id']}})[_0x7ab4('0x20')](handleEntityNotFound(_0x1b2236,null))[_0x7ab4('0x20')](removeEntity(_0x1b2236,null))[_0x7ab4('0x3e')](handleError(_0x1b2236,null));};exports[_0x7ab4('0x44')]=function(_0x2c8285,_0x2939ef){return db[_0x7ab4('0x28')][_0x7ab4('0x44')]()['then'](respondWithResult(_0x2939ef,null))[_0x7ab4('0x3e')](handleError(_0x2939ef,null));}; \ No newline at end of file +var _0x2d85=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','index','map','CmHopperBlack','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','body','describe'];(function(_0x36cb4d,_0x2dc7aa){var _0x35ca7c=function(_0x3e8fbf){while(--_0x3e8fbf){_0x36cb4d['push'](_0x36cb4d['shift']());}};_0x35ca7c(++_0x2dc7aa);}(_0x2d85,0xd8));var _0x52d8=function(_0x16f46a,_0x27de37){_0x16f46a=_0x16f46a-0x0;var _0x48233d=_0x2d85[_0x16f46a];return _0x48233d;};'use strict';var emlformat=require(_0x52d8('0x0'));var rimraf=require(_0x52d8('0x1'));var zipdir=require(_0x52d8('0x2'));var jsonpatch=require(_0x52d8('0x3'));var rp=require(_0x52d8('0x4'));var moment=require('moment');var BPromise=require(_0x52d8('0x5'));var Mustache=require('mustache');var util=require(_0x52d8('0x6'));var path=require(_0x52d8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52d8('0x8'));var _=require(_0x52d8('0x9'));var squel=require(_0x52d8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x52d8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x52d8('0xc'));var Redis=require(_0x52d8('0xd'));var authService=require(_0x52d8('0xe'));var qs=require(_0x52d8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52d8('0x10'));var logger=require(_0x52d8('0x11'))(_0x52d8('0x12'));var utils=require(_0x52d8('0x13'));var config=require(_0x52d8('0x14'));var licenseUtil=require(_0x52d8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1496ef,_0x55aa97){_0x55aa97=_0x55aa97||0xcc;return function(_0x292534){if(_0x292534){return _0x1496ef['sendStatus'](_0x55aa97);}return _0x1496ef[_0x52d8('0x16')](_0x55aa97)[_0x52d8('0x17')]();};}function respondWithResult(_0x1b3a58,_0x5e8010){_0x5e8010=_0x5e8010||0xc8;return function(_0x483d65){if(_0x483d65){return _0x1b3a58[_0x52d8('0x16')](_0x5e8010)[_0x52d8('0x18')](_0x483d65);}};}function respondWithFilteredResult(_0x1913d6,_0x18fb36){return function(_0x47a34c){if(_0x47a34c){var _0x15877b=typeof _0x18fb36[_0x52d8('0x19')]===_0x52d8('0x1a')&&typeof _0x18fb36[_0x52d8('0x1b')]==='undefined';var _0x1dadd6=_0x47a34c[_0x52d8('0x1c')];var _0x2b6685=_0x15877b?0x0:_0x18fb36['offset'];var _0x5a9d84=_0x15877b?_0x47a34c[_0x52d8('0x1c')]:_0x18fb36[_0x52d8('0x19')]+_0x18fb36[_0x52d8('0x1b')];var _0x235868;if(_0x5a9d84>=_0x1dadd6){_0x5a9d84=_0x1dadd6;_0x235868=0xc8;}else{_0x235868=0xce;}_0x1913d6[_0x52d8('0x16')](_0x235868);return _0x1913d6[_0x52d8('0x1d')](_0x52d8('0x1e'),_0x2b6685+'-'+_0x5a9d84+'/'+_0x1dadd6)[_0x52d8('0x18')](_0x47a34c);}return null;};}function patchUpdates(_0x1f10c0){return function(_0x554b0e){try{jsonpatch[_0x52d8('0x1f')](_0x554b0e,_0x1f10c0,!![]);}catch(_0x251dec){return BPromise['reject'](_0x251dec);}return _0x554b0e[_0x52d8('0x20')]();};}function saveUpdates(_0x10663e,_0x470198){return function(_0x167df8){if(_0x167df8){return _0x167df8[_0x52d8('0x21')](_0x10663e)[_0x52d8('0x22')](function(_0x177855){return _0x177855;});}return null;};}function removeEntity(_0x15be85,_0x1cb316){return function(_0x2a5513){if(_0x2a5513){return _0x2a5513[_0x52d8('0x23')]()[_0x52d8('0x22')](function(){_0x15be85[_0x52d8('0x16')](0xcc)[_0x52d8('0x17')]();});}};}function handleEntityNotFound(_0x4dccf9,_0x31617c){return function(_0x490a72){if(!_0x490a72){_0x4dccf9[_0x52d8('0x24')](0x194);}return _0x490a72;};}function handleError(_0xf54d26,_0x3cc660){_0x3cc660=_0x3cc660||0x1f4;return function(_0x4d6e12){logger[_0x52d8('0x25')](_0x4d6e12['stack']);if(_0x4d6e12[_0x52d8('0x26')]){delete _0x4d6e12[_0x52d8('0x26')];}_0xf54d26[_0x52d8('0x16')](_0x3cc660)['send'](_0x4d6e12);};}exports[_0x52d8('0x27')]=function(_0x3b7e4f,_0xc3d2a2){var _0x193fc3={},_0x5d7b99={},_0x4cf733={'count':0x0,'rows':[]};var _0x54c37e=_[_0x52d8('0x28')](db[_0x52d8('0x29')][_0x52d8('0x2a')],function(_0x45574a){return{'name':_0x45574a['fieldName'],'type':_0x45574a[_0x52d8('0x2b')]['key']};});_0x5d7b99[_0x52d8('0x2c')]=_[_0x52d8('0x28')](_0x54c37e,_0x52d8('0x26'));_0x5d7b99[_0x52d8('0x2d')]=_['keys'](_0x3b7e4f[_0x52d8('0x2d')]);_0x5d7b99['filters']=_[_0x52d8('0x2e')](_0x5d7b99[_0x52d8('0x2c')],_0x5d7b99[_0x52d8('0x2d')]);_0x193fc3[_0x52d8('0x2f')]=_[_0x52d8('0x2e')](_0x5d7b99['model'],qs[_0x52d8('0x30')](_0x3b7e4f[_0x52d8('0x2d')][_0x52d8('0x30')]));_0x193fc3[_0x52d8('0x2f')]=_0x193fc3[_0x52d8('0x2f')][_0x52d8('0x31')]?_0x193fc3[_0x52d8('0x2f')]:_0x5d7b99[_0x52d8('0x2c')];if(!_0x3b7e4f['query'][_0x52d8('0x32')](_0x52d8('0x33'))){_0x193fc3[_0x52d8('0x1b')]=qs['limit'](_0x3b7e4f[_0x52d8('0x2d')][_0x52d8('0x1b')]);_0x193fc3[_0x52d8('0x19')]=qs[_0x52d8('0x19')](_0x3b7e4f[_0x52d8('0x2d')][_0x52d8('0x19')]);}_0x193fc3[_0x52d8('0x34')]=qs[_0x52d8('0x35')](_0x3b7e4f[_0x52d8('0x2d')][_0x52d8('0x35')]);_0x193fc3['where']=qs[_0x52d8('0x36')](_[_0x52d8('0x37')](_0x3b7e4f[_0x52d8('0x2d')],_0x5d7b99['filters']),_0x54c37e);if(_0x3b7e4f[_0x52d8('0x2d')]['filter']){_0x193fc3['where']=_[_0x52d8('0x38')](_0x193fc3[_0x52d8('0x39')],{'$or':_['map'](_0x54c37e,function(_0x9f7b48){if(_0x9f7b48[_0x52d8('0x2b')]!==_0x52d8('0x3a')){var _0x1a2411={};_0x1a2411[_0x9f7b48[_0x52d8('0x26')]]={'$like':'%'+_0x3b7e4f[_0x52d8('0x2d')][_0x52d8('0x3b')]+'%'};return _0x1a2411;}})});}_0x193fc3=_['merge']({},_0x193fc3,_0x3b7e4f[_0x52d8('0x3c')]);var _0x275d95={'where':_0x193fc3[_0x52d8('0x39')]};return db[_0x52d8('0x29')][_0x52d8('0x1c')](_0x275d95)[_0x52d8('0x22')](function(_0x1db067){_0x4cf733[_0x52d8('0x1c')]=_0x1db067;if(_0x3b7e4f[_0x52d8('0x2d')][_0x52d8('0x3d')]){_0x193fc3['include']=[{'all':!![]}];}return db[_0x52d8('0x29')][_0x52d8('0x3e')](_0x193fc3);})['then'](function(_0x3c1b46){_0x4cf733[_0x52d8('0x3f')]=_0x3c1b46;return _0x4cf733;})[_0x52d8('0x22')](respondWithFilteredResult(_0xc3d2a2,_0x193fc3))['catch'](handleError(_0xc3d2a2,null));};exports[_0x52d8('0x40')]=function(_0x4597a8,_0x30f8e1){var _0x2ffc61={'raw':!![],'where':{'id':_0x4597a8[_0x52d8('0x41')]['id']}},_0x577470={};_0x577470[_0x52d8('0x2c')]=_[_0x52d8('0x42')](db[_0x52d8('0x29')][_0x52d8('0x2a')]);_0x577470[_0x52d8('0x2d')]=_[_0x52d8('0x42')](_0x4597a8[_0x52d8('0x2d')]);_0x577470[_0x52d8('0x36')]=_[_0x52d8('0x2e')](_0x577470['model'],_0x577470[_0x52d8('0x2d')]);_0x2ffc61['attributes']=_[_0x52d8('0x2e')](_0x577470[_0x52d8('0x2c')],qs['fields'](_0x4597a8[_0x52d8('0x2d')][_0x52d8('0x30')]));_0x2ffc61['attributes']=_0x2ffc61[_0x52d8('0x2f')][_0x52d8('0x31')]?_0x2ffc61[_0x52d8('0x2f')]:_0x577470[_0x52d8('0x2c')];if(_0x4597a8['query'][_0x52d8('0x3d')]){_0x2ffc61[_0x52d8('0x43')]=[{'all':!![]}];}_0x2ffc61=_[_0x52d8('0x38')]({},_0x2ffc61,_0x4597a8[_0x52d8('0x3c')]);return db[_0x52d8('0x29')][_0x52d8('0x44')](_0x2ffc61)[_0x52d8('0x22')](handleEntityNotFound(_0x30f8e1,null))[_0x52d8('0x22')](respondWithResult(_0x30f8e1,null))[_0x52d8('0x45')](handleError(_0x30f8e1,null));};exports[_0x52d8('0x21')]=function(_0x17d437,_0x2a5a14){if(_0x17d437[_0x52d8('0x46')]['id']){delete _0x17d437['body']['id'];}return db[_0x52d8('0x29')][_0x52d8('0x44')]({'where':{'id':_0x17d437[_0x52d8('0x41')]['id']}})[_0x52d8('0x22')](handleEntityNotFound(_0x2a5a14,null))['then'](saveUpdates(_0x17d437[_0x52d8('0x46')],null))[_0x52d8('0x22')](respondWithResult(_0x2a5a14,null))[_0x52d8('0x45')](handleError(_0x2a5a14,null));};exports[_0x52d8('0x23')]=function(_0x43a240,_0xdb94b7){return db[_0x52d8('0x29')][_0x52d8('0x44')]({'where':{'id':_0x43a240[_0x52d8('0x41')]['id']}})[_0x52d8('0x22')](handleEntityNotFound(_0xdb94b7,null))[_0x52d8('0x22')](removeEntity(_0xdb94b7,null))[_0x52d8('0x45')](handleError(_0xdb94b7,null));};exports[_0x52d8('0x47')]=function(_0x3dbed4,_0x228468){return db[_0x52d8('0x29')]['describe']()[_0x52d8('0x22')](respondWithResult(_0x228468,null))['catch'](handleError(_0x228468,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 55e3206..ea3f4d8 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 _0x5b76=['../../config/logger','api','bluebird','request-promise','path','./cmHopperBlack.attributes','exports','CmHopperBlack','util'];(function(_0x376159,_0x5e9290){var _0x508f00=function(_0x160dd7){while(--_0x160dd7){_0x376159['push'](_0x376159['shift']());}};_0x508f00(++_0x5e9290);}(_0x5b76,0xbc));var _0x65b7=function(_0x16dc1c,_0x1bcd2e){_0x16dc1c=_0x16dc1c-0x0;var _0x45f55c=_0x5b76[_0x16dc1c];return _0x45f55c;};'use strict';var _=require('lodash');var util=require(_0x65b7('0x0'));var logger=require(_0x65b7('0x1'))(_0x65b7('0x2'));var moment=require('moment');var BPromise=require(_0x65b7('0x3'));var rp=require(_0x65b7('0x4'));var fs=require('fs');var path=require(_0x65b7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x65b7('0x6'));module[_0x65b7('0x7')]=function(_0x213288,_0x338b8d){return _0x213288['define'](_0x65b7('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20f8=['request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird'];(function(_0x117bd9,_0x173683){var _0x1452e9=function(_0x460744){while(--_0x460744){_0x117bd9['push'](_0x117bd9['shift']());}};_0x1452e9(++_0x173683);}(_0x20f8,0x1b5));var _0x820f=function(_0x5a4c05,_0x6ea13c){_0x5a4c05=_0x5a4c05-0x0;var _0x5bd539=_0x20f8[_0x5a4c05];return _0x5bd539;};'use strict';var _=require('lodash');var util=require(_0x820f('0x0'));var logger=require(_0x820f('0x1'))(_0x820f('0x2'));var moment=require(_0x820f('0x3'));var BPromise=require(_0x820f('0x4'));var rp=require(_0x820f('0x5'));var fs=require('fs');var path=require(_0x820f('0x6'));var rimraf=require(_0x820f('0x7'));var config=require('../../config/environment');var attributes=require(_0x820f('0x8'));module[_0x820f('0x9')]=function(_0x111ced,_0xf62f8e){return _0x111ced[_0x820f('0xa')](_0x820f('0xb'),attributes,{'tableName':_0x820f('0xc'),'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 caff096..12cbb24 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 _0x8eb3=['map','include','stringify','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','findAll','options','where','attributes'];(function(_0x5e570c,_0x233990){var _0xc62527=function(_0xd18777){while(--_0xd18777){_0x5e570c['push'](_0x5e570c['shift']());}};_0xc62527(++_0x233990);}(_0x8eb3,0x1a0));var _0x38eb=function(_0x1d7c73,_0xc61af6){_0x1d7c73=_0x1d7c73-0x0;var _0x236864=_0x8eb3[_0x1d7c73];return _0x236864;};'use strict';var _=require(_0x38eb('0x0'));var util=require('util');var moment=require(_0x38eb('0x1'));var BPromise=require('bluebird');var rs=require(_0x38eb('0x2'));var fs=require('fs');var Redis=require(_0x38eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x38eb('0x4'));var logger=require('../../config/logger')(_0x38eb('0x5'));var config=require('../../config/environment');var jayson=require(_0x38eb('0x6'));var client=jayson[_0x38eb('0x7')][_0x38eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf186ab,_0x5b700e,_0x580ec3){return new BPromise(function(_0x2be36c,_0xbf43db){return client[_0x38eb('0x9')](_0xf186ab,_0x580ec3)[_0x38eb('0xa')](function(_0x3ee047){logger[_0x38eb('0xb')](_0x38eb('0xc'),_0x5b700e,'request\x20sent');logger[_0x38eb('0xd')](_0x38eb('0xe'),_0x5b700e,_0x38eb('0xf'),JSON['stringify'](_0x3ee047));if(_0x3ee047[_0x38eb('0x10')]){if(_0x3ee047[_0x38eb('0x10')][_0x38eb('0x11')]===0x1f4){logger[_0x38eb('0x10')](_0x38eb('0xc'),_0x5b700e,_0x3ee047[_0x38eb('0x10')]['message']);return _0xbf43db(_0x3ee047[_0x38eb('0x10')][_0x38eb('0x12')]);}logger[_0x38eb('0x10')](_0x38eb('0xc'),_0x5b700e,_0x3ee047[_0x38eb('0x10')][_0x38eb('0x12')]);return _0x2be36c(_0x3ee047[_0x38eb('0x10')][_0x38eb('0x12')]);}else{logger[_0x38eb('0xb')](_0x38eb('0xc'),_0x5b700e,_0x38eb('0xf'));_0x2be36c(_0x3ee047[_0x38eb('0x13')][_0x38eb('0x12')]);}})[_0x38eb('0x14')](function(_0x3ab7d1){logger[_0x38eb('0x10')](_0x38eb('0xc'),_0x5b700e,_0x3ab7d1);_0xbf43db(_0x3ab7d1);});});}exports[_0x38eb('0x15')]=function(_0x391f48){var _0x58384c=this;return new Promise(function(_0x3b9afe,_0x4e1c22){return db['CmHopperBlack'][_0x38eb('0x16')]({'raw':_0x391f48[_0x38eb('0x17')]?_0x391f48['options']['raw']===undefined?!![]:![]:!![],'where':_0x391f48[_0x38eb('0x17')]?_0x391f48['options'][_0x38eb('0x18')]||null:null,'attributes':_0x391f48[_0x38eb('0x17')]?_0x391f48[_0x38eb('0x17')][_0x38eb('0x19')]||null:null,'limit':_0x391f48[_0x38eb('0x17')]?_0x391f48[_0x38eb('0x17')]['limit']||null:null,'include':_0x391f48[_0x38eb('0x17')]?_0x391f48[_0x38eb('0x17')]['include']?_[_0x38eb('0x1a')](_0x391f48[_0x38eb('0x17')][_0x38eb('0x1b')],function(_0x5c18a8){return{'model':db[_0x5c18a8['model']],'as':_0x5c18a8['as'],'attributes':_0x5c18a8[_0x38eb('0x19')],'include':_0x5c18a8[_0x38eb('0x1b')]?_['map'](_0x5c18a8[_0x38eb('0x1b')],function(_0xc7cdb7){return{'model':db[_0xc7cdb7['model']],'as':_0xc7cdb7['as'],'attributes':_0xc7cdb7[_0x38eb('0x19')],'include':_0xc7cdb7['include']?_[_0x38eb('0x1a')](_0xc7cdb7['include'],function(_0x4d4708){return{'model':db[_0x4d4708['model']],'as':_0x4d4708['as'],'attributes':_0x4d4708[_0x38eb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x38eb('0xa')](function(_0x1ae02f){logger[_0x38eb('0xb')](_0x38eb('0x15'),_0x391f48);logger[_0x38eb('0xd')](_0x38eb('0x15'),_0x391f48,JSON[_0x38eb('0x1c')](_0x1ae02f));_0x3b9afe(_0x1ae02f);})[_0x38eb('0x14')](function(_0x5396ab){logger[_0x38eb('0x10')](_0x38eb('0x15'),_0x5396ab['message'],_0x391f48);_0x4e1c22(_0x58384c[_0x38eb('0x10')](0x1f4,_0x5396ab['message']));});});};exports[_0x38eb('0x1d')]=function(_0x23eb07){var _0x2199c0=this;return new Promise(function(_0x15c253,_0x39e222){return db['CmHopperBlack'][_0x38eb('0x1e')](_0x23eb07['body'],{'raw':_0x23eb07['options']?_0x23eb07[_0x38eb('0x17')][_0x38eb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23eb07[_0x38eb('0x17')]?_0x23eb07[_0x38eb('0x17')][_0x38eb('0x18')]||null:null,'attributes':_0x23eb07[_0x38eb('0x17')]?_0x23eb07[_0x38eb('0x17')]['attributes']||null:null,'limit':_0x23eb07[_0x38eb('0x17')]?_0x23eb07[_0x38eb('0x17')]['limit']||null:null})[_0x38eb('0xa')](function(_0x28e0ad){logger['info']('UpdateCmHopperBlack',_0x23eb07);logger['debug']('UpdateCmHopperBlack',_0x23eb07,JSON[_0x38eb('0x1c')](_0x28e0ad));_0x15c253(_0x28e0ad);})['catch'](function(_0x5e9c36){logger[_0x38eb('0x10')](_0x38eb('0x1d'),_0x5e9c36[_0x38eb('0x12')],_0x23eb07);_0x39e222(_0x2199c0[_0x38eb('0x10')](0x1f4,_0x5e9c36[_0x38eb('0x12')]));});});};exports[_0x38eb('0x20')]=function(_0x2440f6){var _0x2f6d7b=this;return new Promise(function(_0x25bf33,_0x3c3861){return db['CmHopperBlack'][_0x38eb('0x21')]({'where':_0x2440f6[_0x38eb('0x17')]?_0x2440f6[_0x38eb('0x17')][_0x38eb('0x18')]||null:null})[_0x38eb('0xa')](function(_0x21e179){logger['info']('DestroyCmHopperBlack',_0x2440f6);logger[_0x38eb('0xd')]('DestroyCmHopperBlack',_0x2440f6,JSON[_0x38eb('0x1c')](_0x21e179));_0x25bf33(_0x21e179);})[_0x38eb('0x14')](function(_0x14dfc6){logger[_0x38eb('0x10')]('DestroyCmHopperBlack',_0x14dfc6[_0x38eb('0x12')],_0x2440f6);_0x3c3861(_0x2f6d7b[_0x38eb('0x10')](0x1f4,_0x14dfc6[_0x38eb('0x12')]));});});}; \ No newline at end of file +var _0x9095=['stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent'];(function(_0x226346,_0xcfe6b5){var _0x55234d=function(_0x343d35){while(--_0x343d35){_0x226346['push'](_0x226346['shift']());}};_0x55234d(++_0xcfe6b5);}(_0x9095,0xa8));var _0x5909=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9095[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x5909('0x0'));var util=require('util');var moment=require(_0x5909('0x1'));var BPromise=require(_0x5909('0x2'));var rs=require(_0x5909('0x3'));var fs=require('fs');var Redis=require(_0x5909('0x4'));var db=require(_0x5909('0x5'))['db'];var utils=require(_0x5909('0x6'));var logger=require(_0x5909('0x7'))(_0x5909('0x8'));var config=require(_0x5909('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5909('0xa')][_0x5909('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d010,_0x3f53fc,_0x440d3f){return new BPromise(function(_0x53997f,_0x169994){return client[_0x5909('0xc')](_0x38d010,_0x440d3f)[_0x5909('0xd')](function(_0x12af7d){logger[_0x5909('0xe')](_0x5909('0xf'),_0x3f53fc,_0x5909('0x10'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x3f53fc,_0x5909('0x10'),JSON[_0x5909('0x11')](_0x12af7d));if(_0x12af7d[_0x5909('0x12')]){if(_0x12af7d[_0x5909('0x12')][_0x5909('0x13')]===0x1f4){logger[_0x5909('0x12')](_0x5909('0xf'),_0x3f53fc,_0x12af7d['error']['message']);return _0x169994(_0x12af7d[_0x5909('0x12')][_0x5909('0x14')]);}logger['error'](_0x5909('0xf'),_0x3f53fc,_0x12af7d[_0x5909('0x12')][_0x5909('0x14')]);return _0x53997f(_0x12af7d['error']['message']);}else{logger[_0x5909('0xe')](_0x5909('0xf'),_0x3f53fc,'request\x20sent');_0x53997f(_0x12af7d['result'][_0x5909('0x14')]);}})[_0x5909('0x15')](function(_0x415fb1){logger['error'](_0x5909('0xf'),_0x3f53fc,_0x415fb1);_0x169994(_0x415fb1);});});}exports[_0x5909('0x16')]=function(_0x54d351){var _0x456a48=this;return new Promise(function(_0x4fe29b,_0x18b633){return db[_0x5909('0x17')]['findAll']({'raw':_0x54d351[_0x5909('0x18')]?_0x54d351['options'][_0x5909('0x19')]===undefined?!![]:![]:!![],'where':_0x54d351[_0x5909('0x18')]?_0x54d351['options'][_0x5909('0x1a')]||null:null,'attributes':_0x54d351[_0x5909('0x18')]?_0x54d351[_0x5909('0x18')][_0x5909('0x1b')]||null:null,'limit':_0x54d351['options']?_0x54d351[_0x5909('0x18')][_0x5909('0x1c')]||null:null,'include':_0x54d351[_0x5909('0x18')]?_0x54d351[_0x5909('0x18')][_0x5909('0x1d')]?_['map'](_0x54d351[_0x5909('0x18')][_0x5909('0x1d')],function(_0x217bb1){return{'model':db[_0x217bb1['model']],'as':_0x217bb1['as'],'attributes':_0x217bb1[_0x5909('0x1b')],'include':_0x217bb1[_0x5909('0x1d')]?_[_0x5909('0x1e')](_0x217bb1[_0x5909('0x1d')],function(_0x467473){return{'model':db[_0x467473[_0x5909('0x1f')]],'as':_0x467473['as'],'attributes':_0x467473[_0x5909('0x1b')],'include':_0x467473[_0x5909('0x1d')]?_[_0x5909('0x1e')](_0x467473[_0x5909('0x1d')],function(_0x163b91){return{'model':db[_0x163b91[_0x5909('0x1f')]],'as':_0x163b91['as'],'attributes':_0x163b91[_0x5909('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5909('0xd')](function(_0x20ccc9){logger[_0x5909('0xe')](_0x5909('0x16'),_0x54d351);logger[_0x5909('0x20')]('GetCmHopperBlack',_0x54d351,JSON[_0x5909('0x11')](_0x20ccc9));_0x4fe29b(_0x20ccc9);})[_0x5909('0x15')](function(_0x4a101b){logger[_0x5909('0x12')]('GetCmHopperBlack',_0x4a101b['message'],_0x54d351);_0x18b633(_0x456a48[_0x5909('0x12')](0x1f4,_0x4a101b['message']));});});};exports[_0x5909('0x21')]=function(_0x3d7e5b){var _0x244c86=this;return new Promise(function(_0x5c7ec6,_0x11efce){return db[_0x5909('0x17')][_0x5909('0x22')](_0x3d7e5b['body'],{'raw':_0x3d7e5b[_0x5909('0x18')]?_0x3d7e5b[_0x5909('0x18')][_0x5909('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d7e5b[_0x5909('0x18')]?_0x3d7e5b['options'][_0x5909('0x1a')]||null:null,'attributes':_0x3d7e5b[_0x5909('0x18')]?_0x3d7e5b['options'][_0x5909('0x1b')]||null:null,'limit':_0x3d7e5b[_0x5909('0x18')]?_0x3d7e5b[_0x5909('0x18')]['limit']||null:null})['then'](function(_0x4bc88d){logger[_0x5909('0xe')](_0x5909('0x21'),_0x3d7e5b);logger['debug']('UpdateCmHopperBlack',_0x3d7e5b,JSON[_0x5909('0x11')](_0x4bc88d));_0x5c7ec6(_0x4bc88d);})[_0x5909('0x15')](function(_0x230351){logger[_0x5909('0x12')]('UpdateCmHopperBlack',_0x230351[_0x5909('0x14')],_0x3d7e5b);_0x11efce(_0x244c86[_0x5909('0x12')](0x1f4,_0x230351['message']));});});};exports[_0x5909('0x23')]=function(_0x20c988){var _0x2c0e16=this;return new Promise(function(_0x43917c,_0x33d38f){return db[_0x5909('0x17')][_0x5909('0x24')]({'where':_0x20c988[_0x5909('0x18')]?_0x20c988[_0x5909('0x18')]['where']||null:null})[_0x5909('0xd')](function(_0x247ee0){logger[_0x5909('0xe')](_0x5909('0x23'),_0x20c988);logger[_0x5909('0x20')]('DestroyCmHopperBlack',_0x20c988,JSON[_0x5909('0x11')](_0x247ee0));_0x43917c(_0x247ee0);})[_0x5909('0x15')](function(_0x128148){logger['error'](_0x5909('0x23'),_0x128148[_0x5909('0x14')],_0x20c988);_0x33d38f(_0x2c0e16['error'](0x1f4,_0x128148[_0x5909('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 94acadc..abbd300 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 _0xe3da=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer'];(function(_0x592ae5,_0x20524b){var _0x20b7be=function(_0x3628ba){while(--_0x3628ba){_0x592ae5['push'](_0x592ae5['shift']());}};_0x20b7be(++_0x20524b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')](_0xae3d('0x12'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x13')]);router[_0xae3d('0x14')]('/:id',auth[_0xae3d('0xc')](),controller['destroy']);module[_0xae3d('0x15')]=router; \ No newline at end of file +var _0x11e5=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','put'];(function(_0x502130,_0x578d62){var _0x4701e6=function(_0x45b294){while(--_0x45b294){_0x502130['push'](_0x502130['shift']());}};_0x4701e6(++_0x578d62);}(_0x11e5,0x8b));var _0x511e=function(_0x2b00fa,_0x4551db){_0x2b00fa=_0x2b00fa-0x0;var _0x3c5297=_0x11e5[_0x2b00fa];return _0x3c5297;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0xb'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);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 49e0e3d..2f112d8 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 _0x7481=['sequelize','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','BOOLEAN'];(function(_0x52fc3e,_0x45c5b8){var _0x3d9cc8=function(_0x1ded4f){while(--_0x1ded4f){_0x52fc3e['push'](_0x52fc3e['shift']());}};_0x3d9cc8(++_0x45c5b8);}(_0x7481,0x190));var _0x1748=function(_0x280478,_0x3d5c91){_0x280478=_0x280478-0x0;var _0x2eb3e0=_0x7481[_0x280478];return _0x2eb3e0;};'use strict';var Sequelize=require(_0x1748('0x0'));var moment=require('moment');module[_0x1748('0x1')]={'state':{'type':Sequelize[_0x1748('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1748('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1748('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1748('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x1748('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1748('0x4')]},'droptime':{'type':Sequelize[_0x1748('0x4')]},'endtime':{'type':Sequelize[_0x1748('0x4')]},'ringtime':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1748('0x3')]},'campaign':{'type':Sequelize[_0x1748('0x3')]},'campaigntype':{'type':Sequelize[_0x1748('0x3')]},'membername':{'type':Sequelize[_0x1748('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1748('0x3')]},'secondDisposition':{'type':Sequelize[_0x1748('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x1748('0x4')],'set':function(_0x39fdb6){var _0x22e35a=this[_0x1748('0x5')]('endtime');if(_0x22e35a&&_0x39fdb6){this[_0x1748('0x6')](_0x1748('0x7'),moment(_0x39fdb6)[_0x1748('0x8')](moment(_0x22e35a),'seconds'));}}},'amd':{'type':Sequelize[_0x1748('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1748('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1748('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x1748('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1748('0x4')]},'callback':{'type':Sequelize[_0x1748('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1748('0x4')]},'deleted':{'type':Sequelize[_0x1748('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1748('0x4')]},'recallme':{'type':Sequelize[_0x1748('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1748('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1748('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6784=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x49c31d,_0xb14b89){var _0x1f9601=function(_0x5d9ffa){while(--_0x5d9ffa){_0x49c31d['push'](_0x49c31d['shift']());}};_0x1f9601(++_0xb14b89);}(_0x6784,0xfd));var _0x4678=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x6784[_0x1a8f86];return _0x20d876;};'use strict';var Sequelize=require(_0x4678('0x0'));var moment=require(_0x4678('0x1'));module[_0x4678('0x2')]={'state':{'type':Sequelize[_0x4678('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x4678('0x4')]},'scheduledat':{'type':Sequelize[_0x4678('0x5')]},'countbusyretry':{'type':Sequelize[_0x4678('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4678('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4678('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x4678('0x4')]},'originatecalleridname':{'type':Sequelize[_0x4678('0x4')]},'calleridnum':{'type':Sequelize[_0x4678('0x4')]},'calleridname':{'type':Sequelize[_0x4678('0x4')]},'starttime':{'type':Sequelize[_0x4678('0x5')]},'responsetime':{'type':Sequelize[_0x4678('0x5')]},'answertime':{'type':Sequelize[_0x4678('0x5')]},'droptime':{'type':Sequelize[_0x4678('0x5')]},'endtime':{'type':Sequelize[_0x4678('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4678('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4678('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4678('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4678('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x4678('0x4')]},'disposition':{'type':Sequelize[_0x4678('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4678('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0xf9bbbc){var _0x38c529=this['getDataValue'](_0x4678('0x6'));if(_0x38c529&&_0xf9bbbc){this[_0x4678('0x7')](_0x4678('0x8'),moment(_0xf9bbbc)[_0x4678('0x9')](moment(_0x38c529),_0x4678('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x4678('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4678('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4678('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x4678('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4678('0x5')]},'recallme':{'type':Sequelize[_0x4678('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x4678('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4678('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index cf364b4..f3c82f7 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 _0xc1c6=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','field','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x7018be,_0x38f7e8){_0x7018be=_0x7018be-0x0;var _0x257680=_0xc1c6[_0x7018be];return _0x257680;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['CmHopperFinal']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['CmHopperFinal'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['describe']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')]()[_0x6c1c('0x25')](respondWithResult(_0x58d075,null))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x26cf7f,_0x52c14d){if(_0x26cf7f[_0x6c1c('0x48')][_0x6c1c('0x49')]){delete _0x26cf7f['body'][_0x6c1c('0x49')];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'uniqueid':_0x26cf7f[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x52c14d,null))[_0x6c1c('0x25')](saveUpdates(_0x26cf7f[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0x52c14d,null))['catch'](handleError(_0x52c14d,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x56b367,_0x5714a6,_0x5008b7){return db[_0x6c1c('0x2b')][_0x6c1c('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x56b367['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x53')))),'congestionContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x55')))),_0x6c1c('0x56')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize'][_0x6c1c('0x4e')](_0x6c1c('0x57')))),_0x6c1c('0x58')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),'answeringMachine']]})[_0x6c1c('0x25')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x25')](respondWithResult(_0x5714a6,null))[_0x6c1c('0x41')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x5a')]=function(_0x14f3b5,_0x3229e6,_0xed095f){return db['CmHopperFinal'][_0x6c1c('0x3f')]({'raw':![],'where':{'CampaignId':_0x14f3b5['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x53')))),_0x6c1c('0x5b')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x5c')))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x6c1c('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),_0x6c1c('0x5d')]]})[_0x6c1c('0x25')](handleEntityNotFound(_0x3229e6,null))[_0x6c1c('0x25')](respondWithResult(_0x3229e6,null))['catch'](handleError(_0x3229e6,null));};exports[_0x6c1c('0x5e')]=function(_0x16b741,_0x204e78,_0x5a919a){return db['VoiceQueue']['find']({'where':{'id':_0x16b741[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x204e78,null))['then'](function(_0x10e499){var _0x579ca3;if(_0x10e499){_0x579ca3=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))[_0x6c1c('0x62')](['phone',_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId','VoiceQueueId',_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))['field']('NOW()','scheduledAt')['field'](_0x6c1c('0x6a'),'ContactId')[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))['field'](_0x6c1c('0x6e'),_0x6c1c('0x6f'))[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x65'))['field'](_0x6c1c('0x70'),'updatedAt')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x16b741['body'][_0x6c1c('0x76')]['toString']())['where'](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x69'))['from'](_0x6c1c('0x61'))['where'](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]()))['where'](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')]('calleridnum')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))['toString']();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x579ca3);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x204e78,null))[_0x6c1c('0x41')](handleError(_0x204e78,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1ad9e2,_0x44d8c4,_0x33a141){return db['Campaign'][_0x6c1c('0x46')]({'where':{'id':_0x1ad9e2[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d8c4,null))[_0x6c1c('0x25')](function(_0x50b56b){var _0x1a493a;if(_0x50b56b){_0x1a493a=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))['fromQuery']([_0x6c1c('0x69'),_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId',_0x6c1c('0x7b'),_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))[_0x6c1c('0x6b')]('NOW()',_0x6c1c('0x63'))['field'](_0x6c1c('0x6a'),_0x6c1c('0x64'))[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))[_0x6c1c('0x6b')](_0x6c1c('0x7c'),_0x6c1c('0x7b'))['field'](_0x6c1c('0x70'),'createdAt')[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x66'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2[_0x6c1c('0x43')]['id']['toString']())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x1ad9e2['body']['state'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x69'))[_0x6c1c('0x71')](_0x6c1c('0x61'))[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2['params']['id'][_0x6c1c('0x74')]()))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x7e'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')]('CampaignId\x20=\x20?',_0x1ad9e2['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))[_0x6c1c('0x74')]();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x1a493a);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x44d8c4,null))[_0x6c1c('0x41')](handleError(_0x44d8c4,null));};exports['checkContactHopper']=function(_0x3e40b6,_0x654041,_0x1a0da8){return db[_0x6c1c('0x7f')][_0x6c1c('0x80')]({'where':{'VoiceQueueId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x6f')],'CampaignId':_0x3e40b6[_0x6c1c('0x48')]['CampaignId'],'ContactId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x64')]}})[_0x6c1c('0x25')](handleEntityNotFound(_0x654041,null))[_0x6c1c('0x25')](function(_0x385629){if(_0x385629){return _0x385629;}return null;})[_0x6c1c('0x25')](respondWithResult(_0x654041,null))[_0x6c1c('0x41')](handleError(_0x654041,null));}; \ No newline at end of file +var _0xc4aa=['ContactId','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','phone','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','describe','uniqueid','find','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x40e1ed,_0x297e89){var _0x220ddd=function(_0x9310bb){while(--_0x9310bb){_0x40e1ed['push'](_0x40e1ed['shift']());}};_0x220ddd(++_0x297e89);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')]()['then'](respondWithResult(_0x244950,null))['catch'](handleError(_0x244950,null));};exports[_0xac4a('0x23')]=function(_0x4aaeff,_0x18ae96){if(_0x4aaeff['body'][_0xac4a('0x4a')]){delete _0x4aaeff['body'][_0xac4a('0x4a')];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'uniqueid':_0x4aaeff[_0xac4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x24')](saveUpdates(_0x4aaeff[_0xac4a('0x4c')],null))[_0xac4a('0x24')](respondWithResult(_0x18ae96,null))[_0xac4a('0x44')](handleError(_0x18ae96,null));};exports[_0xac4a('0x4d')]=function(_0x138876,_0x187306,_0x4e6e19){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x138876['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')]('`state`\x20=\x203,\x201,\x20null'))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0xac4a('0x55')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db['sequelize']['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x5e')))),'answeringMachine']]})[_0xac4a('0x24')](handleEntityNotFound(_0x187306,null))['then'](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x5f')]=function(_0x568ffb,_0x3bcae2,_0x3c2f84){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'CampaignId':_0x568ffb['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn']('COUNT',db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x60')))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x61')))),_0xac4a('0x55')],[db['sequelize']['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5e')))),_0xac4a('0x62')]]})[_0xac4a('0x24')](handleEntityNotFound(_0x3bcae2,null))['then'](respondWithResult(_0x3bcae2,null))[_0xac4a('0x44')](handleError(_0x3bcae2,null));};exports[_0xac4a('0x63')]=function(_0x26bd31,_0x231932,_0x513976){return db[_0xac4a('0x64')]['find']({'where':{'id':_0x26bd31[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x231932,null))['then'](function(_0x5bd95b){var _0x17eac2;if(_0x5bd95b){_0x17eac2=squel[_0xac4a('0x65')]()[_0xac4a('0x66')]('cm_hopper')[_0xac4a('0x67')](['phone',_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x69'),'createdAt',_0xac4a('0x6a')],squel['select']()[_0xac4a('0x6b')](_0xac4a('0x6c'),'phone')[_0xac4a('0x6b')]('NOW()',_0xac4a('0x68'))[_0xac4a('0x6b')]('ANY_VALUE(ContactId)',_0xac4a('0x6d'))['field']('ANY_VALUE(ListId)',_0xac4a('0x6e'))['field'](_0xac4a('0x6f'),'VoiceQueueId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')]('NOW()','updatedAt')[_0xac4a('0x72')](_0xac4a('0x73'))['where']('VoiceQueueId\x20=\x20?',_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x75'),_0x26bd31[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))['where'](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')]('phone')[_0xac4a('0x72')](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id']['toString']()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x7d')))[_0xac4a('0x7e')]('ContactId'))[_0xac4a('0x74')]();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x17eac2);}return[];})[_0xac4a('0x24')](respondWithResult(_0x231932,null))['catch'](handleError(_0x231932,null));};exports[_0xac4a('0x7f')]=function(_0x56a934,_0x4447b5,_0x22b718){return db['Campaign']['find']({'where':{'id':_0x56a934[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x4447b5,null))[_0xac4a('0x24')](function(_0x4bb03d){var _0x1f3f1c;if(_0x4bb03d){_0x1f3f1c=squel['insert']()[_0xac4a('0x66')](_0xac4a('0x7a'))[_0xac4a('0x67')]([_0xac4a('0x80'),_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x81'),_0xac4a('0x71'),_0xac4a('0x6a')],squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x6c'),_0xac4a('0x80'))[_0xac4a('0x6b')]('NOW()','scheduledAt')[_0xac4a('0x6b')](_0xac4a('0x82'),_0xac4a('0x6d'))[_0xac4a('0x6b')](_0xac4a('0x83'),_0xac4a('0x6e'))[_0xac4a('0x6b')](_0xac4a('0x84'),'CampaignId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')](_0xac4a('0x70'),_0xac4a('0x6a'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where'](_0xac4a('0x75'),_0x56a934[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()['field'](_0xac4a('0x80'))['from'](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel['select']()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))[_0xac4a('0x3d')]('CampaignId\x20=\x20?',_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where']('state\x20=\x204'))[_0xac4a('0x7e')](_0xac4a('0x6d')))['toString']();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x1f3f1c);}return[];})[_0xac4a('0x24')](respondWithResult(_0x4447b5,null))[_0xac4a('0x44')](handleError(_0x4447b5,null));};exports[_0xac4a('0x86')]=function(_0x34787c,_0x599775,_0xbdff4b){return db[_0xac4a('0x87')][_0xac4a('0x88')]({'where':{'VoiceQueueId':_0x34787c['body'][_0xac4a('0x69')],'CampaignId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x81')],'ContactId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x6d')]}})[_0xac4a('0x24')](handleEntityNotFound(_0x599775,null))['then'](function(_0xe84bf7){if(_0xe84bf7){return _0xe84bf7;}return null;})[_0xac4a('0x24')](respondWithResult(_0x599775,null))['catch'](handleError(_0x599775,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b5f9f2b..1e4393c 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 _0x192d=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x192d,0xcb));var _0xd192=function(_0x35449e,_0x1644fd){_0x35449e=_0x35449e-0x0;var _0x126c8d=_0x192d[_0x35449e];return _0x126c8d;};'use strict';var _=require(_0xd192('0x0'));var util=require('util');var logger=require(_0xd192('0x1'))(_0xd192('0x2'));var moment=require(_0xd192('0x3'));var BPromise=require(_0xd192('0x4'));var rp=require(_0xd192('0x5'));var fs=require('fs');var path=require(_0xd192('0x6'));var rimraf=require(_0xd192('0x7'));var config=require(_0xd192('0x8'));var attributes=require(_0xd192('0x9'));module[_0xd192('0xa')]=function(_0x4f32b0,_0x21d30f){return _0x4f32b0[_0xd192('0xb')](_0xd192('0xc'),attributes,{'tableName':_0xd192('0xd'),'paranoid':![],'indexes':[{'name':_0xd192('0xe'),'fields':[_0xd192('0xe')]},{'name':_0xd192('0xf'),'fields':[_0xd192('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7966=['path','../../config/environment','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0x228b27,_0x899ba0){var _0x315f1c=function(_0x3cc18b){while(--_0x3cc18b){_0x228b27['push'](_0x228b27['shift']());}};_0x315f1c(++_0x899ba0);}(_0x7966,0xeb));var _0x6796=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7966[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x6796('0x0'));var logger=require(_0x6796('0x1'))(_0x6796('0x2'));var moment=require(_0x6796('0x3'));var BPromise=require('bluebird');var rp=require(_0x6796('0x4'));var fs=require('fs');var path=require(_0x6796('0x5'));var rimraf=require('rimraf');var config=require(_0x6796('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x10f58a,_0x538d5f){return _0x10f58a['define'](_0x6796('0x7'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x6796('0x8'),'fields':[_0x6796('0x8')]},{'name':_0x6796('0x9'),'fields':[_0x6796('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 82b3ae5..036ec2b 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(_0x4e2223,_0x534c4b){var _0x4ea847=function(_0x4ccbf0){while(--_0x4ccbf0){_0x4e2223['push'](_0x4e2223['shift']());}};_0x4ea847(++_0x534c4b);}(_0x7a54,0x106));var _0x47a5=function(_0x362736,_0x101e9c){_0x362736=_0x362736-0x0;var _0x4e97a6=_0x7a54[_0x362736];return _0x4e97a6;};'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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x1fba11,_0x502525){var _0x46f1c1=function(_0x2584a6){while(--_0x2584a6){_0x1fba11['push'](_0x1fba11['shift']());}};_0x46f1c1(++_0x502525);}(_0xb10b,0x12a));var _0xbb10=function(_0x11f893,_0x259935){_0x11f893=_0x11f893-0x0;var _0x400fa8=_0xb10b[_0x11f893];return _0x400fa8;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 3adc562..b9fe4f7 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 _0x9333=['show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','put','update','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/:id'];(function(_0x5721c4,_0x2ffbd4){var _0x597a5f=function(_0x2387a5){while(--_0x2387a5){_0x5721c4['push'](_0x5721c4['shift']());}};_0x597a5f(++_0x2ffbd4);}(_0x9333,0x122));var _0x3933=function(_0x45183b,_0x4199f1){_0x45183b=_0x45183b-0x0;var _0x3cc513=_0x9333[_0x45183b];return _0x3cc513;};'use strict';var multer=require(_0x3933('0x0'));var util=require(_0x3933('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3933('0x2'));var router=express[_0x3933('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3933('0x4'));var config=require(_0x3933('0x5'));var controller=require(_0x3933('0x6'));router[_0x3933('0x7')]('/',auth[_0x3933('0x8')](),controller['index']);router[_0x3933('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3933('0x7')](_0x3933('0x9'),auth[_0x3933('0x8')](),controller[_0x3933('0xa')]);router[_0x3933('0x7')]('/voice/queue/countAttributes/:id',auth[_0x3933('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x3933('0x7')](_0x3933('0xb'),auth[_0x3933('0x8')](),controller[_0x3933('0xc')]);router[_0x3933('0xd')](_0x3933('0xe'),auth[_0x3933('0x8')](),controller[_0x3933('0xf')]);router['post']('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x3933('0xd')](_0x3933('0x10'),auth[_0x3933('0x8')](),controller['checkContactHopper']);router[_0x3933('0x11')](_0x3933('0x9'),auth[_0x3933('0x8')](),controller[_0x3933('0x12')]);module[_0x3933('0x13')]=router; \ No newline at end of file +var _0xc67b=['post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0xc67b,0x104));var _0xbc67=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xc67b[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xbc67('0x0'));var util=require(_0xbc67('0x1'));var path=require(_0xbc67('0x2'));var timeout=require(_0xbc67('0x3'));var express=require(_0xbc67('0x4'));var router=express[_0xbc67('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbc67('0x6'));var interaction=require(_0xbc67('0x7'));var config=require(_0xbc67('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xbc67('0x9')]('/',auth[_0xbc67('0xa')](),controller['index']);router['get']('/describe',auth[_0xbc67('0xa')](),controller['describe']);router[_0xbc67('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbc67('0xb')]);router[_0xbc67('0x9')](_0xbc67('0xc'),auth['isAuthenticated'](),controller[_0xbc67('0xd')]);router[_0xbc67('0x9')]('/campaign/countAttributes/:id',auth[_0xbc67('0xa')](),controller[_0xbc67('0xe')]);router['post']('/voice/queue/moveContacts/:id',auth[_0xbc67('0xa')](),controller[_0xbc67('0xf')]);router[_0xbc67('0x10')](_0xbc67('0x11'),auth[_0xbc67('0xa')](),controller[_0xbc67('0x12')]);router[_0xbc67('0x10')]('/checkContactHopper',auth[_0xbc67('0xa')](),controller[_0xbc67('0x13')]);router[_0xbc67('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xbc67('0x15')]);module[_0xbc67('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 229476c..57e8e1b 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 _0x6113=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x6113,0x1b2));var _0x3611=function(_0x3e320d,_0x486482){_0x3e320d=_0x3e320d-0x0;var _0x4ca26a=_0x6113[_0x3e320d];return _0x4ca26a;};'use strict';var Sequelize=require(_0x3611('0x0'));module[_0x3611('0x1')]={'state':{'type':Sequelize[_0x3611('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x3611('0x3')]},'countbusyretry':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3611('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x3611('0x4')]},'originatecalleridname':{'type':Sequelize[_0x3611('0x4')]},'calleridnum':{'type':Sequelize[_0x3611('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x3611('0x3')]},'responsetime':{'type':Sequelize[_0x3611('0x3')]},'answertime':{'type':Sequelize[_0x3611('0x3')]},'droptime':{'type':Sequelize[_0x3611('0x3')]},'endtime':{'type':Sequelize[_0x3611('0x3')]},'ringtime':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3611('0x4')]},'membername':{'type':Sequelize[_0x3611('0x4')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3611('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3611('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3611('0x3')]},'recallme':{'type':Sequelize[_0x3611('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x3611('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3611('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3611('0x4')]}}; \ No newline at end of file +var _0x4a5a=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x2b2680,_0x3adf49){var _0x2d5403=function(_0x1a47f6){while(--_0x1a47f6){_0x2b2680['push'](_0x2b2680['shift']());}};_0x2d5403(++_0x3adf49);}(_0x4a5a,0xfe));var _0xa4a5=function(_0x69f827,_0x5f0be8){_0x69f827=_0x69f827-0x0;var _0x19167c=_0x4a5a[_0x69f827];return _0x19167c;};'use strict';var Sequelize=require(_0xa4a5('0x0'));module[_0xa4a5('0x1')]={'state':{'type':Sequelize[_0xa4a5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa4a5('0x3')]},'scheduledat':{'type':Sequelize[_0xa4a5('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa4a5('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xa4a5('0x3')]},'calleridnum':{'type':Sequelize[_0xa4a5('0x3')]},'calleridname':{'type':Sequelize[_0xa4a5('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa4a5('0x4')]},'answertime':{'type':Sequelize[_0xa4a5('0x4')]},'droptime':{'type':Sequelize[_0xa4a5('0x4')]},'endtime':{'type':Sequelize[_0xa4a5('0x4')]},'ringtime':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa4a5('0x3')]},'campaign':{'type':Sequelize[_0xa4a5('0x3')]},'campaigntype':{'type':Sequelize[_0xa4a5('0x3')]},'membername':{'type':Sequelize[_0xa4a5('0x3')]},'reason':{'type':Sequelize[_0xa4a5('0x3')]},'amd':{'type':Sequelize[_0xa4a5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xa4a5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa4a5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa4a5('0x4')]},'recallme':{'type':Sequelize[_0xa4a5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa4a5('0x4')]},'edited':{'type':Sequelize[_0xa4a5('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa4a5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa4a5('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a800303..e0aaeb9 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 _0x85fe=['merge','VIRTUAL','options','where','includeAll','findAll','rows','show','keys','include','catch','create','body','describe','uniqueid','find','params','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x251dce,_0x3890db){var _0x5e1fec=function(_0x32b348){while(--_0x32b348){_0x251dce['push'](_0x251dce['shift']());}};_0x5e1fec(++_0x3890db);}(_0x85fe,0x1e5));var _0xe85f=function(_0x1f9742,_0x4036cb){_0x1f9742=_0x1f9742-0x0;var _0x2fe1b1=_0x85fe[_0x1f9742];return _0x2fe1b1;};'use strict';var emlformat=require(_0xe85f('0x0'));var rimraf=require(_0xe85f('0x1'));var zipdir=require(_0xe85f('0x2'));var jsonpatch=require(_0xe85f('0x3'));var rp=require(_0xe85f('0x4'));var moment=require('moment');var BPromise=require(_0xe85f('0x5'));var Mustache=require(_0xe85f('0x6'));var util=require(_0xe85f('0x7'));var path=require('path');var sox=require(_0xe85f('0x8'));var csv=require(_0xe85f('0x9'));var ejs=require(_0xe85f('0xa'));var fs=require('fs');var fs_extra=require(_0xe85f('0xb'));var _=require(_0xe85f('0xc'));var squel=require(_0xe85f('0xd'));var crypto=require('crypto');var jsforce=require(_0xe85f('0xe'));var deskjs=require(_0xe85f('0xf'));var toCsv=require(_0xe85f('0x9'));var querystring=require(_0xe85f('0x10'));var Papa=require(_0xe85f('0x11'));var Redis=require('ioredis');var authService=require(_0xe85f('0x12'));var qs=require(_0xe85f('0x13'));var as=require(_0xe85f('0x14'));var hardwareService=require(_0xe85f('0x15'));var logger=require('../../config/logger')(_0xe85f('0x16'));var utils=require('../../config/utils');var config=require(_0xe85f('0x17'));var licenseUtil=require(_0xe85f('0x18'));var db=require(_0xe85f('0x19'))['db'];function respondWithStatusCode(_0x4cdf39,_0x3840d4){_0x3840d4=_0x3840d4||0xcc;return function(_0xd19a77){if(_0xd19a77){return _0x4cdf39['sendStatus'](_0x3840d4);}return _0x4cdf39['status'](_0x3840d4)[_0xe85f('0x1a')]();};}function respondWithResult(_0x592b21,_0x335cd0){_0x335cd0=_0x335cd0||0xc8;return function(_0x1e7b4b){if(_0x1e7b4b){return _0x592b21[_0xe85f('0x1b')](_0x335cd0)[_0xe85f('0x1c')](_0x1e7b4b);}};}function respondWithFilteredResult(_0x205ec7,_0x4d43e8){return function(_0x3f41c6){if(_0x3f41c6){var _0x4a2e5a=typeof _0x4d43e8[_0xe85f('0x1d')]===_0xe85f('0x1e')&&typeof _0x4d43e8[_0xe85f('0x1f')]===_0xe85f('0x1e');var _0x779e4f=_0x3f41c6[_0xe85f('0x20')];var _0x10449c=_0x4a2e5a?0x0:_0x4d43e8[_0xe85f('0x1d')];var _0x2bd8fb=_0x4a2e5a?_0x3f41c6[_0xe85f('0x20')]:_0x4d43e8[_0xe85f('0x1d')]+_0x4d43e8['limit'];var _0x462367;if(_0x2bd8fb>=_0x779e4f){_0x2bd8fb=_0x779e4f;_0x462367=0xc8;}else{_0x462367=0xce;}_0x205ec7[_0xe85f('0x1b')](_0x462367);return _0x205ec7[_0xe85f('0x21')](_0xe85f('0x22'),_0x10449c+'-'+_0x2bd8fb+'/'+_0x779e4f)['json'](_0x3f41c6);}return null;};}function patchUpdates(_0x5059b8){return function(_0x4be987){try{jsonpatch['apply'](_0x4be987,_0x5059b8,!![]);}catch(_0x6146c2){return BPromise[_0xe85f('0x23')](_0x6146c2);}return _0x4be987['save']();};}function saveUpdates(_0x5be329,_0x51501f){return function(_0x4c9fc9){if(_0x4c9fc9){return _0x4c9fc9[_0xe85f('0x24')](_0x5be329)['then'](function(_0x3c5892){return _0x3c5892;});}return null;};}function removeEntity(_0x11a5d0,_0x154298){return function(_0x28136a){if(_0x28136a){return _0x28136a['destroy']()[_0xe85f('0x25')](function(){_0x11a5d0[_0xe85f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ef9b,_0x2cd8a6){return function(_0x52aee1){if(!_0x52aee1){_0x47ef9b[_0xe85f('0x26')](0x194);}return _0x52aee1;};}function handleError(_0x2ae702,_0x214d98){_0x214d98=_0x214d98||0x1f4;return function(_0xd16885){logger[_0xe85f('0x27')](_0xd16885['stack']);if(_0xd16885[_0xe85f('0x28')]){delete _0xd16885[_0xe85f('0x28')];}_0x2ae702[_0xe85f('0x1b')](_0x214d98)[_0xe85f('0x29')](_0xd16885);};}exports[_0xe85f('0x2a')]=function(_0x38f489,_0x3708cb){var _0x9f4c3c={},_0x486521={},_0xe322d6={'count':0x0,'rows':[]};var _0x10df48=_[_0xe85f('0x2b')](db[_0xe85f('0x2c')][_0xe85f('0x2d')],function(_0x57072d){return{'name':_0x57072d[_0xe85f('0x2e')],'type':_0x57072d[_0xe85f('0x2f')][_0xe85f('0x30')]};});_0x486521[_0xe85f('0x31')]=_[_0xe85f('0x2b')](_0x10df48,'name');_0x486521[_0xe85f('0x32')]=_['keys'](_0x38f489[_0xe85f('0x32')]);_0x486521[_0xe85f('0x33')]=_['intersection'](_0x486521[_0xe85f('0x31')],_0x486521[_0xe85f('0x32')]);_0x9f4c3c[_0xe85f('0x34')]=_[_0xe85f('0x35')](_0x486521[_0xe85f('0x31')],qs[_0xe85f('0x36')](_0x38f489['query']['fields']));_0x9f4c3c['attributes']=_0x9f4c3c[_0xe85f('0x34')][_0xe85f('0x37')]?_0x9f4c3c[_0xe85f('0x34')]:_0x486521[_0xe85f('0x31')];if(!_0x38f489[_0xe85f('0x32')][_0xe85f('0x38')](_0xe85f('0x39'))){_0x9f4c3c[_0xe85f('0x1f')]=qs['limit'](_0x38f489['query']['limit']);_0x9f4c3c[_0xe85f('0x1d')]=qs['offset'](_0x38f489[_0xe85f('0x32')][_0xe85f('0x1d')]);}_0x9f4c3c['order']=qs['sort'](_0x38f489[_0xe85f('0x32')][_0xe85f('0x3a')]);_0x9f4c3c['where']=qs[_0xe85f('0x33')](_[_0xe85f('0x3b')](_0x38f489[_0xe85f('0x32')],_0x486521[_0xe85f('0x33')]),_0x10df48);if(_0x38f489['query'][_0xe85f('0x3c')]){_0x9f4c3c['where']=_[_0xe85f('0x3d')](_0x9f4c3c['where'],{'$or':_[_0xe85f('0x2b')](_0x10df48,function(_0x54c5bd){if(_0x54c5bd['type']!==_0xe85f('0x3e')){var _0x2a20c0={};_0x2a20c0[_0x54c5bd['name']]={'$like':'%'+_0x38f489[_0xe85f('0x32')]['filter']+'%'};return _0x2a20c0;}})});}_0x9f4c3c=_[_0xe85f('0x3d')]({},_0x9f4c3c,_0x38f489[_0xe85f('0x3f')]);var _0x453609={'where':_0x9f4c3c[_0xe85f('0x40')]};return db[_0xe85f('0x2c')][_0xe85f('0x20')](_0x453609)[_0xe85f('0x25')](function(_0x3491b3){_0xe322d6[_0xe85f('0x20')]=_0x3491b3;if(_0x38f489[_0xe85f('0x32')][_0xe85f('0x41')]){_0x9f4c3c['include']=[{'all':!![]}];}return db[_0xe85f('0x2c')][_0xe85f('0x42')](_0x9f4c3c);})['then'](function(_0x230e0e){_0xe322d6[_0xe85f('0x43')]=_0x230e0e;return _0xe322d6;})[_0xe85f('0x25')](respondWithFilteredResult(_0x3708cb,_0x9f4c3c))['catch'](handleError(_0x3708cb,null));};exports[_0xe85f('0x44')]=function(_0x395797,_0x22ff91){var _0xe12567={'raw':!![],'where':{'id':_0x395797['params']['id']}},_0x5344aa={};_0x5344aa['model']=_[_0xe85f('0x45')](db[_0xe85f('0x2c')][_0xe85f('0x2d')]);_0x5344aa[_0xe85f('0x32')]=_['keys'](_0x395797[_0xe85f('0x32')]);_0x5344aa[_0xe85f('0x33')]=_[_0xe85f('0x35')](_0x5344aa[_0xe85f('0x31')],_0x5344aa[_0xe85f('0x32')]);_0xe12567['attributes']=_[_0xe85f('0x35')](_0x5344aa['model'],qs[_0xe85f('0x36')](_0x395797[_0xe85f('0x32')][_0xe85f('0x36')]));_0xe12567['attributes']=_0xe12567[_0xe85f('0x34')][_0xe85f('0x37')]?_0xe12567[_0xe85f('0x34')]:_0x5344aa['model'];if(_0x395797[_0xe85f('0x32')][_0xe85f('0x41')]){_0xe12567[_0xe85f('0x46')]=[{'all':!![]}];}_0xe12567=_[_0xe85f('0x3d')]({},_0xe12567,_0x395797[_0xe85f('0x3f')]);return db['CmHopperHistory']['find'](_0xe12567)['then'](handleEntityNotFound(_0x22ff91,null))[_0xe85f('0x25')](respondWithResult(_0x22ff91,null))[_0xe85f('0x47')](handleError(_0x22ff91,null));};exports[_0xe85f('0x48')]=function(_0x573f8d,_0x5a1108){return db['CmHopperHistory'][_0xe85f('0x48')](_0x573f8d[_0xe85f('0x49')],{})[_0xe85f('0x25')](respondWithResult(_0x5a1108,0xc9))['catch'](handleError(_0x5a1108,null));};exports['describe']=function(_0x199ba3,_0x3a85dd){return db['CmHopperHistory'][_0xe85f('0x4a')]()[_0xe85f('0x25')](respondWithResult(_0x3a85dd,null))[_0xe85f('0x47')](handleError(_0x3a85dd,null));};exports[_0xe85f('0x24')]=function(_0x2dda26,_0x1ba0ca){if(_0x2dda26[_0xe85f('0x49')][_0xe85f('0x4b')]){delete _0x2dda26[_0xe85f('0x49')][_0xe85f('0x4b')];}return db['CmHopperHistory'][_0xe85f('0x4c')]({'where':{'uniqueid':_0x2dda26[_0xe85f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ba0ca,null))[_0xe85f('0x25')](saveUpdates(_0x2dda26[_0xe85f('0x49')],null))[_0xe85f('0x25')](respondWithResult(_0x1ba0ca,null))[_0xe85f('0x47')](handleError(_0x1ba0ca,null));}; \ No newline at end of file +var _0x0b6f=['describe','body','uniqueid','find','rimraf','zip-dir','request-promise','moment','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b6f,0x1ae));var _0xf0b6=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0x0b6f[_0x2df1f2];return _0x38652b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0b6('0x0'));var zipdir=require(_0xf0b6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0b6('0x2'));var moment=require(_0xf0b6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf0b6('0x4'));var path=require('path');var sox=require(_0xf0b6('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0b6('0x6'));var _=require(_0xf0b6('0x7'));var squel=require(_0xf0b6('0x8'));var crypto=require(_0xf0b6('0x9'));var jsforce=require(_0xf0b6('0xa'));var deskjs=require(_0xf0b6('0xb'));var toCsv=require(_0xf0b6('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf0b6('0xd'));var as=require(_0xf0b6('0xe'));var hardwareService=require(_0xf0b6('0xf'));var logger=require(_0xf0b6('0x10'))(_0xf0b6('0x11'));var utils=require(_0xf0b6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf0b6('0x13'));var db=require(_0xf0b6('0x14'))['db'];function respondWithStatusCode(_0x1321a8,_0xe5b26b){_0xe5b26b=_0xe5b26b||0xcc;return function(_0x56d5fb){if(_0x56d5fb){return _0x1321a8[_0xf0b6('0x15')](_0xe5b26b);}return _0x1321a8[_0xf0b6('0x16')](_0xe5b26b)[_0xf0b6('0x17')]();};}function respondWithResult(_0xc85d9,_0x41352c){_0x41352c=_0x41352c||0xc8;return function(_0x1385e1){if(_0x1385e1){return _0xc85d9[_0xf0b6('0x16')](_0x41352c)[_0xf0b6('0x18')](_0x1385e1);}};}function respondWithFilteredResult(_0xda5ab,_0x54b55d){return function(_0x1d5bfc){if(_0x1d5bfc){var _0x44a7f7=typeof _0x54b55d[_0xf0b6('0x19')]===_0xf0b6('0x1a')&&typeof _0x54b55d[_0xf0b6('0x1b')]==='undefined';var _0x16acca=_0x1d5bfc[_0xf0b6('0x1c')];var _0xa3e922=_0x44a7f7?0x0:_0x54b55d[_0xf0b6('0x19')];var _0x2b39ce=_0x44a7f7?_0x1d5bfc[_0xf0b6('0x1c')]:_0x54b55d[_0xf0b6('0x19')]+_0x54b55d[_0xf0b6('0x1b')];var _0x5e55d4;if(_0x2b39ce>=_0x16acca){_0x2b39ce=_0x16acca;_0x5e55d4=0xc8;}else{_0x5e55d4=0xce;}_0xda5ab[_0xf0b6('0x16')](_0x5e55d4);return _0xda5ab[_0xf0b6('0x1d')]('Content-Range',_0xa3e922+'-'+_0x2b39ce+'/'+_0x16acca)[_0xf0b6('0x18')](_0x1d5bfc);}return null;};}function patchUpdates(_0x3080e9){return function(_0x56c588){try{jsonpatch['apply'](_0x56c588,_0x3080e9,!![]);}catch(_0x48139d){return BPromise[_0xf0b6('0x1e')](_0x48139d);}return _0x56c588['save']();};}function saveUpdates(_0x5b1e54,_0x5a9625){return function(_0x1fc60b){if(_0x1fc60b){return _0x1fc60b[_0xf0b6('0x1f')](_0x5b1e54)[_0xf0b6('0x20')](function(_0x17ec54){return _0x17ec54;});}return null;};}function removeEntity(_0x5588dd,_0x25a6e0){return function(_0x5319f7){if(_0x5319f7){return _0x5319f7[_0xf0b6('0x21')]()[_0xf0b6('0x20')](function(){_0x5588dd['status'](0xcc)[_0xf0b6('0x17')]();});}};}function handleEntityNotFound(_0x39fcbc,_0x5d48f9){return function(_0x5a3f18){if(!_0x5a3f18){_0x39fcbc[_0xf0b6('0x15')](0x194);}return _0x5a3f18;};}function handleError(_0x8e6758,_0x1a5768){_0x1a5768=_0x1a5768||0x1f4;return function(_0x263516){logger[_0xf0b6('0x22')](_0x263516[_0xf0b6('0x23')]);if(_0x263516[_0xf0b6('0x24')]){delete _0x263516[_0xf0b6('0x24')];}_0x8e6758[_0xf0b6('0x16')](_0x1a5768)[_0xf0b6('0x25')](_0x263516);};}exports[_0xf0b6('0x26')]=function(_0x4f477b,_0x3f96c1){var _0x521fa9={},_0x2c5b79={},_0x1b7bb0={'count':0x0,'rows':[]};var _0x5ed673=_[_0xf0b6('0x27')](db[_0xf0b6('0x28')][_0xf0b6('0x29')],function(_0x2b2269){return{'name':_0x2b2269['fieldName'],'type':_0x2b2269[_0xf0b6('0x2a')][_0xf0b6('0x2b')]};});_0x2c5b79['model']=_[_0xf0b6('0x27')](_0x5ed673,_0xf0b6('0x24'));_0x2c5b79[_0xf0b6('0x2c')]=_[_0xf0b6('0x2d')](_0x4f477b[_0xf0b6('0x2c')]);_0x2c5b79[_0xf0b6('0x2e')]=_['intersection'](_0x2c5b79[_0xf0b6('0x2f')],_0x2c5b79[_0xf0b6('0x2c')]);_0x521fa9[_0xf0b6('0x30')]=_[_0xf0b6('0x31')](_0x2c5b79[_0xf0b6('0x2f')],qs['fields'](_0x4f477b[_0xf0b6('0x2c')][_0xf0b6('0x32')]));_0x521fa9[_0xf0b6('0x30')]=_0x521fa9[_0xf0b6('0x30')][_0xf0b6('0x33')]?_0x521fa9[_0xf0b6('0x30')]:_0x2c5b79[_0xf0b6('0x2f')];if(!_0x4f477b[_0xf0b6('0x2c')][_0xf0b6('0x34')]('nolimit')){_0x521fa9[_0xf0b6('0x1b')]=qs[_0xf0b6('0x1b')](_0x4f477b[_0xf0b6('0x2c')]['limit']);_0x521fa9[_0xf0b6('0x19')]=qs[_0xf0b6('0x19')](_0x4f477b[_0xf0b6('0x2c')][_0xf0b6('0x19')]);}_0x521fa9[_0xf0b6('0x35')]=qs[_0xf0b6('0x36')](_0x4f477b[_0xf0b6('0x2c')][_0xf0b6('0x36')]);_0x521fa9['where']=qs['filters'](_[_0xf0b6('0x37')](_0x4f477b['query'],_0x2c5b79[_0xf0b6('0x2e')]),_0x5ed673);if(_0x4f477b['query'][_0xf0b6('0x38')]){_0x521fa9['where']=_[_0xf0b6('0x39')](_0x521fa9['where'],{'$or':_[_0xf0b6('0x27')](_0x5ed673,function(_0x5cac15){if(_0x5cac15[_0xf0b6('0x2a')]!==_0xf0b6('0x3a')){var _0x5b9132={};_0x5b9132[_0x5cac15[_0xf0b6('0x24')]]={'$like':'%'+_0x4f477b['query'][_0xf0b6('0x38')]+'%'};return _0x5b9132;}})});}_0x521fa9=_['merge']({},_0x521fa9,_0x4f477b[_0xf0b6('0x3b')]);var _0x24b61c={'where':_0x521fa9['where']};return db['CmHopperHistory']['count'](_0x24b61c)[_0xf0b6('0x20')](function(_0x5b74fb){_0x1b7bb0[_0xf0b6('0x1c')]=_0x5b74fb;if(_0x4f477b['query'][_0xf0b6('0x3c')]){_0x521fa9[_0xf0b6('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x521fa9);})['then'](function(_0x12e418){_0x1b7bb0[_0xf0b6('0x3e')]=_0x12e418;return _0x1b7bb0;})[_0xf0b6('0x20')](respondWithFilteredResult(_0x3f96c1,_0x521fa9))[_0xf0b6('0x3f')](handleError(_0x3f96c1,null));};exports[_0xf0b6('0x40')]=function(_0x1fb679,_0x1695c3){var _0x31f348={'raw':!![],'where':{'id':_0x1fb679[_0xf0b6('0x41')]['id']}},_0x217c87={};_0x217c87[_0xf0b6('0x2f')]=_['keys'](db['CmHopperHistory'][_0xf0b6('0x29')]);_0x217c87['query']=_[_0xf0b6('0x2d')](_0x1fb679[_0xf0b6('0x2c')]);_0x217c87[_0xf0b6('0x2e')]=_[_0xf0b6('0x31')](_0x217c87[_0xf0b6('0x2f')],_0x217c87[_0xf0b6('0x2c')]);_0x31f348[_0xf0b6('0x30')]=_[_0xf0b6('0x31')](_0x217c87['model'],qs[_0xf0b6('0x32')](_0x1fb679[_0xf0b6('0x2c')][_0xf0b6('0x32')]));_0x31f348[_0xf0b6('0x30')]=_0x31f348[_0xf0b6('0x30')][_0xf0b6('0x33')]?_0x31f348[_0xf0b6('0x30')]:_0x217c87[_0xf0b6('0x2f')];if(_0x1fb679['query'][_0xf0b6('0x3c')]){_0x31f348[_0xf0b6('0x3d')]=[{'all':!![]}];}_0x31f348=_[_0xf0b6('0x39')]({},_0x31f348,_0x1fb679[_0xf0b6('0x3b')]);return db[_0xf0b6('0x28')]['find'](_0x31f348)['then'](handleEntityNotFound(_0x1695c3,null))[_0xf0b6('0x20')](respondWithResult(_0x1695c3,null))['catch'](handleError(_0x1695c3,null));};exports[_0xf0b6('0x42')]=function(_0x49b424,_0x1ce6bf){return db[_0xf0b6('0x28')]['create'](_0x49b424['body'],{})[_0xf0b6('0x20')](respondWithResult(_0x1ce6bf,0xc9))[_0xf0b6('0x3f')](handleError(_0x1ce6bf,null));};exports[_0xf0b6('0x43')]=function(_0x2b7326,_0x1a9848){return db[_0xf0b6('0x28')][_0xf0b6('0x43')]()[_0xf0b6('0x20')](respondWithResult(_0x1a9848,null))[_0xf0b6('0x3f')](handleError(_0x1a9848,null));};exports[_0xf0b6('0x1f')]=function(_0x42b542,_0x48ed9f){if(_0x42b542['body']['uniqueid']){delete _0x42b542[_0xf0b6('0x44')][_0xf0b6('0x45')];}return db[_0xf0b6('0x28')][_0xf0b6('0x46')]({'where':{'uniqueid':_0x42b542[_0xf0b6('0x41')]['id']}})[_0xf0b6('0x20')](handleEntityNotFound(_0x48ed9f,null))[_0xf0b6('0x20')](saveUpdates(_0x42b542[_0xf0b6('0x44')],null))[_0xf0b6('0x20')](respondWithResult(_0x48ed9f,null))['catch'](handleError(_0x48ed9f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a9a101c..c2ebfd1 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 _0x2d07=['CmHopperHistory','endtime','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x44fdc4,_0x1e38d4){var _0x8412bc=function(_0x18bf68){while(--_0x18bf68){_0x44fdc4['push'](_0x44fdc4['shift']());}};_0x8412bc(++_0x1e38d4);}(_0x2d07,0x13a));var _0x72d0=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x2d07[_0x46b22a];return _0x44c2e8;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var logger=require('../../config/logger')(_0x72d0('0x2'));var moment=require(_0x72d0('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d0('0x4'));var fs=require('fs');var path=require(_0x72d0('0x5'));var rimraf=require(_0x72d0('0x6'));var config=require(_0x72d0('0x7'));var attributes=require(_0x72d0('0x8'));module[_0x72d0('0x9')]=function(_0x4e0f5c,_0x180424){return _0x4e0f5c[_0x72d0('0xa')](_0x72d0('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x72d0('0xc')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6132=['cm_hopper_history','endtime','uniqueid','util','api','moment','bluebird','rimraf','./cmHopperHistory.attributes','define'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0x6132,0xf3));var _0x2613=function(_0xd85a94,_0x2ec6fe){_0xd85a94=_0xd85a94-0x0;var _0x1d3d1b=_0x6132[_0xd85a94];return _0x1d3d1b;};'use strict';var _=require('lodash');var util=require(_0x2613('0x0'));var logger=require('../../config/logger')(_0x2613('0x1'));var moment=require(_0x2613('0x2'));var BPromise=require(_0x2613('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2613('0x4'));var config=require('../../config/environment');var attributes=require(_0x2613('0x5'));module['exports']=function(_0x4479f6,_0x3f8ef6){return _0x4479f6[_0x2613('0x6')]('CmHopperHistory',attributes,{'tableName':_0x2613('0x7'),'paranoid':![],'indexes':[{'name':_0x2613('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x2613('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index afe95b9..4ed47ae 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 _0x38a5=['predictiveIntervalTotalCalls','sequelize','COUNT','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','literal','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CmHopperHistory','create','options','raw','CreateCmHopperHistory','AvgHandleTime','where','col'];(function(_0x584dbc,_0x4b102c){var _0x554b9a=function(_0x17b669){while(--_0x17b669){_0x584dbc['push'](_0x584dbc['shift']());}};_0x554b9a(++_0x4b102c);}(_0x38a5,0x69));var _0x538a=function(_0x16e8b7,_0x2f5bc6){_0x16e8b7=_0x16e8b7-0x0;var _0x4b5dfb=_0x38a5[_0x16e8b7];return _0x4b5dfb;};'use strict';var _=require(_0x538a('0x0'));var util=require(_0x538a('0x1'));var moment=require(_0x538a('0x2'));var BPromise=require(_0x538a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x538a('0x4'));var db=require(_0x538a('0x5'))['db'];var utils=require(_0x538a('0x6'));var logger=require(_0x538a('0x7'))(_0x538a('0x8'));var config=require(_0x538a('0x9'));var jayson=require(_0x538a('0xa'));var client=jayson[_0x538a('0xb')][_0x538a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fcf5b,_0x11fbcf,_0x3d4e22){return new BPromise(function(_0x6eed8e,_0x5a750d){return client['request'](_0x3fcf5b,_0x3d4e22)[_0x538a('0xd')](function(_0x74ecbf){logger[_0x538a('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x11fbcf,_0x538a('0xf'));logger[_0x538a('0x10')](_0x538a('0x11'),_0x11fbcf,_0x538a('0xf'),JSON[_0x538a('0x12')](_0x74ecbf));if(_0x74ecbf[_0x538a('0x13')]){if(_0x74ecbf[_0x538a('0x13')][_0x538a('0x14')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x11fbcf,_0x74ecbf[_0x538a('0x13')][_0x538a('0x15')]);return _0x5a750d(_0x74ecbf['error']['message']);}logger[_0x538a('0x13')](_0x538a('0x16'),_0x11fbcf,_0x74ecbf[_0x538a('0x13')][_0x538a('0x15')]);return _0x6eed8e(_0x74ecbf[_0x538a('0x13')][_0x538a('0x15')]);}else{logger[_0x538a('0xe')](_0x538a('0x16'),_0x11fbcf,'request\x20sent');_0x6eed8e(_0x74ecbf[_0x538a('0x17')][_0x538a('0x15')]);}})[_0x538a('0x18')](function(_0x547adf){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x11fbcf,_0x547adf);_0x5a750d(_0x547adf);});});}exports['CreateCmHopperHistory']=function(_0xc94f01){var _0x344b64=this;return new Promise(function(_0x3d7a30,_0x5108fb){return db[_0x538a('0x19')][_0x538a('0x1a')](_0xc94f01['body'],{'raw':_0xc94f01[_0x538a('0x1b')]?_0xc94f01[_0x538a('0x1b')][_0x538a('0x1c')]===undefined?!![]:![]:!![]})[_0x538a('0xd')](function(_0x264f39){logger['info'](_0x538a('0x1d'),_0xc94f01);logger[_0x538a('0x10')]('CreateCmHopperHistory',_0xc94f01,JSON[_0x538a('0x12')](_0x264f39));_0x3d7a30(_0x264f39);})[_0x538a('0x18')](function(_0x3124c0){logger['error'](_0x538a('0x1d'),_0x3124c0['message'],_0xc94f01);_0x5108fb(_0x344b64[_0x538a('0x13')](0x1f4,_0x3124c0['message']));});});};exports[_0x538a('0x1e')]=function(_0x27d5c9){var _0x51766c=this;return new Promise(function(_0x173454,_0x881a04){return db[_0x538a('0x19')]['findAll']({'raw':_0x27d5c9[_0x538a('0x1b')]?_0x27d5c9[_0x538a('0x1b')][_0x538a('0x1c')]===undefined?!![]:![]:!![],'where':_0x27d5c9['options']?_0x27d5c9['options'][_0x538a('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x538a('0x20')]('id')),_0x538a('0x21')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x538a('0x24')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')]['literal'](_0x538a('0x25')))),_0x538a('0x26')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')]['literal'](_0x538a('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x538a('0x22')]['fn'](_0x538a('0x28'),db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')](_0x538a('0x2a')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn']('AVG',db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')](_0x538a('0x2b')))),_0x538a('0x2c')]]})[_0x538a('0xd')](function(_0x240f85){logger[_0x538a('0xe')](_0x538a('0x1e'),_0x27d5c9);logger[_0x538a('0x10')](_0x538a('0x1e'),_0x27d5c9,JSON[_0x538a('0x12')](_0x240f85));_0x173454(_0x240f85);})[_0x538a('0x18')](function(_0x15eff3){logger[_0x538a('0x13')](_0x538a('0x1e'),_0x15eff3[_0x538a('0x15')],_0x27d5c9);_0x881a04(_0x51766c['error'](0x1f4,_0x15eff3[_0x538a('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x53205d){var _0x462518=this;return new Promise(function(_0x246ab9,_0x25a3c4){return db['CmHopperHistory'][_0x538a('0x2d')]({'raw':_0x53205d[_0x538a('0x1b')]?_0x53205d[_0x538a('0x1b')][_0x538a('0x1c')]===undefined?!![]:![]:!![],'where':_0x53205d[_0x538a('0x1b')]?_0x53205d[_0x538a('0x1b')][_0x538a('0x1f')]||null:null,'attributes':[['campaign',_0x538a('0x2e')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db['sequelize'][_0x538a('0x29')](_0x538a('0x2f')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db['sequelize'][_0x538a('0x29')](_0x538a('0x30')))),_0x538a('0x31')],[db['sequelize']['fn']('COUNT',db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')]['literal'](_0x538a('0x32')))),'outboundAnswerCallsDay'],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db['sequelize']['fn']('IF',db[_0x538a('0x22')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')]['literal'](_0x538a('0x33')))),_0x538a('0x34')],[db[_0x538a('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x538a('0x29')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x538a('0x35')],[db['sequelize']['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')](_0x538a('0x36')))),_0x538a('0x37')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db['sequelize']['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db['sequelize']['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')](_0x538a('0x38')))),_0x538a('0x39')],[db[_0x538a('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')]('`state`\x20=\x2014,\x201,\x20null'))),_0x538a('0x3a')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')]('`state`\x20=\x2018,\x201,\x20null'))),_0x538a('0x3b')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db['sequelize']['literal'](_0x538a('0x3c')))),_0x538a('0x3d')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db['sequelize']['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')](_0x538a('0x3e')))),_0x538a('0x3b')],[db[_0x538a('0x22')]['fn']('COUNT',db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')](_0x538a('0x3f')))),_0x538a('0x40')]],'group':[_0x538a('0x41')]})['then'](function(_0x30797c){logger[_0x538a('0xe')]('GetVoiceQueueHopperHistory',_0x53205d);logger['debug'](_0x538a('0x42'),_0x53205d,JSON[_0x538a('0x12')](_0x30797c));_0x246ab9(_0x30797c);})['catch'](function(_0x3566f0){logger[_0x538a('0x13')](_0x538a('0x42'),_0x3566f0['message'],_0x53205d);_0x25a3c4(_0x462518[_0x538a('0x13')](0x1f4,_0x3566f0[_0x538a('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x4d5a10){var _0x2b3393=this;return new Promise(function(_0x1a84b2,_0x1db57a){return db[_0x538a('0x19')][_0x538a('0x2d')]({'raw':_0x4d5a10['options']?_0x4d5a10[_0x538a('0x1b')][_0x538a('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d5a10['options']?_0x4d5a10['options']['where']||null:null,'attributes':[['campaign',_0x538a('0x2e')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')][_0x538a('0x20')]('id')),_0x538a('0x43')],[db[_0x538a('0x22')]['fn'](_0x538a('0x23'),db[_0x538a('0x22')]['fn']('IF',db[_0x538a('0x22')][_0x538a('0x29')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x538a('0xd')](function(_0x32111e){logger[_0x538a('0xe')](_0x538a('0x44'),_0x4d5a10);logger[_0x538a('0x10')](_0x538a('0x44'),_0x4d5a10,JSON['stringify'](_0x32111e));_0x1a84b2(_0x32111e);})['catch'](function(_0x4bab20){logger[_0x538a('0x13')](_0x538a('0x44'),_0x4bab20[_0x538a('0x15')],_0x4d5a10);_0x1db57a(_0x2b3393[_0x538a('0x13')](0x1f4,_0x4bab20[_0x538a('0x15')]));});});}; \ No newline at end of file +var _0x1cf1=['then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','debug','AvgHandleTime','findAll','where','sequelize','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x451faa,_0x3d9def){var _0x4dce7a=function(_0x35c769){while(--_0x35c769){_0x451faa['push'](_0x451faa['shift']());}};_0x4dce7a(++_0x3d9def);}(_0x1cf1,0x10e));var _0x11cf=function(_0x4f2b72,_0x336796){_0x4f2b72=_0x4f2b72-0x0;var _0x19afa2=_0x1cf1[_0x4f2b72];return _0x19afa2;};'use strict';var _=require(_0x11cf('0x0'));var util=require('util');var moment=require(_0x11cf('0x1'));var BPromise=require(_0x11cf('0x2'));var rs=require(_0x11cf('0x3'));var fs=require('fs');var Redis=require(_0x11cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x11cf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11cf('0x6'));var jayson=require(_0x11cf('0x7'));var client=jayson[_0x11cf('0x8')][_0x11cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53484f,_0x42a89e,_0xc0fcc9){return new BPromise(function(_0x5dad93,_0x20b65c){return client['request'](_0x53484f,_0xc0fcc9)[_0x11cf('0xa')](function(_0x3d3229){logger[_0x11cf('0xb')](_0x11cf('0xc'),_0x42a89e,_0x11cf('0xd'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x42a89e,'request\x20sent',JSON[_0x11cf('0xe')](_0x3d3229));if(_0x3d3229['error']){if(_0x3d3229[_0x11cf('0xf')][_0x11cf('0x10')]===0x1f4){logger[_0x11cf('0xf')](_0x11cf('0xc'),_0x42a89e,_0x3d3229[_0x11cf('0xf')]['message']);return _0x20b65c(_0x3d3229['error'][_0x11cf('0x11')]);}logger[_0x11cf('0xf')](_0x11cf('0xc'),_0x42a89e,_0x3d3229[_0x11cf('0xf')][_0x11cf('0x11')]);return _0x5dad93(_0x3d3229[_0x11cf('0xf')][_0x11cf('0x11')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x42a89e,_0x11cf('0xd'));_0x5dad93(_0x3d3229[_0x11cf('0x12')][_0x11cf('0x11')]);}})[_0x11cf('0x13')](function(_0xe9d3af){logger['error'](_0x11cf('0xc'),_0x42a89e,_0xe9d3af);_0x20b65c(_0xe9d3af);});});}exports[_0x11cf('0x14')]=function(_0x593824){var _0x11291c=this;return new Promise(function(_0x21d571,_0x4adb04){return db[_0x11cf('0x15')][_0x11cf('0x16')](_0x593824['body'],{'raw':_0x593824[_0x11cf('0x17')]?_0x593824[_0x11cf('0x17')][_0x11cf('0x18')]===undefined?!![]:![]:!![]})[_0x11cf('0xa')](function(_0x3c7c3b){logger['info'](_0x11cf('0x14'),_0x593824);logger[_0x11cf('0x19')](_0x11cf('0x14'),_0x593824,JSON['stringify'](_0x3c7c3b));_0x21d571(_0x3c7c3b);})[_0x11cf('0x13')](function(_0x354e47){logger[_0x11cf('0xf')](_0x11cf('0x14'),_0x354e47[_0x11cf('0x11')],_0x593824);_0x4adb04(_0x11291c['error'](0x1f4,_0x354e47['message']));});});};exports[_0x11cf('0x1a')]=function(_0x573502){var _0xd253c2=this;return new Promise(function(_0x139b5f,_0x1b1715){return db[_0x11cf('0x15')][_0x11cf('0x1b')]({'raw':_0x573502[_0x11cf('0x17')]?_0x573502['options']['raw']===undefined?!![]:![]:!![],'where':_0x573502[_0x11cf('0x17')]?_0x573502['options'][_0x11cf('0x1c')]||null:null,'attributes':[[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db[_0x11cf('0x1d')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x11cf('0x1f')))),_0x11cf('0x20')],[db['sequelize']['fn'](_0x11cf('0x1e'),db['sequelize']['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')](_0x11cf('0x22')))),_0x11cf('0x23')],[db[_0x11cf('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x11cf('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x11cf('0x24')],[db[_0x11cf('0x1d')]['fn']('AVG',db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')]['literal'](_0x11cf('0x25')))),_0x11cf('0x26')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x27'),db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')](_0x11cf('0x28')))),_0x11cf('0x29')]]})[_0x11cf('0xa')](function(_0x4b79f8){logger[_0x11cf('0xb')](_0x11cf('0x1a'),_0x573502);logger[_0x11cf('0x19')]('AvgHandleTime',_0x573502,JSON['stringify'](_0x4b79f8));_0x139b5f(_0x4b79f8);})[_0x11cf('0x13')](function(_0x184792){logger[_0x11cf('0xf')](_0x11cf('0x1a'),_0x184792[_0x11cf('0x11')],_0x573502);_0x1b1715(_0xd253c2['error'](0x1f4,_0x184792[_0x11cf('0x11')]));});});};exports[_0x11cf('0x2a')]=function(_0x23b581){var _0xe75b59=this;return new Promise(function(_0x4eeb74,_0x567900){return db[_0x11cf('0x15')][_0x11cf('0x1b')]({'raw':_0x23b581[_0x11cf('0x17')]?_0x23b581['options'][_0x11cf('0x18')]===undefined?!![]:![]:!![],'where':_0x23b581[_0x11cf('0x17')]?_0x23b581[_0x11cf('0x17')][_0x11cf('0x1c')]||null:null,'attributes':[[_0x11cf('0x2b'),_0x11cf('0x2c')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0x11cf('0x2d')],[db['sequelize']['fn'](_0x11cf('0x1e'),db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')](_0x11cf('0x2e')))),_0x11cf('0x2f')],[db[_0x11cf('0x1d')]['fn']('COUNT',db[_0x11cf('0x1d')]['fn']('IF',db['sequelize'][_0x11cf('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x11cf('0x30')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')](_0x11cf('0x31')))),'outboundBusyCallsDay'],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x11cf('0x21')](_0x11cf('0x32')))),_0x11cf('0x33')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')](_0x11cf('0x34')))),_0x11cf('0x35')],[db[_0x11cf('0x1d')]['fn']('COUNT',db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')](_0x11cf('0x36')))),_0x11cf('0x37')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')](_0x11cf('0x38')))),_0x11cf('0x39')],[db['sequelize']['fn'](_0x11cf('0x1e'),db[_0x11cf('0x1d')]['fn']('IF',db['sequelize'][_0x11cf('0x21')](_0x11cf('0x3a')))),_0x11cf('0x3b')],[db[_0x11cf('0x1d')]['fn']('COUNT',db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x11cf('0x3c')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db['sequelize']['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0x11cf('0x3d')],[db[_0x11cf('0x1d')]['fn']('COUNT',db[_0x11cf('0x1d')]['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')](_0x11cf('0x3e')))),_0x11cf('0x3f')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db['sequelize']['fn']('IF',db[_0x11cf('0x1d')]['literal'](_0x11cf('0x40')))),_0x11cf('0x3d')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db['sequelize']['fn']('IF',db[_0x11cf('0x1d')]['literal'](_0x11cf('0x41')))),_0x11cf('0x42')]],'group':[_0x11cf('0x2b')]})[_0x11cf('0xa')](function(_0x4da432){logger[_0x11cf('0xb')](_0x11cf('0x2a'),_0x23b581);logger[_0x11cf('0x19')](_0x11cf('0x2a'),_0x23b581,JSON[_0x11cf('0xe')](_0x4da432));_0x4eeb74(_0x4da432);})[_0x11cf('0x13')](function(_0xf82a13){logger[_0x11cf('0xf')](_0x11cf('0x2a'),_0xf82a13[_0x11cf('0x11')],_0x23b581);_0x567900(_0xe75b59[_0x11cf('0xf')](0x1f4,_0xf82a13[_0x11cf('0x11')]));});});};exports[_0x11cf('0x43')]=function(_0xcc0d6c){var _0x3db65d=this;return new Promise(function(_0x238d7e,_0x3cddf5){return db[_0x11cf('0x15')][_0x11cf('0x1b')]({'raw':_0xcc0d6c[_0x11cf('0x17')]?_0xcc0d6c['options'][_0x11cf('0x18')]===undefined?!![]:![]:!![],'where':_0xcc0d6c['options']?_0xcc0d6c[_0x11cf('0x17')]['where']||null:null,'attributes':[[_0x11cf('0x2b'),_0x11cf('0x2c')],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db[_0x11cf('0x1d')][_0x11cf('0x44')]('id')),'ivrTotalCallsDays'],[db[_0x11cf('0x1d')]['fn'](_0x11cf('0x1e'),db['sequelize']['fn']('IF',db[_0x11cf('0x1d')][_0x11cf('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x11cf('0x45')]],'group':[_0x11cf('0x2b')]})[_0x11cf('0xa')](function(_0x3bf557){logger[_0x11cf('0xb')](_0x11cf('0x43'),_0xcc0d6c);logger[_0x11cf('0x19')](_0x11cf('0x43'),_0xcc0d6c,JSON[_0x11cf('0xe')](_0x3bf557));_0x238d7e(_0x3bf557);})[_0x11cf('0x13')](function(_0x270a44){logger[_0x11cf('0xf')]('GetCampaignHopperHistory',_0x270a44[_0x11cf('0x11')],_0xcc0d6c);_0x3cddf5(_0x3db65d[_0x11cf('0xf')](0x1f4,_0x270a44['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 8101f67..38e0156 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 _0xede1=['get','isAuthenticated','/describe','show','create','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller'];(function(_0x125fa6,_0x4e0025){var _0x47adf9=function(_0x28b4d8){while(--_0x28b4d8){_0x125fa6['push'](_0x125fa6['shift']());}};_0x47adf9(++_0x4e0025);}(_0xede1,0x1b8));var _0x1ede=function(_0x5a904b,_0x391dce){_0x5a904b=_0x5a904b-0x0;var _0x28e0c0=_0xede1[_0x5a904b];return _0x28e0c0;};'use strict';var multer=require(_0x1ede('0x0'));var util=require(_0x1ede('0x1'));var path=require(_0x1ede('0x2'));var timeout=require(_0x1ede('0x3'));var express=require(_0x1ede('0x4'));var router=express[_0x1ede('0x5')]();var fs_extra=require(_0x1ede('0x6'));var auth=require(_0x1ede('0x7'));var interaction=require(_0x1ede('0x8'));var config=require('../../config/environment');var controller=require(_0x1ede('0x9'));router[_0x1ede('0xa')]('/',auth[_0x1ede('0xb')](),controller['index']);router[_0x1ede('0xa')](_0x1ede('0xc'),auth[_0x1ede('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1ede('0xd')]);router['post']('/',auth[_0x1ede('0xb')](),controller[_0x1ede('0xe')]);router['put'](_0x1ede('0xf'),auth[_0x1ede('0xb')](),controller[_0x1ede('0x10')]);module[_0x1ede('0x11')]=router; \ No newline at end of file +var _0x2664=['isAuthenticated','index','/describe','describe','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./cmHopperHistory.controller','get'];(function(_0x517bd1,_0x1b5b90){var _0x33366a=function(_0x5933e5){while(--_0x5933e5){_0x517bd1['push'](_0x517bd1['shift']());}};_0x33366a(++_0x1b5b90);}(_0x2664,0xf4));var _0x4266=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2664[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x4266('0x0'));var util=require(_0x4266('0x1'));var path=require(_0x4266('0x2'));var timeout=require(_0x4266('0x3'));var express=require('express');var router=express[_0x4266('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4266('0x5'));var config=require('../../config/environment');var controller=require(_0x4266('0x6'));router[_0x4266('0x7')]('/',auth[_0x4266('0x8')](),controller[_0x4266('0x9')]);router[_0x4266('0x7')](_0x4266('0xa'),auth['isAuthenticated'](),controller[_0x4266('0xb')]);router['get'](_0x4266('0xc'),auth[_0x4266('0x8')](),controller[_0x4266('0xd')]);router[_0x4266('0xe')]('/',auth[_0x4266('0x8')](),controller['create']);router[_0x4266('0xf')](_0x4266('0xc'),auth['isAuthenticated'](),controller[_0x4266('0x10')]);module[_0x4266('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3fb8d2e..ae0e928 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 _0xea81=['name','sequelize','exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xea81,0x1ed));var _0x1ea8=function(_0x1bb889,_0x49c4b5){_0x1bb889=_0x1bb889-0x0;var _0xd8b76d=_0xea81[_0x1bb889];return _0xd8b76d;};'use strict';var Sequelize=require(_0x1ea8('0x0'));module[_0x1ea8('0x1')]={'name':{'type':Sequelize[_0x1ea8('0x2')],'unique':_0x1ea8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x43f3=['STRING','exports'];(function(_0x57d500,_0xf52c67){var _0x142c14=function(_0x4b2055){while(--_0x4b2055){_0x57d500['push'](_0x57d500['shift']());}};_0x142c14(++_0xf52c67);}(_0x43f3,0xab));var _0x343f=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x43f3[_0x616290];return _0x453879;};'use strict';var Sequelize=require('sequelize');module[_0x343f('0x0')]={'name':{'type':Sequelize[_0x343f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x343f('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b2ffd88..ff680da 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 _0x374b=['model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','length','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','params','ListId','getDispositions','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','pick','getContactsCsv','CmCustomField','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','customField_','field','cm_contact_has_items','CmContactId\x20=\x20c.id','description','ItemTypeId\x20=\x20?','description_additionalPhone_','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','Lists','error','stack','name','send','map','CmList','rawAttributes','type','key'];(function(_0x3eb5e4,_0x4b4da9){var _0x572597=function(_0x14b137){while(--_0x14b137){_0x3eb5e4['push'](_0x3eb5e4['shift']());}};_0x572597(++_0x4b4da9);}(_0x374b,0x108));var _0xb374=function(_0x455bff,_0x518f6e){_0x455bff=_0x455bff-0x0;var _0x4f2ba3=_0x374b[_0x455bff];return _0x4f2ba3;};'use strict';var emlformat=require(_0xb374('0x0'));var rimraf=require(_0xb374('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb374('0x2'));var rp=require(_0xb374('0x3'));var moment=require(_0xb374('0x4'));var BPromise=require(_0xb374('0x5'));var Mustache=require(_0xb374('0x6'));var util=require(_0xb374('0x7'));var path=require(_0xb374('0x8'));var sox=require(_0xb374('0x9'));var csv=require(_0xb374('0xa'));var ejs=require(_0xb374('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb374('0xc'));var squel=require('squel');var crypto=require(_0xb374('0xd'));var jsforce=require(_0xb374('0xe'));var deskjs=require(_0xb374('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb374('0x10'));var Papa=require(_0xb374('0x11'));var Redis=require(_0xb374('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb374('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb374('0x14'));var logger=require(_0xb374('0x15'))('api');var utils=require(_0xb374('0x16'));var config=require(_0xb374('0x17'));var licenseUtil=require(_0xb374('0x18'));var db=require(_0xb374('0x19'))['db'];var csv_results;config['redis']=_[_0xb374('0x1a')](config[_0xb374('0x1b')],{'host':_0xb374('0x1c'),'port':0x18eb});var socket=require(_0xb374('0x1d'))(new Redis(config['redis']));require(_0xb374('0x1e'))['register'](socket);function respondWithStatusCode(_0x5be5f2,_0x439140){_0x439140=_0x439140||0xcc;return function(_0x4c1431){if(_0x4c1431){return _0x5be5f2[_0xb374('0x1f')](_0x439140);}return _0x5be5f2[_0xb374('0x20')](_0x439140)[_0xb374('0x21')]();};}function respondWithResult(_0x235f79,_0x22e71b){_0x22e71b=_0x22e71b||0xc8;return function(_0xacbe75){if(_0xacbe75){return _0x235f79['status'](_0x22e71b)['json'](_0xacbe75);}};}function respondWithFilteredResult(_0x1e4824,_0x364624){return function(_0x258bc5){if(_0x258bc5){var _0x190e7c=typeof _0x364624[_0xb374('0x22')]===_0xb374('0x23')&&typeof _0x364624[_0xb374('0x24')]===_0xb374('0x23');var _0x1c739b=_0x258bc5[_0xb374('0x25')];var _0x56ef6d=_0x190e7c?0x0:_0x364624[_0xb374('0x22')];var _0x208259=_0x190e7c?_0x258bc5[_0xb374('0x25')]:_0x364624[_0xb374('0x22')]+_0x364624[_0xb374('0x24')];var _0x2dc4fc;if(_0x208259>=_0x1c739b){_0x208259=_0x1c739b;_0x2dc4fc=0xc8;}else{_0x2dc4fc=0xce;}_0x1e4824[_0xb374('0x20')](_0x2dc4fc);return _0x1e4824[_0xb374('0x26')](_0xb374('0x27'),_0x56ef6d+'-'+_0x208259+'/'+_0x1c739b)[_0xb374('0x28')](_0x258bc5);}return null;};}function patchUpdates(_0x2b381e){return function(_0x455d11){try{jsonpatch[_0xb374('0x29')](_0x455d11,_0x2b381e,!![]);}catch(_0x18371b){return BPromise[_0xb374('0x2a')](_0x18371b);}return _0x455d11[_0xb374('0x2b')]();};}function saveUpdates(_0x45f7f5,_0x9dbc01){return function(_0x243ae7){if(_0x243ae7){return _0x243ae7[_0xb374('0x2c')](_0x45f7f5)[_0xb374('0x2d')](function(_0x5687fe){return _0x5687fe;});}return null;};}function removeEntity(_0x4248d8,_0x3c7bee){return function(_0x3e99e1){if(_0x3e99e1){return _0x3e99e1['destroy']()['then'](function(){var _0x267045=_0x3e99e1['get']({'plain':!![]});var _0x3f31a4=_0xb374('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x3f31a4,'resourceId':_0x267045['id']}})[_0xb374('0x2d')](function(){return _0x3e99e1;});})[_0xb374('0x2d')](function(){_0x4248d8['status'](0xcc)[_0xb374('0x21')]();});}};}function handleEntityNotFound(_0x92c36,_0x1566d8){return function(_0x1da7c7){if(!_0x1da7c7){_0x92c36['sendStatus'](0x194);}return _0x1da7c7;};}function handleError(_0xbd8dbe,_0x11a6de){_0x11a6de=_0x11a6de||0x1f4;return function(_0x1ffa78){logger[_0xb374('0x2f')](_0x1ffa78[_0xb374('0x30')]);if(_0x1ffa78[_0xb374('0x31')]){delete _0x1ffa78[_0xb374('0x31')];}_0xbd8dbe[_0xb374('0x20')](_0x11a6de)[_0xb374('0x32')](_0x1ffa78);};}exports['index']=function(_0x1ddb7c,_0x2918c0){var _0x3f5614={},_0x2b4b7a={},_0x3dd18c={'count':0x0,'rows':[]};var _0x17fd1b=_[_0xb374('0x33')](db[_0xb374('0x34')][_0xb374('0x35')],function(_0x55764b){return{'name':_0x55764b['fieldName'],'type':_0x55764b[_0xb374('0x36')][_0xb374('0x37')]};});_0x2b4b7a[_0xb374('0x38')]=_[_0xb374('0x33')](_0x17fd1b,_0xb374('0x31'));_0x2b4b7a['query']=_['keys'](_0x1ddb7c[_0xb374('0x39')]);_0x2b4b7a[_0xb374('0x3a')]=_[_0xb374('0x3b')](_0x2b4b7a[_0xb374('0x38')],_0x2b4b7a[_0xb374('0x39')]);_0x3f5614[_0xb374('0x3c')]=_[_0xb374('0x3b')](_0x2b4b7a[_0xb374('0x38')],qs[_0xb374('0x3d')](_0x1ddb7c[_0xb374('0x39')][_0xb374('0x3d')]));_0x3f5614[_0xb374('0x3c')]=_0x3f5614['attributes']['length']?_0x3f5614[_0xb374('0x3c')]:_0x2b4b7a[_0xb374('0x38')];if(!_0x1ddb7c[_0xb374('0x39')][_0xb374('0x3e')](_0xb374('0x3f'))){_0x3f5614['limit']=qs['limit'](_0x1ddb7c['query'][_0xb374('0x24')]);_0x3f5614[_0xb374('0x22')]=qs[_0xb374('0x22')](_0x1ddb7c[_0xb374('0x39')][_0xb374('0x22')]);}_0x3f5614[_0xb374('0x40')]=qs[_0xb374('0x41')](_0x1ddb7c[_0xb374('0x39')][_0xb374('0x41')]);_0x3f5614[_0xb374('0x42')]=qs[_0xb374('0x3a')](_['pick'](_0x1ddb7c[_0xb374('0x39')],_0x2b4b7a['filters']),_0x17fd1b);if(_0x1ddb7c[_0xb374('0x39')][_0xb374('0x43')]){_0x3f5614[_0xb374('0x42')]=_[_0xb374('0x44')](_0x3f5614['where'],{'$or':_[_0xb374('0x33')](_0x17fd1b,function(_0x1ef32b){if(_0x1ef32b[_0xb374('0x36')]!==_0xb374('0x45')){var _0x1b1a57={};_0x1b1a57[_0x1ef32b[_0xb374('0x31')]]={'$like':'%'+_0x1ddb7c[_0xb374('0x39')][_0xb374('0x43')]+'%'};return _0x1b1a57;}})});}_0x3f5614=_['merge']({},_0x3f5614,_0x1ddb7c['options']);var _0x5c4da3={'where':_0x3f5614[_0xb374('0x42')]};return db['CmList']['count'](_0x5c4da3)[_0xb374('0x2d')](function(_0x27cd31){_0x3dd18c[_0xb374('0x25')]=_0x27cd31;if(_0x1ddb7c[_0xb374('0x39')][_0xb374('0x46')]){_0x3f5614[_0xb374('0x47')]=[{'all':!![]}];}return db[_0xb374('0x34')][_0xb374('0x48')](_0x3f5614);})[_0xb374('0x2d')](function(_0x3a563){_0x3dd18c[_0xb374('0x49')]=_0x3a563;return _0x3dd18c;})[_0xb374('0x2d')](respondWithFilteredResult(_0x2918c0,_0x3f5614))[_0xb374('0x4a')](handleError(_0x2918c0,null));};exports[_0xb374('0x4b')]=function(_0x4493be,_0x184120){var _0x27821d={'raw':![],'where':{'id':_0x4493be['params']['id']}},_0xf1eb97={};_0xf1eb97[_0xb374('0x38')]=_[_0xb374('0x4c')](db[_0xb374('0x34')][_0xb374('0x35')]);_0xf1eb97[_0xb374('0x39')]=_[_0xb374('0x4c')](_0x4493be['query']);_0xf1eb97[_0xb374('0x3a')]=_[_0xb374('0x3b')](_0xf1eb97[_0xb374('0x38')],_0xf1eb97[_0xb374('0x39')]);_0x27821d[_0xb374('0x3c')]=_[_0xb374('0x3b')](_0xf1eb97[_0xb374('0x38')],qs['fields'](_0x4493be[_0xb374('0x39')][_0xb374('0x3d')]));_0x27821d[_0xb374('0x3c')]=_0x27821d[_0xb374('0x3c')][_0xb374('0x4d')]?_0x27821d[_0xb374('0x3c')]:_0xf1eb97[_0xb374('0x38')];if(_0x4493be[_0xb374('0x39')][_0xb374('0x46')]){_0x27821d[_0xb374('0x47')]=[{'all':!![]}];}_0x27821d=_[_0xb374('0x44')]({},_0x27821d,_0x4493be[_0xb374('0x4e')]);return db[_0xb374('0x34')]['find'](_0x27821d)[_0xb374('0x2d')](handleEntityNotFound(_0x184120,null))['then'](respondWithResult(_0x184120,null))[_0xb374('0x4a')](handleError(_0x184120,null));};exports[_0xb374('0x4f')]=function(_0x233605,_0x2903a6){return db[_0xb374('0x34')][_0xb374('0x4f')](_0x233605['body'],{})['then'](function(_0x4e595d){var _0x2cf261=_0x233605[_0xb374('0x50')][_0xb374('0x51')]({'plain':!![]});if(!_0x2cf261)throw new Error(_0xb374('0x52'));if(_0x2cf261[_0xb374('0x53')]===_0xb374('0x50')){var _0x218b90=_0x4e595d[_0xb374('0x51')]({'plain':!![]});var _0x1db81c=_0xb374('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x1db81c,'userProfileId':_0x2cf261['userProfileId']},'raw':!![]})[_0xb374('0x2d')](function(_0x433dfc){if(_0x433dfc&&_0x433dfc['autoAssociation']===0x0){return db[_0xb374('0x54')][_0xb374('0x4f')]({'name':_0x218b90[_0xb374('0x31')],'resourceId':_0x218b90['id'],'type':_0x433dfc[_0xb374('0x31')],'sectionId':_0x433dfc['id']},{})[_0xb374('0x2d')](function(){return _0x4e595d;});}else{return _0x4e595d;}})[_0xb374('0x4a')](function(_0x2b53b1){logger[_0xb374('0x2f')](_0xb374('0x55'),_0x2b53b1);throw _0x2b53b1;});}return _0x4e595d;})[_0xb374('0x2d')](respondWithResult(_0x2903a6,0xc9))[_0xb374('0x4a')](handleError(_0x2903a6,null));};exports['update']=function(_0x5ba041,_0x324b38){if(_0x5ba041[_0xb374('0x56')]['id']){delete _0x5ba041['body']['id'];}return db[_0xb374('0x34')][_0xb374('0x57')]({'where':{'id':_0x5ba041['params']['id']}})[_0xb374('0x2d')](handleEntityNotFound(_0x324b38,null))[_0xb374('0x2d')](saveUpdates(_0x5ba041['body'],null))['then'](respondWithResult(_0x324b38,null))[_0xb374('0x4a')](handleError(_0x324b38,null));};exports['destroy']=function(_0x95abf3,_0x5c77e4){return db[_0xb374('0x34')]['find']({'where':{'id':_0x95abf3['params']['id']}})[_0xb374('0x2d')](handleEntityNotFound(_0x5c77e4,null))[_0xb374('0x2d')](removeEntity(_0x5c77e4,null))['catch'](handleError(_0x5c77e4,null));};exports[_0xb374('0x58')]=function(_0x2e83f9,_0x1346cd){return db[_0xb374('0x34')][_0xb374('0x58')]()['then'](respondWithResult(_0x1346cd,null))[_0xb374('0x4a')](handleError(_0x1346cd,null));};exports[_0xb374('0x59')]=function(_0x585291,_0x435c7a,_0x35a662){if(_0x585291[_0xb374('0x56')]['id']){delete _0x585291['body']['id'];}return db[_0xb374('0x34')][_0xb374('0x57')]({'where':{'id':_0x585291[_0xb374('0x5a')]['id']}})[_0xb374('0x2d')](handleEntityNotFound(_0x435c7a,null))[_0xb374('0x2d')](function(_0x1ecf51){if(_0x1ecf51){_0x585291[_0xb374('0x56')][_0xb374('0x5b')]=_0x1ecf51['id'];return db['Disposition'][_0xb374('0x4f')](_0x585291[_0xb374('0x56')]);}})[_0xb374('0x2d')](respondWithResult(_0x435c7a,null))[_0xb374('0x4a')](handleError(_0x435c7a,null));};exports[_0xb374('0x5c')]=function(_0x3abb33,_0x30751e,_0x5ad30c){var _0x40c363={'raw':![],'where':{}};var _0x4b6f86={};var _0x39a7ed={'count':0x0,'rows':[]};return db[_0xb374('0x34')]['findOne']({'where':{'id':_0x3abb33['params']['id']}})[_0xb374('0x2d')](handleEntityNotFound(_0x30751e,null))[_0xb374('0x2d')](function(_0x41b56e){if(_0x41b56e){_0x4b6f86['model']=_[_0xb374('0x4c')](db[_0xb374('0x5d')][_0xb374('0x35')]);_0x4b6f86[_0xb374('0x39')]=_[_0xb374('0x4c')](_0x3abb33['query']);_0x4b6f86[_0xb374('0x3a')]=_[_0xb374('0x3b')](_0x4b6f86[_0xb374('0x38')],_0x4b6f86[_0xb374('0x39')]);_0x40c363[_0xb374('0x3c')]=_[_0xb374('0x3b')](_0x4b6f86[_0xb374('0x38')],qs[_0xb374('0x3d')](_0x3abb33[_0xb374('0x39')][_0xb374('0x3d')]));_0x40c363['attributes']=_0x40c363['attributes'][_0xb374('0x4d')]?_0x40c363['attributes']:_0x4b6f86[_0xb374('0x38')];if(!_0x3abb33[_0xb374('0x39')][_0xb374('0x3e')]('nolimit')){_0x40c363[_0xb374('0x24')]=qs[_0xb374('0x24')](_0x3abb33[_0xb374('0x39')][_0xb374('0x24')]);_0x40c363[_0xb374('0x22')]=qs[_0xb374('0x22')](_0x3abb33[_0xb374('0x39')][_0xb374('0x22')]);}_0x40c363['order']=qs[_0xb374('0x41')](_0x3abb33[_0xb374('0x39')]['sort']);_0x40c363['where']=qs[_0xb374('0x3a')](_['pick'](_0x3abb33['query'],_0x4b6f86[_0xb374('0x3a')]));_0x40c363['where'][_0xb374('0x5b')]=_0x41b56e['id'];if(_0x3abb33['query'][_0xb374('0x43')]){_0x40c363[_0xb374('0x42')]=_[_0xb374('0x44')](_0x40c363[_0xb374('0x42')],{'$or':_['map'](_0x40c363[_0xb374('0x3c')],function(_0x19971f){var _0x13f191={};_0x13f191[_0x19971f]={'$like':'%'+_0x3abb33[_0xb374('0x39')][_0xb374('0x43')]+'%'};return _0x13f191;})});}_0x40c363=_['merge']({},_0x40c363,_0x3abb33[_0xb374('0x4e')]);return db['Disposition'][_0xb374('0x25')]({'where':_0x40c363[_0xb374('0x42')]})[_0xb374('0x2d')](function(_0x1f8b5b){_0x39a7ed[_0xb374('0x25')]=_0x1f8b5b;if(_0x3abb33[_0xb374('0x39')][_0xb374('0x46')]){_0x40c363['include']=[{'all':!![]}];}return db[_0xb374('0x5d')][_0xb374('0x48')](_0x40c363);})['then'](function(_0x2e23bb){_0x39a7ed[_0xb374('0x49')]=_0x2e23bb;return _0x39a7ed;});}})[_0xb374('0x2d')](respondWithFilteredResult(_0x30751e,_0x40c363))['catch'](handleError(_0x30751e,null));};exports[_0xb374('0x5e')]=function(_0x11e8a5,_0x21c8de,_0x3a4761){return db['CmList']['find']({'where':{'id':_0x11e8a5[_0xb374('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21c8de,null))[_0xb374('0x2d')](function(_0x2513ed){if(_0x2513ed){return _0x2513ed[_0xb374('0x5e')](_0x11e8a5[_0xb374('0x39')][_0xb374('0x5f')]);}})[_0xb374('0x2d')](respondWithStatusCode(_0x21c8de,null))['catch'](handleError(_0x21c8de,null));};exports[_0xb374('0x60')]=function(_0x25c8db,_0x347d77,_0x5642c0){return db[_0xb374('0x34')]['find']({'where':{'id':_0x25c8db['params']['id']}})['then'](handleEntityNotFound(_0x347d77,null))[_0xb374('0x2d')](function(_0x1c0c4f){if(_0x1c0c4f){var _0xb4172e=[];var _0x25f4cb={'success':[],'errors':[]};return db[_0xb374('0x61')][_0xb374('0x58')]()['then'](function(_0x242bb9){if(_0x25c8db[_0xb374('0x56')][_0xb374('0x62')]&&_[_0xb374('0x63')](_0x25c8db[_0xb374('0x56')][_0xb374('0x62')])){if(_0x25c8db['body'][_0xb374('0x62')][_0xb374('0x4d')]){_0x25c8db['body']['tags']=_0x25c8db['body']['tags']['join'](';')+';';}else{_0x25c8db[_0xb374('0x56')][_0xb374('0x62')]=null;}}else{_0x25c8db[_0xb374('0x56')][_0xb374('0x62')]=null;}if(_0x25c8db['body']&&_[_0xb374('0x63')](_0x25c8db[_0xb374('0x56')])){for(var _0x4a1528=0x0;_0x4a1528<_0x25c8db['body']['length'];_0x4a1528+=0x1){_0x25c8db[_0xb374('0x56')][_0x4a1528][_0xb374('0x5b')]=_0x25c8db[_0xb374('0x5a')]['id'];_0xb4172e[_0xb374('0x64')](_0x25c8db[_0xb374('0x56')][_0x4a1528]);}return BPromise['each'](_0xb4172e,function(_0x475033){return db['CmContact'][_0xb374('0x4f')](_['omit'](_0x475033,[_0xb374('0x5f'),'id'])||{},{'fields':_[_0xb374('0x4c')](_0x242bb9),'raw':!![]})['then'](function(_0x46deb5){_0x25f4cb[_0xb374('0x65')]['push'](_0x46deb5[_0xb374('0x66')]);})[_0xb374('0x4a')](function(_0x58217f){_0x25f4cb[_0xb374('0x67')]['push']({'data':_0x475033,'error':_0x58217f[_0xb374('0x68')]});});})[_0xb374('0x2d')](function(_0x53256c){return _0x25f4cb;})['catch'](function(_0x303a12){return _0x303a12;});}else{_0x347d77[_0xb374('0x20')](0x190)['json']({'message':_0xb374('0x69')});}});}})[_0xb374('0x2d')](respondWithResult(_0x347d77,null))[_0xb374('0x4a')](handleError(_0x347d77,null));};exports[_0xb374('0x6a')]=function(_0xbca349,_0x153538,_0x5ac917){var _0x44ef31;return db[_0xb374('0x34')]['find']({'where':{'id':_0xbca349[_0xb374('0x5a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xb374('0x6b')}]})[_0xb374('0x2d')](handleEntityNotFound(_0x153538,null))[_0xb374('0x2d')](function(_0x10aaa3){if(_0x10aaa3){_0x44ef31=_0x10aaa3;return db[_0xb374('0x61')]['rawAttributes'];}})[_0xb374('0x2d')](function(_0x12bfeb){if(_0x12bfeb){var _0x2812e0={};var _0x223419={};_0x223419['model']=_['concat'](_['keys'](_0x12bfeb),_['map'](_0x44ef31[_0xb374('0x6b')],function(_0x25df06){return util['format']('cf_%d',_0x25df06['id']);}));_0x223419[_0xb374('0x39')]=_[_0xb374('0x4c')](_0xbca349['query']);_0x223419[_0xb374('0x3a')]=_[_0xb374('0x3b')](_0x223419[_0xb374('0x38')],_0x223419[_0xb374('0x39')]);_0x2812e0['attributes']=_[_0xb374('0x3b')](_0x223419[_0xb374('0x38')],qs['fields'](_0xbca349[_0xb374('0x39')][_0xb374('0x3d')]));_0x2812e0[_0xb374('0x3c')]=_0x2812e0['attributes'][_0xb374('0x4d')]?_0x2812e0['attributes']:_0x223419['model'];if(!_0xbca349['query'][_0xb374('0x3e')](_0xb374('0x3f'))){_0x2812e0[_0xb374('0x24')]=qs[_0xb374('0x24')](_0xbca349[_0xb374('0x39')][_0xb374('0x24')]);_0x2812e0['offset']=qs[_0xb374('0x22')](_0xbca349[_0xb374('0x39')]['offset']);}_0x2812e0[_0xb374('0x40')]=qs['sort'](_0xbca349[_0xb374('0x39')]['sort']);_0x2812e0['where']=qs[_0xb374('0x3a')](_[_0xb374('0x6c')](_0xbca349['query'],_0x223419['filters']));_0x2812e0['raw']=!![];if(_0xbca349[_0xb374('0x39')][_0xb374('0x43')]){_0x2812e0[_0xb374('0x42')]=_['merge'](_0x2812e0[_0xb374('0x42')],{'$or':_[_0xb374('0x33')](_0x2812e0['attributes'],function(_0x3685cf){var _0x5d8298={};_0x5d8298[_0x3685cf]={'$like':'%'+_0xbca349[_0xb374('0x39')]['filter']+'%'};return _0x5d8298;})});}_0x2812e0=_[_0xb374('0x44')]({},_0x2812e0,_0xbca349[_0xb374('0x4e')]);return _0x44ef31[_0xb374('0x6a')](_0x2812e0);}})[_0xb374('0x2d')](respondWithResult(_0x153538,null))[_0xb374('0x4a')](handleError(_0x153538,null));};exports[_0xb374('0x6d')]=function(_0x5a6d0b,_0x25e19,_0x4eb080){var _0x3a7dfa;var _0x1bc0d3;var _0x4aac53;var _0xa796c3=_0x5a6d0b[_0xb374('0x5a')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0xb374('0x31')],'raw':!![],'order':['OrderBy']})[_0xb374('0x2d')](function(_0x247249){_0x3a7dfa=_0x247249;var _0x3d8d50=_[_0xb374('0x4c')](db[_0xb374('0x61')][_0xb374('0x35')]);return db[_0xb374('0x6e')][_0xb374('0x48')]({'raw':!![],'attributes':['id',_0xb374('0x6f')]})[_0xb374('0x2d')](function(_0x1f24c6){_0x1bc0d3=_0x1f24c6;var _0x52cc13=squel[_0xb374('0x70')]()[_0xb374('0x3d')](_0x3d8d50)[_0xb374('0x71')]('cm_contacts','c')[_0xb374('0x42')](_0xb374('0x72'),_0xa796c3)['where'](_0xb374('0x73'))[_0xb374('0x74')]();for(var _0x18a3b5=0x0;_0x18a3b5<_0x1bc0d3[_0xb374('0x4d')];_0x18a3b5++){_0x52cc13['field']('c.cf_'+_0x1bc0d3[_0x18a3b5]['id'],_0xb374('0x75')+_0x1bc0d3[_0x18a3b5][_0xb374('0x6f')]);}for(var _0x18a3b5=0x0;_0x18a3b5<_0x3a7dfa[_0xb374('0x4d')];_0x18a3b5++){_0x52cc13['field'](squel[_0xb374('0x70')]()[_0xb374('0x76')]('item')[_0xb374('0x71')](_0xb374('0x77'))[_0xb374('0x42')]('ItemTypeId\x20=\x20?',_0x3a7dfa[_0x18a3b5]['id'])[_0xb374('0x42')](_0xb374('0x78')),'additionalPhone_'+_0x3a7dfa[_0x18a3b5]['name']);_0x52cc13[_0xb374('0x76')](squel[_0xb374('0x70')]()[_0xb374('0x76')](_0xb374('0x79'))['from'](_0xb374('0x77'))[_0xb374('0x42')](_0xb374('0x7a'),_0x3a7dfa[_0x18a3b5]['id'])['where'](_0xb374('0x78')),_0xb374('0x7b')+_0x3a7dfa[_0x18a3b5]['name']);}var _0x382952=[];_0x382952[_0xb374('0x64')](_0x52cc13['toString']());BPromise['each'](_0x382952,handleQuery)[_0xb374('0x2d')](function(_0x3a274a){handleQuery(_0x52cc13['toString']());var _0x48c7a2=csv_results[0x0];if(!_[_0xb374('0x7c')](_0x48c7a2)){var _0x35e8e9=toCsv(_0x48c7a2);var _0xe3ac11=Date[_0xb374('0x7d')]();fs[_0xb374('0x7e')](util[_0xb374('0x7f')](_0xb374('0x80'),_0xa796c3,_0xe3ac11),_0x35e8e9);_0x25e19['setHeader']('Content-disposition',_0xb374('0x81')+util[_0xb374('0x7f')](_0xb374('0x82'),_0xa796c3,_0xe3ac11));_0x25e19[_0xb374('0x83')](_0xb374('0x84'),_0xb374('0x85'));return _0x25e19['download'](util[_0xb374('0x7f')]('/tmp/list_%d_%s.csv',_0xa796c3,_0xe3ac11));}else{return _0x25e19['sendStatus'](0xcc);}});});});};exports[_0xb374('0x86')]=function(_0x52ae58,_0x58cc3c,_0x5b218c){var _0x246d6d;delete _0x52ae58[_0xb374('0x56')]['id'];return db[_0xb374('0x34')][_0xb374('0x87')]({'where':{'id':_0x52ae58['params']['id']}})[_0xb374('0x2d')](handleEntityNotFound(_0x58cc3c,null))[_0xb374('0x2d')](function(_0x565b94){if(_0x565b94){return db[_0xb374('0x88')][_0xb374('0x89')](function(_0x38f798){return db[_0xb374('0x6e')][_0xb374('0x4f')](_0x52ae58['body'],{'transaction':_0x38f798})[_0xb374('0x2d')](function(_0xebcf4){_0x246d6d=_0xebcf4;return _0x565b94[_0xb374('0x8a')](_0xebcf4,{'transaction':_0x38f798});})[_0xb374('0x2d')](function(){var _0x40bf5b={'type':db[_0xb374('0x8b')][_0xb374('0x8c')],'transaction':_0x38f798};switch(_0x52ae58['body'][_0xb374('0x36')]){case'text':_0x40bf5b[_0xb374('0x36')]=db[_0xb374('0x8b')]['TEXT'];break;case _0xb374('0x8d'):_0x40bf5b['type']=db[_0xb374('0x8b')][_0xb374('0x8e')];break;case'switch':_0x40bf5b[_0xb374('0x36')]=db[_0xb374('0x8b')][_0xb374('0x8f')];_0x40bf5b['defaultValue']=![];break;default:}return db['sequelize'][_0xb374('0x90')][_0xb374('0x91')](_0xb374('0x92'),util['format'](_0xb374('0x93'),_0x246d6d['id']),_0x40bf5b);})['then'](function(){return _0x246d6d;});});}})[_0xb374('0x2d')](respondWithResult(_0x58cc3c,null))[_0xb374('0x4a')](handleError(_0x58cc3c,null));};exports[_0xb374('0x94')]=function(_0x266048,_0x344edf,_0x2977bc){var _0x151fb3={};var _0x561cb0={};var _0x2a20e6;var _0x4cc7a7;return db['CmList']['findOne']({'where':{'id':_0x266048[_0xb374('0x5a')]['id']}})['then'](handleEntityNotFound(_0x344edf,null))[_0xb374('0x2d')](function(_0x35864b){if(_0x35864b){_0x2a20e6=_0x35864b;_0x561cb0[_0xb374('0x38')]=_[_0xb374('0x4c')](db['CmCustomField']['rawAttributes']);_0x561cb0[_0xb374('0x39')]=_[_0xb374('0x4c')](_0x266048[_0xb374('0x39')]);_0x561cb0[_0xb374('0x3a')]=_[_0xb374('0x3b')](_0x561cb0[_0xb374('0x38')],_0x561cb0[_0xb374('0x39')]);_0x151fb3['attributes']=_[_0xb374('0x3b')](_0x561cb0[_0xb374('0x38')],qs['fields'](_0x266048[_0xb374('0x39')]['fields']));_0x151fb3[_0xb374('0x3c')]=_0x151fb3[_0xb374('0x3c')][_0xb374('0x4d')]?_0x151fb3[_0xb374('0x3c')]:_0x561cb0[_0xb374('0x38')];_0x151fb3['order']=qs['sort'](_0x266048[_0xb374('0x39')][_0xb374('0x41')]);_0x151fb3[_0xb374('0x42')]=qs[_0xb374('0x3a')](_[_0xb374('0x6c')](_0x266048[_0xb374('0x39')],_0x561cb0['filters']));_0x151fb3[_0xb374('0x42')]=_[_0xb374('0x44')](_0x151fb3[_0xb374('0x42')],{'$or':[{'ListId':_0x35864b['id']},{'ListId':null}]});if(_0x266048['query'][_0xb374('0x43')]){_0x151fb3[_0xb374('0x42')]=_[_0xb374('0x44')](_0x151fb3[_0xb374('0x42')],{'$or':_['map'](_0x151fb3[_0xb374('0x3c')],function(_0x176f0c){var _0x2a8f5d={};_0x2a8f5d[_0x176f0c]={'$like':'%'+_0x266048[_0xb374('0x39')][_0xb374('0x43')]+'%'};return _0x2a8f5d;})});}_0x151fb3=_[_0xb374('0x44')]({},_0x151fb3,_0x266048[_0xb374('0x4e')]);return db['CmCustomField'][_0xb374('0x95')](_0x151fb3);}})[_0xb374('0x2d')](respondWithResult(_0x344edf,null))[_0xb374('0x4a')](handleError(_0x344edf,null));};exports[_0xb374('0x96')]=function(_0x21544e,_0x3ea060){return db[_0xb374('0x6e')][_0xb374('0x95')]({'where':{'ListId':null}})[_0xb374('0x2d')](handleEntityNotFound(_0x3ea060,null))[_0xb374('0x2d')](function(_0x1660d2){return _0x1660d2;})['then'](respondWithResult(_0x3ea060,null))[_0xb374('0x4a')](handleError(_0x3ea060,null));};exports[_0xb374('0x97')]=function(_0x98b17c,_0x53c57e,_0x4dbb08){return db[_0xb374('0x34')][_0xb374('0x57')]({'where':{'id':_0x98b17c[_0xb374('0x5a')]['id']}})['then'](handleEntityNotFound(_0x53c57e,null))[_0xb374('0x2d')](function(_0x8e23bc){if(_0x8e23bc){return _0x8e23bc[_0xb374('0x97')](_0x98b17c[_0xb374('0x56')][_0xb374('0x5f')],_['omit'](_0x98b17c[_0xb374('0x56')],['ids','id'])||{})[_0xb374('0x98')](function(_0x486134){for(var _0x433cae=0x0;_0x433cae<_0x98b17c['body'][_0xb374('0x5f')][_0xb374('0x4d')];_0x433cae+=0x1){socket['emit'](_0xb374('0x99'),{'UserId':Number(_0x98b17c[_0xb374('0x56')][_0xb374('0x5f')][_0x433cae]),'CmListId':Number(_0x98b17c['params']['id'])});}return _0x486134;});}})[_0xb374('0x2d')](respondWithResult(_0x53c57e,null))[_0xb374('0x4a')](handleError(_0x53c57e,null));};exports[_0xb374('0x9a')]=function(_0x3c1a45,_0x35a0b3,_0x1e4364){return db[_0xb374('0x34')][_0xb374('0x57')]({'where':{'id':_0x3c1a45[_0xb374('0x5a')]['id']}})[_0xb374('0x2d')](handleEntityNotFound(_0x35a0b3,null))[_0xb374('0x2d')](function(_0x1e411b){if(_0x1e411b){return _0x1e411b[_0xb374('0x9a')](_0x3c1a45['query'][_0xb374('0x5f')])[_0xb374('0x2d')](function(){if(_[_0xb374('0x63')](_0x3c1a45['query']['ids'])){for(var _0x2b57a7=0x0;_0x2b57a7<_0x3c1a45['query']['ids']['length'];_0x2b57a7+=0x1){socket[_0xb374('0x9b')](_0xb374('0x9c'),{'UserId':Number(_0x3c1a45[_0xb374('0x39')][_0xb374('0x5f')][_0x2b57a7]),'CmListId':Number(_0x3c1a45['params']['id'])});}}else{socket[_0xb374('0x9b')](_0xb374('0x9c'),{'UserId':Number(_0x3c1a45[_0xb374('0x39')]['ids']),'CmListId':Number(_0x3c1a45['params']['id'])});}});}})[_0xb374('0x2d')](respondWithStatusCode(_0x35a0b3,null))[_0xb374('0x4a')](handleError(_0x35a0b3,null));};exports['getAgents']=function(_0x5cbf05,_0x3675cd,_0x5bc721){var _0x3e45d0={};var _0x1ce4fe={};var _0x470582;var _0x4b6d8e;return db[_0xb374('0x34')][_0xb374('0x87')]({'where':{'id':_0x5cbf05[_0xb374('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3675cd,null))[_0xb374('0x2d')](function(_0xbb064b){if(_0xbb064b){_0x470582=_0xbb064b;_0x1ce4fe[_0xb374('0x38')]=_[_0xb374('0x4c')](db[_0xb374('0x9d')]['rawAttributes']);_0x1ce4fe[_0xb374('0x39')]=_['keys'](_0x5cbf05[_0xb374('0x39')]);_0x1ce4fe[_0xb374('0x3a')]=_['intersection'](_0x1ce4fe['model'],_0x1ce4fe[_0xb374('0x39')]);_0x3e45d0[_0xb374('0x3c')]=_[_0xb374('0x3b')](_0x1ce4fe['model'],qs['fields'](_0x5cbf05[_0xb374('0x39')][_0xb374('0x3d')]));_0x3e45d0['attributes']=_0x3e45d0['attributes'][_0xb374('0x4d')]?_0x3e45d0[_0xb374('0x3c')]:_0x1ce4fe[_0xb374('0x38')];_0x3e45d0[_0xb374('0x40')]=qs['sort'](_0x5cbf05[_0xb374('0x39')][_0xb374('0x41')]);_0x3e45d0['where']=qs[_0xb374('0x3a')](_[_0xb374('0x6c')](_0x5cbf05['query'],_0x1ce4fe[_0xb374('0x3a')]));if(_0x5cbf05['query'][_0xb374('0x43')]){_0x3e45d0['where']=_[_0xb374('0x44')](_0x3e45d0[_0xb374('0x42')],{'$or':_[_0xb374('0x33')](_0x3e45d0[_0xb374('0x3c')],function(_0x1c8f97){var _0x24264b={};_0x24264b[_0x1c8f97]={'$like':'%'+_0x5cbf05['query'][_0xb374('0x43')]+'%'};return _0x24264b;})});}_0x3e45d0=_[_0xb374('0x44')]({},_0x3e45d0,_0x5cbf05[_0xb374('0x4e')]);return _0x470582[_0xb374('0x9e')](_0x3e45d0);}})[_0xb374('0x2d')](function(_0x16b97a){if(_0x16b97a){_0x4b6d8e=_0x16b97a['length'];if(!_0x5cbf05[_0xb374('0x39')][_0xb374('0x3e')](_0xb374('0x3f'))){_0x3e45d0['limit']=qs['limit'](_0x5cbf05[_0xb374('0x39')][_0xb374('0x24')]);_0x3e45d0[_0xb374('0x22')]=qs['offset'](_0x5cbf05[_0xb374('0x39')][_0xb374('0x22')]);}return _0x470582[_0xb374('0x9e')](_0x3e45d0);}})[_0xb374('0x2d')](function(_0x36fffb){if(_0x36fffb){return _0x36fffb?{'count':_0x4b6d8e,'rows':_0x36fffb}:null;}})[_0xb374('0x2d')](respondWithResult(_0x3675cd,null))[_0xb374('0x4a')](handleError(_0x3675cd,null));};function handleQuery(_0x3cf1b8){logger[_0xb374('0x9f')](_0x3cf1b8);return db['sequelize'][_0xb374('0x39')](_0x3cf1b8)[_0xb374('0x98')](function(_0x3bdec1){csv_results[_0xb374('0x64')](_0x3bdec1);})[_0xb374('0x4a')](function(_0x312baf){logger[_0xb374('0x2f')](_0x312baf[_0xb374('0x68')]);});} \ No newline at end of file +var _0x6a1b=['count','Content-Range','apply','save','update','then','get','Lists','UserProfileResource','end','error','stack','name','index','CmList','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','order','map','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','omit','success','dataValues','errors','json','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','ContactItemType','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findOne','pick','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','spread','message','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','limit','undefined'];(function(_0x18e2e8,_0x16ae5a){var _0x2e591c=function(_0x47089a){while(--_0x47089a){_0x18e2e8['push'](_0x18e2e8['shift']());}};_0x2e591c(++_0x16ae5a);}(_0x6a1b,0x7f));var _0xb6a1=function(_0x453ac9,_0x41b7d1){_0x453ac9=_0x453ac9-0x0;var _0x9aaabb=_0x6a1b[_0x453ac9];return _0x9aaabb;};'use strict';var emlformat=require(_0xb6a1('0x0'));var rimraf=require(_0xb6a1('0x1'));var zipdir=require(_0xb6a1('0x2'));var jsonpatch=require(_0xb6a1('0x3'));var rp=require('request-promise');var moment=require(_0xb6a1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb6a1('0x5'));var util=require(_0xb6a1('0x6'));var path=require(_0xb6a1('0x7'));var sox=require(_0xb6a1('0x8'));var csv=require(_0xb6a1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6a1('0xa'));var _=require(_0xb6a1('0xb'));var squel=require(_0xb6a1('0xc'));var crypto=require(_0xb6a1('0xd'));var jsforce=require(_0xb6a1('0xe'));var deskjs=require(_0xb6a1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb6a1('0x10'));var Redis=require(_0xb6a1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb6a1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb6a1('0x13'));var utils=require('../../config/utils');var config=require(_0xb6a1('0x14'));var licenseUtil=require(_0xb6a1('0x15'));var db=require(_0xb6a1('0x16'))['db'];var csv_results;config[_0xb6a1('0x17')]=_[_0xb6a1('0x18')](config[_0xb6a1('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb6a1('0x19'))(new Redis(config[_0xb6a1('0x17')]));require(_0xb6a1('0x1a'))[_0xb6a1('0x1b')](socket);function respondWithStatusCode(_0xcc0c27,_0x1e94c8){_0x1e94c8=_0x1e94c8||0xcc;return function(_0x1ac9fe){if(_0x1ac9fe){return _0xcc0c27[_0xb6a1('0x1c')](_0x1e94c8);}return _0xcc0c27[_0xb6a1('0x1d')](_0x1e94c8)['end']();};}function respondWithResult(_0x4cf95c,_0xb6df3b){_0xb6df3b=_0xb6df3b||0xc8;return function(_0x2ec53f){if(_0x2ec53f){return _0x4cf95c[_0xb6a1('0x1d')](_0xb6df3b)['json'](_0x2ec53f);}};}function respondWithFilteredResult(_0x32b55b,_0x4246c7){return function(_0x261df7){if(_0x261df7){var _0x376a0d=typeof _0x4246c7[_0xb6a1('0x1e')]==='undefined'&&typeof _0x4246c7[_0xb6a1('0x1f')]===_0xb6a1('0x20');var _0x49abdc=_0x261df7[_0xb6a1('0x21')];var _0x498166=_0x376a0d?0x0:_0x4246c7[_0xb6a1('0x1e')];var _0x1ef2ff=_0x376a0d?_0x261df7['count']:_0x4246c7['offset']+_0x4246c7[_0xb6a1('0x1f')];var _0x5ea252;if(_0x1ef2ff>=_0x49abdc){_0x1ef2ff=_0x49abdc;_0x5ea252=0xc8;}else{_0x5ea252=0xce;}_0x32b55b['status'](_0x5ea252);return _0x32b55b['set'](_0xb6a1('0x22'),_0x498166+'-'+_0x1ef2ff+'/'+_0x49abdc)['json'](_0x261df7);}return null;};}function patchUpdates(_0x218119){return function(_0x320b8d){try{jsonpatch[_0xb6a1('0x23')](_0x320b8d,_0x218119,!![]);}catch(_0x2d6e42){return BPromise['reject'](_0x2d6e42);}return _0x320b8d[_0xb6a1('0x24')]();};}function saveUpdates(_0x45d536,_0x3b9870){return function(_0x470d80){if(_0x470d80){return _0x470d80[_0xb6a1('0x25')](_0x45d536)[_0xb6a1('0x26')](function(_0x293d0a){return _0x293d0a;});}return null;};}function removeEntity(_0x19e1fe,_0x2ce0f6){return function(_0x2b22af){if(_0x2b22af){return _0x2b22af['destroy']()[_0xb6a1('0x26')](function(){var _0x2bf212=_0x2b22af[_0xb6a1('0x27')]({'plain':!![]});var _0x373b87=_0xb6a1('0x28');return db[_0xb6a1('0x29')]['destroy']({'where':{'type':_0x373b87,'resourceId':_0x2bf212['id']}})[_0xb6a1('0x26')](function(){return _0x2b22af;});})[_0xb6a1('0x26')](function(){_0x19e1fe[_0xb6a1('0x1d')](0xcc)[_0xb6a1('0x2a')]();});}};}function handleEntityNotFound(_0x33b082,_0xb45178){return function(_0x3db86c){if(!_0x3db86c){_0x33b082[_0xb6a1('0x1c')](0x194);}return _0x3db86c;};}function handleError(_0x4e4cb3,_0x4d07c4){_0x4d07c4=_0x4d07c4||0x1f4;return function(_0x3f9594){logger[_0xb6a1('0x2b')](_0x3f9594[_0xb6a1('0x2c')]);if(_0x3f9594[_0xb6a1('0x2d')]){delete _0x3f9594[_0xb6a1('0x2d')];}_0x4e4cb3[_0xb6a1('0x1d')](_0x4d07c4)['send'](_0x3f9594);};}exports[_0xb6a1('0x2e')]=function(_0x41b348,_0x1538b8){var _0x1fda7c={},_0x1f034a={},_0x120194={'count':0x0,'rows':[]};var _0x429efc=_['map'](db[_0xb6a1('0x2f')][_0xb6a1('0x30')],function(_0x2da99c){return{'name':_0x2da99c[_0xb6a1('0x31')],'type':_0x2da99c[_0xb6a1('0x32')]['key']};});_0x1f034a[_0xb6a1('0x33')]=_['map'](_0x429efc,'name');_0x1f034a[_0xb6a1('0x34')]=_[_0xb6a1('0x35')](_0x41b348['query']);_0x1f034a[_0xb6a1('0x36')]=_[_0xb6a1('0x37')](_0x1f034a[_0xb6a1('0x33')],_0x1f034a['query']);_0x1fda7c['attributes']=_[_0xb6a1('0x37')](_0x1f034a[_0xb6a1('0x33')],qs[_0xb6a1('0x38')](_0x41b348[_0xb6a1('0x34')][_0xb6a1('0x38')]));_0x1fda7c[_0xb6a1('0x39')]=_0x1fda7c[_0xb6a1('0x39')][_0xb6a1('0x3a')]?_0x1fda7c[_0xb6a1('0x39')]:_0x1f034a[_0xb6a1('0x33')];if(!_0x41b348[_0xb6a1('0x34')][_0xb6a1('0x3b')](_0xb6a1('0x3c'))){_0x1fda7c[_0xb6a1('0x1f')]=qs['limit'](_0x41b348['query'][_0xb6a1('0x1f')]);_0x1fda7c[_0xb6a1('0x1e')]=qs['offset'](_0x41b348['query'][_0xb6a1('0x1e')]);}_0x1fda7c['order']=qs[_0xb6a1('0x3d')](_0x41b348[_0xb6a1('0x34')][_0xb6a1('0x3d')]);_0x1fda7c[_0xb6a1('0x3e')]=qs[_0xb6a1('0x36')](_['pick'](_0x41b348[_0xb6a1('0x34')],_0x1f034a[_0xb6a1('0x36')]),_0x429efc);if(_0x41b348[_0xb6a1('0x34')]['filter']){_0x1fda7c[_0xb6a1('0x3e')]=_[_0xb6a1('0x3f')](_0x1fda7c[_0xb6a1('0x3e')],{'$or':_['map'](_0x429efc,function(_0x43b0d0){if(_0x43b0d0[_0xb6a1('0x32')]!=='VIRTUAL'){var _0x48f97f={};_0x48f97f[_0x43b0d0[_0xb6a1('0x2d')]]={'$like':'%'+_0x41b348[_0xb6a1('0x34')][_0xb6a1('0x40')]+'%'};return _0x48f97f;}})});}_0x1fda7c=_[_0xb6a1('0x3f')]({},_0x1fda7c,_0x41b348[_0xb6a1('0x41')]);var _0x3f2ae4={'where':_0x1fda7c['where']};return db['CmList'][_0xb6a1('0x21')](_0x3f2ae4)['then'](function(_0x12aed1){_0x120194['count']=_0x12aed1;if(_0x41b348[_0xb6a1('0x34')][_0xb6a1('0x42')]){_0x1fda7c[_0xb6a1('0x43')]=[{'all':!![]}];}return db[_0xb6a1('0x2f')][_0xb6a1('0x44')](_0x1fda7c);})[_0xb6a1('0x26')](function(_0xb46c06){_0x120194[_0xb6a1('0x45')]=_0xb46c06;return _0x120194;})['then'](respondWithFilteredResult(_0x1538b8,_0x1fda7c))[_0xb6a1('0x46')](handleError(_0x1538b8,null));};exports[_0xb6a1('0x47')]=function(_0x2aee6f,_0x3f7da8){var _0xff1720={'raw':![],'where':{'id':_0x2aee6f[_0xb6a1('0x48')]['id']}},_0x5a2290={};_0x5a2290[_0xb6a1('0x33')]=_[_0xb6a1('0x35')](db['CmList'][_0xb6a1('0x30')]);_0x5a2290['query']=_['keys'](_0x2aee6f['query']);_0x5a2290[_0xb6a1('0x36')]=_[_0xb6a1('0x37')](_0x5a2290[_0xb6a1('0x33')],_0x5a2290['query']);_0xff1720['attributes']=_['intersection'](_0x5a2290[_0xb6a1('0x33')],qs[_0xb6a1('0x38')](_0x2aee6f['query'][_0xb6a1('0x38')]));_0xff1720[_0xb6a1('0x39')]=_0xff1720[_0xb6a1('0x39')][_0xb6a1('0x3a')]?_0xff1720[_0xb6a1('0x39')]:_0x5a2290['model'];if(_0x2aee6f['query'][_0xb6a1('0x42')]){_0xff1720[_0xb6a1('0x43')]=[{'all':!![]}];}_0xff1720=_[_0xb6a1('0x3f')]({},_0xff1720,_0x2aee6f[_0xb6a1('0x41')]);return db[_0xb6a1('0x2f')][_0xb6a1('0x49')](_0xff1720)[_0xb6a1('0x26')](handleEntityNotFound(_0x3f7da8,null))[_0xb6a1('0x26')](respondWithResult(_0x3f7da8,null))[_0xb6a1('0x46')](handleError(_0x3f7da8,null));};exports['create']=function(_0x322772,_0x5c5a36){return db[_0xb6a1('0x2f')][_0xb6a1('0x4a')](_0x322772[_0xb6a1('0x4b')],{})[_0xb6a1('0x26')](function(_0x49999c){var _0x242eb7=_0x322772[_0xb6a1('0x4c')][_0xb6a1('0x27')]({'plain':!![]});if(!_0x242eb7)throw new Error(_0xb6a1('0x4d'));if(_0x242eb7['role']===_0xb6a1('0x4c')){var _0x1615f1=_0x49999c['get']({'plain':!![]});var _0x5693f3=_0xb6a1('0x28');return db[_0xb6a1('0x4e')][_0xb6a1('0x49')]({'where':{'name':_0x5693f3,'userProfileId':_0x242eb7[_0xb6a1('0x4f')]},'raw':!![]})['then'](function(_0x490b5d){if(_0x490b5d&&_0x490b5d[_0xb6a1('0x50')]===0x0){return db[_0xb6a1('0x29')][_0xb6a1('0x4a')]({'name':_0x1615f1[_0xb6a1('0x2d')],'resourceId':_0x1615f1['id'],'type':_0x490b5d['name'],'sectionId':_0x490b5d['id']},{})[_0xb6a1('0x26')](function(){return _0x49999c;});}else{return _0x49999c;}})['catch'](function(_0xae2889){logger['error'](_0xb6a1('0x51'),_0xae2889);throw _0xae2889;});}return _0x49999c;})[_0xb6a1('0x26')](respondWithResult(_0x5c5a36,0xc9))[_0xb6a1('0x46')](handleError(_0x5c5a36,null));};exports[_0xb6a1('0x25')]=function(_0x3d9618,_0x13fc7f){if(_0x3d9618[_0xb6a1('0x4b')]['id']){delete _0x3d9618[_0xb6a1('0x4b')]['id'];}return db[_0xb6a1('0x2f')][_0xb6a1('0x49')]({'where':{'id':_0x3d9618['params']['id']}})[_0xb6a1('0x26')](handleEntityNotFound(_0x13fc7f,null))[_0xb6a1('0x26')](saveUpdates(_0x3d9618['body'],null))['then'](respondWithResult(_0x13fc7f,null))[_0xb6a1('0x46')](handleError(_0x13fc7f,null));};exports['destroy']=function(_0x50baea,_0x47c433){return db['CmList'][_0xb6a1('0x49')]({'where':{'id':_0x50baea[_0xb6a1('0x48')]['id']}})['then'](handleEntityNotFound(_0x47c433,null))[_0xb6a1('0x26')](removeEntity(_0x47c433,null))[_0xb6a1('0x46')](handleError(_0x47c433,null));};exports[_0xb6a1('0x52')]=function(_0x4d56f6,_0x21dec4){return db['CmList'][_0xb6a1('0x52')]()[_0xb6a1('0x26')](respondWithResult(_0x21dec4,null))['catch'](handleError(_0x21dec4,null));};exports[_0xb6a1('0x53')]=function(_0x4f5c96,_0x4fbf69,_0x7302a){if(_0x4f5c96['body']['id']){delete _0x4f5c96[_0xb6a1('0x4b')]['id'];}return db['CmList'][_0xb6a1('0x49')]({'where':{'id':_0x4f5c96[_0xb6a1('0x48')]['id']}})[_0xb6a1('0x26')](handleEntityNotFound(_0x4fbf69,null))[_0xb6a1('0x26')](function(_0x267a2c){if(_0x267a2c){_0x4f5c96['body'][_0xb6a1('0x54')]=_0x267a2c['id'];return db[_0xb6a1('0x55')][_0xb6a1('0x4a')](_0x4f5c96[_0xb6a1('0x4b')]);}})[_0xb6a1('0x26')](respondWithResult(_0x4fbf69,null))['catch'](handleError(_0x4fbf69,null));};exports[_0xb6a1('0x56')]=function(_0x6c113d,_0x488bb2,_0x11bf18){var _0x148f9f={'raw':![],'where':{}};var _0x2ff645={};var _0x4b6ade={'count':0x0,'rows':[]};return db[_0xb6a1('0x2f')]['findOne']({'where':{'id':_0x6c113d[_0xb6a1('0x48')]['id']}})['then'](handleEntityNotFound(_0x488bb2,null))[_0xb6a1('0x26')](function(_0x401296){if(_0x401296){_0x2ff645[_0xb6a1('0x33')]=_[_0xb6a1('0x35')](db[_0xb6a1('0x55')][_0xb6a1('0x30')]);_0x2ff645['query']=_[_0xb6a1('0x35')](_0x6c113d[_0xb6a1('0x34')]);_0x2ff645[_0xb6a1('0x36')]=_[_0xb6a1('0x37')](_0x2ff645[_0xb6a1('0x33')],_0x2ff645[_0xb6a1('0x34')]);_0x148f9f[_0xb6a1('0x39')]=_[_0xb6a1('0x37')](_0x2ff645[_0xb6a1('0x33')],qs[_0xb6a1('0x38')](_0x6c113d[_0xb6a1('0x34')]['fields']));_0x148f9f['attributes']=_0x148f9f['attributes'][_0xb6a1('0x3a')]?_0x148f9f[_0xb6a1('0x39')]:_0x2ff645['model'];if(!_0x6c113d[_0xb6a1('0x34')][_0xb6a1('0x3b')](_0xb6a1('0x3c'))){_0x148f9f[_0xb6a1('0x1f')]=qs[_0xb6a1('0x1f')](_0x6c113d[_0xb6a1('0x34')][_0xb6a1('0x1f')]);_0x148f9f['offset']=qs[_0xb6a1('0x1e')](_0x6c113d[_0xb6a1('0x34')][_0xb6a1('0x1e')]);}_0x148f9f[_0xb6a1('0x57')]=qs[_0xb6a1('0x3d')](_0x6c113d[_0xb6a1('0x34')]['sort']);_0x148f9f[_0xb6a1('0x3e')]=qs['filters'](_['pick'](_0x6c113d['query'],_0x2ff645[_0xb6a1('0x36')]));_0x148f9f[_0xb6a1('0x3e')][_0xb6a1('0x54')]=_0x401296['id'];if(_0x6c113d[_0xb6a1('0x34')][_0xb6a1('0x40')]){_0x148f9f[_0xb6a1('0x3e')]=_[_0xb6a1('0x3f')](_0x148f9f['where'],{'$or':_[_0xb6a1('0x58')](_0x148f9f[_0xb6a1('0x39')],function(_0x103442){var _0x1bec44={};_0x1bec44[_0x103442]={'$like':'%'+_0x6c113d[_0xb6a1('0x34')][_0xb6a1('0x40')]+'%'};return _0x1bec44;})});}_0x148f9f=_[_0xb6a1('0x3f')]({},_0x148f9f,_0x6c113d[_0xb6a1('0x41')]);return db['Disposition'][_0xb6a1('0x21')]({'where':_0x148f9f['where']})[_0xb6a1('0x26')](function(_0x2dc26d){_0x4b6ade['count']=_0x2dc26d;if(_0x6c113d[_0xb6a1('0x34')][_0xb6a1('0x42')]){_0x148f9f['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x148f9f);})[_0xb6a1('0x26')](function(_0x333e8c){_0x4b6ade['rows']=_0x333e8c;return _0x4b6ade;});}})[_0xb6a1('0x26')](respondWithFilteredResult(_0x488bb2,_0x148f9f))['catch'](handleError(_0x488bb2,null));};exports[_0xb6a1('0x59')]=function(_0x2e0cff,_0x13e9d3,_0x24fbb9){return db[_0xb6a1('0x2f')]['find']({'where':{'id':_0x2e0cff[_0xb6a1('0x48')]['id']}})[_0xb6a1('0x26')](handleEntityNotFound(_0x13e9d3,null))[_0xb6a1('0x26')](function(_0x3ddf62){if(_0x3ddf62){return _0x3ddf62[_0xb6a1('0x59')](_0x2e0cff[_0xb6a1('0x34')][_0xb6a1('0x5a')]);}})[_0xb6a1('0x26')](respondWithStatusCode(_0x13e9d3,null))['catch'](handleError(_0x13e9d3,null));};exports[_0xb6a1('0x5b')]=function(_0x10850a,_0x59e418,_0x5ad27a){return db[_0xb6a1('0x2f')][_0xb6a1('0x49')]({'where':{'id':_0x10850a[_0xb6a1('0x48')]['id']}})[_0xb6a1('0x26')](handleEntityNotFound(_0x59e418,null))[_0xb6a1('0x26')](function(_0x22c1a0){if(_0x22c1a0){var _0x3322d8=[];var _0x5c4235={'success':[],'errors':[]};return db[_0xb6a1('0x5c')]['describe']()['then'](function(_0x13476c){if(_0x10850a[_0xb6a1('0x4b')]['tags']&&_[_0xb6a1('0x5d')](_0x10850a[_0xb6a1('0x4b')][_0xb6a1('0x5e')])){if(_0x10850a[_0xb6a1('0x4b')][_0xb6a1('0x5e')][_0xb6a1('0x3a')]){_0x10850a[_0xb6a1('0x4b')]['tags']=_0x10850a[_0xb6a1('0x4b')][_0xb6a1('0x5e')]['join'](';')+';';}else{_0x10850a[_0xb6a1('0x4b')]['tags']=null;}}else{_0x10850a[_0xb6a1('0x4b')]['tags']=null;}if(_0x10850a[_0xb6a1('0x4b')]&&_[_0xb6a1('0x5d')](_0x10850a['body'])){for(var _0x26d572=0x0;_0x26d572<_0x10850a[_0xb6a1('0x4b')][_0xb6a1('0x3a')];_0x26d572+=0x1){_0x10850a[_0xb6a1('0x4b')][_0x26d572]['ListId']=_0x10850a[_0xb6a1('0x48')]['id'];_0x3322d8[_0xb6a1('0x5f')](_0x10850a[_0xb6a1('0x4b')][_0x26d572]);}return BPromise[_0xb6a1('0x60')](_0x3322d8,function(_0x305264){return db[_0xb6a1('0x5c')][_0xb6a1('0x4a')](_[_0xb6a1('0x61')](_0x305264,['ids','id'])||{},{'fields':_[_0xb6a1('0x35')](_0x13476c),'raw':!![]})[_0xb6a1('0x26')](function(_0x2db881){_0x5c4235[_0xb6a1('0x62')][_0xb6a1('0x5f')](_0x2db881[_0xb6a1('0x63')]);})['catch'](function(_0x59fb82){_0x5c4235[_0xb6a1('0x64')][_0xb6a1('0x5f')]({'data':_0x305264,'error':_0x59fb82['message']});});})[_0xb6a1('0x26')](function(_0x5344f4){return _0x5c4235;})[_0xb6a1('0x46')](function(_0x2d3a92){return _0x2d3a92;});}else{_0x59e418[_0xb6a1('0x1d')](0x190)[_0xb6a1('0x65')]({'message':_0xb6a1('0x66')});}});}})[_0xb6a1('0x26')](respondWithResult(_0x59e418,null))['catch'](handleError(_0x59e418,null));};exports[_0xb6a1('0x67')]=function(_0x5dda91,_0x3fb971,_0x35494f){var _0x1e9e44;return db['CmList'][_0xb6a1('0x49')]({'where':{'id':_0x5dda91[_0xb6a1('0x48')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xb6a1('0x68')}]})[_0xb6a1('0x26')](handleEntityNotFound(_0x3fb971,null))[_0xb6a1('0x26')](function(_0x3cd0c3){if(_0x3cd0c3){_0x1e9e44=_0x3cd0c3;return db['CmContact'][_0xb6a1('0x30')];}})[_0xb6a1('0x26')](function(_0x2d15f1){if(_0x2d15f1){var _0x2a806b={};var _0xe01630={};_0xe01630[_0xb6a1('0x33')]=_[_0xb6a1('0x69')](_[_0xb6a1('0x35')](_0x2d15f1),_['map'](_0x1e9e44[_0xb6a1('0x68')],function(_0x5af683){return util[_0xb6a1('0x6a')](_0xb6a1('0x6b'),_0x5af683['id']);}));_0xe01630[_0xb6a1('0x34')]=_[_0xb6a1('0x35')](_0x5dda91[_0xb6a1('0x34')]);_0xe01630[_0xb6a1('0x36')]=_[_0xb6a1('0x37')](_0xe01630[_0xb6a1('0x33')],_0xe01630[_0xb6a1('0x34')]);_0x2a806b[_0xb6a1('0x39')]=_[_0xb6a1('0x37')](_0xe01630[_0xb6a1('0x33')],qs[_0xb6a1('0x38')](_0x5dda91[_0xb6a1('0x34')]['fields']));_0x2a806b['attributes']=_0x2a806b['attributes']['length']?_0x2a806b[_0xb6a1('0x39')]:_0xe01630['model'];if(!_0x5dda91['query'][_0xb6a1('0x3b')](_0xb6a1('0x3c'))){_0x2a806b[_0xb6a1('0x1f')]=qs['limit'](_0x5dda91[_0xb6a1('0x34')][_0xb6a1('0x1f')]);_0x2a806b[_0xb6a1('0x1e')]=qs['offset'](_0x5dda91['query'][_0xb6a1('0x1e')]);}_0x2a806b[_0xb6a1('0x57')]=qs[_0xb6a1('0x3d')](_0x5dda91['query'][_0xb6a1('0x3d')]);_0x2a806b[_0xb6a1('0x3e')]=qs[_0xb6a1('0x36')](_['pick'](_0x5dda91['query'],_0xe01630['filters']));_0x2a806b[_0xb6a1('0x6c')]=!![];if(_0x5dda91['query']['filter']){_0x2a806b['where']=_[_0xb6a1('0x3f')](_0x2a806b['where'],{'$or':_[_0xb6a1('0x58')](_0x2a806b[_0xb6a1('0x39')],function(_0x561b89){var _0x42447b={};_0x42447b[_0x561b89]={'$like':'%'+_0x5dda91[_0xb6a1('0x34')]['filter']+'%'};return _0x42447b;})});}_0x2a806b=_[_0xb6a1('0x3f')]({},_0x2a806b,_0x5dda91[_0xb6a1('0x41')]);return _0x1e9e44[_0xb6a1('0x67')](_0x2a806b);}})['then'](respondWithResult(_0x3fb971,null))[_0xb6a1('0x46')](handleError(_0x3fb971,null));};exports['getContactsCsv']=function(_0x12375f,_0x4c0bce,_0x511665){var _0x16d739;var _0x5b66a3;var _0x169e25;var _0x40f039=_0x12375f[_0xb6a1('0x48')]['id'];csv_results=[];return db[_0xb6a1('0x6d')][_0xb6a1('0x44')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})['then'](function(_0x3317fc){_0x16d739=_0x3317fc;var _0x341db6=_['keys'](db[_0xb6a1('0x5c')][_0xb6a1('0x30')]);return db[_0xb6a1('0x6e')][_0xb6a1('0x44')]({'raw':!![],'attributes':['id',_0xb6a1('0x6f')]})[_0xb6a1('0x26')](function(_0x119cc5){_0x5b66a3=_0x119cc5;var _0x518600=squel[_0xb6a1('0x70')]()[_0xb6a1('0x38')](_0x341db6)[_0xb6a1('0x71')](_0xb6a1('0x72'),'c')['where'](_0xb6a1('0x73'),_0x40f039)[_0xb6a1('0x3e')]('c.deletedAt\x20is\x20null')[_0xb6a1('0x74')]();for(var _0x476cb1=0x0;_0x476cb1<_0x5b66a3[_0xb6a1('0x3a')];_0x476cb1++){_0x518600[_0xb6a1('0x75')](_0xb6a1('0x76')+_0x5b66a3[_0x476cb1]['id'],_0xb6a1('0x77')+_0x5b66a3[_0x476cb1][_0xb6a1('0x6f')]);}for(var _0x476cb1=0x0;_0x476cb1<_0x16d739[_0xb6a1('0x3a')];_0x476cb1++){_0x518600['field'](squel['select']()[_0xb6a1('0x75')]('item')[_0xb6a1('0x71')](_0xb6a1('0x78'))[_0xb6a1('0x3e')](_0xb6a1('0x79'),_0x16d739[_0x476cb1]['id'])[_0xb6a1('0x3e')](_0xb6a1('0x7a')),'additionalPhone_'+_0x16d739[_0x476cb1][_0xb6a1('0x2d')]);_0x518600['field'](squel[_0xb6a1('0x70')]()[_0xb6a1('0x75')]('description')[_0xb6a1('0x71')](_0xb6a1('0x78'))[_0xb6a1('0x3e')](_0xb6a1('0x79'),_0x16d739[_0x476cb1]['id'])['where'](_0xb6a1('0x7a')),_0xb6a1('0x7b')+_0x16d739[_0x476cb1][_0xb6a1('0x2d')]);}var _0x44d0c4=[];_0x44d0c4[_0xb6a1('0x5f')](_0x518600[_0xb6a1('0x7c')]());BPromise['each'](_0x44d0c4,handleQuery)[_0xb6a1('0x26')](function(_0xebfb37){handleQuery(_0x518600[_0xb6a1('0x7c')]());var _0x1b2903=csv_results[0x0];if(!_['isEmpty'](_0x1b2903)){var _0x4f7029=toCsv(_0x1b2903);var _0x461779=Date[_0xb6a1('0x7d')]();fs[_0xb6a1('0x7e')](util[_0xb6a1('0x6a')](_0xb6a1('0x7f'),_0x40f039,_0x461779),_0x4f7029);_0x4c0bce[_0xb6a1('0x80')](_0xb6a1('0x81'),_0xb6a1('0x82')+util[_0xb6a1('0x6a')](_0xb6a1('0x83'),_0x40f039,_0x461779));_0x4c0bce['setHeader'](_0xb6a1('0x84'),_0xb6a1('0x85'));return _0x4c0bce['download'](util['format'](_0xb6a1('0x7f'),_0x40f039,_0x461779));}else{return _0x4c0bce[_0xb6a1('0x1c')](0xcc);}});});});};exports[_0xb6a1('0x86')]=function(_0x58db86,_0x350db9,_0x3929b4){var _0x105df5;delete _0x58db86[_0xb6a1('0x4b')]['id'];return db[_0xb6a1('0x2f')]['findOne']({'where':{'id':_0x58db86[_0xb6a1('0x48')]['id']}})[_0xb6a1('0x26')](handleEntityNotFound(_0x350db9,null))['then'](function(_0x2bd93f){if(_0x2bd93f){return db[_0xb6a1('0x87')][_0xb6a1('0x88')](function(_0x581445){return db[_0xb6a1('0x6e')][_0xb6a1('0x4a')](_0x58db86[_0xb6a1('0x4b')],{'transaction':_0x581445})[_0xb6a1('0x26')](function(_0x12cc0e){_0x105df5=_0x12cc0e;return _0x2bd93f[_0xb6a1('0x89')](_0x12cc0e,{'transaction':_0x581445});})['then'](function(){var _0x53ea73={'type':db['Sequelize'][_0xb6a1('0x8a')],'transaction':_0x581445};switch(_0x58db86[_0xb6a1('0x4b')][_0xb6a1('0x32')]){case _0xb6a1('0x8b'):_0x53ea73[_0xb6a1('0x32')]=db[_0xb6a1('0x8c')]['TEXT'];break;case'number':_0x53ea73['type']=db[_0xb6a1('0x8c')][_0xb6a1('0x8d')];break;case _0xb6a1('0x8e'):_0x53ea73[_0xb6a1('0x32')]=db[_0xb6a1('0x8c')]['BOOLEAN'];_0x53ea73[_0xb6a1('0x8f')]=![];break;default:}return db['sequelize'][_0xb6a1('0x90')][_0xb6a1('0x91')](_0xb6a1('0x72'),util[_0xb6a1('0x6a')](_0xb6a1('0x92'),_0x105df5['id']),_0x53ea73);})['then'](function(){return _0x105df5;});});}})[_0xb6a1('0x26')](respondWithResult(_0x350db9,null))[_0xb6a1('0x46')](handleError(_0x350db9,null));};exports[_0xb6a1('0x93')]=function(_0x3ef33e,_0x59a20e,_0x2d2cca){var _0x5c9500={};var _0x3686a8={};var _0x28ce08;var _0x3eeb8a;return db[_0xb6a1('0x2f')][_0xb6a1('0x94')]({'where':{'id':_0x3ef33e[_0xb6a1('0x48')]['id']}})[_0xb6a1('0x26')](handleEntityNotFound(_0x59a20e,null))[_0xb6a1('0x26')](function(_0xf8deff){if(_0xf8deff){_0x28ce08=_0xf8deff;_0x3686a8[_0xb6a1('0x33')]=_[_0xb6a1('0x35')](db[_0xb6a1('0x6e')][_0xb6a1('0x30')]);_0x3686a8[_0xb6a1('0x34')]=_[_0xb6a1('0x35')](_0x3ef33e['query']);_0x3686a8[_0xb6a1('0x36')]=_[_0xb6a1('0x37')](_0x3686a8[_0xb6a1('0x33')],_0x3686a8[_0xb6a1('0x34')]);_0x5c9500['attributes']=_['intersection'](_0x3686a8[_0xb6a1('0x33')],qs[_0xb6a1('0x38')](_0x3ef33e['query'][_0xb6a1('0x38')]));_0x5c9500[_0xb6a1('0x39')]=_0x5c9500[_0xb6a1('0x39')]['length']?_0x5c9500[_0xb6a1('0x39')]:_0x3686a8[_0xb6a1('0x33')];_0x5c9500[_0xb6a1('0x57')]=qs[_0xb6a1('0x3d')](_0x3ef33e[_0xb6a1('0x34')][_0xb6a1('0x3d')]);_0x5c9500[_0xb6a1('0x3e')]=qs[_0xb6a1('0x36')](_[_0xb6a1('0x95')](_0x3ef33e[_0xb6a1('0x34')],_0x3686a8[_0xb6a1('0x36')]));_0x5c9500['where']=_[_0xb6a1('0x3f')](_0x5c9500['where'],{'$or':[{'ListId':_0xf8deff['id']},{'ListId':null}]});if(_0x3ef33e[_0xb6a1('0x34')][_0xb6a1('0x40')]){_0x5c9500[_0xb6a1('0x3e')]=_[_0xb6a1('0x3f')](_0x5c9500['where'],{'$or':_[_0xb6a1('0x58')](_0x5c9500[_0xb6a1('0x39')],function(_0x22a986){var _0x582e7b={};_0x582e7b[_0x22a986]={'$like':'%'+_0x3ef33e[_0xb6a1('0x34')][_0xb6a1('0x40')]+'%'};return _0x582e7b;})});}_0x5c9500=_[_0xb6a1('0x3f')]({},_0x5c9500,_0x3ef33e['options']);return db[_0xb6a1('0x6e')][_0xb6a1('0x96')](_0x5c9500);}})[_0xb6a1('0x26')](respondWithResult(_0x59a20e,null))[_0xb6a1('0x46')](handleError(_0x59a20e,null));};exports[_0xb6a1('0x97')]=function(_0x44db21,_0x1b86b9){return db[_0xb6a1('0x6e')][_0xb6a1('0x96')]({'where':{'ListId':null}})[_0xb6a1('0x26')](handleEntityNotFound(_0x1b86b9,null))[_0xb6a1('0x26')](function(_0x13220a){return _0x13220a;})[_0xb6a1('0x26')](respondWithResult(_0x1b86b9,null))[_0xb6a1('0x46')](handleError(_0x1b86b9,null));};exports[_0xb6a1('0x98')]=function(_0x8b4c62,_0x3e100a,_0x4d29c5){return db['CmList'][_0xb6a1('0x49')]({'where':{'id':_0x8b4c62['params']['id']}})['then'](handleEntityNotFound(_0x3e100a,null))[_0xb6a1('0x26')](function(_0x3c0401){if(_0x3c0401){return _0x3c0401['addAgents'](_0x8b4c62[_0xb6a1('0x4b')][_0xb6a1('0x5a')],_[_0xb6a1('0x61')](_0x8b4c62[_0xb6a1('0x4b')],['ids','id'])||{})['spread'](function(_0x2a6270){for(var _0x4d2810=0x0;_0x4d2810<_0x8b4c62[_0xb6a1('0x4b')][_0xb6a1('0x5a')][_0xb6a1('0x3a')];_0x4d2810+=0x1){socket[_0xb6a1('0x99')](_0xb6a1('0x9a'),{'UserId':Number(_0x8b4c62['body'][_0xb6a1('0x5a')][_0x4d2810]),'CmListId':Number(_0x8b4c62[_0xb6a1('0x48')]['id'])});}return _0x2a6270;});}})[_0xb6a1('0x26')](respondWithResult(_0x3e100a,null))[_0xb6a1('0x46')](handleError(_0x3e100a,null));};exports[_0xb6a1('0x9b')]=function(_0x5140b1,_0x1bfe30,_0xe0fb93){return db[_0xb6a1('0x2f')]['find']({'where':{'id':_0x5140b1[_0xb6a1('0x48')]['id']}})[_0xb6a1('0x26')](handleEntityNotFound(_0x1bfe30,null))[_0xb6a1('0x26')](function(_0x210f83){if(_0x210f83){return _0x210f83['removeAgents'](_0x5140b1[_0xb6a1('0x34')][_0xb6a1('0x5a')])[_0xb6a1('0x26')](function(){if(_[_0xb6a1('0x5d')](_0x5140b1[_0xb6a1('0x34')][_0xb6a1('0x5a')])){for(var _0x5b551d=0x0;_0x5b551d<_0x5140b1[_0xb6a1('0x34')][_0xb6a1('0x5a')]['length'];_0x5b551d+=0x1){socket['emit'](_0xb6a1('0x9c'),{'UserId':Number(_0x5140b1[_0xb6a1('0x34')][_0xb6a1('0x5a')][_0x5b551d]),'CmListId':Number(_0x5140b1[_0xb6a1('0x48')]['id'])});}}else{socket[_0xb6a1('0x99')]('userCmList:remove',{'UserId':Number(_0x5140b1[_0xb6a1('0x34')][_0xb6a1('0x5a')]),'CmListId':Number(_0x5140b1[_0xb6a1('0x48')]['id'])});}});}})[_0xb6a1('0x26')](respondWithStatusCode(_0x1bfe30,null))[_0xb6a1('0x46')](handleError(_0x1bfe30,null));};exports[_0xb6a1('0x9d')]=function(_0x2caf9e,_0x20562d,_0xd01aed){var _0x2ac721={};var _0x20a334={};var _0x165d5c;var _0x254baa;return db[_0xb6a1('0x2f')]['findOne']({'where':{'id':_0x2caf9e[_0xb6a1('0x48')]['id']}})['then'](handleEntityNotFound(_0x20562d,null))[_0xb6a1('0x26')](function(_0x2fd2d1){if(_0x2fd2d1){_0x165d5c=_0x2fd2d1;_0x20a334[_0xb6a1('0x33')]=_[_0xb6a1('0x35')](db['User'][_0xb6a1('0x30')]);_0x20a334[_0xb6a1('0x34')]=_['keys'](_0x2caf9e[_0xb6a1('0x34')]);_0x20a334[_0xb6a1('0x36')]=_[_0xb6a1('0x37')](_0x20a334[_0xb6a1('0x33')],_0x20a334['query']);_0x2ac721['attributes']=_[_0xb6a1('0x37')](_0x20a334['model'],qs[_0xb6a1('0x38')](_0x2caf9e[_0xb6a1('0x34')][_0xb6a1('0x38')]));_0x2ac721[_0xb6a1('0x39')]=_0x2ac721[_0xb6a1('0x39')][_0xb6a1('0x3a')]?_0x2ac721['attributes']:_0x20a334[_0xb6a1('0x33')];_0x2ac721['order']=qs[_0xb6a1('0x3d')](_0x2caf9e[_0xb6a1('0x34')][_0xb6a1('0x3d')]);_0x2ac721[_0xb6a1('0x3e')]=qs[_0xb6a1('0x36')](_[_0xb6a1('0x95')](_0x2caf9e['query'],_0x20a334[_0xb6a1('0x36')]));if(_0x2caf9e[_0xb6a1('0x34')][_0xb6a1('0x40')]){_0x2ac721[_0xb6a1('0x3e')]=_['merge'](_0x2ac721[_0xb6a1('0x3e')],{'$or':_[_0xb6a1('0x58')](_0x2ac721[_0xb6a1('0x39')],function(_0x2c49c2){var _0x29f42e={};_0x29f42e[_0x2c49c2]={'$like':'%'+_0x2caf9e[_0xb6a1('0x34')][_0xb6a1('0x40')]+'%'};return _0x29f42e;})});}_0x2ac721=_[_0xb6a1('0x3f')]({},_0x2ac721,_0x2caf9e['options']);return _0x165d5c[_0xb6a1('0x9d')](_0x2ac721);}})[_0xb6a1('0x26')](function(_0x419940){if(_0x419940){_0x254baa=_0x419940[_0xb6a1('0x3a')];if(!_0x2caf9e['query']['hasOwnProperty'](_0xb6a1('0x3c'))){_0x2ac721['limit']=qs[_0xb6a1('0x1f')](_0x2caf9e[_0xb6a1('0x34')][_0xb6a1('0x1f')]);_0x2ac721[_0xb6a1('0x1e')]=qs[_0xb6a1('0x1e')](_0x2caf9e[_0xb6a1('0x34')]['offset']);}return _0x165d5c[_0xb6a1('0x9d')](_0x2ac721);}})[_0xb6a1('0x26')](function(_0x389580){if(_0x389580){return _0x389580?{'count':_0x254baa,'rows':_0x389580}:null;}})[_0xb6a1('0x26')](respondWithResult(_0x20562d,null))['catch'](handleError(_0x20562d,null));};function handleQuery(_0x8badb9){logger['info'](_0x8badb9);return db[_0xb6a1('0x87')][_0xb6a1('0x34')](_0x8badb9)[_0xb6a1('0x9e')](function(_0x58817d){csv_results[_0xb6a1('0x5f')](_0x58817d);})[_0xb6a1('0x46')](function(_0x21fc7b){logger[_0xb6a1('0x2b')](_0x21fc7b[_0xb6a1('0x9f')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 54a47e7..48d3eb0 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x5fc3[_0x13cab0];return _0x38804f;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x5fc3[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 6ee54dd..d2d0767 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 _0xa75b=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','api','moment','bluebird'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xa75b,0x170));var _0xba75=function(_0x41855d,_0x84dea2){_0x41855d=_0x41855d-0x0;var _0x419964=_0xa75b[_0x41855d];return _0x419964;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4522=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api','moment','request-promise'];(function(_0x471b1d,_0x3568c6){var _0x47f8d9=function(_0x5defc5){while(--_0x5defc5){_0x471b1d['push'](_0x471b1d['shift']());}};_0x47f8d9(++_0x3568c6);}(_0x4522,0x1a0));var _0x2452=function(_0x3b271e,_0x4bfe3d){_0x3b271e=_0x3b271e-0x0;var _0x1b6569=_0x4522[_0x3b271e];return _0x1b6569;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var fs=require('fs');var path=require(_0x2452('0x4'));var rimraf=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var attributes=require(_0x2452('0x7'));module[_0x2452('0x8')]=function(_0x15fc69,_0x226578){return _0x15fc69[_0x2452('0x9')](_0x2452('0xa'),attributes,{'tableName':_0x2452('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 6ef7dc9..174716f 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 _0x327f=['socket.io-emitter','register','then','info','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2ca5a4,_0x471977){var _0x52a598=function(_0x4511ca){while(--_0x4511ca){_0x2ca5a4['push'](_0x2ca5a4['shift']());}};_0x52a598(++_0x471977);}(_0x327f,0x174));var _0xf327=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x327f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xf327('0x0'));var util=require(_0xf327('0x1'));var moment=require(_0xf327('0x2'));var BPromise=require(_0xf327('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf327('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf327('0x5'));var logger=require(_0xf327('0x6'))('rpc');var config=require(_0xf327('0x7'));var jayson=require(_0xf327('0x8'));var client=jayson[_0xf327('0x9')][_0xf327('0xa')]({'port':0x232a});config[_0xf327('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf327('0xc'))(new Redis(config[_0xf327('0xb')]));require('./cmList.socket')[_0xf327('0xd')](socket);function respondWithRpcPromise(_0x50d33f,_0x282b3b,_0x4b02bf){return new BPromise(function(_0x33beed,_0x193bb6){return client['request'](_0x50d33f,_0x4b02bf)[_0xf327('0xe')](function(_0x52d983){logger[_0xf327('0xf')]('CmList,\x20%s,\x20%s',_0x282b3b,_0xf327('0x10'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x282b3b,'request\x20sent',JSON[_0xf327('0x11')](_0x52d983));if(_0x52d983[_0xf327('0x12')]){if(_0x52d983[_0xf327('0x12')][_0xf327('0x13')]===0x1f4){logger['error'](_0xf327('0x14'),_0x282b3b,_0x52d983['error'][_0xf327('0x15')]);return _0x193bb6(_0x52d983[_0xf327('0x12')][_0xf327('0x15')]);}logger['error'](_0xf327('0x14'),_0x282b3b,_0x52d983[_0xf327('0x12')][_0xf327('0x15')]);return _0x33beed(_0x52d983[_0xf327('0x12')][_0xf327('0x15')]);}else{logger[_0xf327('0xf')](_0xf327('0x14'),_0x282b3b,_0xf327('0x10'));_0x33beed(_0x52d983[_0xf327('0x16')][_0xf327('0x15')]);}})[_0xf327('0x17')](function(_0x44aa54){logger['error'](_0xf327('0x14'),_0x282b3b,_0x44aa54);_0x193bb6(_0x44aa54);});});} \ No newline at end of file +var _0x7b82=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x42e7ce,_0x375d2e){var _0x3d5428=function(_0x5bcd4b){while(--_0x5bcd4b){_0x42e7ce['push'](_0x42e7ce['shift']());}};_0x3d5428(++_0x375d2e);}(_0x7b82,0xf4));var _0x27b8=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x7b82[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x27b8('0x0'));var util=require(_0x27b8('0x1'));var moment=require(_0x27b8('0x2'));var BPromise=require(_0x27b8('0x3'));var rs=require(_0x27b8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27b8('0x5'))['db'];var utils=require(_0x27b8('0x6'));var logger=require('../../config/logger')(_0x27b8('0x7'));var config=require(_0x27b8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x27b8('0x9')][_0x27b8('0xa')]({'port':0x232a});config[_0x27b8('0xb')]=_['defaults'](config[_0x27b8('0xb')],{'host':_0x27b8('0xc'),'port':0x18eb});var socket=require(_0x27b8('0xd'))(new Redis(config['redis']));require(_0x27b8('0xe'))[_0x27b8('0xf')](socket);function respondWithRpcPromise(_0x458384,_0x449f02,_0x716853){return new BPromise(function(_0x27bca7,_0x4b8ecc){return client['request'](_0x458384,_0x716853)[_0x27b8('0x10')](function(_0x25d5a0){logger[_0x27b8('0x11')](_0x27b8('0x12'),_0x449f02,_0x27b8('0x13'));logger[_0x27b8('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x449f02,_0x27b8('0x13'),JSON[_0x27b8('0x15')](_0x25d5a0));if(_0x25d5a0['error']){if(_0x25d5a0[_0x27b8('0x16')][_0x27b8('0x17')]===0x1f4){logger[_0x27b8('0x16')](_0x27b8('0x12'),_0x449f02,_0x25d5a0[_0x27b8('0x16')][_0x27b8('0x18')]);return _0x4b8ecc(_0x25d5a0[_0x27b8('0x16')][_0x27b8('0x18')]);}logger[_0x27b8('0x16')]('CmList,\x20%s,\x20%s',_0x449f02,_0x25d5a0['error'][_0x27b8('0x18')]);return _0x27bca7(_0x25d5a0['error'][_0x27b8('0x18')]);}else{logger['info'](_0x27b8('0x12'),_0x449f02,_0x27b8('0x13'));_0x27bca7(_0x25d5a0[_0x27b8('0x19')][_0x27b8('0x18')]);}})[_0x27b8('0x1a')](function(_0x48f95a){logger['error'](_0x27b8('0x12'),_0x449f02,_0x48f95a);_0x4b8ecc(_0x48f95a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2ebde8e..afb18f2 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 _0xfac1=['cmList:','save','update','emit','register','length'];(function(_0x8c2e98,_0xacc0f1){var _0x3a546b=function(_0x1e64da){while(--_0x1e64da){_0x8c2e98['push'](_0x8c2e98['shift']());}};_0x3a546b(++_0xacc0f1);}(_0xfac1,0x16f));var _0x1fac=function(_0x29d60a,_0x2b4229){_0x29d60a=_0x29d60a-0x0;var _0x4efc39=_0xfac1[_0x29d60a];return _0x4efc39;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x1fac('0x0'),'remove',_0x1fac('0x1')];function createListener(_0x516fc2,_0x39c68c){return function(_0x3d4396){_0x39c68c[_0x1fac('0x2')](_0x516fc2,_0x3d4396);};}function removeListener(_0x23c264,_0x14605e){return function(){CmListEvents['removeListener'](_0x23c264,_0x14605e);};}exports[_0x1fac('0x3')]=function(_0x10e3de){for(var _0x2b769e=0x0,_0x5bdbfb=events[_0x1fac('0x4')];_0x2b769e<_0x5bdbfb;_0x2b769e++){var _0x3f5e7f=events[_0x2b769e];var _0x3ac379=createListener(_0x1fac('0x5')+_0x3f5e7f,_0x10e3de);CmListEvents['on'](_0x3f5e7f,_0x3ac379);}}; \ No newline at end of file +var _0xe02d=['register','length','./cmList.events','save','remove','update','emit','removeListener'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe02d,0x9a));var _0xde02=function(_0x3a2a6,_0x3b8d74){_0x3a2a6=_0x3a2a6-0x0;var _0x51db8c=_0xe02d[_0x3a2a6];return _0x51db8c;};'use strict';var CmListEvents=require(_0xde02('0x0'));var events=[_0xde02('0x1'),_0xde02('0x2'),_0xde02('0x3')];function createListener(_0x137eec,_0x195af6){return function(_0x3ddba){_0x195af6[_0xde02('0x4')](_0x137eec,_0x3ddba);};}function removeListener(_0x4024bc,_0x3ddb82){return function(){CmListEvents[_0xde02('0x5')](_0x4024bc,_0x3ddb82);};}exports[_0xde02('0x6')]=function(_0xb9bc59){for(var _0x549956=0x0,_0x581ef3=events[_0xde02('0x7')];_0x549956<_0x581ef3;_0x549956++){var _0x309c8f=events[_0x549956];var _0x2efce9=createListener('cmList:'+_0x309c8f,_0xb9bc59);CmListEvents['on'](_0x309c8f,_0x2efce9);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index da9ccf1..ee804c8 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 _0x552d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','addDisposition','update','/:id','destroy','delete','removeDispositions','exports','multer','connect-timeout'];(function(_0x5b6cd3,_0x2fcf1b){var _0x34f3a6=function(_0x59f523){while(--_0x59f523){_0x5b6cd3['push'](_0x5b6cd3['shift']());}};_0x34f3a6(++_0x2fcf1b);}(_0x552d,0xbe));var _0xd552=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x552d[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xd552('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd552('0x1'));var express=require(_0xd552('0x2'));var router=express[_0xd552('0x3')]();var fs_extra=require(_0xd552('0x4'));var auth=require(_0xd552('0x5'));var interaction=require(_0xd552('0x6'));var config=require(_0xd552('0x7'));var controller=require(_0xd552('0x8'));router[_0xd552('0x9')]('/',auth['isAuthenticated'](),controller[_0xd552('0xa')]);router[_0xd552('0x9')](_0xd552('0xb'),auth[_0xd552('0xc')](),controller[_0xd552('0xd')]);router[_0xd552('0x9')]('/global_fields',auth[_0xd552('0xc')](),controller[_0xd552('0xe')]);router[_0xd552('0x9')]('/:id',auth[_0xd552('0xc')](),controller[_0xd552('0xf')]);router['get'](_0xd552('0x10'),auth[_0xd552('0xc')](),controller[_0xd552('0x11')]);router['get'](_0xd552('0x12'),auth[_0xd552('0xc')](),controller[_0xd552('0x13')]);router['get'](_0xd552('0x14'),auth[_0xd552('0xc')](),controller['getContactsCsv']);router['get'](_0xd552('0x15'),auth[_0xd552('0xc')](),controller[_0xd552('0x16')]);router['get'](_0xd552('0x17'),auth[_0xd552('0xc')](),controller['getAgents']);router[_0xd552('0x18')]('/',auth[_0xd552('0xc')](),controller['create']);router[_0xd552('0x18')](_0xd552('0x10'),auth[_0xd552('0xc')](),controller[_0xd552('0x19')]);router[_0xd552('0x18')](_0xd552('0x12'),auth[_0xd552('0xc')](),controller['addContacts']);router['post']('/:id/fields',auth[_0xd552('0xc')](),controller['addCustomField']);router[_0xd552('0x18')](_0xd552('0x17'),auth[_0xd552('0xc')](),controller['addAgents']);router['put']('/:id',auth[_0xd552('0xc')](),controller[_0xd552('0x1a')]);router['delete'](_0xd552('0x1b'),auth[_0xd552('0xc')](),controller[_0xd552('0x1c')]);router[_0xd552('0x1d')]('/:id/dispositions',auth[_0xd552('0xc')](),controller[_0xd552('0x1e')]);router['delete'](_0xd552('0x17'),auth[_0xd552('0xc')](),controller['removeAgents']);module[_0xd552('0x1f')]=router; \ No newline at end of file +var _0xd70d=['addDisposition','/:id/fields','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/users','post','create'];(function(_0x22110e,_0x529a70){var _0x498b7b=function(_0x5e7ef0){while(--_0x5e7ef0){_0x22110e['push'](_0x22110e['shift']());}};_0x498b7b(++_0x529a70);}(_0xd70d,0x196));var _0xdd70=function(_0x1a508a,_0x51f735){_0x1a508a=_0x1a508a-0x0;var _0x2f5b3c=_0xd70d[_0x1a508a];return _0x2f5b3c;};'use strict';var multer=require('multer');var util=require(_0xdd70('0x0'));var path=require(_0xdd70('0x1'));var timeout=require(_0xdd70('0x2'));var express=require(_0xdd70('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd70('0x4'));var interaction=require(_0xdd70('0x5'));var config=require('../../config/environment');var controller=require(_0xdd70('0x6'));router[_0xdd70('0x7')]('/',auth[_0xdd70('0x8')](),controller[_0xdd70('0x9')]);router['get'](_0xdd70('0xa'),auth[_0xdd70('0x8')](),controller['describe']);router[_0xdd70('0x7')](_0xdd70('0xb'),auth[_0xdd70('0x8')](),controller[_0xdd70('0xc')]);router[_0xdd70('0x7')](_0xdd70('0xd'),auth[_0xdd70('0x8')](),controller[_0xdd70('0xe')]);router['get'](_0xdd70('0xf'),auth[_0xdd70('0x8')](),controller[_0xdd70('0x10')]);router[_0xdd70('0x7')](_0xdd70('0x11'),auth[_0xdd70('0x8')](),controller['getContacts']);router['get'](_0xdd70('0x12'),auth['isAuthenticated'](),controller[_0xdd70('0x13')]);router[_0xdd70('0x7')]('/:id/fields',auth[_0xdd70('0x8')](),controller['getCustomFields']);router[_0xdd70('0x7')](_0xdd70('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xdd70('0x15')]('/',auth[_0xdd70('0x8')](),controller[_0xdd70('0x16')]);router[_0xdd70('0x15')](_0xdd70('0xf'),auth[_0xdd70('0x8')](),controller[_0xdd70('0x17')]);router[_0xdd70('0x15')](_0xdd70('0x11'),auth[_0xdd70('0x8')](),controller['addContacts']);router[_0xdd70('0x15')](_0xdd70('0x18'),auth['isAuthenticated'](),controller[_0xdd70('0x19')]);router[_0xdd70('0x15')](_0xdd70('0x14'),auth['isAuthenticated'](),controller[_0xdd70('0x1a')]);router[_0xdd70('0x1b')]('/:id',auth[_0xdd70('0x8')](),controller[_0xdd70('0x1c')]);router[_0xdd70('0x1d')](_0xdd70('0xd'),auth[_0xdd70('0x8')](),controller[_0xdd70('0x1e')]);router[_0xdd70('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xdd70('0x1f')]);router[_0xdd70('0x1d')](_0xdd70('0x14'),auth[_0xdd70('0x8')](),controller[_0xdd70('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5246e83..2b4fd67 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 _0xfa42=['VIRTUAL','getDataValue','field','STRING','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xfa42,0x16c));var _0x2fa4=function(_0x3ced8,_0x2d618c){_0x3ced8=_0x3ced8-0x0;var _0x2d7040=_0xfa42[_0x3ced8];return _0x2d7040;};'use strict';var Sequelize=require('sequelize');module[_0x2fa4('0x0')]={'name':{'type':Sequelize[_0x2fa4('0x1')],'get':function(_0x2bc65b){return this[_0x2fa4('0x2')](_0x2fa4('0x3'));}},'field':{'type':Sequelize[_0x2fa4('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x2fa4('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x2fa4('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x1699=['sequelize','getDataValue','field','STRING'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0x1699,0xac));var _0x9169=function(_0x3c192c,_0x5bd6f9){_0x3c192c=_0x3c192c-0x0;var _0x3d8f5b=_0x1699[_0x3c192c];return _0x3d8f5b;};'use strict';var Sequelize=require(_0x9169('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5f0f26){return this[_0x9169('0x1')](_0x9169('0x2'));}},'field':{'type':Sequelize[_0x9169('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x9169('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 8933457..15f9fdd 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2a715b,_0x25a4af){var _0x391a1b=function(_0x3f2fea){while(--_0x3f2fea){_0x2a715b['push'](_0x2a715b['shift']());}};_0x391a1b(++_0x25a4af);}(_0x7a54,0x106));var _0x47a5=function(_0x56cede,_0x51a85e){_0x56cede=_0x56cede-0x0;var _0x58928f=_0x7a54[_0x56cede];return _0x58928f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4c956c,_0x57f5fc){var _0x180108=function(_0x2558cc){while(--_0x2558cc){_0x4c956c['push'](_0x4c956c['shift']());}};_0x180108(++_0x57f5fc);}(_0x7a54,0x106));var _0x47a5=function(_0x54599d,_0x1d8270){_0x54599d=_0x54599d-0x0;var _0x126a9e=_0x7a54[_0x54599d];return _0x126a9e;};'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 7606ad2..6bbe485 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 _0x4df3=['bluebird','path','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0x4d597a,_0x3ff131){var _0x1c8f05=function(_0x482f9f){while(--_0x482f9f){_0x4d597a['push'](_0x4d597a['shift']());}};_0x1c8f05(++_0x3ff131);}(_0x4df3,0xf7));var _0x34df=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x4df3[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x34df('0x0'));var util=require(_0x34df('0x1'));var logger=require(_0x34df('0x2'))(_0x34df('0x3'));var moment=require(_0x34df('0x4'));var BPromise=require(_0x34df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34df('0x6'));var rimraf=require('rimraf');var config=require(_0x34df('0x7'));var attributes=require(_0x34df('0x8'));module[_0x34df('0x9')]=function(_0x44b531,_0x4cc4b2){return _0x44b531['define'](_0x34df('0xa'),attributes,{'tableName':_0x34df('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x717c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','util','../../config/logger','api'];(function(_0x3740a7,_0x598171){var _0x3f9b84=function(_0x10fca5){while(--_0x10fca5){_0x3740a7['push'](_0x3740a7['shift']());}};_0x3f9b84(++_0x598171);}(_0x717c,0x1ab));var _0xc717=function(_0x41c9a5,_0x2c3676){_0x41c9a5=_0x41c9a5-0x0;var _0x578d82=_0x717c[_0x41c9a5];return _0x578d82;};'use strict';var _=require('lodash');var util=require(_0xc717('0x0'));var logger=require(_0xc717('0x1'))(_0xc717('0x2'));var moment=require(_0xc717('0x3'));var BPromise=require(_0xc717('0x4'));var rp=require(_0xc717('0x5'));var fs=require('fs');var path=require(_0xc717('0x6'));var rimraf=require(_0xc717('0x7'));var config=require(_0xc717('0x8'));var attributes=require('./condition.attributes');module[_0xc717('0x9')]=function(_0x3af871,_0x127b33){return _0x3af871['define']('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 5793177..2797c24 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 _0xc8da=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x1f8ee9,_0x521f85){var _0x24c8a9=function(_0x351d5a){while(--_0x351d5a){_0x1f8ee9['push'](_0x1f8ee9['shift']());}};_0x24c8a9(++_0x521f85);}(_0xc8da,0xa5));var _0xac8d=function(_0x410613,_0x24b56c){_0x410613=_0x410613-0x0;var _0x52472b=_0xc8da[_0x410613];return _0x52472b;};'use strict';var _=require(_0xac8d('0x0'));var util=require(_0xac8d('0x1'));var moment=require(_0xac8d('0x2'));var BPromise=require(_0xac8d('0x3'));var rs=require(_0xac8d('0x4'));var fs=require('fs');var Redis=require(_0xac8d('0x5'));var db=require(_0xac8d('0x6'))['db'];var utils=require(_0xac8d('0x7'));var logger=require(_0xac8d('0x8'))(_0xac8d('0x9'));var config=require(_0xac8d('0xa'));var jayson=require(_0xac8d('0xb'));var client=jayson[_0xac8d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b7d9b,_0x7d7dc7,_0x4603b8){return new BPromise(function(_0x41998d,_0x5240d3){return client[_0xac8d('0xd')](_0x2b7d9b,_0x4603b8)['then'](function(_0x16e93c){logger[_0xac8d('0xe')](_0xac8d('0xf'),_0x7d7dc7,_0xac8d('0x10'));logger['debug'](_0xac8d('0x11'),_0x7d7dc7,'request\x20sent',JSON['stringify'](_0x16e93c));if(_0x16e93c[_0xac8d('0x12')]){if(_0x16e93c[_0xac8d('0x12')][_0xac8d('0x13')]===0x1f4){logger['error'](_0xac8d('0xf'),_0x7d7dc7,_0x16e93c[_0xac8d('0x12')][_0xac8d('0x14')]);return _0x5240d3(_0x16e93c[_0xac8d('0x12')][_0xac8d('0x14')]);}logger[_0xac8d('0x12')](_0xac8d('0xf'),_0x7d7dc7,_0x16e93c[_0xac8d('0x12')][_0xac8d('0x14')]);return _0x41998d(_0x16e93c[_0xac8d('0x12')][_0xac8d('0x14')]);}else{logger[_0xac8d('0xe')]('Condition,\x20%s,\x20%s',_0x7d7dc7,_0xac8d('0x10'));_0x41998d(_0x16e93c[_0xac8d('0x15')][_0xac8d('0x14')]);}})[_0xac8d('0x16')](function(_0x1e99bc){logger['error'](_0xac8d('0xf'),_0x7d7dc7,_0x1e99bc);_0x5240d3(_0x1e99bc);});});} \ No newline at end of file +var _0x0f7f=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','info','lodash','util','moment'];(function(_0x537225,_0x2d63c1){var _0x2f9f54=function(_0x536906){while(--_0x536906){_0x537225['push'](_0x537225['shift']());}};_0x2f9f54(++_0x2d63c1);}(_0x0f7f,0x166));var _0xf0f7=function(_0x1845c0,_0x55359b){_0x1845c0=_0x1845c0-0x0;var _0x548386=_0x0f7f[_0x1845c0];return _0x548386;};'use strict';var _=require(_0xf0f7('0x0'));var util=require(_0xf0f7('0x1'));var moment=require(_0xf0f7('0x2'));var BPromise=require(_0xf0f7('0x3'));var rs=require(_0xf0f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0f7('0x6'))(_0xf0f7('0x7'));var config=require(_0xf0f7('0x8'));var jayson=require(_0xf0f7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1467b5,_0x170b0b,_0x1afe83){return new BPromise(function(_0x1ddc93,_0x154b36){return client['request'](_0x1467b5,_0x1afe83)['then'](function(_0x417d7b){logger['info']('Condition,\x20%s,\x20%s',_0x170b0b,_0xf0f7('0xa'));logger[_0xf0f7('0xb')](_0xf0f7('0xc'),_0x170b0b,_0xf0f7('0xa'),JSON[_0xf0f7('0xd')](_0x417d7b));if(_0x417d7b['error']){if(_0x417d7b[_0xf0f7('0xe')][_0xf0f7('0xf')]===0x1f4){logger['error'](_0xf0f7('0x10'),_0x170b0b,_0x417d7b[_0xf0f7('0xe')][_0xf0f7('0x11')]);return _0x154b36(_0x417d7b[_0xf0f7('0xe')][_0xf0f7('0x11')]);}logger['error'](_0xf0f7('0x10'),_0x170b0b,_0x417d7b[_0xf0f7('0xe')][_0xf0f7('0x11')]);return _0x1ddc93(_0x417d7b[_0xf0f7('0xe')][_0xf0f7('0x11')]);}else{logger[_0xf0f7('0x12')](_0xf0f7('0x10'),_0x170b0b,_0xf0f7('0xa'));_0x1ddc93(_0x417d7b['result'][_0xf0f7('0x11')]);}})['catch'](function(_0x384d98){logger[_0xf0f7('0xe')](_0xf0f7('0x10'),_0x170b0b,_0x384d98);_0x154b36(_0x384d98);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index f9fde76..054bd70 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 _0x44eb=['../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4a9590,_0x833e09){var _0x4eb65a=function(_0x148dc7){while(--_0x148dc7){_0x4a9590['push'](_0x4a9590['shift']());}};_0x4eb65a(++_0x833e09);}(_0x44eb,0xd9));var _0xb44e=function(_0x280820,_0xce9bc7){_0x280820=_0x280820-0x0;var _0x474787=_0x44eb[_0x280820];return _0x474787;};'use strict';var multer=require(_0xb44e('0x0'));var util=require(_0xb44e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb44e('0x2'));var router=express[_0xb44e('0x3')]();var fs_extra=require(_0xb44e('0x4'));var auth=require(_0xb44e('0x5'));var interaction=require(_0xb44e('0x6'));var config=require(_0xb44e('0x7'));var controller=require(_0xb44e('0x8'));router[_0xb44e('0x9')](_0xb44e('0xa'),auth['isAuthenticated'](),controller[_0xb44e('0xb')]);router[_0xb44e('0xc')](_0xb44e('0xa'),auth[_0xb44e('0xd')](),controller[_0xb44e('0xe')]);module[_0xb44e('0xf')]=router; \ No newline at end of file +var _0x68b0=['delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','update'];(function(_0x30b58,_0x48df3b){var _0x9d210d=function(_0x46fffd){while(--_0x46fffd){_0x30b58['push'](_0x30b58['shift']());}};_0x9d210d(++_0x48df3b);}(_0x68b0,0xb9));var _0x068b=function(_0x2fcd7b,_0x27778d){_0x2fcd7b=_0x2fcd7b-0x0;var _0x1cdfa8=_0x68b0[_0x2fcd7b];return _0x1cdfa8;};'use strict';var multer=require(_0x068b('0x0'));var util=require('util');var path=require(_0x068b('0x1'));var timeout=require(_0x068b('0x2'));var express=require('express');var router=express[_0x068b('0x3')]();var fs_extra=require(_0x068b('0x4'));var auth=require(_0x068b('0x5'));var interaction=require(_0x068b('0x6'));var config=require(_0x068b('0x7'));var controller=require('./condition.controller');router['put']('/:id',auth[_0x068b('0x8')](),controller[_0x068b('0x9')]);router[_0x068b('0xa')]('/:id',auth[_0x068b('0x8')](),controller[_0x068b('0xb')]);module[_0x068b('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index d4daebf..1f6245a 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 _0xc5a8=['sequelize','exports','name','STRING'];(function(_0x406fcd,_0x7fe61b){var _0x5b3ea5=function(_0x42c04){while(--_0x42c04){_0x406fcd['push'](_0x406fcd['shift']());}};_0x5b3ea5(++_0x7fe61b);}(_0xc5a8,0x144));var _0x8c5a=function(_0x522daa,_0x4e22c0){_0x522daa=_0x522daa-0x0;var _0xd1a403=_0xc5a8[_0x522daa];return _0xd1a403;};'use strict';var Sequelize=require(_0x8c5a('0x0'));module[_0x8c5a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8c5a('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8c5a('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x2499=['sequelize','exports','STRING','INTEGER'];(function(_0x3da72a,_0x26c4e0){var _0x5ab5f9=function(_0x1167b3){while(--_0x1167b3){_0x3da72a['push'](_0x3da72a['shift']());}};_0x5ab5f9(++_0x26c4e0);}(_0x2499,0x108));var _0x9249=function(_0x5d4431,_0x12d3a0){_0x5d4431=_0x5d4431-0x0;var _0x32ddaf=_0x2499[_0x5d4431];return _0x32ddaf;};'use strict';var Sequelize=require(_0x9249('0x0'));module[_0x9249('0x1')]={'name':{'type':Sequelize[_0x9249('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x9249('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9249('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index c688818..07e6aed 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 _0xcf2f=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ContactItemType','includeAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x4c3ef3,_0x487714){var _0x3d17cc=function(_0x9935c9){while(--_0x9935c9){_0x4c3ef3['push'](_0x4c3ef3['shift']());}};_0x3d17cc(++_0x487714);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x121c79,_0x21f5dd){_0x121c79=_0x121c79-0x0;var _0x5b093b=_0xcf2f[_0x121c79];return _0x5b093b;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];function respondWithStatusCode(_0x1ba610,_0x175ac9){_0x175ac9=_0x175ac9||0xcc;return function(_0x1be8cc){if(_0x1be8cc){return _0x1ba610['sendStatus'](_0x175ac9);}return _0x1ba610[_0xfcf2('0x19')](_0x175ac9)['end']();};}function respondWithResult(_0x5b414a,_0x5dc04b){_0x5dc04b=_0x5dc04b||0xc8;return function(_0xc87ff4){if(_0xc87ff4){return _0x5b414a['status'](_0x5dc04b)[_0xfcf2('0x1a')](_0xc87ff4);}};}function respondWithFilteredResult(_0x1febf8,_0x245f9a){return function(_0x21f7d1){if(_0x21f7d1){var _0x315b2f=typeof _0x245f9a[_0xfcf2('0x1b')]===_0xfcf2('0x1c')&&typeof _0x245f9a['limit']===_0xfcf2('0x1c');var _0x213125=_0x21f7d1[_0xfcf2('0x1d')];var _0x581d78=_0x315b2f?0x0:_0x245f9a[_0xfcf2('0x1b')];var _0x1b3c89=_0x315b2f?_0x21f7d1[_0xfcf2('0x1d')]:_0x245f9a[_0xfcf2('0x1b')]+_0x245f9a[_0xfcf2('0x1e')];var _0x53c406;if(_0x1b3c89>=_0x213125){_0x1b3c89=_0x213125;_0x53c406=0xc8;}else{_0x53c406=0xce;}_0x1febf8[_0xfcf2('0x19')](_0x53c406);return _0x1febf8[_0xfcf2('0x1f')]('Content-Range',_0x581d78+'-'+_0x1b3c89+'/'+_0x213125)[_0xfcf2('0x1a')](_0x21f7d1);}return null;};}function patchUpdates(_0x23c079){return function(_0x206738){try{jsonpatch[_0xfcf2('0x20')](_0x206738,_0x23c079,!![]);}catch(_0x51e0b7){return BPromise[_0xfcf2('0x21')](_0x51e0b7);}return _0x206738[_0xfcf2('0x22')]();};}function saveUpdates(_0x422c5a,_0x1eeebd){return function(_0x5afab5){if(_0x5afab5){return _0x5afab5[_0xfcf2('0x23')](_0x422c5a)[_0xfcf2('0x24')](function(_0x232f6f){return _0x232f6f;});}return null;};}function removeEntity(_0x584e76,_0x26641a){return function(_0x151aa8){if(_0x151aa8){return _0x151aa8['destroy']()[_0xfcf2('0x24')](function(){var _0xbc8722=_0x151aa8['get']({'plain':!![]});var _0x1e6f14=_0xfcf2('0x25');return db[_0xfcf2('0x26')][_0xfcf2('0x27')]({'where':{'type':_0x1e6f14,'resourceId':_0xbc8722['id']}})['then'](function(){return _0x151aa8;});})[_0xfcf2('0x24')](function(){_0x584e76[_0xfcf2('0x19')](0xcc)[_0xfcf2('0x28')]();});}};}function handleEntityNotFound(_0x3779ee,_0x17c994){return function(_0x2b1d60){if(!_0x2b1d60){_0x3779ee[_0xfcf2('0x29')](0x194);}return _0x2b1d60;};}function handleError(_0x1c8f38,_0x23c09c){_0x23c09c=_0x23c09c||0x1f4;return function(_0x56f839){logger['error'](_0x56f839[_0xfcf2('0x2a')]);if(_0x56f839[_0xfcf2('0x2b')]){delete _0x56f839[_0xfcf2('0x2b')];}_0x1c8f38['status'](_0x23c09c)[_0xfcf2('0x2c')](_0x56f839);};}exports['index']=function(_0x3ce9f8,_0x26651e){var _0x40c1ae={},_0x1a4485={},_0x313884={'count':0x0,'rows':[]};var _0x3760ad=_[_0xfcf2('0x2d')](db['ContactItemType']['rawAttributes'],function(_0xfc3b86){return{'name':_0xfc3b86[_0xfcf2('0x2e')],'type':_0xfc3b86[_0xfcf2('0x2f')][_0xfcf2('0x30')]};});_0x1a4485['model']=_['map'](_0x3760ad,_0xfcf2('0x2b'));_0x1a4485['query']=_[_0xfcf2('0x31')](_0x3ce9f8[_0xfcf2('0x32')]);_0x1a4485['filters']=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],_0x1a4485[_0xfcf2('0x32')]);_0x40c1ae[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x3ce9f8['query'][_0xfcf2('0x36')]));_0x40c1ae[_0xfcf2('0x35')]=_0x40c1ae['attributes'][_0xfcf2('0x37')]?_0x40c1ae[_0xfcf2('0x35')]:_0x1a4485['model'];if(!_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x38')]('nolimit')){_0x40c1ae[_0xfcf2('0x1e')]=qs[_0xfcf2('0x1e')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1e')]);_0x40c1ae['offset']=qs[_0xfcf2('0x1b')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1b')]);}_0x40c1ae[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x3ce9f8['query'][_0xfcf2('0x3a')]);_0x40c1ae[_0xfcf2('0x3b')]=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x3ce9f8[_0xfcf2('0x32')],_0x1a4485['filters']),_0x3760ad);if(_0x3ce9f8[_0xfcf2('0x32')]['filter']){_0x40c1ae[_0xfcf2('0x3b')]=_[_0xfcf2('0x3e')](_0x40c1ae[_0xfcf2('0x3b')],{'$or':_[_0xfcf2('0x2d')](_0x3760ad,function(_0x2fd2ef){if(_0x2fd2ef['type']!==_0xfcf2('0x3f')){var _0x341505={};_0x341505[_0x2fd2ef[_0xfcf2('0x2b')]]={'$like':'%'+_0x3ce9f8['query'][_0xfcf2('0x40')]+'%'};return _0x341505;}})});}_0x40c1ae=_[_0xfcf2('0x3e')]({},_0x40c1ae,_0x3ce9f8[_0xfcf2('0x41')]);var _0x320c19={'where':_0x40c1ae[_0xfcf2('0x3b')]};return db[_0xfcf2('0x42')]['count'](_0x320c19)['then'](function(_0x526c42){_0x313884[_0xfcf2('0x1d')]=_0x526c42;if(_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x43')]){_0x40c1ae['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x40c1ae);})[_0xfcf2('0x24')](function(_0xab0747){_0x313884[_0xfcf2('0x44')]=_0xab0747;return _0x313884;})[_0xfcf2('0x24')](respondWithFilteredResult(_0x26651e,_0x40c1ae))[_0xfcf2('0x45')](handleError(_0x26651e,null));};exports[_0xfcf2('0x46')]=function(_0x2c8ba2,_0x16cc21){var _0x2b790b={'raw':!![],'where':{'id':_0x2c8ba2[_0xfcf2('0x47')]['id']}},_0x467ecd={};_0x467ecd['model']=_['keys'](db[_0xfcf2('0x42')][_0xfcf2('0x48')]);_0x467ecd[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x2c8ba2[_0xfcf2('0x32')]);_0x467ecd[_0xfcf2('0x3c')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],_0x467ecd[_0xfcf2('0x32')]);_0x2b790b[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x2c8ba2[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x2b790b[_0xfcf2('0x35')]=_0x2b790b[_0xfcf2('0x35')]['length']?_0x2b790b[_0xfcf2('0x35')]:_0x467ecd[_0xfcf2('0x34')];if(_0x2c8ba2['query'][_0xfcf2('0x43')]){_0x2b790b['include']=[{'all':!![]}];}_0x2b790b=_[_0xfcf2('0x3e')]({},_0x2b790b,_0x2c8ba2[_0xfcf2('0x41')]);return db[_0xfcf2('0x42')][_0xfcf2('0x49')](_0x2b790b)['then'](handleEntityNotFound(_0x16cc21,null))['then'](respondWithResult(_0x16cc21,null))['catch'](handleError(_0x16cc21,null));};exports[_0xfcf2('0x4a')]=function(_0x37d4bb,_0x20fcab){return db[_0xfcf2('0x42')]['create'](_0x37d4bb[_0xfcf2('0x4b')],{})[_0xfcf2('0x24')](function(_0x3b981c){var _0x548c6c=_0x37d4bb[_0xfcf2('0x4c')][_0xfcf2('0x4d')]({'plain':!![]});if(!_0x548c6c)throw new Error(_0xfcf2('0x4e'));if(_0x548c6c[_0xfcf2('0x4f')]===_0xfcf2('0x4c')){var _0x4af270=_0x3b981c[_0xfcf2('0x4d')]({'plain':!![]});var _0x1260a4=_0xfcf2('0x25');return db[_0xfcf2('0x50')][_0xfcf2('0x49')]({'where':{'name':_0x1260a4,'userProfileId':_0x548c6c[_0xfcf2('0x51')]},'raw':!![]})['then'](function(_0x5d162d){if(_0x5d162d&&_0x5d162d['autoAssociation']===0x0){return db[_0xfcf2('0x26')][_0xfcf2('0x4a')]({'name':_0x4af270['name'],'resourceId':_0x4af270['id'],'type':_0x5d162d['name'],'sectionId':_0x5d162d['id']},{})[_0xfcf2('0x24')](function(){return _0x3b981c;});}else{return _0x3b981c;}})[_0xfcf2('0x45')](function(_0x137a47){logger['error'](_0xfcf2('0x52'),_0x137a47);throw _0x137a47;});}return _0x3b981c;})[_0xfcf2('0x24')](respondWithResult(_0x20fcab,0xc9))['catch'](handleError(_0x20fcab,null));};exports['update']=function(_0xfc4b7b,_0x51f636){if(_0xfc4b7b[_0xfcf2('0x4b')]['id']){delete _0xfc4b7b[_0xfcf2('0x4b')]['id'];}return db['ContactItemType'][_0xfcf2('0x49')]({'where':{'id':_0xfc4b7b['params']['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x51f636,null))['then'](saveUpdates(_0xfc4b7b[_0xfcf2('0x4b')],null))[_0xfcf2('0x24')](respondWithResult(_0x51f636,null))[_0xfcf2('0x45')](handleError(_0x51f636,null));};exports['destroy']=function(_0x235b06,_0x27bae5){return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x235b06[_0xfcf2('0x47')]['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x27bae5,null))[_0xfcf2('0x24')](db['CmContactHasItem'][_0xfcf2('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x235b06[_0xfcf2('0x47')]['id']}}))['then'](removeEntity(_0x27bae5,null))[_0xfcf2('0x45')](handleError(_0x27bae5,null));}; \ No newline at end of file +var _0x3d04=['nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','ContactItemTypes','end','error','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x3d3219,_0x208480){var _0x1c0241=function(_0x4809b2){while(--_0x4809b2){_0x3d3219['push'](_0x3d3219['shift']());}};_0x1c0241(++_0x208480);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];function respondWithStatusCode(_0x23daaa,_0x546b23){_0x546b23=_0x546b23||0xcc;return function(_0x29773b){if(_0x29773b){return _0x23daaa[_0x43d0('0x16')](_0x546b23);}return _0x23daaa[_0x43d0('0x17')](_0x546b23)['end']();};}function respondWithResult(_0xd262a8,_0x2454fa){_0x2454fa=_0x2454fa||0xc8;return function(_0x436130){if(_0x436130){return _0xd262a8['status'](_0x2454fa)[_0x43d0('0x18')](_0x436130);}};}function respondWithFilteredResult(_0x357f87,_0x44e6ec){return function(_0x1218b5){if(_0x1218b5){var _0x91b4a1=typeof _0x44e6ec['offset']==='undefined'&&typeof _0x44e6ec[_0x43d0('0x19')]===_0x43d0('0x1a');var _0x35decf=_0x1218b5['count'];var _0x2c641e=_0x91b4a1?0x0:_0x44e6ec['offset'];var _0x2c9d06=_0x91b4a1?_0x1218b5[_0x43d0('0x1b')]:_0x44e6ec[_0x43d0('0x1c')]+_0x44e6ec['limit'];var _0x3d7dcc;if(_0x2c9d06>=_0x35decf){_0x2c9d06=_0x35decf;_0x3d7dcc=0xc8;}else{_0x3d7dcc=0xce;}_0x357f87[_0x43d0('0x17')](_0x3d7dcc);return _0x357f87['set'](_0x43d0('0x1d'),_0x2c641e+'-'+_0x2c9d06+'/'+_0x35decf)[_0x43d0('0x18')](_0x1218b5);}return null;};}function patchUpdates(_0x348429){return function(_0x248622){try{jsonpatch[_0x43d0('0x1e')](_0x248622,_0x348429,!![]);}catch(_0x28381b){return BPromise[_0x43d0('0x1f')](_0x28381b);}return _0x248622[_0x43d0('0x20')]();};}function saveUpdates(_0x30febc,_0xc8a644){return function(_0xec5f07){if(_0xec5f07){return _0xec5f07[_0x43d0('0x21')](_0x30febc)[_0x43d0('0x22')](function(_0xbc72e6){return _0xbc72e6;});}return null;};}function removeEntity(_0x2efd77,_0x48aa18){return function(_0x2c7b24){if(_0x2c7b24){return _0x2c7b24[_0x43d0('0x23')]()['then'](function(){var _0x1fe708=_0x2c7b24['get']({'plain':!![]});var _0x29c111=_0x43d0('0x24');return db['UserProfileResource'][_0x43d0('0x23')]({'where':{'type':_0x29c111,'resourceId':_0x1fe708['id']}})[_0x43d0('0x22')](function(){return _0x2c7b24;});})['then'](function(){_0x2efd77[_0x43d0('0x17')](0xcc)[_0x43d0('0x25')]();});}};}function handleEntityNotFound(_0x22ae3c,_0x5f16ac){return function(_0x447725){if(!_0x447725){_0x22ae3c[_0x43d0('0x16')](0x194);}return _0x447725;};}function handleError(_0x2c4f3f,_0x1eb771){_0x1eb771=_0x1eb771||0x1f4;return function(_0x37d78f){logger[_0x43d0('0x26')](_0x37d78f[_0x43d0('0x27')]);if(_0x37d78f['name']){delete _0x37d78f[_0x43d0('0x28')];}_0x2c4f3f[_0x43d0('0x17')](_0x1eb771)[_0x43d0('0x29')](_0x37d78f);};}exports['index']=function(_0x4bfce9,_0x52c37b){var _0x3c1ea3={},_0x2db9dc={},_0x10086b={'count':0x0,'rows':[]};var _0x13e3c9=_[_0x43d0('0x2a')](db[_0x43d0('0x2b')]['rawAttributes'],function(_0x77654d){return{'name':_0x77654d[_0x43d0('0x2c')],'type':_0x77654d[_0x43d0('0x2d')][_0x43d0('0x2e')]};});_0x2db9dc[_0x43d0('0x2f')]=_[_0x43d0('0x2a')](_0x13e3c9,_0x43d0('0x28'));_0x2db9dc[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x4bfce9[_0x43d0('0x30')]);_0x2db9dc[_0x43d0('0x32')]=_['intersection'](_0x2db9dc[_0x43d0('0x2f')],_0x2db9dc[_0x43d0('0x30')]);_0x3c1ea3[_0x43d0('0x33')]=_[_0x43d0('0x34')](_0x2db9dc['model'],qs[_0x43d0('0x35')](_0x4bfce9['query'][_0x43d0('0x35')]));_0x3c1ea3[_0x43d0('0x33')]=_0x3c1ea3['attributes'][_0x43d0('0x36')]?_0x3c1ea3[_0x43d0('0x33')]:_0x2db9dc[_0x43d0('0x2f')];if(!_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x37')](_0x43d0('0x38'))){_0x3c1ea3[_0x43d0('0x19')]=qs[_0x43d0('0x19')](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x19')]);_0x3c1ea3[_0x43d0('0x1c')]=qs['offset'](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x1c')]);}_0x3c1ea3[_0x43d0('0x39')]=qs[_0x43d0('0x3a')](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x3a')]);_0x3c1ea3[_0x43d0('0x3b')]=qs[_0x43d0('0x32')](_[_0x43d0('0x3c')](_0x4bfce9[_0x43d0('0x30')],_0x2db9dc[_0x43d0('0x32')]),_0x13e3c9);if(_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x3d')]){_0x3c1ea3[_0x43d0('0x3b')]=_['merge'](_0x3c1ea3[_0x43d0('0x3b')],{'$or':_[_0x43d0('0x2a')](_0x13e3c9,function(_0x38f330){if(_0x38f330[_0x43d0('0x2d')]!==_0x43d0('0x3e')){var _0x1e6c8b={};_0x1e6c8b[_0x38f330[_0x43d0('0x28')]]={'$like':'%'+_0x4bfce9[_0x43d0('0x30')]['filter']+'%'};return _0x1e6c8b;}})});}_0x3c1ea3=_['merge']({},_0x3c1ea3,_0x4bfce9[_0x43d0('0x3f')]);var _0x5ad2d0={'where':_0x3c1ea3['where']};return db[_0x43d0('0x2b')]['count'](_0x5ad2d0)[_0x43d0('0x22')](function(_0x5027d0){_0x10086b[_0x43d0('0x1b')]=_0x5027d0;if(_0x4bfce9['query'][_0x43d0('0x40')]){_0x3c1ea3[_0x43d0('0x41')]=[{'all':!![]}];}return db[_0x43d0('0x2b')]['findAll'](_0x3c1ea3);})[_0x43d0('0x22')](function(_0x520406){_0x10086b[_0x43d0('0x42')]=_0x520406;return _0x10086b;})['then'](respondWithFilteredResult(_0x52c37b,_0x3c1ea3))['catch'](handleError(_0x52c37b,null));};exports[_0x43d0('0x43')]=function(_0xcb5a02,_0x4d539f){var _0x2f2ac9={'raw':!![],'where':{'id':_0xcb5a02[_0x43d0('0x44')]['id']}},_0x1c87bc={};_0x1c87bc[_0x43d0('0x2f')]=_[_0x43d0('0x31')](db['ContactItemType'][_0x43d0('0x45')]);_0x1c87bc[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0xcb5a02[_0x43d0('0x30')]);_0x1c87bc['filters']=_[_0x43d0('0x34')](_0x1c87bc[_0x43d0('0x2f')],_0x1c87bc[_0x43d0('0x30')]);_0x2f2ac9[_0x43d0('0x33')]=_[_0x43d0('0x34')](_0x1c87bc['model'],qs[_0x43d0('0x35')](_0xcb5a02[_0x43d0('0x30')]['fields']));_0x2f2ac9[_0x43d0('0x33')]=_0x2f2ac9[_0x43d0('0x33')][_0x43d0('0x36')]?_0x2f2ac9['attributes']:_0x1c87bc[_0x43d0('0x2f')];if(_0xcb5a02['query'][_0x43d0('0x40')]){_0x2f2ac9['include']=[{'all':!![]}];}_0x2f2ac9=_[_0x43d0('0x46')]({},_0x2f2ac9,_0xcb5a02[_0x43d0('0x3f')]);return db[_0x43d0('0x2b')][_0x43d0('0x47')](_0x2f2ac9)[_0x43d0('0x22')](handleEntityNotFound(_0x4d539f,null))['then'](respondWithResult(_0x4d539f,null))[_0x43d0('0x48')](handleError(_0x4d539f,null));};exports['create']=function(_0x5a6364,_0x3e7392){return db[_0x43d0('0x2b')][_0x43d0('0x49')](_0x5a6364[_0x43d0('0x4a')],{})[_0x43d0('0x22')](function(_0x3685cf){var _0x36c9d0=_0x5a6364[_0x43d0('0x4b')][_0x43d0('0x4c')]({'plain':!![]});if(!_0x36c9d0)throw new Error(_0x43d0('0x4d'));if(_0x36c9d0[_0x43d0('0x4e')]==='user'){var _0x338203=_0x3685cf[_0x43d0('0x4c')]({'plain':!![]});var _0x1503bc='ContactItemTypes';return db[_0x43d0('0x4f')]['find']({'where':{'name':_0x1503bc,'userProfileId':_0x36c9d0['userProfileId']},'raw':!![]})[_0x43d0('0x22')](function(_0x29a14a){if(_0x29a14a&&_0x29a14a[_0x43d0('0x50')]===0x0){return db[_0x43d0('0x51')][_0x43d0('0x49')]({'name':_0x338203['name'],'resourceId':_0x338203['id'],'type':_0x29a14a['name'],'sectionId':_0x29a14a['id']},{})[_0x43d0('0x22')](function(){return _0x3685cf;});}else{return _0x3685cf;}})['catch'](function(_0x32aab0){logger[_0x43d0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32aab0);throw _0x32aab0;});}return _0x3685cf;})['then'](respondWithResult(_0x3e7392,0xc9))['catch'](handleError(_0x3e7392,null));};exports[_0x43d0('0x21')]=function(_0x126863,_0x3d89d4){if(_0x126863[_0x43d0('0x4a')]['id']){delete _0x126863[_0x43d0('0x4a')]['id'];}return db[_0x43d0('0x2b')][_0x43d0('0x47')]({'where':{'id':_0x126863[_0x43d0('0x44')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x3d89d4,null))['then'](saveUpdates(_0x126863[_0x43d0('0x4a')],null))[_0x43d0('0x22')](respondWithResult(_0x3d89d4,null))[_0x43d0('0x48')](handleError(_0x3d89d4,null));};exports[_0x43d0('0x23')]=function(_0x44feea,_0x5e341f){return db[_0x43d0('0x2b')][_0x43d0('0x47')]({'where':{'id':_0x44feea[_0x43d0('0x44')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x5e341f,null))['then'](db['CmContactHasItem'][_0x43d0('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x44feea[_0x43d0('0x44')]['id']}}))[_0x43d0('0x22')](removeEntity(_0x5e341f,null))[_0x43d0('0x48')](handleError(_0x5e341f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 7d736e1..87173da 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 _0x1a94=['bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0x1a94,0x98));var _0x41a9=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x1a94[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x41a9('0x0'));var util=require('util');var logger=require(_0x41a9('0x1'))(_0x41a9('0x2'));var moment=require(_0x41a9('0x3'));var BPromise=require(_0x41a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41a9('0x5'));var rimraf=require(_0x41a9('0x6'));var config=require(_0x41a9('0x7'));var attributes=require(_0x41a9('0x8'));module[_0x41a9('0x9')]=function(_0x62fc1a,_0x5c464d){return _0x62fc1a[_0x41a9('0xa')](_0x41a9('0xb'),attributes,{'tableName':_0x41a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b72=['path','rimraf','../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4a53f3,_0x378c65){var _0x376337=function(_0x161b16){while(--_0x161b16){_0x4a53f3['push'](_0x4a53f3['shift']());}};_0x376337(++_0x378c65);}(_0x2b72,0x13f));var _0x22b7=function(_0x57b15a,_0x373232){_0x57b15a=_0x57b15a-0x0;var _0x122382=_0x2b72[_0x57b15a];return _0x122382;};'use strict';var _=require(_0x22b7('0x0'));var util=require(_0x22b7('0x1'));var logger=require('../../config/logger')(_0x22b7('0x2'));var moment=require(_0x22b7('0x3'));var BPromise=require(_0x22b7('0x4'));var rp=require(_0x22b7('0x5'));var fs=require('fs');var path=require(_0x22b7('0x6'));var rimraf=require(_0x22b7('0x7'));var config=require(_0x22b7('0x8'));var attributes=require(_0x22b7('0x9'));module['exports']=function(_0x1cd9af,_0x4aba75){return _0x1cd9af[_0x22b7('0xa')](_0x22b7('0xb'),attributes,{'tableName':_0x22b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 7dca782..1ee3da2 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 _0x0d31=['../../config/logger','rpc','../../config/environment','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0d31,0x178));var _0x10d3=function(_0x48f29a,_0x1f9f1a){_0x48f29a=_0x48f29a-0x0;var _0x467232=_0x0d31[_0x48f29a];return _0x467232;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x10d3('0x0'));var rs=require(_0x10d3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10d3('0x2'))['db'];var utils=require(_0x10d3('0x3'));var logger=require(_0x10d3('0x4'))(_0x10d3('0x5'));var config=require(_0x10d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x10d3('0x7')][_0x10d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d55a8,_0x4dc67a,_0x366709){return new BPromise(function(_0x2c581c,_0xc7a014){return client[_0x10d3('0x9')](_0x1d55a8,_0x366709)[_0x10d3('0xa')](function(_0x5a4903){logger['info'](_0x10d3('0xb'),_0x4dc67a,_0x10d3('0xc'));logger['debug'](_0x10d3('0xd'),_0x4dc67a,_0x10d3('0xc'),JSON['stringify'](_0x5a4903));if(_0x5a4903[_0x10d3('0xe')]){if(_0x5a4903[_0x10d3('0xe')]['code']===0x1f4){logger['error'](_0x10d3('0xb'),_0x4dc67a,_0x5a4903[_0x10d3('0xe')][_0x10d3('0xf')]);return _0xc7a014(_0x5a4903[_0x10d3('0xe')][_0x10d3('0xf')]);}logger[_0x10d3('0xe')](_0x10d3('0xb'),_0x4dc67a,_0x5a4903[_0x10d3('0xe')]['message']);return _0x2c581c(_0x5a4903[_0x10d3('0xe')][_0x10d3('0xf')]);}else{logger[_0x10d3('0x10')](_0x10d3('0xb'),_0x4dc67a,'request\x20sent');_0x2c581c(_0x5a4903[_0x10d3('0x11')]['message']);}})[_0x10d3('0x12')](function(_0x46ad88){logger['error']('ContactItemType,\x20%s,\x20%s',_0x4dc67a,_0x46ad88);_0xc7a014(_0x46ad88);});});} \ No newline at end of file +var _0x1b3e=['rpc','../../config/environment','http','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x1d2e34,_0x1d4ac7){var _0x38fccc=function(_0x4d9328){while(--_0x4d9328){_0x1d2e34['push'](_0x1d2e34['shift']());}};_0x38fccc(++_0x1d4ac7);}(_0x1b3e,0x128));var _0xe1b3=function(_0x40601e,_0x5ed382){_0x40601e=_0x40601e-0x0;var _0x1d99a8=_0x1b3e[_0x40601e];return _0x1d99a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe1b3('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1b3('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1b3('0x2'));var logger=require(_0xe1b3('0x3'))(_0xe1b3('0x4'));var config=require(_0xe1b3('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe1b3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2d2b89,_0x50f3f8,_0x4650f1){return new BPromise(function(_0xad77b6,_0xfb7132){return client[_0xe1b3('0x7')](_0x2d2b89,_0x4650f1)[_0xe1b3('0x8')](function(_0x41e7ee){logger[_0xe1b3('0x9')](_0xe1b3('0xa'),_0x50f3f8,'request\x20sent');logger[_0xe1b3('0xb')](_0xe1b3('0xc'),_0x50f3f8,_0xe1b3('0xd'),JSON[_0xe1b3('0xe')](_0x41e7ee));if(_0x41e7ee[_0xe1b3('0xf')]){if(_0x41e7ee[_0xe1b3('0xf')][_0xe1b3('0x10')]===0x1f4){logger[_0xe1b3('0xf')](_0xe1b3('0xa'),_0x50f3f8,_0x41e7ee[_0xe1b3('0xf')]['message']);return _0xfb7132(_0x41e7ee[_0xe1b3('0xf')][_0xe1b3('0x11')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x50f3f8,_0x41e7ee[_0xe1b3('0xf')][_0xe1b3('0x11')]);return _0xad77b6(_0x41e7ee[_0xe1b3('0xf')][_0xe1b3('0x11')]);}else{logger['info'](_0xe1b3('0xa'),_0x50f3f8,_0xe1b3('0xd'));_0xad77b6(_0x41e7ee[_0xe1b3('0x12')][_0xe1b3('0x11')]);}})[_0xe1b3('0x13')](function(_0x25a2a3){logger[_0xe1b3('0xf')](_0xe1b3('0xa'),_0x50f3f8,_0x25a2a3);_0xfb7132(_0x25a2a3);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 733cd2a..4426efa 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 _0xcb17=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0xcb17,0x1d3));var _0x7cb1=function(_0x448247,_0x18f3b0){_0x448247=_0x448247-0x0;var _0x1f2353=_0xcb17[_0x448247];return _0x1f2353;};'use strict';var multer=require(_0x7cb1('0x0'));var util=require(_0x7cb1('0x1'));var path=require(_0x7cb1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7cb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7cb1('0x4'));var interaction=require(_0x7cb1('0x5'));var config=require(_0x7cb1('0x6'));var controller=require(_0x7cb1('0x7'));router[_0x7cb1('0x8')]('/',auth[_0x7cb1('0x9')](),controller[_0x7cb1('0xa')]);router[_0x7cb1('0x8')](_0x7cb1('0xb'),auth[_0x7cb1('0x9')](),controller[_0x7cb1('0xc')]);router[_0x7cb1('0xd')]('/',auth[_0x7cb1('0x9')](),controller[_0x7cb1('0xe')]);router[_0x7cb1('0xf')](_0x7cb1('0xb'),auth[_0x7cb1('0x9')](),controller[_0x7cb1('0x10')]);router[_0x7cb1('0x11')](_0x7cb1('0xb'),auth[_0x7cb1('0x9')](),controller[_0x7cb1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xba43=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','show'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0xba43,0x1ab));var _0x3ba4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xba43[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3ba4('0x0'));var util=require(_0x3ba4('0x1'));var path=require(_0x3ba4('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ba4('0x3'));var router=express[_0x3ba4('0x4')]();var fs_extra=require(_0x3ba4('0x5'));var auth=require(_0x3ba4('0x6'));var interaction=require(_0x3ba4('0x7'));var config=require(_0x3ba4('0x8'));var controller=require(_0x3ba4('0x9'));router[_0x3ba4('0xa')]('/',auth[_0x3ba4('0xb')](),controller['index']);router[_0x3ba4('0xa')]('/:id',auth[_0x3ba4('0xb')](),controller[_0x3ba4('0xc')]);router[_0x3ba4('0xd')]('/',auth['isAuthenticated'](),controller[_0x3ba4('0xe')]);router[_0x3ba4('0xf')]('/:id',auth[_0x3ba4('0xb')](),controller[_0x3ba4('0x10')]);router[_0x3ba4('0x11')]('/:id',auth[_0x3ba4('0xb')](),controller[_0x3ba4('0x12')]);module[_0x3ba4('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c2617e0..bbb2d1e 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 _0xd8b0=['exports','sequelize'];(function(_0x5ee046,_0x5e442f){var _0x2817aa=function(_0x18d261){while(--_0x18d261){_0x5ee046['push'](_0x5ee046['shift']());}};_0x2817aa(++_0x5e442f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x1fadd8,_0x33062b){var _0x5c83b6=function(_0x12727d){while(--_0x12727d){_0x1fadd8['push'](_0x1fadd8['shift']());}};_0x5c83b6(++_0x33062b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b08bc4f..acc9754 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 _0x5858=['attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','getItems','findOne','DashboardItem','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','include','rows','catch','show','keys','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','includeAll','omit','updatedAt','createdAt','role','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x5858,0x1ae));var _0x8585=function(_0x5e8c94,_0x4f68e7){_0x5e8c94=_0x5e8c94-0x0;var _0x2a2826=_0x5858[_0x5e8c94];return _0x2a2826;};'use strict';var emlformat=require(_0x8585('0x0'));var rimraf=require(_0x8585('0x1'));var zipdir=require(_0x8585('0x2'));var jsonpatch=require(_0x8585('0x3'));var rp=require(_0x8585('0x4'));var moment=require(_0x8585('0x5'));var BPromise=require(_0x8585('0x6'));var Mustache=require('mustache');var util=require(_0x8585('0x7'));var path=require(_0x8585('0x8'));var sox=require(_0x8585('0x9'));var csv=require(_0x8585('0xa'));var ejs=require(_0x8585('0xb'));var fs=require('fs');var fs_extra=require(_0x8585('0xc'));var _=require(_0x8585('0xd'));var squel=require(_0x8585('0xe'));var crypto=require(_0x8585('0xf'));var jsforce=require(_0x8585('0x10'));var deskjs=require(_0x8585('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8585('0x12'));var Redis=require(_0x8585('0x13'));var authService=require(_0x8585('0x14'));var qs=require(_0x8585('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8585('0x16'));var logger=require(_0x8585('0x17'))(_0x8585('0x18'));var utils=require(_0x8585('0x19'));var config=require(_0x8585('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8585('0x1b')]=_[_0x8585('0x1c')](config[_0x8585('0x1b')],{'host':_0x8585('0x1d'),'port':0x18eb});var socket=require(_0x8585('0x1e'))(new Redis(config['redis']));require('./dashboard.socket')[_0x8585('0x1f')](socket);function respondWithStatusCode(_0x597a67,_0x47c62a){_0x47c62a=_0x47c62a||0xcc;return function(_0x3c443e){if(_0x3c443e){return _0x597a67[_0x8585('0x20')](_0x47c62a);}return _0x597a67[_0x8585('0x21')](_0x47c62a)[_0x8585('0x22')]();};}function respondWithResult(_0x52fe8d,_0xd0c20a){_0xd0c20a=_0xd0c20a||0xc8;return function(_0x18d697){if(_0x18d697){return _0x52fe8d[_0x8585('0x21')](_0xd0c20a)['json'](_0x18d697);}};}function respondWithFilteredResult(_0x52947d,_0x543489){return function(_0x19f5c3){if(_0x19f5c3){var _0x2465a8=typeof _0x543489[_0x8585('0x23')]==='undefined'&&typeof _0x543489['limit']===_0x8585('0x24');var _0x49f967=_0x19f5c3['count'];var _0x223697=_0x2465a8?0x0:_0x543489[_0x8585('0x23')];var _0x226f11=_0x2465a8?_0x19f5c3[_0x8585('0x25')]:_0x543489[_0x8585('0x23')]+_0x543489[_0x8585('0x26')];var _0x309ed6;if(_0x226f11>=_0x49f967){_0x226f11=_0x49f967;_0x309ed6=0xc8;}else{_0x309ed6=0xce;}_0x52947d[_0x8585('0x21')](_0x309ed6);return _0x52947d['set'](_0x8585('0x27'),_0x223697+'-'+_0x226f11+'/'+_0x49f967)[_0x8585('0x28')](_0x19f5c3);}return null;};}function patchUpdates(_0x31d0d5){return function(_0x5b1ec4){try{jsonpatch[_0x8585('0x29')](_0x5b1ec4,_0x31d0d5,!![]);}catch(_0x3228d9){return BPromise[_0x8585('0x2a')](_0x3228d9);}return _0x5b1ec4['save']();};}function saveUpdates(_0x4bdd70,_0xa52f3c){return function(_0x1ec988){if(_0x1ec988){return _0x1ec988[_0x8585('0x2b')](_0x4bdd70)[_0x8585('0x2c')](function(_0x134416){return _0x134416;});}return null;};}function removeEntity(_0x18ee1f,_0x2c10c5){return function(_0x5d86d4){if(_0x5d86d4){return _0x5d86d4[_0x8585('0x2d')]()[_0x8585('0x2c')](function(){var _0x382c2a=_0x5d86d4[_0x8585('0x2e')]({'plain':!![]});var _0x5a1a1b=_0x8585('0x2f');return db[_0x8585('0x30')][_0x8585('0x2d')]({'where':{'type':_0x5a1a1b,'resourceId':_0x382c2a['id']}})['then'](function(){return _0x5d86d4;});})[_0x8585('0x2c')](function(){_0x18ee1f[_0x8585('0x21')](0xcc)[_0x8585('0x22')]();});}};}function handleEntityNotFound(_0xa7a87e,_0x1d7af8){return function(_0x20bda6){if(!_0x20bda6){_0xa7a87e[_0x8585('0x20')](0x194);}return _0x20bda6;};}function handleError(_0x271d44,_0x1d9e76){_0x1d9e76=_0x1d9e76||0x1f4;return function(_0x4bdd33){logger[_0x8585('0x31')](_0x4bdd33[_0x8585('0x32')]);if(_0x4bdd33[_0x8585('0x33')]){delete _0x4bdd33['name'];}_0x271d44[_0x8585('0x21')](_0x1d9e76)[_0x8585('0x34')](_0x4bdd33);};}exports[_0x8585('0x35')]=function(_0x23302c,_0x31440a){var _0x102a12={},_0x4e6a77={},_0x5af081={'count':0x0,'rows':[]};var _0xca8d1=_[_0x8585('0x36')](db[_0x8585('0x37')]['rawAttributes'],function(_0x4a37cb){return{'name':_0x4a37cb['fieldName'],'type':_0x4a37cb[_0x8585('0x38')][_0x8585('0x39')]};});_0x4e6a77[_0x8585('0x3a')]=_[_0x8585('0x36')](_0xca8d1,'name');_0x4e6a77[_0x8585('0x3b')]=_['keys'](_0x23302c[_0x8585('0x3b')]);_0x4e6a77[_0x8585('0x3c')]=_[_0x8585('0x3d')](_0x4e6a77[_0x8585('0x3a')],_0x4e6a77[_0x8585('0x3b')]);_0x102a12[_0x8585('0x3e')]=_[_0x8585('0x3d')](_0x4e6a77['model'],qs[_0x8585('0x3f')](_0x23302c['query']['fields']));_0x102a12[_0x8585('0x3e')]=_0x102a12['attributes']['length']?_0x102a12[_0x8585('0x3e')]:_0x4e6a77[_0x8585('0x3a')];if(!_0x23302c[_0x8585('0x3b')][_0x8585('0x40')](_0x8585('0x41'))){_0x102a12[_0x8585('0x26')]=qs[_0x8585('0x26')](_0x23302c[_0x8585('0x3b')][_0x8585('0x26')]);_0x102a12['offset']=qs[_0x8585('0x23')](_0x23302c[_0x8585('0x3b')]['offset']);}_0x102a12[_0x8585('0x42')]=qs['sort'](_0x23302c['query']['sort']);_0x102a12['where']=qs[_0x8585('0x3c')](_[_0x8585('0x43')](_0x23302c[_0x8585('0x3b')],_0x4e6a77[_0x8585('0x3c')]),_0xca8d1);if(_0x23302c[_0x8585('0x3b')]['filter']){_0x102a12[_0x8585('0x44')]=_[_0x8585('0x45')](_0x102a12['where'],{'$or':_[_0x8585('0x36')](_0xca8d1,function(_0xa1f72f){if(_0xa1f72f[_0x8585('0x38')]!==_0x8585('0x46')){var _0x141b1c={};_0x141b1c[_0xa1f72f['name']]={'$like':'%'+_0x23302c[_0x8585('0x3b')][_0x8585('0x47')]+'%'};return _0x141b1c;}})});}_0x102a12=_['merge']({},_0x102a12,_0x23302c[_0x8585('0x48')]);var _0x15ad4e={'where':_0x102a12[_0x8585('0x44')]};return db[_0x8585('0x37')][_0x8585('0x25')](_0x15ad4e)[_0x8585('0x2c')](function(_0x51eb0d){_0x5af081[_0x8585('0x25')]=_0x51eb0d;if(_0x23302c[_0x8585('0x3b')]['includeAll']){_0x102a12[_0x8585('0x49')]=[{'all':!![]}];}return db[_0x8585('0x37')]['findAll'](_0x102a12);})[_0x8585('0x2c')](function(_0x404be0){_0x5af081[_0x8585('0x4a')]=_0x404be0;return _0x5af081;})[_0x8585('0x2c')](respondWithFilteredResult(_0x31440a,_0x102a12))[_0x8585('0x4b')](handleError(_0x31440a,null));};exports[_0x8585('0x4c')]=function(_0xf59832,_0x53630e){var _0x254958={'raw':![],'where':{'id':_0xf59832['params']['id']}},_0xf9a7c8={};_0xf9a7c8['model']=_[_0x8585('0x4d')](db[_0x8585('0x37')][_0x8585('0x4e')]);_0xf9a7c8[_0x8585('0x3b')]=_[_0x8585('0x4d')](_0xf59832[_0x8585('0x3b')]);_0xf9a7c8[_0x8585('0x3c')]=_[_0x8585('0x3d')](_0xf9a7c8['model'],_0xf9a7c8[_0x8585('0x3b')]);_0x254958[_0x8585('0x3e')]=_['intersection'](_0xf9a7c8[_0x8585('0x3a')],qs[_0x8585('0x3f')](_0xf59832[_0x8585('0x3b')][_0x8585('0x3f')]));_0x254958[_0x8585('0x3e')]=_0x254958[_0x8585('0x3e')][_0x8585('0x4f')]?_0x254958[_0x8585('0x3e')]:_0xf9a7c8[_0x8585('0x3a')];if(_0xf59832[_0x8585('0x3b')]['includeAll']){_0x254958[_0x8585('0x49')]=[{'all':!![]}];}_0x254958=_['merge']({},_0x254958,_0xf59832[_0x8585('0x48')]);return db[_0x8585('0x37')]['find'](_0x254958)[_0x8585('0x2c')](handleEntityNotFound(_0x53630e,null))['then'](respondWithResult(_0x53630e,null))[_0x8585('0x4b')](handleError(_0x53630e,null));};exports[_0x8585('0x50')]=function(_0x22e951,_0x3e0b68){return db[_0x8585('0x37')][_0x8585('0x50')](_0x22e951[_0x8585('0x51')],{})[_0x8585('0x2c')](function(_0x3718bd){var _0x5d813b=_0x22e951[_0x8585('0x52')][_0x8585('0x2e')]({'plain':!![]});if(!_0x5d813b)throw new Error(_0x8585('0x53'));if(_0x5d813b['role']==='user'){var _0x2919ca=_0x3718bd[_0x8585('0x2e')]({'plain':!![]});var _0x1682ca='CustomDashboards';return db['UserProfileSection'][_0x8585('0x54')]({'where':{'name':_0x1682ca,'userProfileId':_0x5d813b[_0x8585('0x55')]},'raw':!![]})['then'](function(_0x3f9a90){if(_0x3f9a90&&_0x3f9a90[_0x8585('0x56')]===0x0){return db[_0x8585('0x30')][_0x8585('0x50')]({'name':_0x2919ca[_0x8585('0x33')],'resourceId':_0x2919ca['id'],'type':_0x3f9a90[_0x8585('0x33')],'sectionId':_0x3f9a90['id']},{})[_0x8585('0x2c')](function(){return _0x3718bd;});}else{return _0x3718bd;}})['catch'](function(_0x1fa181){logger[_0x8585('0x31')](_0x8585('0x57'),_0x1fa181);throw _0x1fa181;});}return _0x3718bd;})[_0x8585('0x2c')](respondWithResult(_0x3e0b68,0xc9))[_0x8585('0x4b')](handleError(_0x3e0b68,null));};exports['clone']=function(_0x387c23,_0x4d4965){var _0x1b878a={'where':{'id':_0x387c23[_0x8585('0x58')]['id']}},_0xbca133={};_0xbca133['model']=_[_0x8585('0x4d')](db[_0x8585('0x37')][_0x8585('0x4e')]);_0x1b878a['attributes']=_[_0x8585('0x3d')](_0xbca133[_0x8585('0x3a')],qs['fields'](_0x387c23['query'][_0x8585('0x3f')]));_0x1b878a['attributes']=_0x1b878a[_0x8585('0x3e')][_0x8585('0x4f')]?_0x1b878a[_0x8585('0x3e')]:_0xbca133[_0x8585('0x3a')];if(_0x387c23['query'][_0x8585('0x59')]){_0x1b878a[_0x8585('0x49')]=[{'all':!![]}];}_0x1b878a=_[_0x8585('0x45')]({},_0x1b878a,_0x387c23[_0x8585('0x48')]);return db[_0x8585('0x37')]['find'](_0x1b878a)['then'](handleEntityNotFound(_0x4d4965,null))[_0x8585('0x2c')](function(_0x37351a){if(_0x37351a){var _0x747a75=_0x37351a['get']({'plain':!![]});_0x747a75=qs[_0x8585('0x5a')](_0x747a75,['id','createdAt',_0x8585('0x5b')]);_0x387c23[_0x8585('0x51')]=_['omit'](_0x387c23[_0x8585('0x51')],['id',_0x8585('0x5c'),'updatedAt']);return db[_0x8585('0x37')][_0x8585('0x50')](_[_0x8585('0x45')](_0x747a75,_0x387c23[_0x8585('0x51')]),{'include':_0x387c23[_0x8585('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0x8585('0x2c')](function(_0x81c720){var _0x426fa9=_0x387c23['user'][_0x8585('0x2e')]({'plain':!![]});if(!_0x426fa9)throw new Error(_0x8585('0x53'));if(_0x426fa9[_0x8585('0x5d')]===_0x8585('0x52')){var _0x35f0e4=_0x81c720['get']({'plain':!![]});var _0x8f0bd8=_0x8585('0x2f');return db['UserProfileSection'][_0x8585('0x54')]({'where':{'name':_0x8f0bd8,'userProfileId':_0x426fa9[_0x8585('0x55')]},'raw':!![]})['then'](function(_0x3d8549){if(_0x3d8549&&_0x3d8549['autoAssociation']===0x0){return db[_0x8585('0x30')][_0x8585('0x50')]({'name':_0x35f0e4[_0x8585('0x33')],'resourceId':_0x35f0e4['id'],'type':_0x3d8549[_0x8585('0x33')],'sectionId':_0x3d8549['id']},{})[_0x8585('0x2c')](function(){return _0x81c720;});}else{return _0x81c720;}})[_0x8585('0x4b')](function(_0xf2a0a0){logger[_0x8585('0x31')](_0x8585('0x57'),_0xf2a0a0);throw _0xf2a0a0;});}return _0x81c720;});}})[_0x8585('0x2c')](respondWithResult(_0x4d4965,0xc9))[_0x8585('0x4b')](handleError(_0x4d4965,null));};exports['update']=function(_0x1c0f94,_0xf7dcfa){if(_0x1c0f94[_0x8585('0x51')]['id']){delete _0x1c0f94[_0x8585('0x51')]['id'];}return db['Dashboard'][_0x8585('0x54')]({'where':{'id':_0x1c0f94[_0x8585('0x58')]['id']}})[_0x8585('0x2c')](handleEntityNotFound(_0xf7dcfa,null))[_0x8585('0x2c')](saveUpdates(_0x1c0f94[_0x8585('0x51')],null))[_0x8585('0x2c')](respondWithResult(_0xf7dcfa,null))[_0x8585('0x4b')](handleError(_0xf7dcfa,null));};exports[_0x8585('0x2d')]=function(_0x46c096,_0x39cd95){return db[_0x8585('0x37')][_0x8585('0x54')]({'where':{'id':_0x46c096['params']['id']}})['then'](handleEntityNotFound(_0x39cd95,null))[_0x8585('0x2c')](removeEntity(_0x39cd95,null))['catch'](handleError(_0x39cd95,null));};function widgetAttributes(_0x27aae2){try{switch(_0x27aae2[_0x8585('0x38')]){case _0x8585('0x5e'):return[{'name':_0x8585('0x5f'),'value':_0x27aae2[_0x8585('0x5f')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x0]?_0x27aae2['attrs'][0x0]['value']:undefined)||_0x8585('0x61')}];case _0x8585('0x62'):return[{'name':'attrPath','value':_0x27aae2[_0x8585('0x63')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x0]?_0x27aae2[_0x8585('0x60')][0x0][_0x8585('0x64')]:undefined)||''}];case _0x8585('0x65'):return[{'name':'attrHourFormat','value':_0x27aae2[_0x8585('0x66')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x0]?_0x27aae2[_0x8585('0x60')][0x0][_0x8585('0x64')]:undefined)||_0x8585('0x67')},{'name':_0x8585('0x68'),'value':_0x27aae2[_0x8585('0x68')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x1]?_0x27aae2[_0x8585('0x60')][0x1][_0x8585('0x64')]:undefined)||_0x8585('0x69')},{'name':'attrFontSize','value':_0x27aae2['attrFontSize']||(_0x27aae2['attrs']&&_0x27aae2[_0x8585('0x60')][0x2]?_0x27aae2['attrs'][0x2][_0x8585('0x64')]:undefined)||0xc}];case'counter':return[{'name':_0x8585('0x6a'),'value':_0x27aae2['attrMetric']||(_0x27aae2['attrs']&&_0x27aae2['attrs'][0x0]?_0x27aae2['attrs'][0x0][_0x8585('0x64')]:undefined)||_0x8585('0x6b')},{'name':'attrVoiceQueues','value':_0x27aae2[_0x8585('0x6c')]||(_0x27aae2['attrs']&&_0x27aae2[_0x8585('0x60')][0x1]?_0x27aae2[_0x8585('0x60')][0x1][_0x8585('0x64')]:undefined)||[]},{'name':_0x8585('0x6d'),'value':_0x27aae2[_0x8585('0x6d')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x2]?_0x27aae2[_0x8585('0x60')][0x2]['value']:undefined)||0x14},{'name':_0x8585('0x6e'),'value':_0x27aae2[_0x8585('0x6e')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x3]?_0x27aae2['attrs'][0x3][_0x8585('0x64')]:undefined)||_0x8585('0x6f')},{'name':'attrEmailAccounts','value':_0x27aae2[_0x8585('0x70')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x4]?_0x27aae2[_0x8585('0x60')][0x4][_0x8585('0x64')]:undefined)||''},{'name':_0x8585('0x71'),'value':_0x27aae2[_0x8585('0x71')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x5]?_0x27aae2[_0x8585('0x60')][0x5][_0x8585('0x64')]:undefined)||''},{'name':_0x8585('0x72'),'value':_0x27aae2[_0x8585('0x72')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x6]?_0x27aae2[_0x8585('0x60')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x27aae2['attrOpenchannelAccounts']||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x7]?_0x27aae2[_0x8585('0x60')][0x7][_0x8585('0x64')]:undefined)||''},{'name':_0x8585('0x73'),'value':_0x27aae2[_0x8585('0x73')]||(_0x27aae2['attrs']&&_0x27aae2['attrs'][0x8]?_0x27aae2[_0x8585('0x60')][0x8][_0x8585('0x64')]:undefined)||''},{'name':_0x8585('0x74'),'value':_0x27aae2[_0x8585('0x74')]||(_0x27aae2['attrs']&&_0x27aae2[_0x8585('0x60')][0x9]?_0x27aae2[_0x8585('0x60')][0x9][_0x8585('0x64')]:undefined)||''}];case _0x8585('0x75'):case _0x8585('0x76'):return[{'name':_0x8585('0x77'),'value':_0x27aae2[_0x8585('0x77')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2['attrs'][0x0]?_0x27aae2[_0x8585('0x60')][0x0][_0x8585('0x64')]:undefined)||_0x8585('0x6b')},{'name':_0x8585('0x78'),'value':_0x27aae2[_0x8585('0x78')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x1]?_0x27aae2[_0x8585('0x60')][0x1][_0x8585('0x64')]:undefined)||null},{'name':_0x8585('0x79'),'value':_0x27aae2[_0x8585('0x79')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2['attrs'][0x2]?_0x27aae2[_0x8585('0x60')][0x2][_0x8585('0x64')]:undefined)||null},{'name':_0x8585('0x6c'),'value':_0x27aae2[_0x8585('0x6c')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2['attrs'][0x3]?_0x27aae2[_0x8585('0x60')][0x3]['value']:undefined)||[]},{'name':_0x8585('0x6e'),'value':_0x27aae2[_0x8585('0x6e')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x4]?_0x27aae2[_0x8585('0x60')][0x4][_0x8585('0x64')]:undefined)||_0x8585('0x6f')},{'name':_0x8585('0x70'),'value':_0x27aae2[_0x8585('0x70')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2['attrs'][0x5]?_0x27aae2[_0x8585('0x60')][0x5][_0x8585('0x64')]:undefined)||''},{'name':_0x8585('0x71'),'value':_0x27aae2[_0x8585('0x71')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x6]?_0x27aae2[_0x8585('0x60')][0x6][_0x8585('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x27aae2[_0x8585('0x72')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x7]?_0x27aae2[_0x8585('0x60')][0x7][_0x8585('0x64')]:undefined)||''},{'name':_0x8585('0x7a'),'value':_0x27aae2[_0x8585('0x7a')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x8]?_0x27aae2[_0x8585('0x60')][0x8][_0x8585('0x64')]:undefined)||''},{'name':_0x8585('0x73'),'value':_0x27aae2[_0x8585('0x73')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2['attrs'][0x9]?_0x27aae2[_0x8585('0x60')][0x9]['value']:undefined)||''},{'name':_0x8585('0x74'),'value':_0x27aae2[_0x8585('0x74')]||(_0x27aae2['attrs']&&_0x27aae2[_0x8585('0x60')][0xa]?_0x27aae2[_0x8585('0x60')][0xa][_0x8585('0x64')]:undefined)||''}];case _0x8585('0x7b'):return[{'name':_0x8585('0x7c'),'type':_0x27aae2[_0x8585('0x7d')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x0]?_0x27aae2['attrs'][0x0][_0x8585('0x38')]:undefined)||null,'value':_0x27aae2[_0x8585('0x7c')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x0]?_0x27aae2[_0x8585('0x60')][0x0][_0x8585('0x64')]:undefined)||null},{'name':_0x8585('0x7e'),'value':_0x27aae2[_0x8585('0x7e')]||(_0x27aae2[_0x8585('0x60')]&&_0x27aae2[_0x8585('0x60')][0x1]?_0x27aae2[_0x8585('0x60')][0x1][_0x8585('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x4c97df){logger['error'](_0x8585('0x7f'),JSON['stringify'](_0x4c97df));return[];}}exports['addItem']=function(_0x10bb3a,_0x271203,_0x46f4a1){if(_0x10bb3a[_0x8585('0x51')]['id']){delete _0x10bb3a[_0x8585('0x51')]['id'];}return db[_0x8585('0x37')][_0x8585('0x54')]({'where':{'id':_0x10bb3a[_0x8585('0x58')]['id']}})['then'](handleEntityNotFound(_0x271203,null))[_0x8585('0x2c')](function(_0x2c8b71){if(_0x2c8b71){_0x10bb3a[_0x8585('0x51')][_0x8585('0x80')]=_0x2c8b71['id'];_0x10bb3a[_0x8585('0x51')][_0x8585('0x60')]=widgetAttributes(_0x10bb3a[_0x8585('0x51')]);return db['DashboardItem'][_0x8585('0x50')](_0x10bb3a[_0x8585('0x51')]);}})[_0x8585('0x2c')](respondWithResult(_0x271203,null))[_0x8585('0x4b')](handleError(_0x271203,null));};exports[_0x8585('0x81')]=function(_0x204861,_0x2739ed,_0x524e76){var _0x16b9d7={};var _0x4948df={};var _0x529a08;var _0x5d71f6;return db['Dashboard'][_0x8585('0x82')]({'where':{'id':_0x204861['params']['id']}})[_0x8585('0x2c')](handleEntityNotFound(_0x2739ed,null))[_0x8585('0x2c')](function(_0x44c86a){if(_0x44c86a){_0x529a08=_0x44c86a;_0x4948df[_0x8585('0x3a')]=_['keys'](db[_0x8585('0x83')][_0x8585('0x4e')]);_0x4948df[_0x8585('0x3b')]=_[_0x8585('0x4d')](_0x204861[_0x8585('0x3b')]);_0x4948df[_0x8585('0x3c')]=_['intersection'](_0x4948df[_0x8585('0x3a')],_0x4948df[_0x8585('0x3b')]);_0x16b9d7[_0x8585('0x3e')]=_['intersection'](_0x4948df['model'],qs[_0x8585('0x3f')](_0x204861[_0x8585('0x3b')][_0x8585('0x3f')]));_0x16b9d7['attributes']=_0x16b9d7[_0x8585('0x3e')][_0x8585('0x4f')]?_0x16b9d7[_0x8585('0x3e')]:_0x4948df['model'];_0x16b9d7[_0x8585('0x42')]=qs[_0x8585('0x84')](_0x204861[_0x8585('0x3b')][_0x8585('0x84')]);_0x16b9d7[_0x8585('0x44')]=qs[_0x8585('0x3c')](_[_0x8585('0x43')](_0x204861[_0x8585('0x3b')],_0x4948df[_0x8585('0x3c')]));if(_0x204861[_0x8585('0x3b')][_0x8585('0x47')]){_0x16b9d7[_0x8585('0x44')]=_[_0x8585('0x45')](_0x16b9d7[_0x8585('0x44')],{'$or':_['map'](_0x16b9d7['attributes'],function(_0x25ddde){var _0x29d6d9={};_0x29d6d9[_0x25ddde]={'$like':'%'+_0x204861[_0x8585('0x3b')][_0x8585('0x47')]+'%'};return _0x29d6d9;})});}_0x16b9d7=_['merge']({},_0x16b9d7,_0x204861[_0x8585('0x48')]);return _0x529a08[_0x8585('0x81')](_0x16b9d7);}})[_0x8585('0x2c')](function(_0x192c0f){if(_0x192c0f){_0x5d71f6=_0x192c0f[_0x8585('0x4f')];if(!_0x204861['query'][_0x8585('0x40')](_0x8585('0x41'))){_0x16b9d7[_0x8585('0x26')]=qs['limit'](_0x204861[_0x8585('0x3b')][_0x8585('0x26')]);_0x16b9d7[_0x8585('0x23')]=qs[_0x8585('0x23')](_0x204861['query'][_0x8585('0x23')]);}return _0x529a08[_0x8585('0x81')](_0x16b9d7);}})[_0x8585('0x2c')](function(_0x5c5cc0){if(_0x5c5cc0){return _0x5c5cc0?{'count':_0x5d71f6,'rows':_0x5c5cc0}:null;}})[_0x8585('0x2c')](respondWithResult(_0x2739ed,null))[_0x8585('0x4b')](handleError(_0x2739ed,null));}; \ No newline at end of file +var _0xb2c2=['attrUrl','attrs','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','CustomDashboards','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','find','autoAssociation','params','iframe'];(function(_0x3eff1b,_0xa5924){var _0x47ebc2=function(_0x164bed){while(--_0x164bed){_0x3eff1b['push'](_0x3eff1b['shift']());}};_0x47ebc2(++_0xa5924);}(_0xb2c2,0xa3));var _0x2b2c=function(_0x8e992d,_0x5dd91c){_0x8e992d=_0x8e992d-0x0;var _0x41dd7f=_0xb2c2[_0x8e992d];return _0x41dd7f;};'use strict';var emlformat=require(_0x2b2c('0x0'));var rimraf=require(_0x2b2c('0x1'));var zipdir=require(_0x2b2c('0x2'));var jsonpatch=require(_0x2b2c('0x3'));var rp=require(_0x2b2c('0x4'));var moment=require(_0x2b2c('0x5'));var BPromise=require(_0x2b2c('0x6'));var Mustache=require(_0x2b2c('0x7'));var util=require(_0x2b2c('0x8'));var path=require('path');var sox=require(_0x2b2c('0x9'));var csv=require(_0x2b2c('0xa'));var ejs=require(_0x2b2c('0xb'));var fs=require('fs');var fs_extra=require(_0x2b2c('0xc'));var _=require(_0x2b2c('0xd'));var squel=require(_0x2b2c('0xe'));var crypto=require(_0x2b2c('0xf'));var jsforce=require(_0x2b2c('0x10'));var deskjs=require(_0x2b2c('0x11'));var toCsv=require(_0x2b2c('0xa'));var querystring=require('querystring');var Papa=require(_0x2b2c('0x12'));var Redis=require(_0x2b2c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2b2c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2b2c('0x15'));var utils=require(_0x2b2c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2b2c('0x17'))['db'];config[_0x2b2c('0x18')]=_['defaults'](config['redis'],{'host':_0x2b2c('0x19'),'port':0x18eb});var socket=require(_0x2b2c('0x1a'))(new Redis(config['redis']));require(_0x2b2c('0x1b'))[_0x2b2c('0x1c')](socket);function respondWithStatusCode(_0x39f76f,_0x4ba545){_0x4ba545=_0x4ba545||0xcc;return function(_0x42230f){if(_0x42230f){return _0x39f76f['sendStatus'](_0x4ba545);}return _0x39f76f[_0x2b2c('0x1d')](_0x4ba545)[_0x2b2c('0x1e')]();};}function respondWithResult(_0x5ad89f,_0x2663a2){_0x2663a2=_0x2663a2||0xc8;return function(_0x1201ea){if(_0x1201ea){return _0x5ad89f[_0x2b2c('0x1d')](_0x2663a2)[_0x2b2c('0x1f')](_0x1201ea);}};}function respondWithFilteredResult(_0x509667,_0x302778){return function(_0xf3dc92){if(_0xf3dc92){var _0x55b739=typeof _0x302778[_0x2b2c('0x20')]===_0x2b2c('0x21')&&typeof _0x302778['limit']==='undefined';var _0x3e6cfa=_0xf3dc92[_0x2b2c('0x22')];var _0x5d90be=_0x55b739?0x0:_0x302778[_0x2b2c('0x20')];var _0x3a74f9=_0x55b739?_0xf3dc92[_0x2b2c('0x22')]:_0x302778[_0x2b2c('0x20')]+_0x302778[_0x2b2c('0x23')];var _0x324482;if(_0x3a74f9>=_0x3e6cfa){_0x3a74f9=_0x3e6cfa;_0x324482=0xc8;}else{_0x324482=0xce;}_0x509667[_0x2b2c('0x1d')](_0x324482);return _0x509667[_0x2b2c('0x24')](_0x2b2c('0x25'),_0x5d90be+'-'+_0x3a74f9+'/'+_0x3e6cfa)[_0x2b2c('0x1f')](_0xf3dc92);}return null;};}function patchUpdates(_0x4cc8bb){return function(_0x2972ac){try{jsonpatch[_0x2b2c('0x26')](_0x2972ac,_0x4cc8bb,!![]);}catch(_0x1dd7de){return BPromise[_0x2b2c('0x27')](_0x1dd7de);}return _0x2972ac[_0x2b2c('0x28')]();};}function saveUpdates(_0x31e1f7,_0x2f61d9){return function(_0x455685){if(_0x455685){return _0x455685[_0x2b2c('0x29')](_0x31e1f7)[_0x2b2c('0x2a')](function(_0x41f9e0){return _0x41f9e0;});}return null;};}function removeEntity(_0x2f0a5b,_0x4229cb){return function(_0x561182){if(_0x561182){return _0x561182['destroy']()[_0x2b2c('0x2a')](function(){var _0x456af=_0x561182['get']({'plain':!![]});var _0x4ade65=_0x2b2c('0x2b');return db[_0x2b2c('0x2c')][_0x2b2c('0x2d')]({'where':{'type':_0x4ade65,'resourceId':_0x456af['id']}})['then'](function(){return _0x561182;});})['then'](function(){_0x2f0a5b[_0x2b2c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9052,_0x475c7d){return function(_0x464b41){if(!_0x464b41){_0x5b9052[_0x2b2c('0x2e')](0x194);}return _0x464b41;};}function handleError(_0x51a234,_0x51eb4c){_0x51eb4c=_0x51eb4c||0x1f4;return function(_0x428cdb){logger[_0x2b2c('0x2f')](_0x428cdb[_0x2b2c('0x30')]);if(_0x428cdb['name']){delete _0x428cdb[_0x2b2c('0x31')];}_0x51a234[_0x2b2c('0x1d')](_0x51eb4c)[_0x2b2c('0x32')](_0x428cdb);};}exports[_0x2b2c('0x33')]=function(_0x2ceda1,_0x321c6e){var _0x42f8b5={},_0x453f80={},_0x31b365={'count':0x0,'rows':[]};var _0x474e79=_[_0x2b2c('0x34')](db[_0x2b2c('0x35')][_0x2b2c('0x36')],function(_0x13c704){return{'name':_0x13c704['fieldName'],'type':_0x13c704[_0x2b2c('0x37')]['key']};});_0x453f80[_0x2b2c('0x38')]=_['map'](_0x474e79,_0x2b2c('0x31'));_0x453f80[_0x2b2c('0x39')]=_[_0x2b2c('0x3a')](_0x2ceda1['query']);_0x453f80[_0x2b2c('0x3b')]=_[_0x2b2c('0x3c')](_0x453f80[_0x2b2c('0x38')],_0x453f80[_0x2b2c('0x39')]);_0x42f8b5[_0x2b2c('0x3d')]=_['intersection'](_0x453f80['model'],qs[_0x2b2c('0x3e')](_0x2ceda1['query']['fields']));_0x42f8b5[_0x2b2c('0x3d')]=_0x42f8b5[_0x2b2c('0x3d')]['length']?_0x42f8b5['attributes']:_0x453f80[_0x2b2c('0x38')];if(!_0x2ceda1[_0x2b2c('0x39')]['hasOwnProperty']('nolimit')){_0x42f8b5['limit']=qs['limit'](_0x2ceda1['query'][_0x2b2c('0x23')]);_0x42f8b5[_0x2b2c('0x20')]=qs[_0x2b2c('0x20')](_0x2ceda1[_0x2b2c('0x39')][_0x2b2c('0x20')]);}_0x42f8b5[_0x2b2c('0x3f')]=qs[_0x2b2c('0x40')](_0x2ceda1[_0x2b2c('0x39')]['sort']);_0x42f8b5[_0x2b2c('0x41')]=qs[_0x2b2c('0x3b')](_[_0x2b2c('0x42')](_0x2ceda1[_0x2b2c('0x39')],_0x453f80[_0x2b2c('0x3b')]),_0x474e79);if(_0x2ceda1[_0x2b2c('0x39')][_0x2b2c('0x43')]){_0x42f8b5['where']=_[_0x2b2c('0x44')](_0x42f8b5[_0x2b2c('0x41')],{'$or':_[_0x2b2c('0x34')](_0x474e79,function(_0x5db9){if(_0x5db9[_0x2b2c('0x37')]!==_0x2b2c('0x45')){var _0x2145e7={};_0x2145e7[_0x5db9[_0x2b2c('0x31')]]={'$like':'%'+_0x2ceda1[_0x2b2c('0x39')][_0x2b2c('0x43')]+'%'};return _0x2145e7;}})});}_0x42f8b5=_[_0x2b2c('0x44')]({},_0x42f8b5,_0x2ceda1[_0x2b2c('0x46')]);var _0x57ea62={'where':_0x42f8b5[_0x2b2c('0x41')]};return db[_0x2b2c('0x35')][_0x2b2c('0x22')](_0x57ea62)[_0x2b2c('0x2a')](function(_0x1ef0ad){_0x31b365[_0x2b2c('0x22')]=_0x1ef0ad;if(_0x2ceda1[_0x2b2c('0x39')][_0x2b2c('0x47')]){_0x42f8b5[_0x2b2c('0x48')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x42f8b5);})[_0x2b2c('0x2a')](function(_0x458b28){_0x31b365['rows']=_0x458b28;return _0x31b365;})[_0x2b2c('0x2a')](respondWithFilteredResult(_0x321c6e,_0x42f8b5))[_0x2b2c('0x49')](handleError(_0x321c6e,null));};exports['show']=function(_0x46f6d2,_0x55145f){var _0x5f238f={'raw':![],'where':{'id':_0x46f6d2['params']['id']}},_0x8ee942={};_0x8ee942[_0x2b2c('0x38')]=_['keys'](db[_0x2b2c('0x35')][_0x2b2c('0x36')]);_0x8ee942[_0x2b2c('0x39')]=_[_0x2b2c('0x3a')](_0x46f6d2[_0x2b2c('0x39')]);_0x8ee942[_0x2b2c('0x3b')]=_[_0x2b2c('0x3c')](_0x8ee942['model'],_0x8ee942[_0x2b2c('0x39')]);_0x5f238f[_0x2b2c('0x3d')]=_['intersection'](_0x8ee942[_0x2b2c('0x38')],qs[_0x2b2c('0x3e')](_0x46f6d2[_0x2b2c('0x39')]['fields']));_0x5f238f['attributes']=_0x5f238f[_0x2b2c('0x3d')][_0x2b2c('0x4a')]?_0x5f238f[_0x2b2c('0x3d')]:_0x8ee942[_0x2b2c('0x38')];if(_0x46f6d2[_0x2b2c('0x39')][_0x2b2c('0x47')]){_0x5f238f[_0x2b2c('0x48')]=[{'all':!![]}];}_0x5f238f=_[_0x2b2c('0x44')]({},_0x5f238f,_0x46f6d2[_0x2b2c('0x46')]);return db['Dashboard']['find'](_0x5f238f)[_0x2b2c('0x2a')](handleEntityNotFound(_0x55145f,null))[_0x2b2c('0x2a')](respondWithResult(_0x55145f,null))['catch'](handleError(_0x55145f,null));};exports[_0x2b2c('0x4b')]=function(_0x2aef63,_0x5d9519){return db[_0x2b2c('0x35')][_0x2b2c('0x4b')](_0x2aef63[_0x2b2c('0x4c')],{})[_0x2b2c('0x2a')](function(_0x136a17){var _0x4d3a11=_0x2aef63[_0x2b2c('0x4d')][_0x2b2c('0x4e')]({'plain':!![]});if(!_0x4d3a11)throw new Error(_0x2b2c('0x4f'));if(_0x4d3a11[_0x2b2c('0x50')]===_0x2b2c('0x4d')){var _0xf29bf0=_0x136a17[_0x2b2c('0x4e')]({'plain':!![]});var _0x5876ea='CustomDashboards';return db[_0x2b2c('0x51')]['find']({'where':{'name':_0x5876ea,'userProfileId':_0x4d3a11[_0x2b2c('0x52')]},'raw':!![]})[_0x2b2c('0x2a')](function(_0xfdb9ec){if(_0xfdb9ec&&_0xfdb9ec['autoAssociation']===0x0){return db[_0x2b2c('0x2c')][_0x2b2c('0x4b')]({'name':_0xf29bf0[_0x2b2c('0x31')],'resourceId':_0xf29bf0['id'],'type':_0xfdb9ec[_0x2b2c('0x31')],'sectionId':_0xfdb9ec['id']},{})[_0x2b2c('0x2a')](function(){return _0x136a17;});}else{return _0x136a17;}})[_0x2b2c('0x49')](function(_0x2acfdd){logger[_0x2b2c('0x2f')](_0x2b2c('0x53'),_0x2acfdd);throw _0x2acfdd;});}return _0x136a17;})[_0x2b2c('0x2a')](respondWithResult(_0x5d9519,0xc9))[_0x2b2c('0x49')](handleError(_0x5d9519,null));};exports['clone']=function(_0x54d348,_0x4114d7){var _0x5e30e4={'where':{'id':_0x54d348['params']['id']}},_0x5864e8={};_0x5864e8[_0x2b2c('0x38')]=_[_0x2b2c('0x3a')](db[_0x2b2c('0x35')][_0x2b2c('0x36')]);_0x5e30e4[_0x2b2c('0x3d')]=_[_0x2b2c('0x3c')](_0x5864e8[_0x2b2c('0x38')],qs[_0x2b2c('0x3e')](_0x54d348[_0x2b2c('0x39')][_0x2b2c('0x3e')]));_0x5e30e4[_0x2b2c('0x3d')]=_0x5e30e4['attributes'][_0x2b2c('0x4a')]?_0x5e30e4['attributes']:_0x5864e8[_0x2b2c('0x38')];if(_0x54d348['query']['includeAll']){_0x5e30e4[_0x2b2c('0x48')]=[{'all':!![]}];}_0x5e30e4=_[_0x2b2c('0x44')]({},_0x5e30e4,_0x54d348[_0x2b2c('0x46')]);return db[_0x2b2c('0x35')]['find'](_0x5e30e4)[_0x2b2c('0x2a')](handleEntityNotFound(_0x4114d7,null))[_0x2b2c('0x2a')](function(_0x4dacb8){if(_0x4dacb8){var _0x290cc2=_0x4dacb8[_0x2b2c('0x4e')]({'plain':!![]});_0x290cc2=qs[_0x2b2c('0x54')](_0x290cc2,['id',_0x2b2c('0x55'),_0x2b2c('0x56')]);_0x54d348[_0x2b2c('0x4c')]=_[_0x2b2c('0x54')](_0x54d348['body'],['id','createdAt',_0x2b2c('0x56')]);return db[_0x2b2c('0x35')][_0x2b2c('0x4b')](_[_0x2b2c('0x44')](_0x290cc2,_0x54d348[_0x2b2c('0x4c')]),{'include':_0x54d348['query'][_0x2b2c('0x47')]?[{'all':!![]}]:undefined})[_0x2b2c('0x2a')](function(_0x388417){var _0x24a650=_0x54d348[_0x2b2c('0x4d')][_0x2b2c('0x4e')]({'plain':!![]});if(!_0x24a650)throw new Error(_0x2b2c('0x4f'));if(_0x24a650[_0x2b2c('0x50')]===_0x2b2c('0x4d')){var _0x1b8e0a=_0x388417[_0x2b2c('0x4e')]({'plain':!![]});var _0x433251='CustomDashboards';return db['UserProfileSection'][_0x2b2c('0x57')]({'where':{'name':_0x433251,'userProfileId':_0x24a650[_0x2b2c('0x52')]},'raw':!![]})['then'](function(_0x4383b5){if(_0x4383b5&&_0x4383b5[_0x2b2c('0x58')]===0x0){return db[_0x2b2c('0x2c')][_0x2b2c('0x4b')]({'name':_0x1b8e0a[_0x2b2c('0x31')],'resourceId':_0x1b8e0a['id'],'type':_0x4383b5[_0x2b2c('0x31')],'sectionId':_0x4383b5['id']},{})['then'](function(){return _0x388417;});}else{return _0x388417;}})[_0x2b2c('0x49')](function(_0x1448be){logger[_0x2b2c('0x2f')](_0x2b2c('0x53'),_0x1448be);throw _0x1448be;});}return _0x388417;});}})['then'](respondWithResult(_0x4114d7,0xc9))['catch'](handleError(_0x4114d7,null));};exports[_0x2b2c('0x29')]=function(_0x398482,_0x2d2b24){if(_0x398482['body']['id']){delete _0x398482[_0x2b2c('0x4c')]['id'];}return db[_0x2b2c('0x35')][_0x2b2c('0x57')]({'where':{'id':_0x398482[_0x2b2c('0x59')]['id']}})[_0x2b2c('0x2a')](handleEntityNotFound(_0x2d2b24,null))[_0x2b2c('0x2a')](saveUpdates(_0x398482[_0x2b2c('0x4c')],null))[_0x2b2c('0x2a')](respondWithResult(_0x2d2b24,null))[_0x2b2c('0x49')](handleError(_0x2d2b24,null));};exports[_0x2b2c('0x2d')]=function(_0x70a283,_0x541045){return db[_0x2b2c('0x35')][_0x2b2c('0x57')]({'where':{'id':_0x70a283[_0x2b2c('0x59')]['id']}})[_0x2b2c('0x2a')](handleEntityNotFound(_0x541045,null))['then'](removeEntity(_0x541045,null))[_0x2b2c('0x49')](handleError(_0x541045,null));};function widgetAttributes(_0x473a24){try{switch(_0x473a24['type']){case _0x2b2c('0x5a'):return[{'name':'attrUrl','value':_0x473a24[_0x2b2c('0x5b')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x0]?_0x473a24['attrs'][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0x2b2c('0x5d'),'value':_0x473a24[_0x2b2c('0x5d')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x0]?_0x473a24['attrs'][0x0]['value']:undefined)||''}];case _0x2b2c('0x5e'):return[{'name':_0x2b2c('0x5f'),'value':_0x473a24['attrHourFormat']||(_0x473a24['attrs']&&_0x473a24['attrs'][0x0]?_0x473a24['attrs'][0x0][_0x2b2c('0x60')]:undefined)||_0x2b2c('0x61')},{'name':_0x2b2c('0x62'),'value':_0x473a24[_0x2b2c('0x62')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x1]?_0x473a24[_0x2b2c('0x5c')][0x1]['value']:undefined)||_0x2b2c('0x63')},{'name':_0x2b2c('0x64'),'value':_0x473a24['attrFontSize']||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24['attrs'][0x2]?_0x473a24[_0x2b2c('0x5c')][0x2][_0x2b2c('0x60')]:undefined)||0xc}];case _0x2b2c('0x65'):return[{'name':'attrMetric','value':_0x473a24[_0x2b2c('0x66')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x0]?_0x473a24[_0x2b2c('0x5c')][0x0][_0x2b2c('0x60')]:undefined)||_0x2b2c('0x67')},{'name':'attrVoiceQueues','value':_0x473a24[_0x2b2c('0x68')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24['attrs'][0x1]?_0x473a24[_0x2b2c('0x5c')][0x1][_0x2b2c('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x473a24[_0x2b2c('0x64')]||(_0x473a24['attrs']&&_0x473a24[_0x2b2c('0x5c')][0x2]?_0x473a24[_0x2b2c('0x5c')][0x2][_0x2b2c('0x60')]:undefined)||0x14},{'name':_0x2b2c('0x69'),'value':_0x473a24[_0x2b2c('0x69')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x3]?_0x473a24[_0x2b2c('0x5c')][0x3][_0x2b2c('0x60')]:undefined)||_0x2b2c('0x6a')},{'name':_0x2b2c('0x6b'),'value':_0x473a24[_0x2b2c('0x6b')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x4]?_0x473a24['attrs'][0x4][_0x2b2c('0x60')]:undefined)||''},{'name':_0x2b2c('0x6c'),'value':_0x473a24[_0x2b2c('0x6c')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x5]?_0x473a24[_0x2b2c('0x5c')][0x5][_0x2b2c('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x473a24['attrSmsAccounts']||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x6]?_0x473a24['attrs'][0x6][_0x2b2c('0x60')]:undefined)||''},{'name':_0x2b2c('0x6d'),'value':_0x473a24['attrOpenchannelAccounts']||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x7]?_0x473a24['attrs'][0x7][_0x2b2c('0x60')]:undefined)||''},{'name':_0x2b2c('0x6e'),'value':_0x473a24['attrWhatsappAccounts']||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x8]?_0x473a24['attrs'][0x8][_0x2b2c('0x60')]:undefined)||''},{'name':_0x2b2c('0x6f'),'value':_0x473a24[_0x2b2c('0x6f')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x9]?_0x473a24[_0x2b2c('0x5c')][0x9]['value']:undefined)||''}];case _0x2b2c('0x70'):case'pie-chart':return[{'name':_0x2b2c('0x71'),'value':_0x473a24[_0x2b2c('0x71')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x0]?_0x473a24[_0x2b2c('0x5c')][0x0][_0x2b2c('0x60')]:undefined)||_0x2b2c('0x67')},{'name':_0x2b2c('0x72'),'value':_0x473a24[_0x2b2c('0x72')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24['attrs'][0x1]?_0x473a24['attrs'][0x1][_0x2b2c('0x60')]:undefined)||null},{'name':_0x2b2c('0x73'),'value':_0x473a24[_0x2b2c('0x73')]||(_0x473a24['attrs']&&_0x473a24['attrs'][0x2]?_0x473a24['attrs'][0x2][_0x2b2c('0x60')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x473a24[_0x2b2c('0x68')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x3]?_0x473a24[_0x2b2c('0x5c')][0x3][_0x2b2c('0x60')]:undefined)||[]},{'name':_0x2b2c('0x69'),'value':_0x473a24[_0x2b2c('0x69')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x4]?_0x473a24['attrs'][0x4][_0x2b2c('0x60')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x473a24[_0x2b2c('0x6b')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x5]?_0x473a24[_0x2b2c('0x5c')][0x5][_0x2b2c('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x473a24['attrFaxAccounts']||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x6]?_0x473a24[_0x2b2c('0x5c')][0x6][_0x2b2c('0x60')]:undefined)||''},{'name':_0x2b2c('0x74'),'value':_0x473a24['attrSmsAccounts']||(_0x473a24['attrs']&&_0x473a24[_0x2b2c('0x5c')][0x7]?_0x473a24[_0x2b2c('0x5c')][0x7]['value']:undefined)||''},{'name':_0x2b2c('0x6d'),'value':_0x473a24[_0x2b2c('0x6d')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x8]?_0x473a24['attrs'][0x8][_0x2b2c('0x60')]:undefined)||''},{'name':_0x2b2c('0x6e'),'value':_0x473a24[_0x2b2c('0x6e')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x9]?_0x473a24[_0x2b2c('0x5c')][0x9]['value']:undefined)||''},{'name':_0x2b2c('0x6f'),'value':_0x473a24['attrChatWebsites']||(_0x473a24['attrs']&&_0x473a24[_0x2b2c('0x5c')][0xa]?_0x473a24[_0x2b2c('0x5c')][0xa][_0x2b2c('0x60')]:undefined)||''}];case'web-report':return[{'name':_0x2b2c('0x75'),'type':_0x473a24[_0x2b2c('0x76')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x0]?_0x473a24[_0x2b2c('0x5c')][0x0][_0x2b2c('0x37')]:undefined)||null,'value':_0x473a24[_0x2b2c('0x75')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x0]?_0x473a24['attrs'][0x0][_0x2b2c('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x473a24[_0x2b2c('0x77')]||(_0x473a24[_0x2b2c('0x5c')]&&_0x473a24[_0x2b2c('0x5c')][0x1]?_0x473a24[_0x2b2c('0x5c')][0x1][_0x2b2c('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x1fbb8c){logger[_0x2b2c('0x2f')](_0x2b2c('0x78'),JSON[_0x2b2c('0x79')](_0x1fbb8c));return[];}}exports[_0x2b2c('0x7a')]=function(_0x5a22f1,_0x4620bd,_0x2ce15f){if(_0x5a22f1[_0x2b2c('0x4c')]['id']){delete _0x5a22f1[_0x2b2c('0x4c')]['id'];}return db[_0x2b2c('0x35')][_0x2b2c('0x57')]({'where':{'id':_0x5a22f1[_0x2b2c('0x59')]['id']}})[_0x2b2c('0x2a')](handleEntityNotFound(_0x4620bd,null))[_0x2b2c('0x2a')](function(_0x2a59c6){if(_0x2a59c6){_0x5a22f1[_0x2b2c('0x4c')]['DashboardId']=_0x2a59c6['id'];_0x5a22f1[_0x2b2c('0x4c')][_0x2b2c('0x5c')]=widgetAttributes(_0x5a22f1[_0x2b2c('0x4c')]);return db[_0x2b2c('0x7b')][_0x2b2c('0x4b')](_0x5a22f1['body']);}})[_0x2b2c('0x2a')](respondWithResult(_0x4620bd,null))[_0x2b2c('0x49')](handleError(_0x4620bd,null));};exports[_0x2b2c('0x7c')]=function(_0x55befe,_0x40a50f,_0x4e60bf){var _0x4fcd99={};var _0x6b5a11={};var _0x403ceb;var _0x54fcc2;return db[_0x2b2c('0x35')][_0x2b2c('0x7d')]({'where':{'id':_0x55befe[_0x2b2c('0x59')]['id']}})['then'](handleEntityNotFound(_0x40a50f,null))[_0x2b2c('0x2a')](function(_0x4d3e74){if(_0x4d3e74){_0x403ceb=_0x4d3e74;_0x6b5a11[_0x2b2c('0x38')]=_[_0x2b2c('0x3a')](db[_0x2b2c('0x7b')][_0x2b2c('0x36')]);_0x6b5a11[_0x2b2c('0x39')]=_[_0x2b2c('0x3a')](_0x55befe['query']);_0x6b5a11[_0x2b2c('0x3b')]=_['intersection'](_0x6b5a11[_0x2b2c('0x38')],_0x6b5a11[_0x2b2c('0x39')]);_0x4fcd99[_0x2b2c('0x3d')]=_[_0x2b2c('0x3c')](_0x6b5a11['model'],qs['fields'](_0x55befe['query'][_0x2b2c('0x3e')]));_0x4fcd99['attributes']=_0x4fcd99['attributes'][_0x2b2c('0x4a')]?_0x4fcd99['attributes']:_0x6b5a11['model'];_0x4fcd99[_0x2b2c('0x3f')]=qs[_0x2b2c('0x40')](_0x55befe[_0x2b2c('0x39')][_0x2b2c('0x40')]);_0x4fcd99['where']=qs[_0x2b2c('0x3b')](_[_0x2b2c('0x42')](_0x55befe[_0x2b2c('0x39')],_0x6b5a11[_0x2b2c('0x3b')]));if(_0x55befe[_0x2b2c('0x39')]['filter']){_0x4fcd99[_0x2b2c('0x41')]=_['merge'](_0x4fcd99[_0x2b2c('0x41')],{'$or':_[_0x2b2c('0x34')](_0x4fcd99[_0x2b2c('0x3d')],function(_0x5ce8db){var _0x4db2b9={};_0x4db2b9[_0x5ce8db]={'$like':'%'+_0x55befe[_0x2b2c('0x39')][_0x2b2c('0x43')]+'%'};return _0x4db2b9;})});}_0x4fcd99=_[_0x2b2c('0x44')]({},_0x4fcd99,_0x55befe['options']);return _0x403ceb[_0x2b2c('0x7c')](_0x4fcd99);}})['then'](function(_0x1d9d5e){if(_0x1d9d5e){_0x54fcc2=_0x1d9d5e[_0x2b2c('0x4a')];if(!_0x55befe[_0x2b2c('0x39')][_0x2b2c('0x7e')]('nolimit')){_0x4fcd99[_0x2b2c('0x23')]=qs['limit'](_0x55befe[_0x2b2c('0x39')][_0x2b2c('0x23')]);_0x4fcd99[_0x2b2c('0x20')]=qs['offset'](_0x55befe[_0x2b2c('0x39')][_0x2b2c('0x20')]);}return _0x403ceb['getItems'](_0x4fcd99);}})[_0x2b2c('0x2a')](function(_0x44eb97){if(_0x44eb97){return _0x44eb97?{'count':_0x54fcc2,'rows':_0x44eb97}:null;}})[_0x2b2c('0x2a')](respondWithResult(_0x40a50f,null))[_0x2b2c('0x49')](handleError(_0x40a50f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 059d11e..0bf740a 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 _0x5659=['emit','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x53bcba,_0x1ba9da){var _0x232f3a=function(_0xa00853){while(--_0xa00853){_0x53bcba['push'](_0x53bcba['shift']());}};_0x232f3a(++_0x1ba9da);}(_0x5659,0x168));var _0x9565=function(_0x63a69b,_0x296888){_0x63a69b=_0x63a69b-0x0;var _0x425fa1=_0x5659[_0x63a69b];return _0x425fa1;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x9565('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9565('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9565('0x2'),'afterDestroy':_0x9565('0x3')};function emitEvent(_0x502cd9){return function(_0xda6bac,_0x46e5c8,_0x30bd31){DashboardEvents['emit'](_0x502cd9+':'+_0xda6bac['id'],_0xda6bac);DashboardEvents[_0x9565('0x4')](_0x502cd9,_0xda6bac);_0x30bd31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x9565('0x5')](e,emitEvent(event));}}module[_0x9565('0x6')]=DashboardEvents; \ No newline at end of file +var _0xcd91=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x9ee263,_0x288d52){var _0xcfd846=function(_0x3c591f){while(--_0x3c591f){_0x9ee263['push'](_0x9ee263['shift']());}};_0xcfd846(++_0x288d52);}(_0xcd91,0x8a));var _0x1cd9=function(_0x412e8d,_0x256ed7){_0x412e8d=_0x412e8d-0x0;var _0x23dfa8=_0xcd91[_0x412e8d];return _0x23dfa8;};'use strict';var EventEmitter=require(_0x1cd9('0x0'));var Dashboard=require(_0x1cd9('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1cd9('0x2')](0x0);var events={'afterCreate':_0x1cd9('0x3'),'afterUpdate':_0x1cd9('0x4'),'afterDestroy':_0x1cd9('0x5')};function emitEvent(_0x4393e8){return function(_0x3a1080,_0x21271b,_0x2d4963){DashboardEvents[_0x1cd9('0x6')](_0x4393e8+':'+_0x3a1080['id'],_0x3a1080);DashboardEvents[_0x1cd9('0x6')](_0x4393e8,_0x3a1080);_0x2d4963(null);};}for(var e in events){if(events[_0x1cd9('0x7')](e)){var event=events[e];Dashboard[_0x1cd9('0x8')](e,emitEvent(event));}}module[_0x1cd9('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8719651..9a448c6 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 _0x5deb=['../../config/environment','exports','Dashboard','lodash','util','api','request-promise'];(function(_0x2faf9b,_0x3f6780){var _0x40bdc4=function(_0x252740){while(--_0x252740){_0x2faf9b['push'](_0x2faf9b['shift']());}};_0x40bdc4(++_0x3f6780);}(_0x5deb,0x1e6));var _0xb5de=function(_0x44e577,_0x16a38d){_0x44e577=_0x44e577-0x0;var _0x2ff124=_0x5deb[_0x44e577];return _0x2ff124;};'use strict';var _=require(_0xb5de('0x0'));var util=require(_0xb5de('0x1'));var logger=require('../../config/logger')(_0xb5de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb5de('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb5de('0x4'));var attributes=require('./dashboard.attributes');module[_0xb5de('0x5')]=function(_0x5949ed,_0x151f78){return _0x5949ed['define'](_0xb5de('0x6'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1ee=['define','dashboards','lodash','util','api','moment','request-promise','rimraf','exports'];(function(_0x1a5c2a,_0x905452){var _0x4ccaca=function(_0x18fd9d){while(--_0x18fd9d){_0x1a5c2a['push'](_0x1a5c2a['shift']());}};_0x4ccaca(++_0x905452);}(_0xe1ee,0x158));var _0xee1e=function(_0x25bf94,_0x420e7e){_0x25bf94=_0x25bf94-0x0;var _0x24065b=_0xe1ee[_0x25bf94];return _0x24065b;};'use strict';var _=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var logger=require('../../config/logger')(_0xee1e('0x2'));var moment=require(_0xee1e('0x3'));var BPromise=require('bluebird');var rp=require(_0xee1e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee1e('0x5'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xee1e('0x6')]=function(_0x8995fe,_0x1f676f){return _0x8995fe[_0xee1e('0x7')]('Dashboard',attributes,{'tableName':_0xee1e('0x8'),'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 71aed46..acf0307 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 _0x381e=['jayson/promise','redis','defaults','localhost','register','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2ac890,_0xd74783){var _0x2f6065=function(_0x1c71de){while(--_0x1c71de){_0x2ac890['push'](_0x2ac890['shift']());}};_0x2f6065(++_0xd74783);}(_0x381e,0x1c5));var _0xe381=function(_0x2b222b,_0x798b1f){_0x2b222b=_0x2b222b-0x0;var _0x370dc3=_0x381e[_0x2b222b];return _0x370dc3;};'use strict';var _=require(_0xe381('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe381('0x1'));var fs=require('fs');var Redis=require(_0xe381('0x2'));var db=require(_0xe381('0x3'))['db'];var utils=require(_0xe381('0x4'));var logger=require(_0xe381('0x5'))('rpc');var config=require(_0xe381('0x6'));var jayson=require(_0xe381('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xe381('0x8')]=_[_0xe381('0x9')](config[_0xe381('0x8')],{'host':_0xe381('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe381('0x8')]));require('./dashboard.socket')[_0xe381('0xb')](socket);function respondWithRpcPromise(_0x3531cf,_0x181458,_0x389722){return new BPromise(function(_0x272532,_0x4c7d84){return client['request'](_0x3531cf,_0x389722)['then'](function(_0x1037a6){logger[_0xe381('0xc')]('Dashboard,\x20%s,\x20%s',_0x181458,_0xe381('0xd'));logger[_0xe381('0xe')](_0xe381('0xf'),_0x181458,_0xe381('0xd'),JSON[_0xe381('0x10')](_0x1037a6));if(_0x1037a6['error']){if(_0x1037a6[_0xe381('0x11')][_0xe381('0x12')]===0x1f4){logger[_0xe381('0x11')](_0xe381('0x13'),_0x181458,_0x1037a6[_0xe381('0x11')][_0xe381('0x14')]);return _0x4c7d84(_0x1037a6['error'][_0xe381('0x14')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x181458,_0x1037a6[_0xe381('0x11')][_0xe381('0x14')]);return _0x272532(_0x1037a6[_0xe381('0x11')][_0xe381('0x14')]);}else{logger[_0xe381('0xc')]('Dashboard,\x20%s,\x20%s',_0x181458,_0xe381('0xd'));_0x272532(_0x1037a6[_0xe381('0x15')][_0xe381('0x14')]);}})[_0xe381('0x16')](function(_0x37a1a5){logger['error']('Dashboard,\x20%s,\x20%s',_0x181458,_0x37a1a5);_0x4c7d84(_0x37a1a5);});});} \ No newline at end of file +var _0x0911=['message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x0911,0xe4));var _0x1091=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x0911[_0xffa198];return _0x1e4b50;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1091('0x0'));var BPromise=require(_0x1091('0x1'));var rs=require(_0x1091('0x2'));var fs=require('fs');var Redis=require(_0x1091('0x3'));var db=require(_0x1091('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1091('0x5'));var config=require(_0x1091('0x6'));var jayson=require(_0x1091('0x7'));var client=jayson['client'][_0x1091('0x8')]({'port':0x232a});config[_0x1091('0x9')]=_[_0x1091('0xa')](config['redis'],{'host':_0x1091('0xb'),'port':0x18eb});var socket=require(_0x1091('0xc'))(new Redis(config[_0x1091('0x9')]));require(_0x1091('0xd'))[_0x1091('0xe')](socket);function respondWithRpcPromise(_0x1f6964,_0x4d2e29,_0x40faa4){return new BPromise(function(_0x2fecd2,_0x7b8907){return client[_0x1091('0xf')](_0x1f6964,_0x40faa4)['then'](function(_0x9a764c){logger['info'](_0x1091('0x10'),_0x4d2e29,_0x1091('0x11'));logger[_0x1091('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4d2e29,_0x1091('0x11'),JSON[_0x1091('0x13')](_0x9a764c));if(_0x9a764c['error']){if(_0x9a764c[_0x1091('0x14')][_0x1091('0x15')]===0x1f4){logger[_0x1091('0x14')](_0x1091('0x10'),_0x4d2e29,_0x9a764c[_0x1091('0x14')][_0x1091('0x16')]);return _0x7b8907(_0x9a764c[_0x1091('0x14')]['message']);}logger[_0x1091('0x14')](_0x1091('0x10'),_0x4d2e29,_0x9a764c[_0x1091('0x14')][_0x1091('0x16')]);return _0x2fecd2(_0x9a764c[_0x1091('0x14')][_0x1091('0x16')]);}else{logger[_0x1091('0x17')](_0x1091('0x10'),_0x4d2e29,'request\x20sent');_0x2fecd2(_0x9a764c[_0x1091('0x18')][_0x1091('0x16')]);}})['catch'](function(_0x593549){logger[_0x1091('0x14')](_0x1091('0x10'),_0x4d2e29,_0x593549);_0x7b8907(_0x593549);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index d3b814f..49187de 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 _0xb269=['emit','removeListener','register','./dashboard.events','save','remove'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xb269,0x1b3));var _0x9b26=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb269[_0x5b644e];return _0x49c6bf;};'use strict';var DashboardEvents=require(_0x9b26('0x0'));var events=[_0x9b26('0x1'),_0x9b26('0x2'),'update'];function createListener(_0x2da0ae,_0x11e640){return function(_0x5e343b){_0x11e640[_0x9b26('0x3')](_0x2da0ae,_0x5e343b);};}function removeListener(_0x2d11c0,_0x235a0e){return function(){DashboardEvents[_0x9b26('0x4')](_0x2d11c0,_0x235a0e);};}exports[_0x9b26('0x5')]=function(_0x301562){for(var _0x42b192=0x0,_0x1b0926=events['length'];_0x42b192<_0x1b0926;_0x42b192++){var _0x14b838=events[_0x42b192];var _0x9408b=createListener('dashboard:'+_0x14b838,_0x301562);DashboardEvents['on'](_0x14b838,_0x9408b);}}; \ No newline at end of file +var _0x1cff=['register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x5c984e,_0xf6392b){var _0x34e681=function(_0x563121){while(--_0x563121){_0x5c984e['push'](_0x5c984e['shift']());}};_0x34e681(++_0xf6392b);}(_0x1cff,0x15a));var _0xf1cf=function(_0x3f7b7f,_0x360014){_0x3f7b7f=_0x3f7b7f-0x0;var _0x22d2c8=_0x1cff[_0x3f7b7f];return _0x22d2c8;};'use strict';var DashboardEvents=require(_0xf1cf('0x0'));var events=[_0xf1cf('0x1'),_0xf1cf('0x2'),_0xf1cf('0x3')];function createListener(_0x5276b3,_0x4432e4){return function(_0x3470e5){_0x4432e4['emit'](_0x5276b3,_0x3470e5);};}function removeListener(_0x14ea3e,_0x5d719e){return function(){DashboardEvents['removeListener'](_0x14ea3e,_0x5d719e);};}exports[_0xf1cf('0x4')]=function(_0x301ea9){for(var _0x420ceb=0x0,_0x11bbac=events[_0xf1cf('0x5')];_0x420ceb<_0x11bbac;_0x420ceb++){var _0x1b55c0=events[_0x420ceb];var _0x35f0c5=createListener(_0xf1cf('0x6')+_0x1b55c0,_0x301ea9);DashboardEvents['on'](_0x1b55c0,_0x35f0c5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 87f53a7..0e28866 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 _0x8543=['get','isAuthenticated','/:id','/:id/items','getItems','post','create','/:id/clone','clone','addItem','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0x205bf9,_0x3aec76){var _0x3f208c=function(_0x17325b){while(--_0x17325b){_0x205bf9['push'](_0x205bf9['shift']());}};_0x3f208c(++_0x3aec76);}(_0x8543,0x1f1));var _0x3854=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8543[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x3854('0x0'));var util=require('util');var path=require(_0x3854('0x1'));var timeout=require(_0x3854('0x2'));var express=require('express');var router=express[_0x3854('0x3')]();var fs_extra=require(_0x3854('0x4'));var auth=require(_0x3854('0x5'));var interaction=require(_0x3854('0x6'));var config=require(_0x3854('0x7'));var controller=require(_0x3854('0x8'));router[_0x3854('0x9')]('/',auth[_0x3854('0xa')](),controller['index']);router[_0x3854('0x9')](_0x3854('0xb'),auth[_0x3854('0xa')](),controller['show']);router[_0x3854('0x9')](_0x3854('0xc'),auth[_0x3854('0xa')](),controller[_0x3854('0xd')]);router[_0x3854('0xe')]('/',auth[_0x3854('0xa')](),controller[_0x3854('0xf')]);router[_0x3854('0xe')](_0x3854('0x10'),auth[_0x3854('0xa')](),controller[_0x3854('0x11')]);router[_0x3854('0xe')](_0x3854('0xc'),auth[_0x3854('0xa')](),controller[_0x3854('0x12')]);router['put']('/:id',auth[_0x3854('0xa')](),controller[_0x3854('0x13')]);router[_0x3854('0x14')](_0x3854('0xb'),auth[_0x3854('0xa')](),controller[_0x3854('0x15')]);module['exports']=router; \ No newline at end of file +var _0x42af=['./dashboard.controller','get','isAuthenticated','index','show','getItems','create','post','/:id/clone','clone','/:id/items','addItem','put','/:id','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x42af,0x10b));var _0xf42a=function(_0x454774,_0x290c04){_0x454774=_0x454774-0x0;var _0x3644fa=_0x42af[_0x454774];return _0x3644fa;};'use strict';var multer=require(_0xf42a('0x0'));var util=require(_0xf42a('0x1'));var path=require('path');var timeout=require(_0xf42a('0x2'));var express=require('express');var router=express[_0xf42a('0x3')]();var fs_extra=require(_0xf42a('0x4'));var auth=require(_0xf42a('0x5'));var interaction=require(_0xf42a('0x6'));var config=require(_0xf42a('0x7'));var controller=require(_0xf42a('0x8'));router[_0xf42a('0x9')]('/',auth[_0xf42a('0xa')](),controller[_0xf42a('0xb')]);router[_0xf42a('0x9')]('/:id',auth[_0xf42a('0xa')](),controller[_0xf42a('0xc')]);router[_0xf42a('0x9')]('/:id/items',auth[_0xf42a('0xa')](),controller[_0xf42a('0xd')]);router['post']('/',auth[_0xf42a('0xa')](),controller[_0xf42a('0xe')]);router[_0xf42a('0xf')](_0xf42a('0x10'),auth['isAuthenticated'](),controller[_0xf42a('0x11')]);router[_0xf42a('0xf')](_0xf42a('0x12'),auth[_0xf42a('0xa')](),controller[_0xf42a('0x13')]);router[_0xf42a('0x14')](_0xf42a('0x15'),auth[_0xf42a('0xa')](),controller[_0xf42a('0x16')]);router[_0xf42a('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xf42a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index a5919ca..2aeaaf4 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a07=['setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x2a07,0x74));var _0x72a0=function(_0x5bf609,_0x5c1e35){_0x5bf609=_0x5bf609-0x0;var _0x3c3a74=_0x2a07[_0x5bf609];return _0x3c3a74;};'use strict';var Sequelize=require(_0x72a0('0x0'));var squel=require(_0x72a0('0x1'));var _=require(_0x72a0('0x2'));module[_0x72a0('0x3')]={'title':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x72a0('0x5')](_0x72a0('0x6')),'get':function(){try{return JSON[_0x72a0('0x7')](this[_0x72a0('0x8')](_0x72a0('0x9')));}catch(_0xce74c){return[];}},'set':function(_0x3ccf6d){try{this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')](_0x3ccf6d));}catch(_0x21c819){this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x72a0('0xc')]},'background':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':_0x72a0('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x72a0('0x4')]},'titleFontSize':{'type':Sequelize[_0x72a0('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0x01d9=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));var squel=require(_0x901d('0x1'));var _=require(_0x901d('0x2'));module[_0x901d('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x901d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x6')),'get':function(){try{return JSON[_0x901d('0x7')](this[_0x901d('0x8')](_0x901d('0x9')));}catch(_0xb96b86){return[];}},'set':function(_0x4e7842){try{this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')](_0x4e7842));}catch(_0x12c39f){this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x901d('0xc')]},'col':{'type':Sequelize[_0x901d('0xc')]},'background':{'type':Sequelize[_0x901d('0x4')],'allowNull':![],'defaultValue':_0x901d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x901d('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x901d('0xc')],'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 47c501e..03a8b5f 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 _0x8819=['end','error','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','register','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','destroy','then'];(function(_0x2803ab,_0x1c33f2){var _0x3d6e8e=function(_0x8a86f1){while(--_0x8a86f1){_0x2803ab['push'](_0x2803ab['shift']());}};_0x3d6e8e(++_0x1c33f2);}(_0x8819,0x94));var _0x9881=function(_0x1592d9,_0xf9901d){_0x1592d9=_0x1592d9-0x0;var _0x524738=_0x8819[_0x1592d9];return _0x524738;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9881('0x0'));var jsonpatch=require(_0x9881('0x1'));var rp=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var Mustache=require('mustache');var util=require(_0x9881('0x5'));var path=require(_0x9881('0x6'));var sox=require(_0x9881('0x7'));var csv=require(_0x9881('0x8'));var ejs=require(_0x9881('0x9'));var fs=require('fs');var fs_extra=require(_0x9881('0xa'));var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var as=require(_0x9881('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9881('0x11'))(_0x9881('0x12'));var utils=require(_0x9881('0x13'));var config=require(_0x9881('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9881('0x15'))['db'];config[_0x9881('0x16')]=_['defaults'](config[_0x9881('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x9881('0x17')](socket);function respondWithStatusCode(_0x3178d7,_0x39f5fb){_0x39f5fb=_0x39f5fb||0xcc;return function(_0x1947e8){if(_0x1947e8){return _0x3178d7[_0x9881('0x18')](_0x39f5fb);}return _0x3178d7[_0x9881('0x19')](_0x39f5fb)['end']();};}function respondWithResult(_0x411513,_0x14b5a9){_0x14b5a9=_0x14b5a9||0xc8;return function(_0xcc4b6d){if(_0xcc4b6d){return _0x411513['status'](_0x14b5a9)['json'](_0xcc4b6d);}};}function respondWithFilteredResult(_0x4c92c9,_0x280ea2){return function(_0x4c3493){if(_0x4c3493){var _0x620a9a=typeof _0x280ea2['offset']==='undefined'&&typeof _0x280ea2[_0x9881('0x1a')]===_0x9881('0x1b');var _0x1cbac3=_0x4c3493[_0x9881('0x1c')];var _0x43f8a2=_0x620a9a?0x0:_0x280ea2[_0x9881('0x1d')];var _0x3ae21d=_0x620a9a?_0x4c3493[_0x9881('0x1c')]:_0x280ea2[_0x9881('0x1d')]+_0x280ea2[_0x9881('0x1a')];var _0x32ca84;if(_0x3ae21d>=_0x1cbac3){_0x3ae21d=_0x1cbac3;_0x32ca84=0xc8;}else{_0x32ca84=0xce;}_0x4c92c9[_0x9881('0x19')](_0x32ca84);return _0x4c92c9[_0x9881('0x1e')](_0x9881('0x1f'),_0x43f8a2+'-'+_0x3ae21d+'/'+_0x1cbac3)[_0x9881('0x20')](_0x4c3493);}return null;};}function patchUpdates(_0x58485d){return function(_0x493032){try{jsonpatch[_0x9881('0x21')](_0x493032,_0x58485d,!![]);}catch(_0x513545){return BPromise['reject'](_0x513545);}return _0x493032[_0x9881('0x22')]();};}function saveUpdates(_0x30ed15,_0x55119c){return function(_0x501343){if(_0x501343){return _0x501343[_0x9881('0x23')](_0x30ed15)['then'](function(_0x2bddc1){return _0x2bddc1;});}return null;};}function removeEntity(_0x161f8d,_0x16eeca){return function(_0x418263){if(_0x418263){return _0x418263[_0x9881('0x24')]()[_0x9881('0x25')](function(){_0x161f8d[_0x9881('0x19')](0xcc)[_0x9881('0x26')]();});}};}function handleEntityNotFound(_0xc328b7,_0x23727b){return function(_0x900eae){if(!_0x900eae){_0xc328b7[_0x9881('0x18')](0x194);}return _0x900eae;};}function handleError(_0x1f8fdd,_0x4cd4b5){_0x4cd4b5=_0x4cd4b5||0x1f4;return function(_0x31956e){logger[_0x9881('0x27')](_0x31956e['stack']);if(_0x31956e[_0x9881('0x28')]){delete _0x31956e[_0x9881('0x28')];}_0x1f8fdd['status'](_0x4cd4b5)[_0x9881('0x29')](_0x31956e);};}exports[_0x9881('0x2a')]=function(_0x217a1c,_0x204f2b){var _0x3567dc={'raw':![],'where':{'id':_0x217a1c[_0x9881('0x2b')]['id']}},_0x383ff0={};_0x383ff0[_0x9881('0x2c')]=_['keys'](db[_0x9881('0x2d')][_0x9881('0x2e')]);_0x383ff0[_0x9881('0x2f')]=_[_0x9881('0x30')](_0x217a1c[_0x9881('0x2f')]);_0x383ff0[_0x9881('0x31')]=_['intersection'](_0x383ff0[_0x9881('0x2c')],_0x383ff0[_0x9881('0x2f')]);_0x3567dc['attributes']=_[_0x9881('0x32')](_0x383ff0[_0x9881('0x2c')],qs[_0x9881('0x33')](_0x217a1c[_0x9881('0x2f')][_0x9881('0x33')]));_0x3567dc['attributes']=_0x3567dc[_0x9881('0x34')][_0x9881('0x35')]?_0x3567dc[_0x9881('0x34')]:_0x383ff0[_0x9881('0x2c')];if(_0x217a1c[_0x9881('0x2f')][_0x9881('0x36')]){_0x3567dc[_0x9881('0x37')]=[{'all':!![]}];}_0x3567dc=_[_0x9881('0x38')]({},_0x3567dc,_0x217a1c[_0x9881('0x39')]);return db[_0x9881('0x2d')][_0x9881('0x3a')](_0x3567dc)[_0x9881('0x25')](handleEntityNotFound(_0x204f2b,null))[_0x9881('0x25')](respondWithResult(_0x204f2b,null))[_0x9881('0x3b')](handleError(_0x204f2b,null));};exports[_0x9881('0x24')]=function(_0x32aac8,_0x5d902d){return db[_0x9881('0x2d')]['find']({'where':{'id':_0x32aac8[_0x9881('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d902d,null))[_0x9881('0x25')](removeEntity(_0x5d902d,null))[_0x9881('0x3b')](handleError(_0x5d902d,null));};function widgetAttributes(_0x4c865e){try{switch(_0x4c865e[_0x9881('0x3c')]){case'iframe':return[{'name':_0x9881('0x3d'),'value':_0x4c865e[_0x9881('0x3d')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x0]?_0x4c865e['attrs'][0x0][_0x9881('0x3f')]:undefined)||_0x9881('0x40')}];case _0x9881('0x41'):return[{'name':_0x9881('0x42'),'value':_0x4c865e[_0x9881('0x42')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x0]?_0x4c865e['attrs'][0x0][_0x9881('0x3f')]:undefined)||''}];case'clock':return[{'name':_0x9881('0x43'),'value':_0x4c865e[_0x9881('0x43')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e['attrs'][0x0]?_0x4c865e[_0x9881('0x3e')][0x0][_0x9881('0x3f')]:undefined)||_0x9881('0x44')},{'name':'attrTimezone','value':_0x4c865e[_0x9881('0x45')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e['attrs'][0x1]?_0x4c865e[_0x9881('0x3e')][0x1][_0x9881('0x3f')]:undefined)||_0x9881('0x46')},{'name':_0x9881('0x47'),'value':_0x4c865e[_0x9881('0x47')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x2]?_0x4c865e[_0x9881('0x3e')][0x2][_0x9881('0x3f')]:undefined)||0xc}];case _0x9881('0x48'):return[{'name':'attrMetric','value':_0x4c865e[_0x9881('0x49')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x0]?_0x4c865e[_0x9881('0x3e')][0x0][_0x9881('0x3f')]:undefined)||'total'},{'name':_0x9881('0x4a'),'value':_0x4c865e[_0x9881('0x4a')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x1]?_0x4c865e['attrs'][0x1][_0x9881('0x3f')]:undefined)||[]},{'name':_0x9881('0x47'),'value':_0x4c865e[_0x9881('0x47')]||(_0x4c865e['attrs']&&_0x4c865e[_0x9881('0x3e')][0x2]?_0x4c865e[_0x9881('0x3e')][0x2][_0x9881('0x3f')]:undefined)||0x14},{'name':_0x9881('0x4b'),'value':_0x4c865e[_0x9881('0x4b')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x3]?_0x4c865e[_0x9881('0x3e')][0x3][_0x9881('0x3f')]:undefined)||_0x9881('0x4c')},{'name':'attrEmailAccounts','value':_0x4c865e[_0x9881('0x4d')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x4]?_0x4c865e['attrs'][0x4][_0x9881('0x3f')]:undefined)||''},{'name':_0x9881('0x4e'),'value':_0x4c865e[_0x9881('0x4e')]||(_0x4c865e['attrs']&&_0x4c865e['attrs'][0x5]?_0x4c865e[_0x9881('0x3e')][0x5][_0x9881('0x3f')]:undefined)||''},{'name':_0x9881('0x4f'),'value':_0x4c865e[_0x9881('0x4f')]||(_0x4c865e['attrs']&&_0x4c865e['attrs'][0x6]?_0x4c865e[_0x9881('0x3e')][0x6][_0x9881('0x3f')]:undefined)||''},{'name':_0x9881('0x50'),'value':_0x4c865e['attrOpenchannelAccounts']||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x7]?_0x4c865e['attrs'][0x7][_0x9881('0x3f')]:undefined)||''},{'name':_0x9881('0x51'),'value':_0x4c865e[_0x9881('0x51')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x8]?_0x4c865e[_0x9881('0x3e')][0x8][_0x9881('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4c865e[_0x9881('0x52')]||(_0x4c865e['attrs']&&_0x4c865e[_0x9881('0x3e')][0x9]?_0x4c865e[_0x9881('0x3e')][0x9][_0x9881('0x3f')]:undefined)||''}];case _0x9881('0x53'):case'pie-chart':return[{'name':'attrSerie1','value':_0x4c865e[_0x9881('0x54')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x0]?_0x4c865e['attrs'][0x0][_0x9881('0x3f')]:undefined)||_0x9881('0x55')},{'name':_0x9881('0x56'),'value':_0x4c865e[_0x9881('0x56')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x1]?_0x4c865e['attrs'][0x1][_0x9881('0x3f')]:undefined)||null},{'name':_0x9881('0x57'),'value':_0x4c865e[_0x9881('0x57')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x2]?_0x4c865e['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x4c865e[_0x9881('0x4a')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x3]?_0x4c865e[_0x9881('0x3e')][0x3][_0x9881('0x3f')]:undefined)||[]},{'name':_0x9881('0x4b'),'value':_0x4c865e['attrChannel']||(_0x4c865e['attrs']&&_0x4c865e[_0x9881('0x3e')][0x4]?_0x4c865e[_0x9881('0x3e')][0x4]['value']:undefined)||_0x9881('0x4c')},{'name':_0x9881('0x4d'),'value':_0x4c865e[_0x9881('0x4d')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e['attrs'][0x5]?_0x4c865e[_0x9881('0x3e')][0x5]['value']:undefined)||''},{'name':_0x9881('0x4e'),'value':_0x4c865e[_0x9881('0x4e')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e['attrs'][0x6]?_0x4c865e['attrs'][0x6]['value']:undefined)||''},{'name':_0x9881('0x4f'),'value':_0x4c865e[_0x9881('0x4f')]||(_0x4c865e['attrs']&&_0x4c865e[_0x9881('0x3e')][0x7]?_0x4c865e[_0x9881('0x3e')][0x7][_0x9881('0x3f')]:undefined)||''},{'name':_0x9881('0x50'),'value':_0x4c865e[_0x9881('0x50')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x8]?_0x4c865e[_0x9881('0x3e')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4c865e[_0x9881('0x51')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x9]?_0x4c865e[_0x9881('0x3e')][0x9][_0x9881('0x3f')]:undefined)||''},{'name':_0x9881('0x52'),'value':_0x4c865e['attrChatWebsites']||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0xa]?_0x4c865e[_0x9881('0x3e')][0xa][_0x9881('0x3f')]:undefined)||''}];case'web-report':return[{'name':_0x9881('0x58'),'type':_0x4c865e['reportType']||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e[_0x9881('0x3e')][0x0]?_0x4c865e[_0x9881('0x3e')][0x0][_0x9881('0x3c')]:undefined)||null,'value':_0x4c865e['attrReport']||(_0x4c865e['attrs']&&_0x4c865e[_0x9881('0x3e')][0x0]?_0x4c865e['attrs'][0x0]['value']:undefined)||null},{'name':_0x9881('0x59'),'value':_0x4c865e[_0x9881('0x59')]||(_0x4c865e[_0x9881('0x3e')]&&_0x4c865e['attrs'][0x1]?_0x4c865e[_0x9881('0x3e')][0x1][_0x9881('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x51d605){logger[_0x9881('0x27')](_0x9881('0x5a'),JSON['stringify'](_0x51d605));return[];}}exports[_0x9881('0x5b')]=function(_0x5d2649,_0x410b54){if(_0x5d2649[_0x9881('0x5c')]){_0x5d2649[_0x9881('0x5c')][_0x9881('0x3e')]=widgetAttributes(_0x5d2649[_0x9881('0x5c')]);}return db[_0x9881('0x2d')]['create'](_0x5d2649[_0x9881('0x5c')],{})[_0x9881('0x25')](respondWithResult(_0x410b54,0xc9))[_0x9881('0x3b')](handleError(_0x410b54,null));};exports[_0x9881('0x23')]=function(_0x1a988e,_0x38a52c){if(_0x1a988e[_0x9881('0x5c')]['id']){delete _0x1a988e[_0x9881('0x5c')]['id'];}_0x1a988e[_0x9881('0x5c')][_0x9881('0x3e')]=widgetAttributes(_0x1a988e[_0x9881('0x5c')]);return db['DashboardItem'][_0x9881('0x3a')]({'where':{'id':_0x1a988e[_0x9881('0x2b')]['id']}})['then'](handleEntityNotFound(_0x38a52c,null))[_0x9881('0x25')](saveUpdates(_0x1a988e[_0x9881('0x5c')],null))['then'](respondWithResult(_0x38a52c,null))[_0x9881('0x3b')](handleError(_0x38a52c,null));}; \ No newline at end of file +var _0x8d0a=['attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','length','include','merge','options','find','catch','params','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType'];(function(_0x564019,_0x55bca5){var _0x2fafa3=function(_0x300eda){while(--_0x300eda){_0x564019['push'](_0x564019['shift']());}};_0x2fafa3(++_0x55bca5);}(_0x8d0a,0x65));var _0xa8d0=function(_0x1e7024,_0x4d656d){_0x1e7024=_0x1e7024-0x0;var _0x41fe19=_0x8d0a[_0x1e7024];return _0x41fe19;};'use strict';var emlformat=require(_0xa8d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa8d0('0x1'));var jsonpatch=require(_0xa8d0('0x2'));var rp=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var BPromise=require(_0xa8d0('0x5'));var Mustache=require(_0xa8d0('0x6'));var util=require(_0xa8d0('0x7'));var path=require(_0xa8d0('0x8'));var sox=require(_0xa8d0('0x9'));var csv=require('to-csv');var ejs=require(_0xa8d0('0xa'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xb'));var _=require(_0xa8d0('0xc'));var squel=require(_0xa8d0('0xd'));var crypto=require(_0xa8d0('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa8d0('0xf'));var querystring=require(_0xa8d0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa8d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8d0('0x12'));var logger=require(_0xa8d0('0x13'))(_0xa8d0('0x14'));var utils=require(_0xa8d0('0x15'));var config=require(_0xa8d0('0x16'));var licenseUtil=require(_0xa8d0('0x17'));var db=require(_0xa8d0('0x18'))['db'];config[_0xa8d0('0x19')]=_[_0xa8d0('0x1a')](config[_0xa8d0('0x19')],{'host':_0xa8d0('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8d0('0x19')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x32ea3e,_0x2816d1){_0x2816d1=_0x2816d1||0xcc;return function(_0x523ec0){if(_0x523ec0){return _0x32ea3e[_0xa8d0('0x1c')](_0x2816d1);}return _0x32ea3e[_0xa8d0('0x1d')](_0x2816d1)[_0xa8d0('0x1e')]();};}function respondWithResult(_0x44a48e,_0x10ec3c){_0x10ec3c=_0x10ec3c||0xc8;return function(_0x3a5fe3){if(_0x3a5fe3){return _0x44a48e['status'](_0x10ec3c)[_0xa8d0('0x1f')](_0x3a5fe3);}};}function respondWithFilteredResult(_0x470b4a,_0x5cf619){return function(_0x2f0b00){if(_0x2f0b00){var _0x1e325a=typeof _0x5cf619['offset']===_0xa8d0('0x20')&&typeof _0x5cf619[_0xa8d0('0x21')]==='undefined';var _0x582a54=_0x2f0b00[_0xa8d0('0x22')];var _0x25ed8d=_0x1e325a?0x0:_0x5cf619['offset'];var _0x38d600=_0x1e325a?_0x2f0b00[_0xa8d0('0x22')]:_0x5cf619[_0xa8d0('0x23')]+_0x5cf619['limit'];var _0x36891d;if(_0x38d600>=_0x582a54){_0x38d600=_0x582a54;_0x36891d=0xc8;}else{_0x36891d=0xce;}_0x470b4a['status'](_0x36891d);return _0x470b4a[_0xa8d0('0x24')](_0xa8d0('0x25'),_0x25ed8d+'-'+_0x38d600+'/'+_0x582a54)[_0xa8d0('0x1f')](_0x2f0b00);}return null;};}function patchUpdates(_0x27c798){return function(_0x92d065){try{jsonpatch[_0xa8d0('0x26')](_0x92d065,_0x27c798,!![]);}catch(_0x41667d){return BPromise['reject'](_0x41667d);}return _0x92d065['save']();};}function saveUpdates(_0x265dce,_0x486422){return function(_0x3ec672){if(_0x3ec672){return _0x3ec672[_0xa8d0('0x27')](_0x265dce)[_0xa8d0('0x28')](function(_0x1ddb63){return _0x1ddb63;});}return null;};}function removeEntity(_0x17bdfc,_0x5b9560){return function(_0x3eab24){if(_0x3eab24){return _0x3eab24[_0xa8d0('0x29')]()[_0xa8d0('0x28')](function(){_0x17bdfc[_0xa8d0('0x1d')](0xcc)[_0xa8d0('0x1e')]();});}};}function handleEntityNotFound(_0x1adc0d,_0x80390d){return function(_0x28ba73){if(!_0x28ba73){_0x1adc0d['sendStatus'](0x194);}return _0x28ba73;};}function handleError(_0x195dae,_0xc7761d){_0xc7761d=_0xc7761d||0x1f4;return function(_0xd7943a){logger[_0xa8d0('0x2a')](_0xd7943a[_0xa8d0('0x2b')]);if(_0xd7943a[_0xa8d0('0x2c')]){delete _0xd7943a['name'];}_0x195dae[_0xa8d0('0x1d')](_0xc7761d)[_0xa8d0('0x2d')](_0xd7943a);};}exports[_0xa8d0('0x2e')]=function(_0x78777c,_0x4c46fc){var _0x2d3725={'raw':![],'where':{'id':_0x78777c['params']['id']}},_0x385e05={};_0x385e05['model']=_[_0xa8d0('0x2f')](db[_0xa8d0('0x30')][_0xa8d0('0x31')]);_0x385e05[_0xa8d0('0x32')]=_[_0xa8d0('0x2f')](_0x78777c[_0xa8d0('0x32')]);_0x385e05[_0xa8d0('0x33')]=_[_0xa8d0('0x34')](_0x385e05[_0xa8d0('0x35')],_0x385e05[_0xa8d0('0x32')]);_0x2d3725[_0xa8d0('0x36')]=_[_0xa8d0('0x34')](_0x385e05['model'],qs['fields'](_0x78777c[_0xa8d0('0x32')]['fields']));_0x2d3725[_0xa8d0('0x36')]=_0x2d3725[_0xa8d0('0x36')][_0xa8d0('0x37')]?_0x2d3725[_0xa8d0('0x36')]:_0x385e05[_0xa8d0('0x35')];if(_0x78777c['query']['includeAll']){_0x2d3725[_0xa8d0('0x38')]=[{'all':!![]}];}_0x2d3725=_[_0xa8d0('0x39')]({},_0x2d3725,_0x78777c[_0xa8d0('0x3a')]);return db[_0xa8d0('0x30')][_0xa8d0('0x3b')](_0x2d3725)[_0xa8d0('0x28')](handleEntityNotFound(_0x4c46fc,null))['then'](respondWithResult(_0x4c46fc,null))[_0xa8d0('0x3c')](handleError(_0x4c46fc,null));};exports[_0xa8d0('0x29')]=function(_0x41fc4e,_0x4d175c){return db[_0xa8d0('0x30')][_0xa8d0('0x3b')]({'where':{'id':_0x41fc4e[_0xa8d0('0x3d')]['id']}})[_0xa8d0('0x28')](handleEntityNotFound(_0x4d175c,null))[_0xa8d0('0x28')](removeEntity(_0x4d175c,null))[_0xa8d0('0x3c')](handleError(_0x4d175c,null));};function widgetAttributes(_0x27515e){try{switch(_0x27515e['type']){case _0xa8d0('0x3e'):return[{'name':_0xa8d0('0x3f'),'value':_0x27515e[_0xa8d0('0x3f')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0]['value']:undefined)||_0xa8d0('0x41')}];case _0xa8d0('0x42'):return[{'name':_0xa8d0('0x43'),'value':_0x27515e[_0xa8d0('0x43')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||''}];case'clock':return[{'name':_0xa8d0('0x45'),'value':_0x27515e['attrHourFormat']||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||_0xa8d0('0x46')},{'name':_0xa8d0('0x47'),'value':_0x27515e[_0xa8d0('0x47')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x1]?_0x27515e[_0xa8d0('0x40')][0x1][_0xa8d0('0x44')]:undefined)||_0xa8d0('0x48')},{'name':'attrFontSize','value':_0x27515e[_0xa8d0('0x49')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x2]?_0x27515e[_0xa8d0('0x40')][0x2][_0xa8d0('0x44')]:undefined)||0xc}];case _0xa8d0('0x4a'):return[{'name':'attrMetric','value':_0x27515e[_0xa8d0('0x4b')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||_0xa8d0('0x4c')},{'name':_0xa8d0('0x4d'),'value':_0x27515e[_0xa8d0('0x4d')]||(_0x27515e['attrs']&&_0x27515e[_0xa8d0('0x40')][0x1]?_0x27515e['attrs'][0x1][_0xa8d0('0x44')]:undefined)||[]},{'name':_0xa8d0('0x49'),'value':_0x27515e[_0xa8d0('0x49')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x2]?_0x27515e[_0xa8d0('0x40')][0x2][_0xa8d0('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x27515e[_0xa8d0('0x4e')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x3]?_0x27515e['attrs'][0x3]['value']:undefined)||_0xa8d0('0x4f')},{'name':_0xa8d0('0x50'),'value':_0x27515e[_0xa8d0('0x50')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x4]?_0x27515e[_0xa8d0('0x40')][0x4][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x51'),'value':_0x27515e[_0xa8d0('0x51')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x5]?_0x27515e[_0xa8d0('0x40')][0x5]['value']:undefined)||''},{'name':_0xa8d0('0x52'),'value':_0x27515e[_0xa8d0('0x52')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x6]?_0x27515e[_0xa8d0('0x40')][0x6][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x53'),'value':_0x27515e[_0xa8d0('0x53')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x7]?_0x27515e[_0xa8d0('0x40')][0x7][_0xa8d0('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x27515e[_0xa8d0('0x54')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x8]?_0x27515e[_0xa8d0('0x40')][0x8][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x55'),'value':_0x27515e[_0xa8d0('0x55')]||(_0x27515e['attrs']&&_0x27515e[_0xa8d0('0x40')][0x9]?_0x27515e['attrs'][0x9]['value']:undefined)||''}];case _0xa8d0('0x56'):case _0xa8d0('0x57'):return[{'name':'attrSerie1','value':_0x27515e[_0xa8d0('0x58')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||'total'},{'name':_0xa8d0('0x59'),'value':_0x27515e[_0xa8d0('0x59')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x1]?_0x27515e[_0xa8d0('0x40')][0x1][_0xa8d0('0x44')]:undefined)||null},{'name':'attrSerie3','value':_0x27515e[_0xa8d0('0x5a')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x2]?_0x27515e['attrs'][0x2][_0xa8d0('0x44')]:undefined)||null},{'name':_0xa8d0('0x4d'),'value':_0x27515e[_0xa8d0('0x4d')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x3]?_0x27515e[_0xa8d0('0x40')][0x3][_0xa8d0('0x44')]:undefined)||[]},{'name':_0xa8d0('0x4e'),'value':_0x27515e[_0xa8d0('0x4e')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x4]?_0x27515e[_0xa8d0('0x40')][0x4][_0xa8d0('0x44')]:undefined)||'voice'},{'name':_0xa8d0('0x50'),'value':_0x27515e['attrEmailAccounts']||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x5]?_0x27515e['attrs'][0x5][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x51'),'value':_0x27515e[_0xa8d0('0x51')]||(_0x27515e['attrs']&&_0x27515e['attrs'][0x6]?_0x27515e[_0xa8d0('0x40')][0x6][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x52'),'value':_0x27515e['attrSmsAccounts']||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x7]?_0x27515e[_0xa8d0('0x40')][0x7][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x53'),'value':_0x27515e[_0xa8d0('0x53')]||(_0x27515e['attrs']&&_0x27515e[_0xa8d0('0x40')][0x8]?_0x27515e[_0xa8d0('0x40')][0x8][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x54'),'value':_0x27515e[_0xa8d0('0x54')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x9]?_0x27515e[_0xa8d0('0x40')][0x9][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x55'),'value':_0x27515e['attrChatWebsites']||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0xa]?_0x27515e['attrs'][0xa][_0xa8d0('0x44')]:undefined)||''}];case'web-report':return[{'name':_0xa8d0('0x5b'),'type':_0x27515e[_0xa8d0('0x5c')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e['attrs'][0x0]['type']:undefined)||null,'value':_0x27515e[_0xa8d0('0x5b')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||null},{'name':_0xa8d0('0x5d'),'value':_0x27515e[_0xa8d0('0x5d')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x1]?_0x27515e['attrs'][0x1][_0xa8d0('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x995725){logger[_0xa8d0('0x2a')](_0xa8d0('0x5e'),JSON['stringify'](_0x995725));return[];}}exports[_0xa8d0('0x5f')]=function(_0xf40c7a,_0x25bf63){if(_0xf40c7a[_0xa8d0('0x60')]){_0xf40c7a['body'][_0xa8d0('0x40')]=widgetAttributes(_0xf40c7a[_0xa8d0('0x60')]);}return db[_0xa8d0('0x30')]['create'](_0xf40c7a[_0xa8d0('0x60')],{})[_0xa8d0('0x28')](respondWithResult(_0x25bf63,0xc9))[_0xa8d0('0x3c')](handleError(_0x25bf63,null));};exports[_0xa8d0('0x27')]=function(_0x25d600,_0x54f15d){if(_0x25d600[_0xa8d0('0x60')]['id']){delete _0x25d600[_0xa8d0('0x60')]['id'];}_0x25d600['body'][_0xa8d0('0x40')]=widgetAttributes(_0x25d600[_0xa8d0('0x60')]);return db[_0xa8d0('0x30')][_0xa8d0('0x3b')]({'where':{'id':_0x25d600[_0xa8d0('0x3d')]['id']}})[_0xa8d0('0x28')](handleEntityNotFound(_0x54f15d,null))[_0xa8d0('0x28')](saveUpdates(_0x25d600['body'],null))[_0xa8d0('0x28')](respondWithResult(_0x54f15d,null))[_0xa8d0('0x3c')](handleError(_0x54f15d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f175bea..a8d1e64 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 _0x853d=['exports','events','../../mysqldb','DashboardItem','save','update','emit','hasOwnProperty','hook'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x853d,0x1b1));var _0xd853=function(_0x21e0af,_0x176e49){_0x21e0af=_0x21e0af-0x0;var _0x57d906=_0x853d[_0x21e0af];return _0x57d906;};'use strict';var EventEmitter=require(_0xd853('0x0'));var DashboardItem=require(_0xd853('0x1'))['db'][_0xd853('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd853('0x3'),'afterUpdate':_0xd853('0x4'),'afterDestroy':'remove'};function emitEvent(_0x157f80){return function(_0x41f112,_0x12c348,_0x9be1ba){DashboardItemEvents[_0xd853('0x5')](_0x157f80+':'+_0x41f112['id'],_0x41f112);DashboardItemEvents[_0xd853('0x5')](_0x157f80,_0x41f112);_0x9be1ba(null);};}for(var e in events){if(events[_0xd853('0x6')](e)){var event=events[e];DashboardItem[_0xd853('0x7')](e,emitEvent(event));}}module[_0xd853('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x51f9=['setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x1e8dd5,_0x571f6d){var _0x9aa844=function(_0x21dee6){while(--_0x21dee6){_0x1e8dd5['push'](_0x1e8dd5['shift']());}};_0x9aa844(++_0x571f6d);}(_0x51f9,0x1eb));var _0x951f=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0x51f9[_0x427352];return _0x23e0e6;};'use strict';var EventEmitter=require(_0x951f('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x951f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x951f('0x2')};function emitEvent(_0x3a8340){return function(_0x57efe5,_0x59a9f1,_0x4644ac){DashboardItemEvents[_0x951f('0x3')](_0x3a8340+':'+_0x57efe5['id'],_0x57efe5);DashboardItemEvents[_0x951f('0x3')](_0x3a8340,_0x57efe5);_0x4644ac(null);};}for(var e in events){if(events[_0x951f('0x4')](e)){var event=events[e];DashboardItem[_0x951f('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 9927849..d626b71 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 _0xb66c=['dashboard_items','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0xcf9848,_0x497aaf){var _0x1572c7=function(_0x4ee9bc){while(--_0x4ee9bc){_0xcf9848['push'](_0xcf9848['shift']());}};_0x1572c7(++_0x497aaf);}(_0xb66c,0x175));var _0xcb66=function(_0x41d762,_0x49cf8c){_0x41d762=_0x41d762-0x0;var _0x1cafa9=_0xb66c[_0x41d762];return _0x1cafa9;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce56=['define','DashboardItem','lodash','util','../../config/logger','api','bluebird','../../config/environment','exports'];(function(_0x46cad2,_0x1c7c6a){var _0x439d41=function(_0x5d4abb){while(--_0x5d4abb){_0x46cad2['push'](_0x46cad2['shift']());}};_0x439d41(++_0x1c7c6a);}(_0xce56,0x173));var _0x6ce5=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xce56[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x6ce5('0x0'));var util=require(_0x6ce5('0x1'));var logger=require(_0x6ce5('0x2'))(_0x6ce5('0x3'));var moment=require('moment');var BPromise=require(_0x6ce5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6ce5('0x5'));var attributes=require('./dashboardItem.attributes');module[_0x6ce5('0x6')]=function(_0x2ebd64,_0x4f1fbd){return _0x2ebd64[_0x6ce5('0x7')](_0x6ce5('0x8'),attributes,{'tableName':'dashboard_items','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 015fb78..b564e87 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 _0x4d93=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2eaa15,_0x58305b){var _0x373ac3=function(_0xf411c1){while(--_0xf411c1){_0x2eaa15['push'](_0x2eaa15['shift']());}};_0x373ac3(++_0x58305b);}(_0x4d93,0x17a));var _0x34d9=function(_0x3f88dc,_0x590ca5){_0x3f88dc=_0x3f88dc-0x0;var _0x291f74=_0x4d93[_0x3f88dc];return _0x291f74;};'use strict';var _=require('lodash');var util=require(_0x34d9('0x0'));var moment=require(_0x34d9('0x1'));var BPromise=require(_0x34d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34d9('0x3'));var db=require(_0x34d9('0x4'))['db'];var utils=require(_0x34d9('0x5'));var logger=require('../../config/logger')(_0x34d9('0x6'));var config=require(_0x34d9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34d9('0x8')][_0x34d9('0x9')]({'port':0x232a});config[_0x34d9('0xa')]=_[_0x34d9('0xb')](config[_0x34d9('0xa')],{'host':_0x34d9('0xc'),'port':0x18eb});var socket=require(_0x34d9('0xd'))(new Redis(config[_0x34d9('0xa')]));require(_0x34d9('0xe'))[_0x34d9('0xf')](socket);function respondWithRpcPromise(_0x3ebf24,_0x2b86af,_0x1abe8e){return new BPromise(function(_0x348ca4,_0x598bd9){return client['request'](_0x3ebf24,_0x1abe8e)['then'](function(_0x55e468){logger[_0x34d9('0x10')](_0x34d9('0x11'),_0x2b86af,'request\x20sent');logger[_0x34d9('0x12')](_0x34d9('0x13'),_0x2b86af,_0x34d9('0x14'),JSON[_0x34d9('0x15')](_0x55e468));if(_0x55e468[_0x34d9('0x16')]){if(_0x55e468['error'][_0x34d9('0x17')]===0x1f4){logger[_0x34d9('0x16')](_0x34d9('0x11'),_0x2b86af,_0x55e468[_0x34d9('0x16')][_0x34d9('0x18')]);return _0x598bd9(_0x55e468[_0x34d9('0x16')]['message']);}logger[_0x34d9('0x16')](_0x34d9('0x11'),_0x2b86af,_0x55e468[_0x34d9('0x16')][_0x34d9('0x18')]);return _0x348ca4(_0x55e468[_0x34d9('0x16')]['message']);}else{logger['info'](_0x34d9('0x11'),_0x2b86af,_0x34d9('0x14'));_0x348ca4(_0x55e468[_0x34d9('0x19')]['message']);}})[_0x34d9('0x1a')](function(_0x4744dd){logger[_0x34d9('0x16')](_0x34d9('0x11'),_0x2b86af,_0x4744dd);_0x598bd9(_0x4744dd);});});} \ No newline at end of file +var _0xdfb7=['redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1bb0b8,_0x24add2){var _0x22fc67=function(_0x2e051d){while(--_0x2e051d){_0x1bb0b8['push'](_0x1bb0b8['shift']());}};_0x22fc67(++_0x24add2);}(_0xdfb7,0xad));var _0x7dfb=function(_0x8e658,_0xceec26){_0x8e658=_0x8e658-0x0;var _0x391dea=_0xdfb7[_0x8e658];return _0x391dea;};'use strict';var _=require('lodash');var util=require(_0x7dfb('0x0'));var moment=require(_0x7dfb('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dfb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7dfb('0x3'));var logger=require(_0x7dfb('0x4'))(_0x7dfb('0x5'));var config=require(_0x7dfb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7dfb('0x7')][_0x7dfb('0x8')]({'port':0x232a});config[_0x7dfb('0x9')]=_[_0x7dfb('0xa')](config[_0x7dfb('0x9')],{'host':_0x7dfb('0xb'),'port':0x18eb});var socket=require(_0x7dfb('0xc'))(new Redis(config['redis']));require(_0x7dfb('0xd'))['register'](socket);function respondWithRpcPromise(_0x3cbbc8,_0x33aa95,_0x211948){return new BPromise(function(_0x30bdcc,_0x44486a){return client[_0x7dfb('0xe')](_0x3cbbc8,_0x211948)[_0x7dfb('0xf')](function(_0x1e326f){logger[_0x7dfb('0x10')](_0x7dfb('0x11'),_0x33aa95,_0x7dfb('0x12'));logger[_0x7dfb('0x13')](_0x7dfb('0x14'),_0x33aa95,_0x7dfb('0x12'),JSON[_0x7dfb('0x15')](_0x1e326f));if(_0x1e326f[_0x7dfb('0x16')]){if(_0x1e326f[_0x7dfb('0x16')][_0x7dfb('0x17')]===0x1f4){logger[_0x7dfb('0x16')](_0x7dfb('0x11'),_0x33aa95,_0x1e326f[_0x7dfb('0x16')]['message']);return _0x44486a(_0x1e326f['error'][_0x7dfb('0x18')]);}logger[_0x7dfb('0x16')](_0x7dfb('0x11'),_0x33aa95,_0x1e326f[_0x7dfb('0x16')][_0x7dfb('0x18')]);return _0x30bdcc(_0x1e326f['error']['message']);}else{logger[_0x7dfb('0x10')](_0x7dfb('0x11'),_0x33aa95,_0x7dfb('0x12'));_0x30bdcc(_0x1e326f['result']['message']);}})[_0x7dfb('0x19')](function(_0x436ed3){logger[_0x7dfb('0x16')]('DashboardItem,\x20%s,\x20%s',_0x33aa95,_0x436ed3);_0x44486a(_0x436ed3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 716ad27..e6cab90 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 _0xa8d4=['emit','removeListener','length','dashboardItem:','save','remove','update'];(function(_0x141cf9,_0x3ef2c3){var _0x1279a3=function(_0x5d862f){while(--_0x5d862f){_0x141cf9['push'](_0x141cf9['shift']());}};_0x1279a3(++_0x3ef2c3);}(_0xa8d4,0xdd));var _0x4a8d=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0xa8d4[_0x412c8f];return _0x27c005;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x4a8d('0x0'),_0x4a8d('0x1'),_0x4a8d('0x2')];function createListener(_0x345637,_0x181263){return function(_0x5f4ef4){_0x181263[_0x4a8d('0x3')](_0x345637,_0x5f4ef4);};}function removeListener(_0x2919ab,_0x251a5b){return function(){DashboardItemEvents[_0x4a8d('0x4')](_0x2919ab,_0x251a5b);};}exports['register']=function(_0x3b1dd5){for(var _0x4b7ac5=0x0,_0x415367=events[_0x4a8d('0x5')];_0x4b7ac5<_0x415367;_0x4b7ac5++){var _0x2f5115=events[_0x4b7ac5];var _0x31bd51=createListener(_0x4a8d('0x6')+_0x2f5115,_0x3b1dd5);DashboardItemEvents['on'](_0x2f5115,_0x31bd51);}}; \ No newline at end of file +var _0x553b=['register','length','dashboardItem:','remove','update','emit','removeListener'];(function(_0x5e50cf,_0x1df7e4){var _0x9b1a69=function(_0x11f760){while(--_0x11f760){_0x5e50cf['push'](_0x5e50cf['shift']());}};_0x9b1a69(++_0x1df7e4);}(_0x553b,0x13e));var _0xb553=function(_0x4c4265,_0xcf3386){_0x4c4265=_0x4c4265-0x0;var _0x1f17c6=_0x553b[_0x4c4265];return _0x1f17c6;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0xb553('0x0'),_0xb553('0x1')];function createListener(_0x267255,_0x13031c){return function(_0x4603df){_0x13031c[_0xb553('0x2')](_0x267255,_0x4603df);};}function removeListener(_0x26fc23,_0x5b74f8){return function(){DashboardItemEvents[_0xb553('0x3')](_0x26fc23,_0x5b74f8);};}exports[_0xb553('0x4')]=function(_0x21d4e7){for(var _0x42dcd8=0x0,_0x325384=events[_0xb553('0x5')];_0x42dcd8<_0x325384;_0x42dcd8++){var _0x395c54=events[_0x42dcd8];var _0x1134e2=createListener(_0xb553('0x6')+_0x395c54,_0x21d4e7);DashboardItemEvents['on'](_0x395c54,_0x1134e2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4967086..2d617db 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 _0xab9d=['/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get'];(function(_0x255c37,_0x4973ce){var _0x4326fb=function(_0x13c4c8){while(--_0x13c4c8){_0x255c37['push'](_0x255c37['shift']());}};_0x4326fb(++_0x4973ce);}(_0xab9d,0xe6));var _0xdab9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xab9d[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xdab9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdab9('0x1'));var router=express[_0xdab9('0x2')]();var fs_extra=require(_0xdab9('0x3'));var auth=require(_0xdab9('0x4'));var interaction=require(_0xdab9('0x5'));var config=require('../../config/environment');var controller=require(_0xdab9('0x6'));router[_0xdab9('0x7')](_0xdab9('0x8'),auth[_0xdab9('0x9')](),controller[_0xdab9('0xa')]);router[_0xdab9('0xb')]('/',auth[_0xdab9('0x9')](),controller[_0xdab9('0xc')]);router[_0xdab9('0xd')](_0xdab9('0x8'),auth['isAuthenticated'](),controller[_0xdab9('0xe')]);router[_0xdab9('0xf')](_0xdab9('0x8'),auth[_0xdab9('0x9')](),controller['destroy']);module[_0xdab9('0x10')]=router; \ No newline at end of file +var _0x156d=['create','put','update','delete','multer','path','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x3cafb8,_0x32860e){var _0x4b7f85=function(_0x31b11d){while(--_0x31b11d){_0x3cafb8['push'](_0x3cafb8['shift']());}};_0x4b7f85(++_0x32860e);}(_0x156d,0x1cb));var _0xd156=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x156d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd156('0x0'));var util=require('util');var path=require(_0xd156('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd156('0x2'));var auth=require(_0xd156('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd156('0x4'));var controller=require('./dashboardItem.controller');router[_0xd156('0x5')](_0xd156('0x6'),auth[_0xd156('0x7')](),controller[_0xd156('0x8')]);router['post']('/',auth[_0xd156('0x7')](),controller[_0xd156('0x9')]);router[_0xd156('0xa')](_0xd156('0x6'),auth[_0xd156('0x7')](),controller[_0xd156('0xb')]);router[_0xd156('0xc')](_0xd156('0x6'),auth[_0xd156('0x7')](),controller['destroy']);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 f985333..7647d44 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 _0xc2d3=['sequelize','exports','STRING','ENUM','second','third','first'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc2d3,0x13b));var _0x3c2d=function(_0x25c167,_0x257f49){_0x25c167=_0x25c167-0x0;var _0x47f820=_0xc2d3[_0x25c167];return _0x47f820;};'use strict';var Sequelize=require(_0x3c2d('0x0'));module[_0x3c2d('0x1')]={'name':{'type':Sequelize[_0x3c2d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3c2d('0x3')]('first',_0x3c2d('0x4'),_0x3c2d('0x5')),'allowNull':![],'defaultValue':_0x3c2d('0x6')},'description':{'type':Sequelize[_0x3c2d('0x2')]}}; \ No newline at end of file +var _0xbe06=['ENUM','first','exports','STRING'];(function(_0x10b95c,_0x134f5a){var _0x53fbf8=function(_0x5cc266){while(--_0x5cc266){_0x10b95c['push'](_0x10b95c['shift']());}};_0x53fbf8(++_0x134f5a);}(_0xbe06,0x192));var _0x6be0=function(_0x1dfce8,_0x5d1607){_0x1dfce8=_0x1dfce8-0x0;var _0x4c689a=_0xbe06[_0x1dfce8];return _0x4c689a;};'use strict';var Sequelize=require('sequelize');module[_0x6be0('0x0')]={'name':{'type':Sequelize[_0x6be0('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6be0('0x2')]('first','second','third'),'allowNull':![],'defaultValue':_0x6be0('0x3')},'description':{'type':Sequelize[_0x6be0('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 33acbb6..88c2ed4 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 _0x962e=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','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','zip-dir','request-promise','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4d2938,_0x3a3795){var _0x1714d9=function(_0x5043b1){while(--_0x5043b1){_0x4d2938['push'](_0x4d2938['shift']());}};_0x1714d9(++_0x3a3795);}(_0x962e,0x187));var _0xe962=function(_0x14ca26,_0xf6f7c2){_0x14ca26=_0x14ca26-0x0;var _0x2061e9=_0x962e[_0x14ca26];return _0x2061e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe962('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe962('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe962('0x2'));var csv=require(_0xe962('0x3'));var ejs=require(_0xe962('0x4'));var fs=require('fs');var fs_extra=require(_0xe962('0x5'));var _=require('lodash');var squel=require(_0xe962('0x6'));var crypto=require(_0xe962('0x7'));var jsforce=require(_0xe962('0x8'));var deskjs=require(_0xe962('0x9'));var toCsv=require('to-csv');var querystring=require(_0xe962('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe962('0xb'));var qs=require(_0xe962('0xc'));var as=require(_0xe962('0xd'));var hardwareService=require(_0xe962('0xe'));var logger=require(_0xe962('0xf'))(_0xe962('0x10'));var utils=require('../../config/utils');var config=require(_0xe962('0x11'));var licenseUtil=require(_0xe962('0x12'));var db=require(_0xe962('0x13'))['db'];function respondWithStatusCode(_0x56ee19,_0xe73e41){_0xe73e41=_0xe73e41||0xcc;return function(_0xb46cad){if(_0xb46cad){return _0x56ee19[_0xe962('0x14')](_0xe73e41);}return _0x56ee19[_0xe962('0x15')](_0xe73e41)[_0xe962('0x16')]();};}function respondWithResult(_0x7b6278,_0x5d850b){_0x5d850b=_0x5d850b||0xc8;return function(_0xbc816c){if(_0xbc816c){return _0x7b6278[_0xe962('0x15')](_0x5d850b)[_0xe962('0x17')](_0xbc816c);}};}function respondWithFilteredResult(_0x236c88,_0x545b97){return function(_0x19a31b){if(_0x19a31b){var _0x2f8da8=typeof _0x545b97[_0xe962('0x18')]==='undefined'&&typeof _0x545b97[_0xe962('0x19')]===_0xe962('0x1a');var _0x1b4314=_0x19a31b[_0xe962('0x1b')];var _0xb36a22=_0x2f8da8?0x0:_0x545b97[_0xe962('0x18')];var _0x396cb5=_0x2f8da8?_0x19a31b[_0xe962('0x1b')]:_0x545b97['offset']+_0x545b97[_0xe962('0x19')];var _0xdb9672;if(_0x396cb5>=_0x1b4314){_0x396cb5=_0x1b4314;_0xdb9672=0xc8;}else{_0xdb9672=0xce;}_0x236c88[_0xe962('0x15')](_0xdb9672);return _0x236c88[_0xe962('0x1c')]('Content-Range',_0xb36a22+'-'+_0x396cb5+'/'+_0x1b4314)['json'](_0x19a31b);}return null;};}function patchUpdates(_0x3fef8f){return function(_0x4f5ab0){try{jsonpatch[_0xe962('0x1d')](_0x4f5ab0,_0x3fef8f,!![]);}catch(_0x4277b8){return BPromise[_0xe962('0x1e')](_0x4277b8);}return _0x4f5ab0[_0xe962('0x1f')]();};}function saveUpdates(_0x1774ae,_0x45df3a){return function(_0x5ba13f){if(_0x5ba13f){return _0x5ba13f[_0xe962('0x20')](_0x1774ae)[_0xe962('0x21')](function(_0x11e68b){return _0x11e68b;});}return null;};}function removeEntity(_0x14db0d,_0xccedfb){return function(_0xa1e32a){if(_0xa1e32a){return _0xa1e32a[_0xe962('0x22')]()['then'](function(){var _0x4679db=_0xa1e32a[_0xe962('0x23')]({'plain':!![]});var _0xc22382=_0xe962('0x24');return db[_0xe962('0x25')][_0xe962('0x22')]({'where':{'type':_0xc22382,'resourceId':_0x4679db['id']}})[_0xe962('0x21')](function(){return _0xa1e32a;});})['then'](function(){_0x14db0d[_0xe962('0x15')](0xcc)[_0xe962('0x16')]();});}};}function handleEntityNotFound(_0x1bba5e,_0x415b13){return function(_0x388d4e){if(!_0x388d4e){_0x1bba5e[_0xe962('0x14')](0x194);}return _0x388d4e;};}function handleError(_0x163c79,_0x441613){_0x441613=_0x441613||0x1f4;return function(_0x34bc3e){logger[_0xe962('0x26')](_0x34bc3e[_0xe962('0x27')]);if(_0x34bc3e['name']){delete _0x34bc3e[_0xe962('0x28')];}_0x163c79[_0xe962('0x15')](_0x441613)[_0xe962('0x29')](_0x34bc3e);};}exports[_0xe962('0x2a')]=function(_0x4fea45,_0x21b50a){var _0x38ae9e={},_0x430bf6={},_0xc4adeb={'count':0x0,'rows':[]};var _0x82aff1=_[_0xe962('0x2b')](db[_0xe962('0x2c')][_0xe962('0x2d')],function(_0x3aa92e){return{'name':_0x3aa92e[_0xe962('0x2e')],'type':_0x3aa92e['type'][_0xe962('0x2f')]};});_0x430bf6['model']=_[_0xe962('0x2b')](_0x82aff1,_0xe962('0x28'));_0x430bf6[_0xe962('0x30')]=_[_0xe962('0x31')](_0x4fea45[_0xe962('0x30')]);_0x430bf6[_0xe962('0x32')]=_[_0xe962('0x33')](_0x430bf6[_0xe962('0x34')],_0x430bf6[_0xe962('0x30')]);_0x38ae9e[_0xe962('0x35')]=_['intersection'](_0x430bf6[_0xe962('0x34')],qs[_0xe962('0x36')](_0x4fea45[_0xe962('0x30')][_0xe962('0x36')]));_0x38ae9e[_0xe962('0x35')]=_0x38ae9e[_0xe962('0x35')]['length']?_0x38ae9e[_0xe962('0x35')]:_0x430bf6['model'];if(!_0x4fea45[_0xe962('0x30')][_0xe962('0x37')]('nolimit')){_0x38ae9e[_0xe962('0x19')]=qs[_0xe962('0x19')](_0x4fea45[_0xe962('0x30')][_0xe962('0x19')]);_0x38ae9e[_0xe962('0x18')]=qs[_0xe962('0x18')](_0x4fea45['query'][_0xe962('0x18')]);}_0x38ae9e['order']=qs[_0xe962('0x38')](_0x4fea45[_0xe962('0x30')]['sort']);_0x38ae9e[_0xe962('0x39')]=qs['filters'](_[_0xe962('0x3a')](_0x4fea45[_0xe962('0x30')],_0x430bf6[_0xe962('0x32')]),_0x82aff1);if(_0x4fea45[_0xe962('0x30')][_0xe962('0x3b')]){_0x38ae9e[_0xe962('0x39')]=_[_0xe962('0x3c')](_0x38ae9e[_0xe962('0x39')],{'$or':_['map'](_0x82aff1,function(_0x36bd6f){if(_0x36bd6f[_0xe962('0x3d')]!==_0xe962('0x3e')){var _0x1bc5f1={};_0x1bc5f1[_0x36bd6f['name']]={'$like':'%'+_0x4fea45['query'][_0xe962('0x3b')]+'%'};return _0x1bc5f1;}})});}_0x38ae9e=_[_0xe962('0x3c')]({},_0x38ae9e,_0x4fea45[_0xe962('0x3f')]);var _0x11e73c={'where':_0x38ae9e['where']};return db['Disposition'][_0xe962('0x1b')](_0x11e73c)[_0xe962('0x21')](function(_0x4aaec7){_0xc4adeb[_0xe962('0x1b')]=_0x4aaec7;if(_0x4fea45['query'][_0xe962('0x40')]){_0x38ae9e[_0xe962('0x41')]=[{'all':!![]}];}return db[_0xe962('0x2c')]['findAll'](_0x38ae9e);})['then'](function(_0x5f4dcd){_0xc4adeb[_0xe962('0x42')]=_0x5f4dcd;return _0xc4adeb;})[_0xe962('0x21')](respondWithFilteredResult(_0x21b50a,_0x38ae9e))[_0xe962('0x43')](handleError(_0x21b50a,null));};exports[_0xe962('0x44')]=function(_0x202a5f,_0x5c428c){var _0x5aac3f={'raw':!![],'where':{'id':_0x202a5f[_0xe962('0x45')]['id']}},_0x5ee667={};_0x5ee667[_0xe962('0x34')]=_['keys'](db[_0xe962('0x2c')][_0xe962('0x2d')]);_0x5ee667[_0xe962('0x30')]=_[_0xe962('0x31')](_0x202a5f['query']);_0x5ee667[_0xe962('0x32')]=_[_0xe962('0x33')](_0x5ee667[_0xe962('0x34')],_0x5ee667[_0xe962('0x30')]);_0x5aac3f['attributes']=_[_0xe962('0x33')](_0x5ee667[_0xe962('0x34')],qs[_0xe962('0x36')](_0x202a5f['query'][_0xe962('0x36')]));_0x5aac3f[_0xe962('0x35')]=_0x5aac3f[_0xe962('0x35')][_0xe962('0x46')]?_0x5aac3f[_0xe962('0x35')]:_0x5ee667['model'];if(_0x202a5f['query'][_0xe962('0x40')]){_0x5aac3f[_0xe962('0x41')]=[{'all':!![]}];}_0x5aac3f=_[_0xe962('0x3c')]({},_0x5aac3f,_0x202a5f[_0xe962('0x3f')]);return db['Disposition'][_0xe962('0x47')](_0x5aac3f)[_0xe962('0x21')](handleEntityNotFound(_0x5c428c,null))[_0xe962('0x21')](respondWithResult(_0x5c428c,null))[_0xe962('0x43')](handleError(_0x5c428c,null));};exports[_0xe962('0x48')]=function(_0x48c814,_0x322552){return db[_0xe962('0x2c')][_0xe962('0x48')](_0x48c814[_0xe962('0x49')],{})[_0xe962('0x21')](function(_0x51f635){var _0x5c9026=_0x48c814[_0xe962('0x4a')][_0xe962('0x23')]({'plain':!![]});if(!_0x5c9026)throw new Error(_0xe962('0x4b'));if(_0x5c9026[_0xe962('0x4c')]==='user'){var _0x4917ff=_0x51f635[_0xe962('0x23')]({'plain':!![]});var _0x333136=_0xe962('0x24');return db[_0xe962('0x4d')][_0xe962('0x47')]({'where':{'name':_0x333136,'userProfileId':_0x5c9026[_0xe962('0x4e')]},'raw':!![]})['then'](function(_0x572b7e){if(_0x572b7e&&_0x572b7e[_0xe962('0x4f')]===0x0){return db[_0xe962('0x25')][_0xe962('0x48')]({'name':_0x4917ff[_0xe962('0x28')],'resourceId':_0x4917ff['id'],'type':_0x572b7e['name'],'sectionId':_0x572b7e['id']},{})[_0xe962('0x21')](function(){return _0x51f635;});}else{return _0x51f635;}})['catch'](function(_0x3f4a56){logger[_0xe962('0x26')](_0xe962('0x50'),_0x3f4a56);throw _0x3f4a56;});}return _0x51f635;})[_0xe962('0x21')](respondWithResult(_0x322552,0xc9))[_0xe962('0x43')](handleError(_0x322552,null));};exports[_0xe962('0x20')]=function(_0x47cc0a,_0x46ce1d){if(_0x47cc0a[_0xe962('0x49')]['id']){delete _0x47cc0a['body']['id'];}return db[_0xe962('0x2c')][_0xe962('0x47')]({'where':{'id':_0x47cc0a[_0xe962('0x45')]['id']}})[_0xe962('0x21')](handleEntityNotFound(_0x46ce1d,null))[_0xe962('0x21')](saveUpdates(_0x47cc0a[_0xe962('0x49')],null))[_0xe962('0x21')](respondWithResult(_0x46ce1d,null))[_0xe962('0x43')](handleError(_0x46ce1d,null));};exports[_0xe962('0x22')]=function(_0x4dd99b,_0x1b8228){return db[_0xe962('0x2c')][_0xe962('0x47')]({'where':{'id':_0x4dd99b[_0xe962('0x45')]['id']}})[_0xe962('0x21')](handleEntityNotFound(_0x1b8228,null))['then'](removeEntity(_0x1b8228,null))['catch'](handleError(_0x1b8228,null));}; \ No newline at end of file +var _0x5ed3=['query','keys','filters','intersection','attributes','fields','limit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','rawAttributes','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','error','name','send','map','Disposition','fieldName','type','model'];(function(_0x4b2412,_0x5de7f7){var _0x2db47d=function(_0x1d7a62){while(--_0x1d7a62){_0x4b2412['push'](_0x4b2412['shift']());}};_0x2db47d(++_0x5de7f7);}(_0x5ed3,0x1f3));var _0x35ed=function(_0x525b9c,_0x16e8e0){_0x525b9c=_0x525b9c-0x0;var _0x19a140=_0x5ed3[_0x525b9c];return _0x19a140;};'use strict';var emlformat=require(_0x35ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35ed('0x1'));var jsonpatch=require(_0x35ed('0x2'));var rp=require(_0x35ed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x35ed('0x4'));var util=require(_0x35ed('0x5'));var path=require(_0x35ed('0x6'));var sox=require('sox');var csv=require(_0x35ed('0x7'));var ejs=require(_0x35ed('0x8'));var fs=require('fs');var fs_extra=require(_0x35ed('0x9'));var _=require(_0x35ed('0xa'));var squel=require('squel');var crypto=require(_0x35ed('0xb'));var jsforce=require(_0x35ed('0xc'));var deskjs=require(_0x35ed('0xd'));var toCsv=require(_0x35ed('0x7'));var querystring=require(_0x35ed('0xe'));var Papa=require(_0x35ed('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x35ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35ed('0x11'))(_0x35ed('0x12'));var utils=require(_0x35ed('0x13'));var config=require(_0x35ed('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x35ed('0x15'))['db'];function respondWithStatusCode(_0x7b2467,_0xd89531){_0xd89531=_0xd89531||0xcc;return function(_0x189ae6){if(_0x189ae6){return _0x7b2467[_0x35ed('0x16')](_0xd89531);}return _0x7b2467[_0x35ed('0x17')](_0xd89531)[_0x35ed('0x18')]();};}function respondWithResult(_0x4f3cec,_0x1d2da2){_0x1d2da2=_0x1d2da2||0xc8;return function(_0x4338a7){if(_0x4338a7){return _0x4f3cec[_0x35ed('0x17')](_0x1d2da2)[_0x35ed('0x19')](_0x4338a7);}};}function respondWithFilteredResult(_0x27f3ca,_0x6dd34e){return function(_0x5472d8){if(_0x5472d8){var _0x5a9505=typeof _0x6dd34e[_0x35ed('0x1a')]===_0x35ed('0x1b')&&typeof _0x6dd34e['limit']===_0x35ed('0x1b');var _0x1f43ec=_0x5472d8[_0x35ed('0x1c')];var _0x58405c=_0x5a9505?0x0:_0x6dd34e[_0x35ed('0x1a')];var _0x25f05b=_0x5a9505?_0x5472d8[_0x35ed('0x1c')]:_0x6dd34e[_0x35ed('0x1a')]+_0x6dd34e['limit'];var _0x5f4d09;if(_0x25f05b>=_0x1f43ec){_0x25f05b=_0x1f43ec;_0x5f4d09=0xc8;}else{_0x5f4d09=0xce;}_0x27f3ca['status'](_0x5f4d09);return _0x27f3ca[_0x35ed('0x1d')](_0x35ed('0x1e'),_0x58405c+'-'+_0x25f05b+'/'+_0x1f43ec)[_0x35ed('0x19')](_0x5472d8);}return null;};}function patchUpdates(_0x47bd4b){return function(_0x42fcf7){try{jsonpatch[_0x35ed('0x1f')](_0x42fcf7,_0x47bd4b,!![]);}catch(_0x5f4f2f){return BPromise[_0x35ed('0x20')](_0x5f4f2f);}return _0x42fcf7[_0x35ed('0x21')]();};}function saveUpdates(_0x520d13,_0x49bcab){return function(_0x234ffe){if(_0x234ffe){return _0x234ffe[_0x35ed('0x22')](_0x520d13)[_0x35ed('0x23')](function(_0x4f9001){return _0x4f9001;});}return null;};}function removeEntity(_0x3af8a2,_0x3fa61e){return function(_0x2c0a87){if(_0x2c0a87){return _0x2c0a87[_0x35ed('0x24')]()[_0x35ed('0x23')](function(){var _0x543305=_0x2c0a87[_0x35ed('0x25')]({'plain':!![]});var _0x5b71e6=_0x35ed('0x26');return db['UserProfileResource'][_0x35ed('0x24')]({'where':{'type':_0x5b71e6,'resourceId':_0x543305['id']}})[_0x35ed('0x23')](function(){return _0x2c0a87;});})[_0x35ed('0x23')](function(){_0x3af8a2[_0x35ed('0x17')](0xcc)[_0x35ed('0x18')]();});}};}function handleEntityNotFound(_0x499b99,_0x2ee501){return function(_0x446e70){if(!_0x446e70){_0x499b99[_0x35ed('0x16')](0x194);}return _0x446e70;};}function handleError(_0x497593,_0x11c65e){_0x11c65e=_0x11c65e||0x1f4;return function(_0x4d0d8e){logger[_0x35ed('0x27')](_0x4d0d8e['stack']);if(_0x4d0d8e[_0x35ed('0x28')]){delete _0x4d0d8e[_0x35ed('0x28')];}_0x497593['status'](_0x11c65e)[_0x35ed('0x29')](_0x4d0d8e);};}exports['index']=function(_0x1a9a3e,_0x277aad){var _0x3f7f06={},_0x58c04e={},_0x431280={'count':0x0,'rows':[]};var _0x2e15ac=_[_0x35ed('0x2a')](db[_0x35ed('0x2b')]['rawAttributes'],function(_0x3fd1b0){return{'name':_0x3fd1b0[_0x35ed('0x2c')],'type':_0x3fd1b0[_0x35ed('0x2d')]['key']};});_0x58c04e[_0x35ed('0x2e')]=_[_0x35ed('0x2a')](_0x2e15ac,_0x35ed('0x28'));_0x58c04e[_0x35ed('0x2f')]=_[_0x35ed('0x30')](_0x1a9a3e[_0x35ed('0x2f')]);_0x58c04e[_0x35ed('0x31')]=_[_0x35ed('0x32')](_0x58c04e[_0x35ed('0x2e')],_0x58c04e[_0x35ed('0x2f')]);_0x3f7f06[_0x35ed('0x33')]=_['intersection'](_0x58c04e[_0x35ed('0x2e')],qs[_0x35ed('0x34')](_0x1a9a3e[_0x35ed('0x2f')][_0x35ed('0x34')]));_0x3f7f06[_0x35ed('0x33')]=_0x3f7f06[_0x35ed('0x33')]['length']?_0x3f7f06[_0x35ed('0x33')]:_0x58c04e[_0x35ed('0x2e')];if(!_0x1a9a3e['query']['hasOwnProperty']('nolimit')){_0x3f7f06[_0x35ed('0x35')]=qs[_0x35ed('0x35')](_0x1a9a3e[_0x35ed('0x2f')][_0x35ed('0x35')]);_0x3f7f06[_0x35ed('0x1a')]=qs['offset'](_0x1a9a3e[_0x35ed('0x2f')][_0x35ed('0x1a')]);}_0x3f7f06['order']=qs['sort'](_0x1a9a3e[_0x35ed('0x2f')][_0x35ed('0x36')]);_0x3f7f06[_0x35ed('0x37')]=qs[_0x35ed('0x31')](_[_0x35ed('0x38')](_0x1a9a3e[_0x35ed('0x2f')],_0x58c04e[_0x35ed('0x31')]),_0x2e15ac);if(_0x1a9a3e[_0x35ed('0x2f')]['filter']){_0x3f7f06['where']=_[_0x35ed('0x39')](_0x3f7f06['where'],{'$or':_[_0x35ed('0x2a')](_0x2e15ac,function(_0x239e23){if(_0x239e23[_0x35ed('0x2d')]!==_0x35ed('0x3a')){var _0x1f682a={};_0x1f682a[_0x239e23[_0x35ed('0x28')]]={'$like':'%'+_0x1a9a3e['query'][_0x35ed('0x3b')]+'%'};return _0x1f682a;}})});}_0x3f7f06=_[_0x35ed('0x39')]({},_0x3f7f06,_0x1a9a3e[_0x35ed('0x3c')]);var _0x59302f={'where':_0x3f7f06['where']};return db['Disposition'][_0x35ed('0x1c')](_0x59302f)[_0x35ed('0x23')](function(_0x3dda0a){_0x431280[_0x35ed('0x1c')]=_0x3dda0a;if(_0x1a9a3e['query']['includeAll']){_0x3f7f06['include']=[{'all':!![]}];}return db[_0x35ed('0x2b')][_0x35ed('0x3d')](_0x3f7f06);})[_0x35ed('0x23')](function(_0x25a67b){_0x431280[_0x35ed('0x3e')]=_0x25a67b;return _0x431280;})[_0x35ed('0x23')](respondWithFilteredResult(_0x277aad,_0x3f7f06))[_0x35ed('0x3f')](handleError(_0x277aad,null));};exports['show']=function(_0x2168bf,_0xec327e){var _0x556700={'raw':!![],'where':{'id':_0x2168bf['params']['id']}},_0x20e5aa={};_0x20e5aa[_0x35ed('0x2e')]=_[_0x35ed('0x30')](db['Disposition'][_0x35ed('0x40')]);_0x20e5aa[_0x35ed('0x2f')]=_[_0x35ed('0x30')](_0x2168bf[_0x35ed('0x2f')]);_0x20e5aa[_0x35ed('0x31')]=_[_0x35ed('0x32')](_0x20e5aa['model'],_0x20e5aa[_0x35ed('0x2f')]);_0x556700[_0x35ed('0x33')]=_[_0x35ed('0x32')](_0x20e5aa[_0x35ed('0x2e')],qs[_0x35ed('0x34')](_0x2168bf['query'][_0x35ed('0x34')]));_0x556700[_0x35ed('0x33')]=_0x556700[_0x35ed('0x33')][_0x35ed('0x41')]?_0x556700[_0x35ed('0x33')]:_0x20e5aa['model'];if(_0x2168bf['query'][_0x35ed('0x42')]){_0x556700[_0x35ed('0x43')]=[{'all':!![]}];}_0x556700=_[_0x35ed('0x39')]({},_0x556700,_0x2168bf[_0x35ed('0x3c')]);return db['Disposition'][_0x35ed('0x44')](_0x556700)['then'](handleEntityNotFound(_0xec327e,null))['then'](respondWithResult(_0xec327e,null))[_0x35ed('0x3f')](handleError(_0xec327e,null));};exports[_0x35ed('0x45')]=function(_0xaffa79,_0x5adde1){return db[_0x35ed('0x2b')]['create'](_0xaffa79[_0x35ed('0x46')],{})[_0x35ed('0x23')](function(_0x13eda6){var _0x6f369f=_0xaffa79[_0x35ed('0x47')][_0x35ed('0x25')]({'plain':!![]});if(!_0x6f369f)throw new Error(_0x35ed('0x48'));if(_0x6f369f['role']===_0x35ed('0x47')){var _0x4afce4=_0x13eda6[_0x35ed('0x25')]({'plain':!![]});var _0x529631=_0x35ed('0x26');return db[_0x35ed('0x49')][_0x35ed('0x44')]({'where':{'name':_0x529631,'userProfileId':_0x6f369f[_0x35ed('0x4a')]},'raw':!![]})[_0x35ed('0x23')](function(_0x32a9fb){if(_0x32a9fb&&_0x32a9fb['autoAssociation']===0x0){return db[_0x35ed('0x4b')][_0x35ed('0x45')]({'name':_0x4afce4[_0x35ed('0x28')],'resourceId':_0x4afce4['id'],'type':_0x32a9fb[_0x35ed('0x28')],'sectionId':_0x32a9fb['id']},{})[_0x35ed('0x23')](function(){return _0x13eda6;});}else{return _0x13eda6;}})['catch'](function(_0x5c5595){logger[_0x35ed('0x27')](_0x35ed('0x4c'),_0x5c5595);throw _0x5c5595;});}return _0x13eda6;})[_0x35ed('0x23')](respondWithResult(_0x5adde1,0xc9))[_0x35ed('0x3f')](handleError(_0x5adde1,null));};exports[_0x35ed('0x22')]=function(_0x3b4c33,_0x53f9f4){if(_0x3b4c33[_0x35ed('0x46')]['id']){delete _0x3b4c33['body']['id'];}return db[_0x35ed('0x2b')][_0x35ed('0x44')]({'where':{'id':_0x3b4c33[_0x35ed('0x4d')]['id']}})[_0x35ed('0x23')](handleEntityNotFound(_0x53f9f4,null))['then'](saveUpdates(_0x3b4c33[_0x35ed('0x46')],null))[_0x35ed('0x23')](respondWithResult(_0x53f9f4,null))[_0x35ed('0x3f')](handleError(_0x53f9f4,null));};exports['destroy']=function(_0x7aeed4,_0x3e69e1){return db[_0x35ed('0x2b')][_0x35ed('0x44')]({'where':{'id':_0x7aeed4[_0x35ed('0x4d')]['id']}})[_0x35ed('0x23')](handleEntityNotFound(_0x3e69e1,null))['then'](removeEntity(_0x3e69e1,null))['catch'](handleError(_0x3e69e1,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 660b8be..2ed9055 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 _0xaadb=['bluebird','path','rimraf','define','Disposition','tools_dispositions','name_voice','ListId','name','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment'];(function(_0x227d77,_0x353e99){var _0x4e44fb=function(_0x44870a){while(--_0x44870a){_0x227d77['push'](_0x227d77['shift']());}};_0x4e44fb(++_0x353e99);}(_0xaadb,0x1de));var _0xbaad=function(_0x1b63a9,_0x261156){_0x1b63a9=_0x1b63a9-0x0;var _0x2a89a4=_0xaadb[_0x1b63a9];return _0x2a89a4;};'use strict';var _=require(_0xbaad('0x0'));var util=require(_0xbaad('0x1'));var logger=require(_0xbaad('0x2'))(_0xbaad('0x3'));var moment=require(_0xbaad('0x4'));var BPromise=require(_0xbaad('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaad('0x6'));var rimraf=require(_0xbaad('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module['exports']=function(_0x2eba59,_0x4d35f2){return _0x2eba59[_0xbaad('0x8')](_0xbaad('0x9'),attributes,{'tableName':_0xbaad('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbaad('0xb'),'fields':['name',_0xbaad('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0xbaad('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0xbaad('0xe'),'fields':[_0xbaad('0xd'),_0xbaad('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0xbaad('0xd'),_0xbaad('0x10')]},{'unique':!![],'name':_0xbaad('0x11'),'fields':[_0xbaad('0xd'),_0xbaad('0x12')]},{'unique':!![],'name':_0xbaad('0x13'),'fields':[_0xbaad('0xd'),_0xbaad('0x14')]},{'unique':!![],'name':_0xbaad('0x15'),'fields':[_0xbaad('0xd'),_0xbaad('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45e5=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','bluebird','path','rimraf','../../config/environment','define','Disposition','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','FaxAccountId'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x45e5,0x13f));var _0x545e=function(_0x3da589,_0x48f405){_0x3da589=_0x3da589-0x0;var _0x25e3c0=_0x45e5[_0x3da589];return _0x25e3c0;};'use strict';var _=require(_0x545e('0x0'));var util=require(_0x545e('0x1'));var logger=require('../../config/logger')(_0x545e('0x2'));var moment=require('moment');var BPromise=require(_0x545e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x545e('0x4'));var rimraf=require(_0x545e('0x5'));var config=require(_0x545e('0x6'));var attributes=require('./disposition.attributes');module['exports']=function(_0x1105ce,_0x16fef9){return _0x1105ce[_0x545e('0x7')](_0x545e('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x545e('0x9'),'fields':[_0x545e('0xa'),'ListId']},{'unique':!![],'name':_0x545e('0xb'),'fields':[_0x545e('0xa'),_0x545e('0xc')]},{'unique':!![],'name':_0x545e('0xd'),'fields':[_0x545e('0xa'),_0x545e('0xe')]},{'unique':!![],'name':_0x545e('0xf'),'fields':[_0x545e('0xa'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x545e('0xa'),_0x545e('0x10')]},{'unique':!![],'name':_0x545e('0x11'),'fields':[_0x545e('0xa'),_0x545e('0x12')]},{'unique':!![],'name':_0x545e('0x13'),'fields':[_0x545e('0xa'),_0x545e('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 6836ae1..89cf883 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(_0x34069a,_0x32f540){var _0x52c046=function(_0x479c92){while(--_0x479c92){_0x34069a['push'](_0x34069a['shift']());}};_0x52c046(++_0x32f540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x4b1a88,_0x3cc833){var _0x1630de=function(_0x123942){while(--_0x123942){_0x4b1a88['push'](_0x4b1a88['shift']());}};_0x1630de(++_0x3cc833);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index bc01a17..8ef0c57 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 _0x60f3=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5f2a5a,_0x27a77f){var _0x5c60c2=function(_0x34cae3){while(--_0x34cae3){_0x5f2a5a['push'](_0x5f2a5a['shift']());}};_0x5c60c2(++_0x27a77f);}(_0x60f3,0x162));var _0x360f=function(_0x477491,_0x5ca700){_0x477491=_0x477491-0x0;var _0xac6aec=_0x60f3[_0x477491];return _0xac6aec;};'use strict';var multer=require(_0x360f('0x0'));var util=require(_0x360f('0x1'));var path=require(_0x360f('0x2'));var timeout=require('connect-timeout');var express=require(_0x360f('0x3'));var router=express[_0x360f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x360f('0x5'));var interaction=require(_0x360f('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x360f('0x7')]('/',auth[_0x360f('0x8')](),controller['index']);router[_0x360f('0x7')](_0x360f('0x9'),auth['isAuthenticated'](),controller[_0x360f('0xa')]);router['post']('/',auth[_0x360f('0x8')](),controller[_0x360f('0xb')]);router[_0x360f('0xc')](_0x360f('0x9'),auth['isAuthenticated'](),controller[_0x360f('0xd')]);router[_0x360f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x360f('0xf')]);module[_0x360f('0x10')]=router; \ No newline at end of file +var _0xd238=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','show','post','put','update','delete'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd238,0x106));var _0x8d23=function(_0x1f2f12,_0x2e67c6){_0x1f2f12=_0x1f2f12-0x0;var _0x9a59b4=_0xd238[_0x1f2f12];return _0x9a59b4;};'use strict';var multer=require(_0x8d23('0x0'));var util=require('util');var path=require(_0x8d23('0x1'));var timeout=require(_0x8d23('0x2'));var express=require(_0x8d23('0x3'));var router=express[_0x8d23('0x4')]();var fs_extra=require(_0x8d23('0x5'));var auth=require(_0x8d23('0x6'));var interaction=require(_0x8d23('0x7'));var config=require(_0x8d23('0x8'));var controller=require(_0x8d23('0x9'));router['get']('/',auth[_0x8d23('0xa')](),controller[_0x8d23('0xb')]);router[_0x8d23('0xc')]('/:id',auth[_0x8d23('0xa')](),controller[_0x8d23('0xd')]);router[_0x8d23('0xe')]('/',auth[_0x8d23('0xa')](),controller['create']);router[_0x8d23('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8d23('0x10')]);router[_0x8d23('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8d23('0x12')]);module[_0x8d23('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7007989..b47b801 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 _0x126e=['9600','v17,v27,v29','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','14400'];(function(_0x58ea4b,_0x57bd18){var _0x5571ad=function(_0x338549){while(--_0x338549){_0x58ea4b['push'](_0x58ea4b['shift']());}};_0x5571ad(++_0x57bd18);}(_0x126e,0x108));var _0xe126=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x126e[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require('sequelize');module[_0xe126('0x0')]={'name':{'type':Sequelize[_0xe126('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe126('0x1')]},'ecm':{'type':Sequelize[_0xe126('0x2')](_0xe126('0x3'),'no'),'defaultValue':_0xe126('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xe126('0x4')},'localstationid':{'type':Sequelize[_0xe126('0x1')],'unique':_0xe126('0x5')},'minrate':{'type':Sequelize[_0xe126('0x2')](_0xe126('0x6'),_0xe126('0x7'),_0xe126('0x8'),'9600',_0xe126('0x9'),_0xe126('0xa')),'defaultValue':_0xe126('0x7')},'maxrate':{'type':Sequelize[_0xe126('0x2')](_0xe126('0x6'),'4800',_0xe126('0x8'),_0xe126('0xb'),'12000',_0xe126('0xa')),'defaultValue':_0xe126('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xe126('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe126('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe126('0x2')](_0xe126('0xd'),_0xe126('0xe'),_0xe126('0xf'),_0xe126('0x10')),'defaultValue':_0xe126('0xd')},'key':{'type':Sequelize[_0xe126('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe126('0x11');}},'notificationSound':{'type':Sequelize[_0xe126('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe126('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe126('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe126('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe126('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe126('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe126('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0xe126('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe126('0x15'),'set':function(_0x553e29){if(!_0x553e29)this[_0xe126('0x16')](_0xe126('0x17'),null);this[_0xe126('0x16')](_0xe126('0x18'),_0x553e29);}}}; \ No newline at end of file +var _0x323f=['2400','7200','9600','12000','14400','4800','v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x2aa3fe,_0x4338a2){var _0x5c7610=function(_0x54f873){while(--_0x54f873){_0x2aa3fe['push'](_0x2aa3fe['shift']());}};_0x5c7610(++_0x4338a2);}(_0x323f,0x1ee));var _0xf323=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x323f[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xf323('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf323('0x1')]},'ecm':{'type':Sequelize[_0xf323('0x2')](_0xf323('0x3'),'no'),'defaultValue':_0xf323('0x3')},'headerinfo':{'type':Sequelize[_0xf323('0x1')],'defaultValue':_0xf323('0x4')},'localstationid':{'type':Sequelize[_0xf323('0x1')],'unique':_0xf323('0x5')},'minrate':{'type':Sequelize[_0xf323('0x2')](_0xf323('0x6'),'4800',_0xf323('0x7'),_0xf323('0x8'),_0xf323('0x9'),_0xf323('0xa')),'defaultValue':_0xf323('0xb')},'maxrate':{'type':Sequelize[_0xf323('0x2')](_0xf323('0x6'),_0xf323('0xb'),_0xf323('0x7'),_0xf323('0x8'),_0xf323('0x9'),_0xf323('0xa')),'defaultValue':_0xf323('0xa')},'modem':{'type':Sequelize[_0xf323('0x1')],'defaultValue':_0xf323('0xc')},'gateway':{'type':Sequelize[_0xf323('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf323('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf323('0x2')](_0xf323('0xd'),_0xf323('0xe'),'DADHI',_0xf323('0xf')),'defaultValue':_0xf323('0xd')},'key':{'type':Sequelize[_0xf323('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf323('0x10')],'defaultValue':function(){return _0xf323('0x11');}},'notificationSound':{'type':Sequelize[_0xf323('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf323('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf323('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf323('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf323('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf323('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf323('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xf323('0x12')],'defaultValue':![],'comment':_0xf323('0x15'),'set':function(_0x44671c){if(!_0x44671c)this['setDataValue'](_0xf323('0x16'),null);this[_0xf323('0x17')](_0xf323('0x18'),_0x44671c);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5d69a9a..6f3e7b5 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 _0x3ec1=['DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','params','Pause','mandatoryDispositionPause','intersection','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','Owner','internal','Tags','tag','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','maxrate','modem','t38timeout','FAXOPT(','Wait','addAccountApplications','VoiceExtension','omit','tech','TrunkId','ListId','findById','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts'];(function(_0x251cdf,_0x58037e){var _0x1263c4=function(_0x115cb4){while(--_0x115cb4){_0x251cdf['push'](_0x251cdf['shift']());}};_0x1263c4(++_0x58037e);}(_0x3ec1,0xe1));var _0x13ec=function(_0x2a8ca3,_0x2626d7){_0x2a8ca3=_0x2a8ca3-0x0;var _0x2add49=_0x3ec1[_0x2a8ca3];return _0x2add49;};'use strict';var emlformat=require(_0x13ec('0x0'));var rimraf=require(_0x13ec('0x1'));var zipdir=require(_0x13ec('0x2'));var jsonpatch=require(_0x13ec('0x3'));var rp=require(_0x13ec('0x4'));var moment=require(_0x13ec('0x5'));var BPromise=require(_0x13ec('0x6'));var Mustache=require(_0x13ec('0x7'));var util=require('util');var path=require(_0x13ec('0x8'));var sox=require(_0x13ec('0x9'));var csv=require(_0x13ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13ec('0xb'));var _=require(_0x13ec('0xc'));var squel=require(_0x13ec('0xd'));var crypto=require(_0x13ec('0xe'));var jsforce=require(_0x13ec('0xf'));var deskjs=require(_0x13ec('0x10'));var toCsv=require(_0x13ec('0xa'));var querystring=require(_0x13ec('0x11'));var Papa=require(_0x13ec('0x12'));var Redis=require(_0x13ec('0x13'));var authService=require(_0x13ec('0x14'));var qs=require(_0x13ec('0x15'));var as=require(_0x13ec('0x16'));var hardwareService=require(_0x13ec('0x17'));var logger=require(_0x13ec('0x18'))(_0x13ec('0x19'));var utils=require('../../config/utils');var config=require(_0x13ec('0x1a'));var licenseUtil=require(_0x13ec('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x13ec('0x1c')](config[_0x13ec('0x1d')],{'host':_0x13ec('0x1e'),'port':0x18eb});var socket=require(_0x13ec('0x1f'))(new Redis(config[_0x13ec('0x1d')]));require(_0x13ec('0x20'))['register'](socket);var jayson=require(_0x13ec('0x21'));var client=jayson[_0x13ec('0x22')][_0x13ec('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x13ec('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x20f49a,_0x2b0a09,_0xa79ca5,_0x443060){return new BPromise(function(_0x3238b9,_0x577289){var _0x51321c=_0x443060||client;return _0x51321c[_0x13ec('0x24')](_0x20f49a,_0xa79ca5)[_0x13ec('0x25')](function(_0x325ce6){logger[_0x13ec('0x26')](_0x13ec('0x27'),_0x2b0a09,_0x13ec('0x28'));logger[_0x13ec('0x29')](_0x13ec('0x2a'),_0x2b0a09,'request\x20sent',JSON[_0x13ec('0x2b')](_0x325ce6));if(_0x325ce6[_0x13ec('0x2c')]){if(_0x325ce6[_0x13ec('0x2c')][_0x13ec('0x2d')]===0x1f4){logger[_0x13ec('0x2c')](_0x13ec('0x27'),_0x2b0a09,_0x325ce6[_0x13ec('0x2c')][_0x13ec('0x2e')]);return _0x577289(_0x325ce6[_0x13ec('0x2c')][_0x13ec('0x2e')]);}logger[_0x13ec('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x2b0a09,_0x325ce6['error'][_0x13ec('0x2e')]);return _0x3238b9(_0x325ce6[_0x13ec('0x2c')]['message']);}else{logger[_0x13ec('0x26')]('FaxAccount,\x20%s,\x20%s',_0x2b0a09,_0x13ec('0x28'));_0x3238b9(_0x325ce6['result'][_0x13ec('0x2e')]);}})['catch'](function(_0x1d620e){logger[_0x13ec('0x2c')](_0x13ec('0x27'),_0x2b0a09,_0x1d620e);_0x577289(_0x1d620e);});});}function respondWithStatusCode(_0x31b6be,_0x3605d8){_0x3605d8=_0x3605d8||0xcc;return function(_0x4c9d74){if(_0x4c9d74){return _0x31b6be['sendStatus'](_0x3605d8);}return _0x31b6be[_0x13ec('0x2f')](_0x3605d8)[_0x13ec('0x30')]();};}function respondWithResult(_0x567ae3,_0x28c1e2){_0x28c1e2=_0x28c1e2||0xc8;return function(_0x5bf454){if(_0x5bf454){return _0x567ae3[_0x13ec('0x2f')](_0x28c1e2)['json'](_0x5bf454);}};}function respondWithFilteredResult(_0x49c0b6,_0x46a4ef){return function(_0x3d3501){if(_0x3d3501){var _0x2b6113=typeof _0x46a4ef[_0x13ec('0x31')]===_0x13ec('0x32')&&typeof _0x46a4ef['limit']===_0x13ec('0x32');var _0x3cd5c6=_0x3d3501[_0x13ec('0x33')];var _0x4925aa=_0x2b6113?0x0:_0x46a4ef[_0x13ec('0x31')];var _0x1a80d9=_0x2b6113?_0x3d3501['count']:_0x46a4ef[_0x13ec('0x31')]+_0x46a4ef[_0x13ec('0x34')];var _0x264535;if(_0x1a80d9>=_0x3cd5c6){_0x1a80d9=_0x3cd5c6;_0x264535=0xc8;}else{_0x264535=0xce;}_0x49c0b6['status'](_0x264535);return _0x49c0b6['set'](_0x13ec('0x35'),_0x4925aa+'-'+_0x1a80d9+'/'+_0x3cd5c6)[_0x13ec('0x36')](_0x3d3501);}return null;};}function patchUpdates(_0x4cd455){return function(_0x4e548b){try{jsonpatch[_0x13ec('0x37')](_0x4e548b,_0x4cd455,!![]);}catch(_0x237dca){return BPromise[_0x13ec('0x38')](_0x237dca);}return _0x4e548b['save']();};}function saveUpdates(_0x8e362c,_0x4c5f79){return function(_0x1c50f1){if(_0x1c50f1){return _0x1c50f1['update'](_0x8e362c)[_0x13ec('0x25')](function(_0xc4982c){return _0xc4982c;});}return null;};}function removeEntity(_0x5774c0,_0x22f1d6){return function(_0x4cfe05){if(_0x4cfe05){return _0x4cfe05[_0x13ec('0x39')]()[_0x13ec('0x25')](function(){var _0x951a1c=_0x4cfe05[_0x13ec('0x3a')]({'plain':!![]});var _0x1c2b32=_0x13ec('0x3b');return db[_0x13ec('0x3c')]['destroy']({'where':{'type':_0x1c2b32,'resourceId':_0x951a1c['id']}})[_0x13ec('0x25')](function(){return _0x4cfe05;});})[_0x13ec('0x25')](function(){_0x5774c0[_0x13ec('0x2f')](0xcc)[_0x13ec('0x30')]();});}};}function handleEntityNotFound(_0x5e582b,_0x53e735){return function(_0x145816){if(!_0x145816){_0x5e582b[_0x13ec('0x3d')](0x194);}return _0x145816;};}function handleError(_0x5d4b58,_0x466f2d){_0x466f2d=_0x466f2d||0x1f4;return function(_0x180e5d){logger[_0x13ec('0x2c')](_0x180e5d['stack']);if(_0x180e5d[_0x13ec('0x3e')]){delete _0x180e5d[_0x13ec('0x3e')];}_0x5d4b58[_0x13ec('0x2f')](_0x466f2d)[_0x13ec('0x3f')](_0x180e5d);};}exports[_0x13ec('0x40')]=function(_0xf6613a,_0x38f408){var _0x554629={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xb4cee0={},_0x1eb4f3={'count':0x0,'rows':[]};var _0x13876c=_[_0x13ec('0x41')](db['FaxAccount'][_0x13ec('0x42')],function(_0x4ef4c6){return{'name':_0x4ef4c6['fieldName'],'type':_0x4ef4c6[_0x13ec('0x43')][_0x13ec('0x44')]};});_0xb4cee0[_0x13ec('0x45')]=_['map'](_0x13876c,'name');_0xb4cee0[_0x13ec('0x46')]=_[_0x13ec('0x47')](_0xf6613a[_0x13ec('0x46')]);_0xb4cee0[_0x13ec('0x48')]=_['intersection'](_0xb4cee0[_0x13ec('0x45')],_0xb4cee0[_0x13ec('0x46')]);_0x554629['attributes']=_['intersection'](_0xb4cee0['model'],qs[_0x13ec('0x49')](_0xf6613a['query']['fields']));_0x554629[_0x13ec('0x4a')]=_0x554629[_0x13ec('0x4a')][_0x13ec('0x4b')]?_0x554629['attributes']:_0xb4cee0[_0x13ec('0x45')];if(!_0xf6613a['query'][_0x13ec('0x4c')](_0x13ec('0x4d'))){_0x554629[_0x13ec('0x34')]=qs['limit'](_0xf6613a[_0x13ec('0x46')][_0x13ec('0x34')]);_0x554629[_0x13ec('0x31')]=qs[_0x13ec('0x31')](_0xf6613a[_0x13ec('0x46')][_0x13ec('0x31')]);}_0x554629[_0x13ec('0x4e')]=qs['sort'](_0xf6613a[_0x13ec('0x46')][_0x13ec('0x4f')]);_0x554629[_0x13ec('0x50')]=qs[_0x13ec('0x48')](_[_0x13ec('0x51')](_0xf6613a['query'],_0xb4cee0[_0x13ec('0x48')]),_0x13876c);if(_0xf6613a[_0x13ec('0x46')][_0x13ec('0x52')]){_0x554629['where']=_[_0x13ec('0x53')](_0x554629['where'],{'$or':_[_0x13ec('0x41')](_0x13876c,function(_0x906047){if(_0x906047[_0x13ec('0x43')]!==_0x13ec('0x54')){var _0x47cc17={};_0x47cc17[_0x906047[_0x13ec('0x3e')]]={'$like':'%'+_0xf6613a[_0x13ec('0x46')][_0x13ec('0x52')]+'%'};return _0x47cc17;}})});}_0x554629=_['merge']({},_0x554629,_0xf6613a[_0x13ec('0x55')]);var _0x5028ba={'where':_0x554629[_0x13ec('0x50')]};return db[_0x13ec('0x56')][_0x13ec('0x33')](_0x5028ba)['then'](function(_0x63f1a3){_0x1eb4f3[_0x13ec('0x33')]=_0x63f1a3;if(_0xf6613a[_0x13ec('0x46')][_0x13ec('0x57')]){_0x554629[_0x13ec('0x58')]=[{'all':!![]}];}return db[_0x13ec('0x56')][_0x13ec('0x59')](_0x554629);})[_0x13ec('0x25')](function(_0x25115f){_0x1eb4f3['rows']=_0x25115f;return _0x1eb4f3;})[_0x13ec('0x25')](respondWithFilteredResult(_0x38f408,_0x554629))['catch'](handleError(_0x38f408,null));};exports['show']=function(_0x46f2a6,_0x42ad49){var _0x1d3ef8={'raw':![],'where':{'id':_0x46f2a6[_0x13ec('0x5a')]['id']},'include':[{'model':db[_0x13ec('0x5b')],'as':_0x13ec('0x5c')}]},_0x3b2aa2={};_0x3b2aa2['model']=_['keys'](db[_0x13ec('0x56')][_0x13ec('0x42')]);_0x3b2aa2['query']=_[_0x13ec('0x47')](_0x46f2a6[_0x13ec('0x46')]);_0x3b2aa2['filters']=_[_0x13ec('0x5d')](_0x3b2aa2[_0x13ec('0x45')],_0x3b2aa2[_0x13ec('0x46')]);_0x1d3ef8[_0x13ec('0x4a')]=_[_0x13ec('0x5d')](_0x3b2aa2[_0x13ec('0x45')],qs[_0x13ec('0x49')](_0x46f2a6['query']['fields']));_0x1d3ef8[_0x13ec('0x4a')]=_0x1d3ef8['attributes']['length']?_0x1d3ef8['attributes']:_0x3b2aa2['model'];if(_0x46f2a6[_0x13ec('0x46')]['includeAll']){_0x1d3ef8['include']=[{'all':!![]}];}_0x1d3ef8=_[_0x13ec('0x53')]({},_0x1d3ef8,_0x46f2a6['options']);return db[_0x13ec('0x56')]['find'](_0x1d3ef8)['then'](handleEntityNotFound(_0x42ad49,null))['then'](respondWithResult(_0x42ad49,null))[_0x13ec('0x5e')](handleError(_0x42ad49,null));};exports[_0x13ec('0x5f')]=function(_0x2c7b3c,_0x5c54cf){return db['FaxAccount'][_0x13ec('0x5f')](_0x2c7b3c['body'],{})[_0x13ec('0x25')](function(_0x37f3f0){var _0x56f8cc=_0x2c7b3c['user'][_0x13ec('0x3a')]({'plain':!![]});if(!_0x56f8cc)throw new Error(_0x13ec('0x60'));if(_0x56f8cc['role']===_0x13ec('0x61')){var _0x56f391=_0x37f3f0[_0x13ec('0x3a')]({'plain':!![]});var _0x59ca21=_0x13ec('0x3b');return db[_0x13ec('0x62')][_0x13ec('0x63')]({'where':{'name':_0x59ca21,'userProfileId':_0x56f8cc[_0x13ec('0x64')]},'raw':!![]})[_0x13ec('0x25')](function(_0x31677d){if(_0x31677d&&_0x31677d['autoAssociation']===0x0){return db[_0x13ec('0x3c')]['create']({'name':_0x56f391[_0x13ec('0x3e')],'resourceId':_0x56f391['id'],'type':_0x31677d[_0x13ec('0x3e')],'sectionId':_0x31677d['id']},{})[_0x13ec('0x25')](function(){return _0x37f3f0;});}else{return _0x37f3f0;}})[_0x13ec('0x5e')](function(_0x584c9f){logger['error'](_0x13ec('0x65'),_0x584c9f);throw _0x584c9f;});}return _0x37f3f0;})['then'](respondWithResult(_0x5c54cf,0xc9))['catch'](handleError(_0x5c54cf,null));};exports[_0x13ec('0x66')]=function(_0x1d32f0,_0x378cd1){if(_0x1d32f0['body']['id']){delete _0x1d32f0[_0x13ec('0x67')]['id'];}return db[_0x13ec('0x56')][_0x13ec('0x63')]({'where':{'id':_0x1d32f0[_0x13ec('0x5a')]['id']},'include':[{'model':db[_0x13ec('0x5b')],'as':_0x13ec('0x5c')}]})[_0x13ec('0x25')](handleEntityNotFound(_0x378cd1,null))['then'](saveUpdates(_0x1d32f0[_0x13ec('0x67')],null))[_0x13ec('0x25')](respondWithResult(_0x378cd1,null))[_0x13ec('0x5e')](handleError(_0x378cd1,null));};exports['destroy']=function(_0x1a0b2e,_0x1fe90c){return db[_0x13ec('0x56')][_0x13ec('0x63')]({'where':{'id':_0x1a0b2e[_0x13ec('0x5a')]['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x1fe90c,null))[_0x13ec('0x25')](removeEntity(_0x1fe90c,null))[_0x13ec('0x5e')](handleError(_0x1fe90c,null));};exports['describe']=function(_0x570908,_0x5cf197){return db[_0x13ec('0x56')][_0x13ec('0x68')]()[_0x13ec('0x25')](respondWithResult(_0x5cf197,null))['catch'](handleError(_0x5cf197,null));};exports[_0x13ec('0x69')]=function(_0x375f48,_0x780679,_0xa5de53){if(_0x375f48['body']['id']){delete _0x375f48[_0x13ec('0x67')]['id'];}return db[_0x13ec('0x56')][_0x13ec('0x63')]({'where':{'id':_0x375f48['params']['id']}})['then'](handleEntityNotFound(_0x780679,null))['then'](function(_0x2939d5){if(_0x2939d5){_0x375f48[_0x13ec('0x67')][_0x13ec('0x6a')]=_0x2939d5['id'];return db[_0x13ec('0x6b')]['create'](_0x375f48[_0x13ec('0x67')]);}})[_0x13ec('0x25')](respondWithResult(_0x780679,null))[_0x13ec('0x5e')](handleError(_0x780679,null));};exports[_0x13ec('0x6c')]=function(_0x191aa7,_0x41ccfa,_0x3cd34b){var _0x2313f0={'raw':![],'where':{}};var _0x2a6d3b={};var _0x5da551={'count':0x0,'rows':[]};return db[_0x13ec('0x56')]['findOne']({'where':{'id':_0x191aa7['params']['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x41ccfa,null))[_0x13ec('0x25')](function(_0x493d1d){if(_0x493d1d){_0x2a6d3b[_0x13ec('0x45')]=_['keys'](db[_0x13ec('0x6b')][_0x13ec('0x42')]);_0x2a6d3b[_0x13ec('0x46')]=_[_0x13ec('0x47')](_0x191aa7[_0x13ec('0x46')]);_0x2a6d3b[_0x13ec('0x48')]=_[_0x13ec('0x5d')](_0x2a6d3b[_0x13ec('0x45')],_0x2a6d3b[_0x13ec('0x46')]);_0x2313f0[_0x13ec('0x4a')]=_[_0x13ec('0x5d')](_0x2a6d3b['model'],qs[_0x13ec('0x49')](_0x191aa7[_0x13ec('0x46')][_0x13ec('0x49')]));_0x2313f0[_0x13ec('0x4a')]=_0x2313f0[_0x13ec('0x4a')][_0x13ec('0x4b')]?_0x2313f0['attributes']:_0x2a6d3b[_0x13ec('0x45')];if(!_0x191aa7['query'][_0x13ec('0x4c')](_0x13ec('0x4d'))){_0x2313f0[_0x13ec('0x34')]=qs['limit'](_0x191aa7[_0x13ec('0x46')][_0x13ec('0x34')]);_0x2313f0[_0x13ec('0x31')]=qs[_0x13ec('0x31')](_0x191aa7[_0x13ec('0x46')][_0x13ec('0x31')]);}_0x2313f0[_0x13ec('0x4e')]=qs[_0x13ec('0x4f')](_0x191aa7[_0x13ec('0x46')][_0x13ec('0x4f')]);_0x2313f0[_0x13ec('0x50')]=qs[_0x13ec('0x48')](_['pick'](_0x191aa7[_0x13ec('0x46')],_0x2a6d3b[_0x13ec('0x48')]));_0x2313f0[_0x13ec('0x50')][_0x13ec('0x6a')]=_0x493d1d['id'];if(_0x191aa7[_0x13ec('0x46')][_0x13ec('0x52')]){_0x2313f0[_0x13ec('0x50')]=_[_0x13ec('0x53')](_0x2313f0[_0x13ec('0x50')],{'$or':_['map'](_0x2313f0[_0x13ec('0x4a')],function(_0x3fcce4){var _0x16bf00={};_0x16bf00[_0x3fcce4]={'$like':'%'+_0x191aa7[_0x13ec('0x46')][_0x13ec('0x52')]+'%'};return _0x16bf00;})});}_0x2313f0=_[_0x13ec('0x53')]({},_0x2313f0,_0x191aa7['options']);return db[_0x13ec('0x6b')][_0x13ec('0x33')]({'where':_0x2313f0[_0x13ec('0x50')]})[_0x13ec('0x25')](function(_0x1e9471){_0x5da551[_0x13ec('0x33')]=_0x1e9471;if(_0x191aa7[_0x13ec('0x46')][_0x13ec('0x57')]){_0x2313f0[_0x13ec('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x13ec('0x59')](_0x2313f0);})['then'](function(_0x5f3dcf){_0x5da551[_0x13ec('0x6d')]=_0x5f3dcf;return _0x5da551;});}})['then'](respondWithFilteredResult(_0x41ccfa,_0x2313f0))['catch'](handleError(_0x41ccfa,null));};exports[_0x13ec('0x6e')]=function(_0x31001f,_0x229570,_0x4ba42f){return db[_0x13ec('0x56')][_0x13ec('0x63')]({'where':{'id':_0x31001f[_0x13ec('0x5a')]['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x229570,null))['then'](function(_0x2578ed){if(_0x2578ed){return _0x2578ed[_0x13ec('0x6e')](_0x31001f[_0x13ec('0x46')][_0x13ec('0x6f')]);}})['then'](respondWithStatusCode(_0x229570,null))[_0x13ec('0x5e')](handleError(_0x229570,null));};exports[_0x13ec('0x70')]=function(_0x2359c9,_0x21f8db,_0x3c4ea6){if(_0x2359c9[_0x13ec('0x67')]['id']){delete _0x2359c9[_0x13ec('0x67')]['id'];}return db[_0x13ec('0x56')][_0x13ec('0x63')]({'where':{'id':_0x2359c9[_0x13ec('0x5a')]['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x21f8db,null))[_0x13ec('0x25')](function(_0x156a0c){if(_0x156a0c){_0x2359c9[_0x13ec('0x67')]['FaxAccountId']=_0x156a0c['id'];return db[_0x13ec('0x71')][_0x13ec('0x5f')](_0x2359c9[_0x13ec('0x67')]);}})[_0x13ec('0x25')](respondWithResult(_0x21f8db,null))[_0x13ec('0x5e')](handleError(_0x21f8db,null));};exports['getAnswers']=function(_0x608544,_0x48f018,_0x3a752a){var _0xe483d2={'raw':![],'where':{}};var _0x2e25ec={};var _0x1c5b17={'count':0x0,'rows':[]};return db[_0x13ec('0x56')][_0x13ec('0x72')]({'where':{'id':_0x608544[_0x13ec('0x5a')]['id']}})['then'](handleEntityNotFound(_0x48f018,null))[_0x13ec('0x25')](function(_0x4e96cf){if(_0x4e96cf){_0x2e25ec[_0x13ec('0x45')]=_['keys'](db[_0x13ec('0x71')][_0x13ec('0x42')]);_0x2e25ec[_0x13ec('0x46')]=_['keys'](_0x608544['query']);_0x2e25ec[_0x13ec('0x48')]=_[_0x13ec('0x5d')](_0x2e25ec[_0x13ec('0x45')],_0x2e25ec[_0x13ec('0x46')]);_0xe483d2[_0x13ec('0x4a')]=_[_0x13ec('0x5d')](_0x2e25ec['model'],qs[_0x13ec('0x49')](_0x608544[_0x13ec('0x46')][_0x13ec('0x49')]));_0xe483d2[_0x13ec('0x4a')]=_0xe483d2['attributes'][_0x13ec('0x4b')]?_0xe483d2[_0x13ec('0x4a')]:_0x2e25ec['model'];if(!_0x608544['query'][_0x13ec('0x4c')](_0x13ec('0x4d'))){_0xe483d2[_0x13ec('0x34')]=qs['limit'](_0x608544[_0x13ec('0x46')][_0x13ec('0x34')]);_0xe483d2[_0x13ec('0x31')]=qs['offset'](_0x608544[_0x13ec('0x46')][_0x13ec('0x31')]);}_0xe483d2[_0x13ec('0x4e')]=qs[_0x13ec('0x4f')](_0x608544[_0x13ec('0x46')][_0x13ec('0x4f')]);_0xe483d2[_0x13ec('0x50')]=qs[_0x13ec('0x48')](_[_0x13ec('0x51')](_0x608544['query'],_0x2e25ec[_0x13ec('0x48')]));_0xe483d2[_0x13ec('0x50')]['FaxAccountId']=_0x4e96cf['id'];if(_0x608544['query']['filter']){_0xe483d2['where']=_['merge'](_0xe483d2[_0x13ec('0x50')],{'$or':_['map'](_0xe483d2[_0x13ec('0x4a')],function(_0x3d77f3){var _0x2e99c2={};_0x2e99c2[_0x3d77f3]={'$like':'%'+_0x608544[_0x13ec('0x46')][_0x13ec('0x52')]+'%'};return _0x2e99c2;})});}_0xe483d2=_[_0x13ec('0x53')]({},_0xe483d2,_0x608544['options']);return db[_0x13ec('0x71')][_0x13ec('0x33')]({'where':_0xe483d2[_0x13ec('0x50')]})[_0x13ec('0x25')](function(_0x2b6553){_0x1c5b17[_0x13ec('0x33')]=_0x2b6553;if(_0x608544[_0x13ec('0x46')][_0x13ec('0x57')]){_0xe483d2[_0x13ec('0x58')]=[{'all':!![]}];}return db[_0x13ec('0x71')]['findAll'](_0xe483d2);})[_0x13ec('0x25')](function(_0x4f9666){_0x1c5b17[_0x13ec('0x6d')]=_0x4f9666;return _0x1c5b17;});}})[_0x13ec('0x25')](respondWithFilteredResult(_0x48f018,_0xe483d2))[_0x13ec('0x5e')](handleError(_0x48f018,null));};exports[_0x13ec('0x73')]=function(_0x201e3e,_0x562c7b,_0x2d0936){return db[_0x13ec('0x56')][_0x13ec('0x63')]({'where':{'id':_0x201e3e[_0x13ec('0x5a')]['id']}})['then'](handleEntityNotFound(_0x562c7b,null))['then'](function(_0x160172){if(_0x160172){return _0x160172[_0x13ec('0x73')](_0x201e3e[_0x13ec('0x46')]['ids']);}})[_0x13ec('0x25')](respondWithStatusCode(_0x562c7b,null))['catch'](handleError(_0x562c7b,null));};exports['addInteraction']=function(_0x5db354,_0x5b20fc,_0xeda538){return db[_0x13ec('0x74')][_0x13ec('0x63')]({'where':{'id':_0x5db354[_0x13ec('0x5a')]['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x5b20fc,null))[_0x13ec('0x25')](function(_0x10d771){if(_0x10d771){return _0x10d771[_0x13ec('0x75')](_0x5db354[_0x13ec('0x67')][_0x13ec('0x6f')],_['omit'](_0x5db354[_0x13ec('0x67')],['ids','id'])||{});}})[_0x13ec('0x25')](respondWithResult(_0x5b20fc,null))[_0x13ec('0x5e')](handleError(_0x5b20fc,null));};exports[_0x13ec('0x76')]=function(_0x8a3e4e,_0x11d187,_0x558287){var _0x3036c6={'raw':![],'where':{}};var _0x52ebde={};var _0x5ad0b6={'count':0x0,'rows':[]};return db[_0x13ec('0x56')][_0x13ec('0x72')]({'where':{'id':_0x8a3e4e[_0x13ec('0x5a')]['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x11d187,null))[_0x13ec('0x25')](function(_0x4cc051){if(_0x4cc051){_0x52ebde['model']=_[_0x13ec('0x47')](db['FaxInteraction']['rawAttributes']);_0x52ebde['query']=_['keys'](_0x8a3e4e[_0x13ec('0x46')]);_0x52ebde[_0x13ec('0x48')]=_[_0x13ec('0x5d')](_0x52ebde['model'],_0x52ebde[_0x13ec('0x46')]);_0x3036c6[_0x13ec('0x4a')]=_[_0x13ec('0x5d')](_0x52ebde[_0x13ec('0x45')],qs[_0x13ec('0x49')](_0x8a3e4e[_0x13ec('0x46')][_0x13ec('0x49')]));_0x3036c6[_0x13ec('0x4a')]=_0x3036c6[_0x13ec('0x4a')][_0x13ec('0x4b')]?_0x3036c6[_0x13ec('0x4a')]:_0x52ebde[_0x13ec('0x45')];if(!_0x8a3e4e[_0x13ec('0x46')]['hasOwnProperty'](_0x13ec('0x4d'))){_0x3036c6[_0x13ec('0x34')]=qs['limit'](_0x8a3e4e[_0x13ec('0x46')][_0x13ec('0x34')]);_0x3036c6[_0x13ec('0x31')]=qs[_0x13ec('0x31')](_0x8a3e4e[_0x13ec('0x46')][_0x13ec('0x31')]);}_0x3036c6[_0x13ec('0x4e')]=qs[_0x13ec('0x4f')](_0x8a3e4e[_0x13ec('0x46')]['sort']);_0x3036c6['where']=qs['filters'](_[_0x13ec('0x51')](_0x8a3e4e[_0x13ec('0x46')],_0x52ebde[_0x13ec('0x48')]));_0x3036c6[_0x13ec('0x50')][_0x13ec('0x6a')]=_0x4cc051['id'];if(_0x8a3e4e['query'][_0x13ec('0x52')]){_0x3036c6[_0x13ec('0x50')]=_[_0x13ec('0x53')](_0x3036c6[_0x13ec('0x50')],{'$or':_['map'](_0x3036c6[_0x13ec('0x4a')],function(_0x2e7fc8){var _0x58edd2={};_0x58edd2[_0x2e7fc8]={'$like':'%'+_0x8a3e4e[_0x13ec('0x46')][_0x13ec('0x52')]+'%'};return _0x58edd2;})});}_0x3036c6=_[_0x13ec('0x53')]({},_0x3036c6,_0x8a3e4e[_0x13ec('0x55')]);return db[_0x13ec('0x74')][_0x13ec('0x33')]({'where':_0x3036c6[_0x13ec('0x50')]})[_0x13ec('0x25')](function(_0x230eed){_0x5ad0b6[_0x13ec('0x33')]=_0x230eed;if(_0x8a3e4e['query'][_0x13ec('0x57')]){_0x3036c6[_0x13ec('0x58')]=[{'model':db[_0x13ec('0x77')],'as':_0x13ec('0x78'),'required':![]},{'model':db['User'],'as':_0x13ec('0x79'),'attributes':[_0x13ec('0x3e'),'fullname',_0x13ec('0x7a')],'required':![]},{'model':db['Tag'],'as':_0x13ec('0x7b'),'attributes':['id',_0x13ec('0x3e'),'color'],'where':_0x8a3e4e[_0x13ec('0x46')][_0x13ec('0x7c')]?{'id':_0x8a3e4e['query'][_0x13ec('0x7c')]}:undefined,'required':_0x8a3e4e[_0x13ec('0x46')][_0x13ec('0x7c')]?!![]:![]}];}return db[_0x13ec('0x74')][_0x13ec('0x59')](_0x3036c6);})[_0x13ec('0x25')](function(_0x8d9a50){_0x5ad0b6[_0x13ec('0x6d')]=_0x8d9a50;return _0x5ad0b6;});}})[_0x13ec('0x25')](respondWithFilteredResult(_0x11d187,_0x3036c6))[_0x13ec('0x5e')](handleError(_0x11d187,null));};exports['addApplications']=function(_0x3634f3,_0x4f0b77){var _0x800d6a=_0x3634f3['params']['id'];var _0x21b7af=_0x3634f3[_0x13ec('0x67')];var _0x5558ab=0xc8;var _0xefe75b=null;return db['sequelize'][_0x13ec('0x7d')]({'isolationLevel':db[_0x13ec('0x7e')]['Transaction'][_0x13ec('0x7f')][_0x13ec('0x80')]},function(_0x31ddb5){return db['FaxAccount']['findOne']({'where':{'id':_0x800d6a},'transaction':_0x31ddb5})['then'](function(_0x23f946){if(_0x23f946){return db[_0x13ec('0x81')]['destroy']({'where':{'FaxAccountId':_0x800d6a},'transaction':_0x31ddb5})[_0x13ec('0x25')](function(){var _0x28694b=_[_0x13ec('0x41')](_0x21b7af,function(_0x491364){_0x491364[_0x13ec('0x6a')]=_0x800d6a;return _0x491364;});return db[_0x13ec('0x81')][_0x13ec('0x82')](_0x28694b,{'transaction':_0x31ddb5});});}else{_0x5558ab=0x194;_0xefe75b=[];}});})[_0x13ec('0x25')](function(){if(_0x5558ab!==0x194){return db[_0x13ec('0x81')][_0x13ec('0x83')]({'where':{'FaxAccountId':_0x800d6a},'order':_0x13ec('0x84')})['then'](function(_0x53b9a){_0xefe75b=_0x53b9a;});}})[_0x13ec('0x5e')](function(_0x21f3ef){_0x5558ab=0x1f4;logger[_0x13ec('0x2c')](_0x21f3ef['stack']);if(_0x21f3ef['name']){delete _0x21f3ef[_0x13ec('0x3e')];}_0xefe75b=_0x21f3ef;})[_0x13ec('0x85')](function(){if(_0xefe75b===null){_0x4f0b77[_0x13ec('0x3d')](_0x5558ab);}else{if(_0x5558ab===0x1f4){_0x4f0b77[_0x13ec('0x2f')](_0x5558ab)[_0x13ec('0x3f')](_0xefe75b);}else{_0x4f0b77[_0x13ec('0x2f')](_0x5558ab)[_0x13ec('0x36')](_0xefe75b);}}});};exports[_0x13ec('0x86')]=function(_0x2f2a55,_0x5d244a,_0x92773){var _0x547ca9={};var _0x14b70d={};var _0x2a3cdc;var _0x5b8fce;return db[_0x13ec('0x56')][_0x13ec('0x72')]({'where':{'id':_0x2f2a55[_0x13ec('0x5a')]['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x5d244a,null))['then'](function(_0xf91e4a){if(_0xf91e4a){_0x2a3cdc=_0xf91e4a;_0x14b70d[_0x13ec('0x45')]=_[_0x13ec('0x47')](db[_0x13ec('0x81')][_0x13ec('0x42')]);_0x14b70d[_0x13ec('0x46')]=_[_0x13ec('0x47')](_0x2f2a55[_0x13ec('0x46')]);_0x14b70d['filters']=_[_0x13ec('0x5d')](_0x14b70d['model'],_0x14b70d['query']);_0x547ca9[_0x13ec('0x4a')]=_[_0x13ec('0x5d')](_0x14b70d[_0x13ec('0x45')],qs[_0x13ec('0x49')](_0x2f2a55['query']['fields']));_0x547ca9[_0x13ec('0x4a')]=_0x547ca9['attributes'][_0x13ec('0x4b')]?_0x547ca9[_0x13ec('0x4a')]:_0x14b70d[_0x13ec('0x45')];_0x547ca9[_0x13ec('0x4e')]=qs[_0x13ec('0x4f')](_0x2f2a55['query']['sort']);_0x547ca9['where']=qs[_0x13ec('0x48')](_[_0x13ec('0x51')](_0x2f2a55[_0x13ec('0x46')],_0x14b70d[_0x13ec('0x48')]));if(_0x2f2a55[_0x13ec('0x46')][_0x13ec('0x52')]){_0x547ca9['where']=_[_0x13ec('0x53')](_0x547ca9[_0x13ec('0x50')],{'$or':_[_0x13ec('0x41')](_0x547ca9[_0x13ec('0x4a')],function(_0x2d7446){var _0xdccaf3={};_0xdccaf3[_0x2d7446]={'$like':'%'+_0x2f2a55[_0x13ec('0x46')][_0x13ec('0x52')]+'%'};return _0xdccaf3;})});}_0x547ca9=_[_0x13ec('0x53')]({},_0x547ca9,_0x2f2a55['options']);return _0x2a3cdc['getApplications'](_0x547ca9);}})[_0x13ec('0x25')](function(_0x5a6eaf){if(_0x5a6eaf){_0x5b8fce=_0x5a6eaf[_0x13ec('0x4b')];if(!_0x2f2a55[_0x13ec('0x46')][_0x13ec('0x4c')](_0x13ec('0x4d'))){_0x547ca9[_0x13ec('0x34')]=qs['limit'](_0x2f2a55[_0x13ec('0x46')][_0x13ec('0x34')]);_0x547ca9[_0x13ec('0x31')]=qs[_0x13ec('0x31')](_0x2f2a55[_0x13ec('0x46')][_0x13ec('0x31')]);}return _0x2a3cdc[_0x13ec('0x86')](_0x547ca9);}})[_0x13ec('0x25')](function(_0x361677){if(_0x361677){return _0x361677?{'count':_0x5b8fce,'rows':_0x361677}:null;}})['then'](respondWithResult(_0x5d244a,null))[_0x13ec('0x5e')](handleError(_0x5d244a,null));};function Extension(_0x398b75,_0x3dcd2f,_0x2f5530,_0x1e82a8){this[_0x13ec('0x87')]=_0x13ec('0x88');this[_0x13ec('0x89')]=_0x398b75[_0x13ec('0x8a')];this[_0x13ec('0x8b')]=_0x1e82a8;this[_0x13ec('0x43')]=_0x13ec('0x8c');this[_0x13ec('0x8d')]=_0x13ec('0x8e');this[_0x13ec('0x6a')]=_0x398b75['id'];this[_0x13ec('0x84')]=_0x3dcd2f;this['appdata']=_0x2f5530;}function createExtensionsReciveFax(_0x17104d){var _0x4eb89c=0x1;var _0x5e72b3=[];_0x5e72b3[_0x13ec('0x8f')](new Extension(_0x17104d,_0x4eb89c,'',_0x13ec('0x90')));_0x4eb89c+=0x1;_0x5e72b3['push'](new Extension(_0x17104d,_0x4eb89c,_0x13ec('0x91'),_0x13ec('0x92')));_0x4eb89c+=0x1;for(var _0x42020f in _0x17104d){if(_0x17104d['hasOwnProperty'](_0x42020f)&&(_0x42020f==='ecm'||_0x42020f===_0x13ec('0x8a')||_0x42020f===_0x13ec('0x93')||_0x42020f===_0x13ec('0x94')||_0x42020f==='headerinfo'||_0x42020f===_0x13ec('0x95')||_0x42020f==='minrate'||_0x42020f===_0x13ec('0x96')||_0x42020f===_0x13ec('0x97'))){_0x5e72b3[_0x13ec('0x8f')](new Extension(_0x17104d,_0x4eb89c,_0x13ec('0x98')+_0x42020f+')='+_0x17104d[_0x42020f],_0x13ec('0x92')));_0x4eb89c+=0x1;}}_0x5e72b3[_0x13ec('0x8f')](new Extension(_0x17104d,_0x4eb89c,'6',_0x13ec('0x99')));_0x4eb89c+=0x1;_0x5e72b3['push'](new Extension(_0x17104d,_0x4eb89c,'/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'));_0x4eb89c=0x0;return _0x5e72b3;}exports[_0x13ec('0x9a')]=function(_0xe732d8,_0xded50a,_0x3e1fea){var _0x2ebf8c;return db['sequelize']['transaction'](function(_0x502a1c){return db[_0x13ec('0x56')][_0x13ec('0x5f')](_0xe732d8[_0x13ec('0x67')],{'transaction':_0x502a1c})[_0x13ec('0x25')](function(_0x54c985){_0x2ebf8c=_0x54c985['get']({'plain':!![]});return db[_0x13ec('0x9b')][_0x13ec('0x82')](createExtensionsReciveFax(_0x2ebf8c),{'transaction':_0x502a1c});});})[_0x13ec('0x25')](function(){return _0x2ebf8c;})[_0x13ec('0x25')](respondWithResult(_0xded50a,null))[_0x13ec('0x5e')](handleError(_0xded50a,null));};exports['updateAccountApplications']=function(_0x24dcd0,_0xf9cf00,_0x2b1437){var _0x2d67ec;return db[_0x13ec('0x7e')][_0x13ec('0x7d')](function(_0x539c9c){return db[_0x13ec('0x56')][_0x13ec('0x66')](_0x24dcd0[_0x13ec('0x67')],{'where':{'id':_0x24dcd0['body']['id']},'transaction':_0x539c9c})[_0x13ec('0x25')](function(_0x144a5c){return db['VoiceExtension'][_0x13ec('0x39')]({'where':{'FaxAccountId':_0x24dcd0[_0x13ec('0x67')]['id']},'transaction':_0x539c9c})[_0x13ec('0x25')](function(_0x48e785){return db[_0x13ec('0x9b')][_0x13ec('0x82')](createExtensionsReciveFax(_[_0x13ec('0x9c')](_0x24dcd0[_0x13ec('0x67')],[_0x13ec('0x9d'),_0x13ec('0x44'),'createdAt','updatedAt',_0x13ec('0x9e'),_0x13ec('0x9f')])),{'transaction':_0x539c9c});});});})[_0x13ec('0x25')](function(){return db[_0x13ec('0x56')][_0x13ec('0xa0')](_0x24dcd0[_0x13ec('0x67')]['id']);})[_0x13ec('0x25')](respondWithResult(_0xf9cf00,null))[_0x13ec('0x5e')](handleError(_0xf9cf00,null));};exports['getMessages']=function(_0x8a68a4,_0x5d92ec,_0x1f2d72){var _0x2bccd8={'raw':!![],'where':{}};var _0x48e623={};var _0x4d2b46={'count':0x0,'rows':[]};return db['FaxAccount'][_0x13ec('0x72')]({'where':{'id':_0x8a68a4['params']['id']}})['then'](handleEntityNotFound(_0x5d92ec,null))[_0x13ec('0x25')](function(_0x4b8eae){if(_0x4b8eae){_0x48e623[_0x13ec('0x45')]=_['keys'](db[_0x13ec('0xa1')][_0x13ec('0x42')]);_0x48e623[_0x13ec('0x46')]=_['keys'](_0x8a68a4['query']);_0x48e623[_0x13ec('0x48')]=_['intersection'](_0x48e623[_0x13ec('0x45')],_0x48e623[_0x13ec('0x46')]);_0x2bccd8[_0x13ec('0x4a')]=_['intersection'](_0x48e623[_0x13ec('0x45')],qs[_0x13ec('0x49')](_0x8a68a4['query'][_0x13ec('0x49')]));_0x2bccd8[_0x13ec('0x4a')]=_0x2bccd8[_0x13ec('0x4a')][_0x13ec('0x4b')]?_0x2bccd8[_0x13ec('0x4a')]:_0x48e623['model'];if(!_0x8a68a4[_0x13ec('0x46')]['hasOwnProperty'](_0x13ec('0x4d'))){_0x2bccd8[_0x13ec('0x34')]=qs[_0x13ec('0x34')](_0x8a68a4[_0x13ec('0x46')][_0x13ec('0x34')]);_0x2bccd8['offset']=qs[_0x13ec('0x31')](_0x8a68a4[_0x13ec('0x46')][_0x13ec('0x31')]);}_0x2bccd8['order']=qs[_0x13ec('0x4f')](_0x8a68a4['query'][_0x13ec('0x4f')]);_0x2bccd8[_0x13ec('0x50')]=qs[_0x13ec('0x48')](_[_0x13ec('0x51')](_0x8a68a4[_0x13ec('0x46')],_0x48e623[_0x13ec('0x48')]));_0x2bccd8[_0x13ec('0x50')]['FaxAccountId']=_0x4b8eae['id'];if(_0x8a68a4['query'][_0x13ec('0x52')]){_0x2bccd8[_0x13ec('0x50')]=_['merge'](_0x2bccd8[_0x13ec('0x50')],{'$or':_['map'](_0x2bccd8[_0x13ec('0x4a')],function(_0x3d5c52){var _0x5516cc={};_0x5516cc[_0x3d5c52]={'$like':'%'+_0x8a68a4[_0x13ec('0x46')][_0x13ec('0x52')]+'%'};return _0x5516cc;})});}if(_0x8a68a4[_0x13ec('0x46')]['$gte']){var _0x4927c5=_0x8a68a4[_0x13ec('0x46')][_0x13ec('0xa2')]['split'](',');var _0x57bd18={};_0x57bd18[_0x4927c5[0x0]]={'$gte':moment(_0x4927c5[0x1])[_0x13ec('0xa3')](_0x13ec('0xa4'))};_0x2bccd8[_0x13ec('0x50')]=_['merge'](_0x2bccd8[_0x13ec('0x50')],_0x57bd18);}_0x2bccd8=_[_0x13ec('0x53')]({},_0x2bccd8,_0x8a68a4['options']);return db[_0x13ec('0xa1')][_0x13ec('0x33')]({'where':_0x2bccd8['where']})[_0x13ec('0x25')](function(_0x2f9dc7){_0x4d2b46[_0x13ec('0x33')]=_0x2f9dc7;if(_0x8a68a4[_0x13ec('0x46')][_0x13ec('0x57')]){_0x2bccd8[_0x13ec('0x58')]=[{'all':!![]}];}return db[_0x13ec('0xa1')][_0x13ec('0x59')](_0x2bccd8);})[_0x13ec('0x25')](function(_0x58c502){_0x4d2b46[_0x13ec('0x6d')]=_0x58c502;return _0x4d2b46;});}})['then'](respondWithFilteredResult(_0x5d92ec,_0x2bccd8))[_0x13ec('0x5e')](handleError(_0x5d92ec,null));};exports[_0x13ec('0x3f')]=function(_0x2cd082,_0x6f3528,_0x5e8717){var _0x1fc929,_0x11fa7a={},_0x1704e2;if(_0x2cd082[_0x13ec('0x67')]['to']){_0x1704e2=_0x2cd082[_0x13ec('0x67')]['to'][0x0];}return db[_0x13ec('0x56')][_0x13ec('0x63')]({'where':{'id':_0x2cd082[_0x13ec('0x5a')]['id']},'include':[{'model':db[_0x13ec('0xa5')],'as':'List','include':[{'model':db[_0x13ec('0x77')],'as':_0x13ec('0xa6'),'where':{'fax':_0x1704e2},'limit':0x1,'order':[['updatedAt',_0x13ec('0xa7')]]}]}]})[_0x13ec('0x25')](handleEntityNotFound(_0x6f3528,null))[_0x13ec('0x25')](function(_0x19919e){_0x1fc929=_0x19919e;if(_0x2cd082[_0x13ec('0x67')][_0x13ec('0xa8')]&&_0x2cd082[_0x13ec('0x67')][_0x13ec('0xa8')]['length']){for(var _0x5bbe39=0x0;_0x5bbe39<_0x2cd082[_0x13ec('0x67')]['attachments']['length'];_0x5bbe39+=0x1){_0x2cd082['body'][_0x13ec('0xa8')][_0x5bbe39]={'filename':_0x2cd082[_0x13ec('0x67')]['attachments'][_0x5bbe39][_0x13ec('0x3e')],'id':_0x2cd082[_0x13ec('0x67')][_0x13ec('0xa8')][_0x5bbe39]['id'],'path':path[_0x13ec('0xa9')](config[_0x13ec('0xaa')],_0x13ec('0xab'),_0x2cd082[_0x13ec('0x67')]['attachments'][_0x5bbe39][_0x13ec('0xac')])};}}return respondWithRpcPromise('CheckAfterSend',_0x13ec('0xad'),{'FaxAccountId':_[_0x13ec('0xae')](_0x2cd082[_0x13ec('0x5a')]['id'])?undefined:_0x2cd082[_0x13ec('0x5a')]['id'],'path':_[_0x13ec('0xae')](_0x2cd082['body'][_0x13ec('0xa8')][0x0][_0x13ec('0x8')])?undefined:_0x2cd082[_0x13ec('0x67')]['attachments'][0x0]['path'],'fax':_[_0x13ec('0xae')](_0x2cd082[_0x13ec('0x67')]['to'][0x0])?undefined:_0x2cd082[_0x13ec('0x67')]['to'][0x0]},client9002);})[_0x13ec('0x25')](function(){if(_0x1fc929){if(_['isNil'](_0x2cd082[_0x13ec('0x67')][_0x13ec('0xaf')])){_0x2cd082['body'][_0x13ec('0xaf')]=util[_0x13ec('0xa3')](_0x13ec('0xb0'),_0x1fc929[_0x13ec('0x3e')],_0x1fc929[_0x13ec('0xb1')]);}if(_0x1fc929[_0x13ec('0xb2')]){if(_0x1fc929['List'][_0x13ec('0xa6')]['length']){return _0x1fc929[_0x13ec('0xb2')]['Contacts'][0x0];}else{return db[_0x13ec('0x77')]['create'](_['defaults'](_0x2cd082['body'],{'firstName':_0x2cd082[_0x13ec('0x67')]['to'][0x0],'phone':_0x2cd082[_0x13ec('0x67')]['to'][0x0],'fax':_0x2cd082['body']['to'][0x0],'ListId':_0x1fc929['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x13ec('0xb3'));}})[_0x13ec('0x25')](function(_0x18a640){if(_0x18a640){return db['FaxInteraction']['find']({'where':{'ContactId':_0x18a640['id'],'closed':![],'FaxAccountId':_0x1fc929['id']}})[_0x13ec('0x25')](function(_0x182649){if(_0x182649){return[_0x182649,![]];}return db[_0x13ec('0x74')][_0x13ec('0x5f')]({'UserId':_0x2cd082['user']['id'],'ContactId':_0x18a640['id'],'FaxAccountId':_0x1fc929['id'],'fax':_0x2cd082['body']['to'][0x0],'firstMsgDirection':_0x13ec('0xb4'),'Messages':[_[_0x13ec('0x53')](_0x2cd082['body'],{'read':![],'body':_0x2cd082['body'][_0x13ec('0xa8')][0x0][_0x13ec('0xb5')],'FaxAccountId':_0x1fc929['id'],'UserId':_0x2cd082[_0x13ec('0x61')]['id'],'ContactId':_0x18a640['id'],'AttachmentId':_0x2cd082['body'][_0x13ec('0xa8')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x13ec('0xb6')}]})['then'](function(_0x135bad){return[_0x135bad,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x13ec('0xb7')](function(_0x31ab1a,_0x551c7d){if(_0x551c7d){return _0x31ab1a;}return db['FaxMessage'][_0x13ec('0x5f')]({'direction':_0x13ec('0xb4'),'read':![],'body':_0x2cd082[_0x13ec('0x67')][_0x13ec('0xa8')][0x0][_0x13ec('0xb5')],'FaxAccountId':_0x1fc929['id'],'FaxInteractionId':_0x31ab1a['id'],'UserId':_0x2cd082[_0x13ec('0x61')]['id'],'ContactId':_0x31ab1a[_0x13ec('0xb8')],'AttachmentId':_0x2cd082['body'][_0x13ec('0xa8')][0x0]['id']})['then'](function(_0x52f0a4){_0x31ab1a['dataValues'][_0x13ec('0xb6')]=[];_0x31ab1a[_0x13ec('0xb9')][_0x13ec('0xb6')][_0x13ec('0x8f')](_0x52f0a4[_0x13ec('0xb9')]);return _0x31ab1a;});})['then'](function(_0x4a2261){respondWithRpcPromise('SendFax',_0x13ec('0xba'),{'FaxAccountId':_['isNil'](_0x2cd082[_0x13ec('0x5a')]['id'])?undefined:_0x2cd082['params']['id'],'path':_[_0x13ec('0xae')](_0x2cd082['body']['attachments'][0x0]['path'])?undefined:_0x2cd082[_0x13ec('0x67')][_0x13ec('0xa8')][0x0][_0x13ec('0x8')],'fax':_[_0x13ec('0xae')](_0x2cd082['body']['to'][0x0])?undefined:_0x2cd082[_0x13ec('0x67')]['to'][0x0],'AttachmentId':_0x2cd082[_0x13ec('0x67')]['attachments'][0x0]['id']},client9002)['then'](function(_0x2ae4e2){logger['info'](_0x13ec('0xbb'),_0x2ae4e2);})[_0x13ec('0x5e')](function(_0xc325e9){logger['info']('SendFaxRpc,\x20%s',_0xc325e9);});return _0x4a2261;})['then'](respondWithResult(_0x6f3528,null))[_0x13ec('0x5e')](handleError(_0x6f3528,null));};exports[_0x13ec('0xbc')]=function(_0xbea0f9,_0x369780,_0xb68e3){return db['FaxAccount'][_0x13ec('0x63')]({'where':{'id':_0xbea0f9['params']['id']}})['then'](handleEntityNotFound(_0x369780,null))[_0x13ec('0x25')](function(_0x3ebc86){if(_0x3ebc86){return _0x3ebc86[_0x13ec('0xbc')](_0xbea0f9['body']['ids'],_[_0x13ec('0x9c')](_0xbea0f9[_0x13ec('0x67')],['ids','id'])||{})[_0x13ec('0xb7')](function(_0x582572){for(var _0xf68dfc=0x0;_0xf68dfc<_0xbea0f9['body'][_0x13ec('0x6f')][_0x13ec('0x4b')];_0xf68dfc+=0x1){socket[_0x13ec('0xbd')](_0x13ec('0xbe'),{'UserId':Number(_0xbea0f9[_0x13ec('0x67')]['ids'][_0xf68dfc]),'FaxAccountId':Number(_0xbea0f9['params']['id'])});}return _0x582572;});}})['then'](respondWithResult(_0x369780,null))[_0x13ec('0x5e')](handleError(_0x369780,null));};exports['removeAgents']=function(_0x51253c,_0x3b3844,_0x253887){return db[_0x13ec('0x56')][_0x13ec('0x63')]({'where':{'id':_0x51253c['params']['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x3b3844,null))[_0x13ec('0x25')](function(_0x56d596){if(_0x56d596){return _0x56d596[_0x13ec('0xbf')](_0x51253c['query']['ids'])[_0x13ec('0x25')](function(){if(_[_0x13ec('0xc0')](_0x51253c[_0x13ec('0x46')][_0x13ec('0x6f')])){for(var _0xa59857=0x0;_0xa59857<_0x51253c[_0x13ec('0x46')][_0x13ec('0x6f')][_0x13ec('0x4b')];_0xa59857+=0x1){socket[_0x13ec('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x51253c[_0x13ec('0x46')]['ids'][_0xa59857]),'FaxAccountId':Number(_0x51253c[_0x13ec('0x5a')]['id'])});}}else{socket[_0x13ec('0xbd')](_0x13ec('0xc1'),{'UserId':Number(_0x51253c['query']['ids']),'FaxAccountId':Number(_0x51253c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3b3844,null))[_0x13ec('0x5e')](handleError(_0x3b3844,null));};exports[_0x13ec('0xc2')]=function(_0x4b72ba,_0x1a13c4,_0x120e44){var _0xa40a8e={};var _0x2f1963={};var _0x488cd4;var _0x393b75;return db['FaxAccount'][_0x13ec('0x72')]({'where':{'id':_0x4b72ba[_0x13ec('0x5a')]['id']}})[_0x13ec('0x25')](handleEntityNotFound(_0x1a13c4,null))[_0x13ec('0x25')](function(_0x11ed0f){if(_0x11ed0f){_0x488cd4=_0x11ed0f;_0x2f1963[_0x13ec('0x45')]=_[_0x13ec('0x47')](db[_0x13ec('0xc3')][_0x13ec('0x42')]);_0x2f1963[_0x13ec('0x46')]=_[_0x13ec('0x47')](_0x4b72ba['query']);_0x2f1963[_0x13ec('0x48')]=_[_0x13ec('0x5d')](_0x2f1963[_0x13ec('0x45')],_0x2f1963[_0x13ec('0x46')]);_0xa40a8e[_0x13ec('0x4a')]=_[_0x13ec('0x5d')](_0x2f1963[_0x13ec('0x45')],qs[_0x13ec('0x49')](_0x4b72ba[_0x13ec('0x46')]['fields']));_0xa40a8e[_0x13ec('0x4a')]=_0xa40a8e[_0x13ec('0x4a')][_0x13ec('0x4b')]?_0xa40a8e[_0x13ec('0x4a')]:_0x2f1963[_0x13ec('0x45')];_0xa40a8e[_0x13ec('0x4e')]=qs[_0x13ec('0x4f')](_0x4b72ba[_0x13ec('0x46')][_0x13ec('0x4f')]);_0xa40a8e[_0x13ec('0x50')]=qs[_0x13ec('0x48')](_[_0x13ec('0x51')](_0x4b72ba[_0x13ec('0x46')],_0x2f1963[_0x13ec('0x48')]));if(_0x4b72ba[_0x13ec('0x46')][_0x13ec('0x52')]){_0xa40a8e[_0x13ec('0x50')]=_[_0x13ec('0x53')](_0xa40a8e[_0x13ec('0x50')],{'$or':_[_0x13ec('0x41')](_0xa40a8e['attributes'],function(_0x3a19e9){var _0x3a246e={};_0x3a246e[_0x3a19e9]={'$like':'%'+_0x4b72ba['query']['filter']+'%'};return _0x3a246e;})});}_0xa40a8e=_[_0x13ec('0x53')]({},_0xa40a8e,_0x4b72ba[_0x13ec('0x55')]);return _0x488cd4[_0x13ec('0xc2')](_0xa40a8e);}})[_0x13ec('0x25')](function(_0x38ccfa){if(_0x38ccfa){_0x393b75=_0x38ccfa['length'];if(!_0x4b72ba['query']['hasOwnProperty'](_0x13ec('0x4d'))){_0xa40a8e[_0x13ec('0x34')]=qs[_0x13ec('0x34')](_0x4b72ba['query'][_0x13ec('0x34')]);_0xa40a8e[_0x13ec('0x31')]=qs[_0x13ec('0x31')](_0x4b72ba[_0x13ec('0x46')][_0x13ec('0x31')]);}return _0x488cd4[_0x13ec('0xc2')](_0xa40a8e);}})[_0x13ec('0x25')](function(_0x45a972){if(_0x45a972){return _0x45a972?{'count':_0x393b75,'rows':_0x45a972}:null;}})['then'](respondWithResult(_0x1a13c4,null))[_0x13ec('0x5e')](handleError(_0x1a13c4,null));}; \ No newline at end of file +var _0x3e3f=['context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','minrate','modem','t38timeout','FAXOPT(','/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','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Contact\x20not\x20found','spread','filename','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','index','Pause','map','FaxAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','addDisposition','FaxAccountId','Disposition','findOne','hasOwnProperty','pick','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','nolimit','CmContact','User','Owner','fullname','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications'];(function(_0x1f4acf,_0x4ea06c){var _0x25ea54=function(_0x5b2c90){while(--_0x5b2c90){_0x1f4acf['push'](_0x1f4acf['shift']());}};_0x25ea54(++_0x4ea06c);}(_0x3e3f,0xf6));var _0xf3e3=function(_0x2ca128,_0x2bc65e){_0x2ca128=_0x2ca128-0x0;var _0x47a7ea=_0x3e3f[_0x2ca128];return _0x47a7ea;};'use strict';var emlformat=require(_0xf3e3('0x0'));var rimraf=require(_0xf3e3('0x1'));var zipdir=require(_0xf3e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3e3('0x3'));var moment=require(_0xf3e3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf3e3('0x5'));var path=require(_0xf3e3('0x6'));var sox=require(_0xf3e3('0x7'));var csv=require('to-csv');var ejs=require(_0xf3e3('0x8'));var fs=require('fs');var fs_extra=require(_0xf3e3('0x9'));var _=require(_0xf3e3('0xa'));var squel=require(_0xf3e3('0xb'));var crypto=require('crypto');var jsforce=require(_0xf3e3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf3e3('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf3e3('0xe'));var authService=require(_0xf3e3('0xf'));var qs=require(_0xf3e3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3e3('0x11'))('api');var utils=require(_0xf3e3('0x12'));var config=require(_0xf3e3('0x13'));var licenseUtil=require(_0xf3e3('0x14'));var db=require('../../mysqldb')['db'];config[_0xf3e3('0x15')]=_[_0xf3e3('0x16')](config['redis'],{'host':_0xf3e3('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3e3('0x15')]));require('./faxAccount.socket')[_0xf3e3('0x18')](socket);var jayson=require(_0xf3e3('0x19'));var client=jayson[_0xf3e3('0x1a')][_0xf3e3('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xf3e3('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1f8bf3,_0x1ad80d,_0x1218c5,_0x53883c){return new BPromise(function(_0x27d14a,_0x3fa3b8){var _0x3925e0=_0x53883c||client;return _0x3925e0[_0xf3e3('0x1c')](_0x1f8bf3,_0x1218c5)[_0xf3e3('0x1d')](function(_0x24372d){logger[_0xf3e3('0x1e')](_0xf3e3('0x1f'),_0x1ad80d,_0xf3e3('0x20'));logger[_0xf3e3('0x21')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1ad80d,_0xf3e3('0x20'),JSON[_0xf3e3('0x22')](_0x24372d));if(_0x24372d[_0xf3e3('0x23')]){if(_0x24372d[_0xf3e3('0x23')][_0xf3e3('0x24')]===0x1f4){logger[_0xf3e3('0x23')]('FaxAccount,\x20%s,\x20%s',_0x1ad80d,_0x24372d[_0xf3e3('0x23')][_0xf3e3('0x25')]);return _0x3fa3b8(_0x24372d[_0xf3e3('0x23')][_0xf3e3('0x25')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1ad80d,_0x24372d[_0xf3e3('0x23')]['message']);return _0x27d14a(_0x24372d[_0xf3e3('0x23')][_0xf3e3('0x25')]);}else{logger[_0xf3e3('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x1ad80d,_0xf3e3('0x20'));_0x27d14a(_0x24372d[_0xf3e3('0x26')]['message']);}})[_0xf3e3('0x27')](function(_0x282c0b){logger[_0xf3e3('0x23')](_0xf3e3('0x1f'),_0x1ad80d,_0x282c0b);_0x3fa3b8(_0x282c0b);});});}function respondWithStatusCode(_0x25395a,_0x4fca44){_0x4fca44=_0x4fca44||0xcc;return function(_0x566a8e){if(_0x566a8e){return _0x25395a['sendStatus'](_0x4fca44);}return _0x25395a[_0xf3e3('0x28')](_0x4fca44)[_0xf3e3('0x29')]();};}function respondWithResult(_0x5f13bc,_0x1a08ca){_0x1a08ca=_0x1a08ca||0xc8;return function(_0x409fa9){if(_0x409fa9){return _0x5f13bc[_0xf3e3('0x28')](_0x1a08ca)[_0xf3e3('0x2a')](_0x409fa9);}};}function respondWithFilteredResult(_0x24495f,_0x5d212f){return function(_0x569b19){if(_0x569b19){var _0x14bf18=typeof _0x5d212f[_0xf3e3('0x2b')]===_0xf3e3('0x2c')&&typeof _0x5d212f[_0xf3e3('0x2d')]===_0xf3e3('0x2c');var _0x57008b=_0x569b19[_0xf3e3('0x2e')];var _0x430681=_0x14bf18?0x0:_0x5d212f[_0xf3e3('0x2b')];var _0x344c02=_0x14bf18?_0x569b19[_0xf3e3('0x2e')]:_0x5d212f[_0xf3e3('0x2b')]+_0x5d212f[_0xf3e3('0x2d')];var _0x184ddb;if(_0x344c02>=_0x57008b){_0x344c02=_0x57008b;_0x184ddb=0xc8;}else{_0x184ddb=0xce;}_0x24495f['status'](_0x184ddb);return _0x24495f[_0xf3e3('0x2f')](_0xf3e3('0x30'),_0x430681+'-'+_0x344c02+'/'+_0x57008b)[_0xf3e3('0x2a')](_0x569b19);}return null;};}function patchUpdates(_0x4347e1){return function(_0x1301f1){try{jsonpatch['apply'](_0x1301f1,_0x4347e1,!![]);}catch(_0x50645c){return BPromise['reject'](_0x50645c);}return _0x1301f1[_0xf3e3('0x31')]();};}function saveUpdates(_0x45f2bf,_0x925ac){return function(_0x3bfe32){if(_0x3bfe32){return _0x3bfe32[_0xf3e3('0x32')](_0x45f2bf)['then'](function(_0x58a0a8){return _0x58a0a8;});}return null;};}function removeEntity(_0x3881ba,_0x402920){return function(_0x34ee6c){if(_0x34ee6c){return _0x34ee6c[_0xf3e3('0x33')]()[_0xf3e3('0x1d')](function(){var _0x458ff9=_0x34ee6c[_0xf3e3('0x34')]({'plain':!![]});var _0x130ff1=_0xf3e3('0x35');return db[_0xf3e3('0x36')]['destroy']({'where':{'type':_0x130ff1,'resourceId':_0x458ff9['id']}})[_0xf3e3('0x1d')](function(){return _0x34ee6c;});})[_0xf3e3('0x1d')](function(){_0x3881ba[_0xf3e3('0x28')](0xcc)[_0xf3e3('0x29')]();});}};}function handleEntityNotFound(_0x30518b,_0x53d46c){return function(_0x54adfd){if(!_0x54adfd){_0x30518b[_0xf3e3('0x37')](0x194);}return _0x54adfd;};}function handleError(_0x737da1,_0x2ec8f1){_0x2ec8f1=_0x2ec8f1||0x1f4;return function(_0x33a2c1){logger[_0xf3e3('0x23')](_0x33a2c1['stack']);if(_0x33a2c1[_0xf3e3('0x38')]){delete _0x33a2c1['name'];}_0x737da1[_0xf3e3('0x28')](_0x2ec8f1)[_0xf3e3('0x39')](_0x33a2c1);};}exports[_0xf3e3('0x3a')]=function(_0x2bd182,_0x318b04){var _0x24e425={'include':[{'model':db[_0xf3e3('0x3b')],'as':'mandatoryDispositionPause'}]},_0xd45f7={},_0x61dfdc={'count':0x0,'rows':[]};var _0x25e08c=_[_0xf3e3('0x3c')](db[_0xf3e3('0x3d')][_0xf3e3('0x3e')],function(_0x2f01bd){return{'name':_0x2f01bd['fieldName'],'type':_0x2f01bd[_0xf3e3('0x3f')][_0xf3e3('0x40')]};});_0xd45f7[_0xf3e3('0x41')]=_[_0xf3e3('0x3c')](_0x25e08c,_0xf3e3('0x38'));_0xd45f7['query']=_[_0xf3e3('0x42')](_0x2bd182[_0xf3e3('0x43')]);_0xd45f7[_0xf3e3('0x44')]=_[_0xf3e3('0x45')](_0xd45f7[_0xf3e3('0x41')],_0xd45f7[_0xf3e3('0x43')]);_0x24e425[_0xf3e3('0x46')]=_['intersection'](_0xd45f7[_0xf3e3('0x41')],qs[_0xf3e3('0x47')](_0x2bd182[_0xf3e3('0x43')][_0xf3e3('0x47')]));_0x24e425[_0xf3e3('0x46')]=_0x24e425['attributes'][_0xf3e3('0x48')]?_0x24e425[_0xf3e3('0x46')]:_0xd45f7['model'];if(!_0x2bd182[_0xf3e3('0x43')]['hasOwnProperty']('nolimit')){_0x24e425[_0xf3e3('0x2d')]=qs[_0xf3e3('0x2d')](_0x2bd182['query'][_0xf3e3('0x2d')]);_0x24e425['offset']=qs[_0xf3e3('0x2b')](_0x2bd182[_0xf3e3('0x43')][_0xf3e3('0x2b')]);}_0x24e425[_0xf3e3('0x49')]=qs[_0xf3e3('0x4a')](_0x2bd182[_0xf3e3('0x43')][_0xf3e3('0x4a')]);_0x24e425[_0xf3e3('0x4b')]=qs[_0xf3e3('0x44')](_['pick'](_0x2bd182[_0xf3e3('0x43')],_0xd45f7[_0xf3e3('0x44')]),_0x25e08c);if(_0x2bd182[_0xf3e3('0x43')][_0xf3e3('0x4c')]){_0x24e425[_0xf3e3('0x4b')]=_[_0xf3e3('0x4d')](_0x24e425[_0xf3e3('0x4b')],{'$or':_[_0xf3e3('0x3c')](_0x25e08c,function(_0x4f6205){if(_0x4f6205[_0xf3e3('0x3f')]!=='VIRTUAL'){var _0x224c52={};_0x224c52[_0x4f6205[_0xf3e3('0x38')]]={'$like':'%'+_0x2bd182[_0xf3e3('0x43')][_0xf3e3('0x4c')]+'%'};return _0x224c52;}})});}_0x24e425=_[_0xf3e3('0x4d')]({},_0x24e425,_0x2bd182[_0xf3e3('0x4e')]);var _0xe167f0={'where':_0x24e425[_0xf3e3('0x4b')]};return db[_0xf3e3('0x3d')][_0xf3e3('0x2e')](_0xe167f0)[_0xf3e3('0x1d')](function(_0x513374){_0x61dfdc[_0xf3e3('0x2e')]=_0x513374;if(_0x2bd182[_0xf3e3('0x43')][_0xf3e3('0x4f')]){_0x24e425[_0xf3e3('0x50')]=[{'all':!![]}];}return db[_0xf3e3('0x3d')][_0xf3e3('0x51')](_0x24e425);})[_0xf3e3('0x1d')](function(_0x279dee){_0x61dfdc[_0xf3e3('0x52')]=_0x279dee;return _0x61dfdc;})['then'](respondWithFilteredResult(_0x318b04,_0x24e425))['catch'](handleError(_0x318b04,null));};exports[_0xf3e3('0x53')]=function(_0xc9660b,_0x275c8e){var _0x1fffc0={'raw':![],'where':{'id':_0xc9660b[_0xf3e3('0x54')]['id']},'include':[{'model':db[_0xf3e3('0x3b')],'as':'mandatoryDispositionPause'}]},_0xbfadeb={};_0xbfadeb[_0xf3e3('0x41')]=_[_0xf3e3('0x42')](db[_0xf3e3('0x3d')][_0xf3e3('0x3e')]);_0xbfadeb[_0xf3e3('0x43')]=_[_0xf3e3('0x42')](_0xc9660b['query']);_0xbfadeb[_0xf3e3('0x44')]=_[_0xf3e3('0x45')](_0xbfadeb['model'],_0xbfadeb[_0xf3e3('0x43')]);_0x1fffc0['attributes']=_[_0xf3e3('0x45')](_0xbfadeb[_0xf3e3('0x41')],qs['fields'](_0xc9660b[_0xf3e3('0x43')][_0xf3e3('0x47')]));_0x1fffc0[_0xf3e3('0x46')]=_0x1fffc0[_0xf3e3('0x46')]['length']?_0x1fffc0[_0xf3e3('0x46')]:_0xbfadeb[_0xf3e3('0x41')];if(_0xc9660b[_0xf3e3('0x43')][_0xf3e3('0x4f')]){_0x1fffc0[_0xf3e3('0x50')]=[{'all':!![]}];}_0x1fffc0=_['merge']({},_0x1fffc0,_0xc9660b[_0xf3e3('0x4e')]);return db['FaxAccount'][_0xf3e3('0x55')](_0x1fffc0)['then'](handleEntityNotFound(_0x275c8e,null))[_0xf3e3('0x1d')](respondWithResult(_0x275c8e,null))[_0xf3e3('0x27')](handleError(_0x275c8e,null));};exports[_0xf3e3('0x56')]=function(_0x350d45,_0x57bb02){return db[_0xf3e3('0x3d')][_0xf3e3('0x56')](_0x350d45[_0xf3e3('0x57')],{})[_0xf3e3('0x1d')](function(_0x2f8864){var _0x2032cf=_0x350d45[_0xf3e3('0x58')]['get']({'plain':!![]});if(!_0x2032cf)throw new Error(_0xf3e3('0x59'));if(_0x2032cf['role']===_0xf3e3('0x58')){var _0x315cfa=_0x2f8864[_0xf3e3('0x34')]({'plain':!![]});var _0x574c54=_0xf3e3('0x35');return db[_0xf3e3('0x5a')][_0xf3e3('0x55')]({'where':{'name':_0x574c54,'userProfileId':_0x2032cf[_0xf3e3('0x5b')]},'raw':!![]})['then'](function(_0xe4d6ad){if(_0xe4d6ad&&_0xe4d6ad['autoAssociation']===0x0){return db['UserProfileResource'][_0xf3e3('0x56')]({'name':_0x315cfa[_0xf3e3('0x38')],'resourceId':_0x315cfa['id'],'type':_0xe4d6ad[_0xf3e3('0x38')],'sectionId':_0xe4d6ad['id']},{})[_0xf3e3('0x1d')](function(){return _0x2f8864;});}else{return _0x2f8864;}})['catch'](function(_0x5e024d){logger[_0xf3e3('0x23')](_0xf3e3('0x5c'),_0x5e024d);throw _0x5e024d;});}return _0x2f8864;})[_0xf3e3('0x1d')](respondWithResult(_0x57bb02,0xc9))[_0xf3e3('0x27')](handleError(_0x57bb02,null));};exports[_0xf3e3('0x32')]=function(_0x246c0b,_0x194dcc){if(_0x246c0b[_0xf3e3('0x57')]['id']){delete _0x246c0b['body']['id'];}return db[_0xf3e3('0x3d')][_0xf3e3('0x55')]({'where':{'id':_0x246c0b['params']['id']},'include':[{'model':db[_0xf3e3('0x3b')],'as':_0xf3e3('0x5d')}]})[_0xf3e3('0x1d')](handleEntityNotFound(_0x194dcc,null))[_0xf3e3('0x1d')](saveUpdates(_0x246c0b[_0xf3e3('0x57')],null))[_0xf3e3('0x1d')](respondWithResult(_0x194dcc,null))['catch'](handleError(_0x194dcc,null));};exports[_0xf3e3('0x33')]=function(_0x2aca65,_0x1d58ac){return db[_0xf3e3('0x3d')][_0xf3e3('0x55')]({'where':{'id':_0x2aca65['params']['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x1d58ac,null))[_0xf3e3('0x1d')](removeEntity(_0x1d58ac,null))[_0xf3e3('0x27')](handleError(_0x1d58ac,null));};exports['describe']=function(_0x4318a6,_0x3a83e9){return db[_0xf3e3('0x3d')]['describe']()[_0xf3e3('0x1d')](respondWithResult(_0x3a83e9,null))[_0xf3e3('0x27')](handleError(_0x3a83e9,null));};exports[_0xf3e3('0x5e')]=function(_0x552d74,_0x14ae66,_0x148202){if(_0x552d74[_0xf3e3('0x57')]['id']){delete _0x552d74[_0xf3e3('0x57')]['id'];}return db[_0xf3e3('0x3d')][_0xf3e3('0x55')]({'where':{'id':_0x552d74[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x14ae66,null))[_0xf3e3('0x1d')](function(_0x44895e){if(_0x44895e){_0x552d74[_0xf3e3('0x57')][_0xf3e3('0x5f')]=_0x44895e['id'];return db[_0xf3e3('0x60')][_0xf3e3('0x56')](_0x552d74['body']);}})[_0xf3e3('0x1d')](respondWithResult(_0x14ae66,null))[_0xf3e3('0x27')](handleError(_0x14ae66,null));};exports['getDispositions']=function(_0x1b7380,_0x450bff,_0x3aef31){var _0x27298b={'raw':![],'where':{}};var _0x457fa2={};var _0x107e1d={'count':0x0,'rows':[]};return db[_0xf3e3('0x3d')][_0xf3e3('0x61')]({'where':{'id':_0x1b7380[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x450bff,null))[_0xf3e3('0x1d')](function(_0x521a84){if(_0x521a84){_0x457fa2['model']=_[_0xf3e3('0x42')](db[_0xf3e3('0x60')][_0xf3e3('0x3e')]);_0x457fa2['query']=_['keys'](_0x1b7380[_0xf3e3('0x43')]);_0x457fa2[_0xf3e3('0x44')]=_['intersection'](_0x457fa2[_0xf3e3('0x41')],_0x457fa2['query']);_0x27298b[_0xf3e3('0x46')]=_[_0xf3e3('0x45')](_0x457fa2[_0xf3e3('0x41')],qs['fields'](_0x1b7380[_0xf3e3('0x43')][_0xf3e3('0x47')]));_0x27298b['attributes']=_0x27298b['attributes'][_0xf3e3('0x48')]?_0x27298b[_0xf3e3('0x46')]:_0x457fa2[_0xf3e3('0x41')];if(!_0x1b7380['query'][_0xf3e3('0x62')]('nolimit')){_0x27298b[_0xf3e3('0x2d')]=qs['limit'](_0x1b7380['query'][_0xf3e3('0x2d')]);_0x27298b[_0xf3e3('0x2b')]=qs[_0xf3e3('0x2b')](_0x1b7380[_0xf3e3('0x43')][_0xf3e3('0x2b')]);}_0x27298b[_0xf3e3('0x49')]=qs[_0xf3e3('0x4a')](_0x1b7380[_0xf3e3('0x43')]['sort']);_0x27298b['where']=qs[_0xf3e3('0x44')](_[_0xf3e3('0x63')](_0x1b7380['query'],_0x457fa2['filters']));_0x27298b[_0xf3e3('0x4b')]['FaxAccountId']=_0x521a84['id'];if(_0x1b7380['query'][_0xf3e3('0x4c')]){_0x27298b[_0xf3e3('0x4b')]=_[_0xf3e3('0x4d')](_0x27298b[_0xf3e3('0x4b')],{'$or':_[_0xf3e3('0x3c')](_0x27298b[_0xf3e3('0x46')],function(_0x5b338d){var _0x1e2db7={};_0x1e2db7[_0x5b338d]={'$like':'%'+_0x1b7380[_0xf3e3('0x43')][_0xf3e3('0x4c')]+'%'};return _0x1e2db7;})});}_0x27298b=_['merge']({},_0x27298b,_0x1b7380[_0xf3e3('0x4e')]);return db[_0xf3e3('0x60')][_0xf3e3('0x2e')]({'where':_0x27298b[_0xf3e3('0x4b')]})[_0xf3e3('0x1d')](function(_0x5e6163){_0x107e1d[_0xf3e3('0x2e')]=_0x5e6163;if(_0x1b7380['query'][_0xf3e3('0x4f')]){_0x27298b[_0xf3e3('0x50')]=[{'all':!![]}];}return db[_0xf3e3('0x60')][_0xf3e3('0x51')](_0x27298b);})[_0xf3e3('0x1d')](function(_0x40ac49){_0x107e1d[_0xf3e3('0x52')]=_0x40ac49;return _0x107e1d;});}})[_0xf3e3('0x1d')](respondWithFilteredResult(_0x450bff,_0x27298b))[_0xf3e3('0x27')](handleError(_0x450bff,null));};exports[_0xf3e3('0x64')]=function(_0x41e00b,_0x12f23d,_0xfcedd){return db[_0xf3e3('0x3d')][_0xf3e3('0x55')]({'where':{'id':_0x41e00b['params']['id']}})['then'](handleEntityNotFound(_0x12f23d,null))[_0xf3e3('0x1d')](function(_0xe3134b){if(_0xe3134b){return _0xe3134b[_0xf3e3('0x64')](_0x41e00b[_0xf3e3('0x43')][_0xf3e3('0x65')]);}})[_0xf3e3('0x1d')](respondWithStatusCode(_0x12f23d,null))['catch'](handleError(_0x12f23d,null));};exports['addAnswer']=function(_0x495008,_0x4cb7ed,_0x4c819f){if(_0x495008[_0xf3e3('0x57')]['id']){delete _0x495008[_0xf3e3('0x57')]['id'];}return db['FaxAccount'][_0xf3e3('0x55')]({'where':{'id':_0x495008[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x4cb7ed,null))['then'](function(_0x281af0){if(_0x281af0){_0x495008[_0xf3e3('0x57')]['FaxAccountId']=_0x281af0['id'];return db[_0xf3e3('0x66')][_0xf3e3('0x56')](_0x495008[_0xf3e3('0x57')]);}})[_0xf3e3('0x1d')](respondWithResult(_0x4cb7ed,null))['catch'](handleError(_0x4cb7ed,null));};exports['getAnswers']=function(_0x2fc130,_0x348729,_0x3eaa2c){var _0x1bbddf={'raw':![],'where':{}};var _0x4c03c3={};var _0x269f2c={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf3e3('0x61')]({'where':{'id':_0x2fc130[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x348729,null))[_0xf3e3('0x1d')](function(_0xea007c){if(_0xea007c){_0x4c03c3[_0xf3e3('0x41')]=_[_0xf3e3('0x42')](db['CannedAnswer']['rawAttributes']);_0x4c03c3[_0xf3e3('0x43')]=_['keys'](_0x2fc130['query']);_0x4c03c3['filters']=_[_0xf3e3('0x45')](_0x4c03c3[_0xf3e3('0x41')],_0x4c03c3[_0xf3e3('0x43')]);_0x1bbddf[_0xf3e3('0x46')]=_['intersection'](_0x4c03c3[_0xf3e3('0x41')],qs['fields'](_0x2fc130[_0xf3e3('0x43')]['fields']));_0x1bbddf['attributes']=_0x1bbddf[_0xf3e3('0x46')][_0xf3e3('0x48')]?_0x1bbddf['attributes']:_0x4c03c3[_0xf3e3('0x41')];if(!_0x2fc130[_0xf3e3('0x43')][_0xf3e3('0x62')]('nolimit')){_0x1bbddf[_0xf3e3('0x2d')]=qs['limit'](_0x2fc130[_0xf3e3('0x43')][_0xf3e3('0x2d')]);_0x1bbddf['offset']=qs[_0xf3e3('0x2b')](_0x2fc130['query'][_0xf3e3('0x2b')]);}_0x1bbddf[_0xf3e3('0x49')]=qs['sort'](_0x2fc130[_0xf3e3('0x43')][_0xf3e3('0x4a')]);_0x1bbddf[_0xf3e3('0x4b')]=qs[_0xf3e3('0x44')](_[_0xf3e3('0x63')](_0x2fc130[_0xf3e3('0x43')],_0x4c03c3[_0xf3e3('0x44')]));_0x1bbddf[_0xf3e3('0x4b')][_0xf3e3('0x5f')]=_0xea007c['id'];if(_0x2fc130[_0xf3e3('0x43')][_0xf3e3('0x4c')]){_0x1bbddf['where']=_['merge'](_0x1bbddf[_0xf3e3('0x4b')],{'$or':_[_0xf3e3('0x3c')](_0x1bbddf[_0xf3e3('0x46')],function(_0xc441cb){var _0x15984c={};_0x15984c[_0xc441cb]={'$like':'%'+_0x2fc130[_0xf3e3('0x43')][_0xf3e3('0x4c')]+'%'};return _0x15984c;})});}_0x1bbddf=_['merge']({},_0x1bbddf,_0x2fc130['options']);return db[_0xf3e3('0x66')][_0xf3e3('0x2e')]({'where':_0x1bbddf['where']})['then'](function(_0x58550c){_0x269f2c[_0xf3e3('0x2e')]=_0x58550c;if(_0x2fc130['query'][_0xf3e3('0x4f')]){_0x1bbddf[_0xf3e3('0x50')]=[{'all':!![]}];}return db[_0xf3e3('0x66')][_0xf3e3('0x51')](_0x1bbddf);})['then'](function(_0x3aee94){_0x269f2c[_0xf3e3('0x52')]=_0x3aee94;return _0x269f2c;});}})[_0xf3e3('0x1d')](respondWithFilteredResult(_0x348729,_0x1bbddf))['catch'](handleError(_0x348729,null));};exports[_0xf3e3('0x67')]=function(_0x4cab44,_0xbe7e14,_0x2f88c5){return db['FaxAccount'][_0xf3e3('0x55')]({'where':{'id':_0x4cab44[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0xbe7e14,null))[_0xf3e3('0x1d')](function(_0x4decd5){if(_0x4decd5){return _0x4decd5['removeAnswers'](_0x4cab44[_0xf3e3('0x43')][_0xf3e3('0x65')]);}})[_0xf3e3('0x1d')](respondWithStatusCode(_0xbe7e14,null))[_0xf3e3('0x27')](handleError(_0xbe7e14,null));};exports[_0xf3e3('0x68')]=function(_0x22e617,_0x4e39a1,_0x4ef106){return db[_0xf3e3('0x69')]['find']({'where':{'id':_0x22e617[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x4e39a1,null))['then'](function(_0x1db80b){if(_0x1db80b){return _0x1db80b[_0xf3e3('0x68')](_0x22e617[_0xf3e3('0x57')]['ids'],_['omit'](_0x22e617[_0xf3e3('0x57')],[_0xf3e3('0x65'),'id'])||{});}})['then'](respondWithResult(_0x4e39a1,null))[_0xf3e3('0x27')](handleError(_0x4e39a1,null));};exports['getInteractions']=function(_0x3bde97,_0x2f108c,_0x1c4f29){var _0x165e61={'raw':![],'where':{}};var _0x3680ad={};var _0x3c5cef={'count':0x0,'rows':[]};return db[_0xf3e3('0x3d')][_0xf3e3('0x61')]({'where':{'id':_0x3bde97['params']['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x2f108c,null))[_0xf3e3('0x1d')](function(_0x108770){if(_0x108770){_0x3680ad[_0xf3e3('0x41')]=_[_0xf3e3('0x42')](db[_0xf3e3('0x69')]['rawAttributes']);_0x3680ad[_0xf3e3('0x43')]=_[_0xf3e3('0x42')](_0x3bde97['query']);_0x3680ad['filters']=_[_0xf3e3('0x45')](_0x3680ad[_0xf3e3('0x41')],_0x3680ad[_0xf3e3('0x43')]);_0x165e61['attributes']=_[_0xf3e3('0x45')](_0x3680ad[_0xf3e3('0x41')],qs['fields'](_0x3bde97[_0xf3e3('0x43')]['fields']));_0x165e61[_0xf3e3('0x46')]=_0x165e61[_0xf3e3('0x46')][_0xf3e3('0x48')]?_0x165e61[_0xf3e3('0x46')]:_0x3680ad[_0xf3e3('0x41')];if(!_0x3bde97[_0xf3e3('0x43')][_0xf3e3('0x62')](_0xf3e3('0x6a'))){_0x165e61[_0xf3e3('0x2d')]=qs[_0xf3e3('0x2d')](_0x3bde97[_0xf3e3('0x43')][_0xf3e3('0x2d')]);_0x165e61['offset']=qs['offset'](_0x3bde97[_0xf3e3('0x43')]['offset']);}_0x165e61[_0xf3e3('0x49')]=qs['sort'](_0x3bde97[_0xf3e3('0x43')]['sort']);_0x165e61[_0xf3e3('0x4b')]=qs[_0xf3e3('0x44')](_[_0xf3e3('0x63')](_0x3bde97['query'],_0x3680ad['filters']));_0x165e61['where'][_0xf3e3('0x5f')]=_0x108770['id'];if(_0x3bde97[_0xf3e3('0x43')][_0xf3e3('0x4c')]){_0x165e61['where']=_[_0xf3e3('0x4d')](_0x165e61['where'],{'$or':_['map'](_0x165e61[_0xf3e3('0x46')],function(_0x13ae57){var _0x24e62b={};_0x24e62b[_0x13ae57]={'$like':'%'+_0x3bde97[_0xf3e3('0x43')]['filter']+'%'};return _0x24e62b;})});}_0x165e61=_[_0xf3e3('0x4d')]({},_0x165e61,_0x3bde97[_0xf3e3('0x4e')]);return db['FaxInteraction'][_0xf3e3('0x2e')]({'where':_0x165e61[_0xf3e3('0x4b')]})[_0xf3e3('0x1d')](function(_0x2e70eb){_0x3c5cef[_0xf3e3('0x2e')]=_0x2e70eb;if(_0x3bde97['query'][_0xf3e3('0x4f')]){_0x165e61[_0xf3e3('0x50')]=[{'model':db[_0xf3e3('0x6b')],'as':'Contact','required':![]},{'model':db[_0xf3e3('0x6c')],'as':_0xf3e3('0x6d'),'attributes':[_0xf3e3('0x38'),_0xf3e3('0x6e'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xf3e3('0x6f'),'attributes':['id',_0xf3e3('0x38'),_0xf3e3('0x70')],'where':_0x3bde97['query'][_0xf3e3('0x71')]?{'id':_0x3bde97['query'][_0xf3e3('0x71')]}:undefined,'required':_0x3bde97['query'][_0xf3e3('0x71')]?!![]:![]}];}return db[_0xf3e3('0x69')][_0xf3e3('0x51')](_0x165e61);})[_0xf3e3('0x1d')](function(_0x5485a0){_0x3c5cef[_0xf3e3('0x52')]=_0x5485a0;return _0x3c5cef;});}})[_0xf3e3('0x1d')](respondWithFilteredResult(_0x2f108c,_0x165e61))[_0xf3e3('0x27')](handleError(_0x2f108c,null));};exports['addApplications']=function(_0x2b9936,_0x111ada){var _0x29455f=_0x2b9936['params']['id'];var _0x2630d3=_0x2b9936['body'];var _0x569cfc=0xc8;var _0x4a4019=null;return db[_0xf3e3('0x72')][_0xf3e3('0x73')]({'isolationLevel':db[_0xf3e3('0x72')][_0xf3e3('0x74')][_0xf3e3('0x75')]['READ_COMMITTED']},function(_0x3e1147){return db[_0xf3e3('0x3d')]['findOne']({'where':{'id':_0x29455f},'transaction':_0x3e1147})[_0xf3e3('0x1d')](function(_0x162cf2){if(_0x162cf2){return db[_0xf3e3('0x76')][_0xf3e3('0x33')]({'where':{'FaxAccountId':_0x29455f},'transaction':_0x3e1147})[_0xf3e3('0x1d')](function(){var _0x23639b=_['map'](_0x2630d3,function(_0x1df0da){_0x1df0da[_0xf3e3('0x5f')]=_0x29455f;return _0x1df0da;});return db[_0xf3e3('0x76')][_0xf3e3('0x77')](_0x23639b,{'transaction':_0x3e1147});});}else{_0x569cfc=0x194;_0x4a4019=[];}});})[_0xf3e3('0x1d')](function(){if(_0x569cfc!==0x194){return db[_0xf3e3('0x76')][_0xf3e3('0x78')]({'where':{'FaxAccountId':_0x29455f},'order':_0xf3e3('0x79')})[_0xf3e3('0x1d')](function(_0x433731){_0x4a4019=_0x433731;});}})['catch'](function(_0x894943){_0x569cfc=0x1f4;logger['error'](_0x894943['stack']);if(_0x894943[_0xf3e3('0x38')]){delete _0x894943[_0xf3e3('0x38')];}_0x4a4019=_0x894943;})[_0xf3e3('0x7a')](function(){if(_0x4a4019===null){_0x111ada[_0xf3e3('0x37')](_0x569cfc);}else{if(_0x569cfc===0x1f4){_0x111ada['status'](_0x569cfc)[_0xf3e3('0x39')](_0x4a4019);}else{_0x111ada[_0xf3e3('0x28')](_0x569cfc)['json'](_0x4a4019);}}});};exports[_0xf3e3('0x7b')]=function(_0x3d4988,_0x3c9ae3,_0x514864){var _0x1a1bb7={};var _0x19ce56={};var _0x12f423;var _0xf83a65;return db[_0xf3e3('0x3d')][_0xf3e3('0x61')]({'where':{'id':_0x3d4988[_0xf3e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c9ae3,null))[_0xf3e3('0x1d')](function(_0x46ea9e){if(_0x46ea9e){_0x12f423=_0x46ea9e;_0x19ce56[_0xf3e3('0x41')]=_[_0xf3e3('0x42')](db[_0xf3e3('0x76')][_0xf3e3('0x3e')]);_0x19ce56[_0xf3e3('0x43')]=_[_0xf3e3('0x42')](_0x3d4988[_0xf3e3('0x43')]);_0x19ce56[_0xf3e3('0x44')]=_[_0xf3e3('0x45')](_0x19ce56[_0xf3e3('0x41')],_0x19ce56[_0xf3e3('0x43')]);_0x1a1bb7[_0xf3e3('0x46')]=_[_0xf3e3('0x45')](_0x19ce56[_0xf3e3('0x41')],qs[_0xf3e3('0x47')](_0x3d4988[_0xf3e3('0x43')][_0xf3e3('0x47')]));_0x1a1bb7[_0xf3e3('0x46')]=_0x1a1bb7['attributes']['length']?_0x1a1bb7[_0xf3e3('0x46')]:_0x19ce56[_0xf3e3('0x41')];_0x1a1bb7[_0xf3e3('0x49')]=qs[_0xf3e3('0x4a')](_0x3d4988['query'][_0xf3e3('0x4a')]);_0x1a1bb7['where']=qs[_0xf3e3('0x44')](_['pick'](_0x3d4988[_0xf3e3('0x43')],_0x19ce56[_0xf3e3('0x44')]));if(_0x3d4988[_0xf3e3('0x43')]['filter']){_0x1a1bb7[_0xf3e3('0x4b')]=_['merge'](_0x1a1bb7['where'],{'$or':_[_0xf3e3('0x3c')](_0x1a1bb7[_0xf3e3('0x46')],function(_0x31c380){var _0x272135={};_0x272135[_0x31c380]={'$like':'%'+_0x3d4988['query'][_0xf3e3('0x4c')]+'%'};return _0x272135;})});}_0x1a1bb7=_[_0xf3e3('0x4d')]({},_0x1a1bb7,_0x3d4988['options']);return _0x12f423[_0xf3e3('0x7b')](_0x1a1bb7);}})[_0xf3e3('0x1d')](function(_0x1a6c49){if(_0x1a6c49){_0xf83a65=_0x1a6c49[_0xf3e3('0x48')];if(!_0x3d4988[_0xf3e3('0x43')][_0xf3e3('0x62')](_0xf3e3('0x6a'))){_0x1a1bb7[_0xf3e3('0x2d')]=qs[_0xf3e3('0x2d')](_0x3d4988[_0xf3e3('0x43')][_0xf3e3('0x2d')]);_0x1a1bb7[_0xf3e3('0x2b')]=qs[_0xf3e3('0x2b')](_0x3d4988[_0xf3e3('0x43')][_0xf3e3('0x2b')]);}return _0x12f423[_0xf3e3('0x7b')](_0x1a1bb7);}})['then'](function(_0x42196f){if(_0x42196f){return _0x42196f?{'count':_0xf83a65,'rows':_0x42196f}:null;}})['then'](respondWithResult(_0x3c9ae3,null))['catch'](handleError(_0x3c9ae3,null));};function Extension(_0x2579ba,_0xc84ab8,_0x3f4226,_0x43579a){this[_0xf3e3('0x7c')]=_0xf3e3('0x7d');this[_0xf3e3('0x7e')]=_0x2579ba[_0xf3e3('0x7f')];this[_0xf3e3('0x80')]=_0x43579a;this[_0xf3e3('0x3f')]='system';this[_0xf3e3('0x81')]=_0xf3e3('0x82');this[_0xf3e3('0x5f')]=_0x2579ba['id'];this['priority']=_0xc84ab8;this[_0xf3e3('0x83')]=_0x3f4226;}function createExtensionsReciveFax(_0x16c329){var _0x37bfed=0x1;var _0x571f23=[];_0x571f23[_0xf3e3('0x84')](new Extension(_0x16c329,_0x37bfed,'',_0xf3e3('0x85')));_0x37bfed+=0x1;_0x571f23[_0xf3e3('0x84')](new Extension(_0x16c329,_0x37bfed,_0xf3e3('0x86'),_0xf3e3('0x87')));_0x37bfed+=0x1;for(var _0x1fc931 in _0x16c329){if(_0x16c329[_0xf3e3('0x62')](_0x1fc931)&&(_0x1fc931===_0xf3e3('0x88')||_0x1fc931===_0xf3e3('0x7f')||_0x1fc931===_0xf3e3('0x89')||_0x1fc931==='faxdetect'||_0x1fc931==='headerinfo'||_0x1fc931==='maxrate'||_0x1fc931===_0xf3e3('0x8a')||_0x1fc931===_0xf3e3('0x8b')||_0x1fc931===_0xf3e3('0x8c'))){_0x571f23[_0xf3e3('0x84')](new Extension(_0x16c329,_0x37bfed,_0xf3e3('0x8d')+_0x1fc931+')='+_0x16c329[_0x1fc931],_0xf3e3('0x87')));_0x37bfed+=0x1;}}_0x571f23[_0xf3e3('0x84')](new Extension(_0x16c329,_0x37bfed,'6','Wait'));_0x37bfed+=0x1;_0x571f23[_0xf3e3('0x84')](new Extension(_0x16c329,_0x37bfed,_0xf3e3('0x8e'),_0xf3e3('0x8f')));_0x37bfed=0x0;return _0x571f23;}exports['addAccountApplications']=function(_0x1bf6dc,_0x244e74,_0x4ab1b5){var _0x13e713;return db['sequelize'][_0xf3e3('0x73')](function(_0x50b62c){return db['FaxAccount'][_0xf3e3('0x56')](_0x1bf6dc[_0xf3e3('0x57')],{'transaction':_0x50b62c})[_0xf3e3('0x1d')](function(_0x2751f3){_0x13e713=_0x2751f3['get']({'plain':!![]});return db[_0xf3e3('0x90')][_0xf3e3('0x77')](createExtensionsReciveFax(_0x13e713),{'transaction':_0x50b62c});});})[_0xf3e3('0x1d')](function(){return _0x13e713;})['then'](respondWithResult(_0x244e74,null))[_0xf3e3('0x27')](handleError(_0x244e74,null));};exports[_0xf3e3('0x91')]=function(_0x6dcec9,_0xe16598,_0x23522b){var _0x310a91;return db[_0xf3e3('0x72')][_0xf3e3('0x73')](function(_0x5de1db){return db['FaxAccount'][_0xf3e3('0x32')](_0x6dcec9[_0xf3e3('0x57')],{'where':{'id':_0x6dcec9[_0xf3e3('0x57')]['id']},'transaction':_0x5de1db})[_0xf3e3('0x1d')](function(_0x2c8dc8){return db[_0xf3e3('0x90')]['destroy']({'where':{'FaxAccountId':_0x6dcec9[_0xf3e3('0x57')]['id']},'transaction':_0x5de1db})['then'](function(_0x16497a){return db[_0xf3e3('0x90')][_0xf3e3('0x77')](createExtensionsReciveFax(_[_0xf3e3('0x92')](_0x6dcec9['body'],[_0xf3e3('0x93'),_0xf3e3('0x40'),_0xf3e3('0x94'),_0xf3e3('0x95'),_0xf3e3('0x96'),_0xf3e3('0x97')])),{'transaction':_0x5de1db});});});})[_0xf3e3('0x1d')](function(){return db[_0xf3e3('0x3d')][_0xf3e3('0x98')](_0x6dcec9[_0xf3e3('0x57')]['id']);})[_0xf3e3('0x1d')](respondWithResult(_0xe16598,null))[_0xf3e3('0x27')](handleError(_0xe16598,null));};exports[_0xf3e3('0x99')]=function(_0x16a327,_0x41a9ac,_0x273a1e){var _0x400e2e={'raw':!![],'where':{}};var _0x4dccfc={};var _0x2efef2={'count':0x0,'rows':[]};return db[_0xf3e3('0x3d')][_0xf3e3('0x61')]({'where':{'id':_0x16a327[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x41a9ac,null))[_0xf3e3('0x1d')](function(_0x3c3a5d){if(_0x3c3a5d){_0x4dccfc[_0xf3e3('0x41')]=_[_0xf3e3('0x42')](db[_0xf3e3('0x9a')][_0xf3e3('0x3e')]);_0x4dccfc[_0xf3e3('0x43')]=_['keys'](_0x16a327[_0xf3e3('0x43')]);_0x4dccfc['filters']=_[_0xf3e3('0x45')](_0x4dccfc[_0xf3e3('0x41')],_0x4dccfc[_0xf3e3('0x43')]);_0x400e2e[_0xf3e3('0x46')]=_[_0xf3e3('0x45')](_0x4dccfc[_0xf3e3('0x41')],qs[_0xf3e3('0x47')](_0x16a327['query'][_0xf3e3('0x47')]));_0x400e2e[_0xf3e3('0x46')]=_0x400e2e[_0xf3e3('0x46')][_0xf3e3('0x48')]?_0x400e2e['attributes']:_0x4dccfc[_0xf3e3('0x41')];if(!_0x16a327[_0xf3e3('0x43')][_0xf3e3('0x62')](_0xf3e3('0x6a'))){_0x400e2e[_0xf3e3('0x2d')]=qs[_0xf3e3('0x2d')](_0x16a327[_0xf3e3('0x43')]['limit']);_0x400e2e['offset']=qs['offset'](_0x16a327[_0xf3e3('0x43')][_0xf3e3('0x2b')]);}_0x400e2e[_0xf3e3('0x49')]=qs[_0xf3e3('0x4a')](_0x16a327['query'][_0xf3e3('0x4a')]);_0x400e2e['where']=qs['filters'](_['pick'](_0x16a327[_0xf3e3('0x43')],_0x4dccfc[_0xf3e3('0x44')]));_0x400e2e[_0xf3e3('0x4b')][_0xf3e3('0x5f')]=_0x3c3a5d['id'];if(_0x16a327[_0xf3e3('0x43')][_0xf3e3('0x4c')]){_0x400e2e['where']=_[_0xf3e3('0x4d')](_0x400e2e['where'],{'$or':_[_0xf3e3('0x3c')](_0x400e2e[_0xf3e3('0x46')],function(_0xcf68f1){var _0x4fa48f={};_0x4fa48f[_0xcf68f1]={'$like':'%'+_0x16a327[_0xf3e3('0x43')][_0xf3e3('0x4c')]+'%'};return _0x4fa48f;})});}if(_0x16a327[_0xf3e3('0x43')]['$gte']){var _0x312941=_0x16a327['query'][_0xf3e3('0x9b')][_0xf3e3('0x9c')](',');var _0x6605c8={};_0x6605c8[_0x312941[0x0]]={'$gte':moment(_0x312941[0x1])[_0xf3e3('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x400e2e[_0xf3e3('0x4b')]=_['merge'](_0x400e2e[_0xf3e3('0x4b')],_0x6605c8);}_0x400e2e=_[_0xf3e3('0x4d')]({},_0x400e2e,_0x16a327[_0xf3e3('0x4e')]);return db['FaxMessage']['count']({'where':_0x400e2e[_0xf3e3('0x4b')]})[_0xf3e3('0x1d')](function(_0xbbe02c){_0x2efef2['count']=_0xbbe02c;if(_0x16a327[_0xf3e3('0x43')][_0xf3e3('0x4f')]){_0x400e2e['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x400e2e);})[_0xf3e3('0x1d')](function(_0x5d3fdf){_0x2efef2[_0xf3e3('0x52')]=_0x5d3fdf;return _0x2efef2;});}})[_0xf3e3('0x1d')](respondWithFilteredResult(_0x41a9ac,_0x400e2e))[_0xf3e3('0x27')](handleError(_0x41a9ac,null));};exports[_0xf3e3('0x39')]=function(_0x4d078f,_0x256e95,_0x4891ba){var _0x213e83,_0x508dec={},_0x6d3a26;if(_0x4d078f[_0xf3e3('0x57')]['to']){_0x6d3a26=_0x4d078f['body']['to'][0x0];}return db['FaxAccount'][_0xf3e3('0x55')]({'where':{'id':_0x4d078f[_0xf3e3('0x54')]['id']},'include':[{'model':db[_0xf3e3('0x9e')],'as':_0xf3e3('0x9f'),'include':[{'model':db[_0xf3e3('0x6b')],'as':_0xf3e3('0xa0'),'where':{'fax':_0x6d3a26},'limit':0x1,'order':[[_0xf3e3('0x95'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x256e95,null))[_0xf3e3('0x1d')](function(_0x55073a){_0x213e83=_0x55073a;if(_0x4d078f[_0xf3e3('0x57')]['attachments']&&_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][_0xf3e3('0x48')]){for(var _0x1648a3=0x0;_0x1648a3<_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')]['length'];_0x1648a3+=0x1){_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][_0x1648a3]={'filename':_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][_0x1648a3][_0xf3e3('0x38')],'id':_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][_0x1648a3]['id'],'path':path[_0xf3e3('0xa2')](config['root'],_0xf3e3('0xa3'),_0x4d078f['body'][_0xf3e3('0xa1')][_0x1648a3][_0xf3e3('0xa4')])};}}return respondWithRpcPromise(_0xf3e3('0xa5'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x4d078f[_0xf3e3('0x54')]['id'])?undefined:_0x4d078f[_0xf3e3('0x54')]['id'],'path':_[_0xf3e3('0xa6')](_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][0x0][_0xf3e3('0x6')])?undefined:_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][0x0][_0xf3e3('0x6')],'fax':_[_0xf3e3('0xa6')](_0x4d078f[_0xf3e3('0x57')]['to'][0x0])?undefined:_0x4d078f[_0xf3e3('0x57')]['to'][0x0]},client9002);})[_0xf3e3('0x1d')](function(){if(_0x213e83){if(_[_0xf3e3('0xa6')](_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa7')])){_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa7')]=util['format'](_0xf3e3('0xa8'),_0x213e83[_0xf3e3('0x38')],_0x213e83['fax']);}if(_0x213e83[_0xf3e3('0x9f')]){if(_0x213e83[_0xf3e3('0x9f')]['Contacts'][_0xf3e3('0x48')]){return _0x213e83['List'][_0xf3e3('0xa0')][0x0];}else{return db[_0xf3e3('0x6b')][_0xf3e3('0x56')](_[_0xf3e3('0x16')](_0x4d078f[_0xf3e3('0x57')],{'firstName':_0x4d078f[_0xf3e3('0x57')]['to'][0x0],'phone':_0x4d078f[_0xf3e3('0x57')]['to'][0x0],'fax':_0x4d078f['body']['to'][0x0],'ListId':_0x213e83[_0xf3e3('0x97')]}));}}else{throw new Error(_0xf3e3('0xa9'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xf3e3('0x1d')](function(_0x418339){if(_0x418339){return db[_0xf3e3('0x69')][_0xf3e3('0x55')]({'where':{'ContactId':_0x418339['id'],'closed':![],'FaxAccountId':_0x213e83['id']}})[_0xf3e3('0x1d')](function(_0x50ce82){if(_0x50ce82){return[_0x50ce82,![]];}return db[_0xf3e3('0x69')][_0xf3e3('0x56')]({'UserId':_0x4d078f[_0xf3e3('0x58')]['id'],'ContactId':_0x418339['id'],'FaxAccountId':_0x213e83['id'],'fax':_0x4d078f[_0xf3e3('0x57')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x4d078f[_0xf3e3('0x57')],{'read':![],'body':_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][0x0]['filename'],'FaxAccountId':_0x213e83['id'],'UserId':_0x4d078f[_0xf3e3('0x58')]['id'],'ContactId':_0x418339['id'],'AttachmentId':_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][0x0]['id']})]},{'include':[{'model':db[_0xf3e3('0x9a')],'as':'Messages'}]})['then'](function(_0x46d500){return[_0x46d500,!![]];});});}else{throw new Error(_0xf3e3('0xaa'));}})[_0xf3e3('0xab')](function(_0x30f7aa,_0x1cd4ba){if(_0x1cd4ba){return _0x30f7aa;}return db[_0xf3e3('0x9a')][_0xf3e3('0x56')]({'direction':'out','read':![],'body':_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][0x0][_0xf3e3('0xac')],'FaxAccountId':_0x213e83['id'],'FaxInteractionId':_0x30f7aa['id'],'UserId':_0x4d078f[_0xf3e3('0x58')]['id'],'ContactId':_0x30f7aa[_0xf3e3('0xad')],'AttachmentId':_0x4d078f[_0xf3e3('0x57')][_0xf3e3('0xa1')][0x0]['id']})[_0xf3e3('0x1d')](function(_0x2a2b73){_0x30f7aa['dataValues'][_0xf3e3('0xae')]=[];_0x30f7aa['dataValues']['Messages'][_0xf3e3('0x84')](_0x2a2b73[_0xf3e3('0xaf')]);return _0x30f7aa;});})[_0xf3e3('0x1d')](function(_0x3b0839){respondWithRpcPromise(_0xf3e3('0xb0'),_0xf3e3('0xb0'),{'FaxAccountId':_[_0xf3e3('0xa6')](_0x4d078f[_0xf3e3('0x54')]['id'])?undefined:_0x4d078f[_0xf3e3('0x54')]['id'],'path':_[_0xf3e3('0xa6')](_0x4d078f[_0xf3e3('0x57')]['attachments'][0x0][_0xf3e3('0x6')])?undefined:_0x4d078f[_0xf3e3('0x57')]['attachments'][0x0][_0xf3e3('0x6')],'fax':_[_0xf3e3('0xa6')](_0x4d078f[_0xf3e3('0x57')]['to'][0x0])?undefined:_0x4d078f['body']['to'][0x0],'AttachmentId':_0x4d078f[_0xf3e3('0x57')]['attachments'][0x0]['id']},client9002)[_0xf3e3('0x1d')](function(_0x25a187){logger[_0xf3e3('0x1e')](_0xf3e3('0xb1'),_0x25a187);})[_0xf3e3('0x27')](function(_0x111af2){logger['info'](_0xf3e3('0xb1'),_0x111af2);});return _0x3b0839;})[_0xf3e3('0x1d')](respondWithResult(_0x256e95,null))[_0xf3e3('0x27')](handleError(_0x256e95,null));};exports[_0xf3e3('0xb2')]=function(_0x7be12e,_0x56f2b2,_0xc9e544){return db[_0xf3e3('0x3d')][_0xf3e3('0x55')]({'where':{'id':_0x7be12e[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x56f2b2,null))['then'](function(_0x4e6692){if(_0x4e6692){return _0x4e6692['addAgents'](_0x7be12e[_0xf3e3('0x57')][_0xf3e3('0x65')],_[_0xf3e3('0x92')](_0x7be12e[_0xf3e3('0x57')],[_0xf3e3('0x65'),'id'])||{})[_0xf3e3('0xab')](function(_0x5d2f68){for(var _0x16c578=0x0;_0x16c578<_0x7be12e['body'][_0xf3e3('0x65')][_0xf3e3('0x48')];_0x16c578+=0x1){socket['emit'](_0xf3e3('0xb3'),{'UserId':Number(_0x7be12e[_0xf3e3('0x57')][_0xf3e3('0x65')][_0x16c578]),'FaxAccountId':Number(_0x7be12e[_0xf3e3('0x54')]['id'])});}return _0x5d2f68;});}})['then'](respondWithResult(_0x56f2b2,null))[_0xf3e3('0x27')](handleError(_0x56f2b2,null));};exports[_0xf3e3('0xb4')]=function(_0x52a812,_0x31dcfd,_0x251b42){return db[_0xf3e3('0x3d')][_0xf3e3('0x55')]({'where':{'id':_0x52a812[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x31dcfd,null))['then'](function(_0x3f5dc2){if(_0x3f5dc2){return _0x3f5dc2[_0xf3e3('0xb4')](_0x52a812[_0xf3e3('0x43')][_0xf3e3('0x65')])[_0xf3e3('0x1d')](function(){if(_[_0xf3e3('0xb5')](_0x52a812[_0xf3e3('0x43')][_0xf3e3('0x65')])){for(var _0x397ee4=0x0;_0x397ee4<_0x52a812['query'][_0xf3e3('0x65')][_0xf3e3('0x48')];_0x397ee4+=0x1){socket[_0xf3e3('0xb6')](_0xf3e3('0xb7'),{'UserId':Number(_0x52a812[_0xf3e3('0x43')]['ids'][_0x397ee4]),'FaxAccountId':Number(_0x52a812[_0xf3e3('0x54')]['id'])});}}else{socket[_0xf3e3('0xb6')](_0xf3e3('0xb7'),{'UserId':Number(_0x52a812['query'][_0xf3e3('0x65')]),'FaxAccountId':Number(_0x52a812[_0xf3e3('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x31dcfd,null))[_0xf3e3('0x27')](handleError(_0x31dcfd,null));};exports[_0xf3e3('0xb8')]=function(_0x40c3a2,_0x39a1f4,_0x56be1c){var _0x1db046={};var _0x59805a={};var _0x269a64;var _0x298ad5;return db[_0xf3e3('0x3d')][_0xf3e3('0x61')]({'where':{'id':_0x40c3a2[_0xf3e3('0x54')]['id']}})[_0xf3e3('0x1d')](handleEntityNotFound(_0x39a1f4,null))[_0xf3e3('0x1d')](function(_0x42f5ff){if(_0x42f5ff){_0x269a64=_0x42f5ff;_0x59805a[_0xf3e3('0x41')]=_[_0xf3e3('0x42')](db['User']['rawAttributes']);_0x59805a[_0xf3e3('0x43')]=_[_0xf3e3('0x42')](_0x40c3a2[_0xf3e3('0x43')]);_0x59805a[_0xf3e3('0x44')]=_[_0xf3e3('0x45')](_0x59805a[_0xf3e3('0x41')],_0x59805a['query']);_0x1db046['attributes']=_[_0xf3e3('0x45')](_0x59805a[_0xf3e3('0x41')],qs[_0xf3e3('0x47')](_0x40c3a2[_0xf3e3('0x43')][_0xf3e3('0x47')]));_0x1db046[_0xf3e3('0x46')]=_0x1db046['attributes'][_0xf3e3('0x48')]?_0x1db046['attributes']:_0x59805a[_0xf3e3('0x41')];_0x1db046[_0xf3e3('0x49')]=qs[_0xf3e3('0x4a')](_0x40c3a2[_0xf3e3('0x43')][_0xf3e3('0x4a')]);_0x1db046['where']=qs['filters'](_[_0xf3e3('0x63')](_0x40c3a2[_0xf3e3('0x43')],_0x59805a[_0xf3e3('0x44')]));if(_0x40c3a2[_0xf3e3('0x43')][_0xf3e3('0x4c')]){_0x1db046[_0xf3e3('0x4b')]=_[_0xf3e3('0x4d')](_0x1db046['where'],{'$or':_['map'](_0x1db046[_0xf3e3('0x46')],function(_0x501e48){var _0x4cbf65={};_0x4cbf65[_0x501e48]={'$like':'%'+_0x40c3a2['query']['filter']+'%'};return _0x4cbf65;})});}_0x1db046=_['merge']({},_0x1db046,_0x40c3a2[_0xf3e3('0x4e')]);return _0x269a64[_0xf3e3('0xb8')](_0x1db046);}})[_0xf3e3('0x1d')](function(_0x3df3d6){if(_0x3df3d6){_0x298ad5=_0x3df3d6[_0xf3e3('0x48')];if(!_0x40c3a2[_0xf3e3('0x43')][_0xf3e3('0x62')]('nolimit')){_0x1db046[_0xf3e3('0x2d')]=qs[_0xf3e3('0x2d')](_0x40c3a2['query'][_0xf3e3('0x2d')]);_0x1db046[_0xf3e3('0x2b')]=qs['offset'](_0x40c3a2[_0xf3e3('0x43')][_0xf3e3('0x2b')]);}return _0x269a64[_0xf3e3('0xb8')](_0x1db046);}})[_0xf3e3('0x1d')](function(_0x3b712f){if(_0x3b712f){return _0x3b712f?{'count':_0x298ad5,'rows':_0x3b712f}:null;}})[_0xf3e3('0x1d')](respondWithResult(_0x39a1f4,null))[_0xf3e3('0x27')](handleError(_0x39a1f4,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index dd6a14c..1403056 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 _0x1794=['save','update','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x53f025,_0x476c3b){var _0x2a1bca=function(_0x4c7ac0){while(--_0x4c7ac0){_0x53f025['push'](_0x53f025['shift']());}};_0x2a1bca(++_0x476c3b);}(_0x1794,0x165));var _0x4179=function(_0xc8a13d,_0x317109){_0xc8a13d=_0xc8a13d-0x0;var _0x2f6540=_0x1794[_0xc8a13d];return _0x2f6540;};'use strict';var EventEmitter=require(_0x4179('0x0'));var FaxAccount=require(_0x4179('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4179('0x2')](0x0);var events={'afterCreate':_0x4179('0x3'),'afterUpdate':_0x4179('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38aeff){return function(_0x3a4093,_0x158e8a,_0x232001){FaxAccountEvents[_0x4179('0x5')](_0x38aeff+':'+_0x3a4093['id'],_0x3a4093);FaxAccountEvents[_0x4179('0x5')](_0x38aeff,_0x3a4093);_0x232001(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x4179('0x6')](e,emitEvent(event));}}module[_0x4179('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x1241=['hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x249151,_0x241f8d){var _0x4dc4cf=function(_0x3ab86c){while(--_0x3ab86c){_0x249151['push'](_0x249151['shift']());}};_0x4dc4cf(++_0x241f8d);}(_0x1241,0x155));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1124('0x0'));var FaxAccount=require(_0x1124('0x1'))['db'][_0x1124('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1124('0x3')](0x0);var events={'afterCreate':_0x1124('0x4'),'afterUpdate':_0x1124('0x5'),'afterDestroy':_0x1124('0x6')};function emitEvent(_0x5e0eee){return function(_0x3ec870,_0x33431e,_0x157acd){FaxAccountEvents['emit'](_0x5e0eee+':'+_0x3ec870['id'],_0x3ec870);FaxAccountEvents[_0x1124('0x7')](_0x5e0eee,_0x3ec870);_0x157acd(null);};}for(var e in events){if(events[_0x1124('0x8')](e)){var event=events[e];FaxAccount[_0x1124('0x9')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 20a7404..25d6119 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 _0x6372=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define','FaxAccount','fax_accounts'];(function(_0x2dcbaf,_0x16bfdb){var _0x3e4820=function(_0x2d34d5){while(--_0x2d34d5){_0x2dcbaf['push'](_0x2dcbaf['shift']());}};_0x3e4820(++_0x16bfdb);}(_0x6372,0x9a));var _0x2637=function(_0x241d4f,_0x54cc1c){_0x241d4f=_0x241d4f-0x0;var _0x19387a=_0x6372[_0x241d4f];return _0x19387a;};'use strict';var _=require(_0x2637('0x0'));var util=require(_0x2637('0x1'));var logger=require(_0x2637('0x2'))(_0x2637('0x3'));var moment=require(_0x2637('0x4'));var BPromise=require(_0x2637('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2637('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x2637('0x7')]=function(_0x59a3a8,_0x129caa){return _0x59a3a8[_0x2637('0x8')](_0x2637('0x9'),attributes,{'tableName':_0x2637('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1c=['define','FaxAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x260593,_0x2bdb5f){var _0x63c998=function(_0x1336f1){while(--_0x1336f1){_0x260593['push'](_0x260593['shift']());}};_0x63c998(++_0x2bdb5f);}(_0x3e1c,0x1be));var _0xc3e1=function(_0x181cd3,_0xbb7f9e){_0x181cd3=_0x181cd3-0x0;var _0x50b066=_0x3e1c[_0x181cd3];return _0x50b066;};'use strict';var _=require(_0xc3e1('0x0'));var util=require(_0xc3e1('0x1'));var logger=require(_0xc3e1('0x2'))(_0xc3e1('0x3'));var moment=require('moment');var BPromise=require(_0xc3e1('0x4'));var rp=require(_0xc3e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3e1('0x6'));var config=require(_0xc3e1('0x7'));var attributes=require(_0xc3e1('0x8'));module[_0xc3e1('0x9')]=function(_0x19d29b,_0x2874c8){return _0x19d29b[_0xc3e1('0xa')](_0xc3e1('0xb'),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 47d3441..81fe408 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 _0x5ebf=['get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','name','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','options','raw','where','attributes','limit','map','include','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','difference','createdAt','keys','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','ValidationError','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','list','List','applications','orderBy','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread'];(function(_0x199257,_0x40c573){var _0x1b35f1=function(_0x4c4650){while(--_0x4c4650){_0x199257['push'](_0x199257['shift']());}};_0x1b35f1(++_0x40c573);}(_0x5ebf,0x134));var _0xf5eb=function(_0x518f11,_0x3d10c0){_0x518f11=_0x518f11-0x0;var _0x1cc77e=_0x5ebf[_0x518f11];return _0x1cc77e;};'use strict';var _=require(_0xf5eb('0x0'));var util=require(_0xf5eb('0x1'));var moment=require(_0xf5eb('0x2'));var BPromise=require(_0xf5eb('0x3'));var rs=require(_0xf5eb('0x4'));var fs=require('fs');var Redis=require(_0xf5eb('0x5'));var db=require(_0xf5eb('0x6'))['db'];var utils=require(_0xf5eb('0x7'));var logger=require(_0xf5eb('0x8'))(_0xf5eb('0x9'));var config=require(_0xf5eb('0xa'));var jayson=require(_0xf5eb('0xb'));var client=jayson[_0xf5eb('0xc')]['http']({'port':0x232c});config[_0xf5eb('0xd')]=_[_0xf5eb('0xe')](config['redis'],{'host':_0xf5eb('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5eb('0xd')]));require(_0xf5eb('0x10'))[_0xf5eb('0x11')](socket);function respondWithRpcPromise(_0x551a35,_0x516dbc,_0x5326fe){return new BPromise(function(_0x19f29f,_0x5d019e){return client[_0xf5eb('0x12')](_0x551a35,_0x5326fe)[_0xf5eb('0x13')](function(_0x48aacf){logger[_0xf5eb('0x14')](_0xf5eb('0x15'),_0x516dbc,_0xf5eb('0x16'));logger[_0xf5eb('0x17')](_0xf5eb('0x18'),_0x516dbc,'request\x20sent',JSON[_0xf5eb('0x19')](_0x48aacf));if(_0x48aacf[_0xf5eb('0x1a')]){if(_0x48aacf['error'][_0xf5eb('0x1b')]===0x1f4){logger[_0xf5eb('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x516dbc,_0x48aacf['error'][_0xf5eb('0x1c')]);return _0x5d019e(_0x48aacf[_0xf5eb('0x1a')][_0xf5eb('0x1c')]);}logger[_0xf5eb('0x1a')](_0xf5eb('0x15'),_0x516dbc,_0x48aacf[_0xf5eb('0x1a')][_0xf5eb('0x1c')]);return _0x19f29f(_0x48aacf['error'][_0xf5eb('0x1c')]);}else{logger[_0xf5eb('0x14')](_0xf5eb('0x15'),_0x516dbc,_0xf5eb('0x16'));_0x19f29f(_0x48aacf[_0xf5eb('0x1d')][_0xf5eb('0x1c')]);}})[_0xf5eb('0x1e')](function(_0x26a36f){logger[_0xf5eb('0x1a')](_0xf5eb('0x15'),_0x516dbc,_0x26a36f);_0x5d019e(_0x26a36f);});});}exports['GetFaxAccount']=function(_0x2143ed){var _0x159b69=this;return new Promise(function(_0x40f018,_0x1af1ed){return db[_0xf5eb('0x1f')]['findAll']({'raw':_0x2143ed[_0xf5eb('0x20')]?_0x2143ed[_0xf5eb('0x20')][_0xf5eb('0x21')]===undefined?!![]:![]:!![],'where':_0x2143ed[_0xf5eb('0x20')]?_0x2143ed[_0xf5eb('0x20')][_0xf5eb('0x22')]||null:null,'attributes':_0x2143ed[_0xf5eb('0x20')]?_0x2143ed[_0xf5eb('0x20')][_0xf5eb('0x23')]||null:null,'limit':_0x2143ed[_0xf5eb('0x20')]?_0x2143ed[_0xf5eb('0x20')][_0xf5eb('0x24')]||null:null,'include':_0x2143ed[_0xf5eb('0x20')]?_0x2143ed[_0xf5eb('0x20')]['include']?_[_0xf5eb('0x25')](_0x2143ed[_0xf5eb('0x20')][_0xf5eb('0x26')],function(_0x3e5f82){return{'model':db[_0x3e5f82[_0xf5eb('0x27')]],'as':_0x3e5f82['as'],'attributes':_0x3e5f82[_0xf5eb('0x23')],'include':_0x3e5f82[_0xf5eb('0x26')]?_['map'](_0x3e5f82[_0xf5eb('0x26')],function(_0x226fc6){return{'model':db[_0x226fc6['model']],'as':_0x226fc6['as'],'attributes':_0x226fc6[_0xf5eb('0x23')],'include':_0x226fc6['include']?_[_0xf5eb('0x25')](_0x226fc6[_0xf5eb('0x26')],function(_0x45bc91){return{'model':db[_0x45bc91[_0xf5eb('0x27')]],'as':_0x45bc91['as'],'attributes':_0x45bc91['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xa99e4d){logger[_0xf5eb('0x14')](_0xf5eb('0x28'),_0x2143ed);logger[_0xf5eb('0x17')](_0xf5eb('0x28'),_0x2143ed,JSON[_0xf5eb('0x19')](_0xa99e4d));_0x40f018(_0xa99e4d);})[_0xf5eb('0x1e')](function(_0x35ad99){logger[_0xf5eb('0x1a')](_0xf5eb('0x28'),_0x35ad99['message'],_0x2143ed);_0x1af1ed(_0x159b69[_0xf5eb('0x1a')](0x1f4,_0x35ad99['message']));});});};exports[_0xf5eb('0x29')]=function(_0x23dcaa,_0x9ebaa1,_0x2e8ccc){var _0x414c02=this;return new Promise(function(_0x3923da,_0x392500){var _0x11bbdd={'body':_0x23dcaa[_0xf5eb('0x2a')],'channel':_0xf5eb('0x2b')};var _0x2b1ce3=[];var _0x2a56f2=[];var _0x33ee0c={};return db[_0xf5eb('0x2c')][_0xf5eb('0x2d')]()[_0xf5eb('0x13')](function(_0x167bfa){if(!_0x167bfa){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x2b1ce3=_[_0xf5eb('0x2e')](_['keys'](_0x167bfa),[_0xf5eb('0x2f'),'updatedAt']);_0x2a56f2=_[_0xf5eb('0x2e')](_[_0xf5eb('0x30')](_0x167bfa),['createdAt','updatedAt',_0xf5eb('0x31'),_0xf5eb('0x32')]);if(_0x23dcaa['body']['id']){delete _0x23dcaa['body']['id'];}if(_[_0xf5eb('0x33')](_0x23dcaa['body'][_0xf5eb('0x34')])){throw new db[(_0xf5eb('0x35'))]['ValidationError'](_0xf5eb('0x36'));}if(_[_0xf5eb('0x33')](_0x23dcaa['body']['body'])||_0x23dcaa[_0xf5eb('0x2a')][_0xf5eb('0x2a')]===''){throw new db[(_0xf5eb('0x35'))][(_0xf5eb('0x37'))](_0xf5eb('0x38'));}if(_[_0xf5eb('0x33')](_0x23dcaa[_0xf5eb('0x2a')][_0xf5eb('0x39')])){throw new db[(_0xf5eb('0x35'))][(_0xf5eb('0x37'))](_0xf5eb('0x3a')+_0x2a56f2);}if(!_['includes'](_0x2a56f2,_0x23dcaa[_0xf5eb('0x2a')]['mapKey'])){throw new db[(_0xf5eb('0x35'))][(_0xf5eb('0x37'))](_0xf5eb('0x3b')+_0x2a56f2);}_0x33ee0c[_0x23dcaa['body'][_0xf5eb('0x39')]]=_0x23dcaa[_0xf5eb('0x2a')]['from'];})[_0xf5eb('0x13')](function(){return db['FaxAccount'][_0xf5eb('0x3c')]({'where':{'id':_0x23dcaa[_0xf5eb('0x3d')]['id']},'include':[{'model':db[_0xf5eb('0x3e')],'as':'List','include':[{'model':db[_0xf5eb('0x2c')],'as':_0xf5eb('0x3f'),'where':_0x33ee0c,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['FaxApplication'],'as':_0xf5eb('0x40')}]});})[_0xf5eb('0x13')](function(_0xa1ce41){if(_0xa1ce41&&_0xa1ce41['List']){var _0x2e4278=_0xa1ce41['get']({'plain':!![]});_0x11bbdd[_0xf5eb('0x3d')]=_0x2e4278;_0x11bbdd['applications']=_0x2e4278['Applications'];_0x11bbdd[_0xf5eb('0x41')]=_0x2e4278[_0xf5eb('0x42')];_0x11bbdd[_0xf5eb('0x43')]=_[_0xf5eb('0x44')](_0x11bbdd['applications'],['priority'],[_0xf5eb('0x45')]);if(_0x11bbdd[_0xf5eb('0x3d')][_0xf5eb('0x40')]){delete _0x11bbdd[_0xf5eb('0x3d')][_0xf5eb('0x40')];}if(_0x11bbdd[_0xf5eb('0x3d')][_0xf5eb('0x42')]&&_0x11bbdd['account']['List'][_0xf5eb('0x3f')][_0xf5eb('0x46')]){return _0x11bbdd[_0xf5eb('0x3d')]['List'][_0xf5eb('0x3f')][0x0];}var _0x45ed3e=_['defaults'](_0x23dcaa[_0xf5eb('0x2a')],{'firstName':_0x23dcaa[_0xf5eb('0x2a')]['from'],'ListId':_0x2e4278[_0xf5eb('0x32')]});_0x45ed3e[_0x23dcaa[_0xf5eb('0x2a')][_0xf5eb('0x39')]]=_0x23dcaa[_0xf5eb('0x2a')]['from'];return db[_0xf5eb('0x2c')][_0xf5eb('0x47')](_0x45ed3e,{'fields':_0x2b1ce3,'raw':!![]});}})['then'](function(_0x4801db){_0x11bbdd[_0xf5eb('0x48')]=_0x4801db;if(_0x4801db){var _0x25aec1={'ContactId':_0x4801db['id'],'FaxAccountId':_0x23dcaa[_0xf5eb('0x3d')]['id'],'fax':_0x4801db['fax']};return db['FaxInteraction']['find']({'where':{'ContactId':_0x4801db['id'],'closed':![],'FaxAccountId':_0x23dcaa[_0xf5eb('0x3d')]['id']}})[_0xf5eb('0x13')](function(_0x14db64){if(_0x14db64){return[_0x14db64,![]];}return db[_0xf5eb('0x49')][_0xf5eb('0x47')](_0x25aec1)['then'](function(_0x197195){return[_0x197195,!![]];});});}else{throw new Error(_0xf5eb('0x4a'));}})[_0xf5eb('0x4b')](function(_0x51fe51,_0x1ce332){var _0xaf5ae0=_0x51fe51[_0xf5eb('0x4c')]({'plain':!![]});if(_0x1ce332){if(_0x11bbdd['account'][_0xf5eb('0x4d')]){_0x11bbdd[_0xf5eb('0x43')][_0xf5eb('0x4e')]({'id':0x0,'priority':_0x11bbdd[_0xf5eb('0x43')][_0xf5eb('0x46')]+0x1,'app':_0xf5eb('0x4f'),'appdata':_0xf5eb('0x50'),'interval':_0xf5eb('0x51')});}_0xaf5ae0[_0xf5eb('0x52')]=!![];}else{_0xaf5ae0[_0xf5eb('0x52')]=![];}_0x11bbdd[_0xf5eb('0x53')]=_0xaf5ae0;return db['FaxMessage'][_0xf5eb('0x47')]({'body':_0x23dcaa[_0xf5eb('0x2a')]['body'],'FaxAccountId':_0x23dcaa[_0xf5eb('0x3d')]['id'],'FaxInteractionId':_0x51fe51['id'],'direction':'in','ContactId':_0x51fe51['ContactId'],'AttachmentId':_0x23dcaa['body'][_0xf5eb('0x54')]});})[_0xf5eb('0x13')](function(_0x44f325){_0x11bbdd[_0xf5eb('0x1c')]=_0x44f325;if(!_0x11bbdd['interaction'][_0xf5eb('0x55')])return;return db['User'][_0xf5eb('0x3c')]({'attributes':['id','name'],'where':{'id':_0x11bbdd[_0xf5eb('0x53')][_0xf5eb('0x55')]}});})[_0xf5eb('0x13')](function(_0xd3503e){if(_0xd3503e){_0x11bbdd[_0xf5eb('0x43')][_0xf5eb('0x56')]({'id':0x0,'priority':0x0,'app':_0xf5eb('0x57'),'appdata':_0xd3503e['name']+','+(_0x11bbdd[_0xf5eb('0x3d')][_0xf5eb('0x58')]||0xa),'interval':_0xf5eb('0x51')});}if(!_0x11bbdd[_0xf5eb('0x53')][_0xf5eb('0x59')])return;return db[_0xf5eb('0x5a')][_0xf5eb('0x3c')]({'attributes':['id',_0xf5eb('0x5b')],'where':{'id':_0x11bbdd['interaction'][_0xf5eb('0x59')]}});})[_0xf5eb('0x13')](function(_0x16dfea){if(_0x16dfea){_0x11bbdd[_0xf5eb('0x43')][_0xf5eb('0x56')]({'id':0x0,'priority':0x1,'app':_0xf5eb('0x5c'),'appdata':_0x16dfea[_0xf5eb('0x5b')]+','+(_0x11bbdd[_0xf5eb('0x3d')][_0xf5eb('0x5d')]||0x12c),'interval':_0xf5eb('0x51')});}return respondWithRpcPromise(_0xf5eb('0x5e'),_0xf5eb('0x5f'),_0x11bbdd);})[_0xf5eb('0x13')](function(_0x5b00ea){_0x3923da(_0x5b00ea);})['catch'](function(_0x21164d){_0x392500(_0x414c02['error'](0x1f4,_0x21164d[_0xf5eb('0x1c')]));});});}; \ No newline at end of file +var _0xd715=['no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','FaxApplication','applications','Applications','list','priority','asc','Contacts','length','create','FaxInteraction','find','spread','get','autoclose','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFaxAccount','catch','body','fax','CmContact','describe','Sequelize'];(function(_0x30409b,_0x56c640){var _0x2b0524=function(_0x363672){while(--_0x363672){_0x30409b['push'](_0x30409b['shift']());}};_0x2b0524(++_0x56c640);}(_0xd715,0x1aa));var _0x5d71=function(_0x29f6e2,_0x26e8e1){_0x29f6e2=_0x29f6e2-0x0;var _0x25eea9=_0xd715[_0x29f6e2];return _0x25eea9;};'use strict';var _=require(_0x5d71('0x0'));var util=require(_0x5d71('0x1'));var moment=require(_0x5d71('0x2'));var BPromise=require(_0x5d71('0x3'));var rs=require(_0x5d71('0x4'));var fs=require('fs');var Redis=require(_0x5d71('0x5'));var db=require(_0x5d71('0x6'))['db'];var utils=require(_0x5d71('0x7'));var logger=require(_0x5d71('0x8'))(_0x5d71('0x9'));var config=require(_0x5d71('0xa'));var jayson=require(_0x5d71('0xb'));var client=jayson['client'][_0x5d71('0xc')]({'port':0x232c});config[_0x5d71('0xd')]=_[_0x5d71('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5d71('0xf'))(new Redis(config[_0x5d71('0xd')]));require('./faxAccount.socket')[_0x5d71('0x10')](socket);function respondWithRpcPromise(_0x37b949,_0x240a11,_0x5c59c9){return new BPromise(function(_0x4f2a68,_0x4de5f4){return client[_0x5d71('0x11')](_0x37b949,_0x5c59c9)[_0x5d71('0x12')](function(_0x18ceb6){logger[_0x5d71('0x13')](_0x5d71('0x14'),_0x240a11,_0x5d71('0x15'));logger[_0x5d71('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x240a11,_0x5d71('0x15'),JSON[_0x5d71('0x17')](_0x18ceb6));if(_0x18ceb6[_0x5d71('0x18')]){if(_0x18ceb6[_0x5d71('0x18')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x240a11,_0x18ceb6[_0x5d71('0x18')][_0x5d71('0x19')]);return _0x4de5f4(_0x18ceb6['error'][_0x5d71('0x19')]);}logger[_0x5d71('0x18')]('FaxAccount,\x20%s,\x20%s',_0x240a11,_0x18ceb6[_0x5d71('0x18')][_0x5d71('0x19')]);return _0x4f2a68(_0x18ceb6['error']['message']);}else{logger[_0x5d71('0x13')](_0x5d71('0x14'),_0x240a11,_0x5d71('0x15'));_0x4f2a68(_0x18ceb6[_0x5d71('0x1a')][_0x5d71('0x19')]);}})['catch'](function(_0x4991e8){logger[_0x5d71('0x18')](_0x5d71('0x14'),_0x240a11,_0x4991e8);_0x4de5f4(_0x4991e8);});});}exports['GetFaxAccount']=function(_0x517da4){var _0x1cb10e=this;return new Promise(function(_0x1e9705,_0x2eb7a0){return db[_0x5d71('0x1b')][_0x5d71('0x1c')]({'raw':_0x517da4['options']?_0x517da4[_0x5d71('0x1d')][_0x5d71('0x1e')]===undefined?!![]:![]:!![],'where':_0x517da4[_0x5d71('0x1d')]?_0x517da4['options'][_0x5d71('0x1f')]||null:null,'attributes':_0x517da4['options']?_0x517da4[_0x5d71('0x1d')][_0x5d71('0x20')]||null:null,'limit':_0x517da4[_0x5d71('0x1d')]?_0x517da4[_0x5d71('0x1d')][_0x5d71('0x21')]||null:null,'include':_0x517da4['options']?_0x517da4[_0x5d71('0x1d')][_0x5d71('0x22')]?_['map'](_0x517da4[_0x5d71('0x1d')][_0x5d71('0x22')],function(_0x3f67ea){return{'model':db[_0x3f67ea[_0x5d71('0x23')]],'as':_0x3f67ea['as'],'attributes':_0x3f67ea[_0x5d71('0x20')],'include':_0x3f67ea[_0x5d71('0x22')]?_[_0x5d71('0x24')](_0x3f67ea[_0x5d71('0x22')],function(_0x363401){return{'model':db[_0x363401[_0x5d71('0x23')]],'as':_0x363401['as'],'attributes':_0x363401['attributes'],'include':_0x363401['include']?_[_0x5d71('0x24')](_0x363401['include'],function(_0x33bfad){return{'model':db[_0x33bfad['model']],'as':_0x33bfad['as'],'attributes':_0x33bfad[_0x5d71('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5d71('0x12')](function(_0x36fd20){logger[_0x5d71('0x13')](_0x5d71('0x25'),_0x517da4);logger[_0x5d71('0x16')](_0x5d71('0x25'),_0x517da4,JSON[_0x5d71('0x17')](_0x36fd20));_0x1e9705(_0x36fd20);})[_0x5d71('0x26')](function(_0x396937){logger[_0x5d71('0x18')](_0x5d71('0x25'),_0x396937[_0x5d71('0x19')],_0x517da4);_0x2eb7a0(_0x1cb10e['error'](0x1f4,_0x396937[_0x5d71('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x3a081c,_0x561183,_0x3e4bb2){var _0x4ea660=this;return new Promise(function(_0x56a969,_0x380e51){var _0x2ed329={'body':_0x3a081c[_0x5d71('0x27')],'channel':_0x5d71('0x28')};var _0x3c99c1=[];var _0x1f5c32=[];var _0x1d284b={};return db[_0x5d71('0x29')][_0x5d71('0x2a')]()['then'](function(_0x3e58e4){if(!_0x3e58e4){throw new db[(_0x5d71('0x2b'))]['ValidationError'](_0x5d71('0x2c'));}_0x3c99c1=_[_0x5d71('0x2d')](_[_0x5d71('0x2e')](_0x3e58e4),[_0x5d71('0x2f'),_0x5d71('0x30')]);_0x1f5c32=_[_0x5d71('0x2d')](_[_0x5d71('0x2e')](_0x3e58e4),[_0x5d71('0x2f'),'updatedAt','CompanyId',_0x5d71('0x31')]);if(_0x3a081c['body']['id']){delete _0x3a081c[_0x5d71('0x27')]['id'];}if(_[_0x5d71('0x32')](_0x3a081c['body'][_0x5d71('0x33')])){throw new db[(_0x5d71('0x2b'))]['ValidationError'](_0x5d71('0x34'));}if(_[_0x5d71('0x32')](_0x3a081c[_0x5d71('0x27')]['body'])||_0x3a081c[_0x5d71('0x27')]['body']===''){throw new db[(_0x5d71('0x2b'))]['ValidationError'](_0x5d71('0x35'));}if(_['isNil'](_0x3a081c['body']['mapKey'])){throw new db[(_0x5d71('0x2b'))][(_0x5d71('0x36'))](_0x5d71('0x37')+_0x1f5c32);}if(!_[_0x5d71('0x38')](_0x1f5c32,_0x3a081c[_0x5d71('0x27')][_0x5d71('0x39')])){throw new db[(_0x5d71('0x2b'))][(_0x5d71('0x36'))](_0x5d71('0x3a')+_0x1f5c32);}_0x1d284b[_0x3a081c[_0x5d71('0x27')][_0x5d71('0x39')]]=_0x3a081c[_0x5d71('0x27')][_0x5d71('0x33')];})[_0x5d71('0x12')](function(){return db[_0x5d71('0x1b')]['find']({'where':{'id':_0x3a081c[_0x5d71('0x3b')]['id']},'include':[{'model':db[_0x5d71('0x3c')],'as':_0x5d71('0x3d'),'include':[{'model':db[_0x5d71('0x29')],'as':'Contacts','where':_0x1d284b,'limit':0x1,'order':[['updatedAt',_0x5d71('0x3e')]]}]},{'model':db[_0x5d71('0x3f')],'as':'Applications'}]});})[_0x5d71('0x12')](function(_0x347a64){if(_0x347a64&&_0x347a64['List']){var _0x3cbaa4=_0x347a64['get']({'plain':!![]});_0x2ed329[_0x5d71('0x3b')]=_0x3cbaa4;_0x2ed329[_0x5d71('0x40')]=_0x3cbaa4[_0x5d71('0x41')];_0x2ed329[_0x5d71('0x42')]=_0x3cbaa4[_0x5d71('0x3d')];_0x2ed329[_0x5d71('0x40')]=_['orderBy'](_0x2ed329['applications'],[_0x5d71('0x43')],[_0x5d71('0x44')]);if(_0x2ed329['account'][_0x5d71('0x41')]){delete _0x2ed329['account'][_0x5d71('0x41')];}if(_0x2ed329[_0x5d71('0x3b')][_0x5d71('0x3d')]&&_0x2ed329[_0x5d71('0x3b')]['List'][_0x5d71('0x45')][_0x5d71('0x46')]){return _0x2ed329[_0x5d71('0x3b')][_0x5d71('0x3d')][_0x5d71('0x45')][0x0];}var _0x465b49=_[_0x5d71('0xe')](_0x3a081c[_0x5d71('0x27')],{'firstName':_0x3a081c['body'][_0x5d71('0x33')],'ListId':_0x3cbaa4[_0x5d71('0x31')]});_0x465b49[_0x3a081c[_0x5d71('0x27')]['mapKey']]=_0x3a081c['body'][_0x5d71('0x33')];return db['CmContact'][_0x5d71('0x47')](_0x465b49,{'fields':_0x3c99c1,'raw':!![]});}})['then'](function(_0x24624c){_0x2ed329['contact']=_0x24624c;if(_0x24624c){var _0x3a6f8b={'ContactId':_0x24624c['id'],'FaxAccountId':_0x3a081c[_0x5d71('0x3b')]['id'],'fax':_0x24624c['fax']};return db[_0x5d71('0x48')][_0x5d71('0x49')]({'where':{'ContactId':_0x24624c['id'],'closed':![],'FaxAccountId':_0x3a081c['account']['id']}})[_0x5d71('0x12')](function(_0x409286){if(_0x409286){return[_0x409286,![]];}return db['FaxInteraction'][_0x5d71('0x47')](_0x3a6f8b)[_0x5d71('0x12')](function(_0x2c0e49){return[_0x2c0e49,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x5d71('0x4a')](function(_0x117826,_0x1bf6e6){var _0xfe0415=_0x117826[_0x5d71('0x4b')]({'plain':!![]});if(_0x1bf6e6){if(_0x2ed329[_0x5d71('0x3b')][_0x5d71('0x4c')]){_0x2ed329[_0x5d71('0x40')]['push']({'id':0x0,'priority':_0x2ed329[_0x5d71('0x40')]['length']+0x1,'app':'close','appdata':_0x5d71('0x4d'),'interval':_0x5d71('0x4e')});}_0xfe0415[_0x5d71('0x4f')]=!![];}else{_0xfe0415[_0x5d71('0x4f')]=![];}_0x2ed329['interaction']=_0xfe0415;return db[_0x5d71('0x50')][_0x5d71('0x47')]({'body':_0x3a081c[_0x5d71('0x27')][_0x5d71('0x27')],'FaxAccountId':_0x3a081c[_0x5d71('0x3b')]['id'],'FaxInteractionId':_0x117826['id'],'direction':'in','ContactId':_0x117826['ContactId'],'AttachmentId':_0x3a081c[_0x5d71('0x27')][_0x5d71('0x51')]});})['then'](function(_0x3712c6){_0x2ed329[_0x5d71('0x19')]=_0x3712c6;if(!_0x2ed329[_0x5d71('0x52')][_0x5d71('0x53')])return;return db[_0x5d71('0x54')][_0x5d71('0x49')]({'attributes':['id',_0x5d71('0x55')],'where':{'id':_0x2ed329[_0x5d71('0x52')][_0x5d71('0x53')]}});})[_0x5d71('0x12')](function(_0x1a1e3f){if(_0x1a1e3f){_0x2ed329[_0x5d71('0x40')][_0x5d71('0x56')]({'id':0x0,'priority':0x0,'app':_0x5d71('0x57'),'appdata':_0x1a1e3f[_0x5d71('0x55')]+','+(_0x2ed329['account'][_0x5d71('0x58')]||0xa),'interval':_0x5d71('0x4e')});}if(!_0x2ed329[_0x5d71('0x52')][_0x5d71('0x59')])return;return db[_0x5d71('0x5a')]['find']({'attributes':['id','name'],'where':{'id':_0x2ed329[_0x5d71('0x52')]['queueId']}});})[_0x5d71('0x12')](function(_0x38c6b9){if(_0x38c6b9){_0x2ed329['applications'][_0x5d71('0x56')]({'id':0x0,'priority':0x1,'app':_0x5d71('0x5b'),'appdata':_0x38c6b9[_0x5d71('0x55')]+','+(_0x2ed329[_0x5d71('0x3b')]['waitForTheAssignedQueue']||0x12c),'interval':_0x5d71('0x4e')});}return respondWithRpcPromise(_0x5d71('0x5c'),_0x5d71('0x5d'),_0x2ed329);})[_0x5d71('0x12')](function(_0xc31f4f){_0x56a969(_0xc31f4f);})[_0x5d71('0x26')](function(_0x449953){_0x380e51(_0x4ea660[_0x5d71('0x18')](0x1f4,_0x449953[_0x5d71('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b42e8f7..daf9ed7 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 _0xe067=['save','remove','removeListener','register','./faxAccount.events'];(function(_0x13de53,_0x5cbc31){var _0x13c459=function(_0x2270ca){while(--_0x2270ca){_0x13de53['push'](_0x13de53['shift']());}};_0x13c459(++_0x5cbc31);}(_0xe067,0x9f));var _0x7e06=function(_0x1a91f0,_0x11e203){_0x1a91f0=_0x1a91f0-0x0;var _0x12f862=_0xe067[_0x1a91f0];return _0x12f862;};'use strict';var FaxAccountEvents=require(_0x7e06('0x0'));var events=[_0x7e06('0x1'),_0x7e06('0x2'),'update'];function createListener(_0x124921,_0x5c35ba){return function(_0x2b457e){_0x5c35ba['emit'](_0x124921,_0x2b457e);};}function removeListener(_0x12915f,_0x46dc2a){return function(){FaxAccountEvents[_0x7e06('0x3')](_0x12915f,_0x46dc2a);};}exports[_0x7e06('0x4')]=function(_0x2177fc){for(var _0x55725b=0x0,_0x19ed11=events['length'];_0x55725b<_0x19ed11;_0x55725b++){var _0x339752=events[_0x55725b];var _0x22ecec=createListener('faxAccount:'+_0x339752,_0x2177fc);FaxAccountEvents['on'](_0x339752,_0x22ecec);}}; \ No newline at end of file +var _0x73eb=['faxAccount:','./faxAccount.events','save','remove','update','removeListener','length'];(function(_0x3011a7,_0x1a8f8c){var _0x5c417e=function(_0x5a2193){while(--_0x5a2193){_0x3011a7['push'](_0x3011a7['shift']());}};_0x5c417e(++_0x1a8f8c);}(_0x73eb,0x16d));var _0xb73e=function(_0x330e95,_0x3f5693){_0x330e95=_0x330e95-0x0;var _0x4cc17c=_0x73eb[_0x330e95];return _0x4cc17c;};'use strict';var FaxAccountEvents=require(_0xb73e('0x0'));var events=[_0xb73e('0x1'),_0xb73e('0x2'),_0xb73e('0x3')];function createListener(_0x2c8550,_0x3954ab){return function(_0x85b735){_0x3954ab['emit'](_0x2c8550,_0x85b735);};}function removeListener(_0x14be34,_0x1d306e){return function(){FaxAccountEvents[_0xb73e('0x4')](_0x14be34,_0x1d306e);};}exports['register']=function(_0x2a9d21){for(var _0x3c0d5e=0x0,_0x266881=events[_0xb73e('0x5')];_0x3c0d5e<_0x266881;_0x3c0d5e++){var _0x3f5dee=events[_0x3c0d5e];var _0x8a2a79=createListener(_0xb73e('0x6')+_0x3f5dee,_0x2a9d21);FaxAccountEvents['on'](_0x3f5dee,_0x8a2a79);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 2616aeb..c2d7032 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 _0x7530=['express','fs-extra','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','addDisposition','/:id/canned_answers','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','send','/:id','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x591488,_0x4df078){var _0x36b15d=function(_0x45c24f){while(--_0x45c24f){_0x591488['push'](_0x591488['shift']());}};_0x36b15d(++_0x4df078);}(_0x7530,0x10d));var _0x0753=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x7530[_0x3b231a];return _0x18d67a;};'use strict';var multer=require(_0x0753('0x0'));var util=require(_0x0753('0x1'));var path=require(_0x0753('0x2'));var timeout=require(_0x0753('0x3'));var express=require(_0x0753('0x4'));var router=express['Router']();var fs_extra=require(_0x0753('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0753('0x6'));var config=require('../../config/environment');var controller=require(_0x0753('0x7'));router[_0x0753('0x8')]('/',auth[_0x0753('0x9')](),controller[_0x0753('0xa')]);router[_0x0753('0x8')](_0x0753('0xb'),auth[_0x0753('0x9')](),controller[_0x0753('0xc')]);router['get']('/:id',auth[_0x0753('0x9')](),controller[_0x0753('0xd')]);router['get'](_0x0753('0xe'),auth[_0x0753('0x9')](),controller[_0x0753('0xf')]);router[_0x0753('0x8')]('/:id/canned_answers',auth[_0x0753('0x9')](),controller[_0x0753('0x10')]);router[_0x0753('0x8')]('/:id/interactions',auth[_0x0753('0x9')](),controller[_0x0753('0x11')]);router[_0x0753('0x8')](_0x0753('0x12'),auth[_0x0753('0x9')](),controller[_0x0753('0x13')]);router['get'](_0x0753('0x14'),auth[_0x0753('0x9')](),controller[_0x0753('0x15')]);router[_0x0753('0x8')]('/:id/users',auth[_0x0753('0x9')](),controller[_0x0753('0x16')]);router[_0x0753('0x17')]('/',auth[_0x0753('0x9')](),controller['create']);router['post'](_0x0753('0xe'),auth['isAuthenticated'](),controller[_0x0753('0x18')]);router[_0x0753('0x17')](_0x0753('0x19'),auth[_0x0753('0x9')](),controller['addAnswer']);router[_0x0753('0x17')]('/:id/interactions',auth[_0x0753('0x9')](),controller['addInteraction']);router[_0x0753('0x17')](_0x0753('0x12'),auth[_0x0753('0x9')](),controller[_0x0753('0x1a')]);router[_0x0753('0x17')](_0x0753('0x1b'),auth[_0x0753('0x9')](),controller[_0x0753('0x1c')]);router[_0x0753('0x17')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x0753('0x1d')]);router[_0x0753('0x17')]('/:id/send',auth[_0x0753('0x9')](),controller[_0x0753('0x1e')]);router[_0x0753('0x17')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x0753('0x1f'),auth[_0x0753('0x9')](),controller[_0x0753('0x20')]);router[_0x0753('0x21')]('/:id',auth[_0x0753('0x9')](),controller['destroy']);router[_0x0753('0x21')](_0x0753('0xe'),auth[_0x0753('0x9')](),controller[_0x0753('0x22')]);router['delete']('/:id/canned_answers',auth[_0x0753('0x9')](),controller[_0x0753('0x23')]);router[_0x0753('0x21')](_0x0753('0x24'),auth[_0x0753('0x9')](),controller[_0x0753('0x25')]);module[_0x0753('0x26')]=router; \ No newline at end of file +var _0xa4d3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express'];(function(_0xa25862,_0x27f1a4){var _0x5b9b0a=function(_0x300346){while(--_0x300346){_0xa25862['push'](_0xa25862['shift']());}};_0x5b9b0a(++_0x27f1a4);}(_0xa4d3,0x17f));var _0x3a4d=function(_0x180ebd,_0x2311fd){_0x180ebd=_0x180ebd-0x0;var _0x5c7017=_0xa4d3[_0x180ebd];return _0x5c7017;};'use strict';var multer=require(_0x3a4d('0x0'));var util=require('util');var path=require(_0x3a4d('0x1'));var timeout=require(_0x3a4d('0x2'));var express=require(_0x3a4d('0x3'));var router=express[_0x3a4d('0x4')]();var fs_extra=require(_0x3a4d('0x5'));var auth=require(_0x3a4d('0x6'));var interaction=require(_0x3a4d('0x7'));var config=require(_0x3a4d('0x8'));var controller=require(_0x3a4d('0x9'));router[_0x3a4d('0xa')]('/',auth[_0x3a4d('0xb')](),controller[_0x3a4d('0xc')]);router[_0x3a4d('0xa')]('/describe',auth[_0x3a4d('0xb')](),controller['describe']);router[_0x3a4d('0xa')](_0x3a4d('0xd'),auth['isAuthenticated'](),controller[_0x3a4d('0xe')]);router['get'](_0x3a4d('0xf'),auth['isAuthenticated'](),controller[_0x3a4d('0x10')]);router[_0x3a4d('0xa')]('/:id/canned_answers',auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x11')]);router[_0x3a4d('0xa')](_0x3a4d('0x12'),auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x13')]);router[_0x3a4d('0xa')](_0x3a4d('0x14'),auth['isAuthenticated'](),controller['getApplications']);router[_0x3a4d('0xa')]('/:id/messages',auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x15')]);router[_0x3a4d('0xa')](_0x3a4d('0x16'),auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x17')]);router[_0x3a4d('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3a4d('0x18')]('/:id/dispositions',auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x19')]);router[_0x3a4d('0x18')](_0x3a4d('0x1a'),auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x1b')]);router['post'](_0x3a4d('0x12'),auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x1c')]);router[_0x3a4d('0x18')]('/:id/applications',auth[_0x3a4d('0xb')](),controller['addApplications']);router['post'](_0x3a4d('0x1d'),auth['isAuthenticated'](),controller[_0x3a4d('0x1e')]);router[_0x3a4d('0x18')](_0x3a4d('0x1f'),auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x20')]);router['post'](_0x3a4d('0x21'),auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x22')]);router[_0x3a4d('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x3a4d('0x23')]);router[_0x3a4d('0x24')](_0x3a4d('0xd'),auth[_0x3a4d('0xb')](),controller['update']);router[_0x3a4d('0x25')]('/:id',auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x26')]);router[_0x3a4d('0x25')](_0x3a4d('0xf'),auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x27')]);router[_0x3a4d('0x25')](_0x3a4d('0x1a'),auth[_0x3a4d('0xb')](),controller[_0x3a4d('0x28')]);router[_0x3a4d('0x25')](_0x3a4d('0x16'),auth['isAuthenticated'](),controller[_0x3a4d('0x29')]);module[_0x3a4d('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 66e2fd1..9a01f5d 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 _0x4c4f=['noop','TEXT','sequelize','exports','STRING'];(function(_0x36e1f5,_0x211cdb){var _0x3f49f6=function(_0x29df55){while(--_0x29df55){_0x36e1f5['push'](_0x36e1f5['shift']());}};_0x3f49f6(++_0x211cdb);}(_0x4c4f,0x18d));var _0xf4c4=function(_0x4fc4cf,_0x2eb3a1){_0x4fc4cf=_0x4fc4cf-0x0;var _0x24de8b=_0x4c4f[_0x4fc4cf];return _0x24de8b;};'use strict';var Sequelize=require(_0xf4c4('0x0'));module[_0xf4c4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf4c4('0x2')],'allowNull':![],'defaultValue':_0xf4c4('0x3')},'appdata':{'type':Sequelize[_0xf4c4('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf4c4('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3916=['TEXT','sequelize','STRING'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0x3916,0x11b));var _0x6391=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0x3916[_0x1635fe];return _0x3c512a;};'use strict';var Sequelize=require(_0x6391('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6391('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6391('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 62d509c..3256a88 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 _0xbc15=['merge','map','options','includeAll','include','findAll','catch','show','params','intersection','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','destroy','then','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter'];(function(_0x3f5e77,_0x28d4c7){var _0x3d87d2=function(_0x24b24b){while(--_0x24b24b){_0x3f5e77['push'](_0x3f5e77['shift']());}};_0x3d87d2(++_0x28d4c7);}(_0xbc15,0x1c4));var _0x5bc1=function(_0x4f6472,_0x1e90d2){_0x4f6472=_0x4f6472-0x0;var _0x3aec7e=_0xbc15[_0x4f6472];return _0x3aec7e;};'use strict';var emlformat=require(_0x5bc1('0x0'));var rimraf=require(_0x5bc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bc1('0x2'));var rp=require(_0x5bc1('0x3'));var moment=require(_0x5bc1('0x4'));var BPromise=require(_0x5bc1('0x5'));var Mustache=require(_0x5bc1('0x6'));var util=require(_0x5bc1('0x7'));var path=require(_0x5bc1('0x8'));var sox=require(_0x5bc1('0x9'));var csv=require(_0x5bc1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bc1('0xb'));var _=require(_0x5bc1('0xc'));var squel=require(_0x5bc1('0xd'));var crypto=require(_0x5bc1('0xe'));var jsforce=require(_0x5bc1('0xf'));var deskjs=require(_0x5bc1('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5bc1('0x11'));var Redis=require(_0x5bc1('0x12'));var authService=require(_0x5bc1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bc1('0x14'))(_0x5bc1('0x15'));var utils=require(_0x5bc1('0x16'));var config=require(_0x5bc1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bc1('0x18'))['db'];function respondWithStatusCode(_0x60c243,_0x27c6e7){_0x27c6e7=_0x27c6e7||0xcc;return function(_0x14f7d9){if(_0x14f7d9){return _0x60c243['sendStatus'](_0x27c6e7);}return _0x60c243['status'](_0x27c6e7)[_0x5bc1('0x19')]();};}function respondWithResult(_0x14e7cd,_0x55b7d0){_0x55b7d0=_0x55b7d0||0xc8;return function(_0x455202){if(_0x455202){return _0x14e7cd[_0x5bc1('0x1a')](_0x55b7d0)[_0x5bc1('0x1b')](_0x455202);}};}function respondWithFilteredResult(_0x217265,_0x210756){return function(_0x3fb6ef){if(_0x3fb6ef){var _0xa3fc21=typeof _0x210756['offset']==='undefined'&&typeof _0x210756['limit']===_0x5bc1('0x1c');var _0x4004a9=_0x3fb6ef[_0x5bc1('0x1d')];var _0x12914d=_0xa3fc21?0x0:_0x210756[_0x5bc1('0x1e')];var _0x1390dd=_0xa3fc21?_0x3fb6ef[_0x5bc1('0x1d')]:_0x210756[_0x5bc1('0x1e')]+_0x210756['limit'];var _0x38171b;if(_0x1390dd>=_0x4004a9){_0x1390dd=_0x4004a9;_0x38171b=0xc8;}else{_0x38171b=0xce;}_0x217265['status'](_0x38171b);return _0x217265['set']('Content-Range',_0x12914d+'-'+_0x1390dd+'/'+_0x4004a9)['json'](_0x3fb6ef);}return null;};}function patchUpdates(_0x46062f){return function(_0x1cad9e){try{jsonpatch[_0x5bc1('0x1f')](_0x1cad9e,_0x46062f,!![]);}catch(_0x5456eb){return BPromise[_0x5bc1('0x20')](_0x5456eb);}return _0x1cad9e['save']();};}function saveUpdates(_0xf27dda,_0x2e347a){return function(_0x1bc832){if(_0x1bc832){return _0x1bc832['update'](_0xf27dda)['then'](function(_0x5b87c9){return _0x5b87c9;});}return null;};}function removeEntity(_0x3d9092,_0x54b03c){return function(_0x2aba60){if(_0x2aba60){return _0x2aba60[_0x5bc1('0x21')]()[_0x5bc1('0x22')](function(){_0x3d9092[_0x5bc1('0x1a')](0xcc)[_0x5bc1('0x19')]();});}};}function handleEntityNotFound(_0x34085c,_0x1643ae){return function(_0x4e7f45){if(!_0x4e7f45){_0x34085c['sendStatus'](0x194);}return _0x4e7f45;};}function handleError(_0x3efd38,_0x52ff18){_0x52ff18=_0x52ff18||0x1f4;return function(_0x14798b){logger[_0x5bc1('0x23')](_0x14798b[_0x5bc1('0x24')]);if(_0x14798b[_0x5bc1('0x25')]){delete _0x14798b[_0x5bc1('0x25')];}_0x3efd38['status'](_0x52ff18)[_0x5bc1('0x26')](_0x14798b);};}exports[_0x5bc1('0x27')]=function(_0x19bb75,_0x543f08){var _0x90e51b={},_0x348068={},_0x5ee0ec={'count':0x0,'rows':[]};var _0x43973c=_['map'](db[_0x5bc1('0x28')][_0x5bc1('0x29')],function(_0x261f05){return{'name':_0x261f05[_0x5bc1('0x2a')],'type':_0x261f05[_0x5bc1('0x2b')][_0x5bc1('0x2c')]};});_0x348068['model']=_['map'](_0x43973c,_0x5bc1('0x25'));_0x348068[_0x5bc1('0x2d')]=_[_0x5bc1('0x2e')](_0x19bb75[_0x5bc1('0x2d')]);_0x348068['filters']=_['intersection'](_0x348068[_0x5bc1('0x2f')],_0x348068[_0x5bc1('0x2d')]);_0x90e51b['attributes']=_['intersection'](_0x348068['model'],qs[_0x5bc1('0x30')](_0x19bb75['query']['fields']));_0x90e51b[_0x5bc1('0x31')]=_0x90e51b[_0x5bc1('0x31')][_0x5bc1('0x32')]?_0x90e51b[_0x5bc1('0x31')]:_0x348068[_0x5bc1('0x2f')];if(!_0x19bb75['query'][_0x5bc1('0x33')](_0x5bc1('0x34'))){_0x90e51b['limit']=qs[_0x5bc1('0x35')](_0x19bb75[_0x5bc1('0x2d')][_0x5bc1('0x35')]);_0x90e51b[_0x5bc1('0x1e')]=qs[_0x5bc1('0x1e')](_0x19bb75[_0x5bc1('0x2d')][_0x5bc1('0x1e')]);}_0x90e51b['order']=qs['sort'](_0x19bb75[_0x5bc1('0x2d')][_0x5bc1('0x36')]);_0x90e51b[_0x5bc1('0x37')]=qs['filters'](_[_0x5bc1('0x38')](_0x19bb75[_0x5bc1('0x2d')],_0x348068[_0x5bc1('0x39')]),_0x43973c);if(_0x19bb75[_0x5bc1('0x2d')][_0x5bc1('0x3a')]){_0x90e51b[_0x5bc1('0x37')]=_[_0x5bc1('0x3b')](_0x90e51b['where'],{'$or':_[_0x5bc1('0x3c')](_0x43973c,function(_0x451512){if(_0x451512['type']!=='VIRTUAL'){var _0x49491d={};_0x49491d[_0x451512[_0x5bc1('0x25')]]={'$like':'%'+_0x19bb75['query'][_0x5bc1('0x3a')]+'%'};return _0x49491d;}})});}_0x90e51b=_[_0x5bc1('0x3b')]({},_0x90e51b,_0x19bb75[_0x5bc1('0x3d')]);var _0x3c9c0d={'where':_0x90e51b['where']};return db[_0x5bc1('0x28')]['count'](_0x3c9c0d)[_0x5bc1('0x22')](function(_0x5b21e2){_0x5ee0ec[_0x5bc1('0x1d')]=_0x5b21e2;if(_0x19bb75[_0x5bc1('0x2d')][_0x5bc1('0x3e')]){_0x90e51b[_0x5bc1('0x3f')]=[{'all':!![]}];}return db[_0x5bc1('0x28')][_0x5bc1('0x40')](_0x90e51b);})[_0x5bc1('0x22')](function(_0x1447a2){_0x5ee0ec['rows']=_0x1447a2;return _0x5ee0ec;})[_0x5bc1('0x22')](respondWithFilteredResult(_0x543f08,_0x90e51b))[_0x5bc1('0x41')](handleError(_0x543f08,null));};exports[_0x5bc1('0x42')]=function(_0x29c553,_0x3e89bf){var _0x562cb6={'raw':!![],'where':{'id':_0x29c553[_0x5bc1('0x43')]['id']}},_0x284f14={};_0x284f14[_0x5bc1('0x2f')]=_['keys'](db[_0x5bc1('0x28')][_0x5bc1('0x29')]);_0x284f14[_0x5bc1('0x2d')]=_[_0x5bc1('0x2e')](_0x29c553['query']);_0x284f14[_0x5bc1('0x39')]=_[_0x5bc1('0x44')](_0x284f14['model'],_0x284f14['query']);_0x562cb6[_0x5bc1('0x31')]=_[_0x5bc1('0x44')](_0x284f14[_0x5bc1('0x2f')],qs['fields'](_0x29c553[_0x5bc1('0x2d')]['fields']));_0x562cb6[_0x5bc1('0x31')]=_0x562cb6[_0x5bc1('0x31')][_0x5bc1('0x32')]?_0x562cb6[_0x5bc1('0x31')]:_0x284f14[_0x5bc1('0x2f')];if(_0x29c553['query'][_0x5bc1('0x3e')]){_0x562cb6[_0x5bc1('0x3f')]=[{'all':!![]}];}_0x562cb6=_[_0x5bc1('0x3b')]({},_0x562cb6,_0x29c553[_0x5bc1('0x3d')]);return db[_0x5bc1('0x28')]['find'](_0x562cb6)['then'](handleEntityNotFound(_0x3e89bf,null))['then'](respondWithResult(_0x3e89bf,null))[_0x5bc1('0x41')](handleError(_0x3e89bf,null));};exports['create']=function(_0x2d223b,_0x2ed444){return db[_0x5bc1('0x28')][_0x5bc1('0x45')](_0x2d223b[_0x5bc1('0x46')],{})[_0x5bc1('0x22')](respondWithResult(_0x2ed444,0xc9))['catch'](handleError(_0x2ed444,null));};exports[_0x5bc1('0x47')]=function(_0x4a7508,_0x41be62){if(_0x4a7508[_0x5bc1('0x46')]['id']){delete _0x4a7508['body']['id'];}return db[_0x5bc1('0x28')][_0x5bc1('0x48')]({'where':{'id':_0x4a7508[_0x5bc1('0x43')]['id']}})[_0x5bc1('0x22')](handleEntityNotFound(_0x41be62,null))[_0x5bc1('0x22')](saveUpdates(_0x4a7508[_0x5bc1('0x46')],null))['then'](respondWithResult(_0x41be62,null))[_0x5bc1('0x41')](handleError(_0x41be62,null));};exports[_0x5bc1('0x21')]=function(_0x49a338,_0x309d5e){return db['FaxApplication'][_0x5bc1('0x48')]({'where':{'id':_0x49a338['params']['id']}})[_0x5bc1('0x22')](handleEntityNotFound(_0x309d5e,null))[_0x5bc1('0x22')](removeEntity(_0x309d5e,null))[_0x5bc1('0x41')](handleError(_0x309d5e,null));}; \ No newline at end of file +var _0x2486=['util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','error','stack','name','send','index','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','update','destroy','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x2486,0xe4));var _0x6248=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2486[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6248('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6248('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6248('0x2'));var moment=require(_0x6248('0x3'));var BPromise=require(_0x6248('0x4'));var Mustache=require(_0x6248('0x5'));var util=require(_0x6248('0x6'));var path=require(_0x6248('0x7'));var sox=require(_0x6248('0x8'));var csv=require('to-csv');var ejs=require(_0x6248('0x9'));var fs=require('fs');var fs_extra=require(_0x6248('0xa'));var _=require(_0x6248('0xb'));var squel=require(_0x6248('0xc'));var crypto=require('crypto');var jsforce=require(_0x6248('0xd'));var deskjs=require(_0x6248('0xe'));var toCsv=require(_0x6248('0xf'));var querystring=require(_0x6248('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6248('0x11'));var qs=require(_0x6248('0x12'));var as=require(_0x6248('0x13'));var hardwareService=require(_0x6248('0x14'));var logger=require(_0x6248('0x15'))(_0x6248('0x16'));var utils=require('../../config/utils');var config=require(_0x6248('0x17'));var licenseUtil=require(_0x6248('0x18'));var db=require(_0x6248('0x19'))['db'];function respondWithStatusCode(_0x3ed3b5,_0x508313){_0x508313=_0x508313||0xcc;return function(_0x134819){if(_0x134819){return _0x3ed3b5[_0x6248('0x1a')](_0x508313);}return _0x3ed3b5[_0x6248('0x1b')](_0x508313)[_0x6248('0x1c')]();};}function respondWithResult(_0x514817,_0x372426){_0x372426=_0x372426||0xc8;return function(_0x1e3838){if(_0x1e3838){return _0x514817[_0x6248('0x1b')](_0x372426)[_0x6248('0x1d')](_0x1e3838);}};}function respondWithFilteredResult(_0x1c7b99,_0x2316cf){return function(_0x1c30bc){if(_0x1c30bc){var _0x572fd6=typeof _0x2316cf[_0x6248('0x1e')]===_0x6248('0x1f')&&typeof _0x2316cf['limit']===_0x6248('0x1f');var _0x3928af=_0x1c30bc[_0x6248('0x20')];var _0x16dadb=_0x572fd6?0x0:_0x2316cf['offset'];var _0x24b53b=_0x572fd6?_0x1c30bc[_0x6248('0x20')]:_0x2316cf['offset']+_0x2316cf[_0x6248('0x21')];var _0x38b1e1;if(_0x24b53b>=_0x3928af){_0x24b53b=_0x3928af;_0x38b1e1=0xc8;}else{_0x38b1e1=0xce;}_0x1c7b99[_0x6248('0x1b')](_0x38b1e1);return _0x1c7b99[_0x6248('0x22')]('Content-Range',_0x16dadb+'-'+_0x24b53b+'/'+_0x3928af)[_0x6248('0x1d')](_0x1c30bc);}return null;};}function patchUpdates(_0x4a2787){return function(_0x43fa9d){try{jsonpatch['apply'](_0x43fa9d,_0x4a2787,!![]);}catch(_0x25048d){return BPromise[_0x6248('0x23')](_0x25048d);}return _0x43fa9d[_0x6248('0x24')]();};}function saveUpdates(_0x4b293a,_0x3340dc){return function(_0x32cbd4){if(_0x32cbd4){return _0x32cbd4['update'](_0x4b293a)[_0x6248('0x25')](function(_0x18d357){return _0x18d357;});}return null;};}function removeEntity(_0x147e9f,_0x2f4cb5){return function(_0x4411f6){if(_0x4411f6){return _0x4411f6['destroy']()['then'](function(){_0x147e9f[_0x6248('0x1b')](0xcc)[_0x6248('0x1c')]();});}};}function handleEntityNotFound(_0x30f928,_0x192a02){return function(_0x122d20){if(!_0x122d20){_0x30f928[_0x6248('0x1a')](0x194);}return _0x122d20;};}function handleError(_0xb2c185,_0x410afe){_0x410afe=_0x410afe||0x1f4;return function(_0x22fae9){logger[_0x6248('0x26')](_0x22fae9[_0x6248('0x27')]);if(_0x22fae9[_0x6248('0x28')]){delete _0x22fae9['name'];}_0xb2c185[_0x6248('0x1b')](_0x410afe)[_0x6248('0x29')](_0x22fae9);};}exports[_0x6248('0x2a')]=function(_0x15d24e,_0x25c9df){var _0x1b4217={},_0x40cc65={},_0x4ea39f={'count':0x0,'rows':[]};var _0x1aa3da=_['map'](db['FaxApplication']['rawAttributes'],function(_0x58bdb5){return{'name':_0x58bdb5[_0x6248('0x2b')],'type':_0x58bdb5[_0x6248('0x2c')][_0x6248('0x2d')]};});_0x40cc65[_0x6248('0x2e')]=_[_0x6248('0x2f')](_0x1aa3da,_0x6248('0x28'));_0x40cc65[_0x6248('0x30')]=_['keys'](_0x15d24e[_0x6248('0x30')]);_0x40cc65['filters']=_[_0x6248('0x31')](_0x40cc65[_0x6248('0x2e')],_0x40cc65[_0x6248('0x30')]);_0x1b4217[_0x6248('0x32')]=_[_0x6248('0x31')](_0x40cc65[_0x6248('0x2e')],qs['fields'](_0x15d24e[_0x6248('0x30')][_0x6248('0x33')]));_0x1b4217[_0x6248('0x32')]=_0x1b4217[_0x6248('0x32')][_0x6248('0x34')]?_0x1b4217[_0x6248('0x32')]:_0x40cc65[_0x6248('0x2e')];if(!_0x15d24e['query'][_0x6248('0x35')](_0x6248('0x36'))){_0x1b4217[_0x6248('0x21')]=qs[_0x6248('0x21')](_0x15d24e[_0x6248('0x30')][_0x6248('0x21')]);_0x1b4217[_0x6248('0x1e')]=qs['offset'](_0x15d24e[_0x6248('0x30')][_0x6248('0x1e')]);}_0x1b4217[_0x6248('0x37')]=qs[_0x6248('0x38')](_0x15d24e[_0x6248('0x30')][_0x6248('0x38')]);_0x1b4217[_0x6248('0x39')]=qs['filters'](_[_0x6248('0x3a')](_0x15d24e[_0x6248('0x30')],_0x40cc65[_0x6248('0x3b')]),_0x1aa3da);if(_0x15d24e[_0x6248('0x30')][_0x6248('0x3c')]){_0x1b4217['where']=_[_0x6248('0x3d')](_0x1b4217[_0x6248('0x39')],{'$or':_[_0x6248('0x2f')](_0x1aa3da,function(_0x599e54){if(_0x599e54[_0x6248('0x2c')]!==_0x6248('0x3e')){var _0x2b8f28={};_0x2b8f28[_0x599e54[_0x6248('0x28')]]={'$like':'%'+_0x15d24e[_0x6248('0x30')]['filter']+'%'};return _0x2b8f28;}})});}_0x1b4217=_[_0x6248('0x3d')]({},_0x1b4217,_0x15d24e[_0x6248('0x3f')]);var _0x4e742e={'where':_0x1b4217[_0x6248('0x39')]};return db[_0x6248('0x40')]['count'](_0x4e742e)['then'](function(_0x5d8613){_0x4ea39f[_0x6248('0x20')]=_0x5d8613;if(_0x15d24e[_0x6248('0x30')][_0x6248('0x41')]){_0x1b4217[_0x6248('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0x6248('0x43')](_0x1b4217);})[_0x6248('0x25')](function(_0x156cf0){_0x4ea39f[_0x6248('0x44')]=_0x156cf0;return _0x4ea39f;})[_0x6248('0x25')](respondWithFilteredResult(_0x25c9df,_0x1b4217))[_0x6248('0x45')](handleError(_0x25c9df,null));};exports['show']=function(_0x1d0ea0,_0x30d989){var _0x1b7d91={'raw':!![],'where':{'id':_0x1d0ea0[_0x6248('0x46')]['id']}},_0x1b1702={};_0x1b1702['model']=_[_0x6248('0x47')](db[_0x6248('0x40')][_0x6248('0x48')]);_0x1b1702[_0x6248('0x30')]=_[_0x6248('0x47')](_0x1d0ea0[_0x6248('0x30')]);_0x1b1702['filters']=_[_0x6248('0x31')](_0x1b1702[_0x6248('0x2e')],_0x1b1702[_0x6248('0x30')]);_0x1b7d91['attributes']=_[_0x6248('0x31')](_0x1b1702[_0x6248('0x2e')],qs['fields'](_0x1d0ea0[_0x6248('0x30')][_0x6248('0x33')]));_0x1b7d91[_0x6248('0x32')]=_0x1b7d91[_0x6248('0x32')][_0x6248('0x34')]?_0x1b7d91[_0x6248('0x32')]:_0x1b1702['model'];if(_0x1d0ea0[_0x6248('0x30')][_0x6248('0x41')]){_0x1b7d91[_0x6248('0x42')]=[{'all':!![]}];}_0x1b7d91=_['merge']({},_0x1b7d91,_0x1d0ea0[_0x6248('0x3f')]);return db[_0x6248('0x40')]['find'](_0x1b7d91)['then'](handleEntityNotFound(_0x30d989,null))['then'](respondWithResult(_0x30d989,null))[_0x6248('0x45')](handleError(_0x30d989,null));};exports[_0x6248('0x49')]=function(_0x25d8ed,_0x4a0e2f){return db[_0x6248('0x40')][_0x6248('0x49')](_0x25d8ed[_0x6248('0x4a')],{})[_0x6248('0x25')](respondWithResult(_0x4a0e2f,0xc9))[_0x6248('0x45')](handleError(_0x4a0e2f,null));};exports[_0x6248('0x4b')]=function(_0x24f9d9,_0x3e72bf){if(_0x24f9d9[_0x6248('0x4a')]['id']){delete _0x24f9d9[_0x6248('0x4a')]['id'];}return db[_0x6248('0x40')]['find']({'where':{'id':_0x24f9d9[_0x6248('0x46')]['id']}})[_0x6248('0x25')](handleEntityNotFound(_0x3e72bf,null))[_0x6248('0x25')](saveUpdates(_0x24f9d9[_0x6248('0x4a')],null))[_0x6248('0x25')](respondWithResult(_0x3e72bf,null))['catch'](handleError(_0x3e72bf,null));};exports[_0x6248('0x4c')]=function(_0x310cb9,_0x2c2a7c){return db[_0x6248('0x40')][_0x6248('0x4d')]({'where':{'id':_0x310cb9[_0x6248('0x46')]['id']}})[_0x6248('0x25')](handleEntityNotFound(_0x2c2a7c,null))[_0x6248('0x25')](removeEntity(_0x2c2a7c,null))[_0x6248('0x45')](handleError(_0x2c2a7c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e6075f3..dbb0216 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 _0x762a=['utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4'];(function(_0x3ea3ac,_0x4ede36){var _0x5d0f93=function(_0x5508ce){while(--_0x5508ce){_0x3ea3ac['push'](_0x3ea3ac['shift']());}};_0x5d0f93(++_0x4ede36);}(_0x762a,0x115));var _0xa762=function(_0x44370a,_0x3ac0a1){_0x44370a=_0x44370a-0x0;var _0x47c072=_0x762a[_0x44370a];return _0x47c072;};'use strict';var _=require(_0xa762('0x0'));var util=require('util');var logger=require(_0xa762('0x1'))(_0xa762('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa762('0x3'));var fs=require('fs');var path=require(_0xa762('0x4'));var rimraf=require(_0xa762('0x5'));var config=require(_0xa762('0x6'));var attributes=require('./faxApplication.attributes');module[_0xa762('0x7')]=function(_0x228eab,_0x23f553){return _0x228eab[_0xa762('0x8')]('FaxApplication',attributes,{'tableName':_0xa762('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa762('0xa'),'collate':_0xa762('0xb')});}; \ No newline at end of file +var _0x1860=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x6b066,_0x5041c8){var _0x649aca=function(_0x195c93){while(--_0x195c93){_0x6b066['push'](_0x6b066['shift']());}};_0x649aca(++_0x5041c8);}(_0x1860,0x16b));var _0x0186=function(_0x3eb471,_0x4e4b94){_0x3eb471=_0x3eb471-0x0;var _0x28aaff=_0x1860[_0x3eb471];return _0x28aaff;};'use strict';var _=require(_0x0186('0x0'));var util=require(_0x0186('0x1'));var logger=require(_0x0186('0x2'))(_0x0186('0x3'));var moment=require(_0x0186('0x4'));var BPromise=require(_0x0186('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0186('0x6'));var rimraf=require(_0x0186('0x7'));var config=require(_0x0186('0x8'));var attributes=require(_0x0186('0x9'));module[_0x0186('0xa')]=function(_0x91dffa,_0x2dbc49){return _0x91dffa[_0x0186('0xb')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0186('0xc'),'collate':_0x0186('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1fccece..5df4782 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 _0x41ea=['code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','update','body','options','raw','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x21446b,_0x3e539e){var _0xfe74d4=function(_0x1833c7){while(--_0x1833c7){_0x21446b['push'](_0x21446b['shift']());}};_0xfe74d4(++_0x3e539e);}(_0x41ea,0x97));var _0xa41e=function(_0x39cc46,_0x28b341){_0x39cc46=_0x39cc46-0x0;var _0x2b7db5=_0x41ea[_0x39cc46];return _0x2b7db5;};'use strict';var _=require(_0xa41e('0x0'));var util=require(_0xa41e('0x1'));var moment=require('moment');var BPromise=require(_0xa41e('0x2'));var rs=require(_0xa41e('0x3'));var fs=require('fs');var Redis=require(_0xa41e('0x4'));var db=require(_0xa41e('0x5'))['db'];var utils=require(_0xa41e('0x6'));var logger=require(_0xa41e('0x7'))(_0xa41e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa41e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c62c6,_0x3b01f3,_0x11c0a3){return new BPromise(function(_0x4d3faa,_0x5ce92a){return client[_0xa41e('0xa')](_0x2c62c6,_0x11c0a3)[_0xa41e('0xb')](function(_0x2dbce9){logger['info']('FaxApplication,\x20%s,\x20%s',_0x3b01f3,'request\x20sent');logger[_0xa41e('0xc')](_0xa41e('0xd'),_0x3b01f3,_0xa41e('0xe'),JSON[_0xa41e('0xf')](_0x2dbce9));if(_0x2dbce9[_0xa41e('0x10')]){if(_0x2dbce9[_0xa41e('0x10')][_0xa41e('0x11')]===0x1f4){logger['error'](_0xa41e('0x12'),_0x3b01f3,_0x2dbce9[_0xa41e('0x10')][_0xa41e('0x13')]);return _0x5ce92a(_0x2dbce9[_0xa41e('0x10')][_0xa41e('0x13')]);}logger[_0xa41e('0x10')]('FaxApplication,\x20%s,\x20%s',_0x3b01f3,_0x2dbce9[_0xa41e('0x10')][_0xa41e('0x13')]);return _0x4d3faa(_0x2dbce9[_0xa41e('0x10')][_0xa41e('0x13')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x3b01f3,'request\x20sent');_0x4d3faa(_0x2dbce9[_0xa41e('0x14')][_0xa41e('0x13')]);}})[_0xa41e('0x15')](function(_0x11b269){logger[_0xa41e('0x10')](_0xa41e('0x12'),_0x3b01f3,_0x11b269);_0x5ce92a(_0x11b269);});});}exports[_0xa41e('0x16')]=function(_0x344b94){var _0x5e40d6=this;return new Promise(function(_0x21b7cf,_0x2253b0){return db['FaxApplication'][_0xa41e('0x17')](_0x344b94[_0xa41e('0x18')],{'raw':_0x344b94['options']?_0x344b94[_0xa41e('0x19')][_0xa41e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x344b94[_0xa41e('0x19')]?_0x344b94['options']['where']||null:null,'attributes':_0x344b94[_0xa41e('0x19')]?_0x344b94[_0xa41e('0x19')]['attributes']||null:null,'limit':_0x344b94[_0xa41e('0x19')]?_0x344b94[_0xa41e('0x19')][_0xa41e('0x1b')]||null:null})['then'](function(_0x24eb51){logger['info'](_0xa41e('0x16'),_0x344b94);logger[_0xa41e('0xc')](_0xa41e('0x16'),_0x344b94,JSON[_0xa41e('0xf')](_0x24eb51));_0x21b7cf(_0x24eb51);})['catch'](function(_0x3060ac){logger[_0xa41e('0x10')]('UpdateFaxApplication',_0x3060ac[_0xa41e('0x13')],_0x344b94);_0x2253b0(_0x5e40d6[_0xa41e('0x10')](0x1f4,_0x3060ac['message']));});});}; \ No newline at end of file +var _0x4fed=['stringify','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2cda9e,_0xc2dc12){var _0x4f4491=function(_0x507d47){while(--_0x507d47){_0x2cda9e['push'](_0x2cda9e['shift']());}};_0x4f4491(++_0xc2dc12);}(_0x4fed,0x107));var _0xd4fe=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x4fed[_0x20589d];return _0x422de9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4fe('0x0'));var BPromise=require(_0xd4fe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4fe('0x2'));var db=require(_0xd4fe('0x3'))['db'];var utils=require(_0xd4fe('0x4'));var logger=require(_0xd4fe('0x5'))(_0xd4fe('0x6'));var config=require(_0xd4fe('0x7'));var jayson=require(_0xd4fe('0x8'));var client=jayson[_0xd4fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x334dbc,_0x2adadd,_0x13b3b0){return new BPromise(function(_0x5a0e1f,_0xe74816){return client[_0xd4fe('0xa')](_0x334dbc,_0x13b3b0)[_0xd4fe('0xb')](function(_0x25c12a){logger['info'](_0xd4fe('0xc'),_0x2adadd,_0xd4fe('0xd'));logger[_0xd4fe('0xe')](_0xd4fe('0xf'),_0x2adadd,_0xd4fe('0xd'),JSON[_0xd4fe('0x10')](_0x25c12a));if(_0x25c12a[_0xd4fe('0x11')]){if(_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x12')]===0x1f4){logger[_0xd4fe('0x11')](_0xd4fe('0xc'),_0x2adadd,_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x13')]);return _0xe74816(_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x13')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x2adadd,_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x13')]);return _0x5a0e1f(_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x13')]);}else{logger[_0xd4fe('0x14')](_0xd4fe('0xc'),_0x2adadd,'request\x20sent');_0x5a0e1f(_0x25c12a[_0xd4fe('0x15')][_0xd4fe('0x13')]);}})[_0xd4fe('0x16')](function(_0x1fd111){logger[_0xd4fe('0x11')](_0xd4fe('0xc'),_0x2adadd,_0x1fd111);_0xe74816(_0x1fd111);});});}exports[_0xd4fe('0x17')]=function(_0x48b1f1){var _0xc8c39c=this;return new Promise(function(_0x7bf51e,_0x524b6d){return db[_0xd4fe('0x18')]['update'](_0x48b1f1[_0xd4fe('0x19')],{'raw':_0x48b1f1[_0xd4fe('0x1a')]?_0x48b1f1[_0xd4fe('0x1a')][_0xd4fe('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48b1f1[_0xd4fe('0x1a')]?_0x48b1f1['options'][_0xd4fe('0x1c')]||null:null,'attributes':_0x48b1f1['options']?_0x48b1f1[_0xd4fe('0x1a')][_0xd4fe('0x1d')]||null:null,'limit':_0x48b1f1['options']?_0x48b1f1['options'][_0xd4fe('0x1e')]||null:null})[_0xd4fe('0xb')](function(_0x651bc2){logger[_0xd4fe('0x14')](_0xd4fe('0x17'),_0x48b1f1);logger[_0xd4fe('0xe')](_0xd4fe('0x17'),_0x48b1f1,JSON[_0xd4fe('0x10')](_0x651bc2));_0x7bf51e(_0x651bc2);})['catch'](function(_0x4949be){logger[_0xd4fe('0x11')]('UpdateFaxApplication',_0x4949be[_0xd4fe('0x13')],_0x48b1f1);_0x524b6d(_0xc8c39c[_0xd4fe('0x11')](0x1f4,_0x4949be[_0xd4fe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index fb6930e..d3b20ba 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 _0xb10b=['./faxApplication.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8ab0b,_0x179caa){var _0x1d3b60=function(_0xd7b0ef){while(--_0xd7b0ef){_0x8ab0b['push'](_0x8ab0b['shift']());}};_0x1d3b60(++_0x179caa);}(_0xb10b,0x12a));var _0xbb10=function(_0x2377a3,_0x7b4522){_0x2377a3=_0x2377a3-0x0;var _0x538284=_0xb10b[_0x2377a3];return _0x538284;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea28,0x13a));var _0x8ea2=function(_0x2d2907,_0x4968a8){_0x2d2907=_0x2d2907-0x0;var _0x1afec8=_0xea28[_0x2d2907];return _0x1afec8;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 910a35d..f8c0bf4 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 _0x6a95=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x33f11c,_0x1dac56){var _0x33e364=function(_0x2a34ba){while(--_0x2a34ba){_0x33f11c['push'](_0x33f11c['shift']());}};_0x33e364(++_0x1dac56);}(_0x6a95,0x1db));var _0x56a9=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x6a95[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'closed':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x56a9('0x3')]},'disposition':{'type':Sequelize[_0x56a9('0x4')]},'secondDisposition':{'type':Sequelize[_0x56a9('0x4')]},'thirdDisposition':{'type':Sequelize[_0x56a9('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x56a9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x56a9('0x5')]('in',_0x56a9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x56a9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x56a9('0x5')]('in',_0x56a9('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x56a9('0x7')]}}; \ No newline at end of file +var _0x2542=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x1efffb,_0x42b9a4){var _0x330946=function(_0x155390){while(--_0x155390){_0x1efffb['push'](_0x1efffb['shift']());}};_0x330946(++_0x42b9a4);}(_0x2542,0x169));var _0x2254=function(_0x1c4201,_0x59ddcc){_0x1c4201=_0x1c4201-0x0;var _0x27461c=_0x2542[_0x1c4201];return _0x27461c;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'closed':{'type':Sequelize[_0x2254('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2254('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2254('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2254('0x4')]},'read1stAt':{'type':Sequelize[_0x2254('0x3')]},'fax':{'type':Sequelize[_0x2254('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2254('0x5')]('in',_0x2254('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2254('0x5')]('in',_0x2254('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2254('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 2304875..400fafe 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 _0x943e=['user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','catch','create','body','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','order','sort','where','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','Attachment','createdAt','get','mkdirSync','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','rimraf','zip-dir','moment','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','undefined','limit','count','offset','set','update','then','destroy','error','name','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','fax','query'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x943e,0x102));var _0xe943=function(_0x1bf059,_0x34a4ff){_0x1bf059=_0x1bf059-0x0;var _0x52b9ac=_0x943e[_0x1bf059];return _0x52b9ac;};'use strict';var rimraf=require(_0xe943('0x0'));var zipdir=require(_0xe943('0x1'));var moment=require(_0xe943('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xe943('0x3'));var Redis=require(_0xe943('0x4'));var interaction=require(_0xe943('0x5'));var qs=require(_0xe943('0x6'));var logger=require('../../config/logger')(_0xe943('0x7'));var config=require(_0xe943('0x8'));var db=require(_0xe943('0x9'))['db'];config[_0xe943('0xa')]=_[_0xe943('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe943('0xc'))(new Redis(config[_0xe943('0xa')]));require(_0xe943('0xd'))['register'](socket);function respondWithStatusCode(_0x4d4404,_0x5096e5){_0x5096e5=_0x5096e5||0xcc;return function(_0x632c2c){if(_0x632c2c){return _0x4d4404[_0xe943('0xe')](_0x5096e5);}return _0x4d4404['status'](_0x5096e5)['end']();};}function respondWithResult(_0x12c72c,_0x5a3961){_0x5a3961=_0x5a3961||0xc8;return function(_0x3bd62b){if(_0x3bd62b){return _0x12c72c[_0xe943('0xf')](_0x5a3961)[_0xe943('0x10')](_0x3bd62b);}};}function respondWithFilteredResult(_0x1cfd64,_0x3207f5){return function(_0x29af5b){if(_0x29af5b){var _0x4c8df0=typeof _0x3207f5['offset']===_0xe943('0x11')&&typeof _0x3207f5[_0xe943('0x12')]===_0xe943('0x11');var _0x2037d5=_0x29af5b[_0xe943('0x13')];var _0x1ff89e=_0x4c8df0?0x0:_0x3207f5[_0xe943('0x14')];var _0x27b9e1=_0x4c8df0?_0x29af5b[_0xe943('0x13')]:_0x3207f5['offset']+_0x3207f5['limit'];var _0x2ea7ff;if(_0x27b9e1>=_0x2037d5){_0x27b9e1=_0x2037d5;_0x2ea7ff=0xc8;}else{_0x2ea7ff=0xce;}_0x1cfd64[_0xe943('0xf')](_0x2ea7ff);return _0x1cfd64[_0xe943('0x15')]('Content-Range',_0x1ff89e+'-'+_0x27b9e1+'/'+_0x2037d5)[_0xe943('0x10')](_0x29af5b);}return null;};}function saveUpdates(_0x3e89a0){return function(_0x49de0e){if(_0x49de0e){return _0x49de0e[_0xe943('0x16')](_0x3e89a0)[_0xe943('0x17')](function(_0x58fac1){return _0x58fac1;});}return null;};}function removeEntity(_0x1dced3){return function(_0x58e676){if(_0x58e676){return _0x58e676[_0xe943('0x18')]()['then'](function(){_0x1dced3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x475ba9){return function(_0x4787a8){if(!_0x4787a8){_0x475ba9[_0xe943('0xe')](0x194);}return _0x4787a8;};}function handleError(_0x32a225,_0x2ac198){_0x2ac198=_0x2ac198||0x1f4;return function(_0xb2710a){logger[_0xe943('0x19')](_0xb2710a['stack']);if(_0xb2710a['name']){delete _0xb2710a[_0xe943('0x1a')];}_0x32a225['status'](_0x2ac198)['send'](_0xb2710a);};}exports['index']=function(_0x28358a,_0x2a6248){var _0x43d31e={};var _0x448abc=_[_0xe943('0x1b')](db[_0xe943('0x1c')][_0xe943('0x1d')],function(_0x580709){return{'name':_0x580709[_0xe943('0x1e')],'type':_0x580709[_0xe943('0x1f')]['key']};});_0x43d31e=qs[_0xe943('0x20')](_0x448abc,_0x28358a);return interaction[_0xe943('0x21')](_0xe943('0x22'),_0x28358a[_0xe943('0x23')],_0x28358a[_0xe943('0x24')],_0x43d31e,_0x448abc)[_0xe943('0x17')](respondWithFilteredResult(_0x2a6248,_0x43d31e))['catch'](handleError(_0x2a6248,null));};exports[_0xe943('0x25')]=function(_0x19f559,_0x2a453a){var _0x590cd6={'raw':![],'where':{'id':_0x19f559[_0xe943('0x26')]['id']}},_0x561b38={};_0x561b38[_0xe943('0x27')]=_[_0xe943('0x28')](db[_0xe943('0x1c')][_0xe943('0x1d')]);_0x561b38[_0xe943('0x23')]=_[_0xe943('0x28')](_0x19f559['query']);_0x561b38[_0xe943('0x29')]=_[_0xe943('0x2a')](_0x561b38[_0xe943('0x27')],_0x561b38[_0xe943('0x23')]);_0x590cd6[_0xe943('0x2b')]=_['intersection'](_0x561b38[_0xe943('0x27')],qs[_0xe943('0x2c')](_0x19f559['query'][_0xe943('0x2c')]));_0x590cd6[_0xe943('0x2b')]=_0x590cd6['attributes'][_0xe943('0x2d')]?_0x590cd6[_0xe943('0x2b')]:_0x561b38[_0xe943('0x27')];if(_0x19f559[_0xe943('0x23')][_0xe943('0x2e')]){_0x590cd6['include']=[{'all':!![]}];}_0x590cd6=_[_0xe943('0x2f')]({},_0x590cd6,_0x19f559['options']);return db[_0xe943('0x1c')][_0xe943('0x30')](_0x590cd6)['then'](handleEntityNotFound(_0x2a453a,null))['then'](respondWithResult(_0x2a453a,null))[_0xe943('0x31')](handleError(_0x2a453a,null));};exports['create']=function(_0x9196c6,_0x44fec3){return db['FaxInteraction'][_0xe943('0x32')](_0x9196c6['body'],{})[_0xe943('0x17')](respondWithResult(_0x44fec3,0xc9))[_0xe943('0x31')](handleError(_0x44fec3,null));};exports[_0xe943('0x16')]=function(_0x30e499,_0x10a50f){if(_0x30e499[_0xe943('0x33')]['id']){delete _0x30e499[_0xe943('0x33')]['id'];}return db[_0xe943('0x1c')][_0xe943('0x30')]({'where':{'id':_0x30e499[_0xe943('0x26')]['id']}})[_0xe943('0x17')](handleEntityNotFound(_0x10a50f,null))[_0xe943('0x17')](saveUpdates(_0x30e499[_0xe943('0x33')],null))['then'](respondWithResult(_0x10a50f,null))['catch'](handleError(_0x10a50f,null));};exports[_0xe943('0x18')]=function(_0x409420,_0x229c49){return db[_0xe943('0x1c')][_0xe943('0x30')]({'where':{'id':_0x409420[_0xe943('0x26')]['id']}})['then'](handleEntityNotFound(_0x229c49,null))[_0xe943('0x17')](removeEntity(_0x229c49,null))[_0xe943('0x31')](handleError(_0x229c49,null));};exports[_0xe943('0x34')]=function(_0x347880,_0x14bdc5){return db['FaxInteraction'][_0xe943('0x34')]()['then'](respondWithResult(_0x14bdc5,null))[_0xe943('0x31')](handleError(_0x14bdc5,null));};exports['addMessage']=function(_0x578901,_0x542c4b){return db[_0xe943('0x35')][_0xe943('0x30')]({'where':{'id':_0x578901['params']['id']}})[_0xe943('0x17')](handleEntityNotFound(_0x542c4b,null))[_0xe943('0x17')](function(_0x165bda){if(_0x165bda){return _0x165bda[_0xe943('0x36')](_0x578901[_0xe943('0x33')][_0xe943('0x37')],_[_0xe943('0x38')](_0x578901[_0xe943('0x33')],['ids','id'])||{});}})[_0xe943('0x17')](respondWithResult(_0x542c4b,null))[_0xe943('0x31')](handleError(_0x542c4b,null));};exports[_0xe943('0x39')]=function(_0x2f8fdd,_0x58a36e){var _0x56ee8d={'raw':![],'where':{}};var _0x3c8034={};var _0x538a58={'count':0x0,'rows':[]};return db[_0xe943('0x1c')][_0xe943('0x3a')]({'where':{'id':_0x2f8fdd[_0xe943('0x26')]['id']}})['then'](handleEntityNotFound(_0x58a36e,null))[_0xe943('0x17')](function(_0x13c292){if(_0x13c292){_0x3c8034[_0xe943('0x27')]=_['keys'](db[_0xe943('0x35')][_0xe943('0x1d')]);_0x3c8034[_0xe943('0x23')]=_[_0xe943('0x28')](_0x2f8fdd[_0xe943('0x23')]);_0x3c8034[_0xe943('0x29')]=_[_0xe943('0x2a')](_0x3c8034[_0xe943('0x27')],_0x3c8034['query']);_0x56ee8d['attributes']=_[_0xe943('0x2a')](_0x3c8034[_0xe943('0x27')],qs['fields'](_0x2f8fdd[_0xe943('0x23')]['fields']));_0x56ee8d[_0xe943('0x2b')]=_0x56ee8d[_0xe943('0x2b')][_0xe943('0x2d')]?_0x56ee8d[_0xe943('0x2b')]:_0x3c8034[_0xe943('0x27')];if(!_0x2f8fdd[_0xe943('0x23')]['hasOwnProperty']('nolimit')){_0x56ee8d[_0xe943('0x12')]=qs[_0xe943('0x12')](_0x2f8fdd[_0xe943('0x23')][_0xe943('0x12')]);_0x56ee8d[_0xe943('0x14')]=qs[_0xe943('0x14')](_0x2f8fdd['query'][_0xe943('0x14')]);}_0x56ee8d[_0xe943('0x3b')]=qs['sort'](_0x2f8fdd[_0xe943('0x23')][_0xe943('0x3c')]);_0x56ee8d[_0xe943('0x3d')]=qs['filters'](_['pick'](_0x2f8fdd[_0xe943('0x23')],_0x3c8034['filters']));_0x56ee8d[_0xe943('0x3d')][_0xe943('0x3e')]=_0x13c292['id'];if(_0x2f8fdd[_0xe943('0x23')]['filter']){_0x56ee8d[_0xe943('0x3d')]=_[_0xe943('0x2f')](_0x56ee8d[_0xe943('0x3d')],{'$or':_[_0xe943('0x1b')](_0x56ee8d['attributes'],function(_0x39e343){var _0x15a4cb={};_0x15a4cb[_0x39e343]={'$like':'%'+_0x2f8fdd[_0xe943('0x23')][_0xe943('0x3f')]+'%'};return _0x15a4cb;})});}if(_0x2f8fdd[_0xe943('0x23')][_0xe943('0x40')]){var _0x10b525=_0x2f8fdd[_0xe943('0x23')][_0xe943('0x40')][_0xe943('0x41')](',');var _0x354b8c={};_0x354b8c[_0x10b525[0x0]]={'$gte':moment(_0x10b525[0x1])['format'](_0xe943('0x42'))};_0x56ee8d[_0xe943('0x3d')]=_[_0xe943('0x2f')](_0x56ee8d['where'],_0x354b8c);}_0x56ee8d=_['merge']({},_0x56ee8d,_0x2f8fdd[_0xe943('0x43')]);return db[_0xe943('0x35')][_0xe943('0x13')]({'where':_0x56ee8d['where']})[_0xe943('0x17')](function(_0x124e6a){_0x538a58['count']=_0x124e6a;if(_0x2f8fdd['query']['includeAll']){_0x56ee8d[_0xe943('0x44')]=[{'all':!![]}];}return db['FaxMessage'][_0xe943('0x21')](_0x56ee8d);})['then'](function(_0x204fb9){_0x538a58['rows']=_0x204fb9;return _0x538a58;});}})[_0xe943('0x17')](respondWithFilteredResult(_0x58a36e,_0x56ee8d))[_0xe943('0x31')](handleError(_0x58a36e,null));};exports[_0xe943('0x45')]=function(_0xbae61e,_0x4675c3){return db[_0xe943('0x1c')][_0xe943('0x30')]({'where':{'id':_0xbae61e['params']['id']}})[_0xe943('0x17')](handleEntityNotFound(_0x4675c3,null))['then'](function(_0x5eb501){if(_0x5eb501){return _0x5eb501[_0xe943('0x46')](_0xbae61e[_0xe943('0x33')]['ids'],_['omit'](_0xbae61e[_0xe943('0x33')],[_0xe943('0x37'),'id'])||{})[_0xe943('0x47')](function(){return db['Tag']['findAll']({'attributes':['id',_0xe943('0x1a'),_0xe943('0x48')],'where':{'id':_0xbae61e[_0xe943('0x33')][_0xe943('0x37')]}});})[_0xe943('0x17')](function(_0x1e8891){socket[_0xe943('0x49')](_0xe943('0x4a'),{'id':Number(_0xbae61e['params']['id']),'tags':_0x1e8891||[]});return{'id':Number(_0xbae61e[_0xe943('0x26')]['id']),'tags':_0x1e8891||[]};});}})['then'](respondWithResult(_0x4675c3,null))['catch'](handleError(_0x4675c3,null));};exports[_0xe943('0x4b')]=function(_0x1d3634,_0x3b7829){return db[_0xe943('0x1c')][_0xe943('0x30')]({'where':{'id':_0x1d3634[_0xe943('0x26')]['id']}})[_0xe943('0x17')](handleEntityNotFound(_0x3b7829,null))['then'](function(_0x4c59d8){if(_0x4c59d8){return _0x4c59d8['removeTags'](_0x1d3634[_0xe943('0x23')][_0xe943('0x37')]);}})[_0xe943('0x17')](respondWithStatusCode(_0x3b7829,null))[_0xe943('0x31')](handleError(_0x3b7829,null));};exports[_0xe943('0x4c')]=function(_0x189639,_0x2e90a0){var _0x2f60cc=moment()[_0xe943('0x4d')]()[_0xe943('0x4e')]();var _0x16cd15=path[_0xe943('0x4f')](config[_0xe943('0x50')],_0xe943('0x51'),_0xe943('0x52'),_0xe943('0x53'));var _0x2c7b24=path[_0xe943('0x4f')](config[_0xe943('0x50')],_0xe943('0x51'),_0xe943('0x52'),_0xe943('0x54'));var _0x560944=path[_0xe943('0x4f')](_0x16cd15,_0x2f60cc);var _0x10d215=util[_0xe943('0x55')]('transcript-%d-%s.zip',_0x189639[_0xe943('0x26')]['id'],_0x2f60cc);var _0x8a65d8=path[_0xe943('0x4f')](_0x16cd15,_0x10d215);var _0x11d697=[];_0x11d697['push']({'model':db[_0xe943('0x56')],'as':_0xe943('0x56'),'raw':!![]});var _0x813210=[{'model':db[_0xe943('0x35')],'as':'Messages','attributes':['id',_0xe943('0x33'),_0xe943('0x57')],'include':_0x11d697}];return db[_0xe943('0x1c')][_0xe943('0x30')]({'where':{'id':_0x189639[_0xe943('0x26')]['id']},'include':_0x813210})[_0xe943('0x17')](handleEntityNotFound(_0x2e90a0,null))[_0xe943('0x17')](function(_0x92abb7){if(_0x92abb7&&_0x92abb7['Messages']){var _0x5a80a6=_0x92abb7[_0xe943('0x58')]({'plain':!![]});fs[_0xe943('0x59')](_0x560944);for(var _0x1316d0=0x0;_0x1316d0<_0x5a80a6[_0xe943('0x5a')][_0xe943('0x2d')];_0x1316d0++){var _0x10320d=_0x5a80a6['Messages'][_0x1316d0][_0xe943('0x56')];if(_0x10320d){var _0x4044fb=path[_0xe943('0x4f')](_0x2c7b24,_0x10320d['basename']);if(fs[_0xe943('0x5b')](_0x4044fb)){fs[_0xe943('0x5c')](_0x4044fb)[_0xe943('0x5d')](fs[_0xe943('0x5e')](path[_0xe943('0x4f')](_0x560944,_0x10320d[_0xe943('0x5f')])));}}}return BPromise['resolve']()[_0xe943('0x17')](function(){return new BPromise(function(_0x2008d8,_0x43ffb1){zipdir(_0x560944,{'saveTo':_0x8a65d8},function(_0x205e93,_0x3431af){if(_0x205e93)return _0x43ffb1(_0x205e93);return _0x2008d8(_0x3431af);});})[_0xe943('0x17')](function(){return new BPromise(function(_0x687982,_0x18c34e){rimraf(_0x560944,function(_0x5ec6f7){if(_0x5ec6f7)_0x18c34e(_0x5ec6f7);return _0x687982();});});})[_0xe943('0x17')](function(){return _0x2e90a0[_0xe943('0x4c')](_0x8a65d8,_0x10d215,function(_0x3bb570){if(_0x3bb570){console[_0xe943('0x60')](_0xe943('0x61'),_0x3bb570);}else{fs['unlinkSync'](_0x8a65d8);}});});});}else{return _0x2e90a0[_0xe943('0xe')](0xc8);}})[_0xe943('0x31')](handleError(_0x2e90a0,null));}; \ No newline at end of file +var _0x361b=['format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','ids','color','emit','removeTags','download','unix','toString','join','root','server','files','attachments','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','findAll','query','catch','show','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','create','body','find','params','destroy','describe','FaxMessage','omit','getMessages','length','hasOwnProperty','order','sort','pick','where','FaxInteractionId','filter','$gte','split'];(function(_0x567264,_0x6b7514){var _0x33c39c=function(_0x14479f){while(--_0x14479f){_0x567264['push'](_0x567264['shift']());}};_0x33c39c(++_0x6b7514);}(_0x361b,0x151));var _0xb361=function(_0x1f576d,_0x1dfa24){_0x1f576d=_0x1f576d-0x0;var _0x156642=_0x361b[_0x1f576d];return _0x156642;};'use strict';var rimraf=require(_0xb361('0x0'));var zipdir=require(_0xb361('0x1'));var moment=require(_0xb361('0x2'));var BPromise=require(_0xb361('0x3'));var util=require(_0xb361('0x4'));var path=require(_0xb361('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb361('0x6'));var interaction=require(_0xb361('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xb361('0x8'))(_0xb361('0x9'));var config=require(_0xb361('0xa'));var db=require(_0xb361('0xb'))['db'];config['redis']=_[_0xb361('0xc')](config[_0xb361('0xd')],{'host':_0xb361('0xe'),'port':0x18eb});var socket=require(_0xb361('0xf'))(new Redis(config['redis']));require(_0xb361('0x10'))[_0xb361('0x11')](socket);function respondWithStatusCode(_0xf302f4,_0x7a5e34){_0x7a5e34=_0x7a5e34||0xcc;return function(_0x13b4e3){if(_0x13b4e3){return _0xf302f4[_0xb361('0x12')](_0x7a5e34);}return _0xf302f4[_0xb361('0x13')](_0x7a5e34)['end']();};}function respondWithResult(_0x1faca9,_0x1985d5){_0x1985d5=_0x1985d5||0xc8;return function(_0x11ebf3){if(_0x11ebf3){return _0x1faca9['status'](_0x1985d5)[_0xb361('0x14')](_0x11ebf3);}};}function respondWithFilteredResult(_0x265dd6,_0x345ebd){return function(_0x2b8fcb){if(_0x2b8fcb){var _0x256177=typeof _0x345ebd[_0xb361('0x15')]===_0xb361('0x16')&&typeof _0x345ebd[_0xb361('0x17')]===_0xb361('0x16');var _0x20a8dd=_0x2b8fcb[_0xb361('0x18')];var _0x5c19b9=_0x256177?0x0:_0x345ebd[_0xb361('0x15')];var _0x5a1c4c=_0x256177?_0x2b8fcb[_0xb361('0x18')]:_0x345ebd['offset']+_0x345ebd[_0xb361('0x17')];var _0x4cfaf1;if(_0x5a1c4c>=_0x20a8dd){_0x5a1c4c=_0x20a8dd;_0x4cfaf1=0xc8;}else{_0x4cfaf1=0xce;}_0x265dd6[_0xb361('0x13')](_0x4cfaf1);return _0x265dd6[_0xb361('0x19')](_0xb361('0x1a'),_0x5c19b9+'-'+_0x5a1c4c+'/'+_0x20a8dd)['json'](_0x2b8fcb);}return null;};}function saveUpdates(_0x1fcd0c){return function(_0x223420){if(_0x223420){return _0x223420[_0xb361('0x1b')](_0x1fcd0c)[_0xb361('0x1c')](function(_0xf0aef3){return _0xf0aef3;});}return null;};}function removeEntity(_0x270e95){return function(_0xd22b9c){if(_0xd22b9c){return _0xd22b9c['destroy']()[_0xb361('0x1c')](function(){_0x270e95[_0xb361('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30704b){return function(_0x1d211a){if(!_0x1d211a){_0x30704b[_0xb361('0x12')](0x194);}return _0x1d211a;};}function handleError(_0x241045,_0x38d98d){_0x38d98d=_0x38d98d||0x1f4;return function(_0x4d096d){logger[_0xb361('0x1d')](_0x4d096d['stack']);if(_0x4d096d[_0xb361('0x1e')]){delete _0x4d096d[_0xb361('0x1e')];}_0x241045[_0xb361('0x13')](_0x38d98d)[_0xb361('0x1f')](_0x4d096d);};}exports[_0xb361('0x20')]=function(_0x3fcfac,_0xa9b2e3){var _0x468115={};var _0x4a49a4=_[_0xb361('0x21')](db[_0xb361('0x22')][_0xb361('0x23')],function(_0x2e8d03){return{'name':_0x2e8d03[_0xb361('0x24')],'type':_0x2e8d03['type'][_0xb361('0x25')]};});_0x468115=qs['getOptions'](_0x4a49a4,_0x3fcfac);return interaction[_0xb361('0x26')]('fax',_0x3fcfac[_0xb361('0x27')],_0x3fcfac['user'],_0x468115,_0x4a49a4)[_0xb361('0x1c')](respondWithFilteredResult(_0xa9b2e3,_0x468115))[_0xb361('0x28')](handleError(_0xa9b2e3,null));};exports[_0xb361('0x29')]=function(_0x1c14c2,_0x354141){var _0x6edc5a={'raw':![],'where':{'id':_0x1c14c2['params']['id']}},_0x2723bf={};_0x2723bf[_0xb361('0x2a')]=_['keys'](db[_0xb361('0x22')][_0xb361('0x23')]);_0x2723bf[_0xb361('0x27')]=_[_0xb361('0x2b')](_0x1c14c2[_0xb361('0x27')]);_0x2723bf[_0xb361('0x2c')]=_[_0xb361('0x2d')](_0x2723bf[_0xb361('0x2a')],_0x2723bf['query']);_0x6edc5a[_0xb361('0x2e')]=_[_0xb361('0x2d')](_0x2723bf[_0xb361('0x2a')],qs[_0xb361('0x2f')](_0x1c14c2['query'][_0xb361('0x2f')]));_0x6edc5a['attributes']=_0x6edc5a[_0xb361('0x2e')]['length']?_0x6edc5a['attributes']:_0x2723bf[_0xb361('0x2a')];if(_0x1c14c2[_0xb361('0x27')][_0xb361('0x30')]){_0x6edc5a[_0xb361('0x31')]=[{'all':!![]}];}_0x6edc5a=_[_0xb361('0x32')]({},_0x6edc5a,_0x1c14c2[_0xb361('0x33')]);return db[_0xb361('0x22')]['find'](_0x6edc5a)[_0xb361('0x1c')](handleEntityNotFound(_0x354141,null))[_0xb361('0x1c')](respondWithResult(_0x354141,null))[_0xb361('0x28')](handleError(_0x354141,null));};exports[_0xb361('0x34')]=function(_0x3e7ce3,_0x32766c){return db[_0xb361('0x22')]['create'](_0x3e7ce3['body'],{})[_0xb361('0x1c')](respondWithResult(_0x32766c,0xc9))[_0xb361('0x28')](handleError(_0x32766c,null));};exports[_0xb361('0x1b')]=function(_0x18d5e6,_0x21506e){if(_0x18d5e6[_0xb361('0x35')]['id']){delete _0x18d5e6[_0xb361('0x35')]['id'];}return db[_0xb361('0x22')][_0xb361('0x36')]({'where':{'id':_0x18d5e6[_0xb361('0x37')]['id']}})[_0xb361('0x1c')](handleEntityNotFound(_0x21506e,null))[_0xb361('0x1c')](saveUpdates(_0x18d5e6['body'],null))[_0xb361('0x1c')](respondWithResult(_0x21506e,null))[_0xb361('0x28')](handleError(_0x21506e,null));};exports[_0xb361('0x38')]=function(_0x12f6e1,_0x880306){return db[_0xb361('0x22')][_0xb361('0x36')]({'where':{'id':_0x12f6e1['params']['id']}})[_0xb361('0x1c')](handleEntityNotFound(_0x880306,null))[_0xb361('0x1c')](removeEntity(_0x880306,null))[_0xb361('0x28')](handleError(_0x880306,null));};exports[_0xb361('0x39')]=function(_0x64728c,_0x467cf8){return db[_0xb361('0x22')][_0xb361('0x39')]()[_0xb361('0x1c')](respondWithResult(_0x467cf8,null))[_0xb361('0x28')](handleError(_0x467cf8,null));};exports['addMessage']=function(_0x18986d,_0x419258){return db[_0xb361('0x3a')][_0xb361('0x36')]({'where':{'id':_0x18986d[_0xb361('0x37')]['id']}})['then'](handleEntityNotFound(_0x419258,null))['then'](function(_0xb2cc23){if(_0xb2cc23){return _0xb2cc23['addMessage'](_0x18986d[_0xb361('0x35')]['ids'],_[_0xb361('0x3b')](_0x18986d['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x419258,null))[_0xb361('0x28')](handleError(_0x419258,null));};exports[_0xb361('0x3c')]=function(_0xfdab67,_0x1de958){var _0x341dea={'raw':![],'where':{}};var _0x1ade66={};var _0x44531c={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0xfdab67[_0xb361('0x37')]['id']}})[_0xb361('0x1c')](handleEntityNotFound(_0x1de958,null))[_0xb361('0x1c')](function(_0x278796){if(_0x278796){_0x1ade66[_0xb361('0x2a')]=_[_0xb361('0x2b')](db[_0xb361('0x3a')][_0xb361('0x23')]);_0x1ade66[_0xb361('0x27')]=_['keys'](_0xfdab67[_0xb361('0x27')]);_0x1ade66[_0xb361('0x2c')]=_[_0xb361('0x2d')](_0x1ade66[_0xb361('0x2a')],_0x1ade66['query']);_0x341dea['attributes']=_[_0xb361('0x2d')](_0x1ade66[_0xb361('0x2a')],qs[_0xb361('0x2f')](_0xfdab67[_0xb361('0x27')][_0xb361('0x2f')]));_0x341dea[_0xb361('0x2e')]=_0x341dea[_0xb361('0x2e')][_0xb361('0x3d')]?_0x341dea['attributes']:_0x1ade66[_0xb361('0x2a')];if(!_0xfdab67['query'][_0xb361('0x3e')]('nolimit')){_0x341dea[_0xb361('0x17')]=qs[_0xb361('0x17')](_0xfdab67[_0xb361('0x27')][_0xb361('0x17')]);_0x341dea[_0xb361('0x15')]=qs[_0xb361('0x15')](_0xfdab67[_0xb361('0x27')][_0xb361('0x15')]);}_0x341dea[_0xb361('0x3f')]=qs[_0xb361('0x40')](_0xfdab67[_0xb361('0x27')][_0xb361('0x40')]);_0x341dea['where']=qs['filters'](_[_0xb361('0x41')](_0xfdab67[_0xb361('0x27')],_0x1ade66['filters']));_0x341dea[_0xb361('0x42')][_0xb361('0x43')]=_0x278796['id'];if(_0xfdab67[_0xb361('0x27')]['filter']){_0x341dea[_0xb361('0x42')]=_['merge'](_0x341dea['where'],{'$or':_[_0xb361('0x21')](_0x341dea[_0xb361('0x2e')],function(_0x79017a){var _0x1e6e0b={};_0x1e6e0b[_0x79017a]={'$like':'%'+_0xfdab67[_0xb361('0x27')][_0xb361('0x44')]+'%'};return _0x1e6e0b;})});}if(_0xfdab67[_0xb361('0x27')][_0xb361('0x45')]){var _0x52c4e6=_0xfdab67['query'][_0xb361('0x45')][_0xb361('0x46')](',');var _0x554fc8={};_0x554fc8[_0x52c4e6[0x0]]={'$gte':moment(_0x52c4e6[0x1])[_0xb361('0x47')](_0xb361('0x48'))};_0x341dea[_0xb361('0x42')]=_['merge'](_0x341dea[_0xb361('0x42')],_0x554fc8);}_0x341dea=_[_0xb361('0x32')]({},_0x341dea,_0xfdab67[_0xb361('0x33')]);return db['FaxMessage'][_0xb361('0x18')]({'where':_0x341dea[_0xb361('0x42')]})[_0xb361('0x1c')](function(_0x43b81c){_0x44531c['count']=_0x43b81c;if(_0xfdab67[_0xb361('0x27')][_0xb361('0x30')]){_0x341dea[_0xb361('0x31')]=[{'all':!![]}];}return db[_0xb361('0x3a')]['findAll'](_0x341dea);})['then'](function(_0x45400c){_0x44531c['rows']=_0x45400c;return _0x44531c;});}})[_0xb361('0x1c')](respondWithFilteredResult(_0x1de958,_0x341dea))['catch'](handleError(_0x1de958,null));};exports[_0xb361('0x49')]=function(_0x29b967,_0x283e36){return db[_0xb361('0x22')]['find']({'where':{'id':_0x29b967[_0xb361('0x37')]['id']}})[_0xb361('0x1c')](handleEntityNotFound(_0x283e36,null))[_0xb361('0x1c')](function(_0x226582){if(_0x226582){return _0x226582[_0xb361('0x4a')](_0x29b967[_0xb361('0x35')][_0xb361('0x4b')],_[_0xb361('0x3b')](_0x29b967[_0xb361('0x35')],[_0xb361('0x4b'),'id'])||{})['spread'](function(){return db['Tag'][_0xb361('0x26')]({'attributes':['id',_0xb361('0x1e'),_0xb361('0x4c')],'where':{'id':_0x29b967[_0xb361('0x35')]['ids']}});})['then'](function(_0xe63462){socket[_0xb361('0x4d')]('faxInteractionTags:save',{'id':Number(_0x29b967['params']['id']),'tags':_0xe63462||[]});return{'id':Number(_0x29b967[_0xb361('0x37')]['id']),'tags':_0xe63462||[]};});}})[_0xb361('0x1c')](respondWithResult(_0x283e36,null))[_0xb361('0x28')](handleError(_0x283e36,null));};exports['removeTags']=function(_0x2bed85,_0x488160){return db[_0xb361('0x22')][_0xb361('0x36')]({'where':{'id':_0x2bed85[_0xb361('0x37')]['id']}})[_0xb361('0x1c')](handleEntityNotFound(_0x488160,null))[_0xb361('0x1c')](function(_0x479632){if(_0x479632){return _0x479632[_0xb361('0x4e')](_0x2bed85[_0xb361('0x27')]['ids']);}})[_0xb361('0x1c')](respondWithStatusCode(_0x488160,null))['catch'](handleError(_0x488160,null));};exports[_0xb361('0x4f')]=function(_0x2f49e9,_0x89a7cb){var _0x5617ba=moment()[_0xb361('0x50')]()[_0xb361('0x51')]();var _0x2ee015=path[_0xb361('0x52')](config[_0xb361('0x53')],'server','files','tmp');var _0x37a493=path[_0xb361('0x52')](config[_0xb361('0x53')],_0xb361('0x54'),_0xb361('0x55'),_0xb361('0x56'));var _0x26887f=path['join'](_0x2ee015,_0x5617ba);var _0x443bbe=util['format']('transcript-%d-%s.zip',_0x2f49e9[_0xb361('0x37')]['id'],_0x5617ba);var _0x223754=path[_0xb361('0x52')](_0x2ee015,_0x443bbe);var _0x43e95c=[];_0x43e95c[_0xb361('0x57')]({'model':db[_0xb361('0x58')],'as':_0xb361('0x58'),'raw':!![]});var _0x50ede7=[{'model':db['FaxMessage'],'as':_0xb361('0x59'),'attributes':['id',_0xb361('0x35'),_0xb361('0x5a')],'include':_0x43e95c}];return db[_0xb361('0x22')][_0xb361('0x36')]({'where':{'id':_0x2f49e9[_0xb361('0x37')]['id']},'include':_0x50ede7})[_0xb361('0x1c')](handleEntityNotFound(_0x89a7cb,null))[_0xb361('0x1c')](function(_0x4d762f){if(_0x4d762f&&_0x4d762f[_0xb361('0x59')]){var _0x4ea078=_0x4d762f[_0xb361('0x5b')]({'plain':!![]});fs[_0xb361('0x5c')](_0x26887f);for(var _0x164f0a=0x0;_0x164f0a<_0x4ea078[_0xb361('0x59')][_0xb361('0x3d')];_0x164f0a++){var _0x166bc8=_0x4ea078[_0xb361('0x59')][_0x164f0a]['Attachment'];if(_0x166bc8){var _0x514225=path[_0xb361('0x52')](_0x37a493,_0x166bc8[_0xb361('0x5d')]);if(fs[_0xb361('0x5e')](_0x514225)){fs[_0xb361('0x5f')](_0x514225)[_0xb361('0x60')](fs[_0xb361('0x61')](path[_0xb361('0x52')](_0x26887f,_0x166bc8[_0xb361('0x5d')])));}}}return BPromise[_0xb361('0x62')]()['then'](function(){return new BPromise(function(_0x4ceef2,_0x428307){zipdir(_0x26887f,{'saveTo':_0x223754},function(_0x57f4a8,_0x10012b){if(_0x57f4a8)return _0x428307(_0x57f4a8);return _0x4ceef2(_0x10012b);});})[_0xb361('0x1c')](function(){return new BPromise(function(_0x408b70,_0x3b5c2c){rimraf(_0x26887f,function(_0x439eeb){if(_0x439eeb)_0x3b5c2c(_0x439eeb);return _0x408b70();});});})[_0xb361('0x1c')](function(){return _0x89a7cb[_0xb361('0x4f')](_0x223754,_0x443bbe,function(_0x86848f){if(_0x86848f){console[_0xb361('0x63')](_0xb361('0x64'),_0x86848f);}else{fs[_0xb361('0x65')](_0x223754);}});});});}else{return _0x89a7cb[_0xb361('0x12')](0xc8);}})['catch'](handleError(_0x89a7cb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 246ec2b..7105fcf 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 _0xb804=['setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb804,0x12a));var _0x4b80=function(_0x2cb074,_0x12d323){_0x2cb074=_0x2cb074-0x0;var _0x42593c=_0xb804[_0x2cb074];return _0x42593c;};'use strict';var EventEmitter=require(_0x4b80('0x0'));var FaxInteraction=require(_0x4b80('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x4b80('0x1'))['db'][_0x4b80('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4b80('0x3')](0x0);var events={'afterCreate':_0x4b80('0x4'),'afterUpdate':_0x4b80('0x5'),'afterDestroy':'remove'};function emitEvent(_0x546505){return function(_0x40e6aa,_0x5844e9,_0x41acbc){_0x40e6aa[_0x4b80('0x6')]({'attributes':['id'],'raw':!![]})[_0x4b80('0x7')](function(_0x1206ae){_0x40e6aa[_0x4b80('0x8')]('Users',_0x1206ae[_0x4b80('0x9')](function(_0x3b3155){return{'id':_0x3b3155['id']};}));return FaxMessage[_0x4b80('0xa')]({'where':{'FaxInteractionId':_0x40e6aa['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xb5980d){_0x40e6aa['setDataValue'](_0x4b80('0xb'),_0xb5980d['length']);FaxInteractionEvents[_0x4b80('0xc')](_0x546505+':'+_0x40e6aa['id'],_0x40e6aa);FaxInteractionEvents[_0x4b80('0xc')](_0x546505,_0x40e6aa);_0x41acbc(null);})[_0x4b80('0xd')](_0x41acbc(null));};}for(var e in events){if(events[_0x4b80('0xe')](e)){var event=events[e];FaxInteraction[_0x4b80('0xf')](e,emitEvent(event));}}module[_0x4b80('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x2f39=['exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','then','setDataValue','findAll','unreadMessages','length','emit','catch','hook'];(function(_0x531722,_0x161aa9){var _0x3f1769=function(_0x44e0d8){while(--_0x44e0d8){_0x531722['push'](_0x531722['shift']());}};_0x3f1769(++_0x161aa9);}(_0x2f39,0x1b1));var _0x92f3=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x2f39[_0xef4cf0];return _0x497ad2;};'use strict';var EventEmitter=require(_0x92f3('0x0'));var FaxInteraction=require(_0x92f3('0x1'))['db'][_0x92f3('0x2')];var FaxMessage=require(_0x92f3('0x1'))['db'][_0x92f3('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x92f3('0x4'),'afterUpdate':_0x92f3('0x5'),'afterDestroy':_0x92f3('0x6')};function emitEvent(_0x44155a){return function(_0x1315cc,_0x541cdb,_0x2307b0){_0x1315cc['getUsers']({'attributes':['id'],'raw':!![]})[_0x92f3('0x7')](function(_0x4b5ff5){_0x1315cc[_0x92f3('0x8')]('Users',_0x4b5ff5['map'](function(_0x128a6b){return{'id':_0x128a6b['id']};}));return FaxMessage[_0x92f3('0x9')]({'where':{'FaxInteractionId':_0x1315cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x92f3('0x7')](function(_0x230f36){_0x1315cc[_0x92f3('0x8')](_0x92f3('0xa'),_0x230f36[_0x92f3('0xb')]);FaxInteractionEvents[_0x92f3('0xc')](_0x44155a+':'+_0x1315cc['id'],_0x1315cc);FaxInteractionEvents[_0x92f3('0xc')](_0x44155a,_0x1315cc);_0x2307b0(null);})[_0x92f3('0xd')](_0x2307b0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x92f3('0xe')](e,emitEvent(event));}}module[_0x92f3('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index f1208d2..98c5a03 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 _0x22b9=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0x22b9,0x8c));var _0x922b=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x22b9[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x922b('0x0'));var util=require(_0x922b('0x1'));var logger=require(_0x922b('0x2'))(_0x922b('0x3'));var moment=require(_0x922b('0x4'));var BPromise=require(_0x922b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x922b('0x6'));var config=require('../../config/environment');var attributes=require(_0x922b('0x7'));module[_0x922b('0x8')]=function(_0xf709c0,_0x1f9593){return _0xf709c0['define'](_0x922b('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x472490,_0x4d5dd2,_0x1277a4){if(_0x472490[_0x922b('0xa')](_0x922b('0xb'))){_0x472490[_0x922b('0xc')]=moment()[_0x922b('0xd')](_0x922b('0xe'));}_0x1277a4(null,_0x472490);}}});}; \ No newline at end of file +var _0x0cb9=['fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','rimraf','./faxInteraction.attributes','exports','define'];(function(_0x30b2c6,_0x1eafe8){var _0x42052d=function(_0xfeb539){while(--_0xfeb539){_0x30b2c6['push'](_0x30b2c6['shift']());}};_0x42052d(++_0x1eafe8);}(_0x0cb9,0xc8));var _0x90cb=function(_0xa8c911,_0x135b6d){_0xa8c911=_0xa8c911-0x0;var _0x81b46d=_0x0cb9[_0xa8c911];return _0x81b46d;};'use strict';var _=require('lodash');var util=require(_0x90cb('0x0'));var logger=require('../../config/logger')(_0x90cb('0x1'));var moment=require(_0x90cb('0x2'));var BPromise=require(_0x90cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x90cb('0x4'));var config=require('../../config/environment');var attributes=require(_0x90cb('0x5'));module[_0x90cb('0x6')]=function(_0x30c91e,_0x4f83cd){return _0x30c91e[_0x90cb('0x7')]('FaxInteraction',attributes,{'tableName':_0x90cb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d26fc,_0x3573cf,_0x520917){if(_0x4d26fc['changed'](_0x90cb('0x9'))){_0x4d26fc[_0x90cb('0xa')]=moment()[_0x90cb('0xb')](_0x90cb('0xc'));}_0x520917(null,_0x4d26fc);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index efbedbe..3712f60 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 _0x8f9b=['omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','attributes','limit','AddTagsToFaxInteraction','find','where','addTags'];(function(_0x590455,_0x338a42){var _0x1b5a98=function(_0x29f08c){while(--_0x29f08c){_0x590455['push'](_0x590455['shift']());}};_0x1b5a98(++_0x338a42);}(_0x8f9b,0x1f2));var _0xb8f9=function(_0x9f8f89,_0x5c4f39){_0x9f8f89=_0x9f8f89-0x0;var _0xf5659=_0x8f9b[_0x9f8f89];return _0xf5659;};'use strict';var _=require(_0xb8f9('0x0'));var util=require(_0xb8f9('0x1'));var moment=require(_0xb8f9('0x2'));var BPromise=require(_0xb8f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8f9('0x4'));var db=require(_0xb8f9('0x5'))['db'];var utils=require(_0xb8f9('0x6'));var logger=require(_0xb8f9('0x7'))(_0xb8f9('0x8'));var config=require(_0xb8f9('0x9'));var jayson=require(_0xb8f9('0xa'));var client=jayson[_0xb8f9('0xb')][_0xb8f9('0xc')]({'port':0x232a});config[_0xb8f9('0xd')]=_[_0xb8f9('0xe')](config[_0xb8f9('0xd')],{'host':_0xb8f9('0xf'),'port':0x18eb});var socket=require(_0xb8f9('0x10'))(new Redis(config[_0xb8f9('0xd')]));require(_0xb8f9('0x11'))[_0xb8f9('0x12')](socket);function respondWithRpcPromise(_0x299589,_0x11b342,_0x39f3a7){return new BPromise(function(_0x1a3358,_0x181821){return client[_0xb8f9('0x13')](_0x299589,_0x39f3a7)[_0xb8f9('0x14')](function(_0xe2dd0f){logger[_0xb8f9('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x11b342,_0xb8f9('0x16'));logger[_0xb8f9('0x17')](_0xb8f9('0x18'),_0x11b342,'request\x20sent',JSON[_0xb8f9('0x19')](_0xe2dd0f));if(_0xe2dd0f[_0xb8f9('0x1a')]){if(_0xe2dd0f[_0xb8f9('0x1a')]['code']===0x1f4){logger['error'](_0xb8f9('0x1b'),_0x11b342,_0xe2dd0f[_0xb8f9('0x1a')][_0xb8f9('0x1c')]);return _0x181821(_0xe2dd0f['error'][_0xb8f9('0x1c')]);}logger[_0xb8f9('0x1a')](_0xb8f9('0x1b'),_0x11b342,_0xe2dd0f[_0xb8f9('0x1a')][_0xb8f9('0x1c')]);return _0x1a3358(_0xe2dd0f[_0xb8f9('0x1a')][_0xb8f9('0x1c')]);}else{logger['info'](_0xb8f9('0x1b'),_0x11b342,'request\x20sent');_0x1a3358(_0xe2dd0f['result'][_0xb8f9('0x1c')]);}})[_0xb8f9('0x1d')](function(_0x26d118){logger[_0xb8f9('0x1a')](_0xb8f9('0x1b'),_0x11b342,_0x26d118);_0x181821(_0x26d118);});});}exports[_0xb8f9('0x1e')]=function(_0x137a38){var _0x79194d=this;return new Promise(function(_0x44abcc,_0x35e038){return db[_0xb8f9('0x1f')][_0xb8f9('0x20')](_0x137a38[_0xb8f9('0x21')],{'raw':_0x137a38['options']?_0x137a38['options'][_0xb8f9('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137a38['options']?_0x137a38[_0xb8f9('0x23')]['where']||null:null,'attributes':_0x137a38[_0xb8f9('0x23')]?_0x137a38[_0xb8f9('0x23')][_0xb8f9('0x24')]||null:null,'limit':_0x137a38['options']?_0x137a38[_0xb8f9('0x23')][_0xb8f9('0x25')]||null:null})['then'](function(_0x16975a){logger[_0xb8f9('0x15')](_0xb8f9('0x1e'),_0x137a38);logger['debug'](_0xb8f9('0x1e'),_0x137a38,JSON['stringify'](_0x16975a));_0x44abcc(_0x16975a);})[_0xb8f9('0x1d')](function(_0x403fcf){logger[_0xb8f9('0x1a')](_0xb8f9('0x1e'),_0x403fcf[_0xb8f9('0x1c')],_0x137a38);_0x35e038(_0x79194d[_0xb8f9('0x1a')](0x1f4,_0x403fcf['message']));});});};exports[_0xb8f9('0x26')]=function(_0x2e359f){return new Promise(function(_0xb7e37f,_0x6644c7){return db['FaxInteraction'][_0xb8f9('0x27')]({'where':_0x2e359f[_0xb8f9('0x23')]?_0x2e359f[_0xb8f9('0x23')][_0xb8f9('0x28')]||null:null})[_0xb8f9('0x14')](function(_0x7a8763){if(_0x7a8763){return _0x7a8763[_0xb8f9('0x29')](_0x2e359f['body']['ids'],_[_0xb8f9('0x2a')](_0x2e359f[_0xb8f9('0x21')],['ids','id'])||{});}})[_0xb8f9('0x2b')](function(_0xb57348){logger[_0xb8f9('0x15')](_0xb8f9('0x2c'),_0x2e359f);logger[_0xb8f9('0x17')]('AddTags',_0x2e359f,JSON[_0xb8f9('0x19')](_0xb57348));_0xb7e37f(_0xb57348);})['catch'](function(_0x154e8a){logger[_0xb8f9('0x1a')](_0xb8f9('0x2c'),_0x154e8a[_0xb8f9('0x1c')],_0x2e359f);_0x6644c7(_this['error'](0x1f4,_0x154e8a['message']));});});}; \ No newline at end of file +var _0x2652=['localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxInteraction','body','options','raw','where','attributes','limit','catch','FaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x553089,_0x25ba70){var _0x5de1f4=function(_0x4d4155){while(--_0x4d4155){_0x553089['push'](_0x553089['shift']());}};_0x5de1f4(++_0x25ba70);}(_0x2652,0x9c));var _0x2265=function(_0x111f63,_0x137b87){_0x111f63=_0x111f63-0x0;var _0x232f58=_0x2652[_0x111f63];return _0x232f58;};'use strict';var _=require(_0x2265('0x0'));var util=require(_0x2265('0x1'));var moment=require('moment');var BPromise=require(_0x2265('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2265('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2265('0x4'));var logger=require(_0x2265('0x5'))(_0x2265('0x6'));var config=require(_0x2265('0x7'));var jayson=require(_0x2265('0x8'));var client=jayson[_0x2265('0x9')]['http']({'port':0x232a});config[_0x2265('0xa')]=_[_0x2265('0xb')](config['redis'],{'host':_0x2265('0xc'),'port':0x18eb});var socket=require(_0x2265('0xd'))(new Redis(config[_0x2265('0xa')]));require(_0x2265('0xe'))[_0x2265('0xf')](socket);function respondWithRpcPromise(_0x3c08f0,_0x9b8be,_0x2e8e51){return new BPromise(function(_0x4b5b39,_0x1ec69c){return client['request'](_0x3c08f0,_0x2e8e51)[_0x2265('0x10')](function(_0x256afa){logger[_0x2265('0x11')](_0x2265('0x12'),_0x9b8be,_0x2265('0x13'));logger[_0x2265('0x14')](_0x2265('0x15'),_0x9b8be,'request\x20sent',JSON[_0x2265('0x16')](_0x256afa));if(_0x256afa[_0x2265('0x17')]){if(_0x256afa[_0x2265('0x17')][_0x2265('0x18')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x9b8be,_0x256afa[_0x2265('0x17')][_0x2265('0x19')]);return _0x1ec69c(_0x256afa[_0x2265('0x17')][_0x2265('0x19')]);}logger[_0x2265('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x9b8be,_0x256afa[_0x2265('0x17')]['message']);return _0x4b5b39(_0x256afa[_0x2265('0x17')][_0x2265('0x19')]);}else{logger[_0x2265('0x11')](_0x2265('0x12'),_0x9b8be,_0x2265('0x13'));_0x4b5b39(_0x256afa[_0x2265('0x1a')][_0x2265('0x19')]);}})['catch'](function(_0x12eba6){logger[_0x2265('0x17')](_0x2265('0x12'),_0x9b8be,_0x12eba6);_0x1ec69c(_0x12eba6);});});}exports[_0x2265('0x1b')]=function(_0xc525ff){var _0x4e339d=this;return new Promise(function(_0x2aec04,_0x23eafc){return db['FaxInteraction']['update'](_0xc525ff[_0x2265('0x1c')],{'raw':_0xc525ff['options']?_0xc525ff[_0x2265('0x1d')][_0x2265('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc525ff[_0x2265('0x1d')]?_0xc525ff[_0x2265('0x1d')][_0x2265('0x1f')]||null:null,'attributes':_0xc525ff[_0x2265('0x1d')]?_0xc525ff[_0x2265('0x1d')][_0x2265('0x20')]||null:null,'limit':_0xc525ff[_0x2265('0x1d')]?_0xc525ff[_0x2265('0x1d')][_0x2265('0x21')]||null:null})[_0x2265('0x10')](function(_0xcda72e){logger[_0x2265('0x11')]('UpdateFaxInteraction',_0xc525ff);logger['debug'](_0x2265('0x1b'),_0xc525ff,JSON[_0x2265('0x16')](_0xcda72e));_0x2aec04(_0xcda72e);})[_0x2265('0x22')](function(_0x17af5f){logger['error']('UpdateFaxInteraction',_0x17af5f[_0x2265('0x19')],_0xc525ff);_0x23eafc(_0x4e339d['error'](0x1f4,_0x17af5f[_0x2265('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x59bbc4){return new Promise(function(_0xd76556,_0x1e0d9b){return db[_0x2265('0x23')][_0x2265('0x24')]({'where':_0x59bbc4['options']?_0x59bbc4[_0x2265('0x1d')][_0x2265('0x1f')]||null:null})[_0x2265('0x10')](function(_0x14e971){if(_0x14e971){return _0x14e971[_0x2265('0x25')](_0x59bbc4[_0x2265('0x1c')]['ids'],_[_0x2265('0x26')](_0x59bbc4[_0x2265('0x1c')],[_0x2265('0x27'),'id'])||{});}})[_0x2265('0x28')](function(_0x49f8a5){logger[_0x2265('0x11')](_0x2265('0x29'),_0x59bbc4);logger[_0x2265('0x14')](_0x2265('0x29'),_0x59bbc4,JSON[_0x2265('0x16')](_0x49f8a5));_0xd76556(_0x49f8a5);})[_0x2265('0x22')](function(_0x1f7fa6){logger[_0x2265('0x17')]('AddTags',_0x1f7fa6[_0x2265('0x19')],_0x59bbc4);_0x1e0d9b(_this['error'](0x1f4,_0x1f7fa6[_0x2265('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 09a8e77..6a6a2eb 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 _0xe960=['remove','update','emit','removeListener','register','faxInteraction:'];(function(_0x3ff57d,_0x210af9){var _0x1c7298=function(_0x2cb852){while(--_0x2cb852){_0x3ff57d['push'](_0x3ff57d['shift']());}};_0x1c7298(++_0x210af9);}(_0xe960,0x6c));var _0x0e96=function(_0x98fdcb,_0x5bbe88){_0x98fdcb=_0x98fdcb-0x0;var _0x5764c3=_0xe960[_0x98fdcb];return _0x5764c3;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x0e96('0x0'),_0x0e96('0x1')];function createListener(_0xcd01d8,_0x35c5de){return function(_0x3f9abb){_0x35c5de[_0x0e96('0x2')](_0xcd01d8,_0x3f9abb);};}function removeListener(_0x5ef087,_0x22ac00){return function(){FaxInteractionEvents[_0x0e96('0x3')](_0x5ef087,_0x22ac00);};}exports[_0x0e96('0x4')]=function(_0x4886fe){for(var _0xb149b0=0x0,_0xa7222e=events['length'];_0xb149b0<_0xa7222e;_0xb149b0++){var _0x5a77ed=events[_0xb149b0];var _0x4cedce=createListener(_0x0e96('0x5')+_0x5a77ed,_0x4886fe);FaxInteractionEvents['on'](_0x5a77ed,_0x4cedce);}}; \ No newline at end of file +var _0x04f6=['remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x219857,_0x2fc818){var _0x13976a=function(_0x169753){while(--_0x169753){_0x219857['push'](_0x219857['shift']());}};_0x13976a(++_0x2fc818);}(_0x04f6,0x1e4));var _0x604f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x04f6[_0xa464c9];return _0x3d73c4;};'use strict';var FaxInteractionEvents=require(_0x604f('0x0'));var events=[_0x604f('0x1'),_0x604f('0x2'),_0x604f('0x3')];function createListener(_0x2db526,_0x55e7e4){return function(_0x376826){_0x55e7e4[_0x604f('0x4')](_0x2db526,_0x376826);};}function removeListener(_0x1e3336,_0x279636){return function(){FaxInteractionEvents[_0x604f('0x5')](_0x1e3336,_0x279636);};}exports[_0x604f('0x6')]=function(_0x179949){for(var _0x2e5560=0x0,_0x5134cb=events[_0x604f('0x7')];_0x2e5560<_0x5134cb;_0x2e5560++){var _0x5451e7=events[_0x2e5560];var _0x169cb1=createListener(_0x604f('0x8')+_0x5451e7,_0x179949);FaxInteractionEvents['on'](_0x5451e7,_0x169cb1);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1d689e9..4d40f1a 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 _0xb9a7=['/:id/tags','tracked','fax','put','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb9a7,0x66));var _0x7b9a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb9a7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7b9a('0x0'));var util=require(_0x7b9a('0x1'));var path=require(_0x7b9a('0x2'));var timeout=require(_0x7b9a('0x3'));var express=require(_0x7b9a('0x4'));var router=express[_0x7b9a('0x5')]();var fs_extra=require(_0x7b9a('0x6'));var auth=require(_0x7b9a('0x7'));var interaction=require(_0x7b9a('0x8'));var config=require(_0x7b9a('0x9'));var controller=require(_0x7b9a('0xa'));router[_0x7b9a('0xb')]('/',auth[_0x7b9a('0xc')](),controller['index']);router[_0x7b9a('0xb')]('/describe',auth[_0x7b9a('0xc')](),controller[_0x7b9a('0xd')]);router['get'](_0x7b9a('0xe'),auth[_0x7b9a('0xc')](),controller[_0x7b9a('0xf')]);router[_0x7b9a('0xb')](_0x7b9a('0x10'),auth[_0x7b9a('0xc')](),controller[_0x7b9a('0x11')]);router[_0x7b9a('0xb')](_0x7b9a('0x12'),auth[_0x7b9a('0xc')](),controller['download']);router[_0x7b9a('0x13')]('/',auth[_0x7b9a('0xc')](),controller[_0x7b9a('0x14')]);router[_0x7b9a('0x13')]('/:id/messages',auth[_0x7b9a('0xc')](),controller[_0x7b9a('0x15')]);router[_0x7b9a('0x13')](_0x7b9a('0x16'),auth['isAuthenticated'](),interaction[_0x7b9a('0x17')](_0x7b9a('0x18'),'faxinteraction:addtags'),controller['addTags']);router[_0x7b9a('0x19')](_0x7b9a('0xe'),auth[_0x7b9a('0xc')](),interaction['tracked'](_0x7b9a('0x18'),_0x7b9a('0x1a')),controller[_0x7b9a('0x1b')]);router['delete'](_0x7b9a('0xe'),auth[_0x7b9a('0xc')](),interaction[_0x7b9a('0x17')](_0x7b9a('0x18'),_0x7b9a('0x1c')),controller[_0x7b9a('0x1d')]);router[_0x7b9a('0x1e')]('/:id/tags',auth[_0x7b9a('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xcebf=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','addTags','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports'];(function(_0x8d8207,_0x977b82){var _0x301bf0=function(_0x9c29c1){while(--_0x9c29c1){_0x8d8207['push'](_0x8d8207['shift']());}};_0x301bf0(++_0x977b82);}(_0xcebf,0x1a0));var _0xfceb=function(_0x163e5b,_0x1725e8){_0x163e5b=_0x163e5b-0x0;var _0x3c420b=_0xcebf[_0x163e5b];return _0x3c420b;};'use strict';var multer=require('multer');var util=require(_0xfceb('0x0'));var path=require(_0xfceb('0x1'));var timeout=require(_0xfceb('0x2'));var express=require(_0xfceb('0x3'));var router=express[_0xfceb('0x4')]();var fs_extra=require(_0xfceb('0x5'));var auth=require(_0xfceb('0x6'));var interaction=require(_0xfceb('0x7'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0xfceb('0x8')]('/',auth[_0xfceb('0x9')](),controller['index']);router[_0xfceb('0x8')](_0xfceb('0xa'),auth[_0xfceb('0x9')](),controller[_0xfceb('0xb')]);router[_0xfceb('0x8')](_0xfceb('0xc'),auth['isAuthenticated'](),controller[_0xfceb('0xd')]);router[_0xfceb('0x8')](_0xfceb('0xe'),auth[_0xfceb('0x9')](),controller[_0xfceb('0xf')]);router[_0xfceb('0x8')](_0xfceb('0x10'),auth[_0xfceb('0x9')](),controller[_0xfceb('0x11')]);router['post']('/',auth[_0xfceb('0x9')](),controller[_0xfceb('0x12')]);router['post'](_0xfceb('0xe'),auth[_0xfceb('0x9')](),controller[_0xfceb('0x13')]);router[_0xfceb('0x14')](_0xfceb('0x15'),auth['isAuthenticated'](),interaction[_0xfceb('0x16')]('fax','faxinteraction:addtags'),controller[_0xfceb('0x17')]);router[_0xfceb('0x18')](_0xfceb('0xc'),auth[_0xfceb('0x9')](),interaction[_0xfceb('0x16')](_0xfceb('0x19'),_0xfceb('0x1a')),controller[_0xfceb('0x1b')]);router[_0xfceb('0x1c')]('/:id',auth[_0xfceb('0x9')](),interaction[_0xfceb('0x16')](_0xfceb('0x19'),_0xfceb('0x1d')),controller['destroy']);router['delete'](_0xfceb('0x15'),auth[_0xfceb('0x9')](),controller[_0xfceb('0x1e')]);module[_0xfceb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c282333..369c7b6 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 _0xe198=['ENUM','out','TEXT','sequelize','exports','BOOLEAN'];(function(_0x1b5a40,_0x40651e){var _0x2e220a=function(_0x509006){while(--_0x509006){_0x1b5a40['push'](_0x1b5a40['shift']());}};_0x2e220a(++_0x40651e);}(_0xe198,0x6f));var _0x8e19=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xe198[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x8e19('0x0'));module[_0x8e19('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8e19('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8e19('0x3')]('in',_0x8e19('0x4')),'defaultValue':_0x8e19('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8e19('0x5')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb38e=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x2d7af5,_0x5365ff){var _0x50239d=function(_0x1b0f03){while(--_0x1b0f03){_0x2d7af5['push'](_0x2d7af5['shift']());}};_0x50239d(++_0x5365ff);}(_0xb38e,0xa7));var _0xeb38=function(_0x3f7840,_0x42e9f8){_0x3f7840=_0x3f7840-0x0;var _0x10b524=_0xb38e[_0x3f7840];return _0x10b524;};'use strict';var Sequelize=require(_0xeb38('0x0'));module[_0xeb38('0x1')]={'body':{'type':Sequelize[_0xeb38('0x2')](_0xeb38('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xeb38('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeb38('0x5')]('in',_0xeb38('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xeb38('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xeb38('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e9e13e1..7cf136c 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 _0x30bc=['sequelize','internal','interface','rejectmessage','create','Attachment','findOne','SendFax','FaxAccountId','basename','AttachmentId','download','join','root','server','attachments','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxMessage.socket','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','FaxMessage','findAll','rows','catch','params','fields','body','find','describe','fax-interactions','accept','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage'];(function(_0x11fa4b,_0x2e0ec1){var _0x122a99=function(_0x305e92){while(--_0x305e92){_0x11fa4b['push'](_0x11fa4b['shift']());}};_0x122a99(++_0x2e0ec1);}(_0x30bc,0x124));var _0xc30b=function(_0x1aa277,_0x1edd4f){_0x1aa277=_0x1aa277-0x0;var _0x2f21e5=_0x30bc[_0x1aa277];return _0x2f21e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc30b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc30b('0x1'));var moment=require(_0xc30b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc30b('0x3'));var util=require('util');var path=require(_0xc30b('0x4'));var sox=require(_0xc30b('0x5'));var csv=require('to-csv');var ejs=require(_0xc30b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc30b('0x7'));var squel=require(_0xc30b('0x8'));var crypto=require('crypto');var jsforce=require(_0xc30b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xc30b('0xa'));var querystring=require(_0xc30b('0xb'));var Papa=require(_0xc30b('0xc'));var Redis=require(_0xc30b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc30b('0xe'));var as=require(_0xc30b('0xf'));var hardwareService=require(_0xc30b('0x10'));var logger=require(_0xc30b('0x11'))(_0xc30b('0x12'));var utils=require(_0xc30b('0x13'));var config=require(_0xc30b('0x14'));var licenseUtil=require(_0xc30b('0x15'));var db=require('../../mysqldb')['db'];config[_0xc30b('0x16')]=_['defaults'](config[_0xc30b('0x16')],{'host':_0xc30b('0x17'),'port':0x18eb});var socket=require(_0xc30b('0x18'))(new Redis(config['redis']));require(_0xc30b('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc30b('0x1a')][_0xc30b('0x1b')]({'port':0x232c});var client9002=jayson[_0xc30b('0x1a')][_0xc30b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3a8b5d,_0x5745ff,_0x5239b6,_0x2b2254){return new BPromise(function(_0x4c7fd0,_0x4e9c1a){var _0x12c9b3=_0x2b2254||client;return _0x12c9b3[_0xc30b('0x1c')](_0x3a8b5d,_0x5239b6)[_0xc30b('0x1d')](function(_0x4bb60c){logger[_0xc30b('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x5745ff,_0xc30b('0x1f'));logger[_0xc30b('0x20')](_0xc30b('0x21'),_0x5745ff,'request\x20sent',JSON[_0xc30b('0x22')](_0x4bb60c));if(_0x4bb60c[_0xc30b('0x23')]){if(_0x4bb60c['error'][_0xc30b('0x24')]===0x1f4){logger[_0xc30b('0x23')](_0xc30b('0x25'),_0x5745ff,_0x4bb60c[_0xc30b('0x23')][_0xc30b('0x26')]);return _0x4e9c1a(_0x4bb60c[_0xc30b('0x23')][_0xc30b('0x26')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x5745ff,_0x4bb60c[_0xc30b('0x23')][_0xc30b('0x26')]);return _0x4c7fd0(_0x4bb60c['error']['message']);}else{logger[_0xc30b('0x1e')](_0xc30b('0x25'),_0x5745ff,_0xc30b('0x1f'));_0x4c7fd0(_0x4bb60c[_0xc30b('0x27')][_0xc30b('0x26')]);}})['catch'](function(_0x36c687){logger[_0xc30b('0x23')](_0xc30b('0x25'),_0x5745ff,_0x36c687);_0x4e9c1a(_0x36c687);});});}function respondWithStatusCode(_0x404d20,_0xa60467){_0xa60467=_0xa60467||0xcc;return function(_0x5c2a87){if(_0x5c2a87){return _0x404d20['sendStatus'](_0xa60467);}return _0x404d20[_0xc30b('0x28')](_0xa60467)[_0xc30b('0x29')]();};}function respondWithResult(_0x502db9,_0xff94e9){_0xff94e9=_0xff94e9||0xc8;return function(_0x2802f7){if(_0x2802f7){return _0x502db9['status'](_0xff94e9)[_0xc30b('0x2a')](_0x2802f7);}};}function respondWithFilteredResult(_0x12f895,_0x1f90a7){return function(_0xc19916){if(_0xc19916){var _0x220d99=typeof _0x1f90a7[_0xc30b('0x2b')]===_0xc30b('0x2c')&&typeof _0x1f90a7[_0xc30b('0x2d')]==='undefined';var _0x104359=_0xc19916[_0xc30b('0x2e')];var _0x4d9c15=_0x220d99?0x0:_0x1f90a7[_0xc30b('0x2b')];var _0x40a27a=_0x220d99?_0xc19916[_0xc30b('0x2e')]:_0x1f90a7[_0xc30b('0x2b')]+_0x1f90a7[_0xc30b('0x2d')];var _0x1a0f45;if(_0x40a27a>=_0x104359){_0x40a27a=_0x104359;_0x1a0f45=0xc8;}else{_0x1a0f45=0xce;}_0x12f895[_0xc30b('0x28')](_0x1a0f45);return _0x12f895[_0xc30b('0x2f')]('Content-Range',_0x4d9c15+'-'+_0x40a27a+'/'+_0x104359)[_0xc30b('0x2a')](_0xc19916);}return null;};}function patchUpdates(_0x49f608){return function(_0x5c6b17){try{jsonpatch['apply'](_0x5c6b17,_0x49f608,!![]);}catch(_0x16cbdc){return BPromise[_0xc30b('0x30')](_0x16cbdc);}return _0x5c6b17[_0xc30b('0x31')]();};}function saveUpdates(_0x35694a,_0xa3c31){return function(_0xc416f2){if(_0xc416f2){return _0xc416f2[_0xc30b('0x32')](_0x35694a)[_0xc30b('0x1d')](function(_0x3707f2){return _0x3707f2;});}return null;};}function removeEntity(_0x271f29,_0x4553fe){return function(_0x1a6b72){if(_0x1a6b72){return _0x1a6b72[_0xc30b('0x33')]()[_0xc30b('0x1d')](function(){_0x271f29[_0xc30b('0x28')](0xcc)[_0xc30b('0x29')]();});}};}function handleEntityNotFound(_0x191c29,_0x5b8ffc){return function(_0x432a0d){if(!_0x432a0d){_0x191c29['sendStatus'](0x194);}return _0x432a0d;};}function handleError(_0x5a8d92,_0x408775){_0x408775=_0x408775||0x1f4;return function(_0x46cd27){logger[_0xc30b('0x23')](_0x46cd27[_0xc30b('0x34')]);if(_0x46cd27[_0xc30b('0x35')]){delete _0x46cd27[_0xc30b('0x35')];}_0x5a8d92['status'](_0x408775)['send'](_0x46cd27);};}exports[_0xc30b('0x36')]=function(_0x1742b2,_0x33e0dc){var _0x47f1f8={},_0x2c6135={},_0x271978={'count':0x0,'rows':[]};var _0xfa1c9d=_[_0xc30b('0x37')](db['FaxMessage']['rawAttributes'],function(_0x125e55){return{'name':_0x125e55[_0xc30b('0x38')],'type':_0x125e55[_0xc30b('0x39')][_0xc30b('0x3a')]};});_0x2c6135[_0xc30b('0x3b')]=_['map'](_0xfa1c9d,_0xc30b('0x35'));_0x2c6135[_0xc30b('0x3c')]=_[_0xc30b('0x3d')](_0x1742b2[_0xc30b('0x3c')]);_0x2c6135['filters']=_[_0xc30b('0x3e')](_0x2c6135['model'],_0x2c6135[_0xc30b('0x3c')]);_0x47f1f8[_0xc30b('0x3f')]=_[_0xc30b('0x3e')](_0x2c6135[_0xc30b('0x3b')],qs['fields'](_0x1742b2[_0xc30b('0x3c')]['fields']));_0x47f1f8[_0xc30b('0x3f')]=_0x47f1f8[_0xc30b('0x3f')][_0xc30b('0x40')]?_0x47f1f8[_0xc30b('0x3f')]:_0x2c6135[_0xc30b('0x3b')];if(!_0x1742b2[_0xc30b('0x3c')][_0xc30b('0x41')](_0xc30b('0x42'))){_0x47f1f8['limit']=qs[_0xc30b('0x2d')](_0x1742b2[_0xc30b('0x3c')][_0xc30b('0x2d')]);_0x47f1f8[_0xc30b('0x2b')]=qs['offset'](_0x1742b2['query'][_0xc30b('0x2b')]);}_0x47f1f8[_0xc30b('0x43')]=qs[_0xc30b('0x44')](_0x1742b2['query'][_0xc30b('0x44')]);_0x47f1f8[_0xc30b('0x45')]=qs['filters'](_[_0xc30b('0x46')](_0x1742b2['query'],_0x2c6135[_0xc30b('0x47')]),_0xfa1c9d);if(_0x1742b2[_0xc30b('0x3c')]['filter']){_0x47f1f8[_0xc30b('0x45')]=_[_0xc30b('0x48')](_0x47f1f8[_0xc30b('0x45')],{'$or':_[_0xc30b('0x37')](_0xfa1c9d,function(_0xa7699d){if(_0xa7699d[_0xc30b('0x39')]!==_0xc30b('0x49')){var _0x3a2e88={};_0x3a2e88[_0xa7699d[_0xc30b('0x35')]]={'$like':'%'+_0x1742b2['query'][_0xc30b('0x4a')]+'%'};return _0x3a2e88;}})});}_0x47f1f8=_['merge']({},_0x47f1f8,_0x1742b2['options']);var _0x60f27f={'where':_0x47f1f8[_0xc30b('0x45')]};return db['FaxMessage'][_0xc30b('0x2e')](_0x60f27f)[_0xc30b('0x1d')](function(_0x2126ee){_0x271978[_0xc30b('0x2e')]=_0x2126ee;if(_0x1742b2['query'][_0xc30b('0x4b')]){_0x47f1f8[_0xc30b('0x4c')]=[{'all':!![]}];}return db[_0xc30b('0x4d')][_0xc30b('0x4e')](_0x47f1f8);})[_0xc30b('0x1d')](function(_0x53405f){_0x271978[_0xc30b('0x4f')]=_0x53405f;return _0x271978;})['then'](respondWithFilteredResult(_0x33e0dc,_0x47f1f8))[_0xc30b('0x50')](handleError(_0x33e0dc,null));};exports['show']=function(_0x2b8c62,_0x42f290){var _0x36ea8a={'raw':!![],'where':{'id':_0x2b8c62[_0xc30b('0x51')]['id']}},_0x420062={};_0x420062[_0xc30b('0x3b')]=_[_0xc30b('0x3d')](db[_0xc30b('0x4d')]['rawAttributes']);_0x420062[_0xc30b('0x3c')]=_['keys'](_0x2b8c62['query']);_0x420062[_0xc30b('0x47')]=_[_0xc30b('0x3e')](_0x420062[_0xc30b('0x3b')],_0x420062[_0xc30b('0x3c')]);_0x36ea8a[_0xc30b('0x3f')]=_[_0xc30b('0x3e')](_0x420062[_0xc30b('0x3b')],qs[_0xc30b('0x52')](_0x2b8c62[_0xc30b('0x3c')][_0xc30b('0x52')]));_0x36ea8a['attributes']=_0x36ea8a[_0xc30b('0x3f')][_0xc30b('0x40')]?_0x36ea8a[_0xc30b('0x3f')]:_0x420062[_0xc30b('0x3b')];if(_0x2b8c62[_0xc30b('0x3c')][_0xc30b('0x4b')]){_0x36ea8a[_0xc30b('0x4c')]=[{'all':!![]}];}_0x36ea8a=_[_0xc30b('0x48')]({},_0x36ea8a,_0x2b8c62['options']);return db[_0xc30b('0x4d')]['find'](_0x36ea8a)['then'](handleEntityNotFound(_0x42f290,null))[_0xc30b('0x1d')](respondWithResult(_0x42f290,null))[_0xc30b('0x50')](handleError(_0x42f290,null));};exports['update']=function(_0x244aae,_0x173656){if(_0x244aae[_0xc30b('0x53')]['id']){delete _0x244aae['body']['id'];}return db['FaxMessage'][_0xc30b('0x54')]({'where':{'id':_0x244aae[_0xc30b('0x51')]['id']}})['then'](handleEntityNotFound(_0x173656,null))[_0xc30b('0x1d')](saveUpdates(_0x244aae[_0xc30b('0x53')],null))[_0xc30b('0x1d')](respondWithResult(_0x173656,null))[_0xc30b('0x50')](handleError(_0x173656,null));};exports['destroy']=function(_0x4b0c93,_0x32efc7){return db[_0xc30b('0x4d')]['find']({'where':{'id':_0x4b0c93['params']['id']}})['then'](handleEntityNotFound(_0x32efc7,null))[_0xc30b('0x1d')](removeEntity(_0x32efc7,null))['catch'](handleError(_0x32efc7,null));};exports[_0xc30b('0x55')]=function(_0x2b5ca5,_0x52109e){return db[_0xc30b('0x4d')][_0xc30b('0x55')]()[_0xc30b('0x1d')](respondWithResult(_0x52109e,null))[_0xc30b('0x50')](handleError(_0x52109e,null));};var interaction_log=require(_0xc30b('0x11'))(_0xc30b('0x56'));exports[_0xc30b('0x57')]=function(_0x40965f,_0x2973cd,_0x1a884f){var _0x6bb657={'agent':{},'channel':_0xc30b('0x58')};if(_0x40965f['body']['id']){delete _0x40965f[_0xc30b('0x53')]['id'];}_0x40965f[_0xc30b('0x53')][_0xc30b('0x59')]=!![];_0x40965f[_0xc30b('0x53')]['readAt']=moment()['format'](_0xc30b('0x5a'));_0x40965f[_0xc30b('0x53')][_0xc30b('0x5b')]=_0x40965f['body']['UserId']||_0x40965f[_0xc30b('0x5c')]['id'];_0x6bb657[_0xc30b('0x5d')]['id']=_0x40965f['body'][_0xc30b('0x5b')];return db['FaxMessage']['find']({'where':{'id':_0x40965f[_0xc30b('0x51')]['id'],'UserId':null}})[_0xc30b('0x1d')](handleEntityNotFound(_0x2973cd,null))[_0xc30b('0x1d')](saveUpdates(_0x40965f[_0xc30b('0x53')],null))[_0xc30b('0x1d')](function(_0x534a5b){if(_0x534a5b){_0x6bb657['message']=_0x534a5b['get']({'plain':!![]});return db[_0xc30b('0x5e')][_0xc30b('0x54')]({'where':{'id':_0x534a5b['FaxInteractionId']}});}return null;})[_0xc30b('0x1d')](handleEntityNotFound(_0x2973cd,null))[_0xc30b('0x1d')](function(_0x5b5d23){if(_0x5b5d23){return _0x5b5d23[_0xc30b('0x32')]({'UserId':_0x40965f[_0xc30b('0x53')][_0xc30b('0x5b')],'read1stAt':_[_0xc30b('0x5f')](_0x5b5d23[_0xc30b('0x60')])?moment()[_0xc30b('0x61')](_0xc30b('0x5a')):undefined});}return null;})[_0xc30b('0x1d')](function(_0x10b178){if(_0x10b178){_0x6bb657[_0xc30b('0x62')]=_0x10b178['get']({'plain':!![]});interaction_log[_0xc30b('0x1e')](_0xc30b('0x63'),_0x40965f['user']['id'],_0x40965f[_0xc30b('0x5c')]['name'],_0x40965f[_0xc30b('0x5c')][_0xc30b('0x64')],_0x6bb657['interaction']['id'],_0x40965f[_0xc30b('0x53')]?JSON[_0xc30b('0x22')](_0x40965f['body']):'null');return respondWithRpcPromise(_0xc30b('0x65'),'acceptMessage',_0x6bb657);}return null;})[_0xc30b('0x1d')](function(_0x1a17e9){var _0x45ae1c=_0xc30b('0x66')+_0x1a17e9[_0xc30b('0x26')][_0xc30b('0x67')];return db['sequelize'][_0xc30b('0x3c')](_0x45ae1c,{'type':db[_0xc30b('0x68')][_0xc30b('0x69')][_0xc30b('0x6a')],'raw':!![]})[_0xc30b('0x1d')](function(_0xcefb67){return _0xcefb67;});})[_0xc30b('0x1d')](function(_0x32b5ad){if(_0x32b5ad){_0x6bb657[_0xc30b('0x26')][_0xc30b('0x6b')]=_0x32b5ad[0x0];if(!_0x40965f[_0xc30b('0x53')][_0xc30b('0x5b')])return;return db[_0xc30b('0x6c')]['find']({'where':{'id':_0x40965f[_0xc30b('0x53')][_0xc30b('0x5b')],'role':_0xc30b('0x5d')},'attributes':['id',_0xc30b('0x35'),_0xc30b('0x6d'),_0xc30b('0x6e'),'internal'],'raw':!![]});}return null;})[_0xc30b('0x1d')](function(_0x2172bc){if(!_0x2172bc)return null;_0x6bb657[_0xc30b('0x26')][_0xc30b('0x5d')]=_0x2172bc;return _0x6bb657;})[_0xc30b('0x1d')](function(_0x45ae60){if(_0x45ae60){if(_0x40965f[_0xc30b('0x53')][_0xc30b('0x6f')]){_0x6bb657[_0xc30b('0x26')]['interface']=util['format'](_0xc30b('0x70'),_0x40965f[_0xc30b('0x5c')][_0xc30b('0x35')]);_0x6bb657[_0xc30b('0x26')][_0xc30b('0x71')]=_0x6bb657[_0xc30b('0x71')];_0x6bb657[_0xc30b('0x26')][_0xc30b('0x72')]=_0x6bb657[_0xc30b('0x71')];_0x6bb657['message']['event']=_0xc30b('0x57');return respondWithRpcPromise(_0xc30b('0x73'),_0xc30b('0x73'),{'event':_0xc30b('0x74'),'message':_0x6bb657[_0xc30b('0x26')]},client9002)[_0xc30b('0x1d')](function(){return _0x6bb657;});}return _0x6bb657;}return null;})[_0xc30b('0x1d')](respondWithResult(_0x2973cd,null))['catch'](handleError(_0x2973cd,null));};var interaction_log=require(_0xc30b('0x11'))(_0xc30b('0x56'));exports[_0xc30b('0x30')]=function(_0x143252,_0xab87ae,_0x33c791){var _0x5577c5={'agent':{},'channel':_0xc30b('0x58')};if(_0x143252[_0xc30b('0x53')]['id']){delete _0x143252[_0xc30b('0x53')]['id'];}_0x143252['body'][_0xc30b('0x5b')]=_0x143252[_0xc30b('0x53')]['UserId']||_0x143252[_0xc30b('0x5c')]['id'];_0x5577c5[_0xc30b('0x5d')]['id']=_0x143252[_0xc30b('0x53')][_0xc30b('0x5b')];return db[_0xc30b('0x4d')]['find']({'where':{'id':_0x143252[_0xc30b('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xab87ae,null))[_0xc30b('0x1d')](function(_0x5e6792){if(_0x5e6792){_0x5577c5[_0xc30b('0x26')]=_0x5e6792['get']({'plain':!![]});return db[_0xc30b('0x5e')]['find']({'where':{'id':_0x5e6792[_0xc30b('0x75')]}});}return null;})[_0xc30b('0x1d')](handleEntityNotFound(_0xab87ae,null))[_0xc30b('0x1d')](function(_0x2f496c){if(_0x2f496c){_0x5577c5[_0xc30b('0x62')]=_0x2f496c['get']({'plain':!![]});interaction_log[_0xc30b('0x1e')](_0xc30b('0x76'),_0x143252[_0xc30b('0x5c')]['id'],_0x143252[_0xc30b('0x5c')][_0xc30b('0x35')],_0x143252[_0xc30b('0x5c')][_0xc30b('0x64')],_0x5577c5[_0xc30b('0x62')]['id'],_0x143252[_0xc30b('0x53')]?JSON[_0xc30b('0x22')](_0x143252['body']):_0xc30b('0x77'));return respondWithRpcPromise(_0xc30b('0x78'),_0xc30b('0x79'),_0x5577c5);}return null;})['then'](function(_0x143ba9){var _0x536a92=_0xc30b('0x66')+_0x143ba9[_0xc30b('0x26')][_0xc30b('0x67')];return db[_0xc30b('0x7a')][_0xc30b('0x3c')](_0x536a92,{'type':db[_0xc30b('0x68')]['QueryTypes'][_0xc30b('0x6a')],'raw':!![]})[_0xc30b('0x1d')](function(_0x83454b){return _0x83454b;});})[_0xc30b('0x1d')](function(_0x5d0d45){if(_0x5d0d45){_0x5577c5['message']['contact']=_0x5d0d45[0x0];if(!_0x143252[_0xc30b('0x53')][_0xc30b('0x5b')])return;return db[_0xc30b('0x6c')][_0xc30b('0x54')]({'where':{'id':_0x143252[_0xc30b('0x53')][_0xc30b('0x5b')],'role':_0xc30b('0x5d')},'attributes':['id',_0xc30b('0x35'),_0xc30b('0x6d'),_0xc30b('0x6e'),_0xc30b('0x7b')],'raw':!![]});}return null;})[_0xc30b('0x1d')](function(_0x57cc32){if(!_0x57cc32)return null;_0x5577c5['message'][_0xc30b('0x5d')]=_0x57cc32;return _0x5577c5;})[_0xc30b('0x1d')](function(_0xc8b08b){if(_0xc8b08b){_0xc8b08b[_0xc30b('0x26')][_0xc30b('0x7c')]=util[_0xc30b('0x61')](_0xc30b('0x70'),_0x143252[_0xc30b('0x5c')][_0xc30b('0x35')]);_0xc8b08b[_0xc30b('0x26')][_0xc30b('0x71')]=_0x5577c5['channel'];_0xc8b08b['message']['motionChannel']=_0x5577c5[_0xc30b('0x71')];_0xc8b08b[_0xc30b('0x26')]['event']=_0xc30b('0x30');respondWithRpcPromise(_0xc30b('0x73'),'EventManager',{'event':_0xc30b('0x7d'),'message':_0xc8b08b[_0xc30b('0x26')]},client9002);return _0x5577c5;}return null;})[_0xc30b('0x1d')](respondWithResult(_0xab87ae,null))[_0xc30b('0x50')](handleError(_0xab87ae,null));};exports[_0xc30b('0x7e')]=function(_0x565ddd,_0x5d2c41){var _0x5f0197;return db[_0xc30b('0x4d')][_0xc30b('0x7e')](_0x565ddd[_0xc30b('0x53')],{})[_0xc30b('0x1d')](function(_0x4e87ae){_0x5f0197=_0x4e87ae;return db['CmContact']['findOne']({'where':{'id':_0x5f0197[_0xc30b('0x67')]}});})[_0xc30b('0x1d')](function(_0x38255d){if(_[_0xc30b('0x5f')](_0x38255d)){return;}else{_0x5f0197['fax']=_0x38255d['fax'];return db[_0xc30b('0x7f')][_0xc30b('0x80')]({'where':{'id':_0x5f0197['AttachmentId']}});}})[_0xc30b('0x1d')](function(_0xbaf1b1){return respondWithRpcPromise(_0xc30b('0x81'),_0xc30b('0x81'),{'FaxAccountId':_[_0xc30b('0x5f')](_0x565ddd[_0xc30b('0x53')])?undefined:_0x565ddd['body'][_0xc30b('0x82')],'path':_[_0xc30b('0x5f')](_0xbaf1b1)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0xbaf1b1[_0xc30b('0x83')]),'fax':_['isNil'](_0x5f0197[_0xc30b('0x58')])?undefined:_0x5f0197[_0xc30b('0x58')],'AttachmentId':_0x5f0197[_0xc30b('0x84')]},client9002);})[_0xc30b('0x1d')](respondWithResult(_0x5d2c41,0xc9))[_0xc30b('0x50')](handleError(_0x5d2c41,null));};exports[_0xc30b('0x85')]=function(_0x4a85cb,_0x1da150){var _0x2dbc10=path[_0xc30b('0x86')](config[_0xc30b('0x87')],_0xc30b('0x88'),'files',_0xc30b('0x89'));return db['FaxMessage'][_0xc30b('0x54')]({'where':{'id':_0x4a85cb[_0xc30b('0x51')]['id']},'include':[{'model':db[_0xc30b('0x7f')],'as':_0xc30b('0x7f')}]})[_0xc30b('0x1d')](handleEntityNotFound(_0x1da150,null))['then'](function(_0xcc9dca){if(_0xcc9dca){return _0x1da150[_0xc30b('0x85')](path[_0xc30b('0x86')](_0x2dbc10,_0xcc9dca[_0xc30b('0x7f')][_0xc30b('0x83')]));}})['catch'](handleError(_0x1da150,null));}; \ No newline at end of file +var _0x4d29=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','index','map','FaxMessage','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','find','body','describe','fax-interactions','accept','fax','read','readAt','format','agent','UserId','get','FaxInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2ea578,_0xdcd0b9){var _0x442b5e=function(_0x3b2564){while(--_0x3b2564){_0x2ea578['push'](_0x2ea578['shift']());}};_0x442b5e(++_0xdcd0b9);}(_0x4d29,0x19f));var _0x94d2=function(_0x598969,_0x3de2df){_0x598969=_0x598969-0x0;var _0x499da5=_0x4d29[_0x598969];return _0x499da5;};'use strict';var emlformat=require(_0x94d2('0x0'));var rimraf=require(_0x94d2('0x1'));var zipdir=require(_0x94d2('0x2'));var jsonpatch=require(_0x94d2('0x3'));var rp=require(_0x94d2('0x4'));var moment=require('moment');var BPromise=require(_0x94d2('0x5'));var Mustache=require(_0x94d2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x94d2('0x7'));var csv=require(_0x94d2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94d2('0x9'));var squel=require(_0x94d2('0xa'));var crypto=require(_0x94d2('0xb'));var jsforce=require(_0x94d2('0xc'));var deskjs=require(_0x94d2('0xd'));var toCsv=require(_0x94d2('0x8'));var querystring=require(_0x94d2('0xe'));var Papa=require('papaparse');var Redis=require(_0x94d2('0xf'));var authService=require(_0x94d2('0x10'));var qs=require(_0x94d2('0x11'));var as=require(_0x94d2('0x12'));var hardwareService=require(_0x94d2('0x13'));var logger=require(_0x94d2('0x14'))(_0x94d2('0x15'));var utils=require(_0x94d2('0x16'));var config=require(_0x94d2('0x17'));var licenseUtil=require(_0x94d2('0x18'));var db=require('../../mysqldb')['db'];config[_0x94d2('0x19')]=_[_0x94d2('0x1a')](config[_0x94d2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x94d2('0x1b'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x94d2('0x1c')](socket);var jayson=require(_0x94d2('0x1d'));var client=jayson['client'][_0x94d2('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x94d2('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x17231b,_0xb82e57,_0x4d41f0,_0xfc2722){return new BPromise(function(_0x4b406c,_0x438f59){var _0x59b80f=_0xfc2722||client;return _0x59b80f[_0x94d2('0x1f')](_0x17231b,_0x4d41f0)[_0x94d2('0x20')](function(_0x3a2c43){logger['info'](_0x94d2('0x21'),_0xb82e57,_0x94d2('0x22'));logger['debug'](_0x94d2('0x23'),_0xb82e57,'request\x20sent',JSON[_0x94d2('0x24')](_0x3a2c43));if(_0x3a2c43[_0x94d2('0x25')]){if(_0x3a2c43[_0x94d2('0x25')][_0x94d2('0x26')]===0x1f4){logger[_0x94d2('0x25')](_0x94d2('0x21'),_0xb82e57,_0x3a2c43['error']['message']);return _0x438f59(_0x3a2c43['error'][_0x94d2('0x27')]);}logger[_0x94d2('0x25')]('FaxMessage,\x20%s,\x20%s',_0xb82e57,_0x3a2c43['error'][_0x94d2('0x27')]);return _0x4b406c(_0x3a2c43[_0x94d2('0x25')][_0x94d2('0x27')]);}else{logger[_0x94d2('0x28')](_0x94d2('0x21'),_0xb82e57,'request\x20sent');_0x4b406c(_0x3a2c43[_0x94d2('0x29')]['message']);}})[_0x94d2('0x2a')](function(_0x2e84c3){logger[_0x94d2('0x25')]('FaxMessage,\x20%s,\x20%s',_0xb82e57,_0x2e84c3);_0x438f59(_0x2e84c3);});});}function respondWithStatusCode(_0x9cb622,_0x134be5){_0x134be5=_0x134be5||0xcc;return function(_0x51670c){if(_0x51670c){return _0x9cb622[_0x94d2('0x2b')](_0x134be5);}return _0x9cb622[_0x94d2('0x2c')](_0x134be5)[_0x94d2('0x2d')]();};}function respondWithResult(_0xa2eafb,_0x3d174b){_0x3d174b=_0x3d174b||0xc8;return function(_0x160264){if(_0x160264){return _0xa2eafb['status'](_0x3d174b)[_0x94d2('0x2e')](_0x160264);}};}function respondWithFilteredResult(_0x50eef8,_0xb4b830){return function(_0x1b370a){if(_0x1b370a){var _0x56fe65=typeof _0xb4b830[_0x94d2('0x2f')]===_0x94d2('0x30')&&typeof _0xb4b830['limit']===_0x94d2('0x30');var _0x316cf6=_0x1b370a[_0x94d2('0x31')];var _0x37e0af=_0x56fe65?0x0:_0xb4b830['offset'];var _0x411896=_0x56fe65?_0x1b370a[_0x94d2('0x31')]:_0xb4b830['offset']+_0xb4b830[_0x94d2('0x32')];var _0x540544;if(_0x411896>=_0x316cf6){_0x411896=_0x316cf6;_0x540544=0xc8;}else{_0x540544=0xce;}_0x50eef8[_0x94d2('0x2c')](_0x540544);return _0x50eef8[_0x94d2('0x33')](_0x94d2('0x34'),_0x37e0af+'-'+_0x411896+'/'+_0x316cf6)[_0x94d2('0x2e')](_0x1b370a);}return null;};}function patchUpdates(_0x3b0d00){return function(_0x521b2b){try{jsonpatch['apply'](_0x521b2b,_0x3b0d00,!![]);}catch(_0x592076){return BPromise[_0x94d2('0x35')](_0x592076);}return _0x521b2b[_0x94d2('0x36')]();};}function saveUpdates(_0x4efeba,_0x351886){return function(_0x63a795){if(_0x63a795){return _0x63a795[_0x94d2('0x37')](_0x4efeba)[_0x94d2('0x20')](function(_0x415ae7){return _0x415ae7;});}return null;};}function removeEntity(_0x535c6c,_0x4c7049){return function(_0x32cc97){if(_0x32cc97){return _0x32cc97[_0x94d2('0x38')]()[_0x94d2('0x20')](function(){_0x535c6c[_0x94d2('0x2c')](0xcc)[_0x94d2('0x2d')]();});}};}function handleEntityNotFound(_0x3b4181,_0x22092d){return function(_0x511d84){if(!_0x511d84){_0x3b4181[_0x94d2('0x2b')](0x194);}return _0x511d84;};}function handleError(_0x2de163,_0x4be78f){_0x4be78f=_0x4be78f||0x1f4;return function(_0x199ba5){logger[_0x94d2('0x25')](_0x199ba5[_0x94d2('0x39')]);if(_0x199ba5[_0x94d2('0x3a')]){delete _0x199ba5[_0x94d2('0x3a')];}_0x2de163[_0x94d2('0x2c')](_0x4be78f)['send'](_0x199ba5);};}exports[_0x94d2('0x3b')]=function(_0x4cbbfb,_0x24320d){var _0xc9accc={},_0x1fa01a={},_0x30a7c1={'count':0x0,'rows':[]};var _0x529da2=_[_0x94d2('0x3c')](db[_0x94d2('0x3d')]['rawAttributes'],function(_0x531386){return{'name':_0x531386['fieldName'],'type':_0x531386['type'][_0x94d2('0x3e')]};});_0x1fa01a[_0x94d2('0x3f')]=_[_0x94d2('0x3c')](_0x529da2,'name');_0x1fa01a[_0x94d2('0x40')]=_[_0x94d2('0x41')](_0x4cbbfb[_0x94d2('0x40')]);_0x1fa01a[_0x94d2('0x42')]=_[_0x94d2('0x43')](_0x1fa01a[_0x94d2('0x3f')],_0x1fa01a[_0x94d2('0x40')]);_0xc9accc[_0x94d2('0x44')]=_[_0x94d2('0x43')](_0x1fa01a[_0x94d2('0x3f')],qs['fields'](_0x4cbbfb[_0x94d2('0x40')][_0x94d2('0x45')]));_0xc9accc['attributes']=_0xc9accc[_0x94d2('0x44')][_0x94d2('0x46')]?_0xc9accc[_0x94d2('0x44')]:_0x1fa01a[_0x94d2('0x3f')];if(!_0x4cbbfb['query'][_0x94d2('0x47')](_0x94d2('0x48'))){_0xc9accc[_0x94d2('0x32')]=qs[_0x94d2('0x32')](_0x4cbbfb[_0x94d2('0x40')][_0x94d2('0x32')]);_0xc9accc[_0x94d2('0x2f')]=qs[_0x94d2('0x2f')](_0x4cbbfb['query'][_0x94d2('0x2f')]);}_0xc9accc[_0x94d2('0x49')]=qs[_0x94d2('0x4a')](_0x4cbbfb[_0x94d2('0x40')][_0x94d2('0x4a')]);_0xc9accc['where']=qs[_0x94d2('0x42')](_[_0x94d2('0x4b')](_0x4cbbfb[_0x94d2('0x40')],_0x1fa01a[_0x94d2('0x42')]),_0x529da2);if(_0x4cbbfb[_0x94d2('0x40')][_0x94d2('0x4c')]){_0xc9accc['where']=_['merge'](_0xc9accc[_0x94d2('0x4d')],{'$or':_[_0x94d2('0x3c')](_0x529da2,function(_0x2959ee){if(_0x2959ee[_0x94d2('0x4e')]!==_0x94d2('0x4f')){var _0x470ae5={};_0x470ae5[_0x2959ee[_0x94d2('0x3a')]]={'$like':'%'+_0x4cbbfb[_0x94d2('0x40')][_0x94d2('0x4c')]+'%'};return _0x470ae5;}})});}_0xc9accc=_[_0x94d2('0x50')]({},_0xc9accc,_0x4cbbfb[_0x94d2('0x51')]);var _0x3cd780={'where':_0xc9accc['where']};return db['FaxMessage']['count'](_0x3cd780)[_0x94d2('0x20')](function(_0x5c6be8){_0x30a7c1[_0x94d2('0x31')]=_0x5c6be8;if(_0x4cbbfb[_0x94d2('0x40')][_0x94d2('0x52')]){_0xc9accc[_0x94d2('0x53')]=[{'all':!![]}];}return db[_0x94d2('0x3d')]['findAll'](_0xc9accc);})[_0x94d2('0x20')](function(_0x439e00){_0x30a7c1[_0x94d2('0x54')]=_0x439e00;return _0x30a7c1;})[_0x94d2('0x20')](respondWithFilteredResult(_0x24320d,_0xc9accc))[_0x94d2('0x2a')](handleError(_0x24320d,null));};exports[_0x94d2('0x55')]=function(_0x22dcf2,_0x21179a){var _0xde7f1b={'raw':!![],'where':{'id':_0x22dcf2[_0x94d2('0x56')]['id']}},_0x1666c3={};_0x1666c3['model']=_['keys'](db[_0x94d2('0x3d')][_0x94d2('0x57')]);_0x1666c3['query']=_['keys'](_0x22dcf2[_0x94d2('0x40')]);_0x1666c3[_0x94d2('0x42')]=_[_0x94d2('0x43')](_0x1666c3[_0x94d2('0x3f')],_0x1666c3[_0x94d2('0x40')]);_0xde7f1b[_0x94d2('0x44')]=_[_0x94d2('0x43')](_0x1666c3[_0x94d2('0x3f')],qs[_0x94d2('0x45')](_0x22dcf2[_0x94d2('0x40')][_0x94d2('0x45')]));_0xde7f1b[_0x94d2('0x44')]=_0xde7f1b[_0x94d2('0x44')][_0x94d2('0x46')]?_0xde7f1b[_0x94d2('0x44')]:_0x1666c3[_0x94d2('0x3f')];if(_0x22dcf2[_0x94d2('0x40')][_0x94d2('0x52')]){_0xde7f1b['include']=[{'all':!![]}];}_0xde7f1b=_[_0x94d2('0x50')]({},_0xde7f1b,_0x22dcf2[_0x94d2('0x51')]);return db['FaxMessage'][_0x94d2('0x58')](_0xde7f1b)['then'](handleEntityNotFound(_0x21179a,null))[_0x94d2('0x20')](respondWithResult(_0x21179a,null))['catch'](handleError(_0x21179a,null));};exports[_0x94d2('0x37')]=function(_0x2b3f1a,_0x570c45){if(_0x2b3f1a['body']['id']){delete _0x2b3f1a[_0x94d2('0x59')]['id'];}return db[_0x94d2('0x3d')][_0x94d2('0x58')]({'where':{'id':_0x2b3f1a[_0x94d2('0x56')]['id']}})[_0x94d2('0x20')](handleEntityNotFound(_0x570c45,null))[_0x94d2('0x20')](saveUpdates(_0x2b3f1a[_0x94d2('0x59')],null))[_0x94d2('0x20')](respondWithResult(_0x570c45,null))['catch'](handleError(_0x570c45,null));};exports[_0x94d2('0x38')]=function(_0x5736d8,_0x4caad9){return db['FaxMessage']['find']({'where':{'id':_0x5736d8[_0x94d2('0x56')]['id']}})[_0x94d2('0x20')](handleEntityNotFound(_0x4caad9,null))[_0x94d2('0x20')](removeEntity(_0x4caad9,null))[_0x94d2('0x2a')](handleError(_0x4caad9,null));};exports[_0x94d2('0x5a')]=function(_0x337280,_0x5c0293){return db[_0x94d2('0x3d')][_0x94d2('0x5a')]()[_0x94d2('0x20')](respondWithResult(_0x5c0293,null))['catch'](handleError(_0x5c0293,null));};var interaction_log=require(_0x94d2('0x14'))(_0x94d2('0x5b'));exports[_0x94d2('0x5c')]=function(_0xf8fdd1,_0x175e48,_0x3f8895){var _0xdc107b={'agent':{},'channel':_0x94d2('0x5d')};if(_0xf8fdd1[_0x94d2('0x59')]['id']){delete _0xf8fdd1[_0x94d2('0x59')]['id'];}_0xf8fdd1['body'][_0x94d2('0x5e')]=!![];_0xf8fdd1[_0x94d2('0x59')][_0x94d2('0x5f')]=moment()[_0x94d2('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0xf8fdd1[_0x94d2('0x59')]['UserId']=_0xf8fdd1[_0x94d2('0x59')]['UserId']||_0xf8fdd1['user']['id'];_0xdc107b[_0x94d2('0x61')]['id']=_0xf8fdd1[_0x94d2('0x59')][_0x94d2('0x62')];return db[_0x94d2('0x3d')][_0x94d2('0x58')]({'where':{'id':_0xf8fdd1[_0x94d2('0x56')]['id'],'UserId':null}})[_0x94d2('0x20')](handleEntityNotFound(_0x175e48,null))[_0x94d2('0x20')](saveUpdates(_0xf8fdd1[_0x94d2('0x59')],null))[_0x94d2('0x20')](function(_0x42f982){if(_0x42f982){_0xdc107b[_0x94d2('0x27')]=_0x42f982[_0x94d2('0x63')]({'plain':!![]});return db[_0x94d2('0x64')][_0x94d2('0x58')]({'where':{'id':_0x42f982['FaxInteractionId']}});}return null;})[_0x94d2('0x20')](handleEntityNotFound(_0x175e48,null))[_0x94d2('0x20')](function(_0x57eb59){if(_0x57eb59){return _0x57eb59[_0x94d2('0x37')]({'UserId':_0xf8fdd1['body'][_0x94d2('0x62')],'read1stAt':_[_0x94d2('0x65')](_0x57eb59[_0x94d2('0x66')])?moment()['format'](_0x94d2('0x67')):undefined});}return null;})[_0x94d2('0x20')](function(_0x11251b){if(_0x11251b){_0xdc107b[_0x94d2('0x68')]=_0x11251b[_0x94d2('0x63')]({'plain':!![]});interaction_log['info'](_0x94d2('0x69'),_0xf8fdd1[_0x94d2('0x6a')]['id'],_0xf8fdd1[_0x94d2('0x6a')][_0x94d2('0x3a')],_0xf8fdd1[_0x94d2('0x6a')][_0x94d2('0x6b')],_0xdc107b['interaction']['id'],_0xf8fdd1['body']?JSON[_0x94d2('0x24')](_0xf8fdd1[_0x94d2('0x59')]):_0x94d2('0x6c'));return respondWithRpcPromise(_0x94d2('0x6d'),'acceptMessage',_0xdc107b);}return null;})[_0x94d2('0x20')](function(_0x57170f){var _0x513f7d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x57170f[_0x94d2('0x27')][_0x94d2('0x6e')];return db[_0x94d2('0x6f')][_0x94d2('0x40')](_0x513f7d,{'type':db['Sequelize'][_0x94d2('0x70')][_0x94d2('0x71')],'raw':!![]})[_0x94d2('0x20')](function(_0x178d59){return _0x178d59;});})['then'](function(_0x197bbf){if(_0x197bbf){_0xdc107b[_0x94d2('0x27')][_0x94d2('0x72')]=_0x197bbf[0x0];if(!_0xf8fdd1['body'][_0x94d2('0x62')])return;return db[_0x94d2('0x73')][_0x94d2('0x58')]({'where':{'id':_0xf8fdd1[_0x94d2('0x59')][_0x94d2('0x62')],'role':_0x94d2('0x61')},'attributes':['id',_0x94d2('0x3a'),_0x94d2('0x74'),_0x94d2('0x75'),_0x94d2('0x76')],'raw':!![]});}return null;})[_0x94d2('0x20')](function(_0x4adc28){if(!_0x4adc28)return null;_0xdc107b[_0x94d2('0x27')]['agent']=_0x4adc28;return _0xdc107b;})['then'](function(_0x4fb0e9){if(_0x4fb0e9){if(_0xf8fdd1[_0x94d2('0x59')]['manual']){_0xdc107b['message']['interface']=util[_0x94d2('0x60')](_0x94d2('0x77'),_0xf8fdd1[_0x94d2('0x6a')]['name']);_0xdc107b[_0x94d2('0x27')][_0x94d2('0x78')]=_0xdc107b[_0x94d2('0x78')];_0xdc107b[_0x94d2('0x27')][_0x94d2('0x79')]=_0xdc107b[_0x94d2('0x78')];_0xdc107b[_0x94d2('0x27')][_0x94d2('0x7a')]='accept';return respondWithRpcPromise(_0x94d2('0x7b'),_0x94d2('0x7b'),{'event':_0x94d2('0x7c'),'message':_0xdc107b[_0x94d2('0x27')]},client9002)[_0x94d2('0x20')](function(){return _0xdc107b;});}return _0xdc107b;}return null;})[_0x94d2('0x20')](respondWithResult(_0x175e48,null))[_0x94d2('0x2a')](handleError(_0x175e48,null));};var interaction_log=require(_0x94d2('0x14'))('fax-interactions');exports[_0x94d2('0x35')]=function(_0x42b58b,_0x6356d2,_0x42b212){var _0x2ec7f6={'agent':{},'channel':'fax'};if(_0x42b58b['body']['id']){delete _0x42b58b[_0x94d2('0x59')]['id'];}_0x42b58b['body'][_0x94d2('0x62')]=_0x42b58b[_0x94d2('0x59')][_0x94d2('0x62')]||_0x42b58b[_0x94d2('0x6a')]['id'];_0x2ec7f6[_0x94d2('0x61')]['id']=_0x42b58b['body']['UserId'];return db[_0x94d2('0x3d')][_0x94d2('0x58')]({'where':{'id':_0x42b58b[_0x94d2('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x6356d2,null))[_0x94d2('0x20')](function(_0x565506){if(_0x565506){_0x2ec7f6[_0x94d2('0x27')]=_0x565506[_0x94d2('0x63')]({'plain':!![]});return db[_0x94d2('0x64')]['find']({'where':{'id':_0x565506[_0x94d2('0x7d')]}});}return null;})[_0x94d2('0x20')](handleEntityNotFound(_0x6356d2,null))[_0x94d2('0x20')](function(_0x574bad){if(_0x574bad){_0x2ec7f6[_0x94d2('0x68')]=_0x574bad[_0x94d2('0x63')]({'plain':!![]});interaction_log[_0x94d2('0x28')](_0x94d2('0x7e'),_0x42b58b[_0x94d2('0x6a')]['id'],_0x42b58b[_0x94d2('0x6a')][_0x94d2('0x3a')],_0x42b58b[_0x94d2('0x6a')]['role'],_0x2ec7f6[_0x94d2('0x68')]['id'],_0x42b58b[_0x94d2('0x59')]?JSON[_0x94d2('0x24')](_0x42b58b[_0x94d2('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0x94d2('0x7f'),_0x2ec7f6);}return null;})['then'](function(_0x3ac47a){var _0x41cc75=_0x94d2('0x80')+_0x3ac47a[_0x94d2('0x27')]['ContactId'];return db[_0x94d2('0x6f')][_0x94d2('0x40')](_0x41cc75,{'type':db['Sequelize']['QueryTypes'][_0x94d2('0x71')],'raw':!![]})[_0x94d2('0x20')](function(_0x6f1ae5){return _0x6f1ae5;});})[_0x94d2('0x20')](function(_0x1c1249){if(_0x1c1249){_0x2ec7f6[_0x94d2('0x27')][_0x94d2('0x72')]=_0x1c1249[0x0];if(!_0x42b58b[_0x94d2('0x59')][_0x94d2('0x62')])return;return db['User'][_0x94d2('0x58')]({'where':{'id':_0x42b58b[_0x94d2('0x59')][_0x94d2('0x62')],'role':'agent'},'attributes':['id','name',_0x94d2('0x74'),_0x94d2('0x75'),_0x94d2('0x76')],'raw':!![]});}return null;})[_0x94d2('0x20')](function(_0x1274ad){if(!_0x1274ad)return null;_0x2ec7f6[_0x94d2('0x27')]['agent']=_0x1274ad;return _0x2ec7f6;})[_0x94d2('0x20')](function(_0x2f9be5){if(_0x2f9be5){_0x2f9be5[_0x94d2('0x27')]['interface']=util['format'](_0x94d2('0x77'),_0x42b58b[_0x94d2('0x6a')]['name']);_0x2f9be5[_0x94d2('0x27')]['channel']=_0x2ec7f6['channel'];_0x2f9be5[_0x94d2('0x27')][_0x94d2('0x79')]=_0x2ec7f6['channel'];_0x2f9be5[_0x94d2('0x27')][_0x94d2('0x7a')]=_0x94d2('0x35');respondWithRpcPromise(_0x94d2('0x7b'),_0x94d2('0x7b'),{'event':_0x94d2('0x81'),'message':_0x2f9be5['message']},client9002);return _0x2ec7f6;}return null;})[_0x94d2('0x20')](respondWithResult(_0x6356d2,null))['catch'](handleError(_0x6356d2,null));};exports[_0x94d2('0x82')]=function(_0x517aa2,_0x1fee4a){var _0x1ecfe6;return db[_0x94d2('0x3d')][_0x94d2('0x82')](_0x517aa2['body'],{})[_0x94d2('0x20')](function(_0x5bcae3){_0x1ecfe6=_0x5bcae3;return db[_0x94d2('0x83')]['findOne']({'where':{'id':_0x1ecfe6[_0x94d2('0x6e')]}});})['then'](function(_0x4bb66c){if(_[_0x94d2('0x65')](_0x4bb66c)){return;}else{_0x1ecfe6['fax']=_0x4bb66c[_0x94d2('0x5d')];return db[_0x94d2('0x84')][_0x94d2('0x85')]({'where':{'id':_0x1ecfe6[_0x94d2('0x86')]}});}})['then'](function(_0x269f4e){return respondWithRpcPromise(_0x94d2('0x87'),_0x94d2('0x87'),{'FaxAccountId':_['isNil'](_0x517aa2[_0x94d2('0x59')])?undefined:_0x517aa2[_0x94d2('0x59')][_0x94d2('0x88')],'path':_['isNil'](_0x269f4e)?undefined:util[_0x94d2('0x60')](_0x94d2('0x89'),_0x269f4e[_0x94d2('0x8a')]),'fax':_[_0x94d2('0x65')](_0x1ecfe6['fax'])?undefined:_0x1ecfe6[_0x94d2('0x5d')],'AttachmentId':_0x1ecfe6[_0x94d2('0x86')]},client9002);})['then'](respondWithResult(_0x1fee4a,0xc9))[_0x94d2('0x2a')](handleError(_0x1fee4a,null));};exports['download']=function(_0x31403d,_0x281084){var _0x4ff213=path[_0x94d2('0x8b')](config[_0x94d2('0x8c')],_0x94d2('0x8d'),'files',_0x94d2('0x8e'));return db['FaxMessage'][_0x94d2('0x58')]({'where':{'id':_0x31403d[_0x94d2('0x56')]['id']},'include':[{'model':db[_0x94d2('0x84')],'as':_0x94d2('0x84')}]})[_0x94d2('0x20')](handleEntityNotFound(_0x281084,null))[_0x94d2('0x20')](function(_0x1674d8){if(_0x1674d8){return _0x281084['download'](path['join'](_0x4ff213,_0x1674d8[_0x94d2('0x84')][_0x94d2('0x8a')]));}})[_0x94d2('0x2a')](handleError(_0x281084,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 61a56fe..eff0dd6 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 _0x67d1=['remove','emit','hook','../../mysqldb','FaxMessage','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x67d1,0xf1));var _0x167d=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x67d1[_0x1589dd];return _0x1bddd1;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x167d('0x0'))['db'][_0x167d('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x167d('0x2'),'afterUpdate':_0x167d('0x3'),'afterDestroy':_0x167d('0x4')};function emitEvent(_0x140f63){return function(_0x4e6fba,_0x3ab690,_0x1d3b56){FaxMessageEvents[_0x167d('0x5')](_0x140f63+':'+_0x4e6fba['id'],_0x4e6fba);FaxMessageEvents[_0x167d('0x5')](_0x140f63,_0x4e6fba);_0x1d3b56(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x167d('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x6337=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','FaxMessage'];(function(_0x4fbd5c,_0x1274bd){var _0x408f8d=function(_0x3c1395){while(--_0x3c1395){_0x4fbd5c['push'](_0x4fbd5c['shift']());}};_0x408f8d(++_0x1274bd);}(_0x6337,0x18a));var _0x7633=function(_0x33351e,_0x4b5d71){_0x33351e=_0x33351e-0x0;var _0xb0dfa=_0x6337[_0x33351e];return _0xb0dfa;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x7633('0x0'))['db'][_0x7633('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7633('0x2')](0x0);var events={'afterCreate':_0x7633('0x3'),'afterUpdate':_0x7633('0x4'),'afterDestroy':_0x7633('0x5')};function emitEvent(_0xf5dc52){return function(_0x3f476d,_0x2ccc60,_0x56f3ba){FaxMessageEvents[_0x7633('0x6')](_0xf5dc52+':'+_0x3f476d['id'],_0x3f476d);FaxMessageEvents[_0x7633('0x6')](_0xf5dc52,_0x3f476d);_0x56f3ba(null);};}for(var e in events){if(events[_0x7633('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x7633('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 8617b92..b86f21b 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 _0x2f22=['UserId','FaxInteraction','findOne','createdAt','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','secret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f22,0x157));var _0x22f2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2f22[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x22f2('0x0'));var util=require(_0x22f2('0x1'));var logger=require(_0x22f2('0x2'))(_0x22f2('0x3'));var moment=require(_0x22f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x22f2('0x5'));var fs=require('fs');var path=require(_0x22f2('0x6'));var rimraf=require(_0x22f2('0x7'));var config=require(_0x22f2('0x8'));var attributes=require(_0x22f2('0x9'));module[_0x22f2('0xa')]=function(_0x814def,_0x5b13aa){return _0x814def[_0x22f2('0xb')](_0x22f2('0xc'),attributes,{'tableName':_0x22f2('0xd'),'paranoid':![],'indexes':[{'name':_0x22f2('0xe'),'fields':[_0x22f2('0xf')],'type':_0x22f2('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f775,_0x134eb0,_0x53d844){var _0x353278=_0x814def[_0x22f2('0x11')];var _0x483925=_0x53f775['get']({'plain':!![]});if(_0x483925[_0x22f2('0x12')][_0x22f2('0x13')]()==='in'||_0x483925['direction'][_0x22f2('0x13')]()==='out'&&!_0x483925[_0x22f2('0x14')]&&!_['isNil'](_0x483925[_0x22f2('0x15')])){_0x353278[_0x22f2('0x16')][_0x22f2('0x17')]({'where':{'id':_0x483925['FaxInteractionId']}})['then'](function(_0x1f2945){if(_0x1f2945){_0x1f2945['update']({'lastMsgAt':_0x483925[_0x22f2('0x18')],'lastMsgDirection':_0x483925[_0x22f2('0x12')][_0x22f2('0x13')]()});}})['catch'](function(_0x283d53){console['error'](_0x283d53);});}_0x53d844();}},'charset':'utf8mb4','collate':_0x22f2('0x19')});}; \ No newline at end of file +var _0xd906=['lodash','util','../../config/logger','rimraf','../../config/environment','exports','FaxMessage','fti_fax_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x23df80,_0x471558){var _0x1d767b=function(_0x5e83b5){while(--_0x5e83b5){_0x23df80['push'](_0x23df80['shift']());}};_0x1d767b(++_0x471558);}(_0xd906,0x1e0));var _0x6d90=function(_0x1605b7,_0x13302a){_0x1605b7=_0x1605b7-0x0;var _0x3c6527=_0xd906[_0x1605b7];return _0x3c6527;};'use strict';var _=require(_0x6d90('0x0'));var util=require(_0x6d90('0x1'));var logger=require(_0x6d90('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d90('0x3'));var config=require(_0x6d90('0x4'));var attributes=require('./faxMessage.attributes');module[_0x6d90('0x5')]=function(_0x42f8b8,_0x443ff3){return _0x42f8b8['define'](_0x6d90('0x6'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x6d90('0x7'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x205b4f,_0x791b67,_0x21baa3){var _0x182ceb=_0x42f8b8[_0x6d90('0x8')];var _0x3c70e0=_0x205b4f[_0x6d90('0x9')]({'plain':!![]});if(_0x3c70e0[_0x6d90('0xa')]['toLowerCase']()==='in'||_0x3c70e0[_0x6d90('0xa')][_0x6d90('0xb')]()===_0x6d90('0xc')&&!_0x3c70e0[_0x6d90('0xd')]&&!_[_0x6d90('0xe')](_0x3c70e0[_0x6d90('0xf')])){_0x182ceb['FaxInteraction'][_0x6d90('0x10')]({'where':{'id':_0x3c70e0[_0x6d90('0x11')]}})[_0x6d90('0x12')](function(_0x4cf545){if(_0x4cf545){_0x4cf545['update']({'lastMsgAt':_0x3c70e0[_0x6d90('0x13')],'lastMsgDirection':_0x3c70e0[_0x6d90('0xa')][_0x6d90('0xb')]()});}})[_0x6d90('0x14')](function(_0x3e3617){console[_0x6d90('0x15')](_0x3e3617);});}_0x21baa3();}},'charset':_0x6d90('0x16'),'collate':_0x6d90('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 95caecd..c3bd0a8 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 _0xd0bb=['CreateFaxMessage','FaxMessage','create','body','options','update','raw','where','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x7d2272,_0x41f365){var _0x5bc56e=function(_0x3974af){while(--_0x3974af){_0x7d2272['push'](_0x7d2272['shift']());}};_0x5bc56e(++_0x41f365);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x431807,_0x187385){_0x431807=_0x431807-0x0;var _0x51d062=_0xd0bb[_0x431807];return _0x51d062;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});config[_0xbd0b('0xa')]=_[_0xbd0b('0xb')](config['redis'],{'host':_0xbd0b('0xc'),'port':0x18eb});var socket=require(_0xbd0b('0xd'))(new Redis(config[_0xbd0b('0xa')]));require(_0xbd0b('0xe'))[_0xbd0b('0xf')](socket);function respondWithRpcPromise(_0x53d5e8,_0x51cf98,_0x14bc5b){return new BPromise(function(_0x110cf1,_0x4a69ff){return client[_0xbd0b('0x10')](_0x53d5e8,_0x14bc5b)[_0xbd0b('0x11')](function(_0x526258){logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));logger[_0xbd0b('0x15')](_0xbd0b('0x16'),_0x51cf98,_0xbd0b('0x14'),JSON[_0xbd0b('0x17')](_0x526258));if(_0x526258[_0xbd0b('0x18')]){if(_0x526258[_0xbd0b('0x18')][_0xbd0b('0x19')]===0x1f4){logger[_0xbd0b('0x18')]('FaxMessage,\x20%s,\x20%s',_0x51cf98,_0x526258[_0xbd0b('0x18')]['message']);return _0x4a69ff(_0x526258['error'][_0xbd0b('0x1a')]);}logger[_0xbd0b('0x18')](_0xbd0b('0x13'),_0x51cf98,_0x526258[_0xbd0b('0x18')][_0xbd0b('0x1a')]);return _0x110cf1(_0x526258['error']['message']);}else{logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));_0x110cf1(_0x526258[_0xbd0b('0x1b')][_0xbd0b('0x1a')]);}})[_0xbd0b('0x1c')](function(_0x5aeb79){logger[_0xbd0b('0x18')]('FaxMessage,\x20%s,\x20%s',_0x51cf98,_0x5aeb79);_0x4a69ff(_0x5aeb79);});});}exports[_0xbd0b('0x1d')]=function(_0x475801){var _0x2d02d0=this;return new Promise(function(_0x3053bb,_0x4b312d){return db[_0xbd0b('0x1e')][_0xbd0b('0x1f')](_0x475801[_0xbd0b('0x20')],{'raw':_0x475801['options']?_0x475801[_0xbd0b('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xbd0b('0x11')](function(_0x3c4938){logger[_0xbd0b('0x12')](_0xbd0b('0x1d'),_0x475801);logger[_0xbd0b('0x15')]('CreateFaxMessage',_0x475801,JSON[_0xbd0b('0x17')](_0x3c4938));_0x3053bb(_0x3c4938);})['catch'](function(_0x3e7e9c){logger[_0xbd0b('0x18')](_0xbd0b('0x1d'),_0x3e7e9c[_0xbd0b('0x1a')],_0x475801);_0x4b312d(_0x2d02d0[_0xbd0b('0x18')](0x1f4,_0x3e7e9c[_0xbd0b('0x1a')]));});});};exports['UpdateFaxMessage']=function(_0x382f76){var _0x1b46a3=this;return new Promise(function(_0x33b752,_0x1b5a00){return db[_0xbd0b('0x1e')][_0xbd0b('0x22')](_0x382f76['body'],{'raw':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x382f76['options']?_0x382f76['options'][_0xbd0b('0x24')]||null:null,'attributes':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x25')]||null:null,'limit':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x26')]||null:null})['then'](function(_0x45f7d6){logger[_0xbd0b('0x12')]('UpdateFaxMessage',_0x382f76);logger['debug'](_0xbd0b('0x27'),_0x382f76,JSON[_0xbd0b('0x17')](_0x45f7d6));_0x33b752(_0x45f7d6);})['catch'](function(_0x31bdd3){logger[_0xbd0b('0x18')](_0xbd0b('0x27'),_0x31bdd3[_0xbd0b('0x1a')],_0x382f76);_0x1b5a00(_0x1b46a3[_0xbd0b('0x18')](0x1f4,_0x31bdd3[_0xbd0b('0x1a')]));});});}; \ No newline at end of file +var _0x98a8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','attributes','limit','stringify','lodash','util','moment','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x98a8,0x12c));var _0x898a=function(_0x34d29e,_0x384eeb){_0x34d29e=_0x34d29e-0x0;var _0x1430c9=_0x98a8[_0x34d29e];return _0x1430c9;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});}exports[_0x898a('0x1b')]=function(_0x58c3ab){var _0x4d374b=this;return new Promise(function(_0x12bc0f,_0x26449a){return db[_0x898a('0x1c')][_0x898a('0x1d')](_0x58c3ab[_0x898a('0x1e')],{'raw':_0x58c3ab[_0x898a('0x1f')]?_0x58c3ab[_0x898a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x898a('0x10')](function(_0x50718e){logger[_0x898a('0x11')](_0x898a('0x1b'),_0x58c3ab);logger[_0x898a('0x13')](_0x898a('0x1b'),_0x58c3ab,JSON['stringify'](_0x50718e));_0x12bc0f(_0x50718e);})[_0x898a('0x1a')](function(_0x16c318){logger[_0x898a('0x15')](_0x898a('0x1b'),_0x16c318[_0x898a('0x18')],_0x58c3ab);_0x26449a(_0x4d374b[_0x898a('0x15')](0x1f4,_0x16c318['message']));});});};exports[_0x898a('0x20')]=function(_0x51d501){var _0x513c6b=this;return new Promise(function(_0x53ddb2,_0x3678be){return db[_0x898a('0x1c')][_0x898a('0x21')](_0x51d501[_0x898a('0x1e')],{'raw':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')]['where']||null:null,'attributes':_0x51d501['options']?_0x51d501['options'][_0x898a('0x23')]||null:null,'limit':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x24')]||null:null})[_0x898a('0x10')](function(_0x560000){logger[_0x898a('0x11')](_0x898a('0x20'),_0x51d501);logger[_0x898a('0x13')](_0x898a('0x20'),_0x51d501,JSON[_0x898a('0x25')](_0x560000));_0x53ddb2(_0x560000);})[_0x898a('0x1a')](function(_0x494127){logger[_0x898a('0x15')](_0x898a('0x20'),_0x494127[_0x898a('0x18')],_0x51d501);_0x3678be(_0x513c6b[_0x898a('0x15')](0x1f4,_0x494127[_0x898a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 23e4b52..5234bf6 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 _0x77b5=['emit','removeListener','register','faxMessage:','save','remove','update'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x77b5,0x107));var _0x577b=function(_0x3ddc81,_0x232ecf){_0x3ddc81=_0x3ddc81-0x0;var _0x2e15c2=_0x77b5[_0x3ddc81];return _0x2e15c2;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x577b('0x0'),_0x577b('0x1'),_0x577b('0x2')];function createListener(_0x343fe9,_0x1f04d4){return function(_0x241c73){_0x1f04d4[_0x577b('0x3')](_0x343fe9,_0x241c73);};}function removeListener(_0x47497d,_0x3afa7f){return function(){FaxMessageEvents[_0x577b('0x4')](_0x47497d,_0x3afa7f);};}exports[_0x577b('0x5')]=function(_0x462445){for(var _0x5abba9=0x0,_0x61917f=events['length'];_0x5abba9<_0x61917f;_0x5abba9++){var _0x32b301=events[_0x5abba9];var _0x1cee86=createListener(_0x577b('0x6')+_0x32b301,_0x462445);FaxMessageEvents['on'](_0x32b301,_0x1cee86);}}; \ No newline at end of file +var _0xf6a6=['length','faxMessage:','./faxMessage.events','emit','removeListener'];(function(_0x4f2626,_0x1078da){var _0xa80c7=function(_0x1737fa){while(--_0x1737fa){_0x4f2626['push'](_0x4f2626['shift']());}};_0xa80c7(++_0x1078da);}(_0xf6a6,0x106));var _0x6f6a=function(_0x58e965,_0x2bef5c){_0x58e965=_0x58e965-0x0;var _0x2662f6=_0xf6a6[_0x58e965];return _0x2662f6;};'use strict';var FaxMessageEvents=require(_0x6f6a('0x0'));var events=['save','remove','update'];function createListener(_0x45e05d,_0x19f136){return function(_0x4526d4){_0x19f136[_0x6f6a('0x1')](_0x45e05d,_0x4526d4);};}function removeListener(_0xc07c74,_0x3524df){return function(){FaxMessageEvents[_0x6f6a('0x2')](_0xc07c74,_0x3524df);};}exports['register']=function(_0x4f0e3d){for(var _0x17a681=0x0,_0x231be3=events[_0x6f6a('0x3')];_0x17a681<_0x231be3;_0x17a681++){var _0x439ba2=events[_0x17a681];var _0x5aecfd=createListener(_0x6f6a('0x4')+_0x439ba2,_0x4f0e3d);FaxMessageEvents['on'](_0x439ba2,_0x5aecfd);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 4d216fc..8ac5709 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 _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(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x0102,0x186));var _0x2010=function(_0x54a0d7,_0x24cbc7){_0x54a0d7=_0x54a0d7-0x0;var _0x249877=_0x0102[_0x54a0d7];return _0x249877;};'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 +var _0xda3f=['create','put','/:id/accept','/:id/reject','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create'];(function(_0x25f742,_0x10a7ea){var _0x2ade9d=function(_0x38c53c){while(--_0x38c53c){_0x25f742['push'](_0x25f742['shift']());}};_0x2ade9d(++_0x10a7ea);}(_0xda3f,0xec));var _0xfda3=function(_0x374abc,_0x199b9a){_0x374abc=_0x374abc-0x0;var _0xb3e55=_0xda3f[_0x374abc];return _0xb3e55;};'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('./faxMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')]('/',auth['isAuthenticated'](),interaction[_0xfda3('0xe')](_0xfda3('0xf'),_0xfda3('0x10')),controller[_0xfda3('0x11')]);router[_0xfda3('0x12')]('/:id',auth[_0xfda3('0x6')](),controller['update']);router[_0xfda3('0x12')](_0xfda3('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xfda3('0x14'),auth[_0xfda3('0x6')](),controller['reject']);router['delete']('/:id',auth[_0xfda3('0x6')](),controller[_0xfda3('0x15')]);module[_0xfda3('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 7654c62..f086ea1 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 _0x49b9=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x3e4002,_0x39d440){var _0x315278=function(_0x1e7aa2){while(--_0x1e7aa2){_0x3e4002['push'](_0x3e4002['shift']());}};_0x315278(++_0x39d440);}(_0x49b9,0x1da));var _0x949b=function(_0x11dfb6,_0x346a1d){_0x11dfb6=_0x11dfb6-0x0;var _0x52a4b8=_0x49b9[_0x11dfb6];return _0x52a4b8;};'use strict';var Sequelize=require(_0x949b('0x0'));module[_0x949b('0x1')]={'name':{'type':Sequelize[_0x949b('0x2')],'unique':_0x949b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x949b('0x2')]},'timeout':{'type':Sequelize[_0x949b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x949b('0x5')]('rrmemory',_0x949b('0x6'),_0x949b('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x949b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8f33=['ENUM','rrmemory','sequelize','exports','STRING','name','INTEGER'];(function(_0x24daf8,_0x6d4c10){var _0x183abf=function(_0xb1becb){while(--_0xb1becb){_0x24daf8['push'](_0x24daf8['shift']());}};_0x183abf(++_0x6d4c10);}(_0x8f33,0x10c));var _0x38f3=function(_0x12aabc,_0x1b2df3){_0x12aabc=_0x12aabc-0x0;var _0x555739=_0x8f33[_0x12aabc];return _0x555739;};'use strict';var Sequelize=require(_0x38f3('0x0'));module[_0x38f3('0x1')]={'name':{'type':Sequelize[_0x38f3('0x2')],'unique':_0x38f3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x38f3('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x38f3('0x5')](_0x38f3('0x6'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index ee117f4..6dee045 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 _0x4137=['omit','spread','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','FaxQueues','end','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','pick','FaxQueueId','filter','UserFaxQueue','User','UserId','updatedAt','createdAt','format','%s/%s','SIP','faxPause','Team','order','sort','options','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','union','value','isEmpty','userFaxQueue:remove','addAgents'];(function(_0x482914,_0x3fe08e){var _0x151f6a=function(_0x1fc08e){while(--_0x1fc08e){_0x482914['push'](_0x482914['shift']());}};_0x151f6a(++_0x3fe08e);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var BPromise=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var _=require(_0x7413('0x2'));var squel=require(_0x7413('0x3'));var Redis=require(_0x7413('0x4'));var qs=require(_0x7413('0x5'));var logger=require(_0x7413('0x6'))(_0x7413('0x7'));var config=require(_0x7413('0x8'));var db=require(_0x7413('0x9'))['db'];config[_0x7413('0xa')]=_[_0x7413('0xb')](config['redis'],{'host':_0x7413('0xc'),'port':0x18eb});var socket=require(_0x7413('0xd'))(new Redis(config[_0x7413('0xa')]));require(_0x7413('0xe'))['register'](socket);function respondWithStatusCode(_0x3236ec,_0x120dc2){_0x120dc2=_0x120dc2||0xcc;return function(_0x4e320b){if(_0x4e320b){return _0x3236ec[_0x7413('0xf')](_0x120dc2);}return _0x3236ec[_0x7413('0x10')](_0x120dc2)['end']();};}function respondWithResult(_0x29f124,_0x427b3b){_0x427b3b=_0x427b3b||0xc8;return function(_0x737ab4){if(_0x737ab4){return _0x29f124[_0x7413('0x10')](_0x427b3b)[_0x7413('0x11')](_0x737ab4);}};}function respondWithFilteredResult(_0x5a1e62,_0xa25d72){return function(_0x32034c){if(_0x32034c){var _0x4bf07d=typeof _0xa25d72[_0x7413('0x12')]===_0x7413('0x13')&&typeof _0xa25d72[_0x7413('0x14')]==='undefined';var _0x5956b0=_0x32034c['count'];var _0x2267f6=_0x4bf07d?0x0:_0xa25d72[_0x7413('0x12')];var _0x49f0f6=_0x4bf07d?_0x32034c[_0x7413('0x15')]:_0xa25d72[_0x7413('0x12')]+_0xa25d72['limit'];var _0x38b3d1;if(_0x49f0f6>=_0x5956b0){_0x49f0f6=_0x5956b0;_0x38b3d1=0xc8;}else{_0x38b3d1=0xce;}_0x5a1e62['status'](_0x38b3d1);return _0x5a1e62['set'](_0x7413('0x16'),_0x2267f6+'-'+_0x49f0f6+'/'+_0x5956b0)['json'](_0x32034c);}return null;};}function saveUpdates(_0x195c72){return function(_0x538862){if(_0x538862){return _0x538862[_0x7413('0x17')](_0x195c72)[_0x7413('0x18')](function(_0x19157f){return _0x19157f;});}return null;};}function removeEntity(_0x12a01e){return function(_0x2a3417){if(_0x2a3417){return _0x2a3417[_0x7413('0x19')]()['then'](function(){var _0xecc3e=_0x2a3417[_0x7413('0x1a')]({'plain':!![]});var _0x11f8a1=_0x7413('0x1b');return db['UserProfileResource'][_0x7413('0x19')]({'where':{'type':_0x11f8a1,'resourceId':_0xecc3e['id']}})[_0x7413('0x18')](function(){return _0x2a3417;});})[_0x7413('0x18')](function(){_0x12a01e[_0x7413('0x10')](0xcc)[_0x7413('0x1c')]();});}};}function handleEntityNotFound(_0x2d220f){return function(_0x4886e3){if(!_0x4886e3){_0x2d220f[_0x7413('0xf')](0x194);}return _0x4886e3;};}function handleError(_0x56a06a,_0x5f12a2){_0x5f12a2=_0x5f12a2||0x1f4;return function(_0x138508){logger['error'](_0x138508[_0x7413('0x1d')]);if(_0x138508[_0x7413('0x1e')]){delete _0x138508[_0x7413('0x1e')];}_0x56a06a[_0x7413('0x10')](_0x5f12a2)[_0x7413('0x1f')](_0x138508);};}exports[_0x7413('0x20')]=function(_0x1d97fd,_0x41cb5d){var _0x1d455b={};var _0x5a8329={'count':0x0,'rows':[]};var _0x5cb15f=_[_0x7413('0x21')](db['FaxQueue'][_0x7413('0x22')],function(_0x71cbb4){return{'name':_0x71cbb4[_0x7413('0x23')],'type':_0x71cbb4['type'][_0x7413('0x24')]};});_0x1d455b=qs[_0x7413('0x25')](_0x5cb15f,_0x1d97fd);var _0x79cab6={'where':_0x1d455b[_0x7413('0x26')]};return db[_0x7413('0x27')][_0x7413('0x15')](_0x79cab6)['then'](function(_0x24dce7){_0x5a8329['count']=_0x24dce7;_0x1d455b[_0x7413('0x28')]=qs[_0x7413('0x28')](_0x1d97fd[_0x7413('0x29')]);return db[_0x7413('0x27')][_0x7413('0x2a')](_0x1d455b);})[_0x7413('0x18')](function(_0x5bb3ea){_0x5a8329[_0x7413('0x2b')]=_0x5bb3ea;return _0x5a8329;})[_0x7413('0x18')](respondWithFilteredResult(_0x41cb5d,_0x1d455b))[_0x7413('0x2c')](handleError(_0x41cb5d,null));};exports[_0x7413('0x2d')]=function(_0x291268,_0x256395){var _0x185cfe={'raw':!![],'where':{'id':_0x291268[_0x7413('0x2e')]['id']}},_0x5b4426={};_0x5b4426[_0x7413('0x2f')]=_[_0x7413('0x30')](db[_0x7413('0x27')][_0x7413('0x22')]);_0x5b4426['query']=_[_0x7413('0x30')](_0x291268['query']);_0x5b4426[_0x7413('0x31')]=_[_0x7413('0x32')](_0x5b4426[_0x7413('0x2f')],_0x5b4426['query']);_0x185cfe[_0x7413('0x33')]=_['intersection'](_0x5b4426[_0x7413('0x2f')],qs[_0x7413('0x34')](_0x291268['query']['fields']));_0x185cfe[_0x7413('0x33')]=_0x185cfe[_0x7413('0x33')][_0x7413('0x35')]?_0x185cfe['attributes']:_0x5b4426['model'];if(_0x291268[_0x7413('0x29')]['includeAll']){_0x185cfe['include']=[{'all':!![]}];}_0x185cfe=_[_0x7413('0x36')]({},_0x185cfe,_0x291268['options']);return db[_0x7413('0x27')][_0x7413('0x37')](_0x185cfe)[_0x7413('0x18')](handleEntityNotFound(_0x256395,null))[_0x7413('0x18')](respondWithResult(_0x256395,null))[_0x7413('0x2c')](handleError(_0x256395,null));};exports['create']=function(_0xa58bd2,_0x8dc047){return db[_0x7413('0x27')][_0x7413('0x38')](_0xa58bd2[_0x7413('0x39')],{})[_0x7413('0x18')](function(_0x339b10){var _0x385156=_0xa58bd2[_0x7413('0x3a')][_0x7413('0x1a')]({'plain':!![]});if(!_0x385156)throw new Error(_0x7413('0x3b'));if(_0x385156[_0x7413('0x3c')]==='user'){var _0x31f8=_0x339b10['get']({'plain':!![]});var _0x56cb6f='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x56cb6f,'userProfileId':_0x385156[_0x7413('0x3d')]},'raw':!![]})['then'](function(_0x535e49){if(_0x535e49&&_0x535e49[_0x7413('0x3e')]===0x0){return db['UserProfileResource']['create']({'name':_0x31f8[_0x7413('0x1e')],'resourceId':_0x31f8['id'],'type':_0x535e49[_0x7413('0x1e')],'sectionId':_0x535e49['id']},{})[_0x7413('0x18')](function(){return _0x339b10;});}else{return _0x339b10;}})[_0x7413('0x2c')](function(_0x8049c0){logger['error'](_0x7413('0x3f'),_0x8049c0);throw _0x8049c0;});}return _0x339b10;})['then'](respondWithResult(_0x8dc047,0xc9))[_0x7413('0x2c')](handleError(_0x8dc047,null));};exports[_0x7413('0x17')]=function(_0xa063d1,_0xfe0daa){if(_0xa063d1[_0x7413('0x39')]['id']){delete _0xa063d1[_0x7413('0x39')]['id'];}return db[_0x7413('0x27')][_0x7413('0x37')]({'where':{'id':_0xa063d1[_0x7413('0x2e')]['id']}})[_0x7413('0x18')](handleEntityNotFound(_0xfe0daa,null))[_0x7413('0x18')](saveUpdates(_0xa063d1[_0x7413('0x39')],null))[_0x7413('0x18')](respondWithResult(_0xfe0daa,null))['catch'](handleError(_0xfe0daa,null));};exports[_0x7413('0x19')]=function(_0xa9c721,_0x32ab6e){return db[_0x7413('0x27')][_0x7413('0x37')]({'where':{'id':_0xa9c721[_0x7413('0x2e')]['id']}})[_0x7413('0x18')](handleEntityNotFound(_0x32ab6e,null))[_0x7413('0x18')](removeEntity(_0x32ab6e,null))[_0x7413('0x2c')](handleError(_0x32ab6e,null));};exports[_0x7413('0x40')]=function(_0xf41d85,_0x51b1d3){return db[_0x7413('0x27')]['describe']()[_0x7413('0x18')](respondWithResult(_0x51b1d3,null))[_0x7413('0x2c')](handleError(_0x51b1d3,null));};exports[_0x7413('0x41')]=function(_0xb2d135,_0x479049){var _0x148b69={'raw':!![],'where':{}},_0x203729={},_0x7de9d8;return db[_0x7413('0x27')][_0x7413('0x42')]({'where':{'id':_0xb2d135['params']['id']}})['then'](handleEntityNotFound(_0x479049,null))[_0x7413('0x18')](function(_0x520eb6){if(_0x520eb6){_0x7de9d8=_0x520eb6['get']({'plain':!![]});_0x203729[_0x7413('0x2f')]=_[_0x7413('0x30')](db['UserFaxQueue'][_0x7413('0x22')]);_0x203729['query']=_['keys'](_0xb2d135[_0x7413('0x29')]);_0x203729['filters']=_[_0x7413('0x32')](_0x203729[_0x7413('0x2f')],_0x203729[_0x7413('0x29')]);_0x148b69[_0x7413('0x33')]=_[_0x7413('0x32')](_0x203729[_0x7413('0x2f')],qs[_0x7413('0x34')](_0xb2d135[_0x7413('0x29')][_0x7413('0x34')]));_0x148b69[_0x7413('0x33')]=_0x148b69['attributes'][_0x7413('0x35')]?_0x148b69['attributes']:_0x203729['model'];if(!_0xb2d135['query'][_0x7413('0x43')](_0x7413('0x44'))){_0x148b69[_0x7413('0x14')]=qs[_0x7413('0x14')](_0xb2d135['query']['limit']);_0x148b69[_0x7413('0x12')]=qs['offset'](_0xb2d135[_0x7413('0x29')]['offset']);}_0x148b69['order']=qs['sort'](_0xb2d135['query']['sort']);_0x148b69[_0x7413('0x26')]=qs[_0x7413('0x31')](_[_0x7413('0x45')](_0xb2d135[_0x7413('0x29')],_0x203729[_0x7413('0x31')]));_0x148b69['where'][_0x7413('0x46')]=_0x520eb6['id'];if(_0xb2d135[_0x7413('0x29')][_0x7413('0x47')]){_0x148b69['where']=_[_0x7413('0x36')](_0x148b69['where'],{'$or':_['map'](_0x148b69[_0x7413('0x33')],function(_0x287c40){var _0x1939a8={};_0x1939a8[_0x287c40]={'$like':'%'+_0xb2d135[_0x7413('0x29')][_0x7413('0x47')]+'%'};return _0x1939a8;})});}_0x148b69=_[_0x7413('0x36')]({},_0x148b69,_0xb2d135['options']);return db[_0x7413('0x48')]['findAll'](_0x148b69);}})[_0x7413('0x18')](function(_0x511437){if(_0x511437){return db[_0x7413('0x49')]['findAndCountAll']({'where':{'id':_[_0x7413('0x21')](_0x511437,_0x7413('0x4a')),'role':'agent'},'attributes':['id',_0x7413('0x1e'),'faxPause',_0x7413('0x4b'),_0x7413('0x4c')]});}})['then'](function(_0x3ea2d9){if(_0x3ea2d9){return{'count':_0x3ea2d9[_0x7413('0x15')],'rows':_['map'](_0x3ea2d9[_0x7413('0x2b')],function(_0x2bebea){return{'membername':_0x2bebea['name'],'UserId':_0x2bebea['id'],'queue_name':_0x7de9d8[_0x7413('0x1e')],'FaxQueueId':_0x7de9d8['id'],'interface':util[_0x7413('0x4d')](_0x7413('0x4e'),_0x7413('0x4f'),_0x2bebea[_0x7413('0x1e')]),'penalty':0x0,'paused':_0x2bebea[_0x7413('0x50')],'createdAt':_0x2bebea[_0x7413('0x4c')],'updatedAt':_0x2bebea[_0x7413('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x479049,_0x148b69))[_0x7413('0x2c')](handleError(_0x479049,null));};exports['getTeams']=function(_0x3808d3,_0x37a55c){var _0x42f0a6={};var _0x3e7058={};var _0x4c8996;var _0x5e6b7b;return db['FaxQueue']['findOne']({'where':{'id':_0x3808d3['params']['id']}})[_0x7413('0x18')](handleEntityNotFound(_0x37a55c,null))[_0x7413('0x18')](function(_0x1f023f){if(_0x1f023f){_0x4c8996=_0x1f023f;_0x3e7058['model']=_[_0x7413('0x30')](db[_0x7413('0x51')][_0x7413('0x22')]);_0x3e7058[_0x7413('0x29')]=_[_0x7413('0x30')](_0x3808d3[_0x7413('0x29')]);_0x3e7058[_0x7413('0x31')]=_[_0x7413('0x32')](_0x3e7058[_0x7413('0x2f')],_0x3e7058[_0x7413('0x29')]);_0x42f0a6[_0x7413('0x33')]=_[_0x7413('0x32')](_0x3e7058[_0x7413('0x2f')],qs['fields'](_0x3808d3[_0x7413('0x29')][_0x7413('0x34')]));_0x42f0a6['attributes']=_0x42f0a6[_0x7413('0x33')][_0x7413('0x35')]?_0x42f0a6[_0x7413('0x33')]:_0x3e7058[_0x7413('0x2f')];_0x42f0a6[_0x7413('0x52')]=qs[_0x7413('0x53')](_0x3808d3['query'][_0x7413('0x53')]);_0x42f0a6[_0x7413('0x26')]=qs['filters'](_[_0x7413('0x45')](_0x3808d3['query'],_0x3e7058['filters']));if(_0x3808d3[_0x7413('0x29')][_0x7413('0x47')]){_0x42f0a6[_0x7413('0x26')]=_[_0x7413('0x36')](_0x42f0a6[_0x7413('0x26')],{'$or':_[_0x7413('0x21')](_0x42f0a6[_0x7413('0x33')],function(_0x2f8637){var _0x5bed58={};_0x5bed58[_0x2f8637]={'$like':'%'+_0x3808d3[_0x7413('0x29')]['filter']+'%'};return _0x5bed58;})});}_0x42f0a6=_[_0x7413('0x36')]({},_0x42f0a6,_0x3808d3[_0x7413('0x54')]);return _0x4c8996[_0x7413('0x55')](_0x42f0a6);}})[_0x7413('0x18')](function(_0x2c4664){if(_0x2c4664){_0x5e6b7b=_0x2c4664[_0x7413('0x35')];if(!_0x3808d3[_0x7413('0x29')][_0x7413('0x43')](_0x7413('0x44'))){_0x42f0a6['limit']=qs[_0x7413('0x14')](_0x3808d3[_0x7413('0x29')]['limit']);_0x42f0a6[_0x7413('0x12')]=qs[_0x7413('0x12')](_0x3808d3['query'][_0x7413('0x12')]);}return _0x4c8996['getTeams'](_0x42f0a6);}})[_0x7413('0x18')](function(_0x3d4ce3){if(_0x3d4ce3){return _0x3d4ce3?{'count':_0x5e6b7b,'rows':_0x3d4ce3}:null;}})['then'](respondWithResult(_0x37a55c,null))['catch'](handleError(_0x37a55c,null));};exports[_0x7413('0x56')]=function(_0x19fe72,_0x34ec9a){var _0x5f4281=_0x19fe72[_0x7413('0x39')][_0x7413('0x57')];return db[_0x7413('0x51')][_0x7413('0x2a')]({'where':{'id':_0x5f4281},'attributes':['id'],'include':[{'model':db[_0x7413('0x49')],'as':_0x7413('0x58'),'attributes':['id','name',_0x7413('0x59'),_0x7413('0x5a'),_0x7413('0x5b')],'raw':!![]}]})['then'](function(_0x350b01){if(_0x350b01){var _0x18d2e7=_[_0x7413('0x5c')](_0x350b01,function(_0x44cfe7){var _0x33b54f=_0x44cfe7[_0x7413('0x1a')]({'plain':!![]});return _0x33b54f[_0x7413('0x58')];});return db[_0x7413('0x27')][_0x7413('0x37')]({'where':{'id':_0x19fe72['params']['id']}})[_0x7413('0x18')](function(_0x3e1efb){return db[_0x7413('0x5d')][_0x7413('0x5e')](function(_0x23aa9a){return _0x3e1efb[_0x7413('0x56')](_0x5f4281,{'transaction':_0x23aa9a})['then'](function(){return BPromise[_0x7413('0x5f')](_0x18d2e7,function(_0x56d20e){return db['UserFaxQueue'][_0x7413('0x60')]({'where':{'UserId':_0x56d20e['id'],'FaxQueueId':_0x19fe72[_0x7413('0x2e')]['id']},'transaction':_0x23aa9a});});})['then'](function(){_0x18d2e7[_0x7413('0x61')](function(_0x44edb0){socket[_0x7413('0x62')](_0x7413('0x63'),{'UserId':_0x44edb0['id'],'FaxQueueId':_0x3e1efb['id']});});});});});}})[_0x7413('0x18')](respondWithStatusCode(_0x34ec9a,null))[_0x7413('0x2c')](handleError(_0x34ec9a,null));};exports[_0x7413('0x64')]=function(_0x3413f2,_0x5f4765){return db[_0x7413('0x51')]['findAll']({'where':{'id':_0x3413f2[_0x7413('0x29')][_0x7413('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7413('0x58'),'attributes':['id'],'raw':!![]}]})[_0x7413('0x18')](handleEntityNotFound(_0x5f4765,null))[_0x7413('0x18')](function(_0x300a17){var _0xdf132c=_[_0x7413('0x21')](_0x300a17,'id');var _0x3dcbfb=[];var _0x12fbb2=[];var _0x2661b2=squel[_0x7413('0x65')]();_0x2661b2['field'](_0x7413('0x66'))[_0x7413('0x67')]('team_has_fax_queues','tq')['join']('user_has_teams','ut',_0x7413('0x68'))['where'](_0x7413('0x69'),_0x3413f2[_0x7413('0x2e')]['id']);for(var _0x121b1a=0x0;_0x121b1a<_0x300a17[_0x7413('0x35')];_0x121b1a+=0x1){let _0x470c21=_0x300a17[_0x121b1a];for(var _0x17c115=0x0;_0x17c115<_0x470c21[_0x7413('0x58')][_0x7413('0x35')];_0x17c115+=0x1){let _0x3efa75=_0x470c21['Agents'][_0x17c115];var _0x1c0800=_0x2661b2[_0x7413('0x6a')]();_0x1c0800[_0x7413('0x26')]('ut.UserId\x20=\x20?',_0x3efa75['id']);_0x12fbb2[_0x7413('0x6b')](db[_0x7413('0x5d')][_0x7413('0x29')](_0x1c0800[_0x7413('0x6c')](),{'type':db[_0x7413('0x5d')][_0x7413('0x6d')][_0x7413('0x6e')]})[_0x7413('0x18')](function(_0x471c28){if(_0x471c28[_0x7413('0x35')]===0x1){return _0x3efa75['id'];}else{var _0x4f998b=_[_0x7413('0x6f')](_[_0x7413('0x21')](_0x471c28,'TeamId'),function(_0x43f813){return _[_0x7413('0x70')](_0xdf132c,_0x43f813);});if(_0x4f998b){return _0x3efa75['id'];}}}));}}return BPromise['all'](_0x12fbb2)[_0x7413('0x18')](function(_0x193d54){_0x3dcbfb=_(_0x3dcbfb)[_0x7413('0x71')](_0x193d54)['compact']()[_0x7413('0x72')]();return db['FaxQueue'][_0x7413('0x37')]({'where':{'id':_0x3413f2[_0x7413('0x2e')]['id']}})[_0x7413('0x18')](function(_0x20ba75){return db[_0x7413('0x5d')][_0x7413('0x5e')](function(_0x53e64f){return _0x20ba75[_0x7413('0x64')](_0x3413f2[_0x7413('0x29')][_0x7413('0x57')],{'transaction':_0x53e64f})[_0x7413('0x18')](function(){if(!_[_0x7413('0x73')](_0x3dcbfb)){return _0x20ba75['removeAgents'](_0x3dcbfb,{'transaction':_0x53e64f});}})[_0x7413('0x18')](function(){_0x3dcbfb[_0x7413('0x61')](function(_0x191fa2){socket[_0x7413('0x62')](_0x7413('0x74'),{'UserId':_0x191fa2,'FaxQueueId':_0x20ba75['id']});});});});});});})['then'](respondWithStatusCode(_0x5f4765,null))['catch'](handleError(_0x5f4765,null));};exports[_0x7413('0x75')]=function(_0x2e672d,_0x389ce1){return db[_0x7413('0x27')]['find']({'where':{'id':_0x2e672d['params']['id']}})[_0x7413('0x18')](handleEntityNotFound(_0x389ce1,null))[_0x7413('0x18')](function(_0x32c96f){if(_0x32c96f){return _0x32c96f['addAgents'](_0x2e672d['body'][_0x7413('0x57')],_[_0x7413('0x76')](_0x2e672d[_0x7413('0x39')],[_0x7413('0x57'),'id'])||{})[_0x7413('0x77')](function(_0x12fe51){for(var _0x5fd045=0x0;_0x5fd045<_0x2e672d['body']['ids'][_0x7413('0x35')];_0x5fd045+=0x1){socket[_0x7413('0x62')]('userFaxQueue:save',{'UserId':Number(_0x2e672d[_0x7413('0x39')][_0x7413('0x57')][_0x5fd045]),'FaxQueueId':Number(_0x2e672d[_0x7413('0x2e')]['id'])});}return _0x12fe51;});}})[_0x7413('0x18')](respondWithResult(_0x389ce1,null))[_0x7413('0x2c')](handleError(_0x389ce1,null));};exports[_0x7413('0x78')]=function(_0x1826d6,_0x2939b6){return db[_0x7413('0x27')]['find']({'where':{'id':_0x1826d6[_0x7413('0x2e')]['id']}})[_0x7413('0x18')](handleEntityNotFound(_0x2939b6,null))[_0x7413('0x18')](function(_0x1f3e26){if(_0x1f3e26){return _0x1f3e26[_0x7413('0x78')](_0x1826d6[_0x7413('0x29')]['ids'])['then'](function(){if(_['isArray'](_0x1826d6[_0x7413('0x29')][_0x7413('0x57')])){for(var _0x999109=0x0;_0x999109<_0x1826d6[_0x7413('0x29')][_0x7413('0x57')][_0x7413('0x35')];_0x999109+=0x1){socket[_0x7413('0x62')](_0x7413('0x74'),{'UserId':Number(_0x1826d6['query'][_0x7413('0x57')][_0x999109]),'FaxQueueId':Number(_0x1826d6['params']['id'])});}}else{socket[_0x7413('0x62')](_0x7413('0x74'),{'UserId':Number(_0x1826d6[_0x7413('0x29')][_0x7413('0x57')]),'FaxQueueId':Number(_0x1826d6[_0x7413('0x2e')]['id'])});}});}})['then'](respondWithStatusCode(_0x2939b6,null))[_0x7413('0x2c')](handleError(_0x2939b6,null));};exports[_0x7413('0x79')]=function(_0x1455b4,_0x145fcb){var _0xf11f9b={};var _0x38f6cc={};var _0xaecc97;var _0xa43b1b;return db[_0x7413('0x27')][_0x7413('0x42')]({'where':{'id':_0x1455b4[_0x7413('0x2e')]['id']}})[_0x7413('0x18')](handleEntityNotFound(_0x145fcb,null))[_0x7413('0x18')](function(_0x398823){if(_0x398823){_0xaecc97=_0x398823;_0x38f6cc[_0x7413('0x2f')]=_['keys'](db['User'][_0x7413('0x22')]);_0x38f6cc[_0x7413('0x29')]=_['keys'](_0x1455b4[_0x7413('0x29')]);_0x38f6cc['filters']=_[_0x7413('0x32')](_0x38f6cc[_0x7413('0x2f')],_0x38f6cc[_0x7413('0x29')]);_0xf11f9b[_0x7413('0x33')]=_[_0x7413('0x32')](_0x38f6cc[_0x7413('0x2f')],qs[_0x7413('0x34')](_0x1455b4[_0x7413('0x29')]['fields']));_0xf11f9b[_0x7413('0x33')]=_0xf11f9b['attributes'][_0x7413('0x35')]?_0xf11f9b['attributes']:_0x38f6cc[_0x7413('0x2f')];_0xf11f9b[_0x7413('0x52')]=qs[_0x7413('0x53')](_0x1455b4['query'][_0x7413('0x53')]);_0xf11f9b[_0x7413('0x26')]=qs[_0x7413('0x31')](_[_0x7413('0x45')](_0x1455b4[_0x7413('0x29')],_0x38f6cc[_0x7413('0x31')]));if(_0x1455b4['query'][_0x7413('0x47')]){_0xf11f9b['where']=_['merge'](_0xf11f9b[_0x7413('0x26')],{'$or':_[_0x7413('0x21')](_0xf11f9b[_0x7413('0x33')],function(_0x5e15b3){var _0x7a4159={};_0x7a4159[_0x5e15b3]={'$like':'%'+_0x1455b4[_0x7413('0x29')][_0x7413('0x47')]+'%'};return _0x7a4159;})});}_0xf11f9b=_[_0x7413('0x36')]({},_0xf11f9b,_0x1455b4[_0x7413('0x54')]);return _0xaecc97[_0x7413('0x79')](_0xf11f9b);}})['then'](function(_0x599ffe){if(_0x599ffe){_0xa43b1b=_0x599ffe['length'];if(!_0x1455b4[_0x7413('0x29')][_0x7413('0x43')]('nolimit')){_0xf11f9b[_0x7413('0x14')]=qs[_0x7413('0x14')](_0x1455b4[_0x7413('0x29')][_0x7413('0x14')]);_0xf11f9b['offset']=qs[_0x7413('0x12')](_0x1455b4[_0x7413('0x29')]['offset']);}return _0xaecc97[_0x7413('0x79')](_0xf11f9b);}})[_0x7413('0x18')](function(_0x46a3f9){if(_0x46a3f9){return _0x46a3f9?{'count':_0xa43b1b,'rows':_0x46a3f9}:null;}})[_0x7413('0x18')](respondWithResult(_0x145fcb,null))['catch'](handleError(_0x145fcb,null));}; \ No newline at end of file +var _0x9206=['value','transaction','isEmpty','addAgents','spread','removeAgents','isArray','userFaxQueue:remove','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','map','FaxQueue','fieldName','type','key','getOptions','where','include','catch','show','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','options','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserFaxQueue','filters','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','merge','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','compact'];(function(_0x529064,_0x249b11){var _0xbe8bef=function(_0x1b97c4){while(--_0x1b97c4){_0x529064['push'](_0x529064['shift']());}};_0xbe8bef(++_0x249b11);}(_0x9206,0x176));var _0x6920=function(_0x320e1b,_0x70f30){_0x320e1b=_0x320e1b-0x0;var _0x2d4528=_0x9206[_0x320e1b];return _0x2d4528;};'use strict';var BPromise=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var _=require(_0x6920('0x2'));var squel=require(_0x6920('0x3'));var Redis=require(_0x6920('0x4'));var qs=require(_0x6920('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x6920('0x6'));var db=require(_0x6920('0x7'))['db'];config['redis']=_['defaults'](config[_0x6920('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6920('0x9'))(new Redis(config[_0x6920('0x8')]));require(_0x6920('0xa'))[_0x6920('0xb')](socket);function respondWithStatusCode(_0x56bb75,_0x538f80){_0x538f80=_0x538f80||0xcc;return function(_0x1f4895){if(_0x1f4895){return _0x56bb75[_0x6920('0xc')](_0x538f80);}return _0x56bb75[_0x6920('0xd')](_0x538f80)[_0x6920('0xe')]();};}function respondWithResult(_0x188e0c,_0x2a9aa6){_0x2a9aa6=_0x2a9aa6||0xc8;return function(_0x31711e){if(_0x31711e){return _0x188e0c[_0x6920('0xd')](_0x2a9aa6)[_0x6920('0xf')](_0x31711e);}};}function respondWithFilteredResult(_0x3c10a4,_0xb5d14){return function(_0xa75e65){if(_0xa75e65){var _0x4052cf=typeof _0xb5d14['offset']==='undefined'&&typeof _0xb5d14[_0x6920('0x10')]===_0x6920('0x11');var _0x57e9f3=_0xa75e65[_0x6920('0x12')];var _0xfa2823=_0x4052cf?0x0:_0xb5d14[_0x6920('0x13')];var _0x2c3a35=_0x4052cf?_0xa75e65[_0x6920('0x12')]:_0xb5d14['offset']+_0xb5d14[_0x6920('0x10')];var _0x20cdfb;if(_0x2c3a35>=_0x57e9f3){_0x2c3a35=_0x57e9f3;_0x20cdfb=0xc8;}else{_0x20cdfb=0xce;}_0x3c10a4[_0x6920('0xd')](_0x20cdfb);return _0x3c10a4[_0x6920('0x14')](_0x6920('0x15'),_0xfa2823+'-'+_0x2c3a35+'/'+_0x57e9f3)[_0x6920('0xf')](_0xa75e65);}return null;};}function saveUpdates(_0x3452a4){return function(_0x17a166){if(_0x17a166){return _0x17a166[_0x6920('0x16')](_0x3452a4)[_0x6920('0x17')](function(_0x462500){return _0x462500;});}return null;};}function removeEntity(_0x3d0059){return function(_0xc6e86b){if(_0xc6e86b){return _0xc6e86b[_0x6920('0x18')]()[_0x6920('0x17')](function(){var _0x568c24=_0xc6e86b[_0x6920('0x19')]({'plain':!![]});var _0x1f8af0=_0x6920('0x1a');return db[_0x6920('0x1b')][_0x6920('0x18')]({'where':{'type':_0x1f8af0,'resourceId':_0x568c24['id']}})[_0x6920('0x17')](function(){return _0xc6e86b;});})[_0x6920('0x17')](function(){_0x3d0059[_0x6920('0xd')](0xcc)[_0x6920('0xe')]();});}};}function handleEntityNotFound(_0x37ebb0){return function(_0x32c784){if(!_0x32c784){_0x37ebb0[_0x6920('0xc')](0x194);}return _0x32c784;};}function handleError(_0x1df372,_0x2dd788){_0x2dd788=_0x2dd788||0x1f4;return function(_0x1f68c5){logger[_0x6920('0x1c')](_0x1f68c5[_0x6920('0x1d')]);if(_0x1f68c5[_0x6920('0x1e')]){delete _0x1f68c5[_0x6920('0x1e')];}_0x1df372[_0x6920('0xd')](_0x2dd788)['send'](_0x1f68c5);};}exports[_0x6920('0x1f')]=function(_0x5ab31d,_0x277b69){var _0x4dd08b={};var _0x72316a={'count':0x0,'rows':[]};var _0x32a6ae=_[_0x6920('0x20')](db[_0x6920('0x21')]['rawAttributes'],function(_0x1cab00){return{'name':_0x1cab00[_0x6920('0x22')],'type':_0x1cab00[_0x6920('0x23')][_0x6920('0x24')]};});_0x4dd08b=qs[_0x6920('0x25')](_0x32a6ae,_0x5ab31d);var _0x462692={'where':_0x4dd08b[_0x6920('0x26')]};return db[_0x6920('0x21')][_0x6920('0x12')](_0x462692)[_0x6920('0x17')](function(_0x6860c7){_0x72316a[_0x6920('0x12')]=_0x6860c7;_0x4dd08b['include']=qs[_0x6920('0x27')](_0x5ab31d['query']);return db[_0x6920('0x21')]['findAll'](_0x4dd08b);})[_0x6920('0x17')](function(_0x25e7ff){_0x72316a['rows']=_0x25e7ff;return _0x72316a;})[_0x6920('0x17')](respondWithFilteredResult(_0x277b69,_0x4dd08b))[_0x6920('0x28')](handleError(_0x277b69,null));};exports[_0x6920('0x29')]=function(_0x488b7f,_0x4a57b0){var _0x299f88={'raw':!![],'where':{'id':_0x488b7f['params']['id']}},_0x5bb636={};_0x5bb636[_0x6920('0x2a')]=_[_0x6920('0x2b')](db[_0x6920('0x21')][_0x6920('0x2c')]);_0x5bb636[_0x6920('0x2d')]=_[_0x6920('0x2b')](_0x488b7f[_0x6920('0x2d')]);_0x5bb636['filters']=_[_0x6920('0x2e')](_0x5bb636['model'],_0x5bb636[_0x6920('0x2d')]);_0x299f88['attributes']=_['intersection'](_0x5bb636[_0x6920('0x2a')],qs[_0x6920('0x2f')](_0x488b7f[_0x6920('0x2d')][_0x6920('0x2f')]));_0x299f88[_0x6920('0x30')]=_0x299f88[_0x6920('0x30')][_0x6920('0x31')]?_0x299f88[_0x6920('0x30')]:_0x5bb636[_0x6920('0x2a')];if(_0x488b7f[_0x6920('0x2d')][_0x6920('0x32')]){_0x299f88[_0x6920('0x27')]=[{'all':!![]}];}_0x299f88=_['merge']({},_0x299f88,_0x488b7f[_0x6920('0x33')]);return db['FaxQueue'][_0x6920('0x34')](_0x299f88)[_0x6920('0x17')](handleEntityNotFound(_0x4a57b0,null))[_0x6920('0x17')](respondWithResult(_0x4a57b0,null))['catch'](handleError(_0x4a57b0,null));};exports[_0x6920('0x35')]=function(_0x41503b,_0x14f841){return db[_0x6920('0x21')]['create'](_0x41503b[_0x6920('0x36')],{})[_0x6920('0x17')](function(_0x4f66dd){var _0x49be52=_0x41503b[_0x6920('0x37')][_0x6920('0x19')]({'plain':!![]});if(!_0x49be52)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49be52[_0x6920('0x38')]===_0x6920('0x37')){var _0x4abd78=_0x4f66dd['get']({'plain':!![]});var _0xeb7ca4=_0x6920('0x1a');return db[_0x6920('0x39')][_0x6920('0x34')]({'where':{'name':_0xeb7ca4,'userProfileId':_0x49be52[_0x6920('0x3a')]},'raw':!![]})['then'](function(_0x58f0e8){if(_0x58f0e8&&_0x58f0e8['autoAssociation']===0x0){return db[_0x6920('0x1b')]['create']({'name':_0x4abd78['name'],'resourceId':_0x4abd78['id'],'type':_0x58f0e8[_0x6920('0x1e')],'sectionId':_0x58f0e8['id']},{})[_0x6920('0x17')](function(){return _0x4f66dd;});}else{return _0x4f66dd;}})['catch'](function(_0x3aad11){logger['error'](_0x6920('0x3b'),_0x3aad11);throw _0x3aad11;});}return _0x4f66dd;})[_0x6920('0x17')](respondWithResult(_0x14f841,0xc9))[_0x6920('0x28')](handleError(_0x14f841,null));};exports[_0x6920('0x16')]=function(_0x3a994d,_0x55d7b5){if(_0x3a994d['body']['id']){delete _0x3a994d[_0x6920('0x36')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x3a994d['params']['id']}})['then'](handleEntityNotFound(_0x55d7b5,null))[_0x6920('0x17')](saveUpdates(_0x3a994d[_0x6920('0x36')],null))[_0x6920('0x17')](respondWithResult(_0x55d7b5,null))['catch'](handleError(_0x55d7b5,null));};exports[_0x6920('0x18')]=function(_0x29306b,_0x256f72){return db[_0x6920('0x21')][_0x6920('0x34')]({'where':{'id':_0x29306b[_0x6920('0x3c')]['id']}})['then'](handleEntityNotFound(_0x256f72,null))[_0x6920('0x17')](removeEntity(_0x256f72,null))[_0x6920('0x28')](handleError(_0x256f72,null));};exports[_0x6920('0x3d')]=function(_0x1d2d44,_0xab9d6c){return db[_0x6920('0x21')][_0x6920('0x3d')]()[_0x6920('0x17')](respondWithResult(_0xab9d6c,null))[_0x6920('0x28')](handleError(_0xab9d6c,null));};exports[_0x6920('0x3e')]=function(_0x2f36ff,_0x21e5f4){var _0x552a81={'raw':!![],'where':{}},_0x1d50f7={},_0x383c6d;return db['FaxQueue']['findOne']({'where':{'id':_0x2f36ff[_0x6920('0x3c')]['id']}})[_0x6920('0x17')](handleEntityNotFound(_0x21e5f4,null))[_0x6920('0x17')](function(_0x41c38d){if(_0x41c38d){_0x383c6d=_0x41c38d[_0x6920('0x19')]({'plain':!![]});_0x1d50f7['model']=_[_0x6920('0x2b')](db[_0x6920('0x3f')][_0x6920('0x2c')]);_0x1d50f7['query']=_['keys'](_0x2f36ff[_0x6920('0x2d')]);_0x1d50f7[_0x6920('0x40')]=_[_0x6920('0x2e')](_0x1d50f7[_0x6920('0x2a')],_0x1d50f7['query']);_0x552a81[_0x6920('0x30')]=_[_0x6920('0x2e')](_0x1d50f7[_0x6920('0x2a')],qs[_0x6920('0x2f')](_0x2f36ff[_0x6920('0x2d')]['fields']));_0x552a81[_0x6920('0x30')]=_0x552a81[_0x6920('0x30')][_0x6920('0x31')]?_0x552a81[_0x6920('0x30')]:_0x1d50f7[_0x6920('0x2a')];if(!_0x2f36ff[_0x6920('0x2d')][_0x6920('0x41')](_0x6920('0x42'))){_0x552a81[_0x6920('0x10')]=qs[_0x6920('0x10')](_0x2f36ff['query'][_0x6920('0x10')]);_0x552a81[_0x6920('0x13')]=qs[_0x6920('0x13')](_0x2f36ff[_0x6920('0x2d')][_0x6920('0x13')]);}_0x552a81[_0x6920('0x43')]=qs[_0x6920('0x44')](_0x2f36ff['query'][_0x6920('0x44')]);_0x552a81[_0x6920('0x26')]=qs[_0x6920('0x40')](_[_0x6920('0x45')](_0x2f36ff['query'],_0x1d50f7['filters']));_0x552a81['where'][_0x6920('0x46')]=_0x41c38d['id'];if(_0x2f36ff[_0x6920('0x2d')][_0x6920('0x47')]){_0x552a81['where']=_[_0x6920('0x48')](_0x552a81[_0x6920('0x26')],{'$or':_[_0x6920('0x20')](_0x552a81[_0x6920('0x30')],function(_0x2c1b33){var _0x6a2ff4={};_0x6a2ff4[_0x2c1b33]={'$like':'%'+_0x2f36ff[_0x6920('0x2d')]['filter']+'%'};return _0x6a2ff4;})});}_0x552a81=_[_0x6920('0x48')]({},_0x552a81,_0x2f36ff[_0x6920('0x33')]);return db['UserFaxQueue'][_0x6920('0x49')](_0x552a81);}})[_0x6920('0x17')](function(_0xfcb300){if(_0xfcb300){return db[_0x6920('0x4a')][_0x6920('0x4b')]({'where':{'id':_['map'](_0xfcb300,_0x6920('0x4c')),'role':_0x6920('0x4d')},'attributes':['id','name',_0x6920('0x4e'),_0x6920('0x4f'),'createdAt']});}})['then'](function(_0x4483ac){if(_0x4483ac){return{'count':_0x4483ac[_0x6920('0x12')],'rows':_['map'](_0x4483ac[_0x6920('0x50')],function(_0x3a24e0){return{'membername':_0x3a24e0[_0x6920('0x1e')],'UserId':_0x3a24e0['id'],'queue_name':_0x383c6d[_0x6920('0x1e')],'FaxQueueId':_0x383c6d['id'],'interface':util[_0x6920('0x51')](_0x6920('0x52'),_0x6920('0x53'),_0x3a24e0['name']),'penalty':0x0,'paused':_0x3a24e0[_0x6920('0x4e')],'createdAt':_0x3a24e0[_0x6920('0x54')],'updatedAt':_0x3a24e0[_0x6920('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6920('0x17')](respondWithFilteredResult(_0x21e5f4,_0x552a81))[_0x6920('0x28')](handleError(_0x21e5f4,null));};exports[_0x6920('0x55')]=function(_0xa0eeb8,_0x5291bf){var _0xe17e0c={};var _0x5c34c2={};var _0x42b438;var _0x1016e2;return db[_0x6920('0x21')][_0x6920('0x56')]({'where':{'id':_0xa0eeb8['params']['id']}})[_0x6920('0x17')](handleEntityNotFound(_0x5291bf,null))[_0x6920('0x17')](function(_0x3ce032){if(_0x3ce032){_0x42b438=_0x3ce032;_0x5c34c2[_0x6920('0x2a')]=_[_0x6920('0x2b')](db[_0x6920('0x57')]['rawAttributes']);_0x5c34c2[_0x6920('0x2d')]=_[_0x6920('0x2b')](_0xa0eeb8['query']);_0x5c34c2[_0x6920('0x40')]=_[_0x6920('0x2e')](_0x5c34c2[_0x6920('0x2a')],_0x5c34c2[_0x6920('0x2d')]);_0xe17e0c[_0x6920('0x30')]=_[_0x6920('0x2e')](_0x5c34c2[_0x6920('0x2a')],qs[_0x6920('0x2f')](_0xa0eeb8[_0x6920('0x2d')][_0x6920('0x2f')]));_0xe17e0c[_0x6920('0x30')]=_0xe17e0c[_0x6920('0x30')][_0x6920('0x31')]?_0xe17e0c[_0x6920('0x30')]:_0x5c34c2['model'];_0xe17e0c[_0x6920('0x43')]=qs[_0x6920('0x44')](_0xa0eeb8[_0x6920('0x2d')]['sort']);_0xe17e0c[_0x6920('0x26')]=qs[_0x6920('0x40')](_[_0x6920('0x45')](_0xa0eeb8[_0x6920('0x2d')],_0x5c34c2[_0x6920('0x40')]));if(_0xa0eeb8['query'][_0x6920('0x47')]){_0xe17e0c[_0x6920('0x26')]=_[_0x6920('0x48')](_0xe17e0c['where'],{'$or':_[_0x6920('0x20')](_0xe17e0c['attributes'],function(_0x4c8698){var _0x1cdd6e={};_0x1cdd6e[_0x4c8698]={'$like':'%'+_0xa0eeb8['query'][_0x6920('0x47')]+'%'};return _0x1cdd6e;})});}_0xe17e0c=_[_0x6920('0x48')]({},_0xe17e0c,_0xa0eeb8['options']);return _0x42b438['getTeams'](_0xe17e0c);}})[_0x6920('0x17')](function(_0x166a2f){if(_0x166a2f){_0x1016e2=_0x166a2f[_0x6920('0x31')];if(!_0xa0eeb8[_0x6920('0x2d')][_0x6920('0x41')](_0x6920('0x42'))){_0xe17e0c[_0x6920('0x10')]=qs[_0x6920('0x10')](_0xa0eeb8[_0x6920('0x2d')][_0x6920('0x10')]);_0xe17e0c['offset']=qs['offset'](_0xa0eeb8[_0x6920('0x2d')][_0x6920('0x13')]);}return _0x42b438['getTeams'](_0xe17e0c);}})[_0x6920('0x17')](function(_0x598920){if(_0x598920){return _0x598920?{'count':_0x1016e2,'rows':_0x598920}:null;}})[_0x6920('0x17')](respondWithResult(_0x5291bf,null))[_0x6920('0x28')](handleError(_0x5291bf,null));};exports[_0x6920('0x58')]=function(_0x345130,_0x2340ea){var _0x53ec4d=_0x345130['body']['ids'];return db['Team'][_0x6920('0x49')]({'where':{'id':_0x53ec4d},'attributes':['id'],'include':[{'model':db[_0x6920('0x4a')],'as':_0x6920('0x59'),'attributes':['id',_0x6920('0x1e'),'online',_0x6920('0x5a'),_0x6920('0x5b')],'raw':!![]}]})[_0x6920('0x17')](function(_0x17f172){if(_0x17f172){var _0x3f2497=_[_0x6920('0x5c')](_0x17f172,function(_0x18be21){var _0x2f7f1c=_0x18be21[_0x6920('0x19')]({'plain':!![]});return _0x2f7f1c[_0x6920('0x59')];});return db[_0x6920('0x21')][_0x6920('0x34')]({'where':{'id':_0x345130['params']['id']}})[_0x6920('0x17')](function(_0x18423f){return db[_0x6920('0x5d')]['transaction'](function(_0x299ea9){return _0x18423f[_0x6920('0x58')](_0x53ec4d,{'transaction':_0x299ea9})[_0x6920('0x17')](function(){return BPromise[_0x6920('0x5e')](_0x3f2497,function(_0x36ee1a){return db['UserFaxQueue'][_0x6920('0x5f')]({'where':{'UserId':_0x36ee1a['id'],'FaxQueueId':_0x345130[_0x6920('0x3c')]['id']},'transaction':_0x299ea9});});})[_0x6920('0x17')](function(){_0x3f2497[_0x6920('0x60')](function(_0x57f568){socket[_0x6920('0x61')](_0x6920('0x62'),{'UserId':_0x57f568['id'],'FaxQueueId':_0x18423f['id']});});});});});}})['then'](respondWithStatusCode(_0x2340ea,null))[_0x6920('0x28')](handleError(_0x2340ea,null));};exports[_0x6920('0x63')]=function(_0x5e9a16,_0x3267fd){return db['Team'][_0x6920('0x49')]({'where':{'id':_0x5e9a16[_0x6920('0x2d')][_0x6920('0x64')]},'attributes':['id'],'include':[{'model':db[_0x6920('0x4a')],'as':_0x6920('0x59'),'attributes':['id'],'raw':!![]}]})[_0x6920('0x17')](handleEntityNotFound(_0x3267fd,null))['then'](function(_0x3e52f5){var _0x1aa513=_[_0x6920('0x20')](_0x3e52f5,'id');var _0x2bad87=[];var _0x5ca516=[];var _0x3f472a=squel[_0x6920('0x65')]();_0x3f472a[_0x6920('0x66')]('tq.TeamId')[_0x6920('0x67')]('team_has_fax_queues','tq')[_0x6920('0x68')](_0x6920('0x69'),'ut',_0x6920('0x6a'))['where']('FaxQueueId\x20=\x20?',_0x5e9a16['params']['id']);for(var _0x1f5795=0x0;_0x1f5795<_0x3e52f5['length'];_0x1f5795+=0x1){let _0x5b19ee=_0x3e52f5[_0x1f5795];for(var _0x4928d1=0x0;_0x4928d1<_0x5b19ee[_0x6920('0x59')][_0x6920('0x31')];_0x4928d1+=0x1){let _0x3e477f=_0x5b19ee[_0x6920('0x59')][_0x4928d1];var _0x3093b2=_0x3f472a['clone']();_0x3093b2[_0x6920('0x26')](_0x6920('0x6b'),_0x3e477f['id']);_0x5ca516[_0x6920('0x6c')](db['sequelize'][_0x6920('0x2d')](_0x3093b2[_0x6920('0x6d')](),{'type':db['sequelize']['QueryTypes'][_0x6920('0x6e')]})['then'](function(_0x544bcb){if(_0x544bcb[_0x6920('0x31')]===0x1){return _0x3e477f['id'];}else{var _0x349fb5=_[_0x6920('0x6f')](_[_0x6920('0x20')](_0x544bcb,'TeamId'),function(_0x297cf7){return _[_0x6920('0x70')](_0x1aa513,_0x297cf7);});if(_0x349fb5){return _0x3e477f['id'];}}}));}}return BPromise['all'](_0x5ca516)[_0x6920('0x17')](function(_0x30e9f3){_0x2bad87=_(_0x2bad87)['union'](_0x30e9f3)[_0x6920('0x71')]()[_0x6920('0x72')]();return db[_0x6920('0x21')][_0x6920('0x34')]({'where':{'id':_0x5e9a16[_0x6920('0x3c')]['id']}})[_0x6920('0x17')](function(_0x190aa7){return db[_0x6920('0x5d')][_0x6920('0x73')](function(_0x359bc7){return _0x190aa7[_0x6920('0x63')](_0x5e9a16[_0x6920('0x2d')][_0x6920('0x64')],{'transaction':_0x359bc7})[_0x6920('0x17')](function(){if(!_[_0x6920('0x74')](_0x2bad87)){return _0x190aa7['removeAgents'](_0x2bad87,{'transaction':_0x359bc7});}})[_0x6920('0x17')](function(){_0x2bad87[_0x6920('0x60')](function(_0x3d4588){socket['emit']('userFaxQueue:remove',{'UserId':_0x3d4588,'FaxQueueId':_0x190aa7['id']});});});});});});})[_0x6920('0x17')](respondWithStatusCode(_0x3267fd,null))['catch'](handleError(_0x3267fd,null));};exports[_0x6920('0x75')]=function(_0x408f7a,_0x33d0cc){return db[_0x6920('0x21')]['find']({'where':{'id':_0x408f7a[_0x6920('0x3c')]['id']}})[_0x6920('0x17')](handleEntityNotFound(_0x33d0cc,null))[_0x6920('0x17')](function(_0x26f328){if(_0x26f328){return _0x26f328['addAgents'](_0x408f7a['body'][_0x6920('0x64')],_['omit'](_0x408f7a[_0x6920('0x36')],[_0x6920('0x64'),'id'])||{})[_0x6920('0x76')](function(_0x1a08c4){for(var _0x3001c9=0x0;_0x3001c9<_0x408f7a[_0x6920('0x36')]['ids'][_0x6920('0x31')];_0x3001c9+=0x1){socket[_0x6920('0x61')](_0x6920('0x62'),{'UserId':Number(_0x408f7a[_0x6920('0x36')][_0x6920('0x64')][_0x3001c9]),'FaxQueueId':Number(_0x408f7a[_0x6920('0x3c')]['id'])});}return _0x1a08c4;});}})['then'](respondWithResult(_0x33d0cc,null))['catch'](handleError(_0x33d0cc,null));};exports[_0x6920('0x77')]=function(_0x2c2ea4,_0x38d43e){return db[_0x6920('0x21')][_0x6920('0x34')]({'where':{'id':_0x2c2ea4[_0x6920('0x3c')]['id']}})[_0x6920('0x17')](handleEntityNotFound(_0x38d43e,null))[_0x6920('0x17')](function(_0x2644ef){if(_0x2644ef){return _0x2644ef['removeAgents'](_0x2c2ea4[_0x6920('0x2d')]['ids'])['then'](function(){if(_[_0x6920('0x78')](_0x2c2ea4[_0x6920('0x2d')][_0x6920('0x64')])){for(var _0x5f4c89=0x0;_0x5f4c89<_0x2c2ea4[_0x6920('0x2d')][_0x6920('0x64')]['length'];_0x5f4c89+=0x1){socket[_0x6920('0x61')]('userFaxQueue:remove',{'UserId':Number(_0x2c2ea4[_0x6920('0x2d')]['ids'][_0x5f4c89]),'FaxQueueId':Number(_0x2c2ea4['params']['id'])});}}else{socket[_0x6920('0x61')](_0x6920('0x79'),{'UserId':Number(_0x2c2ea4[_0x6920('0x2d')][_0x6920('0x64')]),'FaxQueueId':Number(_0x2c2ea4[_0x6920('0x3c')]['id'])});}});}})['then'](respondWithStatusCode(_0x38d43e,null))[_0x6920('0x28')](handleError(_0x38d43e,null));};exports['getAgents']=function(_0x2f9c4f,_0x50fed3){var _0x2f3b73={};var _0x4e61e7={};var _0x4da2be;var _0x209ad3;return db[_0x6920('0x21')][_0x6920('0x56')]({'where':{'id':_0x2f9c4f[_0x6920('0x3c')]['id']}})[_0x6920('0x17')](handleEntityNotFound(_0x50fed3,null))[_0x6920('0x17')](function(_0x34dc64){if(_0x34dc64){_0x4da2be=_0x34dc64;_0x4e61e7[_0x6920('0x2a')]=_['keys'](db[_0x6920('0x4a')][_0x6920('0x2c')]);_0x4e61e7[_0x6920('0x2d')]=_[_0x6920('0x2b')](_0x2f9c4f['query']);_0x4e61e7[_0x6920('0x40')]=_[_0x6920('0x2e')](_0x4e61e7[_0x6920('0x2a')],_0x4e61e7[_0x6920('0x2d')]);_0x2f3b73['attributes']=_[_0x6920('0x2e')](_0x4e61e7[_0x6920('0x2a')],qs[_0x6920('0x2f')](_0x2f9c4f[_0x6920('0x2d')][_0x6920('0x2f')]));_0x2f3b73[_0x6920('0x30')]=_0x2f3b73['attributes']['length']?_0x2f3b73[_0x6920('0x30')]:_0x4e61e7[_0x6920('0x2a')];_0x2f3b73[_0x6920('0x43')]=qs[_0x6920('0x44')](_0x2f9c4f[_0x6920('0x2d')]['sort']);_0x2f3b73[_0x6920('0x26')]=qs[_0x6920('0x40')](_[_0x6920('0x45')](_0x2f9c4f[_0x6920('0x2d')],_0x4e61e7['filters']));if(_0x2f9c4f[_0x6920('0x2d')][_0x6920('0x47')]){_0x2f3b73[_0x6920('0x26')]=_['merge'](_0x2f3b73[_0x6920('0x26')],{'$or':_[_0x6920('0x20')](_0x2f3b73['attributes'],function(_0x2d3f27){var _0x509315={};_0x509315[_0x2d3f27]={'$like':'%'+_0x2f9c4f[_0x6920('0x2d')]['filter']+'%'};return _0x509315;})});}_0x2f3b73=_[_0x6920('0x48')]({},_0x2f3b73,_0x2f9c4f[_0x6920('0x33')]);return _0x4da2be['getAgents'](_0x2f3b73);}})['then'](function(_0x366dd3){if(_0x366dd3){_0x209ad3=_0x366dd3[_0x6920('0x31')];if(!_0x2f9c4f[_0x6920('0x2d')][_0x6920('0x41')](_0x6920('0x42'))){_0x2f3b73['limit']=qs[_0x6920('0x10')](_0x2f9c4f[_0x6920('0x2d')][_0x6920('0x10')]);_0x2f3b73[_0x6920('0x13')]=qs[_0x6920('0x13')](_0x2f9c4f[_0x6920('0x2d')][_0x6920('0x13')]);}return _0x4da2be['getAgents'](_0x2f3b73);}})[_0x6920('0x17')](function(_0x27cb3a){if(_0x27cb3a){return _0x27cb3a?{'count':_0x209ad3,'rows':_0x27cb3a}:null;}})['then'](respondWithResult(_0x50fed3,null))['catch'](handleError(_0x50fed3,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e81ca27..dd4869d 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 _0x3369=['FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2a8cf5,_0x26689d){var _0x3850a2=function(_0x3b8c72){while(--_0x3b8c72){_0x2a8cf5['push'](_0x2a8cf5['shift']());}};_0x3850a2(++_0x26689d);}(_0x3369,0x11f));var _0x9336=function(_0x4fbf59,_0x3b946e){_0x4fbf59=_0x4fbf59-0x0;var _0x5601ff=_0x3369[_0x4fbf59];return _0x5601ff;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x9336('0x0'))['db'][_0x9336('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9336('0x2')](0x0);var events={'afterCreate':_0x9336('0x3'),'afterUpdate':_0x9336('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36ff3c){return function(_0x68b92b,_0x44f169,_0x249eb0){FaxQueueEvents['emit'](_0x36ff3c+':'+_0x68b92b['id'],_0x68b92b);FaxQueueEvents[_0x9336('0x5')](_0x36ff3c,_0x68b92b);_0x249eb0(null);};}for(var e in events){if(events[_0x9336('0x6')](e)){var event=events[e];FaxQueue[_0x9336('0x7')](e,emitEvent(event));}}module[_0x9336('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xe038=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue'];(function(_0x4a5600,_0x3cda41){var _0x4d0442=function(_0x3012ae){while(--_0x3012ae){_0x4a5600['push'](_0x4a5600['shift']());}};_0x4d0442(++_0x3cda41);}(_0xe038,0x1aa));var _0x8e03=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xe038[_0x26462c];return _0x509a42;};'use strict';var EventEmitter=require(_0x8e03('0x0'));var FaxQueue=require(_0x8e03('0x1'))['db'][_0x8e03('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8e03('0x3')](0x0);var events={'afterCreate':_0x8e03('0x4'),'afterUpdate':_0x8e03('0x5'),'afterDestroy':_0x8e03('0x6')};function emitEvent(_0x1dd77){return function(_0xd3db8c,_0x12d265,_0x2325cf){FaxQueueEvents[_0x8e03('0x7')](_0x1dd77+':'+_0xd3db8c['id'],_0xd3db8c);FaxQueueEvents[_0x8e03('0x7')](_0x1dd77,_0xd3db8c);_0x2325cf(null);};}for(var e in events){if(events[_0x8e03('0x8')](e)){var event=events[e];FaxQueue[_0x8e03('0x9')](e,emitEvent(event));}}module[_0x8e03('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 39ef6b7..86375f3 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 _0xae4c=['exports','define','FaxQueue','fax_queues','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes'];(function(_0xcb485a,_0x451a51){var _0x27672c=function(_0x5d2323){while(--_0x5d2323){_0xcb485a['push'](_0xcb485a['shift']());}};_0x27672c(++_0x451a51);}(_0xae4c,0x1f0));var _0xcae4=function(_0x15b1cd,_0x2db0c5){_0x15b1cd=_0x15b1cd-0x0;var _0x73f160=_0xae4c[_0x15b1cd];return _0x73f160;};'use strict';var _=require('lodash');var util=require(_0xcae4('0x0'));var logger=require(_0xcae4('0x1'))('api');var moment=require(_0xcae4('0x2'));var BPromise=require(_0xcae4('0x3'));var rp=require(_0xcae4('0x4'));var fs=require('fs');var path=require(_0xcae4('0x5'));var rimraf=require('rimraf');var config=require(_0xcae4('0x6'));var attributes=require(_0xcae4('0x7'));module[_0xcae4('0x8')]=function(_0xbd0cb7,_0x5b9891){return _0xbd0cb7[_0xcae4('0x9')](_0xcae4('0xa'),attributes,{'tableName':_0xcae4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f34=['FaxQueue','fax_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define'];(function(_0x4b87a3,_0x3a698c){var _0x334112=function(_0x3e8fb0){while(--_0x3e8fb0){_0x4b87a3['push'](_0x4b87a3['shift']());}};_0x334112(++_0x3a698c);}(_0x2f34,0x98));var _0x42f3=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x2f34[_0x424a9a];return _0xa7831c;};'use strict';var _=require('lodash');var util=require(_0x42f3('0x0'));var logger=require(_0x42f3('0x1'))('api');var moment=require(_0x42f3('0x2'));var BPromise=require(_0x42f3('0x3'));var rp=require(_0x42f3('0x4'));var fs=require('fs');var path=require(_0x42f3('0x5'));var rimraf=require(_0x42f3('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module['exports']=function(_0x563275,_0x252deb){return _0x563275[_0x42f3('0x7')](_0x42f3('0x8'),attributes,{'tableName':_0x42f3('0x9'),'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 5cd78e9..bdb221d 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 _0x8d58=['FaxQueue','options','raw','where','attributes','limit','include','model','then','ShowFaxQueue','find','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue'];(function(_0x439f80,_0x44e29f){var _0x30e972=function(_0x20d25d){while(--_0x20d25d){_0x439f80['push'](_0x439f80['shift']());}};_0x30e972(++_0x44e29f);}(_0x8d58,0xfc));var _0x88d5=function(_0x28f5f7,_0x52b09c){_0x28f5f7=_0x28f5f7-0x0;var _0x5c7167=_0x8d58[_0x28f5f7];return _0x5c7167;};'use strict';var _=require('lodash');var util=require(_0x88d5('0x0'));var moment=require(_0x88d5('0x1'));var BPromise=require(_0x88d5('0x2'));var rs=require(_0x88d5('0x3'));var fs=require('fs');var Redis=require(_0x88d5('0x4'));var db=require(_0x88d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x88d5('0x6'))('rpc');var config=require(_0x88d5('0x7'));var jayson=require(_0x88d5('0x8'));var client=jayson[_0x88d5('0x9')][_0x88d5('0xa')]({'port':0x232a});config['redis']=_[_0x88d5('0xb')](config[_0x88d5('0xc')],{'host':_0x88d5('0xd'),'port':0x18eb});var socket=require(_0x88d5('0xe'))(new Redis(config[_0x88d5('0xc')]));require(_0x88d5('0xf'))[_0x88d5('0x10')](socket);function respondWithRpcPromise(_0x1ed8b0,_0x987f27,_0x31a586){return new BPromise(function(_0x18532c,_0x5b5b4c){return client['request'](_0x1ed8b0,_0x31a586)['then'](function(_0x4479a4){logger['info'](_0x88d5('0x11'),_0x987f27,'request\x20sent');logger[_0x88d5('0x12')](_0x88d5('0x13'),_0x987f27,'request\x20sent',JSON[_0x88d5('0x14')](_0x4479a4));if(_0x4479a4['error']){if(_0x4479a4[_0x88d5('0x15')][_0x88d5('0x16')]===0x1f4){logger['error'](_0x88d5('0x11'),_0x987f27,_0x4479a4[_0x88d5('0x15')][_0x88d5('0x17')]);return _0x5b5b4c(_0x4479a4[_0x88d5('0x15')]['message']);}logger[_0x88d5('0x15')](_0x88d5('0x11'),_0x987f27,_0x4479a4[_0x88d5('0x15')][_0x88d5('0x17')]);return _0x18532c(_0x4479a4[_0x88d5('0x15')]['message']);}else{logger[_0x88d5('0x18')](_0x88d5('0x11'),_0x987f27,'request\x20sent');_0x18532c(_0x4479a4[_0x88d5('0x19')][_0x88d5('0x17')]);}})[_0x88d5('0x1a')](function(_0x500c9c){logger[_0x88d5('0x15')](_0x88d5('0x11'),_0x987f27,_0x500c9c);_0x5b5b4c(_0x500c9c);});});}exports[_0x88d5('0x1b')]=function(_0x47ddd9){var _0x196730=this;return new Promise(function(_0x2e6282,_0x4315c3){return db[_0x88d5('0x1c')]['findAll']({'raw':_0x47ddd9[_0x88d5('0x1d')]?_0x47ddd9[_0x88d5('0x1d')][_0x88d5('0x1e')]===undefined?!![]:![]:!![],'where':_0x47ddd9[_0x88d5('0x1d')]?_0x47ddd9[_0x88d5('0x1d')][_0x88d5('0x1f')]||null:null,'attributes':_0x47ddd9['options']?_0x47ddd9[_0x88d5('0x1d')][_0x88d5('0x20')]||null:null,'limit':_0x47ddd9[_0x88d5('0x1d')]?_0x47ddd9[_0x88d5('0x1d')][_0x88d5('0x21')]||null:null,'include':_0x47ddd9['options']?_0x47ddd9['options'][_0x88d5('0x22')]?_['map'](_0x47ddd9[_0x88d5('0x1d')][_0x88d5('0x22')],function(_0x504f2c){return{'model':db[_0x504f2c[_0x88d5('0x23')]],'as':_0x504f2c['as'],'attributes':_0x504f2c['attributes'],'include':_0x504f2c[_0x88d5('0x22')]?_['map'](_0x504f2c[_0x88d5('0x22')],function(_0x5b236b){return{'model':db[_0x5b236b['model']],'as':_0x5b236b['as'],'attributes':_0x5b236b[_0x88d5('0x20')],'include':_0x5b236b[_0x88d5('0x22')]?_['map'](_0x5b236b[_0x88d5('0x22')],function(_0x13b93e){return{'model':db[_0x13b93e[_0x88d5('0x23')]],'as':_0x13b93e['as'],'attributes':_0x13b93e['attributes']};}):[]};}):[]};}):[]:[]})[_0x88d5('0x24')](function(_0x1c0bcb){logger[_0x88d5('0x18')]('GetFaxQueue',_0x47ddd9);logger[_0x88d5('0x12')](_0x88d5('0x1b'),_0x47ddd9,JSON[_0x88d5('0x14')](_0x1c0bcb));_0x2e6282(_0x1c0bcb);})[_0x88d5('0x1a')](function(_0x25c0c4){logger[_0x88d5('0x15')](_0x88d5('0x1b'),_0x25c0c4[_0x88d5('0x17')],_0x47ddd9);_0x4315c3(_0x196730[_0x88d5('0x15')](0x1f4,_0x25c0c4[_0x88d5('0x17')]));});});};exports[_0x88d5('0x25')]=function(_0x3ac63b){var _0x30131f=this;return new Promise(function(_0xa7238b,_0x574484){return db[_0x88d5('0x1c')][_0x88d5('0x26')]({'raw':_0x3ac63b['options']?_0x3ac63b[_0x88d5('0x1d')][_0x88d5('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ac63b['options']?_0x3ac63b[_0x88d5('0x1d')][_0x88d5('0x1f')]||null:null,'attributes':_0x3ac63b[_0x88d5('0x1d')]?_0x3ac63b[_0x88d5('0x1d')][_0x88d5('0x20')]||null:null,'include':_0x3ac63b[_0x88d5('0x1d')]?_0x3ac63b['options'][_0x88d5('0x22')]?_['map'](_0x3ac63b[_0x88d5('0x1d')][_0x88d5('0x22')],function(_0x414c5d){return{'model':db[_0x414c5d['model']],'as':_0x414c5d['as'],'attributes':_0x414c5d[_0x88d5('0x20')],'include':_0x414c5d['include']?_['map'](_0x414c5d[_0x88d5('0x22')],function(_0x3f0c4a){return{'model':db[_0x3f0c4a[_0x88d5('0x23')]],'as':_0x3f0c4a['as'],'attributes':_0x3f0c4a[_0x88d5('0x20')],'include':_0x3f0c4a[_0x88d5('0x22')]?_[_0x88d5('0x27')](_0x3f0c4a['include'],function(_0x35049d){return{'model':db[_0x35049d[_0x88d5('0x23')]],'as':_0x35049d['as'],'attributes':_0x35049d['attributes']};}):[]};}):[]};}):[]:[]})[_0x88d5('0x24')](function(_0x2778a3){logger['info']('ShowFaxQueue',_0x3ac63b);logger[_0x88d5('0x12')]('ShowFaxQueue',_0x3ac63b,JSON[_0x88d5('0x14')](_0x2778a3));_0xa7238b(_0x2778a3);})[_0x88d5('0x1a')](function(_0x3c4df5){logger['error']('ShowFaxQueue',_0x3c4df5[_0x88d5('0x17')],_0x3ac63b);_0x574484(_0x30131f[_0x88d5('0x15')](0x1f4,_0x3c4df5['message']));});});}; \ No newline at end of file +var _0x1ed4=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','message','error','result','GetFaxQueue','options','raw','where','limit','include','attributes','map','model','catch','ShowFaxQueue','FaxQueue','find','util','moment','bluebird','randomstring'];(function(_0x44cca6,_0x5e9271){var _0x175d04=function(_0x26d9e4){while(--_0x26d9e4){_0x44cca6['push'](_0x44cca6['shift']());}};_0x175d04(++_0x5e9271);}(_0x1ed4,0x106));var _0x41ed=function(_0x2c633,_0xf0ef8){_0x2c633=_0x2c633-0x0;var _0x24af40=_0x1ed4[_0x2c633];return _0x24af40;};'use strict';var _=require('lodash');var util=require(_0x41ed('0x0'));var moment=require(_0x41ed('0x1'));var BPromise=require(_0x41ed('0x2'));var rs=require(_0x41ed('0x3'));var fs=require('fs');var Redis=require(_0x41ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x41ed('0x5'));var logger=require(_0x41ed('0x6'))(_0x41ed('0x7'));var config=require(_0x41ed('0x8'));var jayson=require(_0x41ed('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x41ed('0xa')](config[_0x41ed('0xb')],{'host':_0x41ed('0xc'),'port':0x18eb});var socket=require(_0x41ed('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x315621,_0x58aadd,_0x308cef){return new BPromise(function(_0x13e162,_0x398e58){return client[_0x41ed('0xe')](_0x315621,_0x308cef)[_0x41ed('0xf')](function(_0x31d206){logger[_0x41ed('0x10')](_0x41ed('0x11'),_0x58aadd,_0x41ed('0x12'));logger[_0x41ed('0x13')](_0x41ed('0x14'),_0x58aadd,'request\x20sent',JSON[_0x41ed('0x15')](_0x31d206));if(_0x31d206['error']){if(_0x31d206['error']['code']===0x1f4){logger['error'](_0x41ed('0x11'),_0x58aadd,_0x31d206['error'][_0x41ed('0x16')]);return _0x398e58(_0x31d206[_0x41ed('0x17')]['message']);}logger[_0x41ed('0x17')](_0x41ed('0x11'),_0x58aadd,_0x31d206[_0x41ed('0x17')][_0x41ed('0x16')]);return _0x13e162(_0x31d206[_0x41ed('0x17')][_0x41ed('0x16')]);}else{logger[_0x41ed('0x10')]('FaxQueue,\x20%s,\x20%s',_0x58aadd,'request\x20sent');_0x13e162(_0x31d206[_0x41ed('0x18')][_0x41ed('0x16')]);}})['catch'](function(_0x415bbe){logger['error'](_0x41ed('0x11'),_0x58aadd,_0x415bbe);_0x398e58(_0x415bbe);});});}exports[_0x41ed('0x19')]=function(_0x56e971){var _0x34c041=this;return new Promise(function(_0x8364ed,_0x212a57){return db['FaxQueue']['findAll']({'raw':_0x56e971[_0x41ed('0x1a')]?_0x56e971['options'][_0x41ed('0x1b')]===undefined?!![]:![]:!![],'where':_0x56e971[_0x41ed('0x1a')]?_0x56e971[_0x41ed('0x1a')][_0x41ed('0x1c')]||null:null,'attributes':_0x56e971[_0x41ed('0x1a')]?_0x56e971[_0x41ed('0x1a')]['attributes']||null:null,'limit':_0x56e971[_0x41ed('0x1a')]?_0x56e971[_0x41ed('0x1a')][_0x41ed('0x1d')]||null:null,'include':_0x56e971[_0x41ed('0x1a')]?_0x56e971['options'][_0x41ed('0x1e')]?_['map'](_0x56e971[_0x41ed('0x1a')][_0x41ed('0x1e')],function(_0x1c88b3){return{'model':db[_0x1c88b3['model']],'as':_0x1c88b3['as'],'attributes':_0x1c88b3[_0x41ed('0x1f')],'include':_0x1c88b3[_0x41ed('0x1e')]?_[_0x41ed('0x20')](_0x1c88b3[_0x41ed('0x1e')],function(_0x5672f4){return{'model':db[_0x5672f4[_0x41ed('0x21')]],'as':_0x5672f4['as'],'attributes':_0x5672f4[_0x41ed('0x1f')],'include':_0x5672f4['include']?_[_0x41ed('0x20')](_0x5672f4['include'],function(_0x3202f9){return{'model':db[_0x3202f9[_0x41ed('0x21')]],'as':_0x3202f9['as'],'attributes':_0x3202f9[_0x41ed('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x41ed('0xf')](function(_0x21beb7){logger[_0x41ed('0x10')]('GetFaxQueue',_0x56e971);logger['debug'](_0x41ed('0x19'),_0x56e971,JSON[_0x41ed('0x15')](_0x21beb7));_0x8364ed(_0x21beb7);})[_0x41ed('0x22')](function(_0x72a398){logger['error'](_0x41ed('0x19'),_0x72a398[_0x41ed('0x16')],_0x56e971);_0x212a57(_0x34c041[_0x41ed('0x17')](0x1f4,_0x72a398[_0x41ed('0x16')]));});});};exports[_0x41ed('0x23')]=function(_0x5d6d5e){var _0x85e9db=this;return new Promise(function(_0xc0309e,_0x3313f7){return db[_0x41ed('0x24')][_0x41ed('0x25')]({'raw':_0x5d6d5e[_0x41ed('0x1a')]?_0x5d6d5e['options'][_0x41ed('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d6d5e['options']?_0x5d6d5e['options'][_0x41ed('0x1c')]||null:null,'attributes':_0x5d6d5e[_0x41ed('0x1a')]?_0x5d6d5e[_0x41ed('0x1a')][_0x41ed('0x1f')]||null:null,'include':_0x5d6d5e[_0x41ed('0x1a')]?_0x5d6d5e['options'][_0x41ed('0x1e')]?_[_0x41ed('0x20')](_0x5d6d5e[_0x41ed('0x1a')][_0x41ed('0x1e')],function(_0x34f839){return{'model':db[_0x34f839[_0x41ed('0x21')]],'as':_0x34f839['as'],'attributes':_0x34f839['attributes'],'include':_0x34f839['include']?_[_0x41ed('0x20')](_0x34f839[_0x41ed('0x1e')],function(_0x2abba8){return{'model':db[_0x2abba8[_0x41ed('0x21')]],'as':_0x2abba8['as'],'attributes':_0x2abba8[_0x41ed('0x1f')],'include':_0x2abba8[_0x41ed('0x1e')]?_['map'](_0x2abba8[_0x41ed('0x1e')],function(_0x25f078){return{'model':db[_0x25f078['model']],'as':_0x25f078['as'],'attributes':_0x25f078['attributes']};}):[]};}):[]};}):[]:[]})[_0x41ed('0xf')](function(_0x55fc4a){logger['info'](_0x41ed('0x23'),_0x5d6d5e);logger[_0x41ed('0x13')](_0x41ed('0x23'),_0x5d6d5e,JSON[_0x41ed('0x15')](_0x55fc4a));_0xc0309e(_0x55fc4a);})[_0x41ed('0x22')](function(_0x2cdecf){logger[_0x41ed('0x17')]('ShowFaxQueue',_0x2cdecf['message'],_0x5d6d5e);_0x3313f7(_0x85e9db['error'](0x1f4,_0x2cdecf[_0x41ed('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ebecf5d..62a345d 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 _0xdb63=['remove','emit','removeListener','register','save'];(function(_0x25d9b0,_0x553c88){var _0x51e67d=function(_0x46790f){while(--_0x46790f){_0x25d9b0['push'](_0x25d9b0['shift']());}};_0x51e67d(++_0x553c88);}(_0xdb63,0x18a));var _0x3db6=function(_0x1995f4,_0x506388){_0x1995f4=_0x1995f4-0x0;var _0x440044=_0xdb63[_0x1995f4];return _0x440044;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x3db6('0x0'),_0x3db6('0x1'),'update'];function createListener(_0x366b09,_0x7e0f94){return function(_0x448a6a){_0x7e0f94[_0x3db6('0x2')](_0x366b09,_0x448a6a);};}function removeListener(_0x5211ed,_0x266108){return function(){FaxQueueEvents[_0x3db6('0x3')](_0x5211ed,_0x266108);};}exports[_0x3db6('0x4')]=function(_0x167829){for(var _0x524ba1=0x0,_0x41f5d2=events['length'];_0x524ba1<_0x41f5d2;_0x524ba1++){var _0x488f3f=events[_0x524ba1];var _0x1540cb=createListener('faxQueue:'+_0x488f3f,_0x167829);FaxQueueEvents['on'](_0x488f3f,_0x1540cb);}}; \ No newline at end of file +var _0xd4e5=['removeListener','register','length','faxQueue:','save','emit'];(function(_0x21dfef,_0x531dbc){var _0x198192=function(_0x23679c){while(--_0x23679c){_0x21dfef['push'](_0x21dfef['shift']());}};_0x198192(++_0x531dbc);}(_0xd4e5,0x1ae));var _0x5d4e=function(_0x5da63b,_0x1f465f){_0x5da63b=_0x5da63b-0x0;var _0x18d1de=_0xd4e5[_0x5da63b];return _0x18d1de;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5d4e('0x0'),'remove','update'];function createListener(_0x102f8d,_0x47e507){return function(_0x3bee1d){_0x47e507[_0x5d4e('0x1')](_0x102f8d,_0x3bee1d);};}function removeListener(_0x4d6829,_0x33a86f){return function(){FaxQueueEvents[_0x5d4e('0x2')](_0x4d6829,_0x33a86f);};}exports[_0x5d4e('0x3')]=function(_0x19c005){for(var _0x374a6b=0x0,_0x560826=events[_0x5d4e('0x4')];_0x374a6b<_0x560826;_0x374a6b++){var _0x95a0d9=events[_0x374a6b];var _0x4c3146=createListener(_0x5d4e('0x5')+_0x95a0d9,_0x19c005);FaxQueueEvents['on'](_0x95a0d9,_0x4c3146);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 0063e7d..94f5a99 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 _0x5430=['addAgents','put','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x6a2530,_0x5cb00e){var _0x398568=function(_0x265cbb){while(--_0x265cbb){_0x6a2530['push'](_0x6a2530['shift']());}};_0x398568(++_0x5cb00e);}(_0x5430,0x10c));var _0x0543=function(_0x3976f6,_0x34e018){_0x3976f6=_0x3976f6-0x0;var _0x7c1281=_0x5430[_0x3976f6];return _0x7c1281;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0x7')]('/:id/members',auth[_0x0543('0x8')](),controller[_0x0543('0xe')]);router['get'](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x10')]);router[_0x0543('0x7')](_0x0543('0x11'),auth[_0x0543('0x8')](),controller[_0x0543('0x12')]);router[_0x0543('0x13')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x14')]);router[_0x0543('0x13')](_0x0543('0xf'),auth['isAuthenticated'](),controller[_0x0543('0x15')]);router[_0x0543('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x0543('0x16')]);router[_0x0543('0x17')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0x18')]);router['delete'](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0x19')]);router[_0x0543('0x1a')](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x1b')]);router['delete'](_0x0543('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x0543('0x1c')]=router; \ No newline at end of file +var _0x33af=['destroy','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','/:id/users','post','/:id/teams','addTeams','addAgents','put','delete','/:id'];(function(_0x189a9a,_0x18427f){var _0x27a739=function(_0x2e3292){while(--_0x2e3292){_0x189a9a['push'](_0x189a9a['shift']());}};_0x27a739(++_0x18427f);}(_0x33af,0xec));var _0xf33a=function(_0xb36843,_0x57c1f4){_0xb36843=_0xb36843-0x0;var _0x227b83=_0x33af[_0xb36843];return _0x227b83;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/teams',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x12')]('/',auth[_0xf33a('0xb')](),controller['create']);router['post'](_0xf33a('0x13'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x12')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x16')]('/:id',auth[_0xf33a('0xb')](),controller['update']);router[_0xf33a('0x17')](_0xf33a('0x18'),auth['isAuthenticated'](),controller[_0xf33a('0x19')]);router[_0xf33a('0x17')]('/:id/teams',auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x17')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x1b')]);module[_0xf33a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 21be0ff..f135d0f 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 _0x368c=['moment','sequelize','STRING','DATE'];(function(_0x5a1e4f,_0x3b08eb){var _0x3df72c=function(_0x4c41d8){while(--_0x4c41d8){_0x5a1e4f['push'](_0x5a1e4f['shift']());}};_0x3df72c(++_0x3b08eb);}(_0x368c,0x1b4));var _0xc368=function(_0x33cf1f,_0xe6764a){_0x33cf1f=_0x33cf1f-0x0;var _0x538ffc=_0x368c[_0x33cf1f];return _0x538ffc;};'use strict';var moment=require(_0xc368('0x0'));var Sequelize=require(_0xc368('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc368('0x2')]},'joinAt':{'type':Sequelize[_0xc368('0x3')]},'leaveAt':{'type':Sequelize[_0xc368('0x3')]},'acceptAt':{'type':Sequelize[_0xc368('0x3')]},'exitAt':{'type':Sequelize[_0xc368('0x3')]},'reason':{'type':Sequelize[_0xc368('0x2')]}}; \ No newline at end of file +var _0x3ee0=['sequelize','exports','STRING','DATE','moment'];(function(_0x265abf,_0x181e43){var _0x4dd0e4=function(_0x2de248){while(--_0x2de248){_0x265abf['push'](_0x265abf['shift']());}};_0x4dd0e4(++_0x181e43);}(_0x3ee0,0x12b));var _0x03ee=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3ee0[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x03ee('0x0'));var Sequelize=require(_0x03ee('0x1'));module[_0x03ee('0x2')]={'uniqueid':{'type':Sequelize[_0x03ee('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x03ee('0x4')]},'leaveAt':{'type':Sequelize[_0x03ee('0x4')]},'acceptAt':{'type':Sequelize[_0x03ee('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x03ee('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index eeea5a6..d0eb0a6 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 _0xdb13=['query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueueReport','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','fieldName','type','key','model','keys'];(function(_0x331615,_0x13aebd){var _0x4ba773=function(_0x577243){while(--_0x577243){_0x331615['push'](_0x331615['shift']());}};_0x4ba773(++_0x13aebd);}(_0xdb13,0x10c));var _0x3db1=function(_0x22a551,_0x3f9b81){_0x22a551=_0x22a551-0x0;var _0xe956be=_0xdb13[_0x22a551];return _0xe956be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3db1('0x0'));var zipdir=require(_0x3db1('0x1'));var jsonpatch=require(_0x3db1('0x2'));var rp=require(_0x3db1('0x3'));var moment=require(_0x3db1('0x4'));var BPromise=require(_0x3db1('0x5'));var Mustache=require('mustache');var util=require(_0x3db1('0x6'));var path=require(_0x3db1('0x7'));var sox=require(_0x3db1('0x8'));var csv=require(_0x3db1('0x9'));var ejs=require(_0x3db1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3db1('0xb'));var squel=require(_0x3db1('0xc'));var crypto=require(_0x3db1('0xd'));var jsforce=require(_0x3db1('0xe'));var deskjs=require(_0x3db1('0xf'));var toCsv=require(_0x3db1('0x9'));var querystring=require(_0x3db1('0x10'));var Papa=require(_0x3db1('0x11'));var Redis=require(_0x3db1('0x12'));var authService=require(_0x3db1('0x13'));var qs=require(_0x3db1('0x14'));var as=require(_0x3db1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3db1('0x16'))(_0x3db1('0x17'));var utils=require(_0x3db1('0x18'));var config=require(_0x3db1('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13d3cd,_0x12a973){_0x12a973=_0x12a973||0xcc;return function(_0x35954c){if(_0x35954c){return _0x13d3cd[_0x3db1('0x1a')](_0x12a973);}return _0x13d3cd[_0x3db1('0x1b')](_0x12a973)['end']();};}function respondWithResult(_0x59667f,_0x528650){_0x528650=_0x528650||0xc8;return function(_0x5f1633){if(_0x5f1633){return _0x59667f[_0x3db1('0x1b')](_0x528650)[_0x3db1('0x1c')](_0x5f1633);}};}function respondWithFilteredResult(_0x10be63,_0x2b4038){return function(_0xe390b3){if(_0xe390b3){var _0x24d8d6=typeof _0x2b4038['offset']===_0x3db1('0x1d')&&typeof _0x2b4038[_0x3db1('0x1e')]==='undefined';var _0x2d76e9=_0xe390b3[_0x3db1('0x1f')];var _0x549a0e=_0x24d8d6?0x0:_0x2b4038[_0x3db1('0x20')];var _0x5f3203=_0x24d8d6?_0xe390b3[_0x3db1('0x1f')]:_0x2b4038[_0x3db1('0x20')]+_0x2b4038[_0x3db1('0x1e')];var _0x435a76;if(_0x5f3203>=_0x2d76e9){_0x5f3203=_0x2d76e9;_0x435a76=0xc8;}else{_0x435a76=0xce;}_0x10be63['status'](_0x435a76);return _0x10be63[_0x3db1('0x21')](_0x3db1('0x22'),_0x549a0e+'-'+_0x5f3203+'/'+_0x2d76e9)[_0x3db1('0x1c')](_0xe390b3);}return null;};}function patchUpdates(_0x5ae404){return function(_0x365d65){try{jsonpatch[_0x3db1('0x23')](_0x365d65,_0x5ae404,!![]);}catch(_0x3eeca8){return BPromise[_0x3db1('0x24')](_0x3eeca8);}return _0x365d65[_0x3db1('0x25')]();};}function saveUpdates(_0x347555,_0x12f970){return function(_0x3a84aa){if(_0x3a84aa){return _0x3a84aa[_0x3db1('0x26')](_0x347555)[_0x3db1('0x27')](function(_0x3ad8f6){return _0x3ad8f6;});}return null;};}function removeEntity(_0x1ae9af,_0x1ee0c6){return function(_0x47c187){if(_0x47c187){return _0x47c187[_0x3db1('0x28')]()['then'](function(){_0x1ae9af[_0x3db1('0x1b')](0xcc)[_0x3db1('0x29')]();});}};}function handleEntityNotFound(_0x2263c6,_0x58b990){return function(_0x218f71){if(!_0x218f71){_0x2263c6[_0x3db1('0x1a')](0x194);}return _0x218f71;};}function handleError(_0x9792ff,_0x8ba38c){_0x8ba38c=_0x8ba38c||0x1f4;return function(_0x5bd826){logger[_0x3db1('0x2a')](_0x5bd826[_0x3db1('0x2b')]);if(_0x5bd826['name']){delete _0x5bd826[_0x3db1('0x2c')];}_0x9792ff[_0x3db1('0x1b')](_0x8ba38c)[_0x3db1('0x2d')](_0x5bd826);};}exports['index']=function(_0x2d139d,_0x226846){var _0x4164eb={},_0x51ec2f={},_0x4d0572={'count':0x0,'rows':[]};var _0xa731b3=_[_0x3db1('0x2e')](db['FaxQueueReport']['rawAttributes'],function(_0x2d8930){return{'name':_0x2d8930[_0x3db1('0x2f')],'type':_0x2d8930[_0x3db1('0x30')][_0x3db1('0x31')]};});_0x51ec2f[_0x3db1('0x32')]=_[_0x3db1('0x2e')](_0xa731b3,_0x3db1('0x2c'));_0x51ec2f['query']=_[_0x3db1('0x33')](_0x2d139d[_0x3db1('0x34')]);_0x51ec2f[_0x3db1('0x35')]=_[_0x3db1('0x36')](_0x51ec2f[_0x3db1('0x32')],_0x51ec2f[_0x3db1('0x34')]);_0x4164eb[_0x3db1('0x37')]=_[_0x3db1('0x36')](_0x51ec2f[_0x3db1('0x32')],qs['fields'](_0x2d139d[_0x3db1('0x34')]['fields']));_0x4164eb['attributes']=_0x4164eb[_0x3db1('0x37')]['length']?_0x4164eb[_0x3db1('0x37')]:_0x51ec2f['model'];if(!_0x2d139d[_0x3db1('0x34')][_0x3db1('0x38')](_0x3db1('0x39'))){_0x4164eb['limit']=qs['limit'](_0x2d139d['query'][_0x3db1('0x1e')]);_0x4164eb[_0x3db1('0x20')]=qs[_0x3db1('0x20')](_0x2d139d[_0x3db1('0x34')]['offset']);}_0x4164eb[_0x3db1('0x3a')]=qs[_0x3db1('0x3b')](_0x2d139d[_0x3db1('0x34')][_0x3db1('0x3b')]);_0x4164eb[_0x3db1('0x3c')]=qs[_0x3db1('0x35')](_[_0x3db1('0x3d')](_0x2d139d['query'],_0x51ec2f['filters']),_0xa731b3);if(_0x2d139d[_0x3db1('0x34')][_0x3db1('0x3e')]){_0x4164eb[_0x3db1('0x3c')]=_[_0x3db1('0x3f')](_0x4164eb[_0x3db1('0x3c')],{'$or':_['map'](_0xa731b3,function(_0x48fb83){if(_0x48fb83[_0x3db1('0x30')]!==_0x3db1('0x40')){var _0x3d0f20={};_0x3d0f20[_0x48fb83[_0x3db1('0x2c')]]={'$like':'%'+_0x2d139d['query'][_0x3db1('0x3e')]+'%'};return _0x3d0f20;}})});}_0x4164eb=_[_0x3db1('0x3f')]({},_0x4164eb,_0x2d139d[_0x3db1('0x41')]);var _0x594910={'where':_0x4164eb['where']};return db[_0x3db1('0x42')][_0x3db1('0x1f')](_0x594910)[_0x3db1('0x27')](function(_0x4da38d){_0x4d0572['count']=_0x4da38d;if(_0x2d139d[_0x3db1('0x34')][_0x3db1('0x43')]){_0x4164eb['include']=[{'all':!![]}];}return db[_0x3db1('0x42')][_0x3db1('0x44')](_0x4164eb);})[_0x3db1('0x27')](function(_0x511527){_0x4d0572[_0x3db1('0x45')]=_0x511527;return _0x4d0572;})['then'](respondWithFilteredResult(_0x226846,_0x4164eb))[_0x3db1('0x46')](handleError(_0x226846,null));};exports[_0x3db1('0x47')]=function(_0x405eba,_0x414269){var _0x1bd8c1={'raw':!![],'where':{'id':_0x405eba[_0x3db1('0x48')]['id']}},_0x432804={};_0x432804[_0x3db1('0x32')]=_[_0x3db1('0x33')](db[_0x3db1('0x42')][_0x3db1('0x49')]);_0x432804[_0x3db1('0x34')]=_[_0x3db1('0x33')](_0x405eba[_0x3db1('0x34')]);_0x432804[_0x3db1('0x35')]=_['intersection'](_0x432804[_0x3db1('0x32')],_0x432804[_0x3db1('0x34')]);_0x1bd8c1[_0x3db1('0x37')]=_[_0x3db1('0x36')](_0x432804['model'],qs['fields'](_0x405eba[_0x3db1('0x34')][_0x3db1('0x4a')]));_0x1bd8c1[_0x3db1('0x37')]=_0x1bd8c1[_0x3db1('0x37')]['length']?_0x1bd8c1[_0x3db1('0x37')]:_0x432804['model'];if(_0x405eba[_0x3db1('0x34')]['includeAll']){_0x1bd8c1[_0x3db1('0x4b')]=[{'all':!![]}];}_0x1bd8c1=_[_0x3db1('0x3f')]({},_0x1bd8c1,_0x405eba['options']);return db[_0x3db1('0x42')][_0x3db1('0x4c')](_0x1bd8c1)[_0x3db1('0x27')](handleEntityNotFound(_0x414269,null))[_0x3db1('0x27')](respondWithResult(_0x414269,null))[_0x3db1('0x46')](handleError(_0x414269,null));};exports[_0x3db1('0x4d')]=function(_0x45682a,_0x2c0946){return db[_0x3db1('0x42')]['create'](_0x45682a[_0x3db1('0x4e')],{})['then'](respondWithResult(_0x2c0946,0xc9))[_0x3db1('0x46')](handleError(_0x2c0946,null));};exports[_0x3db1('0x26')]=function(_0xb34b3e,_0x5c7c6a){if(_0xb34b3e[_0x3db1('0x4e')]['id']){delete _0xb34b3e['body']['id'];}return db[_0x3db1('0x42')][_0x3db1('0x4c')]({'where':{'id':_0xb34b3e[_0x3db1('0x48')]['id']}})[_0x3db1('0x27')](handleEntityNotFound(_0x5c7c6a,null))[_0x3db1('0x27')](saveUpdates(_0xb34b3e[_0x3db1('0x4e')],null))[_0x3db1('0x27')](respondWithResult(_0x5c7c6a,null))['catch'](handleError(_0x5c7c6a,null));};exports[_0x3db1('0x28')]=function(_0x2e60a0,_0x2c7e97){return db[_0x3db1('0x42')]['find']({'where':{'id':_0x2e60a0[_0x3db1('0x48')]['id']}})[_0x3db1('0x27')](handleEntityNotFound(_0x2c7e97,null))['then'](removeEntity(_0x2c7e97,null))[_0x3db1('0x46')](handleError(_0x2c7e97,null));};exports[_0x3db1('0x4f')]=function(_0x3675fa,_0x27cf50){return db[_0x3db1('0x42')][_0x3db1('0x4f')]()[_0x3db1('0x27')](respondWithResult(_0x27cf50,null))[_0x3db1('0x46')](handleError(_0x27cf50,null));}; \ No newline at end of file +var _0xb821=['filter','where','merge','VIRTUAL','options','include','findAll','show','keys','includeAll','find','catch','body','update','describe','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb821,0xa7));var _0x1b82=function(_0x4f8165,_0x300e3e){_0x4f8165=_0x4f8165-0x0;var _0x3013c1=_0xb821[_0x4f8165];return _0x3013c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];function respondWithStatusCode(_0x241d11,_0x2391f5){_0x2391f5=_0x2391f5||0xcc;return function(_0x61b6eb){if(_0x61b6eb){return _0x241d11['sendStatus'](_0x2391f5);}return _0x241d11[_0x1b82('0x18')](_0x2391f5)['end']();};}function respondWithResult(_0x54915f,_0x1e553a){_0x1e553a=_0x1e553a||0xc8;return function(_0x4bf75b){if(_0x4bf75b){return _0x54915f[_0x1b82('0x18')](_0x1e553a)[_0x1b82('0x19')](_0x4bf75b);}};}function respondWithFilteredResult(_0x5d4cf1,_0x46c2cf){return function(_0x5dab7d){if(_0x5dab7d){var _0x563261=typeof _0x46c2cf[_0x1b82('0x1a')]==='undefined'&&typeof _0x46c2cf[_0x1b82('0x1b')]===_0x1b82('0x1c');var _0xf42818=_0x5dab7d['count'];var _0x514082=_0x563261?0x0:_0x46c2cf[_0x1b82('0x1a')];var _0x5d66c3=_0x563261?_0x5dab7d[_0x1b82('0x1d')]:_0x46c2cf[_0x1b82('0x1a')]+_0x46c2cf[_0x1b82('0x1b')];var _0x594a63;if(_0x5d66c3>=_0xf42818){_0x5d66c3=_0xf42818;_0x594a63=0xc8;}else{_0x594a63=0xce;}_0x5d4cf1[_0x1b82('0x18')](_0x594a63);return _0x5d4cf1[_0x1b82('0x1e')](_0x1b82('0x1f'),_0x514082+'-'+_0x5d66c3+'/'+_0xf42818)[_0x1b82('0x19')](_0x5dab7d);}return null;};}function patchUpdates(_0x10d45c){return function(_0x47e99b){try{jsonpatch[_0x1b82('0x20')](_0x47e99b,_0x10d45c,!![]);}catch(_0x1892b0){return BPromise[_0x1b82('0x21')](_0x1892b0);}return _0x47e99b[_0x1b82('0x22')]();};}function saveUpdates(_0x26e481,_0x31fd64){return function(_0x2d07f4){if(_0x2d07f4){return _0x2d07f4['update'](_0x26e481)[_0x1b82('0x23')](function(_0x233740){return _0x233740;});}return null;};}function removeEntity(_0x5b8d09,_0x561d78){return function(_0x225b81){if(_0x225b81){return _0x225b81[_0x1b82('0x24')]()['then'](function(){_0x5b8d09[_0x1b82('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd458,_0x5f556b){return function(_0xf2e556){if(!_0xf2e556){_0x5cd458[_0x1b82('0x25')](0x194);}return _0xf2e556;};}function handleError(_0xfd00d1,_0x257b79){_0x257b79=_0x257b79||0x1f4;return function(_0x548a3b){logger[_0x1b82('0x26')](_0x548a3b[_0x1b82('0x27')]);if(_0x548a3b[_0x1b82('0x28')]){delete _0x548a3b[_0x1b82('0x28')];}_0xfd00d1[_0x1b82('0x18')](_0x257b79)[_0x1b82('0x29')](_0x548a3b);};}exports[_0x1b82('0x2a')]=function(_0x21ea34,_0x39641a){var _0x1f9c6b={},_0x2fe45d={},_0x37275f={'count':0x0,'rows':[]};var _0x466441=_['map'](db[_0x1b82('0x2b')][_0x1b82('0x2c')],function(_0x155a34){return{'name':_0x155a34[_0x1b82('0x2d')],'type':_0x155a34[_0x1b82('0x2e')][_0x1b82('0x2f')]};});_0x2fe45d[_0x1b82('0x30')]=_[_0x1b82('0x31')](_0x466441,_0x1b82('0x28'));_0x2fe45d[_0x1b82('0x32')]=_['keys'](_0x21ea34[_0x1b82('0x32')]);_0x2fe45d[_0x1b82('0x33')]=_[_0x1b82('0x34')](_0x2fe45d[_0x1b82('0x30')],_0x2fe45d['query']);_0x1f9c6b[_0x1b82('0x35')]=_[_0x1b82('0x34')](_0x2fe45d['model'],qs[_0x1b82('0x36')](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x36')]));_0x1f9c6b['attributes']=_0x1f9c6b['attributes'][_0x1b82('0x37')]?_0x1f9c6b['attributes']:_0x2fe45d['model'];if(!_0x21ea34[_0x1b82('0x32')][_0x1b82('0x38')](_0x1b82('0x39'))){_0x1f9c6b['limit']=qs[_0x1b82('0x1b')](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x1b')]);_0x1f9c6b[_0x1b82('0x1a')]=qs['offset'](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x1a')]);}_0x1f9c6b[_0x1b82('0x3a')]=qs['sort'](_0x21ea34['query'][_0x1b82('0x3b')]);_0x1f9c6b['where']=qs[_0x1b82('0x33')](_[_0x1b82('0x3c')](_0x21ea34[_0x1b82('0x32')],_0x2fe45d[_0x1b82('0x33')]),_0x466441);if(_0x21ea34[_0x1b82('0x32')][_0x1b82('0x3d')]){_0x1f9c6b[_0x1b82('0x3e')]=_[_0x1b82('0x3f')](_0x1f9c6b['where'],{'$or':_['map'](_0x466441,function(_0x18b624){if(_0x18b624['type']!==_0x1b82('0x40')){var _0x592449={};_0x592449[_0x18b624[_0x1b82('0x28')]]={'$like':'%'+_0x21ea34[_0x1b82('0x32')][_0x1b82('0x3d')]+'%'};return _0x592449;}})});}_0x1f9c6b=_[_0x1b82('0x3f')]({},_0x1f9c6b,_0x21ea34[_0x1b82('0x41')]);var _0x202bb4={'where':_0x1f9c6b['where']};return db[_0x1b82('0x2b')]['count'](_0x202bb4)[_0x1b82('0x23')](function(_0x4e5659){_0x37275f[_0x1b82('0x1d')]=_0x4e5659;if(_0x21ea34['query']['includeAll']){_0x1f9c6b[_0x1b82('0x42')]=[{'all':!![]}];}return db[_0x1b82('0x2b')][_0x1b82('0x43')](_0x1f9c6b);})[_0x1b82('0x23')](function(_0x3eb429){_0x37275f['rows']=_0x3eb429;return _0x37275f;})[_0x1b82('0x23')](respondWithFilteredResult(_0x39641a,_0x1f9c6b))['catch'](handleError(_0x39641a,null));};exports[_0x1b82('0x44')]=function(_0x2fcf04,_0x17e47f){var _0x3adf9c={'raw':!![],'where':{'id':_0x2fcf04['params']['id']}},_0x365ab4={};_0x365ab4[_0x1b82('0x30')]=_['keys'](db[_0x1b82('0x2b')][_0x1b82('0x2c')]);_0x365ab4['query']=_[_0x1b82('0x45')](_0x2fcf04[_0x1b82('0x32')]);_0x365ab4[_0x1b82('0x33')]=_[_0x1b82('0x34')](_0x365ab4[_0x1b82('0x30')],_0x365ab4[_0x1b82('0x32')]);_0x3adf9c[_0x1b82('0x35')]=_['intersection'](_0x365ab4[_0x1b82('0x30')],qs['fields'](_0x2fcf04[_0x1b82('0x32')][_0x1b82('0x36')]));_0x3adf9c[_0x1b82('0x35')]=_0x3adf9c[_0x1b82('0x35')][_0x1b82('0x37')]?_0x3adf9c[_0x1b82('0x35')]:_0x365ab4[_0x1b82('0x30')];if(_0x2fcf04[_0x1b82('0x32')][_0x1b82('0x46')]){_0x3adf9c[_0x1b82('0x42')]=[{'all':!![]}];}_0x3adf9c=_[_0x1b82('0x3f')]({},_0x3adf9c,_0x2fcf04[_0x1b82('0x41')]);return db[_0x1b82('0x2b')][_0x1b82('0x47')](_0x3adf9c)['then'](handleEntityNotFound(_0x17e47f,null))['then'](respondWithResult(_0x17e47f,null))[_0x1b82('0x48')](handleError(_0x17e47f,null));};exports['create']=function(_0x12d9ac,_0x3df0af){return db[_0x1b82('0x2b')]['create'](_0x12d9ac[_0x1b82('0x49')],{})['then'](respondWithResult(_0x3df0af,0xc9))['catch'](handleError(_0x3df0af,null));};exports[_0x1b82('0x4a')]=function(_0x2aadf7,_0x242324){if(_0x2aadf7['body']['id']){delete _0x2aadf7[_0x1b82('0x49')]['id'];}return db[_0x1b82('0x2b')]['find']({'where':{'id':_0x2aadf7['params']['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x242324,null))[_0x1b82('0x23')](saveUpdates(_0x2aadf7[_0x1b82('0x49')],null))['then'](respondWithResult(_0x242324,null))[_0x1b82('0x48')](handleError(_0x242324,null));};exports[_0x1b82('0x24')]=function(_0x31fb5d,_0x29f9ae){return db[_0x1b82('0x2b')][_0x1b82('0x47')]({'where':{'id':_0x31fb5d['params']['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x29f9ae,null))['then'](removeEntity(_0x29f9ae,null))[_0x1b82('0x48')](handleError(_0x29f9ae,null));};exports[_0x1b82('0x4b')]=function(_0x5d9708,_0x44ce1c){return db['FaxQueueReport'][_0x1b82('0x4b')]()[_0x1b82('0x23')](respondWithResult(_0x44ce1c,null))[_0x1b82('0x48')](handleError(_0x44ce1c,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f797df6..342091b 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x55829c,_0x8613dd){var _0x111093=function(_0x3c1e8e){while(--_0x3c1e8e){_0x55829c['push'](_0x55829c['shift']());}};_0x111093(++_0x8613dd);}(_0x1261,0x144));var _0x1126=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x1261[_0x51d129];return _0x44c377;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('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 54081d5..a8d985d 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 _0xd4e3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','then','update','body','raw','where','limit','UpdateFaxQueueReport','lodash','util'];(function(_0x159cde,_0x349180){var _0x1a9cf9=function(_0x1eea82){while(--_0x1eea82){_0x159cde['push'](_0x159cde['shift']());}};_0x1a9cf9(++_0x349180);}(_0xd4e3,0x11e));var _0x3d4e=function(_0x397ec9,_0x384f51){_0x397ec9=_0x397ec9-0x0;var _0x381635=_0xd4e3[_0x397ec9];return _0x381635;};'use strict';var _=require(_0x3d4e('0x0'));var util=require(_0x3d4e('0x1'));var moment=require('moment');var BPromise=require(_0x3d4e('0x2'));var rs=require(_0x3d4e('0x3'));var fs=require('fs');var Redis=require(_0x3d4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d4e('0x5'));var logger=require(_0x3d4e('0x6'))(_0x3d4e('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d4e('0x8'));var client=jayson[_0x3d4e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x87447a,_0x51f535,_0x5e7d56){return new BPromise(function(_0x18eb0a,_0x9904e8){return client[_0x3d4e('0xa')](_0x87447a,_0x5e7d56)['then'](function(_0x183fd2){logger[_0x3d4e('0xb')](_0x3d4e('0xc'),_0x51f535,'request\x20sent');logger[_0x3d4e('0xd')](_0x3d4e('0xe'),_0x51f535,_0x3d4e('0xf'),JSON[_0x3d4e('0x10')](_0x183fd2));if(_0x183fd2['error']){if(_0x183fd2[_0x3d4e('0x11')][_0x3d4e('0x12')]===0x1f4){logger[_0x3d4e('0x11')](_0x3d4e('0xc'),_0x51f535,_0x183fd2[_0x3d4e('0x11')][_0x3d4e('0x13')]);return _0x9904e8(_0x183fd2[_0x3d4e('0x11')]['message']);}logger[_0x3d4e('0x11')](_0x3d4e('0xc'),_0x51f535,_0x183fd2['error']['message']);return _0x18eb0a(_0x183fd2[_0x3d4e('0x11')][_0x3d4e('0x13')]);}else{logger[_0x3d4e('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x51f535,'request\x20sent');_0x18eb0a(_0x183fd2[_0x3d4e('0x14')][_0x3d4e('0x13')]);}})[_0x3d4e('0x15')](function(_0xe114e){logger[_0x3d4e('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x51f535,_0xe114e);_0x9904e8(_0xe114e);});});}exports[_0x3d4e('0x16')]=function(_0x3cba42){var _0x3a6bf0=this;return new Promise(function(_0x18d31,_0x499885){return db[_0x3d4e('0x17')]['create'](_0x3cba42['body'],{'raw':_0x3cba42[_0x3d4e('0x18')]?_0x3cba42[_0x3d4e('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3d4e('0x19')](function(_0x1801fa){logger['info'](_0x3d4e('0x16'),_0x3cba42);logger['debug'](_0x3d4e('0x16'),_0x3cba42,JSON[_0x3d4e('0x10')](_0x1801fa));_0x18d31(_0x1801fa);})['catch'](function(_0x5cd64a){logger['error']('CreateFaxQueueReport',_0x5cd64a[_0x3d4e('0x13')],_0x3cba42);_0x499885(_0x3a6bf0[_0x3d4e('0x11')](0x1f4,_0x5cd64a[_0x3d4e('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x59d143){var _0x14f9cc=this;return new Promise(function(_0x58cc32,_0x2d82aa){return db[_0x3d4e('0x17')][_0x3d4e('0x1a')](_0x59d143[_0x3d4e('0x1b')],{'raw':_0x59d143[_0x3d4e('0x18')]?_0x59d143[_0x3d4e('0x18')][_0x3d4e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d143[_0x3d4e('0x18')]?_0x59d143['options'][_0x3d4e('0x1d')]||null:null,'attributes':_0x59d143[_0x3d4e('0x18')]?_0x59d143['options']['attributes']||null:null,'limit':_0x59d143[_0x3d4e('0x18')]?_0x59d143['options'][_0x3d4e('0x1e')]||null:null})[_0x3d4e('0x19')](function(_0x2f8231){logger[_0x3d4e('0xb')](_0x3d4e('0x1f'),_0x59d143);logger[_0x3d4e('0xd')]('UpdateFaxQueueReport',_0x59d143,JSON['stringify'](_0x2f8231));_0x58cc32(_0x2f8231);})['catch'](function(_0x6119){logger['error'](_0x3d4e('0x1f'),_0x6119[_0x3d4e('0x13')],_0x59d143);_0x2d82aa(_0x14f9cc[_0x3d4e('0x11')](0x1f4,_0x6119[_0x3d4e('0x13')]));});});}; \ No newline at end of file +var _0x4472=['jayson/promise','client','http','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x54b56d,_0x43cee0){var _0x29e581=function(_0x2d0f0f){while(--_0x2d0f0f){_0x54b56d['push'](_0x54b56d['shift']());}};_0x29e581(++_0x43cee0);}(_0x4472,0x7d));var _0x2447=function(_0x2071a8,_0x4b00d6){_0x2071a8=_0x2071a8-0x0;var _0x5a0c12=_0x4472[_0x2071a8];return _0x5a0c12;};'use strict';var _=require('lodash');var util=require(_0x2447('0x0'));var moment=require(_0x2447('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2447('0x2'));var db=require(_0x2447('0x3'))['db'];var utils=require(_0x2447('0x4'));var logger=require(_0x2447('0x5'))('rpc');var config=require(_0x2447('0x6'));var jayson=require(_0x2447('0x7'));var client=jayson[_0x2447('0x8')][_0x2447('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11f076,_0x1bcb51,_0x162261){return new BPromise(function(_0x20eb9c,_0x329d7a){return client['request'](_0x11f076,_0x162261)[_0x2447('0xa')](function(_0x316251){logger[_0x2447('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x1bcb51,_0x2447('0xc'));logger[_0x2447('0xd')](_0x2447('0xe'),_0x1bcb51,_0x2447('0xc'),JSON[_0x2447('0xf')](_0x316251));if(_0x316251[_0x2447('0x10')]){if(_0x316251[_0x2447('0x10')][_0x2447('0x11')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x1bcb51,_0x316251['error']['message']);return _0x329d7a(_0x316251[_0x2447('0x10')]['message']);}logger['error'](_0x2447('0x12'),_0x1bcb51,_0x316251[_0x2447('0x10')][_0x2447('0x13')]);return _0x20eb9c(_0x316251['error'][_0x2447('0x13')]);}else{logger[_0x2447('0xb')](_0x2447('0x12'),_0x1bcb51,_0x2447('0xc'));_0x20eb9c(_0x316251[_0x2447('0x14')][_0x2447('0x13')]);}})[_0x2447('0x15')](function(_0x35ac0d){logger['error'](_0x2447('0x12'),_0x1bcb51,_0x35ac0d);_0x329d7a(_0x35ac0d);});});}exports[_0x2447('0x16')]=function(_0x4cdc64){var _0x336e4c=this;return new Promise(function(_0xa1549d,_0x348d54){return db[_0x2447('0x17')][_0x2447('0x18')](_0x4cdc64['body'],{'raw':_0x4cdc64[_0x2447('0x19')]?_0x4cdc64[_0x2447('0x19')][_0x2447('0x1a')]===undefined?!![]:![]:!![]})[_0x2447('0xa')](function(_0x13f098){logger[_0x2447('0xb')](_0x2447('0x16'),_0x4cdc64);logger[_0x2447('0xd')]('CreateFaxQueueReport',_0x4cdc64,JSON[_0x2447('0xf')](_0x13f098));_0xa1549d(_0x13f098);})['catch'](function(_0x4a475b){logger[_0x2447('0x10')](_0x2447('0x16'),_0x4a475b['message'],_0x4cdc64);_0x348d54(_0x336e4c['error'](0x1f4,_0x4a475b[_0x2447('0x13')]));});});};exports[_0x2447('0x1b')]=function(_0xd80b54){var _0x413ee2=this;return new Promise(function(_0x1e2c02,_0x2f307f){return db[_0x2447('0x17')][_0x2447('0x1c')](_0xd80b54[_0x2447('0x1d')],{'raw':_0xd80b54[_0x2447('0x19')]?_0xd80b54[_0x2447('0x19')][_0x2447('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd80b54[_0x2447('0x19')]?_0xd80b54['options'][_0x2447('0x1e')]||null:null,'attributes':_0xd80b54[_0x2447('0x19')]?_0xd80b54[_0x2447('0x19')][_0x2447('0x1f')]||null:null,'limit':_0xd80b54['options']?_0xd80b54[_0x2447('0x19')][_0x2447('0x20')]||null:null})[_0x2447('0xa')](function(_0x4ea0a5){logger[_0x2447('0xb')](_0x2447('0x1b'),_0xd80b54);logger[_0x2447('0xd')](_0x2447('0x1b'),_0xd80b54,JSON[_0x2447('0xf')](_0x4ea0a5));_0x1e2c02(_0x4ea0a5);})[_0x2447('0x15')](function(_0x461cd3){logger[_0x2447('0x10')](_0x2447('0x1b'),_0x461cd3[_0x2447('0x13')],_0xd80b54);_0x2f307f(_0x413ee2[_0x2447('0x10')](0x1f4,_0x461cd3[_0x2447('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 85506c5..4d49a13 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 _0x0f04=['delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x1ab483,_0x27b08d){var _0x5cbc59=function(_0x4e0e2e){while(--_0x4e0e2e){_0x1ab483['push'](_0x1ab483['shift']());}};_0x5cbc59(++_0x27b08d);}(_0x0f04,0xec));var _0x40f0=function(_0x153acc,_0x6634be){_0x153acc=_0x153acc-0x0;var _0x5c0ca1=_0x0f04[_0x153acc];return _0x5c0ca1;};'use strict';var multer=require(_0x40f0('0x0'));var util=require(_0x40f0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x40f0('0x2')]();var fs_extra=require(_0x40f0('0x3'));var auth=require(_0x40f0('0x4'));var interaction=require(_0x40f0('0x5'));var config=require('../../config/environment');var controller=require(_0x40f0('0x6'));router[_0x40f0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x40f0('0x8'),auth[_0x40f0('0x9')](),controller[_0x40f0('0xa')]);router[_0x40f0('0x7')](_0x40f0('0xb'),auth[_0x40f0('0x9')](),controller['show']);router[_0x40f0('0xc')]('/',auth[_0x40f0('0x9')](),controller[_0x40f0('0xd')]);router[_0x40f0('0xe')](_0x40f0('0xb'),auth[_0x40f0('0x9')](),controller[_0x40f0('0xf')]);router[_0x40f0('0x10')]('/:id',auth[_0x40f0('0x9')](),controller['destroy']);module[_0x40f0('0x11')]=router; \ No newline at end of file +var _0x3292=['/describe','post','create','put','update','delete','/:id','destroy','multer','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x48a49e,_0x2f1d73){var _0x34d1f1=function(_0x2ac5f3){while(--_0x2ac5f3){_0x48a49e['push'](_0x48a49e['shift']());}};_0x34d1f1(++_0x2f1d73);}(_0x3292,0x158));var _0x2329=function(_0x3c6e15,_0x2f414f){_0x3c6e15=_0x3c6e15-0x0;var _0x26a616=_0x3292[_0x3c6e15];return _0x26a616;};'use strict';var multer=require(_0x2329('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2329('0x1'));var router=express[_0x2329('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2329('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2329('0x4'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x2329('0x5')](),controller[_0x2329('0x6')]);router[_0x2329('0x7')](_0x2329('0x8'),auth[_0x2329('0x5')](),controller['describe']);router['get']('/:id',auth[_0x2329('0x5')](),controller['show']);router[_0x2329('0x9')]('/',auth['isAuthenticated'](),controller[_0x2329('0xa')]);router[_0x2329('0xb')]('/:id',auth[_0x2329('0x5')](),controller[_0x2329('0xc')]);router[_0x2329('0xd')](_0x2329('0xe'),auth[_0x2329('0x5')](),controller[_0x2329('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4f8e6ae..2fde141 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1eaf9a,_0x4a10c3){var _0x1fbedb=function(_0x261b11){while(--_0x261b11){_0x1eaf9a['push'](_0x1eaf9a['shift']());}};_0x1fbedb(++_0x4a10c3);}(_0x54ef,0x112));var _0xf54e=function(_0x204d9c,_0x4cc9f9){_0x204d9c=_0x204d9c-0x0;var _0x3b4399=_0x54ef[_0x204d9c];return _0x3b4399;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5dc86b,_0x43e7e2){var _0x3645ab=function(_0x10a586){while(--_0x10a586){_0x5dc86b['push'](_0x5dc86b['shift']());}};_0x3645ab(++_0x43e7e2);}(_0xf4eb,0xec));var _0xbf4e=function(_0x377bc4,_0x3f4518){_0x377bc4=_0x377bc4-0x0;var _0x384537=_0xf4eb[_0x377bc4];return _0x384537;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 4ff946f..5586270 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 _0xdad4=['pick','filter','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x2fda4d,_0x1a3f7a){var _0x1b6ce7=function(_0x3f7892){while(--_0x3f7892){_0x2fda4d['push'](_0x2fda4d['shift']());}};_0x1b6ce7(++_0x1a3f7a);}(_0xdad4,0x1cb));var _0x4dad=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xdad4[_0x46efd7];return _0x5637e4;};'use strict';var emlformat=require(_0x4dad('0x0'));var rimraf=require(_0x4dad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4dad('0x2'));var rp=require(_0x4dad('0x3'));var moment=require(_0x4dad('0x4'));var BPromise=require(_0x4dad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4dad('0x6'));var sox=require(_0x4dad('0x7'));var csv=require('to-csv');var ejs=require(_0x4dad('0x8'));var fs=require('fs');var fs_extra=require(_0x4dad('0x9'));var _=require('lodash');var squel=require(_0x4dad('0xa'));var crypto=require('crypto');var jsforce=require(_0x4dad('0xb'));var deskjs=require(_0x4dad('0xc'));var toCsv=require(_0x4dad('0xd'));var querystring=require(_0x4dad('0xe'));var Papa=require(_0x4dad('0xf'));var Redis=require(_0x4dad('0x10'));var authService=require(_0x4dad('0x11'));var qs=require(_0x4dad('0x12'));var as=require(_0x4dad('0x13'));var hardwareService=require(_0x4dad('0x14'));var logger=require(_0x4dad('0x15'))(_0x4dad('0x16'));var utils=require(_0x4dad('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4dad('0x18'));var db=require(_0x4dad('0x19'))['db'];function respondWithStatusCode(_0x25594f,_0x5a2007){_0x5a2007=_0x5a2007||0xcc;return function(_0x686c4f){if(_0x686c4f){return _0x25594f[_0x4dad('0x1a')](_0x5a2007);}return _0x25594f[_0x4dad('0x1b')](_0x5a2007)[_0x4dad('0x1c')]();};}function respondWithResult(_0x296c1a,_0x268491){_0x268491=_0x268491||0xc8;return function(_0x32b6c6){if(_0x32b6c6){return _0x296c1a['status'](_0x268491)['json'](_0x32b6c6);}};}function respondWithFilteredResult(_0x22e00a,_0x59a99a){return function(_0x4b407d){if(_0x4b407d){var _0xf38e8=typeof _0x59a99a[_0x4dad('0x1d')]===_0x4dad('0x1e')&&typeof _0x59a99a['limit']===_0x4dad('0x1e');var _0x4bec80=_0x4b407d[_0x4dad('0x1f')];var _0x2af85d=_0xf38e8?0x0:_0x59a99a[_0x4dad('0x1d')];var _0x262171=_0xf38e8?_0x4b407d['count']:_0x59a99a['offset']+_0x59a99a[_0x4dad('0x20')];var _0x360403;if(_0x262171>=_0x4bec80){_0x262171=_0x4bec80;_0x360403=0xc8;}else{_0x360403=0xce;}_0x22e00a[_0x4dad('0x1b')](_0x360403);return _0x22e00a[_0x4dad('0x21')]('Content-Range',_0x2af85d+'-'+_0x262171+'/'+_0x4bec80)[_0x4dad('0x22')](_0x4b407d);}return null;};}function patchUpdates(_0x219c66){return function(_0x3207d4){try{jsonpatch['apply'](_0x3207d4,_0x219c66,!![]);}catch(_0x315505){return BPromise[_0x4dad('0x23')](_0x315505);}return _0x3207d4[_0x4dad('0x24')]();};}function saveUpdates(_0x1b7225,_0x1b9820){return function(_0x211756){if(_0x211756){return _0x211756[_0x4dad('0x25')](_0x1b7225)[_0x4dad('0x26')](function(_0xb737be){return _0xb737be;});}return null;};}function removeEntity(_0x2744c3,_0x19869d){return function(_0x297910){if(_0x297910){return _0x297910[_0x4dad('0x27')]()[_0x4dad('0x26')](function(){_0x2744c3['status'](0xcc)[_0x4dad('0x1c')]();});}};}function handleEntityNotFound(_0x1e4a05,_0xa60e89){return function(_0x1d9aaa){if(!_0x1d9aaa){_0x1e4a05[_0x4dad('0x1a')](0x194);}return _0x1d9aaa;};}function handleError(_0x2d2942,_0x4c7812){_0x4c7812=_0x4c7812||0x1f4;return function(_0x296296){logger['error'](_0x296296['stack']);if(_0x296296[_0x4dad('0x28')]){delete _0x296296[_0x4dad('0x28')];}_0x2d2942['status'](_0x4c7812)[_0x4dad('0x29')](_0x296296);};}exports[_0x4dad('0x2a')]=function(_0x1ff594,_0x604656){var _0x4b0b1f={},_0x3defb4={},_0x42975e={'count':0x0,'rows':[]};var _0x3b5972=_[_0x4dad('0x2b')](db[_0x4dad('0x2c')][_0x4dad('0x2d')],function(_0x5d6a0a){return{'name':_0x5d6a0a[_0x4dad('0x2e')],'type':_0x5d6a0a['type'][_0x4dad('0x2f')]};});_0x3defb4[_0x4dad('0x30')]=_[_0x4dad('0x2b')](_0x3b5972,_0x4dad('0x28'));_0x3defb4[_0x4dad('0x31')]=_['keys'](_0x1ff594[_0x4dad('0x31')]);_0x3defb4[_0x4dad('0x32')]=_[_0x4dad('0x33')](_0x3defb4[_0x4dad('0x30')],_0x3defb4[_0x4dad('0x31')]);_0x4b0b1f[_0x4dad('0x34')]=_[_0x4dad('0x33')](_0x3defb4[_0x4dad('0x30')],qs['fields'](_0x1ff594[_0x4dad('0x31')][_0x4dad('0x35')]));_0x4b0b1f[_0x4dad('0x34')]=_0x4b0b1f[_0x4dad('0x34')][_0x4dad('0x36')]?_0x4b0b1f[_0x4dad('0x34')]:_0x3defb4['model'];if(!_0x1ff594[_0x4dad('0x31')][_0x4dad('0x37')]('nolimit')){_0x4b0b1f['limit']=qs[_0x4dad('0x20')](_0x1ff594[_0x4dad('0x31')][_0x4dad('0x20')]);_0x4b0b1f[_0x4dad('0x1d')]=qs[_0x4dad('0x1d')](_0x1ff594[_0x4dad('0x31')][_0x4dad('0x1d')]);}_0x4b0b1f[_0x4dad('0x38')]=qs[_0x4dad('0x39')](_0x1ff594[_0x4dad('0x31')][_0x4dad('0x39')]);_0x4b0b1f[_0x4dad('0x3a')]=qs[_0x4dad('0x32')](_[_0x4dad('0x3b')](_0x1ff594[_0x4dad('0x31')],_0x3defb4[_0x4dad('0x32')]),_0x3b5972);if(_0x1ff594[_0x4dad('0x31')][_0x4dad('0x3c')]){_0x4b0b1f['where']=_[_0x4dad('0x3d')](_0x4b0b1f[_0x4dad('0x3a')],{'$or':_[_0x4dad('0x2b')](_0x3b5972,function(_0x42c6fc){if(_0x42c6fc['type']!=='VIRTUAL'){var _0x49db4c={};_0x49db4c[_0x42c6fc[_0x4dad('0x28')]]={'$like':'%'+_0x1ff594[_0x4dad('0x31')][_0x4dad('0x3c')]+'%'};return _0x49db4c;}})});}_0x4b0b1f=_['merge']({},_0x4b0b1f,_0x1ff594[_0x4dad('0x3e')]);var _0x4b0159={'where':_0x4b0b1f[_0x4dad('0x3a')]};return db[_0x4dad('0x2c')][_0x4dad('0x1f')](_0x4b0159)[_0x4dad('0x26')](function(_0x53ac1c){_0x42975e['count']=_0x53ac1c;if(_0x1ff594[_0x4dad('0x31')][_0x4dad('0x3f')]){_0x4b0b1f['include']=[{'all':!![]}];}return db[_0x4dad('0x2c')]['findAll'](_0x4b0b1f);})[_0x4dad('0x26')](function(_0x52e606){_0x42975e[_0x4dad('0x40')]=_0x52e606;return _0x42975e;})[_0x4dad('0x26')](respondWithFilteredResult(_0x604656,_0x4b0b1f))[_0x4dad('0x41')](handleError(_0x604656,null));};exports[_0x4dad('0x42')]=function(_0xcf8b07,_0x125fdb){var _0x36eaab={'raw':!![],'where':{'id':_0xcf8b07[_0x4dad('0x43')]['id']}},_0x2a4ab8={};_0x2a4ab8['model']=_[_0x4dad('0x44')](db[_0x4dad('0x2c')][_0x4dad('0x2d')]);_0x2a4ab8[_0x4dad('0x31')]=_[_0x4dad('0x44')](_0xcf8b07['query']);_0x2a4ab8[_0x4dad('0x32')]=_[_0x4dad('0x33')](_0x2a4ab8[_0x4dad('0x30')],_0x2a4ab8['query']);_0x36eaab[_0x4dad('0x34')]=_['intersection'](_0x2a4ab8[_0x4dad('0x30')],qs['fields'](_0xcf8b07[_0x4dad('0x31')]['fields']));_0x36eaab[_0x4dad('0x34')]=_0x36eaab[_0x4dad('0x34')][_0x4dad('0x36')]?_0x36eaab[_0x4dad('0x34')]:_0x2a4ab8[_0x4dad('0x30')];if(_0xcf8b07['query'][_0x4dad('0x3f')]){_0x36eaab[_0x4dad('0x45')]=[{'all':!![]}];}_0x36eaab=_[_0x4dad('0x3d')]({},_0x36eaab,_0xcf8b07[_0x4dad('0x3e')]);return db[_0x4dad('0x2c')][_0x4dad('0x46')](_0x36eaab)[_0x4dad('0x26')](handleEntityNotFound(_0x125fdb,null))[_0x4dad('0x26')](respondWithResult(_0x125fdb,null))['catch'](handleError(_0x125fdb,null));};exports[_0x4dad('0x47')]=function(_0x1afd92,_0x30c098){return db[_0x4dad('0x2c')]['create'](_0x1afd92['body'],{})[_0x4dad('0x26')](respondWithResult(_0x30c098,0xc9))[_0x4dad('0x41')](handleError(_0x30c098,null));};exports[_0x4dad('0x25')]=function(_0x1c263e,_0xadeebd){if(_0x1c263e[_0x4dad('0x48')]['id']){delete _0x1c263e['body']['id'];}return db[_0x4dad('0x2c')][_0x4dad('0x46')]({'where':{'id':_0x1c263e[_0x4dad('0x43')]['id']}})['then'](handleEntityNotFound(_0xadeebd,null))[_0x4dad('0x26')](saveUpdates(_0x1c263e[_0x4dad('0x48')],null))[_0x4dad('0x26')](respondWithResult(_0xadeebd,null))[_0x4dad('0x41')](handleError(_0xadeebd,null));};exports[_0x4dad('0x27')]=function(_0x25884e,_0x1b5047){return db['FaxTransferReport'][_0x4dad('0x46')]({'where':{'id':_0x25884e[_0x4dad('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b5047,null))['then'](removeEntity(_0x1b5047,null))[_0x4dad('0x41')](handleError(_0x1b5047,null));};exports[_0x4dad('0x49')]=function(_0xc41798,_0x36098e){return db[_0x4dad('0x2c')][_0x4dad('0x49')]()[_0x4dad('0x26')](respondWithResult(_0x36098e,null))['catch'](handleError(_0x36098e,null));}; \ No newline at end of file +var _0x48ee=['type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','length','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','FaxTransferReport','rawAttributes'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x48ee,0x149));var _0xe48e=function(_0x57884c,_0x3a5264){_0x57884c=_0x57884c-0x0;var _0x529973=_0x48ee[_0x57884c];return _0x529973;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe48e('0x0'));var zipdir=require(_0xe48e('0x1'));var jsonpatch=require(_0xe48e('0x2'));var rp=require(_0xe48e('0x3'));var moment=require(_0xe48e('0x4'));var BPromise=require(_0xe48e('0x5'));var Mustache=require(_0xe48e('0x6'));var util=require('util');var path=require(_0xe48e('0x7'));var sox=require(_0xe48e('0x8'));var csv=require(_0xe48e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe48e('0xa'));var _=require(_0xe48e('0xb'));var squel=require('squel');var crypto=require(_0xe48e('0xc'));var jsforce=require(_0xe48e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe48e('0x9'));var querystring=require(_0xe48e('0xe'));var Papa=require(_0xe48e('0xf'));var Redis=require(_0xe48e('0x10'));var authService=require(_0xe48e('0x11'));var qs=require(_0xe48e('0x12'));var as=require(_0xe48e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe48e('0x14'))(_0xe48e('0x15'));var utils=require(_0xe48e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe48e('0x17'));var db=require(_0xe48e('0x18'))['db'];function respondWithStatusCode(_0xc4ac16,_0x5ef986){_0x5ef986=_0x5ef986||0xcc;return function(_0x1007b3){if(_0x1007b3){return _0xc4ac16[_0xe48e('0x19')](_0x5ef986);}return _0xc4ac16['status'](_0x5ef986)[_0xe48e('0x1a')]();};}function respondWithResult(_0x2c554b,_0x365790){_0x365790=_0x365790||0xc8;return function(_0x36f378){if(_0x36f378){return _0x2c554b[_0xe48e('0x1b')](_0x365790)[_0xe48e('0x1c')](_0x36f378);}};}function respondWithFilteredResult(_0x35c126,_0x5eccce){return function(_0x4f1feb){if(_0x4f1feb){var _0xe05562=typeof _0x5eccce[_0xe48e('0x1d')]==='undefined'&&typeof _0x5eccce[_0xe48e('0x1e')]===_0xe48e('0x1f');var _0x68cd53=_0x4f1feb[_0xe48e('0x20')];var _0x437973=_0xe05562?0x0:_0x5eccce[_0xe48e('0x1d')];var _0x57709e=_0xe05562?_0x4f1feb['count']:_0x5eccce[_0xe48e('0x1d')]+_0x5eccce[_0xe48e('0x1e')];var _0x55211b;if(_0x57709e>=_0x68cd53){_0x57709e=_0x68cd53;_0x55211b=0xc8;}else{_0x55211b=0xce;}_0x35c126[_0xe48e('0x1b')](_0x55211b);return _0x35c126[_0xe48e('0x21')](_0xe48e('0x22'),_0x437973+'-'+_0x57709e+'/'+_0x68cd53)['json'](_0x4f1feb);}return null;};}function patchUpdates(_0x2e201b){return function(_0x5bb928){try{jsonpatch[_0xe48e('0x23')](_0x5bb928,_0x2e201b,!![]);}catch(_0x3ebe80){return BPromise['reject'](_0x3ebe80);}return _0x5bb928[_0xe48e('0x24')]();};}function saveUpdates(_0x20b4ef,_0x17243d){return function(_0x41434d){if(_0x41434d){return _0x41434d[_0xe48e('0x25')](_0x20b4ef)[_0xe48e('0x26')](function(_0x5f2aa7){return _0x5f2aa7;});}return null;};}function removeEntity(_0x1bd563,_0x1b0ed7){return function(_0x2b9552){if(_0x2b9552){return _0x2b9552[_0xe48e('0x27')]()[_0xe48e('0x26')](function(){_0x1bd563[_0xe48e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x390dc1,_0x617cad){return function(_0x289ee2){if(!_0x289ee2){_0x390dc1[_0xe48e('0x19')](0x194);}return _0x289ee2;};}function handleError(_0x28f4ce,_0x307171){_0x307171=_0x307171||0x1f4;return function(_0x1f1782){logger['error'](_0x1f1782[_0xe48e('0x28')]);if(_0x1f1782[_0xe48e('0x29')]){delete _0x1f1782['name'];}_0x28f4ce[_0xe48e('0x1b')](_0x307171)[_0xe48e('0x2a')](_0x1f1782);};}exports['index']=function(_0x8b656f,_0x562950){var _0x4da54c={},_0x55f96f={},_0x5b78ef={'count':0x0,'rows':[]};var _0x5e7a22=_[_0xe48e('0x2b')](db[_0xe48e('0x2c')][_0xe48e('0x2d')],function(_0x5158b3){return{'name':_0x5158b3['fieldName'],'type':_0x5158b3[_0xe48e('0x2e')][_0xe48e('0x2f')]};});_0x55f96f[_0xe48e('0x30')]=_[_0xe48e('0x2b')](_0x5e7a22,'name');_0x55f96f[_0xe48e('0x31')]=_[_0xe48e('0x32')](_0x8b656f[_0xe48e('0x31')]);_0x55f96f[_0xe48e('0x33')]=_[_0xe48e('0x34')](_0x55f96f['model'],_0x55f96f['query']);_0x4da54c['attributes']=_['intersection'](_0x55f96f[_0xe48e('0x30')],qs[_0xe48e('0x35')](_0x8b656f[_0xe48e('0x31')][_0xe48e('0x35')]));_0x4da54c[_0xe48e('0x36')]=_0x4da54c[_0xe48e('0x36')]['length']?_0x4da54c[_0xe48e('0x36')]:_0x55f96f[_0xe48e('0x30')];if(!_0x8b656f['query'][_0xe48e('0x37')]('nolimit')){_0x4da54c[_0xe48e('0x1e')]=qs['limit'](_0x8b656f[_0xe48e('0x31')]['limit']);_0x4da54c[_0xe48e('0x1d')]=qs[_0xe48e('0x1d')](_0x8b656f[_0xe48e('0x31')][_0xe48e('0x1d')]);}_0x4da54c[_0xe48e('0x38')]=qs[_0xe48e('0x39')](_0x8b656f[_0xe48e('0x31')][_0xe48e('0x39')]);_0x4da54c['where']=qs[_0xe48e('0x33')](_[_0xe48e('0x3a')](_0x8b656f[_0xe48e('0x31')],_0x55f96f[_0xe48e('0x33')]),_0x5e7a22);if(_0x8b656f['query'][_0xe48e('0x3b')]){_0x4da54c[_0xe48e('0x3c')]=_[_0xe48e('0x3d')](_0x4da54c[_0xe48e('0x3c')],{'$or':_[_0xe48e('0x2b')](_0x5e7a22,function(_0x750746){if(_0x750746[_0xe48e('0x2e')]!==_0xe48e('0x3e')){var _0x1f722c={};_0x1f722c[_0x750746[_0xe48e('0x29')]]={'$like':'%'+_0x8b656f[_0xe48e('0x31')]['filter']+'%'};return _0x1f722c;}})});}_0x4da54c=_[_0xe48e('0x3d')]({},_0x4da54c,_0x8b656f[_0xe48e('0x3f')]);var _0xc21028={'where':_0x4da54c['where']};return db[_0xe48e('0x2c')][_0xe48e('0x20')](_0xc21028)['then'](function(_0x5ed926){_0x5b78ef[_0xe48e('0x20')]=_0x5ed926;if(_0x8b656f[_0xe48e('0x31')]['includeAll']){_0x4da54c[_0xe48e('0x40')]=[{'all':!![]}];}return db[_0xe48e('0x2c')]['findAll'](_0x4da54c);})[_0xe48e('0x26')](function(_0xdb1daf){_0x5b78ef[_0xe48e('0x41')]=_0xdb1daf;return _0x5b78ef;})[_0xe48e('0x26')](respondWithFilteredResult(_0x562950,_0x4da54c))[_0xe48e('0x42')](handleError(_0x562950,null));};exports[_0xe48e('0x43')]=function(_0x20de37,_0x1f4eda){var _0xc7632a={'raw':!![],'where':{'id':_0x20de37['params']['id']}},_0x40f881={};_0x40f881[_0xe48e('0x30')]=_[_0xe48e('0x32')](db[_0xe48e('0x2c')][_0xe48e('0x2d')]);_0x40f881[_0xe48e('0x31')]=_[_0xe48e('0x32')](_0x20de37[_0xe48e('0x31')]);_0x40f881[_0xe48e('0x33')]=_['intersection'](_0x40f881[_0xe48e('0x30')],_0x40f881[_0xe48e('0x31')]);_0xc7632a['attributes']=_[_0xe48e('0x34')](_0x40f881[_0xe48e('0x30')],qs['fields'](_0x20de37[_0xe48e('0x31')][_0xe48e('0x35')]));_0xc7632a[_0xe48e('0x36')]=_0xc7632a['attributes'][_0xe48e('0x44')]?_0xc7632a[_0xe48e('0x36')]:_0x40f881['model'];if(_0x20de37[_0xe48e('0x31')][_0xe48e('0x45')]){_0xc7632a[_0xe48e('0x40')]=[{'all':!![]}];}_0xc7632a=_[_0xe48e('0x3d')]({},_0xc7632a,_0x20de37[_0xe48e('0x3f')]);return db[_0xe48e('0x2c')][_0xe48e('0x46')](_0xc7632a)[_0xe48e('0x26')](handleEntityNotFound(_0x1f4eda,null))[_0xe48e('0x26')](respondWithResult(_0x1f4eda,null))['catch'](handleError(_0x1f4eda,null));};exports[_0xe48e('0x47')]=function(_0x7dbbd9,_0x37959b){return db[_0xe48e('0x2c')][_0xe48e('0x47')](_0x7dbbd9[_0xe48e('0x48')],{})[_0xe48e('0x26')](respondWithResult(_0x37959b,0xc9))[_0xe48e('0x42')](handleError(_0x37959b,null));};exports[_0xe48e('0x25')]=function(_0x44784e,_0x3b71cb){if(_0x44784e['body']['id']){delete _0x44784e['body']['id'];}return db[_0xe48e('0x2c')][_0xe48e('0x46')]({'where':{'id':_0x44784e[_0xe48e('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b71cb,null))['then'](saveUpdates(_0x44784e[_0xe48e('0x48')],null))[_0xe48e('0x26')](respondWithResult(_0x3b71cb,null))[_0xe48e('0x42')](handleError(_0x3b71cb,null));};exports[_0xe48e('0x27')]=function(_0x25d022,_0x468a17){return db[_0xe48e('0x2c')][_0xe48e('0x46')]({'where':{'id':_0x25d022[_0xe48e('0x49')]['id']}})['then'](handleEntityNotFound(_0x468a17,null))[_0xe48e('0x26')](removeEntity(_0x468a17,null))[_0xe48e('0x42')](handleError(_0x468a17,null));};exports[_0xe48e('0x4a')]=function(_0x3610d8,_0x5dfdf5){return db[_0xe48e('0x2c')][_0xe48e('0x4a')]()[_0xe48e('0x26')](respondWithResult(_0x5dfdf5,null))[_0xe48e('0x42')](handleError(_0x5dfdf5,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 56c54db..227e25a 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 _0xa24a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','uniqueid','lodash','util'];(function(_0x48a2ca,_0x108524){var _0x18f879=function(_0x34fbbf){while(--_0x34fbbf){_0x48a2ca['push'](_0x48a2ca['shift']());}};_0x18f879(++_0x108524);}(_0xa24a,0x1a2));var _0xaa24=function(_0x2fd029,_0x3675f5){_0x2fd029=_0x2fd029-0x0;var _0x5eb2ed=_0xa24a[_0x2fd029];return _0x5eb2ed;};'use strict';var _=require(_0xaa24('0x0'));var util=require(_0xaa24('0x1'));var logger=require(_0xaa24('0x2'))(_0xaa24('0x3'));var moment=require(_0xaa24('0x4'));var BPromise=require(_0xaa24('0x5'));var rp=require(_0xaa24('0x6'));var fs=require('fs');var path=require(_0xaa24('0x7'));var rimraf=require(_0xaa24('0x8'));var config=require(_0xaa24('0x9'));var attributes=require('./faxTransferReport.attributes');module[_0xaa24('0xa')]=function(_0x1844ac,_0x4b621a){return _0x1844ac[_0xaa24('0xb')](_0xaa24('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xaa24('0xd'),'fields':[_0xaa24('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82f4=['util','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x5545f7,_0x570414){var _0x52a979=function(_0x28eb97){while(--_0x28eb97){_0x5545f7['push'](_0x5545f7['shift']());}};_0x52a979(++_0x570414);}(_0x82f4,0x1bf));var _0x482f=function(_0x537582,_0x71c8f0){_0x537582=_0x537582-0x0;var _0x2cd93c=_0x82f4[_0x537582];return _0x2cd93c;};'use strict';var _=require(_0x482f('0x0'));var util=require(_0x482f('0x1'));var logger=require('../../config/logger')(_0x482f('0x2'));var moment=require(_0x482f('0x3'));var BPromise=require(_0x482f('0x4'));var rp=require(_0x482f('0x5'));var fs=require('fs');var path=require(_0x482f('0x6'));var rimraf=require(_0x482f('0x7'));var config=require('../../config/environment');var attributes=require(_0x482f('0x8'));module[_0x482f('0x9')]=function(_0x457440,_0x4b969d){return _0x457440[_0x482f('0xa')](_0x482f('0xb'),attributes,{'tableName':_0x482f('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x482f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1e13fe7..9dc8d4b 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 _0x95e0=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x240c2f,_0x572aed){var _0x73d2f1=function(_0x423baa){while(--_0x423baa){_0x240c2f['push'](_0x240c2f['shift']());}};_0x73d2f1(++_0x572aed);}(_0x95e0,0x149));var _0x095e=function(_0xeba3f4,_0x5b7c97){_0xeba3f4=_0xeba3f4-0x0;var _0x357756=_0x95e0[_0xeba3f4];return _0x357756;};'use strict';var _=require(_0x095e('0x0'));var util=require(_0x095e('0x1'));var moment=require('moment');var BPromise=require(_0x095e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x095e('0x3'));var db=require(_0x095e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x095e('0x5'))(_0x095e('0x6'));var config=require(_0x095e('0x7'));var jayson=require(_0x095e('0x8'));var client=jayson[_0x095e('0x9')][_0x095e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1834f9,_0x59421b,_0x38c63f){return new BPromise(function(_0x3d6c96,_0x10a1e6){return client[_0x095e('0xb')](_0x1834f9,_0x38c63f)[_0x095e('0xc')](function(_0x4f3a06){logger[_0x095e('0xd')](_0x095e('0xe'),_0x59421b,_0x095e('0xf'));logger[_0x095e('0x10')](_0x095e('0x11'),_0x59421b,'request\x20sent',JSON['stringify'](_0x4f3a06));if(_0x4f3a06[_0x095e('0x12')]){if(_0x4f3a06[_0x095e('0x12')][_0x095e('0x13')]===0x1f4){logger['error'](_0x095e('0xe'),_0x59421b,_0x4f3a06[_0x095e('0x12')]['message']);return _0x10a1e6(_0x4f3a06[_0x095e('0x12')][_0x095e('0x14')]);}logger[_0x095e('0x12')](_0x095e('0xe'),_0x59421b,_0x4f3a06[_0x095e('0x12')][_0x095e('0x14')]);return _0x3d6c96(_0x4f3a06[_0x095e('0x12')]['message']);}else{logger[_0x095e('0xd')](_0x095e('0xe'),_0x59421b,_0x095e('0xf'));_0x3d6c96(_0x4f3a06[_0x095e('0x15')][_0x095e('0x14')]);}})[_0x095e('0x16')](function(_0x1e8ac3){logger['error'](_0x095e('0xe'),_0x59421b,_0x1e8ac3);_0x10a1e6(_0x1e8ac3);});});} \ No newline at end of file +var _0xeab9=['client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2674ee,_0x54afc9){var _0x193c8f=function(_0x1370f0){while(--_0x1370f0){_0x2674ee['push'](_0x2674ee['shift']());}};_0x193c8f(++_0x54afc9);}(_0xeab9,0x1d8));var _0x9eab=function(_0x3eb2bc,_0x3d4dfe){_0x3eb2bc=_0x3eb2bc-0x0;var _0x1b4d2f=_0xeab9[_0x3eb2bc];return _0x1b4d2f;};'use strict';var _=require('lodash');var util=require(_0x9eab('0x0'));var moment=require(_0x9eab('0x1'));var BPromise=require(_0x9eab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9eab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9eab('0x4'));var logger=require('../../config/logger')(_0x9eab('0x5'));var config=require(_0x9eab('0x6'));var jayson=require(_0x9eab('0x7'));var client=jayson[_0x9eab('0x8')][_0x9eab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x518415,_0x6397ce,_0x380908){return new BPromise(function(_0x3be1e0,_0x2271d4){return client['request'](_0x518415,_0x380908)[_0x9eab('0xa')](function(_0x1124ca){logger[_0x9eab('0xb')](_0x9eab('0xc'),_0x6397ce,_0x9eab('0xd'));logger[_0x9eab('0xe')](_0x9eab('0xf'),_0x6397ce,_0x9eab('0xd'),JSON['stringify'](_0x1124ca));if(_0x1124ca[_0x9eab('0x10')]){if(_0x1124ca[_0x9eab('0x10')]['code']===0x1f4){logger[_0x9eab('0x10')](_0x9eab('0xc'),_0x6397ce,_0x1124ca[_0x9eab('0x10')][_0x9eab('0x11')]);return _0x2271d4(_0x1124ca[_0x9eab('0x10')]['message']);}logger[_0x9eab('0x10')](_0x9eab('0xc'),_0x6397ce,_0x1124ca['error']['message']);return _0x3be1e0(_0x1124ca[_0x9eab('0x10')]['message']);}else{logger[_0x9eab('0xb')](_0x9eab('0xc'),_0x6397ce,_0x9eab('0xd'));_0x3be1e0(_0x1124ca[_0x9eab('0x12')][_0x9eab('0x11')]);}})[_0x9eab('0x13')](function(_0x3a578a){logger[_0x9eab('0x10')](_0x9eab('0xc'),_0x6397ce,_0x3a578a);_0x2271d4(_0x3a578a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a1ead0f..c5edbf1 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 _0x22bf=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','post','create','put','/:id','update','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0x22bf,0x137));var _0xf22b=function(_0x192b24,_0x3f050d){_0x192b24=_0x192b24-0x0;var _0x48d700=_0x22bf[_0x192b24];return _0x48d700;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf22b('0x0')]();var fs_extra=require(_0xf22b('0x1'));var auth=require(_0xf22b('0x2'));var interaction=require(_0xf22b('0x3'));var config=require(_0xf22b('0x4'));var controller=require(_0xf22b('0x5'));router[_0xf22b('0x6')]('/',auth[_0xf22b('0x7')](),controller['index']);router[_0xf22b('0x6')](_0xf22b('0x8'),auth[_0xf22b('0x7')](),controller['describe']);router[_0xf22b('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf22b('0x9')]('/',auth[_0xf22b('0x7')](),controller[_0xf22b('0xa')]);router[_0xf22b('0xb')](_0xf22b('0xc'),auth[_0xf22b('0x7')](),controller[_0xf22b('0xd')]);router['delete']('/:id',auth[_0xf22b('0x7')](),controller['destroy']);module[_0xf22b('0xe')]=router; \ No newline at end of file +var _0x5729=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','show','post','put','/:id','destroy','exports'];(function(_0x548043,_0x3831dc){var _0x2a3c9f=function(_0x2dc8a6){while(--_0x2dc8a6){_0x548043['push'](_0x548043['shift']());}};_0x2a3c9f(++_0x3831dc);}(_0x5729,0x169));var _0x9572=function(_0x463697,_0xccfdc4){_0x463697=_0x463697-0x0;var _0x33cfe1=_0x5729[_0x463697];return _0x33cfe1;};'use strict';var multer=require('multer');var util=require(_0x9572('0x0'));var path=require(_0x9572('0x1'));var timeout=require(_0x9572('0x2'));var express=require(_0x9572('0x3'));var router=express[_0x9572('0x4')]();var fs_extra=require(_0x9572('0x5'));var auth=require(_0x9572('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9572('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x9572('0x8')](),controller[_0x9572('0x9')]);router['get'](_0x9572('0xa'),auth['isAuthenticated'](),controller[_0x9572('0xb')]);router[_0x9572('0xc')]('/:id',auth[_0x9572('0x8')](),controller[_0x9572('0xd')]);router[_0x9572('0xe')]('/',auth[_0x9572('0x8')](),controller['create']);router[_0x9572('0xf')](_0x9572('0x10'),auth[_0x9572('0x8')](),controller['update']);router['delete'](_0x9572('0x10'),auth[_0x9572('0x8')](),controller[_0x9572('0x11')]);module[_0x9572('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 1089fe8..853b92f 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 _0xb30c=['./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb30c,0x16f));var _0xcb30=function(_0x1ab56b,_0x392e65){_0x1ab56b=_0x1ab56b-0x0;var _0x4c5385=_0xb30c[_0x1ab56b];return _0x4c5385;};'use strict';var multer=require(_0xcb30('0x0'));var util=require(_0xcb30('0x1'));var path=require(_0xcb30('0x2'));var timeout=require(_0xcb30('0x3'));var express=require('express');var router=express[_0xcb30('0x4')]();var fs_extra=require(_0xcb30('0x5'));var auth=require(_0xcb30('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcb30('0x7'));router[_0xcb30('0x8')]('/',auth[_0xcb30('0x9')](),controller[_0xcb30('0xa')]);router[_0xcb30('0x8')](_0xcb30('0xb'),auth[_0xcb30('0x9')](),controller['show']);router['get'](_0xcb30('0xc'),auth[_0xcb30('0x9')](),controller[_0xcb30('0xd')]);router['get'](_0xcb30('0xe'),auth[_0xcb30('0x9')](),controller[_0xcb30('0xf')]);router[_0xcb30('0x10')]('/',auth[_0xcb30('0x9')](),controller['create']);router[_0xcb30('0x10')]('/:id/configurations',auth[_0xcb30('0x9')](),controller[_0xcb30('0x11')]);router['put'](_0xcb30('0xb'),auth[_0xcb30('0x9')](),controller[_0xcb30('0x12')]);router[_0xcb30('0x13')]('/:id',auth[_0xcb30('0x9')](),controller[_0xcb30('0x14')]);module[_0xcb30('0x15')]=router; \ No newline at end of file +var _0xc1aa=['show','getConfigurations','getFields','post','create','/:id/configurations','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x17ce52,_0x174d05){var _0x468524=function(_0x5c44b5){while(--_0x5c44b5){_0x17ce52['push'](_0x17ce52['shift']());}};_0x468524(++_0x174d05);}(_0xc1aa,0x17a));var _0xac1a=function(_0x1dc14f,_0xc62868){_0x1dc14f=_0x1dc14f-0x0;var _0x402ccf=_0xc1aa[_0x1dc14f];return _0x402ccf;};'use strict';var multer=require(_0xac1a('0x0'));var util=require(_0xac1a('0x1'));var path=require(_0xac1a('0x2'));var timeout=require(_0xac1a('0x3'));var express=require(_0xac1a('0x4'));var router=express[_0xac1a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xac1a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xac1a('0x7'));var controller=require(_0xac1a('0x8'));router[_0xac1a('0x9')]('/',auth[_0xac1a('0xa')](),controller[_0xac1a('0xb')]);router[_0xac1a('0x9')](_0xac1a('0xc'),auth[_0xac1a('0xa')](),controller[_0xac1a('0xd')]);router['get']('/:id/configurations',auth[_0xac1a('0xa')](),controller[_0xac1a('0xe')]);router[_0xac1a('0x9')]('/:id/fields',auth[_0xac1a('0xa')](),controller[_0xac1a('0xf')]);router[_0xac1a('0x10')]('/',auth[_0xac1a('0xa')](),controller[_0xac1a('0x11')]);router[_0xac1a('0x10')](_0xac1a('0x12'),auth[_0xac1a('0xa')](),controller['addConfiguration']);router[_0xac1a('0x13')]('/:id',auth[_0xac1a('0xa')](),controller['update']);router[_0xac1a('0x14')](_0xac1a('0xc'),auth[_0xac1a('0xa')](),controller[_0xac1a('0x15')]);module[_0xac1a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 031a157..e4ed469 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 _0xb0ad=['exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x14cb4c,_0x2d2e89){var _0x5e8e9d=function(_0x383439){while(--_0x383439){_0x14cb4c['push'](_0x14cb4c['shift']());}};_0x5e8e9d(++_0x2d2e89);}(_0xb0ad,0x192));var _0xdb0a=function(_0x45f4ce,_0xabcb35){_0x45f4ce=_0x45f4ce-0x0;var _0xefd814=_0xb0ad[_0x45f4ce];return _0xefd814;};'use strict';var Sequelize=require('sequelize');module[_0xdb0a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb0a('0x1')]},'username':{'type':Sequelize[_0xdb0a('0x1')]},'remoteUri':{'type':Sequelize[_0xdb0a('0x1')]},'authType':{'type':Sequelize[_0xdb0a('0x2')]('basic'),'defaultValue':_0xdb0a('0x3')},'password':{'type':Sequelize[_0xdb0a('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xdb0a('0x1')]},'token':{'type':Sequelize[_0xdb0a('0x1')]},'tokenSecret':{'type':Sequelize[_0xdb0a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdb0a('0x2')]('integrationTab',_0xdb0a('0x4')),'defaultValue':_0xdb0a('0x5')}}; \ No newline at end of file +var _0xc439=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0xc439,0xfa));var _0x9c43=function(_0x1e9e79,_0x1bca97){_0x1e9e79=_0x1e9e79-0x0;var _0x3c54e1=_0xc439[_0x1e9e79];return _0x3c54e1;};'use strict';var Sequelize=require(_0x9c43('0x0'));module[_0x9c43('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c43('0x2')]},'username':{'type':Sequelize[_0x9c43('0x2')]},'remoteUri':{'type':Sequelize[_0x9c43('0x2')]},'authType':{'type':Sequelize[_0x9c43('0x3')]('basic'),'defaultValue':_0x9c43('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x9c43('0x2')]},'token':{'type':Sequelize[_0x9c43('0x2')]},'tokenSecret':{'type':Sequelize[_0x9c43('0x2')]},'serverUrl':{'type':Sequelize[_0x9c43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9c43('0x3')]('integrationTab',_0x9c43('0x5')),'defaultValue':_0x9c43('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b2e2942..a9f25b6 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 _0xe3d7=['getConfigurations','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','findOne','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','username','concat','entries','active','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','params','include','options','find','create','body','update'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0xe3d7,0x1e6));var _0x7e3d=function(_0x38cb62,_0x3827d4){_0x38cb62=_0x38cb62-0x0;var _0x51ce03=_0xe3d7[_0x38cb62];return _0x51ce03;};'use strict';var emlformat=require(_0x7e3d('0x0'));var rimraf=require(_0x7e3d('0x1'));var zipdir=require(_0x7e3d('0x2'));var jsonpatch=require(_0x7e3d('0x3'));var rp=require(_0x7e3d('0x4'));var moment=require('moment');var BPromise=require(_0x7e3d('0x5'));var Mustache=require('mustache');var util=require(_0x7e3d('0x6'));var path=require(_0x7e3d('0x7'));var sox=require(_0x7e3d('0x8'));var csv=require(_0x7e3d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e3d('0xa'));var _=require(_0x7e3d('0xb'));var squel=require(_0x7e3d('0xc'));var crypto=require(_0x7e3d('0xd'));var jsforce=require(_0x7e3d('0xe'));var deskjs=require(_0x7e3d('0xf'));var toCsv=require(_0x7e3d('0x9'));var querystring=require(_0x7e3d('0x10'));var Papa=require('papaparse');var Redis=require(_0x7e3d('0x11'));var authService=require(_0x7e3d('0x12'));var qs=require(_0x7e3d('0x13'));var as=require(_0x7e3d('0x14'));var hardwareService=require(_0x7e3d('0x15'));var logger=require(_0x7e3d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7e3d('0x17'));var licenseUtil=require(_0x7e3d('0x18'));var db=require(_0x7e3d('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x38eac0,_0x304a34){_0x304a34=_0x304a34||0xcc;return function(_0x481e9d){if(_0x481e9d){return _0x38eac0['sendStatus'](_0x304a34);}return _0x38eac0['status'](_0x304a34)['end']();};}function respondWithResult(_0x1372c1,_0x101e1b){_0x101e1b=_0x101e1b||0xc8;return function(_0x15942e){if(_0x15942e){return _0x1372c1[_0x7e3d('0x1a')](_0x101e1b)['json'](_0x15942e);}};}function respondWithFilteredResult(_0x7f0028,_0x3ea0c9){return function(_0x2f56c5){if(_0x2f56c5){var _0x48e382=typeof _0x3ea0c9['offset']===_0x7e3d('0x1b')&&typeof _0x3ea0c9[_0x7e3d('0x1c')]===_0x7e3d('0x1b');var _0x2c60a3=_0x2f56c5[_0x7e3d('0x1d')];var _0x15898f=_0x48e382?0x0:_0x3ea0c9[_0x7e3d('0x1e')];var _0x229cd7=_0x48e382?_0x2f56c5[_0x7e3d('0x1d')]:_0x3ea0c9['offset']+_0x3ea0c9[_0x7e3d('0x1c')];var _0x2c90d4;if(_0x229cd7>=_0x2c60a3){_0x229cd7=_0x2c60a3;_0x2c90d4=0xc8;}else{_0x2c90d4=0xce;}_0x7f0028['status'](_0x2c90d4);return _0x7f0028[_0x7e3d('0x1f')]('Content-Range',_0x15898f+'-'+_0x229cd7+'/'+_0x2c60a3)[_0x7e3d('0x20')](_0x2f56c5);}return null;};}function patchUpdates(_0x5e29d1){return function(_0x47faa9){try{jsonpatch[_0x7e3d('0x21')](_0x47faa9,_0x5e29d1,!![]);}catch(_0x2bf267){return BPromise[_0x7e3d('0x22')](_0x2bf267);}return _0x47faa9[_0x7e3d('0x23')]();};}function saveUpdates(_0x57001c,_0x24bfa6){return function(_0x5ec73a){if(_0x5ec73a){return _0x5ec73a['update'](_0x57001c)[_0x7e3d('0x24')](function(_0x403bbe){return _0x403bbe;});}return null;};}function removeEntity(_0x4ab4e8,_0xcc8921){return function(_0x1caaf9){if(_0x1caaf9){return _0x1caaf9[_0x7e3d('0x25')]()[_0x7e3d('0x24')](function(){_0x4ab4e8[_0x7e3d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f2bc,_0x1ddc62){return function(_0x1646d7){if(!_0x1646d7){_0x51f2bc[_0x7e3d('0x26')](0x194);}return _0x1646d7;};}function handleError(_0x40e1c4,_0xbdf47c){_0xbdf47c=_0xbdf47c||0x1f4;return function(_0x2cee9e){logger[_0x7e3d('0x27')](_0x2cee9e[_0x7e3d('0x28')]);if(_0x2cee9e[_0x7e3d('0x29')]){delete _0x2cee9e[_0x7e3d('0x29')];}_0x40e1c4[_0x7e3d('0x1a')](_0xbdf47c)['send'](_0x2cee9e);};}exports[_0x7e3d('0x2a')]=function(_0xd090b2,_0x28a71b){var _0x57ee77={},_0x134762={},_0x579959={'count':0x0,'rows':[]};var _0x4f646f=_['map'](db[_0x7e3d('0x2b')][_0x7e3d('0x2c')],function(_0x5564d7){return{'name':_0x5564d7[_0x7e3d('0x2d')],'type':_0x5564d7[_0x7e3d('0x2e')]['key']};});_0x134762[_0x7e3d('0x2f')]=_[_0x7e3d('0x30')](_0x4f646f,_0x7e3d('0x29'));_0x134762[_0x7e3d('0x31')]=_[_0x7e3d('0x32')](_0xd090b2[_0x7e3d('0x31')]);_0x134762['filters']=_[_0x7e3d('0x33')](_0x134762[_0x7e3d('0x2f')],_0x134762['query']);_0x57ee77[_0x7e3d('0x34')]=_[_0x7e3d('0x33')](_0x134762[_0x7e3d('0x2f')],qs[_0x7e3d('0x35')](_0xd090b2[_0x7e3d('0x31')][_0x7e3d('0x35')]));_0x57ee77[_0x7e3d('0x34')]=_0x57ee77[_0x7e3d('0x34')][_0x7e3d('0x36')]?_0x57ee77[_0x7e3d('0x34')]:_0x134762[_0x7e3d('0x2f')];if(!_0xd090b2[_0x7e3d('0x31')][_0x7e3d('0x37')](_0x7e3d('0x38'))){_0x57ee77[_0x7e3d('0x1c')]=qs[_0x7e3d('0x1c')](_0xd090b2[_0x7e3d('0x31')]['limit']);_0x57ee77[_0x7e3d('0x1e')]=qs[_0x7e3d('0x1e')](_0xd090b2[_0x7e3d('0x31')][_0x7e3d('0x1e')]);}_0x57ee77['order']=qs[_0x7e3d('0x39')](_0xd090b2[_0x7e3d('0x31')][_0x7e3d('0x39')]);_0x57ee77['where']=qs[_0x7e3d('0x3a')](_['pick'](_0xd090b2[_0x7e3d('0x31')],_0x134762[_0x7e3d('0x3a')]),_0x4f646f);if(_0xd090b2[_0x7e3d('0x31')]['filter']){_0x57ee77[_0x7e3d('0x3b')]=_[_0x7e3d('0x3c')](_0x57ee77[_0x7e3d('0x3b')],{'$or':_[_0x7e3d('0x30')](_0x4f646f,function(_0x17130e){if(_0x17130e[_0x7e3d('0x2e')]!==_0x7e3d('0x3d')){var _0x5ea5b8={};_0x5ea5b8[_0x17130e[_0x7e3d('0x29')]]={'$like':'%'+_0xd090b2[_0x7e3d('0x31')][_0x7e3d('0x3e')]+'%'};return _0x5ea5b8;}})});}_0x57ee77=_[_0x7e3d('0x3c')]({},_0x57ee77,_0xd090b2['options']);var _0x19555b={'where':_0x57ee77[_0x7e3d('0x3b')]};return db[_0x7e3d('0x2b')]['count'](_0x19555b)[_0x7e3d('0x24')](function(_0x219c9c){_0x579959['count']=_0x219c9c;if(_0xd090b2['query'][_0x7e3d('0x3f')]){_0x57ee77['include']=[{'all':!![]}];}return db['DeskAccount'][_0x7e3d('0x40')](_0x57ee77);})[_0x7e3d('0x24')](function(_0x4acdd4){_0x579959[_0x7e3d('0x41')]=_0x4acdd4;return _0x579959;})[_0x7e3d('0x24')](respondWithFilteredResult(_0x28a71b,_0x57ee77))[_0x7e3d('0x42')](handleError(_0x28a71b,null));};exports['show']=function(_0x67d58a,_0x29df2c){var _0x12a7f4={'raw':![],'where':{'id':_0x67d58a[_0x7e3d('0x43')]['id']}},_0xdef9ff={};_0xdef9ff['model']=_[_0x7e3d('0x32')](db[_0x7e3d('0x2b')][_0x7e3d('0x2c')]);_0xdef9ff[_0x7e3d('0x31')]=_[_0x7e3d('0x32')](_0x67d58a[_0x7e3d('0x31')]);_0xdef9ff[_0x7e3d('0x3a')]=_[_0x7e3d('0x33')](_0xdef9ff[_0x7e3d('0x2f')],_0xdef9ff[_0x7e3d('0x31')]);_0x12a7f4[_0x7e3d('0x34')]=_[_0x7e3d('0x33')](_0xdef9ff[_0x7e3d('0x2f')],qs[_0x7e3d('0x35')](_0x67d58a['query'][_0x7e3d('0x35')]));_0x12a7f4[_0x7e3d('0x34')]=_0x12a7f4[_0x7e3d('0x34')]['length']?_0x12a7f4['attributes']:_0xdef9ff[_0x7e3d('0x2f')];if(_0x67d58a[_0x7e3d('0x31')][_0x7e3d('0x3f')]){_0x12a7f4[_0x7e3d('0x44')]=[{'all':!![]}];}_0x12a7f4=_['merge']({},_0x12a7f4,_0x67d58a[_0x7e3d('0x45')]);return db[_0x7e3d('0x2b')][_0x7e3d('0x46')](_0x12a7f4)[_0x7e3d('0x24')](handleEntityNotFound(_0x29df2c,null))[_0x7e3d('0x24')](respondWithResult(_0x29df2c,null))[_0x7e3d('0x42')](handleError(_0x29df2c,null));};exports[_0x7e3d('0x47')]=function(_0x3d7ea8,_0x1aa9f9){return db[_0x7e3d('0x2b')][_0x7e3d('0x47')](_0x3d7ea8[_0x7e3d('0x48')],{})[_0x7e3d('0x24')](respondWithResult(_0x1aa9f9,0xc9))[_0x7e3d('0x42')](handleError(_0x1aa9f9,null));};exports[_0x7e3d('0x49')]=function(_0x5b1bae,_0x126b30){if(_0x5b1bae[_0x7e3d('0x48')]['id']){delete _0x5b1bae[_0x7e3d('0x48')]['id'];}return db[_0x7e3d('0x2b')][_0x7e3d('0x46')]({'where':{'id':_0x5b1bae[_0x7e3d('0x43')]['id']}})[_0x7e3d('0x24')](handleEntityNotFound(_0x126b30,null))[_0x7e3d('0x24')](saveUpdates(_0x5b1bae[_0x7e3d('0x48')],null))[_0x7e3d('0x24')](respondWithResult(_0x126b30,null))[_0x7e3d('0x42')](handleError(_0x126b30,null));};exports[_0x7e3d('0x25')]=function(_0x1b2335,_0x5572a1){return db['DeskAccount'][_0x7e3d('0x46')]({'where':{'id':_0x1b2335[_0x7e3d('0x43')]['id']}})['then'](handleEntityNotFound(_0x5572a1,null))[_0x7e3d('0x24')](removeEntity(_0x5572a1,null))[_0x7e3d('0x42')](handleError(_0x5572a1,null));};exports[_0x7e3d('0x4a')]=function(_0x52e19e,_0x157fc4,_0x4a988e){var _0x541c01={};var _0x4885c4={};var _0x32a1cb;var _0x239d51;return db[_0x7e3d('0x2b')]['findOne']({'where':{'id':_0x52e19e['params']['id']}})[_0x7e3d('0x24')](handleEntityNotFound(_0x157fc4,null))[_0x7e3d('0x24')](function(_0x2afb1b){if(_0x2afb1b){_0x32a1cb=_0x2afb1b;_0x4885c4[_0x7e3d('0x2f')]=_[_0x7e3d('0x32')](db['DeskConfiguration'][_0x7e3d('0x2c')]);_0x4885c4[_0x7e3d('0x31')]=_[_0x7e3d('0x32')](_0x52e19e[_0x7e3d('0x31')]);_0x4885c4[_0x7e3d('0x3a')]=_[_0x7e3d('0x33')](_0x4885c4['model'],_0x4885c4[_0x7e3d('0x31')]);_0x541c01[_0x7e3d('0x34')]=_['intersection'](_0x4885c4[_0x7e3d('0x2f')],qs[_0x7e3d('0x35')](_0x52e19e['query'][_0x7e3d('0x35')]));_0x541c01[_0x7e3d('0x34')]=_0x541c01['attributes'][_0x7e3d('0x36')]?_0x541c01[_0x7e3d('0x34')]:_0x4885c4[_0x7e3d('0x2f')];_0x541c01['order']=qs[_0x7e3d('0x39')](_0x52e19e['query'][_0x7e3d('0x39')]);_0x541c01[_0x7e3d('0x3b')]=qs[_0x7e3d('0x3a')](_[_0x7e3d('0x4b')](_0x52e19e['query'],_0x4885c4[_0x7e3d('0x3a')]));if(_0x52e19e[_0x7e3d('0x31')]['filter']){_0x541c01['where']=_[_0x7e3d('0x3c')](_0x541c01[_0x7e3d('0x3b')],{'$or':_[_0x7e3d('0x30')](_0x541c01['attributes'],function(_0x42a2e0){var _0x55c675={};_0x55c675[_0x42a2e0]={'$like':'%'+_0x52e19e['query']['filter']+'%'};return _0x55c675;})});}_0x541c01=_['merge']({},_0x541c01,_0x52e19e[_0x7e3d('0x45')]);return _0x32a1cb[_0x7e3d('0x4a')](_0x541c01);}})[_0x7e3d('0x24')](function(_0x4d7a2c){if(_0x4d7a2c){_0x239d51=_0x4d7a2c[_0x7e3d('0x36')];if(!_0x52e19e[_0x7e3d('0x31')][_0x7e3d('0x37')](_0x7e3d('0x38'))){_0x541c01[_0x7e3d('0x1c')]=qs[_0x7e3d('0x1c')](_0x52e19e[_0x7e3d('0x31')][_0x7e3d('0x1c')]);_0x541c01[_0x7e3d('0x1e')]=qs[_0x7e3d('0x1e')](_0x52e19e[_0x7e3d('0x31')][_0x7e3d('0x1e')]);}return _0x32a1cb[_0x7e3d('0x4a')](_0x541c01);}})['then'](function(_0x230f1c){if(_0x230f1c){return _0x230f1c?{'count':_0x239d51,'rows':_0x230f1c}:null;}})['then'](respondWithResult(_0x157fc4,null))[_0x7e3d('0x42')](handleError(_0x157fc4,null));};exports[_0x7e3d('0x4c')]=function(_0x10365a,_0x20db85,_0x5a0d78){if(_0x10365a[_0x7e3d('0x48')]['id']){delete _0x10365a[_0x7e3d('0x48')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x10365a['params']['id']}})[_0x7e3d('0x24')](handleEntityNotFound(_0x20db85,null))['then'](function(_0x3371f1){if(_0x3371f1){_0x10365a[_0x7e3d('0x48')][_0x7e3d('0x4d')]=_0x3371f1['id'];_0x10365a[_0x7e3d('0x48')][_0x7e3d('0x4e')]=integrations[_0x7e3d('0x4f')](_0x10365a[_0x7e3d('0x48')][_0x7e3d('0x50')],_0x10365a['body']['type']);_0x10365a[_0x7e3d('0x48')][_0x7e3d('0x51')]=integrations[_0x7e3d('0x52')](_0x10365a[_0x7e3d('0x48')][_0x7e3d('0x50')],_0x10365a[_0x7e3d('0x48')][_0x7e3d('0x2e')]);return db['DeskConfiguration'][_0x7e3d('0x47')](_0x10365a[_0x7e3d('0x48')],{'include':[{'model':db['DeskField'],'as':_0x7e3d('0x4e')},{'model':db[_0x7e3d('0x53')],'as':_0x7e3d('0x51')}]});}return null;})['then'](respondWithResult(_0x20db85,null))[_0x7e3d('0x42')](handleError(_0x20db85,null));};exports[_0x7e3d('0x54')]=function(_0x4dcbf5,_0x3fa7c2,_0x4c3b78){var _0x11355c=[{'name':_0x7e3d('0x55'),'label':_0x7e3d('0x55'),'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 _0x268ae5='';return db[_0x7e3d('0x2b')][_0x7e3d('0x56')]({'where':{'id':_0x4dcbf5[_0x7e3d('0x43')]['id']},'attributes':['id',_0x7e3d('0x57'),_0x7e3d('0x58'),'username',_0x7e3d('0x59'),_0x7e3d('0x5a'),_0x7e3d('0x5b'),_0x7e3d('0x5c'),_0x7e3d('0x5d')]})['then'](handleEntityNotFound(_0x3fa7c2,null))['then'](function(_0x1c8a56){if(_0x1c8a56){_0x268ae5=_0x1c8a56[_0x7e3d('0x57')];var _0x54f62a=_0x268ae5['slice'](-0x1);if(_0x54f62a==='/'){_0x268ae5=_0x268ae5[_0x7e3d('0x5e')](0x0,_0x268ae5['lastIndexOf'](_0x54f62a));}var _0x4f02b3={'method':_0x7e3d('0x5f'),'uri':util[_0x7e3d('0x60')](_0x7e3d('0x61'),_0x268ae5),'headers':{'Content-Type':_0x7e3d('0x62'),'Accept':'application/json'},'json':!![]};if(_0x1c8a56[_0x7e3d('0x58')]===_0x7e3d('0x63')){_0x4f02b3['headers'][_0x7e3d('0x64')]=util[_0x7e3d('0x60')](_0x7e3d('0x65'),new Buffer(util[_0x7e3d('0x60')](_0x7e3d('0x66'),_0x1c8a56[_0x7e3d('0x67')],_0x1c8a56['password']))['toString']('base64'));}return rp(_0x4f02b3)[_0x7e3d('0x24')](function(_0x204970){return _0x11355c[_0x7e3d('0x68')](_[_0x7e3d('0x30')](_0x204970['_embedded'][_0x7e3d('0x69')],function(_0x2d2575){return{'id':_0x2d2575[_0x7e3d('0x29')],'name':_0x2d2575[_0x7e3d('0x29')],'type':_0x2d2575[_0x7e3d('0x2e')],'active':_0x2d2575[_0x7e3d('0x6a')],'label':_0x2d2575['label'],'custom':!![]};}));});}})[_0x7e3d('0x24')](function(_0x27b9fc){return{'count':_0x27b9fc[_0x7e3d('0x36')],'rows':_0x27b9fc};})[_0x7e3d('0x24')](respondWithResult(_0x3fa7c2,null))[_0x7e3d('0x42')](function(_0xfe745c){var _0xbcf45a=_0x4dcbf5[_0x7e3d('0x31')][_0x7e3d('0x6b')]?0x1f4:_0xfe745c[_0x7e3d('0x6c')]||0x1f4;logger[_0x7e3d('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xbcf45a,JSON[_0x7e3d('0x6d')](_0xfe745c));delete _0xfe745c[_0x7e3d('0x29')];if(_0xbcf45a===0x191){_0xbcf45a=0x190;}_0x3fa7c2['status'](_0xbcf45a)[_0x7e3d('0x6e')](_0x4dcbf5['query'][_0x7e3d('0x6b')]?{'message':_0x7e3d('0x6f'),'statusCode':_0xfe745c[_0x7e3d('0x6c')]}:_0xfe745c);});}; \ No newline at end of file +var _0xa97f=['getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','error','name','map','DeskAccount','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','intersection','length','create','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','password','consumerKey','tokenSecret','slice','lastIndexOf','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','label','test','statusCode'];(function(_0x38f497,_0x11e083){var _0x42cd5c=function(_0x599850){while(--_0x599850){_0x38f497['push'](_0x38f497['shift']());}};_0x42cd5c(++_0x11e083);}(_0xa97f,0x1c0));var _0xfa97=function(_0x374d48,_0x4d7968){_0x374d48=_0x374d48-0x0;var _0x483252=_0xa97f[_0x374d48];return _0x483252;};'use strict';var emlformat=require(_0xfa97('0x0'));var rimraf=require(_0xfa97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa97('0x2'));var rp=require(_0xfa97('0x3'));var moment=require(_0xfa97('0x4'));var BPromise=require(_0xfa97('0x5'));var Mustache=require(_0xfa97('0x6'));var util=require('util');var path=require(_0xfa97('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa97('0x8'));var fs=require('fs');var fs_extra=require(_0xfa97('0x9'));var _=require(_0xfa97('0xa'));var squel=require(_0xfa97('0xb'));var crypto=require(_0xfa97('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfa97('0xd'));var toCsv=require(_0xfa97('0xe'));var querystring=require(_0xfa97('0xf'));var Papa=require(_0xfa97('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa97('0x11'));var hardwareService=require(_0xfa97('0x12'));var logger=require(_0xfa97('0x13'))(_0xfa97('0x14'));var utils=require('../../config/utils');var config=require(_0xfa97('0x15'));var licenseUtil=require(_0xfa97('0x16'));var db=require(_0xfa97('0x17'))['db'];var integrations=require(_0xfa97('0x18'));function respondWithStatusCode(_0x5bb379,_0x152b88){_0x152b88=_0x152b88||0xcc;return function(_0x5c2900){if(_0x5c2900){return _0x5bb379[_0xfa97('0x19')](_0x152b88);}return _0x5bb379['status'](_0x152b88)[_0xfa97('0x1a')]();};}function respondWithResult(_0x2d4879,_0x42f259){_0x42f259=_0x42f259||0xc8;return function(_0x35beab){if(_0x35beab){return _0x2d4879[_0xfa97('0x1b')](_0x42f259)[_0xfa97('0x1c')](_0x35beab);}};}function respondWithFilteredResult(_0x558276,_0x2a836f){return function(_0x42de89){if(_0x42de89){var _0x3ae45f=typeof _0x2a836f['offset']===_0xfa97('0x1d')&&typeof _0x2a836f[_0xfa97('0x1e')]===_0xfa97('0x1d');var _0x1accf1=_0x42de89[_0xfa97('0x1f')];var _0x30674b=_0x3ae45f?0x0:_0x2a836f[_0xfa97('0x20')];var _0x12b47d=_0x3ae45f?_0x42de89[_0xfa97('0x1f')]:_0x2a836f['offset']+_0x2a836f[_0xfa97('0x1e')];var _0x2029d2;if(_0x12b47d>=_0x1accf1){_0x12b47d=_0x1accf1;_0x2029d2=0xc8;}else{_0x2029d2=0xce;}_0x558276[_0xfa97('0x1b')](_0x2029d2);return _0x558276['set'](_0xfa97('0x21'),_0x30674b+'-'+_0x12b47d+'/'+_0x1accf1)[_0xfa97('0x1c')](_0x42de89);}return null;};}function patchUpdates(_0x9be362){return function(_0x3e4cfb){try{jsonpatch['apply'](_0x3e4cfb,_0x9be362,!![]);}catch(_0x5bf190){return BPromise[_0xfa97('0x22')](_0x5bf190);}return _0x3e4cfb['save']();};}function saveUpdates(_0x372cb1,_0x128484){return function(_0xaf2d78){if(_0xaf2d78){return _0xaf2d78[_0xfa97('0x23')](_0x372cb1)[_0xfa97('0x24')](function(_0x3cc74f){return _0x3cc74f;});}return null;};}function removeEntity(_0x1b579b,_0x601a88){return function(_0x3d4be3){if(_0x3d4be3){return _0x3d4be3[_0xfa97('0x25')]()[_0xfa97('0x24')](function(){_0x1b579b[_0xfa97('0x1b')](0xcc)[_0xfa97('0x1a')]();});}};}function handleEntityNotFound(_0x2d85c0,_0x3be0a4){return function(_0x655883){if(!_0x655883){_0x2d85c0[_0xfa97('0x19')](0x194);}return _0x655883;};}function handleError(_0x571697,_0x4a366c){_0x4a366c=_0x4a366c||0x1f4;return function(_0x4777fd){logger[_0xfa97('0x26')](_0x4777fd['stack']);if(_0x4777fd[_0xfa97('0x27')]){delete _0x4777fd[_0xfa97('0x27')];}_0x571697[_0xfa97('0x1b')](_0x4a366c)['send'](_0x4777fd);};}exports['index']=function(_0xbb6ff3,_0x4e51ef){var _0x5adfa4={},_0x4e4cfc={},_0xc92fa6={'count':0x0,'rows':[]};var _0x41ee8c=_[_0xfa97('0x28')](db[_0xfa97('0x29')][_0xfa97('0x2a')],function(_0x14bc4e){return{'name':_0x14bc4e[_0xfa97('0x2b')],'type':_0x14bc4e[_0xfa97('0x2c')]['key']};});_0x4e4cfc[_0xfa97('0x2d')]=_[_0xfa97('0x28')](_0x41ee8c,_0xfa97('0x27'));_0x4e4cfc[_0xfa97('0x2e')]=_['keys'](_0xbb6ff3[_0xfa97('0x2e')]);_0x4e4cfc[_0xfa97('0x2f')]=_['intersection'](_0x4e4cfc[_0xfa97('0x2d')],_0x4e4cfc[_0xfa97('0x2e')]);_0x5adfa4[_0xfa97('0x30')]=_['intersection'](_0x4e4cfc[_0xfa97('0x2d')],qs[_0xfa97('0x31')](_0xbb6ff3['query'][_0xfa97('0x31')]));_0x5adfa4[_0xfa97('0x30')]=_0x5adfa4[_0xfa97('0x30')]['length']?_0x5adfa4['attributes']:_0x4e4cfc[_0xfa97('0x2d')];if(!_0xbb6ff3[_0xfa97('0x2e')][_0xfa97('0x32')](_0xfa97('0x33'))){_0x5adfa4['limit']=qs[_0xfa97('0x1e')](_0xbb6ff3[_0xfa97('0x2e')][_0xfa97('0x1e')]);_0x5adfa4[_0xfa97('0x20')]=qs[_0xfa97('0x20')](_0xbb6ff3[_0xfa97('0x2e')]['offset']);}_0x5adfa4[_0xfa97('0x34')]=qs[_0xfa97('0x35')](_0xbb6ff3[_0xfa97('0x2e')][_0xfa97('0x35')]);_0x5adfa4[_0xfa97('0x36')]=qs[_0xfa97('0x2f')](_[_0xfa97('0x37')](_0xbb6ff3[_0xfa97('0x2e')],_0x4e4cfc['filters']),_0x41ee8c);if(_0xbb6ff3[_0xfa97('0x2e')][_0xfa97('0x38')]){_0x5adfa4[_0xfa97('0x36')]=_[_0xfa97('0x39')](_0x5adfa4[_0xfa97('0x36')],{'$or':_[_0xfa97('0x28')](_0x41ee8c,function(_0x20d6c8){if(_0x20d6c8[_0xfa97('0x2c')]!==_0xfa97('0x3a')){var _0x11bd81={};_0x11bd81[_0x20d6c8[_0xfa97('0x27')]]={'$like':'%'+_0xbb6ff3[_0xfa97('0x2e')][_0xfa97('0x38')]+'%'};return _0x11bd81;}})});}_0x5adfa4=_['merge']({},_0x5adfa4,_0xbb6ff3[_0xfa97('0x3b')]);var _0x25b547={'where':_0x5adfa4['where']};return db[_0xfa97('0x29')][_0xfa97('0x1f')](_0x25b547)[_0xfa97('0x24')](function(_0x3a760e){_0xc92fa6[_0xfa97('0x1f')]=_0x3a760e;if(_0xbb6ff3[_0xfa97('0x2e')][_0xfa97('0x3c')]){_0x5adfa4[_0xfa97('0x3d')]=[{'all':!![]}];}return db[_0xfa97('0x29')]['findAll'](_0x5adfa4);})[_0xfa97('0x24')](function(_0x44b96a){_0xc92fa6[_0xfa97('0x3e')]=_0x44b96a;return _0xc92fa6;})['then'](respondWithFilteredResult(_0x4e51ef,_0x5adfa4))[_0xfa97('0x3f')](handleError(_0x4e51ef,null));};exports['show']=function(_0x2512cf,_0x57b517){var _0x2c79fd={'raw':![],'where':{'id':_0x2512cf[_0xfa97('0x40')]['id']}},_0xcc7e13={};_0xcc7e13[_0xfa97('0x2d')]=_[_0xfa97('0x41')](db[_0xfa97('0x29')]['rawAttributes']);_0xcc7e13[_0xfa97('0x2e')]=_['keys'](_0x2512cf[_0xfa97('0x2e')]);_0xcc7e13[_0xfa97('0x2f')]=_[_0xfa97('0x42')](_0xcc7e13[_0xfa97('0x2d')],_0xcc7e13[_0xfa97('0x2e')]);_0x2c79fd[_0xfa97('0x30')]=_[_0xfa97('0x42')](_0xcc7e13['model'],qs['fields'](_0x2512cf[_0xfa97('0x2e')][_0xfa97('0x31')]));_0x2c79fd[_0xfa97('0x30')]=_0x2c79fd[_0xfa97('0x30')][_0xfa97('0x43')]?_0x2c79fd[_0xfa97('0x30')]:_0xcc7e13['model'];if(_0x2512cf[_0xfa97('0x2e')][_0xfa97('0x3c')]){_0x2c79fd['include']=[{'all':!![]}];}_0x2c79fd=_[_0xfa97('0x39')]({},_0x2c79fd,_0x2512cf['options']);return db['DeskAccount']['find'](_0x2c79fd)[_0xfa97('0x24')](handleEntityNotFound(_0x57b517,null))[_0xfa97('0x24')](respondWithResult(_0x57b517,null))[_0xfa97('0x3f')](handleError(_0x57b517,null));};exports[_0xfa97('0x44')]=function(_0x4c22eb,_0x1aa35d){return db[_0xfa97('0x29')]['create'](_0x4c22eb[_0xfa97('0x45')],{})[_0xfa97('0x24')](respondWithResult(_0x1aa35d,0xc9))[_0xfa97('0x3f')](handleError(_0x1aa35d,null));};exports[_0xfa97('0x23')]=function(_0x5e9b26,_0x37730d){if(_0x5e9b26[_0xfa97('0x45')]['id']){delete _0x5e9b26['body']['id'];}return db[_0xfa97('0x29')][_0xfa97('0x46')]({'where':{'id':_0x5e9b26[_0xfa97('0x40')]['id']}})[_0xfa97('0x24')](handleEntityNotFound(_0x37730d,null))['then'](saveUpdates(_0x5e9b26[_0xfa97('0x45')],null))[_0xfa97('0x24')](respondWithResult(_0x37730d,null))[_0xfa97('0x3f')](handleError(_0x37730d,null));};exports['destroy']=function(_0x5bf8d2,_0x3a3bbd){return db[_0xfa97('0x29')][_0xfa97('0x46')]({'where':{'id':_0x5bf8d2[_0xfa97('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a3bbd,null))[_0xfa97('0x24')](removeEntity(_0x3a3bbd,null))['catch'](handleError(_0x3a3bbd,null));};exports[_0xfa97('0x47')]=function(_0x2a28e7,_0x3d6699,_0x496522){var _0x236d96={};var _0x504d3b={};var _0xb77769;var _0x4cef12;return db[_0xfa97('0x29')][_0xfa97('0x48')]({'where':{'id':_0x2a28e7[_0xfa97('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d6699,null))[_0xfa97('0x24')](function(_0x2813a5){if(_0x2813a5){_0xb77769=_0x2813a5;_0x504d3b[_0xfa97('0x2d')]=_['keys'](db[_0xfa97('0x49')]['rawAttributes']);_0x504d3b['query']=_[_0xfa97('0x41')](_0x2a28e7[_0xfa97('0x2e')]);_0x504d3b[_0xfa97('0x2f')]=_[_0xfa97('0x42')](_0x504d3b[_0xfa97('0x2d')],_0x504d3b['query']);_0x236d96[_0xfa97('0x30')]=_[_0xfa97('0x42')](_0x504d3b[_0xfa97('0x2d')],qs[_0xfa97('0x31')](_0x2a28e7['query'][_0xfa97('0x31')]));_0x236d96[_0xfa97('0x30')]=_0x236d96[_0xfa97('0x30')]['length']?_0x236d96[_0xfa97('0x30')]:_0x504d3b[_0xfa97('0x2d')];_0x236d96[_0xfa97('0x34')]=qs['sort'](_0x2a28e7[_0xfa97('0x2e')][_0xfa97('0x35')]);_0x236d96[_0xfa97('0x36')]=qs[_0xfa97('0x2f')](_['pick'](_0x2a28e7[_0xfa97('0x2e')],_0x504d3b[_0xfa97('0x2f')]));if(_0x2a28e7[_0xfa97('0x2e')][_0xfa97('0x38')]){_0x236d96[_0xfa97('0x36')]=_[_0xfa97('0x39')](_0x236d96[_0xfa97('0x36')],{'$or':_[_0xfa97('0x28')](_0x236d96[_0xfa97('0x30')],function(_0x70a66){var _0x7c067c={};_0x7c067c[_0x70a66]={'$like':'%'+_0x2a28e7[_0xfa97('0x2e')][_0xfa97('0x38')]+'%'};return _0x7c067c;})});}_0x236d96=_[_0xfa97('0x39')]({},_0x236d96,_0x2a28e7[_0xfa97('0x3b')]);return _0xb77769[_0xfa97('0x47')](_0x236d96);}})[_0xfa97('0x24')](function(_0x46d238){if(_0x46d238){_0x4cef12=_0x46d238[_0xfa97('0x43')];if(!_0x2a28e7[_0xfa97('0x2e')][_0xfa97('0x32')](_0xfa97('0x33'))){_0x236d96[_0xfa97('0x1e')]=qs[_0xfa97('0x1e')](_0x2a28e7[_0xfa97('0x2e')][_0xfa97('0x1e')]);_0x236d96[_0xfa97('0x20')]=qs[_0xfa97('0x20')](_0x2a28e7[_0xfa97('0x2e')][_0xfa97('0x20')]);}return _0xb77769[_0xfa97('0x47')](_0x236d96);}})[_0xfa97('0x24')](function(_0x381987){if(_0x381987){return _0x381987?{'count':_0x4cef12,'rows':_0x381987}:null;}})[_0xfa97('0x24')](respondWithResult(_0x3d6699,null))[_0xfa97('0x3f')](handleError(_0x3d6699,null));};exports[_0xfa97('0x4a')]=function(_0x483ccb,_0x1d4dcb,_0x22296c){if(_0x483ccb['body']['id']){delete _0x483ccb[_0xfa97('0x45')]['id'];}return db['DeskAccount'][_0xfa97('0x48')]({'where':{'id':_0x483ccb[_0xfa97('0x40')]['id']}})[_0xfa97('0x24')](handleEntityNotFound(_0x1d4dcb,null))[_0xfa97('0x24')](function(_0x4fd4bd){if(_0x4fd4bd){_0x483ccb[_0xfa97('0x45')][_0xfa97('0x4b')]=_0x4fd4bd['id'];_0x483ccb['body'][_0xfa97('0x4c')]=integrations[_0xfa97('0x4d')](_0x483ccb[_0xfa97('0x45')][_0xfa97('0x4e')],_0x483ccb[_0xfa97('0x45')][_0xfa97('0x2c')]);_0x483ccb[_0xfa97('0x45')]['Descriptions']=integrations['getDescriptions'](_0x483ccb['body'][_0xfa97('0x4e')],_0x483ccb['body']['type']);return db[_0xfa97('0x49')][_0xfa97('0x44')](_0x483ccb[_0xfa97('0x45')],{'include':[{'model':db[_0xfa97('0x4f')],'as':'Subjects'},{'model':db['DeskField'],'as':_0xfa97('0x50')}]});}return null;})[_0xfa97('0x24')](respondWithResult(_0x1d4dcb,null))[_0xfa97('0x3f')](handleError(_0x1d4dcb,null));};exports[_0xfa97('0x51')]=function(_0x19cdc3,_0x46d980,_0x790059){var _0x8d8dac=[{'name':'priority','label':_0xfa97('0x52'),'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 _0xc680f3='';return db[_0xfa97('0x29')][_0xfa97('0x48')]({'where':{'id':_0x19cdc3[_0xfa97('0x40')]['id']},'attributes':['id',_0xfa97('0x53'),_0xfa97('0x54'),'username',_0xfa97('0x55'),_0xfa97('0x56'),'consumerSecret','token',_0xfa97('0x57')]})['then'](handleEntityNotFound(_0x46d980,null))[_0xfa97('0x24')](function(_0x43c338){if(_0x43c338){_0xc680f3=_0x43c338['remoteUri'];var _0x2fe32c=_0xc680f3[_0xfa97('0x58')](-0x1);if(_0x2fe32c==='/'){_0xc680f3=_0xc680f3['substring'](0x0,_0xc680f3[_0xfa97('0x59')](_0x2fe32c));}var _0x20deba={'method':'GET','uri':util['format'](_0xfa97('0x5a'),_0xc680f3),'headers':{'Content-Type':_0xfa97('0x5b'),'Accept':_0xfa97('0x5b')},'json':!![]};if(_0x43c338[_0xfa97('0x54')]===_0xfa97('0x5c')){_0x20deba[_0xfa97('0x5d')][_0xfa97('0x5e')]=util[_0xfa97('0x5f')](_0xfa97('0x60'),new Buffer(util[_0xfa97('0x5f')](_0xfa97('0x61'),_0x43c338[_0xfa97('0x62')],_0x43c338['password']))[_0xfa97('0x63')](_0xfa97('0x64')));}return rp(_0x20deba)[_0xfa97('0x24')](function(_0x79bedb){return _0x8d8dac[_0xfa97('0x65')](_['map'](_0x79bedb[_0xfa97('0x66')][_0xfa97('0x67')],function(_0xf63e13){return{'id':_0xf63e13[_0xfa97('0x27')],'name':_0xf63e13['name'],'type':_0xf63e13[_0xfa97('0x2c')],'active':_0xf63e13['active'],'label':_0xf63e13[_0xfa97('0x68')],'custom':!![]};}));});}})[_0xfa97('0x24')](function(_0x53ca5){return{'count':_0x53ca5['length'],'rows':_0x53ca5};})[_0xfa97('0x24')](respondWithResult(_0x46d980,null))[_0xfa97('0x3f')](function(_0x441bb9){var _0x19d164=_0x19cdc3[_0xfa97('0x2e')][_0xfa97('0x69')]?0x1f4:_0x441bb9[_0xfa97('0x6a')]||0x1f4;logger[_0xfa97('0x26')](_0xfa97('0x6b'),_0xfa97('0x51'),_0x19d164,JSON[_0xfa97('0x6c')](_0x441bb9));delete _0x441bb9[_0xfa97('0x27')];if(_0x19d164===0x191){_0x19d164=0x190;}_0x46d980['status'](_0x19d164)[_0xfa97('0x6d')](_0x19cdc3[_0xfa97('0x2e')][_0xfa97('0x69')]?{'message':_0xfa97('0x6e'),'statusCode':_0x441bb9[_0xfa97('0x6a')]}:_0x441bb9);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8cb9336..5cccf2c 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 _0x10d4=['path','rimraf','../../config/environment','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x35d99f,_0x3a9642){var _0x474ead=function(_0x117c94){while(--_0x117c94){_0x35d99f['push'](_0x35d99f['shift']());}};_0x474ead(++_0x3a9642);}(_0x10d4,0x13f));var _0x410d=function(_0x329485,_0x4f7e0d){_0x329485=_0x329485-0x0;var _0x3dd0bb=_0x10d4[_0x329485];return _0x3dd0bb;};'use strict';var _=require(_0x410d('0x0'));var util=require('util');var logger=require(_0x410d('0x1'))(_0x410d('0x2'));var moment=require(_0x410d('0x3'));var BPromise=require(_0x410d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x410d('0x5'));var rimraf=require(_0x410d('0x6'));var config=require(_0x410d('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x410d('0x8'));module['exports']=function(_0x50657f,_0x365a14){return _0x50657f[_0x410d('0x9')](_0x410d('0xa'),attributes,{'tableName':_0x410d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27ef=['moment','path','rimraf','../../config/environment','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x230542,_0x519fea){var _0x3e54c3=function(_0x11bcc9){while(--_0x11bcc9){_0x230542['push'](_0x230542['shift']());}};_0x3e54c3(++_0x519fea);}(_0x27ef,0x141));var _0xf27e=function(_0xd2811e,_0x168a67){_0xd2811e=_0xd2811e-0x0;var _0x9a2a53=_0x27ef[_0xd2811e];return _0x9a2a53;};'use strict';var _=require(_0xf27e('0x0'));var util=require(_0xf27e('0x1'));var logger=require(_0xf27e('0x2'))('api');var moment=require(_0xf27e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf27e('0x4'));var rimraf=require(_0xf27e('0x5'));var config=require(_0xf27e('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1bafb2,_0x57b4de){return _0x1bafb2['define'](_0xf27e('0x7'),attributes,{'tableName':_0xf27e('0x8'),'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 b103527..d562bef 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 _0xc012=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','options','raw','attributes','limit','include','model','map','then','ShowDeskAccount','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0xc012,0x15d));var _0x2c01=function(_0x453bc4,_0x1a31a0){_0x453bc4=_0x453bc4-0x0;var _0x55476c=_0xc012[_0x453bc4];return _0x55476c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2c01('0x0'));var BPromise=require(_0x2c01('0x1'));var rs=require(_0x2c01('0x2'));var fs=require('fs');var Redis=require(_0x2c01('0x3'));var db=require(_0x2c01('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c01('0x5'))('rpc');var config=require(_0x2c01('0x6'));var jayson=require(_0x2c01('0x7'));var client=jayson[_0x2c01('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5055cd,_0x322a50,_0x4599be){return new BPromise(function(_0x3bc13b,_0x1d2826){return client[_0x2c01('0x9')](_0x5055cd,_0x4599be)['then'](function(_0x4a2ce5){logger[_0x2c01('0xa')](_0x2c01('0xb'),_0x322a50,_0x2c01('0xc'));logger[_0x2c01('0xd')](_0x2c01('0xe'),_0x322a50,'request\x20sent',JSON[_0x2c01('0xf')](_0x4a2ce5));if(_0x4a2ce5['error']){if(_0x4a2ce5[_0x2c01('0x10')][_0x2c01('0x11')]===0x1f4){logger[_0x2c01('0x10')]('DeskAccount,\x20%s,\x20%s',_0x322a50,_0x4a2ce5['error']['message']);return _0x1d2826(_0x4a2ce5['error'][_0x2c01('0x12')]);}logger[_0x2c01('0x10')](_0x2c01('0xb'),_0x322a50,_0x4a2ce5[_0x2c01('0x10')][_0x2c01('0x12')]);return _0x3bc13b(_0x4a2ce5[_0x2c01('0x10')][_0x2c01('0x12')]);}else{logger[_0x2c01('0xa')]('DeskAccount,\x20%s,\x20%s',_0x322a50,_0x2c01('0xc'));_0x3bc13b(_0x4a2ce5['result']['message']);}})[_0x2c01('0x13')](function(_0x3f609f){logger[_0x2c01('0x10')](_0x2c01('0xb'),_0x322a50,_0x3f609f);_0x1d2826(_0x3f609f);});});}exports[_0x2c01('0x14')]=function(_0x462f14){var _0x289bc6=this;return new Promise(function(_0x5082c5,_0x3b3941){return db[_0x2c01('0x15')]['findAll']({'raw':_0x462f14[_0x2c01('0x16')]?_0x462f14['options'][_0x2c01('0x17')]===undefined?!![]:![]:!![],'where':_0x462f14[_0x2c01('0x16')]?_0x462f14[_0x2c01('0x16')]['where']||null:null,'attributes':_0x462f14[_0x2c01('0x16')]?_0x462f14[_0x2c01('0x16')][_0x2c01('0x18')]||null:null,'limit':_0x462f14[_0x2c01('0x16')]?_0x462f14[_0x2c01('0x16')][_0x2c01('0x19')]||null:null,'include':_0x462f14['options']?_0x462f14[_0x2c01('0x16')][_0x2c01('0x1a')]?_['map'](_0x462f14[_0x2c01('0x16')][_0x2c01('0x1a')],function(_0x566af4){return{'model':db[_0x566af4[_0x2c01('0x1b')]],'as':_0x566af4['as'],'attributes':_0x566af4['attributes'],'include':_0x566af4[_0x2c01('0x1a')]?_[_0x2c01('0x1c')](_0x566af4[_0x2c01('0x1a')],function(_0x3316a5){return{'model':db[_0x3316a5[_0x2c01('0x1b')]],'as':_0x3316a5['as'],'attributes':_0x3316a5[_0x2c01('0x18')],'include':_0x3316a5['include']?_[_0x2c01('0x1c')](_0x3316a5[_0x2c01('0x1a')],function(_0x151730){return{'model':db[_0x151730[_0x2c01('0x1b')]],'as':_0x151730['as'],'attributes':_0x151730[_0x2c01('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2c01('0x1d')](function(_0x53f586){logger[_0x2c01('0xa')](_0x2c01('0x14'),_0x462f14);logger[_0x2c01('0xd')](_0x2c01('0x14'),_0x462f14,JSON['stringify'](_0x53f586));_0x5082c5(_0x53f586);})[_0x2c01('0x13')](function(_0x353962){logger[_0x2c01('0x10')](_0x2c01('0x14'),_0x353962[_0x2c01('0x12')],_0x462f14);_0x3b3941(_0x289bc6[_0x2c01('0x10')](0x1f4,_0x353962[_0x2c01('0x12')]));});});};exports[_0x2c01('0x1e')]=function(_0xeed515){var _0x11608d=this;return new Promise(function(_0x1afab6,_0x595a68){return db[_0x2c01('0x15')][_0x2c01('0x1f')]({'raw':_0xeed515[_0x2c01('0x16')]?_0xeed515[_0x2c01('0x16')][_0x2c01('0x17')]===undefined?!![]:![]:!![],'where':_0xeed515[_0x2c01('0x16')]?_0xeed515[_0x2c01('0x16')][_0x2c01('0x20')]||null:null,'attributes':_0xeed515[_0x2c01('0x16')]?_0xeed515[_0x2c01('0x16')][_0x2c01('0x18')]||null:null,'include':_0xeed515[_0x2c01('0x16')]?_0xeed515[_0x2c01('0x16')][_0x2c01('0x1a')]?_[_0x2c01('0x1c')](_0xeed515[_0x2c01('0x16')][_0x2c01('0x1a')],function(_0x572823){return{'model':db[_0x572823[_0x2c01('0x1b')]],'as':_0x572823['as'],'attributes':_0x572823[_0x2c01('0x18')],'include':_0x572823[_0x2c01('0x1a')]?_['map'](_0x572823[_0x2c01('0x1a')],function(_0x932f0a){return{'model':db[_0x932f0a[_0x2c01('0x1b')]],'as':_0x932f0a['as'],'attributes':_0x932f0a[_0x2c01('0x18')],'include':_0x932f0a[_0x2c01('0x1a')]?_[_0x2c01('0x1c')](_0x932f0a[_0x2c01('0x1a')],function(_0x432406){return{'model':db[_0x432406[_0x2c01('0x1b')]],'as':_0x432406['as'],'attributes':_0x432406['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c01('0x1d')](function(_0x1f3e33){logger[_0x2c01('0xa')]('ShowDeskAccount',_0xeed515);logger[_0x2c01('0xd')](_0x2c01('0x1e'),_0xeed515,JSON[_0x2c01('0xf')](_0x1f3e33));_0x1afab6(_0x1f3e33);})['catch'](function(_0x71cbd4){logger['error']('ShowDeskAccount',_0x71cbd4[_0x2c01('0x12')],_0xeed515);_0x595a68(_0x11608d[_0x2c01('0x10')](0x1f4,_0x71cbd4[_0x2c01('0x12')]));});});}; \ No newline at end of file +var _0x3e21=['DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','limit','include','map','attributes','model','then','ShowDeskAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x548a4f,_0x569b74){var _0x391798=function(_0x56b717){while(--_0x56b717){_0x548a4f['push'](_0x548a4f['shift']());}};_0x391798(++_0x569b74);}(_0x3e21,0x1ad));var _0x13e2=function(_0x13ef9a,_0x1948e4){_0x13ef9a=_0x13ef9a-0x0;var _0x7b1235=_0x3e21[_0x13ef9a];return _0x7b1235;};'use strict';var _=require(_0x13e2('0x0'));var util=require(_0x13e2('0x1'));var moment=require(_0x13e2('0x2'));var BPromise=require(_0x13e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13e2('0x4'));var db=require(_0x13e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x13e2('0x6'))(_0x13e2('0x7'));var config=require(_0x13e2('0x8'));var jayson=require(_0x13e2('0x9'));var client=jayson[_0x13e2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ad460,_0x8e4e0e,_0x20408b){return new BPromise(function(_0x49d0a6,_0x52ebdd){return client[_0x13e2('0xb')](_0x5ad460,_0x20408b)['then'](function(_0x2f96ab){logger[_0x13e2('0xc')](_0x13e2('0xd'),_0x8e4e0e,_0x13e2('0xe'));logger[_0x13e2('0xf')](_0x13e2('0x10'),_0x8e4e0e,'request\x20sent',JSON[_0x13e2('0x11')](_0x2f96ab));if(_0x2f96ab['error']){if(_0x2f96ab[_0x13e2('0x12')]['code']===0x1f4){logger[_0x13e2('0x12')]('DeskAccount,\x20%s,\x20%s',_0x8e4e0e,_0x2f96ab[_0x13e2('0x12')][_0x13e2('0x13')]);return _0x52ebdd(_0x2f96ab[_0x13e2('0x12')][_0x13e2('0x13')]);}logger[_0x13e2('0x12')](_0x13e2('0xd'),_0x8e4e0e,_0x2f96ab[_0x13e2('0x12')][_0x13e2('0x13')]);return _0x49d0a6(_0x2f96ab[_0x13e2('0x12')][_0x13e2('0x13')]);}else{logger[_0x13e2('0xc')](_0x13e2('0xd'),_0x8e4e0e,'request\x20sent');_0x49d0a6(_0x2f96ab['result'][_0x13e2('0x13')]);}})[_0x13e2('0x14')](function(_0x1abe54){logger[_0x13e2('0x12')](_0x13e2('0xd'),_0x8e4e0e,_0x1abe54);_0x52ebdd(_0x1abe54);});});}exports[_0x13e2('0x15')]=function(_0x1d6812){var _0x2bd5b2=this;return new Promise(function(_0x545f1d,_0x1b5225){return db[_0x13e2('0x16')][_0x13e2('0x17')]({'raw':_0x1d6812[_0x13e2('0x18')]?_0x1d6812[_0x13e2('0x18')][_0x13e2('0x19')]===undefined?!![]:![]:!![],'where':_0x1d6812[_0x13e2('0x18')]?_0x1d6812[_0x13e2('0x18')]['where']||null:null,'attributes':_0x1d6812[_0x13e2('0x18')]?_0x1d6812['options']['attributes']||null:null,'limit':_0x1d6812[_0x13e2('0x18')]?_0x1d6812[_0x13e2('0x18')][_0x13e2('0x1a')]||null:null,'include':_0x1d6812[_0x13e2('0x18')]?_0x1d6812['options'][_0x13e2('0x1b')]?_[_0x13e2('0x1c')](_0x1d6812['options'][_0x13e2('0x1b')],function(_0x12c6e2){return{'model':db[_0x12c6e2['model']],'as':_0x12c6e2['as'],'attributes':_0x12c6e2[_0x13e2('0x1d')],'include':_0x12c6e2[_0x13e2('0x1b')]?_[_0x13e2('0x1c')](_0x12c6e2[_0x13e2('0x1b')],function(_0x2e8465){return{'model':db[_0x2e8465[_0x13e2('0x1e')]],'as':_0x2e8465['as'],'attributes':_0x2e8465[_0x13e2('0x1d')],'include':_0x2e8465[_0x13e2('0x1b')]?_[_0x13e2('0x1c')](_0x2e8465['include'],function(_0x35cf57){return{'model':db[_0x35cf57[_0x13e2('0x1e')]],'as':_0x35cf57['as'],'attributes':_0x35cf57[_0x13e2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x13e2('0x1f')](function(_0x3c15d2){logger[_0x13e2('0xc')](_0x13e2('0x15'),_0x1d6812);logger[_0x13e2('0xf')](_0x13e2('0x15'),_0x1d6812,JSON['stringify'](_0x3c15d2));_0x545f1d(_0x3c15d2);})['catch'](function(_0x332517){logger[_0x13e2('0x12')]('GetDeskAccount',_0x332517[_0x13e2('0x13')],_0x1d6812);_0x1b5225(_0x2bd5b2[_0x13e2('0x12')](0x1f4,_0x332517[_0x13e2('0x13')]));});});};exports[_0x13e2('0x20')]=function(_0xc75b4f){var _0x39ecec=this;return new Promise(function(_0x48c3c9,_0x261246){return db['DeskAccount']['find']({'raw':_0xc75b4f[_0x13e2('0x18')]?_0xc75b4f[_0x13e2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xc75b4f['options']?_0xc75b4f['options'][_0x13e2('0x21')]||null:null,'attributes':_0xc75b4f[_0x13e2('0x18')]?_0xc75b4f[_0x13e2('0x18')][_0x13e2('0x1d')]||null:null,'include':_0xc75b4f[_0x13e2('0x18')]?_0xc75b4f[_0x13e2('0x18')][_0x13e2('0x1b')]?_[_0x13e2('0x1c')](_0xc75b4f[_0x13e2('0x18')][_0x13e2('0x1b')],function(_0x2e690e){return{'model':db[_0x2e690e[_0x13e2('0x1e')]],'as':_0x2e690e['as'],'attributes':_0x2e690e[_0x13e2('0x1d')],'include':_0x2e690e['include']?_[_0x13e2('0x1c')](_0x2e690e[_0x13e2('0x1b')],function(_0x4a0484){return{'model':db[_0x4a0484[_0x13e2('0x1e')]],'as':_0x4a0484['as'],'attributes':_0x4a0484[_0x13e2('0x1d')],'include':_0x4a0484[_0x13e2('0x1b')]?_['map'](_0x4a0484[_0x13e2('0x1b')],function(_0x1c39e8){return{'model':db[_0x1c39e8[_0x13e2('0x1e')]],'as':_0x1c39e8['as'],'attributes':_0x1c39e8[_0x13e2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x13e2('0x1f')](function(_0x18e25e){logger[_0x13e2('0xc')](_0x13e2('0x20'),_0xc75b4f);logger[_0x13e2('0xf')]('ShowDeskAccount',_0xc75b4f,JSON[_0x13e2('0x11')](_0x18e25e));_0x48c3c9(_0x18e25e);})[_0x13e2('0x14')](function(_0x44d3fd){logger[_0x13e2('0x12')](_0x13e2('0x20'),_0x44d3fd['message'],_0xc75b4f);_0x261246(_0x39ecec[_0x13e2('0x12')](0x1f4,_0x44d3fd['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 45fa2bd..dc6847c 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x53e591,_0x31d705){var _0x159c8e=function(_0x2697d2){while(--_0x2697d2){_0x53e591['push'](_0x53e591['shift']());}};_0x159c8e(++_0x31d705);}(_0x34e8,0x12c));var _0x834e=function(_0x53ba31,_0x34afb5){_0x53ba31=_0x53ba31-0x0;var _0x1e4784=_0x34e8[_0x53ba31];return _0x1e4784;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=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(_0x366b24,_0x1aba82){var _0x45e927=function(_0x12ef4b){while(--_0x12ef4b){_0x366b24['push'](_0x366b24['shift']());}};_0x45e927(++_0x1aba82);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 0589f1d..7e53ba6 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 _0x41b3=['STRING','sequelize','exports'];(function(_0x336615,_0x33b21e){var _0x4d2925=function(_0x4414c6){while(--_0x4414c6){_0x336615['push'](_0x336615['shift']());}};_0x4d2925(++_0x33b21e);}(_0x41b3,0x16f));var _0x341b=function(_0x3a3067,_0x5e74e8){_0x3a3067=_0x3a3067-0x0;var _0x2387e0=_0x41b3[_0x3a3067];return _0x2387e0;};'use strict';var Sequelize=require(_0x341b('0x0'));module[_0x341b('0x1')]={'name':{'type':Sequelize[_0x341b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbfb4=['exports','sequelize'];(function(_0x327753,_0x4a26c8){var _0x11655c=function(_0x2df8cc){while(--_0x2df8cc){_0x327753['push'](_0x327753['shift']());}};_0x11655c(++_0x4a26c8);}(_0xbfb4,0x147));var _0x4bfb=function(_0x21fa07,_0x5619f2){_0x21fa07=_0x21fa07-0x0;var _0x1c08ff=_0xbfb4[_0x21fa07];return _0x1c08ff;};'use strict';var Sequelize=require(_0x4bfb('0x0'));module[_0x4bfb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 777779c..417a0cc 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 _0x763e=['moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','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','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','destroy','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5d4bd,_0x465a36){var _0x41e62e=function(_0x3ce705){while(--_0x3ce705){_0x5d4bd['push'](_0x5d4bd['shift']());}};_0x41e62e(++_0x465a36);}(_0x763e,0xfd));var _0xe763=function(_0x39648c,_0x1b8687){_0x39648c=_0x39648c-0x0;var _0x3f50e1=_0x763e[_0x39648c];return _0x3f50e1;};'use strict';var emlformat=require(_0xe763('0x0'));var rimraf=require(_0xe763('0x1'));var zipdir=require(_0xe763('0x2'));var jsonpatch=require(_0xe763('0x3'));var rp=require(_0xe763('0x4'));var moment=require(_0xe763('0x5'));var BPromise=require(_0xe763('0x6'));var Mustache=require(_0xe763('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe763('0x8'));var csv=require('to-csv');var ejs=require(_0xe763('0x9'));var fs=require('fs');var fs_extra=require(_0xe763('0xa'));var _=require(_0xe763('0xb'));var squel=require(_0xe763('0xc'));var crypto=require(_0xe763('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe763('0xe'));var querystring=require(_0xe763('0xf'));var Papa=require(_0xe763('0x10'));var Redis=require(_0xe763('0x11'));var authService=require(_0xe763('0x12'));var qs=require(_0xe763('0x13'));var as=require(_0xe763('0x14'));var hardwareService=require(_0xe763('0x15'));var logger=require(_0xe763('0x16'))('api');var utils=require(_0xe763('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe763('0x18'));var db=require(_0xe763('0x19'))['db'];function respondWithStatusCode(_0x1c1538,_0x1cba1b){_0x1cba1b=_0x1cba1b||0xcc;return function(_0x81713d){if(_0x81713d){return _0x1c1538['sendStatus'](_0x1cba1b);}return _0x1c1538[_0xe763('0x1a')](_0x1cba1b)['end']();};}function respondWithResult(_0x25c12f,_0x23b1a2){_0x23b1a2=_0x23b1a2||0xc8;return function(_0x51a390){if(_0x51a390){return _0x25c12f[_0xe763('0x1a')](_0x23b1a2)[_0xe763('0x1b')](_0x51a390);}};}function respondWithFilteredResult(_0x51db24,_0x2335f7){return function(_0x50039e){if(_0x50039e){var _0x59cedb=typeof _0x2335f7['offset']===_0xe763('0x1c')&&typeof _0x2335f7[_0xe763('0x1d')]===_0xe763('0x1c');var _0x4ed3b7=_0x50039e[_0xe763('0x1e')];var _0x2f95d8=_0x59cedb?0x0:_0x2335f7[_0xe763('0x1f')];var _0x375928=_0x59cedb?_0x50039e[_0xe763('0x1e')]:_0x2335f7[_0xe763('0x1f')]+_0x2335f7[_0xe763('0x1d')];var _0x3b484f;if(_0x375928>=_0x4ed3b7){_0x375928=_0x4ed3b7;_0x3b484f=0xc8;}else{_0x3b484f=0xce;}_0x51db24[_0xe763('0x1a')](_0x3b484f);return _0x51db24['set'](_0xe763('0x20'),_0x2f95d8+'-'+_0x375928+'/'+_0x4ed3b7)[_0xe763('0x1b')](_0x50039e);}return null;};}function patchUpdates(_0x4f6810){return function(_0x1b92ba){try{jsonpatch[_0xe763('0x21')](_0x1b92ba,_0x4f6810,!![]);}catch(_0x25ea9b){return BPromise[_0xe763('0x22')](_0x25ea9b);}return _0x1b92ba[_0xe763('0x23')]();};}function saveUpdates(_0x1b8c32,_0x5541bf){return function(_0x4a0a88){if(_0x4a0a88){return _0x4a0a88[_0xe763('0x24')](_0x1b8c32)[_0xe763('0x25')](function(_0x3a2426){return _0x3a2426;});}return null;};}function removeEntity(_0x289db1,_0x4090a6){return function(_0x453877){if(_0x453877){return _0x453877['destroy']()[_0xe763('0x25')](function(){_0x289db1['status'](0xcc)[_0xe763('0x26')]();});}};}function handleEntityNotFound(_0x4a1534,_0x188455){return function(_0x3dc45f){if(!_0x3dc45f){_0x4a1534[_0xe763('0x27')](0x194);}return _0x3dc45f;};}function handleError(_0x1789a2,_0x2e427b){_0x2e427b=_0x2e427b||0x1f4;return function(_0x4d0666){logger[_0xe763('0x28')](_0x4d0666[_0xe763('0x29')]);if(_0x4d0666[_0xe763('0x2a')]){delete _0x4d0666[_0xe763('0x2a')];}_0x1789a2[_0xe763('0x1a')](_0x2e427b)[_0xe763('0x2b')](_0x4d0666);};}exports[_0xe763('0x2c')]=function(_0x442773,_0x3365c9){var _0xf32435={},_0x31ff09={},_0x578514={'count':0x0,'rows':[]};var _0xa49b25=_['map'](db[_0xe763('0x2d')][_0xe763('0x2e')],function(_0x3242e9){return{'name':_0x3242e9[_0xe763('0x2f')],'type':_0x3242e9['type']['key']};});_0x31ff09[_0xe763('0x30')]=_[_0xe763('0x31')](_0xa49b25,'name');_0x31ff09[_0xe763('0x32')]=_[_0xe763('0x33')](_0x442773[_0xe763('0x32')]);_0x31ff09[_0xe763('0x34')]=_[_0xe763('0x35')](_0x31ff09['model'],_0x31ff09[_0xe763('0x32')]);_0xf32435[_0xe763('0x36')]=_['intersection'](_0x31ff09[_0xe763('0x30')],qs[_0xe763('0x37')](_0x442773[_0xe763('0x32')][_0xe763('0x37')]));_0xf32435[_0xe763('0x36')]=_0xf32435[_0xe763('0x36')][_0xe763('0x38')]?_0xf32435['attributes']:_0x31ff09['model'];if(!_0x442773[_0xe763('0x32')][_0xe763('0x39')](_0xe763('0x3a'))){_0xf32435[_0xe763('0x1d')]=qs[_0xe763('0x1d')](_0x442773[_0xe763('0x32')][_0xe763('0x1d')]);_0xf32435['offset']=qs[_0xe763('0x1f')](_0x442773[_0xe763('0x32')][_0xe763('0x1f')]);}_0xf32435[_0xe763('0x3b')]=qs[_0xe763('0x3c')](_0x442773['query']['sort']);_0xf32435['where']=qs[_0xe763('0x34')](_[_0xe763('0x3d')](_0x442773['query'],_0x31ff09[_0xe763('0x34')]),_0xa49b25);if(_0x442773[_0xe763('0x32')][_0xe763('0x3e')]){_0xf32435['where']=_['merge'](_0xf32435[_0xe763('0x3f')],{'$or':_[_0xe763('0x31')](_0xa49b25,function(_0x356b4a){if(_0x356b4a[_0xe763('0x40')]!=='VIRTUAL'){var _0x3f9dc2={};_0x3f9dc2[_0x356b4a[_0xe763('0x2a')]]={'$like':'%'+_0x442773[_0xe763('0x32')][_0xe763('0x3e')]+'%'};return _0x3f9dc2;}})});}_0xf32435=_[_0xe763('0x41')]({},_0xf32435,_0x442773['options']);var _0x7946f={'where':_0xf32435[_0xe763('0x3f')]};return db['DeskConfiguration']['count'](_0x7946f)[_0xe763('0x25')](function(_0x4e4e41){_0x578514[_0xe763('0x1e')]=_0x4e4e41;if(_0x442773['query'][_0xe763('0x42')]){_0xf32435[_0xe763('0x43')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xe763('0x44')](_0xf32435);})[_0xe763('0x25')](function(_0x287360){_0x578514[_0xe763('0x45')]=_0x287360;return _0x578514;})['then'](respondWithFilteredResult(_0x3365c9,_0xf32435))[_0xe763('0x46')](handleError(_0x3365c9,null));};exports[_0xe763('0x47')]=function(_0xb7cf95,_0x737728){var _0x529038={'raw':![],'where':{'id':_0xb7cf95[_0xe763('0x48')]['id']}},_0x14b9d4={};_0x14b9d4[_0xe763('0x30')]=_[_0xe763('0x33')](db[_0xe763('0x2d')][_0xe763('0x2e')]);_0x14b9d4[_0xe763('0x32')]=_[_0xe763('0x33')](_0xb7cf95[_0xe763('0x32')]);_0x14b9d4['filters']=_[_0xe763('0x35')](_0x14b9d4[_0xe763('0x30')],_0x14b9d4[_0xe763('0x32')]);_0x529038[_0xe763('0x36')]=_[_0xe763('0x35')](_0x14b9d4[_0xe763('0x30')],qs[_0xe763('0x37')](_0xb7cf95['query'][_0xe763('0x37')]));_0x529038[_0xe763('0x36')]=_0x529038['attributes'][_0xe763('0x38')]?_0x529038['attributes']:_0x14b9d4['model'];if(_0xb7cf95[_0xe763('0x32')]['includeAll']){_0x529038[_0xe763('0x43')]=[{'all':!![]}];}_0x529038=_[_0xe763('0x41')]({},_0x529038,_0xb7cf95[_0xe763('0x49')]);return db[_0xe763('0x2d')]['find'](_0x529038)[_0xe763('0x25')](handleEntityNotFound(_0x737728,null))[_0xe763('0x25')](respondWithResult(_0x737728,null))[_0xe763('0x46')](handleError(_0x737728,null));};exports[_0xe763('0x4a')]=function(_0x5e18b1,_0x2b3910){return db[_0xe763('0x2d')][_0xe763('0x4a')](_0x5e18b1[_0xe763('0x4b')],{})[_0xe763('0x25')](respondWithResult(_0x2b3910,0xc9))[_0xe763('0x46')](handleError(_0x2b3910,null));};exports[_0xe763('0x24')]=function(_0x4ce53e,_0x55e073){if(_0x4ce53e[_0xe763('0x4b')]['id']){delete _0x4ce53e[_0xe763('0x4b')]['id'];}return db['DeskConfiguration'][_0xe763('0x4c')]({'where':{'id':_0x4ce53e[_0xe763('0x48')]['id']}})[_0xe763('0x25')](handleEntityNotFound(_0x55e073,null))['then'](saveUpdates(_0x4ce53e[_0xe763('0x4b')],null))[_0xe763('0x25')](respondWithResult(_0x55e073,null))['catch'](handleError(_0x55e073,null));};exports[_0xe763('0x4d')]=function(_0x2f8057,_0x50f2de){return db[_0xe763('0x2d')]['find']({'where':{'id':_0x2f8057['params']['id']}})['then'](handleEntityNotFound(_0x50f2de,null))['then'](removeEntity(_0x50f2de,null))['catch'](handleError(_0x50f2de,null));};exports[_0xe763('0x4e')]=function(_0x35becb,_0x1a144c,_0x18a60d){var _0x59826f={};var _0x223453={};var _0x3d6ca0;var _0x5d1a4c;return db[_0xe763('0x2d')][_0xe763('0x4f')]({'where':{'id':_0x35becb['params']['id']}})['then'](handleEntityNotFound(_0x1a144c,null))[_0xe763('0x25')](function(_0x1ccafd){if(_0x1ccafd){_0x3d6ca0=_0x1ccafd;_0x223453['model']=_[_0xe763('0x33')](db[_0xe763('0x50')][_0xe763('0x2e')]);_0x223453[_0xe763('0x32')]=_[_0xe763('0x33')](_0x35becb[_0xe763('0x32')]);_0x223453[_0xe763('0x34')]=_[_0xe763('0x35')](_0x223453[_0xe763('0x30')],_0x223453[_0xe763('0x32')]);_0x59826f[_0xe763('0x36')]=_[_0xe763('0x35')](_0x223453[_0xe763('0x30')],qs[_0xe763('0x37')](_0x35becb['query']['fields']));_0x59826f[_0xe763('0x36')]=_0x59826f[_0xe763('0x36')]['length']?_0x59826f[_0xe763('0x36')]:_0x223453['model'];_0x59826f[_0xe763('0x3b')]=qs[_0xe763('0x3c')](_0x35becb[_0xe763('0x32')]['sort']);_0x59826f[_0xe763('0x3f')]=qs['filters'](_[_0xe763('0x3d')](_0x35becb[_0xe763('0x32')],_0x223453[_0xe763('0x34')]));if(_0x35becb[_0xe763('0x32')][_0xe763('0x3e')]){_0x59826f[_0xe763('0x3f')]=_[_0xe763('0x41')](_0x59826f[_0xe763('0x3f')],{'$or':_[_0xe763('0x31')](_0x59826f[_0xe763('0x36')],function(_0x5b76ee){var _0x32eae4={};_0x32eae4[_0x5b76ee]={'$like':'%'+_0x35becb[_0xe763('0x32')][_0xe763('0x3e')]+'%'};return _0x32eae4;})});}_0x59826f=_[_0xe763('0x41')]({},_0x59826f,_0x35becb[_0xe763('0x49')]);return _0x3d6ca0['getFields'](_0x59826f);}})[_0xe763('0x25')](function(_0x312299){if(_0x312299){_0x5d1a4c=_0x312299[_0xe763('0x38')];if(!_0x35becb[_0xe763('0x32')][_0xe763('0x39')](_0xe763('0x3a'))){_0x59826f[_0xe763('0x1d')]=qs[_0xe763('0x1d')](_0x35becb[_0xe763('0x32')][_0xe763('0x1d')]);_0x59826f['offset']=qs[_0xe763('0x1f')](_0x35becb['query'][_0xe763('0x1f')]);}return _0x3d6ca0['getFields'](_0x59826f);}})[_0xe763('0x25')](function(_0x2a1a7b){if(_0x2a1a7b){return _0x2a1a7b?{'count':_0x5d1a4c,'rows':_0x2a1a7b}:null;}})[_0xe763('0x25')](respondWithResult(_0x1a144c,null))['catch'](handleError(_0x1a144c,null));};exports['getSubjects']=function(_0x281da1,_0xa76dad,_0xeb7284){var _0x1c109a={};var _0x51803d={};var _0x913333;var _0x3adca8;return db['DeskConfiguration']['findOne']({'where':{'id':_0x281da1['params']['id']}})[_0xe763('0x25')](handleEntityNotFound(_0xa76dad,null))[_0xe763('0x25')](function(_0x2fc21a){if(_0x2fc21a){_0x913333=_0x2fc21a;_0x51803d[_0xe763('0x30')]=_[_0xe763('0x33')](db[_0xe763('0x50')][_0xe763('0x2e')]);_0x51803d[_0xe763('0x32')]=_['keys'](_0x281da1[_0xe763('0x32')]);_0x51803d['filters']=_[_0xe763('0x35')](_0x51803d[_0xe763('0x30')],_0x51803d[_0xe763('0x32')]);_0x1c109a[_0xe763('0x36')]=_[_0xe763('0x35')](_0x51803d['model'],qs['fields'](_0x281da1['query']['fields']));_0x1c109a[_0xe763('0x36')]=_0x1c109a[_0xe763('0x36')][_0xe763('0x38')]?_0x1c109a[_0xe763('0x36')]:_0x51803d[_0xe763('0x30')];_0x1c109a['order']=qs[_0xe763('0x3c')](_0x281da1[_0xe763('0x32')][_0xe763('0x3c')]);_0x1c109a[_0xe763('0x3f')]=qs[_0xe763('0x34')](_['pick'](_0x281da1[_0xe763('0x32')],_0x51803d[_0xe763('0x34')]));if(_0x281da1[_0xe763('0x32')]['filter']){_0x1c109a[_0xe763('0x3f')]=_['merge'](_0x1c109a['where'],{'$or':_[_0xe763('0x31')](_0x1c109a[_0xe763('0x36')],function(_0x1b90d1){var _0x23269c={};_0x23269c[_0x1b90d1]={'$like':'%'+_0x281da1[_0xe763('0x32')][_0xe763('0x3e')]+'%'};return _0x23269c;})});}_0x1c109a=_['merge']({},_0x1c109a,_0x281da1[_0xe763('0x49')]);return _0x913333[_0xe763('0x51')](_0x1c109a);}})[_0xe763('0x25')](function(_0x2a7483){if(_0x2a7483){_0x3adca8=_0x2a7483['length'];if(!_0x281da1[_0xe763('0x32')][_0xe763('0x39')](_0xe763('0x3a'))){_0x1c109a[_0xe763('0x1d')]=qs['limit'](_0x281da1[_0xe763('0x32')]['limit']);_0x1c109a[_0xe763('0x1f')]=qs[_0xe763('0x1f')](_0x281da1['query']['offset']);}return _0x913333[_0xe763('0x51')](_0x1c109a);}})[_0xe763('0x25')](function(_0x29e434){if(_0x29e434){return _0x29e434?{'count':_0x3adca8,'rows':_0x29e434}:null;}})[_0xe763('0x25')](respondWithResult(_0xa76dad,null))[_0xe763('0x46')](handleError(_0xa76dad,null));};exports[_0xe763('0x52')]=function(_0x4d2cc7,_0x5a2d74,_0x219980){var _0x26a212={};var _0x2df0a9={};var _0x1467b5;var _0x39936a;return db[_0xe763('0x2d')][_0xe763('0x4f')]({'where':{'id':_0x4d2cc7[_0xe763('0x48')]['id']}})[_0xe763('0x25')](handleEntityNotFound(_0x5a2d74,null))[_0xe763('0x25')](function(_0x3510e2){if(_0x3510e2){_0x1467b5=_0x3510e2;_0x2df0a9[_0xe763('0x30')]=_[_0xe763('0x33')](db[_0xe763('0x50')][_0xe763('0x2e')]);_0x2df0a9[_0xe763('0x32')]=_[_0xe763('0x33')](_0x4d2cc7[_0xe763('0x32')]);_0x2df0a9[_0xe763('0x34')]=_['intersection'](_0x2df0a9[_0xe763('0x30')],_0x2df0a9['query']);_0x26a212[_0xe763('0x36')]=_[_0xe763('0x35')](_0x2df0a9[_0xe763('0x30')],qs[_0xe763('0x37')](_0x4d2cc7['query'][_0xe763('0x37')]));_0x26a212[_0xe763('0x36')]=_0x26a212['attributes']['length']?_0x26a212[_0xe763('0x36')]:_0x2df0a9[_0xe763('0x30')];_0x26a212[_0xe763('0x3b')]=qs[_0xe763('0x3c')](_0x4d2cc7[_0xe763('0x32')][_0xe763('0x3c')]);_0x26a212[_0xe763('0x3f')]=qs['filters'](_[_0xe763('0x3d')](_0x4d2cc7[_0xe763('0x32')],_0x2df0a9[_0xe763('0x34')]));if(_0x4d2cc7[_0xe763('0x32')][_0xe763('0x3e')]){_0x26a212[_0xe763('0x3f')]=_[_0xe763('0x41')](_0x26a212['where'],{'$or':_[_0xe763('0x31')](_0x26a212[_0xe763('0x36')],function(_0x10abd4){var _0x139e91={};_0x139e91[_0x10abd4]={'$like':'%'+_0x4d2cc7[_0xe763('0x32')][_0xe763('0x3e')]+'%'};return _0x139e91;})});}_0x26a212=_['merge']({},_0x26a212,_0x4d2cc7[_0xe763('0x49')]);return _0x1467b5[_0xe763('0x52')](_0x26a212);}})[_0xe763('0x25')](function(_0x4097d6){if(_0x4097d6){_0x39936a=_0x4097d6['length'];if(!_0x4d2cc7['query']['hasOwnProperty'](_0xe763('0x3a'))){_0x26a212['limit']=qs[_0xe763('0x1d')](_0x4d2cc7[_0xe763('0x32')][_0xe763('0x1d')]);_0x26a212[_0xe763('0x1f')]=qs[_0xe763('0x1f')](_0x4d2cc7[_0xe763('0x32')][_0xe763('0x1f')]);}return _0x1467b5['getDescriptions'](_0x26a212);}})[_0xe763('0x25')](function(_0x290463){if(_0x290463){return _0x290463?{'count':_0x39936a,'rows':_0x290463}:null;}})[_0xe763('0x25')](respondWithResult(_0x5a2d74,null))['catch'](handleError(_0x5a2d74,null));};exports[_0xe763('0x53')]=function(_0x1c3d51,_0x46f7b3,_0x2a08ef){var _0xcf5efb={};var _0x89893a={};var _0x53b7e4;var _0x232084;return db[_0xe763('0x2d')][_0xe763('0x4f')]({'where':{'id':_0x1c3d51[_0xe763('0x48')]['id']}})[_0xe763('0x25')](handleEntityNotFound(_0x46f7b3,null))[_0xe763('0x25')](function(_0x2942b4){if(_0x2942b4){_0x53b7e4=_0x2942b4;_0x89893a[_0xe763('0x30')]=_[_0xe763('0x33')](db[_0xe763('0x54')][_0xe763('0x2e')]);_0x89893a['query']=_[_0xe763('0x33')](_0x1c3d51[_0xe763('0x32')]);_0x89893a[_0xe763('0x34')]=_[_0xe763('0x35')](_0x89893a['model'],_0x89893a[_0xe763('0x32')]);_0xcf5efb[_0xe763('0x36')]=_[_0xe763('0x35')](_0x89893a[_0xe763('0x30')],qs[_0xe763('0x37')](_0x1c3d51[_0xe763('0x32')][_0xe763('0x37')]));_0xcf5efb[_0xe763('0x36')]=_0xcf5efb['attributes'][_0xe763('0x38')]?_0xcf5efb[_0xe763('0x36')]:_0x89893a[_0xe763('0x30')];_0xcf5efb[_0xe763('0x3b')]=qs[_0xe763('0x3c')](_0x1c3d51[_0xe763('0x32')][_0xe763('0x3c')]);_0xcf5efb[_0xe763('0x3f')]=qs[_0xe763('0x34')](_[_0xe763('0x3d')](_0x1c3d51['query'],_0x89893a[_0xe763('0x34')]));if(_0x1c3d51[_0xe763('0x32')]['filter']){_0xcf5efb[_0xe763('0x3f')]=_['merge'](_0xcf5efb[_0xe763('0x3f')],{'$or':_[_0xe763('0x31')](_0xcf5efb[_0xe763('0x36')],function(_0x58ff45){var _0x251bcd={};_0x251bcd[_0x58ff45]={'$like':'%'+_0x1c3d51[_0xe763('0x32')][_0xe763('0x3e')]+'%'};return _0x251bcd;})});}_0xcf5efb=_[_0xe763('0x41')]({},_0xcf5efb,_0x1c3d51[_0xe763('0x49')]);return _0x53b7e4[_0xe763('0x53')](_0xcf5efb);}})['then'](function(_0x40d2d2){if(_0x40d2d2){_0x232084=_0x40d2d2[_0xe763('0x38')];if(!_0x1c3d51[_0xe763('0x32')][_0xe763('0x39')](_0xe763('0x3a'))){_0xcf5efb['limit']=qs['limit'](_0x1c3d51['query'][_0xe763('0x1d')]);_0xcf5efb['offset']=qs[_0xe763('0x1f')](_0x1c3d51[_0xe763('0x32')][_0xe763('0x1f')]);}return _0x53b7e4[_0xe763('0x53')](_0xcf5efb);}})['then'](function(_0x51f2c6){if(_0x51f2c6){return _0x51f2c6?{'count':_0x232084,'rows':_0x51f2c6}:null;}})['then'](respondWithResult(_0x46f7b3,null))['catch'](handleError(_0x46f7b3,null));};exports[_0xe763('0x55')]=function(_0x49dd92,_0x5c4085,_0x5b4898){if(_0x49dd92[_0xe763('0x4b')]['id']){delete _0x49dd92[_0xe763('0x4b')]['id'];}return db[_0xe763('0x2d')][_0xe763('0x4f')]({'where':{'id':_0x49dd92['params']['id']}})[_0xe763('0x25')](handleEntityNotFound(_0x5c4085,null))[_0xe763('0x25')](function(_0x81137d){if(_0x81137d){return _0x81137d[_0xe763('0x55')](_0x49dd92['body']['ids']||[]);}return null;})[_0xe763('0x25')](respondWithResult(_0x5c4085,null))[_0xe763('0x46')](handleError(_0x5c4085,null));}; \ No newline at end of file +var _0xc6e8=['type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','request-promise','moment','bluebird','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','DeskConfiguration','fieldName'];(function(_0x2ef250,_0xa6b73){var _0x1c9a89=function(_0x506987){while(--_0x506987){_0x2ef250['push'](_0x2ef250['shift']());}};_0x1c9a89(++_0xa6b73);}(_0xc6e8,0x127));var _0x8c6e=function(_0x4bf8fc,_0x5e7a2a){_0x4bf8fc=_0x4bf8fc-0x0;var _0x15ccd0=_0xc6e8[_0x4bf8fc];return _0x15ccd0;};'use strict';var emlformat=require(_0x8c6e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6e('0x1'));var moment=require(_0x8c6e('0x2'));var BPromise=require(_0x8c6e('0x3'));var Mustache=require('mustache');var util=require(_0x8c6e('0x4'));var path=require(_0x8c6e('0x5'));var sox=require(_0x8c6e('0x6'));var csv=require(_0x8c6e('0x7'));var ejs=require(_0x8c6e('0x8'));var fs=require('fs');var fs_extra=require(_0x8c6e('0x9'));var _=require(_0x8c6e('0xa'));var squel=require('squel');var crypto=require(_0x8c6e('0xb'));var jsforce=require(_0x8c6e('0xc'));var deskjs=require(_0x8c6e('0xd'));var toCsv=require(_0x8c6e('0x7'));var querystring=require(_0x8c6e('0xe'));var Papa=require(_0x8c6e('0xf'));var Redis=require(_0x8c6e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8c6e('0x11'));var as=require(_0x8c6e('0x12'));var hardwareService=require(_0x8c6e('0x13'));var logger=require(_0x8c6e('0x14'))('api');var utils=require(_0x8c6e('0x15'));var config=require(_0x8c6e('0x16'));var licenseUtil=require(_0x8c6e('0x17'));var db=require(_0x8c6e('0x18'))['db'];function respondWithStatusCode(_0x31d349,_0x2dd50c){_0x2dd50c=_0x2dd50c||0xcc;return function(_0x58db98){if(_0x58db98){return _0x31d349[_0x8c6e('0x19')](_0x2dd50c);}return _0x31d349[_0x8c6e('0x1a')](_0x2dd50c)[_0x8c6e('0x1b')]();};}function respondWithResult(_0x111498,_0x1b77d6){_0x1b77d6=_0x1b77d6||0xc8;return function(_0x3b7bc7){if(_0x3b7bc7){return _0x111498[_0x8c6e('0x1a')](_0x1b77d6)['json'](_0x3b7bc7);}};}function respondWithFilteredResult(_0x2f2c10,_0x312911){return function(_0x28f076){if(_0x28f076){var _0x3b8a9d=typeof _0x312911[_0x8c6e('0x1c')]==='undefined'&&typeof _0x312911[_0x8c6e('0x1d')]==='undefined';var _0x321820=_0x28f076[_0x8c6e('0x1e')];var _0x22cf80=_0x3b8a9d?0x0:_0x312911[_0x8c6e('0x1c')];var _0x295552=_0x3b8a9d?_0x28f076[_0x8c6e('0x1e')]:_0x312911[_0x8c6e('0x1c')]+_0x312911[_0x8c6e('0x1d')];var _0x119dbe;if(_0x295552>=_0x321820){_0x295552=_0x321820;_0x119dbe=0xc8;}else{_0x119dbe=0xce;}_0x2f2c10['status'](_0x119dbe);return _0x2f2c10[_0x8c6e('0x1f')](_0x8c6e('0x20'),_0x22cf80+'-'+_0x295552+'/'+_0x321820)['json'](_0x28f076);}return null;};}function patchUpdates(_0x26a93b){return function(_0x2283f7){try{jsonpatch['apply'](_0x2283f7,_0x26a93b,!![]);}catch(_0x334ee2){return BPromise[_0x8c6e('0x21')](_0x334ee2);}return _0x2283f7[_0x8c6e('0x22')]();};}function saveUpdates(_0x4c10fa,_0x580efe){return function(_0x5907ed){if(_0x5907ed){return _0x5907ed[_0x8c6e('0x23')](_0x4c10fa)[_0x8c6e('0x24')](function(_0x572117){return _0x572117;});}return null;};}function removeEntity(_0x6951a1,_0x22ad9d){return function(_0x384ca8){if(_0x384ca8){return _0x384ca8[_0x8c6e('0x25')]()[_0x8c6e('0x24')](function(){_0x6951a1['status'](0xcc)[_0x8c6e('0x1b')]();});}};}function handleEntityNotFound(_0x5f19cb,_0x2434f9){return function(_0x5d6769){if(!_0x5d6769){_0x5f19cb[_0x8c6e('0x19')](0x194);}return _0x5d6769;};}function handleError(_0x19caa3,_0x660879){_0x660879=_0x660879||0x1f4;return function(_0x1288ff){logger[_0x8c6e('0x26')](_0x1288ff[_0x8c6e('0x27')]);if(_0x1288ff[_0x8c6e('0x28')]){delete _0x1288ff[_0x8c6e('0x28')];}_0x19caa3[_0x8c6e('0x1a')](_0x660879)[_0x8c6e('0x29')](_0x1288ff);};}exports['index']=function(_0x4a2401,_0x339da8){var _0x1647e3={},_0x5b8654={},_0x47c908={'count':0x0,'rows':[]};var _0x2313da=_[_0x8c6e('0x2a')](db[_0x8c6e('0x2b')]['rawAttributes'],function(_0x530a2c){return{'name':_0x530a2c[_0x8c6e('0x2c')],'type':_0x530a2c[_0x8c6e('0x2d')][_0x8c6e('0x2e')]};});_0x5b8654['model']=_['map'](_0x2313da,'name');_0x5b8654[_0x8c6e('0x2f')]=_[_0x8c6e('0x30')](_0x4a2401[_0x8c6e('0x2f')]);_0x5b8654[_0x8c6e('0x31')]=_[_0x8c6e('0x32')](_0x5b8654['model'],_0x5b8654[_0x8c6e('0x2f')]);_0x1647e3[_0x8c6e('0x33')]=_[_0x8c6e('0x32')](_0x5b8654[_0x8c6e('0x34')],qs['fields'](_0x4a2401[_0x8c6e('0x2f')][_0x8c6e('0x35')]));_0x1647e3[_0x8c6e('0x33')]=_0x1647e3[_0x8c6e('0x33')][_0x8c6e('0x36')]?_0x1647e3[_0x8c6e('0x33')]:_0x5b8654['model'];if(!_0x4a2401[_0x8c6e('0x2f')][_0x8c6e('0x37')](_0x8c6e('0x38'))){_0x1647e3[_0x8c6e('0x1d')]=qs[_0x8c6e('0x1d')](_0x4a2401['query']['limit']);_0x1647e3[_0x8c6e('0x1c')]=qs['offset'](_0x4a2401[_0x8c6e('0x2f')]['offset']);}_0x1647e3[_0x8c6e('0x39')]=qs[_0x8c6e('0x3a')](_0x4a2401[_0x8c6e('0x2f')]['sort']);_0x1647e3['where']=qs[_0x8c6e('0x31')](_[_0x8c6e('0x3b')](_0x4a2401[_0x8c6e('0x2f')],_0x5b8654['filters']),_0x2313da);if(_0x4a2401['query'][_0x8c6e('0x3c')]){_0x1647e3[_0x8c6e('0x3d')]=_[_0x8c6e('0x3e')](_0x1647e3[_0x8c6e('0x3d')],{'$or':_[_0x8c6e('0x2a')](_0x2313da,function(_0x2a0d10){if(_0x2a0d10[_0x8c6e('0x2d')]!==_0x8c6e('0x3f')){var _0x24416e={};_0x24416e[_0x2a0d10['name']]={'$like':'%'+_0x4a2401[_0x8c6e('0x2f')]['filter']+'%'};return _0x24416e;}})});}_0x1647e3=_[_0x8c6e('0x3e')]({},_0x1647e3,_0x4a2401[_0x8c6e('0x40')]);var _0x844d3b={'where':_0x1647e3[_0x8c6e('0x3d')]};return db[_0x8c6e('0x2b')][_0x8c6e('0x1e')](_0x844d3b)[_0x8c6e('0x24')](function(_0x496266){_0x47c908[_0x8c6e('0x1e')]=_0x496266;if(_0x4a2401[_0x8c6e('0x2f')][_0x8c6e('0x41')]){_0x1647e3['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x8c6e('0x42')](_0x1647e3);})[_0x8c6e('0x24')](function(_0x59532d){_0x47c908[_0x8c6e('0x43')]=_0x59532d;return _0x47c908;})[_0x8c6e('0x24')](respondWithFilteredResult(_0x339da8,_0x1647e3))[_0x8c6e('0x44')](handleError(_0x339da8,null));};exports[_0x8c6e('0x45')]=function(_0x4d997e,_0x1e31a6){var _0x4f899d={'raw':![],'where':{'id':_0x4d997e[_0x8c6e('0x46')]['id']}},_0x3d6154={};_0x3d6154[_0x8c6e('0x34')]=_[_0x8c6e('0x30')](db[_0x8c6e('0x2b')][_0x8c6e('0x47')]);_0x3d6154[_0x8c6e('0x2f')]=_[_0x8c6e('0x30')](_0x4d997e[_0x8c6e('0x2f')]);_0x3d6154[_0x8c6e('0x31')]=_[_0x8c6e('0x32')](_0x3d6154[_0x8c6e('0x34')],_0x3d6154['query']);_0x4f899d[_0x8c6e('0x33')]=_['intersection'](_0x3d6154[_0x8c6e('0x34')],qs[_0x8c6e('0x35')](_0x4d997e[_0x8c6e('0x2f')]['fields']));_0x4f899d[_0x8c6e('0x33')]=_0x4f899d[_0x8c6e('0x33')][_0x8c6e('0x36')]?_0x4f899d['attributes']:_0x3d6154[_0x8c6e('0x34')];if(_0x4d997e[_0x8c6e('0x2f')][_0x8c6e('0x41')]){_0x4f899d[_0x8c6e('0x48')]=[{'all':!![]}];}_0x4f899d=_[_0x8c6e('0x3e')]({},_0x4f899d,_0x4d997e['options']);return db[_0x8c6e('0x2b')][_0x8c6e('0x49')](_0x4f899d)[_0x8c6e('0x24')](handleEntityNotFound(_0x1e31a6,null))[_0x8c6e('0x24')](respondWithResult(_0x1e31a6,null))['catch'](handleError(_0x1e31a6,null));};exports[_0x8c6e('0x4a')]=function(_0x2d97b5,_0x4b5e85){return db[_0x8c6e('0x2b')][_0x8c6e('0x4a')](_0x2d97b5[_0x8c6e('0x4b')],{})[_0x8c6e('0x24')](respondWithResult(_0x4b5e85,0xc9))[_0x8c6e('0x44')](handleError(_0x4b5e85,null));};exports[_0x8c6e('0x23')]=function(_0x5ab87a,_0x134e67){if(_0x5ab87a['body']['id']){delete _0x5ab87a['body']['id'];}return db[_0x8c6e('0x2b')][_0x8c6e('0x49')]({'where':{'id':_0x5ab87a[_0x8c6e('0x46')]['id']}})['then'](handleEntityNotFound(_0x134e67,null))[_0x8c6e('0x24')](saveUpdates(_0x5ab87a[_0x8c6e('0x4b')],null))[_0x8c6e('0x24')](respondWithResult(_0x134e67,null))['catch'](handleError(_0x134e67,null));};exports[_0x8c6e('0x25')]=function(_0xa17865,_0x327a5a){return db[_0x8c6e('0x2b')][_0x8c6e('0x49')]({'where':{'id':_0xa17865[_0x8c6e('0x46')]['id']}})[_0x8c6e('0x24')](handleEntityNotFound(_0x327a5a,null))['then'](removeEntity(_0x327a5a,null))[_0x8c6e('0x44')](handleError(_0x327a5a,null));};exports[_0x8c6e('0x4c')]=function(_0x320396,_0x4bad01,_0x242fbf){var _0x950219={};var _0x522ca8={};var _0x4ebc66;var _0x220576;return db[_0x8c6e('0x2b')][_0x8c6e('0x4d')]({'where':{'id':_0x320396['params']['id']}})[_0x8c6e('0x24')](handleEntityNotFound(_0x4bad01,null))[_0x8c6e('0x24')](function(_0x5076b7){if(_0x5076b7){_0x4ebc66=_0x5076b7;_0x522ca8[_0x8c6e('0x34')]=_[_0x8c6e('0x30')](db[_0x8c6e('0x4e')][_0x8c6e('0x47')]);_0x522ca8[_0x8c6e('0x2f')]=_[_0x8c6e('0x30')](_0x320396[_0x8c6e('0x2f')]);_0x522ca8[_0x8c6e('0x31')]=_['intersection'](_0x522ca8[_0x8c6e('0x34')],_0x522ca8[_0x8c6e('0x2f')]);_0x950219['attributes']=_['intersection'](_0x522ca8[_0x8c6e('0x34')],qs[_0x8c6e('0x35')](_0x320396[_0x8c6e('0x2f')]['fields']));_0x950219[_0x8c6e('0x33')]=_0x950219[_0x8c6e('0x33')]['length']?_0x950219['attributes']:_0x522ca8[_0x8c6e('0x34')];_0x950219[_0x8c6e('0x39')]=qs[_0x8c6e('0x3a')](_0x320396['query'][_0x8c6e('0x3a')]);_0x950219[_0x8c6e('0x3d')]=qs[_0x8c6e('0x31')](_[_0x8c6e('0x3b')](_0x320396[_0x8c6e('0x2f')],_0x522ca8['filters']));if(_0x320396['query'][_0x8c6e('0x3c')]){_0x950219['where']=_[_0x8c6e('0x3e')](_0x950219['where'],{'$or':_[_0x8c6e('0x2a')](_0x950219[_0x8c6e('0x33')],function(_0x590a35){var _0xbeafa4={};_0xbeafa4[_0x590a35]={'$like':'%'+_0x320396[_0x8c6e('0x2f')]['filter']+'%'};return _0xbeafa4;})});}_0x950219=_[_0x8c6e('0x3e')]({},_0x950219,_0x320396[_0x8c6e('0x40')]);return _0x4ebc66[_0x8c6e('0x4c')](_0x950219);}})[_0x8c6e('0x24')](function(_0x24eb43){if(_0x24eb43){_0x220576=_0x24eb43[_0x8c6e('0x36')];if(!_0x320396[_0x8c6e('0x2f')][_0x8c6e('0x37')]('nolimit')){_0x950219[_0x8c6e('0x1d')]=qs[_0x8c6e('0x1d')](_0x320396[_0x8c6e('0x2f')][_0x8c6e('0x1d')]);_0x950219[_0x8c6e('0x1c')]=qs[_0x8c6e('0x1c')](_0x320396[_0x8c6e('0x2f')][_0x8c6e('0x1c')]);}return _0x4ebc66[_0x8c6e('0x4c')](_0x950219);}})[_0x8c6e('0x24')](function(_0x3c82a6){if(_0x3c82a6){return _0x3c82a6?{'count':_0x220576,'rows':_0x3c82a6}:null;}})[_0x8c6e('0x24')](respondWithResult(_0x4bad01,null))[_0x8c6e('0x44')](handleError(_0x4bad01,null));};exports[_0x8c6e('0x4f')]=function(_0x1c5eb1,_0x2f86d5,_0x5b718f){var _0x5379ea={};var _0x120243={};var _0x342b44;var _0x1c04ce;return db[_0x8c6e('0x2b')][_0x8c6e('0x4d')]({'where':{'id':_0x1c5eb1[_0x8c6e('0x46')]['id']}})[_0x8c6e('0x24')](handleEntityNotFound(_0x2f86d5,null))[_0x8c6e('0x24')](function(_0x489c0b){if(_0x489c0b){_0x342b44=_0x489c0b;_0x120243[_0x8c6e('0x34')]=_[_0x8c6e('0x30')](db[_0x8c6e('0x4e')]['rawAttributes']);_0x120243[_0x8c6e('0x2f')]=_[_0x8c6e('0x30')](_0x1c5eb1[_0x8c6e('0x2f')]);_0x120243['filters']=_[_0x8c6e('0x32')](_0x120243[_0x8c6e('0x34')],_0x120243[_0x8c6e('0x2f')]);_0x5379ea[_0x8c6e('0x33')]=_[_0x8c6e('0x32')](_0x120243[_0x8c6e('0x34')],qs['fields'](_0x1c5eb1[_0x8c6e('0x2f')]['fields']));_0x5379ea['attributes']=_0x5379ea[_0x8c6e('0x33')]['length']?_0x5379ea[_0x8c6e('0x33')]:_0x120243[_0x8c6e('0x34')];_0x5379ea['order']=qs['sort'](_0x1c5eb1['query'][_0x8c6e('0x3a')]);_0x5379ea[_0x8c6e('0x3d')]=qs[_0x8c6e('0x31')](_[_0x8c6e('0x3b')](_0x1c5eb1[_0x8c6e('0x2f')],_0x120243[_0x8c6e('0x31')]));if(_0x1c5eb1['query'][_0x8c6e('0x3c')]){_0x5379ea[_0x8c6e('0x3d')]=_[_0x8c6e('0x3e')](_0x5379ea[_0x8c6e('0x3d')],{'$or':_[_0x8c6e('0x2a')](_0x5379ea[_0x8c6e('0x33')],function(_0x2421c2){var _0x29850f={};_0x29850f[_0x2421c2]={'$like':'%'+_0x1c5eb1['query'][_0x8c6e('0x3c')]+'%'};return _0x29850f;})});}_0x5379ea=_[_0x8c6e('0x3e')]({},_0x5379ea,_0x1c5eb1[_0x8c6e('0x40')]);return _0x342b44[_0x8c6e('0x4f')](_0x5379ea);}})[_0x8c6e('0x24')](function(_0x45f980){if(_0x45f980){_0x1c04ce=_0x45f980[_0x8c6e('0x36')];if(!_0x1c5eb1[_0x8c6e('0x2f')][_0x8c6e('0x37')](_0x8c6e('0x38'))){_0x5379ea['limit']=qs[_0x8c6e('0x1d')](_0x1c5eb1['query'][_0x8c6e('0x1d')]);_0x5379ea[_0x8c6e('0x1c')]=qs[_0x8c6e('0x1c')](_0x1c5eb1[_0x8c6e('0x2f')]['offset']);}return _0x342b44[_0x8c6e('0x4f')](_0x5379ea);}})[_0x8c6e('0x24')](function(_0x36cf61){if(_0x36cf61){return _0x36cf61?{'count':_0x1c04ce,'rows':_0x36cf61}:null;}})[_0x8c6e('0x24')](respondWithResult(_0x2f86d5,null))[_0x8c6e('0x44')](handleError(_0x2f86d5,null));};exports[_0x8c6e('0x50')]=function(_0x43525f,_0x370da5,_0x352de9){var _0x471036={};var _0x9a05ab={};var _0x73d472;var _0x30f509;return db[_0x8c6e('0x2b')][_0x8c6e('0x4d')]({'where':{'id':_0x43525f['params']['id']}})[_0x8c6e('0x24')](handleEntityNotFound(_0x370da5,null))[_0x8c6e('0x24')](function(_0x327cf8){if(_0x327cf8){_0x73d472=_0x327cf8;_0x9a05ab[_0x8c6e('0x34')]=_[_0x8c6e('0x30')](db['DeskField'][_0x8c6e('0x47')]);_0x9a05ab['query']=_[_0x8c6e('0x30')](_0x43525f[_0x8c6e('0x2f')]);_0x9a05ab[_0x8c6e('0x31')]=_[_0x8c6e('0x32')](_0x9a05ab[_0x8c6e('0x34')],_0x9a05ab['query']);_0x471036[_0x8c6e('0x33')]=_[_0x8c6e('0x32')](_0x9a05ab[_0x8c6e('0x34')],qs[_0x8c6e('0x35')](_0x43525f['query'][_0x8c6e('0x35')]));_0x471036[_0x8c6e('0x33')]=_0x471036[_0x8c6e('0x33')][_0x8c6e('0x36')]?_0x471036['attributes']:_0x9a05ab[_0x8c6e('0x34')];_0x471036['order']=qs[_0x8c6e('0x3a')](_0x43525f[_0x8c6e('0x2f')][_0x8c6e('0x3a')]);_0x471036[_0x8c6e('0x3d')]=qs[_0x8c6e('0x31')](_[_0x8c6e('0x3b')](_0x43525f['query'],_0x9a05ab[_0x8c6e('0x31')]));if(_0x43525f['query']['filter']){_0x471036[_0x8c6e('0x3d')]=_[_0x8c6e('0x3e')](_0x471036[_0x8c6e('0x3d')],{'$or':_[_0x8c6e('0x2a')](_0x471036['attributes'],function(_0x12f420){var _0x207756={};_0x207756[_0x12f420]={'$like':'%'+_0x43525f[_0x8c6e('0x2f')][_0x8c6e('0x3c')]+'%'};return _0x207756;})});}_0x471036=_[_0x8c6e('0x3e')]({},_0x471036,_0x43525f[_0x8c6e('0x40')]);return _0x73d472[_0x8c6e('0x50')](_0x471036);}})[_0x8c6e('0x24')](function(_0x258176){if(_0x258176){_0x30f509=_0x258176[_0x8c6e('0x36')];if(!_0x43525f[_0x8c6e('0x2f')][_0x8c6e('0x37')]('nolimit')){_0x471036['limit']=qs[_0x8c6e('0x1d')](_0x43525f[_0x8c6e('0x2f')][_0x8c6e('0x1d')]);_0x471036[_0x8c6e('0x1c')]=qs[_0x8c6e('0x1c')](_0x43525f['query'][_0x8c6e('0x1c')]);}return _0x73d472[_0x8c6e('0x50')](_0x471036);}})['then'](function(_0x5955ed){if(_0x5955ed){return _0x5955ed?{'count':_0x30f509,'rows':_0x5955ed}:null;}})[_0x8c6e('0x24')](respondWithResult(_0x370da5,null))[_0x8c6e('0x44')](handleError(_0x370da5,null));};exports['getTags']=function(_0x42b7bc,_0x3a5d25,_0x4812a1){var _0x17ac26={};var _0x1a2f2d={};var _0x551cea;var _0x28e6f5;return db[_0x8c6e('0x2b')][_0x8c6e('0x4d')]({'where':{'id':_0x42b7bc[_0x8c6e('0x46')]['id']}})[_0x8c6e('0x24')](handleEntityNotFound(_0x3a5d25,null))['then'](function(_0x3314e1){if(_0x3314e1){_0x551cea=_0x3314e1;_0x1a2f2d[_0x8c6e('0x34')]=_['keys'](db[_0x8c6e('0x51')][_0x8c6e('0x47')]);_0x1a2f2d[_0x8c6e('0x2f')]=_[_0x8c6e('0x30')](_0x42b7bc[_0x8c6e('0x2f')]);_0x1a2f2d[_0x8c6e('0x31')]=_[_0x8c6e('0x32')](_0x1a2f2d[_0x8c6e('0x34')],_0x1a2f2d['query']);_0x17ac26[_0x8c6e('0x33')]=_[_0x8c6e('0x32')](_0x1a2f2d[_0x8c6e('0x34')],qs[_0x8c6e('0x35')](_0x42b7bc[_0x8c6e('0x2f')][_0x8c6e('0x35')]));_0x17ac26['attributes']=_0x17ac26[_0x8c6e('0x33')][_0x8c6e('0x36')]?_0x17ac26[_0x8c6e('0x33')]:_0x1a2f2d['model'];_0x17ac26['order']=qs['sort'](_0x42b7bc['query'][_0x8c6e('0x3a')]);_0x17ac26[_0x8c6e('0x3d')]=qs[_0x8c6e('0x31')](_[_0x8c6e('0x3b')](_0x42b7bc[_0x8c6e('0x2f')],_0x1a2f2d['filters']));if(_0x42b7bc[_0x8c6e('0x2f')][_0x8c6e('0x3c')]){_0x17ac26['where']=_['merge'](_0x17ac26[_0x8c6e('0x3d')],{'$or':_[_0x8c6e('0x2a')](_0x17ac26[_0x8c6e('0x33')],function(_0x17d6a5){var _0x3db02c={};_0x3db02c[_0x17d6a5]={'$like':'%'+_0x42b7bc[_0x8c6e('0x2f')]['filter']+'%'};return _0x3db02c;})});}_0x17ac26=_[_0x8c6e('0x3e')]({},_0x17ac26,_0x42b7bc[_0x8c6e('0x40')]);return _0x551cea[_0x8c6e('0x52')](_0x17ac26);}})['then'](function(_0x1ff4ff){if(_0x1ff4ff){_0x28e6f5=_0x1ff4ff[_0x8c6e('0x36')];if(!_0x42b7bc[_0x8c6e('0x2f')][_0x8c6e('0x37')](_0x8c6e('0x38'))){_0x17ac26['limit']=qs[_0x8c6e('0x1d')](_0x42b7bc[_0x8c6e('0x2f')][_0x8c6e('0x1d')]);_0x17ac26[_0x8c6e('0x1c')]=qs[_0x8c6e('0x1c')](_0x42b7bc[_0x8c6e('0x2f')]['offset']);}return _0x551cea[_0x8c6e('0x52')](_0x17ac26);}})[_0x8c6e('0x24')](function(_0x2bb400){if(_0x2bb400){return _0x2bb400?{'count':_0x28e6f5,'rows':_0x2bb400}:null;}})['then'](respondWithResult(_0x3a5d25,null))[_0x8c6e('0x44')](handleError(_0x3a5d25,null));};exports[_0x8c6e('0x53')]=function(_0xc16e0,_0x1375ea,_0x5688a3){if(_0xc16e0['body']['id']){delete _0xc16e0[_0x8c6e('0x4b')]['id'];}return db[_0x8c6e('0x2b')][_0x8c6e('0x4d')]({'where':{'id':_0xc16e0['params']['id']}})[_0x8c6e('0x24')](handleEntityNotFound(_0x1375ea,null))[_0x8c6e('0x24')](function(_0x462673){if(_0x462673){return _0x462673[_0x8c6e('0x53')](_0xc16e0[_0x8c6e('0x4b')][_0x8c6e('0x54')]||[]);}return null;})[_0x8c6e('0x24')](respondWithResult(_0x1375ea,null))[_0x8c6e('0x44')](handleError(_0x1375ea,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8fb12ac..7fb368d 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 _0x88c8=['DeskConfiguration','int_desk_configurations','lodash','util','moment','path','rimraf','./intDeskConfiguration.attributes','exports','define'];(function(_0x247f9f,_0x18a4ce){var _0x40b806=function(_0x15f443){while(--_0x15f443){_0x247f9f['push'](_0x247f9f['shift']());}};_0x40b806(++_0x18a4ce);}(_0x88c8,0x7a));var _0x888c=function(_0x22e9fb,_0x325159){_0x22e9fb=_0x22e9fb-0x0;var _0x2fb472=_0x88c8[_0x22e9fb];return _0x2fb472;};'use strict';var _=require(_0x888c('0x0'));var util=require(_0x888c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x888c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x888c('0x3'));var rimraf=require(_0x888c('0x4'));var config=require('../../config/environment');var attributes=require(_0x888c('0x5'));module[_0x888c('0x6')]=function(_0x1e3a1a,_0x284f52){return _0x1e3a1a[_0x888c('0x7')](_0x888c('0x8'),attributes,{'tableName':_0x888c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d78=['../../config/logger','moment','../../config/environment','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x38e656,_0x21bcb0){var _0x411375=function(_0x1582c3){while(--_0x1582c3){_0x38e656['push'](_0x38e656['shift']());}};_0x411375(++_0x21bcb0);}(_0x9d78,0xde));var _0x89d7=function(_0x3367b7,_0x1e0234){_0x3367b7=_0x3367b7-0x0;var _0x52bb97=_0x9d78[_0x3367b7];return _0x52bb97;};'use strict';var _=require(_0x89d7('0x0'));var util=require(_0x89d7('0x1'));var logger=require(_0x89d7('0x2'))('api');var moment=require(_0x89d7('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(_0x89d7('0x4'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x13720b,_0x2dfa20){return _0x13720b[_0x89d7('0x5')](_0x89d7('0x6'),attributes,{'tableName':_0x89d7('0x7'),'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 65dd18d..bf683d2 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 _0xc373=['../../config/environment','jayson/promise','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x351e93,_0x10d181){var _0x4564c9=function(_0xdee134){while(--_0xdee134){_0x351e93['push'](_0x351e93['shift']());}};_0x4564c9(++_0x10d181);}(_0xc373,0x1c7));var _0x3c37=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0xc373[_0x20cf8a];return _0x54e165;};'use strict';var _=require('lodash');var util=require(_0x3c37('0x0'));var moment=require(_0x3c37('0x1'));var BPromise=require(_0x3c37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c37('0x3'))['db'];var utils=require(_0x3c37('0x4'));var logger=require(_0x3c37('0x5'))(_0x3c37('0x6'));var config=require(_0x3c37('0x7'));var jayson=require(_0x3c37('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1941,_0x1244e6,_0x14b09d){return new BPromise(function(_0x10617,_0x465de6){return client[_0x3c37('0x9')](_0x2e1941,_0x14b09d)[_0x3c37('0xa')](function(_0x59d4f9){logger[_0x3c37('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x1244e6,'request\x20sent');logger[_0x3c37('0xc')](_0x3c37('0xd'),_0x1244e6,_0x3c37('0xe'),JSON[_0x3c37('0xf')](_0x59d4f9));if(_0x59d4f9[_0x3c37('0x10')]){if(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x11')]===0x1f4){logger['error'](_0x3c37('0x12'),_0x1244e6,_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);return _0x465de6(_0x59d4f9['error']['message']);}logger[_0x3c37('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x1244e6,_0x59d4f9['error'][_0x3c37('0x13')]);return _0x10617(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);}else{logger[_0x3c37('0xb')](_0x3c37('0x12'),_0x1244e6,_0x3c37('0xe'));_0x10617(_0x59d4f9[_0x3c37('0x14')][_0x3c37('0x13')]);}})[_0x3c37('0x15')](function(_0x4e1560){logger[_0x3c37('0x10')](_0x3c37('0x12'),_0x1244e6,_0x4e1560);_0x465de6(_0x4e1560);});});} \ No newline at end of file +var _0x57b7=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x57b7,0x160));var _0x757b=function(_0x5f3b51,_0x1b7890){_0x5f3b51=_0x5f3b51-0x0;var _0x52397d=_0x57b7[_0x5f3b51];return _0x52397d;};'use strict';var _=require(_0x757b('0x0'));var util=require(_0x757b('0x1'));var moment=require(_0x757b('0x2'));var BPromise=require(_0x757b('0x3'));var rs=require(_0x757b('0x4'));var fs=require('fs');var Redis=require(_0x757b('0x5'));var db=require(_0x757b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x757b('0x7'))(_0x757b('0x8'));var config=require(_0x757b('0x9'));var jayson=require(_0x757b('0xa'));var client=jayson['client'][_0x757b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8528c7,_0x36c83c,_0x224503){return new BPromise(function(_0x18b130,_0x1845cf){return client[_0x757b('0xc')](_0x8528c7,_0x224503)[_0x757b('0xd')](function(_0x53a1ce){logger[_0x757b('0xe')](_0x757b('0xf'),_0x36c83c,'request\x20sent');logger[_0x757b('0x10')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x36c83c,_0x757b('0x11'),JSON['stringify'](_0x53a1ce));if(_0x53a1ce[_0x757b('0x12')]){if(_0x53a1ce[_0x757b('0x12')]['code']===0x1f4){logger[_0x757b('0x12')](_0x757b('0xf'),_0x36c83c,_0x53a1ce['error'][_0x757b('0x13')]);return _0x1845cf(_0x53a1ce['error'][_0x757b('0x13')]);}logger[_0x757b('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x36c83c,_0x53a1ce[_0x757b('0x12')]['message']);return _0x18b130(_0x53a1ce[_0x757b('0x12')][_0x757b('0x13')]);}else{logger[_0x757b('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x36c83c,_0x757b('0x11'));_0x18b130(_0x53a1ce[_0x757b('0x14')]['message']);}})[_0x757b('0x15')](function(_0x493286){logger['error'](_0x757b('0xf'),_0x36c83c,_0x493286);_0x1845cf(_0x493286);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 97228c1..e370005 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 _0xa596=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','show','put','update'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xa596,0x7b));var _0x6a59=function(_0xc01f,_0x6f4882){_0xc01f=_0xc01f-0x0;var _0x1e2c17=_0xa596[_0xc01f];return _0x1e2c17;};'use strict';var multer=require(_0x6a59('0x0'));var util=require(_0x6a59('0x1'));var path=require('path');var timeout=require(_0x6a59('0x2'));var express=require(_0x6a59('0x3'));var router=express[_0x6a59('0x4')]();var fs_extra=require(_0x6a59('0x5'));var auth=require(_0x6a59('0x6'));var interaction=require(_0x6a59('0x7'));var config=require(_0x6a59('0x8'));var controller=require(_0x6a59('0x9'));router['get']('/',auth[_0x6a59('0xa')](),controller[_0x6a59('0xb')]);router[_0x6a59('0xc')](_0x6a59('0xd'),auth[_0x6a59('0xa')](),controller[_0x6a59('0xe')]);router['post']('/',auth[_0x6a59('0xa')](),controller['create']);router[_0x6a59('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6a59('0x10')]);router[_0x6a59('0x11')](_0x6a59('0xd'),auth['isAuthenticated'](),controller[_0x6a59('0x12')]);module[_0x6a59('0x13')]=router; \ No newline at end of file +var _0x552b=['show','put','/:id','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index'];(function(_0x1ee9d8,_0x3c84b0){var _0x4b3f1a=function(_0x574b92){while(--_0x574b92){_0x1ee9d8['push'](_0x1ee9d8['shift']());}};_0x4b3f1a(++_0x3c84b0);}(_0x552b,0x16d));var _0xb552=function(_0xf04340,_0x238476){_0xf04340=_0xf04340-0x0;var _0x2ece3e=_0x552b[_0xf04340];return _0x2ece3e;};'use strict';var multer=require(_0xb552('0x0'));var util=require('util');var path=require(_0xb552('0x1'));var timeout=require(_0xb552('0x2'));var express=require(_0xb552('0x3'));var router=express[_0xb552('0x4')]();var fs_extra=require(_0xb552('0x5'));var auth=require(_0xb552('0x6'));var interaction=require(_0xb552('0x7'));var config=require(_0xb552('0x8'));var controller=require(_0xb552('0x9'));router[_0xb552('0xa')]('/',auth[_0xb552('0xb')](),controller[_0xb552('0xc')]);router[_0xb552('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb552('0xd')]);router['post']('/',auth[_0xb552('0xb')](),controller['create']);router[_0xb552('0xe')](_0xb552('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xb552('0x10')](_0xb552('0xf'),auth[_0xb552('0xb')](),controller['destroy']);module[_0xb552('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 94a9e66..a2a4cb8 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 _0x6224=['variable','keyValue','picklist','string','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x5a3f1e,_0x306f7c){var _0x28e1ba=function(_0xa35cb4){while(--_0xa35cb4){_0x5a3f1e['push'](_0x5a3f1e['shift']());}};_0x28e1ba(++_0x306f7c);}(_0x6224,0x9f));var _0x4622=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x6224[_0x162780];return _0x1ea2dc;};'use strict';var Sequelize=require(_0x4622('0x0'));module[_0x4622('0x1')]={'type':{'type':Sequelize[_0x4622('0x2')]('string',_0x4622('0x3'),'customVariable',_0x4622('0x4'),_0x4622('0x5')),'defaultValue':_0x4622('0x6')},'content':{'type':Sequelize[_0x4622('0x7')]},'key':{'type':Sequelize[_0x4622('0x7')]},'keyType':{'type':Sequelize[_0x4622('0x2')](_0x4622('0x6'),_0x4622('0x3'),_0x4622('0x8'))},'keyContent':{'type':Sequelize[_0x4622('0x7')]},'idField':{'type':Sequelize[_0x4622('0x7')]},'nameField':{'type':Sequelize[_0x4622('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4622('0x7')]}}; \ No newline at end of file +var _0xa467=['variable','customVariable','picklist','STRING','BOOLEAN','exports','string'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0xa467,0xb4));var _0x7a46=function(_0x14790b,_0x3f64a9){_0x14790b=_0x14790b-0x0;var _0x2371ce=_0xa467[_0x14790b];return _0x2371ce;};'use strict';var Sequelize=require('sequelize');module[_0x7a46('0x0')]={'type':{'type':Sequelize['ENUM'](_0x7a46('0x1'),_0x7a46('0x2'),_0x7a46('0x3'),'keyValue',_0x7a46('0x4')),'defaultValue':_0x7a46('0x1')},'content':{'type':Sequelize[_0x7a46('0x5')]},'key':{'type':Sequelize[_0x7a46('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x7a46('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7a46('0x5')]},'customField':{'type':Sequelize[_0x7a46('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a46('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 6c18c49..cc9796f 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 _0x799b=['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','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','rows','show','params','include','find','catch','create','body','destroy','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x11b34c,_0x57f005){var _0x5c3c2f=function(_0x41e8d0){while(--_0x41e8d0){_0x11b34c['push'](_0x11b34c['shift']());}};_0x5c3c2f(++_0x57f005);}(_0x799b,0x8c));var _0xb799=function(_0x478ed9,_0x49d6d8){_0x478ed9=_0x478ed9-0x0;var _0x15435a=_0x799b[_0x478ed9];return _0x15435a;};'use strict';var emlformat=require(_0xb799('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb799('0x1'));var rp=require('request-promise');var moment=require(_0xb799('0x2'));var BPromise=require(_0xb799('0x3'));var Mustache=require(_0xb799('0x4'));var util=require(_0xb799('0x5'));var path=require('path');var sox=require(_0xb799('0x6'));var csv=require('to-csv');var ejs=require(_0xb799('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb799('0x8'));var squel=require(_0xb799('0x9'));var crypto=require(_0xb799('0xa'));var jsforce=require(_0xb799('0xb'));var deskjs=require(_0xb799('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb799('0xd'));var Papa=require(_0xb799('0xe'));var Redis=require('ioredis');var authService=require(_0xb799('0xf'));var qs=require(_0xb799('0x10'));var as=require(_0xb799('0x11'));var hardwareService=require(_0xb799('0x12'));var logger=require(_0xb799('0x13'))(_0xb799('0x14'));var utils=require(_0xb799('0x15'));var config=require(_0xb799('0x16'));var licenseUtil=require(_0xb799('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c3e9,_0x45df6b){_0x45df6b=_0x45df6b||0xcc;return function(_0x239abc){if(_0x239abc){return _0x13c3e9[_0xb799('0x18')](_0x45df6b);}return _0x13c3e9[_0xb799('0x19')](_0x45df6b)[_0xb799('0x1a')]();};}function respondWithResult(_0x1921bc,_0x2891b9){_0x2891b9=_0x2891b9||0xc8;return function(_0x340696){if(_0x340696){return _0x1921bc[_0xb799('0x19')](_0x2891b9)[_0xb799('0x1b')](_0x340696);}};}function respondWithFilteredResult(_0x3acd27,_0x458672){return function(_0x5d0fde){if(_0x5d0fde){var _0x99c97d=typeof _0x458672[_0xb799('0x1c')]===_0xb799('0x1d')&&typeof _0x458672['limit']==='undefined';var _0xfc7e9e=_0x5d0fde[_0xb799('0x1e')];var _0x586432=_0x99c97d?0x0:_0x458672[_0xb799('0x1c')];var _0x15fa86=_0x99c97d?_0x5d0fde[_0xb799('0x1e')]:_0x458672[_0xb799('0x1c')]+_0x458672[_0xb799('0x1f')];var _0x530b04;if(_0x15fa86>=_0xfc7e9e){_0x15fa86=_0xfc7e9e;_0x530b04=0xc8;}else{_0x530b04=0xce;}_0x3acd27[_0xb799('0x19')](_0x530b04);return _0x3acd27[_0xb799('0x20')]('Content-Range',_0x586432+'-'+_0x15fa86+'/'+_0xfc7e9e)[_0xb799('0x1b')](_0x5d0fde);}return null;};}function patchUpdates(_0x3f1edb){return function(_0x43acdc){try{jsonpatch[_0xb799('0x21')](_0x43acdc,_0x3f1edb,!![]);}catch(_0x29723d){return BPromise[_0xb799('0x22')](_0x29723d);}return _0x43acdc['save']();};}function saveUpdates(_0x2f5a0a,_0x4647a3){return function(_0x1192ca){if(_0x1192ca){return _0x1192ca[_0xb799('0x23')](_0x2f5a0a)[_0xb799('0x24')](function(_0x2b6ece){return _0x2b6ece;});}return null;};}function removeEntity(_0x1f9df3,_0x375ecc){return function(_0x5549b7){if(_0x5549b7){return _0x5549b7['destroy']()['then'](function(){_0x1f9df3['status'](0xcc)[_0xb799('0x1a')]();});}};}function handleEntityNotFound(_0xdd65db,_0x315d9a){return function(_0x35e0c0){if(!_0x35e0c0){_0xdd65db['sendStatus'](0x194);}return _0x35e0c0;};}function handleError(_0x5ad446,_0x1065f2){_0x1065f2=_0x1065f2||0x1f4;return function(_0x51aeee){logger[_0xb799('0x25')](_0x51aeee[_0xb799('0x26')]);if(_0x51aeee[_0xb799('0x27')]){delete _0x51aeee[_0xb799('0x27')];}_0x5ad446[_0xb799('0x19')](_0x1065f2)[_0xb799('0x28')](_0x51aeee);};}exports[_0xb799('0x29')]=function(_0x2d08cb,_0x34084c){var _0x23d8c8={},_0x1f08b8={},_0x2cb18f={'count':0x0,'rows':[]};var _0x1be855=_[_0xb799('0x2a')](db['DeskField'][_0xb799('0x2b')],function(_0x459656){return{'name':_0x459656[_0xb799('0x2c')],'type':_0x459656[_0xb799('0x2d')][_0xb799('0x2e')]};});_0x1f08b8[_0xb799('0x2f')]=_[_0xb799('0x2a')](_0x1be855,_0xb799('0x27'));_0x1f08b8[_0xb799('0x30')]=_[_0xb799('0x31')](_0x2d08cb[_0xb799('0x30')]);_0x1f08b8[_0xb799('0x32')]=_[_0xb799('0x33')](_0x1f08b8[_0xb799('0x2f')],_0x1f08b8[_0xb799('0x30')]);_0x23d8c8[_0xb799('0x34')]=_['intersection'](_0x1f08b8[_0xb799('0x2f')],qs[_0xb799('0x35')](_0x2d08cb[_0xb799('0x30')][_0xb799('0x35')]));_0x23d8c8[_0xb799('0x34')]=_0x23d8c8[_0xb799('0x34')][_0xb799('0x36')]?_0x23d8c8['attributes']:_0x1f08b8['model'];if(!_0x2d08cb[_0xb799('0x30')][_0xb799('0x37')](_0xb799('0x38'))){_0x23d8c8['limit']=qs[_0xb799('0x1f')](_0x2d08cb[_0xb799('0x30')][_0xb799('0x1f')]);_0x23d8c8[_0xb799('0x1c')]=qs[_0xb799('0x1c')](_0x2d08cb['query']['offset']);}_0x23d8c8[_0xb799('0x39')]=qs[_0xb799('0x3a')](_0x2d08cb[_0xb799('0x30')]['sort']);_0x23d8c8[_0xb799('0x3b')]=qs[_0xb799('0x32')](_[_0xb799('0x3c')](_0x2d08cb[_0xb799('0x30')],_0x1f08b8[_0xb799('0x32')]),_0x1be855);if(_0x2d08cb[_0xb799('0x30')][_0xb799('0x3d')]){_0x23d8c8[_0xb799('0x3b')]=_[_0xb799('0x3e')](_0x23d8c8[_0xb799('0x3b')],{'$or':_[_0xb799('0x2a')](_0x1be855,function(_0x2c67c1){if(_0x2c67c1[_0xb799('0x2d')]!==_0xb799('0x3f')){var _0xef6202={};_0xef6202[_0x2c67c1['name']]={'$like':'%'+_0x2d08cb[_0xb799('0x30')][_0xb799('0x3d')]+'%'};return _0xef6202;}})});}_0x23d8c8=_[_0xb799('0x3e')]({},_0x23d8c8,_0x2d08cb[_0xb799('0x40')]);var _0x4a7876={'where':_0x23d8c8[_0xb799('0x3b')]};return db[_0xb799('0x41')][_0xb799('0x1e')](_0x4a7876)['then'](function(_0x59a217){_0x2cb18f[_0xb799('0x1e')]=_0x59a217;if(_0x2d08cb[_0xb799('0x30')][_0xb799('0x42')]){_0x23d8c8['include']=[{'all':!![]}];}return db['DeskField']['findAll'](_0x23d8c8);})[_0xb799('0x24')](function(_0x19ca29){_0x2cb18f[_0xb799('0x43')]=_0x19ca29;return _0x2cb18f;})[_0xb799('0x24')](respondWithFilteredResult(_0x34084c,_0x23d8c8))['catch'](handleError(_0x34084c,null));};exports[_0xb799('0x44')]=function(_0x11f86d,_0x9dd0fe){var _0x1f0e27={'raw':!![],'where':{'id':_0x11f86d[_0xb799('0x45')]['id']}},_0x4b6648={};_0x4b6648[_0xb799('0x2f')]=_[_0xb799('0x31')](db[_0xb799('0x41')][_0xb799('0x2b')]);_0x4b6648['query']=_[_0xb799('0x31')](_0x11f86d[_0xb799('0x30')]);_0x4b6648[_0xb799('0x32')]=_[_0xb799('0x33')](_0x4b6648[_0xb799('0x2f')],_0x4b6648[_0xb799('0x30')]);_0x1f0e27[_0xb799('0x34')]=_[_0xb799('0x33')](_0x4b6648[_0xb799('0x2f')],qs[_0xb799('0x35')](_0x11f86d[_0xb799('0x30')][_0xb799('0x35')]));_0x1f0e27[_0xb799('0x34')]=_0x1f0e27[_0xb799('0x34')][_0xb799('0x36')]?_0x1f0e27[_0xb799('0x34')]:_0x4b6648[_0xb799('0x2f')];if(_0x11f86d[_0xb799('0x30')][_0xb799('0x42')]){_0x1f0e27[_0xb799('0x46')]=[{'all':!![]}];}_0x1f0e27=_[_0xb799('0x3e')]({},_0x1f0e27,_0x11f86d[_0xb799('0x40')]);return db[_0xb799('0x41')][_0xb799('0x47')](_0x1f0e27)[_0xb799('0x24')](handleEntityNotFound(_0x9dd0fe,null))[_0xb799('0x24')](respondWithResult(_0x9dd0fe,null))[_0xb799('0x48')](handleError(_0x9dd0fe,null));};exports['create']=function(_0x250dc7,_0x5125d2){return db['DeskField'][_0xb799('0x49')](_0x250dc7[_0xb799('0x4a')],{})['then'](respondWithResult(_0x5125d2,0xc9))[_0xb799('0x48')](handleError(_0x5125d2,null));};exports[_0xb799('0x23')]=function(_0xc172c0,_0x3d4c6f){if(_0xc172c0[_0xb799('0x4a')]['id']){delete _0xc172c0[_0xb799('0x4a')]['id'];}return db['DeskField'][_0xb799('0x47')]({'where':{'id':_0xc172c0['params']['id']}})[_0xb799('0x24')](handleEntityNotFound(_0x3d4c6f,null))['then'](saveUpdates(_0xc172c0['body'],null))['then'](respondWithResult(_0x3d4c6f,null))[_0xb799('0x48')](handleError(_0x3d4c6f,null));};exports[_0xb799('0x4b')]=function(_0xef5685,_0x285a81){return db['DeskField'][_0xb799('0x47')]({'where':{'id':_0xef5685['params']['id']}})['then'](handleEntityNotFound(_0x285a81,null))[_0xb799('0x24')](removeEntity(_0x285a81,null))['catch'](handleError(_0x285a81,null));}; \ No newline at end of file +var _0x7181=['index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','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','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x41e477,_0x3b8e2f){var _0x2353db=function(_0x1831fe){while(--_0x1831fe){_0x41e477['push'](_0x41e477['shift']());}};_0x2353db(++_0x3b8e2f);}(_0x7181,0x1ef));var _0x1718=function(_0x5070a4,_0x1db896){_0x5070a4=_0x5070a4-0x0;var _0x179668=_0x7181[_0x5070a4];return _0x179668;};'use strict';var emlformat=require(_0x1718('0x0'));var rimraf=require(_0x1718('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1718('0x2'));var BPromise=require(_0x1718('0x3'));var Mustache=require(_0x1718('0x4'));var util=require(_0x1718('0x5'));var path=require(_0x1718('0x6'));var sox=require(_0x1718('0x7'));var csv=require(_0x1718('0x8'));var ejs=require(_0x1718('0x9'));var fs=require('fs');var fs_extra=require(_0x1718('0xa'));var _=require(_0x1718('0xb'));var squel=require(_0x1718('0xc'));var crypto=require(_0x1718('0xd'));var jsforce=require(_0x1718('0xe'));var deskjs=require(_0x1718('0xf'));var toCsv=require(_0x1718('0x8'));var querystring=require(_0x1718('0x10'));var Papa=require('papaparse');var Redis=require(_0x1718('0x11'));var authService=require(_0x1718('0x12'));var qs=require(_0x1718('0x13'));var as=require(_0x1718('0x14'));var hardwareService=require(_0x1718('0x15'));var logger=require(_0x1718('0x16'))(_0x1718('0x17'));var utils=require(_0x1718('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1922f1,_0x2ea52e){_0x2ea52e=_0x2ea52e||0xcc;return function(_0x342145){if(_0x342145){return _0x1922f1[_0x1718('0x19')](_0x2ea52e);}return _0x1922f1[_0x1718('0x1a')](_0x2ea52e)[_0x1718('0x1b')]();};}function respondWithResult(_0x21abeb,_0xad3335){_0xad3335=_0xad3335||0xc8;return function(_0x527638){if(_0x527638){return _0x21abeb[_0x1718('0x1a')](_0xad3335)[_0x1718('0x1c')](_0x527638);}};}function respondWithFilteredResult(_0x57ba7d,_0x213954){return function(_0x399a6b){if(_0x399a6b){var _0x4506cb=typeof _0x213954['offset']==='undefined'&&typeof _0x213954[_0x1718('0x1d')]===_0x1718('0x1e');var _0x283c5d=_0x399a6b[_0x1718('0x1f')];var _0x4283c8=_0x4506cb?0x0:_0x213954[_0x1718('0x20')];var _0x338233=_0x4506cb?_0x399a6b[_0x1718('0x1f')]:_0x213954['offset']+_0x213954['limit'];var _0x2e3557;if(_0x338233>=_0x283c5d){_0x338233=_0x283c5d;_0x2e3557=0xc8;}else{_0x2e3557=0xce;}_0x57ba7d[_0x1718('0x1a')](_0x2e3557);return _0x57ba7d[_0x1718('0x21')](_0x1718('0x22'),_0x4283c8+'-'+_0x338233+'/'+_0x283c5d)[_0x1718('0x1c')](_0x399a6b);}return null;};}function patchUpdates(_0x5597e7){return function(_0x3d59b8){try{jsonpatch[_0x1718('0x23')](_0x3d59b8,_0x5597e7,!![]);}catch(_0x532972){return BPromise[_0x1718('0x24')](_0x532972);}return _0x3d59b8['save']();};}function saveUpdates(_0x1618e7,_0x489289){return function(_0x2fde41){if(_0x2fde41){return _0x2fde41[_0x1718('0x25')](_0x1618e7)[_0x1718('0x26')](function(_0x280bc0){return _0x280bc0;});}return null;};}function removeEntity(_0x356d96,_0x433bfa){return function(_0x36eeff){if(_0x36eeff){return _0x36eeff[_0x1718('0x27')]()[_0x1718('0x26')](function(){_0x356d96[_0x1718('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b766,_0x13d002){return function(_0x3e766d){if(!_0x3e766d){_0x29b766['sendStatus'](0x194);}return _0x3e766d;};}function handleError(_0x4c0b82,_0x582eed){_0x582eed=_0x582eed||0x1f4;return function(_0x3562e8){logger[_0x1718('0x28')](_0x3562e8[_0x1718('0x29')]);if(_0x3562e8[_0x1718('0x2a')]){delete _0x3562e8[_0x1718('0x2a')];}_0x4c0b82['status'](_0x582eed)[_0x1718('0x2b')](_0x3562e8);};}exports[_0x1718('0x2c')]=function(_0x4a1a9f,_0x5635fc){var _0x3133a0={},_0x4d36cd={},_0x38b243={'count':0x0,'rows':[]};var _0x2ebb92=_[_0x1718('0x2d')](db[_0x1718('0x2e')][_0x1718('0x2f')],function(_0x288e7d){return{'name':_0x288e7d[_0x1718('0x30')],'type':_0x288e7d[_0x1718('0x31')][_0x1718('0x32')]};});_0x4d36cd[_0x1718('0x33')]=_[_0x1718('0x2d')](_0x2ebb92,_0x1718('0x2a'));_0x4d36cd['query']=_[_0x1718('0x34')](_0x4a1a9f[_0x1718('0x35')]);_0x4d36cd[_0x1718('0x36')]=_[_0x1718('0x37')](_0x4d36cd[_0x1718('0x33')],_0x4d36cd[_0x1718('0x35')]);_0x3133a0[_0x1718('0x38')]=_['intersection'](_0x4d36cd[_0x1718('0x33')],qs[_0x1718('0x39')](_0x4a1a9f[_0x1718('0x35')][_0x1718('0x39')]));_0x3133a0['attributes']=_0x3133a0[_0x1718('0x38')][_0x1718('0x3a')]?_0x3133a0['attributes']:_0x4d36cd[_0x1718('0x33')];if(!_0x4a1a9f['query'][_0x1718('0x3b')]('nolimit')){_0x3133a0[_0x1718('0x1d')]=qs[_0x1718('0x1d')](_0x4a1a9f[_0x1718('0x35')][_0x1718('0x1d')]);_0x3133a0['offset']=qs[_0x1718('0x20')](_0x4a1a9f[_0x1718('0x35')][_0x1718('0x20')]);}_0x3133a0['order']=qs[_0x1718('0x3c')](_0x4a1a9f[_0x1718('0x35')][_0x1718('0x3c')]);_0x3133a0['where']=qs['filters'](_[_0x1718('0x3d')](_0x4a1a9f['query'],_0x4d36cd[_0x1718('0x36')]),_0x2ebb92);if(_0x4a1a9f['query'][_0x1718('0x3e')]){_0x3133a0[_0x1718('0x3f')]=_[_0x1718('0x40')](_0x3133a0[_0x1718('0x3f')],{'$or':_[_0x1718('0x2d')](_0x2ebb92,function(_0x5ad84b){if(_0x5ad84b[_0x1718('0x31')]!==_0x1718('0x41')){var _0x2fe13f={};_0x2fe13f[_0x5ad84b[_0x1718('0x2a')]]={'$like':'%'+_0x4a1a9f[_0x1718('0x35')][_0x1718('0x3e')]+'%'};return _0x2fe13f;}})});}_0x3133a0=_['merge']({},_0x3133a0,_0x4a1a9f[_0x1718('0x42')]);var _0x4b5a96={'where':_0x3133a0[_0x1718('0x3f')]};return db[_0x1718('0x2e')]['count'](_0x4b5a96)[_0x1718('0x26')](function(_0x135d47){_0x38b243[_0x1718('0x1f')]=_0x135d47;if(_0x4a1a9f[_0x1718('0x35')][_0x1718('0x43')]){_0x3133a0[_0x1718('0x44')]=[{'all':!![]}];}return db['DeskField'][_0x1718('0x45')](_0x3133a0);})[_0x1718('0x26')](function(_0x3c013a){_0x38b243[_0x1718('0x46')]=_0x3c013a;return _0x38b243;})['then'](respondWithFilteredResult(_0x5635fc,_0x3133a0))[_0x1718('0x47')](handleError(_0x5635fc,null));};exports[_0x1718('0x48')]=function(_0x3bcccf,_0x29113e){var _0x5aaf4c={'raw':!![],'where':{'id':_0x3bcccf['params']['id']}},_0x526bc5={};_0x526bc5['model']=_[_0x1718('0x34')](db[_0x1718('0x2e')][_0x1718('0x2f')]);_0x526bc5[_0x1718('0x35')]=_[_0x1718('0x34')](_0x3bcccf[_0x1718('0x35')]);_0x526bc5['filters']=_[_0x1718('0x37')](_0x526bc5[_0x1718('0x33')],_0x526bc5[_0x1718('0x35')]);_0x5aaf4c[_0x1718('0x38')]=_[_0x1718('0x37')](_0x526bc5[_0x1718('0x33')],qs[_0x1718('0x39')](_0x3bcccf[_0x1718('0x35')]['fields']));_0x5aaf4c[_0x1718('0x38')]=_0x5aaf4c[_0x1718('0x38')][_0x1718('0x3a')]?_0x5aaf4c['attributes']:_0x526bc5[_0x1718('0x33')];if(_0x3bcccf[_0x1718('0x35')][_0x1718('0x43')]){_0x5aaf4c[_0x1718('0x44')]=[{'all':!![]}];}_0x5aaf4c=_['merge']({},_0x5aaf4c,_0x3bcccf[_0x1718('0x42')]);return db['DeskField'][_0x1718('0x49')](_0x5aaf4c)[_0x1718('0x26')](handleEntityNotFound(_0x29113e,null))[_0x1718('0x26')](respondWithResult(_0x29113e,null))[_0x1718('0x47')](handleError(_0x29113e,null));};exports['create']=function(_0x2f6fc2,_0x2d55a0){return db[_0x1718('0x2e')][_0x1718('0x4a')](_0x2f6fc2[_0x1718('0x4b')],{})[_0x1718('0x26')](respondWithResult(_0x2d55a0,0xc9))[_0x1718('0x47')](handleError(_0x2d55a0,null));};exports[_0x1718('0x25')]=function(_0x3708f4,_0x328ab8){if(_0x3708f4[_0x1718('0x4b')]['id']){delete _0x3708f4['body']['id'];}return db[_0x1718('0x2e')][_0x1718('0x49')]({'where':{'id':_0x3708f4['params']['id']}})[_0x1718('0x26')](handleEntityNotFound(_0x328ab8,null))[_0x1718('0x26')](saveUpdates(_0x3708f4['body'],null))[_0x1718('0x26')](respondWithResult(_0x328ab8,null))[_0x1718('0x47')](handleError(_0x328ab8,null));};exports[_0x1718('0x27')]=function(_0x1f1951,_0x4c90cd){return db[_0x1718('0x2e')]['find']({'where':{'id':_0x1f1951[_0x1718('0x4c')]['id']}})[_0x1718('0x26')](handleEntityNotFound(_0x4c90cd,null))[_0x1718('0x26')](removeEntity(_0x4c90cd,null))[_0x1718('0x47')](handleError(_0x4c90cd,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index be3f0b5..a16d5ee 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 _0x5860=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2c3b05,_0x1f4dee){var _0x5eaf86=function(_0x10a873){while(--_0x10a873){_0x2c3b05['push'](_0x2c3b05['shift']());}};_0x5eaf86(++_0x1f4dee);}(_0x5860,0xb1));var _0x0586=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x5860[_0x5beda8];return _0x2aa042;};'use strict';var _=require(_0x0586('0x0'));var util=require(_0x0586('0x1'));var logger=require(_0x0586('0x2'))('api');var moment=require(_0x0586('0x3'));var BPromise=require(_0x0586('0x4'));var rp=require(_0x0586('0x5'));var fs=require('fs');var path=require(_0x0586('0x6'));var rimraf=require(_0x0586('0x7'));var config=require(_0x0586('0x8'));var attributes=require(_0x0586('0x9'));module[_0x0586('0xa')]=function(_0x1f20b6,_0x2ccb83){return _0x1f20b6['define']('DeskField',attributes,{'tableName':_0x0586('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x0586('0xc'),_0x0586('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x63a3=['define','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','exports'];(function(_0x4c4668,_0x99db57){var _0x2a1038=function(_0x3eb4de){while(--_0x3eb4de){_0x4c4668['push'](_0x4c4668['shift']());}};_0x2a1038(++_0x99db57);}(_0x63a3,0xe0));var _0x363a=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x63a3[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x363a('0x0'));var util=require(_0x363a('0x1'));var logger=require(_0x363a('0x2'))(_0x363a('0x3'));var moment=require('moment');var BPromise=require(_0x363a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x363a('0x5')]=function(_0x48f68f,_0xde80b0){return _0x48f68f[_0x363a('0x6')]('DeskField',attributes,{'tableName':_0x363a('0x7'),'paranoid':![],'indexes':[{'name':_0x363a('0x8'),'fields':['idField',_0x363a('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 1c2bccb..dafbb8b 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 _0x989a=['DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','request','then','info'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x989a,0x14d));var _0xa989=function(_0x22c1d4,_0x39ee19){_0x22c1d4=_0x22c1d4-0x0;var _0x4159a6=_0x989a[_0x22c1d4];return _0x4159a6;};'use strict';var _=require(_0xa989('0x0'));var util=require('util');var moment=require(_0xa989('0x1'));var BPromise=require(_0xa989('0x2'));var rs=require(_0xa989('0x3'));var fs=require('fs');var Redis=require(_0xa989('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa989('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x140b02,_0x497aad,_0x3aceaa){return new BPromise(function(_0x1da6bc,_0x1f234a){return client[_0xa989('0x6')](_0x140b02,_0x3aceaa)[_0xa989('0x7')](function(_0x5c1ce3){logger[_0xa989('0x8')](_0xa989('0x9'),_0x497aad,_0xa989('0xa'));logger[_0xa989('0xb')](_0xa989('0xc'),_0x497aad,_0xa989('0xa'),JSON[_0xa989('0xd')](_0x5c1ce3));if(_0x5c1ce3[_0xa989('0xe')]){if(_0x5c1ce3[_0xa989('0xe')][_0xa989('0xf')]===0x1f4){logger[_0xa989('0xe')](_0xa989('0x9'),_0x497aad,_0x5c1ce3[_0xa989('0xe')]['message']);return _0x1f234a(_0x5c1ce3[_0xa989('0xe')][_0xa989('0x10')]);}logger[_0xa989('0xe')](_0xa989('0x9'),_0x497aad,_0x5c1ce3[_0xa989('0xe')]['message']);return _0x1da6bc(_0x5c1ce3[_0xa989('0xe')][_0xa989('0x10')]);}else{logger['info'](_0xa989('0x9'),_0x497aad,_0xa989('0xa'));_0x1da6bc(_0x5c1ce3[_0xa989('0x11')][_0xa989('0x10')]);}})[_0xa989('0x12')](function(_0x40c276){logger[_0xa989('0xe')](_0xa989('0x9'),_0x497aad,_0x40c276);_0x1f234a(_0x40c276);});});} \ No newline at end of file +var _0xe359=['../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xe359,0xb8));var _0x9e35=function(_0x433081,_0x30a258){_0x433081=_0x433081-0x0;var _0x4ee7b6=_0xe359[_0x433081];return _0x4ee7b6;};'use strict';var _=require('lodash');var util=require(_0x9e35('0x0'));var moment=require(_0x9e35('0x1'));var BPromise=require(_0x9e35('0x2'));var rs=require(_0x9e35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e35('0x4'))['db'];var utils=require(_0x9e35('0x5'));var logger=require(_0x9e35('0x6'))(_0x9e35('0x7'));var config=require(_0x9e35('0x8'));var jayson=require(_0x9e35('0x9'));var client=jayson[_0x9e35('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x304c17,_0x29afc4,_0x215516){return new BPromise(function(_0x381ff0,_0x4159d3){return client[_0x9e35('0xb')](_0x304c17,_0x215516)[_0x9e35('0xc')](function(_0x4e3175){logger[_0x9e35('0xd')](_0x9e35('0xe'),_0x29afc4,_0x9e35('0xf'));logger[_0x9e35('0x10')](_0x9e35('0x11'),_0x29afc4,'request\x20sent',JSON[_0x9e35('0x12')](_0x4e3175));if(_0x4e3175[_0x9e35('0x13')]){if(_0x4e3175[_0x9e35('0x13')][_0x9e35('0x14')]===0x1f4){logger[_0x9e35('0x13')](_0x9e35('0xe'),_0x29afc4,_0x4e3175[_0x9e35('0x13')]['message']);return _0x4159d3(_0x4e3175['error']['message']);}logger['error']('DeskField,\x20%s,\x20%s',_0x29afc4,_0x4e3175[_0x9e35('0x13')]['message']);return _0x381ff0(_0x4e3175['error'][_0x9e35('0x15')]);}else{logger[_0x9e35('0xd')](_0x9e35('0xe'),_0x29afc4,_0x9e35('0xf'));_0x381ff0(_0x4e3175[_0x9e35('0x16')][_0x9e35('0x15')]);}})[_0x9e35('0x17')](function(_0x5def41){logger[_0x9e35('0x13')](_0x9e35('0xe'),_0x29afc4,_0x5def41);_0x4159d3(_0x5def41);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b66200c..7d1f566 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 _0x677f=['get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x677f,0x7e));var _0xf677=function(_0x1ff766,_0x16759f){_0x1ff766=_0x1ff766-0x0;var _0x183f8f=_0x677f[_0x1ff766];return _0x183f8f;};'use strict';var multer=require(_0xf677('0x0'));var util=require(_0xf677('0x1'));var path=require(_0xf677('0x2'));var timeout=require(_0xf677('0x3'));var express=require(_0xf677('0x4'));var router=express[_0xf677('0x5')]();var fs_extra=require(_0xf677('0x6'));var auth=require(_0xf677('0x7'));var interaction=require(_0xf677('0x8'));var config=require(_0xf677('0x9'));var controller=require(_0xf677('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xf677('0xb')]);router[_0xf677('0xc')]('/:id',auth[_0xf677('0xd')](),controller['show']);router['get'](_0xf677('0xe'),auth[_0xf677('0xd')](),controller[_0xf677('0xf')]);router[_0xf677('0xc')](_0xf677('0x10'),auth[_0xf677('0xd')](),controller[_0xf677('0x11')]);router[_0xf677('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf677('0x12')](_0xf677('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xf677('0x13'),auth[_0xf677('0xd')](),controller['update']);router[_0xf677('0x14')](_0xf677('0x13'),auth[_0xf677('0xd')](),controller[_0xf677('0x15')]);module[_0xf677('0x16')]=router; \ No newline at end of file +var _0x79be=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','path'];(function(_0x4aa71a,_0x58800f){var _0x17bb3=function(_0x157183){while(--_0x157183){_0x4aa71a['push'](_0x4aa71a['shift']());}};_0x17bb3(++_0x58800f);}(_0x79be,0x18b));var _0xe79b=function(_0x1b964f,_0x3fabfa){_0x1b964f=_0x1b964f-0x0;var _0x2d7d15=_0x79be[_0x1b964f];return _0x2d7d15;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe79b('0x0'));var timeout=require('connect-timeout');var express=require(_0xe79b('0x1'));var router=express[_0xe79b('0x2')]();var fs_extra=require(_0xe79b('0x3'));var auth=require(_0xe79b('0x4'));var interaction=require(_0xe79b('0x5'));var config=require(_0xe79b('0x6'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xe79b('0x7')](),controller[_0xe79b('0x8')]);router[_0xe79b('0x9')](_0xe79b('0xa'),auth['isAuthenticated'](),controller[_0xe79b('0xb')]);router[_0xe79b('0x9')]('/:id/configurations',auth[_0xe79b('0x7')](),controller['getConfigurations']);router['get'](_0xe79b('0xc'),auth[_0xe79b('0x7')](),controller[_0xe79b('0xd')]);router[_0xe79b('0xe')]('/',auth[_0xe79b('0x7')](),controller[_0xe79b('0xf')]);router[_0xe79b('0xe')](_0xe79b('0x10'),auth[_0xe79b('0x7')](),controller[_0xe79b('0x11')]);router[_0xe79b('0x12')](_0xe79b('0xa'),auth[_0xe79b('0x7')](),controller[_0xe79b('0x13')]);router[_0xe79b('0x14')](_0xe79b('0xa'),auth[_0xe79b('0x7')](),controller['destroy']);module[_0xe79b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index fc96cd5..8f2885d 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 _0x576b=['BOOLEAN','STRING'];(function(_0x3790a6,_0x276d65){var _0xe6a81b=function(_0x3025a3){while(--_0x3025a3){_0x3790a6['push'](_0x3790a6['shift']());}};_0xe6a81b(++_0x276d65);}(_0x576b,0x1d9));var _0xb576=function(_0x5776fd,_0x51672c){_0x5776fd=_0x5776fd-0x0;var _0x381391=_0x576b[_0x5776fd];return _0x381391;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb576('0x0')]},'password':{'type':Sequelize[_0xb576('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xb576('0x0')]},'clientId':{'type':Sequelize[_0xb576('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb576('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xb576('0x0')]},'modernAuthentication':{'type':Sequelize[_0xb576('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd6d2=['exports','STRING','sequelize'];(function(_0x2f2bf8,_0x41d5cb){var _0x2865d2=function(_0x226a97){while(--_0x226a97){_0x2f2bf8['push'](_0x2f2bf8['shift']());}};_0x2865d2(++_0x41d5cb);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x3ab74c,_0x4ebb04){_0x3ab74c=_0x3ab74c-0x0;var _0xcff54b=_0xd6d2[_0x3ab74c];return _0xcff54b;};'use strict';var Sequelize=require(_0x2d6d('0x0'));module[_0x2d6d('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2d6d('0x2')]},'password':{'type':Sequelize[_0x2d6d('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x2d6d('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2d6d('0x2')]},'serverUrl':{'type':Sequelize[_0x2d6d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2d6d('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 98515d1..68da20f 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 _0x854d=['%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','access_token','POST','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','Content-Range','update','destroy','then','end','error','stack','name','send','index','Dynamics365Account','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','sort','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','Dynamics365Field','slice','substring','lastIndexOf','format'];(function(_0x37d6f5,_0x29705a){var _0x307790=function(_0x3e4c21){while(--_0x3e4c21){_0x37d6f5['push'](_0x37d6f5['shift']());}};_0x307790(++_0x29705a);}(_0x854d,0x13a));var _0xd854=function(_0x174635,_0x15520c){_0x174635=_0x174635-0x0;var _0x13e64e=_0x854d[_0x174635];return _0x13e64e;};'use strict';var rp=require(_0xd854('0x0'));var util=require(_0xd854('0x1'));var _=require(_0xd854('0x2'));var qs=require(_0xd854('0x3'));var logger=require(_0xd854('0x4'))('api');var db=require(_0xd854('0x5'))['db'];var integrations=require(_0xd854('0x6'));function respondWithResult(_0x50b8a9,_0x5d3e78){_0x5d3e78=_0x5d3e78||0xc8;return function(_0x2e1512){if(_0x2e1512){return _0x50b8a9[_0xd854('0x7')](_0x5d3e78)[_0xd854('0x8')](_0x2e1512);}};}function respondWithFilteredResult(_0x2f22b4,_0x4530ba){return function(_0x483e95){if(_0x483e95){var _0x26f8d7=typeof _0x4530ba[_0xd854('0x9')]===_0xd854('0xa')&&typeof _0x4530ba['limit']===_0xd854('0xa');var _0x4f71a0=_0x483e95[_0xd854('0xb')];var _0x5062e7=_0x26f8d7?0x0:_0x4530ba[_0xd854('0x9')];var _0x201515=_0x26f8d7?_0x483e95['count']:_0x4530ba['offset']+_0x4530ba['limit'];var _0x585d8d;if(_0x201515>=_0x4f71a0){_0x201515=_0x4f71a0;_0x585d8d=0xc8;}else{_0x585d8d=0xce;}_0x2f22b4[_0xd854('0x7')](_0x585d8d);return _0x2f22b4['set'](_0xd854('0xc'),_0x5062e7+'-'+_0x201515+'/'+_0x4f71a0)[_0xd854('0x8')](_0x483e95);}return null;};}function saveUpdates(_0x5447fd){return function(_0x59e413){if(_0x59e413){return _0x59e413[_0xd854('0xd')](_0x5447fd)['then'](function(_0x348b1e){return _0x348b1e;});}return null;};}function removeEntity(_0x42ac37){return function(_0x490cb1){if(_0x490cb1){return _0x490cb1[_0xd854('0xe')]()[_0xd854('0xf')](function(){_0x42ac37[_0xd854('0x7')](0xcc)[_0xd854('0x10')]();});}};}function handleEntityNotFound(_0x59e4f4){return function(_0x20f0dc){if(!_0x20f0dc){_0x59e4f4['sendStatus'](0x194);}return _0x20f0dc;};}function handleError(_0x32bd99,_0x1704ce){_0x1704ce=_0x1704ce||0x1f4;return function(_0x5e4767){logger[_0xd854('0x11')](_0x5e4767[_0xd854('0x12')]);if(_0x5e4767[_0xd854('0x13')]){delete _0x5e4767[_0xd854('0x13')];}_0x32bd99[_0xd854('0x7')](_0x1704ce)[_0xd854('0x14')](_0x5e4767);};}exports[_0xd854('0x15')]=function(_0x44157c,_0x3dcbf8){var _0x2f2631={},_0x639695={},_0x11a9dd={'count':0x0,'rows':[]};var _0x3afe53=_['map'](db[_0xd854('0x16')]['rawAttributes'],function(_0x8cf023){return{'name':_0x8cf023['fieldName'],'type':_0x8cf023['type']['key']};});_0x639695['model']=_[_0xd854('0x17')](_0x3afe53,_0xd854('0x13'));_0x639695[_0xd854('0x18')]=_[_0xd854('0x19')](_0x44157c['query']);_0x639695['filters']=_[_0xd854('0x1a')](_0x639695[_0xd854('0x1b')],_0x639695[_0xd854('0x18')]);_0x2f2631[_0xd854('0x1c')]=_[_0xd854('0x1a')](_0x639695['model'],qs[_0xd854('0x1d')](_0x44157c[_0xd854('0x18')][_0xd854('0x1d')]));_0x2f2631[_0xd854('0x1c')]=_0x2f2631[_0xd854('0x1c')][_0xd854('0x1e')]?_0x2f2631[_0xd854('0x1c')]:_0x639695[_0xd854('0x1b')];if(!_0x44157c[_0xd854('0x18')][_0xd854('0x1f')]('nolimit')){_0x2f2631['limit']=qs['limit'](_0x44157c[_0xd854('0x18')][_0xd854('0x20')]);_0x2f2631[_0xd854('0x9')]=qs[_0xd854('0x9')](_0x44157c[_0xd854('0x18')][_0xd854('0x9')]);}_0x2f2631[_0xd854('0x21')]=qs['sort'](_0x44157c[_0xd854('0x18')]['sort']);_0x2f2631[_0xd854('0x22')]=qs[_0xd854('0x23')](_[_0xd854('0x24')](_0x44157c[_0xd854('0x18')],_0x639695[_0xd854('0x23')]),_0x3afe53);if(_0x44157c['query'][_0xd854('0x25')]){_0x2f2631[_0xd854('0x22')]=_[_0xd854('0x26')](_0x2f2631[_0xd854('0x22')],{'$or':_[_0xd854('0x17')](_0x3afe53,function(_0x27fd4b){if(_0x27fd4b['type']!==_0xd854('0x27')){var _0x185d8f={};_0x185d8f[_0x27fd4b[_0xd854('0x13')]]={'$like':'%'+_0x44157c[_0xd854('0x18')]['filter']+'%'};return _0x185d8f;}})});}_0x2f2631=_[_0xd854('0x26')]({},_0x2f2631,_0x44157c['options']);var _0x33d194={'where':_0x2f2631[_0xd854('0x22')]};return db[_0xd854('0x16')][_0xd854('0xb')](_0x33d194)['then'](function(_0x46a672){_0x11a9dd[_0xd854('0xb')]=_0x46a672;if(_0x44157c[_0xd854('0x18')]['includeAll']){_0x2f2631[_0xd854('0x28')]=[{'all':!![]}];}return db[_0xd854('0x16')][_0xd854('0x29')](_0x2f2631);})[_0xd854('0xf')](function(_0x333ce2){_0x11a9dd[_0xd854('0x2a')]=_0x333ce2;return _0x11a9dd;})[_0xd854('0xf')](respondWithFilteredResult(_0x3dcbf8,_0x2f2631))[_0xd854('0x2b')](handleError(_0x3dcbf8,null));};exports['show']=function(_0x443ba2,_0x56caab){var _0x5277e1={'raw':![],'where':{'id':_0x443ba2[_0xd854('0x2c')]['id']}},_0x298d84={};_0x298d84[_0xd854('0x1b')]=_['keys'](db['Dynamics365Account'][_0xd854('0x2d')]);_0x298d84[_0xd854('0x18')]=_[_0xd854('0x19')](_0x443ba2[_0xd854('0x18')]);_0x298d84[_0xd854('0x23')]=_[_0xd854('0x1a')](_0x298d84[_0xd854('0x1b')],_0x298d84[_0xd854('0x18')]);_0x5277e1[_0xd854('0x1c')]=_[_0xd854('0x1a')](_0x298d84[_0xd854('0x1b')],qs[_0xd854('0x1d')](_0x443ba2[_0xd854('0x18')][_0xd854('0x1d')]));_0x5277e1['attributes']=_0x5277e1[_0xd854('0x1c')][_0xd854('0x1e')]?_0x5277e1[_0xd854('0x1c')]:_0x298d84[_0xd854('0x1b')];if(_0x443ba2[_0xd854('0x18')][_0xd854('0x2e')]){_0x5277e1[_0xd854('0x28')]=[{'all':!![]}];}_0x5277e1=_[_0xd854('0x26')]({},_0x5277e1,_0x443ba2[_0xd854('0x2f')]);return db[_0xd854('0x16')][_0xd854('0x30')](_0x5277e1)['then'](handleEntityNotFound(_0x56caab,null))[_0xd854('0xf')](respondWithResult(_0x56caab,null))[_0xd854('0x2b')](handleError(_0x56caab,null));};exports[_0xd854('0x31')]=function(_0x5512fa,_0x4d5be8){return db[_0xd854('0x16')][_0xd854('0x31')](_0x5512fa[_0xd854('0x32')],{})[_0xd854('0xf')](respondWithResult(_0x4d5be8,0xc9))[_0xd854('0x2b')](handleError(_0x4d5be8,null));};exports[_0xd854('0xd')]=function(_0x13415a,_0x2f01de){if(_0x13415a[_0xd854('0x32')]['id']){delete _0x13415a[_0xd854('0x32')]['id'];}return db[_0xd854('0x16')][_0xd854('0x30')]({'where':{'id':_0x13415a['params']['id']}})[_0xd854('0xf')](handleEntityNotFound(_0x2f01de,null))['then'](saveUpdates(_0x13415a[_0xd854('0x32')],null))[_0xd854('0xf')](respondWithResult(_0x2f01de,null))[_0xd854('0x2b')](handleError(_0x2f01de,null));};exports[_0xd854('0xe')]=function(_0x11e550,_0x31fb7c){return db[_0xd854('0x16')][_0xd854('0x30')]({'where':{'id':_0x11e550[_0xd854('0x2c')]['id']}})[_0xd854('0xf')](handleEntityNotFound(_0x31fb7c,null))[_0xd854('0xf')](removeEntity(_0x31fb7c,null))[_0xd854('0x2b')](handleError(_0x31fb7c,null));};exports[_0xd854('0x33')]=function(_0x5d5048,_0x4ee4e5){var _0x223990={};var _0x415bb0={};var _0x16d4fd;var _0x599ae5;return db['Dynamics365Account'][_0xd854('0x34')]({'where':{'id':_0x5d5048[_0xd854('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4ee4e5,null))[_0xd854('0xf')](function(_0xdda6a3){if(_0xdda6a3){_0x16d4fd=_0xdda6a3;_0x415bb0[_0xd854('0x1b')]=_[_0xd854('0x19')](db[_0xd854('0x35')]['rawAttributes']);_0x415bb0[_0xd854('0x18')]=_['keys'](_0x5d5048[_0xd854('0x18')]);_0x415bb0[_0xd854('0x23')]=_['intersection'](_0x415bb0[_0xd854('0x1b')],_0x415bb0[_0xd854('0x18')]);_0x223990[_0xd854('0x1c')]=_['intersection'](_0x415bb0[_0xd854('0x1b')],qs[_0xd854('0x1d')](_0x5d5048['query'][_0xd854('0x1d')]));_0x223990[_0xd854('0x1c')]=_0x223990[_0xd854('0x1c')][_0xd854('0x1e')]?_0x223990['attributes']:_0x415bb0[_0xd854('0x1b')];_0x223990[_0xd854('0x21')]=qs['sort'](_0x5d5048[_0xd854('0x18')][_0xd854('0x36')]);_0x223990['where']=qs[_0xd854('0x23')](_['pick'](_0x5d5048[_0xd854('0x18')],_0x415bb0['filters']));if(_0x5d5048[_0xd854('0x18')][_0xd854('0x25')]){_0x223990[_0xd854('0x22')]=_[_0xd854('0x26')](_0x223990['where'],{'$or':_[_0xd854('0x17')](_0x223990[_0xd854('0x1c')],function(_0x614788){var _0x2c254a={};_0x2c254a[_0x614788]={'$like':'%'+_0x5d5048['query'][_0xd854('0x25')]+'%'};return _0x2c254a;})});}_0x223990=_[_0xd854('0x26')]({},_0x223990,_0x5d5048[_0xd854('0x2f')]);return _0x16d4fd[_0xd854('0x33')](_0x223990);}})[_0xd854('0xf')](function(_0x3da018){if(_0x3da018){_0x599ae5=_0x3da018[_0xd854('0x1e')];if(!_0x5d5048[_0xd854('0x18')][_0xd854('0x1f')](_0xd854('0x37'))){_0x223990['limit']=qs[_0xd854('0x20')](_0x5d5048[_0xd854('0x18')]['limit']);_0x223990[_0xd854('0x9')]=qs['offset'](_0x5d5048[_0xd854('0x18')][_0xd854('0x9')]);}return _0x16d4fd[_0xd854('0x33')](_0x223990);}})[_0xd854('0xf')](function(_0x57a7fd){if(_0x57a7fd){return _0x57a7fd?{'count':_0x599ae5,'rows':_0x57a7fd}:null;}})[_0xd854('0xf')](respondWithResult(_0x4ee4e5,null))['catch'](handleError(_0x4ee4e5,null));};exports['addConfiguration']=function(_0x11d34e,_0x2da6dd){if(_0x11d34e[_0xd854('0x32')]['id']){delete _0x11d34e[_0xd854('0x32')]['id'];}return db[_0xd854('0x16')]['findOne']({'where':{'id':_0x11d34e['params']['id']}})['then'](handleEntityNotFound(_0x2da6dd,null))['then'](function(_0x5c7a2c){if(_0x5c7a2c){_0x11d34e[_0xd854('0x32')][_0xd854('0x38')]=_0x5c7a2c['id'];_0x11d34e[_0xd854('0x32')][_0xd854('0x39')]=integrations[_0xd854('0x3a')](_0x11d34e[_0xd854('0x32')][_0xd854('0x3b')],_0x11d34e[_0xd854('0x32')]['type']);_0x11d34e[_0xd854('0x32')][_0xd854('0x3c')]=integrations[_0xd854('0x3d')](_0x11d34e['body'][_0xd854('0x3b')],_0x11d34e[_0xd854('0x32')][_0xd854('0x3e')]);return db[_0xd854('0x35')]['create'](_0x11d34e[_0xd854('0x32')],{'include':[{'model':db[_0xd854('0x3f')],'as':_0xd854('0x39')},{'model':db[_0xd854('0x3f')],'as':_0xd854('0x3c')}]});}return null;})[_0xd854('0xf')](respondWithResult(_0x2da6dd,null))[_0xd854('0x2b')](handleError(_0x2da6dd,null));};function sanitizeRemoteUri(_0x51ddda){var _0x53a700=_0x51ddda[_0xd854('0x40')](-0x1);if(_0x53a700==='/')return _0x51ddda[_0xd854('0x41')](0x0,_0x51ddda[_0xd854('0x42')](_0x53a700));return _0x51ddda;}function getWebApiUrl(_0xd67d3a){return util[_0xd854('0x43')](_0xd854('0x44'),_0xd67d3a);}exports[_0xd854('0x45')]=function(_0x1ed4ab,_0x3fe46e){var _0x3c3df3=_0x1ed4ab[_0xd854('0x18')]['ticketType'];var _0x11beaa=_0x3c3df3==='incident'?_0xd854('0x46'):_0xd854('0x47');var _0x3a7b5a='';var _0x2c9204='';var _0x3d2d9d='';var _0x2a9cf9='';var _0x37aeb6='';var _0x19379d='';var _0x1e8687='';var _0x46df40='';var _0xdea8c9=[_0xd854('0x48'),_0xd854('0x49'),_0xd854('0x4a'),_0xd854('0x4b'),_0xd854('0x4c'),_0xd854('0x4d'),_0xd854('0x4e'),_0xd854('0x4f'),_0xd854('0x50'),_0xd854('0x51')];var _0x44ca47=[_0xd854('0x52'),_0xd854('0x53'),'actualserviceunits',_0xd854('0x54'),_0xd854('0x55'),_0xd854('0x56'),'contractdetailidname',_0xd854('0x57'),_0xd854('0x58'),'createdbyexternalpartyyominame','createdbyname',_0xd854('0x59'),_0xd854('0x5a'),_0xd854('0x5b'),'createdonbehalfbyyominame','customeridname',_0xd854('0x5c'),_0xd854('0x5d'),_0xd854('0x5e'),_0xd854('0x5f'),_0xd854('0x60'),_0xd854('0x61'),'escalatedon',_0xd854('0x62'),'firstresponsebykpiidname',_0xd854('0x63'),_0xd854('0x64'),_0xd854('0x65'),_0xd854('0x66'),'lastonholdtime',_0xd854('0x67'),_0xd854('0x68'),_0xd854('0x69'),_0xd854('0x6a'),'modifiedbyyominame',_0xd854('0x6b'),_0xd854('0x6c'),_0xd854('0x6d'),_0xd854('0x6e'),'msdyn_iotalertname','numberofchildincidents',_0xd854('0x6f'),_0xd854('0x70'),_0xd854('0x71'),_0xd854('0x72'),_0xd854('0x73'),_0xd854('0x74'),_0xd854('0x75'),'primarycontactidyominame',_0xd854('0x76'),_0xd854('0x77'),_0xd854('0x78'),_0xd854('0x79'),_0xd854('0x7a'),'responseby',_0xd854('0x7b'),'responsiblecontactidyominame',_0xd854('0x7c'),_0xd854('0x7d'),_0xd854('0x7e'),_0xd854('0x7f'),_0xd854('0x80'),_0xd854('0x81'),_0xd854('0x82'),_0xd854('0x83'),_0xd854('0x84'),_0xd854('0x85'),_0xd854('0x86'),_0xd854('0x87'),_0xd854('0x88')];var _0xb13748=_0xdea8c9[_0xd854('0x89')](_0x44ca47);return db[_0xd854('0x16')][_0xd854('0x34')]({'where':{'id':_0x1ed4ab['params']['id']},'attributes':['id',_0xd854('0x8a'),_0xd854('0x8b'),_0xd854('0x8c'),_0xd854('0x8d'),_0xd854('0x8e'),_0xd854('0x8f'),'modernAuthentication'],'include':[{'model':db[_0xd854('0x90')],'as':_0xd854('0x90'),'attributes':['id',_0xd854('0x91'),_0xd854('0x92')]}]})[_0xd854('0xf')](handleEntityNotFound(_0x3fe46e,null))['then'](function(_0x11fe4c){if(_0x11fe4c){if(_0x11fe4c['modernAuthentication']){_0x11fe4c[_0xd854('0x93')]=_0x11fe4c[_0xd854('0x90')][_0xd854('0x91')];_0x46df40=sanitizeRemoteUri(_0x11fe4c[_0xd854('0x90')][_0xd854('0x92')]);_0x1e8687=getWebApiUrl(_0x46df40);return _0x11fe4c;}_0x46df40=sanitizeRemoteUri(_0x11fe4c['remoteUri']);_0x1e8687=getWebApiUrl(_0x46df40);var _0x45e6d1={'method':_0xd854('0x94'),'uri':'https://login.microsoftonline.com/'+_0x11fe4c['tenantId']+'/oauth2/token','form':{'client_id':_0x11fe4c[_0xd854('0x8e')],'resource':_0x46df40,'username':_0x11fe4c['username'],'password':_0x11fe4c['password'],'grant_type':_0xd854('0x8b'),'client_secret':_0x11fe4c['clientSecret']},'json':!![]};return rp(_0x45e6d1);}})[_0xd854('0xf')](function(_0x1f5cc9){_0x19379d=_0x1f5cc9[_0xd854('0x93')];var _0x1bfa43={'method':_0xd854('0x95'),'uri':encodeURI(_0x1e8687+_0xd854('0x96')+_0x11beaa+'\x27'),'headers':{'Authorization':_0xd854('0x97')+_0x19379d,'If-None-Match':null,'OData-Version':_0xd854('0x98')},'json':!![]};return rp(_0x1bfa43);})[_0xd854('0xf')](function(_0x2b322b){var _0x346719=_0x2b322b[_0xd854('0x99')][0x0];var _0x33394d=_0x346719[_0xd854('0x9a')];var _0x15f800={'method':'GET','uri':_0x1e8687+_0xd854('0x9b')+_0x33394d+_0xd854('0x9c'),'headers':{'Authorization':_0xd854('0x97')+_0x19379d,'If-None-Match':null,'OData-Version':_0xd854('0x98')},'json':!![]};return rp(_0x15f800);})[_0xd854('0xf')](function(_0x532e49){_0x3a7b5a=_0x532e49;_0x2c9204=_0x3a7b5a[_0xd854('0x9d')];_0x2c9204=_['remove'](_0x2c9204,function(_0x13b9ec){return!_0xb13748[_0xd854('0x9e')](_0x13b9ec[_0xd854('0x9f')]);});var _0x2e20f6=[];var _0x325ce2=[];_0x2c9204[_0xd854('0xa0')](function(_0x254f96){if(_0x254f96[_0xd854('0xa1')]){var _0x259043=_0x254f96[_0xd854('0xa1')][_0xd854('0x41')](_0x254f96[_0xd854('0xa1')][_0xd854('0x42')]('.')+0x1);if(_0x259043===_0xd854('0xa2')){_0x2e20f6[_0xd854('0xa3')](getSelectList(_0x1e8687,_0x3c3df3,_0x325ce2,_0x3a7b5a[_0xd854('0x9a')],_0x254f96[_0xd854('0x9a')],_0x19379d));}}});return Promise[_0xd854('0xa4')](_0x2e20f6);})['then'](function(_0x3c8b54){_0x3d2d9d=_0x3c8b54[0x0];var _0x15c904=[];var _0xf87eef=[];_0x2c9204['forEach'](function(_0x249362){if(!_[_0xd854('0xa5')](_0x249362[_0xd854('0xa1')])){var _0xaf8034=_0x249362[_0xd854('0xa1')][_0xd854('0x41')](_0x249362['@odata.type']['lastIndexOf']('.')+0x1);if(_0xaf8034===_0xd854('0xa6')){_0x15c904[_0xd854('0xa3')](getBooleanList(_0x1e8687,_0x3c3df3,_0xf87eef,_0x3a7b5a[_0xd854('0x9a')],_0x249362[_0xd854('0x9a')],_0x19379d));}}});return Promise[_0xd854('0xa4')](_0x15c904);})[_0xd854('0xf')](function(_0x5f99a7){_0x2a9cf9=_0x5f99a7[0x0];var _0x200272=[];var _0x1afbbe=[];_0x2c9204[_0xd854('0xa0')](function(_0x17e473){if(_0x17e473[_0xd854('0xa1')]){var _0x4ecb7b=_0x17e473[_0xd854('0xa1')][_0xd854('0x41')](_0x17e473[_0xd854('0xa1')][_0xd854('0x42')]('.')+0x1);if(_0x4ecb7b===_0xd854('0xa7')||_0x4ecb7b===_0xd854('0xa8')||_0x4ecb7b===_0xd854('0xa9')||_0x4ecb7b===_0xd854('0xaa')||_0x4ecb7b===_0xd854('0xab')||_0x4ecb7b==='DateTimeAttributeMetadata'||_0x4ecb7b===_0xd854('0xac')||_0x4ecb7b==='EntityNameAttributeMetadata'||_0x4ecb7b==='StateAttributeMetadata'||_0x4ecb7b===_0xd854('0xad')){_0x200272[_0xd854('0xa3')](getInputList(_0x1e8687,_0x3c3df3,_0x4ecb7b,_0x1afbbe,_0x3a7b5a[_0xd854('0x9a')],_0x17e473[_0xd854('0x9a')],_0x19379d));}}});return Promise['all'](_0x200272);})[_0xd854('0xf')](function(_0x2ab799){_0x37aeb6=_0x2ab799[0x0];var _0x6ca662=_0x3d2d9d[_0xd854('0x89')](_0x2a9cf9)[_0xd854('0x89')](_0x37aeb6);var _0x43d5ca={'count':_0x6ca662['length'],'rows':_0x6ca662};return _0x43d5ca;})[_0xd854('0xf')](respondWithResult(_0x3fe46e,null))[_0xd854('0x2b')](function(_0x40adc1){var _0x5ee584=_0x1ed4ab[_0xd854('0x18')][_0xd854('0xae')]?0x1f4:_0x40adc1[_0xd854('0xaf')]||0x1f4;logger['error'](_0x40adc1[_0xd854('0x12')]);delete _0x40adc1[_0xd854('0x13')];if(_0x5ee584===0x191){_0x5ee584=0x190;}_0x3fe46e[_0xd854('0x7')](_0x5ee584)[_0xd854('0x14')](_0x1ed4ab[_0xd854('0x18')][_0xd854('0xae')]?{'message':_0xd854('0xb0'),'statusCode':_0x40adc1['statusCode']}:_0x40adc1);});};function getSelectList(_0x30fe8d,_0x28f687,_0x3daa1c,_0x1d55a1,_0x3347c7,_0x315341){var _0x55140e={'method':'GET','uri':_0x30fe8d+_0xd854('0x9b')+_0x1d55a1+')/Attributes('+_0x3347c7+_0xd854('0xb1')+_0xd854('0xb2'),'headers':{'Authorization':'Bearer\x20'+_0x315341,'If-None-Match':null,'OData-Version':_0xd854('0x98')},'json':!![]};return rp(_0x55140e)[_0xd854('0xf')](function(_0x1e84d0){var _0xefb9=[];var _0x50b0e8=_0x1e84d0[_0xd854('0xb3')]['Options'];_0x50b0e8[_0xd854('0xa0')](function(_0x16838b){_0xefb9['push']({'name':_0x16838b['Label'][_0xd854('0xb4')][_0xd854('0xb5')],'value':String(_0x16838b[_0xd854('0xb6')])});});var _0x2dad37={'id':_0x28f687+'_'+_0x1e84d0[_0xd854('0x9f')],'name':_0x1e84d0[_0xd854('0xb7')][_0xd854('0xb4')][_0xd854('0xb5')],'custom':![],'options':_0xefb9};_0x3daa1c[_0xd854('0xa3')](_0x2dad37);return _0x3daa1c;});}function getBooleanList(_0x3e9722,_0xc94928,_0x458174,_0x22e1bb,_0x38d978,_0x5d54cc){var _0x5353a2={'method':_0xd854('0x95'),'uri':_0x3e9722+_0xd854('0x9b')+_0x22e1bb+_0xd854('0xb8')+_0x38d978+_0xd854('0xb9'),'headers':{'Authorization':_0xd854('0x97')+_0x5d54cc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5353a2)[_0xd854('0xf')](function(_0x37e4b3){var _0x3d8ced=[];_0x3d8ced[_0xd854('0xa3')]({'name':_0x37e4b3[_0xd854('0xb3')][_0xd854('0xba')][_0xd854('0xb5')]['UserLocalizedLabel'][_0xd854('0xb5')],'value':_0xd854('0xbb')},{'name':_0x37e4b3['OptionSet'][_0xd854('0xbc')][_0xd854('0xb5')]['UserLocalizedLabel']['Label'],'value':_0xd854('0xbd')});var _0x1d847f={'id':_0xc94928+'_'+_0x37e4b3[_0xd854('0x9f')],'name':_0x37e4b3[_0xd854('0xb7')]['UserLocalizedLabel'][_0xd854('0xb5')],'custom':![],'options':_0x3d8ced};_0x458174[_0xd854('0xa3')](_0x1d847f);return _0x458174;});}function getInputList(_0x33c697,_0x402234,_0x2105f5,_0x18da74,_0x32933d,_0x58a007,_0x1783db){var _0x596a99={'method':'GET','uri':_0x33c697+'EntityDefinitions('+_0x32933d+')/Attributes('+_0x58a007+')/Microsoft.Dynamics.CRM.'+_0x2105f5+_0xd854('0xbe'),'headers':{'Authorization':_0xd854('0x97')+_0x1783db,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x596a99)[_0xd854('0xf')](function(_0x13dd2f){var _0x3ecf25={'id':_0x402234+'_'+_0x13dd2f[_0xd854('0x9f')],'name':_0x13dd2f['DisplayName'][_0xd854('0xb4')]?_0x13dd2f['DisplayName'][_0xd854('0xb4')][_0xd854('0xb5')]:_0x13dd2f['LogicalName'],'custom':![],'options':[]};_0x18da74[_0xd854('0xa3')](_0x3ecf25);return _0x18da74;});} \ No newline at end of file +var _0xd22b=['sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','username','password','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','limit','set','update','then','destroy','end','sendStatus','error','name','send','map','Dynamics365Account','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','filter','hasOwnProperty','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdon','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname'];(function(_0x4e6890,_0x4a0bb1){var _0x2eb59f=function(_0xc02788){while(--_0xc02788){_0x4e6890['push'](_0x4e6890['shift']());}};_0x2eb59f(++_0x4a0bb1);}(_0xd22b,0x102));var _0xbd22=function(_0x10424b,_0x1ccb00){_0x10424b=_0x10424b-0x0;var _0x39e61f=_0xd22b[_0x10424b];return _0x39e61f;};'use strict';var rp=require(_0xbd22('0x0'));var util=require(_0xbd22('0x1'));var _=require('lodash');var qs=require(_0xbd22('0x2'));var logger=require('../../config/logger')(_0xbd22('0x3'));var db=require(_0xbd22('0x4'))['db'];var integrations=require(_0xbd22('0x5'));function respondWithResult(_0x33f630,_0x2b748e){_0x2b748e=_0x2b748e||0xc8;return function(_0x58b381){if(_0x58b381){return _0x33f630[_0xbd22('0x6')](_0x2b748e)[_0xbd22('0x7')](_0x58b381);}};}function respondWithFilteredResult(_0x362425,_0xa00bc5){return function(_0x4ab4ee){if(_0x4ab4ee){var _0x29504c=typeof _0xa00bc5['offset']===_0xbd22('0x8')&&typeof _0xa00bc5['limit']==='undefined';var _0x12be0d=_0x4ab4ee[_0xbd22('0x9')];var _0x48625f=_0x29504c?0x0:_0xa00bc5[_0xbd22('0xa')];var _0x30b016=_0x29504c?_0x4ab4ee[_0xbd22('0x9')]:_0xa00bc5[_0xbd22('0xa')]+_0xa00bc5[_0xbd22('0xb')];var _0x28cf6b;if(_0x30b016>=_0x12be0d){_0x30b016=_0x12be0d;_0x28cf6b=0xc8;}else{_0x28cf6b=0xce;}_0x362425[_0xbd22('0x6')](_0x28cf6b);return _0x362425[_0xbd22('0xc')]('Content-Range',_0x48625f+'-'+_0x30b016+'/'+_0x12be0d)[_0xbd22('0x7')](_0x4ab4ee);}return null;};}function saveUpdates(_0x536715){return function(_0x460a99){if(_0x460a99){return _0x460a99[_0xbd22('0xd')](_0x536715)[_0xbd22('0xe')](function(_0x157b2e){return _0x157b2e;});}return null;};}function removeEntity(_0x19084c){return function(_0x47e78d){if(_0x47e78d){return _0x47e78d[_0xbd22('0xf')]()[_0xbd22('0xe')](function(){_0x19084c['status'](0xcc)[_0xbd22('0x10')]();});}};}function handleEntityNotFound(_0x588584){return function(_0x1a8b88){if(!_0x1a8b88){_0x588584[_0xbd22('0x11')](0x194);}return _0x1a8b88;};}function handleError(_0x392cb8,_0x98c833){_0x98c833=_0x98c833||0x1f4;return function(_0x366c4f){logger[_0xbd22('0x12')](_0x366c4f['stack']);if(_0x366c4f[_0xbd22('0x13')]){delete _0x366c4f[_0xbd22('0x13')];}_0x392cb8[_0xbd22('0x6')](_0x98c833)[_0xbd22('0x14')](_0x366c4f);};}exports['index']=function(_0x4f9914,_0x16b371){var _0x528413={},_0x53f284={},_0x4df096={'count':0x0,'rows':[]};var _0x3bd1e0=_[_0xbd22('0x15')](db[_0xbd22('0x16')][_0xbd22('0x17')],function(_0x459b3c){return{'name':_0x459b3c[_0xbd22('0x18')],'type':_0x459b3c['type'][_0xbd22('0x19')]};});_0x53f284[_0xbd22('0x1a')]=_['map'](_0x3bd1e0,_0xbd22('0x13'));_0x53f284['query']=_[_0xbd22('0x1b')](_0x4f9914[_0xbd22('0x1c')]);_0x53f284[_0xbd22('0x1d')]=_['intersection'](_0x53f284[_0xbd22('0x1a')],_0x53f284[_0xbd22('0x1c')]);_0x528413[_0xbd22('0x1e')]=_[_0xbd22('0x1f')](_0x53f284[_0xbd22('0x1a')],qs[_0xbd22('0x20')](_0x4f9914[_0xbd22('0x1c')][_0xbd22('0x20')]));_0x528413[_0xbd22('0x1e')]=_0x528413['attributes'][_0xbd22('0x21')]?_0x528413[_0xbd22('0x1e')]:_0x53f284['model'];if(!_0x4f9914[_0xbd22('0x1c')]['hasOwnProperty'](_0xbd22('0x22'))){_0x528413['limit']=qs['limit'](_0x4f9914[_0xbd22('0x1c')][_0xbd22('0xb')]);_0x528413['offset']=qs[_0xbd22('0xa')](_0x4f9914[_0xbd22('0x1c')]['offset']);}_0x528413[_0xbd22('0x23')]=qs[_0xbd22('0x24')](_0x4f9914[_0xbd22('0x1c')][_0xbd22('0x24')]);_0x528413[_0xbd22('0x25')]=qs[_0xbd22('0x1d')](_[_0xbd22('0x26')](_0x4f9914[_0xbd22('0x1c')],_0x53f284[_0xbd22('0x1d')]),_0x3bd1e0);if(_0x4f9914[_0xbd22('0x1c')]['filter']){_0x528413[_0xbd22('0x25')]=_['merge'](_0x528413['where'],{'$or':_[_0xbd22('0x15')](_0x3bd1e0,function(_0x3a131f){if(_0x3a131f['type']!==_0xbd22('0x27')){var _0x367686={};_0x367686[_0x3a131f[_0xbd22('0x13')]]={'$like':'%'+_0x4f9914[_0xbd22('0x1c')]['filter']+'%'};return _0x367686;}})});}_0x528413=_[_0xbd22('0x28')]({},_0x528413,_0x4f9914[_0xbd22('0x29')]);var _0x3b7bd4={'where':_0x528413[_0xbd22('0x25')]};return db[_0xbd22('0x16')]['count'](_0x3b7bd4)[_0xbd22('0xe')](function(_0x1dfccc){_0x4df096[_0xbd22('0x9')]=_0x1dfccc;if(_0x4f9914[_0xbd22('0x1c')][_0xbd22('0x2a')]){_0x528413[_0xbd22('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xbd22('0x2c')](_0x528413);})[_0xbd22('0xe')](function(_0x124ee8){_0x4df096[_0xbd22('0x2d')]=_0x124ee8;return _0x4df096;})['then'](respondWithFilteredResult(_0x16b371,_0x528413))[_0xbd22('0x2e')](handleError(_0x16b371,null));};exports[_0xbd22('0x2f')]=function(_0x2286fa,_0x357673){var _0x47d85a={'raw':![],'where':{'id':_0x2286fa[_0xbd22('0x30')]['id']}},_0x25d53c={};_0x25d53c[_0xbd22('0x1a')]=_['keys'](db['Dynamics365Account'][_0xbd22('0x17')]);_0x25d53c[_0xbd22('0x1c')]=_['keys'](_0x2286fa[_0xbd22('0x1c')]);_0x25d53c[_0xbd22('0x1d')]=_['intersection'](_0x25d53c[_0xbd22('0x1a')],_0x25d53c['query']);_0x47d85a[_0xbd22('0x1e')]=_['intersection'](_0x25d53c[_0xbd22('0x1a')],qs['fields'](_0x2286fa['query']['fields']));_0x47d85a['attributes']=_0x47d85a[_0xbd22('0x1e')][_0xbd22('0x21')]?_0x47d85a[_0xbd22('0x1e')]:_0x25d53c[_0xbd22('0x1a')];if(_0x2286fa[_0xbd22('0x1c')][_0xbd22('0x2a')]){_0x47d85a[_0xbd22('0x2b')]=[{'all':!![]}];}_0x47d85a=_[_0xbd22('0x28')]({},_0x47d85a,_0x2286fa['options']);return db[_0xbd22('0x16')][_0xbd22('0x31')](_0x47d85a)[_0xbd22('0xe')](handleEntityNotFound(_0x357673,null))[_0xbd22('0xe')](respondWithResult(_0x357673,null))[_0xbd22('0x2e')](handleError(_0x357673,null));};exports[_0xbd22('0x32')]=function(_0x1e8c95,_0x1c4c93){return db[_0xbd22('0x16')]['create'](_0x1e8c95[_0xbd22('0x33')],{})[_0xbd22('0xe')](respondWithResult(_0x1c4c93,0xc9))[_0xbd22('0x2e')](handleError(_0x1c4c93,null));};exports[_0xbd22('0xd')]=function(_0x15a402,_0x1c170b){if(_0x15a402[_0xbd22('0x33')]['id']){delete _0x15a402[_0xbd22('0x33')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x15a402[_0xbd22('0x30')]['id']}})['then'](handleEntityNotFound(_0x1c170b,null))[_0xbd22('0xe')](saveUpdates(_0x15a402[_0xbd22('0x33')],null))[_0xbd22('0xe')](respondWithResult(_0x1c170b,null))['catch'](handleError(_0x1c170b,null));};exports[_0xbd22('0xf')]=function(_0x3c68a2,_0x1b5896){return db['Dynamics365Account'][_0xbd22('0x31')]({'where':{'id':_0x3c68a2[_0xbd22('0x30')]['id']}})[_0xbd22('0xe')](handleEntityNotFound(_0x1b5896,null))[_0xbd22('0xe')](removeEntity(_0x1b5896,null))[_0xbd22('0x2e')](handleError(_0x1b5896,null));};exports[_0xbd22('0x34')]=function(_0x2a2ea4,_0x4aae43){var _0x117cb4={};var _0x109dc6={};var _0x5cf0c8;var _0x2a89f1;return db[_0xbd22('0x16')][_0xbd22('0x35')]({'where':{'id':_0x2a2ea4[_0xbd22('0x30')]['id']}})['then'](handleEntityNotFound(_0x4aae43,null))[_0xbd22('0xe')](function(_0x4726d6){if(_0x4726d6){_0x5cf0c8=_0x4726d6;_0x109dc6[_0xbd22('0x1a')]=_[_0xbd22('0x1b')](db[_0xbd22('0x36')][_0xbd22('0x17')]);_0x109dc6['query']=_[_0xbd22('0x1b')](_0x2a2ea4[_0xbd22('0x1c')]);_0x109dc6[_0xbd22('0x1d')]=_[_0xbd22('0x1f')](_0x109dc6[_0xbd22('0x1a')],_0x109dc6[_0xbd22('0x1c')]);_0x117cb4['attributes']=_['intersection'](_0x109dc6[_0xbd22('0x1a')],qs['fields'](_0x2a2ea4[_0xbd22('0x1c')]['fields']));_0x117cb4[_0xbd22('0x1e')]=_0x117cb4[_0xbd22('0x1e')]['length']?_0x117cb4[_0xbd22('0x1e')]:_0x109dc6[_0xbd22('0x1a')];_0x117cb4['order']=qs[_0xbd22('0x24')](_0x2a2ea4[_0xbd22('0x1c')]['sort']);_0x117cb4['where']=qs[_0xbd22('0x1d')](_[_0xbd22('0x26')](_0x2a2ea4[_0xbd22('0x1c')],_0x109dc6[_0xbd22('0x1d')]));if(_0x2a2ea4['query'][_0xbd22('0x37')]){_0x117cb4[_0xbd22('0x25')]=_[_0xbd22('0x28')](_0x117cb4[_0xbd22('0x25')],{'$or':_[_0xbd22('0x15')](_0x117cb4['attributes'],function(_0x642dd9){var _0x1dfc3a={};_0x1dfc3a[_0x642dd9]={'$like':'%'+_0x2a2ea4[_0xbd22('0x1c')][_0xbd22('0x37')]+'%'};return _0x1dfc3a;})});}_0x117cb4=_['merge']({},_0x117cb4,_0x2a2ea4[_0xbd22('0x29')]);return _0x5cf0c8[_0xbd22('0x34')](_0x117cb4);}})['then'](function(_0x3387e4){if(_0x3387e4){_0x2a89f1=_0x3387e4[_0xbd22('0x21')];if(!_0x2a2ea4['query'][_0xbd22('0x38')](_0xbd22('0x22'))){_0x117cb4['limit']=qs[_0xbd22('0xb')](_0x2a2ea4[_0xbd22('0x1c')][_0xbd22('0xb')]);_0x117cb4[_0xbd22('0xa')]=qs[_0xbd22('0xa')](_0x2a2ea4[_0xbd22('0x1c')][_0xbd22('0xa')]);}return _0x5cf0c8['getConfigurations'](_0x117cb4);}})[_0xbd22('0xe')](function(_0x17d322){if(_0x17d322){return _0x17d322?{'count':_0x2a89f1,'rows':_0x17d322}:null;}})['then'](respondWithResult(_0x4aae43,null))[_0xbd22('0x2e')](handleError(_0x4aae43,null));};exports['addConfiguration']=function(_0x37cd35,_0xa3ee57){if(_0x37cd35['body']['id']){delete _0x37cd35[_0xbd22('0x33')]['id'];}return db[_0xbd22('0x16')][_0xbd22('0x35')]({'where':{'id':_0x37cd35[_0xbd22('0x30')]['id']}})[_0xbd22('0xe')](handleEntityNotFound(_0xa3ee57,null))['then'](function(_0x4e2b70){if(_0x4e2b70){_0x37cd35[_0xbd22('0x33')][_0xbd22('0x39')]=_0x4e2b70['id'];_0x37cd35[_0xbd22('0x33')][_0xbd22('0x3a')]=integrations[_0xbd22('0x3b')](_0x37cd35[_0xbd22('0x33')][_0xbd22('0x3c')],_0x37cd35['body'][_0xbd22('0x3d')]);_0x37cd35[_0xbd22('0x33')][_0xbd22('0x3e')]=integrations[_0xbd22('0x3f')](_0x37cd35[_0xbd22('0x33')][_0xbd22('0x3c')],_0x37cd35[_0xbd22('0x33')]['type']);return db[_0xbd22('0x36')][_0xbd22('0x32')](_0x37cd35['body'],{'include':[{'model':db[_0xbd22('0x40')],'as':'Subjects'},{'model':db[_0xbd22('0x40')],'as':_0xbd22('0x3e')}]});}return null;})[_0xbd22('0xe')](respondWithResult(_0xa3ee57,null))['catch'](handleError(_0xa3ee57,null));};function sanitizeRemoteUri(_0x20436b){var _0x5b8f55=_0x20436b[_0xbd22('0x41')](-0x1);if(_0x5b8f55==='/')return _0x20436b[_0xbd22('0x42')](0x0,_0x20436b[_0xbd22('0x43')](_0x5b8f55));return _0x20436b;}function getWebApiUrl(_0x4d9c00){return util[_0xbd22('0x44')]('%s/api/data/v9.0/',_0x4d9c00);}exports[_0xbd22('0x45')]=function(_0x122657,_0x580d66){var _0x359c2d=_0x122657[_0xbd22('0x1c')]['ticketType'];var _0x3ca738=_0x359c2d==='incident'?_0xbd22('0x46'):_0xbd22('0x47');var _0x1682ea='';var _0x1bebe0='';var _0x44bb4e='';var _0x363896='';var _0x96a899='';var _0x3d485c='';var _0x492a88='';var _0x10a0cf='';var _0x3177d3=[_0xbd22('0x48'),_0xbd22('0x49'),_0xbd22('0x4a'),_0xbd22('0x4b'),_0xbd22('0x4c'),_0xbd22('0x4d'),_0xbd22('0x4e'),_0xbd22('0x4f'),'directioncode',_0xbd22('0x50')];var _0x28d2fa=[_0xbd22('0x51'),'accountidyominame',_0xbd22('0x52'),'billedserviceunits',_0xbd22('0x53'),_0xbd22('0x54'),_0xbd22('0x55'),_0xbd22('0x56'),'createdbyexternalpartyname',_0xbd22('0x57'),'createdbyname','createdbyyominame',_0xbd22('0x58'),'createdonbehalfbyname',_0xbd22('0x59'),'customeridname',_0xbd22('0x5a'),'customeridyominame',_0xbd22('0x5b'),_0xbd22('0x5c'),_0xbd22('0x5d'),'entityimage_url',_0xbd22('0x5e'),'exchangerate',_0xbd22('0x5f'),_0xbd22('0x60'),'importsequencenumber',_0xbd22('0x61'),'kbarticleidname',_0xbd22('0x62'),_0xbd22('0x63'),_0xbd22('0x64'),_0xbd22('0x65'),_0xbd22('0x66'),'modifiedbyyominame',_0xbd22('0x67'),'modifiedonbehalfbyname',_0xbd22('0x68'),'msdyn_incidenttypename',_0xbd22('0x69'),_0xbd22('0x6a'),_0xbd22('0x6b'),'overriddencreatedon','owneridname',_0xbd22('0x6c'),_0xbd22('0x6d'),'parentcaseidname',_0xbd22('0x6e'),_0xbd22('0x6f'),_0xbd22('0x70'),_0xbd22('0x71'),_0xbd22('0x72'),_0xbd22('0x73'),'resolvebykpiidname',_0xbd22('0x74'),_0xbd22('0x75'),'responsiblecontactidyominame',_0xbd22('0x76'),_0xbd22('0x77'),_0xbd22('0x78'),_0xbd22('0x79'),_0xbd22('0x7a'),_0xbd22('0x7b'),_0xbd22('0x7c'),_0xbd22('0x7d'),_0xbd22('0x7e'),_0xbd22('0x7f'),_0xbd22('0x80'),'utcconversiontimezonecode',_0xbd22('0x81')];var _0x2f7838=_0x3177d3[_0xbd22('0x82')](_0x28d2fa);return db[_0xbd22('0x16')]['findOne']({'where':{'id':_0x122657[_0xbd22('0x30')]['id']},'attributes':['id','username','password','remoteUri',_0xbd22('0x83'),_0xbd22('0x84'),_0xbd22('0x85'),_0xbd22('0x86')],'include':[{'model':db[_0xbd22('0x87')],'as':_0xbd22('0x87'),'attributes':['id',_0xbd22('0x88'),_0xbd22('0x89')]}]})[_0xbd22('0xe')](handleEntityNotFound(_0x580d66,null))[_0xbd22('0xe')](function(_0x50d47f){if(_0x50d47f){if(_0x50d47f[_0xbd22('0x86')]){_0x50d47f['access_token']=_0x50d47f['CloudProvider'][_0xbd22('0x88')];_0x10a0cf=sanitizeRemoteUri(_0x50d47f[_0xbd22('0x87')][_0xbd22('0x89')]);_0x492a88=getWebApiUrl(_0x10a0cf);return _0x50d47f;}_0x10a0cf=sanitizeRemoteUri(_0x50d47f[_0xbd22('0x8a')]);_0x492a88=getWebApiUrl(_0x10a0cf);var _0x132afa={'method':_0xbd22('0x8b'),'uri':_0xbd22('0x8c')+_0x50d47f['tenantId']+_0xbd22('0x8d'),'form':{'client_id':_0x50d47f['clientId'],'resource':_0x10a0cf,'username':_0x50d47f[_0xbd22('0x8e')],'password':_0x50d47f[_0xbd22('0x8f')],'grant_type':_0xbd22('0x8f'),'client_secret':_0x50d47f[_0xbd22('0x85')]},'json':!![]};return rp(_0x132afa);}})[_0xbd22('0xe')](function(_0x435f8c){_0x3d485c=_0x435f8c['access_token'];var _0x302a54={'method':'GET','uri':encodeURI(_0x492a88+_0xbd22('0x90')+_0x3ca738+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x3d485c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x302a54);})['then'](function(_0x565bf3){var _0x3cfb3d=_0x565bf3[_0xbd22('0x91')][0x0];var _0x2abed8=_0x3cfb3d[_0xbd22('0x92')];var _0x2c3a18={'method':_0xbd22('0x93'),'uri':_0x492a88+_0xbd22('0x94')+_0x2abed8+_0xbd22('0x95'),'headers':{'Authorization':'Bearer\x20'+_0x3d485c,'If-None-Match':null,'OData-Version':_0xbd22('0x96')},'json':!![]};return rp(_0x2c3a18);})['then'](function(_0x288e84){_0x1682ea=_0x288e84;_0x1bebe0=_0x1682ea[_0xbd22('0x97')];_0x1bebe0=_['remove'](_0x1bebe0,function(_0x281779){return!_0x2f7838['includes'](_0x281779[_0xbd22('0x98')]);});var _0x3ccdce=[];var _0x2ad2e2=[];_0x1bebe0[_0xbd22('0x99')](function(_0x2df99c){if(_0x2df99c[_0xbd22('0x9a')]){var _0x2f9498=_0x2df99c[_0xbd22('0x9a')][_0xbd22('0x42')](_0x2df99c[_0xbd22('0x9a')][_0xbd22('0x43')]('.')+0x1);if(_0x2f9498===_0xbd22('0x9b')){_0x3ccdce['push'](getSelectList(_0x492a88,_0x359c2d,_0x2ad2e2,_0x1682ea[_0xbd22('0x92')],_0x2df99c[_0xbd22('0x92')],_0x3d485c));}}});return Promise[_0xbd22('0x9c')](_0x3ccdce);})['then'](function(_0x2e3f71){_0x44bb4e=_0x2e3f71[0x0];var _0x484255=[];var _0x5cf71c=[];_0x1bebe0['forEach'](function(_0xf90e89){if(!_['isNil'](_0xf90e89['@odata.type'])){var _0x345eb9=_0xf90e89[_0xbd22('0x9a')]['substring'](_0xf90e89[_0xbd22('0x9a')][_0xbd22('0x43')]('.')+0x1);if(_0x345eb9===_0xbd22('0x9d')){_0x484255['push'](getBooleanList(_0x492a88,_0x359c2d,_0x5cf71c,_0x1682ea[_0xbd22('0x92')],_0xf90e89[_0xbd22('0x92')],_0x3d485c));}}});return Promise['all'](_0x484255);})[_0xbd22('0xe')](function(_0x4bbd56){_0x363896=_0x4bbd56[0x0];var _0x4259af=[];var _0x298d7d=[];_0x1bebe0[_0xbd22('0x99')](function(_0x3e8c80){if(_0x3e8c80[_0xbd22('0x9a')]){var _0x2cd059=_0x3e8c80[_0xbd22('0x9a')]['substring'](_0x3e8c80[_0xbd22('0x9a')]['lastIndexOf']('.')+0x1);if(_0x2cd059===_0xbd22('0x9e')||_0x2cd059===_0xbd22('0x9f')||_0x2cd059===_0xbd22('0xa0')||_0x2cd059===_0xbd22('0xa1')||_0x2cd059===_0xbd22('0xa2')||_0x2cd059===_0xbd22('0xa3')||_0x2cd059===_0xbd22('0xa4')||_0x2cd059===_0xbd22('0xa5')||_0x2cd059===_0xbd22('0xa6')||_0x2cd059===_0xbd22('0xa7')){_0x4259af[_0xbd22('0xa8')](getInputList(_0x492a88,_0x359c2d,_0x2cd059,_0x298d7d,_0x1682ea['MetadataId'],_0x3e8c80['MetadataId'],_0x3d485c));}}});return Promise[_0xbd22('0x9c')](_0x4259af);})['then'](function(_0x56df18){_0x96a899=_0x56df18[0x0];var _0x6c2819=_0x44bb4e['concat'](_0x363896)[_0xbd22('0x82')](_0x96a899);var _0x3aee74={'count':_0x6c2819[_0xbd22('0x21')],'rows':_0x6c2819};return _0x3aee74;})[_0xbd22('0xe')](respondWithResult(_0x580d66,null))[_0xbd22('0x2e')](function(_0x26dcb8){var _0x2ab18f=_0x122657[_0xbd22('0x1c')]['test']?0x1f4:_0x26dcb8[_0xbd22('0xa9')]||0x1f4;logger['error'](_0x26dcb8[_0xbd22('0xaa')]);delete _0x26dcb8['name'];if(_0x2ab18f===0x191){_0x2ab18f=0x190;}_0x580d66[_0xbd22('0x6')](_0x2ab18f)['send'](_0x122657['query']['test']?{'message':_0xbd22('0xab'),'statusCode':_0x26dcb8[_0xbd22('0xa9')]}:_0x26dcb8);});};function getSelectList(_0x304787,_0x1bb59a,_0x5ee353,_0xad2339,_0x42ef19,_0x4589e5){var _0x3e7154={'method':_0xbd22('0x93'),'uri':_0x304787+_0xbd22('0x94')+_0xad2339+_0xbd22('0xac')+_0x42ef19+_0xbd22('0xad')+_0xbd22('0xae'),'headers':{'Authorization':'Bearer\x20'+_0x4589e5,'If-None-Match':null,'OData-Version':_0xbd22('0x96')},'json':!![]};return rp(_0x3e7154)[_0xbd22('0xe')](function(_0xc9a8bc){var _0xfadf06=[];var _0x4eb46c=_0xc9a8bc[_0xbd22('0xaf')][_0xbd22('0xb0')];_0x4eb46c[_0xbd22('0x99')](function(_0x112f95){_0xfadf06['push']({'name':_0x112f95[_0xbd22('0xb1')][_0xbd22('0xb2')]['Label'],'value':String(_0x112f95[_0xbd22('0xb3')])});});var _0x3e4ca2={'id':_0x1bb59a+'_'+_0xc9a8bc[_0xbd22('0x98')],'name':_0xc9a8bc['DisplayName'][_0xbd22('0xb2')]['Label'],'custom':![],'options':_0xfadf06};_0x5ee353['push'](_0x3e4ca2);return _0x5ee353;});}function getBooleanList(_0x3f7a1c,_0x5c35ee,_0x4e6037,_0x31e23e,_0x3d1327,_0xcf625d){var _0x260321={'method':'GET','uri':_0x3f7a1c+_0xbd22('0x94')+_0x31e23e+')/Attributes('+_0x3d1327+_0xbd22('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0xcf625d,'If-None-Match':null,'OData-Version':_0xbd22('0x96')},'json':!![]};return rp(_0x260321)[_0xbd22('0xe')](function(_0x18f194){var _0x3f91a6=[];_0x3f91a6[_0xbd22('0xa8')]({'name':_0x18f194[_0xbd22('0xaf')][_0xbd22('0xb5')][_0xbd22('0xb1')][_0xbd22('0xb2')][_0xbd22('0xb1')],'value':_0xbd22('0xb6')},{'name':_0x18f194[_0xbd22('0xaf')][_0xbd22('0xb7')][_0xbd22('0xb1')]['UserLocalizedLabel'][_0xbd22('0xb1')],'value':_0xbd22('0xb8')});var _0x2bd113={'id':_0x5c35ee+'_'+_0x18f194[_0xbd22('0x98')],'name':_0x18f194[_0xbd22('0xb9')][_0xbd22('0xb2')]['Label'],'custom':![],'options':_0x3f91a6};_0x4e6037['push'](_0x2bd113);return _0x4e6037;});}function getInputList(_0xdddbd0,_0x87a538,_0x15d5cd,_0x382b72,_0x3052f2,_0xa26224,_0x4774ae){var _0x40df78={'method':'GET','uri':_0xdddbd0+_0xbd22('0x94')+_0x3052f2+_0xbd22('0xac')+_0xa26224+_0xbd22('0xba')+_0x15d5cd+_0xbd22('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x4774ae,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x40df78)[_0xbd22('0xe')](function(_0x3b059b){var _0x14ac53={'id':_0x87a538+'_'+_0x3b059b['LogicalName'],'name':_0x3b059b[_0xbd22('0xb9')]['UserLocalizedLabel']?_0x3b059b[_0xbd22('0xb9')][_0xbd22('0xb2')][_0xbd22('0xb1')]:_0x3b059b[_0xbd22('0x98')],'custom':![],'options':[]};_0x382b72[_0xbd22('0xa8')](_0x14ac53);return _0x382b72;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index dd7ef28..a79964d 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x181402,_0x257395){var _0x2ac441=function(_0x36c903){while(--_0x36c903){_0x181402['push'](_0x181402['shift']());}};_0x2ac441(++_0x257395);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x323116,_0x1745d5){var _0x34ad7f=function(_0x460c84){while(--_0x460c84){_0x323116['push'](_0x323116['shift']());}};_0x34ad7f(++_0x1745d5);}(_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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index eb1a0ed..fefe286 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 _0x3e6c=['ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','map','include','attributes','model','info','ShowDynamics365Account','find','bluebird','randomstring'];(function(_0x58c745,_0x5329aa){var _0x2600ed=function(_0x454038){while(--_0x454038){_0x58c745['push'](_0x58c745['shift']());}};_0x2600ed(++_0x5329aa);}(_0x3e6c,0x196));var _0xc3e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc3e6('0x0'));var rs=require(_0xc3e6('0x1'));var fs=require('fs');var Redis=require(_0xc3e6('0x2'));var db=require(_0xc3e6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc3e6('0x4'));var config=require(_0xc3e6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc3e6('0x6')][_0xc3e6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3def8b,_0x28b9b9,_0x16baac){return new BPromise(function(_0x5572ae,_0x13cd77){return client[_0xc3e6('0x8')](_0x3def8b,_0x16baac)[_0xc3e6('0x9')](function(_0x314c45){logger['info'](_0xc3e6('0xa'),_0x28b9b9,'request\x20sent');logger[_0xc3e6('0xb')](_0xc3e6('0xc'),_0x28b9b9,'request\x20sent',JSON[_0xc3e6('0xd')](_0x314c45));if(_0x314c45[_0xc3e6('0xe')]){if(_0x314c45[_0xc3e6('0xe')][_0xc3e6('0xf')]===0x1f4){logger['error'](_0xc3e6('0xa'),_0x28b9b9,_0x314c45[_0xc3e6('0xe')][_0xc3e6('0x10')]);return _0x13cd77(_0x314c45[_0xc3e6('0xe')]['message']);}logger[_0xc3e6('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x28b9b9,_0x314c45['error']['message']);return _0x5572ae(_0x314c45['error']['message']);}else{logger['info'](_0xc3e6('0xa'),_0x28b9b9,_0xc3e6('0x11'));_0x5572ae(_0x314c45[_0xc3e6('0x12')][_0xc3e6('0x10')]);}})[_0xc3e6('0x13')](function(_0x48ec5b){logger[_0xc3e6('0xe')](_0xc3e6('0xa'),_0x28b9b9,_0x48ec5b);_0x13cd77(_0x48ec5b);});});}exports[_0xc3e6('0x14')]=function(_0x2805a7){var _0x5a3c93=this;return new Promise(function(_0x521cfe,_0x308e86){return db[_0xc3e6('0x15')][_0xc3e6('0x16')]({'raw':_0x2805a7[_0xc3e6('0x17')]?_0x2805a7[_0xc3e6('0x17')][_0xc3e6('0x18')]===undefined?!![]:![]:!![],'where':_0x2805a7[_0xc3e6('0x17')]?_0x2805a7[_0xc3e6('0x17')][_0xc3e6('0x19')]||null:null,'attributes':_0x2805a7[_0xc3e6('0x17')]?_0x2805a7[_0xc3e6('0x17')]['attributes']||null:null,'limit':_0x2805a7[_0xc3e6('0x17')]?_0x2805a7['options'][_0xc3e6('0x1a')]||null:null,'include':_0x2805a7[_0xc3e6('0x17')]?_0x2805a7[_0xc3e6('0x17')]['include']?_[_0xc3e6('0x1b')](_0x2805a7[_0xc3e6('0x17')][_0xc3e6('0x1c')],function(_0xcd0117){return{'model':db[_0xcd0117['model']],'as':_0xcd0117['as'],'attributes':_0xcd0117[_0xc3e6('0x1d')],'include':_0xcd0117[_0xc3e6('0x1c')]?_['map'](_0xcd0117[_0xc3e6('0x1c')],function(_0x23414c){return{'model':db[_0x23414c[_0xc3e6('0x1e')]],'as':_0x23414c['as'],'attributes':_0x23414c[_0xc3e6('0x1d')],'include':_0x23414c['include']?_[_0xc3e6('0x1b')](_0x23414c[_0xc3e6('0x1c')],function(_0x5006b7){return{'model':db[_0x5006b7[_0xc3e6('0x1e')]],'as':_0x5006b7['as'],'attributes':_0x5006b7[_0xc3e6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc3e6('0x9')](function(_0x5ad6d7){logger[_0xc3e6('0x1f')](_0xc3e6('0x14'),_0x2805a7);logger['debug'](_0xc3e6('0x14'),_0x2805a7,JSON[_0xc3e6('0xd')](_0x5ad6d7));_0x521cfe(_0x5ad6d7);})[_0xc3e6('0x13')](function(_0x551ee5){logger[_0xc3e6('0xe')](_0xc3e6('0x14'),_0x551ee5[_0xc3e6('0x10')],_0x2805a7);_0x308e86(_0x5a3c93['error'](0x1f4,_0x551ee5[_0xc3e6('0x10')]));});});};exports[_0xc3e6('0x20')]=function(_0x381115){var _0x58b53f=this;return new Promise(function(_0x3afa53,_0x409888){return db[_0xc3e6('0x15')][_0xc3e6('0x21')]({'raw':_0x381115[_0xc3e6('0x17')]?_0x381115['options'][_0xc3e6('0x18')]===undefined?!![]:![]:!![],'where':_0x381115[_0xc3e6('0x17')]?_0x381115[_0xc3e6('0x17')][_0xc3e6('0x19')]||null:null,'attributes':_0x381115['options']?_0x381115['options'][_0xc3e6('0x1d')]||null:null,'include':_0x381115['options']?_0x381115['options'][_0xc3e6('0x1c')]?_['map'](_0x381115['options'][_0xc3e6('0x1c')],function(_0x34c02c){return{'model':db[_0x34c02c['model']],'as':_0x34c02c['as'],'attributes':_0x34c02c[_0xc3e6('0x1d')],'include':_0x34c02c[_0xc3e6('0x1c')]?_['map'](_0x34c02c['include'],function(_0x1d26f0){return{'model':db[_0x1d26f0[_0xc3e6('0x1e')]],'as':_0x1d26f0['as'],'attributes':_0x1d26f0[_0xc3e6('0x1d')],'include':_0x1d26f0[_0xc3e6('0x1c')]?_[_0xc3e6('0x1b')](_0x1d26f0[_0xc3e6('0x1c')],function(_0x1d6e30){return{'model':db[_0x1d6e30[_0xc3e6('0x1e')]],'as':_0x1d6e30['as'],'attributes':_0x1d6e30['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3e6('0x9')](function(_0x1cd26a){logger[_0xc3e6('0x1f')](_0xc3e6('0x20'),_0x381115);logger['debug']('ShowDynamics365Account',_0x381115,JSON[_0xc3e6('0xd')](_0x1cd26a));_0x3afa53(_0x1cd26a);})['catch'](function(_0x3803da){logger[_0xc3e6('0xe')](_0xc3e6('0x20'),_0x3803da[_0xc3e6('0x10')],_0x381115);_0x409888(_0x58b53f[_0xc3e6('0xe')](0x1f4,_0x3803da[_0xc3e6('0x10')]));});});}; \ No newline at end of file +var _0xcbca=['include','map','model','ShowDynamics365Account','find','debug','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes'];(function(_0x5c763f,_0xd5b7c9){var _0x1a6b7f=function(_0x1c3db4){while(--_0x1c3db4){_0x5c763f['push'](_0x5c763f['shift']());}};_0x1a6b7f(++_0xd5b7c9);}(_0xcbca,0x139));var _0xacbc=function(_0x2a679c,_0x1ae8ef){_0x2a679c=_0x2a679c-0x0;var _0x560b70=_0xcbca[_0x2a679c];return _0x560b70;};'use strict';var _=require('lodash');var util=require(_0xacbc('0x0'));var moment=require(_0xacbc('0x1'));var BPromise=require('bluebird');var rs=require(_0xacbc('0x2'));var fs=require('fs');var Redis=require(_0xacbc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xacbc('0x4'));var logger=require(_0xacbc('0x5'))(_0xacbc('0x6'));var config=require(_0xacbc('0x7'));var jayson=require(_0xacbc('0x8'));var client=jayson[_0xacbc('0x9')][_0xacbc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd3d32d,_0x57db7a,_0x9e0374){return new BPromise(function(_0x228496,_0x3f3c90){return client['request'](_0xd3d32d,_0x9e0374)[_0xacbc('0xb')](function(_0x5bc543){logger[_0xacbc('0xc')](_0xacbc('0xd'),_0x57db7a,_0xacbc('0xe'));logger['debug'](_0xacbc('0xf'),_0x57db7a,'request\x20sent',JSON[_0xacbc('0x10')](_0x5bc543));if(_0x5bc543['error']){if(_0x5bc543[_0xacbc('0x11')]['code']===0x1f4){logger[_0xacbc('0x11')](_0xacbc('0xd'),_0x57db7a,_0x5bc543['error']['message']);return _0x3f3c90(_0x5bc543[_0xacbc('0x11')][_0xacbc('0x12')]);}logger[_0xacbc('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x57db7a,_0x5bc543['error'][_0xacbc('0x12')]);return _0x228496(_0x5bc543[_0xacbc('0x11')][_0xacbc('0x12')]);}else{logger[_0xacbc('0xc')](_0xacbc('0xd'),_0x57db7a,_0xacbc('0xe'));_0x228496(_0x5bc543[_0xacbc('0x13')][_0xacbc('0x12')]);}})['catch'](function(_0x513bf7){logger['error'](_0xacbc('0xd'),_0x57db7a,_0x513bf7);_0x3f3c90(_0x513bf7);});});}exports[_0xacbc('0x14')]=function(_0x59517f){var _0x230ce6=this;return new Promise(function(_0x495b26,_0x12e050){return db[_0xacbc('0x15')][_0xacbc('0x16')]({'raw':_0x59517f[_0xacbc('0x17')]?_0x59517f['options'][_0xacbc('0x18')]===undefined?!![]:![]:!![],'where':_0x59517f['options']?_0x59517f['options'][_0xacbc('0x19')]||null:null,'attributes':_0x59517f[_0xacbc('0x17')]?_0x59517f[_0xacbc('0x17')][_0xacbc('0x1a')]||null:null,'limit':_0x59517f[_0xacbc('0x17')]?_0x59517f[_0xacbc('0x17')]['limit']||null:null,'include':_0x59517f[_0xacbc('0x17')]?_0x59517f[_0xacbc('0x17')][_0xacbc('0x1b')]?_[_0xacbc('0x1c')](_0x59517f['options'][_0xacbc('0x1b')],function(_0x3a639a){return{'model':db[_0x3a639a[_0xacbc('0x1d')]],'as':_0x3a639a['as'],'attributes':_0x3a639a[_0xacbc('0x1a')],'include':_0x3a639a['include']?_[_0xacbc('0x1c')](_0x3a639a[_0xacbc('0x1b')],function(_0x6edc1c){return{'model':db[_0x6edc1c[_0xacbc('0x1d')]],'as':_0x6edc1c['as'],'attributes':_0x6edc1c[_0xacbc('0x1a')],'include':_0x6edc1c[_0xacbc('0x1b')]?_[_0xacbc('0x1c')](_0x6edc1c[_0xacbc('0x1b')],function(_0x4cc36a){return{'model':db[_0x4cc36a[_0xacbc('0x1d')]],'as':_0x4cc36a['as'],'attributes':_0x4cc36a[_0xacbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xacbc('0xb')](function(_0x3de82f){logger[_0xacbc('0xc')]('GetDynamics365Account',_0x59517f);logger['debug'](_0xacbc('0x14'),_0x59517f,JSON[_0xacbc('0x10')](_0x3de82f));_0x495b26(_0x3de82f);})['catch'](function(_0xef488f){logger[_0xacbc('0x11')](_0xacbc('0x14'),_0xef488f[_0xacbc('0x12')],_0x59517f);_0x12e050(_0x230ce6['error'](0x1f4,_0xef488f[_0xacbc('0x12')]));});});};exports[_0xacbc('0x1e')]=function(_0xa7a6fd){var _0x3ed782=this;return new Promise(function(_0x1e9dc3,_0x2ba1b2){return db['Dynamics365Account'][_0xacbc('0x1f')]({'raw':_0xa7a6fd[_0xacbc('0x17')]?_0xa7a6fd['options']['raw']===undefined?!![]:![]:!![],'where':_0xa7a6fd[_0xacbc('0x17')]?_0xa7a6fd['options'][_0xacbc('0x19')]||null:null,'attributes':_0xa7a6fd[_0xacbc('0x17')]?_0xa7a6fd[_0xacbc('0x17')]['attributes']||null:null,'include':_0xa7a6fd['options']?_0xa7a6fd[_0xacbc('0x17')]['include']?_[_0xacbc('0x1c')](_0xa7a6fd[_0xacbc('0x17')]['include'],function(_0x2ee6e6){return{'model':db[_0x2ee6e6[_0xacbc('0x1d')]],'as':_0x2ee6e6['as'],'attributes':_0x2ee6e6[_0xacbc('0x1a')],'include':_0x2ee6e6['include']?_[_0xacbc('0x1c')](_0x2ee6e6[_0xacbc('0x1b')],function(_0x50e612){return{'model':db[_0x50e612['model']],'as':_0x50e612['as'],'attributes':_0x50e612[_0xacbc('0x1a')],'include':_0x50e612[_0xacbc('0x1b')]?_[_0xacbc('0x1c')](_0x50e612[_0xacbc('0x1b')],function(_0xb0c559){return{'model':db[_0xb0c559[_0xacbc('0x1d')]],'as':_0xb0c559['as'],'attributes':_0xb0c559[_0xacbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xacbc('0xb')](function(_0x5a879d){logger['info'](_0xacbc('0x1e'),_0xa7a6fd);logger[_0xacbc('0x20')](_0xacbc('0x1e'),_0xa7a6fd,JSON[_0xacbc('0x10')](_0x5a879d));_0x1e9dc3(_0x5a879d);})[_0xacbc('0x21')](function(_0x17a101){logger[_0xacbc('0x11')](_0xacbc('0x1e'),_0x17a101[_0xacbc('0x12')],_0xa7a6fd);_0x2ba1b2(_0x3ed782[_0xacbc('0x11')](0x1f4,_0x17a101[_0xacbc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ab856ab..ab137ef 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 _0x70b7=['getDescriptions','post','create','delete','/:id','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Configuration.controller','get','index','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5e5d21,_0x2817dd){var _0x20398d=function(_0x595d6e){while(--_0x595d6e){_0x5e5d21['push'](_0x5e5d21['shift']());}};_0x20398d(++_0x2817dd);}(_0x70b7,0x1e9));var _0x770b=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x70b7[_0x5b7788];return _0x573871;};'use strict';var multer=require('multer');var util=require(_0x770b('0x0'));var path=require('path');var timeout=require(_0x770b('0x1'));var express=require(_0x770b('0x2'));var router=express[_0x770b('0x3')]();var fs_extra=require(_0x770b('0x4'));var auth=require(_0x770b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x770b('0x6'));router[_0x770b('0x7')]('/',auth['isAuthenticated'](),controller[_0x770b('0x8')]);router['get']('/:id',auth[_0x770b('0x9')](),controller['show']);router[_0x770b('0x7')](_0x770b('0xa'),auth[_0x770b('0x9')](),controller[_0x770b('0xb')]);router[_0x770b('0x7')](_0x770b('0xc'),auth[_0x770b('0x9')](),controller[_0x770b('0xd')]);router[_0x770b('0x7')](_0x770b('0xe'),auth[_0x770b('0x9')](),controller[_0x770b('0xf')]);router[_0x770b('0x10')]('/',auth['isAuthenticated'](),controller[_0x770b('0x11')]);router['put']('/:id',auth[_0x770b('0x9')](),controller['update']);router[_0x770b('0x12')](_0x770b('0x13'),auth[_0x770b('0x9')](),controller['destroy']);module[_0x770b('0x14')]=router; \ No newline at end of file +var _0xe3cf=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0xe3cf,0x16f));var _0xfe3c=function(_0x46f89c,_0x2aa737){_0x46f89c=_0x46f89c-0x0;var _0x2038a2=_0xe3cf[_0x46f89c];return _0x2038a2;};'use strict';var multer=require(_0xfe3c('0x0'));var util=require('util');var path=require(_0xfe3c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe3c('0x2'));var auth=require(_0xfe3c('0x3'));var interaction=require(_0xfe3c('0x4'));var config=require(_0xfe3c('0x5'));var controller=require(_0xfe3c('0x6'));router[_0xfe3c('0x7')]('/',auth['isAuthenticated'](),controller[_0xfe3c('0x8')]);router[_0xfe3c('0x7')](_0xfe3c('0x9'),auth[_0xfe3c('0xa')](),controller[_0xfe3c('0xb')]);router['get'](_0xfe3c('0xc'),auth['isAuthenticated'](),controller[_0xfe3c('0xd')]);router[_0xfe3c('0x7')](_0xfe3c('0xe'),auth[_0xfe3c('0xa')](),controller[_0xfe3c('0xf')]);router[_0xfe3c('0x7')]('/:id/descriptions',auth[_0xfe3c('0xa')](),controller[_0xfe3c('0x10')]);router[_0xfe3c('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfe3c('0x12')]('/:id',auth[_0xfe3c('0xa')](),controller[_0xfe3c('0x13')]);router[_0xfe3c('0x14')](_0xfe3c('0x9'),auth[_0xfe3c('0xa')](),controller[_0xfe3c('0x15')]);module[_0xfe3c('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 ec88011..55fbc18 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 _0x437a=['STRING','ENUM','phonecall','incident','contact','exports'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x437a,0x1c1));var _0xa437=function(_0x21399e,_0xbc6101){_0x21399e=_0x21399e-0x0;var _0x3b7be4=_0x437a[_0x21399e];return _0x3b7be4;};'use strict';var Sequelize=require('sequelize');module[_0xa437('0x0')]={'name':{'type':Sequelize[_0xa437('0x1')]},'description':{'type':Sequelize[_0xa437('0x1')]},'ticketType':{'type':Sequelize[_0xa437('0x2')]('incident',_0xa437('0x3')),'defaultValue':_0xa437('0x4')},'moduleCreate':{'type':Sequelize[_0xa437('0x2')](_0xa437('0x5'),'nothing'),'defaultValue':_0xa437('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xaa15=['incident','phonecall','nothing','contact','sequelize','STRING','ENUM'];(function(_0x139db3,_0x22a5bf){var _0xde6ed7=function(_0x444626){while(--_0x444626){_0x139db3['push'](_0x139db3['shift']());}};_0xde6ed7(++_0x22a5bf);}(_0xaa15,0x89));var _0x5aa1=function(_0x5555ed,_0xabc974){_0x5555ed=_0x5555ed-0x0;var _0x38e997=_0xaa15[_0x5555ed];return _0x38e997;};'use strict';var Sequelize=require(_0x5aa1('0x0'));module['exports']={'name':{'type':Sequelize[_0x5aa1('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5aa1('0x2')](_0x5aa1('0x3'),_0x5aa1('0x4')),'defaultValue':_0x5aa1('0x3')},'moduleCreate':{'type':Sequelize[_0x5aa1('0x2')]('contact',_0x5aa1('0x5')),'defaultValue':_0x5aa1('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5aa1('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 49fb692..566247b 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 _0xfc63=['bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','Content-Range','apply','reject','update','destroy','end','sendStatus','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions','fast-json-patch','request-promise','moment'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xfc63,0x139));var _0x3fc6=function(_0x2c5bd5,_0x606b6e){_0x2c5bd5=_0x2c5bd5-0x0;var _0x50a9ff=_0xfc63[_0x2c5bd5];return _0x50a9ff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3fc6('0x0'));var rp=require(_0x3fc6('0x1'));var moment=require(_0x3fc6('0x2'));var BPromise=require(_0x3fc6('0x3'));var Mustache=require('mustache');var util=require(_0x3fc6('0x4'));var path=require('path');var sox=require(_0x3fc6('0x5'));var csv=require(_0x3fc6('0x6'));var ejs=require(_0x3fc6('0x7'));var fs=require('fs');var fs_extra=require(_0x3fc6('0x8'));var _=require(_0x3fc6('0x9'));var squel=require(_0x3fc6('0xa'));var crypto=require('crypto');var jsforce=require(_0x3fc6('0xb'));var deskjs=require(_0x3fc6('0xc'));var toCsv=require(_0x3fc6('0x6'));var querystring=require(_0x3fc6('0xd'));var Papa=require(_0x3fc6('0xe'));var Redis=require('ioredis');var authService=require(_0x3fc6('0xf'));var qs=require(_0x3fc6('0x10'));var as=require(_0x3fc6('0x11'));var hardwareService=require(_0x3fc6('0x12'));var logger=require('../../config/logger')(_0x3fc6('0x13'));var utils=require(_0x3fc6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3fc6('0x15'))['db'];function respondWithStatusCode(_0x3cdc63,_0x89efbe){_0x89efbe=_0x89efbe||0xcc;return function(_0x1e097e){if(_0x1e097e){return _0x3cdc63['sendStatus'](_0x89efbe);}return _0x3cdc63[_0x3fc6('0x16')](_0x89efbe)['end']();};}function respondWithResult(_0x57a141,_0x1f815f){_0x1f815f=_0x1f815f||0xc8;return function(_0x452bb1){if(_0x452bb1){return _0x57a141[_0x3fc6('0x16')](_0x1f815f)[_0x3fc6('0x17')](_0x452bb1);}};}function respondWithFilteredResult(_0x34d91d,_0xeacd2d){return function(_0x24f723){if(_0x24f723){var _0x11bd06=typeof _0xeacd2d[_0x3fc6('0x18')]===_0x3fc6('0x19')&&typeof _0xeacd2d['limit']===_0x3fc6('0x19');var _0x52fb7b=_0x24f723[_0x3fc6('0x1a')];var _0x236e6d=_0x11bd06?0x0:_0xeacd2d[_0x3fc6('0x18')];var _0x3ca34e=_0x11bd06?_0x24f723[_0x3fc6('0x1a')]:_0xeacd2d[_0x3fc6('0x18')]+_0xeacd2d['limit'];var _0x518970;if(_0x3ca34e>=_0x52fb7b){_0x3ca34e=_0x52fb7b;_0x518970=0xc8;}else{_0x518970=0xce;}_0x34d91d['status'](_0x518970);return _0x34d91d['set'](_0x3fc6('0x1b'),_0x236e6d+'-'+_0x3ca34e+'/'+_0x52fb7b)[_0x3fc6('0x17')](_0x24f723);}return null;};}function patchUpdates(_0x79e9f){return function(_0x5257b5){try{jsonpatch[_0x3fc6('0x1c')](_0x5257b5,_0x79e9f,!![]);}catch(_0x5246a3){return BPromise[_0x3fc6('0x1d')](_0x5246a3);}return _0x5257b5['save']();};}function saveUpdates(_0x78b526,_0x1b3d04){return function(_0x9a678a){if(_0x9a678a){return _0x9a678a[_0x3fc6('0x1e')](_0x78b526)['then'](function(_0x4a765d){return _0x4a765d;});}return null;};}function removeEntity(_0x3308f0,_0x44d4bd){return function(_0x35f21b){if(_0x35f21b){return _0x35f21b[_0x3fc6('0x1f')]()['then'](function(){_0x3308f0[_0x3fc6('0x16')](0xcc)[_0x3fc6('0x20')]();});}};}function handleEntityNotFound(_0x3de3cd,_0x1154b2){return function(_0x5d2b2e){if(!_0x5d2b2e){_0x3de3cd[_0x3fc6('0x21')](0x194);}return _0x5d2b2e;};}function handleError(_0x28647b,_0x1a555d){_0x1a555d=_0x1a555d||0x1f4;return function(_0x2aaae9){logger[_0x3fc6('0x22')](_0x2aaae9['stack']);if(_0x2aaae9[_0x3fc6('0x23')]){delete _0x2aaae9[_0x3fc6('0x23')];}_0x28647b['status'](_0x1a555d)[_0x3fc6('0x24')](_0x2aaae9);};}exports[_0x3fc6('0x25')]=function(_0x46043a,_0x28b7c4){var _0x26b8c8={},_0x286626={},_0x3dfec6={'count':0x0,'rows':[]};var _0x4fe648=_[_0x3fc6('0x26')](db[_0x3fc6('0x27')][_0x3fc6('0x28')],function(_0x42df06){return{'name':_0x42df06[_0x3fc6('0x29')],'type':_0x42df06[_0x3fc6('0x2a')][_0x3fc6('0x2b')]};});_0x286626[_0x3fc6('0x2c')]=_[_0x3fc6('0x26')](_0x4fe648,'name');_0x286626['query']=_[_0x3fc6('0x2d')](_0x46043a[_0x3fc6('0x2e')]);_0x286626[_0x3fc6('0x2f')]=_[_0x3fc6('0x30')](_0x286626[_0x3fc6('0x2c')],_0x286626[_0x3fc6('0x2e')]);_0x26b8c8['attributes']=_[_0x3fc6('0x30')](_0x286626[_0x3fc6('0x2c')],qs[_0x3fc6('0x31')](_0x46043a[_0x3fc6('0x2e')][_0x3fc6('0x31')]));_0x26b8c8[_0x3fc6('0x32')]=_0x26b8c8[_0x3fc6('0x32')][_0x3fc6('0x33')]?_0x26b8c8[_0x3fc6('0x32')]:_0x286626[_0x3fc6('0x2c')];if(!_0x46043a[_0x3fc6('0x2e')][_0x3fc6('0x34')]('nolimit')){_0x26b8c8['limit']=qs[_0x3fc6('0x35')](_0x46043a[_0x3fc6('0x2e')]['limit']);_0x26b8c8[_0x3fc6('0x18')]=qs[_0x3fc6('0x18')](_0x46043a[_0x3fc6('0x2e')][_0x3fc6('0x18')]);}_0x26b8c8[_0x3fc6('0x36')]=qs[_0x3fc6('0x37')](_0x46043a[_0x3fc6('0x2e')][_0x3fc6('0x37')]);_0x26b8c8[_0x3fc6('0x38')]=qs[_0x3fc6('0x2f')](_[_0x3fc6('0x39')](_0x46043a['query'],_0x286626[_0x3fc6('0x2f')]),_0x4fe648);if(_0x46043a[_0x3fc6('0x2e')]['filter']){_0x26b8c8[_0x3fc6('0x38')]=_[_0x3fc6('0x3a')](_0x26b8c8[_0x3fc6('0x38')],{'$or':_[_0x3fc6('0x26')](_0x4fe648,function(_0x5d42d0){if(_0x5d42d0[_0x3fc6('0x2a')]!==_0x3fc6('0x3b')){var _0x207024={};_0x207024[_0x5d42d0[_0x3fc6('0x23')]]={'$like':'%'+_0x46043a[_0x3fc6('0x2e')][_0x3fc6('0x3c')]+'%'};return _0x207024;}})});}_0x26b8c8=_[_0x3fc6('0x3a')]({},_0x26b8c8,_0x46043a[_0x3fc6('0x3d')]);var _0x5ba9c0={'where':_0x26b8c8[_0x3fc6('0x38')]};return db[_0x3fc6('0x27')][_0x3fc6('0x1a')](_0x5ba9c0)[_0x3fc6('0x3e')](function(_0x256a3a){_0x3dfec6[_0x3fc6('0x1a')]=_0x256a3a;if(_0x46043a[_0x3fc6('0x2e')][_0x3fc6('0x3f')]){_0x26b8c8[_0x3fc6('0x40')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x3fc6('0x41')](_0x26b8c8);})[_0x3fc6('0x3e')](function(_0x157c19){_0x3dfec6[_0x3fc6('0x42')]=_0x157c19;return _0x3dfec6;})[_0x3fc6('0x3e')](respondWithFilteredResult(_0x28b7c4,_0x26b8c8))['catch'](handleError(_0x28b7c4,null));};exports[_0x3fc6('0x43')]=function(_0x281cd5,_0x3026d6){var _0x1a1f41={'raw':![],'where':{'id':_0x281cd5[_0x3fc6('0x44')]['id']}},_0x36c8b8={};_0x36c8b8[_0x3fc6('0x2c')]=_['keys'](db['Dynamics365Configuration'][_0x3fc6('0x28')]);_0x36c8b8[_0x3fc6('0x2e')]=_[_0x3fc6('0x2d')](_0x281cd5[_0x3fc6('0x2e')]);_0x36c8b8[_0x3fc6('0x2f')]=_[_0x3fc6('0x30')](_0x36c8b8[_0x3fc6('0x2c')],_0x36c8b8[_0x3fc6('0x2e')]);_0x1a1f41[_0x3fc6('0x32')]=_[_0x3fc6('0x30')](_0x36c8b8[_0x3fc6('0x2c')],qs['fields'](_0x281cd5[_0x3fc6('0x2e')][_0x3fc6('0x31')]));_0x1a1f41[_0x3fc6('0x32')]=_0x1a1f41[_0x3fc6('0x32')]['length']?_0x1a1f41[_0x3fc6('0x32')]:_0x36c8b8[_0x3fc6('0x2c')];if(_0x281cd5[_0x3fc6('0x2e')][_0x3fc6('0x3f')]){_0x1a1f41[_0x3fc6('0x40')]=[{'all':!![]}];}_0x1a1f41=_[_0x3fc6('0x3a')]({},_0x1a1f41,_0x281cd5[_0x3fc6('0x3d')]);return db[_0x3fc6('0x27')][_0x3fc6('0x45')](_0x1a1f41)[_0x3fc6('0x3e')](handleEntityNotFound(_0x3026d6,null))[_0x3fc6('0x3e')](respondWithResult(_0x3026d6,null))[_0x3fc6('0x46')](handleError(_0x3026d6,null));};exports[_0x3fc6('0x47')]=function(_0x3054b2,_0x4c2b86){return db[_0x3fc6('0x27')]['create'](_0x3054b2[_0x3fc6('0x48')],{})[_0x3fc6('0x3e')](respondWithResult(_0x4c2b86,0xc9))[_0x3fc6('0x46')](handleError(_0x4c2b86,null));};exports[_0x3fc6('0x1e')]=function(_0x30ce0c,_0x41d262){if(_0x30ce0c[_0x3fc6('0x48')]['id']){delete _0x30ce0c[_0x3fc6('0x48')]['id'];}return db[_0x3fc6('0x27')][_0x3fc6('0x45')]({'where':{'id':_0x30ce0c[_0x3fc6('0x44')]['id']}})[_0x3fc6('0x3e')](handleEntityNotFound(_0x41d262,null))[_0x3fc6('0x3e')](saveUpdates(_0x30ce0c[_0x3fc6('0x48')],null))[_0x3fc6('0x3e')](respondWithResult(_0x41d262,null))['catch'](handleError(_0x41d262,null));};exports[_0x3fc6('0x1f')]=function(_0x1722f5,_0x50133a){return db[_0x3fc6('0x27')][_0x3fc6('0x45')]({'where':{'id':_0x1722f5[_0x3fc6('0x44')]['id']}})[_0x3fc6('0x3e')](handleEntityNotFound(_0x50133a,null))['then'](removeEntity(_0x50133a,null))['catch'](handleError(_0x50133a,null));};exports[_0x3fc6('0x49')]=function(_0x15612d,_0x4fddbf,_0x3eb8cf){var _0x5a0c43={};var _0x1e1f62={};var _0x39a235;var _0x543f17;return db[_0x3fc6('0x27')][_0x3fc6('0x4a')]({'where':{'id':_0x15612d['params']['id']}})[_0x3fc6('0x3e')](handleEntityNotFound(_0x4fddbf,null))['then'](function(_0x217ec5){if(_0x217ec5){_0x39a235=_0x217ec5;_0x1e1f62[_0x3fc6('0x2c')]=_[_0x3fc6('0x2d')](db[_0x3fc6('0x4b')][_0x3fc6('0x28')]);_0x1e1f62['query']=_[_0x3fc6('0x2d')](_0x15612d[_0x3fc6('0x2e')]);_0x1e1f62[_0x3fc6('0x2f')]=_[_0x3fc6('0x30')](_0x1e1f62[_0x3fc6('0x2c')],_0x1e1f62['query']);_0x5a0c43[_0x3fc6('0x32')]=_[_0x3fc6('0x30')](_0x1e1f62[_0x3fc6('0x2c')],qs[_0x3fc6('0x31')](_0x15612d['query'][_0x3fc6('0x31')]));_0x5a0c43['attributes']=_0x5a0c43[_0x3fc6('0x32')]['length']?_0x5a0c43[_0x3fc6('0x32')]:_0x1e1f62[_0x3fc6('0x2c')];_0x5a0c43['order']=qs[_0x3fc6('0x37')](_0x15612d[_0x3fc6('0x2e')][_0x3fc6('0x37')]);_0x5a0c43['where']=qs[_0x3fc6('0x2f')](_[_0x3fc6('0x39')](_0x15612d[_0x3fc6('0x2e')],_0x1e1f62[_0x3fc6('0x2f')]));if(_0x15612d['query']['filter']){_0x5a0c43[_0x3fc6('0x38')]=_['merge'](_0x5a0c43[_0x3fc6('0x38')],{'$or':_[_0x3fc6('0x26')](_0x5a0c43[_0x3fc6('0x32')],function(_0x4af7f3){var _0x574845={};_0x574845[_0x4af7f3]={'$like':'%'+_0x15612d[_0x3fc6('0x2e')]['filter']+'%'};return _0x574845;})});}_0x5a0c43=_['merge']({},_0x5a0c43,_0x15612d[_0x3fc6('0x3d')]);return _0x39a235[_0x3fc6('0x49')](_0x5a0c43);}})[_0x3fc6('0x3e')](function(_0x12e15e){if(_0x12e15e){_0x543f17=_0x12e15e['length'];if(!_0x15612d['query'][_0x3fc6('0x34')](_0x3fc6('0x4c'))){_0x5a0c43[_0x3fc6('0x35')]=qs['limit'](_0x15612d[_0x3fc6('0x2e')][_0x3fc6('0x35')]);_0x5a0c43[_0x3fc6('0x18')]=qs[_0x3fc6('0x18')](_0x15612d[_0x3fc6('0x2e')][_0x3fc6('0x18')]);}return _0x39a235[_0x3fc6('0x49')](_0x5a0c43);}})[_0x3fc6('0x3e')](function(_0x3fd036){if(_0x3fd036){return _0x3fd036?{'count':_0x543f17,'rows':_0x3fd036}:null;}})['then'](respondWithResult(_0x4fddbf,null))[_0x3fc6('0x46')](handleError(_0x4fddbf,null));};exports[_0x3fc6('0x4d')]=function(_0x408394,_0xca9b48,_0x3c6fdd){var _0x1c14ab={};var _0x3d12f2={};var _0x134328;var _0x329ae7;return db['Dynamics365Configuration'][_0x3fc6('0x4a')]({'where':{'id':_0x408394[_0x3fc6('0x44')]['id']}})['then'](handleEntityNotFound(_0xca9b48,null))[_0x3fc6('0x3e')](function(_0xbf485c){if(_0xbf485c){_0x134328=_0xbf485c;_0x3d12f2[_0x3fc6('0x2c')]=_[_0x3fc6('0x2d')](db[_0x3fc6('0x4b')]['rawAttributes']);_0x3d12f2[_0x3fc6('0x2e')]=_[_0x3fc6('0x2d')](_0x408394['query']);_0x3d12f2[_0x3fc6('0x2f')]=_['intersection'](_0x3d12f2[_0x3fc6('0x2c')],_0x3d12f2['query']);_0x1c14ab[_0x3fc6('0x32')]=_[_0x3fc6('0x30')](_0x3d12f2[_0x3fc6('0x2c')],qs[_0x3fc6('0x31')](_0x408394['query'][_0x3fc6('0x31')]));_0x1c14ab[_0x3fc6('0x32')]=_0x1c14ab[_0x3fc6('0x32')][_0x3fc6('0x33')]?_0x1c14ab['attributes']:_0x3d12f2[_0x3fc6('0x2c')];_0x1c14ab[_0x3fc6('0x36')]=qs[_0x3fc6('0x37')](_0x408394[_0x3fc6('0x2e')][_0x3fc6('0x37')]);_0x1c14ab['where']=qs['filters'](_[_0x3fc6('0x39')](_0x408394[_0x3fc6('0x2e')],_0x3d12f2[_0x3fc6('0x2f')]));if(_0x408394[_0x3fc6('0x2e')][_0x3fc6('0x3c')]){_0x1c14ab[_0x3fc6('0x38')]=_[_0x3fc6('0x3a')](_0x1c14ab[_0x3fc6('0x38')],{'$or':_[_0x3fc6('0x26')](_0x1c14ab[_0x3fc6('0x32')],function(_0x39ae9f){var _0x567a5c={};_0x567a5c[_0x39ae9f]={'$like':'%'+_0x408394['query'][_0x3fc6('0x3c')]+'%'};return _0x567a5c;})});}_0x1c14ab=_[_0x3fc6('0x3a')]({},_0x1c14ab,_0x408394[_0x3fc6('0x3d')]);return _0x134328['getSubjects'](_0x1c14ab);}})[_0x3fc6('0x3e')](function(_0x62eac4){if(_0x62eac4){_0x329ae7=_0x62eac4[_0x3fc6('0x33')];if(!_0x408394[_0x3fc6('0x2e')][_0x3fc6('0x34')](_0x3fc6('0x4c'))){_0x1c14ab['limit']=qs['limit'](_0x408394[_0x3fc6('0x2e')]['limit']);_0x1c14ab[_0x3fc6('0x18')]=qs['offset'](_0x408394[_0x3fc6('0x2e')][_0x3fc6('0x18')]);}return _0x134328[_0x3fc6('0x4d')](_0x1c14ab);}})[_0x3fc6('0x3e')](function(_0x468bb8){if(_0x468bb8){return _0x468bb8?{'count':_0x329ae7,'rows':_0x468bb8}:null;}})[_0x3fc6('0x3e')](respondWithResult(_0xca9b48,null))[_0x3fc6('0x46')](handleError(_0xca9b48,null));};exports[_0x3fc6('0x4e')]=function(_0xce057f,_0xfc5b21,_0x1ef2df){var _0x2ac852={};var _0x2b8510={};var _0xcc607b;var _0x47143f;return db[_0x3fc6('0x27')]['findOne']({'where':{'id':_0xce057f[_0x3fc6('0x44')]['id']}})[_0x3fc6('0x3e')](handleEntityNotFound(_0xfc5b21,null))['then'](function(_0x285cc9){if(_0x285cc9){_0xcc607b=_0x285cc9;_0x2b8510['model']=_[_0x3fc6('0x2d')](db['Dynamics365Field']['rawAttributes']);_0x2b8510[_0x3fc6('0x2e')]=_[_0x3fc6('0x2d')](_0xce057f[_0x3fc6('0x2e')]);_0x2b8510['filters']=_['intersection'](_0x2b8510[_0x3fc6('0x2c')],_0x2b8510['query']);_0x2ac852['attributes']=_[_0x3fc6('0x30')](_0x2b8510[_0x3fc6('0x2c')],qs[_0x3fc6('0x31')](_0xce057f['query'][_0x3fc6('0x31')]));_0x2ac852[_0x3fc6('0x32')]=_0x2ac852['attributes']['length']?_0x2ac852[_0x3fc6('0x32')]:_0x2b8510[_0x3fc6('0x2c')];_0x2ac852['order']=qs[_0x3fc6('0x37')](_0xce057f[_0x3fc6('0x2e')][_0x3fc6('0x37')]);_0x2ac852[_0x3fc6('0x38')]=qs[_0x3fc6('0x2f')](_[_0x3fc6('0x39')](_0xce057f[_0x3fc6('0x2e')],_0x2b8510[_0x3fc6('0x2f')]));if(_0xce057f['query'][_0x3fc6('0x3c')]){_0x2ac852[_0x3fc6('0x38')]=_['merge'](_0x2ac852[_0x3fc6('0x38')],{'$or':_[_0x3fc6('0x26')](_0x2ac852[_0x3fc6('0x32')],function(_0x3d2be0){var _0x55514b={};_0x55514b[_0x3d2be0]={'$like':'%'+_0xce057f[_0x3fc6('0x2e')][_0x3fc6('0x3c')]+'%'};return _0x55514b;})});}_0x2ac852=_[_0x3fc6('0x3a')]({},_0x2ac852,_0xce057f[_0x3fc6('0x3d')]);return _0xcc607b[_0x3fc6('0x4e')](_0x2ac852);}})[_0x3fc6('0x3e')](function(_0x6ae8a8){if(_0x6ae8a8){_0x47143f=_0x6ae8a8[_0x3fc6('0x33')];if(!_0xce057f['query'][_0x3fc6('0x34')](_0x3fc6('0x4c'))){_0x2ac852['limit']=qs['limit'](_0xce057f['query']['limit']);_0x2ac852['offset']=qs[_0x3fc6('0x18')](_0xce057f[_0x3fc6('0x2e')][_0x3fc6('0x18')]);}return _0xcc607b[_0x3fc6('0x4e')](_0x2ac852);}})['then'](function(_0x16a9e6){if(_0x16a9e6){return _0x16a9e6?{'count':_0x47143f,'rows':_0x16a9e6}:null;}})[_0x3fc6('0x3e')](respondWithResult(_0xfc5b21,null))[_0x3fc6('0x46')](handleError(_0xfc5b21,null));}; \ No newline at end of file +var _0x39f5=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys'];(function(_0xf08fdc,_0x2ba2a4){var _0x26e070=function(_0x37f236){while(--_0x37f236){_0xf08fdc['push'](_0xf08fdc['shift']());}};_0x26e070(++_0x2ba2a4);}(_0x39f5,0x73));var _0x539f=function(_0x5d7cde,_0x5b1168){_0x5d7cde=_0x5d7cde-0x0;var _0x366675=_0x39f5[_0x5d7cde];return _0x366675;};'use strict';var emlformat=require(_0x539f('0x0'));var rimraf=require(_0x539f('0x1'));var zipdir=require(_0x539f('0x2'));var jsonpatch=require(_0x539f('0x3'));var rp=require(_0x539f('0x4'));var moment=require(_0x539f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x539f('0x6'));var util=require(_0x539f('0x7'));var path=require(_0x539f('0x8'));var sox=require(_0x539f('0x9'));var csv=require(_0x539f('0xa'));var ejs=require(_0x539f('0xb'));var fs=require('fs');var fs_extra=require(_0x539f('0xc'));var _=require(_0x539f('0xd'));var squel=require(_0x539f('0xe'));var crypto=require(_0x539f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x539f('0x10'));var toCsv=require(_0x539f('0xa'));var querystring=require(_0x539f('0x11'));var Papa=require(_0x539f('0x12'));var Redis=require(_0x539f('0x13'));var authService=require(_0x539f('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x539f('0x15'));var logger=require(_0x539f('0x16'))('api');var utils=require(_0x539f('0x17'));var config=require(_0x539f('0x18'));var licenseUtil=require(_0x539f('0x19'));var db=require(_0x539f('0x1a'))['db'];function respondWithStatusCode(_0x4ec48d,_0x39eca2){_0x39eca2=_0x39eca2||0xcc;return function(_0x20d2e3){if(_0x20d2e3){return _0x4ec48d[_0x539f('0x1b')](_0x39eca2);}return _0x4ec48d[_0x539f('0x1c')](_0x39eca2)[_0x539f('0x1d')]();};}function respondWithResult(_0x3db41f,_0x5e6e50){_0x5e6e50=_0x5e6e50||0xc8;return function(_0x1d65c1){if(_0x1d65c1){return _0x3db41f[_0x539f('0x1c')](_0x5e6e50)[_0x539f('0x1e')](_0x1d65c1);}};}function respondWithFilteredResult(_0x388471,_0xed926a){return function(_0x2dc41c){if(_0x2dc41c){var _0x1631e4=typeof _0xed926a[_0x539f('0x1f')]==='undefined'&&typeof _0xed926a[_0x539f('0x20')]===_0x539f('0x21');var _0x225762=_0x2dc41c[_0x539f('0x22')];var _0x2d8f91=_0x1631e4?0x0:_0xed926a[_0x539f('0x1f')];var _0x45f1fb=_0x1631e4?_0x2dc41c[_0x539f('0x22')]:_0xed926a[_0x539f('0x1f')]+_0xed926a[_0x539f('0x20')];var _0x43bc6f;if(_0x45f1fb>=_0x225762){_0x45f1fb=_0x225762;_0x43bc6f=0xc8;}else{_0x43bc6f=0xce;}_0x388471[_0x539f('0x1c')](_0x43bc6f);return _0x388471[_0x539f('0x23')](_0x539f('0x24'),_0x2d8f91+'-'+_0x45f1fb+'/'+_0x225762)[_0x539f('0x1e')](_0x2dc41c);}return null;};}function patchUpdates(_0x56cce8){return function(_0x9d9a7){try{jsonpatch[_0x539f('0x25')](_0x9d9a7,_0x56cce8,!![]);}catch(_0x2bcfcc){return BPromise['reject'](_0x2bcfcc);}return _0x9d9a7[_0x539f('0x26')]();};}function saveUpdates(_0x1804f9,_0x1cb009){return function(_0x15947c){if(_0x15947c){return _0x15947c[_0x539f('0x27')](_0x1804f9)[_0x539f('0x28')](function(_0x3f26eb){return _0x3f26eb;});}return null;};}function removeEntity(_0x3670c1,_0xe4e31d){return function(_0x444bf0){if(_0x444bf0){return _0x444bf0[_0x539f('0x29')]()[_0x539f('0x28')](function(){_0x3670c1[_0x539f('0x1c')](0xcc)[_0x539f('0x1d')]();});}};}function handleEntityNotFound(_0x22dfb5,_0x1a5225){return function(_0x4ad2aa){if(!_0x4ad2aa){_0x22dfb5['sendStatus'](0x194);}return _0x4ad2aa;};}function handleError(_0x50c697,_0x270ef2){_0x270ef2=_0x270ef2||0x1f4;return function(_0x3437c0){logger[_0x539f('0x2a')](_0x3437c0[_0x539f('0x2b')]);if(_0x3437c0[_0x539f('0x2c')]){delete _0x3437c0[_0x539f('0x2c')];}_0x50c697[_0x539f('0x1c')](_0x270ef2)[_0x539f('0x2d')](_0x3437c0);};}exports[_0x539f('0x2e')]=function(_0x1e2543,_0x4f6659){var _0x705162={},_0x24d432={},_0x287af8={'count':0x0,'rows':[]};var _0x97e023=_[_0x539f('0x2f')](db[_0x539f('0x30')][_0x539f('0x31')],function(_0x336599){return{'name':_0x336599[_0x539f('0x32')],'type':_0x336599[_0x539f('0x33')]['key']};});_0x24d432[_0x539f('0x34')]=_[_0x539f('0x2f')](_0x97e023,_0x539f('0x2c'));_0x24d432[_0x539f('0x35')]=_[_0x539f('0x36')](_0x1e2543[_0x539f('0x35')]);_0x24d432['filters']=_[_0x539f('0x37')](_0x24d432['model'],_0x24d432[_0x539f('0x35')]);_0x705162[_0x539f('0x38')]=_[_0x539f('0x37')](_0x24d432[_0x539f('0x34')],qs[_0x539f('0x39')](_0x1e2543[_0x539f('0x35')][_0x539f('0x39')]));_0x705162[_0x539f('0x38')]=_0x705162[_0x539f('0x38')][_0x539f('0x3a')]?_0x705162[_0x539f('0x38')]:_0x24d432['model'];if(!_0x1e2543['query'][_0x539f('0x3b')](_0x539f('0x3c'))){_0x705162[_0x539f('0x20')]=qs[_0x539f('0x20')](_0x1e2543[_0x539f('0x35')][_0x539f('0x20')]);_0x705162[_0x539f('0x1f')]=qs[_0x539f('0x1f')](_0x1e2543['query'][_0x539f('0x1f')]);}_0x705162[_0x539f('0x3d')]=qs['sort'](_0x1e2543['query'][_0x539f('0x3e')]);_0x705162[_0x539f('0x3f')]=qs[_0x539f('0x40')](_[_0x539f('0x41')](_0x1e2543[_0x539f('0x35')],_0x24d432['filters']),_0x97e023);if(_0x1e2543[_0x539f('0x35')][_0x539f('0x42')]){_0x705162[_0x539f('0x3f')]=_[_0x539f('0x43')](_0x705162[_0x539f('0x3f')],{'$or':_[_0x539f('0x2f')](_0x97e023,function(_0x1e80b1){if(_0x1e80b1['type']!==_0x539f('0x44')){var _0x336b71={};_0x336b71[_0x1e80b1['name']]={'$like':'%'+_0x1e2543[_0x539f('0x35')][_0x539f('0x42')]+'%'};return _0x336b71;}})});}_0x705162=_['merge']({},_0x705162,_0x1e2543[_0x539f('0x45')]);var _0x3951ad={'where':_0x705162[_0x539f('0x3f')]};return db[_0x539f('0x30')][_0x539f('0x22')](_0x3951ad)['then'](function(_0x3ef993){_0x287af8[_0x539f('0x22')]=_0x3ef993;if(_0x1e2543['query'][_0x539f('0x46')]){_0x705162['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x539f('0x47')](_0x705162);})[_0x539f('0x28')](function(_0x573fd0){_0x287af8[_0x539f('0x48')]=_0x573fd0;return _0x287af8;})[_0x539f('0x28')](respondWithFilteredResult(_0x4f6659,_0x705162))[_0x539f('0x49')](handleError(_0x4f6659,null));};exports[_0x539f('0x4a')]=function(_0x237cfe,_0x16f39e){var _0x38a9b5={'raw':![],'where':{'id':_0x237cfe[_0x539f('0x4b')]['id']}},_0x4c45c1={};_0x4c45c1[_0x539f('0x34')]=_[_0x539f('0x36')](db[_0x539f('0x30')][_0x539f('0x31')]);_0x4c45c1[_0x539f('0x35')]=_['keys'](_0x237cfe[_0x539f('0x35')]);_0x4c45c1[_0x539f('0x40')]=_[_0x539f('0x37')](_0x4c45c1[_0x539f('0x34')],_0x4c45c1['query']);_0x38a9b5[_0x539f('0x38')]=_[_0x539f('0x37')](_0x4c45c1[_0x539f('0x34')],qs[_0x539f('0x39')](_0x237cfe['query'][_0x539f('0x39')]));_0x38a9b5[_0x539f('0x38')]=_0x38a9b5[_0x539f('0x38')][_0x539f('0x3a')]?_0x38a9b5[_0x539f('0x38')]:_0x4c45c1[_0x539f('0x34')];if(_0x237cfe[_0x539f('0x35')][_0x539f('0x46')]){_0x38a9b5[_0x539f('0x4c')]=[{'all':!![]}];}_0x38a9b5=_[_0x539f('0x43')]({},_0x38a9b5,_0x237cfe[_0x539f('0x45')]);return db[_0x539f('0x30')][_0x539f('0x4d')](_0x38a9b5)['then'](handleEntityNotFound(_0x16f39e,null))[_0x539f('0x28')](respondWithResult(_0x16f39e,null))[_0x539f('0x49')](handleError(_0x16f39e,null));};exports[_0x539f('0x4e')]=function(_0x505317,_0x5c2f88){return db[_0x539f('0x30')][_0x539f('0x4e')](_0x505317[_0x539f('0x4f')],{})[_0x539f('0x28')](respondWithResult(_0x5c2f88,0xc9))[_0x539f('0x49')](handleError(_0x5c2f88,null));};exports['update']=function(_0x4dc2fb,_0x5bfba8){if(_0x4dc2fb[_0x539f('0x4f')]['id']){delete _0x4dc2fb[_0x539f('0x4f')]['id'];}return db[_0x539f('0x30')][_0x539f('0x4d')]({'where':{'id':_0x4dc2fb[_0x539f('0x4b')]['id']}})[_0x539f('0x28')](handleEntityNotFound(_0x5bfba8,null))[_0x539f('0x28')](saveUpdates(_0x4dc2fb[_0x539f('0x4f')],null))[_0x539f('0x28')](respondWithResult(_0x5bfba8,null))['catch'](handleError(_0x5bfba8,null));};exports[_0x539f('0x29')]=function(_0x5c4d7f,_0x297ff1){return db[_0x539f('0x30')][_0x539f('0x4d')]({'where':{'id':_0x5c4d7f[_0x539f('0x4b')]['id']}})[_0x539f('0x28')](handleEntityNotFound(_0x297ff1,null))[_0x539f('0x28')](removeEntity(_0x297ff1,null))['catch'](handleError(_0x297ff1,null));};exports[_0x539f('0x50')]=function(_0x36c9cd,_0x544811,_0x26d2e6){var _0x3a2f69={};var _0x317fa9={};var _0x4814f3;var _0x258e99;return db[_0x539f('0x30')][_0x539f('0x51')]({'where':{'id':_0x36c9cd[_0x539f('0x4b')]['id']}})[_0x539f('0x28')](handleEntityNotFound(_0x544811,null))['then'](function(_0x2664ba){if(_0x2664ba){_0x4814f3=_0x2664ba;_0x317fa9['model']=_[_0x539f('0x36')](db[_0x539f('0x52')][_0x539f('0x31')]);_0x317fa9[_0x539f('0x35')]=_['keys'](_0x36c9cd[_0x539f('0x35')]);_0x317fa9['filters']=_['intersection'](_0x317fa9[_0x539f('0x34')],_0x317fa9[_0x539f('0x35')]);_0x3a2f69[_0x539f('0x38')]=_[_0x539f('0x37')](_0x317fa9[_0x539f('0x34')],qs[_0x539f('0x39')](_0x36c9cd['query'][_0x539f('0x39')]));_0x3a2f69['attributes']=_0x3a2f69[_0x539f('0x38')][_0x539f('0x3a')]?_0x3a2f69['attributes']:_0x317fa9[_0x539f('0x34')];_0x3a2f69[_0x539f('0x3d')]=qs[_0x539f('0x3e')](_0x36c9cd['query'][_0x539f('0x3e')]);_0x3a2f69[_0x539f('0x3f')]=qs[_0x539f('0x40')](_[_0x539f('0x41')](_0x36c9cd[_0x539f('0x35')],_0x317fa9[_0x539f('0x40')]));if(_0x36c9cd['query']['filter']){_0x3a2f69[_0x539f('0x3f')]=_[_0x539f('0x43')](_0x3a2f69[_0x539f('0x3f')],{'$or':_[_0x539f('0x2f')](_0x3a2f69[_0x539f('0x38')],function(_0x39a82a){var _0x5a4b1f={};_0x5a4b1f[_0x39a82a]={'$like':'%'+_0x36c9cd['query'][_0x539f('0x42')]+'%'};return _0x5a4b1f;})});}_0x3a2f69=_[_0x539f('0x43')]({},_0x3a2f69,_0x36c9cd[_0x539f('0x45')]);return _0x4814f3['getFields'](_0x3a2f69);}})[_0x539f('0x28')](function(_0x3f2bdb){if(_0x3f2bdb){_0x258e99=_0x3f2bdb[_0x539f('0x3a')];if(!_0x36c9cd[_0x539f('0x35')][_0x539f('0x3b')](_0x539f('0x3c'))){_0x3a2f69[_0x539f('0x20')]=qs[_0x539f('0x20')](_0x36c9cd[_0x539f('0x35')]['limit']);_0x3a2f69[_0x539f('0x1f')]=qs[_0x539f('0x1f')](_0x36c9cd[_0x539f('0x35')][_0x539f('0x1f')]);}return _0x4814f3[_0x539f('0x50')](_0x3a2f69);}})[_0x539f('0x28')](function(_0x5c9803){if(_0x5c9803){return _0x5c9803?{'count':_0x258e99,'rows':_0x5c9803}:null;}})[_0x539f('0x28')](respondWithResult(_0x544811,null))[_0x539f('0x49')](handleError(_0x544811,null));};exports[_0x539f('0x53')]=function(_0x321bc7,_0x28bb05,_0x113032){var _0x5d97b1={};var _0x550316={};var _0x24b6b4;var _0x418f89;return db[_0x539f('0x30')][_0x539f('0x51')]({'where':{'id':_0x321bc7[_0x539f('0x4b')]['id']}})[_0x539f('0x28')](handleEntityNotFound(_0x28bb05,null))['then'](function(_0x463e7d){if(_0x463e7d){_0x24b6b4=_0x463e7d;_0x550316[_0x539f('0x34')]=_['keys'](db[_0x539f('0x52')]['rawAttributes']);_0x550316[_0x539f('0x35')]=_[_0x539f('0x36')](_0x321bc7[_0x539f('0x35')]);_0x550316[_0x539f('0x40')]=_[_0x539f('0x37')](_0x550316['model'],_0x550316[_0x539f('0x35')]);_0x5d97b1[_0x539f('0x38')]=_[_0x539f('0x37')](_0x550316[_0x539f('0x34')],qs['fields'](_0x321bc7[_0x539f('0x35')][_0x539f('0x39')]));_0x5d97b1[_0x539f('0x38')]=_0x5d97b1[_0x539f('0x38')][_0x539f('0x3a')]?_0x5d97b1['attributes']:_0x550316[_0x539f('0x34')];_0x5d97b1[_0x539f('0x3d')]=qs[_0x539f('0x3e')](_0x321bc7[_0x539f('0x35')]['sort']);_0x5d97b1[_0x539f('0x3f')]=qs[_0x539f('0x40')](_[_0x539f('0x41')](_0x321bc7['query'],_0x550316[_0x539f('0x40')]));if(_0x321bc7[_0x539f('0x35')][_0x539f('0x42')]){_0x5d97b1[_0x539f('0x3f')]=_['merge'](_0x5d97b1[_0x539f('0x3f')],{'$or':_[_0x539f('0x2f')](_0x5d97b1['attributes'],function(_0x1377bd){var _0x21360d={};_0x21360d[_0x1377bd]={'$like':'%'+_0x321bc7[_0x539f('0x35')]['filter']+'%'};return _0x21360d;})});}_0x5d97b1=_['merge']({},_0x5d97b1,_0x321bc7['options']);return _0x24b6b4['getSubjects'](_0x5d97b1);}})[_0x539f('0x28')](function(_0xa1c2b0){if(_0xa1c2b0){_0x418f89=_0xa1c2b0[_0x539f('0x3a')];if(!_0x321bc7['query'][_0x539f('0x3b')]('nolimit')){_0x5d97b1['limit']=qs['limit'](_0x321bc7['query']['limit']);_0x5d97b1[_0x539f('0x1f')]=qs['offset'](_0x321bc7[_0x539f('0x35')][_0x539f('0x1f')]);}return _0x24b6b4[_0x539f('0x53')](_0x5d97b1);}})[_0x539f('0x28')](function(_0x20d545){if(_0x20d545){return _0x20d545?{'count':_0x418f89,'rows':_0x20d545}:null;}})['then'](respondWithResult(_0x28bb05,null))[_0x539f('0x49')](handleError(_0x28bb05,null));};exports['getDescriptions']=function(_0x484d70,_0x574522,_0x134f76){var _0x32d5c9={};var _0x1828d2={};var _0x1cc45b;var _0x5a5db6;return db[_0x539f('0x30')]['findOne']({'where':{'id':_0x484d70[_0x539f('0x4b')]['id']}})[_0x539f('0x28')](handleEntityNotFound(_0x574522,null))[_0x539f('0x28')](function(_0x41d398){if(_0x41d398){_0x1cc45b=_0x41d398;_0x1828d2[_0x539f('0x34')]=_[_0x539f('0x36')](db[_0x539f('0x52')][_0x539f('0x31')]);_0x1828d2[_0x539f('0x35')]=_[_0x539f('0x36')](_0x484d70['query']);_0x1828d2[_0x539f('0x40')]=_['intersection'](_0x1828d2['model'],_0x1828d2['query']);_0x32d5c9[_0x539f('0x38')]=_[_0x539f('0x37')](_0x1828d2['model'],qs[_0x539f('0x39')](_0x484d70['query'][_0x539f('0x39')]));_0x32d5c9['attributes']=_0x32d5c9[_0x539f('0x38')][_0x539f('0x3a')]?_0x32d5c9[_0x539f('0x38')]:_0x1828d2['model'];_0x32d5c9[_0x539f('0x3d')]=qs[_0x539f('0x3e')](_0x484d70[_0x539f('0x35')][_0x539f('0x3e')]);_0x32d5c9['where']=qs[_0x539f('0x40')](_[_0x539f('0x41')](_0x484d70['query'],_0x1828d2['filters']));if(_0x484d70[_0x539f('0x35')]['filter']){_0x32d5c9['where']=_[_0x539f('0x43')](_0x32d5c9[_0x539f('0x3f')],{'$or':_[_0x539f('0x2f')](_0x32d5c9[_0x539f('0x38')],function(_0x451b37){var _0x4edc55={};_0x4edc55[_0x451b37]={'$like':'%'+_0x484d70[_0x539f('0x35')][_0x539f('0x42')]+'%'};return _0x4edc55;})});}_0x32d5c9=_[_0x539f('0x43')]({},_0x32d5c9,_0x484d70[_0x539f('0x45')]);return _0x1cc45b[_0x539f('0x54')](_0x32d5c9);}})[_0x539f('0x28')](function(_0x192098){if(_0x192098){_0x5a5db6=_0x192098[_0x539f('0x3a')];if(!_0x484d70[_0x539f('0x35')][_0x539f('0x3b')]('nolimit')){_0x32d5c9[_0x539f('0x20')]=qs[_0x539f('0x20')](_0x484d70[_0x539f('0x35')][_0x539f('0x20')]);_0x32d5c9[_0x539f('0x1f')]=qs[_0x539f('0x1f')](_0x484d70[_0x539f('0x35')][_0x539f('0x1f')]);}return _0x1cc45b[_0x539f('0x54')](_0x32d5c9);}})[_0x539f('0x28')](function(_0x44545f){if(_0x44545f){return _0x44545f?{'count':_0x5a5db6,'rows':_0x44545f}:null;}})[_0x539f('0x28')](respondWithResult(_0x574522,null))[_0x539f('0x49')](handleError(_0x574522,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index cb231a1..85a4b9a 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x1b337d,_0x433e67){var _0x1ffea3=function(_0x456b9d){while(--_0x456b9d){_0x1b337d['push'](_0x1b337d['shift']());}};_0x1ffea3(++_0x433e67);}(_0x9f62,0x154));var _0x29f6=function(_0x13aabf,_0x2e4848){_0x13aabf=_0x13aabf-0x0;var _0x1fe520=_0x9f62[_0x13aabf];return _0x1fe520;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x9a19,0x114));var _0x99a1=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x9a19[_0x35007a];return _0x574f68;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',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 56ffd91..bdf9a3c 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 _0x2ef7=['util','bluebird','randomstring','ioredis','rpc','../../config/environment','http','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result'];(function(_0x39b9b8,_0xf786f2){var _0x353919=function(_0x52c562){while(--_0x52c562){_0x39b9b8['push'](_0x39b9b8['shift']());}};_0x353919(++_0xf786f2);}(_0x2ef7,0x187));var _0x72ef=function(_0x31a42c,_0x16d034){_0x31a42c=_0x31a42c-0x0;var _0x2a4420=_0x2ef7[_0x31a42c];return _0x2a4420;};'use strict';var _=require('lodash');var util=require(_0x72ef('0x0'));var moment=require('moment');var BPromise=require(_0x72ef('0x1'));var rs=require(_0x72ef('0x2'));var fs=require('fs');var Redis=require(_0x72ef('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x72ef('0x4'));var config=require(_0x72ef('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x72ef('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34fcdd,_0x1fd45f,_0x187c67){return new BPromise(function(_0x2b3014,_0x3302db){return client['request'](_0x34fcdd,_0x187c67)[_0x72ef('0x7')](function(_0x3d4c90){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x1fd45f,_0x72ef('0x8'));logger[_0x72ef('0x9')](_0x72ef('0xa'),_0x1fd45f,_0x72ef('0x8'),JSON[_0x72ef('0xb')](_0x3d4c90));if(_0x3d4c90[_0x72ef('0xc')]){if(_0x3d4c90[_0x72ef('0xc')][_0x72ef('0xd')]===0x1f4){logger[_0x72ef('0xc')](_0x72ef('0xe'),_0x1fd45f,_0x3d4c90[_0x72ef('0xc')][_0x72ef('0xf')]);return _0x3302db(_0x3d4c90[_0x72ef('0xc')][_0x72ef('0xf')]);}logger[_0x72ef('0xc')](_0x72ef('0xe'),_0x1fd45f,_0x3d4c90[_0x72ef('0xc')][_0x72ef('0xf')]);return _0x2b3014(_0x3d4c90[_0x72ef('0xc')][_0x72ef('0xf')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x1fd45f,_0x72ef('0x8'));_0x2b3014(_0x3d4c90[_0x72ef('0x10')][_0x72ef('0xf')]);}})['catch'](function(_0x2a51b0){logger['error'](_0x72ef('0xe'),_0x1fd45f,_0x2a51b0);_0x3302db(_0x2a51b0);});});} \ No newline at end of file +var _0x46ea=['stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1f12a3,_0x4cea2e){var _0x2a2e1d=function(_0x1762cd){while(--_0x1762cd){_0x1f12a3['push'](_0x1f12a3['shift']());}};_0x2a2e1d(++_0x4cea2e);}(_0x46ea,0x1d4));var _0xa46e=function(_0x3e0a60,_0xf39dc3){_0x3e0a60=_0x3e0a60-0x0;var _0x3e8eb6=_0x46ea[_0x3e0a60];return _0x3e8eb6;};'use strict';var _=require('lodash');var util=require(_0xa46e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa46e('0x1'));var fs=require('fs');var Redis=require(_0xa46e('0x2'));var db=require(_0xa46e('0x3'))['db'];var utils=require(_0xa46e('0x4'));var logger=require('../../config/logger')(_0xa46e('0x5'));var config=require(_0xa46e('0x6'));var jayson=require(_0xa46e('0x7'));var client=jayson[_0xa46e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39bfc7,_0x4ba68d,_0x5ad6cd){return new BPromise(function(_0x5f4315,_0x3393d4){return client[_0xa46e('0x9')](_0x39bfc7,_0x5ad6cd)['then'](function(_0x194154){logger[_0xa46e('0xa')](_0xa46e('0xb'),_0x4ba68d,'request\x20sent');logger[_0xa46e('0xc')](_0xa46e('0xd'),_0x4ba68d,_0xa46e('0xe'),JSON[_0xa46e('0xf')](_0x194154));if(_0x194154[_0xa46e('0x10')]){if(_0x194154[_0xa46e('0x10')][_0xa46e('0x11')]===0x1f4){logger[_0xa46e('0x10')](_0xa46e('0xb'),_0x4ba68d,_0x194154['error'][_0xa46e('0x12')]);return _0x3393d4(_0x194154[_0xa46e('0x10')][_0xa46e('0x12')]);}logger[_0xa46e('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4ba68d,_0x194154[_0xa46e('0x10')][_0xa46e('0x12')]);return _0x5f4315(_0x194154[_0xa46e('0x10')]['message']);}else{logger[_0xa46e('0xa')](_0xa46e('0xb'),_0x4ba68d,_0xa46e('0xe'));_0x5f4315(_0x194154[_0xa46e('0x13')][_0xa46e('0x12')]);}})[_0xa46e('0x14')](function(_0x42fec8){logger[_0xa46e('0x10')](_0xa46e('0xb'),_0x4ba68d,_0x42fec8);_0x3393d4(_0x42fec8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index b99f7f0..b0da19c 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 _0x14bf=['/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x14bf,0x117));var _0xf14b=function(_0x9864fa,_0x4f7095){_0x9864fa=_0x9864fa-0x0;var _0x192c87=_0x14bf[_0x9864fa];return _0x192c87;};'use strict';var multer=require(_0xf14b('0x0'));var util=require(_0xf14b('0x1'));var path=require('path');var timeout=require(_0xf14b('0x2'));var express=require('express');var router=express[_0xf14b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf14b('0x4'));var config=require(_0xf14b('0x5'));var controller=require(_0xf14b('0x6'));router[_0xf14b('0x7')]('/',auth[_0xf14b('0x8')](),controller[_0xf14b('0x9')]);router[_0xf14b('0x7')](_0xf14b('0xa'),auth['isAuthenticated'](),controller[_0xf14b('0xb')]);router[_0xf14b('0xc')]('/',auth[_0xf14b('0x8')](),controller['create']);router['put'](_0xf14b('0xa'),auth['isAuthenticated'](),controller[_0xf14b('0xd')]);router[_0xf14b('0xe')]('/:id',auth[_0xf14b('0x8')](),controller[_0xf14b('0xf')]);module[_0xf14b('0x10')]=router; \ No newline at end of file +var _0x6363=['fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','post','create','put','/:id','delete','util','path','connect-timeout','express','Router'];(function(_0x48e611,_0x499a5d){var _0x3f5aae=function(_0x3ca573){while(--_0x3ca573){_0x48e611['push'](_0x48e611['shift']());}};_0x3f5aae(++_0x499a5d);}(_0x6363,0x171));var _0x3636=function(_0x46459f,_0x55b204){_0x46459f=_0x46459f-0x0;var _0x5f2a84=_0x6363[_0x46459f];return _0x5f2a84;};'use strict';var multer=require('multer');var util=require(_0x3636('0x0'));var path=require(_0x3636('0x1'));var timeout=require(_0x3636('0x2'));var express=require(_0x3636('0x3'));var router=express[_0x3636('0x4')]();var fs_extra=require(_0x3636('0x5'));var auth=require(_0x3636('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3636('0x7'));var controller=require(_0x3636('0x8'));router['get']('/',auth[_0x3636('0x9')](),controller[_0x3636('0xa')]);router[_0x3636('0xb')]('/:id',auth[_0x3636('0x9')](),controller['show']);router[_0x3636('0xc')]('/',auth['isAuthenticated'](),controller[_0x3636('0xd')]);router[_0x3636('0xe')](_0x3636('0xf'),auth[_0x3636('0x9')](),controller['update']);router[_0x3636('0x10')](_0x3636('0xf'),auth[_0x3636('0x9')](),controller['destroy']);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 3275eed..17f54a0 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 _0x2aa2=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x48db27,_0x3e3d58){var _0x4c80a6=function(_0x5e5ed3){while(--_0x5e5ed3){_0x48db27['push'](_0x48db27['shift']());}};_0x4c80a6(++_0x3e3d58);}(_0x2aa2,0x1a3));var _0x22aa=function(_0x579823,_0x2a792a){_0x579823=_0x579823-0x0;var _0xd6481f=_0x2aa2[_0x579823];return _0xd6481f;};'use strict';var Sequelize=require(_0x22aa('0x0'));module['exports']={'type':{'type':Sequelize[_0x22aa('0x1')](_0x22aa('0x2'),_0x22aa('0x3'),_0x22aa('0x4'),'keyValue',_0x22aa('0x5')),'defaultValue':_0x22aa('0x2')},'content':{'type':Sequelize[_0x22aa('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x22aa('0x1')](_0x22aa('0x2'),_0x22aa('0x3'),_0x22aa('0x4'))},'keyContent':{'type':Sequelize[_0x22aa('0x6')]},'idField':{'type':Sequelize[_0x22aa('0x6')]},'nameField':{'type':Sequelize[_0x22aa('0x6')]},'customField':{'type':Sequelize[_0x22aa('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x22aa('0x6')]}}; \ No newline at end of file +var _0x42a3=['variable','keyValue','picklist','string','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x42a3,0x130));var _0x342a=function(_0x403475,_0x456719){_0x403475=_0x403475-0x0;var _0x3ba3da=_0x42a3[_0x403475];return _0x3ba3da;};'use strict';var Sequelize=require('sequelize');module[_0x342a('0x0')]={'type':{'type':Sequelize[_0x342a('0x1')]('string',_0x342a('0x2'),'customVariable',_0x342a('0x3'),_0x342a('0x4')),'defaultValue':_0x342a('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x342a('0x6')]},'keyType':{'type':Sequelize[_0x342a('0x1')](_0x342a('0x5'),'variable',_0x342a('0x7'))},'keyContent':{'type':Sequelize[_0x342a('0x6')]},'idField':{'type':Sequelize[_0x342a('0x6')]},'nameField':{'type':Sequelize[_0x342a('0x6')]},'customField':{'type':Sequelize[_0x342a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x342a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1aa31f4..a5a3f91 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 _0x66d6=['index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','options','findAll','rows','catch','params','include','create','body','find','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','stack','name','send'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x66d6,0x15d));var _0x666d=function(_0x4427a0,_0x39edb4){_0x4427a0=_0x4427a0-0x0;var _0x2a9ccf=_0x66d6[_0x4427a0];return _0x2a9ccf;};'use strict';var emlformat=require(_0x666d('0x0'));var rimraf=require(_0x666d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x666d('0x2'));var rp=require('request-promise');var moment=require(_0x666d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x666d('0x4'));var util=require(_0x666d('0x5'));var path=require('path');var sox=require(_0x666d('0x6'));var csv=require(_0x666d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x666d('0x8'));var squel=require('squel');var crypto=require(_0x666d('0x9'));var jsforce=require(_0x666d('0xa'));var deskjs=require(_0x666d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x666d('0xc'));var Papa=require(_0x666d('0xd'));var Redis=require('ioredis');var authService=require(_0x666d('0xe'));var qs=require(_0x666d('0xf'));var as=require(_0x666d('0x10'));var hardwareService=require(_0x666d('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x666d('0x12'));var db=require(_0x666d('0x13'))['db'];function respondWithStatusCode(_0x2c806d,_0x16c82f){_0x16c82f=_0x16c82f||0xcc;return function(_0x1cb7c4){if(_0x1cb7c4){return _0x2c806d['sendStatus'](_0x16c82f);}return _0x2c806d[_0x666d('0x14')](_0x16c82f)['end']();};}function respondWithResult(_0x31da15,_0x5104e9){_0x5104e9=_0x5104e9||0xc8;return function(_0x2f0f0c){if(_0x2f0f0c){return _0x31da15[_0x666d('0x14')](_0x5104e9)['json'](_0x2f0f0c);}};}function respondWithFilteredResult(_0x32f00e,_0x1774d4){return function(_0x2155f5){if(_0x2155f5){var _0x1c182b=typeof _0x1774d4[_0x666d('0x15')]===_0x666d('0x16')&&typeof _0x1774d4[_0x666d('0x17')]===_0x666d('0x16');var _0x4d842c=_0x2155f5['count'];var _0xebf7c3=_0x1c182b?0x0:_0x1774d4[_0x666d('0x15')];var _0xb9903f=_0x1c182b?_0x2155f5[_0x666d('0x18')]:_0x1774d4[_0x666d('0x15')]+_0x1774d4[_0x666d('0x17')];var _0x1f4c84;if(_0xb9903f>=_0x4d842c){_0xb9903f=_0x4d842c;_0x1f4c84=0xc8;}else{_0x1f4c84=0xce;}_0x32f00e[_0x666d('0x14')](_0x1f4c84);return _0x32f00e[_0x666d('0x19')]('Content-Range',_0xebf7c3+'-'+_0xb9903f+'/'+_0x4d842c)['json'](_0x2155f5);}return null;};}function patchUpdates(_0x290cc0){return function(_0x24e49f){try{jsonpatch['apply'](_0x24e49f,_0x290cc0,!![]);}catch(_0x49896f){return BPromise[_0x666d('0x1a')](_0x49896f);}return _0x24e49f[_0x666d('0x1b')]();};}function saveUpdates(_0x2de856,_0x2044be){return function(_0x133c7e){if(_0x133c7e){return _0x133c7e[_0x666d('0x1c')](_0x2de856)[_0x666d('0x1d')](function(_0x49e57a){return _0x49e57a;});}return null;};}function removeEntity(_0xe33af5,_0x290ecc){return function(_0x496ecd){if(_0x496ecd){return _0x496ecd[_0x666d('0x1e')]()[_0x666d('0x1d')](function(){_0xe33af5[_0x666d('0x14')](0xcc)[_0x666d('0x1f')]();});}};}function handleEntityNotFound(_0x59ef57,_0x298b55){return function(_0xce3205){if(!_0xce3205){_0x59ef57['sendStatus'](0x194);}return _0xce3205;};}function handleError(_0x21c8ad,_0x52a899){_0x52a899=_0x52a899||0x1f4;return function(_0x5f55e6){logger['error'](_0x5f55e6[_0x666d('0x20')]);if(_0x5f55e6[_0x666d('0x21')]){delete _0x5f55e6[_0x666d('0x21')];}_0x21c8ad['status'](_0x52a899)[_0x666d('0x22')](_0x5f55e6);};}exports[_0x666d('0x23')]=function(_0x46deca,_0x361fa3){var _0x10440b={},_0x2764ec={},_0x1d66a7={'count':0x0,'rows':[]};var _0x13d1f6=_[_0x666d('0x24')](db[_0x666d('0x25')][_0x666d('0x26')],function(_0x5cd9eb){return{'name':_0x5cd9eb['fieldName'],'type':_0x5cd9eb[_0x666d('0x27')][_0x666d('0x28')]};});_0x2764ec[_0x666d('0x29')]=_['map'](_0x13d1f6,_0x666d('0x21'));_0x2764ec[_0x666d('0x2a')]=_[_0x666d('0x2b')](_0x46deca[_0x666d('0x2a')]);_0x2764ec[_0x666d('0x2c')]=_[_0x666d('0x2d')](_0x2764ec[_0x666d('0x29')],_0x2764ec[_0x666d('0x2a')]);_0x10440b[_0x666d('0x2e')]=_[_0x666d('0x2d')](_0x2764ec[_0x666d('0x29')],qs[_0x666d('0x2f')](_0x46deca[_0x666d('0x2a')][_0x666d('0x2f')]));_0x10440b[_0x666d('0x2e')]=_0x10440b[_0x666d('0x2e')][_0x666d('0x30')]?_0x10440b[_0x666d('0x2e')]:_0x2764ec[_0x666d('0x29')];if(!_0x46deca['query'][_0x666d('0x31')](_0x666d('0x32'))){_0x10440b[_0x666d('0x17')]=qs[_0x666d('0x17')](_0x46deca[_0x666d('0x2a')][_0x666d('0x17')]);_0x10440b[_0x666d('0x15')]=qs[_0x666d('0x15')](_0x46deca['query'][_0x666d('0x15')]);}_0x10440b['order']=qs['sort'](_0x46deca[_0x666d('0x2a')]['sort']);_0x10440b['where']=qs['filters'](_[_0x666d('0x33')](_0x46deca['query'],_0x2764ec[_0x666d('0x2c')]),_0x13d1f6);if(_0x46deca[_0x666d('0x2a')][_0x666d('0x34')]){_0x10440b[_0x666d('0x35')]=_[_0x666d('0x36')](_0x10440b[_0x666d('0x35')],{'$or':_[_0x666d('0x24')](_0x13d1f6,function(_0x4a56a0){if(_0x4a56a0[_0x666d('0x27')]!=='VIRTUAL'){var _0x429469={};_0x429469[_0x4a56a0[_0x666d('0x21')]]={'$like':'%'+_0x46deca['query'][_0x666d('0x34')]+'%'};return _0x429469;}})});}_0x10440b=_[_0x666d('0x36')]({},_0x10440b,_0x46deca[_0x666d('0x37')]);var _0xeec7bf={'where':_0x10440b[_0x666d('0x35')]};return db[_0x666d('0x25')]['count'](_0xeec7bf)[_0x666d('0x1d')](function(_0x1eadfa){_0x1d66a7[_0x666d('0x18')]=_0x1eadfa;if(_0x46deca['query']['includeAll']){_0x10440b['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x666d('0x38')](_0x10440b);})[_0x666d('0x1d')](function(_0x5e67e2){_0x1d66a7[_0x666d('0x39')]=_0x5e67e2;return _0x1d66a7;})[_0x666d('0x1d')](respondWithFilteredResult(_0x361fa3,_0x10440b))[_0x666d('0x3a')](handleError(_0x361fa3,null));};exports['show']=function(_0x3b61f6,_0x167836){var _0x1c16e2={'raw':!![],'where':{'id':_0x3b61f6[_0x666d('0x3b')]['id']}},_0x474eb4={};_0x474eb4[_0x666d('0x29')]=_['keys'](db[_0x666d('0x25')][_0x666d('0x26')]);_0x474eb4[_0x666d('0x2a')]=_['keys'](_0x3b61f6[_0x666d('0x2a')]);_0x474eb4[_0x666d('0x2c')]=_['intersection'](_0x474eb4['model'],_0x474eb4[_0x666d('0x2a')]);_0x1c16e2[_0x666d('0x2e')]=_[_0x666d('0x2d')](_0x474eb4[_0x666d('0x29')],qs[_0x666d('0x2f')](_0x3b61f6[_0x666d('0x2a')]['fields']));_0x1c16e2[_0x666d('0x2e')]=_0x1c16e2['attributes'][_0x666d('0x30')]?_0x1c16e2['attributes']:_0x474eb4[_0x666d('0x29')];if(_0x3b61f6[_0x666d('0x2a')]['includeAll']){_0x1c16e2[_0x666d('0x3c')]=[{'all':!![]}];}_0x1c16e2=_[_0x666d('0x36')]({},_0x1c16e2,_0x3b61f6[_0x666d('0x37')]);return db['Dynamics365Field']['find'](_0x1c16e2)[_0x666d('0x1d')](handleEntityNotFound(_0x167836,null))[_0x666d('0x1d')](respondWithResult(_0x167836,null))[_0x666d('0x3a')](handleError(_0x167836,null));};exports[_0x666d('0x3d')]=function(_0x5034c8,_0x5e70bc){return db[_0x666d('0x25')][_0x666d('0x3d')](_0x5034c8['body'],{})[_0x666d('0x1d')](respondWithResult(_0x5e70bc,0xc9))[_0x666d('0x3a')](handleError(_0x5e70bc,null));};exports['update']=function(_0x5d93c5,_0x11680b){if(_0x5d93c5[_0x666d('0x3e')]['id']){delete _0x5d93c5[_0x666d('0x3e')]['id'];}return db[_0x666d('0x25')][_0x666d('0x3f')]({'where':{'id':_0x5d93c5[_0x666d('0x3b')]['id']}})['then'](handleEntityNotFound(_0x11680b,null))['then'](saveUpdates(_0x5d93c5['body'],null))[_0x666d('0x1d')](respondWithResult(_0x11680b,null))[_0x666d('0x3a')](handleError(_0x11680b,null));};exports[_0x666d('0x1e')]=function(_0x1c8482,_0x522976){return db[_0x666d('0x25')][_0x666d('0x3f')]({'where':{'id':_0x1c8482['params']['id']}})[_0x666d('0x1d')](handleEntityNotFound(_0x522976,null))[_0x666d('0x1d')](removeEntity(_0x522976,null))[_0x666d('0x3a')](handleError(_0x522976,null));}; \ No newline at end of file +var _0xc1d4=['reject','save','update','then','destroy','end','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0x4efc32,_0xf20b5e){var _0x52a0e8=function(_0x3ec54b){while(--_0x3ec54b){_0x4efc32['push'](_0x4efc32['shift']());}};_0x52a0e8(++_0xf20b5e);}(_0xc1d4,0x1ab));var _0x4c1d=function(_0xc0373e,_0x446c82){_0xc0373e=_0xc0373e-0x0;var _0x53d1c5=_0xc1d4[_0xc0373e];return _0x53d1c5;};'use strict';var emlformat=require(_0x4c1d('0x0'));var rimraf=require(_0x4c1d('0x1'));var zipdir=require(_0x4c1d('0x2'));var jsonpatch=require(_0x4c1d('0x3'));var rp=require('request-promise');var moment=require(_0x4c1d('0x4'));var BPromise=require(_0x4c1d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4c1d('0x6'));var csv=require(_0x4c1d('0x7'));var ejs=require(_0x4c1d('0x8'));var fs=require('fs');var fs_extra=require(_0x4c1d('0x9'));var _=require('lodash');var squel=require(_0x4c1d('0xa'));var crypto=require(_0x4c1d('0xb'));var jsforce=require(_0x4c1d('0xc'));var deskjs=require(_0x4c1d('0xd'));var toCsv=require(_0x4c1d('0x7'));var querystring=require(_0x4c1d('0xe'));var Papa=require(_0x4c1d('0xf'));var Redis=require(_0x4c1d('0x10'));var authService=require(_0x4c1d('0x11'));var qs=require(_0x4c1d('0x12'));var as=require(_0x4c1d('0x13'));var hardwareService=require(_0x4c1d('0x14'));var logger=require(_0x4c1d('0x15'))(_0x4c1d('0x16'));var utils=require(_0x4c1d('0x17'));var config=require(_0x4c1d('0x18'));var licenseUtil=require(_0x4c1d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d15d5,_0x55b096){_0x55b096=_0x55b096||0xcc;return function(_0x1edb56){if(_0x1edb56){return _0x5d15d5[_0x4c1d('0x1a')](_0x55b096);}return _0x5d15d5[_0x4c1d('0x1b')](_0x55b096)['end']();};}function respondWithResult(_0x249f22,_0x355435){_0x355435=_0x355435||0xc8;return function(_0x38b2b2){if(_0x38b2b2){return _0x249f22[_0x4c1d('0x1b')](_0x355435)[_0x4c1d('0x1c')](_0x38b2b2);}};}function respondWithFilteredResult(_0x3861bc,_0x12ee67){return function(_0xd653da){if(_0xd653da){var _0x5f57b9=typeof _0x12ee67[_0x4c1d('0x1d')]==='undefined'&&typeof _0x12ee67['limit']===_0x4c1d('0x1e');var _0xf3fbd8=_0xd653da[_0x4c1d('0x1f')];var _0x27409e=_0x5f57b9?0x0:_0x12ee67[_0x4c1d('0x1d')];var _0x3bae96=_0x5f57b9?_0xd653da[_0x4c1d('0x1f')]:_0x12ee67[_0x4c1d('0x1d')]+_0x12ee67[_0x4c1d('0x20')];var _0xf6ae5b;if(_0x3bae96>=_0xf3fbd8){_0x3bae96=_0xf3fbd8;_0xf6ae5b=0xc8;}else{_0xf6ae5b=0xce;}_0x3861bc[_0x4c1d('0x1b')](_0xf6ae5b);return _0x3861bc['set'](_0x4c1d('0x21'),_0x27409e+'-'+_0x3bae96+'/'+_0xf3fbd8)[_0x4c1d('0x1c')](_0xd653da);}return null;};}function patchUpdates(_0x50fa70){return function(_0x3c0337){try{jsonpatch[_0x4c1d('0x22')](_0x3c0337,_0x50fa70,!![]);}catch(_0x145a0d){return BPromise[_0x4c1d('0x23')](_0x145a0d);}return _0x3c0337[_0x4c1d('0x24')]();};}function saveUpdates(_0x292e28,_0x3fd894){return function(_0x493ff8){if(_0x493ff8){return _0x493ff8[_0x4c1d('0x25')](_0x292e28)[_0x4c1d('0x26')](function(_0x631bb7){return _0x631bb7;});}return null;};}function removeEntity(_0x3d7546,_0x6dfba5){return function(_0x326ed5){if(_0x326ed5){return _0x326ed5[_0x4c1d('0x27')]()['then'](function(){_0x3d7546[_0x4c1d('0x1b')](0xcc)[_0x4c1d('0x28')]();});}};}function handleEntityNotFound(_0x12812a,_0x280012){return function(_0x54a72f){if(!_0x54a72f){_0x12812a['sendStatus'](0x194);}return _0x54a72f;};}function handleError(_0x50a988,_0x41431c){_0x41431c=_0x41431c||0x1f4;return function(_0xd62cc8){logger[_0x4c1d('0x29')](_0xd62cc8['stack']);if(_0xd62cc8[_0x4c1d('0x2a')]){delete _0xd62cc8[_0x4c1d('0x2a')];}_0x50a988[_0x4c1d('0x1b')](_0x41431c)[_0x4c1d('0x2b')](_0xd62cc8);};}exports[_0x4c1d('0x2c')]=function(_0x10103c,_0x1af6e9){var _0x5a4fb8={},_0xa61b2d={},_0x309d25={'count':0x0,'rows':[]};var _0x1646db=_[_0x4c1d('0x2d')](db[_0x4c1d('0x2e')][_0x4c1d('0x2f')],function(_0x2541ed){return{'name':_0x2541ed[_0x4c1d('0x30')],'type':_0x2541ed['type'][_0x4c1d('0x31')]};});_0xa61b2d[_0x4c1d('0x32')]=_[_0x4c1d('0x2d')](_0x1646db,'name');_0xa61b2d[_0x4c1d('0x33')]=_[_0x4c1d('0x34')](_0x10103c[_0x4c1d('0x33')]);_0xa61b2d[_0x4c1d('0x35')]=_[_0x4c1d('0x36')](_0xa61b2d['model'],_0xa61b2d[_0x4c1d('0x33')]);_0x5a4fb8['attributes']=_[_0x4c1d('0x36')](_0xa61b2d[_0x4c1d('0x32')],qs[_0x4c1d('0x37')](_0x10103c[_0x4c1d('0x33')][_0x4c1d('0x37')]));_0x5a4fb8[_0x4c1d('0x38')]=_0x5a4fb8[_0x4c1d('0x38')][_0x4c1d('0x39')]?_0x5a4fb8[_0x4c1d('0x38')]:_0xa61b2d[_0x4c1d('0x32')];if(!_0x10103c['query'][_0x4c1d('0x3a')](_0x4c1d('0x3b'))){_0x5a4fb8['limit']=qs['limit'](_0x10103c[_0x4c1d('0x33')][_0x4c1d('0x20')]);_0x5a4fb8[_0x4c1d('0x1d')]=qs['offset'](_0x10103c[_0x4c1d('0x33')]['offset']);}_0x5a4fb8[_0x4c1d('0x3c')]=qs[_0x4c1d('0x3d')](_0x10103c['query']['sort']);_0x5a4fb8[_0x4c1d('0x3e')]=qs[_0x4c1d('0x35')](_[_0x4c1d('0x3f')](_0x10103c[_0x4c1d('0x33')],_0xa61b2d['filters']),_0x1646db);if(_0x10103c['query']['filter']){_0x5a4fb8['where']=_[_0x4c1d('0x40')](_0x5a4fb8[_0x4c1d('0x3e')],{'$or':_[_0x4c1d('0x2d')](_0x1646db,function(_0x1a3f41){if(_0x1a3f41['type']!==_0x4c1d('0x41')){var _0x31a4ea={};_0x31a4ea[_0x1a3f41[_0x4c1d('0x2a')]]={'$like':'%'+_0x10103c[_0x4c1d('0x33')]['filter']+'%'};return _0x31a4ea;}})});}_0x5a4fb8=_['merge']({},_0x5a4fb8,_0x10103c[_0x4c1d('0x42')]);var _0x30aa1a={'where':_0x5a4fb8[_0x4c1d('0x3e')]};return db[_0x4c1d('0x2e')][_0x4c1d('0x1f')](_0x30aa1a)['then'](function(_0x33200f){_0x309d25['count']=_0x33200f;if(_0x10103c['query'][_0x4c1d('0x43')]){_0x5a4fb8['include']=[{'all':!![]}];}return db[_0x4c1d('0x2e')][_0x4c1d('0x44')](_0x5a4fb8);})[_0x4c1d('0x26')](function(_0x22cd36){_0x309d25[_0x4c1d('0x45')]=_0x22cd36;return _0x309d25;})[_0x4c1d('0x26')](respondWithFilteredResult(_0x1af6e9,_0x5a4fb8))[_0x4c1d('0x46')](handleError(_0x1af6e9,null));};exports[_0x4c1d('0x47')]=function(_0x3a595c,_0x54a170){var _0x99f21c={'raw':!![],'where':{'id':_0x3a595c[_0x4c1d('0x48')]['id']}},_0x405e13={};_0x405e13[_0x4c1d('0x32')]=_[_0x4c1d('0x34')](db[_0x4c1d('0x2e')][_0x4c1d('0x2f')]);_0x405e13[_0x4c1d('0x33')]=_[_0x4c1d('0x34')](_0x3a595c[_0x4c1d('0x33')]);_0x405e13[_0x4c1d('0x35')]=_[_0x4c1d('0x36')](_0x405e13[_0x4c1d('0x32')],_0x405e13[_0x4c1d('0x33')]);_0x99f21c[_0x4c1d('0x38')]=_[_0x4c1d('0x36')](_0x405e13[_0x4c1d('0x32')],qs[_0x4c1d('0x37')](_0x3a595c[_0x4c1d('0x33')]['fields']));_0x99f21c[_0x4c1d('0x38')]=_0x99f21c[_0x4c1d('0x38')]['length']?_0x99f21c[_0x4c1d('0x38')]:_0x405e13['model'];if(_0x3a595c[_0x4c1d('0x33')]['includeAll']){_0x99f21c[_0x4c1d('0x49')]=[{'all':!![]}];}_0x99f21c=_['merge']({},_0x99f21c,_0x3a595c[_0x4c1d('0x42')]);return db[_0x4c1d('0x2e')][_0x4c1d('0x4a')](_0x99f21c)[_0x4c1d('0x26')](handleEntityNotFound(_0x54a170,null))[_0x4c1d('0x26')](respondWithResult(_0x54a170,null))['catch'](handleError(_0x54a170,null));};exports[_0x4c1d('0x4b')]=function(_0x443728,_0x44ce47){return db[_0x4c1d('0x2e')][_0x4c1d('0x4b')](_0x443728[_0x4c1d('0x4c')],{})['then'](respondWithResult(_0x44ce47,0xc9))[_0x4c1d('0x46')](handleError(_0x44ce47,null));};exports[_0x4c1d('0x25')]=function(_0x1bd127,_0x328879){if(_0x1bd127[_0x4c1d('0x4c')]['id']){delete _0x1bd127[_0x4c1d('0x4c')]['id'];}return db['Dynamics365Field'][_0x4c1d('0x4a')]({'where':{'id':_0x1bd127['params']['id']}})[_0x4c1d('0x26')](handleEntityNotFound(_0x328879,null))[_0x4c1d('0x26')](saveUpdates(_0x1bd127[_0x4c1d('0x4c')],null))[_0x4c1d('0x26')](respondWithResult(_0x328879,null))[_0x4c1d('0x46')](handleError(_0x328879,null));};exports[_0x4c1d('0x27')]=function(_0x400ee2,_0x4906af){return db[_0x4c1d('0x2e')][_0x4c1d('0x4a')]({'where':{'id':_0x400ee2[_0x4c1d('0x48')]['id']}})[_0x4c1d('0x26')](handleEntityNotFound(_0x4906af,null))[_0x4c1d('0x26')](removeEntity(_0x4906af,null))[_0x4c1d('0x46')](handleError(_0x4906af,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3e455e0..1bd4925 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 _0x132c=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','request-promise','path','../../config/environment'];(function(_0x24dfad,_0x50e811){var _0x2a1ef2=function(_0x3acdf0){while(--_0x3acdf0){_0x24dfad['push'](_0x24dfad['shift']());}};_0x2a1ef2(++_0x50e811);}(_0x132c,0xbb));var _0xc132=function(_0x555f02,_0x1c6213){_0x555f02=_0x555f02-0x0;var _0x10abdd=_0x132c[_0x555f02];return _0x10abdd;};'use strict';var _=require(_0xc132('0x0'));var util=require(_0xc132('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc132('0x2'));var fs=require('fs');var path=require(_0xc132('0x3'));var rimraf=require('rimraf');var config=require(_0xc132('0x4'));var attributes=require(_0xc132('0x5'));module[_0xc132('0x6')]=function(_0x507a9f,_0x5bb9b4){return _0x507a9f[_0xc132('0x7')](_0xc132('0x8'),attributes,{'tableName':_0xc132('0x9'),'paranoid':![],'indexes':[{'name':_0xc132('0xa'),'fields':['idField',_0xc132('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x790a=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','../../config/logger','request-promise','path','rimraf','./intDynamics365Field.attributes'];(function(_0x451420,_0x412b79){var _0x4baccb=function(_0x17eff7){while(--_0x17eff7){_0x451420['push'](_0x451420['shift']());}};_0x4baccb(++_0x412b79);}(_0x790a,0xa3));var _0xa790=function(_0x1fe4d1,_0x3489c1){_0x1fe4d1=_0x1fe4d1-0x0;var _0x106bfb=_0x790a[_0x1fe4d1];return _0x106bfb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa790('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa790('0x1'));var fs=require('fs');var path=require(_0xa790('0x2'));var rimraf=require(_0xa790('0x3'));var config=require('../../config/environment');var attributes=require(_0xa790('0x4'));module[_0xa790('0x5')]=function(_0x2edbcd,_0x3c4860){return _0x2edbcd[_0xa790('0x6')](_0xa790('0x7'),attributes,{'tableName':_0xa790('0x8'),'paranoid':![],'indexes':[{'name':_0xa790('0x9'),'fields':[_0xa790('0xa'),_0xa790('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 2838740..5384ee7 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 _0x92ae=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0xace0af,_0x3a8558){var _0xe6ddb8=function(_0xc8b6cf){while(--_0xc8b6cf){_0xace0af['push'](_0xace0af['shift']());}};_0xe6ddb8(++_0x3a8558);}(_0x92ae,0x1c2));var _0xe92a=function(_0x2c26ac,_0x58f4d2){_0x2c26ac=_0x2c26ac-0x0;var _0xc837d8=_0x92ae[_0x2c26ac];return _0xc837d8;};'use strict';var _=require(_0xe92a('0x0'));var util=require(_0xe92a('0x1'));var moment=require(_0xe92a('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(_0xe92a('0x3'));var logger=require(_0xe92a('0x4'))(_0xe92a('0x5'));var config=require('../../config/environment');var jayson=require(_0xe92a('0x6'));var client=jayson['client'][_0xe92a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x238f51,_0x211efb,_0x120ea5){return new BPromise(function(_0x4698be,_0x55a6a4){return client[_0xe92a('0x8')](_0x238f51,_0x120ea5)[_0xe92a('0x9')](function(_0x3992ac){logger[_0xe92a('0xa')](_0xe92a('0xb'),_0x211efb,_0xe92a('0xc'));logger[_0xe92a('0xd')](_0xe92a('0xe'),_0x211efb,_0xe92a('0xc'),JSON['stringify'](_0x3992ac));if(_0x3992ac[_0xe92a('0xf')]){if(_0x3992ac[_0xe92a('0xf')][_0xe92a('0x10')]===0x1f4){logger[_0xe92a('0xf')](_0xe92a('0xb'),_0x211efb,_0x3992ac[_0xe92a('0xf')]['message']);return _0x55a6a4(_0x3992ac[_0xe92a('0xf')]['message']);}logger[_0xe92a('0xf')](_0xe92a('0xb'),_0x211efb,_0x3992ac['error'][_0xe92a('0x11')]);return _0x4698be(_0x3992ac[_0xe92a('0xf')]['message']);}else{logger['info'](_0xe92a('0xb'),_0x211efb,'request\x20sent');_0x4698be(_0x3992ac[_0xe92a('0x12')][_0xe92a('0x11')]);}})[_0xe92a('0x13')](function(_0x22d008){logger[_0xe92a('0xf')](_0xe92a('0xb'),_0x211efb,_0x22d008);_0x55a6a4(_0x22d008);});});} \ No newline at end of file +var _0x2299=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x1a0a72,_0x452df4){var _0x4af4c0=function(_0x48a179){while(--_0x48a179){_0x1a0a72['push'](_0x1a0a72['shift']());}};_0x4af4c0(++_0x452df4);}(_0x2299,0x1aa));var _0x9229=function(_0x559f21,_0x288db8){_0x559f21=_0x559f21-0x0;var _0x5f3168=_0x2299[_0x559f21];return _0x5f3168;};'use strict';var _=require(_0x9229('0x0'));var util=require(_0x9229('0x1'));var moment=require(_0x9229('0x2'));var BPromise=require(_0x9229('0x3'));var rs=require(_0x9229('0x4'));var fs=require('fs');var Redis=require(_0x9229('0x5'));var db=require(_0x9229('0x6'))['db'];var utils=require(_0x9229('0x7'));var logger=require(_0x9229('0x8'))(_0x9229('0x9'));var config=require(_0x9229('0xa'));var jayson=require(_0x9229('0xb'));var client=jayson[_0x9229('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f28da,_0x489143,_0x426f10){return new BPromise(function(_0x1828c8,_0x343c03){return client[_0x9229('0xd')](_0x2f28da,_0x426f10)[_0x9229('0xe')](function(_0x45d5dd){logger[_0x9229('0xf')](_0x9229('0x10'),_0x489143,'request\x20sent');logger[_0x9229('0x11')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x489143,_0x9229('0x12'),JSON[_0x9229('0x13')](_0x45d5dd));if(_0x45d5dd[_0x9229('0x14')]){if(_0x45d5dd[_0x9229('0x14')][_0x9229('0x15')]===0x1f4){logger[_0x9229('0x14')](_0x9229('0x10'),_0x489143,_0x45d5dd['error'][_0x9229('0x16')]);return _0x343c03(_0x45d5dd[_0x9229('0x14')][_0x9229('0x16')]);}logger['error'](_0x9229('0x10'),_0x489143,_0x45d5dd[_0x9229('0x14')][_0x9229('0x16')]);return _0x1828c8(_0x45d5dd['error']['message']);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x489143,_0x9229('0x12'));_0x1828c8(_0x45d5dd[_0x9229('0x17')][_0x9229('0x16')]);}})[_0x9229('0x18')](function(_0x191995){logger['error'](_0x9229('0x10'),_0x489143,_0x191995);_0x343c03(_0x191995);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 8c023e8..c9176a3 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 _0xd404=['addConfiguration','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id/fields','create','/:id/configurations'];(function(_0x1782ab,_0x2be812){var _0x4dd6d9=function(_0x289fa9){while(--_0x289fa9){_0x1782ab['push'](_0x1782ab['shift']());}};_0x4dd6d9(++_0x2be812);}(_0xd404,0x6f));var _0x4d40=function(_0x5955c7,_0x3be12){_0x5955c7=_0x5955c7-0x0;var _0x312d65=_0xd404[_0x5955c7];return _0x312d65;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require(_0x4d40('0x2'));var timeout=require(_0x4d40('0x3'));var express=require(_0x4d40('0x4'));var router=express['Router']();var fs_extra=require(_0x4d40('0x5'));var auth=require(_0x4d40('0x6'));var interaction=require(_0x4d40('0x7'));var config=require('../../config/environment');var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router['get']('/:id',auth[_0x4d40('0xa')](),controller['show']);router[_0x4d40('0x9')]('/:id/configurations',auth[_0x4d40('0xa')](),controller['getConfigurations']);router['get'](_0x4d40('0xc'),auth[_0x4d40('0xa')](),controller['getFields']);router['post']('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xd')]);router['post'](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/:id',auth[_0x4d40('0xa')](),controller[_0x4d40('0x11')]);router[_0x4d40('0x12')](_0x4d40('0x13'),auth[_0x4d40('0xa')](),controller['destroy']);module[_0x4d40('0x14')]=router; \ No newline at end of file +var _0x9fb1=['../../config/environment','./intFreshdeskAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x94b760,_0x1dbbfe){var _0x5dfb70=function(_0x23f6bd){while(--_0x23f6bd){_0x94b760['push'](_0x94b760['shift']());}};_0x5dfb70(++_0x1dbbfe);}(_0x9fb1,0xf7));var _0x19fb=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x9fb1[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require(_0x19fb('0x0'));var util=require(_0x19fb('0x1'));var path=require(_0x19fb('0x2'));var timeout=require(_0x19fb('0x3'));var express=require('express');var router=express[_0x19fb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19fb('0x5'));var controller=require(_0x19fb('0x6'));router[_0x19fb('0x7')]('/',auth['isAuthenticated'](),controller[_0x19fb('0x8')]);router[_0x19fb('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x19fb('0x9')]);router['get'](_0x19fb('0xa'),auth[_0x19fb('0xb')](),controller[_0x19fb('0xc')]);router[_0x19fb('0x7')](_0x19fb('0xd'),auth[_0x19fb('0xb')](),controller[_0x19fb('0xe')]);router[_0x19fb('0xf')]('/',auth[_0x19fb('0xb')](),controller[_0x19fb('0x10')]);router[_0x19fb('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x19fb('0x11'),auth[_0x19fb('0xb')](),controller[_0x19fb('0x12')]);router['delete']('/:id',auth[_0x19fb('0xb')](),controller[_0x19fb('0x13')]);module[_0x19fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e43a48b..8f56046 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 _0x4888=['exports','STRING','username'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4888,0x198));var _0x8488=function(_0x3d8eb2,_0x5e58a3){_0x3d8eb2=_0x3d8eb2-0x0;var _0x1bb6bb=_0x4888[_0x3d8eb2];return _0x1bb6bb;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbbbc=['remoteUri','sequelize','exports','STRING','username'];(function(_0x61ed0b,_0x37e3c8){var _0x4f2784=function(_0xba14d6){while(--_0xba14d6){_0x61ed0b['push'](_0x61ed0b['shift']());}};_0x4f2784(++_0x37e3c8);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x443e1c,_0x229f8c){_0x443e1c=_0x443e1c-0x0;var _0x1a659a=_0xbbbc[_0x443e1c];return _0x1a659a;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module[_0xcbbb('0x1')]={'name':{'type':Sequelize[_0xcbbb('0x2')]},'description':{'type':Sequelize[_0xcbbb('0x2')]},'username':{'type':Sequelize[_0xcbbb('0x2')],'unique':_0xcbbb('0x3')},'apiKey':{'type':Sequelize[_0xcbbb('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcbbb('0x4')},'serverUrl':{'type':Sequelize[_0xcbbb('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 0fa9ab2..e37fea9 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 _0xf109=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','nolimit','Subjects','type','getDescriptions','channel','FreshdeskField','Descriptions','remoteUri','apiKey','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','error','getFields','stringify','statusCode','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xf109,0xce));var _0x9f10=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xf109[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require(_0x9f10('0x0'));var rimraf=require(_0x9f10('0x1'));var zipdir=require(_0x9f10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f10('0x3'));var Mustache=require(_0x9f10('0x4'));var util=require(_0x9f10('0x5'));var path=require(_0x9f10('0x6'));var sox=require(_0x9f10('0x7'));var csv=require(_0x9f10('0x8'));var ejs=require(_0x9f10('0x9'));var fs=require('fs');var fs_extra=require(_0x9f10('0xa'));var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x8'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var licenseUtil=require(_0x9f10('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9f10('0x18'));function respondWithStatusCode(_0x260606,_0x35c529){_0x35c529=_0x35c529||0xcc;return function(_0x58067f){if(_0x58067f){return _0x260606[_0x9f10('0x19')](_0x35c529);}return _0x260606[_0x9f10('0x1a')](_0x35c529)['end']();};}function respondWithResult(_0x40a48a,_0x236e28){_0x236e28=_0x236e28||0xc8;return function(_0x507e1a){if(_0x507e1a){return _0x40a48a['status'](_0x236e28)[_0x9f10('0x1b')](_0x507e1a);}};}function respondWithFilteredResult(_0x177918,_0x549217){return function(_0x11154b){if(_0x11154b){var _0x5ae255=typeof _0x549217[_0x9f10('0x1c')]===_0x9f10('0x1d')&&typeof _0x549217['limit']===_0x9f10('0x1d');var _0xd2950c=_0x11154b['count'];var _0x150813=_0x5ae255?0x0:_0x549217['offset'];var _0xe221d0=_0x5ae255?_0x11154b['count']:_0x549217[_0x9f10('0x1c')]+_0x549217['limit'];var _0x54c262;if(_0xe221d0>=_0xd2950c){_0xe221d0=_0xd2950c;_0x54c262=0xc8;}else{_0x54c262=0xce;}_0x177918[_0x9f10('0x1a')](_0x54c262);return _0x177918[_0x9f10('0x1e')](_0x9f10('0x1f'),_0x150813+'-'+_0xe221d0+'/'+_0xd2950c)[_0x9f10('0x1b')](_0x11154b);}return null;};}function patchUpdates(_0xa810c){return function(_0x332575){try{jsonpatch[_0x9f10('0x20')](_0x332575,_0xa810c,!![]);}catch(_0x4cdc00){return BPromise[_0x9f10('0x21')](_0x4cdc00);}return _0x332575['save']();};}function saveUpdates(_0x293990,_0x36ace4){return function(_0x3d25cb){if(_0x3d25cb){return _0x3d25cb['update'](_0x293990)[_0x9f10('0x22')](function(_0x3dde2e){return _0x3dde2e;});}return null;};}function removeEntity(_0x213567,_0x4d21c5){return function(_0x36821e){if(_0x36821e){return _0x36821e[_0x9f10('0x23')]()[_0x9f10('0x22')](function(){_0x213567['status'](0xcc)[_0x9f10('0x24')]();});}};}function handleEntityNotFound(_0x23c2e7,_0x11cae7){return function(_0x1647c0){if(!_0x1647c0){_0x23c2e7['sendStatus'](0x194);}return _0x1647c0;};}function handleError(_0x57539b,_0x5c1800){_0x5c1800=_0x5c1800||0x1f4;return function(_0x385a39){logger['error'](_0x385a39[_0x9f10('0x25')]);if(_0x385a39[_0x9f10('0x26')]){delete _0x385a39[_0x9f10('0x26')];}_0x57539b[_0x9f10('0x1a')](_0x5c1800)[_0x9f10('0x27')](_0x385a39);};}exports['index']=function(_0x522805,_0x22814f){var _0x40f96b={},_0xfbb37f={},_0x181aec={'count':0x0,'rows':[]};var _0x2c4373=_['map'](db[_0x9f10('0x28')][_0x9f10('0x29')],function(_0x44207f){return{'name':_0x44207f[_0x9f10('0x2a')],'type':_0x44207f['type'][_0x9f10('0x2b')]};});_0xfbb37f[_0x9f10('0x2c')]=_[_0x9f10('0x2d')](_0x2c4373,'name');_0xfbb37f[_0x9f10('0x2e')]=_['keys'](_0x522805[_0x9f10('0x2e')]);_0xfbb37f[_0x9f10('0x2f')]=_[_0x9f10('0x30')](_0xfbb37f['model'],_0xfbb37f[_0x9f10('0x2e')]);_0x40f96b[_0x9f10('0x31')]=_[_0x9f10('0x30')](_0xfbb37f[_0x9f10('0x2c')],qs[_0x9f10('0x32')](_0x522805['query'][_0x9f10('0x32')]));_0x40f96b['attributes']=_0x40f96b[_0x9f10('0x31')][_0x9f10('0x33')]?_0x40f96b[_0x9f10('0x31')]:_0xfbb37f[_0x9f10('0x2c')];if(!_0x522805[_0x9f10('0x2e')][_0x9f10('0x34')]('nolimit')){_0x40f96b[_0x9f10('0x35')]=qs[_0x9f10('0x35')](_0x522805[_0x9f10('0x2e')]['limit']);_0x40f96b[_0x9f10('0x1c')]=qs[_0x9f10('0x1c')](_0x522805['query'][_0x9f10('0x1c')]);}_0x40f96b['order']=qs[_0x9f10('0x36')](_0x522805[_0x9f10('0x2e')][_0x9f10('0x36')]);_0x40f96b[_0x9f10('0x37')]=qs[_0x9f10('0x2f')](_[_0x9f10('0x38')](_0x522805[_0x9f10('0x2e')],_0xfbb37f[_0x9f10('0x2f')]),_0x2c4373);if(_0x522805['query'][_0x9f10('0x39')]){_0x40f96b[_0x9f10('0x37')]=_[_0x9f10('0x3a')](_0x40f96b['where'],{'$or':_[_0x9f10('0x2d')](_0x2c4373,function(_0x193b59){if(_0x193b59['type']!==_0x9f10('0x3b')){var _0x26f0ba={};_0x26f0ba[_0x193b59[_0x9f10('0x26')]]={'$like':'%'+_0x522805['query']['filter']+'%'};return _0x26f0ba;}})});}_0x40f96b=_[_0x9f10('0x3a')]({},_0x40f96b,_0x522805[_0x9f10('0x3c')]);var _0x1deed4={'where':_0x40f96b[_0x9f10('0x37')]};return db[_0x9f10('0x28')][_0x9f10('0x3d')](_0x1deed4)[_0x9f10('0x22')](function(_0x34869c){_0x181aec[_0x9f10('0x3d')]=_0x34869c;if(_0x522805[_0x9f10('0x2e')][_0x9f10('0x3e')]){_0x40f96b[_0x9f10('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x40f96b);})['then'](function(_0x24700a){_0x181aec['rows']=_0x24700a;return _0x181aec;})[_0x9f10('0x22')](respondWithFilteredResult(_0x22814f,_0x40f96b))[_0x9f10('0x40')](handleError(_0x22814f,null));};exports[_0x9f10('0x41')]=function(_0x47d25c,_0x3cfce6){var _0xf1164={'raw':![],'where':{'id':_0x47d25c[_0x9f10('0x42')]['id']}},_0x1d334e={};_0x1d334e[_0x9f10('0x2c')]=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x1d334e[_0x9f10('0x2e')]=_['keys'](_0x47d25c[_0x9f10('0x2e')]);_0x1d334e['filters']=_[_0x9f10('0x30')](_0x1d334e[_0x9f10('0x2c')],_0x1d334e[_0x9f10('0x2e')]);_0xf1164[_0x9f10('0x31')]=_['intersection'](_0x1d334e[_0x9f10('0x2c')],qs[_0x9f10('0x32')](_0x47d25c['query'][_0x9f10('0x32')]));_0xf1164[_0x9f10('0x31')]=_0xf1164[_0x9f10('0x31')][_0x9f10('0x33')]?_0xf1164[_0x9f10('0x31')]:_0x1d334e[_0x9f10('0x2c')];if(_0x47d25c[_0x9f10('0x2e')][_0x9f10('0x3e')]){_0xf1164[_0x9f10('0x3f')]=[{'all':!![]}];}_0xf1164=_[_0x9f10('0x3a')]({},_0xf1164,_0x47d25c['options']);return db[_0x9f10('0x28')][_0x9f10('0x43')](_0xf1164)['then'](handleEntityNotFound(_0x3cfce6,null))[_0x9f10('0x22')](respondWithResult(_0x3cfce6,null))[_0x9f10('0x40')](handleError(_0x3cfce6,null));};exports[_0x9f10('0x44')]=function(_0x1807b3,_0x58b5b5){return db[_0x9f10('0x28')][_0x9f10('0x44')](_0x1807b3[_0x9f10('0x45')],{})[_0x9f10('0x22')](respondWithResult(_0x58b5b5,0xc9))[_0x9f10('0x40')](handleError(_0x58b5b5,null));};exports[_0x9f10('0x46')]=function(_0x479b46,_0x24ebc4){if(_0x479b46[_0x9f10('0x45')]['id']){delete _0x479b46[_0x9f10('0x45')]['id'];}return db[_0x9f10('0x28')][_0x9f10('0x43')]({'where':{'id':_0x479b46[_0x9f10('0x42')]['id']}})['then'](handleEntityNotFound(_0x24ebc4,null))[_0x9f10('0x22')](saveUpdates(_0x479b46[_0x9f10('0x45')],null))[_0x9f10('0x22')](respondWithResult(_0x24ebc4,null))[_0x9f10('0x40')](handleError(_0x24ebc4,null));};exports[_0x9f10('0x23')]=function(_0x15d676,_0x2b6fe7){return db[_0x9f10('0x28')]['find']({'where':{'id':_0x15d676[_0x9f10('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b6fe7,null))[_0x9f10('0x22')](removeEntity(_0x2b6fe7,null))['catch'](handleError(_0x2b6fe7,null));};exports[_0x9f10('0x47')]=function(_0x2d06b2,_0x30fad9,_0x30ea41){var _0x10d6dc={};var _0x497260={};var _0x12cf34;var _0x63abfb;return db[_0x9f10('0x28')][_0x9f10('0x48')]({'where':{'id':_0x2d06b2['params']['id']}})['then'](handleEntityNotFound(_0x30fad9,null))[_0x9f10('0x22')](function(_0x22e236){if(_0x22e236){_0x12cf34=_0x22e236;_0x497260['model']=_['keys'](db[_0x9f10('0x49')][_0x9f10('0x29')]);_0x497260[_0x9f10('0x2e')]=_['keys'](_0x2d06b2[_0x9f10('0x2e')]);_0x497260[_0x9f10('0x2f')]=_[_0x9f10('0x30')](_0x497260['model'],_0x497260[_0x9f10('0x2e')]);_0x10d6dc[_0x9f10('0x31')]=_[_0x9f10('0x30')](_0x497260['model'],qs[_0x9f10('0x32')](_0x2d06b2[_0x9f10('0x2e')]['fields']));_0x10d6dc[_0x9f10('0x31')]=_0x10d6dc[_0x9f10('0x31')][_0x9f10('0x33')]?_0x10d6dc[_0x9f10('0x31')]:_0x497260[_0x9f10('0x2c')];_0x10d6dc['order']=qs[_0x9f10('0x36')](_0x2d06b2['query']['sort']);_0x10d6dc[_0x9f10('0x37')]=qs[_0x9f10('0x2f')](_[_0x9f10('0x38')](_0x2d06b2[_0x9f10('0x2e')],_0x497260[_0x9f10('0x2f')]));if(_0x2d06b2[_0x9f10('0x2e')][_0x9f10('0x39')]){_0x10d6dc['where']=_['merge'](_0x10d6dc[_0x9f10('0x37')],{'$or':_[_0x9f10('0x2d')](_0x10d6dc[_0x9f10('0x31')],function(_0x40f845){var _0x2625ca={};_0x2625ca[_0x40f845]={'$like':'%'+_0x2d06b2[_0x9f10('0x2e')][_0x9f10('0x39')]+'%'};return _0x2625ca;})});}_0x10d6dc=_['merge']({},_0x10d6dc,_0x2d06b2[_0x9f10('0x3c')]);return _0x12cf34[_0x9f10('0x47')](_0x10d6dc);}})['then'](function(_0x29589e){if(_0x29589e){_0x63abfb=_0x29589e[_0x9f10('0x33')];if(!_0x2d06b2['query'][_0x9f10('0x34')](_0x9f10('0x4a'))){_0x10d6dc['limit']=qs[_0x9f10('0x35')](_0x2d06b2['query'][_0x9f10('0x35')]);_0x10d6dc[_0x9f10('0x1c')]=qs[_0x9f10('0x1c')](_0x2d06b2[_0x9f10('0x2e')][_0x9f10('0x1c')]);}return _0x12cf34['getConfigurations'](_0x10d6dc);}})[_0x9f10('0x22')](function(_0x364a6e){if(_0x364a6e){return _0x364a6e?{'count':_0x63abfb,'rows':_0x364a6e}:null;}})[_0x9f10('0x22')](respondWithResult(_0x30fad9,null))['catch'](handleError(_0x30fad9,null));};exports['addConfiguration']=function(_0x5b60ef,_0x41d949,_0x216d6c){if(_0x5b60ef[_0x9f10('0x45')]['id']){delete _0x5b60ef[_0x9f10('0x45')]['id'];}return db[_0x9f10('0x28')][_0x9f10('0x48')]({'where':{'id':_0x5b60ef['params']['id']}})[_0x9f10('0x22')](handleEntityNotFound(_0x41d949,null))[_0x9f10('0x22')](function(_0x498ad6){if(_0x498ad6){_0x5b60ef[_0x9f10('0x45')]['AccountId']=_0x498ad6['id'];_0x5b60ef[_0x9f10('0x45')][_0x9f10('0x4b')]=integrations['getSubjects'](_0x5b60ef[_0x9f10('0x45')]['channel'],_0x5b60ef[_0x9f10('0x45')][_0x9f10('0x4c')]);_0x5b60ef[_0x9f10('0x45')]['Descriptions']=integrations[_0x9f10('0x4d')](_0x5b60ef['body'][_0x9f10('0x4e')],_0x5b60ef[_0x9f10('0x45')][_0x9f10('0x4c')]);return db['FreshdeskConfiguration'][_0x9f10('0x44')](_0x5b60ef['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x9f10('0x4b')},{'model':db[_0x9f10('0x4f')],'as':_0x9f10('0x50')}]});}return null;})['then'](respondWithResult(_0x41d949,null))[_0x9f10('0x40')](handleError(_0x41d949,null));};exports['getFields']=function(_0x48ce93,_0x329a74,_0x551a5d){var _0x4e7b27='';return db[_0x9f10('0x28')]['findOne']({'where':{'id':_0x48ce93[_0x9f10('0x42')]['id']},'attributes':['id',_0x9f10('0x51'),_0x9f10('0x52')]})['then'](handleEntityNotFound(_0x329a74,null))[_0x9f10('0x22')](function(_0x1cbcf3){if(_0x1cbcf3){_0x4e7b27=_0x1cbcf3['remoteUri'];var _0x2941dc=_0x4e7b27['slice'](-0x1);if(_0x2941dc==='/'){_0x4e7b27=_0x4e7b27['substring'](0x0,_0x4e7b27[_0x9f10('0x53')](_0x2941dc));}return rp({'method':_0x9f10('0x54'),'uri':util[_0x9f10('0x55')](_0x9f10('0x56'),_0x4e7b27,_0x9f10('0x57')),'headers':{'Authorization':util[_0x9f10('0x55')](_0x9f10('0x58'),new Buffer(util['format'](_0x9f10('0x59'),_0x1cbcf3[_0x9f10('0x52')]))[_0x9f10('0x5a')](_0x9f10('0x5b')))},'json':!![]});}})[_0x9f10('0x22')](function(_0x16b217){if(_0x16b217){var _0x26d49b=[_0x9f10('0x5c'),_0x9f10('0x5d'),'agent',_0x9f10('0x5e'),_0x9f10('0x1a'),_0x9f10('0x5f'),_0x9f10('0x60'),'source',_0x9f10('0x61'),_0x9f10('0x60'),_0x9f10('0x62')];_[_0x9f10('0x63')](_0x16b217,function(_0x4d68d3){return _0x26d49b['includes'](_0x4d68d3[_0x9f10('0x26')])||!_0x4d68d3[_0x9f10('0x64')]&&_0x4d68d3[_0x9f10('0x4c')]!==_0x9f10('0x65')&&_0x4d68d3[_0x9f10('0x4c')]!==_0x9f10('0x66');});return{'count':_0x16b217[_0x9f10('0x33')],'rows':_[_0x9f10('0x2d')](_0x16b217,function(_0x129f91){return{'id':_0x129f91[_0x9f10('0x26')],'name':_0x129f91[_0x9f10('0x67')],'custom':!_0x129f91[_0x9f10('0x64')],'options':_0x129f91[_0x9f10('0x68')]?_[_0x9f10('0x2d')](_0x129f91[_0x9f10('0x68')],function(_0x514315){return{'name':_[_0x9f10('0x69')](_0x514315),'value':_0x514315};}):[]};})};}})[_0x9f10('0x22')](respondWithResult(_0x329a74,null))['catch'](function(_0x3bcea2){var _0x21d1df=_0x48ce93[_0x9f10('0x2e')][_0x9f10('0x6a')]?0x1f4:_0x3bcea2['statusCode']||0x1f4;logger[_0x9f10('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0x9f10('0x6c'),_0x21d1df,JSON[_0x9f10('0x6d')](_0x3bcea2));delete _0x3bcea2[_0x9f10('0x26')];if(_0x21d1df===0x191){_0x21d1df=0x190;}_0x329a74['status'](_0x21d1df)[_0x9f10('0x27')](_0x48ce93[_0x9f10('0x2e')][_0x9f10('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x3bcea2[_0x9f10('0x6e')]}:_0x3bcea2);});}; \ No newline at end of file +var _0x4a3d=['custom_text','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','apply','update','destroy','then','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','catch','body','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','agent','description','priority','group','company','remove','includes'];(function(_0x409268,_0x240121){var _0x11b5b9=function(_0x30d248){while(--_0x30d248){_0x409268['push'](_0x409268['shift']());}};_0x11b5b9(++_0x240121);}(_0x4a3d,0x79));var _0xd4a3=function(_0x481eda,_0x50b746){_0x481eda=_0x481eda-0x0;var _0x4a597e=_0x4a3d[_0x481eda];return _0x4a597e;};'use strict';var emlformat=require(_0xd4a3('0x0'));var rimraf=require(_0xd4a3('0x1'));var zipdir=require(_0xd4a3('0x2'));var jsonpatch=require(_0xd4a3('0x3'));var rp=require(_0xd4a3('0x4'));var moment=require(_0xd4a3('0x5'));var BPromise=require(_0xd4a3('0x6'));var Mustache=require(_0xd4a3('0x7'));var util=require(_0xd4a3('0x8'));var path=require(_0xd4a3('0x9'));var sox=require(_0xd4a3('0xa'));var csv=require(_0xd4a3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4a3('0xc'));var squel=require(_0xd4a3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4a3('0xe'));var toCsv=require(_0xd4a3('0xb'));var querystring=require(_0xd4a3('0xf'));var Papa=require(_0xd4a3('0x10'));var Redis=require(_0xd4a3('0x11'));var authService=require(_0xd4a3('0x12'));var qs=require(_0xd4a3('0x13'));var as=require(_0xd4a3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a3('0x15'))(_0xd4a3('0x16'));var utils=require(_0xd4a3('0x17'));var config=require(_0xd4a3('0x18'));var licenseUtil=require(_0xd4a3('0x19'));var db=require(_0xd4a3('0x1a'))['db'];var integrations=require(_0xd4a3('0x1b'));function respondWithStatusCode(_0x57bd90,_0x3548e4){_0x3548e4=_0x3548e4||0xcc;return function(_0x2f4009){if(_0x2f4009){return _0x57bd90[_0xd4a3('0x1c')](_0x3548e4);}return _0x57bd90[_0xd4a3('0x1d')](_0x3548e4)[_0xd4a3('0x1e')]();};}function respondWithResult(_0x11f325,_0x2bfeb6){_0x2bfeb6=_0x2bfeb6||0xc8;return function(_0x306926){if(_0x306926){return _0x11f325['status'](_0x2bfeb6)['json'](_0x306926);}};}function respondWithFilteredResult(_0x140379,_0x2f96bb){return function(_0x124d03){if(_0x124d03){var _0xfd502c=typeof _0x2f96bb[_0xd4a3('0x1f')]===_0xd4a3('0x20')&&typeof _0x2f96bb['limit']===_0xd4a3('0x20');var _0x56ab48=_0x124d03[_0xd4a3('0x21')];var _0x592077=_0xfd502c?0x0:_0x2f96bb[_0xd4a3('0x1f')];var _0x4b8850=_0xfd502c?_0x124d03[_0xd4a3('0x21')]:_0x2f96bb[_0xd4a3('0x1f')]+_0x2f96bb['limit'];var _0x40973a;if(_0x4b8850>=_0x56ab48){_0x4b8850=_0x56ab48;_0x40973a=0xc8;}else{_0x40973a=0xce;}_0x140379[_0xd4a3('0x1d')](_0x40973a);return _0x140379[_0xd4a3('0x22')]('Content-Range',_0x592077+'-'+_0x4b8850+'/'+_0x56ab48)['json'](_0x124d03);}return null;};}function patchUpdates(_0x21efd7){return function(_0x5b2526){try{jsonpatch[_0xd4a3('0x23')](_0x5b2526,_0x21efd7,!![]);}catch(_0x1d7134){return BPromise['reject'](_0x1d7134);}return _0x5b2526['save']();};}function saveUpdates(_0x4f957f,_0x40535d){return function(_0xd558a8){if(_0xd558a8){return _0xd558a8[_0xd4a3('0x24')](_0x4f957f)['then'](function(_0x2de130){return _0x2de130;});}return null;};}function removeEntity(_0x137bba,_0x1a4ced){return function(_0x2e632f){if(_0x2e632f){return _0x2e632f[_0xd4a3('0x25')]()[_0xd4a3('0x26')](function(){_0x137bba['status'](0xcc)[_0xd4a3('0x1e')]();});}};}function handleEntityNotFound(_0x1dea89,_0x50c8ac){return function(_0x2b6cd8){if(!_0x2b6cd8){_0x1dea89[_0xd4a3('0x1c')](0x194);}return _0x2b6cd8;};}function handleError(_0x26cb96,_0x4ce98a){_0x4ce98a=_0x4ce98a||0x1f4;return function(_0x37f09e){logger[_0xd4a3('0x27')](_0x37f09e[_0xd4a3('0x28')]);if(_0x37f09e['name']){delete _0x37f09e[_0xd4a3('0x29')];}_0x26cb96['status'](_0x4ce98a)[_0xd4a3('0x2a')](_0x37f09e);};}exports['index']=function(_0x3019a4,_0x5d84f2){var _0x2769b7={},_0x535ecd={},_0x3e471e={'count':0x0,'rows':[]};var _0x5d1039=_[_0xd4a3('0x2b')](db[_0xd4a3('0x2c')][_0xd4a3('0x2d')],function(_0x318159){return{'name':_0x318159[_0xd4a3('0x2e')],'type':_0x318159['type']['key']};});_0x535ecd[_0xd4a3('0x2f')]=_[_0xd4a3('0x2b')](_0x5d1039,_0xd4a3('0x29'));_0x535ecd[_0xd4a3('0x30')]=_['keys'](_0x3019a4[_0xd4a3('0x30')]);_0x535ecd[_0xd4a3('0x31')]=_['intersection'](_0x535ecd[_0xd4a3('0x2f')],_0x535ecd['query']);_0x2769b7[_0xd4a3('0x32')]=_[_0xd4a3('0x33')](_0x535ecd[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x34')]));_0x2769b7[_0xd4a3('0x32')]=_0x2769b7[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0x2769b7['attributes']:_0x535ecd[_0xd4a3('0x2f')];if(!_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x36')]('nolimit')){_0x2769b7[_0xd4a3('0x37')]=qs[_0xd4a3('0x37')](_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x37')]);_0x2769b7[_0xd4a3('0x1f')]=qs[_0xd4a3('0x1f')](_0x3019a4[_0xd4a3('0x30')]['offset']);}_0x2769b7[_0xd4a3('0x38')]=qs['sort'](_0x3019a4['query'][_0xd4a3('0x39')]);_0x2769b7[_0xd4a3('0x3a')]=qs[_0xd4a3('0x31')](_[_0xd4a3('0x3b')](_0x3019a4['query'],_0x535ecd[_0xd4a3('0x31')]),_0x5d1039);if(_0x3019a4['query'][_0xd4a3('0x3c')]){_0x2769b7[_0xd4a3('0x3a')]=_[_0xd4a3('0x3d')](_0x2769b7[_0xd4a3('0x3a')],{'$or':_['map'](_0x5d1039,function(_0x23c13a){if(_0x23c13a[_0xd4a3('0x3e')]!==_0xd4a3('0x3f')){var _0xa307c5={};_0xa307c5[_0x23c13a['name']]={'$like':'%'+_0x3019a4['query'][_0xd4a3('0x3c')]+'%'};return _0xa307c5;}})});}_0x2769b7=_[_0xd4a3('0x3d')]({},_0x2769b7,_0x3019a4[_0xd4a3('0x40')]);var _0x3c3cb8={'where':_0x2769b7[_0xd4a3('0x3a')]};return db[_0xd4a3('0x2c')][_0xd4a3('0x21')](_0x3c3cb8)['then'](function(_0x55b03c){_0x3e471e[_0xd4a3('0x21')]=_0x55b03c;if(_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x41')]){_0x2769b7[_0xd4a3('0x42')]=[{'all':!![]}];}return db[_0xd4a3('0x2c')][_0xd4a3('0x43')](_0x2769b7);})[_0xd4a3('0x26')](function(_0x27c840){_0x3e471e[_0xd4a3('0x44')]=_0x27c840;return _0x3e471e;})[_0xd4a3('0x26')](respondWithFilteredResult(_0x5d84f2,_0x2769b7))['catch'](handleError(_0x5d84f2,null));};exports[_0xd4a3('0x45')]=function(_0x29955b,_0x6e7362){var _0x40b847={'raw':![],'where':{'id':_0x29955b[_0xd4a3('0x46')]['id']}},_0x48256e={};_0x48256e['model']=_[_0xd4a3('0x47')](db['FreshdeskAccount'][_0xd4a3('0x2d')]);_0x48256e[_0xd4a3('0x30')]=_[_0xd4a3('0x47')](_0x29955b[_0xd4a3('0x30')]);_0x48256e[_0xd4a3('0x31')]=_['intersection'](_0x48256e[_0xd4a3('0x2f')],_0x48256e[_0xd4a3('0x30')]);_0x40b847[_0xd4a3('0x32')]=_['intersection'](_0x48256e[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x29955b['query'][_0xd4a3('0x34')]));_0x40b847[_0xd4a3('0x32')]=_0x40b847[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0x40b847[_0xd4a3('0x32')]:_0x48256e['model'];if(_0x29955b['query'][_0xd4a3('0x41')]){_0x40b847[_0xd4a3('0x42')]=[{'all':!![]}];}_0x40b847=_[_0xd4a3('0x3d')]({},_0x40b847,_0x29955b[_0xd4a3('0x40')]);return db[_0xd4a3('0x2c')][_0xd4a3('0x48')](_0x40b847)[_0xd4a3('0x26')](handleEntityNotFound(_0x6e7362,null))[_0xd4a3('0x26')](respondWithResult(_0x6e7362,null))['catch'](handleError(_0x6e7362,null));};exports[_0xd4a3('0x49')]=function(_0x1ba4b9,_0x52e74e){return db['FreshdeskAccount'][_0xd4a3('0x49')](_0x1ba4b9['body'],{})['then'](respondWithResult(_0x52e74e,0xc9))[_0xd4a3('0x4a')](handleError(_0x52e74e,null));};exports[_0xd4a3('0x24')]=function(_0x1b0051,_0x3f5c3a){if(_0x1b0051[_0xd4a3('0x4b')]['id']){delete _0x1b0051[_0xd4a3('0x4b')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x1b0051['params']['id']}})[_0xd4a3('0x26')](handleEntityNotFound(_0x3f5c3a,null))['then'](saveUpdates(_0x1b0051[_0xd4a3('0x4b')],null))[_0xd4a3('0x26')](respondWithResult(_0x3f5c3a,null))[_0xd4a3('0x4a')](handleError(_0x3f5c3a,null));};exports[_0xd4a3('0x25')]=function(_0x37cdd3,_0x1ec9a3){return db[_0xd4a3('0x2c')]['find']({'where':{'id':_0x37cdd3[_0xd4a3('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ec9a3,null))[_0xd4a3('0x26')](removeEntity(_0x1ec9a3,null))['catch'](handleError(_0x1ec9a3,null));};exports[_0xd4a3('0x4c')]=function(_0x31d2ca,_0x4f5039,_0x347049){var _0xd9ec86={};var _0x4f0db6={};var _0x40087b;var _0x155744;return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x31d2ca[_0xd4a3('0x46')]['id']}})[_0xd4a3('0x26')](handleEntityNotFound(_0x4f5039,null))[_0xd4a3('0x26')](function(_0x4d4491){if(_0x4d4491){_0x40087b=_0x4d4491;_0x4f0db6[_0xd4a3('0x2f')]=_[_0xd4a3('0x47')](db['FreshdeskConfiguration'][_0xd4a3('0x2d')]);_0x4f0db6[_0xd4a3('0x30')]=_[_0xd4a3('0x47')](_0x31d2ca[_0xd4a3('0x30')]);_0x4f0db6[_0xd4a3('0x31')]=_[_0xd4a3('0x33')](_0x4f0db6['model'],_0x4f0db6[_0xd4a3('0x30')]);_0xd9ec86[_0xd4a3('0x32')]=_[_0xd4a3('0x33')](_0x4f0db6[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x34')]));_0xd9ec86[_0xd4a3('0x32')]=_0xd9ec86[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0xd9ec86[_0xd4a3('0x32')]:_0x4f0db6[_0xd4a3('0x2f')];_0xd9ec86[_0xd4a3('0x38')]=qs[_0xd4a3('0x39')](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x39')]);_0xd9ec86[_0xd4a3('0x3a')]=qs[_0xd4a3('0x31')](_['pick'](_0x31d2ca[_0xd4a3('0x30')],_0x4f0db6[_0xd4a3('0x31')]));if(_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x3c')]){_0xd9ec86[_0xd4a3('0x3a')]=_[_0xd4a3('0x3d')](_0xd9ec86[_0xd4a3('0x3a')],{'$or':_['map'](_0xd9ec86['attributes'],function(_0x4293bf){var _0x55edc8={};_0x55edc8[_0x4293bf]={'$like':'%'+_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x3c')]+'%'};return _0x55edc8;})});}_0xd9ec86=_[_0xd4a3('0x3d')]({},_0xd9ec86,_0x31d2ca[_0xd4a3('0x40')]);return _0x40087b[_0xd4a3('0x4c')](_0xd9ec86);}})['then'](function(_0x590c22){if(_0x590c22){_0x155744=_0x590c22[_0xd4a3('0x35')];if(!_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x36')](_0xd4a3('0x4d'))){_0xd9ec86['limit']=qs['limit'](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x37')]);_0xd9ec86[_0xd4a3('0x1f')]=qs['offset'](_0x31d2ca['query']['offset']);}return _0x40087b[_0xd4a3('0x4c')](_0xd9ec86);}})['then'](function(_0x2fc74c){if(_0x2fc74c){return _0x2fc74c?{'count':_0x155744,'rows':_0x2fc74c}:null;}})[_0xd4a3('0x26')](respondWithResult(_0x4f5039,null))[_0xd4a3('0x4a')](handleError(_0x4f5039,null));};exports[_0xd4a3('0x4e')]=function(_0x4b0398,_0x2d152c,_0x4193be){if(_0x4b0398['body']['id']){delete _0x4b0398[_0xd4a3('0x4b')]['id'];}return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x4b0398['params']['id']}})['then'](handleEntityNotFound(_0x2d152c,null))[_0xd4a3('0x26')](function(_0x3b5037){if(_0x3b5037){_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x4f')]=_0x3b5037['id'];_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x50')]=integrations['getSubjects'](_0x4b0398[_0xd4a3('0x4b')]['channel'],_0x4b0398['body']['type']);_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x51')]=integrations[_0xd4a3('0x52')](_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x53')],_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x3e')]);return db['FreshdeskConfiguration'][_0xd4a3('0x49')](_0x4b0398[_0xd4a3('0x4b')],{'include':[{'model':db[_0xd4a3('0x54')],'as':_0xd4a3('0x50')},{'model':db[_0xd4a3('0x54')],'as':_0xd4a3('0x51')}]});}return null;})[_0xd4a3('0x26')](respondWithResult(_0x2d152c,null))[_0xd4a3('0x4a')](handleError(_0x2d152c,null));};exports[_0xd4a3('0x55')]=function(_0x320c05,_0x49f4c5,_0x446d14){var _0x5b688e='';return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x320c05['params']['id']},'attributes':['id','remoteUri',_0xd4a3('0x56')]})[_0xd4a3('0x26')](handleEntityNotFound(_0x49f4c5,null))[_0xd4a3('0x26')](function(_0x5dcb3e){if(_0x5dcb3e){_0x5b688e=_0x5dcb3e[_0xd4a3('0x57')];var _0x524457=_0x5b688e[_0xd4a3('0x58')](-0x1);if(_0x524457==='/'){_0x5b688e=_0x5b688e[_0xd4a3('0x59')](0x0,_0x5b688e[_0xd4a3('0x5a')](_0x524457));}return rp({'method':_0xd4a3('0x5b'),'uri':util['format'](_0xd4a3('0x5c'),_0x5b688e,_0xd4a3('0x5d')),'headers':{'Authorization':util[_0xd4a3('0x5e')](_0xd4a3('0x5f'),new Buffer(util['format']('%s:X',_0x5dcb3e[_0xd4a3('0x56')]))[_0xd4a3('0x60')](_0xd4a3('0x61')))},'json':!![]});}})[_0xd4a3('0x26')](function(_0x4dc642){if(_0x4dc642){var _0x629f2d=['requester','subject',_0xd4a3('0x62'),_0xd4a3('0x63'),_0xd4a3('0x1d'),_0xd4a3('0x64'),_0xd4a3('0x65'),'source','ticket_type','group',_0xd4a3('0x66')];_[_0xd4a3('0x67')](_0x4dc642,function(_0x4e1992){return _0x629f2d[_0xd4a3('0x68')](_0x4e1992[_0xd4a3('0x29')])||!_0x4e1992['default']&&_0x4e1992[_0xd4a3('0x3e')]!==_0xd4a3('0x69')&&_0x4e1992['type']!=='custom_dropdown';});return{'count':_0x4dc642[_0xd4a3('0x35')],'rows':_[_0xd4a3('0x2b')](_0x4dc642,function(_0xd7b2cc){return{'id':_0xd7b2cc['name'],'name':_0xd7b2cc[_0xd4a3('0x6a')],'custom':!_0xd7b2cc[_0xd4a3('0x6b')],'options':_0xd7b2cc[_0xd4a3('0x6c')]?_[_0xd4a3('0x2b')](_0xd7b2cc[_0xd4a3('0x6c')],function(_0x10dd25){return{'name':_[_0xd4a3('0x6d')](_0x10dd25),'value':_0x10dd25};}):[]};})};}})[_0xd4a3('0x26')](respondWithResult(_0x49f4c5,null))[_0xd4a3('0x4a')](function(_0xa7a83b){var _0xb83eff=_0x320c05['query'][_0xd4a3('0x6e')]?0x1f4:_0xa7a83b[_0xd4a3('0x6f')]||0x1f4;logger['error'](_0xd4a3('0x70'),_0xd4a3('0x55'),_0xb83eff,JSON['stringify'](_0xa7a83b));delete _0xa7a83b[_0xd4a3('0x29')];if(_0xb83eff===0x191){_0xb83eff=0x190;}_0x49f4c5[_0xd4a3('0x1d')](_0xb83eff)[_0xd4a3('0x2a')](_0x320c05[_0xd4a3('0x30')][_0xd4a3('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0xa7a83b[_0xd4a3('0x6f')]}:_0xa7a83b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 31e3eb0..47dbca8 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 _0x2250=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0x2250,0x174));var _0x0225=function(_0x48fa3f,_0x700760){_0x48fa3f=_0x48fa3f-0x0;var _0x16037d=_0x2250[_0x48fa3f];return _0x16037d;};'use strict';var _=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var logger=require(_0x0225('0x2'))(_0x0225('0x3'));var moment=require('moment');var BPromise=require(_0x0225('0x4'));var rp=require(_0x0225('0x5'));var fs=require('fs');var path=require(_0x0225('0x6'));var rimraf=require(_0x0225('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0225('0x8')]=function(_0x4f7553,_0x49866d){return _0x4f7553[_0x0225('0x9')](_0x0225('0xa'),attributes,{'tableName':_0x0225('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3204=['lodash','../../config/logger','api','moment','rimraf','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x15d208,_0x41f194){var _0x39049a=function(_0x4cb9d3){while(--_0x4cb9d3){_0x15d208['push'](_0x15d208['shift']());}};_0x39049a(++_0x41f194);}(_0x3204,0x80));var _0x4320=function(_0x2f2830,_0x1f20b4){_0x2f2830=_0x2f2830-0x0;var _0x5e29b0=_0x3204[_0x2f2830];return _0x5e29b0;};'use strict';var _=require(_0x4320('0x0'));var util=require('util');var logger=require(_0x4320('0x1'))(_0x4320('0x2'));var moment=require(_0x4320('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4320('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4bbaf7,_0x37a34d){return _0x4bbaf7[_0x4320('0x5')](_0x4320('0x6'),attributes,{'tableName':_0x4320('0x7'),'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 68f2c90..bd4b8c3 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 _0x3566=['attributes','GetFreshdeskAccount','ShowFreshdeskAccount','raw','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','FreshdeskAccount','findAll','options','where','limit','include','map','model'];(function(_0xf03545,_0x5136e2){var _0x4efc70=function(_0x529c47){while(--_0x529c47){_0xf03545['push'](_0xf03545['shift']());}};_0x4efc70(++_0x5136e2);}(_0x3566,0x159));var _0x6356=function(_0x5d18a1,_0x18de1f){_0x5d18a1=_0x5d18a1-0x0;var _0x521e7e=_0x3566[_0x5d18a1];return _0x521e7e;};'use strict';var _=require(_0x6356('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6356('0x1'));var rs=require(_0x6356('0x2'));var fs=require('fs');var Redis=require(_0x6356('0x3'));var db=require(_0x6356('0x4'))['db'];var utils=require(_0x6356('0x5'));var logger=require('../../config/logger')(_0x6356('0x6'));var config=require('../../config/environment');var jayson=require(_0x6356('0x7'));var client=jayson['client'][_0x6356('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48889d,_0x45c880,_0x4d430f){return new BPromise(function(_0x1dbdbd,_0x4abad8){return client[_0x6356('0x9')](_0x48889d,_0x4d430f)[_0x6356('0xa')](function(_0x32ed64){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x45c880,_0x6356('0xb'));logger[_0x6356('0xc')](_0x6356('0xd'),_0x45c880,_0x6356('0xb'),JSON['stringify'](_0x32ed64));if(_0x32ed64[_0x6356('0xe')]){if(_0x32ed64[_0x6356('0xe')][_0x6356('0xf')]===0x1f4){logger[_0x6356('0xe')](_0x6356('0x10'),_0x45c880,_0x32ed64['error']['message']);return _0x4abad8(_0x32ed64[_0x6356('0xe')]['message']);}logger['error'](_0x6356('0x10'),_0x45c880,_0x32ed64['error'][_0x6356('0x11')]);return _0x1dbdbd(_0x32ed64[_0x6356('0xe')]['message']);}else{logger[_0x6356('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x45c880,_0x6356('0xb'));_0x1dbdbd(_0x32ed64[_0x6356('0x13')]['message']);}})[_0x6356('0x14')](function(_0x12aa6b){logger[_0x6356('0xe')](_0x6356('0x10'),_0x45c880,_0x12aa6b);_0x4abad8(_0x12aa6b);});});}exports['GetFreshdeskAccount']=function(_0x435e4e){var _0x53255c=this;return new Promise(function(_0x4ed75a,_0x64cb1f){return db[_0x6356('0x15')][_0x6356('0x16')]({'raw':_0x435e4e[_0x6356('0x17')]?_0x435e4e[_0x6356('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x435e4e[_0x6356('0x17')]?_0x435e4e[_0x6356('0x17')][_0x6356('0x18')]||null:null,'attributes':_0x435e4e[_0x6356('0x17')]?_0x435e4e[_0x6356('0x17')]['attributes']||null:null,'limit':_0x435e4e['options']?_0x435e4e[_0x6356('0x17')][_0x6356('0x19')]||null:null,'include':_0x435e4e[_0x6356('0x17')]?_0x435e4e[_0x6356('0x17')][_0x6356('0x1a')]?_[_0x6356('0x1b')](_0x435e4e[_0x6356('0x17')]['include'],function(_0x3d6a0b){return{'model':db[_0x3d6a0b[_0x6356('0x1c')]],'as':_0x3d6a0b['as'],'attributes':_0x3d6a0b[_0x6356('0x1d')],'include':_0x3d6a0b['include']?_[_0x6356('0x1b')](_0x3d6a0b[_0x6356('0x1a')],function(_0x205d03){return{'model':db[_0x205d03[_0x6356('0x1c')]],'as':_0x205d03['as'],'attributes':_0x205d03['attributes'],'include':_0x205d03[_0x6356('0x1a')]?_[_0x6356('0x1b')](_0x205d03['include'],function(_0x172281){return{'model':db[_0x172281[_0x6356('0x1c')]],'as':_0x172281['as'],'attributes':_0x172281[_0x6356('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6356('0xa')](function(_0x3ee7fd){logger['info'](_0x6356('0x1e'),_0x435e4e);logger[_0x6356('0xc')](_0x6356('0x1e'),_0x435e4e,JSON['stringify'](_0x3ee7fd));_0x4ed75a(_0x3ee7fd);})[_0x6356('0x14')](function(_0x217c93){logger['error'](_0x6356('0x1e'),_0x217c93['message'],_0x435e4e);_0x64cb1f(_0x53255c[_0x6356('0xe')](0x1f4,_0x217c93[_0x6356('0x11')]));});});};exports[_0x6356('0x1f')]=function(_0x18d458){var _0x372f54=this;return new Promise(function(_0x5d60d2,_0x11f4a0){return db[_0x6356('0x15')]['find']({'raw':_0x18d458['options']?_0x18d458[_0x6356('0x17')][_0x6356('0x20')]===undefined?!![]:![]:!![],'where':_0x18d458[_0x6356('0x17')]?_0x18d458[_0x6356('0x17')][_0x6356('0x18')]||null:null,'attributes':_0x18d458[_0x6356('0x17')]?_0x18d458[_0x6356('0x17')][_0x6356('0x1d')]||null:null,'include':_0x18d458[_0x6356('0x17')]?_0x18d458['options'][_0x6356('0x1a')]?_[_0x6356('0x1b')](_0x18d458[_0x6356('0x17')][_0x6356('0x1a')],function(_0x13033c){return{'model':db[_0x13033c[_0x6356('0x1c')]],'as':_0x13033c['as'],'attributes':_0x13033c[_0x6356('0x1d')],'include':_0x13033c[_0x6356('0x1a')]?_[_0x6356('0x1b')](_0x13033c['include'],function(_0x547110){return{'model':db[_0x547110['model']],'as':_0x547110['as'],'attributes':_0x547110['attributes'],'include':_0x547110[_0x6356('0x1a')]?_[_0x6356('0x1b')](_0x547110[_0x6356('0x1a')],function(_0x257c0d){return{'model':db[_0x257c0d[_0x6356('0x1c')]],'as':_0x257c0d['as'],'attributes':_0x257c0d[_0x6356('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6356('0xa')](function(_0x476e15){logger[_0x6356('0x12')](_0x6356('0x1f'),_0x18d458);logger['debug']('ShowFreshdeskAccount',_0x18d458,JSON[_0x6356('0x21')](_0x476e15));_0x5d60d2(_0x476e15);})[_0x6356('0x14')](function(_0x3efd9f){logger[_0x6356('0xe')]('ShowFreshdeskAccount',_0x3efd9f[_0x6356('0x11')],_0x18d458);_0x11f4a0(_0x372f54[_0x6356('0xe')](0x1f4,_0x3efd9f[_0x6356('0x11')]));});});}; \ No newline at end of file +var _0x91f6=['rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowFreshdeskAccount','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x19d465,_0x3af538){var _0x1ad248=function(_0x1a8dfa){while(--_0x1a8dfa){_0x19d465['push'](_0x19d465['shift']());}};_0x1ad248(++_0x3af538);}(_0x91f6,0x7c));var _0x691f=function(_0x9a17b8,_0x5cc9eb){_0x9a17b8=_0x9a17b8-0x0;var _0x42de9f=_0x91f6[_0x9a17b8];return _0x42de9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x691f('0x0'));var BPromise=require('bluebird');var rs=require(_0x691f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x691f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x691f('0x3'))(_0x691f('0x4'));var config=require(_0x691f('0x5'));var jayson=require(_0x691f('0x6'));var client=jayson['client'][_0x691f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x597103,_0x3d8209,_0x214296){return new BPromise(function(_0x8098e0,_0x3150be){return client['request'](_0x597103,_0x214296)[_0x691f('0x8')](function(_0x38b254){logger[_0x691f('0x9')](_0x691f('0xa'),_0x3d8209,_0x691f('0xb'));logger[_0x691f('0xc')](_0x691f('0xd'),_0x3d8209,_0x691f('0xb'),JSON['stringify'](_0x38b254));if(_0x38b254['error']){if(_0x38b254['error'][_0x691f('0xe')]===0x1f4){logger['error'](_0x691f('0xa'),_0x3d8209,_0x38b254[_0x691f('0xf')][_0x691f('0x10')]);return _0x3150be(_0x38b254['error'][_0x691f('0x10')]);}logger[_0x691f('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x3d8209,_0x38b254[_0x691f('0xf')][_0x691f('0x10')]);return _0x8098e0(_0x38b254[_0x691f('0xf')][_0x691f('0x10')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x3d8209,_0x691f('0xb'));_0x8098e0(_0x38b254['result']['message']);}})[_0x691f('0x11')](function(_0x15bf3d){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3d8209,_0x15bf3d);_0x3150be(_0x15bf3d);});});}exports[_0x691f('0x12')]=function(_0x3cca17){var _0x2ddf65=this;return new Promise(function(_0xc7dd7d,_0x2e07b1){return db[_0x691f('0x13')][_0x691f('0x14')]({'raw':_0x3cca17[_0x691f('0x15')]?_0x3cca17['options'][_0x691f('0x16')]===undefined?!![]:![]:!![],'where':_0x3cca17[_0x691f('0x15')]?_0x3cca17['options'][_0x691f('0x17')]||null:null,'attributes':_0x3cca17['options']?_0x3cca17[_0x691f('0x15')][_0x691f('0x18')]||null:null,'limit':_0x3cca17['options']?_0x3cca17[_0x691f('0x15')][_0x691f('0x19')]||null:null,'include':_0x3cca17[_0x691f('0x15')]?_0x3cca17['options'][_0x691f('0x1a')]?_[_0x691f('0x1b')](_0x3cca17['options'][_0x691f('0x1a')],function(_0x113d00){return{'model':db[_0x113d00[_0x691f('0x1c')]],'as':_0x113d00['as'],'attributes':_0x113d00[_0x691f('0x18')],'include':_0x113d00[_0x691f('0x1a')]?_['map'](_0x113d00[_0x691f('0x1a')],function(_0x5a869f){return{'model':db[_0x5a869f[_0x691f('0x1c')]],'as':_0x5a869f['as'],'attributes':_0x5a869f[_0x691f('0x18')],'include':_0x5a869f[_0x691f('0x1a')]?_[_0x691f('0x1b')](_0x5a869f[_0x691f('0x1a')],function(_0x444549){return{'model':db[_0x444549['model']],'as':_0x444549['as'],'attributes':_0x444549[_0x691f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56a18a){logger['info'](_0x691f('0x12'),_0x3cca17);logger[_0x691f('0xc')](_0x691f('0x12'),_0x3cca17,JSON[_0x691f('0x1d')](_0x56a18a));_0xc7dd7d(_0x56a18a);})[_0x691f('0x11')](function(_0x13f7b4){logger[_0x691f('0xf')](_0x691f('0x12'),_0x13f7b4[_0x691f('0x10')],_0x3cca17);_0x2e07b1(_0x2ddf65[_0x691f('0xf')](0x1f4,_0x13f7b4[_0x691f('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0x2e888e){var _0x345969=this;return new Promise(function(_0x2160a1,_0x3aa55d){return db[_0x691f('0x13')][_0x691f('0x1e')]({'raw':_0x2e888e[_0x691f('0x15')]?_0x2e888e[_0x691f('0x15')][_0x691f('0x16')]===undefined?!![]:![]:!![],'where':_0x2e888e[_0x691f('0x15')]?_0x2e888e[_0x691f('0x15')][_0x691f('0x17')]||null:null,'attributes':_0x2e888e[_0x691f('0x15')]?_0x2e888e['options'][_0x691f('0x18')]||null:null,'include':_0x2e888e[_0x691f('0x15')]?_0x2e888e[_0x691f('0x15')][_0x691f('0x1a')]?_[_0x691f('0x1b')](_0x2e888e[_0x691f('0x15')][_0x691f('0x1a')],function(_0x455bde){return{'model':db[_0x455bde['model']],'as':_0x455bde['as'],'attributes':_0x455bde[_0x691f('0x18')],'include':_0x455bde['include']?_['map'](_0x455bde[_0x691f('0x1a')],function(_0x4c5113){return{'model':db[_0x4c5113[_0x691f('0x1c')]],'as':_0x4c5113['as'],'attributes':_0x4c5113[_0x691f('0x18')],'include':_0x4c5113[_0x691f('0x1a')]?_[_0x691f('0x1b')](_0x4c5113[_0x691f('0x1a')],function(_0x5abc01){return{'model':db[_0x5abc01[_0x691f('0x1c')]],'as':_0x5abc01['as'],'attributes':_0x5abc01[_0x691f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x644b90){logger[_0x691f('0x9')](_0x691f('0x1f'),_0x2e888e);logger['debug']('ShowFreshdeskAccount',_0x2e888e,JSON['stringify'](_0x644b90));_0x2160a1(_0x644b90);})[_0x691f('0x11')](function(_0x258c92){logger[_0x691f('0xf')](_0x691f('0x1f'),_0x258c92['message'],_0x2e888e);_0x3aa55d(_0x345969[_0x691f('0xf')](0x1f4,_0x258c92[_0x691f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c89f5a6..5c2da5a 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 _0xb554=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','update','delete','destroy','exports','multer','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb554,0x178));var _0x4b55=function(_0x5d4e83,_0x19b387){_0x5d4e83=_0x5d4e83-0x0;var _0x5ba82b=_0xb554[_0x5d4e83];return _0x5ba82b;};'use strict';var multer=require(_0x4b55('0x0'));var util=require(_0x4b55('0x1'));var path=require(_0x4b55('0x2'));var timeout=require(_0x4b55('0x3'));var express=require(_0x4b55('0x4'));var router=express[_0x4b55('0x5')]();var fs_extra=require(_0x4b55('0x6'));var auth=require(_0x4b55('0x7'));var interaction=require(_0x4b55('0x8'));var config=require('../../config/environment');var controller=require(_0x4b55('0x9'));router[_0x4b55('0xa')]('/',auth[_0x4b55('0xb')](),controller['index']);router[_0x4b55('0xa')](_0x4b55('0xc'),auth[_0x4b55('0xb')](),controller[_0x4b55('0xd')]);router[_0x4b55('0xa')](_0x4b55('0xe'),auth[_0x4b55('0xb')](),controller['getFields']);router[_0x4b55('0xa')](_0x4b55('0xf'),auth[_0x4b55('0xb')](),controller[_0x4b55('0x10')]);router[_0x4b55('0xa')](_0x4b55('0x11'),auth['isAuthenticated'](),controller[_0x4b55('0x12')]);router[_0x4b55('0xa')](_0x4b55('0x13'),auth['isAuthenticated'](),controller[_0x4b55('0x14')]);router[_0x4b55('0x15')]('/',auth[_0x4b55('0xb')](),controller['create']);router[_0x4b55('0x15')](_0x4b55('0x13'),auth[_0x4b55('0xb')](),controller['setTags']);router[_0x4b55('0x16')](_0x4b55('0xc'),auth[_0x4b55('0xb')](),controller[_0x4b55('0x17')]);router[_0x4b55('0x18')](_0x4b55('0xc'),auth[_0x4b55('0xb')](),controller[_0x4b55('0x19')]);module[_0x4b55('0x1a')]=router; \ No newline at end of file +var _0xf0b5=['show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index'];(function(_0x48b311,_0x39d0bd){var _0x2bd3df=function(_0x31736d){while(--_0x31736d){_0x48b311['push'](_0x48b311['shift']());}};_0x2bd3df(++_0x39d0bd);}(_0xf0b5,0xb7));var _0x5f0b=function(_0x47c6b9,_0x210b3c){_0x47c6b9=_0x47c6b9-0x0;var _0x34f34d=_0xf0b5[_0x47c6b9];return _0x34f34d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5f0b('0x0'));var timeout=require(_0x5f0b('0x1'));var express=require(_0x5f0b('0x2'));var router=express[_0x5f0b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5f0b('0x4'));var config=require('../../config/environment');var controller=require(_0x5f0b('0x5'));router[_0x5f0b('0x6')]('/',auth[_0x5f0b('0x7')](),controller[_0x5f0b('0x8')]);router[_0x5f0b('0x6')]('/:id',auth[_0x5f0b('0x7')](),controller[_0x5f0b('0x9')]);router[_0x5f0b('0x6')]('/:id/fields',auth[_0x5f0b('0x7')](),controller[_0x5f0b('0xa')]);router[_0x5f0b('0x6')](_0x5f0b('0xb'),auth[_0x5f0b('0x7')](),controller['getSubjects']);router[_0x5f0b('0x6')](_0x5f0b('0xc'),auth['isAuthenticated'](),controller[_0x5f0b('0xd')]);router[_0x5f0b('0x6')](_0x5f0b('0xe'),auth[_0x5f0b('0x7')](),controller['getTags']);router[_0x5f0b('0xf')]('/',auth[_0x5f0b('0x7')](),controller[_0x5f0b('0x10')]);router[_0x5f0b('0xf')]('/:id/tags',auth[_0x5f0b('0x7')](),controller[_0x5f0b('0x11')]);router[_0x5f0b('0x12')](_0x5f0b('0x13'),auth[_0x5f0b('0x7')](),controller[_0x5f0b('0x14')]);router[_0x5f0b('0x15')](_0x5f0b('0x13'),auth[_0x5f0b('0x7')](),controller[_0x5f0b('0x16')]);module[_0x5f0b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 026ef6a..a0e3314 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 _0x3791=['STRING','sequelize'];(function(_0x538e2e,_0x5792ef){var _0x3aa76a=function(_0xa03093){while(--_0xa03093){_0x538e2e['push'](_0x538e2e['shift']());}};_0x3aa76a(++_0x5792ef);}(_0x3791,0x1db));var _0x1379=function(_0x4732f7,_0x141fa1){_0x4732f7=_0x4732f7-0x0;var _0x777185=_0x3791[_0x4732f7];return _0x777185;};'use strict';var Sequelize=require(_0x1379('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1379('0x1')]}}; \ No newline at end of file +var _0xeef1=['exports','STRING'];(function(_0x1c2689,_0x5414a0){var _0x5d67cd=function(_0x7537f7){while(--_0x7537f7){_0x1c2689['push'](_0x1c2689['shift']());}};_0x5d67cd(++_0x5414a0);}(_0xeef1,0x78));var _0x1eef=function(_0x22badc,_0x53cd68){_0x22badc=_0x22badc-0x0;var _0x2ad7ba=_0xeef1[_0x22badc];return _0x2ad7ba;};'use strict';var Sequelize=require('sequelize');module[_0x1eef('0x0')]={'name':{'type':Sequelize[_0x1eef('0x1')]},'description':{'type':Sequelize[_0x1eef('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index caedae1..a9d5b24 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 _0xc67c=['rawAttributes','includeAll','find','create','body','catch','getFields','getSubjects','findOne','FreshdeskField','getDescriptions','getTags','setTags','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','FreshdeskConfiguration','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params'];(function(_0x5477d7,_0x16cd92){var _0x304807=function(_0x5711c5){while(--_0x5711c5){_0x5477d7['push'](_0x5477d7['shift']());}};_0x304807(++_0x16cd92);}(_0xc67c,0x1ac));var _0xcc67=function(_0xc1ef4e,_0x2bc5af){_0xc1ef4e=_0xc1ef4e-0x0;var _0x1c5586=_0xc67c[_0xc1ef4e];return _0x1c5586;};'use strict';var emlformat=require(_0xcc67('0x0'));var rimraf=require(_0xcc67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc67('0x2'));var rp=require('request-promise');var moment=require(_0xcc67('0x3'));var BPromise=require(_0xcc67('0x4'));var Mustache=require(_0xcc67('0x5'));var util=require(_0xcc67('0x6'));var path=require(_0xcc67('0x7'));var sox=require(_0xcc67('0x8'));var csv=require(_0xcc67('0x9'));var ejs=require(_0xcc67('0xa'));var fs=require('fs');var fs_extra=require(_0xcc67('0xb'));var _=require(_0xcc67('0xc'));var squel=require(_0xcc67('0xd'));var crypto=require(_0xcc67('0xe'));var jsforce=require(_0xcc67('0xf'));var deskjs=require(_0xcc67('0x10'));var toCsv=require(_0xcc67('0x9'));var querystring=require(_0xcc67('0x11'));var Papa=require(_0xcc67('0x12'));var Redis=require(_0xcc67('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xcc67('0x14'));var as=require(_0xcc67('0x15'));var hardwareService=require(_0xcc67('0x16'));var logger=require(_0xcc67('0x17'))(_0xcc67('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc67('0x19'));var db=require(_0xcc67('0x1a'))['db'];function respondWithStatusCode(_0x417b4c,_0x5eb559){_0x5eb559=_0x5eb559||0xcc;return function(_0x18cc21){if(_0x18cc21){return _0x417b4c['sendStatus'](_0x5eb559);}return _0x417b4c[_0xcc67('0x1b')](_0x5eb559)[_0xcc67('0x1c')]();};}function respondWithResult(_0x20541a,_0x5b11b8){_0x5b11b8=_0x5b11b8||0xc8;return function(_0x24ad70){if(_0x24ad70){return _0x20541a['status'](_0x5b11b8)[_0xcc67('0x1d')](_0x24ad70);}};}function respondWithFilteredResult(_0x32b273,_0x3700c6){return function(_0x61a987){if(_0x61a987){var _0xa5e26b=typeof _0x3700c6[_0xcc67('0x1e')]==='undefined'&&typeof _0x3700c6['limit']==='undefined';var _0x5e3a6f=_0x61a987[_0xcc67('0x1f')];var _0x2f44cf=_0xa5e26b?0x0:_0x3700c6['offset'];var _0x1643a5=_0xa5e26b?_0x61a987[_0xcc67('0x1f')]:_0x3700c6[_0xcc67('0x1e')]+_0x3700c6[_0xcc67('0x20')];var _0x3b21cf;if(_0x1643a5>=_0x5e3a6f){_0x1643a5=_0x5e3a6f;_0x3b21cf=0xc8;}else{_0x3b21cf=0xce;}_0x32b273[_0xcc67('0x1b')](_0x3b21cf);return _0x32b273[_0xcc67('0x21')](_0xcc67('0x22'),_0x2f44cf+'-'+_0x1643a5+'/'+_0x5e3a6f)[_0xcc67('0x1d')](_0x61a987);}return null;};}function patchUpdates(_0x554f61){return function(_0x2f4adc){try{jsonpatch[_0xcc67('0x23')](_0x2f4adc,_0x554f61,!![]);}catch(_0x593353){return BPromise[_0xcc67('0x24')](_0x593353);}return _0x2f4adc['save']();};}function saveUpdates(_0xc1b9fc,_0x40397b){return function(_0x1c8bda){if(_0x1c8bda){return _0x1c8bda[_0xcc67('0x25')](_0xc1b9fc)[_0xcc67('0x26')](function(_0x304ef5){return _0x304ef5;});}return null;};}function removeEntity(_0x396b6c,_0x53a3cb){return function(_0x4750e3){if(_0x4750e3){return _0x4750e3[_0xcc67('0x27')]()[_0xcc67('0x26')](function(){_0x396b6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53f3c6,_0x20894f){return function(_0x52fab5){if(!_0x52fab5){_0x53f3c6[_0xcc67('0x28')](0x194);}return _0x52fab5;};}function handleError(_0xc97cf7,_0x152232){_0x152232=_0x152232||0x1f4;return function(_0x5d8497){logger[_0xcc67('0x29')](_0x5d8497['stack']);if(_0x5d8497[_0xcc67('0x2a')]){delete _0x5d8497['name'];}_0xc97cf7[_0xcc67('0x1b')](_0x152232)[_0xcc67('0x2b')](_0x5d8497);};}exports[_0xcc67('0x2c')]=function(_0x50ebf3,_0x21cf01){var _0x5dfc4a={},_0x31de4d={},_0x486766={'count':0x0,'rows':[]};var _0x477422=_['map'](db[_0xcc67('0x2d')]['rawAttributes'],function(_0x2a5204){return{'name':_0x2a5204[_0xcc67('0x2e')],'type':_0x2a5204[_0xcc67('0x2f')]['key']};});_0x31de4d['model']=_[_0xcc67('0x30')](_0x477422,'name');_0x31de4d[_0xcc67('0x31')]=_[_0xcc67('0x32')](_0x50ebf3[_0xcc67('0x31')]);_0x31de4d[_0xcc67('0x33')]=_[_0xcc67('0x34')](_0x31de4d[_0xcc67('0x35')],_0x31de4d[_0xcc67('0x31')]);_0x5dfc4a[_0xcc67('0x36')]=_[_0xcc67('0x34')](_0x31de4d[_0xcc67('0x35')],qs[_0xcc67('0x37')](_0x50ebf3[_0xcc67('0x31')][_0xcc67('0x37')]));_0x5dfc4a[_0xcc67('0x36')]=_0x5dfc4a['attributes'][_0xcc67('0x38')]?_0x5dfc4a[_0xcc67('0x36')]:_0x31de4d[_0xcc67('0x35')];if(!_0x50ebf3['query'][_0xcc67('0x39')](_0xcc67('0x3a'))){_0x5dfc4a[_0xcc67('0x20')]=qs[_0xcc67('0x20')](_0x50ebf3['query'][_0xcc67('0x20')]);_0x5dfc4a[_0xcc67('0x1e')]=qs[_0xcc67('0x1e')](_0x50ebf3[_0xcc67('0x31')]['offset']);}_0x5dfc4a[_0xcc67('0x3b')]=qs[_0xcc67('0x3c')](_0x50ebf3[_0xcc67('0x31')]['sort']);_0x5dfc4a[_0xcc67('0x3d')]=qs[_0xcc67('0x33')](_[_0xcc67('0x3e')](_0x50ebf3['query'],_0x31de4d[_0xcc67('0x33')]),_0x477422);if(_0x50ebf3[_0xcc67('0x31')][_0xcc67('0x3f')]){_0x5dfc4a[_0xcc67('0x3d')]=_[_0xcc67('0x40')](_0x5dfc4a['where'],{'$or':_[_0xcc67('0x30')](_0x477422,function(_0x13c74f){if(_0x13c74f[_0xcc67('0x2f')]!==_0xcc67('0x41')){var _0x2f114a={};_0x2f114a[_0x13c74f[_0xcc67('0x2a')]]={'$like':'%'+_0x50ebf3[_0xcc67('0x31')][_0xcc67('0x3f')]+'%'};return _0x2f114a;}})});}_0x5dfc4a=_[_0xcc67('0x40')]({},_0x5dfc4a,_0x50ebf3[_0xcc67('0x42')]);var _0x37875c={'where':_0x5dfc4a['where']};return db[_0xcc67('0x2d')][_0xcc67('0x1f')](_0x37875c)[_0xcc67('0x26')](function(_0x440ca4){_0x486766['count']=_0x440ca4;if(_0x50ebf3[_0xcc67('0x31')]['includeAll']){_0x5dfc4a[_0xcc67('0x43')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xcc67('0x44')](_0x5dfc4a);})[_0xcc67('0x26')](function(_0x4451d8){_0x486766['rows']=_0x4451d8;return _0x486766;})[_0xcc67('0x26')](respondWithFilteredResult(_0x21cf01,_0x5dfc4a))['catch'](handleError(_0x21cf01,null));};exports['show']=function(_0x2bcf63,_0x3cde83){var _0x23533e={'raw':![],'where':{'id':_0x2bcf63[_0xcc67('0x45')]['id']}},_0x21fd1e={};_0x21fd1e[_0xcc67('0x35')]=_[_0xcc67('0x32')](db[_0xcc67('0x2d')][_0xcc67('0x46')]);_0x21fd1e[_0xcc67('0x31')]=_[_0xcc67('0x32')](_0x2bcf63[_0xcc67('0x31')]);_0x21fd1e[_0xcc67('0x33')]=_['intersection'](_0x21fd1e[_0xcc67('0x35')],_0x21fd1e[_0xcc67('0x31')]);_0x23533e[_0xcc67('0x36')]=_[_0xcc67('0x34')](_0x21fd1e[_0xcc67('0x35')],qs[_0xcc67('0x37')](_0x2bcf63[_0xcc67('0x31')][_0xcc67('0x37')]));_0x23533e['attributes']=_0x23533e[_0xcc67('0x36')]['length']?_0x23533e[_0xcc67('0x36')]:_0x21fd1e[_0xcc67('0x35')];if(_0x2bcf63[_0xcc67('0x31')][_0xcc67('0x47')]){_0x23533e[_0xcc67('0x43')]=[{'all':!![]}];}_0x23533e=_[_0xcc67('0x40')]({},_0x23533e,_0x2bcf63['options']);return db[_0xcc67('0x2d')][_0xcc67('0x48')](_0x23533e)[_0xcc67('0x26')](handleEntityNotFound(_0x3cde83,null))[_0xcc67('0x26')](respondWithResult(_0x3cde83,null))['catch'](handleError(_0x3cde83,null));};exports[_0xcc67('0x49')]=function(_0x9b2f32,_0x56216e){return db[_0xcc67('0x2d')]['create'](_0x9b2f32[_0xcc67('0x4a')],{})['then'](respondWithResult(_0x56216e,0xc9))[_0xcc67('0x4b')](handleError(_0x56216e,null));};exports[_0xcc67('0x25')]=function(_0x5c4b30,_0x4b5b5a){if(_0x5c4b30[_0xcc67('0x4a')]['id']){delete _0x5c4b30[_0xcc67('0x4a')]['id'];}return db[_0xcc67('0x2d')][_0xcc67('0x48')]({'where':{'id':_0x5c4b30[_0xcc67('0x45')]['id']}})[_0xcc67('0x26')](handleEntityNotFound(_0x4b5b5a,null))[_0xcc67('0x26')](saveUpdates(_0x5c4b30[_0xcc67('0x4a')],null))[_0xcc67('0x26')](respondWithResult(_0x4b5b5a,null))[_0xcc67('0x4b')](handleError(_0x4b5b5a,null));};exports[_0xcc67('0x27')]=function(_0x4a3763,_0x2c93ef){return db[_0xcc67('0x2d')][_0xcc67('0x48')]({'where':{'id':_0x4a3763[_0xcc67('0x45')]['id']}})[_0xcc67('0x26')](handleEntityNotFound(_0x2c93ef,null))[_0xcc67('0x26')](removeEntity(_0x2c93ef,null))[_0xcc67('0x4b')](handleError(_0x2c93ef,null));};exports[_0xcc67('0x4c')]=function(_0x7eaa59,_0x4a7019,_0x2b700b){var _0x1e09d6={};var _0x1f95a1={};var _0x30a4cd;var _0x4ef5f0;return db[_0xcc67('0x2d')]['findOne']({'where':{'id':_0x7eaa59[_0xcc67('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a7019,null))[_0xcc67('0x26')](function(_0x5bbc4d){if(_0x5bbc4d){_0x30a4cd=_0x5bbc4d;_0x1f95a1[_0xcc67('0x35')]=_['keys'](db['FreshdeskField'][_0xcc67('0x46')]);_0x1f95a1[_0xcc67('0x31')]=_[_0xcc67('0x32')](_0x7eaa59['query']);_0x1f95a1[_0xcc67('0x33')]=_[_0xcc67('0x34')](_0x1f95a1[_0xcc67('0x35')],_0x1f95a1[_0xcc67('0x31')]);_0x1e09d6[_0xcc67('0x36')]=_[_0xcc67('0x34')](_0x1f95a1['model'],qs['fields'](_0x7eaa59['query'][_0xcc67('0x37')]));_0x1e09d6[_0xcc67('0x36')]=_0x1e09d6[_0xcc67('0x36')][_0xcc67('0x38')]?_0x1e09d6[_0xcc67('0x36')]:_0x1f95a1[_0xcc67('0x35')];_0x1e09d6[_0xcc67('0x3b')]=qs[_0xcc67('0x3c')](_0x7eaa59[_0xcc67('0x31')][_0xcc67('0x3c')]);_0x1e09d6[_0xcc67('0x3d')]=qs[_0xcc67('0x33')](_['pick'](_0x7eaa59['query'],_0x1f95a1[_0xcc67('0x33')]));if(_0x7eaa59[_0xcc67('0x31')][_0xcc67('0x3f')]){_0x1e09d6[_0xcc67('0x3d')]=_['merge'](_0x1e09d6['where'],{'$or':_[_0xcc67('0x30')](_0x1e09d6[_0xcc67('0x36')],function(_0x21b614){var _0x242438={};_0x242438[_0x21b614]={'$like':'%'+_0x7eaa59['query']['filter']+'%'};return _0x242438;})});}_0x1e09d6=_[_0xcc67('0x40')]({},_0x1e09d6,_0x7eaa59[_0xcc67('0x42')]);return _0x30a4cd['getFields'](_0x1e09d6);}})['then'](function(_0x5e1535){if(_0x5e1535){_0x4ef5f0=_0x5e1535[_0xcc67('0x38')];if(!_0x7eaa59['query'][_0xcc67('0x39')](_0xcc67('0x3a'))){_0x1e09d6[_0xcc67('0x20')]=qs[_0xcc67('0x20')](_0x7eaa59[_0xcc67('0x31')][_0xcc67('0x20')]);_0x1e09d6[_0xcc67('0x1e')]=qs[_0xcc67('0x1e')](_0x7eaa59['query'][_0xcc67('0x1e')]);}return _0x30a4cd[_0xcc67('0x4c')](_0x1e09d6);}})[_0xcc67('0x26')](function(_0x2e49a9){if(_0x2e49a9){return _0x2e49a9?{'count':_0x4ef5f0,'rows':_0x2e49a9}:null;}})[_0xcc67('0x26')](respondWithResult(_0x4a7019,null))[_0xcc67('0x4b')](handleError(_0x4a7019,null));};exports[_0xcc67('0x4d')]=function(_0x522b15,_0x3b5454,_0x4c5ba1){var _0x47759f={};var _0x26a075={};var _0x3d53bb;var _0x206d55;return db['FreshdeskConfiguration'][_0xcc67('0x4e')]({'where':{'id':_0x522b15['params']['id']}})[_0xcc67('0x26')](handleEntityNotFound(_0x3b5454,null))[_0xcc67('0x26')](function(_0x187441){if(_0x187441){_0x3d53bb=_0x187441;_0x26a075[_0xcc67('0x35')]=_[_0xcc67('0x32')](db[_0xcc67('0x4f')]['rawAttributes']);_0x26a075[_0xcc67('0x31')]=_[_0xcc67('0x32')](_0x522b15['query']);_0x26a075[_0xcc67('0x33')]=_[_0xcc67('0x34')](_0x26a075[_0xcc67('0x35')],_0x26a075[_0xcc67('0x31')]);_0x47759f[_0xcc67('0x36')]=_[_0xcc67('0x34')](_0x26a075[_0xcc67('0x35')],qs[_0xcc67('0x37')](_0x522b15[_0xcc67('0x31')]['fields']));_0x47759f[_0xcc67('0x36')]=_0x47759f[_0xcc67('0x36')]['length']?_0x47759f[_0xcc67('0x36')]:_0x26a075[_0xcc67('0x35')];_0x47759f[_0xcc67('0x3b')]=qs[_0xcc67('0x3c')](_0x522b15[_0xcc67('0x31')]['sort']);_0x47759f[_0xcc67('0x3d')]=qs[_0xcc67('0x33')](_['pick'](_0x522b15[_0xcc67('0x31')],_0x26a075[_0xcc67('0x33')]));if(_0x522b15[_0xcc67('0x31')][_0xcc67('0x3f')]){_0x47759f[_0xcc67('0x3d')]=_[_0xcc67('0x40')](_0x47759f[_0xcc67('0x3d')],{'$or':_[_0xcc67('0x30')](_0x47759f[_0xcc67('0x36')],function(_0x50f920){var _0x111258={};_0x111258[_0x50f920]={'$like':'%'+_0x522b15[_0xcc67('0x31')]['filter']+'%'};return _0x111258;})});}_0x47759f=_[_0xcc67('0x40')]({},_0x47759f,_0x522b15[_0xcc67('0x42')]);return _0x3d53bb[_0xcc67('0x4d')](_0x47759f);}})[_0xcc67('0x26')](function(_0x13aedc){if(_0x13aedc){_0x206d55=_0x13aedc['length'];if(!_0x522b15[_0xcc67('0x31')][_0xcc67('0x39')](_0xcc67('0x3a'))){_0x47759f[_0xcc67('0x20')]=qs[_0xcc67('0x20')](_0x522b15['query'][_0xcc67('0x20')]);_0x47759f[_0xcc67('0x1e')]=qs[_0xcc67('0x1e')](_0x522b15[_0xcc67('0x31')][_0xcc67('0x1e')]);}return _0x3d53bb[_0xcc67('0x4d')](_0x47759f);}})[_0xcc67('0x26')](function(_0x587f1c){if(_0x587f1c){return _0x587f1c?{'count':_0x206d55,'rows':_0x587f1c}:null;}})[_0xcc67('0x26')](respondWithResult(_0x3b5454,null))[_0xcc67('0x4b')](handleError(_0x3b5454,null));};exports[_0xcc67('0x50')]=function(_0x28158b,_0x11f9f2,_0x4a5971){var _0x5c7b63={};var _0x56055b={};var _0x33dff9;var _0x5b1811;return db[_0xcc67('0x2d')]['findOne']({'where':{'id':_0x28158b['params']['id']}})[_0xcc67('0x26')](handleEntityNotFound(_0x11f9f2,null))[_0xcc67('0x26')](function(_0xfa88df){if(_0xfa88df){_0x33dff9=_0xfa88df;_0x56055b[_0xcc67('0x35')]=_['keys'](db[_0xcc67('0x4f')][_0xcc67('0x46')]);_0x56055b[_0xcc67('0x31')]=_[_0xcc67('0x32')](_0x28158b[_0xcc67('0x31')]);_0x56055b[_0xcc67('0x33')]=_[_0xcc67('0x34')](_0x56055b['model'],_0x56055b[_0xcc67('0x31')]);_0x5c7b63[_0xcc67('0x36')]=_[_0xcc67('0x34')](_0x56055b[_0xcc67('0x35')],qs['fields'](_0x28158b[_0xcc67('0x31')]['fields']));_0x5c7b63[_0xcc67('0x36')]=_0x5c7b63[_0xcc67('0x36')][_0xcc67('0x38')]?_0x5c7b63[_0xcc67('0x36')]:_0x56055b[_0xcc67('0x35')];_0x5c7b63[_0xcc67('0x3b')]=qs[_0xcc67('0x3c')](_0x28158b['query'][_0xcc67('0x3c')]);_0x5c7b63['where']=qs[_0xcc67('0x33')](_[_0xcc67('0x3e')](_0x28158b['query'],_0x56055b[_0xcc67('0x33')]));if(_0x28158b['query']['filter']){_0x5c7b63[_0xcc67('0x3d')]=_[_0xcc67('0x40')](_0x5c7b63['where'],{'$or':_[_0xcc67('0x30')](_0x5c7b63[_0xcc67('0x36')],function(_0x42caea){var _0x208dbf={};_0x208dbf[_0x42caea]={'$like':'%'+_0x28158b[_0xcc67('0x31')][_0xcc67('0x3f')]+'%'};return _0x208dbf;})});}_0x5c7b63=_['merge']({},_0x5c7b63,_0x28158b['options']);return _0x33dff9[_0xcc67('0x50')](_0x5c7b63);}})['then'](function(_0x4a0818){if(_0x4a0818){_0x5b1811=_0x4a0818[_0xcc67('0x38')];if(!_0x28158b[_0xcc67('0x31')][_0xcc67('0x39')]('nolimit')){_0x5c7b63[_0xcc67('0x20')]=qs['limit'](_0x28158b[_0xcc67('0x31')][_0xcc67('0x20')]);_0x5c7b63[_0xcc67('0x1e')]=qs[_0xcc67('0x1e')](_0x28158b[_0xcc67('0x31')][_0xcc67('0x1e')]);}return _0x33dff9[_0xcc67('0x50')](_0x5c7b63);}})['then'](function(_0x4f70f2){if(_0x4f70f2){return _0x4f70f2?{'count':_0x5b1811,'rows':_0x4f70f2}:null;}})[_0xcc67('0x26')](respondWithResult(_0x11f9f2,null))[_0xcc67('0x4b')](handleError(_0x11f9f2,null));};exports[_0xcc67('0x51')]=function(_0x470a5a,_0x51d0a0,_0x35b7d2){var _0x571e66={};var _0x42a644={};var _0x676ce8;var _0x28d312;return db['FreshdeskConfiguration'][_0xcc67('0x4e')]({'where':{'id':_0x470a5a[_0xcc67('0x45')]['id']}})[_0xcc67('0x26')](handleEntityNotFound(_0x51d0a0,null))[_0xcc67('0x26')](function(_0x3b4b73){if(_0x3b4b73){_0x676ce8=_0x3b4b73;_0x42a644['model']=_[_0xcc67('0x32')](db['Tag']['rawAttributes']);_0x42a644['query']=_[_0xcc67('0x32')](_0x470a5a[_0xcc67('0x31')]);_0x42a644['filters']=_['intersection'](_0x42a644[_0xcc67('0x35')],_0x42a644[_0xcc67('0x31')]);_0x571e66[_0xcc67('0x36')]=_['intersection'](_0x42a644[_0xcc67('0x35')],qs[_0xcc67('0x37')](_0x470a5a[_0xcc67('0x31')]['fields']));_0x571e66['attributes']=_0x571e66['attributes'][_0xcc67('0x38')]?_0x571e66['attributes']:_0x42a644['model'];_0x571e66[_0xcc67('0x3b')]=qs['sort'](_0x470a5a[_0xcc67('0x31')][_0xcc67('0x3c')]);_0x571e66[_0xcc67('0x3d')]=qs[_0xcc67('0x33')](_[_0xcc67('0x3e')](_0x470a5a[_0xcc67('0x31')],_0x42a644[_0xcc67('0x33')]));if(_0x470a5a[_0xcc67('0x31')][_0xcc67('0x3f')]){_0x571e66['where']=_[_0xcc67('0x40')](_0x571e66[_0xcc67('0x3d')],{'$or':_[_0xcc67('0x30')](_0x571e66[_0xcc67('0x36')],function(_0x3059cb){var _0x2bc851={};_0x2bc851[_0x3059cb]={'$like':'%'+_0x470a5a[_0xcc67('0x31')]['filter']+'%'};return _0x2bc851;})});}_0x571e66=_['merge']({},_0x571e66,_0x470a5a[_0xcc67('0x42')]);return _0x676ce8[_0xcc67('0x51')](_0x571e66);}})['then'](function(_0x5bfc69){if(_0x5bfc69){_0x28d312=_0x5bfc69[_0xcc67('0x38')];if(!_0x470a5a['query']['hasOwnProperty']('nolimit')){_0x571e66[_0xcc67('0x20')]=qs['limit'](_0x470a5a[_0xcc67('0x31')][_0xcc67('0x20')]);_0x571e66[_0xcc67('0x1e')]=qs[_0xcc67('0x1e')](_0x470a5a[_0xcc67('0x31')][_0xcc67('0x1e')]);}return _0x676ce8[_0xcc67('0x51')](_0x571e66);}})['then'](function(_0x2f1582){if(_0x2f1582){return _0x2f1582?{'count':_0x28d312,'rows':_0x2f1582}:null;}})[_0xcc67('0x26')](respondWithResult(_0x51d0a0,null))['catch'](handleError(_0x51d0a0,null));};exports[_0xcc67('0x52')]=function(_0x5e1e1c,_0xf49f7a,_0x2a5d76){if(_0x5e1e1c[_0xcc67('0x4a')]['id']){delete _0x5e1e1c[_0xcc67('0x4a')]['id'];}return db[_0xcc67('0x2d')]['findOne']({'where':{'id':_0x5e1e1c['params']['id']}})[_0xcc67('0x26')](handleEntityNotFound(_0xf49f7a,null))[_0xcc67('0x26')](function(_0x7279a3){if(_0x7279a3){return _0x7279a3[_0xcc67('0x52')](_0x5e1e1c[_0xcc67('0x4a')]['ids']||[]);}return null;})['then'](respondWithResult(_0xf49f7a,null))['catch'](handleError(_0xf49f7a,null));}; \ No newline at end of file +var _0x98cd=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','map','type','VIRTUAL','options','FreshdeskConfiguration','include','catch','show','params','includeAll','merge','find','create','body','update','getFields','findOne','FreshdeskField','order','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf'];(function(_0x2ae0a7,_0x39bd10){var _0xcfb336=function(_0x173a8b){while(--_0x173a8b){_0x2ae0a7['push'](_0x2ae0a7['shift']());}};_0xcfb336(++_0x39bd10);}(_0x98cd,0xac));var _0xd98c=function(_0x48f977,_0x144730){_0x48f977=_0x48f977-0x0;var _0x1352c2=_0x98cd[_0x48f977];return _0x1352c2;};'use strict';var emlformat=require(_0xd98c('0x0'));var rimraf=require(_0xd98c('0x1'));var zipdir=require(_0xd98c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd98c('0x3'));var moment=require(_0xd98c('0x4'));var BPromise=require(_0xd98c('0x5'));var Mustache=require(_0xd98c('0x6'));var util=require(_0xd98c('0x7'));var path=require(_0xd98c('0x8'));var sox=require(_0xd98c('0x9'));var csv=require(_0xd98c('0xa'));var ejs=require(_0xd98c('0xb'));var fs=require('fs');var fs_extra=require(_0xd98c('0xc'));var _=require(_0xd98c('0xd'));var squel=require(_0xd98c('0xe'));var crypto=require(_0xd98c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd98c('0x10'));var toCsv=require(_0xd98c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd98c('0x11'));var authService=require(_0xd98c('0x12'));var qs=require(_0xd98c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd98c('0x14'));var logger=require(_0xd98c('0x15'))(_0xd98c('0x16'));var utils=require(_0xd98c('0x17'));var config=require(_0xd98c('0x18'));var licenseUtil=require(_0xd98c('0x19'));var db=require(_0xd98c('0x1a'))['db'];function respondWithStatusCode(_0x2a8dc5,_0x4a05a0){_0x4a05a0=_0x4a05a0||0xcc;return function(_0x2fe66a){if(_0x2fe66a){return _0x2a8dc5[_0xd98c('0x1b')](_0x4a05a0);}return _0x2a8dc5[_0xd98c('0x1c')](_0x4a05a0)['end']();};}function respondWithResult(_0x5144a8,_0x207808){_0x207808=_0x207808||0xc8;return function(_0x23320d){if(_0x23320d){return _0x5144a8['status'](_0x207808)[_0xd98c('0x1d')](_0x23320d);}};}function respondWithFilteredResult(_0x4cd908,_0x7f8824){return function(_0x39a3a7){if(_0x39a3a7){var _0x8a41a0=typeof _0x7f8824[_0xd98c('0x1e')]===_0xd98c('0x1f')&&typeof _0x7f8824[_0xd98c('0x20')]==='undefined';var _0x16a262=_0x39a3a7[_0xd98c('0x21')];var _0x2e7cbf=_0x8a41a0?0x0:_0x7f8824[_0xd98c('0x1e')];var _0x591b44=_0x8a41a0?_0x39a3a7['count']:_0x7f8824[_0xd98c('0x1e')]+_0x7f8824[_0xd98c('0x20')];var _0x370b25;if(_0x591b44>=_0x16a262){_0x591b44=_0x16a262;_0x370b25=0xc8;}else{_0x370b25=0xce;}_0x4cd908['status'](_0x370b25);return _0x4cd908[_0xd98c('0x22')](_0xd98c('0x23'),_0x2e7cbf+'-'+_0x591b44+'/'+_0x16a262)[_0xd98c('0x1d')](_0x39a3a7);}return null;};}function patchUpdates(_0x44b0c2){return function(_0x380706){try{jsonpatch[_0xd98c('0x24')](_0x380706,_0x44b0c2,!![]);}catch(_0x5a47c1){return BPromise[_0xd98c('0x25')](_0x5a47c1);}return _0x380706[_0xd98c('0x26')]();};}function saveUpdates(_0x5dbde9,_0x6f0958){return function(_0x2b4be2){if(_0x2b4be2){return _0x2b4be2['update'](_0x5dbde9)['then'](function(_0x23f884){return _0x23f884;});}return null;};}function removeEntity(_0x4ed099,_0x5abed6){return function(_0xead5f5){if(_0xead5f5){return _0xead5f5[_0xd98c('0x27')]()[_0xd98c('0x28')](function(){_0x4ed099[_0xd98c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x316660,_0x121f7a){return function(_0x2463c1){if(!_0x2463c1){_0x316660[_0xd98c('0x1b')](0x194);}return _0x2463c1;};}function handleError(_0x9918ab,_0x2b2694){_0x2b2694=_0x2b2694||0x1f4;return function(_0x3b20fb){logger['error'](_0x3b20fb[_0xd98c('0x29')]);if(_0x3b20fb[_0xd98c('0x2a')]){delete _0x3b20fb[_0xd98c('0x2a')];}_0x9918ab['status'](_0x2b2694)[_0xd98c('0x2b')](_0x3b20fb);};}exports[_0xd98c('0x2c')]=function(_0x37c7ec,_0x62723b){var _0x55dfcd={},_0x21c614={},_0x3982f8={'count':0x0,'rows':[]};var _0x5be6d1=_['map'](db['FreshdeskConfiguration'][_0xd98c('0x2d')],function(_0x2bdd27){return{'name':_0x2bdd27[_0xd98c('0x2e')],'type':_0x2bdd27['type'][_0xd98c('0x2f')]};});_0x21c614[_0xd98c('0x30')]=_['map'](_0x5be6d1,_0xd98c('0x2a'));_0x21c614[_0xd98c('0x31')]=_[_0xd98c('0x32')](_0x37c7ec['query']);_0x21c614['filters']=_['intersection'](_0x21c614[_0xd98c('0x30')],_0x21c614['query']);_0x55dfcd[_0xd98c('0x33')]=_[_0xd98c('0x34')](_0x21c614[_0xd98c('0x30')],qs['fields'](_0x37c7ec[_0xd98c('0x31')][_0xd98c('0x35')]));_0x55dfcd[_0xd98c('0x33')]=_0x55dfcd[_0xd98c('0x33')][_0xd98c('0x36')]?_0x55dfcd[_0xd98c('0x33')]:_0x21c614[_0xd98c('0x30')];if(!_0x37c7ec['query'][_0xd98c('0x37')](_0xd98c('0x38'))){_0x55dfcd[_0xd98c('0x20')]=qs['limit'](_0x37c7ec[_0xd98c('0x31')][_0xd98c('0x20')]);_0x55dfcd[_0xd98c('0x1e')]=qs[_0xd98c('0x1e')](_0x37c7ec[_0xd98c('0x31')][_0xd98c('0x1e')]);}_0x55dfcd['order']=qs[_0xd98c('0x39')](_0x37c7ec[_0xd98c('0x31')][_0xd98c('0x39')]);_0x55dfcd['where']=qs[_0xd98c('0x3a')](_['pick'](_0x37c7ec[_0xd98c('0x31')],_0x21c614[_0xd98c('0x3a')]),_0x5be6d1);if(_0x37c7ec['query'][_0xd98c('0x3b')]){_0x55dfcd[_0xd98c('0x3c')]=_['merge'](_0x55dfcd[_0xd98c('0x3c')],{'$or':_[_0xd98c('0x3d')](_0x5be6d1,function(_0x5b2787){if(_0x5b2787[_0xd98c('0x3e')]!==_0xd98c('0x3f')){var _0x31dddd={};_0x31dddd[_0x5b2787[_0xd98c('0x2a')]]={'$like':'%'+_0x37c7ec['query']['filter']+'%'};return _0x31dddd;}})});}_0x55dfcd=_['merge']({},_0x55dfcd,_0x37c7ec[_0xd98c('0x40')]);var _0x2b1b49={'where':_0x55dfcd[_0xd98c('0x3c')]};return db[_0xd98c('0x41')][_0xd98c('0x21')](_0x2b1b49)[_0xd98c('0x28')](function(_0x43dfdd){_0x3982f8[_0xd98c('0x21')]=_0x43dfdd;if(_0x37c7ec[_0xd98c('0x31')]['includeAll']){_0x55dfcd[_0xd98c('0x42')]=[{'all':!![]}];}return db[_0xd98c('0x41')]['findAll'](_0x55dfcd);})[_0xd98c('0x28')](function(_0x5db339){_0x3982f8['rows']=_0x5db339;return _0x3982f8;})[_0xd98c('0x28')](respondWithFilteredResult(_0x62723b,_0x55dfcd))[_0xd98c('0x43')](handleError(_0x62723b,null));};exports[_0xd98c('0x44')]=function(_0x1421d8,_0x5c6b63){var _0x2546b9={'raw':![],'where':{'id':_0x1421d8[_0xd98c('0x45')]['id']}},_0x16f617={};_0x16f617[_0xd98c('0x30')]=_['keys'](db[_0xd98c('0x41')]['rawAttributes']);_0x16f617[_0xd98c('0x31')]=_[_0xd98c('0x32')](_0x1421d8['query']);_0x16f617[_0xd98c('0x3a')]=_[_0xd98c('0x34')](_0x16f617[_0xd98c('0x30')],_0x16f617['query']);_0x2546b9[_0xd98c('0x33')]=_[_0xd98c('0x34')](_0x16f617[_0xd98c('0x30')],qs[_0xd98c('0x35')](_0x1421d8[_0xd98c('0x31')]['fields']));_0x2546b9[_0xd98c('0x33')]=_0x2546b9[_0xd98c('0x33')][_0xd98c('0x36')]?_0x2546b9[_0xd98c('0x33')]:_0x16f617['model'];if(_0x1421d8[_0xd98c('0x31')][_0xd98c('0x46')]){_0x2546b9[_0xd98c('0x42')]=[{'all':!![]}];}_0x2546b9=_[_0xd98c('0x47')]({},_0x2546b9,_0x1421d8['options']);return db[_0xd98c('0x41')][_0xd98c('0x48')](_0x2546b9)['then'](handleEntityNotFound(_0x5c6b63,null))[_0xd98c('0x28')](respondWithResult(_0x5c6b63,null))['catch'](handleError(_0x5c6b63,null));};exports[_0xd98c('0x49')]=function(_0x572268,_0x415969){return db[_0xd98c('0x41')][_0xd98c('0x49')](_0x572268[_0xd98c('0x4a')],{})[_0xd98c('0x28')](respondWithResult(_0x415969,0xc9))[_0xd98c('0x43')](handleError(_0x415969,null));};exports[_0xd98c('0x4b')]=function(_0x854bfc,_0x41d333){if(_0x854bfc['body']['id']){delete _0x854bfc[_0xd98c('0x4a')]['id'];}return db[_0xd98c('0x41')][_0xd98c('0x48')]({'where':{'id':_0x854bfc[_0xd98c('0x45')]['id']}})['then'](handleEntityNotFound(_0x41d333,null))[_0xd98c('0x28')](saveUpdates(_0x854bfc[_0xd98c('0x4a')],null))[_0xd98c('0x28')](respondWithResult(_0x41d333,null))[_0xd98c('0x43')](handleError(_0x41d333,null));};exports['destroy']=function(_0x2ea904,_0x23008b){return db['FreshdeskConfiguration'][_0xd98c('0x48')]({'where':{'id':_0x2ea904[_0xd98c('0x45')]['id']}})[_0xd98c('0x28')](handleEntityNotFound(_0x23008b,null))['then'](removeEntity(_0x23008b,null))[_0xd98c('0x43')](handleError(_0x23008b,null));};exports[_0xd98c('0x4c')]=function(_0x7822b,_0x30172d,_0x26fb0f){var _0x2a7207={};var _0x5984b6={};var _0x427442;var _0x25591e;return db['FreshdeskConfiguration'][_0xd98c('0x4d')]({'where':{'id':_0x7822b[_0xd98c('0x45')]['id']}})[_0xd98c('0x28')](handleEntityNotFound(_0x30172d,null))[_0xd98c('0x28')](function(_0x389884){if(_0x389884){_0x427442=_0x389884;_0x5984b6[_0xd98c('0x30')]=_[_0xd98c('0x32')](db[_0xd98c('0x4e')]['rawAttributes']);_0x5984b6[_0xd98c('0x31')]=_[_0xd98c('0x32')](_0x7822b[_0xd98c('0x31')]);_0x5984b6[_0xd98c('0x3a')]=_[_0xd98c('0x34')](_0x5984b6[_0xd98c('0x30')],_0x5984b6[_0xd98c('0x31')]);_0x2a7207[_0xd98c('0x33')]=_['intersection'](_0x5984b6[_0xd98c('0x30')],qs['fields'](_0x7822b[_0xd98c('0x31')]['fields']));_0x2a7207[_0xd98c('0x33')]=_0x2a7207[_0xd98c('0x33')][_0xd98c('0x36')]?_0x2a7207[_0xd98c('0x33')]:_0x5984b6[_0xd98c('0x30')];_0x2a7207[_0xd98c('0x4f')]=qs['sort'](_0x7822b['query'][_0xd98c('0x39')]);_0x2a7207[_0xd98c('0x3c')]=qs[_0xd98c('0x3a')](_['pick'](_0x7822b[_0xd98c('0x31')],_0x5984b6['filters']));if(_0x7822b[_0xd98c('0x31')][_0xd98c('0x3b')]){_0x2a7207[_0xd98c('0x3c')]=_[_0xd98c('0x47')](_0x2a7207[_0xd98c('0x3c')],{'$or':_[_0xd98c('0x3d')](_0x2a7207[_0xd98c('0x33')],function(_0x14a0ca){var _0x5f0605={};_0x5f0605[_0x14a0ca]={'$like':'%'+_0x7822b['query'][_0xd98c('0x3b')]+'%'};return _0x5f0605;})});}_0x2a7207=_[_0xd98c('0x47')]({},_0x2a7207,_0x7822b[_0xd98c('0x40')]);return _0x427442[_0xd98c('0x4c')](_0x2a7207);}})[_0xd98c('0x28')](function(_0x33bffd){if(_0x33bffd){_0x25591e=_0x33bffd[_0xd98c('0x36')];if(!_0x7822b[_0xd98c('0x31')][_0xd98c('0x37')](_0xd98c('0x38'))){_0x2a7207['limit']=qs[_0xd98c('0x20')](_0x7822b[_0xd98c('0x31')][_0xd98c('0x20')]);_0x2a7207[_0xd98c('0x1e')]=qs[_0xd98c('0x1e')](_0x7822b['query']['offset']);}return _0x427442[_0xd98c('0x4c')](_0x2a7207);}})[_0xd98c('0x28')](function(_0x30579a){if(_0x30579a){return _0x30579a?{'count':_0x25591e,'rows':_0x30579a}:null;}})['then'](respondWithResult(_0x30172d,null))[_0xd98c('0x43')](handleError(_0x30172d,null));};exports[_0xd98c('0x50')]=function(_0xc7ace1,_0x40f46a,_0x28de3c){var _0x310fe1={};var _0x1db20b={};var _0x3c911b;var _0x4ba0b2;return db[_0xd98c('0x41')][_0xd98c('0x4d')]({'where':{'id':_0xc7ace1[_0xd98c('0x45')]['id']}})[_0xd98c('0x28')](handleEntityNotFound(_0x40f46a,null))[_0xd98c('0x28')](function(_0x1dee0d){if(_0x1dee0d){_0x3c911b=_0x1dee0d;_0x1db20b['model']=_[_0xd98c('0x32')](db[_0xd98c('0x4e')][_0xd98c('0x2d')]);_0x1db20b[_0xd98c('0x31')]=_[_0xd98c('0x32')](_0xc7ace1[_0xd98c('0x31')]);_0x1db20b[_0xd98c('0x3a')]=_[_0xd98c('0x34')](_0x1db20b[_0xd98c('0x30')],_0x1db20b[_0xd98c('0x31')]);_0x310fe1['attributes']=_[_0xd98c('0x34')](_0x1db20b['model'],qs[_0xd98c('0x35')](_0xc7ace1[_0xd98c('0x31')][_0xd98c('0x35')]));_0x310fe1[_0xd98c('0x33')]=_0x310fe1[_0xd98c('0x33')][_0xd98c('0x36')]?_0x310fe1[_0xd98c('0x33')]:_0x1db20b['model'];_0x310fe1[_0xd98c('0x4f')]=qs[_0xd98c('0x39')](_0xc7ace1[_0xd98c('0x31')]['sort']);_0x310fe1[_0xd98c('0x3c')]=qs[_0xd98c('0x3a')](_[_0xd98c('0x51')](_0xc7ace1['query'],_0x1db20b[_0xd98c('0x3a')]));if(_0xc7ace1[_0xd98c('0x31')][_0xd98c('0x3b')]){_0x310fe1[_0xd98c('0x3c')]=_[_0xd98c('0x47')](_0x310fe1[_0xd98c('0x3c')],{'$or':_[_0xd98c('0x3d')](_0x310fe1[_0xd98c('0x33')],function(_0x39f0ed){var _0x200ed9={};_0x200ed9[_0x39f0ed]={'$like':'%'+_0xc7ace1[_0xd98c('0x31')][_0xd98c('0x3b')]+'%'};return _0x200ed9;})});}_0x310fe1=_[_0xd98c('0x47')]({},_0x310fe1,_0xc7ace1[_0xd98c('0x40')]);return _0x3c911b[_0xd98c('0x50')](_0x310fe1);}})[_0xd98c('0x28')](function(_0x17aace){if(_0x17aace){_0x4ba0b2=_0x17aace[_0xd98c('0x36')];if(!_0xc7ace1[_0xd98c('0x31')][_0xd98c('0x37')](_0xd98c('0x38'))){_0x310fe1['limit']=qs[_0xd98c('0x20')](_0xc7ace1[_0xd98c('0x31')][_0xd98c('0x20')]);_0x310fe1[_0xd98c('0x1e')]=qs['offset'](_0xc7ace1[_0xd98c('0x31')]['offset']);}return _0x3c911b[_0xd98c('0x50')](_0x310fe1);}})[_0xd98c('0x28')](function(_0x477120){if(_0x477120){return _0x477120?{'count':_0x4ba0b2,'rows':_0x477120}:null;}})[_0xd98c('0x28')](respondWithResult(_0x40f46a,null))[_0xd98c('0x43')](handleError(_0x40f46a,null));};exports[_0xd98c('0x52')]=function(_0x993a41,_0x277c44,_0x33932b){var _0x50b7ef={};var _0x5e5149={};var _0x280088;var _0x399f41;return db[_0xd98c('0x41')][_0xd98c('0x4d')]({'where':{'id':_0x993a41[_0xd98c('0x45')]['id']}})[_0xd98c('0x28')](handleEntityNotFound(_0x277c44,null))[_0xd98c('0x28')](function(_0x3bc94d){if(_0x3bc94d){_0x280088=_0x3bc94d;_0x5e5149[_0xd98c('0x30')]=_[_0xd98c('0x32')](db[_0xd98c('0x4e')][_0xd98c('0x2d')]);_0x5e5149['query']=_[_0xd98c('0x32')](_0x993a41['query']);_0x5e5149[_0xd98c('0x3a')]=_[_0xd98c('0x34')](_0x5e5149[_0xd98c('0x30')],_0x5e5149['query']);_0x50b7ef['attributes']=_['intersection'](_0x5e5149[_0xd98c('0x30')],qs['fields'](_0x993a41[_0xd98c('0x31')][_0xd98c('0x35')]));_0x50b7ef[_0xd98c('0x33')]=_0x50b7ef[_0xd98c('0x33')]['length']?_0x50b7ef['attributes']:_0x5e5149['model'];_0x50b7ef[_0xd98c('0x4f')]=qs[_0xd98c('0x39')](_0x993a41['query']['sort']);_0x50b7ef[_0xd98c('0x3c')]=qs[_0xd98c('0x3a')](_[_0xd98c('0x51')](_0x993a41[_0xd98c('0x31')],_0x5e5149[_0xd98c('0x3a')]));if(_0x993a41['query'][_0xd98c('0x3b')]){_0x50b7ef['where']=_[_0xd98c('0x47')](_0x50b7ef['where'],{'$or':_[_0xd98c('0x3d')](_0x50b7ef['attributes'],function(_0x27266e){var _0x22bc6c={};_0x22bc6c[_0x27266e]={'$like':'%'+_0x993a41[_0xd98c('0x31')][_0xd98c('0x3b')]+'%'};return _0x22bc6c;})});}_0x50b7ef=_['merge']({},_0x50b7ef,_0x993a41[_0xd98c('0x40')]);return _0x280088[_0xd98c('0x52')](_0x50b7ef);}})[_0xd98c('0x28')](function(_0x55bf27){if(_0x55bf27){_0x399f41=_0x55bf27[_0xd98c('0x36')];if(!_0x993a41['query'][_0xd98c('0x37')](_0xd98c('0x38'))){_0x50b7ef[_0xd98c('0x20')]=qs[_0xd98c('0x20')](_0x993a41[_0xd98c('0x31')]['limit']);_0x50b7ef['offset']=qs['offset'](_0x993a41[_0xd98c('0x31')][_0xd98c('0x1e')]);}return _0x280088[_0xd98c('0x52')](_0x50b7ef);}})[_0xd98c('0x28')](function(_0x2156a5){if(_0x2156a5){return _0x2156a5?{'count':_0x399f41,'rows':_0x2156a5}:null;}})['then'](respondWithResult(_0x277c44,null))['catch'](handleError(_0x277c44,null));};exports[_0xd98c('0x53')]=function(_0x4bad8d,_0x241980,_0x4bc2bb){var _0x28c635={};var _0x5ba548={};var _0x28fe45;var _0x4095b4;return db[_0xd98c('0x41')][_0xd98c('0x4d')]({'where':{'id':_0x4bad8d['params']['id']}})[_0xd98c('0x28')](handleEntityNotFound(_0x241980,null))[_0xd98c('0x28')](function(_0x2869a2){if(_0x2869a2){_0x28fe45=_0x2869a2;_0x5ba548[_0xd98c('0x30')]=_[_0xd98c('0x32')](db[_0xd98c('0x54')]['rawAttributes']);_0x5ba548['query']=_['keys'](_0x4bad8d[_0xd98c('0x31')]);_0x5ba548[_0xd98c('0x3a')]=_[_0xd98c('0x34')](_0x5ba548[_0xd98c('0x30')],_0x5ba548[_0xd98c('0x31')]);_0x28c635[_0xd98c('0x33')]=_[_0xd98c('0x34')](_0x5ba548[_0xd98c('0x30')],qs[_0xd98c('0x35')](_0x4bad8d['query'][_0xd98c('0x35')]));_0x28c635['attributes']=_0x28c635['attributes'][_0xd98c('0x36')]?_0x28c635[_0xd98c('0x33')]:_0x5ba548[_0xd98c('0x30')];_0x28c635['order']=qs['sort'](_0x4bad8d['query'][_0xd98c('0x39')]);_0x28c635[_0xd98c('0x3c')]=qs[_0xd98c('0x3a')](_['pick'](_0x4bad8d[_0xd98c('0x31')],_0x5ba548[_0xd98c('0x3a')]));if(_0x4bad8d[_0xd98c('0x31')]['filter']){_0x28c635[_0xd98c('0x3c')]=_[_0xd98c('0x47')](_0x28c635[_0xd98c('0x3c')],{'$or':_[_0xd98c('0x3d')](_0x28c635[_0xd98c('0x33')],function(_0x3bc01b){var _0x2c5dee={};_0x2c5dee[_0x3bc01b]={'$like':'%'+_0x4bad8d[_0xd98c('0x31')]['filter']+'%'};return _0x2c5dee;})});}_0x28c635=_[_0xd98c('0x47')]({},_0x28c635,_0x4bad8d[_0xd98c('0x40')]);return _0x28fe45[_0xd98c('0x53')](_0x28c635);}})[_0xd98c('0x28')](function(_0x5d3c6f){if(_0x5d3c6f){_0x4095b4=_0x5d3c6f[_0xd98c('0x36')];if(!_0x4bad8d[_0xd98c('0x31')][_0xd98c('0x37')](_0xd98c('0x38'))){_0x28c635[_0xd98c('0x20')]=qs[_0xd98c('0x20')](_0x4bad8d['query'][_0xd98c('0x20')]);_0x28c635[_0xd98c('0x1e')]=qs[_0xd98c('0x1e')](_0x4bad8d['query'][_0xd98c('0x1e')]);}return _0x28fe45[_0xd98c('0x53')](_0x28c635);}})['then'](function(_0x5daeb9){if(_0x5daeb9){return _0x5daeb9?{'count':_0x4095b4,'rows':_0x5daeb9}:null;}})['then'](respondWithResult(_0x241980,null))['catch'](handleError(_0x241980,null));};exports['setTags']=function(_0x3af244,_0x133b62,_0x2922e1){if(_0x3af244[_0xd98c('0x4a')]['id']){delete _0x3af244[_0xd98c('0x4a')]['id'];}return db[_0xd98c('0x41')][_0xd98c('0x4d')]({'where':{'id':_0x3af244['params']['id']}})[_0xd98c('0x28')](handleEntityNotFound(_0x133b62,null))['then'](function(_0x2a0518){if(_0x2a0518){return _0x2a0518[_0xd98c('0x55')](_0x3af244[_0xd98c('0x4a')][_0xd98c('0x56')]||[]);}return null;})['then'](respondWithResult(_0x133b62,null))[_0xd98c('0x43')](handleError(_0x133b62,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3fc884a..5f00568 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 _0x7688=['bluebird','request-promise','path','../../config/environment','exports','define','FreshdeskConfiguration','lodash','../../config/logger','api'];(function(_0x2a6571,_0xf1567c){var _0xdf7731=function(_0x43a5c4){while(--_0x43a5c4){_0x2a6571['push'](_0x2a6571['shift']());}};_0xdf7731(++_0xf1567c);}(_0x7688,0x183));var _0x8768=function(_0x4a281d,_0x35e914){_0x4a281d=_0x4a281d-0x0;var _0x4337cf=_0x7688[_0x4a281d];return _0x4337cf;};'use strict';var _=require(_0x8768('0x0'));var util=require('util');var logger=require(_0x8768('0x1'))(_0x8768('0x2'));var moment=require('moment');var BPromise=require(_0x8768('0x3'));var rp=require(_0x8768('0x4'));var fs=require('fs');var path=require(_0x8768('0x5'));var rimraf=require('rimraf');var config=require(_0x8768('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x8768('0x7')]=function(_0x2ea318,_0x1f7fbc){return _0x2ea318[_0x8768('0x8')](_0x8768('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa62e=['lodash','util','../../config/logger','api','moment','bluebird','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xa62e,0x1b8));var _0xea62=function(_0xc37fb8,_0x31b988){_0xc37fb8=_0xc37fb8-0x0;var _0x480ab7=_0xa62e[_0xc37fb8];return _0x480ab7;};'use strict';var _=require(_0xea62('0x0'));var util=require(_0xea62('0x1'));var logger=require(_0xea62('0x2'))(_0xea62('0x3'));var moment=require(_0xea62('0x4'));var BPromise=require(_0xea62('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xea62('0x6'));module[_0xea62('0x7')]=function(_0x2281bd,_0x387033){return _0x2281bd[_0xea62('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0xea62('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 02299c6..6149cb5 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 _0x1093=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1ff275,_0x12b011){var _0x156912=function(_0x47bf8b){while(--_0x47bf8b){_0x1ff275['push'](_0x1ff275['shift']());}};_0x156912(++_0x12b011);}(_0x1093,0x1e4));var _0x3109=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x1093[_0x934425];return _0x31d596;};'use strict';var _=require(_0x3109('0x0'));var util=require(_0x3109('0x1'));var moment=require('moment');var BPromise=require(_0x3109('0x2'));var rs=require(_0x3109('0x3'));var fs=require('fs');var Redis=require(_0x3109('0x4'));var db=require(_0x3109('0x5'))['db'];var utils=require(_0x3109('0x6'));var logger=require(_0x3109('0x7'))('rpc');var config=require(_0x3109('0x8'));var jayson=require(_0x3109('0x9'));var client=jayson[_0x3109('0xa')][_0x3109('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20a983,_0x16e67b,_0x501078){return new BPromise(function(_0x1ad78b,_0x3e3a3f){return client[_0x3109('0xc')](_0x20a983,_0x501078)['then'](function(_0x1336c9){logger[_0x3109('0xd')](_0x3109('0xe'),_0x16e67b,_0x3109('0xf'));logger[_0x3109('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x16e67b,_0x3109('0xf'),JSON[_0x3109('0x11')](_0x1336c9));if(_0x1336c9['error']){if(_0x1336c9[_0x3109('0x12')][_0x3109('0x13')]===0x1f4){logger['error'](_0x3109('0xe'),_0x16e67b,_0x1336c9[_0x3109('0x12')]['message']);return _0x3e3a3f(_0x1336c9[_0x3109('0x12')]['message']);}logger[_0x3109('0x12')](_0x3109('0xe'),_0x16e67b,_0x1336c9['error'][_0x3109('0x14')]);return _0x1ad78b(_0x1336c9['error']['message']);}else{logger[_0x3109('0xd')](_0x3109('0xe'),_0x16e67b,'request\x20sent');_0x1ad78b(_0x1336c9['result']['message']);}})['catch'](function(_0xe87279){logger[_0x3109('0x12')](_0x3109('0xe'),_0x16e67b,_0xe87279);_0x3e3a3f(_0xe87279);});});} \ No newline at end of file +var _0xd40e=['request','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x195b37,_0x4cb059){var _0x1b78b4=function(_0x88296c){while(--_0x88296c){_0x195b37['push'](_0x195b37['shift']());}};_0x1b78b4(++_0x4cb059);}(_0xd40e,0x16a));var _0xed40=function(_0x1c5385,_0x3aba1a){_0x1c5385=_0x1c5385-0x0;var _0x478ddb=_0xd40e[_0x1c5385];return _0x478ddb;};'use strict';var _=require('lodash');var util=require(_0xed40('0x0'));var moment=require(_0xed40('0x1'));var BPromise=require(_0xed40('0x2'));var rs=require(_0xed40('0x3'));var fs=require('fs');var Redis=require(_0xed40('0x4'));var db=require(_0xed40('0x5'))['db'];var utils=require(_0xed40('0x6'));var logger=require(_0xed40('0x7'))(_0xed40('0x8'));var config=require(_0xed40('0x9'));var jayson=require(_0xed40('0xa'));var client=jayson['client'][_0xed40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa29a8f,_0x274288,_0x489227){return new BPromise(function(_0x5a43cb,_0x1d1141){return client[_0xed40('0xc')](_0xa29a8f,_0x489227)['then'](function(_0x3f65f8){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x274288,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x274288,'request\x20sent',JSON[_0xed40('0xd')](_0x3f65f8));if(_0x3f65f8[_0xed40('0xe')]){if(_0x3f65f8['error'][_0xed40('0xf')]===0x1f4){logger['error'](_0xed40('0x10'),_0x274288,_0x3f65f8[_0xed40('0xe')]['message']);return _0x1d1141(_0x3f65f8[_0xed40('0xe')]['message']);}logger[_0xed40('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x274288,_0x3f65f8['error']['message']);return _0x5a43cb(_0x3f65f8['error'][_0xed40('0x11')]);}else{logger[_0xed40('0x12')](_0xed40('0x10'),_0x274288,_0xed40('0x13'));_0x5a43cb(_0x3f65f8[_0xed40('0x14')]['message']);}})[_0xed40('0x15')](function(_0x13fa72){logger[_0xed40('0xe')](_0xed40('0x10'),_0x274288,_0x13fa72);_0x1d1141(_0x13fa72);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 208a981..ec7ec5c 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 _0xa58b=['destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x5aacda,_0x454413){var _0x47ab11=function(_0x24b2ba){while(--_0x24b2ba){_0x5aacda['push'](_0x5aacda['shift']());}};_0x47ab11(++_0x454413);}(_0xa58b,0x1d6));var _0xba58=function(_0x154dee,_0x45e7e9){_0x154dee=_0x154dee-0x0;var _0x6fd3fc=_0xa58b[_0x154dee];return _0x6fd3fc;};'use strict';var multer=require('multer');var util=require(_0xba58('0x0'));var path=require('path');var timeout=require(_0xba58('0x1'));var express=require('express');var router=express[_0xba58('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xba58('0x3'));var interaction=require(_0xba58('0x4'));var config=require(_0xba58('0x5'));var controller=require(_0xba58('0x6'));router[_0xba58('0x7')]('/',auth[_0xba58('0x8')](),controller[_0xba58('0x9')]);router[_0xba58('0x7')](_0xba58('0xa'),auth['isAuthenticated'](),controller[_0xba58('0xb')]);router[_0xba58('0xc')]('/',auth[_0xba58('0x8')](),controller[_0xba58('0xd')]);router['put'](_0xba58('0xa'),auth[_0xba58('0x8')](),controller[_0xba58('0xe')]);router[_0xba58('0xf')](_0xba58('0xa'),auth['isAuthenticated'](),controller[_0xba58('0x10')]);module[_0xba58('0x11')]=router; \ No newline at end of file +var _0x1589=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x38cbc3,_0x39b1e3){var _0x1486be=function(_0x22c871){while(--_0x22c871){_0x38cbc3['push'](_0x38cbc3['shift']());}};_0x1486be(++_0x39b1e3);}(_0x1589,0xd4));var _0x9158=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x1589[_0x2aecb2];return _0x3ebb80;};'use strict';var multer=require(_0x9158('0x0'));var util=require('util');var path=require(_0x9158('0x1'));var timeout=require(_0x9158('0x2'));var express=require(_0x9158('0x3'));var router=express[_0x9158('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9158('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9158('0x6'));var controller=require(_0x9158('0x7'));router[_0x9158('0x8')]('/',auth[_0x9158('0x9')](),controller[_0x9158('0xa')]);router[_0x9158('0x8')](_0x9158('0xb'),auth[_0x9158('0x9')](),controller[_0x9158('0xc')]);router[_0x9158('0xd')]('/',auth[_0x9158('0x9')](),controller['create']);router[_0x9158('0xe')](_0x9158('0xb'),auth[_0x9158('0x9')](),controller[_0x9158('0xf')]);router[_0x9158('0x10')](_0x9158('0xb'),auth[_0x9158('0x9')](),controller[_0x9158('0x11')]);module[_0x9158('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4b86a4f..147b989 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 _0x10d6=['customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x14ed75,_0x2aac94){var _0x3955cc=function(_0x543223){while(--_0x543223){_0x14ed75['push'](_0x14ed75['shift']());}};_0x3955cc(++_0x2aac94);}(_0x10d6,0x7a));var _0x610d=function(_0x5c0b37,_0x5a4c17){_0x5c0b37=_0x5c0b37-0x0;var _0x8d54c7=_0x10d6[_0x5c0b37];return _0x8d54c7;};'use strict';var Sequelize=require(_0x610d('0x0'));module[_0x610d('0x1')]={'type':{'type':Sequelize[_0x610d('0x2')]('string',_0x610d('0x3'),_0x610d('0x4'),_0x610d('0x5'),_0x610d('0x6')),'defaultValue':_0x610d('0x7')},'content':{'type':Sequelize[_0x610d('0x8')]},'key':{'type':Sequelize[_0x610d('0x8')]},'keyType':{'type':Sequelize[_0x610d('0x2')](_0x610d('0x7'),_0x610d('0x3'),_0x610d('0x4'))},'keyContent':{'type':Sequelize[_0x610d('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x610d('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x610d('0x8')]}}; \ No newline at end of file +var _0x869e=['exports','ENUM','string','keyValue','picklist','STRING','variable','sequelize'];(function(_0x6fa1c9,_0x1834f2){var _0x3ebf6f=function(_0x132805){while(--_0x132805){_0x6fa1c9['push'](_0x6fa1c9['shift']());}};_0x3ebf6f(++_0x1834f2);}(_0x869e,0x97));var _0xe869=function(_0x1c9a89,_0x355f2d){_0x1c9a89=_0x1c9a89-0x0;var _0x354b0d=_0x869e[_0x1c9a89];return _0x354b0d;};'use strict';var Sequelize=require(_0xe869('0x0'));module[_0xe869('0x1')]={'type':{'type':Sequelize[_0xe869('0x2')](_0xe869('0x3'),'variable','customVariable',_0xe869('0x4'),_0xe869('0x5')),'defaultValue':_0xe869('0x3')},'content':{'type':Sequelize[_0xe869('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe869('0x2')](_0xe869('0x3'),_0xe869('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xe869('0x6')]},'idField':{'type':Sequelize[_0xe869('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe869('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e99a777..8402866 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 _0x7794=['status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshdeskField','includeAll','findAll','rows','show','rawAttributes','include','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x50aedf,_0x40fdc0){var _0x332cb6=function(_0x356880){while(--_0x356880){_0x50aedf['push'](_0x50aedf['shift']());}};_0x332cb6(++_0x40fdc0);}(_0x7794,0x7b));var _0x4779=function(_0x304910,_0x3f3ed0){_0x304910=_0x304910-0x0;var _0x23b645=_0x7794[_0x304910];return _0x23b645;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4779('0x0'));var zipdir=require(_0x4779('0x1'));var jsonpatch=require(_0x4779('0x2'));var rp=require(_0x4779('0x3'));var moment=require('moment');var BPromise=require(_0x4779('0x4'));var Mustache=require(_0x4779('0x5'));var util=require('util');var path=require(_0x4779('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4779('0x7'));var _=require(_0x4779('0x8'));var squel=require('squel');var crypto=require(_0x4779('0x9'));var jsforce=require(_0x4779('0xa'));var deskjs=require(_0x4779('0xb'));var toCsv=require(_0x4779('0xc'));var querystring=require(_0x4779('0xd'));var Papa=require(_0x4779('0xe'));var Redis=require(_0x4779('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4779('0x10'));var as=require(_0x4779('0x11'));var hardwareService=require(_0x4779('0x12'));var logger=require(_0x4779('0x13'))(_0x4779('0x14'));var utils=require(_0x4779('0x15'));var config=require(_0x4779('0x16'));var licenseUtil=require(_0x4779('0x17'));var db=require(_0x4779('0x18'))['db'];function respondWithStatusCode(_0x13c989,_0x50e17e){_0x50e17e=_0x50e17e||0xcc;return function(_0x5b1219){if(_0x5b1219){return _0x13c989['sendStatus'](_0x50e17e);}return _0x13c989[_0x4779('0x19')](_0x50e17e)[_0x4779('0x1a')]();};}function respondWithResult(_0xb9a06f,_0xddf5cd){_0xddf5cd=_0xddf5cd||0xc8;return function(_0x4fe370){if(_0x4fe370){return _0xb9a06f[_0x4779('0x19')](_0xddf5cd)[_0x4779('0x1b')](_0x4fe370);}};}function respondWithFilteredResult(_0x4d71a0,_0x599deb){return function(_0x1dbbe1){if(_0x1dbbe1){var _0x2de2be=typeof _0x599deb[_0x4779('0x1c')]===_0x4779('0x1d')&&typeof _0x599deb['limit']==='undefined';var _0x445e0b=_0x1dbbe1[_0x4779('0x1e')];var _0x19fbb6=_0x2de2be?0x0:_0x599deb['offset'];var _0x3dbe70=_0x2de2be?_0x1dbbe1['count']:_0x599deb[_0x4779('0x1c')]+_0x599deb[_0x4779('0x1f')];var _0x478fa5;if(_0x3dbe70>=_0x445e0b){_0x3dbe70=_0x445e0b;_0x478fa5=0xc8;}else{_0x478fa5=0xce;}_0x4d71a0[_0x4779('0x19')](_0x478fa5);return _0x4d71a0['set'](_0x4779('0x20'),_0x19fbb6+'-'+_0x3dbe70+'/'+_0x445e0b)[_0x4779('0x1b')](_0x1dbbe1);}return null;};}function patchUpdates(_0x143ef6){return function(_0x298e25){try{jsonpatch[_0x4779('0x21')](_0x298e25,_0x143ef6,!![]);}catch(_0x1ce270){return BPromise['reject'](_0x1ce270);}return _0x298e25[_0x4779('0x22')]();};}function saveUpdates(_0x4f2158,_0x4ad246){return function(_0xd983f0){if(_0xd983f0){return _0xd983f0[_0x4779('0x23')](_0x4f2158)[_0x4779('0x24')](function(_0x2b7ab6){return _0x2b7ab6;});}return null;};}function removeEntity(_0x555cd6,_0x152887){return function(_0x29a39a){if(_0x29a39a){return _0x29a39a[_0x4779('0x25')]()['then'](function(){_0x555cd6[_0x4779('0x19')](0xcc)[_0x4779('0x1a')]();});}};}function handleEntityNotFound(_0x577b13,_0x1ce2d2){return function(_0x38af24){if(!_0x38af24){_0x577b13['sendStatus'](0x194);}return _0x38af24;};}function handleError(_0x20db7e,_0x277f55){_0x277f55=_0x277f55||0x1f4;return function(_0x211af1){logger[_0x4779('0x26')](_0x211af1[_0x4779('0x27')]);if(_0x211af1[_0x4779('0x28')]){delete _0x211af1[_0x4779('0x28')];}_0x20db7e[_0x4779('0x19')](_0x277f55)['send'](_0x211af1);};}exports[_0x4779('0x29')]=function(_0x1607a5,_0xb028f){var _0x28a261={},_0x8b4c42={},_0x40fb18={'count':0x0,'rows':[]};var _0x13ec28=_[_0x4779('0x2a')](db['FreshdeskField']['rawAttributes'],function(_0x179717){return{'name':_0x179717[_0x4779('0x2b')],'type':_0x179717[_0x4779('0x2c')][_0x4779('0x2d')]};});_0x8b4c42[_0x4779('0x2e')]=_['map'](_0x13ec28,_0x4779('0x28'));_0x8b4c42[_0x4779('0x2f')]=_[_0x4779('0x30')](_0x1607a5[_0x4779('0x2f')]);_0x8b4c42['filters']=_['intersection'](_0x8b4c42[_0x4779('0x2e')],_0x8b4c42['query']);_0x28a261[_0x4779('0x31')]=_[_0x4779('0x32')](_0x8b4c42[_0x4779('0x2e')],qs[_0x4779('0x33')](_0x1607a5[_0x4779('0x2f')][_0x4779('0x33')]));_0x28a261[_0x4779('0x31')]=_0x28a261[_0x4779('0x31')][_0x4779('0x34')]?_0x28a261[_0x4779('0x31')]:_0x8b4c42[_0x4779('0x2e')];if(!_0x1607a5[_0x4779('0x2f')]['hasOwnProperty']('nolimit')){_0x28a261[_0x4779('0x1f')]=qs['limit'](_0x1607a5[_0x4779('0x2f')]['limit']);_0x28a261[_0x4779('0x1c')]=qs[_0x4779('0x1c')](_0x1607a5[_0x4779('0x2f')][_0x4779('0x1c')]);}_0x28a261[_0x4779('0x35')]=qs['sort'](_0x1607a5['query'][_0x4779('0x36')]);_0x28a261[_0x4779('0x37')]=qs[_0x4779('0x38')](_[_0x4779('0x39')](_0x1607a5[_0x4779('0x2f')],_0x8b4c42[_0x4779('0x38')]),_0x13ec28);if(_0x1607a5[_0x4779('0x2f')][_0x4779('0x3a')]){_0x28a261[_0x4779('0x37')]=_[_0x4779('0x3b')](_0x28a261[_0x4779('0x37')],{'$or':_[_0x4779('0x2a')](_0x13ec28,function(_0x88603f){if(_0x88603f[_0x4779('0x2c')]!==_0x4779('0x3c')){var _0x1a2c16={};_0x1a2c16[_0x88603f[_0x4779('0x28')]]={'$like':'%'+_0x1607a5[_0x4779('0x2f')][_0x4779('0x3a')]+'%'};return _0x1a2c16;}})});}_0x28a261=_['merge']({},_0x28a261,_0x1607a5[_0x4779('0x3d')]);var _0x58ca36={'where':_0x28a261[_0x4779('0x37')]};return db[_0x4779('0x3e')][_0x4779('0x1e')](_0x58ca36)[_0x4779('0x24')](function(_0xc9873e){_0x40fb18[_0x4779('0x1e')]=_0xc9873e;if(_0x1607a5['query'][_0x4779('0x3f')]){_0x28a261['include']=[{'all':!![]}];}return db[_0x4779('0x3e')][_0x4779('0x40')](_0x28a261);})[_0x4779('0x24')](function(_0x3a3589){_0x40fb18[_0x4779('0x41')]=_0x3a3589;return _0x40fb18;})[_0x4779('0x24')](respondWithFilteredResult(_0xb028f,_0x28a261))['catch'](handleError(_0xb028f,null));};exports[_0x4779('0x42')]=function(_0x5cdc2b,_0x20abf7){var _0x3f1889={'raw':!![],'where':{'id':_0x5cdc2b['params']['id']}},_0x2e60ab={};_0x2e60ab[_0x4779('0x2e')]=_[_0x4779('0x30')](db[_0x4779('0x3e')][_0x4779('0x43')]);_0x2e60ab[_0x4779('0x2f')]=_[_0x4779('0x30')](_0x5cdc2b[_0x4779('0x2f')]);_0x2e60ab[_0x4779('0x38')]=_[_0x4779('0x32')](_0x2e60ab[_0x4779('0x2e')],_0x2e60ab[_0x4779('0x2f')]);_0x3f1889[_0x4779('0x31')]=_[_0x4779('0x32')](_0x2e60ab[_0x4779('0x2e')],qs[_0x4779('0x33')](_0x5cdc2b['query']['fields']));_0x3f1889[_0x4779('0x31')]=_0x3f1889[_0x4779('0x31')][_0x4779('0x34')]?_0x3f1889[_0x4779('0x31')]:_0x2e60ab[_0x4779('0x2e')];if(_0x5cdc2b[_0x4779('0x2f')][_0x4779('0x3f')]){_0x3f1889[_0x4779('0x44')]=[{'all':!![]}];}_0x3f1889=_['merge']({},_0x3f1889,_0x5cdc2b[_0x4779('0x3d')]);return db[_0x4779('0x3e')][_0x4779('0x45')](_0x3f1889)[_0x4779('0x24')](handleEntityNotFound(_0x20abf7,null))[_0x4779('0x24')](respondWithResult(_0x20abf7,null))[_0x4779('0x46')](handleError(_0x20abf7,null));};exports['create']=function(_0x7f419c,_0x39ecb5){return db[_0x4779('0x3e')][_0x4779('0x47')](_0x7f419c[_0x4779('0x48')],{})['then'](respondWithResult(_0x39ecb5,0xc9))[_0x4779('0x46')](handleError(_0x39ecb5,null));};exports[_0x4779('0x23')]=function(_0x3873d4,_0x4a1040){if(_0x3873d4[_0x4779('0x48')]['id']){delete _0x3873d4['body']['id'];}return db[_0x4779('0x3e')][_0x4779('0x45')]({'where':{'id':_0x3873d4[_0x4779('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a1040,null))[_0x4779('0x24')](saveUpdates(_0x3873d4['body'],null))[_0x4779('0x24')](respondWithResult(_0x4a1040,null))[_0x4779('0x46')](handleError(_0x4a1040,null));};exports[_0x4779('0x25')]=function(_0x58e14e,_0x5dfdb7){return db['FreshdeskField'][_0x4779('0x45')]({'where':{'id':_0x58e14e[_0x4779('0x49')]['id']}})['then'](handleEntityNotFound(_0x5dfdb7,null))[_0x4779('0x24')](removeEntity(_0x5dfdb7,null))[_0x4779('0x46')](handleError(_0x5dfdb7,null));}; \ No newline at end of file +var _0xc36d=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','includeAll','include','rows','catch','show','params','FreshdeskField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x3d55ba,_0x56e972){var _0xb1ccce=function(_0x25c304){while(--_0x25c304){_0x3d55ba['push'](_0x3d55ba['shift']());}};_0xb1ccce(++_0x56e972);}(_0xc36d,0x7d));var _0xdc36=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0xc36d[_0x74745d];return _0x174ab3;};'use strict';var emlformat=require(_0xdc36('0x0'));var rimraf=require(_0xdc36('0x1'));var zipdir=require(_0xdc36('0x2'));var jsonpatch=require(_0xdc36('0x3'));var rp=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc36('0x6'));var util=require(_0xdc36('0x7'));var path=require('path');var sox=require(_0xdc36('0x8'));var csv=require(_0xdc36('0x9'));var ejs=require(_0xdc36('0xa'));var fs=require('fs');var fs_extra=require(_0xdc36('0xb'));var _=require(_0xdc36('0xc'));var squel=require('squel');var crypto=require(_0xdc36('0xd'));var jsforce=require(_0xdc36('0xe'));var deskjs=require(_0xdc36('0xf'));var toCsv=require(_0xdc36('0x9'));var querystring=require('querystring');var Papa=require(_0xdc36('0x10'));var Redis=require(_0xdc36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc36('0x12'));var as=require(_0xdc36('0x13'));var hardwareService=require(_0xdc36('0x14'));var logger=require('../../config/logger')(_0xdc36('0x15'));var utils=require(_0xdc36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc36('0x17'))['db'];function respondWithStatusCode(_0x276692,_0x519fa5){_0x519fa5=_0x519fa5||0xcc;return function(_0x5d62ee){if(_0x5d62ee){return _0x276692['sendStatus'](_0x519fa5);}return _0x276692[_0xdc36('0x18')](_0x519fa5)[_0xdc36('0x19')]();};}function respondWithResult(_0x243d54,_0xae6ad3){_0xae6ad3=_0xae6ad3||0xc8;return function(_0x30803d){if(_0x30803d){return _0x243d54[_0xdc36('0x18')](_0xae6ad3)[_0xdc36('0x1a')](_0x30803d);}};}function respondWithFilteredResult(_0x809cf0,_0x57ebde){return function(_0x155cce){if(_0x155cce){var _0x526ac8=typeof _0x57ebde['offset']==='undefined'&&typeof _0x57ebde[_0xdc36('0x1b')]===_0xdc36('0x1c');var _0x5a498f=_0x155cce[_0xdc36('0x1d')];var _0x219a73=_0x526ac8?0x0:_0x57ebde[_0xdc36('0x1e')];var _0x225878=_0x526ac8?_0x155cce[_0xdc36('0x1d')]:_0x57ebde[_0xdc36('0x1e')]+_0x57ebde['limit'];var _0x3d4c4c;if(_0x225878>=_0x5a498f){_0x225878=_0x5a498f;_0x3d4c4c=0xc8;}else{_0x3d4c4c=0xce;}_0x809cf0[_0xdc36('0x18')](_0x3d4c4c);return _0x809cf0['set'](_0xdc36('0x1f'),_0x219a73+'-'+_0x225878+'/'+_0x5a498f)[_0xdc36('0x1a')](_0x155cce);}return null;};}function patchUpdates(_0x3f25f0){return function(_0x5f15ef){try{jsonpatch[_0xdc36('0x20')](_0x5f15ef,_0x3f25f0,!![]);}catch(_0x235a39){return BPromise['reject'](_0x235a39);}return _0x5f15ef[_0xdc36('0x21')]();};}function saveUpdates(_0x480277,_0x5a6e35){return function(_0x12f9d8){if(_0x12f9d8){return _0x12f9d8[_0xdc36('0x22')](_0x480277)[_0xdc36('0x23')](function(_0xda916b){return _0xda916b;});}return null;};}function removeEntity(_0x2d83c0,_0x34d261){return function(_0x14b595){if(_0x14b595){return _0x14b595[_0xdc36('0x24')]()['then'](function(){_0x2d83c0[_0xdc36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2338d7,_0x38bd73){return function(_0x15e686){if(!_0x15e686){_0x2338d7['sendStatus'](0x194);}return _0x15e686;};}function handleError(_0xbc4322,_0x6e3906){_0x6e3906=_0x6e3906||0x1f4;return function(_0x337091){logger['error'](_0x337091[_0xdc36('0x25')]);if(_0x337091[_0xdc36('0x26')]){delete _0x337091[_0xdc36('0x26')];}_0xbc4322['status'](_0x6e3906)[_0xdc36('0x27')](_0x337091);};}exports[_0xdc36('0x28')]=function(_0x4b15b4,_0x3fe57f){var _0x12fed2={},_0x4ea2ad={},_0x21151b={'count':0x0,'rows':[]};var _0x5bba0b=_['map'](db['FreshdeskField'][_0xdc36('0x29')],function(_0x2f2bb4){return{'name':_0x2f2bb4['fieldName'],'type':_0x2f2bb4[_0xdc36('0x2a')][_0xdc36('0x2b')]};});_0x4ea2ad[_0xdc36('0x2c')]=_['map'](_0x5bba0b,_0xdc36('0x26'));_0x4ea2ad[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x4b15b4[_0xdc36('0x2d')]);_0x4ea2ad[_0xdc36('0x2f')]=_[_0xdc36('0x30')](_0x4ea2ad[_0xdc36('0x2c')],_0x4ea2ad['query']);_0x12fed2[_0xdc36('0x31')]=_[_0xdc36('0x30')](_0x4ea2ad['model'],qs['fields'](_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x32')]));_0x12fed2[_0xdc36('0x31')]=_0x12fed2['attributes']['length']?_0x12fed2[_0xdc36('0x31')]:_0x4ea2ad[_0xdc36('0x2c')];if(!_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x33')](_0xdc36('0x34'))){_0x12fed2[_0xdc36('0x1b')]=qs[_0xdc36('0x1b')](_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x1b')]);_0x12fed2[_0xdc36('0x1e')]=qs[_0xdc36('0x1e')](_0x4b15b4['query'][_0xdc36('0x1e')]);}_0x12fed2[_0xdc36('0x35')]=qs[_0xdc36('0x36')](_0x4b15b4[_0xdc36('0x2d')]['sort']);_0x12fed2[_0xdc36('0x37')]=qs[_0xdc36('0x2f')](_[_0xdc36('0x38')](_0x4b15b4[_0xdc36('0x2d')],_0x4ea2ad['filters']),_0x5bba0b);if(_0x4b15b4[_0xdc36('0x2d')]['filter']){_0x12fed2['where']=_[_0xdc36('0x39')](_0x12fed2[_0xdc36('0x37')],{'$or':_[_0xdc36('0x3a')](_0x5bba0b,function(_0x54c45d){if(_0x54c45d[_0xdc36('0x2a')]!=='VIRTUAL'){var _0x45760b={};_0x45760b[_0x54c45d[_0xdc36('0x26')]]={'$like':'%'+_0x4b15b4[_0xdc36('0x2d')]['filter']+'%'};return _0x45760b;}})});}_0x12fed2=_[_0xdc36('0x39')]({},_0x12fed2,_0x4b15b4[_0xdc36('0x3b')]);var _0xd98d42={'where':_0x12fed2[_0xdc36('0x37')]};return db['FreshdeskField'][_0xdc36('0x1d')](_0xd98d42)[_0xdc36('0x23')](function(_0x68816d){_0x21151b['count']=_0x68816d;if(_0x4b15b4['query'][_0xdc36('0x3c')]){_0x12fed2[_0xdc36('0x3d')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x12fed2);})[_0xdc36('0x23')](function(_0x8f4c80){_0x21151b[_0xdc36('0x3e')]=_0x8f4c80;return _0x21151b;})[_0xdc36('0x23')](respondWithFilteredResult(_0x3fe57f,_0x12fed2))[_0xdc36('0x3f')](handleError(_0x3fe57f,null));};exports[_0xdc36('0x40')]=function(_0x932213,_0x2a83ee){var _0x2f4c89={'raw':!![],'where':{'id':_0x932213[_0xdc36('0x41')]['id']}},_0x125f0e={};_0x125f0e[_0xdc36('0x2c')]=_[_0xdc36('0x2e')](db[_0xdc36('0x42')][_0xdc36('0x29')]);_0x125f0e[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x932213[_0xdc36('0x2d')]);_0x125f0e[_0xdc36('0x2f')]=_[_0xdc36('0x30')](_0x125f0e[_0xdc36('0x2c')],_0x125f0e[_0xdc36('0x2d')]);_0x2f4c89[_0xdc36('0x31')]=_[_0xdc36('0x30')](_0x125f0e[_0xdc36('0x2c')],qs[_0xdc36('0x32')](_0x932213['query'][_0xdc36('0x32')]));_0x2f4c89[_0xdc36('0x31')]=_0x2f4c89['attributes']['length']?_0x2f4c89[_0xdc36('0x31')]:_0x125f0e['model'];if(_0x932213[_0xdc36('0x2d')]['includeAll']){_0x2f4c89[_0xdc36('0x3d')]=[{'all':!![]}];}_0x2f4c89=_[_0xdc36('0x39')]({},_0x2f4c89,_0x932213[_0xdc36('0x3b')]);return db[_0xdc36('0x42')][_0xdc36('0x43')](_0x2f4c89)[_0xdc36('0x23')](handleEntityNotFound(_0x2a83ee,null))[_0xdc36('0x23')](respondWithResult(_0x2a83ee,null))[_0xdc36('0x3f')](handleError(_0x2a83ee,null));};exports[_0xdc36('0x44')]=function(_0x38c24b,_0x3c27c7){return db[_0xdc36('0x42')][_0xdc36('0x44')](_0x38c24b[_0xdc36('0x45')],{})[_0xdc36('0x23')](respondWithResult(_0x3c27c7,0xc9))[_0xdc36('0x3f')](handleError(_0x3c27c7,null));};exports[_0xdc36('0x22')]=function(_0x3399cc,_0x562c86){if(_0x3399cc['body']['id']){delete _0x3399cc[_0xdc36('0x45')]['id'];}return db[_0xdc36('0x42')][_0xdc36('0x43')]({'where':{'id':_0x3399cc[_0xdc36('0x41')]['id']}})[_0xdc36('0x23')](handleEntityNotFound(_0x562c86,null))[_0xdc36('0x23')](saveUpdates(_0x3399cc['body'],null))[_0xdc36('0x23')](respondWithResult(_0x562c86,null))[_0xdc36('0x3f')](handleError(_0x562c86,null));};exports[_0xdc36('0x24')]=function(_0x49f456,_0x2c6856){return db[_0xdc36('0x42')][_0xdc36('0x43')]({'where':{'id':_0x49f456[_0xdc36('0x41')]['id']}})[_0xdc36('0x23')](handleEntityNotFound(_0x2c6856,null))[_0xdc36('0x23')](removeEntity(_0x2c6856,null))['catch'](handleError(_0x2c6856,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9fc7d17..89cd80d 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 _0x2263=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','FieldId','lodash','util'];(function(_0x1a2db9,_0x556d50){var _0x54fb6d=function(_0x259d7f){while(--_0x259d7f){_0x1a2db9['push'](_0x1a2db9['shift']());}};_0x54fb6d(++_0x556d50);}(_0x2263,0x6e));var _0x3226=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x2263[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0x3226('0x0'));var util=require(_0x3226('0x1'));var logger=require(_0x3226('0x2'))(_0x3226('0x3'));var moment=require(_0x3226('0x4'));var BPromise=require(_0x3226('0x5'));var rp=require(_0x3226('0x6'));var fs=require('fs');var path=require(_0x3226('0x7'));var rimraf=require('rimraf');var config=require(_0x3226('0x8'));var attributes=require(_0x3226('0x9'));module[_0x3226('0xa')]=function(_0x34c47c,_0x31b59b){return _0x34c47c['define'](_0x3226('0xb'),attributes,{'tableName':_0x3226('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x3226('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdedd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','idField','lodash','util','../../config/logger','api'];(function(_0x1d7d68,_0x4a407d){var _0x456c44=function(_0x348a5a){while(--_0x348a5a){_0x1d7d68['push'](_0x1d7d68['shift']());}};_0x456c44(++_0x4a407d);}(_0xdedd,0x155));var _0xdded=function(_0x1d42f2,_0x3bb128){_0x1d42f2=_0x1d42f2-0x0;var _0x97a41c=_0xdedd[_0x1d42f2];return _0x97a41c;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var logger=require(_0xdded('0x2'))(_0xdded('0x3'));var moment=require(_0xdded('0x4'));var BPromise=require(_0xdded('0x5'));var rp=require(_0xdded('0x6'));var fs=require('fs');var path=require(_0xdded('0x7'));var rimraf=require(_0xdded('0x8'));var config=require(_0xdded('0x9'));var attributes=require('./intFreshdeskField.attributes');module[_0xdded('0xa')]=function(_0x766687,_0x17cc86){return _0x766687[_0xdded('0xb')](_0xdded('0xc'),attributes,{'tableName':_0xdded('0xd'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xdded('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 74ee483..e8be785 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 _0x01d7=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3b04f3,_0x507854){var _0x2fbc54=function(_0x1067de){while(--_0x1067de){_0x3b04f3['push'](_0x3b04f3['shift']());}};_0x2fbc54(++_0x507854);}(_0x01d7,0x1dd));var _0x701d=function(_0x433d50,_0x245920){_0x433d50=_0x433d50-0x0;var _0x49e332=_0x01d7[_0x433d50];return _0x49e332;};'use strict';var _=require(_0x701d('0x0'));var util=require(_0x701d('0x1'));var moment=require(_0x701d('0x2'));var BPromise=require(_0x701d('0x3'));var rs=require(_0x701d('0x4'));var fs=require('fs');var Redis=require(_0x701d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x701d('0x6'));var logger=require(_0x701d('0x7'))('rpc');var config=require(_0x701d('0x8'));var jayson=require(_0x701d('0x9'));var client=jayson[_0x701d('0xa')][_0x701d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x347f26,_0x1ef06c,_0x363bc8){return new BPromise(function(_0x303d50,_0x5efefc){return client[_0x701d('0xc')](_0x347f26,_0x363bc8)[_0x701d('0xd')](function(_0x477ce6){logger[_0x701d('0xe')](_0x701d('0xf'),_0x1ef06c,'request\x20sent');logger[_0x701d('0x10')](_0x701d('0x11'),_0x1ef06c,_0x701d('0x12'),JSON[_0x701d('0x13')](_0x477ce6));if(_0x477ce6[_0x701d('0x14')]){if(_0x477ce6[_0x701d('0x14')][_0x701d('0x15')]===0x1f4){logger['error'](_0x701d('0xf'),_0x1ef06c,_0x477ce6['error'][_0x701d('0x16')]);return _0x5efefc(_0x477ce6[_0x701d('0x14')][_0x701d('0x16')]);}logger['error'](_0x701d('0xf'),_0x1ef06c,_0x477ce6[_0x701d('0x14')][_0x701d('0x16')]);return _0x303d50(_0x477ce6['error'][_0x701d('0x16')]);}else{logger['info'](_0x701d('0xf'),_0x1ef06c,_0x701d('0x12'));_0x303d50(_0x477ce6['result'][_0x701d('0x16')]);}})['catch'](function(_0x21535c){logger[_0x701d('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x1ef06c,_0x21535c);_0x5efefc(_0x21535c);});});} \ No newline at end of file +var _0xcfe6=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x411289,_0x36dbc8){var _0x5e72ec=function(_0x4d415b){while(--_0x4d415b){_0x411289['push'](_0x411289['shift']());}};_0x5e72ec(++_0x36dbc8);}(_0xcfe6,0x93));var _0x6cfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfe6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6cfe('0x0'));var util=require(_0x6cfe('0x1'));var moment=require(_0x6cfe('0x2'));var BPromise=require(_0x6cfe('0x3'));var rs=require(_0x6cfe('0x4'));var fs=require('fs');var Redis=require(_0x6cfe('0x5'));var db=require(_0x6cfe('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6cfe('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6cfe('0x8')][_0x6cfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x216efd,_0x1b379c,_0x5c114a){return new BPromise(function(_0x406db1,_0x38138){return client[_0x6cfe('0xa')](_0x216efd,_0x5c114a)[_0x6cfe('0xb')](function(_0x1be139){logger[_0x6cfe('0xc')](_0x6cfe('0xd'),_0x1b379c,'request\x20sent');logger['debug'](_0x6cfe('0xe'),_0x1b379c,_0x6cfe('0xf'),JSON['stringify'](_0x1be139));if(_0x1be139[_0x6cfe('0x10')]){if(_0x1be139[_0x6cfe('0x10')][_0x6cfe('0x11')]===0x1f4){logger['error'](_0x6cfe('0xd'),_0x1b379c,_0x1be139[_0x6cfe('0x10')][_0x6cfe('0x12')]);return _0x38138(_0x1be139[_0x6cfe('0x10')][_0x6cfe('0x12')]);}logger[_0x6cfe('0x10')](_0x6cfe('0xd'),_0x1b379c,_0x1be139[_0x6cfe('0x10')][_0x6cfe('0x12')]);return _0x406db1(_0x1be139[_0x6cfe('0x10')][_0x6cfe('0x12')]);}else{logger[_0x6cfe('0xc')](_0x6cfe('0xd'),_0x1b379c,'request\x20sent');_0x406db1(_0x1be139[_0x6cfe('0x13')][_0x6cfe('0x12')]);}})[_0x6cfe('0x14')](function(_0x80b004){logger[_0x6cfe('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x1b379c,_0x80b004);_0x38138(_0x80b004);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 22722c3..4bca3fe 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 _0xa75b=['post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields'];(function(_0x2b2eb0,_0x104ad2){var _0x32406b=function(_0x2bb5a5){while(--_0x2bb5a5){_0x2b2eb0['push'](_0x2b2eb0['shift']());}};_0x32406b(++_0x104ad2);}(_0xa75b,0x170));var _0xba75=function(_0xbae95d,_0x5d024c){_0xbae95d=_0xbae95d-0x0;var _0x2fcb36=_0xa75b[_0xbae95d];return _0x2fcb36;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x10')](_0xba75('0x12'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);router[_0xba75('0x14')](_0xba75('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xba75('0x15')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0x16')]);module[_0xba75('0x17')]=router; \ No newline at end of file +var _0x44a3=['getFields','post','addConfiguration','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x330458,_0xa91caa){var _0x2990d8=function(_0x512807){while(--_0x512807){_0x330458['push'](_0x330458['shift']());}};_0x2990d8(++_0xa91caa);}(_0x44a3,0x1a9));var _0x344a=function(_0x100b96,_0x1bac2c){_0x100b96=_0x100b96-0x0;var _0x44bbcf=_0x44a3[_0x100b96];return _0x44bbcf;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/fields',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),controller['create']);router[_0x344a('0x10')]('/:id/configurations',auth[_0x344a('0xb')](),controller[_0x344a('0x11')]);router['put']('/:id',auth[_0x344a('0xb')](),controller[_0x344a('0x12')]);router[_0x344a('0x13')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6d91182..f1e0ba2 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 _0xe5af=['exports','STRING','username','remoteUri'];(function(_0x32065a,_0x4ad22b){var _0x52ccf9=function(_0x34a76f){while(--_0x34a76f){_0x32065a['push'](_0x32065a['shift']());}};_0x52ccf9(++_0x4ad22b);}(_0xe5af,0x9c));var _0xfe5a=function(_0xcb8b8e,_0x30a35d){_0xcb8b8e=_0xcb8b8e-0x0;var _0x2f1b62=_0xe5af[_0xcb8b8e];return _0x2f1b62;};'use strict';var Sequelize=require('sequelize');module[_0xfe5a('0x0')]={'name':{'type':Sequelize[_0xfe5a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfe5a('0x1')],'unique':_0xfe5a('0x2')},'apiKey':{'type':Sequelize[_0xfe5a('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfe5a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x25e7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x47cfc9,_0x24fc3d){var _0x18fc41=function(_0x4cb2cd){while(--_0x4cb2cd){_0x47cfc9['push'](_0x47cfc9['shift']());}};_0x18fc41(++_0x24fc3d);}(_0x25e7,0x1d6));var _0x725e=function(_0x2fbedc,_0x25d163){_0x2fbedc=_0x2fbedc-0x0;var _0x56b33e=_0x25e7[_0x2fbedc];return _0x56b33e;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'name':{'type':Sequelize[_0x725e('0x2')]},'description':{'type':Sequelize[_0x725e('0x2')]},'username':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x3')},'apiKey':{'type':Sequelize[_0x725e('0x2')]},'remoteUri':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x4')},'serverUrl':{'type':Sequelize[_0x725e('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 1db87c4..22802ea 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 _0x3c81=['keys','rawAttributes','find','create','body','params','getConfigurations','FreshsalesConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','FreshsalesAccount','includeAll','findAll','rows','catch'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3c81,0x148));var _0x13c8=function(_0x3d4895,_0x4d3602){_0x3d4895=_0x3d4895-0x0;var _0x147a70=_0x3c81[_0x3d4895];return _0x147a70;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require(_0x13c8('0x2'));var jsonpatch=require(_0x13c8('0x3'));var rp=require('request-promise');var moment=require(_0x13c8('0x4'));var BPromise=require(_0x13c8('0x5'));var Mustache=require('mustache');var util=require(_0x13c8('0x6'));var path=require(_0x13c8('0x7'));var sox=require(_0x13c8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13c8('0x9'));var _=require(_0x13c8('0xa'));var squel=require(_0x13c8('0xb'));var crypto=require(_0x13c8('0xc'));var jsforce=require(_0x13c8('0xd'));var deskjs=require(_0x13c8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x13c8('0xf'));var Redis=require(_0x13c8('0x10'));var authService=require(_0x13c8('0x11'));var qs=require(_0x13c8('0x12'));var as=require(_0x13c8('0x13'));var hardwareService=require(_0x13c8('0x14'));var logger=require(_0x13c8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x13c8('0x18'));function respondWithStatusCode(_0x3af237,_0x2a76ca){_0x2a76ca=_0x2a76ca||0xcc;return function(_0x5ed14e){if(_0x5ed14e){return _0x3af237['sendStatus'](_0x2a76ca);}return _0x3af237[_0x13c8('0x19')](_0x2a76ca)[_0x13c8('0x1a')]();};}function respondWithResult(_0x21e539,_0x34d799){_0x34d799=_0x34d799||0xc8;return function(_0x3af762){if(_0x3af762){return _0x21e539[_0x13c8('0x19')](_0x34d799)[_0x13c8('0x1b')](_0x3af762);}};}function respondWithFilteredResult(_0x4f53fc,_0x43cf2f){return function(_0x23927b){if(_0x23927b){var _0x1f6258=typeof _0x43cf2f[_0x13c8('0x1c')]==='undefined'&&typeof _0x43cf2f[_0x13c8('0x1d')]==='undefined';var _0x4595fb=_0x23927b[_0x13c8('0x1e')];var _0x5bfa75=_0x1f6258?0x0:_0x43cf2f[_0x13c8('0x1c')];var _0x56bc38=_0x1f6258?_0x23927b[_0x13c8('0x1e')]:_0x43cf2f[_0x13c8('0x1c')]+_0x43cf2f[_0x13c8('0x1d')];var _0x5e314a;if(_0x56bc38>=_0x4595fb){_0x56bc38=_0x4595fb;_0x5e314a=0xc8;}else{_0x5e314a=0xce;}_0x4f53fc[_0x13c8('0x19')](_0x5e314a);return _0x4f53fc['set'](_0x13c8('0x1f'),_0x5bfa75+'-'+_0x56bc38+'/'+_0x4595fb)[_0x13c8('0x1b')](_0x23927b);}return null;};}function patchUpdates(_0x148130){return function(_0x28e827){try{jsonpatch['apply'](_0x28e827,_0x148130,!![]);}catch(_0x100b82){return BPromise[_0x13c8('0x20')](_0x100b82);}return _0x28e827[_0x13c8('0x21')]();};}function saveUpdates(_0x48164d,_0x4369dc){return function(_0x12bd9b){if(_0x12bd9b){return _0x12bd9b[_0x13c8('0x22')](_0x48164d)[_0x13c8('0x23')](function(_0x341d33){return _0x341d33;});}return null;};}function removeEntity(_0x4f8119,_0x254044){return function(_0x572d62){if(_0x572d62){return _0x572d62[_0x13c8('0x24')]()['then'](function(){_0x4f8119['status'](0xcc)[_0x13c8('0x1a')]();});}};}function handleEntityNotFound(_0x103feb,_0x2a804f){return function(_0xf80665){if(!_0xf80665){_0x103feb[_0x13c8('0x25')](0x194);}return _0xf80665;};}function handleError(_0x221094,_0x4a6090){_0x4a6090=_0x4a6090||0x1f4;return function(_0x57d11d){logger[_0x13c8('0x26')](_0x57d11d[_0x13c8('0x27')]);if(_0x57d11d['name']){delete _0x57d11d['name'];}_0x221094[_0x13c8('0x19')](_0x4a6090)[_0x13c8('0x28')](_0x57d11d);};}exports[_0x13c8('0x29')]=function(_0x2811eb,_0x4c6ef3){var _0x54a855={},_0x50bc0a={},_0x15c69d={'count':0x0,'rows':[]};var _0x5dbb11=_[_0x13c8('0x2a')](db['FreshsalesAccount']['rawAttributes'],function(_0x3cd5a5){return{'name':_0x3cd5a5['fieldName'],'type':_0x3cd5a5[_0x13c8('0x2b')][_0x13c8('0x2c')]};});_0x50bc0a[_0x13c8('0x2d')]=_[_0x13c8('0x2a')](_0x5dbb11,'name');_0x50bc0a[_0x13c8('0x2e')]=_['keys'](_0x2811eb['query']);_0x50bc0a['filters']=_['intersection'](_0x50bc0a[_0x13c8('0x2d')],_0x50bc0a[_0x13c8('0x2e')]);_0x54a855[_0x13c8('0x2f')]=_[_0x13c8('0x30')](_0x50bc0a['model'],qs[_0x13c8('0x31')](_0x2811eb[_0x13c8('0x2e')][_0x13c8('0x31')]));_0x54a855[_0x13c8('0x2f')]=_0x54a855['attributes'][_0x13c8('0x32')]?_0x54a855[_0x13c8('0x2f')]:_0x50bc0a[_0x13c8('0x2d')];if(!_0x2811eb[_0x13c8('0x2e')][_0x13c8('0x33')](_0x13c8('0x34'))){_0x54a855[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x2811eb['query'][_0x13c8('0x1d')]);_0x54a855[_0x13c8('0x1c')]=qs['offset'](_0x2811eb['query'][_0x13c8('0x1c')]);}_0x54a855[_0x13c8('0x35')]=qs[_0x13c8('0x36')](_0x2811eb['query']['sort']);_0x54a855[_0x13c8('0x37')]=qs[_0x13c8('0x38')](_[_0x13c8('0x39')](_0x2811eb[_0x13c8('0x2e')],_0x50bc0a[_0x13c8('0x38')]),_0x5dbb11);if(_0x2811eb[_0x13c8('0x2e')][_0x13c8('0x3a')]){_0x54a855[_0x13c8('0x37')]=_[_0x13c8('0x3b')](_0x54a855[_0x13c8('0x37')],{'$or':_[_0x13c8('0x2a')](_0x5dbb11,function(_0x2f104c){if(_0x2f104c['type']!==_0x13c8('0x3c')){var _0x195fe9={};_0x195fe9[_0x2f104c[_0x13c8('0x3d')]]={'$like':'%'+_0x2811eb[_0x13c8('0x2e')][_0x13c8('0x3a')]+'%'};return _0x195fe9;}})});}_0x54a855=_['merge']({},_0x54a855,_0x2811eb[_0x13c8('0x3e')]);var _0x21db17={'where':_0x54a855[_0x13c8('0x37')]};return db[_0x13c8('0x3f')]['count'](_0x21db17)[_0x13c8('0x23')](function(_0x2a5af8){_0x15c69d[_0x13c8('0x1e')]=_0x2a5af8;if(_0x2811eb[_0x13c8('0x2e')][_0x13c8('0x40')]){_0x54a855['include']=[{'all':!![]}];}return db[_0x13c8('0x3f')][_0x13c8('0x41')](_0x54a855);})[_0x13c8('0x23')](function(_0x1a6362){_0x15c69d[_0x13c8('0x42')]=_0x1a6362;return _0x15c69d;})[_0x13c8('0x23')](respondWithFilteredResult(_0x4c6ef3,_0x54a855))[_0x13c8('0x43')](handleError(_0x4c6ef3,null));};exports['show']=function(_0x3e1e33,_0x1ddc80){var _0x33d73c={'raw':![],'where':{'id':_0x3e1e33['params']['id']}},_0xae45f={};_0xae45f[_0x13c8('0x2d')]=_[_0x13c8('0x44')](db[_0x13c8('0x3f')][_0x13c8('0x45')]);_0xae45f['query']=_[_0x13c8('0x44')](_0x3e1e33['query']);_0xae45f[_0x13c8('0x38')]=_[_0x13c8('0x30')](_0xae45f[_0x13c8('0x2d')],_0xae45f[_0x13c8('0x2e')]);_0x33d73c[_0x13c8('0x2f')]=_[_0x13c8('0x30')](_0xae45f[_0x13c8('0x2d')],qs[_0x13c8('0x31')](_0x3e1e33[_0x13c8('0x2e')][_0x13c8('0x31')]));_0x33d73c['attributes']=_0x33d73c[_0x13c8('0x2f')][_0x13c8('0x32')]?_0x33d73c[_0x13c8('0x2f')]:_0xae45f[_0x13c8('0x2d')];if(_0x3e1e33[_0x13c8('0x2e')]['includeAll']){_0x33d73c['include']=[{'all':!![]}];}_0x33d73c=_[_0x13c8('0x3b')]({},_0x33d73c,_0x3e1e33[_0x13c8('0x3e')]);return db[_0x13c8('0x3f')][_0x13c8('0x46')](_0x33d73c)[_0x13c8('0x23')](handleEntityNotFound(_0x1ddc80,null))[_0x13c8('0x23')](respondWithResult(_0x1ddc80,null))[_0x13c8('0x43')](handleError(_0x1ddc80,null));};exports['create']=function(_0x4d8396,_0x5c82d3){return db[_0x13c8('0x3f')][_0x13c8('0x47')](_0x4d8396[_0x13c8('0x48')],{})[_0x13c8('0x23')](respondWithResult(_0x5c82d3,0xc9))[_0x13c8('0x43')](handleError(_0x5c82d3,null));};exports[_0x13c8('0x22')]=function(_0x202d32,_0x5cece5){if(_0x202d32['body']['id']){delete _0x202d32[_0x13c8('0x48')]['id'];}return db[_0x13c8('0x3f')][_0x13c8('0x46')]({'where':{'id':_0x202d32[_0x13c8('0x49')]['id']}})[_0x13c8('0x23')](handleEntityNotFound(_0x5cece5,null))['then'](saveUpdates(_0x202d32[_0x13c8('0x48')],null))[_0x13c8('0x23')](respondWithResult(_0x5cece5,null))[_0x13c8('0x43')](handleError(_0x5cece5,null));};exports[_0x13c8('0x24')]=function(_0x2a2604,_0x3b52e3){return db['FreshsalesAccount']['find']({'where':{'id':_0x2a2604[_0x13c8('0x49')]['id']}})[_0x13c8('0x23')](handleEntityNotFound(_0x3b52e3,null))[_0x13c8('0x23')](removeEntity(_0x3b52e3,null))[_0x13c8('0x43')](handleError(_0x3b52e3,null));};exports[_0x13c8('0x4a')]=function(_0x19cb78,_0x3bea38,_0x31d5fa){var _0x393170={};var _0x536e47={};var _0x365c2d;var _0x3d269e;return db[_0x13c8('0x3f')]['findOne']({'where':{'id':_0x19cb78[_0x13c8('0x49')]['id']}})[_0x13c8('0x23')](handleEntityNotFound(_0x3bea38,null))[_0x13c8('0x23')](function(_0x4937fe){if(_0x4937fe){_0x365c2d=_0x4937fe;_0x536e47['model']=_[_0x13c8('0x44')](db[_0x13c8('0x4b')][_0x13c8('0x45')]);_0x536e47[_0x13c8('0x2e')]=_[_0x13c8('0x44')](_0x19cb78['query']);_0x536e47[_0x13c8('0x38')]=_[_0x13c8('0x30')](_0x536e47[_0x13c8('0x2d')],_0x536e47[_0x13c8('0x2e')]);_0x393170[_0x13c8('0x2f')]=_[_0x13c8('0x30')](_0x536e47[_0x13c8('0x2d')],qs[_0x13c8('0x31')](_0x19cb78[_0x13c8('0x2e')][_0x13c8('0x31')]));_0x393170['attributes']=_0x393170['attributes'][_0x13c8('0x32')]?_0x393170[_0x13c8('0x2f')]:_0x536e47['model'];_0x393170[_0x13c8('0x35')]=qs[_0x13c8('0x36')](_0x19cb78[_0x13c8('0x2e')][_0x13c8('0x36')]);_0x393170[_0x13c8('0x37')]=qs['filters'](_[_0x13c8('0x39')](_0x19cb78[_0x13c8('0x2e')],_0x536e47[_0x13c8('0x38')]));if(_0x19cb78['query'][_0x13c8('0x3a')]){_0x393170[_0x13c8('0x37')]=_['merge'](_0x393170[_0x13c8('0x37')],{'$or':_['map'](_0x393170[_0x13c8('0x2f')],function(_0x3a56d6){var _0x24491d={};_0x24491d[_0x3a56d6]={'$like':'%'+_0x19cb78[_0x13c8('0x2e')]['filter']+'%'};return _0x24491d;})});}_0x393170=_[_0x13c8('0x3b')]({},_0x393170,_0x19cb78[_0x13c8('0x3e')]);return _0x365c2d[_0x13c8('0x4a')](_0x393170);}})[_0x13c8('0x23')](function(_0x578c01){if(_0x578c01){_0x3d269e=_0x578c01[_0x13c8('0x32')];if(!_0x19cb78[_0x13c8('0x2e')][_0x13c8('0x33')](_0x13c8('0x34'))){_0x393170[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x19cb78[_0x13c8('0x2e')][_0x13c8('0x1d')]);_0x393170[_0x13c8('0x1c')]=qs[_0x13c8('0x1c')](_0x19cb78[_0x13c8('0x2e')][_0x13c8('0x1c')]);}return _0x365c2d[_0x13c8('0x4a')](_0x393170);}})[_0x13c8('0x23')](function(_0x23d267){if(_0x23d267){return _0x23d267?{'count':_0x3d269e,'rows':_0x23d267}:null;}})['then'](respondWithResult(_0x3bea38,null))[_0x13c8('0x43')](handleError(_0x3bea38,null));};exports['addConfiguration']=function(_0x2db89a,_0x5990c9,_0x371d30){if(_0x2db89a[_0x13c8('0x48')]['id']){delete _0x2db89a[_0x13c8('0x48')]['id'];}return db['FreshsalesAccount'][_0x13c8('0x4c')]({'where':{'id':_0x2db89a['params']['id']}})[_0x13c8('0x23')](handleEntityNotFound(_0x5990c9,null))[_0x13c8('0x23')](function(_0xcf3320){if(_0xcf3320){_0x2db89a['body']['AccountId']=_0xcf3320['id'];_0x2db89a[_0x13c8('0x48')][_0x13c8('0x4d')]=integrations[_0x13c8('0x4e')](_0x2db89a[_0x13c8('0x48')][_0x13c8('0x4f')],_0x2db89a['body'][_0x13c8('0x2b')]);_0x2db89a[_0x13c8('0x48')][_0x13c8('0x50')]=integrations['getDescriptions'](_0x2db89a[_0x13c8('0x48')][_0x13c8('0x4f')],_0x2db89a[_0x13c8('0x48')]['type']);return db[_0x13c8('0x4b')][_0x13c8('0x47')](_0x2db89a['body'],{'include':[{'model':db[_0x13c8('0x51')],'as':_0x13c8('0x4d')},{'model':db[_0x13c8('0x51')],'as':_0x13c8('0x50')}]});}return null;})[_0x13c8('0x23')](respondWithResult(_0x5990c9,null))[_0x13c8('0x43')](handleError(_0x5990c9,null));};exports[_0x13c8('0x52')]=function(_0x43db34,_0xb23e55,_0x43d0e3){var _0x42b408='';var _0x93eb0a='';return db[_0x13c8('0x3f')][_0x13c8('0x4c')]({'where':{'id':_0x43db34['params']['id']},'attributes':['id',_0x13c8('0x53'),'remoteUri',_0x13c8('0x54')]})[_0x13c8('0x23')](handleEntityNotFound(_0xb23e55,null))['then'](function(_0x373a7){if(_0x373a7){_0x93eb0a=_0x373a7['username'];_0x42b408=_0x373a7['remoteUri'];var _0x1d57c6=_0x373a7[_0x13c8('0x55')][_0x13c8('0x56')](-0x1);if(_0x1d57c6==='/'){_0x42b408=_0x42b408[_0x13c8('0x57')](0x0,_0x42b408[_0x13c8('0x58')](_0x1d57c6));}return rp({'method':_0x13c8('0x59'),'uri':util['format'](_0x13c8('0x5a'),_0x42b408,_0x13c8('0x5b')),'headers':{'Authorization':_0x13c8('0x5c')+_0x373a7[_0x13c8('0x54')]},'json':!![]});}})[_0x13c8('0x23')](function(_0x1d39d2){if(_0x1d39d2){var _0x19ff80=_0x1d39d2[_0x13c8('0x5d')];var _0x20d676=![];var _0x536d08=null;for(_0x536d08=0x0;_0x536d08<_0x19ff80[_0x13c8('0x32')];_0x536d08++){if(_0x19ff80[_0x536d08]['email']===_0x93eb0a){_0x20d676=!![];}}if(_0x20d676){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0xb23e55,null))[_0x13c8('0x43')](function(_0x2df4b5){var _0x73e1d0=_0x43db34[_0x13c8('0x2e')][_0x13c8('0x5e')]?0x1f4:_0x2df4b5[_0x13c8('0x5f')]||0x1f4;logger[_0x13c8('0x26')](_0x13c8('0x60'),_0x13c8('0x52'),_0x73e1d0,JSON[_0x13c8('0x61')](_0x2df4b5));delete _0x2df4b5['name'];if(_0x73e1d0===0x191){_0x73e1d0=0x190;}_0xb23e55[_0x13c8('0x19')](_0x73e1d0)[_0x13c8('0x28')](_0x43db34[_0x13c8('0x2e')][_0x13c8('0x5e')]?{'message':_0x13c8('0x62'),'statusCode':_0x2df4b5[_0x13c8('0x5f')]}:_0x2df4b5);});}; \ No newline at end of file +var _0xea3c=['rows','catch','show','params','FreshsalesAccount','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','addConfiguration','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','then'];(function(_0x1ea124,_0x2244b3){var _0x480f33=function(_0x287ef2){while(--_0x287ef2){_0x1ea124['push'](_0x1ea124['shift']());}};_0x480f33(++_0x2244b3);}(_0xea3c,0x14d));var _0xcea3=function(_0x173716,_0x324d5c){_0x173716=_0x173716-0x0;var _0x2cf885=_0xea3c[_0x173716];return _0x2cf885;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcea3('0x0'));var zipdir=require(_0xcea3('0x1'));var jsonpatch=require(_0xcea3('0x2'));var rp=require(_0xcea3('0x3'));var moment=require(_0xcea3('0x4'));var BPromise=require(_0xcea3('0x5'));var Mustache=require(_0xcea3('0x6'));var util=require(_0xcea3('0x7'));var path=require(_0xcea3('0x8'));var sox=require(_0xcea3('0x9'));var csv=require(_0xcea3('0xa'));var ejs=require(_0xcea3('0xb'));var fs=require('fs');var fs_extra=require(_0xcea3('0xc'));var _=require(_0xcea3('0xd'));var squel=require(_0xcea3('0xe'));var crypto=require('crypto');var jsforce=require(_0xcea3('0xf'));var deskjs=require(_0xcea3('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcea3('0x11'));var Redis=require(_0xcea3('0x12'));var authService=require(_0xcea3('0x13'));var qs=require(_0xcea3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcea3('0x15'));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(_0xcea3('0x16'))['db'];var integrations=require(_0xcea3('0x17'));function respondWithStatusCode(_0xc27c3e,_0x2142e1){_0x2142e1=_0x2142e1||0xcc;return function(_0x54fd25){if(_0x54fd25){return _0xc27c3e[_0xcea3('0x18')](_0x2142e1);}return _0xc27c3e[_0xcea3('0x19')](_0x2142e1)[_0xcea3('0x1a')]();};}function respondWithResult(_0x156301,_0x1f66b9){_0x1f66b9=_0x1f66b9||0xc8;return function(_0x271c27){if(_0x271c27){return _0x156301[_0xcea3('0x19')](_0x1f66b9)['json'](_0x271c27);}};}function respondWithFilteredResult(_0x5eeab4,_0x4d7116){return function(_0x2112db){if(_0x2112db){var _0x111844=typeof _0x4d7116[_0xcea3('0x1b')]===_0xcea3('0x1c')&&typeof _0x4d7116[_0xcea3('0x1d')]==='undefined';var _0x134a57=_0x2112db['count'];var _0x466937=_0x111844?0x0:_0x4d7116[_0xcea3('0x1b')];var _0x1fc65d=_0x111844?_0x2112db['count']:_0x4d7116[_0xcea3('0x1b')]+_0x4d7116[_0xcea3('0x1d')];var _0x5a257f;if(_0x1fc65d>=_0x134a57){_0x1fc65d=_0x134a57;_0x5a257f=0xc8;}else{_0x5a257f=0xce;}_0x5eeab4[_0xcea3('0x19')](_0x5a257f);return _0x5eeab4['set'](_0xcea3('0x1e'),_0x466937+'-'+_0x1fc65d+'/'+_0x134a57)[_0xcea3('0x1f')](_0x2112db);}return null;};}function patchUpdates(_0x529fea){return function(_0x383211){try{jsonpatch[_0xcea3('0x20')](_0x383211,_0x529fea,!![]);}catch(_0x456c6d){return BPromise[_0xcea3('0x21')](_0x456c6d);}return _0x383211[_0xcea3('0x22')]();};}function saveUpdates(_0x36c437,_0x4ee65a){return function(_0x883600){if(_0x883600){return _0x883600[_0xcea3('0x23')](_0x36c437)['then'](function(_0x3c0756){return _0x3c0756;});}return null;};}function removeEntity(_0x4d224c,_0x55607b){return function(_0x7d49b7){if(_0x7d49b7){return _0x7d49b7[_0xcea3('0x24')]()['then'](function(){_0x4d224c['status'](0xcc)[_0xcea3('0x1a')]();});}};}function handleEntityNotFound(_0x41f0b6,_0x5138b1){return function(_0x1ef498){if(!_0x1ef498){_0x41f0b6[_0xcea3('0x18')](0x194);}return _0x1ef498;};}function handleError(_0x596b08,_0x129546){_0x129546=_0x129546||0x1f4;return function(_0x15228f){logger[_0xcea3('0x25')](_0x15228f[_0xcea3('0x26')]);if(_0x15228f[_0xcea3('0x27')]){delete _0x15228f['name'];}_0x596b08[_0xcea3('0x19')](_0x129546)[_0xcea3('0x28')](_0x15228f);};}exports['index']=function(_0x248225,_0x3f321d){var _0x24f80e={},_0x4a9ccf={},_0x5859af={'count':0x0,'rows':[]};var _0x6869b0=_[_0xcea3('0x29')](db['FreshsalesAccount']['rawAttributes'],function(_0x53f77f){return{'name':_0x53f77f[_0xcea3('0x2a')],'type':_0x53f77f[_0xcea3('0x2b')][_0xcea3('0x2c')]};});_0x4a9ccf['model']=_['map'](_0x6869b0,_0xcea3('0x27'));_0x4a9ccf[_0xcea3('0x2d')]=_[_0xcea3('0x2e')](_0x248225[_0xcea3('0x2d')]);_0x4a9ccf[_0xcea3('0x2f')]=_[_0xcea3('0x30')](_0x4a9ccf['model'],_0x4a9ccf['query']);_0x24f80e[_0xcea3('0x31')]=_[_0xcea3('0x30')](_0x4a9ccf[_0xcea3('0x32')],qs[_0xcea3('0x33')](_0x248225[_0xcea3('0x2d')][_0xcea3('0x33')]));_0x24f80e[_0xcea3('0x31')]=_0x24f80e[_0xcea3('0x31')][_0xcea3('0x34')]?_0x24f80e['attributes']:_0x4a9ccf[_0xcea3('0x32')];if(!_0x248225[_0xcea3('0x2d')][_0xcea3('0x35')](_0xcea3('0x36'))){_0x24f80e[_0xcea3('0x1d')]=qs[_0xcea3('0x1d')](_0x248225[_0xcea3('0x2d')][_0xcea3('0x1d')]);_0x24f80e[_0xcea3('0x1b')]=qs['offset'](_0x248225['query']['offset']);}_0x24f80e[_0xcea3('0x37')]=qs[_0xcea3('0x38')](_0x248225[_0xcea3('0x2d')][_0xcea3('0x38')]);_0x24f80e[_0xcea3('0x39')]=qs[_0xcea3('0x2f')](_[_0xcea3('0x3a')](_0x248225[_0xcea3('0x2d')],_0x4a9ccf[_0xcea3('0x2f')]),_0x6869b0);if(_0x248225[_0xcea3('0x2d')][_0xcea3('0x3b')]){_0x24f80e[_0xcea3('0x39')]=_[_0xcea3('0x3c')](_0x24f80e['where'],{'$or':_[_0xcea3('0x29')](_0x6869b0,function(_0x504988){if(_0x504988[_0xcea3('0x2b')]!==_0xcea3('0x3d')){var _0x57af6e={};_0x57af6e[_0x504988[_0xcea3('0x27')]]={'$like':'%'+_0x248225[_0xcea3('0x2d')]['filter']+'%'};return _0x57af6e;}})});}_0x24f80e=_['merge']({},_0x24f80e,_0x248225[_0xcea3('0x3e')]);var _0x5936c6={'where':_0x24f80e[_0xcea3('0x39')]};return db['FreshsalesAccount'][_0xcea3('0x3f')](_0x5936c6)['then'](function(_0x324585){_0x5859af['count']=_0x324585;if(_0x248225[_0xcea3('0x2d')][_0xcea3('0x40')]){_0x24f80e['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0xcea3('0x41')](_0x24f80e);})[_0xcea3('0x42')](function(_0x5e9b0f){_0x5859af[_0xcea3('0x43')]=_0x5e9b0f;return _0x5859af;})[_0xcea3('0x42')](respondWithFilteredResult(_0x3f321d,_0x24f80e))[_0xcea3('0x44')](handleError(_0x3f321d,null));};exports[_0xcea3('0x45')]=function(_0x3c39b8,_0x591ee9){var _0x3e84de={'raw':![],'where':{'id':_0x3c39b8[_0xcea3('0x46')]['id']}},_0x240511={};_0x240511[_0xcea3('0x32')]=_[_0xcea3('0x2e')](db[_0xcea3('0x47')]['rawAttributes']);_0x240511['query']=_[_0xcea3('0x2e')](_0x3c39b8[_0xcea3('0x2d')]);_0x240511[_0xcea3('0x2f')]=_[_0xcea3('0x30')](_0x240511[_0xcea3('0x32')],_0x240511['query']);_0x3e84de[_0xcea3('0x31')]=_[_0xcea3('0x30')](_0x240511[_0xcea3('0x32')],qs['fields'](_0x3c39b8['query'][_0xcea3('0x33')]));_0x3e84de[_0xcea3('0x31')]=_0x3e84de[_0xcea3('0x31')][_0xcea3('0x34')]?_0x3e84de[_0xcea3('0x31')]:_0x240511[_0xcea3('0x32')];if(_0x3c39b8[_0xcea3('0x2d')][_0xcea3('0x40')]){_0x3e84de['include']=[{'all':!![]}];}_0x3e84de=_['merge']({},_0x3e84de,_0x3c39b8[_0xcea3('0x3e')]);return db['FreshsalesAccount'][_0xcea3('0x48')](_0x3e84de)['then'](handleEntityNotFound(_0x591ee9,null))[_0xcea3('0x42')](respondWithResult(_0x591ee9,null))[_0xcea3('0x44')](handleError(_0x591ee9,null));};exports['create']=function(_0x56d9f3,_0x496dd1){return db[_0xcea3('0x47')][_0xcea3('0x49')](_0x56d9f3[_0xcea3('0x4a')],{})[_0xcea3('0x42')](respondWithResult(_0x496dd1,0xc9))[_0xcea3('0x44')](handleError(_0x496dd1,null));};exports['update']=function(_0x4263b0,_0x452e54){if(_0x4263b0[_0xcea3('0x4a')]['id']){delete _0x4263b0['body']['id'];}return db[_0xcea3('0x47')]['find']({'where':{'id':_0x4263b0[_0xcea3('0x46')]['id']}})[_0xcea3('0x42')](handleEntityNotFound(_0x452e54,null))[_0xcea3('0x42')](saveUpdates(_0x4263b0[_0xcea3('0x4a')],null))[_0xcea3('0x42')](respondWithResult(_0x452e54,null))[_0xcea3('0x44')](handleError(_0x452e54,null));};exports[_0xcea3('0x24')]=function(_0x140ae3,_0x1f141f){return db['FreshsalesAccount'][_0xcea3('0x48')]({'where':{'id':_0x140ae3[_0xcea3('0x46')]['id']}})[_0xcea3('0x42')](handleEntityNotFound(_0x1f141f,null))[_0xcea3('0x42')](removeEntity(_0x1f141f,null))[_0xcea3('0x44')](handleError(_0x1f141f,null));};exports[_0xcea3('0x4b')]=function(_0x5bcaaf,_0x2f5b49,_0x5a95e9){var _0x2c6cc8={};var _0x3e1408={};var _0x243501;var _0xdaf63b;return db[_0xcea3('0x47')][_0xcea3('0x4c')]({'where':{'id':_0x5bcaaf[_0xcea3('0x46')]['id']}})[_0xcea3('0x42')](handleEntityNotFound(_0x2f5b49,null))[_0xcea3('0x42')](function(_0x2cff4a){if(_0x2cff4a){_0x243501=_0x2cff4a;_0x3e1408[_0xcea3('0x32')]=_[_0xcea3('0x2e')](db[_0xcea3('0x4d')][_0xcea3('0x4e')]);_0x3e1408[_0xcea3('0x2d')]=_[_0xcea3('0x2e')](_0x5bcaaf[_0xcea3('0x2d')]);_0x3e1408[_0xcea3('0x2f')]=_['intersection'](_0x3e1408[_0xcea3('0x32')],_0x3e1408[_0xcea3('0x2d')]);_0x2c6cc8['attributes']=_[_0xcea3('0x30')](_0x3e1408[_0xcea3('0x32')],qs['fields'](_0x5bcaaf[_0xcea3('0x2d')][_0xcea3('0x33')]));_0x2c6cc8[_0xcea3('0x31')]=_0x2c6cc8[_0xcea3('0x31')]['length']?_0x2c6cc8[_0xcea3('0x31')]:_0x3e1408[_0xcea3('0x32')];_0x2c6cc8[_0xcea3('0x37')]=qs[_0xcea3('0x38')](_0x5bcaaf[_0xcea3('0x2d')]['sort']);_0x2c6cc8[_0xcea3('0x39')]=qs[_0xcea3('0x2f')](_['pick'](_0x5bcaaf['query'],_0x3e1408[_0xcea3('0x2f')]));if(_0x5bcaaf[_0xcea3('0x2d')][_0xcea3('0x3b')]){_0x2c6cc8[_0xcea3('0x39')]=_['merge'](_0x2c6cc8['where'],{'$or':_[_0xcea3('0x29')](_0x2c6cc8[_0xcea3('0x31')],function(_0x3f4d7a){var _0x349f4b={};_0x349f4b[_0x3f4d7a]={'$like':'%'+_0x5bcaaf[_0xcea3('0x2d')][_0xcea3('0x3b')]+'%'};return _0x349f4b;})});}_0x2c6cc8=_[_0xcea3('0x3c')]({},_0x2c6cc8,_0x5bcaaf[_0xcea3('0x3e')]);return _0x243501['getConfigurations'](_0x2c6cc8);}})['then'](function(_0x25eb6e){if(_0x25eb6e){_0xdaf63b=_0x25eb6e['length'];if(!_0x5bcaaf[_0xcea3('0x2d')]['hasOwnProperty'](_0xcea3('0x36'))){_0x2c6cc8[_0xcea3('0x1d')]=qs[_0xcea3('0x1d')](_0x5bcaaf[_0xcea3('0x2d')][_0xcea3('0x1d')]);_0x2c6cc8[_0xcea3('0x1b')]=qs[_0xcea3('0x1b')](_0x5bcaaf[_0xcea3('0x2d')]['offset']);}return _0x243501[_0xcea3('0x4b')](_0x2c6cc8);}})[_0xcea3('0x42')](function(_0x6ca8c8){if(_0x6ca8c8){return _0x6ca8c8?{'count':_0xdaf63b,'rows':_0x6ca8c8}:null;}})[_0xcea3('0x42')](respondWithResult(_0x2f5b49,null))[_0xcea3('0x44')](handleError(_0x2f5b49,null));};exports[_0xcea3('0x4f')]=function(_0x1a86ba,_0x410bb2,_0x4785d7){if(_0x1a86ba[_0xcea3('0x4a')]['id']){delete _0x1a86ba[_0xcea3('0x4a')]['id'];}return db[_0xcea3('0x47')]['findOne']({'where':{'id':_0x1a86ba[_0xcea3('0x46')]['id']}})[_0xcea3('0x42')](handleEntityNotFound(_0x410bb2,null))[_0xcea3('0x42')](function(_0x4cd40e){if(_0x4cd40e){_0x1a86ba[_0xcea3('0x4a')]['AccountId']=_0x4cd40e['id'];_0x1a86ba[_0xcea3('0x4a')][_0xcea3('0x50')]=integrations['getSubjects'](_0x1a86ba[_0xcea3('0x4a')][_0xcea3('0x51')],_0x1a86ba[_0xcea3('0x4a')][_0xcea3('0x2b')]);_0x1a86ba['body'][_0xcea3('0x52')]=integrations[_0xcea3('0x53')](_0x1a86ba[_0xcea3('0x4a')][_0xcea3('0x51')],_0x1a86ba['body']['type']);return db[_0xcea3('0x4d')][_0xcea3('0x49')](_0x1a86ba[_0xcea3('0x4a')],{'include':[{'model':db[_0xcea3('0x54')],'as':_0xcea3('0x50')},{'model':db[_0xcea3('0x54')],'as':_0xcea3('0x52')}]});}return null;})['then'](respondWithResult(_0x410bb2,null))[_0xcea3('0x44')](handleError(_0x410bb2,null));};exports[_0xcea3('0x55')]=function(_0x35c5e6,_0x3955f6,_0x59605d){var _0x8b62b2='';var _0x2637c1='';return db[_0xcea3('0x47')][_0xcea3('0x4c')]({'where':{'id':_0x35c5e6[_0xcea3('0x46')]['id']},'attributes':['id',_0xcea3('0x56'),_0xcea3('0x57'),_0xcea3('0x58')]})[_0xcea3('0x42')](handleEntityNotFound(_0x3955f6,null))[_0xcea3('0x42')](function(_0x10d868){if(_0x10d868){_0x2637c1=_0x10d868['username'];_0x8b62b2=_0x10d868[_0xcea3('0x57')];var _0x1f9b47=_0x10d868[_0xcea3('0x57')][_0xcea3('0x59')](-0x1);if(_0x1f9b47==='/'){_0x8b62b2=_0x8b62b2[_0xcea3('0x5a')](0x0,_0x8b62b2[_0xcea3('0x5b')](_0x1f9b47));}return rp({'method':'GET','uri':util[_0xcea3('0x5c')](_0xcea3('0x5d'),_0x8b62b2,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x10d868['apiKey']},'json':!![]});}})[_0xcea3('0x42')](function(_0x3b7e12){if(_0x3b7e12){var _0x5160cf=_0x3b7e12[_0xcea3('0x5e')];var _0x2b319e=![];var _0x11c637=null;for(_0x11c637=0x0;_0x11c637<_0x5160cf[_0xcea3('0x34')];_0x11c637++){if(_0x5160cf[_0x11c637]['email']===_0x2637c1){_0x2b319e=!![];}}if(_0x2b319e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xcea3('0x5f')});}}})['then'](respondWithResult(_0x3955f6,null))[_0xcea3('0x44')](function(_0xb42cf7){var _0xfa1a0c=_0x35c5e6[_0xcea3('0x2d')][_0xcea3('0x60')]?0x1f4:_0xb42cf7[_0xcea3('0x61')]||0x1f4;logger['error'](_0xcea3('0x62'),_0xcea3('0x55'),_0xfa1a0c,JSON[_0xcea3('0x63')](_0xb42cf7));delete _0xb42cf7[_0xcea3('0x27')];if(_0xfa1a0c===0x191){_0xfa1a0c=0x190;}_0x3955f6[_0xcea3('0x19')](_0xfa1a0c)['send'](_0x35c5e6[_0xcea3('0x2d')][_0xcea3('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0xb42cf7[_0xcea3('0x61')]}:_0xb42cf7);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 131f510..353ebe3 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 _0x25e7=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5e5a36,_0x37593a){var _0x30f907=function(_0x518f84){while(--_0x518f84){_0x5e5a36['push'](_0x5e5a36['shift']());}};_0x30f907(++_0x37593a);}(_0x25e7,0x1d6));var _0x725e=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0x25e7[_0x3ebb04];return _0x535db0;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x725e('0xa')]=function(_0x480945,_0x481316){return _0x480945[_0x725e('0xb')](_0x725e('0xc'),attributes,{'tableName':_0x725e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb091=['request-promise','../../config/environment','./intFreshsalesAccount.attributes','exports','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment'];(function(_0x5baaa7,_0x33841f){var _0x2dc32d=function(_0xbdc453){while(--_0xbdc453){_0x5baaa7['push'](_0x5baaa7['shift']());}};_0x2dc32d(++_0x33841f);}(_0xb091,0x16e));var _0x1b09=function(_0x3450cf,_0x4690b6){_0x3450cf=_0x3450cf-0x0;var _0x1fdb87=_0xb091[_0x3450cf];return _0x1fdb87;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x1b09('0x7')]=function(_0x5fa348,_0x2bf4f6){return _0x5fa348['define'](_0x1b09('0x8'),attributes,{'tableName':_0x1b09('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 78d1bf5..ce867bd 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 _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include','map','model','ShowFreshsalesAccount','find','where'];(function(_0x3153ff,_0x5e7eef){var _0xee0560=function(_0xe2a5b1){while(--_0xe2a5b1){_0x3153ff['push'](_0x3153ff['shift']());}};_0xee0560(++_0x5e7eef);}(_0xb44a,0x1c2));var _0xab44=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xb44a[_0x92c450];return _0x2a9599;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});}exports[_0xab44('0x12')]=function(_0x354b09){var _0x44fa43=this;return new Promise(function(_0x310b15,_0xc4b3dc){return db[_0xab44('0x13')]['findAll']({'raw':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')]['where']||null:null,'attributes':_0x354b09[_0xab44('0x14')]?_0x354b09['options'][_0xab44('0x16')]||null:null,'limit':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x17')]||null:null,'include':_0x354b09['options']?_0x354b09[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x354b09[_0xab44('0x14')][_0xab44('0x18')],function(_0x402950){return{'model':db[_0x402950[_0xab44('0x1a')]],'as':_0x402950['as'],'attributes':_0x402950['attributes'],'include':_0x402950['include']?_[_0xab44('0x19')](_0x402950['include'],function(_0x2439f3){return{'model':db[_0x2439f3['model']],'as':_0x2439f3['as'],'attributes':_0x2439f3[_0xab44('0x16')],'include':_0x2439f3['include']?_['map'](_0x2439f3[_0xab44('0x18')],function(_0x25287b){return{'model':db[_0x25287b[_0xab44('0x1a')]],'as':_0x25287b['as'],'attributes':_0x25287b[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x4e820c){logger[_0xab44('0x10')](_0xab44('0x12'),_0x354b09);logger['debug'](_0xab44('0x12'),_0x354b09,JSON[_0xab44('0xc')](_0x4e820c));_0x310b15(_0x4e820c);})[_0xab44('0x11')](function(_0x1cd486){logger[_0xab44('0xd')](_0xab44('0x12'),_0x1cd486['message'],_0x354b09);_0xc4b3dc(_0x44fa43[_0xab44('0xd')](0x1f4,_0x1cd486[_0xab44('0xf')]));});});};exports[_0xab44('0x1b')]=function(_0x47e1be){var _0x54cac8=this;return new Promise(function(_0x106d3a,_0x5082e4){return db['FreshsalesAccount'][_0xab44('0x1c')]({'raw':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x1d')]||null:null,'attributes':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x16')]||null:null,'include':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x47e1be['options']['include'],function(_0x27e318){return{'model':db[_0x27e318[_0xab44('0x1a')]],'as':_0x27e318['as'],'attributes':_0x27e318['attributes'],'include':_0x27e318[_0xab44('0x18')]?_[_0xab44('0x19')](_0x27e318[_0xab44('0x18')],function(_0x1e0be7){return{'model':db[_0x1e0be7[_0xab44('0x1a')]],'as':_0x1e0be7['as'],'attributes':_0x1e0be7[_0xab44('0x16')],'include':_0x1e0be7[_0xab44('0x18')]?_[_0xab44('0x19')](_0x1e0be7[_0xab44('0x18')],function(_0xe26f9f){return{'model':db[_0xe26f9f[_0xab44('0x1a')]],'as':_0xe26f9f['as'],'attributes':_0xe26f9f[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x532aad){logger[_0xab44('0x10')](_0xab44('0x1b'),_0x47e1be);logger[_0xab44('0xb')](_0xab44('0x1b'),_0x47e1be,JSON['stringify'](_0x532aad));_0x106d3a(_0x532aad);})[_0xab44('0x11')](function(_0x31b599){logger[_0xab44('0xd')](_0xab44('0x1b'),_0x31b599['message'],_0x47e1be);_0x5082e4(_0x54cac8[_0xab44('0xd')](0x1f4,_0x31b599[_0xab44('0xf')]));});});}; \ No newline at end of file +var _0x160f=['../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')]({'raw':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b8185[_0xf160('0x19')]?_0x4b8185['options'][_0xf160('0x1b')]||null:null,'attributes':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')]['attributes']||null:null,'limit':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1c')]||null:null,'include':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1d')]?_[_0xf160('0x1e')](_0x4b8185['options'][_0xf160('0x1d')],function(_0x28bf27){return{'model':db[_0x28bf27[_0xf160('0x1f')]],'as':_0x28bf27['as'],'attributes':_0x28bf27[_0xf160('0x20')],'include':_0x28bf27['include']?_[_0xf160('0x1e')](_0x28bf27[_0xf160('0x1d')],function(_0x4a8003){return{'model':db[_0x4a8003['model']],'as':_0x4a8003['as'],'attributes':_0x4a8003[_0xf160('0x20')],'include':_0x4a8003[_0xf160('0x1d')]?_[_0xf160('0x1e')](_0x4a8003['include'],function(_0xcfa9bd){return{'model':db[_0xcfa9bd[_0xf160('0x1f')]],'as':_0xcfa9bd['as'],'attributes':_0xcfa9bd[_0xf160('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf160('0xc')](function(_0x135e0f){logger[_0xf160('0xd')]('GetFreshsalesAccount',_0x4b8185);logger['debug']('GetFreshsalesAccount',_0x4b8185,JSON[_0xf160('0x11')](_0x135e0f));_0x1cf6ba(_0x135e0f);})[_0xf160('0x15')](function(_0xcaab39){logger[_0xf160('0x12')](_0xf160('0x16'),_0xcaab39['message'],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0xcaab39[_0xf160('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4ce478){var _0x22c2e3=this;return new Promise(function(_0x3a35b3,_0x5497f6){return db[_0xf160('0x17')][_0xf160('0x21')]({'raw':_0x4ce478['options']?_0x4ce478['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ce478['options']?_0x4ce478[_0xf160('0x19')][_0xf160('0x1b')]||null:null,'attributes':_0x4ce478[_0xf160('0x19')]?_0x4ce478[_0xf160('0x19')][_0xf160('0x20')]||null:null,'include':_0x4ce478[_0xf160('0x19')]?_0x4ce478['options']['include']?_['map'](_0x4ce478[_0xf160('0x19')]['include'],function(_0x5c65d2){return{'model':db[_0x5c65d2[_0xf160('0x1f')]],'as':_0x5c65d2['as'],'attributes':_0x5c65d2[_0xf160('0x20')],'include':_0x5c65d2['include']?_[_0xf160('0x1e')](_0x5c65d2[_0xf160('0x1d')],function(_0x272efe){return{'model':db[_0x272efe[_0xf160('0x1f')]],'as':_0x272efe['as'],'attributes':_0x272efe[_0xf160('0x20')],'include':_0x272efe['include']?_[_0xf160('0x1e')](_0x272efe[_0xf160('0x1d')],function(_0x15070a){return{'model':db[_0x15070a['model']],'as':_0x15070a['as'],'attributes':_0x15070a[_0xf160('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf160('0xc')](function(_0x1e4bd6){logger[_0xf160('0xd')](_0xf160('0x22'),_0x4ce478);logger[_0xf160('0x23')]('ShowFreshsalesAccount',_0x4ce478,JSON['stringify'](_0x1e4bd6));_0x3a35b3(_0x1e4bd6);})[_0xf160('0x15')](function(_0x21c248){logger[_0xf160('0x12')](_0xf160('0x22'),_0x21c248[_0xf160('0x14')],_0x4ce478);_0x5497f6(_0x22c2e3[_0xf160('0x12')](0x1f4,_0x21c248[_0xf160('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7a5dad6..9fda687 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 _0x22d6=['/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x22d6,0x1ad));var _0x622d=function(_0x182094,_0x269200){_0x182094=_0x182094-0x0;var _0x2e74ff=_0x22d6[_0x182094];return _0x2e74ff;};'use strict';var multer=require(_0x622d('0x0'));var util=require(_0x622d('0x1'));var path=require(_0x622d('0x2'));var timeout=require(_0x622d('0x3'));var express=require(_0x622d('0x4'));var router=express[_0x622d('0x5')]();var fs_extra=require(_0x622d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x622d('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x622d('0x8')]('/',auth[_0x622d('0x9')](),controller[_0x622d('0xa')]);router[_0x622d('0x8')](_0x622d('0xb'),auth[_0x622d('0x9')](),controller[_0x622d('0xc')]);router[_0x622d('0x8')](_0x622d('0xd'),auth[_0x622d('0x9')](),controller[_0x622d('0xe')]);router[_0x622d('0x8')](_0x622d('0xf'),auth['isAuthenticated'](),controller[_0x622d('0x10')]);router[_0x622d('0x8')](_0x622d('0x11'),auth[_0x622d('0x9')](),controller[_0x622d('0x12')]);router[_0x622d('0x13')]('/',auth[_0x622d('0x9')](),controller['create']);router[_0x622d('0x14')](_0x622d('0xb'),auth[_0x622d('0x9')](),controller[_0x622d('0x15')]);router['delete']('/:id',auth[_0x622d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcac4=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','getSubjects','/:id/descriptions','/:id/fields','create','put','update','delete','destroy'];(function(_0x14eca8,_0x117cc2){var _0x5ae073=function(_0x5f5ad5){while(--_0x5f5ad5){_0x14eca8['push'](_0x14eca8['shift']());}};_0x5ae073(++_0x117cc2);}(_0xcac4,0x1e0));var _0x4cac=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xcac4[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x4cac('0x0'));var util=require(_0x4cac('0x1'));var path=require('path');var timeout=require(_0x4cac('0x2'));var express=require(_0x4cac('0x3'));var router=express['Router']();var fs_extra=require(_0x4cac('0x4'));var auth=require(_0x4cac('0x5'));var interaction=require(_0x4cac('0x6'));var config=require('../../config/environment');var controller=require(_0x4cac('0x7'));router[_0x4cac('0x8')]('/',auth[_0x4cac('0x9')](),controller[_0x4cac('0xa')]);router[_0x4cac('0x8')](_0x4cac('0xb'),auth[_0x4cac('0x9')](),controller['show']);router['get']('/:id/subjects',auth[_0x4cac('0x9')](),controller[_0x4cac('0xc')]);router[_0x4cac('0x8')](_0x4cac('0xd'),auth[_0x4cac('0x9')](),controller['getDescriptions']);router['get'](_0x4cac('0xe'),auth[_0x4cac('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x4cac('0xf')]);router[_0x4cac('0x10')](_0x4cac('0xb'),auth[_0x4cac('0x9')](),controller[_0x4cac('0x11')]);router[_0x4cac('0x12')](_0x4cac('0xb'),auth[_0x4cac('0x9')](),controller[_0x4cac('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7a9cbcd..4566cbc 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 _0x0e22=['STRING','exports'];(function(_0x4b12ae,_0xf2b3b){var _0x16957b=function(_0x51932c){while(--_0x51932c){_0x4b12ae['push'](_0x4b12ae['shift']());}};_0x16957b(++_0xf2b3b);}(_0x0e22,0x13b));var _0x20e2=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x0e22[_0xa4c85];return _0x172c1f;};'use strict';var Sequelize=require('sequelize');module[_0x20e2('0x0')]={'name':{'type':Sequelize[_0x20e2('0x1')]},'description':{'type':Sequelize[_0x20e2('0x1')]}}; \ No newline at end of file +var _0x79cd=['sequelize','exports','STRING'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x79cd,0x1ad));var _0xd79c=function(_0x44216f,_0x187779){_0x44216f=_0x44216f-0x0;var _0x3b6d3c=_0x79cd[_0x44216f];return _0x3b6d3c;};'use strict';var Sequelize=require(_0xd79c('0x0'));module[_0xd79c('0x1')]={'name':{'type':Sequelize[_0xd79c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b38afcb..3360f72 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 _0x7f17=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','getSubjects','FreshsalesField','pick','hasOwnProperty','getDescriptions','findOne','getFields','eml-format','zip-dir','fast-json-patch','request-promise','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','model'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7f17,0xbd));var _0x77f1=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0x7f17[_0x173113];return _0x3bea89;};'use strict';var emlformat=require(_0x77f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x77f1('0x1'));var jsonpatch=require(_0x77f1('0x2'));var rp=require(_0x77f1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x77f1('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x77f1('0x5'));var fs=require('fs');var fs_extra=require(_0x77f1('0x6'));var _=require(_0x77f1('0x7'));var squel=require(_0x77f1('0x8'));var crypto=require('crypto');var jsforce=require(_0x77f1('0x9'));var deskjs=require(_0x77f1('0xa'));var toCsv=require(_0x77f1('0xb'));var querystring=require(_0x77f1('0xc'));var Papa=require(_0x77f1('0xd'));var Redis=require(_0x77f1('0xe'));var authService=require(_0x77f1('0xf'));var qs=require(_0x77f1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x77f1('0x11'))(_0x77f1('0x12'));var utils=require(_0x77f1('0x13'));var config=require(_0x77f1('0x14'));var licenseUtil=require(_0x77f1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3690cc,_0x4d18e8){_0x4d18e8=_0x4d18e8||0xcc;return function(_0x2976d0){if(_0x2976d0){return _0x3690cc['sendStatus'](_0x4d18e8);}return _0x3690cc[_0x77f1('0x16')](_0x4d18e8)[_0x77f1('0x17')]();};}function respondWithResult(_0x1411d0,_0x4ba292){_0x4ba292=_0x4ba292||0xc8;return function(_0x2339af){if(_0x2339af){return _0x1411d0[_0x77f1('0x16')](_0x4ba292)['json'](_0x2339af);}};}function respondWithFilteredResult(_0xe76299,_0x2cff9f){return function(_0x5a3f01){if(_0x5a3f01){var _0x2fdcb4=typeof _0x2cff9f['offset']===_0x77f1('0x18')&&typeof _0x2cff9f[_0x77f1('0x19')]===_0x77f1('0x18');var _0xc0c21e=_0x5a3f01[_0x77f1('0x1a')];var _0x389879=_0x2fdcb4?0x0:_0x2cff9f[_0x77f1('0x1b')];var _0x2b1ab2=_0x2fdcb4?_0x5a3f01[_0x77f1('0x1a')]:_0x2cff9f['offset']+_0x2cff9f[_0x77f1('0x19')];var _0x24e34a;if(_0x2b1ab2>=_0xc0c21e){_0x2b1ab2=_0xc0c21e;_0x24e34a=0xc8;}else{_0x24e34a=0xce;}_0xe76299[_0x77f1('0x16')](_0x24e34a);return _0xe76299['set'](_0x77f1('0x1c'),_0x389879+'-'+_0x2b1ab2+'/'+_0xc0c21e)[_0x77f1('0x1d')](_0x5a3f01);}return null;};}function patchUpdates(_0xf4a054){return function(_0xe943be){try{jsonpatch[_0x77f1('0x1e')](_0xe943be,_0xf4a054,!![]);}catch(_0x30ba39){return BPromise[_0x77f1('0x1f')](_0x30ba39);}return _0xe943be[_0x77f1('0x20')]();};}function saveUpdates(_0x185181,_0x16e806){return function(_0xf4ef8e){if(_0xf4ef8e){return _0xf4ef8e[_0x77f1('0x21')](_0x185181)[_0x77f1('0x22')](function(_0x52000b){return _0x52000b;});}return null;};}function removeEntity(_0x22ab89,_0x3b60c3){return function(_0x2f4c81){if(_0x2f4c81){return _0x2f4c81['destroy']()['then'](function(){_0x22ab89[_0x77f1('0x16')](0xcc)[_0x77f1('0x17')]();});}};}function handleEntityNotFound(_0x29549e,_0x950e08){return function(_0x4447a2){if(!_0x4447a2){_0x29549e[_0x77f1('0x23')](0x194);}return _0x4447a2;};}function handleError(_0x1611a8,_0x31aa2f){_0x31aa2f=_0x31aa2f||0x1f4;return function(_0x45bb76){logger['error'](_0x45bb76[_0x77f1('0x24')]);if(_0x45bb76['name']){delete _0x45bb76[_0x77f1('0x25')];}_0x1611a8['status'](_0x31aa2f)[_0x77f1('0x26')](_0x45bb76);};}exports[_0x77f1('0x27')]=function(_0x5b2982,_0x4088ec){var _0x2fddce={},_0x2864f5={},_0x2f2f65={'count':0x0,'rows':[]};var _0x44548b=_[_0x77f1('0x28')](db[_0x77f1('0x29')][_0x77f1('0x2a')],function(_0x51f473){return{'name':_0x51f473['fieldName'],'type':_0x51f473[_0x77f1('0x2b')]['key']};});_0x2864f5[_0x77f1('0x2c')]=_[_0x77f1('0x28')](_0x44548b,_0x77f1('0x25'));_0x2864f5[_0x77f1('0x2d')]=_[_0x77f1('0x2e')](_0x5b2982[_0x77f1('0x2d')]);_0x2864f5[_0x77f1('0x2f')]=_[_0x77f1('0x30')](_0x2864f5[_0x77f1('0x2c')],_0x2864f5[_0x77f1('0x2d')]);_0x2fddce[_0x77f1('0x31')]=_[_0x77f1('0x30')](_0x2864f5[_0x77f1('0x2c')],qs[_0x77f1('0x32')](_0x5b2982[_0x77f1('0x2d')][_0x77f1('0x32')]));_0x2fddce[_0x77f1('0x31')]=_0x2fddce[_0x77f1('0x31')][_0x77f1('0x33')]?_0x2fddce[_0x77f1('0x31')]:_0x2864f5[_0x77f1('0x2c')];if(!_0x5b2982['query']['hasOwnProperty'](_0x77f1('0x34'))){_0x2fddce[_0x77f1('0x19')]=qs[_0x77f1('0x19')](_0x5b2982[_0x77f1('0x2d')][_0x77f1('0x19')]);_0x2fddce[_0x77f1('0x1b')]=qs[_0x77f1('0x1b')](_0x5b2982[_0x77f1('0x2d')][_0x77f1('0x1b')]);}_0x2fddce[_0x77f1('0x35')]=qs[_0x77f1('0x36')](_0x5b2982[_0x77f1('0x2d')][_0x77f1('0x36')]);_0x2fddce[_0x77f1('0x37')]=qs['filters'](_['pick'](_0x5b2982[_0x77f1('0x2d')],_0x2864f5[_0x77f1('0x2f')]),_0x44548b);if(_0x5b2982[_0x77f1('0x2d')]['filter']){_0x2fddce['where']=_['merge'](_0x2fddce[_0x77f1('0x37')],{'$or':_[_0x77f1('0x28')](_0x44548b,function(_0x687cb8){if(_0x687cb8[_0x77f1('0x2b')]!==_0x77f1('0x38')){var _0x1f071f={};_0x1f071f[_0x687cb8[_0x77f1('0x25')]]={'$like':'%'+_0x5b2982[_0x77f1('0x2d')][_0x77f1('0x39')]+'%'};return _0x1f071f;}})});}_0x2fddce=_[_0x77f1('0x3a')]({},_0x2fddce,_0x5b2982[_0x77f1('0x3b')]);var _0x5aeea8={'where':_0x2fddce[_0x77f1('0x37')]};return db[_0x77f1('0x29')]['count'](_0x5aeea8)[_0x77f1('0x22')](function(_0x4fc431){_0x2f2f65['count']=_0x4fc431;if(_0x5b2982['query'][_0x77f1('0x3c')]){_0x2fddce[_0x77f1('0x3d')]=[{'all':!![]}];}return db[_0x77f1('0x29')][_0x77f1('0x3e')](_0x2fddce);})[_0x77f1('0x22')](function(_0x3d6d48){_0x2f2f65[_0x77f1('0x3f')]=_0x3d6d48;return _0x2f2f65;})[_0x77f1('0x22')](respondWithFilteredResult(_0x4088ec,_0x2fddce))[_0x77f1('0x40')](handleError(_0x4088ec,null));};exports[_0x77f1('0x41')]=function(_0x1f2b83,_0x1350ef){var _0x478edf={'raw':![],'where':{'id':_0x1f2b83['params']['id']}},_0x2cadfc={};_0x2cadfc[_0x77f1('0x2c')]=_[_0x77f1('0x2e')](db[_0x77f1('0x29')][_0x77f1('0x2a')]);_0x2cadfc[_0x77f1('0x2d')]=_[_0x77f1('0x2e')](_0x1f2b83['query']);_0x2cadfc[_0x77f1('0x2f')]=_[_0x77f1('0x30')](_0x2cadfc[_0x77f1('0x2c')],_0x2cadfc[_0x77f1('0x2d')]);_0x478edf['attributes']=_[_0x77f1('0x30')](_0x2cadfc['model'],qs[_0x77f1('0x32')](_0x1f2b83[_0x77f1('0x2d')][_0x77f1('0x32')]));_0x478edf['attributes']=_0x478edf[_0x77f1('0x31')][_0x77f1('0x33')]?_0x478edf['attributes']:_0x2cadfc[_0x77f1('0x2c')];if(_0x1f2b83[_0x77f1('0x2d')]['includeAll']){_0x478edf['include']=[{'all':!![]}];}_0x478edf=_[_0x77f1('0x3a')]({},_0x478edf,_0x1f2b83[_0x77f1('0x3b')]);return db[_0x77f1('0x29')][_0x77f1('0x42')](_0x478edf)[_0x77f1('0x22')](handleEntityNotFound(_0x1350ef,null))['then'](respondWithResult(_0x1350ef,null))[_0x77f1('0x40')](handleError(_0x1350ef,null));};exports[_0x77f1('0x43')]=function(_0x2d71ed,_0x459e29){return db[_0x77f1('0x29')][_0x77f1('0x43')](_0x2d71ed['body'],{})[_0x77f1('0x22')](respondWithResult(_0x459e29,0xc9))[_0x77f1('0x40')](handleError(_0x459e29,null));};exports[_0x77f1('0x21')]=function(_0xabb2a2,_0x48f641){if(_0xabb2a2[_0x77f1('0x44')]['id']){delete _0xabb2a2[_0x77f1('0x44')]['id'];}return db[_0x77f1('0x29')][_0x77f1('0x42')]({'where':{'id':_0xabb2a2[_0x77f1('0x45')]['id']}})[_0x77f1('0x22')](handleEntityNotFound(_0x48f641,null))[_0x77f1('0x22')](saveUpdates(_0xabb2a2['body'],null))['then'](respondWithResult(_0x48f641,null))[_0x77f1('0x40')](handleError(_0x48f641,null));};exports[_0x77f1('0x46')]=function(_0x435f8b,_0xfceeb1){return db[_0x77f1('0x29')][_0x77f1('0x42')]({'where':{'id':_0x435f8b[_0x77f1('0x45')]['id']}})[_0x77f1('0x22')](handleEntityNotFound(_0xfceeb1,null))[_0x77f1('0x22')](removeEntity(_0xfceeb1,null))[_0x77f1('0x40')](handleError(_0xfceeb1,null));};exports[_0x77f1('0x47')]=function(_0x5e7ec3,_0x577120,_0x51e03f){var _0x17405c={};var _0x575da6={};var _0x5924fd;var _0x338659;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x5e7ec3['params']['id']}})[_0x77f1('0x22')](handleEntityNotFound(_0x577120,null))[_0x77f1('0x22')](function(_0x1f511c){if(_0x1f511c){_0x5924fd=_0x1f511c;_0x575da6['model']=_[_0x77f1('0x2e')](db[_0x77f1('0x48')]['rawAttributes']);_0x575da6[_0x77f1('0x2d')]=_[_0x77f1('0x2e')](_0x5e7ec3[_0x77f1('0x2d')]);_0x575da6[_0x77f1('0x2f')]=_['intersection'](_0x575da6['model'],_0x575da6[_0x77f1('0x2d')]);_0x17405c[_0x77f1('0x31')]=_[_0x77f1('0x30')](_0x575da6['model'],qs[_0x77f1('0x32')](_0x5e7ec3['query'][_0x77f1('0x32')]));_0x17405c[_0x77f1('0x31')]=_0x17405c[_0x77f1('0x31')][_0x77f1('0x33')]?_0x17405c['attributes']:_0x575da6[_0x77f1('0x2c')];_0x17405c[_0x77f1('0x35')]=qs[_0x77f1('0x36')](_0x5e7ec3[_0x77f1('0x2d')][_0x77f1('0x36')]);_0x17405c[_0x77f1('0x37')]=qs['filters'](_[_0x77f1('0x49')](_0x5e7ec3[_0x77f1('0x2d')],_0x575da6[_0x77f1('0x2f')]));if(_0x5e7ec3[_0x77f1('0x2d')][_0x77f1('0x39')]){_0x17405c[_0x77f1('0x37')]=_[_0x77f1('0x3a')](_0x17405c[_0x77f1('0x37')],{'$or':_['map'](_0x17405c['attributes'],function(_0x3054bb){var _0x1fa36a={};_0x1fa36a[_0x3054bb]={'$like':'%'+_0x5e7ec3['query'][_0x77f1('0x39')]+'%'};return _0x1fa36a;})});}_0x17405c=_['merge']({},_0x17405c,_0x5e7ec3[_0x77f1('0x3b')]);return _0x5924fd[_0x77f1('0x47')](_0x17405c);}})['then'](function(_0x3e1f42){if(_0x3e1f42){_0x338659=_0x3e1f42[_0x77f1('0x33')];if(!_0x5e7ec3[_0x77f1('0x2d')][_0x77f1('0x4a')](_0x77f1('0x34'))){_0x17405c[_0x77f1('0x19')]=qs[_0x77f1('0x19')](_0x5e7ec3['query']['limit']);_0x17405c['offset']=qs['offset'](_0x5e7ec3[_0x77f1('0x2d')][_0x77f1('0x1b')]);}return _0x5924fd[_0x77f1('0x47')](_0x17405c);}})['then'](function(_0x1b9f56){if(_0x1b9f56){return _0x1b9f56?{'count':_0x338659,'rows':_0x1b9f56}:null;}})[_0x77f1('0x22')](respondWithResult(_0x577120,null))[_0x77f1('0x40')](handleError(_0x577120,null));};exports[_0x77f1('0x4b')]=function(_0x2ecec9,_0x40ee52,_0x144447){var _0x51b5be={};var _0x5a6046={};var _0x582506;var _0x205630;return db['FreshsalesConfiguration'][_0x77f1('0x4c')]({'where':{'id':_0x2ecec9[_0x77f1('0x45')]['id']}})[_0x77f1('0x22')](handleEntityNotFound(_0x40ee52,null))['then'](function(_0x472900){if(_0x472900){_0x582506=_0x472900;_0x5a6046[_0x77f1('0x2c')]=_[_0x77f1('0x2e')](db['FreshsalesField'][_0x77f1('0x2a')]);_0x5a6046[_0x77f1('0x2d')]=_['keys'](_0x2ecec9[_0x77f1('0x2d')]);_0x5a6046[_0x77f1('0x2f')]=_[_0x77f1('0x30')](_0x5a6046[_0x77f1('0x2c')],_0x5a6046[_0x77f1('0x2d')]);_0x51b5be[_0x77f1('0x31')]=_[_0x77f1('0x30')](_0x5a6046[_0x77f1('0x2c')],qs[_0x77f1('0x32')](_0x2ecec9[_0x77f1('0x2d')][_0x77f1('0x32')]));_0x51b5be['attributes']=_0x51b5be[_0x77f1('0x31')][_0x77f1('0x33')]?_0x51b5be[_0x77f1('0x31')]:_0x5a6046['model'];_0x51b5be[_0x77f1('0x35')]=qs[_0x77f1('0x36')](_0x2ecec9[_0x77f1('0x2d')]['sort']);_0x51b5be['where']=qs['filters'](_[_0x77f1('0x49')](_0x2ecec9[_0x77f1('0x2d')],_0x5a6046[_0x77f1('0x2f')]));if(_0x2ecec9[_0x77f1('0x2d')][_0x77f1('0x39')]){_0x51b5be[_0x77f1('0x37')]=_['merge'](_0x51b5be['where'],{'$or':_[_0x77f1('0x28')](_0x51b5be[_0x77f1('0x31')],function(_0xd63196){var _0xe5c671={};_0xe5c671[_0xd63196]={'$like':'%'+_0x2ecec9[_0x77f1('0x2d')]['filter']+'%'};return _0xe5c671;})});}_0x51b5be=_[_0x77f1('0x3a')]({},_0x51b5be,_0x2ecec9[_0x77f1('0x3b')]);return _0x582506[_0x77f1('0x4b')](_0x51b5be);}})[_0x77f1('0x22')](function(_0x3215dc){if(_0x3215dc){_0x205630=_0x3215dc[_0x77f1('0x33')];if(!_0x2ecec9[_0x77f1('0x2d')][_0x77f1('0x4a')]('nolimit')){_0x51b5be[_0x77f1('0x19')]=qs[_0x77f1('0x19')](_0x2ecec9[_0x77f1('0x2d')]['limit']);_0x51b5be[_0x77f1('0x1b')]=qs[_0x77f1('0x1b')](_0x2ecec9[_0x77f1('0x2d')][_0x77f1('0x1b')]);}return _0x582506[_0x77f1('0x4b')](_0x51b5be);}})['then'](function(_0x10f252){if(_0x10f252){return _0x10f252?{'count':_0x205630,'rows':_0x10f252}:null;}})[_0x77f1('0x22')](respondWithResult(_0x40ee52,null))['catch'](handleError(_0x40ee52,null));};exports[_0x77f1('0x4d')]=function(_0x54e816,_0x226adc,_0x27a051){var _0x43eee2={};var _0x23ecdb={};var _0x2a624c;var _0x49ed3d;return db['FreshsalesConfiguration'][_0x77f1('0x4c')]({'where':{'id':_0x54e816[_0x77f1('0x45')]['id']}})['then'](handleEntityNotFound(_0x226adc,null))[_0x77f1('0x22')](function(_0x3586e3){if(_0x3586e3){_0x2a624c=_0x3586e3;_0x23ecdb[_0x77f1('0x2c')]=_['keys'](db[_0x77f1('0x48')][_0x77f1('0x2a')]);_0x23ecdb[_0x77f1('0x2d')]=_[_0x77f1('0x2e')](_0x54e816['query']);_0x23ecdb[_0x77f1('0x2f')]=_[_0x77f1('0x30')](_0x23ecdb[_0x77f1('0x2c')],_0x23ecdb[_0x77f1('0x2d')]);_0x43eee2[_0x77f1('0x31')]=_['intersection'](_0x23ecdb[_0x77f1('0x2c')],qs[_0x77f1('0x32')](_0x54e816[_0x77f1('0x2d')][_0x77f1('0x32')]));_0x43eee2[_0x77f1('0x31')]=_0x43eee2[_0x77f1('0x31')][_0x77f1('0x33')]?_0x43eee2[_0x77f1('0x31')]:_0x23ecdb[_0x77f1('0x2c')];_0x43eee2[_0x77f1('0x35')]=qs[_0x77f1('0x36')](_0x54e816[_0x77f1('0x2d')][_0x77f1('0x36')]);_0x43eee2['where']=qs[_0x77f1('0x2f')](_[_0x77f1('0x49')](_0x54e816[_0x77f1('0x2d')],_0x23ecdb[_0x77f1('0x2f')]));if(_0x54e816[_0x77f1('0x2d')][_0x77f1('0x39')]){_0x43eee2[_0x77f1('0x37')]=_['merge'](_0x43eee2['where'],{'$or':_[_0x77f1('0x28')](_0x43eee2[_0x77f1('0x31')],function(_0x49106a){var _0x5eb3b7={};_0x5eb3b7[_0x49106a]={'$like':'%'+_0x54e816['query'][_0x77f1('0x39')]+'%'};return _0x5eb3b7;})});}_0x43eee2=_[_0x77f1('0x3a')]({},_0x43eee2,_0x54e816[_0x77f1('0x3b')]);return _0x2a624c[_0x77f1('0x4d')](_0x43eee2);}})[_0x77f1('0x22')](function(_0x3e5350){if(_0x3e5350){_0x49ed3d=_0x3e5350[_0x77f1('0x33')];if(!_0x54e816[_0x77f1('0x2d')][_0x77f1('0x4a')](_0x77f1('0x34'))){_0x43eee2[_0x77f1('0x19')]=qs[_0x77f1('0x19')](_0x54e816['query'][_0x77f1('0x19')]);_0x43eee2['offset']=qs['offset'](_0x54e816[_0x77f1('0x2d')]['offset']);}return _0x2a624c['getFields'](_0x43eee2);}})[_0x77f1('0x22')](function(_0xdf8b6c){if(_0xdf8b6c){return _0xdf8b6c?{'count':_0x49ed3d,'rows':_0xdf8b6c}:null;}})[_0x77f1('0x22')](respondWithResult(_0x226adc,null))['catch'](handleError(_0x226adc,null));}; \ No newline at end of file +var _0x490e=['VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','rawAttributes','length','find','catch','create','body','destroy','getSubjects','findOne','order','pick','nolimit','getDescriptions','params','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','map','FreshsalesConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','merge'];(function(_0x598d4b,_0x11bb6f){var _0xa06696=function(_0x257c5a){while(--_0x257c5a){_0x598d4b['push'](_0x598d4b['shift']());}};_0xa06696(++_0x11bb6f);}(_0x490e,0x19e));var _0xe490=function(_0x218681,_0x16971b){_0x218681=_0x218681-0x0;var _0x56c5de=_0x490e[_0x218681];return _0x56c5de;};'use strict';var emlformat=require(_0xe490('0x0'));var rimraf=require(_0xe490('0x1'));var zipdir=require(_0xe490('0x2'));var jsonpatch=require(_0xe490('0x3'));var rp=require(_0xe490('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe490('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe490('0x6'));var csv=require(_0xe490('0x7'));var ejs=require(_0xe490('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe490('0x9'));var squel=require('squel');var crypto=require(_0xe490('0xa'));var jsforce=require(_0xe490('0xb'));var deskjs=require(_0xe490('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe490('0xd'));var Redis=require(_0xe490('0xe'));var authService=require(_0xe490('0xf'));var qs=require(_0xe490('0x10'));var as=require(_0xe490('0x11'));var hardwareService=require(_0xe490('0x12'));var logger=require(_0xe490('0x13'))('api');var utils=require(_0xe490('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe490('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247fcf,_0x30db25){_0x30db25=_0x30db25||0xcc;return function(_0xdf6f51){if(_0xdf6f51){return _0x247fcf[_0xe490('0x16')](_0x30db25);}return _0x247fcf[_0xe490('0x17')](_0x30db25)[_0xe490('0x18')]();};}function respondWithResult(_0x273cb3,_0x6523b4){_0x6523b4=_0x6523b4||0xc8;return function(_0x411940){if(_0x411940){return _0x273cb3[_0xe490('0x17')](_0x6523b4)[_0xe490('0x19')](_0x411940);}};}function respondWithFilteredResult(_0x5af21b,_0x27eae9){return function(_0x156119){if(_0x156119){var _0x59579f=typeof _0x27eae9['offset']==='undefined'&&typeof _0x27eae9['limit']===_0xe490('0x1a');var _0x46f327=_0x156119['count'];var _0x31994e=_0x59579f?0x0:_0x27eae9['offset'];var _0x20df8a=_0x59579f?_0x156119[_0xe490('0x1b')]:_0x27eae9[_0xe490('0x1c')]+_0x27eae9[_0xe490('0x1d')];var _0x4af680;if(_0x20df8a>=_0x46f327){_0x20df8a=_0x46f327;_0x4af680=0xc8;}else{_0x4af680=0xce;}_0x5af21b[_0xe490('0x17')](_0x4af680);return _0x5af21b[_0xe490('0x1e')](_0xe490('0x1f'),_0x31994e+'-'+_0x20df8a+'/'+_0x46f327)[_0xe490('0x19')](_0x156119);}return null;};}function patchUpdates(_0x26dc3f){return function(_0x34d3e5){try{jsonpatch[_0xe490('0x20')](_0x34d3e5,_0x26dc3f,!![]);}catch(_0x503bff){return BPromise[_0xe490('0x21')](_0x503bff);}return _0x34d3e5[_0xe490('0x22')]();};}function saveUpdates(_0x383216,_0x1a811b){return function(_0x2dfb56){if(_0x2dfb56){return _0x2dfb56[_0xe490('0x23')](_0x383216)[_0xe490('0x24')](function(_0x23c8bb){return _0x23c8bb;});}return null;};}function removeEntity(_0xca2d51,_0x423306){return function(_0x19dc3a){if(_0x19dc3a){return _0x19dc3a['destroy']()[_0xe490('0x24')](function(){_0xca2d51[_0xe490('0x17')](0xcc)[_0xe490('0x18')]();});}};}function handleEntityNotFound(_0x53b283,_0x156155){return function(_0x48ae62){if(!_0x48ae62){_0x53b283[_0xe490('0x16')](0x194);}return _0x48ae62;};}function handleError(_0x49d3b8,_0x2139b4){_0x2139b4=_0x2139b4||0x1f4;return function(_0x1d7357){logger['error'](_0x1d7357[_0xe490('0x25')]);if(_0x1d7357['name']){delete _0x1d7357[_0xe490('0x26')];}_0x49d3b8[_0xe490('0x17')](_0x2139b4)['send'](_0x1d7357);};}exports['index']=function(_0x1c6f90,_0x16166e){var _0x47e865={},_0x504007={},_0x53cd84={'count':0x0,'rows':[]};var _0x1b3fa6=_[_0xe490('0x27')](db[_0xe490('0x28')]['rawAttributes'],function(_0x4d8231){return{'name':_0x4d8231[_0xe490('0x29')],'type':_0x4d8231[_0xe490('0x2a')][_0xe490('0x2b')]};});_0x504007[_0xe490('0x2c')]=_['map'](_0x1b3fa6,'name');_0x504007[_0xe490('0x2d')]=_['keys'](_0x1c6f90['query']);_0x504007[_0xe490('0x2e')]=_[_0xe490('0x2f')](_0x504007[_0xe490('0x2c')],_0x504007[_0xe490('0x2d')]);_0x47e865[_0xe490('0x30')]=_[_0xe490('0x2f')](_0x504007[_0xe490('0x2c')],qs[_0xe490('0x31')](_0x1c6f90['query'][_0xe490('0x31')]));_0x47e865[_0xe490('0x30')]=_0x47e865[_0xe490('0x30')]['length']?_0x47e865['attributes']:_0x504007['model'];if(!_0x1c6f90[_0xe490('0x2d')][_0xe490('0x32')]('nolimit')){_0x47e865['limit']=qs['limit'](_0x1c6f90[_0xe490('0x2d')][_0xe490('0x1d')]);_0x47e865[_0xe490('0x1c')]=qs['offset'](_0x1c6f90[_0xe490('0x2d')][_0xe490('0x1c')]);}_0x47e865['order']=qs[_0xe490('0x33')](_0x1c6f90[_0xe490('0x2d')][_0xe490('0x33')]);_0x47e865[_0xe490('0x34')]=qs[_0xe490('0x2e')](_['pick'](_0x1c6f90[_0xe490('0x2d')],_0x504007[_0xe490('0x2e')]),_0x1b3fa6);if(_0x1c6f90[_0xe490('0x2d')]['filter']){_0x47e865['where']=_[_0xe490('0x35')](_0x47e865['where'],{'$or':_[_0xe490('0x27')](_0x1b3fa6,function(_0x482afb){if(_0x482afb[_0xe490('0x2a')]!==_0xe490('0x36')){var _0x60eb96={};_0x60eb96[_0x482afb[_0xe490('0x26')]]={'$like':'%'+_0x1c6f90['query'][_0xe490('0x37')]+'%'};return _0x60eb96;}})});}_0x47e865=_[_0xe490('0x35')]({},_0x47e865,_0x1c6f90[_0xe490('0x38')]);var _0x52a931={'where':_0x47e865[_0xe490('0x34')]};return db['FreshsalesConfiguration'][_0xe490('0x1b')](_0x52a931)['then'](function(_0x49dce2){_0x53cd84['count']=_0x49dce2;if(_0x1c6f90[_0xe490('0x2d')][_0xe490('0x39')]){_0x47e865['include']=[{'all':!![]}];}return db[_0xe490('0x28')][_0xe490('0x3a')](_0x47e865);})[_0xe490('0x24')](function(_0xa54012){_0x53cd84[_0xe490('0x3b')]=_0xa54012;return _0x53cd84;})['then'](respondWithFilteredResult(_0x16166e,_0x47e865))['catch'](handleError(_0x16166e,null));};exports[_0xe490('0x3c')]=function(_0x3b0b28,_0x3cbbeb){var _0x1de3ec={'raw':![],'where':{'id':_0x3b0b28['params']['id']}},_0x5b0f07={};_0x5b0f07[_0xe490('0x2c')]=_[_0xe490('0x3d')](db[_0xe490('0x28')][_0xe490('0x3e')]);_0x5b0f07['query']=_[_0xe490('0x3d')](_0x3b0b28['query']);_0x5b0f07[_0xe490('0x2e')]=_[_0xe490('0x2f')](_0x5b0f07[_0xe490('0x2c')],_0x5b0f07[_0xe490('0x2d')]);_0x1de3ec[_0xe490('0x30')]=_['intersection'](_0x5b0f07[_0xe490('0x2c')],qs[_0xe490('0x31')](_0x3b0b28[_0xe490('0x2d')][_0xe490('0x31')]));_0x1de3ec['attributes']=_0x1de3ec[_0xe490('0x30')][_0xe490('0x3f')]?_0x1de3ec[_0xe490('0x30')]:_0x5b0f07[_0xe490('0x2c')];if(_0x3b0b28[_0xe490('0x2d')][_0xe490('0x39')]){_0x1de3ec['include']=[{'all':!![]}];}_0x1de3ec=_['merge']({},_0x1de3ec,_0x3b0b28['options']);return db[_0xe490('0x28')][_0xe490('0x40')](_0x1de3ec)['then'](handleEntityNotFound(_0x3cbbeb,null))[_0xe490('0x24')](respondWithResult(_0x3cbbeb,null))[_0xe490('0x41')](handleError(_0x3cbbeb,null));};exports[_0xe490('0x42')]=function(_0x2f776a,_0x322e23){return db[_0xe490('0x28')][_0xe490('0x42')](_0x2f776a[_0xe490('0x43')],{})['then'](respondWithResult(_0x322e23,0xc9))[_0xe490('0x41')](handleError(_0x322e23,null));};exports[_0xe490('0x23')]=function(_0x1923b9,_0x20010a){if(_0x1923b9['body']['id']){delete _0x1923b9[_0xe490('0x43')]['id'];}return db['FreshsalesConfiguration'][_0xe490('0x40')]({'where':{'id':_0x1923b9['params']['id']}})['then'](handleEntityNotFound(_0x20010a,null))[_0xe490('0x24')](saveUpdates(_0x1923b9[_0xe490('0x43')],null))[_0xe490('0x24')](respondWithResult(_0x20010a,null))[_0xe490('0x41')](handleError(_0x20010a,null));};exports[_0xe490('0x44')]=function(_0x5705c6,_0x139e73){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x5705c6['params']['id']}})[_0xe490('0x24')](handleEntityNotFound(_0x139e73,null))[_0xe490('0x24')](removeEntity(_0x139e73,null))[_0xe490('0x41')](handleError(_0x139e73,null));};exports[_0xe490('0x45')]=function(_0x37aae2,_0x3b60d5,_0x2ce725){var _0x4b4499={};var _0x1ddb85={};var _0x1b9154;var _0xd4254d;return db['FreshsalesConfiguration'][_0xe490('0x46')]({'where':{'id':_0x37aae2['params']['id']}})[_0xe490('0x24')](handleEntityNotFound(_0x3b60d5,null))[_0xe490('0x24')](function(_0x52713d){if(_0x52713d){_0x1b9154=_0x52713d;_0x1ddb85['model']=_[_0xe490('0x3d')](db['FreshsalesField'][_0xe490('0x3e')]);_0x1ddb85[_0xe490('0x2d')]=_[_0xe490('0x3d')](_0x37aae2[_0xe490('0x2d')]);_0x1ddb85['filters']=_[_0xe490('0x2f')](_0x1ddb85[_0xe490('0x2c')],_0x1ddb85[_0xe490('0x2d')]);_0x4b4499['attributes']=_[_0xe490('0x2f')](_0x1ddb85['model'],qs['fields'](_0x37aae2[_0xe490('0x2d')]['fields']));_0x4b4499[_0xe490('0x30')]=_0x4b4499[_0xe490('0x30')][_0xe490('0x3f')]?_0x4b4499[_0xe490('0x30')]:_0x1ddb85['model'];_0x4b4499[_0xe490('0x47')]=qs[_0xe490('0x33')](_0x37aae2[_0xe490('0x2d')][_0xe490('0x33')]);_0x4b4499[_0xe490('0x34')]=qs['filters'](_[_0xe490('0x48')](_0x37aae2[_0xe490('0x2d')],_0x1ddb85['filters']));if(_0x37aae2['query'][_0xe490('0x37')]){_0x4b4499['where']=_['merge'](_0x4b4499[_0xe490('0x34')],{'$or':_[_0xe490('0x27')](_0x4b4499[_0xe490('0x30')],function(_0x12765d){var _0x1a7db5={};_0x1a7db5[_0x12765d]={'$like':'%'+_0x37aae2[_0xe490('0x2d')][_0xe490('0x37')]+'%'};return _0x1a7db5;})});}_0x4b4499=_[_0xe490('0x35')]({},_0x4b4499,_0x37aae2[_0xe490('0x38')]);return _0x1b9154['getSubjects'](_0x4b4499);}})[_0xe490('0x24')](function(_0x26b653){if(_0x26b653){_0xd4254d=_0x26b653['length'];if(!_0x37aae2[_0xe490('0x2d')][_0xe490('0x32')](_0xe490('0x49'))){_0x4b4499[_0xe490('0x1d')]=qs[_0xe490('0x1d')](_0x37aae2['query']['limit']);_0x4b4499[_0xe490('0x1c')]=qs[_0xe490('0x1c')](_0x37aae2[_0xe490('0x2d')]['offset']);}return _0x1b9154[_0xe490('0x45')](_0x4b4499);}})[_0xe490('0x24')](function(_0x497500){if(_0x497500){return _0x497500?{'count':_0xd4254d,'rows':_0x497500}:null;}})[_0xe490('0x24')](respondWithResult(_0x3b60d5,null))[_0xe490('0x41')](handleError(_0x3b60d5,null));};exports[_0xe490('0x4a')]=function(_0x4f0a37,_0x4e895b,_0x1f9a78){var _0x74c4d={};var _0x255f4f={};var _0x2776de;var _0x27331c;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4f0a37[_0xe490('0x4b')]['id']}})[_0xe490('0x24')](handleEntityNotFound(_0x4e895b,null))[_0xe490('0x24')](function(_0x36ab8a){if(_0x36ab8a){_0x2776de=_0x36ab8a;_0x255f4f[_0xe490('0x2c')]=_[_0xe490('0x3d')](db[_0xe490('0x4c')][_0xe490('0x3e')]);_0x255f4f['query']=_[_0xe490('0x3d')](_0x4f0a37[_0xe490('0x2d')]);_0x255f4f['filters']=_[_0xe490('0x2f')](_0x255f4f['model'],_0x255f4f[_0xe490('0x2d')]);_0x74c4d[_0xe490('0x30')]=_[_0xe490('0x2f')](_0x255f4f['model'],qs[_0xe490('0x31')](_0x4f0a37[_0xe490('0x2d')][_0xe490('0x31')]));_0x74c4d[_0xe490('0x30')]=_0x74c4d[_0xe490('0x30')][_0xe490('0x3f')]?_0x74c4d[_0xe490('0x30')]:_0x255f4f[_0xe490('0x2c')];_0x74c4d['order']=qs['sort'](_0x4f0a37['query'][_0xe490('0x33')]);_0x74c4d['where']=qs[_0xe490('0x2e')](_['pick'](_0x4f0a37[_0xe490('0x2d')],_0x255f4f['filters']));if(_0x4f0a37[_0xe490('0x2d')]['filter']){_0x74c4d['where']=_['merge'](_0x74c4d[_0xe490('0x34')],{'$or':_[_0xe490('0x27')](_0x74c4d['attributes'],function(_0x1ecc58){var _0x4252ba={};_0x4252ba[_0x1ecc58]={'$like':'%'+_0x4f0a37[_0xe490('0x2d')][_0xe490('0x37')]+'%'};return _0x4252ba;})});}_0x74c4d=_['merge']({},_0x74c4d,_0x4f0a37[_0xe490('0x38')]);return _0x2776de[_0xe490('0x4a')](_0x74c4d);}})[_0xe490('0x24')](function(_0x2f9cc0){if(_0x2f9cc0){_0x27331c=_0x2f9cc0[_0xe490('0x3f')];if(!_0x4f0a37[_0xe490('0x2d')][_0xe490('0x32')](_0xe490('0x49'))){_0x74c4d[_0xe490('0x1d')]=qs[_0xe490('0x1d')](_0x4f0a37[_0xe490('0x2d')][_0xe490('0x1d')]);_0x74c4d[_0xe490('0x1c')]=qs[_0xe490('0x1c')](_0x4f0a37[_0xe490('0x2d')][_0xe490('0x1c')]);}return _0x2776de[_0xe490('0x4a')](_0x74c4d);}})[_0xe490('0x24')](function(_0x414d5b){if(_0x414d5b){return _0x414d5b?{'count':_0x27331c,'rows':_0x414d5b}:null;}})[_0xe490('0x24')](respondWithResult(_0x4e895b,null))['catch'](handleError(_0x4e895b,null));};exports[_0xe490('0x4d')]=function(_0xdd57c8,_0xe35e4c,_0x544a3a){var _0x3c2612={};var _0x4b5fda={};var _0x55c6d1;var _0x50463b;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0xdd57c8['params']['id']}})[_0xe490('0x24')](handleEntityNotFound(_0xe35e4c,null))[_0xe490('0x24')](function(_0x15400c){if(_0x15400c){_0x55c6d1=_0x15400c;_0x4b5fda[_0xe490('0x2c')]=_[_0xe490('0x3d')](db[_0xe490('0x4c')]['rawAttributes']);_0x4b5fda[_0xe490('0x2d')]=_[_0xe490('0x3d')](_0xdd57c8[_0xe490('0x2d')]);_0x4b5fda[_0xe490('0x2e')]=_['intersection'](_0x4b5fda[_0xe490('0x2c')],_0x4b5fda[_0xe490('0x2d')]);_0x3c2612[_0xe490('0x30')]=_[_0xe490('0x2f')](_0x4b5fda[_0xe490('0x2c')],qs[_0xe490('0x31')](_0xdd57c8[_0xe490('0x2d')]['fields']));_0x3c2612[_0xe490('0x30')]=_0x3c2612[_0xe490('0x30')][_0xe490('0x3f')]?_0x3c2612[_0xe490('0x30')]:_0x4b5fda[_0xe490('0x2c')];_0x3c2612[_0xe490('0x47')]=qs['sort'](_0xdd57c8[_0xe490('0x2d')]['sort']);_0x3c2612['where']=qs[_0xe490('0x2e')](_[_0xe490('0x48')](_0xdd57c8[_0xe490('0x2d')],_0x4b5fda[_0xe490('0x2e')]));if(_0xdd57c8['query'][_0xe490('0x37')]){_0x3c2612['where']=_[_0xe490('0x35')](_0x3c2612[_0xe490('0x34')],{'$or':_[_0xe490('0x27')](_0x3c2612['attributes'],function(_0x354df5){var _0x44f515={};_0x44f515[_0x354df5]={'$like':'%'+_0xdd57c8[_0xe490('0x2d')][_0xe490('0x37')]+'%'};return _0x44f515;})});}_0x3c2612=_[_0xe490('0x35')]({},_0x3c2612,_0xdd57c8['options']);return _0x55c6d1[_0xe490('0x4d')](_0x3c2612);}})[_0xe490('0x24')](function(_0x3d6151){if(_0x3d6151){_0x50463b=_0x3d6151[_0xe490('0x3f')];if(!_0xdd57c8['query'][_0xe490('0x32')](_0xe490('0x49'))){_0x3c2612['limit']=qs[_0xe490('0x1d')](_0xdd57c8['query'][_0xe490('0x1d')]);_0x3c2612['offset']=qs['offset'](_0xdd57c8[_0xe490('0x2d')][_0xe490('0x1c')]);}return _0x55c6d1[_0xe490('0x4d')](_0x3c2612);}})[_0xe490('0x24')](function(_0x3b510a){if(_0x3b510a){return _0x3b510a?{'count':_0x50463b,'rows':_0x3b510a}:null;}})[_0xe490('0x24')](respondWithResult(_0xe35e4c,null))[_0xe490('0x41')](handleError(_0xe35e4c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d8a7511..70aa033 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 _0xd51e=['define','FreshsalesConfiguration','int_freshsales_configurations','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x45842b,_0x4071ff){var _0x3745bc=function(_0x25a27b){while(--_0x25a27b){_0x45842b['push'](_0x45842b['shift']());}};_0x3745bc(++_0x4071ff);}(_0xd51e,0xb7));var _0xed51=function(_0x441038,_0x318ade){_0x441038=_0x441038-0x0;var _0x373b31=_0xd51e[_0x441038];return _0x373b31;};'use strict';var _=require('lodash');var util=require(_0xed51('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xed51('0x1'));var BPromise=require(_0xed51('0x2'));var rp=require(_0xed51('0x3'));var fs=require('fs');var path=require(_0xed51('0x4'));var rimraf=require(_0xed51('0x5'));var config=require(_0xed51('0x6'));var attributes=require(_0xed51('0x7'));module[_0xed51('0x8')]=function(_0x3a6e3c,_0x59c234){return _0x3a6e3c[_0xed51('0x9')](_0xed51('0xa'),attributes,{'tableName':_0xed51('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3138=['util','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','lodash'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x3138,0x12b));var _0x8313=function(_0x43c8c0,_0x57e0b7){_0x43c8c0=_0x43c8c0-0x0;var _0x23cb8c=_0x3138[_0x43c8c0];return _0x23cb8c;};'use strict';var _=require(_0x8313('0x0'));var util=require(_0x8313('0x1'));var logger=require('../../config/logger')(_0x8313('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8313('0x3'));var fs=require('fs');var path=require(_0x8313('0x4'));var rimraf=require(_0x8313('0x5'));var config=require(_0x8313('0x6'));var attributes=require(_0x8313('0x7'));module['exports']=function(_0x13507d,_0x14f02c){return _0x13507d[_0x8313('0x8')](_0x8313('0x9'),attributes,{'tableName':'int_freshsales_configurations','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 c91a573..a0b7b96 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 _0x470e=['util','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x1ac117,_0x66f6d5){var _0x1e31cb=function(_0x5a34a8){while(--_0x5a34a8){_0x1ac117['push'](_0x1ac117['shift']());}};_0x1e31cb(++_0x66f6d5);}(_0x470e,0x17c));var _0xe470=function(_0x5cbb32,_0x233ace){_0x5cbb32=_0x5cbb32-0x0;var _0x49363c=_0x470e[_0x5cbb32];return _0x49363c;};'use strict';var _=require('lodash');var util=require(_0xe470('0x0'));var moment=require('moment');var BPromise=require(_0xe470('0x1'));var rs=require(_0xe470('0x2'));var fs=require('fs');var Redis=require(_0xe470('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe470('0x4'));var config=require(_0xe470('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe470('0x6')][_0xe470('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5df946,_0x346d84,_0x4e1eea){return new BPromise(function(_0x2054ee,_0x52a091){return client[_0xe470('0x8')](_0x5df946,_0x4e1eea)[_0xe470('0x9')](function(_0x4df72c){logger['info'](_0xe470('0xa'),_0x346d84,_0xe470('0xb'));logger[_0xe470('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x346d84,_0xe470('0xb'),JSON[_0xe470('0xd')](_0x4df72c));if(_0x4df72c[_0xe470('0xe')]){if(_0x4df72c['error'][_0xe470('0xf')]===0x1f4){logger[_0xe470('0xe')](_0xe470('0xa'),_0x346d84,_0x4df72c[_0xe470('0xe')][_0xe470('0x10')]);return _0x52a091(_0x4df72c[_0xe470('0xe')][_0xe470('0x10')]);}logger[_0xe470('0xe')](_0xe470('0xa'),_0x346d84,_0x4df72c[_0xe470('0xe')][_0xe470('0x10')]);return _0x2054ee(_0x4df72c['error'][_0xe470('0x10')]);}else{logger[_0xe470('0x11')](_0xe470('0xa'),_0x346d84,_0xe470('0xb'));_0x2054ee(_0x4df72c[_0xe470('0x12')][_0xe470('0x10')]);}})[_0xe470('0x13')](function(_0xd4a395){logger[_0xe470('0xe')](_0xe470('0xa'),_0x346d84,_0xd4a395);_0x52a091(_0xd4a395);});});} \ No newline at end of file +var _0xfaa3=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfaa3,0x19d));var _0x3faa=function(_0x50caa1,_0x241d11){_0x50caa1=_0x50caa1-0x0;var _0xa2a377=_0xfaa3[_0x50caa1];return _0xa2a377;};'use strict';var _=require('lodash');var util=require(_0x3faa('0x0'));var moment=require(_0x3faa('0x1'));var BPromise=require(_0x3faa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3faa('0x3'));var db=require(_0x3faa('0x4'))['db'];var utils=require(_0x3faa('0x5'));var logger=require(_0x3faa('0x6'))(_0x3faa('0x7'));var config=require(_0x3faa('0x8'));var jayson=require(_0x3faa('0x9'));var client=jayson[_0x3faa('0xa')][_0x3faa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbbcb3b,_0x5e4463,_0x36b65f){return new BPromise(function(_0x54036f,_0x4cc317){return client[_0x3faa('0xc')](_0xbbcb3b,_0x36b65f)[_0x3faa('0xd')](function(_0x513ced){logger[_0x3faa('0xe')](_0x3faa('0xf'),_0x5e4463,_0x3faa('0x10'));logger['debug'](_0x3faa('0x11'),_0x5e4463,_0x3faa('0x10'),JSON[_0x3faa('0x12')](_0x513ced));if(_0x513ced[_0x3faa('0x13')]){if(_0x513ced[_0x3faa('0x13')][_0x3faa('0x14')]===0x1f4){logger[_0x3faa('0x13')](_0x3faa('0xf'),_0x5e4463,_0x513ced[_0x3faa('0x13')][_0x3faa('0x15')]);return _0x4cc317(_0x513ced[_0x3faa('0x13')][_0x3faa('0x15')]);}logger[_0x3faa('0x13')](_0x3faa('0xf'),_0x5e4463,_0x513ced[_0x3faa('0x13')][_0x3faa('0x15')]);return _0x54036f(_0x513ced['error'][_0x3faa('0x15')]);}else{logger[_0x3faa('0xe')](_0x3faa('0xf'),_0x5e4463,_0x3faa('0x10'));_0x54036f(_0x513ced[_0x3faa('0x16')][_0x3faa('0x15')]);}})[_0x3faa('0x17')](function(_0x2d0568){logger[_0x3faa('0x13')](_0x3faa('0xf'),_0x5e4463,_0x2d0568);_0x4cc317(_0x2d0568);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index bd8051f..1920fe9 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 _0xca8d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3f1273,_0x297dc7){var _0x480884=function(_0x394ab9){while(--_0x394ab9){_0x3f1273['push'](_0x3f1273['shift']());}};_0x480884(++_0x297dc7);}(_0xca8d,0x172));var _0xdca8=function(_0x2335bd,_0x54e892){_0x2335bd=_0x2335bd-0x0;var _0x2aac2c=_0xca8d[_0x2335bd];return _0x2aac2c;};'use strict';var multer=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var path=require(_0xdca8('0x2'));var timeout=require(_0xdca8('0x3'));var express=require(_0xdca8('0x4'));var router=express[_0xdca8('0x5')]();var fs_extra=require(_0xdca8('0x6'));var auth=require(_0xdca8('0x7'));var interaction=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var controller=require(_0xdca8('0xa'));router[_0xdca8('0xb')]('/',auth['isAuthenticated'](),controller[_0xdca8('0xc')]);router[_0xdca8('0xb')](_0xdca8('0xd'),auth[_0xdca8('0xe')](),controller[_0xdca8('0xf')]);router['post']('/',auth[_0xdca8('0xe')](),controller[_0xdca8('0x10')]);router[_0xdca8('0x11')]('/:id',auth[_0xdca8('0xe')](),controller[_0xdca8('0x12')]);router[_0xdca8('0x13')](_0xdca8('0xd'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x14')]);module[_0xdca8('0x15')]=router; \ No newline at end of file +var _0xbc8b=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete'];(function(_0x30a9b2,_0x2b0d43){var _0x3ba5a4=function(_0x5eeddc){while(--_0x5eeddc){_0x30a9b2['push'](_0x30a9b2['shift']());}};_0x3ba5a4(++_0x2b0d43);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0xbc8b[_0x4884a7];return _0x56b60e;};'use strict';var multer=require('multer');var util=require(_0xbbc8('0x0'));var path=require('path');var timeout=require(_0xbbc8('0x1'));var express=require(_0xbbc8('0x2'));var router=express[_0xbbc8('0x3')]();var fs_extra=require(_0xbbc8('0x4'));var auth=require(_0xbbc8('0x5'));var interaction=require(_0xbbc8('0x6'));var config=require('../../config/environment');var controller=require(_0xbbc8('0x7'));router[_0xbbc8('0x8')]('/',auth[_0xbbc8('0x9')](),controller[_0xbbc8('0xa')]);router[_0xbbc8('0x8')]('/:id',auth[_0xbbc8('0x9')](),controller[_0xbbc8('0xb')]);router['post']('/',auth[_0xbbc8('0x9')](),controller[_0xbbc8('0xc')]);router[_0xbbc8('0xd')](_0xbbc8('0xe'),auth[_0xbbc8('0x9')](),controller[_0xbbc8('0xf')]);router[_0xbbc8('0x10')](_0xbbc8('0xe'),auth[_0xbbc8('0x9')](),controller[_0xbbc8('0x11')]);module[_0xbbc8('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f937db1..2486316 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 _0xdfc8=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x280604,_0x528d29){var _0x1f659b=function(_0x3f6ae2){while(--_0x3f6ae2){_0x280604['push'](_0x280604['shift']());}};_0x1f659b(++_0x528d29);}(_0xdfc8,0x97));var _0x8dfc=function(_0x55746b,_0x288396){_0x55746b=_0x55746b-0x0;var _0x5bf12c=_0xdfc8[_0x55746b];return _0x5bf12c;};'use strict';var Sequelize=require(_0x8dfc('0x0'));module[_0x8dfc('0x1')]={'type':{'type':Sequelize[_0x8dfc('0x2')](_0x8dfc('0x3'),_0x8dfc('0x4'),_0x8dfc('0x5'),_0x8dfc('0x6'),_0x8dfc('0x7')),'defaultValue':_0x8dfc('0x3')},'content':{'type':Sequelize[_0x8dfc('0x8')]},'key':{'type':Sequelize[_0x8dfc('0x8')]},'keyType':{'type':Sequelize[_0x8dfc('0x2')]('string',_0x8dfc('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8dfc('0x8')]},'idField':{'type':Sequelize[_0x8dfc('0x8')]},'nameField':{'type':Sequelize[_0x8dfc('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd502=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports'];(function(_0x14d717,_0x3f85f9){var _0x50775b=function(_0x4425aa){while(--_0x4425aa){_0x14d717['push'](_0x14d717['shift']());}};_0x50775b(++_0x3f85f9);}(_0xd502,0x1a5));var _0x2d50=function(_0x2f31b1,_0x17daa8){_0x2f31b1=_0x2f31b1-0x0;var _0x448988=_0xd502[_0x2f31b1];return _0x448988;};'use strict';var Sequelize=require(_0x2d50('0x0'));module[_0x2d50('0x1')]={'type':{'type':Sequelize[_0x2d50('0x2')](_0x2d50('0x3'),'variable',_0x2d50('0x4'),_0x2d50('0x5'),_0x2d50('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2d50('0x7')]},'keyType':{'type':Sequelize[_0x2d50('0x2')](_0x2d50('0x3'),_0x2d50('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x2d50('0x7')]},'idField':{'type':Sequelize[_0x2d50('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d50('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 006eb1f..80e68f9 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 _0xff4f=['zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','length','include','find','create','body','catch','eml-format','rimraf'];(function(_0x52527e,_0x3d30db){var _0x13f973=function(_0x538e9e){while(--_0x538e9e){_0x52527e['push'](_0x52527e['shift']());}};_0x13f973(++_0x3d30db);}(_0xff4f,0x157));var _0xfff4=function(_0x149814,_0x39cc47){_0x149814=_0x149814-0x0;var _0xa83b4f=_0xff4f[_0x149814];return _0xa83b4f;};'use strict';var emlformat=require(_0xfff4('0x0'));var rimraf=require(_0xfff4('0x1'));var zipdir=require(_0xfff4('0x2'));var jsonpatch=require(_0xfff4('0x3'));var rp=require(_0xfff4('0x4'));var moment=require('moment');var BPromise=require(_0xfff4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfff4('0x6'));var sox=require(_0xfff4('0x7'));var csv=require(_0xfff4('0x8'));var ejs=require(_0xfff4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfff4('0xa'));var crypto=require(_0xfff4('0xb'));var jsforce=require(_0xfff4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfff4('0x8'));var querystring=require(_0xfff4('0xd'));var Papa=require('papaparse');var Redis=require(_0xfff4('0xe'));var authService=require(_0xfff4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfff4('0x10'));var config=require(_0xfff4('0x11'));var licenseUtil=require(_0xfff4('0x12'));var db=require(_0xfff4('0x13'))['db'];function respondWithStatusCode(_0x5a1e15,_0x2e77b2){_0x2e77b2=_0x2e77b2||0xcc;return function(_0x299848){if(_0x299848){return _0x5a1e15[_0xfff4('0x14')](_0x2e77b2);}return _0x5a1e15[_0xfff4('0x15')](_0x2e77b2)[_0xfff4('0x16')]();};}function respondWithResult(_0x57638a,_0x262a08){_0x262a08=_0x262a08||0xc8;return function(_0x490744){if(_0x490744){return _0x57638a['status'](_0x262a08)['json'](_0x490744);}};}function respondWithFilteredResult(_0x498600,_0x5a0044){return function(_0x526e4a){if(_0x526e4a){var _0x4e35ec=typeof _0x5a0044['offset']===_0xfff4('0x17')&&typeof _0x5a0044[_0xfff4('0x18')]===_0xfff4('0x17');var _0x56ec3e=_0x526e4a[_0xfff4('0x19')];var _0x31d7e2=_0x4e35ec?0x0:_0x5a0044[_0xfff4('0x1a')];var _0x290120=_0x4e35ec?_0x526e4a[_0xfff4('0x19')]:_0x5a0044[_0xfff4('0x1a')]+_0x5a0044[_0xfff4('0x18')];var _0x3c07a2;if(_0x290120>=_0x56ec3e){_0x290120=_0x56ec3e;_0x3c07a2=0xc8;}else{_0x3c07a2=0xce;}_0x498600[_0xfff4('0x15')](_0x3c07a2);return _0x498600['set'](_0xfff4('0x1b'),_0x31d7e2+'-'+_0x290120+'/'+_0x56ec3e)[_0xfff4('0x1c')](_0x526e4a);}return null;};}function patchUpdates(_0x12401f){return function(_0x4bf68b){try{jsonpatch[_0xfff4('0x1d')](_0x4bf68b,_0x12401f,!![]);}catch(_0x1df965){return BPromise[_0xfff4('0x1e')](_0x1df965);}return _0x4bf68b[_0xfff4('0x1f')]();};}function saveUpdates(_0x3105de,_0x110b83){return function(_0x581822){if(_0x581822){return _0x581822['update'](_0x3105de)[_0xfff4('0x20')](function(_0x246c51){return _0x246c51;});}return null;};}function removeEntity(_0x13df51,_0x285c15){return function(_0xe91581){if(_0xe91581){return _0xe91581['destroy']()[_0xfff4('0x20')](function(){_0x13df51[_0xfff4('0x15')](0xcc)[_0xfff4('0x16')]();});}};}function handleEntityNotFound(_0x485fba,_0x4c00d8){return function(_0x2ddbf5){if(!_0x2ddbf5){_0x485fba[_0xfff4('0x14')](0x194);}return _0x2ddbf5;};}function handleError(_0x59b732,_0x152db8){_0x152db8=_0x152db8||0x1f4;return function(_0x53e260){logger[_0xfff4('0x21')](_0x53e260[_0xfff4('0x22')]);if(_0x53e260[_0xfff4('0x23')]){delete _0x53e260[_0xfff4('0x23')];}_0x59b732[_0xfff4('0x15')](_0x152db8)[_0xfff4('0x24')](_0x53e260);};}exports['index']=function(_0x579421,_0x513df0){var _0x59bf7c={},_0x48c7b1={},_0x1fe24={'count':0x0,'rows':[]};var _0x5508cf=_[_0xfff4('0x25')](db[_0xfff4('0x26')][_0xfff4('0x27')],function(_0x4f905b){return{'name':_0x4f905b[_0xfff4('0x28')],'type':_0x4f905b[_0xfff4('0x29')][_0xfff4('0x2a')]};});_0x48c7b1[_0xfff4('0x2b')]=_[_0xfff4('0x25')](_0x5508cf,_0xfff4('0x23'));_0x48c7b1[_0xfff4('0x2c')]=_[_0xfff4('0x2d')](_0x579421[_0xfff4('0x2c')]);_0x48c7b1[_0xfff4('0x2e')]=_['intersection'](_0x48c7b1[_0xfff4('0x2b')],_0x48c7b1[_0xfff4('0x2c')]);_0x59bf7c[_0xfff4('0x2f')]=_[_0xfff4('0x30')](_0x48c7b1[_0xfff4('0x2b')],qs[_0xfff4('0x31')](_0x579421[_0xfff4('0x2c')]['fields']));_0x59bf7c[_0xfff4('0x2f')]=_0x59bf7c[_0xfff4('0x2f')]['length']?_0x59bf7c['attributes']:_0x48c7b1[_0xfff4('0x2b')];if(!_0x579421[_0xfff4('0x2c')][_0xfff4('0x32')]('nolimit')){_0x59bf7c[_0xfff4('0x18')]=qs['limit'](_0x579421[_0xfff4('0x2c')][_0xfff4('0x18')]);_0x59bf7c[_0xfff4('0x1a')]=qs[_0xfff4('0x1a')](_0x579421[_0xfff4('0x2c')][_0xfff4('0x1a')]);}_0x59bf7c[_0xfff4('0x33')]=qs[_0xfff4('0x34')](_0x579421[_0xfff4('0x2c')][_0xfff4('0x34')]);_0x59bf7c['where']=qs[_0xfff4('0x2e')](_['pick'](_0x579421[_0xfff4('0x2c')],_0x48c7b1['filters']),_0x5508cf);if(_0x579421[_0xfff4('0x2c')]['filter']){_0x59bf7c['where']=_['merge'](_0x59bf7c[_0xfff4('0x35')],{'$or':_[_0xfff4('0x25')](_0x5508cf,function(_0x188012){if(_0x188012['type']!==_0xfff4('0x36')){var _0x3e88ad={};_0x3e88ad[_0x188012[_0xfff4('0x23')]]={'$like':'%'+_0x579421['query'][_0xfff4('0x37')]+'%'};return _0x3e88ad;}})});}_0x59bf7c=_[_0xfff4('0x38')]({},_0x59bf7c,_0x579421[_0xfff4('0x39')]);var _0x5704de={'where':_0x59bf7c[_0xfff4('0x35')]};return db[_0xfff4('0x26')][_0xfff4('0x19')](_0x5704de)[_0xfff4('0x20')](function(_0x4e567d){_0x1fe24['count']=_0x4e567d;if(_0x579421['query'][_0xfff4('0x3a')]){_0x59bf7c['include']=[{'all':!![]}];}return db[_0xfff4('0x26')][_0xfff4('0x3b')](_0x59bf7c);})[_0xfff4('0x20')](function(_0x468de9){_0x1fe24[_0xfff4('0x3c')]=_0x468de9;return _0x1fe24;})[_0xfff4('0x20')](respondWithFilteredResult(_0x513df0,_0x59bf7c))['catch'](handleError(_0x513df0,null));};exports[_0xfff4('0x3d')]=function(_0xfd876d,_0x4f8824){var _0x566f39={'raw':!![],'where':{'id':_0xfd876d[_0xfff4('0x3e')]['id']}},_0x31d4a4={};_0x31d4a4['model']=_['keys'](db[_0xfff4('0x26')][_0xfff4('0x27')]);_0x31d4a4[_0xfff4('0x2c')]=_['keys'](_0xfd876d['query']);_0x31d4a4[_0xfff4('0x2e')]=_[_0xfff4('0x30')](_0x31d4a4[_0xfff4('0x2b')],_0x31d4a4[_0xfff4('0x2c')]);_0x566f39[_0xfff4('0x2f')]=_['intersection'](_0x31d4a4[_0xfff4('0x2b')],qs[_0xfff4('0x31')](_0xfd876d[_0xfff4('0x2c')][_0xfff4('0x31')]));_0x566f39['attributes']=_0x566f39['attributes'][_0xfff4('0x3f')]?_0x566f39[_0xfff4('0x2f')]:_0x31d4a4[_0xfff4('0x2b')];if(_0xfd876d[_0xfff4('0x2c')]['includeAll']){_0x566f39[_0xfff4('0x40')]=[{'all':!![]}];}_0x566f39=_[_0xfff4('0x38')]({},_0x566f39,_0xfd876d[_0xfff4('0x39')]);return db[_0xfff4('0x26')][_0xfff4('0x41')](_0x566f39)['then'](handleEntityNotFound(_0x4f8824,null))['then'](respondWithResult(_0x4f8824,null))['catch'](handleError(_0x4f8824,null));};exports[_0xfff4('0x42')]=function(_0x31c601,_0x58d9ef){return db['FreshsalesField'][_0xfff4('0x42')](_0x31c601['body'],{})[_0xfff4('0x20')](respondWithResult(_0x58d9ef,0xc9))['catch'](handleError(_0x58d9ef,null));};exports['update']=function(_0x2bce67,_0x17eb68){if(_0x2bce67['body']['id']){delete _0x2bce67['body']['id'];}return db[_0xfff4('0x26')][_0xfff4('0x41')]({'where':{'id':_0x2bce67['params']['id']}})[_0xfff4('0x20')](handleEntityNotFound(_0x17eb68,null))[_0xfff4('0x20')](saveUpdates(_0x2bce67[_0xfff4('0x43')],null))[_0xfff4('0x20')](respondWithResult(_0x17eb68,null))[_0xfff4('0x44')](handleError(_0x17eb68,null));};exports['destroy']=function(_0x518dd9,_0x1bba42){return db[_0xfff4('0x26')][_0xfff4('0x41')]({'where':{'id':_0x518dd9[_0xfff4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1bba42,null))['then'](removeEntity(_0x1bba42,null))[_0xfff4('0x44')](handleError(_0x1bba42,null));}; \ No newline at end of file +var _0x9cd7=['stack','send','index','fieldName','type','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshsalesField','findAll','rows','catch','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','update','then','error'];(function(_0x2c26be,_0x4d9b3b){var _0x17a70f=function(_0x33efab){while(--_0x33efab){_0x2c26be['push'](_0x2c26be['shift']());}};_0x17a70f(++_0x4d9b3b);}(_0x9cd7,0xbd));var _0x79cd=function(_0x6362d0,_0x5400b4){_0x6362d0=_0x6362d0-0x0;var _0x19bbce=_0x9cd7[_0x6362d0];return _0x19bbce;};'use strict';var emlformat=require(_0x79cd('0x0'));var rimraf=require(_0x79cd('0x1'));var zipdir=require(_0x79cd('0x2'));var jsonpatch=require(_0x79cd('0x3'));var rp=require(_0x79cd('0x4'));var moment=require(_0x79cd('0x5'));var BPromise=require(_0x79cd('0x6'));var Mustache=require(_0x79cd('0x7'));var util=require(_0x79cd('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x79cd('0x9'));var fs=require('fs');var fs_extra=require(_0x79cd('0xa'));var _=require('lodash');var squel=require(_0x79cd('0xb'));var crypto=require(_0x79cd('0xc'));var jsforce=require(_0x79cd('0xd'));var deskjs=require(_0x79cd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x79cd('0xf'));var Papa=require(_0x79cd('0x10'));var Redis=require(_0x79cd('0x11'));var authService=require(_0x79cd('0x12'));var qs=require(_0x79cd('0x13'));var as=require(_0x79cd('0x14'));var hardwareService=require(_0x79cd('0x15'));var logger=require(_0x79cd('0x16'))(_0x79cd('0x17'));var utils=require(_0x79cd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x79cd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52fb35,_0x24bc8b){_0x24bc8b=_0x24bc8b||0xcc;return function(_0x43d024){if(_0x43d024){return _0x52fb35[_0x79cd('0x1a')](_0x24bc8b);}return _0x52fb35[_0x79cd('0x1b')](_0x24bc8b)[_0x79cd('0x1c')]();};}function respondWithResult(_0x19807a,_0x543ca6){_0x543ca6=_0x543ca6||0xc8;return function(_0x1c43ae){if(_0x1c43ae){return _0x19807a[_0x79cd('0x1b')](_0x543ca6)['json'](_0x1c43ae);}};}function respondWithFilteredResult(_0x3c1821,_0x4ced28){return function(_0x59f0a0){if(_0x59f0a0){var _0x31e01e=typeof _0x4ced28[_0x79cd('0x1d')]==='undefined'&&typeof _0x4ced28[_0x79cd('0x1e')]==='undefined';var _0x477c66=_0x59f0a0[_0x79cd('0x1f')];var _0x5b3f8=_0x31e01e?0x0:_0x4ced28[_0x79cd('0x1d')];var _0x2ef8b9=_0x31e01e?_0x59f0a0[_0x79cd('0x1f')]:_0x4ced28[_0x79cd('0x1d')]+_0x4ced28[_0x79cd('0x1e')];var _0x1ed756;if(_0x2ef8b9>=_0x477c66){_0x2ef8b9=_0x477c66;_0x1ed756=0xc8;}else{_0x1ed756=0xce;}_0x3c1821[_0x79cd('0x1b')](_0x1ed756);return _0x3c1821[_0x79cd('0x20')](_0x79cd('0x21'),_0x5b3f8+'-'+_0x2ef8b9+'/'+_0x477c66)['json'](_0x59f0a0);}return null;};}function patchUpdates(_0x4cf86){return function(_0x3bb257){try{jsonpatch[_0x79cd('0x22')](_0x3bb257,_0x4cf86,!![]);}catch(_0x2f07be){return BPromise[_0x79cd('0x23')](_0x2f07be);}return _0x3bb257['save']();};}function saveUpdates(_0xf71c5c,_0x4685c6){return function(_0x40ee41){if(_0x40ee41){return _0x40ee41[_0x79cd('0x24')](_0xf71c5c)[_0x79cd('0x25')](function(_0x585490){return _0x585490;});}return null;};}function removeEntity(_0x12cb11,_0x22edb1){return function(_0x2bb91e){if(_0x2bb91e){return _0x2bb91e['destroy']()['then'](function(){_0x12cb11[_0x79cd('0x1b')](0xcc)[_0x79cd('0x1c')]();});}};}function handleEntityNotFound(_0x5dc2c0,_0x54dcf6){return function(_0x3650f6){if(!_0x3650f6){_0x5dc2c0['sendStatus'](0x194);}return _0x3650f6;};}function handleError(_0x3c0784,_0x5c3e8d){_0x5c3e8d=_0x5c3e8d||0x1f4;return function(_0x3178c4){logger[_0x79cd('0x26')](_0x3178c4[_0x79cd('0x27')]);if(_0x3178c4['name']){delete _0x3178c4['name'];}_0x3c0784[_0x79cd('0x1b')](_0x5c3e8d)[_0x79cd('0x28')](_0x3178c4);};}exports[_0x79cd('0x29')]=function(_0x5c1e49,_0x312125){var _0x194cd6={},_0x18aa95={},_0x5f32fc={'count':0x0,'rows':[]};var _0x530d88=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x167d8d){return{'name':_0x167d8d[_0x79cd('0x2a')],'type':_0x167d8d[_0x79cd('0x2b')][_0x79cd('0x2c')]};});_0x18aa95[_0x79cd('0x2d')]=_[_0x79cd('0x2e')](_0x530d88,_0x79cd('0x2f'));_0x18aa95['query']=_['keys'](_0x5c1e49[_0x79cd('0x30')]);_0x18aa95['filters']=_[_0x79cd('0x31')](_0x18aa95['model'],_0x18aa95[_0x79cd('0x30')]);_0x194cd6[_0x79cd('0x32')]=_[_0x79cd('0x31')](_0x18aa95[_0x79cd('0x2d')],qs['fields'](_0x5c1e49[_0x79cd('0x30')][_0x79cd('0x33')]));_0x194cd6[_0x79cd('0x32')]=_0x194cd6[_0x79cd('0x32')][_0x79cd('0x34')]?_0x194cd6[_0x79cd('0x32')]:_0x18aa95['model'];if(!_0x5c1e49[_0x79cd('0x30')][_0x79cd('0x35')](_0x79cd('0x36'))){_0x194cd6[_0x79cd('0x1e')]=qs[_0x79cd('0x1e')](_0x5c1e49[_0x79cd('0x30')][_0x79cd('0x1e')]);_0x194cd6[_0x79cd('0x1d')]=qs[_0x79cd('0x1d')](_0x5c1e49[_0x79cd('0x30')][_0x79cd('0x1d')]);}_0x194cd6[_0x79cd('0x37')]=qs[_0x79cd('0x38')](_0x5c1e49[_0x79cd('0x30')][_0x79cd('0x38')]);_0x194cd6[_0x79cd('0x39')]=qs[_0x79cd('0x3a')](_[_0x79cd('0x3b')](_0x5c1e49[_0x79cd('0x30')],_0x18aa95[_0x79cd('0x3a')]),_0x530d88);if(_0x5c1e49[_0x79cd('0x30')][_0x79cd('0x3c')]){_0x194cd6[_0x79cd('0x39')]=_[_0x79cd('0x3d')](_0x194cd6[_0x79cd('0x39')],{'$or':_[_0x79cd('0x2e')](_0x530d88,function(_0x51a656){if(_0x51a656[_0x79cd('0x2b')]!==_0x79cd('0x3e')){var _0x5b9a6c={};_0x5b9a6c[_0x51a656[_0x79cd('0x2f')]]={'$like':'%'+_0x5c1e49[_0x79cd('0x30')][_0x79cd('0x3c')]+'%'};return _0x5b9a6c;}})});}_0x194cd6=_['merge']({},_0x194cd6,_0x5c1e49[_0x79cd('0x3f')]);var _0x1d9aff={'where':_0x194cd6['where']};return db['FreshsalesField'][_0x79cd('0x1f')](_0x1d9aff)[_0x79cd('0x25')](function(_0x1aad80){_0x5f32fc[_0x79cd('0x1f')]=_0x1aad80;if(_0x5c1e49[_0x79cd('0x30')][_0x79cd('0x40')]){_0x194cd6[_0x79cd('0x41')]=[{'all':!![]}];}return db[_0x79cd('0x42')][_0x79cd('0x43')](_0x194cd6);})[_0x79cd('0x25')](function(_0x500c17){_0x5f32fc[_0x79cd('0x44')]=_0x500c17;return _0x5f32fc;})[_0x79cd('0x25')](respondWithFilteredResult(_0x312125,_0x194cd6))[_0x79cd('0x45')](handleError(_0x312125,null));};exports['show']=function(_0x25f5ec,_0x2ac4c0){var _0x43fe16={'raw':!![],'where':{'id':_0x25f5ec[_0x79cd('0x46')]['id']}},_0x1cb9dd={};_0x1cb9dd[_0x79cd('0x2d')]=_[_0x79cd('0x47')](db[_0x79cd('0x42')]['rawAttributes']);_0x1cb9dd[_0x79cd('0x30')]=_['keys'](_0x25f5ec['query']);_0x1cb9dd[_0x79cd('0x3a')]=_[_0x79cd('0x31')](_0x1cb9dd[_0x79cd('0x2d')],_0x1cb9dd['query']);_0x43fe16[_0x79cd('0x32')]=_[_0x79cd('0x31')](_0x1cb9dd[_0x79cd('0x2d')],qs[_0x79cd('0x33')](_0x25f5ec[_0x79cd('0x30')][_0x79cd('0x33')]));_0x43fe16[_0x79cd('0x32')]=_0x43fe16[_0x79cd('0x32')][_0x79cd('0x34')]?_0x43fe16[_0x79cd('0x32')]:_0x1cb9dd[_0x79cd('0x2d')];if(_0x25f5ec[_0x79cd('0x30')][_0x79cd('0x40')]){_0x43fe16[_0x79cd('0x41')]=[{'all':!![]}];}_0x43fe16=_[_0x79cd('0x3d')]({},_0x43fe16,_0x25f5ec[_0x79cd('0x3f')]);return db[_0x79cd('0x42')][_0x79cd('0x48')](_0x43fe16)[_0x79cd('0x25')](handleEntityNotFound(_0x2ac4c0,null))[_0x79cd('0x25')](respondWithResult(_0x2ac4c0,null))[_0x79cd('0x45')](handleError(_0x2ac4c0,null));};exports['create']=function(_0x7d2cc2,_0x4eb356){return db[_0x79cd('0x42')][_0x79cd('0x49')](_0x7d2cc2[_0x79cd('0x4a')],{})[_0x79cd('0x25')](respondWithResult(_0x4eb356,0xc9))[_0x79cd('0x45')](handleError(_0x4eb356,null));};exports[_0x79cd('0x24')]=function(_0x1187d0,_0xdc5f9d){if(_0x1187d0[_0x79cd('0x4a')]['id']){delete _0x1187d0['body']['id'];}return db[_0x79cd('0x42')]['find']({'where':{'id':_0x1187d0[_0x79cd('0x46')]['id']}})[_0x79cd('0x25')](handleEntityNotFound(_0xdc5f9d,null))[_0x79cd('0x25')](saveUpdates(_0x1187d0['body'],null))[_0x79cd('0x25')](respondWithResult(_0xdc5f9d,null))['catch'](handleError(_0xdc5f9d,null));};exports[_0x79cd('0x4b')]=function(_0x327978,_0x1ef385){return db[_0x79cd('0x42')][_0x79cd('0x48')]({'where':{'id':_0x327978[_0x79cd('0x46')]['id']}})[_0x79cd('0x25')](handleEntityNotFound(_0x1ef385,null))[_0x79cd('0x25')](removeEntity(_0x1ef385,null))[_0x79cd('0x45')](handleError(_0x1ef385,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 261746a..153d348 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 _0x65cb=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x65cb,0xa4));var _0xb65c=function(_0x5301a3,_0x43aaca){_0x5301a3=_0x5301a3-0x0;var _0x4f94b0=_0x65cb[_0x5301a3];return _0x4f94b0;};'use strict';var _=require(_0xb65c('0x0'));var util=require('util');var logger=require(_0xb65c('0x1'))(_0xb65c('0x2'));var moment=require(_0xb65c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb65c('0x4'));var fs=require('fs');var path=require(_0xb65c('0x5'));var rimraf=require(_0xb65c('0x6'));var config=require(_0xb65c('0x7'));var attributes=require(_0xb65c('0x8'));module['exports']=function(_0x38d414,_0x1c6718){return _0x38d414[_0xb65c('0x9')](_0xb65c('0xa'),attributes,{'tableName':_0xb65c('0xb'),'paranoid':![],'indexes':[{'name':_0xb65c('0xc'),'fields':[_0xb65c('0xd'),_0xb65c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f2e=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','freshsales_unique_index','idField'];(function(_0x383e52,_0x3ced20){var _0x1d6c77=function(_0x240d4d){while(--_0x240d4d){_0x383e52['push'](_0x383e52['shift']());}};_0x1d6c77(++_0x3ced20);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x335d2d,_0x26e065){_0x335d2d=_0x335d2d-0x0;var _0x379073=_0x3f2e[_0x335d2d];return _0x379073;};'use strict';var _=require(_0xe3f2('0x0'));var util=require('util');var logger=require(_0xe3f2('0x1'))(_0xe3f2('0x2'));var moment=require(_0xe3f2('0x3'));var BPromise=require(_0xe3f2('0x4'));var rp=require(_0xe3f2('0x5'));var fs=require('fs');var path=require(_0xe3f2('0x6'));var rimraf=require(_0xe3f2('0x7'));var config=require('../../config/environment');var attributes=require(_0xe3f2('0x8'));module['exports']=function(_0x7cdd2e,_0x2d6460){return _0x7cdd2e['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xe3f2('0x9'),'fields':[_0xe3f2('0xa'),_0xe3f2('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 9b39937..21500f9 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5a09f3,_0x9ce907){var _0x3665c2=function(_0x3a8581){while(--_0x3a8581){_0x5a09f3['push'](_0x5a09f3['shift']());}};_0x3665c2(++_0x9ce907);}(_0xadb5,0xad));var _0x5adb=function(_0x3a8de6,_0x4d6a00){_0x3a8de6=_0x3a8de6-0x0;var _0x2707da=_0xadb5[_0x3a8de6];return _0x2707da;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xf61e=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xcef2d3,_0x106ea1){var _0xa2bfd0=function(_0x323740){while(--_0x323740){_0xcef2d3['push'](_0xcef2d3['shift']());}};_0xa2bfd0(++_0x106ea1);}(_0xf61e,0x191));var _0xef61=function(_0x17feed,_0x2a7803){_0x17feed=_0x17feed-0x0;var _0x3754a6=_0xf61e[_0x17feed];return _0x3754a6;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c2acacc..9ddc303 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 _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(_0x3bef7f,_0x1eedf2){var _0x2459b1=function(_0x1c3687){while(--_0x1c3687){_0x3bef7f['push'](_0x3bef7f['shift']());}};_0x2459b1(++_0x1eedf2);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5f5db9,_0x602999){var _0x9becb8=function(_0x3d6b0c){while(--_0x3d6b0c){_0x5f5db9['push'](_0x5f5db9['shift']());}};_0x9becb8(++_0x602999);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 58d83d8..1cef83b 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 _0xe1bd=['exports','STRING','username','ENUM','newTab','integrationTab','sequelize'];(function(_0x49ad7d,_0x11f51c){var _0x124cfa=function(_0x1931e3){while(--_0x1931e3){_0x49ad7d['push'](_0x49ad7d['shift']());}};_0x124cfa(++_0x11f51c);}(_0xe1bd,0x1a3));var _0xde1b=function(_0x415b64,_0x58a0b7){_0x415b64=_0x415b64-0x0;var _0x121ec2=_0xe1bd[_0x415b64];return _0x121ec2;};'use strict';var Sequelize=require(_0xde1b('0x0'));module[_0xde1b('0x1')]={'name':{'type':Sequelize[_0xde1b('0x2')]},'description':{'type':Sequelize[_0xde1b('0x2')]},'username':{'type':Sequelize[_0xde1b('0x2')],'unique':_0xde1b('0x3')},'remoteUri':{'type':Sequelize[_0xde1b('0x2')]},'password':{'type':Sequelize[_0xde1b('0x2')]},'clientId':{'type':Sequelize[_0xde1b('0x2')]},'clientSecret':{'type':Sequelize[_0xde1b('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xde1b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xde1b('0x4')]('integrationTab',_0xde1b('0x5')),'defaultValue':_0xde1b('0x6')}}; \ No newline at end of file +var _0x288a=['exports','STRING','integrationTab','newTab'];(function(_0x3439ea,_0x1d81d4){var _0x1a55f3=function(_0x33db17){while(--_0x33db17){_0x3439ea['push'](_0x3439ea['shift']());}};_0x1a55f3(++_0x1d81d4);}(_0x288a,0x188));var _0xa288=function(_0x4e93e0,_0x30fdb4){_0x4e93e0=_0x4e93e0-0x0;var _0x5022df=_0x288a[_0x4e93e0];return _0x5022df;};'use strict';var Sequelize=require('sequelize');module[_0xa288('0x0')]={'name':{'type':Sequelize[_0xa288('0x1')]},'description':{'type':Sequelize[_0xa288('0x1')]},'username':{'type':Sequelize[_0xa288('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa288('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xa288('0x1')]},'securityToken':{'type':Sequelize[_0xa288('0x1')]},'serverUrl':{'type':Sequelize[_0xa288('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa288('0x2'),_0xa288('0x3')),'defaultValue':_0xa288('0x2')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index f2ae973..07fecf2 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 _0x4022=['find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','password','securityToken','slice','substring','lastIndexOf','clientSecret','username','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','SalesforceAccount','include','catch','show','params','options'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x4022,0x129));var _0x2402=function(_0x4ff748,_0x52c6bf){_0x4ff748=_0x4ff748-0x0;var _0x23a29c=_0x4022[_0x4ff748];return _0x23a29c;};'use strict';var emlformat=require(_0x2402('0x0'));var rimraf=require(_0x2402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2402('0x2'));var rp=require('request-promise');var moment=require(_0x2402('0x3'));var BPromise=require(_0x2402('0x4'));var Mustache=require(_0x2402('0x5'));var util=require(_0x2402('0x6'));var path=require(_0x2402('0x7'));var sox=require('sox');var csv=require(_0x2402('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2402('0x9'));var _=require(_0x2402('0xa'));var squel=require(_0x2402('0xb'));var crypto=require('crypto');var jsforce=require(_0x2402('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2402('0x8'));var querystring=require(_0x2402('0xd'));var Papa=require(_0x2402('0xe'));var Redis=require(_0x2402('0xf'));var authService=require(_0x2402('0x10'));var qs=require(_0x2402('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2402('0x12'));var logger=require(_0x2402('0x13'))(_0x2402('0x14'));var utils=require(_0x2402('0x15'));var config=require(_0x2402('0x16'));var licenseUtil=require(_0x2402('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2402('0x18'));function respondWithStatusCode(_0x4e5dab,_0x2ba6f8){_0x2ba6f8=_0x2ba6f8||0xcc;return function(_0x769bb2){if(_0x769bb2){return _0x4e5dab[_0x2402('0x19')](_0x2ba6f8);}return _0x4e5dab[_0x2402('0x1a')](_0x2ba6f8)['end']();};}function respondWithResult(_0x3641ef,_0x3806da){_0x3806da=_0x3806da||0xc8;return function(_0x41ec37){if(_0x41ec37){return _0x3641ef[_0x2402('0x1a')](_0x3806da)[_0x2402('0x1b')](_0x41ec37);}};}function respondWithFilteredResult(_0x1bd33f,_0x33a740){return function(_0x5ca315){if(_0x5ca315){var _0x35ae5d=typeof _0x33a740[_0x2402('0x1c')]==='undefined'&&typeof _0x33a740[_0x2402('0x1d')]===_0x2402('0x1e');var _0x56b482=_0x5ca315['count'];var _0xe24c5d=_0x35ae5d?0x0:_0x33a740['offset'];var _0xfcb3b3=_0x35ae5d?_0x5ca315[_0x2402('0x1f')]:_0x33a740[_0x2402('0x1c')]+_0x33a740[_0x2402('0x1d')];var _0xfe4e37;if(_0xfcb3b3>=_0x56b482){_0xfcb3b3=_0x56b482;_0xfe4e37=0xc8;}else{_0xfe4e37=0xce;}_0x1bd33f[_0x2402('0x1a')](_0xfe4e37);return _0x1bd33f['set']('Content-Range',_0xe24c5d+'-'+_0xfcb3b3+'/'+_0x56b482)['json'](_0x5ca315);}return null;};}function patchUpdates(_0x193b0b){return function(_0x287142){try{jsonpatch[_0x2402('0x20')](_0x287142,_0x193b0b,!![]);}catch(_0x12281a){return BPromise[_0x2402('0x21')](_0x12281a);}return _0x287142[_0x2402('0x22')]();};}function saveUpdates(_0x2897dd,_0x4c8dba){return function(_0x37a59f){if(_0x37a59f){return _0x37a59f[_0x2402('0x23')](_0x2897dd)[_0x2402('0x24')](function(_0x39c4a8){return _0x39c4a8;});}return null;};}function removeEntity(_0x56c4d8,_0x15f476){return function(_0x4a1a08){if(_0x4a1a08){return _0x4a1a08['destroy']()[_0x2402('0x24')](function(){_0x56c4d8[_0x2402('0x1a')](0xcc)[_0x2402('0x25')]();});}};}function handleEntityNotFound(_0x356479,_0x5be4c3){return function(_0xa46d83){if(!_0xa46d83){_0x356479[_0x2402('0x19')](0x194);}return _0xa46d83;};}function handleError(_0x5030d9,_0x51a5e1){_0x51a5e1=_0x51a5e1||0x1f4;return function(_0x3b176b){logger[_0x2402('0x26')](_0x3b176b[_0x2402('0x27')]);if(_0x3b176b[_0x2402('0x28')]){delete _0x3b176b[_0x2402('0x28')];}_0x5030d9[_0x2402('0x1a')](_0x51a5e1)[_0x2402('0x29')](_0x3b176b);};}exports['index']=function(_0x450dec,_0x5d3c76){var _0x409b64={},_0x3ebc18={},_0x3c4beb={'count':0x0,'rows':[]};var _0x69d09b=_[_0x2402('0x2a')](db['SalesforceAccount'][_0x2402('0x2b')],function(_0x571de9){return{'name':_0x571de9[_0x2402('0x2c')],'type':_0x571de9[_0x2402('0x2d')][_0x2402('0x2e')]};});_0x3ebc18[_0x2402('0x2f')]=_[_0x2402('0x2a')](_0x69d09b,'name');_0x3ebc18[_0x2402('0x30')]=_[_0x2402('0x31')](_0x450dec['query']);_0x3ebc18[_0x2402('0x32')]=_[_0x2402('0x33')](_0x3ebc18[_0x2402('0x2f')],_0x3ebc18[_0x2402('0x30')]);_0x409b64[_0x2402('0x34')]=_[_0x2402('0x33')](_0x3ebc18['model'],qs[_0x2402('0x35')](_0x450dec[_0x2402('0x30')][_0x2402('0x35')]));_0x409b64[_0x2402('0x34')]=_0x409b64[_0x2402('0x34')][_0x2402('0x36')]?_0x409b64[_0x2402('0x34')]:_0x3ebc18[_0x2402('0x2f')];if(!_0x450dec[_0x2402('0x30')][_0x2402('0x37')](_0x2402('0x38'))){_0x409b64[_0x2402('0x1d')]=qs['limit'](_0x450dec[_0x2402('0x30')][_0x2402('0x1d')]);_0x409b64[_0x2402('0x1c')]=qs[_0x2402('0x1c')](_0x450dec['query'][_0x2402('0x1c')]);}_0x409b64['order']=qs[_0x2402('0x39')](_0x450dec[_0x2402('0x30')][_0x2402('0x39')]);_0x409b64[_0x2402('0x3a')]=qs['filters'](_[_0x2402('0x3b')](_0x450dec[_0x2402('0x30')],_0x3ebc18[_0x2402('0x32')]),_0x69d09b);if(_0x450dec[_0x2402('0x30')][_0x2402('0x3c')]){_0x409b64[_0x2402('0x3a')]=_[_0x2402('0x3d')](_0x409b64['where'],{'$or':_[_0x2402('0x2a')](_0x69d09b,function(_0x143204){if(_0x143204[_0x2402('0x2d')]!==_0x2402('0x3e')){var _0x2781c3={};_0x2781c3[_0x143204[_0x2402('0x28')]]={'$like':'%'+_0x450dec[_0x2402('0x30')][_0x2402('0x3c')]+'%'};return _0x2781c3;}})});}_0x409b64=_[_0x2402('0x3d')]({},_0x409b64,_0x450dec['options']);var _0x220a0={'where':_0x409b64[_0x2402('0x3a')]};return db[_0x2402('0x3f')][_0x2402('0x1f')](_0x220a0)[_0x2402('0x24')](function(_0x473183){_0x3c4beb[_0x2402('0x1f')]=_0x473183;if(_0x450dec[_0x2402('0x30')]['includeAll']){_0x409b64[_0x2402('0x40')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x409b64);})['then'](function(_0x21917d){_0x3c4beb['rows']=_0x21917d;return _0x3c4beb;})['then'](respondWithFilteredResult(_0x5d3c76,_0x409b64))[_0x2402('0x41')](handleError(_0x5d3c76,null));};exports[_0x2402('0x42')]=function(_0x462359,_0x205f7f){var _0x47c76f={'raw':![],'where':{'id':_0x462359[_0x2402('0x43')]['id']}},_0x243c9b={};_0x243c9b[_0x2402('0x2f')]=_[_0x2402('0x31')](db[_0x2402('0x3f')][_0x2402('0x2b')]);_0x243c9b[_0x2402('0x30')]=_[_0x2402('0x31')](_0x462359[_0x2402('0x30')]);_0x243c9b[_0x2402('0x32')]=_[_0x2402('0x33')](_0x243c9b[_0x2402('0x2f')],_0x243c9b[_0x2402('0x30')]);_0x47c76f[_0x2402('0x34')]=_[_0x2402('0x33')](_0x243c9b['model'],qs[_0x2402('0x35')](_0x462359['query'][_0x2402('0x35')]));_0x47c76f[_0x2402('0x34')]=_0x47c76f[_0x2402('0x34')]['length']?_0x47c76f[_0x2402('0x34')]:_0x243c9b[_0x2402('0x2f')];if(_0x462359[_0x2402('0x30')]['includeAll']){_0x47c76f[_0x2402('0x40')]=[{'all':!![]}];}_0x47c76f=_['merge']({},_0x47c76f,_0x462359[_0x2402('0x44')]);return db['SalesforceAccount'][_0x2402('0x45')](_0x47c76f)[_0x2402('0x24')](handleEntityNotFound(_0x205f7f,null))[_0x2402('0x24')](respondWithResult(_0x205f7f,null))['catch'](handleError(_0x205f7f,null));};exports[_0x2402('0x46')]=function(_0x16e15a,_0x43856b){return db[_0x2402('0x3f')][_0x2402('0x46')](_0x16e15a['body'],{})[_0x2402('0x24')](respondWithResult(_0x43856b,0xc9))[_0x2402('0x41')](handleError(_0x43856b,null));};exports[_0x2402('0x23')]=function(_0x2537c0,_0x131c20){if(_0x2537c0['body']['id']){delete _0x2537c0['body']['id'];}return db['SalesforceAccount'][_0x2402('0x45')]({'where':{'id':_0x2537c0[_0x2402('0x43')]['id']}})['then'](handleEntityNotFound(_0x131c20,null))[_0x2402('0x24')](saveUpdates(_0x2537c0[_0x2402('0x47')],null))[_0x2402('0x24')](respondWithResult(_0x131c20,null))[_0x2402('0x41')](handleError(_0x131c20,null));};exports[_0x2402('0x48')]=function(_0xe03f3,_0x33457b){return db['SalesforceAccount'][_0x2402('0x45')]({'where':{'id':_0xe03f3[_0x2402('0x43')]['id']}})[_0x2402('0x24')](handleEntityNotFound(_0x33457b,null))[_0x2402('0x24')](removeEntity(_0x33457b,null))[_0x2402('0x41')](handleError(_0x33457b,null));};exports[_0x2402('0x49')]=function(_0x101253,_0x1edc87,_0x2ad733){var _0x1c9698={};var _0x4f37bd={};var _0x29c00f;var _0x2e0e24;return db[_0x2402('0x3f')][_0x2402('0x4a')]({'where':{'id':_0x101253[_0x2402('0x43')]['id']}})[_0x2402('0x24')](handleEntityNotFound(_0x1edc87,null))[_0x2402('0x24')](function(_0x2f8805){if(_0x2f8805){_0x29c00f=_0x2f8805;_0x4f37bd['model']=_[_0x2402('0x31')](db[_0x2402('0x4b')][_0x2402('0x2b')]);_0x4f37bd[_0x2402('0x30')]=_[_0x2402('0x31')](_0x101253[_0x2402('0x30')]);_0x4f37bd[_0x2402('0x32')]=_['intersection'](_0x4f37bd['model'],_0x4f37bd['query']);_0x1c9698[_0x2402('0x34')]=_[_0x2402('0x33')](_0x4f37bd[_0x2402('0x2f')],qs[_0x2402('0x35')](_0x101253[_0x2402('0x30')][_0x2402('0x35')]));_0x1c9698[_0x2402('0x34')]=_0x1c9698[_0x2402('0x34')][_0x2402('0x36')]?_0x1c9698[_0x2402('0x34')]:_0x4f37bd[_0x2402('0x2f')];_0x1c9698[_0x2402('0x4c')]=qs['sort'](_0x101253[_0x2402('0x30')][_0x2402('0x39')]);_0x1c9698[_0x2402('0x3a')]=qs[_0x2402('0x32')](_[_0x2402('0x3b')](_0x101253[_0x2402('0x30')],_0x4f37bd[_0x2402('0x32')]));if(_0x101253[_0x2402('0x30')]['filter']){_0x1c9698[_0x2402('0x3a')]=_['merge'](_0x1c9698[_0x2402('0x3a')],{'$or':_[_0x2402('0x2a')](_0x1c9698[_0x2402('0x34')],function(_0x83110d){var _0x242853={};_0x242853[_0x83110d]={'$like':'%'+_0x101253[_0x2402('0x30')][_0x2402('0x3c')]+'%'};return _0x242853;})});}_0x1c9698=_[_0x2402('0x3d')]({},_0x1c9698,_0x101253['options']);return _0x29c00f['getConfigurations'](_0x1c9698);}})[_0x2402('0x24')](function(_0xfe3e76){if(_0xfe3e76){_0x2e0e24=_0xfe3e76['length'];if(!_0x101253['query'][_0x2402('0x37')](_0x2402('0x38'))){_0x1c9698[_0x2402('0x1d')]=qs['limit'](_0x101253[_0x2402('0x30')][_0x2402('0x1d')]);_0x1c9698[_0x2402('0x1c')]=qs[_0x2402('0x1c')](_0x101253[_0x2402('0x30')][_0x2402('0x1c')]);}return _0x29c00f[_0x2402('0x49')](_0x1c9698);}})[_0x2402('0x24')](function(_0x4d37b0){if(_0x4d37b0){return _0x4d37b0?{'count':_0x2e0e24,'rows':_0x4d37b0}:null;}})[_0x2402('0x24')](respondWithResult(_0x1edc87,null))['catch'](handleError(_0x1edc87,null));};exports[_0x2402('0x4d')]=function(_0x54fcc5,_0x482f0f,_0x4e7191){if(_0x54fcc5[_0x2402('0x47')]['id']){delete _0x54fcc5['body']['id'];}return db[_0x2402('0x3f')][_0x2402('0x4a')]({'where':{'id':_0x54fcc5[_0x2402('0x43')]['id']}})[_0x2402('0x24')](handleEntityNotFound(_0x482f0f,null))['then'](function(_0x575908){if(_0x575908){_0x54fcc5['body'][_0x2402('0x4e')]=_0x575908['id'];_0x54fcc5[_0x2402('0x47')][_0x2402('0x4f')]=integrations[_0x2402('0x50')](_0x54fcc5[_0x2402('0x47')][_0x2402('0x51')],_0x54fcc5[_0x2402('0x47')]['type']);_0x54fcc5['body'][_0x2402('0x52')]=integrations[_0x2402('0x53')](_0x54fcc5[_0x2402('0x47')][_0x2402('0x51')],_0x54fcc5[_0x2402('0x47')][_0x2402('0x2d')]);return db[_0x2402('0x4b')]['create'](_0x54fcc5[_0x2402('0x47')],{'include':[{'model':db['SalesforceField'],'as':_0x2402('0x4f')},{'model':db[_0x2402('0x54')],'as':_0x2402('0x52')}]});}return null;})[_0x2402('0x24')](respondWithResult(_0x482f0f,null))[_0x2402('0x41')](handleError(_0x482f0f,null));};exports[_0x2402('0x55')]=function(_0x1b2f4b,_0x3d7833,_0x20e917){var _0x4cb92e;var _0x14eebf='';var _0x3651ee='Task';return db[_0x2402('0x3f')]['findOne']({'where':{'id':_0x1b2f4b[_0x2402('0x43')]['id']},'attributes':['id',_0x2402('0x56'),'clientId','clientSecret','username',_0x2402('0x57'),_0x2402('0x58')]})['then'](handleEntityNotFound(_0x3d7833,null))['then'](function(_0x421173){if(_0x421173){_0x14eebf=_0x421173[_0x2402('0x56')];var _0x3ecff9=_0x14eebf[_0x2402('0x59')](-0x1);if(_0x3ecff9==='/'){_0x14eebf=_0x14eebf[_0x2402('0x5a')](0x0,_0x14eebf[_0x2402('0x5b')](_0x3ecff9));}_0x4cb92e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x14eebf,'clientId':_0x421173['clientId'],'clientSecret':_0x421173[_0x2402('0x5c')]}});return _0x4cb92e['login'](_0x421173[_0x2402('0x5d')],_0x421173[_0x2402('0x57')][_0x2402('0x5e')](_0x421173[_0x2402('0x58')]));}})[_0x2402('0x24')](function(_0x4fd648){if(_0x4fd648){if(!_[_0x2402('0x5f')](_0x1b2f4b[_0x2402('0x30')][_0x2402('0x60')])){_0x3651ee=_0x1b2f4b['query']['ticketType'];}return _0x4cb92e[_0x2402('0x61')](_0x3651ee)[_0x2402('0x62')]();}})[_0x2402('0x24')](function(_0x5256a0){var _0x402bec=[_0x2402('0x63'),'ActivityDate',_0x2402('0x64'),_0x2402('0x65'),_0x2402('0x66'),'Description'];var _0x208e34=[_0x2402('0x67'),_0x2402('0x68'),_0x2402('0x69'),_0x2402('0x6a'),_0x2402('0x6b'),_0x2402('0x6c'),_0x2402('0x6d')];if(_0x5256a0){_[_0x2402('0x6e')](_0x5256a0[_0x2402('0x35')],function(_0x4f3230){return _0x402bec['includes'](_0x4f3230['name'])||!_0x208e34[_0x2402('0x6f')](_0x4f3230['type']);});return{'count':_0x5256a0[_0x2402('0x35')]['length'],'rows':_['map'](_0x5256a0[_0x2402('0x35')],function(_0x3a654e){return{'id':_0x3a654e['name'],'name':_0x3a654e[_0x2402('0x70')],'custom':_0x3a654e['custom'],'options':_0x3a654e[_0x2402('0x71')]['length']>0x0?_['map'](_0x3a654e[_0x2402('0x71')],function(_0xf4c50){return{'name':_0xf4c50[_0x2402('0x70')],'value':_0xf4c50[_0x2402('0x72')]};}):_0x3a654e['type']=='boolean'?[{'name':_0x2402('0x73'),'value':_0x2402('0x74')},{'name':_0x2402('0x75'),'value':_0x2402('0x76')}]:[]};})};}})['then'](respondWithResult(_0x3d7833,null))[_0x2402('0x41')](function(_0x472431){var _0x5115bc=_0x1b2f4b[_0x2402('0x30')][_0x2402('0x77')]?0x1f4:_0x472431[_0x2402('0x78')]||0x1f4;logger[_0x2402('0x26')](_0x2402('0x79'),_0x2402('0x55'),_0x5115bc,JSON['stringify'](_0x472431));delete _0x472431['name'];if(_0x5115bc===0x191){_0x5115bc=0x190;}_0x3d7833[_0x2402('0x1a')](_0x5115bc)[_0x2402('0x29')](_0x1b2f4b['query'][_0x2402('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x472431[_0x2402('0x78')]}:_0x472431);});}; \ No newline at end of file +var _0x77de=['moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','then','end','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','destroy','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','findOne','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','login','concat','securityToken','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Description','string','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','False','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','zip-dir'];(function(_0x10165c,_0x5ad2b4){var _0x454073=function(_0x3ca33c){while(--_0x3ca33c){_0x10165c['push'](_0x10165c['shift']());}};_0x454073(++_0x5ad2b4);}(_0x77de,0x17e));var _0xe77d=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x77de[_0x2f6541];return _0x4d76d8;};'use strict';var emlformat=require(_0xe77d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe77d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe77d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe77d('0x3'));var util=require(_0xe77d('0x4'));var path=require(_0xe77d('0x5'));var sox=require(_0xe77d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe77d('0x7'));var squel=require(_0xe77d('0x8'));var crypto=require(_0xe77d('0x9'));var jsforce=require(_0xe77d('0xa'));var deskjs=require(_0xe77d('0xb'));var toCsv=require(_0xe77d('0xc'));var querystring=require(_0xe77d('0xd'));var Papa=require(_0xe77d('0xe'));var Redis=require('ioredis');var authService=require(_0xe77d('0xf'));var qs=require(_0xe77d('0x10'));var as=require(_0xe77d('0x11'));var hardwareService=require(_0xe77d('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe77d('0x13'));var licenseUtil=require(_0xe77d('0x14'));var db=require(_0xe77d('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2c073b,_0x410575){_0x410575=_0x410575||0xcc;return function(_0x8e2aa){if(_0x8e2aa){return _0x2c073b[_0xe77d('0x16')](_0x410575);}return _0x2c073b['status'](_0x410575)['end']();};}function respondWithResult(_0x5cd62f,_0x1e292e){_0x1e292e=_0x1e292e||0xc8;return function(_0x50c266){if(_0x50c266){return _0x5cd62f['status'](_0x1e292e)['json'](_0x50c266);}};}function respondWithFilteredResult(_0xe44948,_0x4b18df){return function(_0x572838){if(_0x572838){var _0x242b71=typeof _0x4b18df[_0xe77d('0x17')]===_0xe77d('0x18')&&typeof _0x4b18df[_0xe77d('0x19')]===_0xe77d('0x18');var _0x42bd5a=_0x572838[_0xe77d('0x1a')];var _0x3df015=_0x242b71?0x0:_0x4b18df[_0xe77d('0x17')];var _0x3e9baf=_0x242b71?_0x572838[_0xe77d('0x1a')]:_0x4b18df[_0xe77d('0x17')]+_0x4b18df[_0xe77d('0x19')];var _0x245680;if(_0x3e9baf>=_0x42bd5a){_0x3e9baf=_0x42bd5a;_0x245680=0xc8;}else{_0x245680=0xce;}_0xe44948[_0xe77d('0x1b')](_0x245680);return _0xe44948[_0xe77d('0x1c')](_0xe77d('0x1d'),_0x3df015+'-'+_0x3e9baf+'/'+_0x42bd5a)[_0xe77d('0x1e')](_0x572838);}return null;};}function patchUpdates(_0x45cb72){return function(_0x3d4c18){try{jsonpatch[_0xe77d('0x1f')](_0x3d4c18,_0x45cb72,!![]);}catch(_0x5e9ecb){return BPromise[_0xe77d('0x20')](_0x5e9ecb);}return _0x3d4c18[_0xe77d('0x21')]();};}function saveUpdates(_0xa01ff3,_0x2acbc6){return function(_0x247b76){if(_0x247b76){return _0x247b76['update'](_0xa01ff3)['then'](function(_0x4d3e6c){return _0x4d3e6c;});}return null;};}function removeEntity(_0x34e7e2,_0xf360){return function(_0x54ef78){if(_0x54ef78){return _0x54ef78['destroy']()[_0xe77d('0x22')](function(){_0x34e7e2['status'](0xcc)[_0xe77d('0x23')]();});}};}function handleEntityNotFound(_0x388176,_0x3ed801){return function(_0x158f64){if(!_0x158f64){_0x388176['sendStatus'](0x194);}return _0x158f64;};}function handleError(_0x1853d2,_0x457c3a){_0x457c3a=_0x457c3a||0x1f4;return function(_0x538ba8){logger['error'](_0x538ba8[_0xe77d('0x24')]);if(_0x538ba8[_0xe77d('0x25')]){delete _0x538ba8[_0xe77d('0x25')];}_0x1853d2[_0xe77d('0x1b')](_0x457c3a)['send'](_0x538ba8);};}exports[_0xe77d('0x26')]=function(_0x174562,_0x39b145){var _0x320abd={},_0x42bd0e={},_0xf474af={'count':0x0,'rows':[]};var _0x4ec072=_[_0xe77d('0x27')](db[_0xe77d('0x28')][_0xe77d('0x29')],function(_0x541113){return{'name':_0x541113[_0xe77d('0x2a')],'type':_0x541113[_0xe77d('0x2b')][_0xe77d('0x2c')]};});_0x42bd0e[_0xe77d('0x2d')]=_[_0xe77d('0x27')](_0x4ec072,'name');_0x42bd0e[_0xe77d('0x2e')]=_[_0xe77d('0x2f')](_0x174562[_0xe77d('0x2e')]);_0x42bd0e[_0xe77d('0x30')]=_[_0xe77d('0x31')](_0x42bd0e[_0xe77d('0x2d')],_0x42bd0e[_0xe77d('0x2e')]);_0x320abd[_0xe77d('0x32')]=_[_0xe77d('0x31')](_0x42bd0e[_0xe77d('0x2d')],qs['fields'](_0x174562[_0xe77d('0x2e')][_0xe77d('0x33')]));_0x320abd[_0xe77d('0x32')]=_0x320abd[_0xe77d('0x32')]['length']?_0x320abd[_0xe77d('0x32')]:_0x42bd0e[_0xe77d('0x2d')];if(!_0x174562[_0xe77d('0x2e')][_0xe77d('0x34')](_0xe77d('0x35'))){_0x320abd[_0xe77d('0x19')]=qs[_0xe77d('0x19')](_0x174562[_0xe77d('0x2e')][_0xe77d('0x19')]);_0x320abd[_0xe77d('0x17')]=qs['offset'](_0x174562[_0xe77d('0x2e')][_0xe77d('0x17')]);}_0x320abd[_0xe77d('0x36')]=qs[_0xe77d('0x37')](_0x174562[_0xe77d('0x2e')]['sort']);_0x320abd[_0xe77d('0x38')]=qs['filters'](_[_0xe77d('0x39')](_0x174562['query'],_0x42bd0e[_0xe77d('0x30')]),_0x4ec072);if(_0x174562[_0xe77d('0x2e')][_0xe77d('0x3a')]){_0x320abd[_0xe77d('0x38')]=_[_0xe77d('0x3b')](_0x320abd['where'],{'$or':_[_0xe77d('0x27')](_0x4ec072,function(_0x23e5f0){if(_0x23e5f0[_0xe77d('0x2b')]!==_0xe77d('0x3c')){var _0x1fc8bc={};_0x1fc8bc[_0x23e5f0[_0xe77d('0x25')]]={'$like':'%'+_0x174562['query']['filter']+'%'};return _0x1fc8bc;}})});}_0x320abd=_[_0xe77d('0x3b')]({},_0x320abd,_0x174562[_0xe77d('0x3d')]);var _0x2b1dc2={'where':_0x320abd[_0xe77d('0x38')]};return db[_0xe77d('0x28')][_0xe77d('0x1a')](_0x2b1dc2)[_0xe77d('0x22')](function(_0x42598a){_0xf474af['count']=_0x42598a;if(_0x174562['query'][_0xe77d('0x3e')]){_0x320abd[_0xe77d('0x3f')]=[{'all':!![]}];}return db[_0xe77d('0x28')][_0xe77d('0x40')](_0x320abd);})[_0xe77d('0x22')](function(_0x41f1b0){_0xf474af[_0xe77d('0x41')]=_0x41f1b0;return _0xf474af;})[_0xe77d('0x22')](respondWithFilteredResult(_0x39b145,_0x320abd))[_0xe77d('0x42')](handleError(_0x39b145,null));};exports[_0xe77d('0x43')]=function(_0x56be21,_0x299b3f){var _0x37d541={'raw':![],'where':{'id':_0x56be21[_0xe77d('0x44')]['id']}},_0xb33486={};_0xb33486[_0xe77d('0x2d')]=_[_0xe77d('0x2f')](db['SalesforceAccount'][_0xe77d('0x29')]);_0xb33486[_0xe77d('0x2e')]=_[_0xe77d('0x2f')](_0x56be21[_0xe77d('0x2e')]);_0xb33486[_0xe77d('0x30')]=_[_0xe77d('0x31')](_0xb33486['model'],_0xb33486['query']);_0x37d541[_0xe77d('0x32')]=_[_0xe77d('0x31')](_0xb33486['model'],qs[_0xe77d('0x33')](_0x56be21['query'][_0xe77d('0x33')]));_0x37d541[_0xe77d('0x32')]=_0x37d541[_0xe77d('0x32')][_0xe77d('0x45')]?_0x37d541[_0xe77d('0x32')]:_0xb33486[_0xe77d('0x2d')];if(_0x56be21[_0xe77d('0x2e')][_0xe77d('0x3e')]){_0x37d541['include']=[{'all':!![]}];}_0x37d541=_[_0xe77d('0x3b')]({},_0x37d541,_0x56be21[_0xe77d('0x3d')]);return db[_0xe77d('0x28')][_0xe77d('0x46')](_0x37d541)[_0xe77d('0x22')](handleEntityNotFound(_0x299b3f,null))[_0xe77d('0x22')](respondWithResult(_0x299b3f,null))['catch'](handleError(_0x299b3f,null));};exports[_0xe77d('0x47')]=function(_0x2f6d49,_0x31230e){return db[_0xe77d('0x28')][_0xe77d('0x47')](_0x2f6d49[_0xe77d('0x48')],{})['then'](respondWithResult(_0x31230e,0xc9))[_0xe77d('0x42')](handleError(_0x31230e,null));};exports[_0xe77d('0x49')]=function(_0x27c465,_0x41b76a){if(_0x27c465['body']['id']){delete _0x27c465[_0xe77d('0x48')]['id'];}return db[_0xe77d('0x28')]['find']({'where':{'id':_0x27c465[_0xe77d('0x44')]['id']}})[_0xe77d('0x22')](handleEntityNotFound(_0x41b76a,null))[_0xe77d('0x22')](saveUpdates(_0x27c465['body'],null))[_0xe77d('0x22')](respondWithResult(_0x41b76a,null))[_0xe77d('0x42')](handleError(_0x41b76a,null));};exports[_0xe77d('0x4a')]=function(_0x2a3b97,_0x54b23e){return db[_0xe77d('0x28')]['find']({'where':{'id':_0x2a3b97[_0xe77d('0x44')]['id']}})['then'](handleEntityNotFound(_0x54b23e,null))[_0xe77d('0x22')](removeEntity(_0x54b23e,null))[_0xe77d('0x42')](handleError(_0x54b23e,null));};exports[_0xe77d('0x4b')]=function(_0x698675,_0xd69fd,_0x1f57ae){var _0x2acf89={};var _0x11945b={};var _0x26c328;var _0x122d91;return db[_0xe77d('0x28')]['findOne']({'where':{'id':_0x698675[_0xe77d('0x44')]['id']}})[_0xe77d('0x22')](handleEntityNotFound(_0xd69fd,null))[_0xe77d('0x22')](function(_0x503a57){if(_0x503a57){_0x26c328=_0x503a57;_0x11945b['model']=_[_0xe77d('0x2f')](db['SalesforceConfiguration'][_0xe77d('0x29')]);_0x11945b['query']=_['keys'](_0x698675[_0xe77d('0x2e')]);_0x11945b[_0xe77d('0x30')]=_[_0xe77d('0x31')](_0x11945b[_0xe77d('0x2d')],_0x11945b['query']);_0x2acf89[_0xe77d('0x32')]=_['intersection'](_0x11945b[_0xe77d('0x2d')],qs['fields'](_0x698675[_0xe77d('0x2e')][_0xe77d('0x33')]));_0x2acf89['attributes']=_0x2acf89['attributes'][_0xe77d('0x45')]?_0x2acf89[_0xe77d('0x32')]:_0x11945b['model'];_0x2acf89['order']=qs['sort'](_0x698675[_0xe77d('0x2e')][_0xe77d('0x37')]);_0x2acf89['where']=qs['filters'](_[_0xe77d('0x39')](_0x698675['query'],_0x11945b[_0xe77d('0x30')]));if(_0x698675[_0xe77d('0x2e')][_0xe77d('0x3a')]){_0x2acf89[_0xe77d('0x38')]=_[_0xe77d('0x3b')](_0x2acf89[_0xe77d('0x38')],{'$or':_[_0xe77d('0x27')](_0x2acf89['attributes'],function(_0x27fe5d){var _0x3150ca={};_0x3150ca[_0x27fe5d]={'$like':'%'+_0x698675[_0xe77d('0x2e')][_0xe77d('0x3a')]+'%'};return _0x3150ca;})});}_0x2acf89=_[_0xe77d('0x3b')]({},_0x2acf89,_0x698675[_0xe77d('0x3d')]);return _0x26c328[_0xe77d('0x4b')](_0x2acf89);}})[_0xe77d('0x22')](function(_0x28dbf6){if(_0x28dbf6){_0x122d91=_0x28dbf6['length'];if(!_0x698675['query'][_0xe77d('0x34')](_0xe77d('0x35'))){_0x2acf89[_0xe77d('0x19')]=qs[_0xe77d('0x19')](_0x698675[_0xe77d('0x2e')]['limit']);_0x2acf89[_0xe77d('0x17')]=qs[_0xe77d('0x17')](_0x698675['query']['offset']);}return _0x26c328['getConfigurations'](_0x2acf89);}})[_0xe77d('0x22')](function(_0x7685ae){if(_0x7685ae){return _0x7685ae?{'count':_0x122d91,'rows':_0x7685ae}:null;}})[_0xe77d('0x22')](respondWithResult(_0xd69fd,null))['catch'](handleError(_0xd69fd,null));};exports[_0xe77d('0x4c')]=function(_0x21be35,_0x3906c0,_0x483bee){if(_0x21be35[_0xe77d('0x48')]['id']){delete _0x21be35['body']['id'];}return db[_0xe77d('0x28')]['findOne']({'where':{'id':_0x21be35[_0xe77d('0x44')]['id']}})[_0xe77d('0x22')](handleEntityNotFound(_0x3906c0,null))['then'](function(_0x50e825){if(_0x50e825){_0x21be35['body'][_0xe77d('0x4d')]=_0x50e825['id'];_0x21be35[_0xe77d('0x48')][_0xe77d('0x4e')]=integrations[_0xe77d('0x4f')](_0x21be35[_0xe77d('0x48')]['channel'],_0x21be35[_0xe77d('0x48')]['type']);_0x21be35[_0xe77d('0x48')][_0xe77d('0x50')]=integrations[_0xe77d('0x51')](_0x21be35[_0xe77d('0x48')]['channel'],_0x21be35[_0xe77d('0x48')]['type']);return db[_0xe77d('0x52')][_0xe77d('0x47')](_0x21be35[_0xe77d('0x48')],{'include':[{'model':db[_0xe77d('0x53')],'as':_0xe77d('0x4e')},{'model':db['SalesforceField'],'as':_0xe77d('0x50')}]});}return null;})[_0xe77d('0x22')](respondWithResult(_0x3906c0,null))[_0xe77d('0x42')](handleError(_0x3906c0,null));};exports[_0xe77d('0x54')]=function(_0x1be719,_0x1346b9,_0x11e53c){var _0x3c55f8;var _0x182b4d='';var _0x580281=_0xe77d('0x55');return db[_0xe77d('0x28')][_0xe77d('0x56')]({'where':{'id':_0x1be719[_0xe77d('0x44')]['id']},'attributes':['id',_0xe77d('0x57'),_0xe77d('0x58'),_0xe77d('0x59'),_0xe77d('0x5a'),_0xe77d('0x5b'),'securityToken']})[_0xe77d('0x22')](handleEntityNotFound(_0x1346b9,null))[_0xe77d('0x22')](function(_0x59d055){if(_0x59d055){_0x182b4d=_0x59d055[_0xe77d('0x57')];var _0x32b2a9=_0x182b4d[_0xe77d('0x5c')](-0x1);if(_0x32b2a9==='/'){_0x182b4d=_0x182b4d[_0xe77d('0x5d')](0x0,_0x182b4d[_0xe77d('0x5e')](_0x32b2a9));}_0x3c55f8=new jsforce[(_0xe77d('0x5f'))]({'oauth2':{'loginUrl':_0x182b4d,'clientId':_0x59d055[_0xe77d('0x58')],'clientSecret':_0x59d055[_0xe77d('0x59')]}});return _0x3c55f8[_0xe77d('0x60')](_0x59d055[_0xe77d('0x5a')],_0x59d055[_0xe77d('0x5b')][_0xe77d('0x61')](_0x59d055[_0xe77d('0x62')]));}})['then'](function(_0x266923){if(_0x266923){if(!_['isNil'](_0x1be719[_0xe77d('0x2e')][_0xe77d('0x63')])){_0x580281=_0x1be719[_0xe77d('0x2e')][_0xe77d('0x63')];}return _0x3c55f8[_0xe77d('0x64')](_0x580281)[_0xe77d('0x65')]();}})[_0xe77d('0x22')](function(_0xe60761){var _0x37edfc=[_0xe77d('0x66'),_0xe77d('0x67'),_0xe77d('0x68'),'IsRecurrence','Subject',_0xe77d('0x69')];var _0x3db777=[_0xe77d('0x6a'),'int',_0xe77d('0x6b'),_0xe77d('0x6c'),_0xe77d('0x6d'),_0xe77d('0x6e'),_0xe77d('0x6f')];if(_0xe60761){_[_0xe77d('0x70')](_0xe60761['fields'],function(_0x1cbf1e){return _0x37edfc[_0xe77d('0x71')](_0x1cbf1e['name'])||!_0x3db777[_0xe77d('0x71')](_0x1cbf1e['type']);});return{'count':_0xe60761[_0xe77d('0x33')]['length'],'rows':_[_0xe77d('0x27')](_0xe60761['fields'],function(_0x3ba5b3){return{'id':_0x3ba5b3[_0xe77d('0x25')],'name':_0x3ba5b3['label'],'custom':_0x3ba5b3[_0xe77d('0x72')],'options':_0x3ba5b3[_0xe77d('0x73')]['length']>0x0?_[_0xe77d('0x27')](_0x3ba5b3[_0xe77d('0x73')],function(_0x2f68b3){return{'name':_0x2f68b3[_0xe77d('0x74')],'value':_0x2f68b3[_0xe77d('0x75')]};}):_0x3ba5b3[_0xe77d('0x2b')]=='boolean'?[{'name':_0xe77d('0x76'),'value':_0xe77d('0x77')},{'name':_0xe77d('0x78'),'value':'false'}]:[]};})};}})[_0xe77d('0x22')](respondWithResult(_0x1346b9,null))[_0xe77d('0x42')](function(_0x1e92cc){var _0x4d44c0=_0x1be719[_0xe77d('0x2e')]['test']?0x1f4:_0x1e92cc[_0xe77d('0x79')]||0x1f4;logger[_0xe77d('0x7a')](_0xe77d('0x7b'),_0xe77d('0x54'),_0x4d44c0,JSON[_0xe77d('0x7c')](_0x1e92cc));delete _0x1e92cc[_0xe77d('0x25')];if(_0x4d44c0===0x191){_0x4d44c0=0x190;}_0x1346b9[_0xe77d('0x1b')](_0x4d44c0)[_0xe77d('0x7d')](_0x1be719[_0xe77d('0x2e')][_0xe77d('0x7e')]?{'message':_0xe77d('0x7f'),'statusCode':_0x1e92cc[_0xe77d('0x79')]}:_0x1e92cc);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9fabd3a..dd56154 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 _0x4f08=['SalesforceAccount','int_salesforce_accounts','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xc4d065,_0xa616b8){var _0x43f234=function(_0x2f81f5){while(--_0x2f81f5){_0xc4d065['push'](_0xc4d065['shift']());}};_0x43f234(++_0xa616b8);}(_0x4f08,0xaa));var _0x84f0=function(_0x38aaab,_0x176404){_0x38aaab=_0x38aaab-0x0;var _0x1048d2=_0x4f08[_0x38aaab];return _0x1048d2;};'use strict';var _=require(_0x84f0('0x0'));var util=require(_0x84f0('0x1'));var logger=require('../../config/logger')(_0x84f0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x84f0('0x3'));var fs=require('fs');var path=require(_0x84f0('0x4'));var rimraf=require(_0x84f0('0x5'));var config=require(_0x84f0('0x6'));var attributes=require(_0x84f0('0x7'));var integrations=require(_0x84f0('0x8'));module[_0x84f0('0x9')]=function(_0x94c8b,_0x26bd5d){return _0x94c8b['define'](_0x84f0('0xa'),attributes,{'tableName':_0x84f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d57=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x57b53b,_0x1861af){var _0x3ef0c1=function(_0x2d964b){while(--_0x2d964b){_0x57b53b['push'](_0x57b53b['shift']());}};_0x3ef0c1(++_0x1861af);}(_0x1d57,0x123));var _0x71d5=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x1d57[_0x23ec06];return _0x2831d4;};'use strict';var _=require('lodash');var util=require(_0x71d5('0x0'));var logger=require(_0x71d5('0x1'))(_0x71d5('0x2'));var moment=require('moment');var BPromise=require(_0x71d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71d5('0x4'));var rimraf=require(_0x71d5('0x5'));var config=require(_0x71d5('0x6'));var attributes=require(_0x71d5('0x7'));var integrations=require(_0x71d5('0x8'));module['exports']=function(_0x15a6e8,_0x2ca6a5){return _0x15a6e8['define'](_0x71d5('0x9'),attributes,{'tableName':_0x71d5('0xa'),'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 6c875f9..9e2259a 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 _0x0427=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','include','map','model','debug','find','raw','ShowSalesforceAccount','lodash','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0427,0x6c));var _0x7042=function(_0x31c7f0,_0x318a06){_0x31c7f0=_0x31c7f0-0x0;var _0x5e1e42=_0x0427[_0x31c7f0];return _0x5e1e42;};'use strict';var _=require(_0x7042('0x0'));var util=require(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rs=require(_0x7042('0x3'));var fs=require('fs');var Redis=require(_0x7042('0x4'));var db=require(_0x7042('0x5'))['db'];var utils=require(_0x7042('0x6'));var logger=require('../../config/logger')(_0x7042('0x7'));var config=require(_0x7042('0x8'));var jayson=require(_0x7042('0x9'));var client=jayson[_0x7042('0xa')][_0x7042('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2608cd,_0x121be1,_0x55515e){return new BPromise(function(_0x385195,_0x258baa){return client[_0x7042('0xc')](_0x2608cd,_0x55515e)[_0x7042('0xd')](function(_0x57fde3){logger[_0x7042('0xe')](_0x7042('0xf'),_0x121be1,'request\x20sent');logger['debug'](_0x7042('0x10'),_0x121be1,_0x7042('0x11'),JSON[_0x7042('0x12')](_0x57fde3));if(_0x57fde3['error']){if(_0x57fde3[_0x7042('0x13')][_0x7042('0x14')]===0x1f4){logger[_0x7042('0x13')](_0x7042('0xf'),_0x121be1,_0x57fde3[_0x7042('0x13')][_0x7042('0x15')]);return _0x258baa(_0x57fde3[_0x7042('0x13')][_0x7042('0x15')]);}logger[_0x7042('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x121be1,_0x57fde3[_0x7042('0x13')][_0x7042('0x15')]);return _0x385195(_0x57fde3['error']['message']);}else{logger[_0x7042('0xe')](_0x7042('0xf'),_0x121be1,'request\x20sent');_0x385195(_0x57fde3[_0x7042('0x16')][_0x7042('0x15')]);}})[_0x7042('0x17')](function(_0x497efe){logger[_0x7042('0x13')](_0x7042('0xf'),_0x121be1,_0x497efe);_0x258baa(_0x497efe);});});}exports[_0x7042('0x18')]=function(_0x479a0c){var _0x46f020=this;return new Promise(function(_0xdd167,_0x2ca4f8){return db[_0x7042('0x19')][_0x7042('0x1a')]({'raw':_0x479a0c[_0x7042('0x1b')]?_0x479a0c['options']['raw']===undefined?!![]:![]:!![],'where':_0x479a0c['options']?_0x479a0c[_0x7042('0x1b')][_0x7042('0x1c')]||null:null,'attributes':_0x479a0c[_0x7042('0x1b')]?_0x479a0c[_0x7042('0x1b')][_0x7042('0x1d')]||null:null,'limit':_0x479a0c[_0x7042('0x1b')]?_0x479a0c[_0x7042('0x1b')]['limit']||null:null,'include':_0x479a0c['options']?_0x479a0c['options'][_0x7042('0x1e')]?_[_0x7042('0x1f')](_0x479a0c[_0x7042('0x1b')][_0x7042('0x1e')],function(_0x529d5a){return{'model':db[_0x529d5a[_0x7042('0x20')]],'as':_0x529d5a['as'],'attributes':_0x529d5a[_0x7042('0x1d')],'include':_0x529d5a[_0x7042('0x1e')]?_['map'](_0x529d5a['include'],function(_0x2e936e){return{'model':db[_0x2e936e[_0x7042('0x20')]],'as':_0x2e936e['as'],'attributes':_0x2e936e['attributes'],'include':_0x2e936e[_0x7042('0x1e')]?_[_0x7042('0x1f')](_0x2e936e[_0x7042('0x1e')],function(_0x1ddc6f){return{'model':db[_0x1ddc6f['model']],'as':_0x1ddc6f['as'],'attributes':_0x1ddc6f[_0x7042('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26beb7){logger[_0x7042('0xe')](_0x7042('0x18'),_0x479a0c);logger[_0x7042('0x21')](_0x7042('0x18'),_0x479a0c,JSON['stringify'](_0x26beb7));_0xdd167(_0x26beb7);})[_0x7042('0x17')](function(_0x3a6704){logger[_0x7042('0x13')](_0x7042('0x18'),_0x3a6704[_0x7042('0x15')],_0x479a0c);_0x2ca4f8(_0x46f020['error'](0x1f4,_0x3a6704[_0x7042('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x209f1b){var _0x504cde=this;return new Promise(function(_0x4d7bc3,_0x3d5b3e){return db[_0x7042('0x19')][_0x7042('0x22')]({'raw':_0x209f1b['options']?_0x209f1b[_0x7042('0x1b')][_0x7042('0x23')]===undefined?!![]:![]:!![],'where':_0x209f1b[_0x7042('0x1b')]?_0x209f1b[_0x7042('0x1b')][_0x7042('0x1c')]||null:null,'attributes':_0x209f1b['options']?_0x209f1b[_0x7042('0x1b')][_0x7042('0x1d')]||null:null,'include':_0x209f1b['options']?_0x209f1b[_0x7042('0x1b')][_0x7042('0x1e')]?_['map'](_0x209f1b[_0x7042('0x1b')][_0x7042('0x1e')],function(_0x1a9aa7){return{'model':db[_0x1a9aa7[_0x7042('0x20')]],'as':_0x1a9aa7['as'],'attributes':_0x1a9aa7[_0x7042('0x1d')],'include':_0x1a9aa7[_0x7042('0x1e')]?_['map'](_0x1a9aa7[_0x7042('0x1e')],function(_0x42c0b1){return{'model':db[_0x42c0b1['model']],'as':_0x42c0b1['as'],'attributes':_0x42c0b1['attributes'],'include':_0x42c0b1[_0x7042('0x1e')]?_[_0x7042('0x1f')](_0x42c0b1['include'],function(_0x5a3cd7){return{'model':db[_0x5a3cd7['model']],'as':_0x5a3cd7['as'],'attributes':_0x5a3cd7[_0x7042('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7042('0xd')](function(_0x4d0014){logger[_0x7042('0xe')](_0x7042('0x24'),_0x209f1b);logger[_0x7042('0x21')](_0x7042('0x24'),_0x209f1b,JSON[_0x7042('0x12')](_0x4d0014));_0x4d7bc3(_0x4d0014);})[_0x7042('0x17')](function(_0x75eaa0){logger['error'](_0x7042('0x24'),_0x75eaa0['message'],_0x209f1b);_0x3d5b3e(_0x504cde[_0x7042('0x13')](0x1f4,_0x75eaa0[_0x7042('0x15')]));});});}; \ No newline at end of file +var _0x78a7=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','debug','ShowSalesforceAccount','find','where'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x78a7,0x80));var _0x778a=function(_0x4d0d85,_0x3250d3){_0x4d0d85=_0x4d0d85-0x0;var _0x290a74=_0x78a7[_0x4d0d85];return _0x290a74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x778a('0x0'));var BPromise=require(_0x778a('0x1'));var rs=require(_0x778a('0x2'));var fs=require('fs');var Redis=require(_0x778a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x778a('0x4'));var logger=require(_0x778a('0x5'))(_0x778a('0x6'));var config=require(_0x778a('0x7'));var jayson=require(_0x778a('0x8'));var client=jayson[_0x778a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa50803,_0x272528,_0x32f9bf){return new BPromise(function(_0x3d4a0b,_0x3cf2a2){return client['request'](_0xa50803,_0x32f9bf)[_0x778a('0xa')](function(_0xd635b6){logger[_0x778a('0xb')](_0x778a('0xc'),_0x272528,'request\x20sent');logger['debug'](_0x778a('0xd'),_0x272528,_0x778a('0xe'),JSON[_0x778a('0xf')](_0xd635b6));if(_0xd635b6[_0x778a('0x10')]){if(_0xd635b6[_0x778a('0x10')]['code']===0x1f4){logger[_0x778a('0x10')](_0x778a('0xc'),_0x272528,_0xd635b6[_0x778a('0x10')][_0x778a('0x11')]);return _0x3cf2a2(_0xd635b6[_0x778a('0x10')][_0x778a('0x11')]);}logger[_0x778a('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x272528,_0xd635b6['error']['message']);return _0x3d4a0b(_0xd635b6[_0x778a('0x10')][_0x778a('0x11')]);}else{logger[_0x778a('0xb')](_0x778a('0xc'),_0x272528,_0x778a('0xe'));_0x3d4a0b(_0xd635b6['result'][_0x778a('0x11')]);}})[_0x778a('0x12')](function(_0x50edcc){logger['error'](_0x778a('0xc'),_0x272528,_0x50edcc);_0x3cf2a2(_0x50edcc);});});}exports[_0x778a('0x13')]=function(_0x52c2c9){var _0x1106df=this;return new Promise(function(_0x546a68,_0x17f69c){return db['SalesforceAccount'][_0x778a('0x14')]({'raw':_0x52c2c9['options']?_0x52c2c9[_0x778a('0x15')][_0x778a('0x16')]===undefined?!![]:![]:!![],'where':_0x52c2c9[_0x778a('0x15')]?_0x52c2c9[_0x778a('0x15')]['where']||null:null,'attributes':_0x52c2c9[_0x778a('0x15')]?_0x52c2c9['options'][_0x778a('0x17')]||null:null,'limit':_0x52c2c9['options']?_0x52c2c9[_0x778a('0x15')][_0x778a('0x18')]||null:null,'include':_0x52c2c9[_0x778a('0x15')]?_0x52c2c9[_0x778a('0x15')][_0x778a('0x19')]?_['map'](_0x52c2c9[_0x778a('0x15')]['include'],function(_0x27f302){return{'model':db[_0x27f302[_0x778a('0x1a')]],'as':_0x27f302['as'],'attributes':_0x27f302[_0x778a('0x17')],'include':_0x27f302[_0x778a('0x19')]?_[_0x778a('0x1b')](_0x27f302[_0x778a('0x19')],function(_0x4b2f25){return{'model':db[_0x4b2f25[_0x778a('0x1a')]],'as':_0x4b2f25['as'],'attributes':_0x4b2f25['attributes'],'include':_0x4b2f25[_0x778a('0x19')]?_['map'](_0x4b2f25[_0x778a('0x19')],function(_0x247127){return{'model':db[_0x247127[_0x778a('0x1a')]],'as':_0x247127['as'],'attributes':_0x247127['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x227c06){logger[_0x778a('0xb')](_0x778a('0x13'),_0x52c2c9);logger[_0x778a('0x1c')](_0x778a('0x13'),_0x52c2c9,JSON[_0x778a('0xf')](_0x227c06));_0x546a68(_0x227c06);})[_0x778a('0x12')](function(_0x5e9f96){logger[_0x778a('0x10')](_0x778a('0x13'),_0x5e9f96[_0x778a('0x11')],_0x52c2c9);_0x17f69c(_0x1106df[_0x778a('0x10')](0x1f4,_0x5e9f96[_0x778a('0x11')]));});});};exports[_0x778a('0x1d')]=function(_0x553a90){var _0x935368=this;return new Promise(function(_0xabb284,_0x55b012){return db['SalesforceAccount'][_0x778a('0x1e')]({'raw':_0x553a90[_0x778a('0x15')]?_0x553a90[_0x778a('0x15')][_0x778a('0x16')]===undefined?!![]:![]:!![],'where':_0x553a90['options']?_0x553a90[_0x778a('0x15')][_0x778a('0x1f')]||null:null,'attributes':_0x553a90['options']?_0x553a90[_0x778a('0x15')][_0x778a('0x17')]||null:null,'include':_0x553a90[_0x778a('0x15')]?_0x553a90[_0x778a('0x15')][_0x778a('0x19')]?_['map'](_0x553a90[_0x778a('0x15')][_0x778a('0x19')],function(_0x46c218){return{'model':db[_0x46c218[_0x778a('0x1a')]],'as':_0x46c218['as'],'attributes':_0x46c218[_0x778a('0x17')],'include':_0x46c218[_0x778a('0x19')]?_[_0x778a('0x1b')](_0x46c218[_0x778a('0x19')],function(_0x10886b){return{'model':db[_0x10886b[_0x778a('0x1a')]],'as':_0x10886b['as'],'attributes':_0x10886b[_0x778a('0x17')],'include':_0x10886b[_0x778a('0x19')]?_['map'](_0x10886b[_0x778a('0x19')],function(_0x2ce614){return{'model':db[_0x2ce614[_0x778a('0x1a')]],'as':_0x2ce614['as'],'attributes':_0x2ce614[_0x778a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x778a('0xa')](function(_0x38f46d){logger[_0x778a('0xb')](_0x778a('0x1d'),_0x553a90);logger['debug']('ShowSalesforceAccount',_0x553a90,JSON['stringify'](_0x38f46d));_0xabb284(_0x38f46d);})[_0x778a('0x12')](function(_0x425ce7){logger['error'](_0x778a('0x1d'),_0x425ce7[_0x778a('0x11')],_0x553a90);_0x55b012(_0x935368['error'](0x1f4,_0x425ce7[_0x778a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index fe515de..71371a9 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x0b0e,0x187));var _0xe0b0=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x0b0e[_0x41b0a8];return _0x3a83d4;};'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('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x1e9fb1,_0x2c82d9){var _0x2bd33c=function(_0x2d9a04){while(--_0x2d9a04){_0x1e9fb1['push'](_0x1e9fb1['shift']());}};_0x2bd33c(++_0x2c82d9);}(_0x7a54,0x106));var _0x47a5=function(_0x284328,_0x3d07ac){_0x284328=_0x284328-0x0;var _0x3c224a=_0x7a54[_0x284328];return _0x3c224a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index ffc395e..75d41fe 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 _0x8e89=['lead','account_contact_lead','account','sequelize','exports','STRING','Task','Case','ENUM','contact_lead','contact'];(function(_0x13e9ac,_0x160a61){var _0x257c96=function(_0x5a32b6){while(--_0x5a32b6){_0x13e9ac['push'](_0x13e9ac['shift']());}};_0x257c96(++_0x160a61);}(_0x8e89,0x1a5));var _0x98e8=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x8e89[_0x45c981];return _0x4f62c8;};'use strict';var Sequelize=require(_0x98e8('0x0'));module[_0x98e8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98e8('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x98e8('0x3'),_0x98e8('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x98e8('0x5')](_0x98e8('0x6'),_0x98e8('0x7'),_0x98e8('0x8'),_0x98e8('0x9'),'account'),'defaultValue':_0x98e8('0x6')},'moduleCreate':{'type':Sequelize[_0x98e8('0x5')]('nothing',_0x98e8('0x7'),_0x98e8('0x8'),_0x98e8('0xa')),'defaultValue':_0x98e8('0x8')},'leadId':{'type':Sequelize[_0x98e8('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x98e8('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf1f2=['contact_lead','lead','contact','exports','STRING','Task','ENUM'];(function(_0x55a076,_0x576088){var _0x1e2769=function(_0x44fb4e){while(--_0x44fb4e){_0x55a076['push'](_0x55a076['shift']());}};_0x1e2769(++_0x576088);}(_0xf1f2,0x145));var _0x2f1f=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0xf1f2[_0x102977];return _0x15c466;};'use strict';var Sequelize=require('sequelize');module[_0x2f1f('0x0')]={'name':{'type':Sequelize[_0x2f1f('0x1')]},'description':{'type':Sequelize[_0x2f1f('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x2f1f('0x2'),'Case'),'defaultValue':_0x2f1f('0x2')},'moduleSearch':{'type':Sequelize[_0x2f1f('0x3')](_0x2f1f('0x4'),'contact',_0x2f1f('0x5'),'account_contact_lead','account'),'defaultValue':_0x2f1f('0x4')},'moduleCreate':{'type':Sequelize[_0x2f1f('0x3')]('nothing',_0x2f1f('0x6'),_0x2f1f('0x5'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x2f1f('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x2f1f('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x2f1f('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x2f1f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 6dbe83a..61103b1 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 _0x94cf=['SalesforceConfiguration','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','name','options','includeAll','rows','catch','keys','include','merge','create','body','find','params','getFields','findOne','SalesforceField','rawAttributes','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','send','map'];(function(_0x282e25,_0x5abf6b){var _0x444374=function(_0x50f041){while(--_0x50f041){_0x282e25['push'](_0x282e25['shift']());}};_0x444374(++_0x5abf6b);}(_0x94cf,0xc2));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf94c('0x0'));var zipdir=require(_0xf94c('0x1'));var jsonpatch=require(_0xf94c('0x2'));var rp=require('request-promise');var moment=require(_0xf94c('0x3'));var BPromise=require(_0xf94c('0x4'));var Mustache=require(_0xf94c('0x5'));var util=require(_0xf94c('0x6'));var path=require(_0xf94c('0x7'));var sox=require(_0xf94c('0x8'));var csv=require(_0xf94c('0x9'));var ejs=require(_0xf94c('0xa'));var fs=require('fs');var fs_extra=require(_0xf94c('0xb'));var _=require('lodash');var squel=require(_0xf94c('0xc'));var crypto=require(_0xf94c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf94c('0xe'));var toCsv=require(_0xf94c('0x9'));var querystring=require(_0xf94c('0xf'));var Papa=require(_0xf94c('0x10'));var Redis=require('ioredis');var authService=require(_0xf94c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf94c('0x12'));var hardwareService=require(_0xf94c('0x13'));var logger=require(_0xf94c('0x14'))(_0xf94c('0x15'));var utils=require(_0xf94c('0x16'));var config=require(_0xf94c('0x17'));var licenseUtil=require(_0xf94c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182478,_0x326038){_0x326038=_0x326038||0xcc;return function(_0xf0a826){if(_0xf0a826){return _0x182478['sendStatus'](_0x326038);}return _0x182478['status'](_0x326038)[_0xf94c('0x19')]();};}function respondWithResult(_0x1d8359,_0x3d44a9){_0x3d44a9=_0x3d44a9||0xc8;return function(_0x124f5b){if(_0x124f5b){return _0x1d8359[_0xf94c('0x1a')](_0x3d44a9)[_0xf94c('0x1b')](_0x124f5b);}};}function respondWithFilteredResult(_0x326cca,_0x892620){return function(_0x5cef8b){if(_0x5cef8b){var _0x1d410d=typeof _0x892620[_0xf94c('0x1c')]===_0xf94c('0x1d')&&typeof _0x892620[_0xf94c('0x1e')]===_0xf94c('0x1d');var _0x81cc7b=_0x5cef8b[_0xf94c('0x1f')];var _0x163d37=_0x1d410d?0x0:_0x892620[_0xf94c('0x1c')];var _0x3f469d=_0x1d410d?_0x5cef8b['count']:_0x892620[_0xf94c('0x1c')]+_0x892620[_0xf94c('0x1e')];var _0x596c6d;if(_0x3f469d>=_0x81cc7b){_0x3f469d=_0x81cc7b;_0x596c6d=0xc8;}else{_0x596c6d=0xce;}_0x326cca[_0xf94c('0x1a')](_0x596c6d);return _0x326cca[_0xf94c('0x20')](_0xf94c('0x21'),_0x163d37+'-'+_0x3f469d+'/'+_0x81cc7b)[_0xf94c('0x1b')](_0x5cef8b);}return null;};}function patchUpdates(_0x17b0db){return function(_0x540122){try{jsonpatch[_0xf94c('0x22')](_0x540122,_0x17b0db,!![]);}catch(_0xe5cdf1){return BPromise['reject'](_0xe5cdf1);}return _0x540122[_0xf94c('0x23')]();};}function saveUpdates(_0x17370d,_0x28bdb0){return function(_0x3f6d84){if(_0x3f6d84){return _0x3f6d84['update'](_0x17370d)[_0xf94c('0x24')](function(_0x2801dc){return _0x2801dc;});}return null;};}function removeEntity(_0x4de690,_0x4f8fd2){return function(_0x42c3f5){if(_0x42c3f5){return _0x42c3f5[_0xf94c('0x25')]()[_0xf94c('0x24')](function(){_0x4de690[_0xf94c('0x1a')](0xcc)[_0xf94c('0x19')]();});}};}function handleEntityNotFound(_0x2ae09b,_0x4f4155){return function(_0x5dda51){if(!_0x5dda51){_0x2ae09b[_0xf94c('0x26')](0x194);}return _0x5dda51;};}function handleError(_0x3e89df,_0x3b7427){_0x3b7427=_0x3b7427||0x1f4;return function(_0x3faed0){logger[_0xf94c('0x27')](_0x3faed0[_0xf94c('0x28')]);if(_0x3faed0['name']){delete _0x3faed0['name'];}_0x3e89df[_0xf94c('0x1a')](_0x3b7427)[_0xf94c('0x29')](_0x3faed0);};}exports['index']=function(_0x9ccda2,_0x20590f){var _0xc0633c={},_0x1adac1={},_0x253ff1={'count':0x0,'rows':[]};var _0xb968d0=_[_0xf94c('0x2a')](db[_0xf94c('0x2b')]['rawAttributes'],function(_0x181e93){return{'name':_0x181e93[_0xf94c('0x2c')],'type':_0x181e93[_0xf94c('0x2d')][_0xf94c('0x2e')]};});_0x1adac1[_0xf94c('0x2f')]=_[_0xf94c('0x2a')](_0xb968d0,'name');_0x1adac1[_0xf94c('0x30')]=_['keys'](_0x9ccda2[_0xf94c('0x30')]);_0x1adac1['filters']=_['intersection'](_0x1adac1[_0xf94c('0x2f')],_0x1adac1[_0xf94c('0x30')]);_0xc0633c[_0xf94c('0x31')]=_[_0xf94c('0x32')](_0x1adac1[_0xf94c('0x2f')],qs[_0xf94c('0x33')](_0x9ccda2[_0xf94c('0x30')][_0xf94c('0x33')]));_0xc0633c[_0xf94c('0x31')]=_0xc0633c['attributes'][_0xf94c('0x34')]?_0xc0633c['attributes']:_0x1adac1[_0xf94c('0x2f')];if(!_0x9ccda2['query']['hasOwnProperty'](_0xf94c('0x35'))){_0xc0633c['limit']=qs[_0xf94c('0x1e')](_0x9ccda2[_0xf94c('0x30')][_0xf94c('0x1e')]);_0xc0633c['offset']=qs['offset'](_0x9ccda2[_0xf94c('0x30')][_0xf94c('0x1c')]);}_0xc0633c[_0xf94c('0x36')]=qs['sort'](_0x9ccda2[_0xf94c('0x30')][_0xf94c('0x37')]);_0xc0633c['where']=qs[_0xf94c('0x38')](_[_0xf94c('0x39')](_0x9ccda2[_0xf94c('0x30')],_0x1adac1[_0xf94c('0x38')]),_0xb968d0);if(_0x9ccda2[_0xf94c('0x30')][_0xf94c('0x3a')]){_0xc0633c[_0xf94c('0x3b')]=_['merge'](_0xc0633c[_0xf94c('0x3b')],{'$or':_[_0xf94c('0x2a')](_0xb968d0,function(_0x2c6e24){if(_0x2c6e24['type']!=='VIRTUAL'){var _0xbdff3f={};_0xbdff3f[_0x2c6e24[_0xf94c('0x3c')]]={'$like':'%'+_0x9ccda2[_0xf94c('0x30')][_0xf94c('0x3a')]+'%'};return _0xbdff3f;}})});}_0xc0633c=_['merge']({},_0xc0633c,_0x9ccda2[_0xf94c('0x3d')]);var _0x5d3b56={'where':_0xc0633c['where']};return db[_0xf94c('0x2b')][_0xf94c('0x1f')](_0x5d3b56)['then'](function(_0x578561){_0x253ff1[_0xf94c('0x1f')]=_0x578561;if(_0x9ccda2['query'][_0xf94c('0x3e')]){_0xc0633c['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0xc0633c);})[_0xf94c('0x24')](function(_0x19c024){_0x253ff1[_0xf94c('0x3f')]=_0x19c024;return _0x253ff1;})[_0xf94c('0x24')](respondWithFilteredResult(_0x20590f,_0xc0633c))[_0xf94c('0x40')](handleError(_0x20590f,null));};exports['show']=function(_0x143d86,_0xcfdb2b){var _0x23ffb0={'raw':![],'where':{'id':_0x143d86['params']['id']}},_0x41c58c={};_0x41c58c[_0xf94c('0x2f')]=_[_0xf94c('0x41')](db[_0xf94c('0x2b')]['rawAttributes']);_0x41c58c[_0xf94c('0x30')]=_[_0xf94c('0x41')](_0x143d86[_0xf94c('0x30')]);_0x41c58c[_0xf94c('0x38')]=_['intersection'](_0x41c58c['model'],_0x41c58c['query']);_0x23ffb0['attributes']=_['intersection'](_0x41c58c[_0xf94c('0x2f')],qs[_0xf94c('0x33')](_0x143d86[_0xf94c('0x30')][_0xf94c('0x33')]));_0x23ffb0['attributes']=_0x23ffb0['attributes'][_0xf94c('0x34')]?_0x23ffb0[_0xf94c('0x31')]:_0x41c58c[_0xf94c('0x2f')];if(_0x143d86[_0xf94c('0x30')][_0xf94c('0x3e')]){_0x23ffb0[_0xf94c('0x42')]=[{'all':!![]}];}_0x23ffb0=_[_0xf94c('0x43')]({},_0x23ffb0,_0x143d86[_0xf94c('0x3d')]);return db[_0xf94c('0x2b')]['find'](_0x23ffb0)[_0xf94c('0x24')](handleEntityNotFound(_0xcfdb2b,null))['then'](respondWithResult(_0xcfdb2b,null))[_0xf94c('0x40')](handleError(_0xcfdb2b,null));};exports[_0xf94c('0x44')]=function(_0x52ea5e,_0x171975){return db['SalesforceConfiguration'][_0xf94c('0x44')](_0x52ea5e[_0xf94c('0x45')],{})[_0xf94c('0x24')](respondWithResult(_0x171975,0xc9))[_0xf94c('0x40')](handleError(_0x171975,null));};exports['update']=function(_0x1ca727,_0x547e82){if(_0x1ca727[_0xf94c('0x45')]['id']){delete _0x1ca727['body']['id'];}return db[_0xf94c('0x2b')][_0xf94c('0x46')]({'where':{'id':_0x1ca727[_0xf94c('0x47')]['id']}})[_0xf94c('0x24')](handleEntityNotFound(_0x547e82,null))[_0xf94c('0x24')](saveUpdates(_0x1ca727[_0xf94c('0x45')],null))['then'](respondWithResult(_0x547e82,null))[_0xf94c('0x40')](handleError(_0x547e82,null));};exports['destroy']=function(_0x5b0a5b,_0x3143e6){return db[_0xf94c('0x2b')][_0xf94c('0x46')]({'where':{'id':_0x5b0a5b['params']['id']}})[_0xf94c('0x24')](handleEntityNotFound(_0x3143e6,null))[_0xf94c('0x24')](removeEntity(_0x3143e6,null))['catch'](handleError(_0x3143e6,null));};exports[_0xf94c('0x48')]=function(_0xdc9075,_0x35cd5e,_0x419fc3){var _0x4922a3={};var _0x51b0d3={};var _0x15e3a4;var _0x3605c6;return db[_0xf94c('0x2b')][_0xf94c('0x49')]({'where':{'id':_0xdc9075[_0xf94c('0x47')]['id']}})[_0xf94c('0x24')](handleEntityNotFound(_0x35cd5e,null))[_0xf94c('0x24')](function(_0x5d1925){if(_0x5d1925){_0x15e3a4=_0x5d1925;_0x51b0d3[_0xf94c('0x2f')]=_[_0xf94c('0x41')](db[_0xf94c('0x4a')][_0xf94c('0x4b')]);_0x51b0d3[_0xf94c('0x30')]=_[_0xf94c('0x41')](_0xdc9075['query']);_0x51b0d3['filters']=_['intersection'](_0x51b0d3[_0xf94c('0x2f')],_0x51b0d3['query']);_0x4922a3[_0xf94c('0x31')]=_[_0xf94c('0x32')](_0x51b0d3[_0xf94c('0x2f')],qs[_0xf94c('0x33')](_0xdc9075[_0xf94c('0x30')][_0xf94c('0x33')]));_0x4922a3['attributes']=_0x4922a3[_0xf94c('0x31')][_0xf94c('0x34')]?_0x4922a3[_0xf94c('0x31')]:_0x51b0d3[_0xf94c('0x2f')];_0x4922a3['order']=qs[_0xf94c('0x37')](_0xdc9075[_0xf94c('0x30')][_0xf94c('0x37')]);_0x4922a3[_0xf94c('0x3b')]=qs[_0xf94c('0x38')](_[_0xf94c('0x39')](_0xdc9075[_0xf94c('0x30')],_0x51b0d3[_0xf94c('0x38')]));if(_0xdc9075[_0xf94c('0x30')]['filter']){_0x4922a3['where']=_[_0xf94c('0x43')](_0x4922a3['where'],{'$or':_[_0xf94c('0x2a')](_0x4922a3[_0xf94c('0x31')],function(_0x24ddfb){var _0x182ff6={};_0x182ff6[_0x24ddfb]={'$like':'%'+_0xdc9075[_0xf94c('0x30')][_0xf94c('0x3a')]+'%'};return _0x182ff6;})});}_0x4922a3=_[_0xf94c('0x43')]({},_0x4922a3,_0xdc9075[_0xf94c('0x3d')]);return _0x15e3a4['getFields'](_0x4922a3);}})['then'](function(_0xd5c1c0){if(_0xd5c1c0){_0x3605c6=_0xd5c1c0[_0xf94c('0x34')];if(!_0xdc9075[_0xf94c('0x30')][_0xf94c('0x4c')](_0xf94c('0x35'))){_0x4922a3[_0xf94c('0x1e')]=qs[_0xf94c('0x1e')](_0xdc9075[_0xf94c('0x30')][_0xf94c('0x1e')]);_0x4922a3['offset']=qs[_0xf94c('0x1c')](_0xdc9075[_0xf94c('0x30')][_0xf94c('0x1c')]);}return _0x15e3a4[_0xf94c('0x48')](_0x4922a3);}})['then'](function(_0x57fd31){if(_0x57fd31){return _0x57fd31?{'count':_0x3605c6,'rows':_0x57fd31}:null;}})[_0xf94c('0x24')](respondWithResult(_0x35cd5e,null))[_0xf94c('0x40')](handleError(_0x35cd5e,null));};exports[_0xf94c('0x4d')]=function(_0x286129,_0x150fb6,_0x2d9b52){var _0xeeda70={};var _0x41f87d={};var _0x56a013;var _0x5c99e1;return db[_0xf94c('0x2b')][_0xf94c('0x49')]({'where':{'id':_0x286129[_0xf94c('0x47')]['id']}})['then'](handleEntityNotFound(_0x150fb6,null))[_0xf94c('0x24')](function(_0x5be3db){if(_0x5be3db){_0x56a013=_0x5be3db;_0x41f87d[_0xf94c('0x2f')]=_[_0xf94c('0x41')](db[_0xf94c('0x4a')][_0xf94c('0x4b')]);_0x41f87d[_0xf94c('0x30')]=_[_0xf94c('0x41')](_0x286129[_0xf94c('0x30')]);_0x41f87d['filters']=_[_0xf94c('0x32')](_0x41f87d['model'],_0x41f87d[_0xf94c('0x30')]);_0xeeda70['attributes']=_[_0xf94c('0x32')](_0x41f87d['model'],qs[_0xf94c('0x33')](_0x286129['query'][_0xf94c('0x33')]));_0xeeda70[_0xf94c('0x31')]=_0xeeda70[_0xf94c('0x31')][_0xf94c('0x34')]?_0xeeda70[_0xf94c('0x31')]:_0x41f87d[_0xf94c('0x2f')];_0xeeda70[_0xf94c('0x36')]=qs['sort'](_0x286129[_0xf94c('0x30')][_0xf94c('0x37')]);_0xeeda70[_0xf94c('0x3b')]=qs[_0xf94c('0x38')](_['pick'](_0x286129['query'],_0x41f87d['filters']));if(_0x286129[_0xf94c('0x30')][_0xf94c('0x3a')]){_0xeeda70[_0xf94c('0x3b')]=_[_0xf94c('0x43')](_0xeeda70['where'],{'$or':_[_0xf94c('0x2a')](_0xeeda70['attributes'],function(_0x59dafe){var _0x359189={};_0x359189[_0x59dafe]={'$like':'%'+_0x286129[_0xf94c('0x30')][_0xf94c('0x3a')]+'%'};return _0x359189;})});}_0xeeda70=_[_0xf94c('0x43')]({},_0xeeda70,_0x286129[_0xf94c('0x3d')]);return _0x56a013[_0xf94c('0x4d')](_0xeeda70);}})[_0xf94c('0x24')](function(_0x176d98){if(_0x176d98){_0x5c99e1=_0x176d98[_0xf94c('0x34')];if(!_0x286129[_0xf94c('0x30')][_0xf94c('0x4c')]('nolimit')){_0xeeda70[_0xf94c('0x1e')]=qs[_0xf94c('0x1e')](_0x286129[_0xf94c('0x30')][_0xf94c('0x1e')]);_0xeeda70[_0xf94c('0x1c')]=qs['offset'](_0x286129[_0xf94c('0x30')][_0xf94c('0x1c')]);}return _0x56a013[_0xf94c('0x4d')](_0xeeda70);}})['then'](function(_0x19b2f6){if(_0x19b2f6){return _0x19b2f6?{'count':_0x5c99e1,'rows':_0x19b2f6}:null;}})[_0xf94c('0x24')](respondWithResult(_0x150fb6,null))['catch'](handleError(_0x150fb6,null));};exports['getDescriptions']=function(_0x20cce2,_0x19527f,_0x535ed9){var _0x53e0ec={};var _0x29eeba={};var _0x4149bd;var _0x321b11;return db[_0xf94c('0x2b')][_0xf94c('0x49')]({'where':{'id':_0x20cce2[_0xf94c('0x47')]['id']}})[_0xf94c('0x24')](handleEntityNotFound(_0x19527f,null))['then'](function(_0x444b86){if(_0x444b86){_0x4149bd=_0x444b86;_0x29eeba['model']=_[_0xf94c('0x41')](db[_0xf94c('0x4a')][_0xf94c('0x4b')]);_0x29eeba[_0xf94c('0x30')]=_[_0xf94c('0x41')](_0x20cce2[_0xf94c('0x30')]);_0x29eeba[_0xf94c('0x38')]=_[_0xf94c('0x32')](_0x29eeba['model'],_0x29eeba[_0xf94c('0x30')]);_0x53e0ec[_0xf94c('0x31')]=_['intersection'](_0x29eeba[_0xf94c('0x2f')],qs['fields'](_0x20cce2[_0xf94c('0x30')][_0xf94c('0x33')]));_0x53e0ec[_0xf94c('0x31')]=_0x53e0ec['attributes'][_0xf94c('0x34')]?_0x53e0ec[_0xf94c('0x31')]:_0x29eeba[_0xf94c('0x2f')];_0x53e0ec[_0xf94c('0x36')]=qs[_0xf94c('0x37')](_0x20cce2[_0xf94c('0x30')][_0xf94c('0x37')]);_0x53e0ec[_0xf94c('0x3b')]=qs[_0xf94c('0x38')](_[_0xf94c('0x39')](_0x20cce2[_0xf94c('0x30')],_0x29eeba[_0xf94c('0x38')]));if(_0x20cce2['query']['filter']){_0x53e0ec[_0xf94c('0x3b')]=_[_0xf94c('0x43')](_0x53e0ec[_0xf94c('0x3b')],{'$or':_['map'](_0x53e0ec[_0xf94c('0x31')],function(_0x552faf){var _0x3f90c1={};_0x3f90c1[_0x552faf]={'$like':'%'+_0x20cce2['query']['filter']+'%'};return _0x3f90c1;})});}_0x53e0ec=_[_0xf94c('0x43')]({},_0x53e0ec,_0x20cce2[_0xf94c('0x3d')]);return _0x4149bd[_0xf94c('0x4e')](_0x53e0ec);}})[_0xf94c('0x24')](function(_0xde76){if(_0xde76){_0x321b11=_0xde76[_0xf94c('0x34')];if(!_0x20cce2['query'][_0xf94c('0x4c')]('nolimit')){_0x53e0ec[_0xf94c('0x1e')]=qs['limit'](_0x20cce2['query'][_0xf94c('0x1e')]);_0x53e0ec[_0xf94c('0x1c')]=qs[_0xf94c('0x1c')](_0x20cce2['query'][_0xf94c('0x1c')]);}return _0x4149bd['getDescriptions'](_0x53e0ec);}})[_0xf94c('0x24')](function(_0x5d4120){if(_0x5d4120){return _0x5d4120?{'count':_0x321b11,'rows':_0x5d4120}:null;}})[_0xf94c('0x24')](respondWithResult(_0x19527f,null))[_0xf94c('0x40')](handleError(_0x19527f,null));}; \ No newline at end of file +var _0xe06c=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','index','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','body','destroy','findOne','SalesforceField','map','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x2871ae,_0x2bdf34){var _0x3a9826=function(_0x33d7bd){while(--_0x33d7bd){_0x2871ae['push'](_0x2871ae['shift']());}};_0x3a9826(++_0x2bdf34);}(_0xe06c,0x99));var _0xce06=function(_0x2379f3,_0x5e1dc0){_0x2379f3=_0x2379f3-0x0;var _0x2b4c66=_0xe06c[_0x2379f3];return _0x2b4c66;};'use strict';var emlformat=require(_0xce06('0x0'));var rimraf=require(_0xce06('0x1'));var zipdir=require(_0xce06('0x2'));var jsonpatch=require(_0xce06('0x3'));var rp=require(_0xce06('0x4'));var moment=require('moment');var BPromise=require(_0xce06('0x5'));var Mustache=require(_0xce06('0x6'));var util=require(_0xce06('0x7'));var path=require(_0xce06('0x8'));var sox=require('sox');var csv=require(_0xce06('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce06('0xa'));var _=require(_0xce06('0xb'));var squel=require(_0xce06('0xc'));var crypto=require(_0xce06('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce06('0x9'));var querystring=require(_0xce06('0xe'));var Papa=require(_0xce06('0xf'));var Redis=require(_0xce06('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xce06('0x11'));var as=require(_0xce06('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce06('0x13'))(_0xce06('0x14'));var utils=require(_0xce06('0x15'));var config=require(_0xce06('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xce06('0x17'))['db'];function respondWithStatusCode(_0x2341e5,_0xc61ec6){_0xc61ec6=_0xc61ec6||0xcc;return function(_0x367cdc){if(_0x367cdc){return _0x2341e5[_0xce06('0x18')](_0xc61ec6);}return _0x2341e5[_0xce06('0x19')](_0xc61ec6)[_0xce06('0x1a')]();};}function respondWithResult(_0x370433,_0x40cb45){_0x40cb45=_0x40cb45||0xc8;return function(_0x148f20){if(_0x148f20){return _0x370433[_0xce06('0x19')](_0x40cb45)[_0xce06('0x1b')](_0x148f20);}};}function respondWithFilteredResult(_0x5ba481,_0x2c784c){return function(_0x11db2e){if(_0x11db2e){var _0x4950fa=typeof _0x2c784c[_0xce06('0x1c')]===_0xce06('0x1d')&&typeof _0x2c784c[_0xce06('0x1e')]===_0xce06('0x1d');var _0x22dd83=_0x11db2e[_0xce06('0x1f')];var _0x19c8c7=_0x4950fa?0x0:_0x2c784c[_0xce06('0x1c')];var _0x4a02ec=_0x4950fa?_0x11db2e[_0xce06('0x1f')]:_0x2c784c[_0xce06('0x1c')]+_0x2c784c[_0xce06('0x1e')];var _0x160914;if(_0x4a02ec>=_0x22dd83){_0x4a02ec=_0x22dd83;_0x160914=0xc8;}else{_0x160914=0xce;}_0x5ba481[_0xce06('0x19')](_0x160914);return _0x5ba481[_0xce06('0x20')](_0xce06('0x21'),_0x19c8c7+'-'+_0x4a02ec+'/'+_0x22dd83)[_0xce06('0x1b')](_0x11db2e);}return null;};}function patchUpdates(_0x17423c){return function(_0x2c360e){try{jsonpatch['apply'](_0x2c360e,_0x17423c,!![]);}catch(_0x5d5a1f){return BPromise[_0xce06('0x22')](_0x5d5a1f);}return _0x2c360e[_0xce06('0x23')]();};}function saveUpdates(_0x4447ed,_0xd586f7){return function(_0x51248c){if(_0x51248c){return _0x51248c[_0xce06('0x24')](_0x4447ed)[_0xce06('0x25')](function(_0x39e687){return _0x39e687;});}return null;};}function removeEntity(_0x32a8cb,_0x168b6b){return function(_0x34cd8c){if(_0x34cd8c){return _0x34cd8c['destroy']()[_0xce06('0x25')](function(){_0x32a8cb[_0xce06('0x19')](0xcc)[_0xce06('0x1a')]();});}};}function handleEntityNotFound(_0x104d70,_0x5f2239){return function(_0x431baa){if(!_0x431baa){_0x104d70[_0xce06('0x18')](0x194);}return _0x431baa;};}function handleError(_0x5725e8,_0x44bee7){_0x44bee7=_0x44bee7||0x1f4;return function(_0x2d5fe2){logger[_0xce06('0x26')](_0x2d5fe2['stack']);if(_0x2d5fe2[_0xce06('0x27')]){delete _0x2d5fe2[_0xce06('0x27')];}_0x5725e8[_0xce06('0x19')](_0x44bee7)['send'](_0x2d5fe2);};}exports[_0xce06('0x28')]=function(_0x8a848,_0x409aa1){var _0x3d7155={},_0x46e3c5={},_0x492c61={'count':0x0,'rows':[]};var _0xd2b2ee=_['map'](db[_0xce06('0x29')][_0xce06('0x2a')],function(_0xee859b){return{'name':_0xee859b[_0xce06('0x2b')],'type':_0xee859b['type'][_0xce06('0x2c')]};});_0x46e3c5[_0xce06('0x2d')]=_['map'](_0xd2b2ee,_0xce06('0x27'));_0x46e3c5[_0xce06('0x2e')]=_[_0xce06('0x2f')](_0x8a848['query']);_0x46e3c5['filters']=_[_0xce06('0x30')](_0x46e3c5[_0xce06('0x2d')],_0x46e3c5['query']);_0x3d7155[_0xce06('0x31')]=_[_0xce06('0x30')](_0x46e3c5[_0xce06('0x2d')],qs[_0xce06('0x32')](_0x8a848['query'][_0xce06('0x32')]));_0x3d7155[_0xce06('0x31')]=_0x3d7155['attributes']['length']?_0x3d7155[_0xce06('0x31')]:_0x46e3c5['model'];if(!_0x8a848[_0xce06('0x2e')][_0xce06('0x33')](_0xce06('0x34'))){_0x3d7155[_0xce06('0x1e')]=qs[_0xce06('0x1e')](_0x8a848['query'][_0xce06('0x1e')]);_0x3d7155[_0xce06('0x1c')]=qs[_0xce06('0x1c')](_0x8a848['query']['offset']);}_0x3d7155[_0xce06('0x35')]=qs[_0xce06('0x36')](_0x8a848['query'][_0xce06('0x36')]);_0x3d7155[_0xce06('0x37')]=qs['filters'](_[_0xce06('0x38')](_0x8a848[_0xce06('0x2e')],_0x46e3c5[_0xce06('0x39')]),_0xd2b2ee);if(_0x8a848['query'][_0xce06('0x3a')]){_0x3d7155[_0xce06('0x37')]=_[_0xce06('0x3b')](_0x3d7155['where'],{'$or':_['map'](_0xd2b2ee,function(_0x392357){if(_0x392357['type']!==_0xce06('0x3c')){var _0x2dede7={};_0x2dede7[_0x392357[_0xce06('0x27')]]={'$like':'%'+_0x8a848[_0xce06('0x2e')][_0xce06('0x3a')]+'%'};return _0x2dede7;}})});}_0x3d7155=_[_0xce06('0x3b')]({},_0x3d7155,_0x8a848[_0xce06('0x3d')]);var _0x2853ff={'where':_0x3d7155[_0xce06('0x37')]};return db['SalesforceConfiguration'][_0xce06('0x1f')](_0x2853ff)[_0xce06('0x25')](function(_0x53377d){_0x492c61['count']=_0x53377d;if(_0x8a848[_0xce06('0x2e')][_0xce06('0x3e')]){_0x3d7155[_0xce06('0x3f')]=[{'all':!![]}];}return db[_0xce06('0x29')][_0xce06('0x40')](_0x3d7155);})[_0xce06('0x25')](function(_0x28c0bc){_0x492c61['rows']=_0x28c0bc;return _0x492c61;})[_0xce06('0x25')](respondWithFilteredResult(_0x409aa1,_0x3d7155))[_0xce06('0x41')](handleError(_0x409aa1,null));};exports['show']=function(_0x1b48ec,_0x2265dd){var _0x1b34e3={'raw':![],'where':{'id':_0x1b48ec[_0xce06('0x42')]['id']}},_0x4267fa={};_0x4267fa[_0xce06('0x2d')]=_['keys'](db[_0xce06('0x29')]['rawAttributes']);_0x4267fa[_0xce06('0x2e')]=_[_0xce06('0x2f')](_0x1b48ec['query']);_0x4267fa[_0xce06('0x39')]=_[_0xce06('0x30')](_0x4267fa[_0xce06('0x2d')],_0x4267fa[_0xce06('0x2e')]);_0x1b34e3[_0xce06('0x31')]=_[_0xce06('0x30')](_0x4267fa[_0xce06('0x2d')],qs[_0xce06('0x32')](_0x1b48ec[_0xce06('0x2e')][_0xce06('0x32')]));_0x1b34e3[_0xce06('0x31')]=_0x1b34e3[_0xce06('0x31')][_0xce06('0x43')]?_0x1b34e3[_0xce06('0x31')]:_0x4267fa[_0xce06('0x2d')];if(_0x1b48ec[_0xce06('0x2e')]['includeAll']){_0x1b34e3['include']=[{'all':!![]}];}_0x1b34e3=_[_0xce06('0x3b')]({},_0x1b34e3,_0x1b48ec[_0xce06('0x3d')]);return db['SalesforceConfiguration'][_0xce06('0x44')](_0x1b34e3)['then'](handleEntityNotFound(_0x2265dd,null))[_0xce06('0x25')](respondWithResult(_0x2265dd,null))[_0xce06('0x41')](handleError(_0x2265dd,null));};exports[_0xce06('0x45')]=function(_0x12dc4d,_0x138c10){return db[_0xce06('0x29')]['create'](_0x12dc4d['body'],{})[_0xce06('0x25')](respondWithResult(_0x138c10,0xc9))['catch'](handleError(_0x138c10,null));};exports[_0xce06('0x24')]=function(_0x4f27a4,_0x256b2d){if(_0x4f27a4['body']['id']){delete _0x4f27a4[_0xce06('0x46')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x4f27a4[_0xce06('0x42')]['id']}})[_0xce06('0x25')](handleEntityNotFound(_0x256b2d,null))[_0xce06('0x25')](saveUpdates(_0x4f27a4[_0xce06('0x46')],null))[_0xce06('0x25')](respondWithResult(_0x256b2d,null))[_0xce06('0x41')](handleError(_0x256b2d,null));};exports[_0xce06('0x47')]=function(_0x2bbd7f,_0x689c6b){return db['SalesforceConfiguration'][_0xce06('0x44')]({'where':{'id':_0x2bbd7f[_0xce06('0x42')]['id']}})[_0xce06('0x25')](handleEntityNotFound(_0x689c6b,null))['then'](removeEntity(_0x689c6b,null))[_0xce06('0x41')](handleError(_0x689c6b,null));};exports['getFields']=function(_0x35676b,_0x28ad53,_0x3b288a){var _0x52e401={};var _0x16619a={};var _0x4377d2;var _0x334ded;return db['SalesforceConfiguration'][_0xce06('0x48')]({'where':{'id':_0x35676b[_0xce06('0x42')]['id']}})[_0xce06('0x25')](handleEntityNotFound(_0x28ad53,null))[_0xce06('0x25')](function(_0x12a296){if(_0x12a296){_0x4377d2=_0x12a296;_0x16619a[_0xce06('0x2d')]=_[_0xce06('0x2f')](db[_0xce06('0x49')][_0xce06('0x2a')]);_0x16619a[_0xce06('0x2e')]=_[_0xce06('0x2f')](_0x35676b['query']);_0x16619a[_0xce06('0x39')]=_[_0xce06('0x30')](_0x16619a[_0xce06('0x2d')],_0x16619a[_0xce06('0x2e')]);_0x52e401['attributes']=_[_0xce06('0x30')](_0x16619a[_0xce06('0x2d')],qs[_0xce06('0x32')](_0x35676b[_0xce06('0x2e')][_0xce06('0x32')]));_0x52e401[_0xce06('0x31')]=_0x52e401[_0xce06('0x31')][_0xce06('0x43')]?_0x52e401[_0xce06('0x31')]:_0x16619a[_0xce06('0x2d')];_0x52e401['order']=qs['sort'](_0x35676b[_0xce06('0x2e')][_0xce06('0x36')]);_0x52e401[_0xce06('0x37')]=qs['filters'](_['pick'](_0x35676b[_0xce06('0x2e')],_0x16619a['filters']));if(_0x35676b[_0xce06('0x2e')][_0xce06('0x3a')]){_0x52e401['where']=_[_0xce06('0x3b')](_0x52e401[_0xce06('0x37')],{'$or':_[_0xce06('0x4a')](_0x52e401[_0xce06('0x31')],function(_0xb5a3ae){var _0x12086b={};_0x12086b[_0xb5a3ae]={'$like':'%'+_0x35676b['query'][_0xce06('0x3a')]+'%'};return _0x12086b;})});}_0x52e401=_[_0xce06('0x3b')]({},_0x52e401,_0x35676b[_0xce06('0x3d')]);return _0x4377d2[_0xce06('0x4b')](_0x52e401);}})[_0xce06('0x25')](function(_0x3545cc){if(_0x3545cc){_0x334ded=_0x3545cc[_0xce06('0x43')];if(!_0x35676b['query']['hasOwnProperty']('nolimit')){_0x52e401[_0xce06('0x1e')]=qs[_0xce06('0x1e')](_0x35676b[_0xce06('0x2e')][_0xce06('0x1e')]);_0x52e401[_0xce06('0x1c')]=qs['offset'](_0x35676b[_0xce06('0x2e')][_0xce06('0x1c')]);}return _0x4377d2[_0xce06('0x4b')](_0x52e401);}})[_0xce06('0x25')](function(_0x449c57){if(_0x449c57){return _0x449c57?{'count':_0x334ded,'rows':_0x449c57}:null;}})[_0xce06('0x25')](respondWithResult(_0x28ad53,null))[_0xce06('0x41')](handleError(_0x28ad53,null));};exports['getSubjects']=function(_0x210b81,_0x4fe4c8,_0x40818c){var _0x490200={};var _0x405a5b={};var _0x47fb0c;var _0x48138f;return db[_0xce06('0x29')]['findOne']({'where':{'id':_0x210b81['params']['id']}})[_0xce06('0x25')](handleEntityNotFound(_0x4fe4c8,null))['then'](function(_0x246030){if(_0x246030){_0x47fb0c=_0x246030;_0x405a5b['model']=_['keys'](db[_0xce06('0x49')][_0xce06('0x2a')]);_0x405a5b['query']=_[_0xce06('0x2f')](_0x210b81[_0xce06('0x2e')]);_0x405a5b[_0xce06('0x39')]=_[_0xce06('0x30')](_0x405a5b[_0xce06('0x2d')],_0x405a5b[_0xce06('0x2e')]);_0x490200[_0xce06('0x31')]=_[_0xce06('0x30')](_0x405a5b[_0xce06('0x2d')],qs[_0xce06('0x32')](_0x210b81['query'][_0xce06('0x32')]));_0x490200[_0xce06('0x31')]=_0x490200[_0xce06('0x31')][_0xce06('0x43')]?_0x490200['attributes']:_0x405a5b['model'];_0x490200[_0xce06('0x35')]=qs[_0xce06('0x36')](_0x210b81[_0xce06('0x2e')][_0xce06('0x36')]);_0x490200[_0xce06('0x37')]=qs[_0xce06('0x39')](_[_0xce06('0x38')](_0x210b81[_0xce06('0x2e')],_0x405a5b[_0xce06('0x39')]));if(_0x210b81[_0xce06('0x2e')][_0xce06('0x3a')]){_0x490200[_0xce06('0x37')]=_[_0xce06('0x3b')](_0x490200[_0xce06('0x37')],{'$or':_[_0xce06('0x4a')](_0x490200['attributes'],function(_0x110009){var _0xc3290c={};_0xc3290c[_0x110009]={'$like':'%'+_0x210b81[_0xce06('0x2e')][_0xce06('0x3a')]+'%'};return _0xc3290c;})});}_0x490200=_[_0xce06('0x3b')]({},_0x490200,_0x210b81[_0xce06('0x3d')]);return _0x47fb0c['getSubjects'](_0x490200);}})['then'](function(_0x138665){if(_0x138665){_0x48138f=_0x138665['length'];if(!_0x210b81[_0xce06('0x2e')]['hasOwnProperty'](_0xce06('0x34'))){_0x490200[_0xce06('0x1e')]=qs[_0xce06('0x1e')](_0x210b81[_0xce06('0x2e')]['limit']);_0x490200[_0xce06('0x1c')]=qs['offset'](_0x210b81[_0xce06('0x2e')][_0xce06('0x1c')]);}return _0x47fb0c[_0xce06('0x4c')](_0x490200);}})['then'](function(_0x39b1fe){if(_0x39b1fe){return _0x39b1fe?{'count':_0x48138f,'rows':_0x39b1fe}:null;}})['then'](respondWithResult(_0x4fe4c8,null))[_0xce06('0x41')](handleError(_0x4fe4c8,null));};exports[_0xce06('0x4d')]=function(_0x3523dd,_0x2519bc,_0x5eaf32){var _0x556f30={};var _0x18a306={};var _0x19ebc1;var _0x258d2f;return db['SalesforceConfiguration'][_0xce06('0x48')]({'where':{'id':_0x3523dd[_0xce06('0x42')]['id']}})['then'](handleEntityNotFound(_0x2519bc,null))[_0xce06('0x25')](function(_0x27f04b){if(_0x27f04b){_0x19ebc1=_0x27f04b;_0x18a306['model']=_['keys'](db[_0xce06('0x49')][_0xce06('0x2a')]);_0x18a306[_0xce06('0x2e')]=_[_0xce06('0x2f')](_0x3523dd[_0xce06('0x2e')]);_0x18a306[_0xce06('0x39')]=_[_0xce06('0x30')](_0x18a306[_0xce06('0x2d')],_0x18a306[_0xce06('0x2e')]);_0x556f30[_0xce06('0x31')]=_[_0xce06('0x30')](_0x18a306[_0xce06('0x2d')],qs[_0xce06('0x32')](_0x3523dd[_0xce06('0x2e')]['fields']));_0x556f30['attributes']=_0x556f30[_0xce06('0x31')]['length']?_0x556f30[_0xce06('0x31')]:_0x18a306[_0xce06('0x2d')];_0x556f30[_0xce06('0x35')]=qs['sort'](_0x3523dd[_0xce06('0x2e')][_0xce06('0x36')]);_0x556f30[_0xce06('0x37')]=qs[_0xce06('0x39')](_['pick'](_0x3523dd[_0xce06('0x2e')],_0x18a306['filters']));if(_0x3523dd[_0xce06('0x2e')][_0xce06('0x3a')]){_0x556f30[_0xce06('0x37')]=_[_0xce06('0x3b')](_0x556f30['where'],{'$or':_[_0xce06('0x4a')](_0x556f30[_0xce06('0x31')],function(_0x5e0cab){var _0x2a8be9={};_0x2a8be9[_0x5e0cab]={'$like':'%'+_0x3523dd[_0xce06('0x2e')][_0xce06('0x3a')]+'%'};return _0x2a8be9;})});}_0x556f30=_[_0xce06('0x3b')]({},_0x556f30,_0x3523dd[_0xce06('0x3d')]);return _0x19ebc1[_0xce06('0x4d')](_0x556f30);}})['then'](function(_0x20c67b){if(_0x20c67b){_0x258d2f=_0x20c67b['length'];if(!_0x3523dd['query'][_0xce06('0x33')](_0xce06('0x34'))){_0x556f30[_0xce06('0x1e')]=qs['limit'](_0x3523dd[_0xce06('0x2e')][_0xce06('0x1e')]);_0x556f30[_0xce06('0x1c')]=qs[_0xce06('0x1c')](_0x3523dd[_0xce06('0x2e')][_0xce06('0x1c')]);}return _0x19ebc1[_0xce06('0x4d')](_0x556f30);}})[_0xce06('0x25')](function(_0x558a16){if(_0x558a16){return _0x558a16?{'count':_0x258d2f,'rows':_0x558a16}:null;}})[_0xce06('0x25')](respondWithResult(_0x2519bc,null))['catch'](handleError(_0x2519bc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 3bee284..6546e56 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 _0xdaa3=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0xae8a9e,_0x22e774){var _0x3e4e9b=function(_0xa4fdef){while(--_0xa4fdef){_0xae8a9e['push'](_0xae8a9e['shift']());}};_0x3e4e9b(++_0x22e774);}(_0xdaa3,0x1af));var _0x3daa=function(_0x13a86a,_0x19c627){_0x13a86a=_0x13a86a-0x0;var _0x4dc68e=_0xdaa3[_0x13a86a];return _0x4dc68e;};'use strict';var _=require(_0x3daa('0x0'));var util=require(_0x3daa('0x1'));var logger=require(_0x3daa('0x2'))(_0x3daa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3daa('0x4'));var fs=require('fs');var path=require(_0x3daa('0x5'));var rimraf=require(_0x3daa('0x6'));var config=require(_0x3daa('0x7'));var attributes=require(_0x3daa('0x8'));module['exports']=function(_0x1e14a1,_0x30e840){return _0x1e14a1[_0x3daa('0x9')](_0x3daa('0xa'),attributes,{'tableName':_0x3daa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4224=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','api','bluebird','request-promise'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x4224,0x1e0));var _0x4422=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x4224[_0x246148];return _0x453d94;};'use strict';var _=require('lodash');var util=require(_0x4422('0x0'));var logger=require('../../config/logger')(_0x4422('0x1'));var moment=require('moment');var BPromise=require(_0x4422('0x2'));var rp=require(_0x4422('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4422('0x4'));var config=require(_0x4422('0x5'));var attributes=require(_0x4422('0x6'));module[_0x4422('0x7')]=function(_0x3de1f2,_0x331c51){return _0x3de1f2[_0x4422('0x8')](_0x4422('0x9'),attributes,{'tableName':_0x4422('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9298562..c204659 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 _0xc158=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xc158,0x156));var _0x8c15=function(_0x5b7588,_0x509594){_0x5b7588=_0x5b7588-0x0;var _0x39ccbf=_0xc158[_0x5b7588];return _0x39ccbf;};'use strict';var _=require(_0x8c15('0x0'));var util=require(_0x8c15('0x1'));var moment=require(_0x8c15('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c15('0x3'));var fs=require('fs');var Redis=require(_0x8c15('0x4'));var db=require(_0x8c15('0x5'))['db'];var utils=require(_0x8c15('0x6'));var logger=require(_0x8c15('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8c15('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x399acc,_0x339667,_0x4e7e3f){return new BPromise(function(_0x3297e2,_0x28ea2b){return client[_0x8c15('0x9')](_0x399acc,_0x4e7e3f)[_0x8c15('0xa')](function(_0xfbae58){logger[_0x8c15('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x339667,_0x8c15('0xc'));logger['debug'](_0x8c15('0xd'),_0x339667,_0x8c15('0xc'),JSON['stringify'](_0xfbae58));if(_0xfbae58[_0x8c15('0xe')]){if(_0xfbae58['error'][_0x8c15('0xf')]===0x1f4){logger['error'](_0x8c15('0x10'),_0x339667,_0xfbae58['error']['message']);return _0x28ea2b(_0xfbae58['error']['message']);}logger[_0x8c15('0xe')](_0x8c15('0x10'),_0x339667,_0xfbae58[_0x8c15('0xe')][_0x8c15('0x11')]);return _0x3297e2(_0xfbae58[_0x8c15('0xe')][_0x8c15('0x11')]);}else{logger['info'](_0x8c15('0x10'),_0x339667,'request\x20sent');_0x3297e2(_0xfbae58[_0x8c15('0x12')][_0x8c15('0x11')]);}})[_0x8c15('0x13')](function(_0x35aeeb){logger[_0x8c15('0xe')](_0x8c15('0x10'),_0x339667,_0x35aeeb);_0x28ea2b(_0x35aeeb);});});} \ No newline at end of file +var _0x95b1=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','result'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x95b1,0xb1));var _0x195b=function(_0x5c5988,_0x5ceb12){_0x5c5988=_0x5c5988-0x0;var _0x13188f=_0x95b1[_0x5c5988];return _0x13188f;};'use strict';var _=require('lodash');var util=require(_0x195b('0x0'));var moment=require(_0x195b('0x1'));var BPromise=require('bluebird');var rs=require(_0x195b('0x2'));var fs=require('fs');var Redis=require(_0x195b('0x3'));var db=require(_0x195b('0x4'))['db'];var utils=require(_0x195b('0x5'));var logger=require(_0x195b('0x6'))('rpc');var config=require(_0x195b('0x7'));var jayson=require(_0x195b('0x8'));var client=jayson[_0x195b('0x9')][_0x195b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ae0ce,_0x262cbe,_0x57dee3){return new BPromise(function(_0x1ca809,_0x176c7a){return client[_0x195b('0xb')](_0x2ae0ce,_0x57dee3)[_0x195b('0xc')](function(_0x48d0ee){logger[_0x195b('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x262cbe,_0x195b('0xe'));logger['debug'](_0x195b('0xf'),_0x262cbe,_0x195b('0xe'),JSON[_0x195b('0x10')](_0x48d0ee));if(_0x48d0ee[_0x195b('0x11')]){if(_0x48d0ee[_0x195b('0x11')]['code']===0x1f4){logger[_0x195b('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x262cbe,_0x48d0ee[_0x195b('0x11')][_0x195b('0x12')]);return _0x176c7a(_0x48d0ee[_0x195b('0x11')][_0x195b('0x12')]);}logger[_0x195b('0x11')](_0x195b('0x13'),_0x262cbe,_0x48d0ee[_0x195b('0x11')][_0x195b('0x12')]);return _0x1ca809(_0x48d0ee[_0x195b('0x11')]['message']);}else{logger[_0x195b('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x262cbe,_0x195b('0xe'));_0x1ca809(_0x48d0ee[_0x195b('0x14')]['message']);}})[_0x195b('0x15')](function(_0x323dd5){logger[_0x195b('0x11')](_0x195b('0x13'),_0x262cbe,_0x323dd5);_0x176c7a(_0x323dd5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ecfc970..413d99e 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 _0xcc1a=['Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','/:id','show','create','put','isAuthenticated','update','destroy','exports','util','path','express'];(function(_0x565b8f,_0x60600f){var _0x2a4af6=function(_0x1348b6){while(--_0x1348b6){_0x565b8f['push'](_0x565b8f['shift']());}};_0x2a4af6(++_0x60600f);}(_0xcc1a,0x1cd));var _0xacc1=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0xcc1a[_0x838813];return _0x2bd32d;};'use strict';var multer=require('multer');var util=require(_0xacc1('0x0'));var path=require(_0xacc1('0x1'));var timeout=require('connect-timeout');var express=require(_0xacc1('0x2'));var router=express[_0xacc1('0x3')]();var fs_extra=require(_0xacc1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xacc1('0x5'));var controller=require(_0xacc1('0x6'));router[_0xacc1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xacc1('0x7')](_0xacc1('0x8'),auth['isAuthenticated'](),controller[_0xacc1('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xacc1('0xa')]);router[_0xacc1('0xb')](_0xacc1('0x8'),auth[_0xacc1('0xc')](),controller[_0xacc1('0xd')]);router['delete'](_0xacc1('0x8'),auth['isAuthenticated'](),controller[_0xacc1('0xe')]);module[_0xacc1('0xf')]=router; \ No newline at end of file +var _0xce23=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x155db2,_0x3d70bf){var _0x45d945=function(_0x4beecd){while(--_0x4beecd){_0x155db2['push'](_0x155db2['shift']());}};_0x45d945(++_0x3d70bf);}(_0xce23,0x169));var _0x3ce2=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xce23[_0xc0a3d3];return _0x3386e8;};'use strict';var multer=require(_0x3ce2('0x0'));var util=require(_0x3ce2('0x1'));var path=require('path');var timeout=require(_0x3ce2('0x2'));var express=require('express');var router=express[_0x3ce2('0x3')]();var fs_extra=require(_0x3ce2('0x4'));var auth=require(_0x3ce2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ce2('0x6'));var controller=require(_0x3ce2('0x7'));router['get']('/',auth[_0x3ce2('0x8')](),controller[_0x3ce2('0x9')]);router[_0x3ce2('0xa')](_0x3ce2('0xb'),auth[_0x3ce2('0x8')](),controller[_0x3ce2('0xc')]);router[_0x3ce2('0xd')]('/',auth[_0x3ce2('0x8')](),controller[_0x3ce2('0xe')]);router['put'](_0x3ce2('0xb'),auth[_0x3ce2('0x8')](),controller[_0x3ce2('0xf')]);router[_0x3ce2('0x10')](_0x3ce2('0xb'),auth['isAuthenticated'](),controller[_0x3ce2('0x11')]);module[_0x3ce2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index ab8b5ed..4820da2 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 _0x7049=['keyValue','picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x7049,0xeb));var _0x9704=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7049[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require('sequelize');module[_0x9704('0x0')]={'type':{'type':Sequelize[_0x9704('0x1')](_0x9704('0x2'),_0x9704('0x3'),_0x9704('0x4'),_0x9704('0x5'),_0x9704('0x6')),'defaultValue':_0x9704('0x2')},'content':{'type':Sequelize[_0x9704('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9704('0x1')]('string',_0x9704('0x3'),_0x9704('0x4'))},'keyContent':{'type':Sequelize[_0x9704('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9704('0x7')]}}; \ No newline at end of file +var _0xcc21=['variable','customVariable','picklist','STRING','ENUM','sequelize','exports','string'];(function(_0x4edd73,_0x31c9f4){var _0x60a855=function(_0x183bce){while(--_0x183bce){_0x4edd73['push'](_0x4edd73['shift']());}};_0x60a855(++_0x31c9f4);}(_0xcc21,0x95));var _0x1cc2=function(_0x38cbdf,_0x4eb95f){_0x38cbdf=_0x38cbdf-0x0;var _0x20ebce=_0xcc21[_0x38cbdf];return _0x20ebce;};'use strict';var Sequelize=require(_0x1cc2('0x0'));module[_0x1cc2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1cc2('0x2'),_0x1cc2('0x3'),_0x1cc2('0x4'),'keyValue',_0x1cc2('0x5')),'defaultValue':_0x1cc2('0x2')},'content':{'type':Sequelize[_0x1cc2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1cc2('0x7')](_0x1cc2('0x2'),_0x1cc2('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x1cc2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b44ab7e..1a04744 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 _0x91d7=['nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','SalesforceField','includeAll','include','findAll','show','catch','create','body','find','params','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5be5f0,_0x27c200){var _0x229c02=function(_0x478913){while(--_0x478913){_0x5be5f0['push'](_0x5be5f0['shift']());}};_0x229c02(++_0x27c200);}(_0x91d7,0x1c3));var _0x791d=function(_0x378bcd,_0x51358e){_0x378bcd=_0x378bcd-0x0;var _0x41229e=_0x91d7[_0x378bcd];return _0x41229e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x791d('0x1'));var rp=require(_0x791d('0x2'));var moment=require('moment');var BPromise=require(_0x791d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791d('0x4'));var sox=require(_0x791d('0x5'));var csv=require(_0x791d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791d('0x7'));var _=require('lodash');var squel=require(_0x791d('0x8'));var crypto=require(_0x791d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791d('0xa'));var toCsv=require(_0x791d('0x6'));var querystring=require('querystring');var Papa=require(_0x791d('0xb'));var Redis=require('ioredis');var authService=require(_0x791d('0xc'));var qs=require(_0x791d('0xd'));var as=require(_0x791d('0xe'));var hardwareService=require(_0x791d('0xf'));var logger=require(_0x791d('0x10'))('api');var utils=require(_0x791d('0x11'));var config=require(_0x791d('0x12'));var licenseUtil=require(_0x791d('0x13'));var db=require(_0x791d('0x14'))['db'];function respondWithStatusCode(_0x518523,_0x4629ac){_0x4629ac=_0x4629ac||0xcc;return function(_0x34a1de){if(_0x34a1de){return _0x518523[_0x791d('0x15')](_0x4629ac);}return _0x518523[_0x791d('0x16')](_0x4629ac)[_0x791d('0x17')]();};}function respondWithResult(_0x5d70ac,_0x7e788a){_0x7e788a=_0x7e788a||0xc8;return function(_0x169639){if(_0x169639){return _0x5d70ac[_0x791d('0x16')](_0x7e788a)[_0x791d('0x18')](_0x169639);}};}function respondWithFilteredResult(_0x8dbf6e,_0x3019a4){return function(_0x59fbfd){if(_0x59fbfd){var _0x4f2b57=typeof _0x3019a4[_0x791d('0x19')]==='undefined'&&typeof _0x3019a4[_0x791d('0x1a')]===_0x791d('0x1b');var _0x5d0181=_0x59fbfd['count'];var _0x33dd39=_0x4f2b57?0x0:_0x3019a4[_0x791d('0x19')];var _0xa9ea77=_0x4f2b57?_0x59fbfd[_0x791d('0x1c')]:_0x3019a4[_0x791d('0x19')]+_0x3019a4[_0x791d('0x1a')];var _0x5247eb;if(_0xa9ea77>=_0x5d0181){_0xa9ea77=_0x5d0181;_0x5247eb=0xc8;}else{_0x5247eb=0xce;}_0x8dbf6e[_0x791d('0x16')](_0x5247eb);return _0x8dbf6e['set'](_0x791d('0x1d'),_0x33dd39+'-'+_0xa9ea77+'/'+_0x5d0181)[_0x791d('0x18')](_0x59fbfd);}return null;};}function patchUpdates(_0x5189f2){return function(_0x23a122){try{jsonpatch[_0x791d('0x1e')](_0x23a122,_0x5189f2,!![]);}catch(_0x47c552){return BPromise[_0x791d('0x1f')](_0x47c552);}return _0x23a122['save']();};}function saveUpdates(_0xe5647a,_0x50bde8){return function(_0x44bbdc){if(_0x44bbdc){return _0x44bbdc[_0x791d('0x20')](_0xe5647a)[_0x791d('0x21')](function(_0x22a88b){return _0x22a88b;});}return null;};}function removeEntity(_0x2e8a66,_0x407968){return function(_0x3bf0bc){if(_0x3bf0bc){return _0x3bf0bc[_0x791d('0x22')]()[_0x791d('0x21')](function(){_0x2e8a66[_0x791d('0x16')](0xcc)[_0x791d('0x17')]();});}};}function handleEntityNotFound(_0x1e8626,_0x520fb){return function(_0x139f29){if(!_0x139f29){_0x1e8626[_0x791d('0x15')](0x194);}return _0x139f29;};}function handleError(_0x2469be,_0x506177){_0x506177=_0x506177||0x1f4;return function(_0x530932){logger[_0x791d('0x23')](_0x530932[_0x791d('0x24')]);if(_0x530932[_0x791d('0x25')]){delete _0x530932['name'];}_0x2469be[_0x791d('0x16')](_0x506177)[_0x791d('0x26')](_0x530932);};}exports[_0x791d('0x27')]=function(_0x16d423,_0xfd900c){var _0x45425c={},_0x397221={},_0x61f95f={'count':0x0,'rows':[]};var _0xf07c02=_[_0x791d('0x28')](db['SalesforceField'][_0x791d('0x29')],function(_0x3c87b1){return{'name':_0x3c87b1[_0x791d('0x2a')],'type':_0x3c87b1[_0x791d('0x2b')][_0x791d('0x2c')]};});_0x397221[_0x791d('0x2d')]=_[_0x791d('0x28')](_0xf07c02,'name');_0x397221[_0x791d('0x2e')]=_[_0x791d('0x2f')](_0x16d423[_0x791d('0x2e')]);_0x397221[_0x791d('0x30')]=_[_0x791d('0x31')](_0x397221[_0x791d('0x2d')],_0x397221['query']);_0x45425c[_0x791d('0x32')]=_[_0x791d('0x31')](_0x397221[_0x791d('0x2d')],qs[_0x791d('0x33')](_0x16d423[_0x791d('0x2e')][_0x791d('0x33')]));_0x45425c[_0x791d('0x32')]=_0x45425c[_0x791d('0x32')][_0x791d('0x34')]?_0x45425c[_0x791d('0x32')]:_0x397221[_0x791d('0x2d')];if(!_0x16d423[_0x791d('0x2e')]['hasOwnProperty'](_0x791d('0x35'))){_0x45425c[_0x791d('0x1a')]=qs['limit'](_0x16d423[_0x791d('0x2e')][_0x791d('0x1a')]);_0x45425c['offset']=qs[_0x791d('0x19')](_0x16d423[_0x791d('0x2e')]['offset']);}_0x45425c[_0x791d('0x36')]=qs[_0x791d('0x37')](_0x16d423[_0x791d('0x2e')]['sort']);_0x45425c['where']=qs['filters'](_[_0x791d('0x38')](_0x16d423['query'],_0x397221[_0x791d('0x30')]),_0xf07c02);if(_0x16d423[_0x791d('0x2e')][_0x791d('0x39')]){_0x45425c['where']=_['merge'](_0x45425c['where'],{'$or':_[_0x791d('0x28')](_0xf07c02,function(_0x21ed3c){if(_0x21ed3c[_0x791d('0x2b')]!==_0x791d('0x3a')){var _0x5888cf={};_0x5888cf[_0x21ed3c[_0x791d('0x25')]]={'$like':'%'+_0x16d423[_0x791d('0x2e')][_0x791d('0x39')]+'%'};return _0x5888cf;}})});}_0x45425c=_[_0x791d('0x3b')]({},_0x45425c,_0x16d423[_0x791d('0x3c')]);var _0x4eebe3={'where':_0x45425c[_0x791d('0x3d')]};return db[_0x791d('0x3e')][_0x791d('0x1c')](_0x4eebe3)[_0x791d('0x21')](function(_0x47f669){_0x61f95f['count']=_0x47f669;if(_0x16d423[_0x791d('0x2e')][_0x791d('0x3f')]){_0x45425c[_0x791d('0x40')]=[{'all':!![]}];}return db[_0x791d('0x3e')][_0x791d('0x41')](_0x45425c);})['then'](function(_0x157922){_0x61f95f['rows']=_0x157922;return _0x61f95f;})[_0x791d('0x21')](respondWithFilteredResult(_0xfd900c,_0x45425c))['catch'](handleError(_0xfd900c,null));};exports[_0x791d('0x42')]=function(_0x4a8685,_0x2fb02e){var _0xc4239d={'raw':!![],'where':{'id':_0x4a8685['params']['id']}},_0x35b5da={};_0x35b5da[_0x791d('0x2d')]=_['keys'](db[_0x791d('0x3e')][_0x791d('0x29')]);_0x35b5da['query']=_['keys'](_0x4a8685[_0x791d('0x2e')]);_0x35b5da['filters']=_[_0x791d('0x31')](_0x35b5da[_0x791d('0x2d')],_0x35b5da[_0x791d('0x2e')]);_0xc4239d['attributes']=_[_0x791d('0x31')](_0x35b5da[_0x791d('0x2d')],qs[_0x791d('0x33')](_0x4a8685[_0x791d('0x2e')][_0x791d('0x33')]));_0xc4239d[_0x791d('0x32')]=_0xc4239d[_0x791d('0x32')][_0x791d('0x34')]?_0xc4239d[_0x791d('0x32')]:_0x35b5da['model'];if(_0x4a8685[_0x791d('0x2e')][_0x791d('0x3f')]){_0xc4239d['include']=[{'all':!![]}];}_0xc4239d=_[_0x791d('0x3b')]({},_0xc4239d,_0x4a8685[_0x791d('0x3c')]);return db[_0x791d('0x3e')]['find'](_0xc4239d)[_0x791d('0x21')](handleEntityNotFound(_0x2fb02e,null))[_0x791d('0x21')](respondWithResult(_0x2fb02e,null))[_0x791d('0x43')](handleError(_0x2fb02e,null));};exports[_0x791d('0x44')]=function(_0x1411fa,_0x3618d3){return db[_0x791d('0x3e')]['create'](_0x1411fa[_0x791d('0x45')],{})[_0x791d('0x21')](respondWithResult(_0x3618d3,0xc9))[_0x791d('0x43')](handleError(_0x3618d3,null));};exports[_0x791d('0x20')]=function(_0x3dc1af,_0x35aa58){if(_0x3dc1af[_0x791d('0x45')]['id']){delete _0x3dc1af[_0x791d('0x45')]['id'];}return db[_0x791d('0x3e')][_0x791d('0x46')]({'where':{'id':_0x3dc1af[_0x791d('0x47')]['id']}})[_0x791d('0x21')](handleEntityNotFound(_0x35aa58,null))['then'](saveUpdates(_0x3dc1af[_0x791d('0x45')],null))[_0x791d('0x21')](respondWithResult(_0x35aa58,null))[_0x791d('0x43')](handleError(_0x35aa58,null));};exports[_0x791d('0x22')]=function(_0x3496e3,_0x475258){return db[_0x791d('0x3e')][_0x791d('0x46')]({'where':{'id':_0x3496e3['params']['id']}})[_0x791d('0x21')](handleEntityNotFound(_0x475258,null))['then'](removeEntity(_0x475258,null))[_0x791d('0x43')](handleError(_0x475258,null));}; \ No newline at end of file +var _0x967b=['nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','filters','intersection','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SalesforceField','model','query','fields','attributes','length'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0x967b,0x1cb));var _0xb967=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x967b[_0x1cb18a];return _0x22442e;};'use strict';var emlformat=require(_0xb967('0x0'));var rimraf=require(_0xb967('0x1'));var zipdir=require(_0xb967('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb967('0x3'));var BPromise=require(_0xb967('0x4'));var Mustache=require(_0xb967('0x5'));var util=require(_0xb967('0x6'));var path=require(_0xb967('0x7'));var sox=require(_0xb967('0x8'));var csv=require(_0xb967('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb967('0xa'));var _=require(_0xb967('0xb'));var squel=require(_0xb967('0xc'));var crypto=require(_0xb967('0xd'));var jsforce=require(_0xb967('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb967('0x9'));var querystring=require(_0xb967('0xf'));var Papa=require(_0xb967('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb967('0x11'));var as=require(_0xb967('0x12'));var hardwareService=require(_0xb967('0x13'));var logger=require('../../config/logger')(_0xb967('0x14'));var utils=require(_0xb967('0x15'));var config=require(_0xb967('0x16'));var licenseUtil=require(_0xb967('0x17'));var db=require(_0xb967('0x18'))['db'];function respondWithStatusCode(_0x3037a7,_0xe99856){_0xe99856=_0xe99856||0xcc;return function(_0x531a48){if(_0x531a48){return _0x3037a7[_0xb967('0x19')](_0xe99856);}return _0x3037a7[_0xb967('0x1a')](_0xe99856)['end']();};}function respondWithResult(_0x254d8f,_0x251140){_0x251140=_0x251140||0xc8;return function(_0x5c6869){if(_0x5c6869){return _0x254d8f['status'](_0x251140)[_0xb967('0x1b')](_0x5c6869);}};}function respondWithFilteredResult(_0x284bbe,_0x3d8004){return function(_0x25db8b){if(_0x25db8b){var _0x420490=typeof _0x3d8004[_0xb967('0x1c')]===_0xb967('0x1d')&&typeof _0x3d8004[_0xb967('0x1e')]===_0xb967('0x1d');var _0xb7063d=_0x25db8b[_0xb967('0x1f')];var _0x7fb067=_0x420490?0x0:_0x3d8004[_0xb967('0x1c')];var _0x3d7804=_0x420490?_0x25db8b['count']:_0x3d8004['offset']+_0x3d8004[_0xb967('0x1e')];var _0x48eda1;if(_0x3d7804>=_0xb7063d){_0x3d7804=_0xb7063d;_0x48eda1=0xc8;}else{_0x48eda1=0xce;}_0x284bbe['status'](_0x48eda1);return _0x284bbe[_0xb967('0x20')](_0xb967('0x21'),_0x7fb067+'-'+_0x3d7804+'/'+_0xb7063d)[_0xb967('0x1b')](_0x25db8b);}return null;};}function patchUpdates(_0x3358d2){return function(_0x452d71){try{jsonpatch[_0xb967('0x22')](_0x452d71,_0x3358d2,!![]);}catch(_0x4084d0){return BPromise[_0xb967('0x23')](_0x4084d0);}return _0x452d71[_0xb967('0x24')]();};}function saveUpdates(_0x23176a,_0x192ed9){return function(_0x3abddf){if(_0x3abddf){return _0x3abddf[_0xb967('0x25')](_0x23176a)[_0xb967('0x26')](function(_0x480698){return _0x480698;});}return null;};}function removeEntity(_0xbc5f68,_0x264278){return function(_0x572aa6){if(_0x572aa6){return _0x572aa6[_0xb967('0x27')]()[_0xb967('0x26')](function(){_0xbc5f68[_0xb967('0x1a')](0xcc)[_0xb967('0x28')]();});}};}function handleEntityNotFound(_0x39e649,_0xb8862f){return function(_0x5be6b4){if(!_0x5be6b4){_0x39e649[_0xb967('0x19')](0x194);}return _0x5be6b4;};}function handleError(_0x33ecb7,_0x383235){_0x383235=_0x383235||0x1f4;return function(_0x6e8c14){logger['error'](_0x6e8c14[_0xb967('0x29')]);if(_0x6e8c14[_0xb967('0x2a')]){delete _0x6e8c14[_0xb967('0x2a')];}_0x33ecb7[_0xb967('0x1a')](_0x383235)[_0xb967('0x2b')](_0x6e8c14);};}exports[_0xb967('0x2c')]=function(_0x3ad983,_0x2d6d10){var _0xeaa0df={},_0x25c13f={},_0x276bb1={'count':0x0,'rows':[]};var _0x17bace=_[_0xb967('0x2d')](db[_0xb967('0x2e')]['rawAttributes'],function(_0x429325){return{'name':_0x429325['fieldName'],'type':_0x429325['type']['key']};});_0x25c13f[_0xb967('0x2f')]=_[_0xb967('0x2d')](_0x17bace,'name');_0x25c13f[_0xb967('0x30')]=_['keys'](_0x3ad983[_0xb967('0x30')]);_0x25c13f['filters']=_['intersection'](_0x25c13f[_0xb967('0x2f')],_0x25c13f[_0xb967('0x30')]);_0xeaa0df['attributes']=_['intersection'](_0x25c13f[_0xb967('0x2f')],qs['fields'](_0x3ad983[_0xb967('0x30')][_0xb967('0x31')]));_0xeaa0df[_0xb967('0x32')]=_0xeaa0df[_0xb967('0x32')][_0xb967('0x33')]?_0xeaa0df['attributes']:_0x25c13f[_0xb967('0x2f')];if(!_0x3ad983[_0xb967('0x30')]['hasOwnProperty'](_0xb967('0x34'))){_0xeaa0df[_0xb967('0x1e')]=qs[_0xb967('0x1e')](_0x3ad983[_0xb967('0x30')][_0xb967('0x1e')]);_0xeaa0df[_0xb967('0x1c')]=qs['offset'](_0x3ad983[_0xb967('0x30')][_0xb967('0x1c')]);}_0xeaa0df[_0xb967('0x35')]=qs[_0xb967('0x36')](_0x3ad983['query'][_0xb967('0x36')]);_0xeaa0df[_0xb967('0x37')]=qs['filters'](_[_0xb967('0x38')](_0x3ad983[_0xb967('0x30')],_0x25c13f['filters']),_0x17bace);if(_0x3ad983[_0xb967('0x30')]['filter']){_0xeaa0df[_0xb967('0x37')]=_['merge'](_0xeaa0df[_0xb967('0x37')],{'$or':_[_0xb967('0x2d')](_0x17bace,function(_0x4c2700){if(_0x4c2700[_0xb967('0x39')]!=='VIRTUAL'){var _0x54bacf={};_0x54bacf[_0x4c2700[_0xb967('0x2a')]]={'$like':'%'+_0x3ad983[_0xb967('0x30')][_0xb967('0x3a')]+'%'};return _0x54bacf;}})});}_0xeaa0df=_[_0xb967('0x3b')]({},_0xeaa0df,_0x3ad983[_0xb967('0x3c')]);var _0x5a90b4={'where':_0xeaa0df[_0xb967('0x37')]};return db['SalesforceField'][_0xb967('0x1f')](_0x5a90b4)[_0xb967('0x26')](function(_0x2a51c5){_0x276bb1[_0xb967('0x1f')]=_0x2a51c5;if(_0x3ad983[_0xb967('0x30')][_0xb967('0x3d')]){_0xeaa0df[_0xb967('0x3e')]=[{'all':!![]}];}return db[_0xb967('0x2e')][_0xb967('0x3f')](_0xeaa0df);})[_0xb967('0x26')](function(_0x933d80){_0x276bb1['rows']=_0x933d80;return _0x276bb1;})[_0xb967('0x26')](respondWithFilteredResult(_0x2d6d10,_0xeaa0df))[_0xb967('0x40')](handleError(_0x2d6d10,null));};exports[_0xb967('0x41')]=function(_0x2c2819,_0x154dc3){var _0x33de95={'raw':!![],'where':{'id':_0x2c2819[_0xb967('0x42')]['id']}},_0x46d226={};_0x46d226[_0xb967('0x2f')]=_[_0xb967('0x43')](db[_0xb967('0x2e')]['rawAttributes']);_0x46d226['query']=_['keys'](_0x2c2819[_0xb967('0x30')]);_0x46d226[_0xb967('0x44')]=_['intersection'](_0x46d226[_0xb967('0x2f')],_0x46d226[_0xb967('0x30')]);_0x33de95[_0xb967('0x32')]=_[_0xb967('0x45')](_0x46d226[_0xb967('0x2f')],qs['fields'](_0x2c2819[_0xb967('0x30')][_0xb967('0x31')]));_0x33de95['attributes']=_0x33de95[_0xb967('0x32')]['length']?_0x33de95[_0xb967('0x32')]:_0x46d226[_0xb967('0x2f')];if(_0x2c2819[_0xb967('0x30')][_0xb967('0x3d')]){_0x33de95[_0xb967('0x3e')]=[{'all':!![]}];}_0x33de95=_[_0xb967('0x3b')]({},_0x33de95,_0x2c2819[_0xb967('0x3c')]);return db[_0xb967('0x2e')][_0xb967('0x46')](_0x33de95)['then'](handleEntityNotFound(_0x154dc3,null))[_0xb967('0x26')](respondWithResult(_0x154dc3,null))[_0xb967('0x40')](handleError(_0x154dc3,null));};exports['create']=function(_0x14f9d2,_0x38ab85){return db['SalesforceField'][_0xb967('0x47')](_0x14f9d2[_0xb967('0x48')],{})[_0xb967('0x26')](respondWithResult(_0x38ab85,0xc9))[_0xb967('0x40')](handleError(_0x38ab85,null));};exports[_0xb967('0x25')]=function(_0x16eb76,_0x1bc010){if(_0x16eb76['body']['id']){delete _0x16eb76[_0xb967('0x48')]['id'];}return db[_0xb967('0x2e')][_0xb967('0x46')]({'where':{'id':_0x16eb76['params']['id']}})[_0xb967('0x26')](handleEntityNotFound(_0x1bc010,null))[_0xb967('0x26')](saveUpdates(_0x16eb76[_0xb967('0x48')],null))['then'](respondWithResult(_0x1bc010,null))[_0xb967('0x40')](handleError(_0x1bc010,null));};exports[_0xb967('0x27')]=function(_0x466d4d,_0x16d63d){return db[_0xb967('0x2e')][_0xb967('0x46')]({'where':{'id':_0x466d4d[_0xb967('0x42')]['id']}})['then'](handleEntityNotFound(_0x16d63d,null))[_0xb967('0x26')](removeEntity(_0x16d63d,null))['catch'](handleError(_0x16d63d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e1f36ba..d5f9afe 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 _0xfa5f=['util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x2666ae,_0x1a9d62){var _0x5959ca=function(_0x3ccb77){while(--_0x3ccb77){_0x2666ae['push'](_0x2666ae['shift']());}};_0x5959ca(++_0x1a9d62);}(_0xfa5f,0xb5));var _0xffa5=function(_0xc100d,_0xe9ccf0){_0xc100d=_0xc100d-0x0;var _0x5b8c48=_0xfa5f[_0xc100d];return _0x5b8c48;};'use strict';var _=require(_0xffa5('0x0'));var util=require(_0xffa5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xffa5('0x2'));var BPromise=require(_0xffa5('0x3'));var rp=require(_0xffa5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffa5('0x5'));var config=require(_0xffa5('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0xffa5('0x7')]=function(_0x509be6,_0x349a22){return _0x509be6[_0xffa5('0x8')](_0xffa5('0x9'),attributes,{'tableName':_0xffa5('0xa'),'paranoid':![],'indexes':[{'name':_0xffa5('0xb'),'fields':[_0xffa5('0xc'),_0xffa5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d65=['define','idField','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x81bd59,_0x315d32){var _0x37929f=function(_0x28d38a){while(--_0x28d38a){_0x81bd59['push'](_0x81bd59['shift']());}};_0x37929f(++_0x315d32);}(_0x8d65,0x122));var _0x58d6=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x8d65[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x58d6('0x0'));var util=require(_0x58d6('0x1'));var logger=require(_0x58d6('0x2'))(_0x58d6('0x3'));var moment=require('moment');var BPromise=require(_0x58d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58d6('0x5'));var rimraf=require(_0x58d6('0x6'));var config=require(_0x58d6('0x7'));var attributes=require(_0x58d6('0x8'));module[_0x58d6('0x9')]=function(_0x2e58e4,_0x37fa0e){return _0x2e58e4[_0x58d6('0xa')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x58d6('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 1db3439..c9b8932 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 _0xa6bc=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x5773ab,_0x445596){var _0x1744ff=function(_0x3026ff){while(--_0x3026ff){_0x5773ab['push'](_0x5773ab['shift']());}};_0x1744ff(++_0x445596);}(_0xa6bc,0xfc));var _0xca6b=function(_0x5dee43,_0x35aa9b){_0x5dee43=_0x5dee43-0x0;var _0x3bcfb0=_0xa6bc[_0x5dee43];return _0x3bcfb0;};'use strict';var _=require(_0xca6b('0x0'));var util=require(_0xca6b('0x1'));var moment=require(_0xca6b('0x2'));var BPromise=require(_0xca6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xca6b('0x5'))(_0xca6b('0x6'));var config=require(_0xca6b('0x7'));var jayson=require(_0xca6b('0x8'));var client=jayson[_0xca6b('0x9')][_0xca6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x109809,_0x44726e,_0xe242f0){return new BPromise(function(_0x3b70b1,_0x3c06b6){return client[_0xca6b('0xb')](_0x109809,_0xe242f0)[_0xca6b('0xc')](function(_0x17bb00){logger[_0xca6b('0xd')](_0xca6b('0xe'),_0x44726e,_0xca6b('0xf'));logger[_0xca6b('0x10')](_0xca6b('0x11'),_0x44726e,_0xca6b('0xf'),JSON['stringify'](_0x17bb00));if(_0x17bb00[_0xca6b('0x12')]){if(_0x17bb00['error'][_0xca6b('0x13')]===0x1f4){logger[_0xca6b('0x12')](_0xca6b('0xe'),_0x44726e,_0x17bb00[_0xca6b('0x12')][_0xca6b('0x14')]);return _0x3c06b6(_0x17bb00[_0xca6b('0x12')][_0xca6b('0x14')]);}logger[_0xca6b('0x12')](_0xca6b('0xe'),_0x44726e,_0x17bb00['error'][_0xca6b('0x14')]);return _0x3b70b1(_0x17bb00[_0xca6b('0x12')][_0xca6b('0x14')]);}else{logger[_0xca6b('0xd')](_0xca6b('0xe'),_0x44726e,'request\x20sent');_0x3b70b1(_0x17bb00[_0xca6b('0x15')][_0xca6b('0x14')]);}})[_0xca6b('0x16')](function(_0x2aa923){logger['error'](_0xca6b('0xe'),_0x44726e,_0x2aa923);_0x3c06b6(_0x2aa923);});});} \ No newline at end of file +var _0x33ed=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SalesforceField,\x20%s,\x20%s','debug'];(function(_0x3574b7,_0x14381e){var _0x242cc3=function(_0x12d283){while(--_0x12d283){_0x3574b7['push'](_0x3574b7['shift']());}};_0x242cc3(++_0x14381e);}(_0x33ed,0x1d4));var _0xd33e=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x33ed[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0xd33e('0x0'));var util=require('util');var moment=require(_0xd33e('0x1'));var BPromise=require(_0xd33e('0x2'));var rs=require(_0xd33e('0x3'));var fs=require('fs');var Redis=require(_0xd33e('0x4'));var db=require(_0xd33e('0x5'))['db'];var utils=require(_0xd33e('0x6'));var logger=require(_0xd33e('0x7'))(_0xd33e('0x8'));var config=require(_0xd33e('0x9'));var jayson=require(_0xd33e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0230,_0x1b2325,_0x211a6d){return new BPromise(function(_0x347c51,_0x2655ab){return client[_0xd33e('0xb')](_0x4f0230,_0x211a6d)['then'](function(_0x5cefc3){logger[_0xd33e('0xc')](_0xd33e('0xd'),_0x1b2325,'request\x20sent');logger[_0xd33e('0xe')](_0xd33e('0xf'),_0x1b2325,_0xd33e('0x10'),JSON[_0xd33e('0x11')](_0x5cefc3));if(_0x5cefc3[_0xd33e('0x12')]){if(_0x5cefc3[_0xd33e('0x12')][_0xd33e('0x13')]===0x1f4){logger[_0xd33e('0x12')](_0xd33e('0xd'),_0x1b2325,_0x5cefc3[_0xd33e('0x12')][_0xd33e('0x14')]);return _0x2655ab(_0x5cefc3['error'][_0xd33e('0x14')]);}logger['error'](_0xd33e('0xd'),_0x1b2325,_0x5cefc3[_0xd33e('0x12')][_0xd33e('0x14')]);return _0x347c51(_0x5cefc3[_0xd33e('0x12')]['message']);}else{logger[_0xd33e('0xc')](_0xd33e('0xd'),_0x1b2325,_0xd33e('0x10'));_0x347c51(_0x5cefc3[_0xd33e('0x15')][_0xd33e('0x14')]);}})[_0xd33e('0x16')](function(_0x11878b){logger['error'](_0xd33e('0xd'),_0x1b2325,_0x11878b);_0x2655ab(_0x11878b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 88ea4a8..cb59901 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 _0xefe5=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','/:id'];(function(_0x3972dd,_0x298e3f){var _0x3a29c8=function(_0x461387){while(--_0x461387){_0x3972dd['push'](_0x3972dd['shift']());}};_0x3a29c8(++_0x298e3f);}(_0xefe5,0xf6));var _0x5efe=function(_0x32d01e,_0x5123d1){_0x32d01e=_0x32d01e-0x0;var _0x25f8a6=_0xefe5[_0x32d01e];return _0x25f8a6;};'use strict';var multer=require(_0x5efe('0x0'));var util=require('util');var path=require(_0x5efe('0x1'));var timeout=require(_0x5efe('0x2'));var express=require('express');var router=express[_0x5efe('0x3')]();var fs_extra=require(_0x5efe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5efe('0x5'));var config=require('../../config/environment');var controller=require(_0x5efe('0x6'));router[_0x5efe('0x7')]('/',auth[_0x5efe('0x8')](),controller[_0x5efe('0x9')]);router[_0x5efe('0x7')]('/:id',auth[_0x5efe('0x8')](),controller[_0x5efe('0xa')]);router[_0x5efe('0x7')](_0x5efe('0xb'),auth[_0x5efe('0x8')](),controller[_0x5efe('0xc')]);router[_0x5efe('0x7')](_0x5efe('0xd'),auth[_0x5efe('0x8')](),controller['getFields']);router[_0x5efe('0xe')]('/',auth[_0x5efe('0x8')](),controller[_0x5efe('0xf')]);router[_0x5efe('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5efe('0x10')](_0x5efe('0x11'),auth[_0x5efe('0x8')](),controller[_0x5efe('0x12')]);router[_0x5efe('0x13')](_0x5efe('0x11'),auth[_0x5efe('0x8')](),controller[_0x5efe('0x14')]);module[_0x5efe('0x15')]=router; \ No newline at end of file +var _0xbca8=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xbca8,0xcc));var _0x8bca=function(_0x3e2ea4,_0x477edf){_0x3e2ea4=_0x3e2ea4-0x0;var _0x538a84=_0xbca8[_0x3e2ea4];return _0x538a84;};'use strict';var multer=require(_0x8bca('0x0'));var util=require(_0x8bca('0x1'));var path=require(_0x8bca('0x2'));var timeout=require(_0x8bca('0x3'));var express=require(_0x8bca('0x4'));var router=express['Router']();var fs_extra=require(_0x8bca('0x5'));var auth=require(_0x8bca('0x6'));var interaction=require(_0x8bca('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x8bca('0x8')]('/',auth[_0x8bca('0x9')](),controller[_0x8bca('0xa')]);router[_0x8bca('0x8')]('/:id',auth[_0x8bca('0x9')](),controller[_0x8bca('0xb')]);router[_0x8bca('0x8')](_0x8bca('0xc'),auth[_0x8bca('0x9')](),controller[_0x8bca('0xd')]);router[_0x8bca('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8bca('0xe')]);router[_0x8bca('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8bca('0xf')]('/:id/configurations',auth[_0x8bca('0x9')](),controller[_0x8bca('0x10')]);router['put'](_0x8bca('0x11'),auth[_0x8bca('0x9')](),controller[_0x8bca('0x12')]);router[_0x8bca('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8bca('0x14')]);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 f5b04b1..2d0e88c 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 _0x95c7=['username','remoteUri','sequelize','exports','STRING'];(function(_0x21b87a,_0x36215b){var _0x551f94=function(_0x3d4f64){while(--_0x3d4f64){_0x21b87a['push'](_0x21b87a['shift']());}};_0x551f94(++_0x36215b);}(_0x95c7,0xf2));var _0x795c=function(_0x2119e8,_0x263a0a){_0x2119e8=_0x2119e8-0x0;var _0x17e98f=_0x95c7[_0x2119e8];return _0x17e98f;};'use strict';var Sequelize=require(_0x795c('0x0'));module[_0x795c('0x1')]={'name':{'type':Sequelize[_0x795c('0x2')]},'description':{'type':Sequelize[_0x795c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x795c('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x795c('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x795c('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2874=['remoteUri','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2874,0x15d));var _0x4287=function(_0x4fc79e,_0x3b1919){_0x4fc79e=_0x4fc79e-0x0;var _0x301cba=_0x2874[_0x4fc79e];return _0x301cba;};'use strict';var Sequelize=require(_0x4287('0x0'));module[_0x4287('0x1')]={'name':{'type':Sequelize[_0x4287('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4287('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x4287('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4287('0x2')],'unique':_0x4287('0x3')},'serverUrl':{'type':Sequelize[_0x4287('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a64d4b1..d4cef17 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 _0x9cef=['find','create','body','getConfigurations','findOne','params','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ServicenowConfiguration','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','parent','caused_by','watch_list','number','resolved_by','sys_updated_by','opened_by','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','reopened_time','resolved_at','caller_id','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','reassignment_count','activity_due','assigned_to','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','password','email','remoteUri','substring','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','internalType','push','TCL:\x20_object','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','all','concat','ServiceNow\x20error:\x20','send','test','Wrong\x20credentials','statusCode','boolean','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','ServicenowAccount','includeAll','include','findAll','catch','show'];(function(_0xbe48a,_0x4d3ec5){var _0x3eeda0=function(_0x2d758d){while(--_0x2d758d){_0xbe48a['push'](_0xbe48a['shift']());}};_0x3eeda0(++_0x4d3ec5);}(_0x9cef,0x124));var _0xf9ce=function(_0x39d474,_0x280fb6){_0x39d474=_0x39d474-0x0;var _0x5915ca=_0x9cef[_0x39d474];return _0x5915ca;};'use strict';var emlformat=require(_0xf9ce('0x0'));var rimraf=require(_0xf9ce('0x1'));var zipdir=require(_0xf9ce('0x2'));var jsonpatch=require(_0xf9ce('0x3'));var rp=require(_0xf9ce('0x4'));var moment=require(_0xf9ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf9ce('0x6'));var util=require(_0xf9ce('0x7'));var path=require(_0xf9ce('0x8'));var sox=require(_0xf9ce('0x9'));var csv=require(_0xf9ce('0xa'));var ejs=require(_0xf9ce('0xb'));var fs=require('fs');var fs_extra=require(_0xf9ce('0xc'));var _=require(_0xf9ce('0xd'));var squel=require(_0xf9ce('0xe'));var crypto=require(_0xf9ce('0xf'));var jsforce=require(_0xf9ce('0x10'));var deskjs=require(_0xf9ce('0x11'));var toCsv=require(_0xf9ce('0xa'));var querystring=require('querystring');var Papa=require(_0xf9ce('0x12'));var Redis=require(_0xf9ce('0x13'));var authService=require(_0xf9ce('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9ce('0x15'));var logger=require('../../config/logger')(_0xf9ce('0x16'));var utils=require(_0xf9ce('0x17'));var config=require(_0xf9ce('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9ce('0x19'))['db'];var integrations=require(_0xf9ce('0x1a'));function respondWithStatusCode(_0x193b31,_0x5ed05e){_0x5ed05e=_0x5ed05e||0xcc;return function(_0x3c246a){if(_0x3c246a){return _0x193b31[_0xf9ce('0x1b')](_0x5ed05e);}return _0x193b31['status'](_0x5ed05e)['end']();};}function respondWithResult(_0x12bff4,_0x55343a){_0x55343a=_0x55343a||0xc8;return function(_0x38915c){if(_0x38915c){return _0x12bff4['status'](_0x55343a)[_0xf9ce('0x1c')](_0x38915c);}};}function respondWithFilteredResult(_0x512934,_0x3f56ad){return function(_0x197107){if(_0x197107){var _0x440d8b=typeof _0x3f56ad[_0xf9ce('0x1d')]===_0xf9ce('0x1e')&&typeof _0x3f56ad[_0xf9ce('0x1f')]===_0xf9ce('0x1e');var _0x5e207c=_0x197107[_0xf9ce('0x20')];var _0x561b7c=_0x440d8b?0x0:_0x3f56ad[_0xf9ce('0x1d')];var _0x55c940=_0x440d8b?_0x197107[_0xf9ce('0x20')]:_0x3f56ad['offset']+_0x3f56ad[_0xf9ce('0x1f')];var _0x4ab578;if(_0x55c940>=_0x5e207c){_0x55c940=_0x5e207c;_0x4ab578=0xc8;}else{_0x4ab578=0xce;}_0x512934[_0xf9ce('0x21')](_0x4ab578);return _0x512934[_0xf9ce('0x22')](_0xf9ce('0x23'),_0x561b7c+'-'+_0x55c940+'/'+_0x5e207c)['json'](_0x197107);}return null;};}function patchUpdates(_0x171769){return function(_0x197d6d){try{jsonpatch[_0xf9ce('0x24')](_0x197d6d,_0x171769,!![]);}catch(_0x9a325f){return BPromise[_0xf9ce('0x25')](_0x9a325f);}return _0x197d6d[_0xf9ce('0x26')]();};}function saveUpdates(_0xa9bd2c,_0x20af6d){return function(_0x2a60d1){if(_0x2a60d1){return _0x2a60d1[_0xf9ce('0x27')](_0xa9bd2c)[_0xf9ce('0x28')](function(_0x2a6f85){return _0x2a6f85;});}return null;};}function removeEntity(_0x4f835e,_0x260f31){return function(_0x2fba2d){if(_0x2fba2d){return _0x2fba2d[_0xf9ce('0x29')]()[_0xf9ce('0x28')](function(){_0x4f835e[_0xf9ce('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4839f8,_0x5a329f){return function(_0x42d7b7){if(!_0x42d7b7){_0x4839f8[_0xf9ce('0x1b')](0x194);}return _0x42d7b7;};}function handleError(_0x2a8f3c,_0x1556a3){_0x1556a3=_0x1556a3||0x1f4;return function(_0x4eb9ef){logger[_0xf9ce('0x2a')](_0x4eb9ef[_0xf9ce('0x2b')]);if(_0x4eb9ef['name']){delete _0x4eb9ef[_0xf9ce('0x2c')];}_0x2a8f3c[_0xf9ce('0x21')](_0x1556a3)['send'](_0x4eb9ef);};}exports[_0xf9ce('0x2d')]=function(_0x10e877,_0x5a2f08){var _0x1004e6={},_0x3bcf8d={},_0x5b3607={'count':0x0,'rows':[]};var _0x3b35b0=_[_0xf9ce('0x2e')](db['ServicenowAccount'][_0xf9ce('0x2f')],function(_0x41e22c){return{'name':_0x41e22c[_0xf9ce('0x30')],'type':_0x41e22c[_0xf9ce('0x31')]['key']};});_0x3bcf8d[_0xf9ce('0x32')]=_[_0xf9ce('0x2e')](_0x3b35b0,'name');_0x3bcf8d[_0xf9ce('0x33')]=_[_0xf9ce('0x34')](_0x10e877[_0xf9ce('0x33')]);_0x3bcf8d[_0xf9ce('0x35')]=_[_0xf9ce('0x36')](_0x3bcf8d[_0xf9ce('0x32')],_0x3bcf8d[_0xf9ce('0x33')]);_0x1004e6[_0xf9ce('0x37')]=_[_0xf9ce('0x36')](_0x3bcf8d['model'],qs['fields'](_0x10e877[_0xf9ce('0x33')][_0xf9ce('0x38')]));_0x1004e6[_0xf9ce('0x37')]=_0x1004e6['attributes'][_0xf9ce('0x39')]?_0x1004e6['attributes']:_0x3bcf8d[_0xf9ce('0x32')];if(!_0x10e877[_0xf9ce('0x33')][_0xf9ce('0x3a')](_0xf9ce('0x3b'))){_0x1004e6[_0xf9ce('0x1f')]=qs[_0xf9ce('0x1f')](_0x10e877['query']['limit']);_0x1004e6['offset']=qs[_0xf9ce('0x1d')](_0x10e877[_0xf9ce('0x33')]['offset']);}_0x1004e6[_0xf9ce('0x3c')]=qs[_0xf9ce('0x3d')](_0x10e877[_0xf9ce('0x33')][_0xf9ce('0x3d')]);_0x1004e6['where']=qs[_0xf9ce('0x35')](_['pick'](_0x10e877[_0xf9ce('0x33')],_0x3bcf8d[_0xf9ce('0x35')]),_0x3b35b0);if(_0x10e877['query'][_0xf9ce('0x3e')]){_0x1004e6[_0xf9ce('0x3f')]=_[_0xf9ce('0x40')](_0x1004e6[_0xf9ce('0x3f')],{'$or':_[_0xf9ce('0x2e')](_0x3b35b0,function(_0x4cf230){if(_0x4cf230['type']!=='VIRTUAL'){var _0x4fa511={};_0x4fa511[_0x4cf230[_0xf9ce('0x2c')]]={'$like':'%'+_0x10e877[_0xf9ce('0x33')][_0xf9ce('0x3e')]+'%'};return _0x4fa511;}})});}_0x1004e6=_[_0xf9ce('0x40')]({},_0x1004e6,_0x10e877[_0xf9ce('0x41')]);var _0x1d3392={'where':_0x1004e6[_0xf9ce('0x3f')]};return db[_0xf9ce('0x42')][_0xf9ce('0x20')](_0x1d3392)['then'](function(_0x4e94ab){_0x5b3607[_0xf9ce('0x20')]=_0x4e94ab;if(_0x10e877[_0xf9ce('0x33')][_0xf9ce('0x43')]){_0x1004e6[_0xf9ce('0x44')]=[{'all':!![]}];}return db[_0xf9ce('0x42')][_0xf9ce('0x45')](_0x1004e6);})[_0xf9ce('0x28')](function(_0x2b2c97){_0x5b3607['rows']=_0x2b2c97;return _0x5b3607;})['then'](respondWithFilteredResult(_0x5a2f08,_0x1004e6))[_0xf9ce('0x46')](handleError(_0x5a2f08,null));};exports[_0xf9ce('0x47')]=function(_0xa6b070,_0x453bf6){var _0x5a96c4={'raw':![],'where':{'id':_0xa6b070['params']['id']}},_0x3f2740={};_0x3f2740['model']=_['keys'](db['ServicenowAccount'][_0xf9ce('0x2f')]);_0x3f2740['query']=_[_0xf9ce('0x34')](_0xa6b070[_0xf9ce('0x33')]);_0x3f2740['filters']=_['intersection'](_0x3f2740[_0xf9ce('0x32')],_0x3f2740[_0xf9ce('0x33')]);_0x5a96c4[_0xf9ce('0x37')]=_[_0xf9ce('0x36')](_0x3f2740['model'],qs[_0xf9ce('0x38')](_0xa6b070[_0xf9ce('0x33')][_0xf9ce('0x38')]));_0x5a96c4[_0xf9ce('0x37')]=_0x5a96c4[_0xf9ce('0x37')][_0xf9ce('0x39')]?_0x5a96c4[_0xf9ce('0x37')]:_0x3f2740[_0xf9ce('0x32')];if(_0xa6b070[_0xf9ce('0x33')][_0xf9ce('0x43')]){_0x5a96c4['include']=[{'all':!![]}];}_0x5a96c4=_[_0xf9ce('0x40')]({},_0x5a96c4,_0xa6b070[_0xf9ce('0x41')]);return db['ServicenowAccount'][_0xf9ce('0x48')](_0x5a96c4)[_0xf9ce('0x28')](handleEntityNotFound(_0x453bf6,null))[_0xf9ce('0x28')](respondWithResult(_0x453bf6,null))[_0xf9ce('0x46')](handleError(_0x453bf6,null));};exports['create']=function(_0x245b1e,_0x2443b1){return db[_0xf9ce('0x42')][_0xf9ce('0x49')](_0x245b1e['body'],{})['then'](respondWithResult(_0x2443b1,0xc9))[_0xf9ce('0x46')](handleError(_0x2443b1,null));};exports['update']=function(_0xe844ed,_0x4a7c53){if(_0xe844ed[_0xf9ce('0x4a')]['id']){delete _0xe844ed[_0xf9ce('0x4a')]['id'];}return db['ServicenowAccount'][_0xf9ce('0x48')]({'where':{'id':_0xe844ed['params']['id']}})[_0xf9ce('0x28')](handleEntityNotFound(_0x4a7c53,null))[_0xf9ce('0x28')](saveUpdates(_0xe844ed[_0xf9ce('0x4a')],null))[_0xf9ce('0x28')](respondWithResult(_0x4a7c53,null))[_0xf9ce('0x46')](handleError(_0x4a7c53,null));};exports['destroy']=function(_0x4af7ba,_0x31163c){return db['ServicenowAccount'][_0xf9ce('0x48')]({'where':{'id':_0x4af7ba['params']['id']}})[_0xf9ce('0x28')](handleEntityNotFound(_0x31163c,null))[_0xf9ce('0x28')](removeEntity(_0x31163c,null))['catch'](handleError(_0x31163c,null));};exports[_0xf9ce('0x4b')]=function(_0x160413,_0x50da53,_0xff1f32){var _0x25855e={};var _0x50548c={};var _0x1aa9c9;var _0x5c4124;return db[_0xf9ce('0x42')][_0xf9ce('0x4c')]({'where':{'id':_0x160413[_0xf9ce('0x4d')]['id']}})[_0xf9ce('0x28')](handleEntityNotFound(_0x50da53,null))['then'](function(_0x52183b){if(_0x52183b){_0x1aa9c9=_0x52183b;_0x50548c[_0xf9ce('0x32')]=_[_0xf9ce('0x34')](db['ServicenowConfiguration'][_0xf9ce('0x2f')]);_0x50548c[_0xf9ce('0x33')]=_[_0xf9ce('0x34')](_0x160413[_0xf9ce('0x33')]);_0x50548c['filters']=_[_0xf9ce('0x36')](_0x50548c[_0xf9ce('0x32')],_0x50548c[_0xf9ce('0x33')]);_0x25855e[_0xf9ce('0x37')]=_[_0xf9ce('0x36')](_0x50548c[_0xf9ce('0x32')],qs[_0xf9ce('0x38')](_0x160413[_0xf9ce('0x33')]['fields']));_0x25855e['attributes']=_0x25855e[_0xf9ce('0x37')][_0xf9ce('0x39')]?_0x25855e[_0xf9ce('0x37')]:_0x50548c[_0xf9ce('0x32')];_0x25855e[_0xf9ce('0x3c')]=qs['sort'](_0x160413[_0xf9ce('0x33')]['sort']);_0x25855e[_0xf9ce('0x3f')]=qs[_0xf9ce('0x35')](_['pick'](_0x160413[_0xf9ce('0x33')],_0x50548c[_0xf9ce('0x35')]));if(_0x160413[_0xf9ce('0x33')]['filter']){_0x25855e[_0xf9ce('0x3f')]=_[_0xf9ce('0x40')](_0x25855e[_0xf9ce('0x3f')],{'$or':_[_0xf9ce('0x2e')](_0x25855e['attributes'],function(_0x2e0bc3){var _0x6485fb={};_0x6485fb[_0x2e0bc3]={'$like':'%'+_0x160413['query'][_0xf9ce('0x3e')]+'%'};return _0x6485fb;})});}_0x25855e=_[_0xf9ce('0x40')]({},_0x25855e,_0x160413['options']);return _0x1aa9c9[_0xf9ce('0x4b')](_0x25855e);}})[_0xf9ce('0x28')](function(_0x3204d3){if(_0x3204d3){_0x5c4124=_0x3204d3[_0xf9ce('0x39')];if(!_0x160413[_0xf9ce('0x33')][_0xf9ce('0x3a')](_0xf9ce('0x3b'))){_0x25855e['limit']=qs[_0xf9ce('0x1f')](_0x160413[_0xf9ce('0x33')][_0xf9ce('0x1f')]);_0x25855e[_0xf9ce('0x1d')]=qs[_0xf9ce('0x1d')](_0x160413[_0xf9ce('0x33')][_0xf9ce('0x1d')]);}return _0x1aa9c9[_0xf9ce('0x4b')](_0x25855e);}})[_0xf9ce('0x28')](function(_0x1094f7){if(_0x1094f7){return _0x1094f7?{'count':_0x5c4124,'rows':_0x1094f7}:null;}})[_0xf9ce('0x28')](respondWithResult(_0x50da53,null))[_0xf9ce('0x46')](handleError(_0x50da53,null));};exports[_0xf9ce('0x4e')]=function(_0x5029c9,_0x2d8926,_0x395fb6){if(_0x5029c9['body']['id']){delete _0x5029c9['body']['id'];}return db[_0xf9ce('0x42')][_0xf9ce('0x4c')]({'where':{'id':_0x5029c9[_0xf9ce('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2d8926,null))[_0xf9ce('0x28')](function(_0xa1779){if(_0xa1779){_0x5029c9[_0xf9ce('0x4a')][_0xf9ce('0x4f')]=_0xa1779['id'];_0x5029c9[_0xf9ce('0x4a')][_0xf9ce('0x50')]=integrations[_0xf9ce('0x51')](_0x5029c9[_0xf9ce('0x4a')]['channel'],_0x5029c9['body'][_0xf9ce('0x31')]);_0x5029c9[_0xf9ce('0x4a')][_0xf9ce('0x52')]=integrations['getDescriptions'](_0x5029c9[_0xf9ce('0x4a')][_0xf9ce('0x53')],_0x5029c9[_0xf9ce('0x4a')][_0xf9ce('0x31')]);return db[_0xf9ce('0x54')][_0xf9ce('0x49')](_0x5029c9[_0xf9ce('0x4a')],{'include':[{'model':db['ServicenowField'],'as':_0xf9ce('0x50')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2d8926,null))['catch'](handleError(_0x2d8926,null));};exports[_0xf9ce('0x55')]=function(_0x198362,_0x3cb846,_0x54f47f){var _0x39fcd=[_0xf9ce('0x56'),_0xf9ce('0x57'),_0xf9ce('0x58'),_0xf9ce('0x59'),_0xf9ce('0x5a'),'notify','incident_state',_0xf9ce('0x5b'),_0xf9ce('0x5c')];var _0xa57c3f=[_0xf9ce('0x5d'),_0xf9ce('0x56'),_0xf9ce('0x5e'),_0xf9ce('0x5f'),'upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history',_0xf9ce('0x60'),_0xf9ce('0x61'),_0xf9ce('0x62'),_0xf9ce('0x63'),'user_input','sys_created_on',_0xf9ce('0x64'),_0xf9ce('0x65'),_0xf9ce('0x66'),_0xf9ce('0x58'),_0xf9ce('0x3c'),_0xf9ce('0x67'),_0xf9ce('0x68'),_0xf9ce('0x69'),_0xf9ce('0x6a'),_0xf9ce('0x6b'),_0xf9ce('0x6c'),'work_notes_list','business_service',_0xf9ce('0x6d'),_0xf9ce('0x6e'),'rfc',_0xf9ce('0x6f'),_0xf9ce('0x70'),_0xf9ce('0x71'),_0xf9ce('0x72'),'group_list','work_end',_0xf9ce('0x73'),_0xf9ce('0x74'),_0xf9ce('0x75'),'approval_set',_0xf9ce('0x59'),'work_notes',_0xf9ce('0x76'),'close_code',_0xf9ce('0x77'),_0xf9ce('0x78'),_0xf9ce('0x79'),_0xf9ce('0x7a'),'business_stc',_0xf9ce('0x7b'),_0xf9ce('0x7c'),_0xf9ce('0x7d'),_0xf9ce('0x7e'),_0xf9ce('0x7f'),_0xf9ce('0x80'),_0xf9ce('0x81'),_0xf9ce('0x82'),_0xf9ce('0x83'),_0xf9ce('0x84'),_0xf9ce('0x85'),_0xf9ce('0x86'),_0xf9ce('0x87'),_0xf9ce('0x88'),'problem_id','company',_0xf9ce('0x89'),_0xf9ce('0x8a'),_0xf9ce('0x8b'),'severity','comments','sla_due','approval',_0xf9ce('0x8c'),_0xf9ce('0x8d'),_0xf9ce('0x8e'),_0xf9ce('0x8f'),_0xf9ce('0x90'),_0xf9ce('0x91'),_0xf9ce('0x92'),'correlation_id','location',_0xf9ce('0x5c')];var _0x1b538a='';var _0x7eb088='';var _0x412d3f=[];var _0x59a36e='';var _0x1df50a='';var _0x4a4157=[];var _0x445709='';var _0x13687e='';var _0x543f80={};var _0x45b651='';return db[_0xf9ce('0x42')][_0xf9ce('0x4c')]({'where':{'id':_0x198362[_0xf9ce('0x4d')]['id']},'attributes':['id','username',_0xf9ce('0x93'),_0xf9ce('0x94'),_0xf9ce('0x95'),'serverUrl']})[_0xf9ce('0x28')](handleEntityNotFound(_0x3cb846,null))['then'](function(_0x127676){if(_0x127676){_0x45b651=_0x127676[_0xf9ce('0x95')];var _0x934a0f=_0x45b651['slice'](-0x1);if(_0x934a0f==='/'){_0x45b651=_0x45b651[_0xf9ce('0x96')](0x0,_0x45b651['lastIndexOf'](_0x934a0f));}_0x13687e=util['format'](_0xf9ce('0x97'),_0x45b651);_0x445709=util['format'](_0xf9ce('0x98'),_0x45b651);_0x543f80={'user':_0x127676[_0xf9ce('0x99')],'pass':_0x127676[_0xf9ce('0x93')]};var _0x358aea={'method':'GET','uri':_0x13687e+_0xf9ce('0x9a'),'auth':_0x543f80,'json':!![]};return rp(_0x358aea);}})[_0xf9ce('0x28')](function(_0x4af123){if(_0x4af123[_0xf9ce('0x9b')][_0xf9ce('0x39')]>0x0){_0x1b538a=_0x4af123[_0xf9ce('0x9b')];}console['log'](_0xf9ce('0x9c'),_0x1b538a);_0x4a4157=[];_0x7eb088=Object[_0xf9ce('0x9d')]([],_0x1b538a);_[_0xf9ce('0x9e')](_0x7eb088,function(_0x34c818){return!_0x39fcd[_0xf9ce('0x9f')](_0x34c818[_0xf9ce('0x2c')]);});_0x7eb088['forEach'](function(_0x7bf0d8){var _0x2359ce=createFieldObject(_0x445709,_0x543f80,_0x7bf0d8[_0xf9ce('0xa0')],_0x7bf0d8[_0xf9ce('0x2c')],_0x7bf0d8['label'],![]);_0x4a4157[_0xf9ce('0xa1')](_0x2359ce);});return Promise['all'](_0x4a4157);})[_0xf9ce('0x28')](function(_0x283566){_0x412d3f=_0x283566;_0x59a36e=Object[_0xf9ce('0x9d')]([],_0x1b538a);console['log'](_0xf9ce('0xa2'),_0x1b538a);_[_0xf9ce('0x9e')](_0x59a36e,function(_0x124360){return _0xa57c3f[_0xf9ce('0x9f')](_0x124360['name']);});console[_0xf9ce('0xa3')](_0xf9ce('0xa4'),_0x59a36e);_0x4a4157=[];_0x59a36e[_0xf9ce('0xa5')](function(_0xb40955){var _0x338036=createFieldObject(_0x445709,_0x543f80,_0xb40955[_0xf9ce('0xa0')],_0xb40955[_0xf9ce('0x2c')],_0xb40955[_0xf9ce('0xa6')],!![]);_0x4a4157[_0xf9ce('0xa1')](_0x338036);});return Promise[_0xf9ce('0xa7')](_0x4a4157);})[_0xf9ce('0x28')](function(_0x4405ca){_0x1df50a=_0x4405ca;var _0x226400=_0x412d3f[_0xf9ce('0xa8')](_0x1df50a);return{'count':_0x226400[_0xf9ce('0x39')],'rows':_0x226400};})[_0xf9ce('0x28')](respondWithResult(_0x3cb846,null))['catch'](function(_0x1eeb48){console['log'](_0xf9ce('0xa9')+_0x1eeb48);var _0x10feb8=_0x198362[_0xf9ce('0x33')]['test']?0x1f4:_0x1eeb48['statusCode']||0x1f4;logger[_0xf9ce('0x2a')](_0x1eeb48[_0xf9ce('0x2b')]);delete _0x1eeb48[_0xf9ce('0x2c')];if(_0x10feb8===0x191){_0x10feb8=0x190;}_0x3cb846[_0xf9ce('0x21')](_0x10feb8)[_0xf9ce('0xaa')](_0x198362[_0xf9ce('0x33')][_0xf9ce('0xab')]?{'message':_0xf9ce('0xac'),'statusCode':_0x1eeb48[_0xf9ce('0xad')]}:_0x1eeb48);});};function createFieldObject(_0x1d6b1d,_0x12fec8,_0x28230d,_0x478242,_0x23dea7,_0x854d82){return new Promise(function(_0x369fbe,_0x479cba){var _0x5f603c={'id':_0x478242,'name':_0x23dea7,'custom':_0x854d82};if(_0x28230d===_0xf9ce('0xae')){_0x5f603c[_0xf9ce('0x41')]=[{'name':_0xf9ce('0xaf'),'value':_0xf9ce('0xb0')},{'name':'False','value':_0xf9ce('0xb1')}];_0x369fbe(_0x5f603c);}else{var _0x310e5a={'method':_0xf9ce('0xb2'),'uri':_0x1d6b1d+_0xf9ce('0xb3')+_0x478242,'auth':_0x12fec8,'json':!![]};return rp(_0x310e5a)['then'](function(_0x59c436){var _0x3b7807=[];if(_0x59c436[_0xf9ce('0x9b')][_0xf9ce('0x39')]>0x0){_0x59c436['result'][_0xf9ce('0xa5')](function(_0x244fad){if(_0x244fad[_0xf9ce('0xb4')]===_0xf9ce('0xb1')){var _0x324374={'name':_0x244fad['label'],'value':_0x244fad[_0xf9ce('0xb5')]};_0x3b7807[_0xf9ce('0xa1')](_0x324374);}});}_0x5f603c[_0xf9ce('0x41')]=_0x3b7807;if(_0x5f603c['options'][_0xf9ce('0x39')]>0x0){_0x369fbe(_0x5f603c);}else{if(_0x854d82==![]){_0x369fbe();}else{_0x369fbe(_0x5f603c);}}});}});} \ No newline at end of file +var _0xae49=['close_notes','follow_up','parent_incident','urgency','problem_id','reassignment_count','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','lastIndexOf','format','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','includes','internalType','label','assign','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','all','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','order','sort','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','calendar_duration','notify'];(function(_0x52e499,_0x3454d0){var _0x4f067d=function(_0x43d0ee){while(--_0x43d0ee){_0x52e499['push'](_0x52e499['shift']());}};_0x4f067d(++_0x3454d0);}(_0xae49,0x19f));var _0x9ae4=function(_0x34c782,_0x3f063d){_0x34c782=_0x34c782-0x0;var _0x311c94=_0xae49[_0x34c782];return _0x311c94;};'use strict';var emlformat=require(_0x9ae4('0x0'));var rimraf=require(_0x9ae4('0x1'));var zipdir=require(_0x9ae4('0x2'));var jsonpatch=require(_0x9ae4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9ae4('0x4'));var Mustache=require('mustache');var util=require(_0x9ae4('0x5'));var path=require(_0x9ae4('0x6'));var sox=require(_0x9ae4('0x7'));var csv=require(_0x9ae4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ae4('0x9'));var _=require(_0x9ae4('0xa'));var squel=require(_0x9ae4('0xb'));var crypto=require('crypto');var jsforce=require(_0x9ae4('0xc'));var deskjs=require(_0x9ae4('0xd'));var toCsv=require(_0x9ae4('0x8'));var querystring=require(_0x9ae4('0xe'));var Papa=require(_0x9ae4('0xf'));var Redis=require(_0x9ae4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9ae4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ae4('0x12'));var logger=require('../../config/logger')(_0x9ae4('0x13'));var utils=require(_0x9ae4('0x14'));var config=require(_0x9ae4('0x15'));var licenseUtil=require(_0x9ae4('0x16'));var db=require(_0x9ae4('0x17'))['db'];var integrations=require(_0x9ae4('0x18'));function respondWithStatusCode(_0xb1f1d,_0x2cc753){_0x2cc753=_0x2cc753||0xcc;return function(_0x5df8d8){if(_0x5df8d8){return _0xb1f1d[_0x9ae4('0x19')](_0x2cc753);}return _0xb1f1d['status'](_0x2cc753)[_0x9ae4('0x1a')]();};}function respondWithResult(_0x4b9912,_0x3c3586){_0x3c3586=_0x3c3586||0xc8;return function(_0x197cdc){if(_0x197cdc){return _0x4b9912['status'](_0x3c3586)[_0x9ae4('0x1b')](_0x197cdc);}};}function respondWithFilteredResult(_0x13bbc3,_0x1395fc){return function(_0x2e3aa0){if(_0x2e3aa0){var _0x1e75f2=typeof _0x1395fc[_0x9ae4('0x1c')]===_0x9ae4('0x1d')&&typeof _0x1395fc[_0x9ae4('0x1e')]===_0x9ae4('0x1d');var _0x454989=_0x2e3aa0['count'];var _0x45eb52=_0x1e75f2?0x0:_0x1395fc['offset'];var _0x5955a8=_0x1e75f2?_0x2e3aa0[_0x9ae4('0x1f')]:_0x1395fc[_0x9ae4('0x1c')]+_0x1395fc[_0x9ae4('0x1e')];var _0x53653e;if(_0x5955a8>=_0x454989){_0x5955a8=_0x454989;_0x53653e=0xc8;}else{_0x53653e=0xce;}_0x13bbc3['status'](_0x53653e);return _0x13bbc3[_0x9ae4('0x20')](_0x9ae4('0x21'),_0x45eb52+'-'+_0x5955a8+'/'+_0x454989)['json'](_0x2e3aa0);}return null;};}function patchUpdates(_0x322d4d){return function(_0x929d30){try{jsonpatch[_0x9ae4('0x22')](_0x929d30,_0x322d4d,!![]);}catch(_0x563b37){return BPromise[_0x9ae4('0x23')](_0x563b37);}return _0x929d30[_0x9ae4('0x24')]();};}function saveUpdates(_0x137d29,_0x74896d){return function(_0x4e555b){if(_0x4e555b){return _0x4e555b[_0x9ae4('0x25')](_0x137d29)[_0x9ae4('0x26')](function(_0x336af1){return _0x336af1;});}return null;};}function removeEntity(_0x194cef,_0x54a2c9){return function(_0x4245fa){if(_0x4245fa){return _0x4245fa[_0x9ae4('0x27')]()[_0x9ae4('0x26')](function(){_0x194cef[_0x9ae4('0x28')](0xcc)[_0x9ae4('0x1a')]();});}};}function handleEntityNotFound(_0x4fd9a1,_0x73f69){return function(_0x3ca883){if(!_0x3ca883){_0x4fd9a1[_0x9ae4('0x19')](0x194);}return _0x3ca883;};}function handleError(_0x133752,_0x33f761){_0x33f761=_0x33f761||0x1f4;return function(_0x770282){logger[_0x9ae4('0x29')](_0x770282[_0x9ae4('0x2a')]);if(_0x770282[_0x9ae4('0x2b')]){delete _0x770282['name'];}_0x133752['status'](_0x33f761)[_0x9ae4('0x2c')](_0x770282);};}exports[_0x9ae4('0x2d')]=function(_0x32523f,_0x49a9da){var _0x283574={},_0x3de900={},_0x414b83={'count':0x0,'rows':[]};var _0x32154d=_[_0x9ae4('0x2e')](db[_0x9ae4('0x2f')][_0x9ae4('0x30')],function(_0x2e160a){return{'name':_0x2e160a[_0x9ae4('0x31')],'type':_0x2e160a['type'][_0x9ae4('0x32')]};});_0x3de900[_0x9ae4('0x33')]=_['map'](_0x32154d,'name');_0x3de900[_0x9ae4('0x34')]=_['keys'](_0x32523f['query']);_0x3de900['filters']=_[_0x9ae4('0x35')](_0x3de900['model'],_0x3de900[_0x9ae4('0x34')]);_0x283574[_0x9ae4('0x36')]=_[_0x9ae4('0x35')](_0x3de900['model'],qs[_0x9ae4('0x37')](_0x32523f[_0x9ae4('0x34')][_0x9ae4('0x37')]));_0x283574['attributes']=_0x283574[_0x9ae4('0x36')]['length']?_0x283574[_0x9ae4('0x36')]:_0x3de900[_0x9ae4('0x33')];if(!_0x32523f[_0x9ae4('0x34')]['hasOwnProperty'](_0x9ae4('0x38'))){_0x283574[_0x9ae4('0x1e')]=qs[_0x9ae4('0x1e')](_0x32523f[_0x9ae4('0x34')][_0x9ae4('0x1e')]);_0x283574[_0x9ae4('0x1c')]=qs[_0x9ae4('0x1c')](_0x32523f[_0x9ae4('0x34')][_0x9ae4('0x1c')]);}_0x283574['order']=qs['sort'](_0x32523f[_0x9ae4('0x34')]['sort']);_0x283574['where']=qs[_0x9ae4('0x39')](_[_0x9ae4('0x3a')](_0x32523f[_0x9ae4('0x34')],_0x3de900[_0x9ae4('0x39')]),_0x32154d);if(_0x32523f[_0x9ae4('0x34')][_0x9ae4('0x3b')]){_0x283574['where']=_[_0x9ae4('0x3c')](_0x283574[_0x9ae4('0x3d')],{'$or':_[_0x9ae4('0x2e')](_0x32154d,function(_0x409841){if(_0x409841['type']!==_0x9ae4('0x3e')){var _0x3271bb={};_0x3271bb[_0x409841[_0x9ae4('0x2b')]]={'$like':'%'+_0x32523f[_0x9ae4('0x34')][_0x9ae4('0x3b')]+'%'};return _0x3271bb;}})});}_0x283574=_[_0x9ae4('0x3c')]({},_0x283574,_0x32523f[_0x9ae4('0x3f')]);var _0x20b67f={'where':_0x283574[_0x9ae4('0x3d')]};return db[_0x9ae4('0x2f')][_0x9ae4('0x1f')](_0x20b67f)[_0x9ae4('0x26')](function(_0x1009ed){_0x414b83[_0x9ae4('0x1f')]=_0x1009ed;if(_0x32523f['query'][_0x9ae4('0x40')]){_0x283574[_0x9ae4('0x41')]=[{'all':!![]}];}return db[_0x9ae4('0x2f')][_0x9ae4('0x42')](_0x283574);})[_0x9ae4('0x26')](function(_0x5d09c9){_0x414b83[_0x9ae4('0x43')]=_0x5d09c9;return _0x414b83;})[_0x9ae4('0x26')](respondWithFilteredResult(_0x49a9da,_0x283574))[_0x9ae4('0x44')](handleError(_0x49a9da,null));};exports[_0x9ae4('0x45')]=function(_0x1844c1,_0x35183f){var _0x3e6024={'raw':![],'where':{'id':_0x1844c1[_0x9ae4('0x46')]['id']}},_0x33f3da={};_0x33f3da[_0x9ae4('0x33')]=_[_0x9ae4('0x47')](db[_0x9ae4('0x2f')][_0x9ae4('0x30')]);_0x33f3da[_0x9ae4('0x34')]=_[_0x9ae4('0x47')](_0x1844c1[_0x9ae4('0x34')]);_0x33f3da[_0x9ae4('0x39')]=_[_0x9ae4('0x35')](_0x33f3da[_0x9ae4('0x33')],_0x33f3da[_0x9ae4('0x34')]);_0x3e6024['attributes']=_[_0x9ae4('0x35')](_0x33f3da[_0x9ae4('0x33')],qs[_0x9ae4('0x37')](_0x1844c1[_0x9ae4('0x34')][_0x9ae4('0x37')]));_0x3e6024[_0x9ae4('0x36')]=_0x3e6024[_0x9ae4('0x36')][_0x9ae4('0x48')]?_0x3e6024[_0x9ae4('0x36')]:_0x33f3da[_0x9ae4('0x33')];if(_0x1844c1[_0x9ae4('0x34')][_0x9ae4('0x40')]){_0x3e6024[_0x9ae4('0x41')]=[{'all':!![]}];}_0x3e6024=_[_0x9ae4('0x3c')]({},_0x3e6024,_0x1844c1[_0x9ae4('0x3f')]);return db[_0x9ae4('0x2f')][_0x9ae4('0x49')](_0x3e6024)[_0x9ae4('0x26')](handleEntityNotFound(_0x35183f,null))[_0x9ae4('0x26')](respondWithResult(_0x35183f,null))['catch'](handleError(_0x35183f,null));};exports[_0x9ae4('0x4a')]=function(_0x296bc0,_0xd76a34){return db[_0x9ae4('0x2f')][_0x9ae4('0x4a')](_0x296bc0['body'],{})['then'](respondWithResult(_0xd76a34,0xc9))[_0x9ae4('0x44')](handleError(_0xd76a34,null));};exports['update']=function(_0x593262,_0x34a414){if(_0x593262['body']['id']){delete _0x593262[_0x9ae4('0x4b')]['id'];}return db[_0x9ae4('0x2f')][_0x9ae4('0x49')]({'where':{'id':_0x593262['params']['id']}})['then'](handleEntityNotFound(_0x34a414,null))[_0x9ae4('0x26')](saveUpdates(_0x593262['body'],null))[_0x9ae4('0x26')](respondWithResult(_0x34a414,null))[_0x9ae4('0x44')](handleError(_0x34a414,null));};exports[_0x9ae4('0x27')]=function(_0x4c52fc,_0x15d984){return db['ServicenowAccount'][_0x9ae4('0x49')]({'where':{'id':_0x4c52fc[_0x9ae4('0x46')]['id']}})[_0x9ae4('0x26')](handleEntityNotFound(_0x15d984,null))[_0x9ae4('0x26')](removeEntity(_0x15d984,null))['catch'](handleError(_0x15d984,null));};exports['getConfigurations']=function(_0x2c0c78,_0x550cef,_0x179f65){var _0x29c5c5={};var _0x5bea95={};var _0x1204af;var _0x47b5a4;return db[_0x9ae4('0x2f')]['findOne']({'where':{'id':_0x2c0c78[_0x9ae4('0x46')]['id']}})[_0x9ae4('0x26')](handleEntityNotFound(_0x550cef,null))[_0x9ae4('0x26')](function(_0x297b73){if(_0x297b73){_0x1204af=_0x297b73;_0x5bea95[_0x9ae4('0x33')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x5bea95[_0x9ae4('0x34')]=_[_0x9ae4('0x47')](_0x2c0c78[_0x9ae4('0x34')]);_0x5bea95[_0x9ae4('0x39')]=_[_0x9ae4('0x35')](_0x5bea95[_0x9ae4('0x33')],_0x5bea95[_0x9ae4('0x34')]);_0x29c5c5[_0x9ae4('0x36')]=_['intersection'](_0x5bea95[_0x9ae4('0x33')],qs[_0x9ae4('0x37')](_0x2c0c78[_0x9ae4('0x34')]['fields']));_0x29c5c5[_0x9ae4('0x36')]=_0x29c5c5[_0x9ae4('0x36')][_0x9ae4('0x48')]?_0x29c5c5[_0x9ae4('0x36')]:_0x5bea95[_0x9ae4('0x33')];_0x29c5c5[_0x9ae4('0x4c')]=qs['sort'](_0x2c0c78['query'][_0x9ae4('0x4d')]);_0x29c5c5[_0x9ae4('0x3d')]=qs[_0x9ae4('0x39')](_[_0x9ae4('0x3a')](_0x2c0c78[_0x9ae4('0x34')],_0x5bea95['filters']));if(_0x2c0c78[_0x9ae4('0x34')]['filter']){_0x29c5c5[_0x9ae4('0x3d')]=_[_0x9ae4('0x3c')](_0x29c5c5[_0x9ae4('0x3d')],{'$or':_[_0x9ae4('0x2e')](_0x29c5c5[_0x9ae4('0x36')],function(_0x4511d6){var _0x39cf0f={};_0x39cf0f[_0x4511d6]={'$like':'%'+_0x2c0c78[_0x9ae4('0x34')][_0x9ae4('0x3b')]+'%'};return _0x39cf0f;})});}_0x29c5c5=_['merge']({},_0x29c5c5,_0x2c0c78[_0x9ae4('0x3f')]);return _0x1204af[_0x9ae4('0x4e')](_0x29c5c5);}})['then'](function(_0x1dd04b){if(_0x1dd04b){_0x47b5a4=_0x1dd04b[_0x9ae4('0x48')];if(!_0x2c0c78[_0x9ae4('0x34')][_0x9ae4('0x4f')]('nolimit')){_0x29c5c5[_0x9ae4('0x1e')]=qs[_0x9ae4('0x1e')](_0x2c0c78[_0x9ae4('0x34')][_0x9ae4('0x1e')]);_0x29c5c5[_0x9ae4('0x1c')]=qs[_0x9ae4('0x1c')](_0x2c0c78[_0x9ae4('0x34')][_0x9ae4('0x1c')]);}return _0x1204af[_0x9ae4('0x4e')](_0x29c5c5);}})['then'](function(_0x19a4e2){if(_0x19a4e2){return _0x19a4e2?{'count':_0x47b5a4,'rows':_0x19a4e2}:null;}})[_0x9ae4('0x26')](respondWithResult(_0x550cef,null))['catch'](handleError(_0x550cef,null));};exports['addConfiguration']=function(_0x30a2e0,_0x507c5e,_0x22c8cf){if(_0x30a2e0['body']['id']){delete _0x30a2e0[_0x9ae4('0x4b')]['id'];}return db[_0x9ae4('0x2f')][_0x9ae4('0x50')]({'where':{'id':_0x30a2e0[_0x9ae4('0x46')]['id']}})[_0x9ae4('0x26')](handleEntityNotFound(_0x507c5e,null))['then'](function(_0x56df41){if(_0x56df41){_0x30a2e0[_0x9ae4('0x4b')][_0x9ae4('0x51')]=_0x56df41['id'];_0x30a2e0['body'][_0x9ae4('0x52')]=integrations[_0x9ae4('0x53')](_0x30a2e0[_0x9ae4('0x4b')][_0x9ae4('0x54')],_0x30a2e0['body'][_0x9ae4('0x55')]);_0x30a2e0[_0x9ae4('0x4b')][_0x9ae4('0x56')]=integrations[_0x9ae4('0x57')](_0x30a2e0[_0x9ae4('0x4b')]['channel'],_0x30a2e0[_0x9ae4('0x4b')][_0x9ae4('0x55')]);return db['ServicenowConfiguration']['create'](_0x30a2e0[_0x9ae4('0x4b')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x9ae4('0x58')],'as':_0x9ae4('0x56')}]});}return null;})[_0x9ae4('0x26')](respondWithResult(_0x507c5e,null))[_0x9ae4('0x44')](handleError(_0x507c5e,null));};exports[_0x9ae4('0x59')]=function(_0x43163e,_0x3f45f7,_0x42b62c){var _0x5240fd=[_0x9ae4('0x5a'),_0x9ae4('0x5b'),_0x9ae4('0x5c'),_0x9ae4('0x5d'),_0x9ae4('0x5e'),'notify',_0x9ae4('0x5f'),'severity',_0x9ae4('0x60')];var _0x8420df=[_0x9ae4('0x61'),_0x9ae4('0x5a'),'caused_by',_0x9ae4('0x62'),_0x9ae4('0x63'),_0x9ae4('0x64'),_0x9ae4('0x65'),'hold_reason',_0x9ae4('0x66'),_0x9ae4('0x67'),_0x9ae4('0x68'),'sys_updated_by',_0x9ae4('0x69'),'user_input',_0x9ae4('0x6a'),_0x9ae4('0x6b'),_0x9ae4('0x6c'),_0x9ae4('0x6d'),_0x9ae4('0x5c'),'order','calendar_stc','closed_at',_0x9ae4('0x6e'),_0x9ae4('0x6f'),_0x9ae4('0x70'),'active',_0x9ae4('0x71'),_0x9ae4('0x72'),_0x9ae4('0x73'),_0x9ae4('0x74'),'rfc',_0x9ae4('0x75'),_0x9ae4('0x76'),_0x9ae4('0x77'),'business_duration','group_list',_0x9ae4('0x78'),_0x9ae4('0x79'),_0x9ae4('0x7a'),_0x9ae4('0x7b'),_0x9ae4('0x7c'),_0x9ae4('0x5d'),_0x9ae4('0x7d'),_0x9ae4('0x7e'),'close_code',_0x9ae4('0x7f'),_0x9ae4('0x80'),_0x9ae4('0x81'),_0x9ae4('0x82'),'business_stc',_0x9ae4('0x83'),'description',_0x9ae4('0x84'),_0x9ae4('0x85'),'sys_class_name',_0x9ae4('0x86'),'closed_by',_0x9ae4('0x87'),_0x9ae4('0x88'),'sys_id','contact_type','reopened_by',_0x9ae4('0x5f'),_0x9ae4('0x89'),_0x9ae4('0x8a'),'company',_0x9ae4('0x8b'),'activity_due',_0x9ae4('0x8c'),_0x9ae4('0x8d'),_0x9ae4('0x8e'),_0x9ae4('0x8f'),_0x9ae4('0x90'),_0x9ae4('0x91'),_0x9ae4('0x92'),'sys_mod_count','reopen_count',_0x9ae4('0x93'),_0x9ae4('0x94'),_0x9ae4('0x95'),_0x9ae4('0x96'),_0x9ae4('0x97'),_0x9ae4('0x60')];var _0x2bdf60='';var _0x3966c3='';var _0x16bedc=[];var _0x52a33f='';var _0x7c05bf='';var _0x1410f6=[];var _0xddb3e4='';var _0x773fbd='';var _0x591ac2={};var _0x131a35='';return db['ServicenowAccount'][_0x9ae4('0x50')]({'where':{'id':_0x43163e[_0x9ae4('0x46')]['id']},'attributes':['id',_0x9ae4('0x98'),_0x9ae4('0x99'),_0x9ae4('0x9a'),_0x9ae4('0x9b'),'serverUrl']})[_0x9ae4('0x26')](handleEntityNotFound(_0x3f45f7,null))[_0x9ae4('0x26')](function(_0x3e24ff){if(_0x3e24ff){_0x131a35=_0x3e24ff[_0x9ae4('0x9b')];var _0x354b76=_0x131a35[_0x9ae4('0x9c')](-0x1);if(_0x354b76==='/'){_0x131a35=_0x131a35['substring'](0x0,_0x131a35[_0x9ae4('0x9d')](_0x354b76));}_0x773fbd=util[_0x9ae4('0x9e')]('%s/api/now/doc/table/schema/',_0x131a35);_0xddb3e4=util[_0x9ae4('0x9e')]('%s/api/now/table/',_0x131a35);_0x591ac2={'user':_0x3e24ff['username'],'pass':_0x3e24ff[_0x9ae4('0x99')]};var _0x4fef0f={'method':_0x9ae4('0x9f'),'uri':_0x773fbd+_0x9ae4('0xa0'),'auth':_0x591ac2,'json':!![]};return rp(_0x4fef0f);}})[_0x9ae4('0x26')](function(_0x5246f4){if(_0x5246f4[_0x9ae4('0xa1')][_0x9ae4('0x48')]>0x0){_0x2bdf60=_0x5246f4[_0x9ae4('0xa1')];}console[_0x9ae4('0xa2')](_0x9ae4('0xa3'),_0x2bdf60);_0x1410f6=[];_0x3966c3=Object['assign']([],_0x2bdf60);_['remove'](_0x3966c3,function(_0x5d0e3e){return!_0x5240fd[_0x9ae4('0xa4')](_0x5d0e3e[_0x9ae4('0x2b')]);});_0x3966c3['forEach'](function(_0x5dd087){var _0x2c53b2=createFieldObject(_0xddb3e4,_0x591ac2,_0x5dd087[_0x9ae4('0xa5')],_0x5dd087[_0x9ae4('0x2b')],_0x5dd087[_0x9ae4('0xa6')],![]);_0x1410f6['push'](_0x2c53b2);});return Promise['all'](_0x1410f6);})[_0x9ae4('0x26')](function(_0xd7a08d){_0x16bedc=_0xd7a08d;_0x52a33f=Object[_0x9ae4('0xa7')]([],_0x2bdf60);console[_0x9ae4('0xa2')](_0x9ae4('0xa8'),_0x2bdf60);_[_0x9ae4('0xa9')](_0x52a33f,function(_0x1fd7d2){return _0x8420df[_0x9ae4('0xa4')](_0x1fd7d2[_0x9ae4('0x2b')]);});console[_0x9ae4('0xa2')](_0x9ae4('0xaa'),_0x52a33f);_0x1410f6=[];_0x52a33f[_0x9ae4('0xab')](function(_0x29bc0a){var _0x1b5979=createFieldObject(_0xddb3e4,_0x591ac2,_0x29bc0a[_0x9ae4('0xa5')],_0x29bc0a['name'],_0x29bc0a[_0x9ae4('0xa6')],!![]);_0x1410f6[_0x9ae4('0xac')](_0x1b5979);});return Promise[_0x9ae4('0xad')](_0x1410f6);})[_0x9ae4('0x26')](function(_0x306824){_0x7c05bf=_0x306824;var _0x51aa69=_0x16bedc['concat'](_0x7c05bf);return{'count':_0x51aa69[_0x9ae4('0x48')],'rows':_0x51aa69};})[_0x9ae4('0x26')](respondWithResult(_0x3f45f7,null))[_0x9ae4('0x44')](function(_0x3bc19c){console[_0x9ae4('0xa2')](_0x9ae4('0xae')+_0x3bc19c);var _0x264dbf=_0x43163e[_0x9ae4('0x34')][_0x9ae4('0xaf')]?0x1f4:_0x3bc19c[_0x9ae4('0xb0')]||0x1f4;logger[_0x9ae4('0x29')](_0x3bc19c[_0x9ae4('0x2a')]);delete _0x3bc19c[_0x9ae4('0x2b')];if(_0x264dbf===0x191){_0x264dbf=0x190;}_0x3f45f7[_0x9ae4('0x28')](_0x264dbf)[_0x9ae4('0x2c')](_0x43163e[_0x9ae4('0x34')][_0x9ae4('0xaf')]?{'message':'Wrong\x20credentials','statusCode':_0x3bc19c[_0x9ae4('0xb0')]}:_0x3bc19c);});};function createFieldObject(_0x1cf46b,_0x22d24d,_0x2eba5c,_0x4cd842,_0x554803,_0x10e1ff){return new Promise(function(_0x27c0de,_0x3139ba){var _0x261f6a={'id':_0x4cd842,'name':_0x554803,'custom':_0x10e1ff};if(_0x2eba5c===_0x9ae4('0xb1')){_0x261f6a[_0x9ae4('0x3f')]=[{'name':_0x9ae4('0xb2'),'value':_0x9ae4('0xb3')},{'name':'False','value':_0x9ae4('0xb4')}];_0x27c0de(_0x261f6a);}else{var _0xc29c95={'method':_0x9ae4('0x9f'),'uri':_0x1cf46b+_0x9ae4('0xb5')+_0x4cd842,'auth':_0x22d24d,'json':!![]};return rp(_0xc29c95)[_0x9ae4('0x26')](function(_0x4a7e30){var _0x364416=[];if(_0x4a7e30['result']['length']>0x0){_0x4a7e30[_0x9ae4('0xa1')][_0x9ae4('0xab')](function(_0x14d6e6){if(_0x14d6e6['inactive']===_0x9ae4('0xb4')){var _0x1e0488={'name':_0x14d6e6['label'],'value':_0x14d6e6[_0x9ae4('0xb6')]};_0x364416[_0x9ae4('0xac')](_0x1e0488);}});}_0x261f6a[_0x9ae4('0x3f')]=_0x364416;if(_0x261f6a['options'][_0x9ae4('0x48')]>0x0){_0x27c0de(_0x261f6a);}else{if(_0x10e1ff==![]){_0x27c0de();}else{_0x27c0de(_0x261f6a);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 6adb0d5..5fa4014 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xf494,0x1c6));var _0x4f49=function(_0x58b250,_0x210a75){_0x58b250=_0x58b250-0x0;var _0x2ad6d6=_0xf494[_0x58b250];return _0x2ad6d6;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x29cf89,_0x10ce1f){_0x29cf89=_0x29cf89-0x0;var _0x34ac61=_0xf2ca[_0x29cf89];return _0x34ac61;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xaf2c('0x9'));module[_0xaf2c('0xa')]=function(_0x297740,_0x1f9531){return _0x297740['define'](_0xaf2c('0xb'),attributes,{'tableName':_0xaf2c('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 7f9c206..554a091 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 _0x9735=['message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9735,0x142));var _0x5973=function(_0x208d00,_0x4b487a){_0x208d00=_0x208d00-0x0;var _0x3c757f=_0x9735[_0x208d00];return _0x3c757f;};'use strict';var _=require(_0x5973('0x0'));var util=require('util');var moment=require(_0x5973('0x1'));var BPromise=require(_0x5973('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5973('0x3'));var logger=require(_0x5973('0x4'))(_0x5973('0x5'));var config=require(_0x5973('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5973('0x7')][_0x5973('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4707d6,_0x22b048,_0x3c12c7){return new BPromise(function(_0x260b9f,_0x4cafe7){return client[_0x5973('0x9')](_0x4707d6,_0x3c12c7)[_0x5973('0xa')](function(_0x171bd9){logger[_0x5973('0xb')](_0x5973('0xc'),_0x22b048,'request\x20sent');logger[_0x5973('0xd')](_0x5973('0xe'),_0x22b048,_0x5973('0xf'),JSON[_0x5973('0x10')](_0x171bd9));if(_0x171bd9[_0x5973('0x11')]){if(_0x171bd9[_0x5973('0x11')]['code']===0x1f4){logger['error'](_0x5973('0xc'),_0x22b048,_0x171bd9['error'][_0x5973('0x12')]);return _0x4cafe7(_0x171bd9[_0x5973('0x11')][_0x5973('0x12')]);}logger[_0x5973('0x11')](_0x5973('0xc'),_0x22b048,_0x171bd9[_0x5973('0x11')][_0x5973('0x12')]);return _0x260b9f(_0x171bd9[_0x5973('0x11')]['message']);}else{logger[_0x5973('0xb')](_0x5973('0xc'),_0x22b048,_0x5973('0xf'));_0x260b9f(_0x171bd9[_0x5973('0x13')]['message']);}})[_0x5973('0x14')](function(_0x5391bc){logger[_0x5973('0x11')](_0x5973('0xc'),_0x22b048,_0x5391bc);_0x4cafe7(_0x5391bc);});});}exports[_0x5973('0x15')]=function(_0x329a77){var _0x1c46c5=this;return new Promise(function(_0x34a07e,_0x527d48){return db[_0x5973('0x16')][_0x5973('0x17')]({'raw':_0x329a77['options']?_0x329a77[_0x5973('0x18')][_0x5973('0x19')]===undefined?!![]:![]:!![],'where':_0x329a77[_0x5973('0x18')]?_0x329a77['options'][_0x5973('0x1a')]||null:null,'attributes':_0x329a77[_0x5973('0x18')]?_0x329a77[_0x5973('0x18')][_0x5973('0x1b')]||null:null,'limit':_0x329a77['options']?_0x329a77[_0x5973('0x18')][_0x5973('0x1c')]||null:null,'include':_0x329a77[_0x5973('0x18')]?_0x329a77[_0x5973('0x18')][_0x5973('0x1d')]?_[_0x5973('0x1e')](_0x329a77[_0x5973('0x18')][_0x5973('0x1d')],function(_0x7e065f){return{'model':db[_0x7e065f[_0x5973('0x1f')]],'as':_0x7e065f['as'],'attributes':_0x7e065f[_0x5973('0x1b')],'include':_0x7e065f[_0x5973('0x1d')]?_[_0x5973('0x1e')](_0x7e065f['include'],function(_0x52c9b7){return{'model':db[_0x52c9b7[_0x5973('0x1f')]],'as':_0x52c9b7['as'],'attributes':_0x52c9b7[_0x5973('0x1b')],'include':_0x52c9b7['include']?_[_0x5973('0x1e')](_0x52c9b7[_0x5973('0x1d')],function(_0xdff97e){return{'model':db[_0xdff97e[_0x5973('0x1f')]],'as':_0xdff97e['as'],'attributes':_0xdff97e[_0x5973('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5973('0xa')](function(_0x10968f){logger[_0x5973('0xb')](_0x5973('0x15'),_0x329a77);logger[_0x5973('0xd')]('GetServicenowAccount',_0x329a77,JSON[_0x5973('0x10')](_0x10968f));_0x34a07e(_0x10968f);})[_0x5973('0x14')](function(_0x4fe7d0){logger[_0x5973('0x11')](_0x5973('0x15'),_0x4fe7d0[_0x5973('0x12')],_0x329a77);_0x527d48(_0x1c46c5[_0x5973('0x11')](0x1f4,_0x4fe7d0[_0x5973('0x12')]));});});};exports[_0x5973('0x20')]=function(_0x571295){var _0x52be75=this;return new Promise(function(_0x4a5272,_0x2054c6){return db[_0x5973('0x16')][_0x5973('0x21')]({'raw':_0x571295[_0x5973('0x18')]?_0x571295[_0x5973('0x18')][_0x5973('0x19')]===undefined?!![]:![]:!![],'where':_0x571295[_0x5973('0x18')]?_0x571295[_0x5973('0x18')]['where']||null:null,'attributes':_0x571295[_0x5973('0x18')]?_0x571295[_0x5973('0x18')][_0x5973('0x1b')]||null:null,'include':_0x571295[_0x5973('0x18')]?_0x571295[_0x5973('0x18')][_0x5973('0x1d')]?_['map'](_0x571295['options'][_0x5973('0x1d')],function(_0x56f605){return{'model':db[_0x56f605['model']],'as':_0x56f605['as'],'attributes':_0x56f605[_0x5973('0x1b')],'include':_0x56f605[_0x5973('0x1d')]?_['map'](_0x56f605[_0x5973('0x1d')],function(_0x4cded1){return{'model':db[_0x4cded1[_0x5973('0x1f')]],'as':_0x4cded1['as'],'attributes':_0x4cded1['attributes'],'include':_0x4cded1['include']?_[_0x5973('0x1e')](_0x4cded1[_0x5973('0x1d')],function(_0x2bf66f){return{'model':db[_0x2bf66f[_0x5973('0x1f')]],'as':_0x2bf66f['as'],'attributes':_0x2bf66f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5973('0xa')](function(_0x3f3fb6){logger['info'](_0x5973('0x20'),_0x571295);logger[_0x5973('0xd')]('ShowServicenowAccount',_0x571295,JSON['stringify'](_0x3f3fb6));_0x4a5272(_0x3f3fb6);})['catch'](function(_0x27a7d0){logger[_0x5973('0x11')]('ShowServicenowAccount',_0x27a7d0[_0x5973('0x12')],_0x571295);_0x2054c6(_0x52be75[_0x5973('0x11')](0x1f4,_0x27a7d0[_0x5973('0x12')]));});});}; \ No newline at end of file +var _0x5b17=['options','raw','attributes','limit','include','map','model','then','debug','stringify','ShowServicenowAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5b17,0xc5));var _0x75b1=function(_0x51a565,_0x15365a){_0x51a565=_0x51a565-0x0;var _0x4167de=_0x5b17[_0x51a565];return _0x4167de;};'use strict';var _=require(_0x75b1('0x0'));var util=require(_0x75b1('0x1'));var moment=require(_0x75b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x75b1('0x3'));var fs=require('fs');var Redis=require(_0x75b1('0x4'));var db=require(_0x75b1('0x5'))['db'];var utils=require(_0x75b1('0x6'));var logger=require(_0x75b1('0x7'))(_0x75b1('0x8'));var config=require(_0x75b1('0x9'));var jayson=require(_0x75b1('0xa'));var client=jayson[_0x75b1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a788,_0x58f16c,_0x1e59bc){return new BPromise(function(_0x25b38a,_0x31a3b4){return client[_0x75b1('0xc')](_0x22a788,_0x1e59bc)['then'](function(_0x313b4f){logger[_0x75b1('0xd')](_0x75b1('0xe'),_0x58f16c,_0x75b1('0xf'));logger['debug'](_0x75b1('0x10'),_0x58f16c,_0x75b1('0xf'),JSON['stringify'](_0x313b4f));if(_0x313b4f[_0x75b1('0x11')]){if(_0x313b4f[_0x75b1('0x11')][_0x75b1('0x12')]===0x1f4){logger[_0x75b1('0x11')](_0x75b1('0xe'),_0x58f16c,_0x313b4f[_0x75b1('0x11')][_0x75b1('0x13')]);return _0x31a3b4(_0x313b4f[_0x75b1('0x11')]['message']);}logger[_0x75b1('0x11')](_0x75b1('0xe'),_0x58f16c,_0x313b4f[_0x75b1('0x11')][_0x75b1('0x13')]);return _0x25b38a(_0x313b4f[_0x75b1('0x11')][_0x75b1('0x13')]);}else{logger[_0x75b1('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x58f16c,'request\x20sent');_0x25b38a(_0x313b4f[_0x75b1('0x14')]['message']);}})[_0x75b1('0x15')](function(_0xdff532){logger['error'](_0x75b1('0xe'),_0x58f16c,_0xdff532);_0x31a3b4(_0xdff532);});});}exports[_0x75b1('0x16')]=function(_0x38adcf){var _0x4ca9b7=this;return new Promise(function(_0x512196,_0x372192){return db[_0x75b1('0x17')][_0x75b1('0x18')]({'raw':_0x38adcf['options']?_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1a')]===undefined?!![]:![]:!![],'where':_0x38adcf[_0x75b1('0x19')]?_0x38adcf[_0x75b1('0x19')]['where']||null:null,'attributes':_0x38adcf[_0x75b1('0x19')]?_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1b')]||null:null,'limit':_0x38adcf[_0x75b1('0x19')]?_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1c')]||null:null,'include':_0x38adcf[_0x75b1('0x19')]?_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1d')]?_[_0x75b1('0x1e')](_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1d')],function(_0x1af4ba){return{'model':db[_0x1af4ba['model']],'as':_0x1af4ba['as'],'attributes':_0x1af4ba['attributes'],'include':_0x1af4ba[_0x75b1('0x1d')]?_[_0x75b1('0x1e')](_0x1af4ba['include'],function(_0x5b5742){return{'model':db[_0x5b5742[_0x75b1('0x1f')]],'as':_0x5b5742['as'],'attributes':_0x5b5742[_0x75b1('0x1b')],'include':_0x5b5742['include']?_[_0x75b1('0x1e')](_0x5b5742[_0x75b1('0x1d')],function(_0x2d09f5){return{'model':db[_0x2d09f5['model']],'as':_0x2d09f5['as'],'attributes':_0x2d09f5[_0x75b1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x75b1('0x20')](function(_0x1cee31){logger[_0x75b1('0xd')](_0x75b1('0x16'),_0x38adcf);logger[_0x75b1('0x21')](_0x75b1('0x16'),_0x38adcf,JSON[_0x75b1('0x22')](_0x1cee31));_0x512196(_0x1cee31);})[_0x75b1('0x15')](function(_0x21725f){logger['error'](_0x75b1('0x16'),_0x21725f[_0x75b1('0x13')],_0x38adcf);_0x372192(_0x4ca9b7[_0x75b1('0x11')](0x1f4,_0x21725f['message']));});});};exports[_0x75b1('0x23')]=function(_0xfdaa7c){var _0xa1ed12=this;return new Promise(function(_0x12d17d,_0x340398){return db[_0x75b1('0x17')][_0x75b1('0x24')]({'raw':_0xfdaa7c[_0x75b1('0x19')]?_0xfdaa7c[_0x75b1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xfdaa7c['options']?_0xfdaa7c[_0x75b1('0x19')]['where']||null:null,'attributes':_0xfdaa7c[_0x75b1('0x19')]?_0xfdaa7c[_0x75b1('0x19')]['attributes']||null:null,'include':_0xfdaa7c[_0x75b1('0x19')]?_0xfdaa7c[_0x75b1('0x19')][_0x75b1('0x1d')]?_['map'](_0xfdaa7c['options']['include'],function(_0x54882e){return{'model':db[_0x54882e['model']],'as':_0x54882e['as'],'attributes':_0x54882e[_0x75b1('0x1b')],'include':_0x54882e[_0x75b1('0x1d')]?_[_0x75b1('0x1e')](_0x54882e[_0x75b1('0x1d')],function(_0x227db3){return{'model':db[_0x227db3[_0x75b1('0x1f')]],'as':_0x227db3['as'],'attributes':_0x227db3[_0x75b1('0x1b')],'include':_0x227db3['include']?_[_0x75b1('0x1e')](_0x227db3[_0x75b1('0x1d')],function(_0x5c7845){return{'model':db[_0x5c7845[_0x75b1('0x1f')]],'as':_0x5c7845['as'],'attributes':_0x5c7845[_0x75b1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x75b1('0x20')](function(_0x8b96f0){logger[_0x75b1('0xd')](_0x75b1('0x23'),_0xfdaa7c);logger[_0x75b1('0x21')](_0x75b1('0x23'),_0xfdaa7c,JSON[_0x75b1('0x22')](_0x8b96f0));_0x12d17d(_0x8b96f0);})['catch'](function(_0x4fab4f){logger[_0x75b1('0x11')](_0x75b1('0x23'),_0x4fab4f[_0x75b1('0x13')],_0xfdaa7c);_0x340398(_0xa1ed12['error'](0x1f4,_0x4fab4f['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index f237fbf..65dd691 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 _0x0867=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x0867,0x1ee));var _0x7086=function(_0x1d31e0,_0x5df7a6){_0x1d31e0=_0x1d31e0-0x0;var _0x2751f0=_0x0867[_0x1d31e0];return _0x2751f0;};'use strict';var multer=require(_0x7086('0x0'));var util=require(_0x7086('0x1'));var path=require('path');var timeout=require(_0x7086('0x2'));var express=require('express');var router=express[_0x7086('0x3')]();var fs_extra=require(_0x7086('0x4'));var auth=require(_0x7086('0x5'));var interaction=require(_0x7086('0x6'));var config=require(_0x7086('0x7'));var controller=require(_0x7086('0x8'));router[_0x7086('0x9')]('/',auth[_0x7086('0xa')](),controller[_0x7086('0xb')]);router[_0x7086('0x9')](_0x7086('0xc'),auth['isAuthenticated'](),controller[_0x7086('0xd')]);router[_0x7086('0x9')](_0x7086('0xe'),auth['isAuthenticated'](),controller[_0x7086('0xf')]);router[_0x7086('0x9')](_0x7086('0x10'),auth[_0x7086('0xa')](),controller[_0x7086('0x11')]);router[_0x7086('0x9')](_0x7086('0x12'),auth[_0x7086('0xa')](),controller['getDescriptions']);router[_0x7086('0x13')]('/',auth[_0x7086('0xa')](),controller[_0x7086('0x14')]);router[_0x7086('0x15')](_0x7086('0xc'),auth[_0x7086('0xa')](),controller['update']);router[_0x7086('0x16')](_0x7086('0xc'),auth[_0x7086('0xa')](),controller[_0x7086('0x17')]);module[_0x7086('0x18')]=router; \ No newline at end of file +var _0xd446=['create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','post'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xd446,0xec));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6d44('0x0'));var util=require(_0x6d44('0x1'));var path=require(_0x6d44('0x2'));var timeout=require(_0x6d44('0x3'));var express=require('express');var router=express[_0x6d44('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d44('0x5'));var interaction=require(_0x6d44('0x6'));var config=require(_0x6d44('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x6d44('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d44('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6d44('0xa')]);router['get'](_0x6d44('0xb'),auth[_0x6d44('0xc')](),controller[_0x6d44('0xd')]);router[_0x6d44('0x8')]('/:id/subjects',auth[_0x6d44('0xc')](),controller[_0x6d44('0xe')]);router[_0x6d44('0x8')](_0x6d44('0xf'),auth[_0x6d44('0xc')](),controller['getDescriptions']);router[_0x6d44('0x10')]('/',auth[_0x6d44('0xc')](),controller[_0x6d44('0x11')]);router['put'](_0x6d44('0x12'),auth[_0x6d44('0xc')](),controller[_0x6d44('0x13')]);router[_0x6d44('0x14')](_0x6d44('0x12'),auth[_0x6d44('0xc')](),controller[_0x6d44('0x15')]);module[_0x6d44('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5c890b0..75b40dc 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 _0x8337=['exports','STRING','sequelize'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x8337,0x1ee));var _0x7833=function(_0xeb8fec,_0x36ebc4){_0xeb8fec=_0xeb8fec-0x0;var _0x49397a=_0x8337[_0xeb8fec];return _0x49397a;};'use strict';var Sequelize=require(_0x7833('0x0'));module[_0x7833('0x1')]={'name':{'type':Sequelize[_0x7833('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x58e1=['STRING','sequelize','exports'];(function(_0x21f51a,_0x4307c2){var _0x450ef1=function(_0x286e5f){while(--_0x286e5f){_0x21f51a['push'](_0x21f51a['shift']());}};_0x450ef1(++_0x4307c2);}(_0x58e1,0x64));var _0x158e=function(_0x2bdcf2,_0x52512b){_0x2bdcf2=_0x2bdcf2-0x0;var _0x216126=_0x58e1[_0x2bdcf2];return _0x216126;};'use strict';var Sequelize=require(_0x158e('0x0'));module[_0x158e('0x1')]={'name':{'type':Sequelize[_0x158e('0x2')]},'description':{'type':Sequelize[_0x158e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index edc18e1..e79723e 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 _0x6e40=['limit','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','body','params','getFields','ServicenowField','pick','filter','options','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e40,0x176));var _0x06e4=function(_0x295e2d,_0x1e3f0e){_0x295e2d=_0x295e2d-0x0;var _0x33fbce=_0x6e40[_0x295e2d];return _0x33fbce;};'use strict';var emlformat=require(_0x06e4('0x0'));var rimraf=require(_0x06e4('0x1'));var zipdir=require(_0x06e4('0x2'));var jsonpatch=require(_0x06e4('0x3'));var rp=require(_0x06e4('0x4'));var moment=require(_0x06e4('0x5'));var BPromise=require(_0x06e4('0x6'));var Mustache=require(_0x06e4('0x7'));var util=require('util');var path=require(_0x06e4('0x8'));var sox=require(_0x06e4('0x9'));var csv=require(_0x06e4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x06e4('0xb'));var _=require(_0x06e4('0xc'));var squel=require('squel');var crypto=require(_0x06e4('0xd'));var jsforce=require(_0x06e4('0xe'));var deskjs=require(_0x06e4('0xf'));var toCsv=require(_0x06e4('0xa'));var querystring=require('querystring');var Papa=require(_0x06e4('0x10'));var Redis=require(_0x06e4('0x11'));var authService=require(_0x06e4('0x12'));var qs=require(_0x06e4('0x13'));var as=require(_0x06e4('0x14'));var hardwareService=require(_0x06e4('0x15'));var logger=require('../../config/logger')(_0x06e4('0x16'));var utils=require(_0x06e4('0x17'));var config=require(_0x06e4('0x18'));var licenseUtil=require(_0x06e4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b4543,_0x57182a){_0x57182a=_0x57182a||0xcc;return function(_0xd3abe9){if(_0xd3abe9){return _0x4b4543[_0x06e4('0x1a')](_0x57182a);}return _0x4b4543[_0x06e4('0x1b')](_0x57182a)[_0x06e4('0x1c')]();};}function respondWithResult(_0x3334d5,_0x43f1ed){_0x43f1ed=_0x43f1ed||0xc8;return function(_0x10b800){if(_0x10b800){return _0x3334d5[_0x06e4('0x1b')](_0x43f1ed)[_0x06e4('0x1d')](_0x10b800);}};}function respondWithFilteredResult(_0x76c5bf,_0x58c291){return function(_0x4fd19b){if(_0x4fd19b){var _0x5d7358=typeof _0x58c291['offset']===_0x06e4('0x1e')&&typeof _0x58c291[_0x06e4('0x1f')]===_0x06e4('0x1e');var _0x43e004=_0x4fd19b['count'];var _0x2283b3=_0x5d7358?0x0:_0x58c291[_0x06e4('0x20')];var _0x5a0853=_0x5d7358?_0x4fd19b[_0x06e4('0x21')]:_0x58c291[_0x06e4('0x20')]+_0x58c291[_0x06e4('0x1f')];var _0x3e83db;if(_0x5a0853>=_0x43e004){_0x5a0853=_0x43e004;_0x3e83db=0xc8;}else{_0x3e83db=0xce;}_0x76c5bf['status'](_0x3e83db);return _0x76c5bf[_0x06e4('0x22')](_0x06e4('0x23'),_0x2283b3+'-'+_0x5a0853+'/'+_0x43e004)[_0x06e4('0x1d')](_0x4fd19b);}return null;};}function patchUpdates(_0x20cd1b){return function(_0x1df36d){try{jsonpatch['apply'](_0x1df36d,_0x20cd1b,!![]);}catch(_0x236597){return BPromise[_0x06e4('0x24')](_0x236597);}return _0x1df36d[_0x06e4('0x25')]();};}function saveUpdates(_0x2cfc28,_0x22a55b){return function(_0x23e69b){if(_0x23e69b){return _0x23e69b[_0x06e4('0x26')](_0x2cfc28)[_0x06e4('0x27')](function(_0x2b95df){return _0x2b95df;});}return null;};}function removeEntity(_0x5de176,_0x8ce223){return function(_0x55e7c1){if(_0x55e7c1){return _0x55e7c1[_0x06e4('0x28')]()[_0x06e4('0x27')](function(){_0x5de176[_0x06e4('0x1b')](0xcc)[_0x06e4('0x1c')]();});}};}function handleEntityNotFound(_0xf70f4c,_0x489123){return function(_0x1be76b){if(!_0x1be76b){_0xf70f4c['sendStatus'](0x194);}return _0x1be76b;};}function handleError(_0x1112a1,_0x1f209f){_0x1f209f=_0x1f209f||0x1f4;return function(_0x4bf9b7){logger['error'](_0x4bf9b7[_0x06e4('0x29')]);if(_0x4bf9b7[_0x06e4('0x2a')]){delete _0x4bf9b7[_0x06e4('0x2a')];}_0x1112a1[_0x06e4('0x1b')](_0x1f209f)[_0x06e4('0x2b')](_0x4bf9b7);};}exports[_0x06e4('0x2c')]=function(_0x182f28,_0xc0720){var _0x55d151={},_0x38fa33={},_0xf66c5b={'count':0x0,'rows':[]};var _0xe33086=_[_0x06e4('0x2d')](db[_0x06e4('0x2e')][_0x06e4('0x2f')],function(_0x4ffc7d){return{'name':_0x4ffc7d['fieldName'],'type':_0x4ffc7d[_0x06e4('0x30')]['key']};});_0x38fa33[_0x06e4('0x31')]=_[_0x06e4('0x2d')](_0xe33086,_0x06e4('0x2a'));_0x38fa33[_0x06e4('0x32')]=_[_0x06e4('0x33')](_0x182f28[_0x06e4('0x32')]);_0x38fa33[_0x06e4('0x34')]=_['intersection'](_0x38fa33['model'],_0x38fa33[_0x06e4('0x32')]);_0x55d151[_0x06e4('0x35')]=_[_0x06e4('0x36')](_0x38fa33[_0x06e4('0x31')],qs[_0x06e4('0x37')](_0x182f28[_0x06e4('0x32')][_0x06e4('0x37')]));_0x55d151[_0x06e4('0x35')]=_0x55d151[_0x06e4('0x35')][_0x06e4('0x38')]?_0x55d151[_0x06e4('0x35')]:_0x38fa33['model'];if(!_0x182f28[_0x06e4('0x32')][_0x06e4('0x39')](_0x06e4('0x3a'))){_0x55d151[_0x06e4('0x1f')]=qs[_0x06e4('0x1f')](_0x182f28[_0x06e4('0x32')][_0x06e4('0x1f')]);_0x55d151[_0x06e4('0x20')]=qs['offset'](_0x182f28[_0x06e4('0x32')][_0x06e4('0x20')]);}_0x55d151[_0x06e4('0x3b')]=qs[_0x06e4('0x3c')](_0x182f28[_0x06e4('0x32')]['sort']);_0x55d151[_0x06e4('0x3d')]=qs[_0x06e4('0x34')](_['pick'](_0x182f28[_0x06e4('0x32')],_0x38fa33['filters']),_0xe33086);if(_0x182f28[_0x06e4('0x32')]['filter']){_0x55d151['where']=_[_0x06e4('0x3e')](_0x55d151[_0x06e4('0x3d')],{'$or':_[_0x06e4('0x2d')](_0xe33086,function(_0x424e62){if(_0x424e62['type']!==_0x06e4('0x3f')){var _0x104803={};_0x104803[_0x424e62[_0x06e4('0x2a')]]={'$like':'%'+_0x182f28[_0x06e4('0x32')]['filter']+'%'};return _0x104803;}})});}_0x55d151=_[_0x06e4('0x3e')]({},_0x55d151,_0x182f28['options']);var _0x372ed1={'where':_0x55d151[_0x06e4('0x3d')]};return db[_0x06e4('0x2e')]['count'](_0x372ed1)[_0x06e4('0x27')](function(_0x401397){_0xf66c5b['count']=_0x401397;if(_0x182f28[_0x06e4('0x32')][_0x06e4('0x40')]){_0x55d151[_0x06e4('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x06e4('0x42')](_0x55d151);})['then'](function(_0x16aa23){_0xf66c5b[_0x06e4('0x43')]=_0x16aa23;return _0xf66c5b;})[_0x06e4('0x27')](respondWithFilteredResult(_0xc0720,_0x55d151))[_0x06e4('0x44')](handleError(_0xc0720,null));};exports[_0x06e4('0x45')]=function(_0x5bb845,_0x29e790){var _0x55c64a={'raw':![],'where':{'id':_0x5bb845['params']['id']}},_0x2f6cd7={};_0x2f6cd7[_0x06e4('0x31')]=_['keys'](db[_0x06e4('0x2e')][_0x06e4('0x2f')]);_0x2f6cd7['query']=_[_0x06e4('0x33')](_0x5bb845[_0x06e4('0x32')]);_0x2f6cd7['filters']=_[_0x06e4('0x36')](_0x2f6cd7['model'],_0x2f6cd7[_0x06e4('0x32')]);_0x55c64a['attributes']=_[_0x06e4('0x36')](_0x2f6cd7['model'],qs[_0x06e4('0x37')](_0x5bb845[_0x06e4('0x32')][_0x06e4('0x37')]));_0x55c64a[_0x06e4('0x35')]=_0x55c64a['attributes'][_0x06e4('0x38')]?_0x55c64a[_0x06e4('0x35')]:_0x2f6cd7[_0x06e4('0x31')];if(_0x5bb845[_0x06e4('0x32')]['includeAll']){_0x55c64a[_0x06e4('0x41')]=[{'all':!![]}];}_0x55c64a=_[_0x06e4('0x3e')]({},_0x55c64a,_0x5bb845['options']);return db[_0x06e4('0x2e')][_0x06e4('0x46')](_0x55c64a)[_0x06e4('0x27')](handleEntityNotFound(_0x29e790,null))[_0x06e4('0x27')](respondWithResult(_0x29e790,null))['catch'](handleError(_0x29e790,null));};exports['create']=function(_0x4c1902,_0x204c96){return db[_0x06e4('0x2e')]['create'](_0x4c1902[_0x06e4('0x47')],{})['then'](respondWithResult(_0x204c96,0xc9))['catch'](handleError(_0x204c96,null));};exports[_0x06e4('0x26')]=function(_0x53c005,_0x30e465){if(_0x53c005['body']['id']){delete _0x53c005[_0x06e4('0x47')]['id'];}return db[_0x06e4('0x2e')]['find']({'where':{'id':_0x53c005[_0x06e4('0x48')]['id']}})[_0x06e4('0x27')](handleEntityNotFound(_0x30e465,null))[_0x06e4('0x27')](saveUpdates(_0x53c005[_0x06e4('0x47')],null))['then'](respondWithResult(_0x30e465,null))['catch'](handleError(_0x30e465,null));};exports[_0x06e4('0x28')]=function(_0x5e9d18,_0xcf6de4){return db[_0x06e4('0x2e')]['find']({'where':{'id':_0x5e9d18[_0x06e4('0x48')]['id']}})[_0x06e4('0x27')](handleEntityNotFound(_0xcf6de4,null))['then'](removeEntity(_0xcf6de4,null))[_0x06e4('0x44')](handleError(_0xcf6de4,null));};exports[_0x06e4('0x49')]=function(_0x283777,_0x6e3bcb,_0x44f576){var _0x1d230a={};var _0x26ebbf={};var _0x5a097d;var _0x40e2b6;return db[_0x06e4('0x2e')]['findOne']({'where':{'id':_0x283777[_0x06e4('0x48')]['id']}})[_0x06e4('0x27')](handleEntityNotFound(_0x6e3bcb,null))[_0x06e4('0x27')](function(_0x2efb64){if(_0x2efb64){_0x5a097d=_0x2efb64;_0x26ebbf['model']=_[_0x06e4('0x33')](db[_0x06e4('0x4a')][_0x06e4('0x2f')]);_0x26ebbf[_0x06e4('0x32')]=_[_0x06e4('0x33')](_0x283777[_0x06e4('0x32')]);_0x26ebbf[_0x06e4('0x34')]=_[_0x06e4('0x36')](_0x26ebbf['model'],_0x26ebbf[_0x06e4('0x32')]);_0x1d230a[_0x06e4('0x35')]=_[_0x06e4('0x36')](_0x26ebbf['model'],qs[_0x06e4('0x37')](_0x283777['query']['fields']));_0x1d230a['attributes']=_0x1d230a[_0x06e4('0x35')]['length']?_0x1d230a[_0x06e4('0x35')]:_0x26ebbf[_0x06e4('0x31')];_0x1d230a['order']=qs['sort'](_0x283777[_0x06e4('0x32')][_0x06e4('0x3c')]);_0x1d230a[_0x06e4('0x3d')]=qs[_0x06e4('0x34')](_[_0x06e4('0x4b')](_0x283777[_0x06e4('0x32')],_0x26ebbf[_0x06e4('0x34')]));if(_0x283777['query'][_0x06e4('0x4c')]){_0x1d230a[_0x06e4('0x3d')]=_[_0x06e4('0x3e')](_0x1d230a['where'],{'$or':_[_0x06e4('0x2d')](_0x1d230a['attributes'],function(_0x23cad5){var _0x1446f5={};_0x1446f5[_0x23cad5]={'$like':'%'+_0x283777['query'][_0x06e4('0x4c')]+'%'};return _0x1446f5;})});}_0x1d230a=_[_0x06e4('0x3e')]({},_0x1d230a,_0x283777[_0x06e4('0x4d')]);return _0x5a097d[_0x06e4('0x49')](_0x1d230a);}})[_0x06e4('0x27')](function(_0x3d7c5e){if(_0x3d7c5e){_0x40e2b6=_0x3d7c5e[_0x06e4('0x38')];if(!_0x283777[_0x06e4('0x32')]['hasOwnProperty']('nolimit')){_0x1d230a[_0x06e4('0x1f')]=qs[_0x06e4('0x1f')](_0x283777[_0x06e4('0x32')][_0x06e4('0x1f')]);_0x1d230a[_0x06e4('0x20')]=qs[_0x06e4('0x20')](_0x283777[_0x06e4('0x32')][_0x06e4('0x20')]);}return _0x5a097d[_0x06e4('0x49')](_0x1d230a);}})[_0x06e4('0x27')](function(_0x248915){if(_0x248915){return _0x248915?{'count':_0x40e2b6,'rows':_0x248915}:null;}})['then'](respondWithResult(_0x6e3bcb,null))[_0x06e4('0x44')](handleError(_0x6e3bcb,null));};exports[_0x06e4('0x4e')]=function(_0x409d91,_0x47da57,_0x31a7c7){var _0x1ad0bf={};var _0x37cd93={};var _0x5192d2;var _0x5aa6b4;return db[_0x06e4('0x2e')][_0x06e4('0x4f')]({'where':{'id':_0x409d91[_0x06e4('0x48')]['id']}})['then'](handleEntityNotFound(_0x47da57,null))[_0x06e4('0x27')](function(_0x33e1a6){if(_0x33e1a6){_0x5192d2=_0x33e1a6;_0x37cd93[_0x06e4('0x31')]=_[_0x06e4('0x33')](db[_0x06e4('0x4a')][_0x06e4('0x2f')]);_0x37cd93['query']=_[_0x06e4('0x33')](_0x409d91[_0x06e4('0x32')]);_0x37cd93[_0x06e4('0x34')]=_[_0x06e4('0x36')](_0x37cd93[_0x06e4('0x31')],_0x37cd93[_0x06e4('0x32')]);_0x1ad0bf[_0x06e4('0x35')]=_[_0x06e4('0x36')](_0x37cd93[_0x06e4('0x31')],qs[_0x06e4('0x37')](_0x409d91[_0x06e4('0x32')]['fields']));_0x1ad0bf[_0x06e4('0x35')]=_0x1ad0bf['attributes'][_0x06e4('0x38')]?_0x1ad0bf[_0x06e4('0x35')]:_0x37cd93[_0x06e4('0x31')];_0x1ad0bf[_0x06e4('0x3b')]=qs[_0x06e4('0x3c')](_0x409d91['query'][_0x06e4('0x3c')]);_0x1ad0bf[_0x06e4('0x3d')]=qs[_0x06e4('0x34')](_[_0x06e4('0x4b')](_0x409d91[_0x06e4('0x32')],_0x37cd93[_0x06e4('0x34')]));if(_0x409d91['query'][_0x06e4('0x4c')]){_0x1ad0bf[_0x06e4('0x3d')]=_['merge'](_0x1ad0bf[_0x06e4('0x3d')],{'$or':_[_0x06e4('0x2d')](_0x1ad0bf[_0x06e4('0x35')],function(_0x333704){var _0x5f0409={};_0x5f0409[_0x333704]={'$like':'%'+_0x409d91[_0x06e4('0x32')][_0x06e4('0x4c')]+'%'};return _0x5f0409;})});}_0x1ad0bf=_['merge']({},_0x1ad0bf,_0x409d91[_0x06e4('0x4d')]);return _0x5192d2[_0x06e4('0x4e')](_0x1ad0bf);}})[_0x06e4('0x27')](function(_0x3abcdb){if(_0x3abcdb){_0x5aa6b4=_0x3abcdb['length'];if(!_0x409d91[_0x06e4('0x32')][_0x06e4('0x39')]('nolimit')){_0x1ad0bf[_0x06e4('0x1f')]=qs[_0x06e4('0x1f')](_0x409d91[_0x06e4('0x32')][_0x06e4('0x1f')]);_0x1ad0bf[_0x06e4('0x20')]=qs[_0x06e4('0x20')](_0x409d91[_0x06e4('0x32')][_0x06e4('0x20')]);}return _0x5192d2[_0x06e4('0x4e')](_0x1ad0bf);}})[_0x06e4('0x27')](function(_0x3b4f29){if(_0x3b4f29){return _0x3b4f29?{'count':_0x5aa6b4,'rows':_0x3b4f29}:null;}})['then'](respondWithResult(_0x47da57,null))[_0x06e4('0x44')](handleError(_0x47da57,null));};exports[_0x06e4('0x50')]=function(_0x44153a,_0x510686,_0x57f54a){var _0x2ec8bc={};var _0xc17679={};var _0x4d6f0d;var _0x2bd57c;return db['ServicenowConfiguration'][_0x06e4('0x4f')]({'where':{'id':_0x44153a['params']['id']}})[_0x06e4('0x27')](handleEntityNotFound(_0x510686,null))[_0x06e4('0x27')](function(_0x16c25d){if(_0x16c25d){_0x4d6f0d=_0x16c25d;_0xc17679[_0x06e4('0x31')]=_[_0x06e4('0x33')](db[_0x06e4('0x4a')][_0x06e4('0x2f')]);_0xc17679[_0x06e4('0x32')]=_[_0x06e4('0x33')](_0x44153a['query']);_0xc17679[_0x06e4('0x34')]=_['intersection'](_0xc17679[_0x06e4('0x31')],_0xc17679['query']);_0x2ec8bc[_0x06e4('0x35')]=_['intersection'](_0xc17679[_0x06e4('0x31')],qs[_0x06e4('0x37')](_0x44153a[_0x06e4('0x32')][_0x06e4('0x37')]));_0x2ec8bc['attributes']=_0x2ec8bc['attributes'][_0x06e4('0x38')]?_0x2ec8bc['attributes']:_0xc17679[_0x06e4('0x31')];_0x2ec8bc[_0x06e4('0x3b')]=qs[_0x06e4('0x3c')](_0x44153a[_0x06e4('0x32')][_0x06e4('0x3c')]);_0x2ec8bc[_0x06e4('0x3d')]=qs['filters'](_[_0x06e4('0x4b')](_0x44153a[_0x06e4('0x32')],_0xc17679[_0x06e4('0x34')]));if(_0x44153a[_0x06e4('0x32')][_0x06e4('0x4c')]){_0x2ec8bc[_0x06e4('0x3d')]=_[_0x06e4('0x3e')](_0x2ec8bc[_0x06e4('0x3d')],{'$or':_['map'](_0x2ec8bc['attributes'],function(_0x3c3241){var _0x6ec43c={};_0x6ec43c[_0x3c3241]={'$like':'%'+_0x44153a[_0x06e4('0x32')][_0x06e4('0x4c')]+'%'};return _0x6ec43c;})});}_0x2ec8bc=_[_0x06e4('0x3e')]({},_0x2ec8bc,_0x44153a[_0x06e4('0x4d')]);return _0x4d6f0d[_0x06e4('0x50')](_0x2ec8bc);}})[_0x06e4('0x27')](function(_0x57d7bb){if(_0x57d7bb){_0x2bd57c=_0x57d7bb[_0x06e4('0x38')];if(!_0x44153a[_0x06e4('0x32')]['hasOwnProperty'](_0x06e4('0x3a'))){_0x2ec8bc[_0x06e4('0x1f')]=qs[_0x06e4('0x1f')](_0x44153a[_0x06e4('0x32')][_0x06e4('0x1f')]);_0x2ec8bc[_0x06e4('0x20')]=qs['offset'](_0x44153a[_0x06e4('0x32')][_0x06e4('0x20')]);}return _0x4d6f0d[_0x06e4('0x50')](_0x2ec8bc);}})[_0x06e4('0x27')](function(_0x5c09ef){if(_0x5c09ef){return _0x5c09ef?{'count':_0x2bd57c,'rows':_0x5c09ef}:null;}})[_0x06e4('0x27')](respondWithResult(_0x510686,null))[_0x06e4('0x44')](handleError(_0x510686,null));}; \ No newline at end of file +var _0x2ddb=['moment','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','update','destroy','then','error','send','index','map','ServicenowConfiguration','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','getFields','findOne','ServicenowField','order','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x42a0e3,_0xe053a6){var _0x59e02e=function(_0x47f082){while(--_0x47f082){_0x42a0e3['push'](_0x42a0e3['shift']());}};_0x59e02e(++_0xe053a6);}(_0x2ddb,0xee));var _0xb2dd=function(_0x8eb04f,_0x3fa06c){_0x8eb04f=_0x8eb04f-0x0;var _0x19811a=_0x2ddb[_0x8eb04f];return _0x19811a;};'use strict';var emlformat=require(_0xb2dd('0x0'));var rimraf=require(_0xb2dd('0x1'));var zipdir=require(_0xb2dd('0x2'));var jsonpatch=require(_0xb2dd('0x3'));var rp=require(_0xb2dd('0x4'));var moment=require(_0xb2dd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb2dd('0x6'));var util=require('util');var path=require(_0xb2dd('0x7'));var sox=require(_0xb2dd('0x8'));var csv=require('to-csv');var ejs=require(_0xb2dd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2dd('0xa'));var squel=require('squel');var crypto=require(_0xb2dd('0xb'));var jsforce=require(_0xb2dd('0xc'));var deskjs=require(_0xb2dd('0xd'));var toCsv=require(_0xb2dd('0xe'));var querystring=require(_0xb2dd('0xf'));var Papa=require(_0xb2dd('0x10'));var Redis=require(_0xb2dd('0x11'));var authService=require(_0xb2dd('0x12'));var qs=require(_0xb2dd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2dd('0x14'));var logger=require(_0xb2dd('0x15'))(_0xb2dd('0x16'));var utils=require(_0xb2dd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb2dd('0x18'));var db=require(_0xb2dd('0x19'))['db'];function respondWithStatusCode(_0x235d88,_0x1302d6){_0x1302d6=_0x1302d6||0xcc;return function(_0x31430d){if(_0x31430d){return _0x235d88[_0xb2dd('0x1a')](_0x1302d6);}return _0x235d88[_0xb2dd('0x1b')](_0x1302d6)[_0xb2dd('0x1c')]();};}function respondWithResult(_0x5211b1,_0x2493b3){_0x2493b3=_0x2493b3||0xc8;return function(_0x5928ab){if(_0x5928ab){return _0x5211b1[_0xb2dd('0x1b')](_0x2493b3)[_0xb2dd('0x1d')](_0x5928ab);}};}function respondWithFilteredResult(_0x4f3ffb,_0x1fdb9b){return function(_0x3a2b73){if(_0x3a2b73){var _0x18fd65=typeof _0x1fdb9b[_0xb2dd('0x1e')]===_0xb2dd('0x1f')&&typeof _0x1fdb9b['limit']===_0xb2dd('0x1f');var _0x3886d0=_0x3a2b73[_0xb2dd('0x20')];var _0x41c1e3=_0x18fd65?0x0:_0x1fdb9b['offset'];var _0x50e24b=_0x18fd65?_0x3a2b73[_0xb2dd('0x20')]:_0x1fdb9b[_0xb2dd('0x1e')]+_0x1fdb9b['limit'];var _0x4c3c28;if(_0x50e24b>=_0x3886d0){_0x50e24b=_0x3886d0;_0x4c3c28=0xc8;}else{_0x4c3c28=0xce;}_0x4f3ffb[_0xb2dd('0x1b')](_0x4c3c28);return _0x4f3ffb[_0xb2dd('0x21')](_0xb2dd('0x22'),_0x41c1e3+'-'+_0x50e24b+'/'+_0x3886d0)['json'](_0x3a2b73);}return null;};}function patchUpdates(_0x20dc4b){return function(_0x1b2b38){try{jsonpatch[_0xb2dd('0x23')](_0x1b2b38,_0x20dc4b,!![]);}catch(_0x928527){return BPromise['reject'](_0x928527);}return _0x1b2b38['save']();};}function saveUpdates(_0x8fa619,_0x1f37ac){return function(_0x420e3a){if(_0x420e3a){return _0x420e3a[_0xb2dd('0x24')](_0x8fa619)['then'](function(_0x2fd324){return _0x2fd324;});}return null;};}function removeEntity(_0x275bbe,_0x315a5e){return function(_0x5e7d1c){if(_0x5e7d1c){return _0x5e7d1c[_0xb2dd('0x25')]()[_0xb2dd('0x26')](function(){_0x275bbe[_0xb2dd('0x1b')](0xcc)[_0xb2dd('0x1c')]();});}};}function handleEntityNotFound(_0x1bddb9,_0x55bc82){return function(_0x5988e1){if(!_0x5988e1){_0x1bddb9[_0xb2dd('0x1a')](0x194);}return _0x5988e1;};}function handleError(_0x4bd00b,_0x51a8f4){_0x51a8f4=_0x51a8f4||0x1f4;return function(_0x43cc88){logger[_0xb2dd('0x27')](_0x43cc88['stack']);if(_0x43cc88['name']){delete _0x43cc88['name'];}_0x4bd00b[_0xb2dd('0x1b')](_0x51a8f4)[_0xb2dd('0x28')](_0x43cc88);};}exports[_0xb2dd('0x29')]=function(_0x2b76ac,_0x240ec2){var _0x788f97={},_0xf19b65={},_0x147d5b={'count':0x0,'rows':[]};var _0x4f7a4d=_[_0xb2dd('0x2a')](db[_0xb2dd('0x2b')]['rawAttributes'],function(_0xd34f22){return{'name':_0xd34f22[_0xb2dd('0x2c')],'type':_0xd34f22[_0xb2dd('0x2d')]['key']};});_0xf19b65[_0xb2dd('0x2e')]=_[_0xb2dd('0x2a')](_0x4f7a4d,'name');_0xf19b65[_0xb2dd('0x2f')]=_[_0xb2dd('0x30')](_0x2b76ac[_0xb2dd('0x2f')]);_0xf19b65['filters']=_[_0xb2dd('0x31')](_0xf19b65[_0xb2dd('0x2e')],_0xf19b65['query']);_0x788f97[_0xb2dd('0x32')]=_['intersection'](_0xf19b65[_0xb2dd('0x2e')],qs[_0xb2dd('0x33')](_0x2b76ac['query'][_0xb2dd('0x33')]));_0x788f97['attributes']=_0x788f97[_0xb2dd('0x32')][_0xb2dd('0x34')]?_0x788f97['attributes']:_0xf19b65['model'];if(!_0x2b76ac[_0xb2dd('0x2f')][_0xb2dd('0x35')](_0xb2dd('0x36'))){_0x788f97['limit']=qs[_0xb2dd('0x37')](_0x2b76ac[_0xb2dd('0x2f')][_0xb2dd('0x37')]);_0x788f97[_0xb2dd('0x1e')]=qs[_0xb2dd('0x1e')](_0x2b76ac[_0xb2dd('0x2f')][_0xb2dd('0x1e')]);}_0x788f97['order']=qs['sort'](_0x2b76ac[_0xb2dd('0x2f')][_0xb2dd('0x38')]);_0x788f97['where']=qs[_0xb2dd('0x39')](_[_0xb2dd('0x3a')](_0x2b76ac[_0xb2dd('0x2f')],_0xf19b65[_0xb2dd('0x39')]),_0x4f7a4d);if(_0x2b76ac[_0xb2dd('0x2f')][_0xb2dd('0x3b')]){_0x788f97[_0xb2dd('0x3c')]=_[_0xb2dd('0x3d')](_0x788f97[_0xb2dd('0x3c')],{'$or':_['map'](_0x4f7a4d,function(_0x70ccc){if(_0x70ccc[_0xb2dd('0x2d')]!==_0xb2dd('0x3e')){var _0x5630b1={};_0x5630b1[_0x70ccc[_0xb2dd('0x3f')]]={'$like':'%'+_0x2b76ac[_0xb2dd('0x2f')]['filter']+'%'};return _0x5630b1;}})});}_0x788f97=_[_0xb2dd('0x3d')]({},_0x788f97,_0x2b76ac['options']);var _0x2ca0c6={'where':_0x788f97[_0xb2dd('0x3c')]};return db[_0xb2dd('0x2b')][_0xb2dd('0x20')](_0x2ca0c6)['then'](function(_0xc7d51f){_0x147d5b[_0xb2dd('0x20')]=_0xc7d51f;if(_0x2b76ac[_0xb2dd('0x2f')][_0xb2dd('0x40')]){_0x788f97[_0xb2dd('0x41')]=[{'all':!![]}];}return db[_0xb2dd('0x2b')][_0xb2dd('0x42')](_0x788f97);})[_0xb2dd('0x26')](function(_0x5277fb){_0x147d5b[_0xb2dd('0x43')]=_0x5277fb;return _0x147d5b;})['then'](respondWithFilteredResult(_0x240ec2,_0x788f97))[_0xb2dd('0x44')](handleError(_0x240ec2,null));};exports['show']=function(_0x136c3f,_0x324453){var _0x39d1e1={'raw':![],'where':{'id':_0x136c3f['params']['id']}},_0x27c9c9={};_0x27c9c9['model']=_[_0xb2dd('0x30')](db['ServicenowConfiguration'][_0xb2dd('0x45')]);_0x27c9c9[_0xb2dd('0x2f')]=_[_0xb2dd('0x30')](_0x136c3f[_0xb2dd('0x2f')]);_0x27c9c9[_0xb2dd('0x39')]=_[_0xb2dd('0x31')](_0x27c9c9[_0xb2dd('0x2e')],_0x27c9c9[_0xb2dd('0x2f')]);_0x39d1e1['attributes']=_[_0xb2dd('0x31')](_0x27c9c9[_0xb2dd('0x2e')],qs['fields'](_0x136c3f[_0xb2dd('0x2f')][_0xb2dd('0x33')]));_0x39d1e1[_0xb2dd('0x32')]=_0x39d1e1['attributes'][_0xb2dd('0x34')]?_0x39d1e1[_0xb2dd('0x32')]:_0x27c9c9[_0xb2dd('0x2e')];if(_0x136c3f[_0xb2dd('0x2f')][_0xb2dd('0x40')]){_0x39d1e1[_0xb2dd('0x41')]=[{'all':!![]}];}_0x39d1e1=_['merge']({},_0x39d1e1,_0x136c3f['options']);return db[_0xb2dd('0x2b')][_0xb2dd('0x46')](_0x39d1e1)[_0xb2dd('0x26')](handleEntityNotFound(_0x324453,null))['then'](respondWithResult(_0x324453,null))[_0xb2dd('0x44')](handleError(_0x324453,null));};exports[_0xb2dd('0x47')]=function(_0x140458,_0xe7c4c){return db[_0xb2dd('0x2b')][_0xb2dd('0x47')](_0x140458[_0xb2dd('0x48')],{})['then'](respondWithResult(_0xe7c4c,0xc9))['catch'](handleError(_0xe7c4c,null));};exports[_0xb2dd('0x24')]=function(_0x82f517,_0x64c7f2){if(_0x82f517['body']['id']){delete _0x82f517[_0xb2dd('0x48')]['id'];}return db['ServicenowConfiguration'][_0xb2dd('0x46')]({'where':{'id':_0x82f517[_0xb2dd('0x49')]['id']}})[_0xb2dd('0x26')](handleEntityNotFound(_0x64c7f2,null))[_0xb2dd('0x26')](saveUpdates(_0x82f517[_0xb2dd('0x48')],null))['then'](respondWithResult(_0x64c7f2,null))[_0xb2dd('0x44')](handleError(_0x64c7f2,null));};exports['destroy']=function(_0x187480,_0x1f9f32){return db[_0xb2dd('0x2b')][_0xb2dd('0x46')]({'where':{'id':_0x187480[_0xb2dd('0x49')]['id']}})[_0xb2dd('0x26')](handleEntityNotFound(_0x1f9f32,null))[_0xb2dd('0x26')](removeEntity(_0x1f9f32,null))['catch'](handleError(_0x1f9f32,null));};exports[_0xb2dd('0x4a')]=function(_0x48b393,_0x387dba,_0x54e154){var _0x46c151={};var _0xfb9152={};var _0x2a0396;var _0x4ea283;return db[_0xb2dd('0x2b')][_0xb2dd('0x4b')]({'where':{'id':_0x48b393[_0xb2dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x387dba,null))['then'](function(_0x1eed89){if(_0x1eed89){_0x2a0396=_0x1eed89;_0xfb9152[_0xb2dd('0x2e')]=_[_0xb2dd('0x30')](db[_0xb2dd('0x4c')][_0xb2dd('0x45')]);_0xfb9152[_0xb2dd('0x2f')]=_['keys'](_0x48b393[_0xb2dd('0x2f')]);_0xfb9152['filters']=_[_0xb2dd('0x31')](_0xfb9152[_0xb2dd('0x2e')],_0xfb9152['query']);_0x46c151[_0xb2dd('0x32')]=_[_0xb2dd('0x31')](_0xfb9152[_0xb2dd('0x2e')],qs['fields'](_0x48b393[_0xb2dd('0x2f')][_0xb2dd('0x33')]));_0x46c151[_0xb2dd('0x32')]=_0x46c151[_0xb2dd('0x32')][_0xb2dd('0x34')]?_0x46c151[_0xb2dd('0x32')]:_0xfb9152[_0xb2dd('0x2e')];_0x46c151[_0xb2dd('0x4d')]=qs[_0xb2dd('0x38')](_0x48b393[_0xb2dd('0x2f')][_0xb2dd('0x38')]);_0x46c151[_0xb2dd('0x3c')]=qs[_0xb2dd('0x39')](_[_0xb2dd('0x3a')](_0x48b393[_0xb2dd('0x2f')],_0xfb9152['filters']));if(_0x48b393['query'][_0xb2dd('0x3b')]){_0x46c151[_0xb2dd('0x3c')]=_[_0xb2dd('0x3d')](_0x46c151[_0xb2dd('0x3c')],{'$or':_[_0xb2dd('0x2a')](_0x46c151['attributes'],function(_0x18e16f){var _0x2b8599={};_0x2b8599[_0x18e16f]={'$like':'%'+_0x48b393['query'][_0xb2dd('0x3b')]+'%'};return _0x2b8599;})});}_0x46c151=_[_0xb2dd('0x3d')]({},_0x46c151,_0x48b393[_0xb2dd('0x4e')]);return _0x2a0396[_0xb2dd('0x4a')](_0x46c151);}})[_0xb2dd('0x26')](function(_0x3aada7){if(_0x3aada7){_0x4ea283=_0x3aada7[_0xb2dd('0x34')];if(!_0x48b393[_0xb2dd('0x2f')]['hasOwnProperty'](_0xb2dd('0x36'))){_0x46c151[_0xb2dd('0x37')]=qs[_0xb2dd('0x37')](_0x48b393[_0xb2dd('0x2f')][_0xb2dd('0x37')]);_0x46c151['offset']=qs[_0xb2dd('0x1e')](_0x48b393['query'][_0xb2dd('0x1e')]);}return _0x2a0396[_0xb2dd('0x4a')](_0x46c151);}})[_0xb2dd('0x26')](function(_0x4cd624){if(_0x4cd624){return _0x4cd624?{'count':_0x4ea283,'rows':_0x4cd624}:null;}})[_0xb2dd('0x26')](respondWithResult(_0x387dba,null))['catch'](handleError(_0x387dba,null));};exports[_0xb2dd('0x4f')]=function(_0x1d4fd3,_0x59a638,_0x3a6cba){var _0x1640cb={};var _0x324fd8={};var _0x4585c6;var _0x47a5e1;return db[_0xb2dd('0x2b')][_0xb2dd('0x4b')]({'where':{'id':_0x1d4fd3[_0xb2dd('0x49')]['id']}})[_0xb2dd('0x26')](handleEntityNotFound(_0x59a638,null))['then'](function(_0x33ea10){if(_0x33ea10){_0x4585c6=_0x33ea10;_0x324fd8[_0xb2dd('0x2e')]=_[_0xb2dd('0x30')](db['ServicenowField']['rawAttributes']);_0x324fd8[_0xb2dd('0x2f')]=_[_0xb2dd('0x30')](_0x1d4fd3['query']);_0x324fd8[_0xb2dd('0x39')]=_[_0xb2dd('0x31')](_0x324fd8['model'],_0x324fd8['query']);_0x1640cb[_0xb2dd('0x32')]=_[_0xb2dd('0x31')](_0x324fd8['model'],qs['fields'](_0x1d4fd3[_0xb2dd('0x2f')][_0xb2dd('0x33')]));_0x1640cb[_0xb2dd('0x32')]=_0x1640cb[_0xb2dd('0x32')]['length']?_0x1640cb[_0xb2dd('0x32')]:_0x324fd8[_0xb2dd('0x2e')];_0x1640cb[_0xb2dd('0x4d')]=qs[_0xb2dd('0x38')](_0x1d4fd3[_0xb2dd('0x2f')][_0xb2dd('0x38')]);_0x1640cb[_0xb2dd('0x3c')]=qs['filters'](_[_0xb2dd('0x3a')](_0x1d4fd3[_0xb2dd('0x2f')],_0x324fd8[_0xb2dd('0x39')]));if(_0x1d4fd3[_0xb2dd('0x2f')][_0xb2dd('0x3b')]){_0x1640cb[_0xb2dd('0x3c')]=_['merge'](_0x1640cb['where'],{'$or':_[_0xb2dd('0x2a')](_0x1640cb[_0xb2dd('0x32')],function(_0x464ebf){var _0x4ea69c={};_0x4ea69c[_0x464ebf]={'$like':'%'+_0x1d4fd3[_0xb2dd('0x2f')]['filter']+'%'};return _0x4ea69c;})});}_0x1640cb=_[_0xb2dd('0x3d')]({},_0x1640cb,_0x1d4fd3[_0xb2dd('0x4e')]);return _0x4585c6['getSubjects'](_0x1640cb);}})[_0xb2dd('0x26')](function(_0x51d094){if(_0x51d094){_0x47a5e1=_0x51d094[_0xb2dd('0x34')];if(!_0x1d4fd3[_0xb2dd('0x2f')][_0xb2dd('0x35')](_0xb2dd('0x36'))){_0x1640cb[_0xb2dd('0x37')]=qs[_0xb2dd('0x37')](_0x1d4fd3[_0xb2dd('0x2f')][_0xb2dd('0x37')]);_0x1640cb[_0xb2dd('0x1e')]=qs['offset'](_0x1d4fd3['query'][_0xb2dd('0x1e')]);}return _0x4585c6[_0xb2dd('0x4f')](_0x1640cb);}})[_0xb2dd('0x26')](function(_0x2bc2e8){if(_0x2bc2e8){return _0x2bc2e8?{'count':_0x47a5e1,'rows':_0x2bc2e8}:null;}})[_0xb2dd('0x26')](respondWithResult(_0x59a638,null))[_0xb2dd('0x44')](handleError(_0x59a638,null));};exports[_0xb2dd('0x50')]=function(_0x109075,_0x43731e,_0x3f3ba4){var _0x5cb222={};var _0x438632={};var _0x355832;var _0x8dc2b6;return db[_0xb2dd('0x2b')][_0xb2dd('0x4b')]({'where':{'id':_0x109075['params']['id']}})['then'](handleEntityNotFound(_0x43731e,null))[_0xb2dd('0x26')](function(_0x1d2a83){if(_0x1d2a83){_0x355832=_0x1d2a83;_0x438632[_0xb2dd('0x2e')]=_[_0xb2dd('0x30')](db[_0xb2dd('0x4c')]['rawAttributes']);_0x438632[_0xb2dd('0x2f')]=_['keys'](_0x109075[_0xb2dd('0x2f')]);_0x438632[_0xb2dd('0x39')]=_[_0xb2dd('0x31')](_0x438632['model'],_0x438632['query']);_0x5cb222['attributes']=_[_0xb2dd('0x31')](_0x438632['model'],qs[_0xb2dd('0x33')](_0x109075[_0xb2dd('0x2f')][_0xb2dd('0x33')]));_0x5cb222['attributes']=_0x5cb222[_0xb2dd('0x32')][_0xb2dd('0x34')]?_0x5cb222[_0xb2dd('0x32')]:_0x438632[_0xb2dd('0x2e')];_0x5cb222[_0xb2dd('0x4d')]=qs[_0xb2dd('0x38')](_0x109075[_0xb2dd('0x2f')][_0xb2dd('0x38')]);_0x5cb222[_0xb2dd('0x3c')]=qs[_0xb2dd('0x39')](_['pick'](_0x109075[_0xb2dd('0x2f')],_0x438632[_0xb2dd('0x39')]));if(_0x109075[_0xb2dd('0x2f')][_0xb2dd('0x3b')]){_0x5cb222[_0xb2dd('0x3c')]=_[_0xb2dd('0x3d')](_0x5cb222[_0xb2dd('0x3c')],{'$or':_[_0xb2dd('0x2a')](_0x5cb222['attributes'],function(_0x50f81e){var _0x1e6b2c={};_0x1e6b2c[_0x50f81e]={'$like':'%'+_0x109075['query']['filter']+'%'};return _0x1e6b2c;})});}_0x5cb222=_[_0xb2dd('0x3d')]({},_0x5cb222,_0x109075[_0xb2dd('0x4e')]);return _0x355832['getDescriptions'](_0x5cb222);}})[_0xb2dd('0x26')](function(_0xc7986a){if(_0xc7986a){_0x8dc2b6=_0xc7986a[_0xb2dd('0x34')];if(!_0x109075[_0xb2dd('0x2f')][_0xb2dd('0x35')](_0xb2dd('0x36'))){_0x5cb222[_0xb2dd('0x37')]=qs['limit'](_0x109075[_0xb2dd('0x2f')][_0xb2dd('0x37')]);_0x5cb222[_0xb2dd('0x1e')]=qs['offset'](_0x109075['query']['offset']);}return _0x355832['getDescriptions'](_0x5cb222);}})[_0xb2dd('0x26')](function(_0x1cd0f8){if(_0x1cd0f8){return _0x1cd0f8?{'count':_0x8dc2b6,'rows':_0x1cd0f8}:null;}})[_0xb2dd('0x26')](respondWithResult(_0x43731e,null))['catch'](handleError(_0x43731e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 17ec11f..5ded1d7 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 _0xbd20=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x8bb60e,_0x315c7f){var _0x19f004=function(_0x332ad8){while(--_0x332ad8){_0x8bb60e['push'](_0x8bb60e['shift']());}};_0x19f004(++_0x315c7f);}(_0xbd20,0x14a));var _0x0bd2=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xbd20[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0x0bd2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0bd2('0x1'));var moment=require(_0x0bd2('0x2'));var BPromise=require(_0x0bd2('0x3'));var rp=require(_0x0bd2('0x4'));var fs=require('fs');var path=require(_0x0bd2('0x5'));var rimraf=require('rimraf');var config=require(_0x0bd2('0x6'));var attributes=require(_0x0bd2('0x7'));module[_0x0bd2('0x8')]=function(_0x550f03,_0xe39613){return _0x550f03[_0x0bd2('0x9')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c11=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util'];(function(_0x630075,_0x3d1f6b){var _0x13ba83=function(_0x4e3206){while(--_0x4e3206){_0x630075['push'](_0x630075['shift']());}};_0x13ba83(++_0x3d1f6b);}(_0x8c11,0xf5));var _0x18c1=function(_0x3ca4d3,_0x3efecb){_0x3ca4d3=_0x3ca4d3-0x0;var _0xc4e032=_0x8c11[_0x3ca4d3];return _0xc4e032;};'use strict';var _=require(_0x18c1('0x0'));var util=require(_0x18c1('0x1'));var logger=require(_0x18c1('0x2'))(_0x18c1('0x3'));var moment=require(_0x18c1('0x4'));var BPromise=require(_0x18c1('0x5'));var rp=require(_0x18c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18c1('0x7'));var config=require(_0x18c1('0x8'));var attributes=require(_0x18c1('0x9'));module[_0x18c1('0xa')]=function(_0x1264cd,_0x12aa20){return _0x1264cd[_0x18c1('0xb')](_0x18c1('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index b73f2e7..a7d6f71 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 _0xa71f=['code','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xc95fe9,_0x36bcb1){var _0x3761dd=function(_0x574a8c){while(--_0x574a8c){_0xc95fe9['push'](_0xc95fe9['shift']());}};_0x3761dd(++_0x36bcb1);}(_0xa71f,0x166));var _0xfa71=function(_0x2182f3,_0x16b424){_0x2182f3=_0x2182f3-0x0;var _0x402151=_0xa71f[_0x2182f3];return _0x402151;};'use strict';var _=require('lodash');var util=require(_0xfa71('0x0'));var moment=require(_0xfa71('0x1'));var BPromise=require(_0xfa71('0x2'));var rs=require(_0xfa71('0x3'));var fs=require('fs');var Redis=require(_0xfa71('0x4'));var db=require(_0xfa71('0x5'))['db'];var utils=require(_0xfa71('0x6'));var logger=require(_0xfa71('0x7'))(_0xfa71('0x8'));var config=require(_0xfa71('0x9'));var jayson=require(_0xfa71('0xa'));var client=jayson['client'][_0xfa71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a43d,_0x35406b,_0x145a6d){return new BPromise(function(_0x4ad155,_0x5e1f3d){return client[_0xfa71('0xc')](_0x22a43d,_0x145a6d)['then'](function(_0x3e627e){logger['info'](_0xfa71('0xd'),_0x35406b,_0xfa71('0xe'));logger['debug'](_0xfa71('0xf'),_0x35406b,_0xfa71('0xe'),JSON['stringify'](_0x3e627e));if(_0x3e627e['error']){if(_0x3e627e['error'][_0xfa71('0x10')]===0x1f4){logger[_0xfa71('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35406b,_0x3e627e['error'][_0xfa71('0x12')]);return _0x5e1f3d(_0x3e627e[_0xfa71('0x11')][_0xfa71('0x12')]);}logger[_0xfa71('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35406b,_0x3e627e[_0xfa71('0x11')][_0xfa71('0x12')]);return _0x4ad155(_0x3e627e[_0xfa71('0x11')][_0xfa71('0x12')]);}else{logger[_0xfa71('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35406b,_0xfa71('0xe'));_0x4ad155(_0x3e627e[_0xfa71('0x14')][_0xfa71('0x12')]);}})[_0xfa71('0x15')](function(_0x4fc4fb){logger[_0xfa71('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35406b,_0x4fc4fb);_0x5e1f3d(_0x4fc4fb);});});} \ No newline at end of file +var _0xcd6e=['request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x3ab36b,_0x58fba7){var _0x9b3171=function(_0x4cafe4){while(--_0x4cafe4){_0x3ab36b['push'](_0x3ab36b['shift']());}};_0x9b3171(++_0x58fba7);}(_0xcd6e,0xa8));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xecd6('0x0'));var util=require(_0xecd6('0x1'));var moment=require(_0xecd6('0x2'));var BPromise=require('bluebird');var rs=require(_0xecd6('0x3'));var fs=require('fs');var Redis=require(_0xecd6('0x4'));var db=require(_0xecd6('0x5'))['db'];var utils=require(_0xecd6('0x6'));var logger=require('../../config/logger')(_0xecd6('0x7'));var config=require(_0xecd6('0x8'));var jayson=require(_0xecd6('0x9'));var client=jayson[_0xecd6('0xa')][_0xecd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bee95,_0x3d1c1,_0x10697f){return new BPromise(function(_0x124e69,_0x1911af){return client[_0xecd6('0xc')](_0x1bee95,_0x10697f)[_0xecd6('0xd')](function(_0x16d97a){logger[_0xecd6('0xe')](_0xecd6('0xf'),_0x3d1c1,_0xecd6('0x10'));logger[_0xecd6('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3d1c1,_0xecd6('0x10'),JSON['stringify'](_0x16d97a));if(_0x16d97a[_0xecd6('0x12')]){if(_0x16d97a[_0xecd6('0x12')][_0xecd6('0x13')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x3d1c1,_0x16d97a[_0xecd6('0x12')][_0xecd6('0x14')]);return _0x1911af(_0x16d97a[_0xecd6('0x12')][_0xecd6('0x14')]);}logger[_0xecd6('0x12')](_0xecd6('0xf'),_0x3d1c1,_0x16d97a[_0xecd6('0x12')][_0xecd6('0x14')]);return _0x124e69(_0x16d97a['error'][_0xecd6('0x14')]);}else{logger[_0xecd6('0xe')](_0xecd6('0xf'),_0x3d1c1,_0xecd6('0x10'));_0x124e69(_0x16d97a[_0xecd6('0x15')]['message']);}})[_0xecd6('0x16')](function(_0x4019bb){logger[_0xecd6('0x12')](_0xecd6('0xf'),_0x3d1c1,_0x4019bb);_0x1911af(_0x4019bb);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a5815dd..8b4e84a 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 _0x54df=['../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x218168,_0x10d378){var _0x4dcc0c=function(_0x3ce091){while(--_0x3ce091){_0x218168['push'](_0x218168['shift']());}};_0x4dcc0c(++_0x10d378);}(_0x54df,0x1d6));var _0xf54d=function(_0x2668c2,_0x2340a9){_0x2668c2=_0x2668c2-0x0;var _0x4d2de6=_0x54df[_0x2668c2];return _0x4d2de6;};'use strict';var multer=require('multer');var util=require(_0xf54d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf54d('0x1'));var router=express[_0xf54d('0x2')]();var fs_extra=require(_0xf54d('0x3'));var auth=require(_0xf54d('0x4'));var interaction=require(_0xf54d('0x5'));var config=require(_0xf54d('0x6'));var controller=require(_0xf54d('0x7'));router[_0xf54d('0x8')]('/',auth['isAuthenticated'](),controller[_0xf54d('0x9')]);router['get'](_0xf54d('0xa'),auth[_0xf54d('0xb')](),controller['show']);router['post']('/',auth[_0xf54d('0xb')](),controller[_0xf54d('0xc')]);router[_0xf54d('0xd')](_0xf54d('0xa'),auth[_0xf54d('0xb')](),controller[_0xf54d('0xe')]);router[_0xf54d('0xf')]('/:id',auth[_0xf54d('0xb')](),controller[_0xf54d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1fec=['delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','get','/:id','isAuthenticated','post','put'];(function(_0x4b2a5c,_0x29b5eb){var _0xed6e3c=function(_0x476514){while(--_0x476514){_0x4b2a5c['push'](_0x4b2a5c['shift']());}};_0xed6e3c(++_0x29b5eb);}(_0x1fec,0x1e8));var _0xc1fe=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x1fec[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0xc1fe('0x0'));var util=require(_0xc1fe('0x1'));var path=require(_0xc1fe('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1fe('0x3'));var router=express[_0xc1fe('0x4')]();var fs_extra=require(_0xc1fe('0x5'));var auth=require(_0xc1fe('0x6'));var interaction=require(_0xc1fe('0x7'));var config=require(_0xc1fe('0x8'));var controller=require(_0xc1fe('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1fe('0xa')]);router[_0xc1fe('0xb')](_0xc1fe('0xc'),auth[_0xc1fe('0xd')](),controller['show']);router[_0xc1fe('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc1fe('0xf')](_0xc1fe('0xc'),auth[_0xc1fe('0xd')](),controller['update']);router[_0xc1fe('0x10')](_0xc1fe('0xc'),auth[_0xc1fe('0xd')](),controller['destroy']);module[_0xc1fe('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c879874..ca4f5e4 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 _0xb4f1=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x568e29,_0x32b484){var _0xabeb67=function(_0x4b47fc){while(--_0x4b47fc){_0x568e29['push'](_0x568e29['shift']());}};_0xabeb67(++_0x32b484);}(_0xb4f1,0xc1));var _0x1b4f=function(_0x28de1d,_0x3a2fcf){_0x28de1d=_0x28de1d-0x0;var _0x3072d9=_0xb4f1[_0x28de1d];return _0x3072d9;};'use strict';var Sequelize=require(_0x1b4f('0x0'));module['exports']={'type':{'type':Sequelize[_0x1b4f('0x1')]('string',_0x1b4f('0x2'),_0x1b4f('0x3'),_0x1b4f('0x4'),'picklist'),'defaultValue':_0x1b4f('0x5')},'content':{'type':Sequelize[_0x1b4f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1b4f('0x1')](_0x1b4f('0x5'),_0x1b4f('0x2'),_0x1b4f('0x3'))},'keyContent':{'type':Sequelize[_0x1b4f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1b4f('0x6')]},'customField':{'type':Sequelize[_0x1b4f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b4f('0x6')]}}; \ No newline at end of file +var _0xa462=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x4ca889,_0x561d9e){var _0x5eb819=function(_0x53ddcd){while(--_0x53ddcd){_0x4ca889['push'](_0x4ca889['shift']());}};_0x5eb819(++_0x561d9e);}(_0xa462,0x131));var _0x2a46=function(_0x9065c7,_0x3ca8fc){_0x9065c7=_0x9065c7-0x0;var _0x16a968=_0xa462[_0x9065c7];return _0x16a968;};'use strict';var Sequelize=require('sequelize');module[_0x2a46('0x0')]={'type':{'type':Sequelize[_0x2a46('0x1')](_0x2a46('0x2'),_0x2a46('0x3'),_0x2a46('0x4'),_0x2a46('0x5'),_0x2a46('0x6')),'defaultValue':_0x2a46('0x2')},'content':{'type':Sequelize[_0x2a46('0x7')]},'key':{'type':Sequelize[_0x2a46('0x7')]},'keyType':{'type':Sequelize[_0x2a46('0x1')](_0x2a46('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x2a46('0x7')]},'idField':{'type':Sequelize[_0x2a46('0x7')]},'nameField':{'type':Sequelize[_0x2a46('0x7')]},'customField':{'type':Sequelize[_0x2a46('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a46('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 7b72c75..147ed03 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 _0xe9c4=['then','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','body','destroy','eml-format','rimraf','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','update'];(function(_0x5a11ad,_0x3323b1){var _0x5cf950=function(_0x3c0974){while(--_0x3c0974){_0x5a11ad['push'](_0x5a11ad['shift']());}};_0x5cf950(++_0x3323b1);}(_0xe9c4,0xb1));var _0x4e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4e9c('0x0'));var rimraf=require(_0x4e9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e9c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e9c('0x3'));var util=require(_0x4e9c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x4e9c('0x5'));var ejs=require(_0x4e9c('0x6'));var fs=require('fs');var fs_extra=require(_0x4e9c('0x7'));var _=require(_0x4e9c('0x8'));var squel=require(_0x4e9c('0x9'));var crypto=require(_0x4e9c('0xa'));var jsforce=require(_0x4e9c('0xb'));var deskjs=require(_0x4e9c('0xc'));var toCsv=require(_0x4e9c('0x5'));var querystring=require(_0x4e9c('0xd'));var Papa=require('papaparse');var Redis=require(_0x4e9c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4e9c('0xf'));var as=require(_0x4e9c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e9c('0x11'))('api');var utils=require(_0x4e9c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4e9c('0x13'));var db=require(_0x4e9c('0x14'))['db'];function respondWithStatusCode(_0x1cf97f,_0x3b2bd4){_0x3b2bd4=_0x3b2bd4||0xcc;return function(_0x379005){if(_0x379005){return _0x1cf97f[_0x4e9c('0x15')](_0x3b2bd4);}return _0x1cf97f['status'](_0x3b2bd4)[_0x4e9c('0x16')]();};}function respondWithResult(_0x3c395c,_0x60a163){_0x60a163=_0x60a163||0xc8;return function(_0x3dba60){if(_0x3dba60){return _0x3c395c[_0x4e9c('0x17')](_0x60a163)[_0x4e9c('0x18')](_0x3dba60);}};}function respondWithFilteredResult(_0x28af4c,_0x2c5658){return function(_0x6600e0){if(_0x6600e0){var _0x2b588e=typeof _0x2c5658['offset']==='undefined'&&typeof _0x2c5658[_0x4e9c('0x19')]==='undefined';var _0x4ecebf=_0x6600e0[_0x4e9c('0x1a')];var _0x333645=_0x2b588e?0x0:_0x2c5658[_0x4e9c('0x1b')];var _0x4c766f=_0x2b588e?_0x6600e0[_0x4e9c('0x1a')]:_0x2c5658[_0x4e9c('0x1b')]+_0x2c5658[_0x4e9c('0x19')];var _0x10a114;if(_0x4c766f>=_0x4ecebf){_0x4c766f=_0x4ecebf;_0x10a114=0xc8;}else{_0x10a114=0xce;}_0x28af4c[_0x4e9c('0x17')](_0x10a114);return _0x28af4c[_0x4e9c('0x1c')](_0x4e9c('0x1d'),_0x333645+'-'+_0x4c766f+'/'+_0x4ecebf)[_0x4e9c('0x18')](_0x6600e0);}return null;};}function patchUpdates(_0x2b1bc4){return function(_0x21cfbb){try{jsonpatch[_0x4e9c('0x1e')](_0x21cfbb,_0x2b1bc4,!![]);}catch(_0x14a52a){return BPromise[_0x4e9c('0x1f')](_0x14a52a);}return _0x21cfbb['save']();};}function saveUpdates(_0x5784f9,_0x324311){return function(_0x599211){if(_0x599211){return _0x599211[_0x4e9c('0x20')](_0x5784f9)[_0x4e9c('0x21')](function(_0x4c2684){return _0x4c2684;});}return null;};}function removeEntity(_0x14d273,_0x3c972e){return function(_0x1db210){if(_0x1db210){return _0x1db210['destroy']()[_0x4e9c('0x21')](function(){_0x14d273[_0x4e9c('0x17')](0xcc)[_0x4e9c('0x16')]();});}};}function handleEntityNotFound(_0x115b69,_0xb23853){return function(_0x3ebdc7){if(!_0x3ebdc7){_0x115b69[_0x4e9c('0x15')](0x194);}return _0x3ebdc7;};}function handleError(_0x34f50e,_0x1b9dc4){_0x1b9dc4=_0x1b9dc4||0x1f4;return function(_0x5f3766){logger[_0x4e9c('0x22')](_0x5f3766['stack']);if(_0x5f3766[_0x4e9c('0x23')]){delete _0x5f3766['name'];}_0x34f50e[_0x4e9c('0x17')](_0x1b9dc4)[_0x4e9c('0x24')](_0x5f3766);};}exports[_0x4e9c('0x25')]=function(_0x4304bf,_0x1a27f7){var _0x1d13b5={},_0x4d3c9d={},_0x2ca55b={'count':0x0,'rows':[]};var _0x397870=_[_0x4e9c('0x26')](db[_0x4e9c('0x27')][_0x4e9c('0x28')],function(_0x46e6c9){return{'name':_0x46e6c9[_0x4e9c('0x29')],'type':_0x46e6c9[_0x4e9c('0x2a')]['key']};});_0x4d3c9d[_0x4e9c('0x2b')]=_[_0x4e9c('0x26')](_0x397870,_0x4e9c('0x23'));_0x4d3c9d[_0x4e9c('0x2c')]=_[_0x4e9c('0x2d')](_0x4304bf[_0x4e9c('0x2c')]);_0x4d3c9d[_0x4e9c('0x2e')]=_['intersection'](_0x4d3c9d[_0x4e9c('0x2b')],_0x4d3c9d[_0x4e9c('0x2c')]);_0x1d13b5[_0x4e9c('0x2f')]=_[_0x4e9c('0x30')](_0x4d3c9d[_0x4e9c('0x2b')],qs[_0x4e9c('0x31')](_0x4304bf[_0x4e9c('0x2c')][_0x4e9c('0x31')]));_0x1d13b5[_0x4e9c('0x2f')]=_0x1d13b5[_0x4e9c('0x2f')][_0x4e9c('0x32')]?_0x1d13b5['attributes']:_0x4d3c9d[_0x4e9c('0x2b')];if(!_0x4304bf['query'][_0x4e9c('0x33')](_0x4e9c('0x34'))){_0x1d13b5['limit']=qs[_0x4e9c('0x19')](_0x4304bf[_0x4e9c('0x2c')]['limit']);_0x1d13b5[_0x4e9c('0x1b')]=qs[_0x4e9c('0x1b')](_0x4304bf[_0x4e9c('0x2c')][_0x4e9c('0x1b')]);}_0x1d13b5[_0x4e9c('0x35')]=qs['sort'](_0x4304bf[_0x4e9c('0x2c')][_0x4e9c('0x36')]);_0x1d13b5[_0x4e9c('0x37')]=qs[_0x4e9c('0x2e')](_[_0x4e9c('0x38')](_0x4304bf[_0x4e9c('0x2c')],_0x4d3c9d[_0x4e9c('0x2e')]),_0x397870);if(_0x4304bf[_0x4e9c('0x2c')]['filter']){_0x1d13b5['where']=_[_0x4e9c('0x39')](_0x1d13b5[_0x4e9c('0x37')],{'$or':_['map'](_0x397870,function(_0x21f556){if(_0x21f556[_0x4e9c('0x2a')]!==_0x4e9c('0x3a')){var _0x2697f4={};_0x2697f4[_0x21f556[_0x4e9c('0x23')]]={'$like':'%'+_0x4304bf[_0x4e9c('0x2c')][_0x4e9c('0x3b')]+'%'};return _0x2697f4;}})});}_0x1d13b5=_[_0x4e9c('0x39')]({},_0x1d13b5,_0x4304bf[_0x4e9c('0x3c')]);var _0x10ebe8={'where':_0x1d13b5[_0x4e9c('0x37')]};return db['ServicenowField']['count'](_0x10ebe8)[_0x4e9c('0x21')](function(_0x6ee56){_0x2ca55b[_0x4e9c('0x1a')]=_0x6ee56;if(_0x4304bf[_0x4e9c('0x2c')]['includeAll']){_0x1d13b5[_0x4e9c('0x3d')]=[{'all':!![]}];}return db[_0x4e9c('0x27')]['findAll'](_0x1d13b5);})[_0x4e9c('0x21')](function(_0x296bb4){_0x2ca55b[_0x4e9c('0x3e')]=_0x296bb4;return _0x2ca55b;})[_0x4e9c('0x21')](respondWithFilteredResult(_0x1a27f7,_0x1d13b5))[_0x4e9c('0x3f')](handleError(_0x1a27f7,null));};exports[_0x4e9c('0x40')]=function(_0x1019bb,_0x16a506){var _0x1f487f={'raw':!![],'where':{'id':_0x1019bb[_0x4e9c('0x41')]['id']}},_0x10891c={};_0x10891c['model']=_['keys'](db[_0x4e9c('0x27')][_0x4e9c('0x28')]);_0x10891c[_0x4e9c('0x2c')]=_['keys'](_0x1019bb[_0x4e9c('0x2c')]);_0x10891c[_0x4e9c('0x2e')]=_[_0x4e9c('0x30')](_0x10891c[_0x4e9c('0x2b')],_0x10891c['query']);_0x1f487f['attributes']=_['intersection'](_0x10891c[_0x4e9c('0x2b')],qs[_0x4e9c('0x31')](_0x1019bb['query'][_0x4e9c('0x31')]));_0x1f487f[_0x4e9c('0x2f')]=_0x1f487f[_0x4e9c('0x2f')][_0x4e9c('0x32')]?_0x1f487f[_0x4e9c('0x2f')]:_0x10891c['model'];if(_0x1019bb[_0x4e9c('0x2c')][_0x4e9c('0x42')]){_0x1f487f[_0x4e9c('0x3d')]=[{'all':!![]}];}_0x1f487f=_[_0x4e9c('0x39')]({},_0x1f487f,_0x1019bb[_0x4e9c('0x3c')]);return db['ServicenowField'][_0x4e9c('0x43')](_0x1f487f)[_0x4e9c('0x21')](handleEntityNotFound(_0x16a506,null))[_0x4e9c('0x21')](respondWithResult(_0x16a506,null))[_0x4e9c('0x3f')](handleError(_0x16a506,null));};exports['create']=function(_0x37c577,_0x59c0c0){return db[_0x4e9c('0x27')]['create'](_0x37c577['body'],{})[_0x4e9c('0x21')](respondWithResult(_0x59c0c0,0xc9))[_0x4e9c('0x3f')](handleError(_0x59c0c0,null));};exports[_0x4e9c('0x20')]=function(_0xb54cf7,_0x1dd0b9){if(_0xb54cf7[_0x4e9c('0x44')]['id']){delete _0xb54cf7[_0x4e9c('0x44')]['id'];}return db[_0x4e9c('0x27')][_0x4e9c('0x43')]({'where':{'id':_0xb54cf7[_0x4e9c('0x41')]['id']}})['then'](handleEntityNotFound(_0x1dd0b9,null))[_0x4e9c('0x21')](saveUpdates(_0xb54cf7['body'],null))[_0x4e9c('0x21')](respondWithResult(_0x1dd0b9,null))[_0x4e9c('0x3f')](handleError(_0x1dd0b9,null));};exports[_0x4e9c('0x45')]=function(_0x8ce064,_0x351169){return db['ServicenowField'][_0x4e9c('0x43')]({'where':{'id':_0x8ce064[_0x4e9c('0x41')]['id']}})[_0x4e9c('0x21')](handleEntityNotFound(_0x351169,null))[_0x4e9c('0x21')](removeEntity(_0x351169,null))[_0x4e9c('0x3f')](handleError(_0x351169,null));}; \ No newline at end of file +var _0x9a44=['where','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','apply','reject','then','destroy','error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x10dfbe,_0x51e7bf){var _0x2ed8c2=function(_0x4081b4){while(--_0x4081b4){_0x10dfbe['push'](_0x10dfbe['shift']());}};_0x2ed8c2(++_0x51e7bf);}(_0x9a44,0x1d1));var _0x49a4=function(_0x3ac207,_0x41c3f5){_0x3ac207=_0x3ac207-0x0;var _0x1f089c=_0x9a44[_0x3ac207];return _0x1f089c;};'use strict';var emlformat=require(_0x49a4('0x0'));var rimraf=require(_0x49a4('0x1'));var zipdir=require(_0x49a4('0x2'));var jsonpatch=require(_0x49a4('0x3'));var rp=require(_0x49a4('0x4'));var moment=require(_0x49a4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x49a4('0x6'));var util=require(_0x49a4('0x7'));var path=require(_0x49a4('0x8'));var sox=require(_0x49a4('0x9'));var csv=require(_0x49a4('0xa'));var ejs=require(_0x49a4('0xb'));var fs=require('fs');var fs_extra=require(_0x49a4('0xc'));var _=require(_0x49a4('0xd'));var squel=require(_0x49a4('0xe'));var crypto=require(_0x49a4('0xf'));var jsforce=require(_0x49a4('0x10'));var deskjs=require(_0x49a4('0x11'));var toCsv=require(_0x49a4('0xa'));var querystring=require('querystring');var Papa=require(_0x49a4('0x12'));var Redis=require(_0x49a4('0x13'));var authService=require(_0x49a4('0x14'));var qs=require(_0x49a4('0x15'));var as=require(_0x49a4('0x16'));var hardwareService=require(_0x49a4('0x17'));var logger=require(_0x49a4('0x18'))(_0x49a4('0x19'));var utils=require('../../config/utils');var config=require(_0x49a4('0x1a'));var licenseUtil=require(_0x49a4('0x1b'));var db=require(_0x49a4('0x1c'))['db'];function respondWithStatusCode(_0x35d475,_0x56d809){_0x56d809=_0x56d809||0xcc;return function(_0x55c5b6){if(_0x55c5b6){return _0x35d475['sendStatus'](_0x56d809);}return _0x35d475[_0x49a4('0x1d')](_0x56d809)[_0x49a4('0x1e')]();};}function respondWithResult(_0x118ce4,_0x153e16){_0x153e16=_0x153e16||0xc8;return function(_0x51dd8b){if(_0x51dd8b){return _0x118ce4[_0x49a4('0x1d')](_0x153e16)[_0x49a4('0x1f')](_0x51dd8b);}};}function respondWithFilteredResult(_0x583588,_0x58ac0f){return function(_0x4eb97c){if(_0x4eb97c){var _0x20cd84=typeof _0x58ac0f[_0x49a4('0x20')]==='undefined'&&typeof _0x58ac0f[_0x49a4('0x21')]===_0x49a4('0x22');var _0x2fb95b=_0x4eb97c[_0x49a4('0x23')];var _0x41c003=_0x20cd84?0x0:_0x58ac0f['offset'];var _0x193967=_0x20cd84?_0x4eb97c[_0x49a4('0x23')]:_0x58ac0f['offset']+_0x58ac0f[_0x49a4('0x21')];var _0x488311;if(_0x193967>=_0x2fb95b){_0x193967=_0x2fb95b;_0x488311=0xc8;}else{_0x488311=0xce;}_0x583588[_0x49a4('0x1d')](_0x488311);return _0x583588['set']('Content-Range',_0x41c003+'-'+_0x193967+'/'+_0x2fb95b)[_0x49a4('0x1f')](_0x4eb97c);}return null;};}function patchUpdates(_0x58cdb3){return function(_0x4af700){try{jsonpatch[_0x49a4('0x24')](_0x4af700,_0x58cdb3,!![]);}catch(_0x343bf2){return BPromise[_0x49a4('0x25')](_0x343bf2);}return _0x4af700['save']();};}function saveUpdates(_0x196245,_0x3db1fa){return function(_0x43ec3b){if(_0x43ec3b){return _0x43ec3b['update'](_0x196245)[_0x49a4('0x26')](function(_0x522d76){return _0x522d76;});}return null;};}function removeEntity(_0x2647a0,_0x324d49){return function(_0x27cc10){if(_0x27cc10){return _0x27cc10[_0x49a4('0x27')]()[_0x49a4('0x26')](function(){_0x2647a0['status'](0xcc)[_0x49a4('0x1e')]();});}};}function handleEntityNotFound(_0x450992,_0x18d777){return function(_0x9800f){if(!_0x9800f){_0x450992['sendStatus'](0x194);}return _0x9800f;};}function handleError(_0x1f8205,_0x871ab9){_0x871ab9=_0x871ab9||0x1f4;return function(_0x111e9a){logger[_0x49a4('0x28')](_0x111e9a[_0x49a4('0x29')]);if(_0x111e9a['name']){delete _0x111e9a[_0x49a4('0x2a')];}_0x1f8205[_0x49a4('0x1d')](_0x871ab9)[_0x49a4('0x2b')](_0x111e9a);};}exports['index']=function(_0x564d1c,_0x3bf580){var _0x112bfa={},_0x4d48d6={},_0xf1a103={'count':0x0,'rows':[]};var _0x2eab1f=_['map'](db[_0x49a4('0x2c')][_0x49a4('0x2d')],function(_0x46ee99){return{'name':_0x46ee99[_0x49a4('0x2e')],'type':_0x46ee99[_0x49a4('0x2f')]['key']};});_0x4d48d6[_0x49a4('0x30')]=_[_0x49a4('0x31')](_0x2eab1f,'name');_0x4d48d6[_0x49a4('0x32')]=_[_0x49a4('0x33')](_0x564d1c['query']);_0x4d48d6[_0x49a4('0x34')]=_[_0x49a4('0x35')](_0x4d48d6[_0x49a4('0x30')],_0x4d48d6[_0x49a4('0x32')]);_0x112bfa[_0x49a4('0x36')]=_[_0x49a4('0x35')](_0x4d48d6[_0x49a4('0x30')],qs[_0x49a4('0x37')](_0x564d1c[_0x49a4('0x32')]['fields']));_0x112bfa[_0x49a4('0x36')]=_0x112bfa[_0x49a4('0x36')][_0x49a4('0x38')]?_0x112bfa[_0x49a4('0x36')]:_0x4d48d6[_0x49a4('0x30')];if(!_0x564d1c[_0x49a4('0x32')][_0x49a4('0x39')](_0x49a4('0x3a'))){_0x112bfa[_0x49a4('0x21')]=qs[_0x49a4('0x21')](_0x564d1c[_0x49a4('0x32')][_0x49a4('0x21')]);_0x112bfa[_0x49a4('0x20')]=qs['offset'](_0x564d1c['query'][_0x49a4('0x20')]);}_0x112bfa['order']=qs[_0x49a4('0x3b')](_0x564d1c[_0x49a4('0x32')]['sort']);_0x112bfa[_0x49a4('0x3c')]=qs[_0x49a4('0x34')](_['pick'](_0x564d1c['query'],_0x4d48d6['filters']),_0x2eab1f);if(_0x564d1c[_0x49a4('0x32')][_0x49a4('0x3d')]){_0x112bfa[_0x49a4('0x3c')]=_[_0x49a4('0x3e')](_0x112bfa[_0x49a4('0x3c')],{'$or':_[_0x49a4('0x31')](_0x2eab1f,function(_0x38e72b){if(_0x38e72b[_0x49a4('0x2f')]!==_0x49a4('0x3f')){var _0x167c68={};_0x167c68[_0x38e72b['name']]={'$like':'%'+_0x564d1c[_0x49a4('0x32')][_0x49a4('0x3d')]+'%'};return _0x167c68;}})});}_0x112bfa=_[_0x49a4('0x3e')]({},_0x112bfa,_0x564d1c['options']);var _0x4ff9d3={'where':_0x112bfa[_0x49a4('0x3c')]};return db['ServicenowField'][_0x49a4('0x23')](_0x4ff9d3)[_0x49a4('0x26')](function(_0x586b09){_0xf1a103[_0x49a4('0x23')]=_0x586b09;if(_0x564d1c[_0x49a4('0x32')][_0x49a4('0x40')]){_0x112bfa['include']=[{'all':!![]}];}return db[_0x49a4('0x2c')][_0x49a4('0x41')](_0x112bfa);})['then'](function(_0x30907a){_0xf1a103['rows']=_0x30907a;return _0xf1a103;})[_0x49a4('0x26')](respondWithFilteredResult(_0x3bf580,_0x112bfa))[_0x49a4('0x42')](handleError(_0x3bf580,null));};exports[_0x49a4('0x43')]=function(_0xcc7f7f,_0x3313a7){var _0x739885={'raw':!![],'where':{'id':_0xcc7f7f[_0x49a4('0x44')]['id']}},_0x44c6d5={};_0x44c6d5[_0x49a4('0x30')]=_[_0x49a4('0x33')](db[_0x49a4('0x2c')][_0x49a4('0x2d')]);_0x44c6d5[_0x49a4('0x32')]=_[_0x49a4('0x33')](_0xcc7f7f[_0x49a4('0x32')]);_0x44c6d5[_0x49a4('0x34')]=_['intersection'](_0x44c6d5[_0x49a4('0x30')],_0x44c6d5[_0x49a4('0x32')]);_0x739885[_0x49a4('0x36')]=_['intersection'](_0x44c6d5['model'],qs['fields'](_0xcc7f7f[_0x49a4('0x32')]['fields']));_0x739885['attributes']=_0x739885['attributes'][_0x49a4('0x38')]?_0x739885[_0x49a4('0x36')]:_0x44c6d5[_0x49a4('0x30')];if(_0xcc7f7f[_0x49a4('0x32')][_0x49a4('0x40')]){_0x739885[_0x49a4('0x45')]=[{'all':!![]}];}_0x739885=_[_0x49a4('0x3e')]({},_0x739885,_0xcc7f7f[_0x49a4('0x46')]);return db[_0x49a4('0x2c')][_0x49a4('0x47')](_0x739885)[_0x49a4('0x26')](handleEntityNotFound(_0x3313a7,null))[_0x49a4('0x26')](respondWithResult(_0x3313a7,null))[_0x49a4('0x42')](handleError(_0x3313a7,null));};exports[_0x49a4('0x48')]=function(_0x11f530,_0x4ac880){return db[_0x49a4('0x2c')][_0x49a4('0x48')](_0x11f530[_0x49a4('0x49')],{})[_0x49a4('0x26')](respondWithResult(_0x4ac880,0xc9))[_0x49a4('0x42')](handleError(_0x4ac880,null));};exports[_0x49a4('0x4a')]=function(_0x3dd20e,_0x295144){if(_0x3dd20e[_0x49a4('0x49')]['id']){delete _0x3dd20e[_0x49a4('0x49')]['id'];}return db[_0x49a4('0x2c')][_0x49a4('0x47')]({'where':{'id':_0x3dd20e['params']['id']}})['then'](handleEntityNotFound(_0x295144,null))[_0x49a4('0x26')](saveUpdates(_0x3dd20e[_0x49a4('0x49')],null))[_0x49a4('0x26')](respondWithResult(_0x295144,null))['catch'](handleError(_0x295144,null));};exports[_0x49a4('0x27')]=function(_0x23684d,_0x530c10){return db[_0x49a4('0x2c')][_0x49a4('0x47')]({'where':{'id':_0x23684d[_0x49a4('0x44')]['id']}})[_0x49a4('0x26')](handleEntityNotFound(_0x530c10,null))[_0x49a4('0x26')](removeEntity(_0x530c10,null))['catch'](handleError(_0x530c10,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 71baff5..f1ab01e 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 _0xbf81=['idField','util','api','moment','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x33385c,_0x13ac69){var _0x14e17e=function(_0x41dd24){while(--_0x41dd24){_0x33385c['push'](_0x33385c['shift']());}};_0x14e17e(++_0x13ac69);}(_0xbf81,0x175));var _0x1bf8=function(_0x545809,_0x1e9efc){_0x545809=_0x545809-0x0;var _0x363e7f=_0xbf81[_0x545809];return _0x363e7f;};'use strict';var _=require('lodash');var util=require(_0x1bf8('0x0'));var logger=require('../../config/logger')(_0x1bf8('0x1'));var moment=require(_0x1bf8('0x2'));var BPromise=require(_0x1bf8('0x3'));var rp=require(_0x1bf8('0x4'));var fs=require('fs');var path=require(_0x1bf8('0x5'));var rimraf=require(_0x1bf8('0x6'));var config=require('../../config/environment');var attributes=require(_0x1bf8('0x7'));module[_0x1bf8('0x8')]=function(_0x5091bb,_0x2b523e){return _0x5091bb[_0x1bf8('0x9')](_0x1bf8('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1bf8('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f32=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3fab05,_0x41f711){var _0x54bf44=function(_0x447217){while(--_0x447217){_0x3fab05['push'](_0x3fab05['shift']());}};_0x54bf44(++_0x41f711);}(_0x8f32,0x1d9));var _0x28f3=function(_0x22133d,_0x12f112){_0x22133d=_0x22133d-0x0;var _0x4e09bb=_0x8f32[_0x22133d];return _0x4e09bb;};'use strict';var _=require(_0x28f3('0x0'));var util=require('util');var logger=require(_0x28f3('0x1'))(_0x28f3('0x2'));var moment=require(_0x28f3('0x3'));var BPromise=require(_0x28f3('0x4'));var rp=require(_0x28f3('0x5'));var fs=require('fs');var path=require(_0x28f3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x28f3('0x7'));module[_0x28f3('0x8')]=function(_0x2f140c,_0x485405){return _0x2f140c[_0x28f3('0x9')](_0x28f3('0xa'),attributes,{'tableName':_0x28f3('0xb'),'paranoid':![],'indexes':[{'name':_0x28f3('0xc'),'fields':[_0x28f3('0xd'),_0x28f3('0xe')],'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 db88b2c..7ed2354 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x22470f,_0x62ee5f){var _0x342bc6=function(_0x31043){while(--_0x31043){_0x22470f['push'](_0x22470f['shift']());}};_0x342bc6(++_0x62ee5f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x5b8ac0,_0x111e9d){var _0x370099=function(_0x558edb){while(--_0x558edb){_0x5b8ac0['push'](_0x5b8ac0['shift']());}};_0x370099(++_0x111e9d);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1176ca,_0x17826b){_0x1176ca=_0x1176ca-0x0;var _0x1b64c1=_0x9ffd[_0x1176ca];return _0x1b64c1;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 2886286..49e97c6 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(_0x2fd64d,_0x49a1da){var _0x54efc4=function(_0x5ac032){while(--_0x5ac032){_0x2fd64d['push'](_0x2fd64d['shift']());}};_0x54efc4(++_0x49a1da);}(_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(_0x267583,_0x2e1356){var _0x23d218=function(_0x7f2ae2){while(--_0x7f2ae2){_0x267583['push'](_0x267583['shift']());}};_0x23d218(++_0x2e1356);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 e17459e..d924b6c 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(_0x6ecbcd,_0x17874a){var _0x5c9534=function(_0xfe878f){while(--_0xfe878f){_0x6ecbcd['push'](_0x6ecbcd['shift']());}};_0x5c9534(++_0x17874a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x145052,_0x386408){var _0x3e5d16=function(_0x10f795){while(--_0x10f795){_0x145052['push'](_0x145052['shift']());}};_0x3e5d16(++_0x386408);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 c1bd486..8736f64 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 _0x19cc=['slice','substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','get_module_fields','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','send','eml-format','rimraf','zip-dir','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','SugarcrmAccount','includeAll','include','rows','catch','params','keys','options','find','create','body','update','findOne','SugarcrmConfiguration','pick','getConfigurations','addConfiguration','Subjects','channel','getDescriptions','Descriptions','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri'];(function(_0x1fa5d2,_0x219e95){var _0x4f887b=function(_0x1be0b6){while(--_0x1be0b6){_0x1fa5d2['push'](_0x1fa5d2['shift']());}};_0x4f887b(++_0x219e95);}(_0x19cc,0x10c));var _0xc19c=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x19cc[_0xf04c6d];return _0x4a804e;};'use strict';var emlformat=require(_0xc19c('0x0'));var rimraf=require(_0xc19c('0x1'));var zipdir=require(_0xc19c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc19c('0x3'));var Mustache=require(_0xc19c('0x4'));var util=require(_0xc19c('0x5'));var path=require(_0xc19c('0x6'));var sox=require(_0xc19c('0x7'));var csv=require(_0xc19c('0x8'));var ejs=require(_0xc19c('0x9'));var fs=require('fs');var fs_extra=require(_0xc19c('0xa'));var _=require(_0xc19c('0xb'));var squel=require(_0xc19c('0xc'));var crypto=require(_0xc19c('0xd'));var jsforce=require(_0xc19c('0xe'));var deskjs=require(_0xc19c('0xf'));var toCsv=require(_0xc19c('0x8'));var querystring=require(_0xc19c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc19c('0x11'));var authService=require(_0xc19c('0x12'));var qs=require(_0xc19c('0x13'));var as=require(_0xc19c('0x14'));var hardwareService=require(_0xc19c('0x15'));var logger=require(_0xc19c('0x16'))(_0xc19c('0x17'));var utils=require(_0xc19c('0x18'));var config=require(_0xc19c('0x19'));var licenseUtil=require(_0xc19c('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc19c('0x1b'));function respondWithStatusCode(_0x4b8bf9,_0x22cbce){_0x22cbce=_0x22cbce||0xcc;return function(_0x31a9e9){if(_0x31a9e9){return _0x4b8bf9[_0xc19c('0x1c')](_0x22cbce);}return _0x4b8bf9[_0xc19c('0x1d')](_0x22cbce)[_0xc19c('0x1e')]();};}function respondWithResult(_0x2de316,_0x317cad){_0x317cad=_0x317cad||0xc8;return function(_0x17d0a9){if(_0x17d0a9){return _0x2de316[_0xc19c('0x1d')](_0x317cad)[_0xc19c('0x1f')](_0x17d0a9);}};}function respondWithFilteredResult(_0x1f2a7d,_0x25689d){return function(_0x17ee0f){if(_0x17ee0f){var _0xdf7507=typeof _0x25689d[_0xc19c('0x20')]===_0xc19c('0x21')&&typeof _0x25689d[_0xc19c('0x22')]===_0xc19c('0x21');var _0x31b5d7=_0x17ee0f[_0xc19c('0x23')];var _0x1bde9d=_0xdf7507?0x0:_0x25689d['offset'];var _0x2aa5a3=_0xdf7507?_0x17ee0f[_0xc19c('0x23')]:_0x25689d[_0xc19c('0x20')]+_0x25689d[_0xc19c('0x22')];var _0x302013;if(_0x2aa5a3>=_0x31b5d7){_0x2aa5a3=_0x31b5d7;_0x302013=0xc8;}else{_0x302013=0xce;}_0x1f2a7d['status'](_0x302013);return _0x1f2a7d['set'](_0xc19c('0x24'),_0x1bde9d+'-'+_0x2aa5a3+'/'+_0x31b5d7)['json'](_0x17ee0f);}return null;};}function patchUpdates(_0x302390){return function(_0x4fea6c){try{jsonpatch[_0xc19c('0x25')](_0x4fea6c,_0x302390,!![]);}catch(_0x102116){return BPromise['reject'](_0x102116);}return _0x4fea6c[_0xc19c('0x26')]();};}function saveUpdates(_0x257644,_0x53a39d){return function(_0x14c329){if(_0x14c329){return _0x14c329['update'](_0x257644)[_0xc19c('0x27')](function(_0x3b0262){return _0x3b0262;});}return null;};}function removeEntity(_0x22be68,_0x1085a8){return function(_0x4aa50e){if(_0x4aa50e){return _0x4aa50e[_0xc19c('0x28')]()['then'](function(){_0x22be68['status'](0xcc)[_0xc19c('0x1e')]();});}};}function handleEntityNotFound(_0x25e535,_0x32d160){return function(_0x177b73){if(!_0x177b73){_0x25e535[_0xc19c('0x1c')](0x194);}return _0x177b73;};}function handleError(_0x2e7e94,_0x43a614){_0x43a614=_0x43a614||0x1f4;return function(_0xc5503d){logger[_0xc19c('0x29')](_0xc5503d[_0xc19c('0x2a')]);if(_0xc5503d[_0xc19c('0x2b')]){delete _0xc5503d[_0xc19c('0x2b')];}_0x2e7e94['status'](_0x43a614)['send'](_0xc5503d);};}exports[_0xc19c('0x2c')]=function(_0x34a20f,_0x2ce297){var _0x4fcd34={},_0x57c2ab={},_0x2ea44f={'count':0x0,'rows':[]};var _0x4a69a2=_[_0xc19c('0x2d')](db['SugarcrmAccount'][_0xc19c('0x2e')],function(_0x5869c8){return{'name':_0x5869c8['fieldName'],'type':_0x5869c8[_0xc19c('0x2f')]['key']};});_0x57c2ab[_0xc19c('0x30')]=_[_0xc19c('0x2d')](_0x4a69a2,_0xc19c('0x2b'));_0x57c2ab[_0xc19c('0x31')]=_['keys'](_0x34a20f[_0xc19c('0x31')]);_0x57c2ab[_0xc19c('0x32')]=_[_0xc19c('0x33')](_0x57c2ab['model'],_0x57c2ab[_0xc19c('0x31')]);_0x4fcd34['attributes']=_[_0xc19c('0x33')](_0x57c2ab[_0xc19c('0x30')],qs[_0xc19c('0x34')](_0x34a20f[_0xc19c('0x31')][_0xc19c('0x34')]));_0x4fcd34[_0xc19c('0x35')]=_0x4fcd34[_0xc19c('0x35')][_0xc19c('0x36')]?_0x4fcd34[_0xc19c('0x35')]:_0x57c2ab['model'];if(!_0x34a20f[_0xc19c('0x31')][_0xc19c('0x37')](_0xc19c('0x38'))){_0x4fcd34[_0xc19c('0x22')]=qs['limit'](_0x34a20f['query'][_0xc19c('0x22')]);_0x4fcd34[_0xc19c('0x20')]=qs[_0xc19c('0x20')](_0x34a20f[_0xc19c('0x31')]['offset']);}_0x4fcd34[_0xc19c('0x39')]=qs[_0xc19c('0x3a')](_0x34a20f['query'][_0xc19c('0x3a')]);_0x4fcd34[_0xc19c('0x3b')]=qs['filters'](_['pick'](_0x34a20f[_0xc19c('0x31')],_0x57c2ab[_0xc19c('0x32')]),_0x4a69a2);if(_0x34a20f[_0xc19c('0x31')][_0xc19c('0x3c')]){_0x4fcd34[_0xc19c('0x3b')]=_[_0xc19c('0x3d')](_0x4fcd34['where'],{'$or':_[_0xc19c('0x2d')](_0x4a69a2,function(_0x3f2a24){if(_0x3f2a24['type']!==_0xc19c('0x3e')){var _0x14fee9={};_0x14fee9[_0x3f2a24[_0xc19c('0x2b')]]={'$like':'%'+_0x34a20f[_0xc19c('0x31')][_0xc19c('0x3c')]+'%'};return _0x14fee9;}})});}_0x4fcd34=_[_0xc19c('0x3d')]({},_0x4fcd34,_0x34a20f['options']);var _0x2364ff={'where':_0x4fcd34[_0xc19c('0x3b')]};return db[_0xc19c('0x3f')]['count'](_0x2364ff)['then'](function(_0x5d6f35){_0x2ea44f['count']=_0x5d6f35;if(_0x34a20f[_0xc19c('0x31')][_0xc19c('0x40')]){_0x4fcd34[_0xc19c('0x41')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x4fcd34);})[_0xc19c('0x27')](function(_0x2ba56e){_0x2ea44f[_0xc19c('0x42')]=_0x2ba56e;return _0x2ea44f;})['then'](respondWithFilteredResult(_0x2ce297,_0x4fcd34))[_0xc19c('0x43')](handleError(_0x2ce297,null));};exports['show']=function(_0x4df87f,_0x4eb817){var _0x1e7708={'raw':![],'where':{'id':_0x4df87f[_0xc19c('0x44')]['id']}},_0xbf8f26={};_0xbf8f26[_0xc19c('0x30')]=_[_0xc19c('0x45')](db[_0xc19c('0x3f')][_0xc19c('0x2e')]);_0xbf8f26[_0xc19c('0x31')]=_['keys'](_0x4df87f[_0xc19c('0x31')]);_0xbf8f26[_0xc19c('0x32')]=_[_0xc19c('0x33')](_0xbf8f26[_0xc19c('0x30')],_0xbf8f26[_0xc19c('0x31')]);_0x1e7708['attributes']=_[_0xc19c('0x33')](_0xbf8f26[_0xc19c('0x30')],qs[_0xc19c('0x34')](_0x4df87f[_0xc19c('0x31')][_0xc19c('0x34')]));_0x1e7708[_0xc19c('0x35')]=_0x1e7708['attributes'][_0xc19c('0x36')]?_0x1e7708['attributes']:_0xbf8f26[_0xc19c('0x30')];if(_0x4df87f[_0xc19c('0x31')][_0xc19c('0x40')]){_0x1e7708[_0xc19c('0x41')]=[{'all':!![]}];}_0x1e7708=_[_0xc19c('0x3d')]({},_0x1e7708,_0x4df87f[_0xc19c('0x46')]);return db[_0xc19c('0x3f')][_0xc19c('0x47')](_0x1e7708)['then'](handleEntityNotFound(_0x4eb817,null))[_0xc19c('0x27')](respondWithResult(_0x4eb817,null))['catch'](handleError(_0x4eb817,null));};exports[_0xc19c('0x48')]=function(_0x5d8cd5,_0x5abfd0){return db[_0xc19c('0x3f')][_0xc19c('0x48')](_0x5d8cd5[_0xc19c('0x49')],{})[_0xc19c('0x27')](respondWithResult(_0x5abfd0,0xc9))[_0xc19c('0x43')](handleError(_0x5abfd0,null));};exports[_0xc19c('0x4a')]=function(_0x31e49f,_0x306e7e){if(_0x31e49f[_0xc19c('0x49')]['id']){delete _0x31e49f['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x31e49f[_0xc19c('0x44')]['id']}})[_0xc19c('0x27')](handleEntityNotFound(_0x306e7e,null))[_0xc19c('0x27')](saveUpdates(_0x31e49f[_0xc19c('0x49')],null))['then'](respondWithResult(_0x306e7e,null))[_0xc19c('0x43')](handleError(_0x306e7e,null));};exports['destroy']=function(_0x3fba83,_0x2b3811){return db[_0xc19c('0x3f')][_0xc19c('0x47')]({'where':{'id':_0x3fba83['params']['id']}})[_0xc19c('0x27')](handleEntityNotFound(_0x2b3811,null))['then'](removeEntity(_0x2b3811,null))[_0xc19c('0x43')](handleError(_0x2b3811,null));};exports['getConfigurations']=function(_0x2b97cf,_0x319824,_0x5bcd60){var _0x5a827b={};var _0xcf4081={};var _0x4b93c5;var _0xbe2ac7;return db[_0xc19c('0x3f')][_0xc19c('0x4b')]({'where':{'id':_0x2b97cf['params']['id']}})['then'](handleEntityNotFound(_0x319824,null))[_0xc19c('0x27')](function(_0x371617){if(_0x371617){_0x4b93c5=_0x371617;_0xcf4081['model']=_[_0xc19c('0x45')](db[_0xc19c('0x4c')]['rawAttributes']);_0xcf4081[_0xc19c('0x31')]=_[_0xc19c('0x45')](_0x2b97cf[_0xc19c('0x31')]);_0xcf4081['filters']=_[_0xc19c('0x33')](_0xcf4081[_0xc19c('0x30')],_0xcf4081['query']);_0x5a827b[_0xc19c('0x35')]=_[_0xc19c('0x33')](_0xcf4081[_0xc19c('0x30')],qs[_0xc19c('0x34')](_0x2b97cf[_0xc19c('0x31')][_0xc19c('0x34')]));_0x5a827b[_0xc19c('0x35')]=_0x5a827b[_0xc19c('0x35')][_0xc19c('0x36')]?_0x5a827b[_0xc19c('0x35')]:_0xcf4081['model'];_0x5a827b[_0xc19c('0x39')]=qs['sort'](_0x2b97cf[_0xc19c('0x31')][_0xc19c('0x3a')]);_0x5a827b['where']=qs[_0xc19c('0x32')](_[_0xc19c('0x4d')](_0x2b97cf[_0xc19c('0x31')],_0xcf4081['filters']));if(_0x2b97cf[_0xc19c('0x31')][_0xc19c('0x3c')]){_0x5a827b[_0xc19c('0x3b')]=_[_0xc19c('0x3d')](_0x5a827b[_0xc19c('0x3b')],{'$or':_[_0xc19c('0x2d')](_0x5a827b[_0xc19c('0x35')],function(_0x446d72){var _0x55553f={};_0x55553f[_0x446d72]={'$like':'%'+_0x2b97cf['query'][_0xc19c('0x3c')]+'%'};return _0x55553f;})});}_0x5a827b=_[_0xc19c('0x3d')]({},_0x5a827b,_0x2b97cf['options']);return _0x4b93c5[_0xc19c('0x4e')](_0x5a827b);}})['then'](function(_0x468b24){if(_0x468b24){_0xbe2ac7=_0x468b24['length'];if(!_0x2b97cf[_0xc19c('0x31')][_0xc19c('0x37')]('nolimit')){_0x5a827b['limit']=qs[_0xc19c('0x22')](_0x2b97cf[_0xc19c('0x31')][_0xc19c('0x22')]);_0x5a827b[_0xc19c('0x20')]=qs[_0xc19c('0x20')](_0x2b97cf[_0xc19c('0x31')][_0xc19c('0x20')]);}return _0x4b93c5['getConfigurations'](_0x5a827b);}})[_0xc19c('0x27')](function(_0x32b910){if(_0x32b910){return _0x32b910?{'count':_0xbe2ac7,'rows':_0x32b910}:null;}})[_0xc19c('0x27')](respondWithResult(_0x319824,null))['catch'](handleError(_0x319824,null));};exports[_0xc19c('0x4f')]=function(_0x46629f,_0x1145bd,_0x353704){if(_0x46629f[_0xc19c('0x49')]['id']){delete _0x46629f[_0xc19c('0x49')]['id'];}return db[_0xc19c('0x3f')][_0xc19c('0x4b')]({'where':{'id':_0x46629f[_0xc19c('0x44')]['id']}})[_0xc19c('0x27')](handleEntityNotFound(_0x1145bd,null))[_0xc19c('0x27')](function(_0x4b0d63){if(_0x4b0d63){_0x46629f[_0xc19c('0x49')]['AccountId']=_0x4b0d63['id'];_0x46629f['body'][_0xc19c('0x50')]=integrations['getSubjects'](_0x46629f['body'][_0xc19c('0x51')],_0x46629f[_0xc19c('0x49')][_0xc19c('0x2f')]);_0x46629f['body']['Descriptions']=integrations[_0xc19c('0x52')](_0x46629f[_0xc19c('0x49')][_0xc19c('0x51')],_0x46629f[_0xc19c('0x49')][_0xc19c('0x2f')]);return db['SugarcrmConfiguration'][_0xc19c('0x48')](_0x46629f[_0xc19c('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0xc19c('0x50')},{'model':db['SugarcrmField'],'as':_0xc19c('0x53')}]});}return null;})['then'](respondWithResult(_0x1145bd,null))[_0xc19c('0x43')](handleError(_0x1145bd,null));};exports['getFields']=function(_0x176a1f,_0x3dbf08,_0x50a153){var _0x474329='';var _0x47dea0=['id',_0xc19c('0x2b'),'assigned_user_id',_0xc19c('0x54'),_0xc19c('0x55'),_0xc19c('0x56'),_0xc19c('0x57'),_0xc19c('0x58'),_0xc19c('0x59'),_0xc19c('0x5a'),_0xc19c('0x5b'),'direction'];return db[_0xc19c('0x3f')][_0xc19c('0x4b')]({'where':{'id':_0x176a1f['params']['id']},'attributes':['id',_0xc19c('0x5c'),_0xc19c('0x5d'),_0xc19c('0x5e')]})[_0xc19c('0x27')](handleEntityNotFound(_0x3dbf08,null))[_0xc19c('0x27')](function(_0x2cd9f8){if(_0x2cd9f8){_0x474329=_0x2cd9f8['remoteUri'];var _0x9e963c=_0x474329[_0xc19c('0x5f')](-0x1);if(_0x9e963c==='/'){_0x474329=_0x474329[_0xc19c('0x60')](0x0,_0x474329['lastIndexOf'](_0x9e963c));}return rp({'method':_0xc19c('0x61'),'uri':util['format'](_0xc19c('0x62'),_0x474329,_0xc19c('0x63')),'json':!![],'form':{'method':_0xc19c('0x64'),'input_type':_0xc19c('0x65'),'response_type':'JSON','rest_data':JSON[_0xc19c('0x66')]({'user_auth':{'user_name':_0x2cd9f8['username'],'password':_0x2cd9f8[_0xc19c('0x5d')],'encryption':_0xc19c('0x67')},'application':_0xc19c('0x68')})}});}})[_0xc19c('0x27')](function(_0xeb4f6c){if(_0xeb4f6c&&_0xeb4f6c[_0xc19c('0x2b')]!=='Invalid\x20Login'&&_0xeb4f6c[_0xc19c('0x2b')]!==_0xc19c('0x69')){return rp({'method':_0xc19c('0x61'),'uri':util[_0xc19c('0x6a')](_0xc19c('0x62'),_0x474329,_0xc19c('0x63')),'json':!![],'form':{'method':_0xc19c('0x6b'),'input_type':_0xc19c('0x65'),'response_type':'JSON','rest_data':JSON[_0xc19c('0x66')]({'session':_0xeb4f6c['id'],'module_name':'Calls'})}})[_0xc19c('0x27')](function(_0x56c4a3){if(_0x56c4a3){var _0x486952=_[_0xc19c('0x6c')](_0x56c4a3[_0xc19c('0x6d')]);_[_0xc19c('0x6e')](_0x486952,function(_0x4f7f17){return _0x47dea0[_0xc19c('0x6f')](_0x4f7f17[_0xc19c('0x2b')]);});return{'count':_0x486952[_0xc19c('0x36')],'rows':_['map'](_0x486952,function(_0x12e725){return{'id':_0x12e725['name'],'name':_0x12e725[_0xc19c('0x70')],'custom':_[_0xc19c('0x71')](_0x12e725[_0xc19c('0x2b')],'_c')?!![]:![],'options':_0x12e725[_0xc19c('0x46')]?_[_0xc19c('0x2d')](_[_0xc19c('0x6c')](_0x12e725[_0xc19c('0x46')]),function(_0x456c2c){return{'name':_0x456c2c[_0xc19c('0x72')],'value':_0x456c2c[_0xc19c('0x2b')]};}):[]};})};}})['then'](respondWithResult(_0x3dbf08,null))[_0xc19c('0x43')](function(_0x1b92c8){var _0x29c7d2=_0x176a1f[_0xc19c('0x31')][_0xc19c('0x73')]?0x1f4:_0x1b92c8[_0xc19c('0x74')]||0x1f4;logger[_0xc19c('0x29')](_0xc19c('0x75'),_0xc19c('0x76'),_0x29c7d2,JSON[_0xc19c('0x66')](_0x1b92c8));delete _0x1b92c8[_0xc19c('0x2b')];if(_0x29c7d2===0x191){_0x29c7d2=0x190;}_0x3dbf08[_0xc19c('0x1d')](_0x29c7d2)['send'](_0x176a1f[_0xc19c('0x31')][_0xc19c('0x73')]?{'message':_0xc19c('0x77'),'statusCode':_0x1b92c8[_0xc19c('0x74')]}:_0x1b92c8);});}else{var _0x9483a0=0x1f4;_0x3dbf08[_0xc19c('0x1d')](_0x9483a0)[_0xc19c('0x78')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x550f=['mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','SugarcrmAccount','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','findOne','SugarcrmConfiguration','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','date_start','duration_hours','parent_id','parent_name','password','slice','substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','remove','label','value','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x550f,0x1c6));var _0xf550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf550('0x0'));var rimraf=require(_0xf550('0x1'));var zipdir=require(_0xf550('0x2'));var jsonpatch=require(_0xf550('0x3'));var rp=require(_0xf550('0x4'));var moment=require('moment');var BPromise=require(_0xf550('0x5'));var Mustache=require(_0xf550('0x6'));var util=require('util');var path=require(_0xf550('0x7'));var sox=require(_0xf550('0x8'));var csv=require(_0xf550('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf550('0xa'));var squel=require(_0xf550('0xb'));var crypto=require(_0xf550('0xc'));var jsforce=require(_0xf550('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf550('0x9'));var querystring=require(_0xf550('0xe'));var Papa=require(_0xf550('0xf'));var Redis=require(_0xf550('0x10'));var authService=require(_0xf550('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf550('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf550('0x13'));var config=require(_0xf550('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf550('0x15'))['db'];var integrations=require(_0xf550('0x16'));function respondWithStatusCode(_0x52a83d,_0x1c646d){_0x1c646d=_0x1c646d||0xcc;return function(_0xc20f5b){if(_0xc20f5b){return _0x52a83d[_0xf550('0x17')](_0x1c646d);}return _0x52a83d['status'](_0x1c646d)[_0xf550('0x18')]();};}function respondWithResult(_0x84f185,_0x544b7a){_0x544b7a=_0x544b7a||0xc8;return function(_0x26eb84){if(_0x26eb84){return _0x84f185[_0xf550('0x19')](_0x544b7a)['json'](_0x26eb84);}};}function respondWithFilteredResult(_0x2e2b69,_0x5c46d3){return function(_0xaddf61){if(_0xaddf61){var _0x4fb954=typeof _0x5c46d3[_0xf550('0x1a')]===_0xf550('0x1b')&&typeof _0x5c46d3[_0xf550('0x1c')]===_0xf550('0x1b');var _0x47a45b=_0xaddf61[_0xf550('0x1d')];var _0xe17252=_0x4fb954?0x0:_0x5c46d3[_0xf550('0x1a')];var _0x331346=_0x4fb954?_0xaddf61['count']:_0x5c46d3['offset']+_0x5c46d3[_0xf550('0x1c')];var _0x2c29e9;if(_0x331346>=_0x47a45b){_0x331346=_0x47a45b;_0x2c29e9=0xc8;}else{_0x2c29e9=0xce;}_0x2e2b69[_0xf550('0x19')](_0x2c29e9);return _0x2e2b69['set'](_0xf550('0x1e'),_0xe17252+'-'+_0x331346+'/'+_0x47a45b)[_0xf550('0x1f')](_0xaddf61);}return null;};}function patchUpdates(_0x59dd54){return function(_0x39673b){try{jsonpatch[_0xf550('0x20')](_0x39673b,_0x59dd54,!![]);}catch(_0x579662){return BPromise[_0xf550('0x21')](_0x579662);}return _0x39673b['save']();};}function saveUpdates(_0x4c251c,_0x2ee745){return function(_0x5447f5){if(_0x5447f5){return _0x5447f5['update'](_0x4c251c)['then'](function(_0x12b91c){return _0x12b91c;});}return null;};}function removeEntity(_0x410430,_0x4887cf){return function(_0x406e3c){if(_0x406e3c){return _0x406e3c[_0xf550('0x22')]()[_0xf550('0x23')](function(){_0x410430[_0xf550('0x19')](0xcc)[_0xf550('0x18')]();});}};}function handleEntityNotFound(_0x47487a,_0x5c28f9){return function(_0x48d2fc){if(!_0x48d2fc){_0x47487a[_0xf550('0x17')](0x194);}return _0x48d2fc;};}function handleError(_0x4417ca,_0x2cd099){_0x2cd099=_0x2cd099||0x1f4;return function(_0xc6d9a4){logger[_0xf550('0x24')](_0xc6d9a4[_0xf550('0x25')]);if(_0xc6d9a4[_0xf550('0x26')]){delete _0xc6d9a4[_0xf550('0x26')];}_0x4417ca[_0xf550('0x19')](_0x2cd099)['send'](_0xc6d9a4);};}exports[_0xf550('0x27')]=function(_0x8db863,_0x228d09){var _0x5dfd79={},_0xaf07da={},_0x58801c={'count':0x0,'rows':[]};var _0x3177d4=_[_0xf550('0x28')](db['SugarcrmAccount'][_0xf550('0x29')],function(_0x667abb){return{'name':_0x667abb[_0xf550('0x2a')],'type':_0x667abb['type']['key']};});_0xaf07da[_0xf550('0x2b')]=_[_0xf550('0x28')](_0x3177d4,_0xf550('0x26'));_0xaf07da['query']=_[_0xf550('0x2c')](_0x8db863[_0xf550('0x2d')]);_0xaf07da[_0xf550('0x2e')]=_[_0xf550('0x2f')](_0xaf07da[_0xf550('0x2b')],_0xaf07da[_0xf550('0x2d')]);_0x5dfd79['attributes']=_[_0xf550('0x2f')](_0xaf07da[_0xf550('0x2b')],qs[_0xf550('0x30')](_0x8db863[_0xf550('0x2d')]['fields']));_0x5dfd79[_0xf550('0x31')]=_0x5dfd79['attributes'][_0xf550('0x32')]?_0x5dfd79['attributes']:_0xaf07da[_0xf550('0x2b')];if(!_0x8db863[_0xf550('0x2d')][_0xf550('0x33')](_0xf550('0x34'))){_0x5dfd79['limit']=qs['limit'](_0x8db863[_0xf550('0x2d')][_0xf550('0x1c')]);_0x5dfd79[_0xf550('0x1a')]=qs[_0xf550('0x1a')](_0x8db863['query']['offset']);}_0x5dfd79[_0xf550('0x35')]=qs[_0xf550('0x36')](_0x8db863[_0xf550('0x2d')][_0xf550('0x36')]);_0x5dfd79['where']=qs[_0xf550('0x2e')](_['pick'](_0x8db863[_0xf550('0x2d')],_0xaf07da['filters']),_0x3177d4);if(_0x8db863['query']['filter']){_0x5dfd79[_0xf550('0x37')]=_['merge'](_0x5dfd79['where'],{'$or':_[_0xf550('0x28')](_0x3177d4,function(_0x38349a){if(_0x38349a[_0xf550('0x38')]!==_0xf550('0x39')){var _0xc0838d={};_0xc0838d[_0x38349a[_0xf550('0x26')]]={'$like':'%'+_0x8db863[_0xf550('0x2d')][_0xf550('0x3a')]+'%'};return _0xc0838d;}})});}_0x5dfd79=_[_0xf550('0x3b')]({},_0x5dfd79,_0x8db863[_0xf550('0x3c')]);var _0x378326={'where':_0x5dfd79['where']};return db[_0xf550('0x3d')][_0xf550('0x1d')](_0x378326)[_0xf550('0x23')](function(_0x56fcf6){_0x58801c['count']=_0x56fcf6;if(_0x8db863[_0xf550('0x2d')][_0xf550('0x3e')]){_0x5dfd79['include']=[{'all':!![]}];}return db[_0xf550('0x3d')][_0xf550('0x3f')](_0x5dfd79);})[_0xf550('0x23')](function(_0x46c350){_0x58801c[_0xf550('0x40')]=_0x46c350;return _0x58801c;})[_0xf550('0x23')](respondWithFilteredResult(_0x228d09,_0x5dfd79))[_0xf550('0x41')](handleError(_0x228d09,null));};exports[_0xf550('0x42')]=function(_0x25feb9,_0xa3446b){var _0x1cf79a={'raw':![],'where':{'id':_0x25feb9[_0xf550('0x43')]['id']}},_0x192b67={};_0x192b67['model']=_['keys'](db[_0xf550('0x3d')]['rawAttributes']);_0x192b67[_0xf550('0x2d')]=_[_0xf550('0x2c')](_0x25feb9[_0xf550('0x2d')]);_0x192b67[_0xf550('0x2e')]=_[_0xf550('0x2f')](_0x192b67['model'],_0x192b67['query']);_0x1cf79a['attributes']=_[_0xf550('0x2f')](_0x192b67[_0xf550('0x2b')],qs[_0xf550('0x30')](_0x25feb9['query'][_0xf550('0x30')]));_0x1cf79a[_0xf550('0x31')]=_0x1cf79a[_0xf550('0x31')][_0xf550('0x32')]?_0x1cf79a[_0xf550('0x31')]:_0x192b67['model'];if(_0x25feb9[_0xf550('0x2d')]['includeAll']){_0x1cf79a[_0xf550('0x44')]=[{'all':!![]}];}_0x1cf79a=_[_0xf550('0x3b')]({},_0x1cf79a,_0x25feb9[_0xf550('0x3c')]);return db[_0xf550('0x3d')][_0xf550('0x45')](_0x1cf79a)['then'](handleEntityNotFound(_0xa3446b,null))[_0xf550('0x23')](respondWithResult(_0xa3446b,null))[_0xf550('0x41')](handleError(_0xa3446b,null));};exports[_0xf550('0x46')]=function(_0x4cd3ff,_0x11ae31){return db[_0xf550('0x3d')]['create'](_0x4cd3ff[_0xf550('0x47')],{})[_0xf550('0x23')](respondWithResult(_0x11ae31,0xc9))['catch'](handleError(_0x11ae31,null));};exports[_0xf550('0x48')]=function(_0x11553b,_0x58a2e9){if(_0x11553b[_0xf550('0x47')]['id']){delete _0x11553b[_0xf550('0x47')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x11553b[_0xf550('0x43')]['id']}})['then'](handleEntityNotFound(_0x58a2e9,null))['then'](saveUpdates(_0x11553b[_0xf550('0x47')],null))[_0xf550('0x23')](respondWithResult(_0x58a2e9,null))[_0xf550('0x41')](handleError(_0x58a2e9,null));};exports[_0xf550('0x22')]=function(_0x55857d,_0x244865){return db[_0xf550('0x3d')][_0xf550('0x45')]({'where':{'id':_0x55857d[_0xf550('0x43')]['id']}})[_0xf550('0x23')](handleEntityNotFound(_0x244865,null))['then'](removeEntity(_0x244865,null))['catch'](handleError(_0x244865,null));};exports['getConfigurations']=function(_0x2d91f3,_0x246bb3,_0x332c17){var _0x1596f1={};var _0x43a624={};var _0x58e746;var _0x237c53;return db[_0xf550('0x3d')][_0xf550('0x49')]({'where':{'id':_0x2d91f3[_0xf550('0x43')]['id']}})[_0xf550('0x23')](handleEntityNotFound(_0x246bb3,null))[_0xf550('0x23')](function(_0x9242ef){if(_0x9242ef){_0x58e746=_0x9242ef;_0x43a624[_0xf550('0x2b')]=_[_0xf550('0x2c')](db[_0xf550('0x4a')][_0xf550('0x29')]);_0x43a624[_0xf550('0x2d')]=_[_0xf550('0x2c')](_0x2d91f3[_0xf550('0x2d')]);_0x43a624[_0xf550('0x2e')]=_[_0xf550('0x2f')](_0x43a624[_0xf550('0x2b')],_0x43a624[_0xf550('0x2d')]);_0x1596f1[_0xf550('0x31')]=_[_0xf550('0x2f')](_0x43a624[_0xf550('0x2b')],qs[_0xf550('0x30')](_0x2d91f3[_0xf550('0x2d')]['fields']));_0x1596f1[_0xf550('0x31')]=_0x1596f1[_0xf550('0x31')][_0xf550('0x32')]?_0x1596f1[_0xf550('0x31')]:_0x43a624[_0xf550('0x2b')];_0x1596f1['order']=qs['sort'](_0x2d91f3[_0xf550('0x2d')][_0xf550('0x36')]);_0x1596f1[_0xf550('0x37')]=qs[_0xf550('0x2e')](_['pick'](_0x2d91f3[_0xf550('0x2d')],_0x43a624[_0xf550('0x2e')]));if(_0x2d91f3['query'][_0xf550('0x3a')]){_0x1596f1[_0xf550('0x37')]=_['merge'](_0x1596f1['where'],{'$or':_[_0xf550('0x28')](_0x1596f1[_0xf550('0x31')],function(_0x46d8cf){var _0x494bd3={};_0x494bd3[_0x46d8cf]={'$like':'%'+_0x2d91f3['query'][_0xf550('0x3a')]+'%'};return _0x494bd3;})});}_0x1596f1=_[_0xf550('0x3b')]({},_0x1596f1,_0x2d91f3[_0xf550('0x3c')]);return _0x58e746['getConfigurations'](_0x1596f1);}})[_0xf550('0x23')](function(_0x123d3a){if(_0x123d3a){_0x237c53=_0x123d3a[_0xf550('0x32')];if(!_0x2d91f3[_0xf550('0x2d')][_0xf550('0x33')](_0xf550('0x34'))){_0x1596f1[_0xf550('0x1c')]=qs['limit'](_0x2d91f3[_0xf550('0x2d')][_0xf550('0x1c')]);_0x1596f1['offset']=qs['offset'](_0x2d91f3[_0xf550('0x2d')][_0xf550('0x1a')]);}return _0x58e746[_0xf550('0x4b')](_0x1596f1);}})[_0xf550('0x23')](function(_0x28a72c){if(_0x28a72c){return _0x28a72c?{'count':_0x237c53,'rows':_0x28a72c}:null;}})[_0xf550('0x23')](respondWithResult(_0x246bb3,null))[_0xf550('0x41')](handleError(_0x246bb3,null));};exports['addConfiguration']=function(_0x4ca8e8,_0x4169bf,_0x1b9dd0){if(_0x4ca8e8[_0xf550('0x47')]['id']){delete _0x4ca8e8['body']['id'];}return db[_0xf550('0x3d')][_0xf550('0x49')]({'where':{'id':_0x4ca8e8['params']['id']}})[_0xf550('0x23')](handleEntityNotFound(_0x4169bf,null))[_0xf550('0x23')](function(_0x13a49c){if(_0x13a49c){_0x4ca8e8[_0xf550('0x47')][_0xf550('0x4c')]=_0x13a49c['id'];_0x4ca8e8[_0xf550('0x47')][_0xf550('0x4d')]=integrations['getSubjects'](_0x4ca8e8[_0xf550('0x47')][_0xf550('0x4e')],_0x4ca8e8['body'][_0xf550('0x38')]);_0x4ca8e8[_0xf550('0x47')][_0xf550('0x4f')]=integrations[_0xf550('0x50')](_0x4ca8e8[_0xf550('0x47')][_0xf550('0x4e')],_0x4ca8e8['body'][_0xf550('0x38')]);return db[_0xf550('0x4a')][_0xf550('0x46')](_0x4ca8e8[_0xf550('0x47')],{'include':[{'model':db[_0xf550('0x51')],'as':_0xf550('0x4d')},{'model':db[_0xf550('0x51')],'as':'Descriptions'}]});}return null;})[_0xf550('0x23')](respondWithResult(_0x4169bf,null))[_0xf550('0x41')](handleError(_0x4169bf,null));};exports[_0xf550('0x52')]=function(_0x420c6c,_0x539266,_0x5baa80){var _0x59df6c='';var _0x32e069=['id',_0xf550('0x26'),'assigned_user_id',_0xf550('0x53'),_0xf550('0x54'),_0xf550('0x55'),_0xf550('0x56'),'duration_minutes',_0xf550('0x57'),'parent_type',_0xf550('0x58'),'direction'];return db['SugarcrmAccount'][_0xf550('0x49')]({'where':{'id':_0x420c6c['params']['id']},'attributes':['id','username',_0xf550('0x59'),'remoteUri']})['then'](handleEntityNotFound(_0x539266,null))[_0xf550('0x23')](function(_0x5c62dd){if(_0x5c62dd){_0x59df6c=_0x5c62dd['remoteUri'];var _0x1f63c5=_0x59df6c[_0xf550('0x5a')](-0x1);if(_0x1f63c5==='/'){_0x59df6c=_0x59df6c[_0xf550('0x5b')](0x0,_0x59df6c['lastIndexOf'](_0x1f63c5));}return rp({'method':_0xf550('0x5c'),'uri':util['format'](_0xf550('0x5d'),_0x59df6c,_0xf550('0x5e')),'json':!![],'form':{'method':_0xf550('0x5f'),'input_type':'JSON','response_type':_0xf550('0x60'),'rest_data':JSON[_0xf550('0x61')]({'user_auth':{'user_name':_0x5c62dd['username'],'password':_0x5c62dd[_0xf550('0x59')],'encryption':_0xf550('0x62')},'application':_0xf550('0x63')})}});}})['then'](function(_0x21ad3b){if(_0x21ad3b&&_0x21ad3b[_0xf550('0x26')]!==_0xf550('0x64')&&_0x21ad3b[_0xf550('0x26')]!==_0xf550('0x65')){return rp({'method':_0xf550('0x5c'),'uri':util[_0xf550('0x66')]('%s%s',_0x59df6c,_0xf550('0x5e')),'json':!![],'form':{'method':_0xf550('0x67'),'input_type':_0xf550('0x60'),'response_type':_0xf550('0x60'),'rest_data':JSON[_0xf550('0x61')]({'session':_0x21ad3b['id'],'module_name':_0xf550('0x68')})}})[_0xf550('0x23')](function(_0x2f18c1){if(_0x2f18c1){var _0x2366c9=_[_0xf550('0x69')](_0x2f18c1[_0xf550('0x6a')]);_[_0xf550('0x6b')](_0x2366c9,function(_0x3dd530){return _0x32e069['includes'](_0x3dd530[_0xf550('0x26')]);});return{'count':_0x2366c9[_0xf550('0x32')],'rows':_[_0xf550('0x28')](_0x2366c9,function(_0x2b0b6b){return{'id':_0x2b0b6b[_0xf550('0x26')],'name':_0x2b0b6b[_0xf550('0x6c')],'custom':_['endsWith'](_0x2b0b6b[_0xf550('0x26')],'_c')?!![]:![],'options':_0x2b0b6b[_0xf550('0x3c')]?_[_0xf550('0x28')](_[_0xf550('0x69')](_0x2b0b6b[_0xf550('0x3c')]),function(_0x2bfd51){return{'name':_0x2bfd51[_0xf550('0x6d')],'value':_0x2bfd51['name']};}):[]};})};}})[_0xf550('0x23')](respondWithResult(_0x539266,null))[_0xf550('0x41')](function(_0x4abc36){var _0xb72bbb=_0x420c6c[_0xf550('0x2d')][_0xf550('0x6e')]?0x1f4:_0x4abc36['statusCode']||0x1f4;logger[_0xf550('0x24')](_0xf550('0x6f'),_0xf550('0x52'),_0xb72bbb,JSON[_0xf550('0x61')](_0x4abc36));delete _0x4abc36['name'];if(_0xb72bbb===0x191){_0xb72bbb=0x190;}_0x539266[_0xf550('0x19')](_0xb72bbb)[_0xf550('0x70')](_0x420c6c['query']['test']?{'message':_0xf550('0x71'),'statusCode':_0x4abc36[_0xf550('0x72')]}:_0x4abc36);});}else{var _0x404226=0x1f4;_0x539266['status'](_0x404226)[_0xf550('0x70')]({'message':_0xf550('0x71'),'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 24f9891..cea746a 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 _0xc740=['request-promise','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment'];(function(_0x5c364f,_0x44e62e){var _0x431172=function(_0x71de24){while(--_0x71de24){_0x5c364f['push'](_0x5c364f['shift']());}};_0x431172(++_0x44e62e);}(_0xc740,0xba));var _0x0c74=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc740[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0c74('0x0'));var logger=require(_0x0c74('0x1'))(_0x0c74('0x2'));var moment=require(_0x0c74('0x3'));var BPromise=require('bluebird');var rp=require(_0x0c74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0c74('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x0c74('0x6'));module[_0x0c74('0x7')]=function(_0x20eba5,_0x541fc1){return _0x20eba5['define'](_0x0c74('0x8'),attributes,{'tableName':_0x0c74('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0d2=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb0d2,0x1b4));var _0x2b0d=function(_0xc4a89a,_0x322f6a){_0xc4a89a=_0xc4a89a-0x0;var _0x13f7bc=_0xb0d2[_0xc4a89a];return _0x13f7bc;};'use strict';var _=require(_0x2b0d('0x0'));var util=require('util');var logger=require(_0x2b0d('0x1'))(_0x2b0d('0x2'));var moment=require(_0x2b0d('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b0d('0x4'));var fs=require('fs');var path=require(_0x2b0d('0x5'));var rimraf=require(_0x2b0d('0x6'));var config=require(_0x2b0d('0x7'));var attributes=require(_0x2b0d('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x2b0d('0x9')]=function(_0x13b580,_0x322c50){return _0x13b580[_0x2b0d('0xa')](_0x2b0d('0xb'),attributes,{'tableName':_0x2b0d('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 b8d47f4..8878db4 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 _0xfc76=['http','request','then','info','request\x20sent','debug','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','map','include','model','catch','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xde1b5,_0x291eca){var _0x52cd92=function(_0x4e02f7){while(--_0x4e02f7){_0xde1b5['push'](_0xde1b5['shift']());}};_0x52cd92(++_0x291eca);}(_0xfc76,0xa8));var _0x6fc7=function(_0x3667c5,_0xae6429){_0x3667c5=_0x3667c5-0x0;var _0x7fdf5c=_0xfc76[_0x3667c5];return _0x7fdf5c;};'use strict';var _=require(_0x6fc7('0x0'));var util=require(_0x6fc7('0x1'));var moment=require(_0x6fc7('0x2'));var BPromise=require(_0x6fc7('0x3'));var rs=require(_0x6fc7('0x4'));var fs=require('fs');var Redis=require(_0x6fc7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fc7('0x6'));var logger=require(_0x6fc7('0x7'))(_0x6fc7('0x8'));var config=require(_0x6fc7('0x9'));var jayson=require(_0x6fc7('0xa'));var client=jayson[_0x6fc7('0xb')][_0x6fc7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b6aa0,_0x56bf7d,_0x2b01dd){return new BPromise(function(_0x45d8a2,_0x2168de){return client[_0x6fc7('0xd')](_0x3b6aa0,_0x2b01dd)[_0x6fc7('0xe')](function(_0x307c17){logger[_0x6fc7('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x56bf7d,_0x6fc7('0x10'));logger[_0x6fc7('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x56bf7d,_0x6fc7('0x10'),JSON['stringify'](_0x307c17));if(_0x307c17[_0x6fc7('0x12')]){if(_0x307c17[_0x6fc7('0x12')][_0x6fc7('0x13')]===0x1f4){logger['error'](_0x6fc7('0x14'),_0x56bf7d,_0x307c17[_0x6fc7('0x12')][_0x6fc7('0x15')]);return _0x2168de(_0x307c17[_0x6fc7('0x12')][_0x6fc7('0x15')]);}logger[_0x6fc7('0x12')](_0x6fc7('0x14'),_0x56bf7d,_0x307c17[_0x6fc7('0x12')][_0x6fc7('0x15')]);return _0x45d8a2(_0x307c17['error'][_0x6fc7('0x15')]);}else{logger[_0x6fc7('0xf')](_0x6fc7('0x14'),_0x56bf7d,_0x6fc7('0x10'));_0x45d8a2(_0x307c17[_0x6fc7('0x16')][_0x6fc7('0x15')]);}})['catch'](function(_0xb8522c){logger[_0x6fc7('0x12')](_0x6fc7('0x14'),_0x56bf7d,_0xb8522c);_0x2168de(_0xb8522c);});});}exports[_0x6fc7('0x17')]=function(_0x562a02){var _0x485e31=this;return new Promise(function(_0x27b2b3,_0x1c9ff2){return db[_0x6fc7('0x18')][_0x6fc7('0x19')]({'raw':_0x562a02[_0x6fc7('0x1a')]?_0x562a02[_0x6fc7('0x1a')][_0x6fc7('0x1b')]===undefined?!![]:![]:!![],'where':_0x562a02[_0x6fc7('0x1a')]?_0x562a02[_0x6fc7('0x1a')][_0x6fc7('0x1c')]||null:null,'attributes':_0x562a02['options']?_0x562a02['options'][_0x6fc7('0x1d')]||null:null,'limit':_0x562a02[_0x6fc7('0x1a')]?_0x562a02[_0x6fc7('0x1a')]['limit']||null:null,'include':_0x562a02[_0x6fc7('0x1a')]?_0x562a02[_0x6fc7('0x1a')]['include']?_[_0x6fc7('0x1e')](_0x562a02[_0x6fc7('0x1a')][_0x6fc7('0x1f')],function(_0xe63902){return{'model':db[_0xe63902['model']],'as':_0xe63902['as'],'attributes':_0xe63902['attributes'],'include':_0xe63902[_0x6fc7('0x1f')]?_[_0x6fc7('0x1e')](_0xe63902['include'],function(_0x3111f2){return{'model':db[_0x3111f2[_0x6fc7('0x20')]],'as':_0x3111f2['as'],'attributes':_0x3111f2[_0x6fc7('0x1d')],'include':_0x3111f2[_0x6fc7('0x1f')]?_['map'](_0x3111f2['include'],function(_0x21d73e){return{'model':db[_0x21d73e[_0x6fc7('0x20')]],'as':_0x21d73e['as'],'attributes':_0x21d73e[_0x6fc7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x397b74){logger[_0x6fc7('0xf')]('GetSugarcrmAccount',_0x562a02);logger[_0x6fc7('0x11')]('GetSugarcrmAccount',_0x562a02,JSON['stringify'](_0x397b74));_0x27b2b3(_0x397b74);})[_0x6fc7('0x21')](function(_0x1aa101){logger[_0x6fc7('0x12')]('GetSugarcrmAccount',_0x1aa101[_0x6fc7('0x15')],_0x562a02);_0x1c9ff2(_0x485e31['error'](0x1f4,_0x1aa101[_0x6fc7('0x15')]));});});};exports[_0x6fc7('0x22')]=function(_0x3f972e){var _0x5a931b=this;return new Promise(function(_0x3d857c,_0xecf742){return db[_0x6fc7('0x18')][_0x6fc7('0x23')]({'raw':_0x3f972e[_0x6fc7('0x1a')]?_0x3f972e[_0x6fc7('0x1a')][_0x6fc7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f972e[_0x6fc7('0x1a')]?_0x3f972e[_0x6fc7('0x1a')][_0x6fc7('0x1c')]||null:null,'attributes':_0x3f972e[_0x6fc7('0x1a')]?_0x3f972e['options'][_0x6fc7('0x1d')]||null:null,'include':_0x3f972e[_0x6fc7('0x1a')]?_0x3f972e[_0x6fc7('0x1a')][_0x6fc7('0x1f')]?_[_0x6fc7('0x1e')](_0x3f972e[_0x6fc7('0x1a')][_0x6fc7('0x1f')],function(_0x3d548d){return{'model':db[_0x3d548d[_0x6fc7('0x20')]],'as':_0x3d548d['as'],'attributes':_0x3d548d[_0x6fc7('0x1d')],'include':_0x3d548d[_0x6fc7('0x1f')]?_[_0x6fc7('0x1e')](_0x3d548d[_0x6fc7('0x1f')],function(_0x576ef0){return{'model':db[_0x576ef0['model']],'as':_0x576ef0['as'],'attributes':_0x576ef0[_0x6fc7('0x1d')],'include':_0x576ef0['include']?_[_0x6fc7('0x1e')](_0x576ef0[_0x6fc7('0x1f')],function(_0x30e8fe){return{'model':db[_0x30e8fe[_0x6fc7('0x20')]],'as':_0x30e8fe['as'],'attributes':_0x30e8fe[_0x6fc7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6fc7('0xe')](function(_0x5ecd71){logger[_0x6fc7('0xf')]('ShowSugarcrmAccount',_0x3f972e);logger[_0x6fc7('0x11')]('ShowSugarcrmAccount',_0x3f972e,JSON['stringify'](_0x5ecd71));_0x3d857c(_0x5ecd71);})[_0x6fc7('0x21')](function(_0x2e9f2c){logger[_0x6fc7('0x12')](_0x6fc7('0x22'),_0x2e9f2c[_0x6fc7('0x15')],_0x3f972e);_0xecf742(_0x5a931b[_0x6fc7('0x12')](0x1f4,_0x2e9f2c[_0x6fc7('0x15')]));});});}; \ No newline at end of file +var _0x59fd=['SugarcrmAccount,\x20%s,\x20%s','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','include','map','model','find','raw','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x388955,_0x562229){var _0x21c4e9=function(_0x29a9ef){while(--_0x29a9ef){_0x388955['push'](_0x388955['shift']());}};_0x21c4e9(++_0x562229);}(_0x59fd,0x1ee));var _0xd59f=function(_0x57f272,_0x357bc6){_0x57f272=_0x57f272-0x0;var _0x122384=_0x59fd[_0x57f272];return _0x122384;};'use strict';var _=require(_0xd59f('0x0'));var util=require('util');var moment=require(_0xd59f('0x1'));var BPromise=require(_0xd59f('0x2'));var rs=require(_0xd59f('0x3'));var fs=require('fs');var Redis=require(_0xd59f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd59f('0x5'))(_0xd59f('0x6'));var config=require('../../config/environment');var jayson=require(_0xd59f('0x7'));var client=jayson['client'][_0xd59f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3da6d6,_0x1890cc,_0x38ab8a){return new BPromise(function(_0x5cb44c,_0x32a6d0){return client[_0xd59f('0x9')](_0x3da6d6,_0x38ab8a)[_0xd59f('0xa')](function(_0x503f59){logger[_0xd59f('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x1890cc,_0xd59f('0xc'));logger[_0xd59f('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1890cc,_0xd59f('0xc'),JSON[_0xd59f('0xe')](_0x503f59));if(_0x503f59[_0xd59f('0xf')]){if(_0x503f59[_0xd59f('0xf')]['code']===0x1f4){logger['error'](_0xd59f('0x10'),_0x1890cc,_0x503f59[_0xd59f('0xf')]['message']);return _0x32a6d0(_0x503f59['error'][_0xd59f('0x11')]);}logger[_0xd59f('0xf')](_0xd59f('0x10'),_0x1890cc,_0x503f59[_0xd59f('0xf')][_0xd59f('0x11')]);return _0x5cb44c(_0x503f59['error'][_0xd59f('0x11')]);}else{logger['info'](_0xd59f('0x10'),_0x1890cc,'request\x20sent');_0x5cb44c(_0x503f59['result'][_0xd59f('0x11')]);}})[_0xd59f('0x12')](function(_0x24195e){logger[_0xd59f('0xf')](_0xd59f('0x10'),_0x1890cc,_0x24195e);_0x32a6d0(_0x24195e);});});}exports[_0xd59f('0x13')]=function(_0x255213){var _0x52099d=this;return new Promise(function(_0x5bca88,_0x389833){return db[_0xd59f('0x14')]['findAll']({'raw':_0x255213[_0xd59f('0x15')]?_0x255213['options']['raw']===undefined?!![]:![]:!![],'where':_0x255213['options']?_0x255213[_0xd59f('0x15')][_0xd59f('0x16')]||null:null,'attributes':_0x255213[_0xd59f('0x15')]?_0x255213['options'][_0xd59f('0x17')]||null:null,'limit':_0x255213[_0xd59f('0x15')]?_0x255213['options']['limit']||null:null,'include':_0x255213[_0xd59f('0x15')]?_0x255213['options'][_0xd59f('0x18')]?_[_0xd59f('0x19')](_0x255213[_0xd59f('0x15')]['include'],function(_0x5dcb2c){return{'model':db[_0x5dcb2c['model']],'as':_0x5dcb2c['as'],'attributes':_0x5dcb2c[_0xd59f('0x17')],'include':_0x5dcb2c[_0xd59f('0x18')]?_[_0xd59f('0x19')](_0x5dcb2c['include'],function(_0x1d17da){return{'model':db[_0x1d17da[_0xd59f('0x1a')]],'as':_0x1d17da['as'],'attributes':_0x1d17da['attributes'],'include':_0x1d17da[_0xd59f('0x18')]?_[_0xd59f('0x19')](_0x1d17da[_0xd59f('0x18')],function(_0x5ac136){return{'model':db[_0x5ac136['model']],'as':_0x5ac136['as'],'attributes':_0x5ac136[_0xd59f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd59f('0xa')](function(_0x49db2f){logger[_0xd59f('0xb')]('GetSugarcrmAccount',_0x255213);logger['debug']('GetSugarcrmAccount',_0x255213,JSON[_0xd59f('0xe')](_0x49db2f));_0x5bca88(_0x49db2f);})[_0xd59f('0x12')](function(_0xc508d1){logger[_0xd59f('0xf')](_0xd59f('0x13'),_0xc508d1[_0xd59f('0x11')],_0x255213);_0x389833(_0x52099d[_0xd59f('0xf')](0x1f4,_0xc508d1[_0xd59f('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0xd1e7c5){var _0x5914bd=this;return new Promise(function(_0x36e4da,_0x945bfb){return db[_0xd59f('0x14')][_0xd59f('0x1b')]({'raw':_0xd1e7c5['options']?_0xd1e7c5[_0xd59f('0x15')][_0xd59f('0x1c')]===undefined?!![]:![]:!![],'where':_0xd1e7c5['options']?_0xd1e7c5[_0xd59f('0x15')][_0xd59f('0x16')]||null:null,'attributes':_0xd1e7c5[_0xd59f('0x15')]?_0xd1e7c5[_0xd59f('0x15')][_0xd59f('0x17')]||null:null,'include':_0xd1e7c5[_0xd59f('0x15')]?_0xd1e7c5[_0xd59f('0x15')][_0xd59f('0x18')]?_[_0xd59f('0x19')](_0xd1e7c5['options'][_0xd59f('0x18')],function(_0x4dd6f4){return{'model':db[_0x4dd6f4[_0xd59f('0x1a')]],'as':_0x4dd6f4['as'],'attributes':_0x4dd6f4['attributes'],'include':_0x4dd6f4[_0xd59f('0x18')]?_[_0xd59f('0x19')](_0x4dd6f4[_0xd59f('0x18')],function(_0x2f3370){return{'model':db[_0x2f3370['model']],'as':_0x2f3370['as'],'attributes':_0x2f3370[_0xd59f('0x17')],'include':_0x2f3370['include']?_[_0xd59f('0x19')](_0x2f3370[_0xd59f('0x18')],function(_0x5d9ba2){return{'model':db[_0x5d9ba2[_0xd59f('0x1a')]],'as':_0x5d9ba2['as'],'attributes':_0x5d9ba2[_0xd59f('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x87e2eb){logger[_0xd59f('0xb')](_0xd59f('0x1d'),_0xd1e7c5);logger[_0xd59f('0xd')](_0xd59f('0x1d'),_0xd1e7c5,JSON[_0xd59f('0xe')](_0x87e2eb));_0x36e4da(_0x87e2eb);})['catch'](function(_0x31f8fe){logger[_0xd59f('0xf')]('ShowSugarcrmAccount',_0x31f8fe[_0xd59f('0x11')],_0xd1e7c5);_0x945bfb(_0x5914bd[_0xd59f('0xf')](0x1f4,_0x31f8fe[_0xd59f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 65a6755..af0ff0c 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 _0x8b48=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','destroy','exports'];(function(_0x48665b,_0xee1856){var _0x19dfb7=function(_0x2f6256){while(--_0x2f6256){_0x48665b['push'](_0x48665b['shift']());}};_0x19dfb7(++_0xee1856);}(_0x8b48,0x1a4));var _0x88b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b48[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x88b4('0x0'));var path=require(_0x88b4('0x1'));var timeout=require(_0x88b4('0x2'));var express=require(_0x88b4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x88b4('0x4'));var interaction=require(_0x88b4('0x5'));var config=require(_0x88b4('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x88b4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88b4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x88b4('0x8')]);router[_0x88b4('0x7')](_0x88b4('0x9'),auth[_0x88b4('0xa')](),controller[_0x88b4('0xb')]);router[_0x88b4('0x7')](_0x88b4('0xc'),auth[_0x88b4('0xa')](),controller['getSubjects']);router[_0x88b4('0x7')](_0x88b4('0xd'),auth['isAuthenticated'](),controller[_0x88b4('0xe')]);router[_0x88b4('0xf')]('/',auth[_0x88b4('0xa')](),controller[_0x88b4('0x10')]);router[_0x88b4('0x11')](_0x88b4('0x12'),auth[_0x88b4('0xa')](),controller['update']);router['delete'](_0x88b4('0x12'),auth[_0x88b4('0xa')](),controller[_0x88b4('0x13')]);module[_0x88b4('0x14')]=router; \ No newline at end of file +var _0x4021=['./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/subjects','getSubjects','getDescriptions','post','create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2e00fe,_0x1f9067){var _0x47a122=function(_0xda6aed){while(--_0xda6aed){_0x2e00fe['push'](_0x2e00fe['shift']());}};_0x47a122(++_0x1f9067);}(_0x4021,0xb5));var _0x1402=function(_0x3b2421,_0xf30f91){_0x3b2421=_0x3b2421-0x0;var _0x288bde=_0x4021[_0x3b2421];return _0x288bde;};'use strict';var multer=require(_0x1402('0x0'));var util=require(_0x1402('0x1'));var path=require(_0x1402('0x2'));var timeout=require(_0x1402('0x3'));var express=require(_0x1402('0x4'));var router=express[_0x1402('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1402('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1402('0x7'));var controller=require(_0x1402('0x8'));router['get']('/',auth[_0x1402('0x9')](),controller[_0x1402('0xa')]);router['get'](_0x1402('0xb'),auth[_0x1402('0x9')](),controller[_0x1402('0xc')]);router[_0x1402('0xd')]('/:id/fields',auth[_0x1402('0x9')](),controller['getFields']);router[_0x1402('0xd')](_0x1402('0xe'),auth[_0x1402('0x9')](),controller[_0x1402('0xf')]);router['get']('/:id/descriptions',auth[_0x1402('0x9')](),controller[_0x1402('0x10')]);router[_0x1402('0x11')]('/',auth[_0x1402('0x9')](),controller[_0x1402('0x12')]);router['put'](_0x1402('0xb'),auth[_0x1402('0x9')](),controller[_0x1402('0x13')]);router['delete'](_0x1402('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1402('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 32b3983..e862b3c 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 _0x9082=['sequelize','exports','STRING'];(function(_0x1b5e22,_0x41a022){var _0x54f55f=function(_0x432fae){while(--_0x432fae){_0x1b5e22['push'](_0x1b5e22['shift']());}};_0x54f55f(++_0x41a022);}(_0x9082,0x8a));var _0x2908=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x9082[_0x1488cd];return _0x63fa13;};'use strict';var Sequelize=require(_0x2908('0x0'));module[_0x2908('0x1')]={'name':{'type':Sequelize[_0x2908('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe580=['sequelize','exports','STRING'];(function(_0x2df288,_0x2ff7bb){var _0x3046f3=function(_0x4a6329){while(--_0x4a6329){_0x2df288['push'](_0x2df288['shift']());}};_0x3046f3(++_0x2ff7bb);}(_0xe580,0xd2));var _0x0e58=function(_0x5af48b,_0x20cb07){_0x5af48b=_0x5af48b-0x0;var _0x29f85e=_0xe580[_0x5af48b];return _0x29f85e;};'use strict';var Sequelize=require(_0x0e58('0x0'));module[_0x0e58('0x1')]={'name':{'type':Sequelize[_0x0e58('0x2')]},'description':{'type':Sequelize[_0x0e58('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6d358c1..1c85ecd 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 _0x8a51=['eml-format','rimraf','fast-json-patch','moment','bluebird','path','ejs','lodash','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','model','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','update','find','getFields','findOne','SugarcrmField','length','nolimit','getSubjects','getDescriptions'];(function(_0x14591c,_0x1e0b35){var _0x1a6205=function(_0x5995c9){while(--_0x5995c9){_0x14591c['push'](_0x14591c['shift']());}};_0x1a6205(++_0x1e0b35);}(_0x8a51,0x124));var _0x18a5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x8a51[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x18a5('0x0'));var rimraf=require(_0x18a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x18a5('0x2'));var rp=require('request-promise');var moment=require(_0x18a5('0x3'));var BPromise=require(_0x18a5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x18a5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x18a5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18a5('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x18a5('0x8'));var deskjs=require(_0x18a5('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x18a5('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x18a5('0xb'));var hardwareService=require(_0x18a5('0xc'));var logger=require('../../config/logger')(_0x18a5('0xd'));var utils=require(_0x18a5('0xe'));var config=require(_0x18a5('0xf'));var licenseUtil=require(_0x18a5('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7bab,_0x161b2d){_0x161b2d=_0x161b2d||0xcc;return function(_0x5b60e4){if(_0x5b60e4){return _0x3c7bab['sendStatus'](_0x161b2d);}return _0x3c7bab[_0x18a5('0x11')](_0x161b2d)['end']();};}function respondWithResult(_0x2dba50,_0x2bf0e0){_0x2bf0e0=_0x2bf0e0||0xc8;return function(_0xe073de){if(_0xe073de){return _0x2dba50[_0x18a5('0x11')](_0x2bf0e0)['json'](_0xe073de);}};}function respondWithFilteredResult(_0x321ebe,_0xcafd34){return function(_0x4626e4){if(_0x4626e4){var _0x13d69b=typeof _0xcafd34['offset']==='undefined'&&typeof _0xcafd34['limit']===_0x18a5('0x12');var _0x1a20d2=_0x4626e4[_0x18a5('0x13')];var _0xbe5902=_0x13d69b?0x0:_0xcafd34[_0x18a5('0x14')];var _0x22b8ff=_0x13d69b?_0x4626e4[_0x18a5('0x13')]:_0xcafd34[_0x18a5('0x14')]+_0xcafd34[_0x18a5('0x15')];var _0x3ceeed;if(_0x22b8ff>=_0x1a20d2){_0x22b8ff=_0x1a20d2;_0x3ceeed=0xc8;}else{_0x3ceeed=0xce;}_0x321ebe[_0x18a5('0x11')](_0x3ceeed);return _0x321ebe[_0x18a5('0x16')](_0x18a5('0x17'),_0xbe5902+'-'+_0x22b8ff+'/'+_0x1a20d2)['json'](_0x4626e4);}return null;};}function patchUpdates(_0x5e1ac8){return function(_0x5c4af7){try{jsonpatch[_0x18a5('0x18')](_0x5c4af7,_0x5e1ac8,!![]);}catch(_0x4b80b5){return BPromise[_0x18a5('0x19')](_0x4b80b5);}return _0x5c4af7[_0x18a5('0x1a')]();};}function saveUpdates(_0x9d279a,_0x3687c8){return function(_0x3063bd){if(_0x3063bd){return _0x3063bd['update'](_0x9d279a)[_0x18a5('0x1b')](function(_0x41d8a5){return _0x41d8a5;});}return null;};}function removeEntity(_0x29e8b7,_0x97f5a6){return function(_0x521e78){if(_0x521e78){return _0x521e78[_0x18a5('0x1c')]()[_0x18a5('0x1b')](function(){_0x29e8b7[_0x18a5('0x11')](0xcc)[_0x18a5('0x1d')]();});}};}function handleEntityNotFound(_0x51c0ef,_0x5406d5){return function(_0x553c72){if(!_0x553c72){_0x51c0ef[_0x18a5('0x1e')](0x194);}return _0x553c72;};}function handleError(_0x242d9a,_0x448966){_0x448966=_0x448966||0x1f4;return function(_0x125310){logger['error'](_0x125310['stack']);if(_0x125310[_0x18a5('0x1f')]){delete _0x125310[_0x18a5('0x1f')];}_0x242d9a[_0x18a5('0x11')](_0x448966)[_0x18a5('0x20')](_0x125310);};}exports[_0x18a5('0x21')]=function(_0x16032b,_0x426944){var _0x18b455={},_0x98f812={},_0x2f45={'count':0x0,'rows':[]};var _0x4a584e=_[_0x18a5('0x22')](db[_0x18a5('0x23')][_0x18a5('0x24')],function(_0x3780a3){return{'name':_0x3780a3[_0x18a5('0x25')],'type':_0x3780a3[_0x18a5('0x26')][_0x18a5('0x27')]};});_0x98f812['model']=_[_0x18a5('0x22')](_0x4a584e,_0x18a5('0x1f'));_0x98f812[_0x18a5('0x28')]=_[_0x18a5('0x29')](_0x16032b['query']);_0x98f812['filters']=_[_0x18a5('0x2a')](_0x98f812['model'],_0x98f812[_0x18a5('0x28')]);_0x18b455[_0x18a5('0x2b')]=_['intersection'](_0x98f812['model'],qs[_0x18a5('0x2c')](_0x16032b['query'][_0x18a5('0x2c')]));_0x18b455[_0x18a5('0x2b')]=_0x18b455[_0x18a5('0x2b')]['length']?_0x18b455[_0x18a5('0x2b')]:_0x98f812[_0x18a5('0x2d')];if(!_0x16032b['query'][_0x18a5('0x2e')]('nolimit')){_0x18b455[_0x18a5('0x15')]=qs[_0x18a5('0x15')](_0x16032b[_0x18a5('0x28')][_0x18a5('0x15')]);_0x18b455[_0x18a5('0x14')]=qs[_0x18a5('0x14')](_0x16032b['query'][_0x18a5('0x14')]);}_0x18b455[_0x18a5('0x2f')]=qs[_0x18a5('0x30')](_0x16032b[_0x18a5('0x28')]['sort']);_0x18b455[_0x18a5('0x31')]=qs[_0x18a5('0x32')](_[_0x18a5('0x33')](_0x16032b[_0x18a5('0x28')],_0x98f812[_0x18a5('0x32')]),_0x4a584e);if(_0x16032b[_0x18a5('0x28')]['filter']){_0x18b455['where']=_[_0x18a5('0x34')](_0x18b455[_0x18a5('0x31')],{'$or':_[_0x18a5('0x22')](_0x4a584e,function(_0x399104){if(_0x399104[_0x18a5('0x26')]!=='VIRTUAL'){var _0x55aae4={};_0x55aae4[_0x399104[_0x18a5('0x1f')]]={'$like':'%'+_0x16032b[_0x18a5('0x28')][_0x18a5('0x35')]+'%'};return _0x55aae4;}})});}_0x18b455=_[_0x18a5('0x34')]({},_0x18b455,_0x16032b[_0x18a5('0x36')]);var _0x1d1dd2={'where':_0x18b455[_0x18a5('0x31')]};return db[_0x18a5('0x23')]['count'](_0x1d1dd2)['then'](function(_0x11970c){_0x2f45['count']=_0x11970c;if(_0x16032b[_0x18a5('0x28')][_0x18a5('0x37')]){_0x18b455['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x18a5('0x38')](_0x18b455);})[_0x18a5('0x1b')](function(_0x545b94){_0x2f45[_0x18a5('0x39')]=_0x545b94;return _0x2f45;})['then'](respondWithFilteredResult(_0x426944,_0x18b455))[_0x18a5('0x3a')](handleError(_0x426944,null));};exports[_0x18a5('0x3b')]=function(_0x1351d3,_0x1bb693){var _0x528652={'raw':![],'where':{'id':_0x1351d3[_0x18a5('0x3c')]['id']}},_0x3a5b39={};_0x3a5b39[_0x18a5('0x2d')]=_[_0x18a5('0x29')](db[_0x18a5('0x23')][_0x18a5('0x24')]);_0x3a5b39[_0x18a5('0x28')]=_['keys'](_0x1351d3['query']);_0x3a5b39[_0x18a5('0x32')]=_[_0x18a5('0x2a')](_0x3a5b39[_0x18a5('0x2d')],_0x3a5b39[_0x18a5('0x28')]);_0x528652[_0x18a5('0x2b')]=_[_0x18a5('0x2a')](_0x3a5b39['model'],qs[_0x18a5('0x2c')](_0x1351d3['query'][_0x18a5('0x2c')]));_0x528652[_0x18a5('0x2b')]=_0x528652['attributes']['length']?_0x528652[_0x18a5('0x2b')]:_0x3a5b39['model'];if(_0x1351d3[_0x18a5('0x28')][_0x18a5('0x37')]){_0x528652[_0x18a5('0x3d')]=[{'all':!![]}];}_0x528652=_[_0x18a5('0x34')]({},_0x528652,_0x1351d3['options']);return db['SugarcrmConfiguration']['find'](_0x528652)[_0x18a5('0x1b')](handleEntityNotFound(_0x1bb693,null))['then'](respondWithResult(_0x1bb693,null))[_0x18a5('0x3a')](handleError(_0x1bb693,null));};exports[_0x18a5('0x3e')]=function(_0x5a2bb5,_0x392bc5){return db['SugarcrmConfiguration']['create'](_0x5a2bb5[_0x18a5('0x3f')],{})['then'](respondWithResult(_0x392bc5,0xc9))['catch'](handleError(_0x392bc5,null));};exports[_0x18a5('0x40')]=function(_0x365adb,_0x173d20){if(_0x365adb['body']['id']){delete _0x365adb[_0x18a5('0x3f')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x365adb[_0x18a5('0x3c')]['id']}})[_0x18a5('0x1b')](handleEntityNotFound(_0x173d20,null))['then'](saveUpdates(_0x365adb[_0x18a5('0x3f')],null))['then'](respondWithResult(_0x173d20,null))[_0x18a5('0x3a')](handleError(_0x173d20,null));};exports[_0x18a5('0x1c')]=function(_0x2acc36,_0x56ffe9){return db[_0x18a5('0x23')][_0x18a5('0x41')]({'where':{'id':_0x2acc36[_0x18a5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x56ffe9,null))['then'](removeEntity(_0x56ffe9,null))[_0x18a5('0x3a')](handleError(_0x56ffe9,null));};exports[_0x18a5('0x42')]=function(_0x1075f8,_0x520f67,_0x2388d1){var _0x3b59c4={};var _0x314392={};var _0x4fd1a9;var _0x54e492;return db[_0x18a5('0x23')][_0x18a5('0x43')]({'where':{'id':_0x1075f8[_0x18a5('0x3c')]['id']}})[_0x18a5('0x1b')](handleEntityNotFound(_0x520f67,null))['then'](function(_0xe95325){if(_0xe95325){_0x4fd1a9=_0xe95325;_0x314392[_0x18a5('0x2d')]=_[_0x18a5('0x29')](db[_0x18a5('0x44')][_0x18a5('0x24')]);_0x314392['query']=_['keys'](_0x1075f8[_0x18a5('0x28')]);_0x314392[_0x18a5('0x32')]=_[_0x18a5('0x2a')](_0x314392[_0x18a5('0x2d')],_0x314392[_0x18a5('0x28')]);_0x3b59c4['attributes']=_['intersection'](_0x314392[_0x18a5('0x2d')],qs[_0x18a5('0x2c')](_0x1075f8[_0x18a5('0x28')][_0x18a5('0x2c')]));_0x3b59c4['attributes']=_0x3b59c4[_0x18a5('0x2b')][_0x18a5('0x45')]?_0x3b59c4[_0x18a5('0x2b')]:_0x314392[_0x18a5('0x2d')];_0x3b59c4[_0x18a5('0x2f')]=qs[_0x18a5('0x30')](_0x1075f8[_0x18a5('0x28')][_0x18a5('0x30')]);_0x3b59c4[_0x18a5('0x31')]=qs[_0x18a5('0x32')](_[_0x18a5('0x33')](_0x1075f8[_0x18a5('0x28')],_0x314392['filters']));if(_0x1075f8[_0x18a5('0x28')][_0x18a5('0x35')]){_0x3b59c4[_0x18a5('0x31')]=_['merge'](_0x3b59c4[_0x18a5('0x31')],{'$or':_[_0x18a5('0x22')](_0x3b59c4['attributes'],function(_0x942709){var _0x52c66a={};_0x52c66a[_0x942709]={'$like':'%'+_0x1075f8[_0x18a5('0x28')]['filter']+'%'};return _0x52c66a;})});}_0x3b59c4=_[_0x18a5('0x34')]({},_0x3b59c4,_0x1075f8[_0x18a5('0x36')]);return _0x4fd1a9[_0x18a5('0x42')](_0x3b59c4);}})[_0x18a5('0x1b')](function(_0x3b0c08){if(_0x3b0c08){_0x54e492=_0x3b0c08['length'];if(!_0x1075f8['query'][_0x18a5('0x2e')](_0x18a5('0x46'))){_0x3b59c4[_0x18a5('0x15')]=qs[_0x18a5('0x15')](_0x1075f8['query'][_0x18a5('0x15')]);_0x3b59c4[_0x18a5('0x14')]=qs[_0x18a5('0x14')](_0x1075f8[_0x18a5('0x28')][_0x18a5('0x14')]);}return _0x4fd1a9[_0x18a5('0x42')](_0x3b59c4);}})[_0x18a5('0x1b')](function(_0x5b5a1b){if(_0x5b5a1b){return _0x5b5a1b?{'count':_0x54e492,'rows':_0x5b5a1b}:null;}})[_0x18a5('0x1b')](respondWithResult(_0x520f67,null))[_0x18a5('0x3a')](handleError(_0x520f67,null));};exports['getSubjects']=function(_0x1c39c1,_0x210283,_0x172408){var _0x3499ae={};var _0x45e259={};var _0x198fac;var _0x17de0b;return db['SugarcrmConfiguration'][_0x18a5('0x43')]({'where':{'id':_0x1c39c1[_0x18a5('0x3c')]['id']}})[_0x18a5('0x1b')](handleEntityNotFound(_0x210283,null))[_0x18a5('0x1b')](function(_0x3c5b61){if(_0x3c5b61){_0x198fac=_0x3c5b61;_0x45e259[_0x18a5('0x2d')]=_[_0x18a5('0x29')](db[_0x18a5('0x44')][_0x18a5('0x24')]);_0x45e259[_0x18a5('0x28')]=_[_0x18a5('0x29')](_0x1c39c1[_0x18a5('0x28')]);_0x45e259['filters']=_[_0x18a5('0x2a')](_0x45e259[_0x18a5('0x2d')],_0x45e259[_0x18a5('0x28')]);_0x3499ae['attributes']=_[_0x18a5('0x2a')](_0x45e259[_0x18a5('0x2d')],qs[_0x18a5('0x2c')](_0x1c39c1['query'][_0x18a5('0x2c')]));_0x3499ae[_0x18a5('0x2b')]=_0x3499ae[_0x18a5('0x2b')]['length']?_0x3499ae['attributes']:_0x45e259['model'];_0x3499ae[_0x18a5('0x2f')]=qs['sort'](_0x1c39c1[_0x18a5('0x28')][_0x18a5('0x30')]);_0x3499ae['where']=qs['filters'](_[_0x18a5('0x33')](_0x1c39c1[_0x18a5('0x28')],_0x45e259[_0x18a5('0x32')]));if(_0x1c39c1[_0x18a5('0x28')][_0x18a5('0x35')]){_0x3499ae['where']=_[_0x18a5('0x34')](_0x3499ae[_0x18a5('0x31')],{'$or':_['map'](_0x3499ae[_0x18a5('0x2b')],function(_0x560d95){var _0x4240ce={};_0x4240ce[_0x560d95]={'$like':'%'+_0x1c39c1[_0x18a5('0x28')]['filter']+'%'};return _0x4240ce;})});}_0x3499ae=_[_0x18a5('0x34')]({},_0x3499ae,_0x1c39c1[_0x18a5('0x36')]);return _0x198fac[_0x18a5('0x47')](_0x3499ae);}})[_0x18a5('0x1b')](function(_0x3c767e){if(_0x3c767e){_0x17de0b=_0x3c767e[_0x18a5('0x45')];if(!_0x1c39c1[_0x18a5('0x28')][_0x18a5('0x2e')](_0x18a5('0x46'))){_0x3499ae[_0x18a5('0x15')]=qs['limit'](_0x1c39c1[_0x18a5('0x28')][_0x18a5('0x15')]);_0x3499ae[_0x18a5('0x14')]=qs[_0x18a5('0x14')](_0x1c39c1[_0x18a5('0x28')]['offset']);}return _0x198fac['getSubjects'](_0x3499ae);}})[_0x18a5('0x1b')](function(_0x24e853){if(_0x24e853){return _0x24e853?{'count':_0x17de0b,'rows':_0x24e853}:null;}})[_0x18a5('0x1b')](respondWithResult(_0x210283,null))[_0x18a5('0x3a')](handleError(_0x210283,null));};exports[_0x18a5('0x48')]=function(_0x4715f2,_0x2720fd,_0x2e0123){var _0xefd86c={};var _0x2ff318={};var _0x5eb610;var _0x1c1999;return db[_0x18a5('0x23')][_0x18a5('0x43')]({'where':{'id':_0x4715f2['params']['id']}})[_0x18a5('0x1b')](handleEntityNotFound(_0x2720fd,null))['then'](function(_0x51761e){if(_0x51761e){_0x5eb610=_0x51761e;_0x2ff318[_0x18a5('0x2d')]=_['keys'](db[_0x18a5('0x44')][_0x18a5('0x24')]);_0x2ff318[_0x18a5('0x28')]=_[_0x18a5('0x29')](_0x4715f2['query']);_0x2ff318[_0x18a5('0x32')]=_[_0x18a5('0x2a')](_0x2ff318['model'],_0x2ff318['query']);_0xefd86c['attributes']=_[_0x18a5('0x2a')](_0x2ff318[_0x18a5('0x2d')],qs['fields'](_0x4715f2[_0x18a5('0x28')]['fields']));_0xefd86c['attributes']=_0xefd86c[_0x18a5('0x2b')][_0x18a5('0x45')]?_0xefd86c[_0x18a5('0x2b')]:_0x2ff318['model'];_0xefd86c['order']=qs[_0x18a5('0x30')](_0x4715f2['query'][_0x18a5('0x30')]);_0xefd86c[_0x18a5('0x31')]=qs[_0x18a5('0x32')](_['pick'](_0x4715f2['query'],_0x2ff318[_0x18a5('0x32')]));if(_0x4715f2['query'][_0x18a5('0x35')]){_0xefd86c[_0x18a5('0x31')]=_[_0x18a5('0x34')](_0xefd86c[_0x18a5('0x31')],{'$or':_[_0x18a5('0x22')](_0xefd86c[_0x18a5('0x2b')],function(_0x1966c5){var _0x37a3d7={};_0x37a3d7[_0x1966c5]={'$like':'%'+_0x4715f2[_0x18a5('0x28')][_0x18a5('0x35')]+'%'};return _0x37a3d7;})});}_0xefd86c=_[_0x18a5('0x34')]({},_0xefd86c,_0x4715f2[_0x18a5('0x36')]);return _0x5eb610['getDescriptions'](_0xefd86c);}})[_0x18a5('0x1b')](function(_0x336935){if(_0x336935){_0x1c1999=_0x336935[_0x18a5('0x45')];if(!_0x4715f2[_0x18a5('0x28')][_0x18a5('0x2e')](_0x18a5('0x46'))){_0xefd86c[_0x18a5('0x15')]=qs[_0x18a5('0x15')](_0x4715f2['query'][_0x18a5('0x15')]);_0xefd86c[_0x18a5('0x14')]=qs[_0x18a5('0x14')](_0x4715f2['query'][_0x18a5('0x14')]);}return _0x5eb610[_0x18a5('0x48')](_0xefd86c);}})[_0x18a5('0x1b')](function(_0x1dd134){if(_0x1dd134){return _0x1dd134?{'count':_0x1c1999,'rows':_0x1dd134}:null;}})[_0x18a5('0x1b')](respondWithResult(_0x2720fd,null))['catch'](handleError(_0x2720fd,null));}; \ No newline at end of file +var _0x3017=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','end','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','update','findOne','SugarcrmField','order','pick','nolimit','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3017,0x96));var _0x7301=function(_0x10bf25,_0x5c614d){_0x10bf25=_0x10bf25-0x0;var _0x592375=_0x3017[_0x10bf25];return _0x592375;};'use strict';var emlformat=require(_0x7301('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7301('0x1'));var jsonpatch=require(_0x7301('0x2'));var rp=require(_0x7301('0x3'));var moment=require(_0x7301('0x4'));var BPromise=require(_0x7301('0x5'));var Mustache=require(_0x7301('0x6'));var util=require(_0x7301('0x7'));var path=require(_0x7301('0x8'));var sox=require(_0x7301('0x9'));var csv=require(_0x7301('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7301('0xb'));var squel=require(_0x7301('0xc'));var crypto=require(_0x7301('0xd'));var jsforce=require(_0x7301('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7301('0xa'));var querystring=require('querystring');var Papa=require(_0x7301('0xf'));var Redis=require(_0x7301('0x10'));var authService=require(_0x7301('0x11'));var qs=require(_0x7301('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7301('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7301('0x14'));var config=require(_0x7301('0x15'));var licenseUtil=require(_0x7301('0x16'));var db=require(_0x7301('0x17'))['db'];function respondWithStatusCode(_0xfe811c,_0x2e8280){_0x2e8280=_0x2e8280||0xcc;return function(_0x605bd7){if(_0x605bd7){return _0xfe811c[_0x7301('0x18')](_0x2e8280);}return _0xfe811c['status'](_0x2e8280)['end']();};}function respondWithResult(_0x3684ce,_0x563498){_0x563498=_0x563498||0xc8;return function(_0xb18a8f){if(_0xb18a8f){return _0x3684ce[_0x7301('0x19')](_0x563498)[_0x7301('0x1a')](_0xb18a8f);}};}function respondWithFilteredResult(_0x53f5a9,_0xf3e3e6){return function(_0x467d24){if(_0x467d24){var _0x151661=typeof _0xf3e3e6[_0x7301('0x1b')]===_0x7301('0x1c')&&typeof _0xf3e3e6['limit']==='undefined';var _0x2ceee0=_0x467d24[_0x7301('0x1d')];var _0x589bc5=_0x151661?0x0:_0xf3e3e6[_0x7301('0x1b')];var _0x6777a8=_0x151661?_0x467d24['count']:_0xf3e3e6[_0x7301('0x1b')]+_0xf3e3e6[_0x7301('0x1e')];var _0x10f006;if(_0x6777a8>=_0x2ceee0){_0x6777a8=_0x2ceee0;_0x10f006=0xc8;}else{_0x10f006=0xce;}_0x53f5a9[_0x7301('0x19')](_0x10f006);return _0x53f5a9[_0x7301('0x1f')](_0x7301('0x20'),_0x589bc5+'-'+_0x6777a8+'/'+_0x2ceee0)[_0x7301('0x1a')](_0x467d24);}return null;};}function patchUpdates(_0x22e603){return function(_0x240142){try{jsonpatch[_0x7301('0x21')](_0x240142,_0x22e603,!![]);}catch(_0x53a490){return BPromise[_0x7301('0x22')](_0x53a490);}return _0x240142['save']();};}function saveUpdates(_0x4c4e10,_0x2b3a4f){return function(_0x512738){if(_0x512738){return _0x512738['update'](_0x4c4e10)[_0x7301('0x23')](function(_0x30ff4c){return _0x30ff4c;});}return null;};}function removeEntity(_0xc86ea,_0x465ef4){return function(_0x133b9d){if(_0x133b9d){return _0x133b9d[_0x7301('0x24')]()[_0x7301('0x23')](function(){_0xc86ea[_0x7301('0x19')](0xcc)[_0x7301('0x25')]();});}};}function handleEntityNotFound(_0x1ad027,_0x223a78){return function(_0x2f1894){if(!_0x2f1894){_0x1ad027[_0x7301('0x18')](0x194);}return _0x2f1894;};}function handleError(_0x4fea47,_0x52c455){_0x52c455=_0x52c455||0x1f4;return function(_0xf548e7){logger['error'](_0xf548e7[_0x7301('0x26')]);if(_0xf548e7[_0x7301('0x27')]){delete _0xf548e7[_0x7301('0x27')];}_0x4fea47[_0x7301('0x19')](_0x52c455)['send'](_0xf548e7);};}exports[_0x7301('0x28')]=function(_0x666c0f,_0x51ea96){var _0x1ad225={},_0x5809a1={},_0xa6c107={'count':0x0,'rows':[]};var _0x1b7ecf=_[_0x7301('0x29')](db[_0x7301('0x2a')]['rawAttributes'],function(_0x453b95){return{'name':_0x453b95[_0x7301('0x2b')],'type':_0x453b95[_0x7301('0x2c')][_0x7301('0x2d')]};});_0x5809a1['model']=_[_0x7301('0x29')](_0x1b7ecf,_0x7301('0x27'));_0x5809a1[_0x7301('0x2e')]=_[_0x7301('0x2f')](_0x666c0f[_0x7301('0x2e')]);_0x5809a1[_0x7301('0x30')]=_['intersection'](_0x5809a1[_0x7301('0x31')],_0x5809a1[_0x7301('0x2e')]);_0x1ad225[_0x7301('0x32')]=_['intersection'](_0x5809a1[_0x7301('0x31')],qs[_0x7301('0x33')](_0x666c0f[_0x7301('0x2e')][_0x7301('0x33')]));_0x1ad225[_0x7301('0x32')]=_0x1ad225['attributes'][_0x7301('0x34')]?_0x1ad225[_0x7301('0x32')]:_0x5809a1[_0x7301('0x31')];if(!_0x666c0f[_0x7301('0x2e')][_0x7301('0x35')]('nolimit')){_0x1ad225[_0x7301('0x1e')]=qs[_0x7301('0x1e')](_0x666c0f['query'][_0x7301('0x1e')]);_0x1ad225['offset']=qs[_0x7301('0x1b')](_0x666c0f[_0x7301('0x2e')][_0x7301('0x1b')]);}_0x1ad225['order']=qs[_0x7301('0x36')](_0x666c0f[_0x7301('0x2e')][_0x7301('0x36')]);_0x1ad225[_0x7301('0x37')]=qs[_0x7301('0x30')](_['pick'](_0x666c0f[_0x7301('0x2e')],_0x5809a1[_0x7301('0x30')]),_0x1b7ecf);if(_0x666c0f[_0x7301('0x2e')][_0x7301('0x38')]){_0x1ad225[_0x7301('0x37')]=_[_0x7301('0x39')](_0x1ad225[_0x7301('0x37')],{'$or':_[_0x7301('0x29')](_0x1b7ecf,function(_0x33268c){if(_0x33268c[_0x7301('0x2c')]!==_0x7301('0x3a')){var _0x431ffc={};_0x431ffc[_0x33268c[_0x7301('0x27')]]={'$like':'%'+_0x666c0f['query'][_0x7301('0x38')]+'%'};return _0x431ffc;}})});}_0x1ad225=_[_0x7301('0x39')]({},_0x1ad225,_0x666c0f[_0x7301('0x3b')]);var _0x2d5064={'where':_0x1ad225[_0x7301('0x37')]};return db[_0x7301('0x2a')][_0x7301('0x1d')](_0x2d5064)[_0x7301('0x23')](function(_0x166bfc){_0xa6c107[_0x7301('0x1d')]=_0x166bfc;if(_0x666c0f[_0x7301('0x2e')][_0x7301('0x3c')]){_0x1ad225[_0x7301('0x3d')]=[{'all':!![]}];}return db[_0x7301('0x2a')][_0x7301('0x3e')](_0x1ad225);})[_0x7301('0x23')](function(_0x5a7a5b){_0xa6c107[_0x7301('0x3f')]=_0x5a7a5b;return _0xa6c107;})['then'](respondWithFilteredResult(_0x51ea96,_0x1ad225))[_0x7301('0x40')](handleError(_0x51ea96,null));};exports[_0x7301('0x41')]=function(_0x2d328c,_0x5b035c){var _0x4b3ef2={'raw':![],'where':{'id':_0x2d328c[_0x7301('0x42')]['id']}},_0x35292d={};_0x35292d[_0x7301('0x31')]=_[_0x7301('0x2f')](db[_0x7301('0x2a')][_0x7301('0x43')]);_0x35292d[_0x7301('0x2e')]=_[_0x7301('0x2f')](_0x2d328c[_0x7301('0x2e')]);_0x35292d[_0x7301('0x30')]=_[_0x7301('0x44')](_0x35292d[_0x7301('0x31')],_0x35292d[_0x7301('0x2e')]);_0x4b3ef2[_0x7301('0x32')]=_[_0x7301('0x44')](_0x35292d[_0x7301('0x31')],qs[_0x7301('0x33')](_0x2d328c[_0x7301('0x2e')][_0x7301('0x33')]));_0x4b3ef2['attributes']=_0x4b3ef2[_0x7301('0x32')][_0x7301('0x34')]?_0x4b3ef2[_0x7301('0x32')]:_0x35292d[_0x7301('0x31')];if(_0x2d328c[_0x7301('0x2e')][_0x7301('0x3c')]){_0x4b3ef2[_0x7301('0x3d')]=[{'all':!![]}];}_0x4b3ef2=_[_0x7301('0x39')]({},_0x4b3ef2,_0x2d328c[_0x7301('0x3b')]);return db[_0x7301('0x2a')][_0x7301('0x45')](_0x4b3ef2)[_0x7301('0x23')](handleEntityNotFound(_0x5b035c,null))['then'](respondWithResult(_0x5b035c,null))[_0x7301('0x40')](handleError(_0x5b035c,null));};exports['create']=function(_0x3155a2,_0x3b4c32){return db['SugarcrmConfiguration'][_0x7301('0x46')](_0x3155a2[_0x7301('0x47')],{})[_0x7301('0x23')](respondWithResult(_0x3b4c32,0xc9))['catch'](handleError(_0x3b4c32,null));};exports[_0x7301('0x48')]=function(_0x5afb03,_0x34fa6c){if(_0x5afb03[_0x7301('0x47')]['id']){delete _0x5afb03['body']['id'];}return db[_0x7301('0x2a')][_0x7301('0x45')]({'where':{'id':_0x5afb03[_0x7301('0x42')]['id']}})[_0x7301('0x23')](handleEntityNotFound(_0x34fa6c,null))[_0x7301('0x23')](saveUpdates(_0x5afb03[_0x7301('0x47')],null))['then'](respondWithResult(_0x34fa6c,null))[_0x7301('0x40')](handleError(_0x34fa6c,null));};exports[_0x7301('0x24')]=function(_0xbce22d,_0x7502e1){return db[_0x7301('0x2a')][_0x7301('0x45')]({'where':{'id':_0xbce22d[_0x7301('0x42')]['id']}})['then'](handleEntityNotFound(_0x7502e1,null))[_0x7301('0x23')](removeEntity(_0x7502e1,null))[_0x7301('0x40')](handleError(_0x7502e1,null));};exports['getFields']=function(_0xab3b95,_0x3c96bc,_0x560d27){var _0x440738={};var _0x116258={};var _0x482134;var _0x3208ce;return db[_0x7301('0x2a')][_0x7301('0x49')]({'where':{'id':_0xab3b95[_0x7301('0x42')]['id']}})[_0x7301('0x23')](handleEntityNotFound(_0x3c96bc,null))['then'](function(_0x27e8f9){if(_0x27e8f9){_0x482134=_0x27e8f9;_0x116258[_0x7301('0x31')]=_[_0x7301('0x2f')](db[_0x7301('0x4a')]['rawAttributes']);_0x116258[_0x7301('0x2e')]=_['keys'](_0xab3b95[_0x7301('0x2e')]);_0x116258[_0x7301('0x30')]=_['intersection'](_0x116258[_0x7301('0x31')],_0x116258[_0x7301('0x2e')]);_0x440738[_0x7301('0x32')]=_[_0x7301('0x44')](_0x116258[_0x7301('0x31')],qs[_0x7301('0x33')](_0xab3b95[_0x7301('0x2e')]['fields']));_0x440738['attributes']=_0x440738[_0x7301('0x32')][_0x7301('0x34')]?_0x440738[_0x7301('0x32')]:_0x116258[_0x7301('0x31')];_0x440738[_0x7301('0x4b')]=qs['sort'](_0xab3b95[_0x7301('0x2e')][_0x7301('0x36')]);_0x440738[_0x7301('0x37')]=qs[_0x7301('0x30')](_[_0x7301('0x4c')](_0xab3b95[_0x7301('0x2e')],_0x116258['filters']));if(_0xab3b95[_0x7301('0x2e')]['filter']){_0x440738[_0x7301('0x37')]=_[_0x7301('0x39')](_0x440738[_0x7301('0x37')],{'$or':_['map'](_0x440738[_0x7301('0x32')],function(_0x57964d){var _0x704807={};_0x704807[_0x57964d]={'$like':'%'+_0xab3b95['query']['filter']+'%'};return _0x704807;})});}_0x440738=_[_0x7301('0x39')]({},_0x440738,_0xab3b95[_0x7301('0x3b')]);return _0x482134['getFields'](_0x440738);}})[_0x7301('0x23')](function(_0x395059){if(_0x395059){_0x3208ce=_0x395059[_0x7301('0x34')];if(!_0xab3b95[_0x7301('0x2e')][_0x7301('0x35')](_0x7301('0x4d'))){_0x440738['limit']=qs[_0x7301('0x1e')](_0xab3b95[_0x7301('0x2e')][_0x7301('0x1e')]);_0x440738[_0x7301('0x1b')]=qs[_0x7301('0x1b')](_0xab3b95[_0x7301('0x2e')][_0x7301('0x1b')]);}return _0x482134[_0x7301('0x4e')](_0x440738);}})[_0x7301('0x23')](function(_0x182420){if(_0x182420){return _0x182420?{'count':_0x3208ce,'rows':_0x182420}:null;}})[_0x7301('0x23')](respondWithResult(_0x3c96bc,null))['catch'](handleError(_0x3c96bc,null));};exports[_0x7301('0x4f')]=function(_0x17da0e,_0x551446,_0x389aeb){var _0x3695ac={};var _0x51289a={};var _0x4084a6;var _0x46738e;return db[_0x7301('0x2a')][_0x7301('0x49')]({'where':{'id':_0x17da0e['params']['id']}})[_0x7301('0x23')](handleEntityNotFound(_0x551446,null))[_0x7301('0x23')](function(_0x203cc4){if(_0x203cc4){_0x4084a6=_0x203cc4;_0x51289a[_0x7301('0x31')]=_['keys'](db[_0x7301('0x4a')][_0x7301('0x43')]);_0x51289a[_0x7301('0x2e')]=_['keys'](_0x17da0e[_0x7301('0x2e')]);_0x51289a['filters']=_[_0x7301('0x44')](_0x51289a[_0x7301('0x31')],_0x51289a['query']);_0x3695ac[_0x7301('0x32')]=_[_0x7301('0x44')](_0x51289a[_0x7301('0x31')],qs['fields'](_0x17da0e[_0x7301('0x2e')][_0x7301('0x33')]));_0x3695ac[_0x7301('0x32')]=_0x3695ac[_0x7301('0x32')][_0x7301('0x34')]?_0x3695ac[_0x7301('0x32')]:_0x51289a['model'];_0x3695ac[_0x7301('0x4b')]=qs['sort'](_0x17da0e[_0x7301('0x2e')][_0x7301('0x36')]);_0x3695ac[_0x7301('0x37')]=qs['filters'](_[_0x7301('0x4c')](_0x17da0e[_0x7301('0x2e')],_0x51289a[_0x7301('0x30')]));if(_0x17da0e['query'][_0x7301('0x38')]){_0x3695ac[_0x7301('0x37')]=_[_0x7301('0x39')](_0x3695ac[_0x7301('0x37')],{'$or':_[_0x7301('0x29')](_0x3695ac[_0x7301('0x32')],function(_0x5e074f){var _0x119f25={};_0x119f25[_0x5e074f]={'$like':'%'+_0x17da0e['query'][_0x7301('0x38')]+'%'};return _0x119f25;})});}_0x3695ac=_['merge']({},_0x3695ac,_0x17da0e[_0x7301('0x3b')]);return _0x4084a6[_0x7301('0x4f')](_0x3695ac);}})[_0x7301('0x23')](function(_0xd570b7){if(_0xd570b7){_0x46738e=_0xd570b7['length'];if(!_0x17da0e[_0x7301('0x2e')][_0x7301('0x35')](_0x7301('0x4d'))){_0x3695ac[_0x7301('0x1e')]=qs[_0x7301('0x1e')](_0x17da0e['query'][_0x7301('0x1e')]);_0x3695ac[_0x7301('0x1b')]=qs['offset'](_0x17da0e[_0x7301('0x2e')][_0x7301('0x1b')]);}return _0x4084a6[_0x7301('0x4f')](_0x3695ac);}})[_0x7301('0x23')](function(_0x1f684c){if(_0x1f684c){return _0x1f684c?{'count':_0x46738e,'rows':_0x1f684c}:null;}})[_0x7301('0x23')](respondWithResult(_0x551446,null))['catch'](handleError(_0x551446,null));};exports[_0x7301('0x50')]=function(_0x52d396,_0x59d710,_0x57ccff){var _0x245805={};var _0x39fe93={};var _0x40a0a4;var _0x2a0f7d;return db[_0x7301('0x2a')][_0x7301('0x49')]({'where':{'id':_0x52d396[_0x7301('0x42')]['id']}})[_0x7301('0x23')](handleEntityNotFound(_0x59d710,null))[_0x7301('0x23')](function(_0x351b2c){if(_0x351b2c){_0x40a0a4=_0x351b2c;_0x39fe93['model']=_['keys'](db[_0x7301('0x4a')][_0x7301('0x43')]);_0x39fe93[_0x7301('0x2e')]=_[_0x7301('0x2f')](_0x52d396[_0x7301('0x2e')]);_0x39fe93[_0x7301('0x30')]=_[_0x7301('0x44')](_0x39fe93[_0x7301('0x31')],_0x39fe93[_0x7301('0x2e')]);_0x245805[_0x7301('0x32')]=_[_0x7301('0x44')](_0x39fe93['model'],qs[_0x7301('0x33')](_0x52d396[_0x7301('0x2e')][_0x7301('0x33')]));_0x245805[_0x7301('0x32')]=_0x245805[_0x7301('0x32')]['length']?_0x245805['attributes']:_0x39fe93[_0x7301('0x31')];_0x245805[_0x7301('0x4b')]=qs[_0x7301('0x36')](_0x52d396[_0x7301('0x2e')][_0x7301('0x36')]);_0x245805[_0x7301('0x37')]=qs[_0x7301('0x30')](_[_0x7301('0x4c')](_0x52d396[_0x7301('0x2e')],_0x39fe93[_0x7301('0x30')]));if(_0x52d396['query'][_0x7301('0x38')]){_0x245805[_0x7301('0x37')]=_['merge'](_0x245805[_0x7301('0x37')],{'$or':_['map'](_0x245805[_0x7301('0x32')],function(_0x147fa5){var _0x2f3069={};_0x2f3069[_0x147fa5]={'$like':'%'+_0x52d396[_0x7301('0x2e')][_0x7301('0x38')]+'%'};return _0x2f3069;})});}_0x245805=_[_0x7301('0x39')]({},_0x245805,_0x52d396['options']);return _0x40a0a4[_0x7301('0x50')](_0x245805);}})[_0x7301('0x23')](function(_0xc1fc01){if(_0xc1fc01){_0x2a0f7d=_0xc1fc01[_0x7301('0x34')];if(!_0x52d396[_0x7301('0x2e')][_0x7301('0x35')]('nolimit')){_0x245805['limit']=qs[_0x7301('0x1e')](_0x52d396['query']['limit']);_0x245805['offset']=qs[_0x7301('0x1b')](_0x52d396['query']['offset']);}return _0x40a0a4['getDescriptions'](_0x245805);}})[_0x7301('0x23')](function(_0x1afed5){if(_0x1afed5){return _0x1afed5?{'count':_0x2a0f7d,'rows':_0x1afed5}:null;}})['then'](respondWithResult(_0x59d710,null))['catch'](handleError(_0x59d710,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 32e4984..a085a68 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 _0x32f2=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util'];(function(_0x2136c6,_0x649adf){var _0x364bbc=function(_0x3a9d0e){while(--_0x3a9d0e){_0x2136c6['push'](_0x2136c6['shift']());}};_0x364bbc(++_0x649adf);}(_0x32f2,0x8e));var _0x232f=function(_0x4e3107,_0x2d0004){_0x4e3107=_0x4e3107-0x0;var _0x1c298e=_0x32f2[_0x4e3107];return _0x1c298e;};'use strict';var _=require(_0x232f('0x0'));var util=require(_0x232f('0x1'));var logger=require(_0x232f('0x2'))(_0x232f('0x3'));var moment=require(_0x232f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x232f('0x5'));var rimraf=require(_0x232f('0x6'));var config=require(_0x232f('0x7'));var attributes=require(_0x232f('0x8'));module[_0x232f('0x9')]=function(_0x4475a4,_0x1d9e3b){return _0x4475a4[_0x232f('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x232f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5718=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x5718,0xfb));var _0x8571=function(_0x2fc680,_0x48e37e){_0x2fc680=_0x2fc680-0x0;var _0x9237b0=_0x5718[_0x2fc680];return _0x9237b0;};'use strict';var _=require(_0x8571('0x0'));var util=require('util');var logger=require(_0x8571('0x1'))(_0x8571('0x2'));var moment=require(_0x8571('0x3'));var BPromise=require(_0x8571('0x4'));var rp=require(_0x8571('0x5'));var fs=require('fs');var path=require(_0x8571('0x6'));var rimraf=require(_0x8571('0x7'));var config=require('../../config/environment');var attributes=require(_0x8571('0x8'));module[_0x8571('0x9')]=function(_0x1370ce,_0x564af8){return _0x1370ce[_0x8571('0xa')](_0x8571('0xb'),attributes,{'tableName':_0x8571('0xc'),'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 b8e1f3b..a6d3a90 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 _0x1c96=['info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c96,0x169));var _0x61c9=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x1c96[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x61c9('0x0'));var util=require(_0x61c9('0x1'));var moment=require(_0x61c9('0x2'));var BPromise=require(_0x61c9('0x3'));var rs=require(_0x61c9('0x4'));var fs=require('fs');var Redis=require(_0x61c9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x61c9('0x6'));var logger=require(_0x61c9('0x7'))(_0x61c9('0x8'));var config=require(_0x61c9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x61c9('0xa')][_0x61c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x320a16,_0x232f25,_0xd49244){return new BPromise(function(_0x4bd2bd,_0xb501d1){return client['request'](_0x320a16,_0xd49244)[_0x61c9('0xc')](function(_0x1113d8){logger[_0x61c9('0xd')](_0x61c9('0xe'),_0x232f25,'request\x20sent');logger[_0x61c9('0xf')](_0x61c9('0x10'),_0x232f25,_0x61c9('0x11'),JSON[_0x61c9('0x12')](_0x1113d8));if(_0x1113d8[_0x61c9('0x13')]){if(_0x1113d8[_0x61c9('0x13')]['code']===0x1f4){logger[_0x61c9('0x13')](_0x61c9('0xe'),_0x232f25,_0x1113d8[_0x61c9('0x13')][_0x61c9('0x14')]);return _0xb501d1(_0x1113d8[_0x61c9('0x13')][_0x61c9('0x14')]);}logger['error'](_0x61c9('0xe'),_0x232f25,_0x1113d8[_0x61c9('0x13')][_0x61c9('0x14')]);return _0x4bd2bd(_0x1113d8[_0x61c9('0x13')][_0x61c9('0x14')]);}else{logger[_0x61c9('0xd')](_0x61c9('0xe'),_0x232f25,'request\x20sent');_0x4bd2bd(_0x1113d8['result']['message']);}})[_0x61c9('0x15')](function(_0x59eb15){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x232f25,_0x59eb15);_0xb501d1(_0x59eb15);});});} \ No newline at end of file +var _0x55e8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0x55e8,0x1b4));var _0x855e=function(_0x1ed3c6,_0x55ecb1){_0x1ed3c6=_0x1ed3c6-0x0;var _0x4b81ba=_0x55e8[_0x1ed3c6];return _0x4b81ba;};'use strict';var _=require(_0x855e('0x0'));var util=require(_0x855e('0x1'));var moment=require(_0x855e('0x2'));var BPromise=require(_0x855e('0x3'));var rs=require(_0x855e('0x4'));var fs=require('fs');var Redis=require(_0x855e('0x5'));var db=require(_0x855e('0x6'))['db'];var utils=require(_0x855e('0x7'));var logger=require(_0x855e('0x8'))(_0x855e('0x9'));var config=require(_0x855e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x855e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c7493,_0x472240,_0x298842){return new BPromise(function(_0x5ba6ea,_0x1b95a8){return client['request'](_0x4c7493,_0x298842)[_0x855e('0xc')](function(_0x3c2e4b){logger[_0x855e('0xd')](_0x855e('0xe'),_0x472240,_0x855e('0xf'));logger[_0x855e('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x472240,_0x855e('0xf'),JSON[_0x855e('0x11')](_0x3c2e4b));if(_0x3c2e4b[_0x855e('0x12')]){if(_0x3c2e4b[_0x855e('0x12')]['code']===0x1f4){logger[_0x855e('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x472240,_0x3c2e4b[_0x855e('0x12')][_0x855e('0x13')]);return _0x1b95a8(_0x3c2e4b['error']['message']);}logger['error'](_0x855e('0xe'),_0x472240,_0x3c2e4b[_0x855e('0x12')]['message']);return _0x5ba6ea(_0x3c2e4b[_0x855e('0x12')][_0x855e('0x13')]);}else{logger['info'](_0x855e('0xe'),_0x472240,_0x855e('0xf'));_0x5ba6ea(_0x3c2e4b[_0x855e('0x14')][_0x855e('0x13')]);}})[_0x855e('0x15')](function(_0x30f198){logger[_0x855e('0x12')](_0x855e('0xe'),_0x472240,_0x30f198);_0x1b95a8(_0x30f198);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d33d054..63fd0c4 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 _0x594b=['Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x40b635,_0x610633){var _0x5e69cc=function(_0x209e70){while(--_0x209e70){_0x40b635['push'](_0x40b635['shift']());}};_0x5e69cc(++_0x610633);}(_0x594b,0x12d));var _0xb594=function(_0x3e6d3c,_0x36222e){_0x3e6d3c=_0x3e6d3c-0x0;var _0x2c8d04=_0x594b[_0x3e6d3c];return _0x2c8d04;};'use strict';var multer=require(_0xb594('0x0'));var util=require(_0xb594('0x1'));var path=require(_0xb594('0x2'));var timeout=require(_0xb594('0x3'));var express=require(_0xb594('0x4'));var router=express[_0xb594('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb594('0x6'));var interaction=require(_0xb594('0x7'));var config=require('../../config/environment');var controller=require(_0xb594('0x8'));router[_0xb594('0x9')]('/',auth[_0xb594('0xa')](),controller['index']);router[_0xb594('0x9')](_0xb594('0xb'),auth[_0xb594('0xa')](),controller[_0xb594('0xc')]);router[_0xb594('0xd')]('/',auth[_0xb594('0xa')](),controller[_0xb594('0xe')]);router[_0xb594('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb594('0x10')]);router['delete'](_0xb594('0xb'),auth[_0xb594('0xa')](),controller[_0xb594('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd865=['put','update','delete','/:id','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create'];(function(_0x22488b,_0x49b0d1){var _0x211b4b=function(_0x56e1ff){while(--_0x56e1ff){_0x22488b['push'](_0x22488b['shift']());}};_0x211b4b(++_0x49b0d1);}(_0xd865,0x18c));var _0x5d86=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd865[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x5d86('0x0'));var path=require(_0x5d86('0x1'));var timeout=require(_0x5d86('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5d86('0x3'));var interaction=require(_0x5d86('0x4'));var config=require('../../config/environment');var controller=require(_0x5d86('0x5'));router[_0x5d86('0x6')]('/',auth[_0x5d86('0x7')](),controller[_0x5d86('0x8')]);router[_0x5d86('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x5d86('0x9')]);router[_0x5d86('0xa')]('/',auth[_0x5d86('0x7')](),controller[_0x5d86('0xb')]);router[_0x5d86('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x5d86('0xd')]);router[_0x5d86('0xe')](_0x5d86('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x5d86('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d2590e5..4377163 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 _0x256e=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x29b651,_0x2130c9){var _0x405ec1=function(_0x62c3b3){while(--_0x62c3b3){_0x29b651['push'](_0x29b651['shift']());}};_0x405ec1(++_0x2130c9);}(_0x256e,0x66));var _0xe256=function(_0x4f557e,_0x16687a){_0x4f557e=_0x4f557e-0x0;var _0x15c67b=_0x256e[_0x4f557e];return _0x15c67b;};'use strict';var Sequelize=require(_0xe256('0x0'));module[_0xe256('0x1')]={'type':{'type':Sequelize[_0xe256('0x2')](_0xe256('0x3'),_0xe256('0x4'),_0xe256('0x5'),_0xe256('0x6'),_0xe256('0x7')),'defaultValue':_0xe256('0x3')},'content':{'type':Sequelize[_0xe256('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe256('0x2')]('string',_0xe256('0x4'),_0xe256('0x5'))},'keyContent':{'type':Sequelize[_0xe256('0x8')]},'idField':{'type':Sequelize[_0xe256('0x8')]},'nameField':{'type':Sequelize[_0xe256('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3eb9=['variable','customVariable','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x315a80,_0x2b3952){var _0x3f6d1a=function(_0x160e37){while(--_0x160e37){_0x315a80['push'](_0x315a80['shift']());}};_0x3f6d1a(++_0x2b3952);}(_0x3eb9,0x185));var _0x93eb=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0x3eb9[_0x547e20];return _0x359171;};'use strict';var Sequelize=require('sequelize');module[_0x93eb('0x0')]={'type':{'type':Sequelize[_0x93eb('0x1')](_0x93eb('0x2'),_0x93eb('0x3'),_0x93eb('0x4'),'keyValue',_0x93eb('0x5')),'defaultValue':_0x93eb('0x2')},'content':{'type':Sequelize[_0x93eb('0x6')]},'key':{'type':Sequelize[_0x93eb('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x93eb('0x2'),_0x93eb('0x3'),_0x93eb('0x4'))},'keyContent':{'type':Sequelize[_0x93eb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x93eb('0x6')]},'customField':{'type':Sequelize[_0x93eb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x93eb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 42b6df1..ff9e190 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 _0xf881=['show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch'];(function(_0xe278fb,_0x3250ed){var _0x5a42f3=function(_0x49468a){while(--_0x49468a){_0xe278fb['push'](_0xe278fb['shift']());}};_0x5a42f3(++_0x3250ed);}(_0xf881,0x1d9));var _0x1f88=function(_0x5d0a06,_0x2f8043){_0x5d0a06=_0x5d0a06-0x0;var _0x2350ca=_0xf881[_0x5d0a06];return _0x2350ca;};'use strict';var emlformat=require(_0x1f88('0x0'));var rimraf=require(_0x1f88('0x1'));var zipdir=require(_0x1f88('0x2'));var jsonpatch=require(_0x1f88('0x3'));var rp=require(_0x1f88('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f88('0x5'));var util=require(_0x1f88('0x6'));var path=require(_0x1f88('0x7'));var sox=require(_0x1f88('0x8'));var csv=require(_0x1f88('0x9'));var ejs=require(_0x1f88('0xa'));var fs=require('fs');var fs_extra=require(_0x1f88('0xb'));var _=require(_0x1f88('0xc'));var squel=require(_0x1f88('0xd'));var crypto=require(_0x1f88('0xe'));var jsforce=require(_0x1f88('0xf'));var deskjs=require(_0x1f88('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1f88('0x11'));var Papa=require(_0x1f88('0x12'));var Redis=require(_0x1f88('0x13'));var authService=require(_0x1f88('0x14'));var qs=require(_0x1f88('0x15'));var as=require(_0x1f88('0x16'));var hardwareService=require(_0x1f88('0x17'));var logger=require(_0x1f88('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x1f88('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f88('0x1a'))['db'];function respondWithStatusCode(_0x42844e,_0x41df0c){_0x41df0c=_0x41df0c||0xcc;return function(_0x1ce610){if(_0x1ce610){return _0x42844e[_0x1f88('0x1b')](_0x41df0c);}return _0x42844e[_0x1f88('0x1c')](_0x41df0c)[_0x1f88('0x1d')]();};}function respondWithResult(_0x29ab47,_0x488f9e){_0x488f9e=_0x488f9e||0xc8;return function(_0xdb9e38){if(_0xdb9e38){return _0x29ab47['status'](_0x488f9e)['json'](_0xdb9e38);}};}function respondWithFilteredResult(_0x3d5b6b,_0x213b0f){return function(_0x56cb9c){if(_0x56cb9c){var _0x1c6bd2=typeof _0x213b0f[_0x1f88('0x1e')]==='undefined'&&typeof _0x213b0f[_0x1f88('0x1f')]===_0x1f88('0x20');var _0x58a569=_0x56cb9c[_0x1f88('0x21')];var _0x29afa3=_0x1c6bd2?0x0:_0x213b0f[_0x1f88('0x1e')];var _0x4aba76=_0x1c6bd2?_0x56cb9c[_0x1f88('0x21')]:_0x213b0f[_0x1f88('0x1e')]+_0x213b0f[_0x1f88('0x1f')];var _0x4e8ac2;if(_0x4aba76>=_0x58a569){_0x4aba76=_0x58a569;_0x4e8ac2=0xc8;}else{_0x4e8ac2=0xce;}_0x3d5b6b[_0x1f88('0x1c')](_0x4e8ac2);return _0x3d5b6b[_0x1f88('0x22')](_0x1f88('0x23'),_0x29afa3+'-'+_0x4aba76+'/'+_0x58a569)[_0x1f88('0x24')](_0x56cb9c);}return null;};}function patchUpdates(_0xee1a8f){return function(_0x5f27df){try{jsonpatch['apply'](_0x5f27df,_0xee1a8f,!![]);}catch(_0x1a619c){return BPromise[_0x1f88('0x25')](_0x1a619c);}return _0x5f27df[_0x1f88('0x26')]();};}function saveUpdates(_0x206937,_0x4099b6){return function(_0x460856){if(_0x460856){return _0x460856[_0x1f88('0x27')](_0x206937)[_0x1f88('0x28')](function(_0x39ef99){return _0x39ef99;});}return null;};}function removeEntity(_0x15e515,_0x49c35e){return function(_0x1fd5b5){if(_0x1fd5b5){return _0x1fd5b5[_0x1f88('0x29')]()[_0x1f88('0x28')](function(){_0x15e515[_0x1f88('0x1c')](0xcc)[_0x1f88('0x1d')]();});}};}function handleEntityNotFound(_0xc33492,_0x11cb8c){return function(_0x1a5688){if(!_0x1a5688){_0xc33492[_0x1f88('0x1b')](0x194);}return _0x1a5688;};}function handleError(_0x5549c5,_0x246f6a){_0x246f6a=_0x246f6a||0x1f4;return function(_0x996b89){logger[_0x1f88('0x2a')](_0x996b89[_0x1f88('0x2b')]);if(_0x996b89[_0x1f88('0x2c')]){delete _0x996b89[_0x1f88('0x2c')];}_0x5549c5[_0x1f88('0x1c')](_0x246f6a)['send'](_0x996b89);};}exports[_0x1f88('0x2d')]=function(_0xc68e4c,_0x59df56){var _0x406336={},_0x418c49={},_0x23e5e8={'count':0x0,'rows':[]};var _0x37f096=_['map'](db[_0x1f88('0x2e')][_0x1f88('0x2f')],function(_0x193536){return{'name':_0x193536[_0x1f88('0x30')],'type':_0x193536['type'][_0x1f88('0x31')]};});_0x418c49['model']=_[_0x1f88('0x32')](_0x37f096,_0x1f88('0x2c'));_0x418c49['query']=_[_0x1f88('0x33')](_0xc68e4c[_0x1f88('0x34')]);_0x418c49[_0x1f88('0x35')]=_[_0x1f88('0x36')](_0x418c49[_0x1f88('0x37')],_0x418c49[_0x1f88('0x34')]);_0x406336[_0x1f88('0x38')]=_[_0x1f88('0x36')](_0x418c49[_0x1f88('0x37')],qs[_0x1f88('0x39')](_0xc68e4c[_0x1f88('0x34')][_0x1f88('0x39')]));_0x406336['attributes']=_0x406336[_0x1f88('0x38')][_0x1f88('0x3a')]?_0x406336[_0x1f88('0x38')]:_0x418c49[_0x1f88('0x37')];if(!_0xc68e4c['query'][_0x1f88('0x3b')]('nolimit')){_0x406336['limit']=qs[_0x1f88('0x1f')](_0xc68e4c['query'][_0x1f88('0x1f')]);_0x406336[_0x1f88('0x1e')]=qs[_0x1f88('0x1e')](_0xc68e4c['query'][_0x1f88('0x1e')]);}_0x406336[_0x1f88('0x3c')]=qs['sort'](_0xc68e4c[_0x1f88('0x34')][_0x1f88('0x3d')]);_0x406336[_0x1f88('0x3e')]=qs[_0x1f88('0x35')](_[_0x1f88('0x3f')](_0xc68e4c[_0x1f88('0x34')],_0x418c49[_0x1f88('0x35')]),_0x37f096);if(_0xc68e4c['query'][_0x1f88('0x40')]){_0x406336[_0x1f88('0x3e')]=_['merge'](_0x406336['where'],{'$or':_[_0x1f88('0x32')](_0x37f096,function(_0x18107e){if(_0x18107e[_0x1f88('0x41')]!==_0x1f88('0x42')){var _0x69aee6={};_0x69aee6[_0x18107e[_0x1f88('0x2c')]]={'$like':'%'+_0xc68e4c[_0x1f88('0x34')][_0x1f88('0x40')]+'%'};return _0x69aee6;}})});}_0x406336=_[_0x1f88('0x43')]({},_0x406336,_0xc68e4c[_0x1f88('0x44')]);var _0x20e6a4={'where':_0x406336['where']};return db[_0x1f88('0x2e')][_0x1f88('0x21')](_0x20e6a4)['then'](function(_0x1c0210){_0x23e5e8[_0x1f88('0x21')]=_0x1c0210;if(_0xc68e4c[_0x1f88('0x34')][_0x1f88('0x45')]){_0x406336[_0x1f88('0x46')]=[{'all':!![]}];}return db['SugarcrmField'][_0x1f88('0x47')](_0x406336);})[_0x1f88('0x28')](function(_0x5a9e41){_0x23e5e8['rows']=_0x5a9e41;return _0x23e5e8;})[_0x1f88('0x28')](respondWithFilteredResult(_0x59df56,_0x406336))[_0x1f88('0x48')](handleError(_0x59df56,null));};exports[_0x1f88('0x49')]=function(_0x222977,_0x7efdcb){var _0x364934={'raw':!![],'where':{'id':_0x222977[_0x1f88('0x4a')]['id']}},_0xd64542={};_0xd64542[_0x1f88('0x37')]=_['keys'](db['SugarcrmField'][_0x1f88('0x2f')]);_0xd64542[_0x1f88('0x34')]=_[_0x1f88('0x33')](_0x222977[_0x1f88('0x34')]);_0xd64542[_0x1f88('0x35')]=_[_0x1f88('0x36')](_0xd64542['model'],_0xd64542[_0x1f88('0x34')]);_0x364934[_0x1f88('0x38')]=_[_0x1f88('0x36')](_0xd64542[_0x1f88('0x37')],qs['fields'](_0x222977[_0x1f88('0x34')][_0x1f88('0x39')]));_0x364934[_0x1f88('0x38')]=_0x364934[_0x1f88('0x38')]['length']?_0x364934[_0x1f88('0x38')]:_0xd64542[_0x1f88('0x37')];if(_0x222977[_0x1f88('0x34')][_0x1f88('0x45')]){_0x364934['include']=[{'all':!![]}];}_0x364934=_[_0x1f88('0x43')]({},_0x364934,_0x222977[_0x1f88('0x44')]);return db[_0x1f88('0x2e')][_0x1f88('0x4b')](_0x364934)[_0x1f88('0x28')](handleEntityNotFound(_0x7efdcb,null))[_0x1f88('0x28')](respondWithResult(_0x7efdcb,null))[_0x1f88('0x48')](handleError(_0x7efdcb,null));};exports['create']=function(_0x57aa15,_0x306e35){return db[_0x1f88('0x2e')][_0x1f88('0x4c')](_0x57aa15[_0x1f88('0x4d')],{})[_0x1f88('0x28')](respondWithResult(_0x306e35,0xc9))[_0x1f88('0x48')](handleError(_0x306e35,null));};exports[_0x1f88('0x27')]=function(_0x59f73e,_0x1f34c8){if(_0x59f73e[_0x1f88('0x4d')]['id']){delete _0x59f73e['body']['id'];}return db[_0x1f88('0x2e')]['find']({'where':{'id':_0x59f73e[_0x1f88('0x4a')]['id']}})[_0x1f88('0x28')](handleEntityNotFound(_0x1f34c8,null))[_0x1f88('0x28')](saveUpdates(_0x59f73e['body'],null))[_0x1f88('0x28')](respondWithResult(_0x1f34c8,null))[_0x1f88('0x48')](handleError(_0x1f34c8,null));};exports['destroy']=function(_0x4ee5c6,_0x130c6e){return db['SugarcrmField'][_0x1f88('0x4b')]({'where':{'id':_0x4ee5c6['params']['id']}})[_0x1f88('0x28')](handleEntityNotFound(_0x130c6e,null))['then'](removeEntity(_0x130c6e,null))[_0x1f88('0x48')](handleError(_0x130c6e,null));}; \ No newline at end of file +var _0x1cf1=['Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','intersection','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count'];(function(_0x438769,_0x59c306){var _0x2b7bbb=function(_0x3eb6d3){while(--_0x3eb6d3){_0x438769['push'](_0x438769['shift']());}};_0x2b7bbb(++_0x59c306);}(_0x1cf1,0x1a4));var _0x11cf=function(_0x425d29,_0x360e67){_0x425d29=_0x425d29-0x0;var _0x3dda32=_0x1cf1[_0x425d29];return _0x3dda32;};'use strict';var emlformat=require(_0x11cf('0x0'));var rimraf=require(_0x11cf('0x1'));var zipdir=require(_0x11cf('0x2'));var jsonpatch=require(_0x11cf('0x3'));var rp=require('request-promise');var moment=require(_0x11cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x11cf('0x5'));var util=require('util');var path=require(_0x11cf('0x6'));var sox=require(_0x11cf('0x7'));var csv=require(_0x11cf('0x8'));var ejs=require(_0x11cf('0x9'));var fs=require('fs');var fs_extra=require(_0x11cf('0xa'));var _=require('lodash');var squel=require(_0x11cf('0xb'));var crypto=require(_0x11cf('0xc'));var jsforce=require(_0x11cf('0xd'));var deskjs=require(_0x11cf('0xe'));var toCsv=require(_0x11cf('0x8'));var querystring=require(_0x11cf('0xf'));var Papa=require(_0x11cf('0x10'));var Redis=require(_0x11cf('0x11'));var authService=require(_0x11cf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x11cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11cf('0x14'));var utils=require(_0x11cf('0x15'));var config=require(_0x11cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x11cf('0x17'))['db'];function respondWithStatusCode(_0x4e6576,_0x475554){_0x475554=_0x475554||0xcc;return function(_0x2345df){if(_0x2345df){return _0x4e6576['sendStatus'](_0x475554);}return _0x4e6576[_0x11cf('0x18')](_0x475554)['end']();};}function respondWithResult(_0x51c899,_0x3992c2){_0x3992c2=_0x3992c2||0xc8;return function(_0x49d9c9){if(_0x49d9c9){return _0x51c899[_0x11cf('0x18')](_0x3992c2)[_0x11cf('0x19')](_0x49d9c9);}};}function respondWithFilteredResult(_0x232bd2,_0x4cd379){return function(_0x5796e8){if(_0x5796e8){var _0x27109d=typeof _0x4cd379['offset']===_0x11cf('0x1a')&&typeof _0x4cd379[_0x11cf('0x1b')]==='undefined';var _0x56428f=_0x5796e8['count'];var _0x13992c=_0x27109d?0x0:_0x4cd379[_0x11cf('0x1c')];var _0x440568=_0x27109d?_0x5796e8[_0x11cf('0x1d')]:_0x4cd379[_0x11cf('0x1c')]+_0x4cd379['limit'];var _0x39be82;if(_0x440568>=_0x56428f){_0x440568=_0x56428f;_0x39be82=0xc8;}else{_0x39be82=0xce;}_0x232bd2[_0x11cf('0x18')](_0x39be82);return _0x232bd2['set'](_0x11cf('0x1e'),_0x13992c+'-'+_0x440568+'/'+_0x56428f)['json'](_0x5796e8);}return null;};}function patchUpdates(_0x501ec8){return function(_0x48a899){try{jsonpatch[_0x11cf('0x1f')](_0x48a899,_0x501ec8,!![]);}catch(_0xae3106){return BPromise[_0x11cf('0x20')](_0xae3106);}return _0x48a899[_0x11cf('0x21')]();};}function saveUpdates(_0x2869da,_0x243149){return function(_0x4b004a){if(_0x4b004a){return _0x4b004a[_0x11cf('0x22')](_0x2869da)[_0x11cf('0x23')](function(_0x49073c){return _0x49073c;});}return null;};}function removeEntity(_0x149dc7,_0x5e5111){return function(_0x52d661){if(_0x52d661){return _0x52d661[_0x11cf('0x24')]()[_0x11cf('0x23')](function(){_0x149dc7[_0x11cf('0x18')](0xcc)[_0x11cf('0x25')]();});}};}function handleEntityNotFound(_0x27e974,_0x4dc572){return function(_0x54f611){if(!_0x54f611){_0x27e974[_0x11cf('0x26')](0x194);}return _0x54f611;};}function handleError(_0x189efb,_0x49142d){_0x49142d=_0x49142d||0x1f4;return function(_0x54f95b){logger[_0x11cf('0x27')](_0x54f95b[_0x11cf('0x28')]);if(_0x54f95b[_0x11cf('0x29')]){delete _0x54f95b[_0x11cf('0x29')];}_0x189efb['status'](_0x49142d)[_0x11cf('0x2a')](_0x54f95b);};}exports['index']=function(_0x21f0da,_0x332f50){var _0x523c23={},_0x10fa61={},_0x1df862={'count':0x0,'rows':[]};var _0x403abe=_[_0x11cf('0x2b')](db[_0x11cf('0x2c')][_0x11cf('0x2d')],function(_0x1d48a4){return{'name':_0x1d48a4[_0x11cf('0x2e')],'type':_0x1d48a4[_0x11cf('0x2f')][_0x11cf('0x30')]};});_0x10fa61['model']=_[_0x11cf('0x2b')](_0x403abe,'name');_0x10fa61[_0x11cf('0x31')]=_[_0x11cf('0x32')](_0x21f0da[_0x11cf('0x31')]);_0x10fa61['filters']=_['intersection'](_0x10fa61[_0x11cf('0x33')],_0x10fa61[_0x11cf('0x31')]);_0x523c23[_0x11cf('0x34')]=_['intersection'](_0x10fa61['model'],qs[_0x11cf('0x35')](_0x21f0da[_0x11cf('0x31')][_0x11cf('0x35')]));_0x523c23[_0x11cf('0x34')]=_0x523c23['attributes']['length']?_0x523c23[_0x11cf('0x34')]:_0x10fa61[_0x11cf('0x33')];if(!_0x21f0da[_0x11cf('0x31')][_0x11cf('0x36')](_0x11cf('0x37'))){_0x523c23[_0x11cf('0x1b')]=qs['limit'](_0x21f0da[_0x11cf('0x31')][_0x11cf('0x1b')]);_0x523c23[_0x11cf('0x1c')]=qs[_0x11cf('0x1c')](_0x21f0da[_0x11cf('0x31')][_0x11cf('0x1c')]);}_0x523c23[_0x11cf('0x38')]=qs[_0x11cf('0x39')](_0x21f0da[_0x11cf('0x31')][_0x11cf('0x39')]);_0x523c23[_0x11cf('0x3a')]=qs[_0x11cf('0x3b')](_[_0x11cf('0x3c')](_0x21f0da[_0x11cf('0x31')],_0x10fa61[_0x11cf('0x3b')]),_0x403abe);if(_0x21f0da[_0x11cf('0x31')][_0x11cf('0x3d')]){_0x523c23[_0x11cf('0x3a')]=_[_0x11cf('0x3e')](_0x523c23['where'],{'$or':_[_0x11cf('0x2b')](_0x403abe,function(_0x9aa4fc){if(_0x9aa4fc['type']!==_0x11cf('0x3f')){var _0x17ab8b={};_0x17ab8b[_0x9aa4fc[_0x11cf('0x29')]]={'$like':'%'+_0x21f0da[_0x11cf('0x31')][_0x11cf('0x3d')]+'%'};return _0x17ab8b;}})});}_0x523c23=_[_0x11cf('0x3e')]({},_0x523c23,_0x21f0da[_0x11cf('0x40')]);var _0x5e65d2={'where':_0x523c23[_0x11cf('0x3a')]};return db[_0x11cf('0x2c')]['count'](_0x5e65d2)[_0x11cf('0x23')](function(_0x42ac72){_0x1df862[_0x11cf('0x1d')]=_0x42ac72;if(_0x21f0da['query']['includeAll']){_0x523c23['include']=[{'all':!![]}];}return db[_0x11cf('0x2c')][_0x11cf('0x41')](_0x523c23);})['then'](function(_0x1a1b0e){_0x1df862[_0x11cf('0x42')]=_0x1a1b0e;return _0x1df862;})['then'](respondWithFilteredResult(_0x332f50,_0x523c23))[_0x11cf('0x43')](handleError(_0x332f50,null));};exports['show']=function(_0x36b976,_0x551c92){var _0x544812={'raw':!![],'where':{'id':_0x36b976[_0x11cf('0x44')]['id']}},_0x17d0e7={};_0x17d0e7['model']=_[_0x11cf('0x32')](db[_0x11cf('0x2c')][_0x11cf('0x2d')]);_0x17d0e7[_0x11cf('0x31')]=_[_0x11cf('0x32')](_0x36b976[_0x11cf('0x31')]);_0x17d0e7[_0x11cf('0x3b')]=_['intersection'](_0x17d0e7[_0x11cf('0x33')],_0x17d0e7[_0x11cf('0x31')]);_0x544812['attributes']=_[_0x11cf('0x45')](_0x17d0e7[_0x11cf('0x33')],qs[_0x11cf('0x35')](_0x36b976['query'][_0x11cf('0x35')]));_0x544812[_0x11cf('0x34')]=_0x544812['attributes'][_0x11cf('0x46')]?_0x544812[_0x11cf('0x34')]:_0x17d0e7[_0x11cf('0x33')];if(_0x36b976[_0x11cf('0x31')][_0x11cf('0x47')]){_0x544812['include']=[{'all':!![]}];}_0x544812=_['merge']({},_0x544812,_0x36b976[_0x11cf('0x40')]);return db[_0x11cf('0x2c')][_0x11cf('0x48')](_0x544812)[_0x11cf('0x23')](handleEntityNotFound(_0x551c92,null))['then'](respondWithResult(_0x551c92,null))[_0x11cf('0x43')](handleError(_0x551c92,null));};exports[_0x11cf('0x49')]=function(_0x10e0d,_0x2c94a7){return db[_0x11cf('0x2c')]['create'](_0x10e0d[_0x11cf('0x4a')],{})['then'](respondWithResult(_0x2c94a7,0xc9))[_0x11cf('0x43')](handleError(_0x2c94a7,null));};exports[_0x11cf('0x22')]=function(_0xc9a220,_0x62ccda){if(_0xc9a220[_0x11cf('0x4a')]['id']){delete _0xc9a220['body']['id'];}return db[_0x11cf('0x2c')]['find']({'where':{'id':_0xc9a220[_0x11cf('0x44')]['id']}})[_0x11cf('0x23')](handleEntityNotFound(_0x62ccda,null))[_0x11cf('0x23')](saveUpdates(_0xc9a220[_0x11cf('0x4a')],null))[_0x11cf('0x23')](respondWithResult(_0x62ccda,null))[_0x11cf('0x43')](handleError(_0x62ccda,null));};exports[_0x11cf('0x24')]=function(_0x195fa0,_0x468f95){return db['SugarcrmField']['find']({'where':{'id':_0x195fa0['params']['id']}})[_0x11cf('0x23')](handleEntityNotFound(_0x468f95,null))[_0x11cf('0x23')](removeEntity(_0x468f95,null))[_0x11cf('0x43')](handleError(_0x468f95,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6767c10..edf3956 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 _0x1cae=['SugarcrmField','int_sugarcrm_fields','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1cae,0x155));var _0xe1ca=function(_0x186502,_0x5f14ab){_0x186502=_0x186502-0x0;var _0x5353a9=_0x1cae[_0x186502];return _0x5353a9;};'use strict';var _=require(_0xe1ca('0x0'));var util=require('util');var logger=require(_0xe1ca('0x1'))(_0xe1ca('0x2'));var moment=require('moment');var BPromise=require(_0xe1ca('0x3'));var rp=require(_0xe1ca('0x4'));var fs=require('fs');var path=require(_0xe1ca('0x5'));var rimraf=require('rimraf');var config=require(_0xe1ca('0x6'));var attributes=require(_0xe1ca('0x7'));module[_0xe1ca('0x8')]=function(_0x20f18c,_0x6cebc0){return _0x20f18c[_0xe1ca('0x9')](_0xe1ca('0xa'),attributes,{'tableName':_0xe1ca('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xe1ca('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6393=['../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x371c17,_0x2847c2){var _0x5a3306=function(_0x5204d5){while(--_0x5204d5){_0x371c17['push'](_0x371c17['shift']());}};_0x5a3306(++_0x2847c2);}(_0x6393,0xd7));var _0x3639=function(_0x32bff9,_0x3f27d5){_0x32bff9=_0x32bff9-0x0;var _0xbab93=_0x6393[_0x32bff9];return _0xbab93;};'use strict';var _=require('lodash');var util=require(_0x3639('0x0'));var logger=require(_0x3639('0x1'))(_0x3639('0x2'));var moment=require(_0x3639('0x3'));var BPromise=require('bluebird');var rp=require(_0x3639('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3639('0x5'));var config=require(_0x3639('0x6'));var attributes=require(_0x3639('0x7'));module[_0x3639('0x8')]=function(_0x4548fe,_0x1b87e5){return _0x4548fe[_0x3639('0x9')]('SugarcrmField',attributes,{'tableName':_0x3639('0xa'),'paranoid':![],'indexes':[{'name':_0x3639('0xb'),'fields':[_0x3639('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 1d8df54..c3cf962 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 _0x949c=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x166d9c,_0x2fa69b){var _0x32dc68=function(_0x32ea57){while(--_0x32ea57){_0x166d9c['push'](_0x166d9c['shift']());}};_0x32dc68(++_0x2fa69b);}(_0x949c,0xbd));var _0xc949=function(_0x1b3af8,_0xc53e84){_0x1b3af8=_0x1b3af8-0x0;var _0x5bb32a=_0x949c[_0x1b3af8];return _0x5bb32a;};'use strict';var _=require(_0xc949('0x0'));var util=require(_0xc949('0x1'));var moment=require(_0xc949('0x2'));var BPromise=require('bluebird');var rs=require(_0xc949('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc949('0x4'))('rpc');var config=require(_0xc949('0x5'));var jayson=require(_0xc949('0x6'));var client=jayson[_0xc949('0x7')][_0xc949('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21e2c3,_0xad63f7,_0x2d7d15){return new BPromise(function(_0x21e141,_0x3a98da){return client['request'](_0x21e2c3,_0x2d7d15)['then'](function(_0x42741f){logger[_0xc949('0x9')](_0xc949('0xa'),_0xad63f7,_0xc949('0xb'));logger[_0xc949('0xc')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xad63f7,_0xc949('0xb'),JSON[_0xc949('0xd')](_0x42741f));if(_0x42741f[_0xc949('0xe')]){if(_0x42741f['error'][_0xc949('0xf')]===0x1f4){logger[_0xc949('0xe')](_0xc949('0xa'),_0xad63f7,_0x42741f['error']['message']);return _0x3a98da(_0x42741f[_0xc949('0xe')][_0xc949('0x10')]);}logger['error'](_0xc949('0xa'),_0xad63f7,_0x42741f['error'][_0xc949('0x10')]);return _0x21e141(_0x42741f[_0xc949('0xe')][_0xc949('0x10')]);}else{logger[_0xc949('0x9')]('SugarcrmField,\x20%s,\x20%s',_0xad63f7,'request\x20sent');_0x21e141(_0x42741f[_0xc949('0x11')][_0xc949('0x10')]);}})['catch'](function(_0x29625a){logger['error'](_0xc949('0xa'),_0xad63f7,_0x29625a);_0x3a98da(_0x29625a);});});} \ No newline at end of file +var _0x4d30=['jayson/promise','client','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x362fa6,_0x1ffd85){var _0x3b5e5a=function(_0x5d8803){while(--_0x5d8803){_0x362fa6['push'](_0x362fa6['shift']());}};_0x3b5e5a(++_0x1ffd85);}(_0x4d30,0x97));var _0x04d3=function(_0x232a77,_0x1818be){_0x232a77=_0x232a77-0x0;var _0x247c69=_0x4d30[_0x232a77];return _0x247c69;};'use strict';var _=require(_0x04d3('0x0'));var util=require(_0x04d3('0x1'));var moment=require(_0x04d3('0x2'));var BPromise=require(_0x04d3('0x3'));var rs=require(_0x04d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04d3('0x5'))['db'];var utils=require(_0x04d3('0x6'));var logger=require(_0x04d3('0x7'))(_0x04d3('0x8'));var config=require(_0x04d3('0x9'));var jayson=require(_0x04d3('0xa'));var client=jayson[_0x04d3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe58776,_0x1d7d62,_0x1a641e){return new BPromise(function(_0xbd36b5,_0x4b6cdc){return client[_0x04d3('0xc')](_0xe58776,_0x1a641e)['then'](function(_0x57db91){logger['info'](_0x04d3('0xd'),_0x1d7d62,_0x04d3('0xe'));logger[_0x04d3('0xf')](_0x04d3('0x10'),_0x1d7d62,_0x04d3('0xe'),JSON[_0x04d3('0x11')](_0x57db91));if(_0x57db91[_0x04d3('0x12')]){if(_0x57db91['error'][_0x04d3('0x13')]===0x1f4){logger[_0x04d3('0x12')](_0x04d3('0xd'),_0x1d7d62,_0x57db91[_0x04d3('0x12')]['message']);return _0x4b6cdc(_0x57db91[_0x04d3('0x12')][_0x04d3('0x14')]);}logger[_0x04d3('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x1d7d62,_0x57db91[_0x04d3('0x12')][_0x04d3('0x14')]);return _0xbd36b5(_0x57db91['error'][_0x04d3('0x14')]);}else{logger['info'](_0x04d3('0xd'),_0x1d7d62,_0x04d3('0xe'));_0xbd36b5(_0x57db91[_0x04d3('0x15')][_0x04d3('0x14')]);}})[_0x04d3('0x16')](function(_0x33dd6c){logger[_0x04d3('0x12')](_0x04d3('0xd'),_0x1d7d62,_0x33dd6c);_0x4b6cdc(_0x33dd6c);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index fe67194..2f0fc2a 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 _0x5bb7=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x5bb7,0x1ee));var _0x75bb=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x5bb7[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x75bb('0x0'));var util=require(_0x75bb('0x1'));var path=require(_0x75bb('0x2'));var timeout=require(_0x75bb('0x3'));var express=require(_0x75bb('0x4'));var router=express[_0x75bb('0x5')]();var fs_extra=require(_0x75bb('0x6'));var auth=require(_0x75bb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x75bb('0x8'));var controller=require(_0x75bb('0x9'));router[_0x75bb('0xa')]('/',auth[_0x75bb('0xb')](),controller[_0x75bb('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x75bb('0xd')]);router['get'](_0x75bb('0xe'),auth[_0x75bb('0xb')](),controller[_0x75bb('0xf')]);router[_0x75bb('0xa')](_0x75bb('0x10'),auth['isAuthenticated'](),controller[_0x75bb('0x11')]);router[_0x75bb('0x12')]('/',auth[_0x75bb('0xb')](),controller[_0x75bb('0x13')]);router[_0x75bb('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x75bb('0x14')]('/:id',auth[_0x75bb('0xb')](),controller[_0x75bb('0x15')]);router[_0x75bb('0x16')](_0x75bb('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0x75bb('0x18')]=router; \ No newline at end of file +var _0x39a9=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3cbb78,_0x443901){var _0x473af0=function(_0xdc9ad6){while(--_0xdc9ad6){_0x3cbb78['push'](_0x3cbb78['shift']());}};_0x473af0(++_0x443901);}(_0x39a9,0x1d0));var _0x939a=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x39a9[_0x46e523];return _0x5da0ee;};'use strict';var multer=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var path=require(_0x939a('0x2'));var timeout=require(_0x939a('0x3'));var express=require(_0x939a('0x4'));var router=express[_0x939a('0x5')]();var fs_extra=require(_0x939a('0x6'));var auth=require(_0x939a('0x7'));var interaction=require(_0x939a('0x8'));var config=require(_0x939a('0x9'));var controller=require(_0x939a('0xa'));router['get']('/',auth[_0x939a('0xb')](),controller[_0x939a('0xc')]);router[_0x939a('0xd')](_0x939a('0xe'),auth[_0x939a('0xb')](),controller[_0x939a('0xf')]);router[_0x939a('0xd')](_0x939a('0x10'),auth['isAuthenticated'](),controller[_0x939a('0x11')]);router[_0x939a('0xd')](_0x939a('0x12'),auth['isAuthenticated'](),controller[_0x939a('0x13')]);router[_0x939a('0x14')]('/',auth[_0x939a('0xb')](),controller['create']);router[_0x939a('0x14')](_0x939a('0x10'),auth[_0x939a('0xb')](),controller['addConfiguration']);router['put'](_0x939a('0xe'),auth[_0x939a('0xb')](),controller[_0x939a('0x15')]);router['delete'](_0x939a('0xe'),auth[_0x939a('0xb')](),controller[_0x939a('0x16')]);module[_0x939a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 74d22f2..ab50a8f 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 _0x4c6a=['HelpDesk','sequelize','exports','STRING'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x4c6a,0x195));var _0xa4c6=function(_0x2cc561,_0xe8c9ab){_0x2cc561=_0x2cc561-0x0;var _0x4ea6c0=_0x4c6a[_0x2cc561];return _0x4ea6c0;};'use strict';var Sequelize=require(_0xa4c6('0x0'));module[_0xa4c6('0x1')]={'name':{'type':Sequelize[_0xa4c6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa4c6('0x2')]},'username':{'type':Sequelize[_0xa4c6('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa4c6('0x3')},'remoteUri':{'type':Sequelize[_0xa4c6('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa4c6('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa4c6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x46ef=['STRING','HelpDesk','exports'];(function(_0x21b6f0,_0x3c948){var _0x1ec11a=function(_0x5d6656){while(--_0x5d6656){_0x21b6f0['push'](_0x21b6f0['shift']());}};_0x1ec11a(++_0x3c948);}(_0x46ef,0x1dc));var _0xf46e=function(_0x13f66f,_0x596f8d){_0x13f66f=_0x13f66f-0x0;var _0x1a4d26=_0x46ef[_0x13f66f];return _0x1a4d26;};'use strict';var Sequelize=require('sequelize');module[_0xf46e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf46e('0x1')]},'username':{'type':Sequelize[_0xf46e('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf46e('0x1')],'allowNull':![],'defaultValue':_0xf46e('0x2')},'remoteUri':{'type':Sequelize[_0xf46e('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf46e('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e5a80ae..e4d1480 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 _0x8b8c=['rows','catch','params','length','options','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','POST','token','success','sessionName','autogenerated','reference','owner','result','includes','remove','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll'];(function(_0x1abcb6,_0x1ef8b0){var _0x40a2e9=function(_0xb84a56){while(--_0xb84a56){_0x1abcb6['push'](_0x1abcb6['shift']());}};_0x40a2e9(++_0x1ef8b0);}(_0x8b8c,0x1a2));var _0xc8b8=function(_0x1b0c2b,_0x14c8a7){_0x1b0c2b=_0x1b0c2b-0x0;var _0x503427=_0x8b8c[_0x1b0c2b];return _0x503427;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8b8('0x0'));var zipdir=require(_0xc8b8('0x1'));var jsonpatch=require(_0xc8b8('0x2'));var rp=require(_0xc8b8('0x3'));var moment=require('moment');var BPromise=require(_0xc8b8('0x4'));var Mustache=require('mustache');var util=require(_0xc8b8('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc8b8('0x6'));var ejs=require(_0xc8b8('0x7'));var fs=require('fs');var fs_extra=require(_0xc8b8('0x8'));var _=require(_0xc8b8('0x9'));var squel=require(_0xc8b8('0xa'));var crypto=require(_0xc8b8('0xb'));var jsforce=require(_0xc8b8('0xc'));var deskjs=require(_0xc8b8('0xd'));var toCsv=require(_0xc8b8('0x6'));var querystring=require('querystring');var Papa=require(_0xc8b8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc8b8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8b8('0x10'))(_0xc8b8('0x11'));var utils=require(_0xc8b8('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc8b8('0x13'))['db'];var integrations=require(_0xc8b8('0x14'));function respondWithStatusCode(_0x1abe2c,_0x4db2a4){_0x4db2a4=_0x4db2a4||0xcc;return function(_0x142fc0){if(_0x142fc0){return _0x1abe2c[_0xc8b8('0x15')](_0x4db2a4);}return _0x1abe2c[_0xc8b8('0x16')](_0x4db2a4)[_0xc8b8('0x17')]();};}function respondWithResult(_0x5c7200,_0x404efc){_0x404efc=_0x404efc||0xc8;return function(_0xb313f6){if(_0xb313f6){return _0x5c7200[_0xc8b8('0x16')](_0x404efc)[_0xc8b8('0x18')](_0xb313f6);}};}function respondWithFilteredResult(_0x2d836c,_0x556385){return function(_0x44a5c3){if(_0x44a5c3){var _0x50e14f=typeof _0x556385[_0xc8b8('0x19')]===_0xc8b8('0x1a')&&typeof _0x556385[_0xc8b8('0x1b')]===_0xc8b8('0x1a');var _0x52f6b0=_0x44a5c3[_0xc8b8('0x1c')];var _0x3deb3b=_0x50e14f?0x0:_0x556385[_0xc8b8('0x19')];var _0x275cd9=_0x50e14f?_0x44a5c3[_0xc8b8('0x1c')]:_0x556385[_0xc8b8('0x19')]+_0x556385[_0xc8b8('0x1b')];var _0x49fa2f;if(_0x275cd9>=_0x52f6b0){_0x275cd9=_0x52f6b0;_0x49fa2f=0xc8;}else{_0x49fa2f=0xce;}_0x2d836c[_0xc8b8('0x16')](_0x49fa2f);return _0x2d836c['set']('Content-Range',_0x3deb3b+'-'+_0x275cd9+'/'+_0x52f6b0)['json'](_0x44a5c3);}return null;};}function patchUpdates(_0x3a3f75){return function(_0x527e2d){try{jsonpatch[_0xc8b8('0x1d')](_0x527e2d,_0x3a3f75,!![]);}catch(_0x3aef5f){return BPromise[_0xc8b8('0x1e')](_0x3aef5f);}return _0x527e2d[_0xc8b8('0x1f')]();};}function saveUpdates(_0x40c2b5,_0x124199){return function(_0x44b04d){if(_0x44b04d){return _0x44b04d['update'](_0x40c2b5)[_0xc8b8('0x20')](function(_0x417471){return _0x417471;});}return null;};}function removeEntity(_0x429b1d,_0x367396){return function(_0x8892a6){if(_0x8892a6){return _0x8892a6[_0xc8b8('0x21')]()[_0xc8b8('0x20')](function(){_0x429b1d[_0xc8b8('0x16')](0xcc)[_0xc8b8('0x17')]();});}};}function handleEntityNotFound(_0x5b16b2,_0x2db3eb){return function(_0x20dac5){if(!_0x20dac5){_0x5b16b2[_0xc8b8('0x15')](0x194);}return _0x20dac5;};}function handleError(_0x1182dd,_0x4979b9){_0x4979b9=_0x4979b9||0x1f4;return function(_0x3ab9d6){logger[_0xc8b8('0x22')](_0x3ab9d6['stack']);if(_0x3ab9d6[_0xc8b8('0x23')]){delete _0x3ab9d6[_0xc8b8('0x23')];}_0x1182dd[_0xc8b8('0x16')](_0x4979b9)[_0xc8b8('0x24')](_0x3ab9d6);};}exports['index']=function(_0x2a2938,_0xfe9cd7){var _0xa6fcd6={},_0x3e6181={},_0x33c2ef={'count':0x0,'rows':[]};var _0x558f51=_[_0xc8b8('0x25')](db[_0xc8b8('0x26')][_0xc8b8('0x27')],function(_0x1643d0){return{'name':_0x1643d0[_0xc8b8('0x28')],'type':_0x1643d0[_0xc8b8('0x29')][_0xc8b8('0x2a')]};});_0x3e6181[_0xc8b8('0x2b')]=_[_0xc8b8('0x25')](_0x558f51,_0xc8b8('0x23'));_0x3e6181[_0xc8b8('0x2c')]=_[_0xc8b8('0x2d')](_0x2a2938['query']);_0x3e6181[_0xc8b8('0x2e')]=_[_0xc8b8('0x2f')](_0x3e6181[_0xc8b8('0x2b')],_0x3e6181[_0xc8b8('0x2c')]);_0xa6fcd6['attributes']=_[_0xc8b8('0x2f')](_0x3e6181[_0xc8b8('0x2b')],qs[_0xc8b8('0x30')](_0x2a2938[_0xc8b8('0x2c')][_0xc8b8('0x30')]));_0xa6fcd6[_0xc8b8('0x31')]=_0xa6fcd6[_0xc8b8('0x31')]['length']?_0xa6fcd6[_0xc8b8('0x31')]:_0x3e6181[_0xc8b8('0x2b')];if(!_0x2a2938[_0xc8b8('0x2c')][_0xc8b8('0x32')](_0xc8b8('0x33'))){_0xa6fcd6[_0xc8b8('0x1b')]=qs['limit'](_0x2a2938['query']['limit']);_0xa6fcd6[_0xc8b8('0x19')]=qs['offset'](_0x2a2938[_0xc8b8('0x2c')][_0xc8b8('0x19')]);}_0xa6fcd6[_0xc8b8('0x34')]=qs[_0xc8b8('0x35')](_0x2a2938['query'][_0xc8b8('0x35')]);_0xa6fcd6[_0xc8b8('0x36')]=qs[_0xc8b8('0x2e')](_[_0xc8b8('0x37')](_0x2a2938['query'],_0x3e6181[_0xc8b8('0x2e')]),_0x558f51);if(_0x2a2938[_0xc8b8('0x2c')][_0xc8b8('0x38')]){_0xa6fcd6['where']=_['merge'](_0xa6fcd6[_0xc8b8('0x36')],{'$or':_[_0xc8b8('0x25')](_0x558f51,function(_0x8ac233){if(_0x8ac233[_0xc8b8('0x29')]!==_0xc8b8('0x39')){var _0x2ffd57={};_0x2ffd57[_0x8ac233[_0xc8b8('0x23')]]={'$like':'%'+_0x2a2938[_0xc8b8('0x2c')][_0xc8b8('0x38')]+'%'};return _0x2ffd57;}})});}_0xa6fcd6=_[_0xc8b8('0x3a')]({},_0xa6fcd6,_0x2a2938['options']);var _0x27bb97={'where':_0xa6fcd6['where']};return db[_0xc8b8('0x26')][_0xc8b8('0x1c')](_0x27bb97)[_0xc8b8('0x20')](function(_0x3888ae){_0x33c2ef[_0xc8b8('0x1c')]=_0x3888ae;if(_0x2a2938['query'][_0xc8b8('0x3b')]){_0xa6fcd6[_0xc8b8('0x3c')]=[{'all':!![]}];}return db['VtigerAccount'][_0xc8b8('0x3d')](_0xa6fcd6);})[_0xc8b8('0x20')](function(_0x5d2121){_0x33c2ef[_0xc8b8('0x3e')]=_0x5d2121;return _0x33c2ef;})[_0xc8b8('0x20')](respondWithFilteredResult(_0xfe9cd7,_0xa6fcd6))[_0xc8b8('0x3f')](handleError(_0xfe9cd7,null));};exports['show']=function(_0x2c205b,_0x30118b){var _0x7eed40={'raw':![],'where':{'id':_0x2c205b[_0xc8b8('0x40')]['id']}},_0x18af9f={};_0x18af9f['model']=_[_0xc8b8('0x2d')](db['VtigerAccount'][_0xc8b8('0x27')]);_0x18af9f[_0xc8b8('0x2c')]=_[_0xc8b8('0x2d')](_0x2c205b['query']);_0x18af9f[_0xc8b8('0x2e')]=_[_0xc8b8('0x2f')](_0x18af9f[_0xc8b8('0x2b')],_0x18af9f[_0xc8b8('0x2c')]);_0x7eed40[_0xc8b8('0x31')]=_['intersection'](_0x18af9f['model'],qs['fields'](_0x2c205b[_0xc8b8('0x2c')][_0xc8b8('0x30')]));_0x7eed40[_0xc8b8('0x31')]=_0x7eed40[_0xc8b8('0x31')][_0xc8b8('0x41')]?_0x7eed40[_0xc8b8('0x31')]:_0x18af9f['model'];if(_0x2c205b['query']['includeAll']){_0x7eed40['include']=[{'all':!![]}];}_0x7eed40=_[_0xc8b8('0x3a')]({},_0x7eed40,_0x2c205b[_0xc8b8('0x42')]);return db[_0xc8b8('0x26')][_0xc8b8('0x43')](_0x7eed40)['then'](handleEntityNotFound(_0x30118b,null))['then'](respondWithResult(_0x30118b,null))[_0xc8b8('0x3f')](handleError(_0x30118b,null));};exports['create']=function(_0x3ff23f,_0x406fe2){return db[_0xc8b8('0x26')][_0xc8b8('0x44')](_0x3ff23f[_0xc8b8('0x45')],{})['then'](respondWithResult(_0x406fe2,0xc9))[_0xc8b8('0x3f')](handleError(_0x406fe2,null));};exports[_0xc8b8('0x46')]=function(_0x420f3e,_0x3f9bb8){if(_0x420f3e[_0xc8b8('0x45')]['id']){delete _0x420f3e[_0xc8b8('0x45')]['id'];}return db[_0xc8b8('0x26')][_0xc8b8('0x43')]({'where':{'id':_0x420f3e[_0xc8b8('0x40')]['id']}})[_0xc8b8('0x20')](handleEntityNotFound(_0x3f9bb8,null))[_0xc8b8('0x20')](saveUpdates(_0x420f3e[_0xc8b8('0x45')],null))[_0xc8b8('0x20')](respondWithResult(_0x3f9bb8,null))['catch'](handleError(_0x3f9bb8,null));};exports[_0xc8b8('0x21')]=function(_0x4b5fed,_0x8c6ed7){return db['VtigerAccount'][_0xc8b8('0x43')]({'where':{'id':_0x4b5fed[_0xc8b8('0x40')]['id']}})[_0xc8b8('0x20')](handleEntityNotFound(_0x8c6ed7,null))[_0xc8b8('0x20')](removeEntity(_0x8c6ed7,null))[_0xc8b8('0x3f')](handleError(_0x8c6ed7,null));};exports[_0xc8b8('0x47')]=function(_0x54e95b,_0x3bdd68,_0x3f1459){var _0x4ad001={};var _0x4dc191={};var _0xca1443;var _0x975df3;return db[_0xc8b8('0x26')][_0xc8b8('0x48')]({'where':{'id':_0x54e95b[_0xc8b8('0x40')]['id']}})[_0xc8b8('0x20')](handleEntityNotFound(_0x3bdd68,null))[_0xc8b8('0x20')](function(_0x57ad6a){if(_0x57ad6a){_0xca1443=_0x57ad6a;_0x4dc191[_0xc8b8('0x2b')]=_[_0xc8b8('0x2d')](db[_0xc8b8('0x49')][_0xc8b8('0x27')]);_0x4dc191[_0xc8b8('0x2c')]=_[_0xc8b8('0x2d')](_0x54e95b[_0xc8b8('0x2c')]);_0x4dc191[_0xc8b8('0x2e')]=_['intersection'](_0x4dc191['model'],_0x4dc191[_0xc8b8('0x2c')]);_0x4ad001[_0xc8b8('0x31')]=_['intersection'](_0x4dc191[_0xc8b8('0x2b')],qs[_0xc8b8('0x30')](_0x54e95b[_0xc8b8('0x2c')][_0xc8b8('0x30')]));_0x4ad001[_0xc8b8('0x31')]=_0x4ad001['attributes'][_0xc8b8('0x41')]?_0x4ad001[_0xc8b8('0x31')]:_0x4dc191[_0xc8b8('0x2b')];_0x4ad001[_0xc8b8('0x34')]=qs[_0xc8b8('0x35')](_0x54e95b['query'][_0xc8b8('0x35')]);_0x4ad001[_0xc8b8('0x36')]=qs[_0xc8b8('0x2e')](_[_0xc8b8('0x37')](_0x54e95b['query'],_0x4dc191['filters']));if(_0x54e95b[_0xc8b8('0x2c')][_0xc8b8('0x38')]){_0x4ad001[_0xc8b8('0x36')]=_[_0xc8b8('0x3a')](_0x4ad001['where'],{'$or':_[_0xc8b8('0x25')](_0x4ad001[_0xc8b8('0x31')],function(_0xf40747){var _0x1ba0ba={};_0x1ba0ba[_0xf40747]={'$like':'%'+_0x54e95b[_0xc8b8('0x2c')]['filter']+'%'};return _0x1ba0ba;})});}_0x4ad001=_[_0xc8b8('0x3a')]({},_0x4ad001,_0x54e95b['options']);return _0xca1443[_0xc8b8('0x47')](_0x4ad001);}})[_0xc8b8('0x20')](function(_0x2a94c4){if(_0x2a94c4){_0x975df3=_0x2a94c4[_0xc8b8('0x41')];if(!_0x54e95b[_0xc8b8('0x2c')][_0xc8b8('0x32')](_0xc8b8('0x33'))){_0x4ad001[_0xc8b8('0x1b')]=qs['limit'](_0x54e95b[_0xc8b8('0x2c')]['limit']);_0x4ad001[_0xc8b8('0x19')]=qs['offset'](_0x54e95b[_0xc8b8('0x2c')][_0xc8b8('0x19')]);}return _0xca1443['getConfigurations'](_0x4ad001);}})[_0xc8b8('0x20')](function(_0x563ebc){if(_0x563ebc){return _0x563ebc?{'count':_0x975df3,'rows':_0x563ebc}:null;}})[_0xc8b8('0x20')](respondWithResult(_0x3bdd68,null))[_0xc8b8('0x3f')](handleError(_0x3bdd68,null));};exports[_0xc8b8('0x4a')]=function(_0x48e087,_0x2a8b91,_0x496037){if(_0x48e087[_0xc8b8('0x45')]['id']){delete _0x48e087[_0xc8b8('0x45')]['id'];}return db['VtigerAccount'][_0xc8b8('0x48')]({'where':{'id':_0x48e087[_0xc8b8('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a8b91,null))[_0xc8b8('0x20')](function(_0x5d8bef){if(_0x5d8bef){_0x48e087[_0xc8b8('0x45')][_0xc8b8('0x4b')]=_0x5d8bef['id'];_0x48e087[_0xc8b8('0x45')][_0xc8b8('0x4c')]=integrations[_0xc8b8('0x4d')](_0x48e087[_0xc8b8('0x45')][_0xc8b8('0x4e')],_0x48e087['body'][_0xc8b8('0x29')]);_0x48e087[_0xc8b8('0x45')]['Descriptions']=integrations[_0xc8b8('0x4f')](_0x48e087[_0xc8b8('0x45')][_0xc8b8('0x4e')],_0x48e087['body'][_0xc8b8('0x29')]);return db[_0xc8b8('0x49')][_0xc8b8('0x44')](_0x48e087['body'],{'include':[{'model':db['VtigerField'],'as':_0xc8b8('0x4c')},{'model':db[_0xc8b8('0x50')],'as':_0xc8b8('0x51')}]});}return null;})[_0xc8b8('0x20')](respondWithResult(_0x2a8b91,null))['catch'](handleError(_0x2a8b91,null));};var md5=require(_0xc8b8('0x52'));exports[_0xc8b8('0x53')]=function(_0x365181,_0x47518e,_0xab0324){var _0x32ff79=null;var _0x4058f0=null;var _0x17e58f=null;var _0x34a109=null;var _0x190fab='';return db['VtigerAccount'][_0xc8b8('0x48')]({'where':{'id':_0x365181['params']['id']},'attributes':['id','name',_0xc8b8('0x54'),_0xc8b8('0x55'),_0xc8b8('0x56'),_0xc8b8('0x57'),_0xc8b8('0x58'),_0xc8b8('0x59')]})['then'](handleEntityNotFound(_0x47518e,null))[_0xc8b8('0x20')](function(_0x10ee77){if(_0x10ee77){_0x32ff79=_0x10ee77[_0xc8b8('0x54')];_0x4058f0=_0x10ee77[_0xc8b8('0x59')];_0x17e58f=_0x10ee77['moduleName'];_0x190fab=_0x10ee77[_0xc8b8('0x57')];var _0x3f2b43=_0x190fab[_0xc8b8('0x5a')](-0x1);if(_0x3f2b43==='/'){_0x190fab=_0x190fab[_0xc8b8('0x5b')](0x0,_0x190fab['lastIndexOf'](_0x3f2b43));}_0x34a109=util[_0xc8b8('0x5c')](_0xc8b8('0x5d'),_0x190fab);var _0x323693={'method':_0xc8b8('0x5e'),'uri':_0x34a109,'qs':{'operation':_0xc8b8('0x5f'),'username':_0x10ee77[_0xc8b8('0x54')]},'json':!![]};return rp(_0x323693);}})[_0xc8b8('0x20')](function(_0x3eee70){if(_0x3eee70['success']){var _0x116681={'method':_0xc8b8('0x60'),'uri':_0x34a109,'form':{'operation':'login','username':_0x32ff79,'accessKey':md5(_0x3eee70['result'][_0xc8b8('0x61')]+_0x4058f0)},'json':!![]};return rp(_0x116681);}})[_0xc8b8('0x20')](function(_0x51a69c){if(_0x51a69c[_0xc8b8('0x62')]){var _0x265714={'method':_0xc8b8('0x5e'),'uri':_0x34a109,'qs':{'operation':'describe','username':_0x32ff79,'sessionName':_0x51a69c['result'][_0xc8b8('0x63')],'elementType':_0x17e58f},'json':!![]};return rp(_0x265714);}})['then'](function(_0x49733f){if(_0x49733f[_0xc8b8('0x62')]){var _0x4d979c=[_0xc8b8('0x64'),_0xc8b8('0x65'),_0xc8b8('0x66')];_['remove'](_0x49733f[_0xc8b8('0x67')][_0xc8b8('0x30')],function(_0x104994){return _0x4d979c[_0xc8b8('0x68')](_0x104994[_0xc8b8('0x29')][_0xc8b8('0x23')]);});_[_0xc8b8('0x69')](_0x49733f[_0xc8b8('0x67')][_0xc8b8('0x30')],function(_0x132f23){return _0x132f23[_0xc8b8('0x6a')]===_0xc8b8('0x6b');});return{'count':_0x49733f['result'][_0xc8b8('0x30')]['length'],'rows':_[_0xc8b8('0x25')](_0x49733f[_0xc8b8('0x67')][_0xc8b8('0x30')],function(_0x271914){return{'id':_0x271914[_0xc8b8('0x23')],'name':_0x271914['label'],'custom':_[_0xc8b8('0x6c')](_0x271914['name'],_0xc8b8('0x6d'))?!![]:![],'options':_0x271914[_0xc8b8('0x29')][_0xc8b8('0x23')]===_0xc8b8('0x6e')&&_0x271914[_0xc8b8('0x29')][_0xc8b8('0x6f')]['length']>0x0?_['map'](_0x271914[_0xc8b8('0x29')]['picklistValues'],function(_0xd5a3ec){return{'name':_0xd5a3ec[_0xc8b8('0x70')],'value':_0xd5a3ec[_0xc8b8('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x47518e,null))[_0xc8b8('0x3f')](function(_0x2395fc){console[_0xc8b8('0x72')](_0xc8b8('0x73')+_0x2395fc);var _0x58acec=_0x365181[_0xc8b8('0x2c')]['test']?0x1f4:_0x2395fc[_0xc8b8('0x74')]||0x1f4;logger['error'](_0xc8b8('0x75'),'getFields',_0x58acec,JSON[_0xc8b8('0x76')](_0x2395fc));delete _0x2395fc[_0xc8b8('0x23')];if(_0x58acec===0x191){_0x58acec=0x190;}_0x47518e[_0xc8b8('0x16')](_0x58acec)['send'](_0x365181[_0xc8b8('0x2c')][_0xc8b8('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x2395fc['statusCode']}:_0x2395fc);});}; \ No newline at end of file +var _0x8899=['sort','pick','filter','where','merge','type','includeAll','findAll','rows','show','params','length','include','options','find','catch','create','body','getConfigurations','findOne','VtigerConfiguration','order','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','owner','remove','editable','false','label','cf_','picklist','picklistValues','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x1978f8,_0x5dc5b0){var _0x285d93=function(_0x20656e){while(--_0x20656e){_0x1978f8['push'](_0x1978f8['shift']());}};_0x285d93(++_0x5dc5b0);}(_0x8899,0xb5));var _0x9889=function(_0x8b479b,_0x5a4c59){_0x8b479b=_0x8b479b-0x0;var _0x90fffe=_0x8899[_0x8b479b];return _0x90fffe;};'use strict';var emlformat=require(_0x9889('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9889('0x1'));var jsonpatch=require(_0x9889('0x2'));var rp=require(_0x9889('0x3'));var moment=require('moment');var BPromise=require(_0x9889('0x4'));var Mustache=require('mustache');var util=require(_0x9889('0x5'));var path=require('path');var sox=require(_0x9889('0x6'));var csv=require('to-csv');var ejs=require(_0x9889('0x7'));var fs=require('fs');var fs_extra=require(_0x9889('0x8'));var _=require(_0x9889('0x9'));var squel=require(_0x9889('0xa'));var crypto=require(_0x9889('0xb'));var jsforce=require(_0x9889('0xc'));var deskjs=require(_0x9889('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9889('0xe'));var Redis=require(_0x9889('0xf'));var authService=require(_0x9889('0x10'));var qs=require(_0x9889('0x11'));var as=require(_0x9889('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9889('0x13'))('api');var utils=require(_0x9889('0x14'));var config=require(_0x9889('0x15'));var licenseUtil=require(_0x9889('0x16'));var db=require(_0x9889('0x17'))['db'];var integrations=require(_0x9889('0x18'));function respondWithStatusCode(_0x58c707,_0x531db9){_0x531db9=_0x531db9||0xcc;return function(_0x2306c8){if(_0x2306c8){return _0x58c707[_0x9889('0x19')](_0x531db9);}return _0x58c707['status'](_0x531db9)[_0x9889('0x1a')]();};}function respondWithResult(_0x432424,_0x139187){_0x139187=_0x139187||0xc8;return function(_0x2ed2c2){if(_0x2ed2c2){return _0x432424[_0x9889('0x1b')](_0x139187)[_0x9889('0x1c')](_0x2ed2c2);}};}function respondWithFilteredResult(_0x5ab2e7,_0x432324){return function(_0x3e14d5){if(_0x3e14d5){var _0x17eea8=typeof _0x432324['offset']===_0x9889('0x1d')&&typeof _0x432324[_0x9889('0x1e')]===_0x9889('0x1d');var _0x28e760=_0x3e14d5[_0x9889('0x1f')];var _0x5a9931=_0x17eea8?0x0:_0x432324[_0x9889('0x20')];var _0x1591ef=_0x17eea8?_0x3e14d5[_0x9889('0x1f')]:_0x432324['offset']+_0x432324['limit'];var _0x4021d5;if(_0x1591ef>=_0x28e760){_0x1591ef=_0x28e760;_0x4021d5=0xc8;}else{_0x4021d5=0xce;}_0x5ab2e7[_0x9889('0x1b')](_0x4021d5);return _0x5ab2e7[_0x9889('0x21')]('Content-Range',_0x5a9931+'-'+_0x1591ef+'/'+_0x28e760)[_0x9889('0x1c')](_0x3e14d5);}return null;};}function patchUpdates(_0x1e980f){return function(_0x35b8c7){try{jsonpatch[_0x9889('0x22')](_0x35b8c7,_0x1e980f,!![]);}catch(_0x5f59c0){return BPromise[_0x9889('0x23')](_0x5f59c0);}return _0x35b8c7[_0x9889('0x24')]();};}function saveUpdates(_0x47095a,_0x5b2d7f){return function(_0x31ced3){if(_0x31ced3){return _0x31ced3[_0x9889('0x25')](_0x47095a)[_0x9889('0x26')](function(_0x134265){return _0x134265;});}return null;};}function removeEntity(_0x464559,_0x5a9bf2){return function(_0x16c603){if(_0x16c603){return _0x16c603[_0x9889('0x27')]()[_0x9889('0x26')](function(){_0x464559['status'](0xcc)[_0x9889('0x1a')]();});}};}function handleEntityNotFound(_0x3bde03,_0x175e39){return function(_0x34513c){if(!_0x34513c){_0x3bde03[_0x9889('0x19')](0x194);}return _0x34513c;};}function handleError(_0x4f69bb,_0x2fc024){_0x2fc024=_0x2fc024||0x1f4;return function(_0x83e260){logger[_0x9889('0x28')](_0x83e260[_0x9889('0x29')]);if(_0x83e260[_0x9889('0x2a')]){delete _0x83e260[_0x9889('0x2a')];}_0x4f69bb[_0x9889('0x1b')](_0x2fc024)[_0x9889('0x2b')](_0x83e260);};}exports['index']=function(_0x407166,_0x22398c){var _0x2c64f6={},_0x1cdbeb={},_0x240578={'count':0x0,'rows':[]};var _0x3c417e=_[_0x9889('0x2c')](db[_0x9889('0x2d')][_0x9889('0x2e')],function(_0x44a656){return{'name':_0x44a656[_0x9889('0x2f')],'type':_0x44a656['type']['key']};});_0x1cdbeb[_0x9889('0x30')]=_[_0x9889('0x2c')](_0x3c417e,_0x9889('0x2a'));_0x1cdbeb['query']=_[_0x9889('0x31')](_0x407166[_0x9889('0x32')]);_0x1cdbeb[_0x9889('0x33')]=_[_0x9889('0x34')](_0x1cdbeb[_0x9889('0x30')],_0x1cdbeb[_0x9889('0x32')]);_0x2c64f6['attributes']=_[_0x9889('0x34')](_0x1cdbeb['model'],qs[_0x9889('0x35')](_0x407166['query'][_0x9889('0x35')]));_0x2c64f6[_0x9889('0x36')]=_0x2c64f6[_0x9889('0x36')]['length']?_0x2c64f6['attributes']:_0x1cdbeb['model'];if(!_0x407166[_0x9889('0x32')][_0x9889('0x37')](_0x9889('0x38'))){_0x2c64f6['limit']=qs['limit'](_0x407166[_0x9889('0x32')]['limit']);_0x2c64f6[_0x9889('0x20')]=qs[_0x9889('0x20')](_0x407166[_0x9889('0x32')][_0x9889('0x20')]);}_0x2c64f6['order']=qs[_0x9889('0x39')](_0x407166[_0x9889('0x32')][_0x9889('0x39')]);_0x2c64f6['where']=qs[_0x9889('0x33')](_[_0x9889('0x3a')](_0x407166[_0x9889('0x32')],_0x1cdbeb['filters']),_0x3c417e);if(_0x407166[_0x9889('0x32')][_0x9889('0x3b')]){_0x2c64f6[_0x9889('0x3c')]=_[_0x9889('0x3d')](_0x2c64f6['where'],{'$or':_[_0x9889('0x2c')](_0x3c417e,function(_0x150246){if(_0x150246[_0x9889('0x3e')]!=='VIRTUAL'){var _0x1847ff={};_0x1847ff[_0x150246[_0x9889('0x2a')]]={'$like':'%'+_0x407166[_0x9889('0x32')][_0x9889('0x3b')]+'%'};return _0x1847ff;}})});}_0x2c64f6=_['merge']({},_0x2c64f6,_0x407166['options']);var _0x1b0b19={'where':_0x2c64f6[_0x9889('0x3c')]};return db['VtigerAccount'][_0x9889('0x1f')](_0x1b0b19)[_0x9889('0x26')](function(_0x4e95ac){_0x240578[_0x9889('0x1f')]=_0x4e95ac;if(_0x407166[_0x9889('0x32')][_0x9889('0x3f')]){_0x2c64f6['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x9889('0x40')](_0x2c64f6);})[_0x9889('0x26')](function(_0x622f4f){_0x240578[_0x9889('0x41')]=_0x622f4f;return _0x240578;})['then'](respondWithFilteredResult(_0x22398c,_0x2c64f6))['catch'](handleError(_0x22398c,null));};exports[_0x9889('0x42')]=function(_0x28d538,_0x59b2a6){var _0x26871d={'raw':![],'where':{'id':_0x28d538[_0x9889('0x43')]['id']}},_0x2b2993={};_0x2b2993[_0x9889('0x30')]=_[_0x9889('0x31')](db[_0x9889('0x2d')][_0x9889('0x2e')]);_0x2b2993[_0x9889('0x32')]=_[_0x9889('0x31')](_0x28d538[_0x9889('0x32')]);_0x2b2993[_0x9889('0x33')]=_[_0x9889('0x34')](_0x2b2993[_0x9889('0x30')],_0x2b2993[_0x9889('0x32')]);_0x26871d['attributes']=_[_0x9889('0x34')](_0x2b2993[_0x9889('0x30')],qs[_0x9889('0x35')](_0x28d538[_0x9889('0x32')][_0x9889('0x35')]));_0x26871d['attributes']=_0x26871d['attributes'][_0x9889('0x44')]?_0x26871d[_0x9889('0x36')]:_0x2b2993[_0x9889('0x30')];if(_0x28d538[_0x9889('0x32')][_0x9889('0x3f')]){_0x26871d[_0x9889('0x45')]=[{'all':!![]}];}_0x26871d=_['merge']({},_0x26871d,_0x28d538[_0x9889('0x46')]);return db[_0x9889('0x2d')][_0x9889('0x47')](_0x26871d)['then'](handleEntityNotFound(_0x59b2a6,null))['then'](respondWithResult(_0x59b2a6,null))[_0x9889('0x48')](handleError(_0x59b2a6,null));};exports[_0x9889('0x49')]=function(_0x5291e0,_0x416616){return db[_0x9889('0x2d')]['create'](_0x5291e0['body'],{})[_0x9889('0x26')](respondWithResult(_0x416616,0xc9))[_0x9889('0x48')](handleError(_0x416616,null));};exports['update']=function(_0x14829c,_0x1267a1){if(_0x14829c[_0x9889('0x4a')]['id']){delete _0x14829c['body']['id'];}return db['VtigerAccount'][_0x9889('0x47')]({'where':{'id':_0x14829c['params']['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x1267a1,null))[_0x9889('0x26')](saveUpdates(_0x14829c[_0x9889('0x4a')],null))[_0x9889('0x26')](respondWithResult(_0x1267a1,null))[_0x9889('0x48')](handleError(_0x1267a1,null));};exports['destroy']=function(_0x284f79,_0x12ebc3){return db['VtigerAccount']['find']({'where':{'id':_0x284f79['params']['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x12ebc3,null))[_0x9889('0x26')](removeEntity(_0x12ebc3,null))['catch'](handleError(_0x12ebc3,null));};exports[_0x9889('0x4b')]=function(_0x528a85,_0x1149a2,_0x7a6df6){var _0x200fec={};var _0x1ed113={};var _0x20d571;var _0xf1dafd;return db[_0x9889('0x2d')][_0x9889('0x4c')]({'where':{'id':_0x528a85[_0x9889('0x43')]['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x1149a2,null))[_0x9889('0x26')](function(_0x3dce03){if(_0x3dce03){_0x20d571=_0x3dce03;_0x1ed113[_0x9889('0x30')]=_[_0x9889('0x31')](db[_0x9889('0x4d')]['rawAttributes']);_0x1ed113[_0x9889('0x32')]=_[_0x9889('0x31')](_0x528a85[_0x9889('0x32')]);_0x1ed113[_0x9889('0x33')]=_['intersection'](_0x1ed113[_0x9889('0x30')],_0x1ed113[_0x9889('0x32')]);_0x200fec['attributes']=_['intersection'](_0x1ed113['model'],qs['fields'](_0x528a85[_0x9889('0x32')][_0x9889('0x35')]));_0x200fec[_0x9889('0x36')]=_0x200fec['attributes'][_0x9889('0x44')]?_0x200fec[_0x9889('0x36')]:_0x1ed113[_0x9889('0x30')];_0x200fec[_0x9889('0x4e')]=qs[_0x9889('0x39')](_0x528a85[_0x9889('0x32')][_0x9889('0x39')]);_0x200fec[_0x9889('0x3c')]=qs[_0x9889('0x33')](_[_0x9889('0x3a')](_0x528a85[_0x9889('0x32')],_0x1ed113['filters']));if(_0x528a85[_0x9889('0x32')][_0x9889('0x3b')]){_0x200fec[_0x9889('0x3c')]=_[_0x9889('0x3d')](_0x200fec['where'],{'$or':_[_0x9889('0x2c')](_0x200fec[_0x9889('0x36')],function(_0x102ca4){var _0x121e56={};_0x121e56[_0x102ca4]={'$like':'%'+_0x528a85[_0x9889('0x32')][_0x9889('0x3b')]+'%'};return _0x121e56;})});}_0x200fec=_[_0x9889('0x3d')]({},_0x200fec,_0x528a85[_0x9889('0x46')]);return _0x20d571[_0x9889('0x4b')](_0x200fec);}})[_0x9889('0x26')](function(_0x56e53d){if(_0x56e53d){_0xf1dafd=_0x56e53d[_0x9889('0x44')];if(!_0x528a85['query']['hasOwnProperty'](_0x9889('0x38'))){_0x200fec['limit']=qs['limit'](_0x528a85[_0x9889('0x32')][_0x9889('0x1e')]);_0x200fec[_0x9889('0x20')]=qs['offset'](_0x528a85[_0x9889('0x32')][_0x9889('0x20')]);}return _0x20d571[_0x9889('0x4b')](_0x200fec);}})[_0x9889('0x26')](function(_0x28e405){if(_0x28e405){return _0x28e405?{'count':_0xf1dafd,'rows':_0x28e405}:null;}})[_0x9889('0x26')](respondWithResult(_0x1149a2,null))[_0x9889('0x48')](handleError(_0x1149a2,null));};exports['addConfiguration']=function(_0x4b9e83,_0x4becd8,_0x33779c){if(_0x4b9e83['body']['id']){delete _0x4b9e83[_0x9889('0x4a')]['id'];}return db['VtigerAccount'][_0x9889('0x4c')]({'where':{'id':_0x4b9e83[_0x9889('0x43')]['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x4becd8,null))[_0x9889('0x26')](function(_0x173b89){if(_0x173b89){_0x4b9e83['body'][_0x9889('0x4f')]=_0x173b89['id'];_0x4b9e83[_0x9889('0x4a')]['Subjects']=integrations[_0x9889('0x50')](_0x4b9e83[_0x9889('0x4a')][_0x9889('0x51')],_0x4b9e83[_0x9889('0x4a')][_0x9889('0x3e')]);_0x4b9e83['body'][_0x9889('0x52')]=integrations[_0x9889('0x53')](_0x4b9e83[_0x9889('0x4a')][_0x9889('0x51')],_0x4b9e83[_0x9889('0x4a')][_0x9889('0x3e')]);return db[_0x9889('0x4d')][_0x9889('0x49')](_0x4b9e83[_0x9889('0x4a')],{'include':[{'model':db[_0x9889('0x54')],'as':_0x9889('0x55')},{'model':db[_0x9889('0x54')],'as':_0x9889('0x52')}]});}return null;})[_0x9889('0x26')](respondWithResult(_0x4becd8,null))[_0x9889('0x48')](handleError(_0x4becd8,null));};var md5=require(_0x9889('0x56'));exports['getFields']=function(_0x2b6014,_0x21d730,_0xa19671){var _0x46abdc=null;var _0x557d58=null;var _0x16aeb1=null;var _0x3bd653=null;var _0x561019='';return db[_0x9889('0x2d')][_0x9889('0x4c')]({'where':{'id':_0x2b6014[_0x9889('0x43')]['id']},'attributes':['id',_0x9889('0x2a'),_0x9889('0x57'),_0x9889('0x58'),_0x9889('0x59'),_0x9889('0x5a'),_0x9889('0x5b'),_0x9889('0x5c')]})[_0x9889('0x26')](handleEntityNotFound(_0x21d730,null))[_0x9889('0x26')](function(_0x51fcd2){if(_0x51fcd2){_0x46abdc=_0x51fcd2[_0x9889('0x57')];_0x557d58=_0x51fcd2[_0x9889('0x5c')];_0x16aeb1=_0x51fcd2[_0x9889('0x59')];_0x561019=_0x51fcd2['remoteUri'];var _0x6bdb2d=_0x561019['slice'](-0x1);if(_0x6bdb2d==='/'){_0x561019=_0x561019['substring'](0x0,_0x561019[_0x9889('0x5d')](_0x6bdb2d));}_0x3bd653=util[_0x9889('0x5e')](_0x9889('0x5f'),_0x561019);var _0x22cbc3={'method':_0x9889('0x60'),'uri':_0x3bd653,'qs':{'operation':_0x9889('0x61'),'username':_0x51fcd2['username']},'json':!![]};return rp(_0x22cbc3);}})[_0x9889('0x26')](function(_0x5a1a16){if(_0x5a1a16[_0x9889('0x62')]){var _0x48e945={'method':_0x9889('0x63'),'uri':_0x3bd653,'form':{'operation':_0x9889('0x64'),'username':_0x46abdc,'accessKey':md5(_0x5a1a16[_0x9889('0x65')][_0x9889('0x66')]+_0x557d58)},'json':!![]};return rp(_0x48e945);}})[_0x9889('0x26')](function(_0x1b27ac){if(_0x1b27ac[_0x9889('0x62')]){var _0x530db5={'method':_0x9889('0x60'),'uri':_0x3bd653,'qs':{'operation':_0x9889('0x67'),'username':_0x46abdc,'sessionName':_0x1b27ac[_0x9889('0x65')][_0x9889('0x68')],'elementType':_0x16aeb1},'json':!![]};return rp(_0x530db5);}})[_0x9889('0x26')](function(_0x16decb){if(_0x16decb[_0x9889('0x62')]){var _0x4a7ab7=['autogenerated','reference',_0x9889('0x69')];_[_0x9889('0x6a')](_0x16decb[_0x9889('0x65')][_0x9889('0x35')],function(_0x25959){return _0x4a7ab7['includes'](_0x25959[_0x9889('0x3e')]['name']);});_[_0x9889('0x6a')](_0x16decb[_0x9889('0x65')][_0x9889('0x35')],function(_0x25d143){return _0x25d143[_0x9889('0x6b')]===_0x9889('0x6c');});return{'count':_0x16decb[_0x9889('0x65')][_0x9889('0x35')][_0x9889('0x44')],'rows':_['map'](_0x16decb[_0x9889('0x65')]['fields'],function(_0x6d269e){return{'id':_0x6d269e[_0x9889('0x2a')],'name':_0x6d269e[_0x9889('0x6d')],'custom':_['startsWith'](_0x6d269e[_0x9889('0x2a')],_0x9889('0x6e'))?!![]:![],'options':_0x6d269e[_0x9889('0x3e')][_0x9889('0x2a')]===_0x9889('0x6f')&&_0x6d269e['type'][_0x9889('0x70')][_0x9889('0x44')]>0x0?_[_0x9889('0x2c')](_0x6d269e[_0x9889('0x3e')][_0x9889('0x70')],function(_0x2a0278){return{'name':_0x2a0278[_0x9889('0x6d')],'value':_0x2a0278['value']};}):[]};})};}})[_0x9889('0x26')](respondWithResult(_0x21d730,null))[_0x9889('0x48')](function(_0x24f37f){console['log'](_0x9889('0x71')+_0x24f37f);var _0x29a1cd=_0x2b6014[_0x9889('0x32')]['test']?0x1f4:_0x24f37f['statusCode']||0x1f4;logger[_0x9889('0x28')](_0x9889('0x72'),'getFields',_0x29a1cd,JSON[_0x9889('0x73')](_0x24f37f));delete _0x24f37f[_0x9889('0x2a')];if(_0x29a1cd===0x191){_0x29a1cd=0x190;}_0x21d730[_0x9889('0x1b')](_0x29a1cd)[_0x9889('0x2b')](_0x2b6014[_0x9889('0x32')][_0x9889('0x74')]?{'message':_0x9889('0x75'),'statusCode':_0x24f37f[_0x9889('0x76')]}:_0x24f37f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 2f4bbfc..e28947c 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 _0xffdd=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x6823e,_0xc66f0e){var _0x5a2be8=function(_0x461770){while(--_0x461770){_0x6823e['push'](_0x6823e['shift']());}};_0x5a2be8(++_0xc66f0e);}(_0xffdd,0x193));var _0xdffd=function(_0x32b999,_0x2b1f74){_0x32b999=_0x32b999-0x0;var _0x31cd06=_0xffdd[_0x32b999];return _0x31cd06;};'use strict';var _=require(_0xdffd('0x0'));var util=require(_0xdffd('0x1'));var logger=require(_0xdffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdffd('0x3'));var rp=require(_0xdffd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdffd('0x5'));var config=require(_0xdffd('0x6'));var attributes=require(_0xdffd('0x7'));var integrations=require(_0xdffd('0x8'));module['exports']=function(_0x581162,_0x4835f6){return _0x581162[_0xdffd('0x9')](_0xdffd('0xa'),attributes,{'tableName':_0xdffd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbc5=['bluebird','path','rimraf','../../config/environment','exports','define','int_vtiger_accounts','../../config/logger','api','moment'];(function(_0x242270,_0x50a068){var _0x50bfe4=function(_0x1ccd96){while(--_0x1ccd96){_0x242270['push'](_0x242270['shift']());}};_0x50bfe4(++_0x50a068);}(_0xfbc5,0x1ab));var _0x5fbc=function(_0x915635,_0x50233f){_0x915635=_0x915635-0x0;var _0x154584=_0xfbc5[_0x915635];return _0x154584;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5fbc('0x0'))(_0x5fbc('0x1'));var moment=require(_0x5fbc('0x2'));var BPromise=require(_0x5fbc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fbc('0x4'));var rimraf=require(_0x5fbc('0x5'));var config=require(_0x5fbc('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5fbc('0x7')]=function(_0x1169e7,_0x4ab5b0){return _0x1169e7[_0x5fbc('0x8')]('VtigerAccount',attributes,{'tableName':_0x5fbc('0x9'),'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 7881863..0bec881 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 _0x1d2d=['error','code','message','result','catch','VtigerAccount','findAll','raw','where','options','attributes','limit','map','include','model','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x22f8a2,_0x2c6908){var _0x586c6e=function(_0xb3358b){while(--_0xb3358b){_0x22f8a2['push'](_0x22f8a2['shift']());}};_0x586c6e(++_0x2c6908);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x438c38,_0x584934){_0x438c38=_0x438c38-0x0;var _0x3390c8=_0x1d2d[_0x438c38];return _0x3390c8;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});}exports['GetVtigerAccount']=function(_0x3be186){var _0x55320b=this;return new Promise(function(_0x247b3a,_0x42565b){return db[_0xd1d2('0x18')][_0xd1d2('0x19')]({'raw':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1b')]||null:null,'attributes':_0x3be186[_0xd1d2('0x1c')]?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'limit':_0x3be186['options']?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1e')]||null:null,'include':_0x3be186[_0xd1d2('0x1c')]?_0x3be186['options']['include']?_[_0xd1d2('0x1f')](_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x20')],function(_0x2f92ee){return{'model':db[_0x2f92ee[_0xd1d2('0x21')]],'as':_0x2f92ee['as'],'attributes':_0x2f92ee[_0xd1d2('0x1d')],'include':_0x2f92ee[_0xd1d2('0x20')]?_['map'](_0x2f92ee[_0xd1d2('0x20')],function(_0x42da6d){return{'model':db[_0x42da6d[_0xd1d2('0x21')]],'as':_0x42da6d['as'],'attributes':_0x42da6d[_0xd1d2('0x1d')],'include':_0x42da6d[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x42da6d[_0xd1d2('0x20')],function(_0x34faf7){return{'model':db[_0x34faf7[_0xd1d2('0x21')]],'as':_0x34faf7['as'],'attributes':_0x34faf7[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x4e1bc2){logger['info'](_0xd1d2('0x22'),_0x3be186);logger[_0xd1d2('0x10')](_0xd1d2('0x22'),_0x3be186,JSON[_0xd1d2('0x12')](_0x4e1bc2));_0x247b3a(_0x4e1bc2);})[_0xd1d2('0x17')](function(_0x48ade1){logger[_0xd1d2('0x13')](_0xd1d2('0x22'),_0x48ade1[_0xd1d2('0x15')],_0x3be186);_0x42565b(_0x55320b['error'](0x1f4,_0x48ade1[_0xd1d2('0x15')]));});});};exports[_0xd1d2('0x23')]=function(_0xbd855a){var _0x56557d=this;return new Promise(function(_0x419db7,_0x18528f){return db[_0xd1d2('0x18')][_0xd1d2('0x24')]({'raw':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1b')]||null:null,'attributes':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'include':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0xbd855a[_0xd1d2('0x1c')]['include'],function(_0x1541ff){return{'model':db[_0x1541ff[_0xd1d2('0x21')]],'as':_0x1541ff['as'],'attributes':_0x1541ff[_0xd1d2('0x1d')],'include':_0x1541ff['include']?_[_0xd1d2('0x1f')](_0x1541ff['include'],function(_0x57a7fb){return{'model':db[_0x57a7fb[_0xd1d2('0x21')]],'as':_0x57a7fb['as'],'attributes':_0x57a7fb[_0xd1d2('0x1d')],'include':_0x57a7fb[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x57a7fb[_0xd1d2('0x20')],function(_0x2d2d12){return{'model':db[_0x2d2d12['model']],'as':_0x2d2d12['as'],'attributes':_0x2d2d12[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x5bdf40){logger[_0xd1d2('0xd')](_0xd1d2('0x23'),_0xbd855a);logger[_0xd1d2('0x10')](_0xd1d2('0x23'),_0xbd855a,JSON['stringify'](_0x5bdf40));_0x419db7(_0x5bdf40);})['catch'](function(_0x2fd2c5){logger['error']('ShowVtigerAccount',_0x2fd2c5['message'],_0xbd855a);_0x18528f(_0x56557d[_0xd1d2('0x13')](0x1f4,_0x2fd2c5['message']));});});}; \ No newline at end of file +var _0x97c1=['error','message','result','catch','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetVtigerAccount','debug','find','where','ShowVtigerAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x26f84d,_0x154717){var _0x5a6bf8=function(_0x1c50e6){while(--_0x1c50e6){_0x26f84d['push'](_0x26f84d['shift']());}};_0x5a6bf8(++_0x154717);}(_0x97c1,0xdf));var _0x197c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x97c1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['GetVtigerAccount']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')]({'raw':_0x372311[_0x197c('0x15')]?_0x372311['options'][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')]['where']||null:null,'attributes':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x17')]||null:null,'limit':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x18')]||null:null,'include':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x372311[_0x197c('0x15')][_0x197c('0x19')],function(_0x174942){return{'model':db[_0x174942[_0x197c('0x1b')]],'as':_0x174942['as'],'attributes':_0x174942[_0x197c('0x17')],'include':_0x174942[_0x197c('0x19')]?_['map'](_0x174942[_0x197c('0x19')],function(_0x2911dd){return{'model':db[_0x2911dd[_0x197c('0x1b')]],'as':_0x2911dd['as'],'attributes':_0x2911dd['attributes'],'include':_0x2911dd[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x2911dd['include'],function(_0x5e7bc9){return{'model':db[_0x5e7bc9[_0x197c('0x1b')]],'as':_0x5e7bc9['as'],'attributes':_0x5e7bc9['attributes']};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x14b0aa){logger[_0x197c('0xa')](_0x197c('0x1d'),_0x372311);logger[_0x197c('0x1e')](_0x197c('0x1d'),_0x372311,JSON[_0x197c('0xe')](_0x14b0aa));_0x50ac52(_0x14b0aa);})[_0x197c('0x12')](function(_0x4422d1){logger['error']('GetVtigerAccount',_0x4422d1['message'],_0x372311);_0x1725d9(_0x47aaa9['error'](0x1f4,_0x4422d1[_0x197c('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x252cde){var _0x35dbf3=this;return new Promise(function(_0x58bc60,_0x422ac6){return db['VtigerAccount'][_0x197c('0x1f')]({'raw':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x20')]||null:null,'attributes':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')]['attributes']||null:null,'include':_0x252cde['options']?_0x252cde[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x252cde[_0x197c('0x15')][_0x197c('0x19')],function(_0x1cb7e8){return{'model':db[_0x1cb7e8[_0x197c('0x1b')]],'as':_0x1cb7e8['as'],'attributes':_0x1cb7e8['attributes'],'include':_0x1cb7e8['include']?_[_0x197c('0x1a')](_0x1cb7e8[_0x197c('0x19')],function(_0x4d085b){return{'model':db[_0x4d085b['model']],'as':_0x4d085b['as'],'attributes':_0x4d085b[_0x197c('0x17')],'include':_0x4d085b[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x4d085b[_0x197c('0x19')],function(_0x45095c){return{'model':db[_0x45095c[_0x197c('0x1b')]],'as':_0x45095c['as'],'attributes':_0x45095c[_0x197c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x44ce68){logger['info'](_0x197c('0x21'),_0x252cde);logger[_0x197c('0x1e')](_0x197c('0x21'),_0x252cde,JSON[_0x197c('0xe')](_0x44ce68));_0x58bc60(_0x44ce68);})[_0x197c('0x12')](function(_0x151e2f){logger['error'](_0x197c('0x21'),_0x151e2f[_0x197c('0x10')],_0x252cde);_0x422ac6(_0x35dbf3[_0x197c('0xf')](0x1f4,_0x151e2f['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 26b0184..702d573 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 _0x9cd5=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x346c39,_0x193bcf){var _0x46fe96=function(_0x24b4d8){while(--_0x24b4d8){_0x346c39['push'](_0x346c39['shift']());}};_0x46fe96(++_0x193bcf);}(_0x9cd5,0x84));var _0x59cd=function(_0x2b346a,_0x248484){_0x2b346a=_0x2b346a-0x0;var _0x28cd72=_0x9cd5[_0x2b346a];return _0x28cd72;};'use strict';var multer=require(_0x59cd('0x0'));var util=require(_0x59cd('0x1'));var path=require(_0x59cd('0x2'));var timeout=require(_0x59cd('0x3'));var express=require(_0x59cd('0x4'));var router=express[_0x59cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x59cd('0x6'));var interaction=require(_0x59cd('0x7'));var config=require('../../config/environment');var controller=require(_0x59cd('0x8'));router[_0x59cd('0x9')]('/',auth[_0x59cd('0xa')](),controller[_0x59cd('0xb')]);router[_0x59cd('0x9')](_0x59cd('0xc'),auth[_0x59cd('0xa')](),controller[_0x59cd('0xd')]);router[_0x59cd('0x9')](_0x59cd('0xe'),auth[_0x59cd('0xa')](),controller[_0x59cd('0xf')]);router[_0x59cd('0x9')](_0x59cd('0x10'),auth['isAuthenticated'](),controller[_0x59cd('0x11')]);router['get'](_0x59cd('0x12'),auth[_0x59cd('0xa')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x59cd('0x13')]);router[_0x59cd('0x14')](_0x59cd('0xc'),auth[_0x59cd('0xa')](),controller[_0x59cd('0x15')]);router['delete'](_0x59cd('0xc'),auth[_0x59cd('0xa')](),controller[_0x59cd('0x16')]);module[_0x59cd('0x17')]=router; \ No newline at end of file +var _0xc971=['/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x304c77,_0x3f4bec){var _0x26ddf7=function(_0x32f3b3){while(--_0x32f3b3){_0x304c77['push'](_0x304c77['shift']());}};_0x26ddf7(++_0x3f4bec);}(_0xc971,0xbb));var _0x1c97=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xc971[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x1c97('0x0'));var util=require('util');var path=require(_0x1c97('0x1'));var timeout=require(_0x1c97('0x2'));var express=require('express');var router=express[_0x1c97('0x3')]();var fs_extra=require(_0x1c97('0x4'));var auth=require(_0x1c97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1c97('0x6'));var controller=require(_0x1c97('0x7'));router[_0x1c97('0x8')]('/',auth[_0x1c97('0x9')](),controller[_0x1c97('0xa')]);router[_0x1c97('0x8')](_0x1c97('0xb'),auth[_0x1c97('0x9')](),controller['show']);router['get'](_0x1c97('0xc'),auth[_0x1c97('0x9')](),controller[_0x1c97('0xd')]);router[_0x1c97('0x8')](_0x1c97('0xe'),auth[_0x1c97('0x9')](),controller[_0x1c97('0xf')]);router[_0x1c97('0x8')](_0x1c97('0x10'),auth[_0x1c97('0x9')](),controller[_0x1c97('0x11')]);router[_0x1c97('0x12')]('/',auth[_0x1c97('0x9')](),controller['create']);router[_0x1c97('0x13')](_0x1c97('0xb'),auth[_0x1c97('0x9')](),controller['update']);router['delete'](_0x1c97('0xb'),auth[_0x1c97('0x9')](),controller[_0x1c97('0x14')]);module[_0x1c97('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5122324..474e626 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 _0x935c=['STRING'];(function(_0x4e8e68,_0x52a7b8){var _0x3c1398=function(_0x315eb8){while(--_0x315eb8){_0x4e8e68['push'](_0x4e8e68['shift']());}};_0x3c1398(++_0x52a7b8);}(_0x935c,0x150));var _0xc935=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x935c[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc935('0x0')]},'description':{'type':Sequelize[_0xc935('0x0')]}}; \ No newline at end of file +var _0x865b=['sequelize','STRING'];(function(_0x484d35,_0x41e4ba){var _0x2a3f74=function(_0xd2dd7d){while(--_0xd2dd7d){_0x484d35['push'](_0x484d35['shift']());}};_0x2a3f74(++_0x41e4ba);}(_0x865b,0x124));var _0xb865=function(_0x1503ef,_0x28d2b0){_0x1503ef=_0x1503ef-0x0;var _0x2d2916=_0x865b[_0x1503ef];return _0x2d2916;};'use strict';var Sequelize=require(_0xb865('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb865('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d34c9b4..f11ef6f 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 _0xccb3=['destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','VtigerConfiguration','findAll','rows','params','includeAll','include','find','create','body','catch','findOne','getSubjects','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','set','Content-Range','json','apply','reject','update','then'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xccb3,0x15a));var _0x3ccb=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xccb3[_0x1fc1f9];return _0x4987ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ccb('0x0'));var zipdir=require(_0x3ccb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ccb('0x2'));var BPromise=require(_0x3ccb('0x3'));var Mustache=require(_0x3ccb('0x4'));var util=require('util');var path=require(_0x3ccb('0x5'));var sox=require(_0x3ccb('0x6'));var csv=require(_0x3ccb('0x7'));var ejs=require(_0x3ccb('0x8'));var fs=require('fs');var fs_extra=require(_0x3ccb('0x9'));var _=require('lodash');var squel=require(_0x3ccb('0xa'));var crypto=require(_0x3ccb('0xb'));var jsforce=require(_0x3ccb('0xc'));var deskjs=require(_0x3ccb('0xd'));var toCsv=require(_0x3ccb('0x7'));var querystring=require('querystring');var Papa=require(_0x3ccb('0xe'));var Redis=require(_0x3ccb('0xf'));var authService=require(_0x3ccb('0x10'));var qs=require(_0x3ccb('0x11'));var as=require(_0x3ccb('0x12'));var hardwareService=require(_0x3ccb('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3ccb('0x14'));var licenseUtil=require(_0x3ccb('0x15'));var db=require(_0x3ccb('0x16'))['db'];function respondWithStatusCode(_0x26a146,_0x40351){_0x40351=_0x40351||0xcc;return function(_0x2eb54c){if(_0x2eb54c){return _0x26a146['sendStatus'](_0x40351);}return _0x26a146[_0x3ccb('0x17')](_0x40351)[_0x3ccb('0x18')]();};}function respondWithResult(_0x53cb06,_0x2e39d9){_0x2e39d9=_0x2e39d9||0xc8;return function(_0x2526f8){if(_0x2526f8){return _0x53cb06[_0x3ccb('0x17')](_0x2e39d9)['json'](_0x2526f8);}};}function respondWithFilteredResult(_0x37395e,_0x2d9c90){return function(_0x756045){if(_0x756045){var _0x1abcbe=typeof _0x2d9c90[_0x3ccb('0x19')]==='undefined'&&typeof _0x2d9c90['limit']==='undefined';var _0x3487c9=_0x756045['count'];var _0x5765de=_0x1abcbe?0x0:_0x2d9c90['offset'];var _0x353130=_0x1abcbe?_0x756045[_0x3ccb('0x1a')]:_0x2d9c90[_0x3ccb('0x19')]+_0x2d9c90['limit'];var _0x579750;if(_0x353130>=_0x3487c9){_0x353130=_0x3487c9;_0x579750=0xc8;}else{_0x579750=0xce;}_0x37395e[_0x3ccb('0x17')](_0x579750);return _0x37395e[_0x3ccb('0x1b')](_0x3ccb('0x1c'),_0x5765de+'-'+_0x353130+'/'+_0x3487c9)[_0x3ccb('0x1d')](_0x756045);}return null;};}function patchUpdates(_0x585b87){return function(_0xad74e4){try{jsonpatch[_0x3ccb('0x1e')](_0xad74e4,_0x585b87,!![]);}catch(_0x1f5e25){return BPromise[_0x3ccb('0x1f')](_0x1f5e25);}return _0xad74e4['save']();};}function saveUpdates(_0xc9254c,_0x312b55){return function(_0xc17195){if(_0xc17195){return _0xc17195[_0x3ccb('0x20')](_0xc9254c)[_0x3ccb('0x21')](function(_0x359729){return _0x359729;});}return null;};}function removeEntity(_0x59b944,_0x296048){return function(_0x52873e){if(_0x52873e){return _0x52873e[_0x3ccb('0x22')]()['then'](function(){_0x59b944[_0x3ccb('0x17')](0xcc)[_0x3ccb('0x18')]();});}};}function handleEntityNotFound(_0x80fad1,_0x483208){return function(_0x1e1f25){if(!_0x1e1f25){_0x80fad1[_0x3ccb('0x23')](0x194);}return _0x1e1f25;};}function handleError(_0x15a7e4,_0x54f283){_0x54f283=_0x54f283||0x1f4;return function(_0x7ca68){logger[_0x3ccb('0x24')](_0x7ca68[_0x3ccb('0x25')]);if(_0x7ca68['name']){delete _0x7ca68[_0x3ccb('0x26')];}_0x15a7e4[_0x3ccb('0x17')](_0x54f283)[_0x3ccb('0x27')](_0x7ca68);};}exports[_0x3ccb('0x28')]=function(_0x224dd0,_0x2502dc){var _0x253a0e={},_0x179f9c={},_0x235ad7={'count':0x0,'rows':[]};var _0x530333=_['map'](db['VtigerConfiguration'][_0x3ccb('0x29')],function(_0x146d49){return{'name':_0x146d49[_0x3ccb('0x2a')],'type':_0x146d49[_0x3ccb('0x2b')]['key']};});_0x179f9c['model']=_[_0x3ccb('0x2c')](_0x530333,_0x3ccb('0x26'));_0x179f9c[_0x3ccb('0x2d')]=_[_0x3ccb('0x2e')](_0x224dd0[_0x3ccb('0x2d')]);_0x179f9c['filters']=_['intersection'](_0x179f9c[_0x3ccb('0x2f')],_0x179f9c[_0x3ccb('0x2d')]);_0x253a0e[_0x3ccb('0x30')]=_[_0x3ccb('0x31')](_0x179f9c[_0x3ccb('0x2f')],qs['fields'](_0x224dd0[_0x3ccb('0x2d')][_0x3ccb('0x32')]));_0x253a0e[_0x3ccb('0x30')]=_0x253a0e['attributes'][_0x3ccb('0x33')]?_0x253a0e['attributes']:_0x179f9c['model'];if(!_0x224dd0[_0x3ccb('0x2d')][_0x3ccb('0x34')](_0x3ccb('0x35'))){_0x253a0e['limit']=qs[_0x3ccb('0x36')](_0x224dd0[_0x3ccb('0x2d')][_0x3ccb('0x36')]);_0x253a0e['offset']=qs[_0x3ccb('0x19')](_0x224dd0[_0x3ccb('0x2d')]['offset']);}_0x253a0e[_0x3ccb('0x37')]=qs[_0x3ccb('0x38')](_0x224dd0['query'][_0x3ccb('0x38')]);_0x253a0e[_0x3ccb('0x39')]=qs[_0x3ccb('0x3a')](_[_0x3ccb('0x3b')](_0x224dd0[_0x3ccb('0x2d')],_0x179f9c[_0x3ccb('0x3a')]),_0x530333);if(_0x224dd0[_0x3ccb('0x2d')]['filter']){_0x253a0e['where']=_[_0x3ccb('0x3c')](_0x253a0e[_0x3ccb('0x39')],{'$or':_[_0x3ccb('0x2c')](_0x530333,function(_0x6b1367){if(_0x6b1367[_0x3ccb('0x2b')]!==_0x3ccb('0x3d')){var _0x563bde={};_0x563bde[_0x6b1367[_0x3ccb('0x26')]]={'$like':'%'+_0x224dd0[_0x3ccb('0x2d')][_0x3ccb('0x3e')]+'%'};return _0x563bde;}})});}_0x253a0e=_['merge']({},_0x253a0e,_0x224dd0[_0x3ccb('0x3f')]);var _0x279057={'where':_0x253a0e[_0x3ccb('0x39')]};return db[_0x3ccb('0x40')][_0x3ccb('0x1a')](_0x279057)[_0x3ccb('0x21')](function(_0x21cc64){_0x235ad7[_0x3ccb('0x1a')]=_0x21cc64;if(_0x224dd0[_0x3ccb('0x2d')]['includeAll']){_0x253a0e['include']=[{'all':!![]}];}return db[_0x3ccb('0x40')][_0x3ccb('0x41')](_0x253a0e);})[_0x3ccb('0x21')](function(_0x295f51){_0x235ad7[_0x3ccb('0x42')]=_0x295f51;return _0x235ad7;})['then'](respondWithFilteredResult(_0x2502dc,_0x253a0e))['catch'](handleError(_0x2502dc,null));};exports['show']=function(_0xa61448,_0x5dbf7e){var _0x572012={'raw':![],'where':{'id':_0xa61448[_0x3ccb('0x43')]['id']}},_0xc7b438={};_0xc7b438['model']=_[_0x3ccb('0x2e')](db[_0x3ccb('0x40')]['rawAttributes']);_0xc7b438[_0x3ccb('0x2d')]=_[_0x3ccb('0x2e')](_0xa61448[_0x3ccb('0x2d')]);_0xc7b438[_0x3ccb('0x3a')]=_[_0x3ccb('0x31')](_0xc7b438['model'],_0xc7b438['query']);_0x572012[_0x3ccb('0x30')]=_[_0x3ccb('0x31')](_0xc7b438[_0x3ccb('0x2f')],qs[_0x3ccb('0x32')](_0xa61448[_0x3ccb('0x2d')]['fields']));_0x572012[_0x3ccb('0x30')]=_0x572012[_0x3ccb('0x30')]['length']?_0x572012[_0x3ccb('0x30')]:_0xc7b438[_0x3ccb('0x2f')];if(_0xa61448[_0x3ccb('0x2d')][_0x3ccb('0x44')]){_0x572012[_0x3ccb('0x45')]=[{'all':!![]}];}_0x572012=_['merge']({},_0x572012,_0xa61448['options']);return db['VtigerConfiguration'][_0x3ccb('0x46')](_0x572012)[_0x3ccb('0x21')](handleEntityNotFound(_0x5dbf7e,null))[_0x3ccb('0x21')](respondWithResult(_0x5dbf7e,null))['catch'](handleError(_0x5dbf7e,null));};exports[_0x3ccb('0x47')]=function(_0x33fbd9,_0x7cfd08){return db[_0x3ccb('0x40')][_0x3ccb('0x47')](_0x33fbd9[_0x3ccb('0x48')],{})['then'](respondWithResult(_0x7cfd08,0xc9))[_0x3ccb('0x49')](handleError(_0x7cfd08,null));};exports[_0x3ccb('0x20')]=function(_0x1d28a3,_0x3b4a77){if(_0x1d28a3[_0x3ccb('0x48')]['id']){delete _0x1d28a3[_0x3ccb('0x48')]['id'];}return db['VtigerConfiguration'][_0x3ccb('0x46')]({'where':{'id':_0x1d28a3['params']['id']}})['then'](handleEntityNotFound(_0x3b4a77,null))['then'](saveUpdates(_0x1d28a3['body'],null))[_0x3ccb('0x21')](respondWithResult(_0x3b4a77,null))['catch'](handleError(_0x3b4a77,null));};exports[_0x3ccb('0x22')]=function(_0x73d1c4,_0xa4a771){return db['VtigerConfiguration'][_0x3ccb('0x46')]({'where':{'id':_0x73d1c4[_0x3ccb('0x43')]['id']}})[_0x3ccb('0x21')](handleEntityNotFound(_0xa4a771,null))[_0x3ccb('0x21')](removeEntity(_0xa4a771,null))[_0x3ccb('0x49')](handleError(_0xa4a771,null));};exports['getFields']=function(_0x55bf0b,_0x585620,_0x3b56bb){var _0x3839b2={};var _0x538060={};var _0x42b2b5;var _0x167674;return db[_0x3ccb('0x40')][_0x3ccb('0x4a')]({'where':{'id':_0x55bf0b[_0x3ccb('0x43')]['id']}})[_0x3ccb('0x21')](handleEntityNotFound(_0x585620,null))[_0x3ccb('0x21')](function(_0x1e2833){if(_0x1e2833){_0x42b2b5=_0x1e2833;_0x538060['model']=_['keys'](db['VtigerField'][_0x3ccb('0x29')]);_0x538060['query']=_[_0x3ccb('0x2e')](_0x55bf0b[_0x3ccb('0x2d')]);_0x538060['filters']=_[_0x3ccb('0x31')](_0x538060[_0x3ccb('0x2f')],_0x538060[_0x3ccb('0x2d')]);_0x3839b2[_0x3ccb('0x30')]=_[_0x3ccb('0x31')](_0x538060['model'],qs['fields'](_0x55bf0b[_0x3ccb('0x2d')]['fields']));_0x3839b2['attributes']=_0x3839b2[_0x3ccb('0x30')]['length']?_0x3839b2['attributes']:_0x538060[_0x3ccb('0x2f')];_0x3839b2[_0x3ccb('0x37')]=qs[_0x3ccb('0x38')](_0x55bf0b[_0x3ccb('0x2d')][_0x3ccb('0x38')]);_0x3839b2[_0x3ccb('0x39')]=qs[_0x3ccb('0x3a')](_[_0x3ccb('0x3b')](_0x55bf0b[_0x3ccb('0x2d')],_0x538060[_0x3ccb('0x3a')]));if(_0x55bf0b[_0x3ccb('0x2d')][_0x3ccb('0x3e')]){_0x3839b2[_0x3ccb('0x39')]=_[_0x3ccb('0x3c')](_0x3839b2[_0x3ccb('0x39')],{'$or':_[_0x3ccb('0x2c')](_0x3839b2[_0x3ccb('0x30')],function(_0x8bf5da){var _0x31b627={};_0x31b627[_0x8bf5da]={'$like':'%'+_0x55bf0b['query']['filter']+'%'};return _0x31b627;})});}_0x3839b2=_[_0x3ccb('0x3c')]({},_0x3839b2,_0x55bf0b[_0x3ccb('0x3f')]);return _0x42b2b5['getFields'](_0x3839b2);}})[_0x3ccb('0x21')](function(_0x487e54){if(_0x487e54){_0x167674=_0x487e54[_0x3ccb('0x33')];if(!_0x55bf0b[_0x3ccb('0x2d')]['hasOwnProperty']('nolimit')){_0x3839b2[_0x3ccb('0x36')]=qs[_0x3ccb('0x36')](_0x55bf0b[_0x3ccb('0x2d')][_0x3ccb('0x36')]);_0x3839b2[_0x3ccb('0x19')]=qs[_0x3ccb('0x19')](_0x55bf0b[_0x3ccb('0x2d')][_0x3ccb('0x19')]);}return _0x42b2b5['getFields'](_0x3839b2);}})['then'](function(_0x51f2fb){if(_0x51f2fb){return _0x51f2fb?{'count':_0x167674,'rows':_0x51f2fb}:null;}})[_0x3ccb('0x21')](respondWithResult(_0x585620,null))[_0x3ccb('0x49')](handleError(_0x585620,null));};exports[_0x3ccb('0x4b')]=function(_0x1480dd,_0x48ed62,_0x2c35d5){var _0x432d98={};var _0x599d79={};var _0x58a9f0;var _0x458f76;return db[_0x3ccb('0x40')][_0x3ccb('0x4a')]({'where':{'id':_0x1480dd[_0x3ccb('0x43')]['id']}})[_0x3ccb('0x21')](handleEntityNotFound(_0x48ed62,null))[_0x3ccb('0x21')](function(_0x502d99){if(_0x502d99){_0x58a9f0=_0x502d99;_0x599d79[_0x3ccb('0x2f')]=_[_0x3ccb('0x2e')](db['VtigerField'][_0x3ccb('0x29')]);_0x599d79[_0x3ccb('0x2d')]=_[_0x3ccb('0x2e')](_0x1480dd[_0x3ccb('0x2d')]);_0x599d79['filters']=_[_0x3ccb('0x31')](_0x599d79[_0x3ccb('0x2f')],_0x599d79['query']);_0x432d98[_0x3ccb('0x30')]=_['intersection'](_0x599d79['model'],qs[_0x3ccb('0x32')](_0x1480dd[_0x3ccb('0x2d')][_0x3ccb('0x32')]));_0x432d98[_0x3ccb('0x30')]=_0x432d98['attributes'][_0x3ccb('0x33')]?_0x432d98[_0x3ccb('0x30')]:_0x599d79[_0x3ccb('0x2f')];_0x432d98['order']=qs[_0x3ccb('0x38')](_0x1480dd['query']['sort']);_0x432d98[_0x3ccb('0x39')]=qs[_0x3ccb('0x3a')](_[_0x3ccb('0x3b')](_0x1480dd[_0x3ccb('0x2d')],_0x599d79[_0x3ccb('0x3a')]));if(_0x1480dd[_0x3ccb('0x2d')][_0x3ccb('0x3e')]){_0x432d98[_0x3ccb('0x39')]=_[_0x3ccb('0x3c')](_0x432d98[_0x3ccb('0x39')],{'$or':_[_0x3ccb('0x2c')](_0x432d98[_0x3ccb('0x30')],function(_0x4e278e){var _0x3ac08f={};_0x3ac08f[_0x4e278e]={'$like':'%'+_0x1480dd[_0x3ccb('0x2d')][_0x3ccb('0x3e')]+'%'};return _0x3ac08f;})});}_0x432d98=_[_0x3ccb('0x3c')]({},_0x432d98,_0x1480dd[_0x3ccb('0x3f')]);return _0x58a9f0['getSubjects'](_0x432d98);}})[_0x3ccb('0x21')](function(_0x9b288d){if(_0x9b288d){_0x458f76=_0x9b288d['length'];if(!_0x1480dd['query'][_0x3ccb('0x34')](_0x3ccb('0x35'))){_0x432d98[_0x3ccb('0x36')]=qs[_0x3ccb('0x36')](_0x1480dd[_0x3ccb('0x2d')][_0x3ccb('0x36')]);_0x432d98['offset']=qs['offset'](_0x1480dd[_0x3ccb('0x2d')][_0x3ccb('0x19')]);}return _0x58a9f0['getSubjects'](_0x432d98);}})['then'](function(_0x48b13e){if(_0x48b13e){return _0x48b13e?{'count':_0x458f76,'rows':_0x48b13e}:null;}})[_0x3ccb('0x21')](respondWithResult(_0x48ed62,null))[_0x3ccb('0x49')](handleError(_0x48ed62,null));};exports['getDescriptions']=function(_0x55e59d,_0x3fb965,_0x475b35){var _0x4378fd={};var _0x33c8a2={};var _0xa24f6c;var _0x223c74;return db[_0x3ccb('0x40')][_0x3ccb('0x4a')]({'where':{'id':_0x55e59d[_0x3ccb('0x43')]['id']}})[_0x3ccb('0x21')](handleEntityNotFound(_0x3fb965,null))[_0x3ccb('0x21')](function(_0x28c6ca){if(_0x28c6ca){_0xa24f6c=_0x28c6ca;_0x33c8a2[_0x3ccb('0x2f')]=_[_0x3ccb('0x2e')](db['VtigerField']['rawAttributes']);_0x33c8a2['query']=_[_0x3ccb('0x2e')](_0x55e59d['query']);_0x33c8a2[_0x3ccb('0x3a')]=_[_0x3ccb('0x31')](_0x33c8a2[_0x3ccb('0x2f')],_0x33c8a2['query']);_0x4378fd[_0x3ccb('0x30')]=_[_0x3ccb('0x31')](_0x33c8a2[_0x3ccb('0x2f')],qs[_0x3ccb('0x32')](_0x55e59d[_0x3ccb('0x2d')][_0x3ccb('0x32')]));_0x4378fd['attributes']=_0x4378fd[_0x3ccb('0x30')][_0x3ccb('0x33')]?_0x4378fd['attributes']:_0x33c8a2[_0x3ccb('0x2f')];_0x4378fd['order']=qs['sort'](_0x55e59d[_0x3ccb('0x2d')][_0x3ccb('0x38')]);_0x4378fd[_0x3ccb('0x39')]=qs[_0x3ccb('0x3a')](_['pick'](_0x55e59d[_0x3ccb('0x2d')],_0x33c8a2[_0x3ccb('0x3a')]));if(_0x55e59d[_0x3ccb('0x2d')][_0x3ccb('0x3e')]){_0x4378fd['where']=_[_0x3ccb('0x3c')](_0x4378fd[_0x3ccb('0x39')],{'$or':_[_0x3ccb('0x2c')](_0x4378fd['attributes'],function(_0x2b0be0){var _0x2e19f4={};_0x2e19f4[_0x2b0be0]={'$like':'%'+_0x55e59d[_0x3ccb('0x2d')]['filter']+'%'};return _0x2e19f4;})});}_0x4378fd=_['merge']({},_0x4378fd,_0x55e59d[_0x3ccb('0x3f')]);return _0xa24f6c['getDescriptions'](_0x4378fd);}})['then'](function(_0x37f6ca){if(_0x37f6ca){_0x223c74=_0x37f6ca[_0x3ccb('0x33')];if(!_0x55e59d[_0x3ccb('0x2d')][_0x3ccb('0x34')](_0x3ccb('0x35'))){_0x4378fd[_0x3ccb('0x36')]=qs['limit'](_0x55e59d['query'][_0x3ccb('0x36')]);_0x4378fd['offset']=qs[_0x3ccb('0x19')](_0x55e59d[_0x3ccb('0x2d')][_0x3ccb('0x19')]);}return _0xa24f6c['getDescriptions'](_0x4378fd);}})[_0x3ccb('0x21')](function(_0x205c60){if(_0x205c60){return _0x205c60?{'count':_0x223c74,'rows':_0x205c60}:null;}})[_0x3ccb('0x21')](respondWithResult(_0x3fb965,null))[_0x3ccb('0x49')](handleError(_0x3fb965,null));}; \ No newline at end of file +var _0x461d=['attributes','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','findOne','VtigerField','pick','getFields','filter','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','length'];(function(_0x2c8e2b,_0x1fb628){var _0x500823=function(_0x3bcce5){while(--_0x3bcce5){_0x2c8e2b['push'](_0x2c8e2b['shift']());}};_0x500823(++_0x1fb628);}(_0x461d,0x166));var _0xd461=function(_0x4b5302,_0xc6ed6d){_0x4b5302=_0x4b5302-0x0;var _0x277af1=_0x461d[_0x4b5302];return _0x277af1;};'use strict';var emlformat=require(_0xd461('0x0'));var rimraf=require(_0xd461('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd461('0x2'));var rp=require(_0xd461('0x3'));var moment=require(_0xd461('0x4'));var BPromise=require(_0xd461('0x5'));var Mustache=require('mustache');var util=require(_0xd461('0x6'));var path=require(_0xd461('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd461('0x8'));var fs=require('fs');var fs_extra=require(_0xd461('0x9'));var _=require(_0xd461('0xa'));var squel=require(_0xd461('0xb'));var crypto=require(_0xd461('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd461('0xd'));var querystring=require(_0xd461('0xe'));var Papa=require(_0xd461('0xf'));var Redis=require(_0xd461('0x10'));var authService=require(_0xd461('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd461('0x12'));var hardwareService=require(_0xd461('0x13'));var logger=require(_0xd461('0x14'))(_0xd461('0x15'));var utils=require(_0xd461('0x16'));var config=require(_0xd461('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd461('0x18'))['db'];function respondWithStatusCode(_0x1d4e9c,_0x23170f){_0x23170f=_0x23170f||0xcc;return function(_0x1be56e){if(_0x1be56e){return _0x1d4e9c[_0xd461('0x19')](_0x23170f);}return _0x1d4e9c['status'](_0x23170f)[_0xd461('0x1a')]();};}function respondWithResult(_0x569361,_0x59b8ea){_0x59b8ea=_0x59b8ea||0xc8;return function(_0x24da5e){if(_0x24da5e){return _0x569361[_0xd461('0x1b')](_0x59b8ea)[_0xd461('0x1c')](_0x24da5e);}};}function respondWithFilteredResult(_0x234514,_0x429978){return function(_0x53c6bf){if(_0x53c6bf){var _0x247dd0=typeof _0x429978[_0xd461('0x1d')]===_0xd461('0x1e')&&typeof _0x429978[_0xd461('0x1f')]==='undefined';var _0x3348bc=_0x53c6bf[_0xd461('0x20')];var _0xebbeab=_0x247dd0?0x0:_0x429978['offset'];var _0x1db74f=_0x247dd0?_0x53c6bf[_0xd461('0x20')]:_0x429978['offset']+_0x429978[_0xd461('0x1f')];var _0x44dca7;if(_0x1db74f>=_0x3348bc){_0x1db74f=_0x3348bc;_0x44dca7=0xc8;}else{_0x44dca7=0xce;}_0x234514[_0xd461('0x1b')](_0x44dca7);return _0x234514[_0xd461('0x21')](_0xd461('0x22'),_0xebbeab+'-'+_0x1db74f+'/'+_0x3348bc)['json'](_0x53c6bf);}return null;};}function patchUpdates(_0x241cc5){return function(_0x6a5ef1){try{jsonpatch[_0xd461('0x23')](_0x6a5ef1,_0x241cc5,!![]);}catch(_0x15cb34){return BPromise[_0xd461('0x24')](_0x15cb34);}return _0x6a5ef1[_0xd461('0x25')]();};}function saveUpdates(_0x3b2306,_0x451701){return function(_0x4ed895){if(_0x4ed895){return _0x4ed895[_0xd461('0x26')](_0x3b2306)[_0xd461('0x27')](function(_0x3c43b6){return _0x3c43b6;});}return null;};}function removeEntity(_0x256c2d,_0x2bd6d1){return function(_0x2a41cd){if(_0x2a41cd){return _0x2a41cd['destroy']()['then'](function(){_0x256c2d[_0xd461('0x1b')](0xcc)[_0xd461('0x1a')]();});}};}function handleEntityNotFound(_0xf61bb,_0x1d7c62){return function(_0x1218bc){if(!_0x1218bc){_0xf61bb['sendStatus'](0x194);}return _0x1218bc;};}function handleError(_0x52f115,_0x32ea07){_0x32ea07=_0x32ea07||0x1f4;return function(_0xfa2a01){logger[_0xd461('0x28')](_0xfa2a01[_0xd461('0x29')]);if(_0xfa2a01['name']){delete _0xfa2a01[_0xd461('0x2a')];}_0x52f115['status'](_0x32ea07)[_0xd461('0x2b')](_0xfa2a01);};}exports[_0xd461('0x2c')]=function(_0x43bad4,_0x58d5b7){var _0x38c909={},_0x3fb225={},_0x5c22fd={'count':0x0,'rows':[]};var _0x1e10d9=_[_0xd461('0x2d')](db[_0xd461('0x2e')][_0xd461('0x2f')],function(_0x3a8cc8){return{'name':_0x3a8cc8[_0xd461('0x30')],'type':_0x3a8cc8[_0xd461('0x31')]['key']};});_0x3fb225[_0xd461('0x32')]=_[_0xd461('0x2d')](_0x1e10d9,_0xd461('0x2a'));_0x3fb225['query']=_[_0xd461('0x33')](_0x43bad4[_0xd461('0x34')]);_0x3fb225[_0xd461('0x35')]=_[_0xd461('0x36')](_0x3fb225[_0xd461('0x32')],_0x3fb225['query']);_0x38c909['attributes']=_[_0xd461('0x36')](_0x3fb225['model'],qs[_0xd461('0x37')](_0x43bad4[_0xd461('0x34')][_0xd461('0x37')]));_0x38c909['attributes']=_0x38c909['attributes'][_0xd461('0x38')]?_0x38c909[_0xd461('0x39')]:_0x3fb225[_0xd461('0x32')];if(!_0x43bad4[_0xd461('0x34')][_0xd461('0x3a')](_0xd461('0x3b'))){_0x38c909[_0xd461('0x1f')]=qs['limit'](_0x43bad4[_0xd461('0x34')][_0xd461('0x1f')]);_0x38c909[_0xd461('0x1d')]=qs[_0xd461('0x1d')](_0x43bad4['query']['offset']);}_0x38c909[_0xd461('0x3c')]=qs[_0xd461('0x3d')](_0x43bad4['query']['sort']);_0x38c909[_0xd461('0x3e')]=qs[_0xd461('0x35')](_['pick'](_0x43bad4['query'],_0x3fb225[_0xd461('0x35')]),_0x1e10d9);if(_0x43bad4[_0xd461('0x34')]['filter']){_0x38c909['where']=_[_0xd461('0x3f')](_0x38c909[_0xd461('0x3e')],{'$or':_['map'](_0x1e10d9,function(_0x5199b9){if(_0x5199b9[_0xd461('0x31')]!=='VIRTUAL'){var _0x5e8b71={};_0x5e8b71[_0x5199b9[_0xd461('0x2a')]]={'$like':'%'+_0x43bad4['query']['filter']+'%'};return _0x5e8b71;}})});}_0x38c909=_[_0xd461('0x3f')]({},_0x38c909,_0x43bad4[_0xd461('0x40')]);var _0x1e393f={'where':_0x38c909[_0xd461('0x3e')]};return db[_0xd461('0x2e')][_0xd461('0x20')](_0x1e393f)[_0xd461('0x27')](function(_0x115558){_0x5c22fd[_0xd461('0x20')]=_0x115558;if(_0x43bad4[_0xd461('0x34')][_0xd461('0x41')]){_0x38c909[_0xd461('0x42')]=[{'all':!![]}];}return db[_0xd461('0x2e')][_0xd461('0x43')](_0x38c909);})['then'](function(_0x3bf2b6){_0x5c22fd[_0xd461('0x44')]=_0x3bf2b6;return _0x5c22fd;})[_0xd461('0x27')](respondWithFilteredResult(_0x58d5b7,_0x38c909))[_0xd461('0x45')](handleError(_0x58d5b7,null));};exports[_0xd461('0x46')]=function(_0x2c9d82,_0x850afc){var _0x3999db={'raw':![],'where':{'id':_0x2c9d82['params']['id']}},_0xd52c0f={};_0xd52c0f[_0xd461('0x32')]=_[_0xd461('0x33')](db['VtigerConfiguration'][_0xd461('0x2f')]);_0xd52c0f['query']=_['keys'](_0x2c9d82[_0xd461('0x34')]);_0xd52c0f['filters']=_[_0xd461('0x36')](_0xd52c0f[_0xd461('0x32')],_0xd52c0f['query']);_0x3999db['attributes']=_['intersection'](_0xd52c0f[_0xd461('0x32')],qs[_0xd461('0x37')](_0x2c9d82[_0xd461('0x34')][_0xd461('0x37')]));_0x3999db[_0xd461('0x39')]=_0x3999db[_0xd461('0x39')][_0xd461('0x38')]?_0x3999db[_0xd461('0x39')]:_0xd52c0f[_0xd461('0x32')];if(_0x2c9d82[_0xd461('0x34')][_0xd461('0x41')]){_0x3999db[_0xd461('0x42')]=[{'all':!![]}];}_0x3999db=_[_0xd461('0x3f')]({},_0x3999db,_0x2c9d82['options']);return db[_0xd461('0x2e')][_0xd461('0x47')](_0x3999db)['then'](handleEntityNotFound(_0x850afc,null))[_0xd461('0x27')](respondWithResult(_0x850afc,null))['catch'](handleError(_0x850afc,null));};exports[_0xd461('0x48')]=function(_0x42949e,_0x517914){return db[_0xd461('0x2e')]['create'](_0x42949e[_0xd461('0x49')],{})[_0xd461('0x27')](respondWithResult(_0x517914,0xc9))[_0xd461('0x45')](handleError(_0x517914,null));};exports[_0xd461('0x26')]=function(_0x2406ef,_0x4c0219){if(_0x2406ef[_0xd461('0x49')]['id']){delete _0x2406ef[_0xd461('0x49')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x2406ef[_0xd461('0x4a')]['id']}})[_0xd461('0x27')](handleEntityNotFound(_0x4c0219,null))[_0xd461('0x27')](saveUpdates(_0x2406ef['body'],null))[_0xd461('0x27')](respondWithResult(_0x4c0219,null))[_0xd461('0x45')](handleError(_0x4c0219,null));};exports[_0xd461('0x4b')]=function(_0x350366,_0x5ae603){return db[_0xd461('0x2e')][_0xd461('0x47')]({'where':{'id':_0x350366[_0xd461('0x4a')]['id']}})[_0xd461('0x27')](handleEntityNotFound(_0x5ae603,null))[_0xd461('0x27')](removeEntity(_0x5ae603,null))[_0xd461('0x45')](handleError(_0x5ae603,null));};exports['getFields']=function(_0x280c36,_0x5d698a,_0x25230a){var _0x313324={};var _0x55f052={};var _0x3dc613;var _0x429882;return db[_0xd461('0x2e')][_0xd461('0x4c')]({'where':{'id':_0x280c36[_0xd461('0x4a')]['id']}})[_0xd461('0x27')](handleEntityNotFound(_0x5d698a,null))[_0xd461('0x27')](function(_0x2e0087){if(_0x2e0087){_0x3dc613=_0x2e0087;_0x55f052[_0xd461('0x32')]=_['keys'](db[_0xd461('0x4d')][_0xd461('0x2f')]);_0x55f052[_0xd461('0x34')]=_['keys'](_0x280c36[_0xd461('0x34')]);_0x55f052[_0xd461('0x35')]=_[_0xd461('0x36')](_0x55f052['model'],_0x55f052[_0xd461('0x34')]);_0x313324[_0xd461('0x39')]=_['intersection'](_0x55f052[_0xd461('0x32')],qs[_0xd461('0x37')](_0x280c36['query']['fields']));_0x313324[_0xd461('0x39')]=_0x313324[_0xd461('0x39')][_0xd461('0x38')]?_0x313324[_0xd461('0x39')]:_0x55f052[_0xd461('0x32')];_0x313324[_0xd461('0x3c')]=qs[_0xd461('0x3d')](_0x280c36[_0xd461('0x34')][_0xd461('0x3d')]);_0x313324['where']=qs[_0xd461('0x35')](_[_0xd461('0x4e')](_0x280c36['query'],_0x55f052['filters']));if(_0x280c36['query']['filter']){_0x313324[_0xd461('0x3e')]=_[_0xd461('0x3f')](_0x313324['where'],{'$or':_[_0xd461('0x2d')](_0x313324[_0xd461('0x39')],function(_0x5da06f){var _0x54f0cc={};_0x54f0cc[_0x5da06f]={'$like':'%'+_0x280c36[_0xd461('0x34')]['filter']+'%'};return _0x54f0cc;})});}_0x313324=_[_0xd461('0x3f')]({},_0x313324,_0x280c36[_0xd461('0x40')]);return _0x3dc613[_0xd461('0x4f')](_0x313324);}})['then'](function(_0x4b6494){if(_0x4b6494){_0x429882=_0x4b6494['length'];if(!_0x280c36[_0xd461('0x34')][_0xd461('0x3a')](_0xd461('0x3b'))){_0x313324[_0xd461('0x1f')]=qs[_0xd461('0x1f')](_0x280c36[_0xd461('0x34')]['limit']);_0x313324[_0xd461('0x1d')]=qs[_0xd461('0x1d')](_0x280c36[_0xd461('0x34')]['offset']);}return _0x3dc613[_0xd461('0x4f')](_0x313324);}})[_0xd461('0x27')](function(_0x5d3bc1){if(_0x5d3bc1){return _0x5d3bc1?{'count':_0x429882,'rows':_0x5d3bc1}:null;}})[_0xd461('0x27')](respondWithResult(_0x5d698a,null))[_0xd461('0x45')](handleError(_0x5d698a,null));};exports['getSubjects']=function(_0x46b53a,_0x4c694f,_0x128902){var _0x922850={};var _0x15ed4e={};var _0xcb61ac;var _0x2a1dba;return db['VtigerConfiguration'][_0xd461('0x4c')]({'where':{'id':_0x46b53a[_0xd461('0x4a')]['id']}})[_0xd461('0x27')](handleEntityNotFound(_0x4c694f,null))[_0xd461('0x27')](function(_0x47d74c){if(_0x47d74c){_0xcb61ac=_0x47d74c;_0x15ed4e[_0xd461('0x32')]=_['keys'](db[_0xd461('0x4d')][_0xd461('0x2f')]);_0x15ed4e[_0xd461('0x34')]=_[_0xd461('0x33')](_0x46b53a[_0xd461('0x34')]);_0x15ed4e['filters']=_[_0xd461('0x36')](_0x15ed4e[_0xd461('0x32')],_0x15ed4e[_0xd461('0x34')]);_0x922850['attributes']=_[_0xd461('0x36')](_0x15ed4e[_0xd461('0x32')],qs[_0xd461('0x37')](_0x46b53a['query'][_0xd461('0x37')]));_0x922850[_0xd461('0x39')]=_0x922850['attributes']['length']?_0x922850['attributes']:_0x15ed4e[_0xd461('0x32')];_0x922850[_0xd461('0x3c')]=qs['sort'](_0x46b53a[_0xd461('0x34')][_0xd461('0x3d')]);_0x922850['where']=qs[_0xd461('0x35')](_['pick'](_0x46b53a['query'],_0x15ed4e['filters']));if(_0x46b53a[_0xd461('0x34')]['filter']){_0x922850[_0xd461('0x3e')]=_[_0xd461('0x3f')](_0x922850[_0xd461('0x3e')],{'$or':_[_0xd461('0x2d')](_0x922850[_0xd461('0x39')],function(_0x2dc1c7){var _0x48bb1e={};_0x48bb1e[_0x2dc1c7]={'$like':'%'+_0x46b53a['query'][_0xd461('0x50')]+'%'};return _0x48bb1e;})});}_0x922850=_[_0xd461('0x3f')]({},_0x922850,_0x46b53a[_0xd461('0x40')]);return _0xcb61ac[_0xd461('0x51')](_0x922850);}})[_0xd461('0x27')](function(_0x5ce964){if(_0x5ce964){_0x2a1dba=_0x5ce964[_0xd461('0x38')];if(!_0x46b53a[_0xd461('0x34')][_0xd461('0x3a')](_0xd461('0x3b'))){_0x922850[_0xd461('0x1f')]=qs[_0xd461('0x1f')](_0x46b53a['query'][_0xd461('0x1f')]);_0x922850[_0xd461('0x1d')]=qs['offset'](_0x46b53a[_0xd461('0x34')][_0xd461('0x1d')]);}return _0xcb61ac[_0xd461('0x51')](_0x922850);}})['then'](function(_0x52c242){if(_0x52c242){return _0x52c242?{'count':_0x2a1dba,'rows':_0x52c242}:null;}})[_0xd461('0x27')](respondWithResult(_0x4c694f,null))[_0xd461('0x45')](handleError(_0x4c694f,null));};exports[_0xd461('0x52')]=function(_0x2cab11,_0x585f9b,_0x5f4e23){var _0x363794={};var _0x2388fc={};var _0x57eba4;var _0x563c6f;return db[_0xd461('0x2e')]['findOne']({'where':{'id':_0x2cab11['params']['id']}})[_0xd461('0x27')](handleEntityNotFound(_0x585f9b,null))[_0xd461('0x27')](function(_0x2e865f){if(_0x2e865f){_0x57eba4=_0x2e865f;_0x2388fc[_0xd461('0x32')]=_[_0xd461('0x33')](db[_0xd461('0x4d')][_0xd461('0x2f')]);_0x2388fc['query']=_[_0xd461('0x33')](_0x2cab11[_0xd461('0x34')]);_0x2388fc[_0xd461('0x35')]=_[_0xd461('0x36')](_0x2388fc['model'],_0x2388fc[_0xd461('0x34')]);_0x363794[_0xd461('0x39')]=_['intersection'](_0x2388fc[_0xd461('0x32')],qs[_0xd461('0x37')](_0x2cab11['query'][_0xd461('0x37')]));_0x363794[_0xd461('0x39')]=_0x363794[_0xd461('0x39')][_0xd461('0x38')]?_0x363794[_0xd461('0x39')]:_0x2388fc[_0xd461('0x32')];_0x363794['order']=qs[_0xd461('0x3d')](_0x2cab11[_0xd461('0x34')]['sort']);_0x363794[_0xd461('0x3e')]=qs['filters'](_[_0xd461('0x4e')](_0x2cab11[_0xd461('0x34')],_0x2388fc[_0xd461('0x35')]));if(_0x2cab11['query'][_0xd461('0x50')]){_0x363794['where']=_[_0xd461('0x3f')](_0x363794['where'],{'$or':_[_0xd461('0x2d')](_0x363794[_0xd461('0x39')],function(_0x5a6a7f){var _0xfa7df4={};_0xfa7df4[_0x5a6a7f]={'$like':'%'+_0x2cab11['query'][_0xd461('0x50')]+'%'};return _0xfa7df4;})});}_0x363794=_['merge']({},_0x363794,_0x2cab11['options']);return _0x57eba4[_0xd461('0x52')](_0x363794);}})[_0xd461('0x27')](function(_0x4962d4){if(_0x4962d4){_0x563c6f=_0x4962d4[_0xd461('0x38')];if(!_0x2cab11[_0xd461('0x34')][_0xd461('0x3a')]('nolimit')){_0x363794[_0xd461('0x1f')]=qs[_0xd461('0x1f')](_0x2cab11[_0xd461('0x34')][_0xd461('0x1f')]);_0x363794[_0xd461('0x1d')]=qs[_0xd461('0x1d')](_0x2cab11[_0xd461('0x34')][_0xd461('0x1d')]);}return _0x57eba4[_0xd461('0x52')](_0x363794);}})['then'](function(_0x3f1b88){if(_0x3f1b88){return _0x3f1b88?{'count':_0x563c6f,'rows':_0x3f1b88}:null;}})[_0xd461('0x27')](respondWithResult(_0x585f9b,null))['catch'](handleError(_0x585f9b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6e31e9a..67a09ac 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 _0x1cef=['util','api','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x473b97,_0x30eaa3){var _0xf3691e=function(_0xa41f0c){while(--_0xa41f0c){_0x473b97['push'](_0x473b97['shift']());}};_0xf3691e(++_0x30eaa3);}(_0x1cef,0x133));var _0xf1ce=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x1cef[_0x35d8af];return _0x1d08b0;};'use strict';var _=require(_0xf1ce('0x0'));var util=require(_0xf1ce('0x1'));var logger=require('../../config/logger')(_0xf1ce('0x2'));var moment=require('moment');var BPromise=require(_0xf1ce('0x3'));var rp=require(_0xf1ce('0x4'));var fs=require('fs');var path=require(_0xf1ce('0x5'));var rimraf=require(_0xf1ce('0x6'));var config=require('../../config/environment');var attributes=require(_0xf1ce('0x7'));module[_0xf1ce('0x8')]=function(_0xefa95a,_0x47b87d){return _0xefa95a['define'](_0xf1ce('0x9'),attributes,{'tableName':_0xf1ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd46d=['request-promise','path','rimraf','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0xd46d,0x8b));var _0xdd46=function(_0x518cc2,_0x26f1f5){_0x518cc2=_0x518cc2-0x0;var _0x32ec4b=_0xd46d[_0x518cc2];return _0x32ec4b;};'use strict';var _=require(_0xdd46('0x0'));var util=require('util');var logger=require(_0xdd46('0x1'))(_0xdd46('0x2'));var moment=require(_0xdd46('0x3'));var BPromise=require(_0xdd46('0x4'));var rp=require(_0xdd46('0x5'));var fs=require('fs');var path=require(_0xdd46('0x6'));var rimraf=require(_0xdd46('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0xdd46('0x8')]=function(_0x56da84,_0x47117b){return _0x56da84[_0xdd46('0x9')](_0xdd46('0xa'),attributes,{'tableName':_0xdd46('0xb'),'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 501c789..71a1c23 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 _0x0969=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x33d841,_0x5bdd1b){var _0x1fc5d4=function(_0x3dd7c7){while(--_0x3dd7c7){_0x33d841['push'](_0x33d841['shift']());}};_0x1fc5d4(++_0x5bdd1b);}(_0x0969,0xa7));var _0x9096=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x0969[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x9096('0x0'));var util=require('util');var moment=require(_0x9096('0x1'));var BPromise=require(_0x9096('0x2'));var rs=require(_0x9096('0x3'));var fs=require('fs');var Redis=require(_0x9096('0x4'));var db=require(_0x9096('0x5'))['db'];var utils=require(_0x9096('0x6'));var logger=require(_0x9096('0x7'))(_0x9096('0x8'));var config=require(_0x9096('0x9'));var jayson=require(_0x9096('0xa'));var client=jayson[_0x9096('0xb')][_0x9096('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x594ce7,_0x317b3a,_0x1ad8ab){return new BPromise(function(_0x47ab25,_0x1a93c6){return client[_0x9096('0xd')](_0x594ce7,_0x1ad8ab)['then'](function(_0x5ba593){logger[_0x9096('0xe')](_0x9096('0xf'),_0x317b3a,_0x9096('0x10'));logger[_0x9096('0x11')](_0x9096('0x12'),_0x317b3a,_0x9096('0x10'),JSON[_0x9096('0x13')](_0x5ba593));if(_0x5ba593[_0x9096('0x14')]){if(_0x5ba593['error']['code']===0x1f4){logger[_0x9096('0x14')](_0x9096('0xf'),_0x317b3a,_0x5ba593[_0x9096('0x14')]['message']);return _0x1a93c6(_0x5ba593[_0x9096('0x14')][_0x9096('0x15')]);}logger[_0x9096('0x14')](_0x9096('0xf'),_0x317b3a,_0x5ba593['error'][_0x9096('0x15')]);return _0x47ab25(_0x5ba593[_0x9096('0x14')][_0x9096('0x15')]);}else{logger['info'](_0x9096('0xf'),_0x317b3a,_0x9096('0x10'));_0x47ab25(_0x5ba593[_0x9096('0x16')]['message']);}})['catch'](function(_0x22e69e){logger[_0x9096('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x317b3a,_0x22e69e);_0x1a93c6(_0x22e69e);});});} \ No newline at end of file +var _0x6535=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x15e0d2,_0x8333c){var _0x45bb73=function(_0x52cb41){while(--_0x52cb41){_0x15e0d2['push'](_0x15e0d2['shift']());}};_0x45bb73(++_0x8333c);}(_0x6535,0xf2));var _0x5653=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x6535[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x5653('0x0'));var util=require(_0x5653('0x1'));var moment=require('moment');var BPromise=require(_0x5653('0x2'));var rs=require(_0x5653('0x3'));var fs=require('fs');var Redis=require(_0x5653('0x4'));var db=require(_0x5653('0x5'))['db'];var utils=require(_0x5653('0x6'));var logger=require('../../config/logger')(_0x5653('0x7'));var config=require(_0x5653('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5653('0x9')][_0x5653('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eb688,_0x32c471,_0x2e535a){return new BPromise(function(_0x1d02b0,_0x5e97e6){return client[_0x5653('0xb')](_0x1eb688,_0x2e535a)[_0x5653('0xc')](function(_0x2b40dc){logger[_0x5653('0xd')](_0x5653('0xe'),_0x32c471,_0x5653('0xf'));logger[_0x5653('0x10')](_0x5653('0x11'),_0x32c471,_0x5653('0xf'),JSON['stringify'](_0x2b40dc));if(_0x2b40dc[_0x5653('0x12')]){if(_0x2b40dc[_0x5653('0x12')][_0x5653('0x13')]===0x1f4){logger[_0x5653('0x12')](_0x5653('0xe'),_0x32c471,_0x2b40dc[_0x5653('0x12')][_0x5653('0x14')]);return _0x5e97e6(_0x2b40dc[_0x5653('0x12')]['message']);}logger[_0x5653('0x12')](_0x5653('0xe'),_0x32c471,_0x2b40dc[_0x5653('0x12')][_0x5653('0x14')]);return _0x1d02b0(_0x2b40dc[_0x5653('0x12')][_0x5653('0x14')]);}else{logger[_0x5653('0xd')](_0x5653('0xe'),_0x32c471,_0x5653('0xf'));_0x1d02b0(_0x2b40dc['result'][_0x5653('0x14')]);}})[_0x5653('0x15')](function(_0x2fa465){logger['error'](_0x5653('0xe'),_0x32c471,_0x2fa465);_0x5e97e6(_0x2fa465);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d55e390..98151fa 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 _0x3053=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3053,0x9f));var _0x3305=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x3053[_0x3efe87];return _0x56a4cc;};'use strict';var multer=require(_0x3305('0x0'));var util=require(_0x3305('0x1'));var path=require(_0x3305('0x2'));var timeout=require(_0x3305('0x3'));var express=require(_0x3305('0x4'));var router=express[_0x3305('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3305('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3305('0x7'));var controller=require(_0x3305('0x8'));router[_0x3305('0x9')]('/',auth[_0x3305('0xa')](),controller[_0x3305('0xb')]);router[_0x3305('0x9')](_0x3305('0xc'),auth['isAuthenticated'](),controller[_0x3305('0xd')]);router[_0x3305('0xe')]('/',auth['isAuthenticated'](),controller[_0x3305('0xf')]);router[_0x3305('0x10')]('/:id',auth[_0x3305('0xa')](),controller[_0x3305('0x11')]);router[_0x3305('0x12')](_0x3305('0xc'),auth[_0x3305('0xa')](),controller[_0x3305('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9f48=['../../components/auth/service','./intVtigerField.controller','isAuthenticated','index','/:id','show','create','put','update','exports','multer','path','Router','fs-extra'];(function(_0x5924bc,_0x15803c){var _0x2a1291=function(_0x472ebf){while(--_0x472ebf){_0x5924bc['push'](_0x5924bc['shift']());}};_0x2a1291(++_0x15803c);}(_0x9f48,0x106));var _0x89f4=function(_0x23c5a8,_0x231dcd){_0x23c5a8=_0x23c5a8-0x0;var _0x3ba1b0=_0x9f48[_0x23c5a8];return _0x3ba1b0;};'use strict';var multer=require(_0x89f4('0x0'));var util=require('util');var path=require(_0x89f4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x89f4('0x2')]();var fs_extra=require(_0x89f4('0x3'));var auth=require(_0x89f4('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89f4('0x5'));router['get']('/',auth[_0x89f4('0x6')](),controller[_0x89f4('0x7')]);router['get'](_0x89f4('0x8'),auth['isAuthenticated'](),controller[_0x89f4('0x9')]);router['post']('/',auth[_0x89f4('0x6')](),controller[_0x89f4('0xa')]);router[_0x89f4('0xb')](_0x89f4('0x8'),auth['isAuthenticated'](),controller[_0x89f4('0xc')]);router['delete'](_0x89f4('0x8'),auth[_0x89f4('0x6')](),controller['destroy']);module[_0x89f4('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 1f1f51b..18f115b 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 _0x1d9a=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x46102a,_0x5a2de5){var _0x1423bb=function(_0x57dc26){while(--_0x57dc26){_0x46102a['push'](_0x46102a['shift']());}};_0x1423bb(++_0x5a2de5);}(_0x1d9a,0x190));var _0xa1d9=function(_0x213972,_0x419463){_0x213972=_0x213972-0x0;var _0x3d66ec=_0x1d9a[_0x213972];return _0x3d66ec;};'use strict';var Sequelize=require('sequelize');module[_0xa1d9('0x0')]={'type':{'type':Sequelize[_0xa1d9('0x1')](_0xa1d9('0x2'),_0xa1d9('0x3'),_0xa1d9('0x4'),_0xa1d9('0x5'),_0xa1d9('0x6')),'defaultValue':_0xa1d9('0x2')},'content':{'type':Sequelize[_0xa1d9('0x7')]},'key':{'type':Sequelize[_0xa1d9('0x7')]},'keyType':{'type':Sequelize[_0xa1d9('0x1')](_0xa1d9('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xa1d9('0x7')]},'idField':{'type':Sequelize[_0xa1d9('0x7')]},'nameField':{'type':Sequelize[_0xa1d9('0x7')]},'customField':{'type':Sequelize[_0xa1d9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x257b=['ENUM','variable','BOOLEAN','exports','string','customVariable','keyValue','picklist','STRING'];(function(_0x460a93,_0x2b2c93){var _0x20d27b=function(_0x278eaf){while(--_0x278eaf){_0x460a93['push'](_0x460a93['shift']());}};_0x20d27b(++_0x2b2c93);}(_0x257b,0x150));var _0xb257=function(_0x39acf0,_0x1d1829){_0x39acf0=_0x39acf0-0x0;var _0x108857=_0x257b[_0x39acf0];return _0x108857;};'use strict';var Sequelize=require('sequelize');module[_0xb257('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb257('0x1'),'variable',_0xb257('0x2'),_0xb257('0x3'),_0xb257('0x4')),'defaultValue':_0xb257('0x1')},'content':{'type':Sequelize[_0xb257('0x5')]},'key':{'type':Sequelize[_0xb257('0x5')]},'keyType':{'type':Sequelize[_0xb257('0x6')](_0xb257('0x1'),_0xb257('0x7'),_0xb257('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb257('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb257('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb257('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9c7e013..341f4c6 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 _0x7e43=['map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','show','keys','includeAll','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','VtigerField','rawAttributes','fieldName'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7e43,0x184));var _0x37e4=function(_0x3bafc2,_0x482db1){_0x3bafc2=_0x3bafc2-0x0;var _0x175f3f=_0x7e43[_0x3bafc2];return _0x175f3f;};'use strict';var emlformat=require(_0x37e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x37e4('0x1'));var jsonpatch=require(_0x37e4('0x2'));var rp=require(_0x37e4('0x3'));var moment=require(_0x37e4('0x4'));var BPromise=require(_0x37e4('0x5'));var Mustache=require('mustache');var util=require(_0x37e4('0x6'));var path=require('path');var sox=require(_0x37e4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37e4('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x37e4('0x9'));var jsforce=require(_0x37e4('0xa'));var deskjs=require(_0x37e4('0xb'));var toCsv=require(_0x37e4('0xc'));var querystring=require(_0x37e4('0xd'));var Papa=require(_0x37e4('0xe'));var Redis=require(_0x37e4('0xf'));var authService=require(_0x37e4('0x10'));var qs=require(_0x37e4('0x11'));var as=require(_0x37e4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37e4('0x13'))('api');var utils=require(_0x37e4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x37e4('0x15'));var db=require(_0x37e4('0x16'))['db'];function respondWithStatusCode(_0x277043,_0xb445ca){_0xb445ca=_0xb445ca||0xcc;return function(_0x42fe0c){if(_0x42fe0c){return _0x277043[_0x37e4('0x17')](_0xb445ca);}return _0x277043[_0x37e4('0x18')](_0xb445ca)[_0x37e4('0x19')]();};}function respondWithResult(_0x2289e0,_0x21bdb7){_0x21bdb7=_0x21bdb7||0xc8;return function(_0x2348bd){if(_0x2348bd){return _0x2289e0[_0x37e4('0x18')](_0x21bdb7)[_0x37e4('0x1a')](_0x2348bd);}};}function respondWithFilteredResult(_0x338acd,_0x1b6aae){return function(_0x302200){if(_0x302200){var _0x4c247c=typeof _0x1b6aae[_0x37e4('0x1b')]===_0x37e4('0x1c')&&typeof _0x1b6aae['limit']===_0x37e4('0x1c');var _0x1aa46d=_0x302200[_0x37e4('0x1d')];var _0x36dbfa=_0x4c247c?0x0:_0x1b6aae['offset'];var _0x2473a5=_0x4c247c?_0x302200['count']:_0x1b6aae['offset']+_0x1b6aae[_0x37e4('0x1e')];var _0x3b213f;if(_0x2473a5>=_0x1aa46d){_0x2473a5=_0x1aa46d;_0x3b213f=0xc8;}else{_0x3b213f=0xce;}_0x338acd['status'](_0x3b213f);return _0x338acd['set'](_0x37e4('0x1f'),_0x36dbfa+'-'+_0x2473a5+'/'+_0x1aa46d)[_0x37e4('0x1a')](_0x302200);}return null;};}function patchUpdates(_0xd10e85){return function(_0x4cff6e){try{jsonpatch['apply'](_0x4cff6e,_0xd10e85,!![]);}catch(_0x321db0){return BPromise[_0x37e4('0x20')](_0x321db0);}return _0x4cff6e[_0x37e4('0x21')]();};}function saveUpdates(_0x4fea9e,_0xa8a3b2){return function(_0x218a0a){if(_0x218a0a){return _0x218a0a[_0x37e4('0x22')](_0x4fea9e)[_0x37e4('0x23')](function(_0x260cf6){return _0x260cf6;});}return null;};}function removeEntity(_0x318e84,_0x169123){return function(_0x2caaa3){if(_0x2caaa3){return _0x2caaa3[_0x37e4('0x24')]()['then'](function(){_0x318e84[_0x37e4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x248fdf,_0x223745){return function(_0xfcc5bf){if(!_0xfcc5bf){_0x248fdf[_0x37e4('0x17')](0x194);}return _0xfcc5bf;};}function handleError(_0xfcb7de,_0x49e09f){_0x49e09f=_0x49e09f||0x1f4;return function(_0x40a118){logger[_0x37e4('0x25')](_0x40a118[_0x37e4('0x26')]);if(_0x40a118['name']){delete _0x40a118[_0x37e4('0x27')];}_0xfcb7de[_0x37e4('0x18')](_0x49e09f)['send'](_0x40a118);};}exports[_0x37e4('0x28')]=function(_0x142216,_0x535466){var _0x32538b={},_0x13c34e={},_0xfe47d={'count':0x0,'rows':[]};var _0x351a80=_['map'](db[_0x37e4('0x29')][_0x37e4('0x2a')],function(_0x3e08be){return{'name':_0x3e08be[_0x37e4('0x2b')],'type':_0x3e08be['type']['key']};});_0x13c34e['model']=_[_0x37e4('0x2c')](_0x351a80,_0x37e4('0x27'));_0x13c34e[_0x37e4('0x2d')]=_['keys'](_0x142216[_0x37e4('0x2d')]);_0x13c34e[_0x37e4('0x2e')]=_[_0x37e4('0x2f')](_0x13c34e['model'],_0x13c34e[_0x37e4('0x2d')]);_0x32538b[_0x37e4('0x30')]=_[_0x37e4('0x2f')](_0x13c34e[_0x37e4('0x31')],qs[_0x37e4('0x32')](_0x142216[_0x37e4('0x2d')][_0x37e4('0x32')]));_0x32538b[_0x37e4('0x30')]=_0x32538b['attributes'][_0x37e4('0x33')]?_0x32538b[_0x37e4('0x30')]:_0x13c34e[_0x37e4('0x31')];if(!_0x142216[_0x37e4('0x2d')][_0x37e4('0x34')](_0x37e4('0x35'))){_0x32538b['limit']=qs[_0x37e4('0x1e')](_0x142216['query'][_0x37e4('0x1e')]);_0x32538b[_0x37e4('0x1b')]=qs[_0x37e4('0x1b')](_0x142216['query'][_0x37e4('0x1b')]);}_0x32538b['order']=qs[_0x37e4('0x36')](_0x142216[_0x37e4('0x2d')]['sort']);_0x32538b[_0x37e4('0x37')]=qs['filters'](_[_0x37e4('0x38')](_0x142216[_0x37e4('0x2d')],_0x13c34e[_0x37e4('0x2e')]),_0x351a80);if(_0x142216[_0x37e4('0x2d')]['filter']){_0x32538b[_0x37e4('0x37')]=_[_0x37e4('0x39')](_0x32538b['where'],{'$or':_[_0x37e4('0x2c')](_0x351a80,function(_0x54af5c){if(_0x54af5c[_0x37e4('0x3a')]!==_0x37e4('0x3b')){var _0x3f4817={};_0x3f4817[_0x54af5c[_0x37e4('0x27')]]={'$like':'%'+_0x142216['query'][_0x37e4('0x3c')]+'%'};return _0x3f4817;}})});}_0x32538b=_[_0x37e4('0x39')]({},_0x32538b,_0x142216[_0x37e4('0x3d')]);var _0x407362={'where':_0x32538b[_0x37e4('0x37')]};return db['VtigerField'][_0x37e4('0x1d')](_0x407362)[_0x37e4('0x23')](function(_0xb4ff7a){_0xfe47d[_0x37e4('0x1d')]=_0xb4ff7a;if(_0x142216[_0x37e4('0x2d')]['includeAll']){_0x32538b[_0x37e4('0x3e')]=[{'all':!![]}];}return db[_0x37e4('0x29')][_0x37e4('0x3f')](_0x32538b);})['then'](function(_0x42ad84){_0xfe47d['rows']=_0x42ad84;return _0xfe47d;})[_0x37e4('0x23')](respondWithFilteredResult(_0x535466,_0x32538b))['catch'](handleError(_0x535466,null));};exports[_0x37e4('0x40')]=function(_0x46016d,_0x397a6b){var _0x84a8fb={'raw':!![],'where':{'id':_0x46016d['params']['id']}},_0x35f223={};_0x35f223[_0x37e4('0x31')]=_['keys'](db[_0x37e4('0x29')][_0x37e4('0x2a')]);_0x35f223[_0x37e4('0x2d')]=_[_0x37e4('0x41')](_0x46016d[_0x37e4('0x2d')]);_0x35f223[_0x37e4('0x2e')]=_[_0x37e4('0x2f')](_0x35f223[_0x37e4('0x31')],_0x35f223[_0x37e4('0x2d')]);_0x84a8fb['attributes']=_['intersection'](_0x35f223[_0x37e4('0x31')],qs['fields'](_0x46016d['query']['fields']));_0x84a8fb[_0x37e4('0x30')]=_0x84a8fb[_0x37e4('0x30')]['length']?_0x84a8fb[_0x37e4('0x30')]:_0x35f223[_0x37e4('0x31')];if(_0x46016d[_0x37e4('0x2d')][_0x37e4('0x42')]){_0x84a8fb['include']=[{'all':!![]}];}_0x84a8fb=_['merge']({},_0x84a8fb,_0x46016d[_0x37e4('0x3d')]);return db['VtigerField'][_0x37e4('0x43')](_0x84a8fb)[_0x37e4('0x23')](handleEntityNotFound(_0x397a6b,null))['then'](respondWithResult(_0x397a6b,null))[_0x37e4('0x44')](handleError(_0x397a6b,null));};exports[_0x37e4('0x45')]=function(_0xbb2a81,_0x1bf39a){return db[_0x37e4('0x29')][_0x37e4('0x45')](_0xbb2a81[_0x37e4('0x46')],{})[_0x37e4('0x23')](respondWithResult(_0x1bf39a,0xc9))['catch'](handleError(_0x1bf39a,null));};exports[_0x37e4('0x22')]=function(_0x4268d6,_0x10a798){if(_0x4268d6[_0x37e4('0x46')]['id']){delete _0x4268d6[_0x37e4('0x46')]['id'];}return db[_0x37e4('0x29')][_0x37e4('0x43')]({'where':{'id':_0x4268d6[_0x37e4('0x47')]['id']}})['then'](handleEntityNotFound(_0x10a798,null))[_0x37e4('0x23')](saveUpdates(_0x4268d6[_0x37e4('0x46')],null))[_0x37e4('0x23')](respondWithResult(_0x10a798,null))[_0x37e4('0x44')](handleError(_0x10a798,null));};exports[_0x37e4('0x24')]=function(_0x5685e4,_0x20b74f){return db[_0x37e4('0x29')][_0x37e4('0x43')]({'where':{'id':_0x5685e4[_0x37e4('0x47')]['id']}})[_0x37e4('0x23')](handleEntityNotFound(_0x20b74f,null))[_0x37e4('0x23')](removeEntity(_0x20b74f,null))['catch'](handleError(_0x20b74f,null));}; \ No newline at end of file +var _0xf7ef=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','show','params','keys','options','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','name','index','VtigerField','rawAttributes','fieldName','type','key'];(function(_0x5cba2c,_0x344f9e){var _0x48b980=function(_0x1a584a){while(--_0x1a584a){_0x5cba2c['push'](_0x5cba2c['shift']());}};_0x48b980(++_0x344f9e);}(_0xf7ef,0x148));var _0xff7e=function(_0x5c08f6,_0x440439){_0x5c08f6=_0x5c08f6-0x0;var _0x5f3546=_0xf7ef[_0x5c08f6];return _0x5f3546;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xff7e('0x0'));var jsonpatch=require(_0xff7e('0x1'));var rp=require(_0xff7e('0x2'));var moment=require(_0xff7e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff7e('0x4'));var path=require(_0xff7e('0x5'));var sox=require(_0xff7e('0x6'));var csv=require(_0xff7e('0x7'));var ejs=require(_0xff7e('0x8'));var fs=require('fs');var fs_extra=require(_0xff7e('0x9'));var _=require('lodash');var squel=require(_0xff7e('0xa'));var crypto=require(_0xff7e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff7e('0x7'));var querystring=require('querystring');var Papa=require(_0xff7e('0xc'));var Redis=require(_0xff7e('0xd'));var authService=require(_0xff7e('0xe'));var qs=require(_0xff7e('0xf'));var as=require(_0xff7e('0x10'));var hardwareService=require(_0xff7e('0x11'));var logger=require(_0xff7e('0x12'))(_0xff7e('0x13'));var utils=require(_0xff7e('0x14'));var config=require(_0xff7e('0x15'));var licenseUtil=require(_0xff7e('0x16'));var db=require(_0xff7e('0x17'))['db'];function respondWithStatusCode(_0x47bde1,_0x528268){_0x528268=_0x528268||0xcc;return function(_0x1e511e){if(_0x1e511e){return _0x47bde1[_0xff7e('0x18')](_0x528268);}return _0x47bde1[_0xff7e('0x19')](_0x528268)[_0xff7e('0x1a')]();};}function respondWithResult(_0x1015cf,_0x325998){_0x325998=_0x325998||0xc8;return function(_0x282d0e){if(_0x282d0e){return _0x1015cf[_0xff7e('0x19')](_0x325998)[_0xff7e('0x1b')](_0x282d0e);}};}function respondWithFilteredResult(_0x1ebb68,_0x41247d){return function(_0x54b494){if(_0x54b494){var _0x1deee9=typeof _0x41247d[_0xff7e('0x1c')]===_0xff7e('0x1d')&&typeof _0x41247d[_0xff7e('0x1e')]===_0xff7e('0x1d');var _0x5c0e20=_0x54b494['count'];var _0x453d7b=_0x1deee9?0x0:_0x41247d[_0xff7e('0x1c')];var _0x2b919c=_0x1deee9?_0x54b494[_0xff7e('0x1f')]:_0x41247d[_0xff7e('0x1c')]+_0x41247d[_0xff7e('0x1e')];var _0x17fb69;if(_0x2b919c>=_0x5c0e20){_0x2b919c=_0x5c0e20;_0x17fb69=0xc8;}else{_0x17fb69=0xce;}_0x1ebb68[_0xff7e('0x19')](_0x17fb69);return _0x1ebb68['set'](_0xff7e('0x20'),_0x453d7b+'-'+_0x2b919c+'/'+_0x5c0e20)[_0xff7e('0x1b')](_0x54b494);}return null;};}function patchUpdates(_0x4d0555){return function(_0x3cba2b){try{jsonpatch[_0xff7e('0x21')](_0x3cba2b,_0x4d0555,!![]);}catch(_0x1ed287){return BPromise[_0xff7e('0x22')](_0x1ed287);}return _0x3cba2b[_0xff7e('0x23')]();};}function saveUpdates(_0x29636a,_0x7d4817){return function(_0x56ab2e){if(_0x56ab2e){return _0x56ab2e[_0xff7e('0x24')](_0x29636a)['then'](function(_0x41329){return _0x41329;});}return null;};}function removeEntity(_0x550557,_0x55bd2e){return function(_0x128c2a){if(_0x128c2a){return _0x128c2a[_0xff7e('0x25')]()[_0xff7e('0x26')](function(){_0x550557[_0xff7e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x364083,_0x5928e1){return function(_0x1c1309){if(!_0x1c1309){_0x364083[_0xff7e('0x18')](0x194);}return _0x1c1309;};}function handleError(_0x5c1694,_0x1f0e20){_0x1f0e20=_0x1f0e20||0x1f4;return function(_0x2e9c8b){logger[_0xff7e('0x27')](_0x2e9c8b['stack']);if(_0x2e9c8b['name']){delete _0x2e9c8b[_0xff7e('0x28')];}_0x5c1694[_0xff7e('0x19')](_0x1f0e20)['send'](_0x2e9c8b);};}exports[_0xff7e('0x29')]=function(_0x4cb735,_0x3e6f3f){var _0x27f747={},_0x406172={},_0x2a36d5={'count':0x0,'rows':[]};var _0x41948e=_['map'](db[_0xff7e('0x2a')][_0xff7e('0x2b')],function(_0xaf9d71){return{'name':_0xaf9d71[_0xff7e('0x2c')],'type':_0xaf9d71[_0xff7e('0x2d')][_0xff7e('0x2e')]};});_0x406172[_0xff7e('0x2f')]=_['map'](_0x41948e,_0xff7e('0x28'));_0x406172[_0xff7e('0x30')]=_['keys'](_0x4cb735[_0xff7e('0x30')]);_0x406172[_0xff7e('0x31')]=_[_0xff7e('0x32')](_0x406172[_0xff7e('0x2f')],_0x406172[_0xff7e('0x30')]);_0x27f747[_0xff7e('0x33')]=_[_0xff7e('0x32')](_0x406172[_0xff7e('0x2f')],qs[_0xff7e('0x34')](_0x4cb735[_0xff7e('0x30')][_0xff7e('0x34')]));_0x27f747[_0xff7e('0x33')]=_0x27f747['attributes'][_0xff7e('0x35')]?_0x27f747[_0xff7e('0x33')]:_0x406172[_0xff7e('0x2f')];if(!_0x4cb735[_0xff7e('0x30')][_0xff7e('0x36')](_0xff7e('0x37'))){_0x27f747['limit']=qs[_0xff7e('0x1e')](_0x4cb735[_0xff7e('0x30')][_0xff7e('0x1e')]);_0x27f747[_0xff7e('0x1c')]=qs[_0xff7e('0x1c')](_0x4cb735['query'][_0xff7e('0x1c')]);}_0x27f747[_0xff7e('0x38')]=qs[_0xff7e('0x39')](_0x4cb735[_0xff7e('0x30')][_0xff7e('0x39')]);_0x27f747[_0xff7e('0x3a')]=qs[_0xff7e('0x31')](_[_0xff7e('0x3b')](_0x4cb735[_0xff7e('0x30')],_0x406172[_0xff7e('0x31')]),_0x41948e);if(_0x4cb735['query'][_0xff7e('0x3c')]){_0x27f747['where']=_[_0xff7e('0x3d')](_0x27f747[_0xff7e('0x3a')],{'$or':_[_0xff7e('0x3e')](_0x41948e,function(_0x3ff3c8){if(_0x3ff3c8['type']!==_0xff7e('0x3f')){var _0x5c66de={};_0x5c66de[_0x3ff3c8[_0xff7e('0x28')]]={'$like':'%'+_0x4cb735[_0xff7e('0x30')][_0xff7e('0x3c')]+'%'};return _0x5c66de;}})});}_0x27f747=_[_0xff7e('0x3d')]({},_0x27f747,_0x4cb735['options']);var _0x573774={'where':_0x27f747[_0xff7e('0x3a')]};return db['VtigerField']['count'](_0x573774)['then'](function(_0x2d6a6e){_0x2a36d5[_0xff7e('0x1f')]=_0x2d6a6e;if(_0x4cb735[_0xff7e('0x30')][_0xff7e('0x40')]){_0x27f747[_0xff7e('0x41')]=[{'all':!![]}];}return db[_0xff7e('0x2a')][_0xff7e('0x42')](_0x27f747);})['then'](function(_0x16a44c){_0x2a36d5['rows']=_0x16a44c;return _0x2a36d5;})[_0xff7e('0x26')](respondWithFilteredResult(_0x3e6f3f,_0x27f747))['catch'](handleError(_0x3e6f3f,null));};exports[_0xff7e('0x43')]=function(_0x33daba,_0x4df2d8){var _0x49a893={'raw':!![],'where':{'id':_0x33daba[_0xff7e('0x44')]['id']}},_0x11c0d8={};_0x11c0d8[_0xff7e('0x2f')]=_[_0xff7e('0x45')](db[_0xff7e('0x2a')]['rawAttributes']);_0x11c0d8['query']=_['keys'](_0x33daba['query']);_0x11c0d8[_0xff7e('0x31')]=_[_0xff7e('0x32')](_0x11c0d8[_0xff7e('0x2f')],_0x11c0d8['query']);_0x49a893['attributes']=_[_0xff7e('0x32')](_0x11c0d8[_0xff7e('0x2f')],qs[_0xff7e('0x34')](_0x33daba[_0xff7e('0x30')][_0xff7e('0x34')]));_0x49a893['attributes']=_0x49a893[_0xff7e('0x33')][_0xff7e('0x35')]?_0x49a893[_0xff7e('0x33')]:_0x11c0d8[_0xff7e('0x2f')];if(_0x33daba[_0xff7e('0x30')][_0xff7e('0x40')]){_0x49a893[_0xff7e('0x41')]=[{'all':!![]}];}_0x49a893=_[_0xff7e('0x3d')]({},_0x49a893,_0x33daba[_0xff7e('0x46')]);return db['VtigerField'][_0xff7e('0x47')](_0x49a893)[_0xff7e('0x26')](handleEntityNotFound(_0x4df2d8,null))[_0xff7e('0x26')](respondWithResult(_0x4df2d8,null))[_0xff7e('0x48')](handleError(_0x4df2d8,null));};exports[_0xff7e('0x49')]=function(_0x25af96,_0x3320c7){return db['VtigerField'][_0xff7e('0x49')](_0x25af96[_0xff7e('0x4a')],{})[_0xff7e('0x26')](respondWithResult(_0x3320c7,0xc9))[_0xff7e('0x48')](handleError(_0x3320c7,null));};exports[_0xff7e('0x24')]=function(_0x148ae6,_0x22631b){if(_0x148ae6[_0xff7e('0x4a')]['id']){delete _0x148ae6[_0xff7e('0x4a')]['id'];}return db[_0xff7e('0x2a')]['find']({'where':{'id':_0x148ae6[_0xff7e('0x44')]['id']}})[_0xff7e('0x26')](handleEntityNotFound(_0x22631b,null))['then'](saveUpdates(_0x148ae6[_0xff7e('0x4a')],null))[_0xff7e('0x26')](respondWithResult(_0x22631b,null))[_0xff7e('0x48')](handleError(_0x22631b,null));};exports[_0xff7e('0x25')]=function(_0x3e84be,_0x3b1758){return db[_0xff7e('0x2a')][_0xff7e('0x47')]({'where':{'id':_0x3e84be['params']['id']}})[_0xff7e('0x26')](handleEntityNotFound(_0x3b1758,null))[_0xff7e('0x26')](removeEntity(_0x3b1758,null))[_0xff7e('0x48')](handleError(_0x3b1758,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4091542..df215c7 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 _0x2ebb=['path','rimraf','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2d2ab0,_0x6ae3a8){var _0x4a69f3=function(_0x2f63e1){while(--_0x2f63e1){_0x2d2ab0['push'](_0x2d2ab0['shift']());}};_0x4a69f3(++_0x6ae3a8);}(_0x2ebb,0x108));var _0xb2eb=function(_0x4e70c6,_0xaa9cc4){_0x4e70c6=_0x4e70c6-0x0;var _0x2e6a01=_0x2ebb[_0x4e70c6];return _0x2e6a01;};'use strict';var _=require(_0xb2eb('0x0'));var util=require('util');var logger=require(_0xb2eb('0x1'))(_0xb2eb('0x2'));var moment=require(_0xb2eb('0x3'));var BPromise=require(_0xb2eb('0x4'));var rp=require(_0xb2eb('0x5'));var fs=require('fs');var path=require(_0xb2eb('0x6'));var rimraf=require(_0xb2eb('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0xb2eb('0x8')]=function(_0x34b9ec,_0x11c1a7){return _0x34b9ec[_0xb2eb('0x9')](_0xb2eb('0xa'),attributes,{'tableName':_0xb2eb('0xb'),'paranoid':![],'indexes':[{'name':_0xb2eb('0xc'),'fields':[_0xb2eb('0xd'),_0xb2eb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d63=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','idField'];(function(_0x4ce24d,_0x453b3e){var _0x1f4269=function(_0x372abe){while(--_0x372abe){_0x4ce24d['push'](_0x4ce24d['shift']());}};_0x1f4269(++_0x453b3e);}(_0x7d63,0xf1));var _0x37d6=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x7d63[_0x8afdd0];return _0x3de7ac;};'use strict';var _=require(_0x37d6('0x0'));var util=require(_0x37d6('0x1'));var logger=require(_0x37d6('0x2'))(_0x37d6('0x3'));var moment=require(_0x37d6('0x4'));var BPromise=require(_0x37d6('0x5'));var rp=require(_0x37d6('0x6'));var fs=require('fs');var path=require(_0x37d6('0x7'));var rimraf=require(_0x37d6('0x8'));var config=require(_0x37d6('0x9'));var attributes=require(_0x37d6('0xa'));module[_0x37d6('0xb')]=function(_0x43e776,_0x49cc24){return _0x43e776[_0x37d6('0xc')](_0x37d6('0xd'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x37d6('0xe'),_0x37d6('0xf')],'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 4271ac6..18ce962 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 _0xa260=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x25d7ad,_0xfd098d){var _0xc5b046=function(_0x566159){while(--_0x566159){_0x25d7ad['push'](_0x25d7ad['shift']());}};_0xc5b046(++_0xfd098d);}(_0xa260,0x1f2));var _0x0a26=function(_0x254374,_0x5717d7){_0x254374=_0x254374-0x0;var _0x2d1a0a=_0xa260[_0x254374];return _0x2d1a0a;};'use strict';var _=require(_0x0a26('0x0'));var util=require(_0x0a26('0x1'));var moment=require(_0x0a26('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a26('0x3'));var fs=require('fs');var Redis=require(_0x0a26('0x4'));var db=require(_0x0a26('0x5'))['db'];var utils=require(_0x0a26('0x6'));var logger=require(_0x0a26('0x7'))(_0x0a26('0x8'));var config=require(_0x0a26('0x9'));var jayson=require(_0x0a26('0xa'));var client=jayson[_0x0a26('0xb')][_0x0a26('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x433464,_0x28b8ff,_0xdc5b5c){return new BPromise(function(_0x52973e,_0x56c1cd){return client['request'](_0x433464,_0xdc5b5c)[_0x0a26('0xd')](function(_0x52fc0b){logger['info'](_0x0a26('0xe'),_0x28b8ff,_0x0a26('0xf'));logger[_0x0a26('0x10')](_0x0a26('0x11'),_0x28b8ff,_0x0a26('0xf'),JSON[_0x0a26('0x12')](_0x52fc0b));if(_0x52fc0b[_0x0a26('0x13')]){if(_0x52fc0b['error']['code']===0x1f4){logger[_0x0a26('0x13')]('VtigerField,\x20%s,\x20%s',_0x28b8ff,_0x52fc0b[_0x0a26('0x13')][_0x0a26('0x14')]);return _0x56c1cd(_0x52fc0b[_0x0a26('0x13')][_0x0a26('0x14')]);}logger[_0x0a26('0x13')]('VtigerField,\x20%s,\x20%s',_0x28b8ff,_0x52fc0b['error']['message']);return _0x52973e(_0x52fc0b[_0x0a26('0x13')][_0x0a26('0x14')]);}else{logger[_0x0a26('0x15')](_0x0a26('0xe'),_0x28b8ff,_0x0a26('0xf'));_0x52973e(_0x52fc0b[_0x0a26('0x16')]['message']);}})[_0x0a26('0x17')](function(_0xbd5f45){logger[_0x0a26('0x13')](_0x0a26('0xe'),_0x28b8ff,_0xbd5f45);_0x56c1cd(_0xbd5f45);});});} \ No newline at end of file +var _0x5d45=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4e5d67,_0x54dffc){var _0x4acdf3=function(_0x53e5a3){while(--_0x53e5a3){_0x4e5d67['push'](_0x4e5d67['shift']());}};_0x4acdf3(++_0x54dffc);}(_0x5d45,0x84));var _0x55d4=function(_0x44c47b,_0x25c439){_0x44c47b=_0x44c47b-0x0;var _0xba455d=_0x5d45[_0x44c47b];return _0xba455d;};'use strict';var _=require(_0x55d4('0x0'));var util=require('util');var moment=require(_0x55d4('0x1'));var BPromise=require(_0x55d4('0x2'));var rs=require(_0x55d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x55d4('0x4'))(_0x55d4('0x5'));var config=require(_0x55d4('0x6'));var jayson=require(_0x55d4('0x7'));var client=jayson['client'][_0x55d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x432381,_0x3e7896,_0x4b14dc){return new BPromise(function(_0x1c53fe,_0x12080f){return client[_0x55d4('0x9')](_0x432381,_0x4b14dc)[_0x55d4('0xa')](function(_0x3d07a4){logger[_0x55d4('0xb')](_0x55d4('0xc'),_0x3e7896,_0x55d4('0xd'));logger[_0x55d4('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3e7896,_0x55d4('0xd'),JSON[_0x55d4('0xf')](_0x3d07a4));if(_0x3d07a4['error']){if(_0x3d07a4[_0x55d4('0x10')]['code']===0x1f4){logger[_0x55d4('0x10')](_0x55d4('0xc'),_0x3e7896,_0x3d07a4['error']['message']);return _0x12080f(_0x3d07a4['error'][_0x55d4('0x11')]);}logger[_0x55d4('0x10')](_0x55d4('0xc'),_0x3e7896,_0x3d07a4[_0x55d4('0x10')][_0x55d4('0x11')]);return _0x1c53fe(_0x3d07a4[_0x55d4('0x10')][_0x55d4('0x11')]);}else{logger[_0x55d4('0xb')](_0x55d4('0xc'),_0x3e7896,_0x55d4('0xd'));_0x1c53fe(_0x3d07a4['result'][_0x55d4('0x11')]);}})['catch'](function(_0x4333e9){logger[_0x55d4('0x10')](_0x55d4('0xc'),_0x3e7896,_0x4333e9);_0x12080f(_0x4333e9);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 11b3a13..27cbd8e 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 _0xa8d4=['delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','put','update'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xa8d4,0x191));var _0x4a8d=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0xa8d4[_0x24cc72];return _0xd49f1e;};'use strict';var multer=require(_0x4a8d('0x0'));var util=require(_0x4a8d('0x1'));var path=require('path');var timeout=require(_0x4a8d('0x2'));var express=require(_0x4a8d('0x3'));var router=express[_0x4a8d('0x4')]();var fs_extra=require(_0x4a8d('0x5'));var auth=require(_0x4a8d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a8d('0x7'));router[_0x4a8d('0x8')]('/',auth[_0x4a8d('0x9')](),controller[_0x4a8d('0xa')]);router[_0x4a8d('0x8')](_0x4a8d('0xb'),auth[_0x4a8d('0x9')](),controller['show']);router[_0x4a8d('0x8')](_0x4a8d('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x4a8d('0x8')](_0x4a8d('0xd'),auth[_0x4a8d('0x9')](),controller[_0x4a8d('0xe')]);router[_0x4a8d('0xf')]('/',auth[_0x4a8d('0x9')](),controller[_0x4a8d('0x10')]);router['post'](_0x4a8d('0xc'),auth[_0x4a8d('0x9')](),controller['addConfiguration']);router[_0x4a8d('0x11')](_0x4a8d('0xb'),auth[_0x4a8d('0x9')](),controller[_0x4a8d('0x12')]);router[_0x4a8d('0x13')](_0x4a8d('0xb'),auth[_0x4a8d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0628=['isAuthenticated','index','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x2f9ed1,_0x1c2c2c){var _0x54634e=function(_0x4d312b){while(--_0x4d312b){_0x2f9ed1['push'](_0x2f9ed1['shift']());}};_0x54634e(++_0x1c2c2c);}(_0x0628,0x15c));var _0x8062=function(_0x4344ff,_0x20f444){_0x4344ff=_0x4344ff-0x0;var _0x343214=_0x0628[_0x4344ff];return _0x343214;};'use strict';var multer=require(_0x8062('0x0'));var util=require(_0x8062('0x1'));var path=require('path');var timeout=require(_0x8062('0x2'));var express=require(_0x8062('0x3'));var router=express[_0x8062('0x4')]();var fs_extra=require(_0x8062('0x5'));var auth=require(_0x8062('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8062('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x8062('0x8')]('/',auth[_0x8062('0x9')](),controller[_0x8062('0xa')]);router[_0x8062('0x8')]('/:id',auth[_0x8062('0x9')](),controller['show']);router[_0x8062('0x8')](_0x8062('0xb'),auth[_0x8062('0x9')](),controller[_0x8062('0xc')]);router[_0x8062('0x8')]('/:id/fields',auth[_0x8062('0x9')](),controller[_0x8062('0xd')]);router[_0x8062('0xe')]('/',auth['isAuthenticated'](),controller[_0x8062('0xf')]);router[_0x8062('0xe')]('/:id/configurations',auth[_0x8062('0x9')](),controller[_0x8062('0x10')]);router['put']('/:id',auth[_0x8062('0x9')](),controller[_0x8062('0x11')]);router[_0x8062('0x12')]('/:id',auth[_0x8062('0x9')](),controller[_0x8062('0x13')]);module[_0x8062('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f8735f4..4f13e55 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 _0x6363=['token','newTab','sequelize','STRING','username','remoteUri','ENUM','password'];(function(_0x18770a,_0x336eec){var _0x36cc11=function(_0x2fa57c){while(--_0x2fa57c){_0x18770a['push'](_0x18770a['shift']());}};_0x36cc11(++_0x336eec);}(_0x6363,0x13a));var _0x3636=function(_0x263406,_0x7abdb5){_0x263406=_0x263406-0x0;var _0x1799f4=_0x6363[_0x263406];return _0x1799f4;};'use strict';var Sequelize=require(_0x3636('0x0'));module['exports']={'name':{'type':Sequelize[_0x3636('0x1')]},'description':{'type':Sequelize[_0x3636('0x1')]},'username':{'type':Sequelize[_0x3636('0x1')],'unique':_0x3636('0x2')},'password':{'type':Sequelize[_0x3636('0x1')]},'token':{'type':Sequelize[_0x3636('0x1')]},'remoteUri':{'type':Sequelize[_0x3636('0x1')],'unique':_0x3636('0x3')},'authType':{'type':Sequelize[_0x3636('0x4')](_0x3636('0x5'),_0x3636('0x6')),'defaultValue':_0x3636('0x5')},'serverUrl':{'type':Sequelize[_0x3636('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3636('0x4')]('integrationTab',_0x3636('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xeda8,0x104));var _0x8eda=function(_0x3d3f13,_0x362acb){_0x3d3f13=_0x3d3f13-0x0;var _0x1b5157=_0xeda8[_0x3d3f13];return _0x1b5157;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8eda('0x2')]},'username':{'type':Sequelize[_0x8eda('0x2')],'unique':_0x8eda('0x3')},'password':{'type':Sequelize[_0x8eda('0x2')]},'token':{'type':Sequelize[_0x8eda('0x2')]},'remoteUri':{'type':Sequelize[_0x8eda('0x2')],'unique':_0x8eda('0x4')},'authType':{'type':Sequelize[_0x8eda('0x5')](_0x8eda('0x6'),_0x8eda('0x7')),'defaultValue':_0x8eda('0x6')},'serverUrl':{'type':Sequelize[_0x8eda('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8eda('0x8'),_0x8eda('0x9')),'defaultValue':_0x8eda('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index bbdd986..b40b6f8 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 _0x16d2=['where','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','catch','body','params','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','password','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','headers','format','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','subject','description','assignee','remove','position','title','system_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x16d2,0x123));var _0x216d=function(_0x3d6ef9,_0xa3ab19){_0x3d6ef9=_0x3d6ef9-0x0;var _0x43bbee=_0x16d2[_0x3d6ef9];return _0x43bbee;};'use strict';var emlformat=require(_0x216d('0x0'));var rimraf=require(_0x216d('0x1'));var zipdir=require(_0x216d('0x2'));var jsonpatch=require(_0x216d('0x3'));var rp=require(_0x216d('0x4'));var moment=require(_0x216d('0x5'));var BPromise=require(_0x216d('0x6'));var Mustache=require(_0x216d('0x7'));var util=require(_0x216d('0x8'));var path=require('path');var sox=require(_0x216d('0x9'));var csv=require(_0x216d('0xa'));var ejs=require(_0x216d('0xb'));var fs=require('fs');var fs_extra=require(_0x216d('0xc'));var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xa'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var licenseUtil=require(_0x216d('0x1a'));var db=require(_0x216d('0x1b'))['db'];var integrations=require(_0x216d('0x1c'));function respondWithStatusCode(_0x4c92d9,_0xb36a43){_0xb36a43=_0xb36a43||0xcc;return function(_0x4c07d0){if(_0x4c07d0){return _0x4c92d9[_0x216d('0x1d')](_0xb36a43);}return _0x4c92d9[_0x216d('0x1e')](_0xb36a43)['end']();};}function respondWithResult(_0x165c19,_0x322e4b){_0x322e4b=_0x322e4b||0xc8;return function(_0x54a816){if(_0x54a816){return _0x165c19[_0x216d('0x1e')](_0x322e4b)['json'](_0x54a816);}};}function respondWithFilteredResult(_0x448c0d,_0xf571a4){return function(_0x4631b0){if(_0x4631b0){var _0x23ff86=typeof _0xf571a4[_0x216d('0x1f')]===_0x216d('0x20')&&typeof _0xf571a4[_0x216d('0x21')]===_0x216d('0x20');var _0x19fdac=_0x4631b0['count'];var _0x3b60dd=_0x23ff86?0x0:_0xf571a4['offset'];var _0x4ddc51=_0x23ff86?_0x4631b0[_0x216d('0x22')]:_0xf571a4[_0x216d('0x1f')]+_0xf571a4['limit'];var _0x3f32e0;if(_0x4ddc51>=_0x19fdac){_0x4ddc51=_0x19fdac;_0x3f32e0=0xc8;}else{_0x3f32e0=0xce;}_0x448c0d[_0x216d('0x1e')](_0x3f32e0);return _0x448c0d['set'](_0x216d('0x23'),_0x3b60dd+'-'+_0x4ddc51+'/'+_0x19fdac)[_0x216d('0x24')](_0x4631b0);}return null;};}function patchUpdates(_0x430e81){return function(_0x3e9818){try{jsonpatch['apply'](_0x3e9818,_0x430e81,!![]);}catch(_0x20ee7c){return BPromise[_0x216d('0x25')](_0x20ee7c);}return _0x3e9818[_0x216d('0x26')]();};}function saveUpdates(_0x438981,_0x206782){return function(_0x57cfbd){if(_0x57cfbd){return _0x57cfbd[_0x216d('0x27')](_0x438981)[_0x216d('0x28')](function(_0x188494){return _0x188494;});}return null;};}function removeEntity(_0x2880c6,_0x6fa4b3){return function(_0x54d96f){if(_0x54d96f){return _0x54d96f[_0x216d('0x29')]()[_0x216d('0x28')](function(){_0x2880c6[_0x216d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ec8a7,_0x56460f){return function(_0x4c792e){if(!_0x4c792e){_0x4ec8a7['sendStatus'](0x194);}return _0x4c792e;};}function handleError(_0x32f240,_0x470d8a){_0x470d8a=_0x470d8a||0x1f4;return function(_0x189413){logger[_0x216d('0x2a')](_0x189413[_0x216d('0x2b')]);if(_0x189413['name']){delete _0x189413['name'];}_0x32f240[_0x216d('0x1e')](_0x470d8a)['send'](_0x189413);};}exports[_0x216d('0x2c')]=function(_0x42abbe,_0x10f7c6){var _0x20bc16={},_0x307f2b={},_0x12bcab={'count':0x0,'rows':[]};var _0x28fcc2=_[_0x216d('0x2d')](db[_0x216d('0x2e')][_0x216d('0x2f')],function(_0x11be90){return{'name':_0x11be90[_0x216d('0x30')],'type':_0x11be90[_0x216d('0x31')]['key']};});_0x307f2b[_0x216d('0x32')]=_[_0x216d('0x2d')](_0x28fcc2,_0x216d('0x33'));_0x307f2b['query']=_[_0x216d('0x34')](_0x42abbe[_0x216d('0x35')]);_0x307f2b[_0x216d('0x36')]=_[_0x216d('0x37')](_0x307f2b['model'],_0x307f2b[_0x216d('0x35')]);_0x20bc16[_0x216d('0x38')]=_[_0x216d('0x37')](_0x307f2b[_0x216d('0x32')],qs[_0x216d('0x39')](_0x42abbe[_0x216d('0x35')][_0x216d('0x39')]));_0x20bc16[_0x216d('0x38')]=_0x20bc16[_0x216d('0x38')][_0x216d('0x3a')]?_0x20bc16[_0x216d('0x38')]:_0x307f2b['model'];if(!_0x42abbe[_0x216d('0x35')][_0x216d('0x3b')](_0x216d('0x3c'))){_0x20bc16['limit']=qs[_0x216d('0x21')](_0x42abbe[_0x216d('0x35')]['limit']);_0x20bc16[_0x216d('0x1f')]=qs['offset'](_0x42abbe['query'][_0x216d('0x1f')]);}_0x20bc16[_0x216d('0x3d')]=qs[_0x216d('0x3e')](_0x42abbe[_0x216d('0x35')]['sort']);_0x20bc16['where']=qs['filters'](_[_0x216d('0x3f')](_0x42abbe[_0x216d('0x35')],_0x307f2b['filters']),_0x28fcc2);if(_0x42abbe[_0x216d('0x35')][_0x216d('0x40')]){_0x20bc16['where']=_[_0x216d('0x41')](_0x20bc16[_0x216d('0x42')],{'$or':_[_0x216d('0x2d')](_0x28fcc2,function(_0x474fab){if(_0x474fab[_0x216d('0x31')]!==_0x216d('0x43')){var _0x35cb6e={};_0x35cb6e[_0x474fab[_0x216d('0x33')]]={'$like':'%'+_0x42abbe['query']['filter']+'%'};return _0x35cb6e;}})});}_0x20bc16=_[_0x216d('0x41')]({},_0x20bc16,_0x42abbe[_0x216d('0x44')]);var _0x504a34={'where':_0x20bc16[_0x216d('0x42')]};return db[_0x216d('0x2e')][_0x216d('0x22')](_0x504a34)['then'](function(_0x2c3e44){_0x12bcab[_0x216d('0x22')]=_0x2c3e44;if(_0x42abbe[_0x216d('0x35')][_0x216d('0x45')]){_0x20bc16['include']=[{'all':!![]}];}return db[_0x216d('0x2e')][_0x216d('0x46')](_0x20bc16);})['then'](function(_0x37bf4a){_0x12bcab[_0x216d('0x47')]=_0x37bf4a;return _0x12bcab;})['then'](respondWithFilteredResult(_0x10f7c6,_0x20bc16))['catch'](handleError(_0x10f7c6,null));};exports[_0x216d('0x48')]=function(_0x440bc9,_0x3c491e){var _0x498efe={'raw':![],'where':{'id':_0x440bc9['params']['id']}},_0x3e361a={};_0x3e361a['model']=_[_0x216d('0x34')](db[_0x216d('0x2e')][_0x216d('0x2f')]);_0x3e361a['query']=_[_0x216d('0x34')](_0x440bc9['query']);_0x3e361a[_0x216d('0x36')]=_[_0x216d('0x37')](_0x3e361a[_0x216d('0x32')],_0x3e361a['query']);_0x498efe[_0x216d('0x38')]=_[_0x216d('0x37')](_0x3e361a[_0x216d('0x32')],qs[_0x216d('0x39')](_0x440bc9['query']['fields']));_0x498efe['attributes']=_0x498efe[_0x216d('0x38')][_0x216d('0x3a')]?_0x498efe[_0x216d('0x38')]:_0x3e361a[_0x216d('0x32')];if(_0x440bc9[_0x216d('0x35')][_0x216d('0x45')]){_0x498efe[_0x216d('0x49')]=[{'all':!![]}];}_0x498efe=_[_0x216d('0x41')]({},_0x498efe,_0x440bc9['options']);return db[_0x216d('0x2e')][_0x216d('0x4a')](_0x498efe)[_0x216d('0x28')](handleEntityNotFound(_0x3c491e,null))[_0x216d('0x28')](respondWithResult(_0x3c491e,null))['catch'](handleError(_0x3c491e,null));};exports[_0x216d('0x4b')]=function(_0x542e1b,_0x1f2fa5){return db[_0x216d('0x2e')][_0x216d('0x4b')](_0x542e1b['body'],{})['then'](respondWithResult(_0x1f2fa5,0xc9))[_0x216d('0x4c')](handleError(_0x1f2fa5,null));};exports[_0x216d('0x27')]=function(_0x3932a3,_0x1340fe){if(_0x3932a3[_0x216d('0x4d')]['id']){delete _0x3932a3[_0x216d('0x4d')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x3932a3[_0x216d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1340fe,null))[_0x216d('0x28')](saveUpdates(_0x3932a3[_0x216d('0x4d')],null))['then'](respondWithResult(_0x1340fe,null))['catch'](handleError(_0x1340fe,null));};exports['destroy']=function(_0x4bac14,_0x1ae9b7){return db[_0x216d('0x2e')][_0x216d('0x4a')]({'where':{'id':_0x4bac14[_0x216d('0x4e')]['id']}})[_0x216d('0x28')](handleEntityNotFound(_0x1ae9b7,null))[_0x216d('0x28')](removeEntity(_0x1ae9b7,null))[_0x216d('0x4c')](handleError(_0x1ae9b7,null));};exports['getConfigurations']=function(_0x3f70c9,_0x34cdb9,_0x119b12){var _0x54dd49={};var _0x1e1caf={};var _0x10fe2e;var _0x2c7c67;return db[_0x216d('0x2e')]['findOne']({'where':{'id':_0x3f70c9[_0x216d('0x4e')]['id']}})[_0x216d('0x28')](handleEntityNotFound(_0x34cdb9,null))[_0x216d('0x28')](function(_0x1a4761){if(_0x1a4761){_0x10fe2e=_0x1a4761;_0x1e1caf['model']=_[_0x216d('0x34')](db[_0x216d('0x4f')]['rawAttributes']);_0x1e1caf[_0x216d('0x35')]=_['keys'](_0x3f70c9[_0x216d('0x35')]);_0x1e1caf[_0x216d('0x36')]=_[_0x216d('0x37')](_0x1e1caf[_0x216d('0x32')],_0x1e1caf[_0x216d('0x35')]);_0x54dd49[_0x216d('0x38')]=_[_0x216d('0x37')](_0x1e1caf[_0x216d('0x32')],qs[_0x216d('0x39')](_0x3f70c9['query'][_0x216d('0x39')]));_0x54dd49[_0x216d('0x38')]=_0x54dd49['attributes'][_0x216d('0x3a')]?_0x54dd49[_0x216d('0x38')]:_0x1e1caf['model'];_0x54dd49['order']=qs[_0x216d('0x3e')](_0x3f70c9['query'][_0x216d('0x3e')]);_0x54dd49[_0x216d('0x42')]=qs[_0x216d('0x36')](_['pick'](_0x3f70c9[_0x216d('0x35')],_0x1e1caf['filters']));if(_0x3f70c9['query'][_0x216d('0x40')]){_0x54dd49[_0x216d('0x42')]=_['merge'](_0x54dd49[_0x216d('0x42')],{'$or':_[_0x216d('0x2d')](_0x54dd49[_0x216d('0x38')],function(_0x3f9097){var _0x2ae667={};_0x2ae667[_0x3f9097]={'$like':'%'+_0x3f70c9[_0x216d('0x35')]['filter']+'%'};return _0x2ae667;})});}_0x54dd49=_['merge']({},_0x54dd49,_0x3f70c9[_0x216d('0x44')]);return _0x10fe2e[_0x216d('0x50')](_0x54dd49);}})[_0x216d('0x28')](function(_0x1551b6){if(_0x1551b6){_0x2c7c67=_0x1551b6[_0x216d('0x3a')];if(!_0x3f70c9[_0x216d('0x35')][_0x216d('0x3b')](_0x216d('0x3c'))){_0x54dd49[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x3f70c9[_0x216d('0x35')][_0x216d('0x21')]);_0x54dd49['offset']=qs['offset'](_0x3f70c9[_0x216d('0x35')][_0x216d('0x1f')]);}return _0x10fe2e['getConfigurations'](_0x54dd49);}})[_0x216d('0x28')](function(_0x5eb684){if(_0x5eb684){return _0x5eb684?{'count':_0x2c7c67,'rows':_0x5eb684}:null;}})['then'](respondWithResult(_0x34cdb9,null))[_0x216d('0x4c')](handleError(_0x34cdb9,null));};exports[_0x216d('0x51')]=function(_0x20806e,_0x17ce26,_0x1d404c){if(_0x20806e[_0x216d('0x4d')]['id']){delete _0x20806e[_0x216d('0x4d')]['id'];}return db[_0x216d('0x2e')][_0x216d('0x52')]({'where':{'id':_0x20806e[_0x216d('0x4e')]['id']}})[_0x216d('0x28')](handleEntityNotFound(_0x17ce26,null))[_0x216d('0x28')](function(_0x19c7cf){if(_0x19c7cf){_0x20806e[_0x216d('0x4d')][_0x216d('0x53')]=_0x19c7cf['id'];_0x20806e[_0x216d('0x4d')][_0x216d('0x54')]=integrations[_0x216d('0x55')](_0x20806e[_0x216d('0x4d')][_0x216d('0x56')],_0x20806e[_0x216d('0x4d')][_0x216d('0x31')]);_0x20806e['body'][_0x216d('0x57')]=integrations['getDescriptions'](_0x20806e[_0x216d('0x4d')]['channel'],_0x20806e[_0x216d('0x4d')][_0x216d('0x31')]);return db['ZendeskConfiguration'][_0x216d('0x4b')](_0x20806e[_0x216d('0x4d')],{'include':[{'model':db[_0x216d('0x58')],'as':_0x216d('0x54')},{'model':db[_0x216d('0x58')],'as':_0x216d('0x57')}]});}return null;})[_0x216d('0x28')](respondWithResult(_0x17ce26,null))[_0x216d('0x4c')](handleError(_0x17ce26,null));};exports[_0x216d('0x59')]=function(_0x5acc44,_0x120f8a,_0x299cc7){var _0x16cf09='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x5acc44['params']['id']},'attributes':['id','username',_0x216d('0x5a'),'token',_0x216d('0x5b'),_0x216d('0x5c')]})[_0x216d('0x28')](handleEntityNotFound(_0x120f8a,null))[_0x216d('0x28')](function(_0x431014){if(_0x431014){_0x16cf09=_0x431014[_0x216d('0x5c')];var _0x3a2e7c=_0x16cf09[_0x216d('0x5d')](-0x1);if(_0x3a2e7c==='/'){_0x16cf09=_0x16cf09[_0x216d('0x5e')](0x0,_0x16cf09['lastIndexOf'](_0x3a2e7c));}var _0x4e4e1a={'method':_0x216d('0x5f'),'uri':util['format'](_0x216d('0x60'),_0x16cf09,_0x216d('0x61')),'json':!![]};switch(_0x431014[_0x216d('0x5b')]){case _0x216d('0x5a'):_0x4e4e1a[_0x216d('0x62')]={'Authorization':util[_0x216d('0x63')]('Basic\x20%s',new Buffer(util['format'](_0x216d('0x64'),_0x431014['username'],_0x431014[_0x216d('0x5a')]))[_0x216d('0x65')](_0x216d('0x66')))};break;case'token':_0x4e4e1a['headers']={'Authorization':util['format'](_0x216d('0x67'),new Buffer(util[_0x216d('0x63')](_0x216d('0x68'),_0x431014[_0x216d('0x69')],_0x431014['token']))[_0x216d('0x65')](_0x216d('0x66')))};break;default:throw new db[(_0x216d('0x6a'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x4e4e1a);}})[_0x216d('0x28')](function(_0x87511b){if(_0x87511b){var _0x273d11=[_0x216d('0x6b'),_0x216d('0x6c'),'group',_0x216d('0x6d')];_[_0x216d('0x6e')](_0x87511b[_0x216d('0x61')],function(_0x325bd8){return _0x273d11['includes'](_0x325bd8[_0x216d('0x31')]);});return{'count':_0x87511b['ticket_fields'][_0x216d('0x3a')],'rows':_['map'](_0x87511b[_0x216d('0x61')],function(_0x3ae6df){return{'id':_0x3ae6df['id'],'name':_0x3ae6df[_0x216d('0x6f')]>0x7?_0x3ae6df[_0x216d('0x70')]:_0x3ae6df[_0x216d('0x31')],'custom':_0x3ae6df['position']>0x7?!![]:![],'options':_0x3ae6df[_0x216d('0x71')]?_0x3ae6df['system_field_options']:_0x3ae6df['custom_field_options']?_0x3ae6df['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x120f8a,null))[_0x216d('0x4c')](function(_0x38e7d7){var _0xa1594b=_0x5acc44['query']['test']?0x1f4:_0x38e7d7[_0x216d('0x72')]||0x1f4;logger[_0x216d('0x2a')](_0x216d('0x73'),_0x216d('0x59'),_0xa1594b,JSON[_0x216d('0x74')](_0x38e7d7));delete _0x38e7d7['name'];if(_0xa1594b===0x191){_0xa1594b=0x190;}_0x120f8a['status'](_0xa1594b)[_0x216d('0x75')](_0x5acc44['query'][_0x216d('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x38e7d7[_0x216d('0x72')]}:_0x38e7d7);});}; \ No newline at end of file +var _0x282b=['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','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','update','then','stack','name','index','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','map','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s/token:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials'];(function(_0x5a0d0b,_0x2565dc){var _0x5f1855=function(_0x26bedc){while(--_0x26bedc){_0x5a0d0b['push'](_0x5a0d0b['shift']());}};_0x5f1855(++_0x2565dc);}(_0x282b,0xec));var _0xb282=function(_0x1d2bf3,_0x356467){_0x1d2bf3=_0x1d2bf3-0x0;var _0x4c83e5=_0x282b[_0x1d2bf3];return _0x4c83e5;};'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'];var integrations=require(_0xb282('0x17'));function respondWithStatusCode(_0xc08746,_0x40d7b8){_0x40d7b8=_0x40d7b8||0xcc;return function(_0x9e9072){if(_0x9e9072){return _0xc08746[_0xb282('0x18')](_0x40d7b8);}return _0xc08746['status'](_0x40d7b8)[_0xb282('0x19')]();};}function respondWithResult(_0x5adf7f,_0xe1d53){_0xe1d53=_0xe1d53||0xc8;return function(_0x211862){if(_0x211862){return _0x5adf7f['status'](_0xe1d53)['json'](_0x211862);}};}function respondWithFilteredResult(_0x5bc7c3,_0x13cea1){return function(_0x350676){if(_0x350676){var _0x7c20df=typeof _0x13cea1[_0xb282('0x1a')]===_0xb282('0x1b')&&typeof _0x13cea1['limit']===_0xb282('0x1b');var _0x5519bf=_0x350676[_0xb282('0x1c')];var _0x45b070=_0x7c20df?0x0:_0x13cea1[_0xb282('0x1a')];var _0x492d20=_0x7c20df?_0x350676['count']:_0x13cea1[_0xb282('0x1a')]+_0x13cea1[_0xb282('0x1d')];var _0x599f9e;if(_0x492d20>=_0x5519bf){_0x492d20=_0x5519bf;_0x599f9e=0xc8;}else{_0x599f9e=0xce;}_0x5bc7c3[_0xb282('0x1e')](_0x599f9e);return _0x5bc7c3[_0xb282('0x1f')](_0xb282('0x20'),_0x45b070+'-'+_0x492d20+'/'+_0x5519bf)[_0xb282('0x21')](_0x350676);}return null;};}function patchUpdates(_0x1c3084){return function(_0x533147){try{jsonpatch[_0xb282('0x22')](_0x533147,_0x1c3084,!![]);}catch(_0x16a656){return BPromise[_0xb282('0x23')](_0x16a656);}return _0x533147['save']();};}function saveUpdates(_0x437d66,_0x2a7ef8){return function(_0x3c55ad){if(_0x3c55ad){return _0x3c55ad[_0xb282('0x24')](_0x437d66)[_0xb282('0x25')](function(_0x56645f){return _0x56645f;});}return null;};}function removeEntity(_0x4d624f,_0x360f15){return function(_0x3c7f1f){if(_0x3c7f1f){return _0x3c7f1f['destroy']()['then'](function(){_0x4d624f[_0xb282('0x1e')](0xcc)[_0xb282('0x19')]();});}};}function handleEntityNotFound(_0x3451e5,_0x3c4018){return function(_0x211cc1){if(!_0x211cc1){_0x3451e5[_0xb282('0x18')](0x194);}return _0x211cc1;};}function handleError(_0x5b1d3d,_0xa0d7fb){_0xa0d7fb=_0xa0d7fb||0x1f4;return function(_0x42015c){logger['error'](_0x42015c[_0xb282('0x26')]);if(_0x42015c[_0xb282('0x27')]){delete _0x42015c[_0xb282('0x27')];}_0x5b1d3d[_0xb282('0x1e')](_0xa0d7fb)['send'](_0x42015c);};}exports[_0xb282('0x28')]=function(_0x1fb89f,_0xe337b8){var _0x433ad5={},_0x4cee93={},_0xfddd2e={'count':0x0,'rows':[]};var _0x22f657=_['map'](db[_0xb282('0x29')][_0xb282('0x2a')],function(_0x3eb294){return{'name':_0x3eb294[_0xb282('0x2b')],'type':_0x3eb294[_0xb282('0x2c')]['key']};});_0x4cee93[_0xb282('0x2d')]=_['map'](_0x22f657,_0xb282('0x27'));_0x4cee93[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1fb89f['query']);_0x4cee93[_0xb282('0x30')]=_['intersection'](_0x4cee93[_0xb282('0x2d')],_0x4cee93[_0xb282('0x2e')]);_0x433ad5[_0xb282('0x31')]=_[_0xb282('0x32')](_0x4cee93[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x1fb89f['query'][_0xb282('0x33')]));_0x433ad5[_0xb282('0x31')]=_0x433ad5['attributes']['length']?_0x433ad5[_0xb282('0x31')]:_0x4cee93[_0xb282('0x2d')];if(!_0x1fb89f[_0xb282('0x2e')]['hasOwnProperty']('nolimit')){_0x433ad5['limit']=qs[_0xb282('0x1d')](_0x1fb89f[_0xb282('0x2e')][_0xb282('0x1d')]);_0x433ad5[_0xb282('0x1a')]=qs[_0xb282('0x1a')](_0x1fb89f[_0xb282('0x2e')][_0xb282('0x1a')]);}_0x433ad5['order']=qs[_0xb282('0x34')](_0x1fb89f['query'][_0xb282('0x34')]);_0x433ad5[_0xb282('0x35')]=qs[_0xb282('0x30')](_['pick'](_0x1fb89f[_0xb282('0x2e')],_0x4cee93['filters']),_0x22f657);if(_0x1fb89f[_0xb282('0x2e')][_0xb282('0x36')]){_0x433ad5[_0xb282('0x35')]=_[_0xb282('0x37')](_0x433ad5['where'],{'$or':_['map'](_0x22f657,function(_0x397fa1){if(_0x397fa1[_0xb282('0x2c')]!==_0xb282('0x38')){var _0x20d56c={};_0x20d56c[_0x397fa1['name']]={'$like':'%'+_0x1fb89f[_0xb282('0x2e')]['filter']+'%'};return _0x20d56c;}})});}_0x433ad5=_[_0xb282('0x37')]({},_0x433ad5,_0x1fb89f[_0xb282('0x39')]);var _0x482ff9={'where':_0x433ad5[_0xb282('0x35')]};return db[_0xb282('0x29')][_0xb282('0x1c')](_0x482ff9)[_0xb282('0x25')](function(_0x3c1e6c){_0xfddd2e[_0xb282('0x1c')]=_0x3c1e6c;if(_0x1fb89f[_0xb282('0x2e')][_0xb282('0x3a')]){_0x433ad5[_0xb282('0x3b')]=[{'all':!![]}];}return db[_0xb282('0x29')][_0xb282('0x3c')](_0x433ad5);})[_0xb282('0x25')](function(_0x1caff0){_0xfddd2e[_0xb282('0x3d')]=_0x1caff0;return _0xfddd2e;})[_0xb282('0x25')](respondWithFilteredResult(_0xe337b8,_0x433ad5))[_0xb282('0x3e')](handleError(_0xe337b8,null));};exports[_0xb282('0x3f')]=function(_0x7332d2,_0x573da7){var _0x310ad1={'raw':![],'where':{'id':_0x7332d2[_0xb282('0x40')]['id']}},_0x58109a={};_0x58109a[_0xb282('0x2d')]=_[_0xb282('0x2f')](db[_0xb282('0x29')][_0xb282('0x2a')]);_0x58109a[_0xb282('0x2e')]=_['keys'](_0x7332d2['query']);_0x58109a[_0xb282('0x30')]=_['intersection'](_0x58109a[_0xb282('0x2d')],_0x58109a[_0xb282('0x2e')]);_0x310ad1['attributes']=_[_0xb282('0x32')](_0x58109a[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x7332d2['query']['fields']));_0x310ad1[_0xb282('0x31')]=_0x310ad1['attributes'][_0xb282('0x41')]?_0x310ad1[_0xb282('0x31')]:_0x58109a[_0xb282('0x2d')];if(_0x7332d2[_0xb282('0x2e')][_0xb282('0x3a')]){_0x310ad1[_0xb282('0x3b')]=[{'all':!![]}];}_0x310ad1=_['merge']({},_0x310ad1,_0x7332d2[_0xb282('0x39')]);return db[_0xb282('0x29')][_0xb282('0x42')](_0x310ad1)['then'](handleEntityNotFound(_0x573da7,null))[_0xb282('0x25')](respondWithResult(_0x573da7,null))['catch'](handleError(_0x573da7,null));};exports[_0xb282('0x43')]=function(_0x4b0822,_0x1bf51c){return db['ZendeskAccount']['create'](_0x4b0822['body'],{})[_0xb282('0x25')](respondWithResult(_0x1bf51c,0xc9))[_0xb282('0x3e')](handleError(_0x1bf51c,null));};exports[_0xb282('0x24')]=function(_0x7a5aa4,_0x4a2d0e){if(_0x7a5aa4['body']['id']){delete _0x7a5aa4['body']['id'];}return db[_0xb282('0x29')][_0xb282('0x42')]({'where':{'id':_0x7a5aa4[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x4a2d0e,null))['then'](saveUpdates(_0x7a5aa4[_0xb282('0x44')],null))[_0xb282('0x25')](respondWithResult(_0x4a2d0e,null))['catch'](handleError(_0x4a2d0e,null));};exports[_0xb282('0x45')]=function(_0x9f4d79,_0x16f66b){return db[_0xb282('0x29')][_0xb282('0x42')]({'where':{'id':_0x9f4d79['params']['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x16f66b,null))[_0xb282('0x25')](removeEntity(_0x16f66b,null))[_0xb282('0x3e')](handleError(_0x16f66b,null));};exports[_0xb282('0x46')]=function(_0x308aa8,_0x112d4d,_0x4cde65){var _0x87d777={};var _0x574653={};var _0x4554f1;var _0x1e6ade;return db['ZendeskAccount'][_0xb282('0x47')]({'where':{'id':_0x308aa8[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x112d4d,null))['then'](function(_0x51cbb0){if(_0x51cbb0){_0x4554f1=_0x51cbb0;_0x574653[_0xb282('0x2d')]=_[_0xb282('0x2f')](db[_0xb282('0x48')]['rawAttributes']);_0x574653[_0xb282('0x2e')]=_['keys'](_0x308aa8[_0xb282('0x2e')]);_0x574653[_0xb282('0x30')]=_['intersection'](_0x574653[_0xb282('0x2d')],_0x574653['query']);_0x87d777[_0xb282('0x31')]=_[_0xb282('0x32')](_0x574653[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x308aa8[_0xb282('0x2e')][_0xb282('0x33')]));_0x87d777['attributes']=_0x87d777[_0xb282('0x31')]['length']?_0x87d777[_0xb282('0x31')]:_0x574653[_0xb282('0x2d')];_0x87d777['order']=qs['sort'](_0x308aa8[_0xb282('0x2e')][_0xb282('0x34')]);_0x87d777[_0xb282('0x35')]=qs['filters'](_['pick'](_0x308aa8[_0xb282('0x2e')],_0x574653[_0xb282('0x30')]));if(_0x308aa8[_0xb282('0x2e')]['filter']){_0x87d777[_0xb282('0x35')]=_['merge'](_0x87d777[_0xb282('0x35')],{'$or':_[_0xb282('0x49')](_0x87d777[_0xb282('0x31')],function(_0x27bac8){var _0x178b6a={};_0x178b6a[_0x27bac8]={'$like':'%'+_0x308aa8[_0xb282('0x2e')][_0xb282('0x36')]+'%'};return _0x178b6a;})});}_0x87d777=_['merge']({},_0x87d777,_0x308aa8[_0xb282('0x39')]);return _0x4554f1[_0xb282('0x46')](_0x87d777);}})[_0xb282('0x25')](function(_0x58116b){if(_0x58116b){_0x1e6ade=_0x58116b['length'];if(!_0x308aa8[_0xb282('0x2e')][_0xb282('0x4a')](_0xb282('0x4b'))){_0x87d777['limit']=qs['limit'](_0x308aa8[_0xb282('0x2e')][_0xb282('0x1d')]);_0x87d777['offset']=qs[_0xb282('0x1a')](_0x308aa8[_0xb282('0x2e')][_0xb282('0x1a')]);}return _0x4554f1['getConfigurations'](_0x87d777);}})[_0xb282('0x25')](function(_0x2fb4e4){if(_0x2fb4e4){return _0x2fb4e4?{'count':_0x1e6ade,'rows':_0x2fb4e4}:null;}})['then'](respondWithResult(_0x112d4d,null))[_0xb282('0x3e')](handleError(_0x112d4d,null));};exports[_0xb282('0x4c')]=function(_0x33b5ec,_0x26c9a6,_0x4ea7a6){if(_0x33b5ec['body']['id']){delete _0x33b5ec[_0xb282('0x44')]['id'];}return db[_0xb282('0x29')]['findOne']({'where':{'id':_0x33b5ec[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x26c9a6,null))[_0xb282('0x25')](function(_0x364b77){if(_0x364b77){_0x33b5ec[_0xb282('0x44')][_0xb282('0x4d')]=_0x364b77['id'];_0x33b5ec[_0xb282('0x44')][_0xb282('0x4e')]=integrations['getSubjects'](_0x33b5ec[_0xb282('0x44')][_0xb282('0x4f')],_0x33b5ec[_0xb282('0x44')]['type']);_0x33b5ec[_0xb282('0x44')][_0xb282('0x50')]=integrations['getDescriptions'](_0x33b5ec['body'][_0xb282('0x4f')],_0x33b5ec[_0xb282('0x44')][_0xb282('0x2c')]);return db[_0xb282('0x48')][_0xb282('0x43')](_0x33b5ec[_0xb282('0x44')],{'include':[{'model':db[_0xb282('0x51')],'as':_0xb282('0x4e')},{'model':db[_0xb282('0x51')],'as':_0xb282('0x50')}]});}return null;})[_0xb282('0x25')](respondWithResult(_0x26c9a6,null))[_0xb282('0x3e')](handleError(_0x26c9a6,null));};exports[_0xb282('0x52')]=function(_0x2eae62,_0x3c1579,_0x3a87ce){var _0x4ccef5='';return db[_0xb282('0x29')][_0xb282('0x47')]({'where':{'id':_0x2eae62[_0xb282('0x40')]['id']},'attributes':['id',_0xb282('0x53'),_0xb282('0x54'),_0xb282('0x55'),_0xb282('0x56'),_0xb282('0x57')]})[_0xb282('0x25')](handleEntityNotFound(_0x3c1579,null))[_0xb282('0x25')](function(_0x21b3f6){if(_0x21b3f6){_0x4ccef5=_0x21b3f6['remoteUri'];var _0x10bed7=_0x4ccef5[_0xb282('0x58')](-0x1);if(_0x10bed7==='/'){_0x4ccef5=_0x4ccef5[_0xb282('0x59')](0x0,_0x4ccef5[_0xb282('0x5a')](_0x10bed7));}var _0x1e5c3a={'method':'GET','uri':util['format'](_0xb282('0x5b'),_0x4ccef5,_0xb282('0x5c')),'json':!![]};switch(_0x21b3f6[_0xb282('0x56')]){case _0xb282('0x54'):_0x1e5c3a[_0xb282('0x5d')]={'Authorization':util[_0xb282('0x5e')](_0xb282('0x5f'),new Buffer(util['format']('%s:%s',_0x21b3f6[_0xb282('0x53')],_0x21b3f6[_0xb282('0x54')]))['toString']('base64'))};break;case _0xb282('0x55'):_0x1e5c3a[_0xb282('0x5d')]={'Authorization':util[_0xb282('0x5e')](_0xb282('0x5f'),new Buffer(util[_0xb282('0x5e')](_0xb282('0x60'),_0x21b3f6[_0xb282('0x53')],_0x21b3f6['token']))[_0xb282('0x61')](_0xb282('0x62')))};break;default:throw new db[(_0xb282('0x63'))][(_0xb282('0x64'))](_0xb282('0x65'));}return rp(_0x1e5c3a);}})[_0xb282('0x25')](function(_0x11f255){if(_0x11f255){var _0x3c37e0=[_0xb282('0x66'),_0xb282('0x67'),'group',_0xb282('0x68')];_[_0xb282('0x69')](_0x11f255[_0xb282('0x5c')],function(_0x227e66){return _0x3c37e0[_0xb282('0x6a')](_0x227e66[_0xb282('0x2c')]);});return{'count':_0x11f255[_0xb282('0x5c')][_0xb282('0x41')],'rows':_['map'](_0x11f255[_0xb282('0x5c')],function(_0x400f2a){return{'id':_0x400f2a['id'],'name':_0x400f2a[_0xb282('0x6b')]>0x7?_0x400f2a[_0xb282('0x6c')]:_0x400f2a[_0xb282('0x2c')],'custom':_0x400f2a[_0xb282('0x6b')]>0x7?!![]:![],'options':_0x400f2a['system_field_options']?_0x400f2a[_0xb282('0x6d')]:_0x400f2a[_0xb282('0x6e')]?_0x400f2a[_0xb282('0x6e')]:[]};})};}})['then'](respondWithResult(_0x3c1579,null))[_0xb282('0x3e')](function(_0x28677e){var _0x4e894e=_0x2eae62[_0xb282('0x2e')][_0xb282('0x6f')]?0x1f4:_0x28677e[_0xb282('0x70')]||0x1f4;logger[_0xb282('0x71')](_0xb282('0x72'),_0xb282('0x52'),_0x4e894e,JSON[_0xb282('0x73')](_0x28677e));delete _0x28677e['name'];if(_0x4e894e===0x191){_0x4e894e=0x190;}_0x3c1579['status'](_0x4e894e)[_0xb282('0x74')](_0x2eae62['query'][_0xb282('0x6f')]?{'message':_0xb282('0x75'),'statusCode':_0x28677e[_0xb282('0x70')]}:_0x28677e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d5f0cf5..2c4e713 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 _0x9555=['int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','exports','define','ZendeskAccount'];(function(_0x4d026d,_0x4a1146){var _0x311a19=function(_0x50c360){while(--_0x50c360){_0x4d026d['push'](_0x4d026d['shift']());}};_0x311a19(++_0x4a1146);}(_0x9555,0x76));var _0x5955=function(_0x59a9e8,_0x59c3e6){_0x59a9e8=_0x59a9e8-0x0;var _0x12c8cd=_0x9555[_0x59a9e8];return _0x12c8cd;};'use strict';var _=require(_0x5955('0x0'));var util=require(_0x5955('0x1'));var logger=require(_0x5955('0x2'))('api');var moment=require(_0x5955('0x3'));var BPromise=require(_0x5955('0x4'));var rp=require(_0x5955('0x5'));var fs=require('fs');var path=require(_0x5955('0x6'));var rimraf=require(_0x5955('0x7'));var config=require('../../config/environment');var attributes=require(_0x5955('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5955('0x9')]=function(_0x616a78,_0x4be82e){return _0x616a78[_0x5955('0xa')](_0x5955('0xb'),attributes,{'tableName':_0x5955('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d41=['../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5b083b,_0x145a9b){var _0x6c2225=function(_0xcc6435){while(--_0xcc6435){_0x5b083b['push'](_0x5b083b['shift']());}};_0x6c2225(++_0x145a9b);}(_0x3d41,0xb8));var _0x13d4=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x3d41[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0x13d4('0x0'));var util=require('util');var logger=require(_0x13d4('0x1'))('api');var moment=require(_0x13d4('0x2'));var BPromise=require(_0x13d4('0x3'));var rp=require(_0x13d4('0x4'));var fs=require('fs');var path=require(_0x13d4('0x5'));var rimraf=require(_0x13d4('0x6'));var config=require(_0x13d4('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x13d4('0x8'));module[_0x13d4('0x9')]=function(_0x2ce7b6,_0x1b9f23){return _0x2ce7b6[_0x13d4('0xa')](_0x13d4('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 5e6f9f2..265e695 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 _0x6aa1=['then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetZendeskAccount','ZendeskAccount','options','where','limit','include','map','model','attributes','debug','stringify','ShowZendeskAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x480f4a,_0x2ea3f8){var _0xdccb7d=function(_0x151258){while(--_0x151258){_0x480f4a['push'](_0x480f4a['shift']());}};_0xdccb7d(++_0x2ea3f8);}(_0x6aa1,0x7b));var _0x16aa=function(_0x4e0e45,_0x430aad){_0x4e0e45=_0x4e0e45-0x0;var _0x48b664=_0x6aa1[_0x4e0e45];return _0x48b664;};'use strict';var _=require(_0x16aa('0x0'));var util=require(_0x16aa('0x1'));var moment=require(_0x16aa('0x2'));var BPromise=require(_0x16aa('0x3'));var rs=require(_0x16aa('0x4'));var fs=require('fs');var Redis=require(_0x16aa('0x5'));var db=require(_0x16aa('0x6'))['db'];var utils=require(_0x16aa('0x7'));var logger=require(_0x16aa('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x16aa('0x9'));var client=jayson[_0x16aa('0xa')][_0x16aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x496fd7,_0x339db0,_0x4c86b1){return new BPromise(function(_0x36d089,_0x3f2730){return client[_0x16aa('0xc')](_0x496fd7,_0x4c86b1)[_0x16aa('0xd')](function(_0x17bb1f){logger[_0x16aa('0xe')](_0x16aa('0xf'),_0x339db0,_0x16aa('0x10'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x339db0,_0x16aa('0x10'),JSON['stringify'](_0x17bb1f));if(_0x17bb1f[_0x16aa('0x11')]){if(_0x17bb1f[_0x16aa('0x11')][_0x16aa('0x12')]===0x1f4){logger['error'](_0x16aa('0xf'),_0x339db0,_0x17bb1f[_0x16aa('0x11')][_0x16aa('0x13')]);return _0x3f2730(_0x17bb1f['error'][_0x16aa('0x13')]);}logger[_0x16aa('0x11')](_0x16aa('0xf'),_0x339db0,_0x17bb1f['error'][_0x16aa('0x13')]);return _0x36d089(_0x17bb1f[_0x16aa('0x11')][_0x16aa('0x13')]);}else{logger[_0x16aa('0xe')](_0x16aa('0xf'),_0x339db0,_0x16aa('0x10'));_0x36d089(_0x17bb1f['result'][_0x16aa('0x13')]);}})[_0x16aa('0x14')](function(_0x2d4f16){logger[_0x16aa('0x11')](_0x16aa('0xf'),_0x339db0,_0x2d4f16);_0x3f2730(_0x2d4f16);});});}exports[_0x16aa('0x15')]=function(_0x2f5926){var _0x3df9e4=this;return new Promise(function(_0x1eb80a,_0xa9101f){return db[_0x16aa('0x16')]['findAll']({'raw':_0x2f5926[_0x16aa('0x17')]?_0x2f5926[_0x16aa('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2f5926['options']?_0x2f5926['options'][_0x16aa('0x18')]||null:null,'attributes':_0x2f5926[_0x16aa('0x17')]?_0x2f5926[_0x16aa('0x17')]['attributes']||null:null,'limit':_0x2f5926[_0x16aa('0x17')]?_0x2f5926['options'][_0x16aa('0x19')]||null:null,'include':_0x2f5926[_0x16aa('0x17')]?_0x2f5926[_0x16aa('0x17')][_0x16aa('0x1a')]?_[_0x16aa('0x1b')](_0x2f5926[_0x16aa('0x17')][_0x16aa('0x1a')],function(_0x28d61b){return{'model':db[_0x28d61b[_0x16aa('0x1c')]],'as':_0x28d61b['as'],'attributes':_0x28d61b['attributes'],'include':_0x28d61b[_0x16aa('0x1a')]?_['map'](_0x28d61b[_0x16aa('0x1a')],function(_0x53ad8b){return{'model':db[_0x53ad8b[_0x16aa('0x1c')]],'as':_0x53ad8b['as'],'attributes':_0x53ad8b[_0x16aa('0x1d')],'include':_0x53ad8b[_0x16aa('0x1a')]?_[_0x16aa('0x1b')](_0x53ad8b[_0x16aa('0x1a')],function(_0x58d727){return{'model':db[_0x58d727[_0x16aa('0x1c')]],'as':_0x58d727['as'],'attributes':_0x58d727['attributes']};}):[]};}):[]};}):[]:[]})[_0x16aa('0xd')](function(_0x5928ad){logger[_0x16aa('0xe')](_0x16aa('0x15'),_0x2f5926);logger[_0x16aa('0x1e')](_0x16aa('0x15'),_0x2f5926,JSON[_0x16aa('0x1f')](_0x5928ad));_0x1eb80a(_0x5928ad);})[_0x16aa('0x14')](function(_0x1fd3ef){logger[_0x16aa('0x11')](_0x16aa('0x15'),_0x1fd3ef[_0x16aa('0x13')],_0x2f5926);_0xa9101f(_0x3df9e4[_0x16aa('0x11')](0x1f4,_0x1fd3ef[_0x16aa('0x13')]));});});};exports[_0x16aa('0x20')]=function(_0x1a653c){var _0x62e2dd=this;return new Promise(function(_0x3ce1a5,_0x4dd4ae){return db[_0x16aa('0x16')]['find']({'raw':_0x1a653c[_0x16aa('0x17')]?_0x1a653c[_0x16aa('0x17')][_0x16aa('0x21')]===undefined?!![]:![]:!![],'where':_0x1a653c['options']?_0x1a653c[_0x16aa('0x17')][_0x16aa('0x18')]||null:null,'attributes':_0x1a653c['options']?_0x1a653c[_0x16aa('0x17')][_0x16aa('0x1d')]||null:null,'include':_0x1a653c['options']?_0x1a653c[_0x16aa('0x17')]['include']?_[_0x16aa('0x1b')](_0x1a653c[_0x16aa('0x17')][_0x16aa('0x1a')],function(_0xdd5cf){return{'model':db[_0xdd5cf['model']],'as':_0xdd5cf['as'],'attributes':_0xdd5cf[_0x16aa('0x1d')],'include':_0xdd5cf[_0x16aa('0x1a')]?_[_0x16aa('0x1b')](_0xdd5cf[_0x16aa('0x1a')],function(_0x4d80e1){return{'model':db[_0x4d80e1[_0x16aa('0x1c')]],'as':_0x4d80e1['as'],'attributes':_0x4d80e1[_0x16aa('0x1d')],'include':_0x4d80e1[_0x16aa('0x1a')]?_[_0x16aa('0x1b')](_0x4d80e1['include'],function(_0x490d8f){return{'model':db[_0x490d8f[_0x16aa('0x1c')]],'as':_0x490d8f['as'],'attributes':_0x490d8f[_0x16aa('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56d21f){logger['info'](_0x16aa('0x20'),_0x1a653c);logger[_0x16aa('0x1e')](_0x16aa('0x20'),_0x1a653c,JSON['stringify'](_0x56d21f));_0x3ce1a5(_0x56d21f);})['catch'](function(_0x21c3d4){logger[_0x16aa('0x11')]('ShowZendeskAccount',_0x21c3d4[_0x16aa('0x13')],_0x1a653c);_0x4dd4ae(_0x62e2dd[_0x16aa('0x11')](0x1f4,_0x21c3d4['message']));});});}; \ No newline at end of file +var _0x37a5=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetZendeskAccount','findAll','options','map','include','model','attributes','then','catch','ShowZendeskAccount','ZendeskAccount','find','raw','where','lodash'];(function(_0x5771d1,_0x38b898){var _0x40a3cc=function(_0x3bdf80){while(--_0x3bdf80){_0x5771d1['push'](_0x5771d1['shift']());}};_0x40a3cc(++_0x38b898);}(_0x37a5,0x107));var _0x537a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x37a5[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x537a('0x0'));var util=require(_0x537a('0x1'));var moment=require('moment');var BPromise=require(_0x537a('0x2'));var rs=require(_0x537a('0x3'));var fs=require('fs');var Redis=require(_0x537a('0x4'));var db=require(_0x537a('0x5'))['db'];var utils=require(_0x537a('0x6'));var logger=require(_0x537a('0x7'))(_0x537a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x537a('0x9')][_0x537a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x158608,_0x1ddd9d,_0x50d48c){return new BPromise(function(_0x539908,_0x4396b7){return client['request'](_0x158608,_0x50d48c)['then'](function(_0x46e190){logger[_0x537a('0xb')](_0x537a('0xc'),_0x1ddd9d,'request\x20sent');logger[_0x537a('0xd')](_0x537a('0xe'),_0x1ddd9d,_0x537a('0xf'),JSON[_0x537a('0x10')](_0x46e190));if(_0x46e190[_0x537a('0x11')]){if(_0x46e190['error']['code']===0x1f4){logger['error'](_0x537a('0xc'),_0x1ddd9d,_0x46e190['error']['message']);return _0x4396b7(_0x46e190[_0x537a('0x11')]['message']);}logger[_0x537a('0x11')](_0x537a('0xc'),_0x1ddd9d,_0x46e190[_0x537a('0x11')][_0x537a('0x12')]);return _0x539908(_0x46e190['error'][_0x537a('0x12')]);}else{logger['info'](_0x537a('0xc'),_0x1ddd9d,_0x537a('0xf'));_0x539908(_0x46e190['result'][_0x537a('0x12')]);}})['catch'](function(_0x53d3b7){logger[_0x537a('0x11')](_0x537a('0xc'),_0x1ddd9d,_0x53d3b7);_0x4396b7(_0x53d3b7);});});}exports[_0x537a('0x13')]=function(_0x38dc77){var _0x1ff490=this;return new Promise(function(_0x104bd5,_0x3e1e09){return db['ZendeskAccount'][_0x537a('0x14')]({'raw':_0x38dc77[_0x537a('0x15')]?_0x38dc77[_0x537a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x38dc77[_0x537a('0x15')]?_0x38dc77[_0x537a('0x15')]['where']||null:null,'attributes':_0x38dc77['options']?_0x38dc77['options']['attributes']||null:null,'limit':_0x38dc77['options']?_0x38dc77[_0x537a('0x15')]['limit']||null:null,'include':_0x38dc77[_0x537a('0x15')]?_0x38dc77[_0x537a('0x15')]['include']?_[_0x537a('0x16')](_0x38dc77[_0x537a('0x15')][_0x537a('0x17')],function(_0x262f86){return{'model':db[_0x262f86[_0x537a('0x18')]],'as':_0x262f86['as'],'attributes':_0x262f86[_0x537a('0x19')],'include':_0x262f86[_0x537a('0x17')]?_['map'](_0x262f86[_0x537a('0x17')],function(_0x387396){return{'model':db[_0x387396[_0x537a('0x18')]],'as':_0x387396['as'],'attributes':_0x387396[_0x537a('0x19')],'include':_0x387396[_0x537a('0x17')]?_['map'](_0x387396['include'],function(_0xba0650){return{'model':db[_0xba0650[_0x537a('0x18')]],'as':_0xba0650['as'],'attributes':_0xba0650['attributes']};}):[]};}):[]};}):[]:[]})[_0x537a('0x1a')](function(_0x172f5b){logger[_0x537a('0xb')](_0x537a('0x13'),_0x38dc77);logger[_0x537a('0xd')](_0x537a('0x13'),_0x38dc77,JSON[_0x537a('0x10')](_0x172f5b));_0x104bd5(_0x172f5b);})[_0x537a('0x1b')](function(_0x1a23f5){logger[_0x537a('0x11')](_0x537a('0x13'),_0x1a23f5['message'],_0x38dc77);_0x3e1e09(_0x1ff490['error'](0x1f4,_0x1a23f5[_0x537a('0x12')]));});});};exports[_0x537a('0x1c')]=function(_0x5be5aa){var _0x164994=this;return new Promise(function(_0x12c959,_0x3d73fe){return db[_0x537a('0x1d')][_0x537a('0x1e')]({'raw':_0x5be5aa[_0x537a('0x15')]?_0x5be5aa[_0x537a('0x15')][_0x537a('0x1f')]===undefined?!![]:![]:!![],'where':_0x5be5aa[_0x537a('0x15')]?_0x5be5aa[_0x537a('0x15')][_0x537a('0x20')]||null:null,'attributes':_0x5be5aa[_0x537a('0x15')]?_0x5be5aa[_0x537a('0x15')][_0x537a('0x19')]||null:null,'include':_0x5be5aa[_0x537a('0x15')]?_0x5be5aa['options'][_0x537a('0x17')]?_[_0x537a('0x16')](_0x5be5aa[_0x537a('0x15')][_0x537a('0x17')],function(_0x5225e7){return{'model':db[_0x5225e7[_0x537a('0x18')]],'as':_0x5225e7['as'],'attributes':_0x5225e7[_0x537a('0x19')],'include':_0x5225e7[_0x537a('0x17')]?_[_0x537a('0x16')](_0x5225e7[_0x537a('0x17')],function(_0x28aa40){return{'model':db[_0x28aa40['model']],'as':_0x28aa40['as'],'attributes':_0x28aa40[_0x537a('0x19')],'include':_0x28aa40[_0x537a('0x17')]?_[_0x537a('0x16')](_0x28aa40[_0x537a('0x17')],function(_0x42fbb4){return{'model':db[_0x42fbb4[_0x537a('0x18')]],'as':_0x42fbb4['as'],'attributes':_0x42fbb4[_0x537a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de105){logger['info'](_0x537a('0x1c'),_0x5be5aa);logger[_0x537a('0xd')]('ShowZendeskAccount',_0x5be5aa,JSON['stringify'](_0x2de105));_0x12c959(_0x2de105);})[_0x537a('0x1b')](function(_0x1ee887){logger[_0x537a('0x11')](_0x537a('0x1c'),_0x1ee887[_0x537a('0x12')],_0x5be5aa);_0x3d73fe(_0x164994[_0x537a('0x11')](0x1f4,_0x1ee887[_0x537a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f322ed6..00c719f 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 _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(_0x986ac2,_0x42a18a){var _0x3ffee4=function(_0xca6e3f){while(--_0xca6e3f){_0x986ac2['push'](_0x986ac2['shift']());}};_0x3ffee4(++_0x42a18a);}(_0x5c00,0x17e));var _0x05c0=function(_0x5e8fc,_0x1ccc06){_0x5e8fc=_0x5e8fc-0x0;var _0x41c58c=_0x5c00[_0x5e8fc];return _0x41c58c;};'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 +var _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x4024,0x89));var _0x4402=function(_0x104d0d,_0x81e4ad){_0x104d0d=_0x104d0d-0x0;var _0x3889ac=_0x4024[_0x104d0d];return _0x3889ac;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index ed67be3..14e344a 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 _0x1c98=['STRING','exports'];(function(_0x480fc2,_0x482fba){var _0x540a95=function(_0x4b5a56){while(--_0x4b5a56){_0x480fc2['push'](_0x480fc2['shift']());}};_0x540a95(++_0x482fba);}(_0x1c98,0x69));var _0x81c9=function(_0x3a3c72,_0x3d801a){_0x3a3c72=_0x3a3c72-0x0;var _0x274b17=_0x1c98[_0x3a3c72];return _0x274b17;};'use strict';var Sequelize=require('sequelize');module[_0x81c9('0x0')]={'name':{'type':Sequelize[_0x81c9('0x1')]},'description':{'type':Sequelize[_0x81c9('0x1')]}}; \ No newline at end of file +var _0xd0f0=['STRING'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0xd0f0,0x10d));var _0x0d0f=function(_0x5f3cab,_0x1b523d){_0x5f3cab=_0x5f3cab-0x0;var _0x2db243=_0xd0f0[_0x5f3cab];return _0x2db243;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0d0f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index fe2156a..4e07993 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 _0x57d0=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','ZendeskConfiguration','includeAll','include','rows','catch','create','body','find','params','getFields','findOne','ZendeskField','length','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x31c04b,_0xe5b190){var _0x23104b=function(_0x5a7150){while(--_0x5a7150){_0x31c04b['push'](_0x31c04b['shift']());}};_0x23104b(++_0xe5b190);}(_0x57d0,0xe2));var _0x057d=function(_0x1ffff7,_0x2f9ff6){_0x1ffff7=_0x1ffff7-0x0;var _0x49d017=_0x57d0[_0x1ffff7];return _0x49d017;};'use strict';var emlformat=require(_0x057d('0x0'));var rimraf=require(_0x057d('0x1'));var zipdir=require(_0x057d('0x2'));var jsonpatch=require(_0x057d('0x3'));var rp=require('request-promise');var moment=require(_0x057d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x057d('0x5'));var path=require(_0x057d('0x6'));var sox=require(_0x057d('0x7'));var csv=require(_0x057d('0x8'));var ejs=require(_0x057d('0x9'));var fs=require('fs');var fs_extra=require(_0x057d('0xa'));var _=require(_0x057d('0xb'));var squel=require(_0x057d('0xc'));var crypto=require(_0x057d('0xd'));var jsforce=require(_0x057d('0xe'));var deskjs=require(_0x057d('0xf'));var toCsv=require(_0x057d('0x8'));var querystring=require(_0x057d('0x10'));var Papa=require(_0x057d('0x11'));var Redis=require(_0x057d('0x12'));var authService=require(_0x057d('0x13'));var qs=require(_0x057d('0x14'));var as=require(_0x057d('0x15'));var hardwareService=require(_0x057d('0x16'));var logger=require(_0x057d('0x17'))(_0x057d('0x18'));var utils=require(_0x057d('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x057d('0x1a'))['db'];function respondWithStatusCode(_0x403d8f,_0x217e04){_0x217e04=_0x217e04||0xcc;return function(_0x1ed7de){if(_0x1ed7de){return _0x403d8f[_0x057d('0x1b')](_0x217e04);}return _0x403d8f[_0x057d('0x1c')](_0x217e04)['end']();};}function respondWithResult(_0x101f00,_0x34742b){_0x34742b=_0x34742b||0xc8;return function(_0x4855b3){if(_0x4855b3){return _0x101f00[_0x057d('0x1c')](_0x34742b)[_0x057d('0x1d')](_0x4855b3);}};}function respondWithFilteredResult(_0xfce498,_0x598573){return function(_0x3c8092){if(_0x3c8092){var _0x56efed=typeof _0x598573['offset']===_0x057d('0x1e')&&typeof _0x598573[_0x057d('0x1f')]===_0x057d('0x1e');var _0x328a05=_0x3c8092[_0x057d('0x20')];var _0x4ee53b=_0x56efed?0x0:_0x598573['offset'];var _0x22bd68=_0x56efed?_0x3c8092['count']:_0x598573[_0x057d('0x21')]+_0x598573[_0x057d('0x1f')];var _0x3a710f;if(_0x22bd68>=_0x328a05){_0x22bd68=_0x328a05;_0x3a710f=0xc8;}else{_0x3a710f=0xce;}_0xfce498[_0x057d('0x1c')](_0x3a710f);return _0xfce498['set'](_0x057d('0x22'),_0x4ee53b+'-'+_0x22bd68+'/'+_0x328a05)[_0x057d('0x1d')](_0x3c8092);}return null;};}function patchUpdates(_0x40aa81){return function(_0x20486c){try{jsonpatch[_0x057d('0x23')](_0x20486c,_0x40aa81,!![]);}catch(_0xa9a37c){return BPromise[_0x057d('0x24')](_0xa9a37c);}return _0x20486c[_0x057d('0x25')]();};}function saveUpdates(_0xaa34bf,_0x4975fc){return function(_0x48c39b){if(_0x48c39b){return _0x48c39b[_0x057d('0x26')](_0xaa34bf)[_0x057d('0x27')](function(_0x649214){return _0x649214;});}return null;};}function removeEntity(_0xd9878e,_0x55a4c7){return function(_0x58d641){if(_0x58d641){return _0x58d641[_0x057d('0x28')]()[_0x057d('0x27')](function(){_0xd9878e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1f42,_0x2b2306){return function(_0x5b66a4){if(!_0x5b66a4){_0x4a1f42[_0x057d('0x1b')](0x194);}return _0x5b66a4;};}function handleError(_0x27918a,_0x17b217){_0x17b217=_0x17b217||0x1f4;return function(_0x376049){logger['error'](_0x376049[_0x057d('0x29')]);if(_0x376049['name']){delete _0x376049[_0x057d('0x2a')];}_0x27918a['status'](_0x17b217)[_0x057d('0x2b')](_0x376049);};}exports['index']=function(_0x3d4aa5,_0x1a829){var _0x3ed6df={},_0x1cbdbe={},_0xc298b0={'count':0x0,'rows':[]};var _0x33cd8d=_[_0x057d('0x2c')](db['ZendeskConfiguration'][_0x057d('0x2d')],function(_0x404422){return{'name':_0x404422[_0x057d('0x2e')],'type':_0x404422[_0x057d('0x2f')][_0x057d('0x30')]};});_0x1cbdbe[_0x057d('0x31')]=_['map'](_0x33cd8d,_0x057d('0x2a'));_0x1cbdbe[_0x057d('0x32')]=_[_0x057d('0x33')](_0x3d4aa5[_0x057d('0x32')]);_0x1cbdbe[_0x057d('0x34')]=_[_0x057d('0x35')](_0x1cbdbe[_0x057d('0x31')],_0x1cbdbe[_0x057d('0x32')]);_0x3ed6df[_0x057d('0x36')]=_[_0x057d('0x35')](_0x1cbdbe[_0x057d('0x31')],qs['fields'](_0x3d4aa5[_0x057d('0x32')][_0x057d('0x37')]));_0x3ed6df[_0x057d('0x36')]=_0x3ed6df[_0x057d('0x36')]['length']?_0x3ed6df['attributes']:_0x1cbdbe[_0x057d('0x31')];if(!_0x3d4aa5[_0x057d('0x32')][_0x057d('0x38')]('nolimit')){_0x3ed6df[_0x057d('0x1f')]=qs[_0x057d('0x1f')](_0x3d4aa5['query']['limit']);_0x3ed6df[_0x057d('0x21')]=qs[_0x057d('0x21')](_0x3d4aa5[_0x057d('0x32')][_0x057d('0x21')]);}_0x3ed6df[_0x057d('0x39')]=qs[_0x057d('0x3a')](_0x3d4aa5[_0x057d('0x32')][_0x057d('0x3a')]);_0x3ed6df[_0x057d('0x3b')]=qs[_0x057d('0x34')](_[_0x057d('0x3c')](_0x3d4aa5[_0x057d('0x32')],_0x1cbdbe['filters']),_0x33cd8d);if(_0x3d4aa5[_0x057d('0x32')]['filter']){_0x3ed6df[_0x057d('0x3b')]=_[_0x057d('0x3d')](_0x3ed6df[_0x057d('0x3b')],{'$or':_[_0x057d('0x2c')](_0x33cd8d,function(_0x4edc43){if(_0x4edc43[_0x057d('0x2f')]!==_0x057d('0x3e')){var _0x2f2a41={};_0x2f2a41[_0x4edc43[_0x057d('0x2a')]]={'$like':'%'+_0x3d4aa5['query'][_0x057d('0x3f')]+'%'};return _0x2f2a41;}})});}_0x3ed6df=_[_0x057d('0x3d')]({},_0x3ed6df,_0x3d4aa5[_0x057d('0x40')]);var _0xd2020b={'where':_0x3ed6df['where']};return db[_0x057d('0x41')][_0x057d('0x20')](_0xd2020b)['then'](function(_0xd02e75){_0xc298b0[_0x057d('0x20')]=_0xd02e75;if(_0x3d4aa5[_0x057d('0x32')][_0x057d('0x42')]){_0x3ed6df[_0x057d('0x43')]=[{'all':!![]}];}return db[_0x057d('0x41')]['findAll'](_0x3ed6df);})[_0x057d('0x27')](function(_0xb5a3e){_0xc298b0[_0x057d('0x44')]=_0xb5a3e;return _0xc298b0;})[_0x057d('0x27')](respondWithFilteredResult(_0x1a829,_0x3ed6df))['catch'](handleError(_0x1a829,null));};exports['show']=function(_0x1cf536,_0x4172d0){var _0x248d15={'raw':![],'where':{'id':_0x1cf536['params']['id']}},_0x1b3412={};_0x1b3412[_0x057d('0x31')]=_['keys'](db[_0x057d('0x41')]['rawAttributes']);_0x1b3412[_0x057d('0x32')]=_[_0x057d('0x33')](_0x1cf536['query']);_0x1b3412[_0x057d('0x34')]=_[_0x057d('0x35')](_0x1b3412['model'],_0x1b3412[_0x057d('0x32')]);_0x248d15[_0x057d('0x36')]=_[_0x057d('0x35')](_0x1b3412[_0x057d('0x31')],qs[_0x057d('0x37')](_0x1cf536[_0x057d('0x32')]['fields']));_0x248d15['attributes']=_0x248d15[_0x057d('0x36')]['length']?_0x248d15[_0x057d('0x36')]:_0x1b3412['model'];if(_0x1cf536[_0x057d('0x32')][_0x057d('0x42')]){_0x248d15[_0x057d('0x43')]=[{'all':!![]}];}_0x248d15=_[_0x057d('0x3d')]({},_0x248d15,_0x1cf536[_0x057d('0x40')]);return db['ZendeskConfiguration']['find'](_0x248d15)['then'](handleEntityNotFound(_0x4172d0,null))[_0x057d('0x27')](respondWithResult(_0x4172d0,null))[_0x057d('0x45')](handleError(_0x4172d0,null));};exports[_0x057d('0x46')]=function(_0x22028a,_0x2e92bc){return db[_0x057d('0x41')][_0x057d('0x46')](_0x22028a[_0x057d('0x47')],{})[_0x057d('0x27')](respondWithResult(_0x2e92bc,0xc9))[_0x057d('0x45')](handleError(_0x2e92bc,null));};exports[_0x057d('0x26')]=function(_0x37b3f5,_0x32c9e1){if(_0x37b3f5['body']['id']){delete _0x37b3f5[_0x057d('0x47')]['id'];}return db[_0x057d('0x41')][_0x057d('0x48')]({'where':{'id':_0x37b3f5['params']['id']}})['then'](handleEntityNotFound(_0x32c9e1,null))[_0x057d('0x27')](saveUpdates(_0x37b3f5[_0x057d('0x47')],null))[_0x057d('0x27')](respondWithResult(_0x32c9e1,null))[_0x057d('0x45')](handleError(_0x32c9e1,null));};exports[_0x057d('0x28')]=function(_0x49c0b4,_0x41d644){return db[_0x057d('0x41')][_0x057d('0x48')]({'where':{'id':_0x49c0b4[_0x057d('0x49')]['id']}})[_0x057d('0x27')](handleEntityNotFound(_0x41d644,null))[_0x057d('0x27')](removeEntity(_0x41d644,null))[_0x057d('0x45')](handleError(_0x41d644,null));};exports[_0x057d('0x4a')]=function(_0x2ef2e7,_0x275952,_0x1297bb){var _0x1bdb9c={};var _0x45fa1d={};var _0xac7010;var _0xe3c865;return db[_0x057d('0x41')][_0x057d('0x4b')]({'where':{'id':_0x2ef2e7[_0x057d('0x49')]['id']}})['then'](handleEntityNotFound(_0x275952,null))['then'](function(_0x56f297){if(_0x56f297){_0xac7010=_0x56f297;_0x45fa1d[_0x057d('0x31')]=_[_0x057d('0x33')](db[_0x057d('0x4c')][_0x057d('0x2d')]);_0x45fa1d[_0x057d('0x32')]=_[_0x057d('0x33')](_0x2ef2e7['query']);_0x45fa1d[_0x057d('0x34')]=_['intersection'](_0x45fa1d[_0x057d('0x31')],_0x45fa1d['query']);_0x1bdb9c[_0x057d('0x36')]=_[_0x057d('0x35')](_0x45fa1d['model'],qs[_0x057d('0x37')](_0x2ef2e7[_0x057d('0x32')]['fields']));_0x1bdb9c[_0x057d('0x36')]=_0x1bdb9c['attributes']['length']?_0x1bdb9c[_0x057d('0x36')]:_0x45fa1d[_0x057d('0x31')];_0x1bdb9c[_0x057d('0x39')]=qs[_0x057d('0x3a')](_0x2ef2e7[_0x057d('0x32')][_0x057d('0x3a')]);_0x1bdb9c[_0x057d('0x3b')]=qs[_0x057d('0x34')](_[_0x057d('0x3c')](_0x2ef2e7[_0x057d('0x32')],_0x45fa1d[_0x057d('0x34')]));if(_0x2ef2e7[_0x057d('0x32')][_0x057d('0x3f')]){_0x1bdb9c[_0x057d('0x3b')]=_['merge'](_0x1bdb9c[_0x057d('0x3b')],{'$or':_[_0x057d('0x2c')](_0x1bdb9c['attributes'],function(_0x43d95b){var _0x4004a6={};_0x4004a6[_0x43d95b]={'$like':'%'+_0x2ef2e7[_0x057d('0x32')][_0x057d('0x3f')]+'%'};return _0x4004a6;})});}_0x1bdb9c=_[_0x057d('0x3d')]({},_0x1bdb9c,_0x2ef2e7[_0x057d('0x40')]);return _0xac7010[_0x057d('0x4a')](_0x1bdb9c);}})[_0x057d('0x27')](function(_0x533c3c){if(_0x533c3c){_0xe3c865=_0x533c3c[_0x057d('0x4d')];if(!_0x2ef2e7['query']['hasOwnProperty'](_0x057d('0x4e'))){_0x1bdb9c[_0x057d('0x1f')]=qs['limit'](_0x2ef2e7['query'][_0x057d('0x1f')]);_0x1bdb9c['offset']=qs[_0x057d('0x21')](_0x2ef2e7[_0x057d('0x32')]['offset']);}return _0xac7010['getFields'](_0x1bdb9c);}})[_0x057d('0x27')](function(_0x3b7fea){if(_0x3b7fea){return _0x3b7fea?{'count':_0xe3c865,'rows':_0x3b7fea}:null;}})[_0x057d('0x27')](respondWithResult(_0x275952,null))[_0x057d('0x45')](handleError(_0x275952,null));};exports[_0x057d('0x4f')]=function(_0x4f85d4,_0x6687b0,_0x20afec){var _0x415c7a={};var _0x2a168b={};var _0x6b40d5;var _0x2077fd;return db[_0x057d('0x41')][_0x057d('0x4b')]({'where':{'id':_0x4f85d4[_0x057d('0x49')]['id']}})[_0x057d('0x27')](handleEntityNotFound(_0x6687b0,null))[_0x057d('0x27')](function(_0x387c14){if(_0x387c14){_0x6b40d5=_0x387c14;_0x2a168b[_0x057d('0x31')]=_['keys'](db[_0x057d('0x4c')][_0x057d('0x2d')]);_0x2a168b[_0x057d('0x32')]=_['keys'](_0x4f85d4[_0x057d('0x32')]);_0x2a168b[_0x057d('0x34')]=_[_0x057d('0x35')](_0x2a168b[_0x057d('0x31')],_0x2a168b['query']);_0x415c7a['attributes']=_[_0x057d('0x35')](_0x2a168b[_0x057d('0x31')],qs['fields'](_0x4f85d4[_0x057d('0x32')][_0x057d('0x37')]));_0x415c7a[_0x057d('0x36')]=_0x415c7a[_0x057d('0x36')][_0x057d('0x4d')]?_0x415c7a['attributes']:_0x2a168b[_0x057d('0x31')];_0x415c7a[_0x057d('0x39')]=qs[_0x057d('0x3a')](_0x4f85d4[_0x057d('0x32')]['sort']);_0x415c7a['where']=qs[_0x057d('0x34')](_[_0x057d('0x3c')](_0x4f85d4[_0x057d('0x32')],_0x2a168b[_0x057d('0x34')]));if(_0x4f85d4[_0x057d('0x32')][_0x057d('0x3f')]){_0x415c7a[_0x057d('0x3b')]=_[_0x057d('0x3d')](_0x415c7a[_0x057d('0x3b')],{'$or':_[_0x057d('0x2c')](_0x415c7a[_0x057d('0x36')],function(_0x4975b6){var _0x10bc9b={};_0x10bc9b[_0x4975b6]={'$like':'%'+_0x4f85d4[_0x057d('0x32')][_0x057d('0x3f')]+'%'};return _0x10bc9b;})});}_0x415c7a=_['merge']({},_0x415c7a,_0x4f85d4[_0x057d('0x40')]);return _0x6b40d5[_0x057d('0x4f')](_0x415c7a);}})['then'](function(_0x118acf){if(_0x118acf){_0x2077fd=_0x118acf['length'];if(!_0x4f85d4[_0x057d('0x32')]['hasOwnProperty'](_0x057d('0x4e'))){_0x415c7a['limit']=qs[_0x057d('0x1f')](_0x4f85d4[_0x057d('0x32')][_0x057d('0x1f')]);_0x415c7a[_0x057d('0x21')]=qs['offset'](_0x4f85d4[_0x057d('0x32')][_0x057d('0x21')]);}return _0x6b40d5[_0x057d('0x4f')](_0x415c7a);}})[_0x057d('0x27')](function(_0x127956){if(_0x127956){return _0x127956?{'count':_0x2077fd,'rows':_0x127956}:null;}})['then'](respondWithResult(_0x6687b0,null))[_0x057d('0x45')](handleError(_0x6687b0,null));};exports[_0x057d('0x50')]=function(_0x24ceb8,_0x3bc09f,_0x4a5df4){var _0x246784={};var _0x16b496={};var _0x53525b;var _0x418aff;return db[_0x057d('0x41')][_0x057d('0x4b')]({'where':{'id':_0x24ceb8[_0x057d('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bc09f,null))[_0x057d('0x27')](function(_0x330028){if(_0x330028){_0x53525b=_0x330028;_0x16b496[_0x057d('0x31')]=_['keys'](db[_0x057d('0x4c')][_0x057d('0x2d')]);_0x16b496['query']=_[_0x057d('0x33')](_0x24ceb8[_0x057d('0x32')]);_0x16b496['filters']=_[_0x057d('0x35')](_0x16b496[_0x057d('0x31')],_0x16b496[_0x057d('0x32')]);_0x246784[_0x057d('0x36')]=_[_0x057d('0x35')](_0x16b496['model'],qs[_0x057d('0x37')](_0x24ceb8[_0x057d('0x32')]['fields']));_0x246784[_0x057d('0x36')]=_0x246784[_0x057d('0x36')]['length']?_0x246784[_0x057d('0x36')]:_0x16b496[_0x057d('0x31')];_0x246784[_0x057d('0x39')]=qs[_0x057d('0x3a')](_0x24ceb8[_0x057d('0x32')][_0x057d('0x3a')]);_0x246784[_0x057d('0x3b')]=qs['filters'](_[_0x057d('0x3c')](_0x24ceb8[_0x057d('0x32')],_0x16b496[_0x057d('0x34')]));if(_0x24ceb8['query'][_0x057d('0x3f')]){_0x246784[_0x057d('0x3b')]=_['merge'](_0x246784['where'],{'$or':_[_0x057d('0x2c')](_0x246784[_0x057d('0x36')],function(_0x9cb38d){var _0x23ada6={};_0x23ada6[_0x9cb38d]={'$like':'%'+_0x24ceb8['query'][_0x057d('0x3f')]+'%'};return _0x23ada6;})});}_0x246784=_[_0x057d('0x3d')]({},_0x246784,_0x24ceb8['options']);return _0x53525b['getDescriptions'](_0x246784);}})[_0x057d('0x27')](function(_0x4f4ceb){if(_0x4f4ceb){_0x418aff=_0x4f4ceb[_0x057d('0x4d')];if(!_0x24ceb8['query']['hasOwnProperty'](_0x057d('0x4e'))){_0x246784[_0x057d('0x1f')]=qs['limit'](_0x24ceb8['query'][_0x057d('0x1f')]);_0x246784[_0x057d('0x21')]=qs[_0x057d('0x21')](_0x24ceb8[_0x057d('0x32')][_0x057d('0x21')]);}return _0x53525b[_0x057d('0x50')](_0x246784);}})['then'](function(_0x294a96){if(_0x294a96){return _0x294a96?{'count':_0x418aff,'rows':_0x294a96}:null;}})['then'](respondWithResult(_0x3bc09f,null))[_0x057d('0x45')](handleError(_0x3bc09f,null));};exports['getTags']=function(_0x2d23e3,_0x187b13,_0x4010d0){var _0x4b758f={};var _0x275c68={};var _0x103998;var _0x354b3d;return db[_0x057d('0x41')]['findOne']({'where':{'id':_0x2d23e3[_0x057d('0x49')]['id']}})[_0x057d('0x27')](handleEntityNotFound(_0x187b13,null))['then'](function(_0x4c2602){if(_0x4c2602){_0x103998=_0x4c2602;_0x275c68[_0x057d('0x31')]=_['keys'](db[_0x057d('0x51')][_0x057d('0x2d')]);_0x275c68['query']=_['keys'](_0x2d23e3[_0x057d('0x32')]);_0x275c68['filters']=_['intersection'](_0x275c68[_0x057d('0x31')],_0x275c68[_0x057d('0x32')]);_0x4b758f[_0x057d('0x36')]=_[_0x057d('0x35')](_0x275c68['model'],qs['fields'](_0x2d23e3[_0x057d('0x32')][_0x057d('0x37')]));_0x4b758f[_0x057d('0x36')]=_0x4b758f[_0x057d('0x36')][_0x057d('0x4d')]?_0x4b758f['attributes']:_0x275c68[_0x057d('0x31')];_0x4b758f[_0x057d('0x39')]=qs['sort'](_0x2d23e3['query']['sort']);_0x4b758f[_0x057d('0x3b')]=qs['filters'](_[_0x057d('0x3c')](_0x2d23e3[_0x057d('0x32')],_0x275c68[_0x057d('0x34')]));if(_0x2d23e3[_0x057d('0x32')][_0x057d('0x3f')]){_0x4b758f[_0x057d('0x3b')]=_[_0x057d('0x3d')](_0x4b758f[_0x057d('0x3b')],{'$or':_[_0x057d('0x2c')](_0x4b758f['attributes'],function(_0x40c9a1){var _0x23913a={};_0x23913a[_0x40c9a1]={'$like':'%'+_0x2d23e3['query']['filter']+'%'};return _0x23913a;})});}_0x4b758f=_[_0x057d('0x3d')]({},_0x4b758f,_0x2d23e3[_0x057d('0x40')]);return _0x103998[_0x057d('0x52')](_0x4b758f);}})['then'](function(_0x3942f8){if(_0x3942f8){_0x354b3d=_0x3942f8['length'];if(!_0x2d23e3[_0x057d('0x32')]['hasOwnProperty'](_0x057d('0x4e'))){_0x4b758f[_0x057d('0x1f')]=qs['limit'](_0x2d23e3[_0x057d('0x32')]['limit']);_0x4b758f['offset']=qs[_0x057d('0x21')](_0x2d23e3[_0x057d('0x32')][_0x057d('0x21')]);}return _0x103998[_0x057d('0x52')](_0x4b758f);}})[_0x057d('0x27')](function(_0x391173){if(_0x391173){return _0x391173?{'count':_0x354b3d,'rows':_0x391173}:null;}})['then'](respondWithResult(_0x187b13,null))[_0x057d('0x45')](handleError(_0x187b13,null));};exports[_0x057d('0x53')]=function(_0x1cce93,_0x161057,_0x26b0f1){if(_0x1cce93[_0x057d('0x47')]['id']){delete _0x1cce93[_0x057d('0x47')]['id'];}return db['ZendeskConfiguration'][_0x057d('0x4b')]({'where':{'id':_0x1cce93['params']['id']}})[_0x057d('0x27')](handleEntityNotFound(_0x161057,null))['then'](function(_0x19fbe8){if(_0x19fbe8){return _0x19fbe8['setTags'](_0x1cce93['body'][_0x057d('0x54')]||[]);}return null;})[_0x057d('0x27')](respondWithResult(_0x161057,null))[_0x057d('0x45')](handleError(_0x161057,null));}; \ No newline at end of file +var _0x3a42=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','catch','params','rawAttributes','keys','include','merge','create','body','find','destroy','findOne','ZendeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set','reject','save','update','then','end','stack','name','index','map','ZendeskConfiguration'];(function(_0x58bfc9,_0x2f763d){var _0x33a2cf=function(_0x20b6a4){while(--_0x20b6a4){_0x58bfc9['push'](_0x58bfc9['shift']());}};_0x33a2cf(++_0x2f763d);}(_0x3a42,0x113));var _0x23a4=function(_0x324341,_0x4f23c9){_0x324341=_0x324341-0x0;var _0x451a37=_0x3a42[_0x324341];return _0x451a37;};'use strict';var emlformat=require(_0x23a4('0x0'));var rimraf=require(_0x23a4('0x1'));var zipdir=require(_0x23a4('0x2'));var jsonpatch=require(_0x23a4('0x3'));var rp=require(_0x23a4('0x4'));var moment=require(_0x23a4('0x5'));var BPromise=require(_0x23a4('0x6'));var Mustache=require('mustache');var util=require(_0x23a4('0x7'));var path=require(_0x23a4('0x8'));var sox=require('sox');var csv=require(_0x23a4('0x9'));var ejs=require(_0x23a4('0xa'));var fs=require('fs');var fs_extra=require(_0x23a4('0xb'));var _=require(_0x23a4('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x23a4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x23a4('0xe'));var Papa=require(_0x23a4('0xf'));var Redis=require(_0x23a4('0x10'));var authService=require(_0x23a4('0x11'));var qs=require(_0x23a4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23a4('0x13'));var logger=require(_0x23a4('0x14'))(_0x23a4('0x15'));var utils=require(_0x23a4('0x16'));var config=require(_0x23a4('0x17'));var licenseUtil=require(_0x23a4('0x18'));var db=require(_0x23a4('0x19'))['db'];function respondWithStatusCode(_0x48319b,_0x2e7d41){_0x2e7d41=_0x2e7d41||0xcc;return function(_0x12c4cd){if(_0x12c4cd){return _0x48319b['sendStatus'](_0x2e7d41);}return _0x48319b[_0x23a4('0x1a')](_0x2e7d41)['end']();};}function respondWithResult(_0x256f0b,_0x53645f){_0x53645f=_0x53645f||0xc8;return function(_0x3f6ea2){if(_0x3f6ea2){return _0x256f0b[_0x23a4('0x1a')](_0x53645f)[_0x23a4('0x1b')](_0x3f6ea2);}};}function respondWithFilteredResult(_0xbb8f48,_0x5b1528){return function(_0x55807f){if(_0x55807f){var _0x46ad76=typeof _0x5b1528[_0x23a4('0x1c')]==='undefined'&&typeof _0x5b1528['limit']==='undefined';var _0x45ede6=_0x55807f['count'];var _0x43d965=_0x46ad76?0x0:_0x5b1528[_0x23a4('0x1c')];var _0x99561e=_0x46ad76?_0x55807f['count']:_0x5b1528[_0x23a4('0x1c')]+_0x5b1528[_0x23a4('0x1d')];var _0x37118a;if(_0x99561e>=_0x45ede6){_0x99561e=_0x45ede6;_0x37118a=0xc8;}else{_0x37118a=0xce;}_0xbb8f48[_0x23a4('0x1a')](_0x37118a);return _0xbb8f48[_0x23a4('0x1e')]('Content-Range',_0x43d965+'-'+_0x99561e+'/'+_0x45ede6)['json'](_0x55807f);}return null;};}function patchUpdates(_0x2af109){return function(_0x5adaad){try{jsonpatch['apply'](_0x5adaad,_0x2af109,!![]);}catch(_0x573a61){return BPromise[_0x23a4('0x1f')](_0x573a61);}return _0x5adaad[_0x23a4('0x20')]();};}function saveUpdates(_0x21b168,_0x395fa2){return function(_0x5ba843){if(_0x5ba843){return _0x5ba843[_0x23a4('0x21')](_0x21b168)[_0x23a4('0x22')](function(_0x3f00d1){return _0x3f00d1;});}return null;};}function removeEntity(_0xa7a47c,_0x35fd31){return function(_0x34cd64){if(_0x34cd64){return _0x34cd64['destroy']()['then'](function(){_0xa7a47c[_0x23a4('0x1a')](0xcc)[_0x23a4('0x23')]();});}};}function handleEntityNotFound(_0x552b19,_0x26c94){return function(_0x442cd9){if(!_0x442cd9){_0x552b19['sendStatus'](0x194);}return _0x442cd9;};}function handleError(_0x1cc527,_0x16fcc6){_0x16fcc6=_0x16fcc6||0x1f4;return function(_0x4025f5){logger['error'](_0x4025f5[_0x23a4('0x24')]);if(_0x4025f5[_0x23a4('0x25')]){delete _0x4025f5[_0x23a4('0x25')];}_0x1cc527['status'](_0x16fcc6)['send'](_0x4025f5);};}exports[_0x23a4('0x26')]=function(_0x5eb177,_0x391642){var _0x2700da={},_0x26b075={},_0xa88d2b={'count':0x0,'rows':[]};var _0x5e0041=_[_0x23a4('0x27')](db[_0x23a4('0x28')]['rawAttributes'],function(_0x5cab5c){return{'name':_0x5cab5c['fieldName'],'type':_0x5cab5c[_0x23a4('0x29')]['key']};});_0x26b075[_0x23a4('0x2a')]=_[_0x23a4('0x27')](_0x5e0041,'name');_0x26b075['query']=_['keys'](_0x5eb177[_0x23a4('0x2b')]);_0x26b075[_0x23a4('0x2c')]=_[_0x23a4('0x2d')](_0x26b075[_0x23a4('0x2a')],_0x26b075[_0x23a4('0x2b')]);_0x2700da[_0x23a4('0x2e')]=_['intersection'](_0x26b075[_0x23a4('0x2a')],qs[_0x23a4('0x2f')](_0x5eb177[_0x23a4('0x2b')][_0x23a4('0x2f')]));_0x2700da[_0x23a4('0x2e')]=_0x2700da[_0x23a4('0x2e')][_0x23a4('0x30')]?_0x2700da[_0x23a4('0x2e')]:_0x26b075['model'];if(!_0x5eb177[_0x23a4('0x2b')][_0x23a4('0x31')](_0x23a4('0x32'))){_0x2700da[_0x23a4('0x1d')]=qs[_0x23a4('0x1d')](_0x5eb177[_0x23a4('0x2b')][_0x23a4('0x1d')]);_0x2700da['offset']=qs[_0x23a4('0x1c')](_0x5eb177[_0x23a4('0x2b')][_0x23a4('0x1c')]);}_0x2700da[_0x23a4('0x33')]=qs[_0x23a4('0x34')](_0x5eb177['query'][_0x23a4('0x34')]);_0x2700da[_0x23a4('0x35')]=qs[_0x23a4('0x2c')](_[_0x23a4('0x36')](_0x5eb177[_0x23a4('0x2b')],_0x26b075[_0x23a4('0x2c')]),_0x5e0041);if(_0x5eb177[_0x23a4('0x2b')][_0x23a4('0x37')]){_0x2700da[_0x23a4('0x35')]=_['merge'](_0x2700da[_0x23a4('0x35')],{'$or':_[_0x23a4('0x27')](_0x5e0041,function(_0xc0b2d5){if(_0xc0b2d5['type']!==_0x23a4('0x38')){var _0x8b1b3f={};_0x8b1b3f[_0xc0b2d5['name']]={'$like':'%'+_0x5eb177[_0x23a4('0x2b')][_0x23a4('0x37')]+'%'};return _0x8b1b3f;}})});}_0x2700da=_['merge']({},_0x2700da,_0x5eb177[_0x23a4('0x39')]);var _0x2f07e2={'where':_0x2700da[_0x23a4('0x35')]};return db[_0x23a4('0x28')][_0x23a4('0x3a')](_0x2f07e2)[_0x23a4('0x22')](function(_0x30c9fc){_0xa88d2b[_0x23a4('0x3a')]=_0x30c9fc;if(_0x5eb177[_0x23a4('0x2b')][_0x23a4('0x3b')]){_0x2700da['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x23a4('0x3c')](_0x2700da);})['then'](function(_0x34ad18){_0xa88d2b['rows']=_0x34ad18;return _0xa88d2b;})[_0x23a4('0x22')](respondWithFilteredResult(_0x391642,_0x2700da))[_0x23a4('0x3d')](handleError(_0x391642,null));};exports['show']=function(_0x468bf6,_0x1dc5ee){var _0x5cdaa7={'raw':![],'where':{'id':_0x468bf6[_0x23a4('0x3e')]['id']}},_0x5108b6={};_0x5108b6['model']=_['keys'](db[_0x23a4('0x28')][_0x23a4('0x3f')]);_0x5108b6['query']=_[_0x23a4('0x40')](_0x468bf6['query']);_0x5108b6[_0x23a4('0x2c')]=_['intersection'](_0x5108b6[_0x23a4('0x2a')],_0x5108b6['query']);_0x5cdaa7[_0x23a4('0x2e')]=_[_0x23a4('0x2d')](_0x5108b6[_0x23a4('0x2a')],qs['fields'](_0x468bf6['query'][_0x23a4('0x2f')]));_0x5cdaa7[_0x23a4('0x2e')]=_0x5cdaa7[_0x23a4('0x2e')]['length']?_0x5cdaa7[_0x23a4('0x2e')]:_0x5108b6[_0x23a4('0x2a')];if(_0x468bf6[_0x23a4('0x2b')]['includeAll']){_0x5cdaa7[_0x23a4('0x41')]=[{'all':!![]}];}_0x5cdaa7=_[_0x23a4('0x42')]({},_0x5cdaa7,_0x468bf6[_0x23a4('0x39')]);return db[_0x23a4('0x28')]['find'](_0x5cdaa7)[_0x23a4('0x22')](handleEntityNotFound(_0x1dc5ee,null))[_0x23a4('0x22')](respondWithResult(_0x1dc5ee,null))[_0x23a4('0x3d')](handleError(_0x1dc5ee,null));};exports[_0x23a4('0x43')]=function(_0x5b0750,_0x41fc84){return db[_0x23a4('0x28')][_0x23a4('0x43')](_0x5b0750[_0x23a4('0x44')],{})[_0x23a4('0x22')](respondWithResult(_0x41fc84,0xc9))['catch'](handleError(_0x41fc84,null));};exports['update']=function(_0xa3a2da,_0x3962f1){if(_0xa3a2da[_0x23a4('0x44')]['id']){delete _0xa3a2da[_0x23a4('0x44')]['id'];}return db[_0x23a4('0x28')][_0x23a4('0x45')]({'where':{'id':_0xa3a2da[_0x23a4('0x3e')]['id']}})[_0x23a4('0x22')](handleEntityNotFound(_0x3962f1,null))[_0x23a4('0x22')](saveUpdates(_0xa3a2da[_0x23a4('0x44')],null))[_0x23a4('0x22')](respondWithResult(_0x3962f1,null))[_0x23a4('0x3d')](handleError(_0x3962f1,null));};exports[_0x23a4('0x46')]=function(_0x34c76f,_0x43f746){return db['ZendeskConfiguration'][_0x23a4('0x45')]({'where':{'id':_0x34c76f[_0x23a4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x43f746,null))[_0x23a4('0x22')](removeEntity(_0x43f746,null))[_0x23a4('0x3d')](handleError(_0x43f746,null));};exports['getFields']=function(_0x417c65,_0x964618,_0x4e6925){var _0x836078={};var _0x2ad636={};var _0xf056f8;var _0x3c2997;return db[_0x23a4('0x28')][_0x23a4('0x47')]({'where':{'id':_0x417c65['params']['id']}})['then'](handleEntityNotFound(_0x964618,null))[_0x23a4('0x22')](function(_0xfddfdd){if(_0xfddfdd){_0xf056f8=_0xfddfdd;_0x2ad636[_0x23a4('0x2a')]=_[_0x23a4('0x40')](db[_0x23a4('0x48')][_0x23a4('0x3f')]);_0x2ad636[_0x23a4('0x2b')]=_[_0x23a4('0x40')](_0x417c65['query']);_0x2ad636[_0x23a4('0x2c')]=_[_0x23a4('0x2d')](_0x2ad636[_0x23a4('0x2a')],_0x2ad636[_0x23a4('0x2b')]);_0x836078['attributes']=_[_0x23a4('0x2d')](_0x2ad636[_0x23a4('0x2a')],qs[_0x23a4('0x2f')](_0x417c65[_0x23a4('0x2b')][_0x23a4('0x2f')]));_0x836078[_0x23a4('0x2e')]=_0x836078[_0x23a4('0x2e')][_0x23a4('0x30')]?_0x836078[_0x23a4('0x2e')]:_0x2ad636[_0x23a4('0x2a')];_0x836078['order']=qs[_0x23a4('0x34')](_0x417c65[_0x23a4('0x2b')][_0x23a4('0x34')]);_0x836078[_0x23a4('0x35')]=qs['filters'](_['pick'](_0x417c65['query'],_0x2ad636[_0x23a4('0x2c')]));if(_0x417c65['query'][_0x23a4('0x37')]){_0x836078[_0x23a4('0x35')]=_[_0x23a4('0x42')](_0x836078[_0x23a4('0x35')],{'$or':_['map'](_0x836078[_0x23a4('0x2e')],function(_0x3ab842){var _0x5f3e8a={};_0x5f3e8a[_0x3ab842]={'$like':'%'+_0x417c65[_0x23a4('0x2b')][_0x23a4('0x37')]+'%'};return _0x5f3e8a;})});}_0x836078=_[_0x23a4('0x42')]({},_0x836078,_0x417c65[_0x23a4('0x39')]);return _0xf056f8[_0x23a4('0x49')](_0x836078);}})[_0x23a4('0x22')](function(_0x2048e1){if(_0x2048e1){_0x3c2997=_0x2048e1[_0x23a4('0x30')];if(!_0x417c65[_0x23a4('0x2b')][_0x23a4('0x31')]('nolimit')){_0x836078['limit']=qs['limit'](_0x417c65[_0x23a4('0x2b')][_0x23a4('0x1d')]);_0x836078[_0x23a4('0x1c')]=qs[_0x23a4('0x1c')](_0x417c65[_0x23a4('0x2b')][_0x23a4('0x1c')]);}return _0xf056f8['getFields'](_0x836078);}})[_0x23a4('0x22')](function(_0x4fc379){if(_0x4fc379){return _0x4fc379?{'count':_0x3c2997,'rows':_0x4fc379}:null;}})[_0x23a4('0x22')](respondWithResult(_0x964618,null))[_0x23a4('0x3d')](handleError(_0x964618,null));};exports[_0x23a4('0x4a')]=function(_0x395117,_0x545b56,_0x1f321d){var _0x43a733={};var _0x1ef860={};var _0x138d0d;var _0x237e38;return db[_0x23a4('0x28')][_0x23a4('0x47')]({'where':{'id':_0x395117['params']['id']}})[_0x23a4('0x22')](handleEntityNotFound(_0x545b56,null))[_0x23a4('0x22')](function(_0x307bf9){if(_0x307bf9){_0x138d0d=_0x307bf9;_0x1ef860['model']=_[_0x23a4('0x40')](db[_0x23a4('0x48')][_0x23a4('0x3f')]);_0x1ef860['query']=_[_0x23a4('0x40')](_0x395117[_0x23a4('0x2b')]);_0x1ef860[_0x23a4('0x2c')]=_[_0x23a4('0x2d')](_0x1ef860['model'],_0x1ef860['query']);_0x43a733['attributes']=_[_0x23a4('0x2d')](_0x1ef860[_0x23a4('0x2a')],qs[_0x23a4('0x2f')](_0x395117['query'][_0x23a4('0x2f')]));_0x43a733['attributes']=_0x43a733[_0x23a4('0x2e')]['length']?_0x43a733[_0x23a4('0x2e')]:_0x1ef860[_0x23a4('0x2a')];_0x43a733[_0x23a4('0x33')]=qs[_0x23a4('0x34')](_0x395117[_0x23a4('0x2b')]['sort']);_0x43a733[_0x23a4('0x35')]=qs['filters'](_[_0x23a4('0x36')](_0x395117[_0x23a4('0x2b')],_0x1ef860[_0x23a4('0x2c')]));if(_0x395117['query'][_0x23a4('0x37')]){_0x43a733[_0x23a4('0x35')]=_[_0x23a4('0x42')](_0x43a733['where'],{'$or':_['map'](_0x43a733[_0x23a4('0x2e')],function(_0x840447){var _0x147c6f={};_0x147c6f[_0x840447]={'$like':'%'+_0x395117['query'][_0x23a4('0x37')]+'%'};return _0x147c6f;})});}_0x43a733=_['merge']({},_0x43a733,_0x395117[_0x23a4('0x39')]);return _0x138d0d[_0x23a4('0x4a')](_0x43a733);}})['then'](function(_0x3a241e){if(_0x3a241e){_0x237e38=_0x3a241e[_0x23a4('0x30')];if(!_0x395117[_0x23a4('0x2b')][_0x23a4('0x31')](_0x23a4('0x32'))){_0x43a733[_0x23a4('0x1d')]=qs[_0x23a4('0x1d')](_0x395117[_0x23a4('0x2b')][_0x23a4('0x1d')]);_0x43a733[_0x23a4('0x1c')]=qs['offset'](_0x395117['query'][_0x23a4('0x1c')]);}return _0x138d0d[_0x23a4('0x4a')](_0x43a733);}})[_0x23a4('0x22')](function(_0x4da72f){if(_0x4da72f){return _0x4da72f?{'count':_0x237e38,'rows':_0x4da72f}:null;}})[_0x23a4('0x22')](respondWithResult(_0x545b56,null))[_0x23a4('0x3d')](handleError(_0x545b56,null));};exports[_0x23a4('0x4b')]=function(_0x1bb20e,_0xb4b41,_0x246a40){var _0x30fe9f={};var _0x2d6b6a={};var _0x265136;var _0x2ddf6a;return db['ZendeskConfiguration'][_0x23a4('0x47')]({'where':{'id':_0x1bb20e['params']['id']}})[_0x23a4('0x22')](handleEntityNotFound(_0xb4b41,null))[_0x23a4('0x22')](function(_0x3e7400){if(_0x3e7400){_0x265136=_0x3e7400;_0x2d6b6a[_0x23a4('0x2a')]=_[_0x23a4('0x40')](db[_0x23a4('0x48')]['rawAttributes']);_0x2d6b6a[_0x23a4('0x2b')]=_['keys'](_0x1bb20e[_0x23a4('0x2b')]);_0x2d6b6a[_0x23a4('0x2c')]=_['intersection'](_0x2d6b6a['model'],_0x2d6b6a[_0x23a4('0x2b')]);_0x30fe9f[_0x23a4('0x2e')]=_[_0x23a4('0x2d')](_0x2d6b6a['model'],qs['fields'](_0x1bb20e[_0x23a4('0x2b')][_0x23a4('0x2f')]));_0x30fe9f[_0x23a4('0x2e')]=_0x30fe9f[_0x23a4('0x2e')][_0x23a4('0x30')]?_0x30fe9f[_0x23a4('0x2e')]:_0x2d6b6a[_0x23a4('0x2a')];_0x30fe9f['order']=qs['sort'](_0x1bb20e[_0x23a4('0x2b')][_0x23a4('0x34')]);_0x30fe9f['where']=qs['filters'](_['pick'](_0x1bb20e[_0x23a4('0x2b')],_0x2d6b6a['filters']));if(_0x1bb20e[_0x23a4('0x2b')][_0x23a4('0x37')]){_0x30fe9f['where']=_[_0x23a4('0x42')](_0x30fe9f[_0x23a4('0x35')],{'$or':_[_0x23a4('0x27')](_0x30fe9f[_0x23a4('0x2e')],function(_0xc8a81d){var _0x28a82f={};_0x28a82f[_0xc8a81d]={'$like':'%'+_0x1bb20e[_0x23a4('0x2b')][_0x23a4('0x37')]+'%'};return _0x28a82f;})});}_0x30fe9f=_[_0x23a4('0x42')]({},_0x30fe9f,_0x1bb20e[_0x23a4('0x39')]);return _0x265136['getDescriptions'](_0x30fe9f);}})[_0x23a4('0x22')](function(_0x2ec728){if(_0x2ec728){_0x2ddf6a=_0x2ec728[_0x23a4('0x30')];if(!_0x1bb20e[_0x23a4('0x2b')][_0x23a4('0x31')]('nolimit')){_0x30fe9f[_0x23a4('0x1d')]=qs[_0x23a4('0x1d')](_0x1bb20e[_0x23a4('0x2b')]['limit']);_0x30fe9f[_0x23a4('0x1c')]=qs[_0x23a4('0x1c')](_0x1bb20e[_0x23a4('0x2b')][_0x23a4('0x1c')]);}return _0x265136['getDescriptions'](_0x30fe9f);}})[_0x23a4('0x22')](function(_0x3e3c0d){if(_0x3e3c0d){return _0x3e3c0d?{'count':_0x2ddf6a,'rows':_0x3e3c0d}:null;}})[_0x23a4('0x22')](respondWithResult(_0xb4b41,null))[_0x23a4('0x3d')](handleError(_0xb4b41,null));};exports[_0x23a4('0x4c')]=function(_0xe0a4cd,_0x1fdcfe,_0x3b7265){var _0x1f12f8={};var _0x2763bb={};var _0xbcd692;var _0x587882;return db[_0x23a4('0x28')][_0x23a4('0x47')]({'where':{'id':_0xe0a4cd['params']['id']}})[_0x23a4('0x22')](handleEntityNotFound(_0x1fdcfe,null))[_0x23a4('0x22')](function(_0xcac1b6){if(_0xcac1b6){_0xbcd692=_0xcac1b6;_0x2763bb[_0x23a4('0x2a')]=_['keys'](db[_0x23a4('0x4d')][_0x23a4('0x3f')]);_0x2763bb[_0x23a4('0x2b')]=_['keys'](_0xe0a4cd[_0x23a4('0x2b')]);_0x2763bb[_0x23a4('0x2c')]=_[_0x23a4('0x2d')](_0x2763bb[_0x23a4('0x2a')],_0x2763bb[_0x23a4('0x2b')]);_0x1f12f8['attributes']=_['intersection'](_0x2763bb[_0x23a4('0x2a')],qs['fields'](_0xe0a4cd[_0x23a4('0x2b')][_0x23a4('0x2f')]));_0x1f12f8[_0x23a4('0x2e')]=_0x1f12f8['attributes'][_0x23a4('0x30')]?_0x1f12f8[_0x23a4('0x2e')]:_0x2763bb[_0x23a4('0x2a')];_0x1f12f8['order']=qs[_0x23a4('0x34')](_0xe0a4cd[_0x23a4('0x2b')][_0x23a4('0x34')]);_0x1f12f8[_0x23a4('0x35')]=qs[_0x23a4('0x2c')](_['pick'](_0xe0a4cd[_0x23a4('0x2b')],_0x2763bb[_0x23a4('0x2c')]));if(_0xe0a4cd['query']['filter']){_0x1f12f8[_0x23a4('0x35')]=_[_0x23a4('0x42')](_0x1f12f8[_0x23a4('0x35')],{'$or':_[_0x23a4('0x27')](_0x1f12f8[_0x23a4('0x2e')],function(_0x57b1fc){var _0x5a3c24={};_0x5a3c24[_0x57b1fc]={'$like':'%'+_0xe0a4cd['query'][_0x23a4('0x37')]+'%'};return _0x5a3c24;})});}_0x1f12f8=_[_0x23a4('0x42')]({},_0x1f12f8,_0xe0a4cd[_0x23a4('0x39')]);return _0xbcd692['getTags'](_0x1f12f8);}})[_0x23a4('0x22')](function(_0x2fd006){if(_0x2fd006){_0x587882=_0x2fd006[_0x23a4('0x30')];if(!_0xe0a4cd['query'][_0x23a4('0x31')]('nolimit')){_0x1f12f8[_0x23a4('0x1d')]=qs['limit'](_0xe0a4cd[_0x23a4('0x2b')][_0x23a4('0x1d')]);_0x1f12f8['offset']=qs['offset'](_0xe0a4cd[_0x23a4('0x2b')]['offset']);}return _0xbcd692['getTags'](_0x1f12f8);}})[_0x23a4('0x22')](function(_0x46dfd1){if(_0x46dfd1){return _0x46dfd1?{'count':_0x587882,'rows':_0x46dfd1}:null;}})[_0x23a4('0x22')](respondWithResult(_0x1fdcfe,null))[_0x23a4('0x3d')](handleError(_0x1fdcfe,null));};exports['setTags']=function(_0x504d43,_0x365639,_0x13ef2b){if(_0x504d43[_0x23a4('0x44')]['id']){delete _0x504d43['body']['id'];}return db[_0x23a4('0x28')][_0x23a4('0x47')]({'where':{'id':_0x504d43[_0x23a4('0x3e')]['id']}})[_0x23a4('0x22')](handleEntityNotFound(_0x365639,null))[_0x23a4('0x22')](function(_0x516897){if(_0x516897){return _0x516897[_0x23a4('0x4e')](_0x504d43[_0x23a4('0x44')]['ids']||[]);}return null;})[_0x23a4('0x22')](respondWithResult(_0x365639,null))['catch'](handleError(_0x365639,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 7f66cce..f859ac3 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 _0x7916=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','ZendeskConfiguration','lodash'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x7916,0x128));var _0x6791=function(_0x4f733d,_0x273d4f){_0x4f733d=_0x4f733d-0x0;var _0x11e1e1=_0x7916[_0x4f733d];return _0x11e1e1;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0972=['util','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0972,0x64));var _0x2097=function(_0x4cdd9d,_0x1366fc){_0x4cdd9d=_0x4cdd9d-0x0;var _0x4d9969=_0x0972[_0x4cdd9d];return _0x4d9969;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x2097('0x9'),'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 f2c4bbd..ac87577 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 _0x5b06=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0xc3ce34,_0x7f9428){var _0x42501e=function(_0x2058a4){while(--_0x2058a4){_0xc3ce34['push'](_0xc3ce34['shift']());}};_0x42501e(++_0x7f9428);}(_0x5b06,0xf1));var _0x65b0=function(_0x4a27a6,_0x2f8f8e){_0x4a27a6=_0x4a27a6-0x0;var _0x351568=_0x5b06[_0x4a27a6];return _0x351568;};'use strict';var _=require(_0x65b0('0x0'));var util=require('util');var moment=require(_0x65b0('0x1'));var BPromise=require(_0x65b0('0x2'));var rs=require(_0x65b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65b0('0x5'))('rpc');var config=require(_0x65b0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65b0('0x7')][_0x65b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6946c7,_0x8f89a4,_0x14c33){return new BPromise(function(_0x25364a,_0x44300f){return client[_0x65b0('0x9')](_0x6946c7,_0x14c33)['then'](function(_0x7d1a82){logger['info'](_0x65b0('0xa'),_0x8f89a4,_0x65b0('0xb'));logger[_0x65b0('0xc')](_0x65b0('0xd'),_0x8f89a4,'request\x20sent',JSON[_0x65b0('0xe')](_0x7d1a82));if(_0x7d1a82[_0x65b0('0xf')]){if(_0x7d1a82[_0x65b0('0xf')][_0x65b0('0x10')]===0x1f4){logger[_0x65b0('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x8f89a4,_0x7d1a82[_0x65b0('0xf')]['message']);return _0x44300f(_0x7d1a82[_0x65b0('0xf')][_0x65b0('0x11')]);}logger[_0x65b0('0xf')](_0x65b0('0xa'),_0x8f89a4,_0x7d1a82[_0x65b0('0xf')][_0x65b0('0x11')]);return _0x25364a(_0x7d1a82[_0x65b0('0xf')][_0x65b0('0x11')]);}else{logger[_0x65b0('0x12')](_0x65b0('0xa'),_0x8f89a4,'request\x20sent');_0x25364a(_0x7d1a82[_0x65b0('0x13')][_0x65b0('0x11')]);}})[_0x65b0('0x14')](function(_0x2a0db4){logger['error'](_0x65b0('0xa'),_0x8f89a4,_0x2a0db4);_0x44300f(_0x2a0db4);});});} \ No newline at end of file +var _0xf1a9=['debug','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf1a9,0x16d));var _0x9f1a=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xf1a9[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x9f1a('0x0'));var util=require('util');var moment=require(_0x9f1a('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f1a('0x2'));var fs=require('fs');var Redis=require(_0x9f1a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f1a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f1a('0x5'));var client=jayson[_0x9f1a('0x6')][_0x9f1a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x239209,_0x5ab10f,_0x591696){return new BPromise(function(_0x734dfa,_0x15ffee){return client['request'](_0x239209,_0x591696)['then'](function(_0x3d3496){logger['info'](_0x9f1a('0x8'),_0x5ab10f,'request\x20sent');logger[_0x9f1a('0x9')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5ab10f,'request\x20sent',JSON[_0x9f1a('0xa')](_0x3d3496));if(_0x3d3496['error']){if(_0x3d3496[_0x9f1a('0xb')][_0x9f1a('0xc')]===0x1f4){logger[_0x9f1a('0xb')](_0x9f1a('0x8'),_0x5ab10f,_0x3d3496[_0x9f1a('0xb')][_0x9f1a('0xd')]);return _0x15ffee(_0x3d3496[_0x9f1a('0xb')][_0x9f1a('0xd')]);}logger[_0x9f1a('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5ab10f,_0x3d3496['error'][_0x9f1a('0xd')]);return _0x734dfa(_0x3d3496[_0x9f1a('0xb')]['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x5ab10f,_0x9f1a('0xe'));_0x734dfa(_0x3d3496[_0x9f1a('0xf')][_0x9f1a('0xd')]);}})[_0x9f1a('0x10')](function(_0x345cdd){logger[_0x9f1a('0xb')](_0x9f1a('0x8'),_0x5ab10f,_0x345cdd);_0x15ffee(_0x345cdd);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 570307c..c77d0ce 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 _0xc195=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x2598b3,_0x1cc0a8){var _0x55607f=function(_0x3b37fd){while(--_0x3b37fd){_0x2598b3['push'](_0x2598b3['shift']());}};_0x55607f(++_0x1cc0a8);}(_0xc195,0x11f));var _0x5c19=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xc195[_0x384231];return _0x2480bf;};'use strict';var multer=require(_0x5c19('0x0'));var util=require(_0x5c19('0x1'));var path=require(_0x5c19('0x2'));var timeout=require(_0x5c19('0x3'));var express=require(_0x5c19('0x4'));var router=express[_0x5c19('0x5')]();var fs_extra=require(_0x5c19('0x6'));var auth=require(_0x5c19('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c19('0x8'));router[_0x5c19('0x9')]('/',auth[_0x5c19('0xa')](),controller[_0x5c19('0xb')]);router[_0x5c19('0x9')](_0x5c19('0xc'),auth[_0x5c19('0xa')](),controller[_0x5c19('0xd')]);router[_0x5c19('0xe')]('/',auth['isAuthenticated'](),controller[_0x5c19('0xf')]);router[_0x5c19('0x10')](_0x5c19('0xc'),auth['isAuthenticated'](),controller[_0x5c19('0x11')]);router[_0x5c19('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5c19('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2554=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5bf8de,_0x5ef5cc){var _0x47160c=function(_0x246033){while(--_0x246033){_0x5bf8de['push'](_0x5bf8de['shift']());}};_0x47160c(++_0x5ef5cc);}(_0x2554,0x10f));var _0x4255=function(_0x218d2c,_0x125c8f){_0x218d2c=_0x218d2c-0x0;var _0x5af8e7=_0x2554[_0x218d2c];return _0x5af8e7;};'use strict';var multer=require('multer');var util=require(_0x4255('0x0'));var path=require(_0x4255('0x1'));var timeout=require(_0x4255('0x2'));var express=require(_0x4255('0x3'));var router=express[_0x4255('0x4')]();var fs_extra=require(_0x4255('0x5'));var auth=require(_0x4255('0x6'));var interaction=require(_0x4255('0x7'));var config=require(_0x4255('0x8'));var controller=require(_0x4255('0x9'));router[_0x4255('0xa')]('/',auth[_0x4255('0xb')](),controller[_0x4255('0xc')]);router[_0x4255('0xa')](_0x4255('0xd'),auth[_0x4255('0xb')](),controller[_0x4255('0xe')]);router[_0x4255('0xf')]('/',auth[_0x4255('0xb')](),controller[_0x4255('0x10')]);router[_0x4255('0x11')](_0x4255('0xd'),auth['isAuthenticated'](),controller[_0x4255('0x12')]);router[_0x4255('0x13')]('/:id',auth[_0x4255('0xb')](),controller[_0x4255('0x14')]);module[_0x4255('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ae48722..4cb42ce 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 _0x003d=['sequelize','ENUM','customVariable','keyValue','picklist','string','STRING','variable'];(function(_0x24d5c3,_0x32aca8){var _0x201c1f=function(_0x3c3d90){while(--_0x3c3d90){_0x24d5c3['push'](_0x24d5c3['shift']());}};_0x201c1f(++_0x32aca8);}(_0x003d,0x168));var _0xd003=function(_0x3d7457,_0x174c83){_0x3d7457=_0x3d7457-0x0;var _0xffad8c=_0x003d[_0x3d7457];return _0xffad8c;};'use strict';var Sequelize=require(_0xd003('0x0'));module['exports']={'type':{'type':Sequelize[_0xd003('0x1')]('string','variable',_0xd003('0x2'),_0xd003('0x3'),_0xd003('0x4')),'defaultValue':_0xd003('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd003('0x6')]},'keyType':{'type':Sequelize[_0xd003('0x1')](_0xd003('0x5'),_0xd003('0x7'),_0xd003('0x2'))},'keyContent':{'type':Sequelize[_0xd003('0x6')]},'idField':{'type':Sequelize[_0xd003('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd003('0x6')]}}; \ No newline at end of file +var _0xd06c=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x89ba8,_0x31f8bc){var _0x34eaca=function(_0x1d787b){while(--_0x1d787b){_0x89ba8['push'](_0x89ba8['shift']());}};_0x34eaca(++_0x31f8bc);}(_0xd06c,0x1e5));var _0xcd06=function(_0x426f93,_0x30a4e0){_0x426f93=_0x426f93-0x0;var _0xaa81ff=_0xd06c[_0x426f93];return _0xaa81ff;};'use strict';var Sequelize=require(_0xcd06('0x0'));module[_0xcd06('0x1')]={'type':{'type':Sequelize[_0xcd06('0x2')](_0xcd06('0x3'),_0xcd06('0x4'),_0xcd06('0x5'),_0xcd06('0x6'),_0xcd06('0x7')),'defaultValue':_0xcd06('0x3')},'content':{'type':Sequelize[_0xcd06('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcd06('0x2')](_0xcd06('0x3'),_0xcd06('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xcd06('0x8')]},'idField':{'type':Sequelize[_0xcd06('0x8')]},'nameField':{'type':Sequelize[_0xcd06('0x8')]},'customField':{'type':Sequelize[_0xcd06('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd06('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ddc9b5c..b9d96eb 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 _0xce1e=['VIRTUAL','filter','includeAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge'];(function(_0x35a329,_0x488fee){var _0x4cbdb1=function(_0x5042c0){while(--_0x5042c0){_0x35a329['push'](_0x35a329['shift']());}};_0x4cbdb1(++_0x488fee);}(_0xce1e,0x97));var _0xece1=function(_0x573a73,_0x2b67b9){_0x573a73=_0x573a73-0x0;var _0x5dba16=_0xce1e[_0x573a73];return _0x5dba16;};'use strict';var emlformat=require(_0xece1('0x0'));var rimraf=require(_0xece1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xece1('0x2'));var rp=require('request-promise');var moment=require(_0xece1('0x3'));var BPromise=require(_0xece1('0x4'));var Mustache=require(_0xece1('0x5'));var util=require('util');var path=require(_0xece1('0x6'));var sox=require(_0xece1('0x7'));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(_0xece1('0x8'));var crypto=require(_0xece1('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xece1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xece1('0xb'));var authService=require(_0xece1('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xece1('0xd'));var hardwareService=require(_0xece1('0xe'));var logger=require(_0xece1('0xf'))('api');var utils=require(_0xece1('0x10'));var config=require(_0xece1('0x11'));var licenseUtil=require(_0xece1('0x12'));var db=require(_0xece1('0x13'))['db'];function respondWithStatusCode(_0x2ceb5e,_0x4fdc18){_0x4fdc18=_0x4fdc18||0xcc;return function(_0x5ef1fe){if(_0x5ef1fe){return _0x2ceb5e[_0xece1('0x14')](_0x4fdc18);}return _0x2ceb5e[_0xece1('0x15')](_0x4fdc18)[_0xece1('0x16')]();};}function respondWithResult(_0x240c45,_0x2ae1bc){_0x2ae1bc=_0x2ae1bc||0xc8;return function(_0x3b5a78){if(_0x3b5a78){return _0x240c45[_0xece1('0x15')](_0x2ae1bc)[_0xece1('0x17')](_0x3b5a78);}};}function respondWithFilteredResult(_0x1fe646,_0x19002e){return function(_0x4a9057){if(_0x4a9057){var _0x49bd16=typeof _0x19002e[_0xece1('0x18')]===_0xece1('0x19')&&typeof _0x19002e[_0xece1('0x1a')]==='undefined';var _0x4e7895=_0x4a9057[_0xece1('0x1b')];var _0x12999b=_0x49bd16?0x0:_0x19002e[_0xece1('0x18')];var _0x1cc635=_0x49bd16?_0x4a9057[_0xece1('0x1b')]:_0x19002e[_0xece1('0x18')]+_0x19002e[_0xece1('0x1a')];var _0x2ca77b;if(_0x1cc635>=_0x4e7895){_0x1cc635=_0x4e7895;_0x2ca77b=0xc8;}else{_0x2ca77b=0xce;}_0x1fe646[_0xece1('0x15')](_0x2ca77b);return _0x1fe646[_0xece1('0x1c')]('Content-Range',_0x12999b+'-'+_0x1cc635+'/'+_0x4e7895)['json'](_0x4a9057);}return null;};}function patchUpdates(_0x533dd9){return function(_0x5d56d8){try{jsonpatch[_0xece1('0x1d')](_0x5d56d8,_0x533dd9,!![]);}catch(_0x33670b){return BPromise[_0xece1('0x1e')](_0x33670b);}return _0x5d56d8[_0xece1('0x1f')]();};}function saveUpdates(_0x49fb31,_0x2e92c8){return function(_0x5ed50d){if(_0x5ed50d){return _0x5ed50d[_0xece1('0x20')](_0x49fb31)[_0xece1('0x21')](function(_0x211076){return _0x211076;});}return null;};}function removeEntity(_0x40bb63,_0x4a3618){return function(_0x2868e2){if(_0x2868e2){return _0x2868e2[_0xece1('0x22')]()[_0xece1('0x21')](function(){_0x40bb63[_0xece1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f07b,_0x58f982){return function(_0x5913c9){if(!_0x5913c9){_0x26f07b[_0xece1('0x14')](0x194);}return _0x5913c9;};}function handleError(_0x165fa2,_0x5162f0){_0x5162f0=_0x5162f0||0x1f4;return function(_0x27638d){logger[_0xece1('0x23')](_0x27638d[_0xece1('0x24')]);if(_0x27638d['name']){delete _0x27638d[_0xece1('0x25')];}_0x165fa2['status'](_0x5162f0)[_0xece1('0x26')](_0x27638d);};}exports[_0xece1('0x27')]=function(_0x46622f,_0x175bb7){var _0x3b38d7={},_0x3906e7={},_0x113466={'count':0x0,'rows':[]};var _0x3b1328=_[_0xece1('0x28')](db[_0xece1('0x29')][_0xece1('0x2a')],function(_0x273b21){return{'name':_0x273b21[_0xece1('0x2b')],'type':_0x273b21[_0xece1('0x2c')][_0xece1('0x2d')]};});_0x3906e7[_0xece1('0x2e')]=_[_0xece1('0x28')](_0x3b1328,_0xece1('0x25'));_0x3906e7[_0xece1('0x2f')]=_[_0xece1('0x30')](_0x46622f[_0xece1('0x2f')]);_0x3906e7[_0xece1('0x31')]=_[_0xece1('0x32')](_0x3906e7[_0xece1('0x2e')],_0x3906e7[_0xece1('0x2f')]);_0x3b38d7[_0xece1('0x33')]=_[_0xece1('0x32')](_0x3906e7[_0xece1('0x2e')],qs[_0xece1('0x34')](_0x46622f[_0xece1('0x2f')][_0xece1('0x34')]));_0x3b38d7[_0xece1('0x33')]=_0x3b38d7[_0xece1('0x33')]['length']?_0x3b38d7[_0xece1('0x33')]:_0x3906e7[_0xece1('0x2e')];if(!_0x46622f[_0xece1('0x2f')][_0xece1('0x35')]('nolimit')){_0x3b38d7[_0xece1('0x1a')]=qs[_0xece1('0x1a')](_0x46622f[_0xece1('0x2f')][_0xece1('0x1a')]);_0x3b38d7[_0xece1('0x18')]=qs[_0xece1('0x18')](_0x46622f['query'][_0xece1('0x18')]);}_0x3b38d7[_0xece1('0x36')]=qs['sort'](_0x46622f[_0xece1('0x2f')][_0xece1('0x37')]);_0x3b38d7[_0xece1('0x38')]=qs[_0xece1('0x31')](_[_0xece1('0x39')](_0x46622f[_0xece1('0x2f')],_0x3906e7['filters']),_0x3b1328);if(_0x46622f[_0xece1('0x2f')]['filter']){_0x3b38d7['where']=_[_0xece1('0x3a')](_0x3b38d7['where'],{'$or':_[_0xece1('0x28')](_0x3b1328,function(_0x35da37){if(_0x35da37['type']!==_0xece1('0x3b')){var _0x3210f7={};_0x3210f7[_0x35da37[_0xece1('0x25')]]={'$like':'%'+_0x46622f['query'][_0xece1('0x3c')]+'%'};return _0x3210f7;}})});}_0x3b38d7=_['merge']({},_0x3b38d7,_0x46622f['options']);var _0x262134={'where':_0x3b38d7[_0xece1('0x38')]};return db[_0xece1('0x29')][_0xece1('0x1b')](_0x262134)[_0xece1('0x21')](function(_0x1ea8d1){_0x113466[_0xece1('0x1b')]=_0x1ea8d1;if(_0x46622f['query'][_0xece1('0x3d')]){_0x3b38d7['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x3b38d7);})[_0xece1('0x21')](function(_0x44262a){_0x113466[_0xece1('0x3e')]=_0x44262a;return _0x113466;})[_0xece1('0x21')](respondWithFilteredResult(_0x175bb7,_0x3b38d7))[_0xece1('0x3f')](handleError(_0x175bb7,null));};exports[_0xece1('0x40')]=function(_0xdcee79,_0x54a755){var _0x749c31={'raw':!![],'where':{'id':_0xdcee79['params']['id']}},_0x39d34b={};_0x39d34b[_0xece1('0x2e')]=_[_0xece1('0x30')](db[_0xece1('0x29')]['rawAttributes']);_0x39d34b[_0xece1('0x2f')]=_['keys'](_0xdcee79[_0xece1('0x2f')]);_0x39d34b[_0xece1('0x31')]=_['intersection'](_0x39d34b[_0xece1('0x2e')],_0x39d34b[_0xece1('0x2f')]);_0x749c31[_0xece1('0x33')]=_[_0xece1('0x32')](_0x39d34b['model'],qs[_0xece1('0x34')](_0xdcee79['query'][_0xece1('0x34')]));_0x749c31[_0xece1('0x33')]=_0x749c31[_0xece1('0x33')][_0xece1('0x41')]?_0x749c31['attributes']:_0x39d34b[_0xece1('0x2e')];if(_0xdcee79['query'][_0xece1('0x3d')]){_0x749c31['include']=[{'all':!![]}];}_0x749c31=_['merge']({},_0x749c31,_0xdcee79['options']);return db[_0xece1('0x29')][_0xece1('0x42')](_0x749c31)[_0xece1('0x21')](handleEntityNotFound(_0x54a755,null))['then'](respondWithResult(_0x54a755,null))[_0xece1('0x3f')](handleError(_0x54a755,null));};exports['create']=function(_0x17c1fb,_0x2ca4bc){return db[_0xece1('0x29')][_0xece1('0x43')](_0x17c1fb[_0xece1('0x44')],{})[_0xece1('0x21')](respondWithResult(_0x2ca4bc,0xc9))[_0xece1('0x3f')](handleError(_0x2ca4bc,null));};exports[_0xece1('0x20')]=function(_0x11d30d,_0x1bd7c2){if(_0x11d30d[_0xece1('0x44')]['id']){delete _0x11d30d['body']['id'];}return db[_0xece1('0x29')][_0xece1('0x42')]({'where':{'id':_0x11d30d[_0xece1('0x45')]['id']}})[_0xece1('0x21')](handleEntityNotFound(_0x1bd7c2,null))[_0xece1('0x21')](saveUpdates(_0x11d30d[_0xece1('0x44')],null))['then'](respondWithResult(_0x1bd7c2,null))['catch'](handleError(_0x1bd7c2,null));};exports[_0xece1('0x22')]=function(_0x15b2c3,_0x22a3ba){return db[_0xece1('0x29')][_0xece1('0x42')]({'where':{'id':_0x15b2c3[_0xece1('0x45')]['id']}})['then'](handleEntityNotFound(_0x22a3ba,null))[_0xece1('0x21')](removeEntity(_0x22a3ba,null))[_0xece1('0x3f')](handleError(_0x22a3ba,null));}; \ No newline at end of file +var _0x3ede=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','show','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1e5762,_0x568daf){var _0x3e608d=function(_0x3558b0){while(--_0x3558b0){_0x1e5762['push'](_0x1e5762['shift']());}};_0x3e608d(++_0x568daf);}(_0x3ede,0x80));var _0xe3ed=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x3ede[_0xf51c06];return _0x1d5420;};'use strict';var emlformat=require(_0xe3ed('0x0'));var rimraf=require(_0xe3ed('0x1'));var zipdir=require(_0xe3ed('0x2'));var jsonpatch=require(_0xe3ed('0x3'));var rp=require(_0xe3ed('0x4'));var moment=require(_0xe3ed('0x5'));var BPromise=require(_0xe3ed('0x6'));var Mustache=require(_0xe3ed('0x7'));var util=require(_0xe3ed('0x8'));var path=require(_0xe3ed('0x9'));var sox=require(_0xe3ed('0xa'));var csv=require(_0xe3ed('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3ed('0xc'));var _=require(_0xe3ed('0xd'));var squel=require(_0xe3ed('0xe'));var crypto=require(_0xe3ed('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe3ed('0x10'));var toCsv=require(_0xe3ed('0xb'));var querystring=require(_0xe3ed('0x11'));var Papa=require('papaparse');var Redis=require(_0xe3ed('0x12'));var authService=require(_0xe3ed('0x13'));var qs=require(_0xe3ed('0x14'));var as=require(_0xe3ed('0x15'));var hardwareService=require(_0xe3ed('0x16'));var logger=require(_0xe3ed('0x17'))(_0xe3ed('0x18'));var utils=require(_0xe3ed('0x19'));var config=require(_0xe3ed('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3ed('0x1b'))['db'];function respondWithStatusCode(_0x511c9e,_0x4a9c78){_0x4a9c78=_0x4a9c78||0xcc;return function(_0x58a1b0){if(_0x58a1b0){return _0x511c9e[_0xe3ed('0x1c')](_0x4a9c78);}return _0x511c9e[_0xe3ed('0x1d')](_0x4a9c78)[_0xe3ed('0x1e')]();};}function respondWithResult(_0x4c249d,_0x1d6b92){_0x1d6b92=_0x1d6b92||0xc8;return function(_0x29369e){if(_0x29369e){return _0x4c249d[_0xe3ed('0x1d')](_0x1d6b92)[_0xe3ed('0x1f')](_0x29369e);}};}function respondWithFilteredResult(_0x9b6886,_0x342c23){return function(_0x1db88a){if(_0x1db88a){var _0x1e2d9a=typeof _0x342c23[_0xe3ed('0x20')]==='undefined'&&typeof _0x342c23['limit']===_0xe3ed('0x21');var _0x33493b=_0x1db88a[_0xe3ed('0x22')];var _0x3a0c84=_0x1e2d9a?0x0:_0x342c23['offset'];var _0x2f6e24=_0x1e2d9a?_0x1db88a[_0xe3ed('0x22')]:_0x342c23[_0xe3ed('0x20')]+_0x342c23[_0xe3ed('0x23')];var _0x487146;if(_0x2f6e24>=_0x33493b){_0x2f6e24=_0x33493b;_0x487146=0xc8;}else{_0x487146=0xce;}_0x9b6886[_0xe3ed('0x1d')](_0x487146);return _0x9b6886['set']('Content-Range',_0x3a0c84+'-'+_0x2f6e24+'/'+_0x33493b)[_0xe3ed('0x1f')](_0x1db88a);}return null;};}function patchUpdates(_0x168a35){return function(_0x14b91c){try{jsonpatch['apply'](_0x14b91c,_0x168a35,!![]);}catch(_0x1d8d38){return BPromise[_0xe3ed('0x24')](_0x1d8d38);}return _0x14b91c[_0xe3ed('0x25')]();};}function saveUpdates(_0x1c69f9,_0x331ec3){return function(_0x510d66){if(_0x510d66){return _0x510d66[_0xe3ed('0x26')](_0x1c69f9)[_0xe3ed('0x27')](function(_0x5af82f){return _0x5af82f;});}return null;};}function removeEntity(_0x13d78a,_0xfaa73){return function(_0x1e8276){if(_0x1e8276){return _0x1e8276[_0xe3ed('0x28')]()[_0xe3ed('0x27')](function(){_0x13d78a[_0xe3ed('0x1d')](0xcc)[_0xe3ed('0x1e')]();});}};}function handleEntityNotFound(_0x472df9,_0x406425){return function(_0x2b04df){if(!_0x2b04df){_0x472df9['sendStatus'](0x194);}return _0x2b04df;};}function handleError(_0x55543c,_0x1de267){_0x1de267=_0x1de267||0x1f4;return function(_0x4c9f88){logger[_0xe3ed('0x29')](_0x4c9f88[_0xe3ed('0x2a')]);if(_0x4c9f88[_0xe3ed('0x2b')]){delete _0x4c9f88[_0xe3ed('0x2b')];}_0x55543c[_0xe3ed('0x1d')](_0x1de267)[_0xe3ed('0x2c')](_0x4c9f88);};}exports[_0xe3ed('0x2d')]=function(_0x129a14,_0x2aac95){var _0x3736ae={},_0xaa72e7={},_0x592ae0={'count':0x0,'rows':[]};var _0x428c9a=_[_0xe3ed('0x2e')](db[_0xe3ed('0x2f')][_0xe3ed('0x30')],function(_0x21e444){return{'name':_0x21e444['fieldName'],'type':_0x21e444[_0xe3ed('0x31')][_0xe3ed('0x32')]};});_0xaa72e7['model']=_[_0xe3ed('0x2e')](_0x428c9a,_0xe3ed('0x2b'));_0xaa72e7[_0xe3ed('0x33')]=_[_0xe3ed('0x34')](_0x129a14[_0xe3ed('0x33')]);_0xaa72e7[_0xe3ed('0x35')]=_['intersection'](_0xaa72e7[_0xe3ed('0x36')],_0xaa72e7[_0xe3ed('0x33')]);_0x3736ae[_0xe3ed('0x37')]=_[_0xe3ed('0x38')](_0xaa72e7[_0xe3ed('0x36')],qs[_0xe3ed('0x39')](_0x129a14[_0xe3ed('0x33')][_0xe3ed('0x39')]));_0x3736ae[_0xe3ed('0x37')]=_0x3736ae[_0xe3ed('0x37')][_0xe3ed('0x3a')]?_0x3736ae[_0xe3ed('0x37')]:_0xaa72e7[_0xe3ed('0x36')];if(!_0x129a14['query'][_0xe3ed('0x3b')]('nolimit')){_0x3736ae['limit']=qs[_0xe3ed('0x23')](_0x129a14[_0xe3ed('0x33')][_0xe3ed('0x23')]);_0x3736ae['offset']=qs['offset'](_0x129a14[_0xe3ed('0x33')][_0xe3ed('0x20')]);}_0x3736ae[_0xe3ed('0x3c')]=qs[_0xe3ed('0x3d')](_0x129a14['query'][_0xe3ed('0x3d')]);_0x3736ae[_0xe3ed('0x3e')]=qs[_0xe3ed('0x35')](_[_0xe3ed('0x3f')](_0x129a14[_0xe3ed('0x33')],_0xaa72e7[_0xe3ed('0x35')]),_0x428c9a);if(_0x129a14['query']['filter']){_0x3736ae[_0xe3ed('0x3e')]=_[_0xe3ed('0x40')](_0x3736ae['where'],{'$or':_['map'](_0x428c9a,function(_0x13557a){if(_0x13557a[_0xe3ed('0x31')]!=='VIRTUAL'){var _0x538b4c={};_0x538b4c[_0x13557a[_0xe3ed('0x2b')]]={'$like':'%'+_0x129a14['query'][_0xe3ed('0x41')]+'%'};return _0x538b4c;}})});}_0x3736ae=_[_0xe3ed('0x40')]({},_0x3736ae,_0x129a14['options']);var _0x5d45bb={'where':_0x3736ae[_0xe3ed('0x3e')]};return db[_0xe3ed('0x2f')]['count'](_0x5d45bb)['then'](function(_0x4db9c9){_0x592ae0[_0xe3ed('0x22')]=_0x4db9c9;if(_0x129a14[_0xe3ed('0x33')][_0xe3ed('0x42')]){_0x3736ae[_0xe3ed('0x43')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x3736ae);})['then'](function(_0x21e183){_0x592ae0['rows']=_0x21e183;return _0x592ae0;})[_0xe3ed('0x27')](respondWithFilteredResult(_0x2aac95,_0x3736ae))['catch'](handleError(_0x2aac95,null));};exports[_0xe3ed('0x44')]=function(_0x32036c,_0xf23653){var _0x313108={'raw':!![],'where':{'id':_0x32036c['params']['id']}},_0x4b4f9b={};_0x4b4f9b[_0xe3ed('0x36')]=_[_0xe3ed('0x34')](db['ZendeskField'][_0xe3ed('0x30')]);_0x4b4f9b[_0xe3ed('0x33')]=_[_0xe3ed('0x34')](_0x32036c['query']);_0x4b4f9b[_0xe3ed('0x35')]=_['intersection'](_0x4b4f9b[_0xe3ed('0x36')],_0x4b4f9b[_0xe3ed('0x33')]);_0x313108['attributes']=_['intersection'](_0x4b4f9b['model'],qs[_0xe3ed('0x39')](_0x32036c['query'][_0xe3ed('0x39')]));_0x313108['attributes']=_0x313108['attributes'][_0xe3ed('0x3a')]?_0x313108[_0xe3ed('0x37')]:_0x4b4f9b['model'];if(_0x32036c[_0xe3ed('0x33')]['includeAll']){_0x313108['include']=[{'all':!![]}];}_0x313108=_[_0xe3ed('0x40')]({},_0x313108,_0x32036c[_0xe3ed('0x45')]);return db[_0xe3ed('0x2f')][_0xe3ed('0x46')](_0x313108)[_0xe3ed('0x27')](handleEntityNotFound(_0xf23653,null))['then'](respondWithResult(_0xf23653,null))[_0xe3ed('0x47')](handleError(_0xf23653,null));};exports[_0xe3ed('0x48')]=function(_0x478d9a,_0x1529d2){return db[_0xe3ed('0x2f')]['create'](_0x478d9a[_0xe3ed('0x49')],{})['then'](respondWithResult(_0x1529d2,0xc9))[_0xe3ed('0x47')](handleError(_0x1529d2,null));};exports[_0xe3ed('0x26')]=function(_0x12e4dc,_0x10f6c7){if(_0x12e4dc[_0xe3ed('0x49')]['id']){delete _0x12e4dc[_0xe3ed('0x49')]['id'];}return db[_0xe3ed('0x2f')]['find']({'where':{'id':_0x12e4dc[_0xe3ed('0x4a')]['id']}})[_0xe3ed('0x27')](handleEntityNotFound(_0x10f6c7,null))[_0xe3ed('0x27')](saveUpdates(_0x12e4dc['body'],null))[_0xe3ed('0x27')](respondWithResult(_0x10f6c7,null))[_0xe3ed('0x47')](handleError(_0x10f6c7,null));};exports[_0xe3ed('0x28')]=function(_0x10cbb1,_0x317139){return db[_0xe3ed('0x2f')]['find']({'where':{'id':_0x10cbb1[_0xe3ed('0x4a')]['id']}})[_0xe3ed('0x27')](handleEntityNotFound(_0x317139,null))[_0xe3ed('0x27')](removeEntity(_0x317139,null))['catch'](handleError(_0x317139,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c19ac37..a20f477 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 _0x0f1a=['lodash','../../config/logger','moment','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index','idField','FieldId'];(function(_0x2c3a7f,_0x50b41b){var _0x16fbff=function(_0x3a8913){while(--_0x3a8913){_0x2c3a7f['push'](_0x2c3a7f['shift']());}};_0x16fbff(++_0x50b41b);}(_0x0f1a,0x15c));var _0xa0f1=function(_0x1a1c45,_0x4fdc66){_0x1a1c45=_0x1a1c45-0x0;var _0x3dbd0f=_0x0f1a[_0x1a1c45];return _0x3dbd0f;};'use strict';var _=require(_0xa0f1('0x0'));var util=require('util');var logger=require(_0xa0f1('0x1'))('api');var moment=require(_0xa0f1('0x2'));var BPromise=require('bluebird');var rp=require(_0xa0f1('0x3'));var fs=require('fs');var path=require(_0xa0f1('0x4'));var rimraf=require('rimraf');var config=require(_0xa0f1('0x5'));var attributes=require(_0xa0f1('0x6'));module[_0xa0f1('0x7')]=function(_0x10c99a,_0x7c96c2){return _0x10c99a['define']('ZendeskField',attributes,{'tableName':_0xa0f1('0x8'),'paranoid':![],'indexes':[{'name':_0xa0f1('0x9'),'fields':[_0xa0f1('0xa'),_0xa0f1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd487=['request-promise','rimraf','../../config/environment','exports','zendesk_unique_index','FieldId','moment','bluebird'];(function(_0x405984,_0x414817){var _0x11518b=function(_0x54cf58){while(--_0x54cf58){_0x405984['push'](_0x405984['shift']());}};_0x11518b(++_0x414817);}(_0xd487,0x8e));var _0x7d48=function(_0x505b1,_0x3f2a5d){_0x505b1=_0x505b1-0x0;var _0x6f5380=_0xd487[_0x505b1];return _0x6f5380;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7d48('0x0'));var BPromise=require(_0x7d48('0x1'));var rp=require(_0x7d48('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d48('0x3'));var config=require(_0x7d48('0x4'));var attributes=require('./intZendeskField.attributes');module[_0x7d48('0x5')]=function(_0x5e5409,_0x3510f1){return _0x5e5409['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x7d48('0x6'),'fields':['idField',_0x7d48('0x7')],'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 59c29ca..80290f3 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 _0xaad8=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0xb3defd,_0x3ebe1b){var _0x1e9458=function(_0x338ec6){while(--_0x338ec6){_0xb3defd['push'](_0xb3defd['shift']());}};_0x1e9458(++_0x3ebe1b);}(_0xaad8,0x183));var _0x8aad=function(_0xf3cdc6,_0x11df29){_0xf3cdc6=_0xf3cdc6-0x0;var _0x4a568a=_0xaad8[_0xf3cdc6];return _0x4a568a;};'use strict';var _=require(_0x8aad('0x0'));var util=require(_0x8aad('0x1'));var moment=require(_0x8aad('0x2'));var BPromise=require(_0x8aad('0x3'));var rs=require(_0x8aad('0x4'));var fs=require('fs');var Redis=require(_0x8aad('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8aad('0x6'));var logger=require(_0x8aad('0x7'))(_0x8aad('0x8'));var config=require(_0x8aad('0x9'));var jayson=require(_0x8aad('0xa'));var client=jayson[_0x8aad('0xb')][_0x8aad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26315c,_0x284c8c,_0x3c5cd6){return new BPromise(function(_0x240b9,_0x5be326){return client[_0x8aad('0xd')](_0x26315c,_0x3c5cd6)[_0x8aad('0xe')](function(_0x8a2347){logger[_0x8aad('0xf')](_0x8aad('0x10'),_0x284c8c,_0x8aad('0x11'));logger['debug'](_0x8aad('0x12'),_0x284c8c,_0x8aad('0x11'),JSON['stringify'](_0x8a2347));if(_0x8a2347[_0x8aad('0x13')]){if(_0x8a2347['error']['code']===0x1f4){logger[_0x8aad('0x13')](_0x8aad('0x10'),_0x284c8c,_0x8a2347[_0x8aad('0x13')]['message']);return _0x5be326(_0x8a2347[_0x8aad('0x13')][_0x8aad('0x14')]);}logger[_0x8aad('0x13')](_0x8aad('0x10'),_0x284c8c,_0x8a2347[_0x8aad('0x13')][_0x8aad('0x14')]);return _0x240b9(_0x8a2347['error'][_0x8aad('0x14')]);}else{logger[_0x8aad('0xf')](_0x8aad('0x10'),_0x284c8c,'request\x20sent');_0x240b9(_0x8a2347[_0x8aad('0x15')][_0x8aad('0x14')]);}})[_0x8aad('0x16')](function(_0x1921ce){logger[_0x8aad('0x13')](_0x8aad('0x10'),_0x284c8c,_0x1921ce);_0x5be326(_0x1921ce);});});} \ No newline at end of file +var _0x57bb=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskField,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','../../config/utils','../../config/environment','client','http','request','then','info'];(function(_0x5f55b4,_0x18d0e7){var _0x611668=function(_0x19e73f){while(--_0x19e73f){_0x5f55b4['push'](_0x5f55b4['shift']());}};_0x611668(++_0x18d0e7);}(_0x57bb,0x136));var _0xb57b=function(_0xab4da6,_0x22bcb0){_0xab4da6=_0xab4da6-0x0;var _0xd1155e=_0x57bb[_0xab4da6];return _0xd1155e;};'use strict';var _=require('lodash');var util=require(_0xb57b('0x0'));var moment=require('moment');var BPromise=require(_0xb57b('0x1'));var rs=require(_0xb57b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb57b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xb57b('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb57b('0x5')][_0xb57b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c8850,_0x4b5268,_0x1ccdb9){return new BPromise(function(_0x867f4c,_0x19af04){return client[_0xb57b('0x7')](_0x1c8850,_0x1ccdb9)[_0xb57b('0x8')](function(_0x31e41e){logger[_0xb57b('0x9')]('ZendeskField,\x20%s,\x20%s',_0x4b5268,_0xb57b('0xa'));logger[_0xb57b('0xb')](_0xb57b('0xc'),_0x4b5268,'request\x20sent',JSON[_0xb57b('0xd')](_0x31e41e));if(_0x31e41e[_0xb57b('0xe')]){if(_0x31e41e['error'][_0xb57b('0xf')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4b5268,_0x31e41e[_0xb57b('0xe')][_0xb57b('0x10')]);return _0x19af04(_0x31e41e['error']['message']);}logger[_0xb57b('0xe')](_0xb57b('0x11'),_0x4b5268,_0x31e41e[_0xb57b('0xe')]['message']);return _0x867f4c(_0x31e41e[_0xb57b('0xe')][_0xb57b('0x10')]);}else{logger[_0xb57b('0x9')](_0xb57b('0x11'),_0x4b5268,_0xb57b('0xa'));_0x867f4c(_0x31e41e[_0xb57b('0x12')]['message']);}})[_0xb57b('0x13')](function(_0x2c14de){logger[_0xb57b('0xe')]('ZendeskField,\x20%s,\x20%s',_0x4b5268,_0x2c14de);_0x19af04(_0x2c14de);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f118b65..c43674b 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 _0x17dc=['get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller'];(function(_0x86e4c0,_0x355af1){var _0xfa666d=function(_0x1395c4){while(--_0x1395c4){_0x86e4c0['push'](_0x86e4c0['shift']());}};_0xfa666d(++_0x355af1);}(_0x17dc,0x123));var _0xc17d=function(_0x2f28f9,_0x4f66f1){_0x2f28f9=_0x2f28f9-0x0;var _0x3abc30=_0x17dc[_0x2f28f9];return _0x3abc30;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc17d('0x0'));var timeout=require(_0xc17d('0x1'));var express=require(_0xc17d('0x2'));var router=express['Router']();var fs_extra=require(_0xc17d('0x3'));var auth=require(_0xc17d('0x4'));var interaction=require(_0xc17d('0x5'));var config=require(_0xc17d('0x6'));var controller=require(_0xc17d('0x7'));router[_0xc17d('0x8')]('/',auth[_0xc17d('0x9')](),controller[_0xc17d('0xa')]);router[_0xc17d('0x8')](_0xc17d('0xb'),auth['isAuthenticated'](),controller[_0xc17d('0xc')]);router[_0xc17d('0x8')](_0xc17d('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xc17d('0xe'),auth['isAuthenticated'](),controller[_0xc17d('0xf')]);router[_0xc17d('0x10')]('/',auth[_0xc17d('0x9')](),controller[_0xc17d('0x11')]);router['post'](_0xc17d('0xd'),auth[_0xc17d('0x9')](),controller[_0xc17d('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc17d('0x13')]);router[_0xc17d('0x14')](_0xc17d('0xb'),auth[_0xc17d('0x9')](),controller[_0xc17d('0x15')]);module[_0xc17d('0x16')]=router; \ No newline at end of file +var _0x9fb3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','delete','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9fb3,0x18c));var _0x39fb=function(_0xfcfce2,_0x5efae3){_0xfcfce2=_0xfcfce2-0x0;var _0x90f48b=_0x9fb3[_0xfcfce2];return _0x90f48b;};'use strict';var multer=require(_0x39fb('0x0'));var util=require(_0x39fb('0x1'));var path=require(_0x39fb('0x2'));var timeout=require(_0x39fb('0x3'));var express=require(_0x39fb('0x4'));var router=express[_0x39fb('0x5')]();var fs_extra=require(_0x39fb('0x6'));var auth=require(_0x39fb('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39fb('0x8'));router[_0x39fb('0x9')]('/',auth[_0x39fb('0xa')](),controller['index']);router[_0x39fb('0x9')](_0x39fb('0xb'),auth[_0x39fb('0xa')](),controller[_0x39fb('0xc')]);router['get'](_0x39fb('0xd'),auth[_0x39fb('0xa')](),controller[_0x39fb('0xe')]);router[_0x39fb('0x9')]('/:id/fields',auth[_0x39fb('0xa')](),controller[_0x39fb('0xf')]);router[_0x39fb('0x10')]('/',auth[_0x39fb('0xa')](),controller[_0x39fb('0x11')]);router['post'](_0x39fb('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x39fb('0x12')](_0x39fb('0xb'),auth[_0x39fb('0xa')](),controller['update']);router[_0x39fb('0x13')](_0x39fb('0xb'),auth[_0x39fb('0xa')](),controller[_0x39fb('0x14')]);module[_0x39fb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 4e9dff8..8cf2748 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 _0x2750=['STRING','sequelize'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x2750,0x13b));var _0x0275=function(_0x5a5ea2,_0x28c454){_0x5a5ea2=_0x5a5ea2-0x0;var _0x1fbb82=_0x2750[_0x5a5ea2];return _0x1fbb82;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'name':{'type':Sequelize[_0x0275('0x1')]},'description':{'type':Sequelize[_0x0275('0x1')]},'host':{'type':Sequelize[_0x0275('0x1')]},'zone':{'type':Sequelize[_0x0275('0x1')]},'clientId':{'type':Sequelize[_0x0275('0x1')]},'clientSecret':{'type':Sequelize[_0x0275('0x1')]},'serverUrl':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x0275('0x1')]},'refreshToken':{'type':Sequelize[_0x0275('0x1')]}}; \ No newline at end of file +var _0x55e0=['STRING','sequelize','exports'];(function(_0x1c223c,_0x3cef2f){var _0x141766=function(_0x5c09ed){while(--_0x5c09ed){_0x1c223c['push'](_0x1c223c['shift']());}};_0x141766(++_0x3cef2f);}(_0x55e0,0xdc));var _0x055e=function(_0x35ab75,_0x209dba){_0x35ab75=_0x35ab75-0x0;var _0xf61827=_0x55e0[_0x35ab75];return _0xf61827;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'name':{'type':Sequelize[_0x055e('0x2')]},'description':{'type':Sequelize[_0x055e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x055e('0x2')]},'clientSecret':{'type':Sequelize[_0x055e('0x2')]},'serverUrl':{'type':Sequelize[_0x055e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x055e('0x2')]},'refreshToken':{'type':Sequelize[_0x055e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9a7ee6f..f531372 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 _0x3f9d=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','ZohoAccount','includeAll','include','findAll','rows','catch','keys','create','body','params','getConfigurations','findOne','ZohoConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','access_token','getFields','host','clientSecret','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x241246,_0x2937ba){var _0x4d7043=function(_0x393fa6){while(--_0x393fa6){_0x241246['push'](_0x241246['shift']());}};_0x4d7043(++_0x2937ba);}(_0x3f9d,0xf4));var _0xd3f9=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x3f9d[_0x50a004];return _0x5e9992;};'use strict';var emlformat=require(_0xd3f9('0x0'));var rimraf=require(_0xd3f9('0x1'));var zipdir=require(_0xd3f9('0x2'));var jsonpatch=require(_0xd3f9('0x3'));var rp=require(_0xd3f9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd3f9('0x5'));var util=require('util');var path=require(_0xd3f9('0x6'));var sox=require(_0xd3f9('0x7'));var csv=require('to-csv');var ejs=require(_0xd3f9('0x8'));var fs=require('fs');var fs_extra=require(_0xd3f9('0x9'));var _=require(_0xd3f9('0xa'));var squel=require('squel');var crypto=require(_0xd3f9('0xb'));var jsforce=require(_0xd3f9('0xc'));var deskjs=require(_0xd3f9('0xd'));var toCsv=require(_0xd3f9('0xe'));var querystring=require(_0xd3f9('0xf'));var Papa=require(_0xd3f9('0x10'));var Redis=require(_0xd3f9('0x11'));var authService=require(_0xd3f9('0x12'));var qs=require(_0xd3f9('0x13'));var as=require(_0xd3f9('0x14'));var hardwareService=require(_0xd3f9('0x15'));var logger=require(_0xd3f9('0x16'))(_0xd3f9('0x17'));var utils=require(_0xd3f9('0x18'));var config=require(_0xd3f9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd3f9('0x1a'))['db'];var integrations=require(_0xd3f9('0x1b'));function respondWithStatusCode(_0x4a343c,_0xc6d931){_0xc6d931=_0xc6d931||0xcc;return function(_0x11a2a4){if(_0x11a2a4){return _0x4a343c[_0xd3f9('0x1c')](_0xc6d931);}return _0x4a343c[_0xd3f9('0x1d')](_0xc6d931)['end']();};}function respondWithResult(_0x3c75fa,_0x24fdea){_0x24fdea=_0x24fdea||0xc8;return function(_0x16d581){if(_0x16d581){return _0x3c75fa['status'](_0x24fdea)[_0xd3f9('0x1e')](_0x16d581);}};}function respondWithFilteredResult(_0x229c26,_0x25e421){return function(_0x544114){if(_0x544114){var _0x1d3dc5=typeof _0x25e421[_0xd3f9('0x1f')]===_0xd3f9('0x20')&&typeof _0x25e421[_0xd3f9('0x21')]===_0xd3f9('0x20');var _0x84b674=_0x544114[_0xd3f9('0x22')];var _0x351c22=_0x1d3dc5?0x0:_0x25e421['offset'];var _0x12e878=_0x1d3dc5?_0x544114[_0xd3f9('0x22')]:_0x25e421['offset']+_0x25e421[_0xd3f9('0x21')];var _0x1f822e;if(_0x12e878>=_0x84b674){_0x12e878=_0x84b674;_0x1f822e=0xc8;}else{_0x1f822e=0xce;}_0x229c26[_0xd3f9('0x1d')](_0x1f822e);return _0x229c26[_0xd3f9('0x23')]('Content-Range',_0x351c22+'-'+_0x12e878+'/'+_0x84b674)[_0xd3f9('0x1e')](_0x544114);}return null;};}function patchUpdates(_0x437895){return function(_0x284dbd){try{jsonpatch[_0xd3f9('0x24')](_0x284dbd,_0x437895,!![]);}catch(_0x295131){return BPromise[_0xd3f9('0x25')](_0x295131);}return _0x284dbd['save']();};}function saveUpdates(_0x31fa0e,_0x3f8146){return function(_0x351b67){if(_0x351b67){return _0x351b67[_0xd3f9('0x26')](_0x31fa0e)[_0xd3f9('0x27')](function(_0x3f77d6){return _0x3f77d6;});}return null;};}function removeEntity(_0x14f8a1,_0xce2495){return function(_0x938e2e){if(_0x938e2e){return _0x938e2e[_0xd3f9('0x28')]()[_0xd3f9('0x27')](function(){_0x14f8a1[_0xd3f9('0x1d')](0xcc)[_0xd3f9('0x29')]();});}};}function handleEntityNotFound(_0x3e5ed1,_0x380285){return function(_0x4a2997){if(!_0x4a2997){_0x3e5ed1[_0xd3f9('0x1c')](0x194);}return _0x4a2997;};}function handleError(_0x34c487,_0x52ce5a){_0x52ce5a=_0x52ce5a||0x1f4;return function(_0x5a059a){logger[_0xd3f9('0x2a')](_0x5a059a[_0xd3f9('0x2b')]);if(_0x5a059a['name']){delete _0x5a059a[_0xd3f9('0x2c')];}_0x34c487[_0xd3f9('0x1d')](_0x52ce5a)[_0xd3f9('0x2d')](_0x5a059a);};}exports[_0xd3f9('0x2e')]=function(_0x3d96f2,_0x1359c7){var _0x392f49={},_0x4d2063={},_0x2a4ef1={'count':0x0,'rows':[]};var _0x447eb3=_[_0xd3f9('0x2f')](db['ZohoAccount'][_0xd3f9('0x30')],function(_0x215d98){return{'name':_0x215d98[_0xd3f9('0x31')],'type':_0x215d98[_0xd3f9('0x32')][_0xd3f9('0x33')]};});_0x4d2063[_0xd3f9('0x34')]=_[_0xd3f9('0x2f')](_0x447eb3,_0xd3f9('0x2c'));_0x4d2063['query']=_['keys'](_0x3d96f2[_0xd3f9('0x35')]);_0x4d2063[_0xd3f9('0x36')]=_[_0xd3f9('0x37')](_0x4d2063[_0xd3f9('0x34')],_0x4d2063[_0xd3f9('0x35')]);_0x392f49[_0xd3f9('0x38')]=_[_0xd3f9('0x37')](_0x4d2063[_0xd3f9('0x34')],qs[_0xd3f9('0x39')](_0x3d96f2[_0xd3f9('0x35')][_0xd3f9('0x39')]));_0x392f49['attributes']=_0x392f49[_0xd3f9('0x38')][_0xd3f9('0x3a')]?_0x392f49['attributes']:_0x4d2063[_0xd3f9('0x34')];if(!_0x3d96f2[_0xd3f9('0x35')]['hasOwnProperty']('nolimit')){_0x392f49[_0xd3f9('0x21')]=qs[_0xd3f9('0x21')](_0x3d96f2[_0xd3f9('0x35')][_0xd3f9('0x21')]);_0x392f49[_0xd3f9('0x1f')]=qs['offset'](_0x3d96f2[_0xd3f9('0x35')][_0xd3f9('0x1f')]);}_0x392f49[_0xd3f9('0x3b')]=qs['sort'](_0x3d96f2[_0xd3f9('0x35')][_0xd3f9('0x3c')]);_0x392f49[_0xd3f9('0x3d')]=qs[_0xd3f9('0x36')](_['pick'](_0x3d96f2[_0xd3f9('0x35')],_0x4d2063[_0xd3f9('0x36')]),_0x447eb3);if(_0x3d96f2[_0xd3f9('0x35')][_0xd3f9('0x3e')]){_0x392f49[_0xd3f9('0x3d')]=_['merge'](_0x392f49[_0xd3f9('0x3d')],{'$or':_[_0xd3f9('0x2f')](_0x447eb3,function(_0x2350ed){if(_0x2350ed[_0xd3f9('0x32')]!=='VIRTUAL'){var _0x46e77={};_0x46e77[_0x2350ed['name']]={'$like':'%'+_0x3d96f2[_0xd3f9('0x35')][_0xd3f9('0x3e')]+'%'};return _0x46e77;}})});}_0x392f49=_[_0xd3f9('0x3f')]({},_0x392f49,_0x3d96f2[_0xd3f9('0x40')]);var _0x4c4784={'where':_0x392f49['where']};return db[_0xd3f9('0x41')][_0xd3f9('0x22')](_0x4c4784)[_0xd3f9('0x27')](function(_0x50d148){_0x2a4ef1[_0xd3f9('0x22')]=_0x50d148;if(_0x3d96f2[_0xd3f9('0x35')][_0xd3f9('0x42')]){_0x392f49[_0xd3f9('0x43')]=[{'all':!![]}];}return db[_0xd3f9('0x41')][_0xd3f9('0x44')](_0x392f49);})[_0xd3f9('0x27')](function(_0x78f388){_0x2a4ef1[_0xd3f9('0x45')]=_0x78f388;return _0x2a4ef1;})[_0xd3f9('0x27')](respondWithFilteredResult(_0x1359c7,_0x392f49))[_0xd3f9('0x46')](handleError(_0x1359c7,null));};exports['show']=function(_0x3bc0ad,_0x305cc3){var _0x3ad422={'raw':![],'where':{'id':_0x3bc0ad['params']['id']}},_0x3fd607={};_0x3fd607[_0xd3f9('0x34')]=_[_0xd3f9('0x47')](db[_0xd3f9('0x41')][_0xd3f9('0x30')]);_0x3fd607[_0xd3f9('0x35')]=_[_0xd3f9('0x47')](_0x3bc0ad['query']);_0x3fd607[_0xd3f9('0x36')]=_[_0xd3f9('0x37')](_0x3fd607[_0xd3f9('0x34')],_0x3fd607[_0xd3f9('0x35')]);_0x3ad422['attributes']=_[_0xd3f9('0x37')](_0x3fd607[_0xd3f9('0x34')],qs[_0xd3f9('0x39')](_0x3bc0ad[_0xd3f9('0x35')][_0xd3f9('0x39')]));_0x3ad422['attributes']=_0x3ad422[_0xd3f9('0x38')][_0xd3f9('0x3a')]?_0x3ad422[_0xd3f9('0x38')]:_0x3fd607['model'];if(_0x3bc0ad[_0xd3f9('0x35')][_0xd3f9('0x42')]){_0x3ad422[_0xd3f9('0x43')]=[{'all':!![]}];}_0x3ad422=_[_0xd3f9('0x3f')]({},_0x3ad422,_0x3bc0ad[_0xd3f9('0x40')]);return db[_0xd3f9('0x41')]['find'](_0x3ad422)[_0xd3f9('0x27')](handleEntityNotFound(_0x305cc3,null))[_0xd3f9('0x27')](respondWithResult(_0x305cc3,null))[_0xd3f9('0x46')](handleError(_0x305cc3,null));};exports[_0xd3f9('0x48')]=function(_0x482e27,_0x561e5e){return db[_0xd3f9('0x41')][_0xd3f9('0x48')](_0x482e27[_0xd3f9('0x49')],{})['then'](respondWithResult(_0x561e5e,0xc9))[_0xd3f9('0x46')](handleError(_0x561e5e,null));};exports[_0xd3f9('0x26')]=function(_0x5b7a37,_0x1b130a){if(_0x5b7a37[_0xd3f9('0x49')]['id']){delete _0x5b7a37[_0xd3f9('0x49')]['id'];}return db[_0xd3f9('0x41')]['find']({'where':{'id':_0x5b7a37[_0xd3f9('0x4a')]['id']}})[_0xd3f9('0x27')](handleEntityNotFound(_0x1b130a,null))[_0xd3f9('0x27')](saveUpdates(_0x5b7a37[_0xd3f9('0x49')],null))[_0xd3f9('0x27')](respondWithResult(_0x1b130a,null))[_0xd3f9('0x46')](handleError(_0x1b130a,null));};exports[_0xd3f9('0x28')]=function(_0x1148e8,_0x12325b){return db[_0xd3f9('0x41')]['find']({'where':{'id':_0x1148e8[_0xd3f9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12325b,null))[_0xd3f9('0x27')](removeEntity(_0x12325b,null))[_0xd3f9('0x46')](handleError(_0x12325b,null));};exports[_0xd3f9('0x4b')]=function(_0x4397c8,_0xff9d90,_0x119f14){var _0x50866a={};var _0x3d29c3={};var _0x3bc303;var _0x253389;return db[_0xd3f9('0x41')][_0xd3f9('0x4c')]({'where':{'id':_0x4397c8[_0xd3f9('0x4a')]['id']}})['then'](handleEntityNotFound(_0xff9d90,null))['then'](function(_0x355fd7){if(_0x355fd7){_0x3bc303=_0x355fd7;_0x3d29c3['model']=_[_0xd3f9('0x47')](db[_0xd3f9('0x4d')][_0xd3f9('0x30')]);_0x3d29c3[_0xd3f9('0x35')]=_['keys'](_0x4397c8[_0xd3f9('0x35')]);_0x3d29c3[_0xd3f9('0x36')]=_[_0xd3f9('0x37')](_0x3d29c3[_0xd3f9('0x34')],_0x3d29c3[_0xd3f9('0x35')]);_0x50866a[_0xd3f9('0x38')]=_[_0xd3f9('0x37')](_0x3d29c3['model'],qs[_0xd3f9('0x39')](_0x4397c8[_0xd3f9('0x35')][_0xd3f9('0x39')]));_0x50866a[_0xd3f9('0x38')]=_0x50866a[_0xd3f9('0x38')]['length']?_0x50866a[_0xd3f9('0x38')]:_0x3d29c3['model'];_0x50866a[_0xd3f9('0x3b')]=qs[_0xd3f9('0x3c')](_0x4397c8[_0xd3f9('0x35')][_0xd3f9('0x3c')]);_0x50866a[_0xd3f9('0x3d')]=qs['filters'](_[_0xd3f9('0x4e')](_0x4397c8['query'],_0x3d29c3[_0xd3f9('0x36')]));if(_0x4397c8['query'][_0xd3f9('0x3e')]){_0x50866a['where']=_['merge'](_0x50866a[_0xd3f9('0x3d')],{'$or':_[_0xd3f9('0x2f')](_0x50866a[_0xd3f9('0x38')],function(_0xea3e02){var _0x16a17d={};_0x16a17d[_0xea3e02]={'$like':'%'+_0x4397c8[_0xd3f9('0x35')]['filter']+'%'};return _0x16a17d;})});}_0x50866a=_['merge']({},_0x50866a,_0x4397c8['options']);return _0x3bc303[_0xd3f9('0x4b')](_0x50866a);}})['then'](function(_0x2febac){if(_0x2febac){_0x253389=_0x2febac[_0xd3f9('0x3a')];if(!_0x4397c8[_0xd3f9('0x35')][_0xd3f9('0x4f')](_0xd3f9('0x50'))){_0x50866a[_0xd3f9('0x21')]=qs[_0xd3f9('0x21')](_0x4397c8[_0xd3f9('0x35')][_0xd3f9('0x21')]);_0x50866a[_0xd3f9('0x1f')]=qs[_0xd3f9('0x1f')](_0x4397c8[_0xd3f9('0x35')][_0xd3f9('0x1f')]);}return _0x3bc303[_0xd3f9('0x4b')](_0x50866a);}})['then'](function(_0x5033cf){if(_0x5033cf){return _0x5033cf?{'count':_0x253389,'rows':_0x5033cf}:null;}})['then'](respondWithResult(_0xff9d90,null))[_0xd3f9('0x46')](handleError(_0xff9d90,null));};exports[_0xd3f9('0x51')]=function(_0x4050a7,_0x37f2c1,_0x29df7b){if(_0x4050a7[_0xd3f9('0x49')]['id']){delete _0x4050a7['body']['id'];}return db[_0xd3f9('0x41')][_0xd3f9('0x4c')]({'where':{'id':_0x4050a7[_0xd3f9('0x4a')]['id']}})[_0xd3f9('0x27')](handleEntityNotFound(_0x37f2c1,null))[_0xd3f9('0x27')](function(_0x4cbaa0){if(_0x4cbaa0){_0x4050a7['body']['AccountId']=_0x4cbaa0['id'];_0x4050a7[_0xd3f9('0x49')][_0xd3f9('0x52')]=integrations[_0xd3f9('0x53')](_0x4050a7[_0xd3f9('0x49')][_0xd3f9('0x54')],_0x4050a7[_0xd3f9('0x49')]['type']);_0x4050a7['body'][_0xd3f9('0x55')]=integrations[_0xd3f9('0x56')](_0x4050a7[_0xd3f9('0x49')]['channel'],_0x4050a7[_0xd3f9('0x49')][_0xd3f9('0x32')]);return db[_0xd3f9('0x4d')][_0xd3f9('0x48')](_0x4050a7[_0xd3f9('0x49')],{'include':[{'model':db[_0xd3f9('0x57')],'as':_0xd3f9('0x52')},{'model':db[_0xd3f9('0x57')],'as':_0xd3f9('0x55')}]});}return null;})['then'](respondWithResult(_0x37f2c1,null))[_0xd3f9('0x46')](handleError(_0x37f2c1,null));};function getAccessToken(_0x172e6b){return new Promise(function(_0x101b4e,_0x57befd){var _0x371910;switch(_0x172e6b[_0xd3f9('0x58')]){case'US':_0x371910='https://accounts.zoho.com';break;case'AU':_0x371910=_0xd3f9('0x59');break;case'EU':_0x371910='https://accounts.zoho.eu';break;case'IN':_0x371910=_0xd3f9('0x5a');break;case'CN':_0x371910=_0xd3f9('0x5b');break;default:_0x371910='https://accounts.zoho.eu';break;}var _0x1318e5={'method':_0xd3f9('0x5c'),'uri':_0x371910+_0xd3f9('0x5d'),'qs':{'refresh_token':_0x172e6b[_0xd3f9('0x5e')],'client_id':_0x172e6b[_0xd3f9('0x5f')],'client_secret':_0x172e6b['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1318e5)['then'](function(_0xe6f0ee){if(_0xe6f0ee[_0xd3f9('0x60')]){_0x101b4e(_0xe6f0ee['access_token']);}else{_0x57befd('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xd3f9('0x46')](function(_0x1a1442){_0x57befd(_0x1a1442);});});}exports[_0xd3f9('0x61')]=function(_0x5151e4,_0x53b5c7,_0x26353e){var _0x57be72,_0xd05de5,_0x339aa5,_0x5824ee,_0x76cff9;return db[_0xd3f9('0x41')][_0xd3f9('0x4c')]({'where':{'id':_0x5151e4[_0xd3f9('0x4a')]['id']},'attributes':['id',_0xd3f9('0x62'),_0xd3f9('0x58'),'clientId',_0xd3f9('0x63'),_0xd3f9('0x64'),_0xd3f9('0x65'),_0xd3f9('0x5e')]})[_0xd3f9('0x27')](handleEntityNotFound(_0x53b5c7,null))[_0xd3f9('0x27')](function(_0x228b74){_0x76cff9=_0x228b74;_0x57be72=_0x76cff9[_0xd3f9('0x62')];_0xd05de5=_0x57be72===_0xd3f9('0x66')?'eu':_0xd3f9('0x67');_0x339aa5=_0x76cff9['serverUrl'];var _0xfa78ca=_0x339aa5[_0xd3f9('0x68')](-0x1);if(_0xfa78ca==='/'||_0xfa78ca==='\x5c'||_0xfa78ca===':'){_0x339aa5=_0x339aa5[_0xd3f9('0x69')](0x0,_0x339aa5[_0xd3f9('0x6a')](_0xfa78ca));}if(!_0x76cff9[_0xd3f9('0x5e')]){throw new Error(_0xd3f9('0x6b'));}return getAccessToken(_0x76cff9);})[_0xd3f9('0x27')](function(_0x5535d2){if(_0x5535d2){return rp({'method':'GET','uri':util[_0xd3f9('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xd05de5),'qs':{'module':_0xd3f9('0x6d')},'headers':{'Authorization':_0xd3f9('0x6e')+_0x5535d2},'json':!![]});}})['then'](function(_0x54c92a){if(_0x54c92a){if(_0x54c92a['response']&&_0x54c92a[_0xd3f9('0x6f')][_0xd3f9('0x2a')]){throw new Error(_0x54c92a[_0xd3f9('0x6f')][_0xd3f9('0x2a')]['message']);}var _0x1b1a71=[];var _0x817283=[];var _0x20822e=[_0xd3f9('0x70'),_0xd3f9('0x71'),_0xd3f9('0x72'),_0xd3f9('0x73'),_0xd3f9('0x74'),_0xd3f9('0x75'),_0xd3f9('0x76'),'Call_Type'];_0x817283=_[_0xd3f9('0x77')](_0x54c92a['fields'],function(_0x5ab5f0){return _0x20822e[_0xd3f9('0x78')](_0x5ab5f0[_0xd3f9('0x79')]);});for(var _0x540b0a=0x0;_0x540b0a<_0x817283[_0xd3f9('0x3a')];_0x540b0a++){if(_0x817283[_0x540b0a][_0xd3f9('0x7a')]===![]){_0x1b1a71[_0xd3f9('0x7b')]({'id':_0x817283[_0x540b0a]['id'],'name':_0x817283[_0x540b0a][_0xd3f9('0x7c')],'custom':_0x817283[_0x540b0a][_0xd3f9('0x7d')],'options':_0x817283[_0x540b0a][_0xd3f9('0x7e')]===_0xd3f9('0x7f')&&_0x817283[_0x540b0a]['pick_list_values'][_0xd3f9('0x3a')]>-0x1?_['map'](_0x817283[_0x540b0a][_0xd3f9('0x80')],function(_0x2eef55){return{'name':_0x2eef55,'value':_0x2eef55};}):[]});}}return{'count':_0x1b1a71[_0xd3f9('0x3a')],'rows':_0x1b1a71};}else{return{'count':0x0,'rows':[]};}})[_0xd3f9('0x27')](respondWithResult(_0x53b5c7,null))[_0xd3f9('0x46')](function(_0xa0c99){var _0x5a6ef9=_0x5151e4[_0xd3f9('0x35')][_0xd3f9('0x81')]?0x1f4:_0xa0c99[_0xd3f9('0x82')]||0x1f4;logger[_0xd3f9('0x2a')](_0xd3f9('0x83'),_0xd3f9('0x61'),_0x5a6ef9,JSON[_0xd3f9('0x84')](_0xa0c99));delete _0xa0c99[_0xd3f9('0x2c')];if(_0x5a6ef9===0x191){_0x5a6ef9=0x190;}_0x53b5c7[_0xd3f9('0x1d')](_0x5a6ef9)[_0xd3f9('0x2d')](_0x5151e4[_0xd3f9('0x35')][_0xd3f9('0x81')]?{'message':_0xd3f9('0x85'),'statusCode':_0xa0c99[_0xd3f9('0x82')]}:_0xa0c99);});}; \ No newline at end of file +var _0x8c19=['https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientSecret','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','refreshToken','serverUrl','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getConfigurations','findOne','ZohoConfiguration','AccountId','getSubjects','channel','getDescriptions','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x2538d4,_0x1a4f7e){var _0x23a1b4=function(_0x10b81a){while(--_0x10b81a){_0x2538d4['push'](_0x2538d4['shift']());}};_0x23a1b4(++_0x1a4f7e);}(_0x8c19,0xa4));var _0x98c1=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x8c19[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require(_0x98c1('0x0'));var rimraf=require(_0x98c1('0x1'));var zipdir=require(_0x98c1('0x2'));var jsonpatch=require(_0x98c1('0x3'));var rp=require('request-promise');var moment=require(_0x98c1('0x4'));var BPromise=require(_0x98c1('0x5'));var Mustache=require(_0x98c1('0x6'));var util=require('util');var path=require(_0x98c1('0x7'));var sox=require(_0x98c1('0x8'));var csv=require(_0x98c1('0x9'));var ejs=require(_0x98c1('0xa'));var fs=require('fs');var fs_extra=require(_0x98c1('0xb'));var _=require('lodash');var squel=require(_0x98c1('0xc'));var crypto=require(_0x98c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x98c1('0x9'));var querystring=require('querystring');var Papa=require(_0x98c1('0xe'));var Redis=require(_0x98c1('0xf'));var authService=require(_0x98c1('0x10'));var qs=require(_0x98c1('0x11'));var as=require(_0x98c1('0x12'));var hardwareService=require(_0x98c1('0x13'));var logger=require(_0x98c1('0x14'))(_0x98c1('0x15'));var utils=require(_0x98c1('0x16'));var config=require(_0x98c1('0x17'));var licenseUtil=require(_0x98c1('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x98c1('0x19'));function respondWithStatusCode(_0x408c0a,_0x51b251){_0x51b251=_0x51b251||0xcc;return function(_0x2fd259){if(_0x2fd259){return _0x408c0a[_0x98c1('0x1a')](_0x51b251);}return _0x408c0a[_0x98c1('0x1b')](_0x51b251)[_0x98c1('0x1c')]();};}function respondWithResult(_0x20ae7d,_0x2c2500){_0x2c2500=_0x2c2500||0xc8;return function(_0xd8106d){if(_0xd8106d){return _0x20ae7d[_0x98c1('0x1b')](_0x2c2500)[_0x98c1('0x1d')](_0xd8106d);}};}function respondWithFilteredResult(_0x34f90e,_0x4ee9d5){return function(_0x6eca16){if(_0x6eca16){var _0xeaa3a8=typeof _0x4ee9d5[_0x98c1('0x1e')]===_0x98c1('0x1f')&&typeof _0x4ee9d5[_0x98c1('0x20')]===_0x98c1('0x1f');var _0x5327bd=_0x6eca16[_0x98c1('0x21')];var _0x131bc0=_0xeaa3a8?0x0:_0x4ee9d5[_0x98c1('0x1e')];var _0x4fcec4=_0xeaa3a8?_0x6eca16[_0x98c1('0x21')]:_0x4ee9d5[_0x98c1('0x1e')]+_0x4ee9d5[_0x98c1('0x20')];var _0x2b03a5;if(_0x4fcec4>=_0x5327bd){_0x4fcec4=_0x5327bd;_0x2b03a5=0xc8;}else{_0x2b03a5=0xce;}_0x34f90e[_0x98c1('0x1b')](_0x2b03a5);return _0x34f90e[_0x98c1('0x22')](_0x98c1('0x23'),_0x131bc0+'-'+_0x4fcec4+'/'+_0x5327bd)[_0x98c1('0x1d')](_0x6eca16);}return null;};}function patchUpdates(_0x2f2d16){return function(_0x3a7f92){try{jsonpatch[_0x98c1('0x24')](_0x3a7f92,_0x2f2d16,!![]);}catch(_0x512479){return BPromise['reject'](_0x512479);}return _0x3a7f92[_0x98c1('0x25')]();};}function saveUpdates(_0x2b836b,_0x1d4cc7){return function(_0x20015e){if(_0x20015e){return _0x20015e[_0x98c1('0x26')](_0x2b836b)[_0x98c1('0x27')](function(_0xd84bcc){return _0xd84bcc;});}return null;};}function removeEntity(_0x1b8212,_0x1f2969){return function(_0x1da461){if(_0x1da461){return _0x1da461[_0x98c1('0x28')]()[_0x98c1('0x27')](function(){_0x1b8212[_0x98c1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e234a,_0x4832d7){return function(_0x69818b){if(!_0x69818b){_0x4e234a[_0x98c1('0x1a')](0x194);}return _0x69818b;};}function handleError(_0x545036,_0x13f89c){_0x13f89c=_0x13f89c||0x1f4;return function(_0x48f79b){logger[_0x98c1('0x29')](_0x48f79b[_0x98c1('0x2a')]);if(_0x48f79b['name']){delete _0x48f79b[_0x98c1('0x2b')];}_0x545036[_0x98c1('0x1b')](_0x13f89c)[_0x98c1('0x2c')](_0x48f79b);};}exports[_0x98c1('0x2d')]=function(_0x212d36,_0x2df8f8){var _0xf75e69={},_0x97a09e={},_0xc1786f={'count':0x0,'rows':[]};var _0x413989=_['map'](db[_0x98c1('0x2e')][_0x98c1('0x2f')],function(_0x851a68){return{'name':_0x851a68[_0x98c1('0x30')],'type':_0x851a68[_0x98c1('0x31')][_0x98c1('0x32')]};});_0x97a09e[_0x98c1('0x33')]=_[_0x98c1('0x34')](_0x413989,_0x98c1('0x2b'));_0x97a09e[_0x98c1('0x35')]=_[_0x98c1('0x36')](_0x212d36['query']);_0x97a09e['filters']=_[_0x98c1('0x37')](_0x97a09e[_0x98c1('0x33')],_0x97a09e[_0x98c1('0x35')]);_0xf75e69['attributes']=_[_0x98c1('0x37')](_0x97a09e[_0x98c1('0x33')],qs[_0x98c1('0x38')](_0x212d36['query'][_0x98c1('0x38')]));_0xf75e69['attributes']=_0xf75e69[_0x98c1('0x39')]['length']?_0xf75e69[_0x98c1('0x39')]:_0x97a09e[_0x98c1('0x33')];if(!_0x212d36[_0x98c1('0x35')][_0x98c1('0x3a')](_0x98c1('0x3b'))){_0xf75e69[_0x98c1('0x20')]=qs[_0x98c1('0x20')](_0x212d36[_0x98c1('0x35')][_0x98c1('0x20')]);_0xf75e69[_0x98c1('0x1e')]=qs[_0x98c1('0x1e')](_0x212d36[_0x98c1('0x35')][_0x98c1('0x1e')]);}_0xf75e69[_0x98c1('0x3c')]=qs[_0x98c1('0x3d')](_0x212d36[_0x98c1('0x35')][_0x98c1('0x3d')]);_0xf75e69[_0x98c1('0x3e')]=qs[_0x98c1('0x3f')](_['pick'](_0x212d36[_0x98c1('0x35')],_0x97a09e[_0x98c1('0x3f')]),_0x413989);if(_0x212d36[_0x98c1('0x35')][_0x98c1('0x40')]){_0xf75e69[_0x98c1('0x3e')]=_['merge'](_0xf75e69[_0x98c1('0x3e')],{'$or':_['map'](_0x413989,function(_0x17f351){if(_0x17f351['type']!==_0x98c1('0x41')){var _0x165dc0={};_0x165dc0[_0x17f351[_0x98c1('0x2b')]]={'$like':'%'+_0x212d36[_0x98c1('0x35')][_0x98c1('0x40')]+'%'};return _0x165dc0;}})});}_0xf75e69=_[_0x98c1('0x42')]({},_0xf75e69,_0x212d36[_0x98c1('0x43')]);var _0x3a09cf={'where':_0xf75e69[_0x98c1('0x3e')]};return db[_0x98c1('0x2e')]['count'](_0x3a09cf)[_0x98c1('0x27')](function(_0x373c6e){_0xc1786f[_0x98c1('0x21')]=_0x373c6e;if(_0x212d36[_0x98c1('0x35')][_0x98c1('0x44')]){_0xf75e69['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x98c1('0x45')](_0xf75e69);})[_0x98c1('0x27')](function(_0x452767){_0xc1786f[_0x98c1('0x46')]=_0x452767;return _0xc1786f;})[_0x98c1('0x27')](respondWithFilteredResult(_0x2df8f8,_0xf75e69))[_0x98c1('0x47')](handleError(_0x2df8f8,null));};exports[_0x98c1('0x48')]=function(_0x2edd7d,_0x3150e3){var _0x2b3acf={'raw':![],'where':{'id':_0x2edd7d[_0x98c1('0x49')]['id']}},_0x304092={};_0x304092['model']=_[_0x98c1('0x36')](db['ZohoAccount'][_0x98c1('0x2f')]);_0x304092[_0x98c1('0x35')]=_[_0x98c1('0x36')](_0x2edd7d[_0x98c1('0x35')]);_0x304092[_0x98c1('0x3f')]=_[_0x98c1('0x37')](_0x304092[_0x98c1('0x33')],_0x304092[_0x98c1('0x35')]);_0x2b3acf['attributes']=_[_0x98c1('0x37')](_0x304092['model'],qs[_0x98c1('0x38')](_0x2edd7d['query']['fields']));_0x2b3acf[_0x98c1('0x39')]=_0x2b3acf['attributes'][_0x98c1('0x4a')]?_0x2b3acf[_0x98c1('0x39')]:_0x304092[_0x98c1('0x33')];if(_0x2edd7d[_0x98c1('0x35')][_0x98c1('0x44')]){_0x2b3acf[_0x98c1('0x4b')]=[{'all':!![]}];}_0x2b3acf=_[_0x98c1('0x42')]({},_0x2b3acf,_0x2edd7d[_0x98c1('0x43')]);return db['ZohoAccount'][_0x98c1('0x4c')](_0x2b3acf)[_0x98c1('0x27')](handleEntityNotFound(_0x3150e3,null))[_0x98c1('0x27')](respondWithResult(_0x3150e3,null))[_0x98c1('0x47')](handleError(_0x3150e3,null));};exports[_0x98c1('0x4d')]=function(_0x471821,_0xfaea46){return db[_0x98c1('0x2e')][_0x98c1('0x4d')](_0x471821[_0x98c1('0x4e')],{})[_0x98c1('0x27')](respondWithResult(_0xfaea46,0xc9))[_0x98c1('0x47')](handleError(_0xfaea46,null));};exports[_0x98c1('0x26')]=function(_0x24ee6e,_0x287edd){if(_0x24ee6e[_0x98c1('0x4e')]['id']){delete _0x24ee6e['body']['id'];}return db[_0x98c1('0x2e')][_0x98c1('0x4c')]({'where':{'id':_0x24ee6e['params']['id']}})[_0x98c1('0x27')](handleEntityNotFound(_0x287edd,null))[_0x98c1('0x27')](saveUpdates(_0x24ee6e[_0x98c1('0x4e')],null))[_0x98c1('0x27')](respondWithResult(_0x287edd,null))[_0x98c1('0x47')](handleError(_0x287edd,null));};exports[_0x98c1('0x28')]=function(_0xd71865,_0x3c76d5){return db[_0x98c1('0x2e')][_0x98c1('0x4c')]({'where':{'id':_0xd71865[_0x98c1('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c76d5,null))['then'](removeEntity(_0x3c76d5,null))['catch'](handleError(_0x3c76d5,null));};exports[_0x98c1('0x4f')]=function(_0x583596,_0x3bb9f2,_0x3f6071){var _0x52d533={};var _0x477d1d={};var _0x1ad5c3;var _0x4caec3;return db[_0x98c1('0x2e')][_0x98c1('0x50')]({'where':{'id':_0x583596['params']['id']}})['then'](handleEntityNotFound(_0x3bb9f2,null))[_0x98c1('0x27')](function(_0x4fcbd1){if(_0x4fcbd1){_0x1ad5c3=_0x4fcbd1;_0x477d1d[_0x98c1('0x33')]=_[_0x98c1('0x36')](db[_0x98c1('0x51')][_0x98c1('0x2f')]);_0x477d1d[_0x98c1('0x35')]=_[_0x98c1('0x36')](_0x583596[_0x98c1('0x35')]);_0x477d1d[_0x98c1('0x3f')]=_['intersection'](_0x477d1d[_0x98c1('0x33')],_0x477d1d[_0x98c1('0x35')]);_0x52d533[_0x98c1('0x39')]=_[_0x98c1('0x37')](_0x477d1d[_0x98c1('0x33')],qs[_0x98c1('0x38')](_0x583596['query'][_0x98c1('0x38')]));_0x52d533[_0x98c1('0x39')]=_0x52d533['attributes']['length']?_0x52d533[_0x98c1('0x39')]:_0x477d1d[_0x98c1('0x33')];_0x52d533[_0x98c1('0x3c')]=qs[_0x98c1('0x3d')](_0x583596[_0x98c1('0x35')][_0x98c1('0x3d')]);_0x52d533[_0x98c1('0x3e')]=qs['filters'](_['pick'](_0x583596[_0x98c1('0x35')],_0x477d1d[_0x98c1('0x3f')]));if(_0x583596['query']['filter']){_0x52d533['where']=_['merge'](_0x52d533[_0x98c1('0x3e')],{'$or':_[_0x98c1('0x34')](_0x52d533[_0x98c1('0x39')],function(_0x2948fd){var _0x29b9df={};_0x29b9df[_0x2948fd]={'$like':'%'+_0x583596[_0x98c1('0x35')]['filter']+'%'};return _0x29b9df;})});}_0x52d533=_[_0x98c1('0x42')]({},_0x52d533,_0x583596['options']);return _0x1ad5c3[_0x98c1('0x4f')](_0x52d533);}})[_0x98c1('0x27')](function(_0x458f08){if(_0x458f08){_0x4caec3=_0x458f08[_0x98c1('0x4a')];if(!_0x583596[_0x98c1('0x35')]['hasOwnProperty'](_0x98c1('0x3b'))){_0x52d533[_0x98c1('0x20')]=qs['limit'](_0x583596['query'][_0x98c1('0x20')]);_0x52d533[_0x98c1('0x1e')]=qs[_0x98c1('0x1e')](_0x583596[_0x98c1('0x35')]['offset']);}return _0x1ad5c3[_0x98c1('0x4f')](_0x52d533);}})[_0x98c1('0x27')](function(_0x33b49e){if(_0x33b49e){return _0x33b49e?{'count':_0x4caec3,'rows':_0x33b49e}:null;}})[_0x98c1('0x27')](respondWithResult(_0x3bb9f2,null))[_0x98c1('0x47')](handleError(_0x3bb9f2,null));};exports['addConfiguration']=function(_0x26a8e2,_0x5056c1,_0x2b3e66){if(_0x26a8e2[_0x98c1('0x4e')]['id']){delete _0x26a8e2['body']['id'];}return db['ZohoAccount'][_0x98c1('0x50')]({'where':{'id':_0x26a8e2[_0x98c1('0x49')]['id']}})[_0x98c1('0x27')](handleEntityNotFound(_0x5056c1,null))[_0x98c1('0x27')](function(_0x1024ba){if(_0x1024ba){_0x26a8e2[_0x98c1('0x4e')][_0x98c1('0x52')]=_0x1024ba['id'];_0x26a8e2[_0x98c1('0x4e')]['Subjects']=integrations[_0x98c1('0x53')](_0x26a8e2[_0x98c1('0x4e')][_0x98c1('0x54')],_0x26a8e2[_0x98c1('0x4e')][_0x98c1('0x31')]);_0x26a8e2[_0x98c1('0x4e')]['Descriptions']=integrations[_0x98c1('0x55')](_0x26a8e2[_0x98c1('0x4e')][_0x98c1('0x54')],_0x26a8e2[_0x98c1('0x4e')][_0x98c1('0x31')]);return db[_0x98c1('0x51')]['create'](_0x26a8e2[_0x98c1('0x4e')],{'include':[{'model':db[_0x98c1('0x56')],'as':_0x98c1('0x57')},{'model':db[_0x98c1('0x56')],'as':_0x98c1('0x58')}]});}return null;})['then'](respondWithResult(_0x5056c1,null))['catch'](handleError(_0x5056c1,null));};function getAccessToken(_0x16d77c){return new Promise(function(_0xfc67f9,_0x3394e6){var _0x554e9d;switch(_0x16d77c[_0x98c1('0x59')]){case'US':_0x554e9d=_0x98c1('0x5a');break;case'AU':_0x554e9d=_0x98c1('0x5b');break;case'EU':_0x554e9d=_0x98c1('0x5c');break;case'IN':_0x554e9d=_0x98c1('0x5d');break;case'CN':_0x554e9d=_0x98c1('0x5e');break;default:_0x554e9d=_0x98c1('0x5c');break;}var _0x1f51da={'method':_0x98c1('0x5f'),'uri':_0x554e9d+'/oauth/v2/token','qs':{'refresh_token':_0x16d77c['refreshToken'],'client_id':_0x16d77c['clientId'],'client_secret':_0x16d77c[_0x98c1('0x60')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1f51da)[_0x98c1('0x27')](function(_0x1736d6){if(_0x1736d6['access_token']){_0xfc67f9(_0x1736d6['access_token']);}else{_0x3394e6(_0x98c1('0x61'));}})[_0x98c1('0x47')](function(_0x4b030d){_0x3394e6(_0x4b030d);});});}exports[_0x98c1('0x62')]=function(_0x209a90,_0x95ae23,_0x5b778c){var _0x688cfd,_0x55c936,_0x4ebc6e,_0x552eed,_0x304e17;return db['ZohoAccount'][_0x98c1('0x50')]({'where':{'id':_0x209a90[_0x98c1('0x49')]['id']},'attributes':['id',_0x98c1('0x63'),_0x98c1('0x59'),'clientId','clientSecret','serverUrl',_0x98c1('0x64'),_0x98c1('0x65')]})[_0x98c1('0x27')](handleEntityNotFound(_0x95ae23,null))['then'](function(_0x598ecf){_0x304e17=_0x598ecf;_0x688cfd=_0x304e17[_0x98c1('0x63')];_0x55c936=_0x688cfd==='zoho.eu'?'eu':'com';_0x4ebc6e=_0x304e17[_0x98c1('0x66')];var _0x5d37c1=_0x4ebc6e[_0x98c1('0x67')](-0x1);if(_0x5d37c1==='/'||_0x5d37c1==='\x5c'||_0x5d37c1===':'){_0x4ebc6e=_0x4ebc6e['substring'](0x0,_0x4ebc6e['lastIndexOf'](_0x5d37c1));}if(!_0x304e17[_0x98c1('0x65')]){throw new Error(_0x98c1('0x68'));}return getAccessToken(_0x304e17);})[_0x98c1('0x27')](function(_0x5072a1){if(_0x5072a1){return rp({'method':_0x98c1('0x69'),'uri':util[_0x98c1('0x6a')](_0x98c1('0x6b'),_0x55c936),'qs':{'module':_0x98c1('0x6c')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5072a1},'json':!![]});}})[_0x98c1('0x27')](function(_0x38d037){if(_0x38d037){if(_0x38d037['response']&&_0x38d037[_0x98c1('0x6d')][_0x98c1('0x29')]){throw new Error(_0x38d037[_0x98c1('0x6d')][_0x98c1('0x29')][_0x98c1('0x6e')]);}var _0x484ee4=[];var _0x6ca4c5=[];var _0x499198=['Owner',_0x98c1('0x6f'),_0x98c1('0x70'),_0x98c1('0x71'),_0x98c1('0x72'),_0x98c1('0x73'),_0x98c1('0x74'),'Call_Type'];_0x6ca4c5=_['remove'](_0x38d037['fields'],function(_0x196f2a){return _0x499198[_0x98c1('0x75')](_0x196f2a[_0x98c1('0x76')]);});for(var _0x32f36b=0x0;_0x32f36b<_0x6ca4c5[_0x98c1('0x4a')];_0x32f36b++){if(_0x6ca4c5[_0x32f36b][_0x98c1('0x77')]===![]){_0x484ee4[_0x98c1('0x78')]({'id':_0x6ca4c5[_0x32f36b]['id'],'name':_0x6ca4c5[_0x32f36b][_0x98c1('0x79')],'custom':_0x6ca4c5[_0x32f36b][_0x98c1('0x7a')],'options':_0x6ca4c5[_0x32f36b][_0x98c1('0x7b')]===_0x98c1('0x7c')&&_0x6ca4c5[_0x32f36b]['pick_list_values']['length']>-0x1?_[_0x98c1('0x34')](_0x6ca4c5[_0x32f36b]['pick_list_values'],function(_0x3f4c9f){return{'name':_0x3f4c9f,'value':_0x3f4c9f};}):[]});}}return{'count':_0x484ee4[_0x98c1('0x4a')],'rows':_0x484ee4};}else{return{'count':0x0,'rows':[]};}})[_0x98c1('0x27')](respondWithResult(_0x95ae23,null))[_0x98c1('0x47')](function(_0x4952e9){var _0x437663=_0x209a90[_0x98c1('0x35')][_0x98c1('0x7d')]?0x1f4:_0x4952e9[_0x98c1('0x7e')]||0x1f4;logger[_0x98c1('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x437663,JSON['stringify'](_0x4952e9));delete _0x4952e9[_0x98c1('0x2b')];if(_0x437663===0x191){_0x437663=0x190;}_0x95ae23['status'](_0x437663)['send'](_0x209a90['query'][_0x98c1('0x7d')]?{'message':_0x98c1('0x7f'),'statusCode':_0x4952e9[_0x98c1('0x7e')]}:_0x4952e9);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6f892f0..9f37fb7 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 _0x0278=['code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','clientId','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','../../config/logger','api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientSecret'];(function(_0x28b790,_0x19e463){var _0x131434=function(_0x204f08){while(--_0x204f08){_0x28b790['push'](_0x28b790['shift']());}};_0x131434(++_0x19e463);}(_0x0278,0x18c));var _0x8027=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0278[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8027('0x0'))(_0x8027('0x1'));var moment=require(_0x8027('0x2'));var BPromise=require(_0x8027('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8027('0x4'));var rimraf=require('rimraf');var config=require(_0x8027('0x5'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8027('0x6'));module[_0x8027('0x7')]=function(_0x477d72,_0x5dfcfc){return _0x477d72[_0x8027('0x8')]('ZohoAccount',attributes,{'tableName':_0x8027('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x41f2a9,_0x60f302,_0x47907d){if(_0x41f2a9[_0x8027('0xa')](_0x8027('0xb'))||_0x41f2a9['changed'](_0x8027('0xc'))||_0x41f2a9[_0x8027('0xa')]('clientId')||_0x41f2a9[_0x8027('0xa')](_0x8027('0xd'))||_0x41f2a9[_0x8027('0xa')](_0x8027('0xe'))||_0x41f2a9[_0x8027('0xa')](_0x8027('0xf'))){var _0x3fd7b2,_0x270b40;_0x3fd7b2=_0x41f2a9[_0x8027('0xc')];var _0x6f05c6=_0x3fd7b2[_0x8027('0x10')](-0x1);if(_0x6f05c6==='/'||_0x6f05c6==='\x5c'||_0x6f05c6===':'){_0x3fd7b2=_0x3fd7b2[_0x8027('0x11')](0x0,_0x3fd7b2[_0x8027('0x12')](_0x6f05c6));}switch(_0x41f2a9['zone']){case'US':_0x270b40=_0x8027('0x13');break;case'AU':_0x270b40=_0x8027('0x14');break;case'IN':_0x270b40=_0x8027('0x15');break;case'CN':_0x270b40='https://accounts.zoho.com.cn';break;default:_0x270b40=_0x8027('0x16');break;}var _0x4375b9={'method':_0x8027('0x17'),'uri':_0x270b40+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x41f2a9[_0x8027('0x18')],'client_secret':_0x41f2a9[_0x8027('0xd')],'redirect_uri':_0x41f2a9['serverUrl'],'code':_0x41f2a9[_0x8027('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4375b9)[_0x8027('0x19')](function(_0x912c89){var _0x129130=JSON[_0x8027('0x1a')](_0x912c89);if(_0x129130[_0x8027('0x1b')]){_0x41f2a9[_0x8027('0x1c')]=_0x129130[_0x8027('0x1b')];logger[_0x8027('0x1d')](util[_0x8027('0x1e')](_0x8027('0x1f'),_0x41f2a9[_0x8027('0x20')],_0x41f2a9['id']));}else{logger[_0x8027('0x21')](util[_0x8027('0x1e')](_0x8027('0x22'),_0x41f2a9[_0x8027('0x20')],_0x41f2a9['id']),util['inspect'](_0x129130,{'showHidden':![],'depth':null}));}return _0x47907d(null,_0x60f302);})[_0x8027('0x23')](function(_0x12f0de){logger[_0x8027('0x21')](util[_0x8027('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x41f2a9['name'],_0x41f2a9['id']),util[_0x8027('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x47907d(_0x12f0de);});}else{return _0x47907d(null,_0x60f302);}},'beforeUpdate':function(_0x7dca2d,_0x1cb7ce,_0x278a92){if(_0x7dca2d['changed'](_0x8027('0xb'))||_0x7dca2d['changed']('serverUrl')||_0x7dca2d[_0x8027('0xa')]('clientId')||_0x7dca2d[_0x8027('0xa')](_0x8027('0xd'))||_0x7dca2d[_0x8027('0xa')](_0x8027('0xe'))||_0x7dca2d[_0x8027('0xa')](_0x8027('0xf'))){var _0x480ef1,_0x590ce9;_0x480ef1=_0x7dca2d[_0x8027('0xc')];var _0x424970=_0x480ef1[_0x8027('0x10')](-0x1);if(_0x424970==='/'||_0x424970==='\x5c'||_0x424970===':'){_0x480ef1=_0x480ef1['substring'](0x0,_0x480ef1[_0x8027('0x12')](_0x424970));}switch(_0x7dca2d[_0x8027('0xb')]){case'US':_0x590ce9=_0x8027('0x13');break;case'AU':_0x590ce9='https://accounts.zoho.com.au';break;case'IN':_0x590ce9=_0x8027('0x15');break;case'CN':_0x590ce9=_0x8027('0x25');break;default:_0x590ce9=_0x8027('0x16');break;}var _0x10adeb={'method':_0x8027('0x17'),'uri':_0x590ce9+_0x8027('0x26'),'form':{'grant_type':_0x8027('0x27'),'client_id':_0x7dca2d[_0x8027('0x18')],'client_secret':_0x7dca2d[_0x8027('0xd')],'redirect_uri':_0x7dca2d['serverUrl'],'code':_0x7dca2d['code']},'headers':{'Content-Type':_0x8027('0x28')}};return rp(_0x10adeb)[_0x8027('0x19')](function(_0x6975c6){var _0x1fb66c=JSON[_0x8027('0x1a')](_0x6975c6);if(_0x1fb66c[_0x8027('0x1b')]){_0x7dca2d[_0x8027('0x1c')]=_0x1fb66c[_0x8027('0x1b')];logger[_0x8027('0x1d')](util['format'](_0x8027('0x1f'),_0x7dca2d['name'],_0x7dca2d['id']));}else{logger['error'](util[_0x8027('0x1e')](_0x8027('0x22'),_0x7dca2d[_0x8027('0x20')],_0x7dca2d['id']),util[_0x8027('0x24')](_0x1fb66c,{'showHidden':![],'depth':null}));}return _0x278a92(null,_0x1cb7ce);})[_0x8027('0x23')](function(_0x12c247){logger[_0x8027('0x21')](util['format'](_0x8027('0x22'),_0x7dca2d[_0x8027('0x20')],_0x7dca2d['id']),util[_0x8027('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x278a92(_0x12c247);});}else{return _0x278a92(null,_0x1cb7ce);}}}});}; \ No newline at end of file +var _0x7fde=['define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','host','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','https://accounts.zoho.com','refreshToken','util','../../config/logger','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5277f9,_0x300dfc){var _0x20c80f=function(_0x4f52d7){while(--_0x4f52d7){_0x5277f9['push'](_0x5277f9['shift']());}};_0x20c80f(++_0x300dfc);}(_0x7fde,0x19b));var _0xe7fd=function(_0x1cc070,_0x4ecbef){_0x1cc070=_0x1cc070-0x0;var _0x371380=_0x7fde[_0x1cc070];return _0x371380;};'use strict';var _=require('lodash');var util=require(_0xe7fd('0x0'));var logger=require(_0xe7fd('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe7fd('0x2'));var rp=require(_0xe7fd('0x3'));var fs=require('fs');var path=require(_0xe7fd('0x4'));var rimraf=require(_0xe7fd('0x5'));var config=require('../../config/environment');var attributes=require(_0xe7fd('0x6'));var integrations=require(_0xe7fd('0x7'));module[_0xe7fd('0x8')]=function(_0x36854b,_0x5486a3){return _0x36854b[_0xe7fd('0x9')](_0xe7fd('0xa'),attributes,{'tableName':_0xe7fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1ca98d,_0x2b2171,_0x52c64c){if(_0x1ca98d[_0xe7fd('0xc')]('zone')||_0x1ca98d[_0xe7fd('0xc')](_0xe7fd('0xd'))||_0x1ca98d[_0xe7fd('0xc')](_0xe7fd('0xe'))||_0x1ca98d['changed']('clientSecret')||_0x1ca98d[_0xe7fd('0xc')](_0xe7fd('0xf'))||_0x1ca98d[_0xe7fd('0xc')](_0xe7fd('0x10'))){var _0x4ed632,_0x3a4afd;_0x4ed632=_0x1ca98d[_0xe7fd('0xd')];var _0x15cd87=_0x4ed632['slice'](-0x1);if(_0x15cd87==='/'||_0x15cd87==='\x5c'||_0x15cd87===':'){_0x4ed632=_0x4ed632[_0xe7fd('0x11')](0x0,_0x4ed632[_0xe7fd('0x12')](_0x15cd87));}switch(_0x1ca98d[_0xe7fd('0x13')]){case'US':_0x3a4afd='https://accounts.zoho.com';break;case'AU':_0x3a4afd=_0xe7fd('0x14');break;case'IN':_0x3a4afd=_0xe7fd('0x15');break;case'CN':_0x3a4afd=_0xe7fd('0x16');break;default:_0x3a4afd=_0xe7fd('0x17');break;}var _0x1fb51d={'method':_0xe7fd('0x18'),'uri':_0x3a4afd+_0xe7fd('0x19'),'form':{'grant_type':_0xe7fd('0x1a'),'client_id':_0x1ca98d[_0xe7fd('0xe')],'client_secret':_0x1ca98d[_0xe7fd('0x1b')],'redirect_uri':_0x1ca98d[_0xe7fd('0xd')],'code':_0x1ca98d[_0xe7fd('0xf')]},'headers':{'Content-Type':_0xe7fd('0x1c')}};return rp(_0x1fb51d)[_0xe7fd('0x1d')](function(_0x28426e){var _0x5ee382=JSON[_0xe7fd('0x1e')](_0x28426e);if(_0x5ee382['refresh_token']){_0x1ca98d['refreshToken']=_0x5ee382[_0xe7fd('0x1f')];logger[_0xe7fd('0x20')](util[_0xe7fd('0x21')](_0xe7fd('0x22'),_0x1ca98d[_0xe7fd('0x23')],_0x1ca98d['id']));}else{logger[_0xe7fd('0x24')](util['format'](_0xe7fd('0x25'),_0x1ca98d['name'],_0x1ca98d['id']),util[_0xe7fd('0x26')](_0x5ee382,{'showHidden':![],'depth':null}));}return _0x52c64c(null,_0x2b2171);})['catch'](function(_0x116368){logger[_0xe7fd('0x24')](util[_0xe7fd('0x21')](_0xe7fd('0x25'),_0x1ca98d[_0xe7fd('0x23')],_0x1ca98d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x52c64c(_0x116368);});}else{return _0x52c64c(null,_0x2b2171);}},'beforeUpdate':function(_0x199b7e,_0x2e8304,_0x19320b){if(_0x199b7e[_0xe7fd('0xc')](_0xe7fd('0x13'))||_0x199b7e['changed']('serverUrl')||_0x199b7e[_0xe7fd('0xc')]('clientId')||_0x199b7e['changed'](_0xe7fd('0x1b'))||_0x199b7e[_0xe7fd('0xc')](_0xe7fd('0xf'))||_0x199b7e['changed']('host')){var _0xb6ffe4,_0x2cc78d;_0xb6ffe4=_0x199b7e[_0xe7fd('0xd')];var _0x5a3161=_0xb6ffe4[_0xe7fd('0x27')](-0x1);if(_0x5a3161==='/'||_0x5a3161==='\x5c'||_0x5a3161===':'){_0xb6ffe4=_0xb6ffe4[_0xe7fd('0x11')](0x0,_0xb6ffe4[_0xe7fd('0x12')](_0x5a3161));}switch(_0x199b7e[_0xe7fd('0x13')]){case'US':_0x2cc78d=_0xe7fd('0x28');break;case'AU':_0x2cc78d=_0xe7fd('0x14');break;case'IN':_0x2cc78d='https://accounts.zoho.in';break;case'CN':_0x2cc78d='https://accounts.zoho.com.cn';break;default:_0x2cc78d=_0xe7fd('0x17');break;}var _0x53b794={'method':_0xe7fd('0x18'),'uri':_0x2cc78d+_0xe7fd('0x19'),'form':{'grant_type':_0xe7fd('0x1a'),'client_id':_0x199b7e[_0xe7fd('0xe')],'client_secret':_0x199b7e['clientSecret'],'redirect_uri':_0x199b7e[_0xe7fd('0xd')],'code':_0x199b7e[_0xe7fd('0xf')]},'headers':{'Content-Type':_0xe7fd('0x1c')}};return rp(_0x53b794)['then'](function(_0x20f531){var _0x5c76c0=JSON['parse'](_0x20f531);if(_0x5c76c0[_0xe7fd('0x1f')]){_0x199b7e[_0xe7fd('0x29')]=_0x5c76c0[_0xe7fd('0x1f')];logger[_0xe7fd('0x20')](util[_0xe7fd('0x21')](_0xe7fd('0x22'),_0x199b7e[_0xe7fd('0x23')],_0x199b7e['id']));}else{logger[_0xe7fd('0x24')](util[_0xe7fd('0x21')](_0xe7fd('0x25'),_0x199b7e[_0xe7fd('0x23')],_0x199b7e['id']),util[_0xe7fd('0x26')](_0x5c76c0,{'showHidden':![],'depth':null}));}return _0x19320b(null,_0x2e8304);})['catch'](function(_0x4aa11e){logger[_0xe7fd('0x24')](util[_0xe7fd('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x199b7e['name'],_0x199b7e['id']),util[_0xe7fd('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x19320b(_0x4aa11e);});}else{return _0x19320b(null,_0x2e8304);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4ef2231..82c7c6e 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 _0xb03e=['raw','where','attributes','limit','include','map','model','then','ShowZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options'];(function(_0x2575e8,_0xa16553){var _0x3a8919=function(_0x5225bb){while(--_0x5225bb){_0x2575e8['push'](_0x2575e8['shift']());}};_0x3a8919(++_0xa16553);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4f8c4a,_0x155923){_0x4f8c4a=_0x4f8c4a-0x0;var _0xdeafc1=_0xb03e[_0x4f8c4a];return _0xdeafc1;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});}exports[_0xeb03('0x17')]=function(_0x1b4cbd){var _0x167a33=this;return new Promise(function(_0x8d6725,_0x177f9c){return db[_0xeb03('0x18')][_0xeb03('0x19')]({'raw':_0x1b4cbd[_0xeb03('0x1a')]?_0x1b4cbd[_0xeb03('0x1a')][_0xeb03('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b4cbd['options']?_0x1b4cbd[_0xeb03('0x1a')][_0xeb03('0x1c')]||null:null,'attributes':_0x1b4cbd[_0xeb03('0x1a')]?_0x1b4cbd[_0xeb03('0x1a')][_0xeb03('0x1d')]||null:null,'limit':_0x1b4cbd[_0xeb03('0x1a')]?_0x1b4cbd[_0xeb03('0x1a')][_0xeb03('0x1e')]||null:null,'include':_0x1b4cbd[_0xeb03('0x1a')]?_0x1b4cbd['options'][_0xeb03('0x1f')]?_[_0xeb03('0x20')](_0x1b4cbd[_0xeb03('0x1a')][_0xeb03('0x1f')],function(_0x2f99e6){return{'model':db[_0x2f99e6['model']],'as':_0x2f99e6['as'],'attributes':_0x2f99e6[_0xeb03('0x1d')],'include':_0x2f99e6[_0xeb03('0x1f')]?_[_0xeb03('0x20')](_0x2f99e6[_0xeb03('0x1f')],function(_0x3f276a){return{'model':db[_0x3f276a[_0xeb03('0x21')]],'as':_0x3f276a['as'],'attributes':_0x3f276a[_0xeb03('0x1d')],'include':_0x3f276a[_0xeb03('0x1f')]?_[_0xeb03('0x20')](_0x3f276a['include'],function(_0x832372){return{'model':db[_0x832372[_0xeb03('0x21')]],'as':_0x832372['as'],'attributes':_0x832372[_0xeb03('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xeb03('0x22')](function(_0x4cdea6){logger['info'](_0xeb03('0x17'),_0x1b4cbd);logger['debug'](_0xeb03('0x17'),_0x1b4cbd,JSON[_0xeb03('0x11')](_0x4cdea6));_0x8d6725(_0x4cdea6);})[_0xeb03('0x16')](function(_0x5db8bb){logger[_0xeb03('0x12')]('GetZohoAccount',_0x5db8bb['message'],_0x1b4cbd);_0x177f9c(_0x167a33['error'](0x1f4,_0x5db8bb['message']));});});};exports[_0xeb03('0x23')]=function(_0x433ce8){var _0x5d0cc1=this;return new Promise(function(_0x528479,_0x4d830a){return db['ZohoAccount'][_0xeb03('0x24')]({'raw':_0x433ce8[_0xeb03('0x1a')]?_0x433ce8[_0xeb03('0x1a')][_0xeb03('0x1b')]===undefined?!![]:![]:!![],'where':_0x433ce8[_0xeb03('0x1a')]?_0x433ce8['options'][_0xeb03('0x1c')]||null:null,'attributes':_0x433ce8['options']?_0x433ce8[_0xeb03('0x1a')][_0xeb03('0x1d')]||null:null,'include':_0x433ce8[_0xeb03('0x1a')]?_0x433ce8[_0xeb03('0x1a')][_0xeb03('0x1f')]?_[_0xeb03('0x20')](_0x433ce8[_0xeb03('0x1a')][_0xeb03('0x1f')],function(_0x552c86){return{'model':db[_0x552c86[_0xeb03('0x21')]],'as':_0x552c86['as'],'attributes':_0x552c86['attributes'],'include':_0x552c86[_0xeb03('0x1f')]?_[_0xeb03('0x20')](_0x552c86[_0xeb03('0x1f')],function(_0x2bf8be){return{'model':db[_0x2bf8be[_0xeb03('0x21')]],'as':_0x2bf8be['as'],'attributes':_0x2bf8be[_0xeb03('0x1d')],'include':_0x2bf8be['include']?_[_0xeb03('0x20')](_0x2bf8be['include'],function(_0x585cb5){return{'model':db[_0x585cb5['model']],'as':_0x585cb5['as'],'attributes':_0x585cb5[_0xeb03('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xeb03('0x22')](function(_0x1bb6bb){logger[_0xeb03('0xd')](_0xeb03('0x23'),_0x433ce8);logger['debug'](_0xeb03('0x23'),_0x433ce8,JSON[_0xeb03('0x11')](_0x1bb6bb));_0x528479(_0x1bb6bb);})[_0xeb03('0x16')](function(_0x51a4ba){logger['error'](_0xeb03('0x23'),_0x51a4ba[_0xeb03('0x14')],_0x433ce8);_0x4d830a(_0x5d0cc1[_0xeb03('0x12')](0x1f4,_0x51a4ba['message']));});});}; \ No newline at end of file +var _0x68b3=['include','map','model','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit'];(function(_0x7b6e6c,_0x331de4){var _0x2d74b6=function(_0x4ddcb9){while(--_0x4ddcb9){_0x7b6e6c['push'](_0x7b6e6c['shift']());}};_0x2d74b6(++_0x331de4);}(_0x68b3,0x1d8));var _0x368b=function(_0x4de549,_0x120ee4){_0x4de549=_0x4de549-0x0;var _0x3ae99e=_0x68b3[_0x4de549];return _0x3ae99e;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')]({'raw':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1d')]||null:null,'attributes':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'limit':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1f')]||null:null,'include':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x20')]?_[_0x368b('0x21')](_0x540f57['options'][_0x368b('0x20')],function(_0x1ca429){return{'model':db[_0x1ca429[_0x368b('0x22')]],'as':_0x1ca429['as'],'attributes':_0x1ca429[_0x368b('0x1e')],'include':_0x1ca429[_0x368b('0x20')]?_[_0x368b('0x21')](_0x1ca429[_0x368b('0x20')],function(_0x11ea2d){return{'model':db[_0x11ea2d[_0x368b('0x22')]],'as':_0x11ea2d['as'],'attributes':_0x11ea2d[_0x368b('0x1e')],'include':_0x11ea2d[_0x368b('0x20')]?_[_0x368b('0x21')](_0x11ea2d[_0x368b('0x20')],function(_0x376e61){return{'model':db[_0x376e61[_0x368b('0x22')]],'as':_0x376e61['as'],'attributes':_0x376e61[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0x9f192e){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0x9f192e));_0x3e2e9f(_0x9f192e);})[_0x368b('0x17')](function(_0x5db0b4){logger['error'](_0x368b('0x18'),_0x5db0b4[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x5db0b4[_0x368b('0x14')]));});});};exports['ShowZohoAccount']=function(_0x12ae59){var _0x1f3ed3=this;return new Promise(function(_0x3699fe,_0x1c68ca){return db[_0x368b('0x19')]['find']({'raw':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ae59[_0x368b('0x1b')]?_0x12ae59['options']['where']||null:null,'attributes':_0x12ae59['options']?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'include':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')]?_['map'](_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')],function(_0x54e7e5){return{'model':db[_0x54e7e5[_0x368b('0x22')]],'as':_0x54e7e5['as'],'attributes':_0x54e7e5[_0x368b('0x1e')],'include':_0x54e7e5['include']?_[_0x368b('0x21')](_0x54e7e5[_0x368b('0x20')],function(_0x4a3044){return{'model':db[_0x4a3044[_0x368b('0x22')]],'as':_0x4a3044['as'],'attributes':_0x4a3044['attributes'],'include':_0x4a3044['include']?_['map'](_0x4a3044[_0x368b('0x20')],function(_0x4d6f22){return{'model':db[_0x4d6f22[_0x368b('0x22')]],'as':_0x4d6f22['as'],'attributes':_0x4d6f22[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0xd0f23f){logger[_0x368b('0x15')](_0x368b('0x23'),_0x12ae59);logger[_0x368b('0x10')](_0x368b('0x23'),_0x12ae59,JSON['stringify'](_0xd0f23f));_0x3699fe(_0xd0f23f);})[_0x368b('0x17')](function(_0x1f60ea){logger['error'](_0x368b('0x23'),_0x1f60ea[_0x368b('0x14')],_0x12ae59);_0x1c68ca(_0x1f3ed3[_0x368b('0x12')](0x1f4,_0x1f60ea[_0x368b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ef9e0b9..3f68807 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 _0x2169=['multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','getDescriptions','post','create','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2169,0xd2));var _0x9216=function(_0x3ecf95,_0x559a2c){_0x3ecf95=_0x3ecf95-0x0;var _0x3f1e72=_0x2169[_0x3ecf95];return _0x3f1e72;};'use strict';var multer=require(_0x9216('0x0'));var util=require(_0x9216('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9216('0x2'));var router=express[_0x9216('0x3')]();var fs_extra=require(_0x9216('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9216('0x5'));var config=require(_0x9216('0x6'));var controller=require(_0x9216('0x7'));router[_0x9216('0x8')]('/',auth['isAuthenticated'](),controller[_0x9216('0x9')]);router['get'](_0x9216('0xa'),auth[_0x9216('0xb')](),controller[_0x9216('0xc')]);router[_0x9216('0x8')](_0x9216('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x9216('0x8')]('/:id/subjects',auth[_0x9216('0xb')](),controller[_0x9216('0xe')]);router['get']('/:id/descriptions',auth[_0x9216('0xb')](),controller[_0x9216('0xf')]);router[_0x9216('0x10')]('/',auth[_0x9216('0xb')](),controller[_0x9216('0x11')]);router['put'](_0x9216('0xa'),auth[_0x9216('0xb')](),controller[_0x9216('0x12')]);router[_0x9216('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9216('0x14')]);module['exports']=router; \ No newline at end of file +var _0x32bb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x32bb,0x1f4));var _0xb32b=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x32bb[_0x12f688];return _0x59c3de;};'use strict';var multer=require(_0xb32b('0x0'));var util=require(_0xb32b('0x1'));var path=require(_0xb32b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb32b('0x3')]();var fs_extra=require(_0xb32b('0x4'));var auth=require(_0xb32b('0x5'));var interaction=require(_0xb32b('0x6'));var config=require(_0xb32b('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xb32b('0x8')]('/',auth[_0xb32b('0x9')](),controller['index']);router[_0xb32b('0x8')](_0xb32b('0xa'),auth[_0xb32b('0x9')](),controller['show']);router[_0xb32b('0x8')](_0xb32b('0xb'),auth[_0xb32b('0x9')](),controller['getFields']);router[_0xb32b('0x8')](_0xb32b('0xc'),auth['isAuthenticated'](),controller[_0xb32b('0xd')]);router[_0xb32b('0x8')]('/:id/descriptions',auth[_0xb32b('0x9')](),controller[_0xb32b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb32b('0xf')]);router[_0xb32b('0x10')]('/:id',auth[_0xb32b('0x9')](),controller[_0xb32b('0x11')]);router[_0xb32b('0x12')]('/:id',auth[_0xb32b('0x9')](),controller[_0xb32b('0x13')]);module[_0xb32b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 52f3701..bd44158 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 _0x2f05=['nothing','sequelize','STRING','ENUM','lead','contact'];(function(_0x3eac12,_0x4652c8){var _0x218e58=function(_0x28bfc4){while(--_0x28bfc4){_0x3eac12['push'](_0x3eac12['shift']());}};_0x218e58(++_0x4652c8);}(_0x2f05,0xaf));var _0x52f0=function(_0x5ac573,_0x16780d){_0x5ac573=_0x5ac573-0x0;var _0x36f23e=_0x2f05[_0x5ac573];return _0x36f23e;};'use strict';var Sequelize=require(_0x52f0('0x0'));module['exports']={'name':{'type':Sequelize[_0x52f0('0x1')]},'moduleCreate':{'type':Sequelize[_0x52f0('0x2')](_0x52f0('0x3'),_0x52f0('0x4'),_0x52f0('0x5')),'defaultValue':_0x52f0('0x3')},'moduleSearch':{'type':Sequelize[_0x52f0('0x2')]('contact_lead','contact','lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x52f0('0x1')]}}; \ No newline at end of file +var _0xd60b=['contact','ENUM','contact_lead','exports','lead'];(function(_0x563d53,_0x47e672){var _0x465fb4=function(_0x533dcf){while(--_0x533dcf){_0x563d53['push'](_0x563d53['shift']());}};_0x465fb4(++_0x47e672);}(_0xd60b,0x198));var _0xbd60=function(_0x24438d,_0x10b6d2){_0x24438d=_0x24438d-0x0;var _0x2349ea=_0xd60b[_0x24438d];return _0x2349ea;};'use strict';var Sequelize=require('sequelize');module[_0xbd60('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xbd60('0x1'),_0xbd60('0x2'),'nothing'),'defaultValue':_0xbd60('0x1')},'moduleSearch':{'type':Sequelize[_0xbd60('0x3')](_0xbd60('0x4'),'contact',_0xbd60('0x1')),'defaultValue':_0xbd60('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index cc24c74..4f3123f 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 _0x3ae3=['crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../mysqldb','sendStatus','status','undefined','count','offset','limit','apply','save','update','then','destroy','end','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','util','ejs','lodash','squel'];(function(_0x28eedc,_0x176917){var _0x575e59=function(_0x40f58d){while(--_0x40f58d){_0x28eedc['push'](_0x28eedc['shift']());}};_0x575e59(++_0x176917);}(_0x3ae3,0x196));var _0x33ae=function(_0x159545,_0x4b2a93){_0x159545=_0x159545-0x0;var _0x4d43a6=_0x3ae3[_0x159545];return _0x4d43a6;};'use strict';var emlformat=require(_0x33ae('0x0'));var rimraf=require(_0x33ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33ae('0x2'));var rp=require('request-promise');var moment=require(_0x33ae('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x33ae('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x33ae('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x33ae('0x6'));var squel=require(_0x33ae('0x7'));var crypto=require(_0x33ae('0x8'));var jsforce=require(_0x33ae('0x9'));var deskjs=require(_0x33ae('0xa'));var toCsv=require(_0x33ae('0xb'));var querystring=require(_0x33ae('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x33ae('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x33ae('0xe'))['db'];function respondWithStatusCode(_0x512a1a,_0x14914e){_0x14914e=_0x14914e||0xcc;return function(_0x4e7107){if(_0x4e7107){return _0x512a1a[_0x33ae('0xf')](_0x14914e);}return _0x512a1a[_0x33ae('0x10')](_0x14914e)['end']();};}function respondWithResult(_0xdba681,_0x9a980b){_0x9a980b=_0x9a980b||0xc8;return function(_0x4620ea){if(_0x4620ea){return _0xdba681[_0x33ae('0x10')](_0x9a980b)['json'](_0x4620ea);}};}function respondWithFilteredResult(_0x2e2be9,_0x3b13cd){return function(_0x53e323){if(_0x53e323){var _0x59f7f5=typeof _0x3b13cd['offset']==='undefined'&&typeof _0x3b13cd['limit']===_0x33ae('0x11');var _0x377516=_0x53e323[_0x33ae('0x12')];var _0x5cf32f=_0x59f7f5?0x0:_0x3b13cd[_0x33ae('0x13')];var _0xd670f4=_0x59f7f5?_0x53e323[_0x33ae('0x12')]:_0x3b13cd[_0x33ae('0x13')]+_0x3b13cd[_0x33ae('0x14')];var _0x36d3eb;if(_0xd670f4>=_0x377516){_0xd670f4=_0x377516;_0x36d3eb=0xc8;}else{_0x36d3eb=0xce;}_0x2e2be9['status'](_0x36d3eb);return _0x2e2be9['set']('Content-Range',_0x5cf32f+'-'+_0xd670f4+'/'+_0x377516)['json'](_0x53e323);}return null;};}function patchUpdates(_0x48647d){return function(_0x1d9a00){try{jsonpatch[_0x33ae('0x15')](_0x1d9a00,_0x48647d,!![]);}catch(_0x58fd68){return BPromise['reject'](_0x58fd68);}return _0x1d9a00[_0x33ae('0x16')]();};}function saveUpdates(_0x319347,_0x275eae){return function(_0x14508d){if(_0x14508d){return _0x14508d[_0x33ae('0x17')](_0x319347)[_0x33ae('0x18')](function(_0x1a6848){return _0x1a6848;});}return null;};}function removeEntity(_0x32f6df,_0x395afc){return function(_0x297e3b){if(_0x297e3b){return _0x297e3b[_0x33ae('0x19')]()[_0x33ae('0x18')](function(){_0x32f6df[_0x33ae('0x10')](0xcc)[_0x33ae('0x1a')]();});}};}function handleEntityNotFound(_0x38d558,_0x14a8e0){return function(_0x4f0c57){if(!_0x4f0c57){_0x38d558[_0x33ae('0xf')](0x194);}return _0x4f0c57;};}function handleError(_0x3a3ac1,_0x128a11){_0x128a11=_0x128a11||0x1f4;return function(_0xd6a0b){logger['error'](_0xd6a0b[_0x33ae('0x1b')]);if(_0xd6a0b[_0x33ae('0x1c')]){delete _0xd6a0b[_0x33ae('0x1c')];}_0x3a3ac1[_0x33ae('0x10')](_0x128a11)[_0x33ae('0x1d')](_0xd6a0b);};}exports[_0x33ae('0x1e')]=function(_0x3780a7,_0x3fcf5e){var _0xeb614b={},_0x37ebeb={},_0x348ba8={'count':0x0,'rows':[]};var _0x40f813=_[_0x33ae('0x1f')](db[_0x33ae('0x20')][_0x33ae('0x21')],function(_0x3fbad5){return{'name':_0x3fbad5[_0x33ae('0x22')],'type':_0x3fbad5['type'][_0x33ae('0x23')]};});_0x37ebeb['model']=_[_0x33ae('0x1f')](_0x40f813,'name');_0x37ebeb[_0x33ae('0x24')]=_[_0x33ae('0x25')](_0x3780a7[_0x33ae('0x24')]);_0x37ebeb[_0x33ae('0x26')]=_[_0x33ae('0x27')](_0x37ebeb[_0x33ae('0x28')],_0x37ebeb[_0x33ae('0x24')]);_0xeb614b[_0x33ae('0x29')]=_[_0x33ae('0x27')](_0x37ebeb['model'],qs[_0x33ae('0x2a')](_0x3780a7[_0x33ae('0x24')]['fields']));_0xeb614b[_0x33ae('0x29')]=_0xeb614b[_0x33ae('0x29')][_0x33ae('0x2b')]?_0xeb614b['attributes']:_0x37ebeb[_0x33ae('0x28')];if(!_0x3780a7['query'][_0x33ae('0x2c')](_0x33ae('0x2d'))){_0xeb614b[_0x33ae('0x14')]=qs[_0x33ae('0x14')](_0x3780a7[_0x33ae('0x24')][_0x33ae('0x14')]);_0xeb614b[_0x33ae('0x13')]=qs[_0x33ae('0x13')](_0x3780a7[_0x33ae('0x24')]['offset']);}_0xeb614b['order']=qs['sort'](_0x3780a7[_0x33ae('0x24')][_0x33ae('0x2e')]);_0xeb614b['where']=qs[_0x33ae('0x26')](_[_0x33ae('0x2f')](_0x3780a7['query'],_0x37ebeb[_0x33ae('0x26')]),_0x40f813);if(_0x3780a7[_0x33ae('0x24')]['filter']){_0xeb614b[_0x33ae('0x30')]=_[_0x33ae('0x31')](_0xeb614b[_0x33ae('0x30')],{'$or':_[_0x33ae('0x1f')](_0x40f813,function(_0x714fca){if(_0x714fca[_0x33ae('0x32')]!==_0x33ae('0x33')){var _0x28b987={};_0x28b987[_0x714fca['name']]={'$like':'%'+_0x3780a7[_0x33ae('0x24')][_0x33ae('0x34')]+'%'};return _0x28b987;}})});}_0xeb614b=_[_0x33ae('0x31')]({},_0xeb614b,_0x3780a7[_0x33ae('0x35')]);var _0x44c45d={'where':_0xeb614b[_0x33ae('0x30')]};return db[_0x33ae('0x20')][_0x33ae('0x12')](_0x44c45d)[_0x33ae('0x18')](function(_0x1686e4){_0x348ba8[_0x33ae('0x12')]=_0x1686e4;if(_0x3780a7[_0x33ae('0x24')][_0x33ae('0x36')]){_0xeb614b[_0x33ae('0x37')]=[{'all':!![]}];}return db[_0x33ae('0x20')][_0x33ae('0x38')](_0xeb614b);})['then'](function(_0x2b6a44){_0x348ba8['rows']=_0x2b6a44;return _0x348ba8;})[_0x33ae('0x18')](respondWithFilteredResult(_0x3fcf5e,_0xeb614b))[_0x33ae('0x39')](handleError(_0x3fcf5e,null));};exports[_0x33ae('0x3a')]=function(_0x16c4a5,_0x535897){var _0x59f883={'raw':![],'where':{'id':_0x16c4a5[_0x33ae('0x3b')]['id']}},_0x3d0aa6={};_0x3d0aa6[_0x33ae('0x28')]=_['keys'](db['ZohoConfiguration'][_0x33ae('0x21')]);_0x3d0aa6['query']=_[_0x33ae('0x25')](_0x16c4a5[_0x33ae('0x24')]);_0x3d0aa6[_0x33ae('0x26')]=_[_0x33ae('0x27')](_0x3d0aa6['model'],_0x3d0aa6[_0x33ae('0x24')]);_0x59f883[_0x33ae('0x29')]=_['intersection'](_0x3d0aa6[_0x33ae('0x28')],qs[_0x33ae('0x2a')](_0x16c4a5[_0x33ae('0x24')][_0x33ae('0x2a')]));_0x59f883['attributes']=_0x59f883[_0x33ae('0x29')][_0x33ae('0x2b')]?_0x59f883['attributes']:_0x3d0aa6[_0x33ae('0x28')];if(_0x16c4a5['query'][_0x33ae('0x36')]){_0x59f883[_0x33ae('0x37')]=[{'all':!![]}];}_0x59f883=_['merge']({},_0x59f883,_0x16c4a5['options']);return db['ZohoConfiguration']['find'](_0x59f883)[_0x33ae('0x18')](handleEntityNotFound(_0x535897,null))[_0x33ae('0x18')](respondWithResult(_0x535897,null))[_0x33ae('0x39')](handleError(_0x535897,null));};exports[_0x33ae('0x3c')]=function(_0x223b6e,_0x5fb822){return db['ZohoConfiguration'][_0x33ae('0x3c')](_0x223b6e[_0x33ae('0x3d')],{})[_0x33ae('0x18')](respondWithResult(_0x5fb822,0xc9))[_0x33ae('0x39')](handleError(_0x5fb822,null));};exports[_0x33ae('0x17')]=function(_0x3bbcaf,_0x4e0710){if(_0x3bbcaf['body']['id']){delete _0x3bbcaf[_0x33ae('0x3d')]['id'];}return db[_0x33ae('0x20')][_0x33ae('0x3e')]({'where':{'id':_0x3bbcaf['params']['id']}})[_0x33ae('0x18')](handleEntityNotFound(_0x4e0710,null))[_0x33ae('0x18')](saveUpdates(_0x3bbcaf['body'],null))[_0x33ae('0x18')](respondWithResult(_0x4e0710,null))[_0x33ae('0x39')](handleError(_0x4e0710,null));};exports[_0x33ae('0x19')]=function(_0xab7c09,_0x111818){return db['ZohoConfiguration'][_0x33ae('0x3e')]({'where':{'id':_0xab7c09[_0x33ae('0x3b')]['id']}})[_0x33ae('0x18')](handleEntityNotFound(_0x111818,null))['then'](removeEntity(_0x111818,null))[_0x33ae('0x39')](handleError(_0x111818,null));};exports[_0x33ae('0x3f')]=function(_0x4d8fab,_0x487d52,_0x25c9f9){var _0x598cce={};var _0x18256c={};var _0xbd90e5;var _0x18f817;return db['ZohoConfiguration'][_0x33ae('0x40')]({'where':{'id':_0x4d8fab['params']['id']}})['then'](handleEntityNotFound(_0x487d52,null))[_0x33ae('0x18')](function(_0x218c3e){if(_0x218c3e){_0xbd90e5=_0x218c3e;_0x18256c[_0x33ae('0x28')]=_[_0x33ae('0x25')](db[_0x33ae('0x41')][_0x33ae('0x21')]);_0x18256c[_0x33ae('0x24')]=_[_0x33ae('0x25')](_0x4d8fab[_0x33ae('0x24')]);_0x18256c['filters']=_['intersection'](_0x18256c['model'],_0x18256c[_0x33ae('0x24')]);_0x598cce[_0x33ae('0x29')]=_['intersection'](_0x18256c[_0x33ae('0x28')],qs['fields'](_0x4d8fab[_0x33ae('0x24')][_0x33ae('0x2a')]));_0x598cce['attributes']=_0x598cce[_0x33ae('0x29')][_0x33ae('0x2b')]?_0x598cce['attributes']:_0x18256c[_0x33ae('0x28')];_0x598cce[_0x33ae('0x42')]=qs[_0x33ae('0x2e')](_0x4d8fab[_0x33ae('0x24')]['sort']);_0x598cce['where']=qs[_0x33ae('0x26')](_[_0x33ae('0x2f')](_0x4d8fab['query'],_0x18256c[_0x33ae('0x26')]));if(_0x4d8fab[_0x33ae('0x24')]['filter']){_0x598cce['where']=_['merge'](_0x598cce[_0x33ae('0x30')],{'$or':_[_0x33ae('0x1f')](_0x598cce[_0x33ae('0x29')],function(_0xa58d13){var _0x4a5e57={};_0x4a5e57[_0xa58d13]={'$like':'%'+_0x4d8fab[_0x33ae('0x24')][_0x33ae('0x34')]+'%'};return _0x4a5e57;})});}_0x598cce=_[_0x33ae('0x31')]({},_0x598cce,_0x4d8fab['options']);return _0xbd90e5['getFields'](_0x598cce);}})[_0x33ae('0x18')](function(_0x4fdaa3){if(_0x4fdaa3){_0x18f817=_0x4fdaa3[_0x33ae('0x2b')];if(!_0x4d8fab[_0x33ae('0x24')][_0x33ae('0x2c')](_0x33ae('0x2d'))){_0x598cce['limit']=qs[_0x33ae('0x14')](_0x4d8fab[_0x33ae('0x24')][_0x33ae('0x14')]);_0x598cce[_0x33ae('0x13')]=qs[_0x33ae('0x13')](_0x4d8fab[_0x33ae('0x24')][_0x33ae('0x13')]);}return _0xbd90e5[_0x33ae('0x3f')](_0x598cce);}})['then'](function(_0x1dbc7d){if(_0x1dbc7d){return _0x1dbc7d?{'count':_0x18f817,'rows':_0x1dbc7d}:null;}})[_0x33ae('0x18')](respondWithResult(_0x487d52,null))[_0x33ae('0x39')](handleError(_0x487d52,null));};exports[_0x33ae('0x43')]=function(_0x1b37a6,_0x515c3c,_0x5b0219){var _0x4c39f0={};var _0x135a48={};var _0x5eaad6;var _0x30c7e1;return db[_0x33ae('0x20')][_0x33ae('0x40')]({'where':{'id':_0x1b37a6[_0x33ae('0x3b')]['id']}})[_0x33ae('0x18')](handleEntityNotFound(_0x515c3c,null))[_0x33ae('0x18')](function(_0x129615){if(_0x129615){_0x5eaad6=_0x129615;_0x135a48[_0x33ae('0x28')]=_[_0x33ae('0x25')](db[_0x33ae('0x41')][_0x33ae('0x21')]);_0x135a48['query']=_[_0x33ae('0x25')](_0x1b37a6['query']);_0x135a48[_0x33ae('0x26')]=_[_0x33ae('0x27')](_0x135a48['model'],_0x135a48['query']);_0x4c39f0[_0x33ae('0x29')]=_[_0x33ae('0x27')](_0x135a48['model'],qs[_0x33ae('0x2a')](_0x1b37a6[_0x33ae('0x24')][_0x33ae('0x2a')]));_0x4c39f0[_0x33ae('0x29')]=_0x4c39f0[_0x33ae('0x29')][_0x33ae('0x2b')]?_0x4c39f0['attributes']:_0x135a48[_0x33ae('0x28')];_0x4c39f0[_0x33ae('0x42')]=qs[_0x33ae('0x2e')](_0x1b37a6[_0x33ae('0x24')][_0x33ae('0x2e')]);_0x4c39f0[_0x33ae('0x30')]=qs[_0x33ae('0x26')](_[_0x33ae('0x2f')](_0x1b37a6[_0x33ae('0x24')],_0x135a48[_0x33ae('0x26')]));if(_0x1b37a6['query'][_0x33ae('0x34')]){_0x4c39f0[_0x33ae('0x30')]=_['merge'](_0x4c39f0[_0x33ae('0x30')],{'$or':_[_0x33ae('0x1f')](_0x4c39f0['attributes'],function(_0x191307){var _0x59d277={};_0x59d277[_0x191307]={'$like':'%'+_0x1b37a6[_0x33ae('0x24')][_0x33ae('0x34')]+'%'};return _0x59d277;})});}_0x4c39f0=_[_0x33ae('0x31')]({},_0x4c39f0,_0x1b37a6[_0x33ae('0x35')]);return _0x5eaad6['getSubjects'](_0x4c39f0);}})['then'](function(_0xed551a){if(_0xed551a){_0x30c7e1=_0xed551a['length'];if(!_0x1b37a6[_0x33ae('0x24')][_0x33ae('0x2c')](_0x33ae('0x2d'))){_0x4c39f0[_0x33ae('0x14')]=qs[_0x33ae('0x14')](_0x1b37a6[_0x33ae('0x24')][_0x33ae('0x14')]);_0x4c39f0[_0x33ae('0x13')]=qs[_0x33ae('0x13')](_0x1b37a6['query']['offset']);}return _0x5eaad6[_0x33ae('0x43')](_0x4c39f0);}})[_0x33ae('0x18')](function(_0x4ada5a){if(_0x4ada5a){return _0x4ada5a?{'count':_0x30c7e1,'rows':_0x4ada5a}:null;}})[_0x33ae('0x18')](respondWithResult(_0x515c3c,null))[_0x33ae('0x39')](handleError(_0x515c3c,null));};exports[_0x33ae('0x44')]=function(_0x1759cd,_0x1de8c4,_0xed045b){var _0x19227f={};var _0x2ad11f={};var _0x2869c1;var _0x46f671;return db[_0x33ae('0x20')][_0x33ae('0x40')]({'where':{'id':_0x1759cd[_0x33ae('0x3b')]['id']}})[_0x33ae('0x18')](handleEntityNotFound(_0x1de8c4,null))[_0x33ae('0x18')](function(_0x577cd2){if(_0x577cd2){_0x2869c1=_0x577cd2;_0x2ad11f['model']=_[_0x33ae('0x25')](db['ZohoField'][_0x33ae('0x21')]);_0x2ad11f[_0x33ae('0x24')]=_[_0x33ae('0x25')](_0x1759cd[_0x33ae('0x24')]);_0x2ad11f[_0x33ae('0x26')]=_[_0x33ae('0x27')](_0x2ad11f['model'],_0x2ad11f[_0x33ae('0x24')]);_0x19227f['attributes']=_['intersection'](_0x2ad11f[_0x33ae('0x28')],qs[_0x33ae('0x2a')](_0x1759cd[_0x33ae('0x24')][_0x33ae('0x2a')]));_0x19227f['attributes']=_0x19227f['attributes'][_0x33ae('0x2b')]?_0x19227f['attributes']:_0x2ad11f[_0x33ae('0x28')];_0x19227f[_0x33ae('0x42')]=qs[_0x33ae('0x2e')](_0x1759cd[_0x33ae('0x24')][_0x33ae('0x2e')]);_0x19227f[_0x33ae('0x30')]=qs[_0x33ae('0x26')](_['pick'](_0x1759cd[_0x33ae('0x24')],_0x2ad11f[_0x33ae('0x26')]));if(_0x1759cd['query'][_0x33ae('0x34')]){_0x19227f[_0x33ae('0x30')]=_[_0x33ae('0x31')](_0x19227f['where'],{'$or':_[_0x33ae('0x1f')](_0x19227f[_0x33ae('0x29')],function(_0x3328bc){var _0x5e0738={};_0x5e0738[_0x3328bc]={'$like':'%'+_0x1759cd['query'][_0x33ae('0x34')]+'%'};return _0x5e0738;})});}_0x19227f=_[_0x33ae('0x31')]({},_0x19227f,_0x1759cd[_0x33ae('0x35')]);return _0x2869c1[_0x33ae('0x44')](_0x19227f);}})[_0x33ae('0x18')](function(_0x24a138){if(_0x24a138){_0x46f671=_0x24a138['length'];if(!_0x1759cd[_0x33ae('0x24')][_0x33ae('0x2c')](_0x33ae('0x2d'))){_0x19227f[_0x33ae('0x14')]=qs[_0x33ae('0x14')](_0x1759cd['query'][_0x33ae('0x14')]);_0x19227f[_0x33ae('0x13')]=qs[_0x33ae('0x13')](_0x1759cd['query']['offset']);}return _0x2869c1['getDescriptions'](_0x19227f);}})[_0x33ae('0x18')](function(_0x5c32fb){if(_0x5c32fb){return _0x5c32fb?{'count':_0x46f671,'rows':_0x5c32fb}:null;}})[_0x33ae('0x18')](respondWithResult(_0x1de8c4,null))[_0x33ae('0x39')](handleError(_0x1de8c4,null));}; \ No newline at end of file +var _0x2bcf=['update','then','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','type','filter','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','pick','getDescriptions','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','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x2bcf,0xcf));var _0xf2bc=function(_0x3d8776,_0x5305dc){_0x3d8776=_0x3d8776-0x0;var _0x51d331=_0x2bcf[_0x3d8776];return _0x51d331;};'use strict';var emlformat=require(_0xf2bc('0x0'));var rimraf=require(_0xf2bc('0x1'));var zipdir=require(_0xf2bc('0x2'));var jsonpatch=require(_0xf2bc('0x3'));var rp=require('request-promise');var moment=require(_0xf2bc('0x4'));var BPromise=require(_0xf2bc('0x5'));var Mustache=require(_0xf2bc('0x6'));var util=require(_0xf2bc('0x7'));var path=require('path');var sox=require(_0xf2bc('0x8'));var csv=require(_0xf2bc('0x9'));var ejs=require(_0xf2bc('0xa'));var fs=require('fs');var fs_extra=require(_0xf2bc('0xb'));var _=require(_0xf2bc('0xc'));var squel=require(_0xf2bc('0xd'));var crypto=require('crypto');var jsforce=require(_0xf2bc('0xe'));var deskjs=require(_0xf2bc('0xf'));var toCsv=require(_0xf2bc('0x9'));var querystring=require(_0xf2bc('0x10'));var Papa=require(_0xf2bc('0x11'));var Redis=require(_0xf2bc('0x12'));var authService=require(_0xf2bc('0x13'));var qs=require(_0xf2bc('0x14'));var as=require(_0xf2bc('0x15'));var hardwareService=require(_0xf2bc('0x16'));var logger=require(_0xf2bc('0x17'))('api');var utils=require(_0xf2bc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf2bc('0x19'));var db=require(_0xf2bc('0x1a'))['db'];function respondWithStatusCode(_0x134e23,_0x481ef2){_0x481ef2=_0x481ef2||0xcc;return function(_0x2b20cb){if(_0x2b20cb){return _0x134e23[_0xf2bc('0x1b')](_0x481ef2);}return _0x134e23[_0xf2bc('0x1c')](_0x481ef2)[_0xf2bc('0x1d')]();};}function respondWithResult(_0x3a3dad,_0x10e107){_0x10e107=_0x10e107||0xc8;return function(_0x243332){if(_0x243332){return _0x3a3dad[_0xf2bc('0x1c')](_0x10e107)[_0xf2bc('0x1e')](_0x243332);}};}function respondWithFilteredResult(_0x4b08c7,_0x16f9c8){return function(_0x5ea4a6){if(_0x5ea4a6){var _0x542337=typeof _0x16f9c8[_0xf2bc('0x1f')]==='undefined'&&typeof _0x16f9c8[_0xf2bc('0x20')]===_0xf2bc('0x21');var _0x2f1b2e=_0x5ea4a6[_0xf2bc('0x22')];var _0x47129c=_0x542337?0x0:_0x16f9c8[_0xf2bc('0x1f')];var _0x4c6e55=_0x542337?_0x5ea4a6['count']:_0x16f9c8['offset']+_0x16f9c8['limit'];var _0x1bd37c;if(_0x4c6e55>=_0x2f1b2e){_0x4c6e55=_0x2f1b2e;_0x1bd37c=0xc8;}else{_0x1bd37c=0xce;}_0x4b08c7[_0xf2bc('0x1c')](_0x1bd37c);return _0x4b08c7[_0xf2bc('0x23')]('Content-Range',_0x47129c+'-'+_0x4c6e55+'/'+_0x2f1b2e)[_0xf2bc('0x1e')](_0x5ea4a6);}return null;};}function patchUpdates(_0x1f441d){return function(_0x20b023){try{jsonpatch[_0xf2bc('0x24')](_0x20b023,_0x1f441d,!![]);}catch(_0xa536be){return BPromise[_0xf2bc('0x25')](_0xa536be);}return _0x20b023[_0xf2bc('0x26')]();};}function saveUpdates(_0x5ec3d2,_0x3a6a35){return function(_0x4d5f50){if(_0x4d5f50){return _0x4d5f50[_0xf2bc('0x27')](_0x5ec3d2)[_0xf2bc('0x28')](function(_0x161aa8){return _0x161aa8;});}return null;};}function removeEntity(_0x158d5e,_0x2933da){return function(_0x52446d){if(_0x52446d){return _0x52446d['destroy']()[_0xf2bc('0x28')](function(){_0x158d5e[_0xf2bc('0x1c')](0xcc)[_0xf2bc('0x1d')]();});}};}function handleEntityNotFound(_0x44f1d1,_0x3a0ab1){return function(_0x44da5d){if(!_0x44da5d){_0x44f1d1[_0xf2bc('0x1b')](0x194);}return _0x44da5d;};}function handleError(_0x54e45d,_0xb776b7){_0xb776b7=_0xb776b7||0x1f4;return function(_0x2dea26){logger[_0xf2bc('0x29')](_0x2dea26[_0xf2bc('0x2a')]);if(_0x2dea26[_0xf2bc('0x2b')]){delete _0x2dea26[_0xf2bc('0x2b')];}_0x54e45d[_0xf2bc('0x1c')](_0xb776b7)[_0xf2bc('0x2c')](_0x2dea26);};}exports['index']=function(_0x32bc2e,_0x5a4ff6){var _0xdf850d={},_0x3f35f2={},_0x5ad4fa={'count':0x0,'rows':[]};var _0x2efd39=_[_0xf2bc('0x2d')](db[_0xf2bc('0x2e')][_0xf2bc('0x2f')],function(_0x56d5ae){return{'name':_0x56d5ae[_0xf2bc('0x30')],'type':_0x56d5ae['type']['key']};});_0x3f35f2[_0xf2bc('0x31')]=_[_0xf2bc('0x2d')](_0x2efd39,_0xf2bc('0x2b'));_0x3f35f2['query']=_[_0xf2bc('0x32')](_0x32bc2e[_0xf2bc('0x33')]);_0x3f35f2['filters']=_[_0xf2bc('0x34')](_0x3f35f2[_0xf2bc('0x31')],_0x3f35f2[_0xf2bc('0x33')]);_0xdf850d[_0xf2bc('0x35')]=_[_0xf2bc('0x34')](_0x3f35f2[_0xf2bc('0x31')],qs[_0xf2bc('0x36')](_0x32bc2e['query'][_0xf2bc('0x36')]));_0xdf850d[_0xf2bc('0x35')]=_0xdf850d[_0xf2bc('0x35')]['length']?_0xdf850d[_0xf2bc('0x35')]:_0x3f35f2[_0xf2bc('0x31')];if(!_0x32bc2e[_0xf2bc('0x33')]['hasOwnProperty'](_0xf2bc('0x37'))){_0xdf850d[_0xf2bc('0x20')]=qs[_0xf2bc('0x20')](_0x32bc2e['query']['limit']);_0xdf850d[_0xf2bc('0x1f')]=qs['offset'](_0x32bc2e['query'][_0xf2bc('0x1f')]);}_0xdf850d[_0xf2bc('0x38')]=qs['sort'](_0x32bc2e[_0xf2bc('0x33')][_0xf2bc('0x39')]);_0xdf850d[_0xf2bc('0x3a')]=qs[_0xf2bc('0x3b')](_['pick'](_0x32bc2e['query'],_0x3f35f2[_0xf2bc('0x3b')]),_0x2efd39);if(_0x32bc2e[_0xf2bc('0x33')]['filter']){_0xdf850d['where']=_[_0xf2bc('0x3c')](_0xdf850d[_0xf2bc('0x3a')],{'$or':_[_0xf2bc('0x2d')](_0x2efd39,function(_0x5b5404){if(_0x5b5404[_0xf2bc('0x3d')]!=='VIRTUAL'){var _0x3631a1={};_0x3631a1[_0x5b5404['name']]={'$like':'%'+_0x32bc2e['query'][_0xf2bc('0x3e')]+'%'};return _0x3631a1;}})});}_0xdf850d=_['merge']({},_0xdf850d,_0x32bc2e[_0xf2bc('0x3f')]);var _0x32ef2a={'where':_0xdf850d['where']};return db['ZohoConfiguration'][_0xf2bc('0x22')](_0x32ef2a)['then'](function(_0x2e50ae){_0x5ad4fa['count']=_0x2e50ae;if(_0x32bc2e['query']['includeAll']){_0xdf850d['include']=[{'all':!![]}];}return db[_0xf2bc('0x2e')][_0xf2bc('0x40')](_0xdf850d);})[_0xf2bc('0x28')](function(_0x35e030){_0x5ad4fa[_0xf2bc('0x41')]=_0x35e030;return _0x5ad4fa;})[_0xf2bc('0x28')](respondWithFilteredResult(_0x5a4ff6,_0xdf850d))[_0xf2bc('0x42')](handleError(_0x5a4ff6,null));};exports[_0xf2bc('0x43')]=function(_0x5208d5,_0x3bbf35){var _0x3db286={'raw':![],'where':{'id':_0x5208d5[_0xf2bc('0x44')]['id']}},_0x25debe={};_0x25debe[_0xf2bc('0x31')]=_[_0xf2bc('0x32')](db[_0xf2bc('0x2e')][_0xf2bc('0x2f')]);_0x25debe['query']=_[_0xf2bc('0x32')](_0x5208d5[_0xf2bc('0x33')]);_0x25debe[_0xf2bc('0x3b')]=_[_0xf2bc('0x34')](_0x25debe['model'],_0x25debe[_0xf2bc('0x33')]);_0x3db286['attributes']=_['intersection'](_0x25debe[_0xf2bc('0x31')],qs[_0xf2bc('0x36')](_0x5208d5['query'][_0xf2bc('0x36')]));_0x3db286[_0xf2bc('0x35')]=_0x3db286[_0xf2bc('0x35')][_0xf2bc('0x45')]?_0x3db286['attributes']:_0x25debe[_0xf2bc('0x31')];if(_0x5208d5[_0xf2bc('0x33')][_0xf2bc('0x46')]){_0x3db286[_0xf2bc('0x47')]=[{'all':!![]}];}_0x3db286=_[_0xf2bc('0x3c')]({},_0x3db286,_0x5208d5[_0xf2bc('0x3f')]);return db[_0xf2bc('0x2e')][_0xf2bc('0x48')](_0x3db286)[_0xf2bc('0x28')](handleEntityNotFound(_0x3bbf35,null))[_0xf2bc('0x28')](respondWithResult(_0x3bbf35,null))[_0xf2bc('0x42')](handleError(_0x3bbf35,null));};exports[_0xf2bc('0x49')]=function(_0x3f8a22,_0x1c3dba){return db[_0xf2bc('0x2e')][_0xf2bc('0x49')](_0x3f8a22[_0xf2bc('0x4a')],{})[_0xf2bc('0x28')](respondWithResult(_0x1c3dba,0xc9))['catch'](handleError(_0x1c3dba,null));};exports[_0xf2bc('0x27')]=function(_0x15a661,_0x33dfe2){if(_0x15a661[_0xf2bc('0x4a')]['id']){delete _0x15a661[_0xf2bc('0x4a')]['id'];}return db[_0xf2bc('0x2e')][_0xf2bc('0x48')]({'where':{'id':_0x15a661[_0xf2bc('0x44')]['id']}})['then'](handleEntityNotFound(_0x33dfe2,null))['then'](saveUpdates(_0x15a661['body'],null))[_0xf2bc('0x28')](respondWithResult(_0x33dfe2,null))[_0xf2bc('0x42')](handleError(_0x33dfe2,null));};exports['destroy']=function(_0x1878a5,_0x551f12){return db[_0xf2bc('0x2e')][_0xf2bc('0x48')]({'where':{'id':_0x1878a5[_0xf2bc('0x44')]['id']}})[_0xf2bc('0x28')](handleEntityNotFound(_0x551f12,null))[_0xf2bc('0x28')](removeEntity(_0x551f12,null))['catch'](handleError(_0x551f12,null));};exports[_0xf2bc('0x4b')]=function(_0x2d921c,_0xd242b8,_0x4f5145){var _0x357cbf={};var _0x4bc02b={};var _0x1e70f9;var _0x1436b9;return db[_0xf2bc('0x2e')][_0xf2bc('0x4c')]({'where':{'id':_0x2d921c[_0xf2bc('0x44')]['id']}})['then'](handleEntityNotFound(_0xd242b8,null))[_0xf2bc('0x28')](function(_0x2c9a01){if(_0x2c9a01){_0x1e70f9=_0x2c9a01;_0x4bc02b[_0xf2bc('0x31')]=_[_0xf2bc('0x32')](db[_0xf2bc('0x4d')][_0xf2bc('0x2f')]);_0x4bc02b[_0xf2bc('0x33')]=_[_0xf2bc('0x32')](_0x2d921c[_0xf2bc('0x33')]);_0x4bc02b[_0xf2bc('0x3b')]=_[_0xf2bc('0x34')](_0x4bc02b[_0xf2bc('0x31')],_0x4bc02b['query']);_0x357cbf['attributes']=_[_0xf2bc('0x34')](_0x4bc02b[_0xf2bc('0x31')],qs[_0xf2bc('0x36')](_0x2d921c['query'][_0xf2bc('0x36')]));_0x357cbf['attributes']=_0x357cbf['attributes']['length']?_0x357cbf[_0xf2bc('0x35')]:_0x4bc02b['model'];_0x357cbf[_0xf2bc('0x38')]=qs[_0xf2bc('0x39')](_0x2d921c['query'][_0xf2bc('0x39')]);_0x357cbf[_0xf2bc('0x3a')]=qs['filters'](_['pick'](_0x2d921c[_0xf2bc('0x33')],_0x4bc02b[_0xf2bc('0x3b')]));if(_0x2d921c[_0xf2bc('0x33')][_0xf2bc('0x3e')]){_0x357cbf[_0xf2bc('0x3a')]=_['merge'](_0x357cbf[_0xf2bc('0x3a')],{'$or':_['map'](_0x357cbf[_0xf2bc('0x35')],function(_0x517877){var _0x22eb2f={};_0x22eb2f[_0x517877]={'$like':'%'+_0x2d921c[_0xf2bc('0x33')]['filter']+'%'};return _0x22eb2f;})});}_0x357cbf=_['merge']({},_0x357cbf,_0x2d921c[_0xf2bc('0x3f')]);return _0x1e70f9['getFields'](_0x357cbf);}})[_0xf2bc('0x28')](function(_0x51ab76){if(_0x51ab76){_0x1436b9=_0x51ab76['length'];if(!_0x2d921c[_0xf2bc('0x33')][_0xf2bc('0x4e')](_0xf2bc('0x37'))){_0x357cbf['limit']=qs[_0xf2bc('0x20')](_0x2d921c[_0xf2bc('0x33')][_0xf2bc('0x20')]);_0x357cbf[_0xf2bc('0x1f')]=qs[_0xf2bc('0x1f')](_0x2d921c[_0xf2bc('0x33')]['offset']);}return _0x1e70f9[_0xf2bc('0x4b')](_0x357cbf);}})['then'](function(_0xcca129){if(_0xcca129){return _0xcca129?{'count':_0x1436b9,'rows':_0xcca129}:null;}})[_0xf2bc('0x28')](respondWithResult(_0xd242b8,null))[_0xf2bc('0x42')](handleError(_0xd242b8,null));};exports[_0xf2bc('0x4f')]=function(_0x2e9ff7,_0x2ece8a,_0x16b045){var _0x15e494={};var _0x4d40f2={};var _0x349f74;var _0xe30a14;return db['ZohoConfiguration'][_0xf2bc('0x4c')]({'where':{'id':_0x2e9ff7[_0xf2bc('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ece8a,null))[_0xf2bc('0x28')](function(_0x17b5f5){if(_0x17b5f5){_0x349f74=_0x17b5f5;_0x4d40f2[_0xf2bc('0x31')]=_[_0xf2bc('0x32')](db['ZohoField'][_0xf2bc('0x2f')]);_0x4d40f2[_0xf2bc('0x33')]=_[_0xf2bc('0x32')](_0x2e9ff7[_0xf2bc('0x33')]);_0x4d40f2[_0xf2bc('0x3b')]=_[_0xf2bc('0x34')](_0x4d40f2[_0xf2bc('0x31')],_0x4d40f2['query']);_0x15e494[_0xf2bc('0x35')]=_[_0xf2bc('0x34')](_0x4d40f2['model'],qs[_0xf2bc('0x36')](_0x2e9ff7['query'][_0xf2bc('0x36')]));_0x15e494[_0xf2bc('0x35')]=_0x15e494[_0xf2bc('0x35')][_0xf2bc('0x45')]?_0x15e494[_0xf2bc('0x35')]:_0x4d40f2[_0xf2bc('0x31')];_0x15e494[_0xf2bc('0x38')]=qs[_0xf2bc('0x39')](_0x2e9ff7['query']['sort']);_0x15e494[_0xf2bc('0x3a')]=qs[_0xf2bc('0x3b')](_[_0xf2bc('0x50')](_0x2e9ff7[_0xf2bc('0x33')],_0x4d40f2[_0xf2bc('0x3b')]));if(_0x2e9ff7[_0xf2bc('0x33')][_0xf2bc('0x3e')]){_0x15e494[_0xf2bc('0x3a')]=_[_0xf2bc('0x3c')](_0x15e494[_0xf2bc('0x3a')],{'$or':_[_0xf2bc('0x2d')](_0x15e494[_0xf2bc('0x35')],function(_0x5434c){var _0x20165b={};_0x20165b[_0x5434c]={'$like':'%'+_0x2e9ff7['query'][_0xf2bc('0x3e')]+'%'};return _0x20165b;})});}_0x15e494=_[_0xf2bc('0x3c')]({},_0x15e494,_0x2e9ff7['options']);return _0x349f74[_0xf2bc('0x4f')](_0x15e494);}})['then'](function(_0x56c58e){if(_0x56c58e){_0xe30a14=_0x56c58e[_0xf2bc('0x45')];if(!_0x2e9ff7[_0xf2bc('0x33')][_0xf2bc('0x4e')](_0xf2bc('0x37'))){_0x15e494[_0xf2bc('0x20')]=qs['limit'](_0x2e9ff7[_0xf2bc('0x33')][_0xf2bc('0x20')]);_0x15e494['offset']=qs[_0xf2bc('0x1f')](_0x2e9ff7[_0xf2bc('0x33')][_0xf2bc('0x1f')]);}return _0x349f74['getSubjects'](_0x15e494);}})[_0xf2bc('0x28')](function(_0x537524){if(_0x537524){return _0x537524?{'count':_0xe30a14,'rows':_0x537524}:null;}})[_0xf2bc('0x28')](respondWithResult(_0x2ece8a,null))[_0xf2bc('0x42')](handleError(_0x2ece8a,null));};exports[_0xf2bc('0x51')]=function(_0xe0fa71,_0x295152,_0x4234e5){var _0x7815e9={};var _0x10919e={};var _0x269d9b;var _0x1c6609;return db[_0xf2bc('0x2e')][_0xf2bc('0x4c')]({'where':{'id':_0xe0fa71[_0xf2bc('0x44')]['id']}})[_0xf2bc('0x28')](handleEntityNotFound(_0x295152,null))[_0xf2bc('0x28')](function(_0x381009){if(_0x381009){_0x269d9b=_0x381009;_0x10919e[_0xf2bc('0x31')]=_['keys'](db[_0xf2bc('0x4d')]['rawAttributes']);_0x10919e[_0xf2bc('0x33')]=_[_0xf2bc('0x32')](_0xe0fa71[_0xf2bc('0x33')]);_0x10919e[_0xf2bc('0x3b')]=_['intersection'](_0x10919e[_0xf2bc('0x31')],_0x10919e[_0xf2bc('0x33')]);_0x7815e9[_0xf2bc('0x35')]=_['intersection'](_0x10919e[_0xf2bc('0x31')],qs[_0xf2bc('0x36')](_0xe0fa71['query'][_0xf2bc('0x36')]));_0x7815e9['attributes']=_0x7815e9[_0xf2bc('0x35')][_0xf2bc('0x45')]?_0x7815e9['attributes']:_0x10919e['model'];_0x7815e9[_0xf2bc('0x38')]=qs[_0xf2bc('0x39')](_0xe0fa71['query'][_0xf2bc('0x39')]);_0x7815e9[_0xf2bc('0x3a')]=qs[_0xf2bc('0x3b')](_[_0xf2bc('0x50')](_0xe0fa71[_0xf2bc('0x33')],_0x10919e[_0xf2bc('0x3b')]));if(_0xe0fa71[_0xf2bc('0x33')][_0xf2bc('0x3e')]){_0x7815e9['where']=_[_0xf2bc('0x3c')](_0x7815e9[_0xf2bc('0x3a')],{'$or':_[_0xf2bc('0x2d')](_0x7815e9[_0xf2bc('0x35')],function(_0x4f3944){var _0x49568b={};_0x49568b[_0x4f3944]={'$like':'%'+_0xe0fa71[_0xf2bc('0x33')]['filter']+'%'};return _0x49568b;})});}_0x7815e9=_[_0xf2bc('0x3c')]({},_0x7815e9,_0xe0fa71[_0xf2bc('0x3f')]);return _0x269d9b['getDescriptions'](_0x7815e9);}})['then'](function(_0x3f7cb6){if(_0x3f7cb6){_0x1c6609=_0x3f7cb6['length'];if(!_0xe0fa71[_0xf2bc('0x33')][_0xf2bc('0x4e')](_0xf2bc('0x37'))){_0x7815e9[_0xf2bc('0x20')]=qs[_0xf2bc('0x20')](_0xe0fa71[_0xf2bc('0x33')][_0xf2bc('0x20')]);_0x7815e9[_0xf2bc('0x1f')]=qs[_0xf2bc('0x1f')](_0xe0fa71[_0xf2bc('0x33')][_0xf2bc('0x1f')]);}return _0x269d9b['getDescriptions'](_0x7815e9);}})[_0xf2bc('0x28')](function(_0x5874aa){if(_0x5874aa){return _0x5874aa?{'count':_0x1c6609,'rows':_0x5874aa}:null;}})[_0xf2bc('0x28')](respondWithResult(_0x295152,null))[_0xf2bc('0x42')](handleError(_0x295152,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 818d504..278a399 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 _0x9282=['rimraf','./intZohoConfiguration.attributes','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0x9282,0x1d9));var _0x2928=function(_0x4801a0,_0x252c24){_0x4801a0=_0x4801a0-0x0;var _0x338e26=_0x9282[_0x4801a0];return _0x338e26;};'use strict';var _=require(_0x2928('0x0'));var util=require('util');var logger=require(_0x2928('0x1'))(_0x2928('0x2'));var moment=require(_0x2928('0x3'));var BPromise=require(_0x2928('0x4'));var rp=require(_0x2928('0x5'));var fs=require('fs');var path=require(_0x2928('0x6'));var rimraf=require(_0x2928('0x7'));var config=require('../../config/environment');var attributes=require(_0x2928('0x8'));module['exports']=function(_0x40f2fb,_0x67496a){return _0x40f2fb[_0x2928('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7657=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x33cacf,_0x14b7e9){var _0x216882=function(_0x2e0d09){while(--_0x2e0d09){_0x33cacf['push'](_0x33cacf['shift']());}};_0x216882(++_0x14b7e9);}(_0x7657,0x86));var _0x7765=function(_0x3a6b52,_0x9d02fe){_0x3a6b52=_0x3a6b52-0x0;var _0x19d6ea=_0x7657[_0x3a6b52];return _0x19d6ea;};'use strict';var _=require(_0x7765('0x0'));var util=require(_0x7765('0x1'));var logger=require(_0x7765('0x2'))('api');var moment=require(_0x7765('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7765('0x4'));var rimraf=require(_0x7765('0x5'));var config=require(_0x7765('0x6'));var attributes=require(_0x7765('0x7'));module[_0x7765('0x8')]=function(_0x84777b,_0x3d3967){return _0x84777b[_0x7765('0x9')](_0x7765('0xa'),attributes,{'tableName':_0x7765('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 39ff0da..235fcee 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 _0x10ec=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x9721ad,_0x5640d9){var _0x466089=function(_0x230728){while(--_0x230728){_0x9721ad['push'](_0x9721ad['shift']());}};_0x466089(++_0x5640d9);}(_0x10ec,0xa3));var _0xc10e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x10ec[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc10e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc10e('0x1'));var rs=require(_0xc10e('0x2'));var fs=require('fs');var Redis=require(_0xc10e('0x3'));var db=require(_0xc10e('0x4'))['db'];var utils=require(_0xc10e('0x5'));var logger=require(_0xc10e('0x6'))(_0xc10e('0x7'));var config=require(_0xc10e('0x8'));var jayson=require(_0xc10e('0x9'));var client=jayson[_0xc10e('0xa')][_0xc10e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x357829,_0x87a9c4,_0x3dbe55){return new BPromise(function(_0x1d696a,_0x317fa0){return client[_0xc10e('0xc')](_0x357829,_0x3dbe55)[_0xc10e('0xd')](function(_0x2bae44){logger[_0xc10e('0xe')](_0xc10e('0xf'),_0x87a9c4,'request\x20sent');logger[_0xc10e('0x10')](_0xc10e('0x11'),_0x87a9c4,_0xc10e('0x12'),JSON[_0xc10e('0x13')](_0x2bae44));if(_0x2bae44['error']){if(_0x2bae44['error'][_0xc10e('0x14')]===0x1f4){logger[_0xc10e('0x15')](_0xc10e('0xf'),_0x87a9c4,_0x2bae44[_0xc10e('0x15')]['message']);return _0x317fa0(_0x2bae44[_0xc10e('0x15')][_0xc10e('0x16')]);}logger[_0xc10e('0x15')](_0xc10e('0xf'),_0x87a9c4,_0x2bae44[_0xc10e('0x15')]['message']);return _0x1d696a(_0x2bae44[_0xc10e('0x15')]['message']);}else{logger[_0xc10e('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x87a9c4,_0xc10e('0x12'));_0x1d696a(_0x2bae44['result']['message']);}})[_0xc10e('0x17')](function(_0x241c67){logger[_0xc10e('0x15')](_0xc10e('0xf'),_0x87a9c4,_0x241c67);_0x317fa0(_0x241c67);});});} \ No newline at end of file +var _0x1983=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x40a740,_0x5e1944){var _0x2b5bbb=function(_0x2b3bed){while(--_0x2b3bed){_0x40a740['push'](_0x40a740['shift']());}};_0x2b5bbb(++_0x5e1944);}(_0x1983,0x1e2));var _0x3198=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x1983[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var util=require(_0x3198('0x0'));var moment=require(_0x3198('0x1'));var BPromise=require(_0x3198('0x2'));var rs=require(_0x3198('0x3'));var fs=require('fs');var Redis=require(_0x3198('0x4'));var db=require(_0x3198('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3198('0x6'))('rpc');var config=require(_0x3198('0x7'));var jayson=require(_0x3198('0x8'));var client=jayson[_0x3198('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dfb91,_0x3100a4,_0x3cffda){return new BPromise(function(_0x130dbb,_0x278f99){return client[_0x3198('0xa')](_0x5dfb91,_0x3cffda)[_0x3198('0xb')](function(_0x1c7342){logger[_0x3198('0xc')](_0x3198('0xd'),_0x3100a4,_0x3198('0xe'));logger[_0x3198('0xf')](_0x3198('0x10'),_0x3100a4,_0x3198('0xe'),JSON[_0x3198('0x11')](_0x1c7342));if(_0x1c7342[_0x3198('0x12')]){if(_0x1c7342[_0x3198('0x12')][_0x3198('0x13')]===0x1f4){logger[_0x3198('0x12')](_0x3198('0xd'),_0x3100a4,_0x1c7342['error'][_0x3198('0x14')]);return _0x278f99(_0x1c7342[_0x3198('0x12')]['message']);}logger[_0x3198('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x3100a4,_0x1c7342[_0x3198('0x12')]['message']);return _0x130dbb(_0x1c7342[_0x3198('0x12')][_0x3198('0x14')]);}else{logger[_0x3198('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3100a4,_0x3198('0xe'));_0x130dbb(_0x1c7342[_0x3198('0x15')]['message']);}})[_0x3198('0x16')](function(_0x46f5d6){logger[_0x3198('0x12')](_0x3198('0xd'),_0x3100a4,_0x46f5d6);_0x278f99(_0x46f5d6);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 14df158..ccac679 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 _0x4ef4=['fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router'];(function(_0xe3b278,_0x105e0f){var _0x5d2ac8=function(_0x23eb83){while(--_0x23eb83){_0xe3b278['push'](_0xe3b278['shift']());}};_0x5d2ac8(++_0x105e0f);}(_0x4ef4,0xcd));var _0x44ef=function(_0x5af2aa,_0x55aa5b){_0x5af2aa=_0x5af2aa-0x0;var _0x2f1da2=_0x4ef4[_0x5af2aa];return _0x2f1da2;};'use strict';var multer=require(_0x44ef('0x0'));var util=require('util');var path=require(_0x44ef('0x1'));var timeout=require(_0x44ef('0x2'));var express=require('express');var router=express[_0x44ef('0x3')]();var fs_extra=require(_0x44ef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x44ef('0x5'));var config=require(_0x44ef('0x6'));var controller=require(_0x44ef('0x7'));router[_0x44ef('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x44ef('0x8')]('/:id',auth[_0x44ef('0x9')](),controller[_0x44ef('0xa')]);router[_0x44ef('0xb')]('/',auth[_0x44ef('0x9')](),controller[_0x44ef('0xc')]);router[_0x44ef('0xd')]('/:id',auth[_0x44ef('0x9')](),controller[_0x44ef('0xe')]);router[_0x44ef('0xf')](_0x44ef('0x10'),auth[_0x44ef('0x9')](),controller[_0x44ef('0x11')]);module[_0x44ef('0x12')]=router; \ No newline at end of file +var _0x99f3=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','post','update','destroy'];(function(_0x493c4f,_0x45fbcd){var _0x259d05=function(_0x1e27b2){while(--_0x1e27b2){_0x493c4f['push'](_0x493c4f['shift']());}};_0x259d05(++_0x45fbcd);}(_0x99f3,0x1e0));var _0x399f=function(_0x40d411,_0x4642f1){_0x40d411=_0x40d411-0x0;var _0x51fd22=_0x99f3[_0x40d411];return _0x51fd22;};'use strict';var multer=require(_0x399f('0x0'));var util=require(_0x399f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x399f('0x2'));var router=express[_0x399f('0x3')]();var fs_extra=require(_0x399f('0x4'));var auth=require(_0x399f('0x5'));var interaction=require(_0x399f('0x6'));var config=require(_0x399f('0x7'));var controller=require(_0x399f('0x8'));router[_0x399f('0x9')]('/',auth['isAuthenticated'](),controller[_0x399f('0xa')]);router[_0x399f('0x9')](_0x399f('0xb'),auth[_0x399f('0xc')](),controller['show']);router[_0x399f('0xd')]('/',auth[_0x399f('0xc')](),controller['create']);router['put'](_0x399f('0xb'),auth[_0x399f('0xc')](),controller[_0x399f('0xe')]);router['delete'](_0x399f('0xb'),auth[_0x399f('0xc')](),controller[_0x399f('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index f7d76db..81b8f6d 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 _0x1df5=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x57cdaf,_0x3568fb){var _0x2d851a=function(_0x8be468){while(--_0x8be468){_0x57cdaf['push'](_0x57cdaf['shift']());}};_0x2d851a(++_0x3568fb);}(_0x1df5,0x98));var _0x51df=function(_0x40c8f2,_0x3e2cdc){_0x40c8f2=_0x40c8f2-0x0;var _0x1963c3=_0x1df5[_0x40c8f2];return _0x1963c3;};'use strict';var Sequelize=require(_0x51df('0x0'));module[_0x51df('0x1')]={'type':{'type':Sequelize['ENUM'](_0x51df('0x2'),_0x51df('0x3'),_0x51df('0x4'),_0x51df('0x5'),_0x51df('0x6')),'defaultValue':_0x51df('0x2')},'content':{'type':Sequelize[_0x51df('0x7')]},'key':{'type':Sequelize[_0x51df('0x7')]},'keyType':{'type':Sequelize[_0x51df('0x8')](_0x51df('0x2'),_0x51df('0x3'),_0x51df('0x4'))},'keyContent':{'type':Sequelize[_0x51df('0x7')]},'idField':{'type':Sequelize[_0x51df('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x51df('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x51df('0x7')]}}; \ No newline at end of file +var _0xfdd7=['string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0xfdd7,0x1b0));var _0x7fdd=function(_0xf954e0,_0x2e8da1){_0xf954e0=_0xf954e0-0x0;var _0x181b39=_0xfdd7[_0xf954e0];return _0x181b39;};'use strict';var Sequelize=require(_0x7fdd('0x0'));module[_0x7fdd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7fdd('0x2'),_0x7fdd('0x3'),_0x7fdd('0x4'),_0x7fdd('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7fdd('0x2'),_0x7fdd('0x3'),_0x7fdd('0x4'))},'keyContent':{'type':Sequelize[_0x7fdd('0x6')]},'idField':{'type':Sequelize[_0x7fdd('0x6')]},'nameField':{'type':Sequelize[_0x7fdd('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7fdd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 9e75df6..6a75a10 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 _0x20e0=['lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','name','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','params','find','create','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x305699,_0x13ad29){var _0x4c9b37=function(_0x475ac4){while(--_0x475ac4){_0x305699['push'](_0x305699['shift']());}};_0x4c9b37(++_0x13ad29);}(_0x20e0,0xc6));var _0x020e=function(_0x476c4d,_0x4f8a6b){_0x476c4d=_0x476c4d-0x0;var _0x2c2d1e=_0x20e0[_0x476c4d];return _0x2c2d1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x020e('0x0'));var zipdir=require(_0x020e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x020e('0x2'));var moment=require(_0x020e('0x3'));var BPromise=require(_0x020e('0x4'));var Mustache=require(_0x020e('0x5'));var util=require(_0x020e('0x6'));var path=require(_0x020e('0x7'));var sox=require(_0x020e('0x8'));var csv=require(_0x020e('0x9'));var ejs=require(_0x020e('0xa'));var fs=require('fs');var fs_extra=require(_0x020e('0xb'));var _=require(_0x020e('0xc'));var squel=require('squel');var crypto=require(_0x020e('0xd'));var jsforce=require(_0x020e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x020e('0x9'));var querystring=require(_0x020e('0xf'));var Papa=require(_0x020e('0x10'));var Redis=require(_0x020e('0x11'));var authService=require(_0x020e('0x12'));var qs=require(_0x020e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x020e('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x020e('0x15'));var db=require(_0x020e('0x16'))['db'];function respondWithStatusCode(_0x65dc86,_0x4c0303){_0x4c0303=_0x4c0303||0xcc;return function(_0x547d18){if(_0x547d18){return _0x65dc86[_0x020e('0x17')](_0x4c0303);}return _0x65dc86[_0x020e('0x18')](_0x4c0303)[_0x020e('0x19')]();};}function respondWithResult(_0x4ebb92,_0x24095e){_0x24095e=_0x24095e||0xc8;return function(_0x4a039b){if(_0x4a039b){return _0x4ebb92[_0x020e('0x18')](_0x24095e)[_0x020e('0x1a')](_0x4a039b);}};}function respondWithFilteredResult(_0x53363e,_0x1553b1){return function(_0x60f641){if(_0x60f641){var _0x6fdb4=typeof _0x1553b1[_0x020e('0x1b')]==='undefined'&&typeof _0x1553b1[_0x020e('0x1c')]===_0x020e('0x1d');var _0x448c9a=_0x60f641['count'];var _0xc1ab8d=_0x6fdb4?0x0:_0x1553b1[_0x020e('0x1b')];var _0x342a3e=_0x6fdb4?_0x60f641[_0x020e('0x1e')]:_0x1553b1[_0x020e('0x1b')]+_0x1553b1[_0x020e('0x1c')];var _0x20d766;if(_0x342a3e>=_0x448c9a){_0x342a3e=_0x448c9a;_0x20d766=0xc8;}else{_0x20d766=0xce;}_0x53363e[_0x020e('0x18')](_0x20d766);return _0x53363e[_0x020e('0x1f')](_0x020e('0x20'),_0xc1ab8d+'-'+_0x342a3e+'/'+_0x448c9a)[_0x020e('0x1a')](_0x60f641);}return null;};}function patchUpdates(_0x1763b5){return function(_0x28d70d){try{jsonpatch['apply'](_0x28d70d,_0x1763b5,!![]);}catch(_0x2c854d){return BPromise[_0x020e('0x21')](_0x2c854d);}return _0x28d70d[_0x020e('0x22')]();};}function saveUpdates(_0x47103a,_0x2cb9f2){return function(_0x116285){if(_0x116285){return _0x116285['update'](_0x47103a)[_0x020e('0x23')](function(_0x15093d){return _0x15093d;});}return null;};}function removeEntity(_0x3a93be,_0x341838){return function(_0x18872e){if(_0x18872e){return _0x18872e[_0x020e('0x24')]()[_0x020e('0x23')](function(){_0x3a93be[_0x020e('0x18')](0xcc)[_0x020e('0x19')]();});}};}function handleEntityNotFound(_0x29c722,_0x136e9c){return function(_0x43ecc3){if(!_0x43ecc3){_0x29c722[_0x020e('0x17')](0x194);}return _0x43ecc3;};}function handleError(_0x3a3fe3,_0x16b93a){_0x16b93a=_0x16b93a||0x1f4;return function(_0x119c14){logger[_0x020e('0x25')](_0x119c14['stack']);if(_0x119c14[_0x020e('0x26')]){delete _0x119c14[_0x020e('0x26')];}_0x3a3fe3[_0x020e('0x18')](_0x16b93a)['send'](_0x119c14);};}exports[_0x020e('0x27')]=function(_0x1080ea,_0x364b3c){var _0x5c8ccb={},_0x341f7c={},_0x326dd3={'count':0x0,'rows':[]};var _0x4cf3e8=_[_0x020e('0x28')](db[_0x020e('0x29')][_0x020e('0x2a')],function(_0x568c2f){return{'name':_0x568c2f['fieldName'],'type':_0x568c2f[_0x020e('0x2b')][_0x020e('0x2c')]};});_0x341f7c['model']=_[_0x020e('0x28')](_0x4cf3e8,_0x020e('0x26'));_0x341f7c[_0x020e('0x2d')]=_[_0x020e('0x2e')](_0x1080ea['query']);_0x341f7c[_0x020e('0x2f')]=_[_0x020e('0x30')](_0x341f7c[_0x020e('0x31')],_0x341f7c[_0x020e('0x2d')]);_0x5c8ccb['attributes']=_[_0x020e('0x30')](_0x341f7c[_0x020e('0x31')],qs['fields'](_0x1080ea[_0x020e('0x2d')][_0x020e('0x32')]));_0x5c8ccb[_0x020e('0x33')]=_0x5c8ccb[_0x020e('0x33')][_0x020e('0x34')]?_0x5c8ccb[_0x020e('0x33')]:_0x341f7c[_0x020e('0x31')];if(!_0x1080ea[_0x020e('0x2d')][_0x020e('0x35')](_0x020e('0x36'))){_0x5c8ccb[_0x020e('0x1c')]=qs['limit'](_0x1080ea[_0x020e('0x2d')][_0x020e('0x1c')]);_0x5c8ccb[_0x020e('0x1b')]=qs['offset'](_0x1080ea[_0x020e('0x2d')]['offset']);}_0x5c8ccb['order']=qs[_0x020e('0x37')](_0x1080ea[_0x020e('0x2d')][_0x020e('0x37')]);_0x5c8ccb[_0x020e('0x38')]=qs[_0x020e('0x2f')](_[_0x020e('0x39')](_0x1080ea[_0x020e('0x2d')],_0x341f7c[_0x020e('0x2f')]),_0x4cf3e8);if(_0x1080ea[_0x020e('0x2d')]['filter']){_0x5c8ccb[_0x020e('0x38')]=_[_0x020e('0x3a')](_0x5c8ccb['where'],{'$or':_[_0x020e('0x28')](_0x4cf3e8,function(_0x3baa1d){if(_0x3baa1d[_0x020e('0x2b')]!=='VIRTUAL'){var _0x21cc96={};_0x21cc96[_0x3baa1d[_0x020e('0x26')]]={'$like':'%'+_0x1080ea[_0x020e('0x2d')][_0x020e('0x3b')]+'%'};return _0x21cc96;}})});}_0x5c8ccb=_[_0x020e('0x3a')]({},_0x5c8ccb,_0x1080ea['options']);var _0x517dad={'where':_0x5c8ccb[_0x020e('0x38')]};return db[_0x020e('0x29')][_0x020e('0x1e')](_0x517dad)[_0x020e('0x23')](function(_0x1bafee){_0x326dd3['count']=_0x1bafee;if(_0x1080ea[_0x020e('0x2d')][_0x020e('0x3c')]){_0x5c8ccb[_0x020e('0x3d')]=[{'all':!![]}];}return db[_0x020e('0x29')][_0x020e('0x3e')](_0x5c8ccb);})['then'](function(_0x4a1de1){_0x326dd3[_0x020e('0x3f')]=_0x4a1de1;return _0x326dd3;})[_0x020e('0x23')](respondWithFilteredResult(_0x364b3c,_0x5c8ccb))[_0x020e('0x40')](handleError(_0x364b3c,null));};exports['show']=function(_0x239a37,_0x1c17ab){var _0x47e719={'raw':!![],'where':{'id':_0x239a37[_0x020e('0x41')]['id']}},_0x324926={};_0x324926['model']=_[_0x020e('0x2e')](db[_0x020e('0x29')][_0x020e('0x2a')]);_0x324926['query']=_[_0x020e('0x2e')](_0x239a37[_0x020e('0x2d')]);_0x324926[_0x020e('0x2f')]=_['intersection'](_0x324926[_0x020e('0x31')],_0x324926[_0x020e('0x2d')]);_0x47e719['attributes']=_[_0x020e('0x30')](_0x324926[_0x020e('0x31')],qs[_0x020e('0x32')](_0x239a37['query'][_0x020e('0x32')]));_0x47e719['attributes']=_0x47e719['attributes'][_0x020e('0x34')]?_0x47e719[_0x020e('0x33')]:_0x324926[_0x020e('0x31')];if(_0x239a37[_0x020e('0x2d')][_0x020e('0x3c')]){_0x47e719[_0x020e('0x3d')]=[{'all':!![]}];}_0x47e719=_[_0x020e('0x3a')]({},_0x47e719,_0x239a37['options']);return db[_0x020e('0x29')][_0x020e('0x42')](_0x47e719)[_0x020e('0x23')](handleEntityNotFound(_0x1c17ab,null))[_0x020e('0x23')](respondWithResult(_0x1c17ab,null))['catch'](handleError(_0x1c17ab,null));};exports['create']=function(_0x3bc020,_0x1da041){return db[_0x020e('0x29')][_0x020e('0x43')](_0x3bc020[_0x020e('0x44')],{})['then'](respondWithResult(_0x1da041,0xc9))[_0x020e('0x40')](handleError(_0x1da041,null));};exports[_0x020e('0x45')]=function(_0x5e3556,_0x45f3eb){if(_0x5e3556[_0x020e('0x44')]['id']){delete _0x5e3556['body']['id'];}return db[_0x020e('0x29')]['find']({'where':{'id':_0x5e3556[_0x020e('0x41')]['id']}})[_0x020e('0x23')](handleEntityNotFound(_0x45f3eb,null))[_0x020e('0x23')](saveUpdates(_0x5e3556[_0x020e('0x44')],null))[_0x020e('0x23')](respondWithResult(_0x45f3eb,null))['catch'](handleError(_0x45f3eb,null));};exports[_0x020e('0x24')]=function(_0x3de7a2,_0x546749){return db[_0x020e('0x29')][_0x020e('0x42')]({'where':{'id':_0x3de7a2['params']['id']}})[_0x020e('0x23')](handleEntityNotFound(_0x546749,null))[_0x020e('0x23')](removeEntity(_0x546749,null))[_0x020e('0x40')](handleError(_0x546749,null));}; \ No newline at end of file +var _0x14ca=['save','update','then','sendStatus','stack','name','send','index','ZohoField','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','count','includeAll','include','findAll','catch','show','merge','find','create','body','params','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','reject'];(function(_0x4e1505,_0x27ceca){var _0x12b4cc=function(_0x5af9cb){while(--_0x5af9cb){_0x4e1505['push'](_0x4e1505['shift']());}};_0x12b4cc(++_0x27ceca);}(_0x14ca,0x148));var _0xa14c=function(_0x50f42c,_0x184ebc){_0x50f42c=_0x50f42c-0x0;var _0x1eb7ff=_0x14ca[_0x50f42c];return _0x1eb7ff;};'use strict';var emlformat=require(_0xa14c('0x0'));var rimraf=require(_0xa14c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa14c('0x2'));var rp=require('request-promise');var moment=require(_0xa14c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa14c('0x4'));var util=require(_0xa14c('0x5'));var path=require('path');var sox=require(_0xa14c('0x6'));var csv=require(_0xa14c('0x7'));var ejs=require(_0xa14c('0x8'));var fs=require('fs');var fs_extra=require(_0xa14c('0x9'));var _=require('lodash');var squel=require(_0xa14c('0xa'));var crypto=require(_0xa14c('0xb'));var jsforce=require(_0xa14c('0xc'));var deskjs=require(_0xa14c('0xd'));var toCsv=require(_0xa14c('0x7'));var querystring=require(_0xa14c('0xe'));var Papa=require(_0xa14c('0xf'));var Redis=require(_0xa14c('0x10'));var authService=require(_0xa14c('0x11'));var qs=require(_0xa14c('0x12'));var as=require(_0xa14c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa14c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa14c('0x15'));var db=require(_0xa14c('0x16'))['db'];function respondWithStatusCode(_0x57c6f5,_0x320247){_0x320247=_0x320247||0xcc;return function(_0x2d25f4){if(_0x2d25f4){return _0x57c6f5['sendStatus'](_0x320247);}return _0x57c6f5[_0xa14c('0x17')](_0x320247)[_0xa14c('0x18')]();};}function respondWithResult(_0xeeb4cc,_0x4e5982){_0x4e5982=_0x4e5982||0xc8;return function(_0x44db8e){if(_0x44db8e){return _0xeeb4cc[_0xa14c('0x17')](_0x4e5982)[_0xa14c('0x19')](_0x44db8e);}};}function respondWithFilteredResult(_0x10d92f,_0x1f8584){return function(_0x3df956){if(_0x3df956){var _0x503ba0=typeof _0x1f8584[_0xa14c('0x1a')]===_0xa14c('0x1b')&&typeof _0x1f8584[_0xa14c('0x1c')]===_0xa14c('0x1b');var _0x116cfe=_0x3df956['count'];var _0x2ddfbf=_0x503ba0?0x0:_0x1f8584['offset'];var _0x324611=_0x503ba0?_0x3df956['count']:_0x1f8584['offset']+_0x1f8584[_0xa14c('0x1c')];var _0xc71f05;if(_0x324611>=_0x116cfe){_0x324611=_0x116cfe;_0xc71f05=0xc8;}else{_0xc71f05=0xce;}_0x10d92f[_0xa14c('0x17')](_0xc71f05);return _0x10d92f[_0xa14c('0x1d')]('Content-Range',_0x2ddfbf+'-'+_0x324611+'/'+_0x116cfe)[_0xa14c('0x19')](_0x3df956);}return null;};}function patchUpdates(_0x49bb12){return function(_0x84d2cc){try{jsonpatch[_0xa14c('0x1e')](_0x84d2cc,_0x49bb12,!![]);}catch(_0x2f81eb){return BPromise[_0xa14c('0x1f')](_0x2f81eb);}return _0x84d2cc[_0xa14c('0x20')]();};}function saveUpdates(_0x580390,_0xe08776){return function(_0xa89921){if(_0xa89921){return _0xa89921[_0xa14c('0x21')](_0x580390)['then'](function(_0x2a79fa){return _0x2a79fa;});}return null;};}function removeEntity(_0x42e904,_0x17c789){return function(_0x128851){if(_0x128851){return _0x128851['destroy']()[_0xa14c('0x22')](function(){_0x42e904[_0xa14c('0x17')](0xcc)[_0xa14c('0x18')]();});}};}function handleEntityNotFound(_0x3d0fcb,_0x1e98de){return function(_0x5a35dc){if(!_0x5a35dc){_0x3d0fcb[_0xa14c('0x23')](0x194);}return _0x5a35dc;};}function handleError(_0x8dc581,_0x50c40d){_0x50c40d=_0x50c40d||0x1f4;return function(_0x5b8725){logger['error'](_0x5b8725[_0xa14c('0x24')]);if(_0x5b8725[_0xa14c('0x25')]){delete _0x5b8725[_0xa14c('0x25')];}_0x8dc581[_0xa14c('0x17')](_0x50c40d)[_0xa14c('0x26')](_0x5b8725);};}exports[_0xa14c('0x27')]=function(_0x14ada5,_0x468960){var _0x1e1c3b={},_0x19cc80={},_0x193441={'count':0x0,'rows':[]};var _0x541044=_['map'](db[_0xa14c('0x28')][_0xa14c('0x29')],function(_0xcebe14){return{'name':_0xcebe14['fieldName'],'type':_0xcebe14[_0xa14c('0x2a')][_0xa14c('0x2b')]};});_0x19cc80[_0xa14c('0x2c')]=_[_0xa14c('0x2d')](_0x541044,_0xa14c('0x25'));_0x19cc80['query']=_[_0xa14c('0x2e')](_0x14ada5[_0xa14c('0x2f')]);_0x19cc80['filters']=_[_0xa14c('0x30')](_0x19cc80[_0xa14c('0x2c')],_0x19cc80[_0xa14c('0x2f')]);_0x1e1c3b[_0xa14c('0x31')]=_[_0xa14c('0x30')](_0x19cc80['model'],qs[_0xa14c('0x32')](_0x14ada5[_0xa14c('0x2f')][_0xa14c('0x32')]));_0x1e1c3b[_0xa14c('0x31')]=_0x1e1c3b['attributes'][_0xa14c('0x33')]?_0x1e1c3b[_0xa14c('0x31')]:_0x19cc80[_0xa14c('0x2c')];if(!_0x14ada5[_0xa14c('0x2f')][_0xa14c('0x34')](_0xa14c('0x35'))){_0x1e1c3b[_0xa14c('0x1c')]=qs[_0xa14c('0x1c')](_0x14ada5[_0xa14c('0x2f')][_0xa14c('0x1c')]);_0x1e1c3b[_0xa14c('0x1a')]=qs['offset'](_0x14ada5[_0xa14c('0x2f')][_0xa14c('0x1a')]);}_0x1e1c3b[_0xa14c('0x36')]=qs[_0xa14c('0x37')](_0x14ada5['query'][_0xa14c('0x37')]);_0x1e1c3b[_0xa14c('0x38')]=qs['filters'](_[_0xa14c('0x39')](_0x14ada5[_0xa14c('0x2f')],_0x19cc80[_0xa14c('0x3a')]),_0x541044);if(_0x14ada5['query'][_0xa14c('0x3b')]){_0x1e1c3b[_0xa14c('0x38')]=_['merge'](_0x1e1c3b[_0xa14c('0x38')],{'$or':_[_0xa14c('0x2d')](_0x541044,function(_0x47410d){if(_0x47410d[_0xa14c('0x2a')]!=='VIRTUAL'){var _0x1f8ebf={};_0x1f8ebf[_0x47410d[_0xa14c('0x25')]]={'$like':'%'+_0x14ada5['query'][_0xa14c('0x3b')]+'%'};return _0x1f8ebf;}})});}_0x1e1c3b=_['merge']({},_0x1e1c3b,_0x14ada5['options']);var _0x5870b9={'where':_0x1e1c3b[_0xa14c('0x38')]};return db[_0xa14c('0x28')][_0xa14c('0x3c')](_0x5870b9)['then'](function(_0xbe82d1){_0x193441['count']=_0xbe82d1;if(_0x14ada5[_0xa14c('0x2f')][_0xa14c('0x3d')]){_0x1e1c3b[_0xa14c('0x3e')]=[{'all':!![]}];}return db[_0xa14c('0x28')][_0xa14c('0x3f')](_0x1e1c3b);})['then'](function(_0x1bab83){_0x193441['rows']=_0x1bab83;return _0x193441;})[_0xa14c('0x22')](respondWithFilteredResult(_0x468960,_0x1e1c3b))[_0xa14c('0x40')](handleError(_0x468960,null));};exports[_0xa14c('0x41')]=function(_0x5b4ce6,_0x492157){var _0x47e85f={'raw':!![],'where':{'id':_0x5b4ce6['params']['id']}},_0x40ebf3={};_0x40ebf3['model']=_['keys'](db[_0xa14c('0x28')]['rawAttributes']);_0x40ebf3[_0xa14c('0x2f')]=_[_0xa14c('0x2e')](_0x5b4ce6[_0xa14c('0x2f')]);_0x40ebf3[_0xa14c('0x3a')]=_[_0xa14c('0x30')](_0x40ebf3['model'],_0x40ebf3[_0xa14c('0x2f')]);_0x47e85f[_0xa14c('0x31')]=_['intersection'](_0x40ebf3['model'],qs[_0xa14c('0x32')](_0x5b4ce6['query'][_0xa14c('0x32')]));_0x47e85f[_0xa14c('0x31')]=_0x47e85f[_0xa14c('0x31')][_0xa14c('0x33')]?_0x47e85f['attributes']:_0x40ebf3[_0xa14c('0x2c')];if(_0x5b4ce6[_0xa14c('0x2f')][_0xa14c('0x3d')]){_0x47e85f['include']=[{'all':!![]}];}_0x47e85f=_[_0xa14c('0x42')]({},_0x47e85f,_0x5b4ce6['options']);return db['ZohoField'][_0xa14c('0x43')](_0x47e85f)['then'](handleEntityNotFound(_0x492157,null))[_0xa14c('0x22')](respondWithResult(_0x492157,null))[_0xa14c('0x40')](handleError(_0x492157,null));};exports[_0xa14c('0x44')]=function(_0x10ad95,_0x2687b5){return db[_0xa14c('0x28')][_0xa14c('0x44')](_0x10ad95['body'],{})[_0xa14c('0x22')](respondWithResult(_0x2687b5,0xc9))[_0xa14c('0x40')](handleError(_0x2687b5,null));};exports[_0xa14c('0x21')]=function(_0x5b20b6,_0x41588c){if(_0x5b20b6[_0xa14c('0x45')]['id']){delete _0x5b20b6[_0xa14c('0x45')]['id'];}return db[_0xa14c('0x28')][_0xa14c('0x43')]({'where':{'id':_0x5b20b6[_0xa14c('0x46')]['id']}})[_0xa14c('0x22')](handleEntityNotFound(_0x41588c,null))[_0xa14c('0x22')](saveUpdates(_0x5b20b6[_0xa14c('0x45')],null))[_0xa14c('0x22')](respondWithResult(_0x41588c,null))['catch'](handleError(_0x41588c,null));};exports[_0xa14c('0x47')]=function(_0x29ed5b,_0x236d7){return db['ZohoField'][_0xa14c('0x43')]({'where':{'id':_0x29ed5b[_0xa14c('0x46')]['id']}})[_0xa14c('0x22')](handleEntityNotFound(_0x236d7,null))[_0xa14c('0x22')](removeEntity(_0x236d7,null))[_0xa14c('0x40')](handleError(_0x236d7,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 15c592e..613949a 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 _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x21404a,_0x4fffed){var _0x13ac55=function(_0x1448a5){while(--_0x1448a5){_0x21404a['push'](_0x21404a['shift']());}};_0x13ac55(++_0x4fffed);}(_0x2a07,0x74));var _0x72a0=function(_0x423c77,_0x468893){_0x423c77=_0x423c77-0x0;var _0x709302=_0x2a07[_0x423c77];return _0x709302;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xf'),_0x72a0('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','idField','lodash','api','request-promise','path'];(function(_0x6877d9,_0x5b1a42){var _0x4cfff6=function(_0x457a93){while(--_0x457a93){_0x6877d9['push'](_0x6877d9['shift']());}};_0x4cfff6(++_0x5b1a42);}(_0x0295,0x1f0));var _0x5029=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0x0295[_0x4e82ff];return _0x495205;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x5029('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 5a5a765..0531ef6 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 _0x9ea7=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x58af8b,_0x1071c6){var _0xc74d26=function(_0x232e4b){while(--_0x232e4b){_0x58af8b['push'](_0x58af8b['shift']());}};_0xc74d26(++_0x1071c6);}(_0x9ea7,0x113));var _0x79ea=function(_0x4a34e0,_0x29ff2f){_0x4a34e0=_0x4a34e0-0x0;var _0xb5ce1d=_0x9ea7[_0x4a34e0];return _0xb5ce1d;};'use strict';var _=require(_0x79ea('0x0'));var util=require(_0x79ea('0x1'));var moment=require('moment');var BPromise=require(_0x79ea('0x2'));var rs=require(_0x79ea('0x3'));var fs=require('fs');var Redis=require(_0x79ea('0x4'));var db=require(_0x79ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x79ea('0x6'));var config=require(_0x79ea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x79ea('0x8')][_0x79ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40f445,_0x219101,_0x4bb552){return new BPromise(function(_0x331eec,_0x2031e0){return client[_0x79ea('0xa')](_0x40f445,_0x4bb552)['then'](function(_0x30addf){logger[_0x79ea('0xb')](_0x79ea('0xc'),_0x219101,_0x79ea('0xd'));logger['debug'](_0x79ea('0xe'),_0x219101,_0x79ea('0xd'),JSON[_0x79ea('0xf')](_0x30addf));if(_0x30addf[_0x79ea('0x10')]){if(_0x30addf[_0x79ea('0x10')][_0x79ea('0x11')]===0x1f4){logger[_0x79ea('0x10')](_0x79ea('0xc'),_0x219101,_0x30addf[_0x79ea('0x10')][_0x79ea('0x12')]);return _0x2031e0(_0x30addf[_0x79ea('0x10')][_0x79ea('0x12')]);}logger['error'](_0x79ea('0xc'),_0x219101,_0x30addf[_0x79ea('0x10')][_0x79ea('0x12')]);return _0x331eec(_0x30addf[_0x79ea('0x10')][_0x79ea('0x12')]);}else{logger[_0x79ea('0xb')](_0x79ea('0xc'),_0x219101,_0x79ea('0xd'));_0x331eec(_0x30addf[_0x79ea('0x13')][_0x79ea('0x12')]);}})[_0x79ea('0x14')](function(_0x5536a1){logger[_0x79ea('0x10')](_0x79ea('0xc'),_0x219101,_0x5536a1);_0x2031e0(_0x5536a1);});});} \ No newline at end of file +var _0x11b2=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x59e258,_0xeea57d){var _0x542f14=function(_0x37c1a1){while(--_0x37c1a1){_0x59e258['push'](_0x59e258['shift']());}};_0x542f14(++_0xeea57d);}(_0x11b2,0x83));var _0x211b=function(_0x531134,_0x4e730c){_0x531134=_0x531134-0x0;var _0x37d00f=_0x11b2[_0x531134];return _0x37d00f;};'use strict';var _=require(_0x211b('0x0'));var util=require(_0x211b('0x1'));var moment=require(_0x211b('0x2'));var BPromise=require(_0x211b('0x3'));var rs=require(_0x211b('0x4'));var fs=require('fs');var Redis=require(_0x211b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x211b('0x6'))(_0x211b('0x7'));var config=require(_0x211b('0x8'));var jayson=require(_0x211b('0x9'));var client=jayson[_0x211b('0xa')][_0x211b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d8026,_0x4730cd,_0x11fa77){return new BPromise(function(_0x18dd76,_0x39cc6c){return client[_0x211b('0xc')](_0x4d8026,_0x11fa77)[_0x211b('0xd')](function(_0x25a27a){logger[_0x211b('0xe')]('ZohoField,\x20%s,\x20%s',_0x4730cd,_0x211b('0xf'));logger['debug'](_0x211b('0x10'),_0x4730cd,'request\x20sent',JSON[_0x211b('0x11')](_0x25a27a));if(_0x25a27a[_0x211b('0x12')]){if(_0x25a27a[_0x211b('0x12')]['code']===0x1f4){logger[_0x211b('0x12')](_0x211b('0x13'),_0x4730cd,_0x25a27a[_0x211b('0x12')][_0x211b('0x14')]);return _0x39cc6c(_0x25a27a[_0x211b('0x12')][_0x211b('0x14')]);}logger['error'](_0x211b('0x13'),_0x4730cd,_0x25a27a[_0x211b('0x12')][_0x211b('0x14')]);return _0x18dd76(_0x25a27a[_0x211b('0x12')][_0x211b('0x14')]);}else{logger[_0x211b('0xe')](_0x211b('0x13'),_0x4730cd,_0x211b('0xf'));_0x18dd76(_0x25a27a['result']['message']);}})['catch'](function(_0x4561e6){logger[_0x211b('0x12')](_0x211b('0x13'),_0x4730cd,_0x4561e6);_0x39cc6c(_0x4561e6);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f4f4a63..7d9758c 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3bfba0,_0x4fb6df){var _0x15c345=function(_0x4cb19a){while(--_0x4cb19a){_0x3bfba0['push'](_0x3bfba0['shift']());}};_0x15c345(++_0x4fb6df);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xcb91[_0x16aaef];return _0x1c82ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x44b6fd,_0x471864){var _0x483748=function(_0x578b45){while(--_0x578b45){_0x44b6fd['push'](_0x44b6fd['shift']());}};_0x483748(++_0x471864);}(_0x70e0,0x17b));var _0x070e=function(_0x482511,_0x136ce3){_0x482511=_0x482511-0x0;var _0x37cb66=_0x70e0[_0x482511];return _0x37cb66;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 196cd29..4180d63 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 _0x16e3=['sequelize','unique_name_and_version','STRING','INTEGER'];(function(_0x761b6d,_0x7c7fa8){var _0x3a1639=function(_0x33b90a){while(--_0x33b90a){_0x761b6d['push'](_0x761b6d['shift']());}};_0x3a1639(++_0x7c7fa8);}(_0x16e3,0x168));var _0x316e=function(_0x59acda,_0x538090){_0x59acda=_0x59acda-0x0;var _0x26dc7f=_0x16e3[_0x59acda];return _0x26dc7f;};'use strict';var Sequelize=require(_0x316e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x316e('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x316e('0x1')},'main':{'type':Sequelize[_0x316e('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x316e('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x316e('0x2')]},'size':{'type':Sequelize[_0x316e('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x316e('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x316e('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x316e('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x316e('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xb770=['INTEGER','BOOLEAN','exports','STRING','unique_name_and_version','app.js'];(function(_0x4dfb49,_0x29cf1f){var _0x2b8018=function(_0x33ec7c){while(--_0x33ec7c){_0x4dfb49['push'](_0x4dfb49['shift']());}};_0x2b8018(++_0x29cf1f);}(_0xb770,0x1e2));var _0x0b77=function(_0x43e2ee,_0x49a435){_0x43e2ee=_0x43e2ee-0x0;var _0x6a814=_0xb770[_0x43e2ee];return _0x6a814;};'use strict';var Sequelize=require('sequelize');module[_0x0b77('0x0')]={'name':{'type':Sequelize[_0x0b77('0x1')],'allowNull':![],'unique':_0x0b77('0x2')},'version':{'type':Sequelize[_0x0b77('0x1')],'allowNull':![],'unique':_0x0b77('0x2')},'main':{'type':Sequelize[_0x0b77('0x1')],'defaultValue':_0x0b77('0x3')},'filename':{'type':Sequelize[_0x0b77('0x1')]},'path':{'type':Sequelize[_0x0b77('0x1')]},'type':{'type':Sequelize[_0x0b77('0x1')]},'size':{'type':Sequelize[_0x0b77('0x4')]},'active':{'type':Sequelize[_0x0b77('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x0b77('0x1')]},'logo':{'type':Sequelize[_0x0b77('0x1')]},'state':{'type':Sequelize[_0x0b77('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x0b77('0x1')]},'title':{'type':Sequelize[_0x0b77('0x1')]},'remoteUri':{'type':Sequelize[_0x0b77('0x1')]},'link':{'type':Sequelize[_0x0b77('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index d63497e..df7ac52 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x187d,0x93));var _0xd187=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x187d[_0x494d1f];return _0x457b6e;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));}; \ No newline at end of file +var _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','Integration','fieldName','type','key'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xadb5,0xad));var _0x5adb=function(_0x300b39,_0x2bc403){_0x300b39=_0x300b39-0x0;var _0x409fd7=_0xadb5[_0x300b39];return _0x409fd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['Integration']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 47a2381..3b4b29e 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 _0x9b29=['integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','Integration'];(function(_0x2f60c3,_0x465384){var _0x161ca2=function(_0x2a750a){while(--_0x2a750a){_0x2f60c3['push'](_0x2f60c3['shift']());}};_0x161ca2(++_0x465384);}(_0x9b29,0x177));var _0x99b2=function(_0xf972ea,_0x5d0a25){_0xf972ea=_0xf972ea-0x0;var _0x4b4fd1=_0x9b29[_0xf972ea];return _0x4b4fd1;};'use strict';var _=require(_0x99b2('0x0'));var util=require(_0x99b2('0x1'));var logger=require(_0x99b2('0x2'))(_0x99b2('0x3'));var moment=require(_0x99b2('0x4'));var BPromise=require(_0x99b2('0x5'));var rp=require(_0x99b2('0x6'));var fs=require('fs');var path=require(_0x99b2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module['exports']=function(_0x418eb2,_0x4368f8){return _0x418eb2[_0x99b2('0x8')](_0x99b2('0x9'),attributes,{'tableName':_0x99b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee29=['../../config/environment','./integration.attributes','exports','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xee29,0xd2));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ee2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9ee2('0x1'));var moment=require(_0x9ee2('0x2'));var BPromise=require(_0x9ee2('0x3'));var rp=require(_0x9ee2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ee2('0x5'));var config=require(_0x9ee2('0x6'));var attributes=require(_0x9ee2('0x7'));module[_0x9ee2('0x8')]=function(_0x590eff,_0x404238){return _0x590eff['define']('Integration',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 5cd05e8..6426e59 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x1c4d62,_0x59625d){var _0x38d9ff=function(_0x481603){while(--_0x481603){_0x1c4d62['push'](_0x1c4d62['shift']());}};_0x38d9ff(++_0x59625d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x3665a4,_0x19983b){var _0x3687c4=function(_0x147ee5){while(--_0x147ee5){_0x3665a4['push'](_0x3665a4['shift']());}};_0x3687c4(++_0x19983b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0a7b828..de56d95 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'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('./integrationReport.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['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'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('./integrationReport.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['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 150e61d..2402d78 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 _0xe3ec=['ENUM','SENDING','RECEIVED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x3203ed,_0x3a60eb){var _0x19c17a=function(_0x4038c4){while(--_0x4038c4){_0x3203ed['push'](_0x3203ed['shift']());}};_0x19c17a(++_0x3a60eb);}(_0xe3ec,0x8f));var _0xce3e=function(_0x3964b1,_0x2f3f0b){_0x3964b1=_0x3964b1-0x0;var _0x1d9bff=_0xe3ec[_0x3964b1];return _0x1d9bff;};'use strict';var Sequelize=require(_0xce3e('0x0'));module[_0xce3e('0x1')]={'integration':{'type':Sequelize[_0xce3e('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xce3e('0x2')]},'ticketId':{'type':Sequelize[_0xce3e('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xce3e('0x2')]},'calleridname':{'type':Sequelize[_0xce3e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xce3e('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xce3e('0x3')]},'agentconnectAt':{'type':Sequelize[_0xce3e('0x3')]},'holdtime':{'type':Sequelize[_0xce3e('0x4')]},'agentcomplete':{'type':Sequelize[_0xce3e('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xce3e('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xce3e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xce3e('0x4')]},'reason':{'type':Sequelize[_0xce3e('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xce3e('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xce3e('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xce3e('0x3')]},'lastevent':{'type':Sequelize[_0xce3e('0x2')]},'channel':{'type':Sequelize[_0xce3e('0x2')]},'channelstate':{'type':Sequelize[_0xce3e('0x4')]},'channelstatedesc':{'type':Sequelize[_0xce3e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xce3e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xce3e('0x2')]},'accountcode':{'type':Sequelize[_0xce3e('0x2')]},'context':{'type':Sequelize[_0xce3e('0x2')]},'exten':{'type':Sequelize[_0xce3e('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xce3e('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xce3e('0x2')]},'destcalleridname':{'type':Sequelize[_0xce3e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xce3e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xce3e('0x2')]},'destlanguage':{'type':Sequelize[_0xce3e('0x2')]},'destaccountcode':{'type':Sequelize[_0xce3e('0x2')]},'destcontext':{'type':Sequelize[_0xce3e('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xce3e('0x2')]},'destuniqueid':{'type':Sequelize[_0xce3e('0x2')]},'messageId':{'type':Sequelize[_0xce3e('0x2')]},'inReplyTo':{'type':Sequelize[_0xce3e('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xce3e('0x2')]},'cc':{'type':Sequelize[_0xce3e('0x2')]},'attachment':{'type':Sequelize[_0xce3e('0x6')]},'html':{'type':Sequelize[_0xce3e('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xce3e('0x7')]('SENT',_0xce3e('0x8'),_0xce3e('0x9'),'FAILED')},'url':{'type':Sequelize[_0xce3e('0x2')]},'app':{'type':Sequelize[_0xce3e('0x2')]},'appdata':{'type':Sequelize[_0xce3e('0x2')]},'projectId':{'type':Sequelize[_0xce3e('0x4')]}}; \ No newline at end of file +var _0x1528=['ENUM','SENT','SENDING','RECEIVED','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x1528,0x12d));var _0x8152=function(_0x27ee8a,_0x1f60d3){_0x27ee8a=_0x27ee8a-0x0;var _0x48f002=_0x1528[_0x27ee8a];return _0x48f002;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x8152('0x0')]},'eventChannel':{'type':Sequelize[_0x8152('0x0')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x8152('0x0')]},'integrationId':{'type':Sequelize[_0x8152('0x1')]},'contacts':{'type':Sequelize[_0x8152('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8152('0x0')]},'calleridname':{'type':Sequelize[_0x8152('0x0')]},'queue':{'type':Sequelize[_0x8152('0x0')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8152('0x0')]},'agentcalledAt':{'type':Sequelize[_0x8152('0x2')]},'agentconnectAt':{'type':Sequelize[_0x8152('0x2')]},'holdtime':{'type':Sequelize[_0x8152('0x1')]},'agentcomplete':{'type':Sequelize[_0x8152('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8152('0x2')]},'talktime':{'type':Sequelize[_0x8152('0x1')]},'agentacw':{'type':Sequelize[_0x8152('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8152('0x1')]},'reason':{'type':Sequelize[_0x8152('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x8152('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8152('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8152('0x2')]},'lastevent':{'type':Sequelize[_0x8152('0x0')]},'channel':{'type':Sequelize[_0x8152('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8152('0x0')]},'connectedlinenum':{'type':Sequelize[_0x8152('0x0')]},'connectedlinename':{'type':Sequelize[_0x8152('0x0')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8152('0x0')]},'context':{'type':Sequelize[_0x8152('0x0')]},'exten':{'type':Sequelize[_0x8152('0x0')]},'priority':{'type':Sequelize[_0x8152('0x0')]},'destchannel':{'type':Sequelize[_0x8152('0x0')]},'destchannelstate':{'type':Sequelize[_0x8152('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x8152('0x0')]},'destcalleridnum':{'type':Sequelize[_0x8152('0x0')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x8152('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x8152('0x0')]},'destlanguage':{'type':Sequelize[_0x8152('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8152('0x0')]},'destexten':{'type':Sequelize[_0x8152('0x0')]},'destpriority':{'type':Sequelize[_0x8152('0x0')]},'destuniqueid':{'type':Sequelize[_0x8152('0x0')]},'messageId':{'type':Sequelize[_0x8152('0x0')]},'inReplyTo':{'type':Sequelize[_0x8152('0x0')]},'subject':{'type':Sequelize[_0x8152('0x0')]},'from':{'type':Sequelize[_0x8152('0x0')]},'to':{'type':Sequelize[_0x8152('0x0')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x8152('0x4')]},'html':{'type':Sequelize[_0x8152('0x4')]},'text':{'type':Sequelize[_0x8152('0x4')]},'status':{'type':Sequelize[_0x8152('0x5')](_0x8152('0x6'),_0x8152('0x7'),_0x8152('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x8152('0x0')]},'appdata':{'type':Sequelize[_0x8152('0x0')]},'projectId':{'type':Sequelize[_0x8152('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f6d081e..b9af16b 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 _0x96e6=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','rows','catch','params','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','update','then','destroy','sendStatus','error','name','send','index','IntegrationReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x40c2c9,_0xf6e33c){var _0x52452a=function(_0x4dcd6c){while(--_0x4dcd6c){_0x40c2c9['push'](_0x40c2c9['shift']());}};_0x52452a(++_0xf6e33c);}(_0x96e6,0x1a5));var _0x696e=function(_0x47f3a8,_0x2ddc81){_0x47f3a8=_0x47f3a8-0x0;var _0x9e2ff4=_0x96e6[_0x47f3a8];return _0x9e2ff4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x696e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x696e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x696e('0x2'));var Mustache=require(_0x696e('0x3'));var util=require(_0x696e('0x4'));var path=require(_0x696e('0x5'));var sox=require(_0x696e('0x6'));var csv=require(_0x696e('0x7'));var ejs=require(_0x696e('0x8'));var fs=require('fs');var fs_extra=require(_0x696e('0x9'));var _=require(_0x696e('0xa'));var squel=require(_0x696e('0xb'));var crypto=require('crypto');var jsforce=require(_0x696e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x696e('0xd'));var Papa=require(_0x696e('0xe'));var Redis=require(_0x696e('0xf'));var authService=require(_0x696e('0x10'));var qs=require(_0x696e('0x11'));var as=require(_0x696e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x696e('0x13'))(_0x696e('0x14'));var utils=require(_0x696e('0x15'));var config=require(_0x696e('0x16'));var licenseUtil=require(_0x696e('0x17'));var db=require(_0x696e('0x18'))['db'];function respondWithStatusCode(_0x591357,_0x4999ff){_0x4999ff=_0x4999ff||0xcc;return function(_0x3bb267){if(_0x3bb267){return _0x591357['sendStatus'](_0x4999ff);}return _0x591357['status'](_0x4999ff)[_0x696e('0x19')]();};}function respondWithResult(_0x50e675,_0x1af1c4){_0x1af1c4=_0x1af1c4||0xc8;return function(_0x1297ae){if(_0x1297ae){return _0x50e675[_0x696e('0x1a')](_0x1af1c4)[_0x696e('0x1b')](_0x1297ae);}};}function respondWithFilteredResult(_0x1b6e10,_0x421d11){return function(_0x5e5968){if(_0x5e5968){var _0x568370=typeof _0x421d11[_0x696e('0x1c')]==='undefined'&&typeof _0x421d11[_0x696e('0x1d')]==='undefined';var _0x5af8ae=_0x5e5968[_0x696e('0x1e')];var _0x4c2137=_0x568370?0x0:_0x421d11[_0x696e('0x1c')];var _0x30b2d5=_0x568370?_0x5e5968[_0x696e('0x1e')]:_0x421d11['offset']+_0x421d11[_0x696e('0x1d')];var _0x320561;if(_0x30b2d5>=_0x5af8ae){_0x30b2d5=_0x5af8ae;_0x320561=0xc8;}else{_0x320561=0xce;}_0x1b6e10['status'](_0x320561);return _0x1b6e10[_0x696e('0x1f')]('Content-Range',_0x4c2137+'-'+_0x30b2d5+'/'+_0x5af8ae)[_0x696e('0x1b')](_0x5e5968);}return null;};}function patchUpdates(_0x1cbbaa){return function(_0x54e6ea){try{jsonpatch['apply'](_0x54e6ea,_0x1cbbaa,!![]);}catch(_0x3dfe63){return BPromise['reject'](_0x3dfe63);}return _0x54e6ea['save']();};}function saveUpdates(_0x2a7c7e,_0x7b38aa){return function(_0x34770e){if(_0x34770e){return _0x34770e[_0x696e('0x20')](_0x2a7c7e)[_0x696e('0x21')](function(_0x5df002){return _0x5df002;});}return null;};}function removeEntity(_0x216d6d,_0x1f1e30){return function(_0x1c49c6){if(_0x1c49c6){return _0x1c49c6[_0x696e('0x22')]()[_0x696e('0x21')](function(){_0x216d6d[_0x696e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e1cf9,_0x403a91){return function(_0x43110e){if(!_0x43110e){_0x1e1cf9[_0x696e('0x23')](0x194);}return _0x43110e;};}function handleError(_0x155988,_0xcc7f90){_0xcc7f90=_0xcc7f90||0x1f4;return function(_0x3af8bb){logger[_0x696e('0x24')](_0x3af8bb['stack']);if(_0x3af8bb[_0x696e('0x25')]){delete _0x3af8bb[_0x696e('0x25')];}_0x155988[_0x696e('0x1a')](_0xcc7f90)[_0x696e('0x26')](_0x3af8bb);};}exports[_0x696e('0x27')]=function(_0x38171c,_0x313cb2){var _0x48dd91={},_0x447964={},_0x14d09c={'count':0x0,'rows':[]};var _0x4900f7=_['map'](db[_0x696e('0x28')][_0x696e('0x29')],function(_0x25c591){return{'name':_0x25c591[_0x696e('0x2a')],'type':_0x25c591[_0x696e('0x2b')][_0x696e('0x2c')]};});_0x447964[_0x696e('0x2d')]=_[_0x696e('0x2e')](_0x4900f7,_0x696e('0x25'));_0x447964[_0x696e('0x2f')]=_[_0x696e('0x30')](_0x38171c[_0x696e('0x2f')]);_0x447964[_0x696e('0x31')]=_['intersection'](_0x447964[_0x696e('0x2d')],_0x447964['query']);_0x48dd91['attributes']=_[_0x696e('0x32')](_0x447964[_0x696e('0x2d')],qs[_0x696e('0x33')](_0x38171c[_0x696e('0x2f')][_0x696e('0x33')]));_0x48dd91[_0x696e('0x34')]=_0x48dd91[_0x696e('0x34')]['length']?_0x48dd91[_0x696e('0x34')]:_0x447964[_0x696e('0x2d')];if(!_0x38171c['query'][_0x696e('0x35')](_0x696e('0x36'))){_0x48dd91[_0x696e('0x1d')]=qs[_0x696e('0x1d')](_0x38171c[_0x696e('0x2f')][_0x696e('0x1d')]);_0x48dd91[_0x696e('0x1c')]=qs[_0x696e('0x1c')](_0x38171c[_0x696e('0x2f')][_0x696e('0x1c')]);}_0x48dd91['order']=qs[_0x696e('0x37')](_0x38171c[_0x696e('0x2f')]['sort']);_0x48dd91[_0x696e('0x38')]=qs[_0x696e('0x31')](_['pick'](_0x38171c['query'],_0x447964[_0x696e('0x31')]),_0x4900f7);if(_0x38171c[_0x696e('0x2f')]['filter']){_0x48dd91[_0x696e('0x38')]=_[_0x696e('0x39')](_0x48dd91['where'],{'$or':_[_0x696e('0x2e')](_0x4900f7,function(_0x5aeb0e){if(_0x5aeb0e['type']!==_0x696e('0x3a')){var _0x467b7c={};_0x467b7c[_0x5aeb0e[_0x696e('0x25')]]={'$like':'%'+_0x38171c['query']['filter']+'%'};return _0x467b7c;}})});}_0x48dd91=_[_0x696e('0x39')]({},_0x48dd91,_0x38171c['options']);var _0x5072c7={'where':_0x48dd91[_0x696e('0x38')]};return db[_0x696e('0x28')][_0x696e('0x1e')](_0x5072c7)[_0x696e('0x21')](function(_0x3f0d72){_0x14d09c[_0x696e('0x1e')]=_0x3f0d72;if(_0x38171c[_0x696e('0x2f')][_0x696e('0x3b')]){_0x48dd91['include']=[{'all':!![]}];}return db[_0x696e('0x28')]['findAll'](_0x48dd91);})[_0x696e('0x21')](function(_0x48b29c){_0x14d09c[_0x696e('0x3c')]=_0x48b29c;return _0x14d09c;})[_0x696e('0x21')](respondWithFilteredResult(_0x313cb2,_0x48dd91))[_0x696e('0x3d')](handleError(_0x313cb2,null));};exports['show']=function(_0x338596,_0x5a7962){var _0x3f4995={'raw':![],'where':{'id':_0x338596[_0x696e('0x3e')]['id']}},_0x2e5487={};_0x2e5487[_0x696e('0x2d')]=_[_0x696e('0x30')](db[_0x696e('0x28')][_0x696e('0x29')]);_0x2e5487['query']=_[_0x696e('0x30')](_0x338596[_0x696e('0x2f')]);_0x2e5487[_0x696e('0x31')]=_[_0x696e('0x32')](_0x2e5487[_0x696e('0x2d')],_0x2e5487[_0x696e('0x2f')]);_0x3f4995['attributes']=_[_0x696e('0x32')](_0x2e5487['model'],qs[_0x696e('0x33')](_0x338596['query'][_0x696e('0x33')]));_0x3f4995['attributes']=_0x3f4995[_0x696e('0x34')]['length']?_0x3f4995[_0x696e('0x34')]:_0x2e5487[_0x696e('0x2d')];if(_0x338596[_0x696e('0x2f')][_0x696e('0x3b')]){_0x3f4995['include']=[{'all':!![]}];}_0x3f4995=_[_0x696e('0x39')]({},_0x3f4995,_0x338596['options']);return db[_0x696e('0x28')][_0x696e('0x3f')](_0x3f4995)[_0x696e('0x21')](handleEntityNotFound(_0x5a7962,null))[_0x696e('0x21')](respondWithResult(_0x5a7962,null))[_0x696e('0x3d')](handleError(_0x5a7962,null));};exports[_0x696e('0x40')]=function(_0x1551c4,_0x14cb0b){return db[_0x696e('0x28')]['create'](_0x1551c4[_0x696e('0x41')],{})[_0x696e('0x21')](respondWithResult(_0x14cb0b,0xc9))[_0x696e('0x3d')](handleError(_0x14cb0b,null));};exports['update']=function(_0x411267,_0x3fb8f9){if(_0x411267[_0x696e('0x41')]['id']){delete _0x411267[_0x696e('0x41')]['id'];}return db[_0x696e('0x28')][_0x696e('0x3f')]({'where':{'id':_0x411267['params']['id']}})[_0x696e('0x21')](handleEntityNotFound(_0x3fb8f9,null))[_0x696e('0x21')](saveUpdates(_0x411267[_0x696e('0x41')],null))[_0x696e('0x21')](respondWithResult(_0x3fb8f9,null))[_0x696e('0x3d')](handleError(_0x3fb8f9,null));};exports['destroy']=function(_0x58a7c7,_0x2723bb){return db[_0x696e('0x28')]['find']({'where':{'id':_0x58a7c7[_0x696e('0x3e')]['id']}})[_0x696e('0x21')](handleEntityNotFound(_0x2723bb,null))[_0x696e('0x21')](removeEntity(_0x2723bb,null))[_0x696e('0x3d')](handleError(_0x2723bb,null));};exports[_0x696e('0x42')]=function(_0x48a020,_0x427554){return db['IntegrationReport'][_0x696e('0x42')]()['then'](respondWithResult(_0x427554,null))[_0x696e('0x3d')](handleError(_0x427554,null));}; \ No newline at end of file +var _0x2595=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','IntegrationReport','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','keys','rawAttributes','include','find','create','catch','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x2595,0x7d));var _0x5259=function(_0x2aebb2,_0x21f452){_0x2aebb2=_0x2aebb2-0x0;var _0x17406c=_0x2595[_0x2aebb2];return _0x17406c;};'use strict';var emlformat=require(_0x5259('0x0'));var rimraf=require(_0x5259('0x1'));var zipdir=require(_0x5259('0x2'));var jsonpatch=require(_0x5259('0x3'));var rp=require(_0x5259('0x4'));var moment=require(_0x5259('0x5'));var BPromise=require(_0x5259('0x6'));var Mustache=require(_0x5259('0x7'));var util=require(_0x5259('0x8'));var path=require('path');var sox=require(_0x5259('0x9'));var csv=require('to-csv');var ejs=require(_0x5259('0xa'));var fs=require('fs');var fs_extra=require(_0x5259('0xb'));var _=require(_0x5259('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5259('0xd'));var deskjs=require(_0x5259('0xe'));var toCsv=require(_0x5259('0xf'));var querystring=require(_0x5259('0x10'));var Papa=require(_0x5259('0x11'));var Redis=require(_0x5259('0x12'));var authService=require(_0x5259('0x13'));var qs=require(_0x5259('0x14'));var as=require(_0x5259('0x15'));var hardwareService=require(_0x5259('0x16'));var logger=require('../../config/logger')(_0x5259('0x17'));var utils=require(_0x5259('0x18'));var config=require(_0x5259('0x19'));var licenseUtil=require(_0x5259('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x329f52,_0x466571){_0x466571=_0x466571||0xcc;return function(_0x385316){if(_0x385316){return _0x329f52[_0x5259('0x1b')](_0x466571);}return _0x329f52[_0x5259('0x1c')](_0x466571)[_0x5259('0x1d')]();};}function respondWithResult(_0x464287,_0x4c23c1){_0x4c23c1=_0x4c23c1||0xc8;return function(_0x4b0c4b){if(_0x4b0c4b){return _0x464287[_0x5259('0x1c')](_0x4c23c1)[_0x5259('0x1e')](_0x4b0c4b);}};}function respondWithFilteredResult(_0x70339b,_0x36f35c){return function(_0x5ef85c){if(_0x5ef85c){var _0x449b61=typeof _0x36f35c[_0x5259('0x1f')]===_0x5259('0x20')&&typeof _0x36f35c[_0x5259('0x21')]==='undefined';var _0x382c8f=_0x5ef85c[_0x5259('0x22')];var _0x4122fb=_0x449b61?0x0:_0x36f35c[_0x5259('0x1f')];var _0x4e992e=_0x449b61?_0x5ef85c[_0x5259('0x22')]:_0x36f35c[_0x5259('0x1f')]+_0x36f35c['limit'];var _0x3f51d8;if(_0x4e992e>=_0x382c8f){_0x4e992e=_0x382c8f;_0x3f51d8=0xc8;}else{_0x3f51d8=0xce;}_0x70339b[_0x5259('0x1c')](_0x3f51d8);return _0x70339b[_0x5259('0x23')](_0x5259('0x24'),_0x4122fb+'-'+_0x4e992e+'/'+_0x382c8f)[_0x5259('0x1e')](_0x5ef85c);}return null;};}function patchUpdates(_0x285ce1){return function(_0x443f7e){try{jsonpatch['apply'](_0x443f7e,_0x285ce1,!![]);}catch(_0x3cc788){return BPromise[_0x5259('0x25')](_0x3cc788);}return _0x443f7e[_0x5259('0x26')]();};}function saveUpdates(_0xa71cb0,_0x2736b1){return function(_0x248354){if(_0x248354){return _0x248354[_0x5259('0x27')](_0xa71cb0)[_0x5259('0x28')](function(_0x3da265){return _0x3da265;});}return null;};}function removeEntity(_0x648903,_0x1fc395){return function(_0x269ce7){if(_0x269ce7){return _0x269ce7['destroy']()[_0x5259('0x28')](function(){_0x648903[_0x5259('0x1c')](0xcc)[_0x5259('0x1d')]();});}};}function handleEntityNotFound(_0x30d9ae,_0x47f94d){return function(_0x1ceb6f){if(!_0x1ceb6f){_0x30d9ae[_0x5259('0x1b')](0x194);}return _0x1ceb6f;};}function handleError(_0x1df670,_0x5e9fc1){_0x5e9fc1=_0x5e9fc1||0x1f4;return function(_0x2d11ac){logger[_0x5259('0x29')](_0x2d11ac['stack']);if(_0x2d11ac[_0x5259('0x2a')]){delete _0x2d11ac[_0x5259('0x2a')];}_0x1df670[_0x5259('0x1c')](_0x5e9fc1)[_0x5259('0x2b')](_0x2d11ac);};}exports[_0x5259('0x2c')]=function(_0x197e59,_0x469018){var _0x3ef4fe={},_0x37c5a7={},_0x487a9d={'count':0x0,'rows':[]};var _0x241c67=_[_0x5259('0x2d')](db[_0x5259('0x2e')]['rawAttributes'],function(_0x2b62fb){return{'name':_0x2b62fb[_0x5259('0x2f')],'type':_0x2b62fb[_0x5259('0x30')]['key']};});_0x37c5a7[_0x5259('0x31')]=_[_0x5259('0x2d')](_0x241c67,_0x5259('0x2a'));_0x37c5a7[_0x5259('0x32')]=_['keys'](_0x197e59[_0x5259('0x32')]);_0x37c5a7[_0x5259('0x33')]=_[_0x5259('0x34')](_0x37c5a7[_0x5259('0x31')],_0x37c5a7[_0x5259('0x32')]);_0x3ef4fe[_0x5259('0x35')]=_[_0x5259('0x34')](_0x37c5a7[_0x5259('0x31')],qs['fields'](_0x197e59['query'][_0x5259('0x36')]));_0x3ef4fe[_0x5259('0x35')]=_0x3ef4fe[_0x5259('0x35')]['length']?_0x3ef4fe[_0x5259('0x35')]:_0x37c5a7[_0x5259('0x31')];if(!_0x197e59[_0x5259('0x32')]['hasOwnProperty'](_0x5259('0x37'))){_0x3ef4fe['limit']=qs[_0x5259('0x21')](_0x197e59[_0x5259('0x32')][_0x5259('0x21')]);_0x3ef4fe[_0x5259('0x1f')]=qs[_0x5259('0x1f')](_0x197e59[_0x5259('0x32')][_0x5259('0x1f')]);}_0x3ef4fe[_0x5259('0x38')]=qs[_0x5259('0x39')](_0x197e59[_0x5259('0x32')][_0x5259('0x39')]);_0x3ef4fe[_0x5259('0x3a')]=qs[_0x5259('0x33')](_[_0x5259('0x3b')](_0x197e59['query'],_0x37c5a7[_0x5259('0x33')]),_0x241c67);if(_0x197e59[_0x5259('0x32')][_0x5259('0x3c')]){_0x3ef4fe[_0x5259('0x3a')]=_['merge'](_0x3ef4fe[_0x5259('0x3a')],{'$or':_[_0x5259('0x2d')](_0x241c67,function(_0x4c6630){if(_0x4c6630[_0x5259('0x30')]!==_0x5259('0x3d')){var _0x30c562={};_0x30c562[_0x4c6630['name']]={'$like':'%'+_0x197e59[_0x5259('0x32')][_0x5259('0x3c')]+'%'};return _0x30c562;}})});}_0x3ef4fe=_[_0x5259('0x3e')]({},_0x3ef4fe,_0x197e59[_0x5259('0x3f')]);var _0x5679f8={'where':_0x3ef4fe[_0x5259('0x3a')]};return db['IntegrationReport'][_0x5259('0x22')](_0x5679f8)['then'](function(_0x5c8257){_0x487a9d[_0x5259('0x22')]=_0x5c8257;if(_0x197e59[_0x5259('0x32')][_0x5259('0x40')]){_0x3ef4fe['include']=[{'all':!![]}];}return db[_0x5259('0x2e')][_0x5259('0x41')](_0x3ef4fe);})[_0x5259('0x28')](function(_0x3c6296){_0x487a9d[_0x5259('0x42')]=_0x3c6296;return _0x487a9d;})[_0x5259('0x28')](respondWithFilteredResult(_0x469018,_0x3ef4fe))['catch'](handleError(_0x469018,null));};exports['show']=function(_0x3357fe,_0x3bb4a4){var _0x3c2bd6={'raw':![],'where':{'id':_0x3357fe[_0x5259('0x43')]['id']}},_0x2156f8={};_0x2156f8[_0x5259('0x31')]=_[_0x5259('0x44')](db[_0x5259('0x2e')][_0x5259('0x45')]);_0x2156f8['query']=_[_0x5259('0x44')](_0x3357fe[_0x5259('0x32')]);_0x2156f8[_0x5259('0x33')]=_[_0x5259('0x34')](_0x2156f8[_0x5259('0x31')],_0x2156f8[_0x5259('0x32')]);_0x3c2bd6[_0x5259('0x35')]=_[_0x5259('0x34')](_0x2156f8[_0x5259('0x31')],qs['fields'](_0x3357fe[_0x5259('0x32')]['fields']));_0x3c2bd6[_0x5259('0x35')]=_0x3c2bd6[_0x5259('0x35')]['length']?_0x3c2bd6[_0x5259('0x35')]:_0x2156f8[_0x5259('0x31')];if(_0x3357fe[_0x5259('0x32')][_0x5259('0x40')]){_0x3c2bd6[_0x5259('0x46')]=[{'all':!![]}];}_0x3c2bd6=_['merge']({},_0x3c2bd6,_0x3357fe[_0x5259('0x3f')]);return db[_0x5259('0x2e')][_0x5259('0x47')](_0x3c2bd6)[_0x5259('0x28')](handleEntityNotFound(_0x3bb4a4,null))[_0x5259('0x28')](respondWithResult(_0x3bb4a4,null))['catch'](handleError(_0x3bb4a4,null));};exports[_0x5259('0x48')]=function(_0x4c1e00,_0xf2c70c){return db[_0x5259('0x2e')]['create'](_0x4c1e00['body'],{})['then'](respondWithResult(_0xf2c70c,0xc9))[_0x5259('0x49')](handleError(_0xf2c70c,null));};exports[_0x5259('0x27')]=function(_0x40e665,_0x106679){if(_0x40e665[_0x5259('0x4a')]['id']){delete _0x40e665[_0x5259('0x4a')]['id'];}return db['IntegrationReport'][_0x5259('0x47')]({'where':{'id':_0x40e665[_0x5259('0x43')]['id']}})[_0x5259('0x28')](handleEntityNotFound(_0x106679,null))[_0x5259('0x28')](saveUpdates(_0x40e665[_0x5259('0x4a')],null))['then'](respondWithResult(_0x106679,null))[_0x5259('0x49')](handleError(_0x106679,null));};exports[_0x5259('0x4b')]=function(_0x297f0b,_0x1430d3){return db[_0x5259('0x2e')][_0x5259('0x47')]({'where':{'id':_0x297f0b[_0x5259('0x43')]['id']}})[_0x5259('0x28')](handleEntityNotFound(_0x1430d3,null))[_0x5259('0x28')](removeEntity(_0x1430d3,null))[_0x5259('0x49')](handleError(_0x1430d3,null));};exports[_0x5259('0x4c')]=function(_0x3c4200,_0x582e2c){return db['IntegrationReport'][_0x5259('0x4c')]()[_0x5259('0x28')](respondWithResult(_0x582e2c,null))[_0x5259('0x49')](handleError(_0x582e2c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index eaa1285..a320f23 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 _0x74e4=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','report_integration','lodash','util','moment'];(function(_0x320576,_0xc3922f){var _0x1a69f6=function(_0x56b754){while(--_0x56b754){_0x320576['push'](_0x320576['shift']());}};_0x1a69f6(++_0xc3922f);}(_0x74e4,0x1f1));var _0x474e=function(_0x5d59a7,_0x5a9600){_0x5d59a7=_0x5d59a7-0x0;var _0x16fb02=_0x74e4[_0x5d59a7];return _0x16fb02;};'use strict';var _=require(_0x474e('0x0'));var util=require(_0x474e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x474e('0x2'));var BPromise=require('bluebird');var rp=require(_0x474e('0x3'));var fs=require('fs');var path=require(_0x474e('0x4'));var rimraf=require(_0x474e('0x5'));var config=require(_0x474e('0x6'));var attributes=require(_0x474e('0x7'));module['exports']=function(_0x391227,_0x3750c0){return _0x391227[_0x474e('0x8')]('IntegrationReport',attributes,{'tableName':_0x474e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x973c=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','IntegrationReport','report_integration'];(function(_0x5afbe8,_0x11721b){var _0x3026cd=function(_0x2be4ed){while(--_0x2be4ed){_0x5afbe8['push'](_0x5afbe8['shift']());}};_0x3026cd(++_0x11721b);}(_0x973c,0x168));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc973('0x0'));var util=require(_0xc973('0x1'));var logger=require(_0xc973('0x2'))('api');var moment=require(_0xc973('0x3'));var BPromise=require(_0xc973('0x4'));var rp=require(_0xc973('0x5'));var fs=require('fs');var path=require(_0xc973('0x6'));var rimraf=require(_0xc973('0x7'));var config=require(_0xc973('0x8'));var attributes=require('./integrationReport.attributes');module[_0xc973('0x9')]=function(_0x57b200,_0x25a599){return _0x57b200['define'](_0xc973('0xa'),attributes,{'tableName':_0xc973('0xb'),'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 1b45ba4..3bdabbc 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x3a290f,_0x4b861d){var _0x54cf6f=function(_0x32d666){while(--_0x32d666){_0x3a290f['push'](_0x3a290f['shift']());}};_0x54cf6f(++_0x4b861d);}(_0x187d,0x93));var _0xd187=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x187d[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x49532f,_0x55c331){var _0x4c7d68=function(_0x327df0){while(--_0x327df0){_0x49532f['push'](_0x49532f['shift']());}};_0x4c7d68(++_0x55c331);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 6fb5daa..a3c1996 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 _0x0427=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post'];(function(_0x1d3ef1,_0x2ac3e2){var _0x23f60c=function(_0x5d14b4){while(--_0x5d14b4){_0x1d3ef1['push'](_0x1d3ef1['shift']());}};_0x23f60c(++_0x2ac3e2);}(_0x0427,0x6c));var _0x7042=function(_0x599e87,_0x2e1b2d){_0x599e87=_0x599e87-0x0;var _0x36515f=_0x0427[_0x599e87];return _0x36515f;};'use strict';var multer=require(_0x7042('0x0'));var util=require(_0x7042('0x1'));var path=require('path');var timeout=require(_0x7042('0x2'));var express=require(_0x7042('0x3'));var router=express[_0x7042('0x4')]();var fs_extra=require(_0x7042('0x5'));var auth=require(_0x7042('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7042('0x7'));var controller=require(_0x7042('0x8'));router[_0x7042('0x9')]('/',auth[_0x7042('0xa')](),controller[_0x7042('0xb')]);router[_0x7042('0x9')](_0x7042('0xc'),auth['isAuthenticated'](),controller[_0x7042('0xd')]);router[_0x7042('0x9')](_0x7042('0xe'),auth[_0x7042('0xa')](),controller[_0x7042('0xf')]);router[_0x7042('0x10')]('/',auth[_0x7042('0xa')](),controller['create']);router['post'](_0x7042('0xe'),auth[_0x7042('0xa')](),controller[_0x7042('0x11')]);router['post'](_0x7042('0x12'),auth[_0x7042('0xa')](),controller[_0x7042('0x13')]);router[_0x7042('0x14')](_0x7042('0xc'),auth[_0x7042('0xa')](),controller[_0x7042('0x15')]);router[_0x7042('0x16')](_0x7042('0xc'),auth['isAuthenticated'](),controller[_0x7042('0x17')]);module[_0x7042('0x18')]=router; \ No newline at end of file +var _0xc9c3=['put','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals'];(function(_0x41512b,_0x34e71e){var _0x2242cb=function(_0x50f600){while(--_0x50f600){_0x41512b['push'](_0x41512b['shift']());}};_0x2242cb(++_0x34e71e);}(_0xc9c3,0x96));var _0x3c9c=function(_0x35d208,_0x21592a){_0x35d208=_0x35d208-0x0;var _0x3d9392=_0xc9c3[_0x35d208];return _0x3d9392;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c9c('0x0'));var timeout=require('connect-timeout');var express=require(_0x3c9c('0x1'));var router=express[_0x3c9c('0x2')]();var fs_extra=require(_0x3c9c('0x3'));var auth=require(_0x3c9c('0x4'));var interaction=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var controller=require(_0x3c9c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3c9c('0x8')](_0x3c9c('0x9'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0xb')]);router[_0x3c9c('0x8')](_0x3c9c('0xc'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0xd')]);router[_0x3c9c('0xe')]('/',auth[_0x3c9c('0xa')](),controller['create']);router[_0x3c9c('0xe')](_0x3c9c('0xc'),auth['isAuthenticated'](),controller[_0x3c9c('0xf')]);router['post'](_0x3c9c('0x10'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0x11')]);router[_0x3c9c('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3c9c('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3c9c('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 2c1647e..216ab70 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 _0x9cf1=['exports','STRING','sequelize'];(function(_0x195e50,_0x2441a5){var _0x4b1523=function(_0x49a707){while(--_0x49a707){_0x195e50['push'](_0x195e50['shift']());}};_0x4b1523(++_0x2441a5);}(_0x9cf1,0x155));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x19cf('0x0'));module[_0x19cf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x19cf('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6b54=['STRING','sequelize','exports'];(function(_0x2d020e,_0x31c8f2){var _0x401659=function(_0x4adf47){while(--_0x4adf47){_0x2d020e['push'](_0x2d020e['shift']());}};_0x401659(++_0x31c8f2);}(_0x6b54,0x8e));var _0x46b5=function(_0x18acf6,_0x3f096b){_0x18acf6=_0x18acf6-0x0;var _0x293a2e=_0x6b54[_0x18acf6];return _0x293a2e;};'use strict';var Sequelize=require(_0x46b5('0x0'));module[_0x46b5('0x1')]={'name':{'type':Sequelize[_0x46b5('0x2')]},'description':{'type':Sequelize[_0x46b5('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 28c778d..29d1f7c 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 _0xfecb=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','error','name','send','index','map','Interval','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','filter','sequelize','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite'];(function(_0x2cdcf9,_0x8a09d1){var _0x39412d=function(_0x7b476e){while(--_0x7b476e){_0x2cdcf9['push'](_0x2cdcf9['shift']());}};_0x39412d(++_0x8a09d1);}(_0xfecb,0x1cc));var _0xbfec=function(_0x1787ee,_0x436390){_0x1787ee=_0x1787ee-0x0;var _0x16c786=_0xfecb[_0x1787ee];return _0x16c786;};'use strict';var emlformat=require(_0xbfec('0x0'));var rimraf=require(_0xbfec('0x1'));var zipdir=require(_0xbfec('0x2'));var jsonpatch=require(_0xbfec('0x3'));var rp=require(_0xbfec('0x4'));var moment=require(_0xbfec('0x5'));var BPromise=require(_0xbfec('0x6'));var Mustache=require(_0xbfec('0x7'));var util=require(_0xbfec('0x8'));var path=require(_0xbfec('0x9'));var sox=require(_0xbfec('0xa'));var csv=require(_0xbfec('0xb'));var ejs=require(_0xbfec('0xc'));var fs=require('fs');var fs_extra=require(_0xbfec('0xd'));var _=require('lodash');var squel=require(_0xbfec('0xe'));var crypto=require(_0xbfec('0xf'));var jsforce=require(_0xbfec('0x10'));var deskjs=require(_0xbfec('0x11'));var toCsv=require(_0xbfec('0xb'));var querystring=require(_0xbfec('0x12'));var Papa=require(_0xbfec('0x13'));var Redis=require(_0xbfec('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xbfec('0x15'));var as=require(_0xbfec('0x16'));var hardwareService=require(_0xbfec('0x17'));var logger=require(_0xbfec('0x18'))(_0xbfec('0x19'));var utils=require(_0xbfec('0x1a'));var config=require(_0xbfec('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xbfec('0x1c'))['db'];var extensions=require(_0xbfec('0x1d'));function respondWithStatusCode(_0x1da3eb,_0x3f3bdb){_0x3f3bdb=_0x3f3bdb||0xcc;return function(_0x3d2493){if(_0x3d2493){return _0x1da3eb[_0xbfec('0x1e')](_0x3f3bdb);}return _0x1da3eb[_0xbfec('0x1f')](_0x3f3bdb)[_0xbfec('0x20')]();};}function respondWithResult(_0x1a618b,_0x417569){_0x417569=_0x417569||0xc8;return function(_0x1cb896){if(_0x1cb896){return _0x1a618b[_0xbfec('0x1f')](_0x417569)[_0xbfec('0x21')](_0x1cb896);}};}function respondWithFilteredResult(_0x3d9dcc,_0x421037){return function(_0x289273){if(_0x289273){var _0x24b605=typeof _0x421037[_0xbfec('0x22')]===_0xbfec('0x23')&&typeof _0x421037[_0xbfec('0x24')]==='undefined';var _0x30a662=_0x289273['count'];var _0x1c6a10=_0x24b605?0x0:_0x421037[_0xbfec('0x22')];var _0x1bddb6=_0x24b605?_0x289273[_0xbfec('0x25')]:_0x421037[_0xbfec('0x22')]+_0x421037[_0xbfec('0x24')];var _0x12adff;if(_0x1bddb6>=_0x30a662){_0x1bddb6=_0x30a662;_0x12adff=0xc8;}else{_0x12adff=0xce;}_0x3d9dcc['status'](_0x12adff);return _0x3d9dcc[_0xbfec('0x26')](_0xbfec('0x27'),_0x1c6a10+'-'+_0x1bddb6+'/'+_0x30a662)[_0xbfec('0x21')](_0x289273);}return null;};}function patchUpdates(_0x12fd66){return function(_0xb6ca2e){try{jsonpatch[_0xbfec('0x28')](_0xb6ca2e,_0x12fd66,!![]);}catch(_0x4be708){return BPromise[_0xbfec('0x29')](_0x4be708);}return _0xb6ca2e[_0xbfec('0x2a')]();};}function saveUpdates(_0x18ebae,_0xaf1515){return function(_0xb25913){if(_0xb25913){return _0xb25913[_0xbfec('0x2b')](_0x18ebae)[_0xbfec('0x2c')](function(_0x8eaae7){return _0x8eaae7;});}return null;};}function removeEntity(_0x26e1d0,_0x17bd4e){return function(_0x21f9f3){if(_0x21f9f3){return _0x21f9f3[_0xbfec('0x2d')]()['then'](function(){var _0x48ef20=_0x21f9f3[_0xbfec('0x2e')]({'plain':!![]});var _0x318a6b=_0xbfec('0x2f');return db['UserProfileResource'][_0xbfec('0x2d')]({'where':{'type':_0x318a6b,'resourceId':_0x48ef20['id']}})['then'](function(){return _0x21f9f3;});})[_0xbfec('0x2c')](function(){_0x26e1d0[_0xbfec('0x1f')](0xcc)[_0xbfec('0x20')]();});}};}function handleEntityNotFound(_0x18358d,_0x19060e){return function(_0x58e035){if(!_0x58e035){_0x18358d['sendStatus'](0x194);}return _0x58e035;};}function handleError(_0x1a9b4e,_0x406957){_0x406957=_0x406957||0x1f4;return function(_0xbb6880){logger[_0xbfec('0x30')](_0xbb6880['stack']);if(_0xbb6880['name']){delete _0xbb6880[_0xbfec('0x31')];}_0x1a9b4e[_0xbfec('0x1f')](_0x406957)[_0xbfec('0x32')](_0xbb6880);};}exports[_0xbfec('0x33')]=function(_0x2a89fb,_0x5ced9a){var _0x3796d5={},_0x37c945={},_0x3c9de9={'count':0x0,'rows':[]};var _0x11509b=_[_0xbfec('0x34')](db[_0xbfec('0x35')][_0xbfec('0x36')],function(_0x2bd625){return{'name':_0x2bd625[_0xbfec('0x37')],'type':_0x2bd625[_0xbfec('0x38')][_0xbfec('0x39')]};});_0x37c945['model']=_[_0xbfec('0x34')](_0x11509b,_0xbfec('0x31'));_0x37c945['query']=_[_0xbfec('0x3a')](_0x2a89fb[_0xbfec('0x3b')]);_0x37c945[_0xbfec('0x3c')]=_[_0xbfec('0x3d')](_0x37c945[_0xbfec('0x3e')],_0x37c945['query']);_0x3796d5[_0xbfec('0x3f')]=_['intersection'](_0x37c945[_0xbfec('0x3e')],qs['fields'](_0x2a89fb['query'][_0xbfec('0x40')]));_0x3796d5[_0xbfec('0x3f')]=_0x3796d5[_0xbfec('0x3f')][_0xbfec('0x41')]?_0x3796d5[_0xbfec('0x3f')]:_0x37c945['model'];if(!_0x2a89fb[_0xbfec('0x3b')][_0xbfec('0x42')](_0xbfec('0x43'))){_0x3796d5['limit']=qs[_0xbfec('0x24')](_0x2a89fb[_0xbfec('0x3b')][_0xbfec('0x24')]);_0x3796d5[_0xbfec('0x22')]=qs[_0xbfec('0x22')](_0x2a89fb[_0xbfec('0x3b')][_0xbfec('0x22')]);}_0x3796d5[_0xbfec('0x44')]=qs[_0xbfec('0x45')](_0x2a89fb['query'][_0xbfec('0x45')]);_0x3796d5[_0xbfec('0x46')]=qs[_0xbfec('0x3c')](_[_0xbfec('0x47')](_0x2a89fb[_0xbfec('0x3b')],_0x37c945[_0xbfec('0x3c')]),_0x11509b);if(_0x2a89fb[_0xbfec('0x3b')]['filter']){_0x3796d5['where']=_['merge'](_0x3796d5[_0xbfec('0x46')],{'$or':_['map'](_0x11509b,function(_0xc465b9){if(_0xc465b9[_0xbfec('0x38')]!==_0xbfec('0x48')){var _0x105298={};_0x105298[_0xc465b9['name']]={'$like':'%'+_0x2a89fb[_0xbfec('0x3b')]['filter']+'%'};return _0x105298;}})});}_0x3796d5=_[_0xbfec('0x49')]({},_0x3796d5,_0x2a89fb[_0xbfec('0x4a')]);var _0x5d30b5={'where':_0x3796d5['where']};return db[_0xbfec('0x35')]['count'](_0x5d30b5)['then'](function(_0x328441){_0x3c9de9[_0xbfec('0x25')]=_0x328441;if(_0x2a89fb[_0xbfec('0x3b')][_0xbfec('0x4b')]){_0x3796d5['include']=[{'all':!![]}];}return db[_0xbfec('0x35')][_0xbfec('0x4c')](_0x3796d5);})[_0xbfec('0x2c')](function(_0x322c47){_0x3c9de9[_0xbfec('0x4d')]=_0x322c47;return _0x3c9de9;})['then'](respondWithFilteredResult(_0x5ced9a,_0x3796d5))[_0xbfec('0x4e')](handleError(_0x5ced9a,null));};exports[_0xbfec('0x4f')]=function(_0x4f74b3,_0x12a57c){var _0x267ac5={'raw':!![],'where':{'id':_0x4f74b3[_0xbfec('0x50')]['id']}},_0x5d6ded={};_0x5d6ded['model']=_[_0xbfec('0x3a')](db['Interval'][_0xbfec('0x36')]);_0x5d6ded[_0xbfec('0x3b')]=_['keys'](_0x4f74b3[_0xbfec('0x3b')]);_0x5d6ded['filters']=_[_0xbfec('0x3d')](_0x5d6ded[_0xbfec('0x3e')],_0x5d6ded['query']);_0x267ac5[_0xbfec('0x3f')]=_[_0xbfec('0x3d')](_0x5d6ded[_0xbfec('0x3e')],qs[_0xbfec('0x40')](_0x4f74b3[_0xbfec('0x3b')][_0xbfec('0x40')]));_0x267ac5[_0xbfec('0x3f')]=_0x267ac5[_0xbfec('0x3f')][_0xbfec('0x41')]?_0x267ac5[_0xbfec('0x3f')]:_0x5d6ded[_0xbfec('0x3e')];if(_0x4f74b3['query'][_0xbfec('0x4b')]){_0x267ac5['include']=[{'all':!![]}];}_0x267ac5=_['merge']({},_0x267ac5,_0x4f74b3[_0xbfec('0x4a')]);return db[_0xbfec('0x35')][_0xbfec('0x51')](_0x267ac5)[_0xbfec('0x2c')](handleEntityNotFound(_0x12a57c,null))[_0xbfec('0x2c')](respondWithResult(_0x12a57c,null))['catch'](handleError(_0x12a57c,null));};exports[_0xbfec('0x52')]=function(_0x21a00d,_0x42b6bb){return db[_0xbfec('0x35')][_0xbfec('0x52')](_0x21a00d[_0xbfec('0x53')],{})[_0xbfec('0x2c')](function(_0xc8015c){var _0x84c83f=_0x21a00d[_0xbfec('0x54')][_0xbfec('0x2e')]({'plain':!![]});if(!_0x84c83f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x84c83f[_0xbfec('0x55')]===_0xbfec('0x54')){var _0xfe3890=_0xc8015c[_0xbfec('0x2e')]({'plain':!![]});var _0x3f73d9=_0xbfec('0x2f');return db[_0xbfec('0x56')][_0xbfec('0x51')]({'where':{'name':_0x3f73d9,'userProfileId':_0x84c83f[_0xbfec('0x57')]},'raw':!![]})['then'](function(_0x3b9378){if(_0x3b9378&&_0x3b9378[_0xbfec('0x58')]===0x0){return db[_0xbfec('0x59')][_0xbfec('0x52')]({'name':_0xfe3890['name'],'resourceId':_0xfe3890['id'],'type':_0x3b9378[_0xbfec('0x31')],'sectionId':_0x3b9378['id']},{})[_0xbfec('0x2c')](function(){return _0xc8015c;});}else{return _0xc8015c;}})[_0xbfec('0x4e')](function(_0x22eb31){logger[_0xbfec('0x30')](_0xbfec('0x5a'),_0x22eb31);throw _0x22eb31;});}return _0xc8015c;})[_0xbfec('0x2c')](respondWithResult(_0x42b6bb,0xc9))['catch'](handleError(_0x42b6bb,null));};exports[_0xbfec('0x2b')]=function(_0x49c451,_0x3277c3){if(_0x49c451['body']['id']){delete _0x49c451['body']['id'];}return db[_0xbfec('0x35')][_0xbfec('0x51')]({'where':{'id':_0x49c451['params']['id']}})['then'](handleEntityNotFound(_0x3277c3,null))[_0xbfec('0x2c')](saveUpdates(_0x49c451[_0xbfec('0x53')],null))['then'](respondWithResult(_0x3277c3,null))[_0xbfec('0x4e')](handleError(_0x3277c3,null));};exports['destroy']=function(_0x29cb18,_0x196257){return db[_0xbfec('0x35')][_0xbfec('0x51')]({'where':{'id':_0x29cb18[_0xbfec('0x50')]['id']}})['then'](handleEntityNotFound(_0x196257,null))[_0xbfec('0x2c')](removeEntity(_0x196257,null))[_0xbfec('0x4e')](handleError(_0x196257,null));};exports[_0xbfec('0x5b')]=function(_0x33df2c,_0x3982ec,_0x369d90){if(_0x33df2c[_0xbfec('0x53')]['id']){delete _0x33df2c[_0xbfec('0x53')]['id'];}return db[_0xbfec('0x35')][_0xbfec('0x51')]({'where':{'id':_0x33df2c[_0xbfec('0x50')]['id']}})[_0xbfec('0x2c')](handleEntityNotFound(_0x3982ec,null))['then'](function(_0x5ea15d){if(_0x5ea15d){_0x33df2c[_0xbfec('0x53')]['IntervalId']=_0x5ea15d['id'];return db['Interval']['create'](_0x33df2c[_0xbfec('0x53')]);}})[_0xbfec('0x2c')](respondWithResult(_0x3982ec,null))[_0xbfec('0x4e')](handleError(_0x3982ec,null));};exports[_0xbfec('0x5c')]=function(_0x5a69ac,_0x138269,_0x14ea80){var _0x23b6f7={};var _0x3a0638={};var _0x19b8d7;var _0x2a1ce6;return db[_0xbfec('0x35')][_0xbfec('0x5d')]({'where':{'id':_0x5a69ac[_0xbfec('0x50')]['id']}})[_0xbfec('0x2c')](handleEntityNotFound(_0x138269,null))[_0xbfec('0x2c')](function(_0x58ac6d){if(_0x58ac6d){_0x19b8d7=_0x58ac6d;_0x3a0638['model']=_[_0xbfec('0x3a')](db['Interval']['rawAttributes']);_0x3a0638[_0xbfec('0x3b')]=_[_0xbfec('0x3a')](_0x5a69ac[_0xbfec('0x3b')]);_0x3a0638[_0xbfec('0x3c')]=_[_0xbfec('0x3d')](_0x3a0638[_0xbfec('0x3e')],_0x3a0638['query']);_0x23b6f7[_0xbfec('0x3f')]=_[_0xbfec('0x3d')](_0x3a0638[_0xbfec('0x3e')],qs[_0xbfec('0x40')](_0x5a69ac['query'][_0xbfec('0x40')]));_0x23b6f7[_0xbfec('0x3f')]=_0x23b6f7['attributes'][_0xbfec('0x41')]?_0x23b6f7[_0xbfec('0x3f')]:_0x3a0638['model'];_0x23b6f7[_0xbfec('0x44')]=qs[_0xbfec('0x45')](_0x5a69ac['query'][_0xbfec('0x45')]);_0x23b6f7[_0xbfec('0x46')]=qs[_0xbfec('0x3c')](_[_0xbfec('0x47')](_0x5a69ac[_0xbfec('0x3b')],_0x3a0638[_0xbfec('0x3c')]));if(_0x5a69ac[_0xbfec('0x3b')][_0xbfec('0x5e')]){_0x23b6f7[_0xbfec('0x46')]=_['merge'](_0x23b6f7[_0xbfec('0x46')],{'$or':_[_0xbfec('0x34')](_0x23b6f7['attributes'],function(_0x32a645){var _0x2e274d={};_0x2e274d[_0x32a645]={'$like':'%'+_0x5a69ac[_0xbfec('0x3b')]['filter']+'%'};return _0x2e274d;})});}_0x23b6f7=_['merge']({},_0x23b6f7,_0x5a69ac[_0xbfec('0x4a')]);return _0x19b8d7[_0xbfec('0x5c')](_0x23b6f7);}})[_0xbfec('0x2c')](function(_0x3a9c14){if(_0x3a9c14){_0x2a1ce6=_0x3a9c14[_0xbfec('0x41')];if(!_0x5a69ac['query']['hasOwnProperty'](_0xbfec('0x43'))){_0x23b6f7['limit']=qs[_0xbfec('0x24')](_0x5a69ac[_0xbfec('0x3b')][_0xbfec('0x24')]);_0x23b6f7[_0xbfec('0x22')]=qs['offset'](_0x5a69ac[_0xbfec('0x3b')]['offset']);}return _0x19b8d7['getIntervals'](_0x23b6f7);}})[_0xbfec('0x2c')](function(_0x25275b){if(_0x25275b){return _0x25275b?{'count':_0x2a1ce6,'rows':_0x25275b}:null;}})['then'](respondWithResult(_0x138269,null))[_0xbfec('0x4e')](handleError(_0x138269,null));};exports['addIntervals']=function(_0x12759f,_0x526c7d,_0x13f823){return db[_0xbfec('0x35')][_0xbfec('0x5d')]({'where':{'id':_0x12759f[_0xbfec('0x50')]['id']}})['then'](handleEntityNotFound(_0x526c7d,null))[_0xbfec('0x2c')](function(_0x5317c6){if(_0x5317c6){return db[_0xbfec('0x5f')]['transaction'](function(_0x1b97ea){return db[_0xbfec('0x35')][_0xbfec('0x2d')]({'where':{'IntervalId':_0x12759f[_0xbfec('0x50')]['id']},'transaction':_0x1b97ea})[_0xbfec('0x2c')](function(_0x5d1a6c){var _0x5661e8=_['map'](_0x12759f['body'],function(_0x275a28){delete _0x275a28['id'];_0x275a28[_0xbfec('0x60')]=_0x12759f[_0xbfec('0x50')]['id'];return _0x275a28;});return db['Interval'][_0xbfec('0x61')](_0x5661e8,{'transaction':_0x1b97ea});});})['then'](function(){return db['Interval'][_0xbfec('0x4c')]({'where':{'IntervalId':_0x12759f[_0xbfec('0x50')]['id']}});});}})[_0xbfec('0x2c')](respondWithResult(_0x526c7d,null))[_0xbfec('0x4e')](handleError(_0x526c7d,null));}; \ No newline at end of file +var _0x27e9=['request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','Intervals','UserProfileResource','status','end','error','stack','name','send','map','Interval','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','limit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','findAll','rows','params','include','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','pick','merge','hasOwnProperty','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x24161e,_0x5e3d59){var _0x49fb89=function(_0x532e79){while(--_0x532e79){_0x24161e['push'](_0x24161e['shift']());}};_0x49fb89(++_0x5e3d59);}(_0x27e9,0x107));var _0x927e=function(_0x360118,_0x505d0a){_0x360118=_0x360118-0x0;var _0xb39004=_0x27e9[_0x360118];return _0xb39004;};'use strict';var emlformat=require(_0x927e('0x0'));var rimraf=require(_0x927e('0x1'));var zipdir=require(_0x927e('0x2'));var jsonpatch=require(_0x927e('0x3'));var rp=require(_0x927e('0x4'));var moment=require(_0x927e('0x5'));var BPromise=require(_0x927e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x927e('0x7'));var sox=require('sox');var csv=require(_0x927e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x927e('0x9'));var _=require(_0x927e('0xa'));var squel=require(_0x927e('0xb'));var crypto=require('crypto');var jsforce=require(_0x927e('0xc'));var deskjs=require(_0x927e('0xd'));var toCsv=require(_0x927e('0x8'));var querystring=require(_0x927e('0xe'));var Papa=require(_0x927e('0xf'));var Redis=require('ioredis');var authService=require(_0x927e('0x10'));var qs=require(_0x927e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x927e('0x12'));var logger=require(_0x927e('0x13'))(_0x927e('0x14'));var utils=require(_0x927e('0x15'));var config=require(_0x927e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x927e('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3f60d2,_0x4b627e){_0x4b627e=_0x4b627e||0xcc;return function(_0x42aca8){if(_0x42aca8){return _0x3f60d2[_0x927e('0x18')](_0x4b627e);}return _0x3f60d2['status'](_0x4b627e)['end']();};}function respondWithResult(_0x2be69b,_0x2f5239){_0x2f5239=_0x2f5239||0xc8;return function(_0x47afe3){if(_0x47afe3){return _0x2be69b['status'](_0x2f5239)[_0x927e('0x19')](_0x47afe3);}};}function respondWithFilteredResult(_0x4c2eee,_0x546c17){return function(_0x117a27){if(_0x117a27){var _0x1e1177=typeof _0x546c17[_0x927e('0x1a')]===_0x927e('0x1b')&&typeof _0x546c17['limit']===_0x927e('0x1b');var _0x48ddfa=_0x117a27['count'];var _0x42bc30=_0x1e1177?0x0:_0x546c17[_0x927e('0x1a')];var _0x4ae8d3=_0x1e1177?_0x117a27[_0x927e('0x1c')]:_0x546c17[_0x927e('0x1a')]+_0x546c17['limit'];var _0x134aed;if(_0x4ae8d3>=_0x48ddfa){_0x4ae8d3=_0x48ddfa;_0x134aed=0xc8;}else{_0x134aed=0xce;}_0x4c2eee['status'](_0x134aed);return _0x4c2eee[_0x927e('0x1d')](_0x927e('0x1e'),_0x42bc30+'-'+_0x4ae8d3+'/'+_0x48ddfa)['json'](_0x117a27);}return null;};}function patchUpdates(_0x2df7e1){return function(_0x288b1e){try{jsonpatch[_0x927e('0x1f')](_0x288b1e,_0x2df7e1,!![]);}catch(_0x2011c8){return BPromise[_0x927e('0x20')](_0x2011c8);}return _0x288b1e[_0x927e('0x21')]();};}function saveUpdates(_0x2f243d,_0x489a76){return function(_0x2e3488){if(_0x2e3488){return _0x2e3488[_0x927e('0x22')](_0x2f243d)[_0x927e('0x23')](function(_0x4e2000){return _0x4e2000;});}return null;};}function removeEntity(_0x69af20,_0x4ea5d0){return function(_0x21b118){if(_0x21b118){return _0x21b118[_0x927e('0x24')]()['then'](function(){var _0x58cc21=_0x21b118['get']({'plain':!![]});var _0x575d48=_0x927e('0x25');return db[_0x927e('0x26')][_0x927e('0x24')]({'where':{'type':_0x575d48,'resourceId':_0x58cc21['id']}})[_0x927e('0x23')](function(){return _0x21b118;});})[_0x927e('0x23')](function(){_0x69af20[_0x927e('0x27')](0xcc)[_0x927e('0x28')]();});}};}function handleEntityNotFound(_0x571437,_0x1637aa){return function(_0x1a244f){if(!_0x1a244f){_0x571437['sendStatus'](0x194);}return _0x1a244f;};}function handleError(_0x551a50,_0x1227bd){_0x1227bd=_0x1227bd||0x1f4;return function(_0x11ccf4){logger[_0x927e('0x29')](_0x11ccf4[_0x927e('0x2a')]);if(_0x11ccf4[_0x927e('0x2b')]){delete _0x11ccf4['name'];}_0x551a50[_0x927e('0x27')](_0x1227bd)[_0x927e('0x2c')](_0x11ccf4);};}exports['index']=function(_0x346e14,_0x43c99d){var _0x1932c8={},_0x4330d7={},_0xea0bc5={'count':0x0,'rows':[]};var _0x5ef0b9=_[_0x927e('0x2d')](db[_0x927e('0x2e')][_0x927e('0x2f')],function(_0x3e3c7c){return{'name':_0x3e3c7c['fieldName'],'type':_0x3e3c7c[_0x927e('0x30')]['key']};});_0x4330d7['model']=_[_0x927e('0x2d')](_0x5ef0b9,_0x927e('0x2b'));_0x4330d7[_0x927e('0x31')]=_[_0x927e('0x32')](_0x346e14[_0x927e('0x31')]);_0x4330d7['filters']=_[_0x927e('0x33')](_0x4330d7['model'],_0x4330d7[_0x927e('0x31')]);_0x1932c8[_0x927e('0x34')]=_[_0x927e('0x33')](_0x4330d7[_0x927e('0x35')],qs[_0x927e('0x36')](_0x346e14[_0x927e('0x31')]['fields']));_0x1932c8[_0x927e('0x34')]=_0x1932c8[_0x927e('0x34')][_0x927e('0x37')]?_0x1932c8[_0x927e('0x34')]:_0x4330d7[_0x927e('0x35')];if(!_0x346e14[_0x927e('0x31')]['hasOwnProperty']('nolimit')){_0x1932c8[_0x927e('0x38')]=qs[_0x927e('0x38')](_0x346e14[_0x927e('0x31')][_0x927e('0x38')]);_0x1932c8[_0x927e('0x1a')]=qs[_0x927e('0x1a')](_0x346e14[_0x927e('0x31')][_0x927e('0x1a')]);}_0x1932c8[_0x927e('0x39')]=qs[_0x927e('0x3a')](_0x346e14['query']['sort']);_0x1932c8[_0x927e('0x3b')]=qs['filters'](_['pick'](_0x346e14[_0x927e('0x31')],_0x4330d7[_0x927e('0x3c')]),_0x5ef0b9);if(_0x346e14[_0x927e('0x31')][_0x927e('0x3d')]){_0x1932c8[_0x927e('0x3b')]=_['merge'](_0x1932c8[_0x927e('0x3b')],{'$or':_[_0x927e('0x2d')](_0x5ef0b9,function(_0x33f771){if(_0x33f771[_0x927e('0x30')]!==_0x927e('0x3e')){var _0x1ddf3f={};_0x1ddf3f[_0x33f771[_0x927e('0x2b')]]={'$like':'%'+_0x346e14['query'][_0x927e('0x3d')]+'%'};return _0x1ddf3f;}})});}_0x1932c8=_['merge']({},_0x1932c8,_0x346e14[_0x927e('0x3f')]);var _0xa05382={'where':_0x1932c8[_0x927e('0x3b')]};return db[_0x927e('0x2e')][_0x927e('0x1c')](_0xa05382)[_0x927e('0x23')](function(_0x27c1ac){_0xea0bc5['count']=_0x27c1ac;if(_0x346e14[_0x927e('0x31')][_0x927e('0x40')]){_0x1932c8['include']=[{'all':!![]}];}return db['Interval'][_0x927e('0x41')](_0x1932c8);})[_0x927e('0x23')](function(_0x39f01f){_0xea0bc5[_0x927e('0x42')]=_0x39f01f;return _0xea0bc5;})[_0x927e('0x23')](respondWithFilteredResult(_0x43c99d,_0x1932c8))['catch'](handleError(_0x43c99d,null));};exports['show']=function(_0x3d8d05,_0x476566){var _0x21537b={'raw':!![],'where':{'id':_0x3d8d05[_0x927e('0x43')]['id']}},_0x19954f={};_0x19954f[_0x927e('0x35')]=_[_0x927e('0x32')](db[_0x927e('0x2e')][_0x927e('0x2f')]);_0x19954f[_0x927e('0x31')]=_['keys'](_0x3d8d05['query']);_0x19954f[_0x927e('0x3c')]=_['intersection'](_0x19954f[_0x927e('0x35')],_0x19954f['query']);_0x21537b[_0x927e('0x34')]=_['intersection'](_0x19954f[_0x927e('0x35')],qs[_0x927e('0x36')](_0x3d8d05[_0x927e('0x31')][_0x927e('0x36')]));_0x21537b[_0x927e('0x34')]=_0x21537b[_0x927e('0x34')][_0x927e('0x37')]?_0x21537b[_0x927e('0x34')]:_0x19954f['model'];if(_0x3d8d05[_0x927e('0x31')]['includeAll']){_0x21537b[_0x927e('0x44')]=[{'all':!![]}];}_0x21537b=_['merge']({},_0x21537b,_0x3d8d05[_0x927e('0x3f')]);return db[_0x927e('0x2e')]['find'](_0x21537b)['then'](handleEntityNotFound(_0x476566,null))['then'](respondWithResult(_0x476566,null))[_0x927e('0x45')](handleError(_0x476566,null));};exports[_0x927e('0x46')]=function(_0x4bb03d,_0x57d5ae){return db[_0x927e('0x2e')][_0x927e('0x46')](_0x4bb03d[_0x927e('0x47')],{})[_0x927e('0x23')](function(_0xa7cd2){var _0xcf4e6a=_0x4bb03d['user'][_0x927e('0x48')]({'plain':!![]});if(!_0xcf4e6a)throw new Error(_0x927e('0x49'));if(_0xcf4e6a[_0x927e('0x4a')]==='user'){var _0x2971cb=_0xa7cd2['get']({'plain':!![]});var _0x3740b3='Intervals';return db[_0x927e('0x4b')][_0x927e('0x4c')]({'where':{'name':_0x3740b3,'userProfileId':_0xcf4e6a[_0x927e('0x4d')]},'raw':!![]})[_0x927e('0x23')](function(_0xf70256){if(_0xf70256&&_0xf70256[_0x927e('0x4e')]===0x0){return db[_0x927e('0x26')][_0x927e('0x46')]({'name':_0x2971cb[_0x927e('0x2b')],'resourceId':_0x2971cb['id'],'type':_0xf70256[_0x927e('0x2b')],'sectionId':_0xf70256['id']},{})[_0x927e('0x23')](function(){return _0xa7cd2;});}else{return _0xa7cd2;}})['catch'](function(_0x540747){logger[_0x927e('0x29')](_0x927e('0x4f'),_0x540747);throw _0x540747;});}return _0xa7cd2;})[_0x927e('0x23')](respondWithResult(_0x57d5ae,0xc9))[_0x927e('0x45')](handleError(_0x57d5ae,null));};exports[_0x927e('0x22')]=function(_0x284e84,_0x16b7ce){if(_0x284e84[_0x927e('0x47')]['id']){delete _0x284e84[_0x927e('0x47')]['id'];}return db[_0x927e('0x2e')][_0x927e('0x4c')]({'where':{'id':_0x284e84['params']['id']}})['then'](handleEntityNotFound(_0x16b7ce,null))[_0x927e('0x23')](saveUpdates(_0x284e84['body'],null))[_0x927e('0x23')](respondWithResult(_0x16b7ce,null))[_0x927e('0x45')](handleError(_0x16b7ce,null));};exports[_0x927e('0x24')]=function(_0x463a43,_0x508f39){return db['Interval'][_0x927e('0x4c')]({'where':{'id':_0x463a43[_0x927e('0x43')]['id']}})[_0x927e('0x23')](handleEntityNotFound(_0x508f39,null))[_0x927e('0x23')](removeEntity(_0x508f39,null))[_0x927e('0x45')](handleError(_0x508f39,null));};exports[_0x927e('0x50')]=function(_0x3130c0,_0x911f24,_0x424ebf){if(_0x3130c0['body']['id']){delete _0x3130c0[_0x927e('0x47')]['id'];}return db[_0x927e('0x2e')][_0x927e('0x4c')]({'where':{'id':_0x3130c0[_0x927e('0x43')]['id']}})[_0x927e('0x23')](handleEntityNotFound(_0x911f24,null))[_0x927e('0x23')](function(_0x20ed81){if(_0x20ed81){_0x3130c0['body']['IntervalId']=_0x20ed81['id'];return db['Interval'][_0x927e('0x46')](_0x3130c0[_0x927e('0x47')]);}})['then'](respondWithResult(_0x911f24,null))[_0x927e('0x45')](handleError(_0x911f24,null));};exports[_0x927e('0x51')]=function(_0x513ba0,_0x4e68b9,_0x475c98){var _0x1b24c6={};var _0x4998cf={};var _0x17839f;var _0x21eb11;return db[_0x927e('0x2e')]['findOne']({'where':{'id':_0x513ba0[_0x927e('0x43')]['id']}})[_0x927e('0x23')](handleEntityNotFound(_0x4e68b9,null))[_0x927e('0x23')](function(_0x5abf02){if(_0x5abf02){_0x17839f=_0x5abf02;_0x4998cf['model']=_[_0x927e('0x32')](db[_0x927e('0x2e')][_0x927e('0x2f')]);_0x4998cf['query']=_[_0x927e('0x32')](_0x513ba0[_0x927e('0x31')]);_0x4998cf['filters']=_[_0x927e('0x33')](_0x4998cf['model'],_0x4998cf[_0x927e('0x31')]);_0x1b24c6[_0x927e('0x34')]=_['intersection'](_0x4998cf['model'],qs[_0x927e('0x36')](_0x513ba0['query'][_0x927e('0x36')]));_0x1b24c6['attributes']=_0x1b24c6[_0x927e('0x34')][_0x927e('0x37')]?_0x1b24c6[_0x927e('0x34')]:_0x4998cf[_0x927e('0x35')];_0x1b24c6[_0x927e('0x39')]=qs['sort'](_0x513ba0[_0x927e('0x31')]['sort']);_0x1b24c6['where']=qs[_0x927e('0x3c')](_[_0x927e('0x52')](_0x513ba0[_0x927e('0x31')],_0x4998cf[_0x927e('0x3c')]));if(_0x513ba0[_0x927e('0x31')]['filter']){_0x1b24c6[_0x927e('0x3b')]=_[_0x927e('0x53')](_0x1b24c6[_0x927e('0x3b')],{'$or':_[_0x927e('0x2d')](_0x1b24c6[_0x927e('0x34')],function(_0x3aa193){var _0x4b512e={};_0x4b512e[_0x3aa193]={'$like':'%'+_0x513ba0[_0x927e('0x31')][_0x927e('0x3d')]+'%'};return _0x4b512e;})});}_0x1b24c6=_[_0x927e('0x53')]({},_0x1b24c6,_0x513ba0[_0x927e('0x3f')]);return _0x17839f[_0x927e('0x51')](_0x1b24c6);}})[_0x927e('0x23')](function(_0x2e8ea6){if(_0x2e8ea6){_0x21eb11=_0x2e8ea6[_0x927e('0x37')];if(!_0x513ba0[_0x927e('0x31')][_0x927e('0x54')]('nolimit')){_0x1b24c6[_0x927e('0x38')]=qs[_0x927e('0x38')](_0x513ba0[_0x927e('0x31')]['limit']);_0x1b24c6['offset']=qs[_0x927e('0x1a')](_0x513ba0[_0x927e('0x31')][_0x927e('0x1a')]);}return _0x17839f[_0x927e('0x51')](_0x1b24c6);}})['then'](function(_0x55ed5e){if(_0x55ed5e){return _0x55ed5e?{'count':_0x21eb11,'rows':_0x55ed5e}:null;}})[_0x927e('0x23')](respondWithResult(_0x4e68b9,null))[_0x927e('0x45')](handleError(_0x4e68b9,null));};exports['addIntervals']=function(_0x54277f,_0x3437ab,_0x4d3827){return db['Interval']['findOne']({'where':{'id':_0x54277f[_0x927e('0x43')]['id']}})[_0x927e('0x23')](handleEntityNotFound(_0x3437ab,null))['then'](function(_0x2f4fc0){if(_0x2f4fc0){return db[_0x927e('0x55')][_0x927e('0x56')](function(_0x2a87d1){return db[_0x927e('0x2e')]['destroy']({'where':{'IntervalId':_0x54277f[_0x927e('0x43')]['id']},'transaction':_0x2a87d1})[_0x927e('0x23')](function(_0x3b6cf6){var _0xf27ff7=_[_0x927e('0x2d')](_0x54277f[_0x927e('0x47')],function(_0x10676b){delete _0x10676b['id'];_0x10676b[_0x927e('0x57')]=_0x54277f[_0x927e('0x43')]['id'];return _0x10676b;});return db[_0x927e('0x2e')][_0x927e('0x58')](_0xf27ff7,{'transaction':_0x2a87d1});});})[_0x927e('0x23')](function(){return db[_0x927e('0x2e')][_0x927e('0x41')]({'where':{'IntervalId':_0x54277f[_0x927e('0x43')]['id']}});});}})[_0x927e('0x23')](respondWithResult(_0x3437ab,null))['catch'](handleError(_0x3437ab,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4132007..94ad626 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 _0x7245=['getIntervals','then','all','map','ifTime','reduce','../../components/extensions/rewrite','iftime','define','Interval','tools_intervals','rewrite','interval','string'];(function(_0x23303f,_0x34cff9){var _0x4509ba=function(_0x12b686){while(--_0x12b686){_0x23303f['push'](_0x23303f['shift']());}};_0x4509ba(++_0x34cff9);}(_0x7245,0x148));var _0x5724=function(_0x455aa7,_0x560029){_0x455aa7=_0x455aa7-0x0;var _0x35599e=_0x7245[_0x455aa7];return _0x35599e;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x5724('0x0'));var iftime=require('../../utils/iftime')[_0x5724('0x1')];module['exports']=function(_0x2dd49d){return _0x2dd49d[_0x5724('0x2')](_0x5724('0x3'),attributes,{'tableName':_0x5724('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bafb8){extensions['rewrite'](_0x2dd49d,_0x5bafb8);},'afterBulkCreate':function(_0x4a03de,_0xf263f1,_0x5bb57e){_0x5bb57e();extensions[_0x5724('0x5')](_0x2dd49d,_0x4a03de[0x0]);},'afterUpdate':function(_0x4ccd9c){extensions[_0x5724('0x5')](_0x2dd49d,_0x4ccd9c);},'afterDestroy':function(_0x3aed2a){extensions[_0x5724('0x5')](_0x2dd49d,_0x3aed2a);}},'instanceMethods':{'ifTime':function(_0x5c24e6=undefined,_0x3ecbd8=new Date()){if(typeof this[_0x5724('0x6')]===_0x5724('0x7')){return iftime(this[_0x5724('0x6')],_0x5c24e6,_0x3ecbd8);}else{return this[_0x5724('0x8')]()[_0x5724('0x9')](function(_0x5b72fb){return Promise[_0x5724('0xa')](_0x5b72fb[_0x5724('0xb')](function(_0x1fc089){return _0x1fc089[_0x5724('0xc')](_0x5c24e6,_0x3ecbd8);}));})[_0x5724('0x9')](function(_0x1c5614){return _0x1c5614[_0x5724('0xd')](function(_0x276f35,_0xe86360){return _0x276f35||_0xe86360;},![]);});}}}});}; \ No newline at end of file +var _0xe95b=['iftime','exports','Interval','tools_intervals','rewrite','interval','getIntervals','all','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe95b,0x138));var _0xbe95=function(_0x225a81,_0x50f889){_0x225a81=_0x225a81-0x0;var _0x2e7d32=_0xe95b[_0x225a81];return _0x2e7d32;};'use strict';var attributes=require(_0xbe95('0x0'));var extensions=require(_0xbe95('0x1'));var iftime=require(_0xbe95('0x2'))[_0xbe95('0x3')];module[_0xbe95('0x4')]=function(_0x418de2){return _0x418de2['define'](_0xbe95('0x5'),attributes,{'tableName':_0xbe95('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a1da3){extensions[_0xbe95('0x7')](_0x418de2,_0x3a1da3);},'afterBulkCreate':function(_0x102bbf,_0x2b86b4,_0x3455d3){_0x3455d3();extensions[_0xbe95('0x7')](_0x418de2,_0x102bbf[0x0]);},'afterUpdate':function(_0x56da5f){extensions[_0xbe95('0x7')](_0x418de2,_0x56da5f);},'afterDestroy':function(_0x5b8d02){extensions[_0xbe95('0x7')](_0x418de2,_0x5b8d02);}},'instanceMethods':{'ifTime':function(_0x52eb4e=undefined,_0x219c0d=new Date()){if(typeof this[_0xbe95('0x8')]==='string'){return iftime(this[_0xbe95('0x8')],_0x52eb4e,_0x219c0d);}else{return this[_0xbe95('0x9')]()['then'](function(_0x3439f9){return Promise[_0xbe95('0xa')](_0x3439f9[_0xbe95('0xb')](function(_0x37862b){return _0x37862b[_0xbe95('0xc')](_0x52eb4e,_0x219c0d);}));})[_0xbe95('0xd')](function(_0xffd02e){return _0xffd02e[_0xbe95('0xe')](function(_0x55d139,_0x4fbb68){return _0x55d139||_0x4fbb68;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 275b8d6..a36f9c5 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 _0xb0a6=['intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','GetInterval','findAll','raw','options','where','attributes','limit','map','model','include','then','info','debug','stringify','error','message','ShowInterval','Interval','find','catch','all','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'];(function(_0x51d011,_0x11ae2c){var _0x580382=function(_0x500dba){while(--_0x500dba){_0x51d011['push'](_0x51d011['shift']());}};_0x580382(++_0x11ae2c);}(_0xb0a6,0xba));var _0x6b0a=function(_0xedf9cf,_0x484237){_0xedf9cf=_0xedf9cf-0x0;var _0x39082b=_0xb0a6[_0xedf9cf];return _0x39082b;};'use strict';var _=require(_0x6b0a('0x0'));var util=require(_0x6b0a('0x1'));var db=require(_0x6b0a('0x2'))['db'];var iftime=require(_0x6b0a('0x3'))[_0x6b0a('0x4')];var logger=require('../../config/logger')('rpc');exports[_0x6b0a('0x5')]=function(_0x3ba75d){var _0x1daba6=this;return new Promise(function(_0x2593e2,_0x4eaceb){return db['Interval'][_0x6b0a('0x6')]({'raw':_0x3ba75d['options']?_0x3ba75d['options'][_0x6b0a('0x7')]===undefined?!![]:![]:!![],'where':_0x3ba75d['options']?_0x3ba75d[_0x6b0a('0x8')][_0x6b0a('0x9')]||null:null,'attributes':_0x3ba75d[_0x6b0a('0x8')]?_0x3ba75d['options'][_0x6b0a('0xa')]||null:null,'limit':_0x3ba75d['options']?_0x3ba75d[_0x6b0a('0x8')][_0x6b0a('0xb')]||null:null,'include':_0x3ba75d[_0x6b0a('0x8')]?_0x3ba75d[_0x6b0a('0x8')]['include']?_[_0x6b0a('0xc')](_0x3ba75d[_0x6b0a('0x8')]['include'],function(_0x2ec8f7){return{'model':db[_0x2ec8f7[_0x6b0a('0xd')]],'as':_0x2ec8f7['as'],'attributes':_0x2ec8f7[_0x6b0a('0xa')],'include':_0x2ec8f7[_0x6b0a('0xe')]?_[_0x6b0a('0xc')](_0x2ec8f7[_0x6b0a('0xe')],function(_0x31dfc4){return{'model':db[_0x31dfc4[_0x6b0a('0xd')]],'as':_0x31dfc4['as'],'attributes':_0x31dfc4[_0x6b0a('0xa')],'include':_0x31dfc4[_0x6b0a('0xe')]?_['map'](_0x31dfc4[_0x6b0a('0xe')],function(_0x3d67df){return{'model':db[_0x3d67df[_0x6b0a('0xd')]],'as':_0x3d67df['as'],'attributes':_0x3d67df['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b0a('0xf')](function(_0x4ef916){logger[_0x6b0a('0x10')](_0x6b0a('0x5'),_0x3ba75d);logger[_0x6b0a('0x11')]('GetInterval',_0x3ba75d,JSON[_0x6b0a('0x12')](_0x4ef916));_0x2593e2(_0x4ef916);})['catch'](function(_0x1e569e){logger[_0x6b0a('0x13')](_0x6b0a('0x5'),_0x1e569e[_0x6b0a('0x14')],_0x3ba75d);_0x4eaceb(_0x1daba6[_0x6b0a('0x13')](0x1f4,_0x1e569e[_0x6b0a('0x14')]));});});};exports[_0x6b0a('0x15')]=function(_0x53cdd1){var _0x3408e1=this;return new Promise(function(_0x417c21,_0x577848){return db[_0x6b0a('0x16')][_0x6b0a('0x17')]({'raw':_0x53cdd1[_0x6b0a('0x8')]?_0x53cdd1['options'][_0x6b0a('0x7')]===undefined?!![]:![]:!![],'where':_0x53cdd1['options']?_0x53cdd1['options'][_0x6b0a('0x9')]||null:null,'attributes':_0x53cdd1[_0x6b0a('0x8')]?_0x53cdd1['options']['attributes']||null:null,'include':_0x53cdd1[_0x6b0a('0x8')]?_0x53cdd1[_0x6b0a('0x8')][_0x6b0a('0xe')]?_[_0x6b0a('0xc')](_0x53cdd1[_0x6b0a('0x8')]['include'],function(_0x2622ae){return{'model':db[_0x2622ae[_0x6b0a('0xd')]],'as':_0x2622ae['as'],'attributes':_0x2622ae[_0x6b0a('0xa')],'include':_0x2622ae[_0x6b0a('0xe')]?_[_0x6b0a('0xc')](_0x2622ae['include'],function(_0x86c9d8){return{'model':db[_0x86c9d8[_0x6b0a('0xd')]],'as':_0x86c9d8['as'],'attributes':_0x86c9d8['attributes'],'include':_0x86c9d8[_0x6b0a('0xe')]?_['map'](_0x86c9d8[_0x6b0a('0xe')],function(_0x4d36d5){return{'model':db[_0x4d36d5[_0x6b0a('0xd')]],'as':_0x4d36d5['as'],'attributes':_0x4d36d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b0a('0xf')](function(_0x34a02a){logger[_0x6b0a('0x10')](_0x6b0a('0x15'),_0x53cdd1);logger['debug'](_0x6b0a('0x15'),_0x53cdd1,JSON[_0x6b0a('0x12')](_0x34a02a));_0x417c21(_0x34a02a);})[_0x6b0a('0x18')](function(_0xfc47d0){logger[_0x6b0a('0x13')](_0x6b0a('0x15'),_0xfc47d0[_0x6b0a('0x14')],_0x53cdd1);_0x577848(_0x3408e1[_0x6b0a('0x13')](0x1f4,_0xfc47d0['message']));});});};function checkArrayOfIntervals(_0x3fe08b,_0x4e00c3){var _0x123b72=[];return db[_0x6b0a('0x16')]['findAll']({'where':{'id':_0x3fe08b}})[_0x6b0a('0xf')](function(_0x396c2c){_0x123b72=_0x396c2c;return Promise[_0x6b0a('0x19')](_0x123b72[_0x6b0a('0xc')](function(_0x583aea){return _0x583aea[_0x6b0a('0x1a')](_0x4e00c3);}));})[_0x6b0a('0xf')](function(_0x420739){var _0x4ca206=_0x420739['reduce'](function(_0x31bd48,_0x4d2e7d){return _0x31bd48||_0x4d2e7d;},![]);logger['info'](util[_0x6b0a('0x1b')](_0x6b0a('0x1c'),_0x123b72[_0x6b0a('0xc')](function(_0x1f619f){return _0x1f619f[_0x6b0a('0x1d')];})[_0x6b0a('0x1e')](',\x20'),_0x123b72[_0x6b0a('0xc')](function(_0x141c85){return _0x141c85['id'];})[_0x6b0a('0x1e')](',\x20')));return _0x4ca206;});}function checkSingleInterval(_0x33e76d,_0x13b3d5){return db[_0x6b0a('0x16')][_0x6b0a('0x1f')](_0x33e76d)[_0x6b0a('0xf')](function(_0x3e9fac){if(_0x3e9fac){logger[_0x6b0a('0x10')](util['format'](_0x6b0a('0x20'),_0x3e9fac[_0x6b0a('0x1d')],_0x3e9fac['id']));return _0x3e9fac[_0x6b0a('0x1a')](_0x13b3d5);}});}exports[_0x6b0a('0x21')]=function(_0x330aa1){var _0x62f47c=_0x330aa1[_0x6b0a('0x22')];var _0x38c141=Array[_0x6b0a('0x23')](_0x330aa1[_0x6b0a('0x24')])?_0x330aa1[_0x6b0a('0x24')]:typeof _0x330aa1[_0x6b0a('0x24')]===_0x6b0a('0x25')?[_0x330aa1[_0x6b0a('0x24')]]:[];var _0x521b7f=_0x330aa1[_0x6b0a('0x26')]||undefined;var _0x9ac36f=![];if(_0x38c141[_0x6b0a('0x27')]){logger[_0x6b0a('0x10')](util[_0x6b0a('0x1b')](_0x6b0a('0x28'),_0x38c141['join'](';\x20')));}if(_0x521b7f){logger[_0x6b0a('0x10')](util[_0x6b0a('0x1b')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x521b7f));}logger[_0x6b0a('0x11')](_0x6b0a('0x29'),_0x9ac36f);logger[_0x6b0a('0x2a')](_0x6b0a('0x21'),_0x330aa1);return Promise['resolve']()[_0x6b0a('0xf')](function(){if(Array['isArray'](_0x62f47c)){return checkArrayOfIntervals(_0x62f47c,_0x521b7f);}else if(_0x62f47c){return checkSingleInterval(_0x62f47c,_0x521b7f);}})['then'](function(_0x277cf2){var _0x591c36=_0x38c141[_0x6b0a('0x2b')](function(_0x15273e,_0x639a7){return _0x15273e||iftime(_0x639a7,_0x521b7f);},![]);_0x9ac36f=_0x277cf2||_0x591c36;return _0x9ac36f;})[_0x6b0a('0x18')](function(_0x209e8a){logger[_0x6b0a('0x13')]('IntervalIftime',_0x330aa1,_0x209e8a);throw this[_0x6b0a('0x13')](0x1f4,_0x209e8a[_0x6b0a('0x14')]);});}; \ No newline at end of file +var _0x8ef7=['stringify','then','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','isArray','intervals','string','timezone','length','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','Interval','findAll','raw','options','where','attributes','limit','include','map','model','info','debug','GetInterval','catch','error','message','ShowInterval','find'];(function(_0x524375,_0x3ca8d4){var _0x18e8a6=function(_0x4a6898){while(--_0x4a6898){_0x524375['push'](_0x524375['shift']());}};_0x18e8a6(++_0x3ca8d4);}(_0x8ef7,0x1a0));var _0x78ef=function(_0x18da72,_0x20b43c){_0x18da72=_0x18da72-0x0;var _0x410c26=_0x8ef7[_0x18da72];return _0x410c26;};'use strict';var _=require(_0x78ef('0x0'));var util=require(_0x78ef('0x1'));var db=require(_0x78ef('0x2'))['db'];var iftime=require(_0x78ef('0x3'))['iftime'];var logger=require(_0x78ef('0x4'))(_0x78ef('0x5'));exports['GetInterval']=function(_0x1ed4b2){var _0x2e0e86=this;return new Promise(function(_0x6c97f3,_0x1eb833){return db[_0x78ef('0x6')][_0x78ef('0x7')]({'raw':_0x1ed4b2['options']?_0x1ed4b2['options'][_0x78ef('0x8')]===undefined?!![]:![]:!![],'where':_0x1ed4b2[_0x78ef('0x9')]?_0x1ed4b2[_0x78ef('0x9')][_0x78ef('0xa')]||null:null,'attributes':_0x1ed4b2[_0x78ef('0x9')]?_0x1ed4b2[_0x78ef('0x9')][_0x78ef('0xb')]||null:null,'limit':_0x1ed4b2[_0x78ef('0x9')]?_0x1ed4b2[_0x78ef('0x9')][_0x78ef('0xc')]||null:null,'include':_0x1ed4b2[_0x78ef('0x9')]?_0x1ed4b2[_0x78ef('0x9')][_0x78ef('0xd')]?_[_0x78ef('0xe')](_0x1ed4b2['options']['include'],function(_0x3c5836){return{'model':db[_0x3c5836[_0x78ef('0xf')]],'as':_0x3c5836['as'],'attributes':_0x3c5836[_0x78ef('0xb')],'include':_0x3c5836['include']?_['map'](_0x3c5836['include'],function(_0x5a03f2){return{'model':db[_0x5a03f2[_0x78ef('0xf')]],'as':_0x5a03f2['as'],'attributes':_0x5a03f2['attributes'],'include':_0x5a03f2['include']?_[_0x78ef('0xe')](_0x5a03f2['include'],function(_0x343b23){return{'model':db[_0x343b23[_0x78ef('0xf')]],'as':_0x343b23['as'],'attributes':_0x343b23[_0x78ef('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46ad43){logger[_0x78ef('0x10')]('GetInterval',_0x1ed4b2);logger[_0x78ef('0x11')](_0x78ef('0x12'),_0x1ed4b2,JSON['stringify'](_0x46ad43));_0x6c97f3(_0x46ad43);})[_0x78ef('0x13')](function(_0x22d36b){logger[_0x78ef('0x14')]('GetInterval',_0x22d36b[_0x78ef('0x15')],_0x1ed4b2);_0x1eb833(_0x2e0e86[_0x78ef('0x14')](0x1f4,_0x22d36b['message']));});});};exports[_0x78ef('0x16')]=function(_0x34d89e){var _0x352222=this;return new Promise(function(_0x5e4ca4,_0x19bc61){return db[_0x78ef('0x6')][_0x78ef('0x17')]({'raw':_0x34d89e[_0x78ef('0x9')]?_0x34d89e[_0x78ef('0x9')][_0x78ef('0x8')]===undefined?!![]:![]:!![],'where':_0x34d89e[_0x78ef('0x9')]?_0x34d89e[_0x78ef('0x9')]['where']||null:null,'attributes':_0x34d89e[_0x78ef('0x9')]?_0x34d89e[_0x78ef('0x9')]['attributes']||null:null,'include':_0x34d89e['options']?_0x34d89e[_0x78ef('0x9')][_0x78ef('0xd')]?_[_0x78ef('0xe')](_0x34d89e[_0x78ef('0x9')][_0x78ef('0xd')],function(_0x5c6b9a){return{'model':db[_0x5c6b9a[_0x78ef('0xf')]],'as':_0x5c6b9a['as'],'attributes':_0x5c6b9a['attributes'],'include':_0x5c6b9a['include']?_['map'](_0x5c6b9a[_0x78ef('0xd')],function(_0x177465){return{'model':db[_0x177465[_0x78ef('0xf')]],'as':_0x177465['as'],'attributes':_0x177465[_0x78ef('0xb')],'include':_0x177465[_0x78ef('0xd')]?_[_0x78ef('0xe')](_0x177465['include'],function(_0x7d3888){return{'model':db[_0x7d3888[_0x78ef('0xf')]],'as':_0x7d3888['as'],'attributes':_0x7d3888[_0x78ef('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a0ba7){logger[_0x78ef('0x10')](_0x78ef('0x16'),_0x34d89e);logger[_0x78ef('0x11')](_0x78ef('0x16'),_0x34d89e,JSON[_0x78ef('0x18')](_0x2a0ba7));_0x5e4ca4(_0x2a0ba7);})[_0x78ef('0x13')](function(_0x3d304d){logger['error'](_0x78ef('0x16'),_0x3d304d['message'],_0x34d89e);_0x19bc61(_0x352222[_0x78ef('0x14')](0x1f4,_0x3d304d[_0x78ef('0x15')]));});});};function checkArrayOfIntervals(_0x538034,_0x3e6d95){var _0xa8f07=[];return db[_0x78ef('0x6')]['findAll']({'where':{'id':_0x538034}})[_0x78ef('0x19')](function(_0x22eefd){_0xa8f07=_0x22eefd;return Promise[_0x78ef('0x1a')](_0xa8f07['map'](function(_0x2f02db){return _0x2f02db[_0x78ef('0x1b')](_0x3e6d95);}));})['then'](function(_0x2711ac){var _0x9f2341=_0x2711ac[_0x78ef('0x1c')](function(_0x47b827,_0x1f9732){return _0x47b827||_0x1f9732;},![]);logger[_0x78ef('0x10')](util['format'](_0x78ef('0x1d'),_0xa8f07[_0x78ef('0xe')](function(_0x2dc44c){return _0x2dc44c[_0x78ef('0x1e')];})['join'](',\x20'),_0xa8f07[_0x78ef('0xe')](function(_0x8fd852){return _0x8fd852['id'];})[_0x78ef('0x1f')](',\x20')));return _0x9f2341;});}function checkSingleInterval(_0x359217,_0x3ebe5d){return db['Interval'][_0x78ef('0x20')](_0x359217)[_0x78ef('0x19')](function(_0x33717f){if(_0x33717f){logger[_0x78ef('0x10')](util[_0x78ef('0x21')](_0x78ef('0x22'),_0x33717f['name'],_0x33717f['id']));return _0x33717f[_0x78ef('0x1b')](_0x3ebe5d);}});}exports['IntervalIftime']=function(_0x1aaad2){var _0x27dff6=_0x1aaad2['intervalIds'];var _0x1532b6=Array[_0x78ef('0x23')](_0x1aaad2[_0x78ef('0x24')])?_0x1aaad2[_0x78ef('0x24')]:typeof _0x1aaad2[_0x78ef('0x24')]===_0x78ef('0x25')?[_0x1aaad2['intervals']]:[];var _0x5d2dcc=_0x1aaad2[_0x78ef('0x26')]||undefined;var _0x11479c=![];if(_0x1532b6[_0x78ef('0x27')]){logger[_0x78ef('0x10')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x1532b6['join'](';\x20')));}if(_0x5d2dcc){logger['info'](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x5d2dcc));}logger[_0x78ef('0x11')](_0x78ef('0x28'),_0x11479c);logger[_0x78ef('0x29')](_0x78ef('0x2a'),_0x1aaad2);return Promise[_0x78ef('0x2b')]()[_0x78ef('0x19')](function(){if(Array[_0x78ef('0x23')](_0x27dff6)){return checkArrayOfIntervals(_0x27dff6,_0x5d2dcc);}else if(_0x27dff6){return checkSingleInterval(_0x27dff6,_0x5d2dcc);}})['then'](function(_0xb4b4ed){var _0x56706a=_0x1532b6['reduce'](function(_0x1229f6,_0x5eb779){return _0x1229f6||iftime(_0x5eb779,_0x5d2dcc);},![]);_0x11479c=_0xb4b4ed||_0x56706a;return _0x11479c;})[_0x78ef('0x13')](function(_0xcb0d13){logger['error']('IntervalIftime',_0x1aaad2,_0xcb0d13);throw this[_0x78ef('0x14')](0x1f4,_0xcb0d13[_0x78ef('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 4e3e47f..977ab52 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0x0b0e[_0x3efe9b];return _0x132073;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x484261,_0xcaf9e3){var _0x349109=function(_0x13b52c){while(--_0x13b52c){_0x484261['push'](_0x484261['shift']());}};_0x349109(++_0xcaf9e3);}(_0x2ef3,0xba));var _0x32ef=function(_0x38ba56,_0x352021){_0x38ba56=_0x38ba56-0x0;var _0x3507e1=_0x2ef3[_0x38ba56];return _0x3507e1;};'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 d890b32..9a17d63 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 _0x81e3=['../../config/logger','api','support','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','request','utf8','data','end','statusCode','parse','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','https'];(function(_0x1a3683,_0x4cee3c){var _0x12b01f=function(_0x29280a){while(--_0x29280a){_0x1a3683['push'](_0x1a3683['shift']());}};_0x12b01f(++_0x4cee3c);}(_0x81e3,0x86));var _0x381e=function(_0x11df66,_0x9eabf){_0x11df66=_0x11df66-0x0;var _0xc2dca1=_0x81e3[_0x11df66];return _0xc2dca1;};'use strict';var BPromise=require('bluebird');var https=require(_0x381e('0x0'));var logger=require(_0x381e('0x1'))(_0x381e('0x2'));var USERNAME=_0x381e('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x110492,_0x252ff2){var _0x51d5fa={'fields':{'project':{'key':_0x110492['key']||_0x381e('0x4')},'summary':(_0x110492[_0x381e('0x5')]||_0x381e('0x6'))+_0x381e('0x7')+_0x110492['ip'],'description':_0x110492[_0x381e('0x8')]||JSON[_0x381e('0x9')](_0x110492),'issuetype':{'name':_0x110492['issuetype']||_0x381e('0xa')}}};_0x51d5fa['fields'][_0x381e('0xb')]=_0x110492[_0x381e('0xc')];_0x51d5fa[_0x381e('0xd')]['customfield_11501']=_0x110492[_0x381e('0xe')];_0x51d5fa[_0x381e('0xd')][_0x381e('0xf')]=_0x110492[_0x381e('0x10')];_0x51d5fa[_0x381e('0xd')][_0x381e('0x11')]=_0x110492[_0x381e('0x12')];_0x51d5fa[_0x381e('0xd')][_0x381e('0x13')]=_0x110492[_0x381e('0x14')];_0x51d5fa[_0x381e('0xd')][_0x381e('0x15')]=_0x110492['ip'];var _0x321942={'host':_0x381e('0x16'),'port':0x1bb,'path':_0x381e('0x17'),'method':_0x381e('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x381e('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x381e('0x1a')](_0x381e('0x1b'))}};var _0x3fd601=JSON[_0x381e('0x9')](_0x51d5fa);var _0x20787b=https[_0x381e('0x1c')](_0x321942,function(_0x321e5b){_0x321e5b['setEncoding'](_0x381e('0x1d'));var _0x302c2d='';_0x321e5b['on'](_0x381e('0x1e'),function(_0x2c011e){_0x302c2d+=_0x2c011e;});_0x321e5b['on'](_0x381e('0x1f'),function(){if(_0x252ff2){return _0x252ff2['status'](_0x321e5b[_0x381e('0x20')])['json'](JSON[_0x381e('0x21')](_0x302c2d));}});});_0x20787b['on']('error',function(_0x5498ff){if(_0x252ff2){return _0x252ff2[_0x381e('0x22')](0x1f4)[_0x381e('0x23')]({'errors':[{'message':_0x381e('0x24'),'type':'api.jira'}]});}});_0x20787b[_0x381e('0x25')](_0x3fd601);_0x20787b[_0x381e('0x1f')]();}exports[_0x381e('0x26')]=openIssue;exports[_0x381e('0x27')]=function(_0x258405,_0x45a622){_0x258405[_0x381e('0x28')]['ip']=_0x258405[_0x381e('0x29')][_0x381e('0x2a')]||_0x258405[_0x381e('0x2b')][_0x381e('0x2c')]||_0x258405['socket'][_0x381e('0x2c')]||_0x258405[_0x381e('0x2b')]['socket']['remoteAddress'];return openIssue(_0x258405[_0x381e('0x28')],_0x45a622);}; \ No newline at end of file +var _0x7be9=['customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','setEncoding','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','headers','socket','connection','remoteAddress','body','api','support','3eAmWpBVP0','key','summary','Report','description','stringify','fields','email'];(function(_0x5e7e63,_0x6a71e9){var _0x5902c6=function(_0x28e867){while(--_0x28e867){_0x5e7e63['push'](_0x5e7e63['shift']());}};_0x5902c6(++_0x6a71e9);}(_0x7be9,0x100));var _0x97be=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x7be9[_0x342baa];return _0x1208f3;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')(_0x97be('0x0'));var USERNAME=_0x97be('0x1');var PASSWORD=_0x97be('0x2');function openIssue(_0x428eec,_0x11dbd8){var _0x242f88={'fields':{'project':{'key':_0x428eec[_0x97be('0x3')]||'MOTGUI'},'summary':(_0x428eec[_0x97be('0x4')]||_0x97be('0x5'))+'\x20from\x20'+_0x428eec['ip'],'description':_0x428eec[_0x97be('0x6')]||JSON[_0x97be('0x7')](_0x428eec),'issuetype':{'name':_0x428eec['issuetype']||'Bug'}}};_0x242f88[_0x97be('0x8')]['customfield_11500']=_0x428eec[_0x97be('0x9')];_0x242f88['fields'][_0x97be('0xa')]=_0x428eec[_0x97be('0xb')];_0x242f88[_0x97be('0x8')][_0x97be('0xc')]=_0x428eec['newToken'];_0x242f88[_0x97be('0x8')][_0x97be('0xd')]=_0x428eec[_0x97be('0xe')];_0x242f88[_0x97be('0x8')][_0x97be('0xf')]=_0x428eec[_0x97be('0x10')];_0x242f88['fields'][_0x97be('0x11')]=_0x428eec['ip'];var _0x146985={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x97be('0x12'),'method':_0x97be('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x97be('0x14'),'Authorization':_0x97be('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x97be('0x16')]('base64')}};var _0x5573db=JSON[_0x97be('0x7')](_0x242f88);var _0x3308e2=https['request'](_0x146985,function(_0x130e96){_0x130e96[_0x97be('0x17')]('utf8');var _0x1cc65d='';_0x130e96['on']('data',function(_0x261824){_0x1cc65d+=_0x261824;});_0x130e96['on'](_0x97be('0x18'),function(){if(_0x11dbd8){return _0x11dbd8[_0x97be('0x19')](_0x130e96[_0x97be('0x1a')])['json'](JSON[_0x97be('0x1b')](_0x1cc65d));}});});_0x3308e2['on'](_0x97be('0x1c'),function(_0x1a3183){if(_0x11dbd8){return _0x11dbd8[_0x97be('0x19')](0x1f4)[_0x97be('0x1d')]({'errors':[{'message':_0x97be('0x1e'),'type':_0x97be('0x1f')}]});}});_0x3308e2['write'](_0x5573db);_0x3308e2[_0x97be('0x18')]();}exports['openIssue']=openIssue;exports[_0x97be('0x20')]=function(_0x4e369b,_0x283f2c){_0x4e369b['body']['ip']=_0x4e369b[_0x97be('0x21')]['x-forwarded-for']||_0x4e369b['connection']['remoteAddress']||_0x4e369b[_0x97be('0x22')]['remoteAddress']||_0x4e369b[_0x97be('0x23')]['socket'][_0x97be('0x24')];return openIssue(_0x4e369b[_0x97be('0x25')],_0x283f2c);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a3f2461..1912069 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 _0xd64b=['../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','path','express','Router','fs-extra'];(function(_0x54875b,_0x24835d){var _0x5edd2f=function(_0x394176){while(--_0x394176){_0x54875b['push'](_0x54875b['shift']());}};_0x5edd2f(++_0x24835d);}(_0xd64b,0xc1));var _0xbd64=function(_0x37d870,_0x43470b){_0x37d870=_0x37d870-0x0;var _0x4b2c5f=_0xd64b[_0x37d870];return _0x4b2c5f;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var fs_extra=require(_0xbd64('0x4'));var auth=require(_0xbd64('0x5'));var interaction=require(_0xbd64('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x8')](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x8')](_0xbd64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbd64('0xd')]('/',auth[_0xbd64('0xa')](),controller[_0xbd64('0xe')]);router['put'](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xf')]);router[_0xbd64('0x10')]('/:id',auth[_0xbd64('0xa')](),controller['destroy']);module[_0xbd64('0x11')]=router; \ No newline at end of file +var _0x0713=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x398160,_0x23a2ec){var _0x2d3ec1=function(_0x72f761){while(--_0x72f761){_0x398160['push'](_0x398160['shift']());}};_0x2d3ec1(++_0x23a2ec);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xd'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4a09d7a..1040ed2 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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x3efecc,_0x2a0051){_0x3efecc=_0x3efecc-0x0;var _0x45e64d=_0x7a54[_0x3efecc];return _0x45e64d;};'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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7a54,0x106));var _0x47a5=function(_0x561d19,_0x12a57a){_0x561d19=_0x561d19-0x0;var _0x31685d=_0x7a54[_0x561d19];return _0x31685d;};'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 ae8f0ea..75e7c3b 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 _0xaa3f=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','JscriptyAnswerReport','include','rows','show','params','includeAll','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then'];(function(_0x197719,_0x329fdc){var _0x2dab09=function(_0x233b9c){while(--_0x233b9c){_0x197719['push'](_0x197719['shift']());}};_0x2dab09(++_0x329fdc);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x1496ed,_0x4e79f1){_0x1496ed=_0x1496ed-0x0;var _0x5f1086=_0xaa3f[_0x1496ed];return _0x5f1086;};'use strict';var emlformat=require(_0xfaa3('0x0'));var rimraf=require(_0xfaa3('0x1'));var zipdir=require(_0xfaa3('0x2'));var jsonpatch=require(_0xfaa3('0x3'));var rp=require(_0xfaa3('0x4'));var moment=require(_0xfaa3('0x5'));var BPromise=require(_0xfaa3('0x6'));var Mustache=require(_0xfaa3('0x7'));var util=require(_0xfaa3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfaa3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfaa3('0xa'));var _=require(_0xfaa3('0xb'));var squel=require(_0xfaa3('0xc'));var crypto=require(_0xfaa3('0xd'));var jsforce=require(_0xfaa3('0xe'));var deskjs=require(_0xfaa3('0xf'));var toCsv=require(_0xfaa3('0x9'));var querystring=require('querystring');var Papa=require(_0xfaa3('0x10'));var Redis=require(_0xfaa3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfaa3('0x12'));var hardwareService=require(_0xfaa3('0x13'));var logger=require(_0xfaa3('0x14'))(_0xfaa3('0x15'));var utils=require(_0xfaa3('0x16'));var config=require(_0xfaa3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaa3('0x18'))['db'];function respondWithStatusCode(_0x5be067,_0x1aa8e8){_0x1aa8e8=_0x1aa8e8||0xcc;return function(_0x2b8935){if(_0x2b8935){return _0x5be067[_0xfaa3('0x19')](_0x1aa8e8);}return _0x5be067['status'](_0x1aa8e8)[_0xfaa3('0x1a')]();};}function respondWithResult(_0x5f121b,_0xdf7551){_0xdf7551=_0xdf7551||0xc8;return function(_0x84b465){if(_0x84b465){return _0x5f121b[_0xfaa3('0x1b')](_0xdf7551)[_0xfaa3('0x1c')](_0x84b465);}};}function respondWithFilteredResult(_0x1243ed,_0x40831f){return function(_0x4da250){if(_0x4da250){var _0x5f47dd=typeof _0x40831f[_0xfaa3('0x1d')]===_0xfaa3('0x1e')&&typeof _0x40831f[_0xfaa3('0x1f')]===_0xfaa3('0x1e');var _0x4e54e4=_0x4da250['count'];var _0x50f121=_0x5f47dd?0x0:_0x40831f['offset'];var _0x499148=_0x5f47dd?_0x4da250[_0xfaa3('0x20')]:_0x40831f['offset']+_0x40831f[_0xfaa3('0x1f')];var _0x42846e;if(_0x499148>=_0x4e54e4){_0x499148=_0x4e54e4;_0x42846e=0xc8;}else{_0x42846e=0xce;}_0x1243ed[_0xfaa3('0x1b')](_0x42846e);return _0x1243ed[_0xfaa3('0x21')](_0xfaa3('0x22'),_0x50f121+'-'+_0x499148+'/'+_0x4e54e4)[_0xfaa3('0x1c')](_0x4da250);}return null;};}function patchUpdates(_0x1dd053){return function(_0x1ab9cc){try{jsonpatch[_0xfaa3('0x23')](_0x1ab9cc,_0x1dd053,!![]);}catch(_0x39e91e){return BPromise['reject'](_0x39e91e);}return _0x1ab9cc[_0xfaa3('0x24')]();};}function saveUpdates(_0x755038,_0x26d9ef){return function(_0x42b214){if(_0x42b214){return _0x42b214['update'](_0x755038)[_0xfaa3('0x25')](function(_0x2d4087){return _0x2d4087;});}return null;};}function removeEntity(_0x2f077c,_0x22156a){return function(_0x16a3e3){if(_0x16a3e3){return _0x16a3e3[_0xfaa3('0x26')]()[_0xfaa3('0x25')](function(){_0x2f077c[_0xfaa3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe075fc,_0x2a1ace){return function(_0x699e72){if(!_0x699e72){_0xe075fc[_0xfaa3('0x19')](0x194);}return _0x699e72;};}function handleError(_0x31c5cd,_0xf83bbe){_0xf83bbe=_0xf83bbe||0x1f4;return function(_0x2416fe){logger[_0xfaa3('0x27')](_0x2416fe[_0xfaa3('0x28')]);if(_0x2416fe[_0xfaa3('0x29')]){delete _0x2416fe[_0xfaa3('0x29')];}_0x31c5cd[_0xfaa3('0x1b')](_0xf83bbe)[_0xfaa3('0x2a')](_0x2416fe);};}exports[_0xfaa3('0x2b')]=function(_0x2d7c43,_0x5b84cd){var _0x230430={},_0x104343={},_0xc2e71={'count':0x0,'rows':[]};var _0x54bc09=_[_0xfaa3('0x2c')](db['JscriptyAnswerReport'][_0xfaa3('0x2d')],function(_0x5d37bb){return{'name':_0x5d37bb[_0xfaa3('0x2e')],'type':_0x5d37bb[_0xfaa3('0x2f')][_0xfaa3('0x30')]};});_0x104343[_0xfaa3('0x31')]=_[_0xfaa3('0x2c')](_0x54bc09,_0xfaa3('0x29'));_0x104343[_0xfaa3('0x32')]=_[_0xfaa3('0x33')](_0x2d7c43['query']);_0x104343[_0xfaa3('0x34')]=_[_0xfaa3('0x35')](_0x104343[_0xfaa3('0x31')],_0x104343[_0xfaa3('0x32')]);_0x230430[_0xfaa3('0x36')]=_[_0xfaa3('0x35')](_0x104343[_0xfaa3('0x31')],qs[_0xfaa3('0x37')](_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x37')]));_0x230430[_0xfaa3('0x36')]=_0x230430[_0xfaa3('0x36')][_0xfaa3('0x38')]?_0x230430[_0xfaa3('0x36')]:_0x104343[_0xfaa3('0x31')];if(!_0x2d7c43[_0xfaa3('0x32')]['hasOwnProperty'](_0xfaa3('0x39'))){_0x230430[_0xfaa3('0x1f')]=qs[_0xfaa3('0x1f')](_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x1f')]);_0x230430[_0xfaa3('0x1d')]=qs[_0xfaa3('0x1d')](_0x2d7c43[_0xfaa3('0x32')]['offset']);}_0x230430[_0xfaa3('0x3a')]=qs[_0xfaa3('0x3b')](_0x2d7c43[_0xfaa3('0x32')]['sort']);_0x230430[_0xfaa3('0x3c')]=qs[_0xfaa3('0x34')](_['pick'](_0x2d7c43[_0xfaa3('0x32')],_0x104343[_0xfaa3('0x34')]),_0x54bc09);if(_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x3d')]){_0x230430[_0xfaa3('0x3c')]=_[_0xfaa3('0x3e')](_0x230430['where'],{'$or':_['map'](_0x54bc09,function(_0x41498d){if(_0x41498d[_0xfaa3('0x2f')]!=='VIRTUAL'){var _0x4ae1c3={};_0x4ae1c3[_0x41498d[_0xfaa3('0x29')]]={'$like':'%'+_0x2d7c43['query'][_0xfaa3('0x3d')]+'%'};return _0x4ae1c3;}})});}_0x230430=_[_0xfaa3('0x3e')]({},_0x230430,_0x2d7c43[_0xfaa3('0x3f')]);var _0x3fb71d={'where':_0x230430[_0xfaa3('0x3c')]};return db[_0xfaa3('0x40')][_0xfaa3('0x20')](_0x3fb71d)[_0xfaa3('0x25')](function(_0x551cd5){_0xc2e71['count']=_0x551cd5;if(_0x2d7c43['query']['includeAll']){_0x230430[_0xfaa3('0x41')]=[{'all':!![]}];}return db[_0xfaa3('0x40')]['findAll'](_0x230430);})[_0xfaa3('0x25')](function(_0xa83a03){_0xc2e71[_0xfaa3('0x42')]=_0xa83a03;return _0xc2e71;})['then'](respondWithFilteredResult(_0x5b84cd,_0x230430))['catch'](handleError(_0x5b84cd,null));};exports[_0xfaa3('0x43')]=function(_0x4c19fc,_0x1701bc){var _0x57b77c={'raw':!![],'where':{'id':_0x4c19fc[_0xfaa3('0x44')]['id']}},_0x59b4d7={};_0x59b4d7[_0xfaa3('0x31')]=_['keys'](db[_0xfaa3('0x40')]['rawAttributes']);_0x59b4d7[_0xfaa3('0x32')]=_['keys'](_0x4c19fc[_0xfaa3('0x32')]);_0x59b4d7[_0xfaa3('0x34')]=_[_0xfaa3('0x35')](_0x59b4d7['model'],_0x59b4d7[_0xfaa3('0x32')]);_0x57b77c[_0xfaa3('0x36')]=_['intersection'](_0x59b4d7[_0xfaa3('0x31')],qs[_0xfaa3('0x37')](_0x4c19fc[_0xfaa3('0x32')][_0xfaa3('0x37')]));_0x57b77c['attributes']=_0x57b77c[_0xfaa3('0x36')][_0xfaa3('0x38')]?_0x57b77c['attributes']:_0x59b4d7[_0xfaa3('0x31')];if(_0x4c19fc['query'][_0xfaa3('0x45')]){_0x57b77c[_0xfaa3('0x41')]=[{'all':!![]}];}_0x57b77c=_[_0xfaa3('0x3e')]({},_0x57b77c,_0x4c19fc['options']);return db[_0xfaa3('0x40')]['find'](_0x57b77c)['then'](handleEntityNotFound(_0x1701bc,null))[_0xfaa3('0x25')](respondWithResult(_0x1701bc,null))[_0xfaa3('0x46')](handleError(_0x1701bc,null));};exports[_0xfaa3('0x47')]=function(_0x27feb6,_0x1a4fa4){return db[_0xfaa3('0x40')][_0xfaa3('0x47')](_0x27feb6['body'],{})[_0xfaa3('0x25')](respondWithResult(_0x1a4fa4,0xc9))[_0xfaa3('0x46')](handleError(_0x1a4fa4,null));};exports[_0xfaa3('0x48')]=function(_0x72f502,_0x431725){if(_0x72f502[_0xfaa3('0x49')]['id']){delete _0x72f502[_0xfaa3('0x49')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x72f502['params']['id']}})[_0xfaa3('0x25')](handleEntityNotFound(_0x431725,null))[_0xfaa3('0x25')](saveUpdates(_0x72f502[_0xfaa3('0x49')],null))[_0xfaa3('0x25')](respondWithResult(_0x431725,null))['catch'](handleError(_0x431725,null));};exports[_0xfaa3('0x26')]=function(_0x50336d,_0x513d3e){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x50336d['params']['id']}})[_0xfaa3('0x25')](handleEntityNotFound(_0x513d3e,null))[_0xfaa3('0x25')](removeEntity(_0x513d3e,null))[_0xfaa3('0x46')](handleError(_0x513d3e,null));};exports[_0xfaa3('0x4a')]=function(_0x32ab8d,_0x1c856b){return db[_0xfaa3('0x40')][_0xfaa3('0x4a')]()['then'](respondWithResult(_0x1c856b,null))[_0xfaa3('0x46')](handleError(_0x1c856b,null));}; \ No newline at end of file +var _0x6ec2=['Content-Range','apply','save','update','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','keys','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x551ac3,_0x90ddc5){var _0x4fe50b=function(_0x36dae2){while(--_0x36dae2){_0x551ac3['push'](_0x551ac3['shift']());}};_0x4fe50b(++_0x90ddc5);}(_0x6ec2,0x78));var _0x26ec=function(_0x4fd81f,_0x2ba61c){_0x4fd81f=_0x4fd81f-0x0;var _0x1f3b30=_0x6ec2[_0x4fd81f];return _0x1f3b30;};'use strict';var emlformat=require(_0x26ec('0x0'));var rimraf=require(_0x26ec('0x1'));var zipdir=require(_0x26ec('0x2'));var jsonpatch=require(_0x26ec('0x3'));var rp=require(_0x26ec('0x4'));var moment=require(_0x26ec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x26ec('0x6'));var util=require(_0x26ec('0x7'));var path=require(_0x26ec('0x8'));var sox=require(_0x26ec('0x9'));var csv=require(_0x26ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26ec('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x26ec('0xc'));var jsforce=require(_0x26ec('0xd'));var deskjs=require(_0x26ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x26ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x26ec('0x10'));var authService=require(_0x26ec('0x11'));var qs=require(_0x26ec('0x12'));var as=require(_0x26ec('0x13'));var hardwareService=require(_0x26ec('0x14'));var logger=require(_0x26ec('0x15'))(_0x26ec('0x16'));var utils=require(_0x26ec('0x17'));var config=require(_0x26ec('0x18'));var licenseUtil=require(_0x26ec('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5212e4,_0x2d869a){_0x2d869a=_0x2d869a||0xcc;return function(_0x1bec27){if(_0x1bec27){return _0x5212e4[_0x26ec('0x1a')](_0x2d869a);}return _0x5212e4[_0x26ec('0x1b')](_0x2d869a)[_0x26ec('0x1c')]();};}function respondWithResult(_0xff29e5,_0x30cbd3){_0x30cbd3=_0x30cbd3||0xc8;return function(_0x49467a){if(_0x49467a){return _0xff29e5[_0x26ec('0x1b')](_0x30cbd3)[_0x26ec('0x1d')](_0x49467a);}};}function respondWithFilteredResult(_0x302bde,_0x7f9bb2){return function(_0x4f9950){if(_0x4f9950){var _0x4d366c=typeof _0x7f9bb2[_0x26ec('0x1e')]===_0x26ec('0x1f')&&typeof _0x7f9bb2[_0x26ec('0x20')]===_0x26ec('0x1f');var _0x49dc68=_0x4f9950[_0x26ec('0x21')];var _0x176613=_0x4d366c?0x0:_0x7f9bb2['offset'];var _0x5ef1e5=_0x4d366c?_0x4f9950['count']:_0x7f9bb2[_0x26ec('0x1e')]+_0x7f9bb2[_0x26ec('0x20')];var _0x60511e;if(_0x5ef1e5>=_0x49dc68){_0x5ef1e5=_0x49dc68;_0x60511e=0xc8;}else{_0x60511e=0xce;}_0x302bde['status'](_0x60511e);return _0x302bde['set'](_0x26ec('0x22'),_0x176613+'-'+_0x5ef1e5+'/'+_0x49dc68)[_0x26ec('0x1d')](_0x4f9950);}return null;};}function patchUpdates(_0x33a28b){return function(_0x2f4d14){try{jsonpatch[_0x26ec('0x23')](_0x2f4d14,_0x33a28b,!![]);}catch(_0xe199f2){return BPromise['reject'](_0xe199f2);}return _0x2f4d14[_0x26ec('0x24')]();};}function saveUpdates(_0x29c34a,_0x2a9e82){return function(_0x46f766){if(_0x46f766){return _0x46f766[_0x26ec('0x25')](_0x29c34a)['then'](function(_0x5202e6){return _0x5202e6;});}return null;};}function removeEntity(_0x2204ba,_0x16154d){return function(_0x65aea3){if(_0x65aea3){return _0x65aea3['destroy']()['then'](function(){_0x2204ba[_0x26ec('0x1b')](0xcc)[_0x26ec('0x1c')]();});}};}function handleEntityNotFound(_0x16aba4,_0x365fac){return function(_0x4030ea){if(!_0x4030ea){_0x16aba4[_0x26ec('0x1a')](0x194);}return _0x4030ea;};}function handleError(_0x439f78,_0x4e9cf8){_0x4e9cf8=_0x4e9cf8||0x1f4;return function(_0x50fedc){logger['error'](_0x50fedc[_0x26ec('0x26')]);if(_0x50fedc[_0x26ec('0x27')]){delete _0x50fedc[_0x26ec('0x27')];}_0x439f78[_0x26ec('0x1b')](_0x4e9cf8)[_0x26ec('0x28')](_0x50fedc);};}exports[_0x26ec('0x29')]=function(_0x3268e9,_0x4a1371){var _0x30231e={},_0x5d10ba={},_0x38e942={'count':0x0,'rows':[]};var _0x355c4e=_['map'](db[_0x26ec('0x2a')][_0x26ec('0x2b')],function(_0x139d24){return{'name':_0x139d24[_0x26ec('0x2c')],'type':_0x139d24[_0x26ec('0x2d')][_0x26ec('0x2e')]};});_0x5d10ba['model']=_[_0x26ec('0x2f')](_0x355c4e,'name');_0x5d10ba[_0x26ec('0x30')]=_['keys'](_0x3268e9[_0x26ec('0x30')]);_0x5d10ba[_0x26ec('0x31')]=_['intersection'](_0x5d10ba[_0x26ec('0x32')],_0x5d10ba[_0x26ec('0x30')]);_0x30231e[_0x26ec('0x33')]=_[_0x26ec('0x34')](_0x5d10ba[_0x26ec('0x32')],qs[_0x26ec('0x35')](_0x3268e9['query']['fields']));_0x30231e['attributes']=_0x30231e['attributes']['length']?_0x30231e[_0x26ec('0x33')]:_0x5d10ba[_0x26ec('0x32')];if(!_0x3268e9[_0x26ec('0x30')][_0x26ec('0x36')](_0x26ec('0x37'))){_0x30231e['limit']=qs[_0x26ec('0x20')](_0x3268e9[_0x26ec('0x30')][_0x26ec('0x20')]);_0x30231e[_0x26ec('0x1e')]=qs[_0x26ec('0x1e')](_0x3268e9['query'][_0x26ec('0x1e')]);}_0x30231e[_0x26ec('0x38')]=qs[_0x26ec('0x39')](_0x3268e9[_0x26ec('0x30')][_0x26ec('0x39')]);_0x30231e[_0x26ec('0x3a')]=qs[_0x26ec('0x31')](_[_0x26ec('0x3b')](_0x3268e9[_0x26ec('0x30')],_0x5d10ba[_0x26ec('0x31')]),_0x355c4e);if(_0x3268e9['query']['filter']){_0x30231e[_0x26ec('0x3a')]=_[_0x26ec('0x3c')](_0x30231e['where'],{'$or':_[_0x26ec('0x2f')](_0x355c4e,function(_0x4cbe80){if(_0x4cbe80[_0x26ec('0x2d')]!==_0x26ec('0x3d')){var _0x11fc8c={};_0x11fc8c[_0x4cbe80[_0x26ec('0x27')]]={'$like':'%'+_0x3268e9[_0x26ec('0x30')][_0x26ec('0x3e')]+'%'};return _0x11fc8c;}})});}_0x30231e=_['merge']({},_0x30231e,_0x3268e9[_0x26ec('0x3f')]);var _0x3441f4={'where':_0x30231e[_0x26ec('0x3a')]};return db[_0x26ec('0x2a')][_0x26ec('0x21')](_0x3441f4)[_0x26ec('0x40')](function(_0x440ed3){_0x38e942[_0x26ec('0x21')]=_0x440ed3;if(_0x3268e9[_0x26ec('0x30')][_0x26ec('0x41')]){_0x30231e[_0x26ec('0x42')]=[{'all':!![]}];}return db[_0x26ec('0x2a')][_0x26ec('0x43')](_0x30231e);})[_0x26ec('0x40')](function(_0x20a6dd){_0x38e942['rows']=_0x20a6dd;return _0x38e942;})[_0x26ec('0x40')](respondWithFilteredResult(_0x4a1371,_0x30231e))[_0x26ec('0x44')](handleError(_0x4a1371,null));};exports[_0x26ec('0x45')]=function(_0x611b8f,_0x452bbb){var _0x1be9f7={'raw':!![],'where':{'id':_0x611b8f['params']['id']}},_0x58faf4={};_0x58faf4[_0x26ec('0x32')]=_['keys'](db[_0x26ec('0x2a')][_0x26ec('0x2b')]);_0x58faf4[_0x26ec('0x30')]=_[_0x26ec('0x46')](_0x611b8f[_0x26ec('0x30')]);_0x58faf4[_0x26ec('0x31')]=_[_0x26ec('0x34')](_0x58faf4[_0x26ec('0x32')],_0x58faf4['query']);_0x1be9f7[_0x26ec('0x33')]=_[_0x26ec('0x34')](_0x58faf4[_0x26ec('0x32')],qs['fields'](_0x611b8f[_0x26ec('0x30')][_0x26ec('0x35')]));_0x1be9f7[_0x26ec('0x33')]=_0x1be9f7[_0x26ec('0x33')][_0x26ec('0x47')]?_0x1be9f7[_0x26ec('0x33')]:_0x58faf4[_0x26ec('0x32')];if(_0x611b8f[_0x26ec('0x30')][_0x26ec('0x41')]){_0x1be9f7[_0x26ec('0x42')]=[{'all':!![]}];}_0x1be9f7=_[_0x26ec('0x3c')]({},_0x1be9f7,_0x611b8f[_0x26ec('0x3f')]);return db[_0x26ec('0x2a')][_0x26ec('0x48')](_0x1be9f7)['then'](handleEntityNotFound(_0x452bbb,null))['then'](respondWithResult(_0x452bbb,null))[_0x26ec('0x44')](handleError(_0x452bbb,null));};exports['create']=function(_0x4f873e,_0x1350d0){return db[_0x26ec('0x2a')][_0x26ec('0x49')](_0x4f873e['body'],{})['then'](respondWithResult(_0x1350d0,0xc9))['catch'](handleError(_0x1350d0,null));};exports['update']=function(_0x3faf2b,_0x583a22){if(_0x3faf2b[_0x26ec('0x4a')]['id']){delete _0x3faf2b[_0x26ec('0x4a')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3faf2b[_0x26ec('0x4b')]['id']}})[_0x26ec('0x40')](handleEntityNotFound(_0x583a22,null))['then'](saveUpdates(_0x3faf2b[_0x26ec('0x4a')],null))[_0x26ec('0x40')](respondWithResult(_0x583a22,null))['catch'](handleError(_0x583a22,null));};exports['destroy']=function(_0x34ee55,_0x125459){return db[_0x26ec('0x2a')]['find']({'where':{'id':_0x34ee55[_0x26ec('0x4b')]['id']}})['then'](handleEntityNotFound(_0x125459,null))[_0x26ec('0x40')](removeEntity(_0x125459,null))[_0x26ec('0x44')](handleError(_0x125459,null));};exports[_0x26ec('0x4c')]=function(_0x4750a2,_0x43f2fe){return db[_0x26ec('0x2a')]['describe']()[_0x26ec('0x40')](respondWithResult(_0x43f2fe,null))[_0x26ec('0x44')](handleError(_0x43f2fe,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3a8e566..85eb0f6 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 _0xd547=['./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d1c2b,_0x47b2da){var _0x23839b=function(_0x4c99c2){while(--_0x4c99c2){_0x1d1c2b['push'](_0x1d1c2b['shift']());}};_0x23839b(++_0x47b2da);}(_0xd547,0x8c));var _0x7d54=function(_0x36949f,_0xac8926){_0x36949f=_0x36949f-0x0;var _0x225ac9=_0xd547[_0x36949f];return _0x225ac9;};'use strict';var _=require(_0x7d54('0x0'));var util=require(_0x7d54('0x1'));var logger=require(_0x7d54('0x2'))(_0x7d54('0x3'));var moment=require(_0x7d54('0x4'));var BPromise=require(_0x7d54('0x5'));var rp=require(_0x7d54('0x6'));var fs=require('fs');var path=require(_0x7d54('0x7'));var rimraf=require(_0x7d54('0x8'));var config=require(_0x7d54('0x9'));var attributes=require(_0x7d54('0xa'));module[_0x7d54('0xb')]=function(_0x457bc0,_0x47d81f){return _0x457bc0[_0x7d54('0xc')](_0x7d54('0xd'),attributes,{'tableName':_0x7d54('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc037=['JscriptyAnswerReport','lodash','util','../../config/logger','api','./jscriptyAnswerReport.attributes','exports'];(function(_0x10f22e,_0x867d8b){var _0x351ce7=function(_0x44ce1b){while(--_0x44ce1b){_0x10f22e['push'](_0x10f22e['shift']());}};_0x351ce7(++_0x867d8b);}(_0xc037,0xbe));var _0x7c03=function(_0x39a303,_0x3406a8){_0x39a303=_0x39a303-0x0;var _0xee03a2=_0xc037[_0x39a303];return _0xee03a2;};'use strict';var _=require(_0x7c03('0x0'));var util=require(_0x7c03('0x1'));var logger=require(_0x7c03('0x2'))(_0x7c03('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('rimraf');var config=require('../../config/environment');var attributes=require(_0x7c03('0x4'));module[_0x7c03('0x5')]=function(_0x2c8223,_0x124603){return _0x2c8223['define'](_0x7c03('0x6'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 78b57fe..66babe9 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 _0x5703=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info'];(function(_0x9b9ca8,_0x22a714){var _0x1a720f=function(_0x433b1a){while(--_0x433b1a){_0x9b9ca8['push'](_0x9b9ca8['shift']());}};_0x1a720f(++_0x22a714);}(_0x5703,0xc3));var _0x3570=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x5703[_0x3dbd6d];return _0x1216f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3570('0x0'));var rs=require(_0x3570('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3570('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3570('0x3'))(_0x3570('0x4'));var config=require(_0x3570('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3570('0x6')][_0x3570('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x203ce7,_0x362088,_0x36f518){return new BPromise(function(_0x5f0e91,_0x29c681){return client['request'](_0x203ce7,_0x36f518)['then'](function(_0x168f8b){logger[_0x3570('0x8')](_0x3570('0x9'),_0x362088,_0x3570('0xa'));logger['debug'](_0x3570('0xb'),_0x362088,_0x3570('0xa'),JSON[_0x3570('0xc')](_0x168f8b));if(_0x168f8b[_0x3570('0xd')]){if(_0x168f8b[_0x3570('0xd')][_0x3570('0xe')]===0x1f4){logger['error'](_0x3570('0x9'),_0x362088,_0x168f8b[_0x3570('0xd')][_0x3570('0xf')]);return _0x29c681(_0x168f8b[_0x3570('0xd')][_0x3570('0xf')]);}logger[_0x3570('0xd')](_0x3570('0x9'),_0x362088,_0x168f8b[_0x3570('0xd')][_0x3570('0xf')]);return _0x5f0e91(_0x168f8b['error'][_0x3570('0xf')]);}else{logger[_0x3570('0x8')](_0x3570('0x9'),_0x362088,_0x3570('0xa'));_0x5f0e91(_0x168f8b['result']['message']);}})[_0x3570('0x10')](function(_0x2a8fbb){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x362088,_0x2a8fbb);_0x29c681(_0x2a8fbb);});});} \ No newline at end of file +var _0x15b8=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x38b276,_0x18d1fb){var _0x4b8b2b=function(_0x3297d1){while(--_0x3297d1){_0x38b276['push'](_0x38b276['shift']());}};_0x4b8b2b(++_0x18d1fb);}(_0x15b8,0xcd));var _0x815b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x15b8[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 81d2f91..c0a8a97 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 _0xd506=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','delete','exports'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0xd506,0xb6));var _0x6d50=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xd506[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0x6d50('0x0'));var util=require(_0x6d50('0x1'));var path=require(_0x6d50('0x2'));var timeout=require(_0x6d50('0x3'));var express=require(_0x6d50('0x4'));var router=express['Router']();var fs_extra=require(_0x6d50('0x5'));var auth=require(_0x6d50('0x6'));var interaction=require(_0x6d50('0x7'));var config=require(_0x6d50('0x8'));var controller=require(_0x6d50('0x9'));router[_0x6d50('0xa')]('/',auth[_0x6d50('0xb')](),controller['index']);router[_0x6d50('0xa')](_0x6d50('0xc'),auth[_0x6d50('0xb')](),controller[_0x6d50('0xd')]);router['get'](_0x6d50('0xe'),auth[_0x6d50('0xb')](),controller['getSessions']);router[_0x6d50('0xa')](_0x6d50('0xf'),auth[_0x6d50('0xb')](),controller[_0x6d50('0x10')]);router[_0x6d50('0xa')](_0x6d50('0x11'),auth[_0x6d50('0xb')](),timeout(_0x6d50('0x12')),controller[_0x6d50('0x13')]);router[_0x6d50('0x14')]('/',auth[_0x6d50('0xb')](),controller[_0x6d50('0x15')]);router[_0x6d50('0x14')](_0x6d50('0x16'),auth[_0x6d50('0xb')](),controller[_0x6d50('0x17')]);router['put'](_0x6d50('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6d50('0x18')](_0x6d50('0xc'),auth[_0x6d50('0xb')](),controller['destroy']);module[_0x6d50('0x19')]=router; \ No newline at end of file +var _0x61fa=['./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','post','create','/:id/clone','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61fa,0xd9));var _0xa61f=function(_0x2507b6,_0x2d059a){_0x2507b6=_0x2507b6-0x0;var _0x22c8a4=_0x61fa[_0x2507b6];return _0x22c8a4;};'use strict';var multer=require('multer');var util=require(_0xa61f('0x0'));var path=require(_0xa61f('0x1'));var timeout=require(_0xa61f('0x2'));var express=require(_0xa61f('0x3'));var router=express[_0xa61f('0x4')]();var fs_extra=require(_0xa61f('0x5'));var auth=require(_0xa61f('0x6'));var interaction=require(_0xa61f('0x7'));var config=require('../../config/environment');var controller=require(_0xa61f('0x8'));router[_0xa61f('0x9')]('/',auth[_0xa61f('0xa')](),controller[_0xa61f('0xb')]);router[_0xa61f('0x9')](_0xa61f('0xc'),auth[_0xa61f('0xa')](),controller[_0xa61f('0xd')]);router[_0xa61f('0x9')](_0xa61f('0xe'),auth[_0xa61f('0xa')](),controller[_0xa61f('0xf')]);router['get'](_0xa61f('0x10'),auth[_0xa61f('0xa')](),controller['getAnswers']);router[_0xa61f('0x9')](_0xa61f('0x11'),auth['isAuthenticated'](),timeout(_0xa61f('0x12')),controller['getSummary']);router[_0xa61f('0x13')]('/',auth[_0xa61f('0xa')](),controller[_0xa61f('0x14')]);router[_0xa61f('0x13')](_0xa61f('0x15'),auth[_0xa61f('0xa')](),controller['clone']);router[_0xa61f('0x16')](_0xa61f('0xc'),auth[_0xa61f('0xa')](),controller[_0xa61f('0x17')]);router[_0xa61f('0x18')](_0xa61f('0xc'),auth[_0xa61f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a13ce5b..23ce531 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 _0x9e0c=['setDataValue','format','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','long','isObjectLike','formData','stringify','isString'];(function(_0x12db94,_0x11df32){var _0x24aec5=function(_0x28bd61){while(--_0x28bd61){_0x12db94['push'](_0x12db94['shift']());}};_0x24aec5(++_0x11df32);}(_0x9e0c,0xd7));var _0xc9e0=function(_0x1eb145,_0x52eabe){_0x1eb145=_0x1eb145-0x0;var _0x245dee=_0x9e0c[_0x1eb145];return _0x245dee;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc9e0('0x0'));var util=require(_0xc9e0('0x1'));module[_0xc9e0('0x2')]={'name':{'type':Sequelize[_0xc9e0('0x3')],'unique':_0xc9e0('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xc9e0('0x5')),'set':function(_0x1eafa7){if(_[_0xc9e0('0x6')](_0x1eafa7)){this['setDataValue'](_0xc9e0('0x7'),JSON[_0xc9e0('0x8')](_0x1eafa7));}else if(_[_0xc9e0('0x9')](_0x1eafa7)){this[_0xc9e0('0xa')](_0xc9e0('0x7'),_0x1eafa7);}else{this['setDataValue'](_0xc9e0('0x7'),util[_0xc9e0('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue']('name')||'',this[_0xc9e0('0xc')](_0xc9e0('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc9e0('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xae5f=['stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','STRING','name','long','isObjectLike','setDataValue','formData'];(function(_0xeff2c3,_0x3a5a82){var _0x2cade6=function(_0x5a26a1){while(--_0x5a26a1){_0xeff2c3['push'](_0xeff2c3['shift']());}};_0x2cade6(++_0x3a5a82);}(_0xae5f,0x1d8));var _0xfae5=function(_0x37cf6a,_0x343e2c){_0x37cf6a=_0x37cf6a-0x0;var _0x3b6832=_0xae5f[_0x37cf6a];return _0x3b6832;};'use strict';var Sequelize=require(_0xfae5('0x0'));var _=require(_0xfae5('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xfae5('0x2')],'unique':_0xfae5('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xfae5('0x4')),'set':function(_0x4e8db3){if(_[_0xfae5('0x5')](_0x4e8db3)){this[_0xfae5('0x6')](_0xfae5('0x7'),JSON[_0xfae5('0x8')](_0x4e8db3));}else if(_[_0xfae5('0x9')](_0x4e8db3)){this['setDataValue'](_0xfae5('0x7'),_0x4e8db3);}else{this[_0xfae5('0x6')](_0xfae5('0x7'),util[_0xfae5('0xa')](_0xfae5('0xb'),this['getDataValue']('name')||'',this[_0xfae5('0xc')](_0xfae5('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xfae5('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfae5('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 8218ac7..a5ba6a2 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 _0x38dc=['pick','filter','VIRTUAL','merge','options','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','omit','createdAt','userProfileId','error','update','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','reject','then','destroy','get','Projects','UserProfileResource','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x18a81a,_0x4fc65b){var _0x114027=function(_0x1b7e0f){while(--_0x1b7e0f){_0x18a81a['push'](_0x18a81a['shift']());}};_0x114027(++_0x4fc65b);}(_0x38dc,0x117));var _0xc38d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x38dc[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc38d('0x0'));var jsonpatch=require(_0xc38d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc38d('0x2'));var util=require('util');var path=require(_0xc38d('0x3'));var sox=require('sox');var csv=require(_0xc38d('0x4'));var ejs=require(_0xc38d('0x5'));var fs=require('fs');var fs_extra=require(_0xc38d('0x6'));var _=require(_0xc38d('0x7'));var squel=require(_0xc38d('0x8'));var crypto=require(_0xc38d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc38d('0xa'));var toCsv=require(_0xc38d('0x4'));var querystring=require(_0xc38d('0xb'));var Papa=require(_0xc38d('0xc'));var Redis=require(_0xc38d('0xd'));var authService=require(_0xc38d('0xe'));var qs=require(_0xc38d('0xf'));var as=require(_0xc38d('0x10'));var hardwareService=require(_0xc38d('0x11'));var logger=require('../../config/logger')(_0xc38d('0x12'));var utils=require('../../config/utils');var config=require(_0xc38d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc38d('0x14'))['db'];function respondWithStatusCode(_0x3f9148,_0x55fadd){_0x55fadd=_0x55fadd||0xcc;return function(_0x5d1a05){if(_0x5d1a05){return _0x3f9148['sendStatus'](_0x55fadd);}return _0x3f9148[_0xc38d('0x15')](_0x55fadd)[_0xc38d('0x16')]();};}function respondWithResult(_0x7fe769,_0x33cb70){_0x33cb70=_0x33cb70||0xc8;return function(_0x21c3f9){if(_0x21c3f9){return _0x7fe769[_0xc38d('0x15')](_0x33cb70)[_0xc38d('0x17')](_0x21c3f9);}};}function respondWithFilteredResult(_0x4a3c4f,_0x73c0c2){return function(_0x5e9785){if(_0x5e9785){var _0x405097=typeof _0x73c0c2[_0xc38d('0x18')]===_0xc38d('0x19')&&typeof _0x73c0c2[_0xc38d('0x1a')]==='undefined';var _0x174bcd=_0x5e9785[_0xc38d('0x1b')];var _0xc01865=_0x405097?0x0:_0x73c0c2['offset'];var _0x27c320=_0x405097?_0x5e9785[_0xc38d('0x1b')]:_0x73c0c2['offset']+_0x73c0c2[_0xc38d('0x1a')];var _0x2f68fb;if(_0x27c320>=_0x174bcd){_0x27c320=_0x174bcd;_0x2f68fb=0xc8;}else{_0x2f68fb=0xce;}_0x4a3c4f[_0xc38d('0x15')](_0x2f68fb);return _0x4a3c4f['set']('Content-Range',_0xc01865+'-'+_0x27c320+'/'+_0x174bcd)[_0xc38d('0x17')](_0x5e9785);}return null;};}function patchUpdates(_0x40654b){return function(_0x4f5f76){try{jsonpatch['apply'](_0x4f5f76,_0x40654b,!![]);}catch(_0x3ab83b){return BPromise[_0xc38d('0x1c')](_0x3ab83b);}return _0x4f5f76['save']();};}function saveUpdates(_0x5571ed,_0x29b63a){return function(_0x2c14cb){if(_0x2c14cb){return _0x2c14cb['update'](_0x5571ed)[_0xc38d('0x1d')](function(_0x35bd12){return _0x35bd12;});}return null;};}function removeEntity(_0x523e36,_0x1e23f5){return function(_0xf42036){if(_0xf42036){return _0xf42036[_0xc38d('0x1e')]()['then'](function(){var _0xf2258f=_0xf42036[_0xc38d('0x1f')]({'plain':!![]});var _0x4a57c5=_0xc38d('0x20');return db[_0xc38d('0x21')][_0xc38d('0x1e')]({'where':{'type':_0x4a57c5,'resourceId':_0xf2258f['id']}})['then'](function(){return _0xf42036;});})[_0xc38d('0x1d')](function(){_0x523e36[_0xc38d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x797c7d,_0x2ee943){return function(_0x5f48a2){if(!_0x5f48a2){_0x797c7d['sendStatus'](0x194);}return _0x5f48a2;};}function handleError(_0x425f3b,_0x5036ae){_0x5036ae=_0x5036ae||0x1f4;return function(_0x40a121){logger['error'](_0x40a121['stack']);if(_0x40a121[_0xc38d('0x22')]){delete _0x40a121[_0xc38d('0x22')];}_0x425f3b[_0xc38d('0x15')](_0x5036ae)['send'](_0x40a121);};}exports[_0xc38d('0x23')]=function(_0x37290c,_0xb046c6){var _0x5a553e={},_0x696ee4={},_0x47354c={'count':0x0,'rows':[]};var _0x9cb572=_['map'](db['JscriptyProject'][_0xc38d('0x24')],function(_0x594ac5){return{'name':_0x594ac5[_0xc38d('0x25')],'type':_0x594ac5[_0xc38d('0x26')][_0xc38d('0x27')]};});_0x696ee4[_0xc38d('0x28')]=_[_0xc38d('0x29')](_0x9cb572,_0xc38d('0x22'));_0x696ee4[_0xc38d('0x2a')]=_[_0xc38d('0x2b')](_0x37290c[_0xc38d('0x2a')]);_0x696ee4[_0xc38d('0x2c')]=_[_0xc38d('0x2d')](_0x696ee4[_0xc38d('0x28')],_0x696ee4[_0xc38d('0x2a')]);_0x5a553e[_0xc38d('0x2e')]=_['intersection'](_0x696ee4[_0xc38d('0x28')],qs['fields'](_0x37290c[_0xc38d('0x2a')][_0xc38d('0x2f')]));_0x5a553e[_0xc38d('0x2e')]=_0x5a553e[_0xc38d('0x2e')][_0xc38d('0x30')]?_0x5a553e['attributes']:_0x696ee4[_0xc38d('0x28')];if(!_0x37290c['query'][_0xc38d('0x31')](_0xc38d('0x32'))){_0x5a553e[_0xc38d('0x1a')]=qs['limit'](_0x37290c[_0xc38d('0x2a')][_0xc38d('0x1a')]);_0x5a553e[_0xc38d('0x18')]=qs[_0xc38d('0x18')](_0x37290c[_0xc38d('0x2a')][_0xc38d('0x18')]);}_0x5a553e[_0xc38d('0x33')]=qs['sort'](_0x37290c['query'][_0xc38d('0x34')]);_0x5a553e[_0xc38d('0x35')]=qs[_0xc38d('0x2c')](_[_0xc38d('0x36')](_0x37290c[_0xc38d('0x2a')],_0x696ee4[_0xc38d('0x2c')]),_0x9cb572);if(_0x37290c[_0xc38d('0x2a')][_0xc38d('0x37')]){_0x5a553e[_0xc38d('0x35')]=_['merge'](_0x5a553e[_0xc38d('0x35')],{'$or':_['map'](_0x9cb572,function(_0x8cbf1b){if(_0x8cbf1b[_0xc38d('0x26')]!==_0xc38d('0x38')){var _0x5a9d5d={};_0x5a9d5d[_0x8cbf1b[_0xc38d('0x22')]]={'$like':'%'+_0x37290c[_0xc38d('0x2a')][_0xc38d('0x37')]+'%'};return _0x5a9d5d;}})});}_0x5a553e=_[_0xc38d('0x39')]({},_0x5a553e,_0x37290c[_0xc38d('0x3a')]);var _0x39e4d0={'where':_0x5a553e[_0xc38d('0x35')]};return db[_0xc38d('0x3b')]['count'](_0x39e4d0)['then'](function(_0x59bfc6){_0x47354c[_0xc38d('0x1b')]=_0x59bfc6;if(_0x37290c[_0xc38d('0x2a')][_0xc38d('0x3c')]){_0x5a553e[_0xc38d('0x3d')]=[{'all':!![]}];}return db[_0xc38d('0x3b')][_0xc38d('0x3e')](_0x5a553e);})[_0xc38d('0x1d')](function(_0x4941ed){_0x47354c[_0xc38d('0x3f')]=_0x4941ed;return _0x47354c;})[_0xc38d('0x1d')](respondWithFilteredResult(_0xb046c6,_0x5a553e))[_0xc38d('0x40')](handleError(_0xb046c6,null));};exports[_0xc38d('0x41')]=function(_0x1243cf,_0x351821){var _0x2f00b9={'raw':![],'where':{'id':_0x1243cf[_0xc38d('0x42')]['id']}},_0x46ec86={};_0x46ec86[_0xc38d('0x28')]=_['keys'](db[_0xc38d('0x3b')]['rawAttributes']);_0x46ec86[_0xc38d('0x2a')]=_['keys'](_0x1243cf['query']);_0x46ec86['filters']=_[_0xc38d('0x2d')](_0x46ec86[_0xc38d('0x28')],_0x46ec86[_0xc38d('0x2a')]);_0x2f00b9['attributes']=_[_0xc38d('0x2d')](_0x46ec86['model'],qs[_0xc38d('0x2f')](_0x1243cf[_0xc38d('0x2a')][_0xc38d('0x2f')]));_0x2f00b9['attributes']=_0x2f00b9[_0xc38d('0x2e')][_0xc38d('0x30')]?_0x2f00b9[_0xc38d('0x2e')]:_0x46ec86[_0xc38d('0x28')];if(_0x1243cf[_0xc38d('0x2a')][_0xc38d('0x3c')]){_0x2f00b9[_0xc38d('0x3d')]=[{'all':!![]}];}_0x2f00b9=_[_0xc38d('0x39')]({},_0x2f00b9,_0x1243cf[_0xc38d('0x3a')]);return db[_0xc38d('0x3b')]['find'](_0x2f00b9)['then'](handleEntityNotFound(_0x351821,null))['then'](respondWithResult(_0x351821,null))[_0xc38d('0x40')](handleError(_0x351821,null));};exports['create']=function(_0x190b09,_0x2280e3){return db[_0xc38d('0x3b')][_0xc38d('0x43')](_0x190b09[_0xc38d('0x44')],{})['then'](function(_0x31c5a7){var _0x2e9c96=_0x190b09[_0xc38d('0x45')][_0xc38d('0x1f')]({'plain':!![]});if(!_0x2e9c96)throw new Error(_0xc38d('0x46'));if(_0x2e9c96[_0xc38d('0x47')]===_0xc38d('0x45')){var _0x3f287b=_0x31c5a7['get']({'plain':!![]});var _0x2bb650=_0xc38d('0x20');return db[_0xc38d('0x48')]['find']({'where':{'name':_0x2bb650,'userProfileId':_0x2e9c96['userProfileId']},'raw':!![]})[_0xc38d('0x1d')](function(_0x1de93b){if(_0x1de93b&&_0x1de93b[_0xc38d('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f287b[_0xc38d('0x22')],'resourceId':_0x3f287b['id'],'type':_0x1de93b[_0xc38d('0x22')],'sectionId':_0x1de93b['id']},{})['then'](function(){return _0x31c5a7;});}else{return _0x31c5a7;}})[_0xc38d('0x40')](function(_0x16bdce){logger['error'](_0xc38d('0x4a'),_0x16bdce);throw _0x16bdce;});}return _0x31c5a7;})['then'](respondWithResult(_0x2280e3,0xc9))['catch'](handleError(_0x2280e3,null));};exports['clone']=function(_0x2de3ea,_0x336063){var _0x4891db={'where':{'id':_0x2de3ea[_0xc38d('0x42')]['id']}},_0x42bf80={};_0x42bf80[_0xc38d('0x28')]=_[_0xc38d('0x2b')](db['JscriptyProject']['rawAttributes']);_0x4891db[_0xc38d('0x2e')]=_[_0xc38d('0x2d')](_0x42bf80[_0xc38d('0x28')],qs[_0xc38d('0x2f')](_0x2de3ea['query'][_0xc38d('0x2f')]));_0x4891db['attributes']=_0x4891db['attributes']['length']?_0x4891db[_0xc38d('0x2e')]:_0x42bf80['model'];if(_0x2de3ea['query'][_0xc38d('0x3c')]){_0x4891db[_0xc38d('0x3d')]=[{'all':!![]}];}_0x4891db=_[_0xc38d('0x39')]({},_0x4891db,_0x2de3ea['options']);return db[_0xc38d('0x3b')][_0xc38d('0x4b')](_0x4891db)[_0xc38d('0x1d')](handleEntityNotFound(_0x336063,null))[_0xc38d('0x1d')](function(_0x324cc6){if(_0x324cc6){var _0x432ede=_0x324cc6['get']({'plain':!![]});_0x432ede=qs[_0xc38d('0x4c')](_0x432ede,['id',_0xc38d('0x4d'),'updatedAt']);_0x2de3ea[_0xc38d('0x44')]=_[_0xc38d('0x4c')](_0x2de3ea[_0xc38d('0x44')],['id',_0xc38d('0x4d'),'updatedAt']);return db['JscriptyProject'][_0xc38d('0x43')](_[_0xc38d('0x39')](_0x432ede,_0x2de3ea['body']),{'include':_0x2de3ea['query'][_0xc38d('0x3c')]?[{'all':!![]}]:undefined})[_0xc38d('0x1d')](function(_0x17b5f8){var _0x459651=_0x2de3ea[_0xc38d('0x45')][_0xc38d('0x1f')]({'plain':!![]});if(!_0x459651)throw new Error(_0xc38d('0x46'));if(_0x459651['role']==='user'){var _0x37be5c=_0x17b5f8['get']({'plain':!![]});var _0x594533=_0xc38d('0x20');return db[_0xc38d('0x48')][_0xc38d('0x4b')]({'where':{'name':_0x594533,'userProfileId':_0x459651[_0xc38d('0x4e')]},'raw':!![]})[_0xc38d('0x1d')](function(_0x203d45){if(_0x203d45&&_0x203d45['autoAssociation']===0x0){return db[_0xc38d('0x21')][_0xc38d('0x43')]({'name':_0x37be5c[_0xc38d('0x22')],'resourceId':_0x37be5c['id'],'type':_0x203d45[_0xc38d('0x22')],'sectionId':_0x203d45['id']},{})[_0xc38d('0x1d')](function(){return _0x17b5f8;});}else{return _0x17b5f8;}})[_0xc38d('0x40')](function(_0x5bdad6){logger[_0xc38d('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bdad6);throw _0x5bdad6;});}return _0x17b5f8;});}})['then'](respondWithResult(_0x336063,0xc9))['catch'](handleError(_0x336063,null));};exports[_0xc38d('0x50')]=function(_0x3ba459,_0xfdee8b){if(_0x3ba459[_0xc38d('0x44')]['id']){delete _0x3ba459['body']['id'];}return db[_0xc38d('0x3b')][_0xc38d('0x4b')]({'where':{'id':_0x3ba459[_0xc38d('0x42')]['id']}})[_0xc38d('0x1d')](handleEntityNotFound(_0xfdee8b,null))[_0xc38d('0x1d')](saveUpdates(_0x3ba459[_0xc38d('0x44')],null))[_0xc38d('0x1d')](respondWithResult(_0xfdee8b,null))[_0xc38d('0x40')](handleError(_0xfdee8b,null));};exports['destroy']=function(_0x30cbfc,_0x18b517){return db['JscriptyProject'][_0xc38d('0x4b')]({'where':{'id':_0x30cbfc['params']['id']}})['then'](handleEntityNotFound(_0x18b517,null))[_0xc38d('0x1d')](removeEntity(_0x18b517,null))[_0xc38d('0x40')](handleError(_0x18b517,null));};exports[_0xc38d('0x51')]=function(_0x259d8c,_0x3383eb,_0x5089a2){var _0x217bf2={'raw':!![],'where':{}};var _0x3ca637={};var _0x33f98a={'count':0x0,'rows':[]};return db[_0xc38d('0x3b')][_0xc38d('0x52')]({'where':{'id':_0x259d8c[_0xc38d('0x42')]['id']}})[_0xc38d('0x1d')](handleEntityNotFound(_0x3383eb,null))[_0xc38d('0x1d')](function(_0x537b11){if(_0x537b11){_0x3ca637[_0xc38d('0x28')]=_[_0xc38d('0x2b')](db[_0xc38d('0x53')]['rawAttributes']);_0x3ca637[_0xc38d('0x2a')]=_[_0xc38d('0x2b')](_0x259d8c[_0xc38d('0x2a')]);_0x3ca637[_0xc38d('0x2c')]=_[_0xc38d('0x2d')](_0x3ca637[_0xc38d('0x28')],_0x3ca637[_0xc38d('0x2a')]);_0x217bf2[_0xc38d('0x2e')]=_[_0xc38d('0x2d')](_0x3ca637['model'],qs[_0xc38d('0x2f')](_0x259d8c['query']['fields']));_0x217bf2[_0xc38d('0x2e')]=_0x217bf2[_0xc38d('0x2e')][_0xc38d('0x30')]?_0x217bf2[_0xc38d('0x2e')]:_0x3ca637[_0xc38d('0x28')];if(!_0x259d8c['query'][_0xc38d('0x31')](_0xc38d('0x32'))){_0x217bf2[_0xc38d('0x1a')]=qs[_0xc38d('0x1a')](_0x259d8c[_0xc38d('0x2a')][_0xc38d('0x1a')]);_0x217bf2[_0xc38d('0x18')]=qs[_0xc38d('0x18')](_0x259d8c['query']['offset']);}_0x217bf2[_0xc38d('0x33')]=qs[_0xc38d('0x34')](_0x259d8c['query'][_0xc38d('0x34')]);_0x217bf2[_0xc38d('0x35')]=qs['filters'](_[_0xc38d('0x36')](_0x259d8c[_0xc38d('0x2a')],_0x3ca637[_0xc38d('0x2c')]));_0x217bf2[_0xc38d('0x35')][_0xc38d('0x54')]=_0x537b11['id'];if(_0x259d8c[_0xc38d('0x2a')]['filter']){_0x217bf2[_0xc38d('0x35')]=_[_0xc38d('0x39')](_0x217bf2[_0xc38d('0x35')],{'$or':_[_0xc38d('0x29')](_0x217bf2[_0xc38d('0x2e')],function(_0x2c8cea){var _0x41d683={};_0x41d683[_0x2c8cea]={'$like':'%'+_0x259d8c[_0xc38d('0x2a')][_0xc38d('0x37')]+'%'};return _0x41d683;})});}_0x217bf2=_[_0xc38d('0x39')]({},_0x217bf2,_0x259d8c[_0xc38d('0x3a')]);return db['JscriptySessionReport'][_0xc38d('0x1b')]({'where':_0x217bf2['where']})[_0xc38d('0x1d')](function(_0x34b56b){_0x33f98a['count']=_0x34b56b;if(_0x259d8c[_0xc38d('0x2a')][_0xc38d('0x3c')]){_0x217bf2[_0xc38d('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc38d('0x3e')](_0x217bf2);})[_0xc38d('0x1d')](function(_0x5ef449){_0x33f98a[_0xc38d('0x3f')]=_0x5ef449;return _0x33f98a;});}})[_0xc38d('0x1d')](respondWithFilteredResult(_0x3383eb,_0x217bf2))[_0xc38d('0x40')](handleError(_0x3383eb,null));};exports[_0xc38d('0x55')]=function(_0x42bfe1,_0x39cb58,_0x89e98b){var _0x1fd36d={'raw':!![],'where':{}};var _0x27b793={};var _0xd3b25e={'count':0x0,'rows':[]};return db[_0xc38d('0x3b')][_0xc38d('0x52')]({'where':{'id':_0x42bfe1[_0xc38d('0x42')]['id']}})['then'](handleEntityNotFound(_0x39cb58,null))[_0xc38d('0x1d')](function(_0x3bb254){if(_0x3bb254){_0x27b793['model']=_[_0xc38d('0x2b')](db['JscriptyAnswerReport'][_0xc38d('0x24')]);_0x27b793['query']=_['keys'](_0x42bfe1[_0xc38d('0x2a')]);_0x27b793[_0xc38d('0x2c')]=_[_0xc38d('0x2d')](_0x27b793[_0xc38d('0x28')],_0x27b793[_0xc38d('0x2a')]);_0x1fd36d[_0xc38d('0x2e')]=_[_0xc38d('0x2d')](_0x27b793[_0xc38d('0x28')],qs[_0xc38d('0x2f')](_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x2f')]));_0x1fd36d[_0xc38d('0x2e')]=_0x1fd36d['attributes'][_0xc38d('0x30')]?_0x1fd36d['attributes']:_0x27b793[_0xc38d('0x28')];if(!_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x31')]('nolimit')){_0x1fd36d[_0xc38d('0x1a')]=qs[_0xc38d('0x1a')](_0x42bfe1[_0xc38d('0x2a')]['limit']);_0x1fd36d[_0xc38d('0x18')]=qs[_0xc38d('0x18')](_0x42bfe1['query'][_0xc38d('0x18')]);}_0x1fd36d[_0xc38d('0x33')]=qs[_0xc38d('0x34')](_0x42bfe1[_0xc38d('0x2a')]['sort']);_0x1fd36d[_0xc38d('0x35')]=qs['filters'](_['pick'](_0x42bfe1[_0xc38d('0x2a')],_0x27b793[_0xc38d('0x2c')]));_0x1fd36d[_0xc38d('0x35')][_0xc38d('0x54')]=_0x3bb254['id'];if(_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x37')]){_0x1fd36d[_0xc38d('0x35')]=_[_0xc38d('0x39')](_0x1fd36d[_0xc38d('0x35')],{'$or':_[_0xc38d('0x29')](_0x1fd36d['attributes'],function(_0x1704b7){var _0x22a371={};_0x22a371[_0x1704b7]={'$like':'%'+_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x37')]+'%'};return _0x22a371;})});}_0x1fd36d=_['merge']({},_0x1fd36d,_0x42bfe1[_0xc38d('0x3a')]);return db[_0xc38d('0x56')][_0xc38d('0x1b')]({'where':_0x1fd36d['where']})[_0xc38d('0x1d')](function(_0x493244){_0xd3b25e[_0xc38d('0x1b')]=_0x493244;if(_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x3c')]){_0x1fd36d['include']=[{'all':!![]}];}return db[_0xc38d('0x56')][_0xc38d('0x3e')](_0x1fd36d);})['then'](function(_0x2f3ae9){_0xd3b25e['rows']=_0x2f3ae9;return _0xd3b25e;});}})[_0xc38d('0x1d')](respondWithFilteredResult(_0x39cb58,_0x1fd36d))[_0xc38d('0x40')](handleError(_0x39cb58,null));};function char(_0x21a7ad){return _0xc38d('0x57')===typeof _0x21a7ad?String[_0xc38d('0x58')]['apply'](null,arguments):_0x21a7ad;}function needsEncapsulation(_0x3bad85){return!!_0x3bad85&&(_0x3bad85[_0xc38d('0x59')]()[_0xc38d('0x5a')](char(0xd))>=0x0||_0x3bad85[_0xc38d('0x59')]()[_0xc38d('0x5a')](char(0xa))>=0x0||_0x3bad85[_0xc38d('0x59')]()['indexOf'](char(0x2c))>=0x0||_0x3bad85[_0xc38d('0x59')]()[_0xc38d('0x5a')](char(0x22))>=0x0);}function encapsulate(_0x3f005e){var _0x31d1b1=char(0x22),_0x5da593='\x5c'+char(0x22),_0x4f3ecb=_0x3f005e['toString']()[_0xc38d('0x5b')](new RegExp(_0x31d1b1,'g'),_0x5da593);return _0x31d1b1+_0x4f3ecb+_0x31d1b1;}exports[_0xc38d('0x5c')]=function(_0x3502c3,_0x128752,_0x2221ce){var _0x551139,_0x2166e9;var _0x1a2f7d={'where':{'ProjectId':_0x3502c3['params']['id']}};if(_0x3502c3[_0xc38d('0x2a')][_0xc38d('0x5d')]){_0x1a2f7d[_0xc38d('0x35')][_0xc38d('0x5e')]=JSON['parse'](_0x3502c3[_0xc38d('0x2a')][_0xc38d('0x5d')]);}return db[_0xc38d('0x53')]['findAll'](_0x1a2f7d)[_0xc38d('0x1d')](handleEntityNotFound(_0x128752,null))[_0xc38d('0x1d')](function(_0x5c2c05){if(_0x5c2c05){_0x551139=_0x5c2c05;return db[_0xc38d('0x5f')][_0xc38d('0x3e')]({'where':{'SessionId':{'$in':_[_0xc38d('0x29')](_0x551139,'id')},'ProjectId':_0x3502c3[_0xc38d('0x42')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x128752,null))[_0xc38d('0x1d')](function(_0x51b573){if(_0x51b573){_0x2166e9=_0x51b573;var _0x4261f6={};for(var _0x45cc1e=0x0,_0x2acec8=_0x2166e9[_0xc38d('0x30')];_0x45cc1e<_0x2acec8;_0x45cc1e++){if(!_0x4261f6['hasOwnProperty'](_0x2166e9[_0x45cc1e][_0xc38d('0x60')])){_0x4261f6[_0x2166e9[_0x45cc1e][_0xc38d('0x60')]]=needsEncapsulation(_0x2166e9[_0x45cc1e][_0xc38d('0x61')])?encapsulate(_0x2166e9[_0x45cc1e][_0xc38d('0x61')]):_0x2166e9[_0x45cc1e]['question'];}}var _0x5ac76d=[],_0x958c12={};for(var _0x26f6c4=0x0,_0x3914ba=_0x551139[_0xc38d('0x30')];_0x26f6c4<_0x3914ba;_0x26f6c4++){_0x958c12={'ProjectId':_0x3502c3[_0xc38d('0x42')]['id'],'SessionId':_0x551139[_0x26f6c4]['id'],'StartTime':moment(_0x551139[_0x26f6c4][_0xc38d('0x5e')])[_0xc38d('0x62')](_0xc38d('0x63'))};for(var _0x44e0a1=0x0,_0x48c79d=_0x2166e9[_0xc38d('0x30')];_0x44e0a1<_0x48c79d;_0x44e0a1++){if(_0x2166e9[_0x44e0a1][_0xc38d('0x64')]==_0x551139[_0x26f6c4]['id']&&_0x4261f6[_0xc38d('0x31')](_0x2166e9[_0x44e0a1][_0xc38d('0x60')])){_0x958c12[_0x4261f6[_0x2166e9[_0x44e0a1][_0xc38d('0x60')]]]=_0x2166e9[_0x44e0a1]['answer'];}}for(var _0x575c69 in _0x4261f6){if(!_0x958c12['hasOwnProperty'](_0x4261f6[_0x575c69])){_0x958c12[_0x4261f6[_0x575c69]]=null;}}_0x5ac76d[_0xc38d('0x65')](_0x958c12);}return _0x5ac76d;}})['then'](function(_0x39d3f3){if(!_[_0xc38d('0x66')](_0x39d3f3)){var _0x24b2f3=toCsv(_0x39d3f3);var _0x198e0b=Date[_0xc38d('0x67')]();fs[_0xc38d('0x68')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3502c3[_0xc38d('0x42')]['id'],_0x198e0b),_0x24b2f3);_0x128752[_0xc38d('0x69')](_0xc38d('0x6a'),_0xc38d('0x6b')+util[_0xc38d('0x62')]('Jscripty_Project_%d_Summary_%s.csv',_0x3502c3[_0xc38d('0x42')]['id'],_0x198e0b));_0x128752[_0xc38d('0x69')]('Content-type',_0xc38d('0x6c'));return _0x128752[_0xc38d('0x6d')](util[_0xc38d('0x62')](_0xc38d('0x6e'),_0x3502c3['params']['id'],_0x198e0b));}else{return _0x128752['sendStatus'](0xcc);}})[_0xc38d('0x40')](handleError(_0x128752,null));}; \ No newline at end of file +var _0x66ee=['question','starttime','format','SessionId','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','JscriptyProject','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','where','count','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Projects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','options','createdAt','updatedAt','omit','UserProfileSection','find','getSessions','findOne','JscriptySessionReport','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x66ee,0x85));var _0xe66e=function(_0x33619b,_0x4ca61c){_0x33619b=_0x33619b-0x0;var _0x43e1e5=_0x66ee[_0x33619b];return _0x43e1e5;};'use strict';var emlformat=require(_0xe66e('0x0'));var rimraf=require(_0xe66e('0x1'));var zipdir=require(_0xe66e('0x2'));var jsonpatch=require(_0xe66e('0x3'));var rp=require(_0xe66e('0x4'));var moment=require('moment');var BPromise=require(_0xe66e('0x5'));var Mustache=require(_0xe66e('0x6'));var util=require(_0xe66e('0x7'));var path=require(_0xe66e('0x8'));var sox=require('sox');var csv=require(_0xe66e('0x9'));var ejs=require(_0xe66e('0xa'));var fs=require('fs');var fs_extra=require(_0xe66e('0xb'));var _=require(_0xe66e('0xc'));var squel=require(_0xe66e('0xd'));var crypto=require('crypto');var jsforce=require(_0xe66e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe66e('0xf'));var Papa=require('papaparse');var Redis=require(_0xe66e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe66e('0x11'));var as=require(_0xe66e('0x12'));var hardwareService=require(_0xe66e('0x13'));var logger=require(_0xe66e('0x14'))(_0xe66e('0x15'));var utils=require(_0xe66e('0x16'));var config=require(_0xe66e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe66e('0x18'))['db'];function respondWithStatusCode(_0x279384,_0x4e68e8){_0x4e68e8=_0x4e68e8||0xcc;return function(_0x265b15){if(_0x265b15){return _0x279384[_0xe66e('0x19')](_0x4e68e8);}return _0x279384[_0xe66e('0x1a')](_0x4e68e8)[_0xe66e('0x1b')]();};}function respondWithResult(_0x39e53f,_0x3331c2){_0x3331c2=_0x3331c2||0xc8;return function(_0x22fbe9){if(_0x22fbe9){return _0x39e53f[_0xe66e('0x1a')](_0x3331c2)['json'](_0x22fbe9);}};}function respondWithFilteredResult(_0x399b99,_0x55fb65){return function(_0x88e27){if(_0x88e27){var _0x37db26=typeof _0x55fb65[_0xe66e('0x1c')]===_0xe66e('0x1d')&&typeof _0x55fb65[_0xe66e('0x1e')]===_0xe66e('0x1d');var _0x1c0e1b=_0x88e27['count'];var _0x2b0163=_0x37db26?0x0:_0x55fb65['offset'];var _0x50641b=_0x37db26?_0x88e27['count']:_0x55fb65[_0xe66e('0x1c')]+_0x55fb65[_0xe66e('0x1e')];var _0x593232;if(_0x50641b>=_0x1c0e1b){_0x50641b=_0x1c0e1b;_0x593232=0xc8;}else{_0x593232=0xce;}_0x399b99[_0xe66e('0x1a')](_0x593232);return _0x399b99[_0xe66e('0x1f')](_0xe66e('0x20'),_0x2b0163+'-'+_0x50641b+'/'+_0x1c0e1b)['json'](_0x88e27);}return null;};}function patchUpdates(_0x263772){return function(_0x25a2da){try{jsonpatch[_0xe66e('0x21')](_0x25a2da,_0x263772,!![]);}catch(_0x448035){return BPromise['reject'](_0x448035);}return _0x25a2da[_0xe66e('0x22')]();};}function saveUpdates(_0x3251bc,_0x481859){return function(_0x55ba00){if(_0x55ba00){return _0x55ba00[_0xe66e('0x23')](_0x3251bc)['then'](function(_0x3551f1){return _0x3551f1;});}return null;};}function removeEntity(_0x487318,_0x5bb8db){return function(_0x203961){if(_0x203961){return _0x203961[_0xe66e('0x24')]()['then'](function(){var _0x45b2c7=_0x203961[_0xe66e('0x25')]({'plain':!![]});var _0x5949ee='Projects';return db[_0xe66e('0x26')][_0xe66e('0x24')]({'where':{'type':_0x5949ee,'resourceId':_0x45b2c7['id']}})[_0xe66e('0x27')](function(){return _0x203961;});})[_0xe66e('0x27')](function(){_0x487318[_0xe66e('0x1a')](0xcc)[_0xe66e('0x1b')]();});}};}function handleEntityNotFound(_0x564477,_0x21d771){return function(_0x10ed38){if(!_0x10ed38){_0x564477[_0xe66e('0x19')](0x194);}return _0x10ed38;};}function handleError(_0x3a9f68,_0x3108f9){_0x3108f9=_0x3108f9||0x1f4;return function(_0x490440){logger[_0xe66e('0x28')](_0x490440[_0xe66e('0x29')]);if(_0x490440[_0xe66e('0x2a')]){delete _0x490440[_0xe66e('0x2a')];}_0x3a9f68[_0xe66e('0x1a')](_0x3108f9)[_0xe66e('0x2b')](_0x490440);};}exports[_0xe66e('0x2c')]=function(_0x14c27c,_0x2ffdd6){var _0x2159a6={},_0xe5855d={},_0x28e834={'count':0x0,'rows':[]};var _0x489214=_[_0xe66e('0x2d')](db[_0xe66e('0x2e')]['rawAttributes'],function(_0x7bb80b){return{'name':_0x7bb80b[_0xe66e('0x2f')],'type':_0x7bb80b[_0xe66e('0x30')]['key']};});_0xe5855d[_0xe66e('0x31')]=_[_0xe66e('0x2d')](_0x489214,_0xe66e('0x2a'));_0xe5855d[_0xe66e('0x32')]=_[_0xe66e('0x33')](_0x14c27c[_0xe66e('0x32')]);_0xe5855d['filters']=_[_0xe66e('0x34')](_0xe5855d[_0xe66e('0x31')],_0xe5855d[_0xe66e('0x32')]);_0x2159a6[_0xe66e('0x35')]=_[_0xe66e('0x34')](_0xe5855d[_0xe66e('0x31')],qs['fields'](_0x14c27c[_0xe66e('0x32')][_0xe66e('0x36')]));_0x2159a6['attributes']=_0x2159a6[_0xe66e('0x35')][_0xe66e('0x37')]?_0x2159a6['attributes']:_0xe5855d[_0xe66e('0x31')];if(!_0x14c27c[_0xe66e('0x32')][_0xe66e('0x38')](_0xe66e('0x39'))){_0x2159a6['limit']=qs[_0xe66e('0x1e')](_0x14c27c[_0xe66e('0x32')][_0xe66e('0x1e')]);_0x2159a6['offset']=qs[_0xe66e('0x1c')](_0x14c27c[_0xe66e('0x32')][_0xe66e('0x1c')]);}_0x2159a6[_0xe66e('0x3a')]=qs[_0xe66e('0x3b')](_0x14c27c[_0xe66e('0x32')][_0xe66e('0x3b')]);_0x2159a6['where']=qs[_0xe66e('0x3c')](_[_0xe66e('0x3d')](_0x14c27c[_0xe66e('0x32')],_0xe5855d[_0xe66e('0x3c')]),_0x489214);if(_0x14c27c[_0xe66e('0x32')][_0xe66e('0x3e')]){_0x2159a6['where']=_[_0xe66e('0x3f')](_0x2159a6['where'],{'$or':_['map'](_0x489214,function(_0x27b11f){if(_0x27b11f[_0xe66e('0x30')]!==_0xe66e('0x40')){var _0x5cfc8d={};_0x5cfc8d[_0x27b11f[_0xe66e('0x2a')]]={'$like':'%'+_0x14c27c[_0xe66e('0x32')][_0xe66e('0x3e')]+'%'};return _0x5cfc8d;}})});}_0x2159a6=_['merge']({},_0x2159a6,_0x14c27c['options']);var _0x440b21={'where':_0x2159a6[_0xe66e('0x41')]};return db[_0xe66e('0x2e')]['count'](_0x440b21)[_0xe66e('0x27')](function(_0x2010a3){_0x28e834[_0xe66e('0x42')]=_0x2010a3;if(_0x14c27c[_0xe66e('0x32')][_0xe66e('0x43')]){_0x2159a6['include']=[{'all':!![]}];}return db[_0xe66e('0x2e')][_0xe66e('0x44')](_0x2159a6);})[_0xe66e('0x27')](function(_0x3d9160){_0x28e834['rows']=_0x3d9160;return _0x28e834;})['then'](respondWithFilteredResult(_0x2ffdd6,_0x2159a6))[_0xe66e('0x45')](handleError(_0x2ffdd6,null));};exports[_0xe66e('0x46')]=function(_0x485be7,_0x2302aa){var _0x5e57ba={'raw':![],'where':{'id':_0x485be7[_0xe66e('0x47')]['id']}},_0xa72cb5={};_0xa72cb5[_0xe66e('0x31')]=_[_0xe66e('0x33')](db[_0xe66e('0x2e')][_0xe66e('0x48')]);_0xa72cb5[_0xe66e('0x32')]=_['keys'](_0x485be7[_0xe66e('0x32')]);_0xa72cb5[_0xe66e('0x3c')]=_[_0xe66e('0x34')](_0xa72cb5[_0xe66e('0x31')],_0xa72cb5[_0xe66e('0x32')]);_0x5e57ba[_0xe66e('0x35')]=_['intersection'](_0xa72cb5[_0xe66e('0x31')],qs['fields'](_0x485be7[_0xe66e('0x32')][_0xe66e('0x36')]));_0x5e57ba['attributes']=_0x5e57ba['attributes']['length']?_0x5e57ba[_0xe66e('0x35')]:_0xa72cb5['model'];if(_0x485be7[_0xe66e('0x32')][_0xe66e('0x43')]){_0x5e57ba[_0xe66e('0x49')]=[{'all':!![]}];}_0x5e57ba=_[_0xe66e('0x3f')]({},_0x5e57ba,_0x485be7['options']);return db[_0xe66e('0x2e')]['find'](_0x5e57ba)[_0xe66e('0x27')](handleEntityNotFound(_0x2302aa,null))[_0xe66e('0x27')](respondWithResult(_0x2302aa,null))['catch'](handleError(_0x2302aa,null));};exports['create']=function(_0x3de722,_0x5dd1e6){return db[_0xe66e('0x2e')][_0xe66e('0x4a')](_0x3de722[_0xe66e('0x4b')],{})[_0xe66e('0x27')](function(_0x1d44d5){var _0x4b3617=_0x3de722['user'][_0xe66e('0x25')]({'plain':!![]});if(!_0x4b3617)throw new Error(_0xe66e('0x4c'));if(_0x4b3617['role']===_0xe66e('0x4d')){var _0x14eee8=_0x1d44d5[_0xe66e('0x25')]({'plain':!![]});var _0x530897=_0xe66e('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x530897,'userProfileId':_0x4b3617[_0xe66e('0x4f')]},'raw':!![]})['then'](function(_0x5f3398){if(_0x5f3398&&_0x5f3398[_0xe66e('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x14eee8[_0xe66e('0x2a')],'resourceId':_0x14eee8['id'],'type':_0x5f3398[_0xe66e('0x2a')],'sectionId':_0x5f3398['id']},{})['then'](function(){return _0x1d44d5;});}else{return _0x1d44d5;}})[_0xe66e('0x45')](function(_0x92443b){logger[_0xe66e('0x28')](_0xe66e('0x51'),_0x92443b);throw _0x92443b;});}return _0x1d44d5;})[_0xe66e('0x27')](respondWithResult(_0x5dd1e6,0xc9))['catch'](handleError(_0x5dd1e6,null));};exports['clone']=function(_0x3398fc,_0x5766f1){var _0x360cfd={'where':{'id':_0x3398fc[_0xe66e('0x47')]['id']}},_0x2b867b={};_0x2b867b[_0xe66e('0x31')]=_[_0xe66e('0x33')](db[_0xe66e('0x2e')][_0xe66e('0x48')]);_0x360cfd[_0xe66e('0x35')]=_[_0xe66e('0x34')](_0x2b867b[_0xe66e('0x31')],qs[_0xe66e('0x36')](_0x3398fc[_0xe66e('0x32')][_0xe66e('0x36')]));_0x360cfd[_0xe66e('0x35')]=_0x360cfd[_0xe66e('0x35')][_0xe66e('0x37')]?_0x360cfd['attributes']:_0x2b867b[_0xe66e('0x31')];if(_0x3398fc[_0xe66e('0x32')]['includeAll']){_0x360cfd['include']=[{'all':!![]}];}_0x360cfd=_['merge']({},_0x360cfd,_0x3398fc[_0xe66e('0x52')]);return db[_0xe66e('0x2e')]['find'](_0x360cfd)[_0xe66e('0x27')](handleEntityNotFound(_0x5766f1,null))[_0xe66e('0x27')](function(_0x58e582){if(_0x58e582){var _0xf1dedb=_0x58e582[_0xe66e('0x25')]({'plain':!![]});_0xf1dedb=qs['omit'](_0xf1dedb,['id',_0xe66e('0x53'),_0xe66e('0x54')]);_0x3398fc['body']=_[_0xe66e('0x55')](_0x3398fc[_0xe66e('0x4b')],['id','createdAt',_0xe66e('0x54')]);return db[_0xe66e('0x2e')]['create'](_[_0xe66e('0x3f')](_0xf1dedb,_0x3398fc['body']),{'include':_0x3398fc[_0xe66e('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x23f7f4){var _0x102fd0=_0x3398fc[_0xe66e('0x4d')][_0xe66e('0x25')]({'plain':!![]});if(!_0x102fd0)throw new Error(_0xe66e('0x4c'));if(_0x102fd0['role']===_0xe66e('0x4d')){var _0x320d86=_0x23f7f4[_0xe66e('0x25')]({'plain':!![]});var _0x3d9d9c=_0xe66e('0x4e');return db[_0xe66e('0x56')][_0xe66e('0x57')]({'where':{'name':_0x3d9d9c,'userProfileId':_0x102fd0[_0xe66e('0x4f')]},'raw':!![]})[_0xe66e('0x27')](function(_0x2ccc92){if(_0x2ccc92&&_0x2ccc92[_0xe66e('0x50')]===0x0){return db[_0xe66e('0x26')][_0xe66e('0x4a')]({'name':_0x320d86[_0xe66e('0x2a')],'resourceId':_0x320d86['id'],'type':_0x2ccc92[_0xe66e('0x2a')],'sectionId':_0x2ccc92['id']},{})[_0xe66e('0x27')](function(){return _0x23f7f4;});}else{return _0x23f7f4;}})['catch'](function(_0x2c60ee){logger[_0xe66e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c60ee);throw _0x2c60ee;});}return _0x23f7f4;});}})[_0xe66e('0x27')](respondWithResult(_0x5766f1,0xc9))[_0xe66e('0x45')](handleError(_0x5766f1,null));};exports[_0xe66e('0x23')]=function(_0x5c75fa,_0x3a3da6){if(_0x5c75fa['body']['id']){delete _0x5c75fa[_0xe66e('0x4b')]['id'];}return db[_0xe66e('0x2e')]['find']({'where':{'id':_0x5c75fa[_0xe66e('0x47')]['id']}})[_0xe66e('0x27')](handleEntityNotFound(_0x3a3da6,null))[_0xe66e('0x27')](saveUpdates(_0x5c75fa[_0xe66e('0x4b')],null))[_0xe66e('0x27')](respondWithResult(_0x3a3da6,null))['catch'](handleError(_0x3a3da6,null));};exports[_0xe66e('0x24')]=function(_0x5efb4f,_0x41f1ba){return db[_0xe66e('0x2e')][_0xe66e('0x57')]({'where':{'id':_0x5efb4f[_0xe66e('0x47')]['id']}})[_0xe66e('0x27')](handleEntityNotFound(_0x41f1ba,null))[_0xe66e('0x27')](removeEntity(_0x41f1ba,null))[_0xe66e('0x45')](handleError(_0x41f1ba,null));};exports[_0xe66e('0x58')]=function(_0x2c6f53,_0x3a7b8a,_0x31afe5){var _0x1dc64f={'raw':!![],'where':{}};var _0x20d015={};var _0x2cf9b9={'count':0x0,'rows':[]};return db[_0xe66e('0x2e')][_0xe66e('0x59')]({'where':{'id':_0x2c6f53[_0xe66e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a7b8a,null))[_0xe66e('0x27')](function(_0x3bd022){if(_0x3bd022){_0x20d015[_0xe66e('0x31')]=_[_0xe66e('0x33')](db[_0xe66e('0x5a')][_0xe66e('0x48')]);_0x20d015[_0xe66e('0x32')]=_[_0xe66e('0x33')](_0x2c6f53[_0xe66e('0x32')]);_0x20d015[_0xe66e('0x3c')]=_['intersection'](_0x20d015[_0xe66e('0x31')],_0x20d015[_0xe66e('0x32')]);_0x1dc64f[_0xe66e('0x35')]=_[_0xe66e('0x34')](_0x20d015['model'],qs['fields'](_0x2c6f53['query']['fields']));_0x1dc64f[_0xe66e('0x35')]=_0x1dc64f[_0xe66e('0x35')][_0xe66e('0x37')]?_0x1dc64f[_0xe66e('0x35')]:_0x20d015[_0xe66e('0x31')];if(!_0x2c6f53[_0xe66e('0x32')][_0xe66e('0x38')](_0xe66e('0x39'))){_0x1dc64f[_0xe66e('0x1e')]=qs[_0xe66e('0x1e')](_0x2c6f53[_0xe66e('0x32')][_0xe66e('0x1e')]);_0x1dc64f[_0xe66e('0x1c')]=qs[_0xe66e('0x1c')](_0x2c6f53['query'][_0xe66e('0x1c')]);}_0x1dc64f[_0xe66e('0x3a')]=qs['sort'](_0x2c6f53['query'][_0xe66e('0x3b')]);_0x1dc64f[_0xe66e('0x41')]=qs[_0xe66e('0x3c')](_['pick'](_0x2c6f53['query'],_0x20d015[_0xe66e('0x3c')]));_0x1dc64f['where']['ProjectId']=_0x3bd022['id'];if(_0x2c6f53[_0xe66e('0x32')][_0xe66e('0x3e')]){_0x1dc64f['where']=_[_0xe66e('0x3f')](_0x1dc64f[_0xe66e('0x41')],{'$or':_[_0xe66e('0x2d')](_0x1dc64f[_0xe66e('0x35')],function(_0x393946){var _0x3a4f34={};_0x3a4f34[_0x393946]={'$like':'%'+_0x2c6f53[_0xe66e('0x32')][_0xe66e('0x3e')]+'%'};return _0x3a4f34;})});}_0x1dc64f=_['merge']({},_0x1dc64f,_0x2c6f53['options']);return db[_0xe66e('0x5a')]['count']({'where':_0x1dc64f[_0xe66e('0x41')]})[_0xe66e('0x27')](function(_0x550939){_0x2cf9b9[_0xe66e('0x42')]=_0x550939;if(_0x2c6f53[_0xe66e('0x32')][_0xe66e('0x43')]){_0x1dc64f['include']=[{'all':!![]}];}return db[_0xe66e('0x5a')][_0xe66e('0x44')](_0x1dc64f);})[_0xe66e('0x27')](function(_0x2c2095){_0x2cf9b9[_0xe66e('0x5b')]=_0x2c2095;return _0x2cf9b9;});}})['then'](respondWithFilteredResult(_0x3a7b8a,_0x1dc64f))[_0xe66e('0x45')](handleError(_0x3a7b8a,null));};exports[_0xe66e('0x5c')]=function(_0x2acb8b,_0x3a0cf9,_0x423651){var _0x5a34c7={'raw':!![],'where':{}};var _0x3b24c2={};var _0x33a3f2={'count':0x0,'rows':[]};return db[_0xe66e('0x2e')][_0xe66e('0x59')]({'where':{'id':_0x2acb8b[_0xe66e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a0cf9,null))[_0xe66e('0x27')](function(_0x13abd1){if(_0x13abd1){_0x3b24c2[_0xe66e('0x31')]=_[_0xe66e('0x33')](db[_0xe66e('0x5d')][_0xe66e('0x48')]);_0x3b24c2[_0xe66e('0x32')]=_[_0xe66e('0x33')](_0x2acb8b[_0xe66e('0x32')]);_0x3b24c2['filters']=_['intersection'](_0x3b24c2['model'],_0x3b24c2[_0xe66e('0x32')]);_0x5a34c7[_0xe66e('0x35')]=_['intersection'](_0x3b24c2['model'],qs[_0xe66e('0x36')](_0x2acb8b[_0xe66e('0x32')][_0xe66e('0x36')]));_0x5a34c7[_0xe66e('0x35')]=_0x5a34c7['attributes']['length']?_0x5a34c7[_0xe66e('0x35')]:_0x3b24c2['model'];if(!_0x2acb8b[_0xe66e('0x32')]['hasOwnProperty']('nolimit')){_0x5a34c7[_0xe66e('0x1e')]=qs[_0xe66e('0x1e')](_0x2acb8b[_0xe66e('0x32')][_0xe66e('0x1e')]);_0x5a34c7['offset']=qs['offset'](_0x2acb8b['query']['offset']);}_0x5a34c7['order']=qs[_0xe66e('0x3b')](_0x2acb8b[_0xe66e('0x32')][_0xe66e('0x3b')]);_0x5a34c7[_0xe66e('0x41')]=qs[_0xe66e('0x3c')](_[_0xe66e('0x3d')](_0x2acb8b[_0xe66e('0x32')],_0x3b24c2['filters']));_0x5a34c7[_0xe66e('0x41')]['ProjectId']=_0x13abd1['id'];if(_0x2acb8b[_0xe66e('0x32')][_0xe66e('0x3e')]){_0x5a34c7[_0xe66e('0x41')]=_['merge'](_0x5a34c7[_0xe66e('0x41')],{'$or':_[_0xe66e('0x2d')](_0x5a34c7[_0xe66e('0x35')],function(_0x2738b1){var _0x438306={};_0x438306[_0x2738b1]={'$like':'%'+_0x2acb8b[_0xe66e('0x32')][_0xe66e('0x3e')]+'%'};return _0x438306;})});}_0x5a34c7=_[_0xe66e('0x3f')]({},_0x5a34c7,_0x2acb8b[_0xe66e('0x52')]);return db[_0xe66e('0x5d')]['count']({'where':_0x5a34c7[_0xe66e('0x41')]})[_0xe66e('0x27')](function(_0x5142b0){_0x33a3f2[_0xe66e('0x42')]=_0x5142b0;if(_0x2acb8b[_0xe66e('0x32')][_0xe66e('0x43')]){_0x5a34c7[_0xe66e('0x49')]=[{'all':!![]}];}return db[_0xe66e('0x5d')][_0xe66e('0x44')](_0x5a34c7);})[_0xe66e('0x27')](function(_0x19d76d){_0x33a3f2[_0xe66e('0x5b')]=_0x19d76d;return _0x33a3f2;});}})['then'](respondWithFilteredResult(_0x3a0cf9,_0x5a34c7))['catch'](handleError(_0x3a0cf9,null));};function char(_0x5c129){return _0xe66e('0x5e')===typeof _0x5c129?String[_0xe66e('0x5f')][_0xe66e('0x21')](null,arguments):_0x5c129;}function needsEncapsulation(_0x11b780){return!!_0x11b780&&(_0x11b780[_0xe66e('0x60')]()[_0xe66e('0x61')](char(0xd))>=0x0||_0x11b780['toString']()[_0xe66e('0x61')](char(0xa))>=0x0||_0x11b780[_0xe66e('0x60')]()[_0xe66e('0x61')](char(0x2c))>=0x0||_0x11b780[_0xe66e('0x60')]()[_0xe66e('0x61')](char(0x22))>=0x0);}function encapsulate(_0xd3f636){var _0x283278=char(0x22),_0x45eaa4='\x5c'+char(0x22),_0x2c0e08=_0xd3f636['toString']()[_0xe66e('0x62')](new RegExp(_0x283278,'g'),_0x45eaa4);return _0x283278+_0x2c0e08+_0x283278;}exports[_0xe66e('0x63')]=function(_0x3a4c61,_0x47e455,_0x2d7b98){var _0x247922,_0x4d2e70;var _0x20b237={'where':{'ProjectId':_0x3a4c61[_0xe66e('0x47')]['id']}};if(_0x3a4c61[_0xe66e('0x32')][_0xe66e('0x64')]){_0x20b237['where']['starttime']=JSON[_0xe66e('0x65')](_0x3a4c61[_0xe66e('0x32')][_0xe66e('0x64')]);}return db['JscriptySessionReport'][_0xe66e('0x44')](_0x20b237)[_0xe66e('0x27')](handleEntityNotFound(_0x47e455,null))[_0xe66e('0x27')](function(_0x4c083f){if(_0x4c083f){_0x247922=_0x4c083f;return db[_0xe66e('0x66')][_0xe66e('0x44')]({'where':{'SessionId':{'$in':_[_0xe66e('0x2d')](_0x247922,'id')},'ProjectId':_0x3a4c61['params']['id']},'order':_0xe66e('0x67')});}})[_0xe66e('0x27')](handleEntityNotFound(_0x47e455,null))[_0xe66e('0x27')](function(_0x38c34b){if(_0x38c34b){_0x4d2e70=_0x38c34b;var _0x1c0ce8={};for(var _0x3e32bd=0x0,_0x2d028d=_0x4d2e70['length'];_0x3e32bd<_0x2d028d;_0x3e32bd++){if(!_0x1c0ce8[_0xe66e('0x38')](_0x4d2e70[_0x3e32bd]['questionId'])){_0x1c0ce8[_0x4d2e70[_0x3e32bd][_0xe66e('0x68')]]=needsEncapsulation(_0x4d2e70[_0x3e32bd]['question'])?encapsulate(_0x4d2e70[_0x3e32bd][_0xe66e('0x69')]):_0x4d2e70[_0x3e32bd][_0xe66e('0x69')];}}var _0x57c309=[],_0x1f7d55={};for(var _0x3c054c=0x0,_0x9dfe7=_0x247922['length'];_0x3c054c<_0x9dfe7;_0x3c054c++){_0x1f7d55={'ProjectId':_0x3a4c61[_0xe66e('0x47')]['id'],'SessionId':_0x247922[_0x3c054c]['id'],'StartTime':moment(_0x247922[_0x3c054c][_0xe66e('0x6a')])[_0xe66e('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x67c4f2=0x0,_0x2029b0=_0x4d2e70[_0xe66e('0x37')];_0x67c4f2<_0x2029b0;_0x67c4f2++){if(_0x4d2e70[_0x67c4f2][_0xe66e('0x6c')]==_0x247922[_0x3c054c]['id']&&_0x1c0ce8['hasOwnProperty'](_0x4d2e70[_0x67c4f2][_0xe66e('0x68')])){_0x1f7d55[_0x1c0ce8[_0x4d2e70[_0x67c4f2][_0xe66e('0x68')]]]=_0x4d2e70[_0x67c4f2]['answer'];}}for(var _0x5d8fda in _0x1c0ce8){if(!_0x1f7d55[_0xe66e('0x38')](_0x1c0ce8[_0x5d8fda])){_0x1f7d55[_0x1c0ce8[_0x5d8fda]]=null;}}_0x57c309['push'](_0x1f7d55);}return _0x57c309;}})['then'](function(_0x18cdf5){if(!_[_0xe66e('0x6d')](_0x18cdf5)){var _0x3e0cd8=toCsv(_0x18cdf5);var _0x50b4bf=Date[_0xe66e('0x6e')]();fs[_0xe66e('0x6f')](util[_0xe66e('0x6b')](_0xe66e('0x70'),_0x3a4c61['params']['id'],_0x50b4bf),_0x3e0cd8);_0x47e455[_0xe66e('0x71')]('Content-disposition',_0xe66e('0x72')+util[_0xe66e('0x6b')](_0xe66e('0x73'),_0x3a4c61[_0xe66e('0x47')]['id'],_0x50b4bf));_0x47e455[_0xe66e('0x71')](_0xe66e('0x74'),_0xe66e('0x75'));return _0x47e455[_0xe66e('0x76')](util[_0xe66e('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3a4c61[_0xe66e('0x47')]['id'],_0x50b4bf));}else{return _0x47e455[_0xe66e('0x19')](0xcc);}})[_0xe66e('0x45')](handleError(_0x47e455,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 85201bb..bae1c23 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 _0x1d7e=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0xc905bf,_0x3fb45d){var _0x3ffd14=function(_0x3d3d02){while(--_0x3d3d02){_0xc905bf['push'](_0xc905bf['shift']());}};_0x3ffd14(++_0x3fb45d);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x1d7e[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0xe1d7('0x0'));var logger=require(_0xe1d7('0x1'))(_0xe1d7('0x2'));var moment=require('moment');var BPromise=require(_0xe1d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1d7('0x4'));var rimraf=require(_0xe1d7('0x5'));var config=require(_0xe1d7('0x6'));var attributes=require(_0xe1d7('0x7'));module[_0xe1d7('0x8')]=function(_0x4058fe,_0x252026){return _0x4058fe[_0xe1d7('0x9')](_0xe1d7('0xa'),attributes,{'tableName':_0xe1d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc1c=['path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','util','api','bluebird','request-promise'];(function(_0x1527c8,_0x3b14b9){var _0x7c5a60=function(_0x3161ac){while(--_0x3161ac){_0x1527c8['push'](_0x1527c8['shift']());}};_0x7c5a60(++_0x3b14b9);}(_0xbc1c,0xd8));var _0xcbc1=function(_0xa8f776,_0x420cbf){_0xa8f776=_0xa8f776-0x0;var _0x435961=_0xbc1c[_0xa8f776];return _0x435961;};'use strict';var _=require('lodash');var util=require(_0xcbc1('0x0'));var logger=require('../../config/logger')(_0xcbc1('0x1'));var moment=require('moment');var BPromise=require(_0xcbc1('0x2'));var rp=require(_0xcbc1('0x3'));var fs=require('fs');var path=require(_0xcbc1('0x4'));var rimraf=require(_0xcbc1('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbc1('0x6'));module[_0xcbc1('0x7')]=function(_0x54c13c,_0x27da8d){return _0x54c13c[_0xcbc1('0x8')](_0xcbc1('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index f40e288..8a7714d 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2cdf1a,_0x5c008f){var _0x4d2fe7=function(_0xf95c0f){while(--_0xf95c0f){_0x2cdf1a['push'](_0x2cdf1a['shift']());}};_0x4d2fe7(++_0x5c008f);}(_0x70e0,0x17b));var _0x070e=function(_0x181cf5,_0xe9df95){_0x181cf5=_0x181cf5-0x0;var _0x4af1ac=_0x70e0[_0x181cf5];return _0x4af1ac;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x80d8fb,_0x58dac6){var _0x58d38c=function(_0x2d9440){while(--_0x2d9440){_0x80d8fb['push'](_0x80d8fb['shift']());}};_0x58d38c(++_0x58dac6);}(_0xe706,0xa3));var _0x6e70=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0xe706[_0x6173fc];return _0x965fbe;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e74698c..defffc5 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 _0x24b9=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x4cb500,_0x1c2845){var _0x35263c=function(_0x3a78cc){while(--_0x3a78cc){_0x4cb500['push'](_0x4cb500['shift']());}};_0x35263c(++_0x1c2845);}(_0x24b9,0x13e));var _0x924b=function(_0x5a1e54,_0x13dbf7){_0x5a1e54=_0x5a1e54-0x0;var _0x4fe1b2=_0x24b9[_0x5a1e54];return _0x4fe1b2;};'use strict';var multer=require(_0x924b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x924b('0x1'));var express=require(_0x924b('0x2'));var router=express[_0x924b('0x3')]();var fs_extra=require(_0x924b('0x4'));var auth=require(_0x924b('0x5'));var interaction=require(_0x924b('0x6'));var config=require(_0x924b('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x924b('0x8')]('/',auth[_0x924b('0x9')](),controller['index']);router[_0x924b('0x8')](_0x924b('0xa'),auth[_0x924b('0x9')](),controller[_0x924b('0xb')]);router[_0x924b('0x8')](_0x924b('0xc'),auth[_0x924b('0x9')](),controller[_0x924b('0xd')]);router['post']('/',auth[_0x924b('0x9')](),controller[_0x924b('0xe')]);router[_0x924b('0xf')](_0x924b('0xc'),auth[_0x924b('0x9')](),controller['update']);router[_0x924b('0x10')](_0x924b('0xc'),auth[_0x924b('0x9')](),controller[_0x924b('0x11')]);module[_0x924b('0x12')]=router; \ No newline at end of file +var _0xe1e9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','post','put','exports','multer','util','path'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0xe1e9,0x184));var _0x9e1e=function(_0x4d70b0,_0x17385f){_0x4d70b0=_0x4d70b0-0x0;var _0x10b7cc=_0xe1e9[_0x4d70b0];return _0x10b7cc;};'use strict';var multer=require(_0x9e1e('0x0'));var util=require(_0x9e1e('0x1'));var path=require(_0x9e1e('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e1e('0x3'));var router=express[_0x9e1e('0x4')]();var fs_extra=require(_0x9e1e('0x5'));var auth=require(_0x9e1e('0x6'));var interaction=require(_0x9e1e('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x9e1e('0x8')]('/',auth[_0x9e1e('0x9')](),controller[_0x9e1e('0xa')]);router['get']('/describe',auth[_0x9e1e('0x9')](),controller[_0x9e1e('0xb')]);router['get'](_0x9e1e('0xc'),auth['isAuthenticated'](),controller[_0x9e1e('0xd')]);router[_0x9e1e('0xe')]('/',auth[_0x9e1e('0x9')](),controller['create']);router[_0x9e1e('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x9e1e('0xc'),auth[_0x9e1e('0x9')](),controller['destroy']);module[_0x9e1e('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f3756c2..b771d61 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x1fe361,_0x26c506){_0x1fe361=_0x1fe361-0x0;var _0x2690cd=_0x7a54[_0x1fe361];return _0x2690cd;};'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(_0x4937a6,_0x30a567){_0x4937a6=_0x4937a6-0x0;var _0x467530=_0x7a54[_0x4937a6];return _0x467530;};'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 c4e6298..985a0a6 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 _0x6406=['map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','fields','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x6406,0x1e9));var _0x6640=function(_0x239a37,_0x1675c8){_0x239a37=_0x239a37-0x0;var _0x46db3c=_0x6406[_0x239a37];return _0x46db3c;};'use strict';var emlformat=require(_0x6640('0x0'));var rimraf=require(_0x6640('0x1'));var zipdir=require(_0x6640('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6640('0x3'));var BPromise=require(_0x6640('0x4'));var Mustache=require(_0x6640('0x5'));var util=require(_0x6640('0x6'));var path=require(_0x6640('0x7'));var sox=require(_0x6640('0x8'));var csv=require(_0x6640('0x9'));var ejs=require(_0x6640('0xa'));var fs=require('fs');var fs_extra=require(_0x6640('0xb'));var _=require('lodash');var squel=require(_0x6640('0xc'));var crypto=require(_0x6640('0xd'));var jsforce=require(_0x6640('0xe'));var deskjs=require(_0x6640('0xf'));var toCsv=require(_0x6640('0x9'));var querystring=require(_0x6640('0x10'));var Papa=require(_0x6640('0x11'));var Redis=require('ioredis');var authService=require(_0x6640('0x12'));var qs=require(_0x6640('0x13'));var as=require(_0x6640('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6640('0x15'));var utils=require(_0x6640('0x16'));var config=require(_0x6640('0x17'));var licenseUtil=require(_0x6640('0x18'));var db=require(_0x6640('0x19'))['db'];function respondWithStatusCode(_0x2f250a,_0x3ece72){_0x3ece72=_0x3ece72||0xcc;return function(_0x5bab18){if(_0x5bab18){return _0x2f250a[_0x6640('0x1a')](_0x3ece72);}return _0x2f250a[_0x6640('0x1b')](_0x3ece72)[_0x6640('0x1c')]();};}function respondWithResult(_0xc18cbf,_0x49b715){_0x49b715=_0x49b715||0xc8;return function(_0x2a6d35){if(_0x2a6d35){return _0xc18cbf[_0x6640('0x1b')](_0x49b715)[_0x6640('0x1d')](_0x2a6d35);}};}function respondWithFilteredResult(_0x492a94,_0x4e5125){return function(_0x54a101){if(_0x54a101){var _0x435ead=typeof _0x4e5125[_0x6640('0x1e')]===_0x6640('0x1f')&&typeof _0x4e5125[_0x6640('0x20')]===_0x6640('0x1f');var _0x4a0cbe=_0x54a101['count'];var _0x361814=_0x435ead?0x0:_0x4e5125[_0x6640('0x1e')];var _0x434b33=_0x435ead?_0x54a101['count']:_0x4e5125[_0x6640('0x1e')]+_0x4e5125[_0x6640('0x20')];var _0x461556;if(_0x434b33>=_0x4a0cbe){_0x434b33=_0x4a0cbe;_0x461556=0xc8;}else{_0x461556=0xce;}_0x492a94[_0x6640('0x1b')](_0x461556);return _0x492a94[_0x6640('0x21')](_0x6640('0x22'),_0x361814+'-'+_0x434b33+'/'+_0x4a0cbe)[_0x6640('0x1d')](_0x54a101);}return null;};}function patchUpdates(_0x28e3dd){return function(_0xb79107){try{jsonpatch[_0x6640('0x23')](_0xb79107,_0x28e3dd,!![]);}catch(_0x314efe){return BPromise[_0x6640('0x24')](_0x314efe);}return _0xb79107['save']();};}function saveUpdates(_0x16cd2d,_0x1b34e0){return function(_0x5a3d42){if(_0x5a3d42){return _0x5a3d42['update'](_0x16cd2d)[_0x6640('0x25')](function(_0x5012a9){return _0x5012a9;});}return null;};}function removeEntity(_0x540ede,_0x4ea74f){return function(_0x1fdf87){if(_0x1fdf87){return _0x1fdf87[_0x6640('0x26')]()[_0x6640('0x25')](function(){_0x540ede[_0x6640('0x1b')](0xcc)[_0x6640('0x1c')]();});}};}function handleEntityNotFound(_0x2a7c25,_0x267764){return function(_0x1c93a6){if(!_0x1c93a6){_0x2a7c25[_0x6640('0x1a')](0x194);}return _0x1c93a6;};}function handleError(_0x229370,_0x66967d){_0x66967d=_0x66967d||0x1f4;return function(_0x17f509){logger[_0x6640('0x27')](_0x17f509[_0x6640('0x28')]);if(_0x17f509[_0x6640('0x29')]){delete _0x17f509[_0x6640('0x29')];}_0x229370[_0x6640('0x1b')](_0x66967d)[_0x6640('0x2a')](_0x17f509);};}exports['index']=function(_0x581080,_0x93e31f){var _0x3e23b8={},_0x42e7dd={},_0x408e86={'count':0x0,'rows':[]};var _0x479f6e=_[_0x6640('0x2b')](db[_0x6640('0x2c')][_0x6640('0x2d')],function(_0x54b296){return{'name':_0x54b296[_0x6640('0x2e')],'type':_0x54b296[_0x6640('0x2f')][_0x6640('0x30')]};});_0x42e7dd[_0x6640('0x31')]=_['map'](_0x479f6e,_0x6640('0x29'));_0x42e7dd[_0x6640('0x32')]=_[_0x6640('0x33')](_0x581080[_0x6640('0x32')]);_0x42e7dd[_0x6640('0x34')]=_[_0x6640('0x35')](_0x42e7dd[_0x6640('0x31')],_0x42e7dd[_0x6640('0x32')]);_0x3e23b8['attributes']=_[_0x6640('0x35')](_0x42e7dd['model'],qs['fields'](_0x581080[_0x6640('0x32')]['fields']));_0x3e23b8[_0x6640('0x36')]=_0x3e23b8['attributes'][_0x6640('0x37')]?_0x3e23b8[_0x6640('0x36')]:_0x42e7dd['model'];if(!_0x581080[_0x6640('0x32')]['hasOwnProperty'](_0x6640('0x38'))){_0x3e23b8['limit']=qs[_0x6640('0x20')](_0x581080[_0x6640('0x32')][_0x6640('0x20')]);_0x3e23b8[_0x6640('0x1e')]=qs[_0x6640('0x1e')](_0x581080[_0x6640('0x32')]['offset']);}_0x3e23b8['order']=qs[_0x6640('0x39')](_0x581080['query']['sort']);_0x3e23b8[_0x6640('0x3a')]=qs['filters'](_[_0x6640('0x3b')](_0x581080[_0x6640('0x32')],_0x42e7dd[_0x6640('0x34')]),_0x479f6e);if(_0x581080[_0x6640('0x32')][_0x6640('0x3c')]){_0x3e23b8[_0x6640('0x3a')]=_[_0x6640('0x3d')](_0x3e23b8[_0x6640('0x3a')],{'$or':_[_0x6640('0x2b')](_0x479f6e,function(_0x30b993){if(_0x30b993[_0x6640('0x2f')]!==_0x6640('0x3e')){var _0x2113b8={};_0x2113b8[_0x30b993[_0x6640('0x29')]]={'$like':'%'+_0x581080[_0x6640('0x32')][_0x6640('0x3c')]+'%'};return _0x2113b8;}})});}_0x3e23b8=_['merge']({},_0x3e23b8,_0x581080['options']);var _0x41e206={'where':_0x3e23b8[_0x6640('0x3a')]};return db[_0x6640('0x2c')][_0x6640('0x3f')](_0x41e206)[_0x6640('0x25')](function(_0x2a4c36){_0x408e86['count']=_0x2a4c36;if(_0x581080['query'][_0x6640('0x40')]){_0x3e23b8[_0x6640('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6640('0x42')](_0x3e23b8);})[_0x6640('0x25')](function(_0x292e79){_0x408e86[_0x6640('0x43')]=_0x292e79;return _0x408e86;})[_0x6640('0x25')](respondWithFilteredResult(_0x93e31f,_0x3e23b8))[_0x6640('0x44')](handleError(_0x93e31f,null));};exports['show']=function(_0x4d2868,_0x1ae1ce){var _0x465b20={'raw':!![],'where':{'id':_0x4d2868['params']['id']}},_0x298b3f={};_0x298b3f[_0x6640('0x31')]=_['keys'](db[_0x6640('0x2c')][_0x6640('0x2d')]);_0x298b3f[_0x6640('0x32')]=_[_0x6640('0x33')](_0x4d2868[_0x6640('0x32')]);_0x298b3f[_0x6640('0x34')]=_['intersection'](_0x298b3f['model'],_0x298b3f[_0x6640('0x32')]);_0x465b20[_0x6640('0x36')]=_['intersection'](_0x298b3f[_0x6640('0x31')],qs['fields'](_0x4d2868[_0x6640('0x32')][_0x6640('0x45')]));_0x465b20[_0x6640('0x36')]=_0x465b20[_0x6640('0x36')][_0x6640('0x37')]?_0x465b20[_0x6640('0x36')]:_0x298b3f[_0x6640('0x31')];if(_0x4d2868['query'][_0x6640('0x40')]){_0x465b20['include']=[{'all':!![]}];}_0x465b20=_['merge']({},_0x465b20,_0x4d2868['options']);return db[_0x6640('0x2c')][_0x6640('0x46')](_0x465b20)['then'](handleEntityNotFound(_0x1ae1ce,null))[_0x6640('0x25')](respondWithResult(_0x1ae1ce,null))['catch'](handleError(_0x1ae1ce,null));};exports[_0x6640('0x47')]=function(_0x4503dd,_0x6133d7){return db[_0x6640('0x2c')]['create'](_0x4503dd[_0x6640('0x48')],{})[_0x6640('0x25')](respondWithResult(_0x6133d7,0xc9))[_0x6640('0x44')](handleError(_0x6133d7,null));};exports[_0x6640('0x49')]=function(_0x82fcbb,_0x3f061d){if(_0x82fcbb[_0x6640('0x48')]['id']){delete _0x82fcbb[_0x6640('0x48')]['id'];}return db[_0x6640('0x2c')][_0x6640('0x46')]({'where':{'id':_0x82fcbb[_0x6640('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f061d,null))[_0x6640('0x25')](saveUpdates(_0x82fcbb[_0x6640('0x48')],null))['then'](respondWithResult(_0x3f061d,null))[_0x6640('0x44')](handleError(_0x3f061d,null));};exports[_0x6640('0x26')]=function(_0x2c7439,_0x37c827){return db[_0x6640('0x2c')][_0x6640('0x46')]({'where':{'id':_0x2c7439['params']['id']}})[_0x6640('0x25')](handleEntityNotFound(_0x37c827,null))['then'](removeEntity(_0x37c827,null))['catch'](handleError(_0x37c827,null));};exports[_0x6640('0x4b')]=function(_0x361b78,_0x51acc8){return db[_0x6640('0x2c')][_0x6640('0x4b')]()[_0x6640('0x25')](respondWithResult(_0x51acc8,null))[_0x6640('0x44')](handleError(_0x51acc8,null));}; \ No newline at end of file +var _0xd985=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x38fd67,_0x45e1ea){var _0x12a9e9=function(_0x4e0b6c){while(--_0x4e0b6c){_0x38fd67['push'](_0x38fd67['shift']());}};_0x12a9e9(++_0x45e1ea);}(_0xd985,0x1a7));var _0x5d98=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0xd985[_0x427d3a];return _0xe5c521;};'use strict';var emlformat=require(_0x5d98('0x0'));var rimraf=require(_0x5d98('0x1'));var zipdir=require(_0x5d98('0x2'));var jsonpatch=require(_0x5d98('0x3'));var rp=require(_0x5d98('0x4'));var moment=require(_0x5d98('0x5'));var BPromise=require(_0x5d98('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5d98('0x7'));var sox=require('sox');var csv=require(_0x5d98('0x8'));var ejs=require(_0x5d98('0x9'));var fs=require('fs');var fs_extra=require(_0x5d98('0xa'));var _=require(_0x5d98('0xb'));var squel=require('squel');var crypto=require(_0x5d98('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5d98('0xd'));var toCsv=require(_0x5d98('0x8'));var querystring=require('querystring');var Papa=require(_0x5d98('0xe'));var Redis=require(_0x5d98('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d98('0x10'));var hardwareService=require(_0x5d98('0x11'));var logger=require(_0x5d98('0x12'))(_0x5d98('0x13'));var utils=require('../../config/utils');var config=require(_0x5d98('0x14'));var licenseUtil=require(_0x5d98('0x15'));var db=require(_0x5d98('0x16'))['db'];function respondWithStatusCode(_0x2de49a,_0x57ab74){_0x57ab74=_0x57ab74||0xcc;return function(_0x443b86){if(_0x443b86){return _0x2de49a[_0x5d98('0x17')](_0x57ab74);}return _0x2de49a[_0x5d98('0x18')](_0x57ab74)[_0x5d98('0x19')]();};}function respondWithResult(_0x259c38,_0x3236bb){_0x3236bb=_0x3236bb||0xc8;return function(_0x5e2d69){if(_0x5e2d69){return _0x259c38[_0x5d98('0x18')](_0x3236bb)['json'](_0x5e2d69);}};}function respondWithFilteredResult(_0x1c1fde,_0x4bbb03){return function(_0x5f0f5c){if(_0x5f0f5c){var _0x1e1353=typeof _0x4bbb03['offset']===_0x5d98('0x1a')&&typeof _0x4bbb03['limit']===_0x5d98('0x1a');var _0x31066f=_0x5f0f5c[_0x5d98('0x1b')];var _0x15a748=_0x1e1353?0x0:_0x4bbb03[_0x5d98('0x1c')];var _0x244768=_0x1e1353?_0x5f0f5c[_0x5d98('0x1b')]:_0x4bbb03[_0x5d98('0x1c')]+_0x4bbb03[_0x5d98('0x1d')];var _0x510d43;if(_0x244768>=_0x31066f){_0x244768=_0x31066f;_0x510d43=0xc8;}else{_0x510d43=0xce;}_0x1c1fde[_0x5d98('0x18')](_0x510d43);return _0x1c1fde[_0x5d98('0x1e')]('Content-Range',_0x15a748+'-'+_0x244768+'/'+_0x31066f)[_0x5d98('0x1f')](_0x5f0f5c);}return null;};}function patchUpdates(_0xa520cb){return function(_0x93c234){try{jsonpatch['apply'](_0x93c234,_0xa520cb,!![]);}catch(_0x36dc30){return BPromise[_0x5d98('0x20')](_0x36dc30);}return _0x93c234[_0x5d98('0x21')]();};}function saveUpdates(_0x4fffd5,_0x4b23ad){return function(_0x2638d6){if(_0x2638d6){return _0x2638d6[_0x5d98('0x22')](_0x4fffd5)[_0x5d98('0x23')](function(_0x385e6f){return _0x385e6f;});}return null;};}function removeEntity(_0x9ecd04,_0x5b5561){return function(_0x2d2ea8){if(_0x2d2ea8){return _0x2d2ea8[_0x5d98('0x24')]()[_0x5d98('0x23')](function(){_0x9ecd04['status'](0xcc)[_0x5d98('0x19')]();});}};}function handleEntityNotFound(_0x32d766,_0x52a820){return function(_0x9ffafb){if(!_0x9ffafb){_0x32d766[_0x5d98('0x17')](0x194);}return _0x9ffafb;};}function handleError(_0x16007b,_0x32cf25){_0x32cf25=_0x32cf25||0x1f4;return function(_0x220c95){logger[_0x5d98('0x25')](_0x220c95[_0x5d98('0x26')]);if(_0x220c95[_0x5d98('0x27')]){delete _0x220c95[_0x5d98('0x27')];}_0x16007b[_0x5d98('0x18')](_0x32cf25)[_0x5d98('0x28')](_0x220c95);};}exports[_0x5d98('0x29')]=function(_0x59a34c,_0x56c887){var _0xd83a96={},_0x544637={},_0x1a4414={'count':0x0,'rows':[]};var _0x53e758=_['map'](db[_0x5d98('0x2a')][_0x5d98('0x2b')],function(_0x55e0cf){return{'name':_0x55e0cf[_0x5d98('0x2c')],'type':_0x55e0cf[_0x5d98('0x2d')]['key']};});_0x544637[_0x5d98('0x2e')]=_[_0x5d98('0x2f')](_0x53e758,'name');_0x544637[_0x5d98('0x30')]=_[_0x5d98('0x31')](_0x59a34c[_0x5d98('0x30')]);_0x544637[_0x5d98('0x32')]=_[_0x5d98('0x33')](_0x544637['model'],_0x544637['query']);_0xd83a96[_0x5d98('0x34')]=_[_0x5d98('0x33')](_0x544637[_0x5d98('0x2e')],qs[_0x5d98('0x35')](_0x59a34c[_0x5d98('0x30')][_0x5d98('0x35')]));_0xd83a96[_0x5d98('0x34')]=_0xd83a96[_0x5d98('0x34')][_0x5d98('0x36')]?_0xd83a96[_0x5d98('0x34')]:_0x544637[_0x5d98('0x2e')];if(!_0x59a34c[_0x5d98('0x30')][_0x5d98('0x37')](_0x5d98('0x38'))){_0xd83a96[_0x5d98('0x1d')]=qs[_0x5d98('0x1d')](_0x59a34c[_0x5d98('0x30')]['limit']);_0xd83a96[_0x5d98('0x1c')]=qs['offset'](_0x59a34c[_0x5d98('0x30')][_0x5d98('0x1c')]);}_0xd83a96['order']=qs['sort'](_0x59a34c['query'][_0x5d98('0x39')]);_0xd83a96['where']=qs[_0x5d98('0x32')](_[_0x5d98('0x3a')](_0x59a34c[_0x5d98('0x30')],_0x544637[_0x5d98('0x32')]),_0x53e758);if(_0x59a34c[_0x5d98('0x30')][_0x5d98('0x3b')]){_0xd83a96['where']=_[_0x5d98('0x3c')](_0xd83a96[_0x5d98('0x3d')],{'$or':_[_0x5d98('0x2f')](_0x53e758,function(_0x420ce6){if(_0x420ce6[_0x5d98('0x2d')]!==_0x5d98('0x3e')){var _0x100ce6={};_0x100ce6[_0x420ce6[_0x5d98('0x27')]]={'$like':'%'+_0x59a34c[_0x5d98('0x30')][_0x5d98('0x3b')]+'%'};return _0x100ce6;}})});}_0xd83a96=_['merge']({},_0xd83a96,_0x59a34c[_0x5d98('0x3f')]);var _0xa9cc0e={'where':_0xd83a96[_0x5d98('0x3d')]};return db[_0x5d98('0x2a')][_0x5d98('0x1b')](_0xa9cc0e)[_0x5d98('0x23')](function(_0xa55072){_0x1a4414[_0x5d98('0x1b')]=_0xa55072;if(_0x59a34c[_0x5d98('0x30')]['includeAll']){_0xd83a96[_0x5d98('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5d98('0x41')](_0xd83a96);})[_0x5d98('0x23')](function(_0x3eea07){_0x1a4414[_0x5d98('0x42')]=_0x3eea07;return _0x1a4414;})[_0x5d98('0x23')](respondWithFilteredResult(_0x56c887,_0xd83a96))[_0x5d98('0x43')](handleError(_0x56c887,null));};exports[_0x5d98('0x44')]=function(_0x4ec559,_0x317914){var _0x1f6f79={'raw':!![],'where':{'id':_0x4ec559[_0x5d98('0x45')]['id']}},_0x44be49={};_0x44be49['model']=_[_0x5d98('0x31')](db[_0x5d98('0x2a')]['rawAttributes']);_0x44be49['query']=_['keys'](_0x4ec559[_0x5d98('0x30')]);_0x44be49['filters']=_[_0x5d98('0x33')](_0x44be49[_0x5d98('0x2e')],_0x44be49[_0x5d98('0x30')]);_0x1f6f79['attributes']=_['intersection'](_0x44be49[_0x5d98('0x2e')],qs[_0x5d98('0x35')](_0x4ec559[_0x5d98('0x30')]['fields']));_0x1f6f79[_0x5d98('0x34')]=_0x1f6f79[_0x5d98('0x34')][_0x5d98('0x36')]?_0x1f6f79[_0x5d98('0x34')]:_0x44be49[_0x5d98('0x2e')];if(_0x4ec559[_0x5d98('0x30')]['includeAll']){_0x1f6f79[_0x5d98('0x40')]=[{'all':!![]}];}_0x1f6f79=_[_0x5d98('0x3c')]({},_0x1f6f79,_0x4ec559['options']);return db[_0x5d98('0x2a')][_0x5d98('0x46')](_0x1f6f79)['then'](handleEntityNotFound(_0x317914,null))['then'](respondWithResult(_0x317914,null))[_0x5d98('0x43')](handleError(_0x317914,null));};exports[_0x5d98('0x47')]=function(_0x15eb5e,_0x465562){return db[_0x5d98('0x2a')][_0x5d98('0x47')](_0x15eb5e[_0x5d98('0x48')],{})[_0x5d98('0x23')](respondWithResult(_0x465562,0xc9))[_0x5d98('0x43')](handleError(_0x465562,null));};exports[_0x5d98('0x22')]=function(_0x99c14f,_0x2596f2){if(_0x99c14f[_0x5d98('0x48')]['id']){delete _0x99c14f[_0x5d98('0x48')]['id'];}return db[_0x5d98('0x2a')][_0x5d98('0x46')]({'where':{'id':_0x99c14f['params']['id']}})[_0x5d98('0x23')](handleEntityNotFound(_0x2596f2,null))[_0x5d98('0x23')](saveUpdates(_0x99c14f['body'],null))[_0x5d98('0x23')](respondWithResult(_0x2596f2,null))[_0x5d98('0x43')](handleError(_0x2596f2,null));};exports['destroy']=function(_0xdc14c1,_0x186de8){return db[_0x5d98('0x2a')]['find']({'where':{'id':_0xdc14c1[_0x5d98('0x45')]['id']}})[_0x5d98('0x23')](handleEntityNotFound(_0x186de8,null))['then'](removeEntity(_0x186de8,null))[_0x5d98('0x43')](handleError(_0x186de8,null));};exports[_0x5d98('0x49')]=function(_0x21e60a,_0x43b80e){return db[_0x5d98('0x2a')][_0x5d98('0x49')]()[_0x5d98('0x23')](respondWithResult(_0x43b80e,null))[_0x5d98('0x43')](handleError(_0x43b80e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 1bfa293..8758f28 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 _0x16bf=['../../config/environment','./jscriptyQuestionReport.attributes','exports','report_jscripty_questions','lodash','util','../../config/logger','moment','rimraf'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x16bf,0x175));var _0xf16b=function(_0x5712db,_0xeb8e9d){_0x5712db=_0x5712db-0x0;var _0x3fe6f8=_0x16bf[_0x5712db];return _0x3fe6f8;};'use strict';var _=require(_0xf16b('0x0'));var util=require(_0xf16b('0x1'));var logger=require(_0xf16b('0x2'))('api');var moment=require(_0xf16b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf16b('0x4'));var config=require(_0xf16b('0x5'));var attributes=require(_0xf16b('0x6'));module[_0xf16b('0x7')]=function(_0x4be884,_0x146f94){return _0x4be884['define']('JscriptyQuestionReport',attributes,{'tableName':_0xf16b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe579=['api','moment','request-promise','path','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','../../config/logger'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xe579,0x18f));var _0x9e57=function(_0x465749,_0x14f0f8){_0x465749=_0x465749-0x0;var _0x330ba1=_0xe579[_0x465749];return _0x330ba1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9e57('0x0'))(_0x9e57('0x1'));var moment=require(_0x9e57('0x2'));var BPromise=require('bluebird');var rp=require(_0x9e57('0x3'));var fs=require('fs');var path=require(_0x9e57('0x4'));var rimraf=require('rimraf');var config=require(_0x9e57('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x9e57('0x6')]=function(_0x2030f2,_0x2d967a){return _0x2030f2[_0x9e57('0x7')](_0x9e57('0x8'),attributes,{'tableName':_0x9e57('0x9'),'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 7d37e19..d11760b 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 _0x3816=['jayson/promise','http','request','then','info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x543429,_0x140390){var _0x112a46=function(_0x46528b){while(--_0x46528b){_0x543429['push'](_0x543429['shift']());}};_0x112a46(++_0x140390);}(_0x3816,0x1dc));var _0x6381=function(_0x4e9fed,_0x19f4f3){_0x4e9fed=_0x4e9fed-0x0;var _0x5c8cc0=_0x3816[_0x4e9fed];return _0x5c8cc0;};'use strict';var _=require(_0x6381('0x0'));var util=require(_0x6381('0x1'));var moment=require('moment');var BPromise=require(_0x6381('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6381('0x3'))['db'];var utils=require(_0x6381('0x4'));var logger=require(_0x6381('0x5'))(_0x6381('0x6'));var config=require(_0x6381('0x7'));var jayson=require(_0x6381('0x8'));var client=jayson['client'][_0x6381('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d4e47,_0xa094b2,_0x30a19b){return new BPromise(function(_0x23bfb8,_0x4cf2ce){return client[_0x6381('0xa')](_0x3d4e47,_0x30a19b)[_0x6381('0xb')](function(_0x447b08){logger[_0x6381('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xa094b2,_0x6381('0xd'));logger['debug'](_0x6381('0xe'),_0xa094b2,'request\x20sent',JSON[_0x6381('0xf')](_0x447b08));if(_0x447b08[_0x6381('0x10')]){if(_0x447b08[_0x6381('0x10')][_0x6381('0x11')]===0x1f4){logger[_0x6381('0x10')](_0x6381('0x12'),_0xa094b2,_0x447b08[_0x6381('0x10')][_0x6381('0x13')]);return _0x4cf2ce(_0x447b08[_0x6381('0x10')][_0x6381('0x13')]);}logger[_0x6381('0x10')](_0x6381('0x12'),_0xa094b2,_0x447b08[_0x6381('0x10')][_0x6381('0x13')]);return _0x23bfb8(_0x447b08['error'][_0x6381('0x13')]);}else{logger[_0x6381('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xa094b2,_0x6381('0xd'));_0x23bfb8(_0x447b08[_0x6381('0x14')][_0x6381('0x13')]);}})[_0x6381('0x15')](function(_0xcb828b){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0xa094b2,_0xcb828b);_0x4cf2ce(_0xcb828b);});});} \ No newline at end of file +var _0x33c2=['../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x164d8b,_0x133d6d){var _0x21991b=function(_0x576cf0){while(--_0x576cf0){_0x164d8b['push'](_0x164d8b['shift']());}};_0x21991b(++_0x133d6d);}(_0x33c2,0x126));var _0x233c=function(_0x42aabd,_0x217ade){_0x42aabd=_0x42aabd-0x0;var _0x2e83fb=_0x33c2[_0x42aabd];return _0x2e83fb;};'use strict';var _=require(_0x233c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x233c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x233c('0x2'));var db=require(_0x233c('0x3'))['db'];var utils=require(_0x233c('0x4'));var logger=require('../../config/logger')(_0x233c('0x5'));var config=require(_0x233c('0x6'));var jayson=require(_0x233c('0x7'));var client=jayson[_0x233c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45540f,_0x521830,_0x1d6c9c){return new BPromise(function(_0x5285e7,_0x46aef7){return client[_0x233c('0x9')](_0x45540f,_0x1d6c9c)[_0x233c('0xa')](function(_0x1b51fc){logger[_0x233c('0xb')](_0x233c('0xc'),_0x521830,_0x233c('0xd'));logger[_0x233c('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x521830,_0x233c('0xd'),JSON[_0x233c('0xf')](_0x1b51fc));if(_0x1b51fc[_0x233c('0x10')]){if(_0x1b51fc['error']['code']===0x1f4){logger[_0x233c('0x10')](_0x233c('0xc'),_0x521830,_0x1b51fc[_0x233c('0x10')]['message']);return _0x46aef7(_0x1b51fc[_0x233c('0x10')][_0x233c('0x11')]);}logger[_0x233c('0x10')](_0x233c('0xc'),_0x521830,_0x1b51fc[_0x233c('0x10')][_0x233c('0x11')]);return _0x5285e7(_0x1b51fc['error']['message']);}else{logger[_0x233c('0xb')](_0x233c('0xc'),_0x521830,_0x233c('0xd'));_0x5285e7(_0x1b51fc[_0x233c('0x12')]['message']);}})[_0x233c('0x13')](function(_0x51ec1f){logger[_0x233c('0x10')](_0x233c('0xc'),_0x521830,_0x51ec1f);_0x46aef7(_0x51ec1f);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0885690..07400d1 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 _0xaa08=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','/:id','show','/:id/questions','isAuthenticated','getQuestions','create','put','update','delete','destroy','exports'];(function(_0x11bb19,_0x150c77){var _0x3e95da=function(_0x340035){while(--_0x340035){_0x11bb19['push'](_0x11bb19['shift']());}};_0x3e95da(++_0x150c77);}(_0xaa08,0xb4));var _0x8aa0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaa08[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8aa0('0x0'));var express=require(_0x8aa0('0x1'));var router=express[_0x8aa0('0x2')]();var fs_extra=require(_0x8aa0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8aa0('0x4'));var config=require(_0x8aa0('0x5'));var controller=require(_0x8aa0('0x6'));router[_0x8aa0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8aa0('0x7')](_0x8aa0('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x8aa0('0x7')](_0x8aa0('0x9'),auth['isAuthenticated'](),controller[_0x8aa0('0xa')]);router[_0x8aa0('0x7')](_0x8aa0('0xb'),auth[_0x8aa0('0xc')](),controller[_0x8aa0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8aa0('0xe')]);router[_0x8aa0('0xf')]('/:id',auth[_0x8aa0('0xc')](),controller[_0x8aa0('0x10')]);router[_0x8aa0('0x11')](_0x8aa0('0x9'),auth[_0x8aa0('0xc')](),controller[_0x8aa0('0x12')]);module[_0x8aa0('0x13')]=router; \ No newline at end of file +var _0x5db7=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id/questions','getQuestions','post','create','put','/:id','update','destroy'];(function(_0x160cb7,_0x4c945c){var _0x164af0=function(_0xd662be){while(--_0xd662be){_0x160cb7['push'](_0x160cb7['shift']());}};_0x164af0(++_0x4c945c);}(_0x5db7,0x127));var _0x75db=function(_0x20beae,_0x5eac6d){_0x20beae=_0x20beae-0x0;var _0xf5725=_0x5db7[_0x20beae];return _0xf5725;};'use strict';var multer=require('multer');var util=require(_0x75db('0x0'));var path=require('path');var timeout=require(_0x75db('0x1'));var express=require(_0x75db('0x2'));var router=express[_0x75db('0x3')]();var fs_extra=require(_0x75db('0x4'));var auth=require(_0x75db('0x5'));var interaction=require(_0x75db('0x6'));var config=require(_0x75db('0x7'));var controller=require(_0x75db('0x8'));router[_0x75db('0x9')]('/',auth[_0x75db('0xa')](),controller['index']);router[_0x75db('0x9')](_0x75db('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x75db('0x9')]('/:id',auth[_0x75db('0xa')](),controller['show']);router[_0x75db('0x9')](_0x75db('0xc'),auth[_0x75db('0xa')](),controller[_0x75db('0xd')]);router[_0x75db('0xe')]('/',auth[_0x75db('0xa')](),controller[_0x75db('0xf')]);router[_0x75db('0x10')](_0x75db('0x11'),auth[_0x75db('0xa')](),controller[_0x75db('0x12')]);router['delete'](_0x75db('0x11'),auth[_0x75db('0xa')](),controller[_0x75db('0x13')]);module[_0x75db('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c26935f..c4d3ef7 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 _0x4910=['DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x56b8c2,_0x128d5c){var _0x3644f5=function(_0x609c55){while(--_0x609c55){_0x56b8c2['push'](_0x56b8c2['shift']());}};_0x3644f5(++_0x128d5c);}(_0x4910,0x1d9));var _0x0491=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4910[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require(_0x0491('0x0'));var Sequelize=require(_0x0491('0x1'));module[_0x0491('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0xd16f69){this[_0x0491('0x3')](_0x0491('0x4'),_0xd16f69);this[_0x0491('0x3')](_0x0491('0x5'),moment()['format'](_0x0491('0x6')));}},'endtime':{'type':Sequelize[_0x0491('0x7')]},'membername':{'type':Sequelize[_0x0491('0x8')]},'projectname':{'type':Sequelize[_0x0491('0x8')]},'queue':{'type':Sequelize[_0x0491('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0491('0x8')]},'calleridnum':{'type':Sequelize[_0x0491('0x8')]},'completed':{'type':Sequelize[_0x0491('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f0e=['STRING','BOOLEAN','moment','DATE','setDataValue','endtime'];(function(_0x16a677,_0x5de079){var _0x51e8dc=function(_0x3e2eb1){while(--_0x3e2eb1){_0x16a677['push'](_0x16a677['shift']());}};_0x51e8dc(++_0x5de079);}(_0x5f0e,0x19a));var _0xe5f0=function(_0x297e7b,_0x4948cf){_0x297e7b=_0x297e7b-0x0;var _0x12f35b=_0x5f0e[_0x297e7b];return _0x12f35b;};'use strict';var moment=require(_0xe5f0('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xe5f0('0x1')],'set':function(_0x518cae){this[_0xe5f0('0x2')]('starttime',_0x518cae);this[_0xe5f0('0x2')](_0xe5f0('0x3'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xe5f0('0x4')]},'projectname':{'type':Sequelize[_0xe5f0('0x4')]},'queue':{'type':Sequelize[_0xe5f0('0x4')]},'uniqueid':{'type':Sequelize[_0xe5f0('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe5f0('0x4')]},'completed':{'type':Sequelize[_0xe5f0('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 164ac79..4be1940 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 _0x0682=['VIRTUAL','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge'];(function(_0x3bde69,_0x3b9280){var _0x361ed3=function(_0x1f038b){while(--_0x1f038b){_0x3bde69['push'](_0x3bde69['shift']());}};_0x361ed3(++_0x3b9280);}(_0x0682,0x19f));var _0x2068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0682[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2068('0x0'));var zipdir=require(_0x2068('0x1'));var jsonpatch=require(_0x2068('0x2'));var rp=require(_0x2068('0x3'));var moment=require(_0x2068('0x4'));var BPromise=require(_0x2068('0x5'));var Mustache=require('mustache');var util=require(_0x2068('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2068('0x7'));var ejs=require(_0x2068('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2068('0x9'));var squel=require('squel');var crypto=require(_0x2068('0xa'));var jsforce=require(_0x2068('0xb'));var deskjs=require(_0x2068('0xc'));var toCsv=require(_0x2068('0x7'));var querystring=require('querystring');var Papa=require(_0x2068('0xd'));var Redis=require(_0x2068('0xe'));var authService=require(_0x2068('0xf'));var qs=require(_0x2068('0x10'));var as=require(_0x2068('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2068('0x12'))(_0x2068('0x13'));var utils=require(_0x2068('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2068('0x15'));var db=require(_0x2068('0x16'))['db'];function respondWithStatusCode(_0x1fa571,_0x4977be){_0x4977be=_0x4977be||0xcc;return function(_0x99f5a4){if(_0x99f5a4){return _0x1fa571[_0x2068('0x17')](_0x4977be);}return _0x1fa571[_0x2068('0x18')](_0x4977be)[_0x2068('0x19')]();};}function respondWithResult(_0x1aa8c1,_0x4a10c4){_0x4a10c4=_0x4a10c4||0xc8;return function(_0x3219d8){if(_0x3219d8){return _0x1aa8c1[_0x2068('0x18')](_0x4a10c4)[_0x2068('0x1a')](_0x3219d8);}};}function respondWithFilteredResult(_0x224222,_0x5c7ad6){return function(_0x3c2b45){if(_0x3c2b45){var _0x5dd03f=typeof _0x5c7ad6[_0x2068('0x1b')]==='undefined'&&typeof _0x5c7ad6['limit']==='undefined';var _0x53694c=_0x3c2b45['count'];var _0x542495=_0x5dd03f?0x0:_0x5c7ad6[_0x2068('0x1b')];var _0x3ca780=_0x5dd03f?_0x3c2b45[_0x2068('0x1c')]:_0x5c7ad6['offset']+_0x5c7ad6[_0x2068('0x1d')];var _0x89b1c4;if(_0x3ca780>=_0x53694c){_0x3ca780=_0x53694c;_0x89b1c4=0xc8;}else{_0x89b1c4=0xce;}_0x224222[_0x2068('0x18')](_0x89b1c4);return _0x224222[_0x2068('0x1e')](_0x2068('0x1f'),_0x542495+'-'+_0x3ca780+'/'+_0x53694c)[_0x2068('0x1a')](_0x3c2b45);}return null;};}function patchUpdates(_0x37377a){return function(_0xcf3b02){try{jsonpatch[_0x2068('0x20')](_0xcf3b02,_0x37377a,!![]);}catch(_0x2e3bf2){return BPromise[_0x2068('0x21')](_0x2e3bf2);}return _0xcf3b02[_0x2068('0x22')]();};}function saveUpdates(_0x40731b,_0x14caaa){return function(_0x2c8a2e){if(_0x2c8a2e){return _0x2c8a2e['update'](_0x40731b)['then'](function(_0x4bdc78){return _0x4bdc78;});}return null;};}function removeEntity(_0x53f938,_0x131ad2){return function(_0x224f20){if(_0x224f20){return _0x224f20['destroy']()[_0x2068('0x23')](function(){_0x53f938[_0x2068('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9002,_0x5408fd){return function(_0x3b2917){if(!_0x3b2917){_0x5e9002['sendStatus'](0x194);}return _0x3b2917;};}function handleError(_0x45e97c,_0x92b349){_0x92b349=_0x92b349||0x1f4;return function(_0x4aa0a0){logger[_0x2068('0x24')](_0x4aa0a0[_0x2068('0x25')]);if(_0x4aa0a0[_0x2068('0x26')]){delete _0x4aa0a0[_0x2068('0x26')];}_0x45e97c[_0x2068('0x18')](_0x92b349)[_0x2068('0x27')](_0x4aa0a0);};}exports['index']=function(_0x432adb,_0x358407){var _0x298d1c={},_0xc629b7={},_0x460559={'count':0x0,'rows':[]};var _0x17c36e=_[_0x2068('0x28')](db['JscriptySessionReport'][_0x2068('0x29')],function(_0x13705c){return{'name':_0x13705c[_0x2068('0x2a')],'type':_0x13705c[_0x2068('0x2b')][_0x2068('0x2c')]};});_0xc629b7[_0x2068('0x2d')]=_[_0x2068('0x28')](_0x17c36e,'name');_0xc629b7['query']=_['keys'](_0x432adb['query']);_0xc629b7[_0x2068('0x2e')]=_[_0x2068('0x2f')](_0xc629b7['model'],_0xc629b7[_0x2068('0x30')]);_0x298d1c[_0x2068('0x31')]=_[_0x2068('0x2f')](_0xc629b7[_0x2068('0x2d')],qs['fields'](_0x432adb[_0x2068('0x30')][_0x2068('0x32')]));_0x298d1c[_0x2068('0x31')]=_0x298d1c[_0x2068('0x31')][_0x2068('0x33')]?_0x298d1c[_0x2068('0x31')]:_0xc629b7['model'];if(!_0x432adb['query'][_0x2068('0x34')]('nolimit')){_0x298d1c[_0x2068('0x1d')]=qs['limit'](_0x432adb[_0x2068('0x30')][_0x2068('0x1d')]);_0x298d1c['offset']=qs[_0x2068('0x1b')](_0x432adb[_0x2068('0x30')]['offset']);}_0x298d1c[_0x2068('0x35')]=qs[_0x2068('0x36')](_0x432adb[_0x2068('0x30')][_0x2068('0x36')]);_0x298d1c['where']=qs['filters'](_[_0x2068('0x37')](_0x432adb[_0x2068('0x30')],_0xc629b7['filters']),_0x17c36e);if(_0x432adb[_0x2068('0x30')][_0x2068('0x38')]){_0x298d1c[_0x2068('0x39')]=_[_0x2068('0x3a')](_0x298d1c['where'],{'$or':_[_0x2068('0x28')](_0x17c36e,function(_0x4b88d9){if(_0x4b88d9[_0x2068('0x2b')]!==_0x2068('0x3b')){var _0x85b90={};_0x85b90[_0x4b88d9[_0x2068('0x26')]]={'$like':'%'+_0x432adb[_0x2068('0x30')][_0x2068('0x38')]+'%'};return _0x85b90;}})});}_0x298d1c=_[_0x2068('0x3a')]({},_0x298d1c,_0x432adb['options']);var _0x349d88={'where':_0x298d1c[_0x2068('0x39')]};return db[_0x2068('0x3c')][_0x2068('0x1c')](_0x349d88)[_0x2068('0x23')](function(_0x11f51d){_0x460559['count']=_0x11f51d;if(_0x432adb[_0x2068('0x30')][_0x2068('0x3d')]){_0x298d1c[_0x2068('0x3e')]=[{'all':!![]}];}return db[_0x2068('0x3c')][_0x2068('0x3f')](_0x298d1c);})[_0x2068('0x23')](function(_0x7a9b0e){_0x460559[_0x2068('0x40')]=_0x7a9b0e;return _0x460559;})[_0x2068('0x23')](respondWithFilteredResult(_0x358407,_0x298d1c))[_0x2068('0x41')](handleError(_0x358407,null));};exports[_0x2068('0x42')]=function(_0x220eda,_0x850d55){var _0x45d877={'raw':!![],'where':{'id':_0x220eda[_0x2068('0x43')]['id']}},_0x114eb5={};_0x114eb5[_0x2068('0x2d')]=_[_0x2068('0x44')](db['JscriptySessionReport']['rawAttributes']);_0x114eb5[_0x2068('0x30')]=_['keys'](_0x220eda[_0x2068('0x30')]);_0x114eb5[_0x2068('0x2e')]=_[_0x2068('0x2f')](_0x114eb5['model'],_0x114eb5[_0x2068('0x30')]);_0x45d877['attributes']=_[_0x2068('0x2f')](_0x114eb5[_0x2068('0x2d')],qs[_0x2068('0x32')](_0x220eda['query'][_0x2068('0x32')]));_0x45d877[_0x2068('0x31')]=_0x45d877[_0x2068('0x31')][_0x2068('0x33')]?_0x45d877['attributes']:_0x114eb5[_0x2068('0x2d')];if(_0x220eda['query'][_0x2068('0x3d')]){_0x45d877[_0x2068('0x3e')]=[{'all':!![]}];}_0x45d877=_[_0x2068('0x3a')]({},_0x45d877,_0x220eda[_0x2068('0x45')]);return db[_0x2068('0x3c')][_0x2068('0x46')](_0x45d877)[_0x2068('0x23')](handleEntityNotFound(_0x850d55,null))['then'](respondWithResult(_0x850d55,null))['catch'](handleError(_0x850d55,null));};exports[_0x2068('0x47')]=function(_0x1c22d3,_0x130699){return db['JscriptySessionReport'][_0x2068('0x47')](_0x1c22d3['body'],{})['then'](respondWithResult(_0x130699,0xc9))['catch'](handleError(_0x130699,null));};exports['update']=function(_0x40b20c,_0x348894){if(_0x40b20c[_0x2068('0x48')]['id']){delete _0x40b20c['body']['id'];}return db[_0x2068('0x3c')][_0x2068('0x46')]({'where':{'id':_0x40b20c[_0x2068('0x43')]['id']}})[_0x2068('0x23')](handleEntityNotFound(_0x348894,null))[_0x2068('0x23')](saveUpdates(_0x40b20c['body'],null))['then'](respondWithResult(_0x348894,null))[_0x2068('0x41')](handleError(_0x348894,null));};exports[_0x2068('0x49')]=function(_0x4d30ed,_0x2da075){return db[_0x2068('0x3c')][_0x2068('0x46')]({'where':{'id':_0x4d30ed['params']['id']}})['then'](handleEntityNotFound(_0x2da075,null))[_0x2068('0x23')](removeEntity(_0x2da075,null))['catch'](handleError(_0x2da075,null));};exports[_0x2068('0x4a')]=function(_0x270867,_0x51de6f){return db[_0x2068('0x3c')]['describe']()[_0x2068('0x23')](respondWithResult(_0x51de6f,null))[_0x2068('0x41')](handleError(_0x51de6f,null));};exports[_0x2068('0x4b')]=function(_0x5d77ca,_0x334f13,_0x41cc63){var _0x1be9df={'raw':!![],'where':{}};var _0xfea9ba={};var _0x4827b4={'count':0x0,'rows':[]};return db[_0x2068('0x3c')][_0x2068('0x4c')]({'where':{'id':_0x5d77ca[_0x2068('0x43')]['id']}})[_0x2068('0x23')](handleEntityNotFound(_0x334f13,null))[_0x2068('0x23')](function(_0x4a14ac){if(_0x4a14ac){_0xfea9ba[_0x2068('0x2d')]=_[_0x2068('0x44')](db[_0x2068('0x4d')]['rawAttributes']);_0xfea9ba['query']=_[_0x2068('0x44')](_0x5d77ca['query']);_0xfea9ba[_0x2068('0x2e')]=_['intersection'](_0xfea9ba[_0x2068('0x2d')],_0xfea9ba[_0x2068('0x30')]);_0x1be9df[_0x2068('0x31')]=_[_0x2068('0x2f')](_0xfea9ba[_0x2068('0x2d')],qs[_0x2068('0x32')](_0x5d77ca[_0x2068('0x30')][_0x2068('0x32')]));_0x1be9df[_0x2068('0x31')]=_0x1be9df[_0x2068('0x31')][_0x2068('0x33')]?_0x1be9df['attributes']:_0xfea9ba['model'];if(!_0x5d77ca[_0x2068('0x30')]['hasOwnProperty'](_0x2068('0x4e'))){_0x1be9df[_0x2068('0x1d')]=qs[_0x2068('0x1d')](_0x5d77ca[_0x2068('0x30')]['limit']);_0x1be9df[_0x2068('0x1b')]=qs[_0x2068('0x1b')](_0x5d77ca['query'][_0x2068('0x1b')]);}_0x1be9df[_0x2068('0x35')]=qs['sort'](_0x5d77ca[_0x2068('0x30')][_0x2068('0x36')]);_0x1be9df[_0x2068('0x39')]=qs['filters'](_[_0x2068('0x37')](_0x5d77ca['query'],_0xfea9ba[_0x2068('0x2e')]));_0x1be9df[_0x2068('0x39')]['SessionId']=_0x4a14ac['id'];if(_0x5d77ca[_0x2068('0x30')][_0x2068('0x38')]){_0x1be9df['where']=_['merge'](_0x1be9df[_0x2068('0x39')],{'$or':_[_0x2068('0x28')](_0x1be9df[_0x2068('0x31')],function(_0x309e90){var _0x3ca546={};_0x3ca546[_0x309e90]={'$like':'%'+_0x5d77ca[_0x2068('0x30')]['filter']+'%'};return _0x3ca546;})});}_0x1be9df=_[_0x2068('0x3a')]({},_0x1be9df,_0x5d77ca[_0x2068('0x45')]);return db[_0x2068('0x4d')][_0x2068('0x1c')]({'where':_0x1be9df[_0x2068('0x39')]})[_0x2068('0x23')](function(_0x195038){_0x4827b4[_0x2068('0x1c')]=_0x195038;if(_0x5d77ca['query'][_0x2068('0x3d')]){_0x1be9df['include']=[{'all':!![]}];}return db[_0x2068('0x4d')][_0x2068('0x3f')](_0x1be9df);})['then'](function(_0x5bf9fb){_0x4827b4[_0x2068('0x40')]=_0x5bf9fb;return _0x4827b4;});}})['then'](respondWithFilteredResult(_0x334f13,_0x1be9df))[_0x2068('0x41')](handleError(_0x334f13,null));}; \ No newline at end of file +var _0x7c5a=['query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','intersection','create','body','params','find','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','JscriptySessionReport','rawAttributes','type','key','model','map'];(function(_0xdf9d60,_0x319ccb){var _0x5db969=function(_0x1b745d){while(--_0x1b745d){_0xdf9d60['push'](_0xdf9d60['shift']());}};_0x5db969(++_0x319ccb);}(_0x7c5a,0x113));var _0xa7c5=function(_0x5468cb,_0x48de34){_0x5468cb=_0x5468cb-0x0;var _0x55430f=_0x7c5a[_0x5468cb];return _0x55430f;};'use strict';var emlformat=require(_0xa7c5('0x0'));var rimraf=require(_0xa7c5('0x1'));var zipdir=require(_0xa7c5('0x2'));var jsonpatch=require(_0xa7c5('0x3'));var rp=require(_0xa7c5('0x4'));var moment=require('moment');var BPromise=require(_0xa7c5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa7c5('0x6'));var csv=require('to-csv');var ejs=require(_0xa7c5('0x7'));var fs=require('fs');var fs_extra=require(_0xa7c5('0x8'));var _=require(_0xa7c5('0x9'));var squel=require(_0xa7c5('0xa'));var crypto=require(_0xa7c5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa7c5('0xc'));var toCsv=require(_0xa7c5('0xd'));var querystring=require(_0xa7c5('0xe'));var Papa=require(_0xa7c5('0xf'));var Redis=require(_0xa7c5('0x10'));var authService=require(_0xa7c5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa7c5('0x12'));var hardwareService=require(_0xa7c5('0x13'));var logger=require(_0xa7c5('0x14'))('api');var utils=require(_0xa7c5('0x15'));var config=require(_0xa7c5('0x16'));var licenseUtil=require(_0xa7c5('0x17'));var db=require(_0xa7c5('0x18'))['db'];function respondWithStatusCode(_0x4eec3c,_0x38a539){_0x38a539=_0x38a539||0xcc;return function(_0x26d4c8){if(_0x26d4c8){return _0x4eec3c['sendStatus'](_0x38a539);}return _0x4eec3c['status'](_0x38a539)[_0xa7c5('0x19')]();};}function respondWithResult(_0x5c8ac5,_0x25568d){_0x25568d=_0x25568d||0xc8;return function(_0x4d3e21){if(_0x4d3e21){return _0x5c8ac5[_0xa7c5('0x1a')](_0x25568d)[_0xa7c5('0x1b')](_0x4d3e21);}};}function respondWithFilteredResult(_0x2334b0,_0x40c2d9){return function(_0x4b407f){if(_0x4b407f){var _0x18d8cb=typeof _0x40c2d9['offset']===_0xa7c5('0x1c')&&typeof _0x40c2d9[_0xa7c5('0x1d')]===_0xa7c5('0x1c');var _0x4e9cc3=_0x4b407f[_0xa7c5('0x1e')];var _0x33fcdf=_0x18d8cb?0x0:_0x40c2d9[_0xa7c5('0x1f')];var _0x46d652=_0x18d8cb?_0x4b407f[_0xa7c5('0x1e')]:_0x40c2d9['offset']+_0x40c2d9[_0xa7c5('0x1d')];var _0x4248bc;if(_0x46d652>=_0x4e9cc3){_0x46d652=_0x4e9cc3;_0x4248bc=0xc8;}else{_0x4248bc=0xce;}_0x2334b0['status'](_0x4248bc);return _0x2334b0['set'](_0xa7c5('0x20'),_0x33fcdf+'-'+_0x46d652+'/'+_0x4e9cc3)[_0xa7c5('0x1b')](_0x4b407f);}return null;};}function patchUpdates(_0x22e16b){return function(_0x9df7c5){try{jsonpatch[_0xa7c5('0x21')](_0x9df7c5,_0x22e16b,!![]);}catch(_0x464b86){return BPromise[_0xa7c5('0x22')](_0x464b86);}return _0x9df7c5[_0xa7c5('0x23')]();};}function saveUpdates(_0x41aa34,_0x179e0f){return function(_0x55f68b){if(_0x55f68b){return _0x55f68b[_0xa7c5('0x24')](_0x41aa34)[_0xa7c5('0x25')](function(_0x55fd11){return _0x55fd11;});}return null;};}function removeEntity(_0x112be2,_0x46a5fa){return function(_0x2d2d73){if(_0x2d2d73){return _0x2d2d73[_0xa7c5('0x26')]()[_0xa7c5('0x25')](function(){_0x112be2[_0xa7c5('0x1a')](0xcc)[_0xa7c5('0x19')]();});}};}function handleEntityNotFound(_0x3476dd,_0x492235){return function(_0x1a6e25){if(!_0x1a6e25){_0x3476dd['sendStatus'](0x194);}return _0x1a6e25;};}function handleError(_0x58a23b,_0x46b697){_0x46b697=_0x46b697||0x1f4;return function(_0x43a778){logger['error'](_0x43a778[_0xa7c5('0x27')]);if(_0x43a778[_0xa7c5('0x28')]){delete _0x43a778[_0xa7c5('0x28')];}_0x58a23b['status'](_0x46b697)[_0xa7c5('0x29')](_0x43a778);};}exports[_0xa7c5('0x2a')]=function(_0x54d5c5,_0x4fb84f){var _0x42796c={},_0x1f29dc={},_0x4a639a={'count':0x0,'rows':[]};var _0x415d69=_['map'](db[_0xa7c5('0x2b')][_0xa7c5('0x2c')],function(_0x4ae251){return{'name':_0x4ae251['fieldName'],'type':_0x4ae251[_0xa7c5('0x2d')][_0xa7c5('0x2e')]};});_0x1f29dc[_0xa7c5('0x2f')]=_[_0xa7c5('0x30')](_0x415d69,_0xa7c5('0x28'));_0x1f29dc[_0xa7c5('0x31')]=_[_0xa7c5('0x32')](_0x54d5c5['query']);_0x1f29dc[_0xa7c5('0x33')]=_['intersection'](_0x1f29dc['model'],_0x1f29dc[_0xa7c5('0x31')]);_0x42796c[_0xa7c5('0x34')]=_['intersection'](_0x1f29dc['model'],qs[_0xa7c5('0x35')](_0x54d5c5[_0xa7c5('0x31')]['fields']));_0x42796c['attributes']=_0x42796c[_0xa7c5('0x34')][_0xa7c5('0x36')]?_0x42796c[_0xa7c5('0x34')]:_0x1f29dc[_0xa7c5('0x2f')];if(!_0x54d5c5[_0xa7c5('0x31')][_0xa7c5('0x37')](_0xa7c5('0x38'))){_0x42796c['limit']=qs[_0xa7c5('0x1d')](_0x54d5c5['query']['limit']);_0x42796c[_0xa7c5('0x1f')]=qs[_0xa7c5('0x1f')](_0x54d5c5['query'][_0xa7c5('0x1f')]);}_0x42796c[_0xa7c5('0x39')]=qs['sort'](_0x54d5c5[_0xa7c5('0x31')][_0xa7c5('0x3a')]);_0x42796c[_0xa7c5('0x3b')]=qs[_0xa7c5('0x33')](_['pick'](_0x54d5c5[_0xa7c5('0x31')],_0x1f29dc['filters']),_0x415d69);if(_0x54d5c5[_0xa7c5('0x31')][_0xa7c5('0x3c')]){_0x42796c['where']=_['merge'](_0x42796c[_0xa7c5('0x3b')],{'$or':_[_0xa7c5('0x30')](_0x415d69,function(_0x3dbb53){if(_0x3dbb53[_0xa7c5('0x2d')]!==_0xa7c5('0x3d')){var _0x37edcc={};_0x37edcc[_0x3dbb53[_0xa7c5('0x28')]]={'$like':'%'+_0x54d5c5[_0xa7c5('0x31')][_0xa7c5('0x3c')]+'%'};return _0x37edcc;}})});}_0x42796c=_[_0xa7c5('0x3e')]({},_0x42796c,_0x54d5c5[_0xa7c5('0x3f')]);var _0xf2842a={'where':_0x42796c[_0xa7c5('0x3b')]};return db['JscriptySessionReport']['count'](_0xf2842a)[_0xa7c5('0x25')](function(_0x441e19){_0x4a639a[_0xa7c5('0x1e')]=_0x441e19;if(_0x54d5c5[_0xa7c5('0x31')][_0xa7c5('0x40')]){_0x42796c[_0xa7c5('0x41')]=[{'all':!![]}];}return db[_0xa7c5('0x2b')][_0xa7c5('0x42')](_0x42796c);})[_0xa7c5('0x25')](function(_0x17ab48){_0x4a639a[_0xa7c5('0x43')]=_0x17ab48;return _0x4a639a;})[_0xa7c5('0x25')](respondWithFilteredResult(_0x4fb84f,_0x42796c))[_0xa7c5('0x44')](handleError(_0x4fb84f,null));};exports[_0xa7c5('0x45')]=function(_0x2b2791,_0x1501e1){var _0x3c247a={'raw':!![],'where':{'id':_0x2b2791['params']['id']}},_0x3828d9={};_0x3828d9[_0xa7c5('0x2f')]=_[_0xa7c5('0x32')](db[_0xa7c5('0x2b')][_0xa7c5('0x2c')]);_0x3828d9[_0xa7c5('0x31')]=_['keys'](_0x2b2791[_0xa7c5('0x31')]);_0x3828d9[_0xa7c5('0x33')]=_[_0xa7c5('0x46')](_0x3828d9['model'],_0x3828d9[_0xa7c5('0x31')]);_0x3c247a[_0xa7c5('0x34')]=_['intersection'](_0x3828d9['model'],qs['fields'](_0x2b2791[_0xa7c5('0x31')][_0xa7c5('0x35')]));_0x3c247a[_0xa7c5('0x34')]=_0x3c247a[_0xa7c5('0x34')][_0xa7c5('0x36')]?_0x3c247a[_0xa7c5('0x34')]:_0x3828d9[_0xa7c5('0x2f')];if(_0x2b2791[_0xa7c5('0x31')][_0xa7c5('0x40')]){_0x3c247a['include']=[{'all':!![]}];}_0x3c247a=_['merge']({},_0x3c247a,_0x2b2791[_0xa7c5('0x3f')]);return db[_0xa7c5('0x2b')]['find'](_0x3c247a)[_0xa7c5('0x25')](handleEntityNotFound(_0x1501e1,null))[_0xa7c5('0x25')](respondWithResult(_0x1501e1,null))[_0xa7c5('0x44')](handleError(_0x1501e1,null));};exports[_0xa7c5('0x47')]=function(_0xcb616,_0x3ead6f){return db[_0xa7c5('0x2b')][_0xa7c5('0x47')](_0xcb616[_0xa7c5('0x48')],{})['then'](respondWithResult(_0x3ead6f,0xc9))[_0xa7c5('0x44')](handleError(_0x3ead6f,null));};exports[_0xa7c5('0x24')]=function(_0x1f14e1,_0x3ed99a){if(_0x1f14e1['body']['id']){delete _0x1f14e1[_0xa7c5('0x48')]['id'];}return db[_0xa7c5('0x2b')]['find']({'where':{'id':_0x1f14e1[_0xa7c5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ed99a,null))[_0xa7c5('0x25')](saveUpdates(_0x1f14e1['body'],null))[_0xa7c5('0x25')](respondWithResult(_0x3ed99a,null))[_0xa7c5('0x44')](handleError(_0x3ed99a,null));};exports[_0xa7c5('0x26')]=function(_0x4dbf44,_0x1351ae){return db[_0xa7c5('0x2b')][_0xa7c5('0x4a')]({'where':{'id':_0x4dbf44['params']['id']}})['then'](handleEntityNotFound(_0x1351ae,null))[_0xa7c5('0x25')](removeEntity(_0x1351ae,null))[_0xa7c5('0x44')](handleError(_0x1351ae,null));};exports['describe']=function(_0x4f03a1,_0x44e668){return db[_0xa7c5('0x2b')][_0xa7c5('0x4b')]()[_0xa7c5('0x25')](respondWithResult(_0x44e668,null))[_0xa7c5('0x44')](handleError(_0x44e668,null));};exports[_0xa7c5('0x4c')]=function(_0x52c804,_0x3be561,_0x5f5191){var _0x46eb03={'raw':!![],'where':{}};var _0x31b76e={};var _0x56f4e6={'count':0x0,'rows':[]};return db[_0xa7c5('0x2b')][_0xa7c5('0x4d')]({'where':{'id':_0x52c804[_0xa7c5('0x49')]['id']}})[_0xa7c5('0x25')](handleEntityNotFound(_0x3be561,null))['then'](function(_0x3f9a3f){if(_0x3f9a3f){_0x31b76e[_0xa7c5('0x2f')]=_[_0xa7c5('0x32')](db[_0xa7c5('0x4e')][_0xa7c5('0x2c')]);_0x31b76e[_0xa7c5('0x31')]=_['keys'](_0x52c804[_0xa7c5('0x31')]);_0x31b76e[_0xa7c5('0x33')]=_[_0xa7c5('0x46')](_0x31b76e[_0xa7c5('0x2f')],_0x31b76e[_0xa7c5('0x31')]);_0x46eb03[_0xa7c5('0x34')]=_[_0xa7c5('0x46')](_0x31b76e[_0xa7c5('0x2f')],qs[_0xa7c5('0x35')](_0x52c804['query'][_0xa7c5('0x35')]));_0x46eb03[_0xa7c5('0x34')]=_0x46eb03[_0xa7c5('0x34')][_0xa7c5('0x36')]?_0x46eb03[_0xa7c5('0x34')]:_0x31b76e[_0xa7c5('0x2f')];if(!_0x52c804[_0xa7c5('0x31')][_0xa7c5('0x37')](_0xa7c5('0x38'))){_0x46eb03[_0xa7c5('0x1d')]=qs['limit'](_0x52c804[_0xa7c5('0x31')][_0xa7c5('0x1d')]);_0x46eb03['offset']=qs[_0xa7c5('0x1f')](_0x52c804[_0xa7c5('0x31')][_0xa7c5('0x1f')]);}_0x46eb03['order']=qs[_0xa7c5('0x3a')](_0x52c804[_0xa7c5('0x31')]['sort']);_0x46eb03['where']=qs[_0xa7c5('0x33')](_[_0xa7c5('0x4f')](_0x52c804[_0xa7c5('0x31')],_0x31b76e[_0xa7c5('0x33')]));_0x46eb03['where'][_0xa7c5('0x50')]=_0x3f9a3f['id'];if(_0x52c804[_0xa7c5('0x31')]['filter']){_0x46eb03[_0xa7c5('0x3b')]=_['merge'](_0x46eb03[_0xa7c5('0x3b')],{'$or':_['map'](_0x46eb03[_0xa7c5('0x34')],function(_0x2c0dbe){var _0x30b616={};_0x30b616[_0x2c0dbe]={'$like':'%'+_0x52c804[_0xa7c5('0x31')]['filter']+'%'};return _0x30b616;})});}_0x46eb03=_[_0xa7c5('0x3e')]({},_0x46eb03,_0x52c804[_0xa7c5('0x3f')]);return db[_0xa7c5('0x4e')]['count']({'where':_0x46eb03[_0xa7c5('0x3b')]})[_0xa7c5('0x25')](function(_0x5e0fe8){_0x56f4e6[_0xa7c5('0x1e')]=_0x5e0fe8;if(_0x52c804[_0xa7c5('0x31')][_0xa7c5('0x40')]){_0x46eb03[_0xa7c5('0x41')]=[{'all':!![]}];}return db[_0xa7c5('0x4e')]['findAll'](_0x46eb03);})[_0xa7c5('0x25')](function(_0xa1a389){_0x56f4e6[_0xa7c5('0x43')]=_0xa1a389;return _0x56f4e6;});}})[_0xa7c5('0x25')](respondWithFilteredResult(_0x3be561,_0x46eb03))['catch'](handleError(_0x3be561,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 78a14e2..a2d8d0c 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x5214ee,_0x254d0a){var _0x320377=function(_0x58c4f2){while(--_0x58c4f2){_0x5214ee['push'](_0x5214ee['shift']());}};_0x320377(++_0x254d0a);}(_0x5fab,0x177));var _0xb5fa=function(_0x1c1780,_0x93cb2){_0x1c1780=_0x1c1780-0x0;var _0x5eb4ae=_0x5fab[_0x1c1780];return _0x5eb4ae;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment'];(function(_0x10c681,_0x3ae83b){var _0x34dfc6=function(_0x42a60f){while(--_0x42a60f){_0x10c681['push'](_0x10c681['shift']());}};_0x34dfc6(++_0x3ae83b);}(_0xba34,0x119));var _0x4ba3=function(_0x142c83,_0x4ba9ee){_0x142c83=_0x142c83-0x0;var _0x43d5a5=_0xba34[_0x142c83];return _0x43d5a5;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e531b5b..b526b8f 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 _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3c7a2b,_0x5c6d45){var _0x4a904a=function(_0x26a9ab){while(--_0x26a9ab){_0x3c7a2b['push'](_0x3c7a2b['shift']());}};_0x4a904a(++_0x5c6d45);}(_0x5496,0x175));var _0x6549=function(_0x509ef8,_0x746c25){_0x509ef8=_0x509ef8-0x0;var _0x167bf8=_0x5496[_0x509ef8];return _0x167bf8;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file +var _0x0adf=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x3c98c1,_0x524e3c){var _0x45c21b=function(_0x1f8dd0){while(--_0x1f8dd0){_0x3c98c1['push'](_0x3c98c1['shift']());}};_0x45c21b(++_0x524e3c);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x570b98,_0x2642ff){_0x570b98=_0x570b98-0x0;var _0x389de3=_0x0adf[_0x570b98];return _0x389de3;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7bc8be8..f1d8f8e 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 _0x173c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports'];(function(_0x991ba1,_0x303a98){var _0x2615cf=function(_0x56a59c){while(--_0x56a59c){_0x991ba1['push'](_0x991ba1['shift']());}};_0x2615cf(++_0x303a98);}(_0x173c,0x156));var _0xc173=function(_0x4cb659,_0x5df82b){_0x4cb659=_0x4cb659-0x0;var _0x1d36ac=_0x173c[_0x4cb659];return _0x1d36ac;};'use strict';var multer=require(_0xc173('0x0'));var util=require(_0xc173('0x1'));var path=require(_0xc173('0x2'));var timeout=require(_0xc173('0x3'));var express=require(_0xc173('0x4'));var router=express[_0xc173('0x5')]();var fs_extra=require(_0xc173('0x6'));var auth=require(_0xc173('0x7'));var interaction=require(_0xc173('0x8'));var config=require(_0xc173('0x9'));var controller=require(_0xc173('0xa'));router[_0xc173('0xb')]('/',controller['index']);router[_0xc173('0xc')](_0xc173('0xd'),auth[_0xc173('0xe')](),controller[_0xc173('0xf')]);router['get'](_0xc173('0x10'),auth[_0xc173('0xe')](),controller[_0xc173('0x11')]);module[_0xc173('0x12')]=router; \ No newline at end of file +var _0x02f4=['isAuthenticated','get','/download_log_file','downloadLogFile','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id'];(function(_0x2c4d74,_0x55cc88){var _0x4be600=function(_0x1aefac){while(--_0x1aefac){_0x2c4d74['push'](_0x2c4d74['shift']());}};_0x4be600(++_0x55cc88);}(_0x02f4,0x65));var _0x402f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x02f4[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x402f('0x0'));var timeout=require(_0x402f('0x1'));var express=require('express');var router=express[_0x402f('0x2')]();var fs_extra=require(_0x402f('0x3'));var auth=require(_0x402f('0x4'));var interaction=require(_0x402f('0x5'));var config=require(_0x402f('0x6'));var controller=require(_0x402f('0x7'));router['get']('/',controller[_0x402f('0x8')]);router[_0x402f('0x9')](_0x402f('0xa'),auth[_0x402f('0xb')](),controller['update']);router[_0x402f('0xc')](_0x402f('0xd'),auth[_0x402f('0xb')](),controller[_0x402f('0xe')]);module[_0x402f('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index eafd541..5c4412d 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 _0x266e=['sequelize','exports','TEXT','STRING'];(function(_0x35af5d,_0x2da3cd){var _0x3468be=function(_0xc37fbc){while(--_0xc37fbc){_0x35af5d['push'](_0x35af5d['shift']());}};_0x3468be(++_0x2da3cd);}(_0x266e,0xdc));var _0xe266=function(_0x24924e,_0x47231f){_0x24924e=_0x24924e-0x0;var _0x4c3b07=_0x266e[_0x24924e];return _0x4c3b07;};'use strict';var Sequelize=require(_0xe266('0x0'));module[_0xe266('0x1')]={'license':{'type':Sequelize[_0xe266('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe266('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2950=['exports','STRING','INTEGER','sequelize'];(function(_0x3e45a6,_0x576195){var _0x4751f7=function(_0x14d175){while(--_0x14d175){_0x3e45a6['push'](_0x3e45a6['shift']());}};_0x4751f7(++_0x576195);}(_0x2950,0x1ab));var _0x0295=function(_0x5c3eff,_0x8d9ad0){_0x5c3eff=_0x5c3eff-0x0;var _0x9dd60b=_0x2950[_0x5c3eff];return _0x9dd60b;};'use strict';var Sequelize=require(_0x0295('0x0'));module[_0x0295('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x0295('0x2')]},'data2':{'type':Sequelize[_0x0295('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x0295('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 5008f53..4b7d9e3 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 _0x6056=['join','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','offset','undefined','count','limit','status','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','model','keys','License','rawAttributes','filters','query','attributes','intersection','fields','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','downloadLogFile','license-info.log'];(function(_0x5c11fc,_0x43eb53){var _0x38746c=function(_0x478e89){while(--_0x478e89){_0x5c11fc['push'](_0x5c11fc['shift']());}};_0x38746c(++_0x43eb53);}(_0x6056,0xa4));var _0x6605=function(_0x58061a,_0x59fa83){_0x58061a=_0x58061a-0x0;var _0x1e0606=_0x6056[_0x58061a];return _0x1e0606;};'use strict';var emlformat=require(_0x6605('0x0'));var rimraf=require(_0x6605('0x1'));var zipdir=require(_0x6605('0x2'));var jsonpatch=require(_0x6605('0x3'));var rp=require(_0x6605('0x4'));var moment=require('moment');var BPromise=require(_0x6605('0x5'));var Mustache=require(_0x6605('0x6'));var util=require(_0x6605('0x7'));var path=require(_0x6605('0x8'));var sox=require(_0x6605('0x9'));var csv=require(_0x6605('0xa'));var ejs=require(_0x6605('0xb'));var fs=require('fs');var fs_extra=require(_0x6605('0xc'));var _=require(_0x6605('0xd'));var squel=require(_0x6605('0xe'));var crypto=require(_0x6605('0xf'));var jsforce=require(_0x6605('0x10'));var deskjs=require(_0x6605('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6605('0x12'));var Redis=require(_0x6605('0x13'));var authService=require(_0x6605('0x14'));var qs=require(_0x6605('0x15'));var as=require(_0x6605('0x16'));var hardwareService=require(_0x6605('0x17'));var logger=require(_0x6605('0x18'))(_0x6605('0x19'));var utils=require(_0x6605('0x1a'));var config=require(_0x6605('0x1b'));var licenseUtil=require(_0x6605('0x1c'));var db=require(_0x6605('0x1d'))['db'];function respondWithStatusCode(_0x1d5e67,_0x35eb4b){_0x35eb4b=_0x35eb4b||0xcc;return function(_0x500581){if(_0x500581){return _0x1d5e67['sendStatus'](_0x35eb4b);}return _0x1d5e67['status'](_0x35eb4b)['end']();};}function respondWithResult(_0x98110f,_0x3cb946){_0x3cb946=_0x3cb946||0xc8;return function(_0x314d00){if(_0x314d00){return _0x98110f['status'](_0x3cb946)['json'](_0x314d00);}};}function respondWithFilteredResult(_0x38ed0b,_0x5140cc){return function(_0x2737d4){if(_0x2737d4){var _0x2c9098=typeof _0x5140cc[_0x6605('0x1e')]==='undefined'&&typeof _0x5140cc['limit']===_0x6605('0x1f');var _0x6e37c7=_0x2737d4[_0x6605('0x20')];var _0x4c0709=_0x2c9098?0x0:_0x5140cc['offset'];var _0xc9c26d=_0x2c9098?_0x2737d4['count']:_0x5140cc['offset']+_0x5140cc[_0x6605('0x21')];var _0x2918c8;if(_0xc9c26d>=_0x6e37c7){_0xc9c26d=_0x6e37c7;_0x2918c8=0xc8;}else{_0x2918c8=0xce;}_0x38ed0b[_0x6605('0x22')](_0x2918c8);return _0x38ed0b['set'](_0x6605('0x23'),_0x4c0709+'-'+_0xc9c26d+'/'+_0x6e37c7)[_0x6605('0x24')](_0x2737d4);}return null;};}function patchUpdates(_0x56c529){return function(_0x3332d7){try{jsonpatch[_0x6605('0x25')](_0x3332d7,_0x56c529,!![]);}catch(_0x440bcc){return BPromise[_0x6605('0x26')](_0x440bcc);}return _0x3332d7[_0x6605('0x27')]();};}function saveUpdates(_0x59c2b2,_0x363019){return function(_0x5e5e24){if(_0x5e5e24){return _0x5e5e24[_0x6605('0x28')](_0x59c2b2)[_0x6605('0x29')](function(_0x2af611){return _0x2af611;});}return null;};}function removeEntity(_0x4dd847,_0x2adf9a){return function(_0x3170f2){if(_0x3170f2){return _0x3170f2[_0x6605('0x2a')]()[_0x6605('0x29')](function(){_0x4dd847['status'](0xcc)[_0x6605('0x2b')]();});}};}function handleEntityNotFound(_0x19aadf,_0x29e7d6){return function(_0x17ff86){if(!_0x17ff86){_0x19aadf[_0x6605('0x2c')](0x194);}return _0x17ff86;};}function handleError(_0x4de133,_0x12cd49){_0x12cd49=_0x12cd49||0x1f4;return function(_0x59d261){logger[_0x6605('0x2d')](_0x59d261[_0x6605('0x2e')]);if(_0x59d261[_0x6605('0x2f')]){delete _0x59d261[_0x6605('0x2f')];}_0x4de133['status'](_0x12cd49)[_0x6605('0x30')](_0x59d261);};}var utilLicense=require(_0x6605('0x1c'));exports['index']=function(_0x44741f,_0x4bd8cf){var _0x5d59f7={'raw':!![],'where':{'id':0x1}},_0x2e5c11={};_0x2e5c11[_0x6605('0x31')]=_[_0x6605('0x32')](db[_0x6605('0x33')][_0x6605('0x34')]);_0x2e5c11['query']=_[_0x6605('0x32')](_0x44741f['query']);_0x2e5c11[_0x6605('0x35')]=_['intersection'](_0x2e5c11[_0x6605('0x31')],_0x2e5c11[_0x6605('0x36')]);_0x5d59f7[_0x6605('0x37')]=_[_0x6605('0x38')](_0x2e5c11['model'],qs[_0x6605('0x39')](_0x44741f[_0x6605('0x36')][_0x6605('0x39')]));_0x5d59f7[_0x6605('0x37')]=_0x5d59f7[_0x6605('0x37')]['length']?_0x5d59f7[_0x6605('0x37')]:_0x2e5c11[_0x6605('0x31')];_0x5d59f7=_[_0x6605('0x3a')]({},_0x5d59f7,_0x44741f[_0x6605('0x3b')]);return utilLicense[_0x6605('0x3c')](_0x5d59f7)['then'](respondWithResult(_0x4bd8cf,null))[_0x6605('0x3d')](handleError(_0x4bd8cf,null));};exports['update']=function(_0x3af4b3,_0x31bfd2){if(_0x3af4b3[_0x6605('0x3e')]['id']){delete _0x3af4b3[_0x6605('0x3e')]['id'];}return db[_0x6605('0x33')][_0x6605('0x3f')]({'where':{'id':_0x3af4b3[_0x6605('0x40')]['id']}})[_0x6605('0x29')](handleEntityNotFound(_0x31bfd2,null))['then'](function(_0x2ab257){var _0x586aa0=_0x2ab257['get']({'plain':!![]});return utilLicense[_0x6605('0x41')](_0x586aa0,_0x3af4b3[_0x6605('0x3e')][_0x6605('0x42')]);})['then'](function(_0x2cc751){if(!_0x2cc751[_0x6605('0x43')]){return saveUpdates(_0x3af4b3['body'],null);}return _0x2cc751;})[_0x6605('0x29')](respondWithResult(_0x31bfd2,null))[_0x6605('0x3d')](handleError(_0x31bfd2,null));};exports[_0x6605('0x44')]=function(_0x1f1653,_0x51fbbe){var _0x3541c0=_0x6605('0x45');var _0x4c4330=path[_0x6605('0x46')]('/var','log',_0x6605('0x47'),_0x3541c0);_0x51fbbe['setHeader'](_0x6605('0x48'),_0x6605('0x49')+_0x3541c0);_0x51fbbe[_0x6605('0x4a')](_0x6605('0x4b'),_0x6605('0x4c'));_0x51fbbe[_0x6605('0x4d')](_0x4c4330);}; \ No newline at end of file +var _0x4402=['attachment;\x20filename=','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','model','keys','License','rawAttributes','intersection','attributes','fields','query','length','options','getLicense','catch','body','params','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','setHeader'];(function(_0x43bd62,_0x107420){var _0x22321c=function(_0x5ed92c){while(--_0x5ed92c){_0x43bd62['push'](_0x43bd62['shift']());}};_0x22321c(++_0x107420);}(_0x4402,0x162));var _0x2440=function(_0x411511,_0x13b21a){_0x411511=_0x411511-0x0;var _0xda7b33=_0x4402[_0x411511];return _0xda7b33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2440('0x0'));var zipdir=require(_0x2440('0x1'));var jsonpatch=require(_0x2440('0x2'));var rp=require(_0x2440('0x3'));var moment=require(_0x2440('0x4'));var BPromise=require(_0x2440('0x5'));var Mustache=require('mustache');var util=require(_0x2440('0x6'));var path=require('path');var sox=require(_0x2440('0x7'));var csv=require('to-csv');var ejs=require(_0x2440('0x8'));var fs=require('fs');var fs_extra=require(_0x2440('0x9'));var _=require('lodash');var squel=require(_0x2440('0xa'));var crypto=require('crypto');var jsforce=require(_0x2440('0xb'));var deskjs=require(_0x2440('0xc'));var toCsv=require(_0x2440('0xd'));var querystring=require(_0x2440('0xe'));var Papa=require('papaparse');var Redis=require(_0x2440('0xf'));var authService=require(_0x2440('0x10'));var qs=require(_0x2440('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2440('0x12'));var logger=require(_0x2440('0x13'))(_0x2440('0x14'));var utils=require(_0x2440('0x15'));var config=require(_0x2440('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2440('0x17'))['db'];function respondWithStatusCode(_0x407a18,_0x994383){_0x994383=_0x994383||0xcc;return function(_0x275f10){if(_0x275f10){return _0x407a18[_0x2440('0x18')](_0x994383);}return _0x407a18[_0x2440('0x19')](_0x994383)[_0x2440('0x1a')]();};}function respondWithResult(_0x95390d,_0x207f8a){_0x207f8a=_0x207f8a||0xc8;return function(_0x334fee){if(_0x334fee){return _0x95390d[_0x2440('0x19')](_0x207f8a)[_0x2440('0x1b')](_0x334fee);}};}function respondWithFilteredResult(_0x3ca3d1,_0x429efc){return function(_0x310134){if(_0x310134){var _0x9bbd10=typeof _0x429efc[_0x2440('0x1c')]==='undefined'&&typeof _0x429efc[_0x2440('0x1d')]==='undefined';var _0x5ed734=_0x310134[_0x2440('0x1e')];var _0x684cef=_0x9bbd10?0x0:_0x429efc[_0x2440('0x1c')];var _0x377a30=_0x9bbd10?_0x310134[_0x2440('0x1e')]:_0x429efc[_0x2440('0x1c')]+_0x429efc['limit'];var _0x4c0bbc;if(_0x377a30>=_0x5ed734){_0x377a30=_0x5ed734;_0x4c0bbc=0xc8;}else{_0x4c0bbc=0xce;}_0x3ca3d1[_0x2440('0x19')](_0x4c0bbc);return _0x3ca3d1[_0x2440('0x1f')](_0x2440('0x20'),_0x684cef+'-'+_0x377a30+'/'+_0x5ed734)[_0x2440('0x1b')](_0x310134);}return null;};}function patchUpdates(_0x49a6bd){return function(_0x7e2c36){try{jsonpatch[_0x2440('0x21')](_0x7e2c36,_0x49a6bd,!![]);}catch(_0x34081a){return BPromise[_0x2440('0x22')](_0x34081a);}return _0x7e2c36[_0x2440('0x23')]();};}function saveUpdates(_0x51cc6a,_0x5421c0){return function(_0x14dd45){if(_0x14dd45){return _0x14dd45[_0x2440('0x24')](_0x51cc6a)['then'](function(_0xa92b56){return _0xa92b56;});}return null;};}function removeEntity(_0x2ccb9e,_0x4b539e){return function(_0xd168cd){if(_0xd168cd){return _0xd168cd[_0x2440('0x25')]()[_0x2440('0x26')](function(){_0x2ccb9e[_0x2440('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e11cd,_0x583d4f){return function(_0x1a0bcf){if(!_0x1a0bcf){_0x4e11cd[_0x2440('0x18')](0x194);}return _0x1a0bcf;};}function handleError(_0x59a745,_0x328757){_0x328757=_0x328757||0x1f4;return function(_0x1b02c5){logger[_0x2440('0x27')](_0x1b02c5[_0x2440('0x28')]);if(_0x1b02c5[_0x2440('0x29')]){delete _0x1b02c5[_0x2440('0x29')];}_0x59a745[_0x2440('0x19')](_0x328757)[_0x2440('0x2a')](_0x1b02c5);};}var utilLicense=require('../../config/license/util');exports[_0x2440('0x2b')]=function(_0x562c5b,_0x1c898d){var _0xc7c35d={'raw':!![],'where':{'id':0x1}},_0x39b54c={};_0x39b54c[_0x2440('0x2c')]=_[_0x2440('0x2d')](db[_0x2440('0x2e')][_0x2440('0x2f')]);_0x39b54c['query']=_[_0x2440('0x2d')](_0x562c5b['query']);_0x39b54c['filters']=_[_0x2440('0x30')](_0x39b54c[_0x2440('0x2c')],_0x39b54c['query']);_0xc7c35d[_0x2440('0x31')]=_['intersection'](_0x39b54c['model'],qs[_0x2440('0x32')](_0x562c5b[_0x2440('0x33')][_0x2440('0x32')]));_0xc7c35d[_0x2440('0x31')]=_0xc7c35d['attributes'][_0x2440('0x34')]?_0xc7c35d[_0x2440('0x31')]:_0x39b54c[_0x2440('0x2c')];_0xc7c35d=_['merge']({},_0xc7c35d,_0x562c5b[_0x2440('0x35')]);return utilLicense[_0x2440('0x36')](_0xc7c35d)[_0x2440('0x26')](respondWithResult(_0x1c898d,null))[_0x2440('0x37')](handleError(_0x1c898d,null));};exports['update']=function(_0x544b69,_0x221a51){if(_0x544b69[_0x2440('0x38')]['id']){delete _0x544b69[_0x2440('0x38')]['id'];}return db[_0x2440('0x2e')]['find']({'where':{'id':_0x544b69[_0x2440('0x39')]['id']}})[_0x2440('0x26')](handleEntityNotFound(_0x221a51,null))['then'](function(_0x41a9fd){var _0x551df6=_0x41a9fd['get']({'plain':!![]});return utilLicense[_0x2440('0x3a')](_0x551df6,_0x544b69[_0x2440('0x38')][_0x2440('0x3b')]);})[_0x2440('0x26')](function(_0x55eb0b){if(!_0x55eb0b[_0x2440('0x3c')]){return saveUpdates(_0x544b69[_0x2440('0x38')],null);}return _0x55eb0b;})[_0x2440('0x26')](respondWithResult(_0x221a51,null))[_0x2440('0x37')](handleError(_0x221a51,null));};exports[_0x2440('0x3d')]=function(_0x5c2404,_0x2f9413){var _0x341d17=_0x2440('0x3e');var _0x1c74a5=path[_0x2440('0x3f')](_0x2440('0x40'),'log','xcally',_0x341d17);_0x2f9413[_0x2440('0x41')]('Content-disposition',_0x2440('0x42')+_0x341d17);_0x2f9413[_0x2440('0x1f')](_0x2440('0x43'),_0x2440('0x44'));_0x2f9413[_0x2440('0x45')](_0x1c74a5);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b561dcb..4cd70c4 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 _0xc408=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc408,0x1c2));var _0x8c40=function(_0x37b533,_0x158817){_0x37b533=_0x37b533-0x0;var _0x30b75a=_0xc408[_0x37b533];return _0x30b75a;};'use strict';var _=require(_0x8c40('0x0'));var util=require('util');var logger=require(_0x8c40('0x1'))(_0x8c40('0x2'));var moment=require('moment');var BPromise=require(_0x8c40('0x3'));var rp=require(_0x8c40('0x4'));var fs=require('fs');var path=require(_0x8c40('0x5'));var rimraf=require(_0x8c40('0x6'));var config=require(_0x8c40('0x7'));var attributes=require('./license.attributes');module['exports']=function(_0x2309b8,_0x3e8adb){return _0x2309b8[_0x8c40('0x8')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x903d=['moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','../../config/logger','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x903d,0xf4));var _0xd903=function(_0x114be8,_0x3cb75a){_0x114be8=_0x114be8-0x0;var _0x22256c=_0x903d[_0x114be8];return _0x22256c;};'use strict';var _=require(_0xd903('0x0'));var util=require('util');var logger=require(_0xd903('0x1'))(_0xd903('0x2'));var moment=require(_0xd903('0x3'));var BPromise=require(_0xd903('0x4'));var rp=require(_0xd903('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd903('0x6'));var config=require(_0xd903('0x7'));var attributes=require(_0xd903('0x8'));module[_0xd903('0x9')]=function(_0x377a75,_0x216e5d){return _0x377a75[_0xd903('0xa')](_0xd903('0xb'),attributes,{'tableName':_0xd903('0xc'),'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 a573c14..baddc8d 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 _0x6667=['jayson/promise','then','info','request\x20sent','debug','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xae8bb5,_0x2dc308){var _0x5930ba=function(_0x6f0e83){while(--_0x6f0e83){_0xae8bb5['push'](_0xae8bb5['shift']());}};_0x5930ba(++_0x2dc308);}(_0x6667,0x75));var _0x7666=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x6667[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x7666('0x0'));var util=require(_0x7666('0x1'));var moment=require(_0x7666('0x2'));var BPromise=require(_0x7666('0x3'));var rs=require(_0x7666('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7666('0x5'))['db'];var utils=require(_0x7666('0x6'));var logger=require(_0x7666('0x7'))(_0x7666('0x8'));var config=require('../../config/environment');var jayson=require(_0x7666('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x954887,_0x2d9fc9,_0x4cdfd6){return new BPromise(function(_0x5d0ca9,_0x47b33d){return client['request'](_0x954887,_0x4cdfd6)[_0x7666('0xa')](function(_0x513c67){logger[_0x7666('0xb')]('License,\x20%s,\x20%s',_0x2d9fc9,_0x7666('0xc'));logger[_0x7666('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x2d9fc9,_0x7666('0xc'),JSON[_0x7666('0xe')](_0x513c67));if(_0x513c67[_0x7666('0xf')]){if(_0x513c67[_0x7666('0xf')][_0x7666('0x10')]===0x1f4){logger['error'](_0x7666('0x11'),_0x2d9fc9,_0x513c67[_0x7666('0xf')][_0x7666('0x12')]);return _0x47b33d(_0x513c67[_0x7666('0xf')][_0x7666('0x12')]);}logger[_0x7666('0xf')](_0x7666('0x11'),_0x2d9fc9,_0x513c67['error'][_0x7666('0x12')]);return _0x5d0ca9(_0x513c67['error'][_0x7666('0x12')]);}else{logger[_0x7666('0xb')](_0x7666('0x11'),_0x2d9fc9,'request\x20sent');_0x5d0ca9(_0x513c67[_0x7666('0x13')]['message']);}})[_0x7666('0x14')](function(_0x1a7967){logger['error'](_0x7666('0x11'),_0x2d9fc9,_0x1a7967);_0x47b33d(_0x1a7967);});});} \ No newline at end of file +var _0x2209=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2209,0x155));var _0x9220=function(_0x593428,_0x53596e){_0x593428=_0x593428-0x0;var _0x88b32f=_0x2209[_0x593428];return _0x88b32f;};'use strict';var _=require(_0x9220('0x0'));var util=require(_0x9220('0x1'));var moment=require(_0x9220('0x2'));var BPromise=require(_0x9220('0x3'));var rs=require(_0x9220('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9220('0x5'))('rpc');var config=require(_0x9220('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9220('0x7')][_0x9220('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x185061,_0x280abb,_0x26d584){return new BPromise(function(_0x2b62ad,_0xd48ae1){return client[_0x9220('0x9')](_0x185061,_0x26d584)[_0x9220('0xa')](function(_0x35268f){logger[_0x9220('0xb')](_0x9220('0xc'),_0x280abb,_0x9220('0xd'));logger[_0x9220('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x280abb,_0x9220('0xd'),JSON[_0x9220('0xf')](_0x35268f));if(_0x35268f[_0x9220('0x10')]){if(_0x35268f[_0x9220('0x10')][_0x9220('0x11')]===0x1f4){logger[_0x9220('0x10')](_0x9220('0xc'),_0x280abb,_0x35268f[_0x9220('0x10')]['message']);return _0xd48ae1(_0x35268f[_0x9220('0x10')][_0x9220('0x12')]);}logger[_0x9220('0x10')](_0x9220('0xc'),_0x280abb,_0x35268f[_0x9220('0x10')][_0x9220('0x12')]);return _0x2b62ad(_0x35268f[_0x9220('0x10')][_0x9220('0x12')]);}else{logger[_0x9220('0xb')]('License,\x20%s,\x20%s',_0x280abb,_0x9220('0xd'));_0x2b62ad(_0x35268f[_0x9220('0x13')][_0x9220('0x12')]);}})[_0x9220('0x14')](function(_0x2d024d){logger[_0x9220('0x10')](_0x9220('0xc'),_0x280abb,_0x2d024d);_0xd48ae1(_0x2d024d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f60cf2f..f9bee4c 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 _0x7d52=['removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','create','addInteraction','addApplications','send','addAgents','put','delete','removeAnswers'];(function(_0x33cf94,_0x317e59){var _0x2b561a=function(_0x539f0e){while(--_0x539f0e){_0x33cf94['push'](_0x33cf94['shift']());}};_0x2b561a(++_0x317e59);}(_0x7d52,0x1c7));var _0x27d5=function(_0x2c922a,_0x205467){_0x2c922a=_0x2c922a-0x0;var _0x2cdb0c=_0x7d52[_0x2c922a];return _0x2cdb0c;};'use strict';var multer=require(_0x27d5('0x0'));var util=require(_0x27d5('0x1'));var path=require(_0x27d5('0x2'));var timeout=require(_0x27d5('0x3'));var express=require(_0x27d5('0x4'));var router=express[_0x27d5('0x5')]();var fs_extra=require(_0x27d5('0x6'));var auth=require(_0x27d5('0x7'));var interaction=require(_0x27d5('0x8'));var config=require(_0x27d5('0x9'));var controller=require(_0x27d5('0xa'));router[_0x27d5('0xb')]('/',auth[_0x27d5('0xc')](),controller['index']);router[_0x27d5('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x27d5('0xd')]);router[_0x27d5('0xb')](_0x27d5('0xe'),auth['isAuthenticated'](),controller[_0x27d5('0xf')]);router[_0x27d5('0xb')](_0x27d5('0x10'),auth[_0x27d5('0xc')](),controller[_0x27d5('0x11')]);router[_0x27d5('0xb')](_0x27d5('0x12'),auth[_0x27d5('0xc')](),controller['getAnswers']);router[_0x27d5('0xb')](_0x27d5('0x13'),auth[_0x27d5('0xc')](),controller['getImap']);router[_0x27d5('0xb')](_0x27d5('0x14'),auth[_0x27d5('0xc')](),controller[_0x27d5('0x15')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x27d5('0xb')](_0x27d5('0x16'),auth[_0x27d5('0xc')](),controller[_0x27d5('0x17')]);router[_0x27d5('0xb')]('/:id/messages',auth[_0x27d5('0xc')](),controller[_0x27d5('0x18')]);router[_0x27d5('0xb')](_0x27d5('0x19'),auth[_0x27d5('0xc')](),controller[_0x27d5('0x1a')]);router['get'](_0x27d5('0x1b'),auth['isAuthenticated'](),controller[_0x27d5('0x1c')]);router['post'](_0x27d5('0x10'),auth[_0x27d5('0xc')](),controller[_0x27d5('0x1d')]);router[_0x27d5('0x1e')](_0x27d5('0x12'),auth['isAuthenticated'](),controller[_0x27d5('0x1f')]);router[_0x27d5('0x1e')]('/',auth[_0x27d5('0xc')](),controller[_0x27d5('0x20')]);router[_0x27d5('0x1e')]('/:id/in_servers',auth[_0x27d5('0xc')](),controller['addImap']);router[_0x27d5('0x1e')]('/:id/out_servers',auth[_0x27d5('0xc')](),controller['addSmtp']);router['post']('/:id/interactions',auth[_0x27d5('0xc')](),controller[_0x27d5('0x21')]);router[_0x27d5('0x1e')](_0x27d5('0x16'),auth['isAuthenticated'](),controller[_0x27d5('0x22')]);router[_0x27d5('0x1e')]('/:id/send',auth[_0x27d5('0xc')](),controller[_0x27d5('0x23')]);router[_0x27d5('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0x27d5('0x24')]);router[_0x27d5('0x25')](_0x27d5('0xe'),auth[_0x27d5('0xc')](),controller['update']);router[_0x27d5('0x26')](_0x27d5('0x10'),auth[_0x27d5('0xc')](),controller['removeDispositions']);router[_0x27d5('0x26')](_0x27d5('0x12'),auth[_0x27d5('0xc')](),controller[_0x27d5('0x27')]);router['delete']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x27d5('0x28')]);router[_0x27d5('0x26')]('/:id/out_servers',auth[_0x27d5('0xc')](),controller[_0x27d5('0x29')]);router['delete'](_0x27d5('0xe'),auth[_0x27d5('0xc')](),controller[_0x27d5('0x2a')]);router['delete'](_0x27d5('0x1b'),auth['isAuthenticated'](),controller[_0x27d5('0x2b')]);module[_0x27d5('0x2c')]=router; \ No newline at end of file +var _0x3e14=['/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addAnswer','/:id/interactions','addInteraction','/:id/send','send','update','delete','removeDispositions','removeImap','destroy','removeAgents','exports','multer','util','connect-timeout','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions'];(function(_0x4d183d,_0x123de0){var _0x431236=function(_0x35642b){while(--_0x35642b){_0x4d183d['push'](_0x4d183d['shift']());}};_0x431236(++_0x123de0);}(_0x3e14,0xd2));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x43e1('0x0'));var util=require(_0x43e1('0x1'));var path=require('path');var timeout=require(_0x43e1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x43e1('0x3'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0x43e1('0x4')](),controller['index']);router[_0x43e1('0x5')](_0x43e1('0x6'),auth['isAuthenticated'](),controller[_0x43e1('0x7')]);router[_0x43e1('0x5')](_0x43e1('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x43e1('0x5')](_0x43e1('0x9'),auth[_0x43e1('0x4')](),controller[_0x43e1('0xa')]);router['get'](_0x43e1('0xb'),auth['isAuthenticated'](),controller[_0x43e1('0xc')]);router[_0x43e1('0x5')](_0x43e1('0xd'),auth[_0x43e1('0x4')](),controller[_0x43e1('0xe')]);router[_0x43e1('0x5')](_0x43e1('0xf'),auth[_0x43e1('0x4')](),controller[_0x43e1('0x10')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x43e1('0x11')]);router[_0x43e1('0x5')](_0x43e1('0x12'),auth[_0x43e1('0x4')](),controller[_0x43e1('0x13')]);router[_0x43e1('0x5')](_0x43e1('0x14'),auth['isAuthenticated'](),controller[_0x43e1('0x15')]);router[_0x43e1('0x5')]('/:id/verify',auth[_0x43e1('0x4')](),controller[_0x43e1('0x16')]);router[_0x43e1('0x5')](_0x43e1('0x17'),auth[_0x43e1('0x4')](),controller[_0x43e1('0x18')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x43e1('0x19')](_0x43e1('0xb'),auth[_0x43e1('0x4')](),controller[_0x43e1('0x1a')]);router['post']('/',auth[_0x43e1('0x4')](),controller['create']);router[_0x43e1('0x19')](_0x43e1('0xd'),auth['isAuthenticated'](),controller['addImap']);router['post'](_0x43e1('0xf'),auth[_0x43e1('0x4')](),controller['addSmtp']);router[_0x43e1('0x19')](_0x43e1('0x1b'),auth['isAuthenticated'](),controller[_0x43e1('0x1c')]);router[_0x43e1('0x19')](_0x43e1('0x12'),auth[_0x43e1('0x4')](),controller['addApplications']);router[_0x43e1('0x19')](_0x43e1('0x1d'),auth[_0x43e1('0x4')](),controller[_0x43e1('0x1e')]);router[_0x43e1('0x19')](_0x43e1('0x17'),auth[_0x43e1('0x4')](),controller['addAgents']);router['put'](_0x43e1('0x8'),auth['isAuthenticated'](),controller[_0x43e1('0x1f')]);router[_0x43e1('0x20')](_0x43e1('0x9'),auth[_0x43e1('0x4')](),controller[_0x43e1('0x21')]);router[_0x43e1('0x20')](_0x43e1('0xb'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x43e1('0x20')](_0x43e1('0xd'),auth['isAuthenticated'](),controller[_0x43e1('0x22')]);router[_0x43e1('0x20')](_0x43e1('0xf'),auth[_0x43e1('0x4')](),controller['removeSmtp']);router[_0x43e1('0x20')]('/:id',auth[_0x43e1('0x4')](),controller[_0x43e1('0x23')]);router[_0x43e1('0x20')](_0x43e1('0x17'),auth[_0x43e1('0x4')](),controller[_0x43e1('0x24')]);module[_0x43e1('0x25')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index cd274c5..2900560 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 _0xa5f7=['hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xa5f7,0xe9));var _0x7a5f=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa5f7[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x7a5f('0x0'));module[_0x7a5f('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x7a5f('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7a5f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7a5f('0x4')]},'markAsUnread':{'type':Sequelize[_0x7a5f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7a5f('0x2')],'allowNull':![],'defaultValue':_0x7a5f('0x5')},'fontSize':{'type':Sequelize[_0x7a5f('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7a5f('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7a5f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7a5f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7a5f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7a5f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7a5f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7a5f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x7a5f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x7a5f('0x3')],'defaultValue':![],'comment':_0x7a5f('0x9'),'set':function(_0x4f3a09){if(!_0x4f3a09)this[_0x7a5f('0xa')](_0x7a5f('0xb'),null);this[_0x7a5f('0xa')](_0x7a5f('0xc'),_0x4f3a09);}},'provider':{'type':Sequelize['ENUM'](_0x7a5f('0xd'),_0x7a5f('0xe'),_0x7a5f('0xf'),'outlook365'),'defaultValue':null,'get':function(){var _0x47c42c=this[_0x7a5f('0x10')](_0x7a5f('0x11'));return _0x47c42c||_0x7a5f('0x12');},'set':function(_0xae8bb){if(_0xae8bb===_0x7a5f('0x12')){_0xae8bb=null;}return this[_0x7a5f('0xa')](_0x7a5f('0x11'),_0xae8bb);}}}; \ No newline at end of file +var _0xe524=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe524,0x9a));var _0x4e52=function(_0x1396a4,_0x3c2a5b){_0x1396a4=_0x1396a4-0x0;var _0x2eca07=_0xe524[_0x1396a4];return _0x2eca07;};'use strict';var Sequelize=require(_0x4e52('0x0'));module[_0x4e52('0x1')]={'description':{'type':Sequelize[_0x4e52('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4e52('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4e52('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x4e52('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4e52('0x2')],'allowNull':![],'defaultValue':_0x4e52('0x5')},'fontSize':{'type':Sequelize[_0x4e52('0x6')](0x2)[_0x4e52('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4e52('0x8');}},'notificationSound':{'type':Sequelize[_0x4e52('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4e52('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4e52('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4e52('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4e52('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4e52('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4e52('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x4e52('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x4e52('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x59ed8e){if(!_0x59ed8e)this[_0x4e52('0xa')](_0x4e52('0xb'),null);this[_0x4e52('0xa')](_0x4e52('0xc'),_0x59ed8e);}},'provider':{'type':Sequelize[_0x4e52('0xd')](_0x4e52('0xe'),'hotmail',_0x4e52('0xf'),_0x4e52('0x10')),'defaultValue':null,'get':function(){var _0x578313=this[_0x4e52('0x11')](_0x4e52('0x12'));return _0x578313||_0x4e52('0x13');},'set':function(_0x132c3c){if(_0x132c3c==='custom'){_0x132c3c=null;}return this['setDataValue'](_0x4e52('0x12'),_0x132c3c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 550d8c4..8b3dd56 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 _0x1f6a=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','root','messageId','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','get','UserProfileResource','destroy','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','params','mandatoryDispositionPause','rawAttributes','fields','include','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','MailAccountId','getDispositions','Disposition','hasOwnProperty','order','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','create','ListId','active','description','UserProfileSection','MailAccounts'];(function(_0x1f6b4b,_0x39b510){var _0x33156f=function(_0x411eae){while(--_0x411eae){_0x1f6b4b['push'](_0x1f6b4b['shift']());}};_0x33156f(++_0x39b510);}(_0x1f6a,0x10c));var _0xa1f6=function(_0x487e2d,_0x1fe8ba){_0x487e2d=_0x487e2d-0x0;var _0xe4457c=_0x1f6a[_0x487e2d];return _0xe4457c;};'use strict';var moment=require(_0xa1f6('0x0'));var BPromise=require(_0xa1f6('0x1'));var util=require(_0xa1f6('0x2'));var path=require(_0xa1f6('0x3'));var _=require(_0xa1f6('0x4'));var juice=require('juice');var Redis=require(_0xa1f6('0x5'));var qs=require(_0xa1f6('0x6'));var logger=require('../../config/logger')(_0xa1f6('0x7'));var config=require('../../config/environment');var db=require(_0xa1f6('0x8'))['db'];config[_0xa1f6('0x9')]=_[_0xa1f6('0xa')](config[_0xa1f6('0x9')],{'host':_0xa1f6('0xb'),'port':0x18eb});var socket=require(_0xa1f6('0xc'))(new Redis(config[_0xa1f6('0x9')]));require(_0xa1f6('0xd'))[_0xa1f6('0xe')](socket);var jayson=require(_0xa1f6('0xf'));var client=jayson['client'][_0xa1f6('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x94dbfe,_0x4ac429,_0x3252c3,_0x2bab77){return new BPromise(function(_0x2d1739,_0x79d82f){var _0x129ce7=_0x2bab77||client;return _0x129ce7['request'](_0x94dbfe,_0x3252c3)[_0xa1f6('0x11')](function(_0xde5e57){logger[_0xa1f6('0x12')](_0xa1f6('0x13'),_0x4ac429,_0xa1f6('0x14'));logger[_0xa1f6('0x15')](_0xa1f6('0x16'),_0x4ac429,_0xa1f6('0x14'),JSON[_0xa1f6('0x17')](_0xde5e57));if(_0xde5e57[_0xa1f6('0x18')]){if(_0xde5e57['error'][_0xa1f6('0x19')]===0x1f4){logger['error'](_0xa1f6('0x13'),_0x4ac429,_0xde5e57['error']['message']);return _0x79d82f(_0xde5e57[_0xa1f6('0x18')][_0xa1f6('0x1a')]);}logger[_0xa1f6('0x18')]('MailAccount,\x20%s,\x20%s',_0x4ac429,_0xde5e57[_0xa1f6('0x18')][_0xa1f6('0x1a')]);return _0x2d1739(_0xde5e57[_0xa1f6('0x18')][_0xa1f6('0x1a')]);}else{logger[_0xa1f6('0x12')](_0xa1f6('0x13'),_0x4ac429,_0xa1f6('0x14'));_0x2d1739(_0xde5e57[_0xa1f6('0x1b')][_0xa1f6('0x1a')]);}})[_0xa1f6('0x1c')](function(_0x3cc6f0){logger['error'](_0xa1f6('0x13'),_0x4ac429,_0x3cc6f0);_0x79d82f(_0x3cc6f0);});});}function respondWithStatusCode(_0x1a87ab,_0x9ed925){_0x9ed925=_0x9ed925||0xcc;return function(_0x1bfa53){if(_0x1bfa53){return _0x1a87ab[_0xa1f6('0x1d')](_0x9ed925);}return _0x1a87ab[_0xa1f6('0x1e')](_0x9ed925)[_0xa1f6('0x1f')]();};}function respondWithResult(_0x469fc1,_0x374d9d){_0x374d9d=_0x374d9d||0xc8;return function(_0x92e1ef){if(_0x92e1ef){return _0x469fc1[_0xa1f6('0x1e')](_0x374d9d)[_0xa1f6('0x20')](_0x92e1ef);}};}function respondWithFilteredResult(_0x270354,_0x418d50){return function(_0x277895){if(_0x277895){var _0x2862aa=typeof _0x418d50[_0xa1f6('0x21')]==='undefined'&&typeof _0x418d50[_0xa1f6('0x22')]===_0xa1f6('0x23');var _0x2b47ae=_0x277895['count'];var _0x2d8719=_0x2862aa?0x0:_0x418d50[_0xa1f6('0x21')];var _0x7128d0=_0x2862aa?_0x277895[_0xa1f6('0x24')]:_0x418d50['offset']+_0x418d50[_0xa1f6('0x22')];var _0x5517d;if(_0x7128d0>=_0x2b47ae){_0x7128d0=_0x2b47ae;_0x5517d=0xc8;}else{_0x5517d=0xce;}_0x270354[_0xa1f6('0x1e')](_0x5517d);return _0x270354['set'](_0xa1f6('0x25'),_0x2d8719+'-'+_0x7128d0+'/'+_0x2b47ae)['json'](_0x277895);}return null;};}function saveUpdates(_0x1fa497){return function(_0x142827){if(_0x142827){return _0x142827[_0xa1f6('0x26')](_0x1fa497)[_0xa1f6('0x11')](function(_0x29a55d){return _0x29a55d;});}return null;};}function removeEntity(_0x309336){return function(_0x12e9b8){if(_0x12e9b8){return _0x12e9b8['destroy']()[_0xa1f6('0x11')](function(){var _0x174913=_0x12e9b8[_0xa1f6('0x27')]({'plain':!![]});var _0x50fdf2='MailAccounts';return db[_0xa1f6('0x28')][_0xa1f6('0x29')]({'where':{'type':_0x50fdf2,'resourceId':_0x174913['id']}})['then'](function(){return _0x12e9b8;});})[_0xa1f6('0x11')](function(){_0x309336[_0xa1f6('0x1e')](0xcc)[_0xa1f6('0x1f')]();});}};}function handleEntityNotFound(_0x567a06){return function(_0x501400){if(!_0x501400){_0x567a06['sendStatus'](0x194);}return _0x501400;};}function handleError(_0x3b5204,_0x53a164){_0x53a164=_0x53a164||0x1f4;return function(_0x3593ae){logger['error'](_0x3593ae[_0xa1f6('0x2a')]);if(_0x3593ae[_0xa1f6('0x2b')]){delete _0x3593ae[_0xa1f6('0x2b')];}_0x3b5204[_0xa1f6('0x1e')](_0x53a164)[_0xa1f6('0x2c')](_0x3593ae);};}function getImapHost(_0x473524){switch(_0x473524){case _0xa1f6('0x2d'):return _0xa1f6('0x2e');case _0xa1f6('0x2f'):return _0xa1f6('0x30');case _0xa1f6('0x31'):return _0xa1f6('0x32');case _0xa1f6('0x33'):return _0xa1f6('0x34');}throw new Error(_0xa1f6('0x35'),_0x473524);}function getSmtpHost(_0x1826f7){switch(_0x1826f7){case'gmail':return _0xa1f6('0x36');case'yahoo':return _0xa1f6('0x37');case _0xa1f6('0x31'):return _0xa1f6('0x38');case _0xa1f6('0x33'):return _0xa1f6('0x39');}throw new Error(_0xa1f6('0x35'),_0x1826f7);}function getAuthenticationOptions(_0x1892bc,_0x33271a){var _0x3c6241={};var _0x555216={};if(_0x1892bc){_0x3c6241[_0xa1f6('0x3a')]=_0x555216[_0xa1f6('0x3a')]=_0x33271a[_0xa1f6('0x3b')];_0x3c6241['password']=_0x555216[_0xa1f6('0x3c')]=_0x33271a[_0xa1f6('0x3d')];if(_0x33271a[_0xa1f6('0x3e')]){_0x3c6241['modernAuthentication']=_0x555216['modernAuthentication']=!![];_0x3c6241['CloudProviderId']=_0x555216['CloudProviderId']=_0x33271a[_0xa1f6('0x3f')];_0x3c6241[_0xa1f6('0x3d')]=_0x555216[_0xa1f6('0x3c')]=null;}else{_0x3c6241['CloudProviderId']=_0x555216['CloudProviderId']=null;}_0x3c6241['host']=getImapHost(_0x1892bc);_0x3c6241[_0xa1f6('0x40')]=0x3e1;_0x555216[_0xa1f6('0x41')]=getSmtpHost(_0x1892bc);_0x555216['port']=0x24b;_0x555216[_0xa1f6('0x42')]=![];_0x3c6241[_0xa1f6('0x43')]=_0x555216['service']=null;}else{if(_0x33271a[_0xa1f6('0x44')]){_0x3c6241[_0xa1f6('0x3a')]=_0x555216[_0xa1f6('0x3a')]=_0x33271a[_0xa1f6('0x3b')];_0x3c6241['password']=_0x555216[_0xa1f6('0x3c')]=_0x33271a[_0xa1f6('0x3d')];}else{_0x3c6241['authentication']=_0x555216[_0xa1f6('0x44')]=![];_0x3c6241[_0xa1f6('0x3a')]=_0x555216[_0xa1f6('0x3a')]=null;_0x3c6241[_0xa1f6('0x3d')]=_0x555216[_0xa1f6('0x3c')]=null;}_0x3c6241[_0xa1f6('0x41')]=_0x33271a[_0xa1f6('0x45')]['host'];_0x3c6241['port']=_0x33271a['Imap']['port'];_0x555216[_0xa1f6('0x41')]=_0x33271a[_0xa1f6('0x46')][_0xa1f6('0x41')];_0x555216[_0xa1f6('0x40')]=_0x33271a[_0xa1f6('0x46')]['port'];}return{'Imap':_0x3c6241,'Smtp':_0x555216};}exports[_0xa1f6('0x47')]=function(_0x37ef4c,_0x578441){var _0x4d7ad7={'include':[{'model':db[_0xa1f6('0x48')],'as':_0xa1f6('0x45')},{'model':db[_0xa1f6('0x49')],'as':'Smtp'},{'model':db[_0xa1f6('0x4a')],'as':'mandatoryDispositionPause'}]},_0xe26f89={},_0x3ab6f0={'count':0x0,'rows':[]};var _0x4751e5=_[_0xa1f6('0x4b')](db[_0xa1f6('0x4c')]['rawAttributes'],function(_0x1d085b){return{'name':_0x1d085b[_0xa1f6('0x4d')],'type':_0x1d085b[_0xa1f6('0x4e')][_0xa1f6('0x4f')]};});_0xe26f89[_0xa1f6('0x50')]=_[_0xa1f6('0x4b')](_0x4751e5,_0xa1f6('0x2b'));_0xe26f89[_0xa1f6('0x51')]=_[_0xa1f6('0x52')](_0x37ef4c[_0xa1f6('0x51')]);_0xe26f89[_0xa1f6('0x53')]=_[_0xa1f6('0x54')](_0xe26f89['model'],_0xe26f89[_0xa1f6('0x51')]);_0x4d7ad7[_0xa1f6('0x55')]=_[_0xa1f6('0x54')](_0xe26f89[_0xa1f6('0x50')],qs['fields'](_0x37ef4c[_0xa1f6('0x51')]['fields']));_0x4d7ad7['attributes']=_0x4d7ad7[_0xa1f6('0x55')][_0xa1f6('0x56')]?_0x4d7ad7[_0xa1f6('0x55')]:_0xe26f89[_0xa1f6('0x50')];if(!_0x37ef4c[_0xa1f6('0x51')]['hasOwnProperty'](_0xa1f6('0x57'))){_0x4d7ad7['limit']=qs['limit'](_0x37ef4c[_0xa1f6('0x51')][_0xa1f6('0x22')]);_0x4d7ad7[_0xa1f6('0x21')]=qs[_0xa1f6('0x21')](_0x37ef4c['query'][_0xa1f6('0x21')]);}_0x4d7ad7['order']=qs[_0xa1f6('0x58')](_0x37ef4c[_0xa1f6('0x51')]['sort']);_0x4d7ad7[_0xa1f6('0x59')]=qs['filters'](_[_0xa1f6('0x5a')](_0x37ef4c[_0xa1f6('0x51')],_0xe26f89['filters']),_0x4751e5);if(_0x37ef4c[_0xa1f6('0x51')]['filter']){_0x4d7ad7['where']=_[_0xa1f6('0x5b')](_0x4d7ad7[_0xa1f6('0x59')],{'$or':_['map'](_0x4751e5,function(_0x328b83){if(_0x328b83[_0xa1f6('0x4e')]!==_0xa1f6('0x5c')){var _0x22c019={};_0x22c019[_0x328b83[_0xa1f6('0x2b')]]={'$like':'%'+_0x37ef4c['query'][_0xa1f6('0x5d')]+'%'};return _0x22c019;}})});}_0x4d7ad7=_[_0xa1f6('0x5b')]({},_0x4d7ad7,_0x37ef4c[_0xa1f6('0x5e')]);var _0x4f72ab={'where':_0x4d7ad7['where']};return db[_0xa1f6('0x4c')]['count'](_0x4f72ab)[_0xa1f6('0x11')](function(_0x3131f0){_0x3ab6f0[_0xa1f6('0x24')]=_0x3131f0;if(_0x37ef4c[_0xa1f6('0x51')][_0xa1f6('0x5f')]){_0x4d7ad7['include']=[{'all':!![]}];}return db[_0xa1f6('0x4c')][_0xa1f6('0x60')](_0x4d7ad7);})[_0xa1f6('0x11')](function(_0x2b287a){_0x3ab6f0['rows']=_0x2b287a;return _0x3ab6f0;})[_0xa1f6('0x11')](respondWithFilteredResult(_0x578441,_0x4d7ad7))[_0xa1f6('0x1c')](handleError(_0x578441,null));};exports['show']=function(_0x5276cf,_0x2188e7){var _0x566b44={'raw':![],'where':{'id':_0x5276cf[_0xa1f6('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xa1f6('0x45')},{'model':db[_0xa1f6('0x49')],'as':_0xa1f6('0x46')},{'model':db['Pause'],'as':_0xa1f6('0x62')}]},_0x5fb58c={};_0x5fb58c[_0xa1f6('0x50')]=_[_0xa1f6('0x52')](db[_0xa1f6('0x4c')][_0xa1f6('0x63')]);_0x5fb58c[_0xa1f6('0x51')]=_[_0xa1f6('0x52')](_0x5276cf[_0xa1f6('0x51')]);_0x5fb58c['filters']=_['intersection'](_0x5fb58c[_0xa1f6('0x50')],_0x5fb58c['query']);_0x566b44['attributes']=_[_0xa1f6('0x54')](_0x5fb58c[_0xa1f6('0x50')],qs[_0xa1f6('0x64')](_0x5276cf['query'][_0xa1f6('0x64')]));_0x566b44['attributes']=_0x566b44[_0xa1f6('0x55')][_0xa1f6('0x56')]?_0x566b44[_0xa1f6('0x55')]:_0x5fb58c[_0xa1f6('0x50')];if(_0x5276cf[_0xa1f6('0x51')][_0xa1f6('0x5f')]){_0x566b44[_0xa1f6('0x65')]=[{'all':!![]}];}_0x566b44=_['merge']({},_0x566b44,_0x5276cf[_0xa1f6('0x5e')]);return db[_0xa1f6('0x4c')][_0xa1f6('0x66')](_0x566b44)[_0xa1f6('0x11')](handleEntityNotFound(_0x2188e7,null))['then'](respondWithResult(_0x2188e7,null))[_0xa1f6('0x1c')](handleError(_0x2188e7,null));};exports[_0xa1f6('0x26')]=function(_0x4610ac,_0x140eff){if(_0x4610ac[_0xa1f6('0x67')]['id']){delete _0x4610ac[_0xa1f6('0x67')]['id'];}var _0x5da693=_0x4610ac[_0xa1f6('0x67')][_0xa1f6('0x68')]===_0xa1f6('0x69')?null:_0x4610ac[_0xa1f6('0x67')]['provider'];var _0x177e67=_0x4610ac[_0xa1f6('0x67')][_0xa1f6('0x45')]||{};var _0x1a4705=_0x4610ac[_0xa1f6('0x67')][_0xa1f6('0x46')]||{};if(_0x5da693){_0x177e67['host']=getImapHost(_0x5da693);_0x177e67[_0xa1f6('0x40')]=0x3e1;_0x1a4705[_0xa1f6('0x41')]=getSmtpHost(_0x5da693);_0x1a4705[_0xa1f6('0x40')]=0x24b;_0x1a4705[_0xa1f6('0x42')]=![];}if(_0x1a4705[_0xa1f6('0x3e')]){_0x1a4705[_0xa1f6('0x42')]=![];}else{_0x1a4705['CloudProviderId']=null;}if(!_0x177e67[_0xa1f6('0x3e')])_0x177e67[_0xa1f6('0x3f')]=null;_0x4610ac[_0xa1f6('0x67')]['Imap']=_0x177e67;_0x4610ac[_0xa1f6('0x67')][_0xa1f6('0x46')]=_0x1a4705;return db['MailAccount']['find']({'where':{'id':_0x4610ac[_0xa1f6('0x61')]['id']},'include':[{'model':db[_0xa1f6('0x48')],'as':'Imap'},{'model':db[_0xa1f6('0x49')],'as':_0xa1f6('0x46')},{'model':db[_0xa1f6('0x4a')],'as':_0xa1f6('0x62')}]})[_0xa1f6('0x11')](handleEntityNotFound(_0x140eff,null))[_0xa1f6('0x11')](function(_0x2cb683){if(!_0x2cb683)throw new Error(_0xa1f6('0x6a'));if(_0x2cb683['service'])delete _0x4610ac[_0xa1f6('0x67')][_0xa1f6('0x45')];return _0x2cb683;})[_0xa1f6('0x11')](saveUpdates(_0x4610ac[_0xa1f6('0x67')],null))[_0xa1f6('0x11')](function(_0x170637){if(!_0x4610ac[_0xa1f6('0x67')]['Imap'])return _0x170637;return db['MailServerIn']['update'](_0x4610ac[_0xa1f6('0x67')]['Imap'],{'where':{'MailAccountId':_0x170637['id']}})['then'](function(){return _0x170637;});})[_0xa1f6('0x11')](function(_0x3aa7d1){if(!_0x4610ac[_0xa1f6('0x67')]['Smtp'])return _0x3aa7d1;return db[_0xa1f6('0x49')]['update'](_0x4610ac[_0xa1f6('0x67')][_0xa1f6('0x46')],{'where':{'MailAccountId':_0x3aa7d1['id']}})[_0xa1f6('0x11')](function(){return _0x3aa7d1;});})['then'](respondWithResult(_0x140eff,null))[_0xa1f6('0x1c')](handleError(_0x140eff,null));};exports[_0xa1f6('0x6b')]=function(_0x3b750d,_0x45cfa8){return db[_0xa1f6('0x4c')][_0xa1f6('0x6b')]()[_0xa1f6('0x11')](respondWithResult(_0x45cfa8,null))[_0xa1f6('0x1c')](handleError(_0x45cfa8,null));};exports['addDisposition']=function(_0x261a1a,_0x5d8455){if(_0x261a1a[_0xa1f6('0x67')]['id']){delete _0x261a1a[_0xa1f6('0x67')]['id'];}return db['MailAccount'][_0xa1f6('0x66')]({'where':{'id':_0x261a1a['params']['id']}})['then'](handleEntityNotFound(_0x5d8455,null))['then'](function(_0x23a7e0){if(_0x23a7e0){_0x261a1a['body'][_0xa1f6('0x6c')]=_0x23a7e0['id'];return db['Disposition']['create'](_0x261a1a[_0xa1f6('0x67')]);}})[_0xa1f6('0x11')](respondWithResult(_0x5d8455,null))[_0xa1f6('0x1c')](handleError(_0x5d8455,null));};exports[_0xa1f6('0x6d')]=function(_0x19e7c3,_0x2bb4fc){var _0x52d84d={'raw':![],'where':{}};var _0x55ed8f={};var _0x5f1126={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x19e7c3[_0xa1f6('0x61')]['id']}})['then'](handleEntityNotFound(_0x2bb4fc,null))['then'](function(_0x13360c){if(_0x13360c){_0x55ed8f[_0xa1f6('0x50')]=_[_0xa1f6('0x52')](db[_0xa1f6('0x6e')][_0xa1f6('0x63')]);_0x55ed8f[_0xa1f6('0x51')]=_[_0xa1f6('0x52')](_0x19e7c3[_0xa1f6('0x51')]);_0x55ed8f[_0xa1f6('0x53')]=_[_0xa1f6('0x54')](_0x55ed8f[_0xa1f6('0x50')],_0x55ed8f[_0xa1f6('0x51')]);_0x52d84d[_0xa1f6('0x55')]=_[_0xa1f6('0x54')](_0x55ed8f[_0xa1f6('0x50')],qs['fields'](_0x19e7c3[_0xa1f6('0x51')][_0xa1f6('0x64')]));_0x52d84d[_0xa1f6('0x55')]=_0x52d84d[_0xa1f6('0x55')][_0xa1f6('0x56')]?_0x52d84d[_0xa1f6('0x55')]:_0x55ed8f[_0xa1f6('0x50')];if(!_0x19e7c3['query'][_0xa1f6('0x6f')](_0xa1f6('0x57'))){_0x52d84d[_0xa1f6('0x22')]=qs[_0xa1f6('0x22')](_0x19e7c3[_0xa1f6('0x51')]['limit']);_0x52d84d[_0xa1f6('0x21')]=qs[_0xa1f6('0x21')](_0x19e7c3['query']['offset']);}_0x52d84d[_0xa1f6('0x70')]=qs[_0xa1f6('0x58')](_0x19e7c3[_0xa1f6('0x51')]['sort']);_0x52d84d[_0xa1f6('0x59')]=qs[_0xa1f6('0x53')](_['pick'](_0x19e7c3[_0xa1f6('0x51')],_0x55ed8f[_0xa1f6('0x53')]));_0x52d84d[_0xa1f6('0x59')][_0xa1f6('0x6c')]=_0x13360c['id'];if(_0x19e7c3[_0xa1f6('0x51')][_0xa1f6('0x5d')]){_0x52d84d[_0xa1f6('0x59')]=_[_0xa1f6('0x5b')](_0x52d84d[_0xa1f6('0x59')],{'$or':_[_0xa1f6('0x4b')](_0x52d84d['attributes'],function(_0x597ba2){var _0x1a5c24={};_0x1a5c24[_0x597ba2]={'$like':'%'+_0x19e7c3[_0xa1f6('0x51')][_0xa1f6('0x5d')]+'%'};return _0x1a5c24;})});}_0x52d84d=_['merge']({},_0x52d84d,_0x19e7c3[_0xa1f6('0x5e')]);return db[_0xa1f6('0x6e')]['count']({'where':_0x52d84d[_0xa1f6('0x59')]})[_0xa1f6('0x11')](function(_0x14339b){_0x5f1126['count']=_0x14339b;if(_0x19e7c3[_0xa1f6('0x51')][_0xa1f6('0x5f')]){_0x52d84d[_0xa1f6('0x65')]=[{'all':!![]}];}return db[_0xa1f6('0x6e')]['findAll'](_0x52d84d);})['then'](function(_0x4d0cad){_0x5f1126[_0xa1f6('0x71')]=_0x4d0cad;return _0x5f1126;});}})[_0xa1f6('0x11')](respondWithFilteredResult(_0x2bb4fc,_0x52d84d))[_0xa1f6('0x1c')](handleError(_0x2bb4fc,null));};exports[_0xa1f6('0x72')]=function(_0x5616ba,_0x121057){return db[_0xa1f6('0x4c')][_0xa1f6('0x66')]({'where':{'id':_0x5616ba['params']['id']}})['then'](handleEntityNotFound(_0x121057,null))['then'](function(_0x181535){if(_0x181535){return _0x181535[_0xa1f6('0x72')](_0x5616ba[_0xa1f6('0x51')]['ids']);}})[_0xa1f6('0x11')](respondWithStatusCode(_0x121057,null))[_0xa1f6('0x1c')](handleError(_0x121057,null));};exports[_0xa1f6('0x73')]=function(_0x38c0e4,_0x5c8ef4){if(_0x38c0e4[_0xa1f6('0x67')]['id']){delete _0x38c0e4[_0xa1f6('0x67')]['id'];}return db[_0xa1f6('0x4c')][_0xa1f6('0x66')]({'where':{'id':_0x38c0e4[_0xa1f6('0x61')]['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x5c8ef4,null))[_0xa1f6('0x11')](function(_0x4821a7){if(_0x4821a7){_0x38c0e4[_0xa1f6('0x67')][_0xa1f6('0x6c')]=_0x4821a7['id'];return db[_0xa1f6('0x74')]['create'](_0x38c0e4[_0xa1f6('0x67')]);}})['then'](respondWithResult(_0x5c8ef4,null))[_0xa1f6('0x1c')](handleError(_0x5c8ef4,null));};exports[_0xa1f6('0x75')]=function(_0x1f59fc,_0x57f6a1){var _0x3aff1f={'raw':![],'where':{}};var _0x209917={};var _0x116eac={'count':0x0,'rows':[]};return db[_0xa1f6('0x4c')]['findOne']({'where':{'id':_0x1f59fc['params']['id']}})['then'](handleEntityNotFound(_0x57f6a1,null))['then'](function(_0xf5423){if(_0xf5423){_0x209917[_0xa1f6('0x50')]=_[_0xa1f6('0x52')](db['CannedAnswer'][_0xa1f6('0x63')]);_0x209917[_0xa1f6('0x51')]=_[_0xa1f6('0x52')](_0x1f59fc[_0xa1f6('0x51')]);_0x209917[_0xa1f6('0x53')]=_[_0xa1f6('0x54')](_0x209917[_0xa1f6('0x50')],_0x209917[_0xa1f6('0x51')]);_0x3aff1f[_0xa1f6('0x55')]=_[_0xa1f6('0x54')](_0x209917[_0xa1f6('0x50')],qs['fields'](_0x1f59fc[_0xa1f6('0x51')][_0xa1f6('0x64')]));_0x3aff1f['attributes']=_0x3aff1f[_0xa1f6('0x55')]['length']?_0x3aff1f[_0xa1f6('0x55')]:_0x209917['model'];if(!_0x1f59fc[_0xa1f6('0x51')][_0xa1f6('0x6f')](_0xa1f6('0x57'))){_0x3aff1f['limit']=qs[_0xa1f6('0x22')](_0x1f59fc[_0xa1f6('0x51')][_0xa1f6('0x22')]);_0x3aff1f[_0xa1f6('0x21')]=qs[_0xa1f6('0x21')](_0x1f59fc[_0xa1f6('0x51')]['offset']);}_0x3aff1f[_0xa1f6('0x70')]=qs[_0xa1f6('0x58')](_0x1f59fc[_0xa1f6('0x51')][_0xa1f6('0x58')]);_0x3aff1f['where']=qs[_0xa1f6('0x53')](_[_0xa1f6('0x5a')](_0x1f59fc[_0xa1f6('0x51')],_0x209917[_0xa1f6('0x53')]));_0x3aff1f[_0xa1f6('0x59')][_0xa1f6('0x6c')]=_0xf5423['id'];if(_0x1f59fc[_0xa1f6('0x51')][_0xa1f6('0x5d')]){_0x3aff1f[_0xa1f6('0x59')]=_[_0xa1f6('0x5b')](_0x3aff1f[_0xa1f6('0x59')],{'$or':_[_0xa1f6('0x4b')](_0x3aff1f[_0xa1f6('0x55')],function(_0x4799aa){var _0x2f939b={};_0x2f939b[_0x4799aa]={'$like':'%'+_0x1f59fc['query'][_0xa1f6('0x5d')]+'%'};return _0x2f939b;})});}_0x3aff1f=_[_0xa1f6('0x5b')]({},_0x3aff1f,_0x1f59fc[_0xa1f6('0x5e')]);return db['CannedAnswer'][_0xa1f6('0x24')]({'where':_0x3aff1f[_0xa1f6('0x59')]})[_0xa1f6('0x11')](function(_0x9d35a2){_0x116eac[_0xa1f6('0x24')]=_0x9d35a2;if(_0x1f59fc[_0xa1f6('0x51')][_0xa1f6('0x5f')]){_0x3aff1f[_0xa1f6('0x65')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa1f6('0x60')](_0x3aff1f);})[_0xa1f6('0x11')](function(_0x37de42){_0x116eac[_0xa1f6('0x71')]=_0x37de42;return _0x116eac;});}})[_0xa1f6('0x11')](respondWithFilteredResult(_0x57f6a1,_0x3aff1f))[_0xa1f6('0x1c')](handleError(_0x57f6a1,null));};exports['removeAnswers']=function(_0x331693,_0x415515){return db[_0xa1f6('0x4c')][_0xa1f6('0x66')]({'where':{'id':_0x331693['params']['id']}})['then'](handleEntityNotFound(_0x415515,null))[_0xa1f6('0x11')](function(_0x46f7af){if(_0x46f7af){return _0x46f7af[_0xa1f6('0x76')](_0x331693[_0xa1f6('0x51')][_0xa1f6('0x77')]);}})[_0xa1f6('0x11')](respondWithStatusCode(_0x415515,null))['catch'](handleError(_0x415515,null));};exports[_0xa1f6('0x78')]=function(_0x2234e6,_0x379d2b){var _0x49c5c3={'name':_0x2234e6[_0xa1f6('0x67')][_0xa1f6('0x2b')],'key':_0x2234e6[_0xa1f6('0x67')][_0xa1f6('0x4f')],'provider':_0x2234e6[_0xa1f6('0x67')][_0xa1f6('0x68')]==='custom'?null:_0x2234e6[_0xa1f6('0x67')]['provider'],'email':_0x2234e6[_0xa1f6('0x67')]['email'],'ListId':_0x2234e6[_0xa1f6('0x67')][_0xa1f6('0x79')],'active':!_['isNil'](_0x2234e6[_0xa1f6('0x67')][_0xa1f6('0x7a')])?_0x2234e6[_0xa1f6('0x67')][_0xa1f6('0x7a')]:!![],'description':_0x2234e6[_0xa1f6('0x67')][_0xa1f6('0x7b')]||null};var _0x170270=getAuthenticationOptions(_0x49c5c3[_0xa1f6('0x68')],_0x2234e6[_0xa1f6('0x67')]);_0x49c5c3[_0xa1f6('0x45')]=_0x170270[_0xa1f6('0x45')];_0x49c5c3[_0xa1f6('0x46')]=_0x170270[_0xa1f6('0x46')];return db[_0xa1f6('0x4c')][_0xa1f6('0x78')](_0x49c5c3,{'include':[{'model':db['MailServerOut'],'as':_0xa1f6('0x46')},{'model':db[_0xa1f6('0x48')],'as':_0xa1f6('0x45')}]})['then'](function(_0x3766d4){var _0x49a05b=_0x2234e6['user'][_0xa1f6('0x27')]({'plain':!![]});if(!_0x49a05b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49a05b['role']===_0xa1f6('0x3a')){var _0x2115b7=_0x3766d4[_0xa1f6('0x27')]({'plain':!![]});return db[_0xa1f6('0x7c')][_0xa1f6('0x66')]({'where':{'name':_0xa1f6('0x7d'),'userProfileId':_0x49a05b[_0xa1f6('0x7e')]},'raw':!![]})[_0xa1f6('0x11')](function(_0x1f27ac){if(_0x1f27ac&&_0x1f27ac[_0xa1f6('0x7f')]===0x0){return db['UserProfileResource'][_0xa1f6('0x78')]({'name':_0x2115b7[_0xa1f6('0x2b')],'resourceId':_0x2115b7['id'],'type':_0x1f27ac[_0xa1f6('0x2b')],'sectionId':_0x1f27ac['id']},{})[_0xa1f6('0x11')](function(){return _0x3766d4;});}else{return _0x3766d4;}})[_0xa1f6('0x1c')](function(_0x458e25){logger[_0xa1f6('0x18')](_0xa1f6('0x80'),_0x458e25);throw _0x458e25;});}return _0x3766d4;})[_0xa1f6('0x11')](respondWithResult(_0x379d2b,0xc9))[_0xa1f6('0x1c')](handleError(_0x379d2b,null));};exports['getImap']=function(_0x5b7ba0,_0x4fc43a){return db[_0xa1f6('0x4c')][_0xa1f6('0x81')]({'where':{'id':_0x5b7ba0[_0xa1f6('0x61')]['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x4fc43a,null))[_0xa1f6('0x11')](function(_0x2e2fa6){if(_0x2e2fa6){return _0x2e2fa6[_0xa1f6('0x82')]();}return null;})['then'](respondWithResult(_0x4fc43a,null))[_0xa1f6('0x1c')](handleError(_0x4fc43a,null));};exports['addImap']=function(_0x42408b,_0x462653){if(_0x42408b[_0xa1f6('0x67')]['id']){delete _0x42408b[_0xa1f6('0x67')]['id'];}return db[_0xa1f6('0x4c')]['find']({'where':{'id':_0x42408b[_0xa1f6('0x61')]['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x462653,null))['then'](function(_0x1391df){if(_0x1391df){_0x42408b['body']['MailAccountId']=_0x1391df['id'];return db[_0xa1f6('0x48')]['create'](_0x42408b[_0xa1f6('0x67')]);}})[_0xa1f6('0x11')](respondWithResult(_0x462653,null))[_0xa1f6('0x1c')](handleError(_0x462653,null));};exports[_0xa1f6('0x83')]=function(_0x473d1a,_0xdb1453){return db[_0xa1f6('0x4c')][_0xa1f6('0x81')]({'where':{'id':_0x473d1a[_0xa1f6('0x61')]['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0xdb1453,null))[_0xa1f6('0x11')](function(_0x2e1b5a){if(_0x2e1b5a){return _0x2e1b5a[_0xa1f6('0x84')](null);}return null;})['then'](respondWithStatusCode(_0xdb1453,null))[_0xa1f6('0x1c')](handleError(_0xdb1453,null));};exports['getSmtp']=function(_0x4466da,_0x29a361){return db[_0xa1f6('0x4c')][_0xa1f6('0x81')]({'where':{'id':_0x4466da[_0xa1f6('0x61')]['id']}})['then'](handleEntityNotFound(_0x29a361,null))['then'](function(_0x530a74){if(_0x530a74){return _0x530a74[_0xa1f6('0x85')]();}return null;})['then'](respondWithResult(_0x29a361,null))[_0xa1f6('0x1c')](handleError(_0x29a361,null));};exports[_0xa1f6('0x86')]=function(_0x1b965c,_0x457e64){if(_0x1b965c[_0xa1f6('0x67')]['id']){delete _0x1b965c[_0xa1f6('0x67')]['id'];}return db[_0xa1f6('0x4c')]['find']({'where':{'id':_0x1b965c['params']['id']}})['then'](handleEntityNotFound(_0x457e64,null))[_0xa1f6('0x11')](function(_0x3cb50b){if(_0x3cb50b){_0x1b965c['body']['MailAccountId']=_0x3cb50b['id'];return db[_0xa1f6('0x49')][_0xa1f6('0x78')](_0x1b965c['body']);}})[_0xa1f6('0x11')](respondWithResult(_0x457e64,null))[_0xa1f6('0x1c')](handleError(_0x457e64,null));};exports[_0xa1f6('0x87')]=function(_0x2017ee,_0x5876e6){return db['MailAccount'][_0xa1f6('0x81')]({'where':{'id':_0x2017ee['params']['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x5876e6,null))['then'](function(_0x9a9145){if(_0x9a9145){return _0x9a9145[_0xa1f6('0x88')](null);}return null;})[_0xa1f6('0x11')](respondWithStatusCode(_0x5876e6,null))[_0xa1f6('0x1c')](handleError(_0x5876e6,null));};exports[_0xa1f6('0x89')]=function(_0x129ab9,_0x115b3f){return db[_0xa1f6('0x8a')][_0xa1f6('0x66')]({'where':{'id':_0x129ab9['params']['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x115b3f,null))[_0xa1f6('0x11')](function(_0x571440){if(_0x571440){return _0x571440[_0xa1f6('0x89')](_0x129ab9[_0xa1f6('0x67')][_0xa1f6('0x77')],_[_0xa1f6('0x8b')](_0x129ab9[_0xa1f6('0x67')],[_0xa1f6('0x77'),'id'])||{});}})[_0xa1f6('0x11')](respondWithResult(_0x115b3f,null))[_0xa1f6('0x1c')](handleError(_0x115b3f,null));};exports[_0xa1f6('0x8c')]=function(_0x599b15,_0x374e13){var _0x3c681e={'raw':![],'where':{}};var _0x8a43d9={};var _0x1671d9={'count':0x0,'rows':[]};return db[_0xa1f6('0x4c')]['findOne']({'where':{'id':_0x599b15[_0xa1f6('0x61')]['id']}})['then'](handleEntityNotFound(_0x374e13,null))[_0xa1f6('0x11')](function(_0x39da55){if(_0x39da55){_0x8a43d9[_0xa1f6('0x50')]=_[_0xa1f6('0x52')](db[_0xa1f6('0x8a')][_0xa1f6('0x63')]);_0x8a43d9['query']=_[_0xa1f6('0x52')](_0x599b15[_0xa1f6('0x51')]);_0x8a43d9[_0xa1f6('0x53')]=_[_0xa1f6('0x54')](_0x8a43d9[_0xa1f6('0x50')],_0x8a43d9[_0xa1f6('0x51')]);_0x3c681e[_0xa1f6('0x55')]=_[_0xa1f6('0x54')](_0x8a43d9[_0xa1f6('0x50')],qs[_0xa1f6('0x64')](_0x599b15[_0xa1f6('0x51')][_0xa1f6('0x64')]));_0x3c681e[_0xa1f6('0x55')]=_0x3c681e[_0xa1f6('0x55')][_0xa1f6('0x56')]?_0x3c681e[_0xa1f6('0x55')]:_0x8a43d9['model'];if(!_0x599b15[_0xa1f6('0x51')][_0xa1f6('0x6f')](_0xa1f6('0x57'))){_0x3c681e[_0xa1f6('0x22')]=qs['limit'](_0x599b15[_0xa1f6('0x51')][_0xa1f6('0x22')]);_0x3c681e[_0xa1f6('0x21')]=qs[_0xa1f6('0x21')](_0x599b15[_0xa1f6('0x51')][_0xa1f6('0x21')]);}_0x3c681e[_0xa1f6('0x70')]=qs['sort'](_0x599b15[_0xa1f6('0x51')][_0xa1f6('0x58')]);_0x3c681e['where']=qs[_0xa1f6('0x53')](_[_0xa1f6('0x5a')](_0x599b15[_0xa1f6('0x51')],_0x8a43d9[_0xa1f6('0x53')]));_0x3c681e[_0xa1f6('0x59')][_0xa1f6('0x6c')]=_0x39da55['id'];if(_0x599b15[_0xa1f6('0x51')][_0xa1f6('0x5d')]){_0x3c681e['where']=_[_0xa1f6('0x5b')](_0x3c681e['where'],{'$or':_[_0xa1f6('0x4b')](_0x3c681e[_0xa1f6('0x55')],function(_0x38a854){var _0x4cf641={};_0x4cf641[_0x38a854]={'$like':'%'+_0x599b15[_0xa1f6('0x51')]['filter']+'%'};return _0x4cf641;})});}_0x3c681e=_[_0xa1f6('0x5b')]({},_0x3c681e,_0x599b15[_0xa1f6('0x5e')]);return db[_0xa1f6('0x8a')][_0xa1f6('0x24')]({'where':_0x3c681e[_0xa1f6('0x59')]})[_0xa1f6('0x11')](function(_0x347114){_0x1671d9['count']=_0x347114;if(_0x599b15['query'][_0xa1f6('0x5f')]){_0x3c681e[_0xa1f6('0x65')]=[{'model':db[_0xa1f6('0x8d')],'as':'Contact','required':![]},{'model':db[_0xa1f6('0x8e')],'as':_0xa1f6('0x8f'),'attributes':['name',_0xa1f6('0x90'),_0xa1f6('0x91')],'required':![]},{'model':db[_0xa1f6('0x92')],'as':_0xa1f6('0x93'),'attributes':['id',_0xa1f6('0x2b'),_0xa1f6('0x94')],'where':_0x599b15[_0xa1f6('0x51')]['tag']?{'id':_0x599b15[_0xa1f6('0x51')]['tag']}:undefined,'required':_0x599b15[_0xa1f6('0x51')][_0xa1f6('0x95')]?!![]:![]}];}return db[_0xa1f6('0x8a')][_0xa1f6('0x60')](_0x3c681e);})['then'](function(_0x41d518){_0x1671d9[_0xa1f6('0x71')]=_0x41d518;return _0x1671d9;});}})[_0xa1f6('0x11')](respondWithFilteredResult(_0x374e13,_0x3c681e))['catch'](handleError(_0x374e13,null));};exports[_0xa1f6('0x96')]=function addApplications(_0x47e876,_0x3cfae4){var _0x5354bd=_0x47e876[_0xa1f6('0x61')]['id'];var _0xf101dc=_0x47e876['body'];var _0x13425d=0xc8;var _0x2f88fa=null;return db['sequelize'][_0xa1f6('0x97')]({'isolationLevel':db[_0xa1f6('0x98')][_0xa1f6('0x99')][_0xa1f6('0x9a')][_0xa1f6('0x9b')]},function(_0x56375d){return db['MailAccount'][_0xa1f6('0x81')]({'where':{'id':_0x5354bd},'transaction':_0x56375d})['then'](function(_0x282f7e){if(_0x282f7e){return db[_0xa1f6('0x9c')]['destroy']({'where':{'MailAccountId':_0x5354bd},'transaction':_0x56375d})['then'](function(){var _0x434f2a=_[_0xa1f6('0x4b')](_0xf101dc,function(_0x3fcaa1){_0x3fcaa1[_0xa1f6('0x6c')]=_0x5354bd;return _0x3fcaa1;});return db[_0xa1f6('0x9c')][_0xa1f6('0x9d')](_0x434f2a,{'transaction':_0x56375d});});}else{_0x13425d=0x194;_0x2f88fa=[];}});})[_0xa1f6('0x11')](function(){if(_0x13425d!==0x194){return db[_0xa1f6('0x9c')][_0xa1f6('0x9e')]({'where':{'MailAccountId':_0x5354bd},'order':_0xa1f6('0x9f')})[_0xa1f6('0x11')](function(_0x43bfbf){_0x2f88fa=_0x43bfbf;});}})[_0xa1f6('0x1c')](function(_0x5e2286){_0x13425d=0x1f4;logger[_0xa1f6('0x18')](_0x5e2286[_0xa1f6('0x2a')]);if(_0x5e2286[_0xa1f6('0x2b')]){delete _0x5e2286[_0xa1f6('0x2b')];}_0x2f88fa=_0x5e2286;})['finally'](function(){if(_0x2f88fa===null){_0x3cfae4['sendStatus'](_0x13425d);}else{if(_0x13425d===0x1f4){_0x3cfae4['status'](_0x13425d)['send'](_0x2f88fa);}else{_0x3cfae4[_0xa1f6('0x1e')](_0x13425d)[_0xa1f6('0x20')](_0x2f88fa);}}});};exports[_0xa1f6('0xa0')]=function(_0x5a042f,_0x505010){var _0x2b8da6={};var _0x552f18={};var _0x3d40ab;var _0x17fc86;return db[_0xa1f6('0x4c')][_0xa1f6('0x81')]({'where':{'id':_0x5a042f['params']['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x505010,null))[_0xa1f6('0x11')](function(_0x1b7434){if(_0x1b7434){_0x3d40ab=_0x1b7434;_0x552f18['model']=_['keys'](db[_0xa1f6('0x9c')][_0xa1f6('0x63')]);_0x552f18[_0xa1f6('0x51')]=_[_0xa1f6('0x52')](_0x5a042f[_0xa1f6('0x51')]);_0x552f18['filters']=_['intersection'](_0x552f18[_0xa1f6('0x50')],_0x552f18['query']);_0x2b8da6['attributes']=_[_0xa1f6('0x54')](_0x552f18[_0xa1f6('0x50')],qs['fields'](_0x5a042f['query'][_0xa1f6('0x64')]));_0x2b8da6[_0xa1f6('0x55')]=_0x2b8da6[_0xa1f6('0x55')][_0xa1f6('0x56')]?_0x2b8da6[_0xa1f6('0x55')]:_0x552f18[_0xa1f6('0x50')];_0x2b8da6['order']=qs[_0xa1f6('0x58')](_0x5a042f[_0xa1f6('0x51')]['sort']);_0x2b8da6[_0xa1f6('0x59')]=qs[_0xa1f6('0x53')](_[_0xa1f6('0x5a')](_0x5a042f[_0xa1f6('0x51')],_0x552f18[_0xa1f6('0x53')]));if(_0x5a042f['query'][_0xa1f6('0x5d')]){_0x2b8da6['where']=_['merge'](_0x2b8da6[_0xa1f6('0x59')],{'$or':_[_0xa1f6('0x4b')](_0x2b8da6[_0xa1f6('0x55')],function(_0x3cdb6e){var _0x5031ed={};_0x5031ed[_0x3cdb6e]={'$like':'%'+_0x5a042f[_0xa1f6('0x51')][_0xa1f6('0x5d')]+'%'};return _0x5031ed;})});}_0x2b8da6=_[_0xa1f6('0x5b')]({},_0x2b8da6,_0x5a042f[_0xa1f6('0x5e')]);return _0x3d40ab[_0xa1f6('0xa0')](_0x2b8da6);}})['then'](function(_0x3834c7){if(_0x3834c7){_0x17fc86=_0x3834c7[_0xa1f6('0x56')];if(!_0x5a042f['query']['hasOwnProperty'](_0xa1f6('0x57'))){_0x2b8da6[_0xa1f6('0x22')]=qs[_0xa1f6('0x22')](_0x5a042f[_0xa1f6('0x51')][_0xa1f6('0x22')]);_0x2b8da6['offset']=qs[_0xa1f6('0x21')](_0x5a042f['query'][_0xa1f6('0x21')]);}return _0x3d40ab[_0xa1f6('0xa0')](_0x2b8da6);}})[_0xa1f6('0x11')](function(_0x5d167c){if(_0x5d167c){return _0x5d167c?{'count':_0x17fc86,'rows':_0x5d167c}:null;}})['then'](respondWithResult(_0x505010,null))[_0xa1f6('0x1c')](handleError(_0x505010,null));};exports[_0xa1f6('0xa1')]=function(_0x359cf3,_0x463977){var _0x2e5702={'raw':!![],'where':{}};var _0x1bf350={};var _0x1da4cf={'count':0x0,'rows':[]};return db[_0xa1f6('0x4c')]['findOne']({'where':{'id':_0x359cf3[_0xa1f6('0x61')]['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x463977,null))[_0xa1f6('0x11')](function(_0x24bd8d){if(_0x24bd8d){_0x1bf350[_0xa1f6('0x50')]=_[_0xa1f6('0x52')](db[_0xa1f6('0xa2')]['rawAttributes']);_0x1bf350[_0xa1f6('0x51')]=_[_0xa1f6('0x52')](_0x359cf3[_0xa1f6('0x51')]);_0x1bf350[_0xa1f6('0x53')]=_[_0xa1f6('0x54')](_0x1bf350['model'],_0x1bf350[_0xa1f6('0x51')]);_0x2e5702[_0xa1f6('0x55')]=_['intersection'](_0x1bf350[_0xa1f6('0x50')],qs['fields'](_0x359cf3[_0xa1f6('0x51')][_0xa1f6('0x64')]));_0x2e5702['attributes']=_0x2e5702[_0xa1f6('0x55')]['length']?_0x2e5702[_0xa1f6('0x55')]:_0x1bf350['model'];if(!_0x359cf3[_0xa1f6('0x51')][_0xa1f6('0x6f')]('nolimit')){_0x2e5702['limit']=qs['limit'](_0x359cf3[_0xa1f6('0x51')][_0xa1f6('0x22')]);_0x2e5702[_0xa1f6('0x21')]=qs['offset'](_0x359cf3[_0xa1f6('0x51')]['offset']);}_0x2e5702[_0xa1f6('0x70')]=qs[_0xa1f6('0x58')](_0x359cf3[_0xa1f6('0x51')][_0xa1f6('0x58')]);_0x2e5702[_0xa1f6('0x59')]=qs[_0xa1f6('0x53')](_[_0xa1f6('0x5a')](_0x359cf3[_0xa1f6('0x51')],_0x1bf350['filters']));_0x2e5702[_0xa1f6('0x59')][_0xa1f6('0x6c')]=_0x24bd8d['id'];if(_0x359cf3[_0xa1f6('0x51')]['filter']){_0x2e5702[_0xa1f6('0x59')]=_['merge'](_0x2e5702[_0xa1f6('0x59')],{'$or':_[_0xa1f6('0x4b')](_0x2e5702[_0xa1f6('0x55')],function(_0x4dc349){var _0x4f4ed9={};_0x4f4ed9[_0x4dc349]={'$like':'%'+_0x359cf3[_0xa1f6('0x51')][_0xa1f6('0x5d')]+'%'};return _0x4f4ed9;})});}if(_0x359cf3[_0xa1f6('0x51')][_0xa1f6('0xa3')]){var _0x4ea2a0=_0x359cf3[_0xa1f6('0x51')][_0xa1f6('0xa3')][_0xa1f6('0xa4')](',');var _0x2ad53e={};_0x2ad53e[_0x4ea2a0[0x0]]={'$gte':moment(_0x4ea2a0[0x1])[_0xa1f6('0xa5')](_0xa1f6('0xa6'))};_0x2e5702[_0xa1f6('0x59')]=_[_0xa1f6('0x5b')](_0x2e5702['where'],_0x2ad53e);}_0x2e5702=_[_0xa1f6('0x5b')]({},_0x2e5702,_0x359cf3['options']);return db[_0xa1f6('0xa2')][_0xa1f6('0x24')]({'where':_0x2e5702[_0xa1f6('0x59')]})[_0xa1f6('0x11')](function(_0xfc2ee5){_0x1da4cf['count']=_0xfc2ee5;if(_0x359cf3[_0xa1f6('0x51')]['includeAll']){_0x2e5702[_0xa1f6('0x65')]=[{'all':!![]}];}return db[_0xa1f6('0xa2')][_0xa1f6('0x60')](_0x2e5702);})[_0xa1f6('0x11')](function(_0x243004){if(_0x359cf3['query']['inlineCss']===_0xa1f6('0xa7')){for(var _0x57acf7=0x0;_0x57acf7<_0x243004[_0xa1f6('0x56')];_0x57acf7++){_0x243004[_0x57acf7][_0xa1f6('0x67')]=juice(_0x243004[_0x57acf7][_0xa1f6('0x67')]);}}_0x1da4cf[_0xa1f6('0x71')]=_0x243004;return _0x1da4cf;});}})[_0xa1f6('0x11')](respondWithFilteredResult(_0x463977,_0x2e5702))[_0xa1f6('0x1c')](handleError(_0x463977,null));};exports[_0xa1f6('0x2c')]=function(_0x31771e,_0x1e3655){var _0x4afe7a,_0x272540={},_0x2e6c2e;if(_0x31771e[_0xa1f6('0x67')]['to']){_0x2e6c2e=_0x31771e[_0xa1f6('0x67')]['to'][_0xa1f6('0xa4')](',')[0x0];}return db['MailAccount'][_0xa1f6('0x66')]({'where':{'id':_0x31771e[_0xa1f6('0x61')]['id']},'include':[{'model':db[_0xa1f6('0xa8')],'as':_0xa1f6('0xa9'),'include':[{'model':db[_0xa1f6('0x8d')],'as':_0xa1f6('0xaa'),'where':{'email':_0x2e6c2e},'limit':0x1,'order':[['updatedAt',_0xa1f6('0xab')]]}]},{'model':db[_0xa1f6('0x49')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa1f6('0xac')],'as':_0xa1f6('0xac'),'raw':!![]}]}]})[_0xa1f6('0x11')](handleEntityNotFound(_0x1e3655,null))[_0xa1f6('0x11')](function(_0x41a408){if(!_0x41a408)return;_0x4afe7a=_0x41a408;if(!_0x41a408[_0xa1f6('0x46')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x31771e[_0xa1f6('0x67')][_0xa1f6('0xad')])){_0x31771e['body'][_0xa1f6('0xad')]=util[_0xa1f6('0xa5')](_0xa1f6('0xae'),_0x41a408[_0xa1f6('0x2b')],_0x41a408[_0xa1f6('0xaf')]||_0x41a408[_0xa1f6('0x46')][_0xa1f6('0x3a')]);}if(_0x31771e[_0xa1f6('0x67')][_0xa1f6('0xb0')]&&_0x31771e['body'][_0xa1f6('0xb0')]['length']){for(var _0x34744c=0x0;_0x34744c<_0x31771e['body']['attachments'][_0xa1f6('0x56')];_0x34744c+=0x1){_0x31771e['body']['attachments'][_0x34744c]={'filename':_0x31771e['body'][_0xa1f6('0xb0')][_0x34744c][_0xa1f6('0x2b')],'path':path['join'](config[_0xa1f6('0xb1')],'server/files/attachments',_0x31771e[_0xa1f6('0x67')][_0xa1f6('0xb0')][_0x34744c]['basename'])};}}var _0x44a3a1=_0x41a408['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x44a3a1,'message':_0x31771e[_0xa1f6('0x67')]});})[_0xa1f6('0x11')](function(_0x5142b7){if(!_0x5142b7)return;_0x272540=_0x5142b7;if(!_0x4afe7a['List'])throw new Error('List\x20not\x20found');if(_0x4afe7a[_0xa1f6('0xa9')][_0xa1f6('0xaa')][_0xa1f6('0x56')])return _0x4afe7a[_0xa1f6('0xa9')][_0xa1f6('0xaa')][0x0];return db[_0xa1f6('0x8d')][_0xa1f6('0x78')](_[_0xa1f6('0xa')](_0x31771e['body'],{'firstName':_0x31771e[_0xa1f6('0x67')]['to'],'email':_0x31771e['body']['to'],'phone':_0x31771e[_0xa1f6('0x67')]['to'],'ListId':_0x4afe7a['ListId']}));})['then'](function(_0x2d8435){if(!_0x2d8435)return;var _0x1dab9c={'UserId':_0x31771e['user']['id'],'ContactId':_0x2d8435['id'],'MailAccountId':_0x4afe7a['id'],'inReplyTo':_0x272540[_0xa1f6('0xb2')],'to':_0x31771e[_0xa1f6('0x67')]['from'],'cc':_0x31771e['body']['cc'],'subject':_0x31771e['body'][_0xa1f6('0xb3')],'attach':_0x31771e[_0xa1f6('0x67')][_0xa1f6('0xb4')],'firstMsgDirection':_0xa1f6('0xb5'),'lastMsgAt':moment()[_0xa1f6('0xa5')](_0xa1f6('0xa6')),'lastMsgDirection':_0xa1f6('0xb5'),'Messages':[_[_0xa1f6('0x5b')](_0x31771e[_0xa1f6('0x67')],{'messageId':_0x272540['messageId'],'sentAt':moment()[_0xa1f6('0xa5')](_0xa1f6('0xa6')),'read':!![],'MailAccountId':_0x4afe7a['id'],'UserId':_0x31771e[_0xa1f6('0x3a')]['id'],'ContactId':_0x2d8435['id']})]};if(_0x31771e[_0xa1f6('0x67')]['Interaction']){_0x1dab9c=_[_0xa1f6('0x5b')](_0x1dab9c,_0x31771e['body'][_0xa1f6('0xb6')]);}return db[_0xa1f6('0x8a')]['create'](_0x1dab9c,{'include':[{'model':db[_0xa1f6('0xa2')],'as':_0xa1f6('0xb7')}]});})['then'](respondWithResult(_0x1e3655,null))[_0xa1f6('0x1c')](handleError(_0x1e3655,null));};exports[_0xa1f6('0xb8')]=function(_0x30a0f3,_0x15b144){return db[_0xa1f6('0x4c')][_0xa1f6('0x66')]({'where':{'id':_0x30a0f3['params']['id']},'include':[{'model':db[_0xa1f6('0x49')],'as':_0xa1f6('0x46'),'raw':!![],'include':[{'model':db[_0xa1f6('0xac')],'as':'CloudProvider','raw':!![]}]}]})[_0xa1f6('0x11')](handleEntityNotFound(_0x15b144,null))[_0xa1f6('0x11')](function(_0x1df79b){if(!_0x1df79b[_0xa1f6('0x46')])return;var _0x2b16a2=_0x1df79b[_0xa1f6('0xb9')]();return respondWithRpcPromise(_0xa1f6('0xba'),'verifySmtp',{'account':_0x2b16a2});})[_0xa1f6('0x11')](respondWithResult(_0x15b144,null))[_0xa1f6('0x1c')](handleError(_0x15b144,null));};exports[_0xa1f6('0x29')]=function(_0x191522,_0x10e1ce){return db[_0xa1f6('0x4c')][_0xa1f6('0x66')]({'where':{'id':_0x191522['params']['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x10e1ce,null))[_0xa1f6('0x11')](function(_0x1642d2){if(_0x1642d2&&_0x1642d2[_0xa1f6('0x43')]){throw new db[(_0xa1f6('0xbb'))][(_0xa1f6('0xbc'))](_0xa1f6('0xbd'));}return _0x1642d2;})[_0xa1f6('0x11')](removeEntity(_0x10e1ce,null))[_0xa1f6('0x1c')](handleError(_0x10e1ce,null));};exports[_0xa1f6('0xbe')]=function(_0xd3eea1,_0x29c425){return db[_0xa1f6('0x4c')][_0xa1f6('0x66')]({'where':{'id':_0xd3eea1[_0xa1f6('0x61')]['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x29c425,null))[_0xa1f6('0x11')](function(_0x40f1cf){if(_0x40f1cf){return _0x40f1cf['addAgents'](_0xd3eea1[_0xa1f6('0x67')]['ids'],_[_0xa1f6('0x8b')](_0xd3eea1[_0xa1f6('0x67')],['ids','id'])||{})[_0xa1f6('0xbf')](function(_0x43b4a3){for(var _0x51d12=0x0;_0x51d12<_0xd3eea1['body'][_0xa1f6('0x77')][_0xa1f6('0x56')];_0x51d12+=0x1){socket[_0xa1f6('0xc0')]('userMailAccount:save',{'UserId':Number(_0xd3eea1['body']['ids'][_0x51d12]),'MailAccountId':Number(_0xd3eea1['params']['id'])});}return _0x43b4a3;});}})[_0xa1f6('0x11')](respondWithResult(_0x29c425,null))[_0xa1f6('0x1c')](handleError(_0x29c425,null));};exports[_0xa1f6('0xc1')]=function(_0x2198d3,_0x31291e){return db[_0xa1f6('0x4c')][_0xa1f6('0x66')]({'where':{'id':_0x2198d3[_0xa1f6('0x61')]['id']}})['then'](handleEntityNotFound(_0x31291e,null))[_0xa1f6('0x11')](function(_0x3921fd){if(_0x3921fd){return _0x3921fd['removeAgents'](_0x2198d3[_0xa1f6('0x51')][_0xa1f6('0x77')])[_0xa1f6('0x11')](function(){if(_[_0xa1f6('0xc2')](_0x2198d3['query'][_0xa1f6('0x77')])){for(var _0x29c43d=0x0;_0x29c43d<_0x2198d3[_0xa1f6('0x51')][_0xa1f6('0x77')][_0xa1f6('0x56')];_0x29c43d+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2198d3[_0xa1f6('0x51')][_0xa1f6('0x77')][_0x29c43d]),'MailAccountId':Number(_0x2198d3[_0xa1f6('0x61')]['id'])});}}else{socket[_0xa1f6('0xc0')](_0xa1f6('0xc3'),{'UserId':Number(_0x2198d3[_0xa1f6('0x51')][_0xa1f6('0x77')]),'MailAccountId':Number(_0x2198d3[_0xa1f6('0x61')]['id'])});}});}})[_0xa1f6('0x11')](respondWithStatusCode(_0x31291e,null))['catch'](handleError(_0x31291e,null));};exports[_0xa1f6('0xc4')]=function(_0x5c7205,_0x2ae390){var _0x205268={};var _0x49dd5c={};var _0x2eadec;var _0x8e94c6;return db[_0xa1f6('0x4c')]['findOne']({'where':{'id':_0x5c7205[_0xa1f6('0x61')]['id']}})[_0xa1f6('0x11')](handleEntityNotFound(_0x2ae390,null))[_0xa1f6('0x11')](function(_0x56aaf3){if(_0x56aaf3){_0x2eadec=_0x56aaf3;_0x49dd5c['model']=_[_0xa1f6('0x52')](db[_0xa1f6('0x8e')][_0xa1f6('0x63')]);_0x49dd5c[_0xa1f6('0x51')]=_['keys'](_0x5c7205[_0xa1f6('0x51')]);_0x49dd5c['filters']=_[_0xa1f6('0x54')](_0x49dd5c[_0xa1f6('0x50')],_0x49dd5c['query']);_0x205268[_0xa1f6('0x55')]=_['intersection'](_0x49dd5c['model'],qs[_0xa1f6('0x64')](_0x5c7205[_0xa1f6('0x51')][_0xa1f6('0x64')]));_0x205268[_0xa1f6('0x55')]=_0x205268[_0xa1f6('0x55')]['length']?_0x205268[_0xa1f6('0x55')]:_0x49dd5c[_0xa1f6('0x50')];_0x205268[_0xa1f6('0x70')]=qs[_0xa1f6('0x58')](_0x5c7205[_0xa1f6('0x51')][_0xa1f6('0x58')]);_0x205268[_0xa1f6('0x59')]=qs[_0xa1f6('0x53')](_[_0xa1f6('0x5a')](_0x5c7205[_0xa1f6('0x51')],_0x49dd5c['filters']));if(_0x5c7205[_0xa1f6('0x51')][_0xa1f6('0x5d')]){_0x205268[_0xa1f6('0x59')]=_[_0xa1f6('0x5b')](_0x205268[_0xa1f6('0x59')],{'$or':_[_0xa1f6('0x4b')](_0x205268[_0xa1f6('0x55')],function(_0x4602cd){var _0x3657ec={};_0x3657ec[_0x4602cd]={'$like':'%'+_0x5c7205[_0xa1f6('0x51')][_0xa1f6('0x5d')]+'%'};return _0x3657ec;})});}_0x205268=_['merge']({},_0x205268,_0x5c7205[_0xa1f6('0x5e')]);return _0x2eadec[_0xa1f6('0xc4')](_0x205268);}})[_0xa1f6('0x11')](function(_0x158623){if(_0x158623){_0x8e94c6=_0x158623[_0xa1f6('0x56')];if(!_0x5c7205['query'][_0xa1f6('0x6f')](_0xa1f6('0x57'))){_0x205268[_0xa1f6('0x22')]=qs[_0xa1f6('0x22')](_0x5c7205['query'][_0xa1f6('0x22')]);_0x205268[_0xa1f6('0x21')]=qs[_0xa1f6('0x21')](_0x5c7205[_0xa1f6('0x51')]['offset']);}return _0x2eadec[_0xa1f6('0xc4')](_0x205268);}})[_0xa1f6('0x11')](function(_0x31d1cd){if(_0x31d1cd){return _0x31d1cd?{'count':_0x8e94c6,'rows':_0x31d1cd}:null;}})[_0xa1f6('0x11')](respondWithResult(_0x2ae390,null))[_0xa1f6('0x1c')](handleError(_0x2ae390,null));}; \ No newline at end of file +var _0x25ac=['fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','MailAccount','rawAttributes','length','body','provider','custom','find','params','MailServerIn','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','request\x20sent','debug','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','json','undefined','limit','count','offset','status','update','destroy','get','MailAccounts','UserProfileResource','end','sendStatus','stack','name','send','gmail','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','password','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','fieldName','key','model','keys','filters','query','attributes','intersection'];(function(_0x2ab7c4,_0x4cd0be){var _0x45e2a0=function(_0x3ec053){while(--_0x3ec053){_0x2ab7c4['push'](_0x2ab7c4['shift']());}};_0x45e2a0(++_0x4cd0be);}(_0x25ac,0x75));var _0xc25a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25ac[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xc25a('0x0'));var BPromise=require(_0xc25a('0x1'));var util=require(_0xc25a('0x2'));var path=require(_0xc25a('0x3'));var _=require(_0xc25a('0x4'));var juice=require(_0xc25a('0x5'));var Redis=require(_0xc25a('0x6'));var qs=require(_0xc25a('0x7'));var logger=require(_0xc25a('0x8'))(_0xc25a('0x9'));var config=require(_0xc25a('0xa'));var db=require(_0xc25a('0xb'))['db'];config[_0xc25a('0xc')]=_[_0xc25a('0xd')](config[_0xc25a('0xc')],{'host':_0xc25a('0xe'),'port':0x18eb});var socket=require(_0xc25a('0xf'))(new Redis(config[_0xc25a('0xc')]));require(_0xc25a('0x10'))[_0xc25a('0x11')](socket);var jayson=require(_0xc25a('0x12'));var client=jayson['client'][_0xc25a('0x13')]({'port':0x232b});function respondWithRpcPromise(_0x1531b9,_0x3c817a,_0xaea29c,_0x6dc4a0){return new BPromise(function(_0x10d673,_0x33db5b){var _0x899001=_0x6dc4a0||client;return _0x899001[_0xc25a('0x14')](_0x1531b9,_0xaea29c)[_0xc25a('0x15')](function(_0x135eaa){logger['info']('MailAccount,\x20%s,\x20%s',_0x3c817a,_0xc25a('0x16'));logger[_0xc25a('0x17')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3c817a,_0xc25a('0x16'),JSON['stringify'](_0x135eaa));if(_0x135eaa[_0xc25a('0x18')]){if(_0x135eaa[_0xc25a('0x18')][_0xc25a('0x19')]===0x1f4){logger[_0xc25a('0x18')](_0xc25a('0x1a'),_0x3c817a,_0x135eaa[_0xc25a('0x18')]['message']);return _0x33db5b(_0x135eaa['error'][_0xc25a('0x1b')]);}logger[_0xc25a('0x18')]('MailAccount,\x20%s,\x20%s',_0x3c817a,_0x135eaa[_0xc25a('0x18')][_0xc25a('0x1b')]);return _0x10d673(_0x135eaa['error'][_0xc25a('0x1b')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x3c817a,_0xc25a('0x16'));_0x10d673(_0x135eaa[_0xc25a('0x1c')][_0xc25a('0x1b')]);}})[_0xc25a('0x1d')](function(_0x10b9a8){logger[_0xc25a('0x18')](_0xc25a('0x1a'),_0x3c817a,_0x10b9a8);_0x33db5b(_0x10b9a8);});});}function respondWithStatusCode(_0x58774b,_0x335581){_0x335581=_0x335581||0xcc;return function(_0x3b4b69){if(_0x3b4b69){return _0x58774b['sendStatus'](_0x335581);}return _0x58774b['status'](_0x335581)['end']();};}function respondWithResult(_0x476791,_0x1438b2){_0x1438b2=_0x1438b2||0xc8;return function(_0x5a5f7e){if(_0x5a5f7e){return _0x476791['status'](_0x1438b2)[_0xc25a('0x1e')](_0x5a5f7e);}};}function respondWithFilteredResult(_0x2da317,_0x498990){return function(_0x30b438){if(_0x30b438){var _0x5e2af2=typeof _0x498990['offset']===_0xc25a('0x1f')&&typeof _0x498990[_0xc25a('0x20')]===_0xc25a('0x1f');var _0x42bec7=_0x30b438[_0xc25a('0x21')];var _0x45564c=_0x5e2af2?0x0:_0x498990[_0xc25a('0x22')];var _0x270784=_0x5e2af2?_0x30b438[_0xc25a('0x21')]:_0x498990[_0xc25a('0x22')]+_0x498990[_0xc25a('0x20')];var _0x5238b9;if(_0x270784>=_0x42bec7){_0x270784=_0x42bec7;_0x5238b9=0xc8;}else{_0x5238b9=0xce;}_0x2da317[_0xc25a('0x23')](_0x5238b9);return _0x2da317['set']('Content-Range',_0x45564c+'-'+_0x270784+'/'+_0x42bec7)[_0xc25a('0x1e')](_0x30b438);}return null;};}function saveUpdates(_0x3066c7){return function(_0x16289a){if(_0x16289a){return _0x16289a[_0xc25a('0x24')](_0x3066c7)[_0xc25a('0x15')](function(_0x22e9c0){return _0x22e9c0;});}return null;};}function removeEntity(_0x1ce1b8){return function(_0x1fabfc){if(_0x1fabfc){return _0x1fabfc[_0xc25a('0x25')]()[_0xc25a('0x15')](function(){var _0x8ff885=_0x1fabfc[_0xc25a('0x26')]({'plain':!![]});var _0x3937dc=_0xc25a('0x27');return db[_0xc25a('0x28')][_0xc25a('0x25')]({'where':{'type':_0x3937dc,'resourceId':_0x8ff885['id']}})[_0xc25a('0x15')](function(){return _0x1fabfc;});})[_0xc25a('0x15')](function(){_0x1ce1b8[_0xc25a('0x23')](0xcc)[_0xc25a('0x29')]();});}};}function handleEntityNotFound(_0x1bb8fc){return function(_0x415e62){if(!_0x415e62){_0x1bb8fc[_0xc25a('0x2a')](0x194);}return _0x415e62;};}function handleError(_0x2c83c1,_0x1a2923){_0x1a2923=_0x1a2923||0x1f4;return function(_0x48461f){logger[_0xc25a('0x18')](_0x48461f[_0xc25a('0x2b')]);if(_0x48461f['name']){delete _0x48461f[_0xc25a('0x2c')];}_0x2c83c1[_0xc25a('0x23')](_0x1a2923)[_0xc25a('0x2d')](_0x48461f);};}function getImapHost(_0x4084f5){switch(_0x4084f5){case _0xc25a('0x2e'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0xc25a('0x2f'):return _0xc25a('0x30');case _0xc25a('0x31'):return _0xc25a('0x32');}throw new Error(_0xc25a('0x33'),_0x4084f5);}function getSmtpHost(_0x29b5c7){switch(_0x29b5c7){case'gmail':return _0xc25a('0x34');case'yahoo':return'smtp.mail.yahoo.com';case _0xc25a('0x2f'):return _0xc25a('0x35');case _0xc25a('0x31'):return _0xc25a('0x36');}throw new Error(_0xc25a('0x33'),_0x29b5c7);}function getAuthenticationOptions(_0x4be19d,_0x4f18c1){var _0x506499={};var _0x33d05d={};if(_0x4be19d){_0x506499[_0xc25a('0x37')]=_0x33d05d[_0xc25a('0x37')]=_0x4f18c1[_0xc25a('0x38')];_0x506499['password']=_0x33d05d[_0xc25a('0x39')]=_0x4f18c1['password'];if(_0x4f18c1[_0xc25a('0x3a')]){_0x506499[_0xc25a('0x3a')]=_0x33d05d[_0xc25a('0x3a')]=!![];_0x506499[_0xc25a('0x3b')]=_0x33d05d[_0xc25a('0x3b')]=_0x4f18c1[_0xc25a('0x3b')];_0x506499['password']=_0x33d05d[_0xc25a('0x39')]=null;}else{_0x506499[_0xc25a('0x3b')]=_0x33d05d[_0xc25a('0x3b')]=null;}_0x506499[_0xc25a('0x3c')]=getImapHost(_0x4be19d);_0x506499[_0xc25a('0x3d')]=0x3e1;_0x33d05d['host']=getSmtpHost(_0x4be19d);_0x33d05d[_0xc25a('0x3d')]=0x24b;_0x33d05d[_0xc25a('0x3e')]=![];_0x506499[_0xc25a('0x3f')]=_0x33d05d[_0xc25a('0x3f')]=null;}else{if(_0x4f18c1[_0xc25a('0x40')]){_0x506499[_0xc25a('0x37')]=_0x33d05d[_0xc25a('0x37')]=_0x4f18c1[_0xc25a('0x38')];_0x506499[_0xc25a('0x41')]=_0x33d05d[_0xc25a('0x39')]=_0x4f18c1[_0xc25a('0x41')];}else{_0x506499['authentication']=_0x33d05d[_0xc25a('0x40')]=![];_0x506499[_0xc25a('0x37')]=_0x33d05d[_0xc25a('0x37')]=null;_0x506499[_0xc25a('0x41')]=_0x33d05d[_0xc25a('0x39')]=null;}_0x506499[_0xc25a('0x3c')]=_0x4f18c1[_0xc25a('0x42')][_0xc25a('0x3c')];_0x506499['port']=_0x4f18c1[_0xc25a('0x42')][_0xc25a('0x3d')];_0x33d05d[_0xc25a('0x3c')]=_0x4f18c1[_0xc25a('0x43')][_0xc25a('0x3c')];_0x33d05d[_0xc25a('0x3d')]=_0x4f18c1[_0xc25a('0x43')][_0xc25a('0x3d')];}return{'Imap':_0x506499,'Smtp':_0x33d05d};}exports[_0xc25a('0x44')]=function(_0x33bd81,_0x400ff9){var _0xf34f72={'include':[{'model':db['MailServerIn'],'as':_0xc25a('0x42')},{'model':db[_0xc25a('0x45')],'as':_0xc25a('0x43')},{'model':db[_0xc25a('0x46')],'as':_0xc25a('0x47')}]},_0x1c997d={},_0x12da07={'count':0x0,'rows':[]};var _0x4f3e13=_[_0xc25a('0x48')](db['MailAccount']['rawAttributes'],function(_0x352e81){return{'name':_0x352e81[_0xc25a('0x49')],'type':_0x352e81['type'][_0xc25a('0x4a')]};});_0x1c997d[_0xc25a('0x4b')]=_[_0xc25a('0x48')](_0x4f3e13,'name');_0x1c997d['query']=_[_0xc25a('0x4c')](_0x33bd81['query']);_0x1c997d[_0xc25a('0x4d')]=_['intersection'](_0x1c997d[_0xc25a('0x4b')],_0x1c997d[_0xc25a('0x4e')]);_0xf34f72[_0xc25a('0x4f')]=_[_0xc25a('0x50')](_0x1c997d[_0xc25a('0x4b')],qs[_0xc25a('0x51')](_0x33bd81[_0xc25a('0x4e')][_0xc25a('0x51')]));_0xf34f72[_0xc25a('0x4f')]=_0xf34f72[_0xc25a('0x4f')]['length']?_0xf34f72['attributes']:_0x1c997d[_0xc25a('0x4b')];if(!_0x33bd81[_0xc25a('0x4e')][_0xc25a('0x52')]('nolimit')){_0xf34f72['limit']=qs[_0xc25a('0x20')](_0x33bd81['query'][_0xc25a('0x20')]);_0xf34f72[_0xc25a('0x22')]=qs['offset'](_0x33bd81['query']['offset']);}_0xf34f72[_0xc25a('0x53')]=qs[_0xc25a('0x54')](_0x33bd81['query'][_0xc25a('0x54')]);_0xf34f72[_0xc25a('0x55')]=qs[_0xc25a('0x4d')](_[_0xc25a('0x56')](_0x33bd81['query'],_0x1c997d[_0xc25a('0x4d')]),_0x4f3e13);if(_0x33bd81['query'][_0xc25a('0x57')]){_0xf34f72['where']=_[_0xc25a('0x58')](_0xf34f72[_0xc25a('0x55')],{'$or':_['map'](_0x4f3e13,function(_0x4ede86){if(_0x4ede86[_0xc25a('0x59')]!==_0xc25a('0x5a')){var _0x4a6172={};_0x4a6172[_0x4ede86['name']]={'$like':'%'+_0x33bd81[_0xc25a('0x4e')]['filter']+'%'};return _0x4a6172;}})});}_0xf34f72=_[_0xc25a('0x58')]({},_0xf34f72,_0x33bd81[_0xc25a('0x5b')]);var _0x1a1d99={'where':_0xf34f72['where']};return db['MailAccount'][_0xc25a('0x21')](_0x1a1d99)[_0xc25a('0x15')](function(_0x38762b){_0x12da07[_0xc25a('0x21')]=_0x38762b;if(_0x33bd81[_0xc25a('0x4e')][_0xc25a('0x5c')]){_0xf34f72[_0xc25a('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0xc25a('0x5e')](_0xf34f72);})['then'](function(_0x48ba19){_0x12da07[_0xc25a('0x5f')]=_0x48ba19;return _0x12da07;})['then'](respondWithFilteredResult(_0x400ff9,_0xf34f72))[_0xc25a('0x1d')](handleError(_0x400ff9,null));};exports[_0xc25a('0x60')]=function(_0xd607f2,_0x3d2e9c){var _0x51edb6={'raw':![],'where':{'id':_0xd607f2['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xc25a('0x42')},{'model':db[_0xc25a('0x45')],'as':_0xc25a('0x43')},{'model':db[_0xc25a('0x46')],'as':_0xc25a('0x47')}]},_0x3d8947={};_0x3d8947['model']=_[_0xc25a('0x4c')](db[_0xc25a('0x61')][_0xc25a('0x62')]);_0x3d8947['query']=_['keys'](_0xd607f2['query']);_0x3d8947['filters']=_[_0xc25a('0x50')](_0x3d8947[_0xc25a('0x4b')],_0x3d8947[_0xc25a('0x4e')]);_0x51edb6['attributes']=_[_0xc25a('0x50')](_0x3d8947[_0xc25a('0x4b')],qs[_0xc25a('0x51')](_0xd607f2[_0xc25a('0x4e')][_0xc25a('0x51')]));_0x51edb6['attributes']=_0x51edb6['attributes'][_0xc25a('0x63')]?_0x51edb6['attributes']:_0x3d8947['model'];if(_0xd607f2[_0xc25a('0x4e')]['includeAll']){_0x51edb6[_0xc25a('0x5d')]=[{'all':!![]}];}_0x51edb6=_[_0xc25a('0x58')]({},_0x51edb6,_0xd607f2['options']);return db['MailAccount']['find'](_0x51edb6)[_0xc25a('0x15')](handleEntityNotFound(_0x3d2e9c,null))[_0xc25a('0x15')](respondWithResult(_0x3d2e9c,null))[_0xc25a('0x1d')](handleError(_0x3d2e9c,null));};exports[_0xc25a('0x24')]=function(_0x1037b4,_0x584b9b){if(_0x1037b4[_0xc25a('0x64')]['id']){delete _0x1037b4[_0xc25a('0x64')]['id'];}var _0x22b2fd=_0x1037b4['body'][_0xc25a('0x65')]===_0xc25a('0x66')?null:_0x1037b4[_0xc25a('0x64')][_0xc25a('0x65')];var _0x565381=_0x1037b4[_0xc25a('0x64')][_0xc25a('0x42')]||{};var _0x4b88b2=_0x1037b4['body'][_0xc25a('0x43')]||{};if(_0x22b2fd){_0x565381[_0xc25a('0x3c')]=getImapHost(_0x22b2fd);_0x565381[_0xc25a('0x3d')]=0x3e1;_0x4b88b2[_0xc25a('0x3c')]=getSmtpHost(_0x22b2fd);_0x4b88b2['port']=0x24b;_0x4b88b2[_0xc25a('0x3e')]=![];}if(_0x4b88b2[_0xc25a('0x3a')]){_0x4b88b2[_0xc25a('0x3e')]=![];}else{_0x4b88b2[_0xc25a('0x3b')]=null;}if(!_0x565381[_0xc25a('0x3a')])_0x565381['CloudProviderId']=null;_0x1037b4[_0xc25a('0x64')]['Imap']=_0x565381;_0x1037b4[_0xc25a('0x64')][_0xc25a('0x43')]=_0x4b88b2;return db['MailAccount'][_0xc25a('0x67')]({'where':{'id':_0x1037b4[_0xc25a('0x68')]['id']},'include':[{'model':db[_0xc25a('0x69')],'as':_0xc25a('0x42')},{'model':db[_0xc25a('0x45')],'as':'Smtp'},{'model':db[_0xc25a('0x46')],'as':_0xc25a('0x47')}]})[_0xc25a('0x15')](handleEntityNotFound(_0x584b9b,null))[_0xc25a('0x15')](function(_0x50a1a3){if(!_0x50a1a3)throw new Error(_0xc25a('0x6a'));if(_0x50a1a3['service'])delete _0x1037b4[_0xc25a('0x64')][_0xc25a('0x42')];return _0x50a1a3;})[_0xc25a('0x15')](saveUpdates(_0x1037b4[_0xc25a('0x64')],null))[_0xc25a('0x15')](function(_0x4e7361){if(!_0x1037b4['body'][_0xc25a('0x42')])return _0x4e7361;return db['MailServerIn'][_0xc25a('0x24')](_0x1037b4[_0xc25a('0x64')][_0xc25a('0x42')],{'where':{'MailAccountId':_0x4e7361['id']}})['then'](function(){return _0x4e7361;});})[_0xc25a('0x15')](function(_0x3b5c1c){if(!_0x1037b4['body'][_0xc25a('0x43')])return _0x3b5c1c;return db[_0xc25a('0x45')][_0xc25a('0x24')](_0x1037b4['body']['Smtp'],{'where':{'MailAccountId':_0x3b5c1c['id']}})[_0xc25a('0x15')](function(){return _0x3b5c1c;});})[_0xc25a('0x15')](respondWithResult(_0x584b9b,null))['catch'](handleError(_0x584b9b,null));};exports[_0xc25a('0x6b')]=function(_0x45b8f8,_0x3b8391){return db['MailAccount'][_0xc25a('0x6b')]()[_0xc25a('0x15')](respondWithResult(_0x3b8391,null))[_0xc25a('0x1d')](handleError(_0x3b8391,null));};exports[_0xc25a('0x6c')]=function(_0x3918b4,_0x3ef5ee){if(_0x3918b4[_0xc25a('0x64')]['id']){delete _0x3918b4[_0xc25a('0x64')]['id'];}return db[_0xc25a('0x61')]['find']({'where':{'id':_0x3918b4[_0xc25a('0x68')]['id']}})['then'](handleEntityNotFound(_0x3ef5ee,null))[_0xc25a('0x15')](function(_0x18ead5){if(_0x18ead5){_0x3918b4[_0xc25a('0x64')][_0xc25a('0x6d')]=_0x18ead5['id'];return db['Disposition'][_0xc25a('0x6e')](_0x3918b4[_0xc25a('0x64')]);}})[_0xc25a('0x15')](respondWithResult(_0x3ef5ee,null))[_0xc25a('0x1d')](handleError(_0x3ef5ee,null));};exports[_0xc25a('0x6f')]=function(_0x570545,_0x45103b){var _0x50f497={'raw':![],'where':{}};var _0xb8dd73={};var _0x5850d4={'count':0x0,'rows':[]};return db[_0xc25a('0x61')][_0xc25a('0x70')]({'where':{'id':_0x570545['params']['id']}})['then'](handleEntityNotFound(_0x45103b,null))[_0xc25a('0x15')](function(_0x3b232a){if(_0x3b232a){_0xb8dd73['model']=_['keys'](db[_0xc25a('0x71')][_0xc25a('0x62')]);_0xb8dd73[_0xc25a('0x4e')]=_[_0xc25a('0x4c')](_0x570545[_0xc25a('0x4e')]);_0xb8dd73['filters']=_[_0xc25a('0x50')](_0xb8dd73[_0xc25a('0x4b')],_0xb8dd73[_0xc25a('0x4e')]);_0x50f497[_0xc25a('0x4f')]=_[_0xc25a('0x50')](_0xb8dd73['model'],qs[_0xc25a('0x51')](_0x570545[_0xc25a('0x4e')]['fields']));_0x50f497['attributes']=_0x50f497[_0xc25a('0x4f')]['length']?_0x50f497[_0xc25a('0x4f')]:_0xb8dd73[_0xc25a('0x4b')];if(!_0x570545[_0xc25a('0x4e')][_0xc25a('0x52')](_0xc25a('0x72'))){_0x50f497[_0xc25a('0x20')]=qs[_0xc25a('0x20')](_0x570545['query'][_0xc25a('0x20')]);_0x50f497['offset']=qs[_0xc25a('0x22')](_0x570545[_0xc25a('0x4e')]['offset']);}_0x50f497['order']=qs[_0xc25a('0x54')](_0x570545[_0xc25a('0x4e')]['sort']);_0x50f497[_0xc25a('0x55')]=qs[_0xc25a('0x4d')](_[_0xc25a('0x56')](_0x570545[_0xc25a('0x4e')],_0xb8dd73[_0xc25a('0x4d')]));_0x50f497[_0xc25a('0x55')][_0xc25a('0x6d')]=_0x3b232a['id'];if(_0x570545[_0xc25a('0x4e')][_0xc25a('0x57')]){_0x50f497['where']=_[_0xc25a('0x58')](_0x50f497[_0xc25a('0x55')],{'$or':_[_0xc25a('0x48')](_0x50f497[_0xc25a('0x4f')],function(_0x36cb1b){var _0x2ad1e9={};_0x2ad1e9[_0x36cb1b]={'$like':'%'+_0x570545[_0xc25a('0x4e')][_0xc25a('0x57')]+'%'};return _0x2ad1e9;})});}_0x50f497=_['merge']({},_0x50f497,_0x570545[_0xc25a('0x5b')]);return db[_0xc25a('0x71')][_0xc25a('0x21')]({'where':_0x50f497[_0xc25a('0x55')]})['then'](function(_0x188d02){_0x5850d4[_0xc25a('0x21')]=_0x188d02;if(_0x570545[_0xc25a('0x4e')][_0xc25a('0x5c')]){_0x50f497[_0xc25a('0x5d')]=[{'all':!![]}];}return db[_0xc25a('0x71')][_0xc25a('0x5e')](_0x50f497);})['then'](function(_0x3ee60f){_0x5850d4[_0xc25a('0x5f')]=_0x3ee60f;return _0x5850d4;});}})['then'](respondWithFilteredResult(_0x45103b,_0x50f497))[_0xc25a('0x1d')](handleError(_0x45103b,null));};exports[_0xc25a('0x73')]=function(_0x466458,_0x32eb9c){return db[_0xc25a('0x61')][_0xc25a('0x67')]({'where':{'id':_0x466458[_0xc25a('0x68')]['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x32eb9c,null))[_0xc25a('0x15')](function(_0x57dc31){if(_0x57dc31){return _0x57dc31['removeDispositions'](_0x466458[_0xc25a('0x4e')][_0xc25a('0x74')]);}})[_0xc25a('0x15')](respondWithStatusCode(_0x32eb9c,null))[_0xc25a('0x1d')](handleError(_0x32eb9c,null));};exports['addAnswer']=function(_0xe5e656,_0x417107){if(_0xe5e656[_0xc25a('0x64')]['id']){delete _0xe5e656[_0xc25a('0x64')]['id'];}return db[_0xc25a('0x61')][_0xc25a('0x67')]({'where':{'id':_0xe5e656['params']['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x417107,null))['then'](function(_0x17f3af){if(_0x17f3af){_0xe5e656[_0xc25a('0x64')][_0xc25a('0x6d')]=_0x17f3af['id'];return db[_0xc25a('0x75')][_0xc25a('0x6e')](_0xe5e656[_0xc25a('0x64')]);}})[_0xc25a('0x15')](respondWithResult(_0x417107,null))['catch'](handleError(_0x417107,null));};exports[_0xc25a('0x76')]=function(_0x41ace6,_0xfa11e5){var _0x4256da={'raw':![],'where':{}};var _0x432281={};var _0x1c3f46={'count':0x0,'rows':[]};return db['MailAccount'][_0xc25a('0x70')]({'where':{'id':_0x41ace6[_0xc25a('0x68')]['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0xfa11e5,null))[_0xc25a('0x15')](function(_0x48bcae){if(_0x48bcae){_0x432281[_0xc25a('0x4b')]=_[_0xc25a('0x4c')](db['CannedAnswer']['rawAttributes']);_0x432281[_0xc25a('0x4e')]=_[_0xc25a('0x4c')](_0x41ace6[_0xc25a('0x4e')]);_0x432281[_0xc25a('0x4d')]=_[_0xc25a('0x50')](_0x432281[_0xc25a('0x4b')],_0x432281[_0xc25a('0x4e')]);_0x4256da[_0xc25a('0x4f')]=_['intersection'](_0x432281[_0xc25a('0x4b')],qs['fields'](_0x41ace6['query']['fields']));_0x4256da[_0xc25a('0x4f')]=_0x4256da[_0xc25a('0x4f')][_0xc25a('0x63')]?_0x4256da[_0xc25a('0x4f')]:_0x432281[_0xc25a('0x4b')];if(!_0x41ace6[_0xc25a('0x4e')][_0xc25a('0x52')](_0xc25a('0x72'))){_0x4256da['limit']=qs[_0xc25a('0x20')](_0x41ace6[_0xc25a('0x4e')][_0xc25a('0x20')]);_0x4256da[_0xc25a('0x22')]=qs[_0xc25a('0x22')](_0x41ace6[_0xc25a('0x4e')][_0xc25a('0x22')]);}_0x4256da[_0xc25a('0x53')]=qs[_0xc25a('0x54')](_0x41ace6[_0xc25a('0x4e')][_0xc25a('0x54')]);_0x4256da[_0xc25a('0x55')]=qs[_0xc25a('0x4d')](_[_0xc25a('0x56')](_0x41ace6[_0xc25a('0x4e')],_0x432281[_0xc25a('0x4d')]));_0x4256da['where'][_0xc25a('0x6d')]=_0x48bcae['id'];if(_0x41ace6['query'][_0xc25a('0x57')]){_0x4256da[_0xc25a('0x55')]=_[_0xc25a('0x58')](_0x4256da['where'],{'$or':_[_0xc25a('0x48')](_0x4256da['attributes'],function(_0x951362){var _0x1f28e7={};_0x1f28e7[_0x951362]={'$like':'%'+_0x41ace6[_0xc25a('0x4e')][_0xc25a('0x57')]+'%'};return _0x1f28e7;})});}_0x4256da=_['merge']({},_0x4256da,_0x41ace6[_0xc25a('0x5b')]);return db[_0xc25a('0x75')]['count']({'where':_0x4256da[_0xc25a('0x55')]})[_0xc25a('0x15')](function(_0x2e9b61){_0x1c3f46[_0xc25a('0x21')]=_0x2e9b61;if(_0x41ace6[_0xc25a('0x4e')][_0xc25a('0x5c')]){_0x4256da['include']=[{'all':!![]}];}return db[_0xc25a('0x75')]['findAll'](_0x4256da);})['then'](function(_0x46fb19){_0x1c3f46[_0xc25a('0x5f')]=_0x46fb19;return _0x1c3f46;});}})[_0xc25a('0x15')](respondWithFilteredResult(_0xfa11e5,_0x4256da))[_0xc25a('0x1d')](handleError(_0xfa11e5,null));};exports[_0xc25a('0x77')]=function(_0x35e753,_0x4d93dd){return db['MailAccount'][_0xc25a('0x67')]({'where':{'id':_0x35e753['params']['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x4d93dd,null))[_0xc25a('0x15')](function(_0x4c5057){if(_0x4c5057){return _0x4c5057[_0xc25a('0x77')](_0x35e753[_0xc25a('0x4e')]['ids']);}})[_0xc25a('0x15')](respondWithStatusCode(_0x4d93dd,null))['catch'](handleError(_0x4d93dd,null));};exports[_0xc25a('0x6e')]=function(_0x1df9d3,_0x3aa0d4){var _0xba2255={'name':_0x1df9d3[_0xc25a('0x64')]['name'],'key':_0x1df9d3[_0xc25a('0x64')]['key'],'provider':_0x1df9d3[_0xc25a('0x64')][_0xc25a('0x65')]==='custom'?null:_0x1df9d3[_0xc25a('0x64')][_0xc25a('0x65')],'email':_0x1df9d3[_0xc25a('0x64')]['email'],'ListId':_0x1df9d3[_0xc25a('0x64')]['ListId'],'active':!_[_0xc25a('0x78')](_0x1df9d3[_0xc25a('0x64')][_0xc25a('0x79')])?_0x1df9d3[_0xc25a('0x64')][_0xc25a('0x79')]:!![],'description':_0x1df9d3[_0xc25a('0x64')][_0xc25a('0x7a')]||null};var _0x23798b=getAuthenticationOptions(_0xba2255[_0xc25a('0x65')],_0x1df9d3[_0xc25a('0x64')]);_0xba2255[_0xc25a('0x42')]=_0x23798b[_0xc25a('0x42')];_0xba2255[_0xc25a('0x43')]=_0x23798b[_0xc25a('0x43')];return db[_0xc25a('0x61')][_0xc25a('0x6e')](_0xba2255,{'include':[{'model':db[_0xc25a('0x45')],'as':'Smtp'},{'model':db[_0xc25a('0x69')],'as':_0xc25a('0x42')}]})[_0xc25a('0x15')](function(_0x18359f){var _0x3cfd1f=_0x1df9d3[_0xc25a('0x37')][_0xc25a('0x26')]({'plain':!![]});if(!_0x3cfd1f)throw new Error(_0xc25a('0x7b'));if(_0x3cfd1f[_0xc25a('0x7c')]===_0xc25a('0x37')){var _0x3cf506=_0x18359f['get']({'plain':!![]});return db['UserProfileSection'][_0xc25a('0x67')]({'where':{'name':_0xc25a('0x27'),'userProfileId':_0x3cfd1f[_0xc25a('0x7d')]},'raw':!![]})[_0xc25a('0x15')](function(_0x2107ae){if(_0x2107ae&&_0x2107ae[_0xc25a('0x7e')]===0x0){return db[_0xc25a('0x28')][_0xc25a('0x6e')]({'name':_0x3cf506[_0xc25a('0x2c')],'resourceId':_0x3cf506['id'],'type':_0x2107ae[_0xc25a('0x2c')],'sectionId':_0x2107ae['id']},{})[_0xc25a('0x15')](function(){return _0x18359f;});}else{return _0x18359f;}})[_0xc25a('0x1d')](function(_0x585bdc){logger[_0xc25a('0x18')](_0xc25a('0x7f'),_0x585bdc);throw _0x585bdc;});}return _0x18359f;})[_0xc25a('0x15')](respondWithResult(_0x3aa0d4,0xc9))['catch'](handleError(_0x3aa0d4,null));};exports[_0xc25a('0x80')]=function(_0x4b6a88,_0x4b395c){return db[_0xc25a('0x61')][_0xc25a('0x70')]({'where':{'id':_0x4b6a88[_0xc25a('0x68')]['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x4b395c,null))['then'](function(_0x4ad8c7){if(_0x4ad8c7){return _0x4ad8c7[_0xc25a('0x80')]();}return null;})[_0xc25a('0x15')](respondWithResult(_0x4b395c,null))['catch'](handleError(_0x4b395c,null));};exports[_0xc25a('0x81')]=function(_0x48c80b,_0x4112d5){if(_0x48c80b[_0xc25a('0x64')]['id']){delete _0x48c80b[_0xc25a('0x64')]['id'];}return db[_0xc25a('0x61')]['find']({'where':{'id':_0x48c80b[_0xc25a('0x68')]['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x4112d5,null))[_0xc25a('0x15')](function(_0x24ea80){if(_0x24ea80){_0x48c80b[_0xc25a('0x64')][_0xc25a('0x6d')]=_0x24ea80['id'];return db[_0xc25a('0x69')][_0xc25a('0x6e')](_0x48c80b[_0xc25a('0x64')]);}})[_0xc25a('0x15')](respondWithResult(_0x4112d5,null))[_0xc25a('0x1d')](handleError(_0x4112d5,null));};exports[_0xc25a('0x82')]=function(_0x262159,_0x3bf3c9){return db[_0xc25a('0x61')][_0xc25a('0x70')]({'where':{'id':_0x262159[_0xc25a('0x68')]['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x3bf3c9,null))[_0xc25a('0x15')](function(_0x524482){if(_0x524482){return _0x524482[_0xc25a('0x83')](null);}return null;})[_0xc25a('0x15')](respondWithStatusCode(_0x3bf3c9,null))[_0xc25a('0x1d')](handleError(_0x3bf3c9,null));};exports[_0xc25a('0x84')]=function(_0x252bb7,_0x541c74){return db[_0xc25a('0x61')][_0xc25a('0x70')]({'where':{'id':_0x252bb7[_0xc25a('0x68')]['id']}})['then'](handleEntityNotFound(_0x541c74,null))['then'](function(_0x1632d4){if(_0x1632d4){return _0x1632d4[_0xc25a('0x84')]();}return null;})[_0xc25a('0x15')](respondWithResult(_0x541c74,null))[_0xc25a('0x1d')](handleError(_0x541c74,null));};exports['addSmtp']=function(_0x39b332,_0x423e41){if(_0x39b332[_0xc25a('0x64')]['id']){delete _0x39b332[_0xc25a('0x64')]['id'];}return db[_0xc25a('0x61')][_0xc25a('0x67')]({'where':{'id':_0x39b332[_0xc25a('0x68')]['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x423e41,null))[_0xc25a('0x15')](function(_0xb91600){if(_0xb91600){_0x39b332[_0xc25a('0x64')][_0xc25a('0x6d')]=_0xb91600['id'];return db[_0xc25a('0x45')]['create'](_0x39b332[_0xc25a('0x64')]);}})[_0xc25a('0x15')](respondWithResult(_0x423e41,null))[_0xc25a('0x1d')](handleError(_0x423e41,null));};exports[_0xc25a('0x85')]=function(_0x3ab844,_0x1154bd){return db[_0xc25a('0x61')][_0xc25a('0x70')]({'where':{'id':_0x3ab844['params']['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x1154bd,null))[_0xc25a('0x15')](function(_0x44b95d){if(_0x44b95d){return _0x44b95d['setSmtp'](null);}return null;})[_0xc25a('0x15')](respondWithStatusCode(_0x1154bd,null))[_0xc25a('0x1d')](handleError(_0x1154bd,null));};exports[_0xc25a('0x86')]=function(_0x58bf28,_0x142618){return db[_0xc25a('0x87')][_0xc25a('0x67')]({'where':{'id':_0x58bf28['params']['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x142618,null))['then'](function(_0x4afc66){if(_0x4afc66){return _0x4afc66['addInteraction'](_0x58bf28[_0xc25a('0x64')]['ids'],_[_0xc25a('0x88')](_0x58bf28[_0xc25a('0x64')],['ids','id'])||{});}})[_0xc25a('0x15')](respondWithResult(_0x142618,null))[_0xc25a('0x1d')](handleError(_0x142618,null));};exports[_0xc25a('0x89')]=function(_0x2eae81,_0x2fb252){var _0x8e3a73={'raw':![],'where':{}};var _0xe3fd7f={};var _0x367664={'count':0x0,'rows':[]};return db[_0xc25a('0x61')]['findOne']({'where':{'id':_0x2eae81[_0xc25a('0x68')]['id']}})['then'](handleEntityNotFound(_0x2fb252,null))['then'](function(_0x410c44){if(_0x410c44){_0xe3fd7f[_0xc25a('0x4b')]=_[_0xc25a('0x4c')](db[_0xc25a('0x87')][_0xc25a('0x62')]);_0xe3fd7f['query']=_[_0xc25a('0x4c')](_0x2eae81['query']);_0xe3fd7f[_0xc25a('0x4d')]=_[_0xc25a('0x50')](_0xe3fd7f[_0xc25a('0x4b')],_0xe3fd7f[_0xc25a('0x4e')]);_0x8e3a73[_0xc25a('0x4f')]=_[_0xc25a('0x50')](_0xe3fd7f[_0xc25a('0x4b')],qs[_0xc25a('0x51')](_0x2eae81[_0xc25a('0x4e')][_0xc25a('0x51')]));_0x8e3a73[_0xc25a('0x4f')]=_0x8e3a73[_0xc25a('0x4f')][_0xc25a('0x63')]?_0x8e3a73['attributes']:_0xe3fd7f[_0xc25a('0x4b')];if(!_0x2eae81[_0xc25a('0x4e')][_0xc25a('0x52')]('nolimit')){_0x8e3a73[_0xc25a('0x20')]=qs['limit'](_0x2eae81[_0xc25a('0x4e')]['limit']);_0x8e3a73['offset']=qs['offset'](_0x2eae81['query']['offset']);}_0x8e3a73[_0xc25a('0x53')]=qs['sort'](_0x2eae81[_0xc25a('0x4e')][_0xc25a('0x54')]);_0x8e3a73[_0xc25a('0x55')]=qs['filters'](_[_0xc25a('0x56')](_0x2eae81[_0xc25a('0x4e')],_0xe3fd7f[_0xc25a('0x4d')]));_0x8e3a73['where'][_0xc25a('0x6d')]=_0x410c44['id'];if(_0x2eae81['query'][_0xc25a('0x57')]){_0x8e3a73[_0xc25a('0x55')]=_[_0xc25a('0x58')](_0x8e3a73[_0xc25a('0x55')],{'$or':_[_0xc25a('0x48')](_0x8e3a73[_0xc25a('0x4f')],function(_0x10185a){var _0x321130={};_0x321130[_0x10185a]={'$like':'%'+_0x2eae81[_0xc25a('0x4e')][_0xc25a('0x57')]+'%'};return _0x321130;})});}_0x8e3a73=_[_0xc25a('0x58')]({},_0x8e3a73,_0x2eae81[_0xc25a('0x5b')]);return db[_0xc25a('0x87')][_0xc25a('0x21')]({'where':_0x8e3a73[_0xc25a('0x55')]})[_0xc25a('0x15')](function(_0x1be99a){_0x367664['count']=_0x1be99a;if(_0x2eae81[_0xc25a('0x4e')]['includeAll']){_0x8e3a73['include']=[{'model':db['CmContact'],'as':_0xc25a('0x8a'),'required':![]},{'model':db[_0xc25a('0x8b')],'as':_0xc25a('0x8c'),'attributes':[_0xc25a('0x2c'),'fullname',_0xc25a('0x8d')],'required':![]},{'model':db[_0xc25a('0x8e')],'as':_0xc25a('0x8f'),'attributes':['id',_0xc25a('0x2c'),_0xc25a('0x90')],'where':_0x2eae81[_0xc25a('0x4e')]['tag']?{'id':_0x2eae81[_0xc25a('0x4e')]['tag']}:undefined,'required':_0x2eae81[_0xc25a('0x4e')][_0xc25a('0x91')]?!![]:![]}];}return db[_0xc25a('0x87')][_0xc25a('0x5e')](_0x8e3a73);})['then'](function(_0x56cb47){_0x367664[_0xc25a('0x5f')]=_0x56cb47;return _0x367664;});}})['then'](respondWithFilteredResult(_0x2fb252,_0x8e3a73))['catch'](handleError(_0x2fb252,null));};exports[_0xc25a('0x92')]=function addApplications(_0x594164,_0x3fd361){var _0x23bd59=_0x594164[_0xc25a('0x68')]['id'];var _0x3abcd4=_0x594164[_0xc25a('0x64')];var _0x22291a=0xc8;var _0x57e93a=null;return db[_0xc25a('0x93')][_0xc25a('0x94')]({'isolationLevel':db[_0xc25a('0x93')][_0xc25a('0x95')][_0xc25a('0x96')][_0xc25a('0x97')]},function(_0x2dc5ba){return db[_0xc25a('0x61')][_0xc25a('0x70')]({'where':{'id':_0x23bd59},'transaction':_0x2dc5ba})['then'](function(_0x80e018){if(_0x80e018){return db['MailApplication'][_0xc25a('0x25')]({'where':{'MailAccountId':_0x23bd59},'transaction':_0x2dc5ba})[_0xc25a('0x15')](function(){var _0x5a3513=_[_0xc25a('0x48')](_0x3abcd4,function(_0x3b0556){_0x3b0556['MailAccountId']=_0x23bd59;return _0x3b0556;});return db['MailApplication'][_0xc25a('0x98')](_0x5a3513,{'transaction':_0x2dc5ba});});}else{_0x22291a=0x194;_0x57e93a=[];}});})[_0xc25a('0x15')](function(){if(_0x22291a!==0x194){return db[_0xc25a('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0x23bd59},'order':_0xc25a('0x9a')})['then'](function(_0x4cb236){_0x57e93a=_0x4cb236;});}})[_0xc25a('0x1d')](function(_0x3ddc5c){_0x22291a=0x1f4;logger[_0xc25a('0x18')](_0x3ddc5c['stack']);if(_0x3ddc5c['name']){delete _0x3ddc5c[_0xc25a('0x2c')];}_0x57e93a=_0x3ddc5c;})[_0xc25a('0x9b')](function(){if(_0x57e93a===null){_0x3fd361[_0xc25a('0x2a')](_0x22291a);}else{if(_0x22291a===0x1f4){_0x3fd361['status'](_0x22291a)[_0xc25a('0x2d')](_0x57e93a);}else{_0x3fd361['status'](_0x22291a)[_0xc25a('0x1e')](_0x57e93a);}}});};exports[_0xc25a('0x9c')]=function(_0x2ba7e2,_0x2e9461){var _0x437203={};var _0x1e6721={};var _0x58883d;var _0x2b51b;return db[_0xc25a('0x61')][_0xc25a('0x70')]({'where':{'id':_0x2ba7e2[_0xc25a('0x68')]['id']}})['then'](handleEntityNotFound(_0x2e9461,null))[_0xc25a('0x15')](function(_0x3f29e8){if(_0x3f29e8){_0x58883d=_0x3f29e8;_0x1e6721[_0xc25a('0x4b')]=_[_0xc25a('0x4c')](db[_0xc25a('0x99')]['rawAttributes']);_0x1e6721[_0xc25a('0x4e')]=_['keys'](_0x2ba7e2[_0xc25a('0x4e')]);_0x1e6721[_0xc25a('0x4d')]=_['intersection'](_0x1e6721[_0xc25a('0x4b')],_0x1e6721[_0xc25a('0x4e')]);_0x437203['attributes']=_['intersection'](_0x1e6721[_0xc25a('0x4b')],qs['fields'](_0x2ba7e2[_0xc25a('0x4e')][_0xc25a('0x51')]));_0x437203[_0xc25a('0x4f')]=_0x437203[_0xc25a('0x4f')][_0xc25a('0x63')]?_0x437203[_0xc25a('0x4f')]:_0x1e6721[_0xc25a('0x4b')];_0x437203[_0xc25a('0x53')]=qs[_0xc25a('0x54')](_0x2ba7e2[_0xc25a('0x4e')][_0xc25a('0x54')]);_0x437203[_0xc25a('0x55')]=qs[_0xc25a('0x4d')](_['pick'](_0x2ba7e2[_0xc25a('0x4e')],_0x1e6721[_0xc25a('0x4d')]));if(_0x2ba7e2[_0xc25a('0x4e')][_0xc25a('0x57')]){_0x437203['where']=_[_0xc25a('0x58')](_0x437203[_0xc25a('0x55')],{'$or':_[_0xc25a('0x48')](_0x437203['attributes'],function(_0xe4671){var _0x34f247={};_0x34f247[_0xe4671]={'$like':'%'+_0x2ba7e2[_0xc25a('0x4e')]['filter']+'%'};return _0x34f247;})});}_0x437203=_[_0xc25a('0x58')]({},_0x437203,_0x2ba7e2['options']);return _0x58883d[_0xc25a('0x9c')](_0x437203);}})[_0xc25a('0x15')](function(_0x1f9a2d){if(_0x1f9a2d){_0x2b51b=_0x1f9a2d[_0xc25a('0x63')];if(!_0x2ba7e2[_0xc25a('0x4e')][_0xc25a('0x52')]('nolimit')){_0x437203['limit']=qs['limit'](_0x2ba7e2[_0xc25a('0x4e')][_0xc25a('0x20')]);_0x437203[_0xc25a('0x22')]=qs[_0xc25a('0x22')](_0x2ba7e2[_0xc25a('0x4e')][_0xc25a('0x22')]);}return _0x58883d[_0xc25a('0x9c')](_0x437203);}})['then'](function(_0x3bdf6f){if(_0x3bdf6f){return _0x3bdf6f?{'count':_0x2b51b,'rows':_0x3bdf6f}:null;}})['then'](respondWithResult(_0x2e9461,null))[_0xc25a('0x1d')](handleError(_0x2e9461,null));};exports[_0xc25a('0x9d')]=function(_0x247717,_0x4f4862){var _0x4490fb={'raw':!![],'where':{}};var _0x287585={};var _0x1906db={'count':0x0,'rows':[]};return db[_0xc25a('0x61')]['findOne']({'where':{'id':_0x247717['params']['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x4f4862,null))[_0xc25a('0x15')](function(_0x466195){if(_0x466195){_0x287585[_0xc25a('0x4b')]=_[_0xc25a('0x4c')](db[_0xc25a('0x9e')][_0xc25a('0x62')]);_0x287585[_0xc25a('0x4e')]=_[_0xc25a('0x4c')](_0x247717['query']);_0x287585[_0xc25a('0x4d')]=_[_0xc25a('0x50')](_0x287585['model'],_0x287585[_0xc25a('0x4e')]);_0x4490fb[_0xc25a('0x4f')]=_[_0xc25a('0x50')](_0x287585[_0xc25a('0x4b')],qs[_0xc25a('0x51')](_0x247717['query'][_0xc25a('0x51')]));_0x4490fb[_0xc25a('0x4f')]=_0x4490fb['attributes']['length']?_0x4490fb[_0xc25a('0x4f')]:_0x287585[_0xc25a('0x4b')];if(!_0x247717[_0xc25a('0x4e')][_0xc25a('0x52')](_0xc25a('0x72'))){_0x4490fb['limit']=qs[_0xc25a('0x20')](_0x247717[_0xc25a('0x4e')][_0xc25a('0x20')]);_0x4490fb[_0xc25a('0x22')]=qs[_0xc25a('0x22')](_0x247717['query'][_0xc25a('0x22')]);}_0x4490fb[_0xc25a('0x53')]=qs[_0xc25a('0x54')](_0x247717['query'][_0xc25a('0x54')]);_0x4490fb[_0xc25a('0x55')]=qs[_0xc25a('0x4d')](_[_0xc25a('0x56')](_0x247717[_0xc25a('0x4e')],_0x287585[_0xc25a('0x4d')]));_0x4490fb['where'][_0xc25a('0x6d')]=_0x466195['id'];if(_0x247717['query']['filter']){_0x4490fb[_0xc25a('0x55')]=_[_0xc25a('0x58')](_0x4490fb['where'],{'$or':_[_0xc25a('0x48')](_0x4490fb[_0xc25a('0x4f')],function(_0x5333da){var _0x568fd4={};_0x568fd4[_0x5333da]={'$like':'%'+_0x247717['query']['filter']+'%'};return _0x568fd4;})});}if(_0x247717[_0xc25a('0x4e')]['$gte']){var _0x5cbb7c=_0x247717[_0xc25a('0x4e')][_0xc25a('0x9f')]['split'](',');var _0x3af370={};_0x3af370[_0x5cbb7c[0x0]]={'$gte':moment(_0x5cbb7c[0x1])[_0xc25a('0xa0')](_0xc25a('0xa1'))};_0x4490fb[_0xc25a('0x55')]=_[_0xc25a('0x58')](_0x4490fb[_0xc25a('0x55')],_0x3af370);}_0x4490fb=_[_0xc25a('0x58')]({},_0x4490fb,_0x247717[_0xc25a('0x5b')]);return db[_0xc25a('0x9e')][_0xc25a('0x21')]({'where':_0x4490fb['where']})[_0xc25a('0x15')](function(_0x539934){_0x1906db[_0xc25a('0x21')]=_0x539934;if(_0x247717['query'][_0xc25a('0x5c')]){_0x4490fb['include']=[{'all':!![]}];}return db[_0xc25a('0x9e')][_0xc25a('0x5e')](_0x4490fb);})[_0xc25a('0x15')](function(_0x2b6121){if(_0x247717[_0xc25a('0x4e')]['inlineCss']===_0xc25a('0xa2')){for(var _0x308eb8=0x0;_0x308eb8<_0x2b6121['length'];_0x308eb8++){_0x2b6121[_0x308eb8][_0xc25a('0x64')]=juice(_0x2b6121[_0x308eb8][_0xc25a('0x64')]);}}_0x1906db[_0xc25a('0x5f')]=_0x2b6121;return _0x1906db;});}})[_0xc25a('0x15')](respondWithFilteredResult(_0x4f4862,_0x4490fb))['catch'](handleError(_0x4f4862,null));};exports[_0xc25a('0x2d')]=function(_0xc89f6c,_0x4b9c83){var _0x788f44,_0x35245e={},_0x3d8eb9;if(_0xc89f6c[_0xc25a('0x64')]['to']){_0x3d8eb9=_0xc89f6c[_0xc25a('0x64')]['to'][_0xc25a('0xa3')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0xc89f6c[_0xc25a('0x68')]['id']},'include':[{'model':db[_0xc25a('0xa4')],'as':_0xc25a('0xa5'),'include':[{'model':db['CmContact'],'as':_0xc25a('0xa6'),'where':{'email':_0x3d8eb9},'limit':0x1,'order':[[_0xc25a('0xa7'),_0xc25a('0xa8')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc25a('0xa9'),'raw':!![]}]}]})[_0xc25a('0x15')](handleEntityNotFound(_0x4b9c83,null))['then'](function(_0x4a35d4){if(!_0x4a35d4)return;_0x788f44=_0x4a35d4;if(!_0x4a35d4[_0xc25a('0x43')])throw new Error(_0xc25a('0xaa'));if(_[_0xc25a('0x78')](_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xab')])){_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xab')]=util[_0xc25a('0xa0')](_0xc25a('0xac'),_0x4a35d4[_0xc25a('0x2c')],_0x4a35d4[_0xc25a('0xad')]||_0x4a35d4['Smtp'][_0xc25a('0x37')]);}if(_0xc89f6c['body'][_0xc25a('0xae')]&&_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xae')][_0xc25a('0x63')]){for(var _0x1aef2b=0x0;_0x1aef2b<_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xae')][_0xc25a('0x63')];_0x1aef2b+=0x1){_0xc89f6c['body']['attachments'][_0x1aef2b]={'filename':_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xae')][_0x1aef2b][_0xc25a('0x2c')],'path':path[_0xc25a('0xaf')](config['root'],_0xc25a('0xb0'),_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xae')][_0x1aef2b][_0xc25a('0xb1')])};}}var _0x290cc9=_0x4a35d4[_0xc25a('0xb2')]();return respondWithRpcPromise(_0xc25a('0xb3'),_0xc25a('0xb4'),{'account':_0x290cc9,'message':_0xc89f6c[_0xc25a('0x64')]});})[_0xc25a('0x15')](function(_0x503052){if(!_0x503052)return;_0x35245e=_0x503052;if(!_0x788f44[_0xc25a('0xa5')])throw new Error(_0xc25a('0xb5'));if(_0x788f44['List']['Contacts']['length'])return _0x788f44['List']['Contacts'][0x0];return db['CmContact'][_0xc25a('0x6e')](_['defaults'](_0xc89f6c[_0xc25a('0x64')],{'firstName':_0xc89f6c['body']['to'],'email':_0xc89f6c[_0xc25a('0x64')]['to'],'phone':_0xc89f6c['body']['to'],'ListId':_0x788f44['ListId']}));})[_0xc25a('0x15')](function(_0x5cadc2){if(!_0x5cadc2)return;var _0x38a3d6={'UserId':_0xc89f6c[_0xc25a('0x37')]['id'],'ContactId':_0x5cadc2['id'],'MailAccountId':_0x788f44['id'],'inReplyTo':_0x35245e[_0xc25a('0xb6')],'to':_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xab')],'cc':_0xc89f6c[_0xc25a('0x64')]['cc'],'subject':_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xb7')],'attach':_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xb8')],'firstMsgDirection':_0xc25a('0xb9'),'lastMsgAt':moment()['format'](_0xc25a('0xa1')),'lastMsgDirection':_0xc25a('0xb9'),'Messages':[_[_0xc25a('0x58')](_0xc89f6c[_0xc25a('0x64')],{'messageId':_0x35245e[_0xc25a('0xb6')],'sentAt':moment()[_0xc25a('0xa0')](_0xc25a('0xa1')),'read':!![],'MailAccountId':_0x788f44['id'],'UserId':_0xc89f6c[_0xc25a('0x37')]['id'],'ContactId':_0x5cadc2['id']})]};if(_0xc89f6c[_0xc25a('0x64')][_0xc25a('0xba')]){_0x38a3d6=_[_0xc25a('0x58')](_0x38a3d6,_0xc89f6c['body'][_0xc25a('0xba')]);}return db[_0xc25a('0x87')]['create'](_0x38a3d6,{'include':[{'model':db[_0xc25a('0x9e')],'as':_0xc25a('0xbb')}]});})[_0xc25a('0x15')](respondWithResult(_0x4b9c83,null))['catch'](handleError(_0x4b9c83,null));};exports[_0xc25a('0xbc')]=function(_0x548d2a,_0xe986){return db[_0xc25a('0x61')][_0xc25a('0x67')]({'where':{'id':_0x548d2a[_0xc25a('0x68')]['id']},'include':[{'model':db[_0xc25a('0x45')],'as':_0xc25a('0x43'),'raw':!![],'include':[{'model':db[_0xc25a('0xa9')],'as':_0xc25a('0xa9'),'raw':!![]}]}]})[_0xc25a('0x15')](handleEntityNotFound(_0xe986,null))[_0xc25a('0x15')](function(_0x25fa3a){if(!_0x25fa3a['Smtp'])return;var _0x489110=_0x25fa3a['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x489110});})['then'](respondWithResult(_0xe986,null))['catch'](handleError(_0xe986,null));};exports[_0xc25a('0x25')]=function(_0x544899,_0x3751a8){return db['MailAccount'][_0xc25a('0x67')]({'where':{'id':_0x544899[_0xc25a('0x68')]['id']}})['then'](handleEntityNotFound(_0x3751a8,null))[_0xc25a('0x15')](function(_0x432f91){if(_0x432f91&&_0x432f91[_0xc25a('0x3f')]){throw new db[(_0xc25a('0xbd'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x432f91;})[_0xc25a('0x15')](removeEntity(_0x3751a8,null))[_0xc25a('0x1d')](handleError(_0x3751a8,null));};exports[_0xc25a('0xbe')]=function(_0x152abd,_0x4af452){return db[_0xc25a('0x61')]['find']({'where':{'id':_0x152abd[_0xc25a('0x68')]['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x4af452,null))[_0xc25a('0x15')](function(_0x19ad55){if(_0x19ad55){return _0x19ad55[_0xc25a('0xbe')](_0x152abd[_0xc25a('0x64')][_0xc25a('0x74')],_[_0xc25a('0x88')](_0x152abd[_0xc25a('0x64')],[_0xc25a('0x74'),'id'])||{})[_0xc25a('0xbf')](function(_0x245481){for(var _0x5362f6=0x0;_0x5362f6<_0x152abd[_0xc25a('0x64')]['ids'][_0xc25a('0x63')];_0x5362f6+=0x1){socket[_0xc25a('0xc0')](_0xc25a('0xc1'),{'UserId':Number(_0x152abd[_0xc25a('0x64')][_0xc25a('0x74')][_0x5362f6]),'MailAccountId':Number(_0x152abd[_0xc25a('0x68')]['id'])});}return _0x245481;});}})['then'](respondWithResult(_0x4af452,null))[_0xc25a('0x1d')](handleError(_0x4af452,null));};exports[_0xc25a('0xc2')]=function(_0x4ad60e,_0xaea46c){return db[_0xc25a('0x61')]['find']({'where':{'id':_0x4ad60e['params']['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0xaea46c,null))[_0xc25a('0x15')](function(_0x1cb0a){if(_0x1cb0a){return _0x1cb0a[_0xc25a('0xc2')](_0x4ad60e[_0xc25a('0x4e')][_0xc25a('0x74')])[_0xc25a('0x15')](function(){if(_[_0xc25a('0xc3')](_0x4ad60e['query'][_0xc25a('0x74')])){for(var _0x3f240f=0x0;_0x3f240f<_0x4ad60e[_0xc25a('0x4e')]['ids'][_0xc25a('0x63')];_0x3f240f+=0x1){socket[_0xc25a('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x4ad60e['query']['ids'][_0x3f240f]),'MailAccountId':Number(_0x4ad60e[_0xc25a('0x68')]['id'])});}}else{socket[_0xc25a('0xc0')](_0xc25a('0xc4'),{'UserId':Number(_0x4ad60e[_0xc25a('0x4e')]['ids']),'MailAccountId':Number(_0x4ad60e[_0xc25a('0x68')]['id'])});}});}})[_0xc25a('0x15')](respondWithStatusCode(_0xaea46c,null))[_0xc25a('0x1d')](handleError(_0xaea46c,null));};exports[_0xc25a('0xc5')]=function(_0x2d7365,_0x15bb87){var _0x2ef447={};var _0x181e6e={};var _0x47db72;var _0x3e646b;return db[_0xc25a('0x61')]['findOne']({'where':{'id':_0x2d7365[_0xc25a('0x68')]['id']}})[_0xc25a('0x15')](handleEntityNotFound(_0x15bb87,null))[_0xc25a('0x15')](function(_0x3630a1){if(_0x3630a1){_0x47db72=_0x3630a1;_0x181e6e['model']=_['keys'](db[_0xc25a('0x8b')][_0xc25a('0x62')]);_0x181e6e[_0xc25a('0x4e')]=_[_0xc25a('0x4c')](_0x2d7365[_0xc25a('0x4e')]);_0x181e6e[_0xc25a('0x4d')]=_[_0xc25a('0x50')](_0x181e6e[_0xc25a('0x4b')],_0x181e6e[_0xc25a('0x4e')]);_0x2ef447[_0xc25a('0x4f')]=_[_0xc25a('0x50')](_0x181e6e[_0xc25a('0x4b')],qs[_0xc25a('0x51')](_0x2d7365['query'][_0xc25a('0x51')]));_0x2ef447[_0xc25a('0x4f')]=_0x2ef447[_0xc25a('0x4f')][_0xc25a('0x63')]?_0x2ef447[_0xc25a('0x4f')]:_0x181e6e[_0xc25a('0x4b')];_0x2ef447[_0xc25a('0x53')]=qs[_0xc25a('0x54')](_0x2d7365[_0xc25a('0x4e')]['sort']);_0x2ef447[_0xc25a('0x55')]=qs[_0xc25a('0x4d')](_[_0xc25a('0x56')](_0x2d7365[_0xc25a('0x4e')],_0x181e6e[_0xc25a('0x4d')]));if(_0x2d7365[_0xc25a('0x4e')][_0xc25a('0x57')]){_0x2ef447[_0xc25a('0x55')]=_[_0xc25a('0x58')](_0x2ef447[_0xc25a('0x55')],{'$or':_['map'](_0x2ef447['attributes'],function(_0x9a3e84){var _0x4abb25={};_0x4abb25[_0x9a3e84]={'$like':'%'+_0x2d7365['query'][_0xc25a('0x57')]+'%'};return _0x4abb25;})});}_0x2ef447=_[_0xc25a('0x58')]({},_0x2ef447,_0x2d7365[_0xc25a('0x5b')]);return _0x47db72[_0xc25a('0xc5')](_0x2ef447);}})[_0xc25a('0x15')](function(_0x48d846){if(_0x48d846){_0x3e646b=_0x48d846[_0xc25a('0x63')];if(!_0x2d7365[_0xc25a('0x4e')]['hasOwnProperty'](_0xc25a('0x72'))){_0x2ef447[_0xc25a('0x20')]=qs[_0xc25a('0x20')](_0x2d7365[_0xc25a('0x4e')]['limit']);_0x2ef447['offset']=qs['offset'](_0x2d7365['query']['offset']);}return _0x47db72[_0xc25a('0xc5')](_0x2ef447);}})[_0xc25a('0x15')](function(_0x18294e){if(_0x18294e){return _0x18294e?{'count':_0x3e646b,'rows':_0x18294e}:null;}})['then'](respondWithResult(_0x15bb87,null))[_0xc25a('0x1d')](handleError(_0x15bb87,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 44dab9a..696e48e 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 _0x00cd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','update','remove'];(function(_0x31ace8,_0x18dd6e){var _0x568b67=function(_0x2fde1e){while(--_0x2fde1e){_0x31ace8['push'](_0x31ace8['shift']());}};_0x568b67(++_0x18dd6e);}(_0x00cd,0xee));var _0xd00c=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0x00cd[_0x295a3d];return _0x23a732;};'use strict';var EventEmitter=require(_0xd00c('0x0'));var MailAccount=require(_0xd00c('0x1'))['db'][_0xd00c('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd00c('0x3'),'afterDestroy':_0xd00c('0x4')};function emitEvent(_0x3057b7){return function(_0x2291b2,_0x2187fa,_0x5ab1ad){MailAccountEvents[_0xd00c('0x5')](_0x3057b7+':'+_0x2291b2['id'],_0x2291b2);MailAccountEvents[_0xd00c('0x5')](_0x3057b7,_0x2291b2);_0x5ab1ad(null);};}for(var e in events){if(events[_0xd00c('0x6')](e)){var event=events[e];MailAccount[_0xd00c('0x7')](e,emitEvent(event));}}module[_0xd00c('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xb234=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x4cc198,_0x183162){var _0x16f952=function(_0x50c218){while(--_0x50c218){_0x4cc198['push'](_0x4cc198['shift']());}};_0x16f952(++_0x183162);}(_0xb234,0x13f));var _0x4b23=function(_0xeea8ad,_0xee111a){_0xeea8ad=_0xeea8ad-0x0;var _0x9fa66c=_0xb234[_0xeea8ad];return _0x9fa66c;};'use strict';var EventEmitter=require(_0x4b23('0x0'));var MailAccount=require(_0x4b23('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4b23('0x2')](0x0);var events={'afterCreate':_0x4b23('0x3'),'afterUpdate':_0x4b23('0x4'),'afterDestroy':_0x4b23('0x5')};function emitEvent(_0x5496ed){return function(_0x5557dc,_0x36c95e,_0xf90d41){MailAccountEvents['emit'](_0x5496ed+':'+_0x5557dc['id'],_0x5557dc);MailAccountEvents[_0x4b23('0x6')](_0x5496ed,_0x5557dc);_0xf90d41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x4b23('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3770de6..fa3b77e 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 _0xd4ea=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','./mailAccount.attributes','exports','define','MailAccount','provider','custom','host','Smtp','port','authentication','CloudProvider'];(function(_0x5ab359,_0x199ad2){var _0x51e390=function(_0x302b3a){while(--_0x302b3a){_0x5ab359['push'](_0x5ab359['shift']());}};_0x51e390(++_0x199ad2);}(_0xd4ea,0xd5));var _0xad4e=function(_0x53aee6,_0x5d0e22){_0x53aee6=_0x53aee6-0x0;var _0x72006e=_0xd4ea[_0x53aee6];return _0x72006e;};'use strict';var attributes=require(_0xad4e('0x0'));module[_0xad4e('0x1')]=function(_0x37fc78){return _0x37fc78[_0xad4e('0x2')](_0xad4e('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2ef6a1=this;var _0x1a9a77={'id':_0x2ef6a1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2ef6a1[_0xad4e('0x4')]!==_0xad4e('0x5')){_0x1a9a77['service']=_0x2ef6a1['provider'];}else{_0x1a9a77[_0xad4e('0x6')]=_0x2ef6a1[_0xad4e('0x7')][_0xad4e('0x6')];_0x1a9a77[_0xad4e('0x8')]=_0x2ef6a1[_0xad4e('0x7')]['port'];_0x1a9a77['secure']=_0x2ef6a1[_0xad4e('0x7')]['secure'];}if(_0x2ef6a1[_0xad4e('0x7')][_0xad4e('0x9')]){if(_0x2ef6a1['Smtp']['modernAuthentication']){if(!_0x2ef6a1[_0xad4e('0x7')][_0xad4e('0xa')])throw new Error(_0xad4e('0xb'));_0x1a9a77[_0xad4e('0xc')]={'type':_0xad4e('0xd'),'user':_0x2ef6a1['Smtp'][_0xad4e('0xe')],'accessToken':_0x2ef6a1['Smtp'][_0xad4e('0xa')][_0xad4e('0xf')]};}else{_0x1a9a77[_0xad4e('0xc')]={'user':_0x2ef6a1['Smtp'][_0xad4e('0xe')],'pass':_0x2ef6a1[_0xad4e('0x7')]['pass']};}}return _0x1a9a77;}}});}; \ No newline at end of file +var _0xb84f=['exports','define','MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','./mailAccount.attributes'];(function(_0x38bc8e,_0x2f2a6c){var _0x1bdace=function(_0x51c677){while(--_0x51c677){_0x38bc8e['push'](_0x38bc8e['shift']());}};_0x1bdace(++_0x2f2a6c);}(_0xb84f,0x1b7));var _0xfb84=function(_0x2d4461,_0x3ede4c){_0x2d4461=_0x2d4461-0x0;var _0x419b95=_0xb84f[_0x2d4461];return _0x419b95;};'use strict';var attributes=require(_0xfb84('0x0'));module[_0xfb84('0x1')]=function(_0x191cdb){return _0x191cdb[_0xfb84('0x2')](_0xfb84('0x3'),attributes,{'tableName':_0xfb84('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x65f3f6=this;var _0x58070e={'id':_0x65f3f6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x65f3f6[_0xfb84('0x5')]!=='custom'){_0x58070e[_0xfb84('0x6')]=_0x65f3f6[_0xfb84('0x5')];}else{_0x58070e[_0xfb84('0x7')]=_0x65f3f6[_0xfb84('0x8')][_0xfb84('0x7')];_0x58070e[_0xfb84('0x9')]=_0x65f3f6[_0xfb84('0x8')][_0xfb84('0x9')];_0x58070e[_0xfb84('0xa')]=_0x65f3f6[_0xfb84('0x8')][_0xfb84('0xa')];}if(_0x65f3f6['Smtp'][_0xfb84('0xb')]){if(_0x65f3f6[_0xfb84('0x8')][_0xfb84('0xc')]){if(!_0x65f3f6[_0xfb84('0x8')][_0xfb84('0xd')])throw new Error(_0xfb84('0xe'));_0x58070e['auth']={'type':_0xfb84('0xf'),'user':_0x65f3f6['Smtp'][_0xfb84('0x10')],'accessToken':_0x65f3f6[_0xfb84('0x8')][_0xfb84('0xd')][_0xfb84('0x11')]};}else{_0x58070e[_0xfb84('0x12')]={'user':_0x65f3f6[_0xfb84('0x8')][_0xfb84('0x10')],'pass':_0x65f3f6['Smtp'][_0xfb84('0x13')]};}}return _0x58070e;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index b6a269c..8b108ca 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 _0xc21e=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','attributes','limit','include','map','model','then','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','rawAttributes','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','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','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','orderBy','applications','priority','asc','autoclose','push','length','close','*,*,*,*','CmContact','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','spread','update','subject','interaction','created','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x257e1f,_0x11a95a){var _0xa85736=function(_0x4eafa5){while(--_0x4eafa5){_0x257e1f['push'](_0x257e1f['shift']());}};_0xa85736(++_0x11a95a);}(_0xc21e,0x1ca));var _0xec21=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc21e[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var moment=require(_0xec21('0x0'));var BPromise=require(_0xec21('0x1'));var rs=require(_0xec21('0x2'));var Redis=require(_0xec21('0x3'));var db=require(_0xec21('0x4'))['db'];var logger=require(_0xec21('0x5'))('rpc');var config=require(_0xec21('0x6'));var jayson=require(_0xec21('0x7'));var client=jayson[_0xec21('0x8')][_0xec21('0x9')]({'port':0x232c});config[_0xec21('0xa')]=_[_0xec21('0xb')](config[_0xec21('0xa')],{'host':_0xec21('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec21('0xa')]));require(_0xec21('0xd'))[_0xec21('0xe')](socket);function respondWithRpcPromise(_0xfbab77,_0x4d478,_0x569559){return new BPromise(function(_0x110420,_0x1d5e4b){return client[_0xec21('0xf')](_0xfbab77,_0x569559)['then'](function(_0x5f059d){logger[_0xec21('0x10')](_0xec21('0x11'),_0x4d478,'request\x20sent');logger[_0xec21('0x12')](_0xec21('0x13'),_0x4d478,_0xec21('0x14'),JSON[_0xec21('0x15')](_0x5f059d));if(_0x5f059d[_0xec21('0x16')]){if(_0x5f059d['error'][_0xec21('0x17')]===0x1f4){logger['error'](_0xec21('0x11'),_0x4d478,_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);return _0x1d5e4b(_0x5f059d['error'][_0xec21('0x18')]);}logger[_0xec21('0x16')](_0xec21('0x11'),_0x4d478,_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);return _0x110420(_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);}else{logger[_0xec21('0x10')]('MailAccount,\x20%s,\x20%s',_0x4d478,_0xec21('0x14'));_0x110420(_0x5f059d[_0xec21('0x19')][_0xec21('0x18')]);}})[_0xec21('0x1a')](function(_0x3ab226){logger[_0xec21('0x16')](_0xec21('0x11'),_0x4d478,_0x3ab226);_0x1d5e4b(_0x3ab226);});});}exports[_0xec21('0x1b')]=function(_0x3c790e){var _0x350443=this;return new Promise(function(_0x4f4b12,_0x4c244b){return db[_0xec21('0x1c')][_0xec21('0x1d')]({'raw':_0x3c790e['options']?_0x3c790e['options'][_0xec21('0x1e')]===undefined?!![]:![]:!![],'where':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')]['where']||null:null,'attributes':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')][_0xec21('0x20')]||null:null,'limit':_0x3c790e['options']?_0x3c790e[_0xec21('0x1f')][_0xec21('0x21')]||null:null,'include':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')][_0xec21('0x22')]?_[_0xec21('0x23')](_0x3c790e['options'][_0xec21('0x22')],function(_0x26cdae){return{'model':db[_0x26cdae['model']],'as':_0x26cdae['as'],'attributes':_0x26cdae[_0xec21('0x20')],'include':_0x26cdae['include']?_[_0xec21('0x23')](_0x26cdae['include'],function(_0x4ef840){return{'model':db[_0x4ef840[_0xec21('0x24')]],'as':_0x4ef840['as'],'attributes':_0x4ef840[_0xec21('0x20')],'include':_0x4ef840[_0xec21('0x22')]?_[_0xec21('0x23')](_0x4ef840[_0xec21('0x22')],function(_0x5521e3){return{'model':db[_0x5521e3[_0xec21('0x24')]],'as':_0x5521e3['as'],'attributes':_0x5521e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xec21('0x25')](function(_0x233bf9){logger[_0xec21('0x10')](_0xec21('0x1b'),_0x3c790e);logger['debug'](_0xec21('0x1b'),_0x3c790e,JSON[_0xec21('0x15')](_0x233bf9));_0x4f4b12(_0x233bf9);})[_0xec21('0x1a')](function(_0x233231){logger[_0xec21('0x16')](_0xec21('0x1b'),_0x233231[_0xec21('0x18')],_0x3c790e);_0x4c244b(_0x350443[_0xec21('0x16')](0x1f4,_0x233231[_0xec21('0x18')]));});});};exports[_0xec21('0x26')]=function(_0x43a2de){var _0x57e004=this;return new Promise(function(_0x31f861,_0x2a14aa){return db[_0xec21('0x1c')][_0xec21('0x27')]({'raw':_0x43a2de[_0xec21('0x1f')]?_0x43a2de['options'][_0xec21('0x1e')]===undefined?!![]:![]:!![],'where':_0x43a2de['options']?_0x43a2de['options']['where']||null:null,'attributes':_0x43a2de[_0xec21('0x1f')]?_0x43a2de[_0xec21('0x1f')][_0xec21('0x20')]||null:null,'include':_0x43a2de[_0xec21('0x1f')]?_0x43a2de[_0xec21('0x1f')][_0xec21('0x22')]?_[_0xec21('0x23')](_0x43a2de[_0xec21('0x1f')][_0xec21('0x22')],function(_0x1a7586){return{'model':db[_0x1a7586[_0xec21('0x24')]],'as':_0x1a7586['as'],'attributes':_0x1a7586[_0xec21('0x20')],'include':_0x1a7586['include']?_[_0xec21('0x23')](_0x1a7586[_0xec21('0x22')],function(_0x4a91a8){return{'model':db[_0x4a91a8[_0xec21('0x24')]],'as':_0x4a91a8['as'],'attributes':_0x4a91a8['attributes'],'include':_0x4a91a8['include']?_[_0xec21('0x23')](_0x4a91a8['include'],function(_0x4556c2){return{'model':db[_0x4556c2['model']],'as':_0x4556c2['as'],'attributes':_0x4556c2[_0xec21('0x20')]};}):[]};}):[]};}):[]:[]})[_0xec21('0x25')](function(_0x54b3a6){if(_0x43a2de[_0xec21('0x1f')][_0xec21('0x28')]===!![])_0x54b3a6[_0xec21('0x29')]('smtpOptions',_0x54b3a6[_0xec21('0x2a')]());logger[_0xec21('0x10')](_0xec21('0x26'),_0x43a2de);logger['debug'](_0xec21('0x26'),_0x43a2de,JSON[_0xec21('0x15')](_0x54b3a6));_0x31f861(_0x54b3a6);})[_0xec21('0x1a')](function(_0x154b8b){logger[_0xec21('0x16')]('ShowMailAccount',_0x154b8b[_0xec21('0x18')],_0x43a2de);_0x2a14aa(_0x57e004[_0xec21('0x16')](0x1f4,_0x154b8b['message']));});});};exports[_0xec21('0x2b')]=function(_0x54e642){var _0x1f0916=this;return new Promise(function(_0x18e20d,_0xf13561){var _0x49f90a={'body':_0x54e642[_0xec21('0x2c')],'channel':_0xec21('0x2d')};var _0x1093f6=_[_0xec21('0x2e')](_['keys'](db['CmContact'][_0xec21('0x2f')]),['createdAt',_0xec21('0x30'),'CompanyId',_0xec21('0x31')]);var _0x52e024=![];if(_0x54e642[_0xec21('0x2c')]['id']){delete _0x54e642[_0xec21('0x2c')]['id'];}if(_['isNil'](_0x54e642[_0xec21('0x2c')][_0xec21('0x32')])){return _0xf13561(_0x1f0916['error'](0x1f4,_0xec21('0x33')));}if(_[_0xec21('0x34')](_0x54e642[_0xec21('0x2c')][_0xec21('0x2c')])||_0x54e642[_0xec21('0x2c')][_0xec21('0x2c')]===''){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x35')));}if(_[_0xec21('0x34')](_0x54e642['body']['mapKey'])){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x36')+_0x1093f6));}if(!_[_0xec21('0x37')](_0x1093f6,_0x54e642['body'][_0xec21('0x38')])){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x39')+_0x1093f6));}var _0x555d95={};_0x555d95[_0x54e642['body']['mapKey']]=_0x54e642[_0xec21('0x2c')][_0xec21('0x32')];return db[_0xec21('0x1c')][_0xec21('0x27')]({'where':{'id':_0x54e642[_0xec21('0x3a')]['id']},'include':[{'model':db[_0xec21('0x3b')],'as':_0xec21('0x3c'),'include':[{'model':db['CmContact'],'as':_0xec21('0x3d'),'where':_0x555d95,'limit':0x1,'order':[[_0xec21('0x30'),_0xec21('0x3e')]]}]},{'model':db[_0xec21('0x3f')],'as':_0xec21('0x40')},{'model':db[_0xec21('0x41')],'as':_0xec21('0x42'),'include':[{'model':db[_0xec21('0x43')],'as':'CloudProvider'}]}]})[_0xec21('0x25')](function(_0x21e67f){if(_0x21e67f&&_0x21e67f[_0xec21('0x3c')]){var _0x58e490=_0x21e67f['get']({'plain':!![]});_0x49f90a['account']=_[_0xec21('0x44')](_0x58e490,[_0xec21('0x40'),'List']);_0x49f90a[_0xec21('0x3a')][_0xec21('0x45')]=_0x21e67f[_0xec21('0x2a')]();_0x49f90a['applications']=_0x58e490[_0xec21('0x40')];_0x49f90a['list']=_0x58e490[_0xec21('0x3c')];_0x49f90a['applications']=_[_0xec21('0x46')](_0x49f90a[_0xec21('0x47')],[_0xec21('0x48')],[_0xec21('0x49')]);if(_0x49f90a[_0xec21('0x3a')]&&_0x49f90a['account'][_0xec21('0x4a')]){_0x49f90a['applications'][_0xec21('0x4b')]({'id':0x0,'priority':_0x49f90a['applications'][_0xec21('0x4c')]+0x1,'app':_0xec21('0x4d'),'appdata':_0xec21('0x4a'),'interval':_0xec21('0x4e')});}if(_0x49f90a[_0xec21('0x3a')][_0xec21('0x40')]){delete _0x49f90a['account'][_0xec21('0x40')];}if(_0x49f90a[_0xec21('0x3a')][_0xec21('0x3c')]){delete _0x49f90a[_0xec21('0x3a')]['List'];}if(_0x58e490[_0xec21('0x3c')][_0xec21('0x3d')][_0xec21('0x4c')]){return _0x58e490['List']['Contacts'][0x0];}var _0x674ba7=_['defaults'](_0x54e642[_0xec21('0x2c')],{'firstName':_0x54e642[_0xec21('0x2c')]['from'],'ListId':_0x58e490['ListId']});_0x674ba7[_0x54e642[_0xec21('0x2c')][_0xec21('0x38')]]=_0x54e642[_0xec21('0x2c')][_0xec21('0x32')];return db[_0xec21('0x4f')][_0xec21('0x50')](_0x674ba7);}else{throw new Error(_0xec21('0x51'));}})[_0xec21('0x25')](function(_0x4a5351){_0x49f90a[_0xec21('0x52')]=_0x4a5351;if(_0x4a5351){if(!_0x54e642['body'][_0xec21('0x18')]['messageId']){_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x53')]=rs[_0xec21('0x54')]()+'\x20'+_0x54e642[_0xec21('0x2c')]['message']['from'];}var _0x49cd02={'ContactId':_0x4a5351['id'],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id'],'inReplyTo':_0x54e642['body'][_0xec21('0x18')][_0xec21('0x53')],'to':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x32')],'cc':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['cc'],'subject':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['subject'],'attach':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x55')],'lastMsgAt':moment()[_0xec21('0x56')](_0xec21('0x57')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0xec21('0x53')],'where':{'messageId':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['inReplyTo']}}]})[_0xec21('0x25')](function(_0x43848f){if(_0x43848f){return[_0x43848f,![]];}return db[_0xec21('0x58')][_0xec21('0x50')](_0x49cd02)[_0xec21('0x25')](function(_0x2ae987){return[_0x2ae987,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xec21('0x59')](function(_0x1cb2b1,_0x3a4bd6){if(_0x1cb2b1){_0x52e024=_0x3a4bd6;if(!_0x3a4bd6){return _0x1cb2b1[_0xec21('0x5a')]({'inReplyTo':_0x54e642['body']['message']['messageId'],'to':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x32')],'cc':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['cc'],'subject':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x5b')],'attach':_0x1cb2b1[_0xec21('0x55')]?_0x1cb2b1[_0xec21('0x55')]:_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x55')],'substatus':null,'substatusAt':moment()[_0xec21('0x56')](_0xec21('0x57')),'lastMsgAt':moment()['format'](_0xec21('0x57')),'lastMsgDirection':'in'});}else{return _0x1cb2b1;}}})[_0xec21('0x25')](function(_0x11d9e7){_0x49f90a[_0xec21('0x5c')]=_0x11d9e7['get']({'plain':!![]});_0x49f90a['interaction'][_0xec21('0x5d')]=_0x52e024;return db[_0xec21('0x5e')][_0xec21('0x50')]({'body':_0x54e642[_0xec21('0x2c')]['body'],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id'],'MailInteractionId':_0x11d9e7['id'],'direction':'in','ContactId':_0x49f90a['contact']['id'],'messageId':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x53')],'from':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['from'],'to':_0x54e642['body'][_0xec21('0x18')]['to'],'cc':_0x54e642[_0xec21('0x2c')]['message']['cc'],'subject':_0x54e642['body'][_0xec21('0x18')][_0xec21('0x5b')],'attach':_0x54e642['body']['message'][_0xec21('0x55')],'Attachments':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x5f')],'originTo':_0x54e642['body']['message'][_0xec21('0x60')],'originCc':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x61')],'bcc':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x62')],'ChatWebsiteId':_0x54e642['body']['message'][_0xec21('0x63')]||null,'originChannel':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x64')]||_0xec21('0x65'),'ChatOfflineMessageId':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x66')]||null},{'include':[{'model':db[_0xec21('0x67')],'as':'Attachments'}]});})[_0xec21('0x25')](function(_0x194287){_0x49f90a['message']=_0x194287;if(!_0x49f90a['interaction'][_0xec21('0x68')]){return;}return db[_0xec21('0x69')][_0xec21('0x27')]({'attributes':['id',_0xec21('0x6a')],'where':{'id':_0x49f90a[_0xec21('0x5c')][_0xec21('0x68')]}});})['then'](function(_0x2cb4d6){if(_0x2cb4d6){_0x49f90a[_0xec21('0x47')][_0xec21('0x6b')]({'id':0x0,'priority':0x0,'app':_0xec21('0x6c'),'appdata':_0x2cb4d6[_0xec21('0x6a')]+','+(_0x49f90a[_0xec21('0x3a')][_0xec21('0x6d')]||0xa),'interval':_0xec21('0x4e')});}if(!_0x49f90a[_0xec21('0x5c')][_0xec21('0x6e')]){return;}return db[_0xec21('0x6f')][_0xec21('0x27')]({'attributes':['id',_0xec21('0x6a')],'where':{'id':_0x49f90a[_0xec21('0x5c')]['queueId']}});})[_0xec21('0x25')](function(_0x502fb8){if(_0x502fb8){_0x49f90a[_0xec21('0x47')][_0xec21('0x6b')]({'id':0x0,'priority':0x1,'app':_0xec21('0x70'),'appdata':_0x502fb8[_0xec21('0x6a')]+','+(_0x49f90a[_0xec21('0x3a')][_0xec21('0x71')]||0x12c),'interval':_0xec21('0x4e')});}return respondWithRpcPromise(_0xec21('0x72'),_0xec21('0x73'),_0x49f90a);})['then'](function(_0x44077f){_0x18e20d(_0x44077f);})[_0xec21('0x1a')](function(_0x5def11){_0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0x5def11[_0xec21('0x18')]));});});}; \ No newline at end of file +var _0x4351=['ChatWebsiteId','originChannel','Attachment','User','name','UserId','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','debug','request\x20sent','code','error','message','info','result','catch','findAll','options','raw','attributes','limit','include','map','model','GetMailAccount','stringify','find','smtp','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','mail','difference','CmContact','rawAttributes','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','account','List','Contacts','MailApplication','MailServerOut','CloudProvider','get','omit','Applications','applications','list','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','create','contact','messageId','generate','subject','attach','MailInteraction','MailMessage','inReplyTo','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc'];(function(_0x557ad6,_0x2bacb8){var _0x4f5c01=function(_0x4f5bb0){while(--_0x4f5bb0){_0x557ad6['push'](_0x557ad6['shift']());}};_0x4f5c01(++_0x2bacb8);}(_0x4351,0x1b5));var _0x1435=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x4351[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x1435('0x0'));var moment=require(_0x1435('0x1'));var BPromise=require(_0x1435('0x2'));var rs=require(_0x1435('0x3'));var Redis=require(_0x1435('0x4'));var db=require(_0x1435('0x5'))['db'];var logger=require(_0x1435('0x6'))(_0x1435('0x7'));var config=require(_0x1435('0x8'));var jayson=require(_0x1435('0x9'));var client=jayson[_0x1435('0xa')][_0x1435('0xb')]({'port':0x232c});config[_0x1435('0xc')]=_[_0x1435('0xd')](config[_0x1435('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1435('0xe'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x1435('0xf')](socket);function respondWithRpcPromise(_0x22a221,_0x14a9e1,_0x35a509){return new BPromise(function(_0xade491,_0x55cd88){return client[_0x1435('0x10')](_0x22a221,_0x35a509)[_0x1435('0x11')](function(_0x5a64a4){logger['info'](_0x1435('0x12'),_0x14a9e1,'request\x20sent');logger[_0x1435('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x14a9e1,_0x1435('0x14'),JSON['stringify'](_0x5a64a4));if(_0x5a64a4['error']){if(_0x5a64a4['error'][_0x1435('0x15')]===0x1f4){logger[_0x1435('0x16')](_0x1435('0x12'),_0x14a9e1,_0x5a64a4['error']['message']);return _0x55cd88(_0x5a64a4[_0x1435('0x16')]['message']);}logger[_0x1435('0x16')](_0x1435('0x12'),_0x14a9e1,_0x5a64a4[_0x1435('0x16')][_0x1435('0x17')]);return _0xade491(_0x5a64a4[_0x1435('0x16')][_0x1435('0x17')]);}else{logger[_0x1435('0x18')](_0x1435('0x12'),_0x14a9e1,_0x1435('0x14'));_0xade491(_0x5a64a4[_0x1435('0x19')][_0x1435('0x17')]);}})[_0x1435('0x1a')](function(_0x68f503){logger[_0x1435('0x16')](_0x1435('0x12'),_0x14a9e1,_0x68f503);_0x55cd88(_0x68f503);});});}exports['GetMailAccount']=function(_0x26da28){var _0x34f555=this;return new Promise(function(_0x4cf63f,_0x4694cb){return db['MailAccount'][_0x1435('0x1b')]({'raw':_0x26da28[_0x1435('0x1c')]?_0x26da28[_0x1435('0x1c')][_0x1435('0x1d')]===undefined?!![]:![]:!![],'where':_0x26da28[_0x1435('0x1c')]?_0x26da28[_0x1435('0x1c')]['where']||null:null,'attributes':_0x26da28[_0x1435('0x1c')]?_0x26da28[_0x1435('0x1c')][_0x1435('0x1e')]||null:null,'limit':_0x26da28[_0x1435('0x1c')]?_0x26da28[_0x1435('0x1c')][_0x1435('0x1f')]||null:null,'include':_0x26da28[_0x1435('0x1c')]?_0x26da28[_0x1435('0x1c')][_0x1435('0x20')]?_[_0x1435('0x21')](_0x26da28[_0x1435('0x1c')]['include'],function(_0x523792){return{'model':db[_0x523792[_0x1435('0x22')]],'as':_0x523792['as'],'attributes':_0x523792[_0x1435('0x1e')],'include':_0x523792[_0x1435('0x20')]?_['map'](_0x523792[_0x1435('0x20')],function(_0x25cf29){return{'model':db[_0x25cf29[_0x1435('0x22')]],'as':_0x25cf29['as'],'attributes':_0x25cf29[_0x1435('0x1e')],'include':_0x25cf29[_0x1435('0x20')]?_['map'](_0x25cf29[_0x1435('0x20')],function(_0x7a2f63){return{'model':db[_0x7a2f63[_0x1435('0x22')]],'as':_0x7a2f63['as'],'attributes':_0x7a2f63[_0x1435('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1435('0x11')](function(_0x108c25){logger[_0x1435('0x18')]('GetMailAccount',_0x26da28);logger[_0x1435('0x13')](_0x1435('0x23'),_0x26da28,JSON[_0x1435('0x24')](_0x108c25));_0x4cf63f(_0x108c25);})[_0x1435('0x1a')](function(_0x297edf){logger['error'](_0x1435('0x23'),_0x297edf[_0x1435('0x17')],_0x26da28);_0x4694cb(_0x34f555[_0x1435('0x16')](0x1f4,_0x297edf[_0x1435('0x17')]));});});};exports['ShowMailAccount']=function(_0x2afc79){var _0x1dc553=this;return new Promise(function(_0x49209a,_0x4503a1){return db['MailAccount'][_0x1435('0x25')]({'raw':_0x2afc79[_0x1435('0x1c')]?_0x2afc79['options'][_0x1435('0x1d')]===undefined?!![]:![]:!![],'where':_0x2afc79[_0x1435('0x1c')]?_0x2afc79['options']['where']||null:null,'attributes':_0x2afc79['options']?_0x2afc79[_0x1435('0x1c')]['attributes']||null:null,'include':_0x2afc79[_0x1435('0x1c')]?_0x2afc79['options'][_0x1435('0x20')]?_['map'](_0x2afc79[_0x1435('0x1c')][_0x1435('0x20')],function(_0x249edc){return{'model':db[_0x249edc[_0x1435('0x22')]],'as':_0x249edc['as'],'attributes':_0x249edc[_0x1435('0x1e')],'include':_0x249edc[_0x1435('0x20')]?_['map'](_0x249edc[_0x1435('0x20')],function(_0x138597){return{'model':db[_0x138597[_0x1435('0x22')]],'as':_0x138597['as'],'attributes':_0x138597[_0x1435('0x1e')],'include':_0x138597[_0x1435('0x20')]?_['map'](_0x138597[_0x1435('0x20')],function(_0x578845){return{'model':db[_0x578845[_0x1435('0x22')]],'as':_0x578845['as'],'attributes':_0x578845[_0x1435('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11cf64){if(_0x2afc79[_0x1435('0x1c')][_0x1435('0x26')]===!![])_0x11cf64[_0x1435('0x27')](_0x1435('0x28'),_0x11cf64[_0x1435('0x29')]());logger[_0x1435('0x18')](_0x1435('0x2a'),_0x2afc79);logger[_0x1435('0x13')](_0x1435('0x2a'),_0x2afc79,JSON[_0x1435('0x24')](_0x11cf64));_0x49209a(_0x11cf64);})[_0x1435('0x1a')](function(_0x552a61){logger[_0x1435('0x16')]('ShowMailAccount',_0x552a61[_0x1435('0x17')],_0x2afc79);_0x4503a1(_0x1dc553['error'](0x1f4,_0x552a61[_0x1435('0x17')]));});});};exports['NotifyMailAccount']=function(_0x473d6){var _0x516e44=this;return new Promise(function(_0x36bc74,_0x186e7a){var _0x398d3c={'body':_0x473d6['body'],'channel':_0x1435('0x2b')};var _0x1fe164=_[_0x1435('0x2c')](_['keys'](db[_0x1435('0x2d')][_0x1435('0x2e')]),['createdAt','updatedAt',_0x1435('0x2f'),_0x1435('0x30')]);var _0x2dd1f5=![];if(_0x473d6['body']['id']){delete _0x473d6['body']['id'];}if(_[_0x1435('0x31')](_0x473d6['body'][_0x1435('0x32')])){return _0x186e7a(_0x516e44['error'](0x1f4,_0x1435('0x33')));}if(_['isNil'](_0x473d6[_0x1435('0x34')]['body'])||_0x473d6[_0x1435('0x34')]['body']===''){return _0x186e7a(_0x516e44[_0x1435('0x16')](0x1f4,_0x1435('0x35')));}if(_['isNil'](_0x473d6[_0x1435('0x34')]['mapKey'])){return _0x186e7a(_0x516e44[_0x1435('0x16')](0x1f4,_0x1435('0x36')+_0x1fe164));}if(!_[_0x1435('0x37')](_0x1fe164,_0x473d6['body'][_0x1435('0x38')])){return _0x186e7a(_0x516e44[_0x1435('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1fe164));}var _0x1f73f4={};_0x1f73f4[_0x473d6[_0x1435('0x34')]['mapKey']]=_0x473d6[_0x1435('0x34')][_0x1435('0x32')];return db['MailAccount'][_0x1435('0x25')]({'where':{'id':_0x473d6[_0x1435('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x1435('0x3a'),'include':[{'model':db[_0x1435('0x2d')],'as':_0x1435('0x3b'),'where':_0x1f73f4,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x1435('0x3c')],'as':'Applications'},{'model':db[_0x1435('0x3d')],'as':'Smtp','include':[{'model':db[_0x1435('0x3e')],'as':_0x1435('0x3e')}]}]})[_0x1435('0x11')](function(_0x148862){if(_0x148862&&_0x148862[_0x1435('0x3a')]){var _0x3d2346=_0x148862[_0x1435('0x3f')]({'plain':!![]});_0x398d3c['account']=_[_0x1435('0x40')](_0x3d2346,[_0x1435('0x41'),_0x1435('0x3a')]);_0x398d3c['account'][_0x1435('0x28')]=_0x148862[_0x1435('0x29')]();_0x398d3c[_0x1435('0x42')]=_0x3d2346[_0x1435('0x41')];_0x398d3c[_0x1435('0x43')]=_0x3d2346[_0x1435('0x3a')];_0x398d3c[_0x1435('0x42')]=_[_0x1435('0x44')](_0x398d3c['applications'],[_0x1435('0x45')],[_0x1435('0x46')]);if(_0x398d3c[_0x1435('0x39')]&&_0x398d3c[_0x1435('0x39')]['autoclose']){_0x398d3c['applications'][_0x1435('0x47')]({'id':0x0,'priority':_0x398d3c[_0x1435('0x42')][_0x1435('0x48')]+0x1,'app':_0x1435('0x49'),'appdata':_0x1435('0x4a'),'interval':_0x1435('0x4b')});}if(_0x398d3c[_0x1435('0x39')][_0x1435('0x41')]){delete _0x398d3c[_0x1435('0x39')]['Applications'];}if(_0x398d3c['account'][_0x1435('0x3a')]){delete _0x398d3c['account'][_0x1435('0x3a')];}if(_0x3d2346[_0x1435('0x3a')][_0x1435('0x3b')][_0x1435('0x48')]){return _0x3d2346[_0x1435('0x3a')][_0x1435('0x3b')][0x0];}var _0xd776e6=_['defaults'](_0x473d6[_0x1435('0x34')],{'firstName':_0x473d6['body'][_0x1435('0x32')],'ListId':_0x3d2346[_0x1435('0x30')]});_0xd776e6[_0x473d6['body'][_0x1435('0x38')]]=_0x473d6[_0x1435('0x34')][_0x1435('0x32')];return db[_0x1435('0x2d')][_0x1435('0x4c')](_0xd776e6);}else{throw new Error('List\x20not\x20found');}})[_0x1435('0x11')](function(_0x3da03e){_0x398d3c[_0x1435('0x4d')]=_0x3da03e;if(_0x3da03e){if(!_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x4e')]){_0x473d6['body']['message'][_0x1435('0x4e')]=rs[_0x1435('0x4f')]()+'\x20'+_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x32')];}var _0x12c603={'ContactId':_0x3da03e['id'],'MailAccountId':_0x473d6[_0x1435('0x39')]['id'],'inReplyTo':_0x473d6[_0x1435('0x34')]['message'][_0x1435('0x4e')],'to':_0x473d6['body'][_0x1435('0x17')][_0x1435('0x32')],'cc':_0x473d6['body'][_0x1435('0x17')]['cc'],'subject':_0x473d6[_0x1435('0x34')]['message'][_0x1435('0x50')],'attach':_0x473d6[_0x1435('0x34')]['message'][_0x1435('0x51')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x1435('0x52')][_0x1435('0x25')]({'where':{'closed':![],'MailAccountId':_0x473d6[_0x1435('0x39')]['id']},'include':[{'model':db[_0x1435('0x53')],'as':'Messages','attributes':[_0x1435('0x4e')],'where':{'messageId':_0x473d6[_0x1435('0x34')]['message'][_0x1435('0x54')]}}]})[_0x1435('0x11')](function(_0x5d4807){if(_0x5d4807){return[_0x5d4807,![]];}return db[_0x1435('0x52')][_0x1435('0x4c')](_0x12c603)[_0x1435('0x11')](function(_0x44b211){return[_0x44b211,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x3e40d,_0x21bc66){if(_0x3e40d){_0x2dd1f5=_0x21bc66;if(!_0x21bc66){return _0x3e40d[_0x1435('0x55')]({'inReplyTo':_0x473d6[_0x1435('0x34')]['message'][_0x1435('0x4e')],'to':_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x32')],'cc':_0x473d6['body'][_0x1435('0x17')]['cc'],'subject':_0x473d6[_0x1435('0x34')][_0x1435('0x17')]['subject'],'attach':_0x3e40d[_0x1435('0x51')]?_0x3e40d[_0x1435('0x51')]:_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x51')],'substatus':null,'substatusAt':moment()[_0x1435('0x56')](_0x1435('0x57')),'lastMsgAt':moment()[_0x1435('0x56')](_0x1435('0x57')),'lastMsgDirection':'in'});}else{return _0x3e40d;}}})['then'](function(_0x1347a6){_0x398d3c[_0x1435('0x58')]=_0x1347a6[_0x1435('0x3f')]({'plain':!![]});_0x398d3c[_0x1435('0x58')]['created']=_0x2dd1f5;return db['MailMessage'][_0x1435('0x4c')]({'body':_0x473d6['body']['body'],'MailAccountId':_0x473d6['account']['id'],'MailInteractionId':_0x1347a6['id'],'direction':'in','ContactId':_0x398d3c[_0x1435('0x4d')]['id'],'messageId':_0x473d6['body']['message'][_0x1435('0x4e')],'from':_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x32')],'to':_0x473d6[_0x1435('0x34')]['message']['to'],'cc':_0x473d6[_0x1435('0x34')][_0x1435('0x17')]['cc'],'subject':_0x473d6[_0x1435('0x34')][_0x1435('0x17')]['subject'],'attach':_0x473d6[_0x1435('0x34')]['message'][_0x1435('0x51')],'Attachments':_0x473d6[_0x1435('0x34')]['message'][_0x1435('0x59')],'originTo':_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x5a')],'originCc':_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x5b')],'bcc':_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x5c')],'ChatWebsiteId':_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x5d')]||null,'originChannel':_0x473d6[_0x1435('0x34')][_0x1435('0x17')][_0x1435('0x5e')]||'Email','ChatOfflineMessageId':_0x473d6[_0x1435('0x34')][_0x1435('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x1435('0x5f')],'as':'Attachments'}]});})['then'](function(_0x1d0b14){_0x398d3c[_0x1435('0x17')]=_0x1d0b14;if(!_0x398d3c['interaction']['UserId']){return;}return db[_0x1435('0x60')]['find']({'attributes':['id',_0x1435('0x61')],'where':{'id':_0x398d3c[_0x1435('0x58')][_0x1435('0x62')]}});})['then'](function(_0x332d5a){if(_0x332d5a){_0x398d3c[_0x1435('0x42')][_0x1435('0x63')]({'id':0x0,'priority':0x0,'app':_0x1435('0x64'),'appdata':_0x332d5a[_0x1435('0x61')]+','+(_0x398d3c[_0x1435('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x1435('0x4b')});}if(!_0x398d3c[_0x1435('0x58')][_0x1435('0x65')]){return;}return db['MailQueue']['find']({'attributes':['id','name'],'where':{'id':_0x398d3c[_0x1435('0x58')][_0x1435('0x65')]}});})['then'](function(_0x15fd08){if(_0x15fd08){_0x398d3c[_0x1435('0x42')][_0x1435('0x63')]({'id':0x0,'priority':0x1,'app':_0x1435('0x66'),'appdata':_0x15fd08[_0x1435('0x61')]+','+(_0x398d3c[_0x1435('0x39')][_0x1435('0x67')]||0x12c),'interval':_0x1435('0x4b')});}return respondWithRpcPromise(_0x1435('0x68'),_0x1435('0x69'),_0x398d3c);})['then'](function(_0x2a3f87){_0x36bc74(_0x2a3f87);})[_0x1435('0x1a')](function(_0x1f1acc){_0x186e7a(_0x516e44['error'](0x1f4,_0x1f1acc[_0x1435('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index c1f34d8..df8994c 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 _0xe803=['update','emit','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0x5e186a,_0x9e8566){var _0x55eb05=function(_0x3637bf){while(--_0x3637bf){_0x5e186a['push'](_0x5e186a['shift']());}};_0x55eb05(++_0x9e8566);}(_0xe803,0x1b0));var _0x3e80=function(_0x310de7,_0x503112){_0x310de7=_0x310de7-0x0;var _0x16c080=_0xe803[_0x310de7];return _0x16c080;};'use strict';var MailAccountEvents=require(_0x3e80('0x0'));var events=[_0x3e80('0x1'),'remove',_0x3e80('0x2')];function createListener(_0x19327d,_0x3741d3){return function(_0x195536){_0x3741d3[_0x3e80('0x3')](_0x19327d,_0x195536);};}function removeListener(_0x2e5071,_0x4bbce4){return function(){MailAccountEvents[_0x3e80('0x4')](_0x2e5071,_0x4bbce4);};}exports['register']=function(_0x17a4f3){for(var _0xbaad91=0x0,_0x399df2=events[_0x3e80('0x5')];_0xbaad91<_0x399df2;_0xbaad91++){var _0x37b159=events[_0xbaad91];var _0x5f5238=createListener(_0x3e80('0x6')+_0x37b159,_0x17a4f3);MailAccountEvents['on'](_0x37b159,_0x5f5238);}}; \ No newline at end of file +var _0xde53=['length','./mailAccount.events','save','update','emit','removeListener'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xde53,0x199));var _0x3de5=function(_0x264ee4,_0x2986a6){_0x264ee4=_0x264ee4-0x0;var _0x1cda8e=_0xde53[_0x264ee4];return _0x1cda8e;};'use strict';var MailAccountEvents=require(_0x3de5('0x0'));var events=[_0x3de5('0x1'),'remove',_0x3de5('0x2')];function createListener(_0x164024,_0x143204){return function(_0x27c056){_0x143204[_0x3de5('0x3')](_0x164024,_0x27c056);};}function removeListener(_0x5f41bc,_0x505981){return function(){MailAccountEvents[_0x3de5('0x4')](_0x5f41bc,_0x505981);};}exports['register']=function(_0x10372f){for(var _0x405c3f=0x0,_0x3d2563=events[_0x3de5('0x5')];_0x405c3f<_0x3d2563;_0x405c3f++){var _0x548478=events[_0x405c3f];var _0x457f79=createListener('mailAccount:'+_0x548478,_0x10372f);MailAccountEvents['on'](_0x548478,_0x457f79);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 591d7ab..3068e87 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 _0x301b=['destroy','exports','multer','util','path','connect-timeout','Router','./mailApplication.controller','/:id','isAuthenticated','show','put','update','delete'];(function(_0x2f1607,_0x3207f6){var _0x6be822=function(_0x4d1163){while(--_0x4d1163){_0x2f1607['push'](_0x2f1607['shift']());}};_0x6be822(++_0x3207f6);}(_0x301b,0x1ec));var _0xb301=function(_0x255550,_0x241d39){_0x255550=_0x255550-0x0;var _0x1ff26f=_0x301b[_0x255550];return _0x1ff26f;};'use strict';var multer=require(_0xb301('0x0'));var util=require(_0xb301('0x1'));var path=require(_0xb301('0x2'));var timeout=require(_0xb301('0x3'));var express=require('express');var router=express[_0xb301('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb301('0x5'));router['get'](_0xb301('0x6'),auth[_0xb301('0x7')](),controller[_0xb301('0x8')]);router[_0xb301('0x9')](_0xb301('0x6'),auth[_0xb301('0x7')](),controller[_0xb301('0xa')]);router[_0xb301('0xb')](_0xb301('0x6'),auth['isAuthenticated'](),controller[_0xb301('0xc')]);module[_0xb301('0xd')]=router; \ No newline at end of file +var _0x475a=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','/:id','update','delete','multer','util'];(function(_0x54ccd7,_0x3bc3ce){var _0x4e667b=function(_0xab8fea){while(--_0xab8fea){_0x54ccd7['push'](_0x54ccd7['shift']());}};_0x4e667b(++_0x3bc3ce);}(_0x475a,0xc2));var _0xa475=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x475a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa475('0x0'));var util=require(_0xa475('0x1'));var path=require(_0xa475('0x2'));var timeout=require(_0xa475('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa475('0x4'));var interaction=require(_0xa475('0x5'));var config=require(_0xa475('0x6'));var controller=require('./mailApplication.controller');router[_0xa475('0x7')]('/:id',auth[_0xa475('0x8')](),controller[_0xa475('0x9')]);router[_0xa475('0xa')](_0xa475('0xb'),auth[_0xa475('0x8')](),controller[_0xa475('0xc')]);router[_0xa475('0xd')]('/:id',auth[_0xa475('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b8d1d94..747adf4 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 _0x4a99=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x16ecad,_0x205047){var _0x313ff7=function(_0x58b16a){while(--_0x58b16a){_0x16ecad['push'](_0x16ecad['shift']());}};_0x313ff7(++_0x205047);}(_0x4a99,0x9e));var _0x94a9=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4a99[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x94a9('0x0'));module[_0x94a9('0x1')]={'priority':{'type':Sequelize[_0x94a9('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x94a9('0x3')]()},'description':{'type':Sequelize[_0x94a9('0x4')]},'interval':{'type':Sequelize[_0x94a9('0x4')],'defaultValue':_0x94a9('0x5')}}; \ No newline at end of file +var _0x9087=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1dcb20,_0x1505bd){var _0xc381de=function(_0x235130){while(--_0x235130){_0x1dcb20['push'](_0x1dcb20['shift']());}};_0xc381de(++_0x1505bd);}(_0x9087,0x1ea));var _0x7908=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9087[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7908('0x0'));module[_0x7908('0x1')]={'priority':{'type':Sequelize[_0x7908('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7908('0x3')],'allowNull':![],'defaultValue':_0x7908('0x4')},'appdata':{'type':Sequelize[_0x7908('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7908('0x3')],'defaultValue':_0x7908('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 292b74d..1a7c4d7 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 _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x33ebdf,_0x585d59){var _0x5bb4a6=function(_0x41054e){while(--_0x41054e){_0x33ebdf['push'](_0x33ebdf['shift']());}};_0x5bb4a6(++_0x585d59);}(_0xb43b,0x1b2));var _0xbb43=function(_0x117061,_0xee6329){_0x117061=_0x117061-0x0;var _0x28320e=_0xb43b[_0x117061];return _0x28320e;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','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'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xfcfc24,_0x48ca53){_0xfcfc24=_0xfcfc24-0x0;var _0x58f773=_0xbdb7[_0xfcfc24];return _0x58f773;};'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(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5e54a73..7d8cd6e 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 _0xd78a=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','utf8mb4_unicode_ci'];(function(_0x502068,_0x9faa58){var _0x7612b6=function(_0x23519e){while(--_0x23519e){_0x502068['push'](_0x502068['shift']());}};_0x7612b6(++_0x9faa58);}(_0xd78a,0xa8));var _0xad78=function(_0x243b96,_0x509d27){_0x243b96=_0x243b96-0x0;var _0x32b392=_0xd78a[_0x243b96];return _0x32b392;};'use strict';var _=require(_0xad78('0x0'));var util=require(_0xad78('0x1'));var logger=require('../../config/logger')(_0xad78('0x2'));var moment=require(_0xad78('0x3'));var BPromise=require('bluebird');var rp=require(_0xad78('0x4'));var fs=require('fs');var path=require(_0xad78('0x5'));var rimraf=require(_0xad78('0x6'));var config=require(_0xad78('0x7'));var attributes=require('./mailApplication.attributes');module[_0xad78('0x8')]=function(_0x6d5ff7,_0x42d645){return _0x6d5ff7[_0xad78('0x9')](_0xad78('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xad78('0xb')});}; \ No newline at end of file +var _0x1fb7=['define','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./mailApplication.attributes','exports'];(function(_0x219daf,_0x36b307){var _0x4c2e61=function(_0x42f490){while(--_0x42f490){_0x219daf['push'](_0x219daf['shift']());}};_0x4c2e61(++_0x36b307);}(_0x1fb7,0x1c5));var _0x71fb=function(_0xe8f68f,_0x32e7c3){_0xe8f68f=_0xe8f68f-0x0;var _0x15a1d9=_0x1fb7[_0xe8f68f];return _0x15a1d9;};'use strict';var _=require(_0x71fb('0x0'));var util=require(_0x71fb('0x1'));var logger=require(_0x71fb('0x2'))(_0x71fb('0x3'));var moment=require('moment');var BPromise=require(_0x71fb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71fb('0x5'));var rimraf=require('rimraf');var config=require(_0x71fb('0x6'));var attributes=require(_0x71fb('0x7'));module[_0x71fb('0x8')]=function(_0x5b0b04,_0x16a851){return _0x5b0b04[_0x71fb('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x71fb('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 208d304..cbd8f36 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 _0x38ad=['UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x8cfcaf,_0x304d05){var _0xcbc55d=function(_0x2c0c19){while(--_0x2c0c19){_0x8cfcaf['push'](_0x8cfcaf['shift']());}};_0xcbc55d(++_0x304d05);}(_0x38ad,0xef));var _0xd38a=function(_0x168802,_0x53b74e){_0x168802=_0x168802-0x0;var _0xc9b3fd=_0x38ad[_0x168802];return _0xc9b3fd;};'use strict';var _=require(_0xd38a('0x0'));var util=require('util');var moment=require(_0xd38a('0x1'));var BPromise=require(_0xd38a('0x2'));var rs=require(_0xd38a('0x3'));var fs=require('fs');var Redis=require(_0xd38a('0x4'));var db=require(_0xd38a('0x5'))['db'];var utils=require(_0xd38a('0x6'));var logger=require(_0xd38a('0x7'))(_0xd38a('0x8'));var config=require(_0xd38a('0x9'));var jayson=require(_0xd38a('0xa'));var client=jayson[_0xd38a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bdcc2,_0x328f3a,_0x3752f9){return new BPromise(function(_0x3f118c,_0x2b9dba){return client[_0xd38a('0xc')](_0x4bdcc2,_0x3752f9)[_0xd38a('0xd')](function(_0x2bab1b){logger[_0xd38a('0xe')](_0xd38a('0xf'),_0x328f3a,_0xd38a('0x10'));logger[_0xd38a('0x11')](_0xd38a('0x12'),_0x328f3a,_0xd38a('0x10'),JSON[_0xd38a('0x13')](_0x2bab1b));if(_0x2bab1b[_0xd38a('0x14')]){if(_0x2bab1b[_0xd38a('0x14')][_0xd38a('0x15')]===0x1f4){logger[_0xd38a('0x14')](_0xd38a('0xf'),_0x328f3a,_0x2bab1b['error'][_0xd38a('0x16')]);return _0x2b9dba(_0x2bab1b[_0xd38a('0x14')][_0xd38a('0x16')]);}logger[_0xd38a('0x14')]('MailApplication,\x20%s,\x20%s',_0x328f3a,_0x2bab1b[_0xd38a('0x14')][_0xd38a('0x16')]);return _0x3f118c(_0x2bab1b[_0xd38a('0x14')]['message']);}else{logger[_0xd38a('0xe')]('MailApplication,\x20%s,\x20%s',_0x328f3a,_0xd38a('0x10'));_0x3f118c(_0x2bab1b[_0xd38a('0x17')][_0xd38a('0x16')]);}})[_0xd38a('0x18')](function(_0x547de1){logger[_0xd38a('0x14')](_0xd38a('0xf'),_0x328f3a,_0x547de1);_0x2b9dba(_0x547de1);});});}exports[_0xd38a('0x19')]=function(_0x106d5f){var _0x363a22=this;return new Promise(function(_0x3a5500,_0x3b8005){return db[_0xd38a('0x1a')][_0xd38a('0x1b')](_0x106d5f[_0xd38a('0x1c')],{'raw':_0x106d5f[_0xd38a('0x1d')]?_0x106d5f[_0xd38a('0x1d')][_0xd38a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106d5f[_0xd38a('0x1d')]?_0x106d5f[_0xd38a('0x1d')][_0xd38a('0x1f')]||null:null,'attributes':_0x106d5f['options']?_0x106d5f[_0xd38a('0x1d')][_0xd38a('0x20')]||null:null,'limit':_0x106d5f[_0xd38a('0x1d')]?_0x106d5f[_0xd38a('0x1d')]['limit']||null:null})[_0xd38a('0xd')](function(_0x55a4b9){logger['info'](_0xd38a('0x19'),_0x106d5f);logger[_0xd38a('0x11')]('UpdateMailApplication',_0x106d5f,JSON[_0xd38a('0x13')](_0x55a4b9));_0x3a5500(_0x55a4b9);})['catch'](function(_0x54612c){logger['error'](_0xd38a('0x19'),_0x54612c[_0xd38a('0x16')],_0x106d5f);_0x3b8005(_0x363a22[_0xd38a('0x14')](0x1f4,_0x54612c[_0xd38a('0x16')]));});});}; \ No newline at end of file +var _0xb9bf=['../../config/environment','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','UpdateMailApplication','MailApplication','update','options','raw','debug','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb9bf,0xaf));var _0xfb9b=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xb9bf[_0x279d37];return _0x530173;};'use strict';var _=require(_0xfb9b('0x0'));var util=require(_0xfb9b('0x1'));var moment=require(_0xfb9b('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb9b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb9b('0x4'));var logger=require(_0xfb9b('0x5'))(_0xfb9b('0x6'));var config=require(_0xfb9b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfb9b('0x8')][_0xfb9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x356d39,_0x466b70,_0xf97552){return new BPromise(function(_0x3eb465,_0x3e2a44){return client[_0xfb9b('0xa')](_0x356d39,_0xf97552)[_0xfb9b('0xb')](function(_0x4b5fed){logger['info'](_0xfb9b('0xc'),_0x466b70,_0xfb9b('0xd'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x466b70,_0xfb9b('0xd'),JSON[_0xfb9b('0xe')](_0x4b5fed));if(_0x4b5fed['error']){if(_0x4b5fed[_0xfb9b('0xf')][_0xfb9b('0x10')]===0x1f4){logger[_0xfb9b('0xf')](_0xfb9b('0xc'),_0x466b70,_0x4b5fed[_0xfb9b('0xf')][_0xfb9b('0x11')]);return _0x3e2a44(_0x4b5fed['error'][_0xfb9b('0x11')]);}logger[_0xfb9b('0xf')](_0xfb9b('0xc'),_0x466b70,_0x4b5fed[_0xfb9b('0xf')][_0xfb9b('0x11')]);return _0x3eb465(_0x4b5fed[_0xfb9b('0xf')]['message']);}else{logger[_0xfb9b('0x12')](_0xfb9b('0xc'),_0x466b70,_0xfb9b('0xd'));_0x3eb465(_0x4b5fed['result'][_0xfb9b('0x11')]);}})[_0xfb9b('0x13')](function(_0x49fed7){logger['error'](_0xfb9b('0xc'),_0x466b70,_0x49fed7);_0x3e2a44(_0x49fed7);});});}exports[_0xfb9b('0x14')]=function(_0x372f12){var _0x1aad9c=this;return new Promise(function(_0x1af378,_0x4a5136){return db[_0xfb9b('0x15')][_0xfb9b('0x16')](_0x372f12['body'],{'raw':_0x372f12[_0xfb9b('0x17')]?_0x372f12['options'][_0xfb9b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x372f12[_0xfb9b('0x17')]?_0x372f12['options']['where']||null:null,'attributes':_0x372f12[_0xfb9b('0x17')]?_0x372f12[_0xfb9b('0x17')]['attributes']||null:null,'limit':_0x372f12[_0xfb9b('0x17')]?_0x372f12[_0xfb9b('0x17')]['limit']||null:null})[_0xfb9b('0xb')](function(_0x143ccd){logger[_0xfb9b('0x12')]('UpdateMailApplication',_0x372f12);logger[_0xfb9b('0x19')](_0xfb9b('0x14'),_0x372f12,JSON[_0xfb9b('0xe')](_0x143ccd));_0x1af378(_0x143ccd);})[_0xfb9b('0x13')](function(_0x5d170b){logger[_0xfb9b('0xf')]('UpdateMailApplication',_0x5d170b[_0xfb9b('0x11')],_0x372f12);_0x4a5136(_0x1aad9c['error'](0x1f4,_0x5d170b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index df3e627..450cdd0 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 _0x90fe=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','destroy','removeTags','exports','express','./mailInteraction.controller'];(function(_0x568753,_0x1d4c4b){var _0x1def3f=function(_0x7cb859){while(--_0x7cb859){_0x568753['push'](_0x568753['shift']());}};_0x1def3f(++_0x1d4c4b);}(_0x90fe,0x66));var _0xe90f=function(_0x3af69a,_0x4b44bc){_0x3af69a=_0x3af69a-0x0;var _0x11d723=_0x90fe[_0x3af69a];return _0x11d723;};'use strict';var express=require(_0xe90f('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xe90f('0x1'));router[_0xe90f('0x2')]('/',auth[_0xe90f('0x3')](),controller[_0xe90f('0x4')]);router[_0xe90f('0x2')](_0xe90f('0x5'),auth[_0xe90f('0x3')](),controller[_0xe90f('0x6')]);router[_0xe90f('0x2')](_0xe90f('0x7'),auth[_0xe90f('0x3')](),controller[_0xe90f('0x8')]);router[_0xe90f('0x2')](_0xe90f('0x9'),auth[_0xe90f('0x3')](),controller[_0xe90f('0xa')]);router['get'](_0xe90f('0xb'),auth['isAuthenticated'](),controller[_0xe90f('0xc')]);router[_0xe90f('0xd')]('/',auth[_0xe90f('0x3')](),controller['create']);router[_0xe90f('0xd')](_0xe90f('0x9'),auth[_0xe90f('0x3')](),controller[_0xe90f('0xe')]);router[_0xe90f('0xd')]('/:id/tags',auth[_0xe90f('0x3')](),interaction[_0xe90f('0xf')](_0xe90f('0x10'),_0xe90f('0x11')),controller[_0xe90f('0x12')]);router[_0xe90f('0x13')]('/:id',auth[_0xe90f('0x3')](),interaction['tracked'](_0xe90f('0x10'),_0xe90f('0x14')),controller[_0xe90f('0x15')]);router[_0xe90f('0x16')](_0xe90f('0x7'),auth[_0xe90f('0x3')](),interaction[_0xe90f('0xf')](_0xe90f('0x10'),'mailinteraction:destroy'),controller[_0xe90f('0x17')]);router[_0xe90f('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0xe90f('0x18')]);module[_0xe90f('0x19')]=router; \ No newline at end of file +var _0x46b0=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','mailinteraction:destroy','destroy','delete','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','/describe','describe','/:id','show','isAuthenticated','getMessages','/:id/download'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x46b0,0xa2));var _0x046b=function(_0x325bce,_0xcd20d2){_0x325bce=_0x325bce-0x0;var _0x19b5ac=_0x46b0[_0x325bce];return _0x19b5ac;};'use strict';var express=require('express');var router=express[_0x046b('0x0')]();var auth=require(_0x046b('0x1'));var interaction=require(_0x046b('0x2'));var controller=require(_0x046b('0x3'));router[_0x046b('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x046b('0x4')](_0x046b('0x5'),auth['isAuthenticated'](),controller[_0x046b('0x6')]);router['get'](_0x046b('0x7'),auth['isAuthenticated'](),controller[_0x046b('0x8')]);router['get']('/:id/messages',auth[_0x046b('0x9')](),controller[_0x046b('0xa')]);router[_0x046b('0x4')](_0x046b('0xb'),auth[_0x046b('0x9')](),controller[_0x046b('0xc')]);router[_0x046b('0xd')]('/',auth[_0x046b('0x9')](),controller[_0x046b('0xe')]);router[_0x046b('0xd')](_0x046b('0xf'),auth['isAuthenticated'](),controller[_0x046b('0x10')]);router[_0x046b('0xd')](_0x046b('0x11'),auth[_0x046b('0x9')](),interaction[_0x046b('0x12')]('mail',_0x046b('0x13')),controller[_0x046b('0x14')]);router[_0x046b('0x15')](_0x046b('0x7'),auth[_0x046b('0x9')](),interaction['tracked'](_0x046b('0x16'),_0x046b('0x17')),controller['update']);router['delete']('/:id',auth[_0x046b('0x9')](),interaction[_0x046b('0x12')](_0x046b('0x16'),_0x046b('0x18')),controller[_0x046b('0x19')]);router[_0x046b('0x1a')]('/:id/tags',auth[_0x046b('0x9')](),controller[_0x046b('0x1b')]);module[_0x046b('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 e18914e..8726a9e 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 _0xdacc=['TEXT','long','BOOLEAN','ENUM','out','sequelize','DATE','STRING'];(function(_0x176cf0,_0x3016c9){var _0x1cddb6=function(_0xc09aca){while(--_0xc09aca){_0x176cf0['push'](_0x176cf0['shift']());}};_0x1cddb6(++_0x3016c9);}(_0xdacc,0x1dd));var _0xcdac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdacc[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xcdac('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcdac('0x1')]},'disposition':{'type':Sequelize[_0xcdac('0x2')]},'secondDisposition':{'type':Sequelize[_0xcdac('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcdac('0x2')]},'note':{'type':Sequelize[_0xcdac('0x2')]},'inReplyTo':{'type':Sequelize[_0xcdac('0x2')](0x1fe)},'to':{'type':Sequelize[_0xcdac('0x2')]},'cc':{'type':Sequelize[_0xcdac('0x3')](_0xcdac('0x4'))},'subject':{'type':Sequelize[_0xcdac('0x3')]()},'attach':{'type':Sequelize[_0xcdac('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xcdac('0x2')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xcdac('0x6')]('in',_0xcdac('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcdac('0x6')]('in',_0xcdac('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcdac('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2673=['long','BOOLEAN','ENUM','out','INTEGER','sequelize','exports','DATE','STRING','TEXT'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x2673,0xe1));var _0x3267=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x2673[_0x4f8f3b];return _0x4c250c;};'use strict';var Sequelize=require(_0x3267('0x0'));var iconv=require('iconv');module[_0x3267('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3267('0x2')]},'disposition':{'type':Sequelize[_0x3267('0x3')]},'secondDisposition':{'type':Sequelize[_0x3267('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3267('0x3')]},'note':{'type':Sequelize[_0x3267('0x3')]},'inReplyTo':{'type':Sequelize[_0x3267('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3267('0x4')](_0x3267('0x5'))},'subject':{'type':Sequelize[_0x3267('0x4')]()},'attach':{'type':Sequelize[_0x3267('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3267('0x2')]},'substatus':{'type':Sequelize[_0x3267('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x3267('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3267('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3267('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3267('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3267('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3267('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ccd75cb..ec46ae8 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 _0x875f=['register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','findAll','mail','user','catch','show','model','keys','MailInteraction','query','intersection','fields','attributes','length','includeAll','merge','options','create','body','find','params','describe','MailMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','rows','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','server','files','root','attachments','join','transcript-%d-%s.zip','push','Attachment','Attachments','bcc','subject','Messages','get','each','from','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','build','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket'];(function(_0x531f6e,_0x330129){var _0x5b99a3=function(_0x374827){while(--_0x374827){_0x531f6e['push'](_0x531f6e['shift']());}};_0x5b99a3(++_0x330129);}(_0x875f,0x1c9));var _0xf875=function(_0x1ed898,_0x42431b){_0x1ed898=_0x1ed898-0x0;var _0x65e8cf=_0x875f[_0x1ed898];return _0x65e8cf;};'use strict';var emlformat=require(_0xf875('0x0'));var rimraf=require(_0xf875('0x1'));var zipdir=require(_0xf875('0x2'));var moment=require(_0xf875('0x3'));var BPromise=require(_0xf875('0x4'));var util=require(_0xf875('0x5'));var path=require('path');var fs=require('fs');var _=require(_0xf875('0x6'));var juice=require(_0xf875('0x7'));var Redis=require(_0xf875('0x8'));var interaction=require(_0xf875('0x9'));var qs=require(_0xf875('0xa'));var logger=require(_0xf875('0xb'))('api');var config=require(_0xf875('0xc'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xf875('0xd'));config['redis']=_[_0xf875('0xe')](config[_0xf875('0xf')],{'host':_0xf875('0x10'),'port':0x18eb});var socket=require(_0xf875('0x11'))(new Redis(config[_0xf875('0xf')]));require(_0xf875('0x12'))[_0xf875('0x13')](socket);function respondWithStatusCode(_0x134883,_0x10d97f){_0x10d97f=_0x10d97f||0xcc;return function(_0x5b5b1c){if(_0x5b5b1c){return _0x134883[_0xf875('0x14')](_0x10d97f);}return _0x134883[_0xf875('0x15')](_0x10d97f)[_0xf875('0x16')]();};}function respondWithResult(_0xf6d8f2,_0x104a3a){_0x104a3a=_0x104a3a||0xc8;return function(_0xb38b4f){if(_0xb38b4f){return _0xf6d8f2[_0xf875('0x15')](_0x104a3a)[_0xf875('0x17')](_0xb38b4f);}};}function respondWithFilteredResult(_0x1a44fd,_0x3e5fdf){return function(_0x5bcee2){if(_0x5bcee2){var _0x4d4cb8=typeof _0x3e5fdf[_0xf875('0x18')]===_0xf875('0x19')&&typeof _0x3e5fdf[_0xf875('0x1a')]==='undefined';var _0x1f7054=_0x5bcee2[_0xf875('0x1b')];var _0x4f03eb=_0x4d4cb8?0x0:_0x3e5fdf[_0xf875('0x18')];var _0x2b22ed=_0x4d4cb8?_0x5bcee2[_0xf875('0x1b')]:_0x3e5fdf[_0xf875('0x18')]+_0x3e5fdf[_0xf875('0x1a')];var _0x5af150;if(_0x2b22ed>=_0x1f7054){_0x2b22ed=_0x1f7054;_0x5af150=0xc8;}else{_0x5af150=0xce;}_0x1a44fd[_0xf875('0x15')](_0x5af150);return _0x1a44fd[_0xf875('0x1c')](_0xf875('0x1d'),_0x4f03eb+'-'+_0x2b22ed+'/'+_0x1f7054)['json'](_0x5bcee2);}return null;};}function saveUpdates(_0x34aec4){return function(_0x2b1806){if(_0x2b1806){return _0x2b1806['update'](_0x34aec4)[_0xf875('0x1e')](function(_0x3def94){return _0x3def94;});}return null;};}function removeEntity(_0x228788){return function(_0x1a2c92){if(_0x1a2c92){return _0x1a2c92[_0xf875('0x1f')]()['then'](function(){_0x228788[_0xf875('0x15')](0xcc)[_0xf875('0x16')]();});}};}function handleEntityNotFound(_0x15c143){return function(_0x4534ab){if(!_0x4534ab){_0x15c143['sendStatus'](0x194);}return _0x4534ab;};}function handleError(_0x37ce86,_0x323195){_0x323195=_0x323195||0x1f4;return function(_0x203f2e){logger[_0xf875('0x20')](_0x203f2e[_0xf875('0x21')]);if(_0x203f2e[_0xf875('0x22')]){delete _0x203f2e['name'];}_0x37ce86[_0xf875('0x15')](_0x323195)[_0xf875('0x23')](_0x203f2e);};}exports[_0xf875('0x24')]=function(_0x4e0d73,_0x34db3c){var _0x248e12={};var _0x43d0aa=_[_0xf875('0x25')](db['MailInteraction'][_0xf875('0x26')],function(_0x481652){return{'name':_0x481652[_0xf875('0x27')],'type':_0x481652[_0xf875('0x28')][_0xf875('0x29')]};});_0x248e12=qs['getOptions'](_0x43d0aa,_0x4e0d73);return interaction[_0xf875('0x2a')](_0xf875('0x2b'),_0x4e0d73['query'],_0x4e0d73[_0xf875('0x2c')],_0x248e12,_0x43d0aa)[_0xf875('0x1e')](respondWithFilteredResult(_0x34db3c,_0x248e12))[_0xf875('0x2d')](handleError(_0x34db3c,null));};exports[_0xf875('0x2e')]=function(_0x3a1f35,_0x5ee494){var _0x24ef49={'raw':![],'where':{'id':_0x3a1f35['params']['id']}},_0xdc7e93={};_0xdc7e93[_0xf875('0x2f')]=_[_0xf875('0x30')](db[_0xf875('0x31')][_0xf875('0x26')]);_0xdc7e93[_0xf875('0x32')]=_['keys'](_0x3a1f35[_0xf875('0x32')]);_0xdc7e93['filters']=_[_0xf875('0x33')](_0xdc7e93[_0xf875('0x2f')],_0xdc7e93[_0xf875('0x32')]);_0x24ef49['attributes']=_[_0xf875('0x33')](_0xdc7e93[_0xf875('0x2f')],qs[_0xf875('0x34')](_0x3a1f35[_0xf875('0x32')][_0xf875('0x34')]));_0x24ef49[_0xf875('0x35')]=_0x24ef49[_0xf875('0x35')][_0xf875('0x36')]?_0x24ef49[_0xf875('0x35')]:_0xdc7e93[_0xf875('0x2f')];if(_0x3a1f35[_0xf875('0x32')][_0xf875('0x37')]){_0x24ef49['include']=[{'all':!![]}];}_0x24ef49=_[_0xf875('0x38')]({},_0x24ef49,_0x3a1f35[_0xf875('0x39')]);return db['MailInteraction']['find'](_0x24ef49)[_0xf875('0x1e')](handleEntityNotFound(_0x5ee494,null))[_0xf875('0x1e')](respondWithResult(_0x5ee494,null))[_0xf875('0x2d')](handleError(_0x5ee494,null));};exports[_0xf875('0x3a')]=function(_0x1b1715,_0x2125c5){return db[_0xf875('0x31')][_0xf875('0x3a')](_0x1b1715[_0xf875('0x3b')],{})['then'](respondWithResult(_0x2125c5,0xc9))['catch'](handleError(_0x2125c5,null));};exports['update']=function(_0x568f81,_0xe2cea4){if(_0x568f81['body']['id']){delete _0x568f81[_0xf875('0x3b')]['id'];}return db['MailInteraction'][_0xf875('0x3c')]({'where':{'id':_0x568f81[_0xf875('0x3d')]['id']}})['then'](handleEntityNotFound(_0xe2cea4,null))[_0xf875('0x1e')](saveUpdates(_0x568f81[_0xf875('0x3b')],null))[_0xf875('0x1e')](respondWithResult(_0xe2cea4,null))[_0xf875('0x2d')](handleError(_0xe2cea4,null));};exports[_0xf875('0x1f')]=function(_0x22bcab,_0x18364d){return db[_0xf875('0x31')][_0xf875('0x3c')]({'where':{'id':_0x22bcab['params']['id']}})[_0xf875('0x1e')](handleEntityNotFound(_0x18364d,null))['then'](removeEntity(_0x18364d,null))['catch'](handleError(_0x18364d,null));};exports[_0xf875('0x3e')]=function(_0x321931,_0xa1e0bb){return db[_0xf875('0x31')]['describe']()[_0xf875('0x1e')](respondWithResult(_0xa1e0bb,null))['catch'](handleError(_0xa1e0bb,null));};exports['addMessage']=function(_0x1036b6,_0x2c9a69){return db[_0xf875('0x3f')][_0xf875('0x3c')]({'where':{'id':_0x1036b6[_0xf875('0x3d')]['id']}})[_0xf875('0x1e')](handleEntityNotFound(_0x2c9a69,null))['then'](function(_0x31420f){if(_0x31420f){return _0x31420f['addMessage'](_0x1036b6[_0xf875('0x3b')][_0xf875('0x40')],_[_0xf875('0x41')](_0x1036b6[_0xf875('0x3b')],[_0xf875('0x40'),'id'])||{});}})['then'](respondWithResult(_0x2c9a69,null))[_0xf875('0x2d')](handleError(_0x2c9a69,null));};exports[_0xf875('0x42')]=function(_0xcb36ae,_0x1fa9c5){var _0x5fb953={'raw':![],'where':{}};var _0x31813b={};var _0x36b378={'count':0x0,'rows':[]};return db[_0xf875('0x31')][_0xf875('0x43')]({'where':{'id':_0xcb36ae[_0xf875('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1fa9c5,null))[_0xf875('0x1e')](function(_0x444184){if(_0x444184){_0x31813b['model']=_[_0xf875('0x30')](db['MailMessage'][_0xf875('0x26')]);_0x31813b[_0xf875('0x32')]=_['keys'](_0xcb36ae[_0xf875('0x32')]);_0x31813b[_0xf875('0x44')]=_['intersection'](_0x31813b['model'],_0x31813b[_0xf875('0x32')]);_0x5fb953['attributes']=_[_0xf875('0x33')](_0x31813b['model'],qs[_0xf875('0x34')](_0xcb36ae['query']['fields']));_0x5fb953[_0xf875('0x35')]=_0x5fb953[_0xf875('0x35')][_0xf875('0x36')]?_0x5fb953[_0xf875('0x35')]:_0x31813b['model'];if(!_0xcb36ae[_0xf875('0x32')][_0xf875('0x45')](_0xf875('0x46'))){_0x5fb953[_0xf875('0x1a')]=qs[_0xf875('0x1a')](_0xcb36ae[_0xf875('0x32')][_0xf875('0x1a')]);_0x5fb953[_0xf875('0x18')]=qs['offset'](_0xcb36ae['query']['offset']);}_0x5fb953[_0xf875('0x47')]=qs['sort'](_0xcb36ae[_0xf875('0x32')][_0xf875('0x48')]);_0x5fb953[_0xf875('0x49')]=qs['filters'](_[_0xf875('0x4a')](_0xcb36ae[_0xf875('0x32')],_0x31813b[_0xf875('0x44')]));_0x5fb953[_0xf875('0x49')][_0xf875('0x4b')]=_0x444184['id'];if(_0xcb36ae[_0xf875('0x32')][_0xf875('0x4c')]){_0x5fb953[_0xf875('0x49')]=_[_0xf875('0x38')](_0x5fb953[_0xf875('0x49')],{'$or':_[_0xf875('0x25')](_0x5fb953[_0xf875('0x35')],function(_0xe94774){var _0x5db055={};_0x5db055[_0xe94774]={'$like':'%'+_0xcb36ae['query'][_0xf875('0x4c')]+'%'};return _0x5db055;})});}if(_0xcb36ae[_0xf875('0x32')][_0xf875('0x4d')]){var _0x5e7338=_0xcb36ae[_0xf875('0x32')][_0xf875('0x4d')][_0xf875('0x4e')](',');var _0x40c5fa={};_0x40c5fa[_0x5e7338[0x0]]={'$gte':moment(_0x5e7338[0x1])[_0xf875('0x4f')](_0xf875('0x50'))};_0x5fb953[_0xf875('0x49')]=_[_0xf875('0x38')](_0x5fb953[_0xf875('0x49')],_0x40c5fa);}_0x5fb953=_[_0xf875('0x38')]({},_0x5fb953,_0xcb36ae[_0xf875('0x39')]);return db[_0xf875('0x3f')]['count']({'where':_0x5fb953[_0xf875('0x49')]})['then'](function(_0x4f691e){_0x36b378[_0xf875('0x1b')]=_0x4f691e;if(_0xcb36ae[_0xf875('0x32')]['includeAll']){_0x5fb953[_0xf875('0x51')]=[{'all':!![]}];}return db[_0xf875('0x3f')]['findAll'](_0x5fb953);})['then'](function(_0x370f34){if(_0xcb36ae[_0xf875('0x32')][_0xf875('0x52')]===_0xf875('0x53')){for(var _0x6de2f8=0x0;_0x6de2f8<_0x370f34[_0xf875('0x36')];_0x6de2f8++){_0x370f34[_0x6de2f8]['body']=juice(_0x370f34[_0x6de2f8][_0xf875('0x3b')]);}}_0x36b378[_0xf875('0x54')]=_0x370f34;return _0x36b378;});}})[_0xf875('0x1e')](respondWithFilteredResult(_0x1fa9c5,_0x5fb953))['catch'](handleError(_0x1fa9c5,null));};exports[_0xf875('0x55')]=function(_0x5ec59a,_0x209a35){return db['MailInteraction'][_0xf875('0x3c')]({'where':{'id':_0x5ec59a[_0xf875('0x3d')]['id']}})['then'](handleEntityNotFound(_0x209a35,null))['then'](function(_0x30799f){if(_0x30799f){return _0x30799f['setTags'](_0x5ec59a[_0xf875('0x3b')]['ids'],_[_0xf875('0x41')](_0x5ec59a['body'],[_0xf875('0x40'),'id'])||{})[_0xf875('0x56')](function(){return db[_0xf875('0x57')][_0xf875('0x2a')]({'attributes':['id',_0xf875('0x22'),_0xf875('0x58')],'where':{'id':_0x5ec59a[_0xf875('0x3b')]['ids']}});})['then'](function(_0x1e2ebb){socket[_0xf875('0x59')](_0xf875('0x5a'),{'id':Number(_0x5ec59a[_0xf875('0x3d')]['id']),'tags':_0x1e2ebb||[]});return{'id':Number(_0x5ec59a[_0xf875('0x3d')]['id']),'tags':_0x1e2ebb||[]};});}})[_0xf875('0x1e')](respondWithResult(_0x209a35,null))['catch'](handleError(_0x209a35,null));};exports['removeTags']=function(_0x14f643,_0x212a37){return db[_0xf875('0x31')][_0xf875('0x3c')]({'where':{'id':_0x14f643['params']['id']}})['then'](handleEntityNotFound(_0x212a37,null))['then'](function(_0x284567){if(_0x284567){return _0x284567[_0xf875('0x5b')](_0x14f643[_0xf875('0x32')][_0xf875('0x40')]);}})[_0xf875('0x1e')](respondWithStatusCode(_0x212a37,null))[_0xf875('0x2d')](handleError(_0x212a37,null));};exports['download']=function(_0x5c6d79,_0xbe2dd8){var _0xfeeabe=moment()[_0xf875('0x5c')]()[_0xf875('0x5d')]();var _0x432953=path['join'](config['root'],_0xf875('0x5e'),_0xf875('0x5f'),'tmp');var _0x5e48bd=path['join'](config[_0xf875('0x60')],_0xf875('0x5e'),'files',_0xf875('0x61'));var _0x4cb511=path[_0xf875('0x62')](_0x432953,_0xfeeabe);var _0x5ea605=util['format'](_0xf875('0x63'),_0x5c6d79[_0xf875('0x3d')]['id'],_0xfeeabe);var _0x34450a=path['join'](_0x432953,_0x5ea605);var _0x1dd26d=[];if(_0x5c6d79[_0xf875('0x32')][_0xf875('0x61')]){_0x1dd26d[_0xf875('0x64')]({'model':db[_0xf875('0x65')],'as':_0xf875('0x66'),'raw':!![]});}var _0x4a2c52=[{'model':db[_0xf875('0x3f')],'as':'Messages','attributes':['id',_0xf875('0x3b'),'from','to','cc',_0xf875('0x67'),_0xf875('0x68'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1dd26d}];return db[_0xf875('0x31')][_0xf875('0x3c')]({'where':{'id':_0x5c6d79['params']['id']},'include':_0x4a2c52})[_0xf875('0x1e')](handleEntityNotFound(_0xbe2dd8,null))[_0xf875('0x1e')](function(_0x508fbb){if(_0x508fbb&&_0x508fbb[_0xf875('0x69')]){var _0x41fb2c=_0x508fbb[_0xf875('0x6a')]({'plain':!![]});fs['mkdirSync'](_0x4cb511);return BPromise[_0xf875('0x6b')](_0x41fb2c[_0xf875('0x69')],function(_0x544365,_0x18f955){var _0x559e86={'from':_0x544365[_0xf875('0x6c')],'to':_0x544365['to']||_0xf875('0x6d'),'subject':_0x544365[_0xf875('0x68')],'html':htmlEntities[_0xf875('0x6e')](_0x544365[_0xf875('0x3b')]),'headers':{'Date':moment(_0x544365[_0xf875('0x6f')])['format'](_0xf875('0x70'))},'attachments':[]};if(_0x544365['cc']){_0x559e86['headers']['Cc']=_0x544365['cc'];}if(_0x544365['bcc']){_0x559e86[_0xf875('0x71')][_0xf875('0x72')]=_0x544365[_0xf875('0x67')];}return new BPromise(function(_0x1a6cab,_0x16f7cf){if(_0x544365[_0xf875('0x66')]){for(var _0x54d58d=0x0;_0x54d58d<_0x544365[_0xf875('0x66')][_0xf875('0x36')];_0x54d58d++){var _0x18a2f5=_0x544365['Attachments'][_0x54d58d];var _0x281ebb=path[_0xf875('0x62')](_0x5e48bd,_0x18a2f5[_0xf875('0x73')]);if(fs[_0xf875('0x74')](_0x281ebb)){_0x559e86[_0xf875('0x61')][_0xf875('0x64')]({'name':_0x18a2f5[_0xf875('0x22')],'contentType':_0x18a2f5['type'],'data':fs['readFileSync'](_0x281ebb)});}}}emlformat[_0xf875('0x75')](_0x559e86,function(_0x515eb0,_0x256af4){if(_0x515eb0)return _0x16f7cf(_0x515eb0);fs['writeFileSync'](path[_0xf875('0x62')](_0x4cb511,util[_0xf875('0x4f')]('message%d.eml',_0x18f955)),_0x256af4);return _0x1a6cab(_0x256af4);});});})[_0xf875('0x1e')](function(){return new BPromise(function(_0x2471eb,_0x11577e){zipdir(_0x4cb511,{'saveTo':_0x34450a},function(_0x1c18ff,_0x269c67){if(_0x1c18ff)return _0x11577e(_0x1c18ff);return _0x2471eb(_0x269c67);});})['then'](function(){return new BPromise(function(_0x223cfa,_0x12911b){rimraf(_0x4cb511,function(_0x3641b2){if(_0x3641b2)_0x12911b(_0x3641b2);return _0x223cfa();});});})[_0xf875('0x1e')](function(){return _0xbe2dd8['download'](_0x34450a,_0x5ea605,function(_0x184d70){if(!_0x184d70)fs[_0xf875('0x76')](_0x34450a);});});});}else{return _0xbe2dd8[_0xf875('0x14')](0xc8);}})[_0xf875('0x2d')](handleError(_0xbe2dd8,null));}; \ No newline at end of file +var _0xa407=['attachments','push','Attachments','Messages','from','subject','createdAt','get','each','missing.recipient@your.company.com','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','download','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','html-entities','redis','defaults','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','name','send','index','MailInteraction','rawAttributes','fieldName','type','findAll','catch','show','params','model','query','keys','filters','intersection','fields','attributes','length','includeAll','merge','create','body','find','describe','addMessage','MailMessage','ids','omit','getMessages','nolimit','order','sort','where','pick','MailInteractionId','filter','map','$gte','split','options','include','inlineCss','true','rows','addTags','setTags','Tag','color','removeTags','toString','root','server','tmp','join','files'];(function(_0x380dab,_0x6bc5dc){var _0x394027=function(_0x5baddc){while(--_0x5baddc){_0x380dab['push'](_0x380dab['shift']());}};_0x394027(++_0x6bc5dc);}(_0xa407,0xf1));var _0x7a40=function(_0x9be784,_0x16d19d){_0x9be784=_0x9be784-0x0;var _0x315674=_0xa407[_0x9be784];return _0x315674;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a40('0x0'));var zipdir=require(_0x7a40('0x1'));var moment=require(_0x7a40('0x2'));var BPromise=require(_0x7a40('0x3'));var util=require(_0x7a40('0x4'));var path=require(_0x7a40('0x5'));var fs=require('fs');var _=require(_0x7a40('0x6'));var juice=require(_0x7a40('0x7'));var Redis=require(_0x7a40('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x7a40('0x9'));var logger=require('../../config/logger')(_0x7a40('0xa'));var config=require(_0x7a40('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x7a40('0xc'));config[_0x7a40('0xd')]=_[_0x7a40('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7a40('0xf'))(new Redis(config[_0x7a40('0xd')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x20456e,_0x260e9d){_0x260e9d=_0x260e9d||0xcc;return function(_0x206a54){if(_0x206a54){return _0x20456e[_0x7a40('0x10')](_0x260e9d);}return _0x20456e['status'](_0x260e9d)[_0x7a40('0x11')]();};}function respondWithResult(_0x358428,_0x3e9933){_0x3e9933=_0x3e9933||0xc8;return function(_0x4b8bcd){if(_0x4b8bcd){return _0x358428[_0x7a40('0x12')](_0x3e9933)[_0x7a40('0x13')](_0x4b8bcd);}};}function respondWithFilteredResult(_0x24f47c,_0xae492c){return function(_0xf5033){if(_0xf5033){var _0x57299d=typeof _0xae492c[_0x7a40('0x14')]===_0x7a40('0x15')&&typeof _0xae492c['limit']===_0x7a40('0x15');var _0x25c510=_0xf5033['count'];var _0x41439b=_0x57299d?0x0:_0xae492c[_0x7a40('0x14')];var _0x482035=_0x57299d?_0xf5033[_0x7a40('0x16')]:_0xae492c[_0x7a40('0x14')]+_0xae492c[_0x7a40('0x17')];var _0x581fb2;if(_0x482035>=_0x25c510){_0x482035=_0x25c510;_0x581fb2=0xc8;}else{_0x581fb2=0xce;}_0x24f47c[_0x7a40('0x12')](_0x581fb2);return _0x24f47c[_0x7a40('0x18')](_0x7a40('0x19'),_0x41439b+'-'+_0x482035+'/'+_0x25c510)[_0x7a40('0x13')](_0xf5033);}return null;};}function saveUpdates(_0x259e8b){return function(_0x22a9da){if(_0x22a9da){return _0x22a9da[_0x7a40('0x1a')](_0x259e8b)[_0x7a40('0x1b')](function(_0x3e0340){return _0x3e0340;});}return null;};}function removeEntity(_0x4b5eaa){return function(_0x131a3e){if(_0x131a3e){return _0x131a3e[_0x7a40('0x1c')]()[_0x7a40('0x1b')](function(){_0x4b5eaa['status'](0xcc)[_0x7a40('0x11')]();});}};}function handleEntityNotFound(_0x4bb89f){return function(_0x503968){if(!_0x503968){_0x4bb89f[_0x7a40('0x10')](0x194);}return _0x503968;};}function handleError(_0x1a1213,_0x5e0282){_0x5e0282=_0x5e0282||0x1f4;return function(_0x74b3f4){logger[_0x7a40('0x1d')](_0x74b3f4['stack']);if(_0x74b3f4[_0x7a40('0x1e')]){delete _0x74b3f4[_0x7a40('0x1e')];}_0x1a1213[_0x7a40('0x12')](_0x5e0282)[_0x7a40('0x1f')](_0x74b3f4);};}exports[_0x7a40('0x20')]=function(_0x3c39fd,_0x30dfc8){var _0x4ebc92={};var _0x48123a=_['map'](db[_0x7a40('0x21')][_0x7a40('0x22')],function(_0x19d016){return{'name':_0x19d016[_0x7a40('0x23')],'type':_0x19d016[_0x7a40('0x24')]['key']};});_0x4ebc92=qs['getOptions'](_0x48123a,_0x3c39fd);return interaction[_0x7a40('0x25')]('mail',_0x3c39fd['query'],_0x3c39fd['user'],_0x4ebc92,_0x48123a)[_0x7a40('0x1b')](respondWithFilteredResult(_0x30dfc8,_0x4ebc92))[_0x7a40('0x26')](handleError(_0x30dfc8,null));};exports[_0x7a40('0x27')]=function(_0x53aaed,_0x418249){var _0x50bb48={'raw':![],'where':{'id':_0x53aaed[_0x7a40('0x28')]['id']}},_0x279f52={};_0x279f52[_0x7a40('0x29')]=_['keys'](db[_0x7a40('0x21')][_0x7a40('0x22')]);_0x279f52[_0x7a40('0x2a')]=_[_0x7a40('0x2b')](_0x53aaed[_0x7a40('0x2a')]);_0x279f52[_0x7a40('0x2c')]=_[_0x7a40('0x2d')](_0x279f52[_0x7a40('0x29')],_0x279f52[_0x7a40('0x2a')]);_0x50bb48['attributes']=_[_0x7a40('0x2d')](_0x279f52[_0x7a40('0x29')],qs[_0x7a40('0x2e')](_0x53aaed[_0x7a40('0x2a')]['fields']));_0x50bb48[_0x7a40('0x2f')]=_0x50bb48['attributes'][_0x7a40('0x30')]?_0x50bb48[_0x7a40('0x2f')]:_0x279f52[_0x7a40('0x29')];if(_0x53aaed['query'][_0x7a40('0x31')]){_0x50bb48['include']=[{'all':!![]}];}_0x50bb48=_[_0x7a40('0x32')]({},_0x50bb48,_0x53aaed['options']);return db['MailInteraction']['find'](_0x50bb48)[_0x7a40('0x1b')](handleEntityNotFound(_0x418249,null))[_0x7a40('0x1b')](respondWithResult(_0x418249,null))[_0x7a40('0x26')](handleError(_0x418249,null));};exports[_0x7a40('0x33')]=function(_0x18902e,_0x8c8976){return db[_0x7a40('0x21')][_0x7a40('0x33')](_0x18902e[_0x7a40('0x34')],{})[_0x7a40('0x1b')](respondWithResult(_0x8c8976,0xc9))[_0x7a40('0x26')](handleError(_0x8c8976,null));};exports[_0x7a40('0x1a')]=function(_0x280837,_0x479664){if(_0x280837[_0x7a40('0x34')]['id']){delete _0x280837[_0x7a40('0x34')]['id'];}return db[_0x7a40('0x21')][_0x7a40('0x35')]({'where':{'id':_0x280837['params']['id']}})[_0x7a40('0x1b')](handleEntityNotFound(_0x479664,null))[_0x7a40('0x1b')](saveUpdates(_0x280837[_0x7a40('0x34')],null))[_0x7a40('0x1b')](respondWithResult(_0x479664,null))[_0x7a40('0x26')](handleError(_0x479664,null));};exports[_0x7a40('0x1c')]=function(_0x430ed6,_0x400a43){return db[_0x7a40('0x21')][_0x7a40('0x35')]({'where':{'id':_0x430ed6[_0x7a40('0x28')]['id']}})[_0x7a40('0x1b')](handleEntityNotFound(_0x400a43,null))['then'](removeEntity(_0x400a43,null))[_0x7a40('0x26')](handleError(_0x400a43,null));};exports[_0x7a40('0x36')]=function(_0x5c6d29,_0x5e9ab7){return db[_0x7a40('0x21')][_0x7a40('0x36')]()[_0x7a40('0x1b')](respondWithResult(_0x5e9ab7,null))['catch'](handleError(_0x5e9ab7,null));};exports[_0x7a40('0x37')]=function(_0x352256,_0x1333b6){return db[_0x7a40('0x38')][_0x7a40('0x35')]({'where':{'id':_0x352256['params']['id']}})['then'](handleEntityNotFound(_0x1333b6,null))[_0x7a40('0x1b')](function(_0x3d3030){if(_0x3d3030){return _0x3d3030[_0x7a40('0x37')](_0x352256[_0x7a40('0x34')][_0x7a40('0x39')],_[_0x7a40('0x3a')](_0x352256[_0x7a40('0x34')],['ids','id'])||{});}})[_0x7a40('0x1b')](respondWithResult(_0x1333b6,null))[_0x7a40('0x26')](handleError(_0x1333b6,null));};exports[_0x7a40('0x3b')]=function(_0x2286c6,_0x1a46b1){var _0x229fd9={'raw':![],'where':{}};var _0x265aca={};var _0x3a5e6c={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x2286c6[_0x7a40('0x28')]['id']}})[_0x7a40('0x1b')](handleEntityNotFound(_0x1a46b1,null))[_0x7a40('0x1b')](function(_0x4b157e){if(_0x4b157e){_0x265aca[_0x7a40('0x29')]=_[_0x7a40('0x2b')](db[_0x7a40('0x38')][_0x7a40('0x22')]);_0x265aca[_0x7a40('0x2a')]=_[_0x7a40('0x2b')](_0x2286c6[_0x7a40('0x2a')]);_0x265aca[_0x7a40('0x2c')]=_[_0x7a40('0x2d')](_0x265aca['model'],_0x265aca['query']);_0x229fd9[_0x7a40('0x2f')]=_['intersection'](_0x265aca[_0x7a40('0x29')],qs[_0x7a40('0x2e')](_0x2286c6[_0x7a40('0x2a')]['fields']));_0x229fd9[_0x7a40('0x2f')]=_0x229fd9[_0x7a40('0x2f')][_0x7a40('0x30')]?_0x229fd9[_0x7a40('0x2f')]:_0x265aca['model'];if(!_0x2286c6[_0x7a40('0x2a')]['hasOwnProperty'](_0x7a40('0x3c'))){_0x229fd9[_0x7a40('0x17')]=qs['limit'](_0x2286c6[_0x7a40('0x2a')][_0x7a40('0x17')]);_0x229fd9['offset']=qs[_0x7a40('0x14')](_0x2286c6[_0x7a40('0x2a')][_0x7a40('0x14')]);}_0x229fd9[_0x7a40('0x3d')]=qs[_0x7a40('0x3e')](_0x2286c6['query'][_0x7a40('0x3e')]);_0x229fd9[_0x7a40('0x3f')]=qs[_0x7a40('0x2c')](_[_0x7a40('0x40')](_0x2286c6[_0x7a40('0x2a')],_0x265aca[_0x7a40('0x2c')]));_0x229fd9[_0x7a40('0x3f')][_0x7a40('0x41')]=_0x4b157e['id'];if(_0x2286c6[_0x7a40('0x2a')][_0x7a40('0x42')]){_0x229fd9[_0x7a40('0x3f')]=_[_0x7a40('0x32')](_0x229fd9[_0x7a40('0x3f')],{'$or':_[_0x7a40('0x43')](_0x229fd9['attributes'],function(_0x4cdcb1){var _0x3dbc17={};_0x3dbc17[_0x4cdcb1]={'$like':'%'+_0x2286c6['query'][_0x7a40('0x42')]+'%'};return _0x3dbc17;})});}if(_0x2286c6[_0x7a40('0x2a')][_0x7a40('0x44')]){var _0x44838f=_0x2286c6[_0x7a40('0x2a')][_0x7a40('0x44')][_0x7a40('0x45')](',');var _0xacc87b={};_0xacc87b[_0x44838f[0x0]]={'$gte':moment(_0x44838f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x229fd9['where']=_[_0x7a40('0x32')](_0x229fd9[_0x7a40('0x3f')],_0xacc87b);}_0x229fd9=_[_0x7a40('0x32')]({},_0x229fd9,_0x2286c6[_0x7a40('0x46')]);return db[_0x7a40('0x38')]['count']({'where':_0x229fd9['where']})[_0x7a40('0x1b')](function(_0x2ccbe6){_0x3a5e6c[_0x7a40('0x16')]=_0x2ccbe6;if(_0x2286c6[_0x7a40('0x2a')]['includeAll']){_0x229fd9[_0x7a40('0x47')]=[{'all':!![]}];}return db[_0x7a40('0x38')][_0x7a40('0x25')](_0x229fd9);})[_0x7a40('0x1b')](function(_0x3431ec){if(_0x2286c6['query'][_0x7a40('0x48')]===_0x7a40('0x49')){for(var _0x483236=0x0;_0x483236<_0x3431ec[_0x7a40('0x30')];_0x483236++){_0x3431ec[_0x483236][_0x7a40('0x34')]=juice(_0x3431ec[_0x483236][_0x7a40('0x34')]);}}_0x3a5e6c[_0x7a40('0x4a')]=_0x3431ec;return _0x3a5e6c;});}})[_0x7a40('0x1b')](respondWithFilteredResult(_0x1a46b1,_0x229fd9))[_0x7a40('0x26')](handleError(_0x1a46b1,null));};exports[_0x7a40('0x4b')]=function(_0x3574a8,_0x1a6d1d){return db[_0x7a40('0x21')]['find']({'where':{'id':_0x3574a8[_0x7a40('0x28')]['id']}})[_0x7a40('0x1b')](handleEntityNotFound(_0x1a6d1d,null))[_0x7a40('0x1b')](function(_0x1d35f3){if(_0x1d35f3){return _0x1d35f3[_0x7a40('0x4c')](_0x3574a8[_0x7a40('0x34')][_0x7a40('0x39')],_['omit'](_0x3574a8[_0x7a40('0x34')],[_0x7a40('0x39'),'id'])||{})['spread'](function(){return db[_0x7a40('0x4d')]['findAll']({'attributes':['id',_0x7a40('0x1e'),_0x7a40('0x4e')],'where':{'id':_0x3574a8['body'][_0x7a40('0x39')]}});})['then'](function(_0x22017a){socket['emit']('mailInteractionTags:save',{'id':Number(_0x3574a8['params']['id']),'tags':_0x22017a||[]});return{'id':Number(_0x3574a8['params']['id']),'tags':_0x22017a||[]};});}})[_0x7a40('0x1b')](respondWithResult(_0x1a6d1d,null))[_0x7a40('0x26')](handleError(_0x1a6d1d,null));};exports[_0x7a40('0x4f')]=function(_0x85791d,_0x4929d5){return db[_0x7a40('0x21')][_0x7a40('0x35')]({'where':{'id':_0x85791d['params']['id']}})['then'](handleEntityNotFound(_0x4929d5,null))['then'](function(_0x15caff){if(_0x15caff){return _0x15caff[_0x7a40('0x4f')](_0x85791d[_0x7a40('0x2a')][_0x7a40('0x39')]);}})[_0x7a40('0x1b')](respondWithStatusCode(_0x4929d5,null))[_0x7a40('0x26')](handleError(_0x4929d5,null));};exports['download']=function(_0x2f4f86,_0x1e13b7){var _0x41eb3e=moment()['unix']()[_0x7a40('0x50')]();var _0x168667=path['join'](config[_0x7a40('0x51')],_0x7a40('0x52'),'files',_0x7a40('0x53'));var _0x557b1f=path[_0x7a40('0x54')](config[_0x7a40('0x51')],'server',_0x7a40('0x55'),_0x7a40('0x56'));var _0x3fec81=path[_0x7a40('0x54')](_0x168667,_0x41eb3e);var _0xb5f66b=util['format']('transcript-%d-%s.zip',_0x2f4f86[_0x7a40('0x28')]['id'],_0x41eb3e);var _0x31d196=path['join'](_0x168667,_0xb5f66b);var _0x38e08d=[];if(_0x2f4f86['query']['attachments']){_0x38e08d[_0x7a40('0x57')]({'model':db['Attachment'],'as':_0x7a40('0x58'),'raw':!![]});}var _0x5bf08b=[{'model':db[_0x7a40('0x38')],'as':_0x7a40('0x59'),'attributes':['id',_0x7a40('0x34'),_0x7a40('0x5a'),'to','cc','bcc',_0x7a40('0x5b'),_0x7a40('0x5c')],'where':{'secret':![]},'order':qs[_0x7a40('0x3e')]('id'),'include':_0x38e08d}];return db[_0x7a40('0x21')][_0x7a40('0x35')]({'where':{'id':_0x2f4f86[_0x7a40('0x28')]['id']},'include':_0x5bf08b})[_0x7a40('0x1b')](handleEntityNotFound(_0x1e13b7,null))[_0x7a40('0x1b')](function(_0x19fa56){if(_0x19fa56&&_0x19fa56[_0x7a40('0x59')]){var _0x19d728=_0x19fa56[_0x7a40('0x5d')]({'plain':!![]});fs['mkdirSync'](_0x3fec81);return BPromise[_0x7a40('0x5e')](_0x19d728['Messages'],function(_0x3ab425,_0x54a53e){var _0x3a3e85={'from':_0x3ab425['from'],'to':_0x3ab425['to']||_0x7a40('0x5f'),'subject':_0x3ab425[_0x7a40('0x5b')],'html':htmlEntities[_0x7a40('0x60')](_0x3ab425[_0x7a40('0x34')]),'headers':{'Date':moment(_0x3ab425[_0x7a40('0x5c')])[_0x7a40('0x61')](_0x7a40('0x62'))},'attachments':[]};if(_0x3ab425['cc']){_0x3a3e85[_0x7a40('0x63')]['Cc']=_0x3ab425['cc'];}if(_0x3ab425[_0x7a40('0x64')]){_0x3a3e85[_0x7a40('0x63')][_0x7a40('0x65')]=_0x3ab425[_0x7a40('0x64')];}return new BPromise(function(_0xfa1e4f,_0x2e2058){if(_0x3ab425['Attachments']){for(var _0x4702a7=0x0;_0x4702a7<_0x3ab425[_0x7a40('0x58')]['length'];_0x4702a7++){var _0x2976e3=_0x3ab425[_0x7a40('0x58')][_0x4702a7];var _0x1d4e0d=path[_0x7a40('0x54')](_0x557b1f,_0x2976e3[_0x7a40('0x66')]);if(fs[_0x7a40('0x67')](_0x1d4e0d)){_0x3a3e85[_0x7a40('0x56')][_0x7a40('0x57')]({'name':_0x2976e3[_0x7a40('0x1e')],'contentType':_0x2976e3[_0x7a40('0x24')],'data':fs[_0x7a40('0x68')](_0x1d4e0d)});}}}emlformat['build'](_0x3a3e85,function(_0x5d83ee,_0x9bb261){if(_0x5d83ee)return _0x2e2058(_0x5d83ee);fs[_0x7a40('0x69')](path['join'](_0x3fec81,util[_0x7a40('0x61')](_0x7a40('0x6a'),_0x54a53e)),_0x9bb261);return _0xfa1e4f(_0x9bb261);});});})[_0x7a40('0x1b')](function(){return new BPromise(function(_0x4d38ca,_0x4f5040){zipdir(_0x3fec81,{'saveTo':_0x31d196},function(_0x956476,_0x289bbc){if(_0x956476)return _0x4f5040(_0x956476);return _0x4d38ca(_0x289bbc);});})[_0x7a40('0x1b')](function(){return new BPromise(function(_0x1d034e,_0x58215e){rimraf(_0x3fec81,function(_0x2d8c60){if(_0x2d8c60)_0x58215e(_0x2d8c60);return _0x1d034e();});});})[_0x7a40('0x1b')](function(){return _0x1e13b7[_0x7a40('0x6b')](_0x31d196,_0xb5f66b,function(_0x1f96e5){if(!_0x1f96e5)fs[_0x7a40('0x6c')](_0x31d196);});});});}else{return _0x1e13b7[_0x7a40('0x10')](0xc8);}})['catch'](handleError(_0x1e13b7,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 47e0033..a7d1ac3 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 _0x43c8=['update','getUsers','map','findAll','then','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save'];(function(_0x4f8f08,_0x12e75d){var _0x2a2763=function(_0x5c6652){while(--_0x5c6652){_0x4f8f08['push'](_0x4f8f08['shift']());}};_0x2a2763(++_0x12e75d);}(_0x43c8,0x1d6));var _0x843c=function(_0x5007aa,_0x7d8ff6){_0x5007aa=_0x5007aa-0x0;var _0x1c8313=_0x43c8[_0x5007aa];return _0x1c8313;};'use strict';var EventEmitter=require(_0x843c('0x0'));var MailInteraction=require(_0x843c('0x1'))['db'][_0x843c('0x2')];var MailMessage=require(_0x843c('0x1'))['db'][_0x843c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x843c('0x4')](0x0);var events={'afterCreate':_0x843c('0x5'),'afterUpdate':_0x843c('0x6'),'afterDestroy':'remove'};function emitEvent(_0x15273b){return function(_0x45dd7e,_0x26fdbb,_0x417f03){_0x45dd7e[_0x843c('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xe2ed35){_0x45dd7e['setDataValue']('Users',_0xe2ed35[_0x843c('0x8')](function(_0x59625b){return{'id':_0x59625b['id']};}));return MailMessage[_0x843c('0x9')]({'where':{'MailInteractionId':_0x45dd7e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x843c('0xa')](function(_0xd9879d){_0x45dd7e[_0x843c('0xb')](_0x843c('0xc'),_0xd9879d[_0x843c('0xd')]);MailInteractionEvents[_0x843c('0xe')](_0x15273b+':'+_0x45dd7e['id'],_0x45dd7e);MailInteractionEvents[_0x843c('0xe')](_0x15273b,_0x45dd7e);_0x417f03(null);})['catch'](_0x417f03(null));};}for(var e in events){if(events[_0x843c('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x843c('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x9bb7=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x4e1ca0,_0xc5d90a){var _0x39feea=function(_0x14e6fd){while(--_0x14e6fd){_0x4e1ca0['push'](_0x4e1ca0['shift']());}};_0x39feea(++_0xc5d90a);}(_0x9bb7,0x15b));var _0x79bb=function(_0x21b762,_0xc8ef11){_0x21b762=_0x21b762-0x0;var _0x2ea6d4=_0x9bb7[_0x21b762];return _0x2ea6d4;};'use strict';var EventEmitter=require(_0x79bb('0x0'));var MailInteraction=require(_0x79bb('0x1'))['db'][_0x79bb('0x2')];var MailMessage=require(_0x79bb('0x1'))['db'][_0x79bb('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x79bb('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x79bb('0x5'),'afterDestroy':_0x79bb('0x6')};function emitEvent(_0xe3f578){return function(_0x3ae73d,_0x2d7719,_0x100266){_0x3ae73d[_0x79bb('0x7')]({'attributes':['id'],'raw':!![]})[_0x79bb('0x8')](function(_0x439aae){_0x3ae73d[_0x79bb('0x9')](_0x79bb('0xa'),_0x439aae[_0x79bb('0xb')](function(_0x5eccc4){return{'id':_0x5eccc4['id']};}));return MailMessage[_0x79bb('0xc')]({'where':{'MailInteractionId':_0x3ae73d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x79bb('0x8')](function(_0x2f001a){_0x3ae73d[_0x79bb('0x9')](_0x79bb('0xd'),_0x2f001a['length']);MailInteractionEvents['emit'](_0xe3f578+':'+_0x3ae73d['id'],_0x3ae73d);MailInteractionEvents[_0x79bb('0xe')](_0xe3f578,_0x3ae73d);_0x100266(null);})[_0x79bb('0xf')](_0x100266(null));};}for(var e in events){if(events[_0x79bb('0x10')](e)){var event=events[e];MailInteraction[_0x79bb('0x11')](e,emitEvent(event));}}module[_0x79bb('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 03ac7d0..7312e73 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 _0x0a75=['path','rimraf','../../config/environment','./mailInteraction.attributes','define','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','substatusAt','closedAt','models','get','closed','update','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25ee66,_0x1d0ff6){var _0x14338a=function(_0x3c7012){while(--_0x3c7012){_0x25ee66['push'](_0x25ee66['shift']());}};_0x14338a(++_0x1d0ff6);}(_0x0a75,0x7b));var _0x50a7=function(_0x47dafd,_0x33a94f){_0x47dafd=_0x47dafd-0x0;var _0x2cce1b=_0x0a75[_0x47dafd];return _0x2cce1b;};'use strict';var _=require(_0x50a7('0x0'));var util=require(_0x50a7('0x1'));var logger=require(_0x50a7('0x2'))(_0x50a7('0x3'));var moment=require(_0x50a7('0x4'));var BPromise=require(_0x50a7('0x5'));var rp=require(_0x50a7('0x6'));var fs=require('fs');var path=require(_0x50a7('0x7'));var rimraf=require(_0x50a7('0x8'));var config=require(_0x50a7('0x9'));var attributes=require(_0x50a7('0xa'));module['exports']=function(_0x237d4c,_0x282024){return _0x237d4c[_0x50a7('0xb')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x50a7('0xc'),'fields':[_0x50a7('0xd'),'to'],'type':_0x50a7('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa165bb,_0x24877c,_0x4660ba){if(_0xa165bb[_0x50a7('0xf')]){_0xa165bb['substatusAt']=moment()[_0x50a7('0x10')](_0x50a7('0x11'));}if(_0xa165bb['closed']){_0xa165bb['closedAt']=moment()[_0x50a7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4660ba(null,_0x24877c);},'beforeUpdate':function(_0x2a2c40,_0x1a5068,_0x4b9396){if(_0x2a2c40['changed'](_0x50a7('0xf'))){_0x2a2c40[_0x50a7('0x12')]=_0x2a2c40['substatus']?moment()[_0x50a7('0x10')](_0x50a7('0x11')):null;}if(_0x2a2c40['changed']('closed')){_0x2a2c40[_0x50a7('0x13')]=moment()[_0x50a7('0x10')](_0x50a7('0x11'));_0x2a2c40['substatus']=null;_0x2a2c40['substatusAt']=null;}_0x4b9396(null,_0x2a2c40);},'afterUpdate':function(_0x554f82,_0x47c647,_0x3726f6){var _0x30bbcb=_0x237d4c[_0x50a7('0x14')];var _0x215b58=_0x554f82[_0x50a7('0x15')]({'plain':!![]});if(_0x215b58[_0x50a7('0x16')]){return _0x30bbcb['MailMessage'][_0x50a7('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x215b58['id']}})['then'](function(){_0x3726f6();})[_0x50a7('0x18')](function(_0x2c9ac6){_0x3726f6(_0x2c9ac6);});}else{_0x3726f6();}}},'charset':_0x50a7('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x50a4=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','catch'];(function(_0x572208,_0x4e2eb5){var _0x535016=function(_0x46d78f){while(--_0x46d78f){_0x572208['push'](_0x572208['shift']());}};_0x535016(++_0x4e2eb5);}(_0x50a4,0x1cd));var _0x450a=function(_0x22c254,_0x59801f){_0x22c254=_0x22c254-0x0;var _0x12b7a6=_0x50a4[_0x22c254];return _0x12b7a6;};'use strict';var _=require(_0x450a('0x0'));var util=require('util');var logger=require(_0x450a('0x1'))('api');var moment=require(_0x450a('0x2'));var BPromise=require(_0x450a('0x3'));var rp=require(_0x450a('0x4'));var fs=require('fs');var path=require(_0x450a('0x5'));var rimraf=require(_0x450a('0x6'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x450a('0x7')]=function(_0x4cdc4c,_0x5baa75){return _0x4cdc4c[_0x450a('0x8')](_0x450a('0x9'),attributes,{'tableName':_0x450a('0xa'),'paranoid':![],'indexes':[{'name':_0x450a('0xb'),'fields':['subject','to'],'type':_0x450a('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50374b,_0x21c9bf,_0x3686eb){if(_0x50374b[_0x450a('0xd')]){_0x50374b[_0x450a('0xe')]=moment()[_0x450a('0xf')](_0x450a('0x10'));}if(_0x50374b[_0x450a('0x11')]){_0x50374b[_0x450a('0x12')]=moment()[_0x450a('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3686eb(null,_0x21c9bf);},'beforeUpdate':function(_0x19977e,_0x3d246d,_0x1c52fc){if(_0x19977e['changed']('substatus')){_0x19977e[_0x450a('0xe')]=_0x19977e['substatus']?moment()['format'](_0x450a('0x10')):null;}if(_0x19977e[_0x450a('0x13')](_0x450a('0x11'))){_0x19977e[_0x450a('0x12')]=moment()[_0x450a('0xf')](_0x450a('0x10'));_0x19977e[_0x450a('0xd')]=null;_0x19977e[_0x450a('0xe')]=null;}_0x1c52fc(null,_0x19977e);},'afterUpdate':function(_0x1e35b1,_0x36fabb,_0x21f61c){var _0x1b37b4=_0x4cdc4c[_0x450a('0x14')];var _0x29e41f=_0x1e35b1['get']({'plain':!![]});if(_0x29e41f[_0x450a('0x11')]){return _0x1b37b4[_0x450a('0x15')][_0x450a('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x29e41f['id']}})[_0x450a('0x17')](function(){_0x21f61c();})[_0x450a('0x18')](function(_0x53cf42){_0x21f61c(_0x53cf42);});}else{_0x21f61c();}}},'charset':_0x450a('0x19'),'collate':_0x450a('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0ca6500..6af70be 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 _0x9876=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateMailInteraction','update','body','options','where','attributes','limit','then','debug','AddTagsToMailInteraction','MailInteraction','find','addTags','omit','ids'];(function(_0x365877,_0x428816){var _0x2ba9ce=function(_0x52af47){while(--_0x52af47){_0x365877['push'](_0x365877['shift']());}};_0x2ba9ce(++_0x428816);}(_0x9876,0x159));var _0x6987=function(_0x179fae,_0x3e4885){_0x179fae=_0x179fae-0x0;var _0xc7bd68=_0x9876[_0x179fae];return _0xc7bd68;};'use strict';var _=require(_0x6987('0x0'));var util=require(_0x6987('0x1'));var moment=require(_0x6987('0x2'));var BPromise=require(_0x6987('0x3'));var rs=require(_0x6987('0x4'));var fs=require('fs');var Redis=require(_0x6987('0x5'));var db=require(_0x6987('0x6'))['db'];var utils=require(_0x6987('0x7'));var logger=require(_0x6987('0x8'))(_0x6987('0x9'));var config=require('../../config/environment');var jayson=require(_0x6987('0xa'));var client=jayson[_0x6987('0xb')]['http']({'port':0x232a});config['redis']=_[_0x6987('0xc')](config['redis'],{'host':_0x6987('0xd'),'port':0x18eb});var socket=require(_0x6987('0xe'))(new Redis(config[_0x6987('0xf')]));require(_0x6987('0x10'))[_0x6987('0x11')](socket);function respondWithRpcPromise(_0x25cacb,_0x10fe8d,_0x4799d4){return new BPromise(function(_0x364189,_0x59a963){return client[_0x6987('0x12')](_0x25cacb,_0x4799d4)['then'](function(_0x1b4456){logger['info'](_0x6987('0x13'),_0x10fe8d,_0x6987('0x14'));logger['debug'](_0x6987('0x15'),_0x10fe8d,_0x6987('0x14'),JSON[_0x6987('0x16')](_0x1b4456));if(_0x1b4456[_0x6987('0x17')]){if(_0x1b4456[_0x6987('0x17')]['code']===0x1f4){logger[_0x6987('0x17')](_0x6987('0x13'),_0x10fe8d,_0x1b4456[_0x6987('0x17')]['message']);return _0x59a963(_0x1b4456[_0x6987('0x17')][_0x6987('0x18')]);}logger[_0x6987('0x17')](_0x6987('0x13'),_0x10fe8d,_0x1b4456[_0x6987('0x17')][_0x6987('0x18')]);return _0x364189(_0x1b4456['error'][_0x6987('0x18')]);}else{logger[_0x6987('0x19')](_0x6987('0x13'),_0x10fe8d,_0x6987('0x14'));_0x364189(_0x1b4456['result'][_0x6987('0x18')]);}})[_0x6987('0x1a')](function(_0x5790df){logger[_0x6987('0x17')](_0x6987('0x13'),_0x10fe8d,_0x5790df);_0x59a963(_0x5790df);});});}exports[_0x6987('0x1b')]=function(_0x35dcd4){var _0x3ce94f=this;return new Promise(function(_0x27f791,_0x3d8bed){return db['MailInteraction'][_0x6987('0x1c')](_0x35dcd4[_0x6987('0x1d')],{'raw':_0x35dcd4['options']?_0x35dcd4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35dcd4['options']?_0x35dcd4[_0x6987('0x1e')][_0x6987('0x1f')]||null:null,'attributes':_0x35dcd4['options']?_0x35dcd4[_0x6987('0x1e')][_0x6987('0x20')]||null:null,'limit':_0x35dcd4[_0x6987('0x1e')]?_0x35dcd4[_0x6987('0x1e')][_0x6987('0x21')]||null:null})[_0x6987('0x22')](function(_0x3f5b71){logger[_0x6987('0x19')]('UpdateMailInteraction',_0x35dcd4);logger[_0x6987('0x23')]('UpdateMailInteraction',_0x35dcd4,JSON[_0x6987('0x16')](_0x3f5b71));_0x27f791(_0x3f5b71);})['catch'](function(_0x2174b7){logger[_0x6987('0x17')]('UpdateMailInteraction',_0x2174b7[_0x6987('0x18')],_0x35dcd4);_0x3d8bed(_0x3ce94f[_0x6987('0x17')](0x1f4,_0x2174b7[_0x6987('0x18')]));});});};exports[_0x6987('0x24')]=function(_0x2f9361){return new Promise(function(_0x44c41f,_0x23c053){return db[_0x6987('0x25')][_0x6987('0x26')]({'where':_0x2f9361[_0x6987('0x1e')]?_0x2f9361[_0x6987('0x1e')][_0x6987('0x1f')]||null:null})['then'](function(_0x253318){if(_0x253318){return _0x253318[_0x6987('0x27')](_0x2f9361['body']['ids'],_[_0x6987('0x28')](_0x2f9361['body'],[_0x6987('0x29'),'id'])||{});}})['spread'](function(_0x573559){logger[_0x6987('0x19')](_0x6987('0x2a'),_0x2f9361);logger[_0x6987('0x23')]('AddTags',_0x2f9361,JSON[_0x6987('0x16')](_0x573559));_0x44c41f(_0x573559);})['catch'](function(_0x3cadc0){logger[_0x6987('0x17')](_0x6987('0x2a'),_0x3cadc0[_0x6987('0x18')],_0x2f9361);_0x23c053(_this['error'](0x1f4,_0x3cadc0[_0x6987('0x18')]));});});}; \ No newline at end of file +var _0x38f2=['find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateMailInteraction','update','body','raw','options','where','attributes','limit','AddTagsToMailInteraction','MailInteraction'];(function(_0x42db07,_0x1adc79){var _0x4afbcb=function(_0x45b201){while(--_0x45b201){_0x42db07['push'](_0x42db07['shift']());}};_0x4afbcb(++_0x1adc79);}(_0x38f2,0xbe));var _0x238f=function(_0xee8645,_0x5c5be1){_0xee8645=_0xee8645-0x0;var _0x168a97=_0x38f2[_0xee8645];return _0x168a97;};'use strict';var _=require(_0x238f('0x0'));var util=require(_0x238f('0x1'));var moment=require(_0x238f('0x2'));var BPromise=require('bluebird');var rs=require(_0x238f('0x3'));var fs=require('fs');var Redis=require(_0x238f('0x4'));var db=require(_0x238f('0x5'))['db'];var utils=require(_0x238f('0x6'));var logger=require(_0x238f('0x7'))(_0x238f('0x8'));var config=require(_0x238f('0x9'));var jayson=require(_0x238f('0xa'));var client=jayson['client'][_0x238f('0xb')]({'port':0x232a});config['redis']=_[_0x238f('0xc')](config[_0x238f('0xd')],{'host':_0x238f('0xe'),'port':0x18eb});var socket=require(_0x238f('0xf'))(new Redis(config[_0x238f('0xd')]));require(_0x238f('0x10'))[_0x238f('0x11')](socket);function respondWithRpcPromise(_0x2d1d50,_0x26b1b9,_0x2d4038){return new BPromise(function(_0x5e9005,_0x35adf1){return client[_0x238f('0x12')](_0x2d1d50,_0x2d4038)[_0x238f('0x13')](function(_0x30596d){logger['info'](_0x238f('0x14'),_0x26b1b9,_0x238f('0x15'));logger[_0x238f('0x16')](_0x238f('0x17'),_0x26b1b9,'request\x20sent',JSON[_0x238f('0x18')](_0x30596d));if(_0x30596d[_0x238f('0x19')]){if(_0x30596d['error'][_0x238f('0x1a')]===0x1f4){logger[_0x238f('0x19')](_0x238f('0x14'),_0x26b1b9,_0x30596d[_0x238f('0x19')][_0x238f('0x1b')]);return _0x35adf1(_0x30596d[_0x238f('0x19')]['message']);}logger[_0x238f('0x19')](_0x238f('0x14'),_0x26b1b9,_0x30596d[_0x238f('0x19')]['message']);return _0x5e9005(_0x30596d['error'][_0x238f('0x1b')]);}else{logger[_0x238f('0x1c')](_0x238f('0x14'),_0x26b1b9,_0x238f('0x15'));_0x5e9005(_0x30596d[_0x238f('0x1d')][_0x238f('0x1b')]);}})['catch'](function(_0x39bb43){logger[_0x238f('0x19')]('MailInteraction,\x20%s,\x20%s',_0x26b1b9,_0x39bb43);_0x35adf1(_0x39bb43);});});}exports[_0x238f('0x1e')]=function(_0x5b166f){var _0x1194b1=this;return new Promise(function(_0x20ef35,_0xb5f703){return db['MailInteraction'][_0x238f('0x1f')](_0x5b166f[_0x238f('0x20')],{'raw':_0x5b166f['options']?_0x5b166f['options'][_0x238f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b166f[_0x238f('0x22')]?_0x5b166f['options'][_0x238f('0x23')]||null:null,'attributes':_0x5b166f[_0x238f('0x22')]?_0x5b166f[_0x238f('0x22')][_0x238f('0x24')]||null:null,'limit':_0x5b166f[_0x238f('0x22')]?_0x5b166f[_0x238f('0x22')][_0x238f('0x25')]||null:null})[_0x238f('0x13')](function(_0x48f7dd){logger[_0x238f('0x1c')](_0x238f('0x1e'),_0x5b166f);logger[_0x238f('0x16')](_0x238f('0x1e'),_0x5b166f,JSON[_0x238f('0x18')](_0x48f7dd));_0x20ef35(_0x48f7dd);})['catch'](function(_0x5d7631){logger[_0x238f('0x19')](_0x238f('0x1e'),_0x5d7631[_0x238f('0x1b')],_0x5b166f);_0xb5f703(_0x1194b1['error'](0x1f4,_0x5d7631[_0x238f('0x1b')]));});});};exports[_0x238f('0x26')]=function(_0x47de21){return new Promise(function(_0x497284,_0x31f49e){return db[_0x238f('0x27')][_0x238f('0x28')]({'where':_0x47de21['options']?_0x47de21['options'][_0x238f('0x23')]||null:null})['then'](function(_0x397e89){if(_0x397e89){return _0x397e89[_0x238f('0x29')](_0x47de21[_0x238f('0x20')][_0x238f('0x2a')],_[_0x238f('0x2b')](_0x47de21[_0x238f('0x20')],[_0x238f('0x2a'),'id'])||{});}})[_0x238f('0x2c')](function(_0x6d3fec){logger[_0x238f('0x1c')]('AddTags',_0x47de21);logger[_0x238f('0x16')](_0x238f('0x2d'),_0x47de21,JSON['stringify'](_0x6d3fec));_0x497284(_0x6d3fec);})['catch'](function(_0x10a645){logger['error']('AddTags',_0x10a645[_0x238f('0x1b')],_0x47de21);_0x31f49e(_this[_0x238f('0x19')](0x1f4,_0x10a645['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e15608c..b9967a8 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 _0xf6b7=['emit','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0x30e9d2,_0x19f03b){var _0x5dffcb=function(_0x9cfcd0){while(--_0x9cfcd0){_0x30e9d2['push'](_0x30e9d2['shift']());}};_0x5dffcb(++_0x19f03b);}(_0xf6b7,0xbd));var _0x7f6b=function(_0x347298,_0x2146e0){_0x347298=_0x347298-0x0;var _0x33a370=_0xf6b7[_0x347298];return _0x33a370;};'use strict';var MailInteractionEvents=require(_0x7f6b('0x0'));var events=['save',_0x7f6b('0x1'),_0x7f6b('0x2')];function createListener(_0x20a9b3,_0x297bbc){return function(_0x50c43f){_0x297bbc[_0x7f6b('0x3')](_0x20a9b3,_0x50c43f);};}function removeListener(_0x4fd88a,_0x982cea){return function(){MailInteractionEvents['removeListener'](_0x4fd88a,_0x982cea);};}exports['register']=function(_0x295d42){for(var _0x516480=0x0,_0xfef7cf=events[_0x7f6b('0x4')];_0x516480<_0xfef7cf;_0x516480++){var _0x314161=events[_0x516480];var _0x1ff85c=createListener(_0x7f6b('0x5')+_0x314161,_0x295d42);MailInteractionEvents['on'](_0x314161,_0x1ff85c);}}; \ No newline at end of file +var _0x1782=['update','emit','removeListener','register','length','save','remove'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0x1782,0x186));var _0x2178=function(_0x32029e,_0x4d94e2){_0x32029e=_0x32029e-0x0;var _0x4883a1=_0x1782[_0x32029e];return _0x4883a1;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x2178('0x0'),_0x2178('0x1'),_0x2178('0x2')];function createListener(_0x24345a,_0x57984b){return function(_0x493bed){_0x57984b[_0x2178('0x3')](_0x24345a,_0x493bed);};}function removeListener(_0xaa3478,_0x545673){return function(){MailInteractionEvents[_0x2178('0x4')](_0xaa3478,_0x545673);};}exports[_0x2178('0x5')]=function(_0xc3d64c){for(var _0x17203d=0x0,_0x502ff1=events[_0x2178('0x6')];_0x17203d<_0x502ff1;_0x17203d++){var _0x5ae7fe=events[_0x17203d];var _0x28d0ef=createListener('mailInteraction:'+_0x5ae7fe,_0xc3d64c);MailInteractionEvents['on'](_0x5ae7fe,_0x28d0ef);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index f82ad2f..0a6d3ac 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x289e=['express','Router','./mailInteractionHasTag.controller','get','isAuthenticated','describe'];(function(_0x57bc1d,_0xbcd075){var _0x2941aa=function(_0x5de1f2){while(--_0x5de1f2){_0x57bc1d['push'](_0x57bc1d['shift']());}};_0x2941aa(++_0xbcd075);}(_0x289e,0xea));var _0xe289=function(_0x171c42,_0x47b642){_0x171c42=_0x171c42-0x0;var _0x370534=_0x289e[_0x171c42];return _0x370534;};'use strict';var express=require(_0xe289('0x0'));var router=express[_0xe289('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xe289('0x2'));router[_0xe289('0x3')]('/describe',auth[_0xe289('0x4')](),controller[_0xe289('0x5')]);module['exports']=router; \ No newline at end of file +var _0x3157=['describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','/describe'];(function(_0x1a48d4,_0x43028c){var _0x2e12e9=function(_0x371806){while(--_0x371806){_0x1a48d4['push'](_0x1a48d4['shift']());}};_0x2e12e9(++_0x43028c);}(_0x3157,0x198));var _0x7315=function(_0x5ee6c9,_0x1b6779){_0x5ee6c9=_0x5ee6c9-0x0;var _0x23a794=_0x3157[_0x5ee6c9];return _0x23a794;};'use strict';var express=require(_0x7315('0x0'));var router=express[_0x7315('0x1')]();var auth=require(_0x7315('0x2'));var controller=require(_0x7315('0x3'));router['get'](_0x7315('0x4'),auth['isAuthenticated'](),controller[_0x7315('0x5')]);module[_0x7315('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 7e911a6..5cb0a50 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0xa7c48a,_0x6ff95f){var _0x266cd0=function(_0x4eef0b){while(--_0x4eef0b){_0xa7c48a['push'](_0xa7c48a['shift']());}};_0x266cd0(++_0x6ff95f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4a1447,_0x5c495c){var _0x4cf95b=function(_0x25352f){while(--_0x25352f){_0x4a1447['push'](_0x4a1447['shift']());}};_0x4cf95b(++_0x5c495c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index faf25ad..c88c604 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ade=['INTEGER','exports'];(function(_0x209a47,_0x340dec){var _0x5f0370=function(_0x4a75eb){while(--_0x4a75eb){_0x209a47['push'](_0x209a47['shift']());}};_0x5f0370(++_0x340dec);}(_0x2ade,0x1ab));var _0xe2ad=function(_0xd538ec,_0x4673f0){_0xd538ec=_0xd538ec-0x0;var _0x5829f0=_0x2ade[_0xd538ec];return _0x5829f0;};'use strict';var Sequelize=require('sequelize');module[_0xe2ad('0x0')]={'MailInteractionId':{'type':Sequelize[_0xe2ad('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xe2ad('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x2581=['sequelize','exports'];(function(_0x245964,_0x45b3c0){var _0x1e42d1=function(_0x1fe57b){while(--_0x1fe57b){_0x245964['push'](_0x245964['shift']());}};_0x1e42d1(++_0x45b3c0);}(_0x2581,0x1f2));var _0x1258=function(_0x29ab78,_0x3ec9a9){_0x29ab78=_0x29ab78-0x0;var _0x179374=_0x2581[_0x29ab78];return _0x179374;};'use strict';var Sequelize=require(_0x1258('0x0'));module[_0x1258('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 0e4d9cb..5997701 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca7a=['mail_interaction_has_tags','./mailInteractionHasTag','define'];(function(_0x550089,_0x36e029){var _0x7f0b4a=function(_0x4787bd){while(--_0x4787bd){_0x550089['push'](_0x550089['shift']());}};_0x7f0b4a(++_0x36e029);}(_0xca7a,0xb8));var _0xaca7=function(_0x7d4593,_0xd66d60){_0x7d4593=_0x7d4593-0x0;var _0x440c23=_0xca7a[_0x7d4593];return _0x440c23;};'use strict';var attributes=require(_0xaca7('0x0'));module['exports']=function(_0x496921){return _0x496921[_0xaca7('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0xaca7('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9380=['./mailInteractionHasTag','exports','MailInteractionHasTag'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0x9380,0x15c));var _0x0938=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x9380[_0x2aea9e];return _0x430b92;};'use strict';var attributes=require(_0x0938('0x0'));module[_0x0938('0x1')]=function(_0x38eb0e){return _0x38eb0e['define'](_0x0938('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index aafc268..3ad00ae 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 _0x04c5=['index','/describe','describe','show','/:id/download','download','post','mail','mailmessage:create','create','/:id','update','put','/:id/accept','accept','/:id/reject','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated'];(function(_0x24b00f,_0x5cb40c){var _0x2d816d=function(_0x59f49c){while(--_0x59f49c){_0x24b00f['push'](_0x24b00f['shift']());}};_0x2d816d(++_0x5cb40c);}(_0x04c5,0x125));var _0x504c=function(_0x57f8fc,_0x14723f){_0x57f8fc=_0x57f8fc-0x0;var _0x16d09b=_0x04c5[_0x57f8fc];return _0x16d09b;};'use strict';var multer=require(_0x504c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x504c('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x504c('0x2'));var interaction=require(_0x504c('0x3'));var config=require('../../config/environment');var controller=require(_0x504c('0x4'));router[_0x504c('0x5')]('/',auth[_0x504c('0x6')](),controller[_0x504c('0x7')]);router['get'](_0x504c('0x8'),auth[_0x504c('0x6')](),controller[_0x504c('0x9')]);router['get']('/:id',auth[_0x504c('0x6')](),controller[_0x504c('0xa')]);router[_0x504c('0x5')](_0x504c('0xb'),auth[_0x504c('0x6')](),controller[_0x504c('0xc')]);router[_0x504c('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x504c('0xe'),_0x504c('0xf')),controller[_0x504c('0x10')]);router['put'](_0x504c('0x11'),auth[_0x504c('0x6')](),controller[_0x504c('0x12')]);router[_0x504c('0x13')](_0x504c('0x14'),auth['isAuthenticated'](),controller[_0x504c('0x15')]);router[_0x504c('0x13')](_0x504c('0x16'),auth[_0x504c('0x6')](),controller['reject']);router['delete'](_0x504c('0x11'),auth[_0x504c('0x6')](),controller[_0x504c('0x17')]);module[_0x504c('0x18')]=router; \ No newline at end of file +var _0x1596=['reject','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id/download','download','post','mailmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject'];(function(_0x2b29a2,_0x5c5242){var _0x53c471=function(_0x41f14a){while(--_0x41f14a){_0x2b29a2['push'](_0x2b29a2['shift']());}};_0x53c471(++_0x5c5242);}(_0x1596,0x16f));var _0x6159=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1596[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x6159('0x0'));var util=require(_0x6159('0x1'));var path=require(_0x6159('0x2'));var timeout=require(_0x6159('0x3'));var express=require('express');var router=express[_0x6159('0x4')]();var fs_extra=require(_0x6159('0x5'));var auth=require(_0x6159('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6159('0x7'));var controller=require(_0x6159('0x8'));router[_0x6159('0x9')]('/',auth['isAuthenticated'](),controller[_0x6159('0xa')]);router[_0x6159('0x9')](_0x6159('0xb'),auth[_0x6159('0xc')](),controller[_0x6159('0xd')]);router[_0x6159('0x9')]('/:id',auth[_0x6159('0xc')](),controller['show']);router[_0x6159('0x9')](_0x6159('0xe'),auth['isAuthenticated'](),controller[_0x6159('0xf')]);router[_0x6159('0x10')]('/',auth[_0x6159('0xc')](),interaction['tracked']('mail',_0x6159('0x11')),controller[_0x6159('0x12')]);router[_0x6159('0x13')](_0x6159('0x14'),auth[_0x6159('0xc')](),controller[_0x6159('0x15')]);router[_0x6159('0x13')](_0x6159('0x16'),auth[_0x6159('0xc')](),controller[_0x6159('0x17')]);router[_0x6159('0x13')](_0x6159('0x18'),auth[_0x6159('0xc')](),controller[_0x6159('0x19')]);router[_0x6159('0x1a')](_0x6159('0x14'),auth[_0x6159('0xc')](),controller[_0x6159('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index bf5673b..4f25f8f 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 _0x47c7=['Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Chat'];(function(_0x43d31b,_0x670376){var _0x5541c8=function(_0x1bca5d){while(--_0x1bca5d){_0x43d31b['push'](_0x43d31b['shift']());}};_0x5541c8(++_0x670376);}(_0x47c7,0xd3));var _0x747c=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x47c7[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0x747c('0x0'));var _=require(_0x747c('0x1'));module[_0x747c('0x2')]={'body':{'type':Sequelize[_0x747c('0x3')](_0x747c('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x747c('0x3')](_0x747c('0x5'))},'read':{'type':Sequelize[_0x747c('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x747c('0x7')),'defaultValue':_0x747c('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x747c('0x8')](0x1fe)},'from':{'type':Sequelize[_0x747c('0x8')]},'to':{'type':Sequelize[_0x747c('0x3')](_0x747c('0x4'))},'cc':{'type':Sequelize[_0x747c('0x3')](_0x747c('0x4'))},'bcc':{'type':Sequelize[_0x747c('0x3')](_0x747c('0x4'))},'subject':{'type':Sequelize[_0x747c('0x3')]},'sentAt':{'type':Sequelize[_0x747c('0x9')]},'attach':{'type':Sequelize[_0x747c('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x747c('0x9')]},'originTo':{'type':Sequelize[_0x747c('0x3')](_0x747c('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x747c('0x4'))},'originChannel':{'type':Sequelize[_0x747c('0xb')]('Email',_0x747c('0xc')),'defaultValue':_0x747c('0xd'),'allowNull':![]}}; \ No newline at end of file +var _0x3c03=['Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN','out','STRING','long','DATE','ENUM','Chat'];(function(_0x55f6d7,_0x5bd984){var _0x2153cc=function(_0x11ff8b){while(--_0x11ff8b){_0x55f6d7['push'](_0x55f6d7['shift']());}};_0x2153cc(++_0x5bd984);}(_0x3c03,0xeb));var _0x33c0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x3c03[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x33c0('0x0'));var _=require(_0x33c0('0x1'));module[_0x33c0('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x33c0('0x3')](_0x33c0('0x4'))},'read':{'type':Sequelize[_0x33c0('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x33c0('0x6')),'defaultValue':_0x33c0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x33c0('0x7')]},'to':{'type':Sequelize[_0x33c0('0x3')](_0x33c0('0x8'))},'cc':{'type':Sequelize[_0x33c0('0x3')]('long')},'bcc':{'type':Sequelize[_0x33c0('0x3')](_0x33c0('0x8'))},'subject':{'type':Sequelize[_0x33c0('0x3')]},'sentAt':{'type':Sequelize[_0x33c0('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x33c0('0x9')]},'originTo':{'type':Sequelize[_0x33c0('0x3')](_0x33c0('0x8'))},'originCc':{'type':Sequelize[_0x33c0('0x3')](_0x33c0('0x8'))},'originChannel':{'type':Sequelize[_0x33c0('0xa')]('Email',_0x33c0('0xb')),'defaultValue':_0x33c0('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 7d6c591..1e90e54 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 _0x9b10=['fieldName','type','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','keys','fields','options','find','body','destroy','params','describe','direction','out','secret','split','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','attachments','root','server/files/attachments','List','create','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','get','MailInteractionId','read1stAt','interaction','user','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','mail','MailInteraction','null','RejectMessage','rejectMessage','email','download','toString','join','server','files','tmp','createdAt','Attachment','from','bcc','headers','Bcc','Attachments','basename','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','undefined','limit','count','offset','status','set','Content-Range','json','update','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes'];(function(_0x20fc30,_0x224be4){var _0x508068=function(_0x2eceb1){while(--_0x2eceb1){_0x20fc30['push'](_0x20fc30['shift']());}};_0x508068(++_0x224be4);}(_0x9b10,0x10a));var _0x09b1=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9b10[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x09b1('0x0'));var moment=require(_0x09b1('0x1'));var BPromise=require(_0x09b1('0x2'));var util=require(_0x09b1('0x3'));var path=require(_0x09b1('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x09b1('0x5'));var htmlToText=require(_0x09b1('0x6'));var qs=require(_0x09b1('0x7'));var logger=require(_0x09b1('0x8'))(_0x09b1('0x9'));var interaction_log=require('../../config/logger')(_0x09b1('0xa'));var config=require(_0x09b1('0xb'));var db=require(_0x09b1('0xc'))['db'];config[_0x09b1('0xd')]=_[_0x09b1('0xe')](config[_0x09b1('0xd')],{'host':_0x09b1('0xf'),'port':0x18eb});var socket=require(_0x09b1('0x10'))(new Redis(config[_0x09b1('0xd')]));var htmlEntities=require(_0x09b1('0x11'));require(_0x09b1('0x12'))[_0x09b1('0x13')](socket);var jayson=require(_0x09b1('0x14'));var client=jayson[_0x09b1('0x15')][_0x09b1('0x16')]({'port':0x232c});var client9003=jayson[_0x09b1('0x15')][_0x09b1('0x16')]({'port':0x232b});var client9002=jayson[_0x09b1('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b8a72,_0x430918,_0x2cccd7,_0x19385f){return new BPromise(function(_0x14fda8,_0x5662ac){var _0x11ca5f=_0x19385f||client;return _0x11ca5f[_0x09b1('0x17')](_0x3b8a72,_0x2cccd7)[_0x09b1('0x18')](function(_0x19a998){logger['info'](_0x09b1('0x19'),_0x430918,_0x09b1('0x1a'));logger[_0x09b1('0x1b')](_0x09b1('0x1c'),_0x430918,_0x09b1('0x1a'),JSON[_0x09b1('0x1d')](_0x19a998));if(_0x19a998[_0x09b1('0x1e')]){if(_0x19a998['error'][_0x09b1('0x1f')]===0x1f4){logger['error'](_0x09b1('0x19'),_0x430918,_0x19a998[_0x09b1('0x1e')][_0x09b1('0x20')]);return _0x5662ac(_0x19a998[_0x09b1('0x1e')][_0x09b1('0x20')]);}logger[_0x09b1('0x1e')](_0x09b1('0x19'),_0x430918,_0x19a998['error'][_0x09b1('0x20')]);return _0x14fda8(_0x19a998[_0x09b1('0x1e')][_0x09b1('0x20')]);}else{logger[_0x09b1('0x21')](_0x09b1('0x19'),_0x430918,_0x09b1('0x1a'));_0x14fda8(_0x19a998['result'][_0x09b1('0x20')]);}})[_0x09b1('0x22')](function(_0x352c06){logger[_0x09b1('0x1e')]('MailMessage,\x20%s,\x20%s',_0x430918,_0x352c06);_0x5662ac(_0x352c06);});});}function respondWithResult(_0x3a767a,_0x268cee){_0x268cee=_0x268cee||0xc8;return function(_0x3250a8){if(_0x3250a8){return _0x3a767a['status'](_0x268cee)['json'](_0x3250a8);}};}function respondWithFilteredResult(_0x5b09b2,_0x22dd37){return function(_0x15dbc6){if(_0x15dbc6){var _0x5c0515=typeof _0x22dd37['offset']===_0x09b1('0x23')&&typeof _0x22dd37[_0x09b1('0x24')]===_0x09b1('0x23');var _0x1748b5=_0x15dbc6[_0x09b1('0x25')];var _0x5eb29d=_0x5c0515?0x0:_0x22dd37[_0x09b1('0x26')];var _0x34d11a=_0x5c0515?_0x15dbc6['count']:_0x22dd37[_0x09b1('0x26')]+_0x22dd37[_0x09b1('0x24')];var _0xe605bb;if(_0x34d11a>=_0x1748b5){_0x34d11a=_0x1748b5;_0xe605bb=0xc8;}else{_0xe605bb=0xce;}_0x5b09b2[_0x09b1('0x27')](_0xe605bb);return _0x5b09b2[_0x09b1('0x28')](_0x09b1('0x29'),_0x5eb29d+'-'+_0x34d11a+'/'+_0x1748b5)[_0x09b1('0x2a')](_0x15dbc6);}return null;};}function saveUpdates(_0x38f29d){return function(_0x3c8772){if(_0x3c8772){return _0x3c8772[_0x09b1('0x2b')](_0x38f29d)[_0x09b1('0x18')](function(_0x271930){return _0x271930;});}return null;};}function removeEntity(_0x1b915c){return function(_0x1f63c7){if(_0x1f63c7){return _0x1f63c7['destroy']()['then'](function(){_0x1b915c[_0x09b1('0x27')](0xcc)[_0x09b1('0x2c')]();});}};}function handleEntityNotFound(_0x1d4e43){return function(_0x30c615){if(!_0x30c615){_0x1d4e43[_0x09b1('0x2d')](0x194);}return _0x30c615;};}function handleError(_0x5bac87,_0x36816d){_0x36816d=_0x36816d||0x1f4;return function(_0x3773b1){logger['error'](_0x3773b1[_0x09b1('0x2e')]);if(_0x3773b1[_0x09b1('0x2f')]){delete _0x3773b1[_0x09b1('0x2f')];}_0x5bac87[_0x09b1('0x27')](_0x36816d)[_0x09b1('0x30')](_0x3773b1);};}exports['index']=function(_0x52338c,_0x2c1ae4){var _0x3e777c={},_0x3ec2fb={},_0x8c0430={'count':0x0,'rows':[]};var _0x4ca2d4=_[_0x09b1('0x31')](db[_0x09b1('0x32')][_0x09b1('0x33')],function(_0xcfe1a3){return{'name':_0xcfe1a3[_0x09b1('0x34')],'type':_0xcfe1a3[_0x09b1('0x35')]['key']};});_0x3ec2fb[_0x09b1('0x36')]=_['map'](_0x4ca2d4,_0x09b1('0x2f'));_0x3ec2fb[_0x09b1('0x37')]=_['keys'](_0x52338c[_0x09b1('0x37')]);_0x3ec2fb['filters']=_[_0x09b1('0x38')](_0x3ec2fb[_0x09b1('0x36')],_0x3ec2fb['query']);_0x3e777c[_0x09b1('0x39')]=_[_0x09b1('0x38')](_0x3ec2fb[_0x09b1('0x36')],qs['fields'](_0x52338c[_0x09b1('0x37')]['fields']));_0x3e777c[_0x09b1('0x39')]=_0x3e777c['attributes'][_0x09b1('0x3a')]?_0x3e777c[_0x09b1('0x39')]:_0x3ec2fb[_0x09b1('0x36')];if(!_0x52338c[_0x09b1('0x37')][_0x09b1('0x3b')](_0x09b1('0x3c'))){_0x3e777c['limit']=qs[_0x09b1('0x24')](_0x52338c[_0x09b1('0x37')][_0x09b1('0x24')]);_0x3e777c[_0x09b1('0x26')]=qs['offset'](_0x52338c[_0x09b1('0x37')]['offset']);}_0x3e777c[_0x09b1('0x3d')]=qs[_0x09b1('0x3e')](_0x52338c[_0x09b1('0x37')][_0x09b1('0x3e')]);_0x3e777c[_0x09b1('0x3f')]=qs[_0x09b1('0x40')](_['pick'](_0x52338c[_0x09b1('0x37')],_0x3ec2fb[_0x09b1('0x40')]),_0x4ca2d4);if(_0x52338c['query'][_0x09b1('0x41')]){_0x3e777c['where']=_[_0x09b1('0x42')](_0x3e777c[_0x09b1('0x3f')],{'$or':_[_0x09b1('0x31')](_0x4ca2d4,function(_0xec4d75){if(_0xec4d75[_0x09b1('0x35')]!=='VIRTUAL'){var _0x9a703d={};_0x9a703d[_0xec4d75['name']]={'$like':'%'+_0x52338c['query'][_0x09b1('0x41')]+'%'};return _0x9a703d;}})});}_0x3e777c=_[_0x09b1('0x42')]({},_0x3e777c,_0x52338c['options']);var _0x51afa8={'where':_0x3e777c[_0x09b1('0x3f')]};return db[_0x09b1('0x32')][_0x09b1('0x25')](_0x51afa8)['then'](function(_0x527c27){_0x8c0430[_0x09b1('0x25')]=_0x527c27;if(_0x52338c[_0x09b1('0x37')][_0x09b1('0x43')]){_0x3e777c[_0x09b1('0x44')]=[{'all':!![]}];}return db[_0x09b1('0x32')][_0x09b1('0x45')](_0x3e777c);})[_0x09b1('0x18')](function(_0x562e43){_0x8c0430[_0x09b1('0x46')]=_0x562e43;return _0x8c0430;})[_0x09b1('0x18')](respondWithFilteredResult(_0x2c1ae4,_0x3e777c))[_0x09b1('0x22')](handleError(_0x2c1ae4,null));};exports[_0x09b1('0x47')]=function(_0x2c4bbd,_0x48dda4){var _0x21891c={'raw':!![],'where':{'id':_0x2c4bbd['params']['id']}},_0x30d817={};_0x30d817[_0x09b1('0x36')]=_[_0x09b1('0x48')](db[_0x09b1('0x32')]['rawAttributes']);_0x30d817[_0x09b1('0x37')]=_[_0x09b1('0x48')](_0x2c4bbd[_0x09b1('0x37')]);_0x30d817['filters']=_['intersection'](_0x30d817[_0x09b1('0x36')],_0x30d817['query']);_0x21891c[_0x09b1('0x39')]=_['intersection'](_0x30d817['model'],qs[_0x09b1('0x49')](_0x2c4bbd[_0x09b1('0x37')][_0x09b1('0x49')]));_0x21891c[_0x09b1('0x39')]=_0x21891c['attributes'][_0x09b1('0x3a')]?_0x21891c[_0x09b1('0x39')]:_0x30d817[_0x09b1('0x36')];if(_0x2c4bbd['query'][_0x09b1('0x43')]){_0x21891c[_0x09b1('0x44')]=[{'all':!![]}];}_0x21891c=_[_0x09b1('0x42')]({},_0x21891c,_0x2c4bbd[_0x09b1('0x4a')]);return db['MailMessage'][_0x09b1('0x4b')](_0x21891c)['then'](handleEntityNotFound(_0x48dda4,null))[_0x09b1('0x18')](respondWithResult(_0x48dda4,null))['catch'](handleError(_0x48dda4,null));};exports[_0x09b1('0x2b')]=function(_0x2f2fb8,_0x42f5ac){if(_0x2f2fb8[_0x09b1('0x4c')]['id']){delete _0x2f2fb8[_0x09b1('0x4c')]['id'];}return db[_0x09b1('0x32')][_0x09b1('0x4b')]({'where':{'id':_0x2f2fb8['params']['id']}})['then'](handleEntityNotFound(_0x42f5ac,null))[_0x09b1('0x18')](saveUpdates(_0x2f2fb8[_0x09b1('0x4c')],null))[_0x09b1('0x18')](respondWithResult(_0x42f5ac,null))['catch'](handleError(_0x42f5ac,null));};exports[_0x09b1('0x4d')]=function(_0x5c7b69,_0x3fcde5){return db[_0x09b1('0x32')]['find']({'where':{'id':_0x5c7b69[_0x09b1('0x4e')]['id']}})[_0x09b1('0x18')](handleEntityNotFound(_0x3fcde5,null))[_0x09b1('0x18')](removeEntity(_0x3fcde5,null))[_0x09b1('0x22')](handleError(_0x3fcde5,null));};exports[_0x09b1('0x4f')]=function(_0xc45b85,_0x5cb2b8){return db[_0x09b1('0x32')][_0x09b1('0x4f')]()['then'](respondWithResult(_0x5cb2b8,null))[_0x09b1('0x22')](handleError(_0x5cb2b8,null));};exports['create']=function(_0x1cd342,_0x4f3a65){return db[_0x09b1('0x32')]['create'](_0x1cd342['body'])['then'](function(_0x9b1b19){if(_0x9b1b19){if(_0x9b1b19[_0x09b1('0x50')]===_0x09b1('0x51')&&!_0x9b1b19[_0x09b1('0x52')]){var _0x4ace7a,_0x1c8f7b,_0x1ddc30;if(_0x1cd342[_0x09b1('0x4c')]['to']){_0x1c8f7b=_0x1cd342['body']['to'][_0x09b1('0x53')](',')[0x0];}return db['MailAccount'][_0x09b1('0x54')]({'where':{'id':_0x9b1b19[_0x09b1('0x55')]},'include':[{'model':db[_0x09b1('0x56')],'as':'List','include':[{'model':db[_0x09b1('0x57')],'as':_0x09b1('0x58'),'where':{'email':_0x1c8f7b},'limit':0x1,'order':[[_0x09b1('0x59'),_0x09b1('0x5a')]]}]},{'model':db[_0x09b1('0x5b')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x09b1('0x18')](function(_0x5651b5){_0x4ace7a=_0x5651b5;if(!_0x4ace7a||!_0x4ace7a[_0x09b1('0x5c')])return;var _0x59b676=_0x4ace7a['getSmtpOptions']();if(_0x1cd342[_0x09b1('0x4c')]['attachments']&&_0x1cd342[_0x09b1('0x4c')][_0x09b1('0x5d')][_0x09b1('0x3a')]){for(var _0x2e14e3=0x0;_0x2e14e3<_0x1cd342[_0x09b1('0x4c')][_0x09b1('0x5d')]['length'];_0x2e14e3+=0x1){_0x1cd342['body']['attachments'][_0x2e14e3]={'filename':_0x1cd342[_0x09b1('0x4c')][_0x09b1('0x5d')][_0x2e14e3][_0x09b1('0x2f')],'path':path['join'](config[_0x09b1('0x5e')],_0x09b1('0x5f'),_0x1cd342[_0x09b1('0x4c')][_0x09b1('0x5d')][_0x2e14e3]['basename'])};}}_0x1ddc30={'account':_0x59b676,'message':_0x1cd342[_0x09b1('0x4c')]};return;})[_0x09b1('0x18')](function(){if(_0x4ace7a['List']){if(_0x4ace7a[_0x09b1('0x60')][_0x09b1('0x58')][_0x09b1('0x3a')]){return _0x4ace7a['List'][_0x09b1('0x58')][0x0];}else{return db[_0x09b1('0x57')][_0x09b1('0x61')](_[_0x09b1('0xe')](_0x1cd342['body'],{'firstName':_0x1cd342[_0x09b1('0x4c')]['to'],'email':_0x1cd342[_0x09b1('0x4c')]['to'],'phone':_0x1cd342[_0x09b1('0x4c')]['to'],'ListId':_0x4ace7a[_0x09b1('0x62')]}));}}else{throw new Error(_0x09b1('0x63'));}})[_0x09b1('0x18')](function(){if(_0x1ddc30){return respondWithRpcPromise(_0x09b1('0x64'),_0x09b1('0x65'),_0x1ddc30,client9003)['then'](function(_0x46ec4b){return _0x9b1b19['update']({'read':!![],'messageId':_0x46ec4b[_0x09b1('0x66')],'sentAt':moment()[_0x09b1('0x67')](_0x09b1('0x68'))});})[_0x09b1('0x22')](function(_0x47f2dc){logger[_0x09b1('0x1e')]('%s',JSON[_0x09b1('0x1d')](_0x47f2dc));return _0x9b1b19;});}return _0x9b1b19;});}return _0x9b1b19;}})[_0x09b1('0x18')](respondWithResult(_0x4f3a65,0xc9))[_0x09b1('0x22')](handleError(_0x4f3a65,null));};exports[_0x09b1('0x69')]=function(_0x1f41c4,_0x1ae09e){var _0x1183dc={'agent':{},'channel':'mail'};if(_0x1f41c4[_0x09b1('0x4c')]['id']){delete _0x1f41c4[_0x09b1('0x4c')]['id'];}_0x1f41c4['body'][_0x09b1('0x6a')]=!![];_0x1f41c4['body'][_0x09b1('0x6b')]=moment()[_0x09b1('0x67')](_0x09b1('0x68'));_0x1f41c4['body'][_0x09b1('0x6c')]=_0x1f41c4['body'][_0x09b1('0x6c')]||_0x1f41c4['user']['id'];_0x1183dc[_0x09b1('0x6d')]['id']=_0x1f41c4['body'][_0x09b1('0x6c')];return db[_0x09b1('0x32')][_0x09b1('0x4b')]({'where':{'id':_0x1f41c4['params']['id'],'UserId':null}})[_0x09b1('0x18')](handleEntityNotFound(_0x1ae09e,null))[_0x09b1('0x18')](saveUpdates(_0x1f41c4[_0x09b1('0x4c')],null))[_0x09b1('0x18')](function(_0x351ac0){if(_0x351ac0){_0x1183dc[_0x09b1('0x20')]=_0x351ac0[_0x09b1('0x6e')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x351ac0[_0x09b1('0x6f')]}});}return null;})[_0x09b1('0x18')](handleEntityNotFound(_0x1ae09e,null))[_0x09b1('0x18')](function(_0x3325cc){if(_0x3325cc){return _0x3325cc['update']({'UserId':_0x1f41c4[_0x09b1('0x4c')][_0x09b1('0x6c')],'read1stAt':_['isNil'](_0x3325cc[_0x09b1('0x70')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x438251){if(_0x438251){_0x1183dc[_0x09b1('0x71')]=_0x438251[_0x09b1('0x6e')]({'plain':!![]});interaction_log[_0x09b1('0x21')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f41c4[_0x09b1('0x72')]['id'],_0x1f41c4['user'][_0x09b1('0x2f')],_0x1f41c4[_0x09b1('0x72')][_0x09b1('0x73')],_0x1183dc[_0x09b1('0x71')]['id'],_0x1f41c4[_0x09b1('0x4c')]?JSON['stringify'](_0x1f41c4['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1183dc);}return null;})['then'](function(_0x5f0fb7){var _0x59a471=_0x09b1('0x74')+_0x5f0fb7[_0x09b1('0x20')][_0x09b1('0x75')];return db[_0x09b1('0x76')][_0x09b1('0x37')](_0x59a471,{'type':db[_0x09b1('0x77')][_0x09b1('0x78')][_0x09b1('0x79')],'raw':!![]})[_0x09b1('0x18')](function(_0x2d349f){return _0x2d349f;});})['then'](function(_0x3cb3b){if(_0x3cb3b){_0x1183dc[_0x09b1('0x20')][_0x09b1('0x7a')]=_0x3cb3b[0x0];if(!_0x1f41c4[_0x09b1('0x4c')][_0x09b1('0x6c')])return;return db[_0x09b1('0x7b')][_0x09b1('0x4b')]({'where':{'id':_0x1f41c4['body'][_0x09b1('0x6c')],'role':_0x09b1('0x6d')},'attributes':['id',_0x09b1('0x2f'),_0x09b1('0x7c'),'email',_0x09b1('0x7d')],'raw':!![]});}return null;})[_0x09b1('0x18')](function(_0x2d0d23){if(!_0x2d0d23)return null;_0x1183dc['message'][_0x09b1('0x6d')]=_0x2d0d23;return _0x1183dc;})[_0x09b1('0x18')](function(_0x1dfbf5){if(_0x1dfbf5){if(_0x1f41c4['body']['manual']){_0x1183dc[_0x09b1('0x20')][_0x09b1('0x7e')]=util[_0x09b1('0x67')](_0x09b1('0x7f'),_0x1f41c4[_0x09b1('0x72')][_0x09b1('0x2f')]);_0x1183dc[_0x09b1('0x20')][_0x09b1('0x80')]=_0x1183dc['channel'];_0x1183dc[_0x09b1('0x20')][_0x09b1('0x81')]=_0x1183dc[_0x09b1('0x80')];_0x1183dc[_0x09b1('0x20')][_0x09b1('0x82')]=_0x09b1('0x69');_0x1183dc['message']['body']=htmlToText[_0x09b1('0x83')](_0x1183dc['message'][_0x09b1('0x4c')]);return respondWithRpcPromise(_0x09b1('0x84'),_0x09b1('0x84'),{'event':_0x09b1('0x85'),'message':_0x1183dc[_0x09b1('0x20')]},client9002)[_0x09b1('0x18')](function(){return _0x1183dc;});}return _0x1183dc;}return null;})['then'](respondWithResult(_0x1ae09e,null))[_0x09b1('0x22')](handleError(_0x1ae09e,null));};exports['reject']=function(_0x2528f4,_0x454cd0){var _0x9c0174={'agent':{},'channel':_0x09b1('0x86')};if(_0x2528f4['body']['id']){delete _0x2528f4[_0x09b1('0x4c')]['id'];}_0x2528f4[_0x09b1('0x4c')][_0x09b1('0x6c')]=_0x2528f4[_0x09b1('0x4c')][_0x09b1('0x6c')]||_0x2528f4['user']['id'];_0x9c0174['agent']['id']=_0x2528f4['body'][_0x09b1('0x6c')];return db[_0x09b1('0x32')]['find']({'where':{'id':_0x2528f4[_0x09b1('0x4e')]['id'],'UserId':null}})[_0x09b1('0x18')](handleEntityNotFound(_0x454cd0,null))['then'](function(_0x3acad0){if(_0x3acad0){_0x9c0174['message']=_0x3acad0['get']({'plain':!![]});return db[_0x09b1('0x87')][_0x09b1('0x4b')]({'where':{'id':_0x3acad0[_0x09b1('0x6f')]}});}return null;})[_0x09b1('0x18')](handleEntityNotFound(_0x454cd0,null))[_0x09b1('0x18')](function(_0x5d3288){if(_0x5d3288){_0x9c0174[_0x09b1('0x71')]=_0x5d3288[_0x09b1('0x6e')]({'plain':!![]});interaction_log[_0x09b1('0x21')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2528f4[_0x09b1('0x72')]['id'],_0x2528f4[_0x09b1('0x72')][_0x09b1('0x2f')],_0x2528f4[_0x09b1('0x72')][_0x09b1('0x73')],_0x9c0174[_0x09b1('0x71')]['id'],_0x2528f4[_0x09b1('0x4c')]?JSON[_0x09b1('0x1d')](_0x2528f4[_0x09b1('0x4c')]):_0x09b1('0x88'));return respondWithRpcPromise(_0x09b1('0x89'),_0x09b1('0x8a'),_0x9c0174);}return null;})[_0x09b1('0x18')](function(_0x21487f){var _0xb27eeb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x21487f[_0x09b1('0x20')]['ContactId'];return db['sequelize']['query'](_0xb27eeb,{'type':db['Sequelize']['QueryTypes'][_0x09b1('0x79')],'raw':!![]})['then'](function(_0x3d660f){return _0x3d660f;});})[_0x09b1('0x18')](function(_0x493353){if(_0x493353){_0x9c0174[_0x09b1('0x20')][_0x09b1('0x7a')]=_0x493353[0x0];if(!_0x2528f4[_0x09b1('0x4c')][_0x09b1('0x6c')])return;return db[_0x09b1('0x7b')][_0x09b1('0x4b')]({'where':{'id':_0x2528f4[_0x09b1('0x4c')][_0x09b1('0x6c')],'role':_0x09b1('0x6d')},'attributes':['id',_0x09b1('0x2f'),_0x09b1('0x7c'),_0x09b1('0x8b'),_0x09b1('0x7d')],'raw':!![]});}return null;})[_0x09b1('0x18')](function(_0x362f1b){if(!_0x362f1b)return null;_0x9c0174[_0x09b1('0x20')][_0x09b1('0x6d')]=_0x362f1b;return _0x9c0174;})[_0x09b1('0x18')](function(_0x3d0abd){if(_0x3d0abd){_0x3d0abd['message'][_0x09b1('0x7e')]=util[_0x09b1('0x67')]('SIP/%s',_0x2528f4[_0x09b1('0x72')]['name']);_0x3d0abd[_0x09b1('0x20')][_0x09b1('0x80')]=_0x9c0174[_0x09b1('0x80')];_0x3d0abd[_0x09b1('0x20')][_0x09b1('0x81')]=_0x9c0174['channel'];_0x3d0abd['message']['event']='reject';_0x3d0abd[_0x09b1('0x20')][_0x09b1('0x4c')]=htmlToText[_0x09b1('0x83')](_0x9c0174['message'][_0x09b1('0x4c')]);respondWithRpcPromise(_0x09b1('0x84'),'EventManager',{'event':'rejectmessage','message':_0x3d0abd['message']},client9002);return _0x9c0174;}return null;})[_0x09b1('0x18')](respondWithResult(_0x454cd0,null))['catch'](handleError(_0x454cd0,null));};exports[_0x09b1('0x8c')]=function(_0x4d9cc7,_0x192115){var _0x5a8847=moment()['unix']()[_0x09b1('0x8d')]();var _0x558e84=path[_0x09b1('0x8e')](config[_0x09b1('0x5e')],_0x09b1('0x8f'),_0x09b1('0x90'),_0x09b1('0x91'));var _0x4b47c0=path[_0x09b1('0x8e')](config[_0x09b1('0x5e')],_0x09b1('0x8f'),_0x09b1('0x90'),'attachments');var _0x35cae2=util['format']('message-%s.eml',_0x5a8847);return db[_0x09b1('0x32')]['find']({'where':{'id':_0x4d9cc7[_0x09b1('0x4e')]['id']},'attributes':['id',_0x09b1('0x4c'),'from','to','cc','bcc','subject',_0x09b1('0x92')],'include':_0x4d9cc7[_0x09b1('0x37')][_0x09b1('0x5d')]?[{'model':db[_0x09b1('0x93')],'as':'Attachments'}]:undefined})[_0x09b1('0x18')](handleEntityNotFound(_0x192115,null))[_0x09b1('0x18')](function(_0x4a3406){if(_0x4a3406){var _0x2a6119=_0x4a3406;var _0x12b310={'from':_0x2a6119[_0x09b1('0x94')],'to':_0x2a6119['to'],'subject':_0x2a6119['subject'],'html':htmlEntities['decode'](_0x2a6119[_0x09b1('0x4c')]),'headers':{'Date':moment(_0x2a6119[_0x09b1('0x92')])[_0x09b1('0x67')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4a3406['cc']){_0x12b310['headers']['Cc']=_0x4a3406['cc'];}if(_0x4a3406[_0x09b1('0x95')]){_0x12b310[_0x09b1('0x96')][_0x09b1('0x97')]=_0x4a3406[_0x09b1('0x95')];}return new BPromise(function(_0x3f960c,_0x53aaad){if(_0x4a3406[_0x09b1('0x98')]){for(var _0x4afc05=0x0;_0x4afc05<_0x4a3406['Attachments'][_0x09b1('0x3a')];_0x4afc05++){var _0x4ea324=_0x4a3406['Attachments'][_0x4afc05];var _0x5e382f=path[_0x09b1('0x8e')](_0x4b47c0,_0x4ea324[_0x09b1('0x99')]);if(fs[_0x09b1('0x9a')](_0x5e382f)){_0x12b310[_0x09b1('0x5d')][_0x09b1('0x9b')]({'name':_0x4ea324[_0x09b1('0x2f')],'contentType':_0x4ea324[_0x09b1('0x35')],'data':fs['readFileSync'](_0x5e382f)});}}}emlformat[_0x09b1('0x9c')](_0x12b310,function(_0x2da168,_0x2dd41c){if(_0x2da168)return _0x53aaad(_0x2da168);fs[_0x09b1('0x9d')](path[_0x09b1('0x8e')](_0x558e84,_0x35cae2),_0x2dd41c);return _0x3f960c(_0x2dd41c);});});}})['then'](function(_0x419817){if(_0x419817){return _0x192115[_0x09b1('0x8c')](path[_0x09b1('0x8e')](_0x558e84,_0x35cae2),_0x35cae2,function(_0x2122c7){if(!_0x2122c7)fs[_0x09b1('0x9e')](path[_0x09b1('0x8e')](_0x558e84,_0x35cae2));});}})[_0x09b1('0x22')](handleError(_0x192115,null));}; \ No newline at end of file +var _0x6b19=['api','mail-interactions','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','status','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','find','body','params','describe','create','out','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','Contacts','List\x20not\x20found','SendMail','sendMail','messageId','format','accept','mail','read','UserId','user','agent','get','MailInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','internal','SIP/%s','rejectmessage','download','unix','root','files','tmp','server','message-%s.eml','from','bcc','createdAt','Attachment','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','Attachments','basename','readFileSync','build','writeFileSync','unlinkSync','eml-format','util','path','lodash','ioredis','../../config/logger'];(function(_0x18b56f,_0x2d8823){var _0x4df0e0=function(_0x9315f2){while(--_0x9315f2){_0x18b56f['push'](_0x18b56f['shift']());}};_0x4df0e0(++_0x2d8823);}(_0x6b19,0x138));var _0x96b1=function(_0x1e2e2c,_0x1703e6){_0x1e2e2c=_0x1e2e2c-0x0;var _0x50e3eb=_0x6b19[_0x1e2e2c];return _0x50e3eb;};'use strict';var emlformat=require(_0x96b1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x96b1('0x1'));var path=require(_0x96b1('0x2'));var fs=require('fs');var _=require(_0x96b1('0x3'));var Redis=require(_0x96b1('0x4'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var interaction_log=require(_0x96b1('0x5'))(_0x96b1('0x7'));var config=require('../../config/environment');var db=require(_0x96b1('0x8'))['db'];config['redis']=_[_0x96b1('0x9')](config['redis'],{'host':_0x96b1('0xa'),'port':0x18eb});var socket=require(_0x96b1('0xb'))(new Redis(config[_0x96b1('0xc')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x96b1('0xd')](socket);var jayson=require(_0x96b1('0xe'));var client=jayson[_0x96b1('0xf')]['http']({'port':0x232c});var client9003=jayson['client'][_0x96b1('0x10')]({'port':0x232b});var client9002=jayson[_0x96b1('0xf')][_0x96b1('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x24433f,_0x3cb03d,_0x38704e,_0x23b457){return new BPromise(function(_0x4cfcab,_0x5ee079){var _0x4d8811=_0x23b457||client;return _0x4d8811['request'](_0x24433f,_0x38704e)[_0x96b1('0x11')](function(_0x2fabcd){logger['info'](_0x96b1('0x12'),_0x3cb03d,'request\x20sent');logger[_0x96b1('0x13')](_0x96b1('0x14'),_0x3cb03d,_0x96b1('0x15'),JSON[_0x96b1('0x16')](_0x2fabcd));if(_0x2fabcd[_0x96b1('0x17')]){if(_0x2fabcd[_0x96b1('0x17')][_0x96b1('0x18')]===0x1f4){logger[_0x96b1('0x17')](_0x96b1('0x12'),_0x3cb03d,_0x2fabcd[_0x96b1('0x17')][_0x96b1('0x19')]);return _0x5ee079(_0x2fabcd[_0x96b1('0x17')]['message']);}logger[_0x96b1('0x17')](_0x96b1('0x12'),_0x3cb03d,_0x2fabcd[_0x96b1('0x17')]['message']);return _0x4cfcab(_0x2fabcd[_0x96b1('0x17')][_0x96b1('0x19')]);}else{logger[_0x96b1('0x1a')](_0x96b1('0x12'),_0x3cb03d,_0x96b1('0x15'));_0x4cfcab(_0x2fabcd['result'][_0x96b1('0x19')]);}})[_0x96b1('0x1b')](function(_0x530e96){logger['error'](_0x96b1('0x12'),_0x3cb03d,_0x530e96);_0x5ee079(_0x530e96);});});}function respondWithResult(_0x241e07,_0x5c4eea){_0x5c4eea=_0x5c4eea||0xc8;return function(_0x30c8c1){if(_0x30c8c1){return _0x241e07[_0x96b1('0x1c')](_0x5c4eea)['json'](_0x30c8c1);}};}function respondWithFilteredResult(_0x7fdb86,_0x26a0ac){return function(_0x27b333){if(_0x27b333){var _0x57d77f=typeof _0x26a0ac[_0x96b1('0x1d')]==='undefined'&&typeof _0x26a0ac[_0x96b1('0x1e')]===_0x96b1('0x1f');var _0x5d1f5b=_0x27b333[_0x96b1('0x20')];var _0x89ad57=_0x57d77f?0x0:_0x26a0ac[_0x96b1('0x1d')];var _0x4b4ce5=_0x57d77f?_0x27b333['count']:_0x26a0ac[_0x96b1('0x1d')]+_0x26a0ac['limit'];var _0x53f949;if(_0x4b4ce5>=_0x5d1f5b){_0x4b4ce5=_0x5d1f5b;_0x53f949=0xc8;}else{_0x53f949=0xce;}_0x7fdb86[_0x96b1('0x1c')](_0x53f949);return _0x7fdb86[_0x96b1('0x21')](_0x96b1('0x22'),_0x89ad57+'-'+_0x4b4ce5+'/'+_0x5d1f5b)['json'](_0x27b333);}return null;};}function saveUpdates(_0x555eac){return function(_0xb3ca69){if(_0xb3ca69){return _0xb3ca69[_0x96b1('0x23')](_0x555eac)[_0x96b1('0x11')](function(_0x27b578){return _0x27b578;});}return null;};}function removeEntity(_0x5c9285){return function(_0x11f253){if(_0x11f253){return _0x11f253[_0x96b1('0x24')]()[_0x96b1('0x11')](function(){_0x5c9285[_0x96b1('0x1c')](0xcc)[_0x96b1('0x25')]();});}};}function handleEntityNotFound(_0x50d77c){return function(_0x4099a3){if(!_0x4099a3){_0x50d77c[_0x96b1('0x26')](0x194);}return _0x4099a3;};}function handleError(_0x40cd29,_0x1a1b72){_0x1a1b72=_0x1a1b72||0x1f4;return function(_0x2f1268){logger[_0x96b1('0x17')](_0x2f1268[_0x96b1('0x27')]);if(_0x2f1268[_0x96b1('0x28')]){delete _0x2f1268[_0x96b1('0x28')];}_0x40cd29[_0x96b1('0x1c')](_0x1a1b72)['send'](_0x2f1268);};}exports[_0x96b1('0x29')]=function(_0x2f7170,_0x1807b9){var _0x53e981={},_0x304bc1={},_0x37cc78={'count':0x0,'rows':[]};var _0x16c541=_[_0x96b1('0x2a')](db[_0x96b1('0x2b')][_0x96b1('0x2c')],function(_0x1500cb){return{'name':_0x1500cb[_0x96b1('0x2d')],'type':_0x1500cb[_0x96b1('0x2e')][_0x96b1('0x2f')]};});_0x304bc1['model']=_[_0x96b1('0x2a')](_0x16c541,_0x96b1('0x28'));_0x304bc1['query']=_[_0x96b1('0x30')](_0x2f7170[_0x96b1('0x31')]);_0x304bc1[_0x96b1('0x32')]=_[_0x96b1('0x33')](_0x304bc1[_0x96b1('0x34')],_0x304bc1[_0x96b1('0x31')]);_0x53e981[_0x96b1('0x35')]=_[_0x96b1('0x33')](_0x304bc1[_0x96b1('0x34')],qs[_0x96b1('0x36')](_0x2f7170[_0x96b1('0x31')][_0x96b1('0x36')]));_0x53e981[_0x96b1('0x35')]=_0x53e981[_0x96b1('0x35')][_0x96b1('0x37')]?_0x53e981[_0x96b1('0x35')]:_0x304bc1[_0x96b1('0x34')];if(!_0x2f7170[_0x96b1('0x31')][_0x96b1('0x38')](_0x96b1('0x39'))){_0x53e981[_0x96b1('0x1e')]=qs[_0x96b1('0x1e')](_0x2f7170[_0x96b1('0x31')][_0x96b1('0x1e')]);_0x53e981[_0x96b1('0x1d')]=qs['offset'](_0x2f7170['query']['offset']);}_0x53e981[_0x96b1('0x3a')]=qs['sort'](_0x2f7170[_0x96b1('0x31')][_0x96b1('0x3b')]);_0x53e981[_0x96b1('0x3c')]=qs[_0x96b1('0x32')](_['pick'](_0x2f7170[_0x96b1('0x31')],_0x304bc1[_0x96b1('0x32')]),_0x16c541);if(_0x2f7170['query'][_0x96b1('0x3d')]){_0x53e981[_0x96b1('0x3c')]=_[_0x96b1('0x3e')](_0x53e981[_0x96b1('0x3c')],{'$or':_[_0x96b1('0x2a')](_0x16c541,function(_0x16d27f){if(_0x16d27f[_0x96b1('0x2e')]!=='VIRTUAL'){var _0x504912={};_0x504912[_0x16d27f[_0x96b1('0x28')]]={'$like':'%'+_0x2f7170[_0x96b1('0x31')][_0x96b1('0x3d')]+'%'};return _0x504912;}})});}_0x53e981=_['merge']({},_0x53e981,_0x2f7170[_0x96b1('0x3f')]);var _0x14bacd={'where':_0x53e981[_0x96b1('0x3c')]};return db[_0x96b1('0x2b')][_0x96b1('0x20')](_0x14bacd)[_0x96b1('0x11')](function(_0x299626){_0x37cc78['count']=_0x299626;if(_0x2f7170[_0x96b1('0x31')][_0x96b1('0x40')]){_0x53e981[_0x96b1('0x41')]=[{'all':!![]}];}return db[_0x96b1('0x2b')][_0x96b1('0x42')](_0x53e981);})['then'](function(_0x144c53){_0x37cc78[_0x96b1('0x43')]=_0x144c53;return _0x37cc78;})[_0x96b1('0x11')](respondWithFilteredResult(_0x1807b9,_0x53e981))['catch'](handleError(_0x1807b9,null));};exports[_0x96b1('0x44')]=function(_0x19dd85,_0x4f598a){var _0x2e08d8={'raw':!![],'where':{'id':_0x19dd85['params']['id']}},_0x5e14c5={};_0x5e14c5['model']=_[_0x96b1('0x30')](db[_0x96b1('0x2b')]['rawAttributes']);_0x5e14c5[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x19dd85[_0x96b1('0x31')]);_0x5e14c5[_0x96b1('0x32')]=_['intersection'](_0x5e14c5['model'],_0x5e14c5[_0x96b1('0x31')]);_0x2e08d8['attributes']=_['intersection'](_0x5e14c5[_0x96b1('0x34')],qs[_0x96b1('0x36')](_0x19dd85[_0x96b1('0x31')][_0x96b1('0x36')]));_0x2e08d8[_0x96b1('0x35')]=_0x2e08d8[_0x96b1('0x35')]['length']?_0x2e08d8['attributes']:_0x5e14c5[_0x96b1('0x34')];if(_0x19dd85['query'][_0x96b1('0x40')]){_0x2e08d8[_0x96b1('0x41')]=[{'all':!![]}];}_0x2e08d8=_[_0x96b1('0x3e')]({},_0x2e08d8,_0x19dd85[_0x96b1('0x3f')]);return db[_0x96b1('0x2b')][_0x96b1('0x45')](_0x2e08d8)[_0x96b1('0x11')](handleEntityNotFound(_0x4f598a,null))[_0x96b1('0x11')](respondWithResult(_0x4f598a,null))[_0x96b1('0x1b')](handleError(_0x4f598a,null));};exports['update']=function(_0x3d4473,_0x39d7eb){if(_0x3d4473[_0x96b1('0x46')]['id']){delete _0x3d4473[_0x96b1('0x46')]['id'];}return db[_0x96b1('0x2b')][_0x96b1('0x45')]({'where':{'id':_0x3d4473[_0x96b1('0x47')]['id']}})[_0x96b1('0x11')](handleEntityNotFound(_0x39d7eb,null))['then'](saveUpdates(_0x3d4473[_0x96b1('0x46')],null))[_0x96b1('0x11')](respondWithResult(_0x39d7eb,null))['catch'](handleError(_0x39d7eb,null));};exports[_0x96b1('0x24')]=function(_0x27e9e3,_0x237858){return db[_0x96b1('0x2b')]['find']({'where':{'id':_0x27e9e3['params']['id']}})[_0x96b1('0x11')](handleEntityNotFound(_0x237858,null))[_0x96b1('0x11')](removeEntity(_0x237858,null))['catch'](handleError(_0x237858,null));};exports['describe']=function(_0x2bfde8,_0x54f0b6){return db[_0x96b1('0x2b')][_0x96b1('0x48')]()['then'](respondWithResult(_0x54f0b6,null))[_0x96b1('0x1b')](handleError(_0x54f0b6,null));};exports[_0x96b1('0x49')]=function(_0x2d715c,_0x378c30){return db['MailMessage'][_0x96b1('0x49')](_0x2d715c[_0x96b1('0x46')])[_0x96b1('0x11')](function(_0x38049e){if(_0x38049e){if(_0x38049e['direction']===_0x96b1('0x4a')&&!_0x38049e['secret']){var _0x54aaec,_0xf2649d,_0x475c64;if(_0x2d715c[_0x96b1('0x46')]['to']){_0xf2649d=_0x2d715c[_0x96b1('0x46')]['to'][_0x96b1('0x4b')](',')[0x0];}return db[_0x96b1('0x4c')][_0x96b1('0x4d')]({'where':{'id':_0x38049e[_0x96b1('0x4e')]},'include':[{'model':db[_0x96b1('0x4f')],'as':_0x96b1('0x50'),'include':[{'model':db[_0x96b1('0x51')],'as':'Contacts','where':{'email':_0xf2649d},'limit':0x1,'order':[[_0x96b1('0x52'),_0x96b1('0x53')]]}]},{'model':db[_0x96b1('0x54')],'as':_0x96b1('0x55'),'raw':!![],'include':[{'model':db[_0x96b1('0x56')],'as':_0x96b1('0x56'),'raw':!![]}]}]})[_0x96b1('0x11')](function(_0x4ba1c6){_0x54aaec=_0x4ba1c6;if(!_0x54aaec||!_0x54aaec['Smtp'])return;var _0x5344ce=_0x54aaec[_0x96b1('0x57')]();if(_0x2d715c[_0x96b1('0x46')][_0x96b1('0x58')]&&_0x2d715c['body'][_0x96b1('0x58')][_0x96b1('0x37')]){for(var _0x44c1ec=0x0;_0x44c1ec<_0x2d715c['body'][_0x96b1('0x58')]['length'];_0x44c1ec+=0x1){_0x2d715c[_0x96b1('0x46')][_0x96b1('0x58')][_0x44c1ec]={'filename':_0x2d715c[_0x96b1('0x46')]['attachments'][_0x44c1ec][_0x96b1('0x28')],'path':path[_0x96b1('0x59')](config['root'],_0x96b1('0x5a'),_0x2d715c[_0x96b1('0x46')][_0x96b1('0x58')][_0x44c1ec]['basename'])};}}_0x475c64={'account':_0x5344ce,'message':_0x2d715c[_0x96b1('0x46')]};return;})[_0x96b1('0x11')](function(){if(_0x54aaec['List']){if(_0x54aaec[_0x96b1('0x50')][_0x96b1('0x5b')][_0x96b1('0x37')]){return _0x54aaec[_0x96b1('0x50')][_0x96b1('0x5b')][0x0];}else{return db[_0x96b1('0x51')][_0x96b1('0x49')](_[_0x96b1('0x9')](_0x2d715c[_0x96b1('0x46')],{'firstName':_0x2d715c[_0x96b1('0x46')]['to'],'email':_0x2d715c[_0x96b1('0x46')]['to'],'phone':_0x2d715c[_0x96b1('0x46')]['to'],'ListId':_0x54aaec['ListId']}));}}else{throw new Error(_0x96b1('0x5c'));}})[_0x96b1('0x11')](function(){if(_0x475c64){return respondWithRpcPromise(_0x96b1('0x5d'),_0x96b1('0x5e'),_0x475c64,client9003)[_0x96b1('0x11')](function(_0x217ead){return _0x38049e['update']({'read':!![],'messageId':_0x217ead[_0x96b1('0x5f')],'sentAt':moment()[_0x96b1('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x96b1('0x1b')](function(_0x1ebf38){logger['error']('%s',JSON[_0x96b1('0x16')](_0x1ebf38));return _0x38049e;});}return _0x38049e;});}return _0x38049e;}})[_0x96b1('0x11')](respondWithResult(_0x378c30,0xc9))[_0x96b1('0x1b')](handleError(_0x378c30,null));};exports[_0x96b1('0x61')]=function(_0x4ac0c4,_0x2c30fa){var _0xa34f45={'agent':{},'channel':_0x96b1('0x62')};if(_0x4ac0c4[_0x96b1('0x46')]['id']){delete _0x4ac0c4[_0x96b1('0x46')]['id'];}_0x4ac0c4['body'][_0x96b1('0x63')]=!![];_0x4ac0c4[_0x96b1('0x46')]['readAt']=moment()[_0x96b1('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ac0c4['body'][_0x96b1('0x64')]=_0x4ac0c4[_0x96b1('0x46')]['UserId']||_0x4ac0c4[_0x96b1('0x65')]['id'];_0xa34f45[_0x96b1('0x66')]['id']=_0x4ac0c4[_0x96b1('0x46')][_0x96b1('0x64')];return db[_0x96b1('0x2b')][_0x96b1('0x45')]({'where':{'id':_0x4ac0c4['params']['id'],'UserId':null}})[_0x96b1('0x11')](handleEntityNotFound(_0x2c30fa,null))[_0x96b1('0x11')](saveUpdates(_0x4ac0c4['body'],null))[_0x96b1('0x11')](function(_0x1b281f){if(_0x1b281f){_0xa34f45[_0x96b1('0x19')]=_0x1b281f[_0x96b1('0x67')]({'plain':!![]});return db[_0x96b1('0x68')][_0x96b1('0x45')]({'where':{'id':_0x1b281f['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2c30fa,null))[_0x96b1('0x11')](function(_0x59927f){if(_0x59927f){return _0x59927f[_0x96b1('0x23')]({'UserId':_0x4ac0c4['body'][_0x96b1('0x64')],'read1stAt':_[_0x96b1('0x69')](_0x59927f[_0x96b1('0x6a')])?moment()['format'](_0x96b1('0x6b')):undefined});}return null;})['then'](function(_0x21b6fd){if(_0x21b6fd){_0xa34f45[_0x96b1('0x6c')]=_0x21b6fd[_0x96b1('0x67')]({'plain':!![]});interaction_log[_0x96b1('0x1a')](_0x96b1('0x6d'),_0x4ac0c4['user']['id'],_0x4ac0c4[_0x96b1('0x65')]['name'],_0x4ac0c4['user'][_0x96b1('0x6e')],_0xa34f45[_0x96b1('0x6c')]['id'],_0x4ac0c4['body']?JSON[_0x96b1('0x16')](_0x4ac0c4[_0x96b1('0x46')]):_0x96b1('0x6f'));return respondWithRpcPromise(_0x96b1('0x70'),_0x96b1('0x71'),_0xa34f45);}return null;})[_0x96b1('0x11')](function(_0x5ea12b){var _0x32e6ba=_0x96b1('0x72')+_0x5ea12b[_0x96b1('0x19')][_0x96b1('0x73')];return db[_0x96b1('0x74')][_0x96b1('0x31')](_0x32e6ba,{'type':db[_0x96b1('0x75')][_0x96b1('0x76')][_0x96b1('0x77')],'raw':!![]})['then'](function(_0x22ad0f){return _0x22ad0f;});})[_0x96b1('0x11')](function(_0x5919b4){if(_0x5919b4){_0xa34f45['message'][_0x96b1('0x78')]=_0x5919b4[0x0];if(!_0x4ac0c4[_0x96b1('0x46')]['UserId'])return;return db[_0x96b1('0x79')][_0x96b1('0x45')]({'where':{'id':_0x4ac0c4[_0x96b1('0x46')]['UserId'],'role':_0x96b1('0x66')},'attributes':['id',_0x96b1('0x28'),'fullname',_0x96b1('0x7a'),'internal'],'raw':!![]});}return null;})[_0x96b1('0x11')](function(_0x333a82){if(!_0x333a82)return null;_0xa34f45['message'][_0x96b1('0x66')]=_0x333a82;return _0xa34f45;})[_0x96b1('0x11')](function(_0x2742ac){if(_0x2742ac){if(_0x4ac0c4[_0x96b1('0x46')][_0x96b1('0x7b')]){_0xa34f45[_0x96b1('0x19')][_0x96b1('0x7c')]=util[_0x96b1('0x60')]('SIP/%s',_0x4ac0c4[_0x96b1('0x65')]['name']);_0xa34f45[_0x96b1('0x19')][_0x96b1('0x7d')]=_0xa34f45[_0x96b1('0x7d')];_0xa34f45[_0x96b1('0x19')][_0x96b1('0x7e')]=_0xa34f45['channel'];_0xa34f45[_0x96b1('0x19')][_0x96b1('0x7f')]=_0x96b1('0x61');_0xa34f45[_0x96b1('0x19')][_0x96b1('0x46')]=htmlToText[_0x96b1('0x80')](_0xa34f45[_0x96b1('0x19')]['body']);return respondWithRpcPromise('EventManager',_0x96b1('0x81'),{'event':_0x96b1('0x82'),'message':_0xa34f45[_0x96b1('0x19')]},client9002)[_0x96b1('0x11')](function(){return _0xa34f45;});}return _0xa34f45;}return null;})['then'](respondWithResult(_0x2c30fa,null))['catch'](handleError(_0x2c30fa,null));};exports[_0x96b1('0x83')]=function(_0x2fbdd1,_0x8da894){var _0x364cf2={'agent':{},'channel':'mail'};if(_0x2fbdd1[_0x96b1('0x46')]['id']){delete _0x2fbdd1[_0x96b1('0x46')]['id'];}_0x2fbdd1[_0x96b1('0x46')][_0x96b1('0x64')]=_0x2fbdd1['body'][_0x96b1('0x64')]||_0x2fbdd1[_0x96b1('0x65')]['id'];_0x364cf2['agent']['id']=_0x2fbdd1[_0x96b1('0x46')]['UserId'];return db[_0x96b1('0x2b')]['find']({'where':{'id':_0x2fbdd1[_0x96b1('0x47')]['id'],'UserId':null}})[_0x96b1('0x11')](handleEntityNotFound(_0x8da894,null))[_0x96b1('0x11')](function(_0x3cdcc0){if(_0x3cdcc0){_0x364cf2[_0x96b1('0x19')]=_0x3cdcc0[_0x96b1('0x67')]({'plain':!![]});return db[_0x96b1('0x68')][_0x96b1('0x45')]({'where':{'id':_0x3cdcc0[_0x96b1('0x84')]}});}return null;})['then'](handleEntityNotFound(_0x8da894,null))[_0x96b1('0x11')](function(_0x346416){if(_0x346416){_0x364cf2[_0x96b1('0x6c')]=_0x346416[_0x96b1('0x67')]({'plain':!![]});interaction_log['info'](_0x96b1('0x85'),_0x2fbdd1[_0x96b1('0x65')]['id'],_0x2fbdd1['user'][_0x96b1('0x28')],_0x2fbdd1[_0x96b1('0x65')][_0x96b1('0x6e')],_0x364cf2[_0x96b1('0x6c')]['id'],_0x2fbdd1[_0x96b1('0x46')]?JSON[_0x96b1('0x16')](_0x2fbdd1[_0x96b1('0x46')]):_0x96b1('0x6f'));return respondWithRpcPromise(_0x96b1('0x86'),'rejectMessage',_0x364cf2);}return null;})[_0x96b1('0x11')](function(_0x423d5f){var _0x4f9ed2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x423d5f['message'][_0x96b1('0x73')];return db[_0x96b1('0x74')][_0x96b1('0x31')](_0x4f9ed2,{'type':db['Sequelize'][_0x96b1('0x76')][_0x96b1('0x77')],'raw':!![]})[_0x96b1('0x11')](function(_0x56384f){return _0x56384f;});})[_0x96b1('0x11')](function(_0x4e8b6e){if(_0x4e8b6e){_0x364cf2['message'][_0x96b1('0x78')]=_0x4e8b6e[0x0];if(!_0x2fbdd1[_0x96b1('0x46')][_0x96b1('0x64')])return;return db[_0x96b1('0x79')][_0x96b1('0x45')]({'where':{'id':_0x2fbdd1[_0x96b1('0x46')][_0x96b1('0x64')],'role':_0x96b1('0x66')},'attributes':['id',_0x96b1('0x28'),'fullname','email',_0x96b1('0x87')],'raw':!![]});}return null;})[_0x96b1('0x11')](function(_0xa91ba5){if(!_0xa91ba5)return null;_0x364cf2[_0x96b1('0x19')][_0x96b1('0x66')]=_0xa91ba5;return _0x364cf2;})['then'](function(_0x356bc9){if(_0x356bc9){_0x356bc9[_0x96b1('0x19')][_0x96b1('0x7c')]=util[_0x96b1('0x60')](_0x96b1('0x88'),_0x2fbdd1[_0x96b1('0x65')][_0x96b1('0x28')]);_0x356bc9[_0x96b1('0x19')][_0x96b1('0x7d')]=_0x364cf2['channel'];_0x356bc9['message'][_0x96b1('0x7e')]=_0x364cf2[_0x96b1('0x7d')];_0x356bc9[_0x96b1('0x19')]['event']=_0x96b1('0x83');_0x356bc9[_0x96b1('0x19')][_0x96b1('0x46')]=htmlToText[_0x96b1('0x80')](_0x364cf2['message']['body']);respondWithRpcPromise(_0x96b1('0x81'),'EventManager',{'event':_0x96b1('0x89'),'message':_0x356bc9[_0x96b1('0x19')]},client9002);return _0x364cf2;}return null;})[_0x96b1('0x11')](respondWithResult(_0x8da894,null))[_0x96b1('0x1b')](handleError(_0x8da894,null));};exports[_0x96b1('0x8a')]=function(_0x450c42,_0x1d8848){var _0x19f089=moment()[_0x96b1('0x8b')]()['toString']();var _0x9a066d=path[_0x96b1('0x59')](config[_0x96b1('0x8c')],'server',_0x96b1('0x8d'),_0x96b1('0x8e'));var _0xa798c5=path[_0x96b1('0x59')](config[_0x96b1('0x8c')],_0x96b1('0x8f'),_0x96b1('0x8d'),_0x96b1('0x58'));var _0x3d591d=util[_0x96b1('0x60')](_0x96b1('0x90'),_0x19f089);return db[_0x96b1('0x2b')][_0x96b1('0x45')]({'where':{'id':_0x450c42[_0x96b1('0x47')]['id']},'attributes':['id','body',_0x96b1('0x91'),'to','cc',_0x96b1('0x92'),'subject',_0x96b1('0x93')],'include':_0x450c42[_0x96b1('0x31')][_0x96b1('0x58')]?[{'model':db[_0x96b1('0x94')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x1d8848,null))[_0x96b1('0x11')](function(_0xca7e5){if(_0xca7e5){var _0x1da17c=_0xca7e5;var _0x4fb536={'from':_0x1da17c['from'],'to':_0x1da17c['to'],'subject':_0x1da17c[_0x96b1('0x95')],'html':htmlEntities[_0x96b1('0x96')](_0x1da17c['body']),'headers':{'Date':moment(_0x1da17c['createdAt'])[_0x96b1('0x60')](_0x96b1('0x97'))},'attachments':[]};if(_0xca7e5['cc']){_0x4fb536['headers']['Cc']=_0xca7e5['cc'];}if(_0xca7e5[_0x96b1('0x92')]){_0x4fb536['headers'][_0x96b1('0x98')]=_0xca7e5[_0x96b1('0x92')];}return new BPromise(function(_0x14e9ba,_0x3fc2e1){if(_0xca7e5['Attachments']){for(var _0x523fb3=0x0;_0x523fb3<_0xca7e5['Attachments'][_0x96b1('0x37')];_0x523fb3++){var _0x140d1c=_0xca7e5[_0x96b1('0x99')][_0x523fb3];var _0x506f9a=path[_0x96b1('0x59')](_0xa798c5,_0x140d1c[_0x96b1('0x9a')]);if(fs['existsSync'](_0x506f9a)){_0x4fb536[_0x96b1('0x58')]['push']({'name':_0x140d1c[_0x96b1('0x28')],'contentType':_0x140d1c[_0x96b1('0x2e')],'data':fs[_0x96b1('0x9b')](_0x506f9a)});}}}emlformat[_0x96b1('0x9c')](_0x4fb536,function(_0x42bd5e,_0x52ca6a){if(_0x42bd5e)return _0x3fc2e1(_0x42bd5e);fs[_0x96b1('0x9d')](path[_0x96b1('0x59')](_0x9a066d,_0x3d591d),_0x52ca6a);return _0x14e9ba(_0x52ca6a);});});}})[_0x96b1('0x11')](function(_0x47e23e){if(_0x47e23e){return _0x1d8848['download'](path[_0x96b1('0x59')](_0x9a066d,_0x3d591d),_0x3d591d,function(_0x547a45){if(!_0x547a45)fs[_0x96b1('0x9e')](path[_0x96b1('0x59')](_0x9a066d,_0x3d591d));});}})[_0x96b1('0x1b')](handleError(_0x1d8848,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 12db243..4f179d8 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 _0xa20a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xa20a,0x1b1));var _0xaa20=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xa20a[_0x35da42];return _0x370035;};'use strict';var EventEmitter=require(_0xaa20('0x0'));var MailMessage=require(_0xaa20('0x1'))['db'][_0xaa20('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xaa20('0x3')](0x0);var events={'afterCreate':_0xaa20('0x4'),'afterUpdate':_0xaa20('0x5'),'afterDestroy':_0xaa20('0x6')};function emitEvent(_0x91ad1f){return function(_0x1c3fd2,_0x5e1a18,_0x7a426d){MailMessageEvents[_0xaa20('0x7')](_0x91ad1f+':'+_0x1c3fd2['id'],_0x1c3fd2);MailMessageEvents[_0xaa20('0x7')](_0x91ad1f,_0x1c3fd2);_0x7a426d(null);};}for(var e in events){if(events[_0xaa20('0x8')](e)){var event=events[e];MailMessage[_0xaa20('0x9')](e,emitEvent(event));}}module[_0xaa20('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x464a=['emit','exports','events','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x46adc1,_0x161eb6){var _0x257c98=function(_0x1bf2f3){while(--_0x1bf2f3){_0x46adc1['push'](_0x46adc1['shift']());}};_0x257c98(++_0x161eb6);}(_0x464a,0x18a));var _0xa464=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x464a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xa464('0x0'));var MailMessage=require(_0xa464('0x1'))['db'][_0xa464('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa464('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa464('0x4'),'afterDestroy':'remove'};function emitEvent(_0x550831){return function(_0x59742e,_0x165f8b,_0x7f6d9f){MailMessageEvents[_0xa464('0x5')](_0x550831+':'+_0x59742e['id'],_0x59742e);MailMessageEvents[_0xa464('0x5')](_0x550831,_0x59742e);_0x7f6d9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xa464('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 62b5542..b02674c 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 _0x123c=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','html-to-text','rimraf','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','direction','toLowerCase','secret','isNil','UserId','findOne','MailInteractionId','then','createdAt','catch','error'];(function(_0x5a28e5,_0x366872){var _0x5882f2=function(_0x41a40a){while(--_0x41a40a){_0x5a28e5['push'](_0x5a28e5['shift']());}};_0x5882f2(++_0x366872);}(_0x123c,0x98));var _0xc123=function(_0x5c4971,_0x343065){_0x5c4971=_0x5c4971-0x0;var _0x3e1a86=_0x123c[_0x5c4971];return _0x3e1a86;};'use strict';var _=require('lodash');var util=require(_0xc123('0x0'));var logger=require(_0xc123('0x1'))(_0xc123('0x2'));var moment=require(_0xc123('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0xc123('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc123('0x5'));var config=require('../../config/environment');var attributes=require(_0xc123('0x6'));module[_0xc123('0x7')]=function(_0x5ee164,_0x59b65a){return _0x5ee164['define'](_0xc123('0x8'),attributes,{'tableName':_0xc123('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xc123('0xa')]},{'name':_0xc123('0xb'),'fields':[_0xc123('0xc'),'subject'],'type':_0xc123('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35ad9c,_0x3bb906,_0x41dcf4){if(_0x35ad9c[_0xc123('0xe')]){_0x35ad9c[_0xc123('0xc')]=htmlToText[_0xc123('0xf')](_0x35ad9c[_0xc123('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x41dcf4(null,_0x3bb906);},'afterCreate':function(_0x426039,_0x226d35,_0x560dea){var _0x47a5c0=_0x5ee164[_0xc123('0x10')];var _0x5561cc=_0x426039['get']({'plain':!![]});if(_0x5561cc[_0xc123('0x11')]['toLowerCase']()==='in'||_0x5561cc[_0xc123('0x11')][_0xc123('0x12')]()==='out'&&!_0x5561cc[_0xc123('0x13')]&&!_[_0xc123('0x14')](_0x5561cc[_0xc123('0x15')])){_0x47a5c0['MailInteraction'][_0xc123('0x16')]({'where':{'id':_0x5561cc[_0xc123('0x17')]}})[_0xc123('0x18')](function(_0x4cbc86){if(_0x4cbc86){_0x4cbc86['update']({'lastMsgAt':_0x5561cc[_0xc123('0x19')],'lastMsgDirection':_0x5561cc[_0xc123('0x11')][_0xc123('0x12')]()});}})[_0xc123('0x1a')](function(_0x2fafdc){console[_0xc123('0x1b')](_0x2fafdc);});}_0x560dea();}},'charset':_0xc123('0x1c'),'collate':_0xc123('0x1d')});}; \ No newline at end of file +var _0x4780=['api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','secret','isNil','UserId','MailInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4780,0x82));var _0x0478=function(_0x203cae,_0x41caa3){_0x203cae=_0x203cae-0x0;var _0x11349d=_0x4780[_0x203cae];return _0x11349d;};'use strict';var _=require(_0x0478('0x0'));var util=require('util');var logger=require(_0x0478('0x1'))(_0x0478('0x2'));var moment=require(_0x0478('0x3'));var BPromise=require(_0x0478('0x4'));var rp=require(_0x0478('0x5'));var htmlToText=require(_0x0478('0x6'));var fs=require('fs');var path=require(_0x0478('0x7'));var rimraf=require('rimraf');var config=require(_0x0478('0x8'));var attributes=require(_0x0478('0x9'));module[_0x0478('0xa')]=function(_0xe0f817,_0x205706){return _0xe0f817[_0x0478('0xb')](_0x0478('0xc'),attributes,{'tableName':_0x0478('0xd'),'paranoid':![],'indexes':[{'name':_0x0478('0xe'),'fields':[_0x0478('0xe')]},{'name':'fti_mail_messages','fields':[_0x0478('0xf'),'subject'],'type':_0x0478('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3893e4,_0x2ef04d,_0x28ec01){if(_0x3893e4[_0x0478('0x11')]){_0x3893e4[_0x0478('0xf')]=htmlToText[_0x0478('0x12')](_0x3893e4['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x28ec01(null,_0x2ef04d);},'afterCreate':function(_0x1e3201,_0x3324fd,_0x3e8e44){var _0xd0893f=_0xe0f817[_0x0478('0x13')];var _0x5367d3=_0x1e3201[_0x0478('0x14')]({'plain':!![]});if(_0x5367d3['direction'][_0x0478('0x15')]()==='in'||_0x5367d3[_0x0478('0x16')][_0x0478('0x15')]()===_0x0478('0x17')&&!_0x5367d3[_0x0478('0x18')]&&!_[_0x0478('0x19')](_0x5367d3[_0x0478('0x1a')])){_0xd0893f['MailInteraction']['findOne']({'where':{'id':_0x5367d3[_0x0478('0x1b')]}})[_0x0478('0x1c')](function(_0x3f28f1){if(_0x3f28f1){_0x3f28f1[_0x0478('0x1d')]({'lastMsgAt':_0x5367d3[_0x0478('0x1e')],'lastMsgDirection':_0x5367d3[_0x0478('0x16')]['toLowerCase']()});}})[_0x0478('0x1f')](function(_0x565cd1){console['error'](_0x565cd1);});}_0x3e8e44();}},'charset':'utf8mb4','collate':_0x0478('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index bb4bb9d..29f113f 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 _0x6a95=['MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','create','body','options','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','MailMessage,\x20%s,\x20%s','debug'];(function(_0x2c5598,_0x344777){var _0x208d09=function(_0x227df3){while(--_0x227df3){_0x2c5598['push'](_0x2c5598['shift']());}};_0x208d09(++_0x344777);}(_0x6a95,0x1db));var _0x56a9=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6a95[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});config[_0x56a9('0xc')]=_[_0x56a9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56a9('0xe'))(new Redis(config[_0x56a9('0xc')]));require('./mailMessage.socket')[_0x56a9('0xf')](socket);function respondWithRpcPromise(_0x1eddfd,_0x2d590d,_0xcf7c){return new BPromise(function(_0x3c1506,_0x319ff3){return client[_0x56a9('0x10')](_0x1eddfd,_0xcf7c)[_0x56a9('0x11')](function(_0x9ab10c){logger['info'](_0x56a9('0x12'),_0x2d590d,'request\x20sent');logger[_0x56a9('0x13')](_0x56a9('0x14'),_0x2d590d,_0x56a9('0x15'),JSON[_0x56a9('0x16')](_0x9ab10c));if(_0x9ab10c[_0x56a9('0x17')]){if(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x18')]===0x1f4){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error']['message']);return _0x319ff3(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x19')]);}logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error'][_0x56a9('0x19')]);return _0x3c1506(_0x9ab10c['error']['message']);}else{logger['info'](_0x56a9('0x12'),_0x2d590d,_0x56a9('0x15'));_0x3c1506(_0x9ab10c[_0x56a9('0x1a')][_0x56a9('0x19')]);}})[_0x56a9('0x1b')](function(_0x429e24){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x429e24);_0x319ff3(_0x429e24);});});}exports[_0x56a9('0x1c')]=function(_0x335cc3){var _0x2ff2ca=this;return new Promise(function(_0x62f79f,_0x5f145f){return db['MailMessage'][_0x56a9('0x1d')](_0x335cc3[_0x56a9('0x1e')],{'raw':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x56a9('0x11')](function(_0x3355c4){logger[_0x56a9('0x20')](_0x56a9('0x1c'),_0x335cc3);logger['debug'](_0x56a9('0x1c'),_0x335cc3,JSON[_0x56a9('0x16')](_0x3355c4));_0x62f79f(_0x3355c4);})[_0x56a9('0x1b')](function(_0xd029f7){logger[_0x56a9('0x17')]('CreateMailMessage',_0xd029f7[_0x56a9('0x19')],_0x335cc3);_0x5f145f(_0x2ff2ca[_0x56a9('0x17')](0x1f4,_0xd029f7[_0x56a9('0x19')]));});});}; \ No newline at end of file +var _0x2272=['MailMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateMailMessage'];(function(_0x236b5b,_0x1c5872){var _0x1e1808=function(_0x4a4337){while(--_0x4a4337){_0x236b5b['push'](_0x236b5b['shift']());}};_0x1e1808(++_0x1c5872);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});config[_0x2227('0xb')]=_[_0x2227('0xc')](config[_0x2227('0xb')],{'host':_0x2227('0xd'),'port':0x18eb});var socket=require(_0x2227('0xe'))(new Redis(config[_0x2227('0xb')]));require(_0x2227('0xf'))['register'](socket);function respondWithRpcPromise(_0x799370,_0x5c1cba,_0x2f66ca){return new BPromise(function(_0x2d1c39,_0x164735){return client[_0x2227('0x10')](_0x799370,_0x2f66ca)[_0x2227('0x11')](function(_0x51ed54){logger[_0x2227('0x12')](_0x2227('0x13'),_0x5c1cba,_0x2227('0x14'));logger[_0x2227('0x15')](_0x2227('0x16'),_0x5c1cba,_0x2227('0x14'),JSON['stringify'](_0x51ed54));if(_0x51ed54['error']){if(_0x51ed54['error'][_0x2227('0x17')]===0x1f4){logger['error'](_0x2227('0x13'),_0x5c1cba,_0x51ed54[_0x2227('0x18')]['message']);return _0x164735(_0x51ed54[_0x2227('0x18')][_0x2227('0x19')]);}logger[_0x2227('0x18')](_0x2227('0x13'),_0x5c1cba,_0x51ed54[_0x2227('0x18')][_0x2227('0x19')]);return _0x2d1c39(_0x51ed54['error'][_0x2227('0x19')]);}else{logger[_0x2227('0x12')](_0x2227('0x13'),_0x5c1cba,'request\x20sent');_0x2d1c39(_0x51ed54[_0x2227('0x1a')][_0x2227('0x19')]);}})[_0x2227('0x1b')](function(_0x2482ba){logger[_0x2227('0x18')](_0x2227('0x13'),_0x5c1cba,_0x2482ba);_0x164735(_0x2482ba);});});}exports[_0x2227('0x1c')]=function(_0x4e0bba){var _0x386e6a=this;return new Promise(function(_0x59f988,_0x2b26b7){return db[_0x2227('0x1d')][_0x2227('0x1e')](_0x4e0bba[_0x2227('0x1f')],{'raw':_0x4e0bba[_0x2227('0x20')]?_0x4e0bba[_0x2227('0x20')][_0x2227('0x21')]===undefined?!![]:![]:!![]})[_0x2227('0x11')](function(_0x3299fd){logger[_0x2227('0x12')](_0x2227('0x1c'),_0x4e0bba);logger['debug'](_0x2227('0x1c'),_0x4e0bba,JSON[_0x2227('0x22')](_0x3299fd));_0x59f988(_0x3299fd);})['catch'](function(_0x2cef4b){logger[_0x2227('0x18')]('CreateMailMessage',_0x2cef4b['message'],_0x4e0bba);_0x2b26b7(_0x386e6a[_0x2227('0x18')](0x1f4,_0x2cef4b[_0x2227('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7330650..8b352ab 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 _0x520e=['update','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x4be7b9,_0x5b3700){var _0x1822d5=function(_0x422d17){while(--_0x422d17){_0x4be7b9['push'](_0x4be7b9['shift']());}};_0x1822d5(++_0x5b3700);}(_0x520e,0x90));var _0xe520=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x520e[_0x2b0a86];return _0x955940;};'use strict';var MailMessageEvents=require(_0xe520('0x0'));var events=[_0xe520('0x1'),_0xe520('0x2'),_0xe520('0x3')];function createListener(_0xb175cb,_0x15df7b){return function(_0x3a1a15){_0x15df7b['emit'](_0xb175cb,_0x3a1a15);};}function removeListener(_0x2724f4,_0x120b9f){return function(){MailMessageEvents['removeListener'](_0x2724f4,_0x120b9f);};}exports[_0xe520('0x4')]=function(_0x3b7dbc){for(var _0x22f368=0x0,_0x1da5df=events[_0xe520('0x5')];_0x22f368<_0x1da5df;_0x22f368++){var _0x2e8eb6=events[_0x22f368];var _0x552eeb=createListener(_0xe520('0x6')+_0x2e8eb6,_0x3b7dbc);MailMessageEvents['on'](_0x2e8eb6,_0x552eeb);}}; \ No newline at end of file +var _0x7024=['register','./mailMessage.events','save','remove','emit','removeListener'];(function(_0x21cac2,_0x428d86){var _0x2a6437=function(_0x48cc7a){while(--_0x48cc7a){_0x21cac2['push'](_0x21cac2['shift']());}};_0x2a6437(++_0x428d86);}(_0x7024,0x139));var _0x4702=function(_0xc02910,_0x137d7e){_0xc02910=_0xc02910-0x0;var _0x1ad521=_0x7024[_0xc02910];return _0x1ad521;};'use strict';var MailMessageEvents=require(_0x4702('0x0'));var events=[_0x4702('0x1'),_0x4702('0x2'),'update'];function createListener(_0x5029a9,_0x3f5e9a){return function(_0x431eae){_0x3f5e9a[_0x4702('0x3')](_0x5029a9,_0x431eae);};}function removeListener(_0x20f535,_0x26c88a){return function(){MailMessageEvents[_0x4702('0x4')](_0x20f535,_0x26c88a);};}exports[_0x4702('0x5')]=function(_0xd9377c){for(var _0x56b83b=0x0,_0x44e9c7=events['length'];_0x56b83b<_0x44e9c7;_0x56b83b++){var _0x34fca6=events[_0x56b83b];var _0x3858c2=createListener('mailMessage:'+_0x34fca6,_0xd9377c);MailMessageEvents['on'](_0x34fca6,_0x3858c2);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 53a4ddf..3bac50d 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 _0xfe19=['Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','/describe','describe','get','/:id','show','/:id/members','isAuthenticated','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0xc0e030,_0x1f4406){var _0x43b84a=function(_0x25300e){while(--_0x25300e){_0xc0e030['push'](_0xc0e030['shift']());}};_0x43b84a(++_0x1f4406);}(_0xfe19,0xf7));var _0x9fe1=function(_0x32cc7d,_0x3d621b){_0x32cc7d=_0x32cc7d-0x0;var _0x35c303=_0xfe19[_0x32cc7d];return _0x35c303;};'use strict';var multer=require(_0x9fe1('0x0'));var util=require(_0x9fe1('0x1'));var path=require(_0x9fe1('0x2'));var timeout=require(_0x9fe1('0x3'));var express=require(_0x9fe1('0x4'));var router=express[_0x9fe1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9fe1('0x6'));var interaction=require(_0x9fe1('0x7'));var config=require('../../config/environment');var controller=require(_0x9fe1('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9fe1('0x9'),auth['isAuthenticated'](),controller[_0x9fe1('0xa')]);router[_0x9fe1('0xb')](_0x9fe1('0xc'),auth['isAuthenticated'](),controller[_0x9fe1('0xd')]);router[_0x9fe1('0xb')](_0x9fe1('0xe'),auth[_0x9fe1('0xf')](),controller['getMembers']);router[_0x9fe1('0xb')](_0x9fe1('0x10'),auth[_0x9fe1('0xf')](),controller[_0x9fe1('0x11')]);router[_0x9fe1('0xb')](_0x9fe1('0x12'),auth[_0x9fe1('0xf')](),controller[_0x9fe1('0x13')]);router['post']('/',auth[_0x9fe1('0xf')](),controller[_0x9fe1('0x14')]);router[_0x9fe1('0x15')](_0x9fe1('0x10'),auth[_0x9fe1('0xf')](),controller['addTeams']);router[_0x9fe1('0x15')](_0x9fe1('0x12'),auth[_0x9fe1('0xf')](),controller[_0x9fe1('0x16')]);router['put']('/:id',auth[_0x9fe1('0xf')](),controller['update']);router[_0x9fe1('0x17')]('/:id',auth[_0x9fe1('0xf')](),controller[_0x9fe1('0x18')]);router['delete']('/:id/teams',auth[_0x9fe1('0xf')](),controller[_0x9fe1('0x19')]);router[_0x9fe1('0x17')](_0x9fe1('0x12'),auth[_0x9fe1('0xf')](),controller[_0x9fe1('0x1a')]);module[_0x9fe1('0x1b')]=router; \ No newline at end of file +var _0x825a=['/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create'];(function(_0x36c733,_0x53c07c){var _0x5f07f3=function(_0x2d8ae1){while(--_0x2d8ae1){_0x36c733['push'](_0x36c733['shift']());}};_0x5f07f3(++_0x53c07c);}(_0x825a,0x85));var _0xa825=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x825a[_0x1daaa9];return _0x1dd221;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa825('0x0'));var timeout=require(_0xa825('0x1'));var express=require('express');var router=express[_0xa825('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa825('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xa825('0x4')]('/',auth[_0xa825('0x5')](),controller[_0xa825('0x6')]);router[_0xa825('0x4')](_0xa825('0x7'),auth[_0xa825('0x5')](),controller[_0xa825('0x8')]);router[_0xa825('0x4')](_0xa825('0x9'),auth[_0xa825('0x5')](),controller['show']);router[_0xa825('0x4')](_0xa825('0xa'),auth[_0xa825('0x5')](),controller[_0xa825('0xb')]);router[_0xa825('0x4')](_0xa825('0xc'),auth[_0xa825('0x5')](),controller[_0xa825('0xd')]);router[_0xa825('0x4')]('/:id/users',auth[_0xa825('0x5')](),controller[_0xa825('0xe')]);router[_0xa825('0xf')]('/',auth[_0xa825('0x5')](),controller[_0xa825('0x10')]);router[_0xa825('0xf')](_0xa825('0xc'),auth[_0xa825('0x5')](),controller['addTeams']);router[_0xa825('0xf')](_0xa825('0x11'),auth[_0xa825('0x5')](),controller[_0xa825('0x12')]);router[_0xa825('0x13')](_0xa825('0x9'),auth[_0xa825('0x5')](),controller[_0xa825('0x14')]);router[_0xa825('0x15')](_0xa825('0x9'),auth[_0xa825('0x5')](),controller[_0xa825('0x16')]);router['delete'](_0xa825('0xc'),auth[_0xa825('0x5')](),controller[_0xa825('0x17')]);router[_0xa825('0x15')]('/:id/users',auth[_0xa825('0x5')](),controller[_0xa825('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e55931f..b1b0750 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 _0x1b4b=['roundrobin','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x5d192e,_0x38a5d0){var _0xa70326=function(_0x54a95b){while(--_0x54a95b){_0x5d192e['push'](_0x5d192e['shift']());}};_0xa70326(++_0x38a5d0);}(_0x1b4b,0xdf));var _0xb1b4=function(_0x1f29c0,_0x4d47a9){_0x1f29c0=_0x1f29c0-0x0;var _0x3b2384=_0x1b4b[_0x1f29c0];return _0x3b2384;};'use strict';var Sequelize=require(_0xb1b4('0x0'));module[_0xb1b4('0x1')]={'name':{'type':Sequelize[_0xb1b4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb1b4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb1b4('0x3')](_0xb1b4('0x4'),'beepall',_0xb1b4('0x5'))}}; \ No newline at end of file +var _0x6797=['STRING','INTEGER','ENUM','roundrobin','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6797,0x18f));var _0x7679=function(_0x2be7c2,_0x238b1c){_0x2be7c2=_0x2be7c2-0x0;var _0xe43b4e=_0x6797[_0x2be7c2];return _0xe43b4e;};'use strict';var Sequelize=require(_0x7679('0x0'));module['exports']={'name':{'type':Sequelize[_0x7679('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7679('0x1')]},'timeout':{'type':Sequelize[_0x7679('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7679('0x3')]('rrmemory','beepall',_0x7679('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e6a8249..5344c42 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 _0x4da6=['json','undefined','offset','count','limit','set','Content-Range','update','destroy','then','get','MailQueues','UserProfileResource','name','send','index','map','MailQueue','fieldName','type','key','getOptions','where','include','query','findAll','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','rawAttributes','nolimit','order','sort','pick','MailQueueId','filter','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','Agents','voicePause','interface','sequelize','transaction','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','status'];(function(_0x4fb64e,_0x289d9d){var _0xcc90d8=function(_0x59bbd1){while(--_0x59bbd1){_0x4fb64e['push'](_0x4fb64e['shift']());}};_0xcc90d8(++_0x289d9d);}(_0x4da6,0x68));var _0x64da=function(_0x2e7ca6,_0x310cd){_0x2e7ca6=_0x2e7ca6-0x0;var _0x1393d7=_0x4da6[_0x2e7ca6];return _0x1393d7;};'use strict';var BPromise=require(_0x64da('0x0'));var util=require(_0x64da('0x1'));var _=require('lodash');var squel=require(_0x64da('0x2'));var Redis=require(_0x64da('0x3'));var qs=require(_0x64da('0x4'));var logger=require(_0x64da('0x5'))('api');var config=require(_0x64da('0x6'));var db=require(_0x64da('0x7'))['db'];config[_0x64da('0x8')]=_['defaults'](config[_0x64da('0x8')],{'host':_0x64da('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x64da('0xa')](socket);function respondWithStatusCode(_0x4a5c11,_0x118df8){_0x118df8=_0x118df8||0xcc;return function(_0x28aad0){if(_0x28aad0){return _0x4a5c11[_0x64da('0xb')](_0x118df8);}return _0x4a5c11['status'](_0x118df8)[_0x64da('0xc')]();};}function respondWithResult(_0x5271c2,_0x1908c2){_0x1908c2=_0x1908c2||0xc8;return function(_0x29543c){if(_0x29543c){return _0x5271c2[_0x64da('0xd')](_0x1908c2)[_0x64da('0xe')](_0x29543c);}};}function respondWithFilteredResult(_0x5a2cae,_0x2f40ef){return function(_0x4dd17f){if(_0x4dd17f){var _0x34622a=typeof _0x2f40ef['offset']===_0x64da('0xf')&&typeof _0x2f40ef['limit']===_0x64da('0xf');var _0x80ecdb=_0x4dd17f['count'];var _0x4766fe=_0x34622a?0x0:_0x2f40ef[_0x64da('0x10')];var _0x4afab4=_0x34622a?_0x4dd17f[_0x64da('0x11')]:_0x2f40ef[_0x64da('0x10')]+_0x2f40ef[_0x64da('0x12')];var _0x591a96;if(_0x4afab4>=_0x80ecdb){_0x4afab4=_0x80ecdb;_0x591a96=0xc8;}else{_0x591a96=0xce;}_0x5a2cae[_0x64da('0xd')](_0x591a96);return _0x5a2cae[_0x64da('0x13')](_0x64da('0x14'),_0x4766fe+'-'+_0x4afab4+'/'+_0x80ecdb)[_0x64da('0xe')](_0x4dd17f);}return null;};}function saveUpdates(_0x3a36d7){return function(_0x1f0490){if(_0x1f0490){return _0x1f0490[_0x64da('0x15')](_0x3a36d7)['then'](function(_0x5c2b2a){return _0x5c2b2a;});}return null;};}function removeEntity(_0x17d2e5){return function(_0x4cc59e){if(_0x4cc59e){return _0x4cc59e[_0x64da('0x16')]()[_0x64da('0x17')](function(){var _0x1b1db1=_0x4cc59e[_0x64da('0x18')]({'plain':!![]});var _0x161faa=_0x64da('0x19');return db[_0x64da('0x1a')][_0x64da('0x16')]({'where':{'type':_0x161faa,'resourceId':_0x1b1db1['id']}})[_0x64da('0x17')](function(){return _0x4cc59e;});})[_0x64da('0x17')](function(){_0x17d2e5['status'](0xcc)[_0x64da('0xc')]();});}};}function handleEntityNotFound(_0x5bbfd9){return function(_0x2f1913){if(!_0x2f1913){_0x5bbfd9['sendStatus'](0x194);}return _0x2f1913;};}function handleError(_0x228c26,_0x408503){_0x408503=_0x408503||0x1f4;return function(_0x365de3){logger['error'](_0x365de3['stack']);if(_0x365de3[_0x64da('0x1b')]){delete _0x365de3['name'];}_0x228c26[_0x64da('0xd')](_0x408503)[_0x64da('0x1c')](_0x365de3);};}exports[_0x64da('0x1d')]=function(_0x2114cd,_0x57b954){var _0x1805b9={};var _0x46adbe={'count':0x0,'rows':[]};var _0x1ccc9e=_[_0x64da('0x1e')](db[_0x64da('0x1f')]['rawAttributes'],function(_0x4b5dbf){return{'name':_0x4b5dbf[_0x64da('0x20')],'type':_0x4b5dbf[_0x64da('0x21')][_0x64da('0x22')]};});_0x1805b9=qs[_0x64da('0x23')](_0x1ccc9e,_0x2114cd);var _0x8ed679={'where':_0x1805b9[_0x64da('0x24')]};return db['MailQueue'][_0x64da('0x11')](_0x8ed679)[_0x64da('0x17')](function(_0x1404ab){_0x46adbe[_0x64da('0x11')]=_0x1404ab;_0x1805b9[_0x64da('0x25')]=qs[_0x64da('0x25')](_0x2114cd[_0x64da('0x26')]);return db['MailQueue'][_0x64da('0x27')](_0x1805b9);})[_0x64da('0x17')](function(_0x1469b3){_0x46adbe['rows']=_0x1469b3;return _0x46adbe;})['then'](respondWithFilteredResult(_0x57b954,_0x1805b9))['catch'](handleError(_0x57b954,null));};exports[_0x64da('0x28')]=function(_0x18cf6c,_0xf6cfe1){var _0x14aa4e={'raw':!![],'where':{'id':_0x18cf6c[_0x64da('0x29')]['id']}},_0x4ea8ef={};_0x4ea8ef[_0x64da('0x2a')]=_['keys'](db[_0x64da('0x1f')]['rawAttributes']);_0x4ea8ef[_0x64da('0x26')]=_[_0x64da('0x2b')](_0x18cf6c['query']);_0x4ea8ef[_0x64da('0x2c')]=_[_0x64da('0x2d')](_0x4ea8ef[_0x64da('0x2a')],_0x4ea8ef['query']);_0x14aa4e[_0x64da('0x2e')]=_[_0x64da('0x2d')](_0x4ea8ef[_0x64da('0x2a')],qs[_0x64da('0x2f')](_0x18cf6c['query'][_0x64da('0x2f')]));_0x14aa4e[_0x64da('0x2e')]=_0x14aa4e[_0x64da('0x2e')][_0x64da('0x30')]?_0x14aa4e[_0x64da('0x2e')]:_0x4ea8ef[_0x64da('0x2a')];if(_0x18cf6c['query'][_0x64da('0x31')]){_0x14aa4e[_0x64da('0x25')]=[{'all':!![]}];}_0x14aa4e=_[_0x64da('0x32')]({},_0x14aa4e,_0x18cf6c[_0x64da('0x33')]);return db['MailQueue'][_0x64da('0x34')](_0x14aa4e)[_0x64da('0x17')](handleEntityNotFound(_0xf6cfe1,null))[_0x64da('0x17')](respondWithResult(_0xf6cfe1,null))['catch'](handleError(_0xf6cfe1,null));};exports['create']=function(_0x4153da,_0x3741a2){return db['MailQueue'][_0x64da('0x35')](_0x4153da[_0x64da('0x36')],{})['then'](function(_0x54e833){var _0x432fad=_0x4153da['user'][_0x64da('0x18')]({'plain':!![]});if(!_0x432fad)throw new Error(_0x64da('0x37'));if(_0x432fad[_0x64da('0x38')]===_0x64da('0x39')){var _0x30a299=_0x54e833[_0x64da('0x18')]({'plain':!![]});var _0x344586='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x344586,'userProfileId':_0x432fad[_0x64da('0x3a')]},'raw':!![]})['then'](function(_0x23da4a){if(_0x23da4a&&_0x23da4a[_0x64da('0x3b')]===0x0){return db[_0x64da('0x1a')][_0x64da('0x35')]({'name':_0x30a299['name'],'resourceId':_0x30a299['id'],'type':_0x23da4a[_0x64da('0x1b')],'sectionId':_0x23da4a['id']},{})[_0x64da('0x17')](function(){return _0x54e833;});}else{return _0x54e833;}})[_0x64da('0x3c')](function(_0xdd1fdb){logger['error'](_0x64da('0x3d'),_0xdd1fdb);throw _0xdd1fdb;});}return _0x54e833;})['then'](respondWithResult(_0x3741a2,0xc9))[_0x64da('0x3c')](handleError(_0x3741a2,null));};exports[_0x64da('0x15')]=function(_0x311f50,_0x12f932){if(_0x311f50['body']['id']){delete _0x311f50['body']['id'];}return db[_0x64da('0x1f')]['find']({'where':{'id':_0x311f50['params']['id']}})['then'](handleEntityNotFound(_0x12f932,null))[_0x64da('0x17')](saveUpdates(_0x311f50['body'],null))['then'](respondWithResult(_0x12f932,null))[_0x64da('0x3c')](handleError(_0x12f932,null));};exports[_0x64da('0x16')]=function(_0x35401d,_0x404f43){return db[_0x64da('0x1f')][_0x64da('0x34')]({'where':{'id':_0x35401d[_0x64da('0x29')]['id']}})[_0x64da('0x17')](handleEntityNotFound(_0x404f43,null))[_0x64da('0x17')](removeEntity(_0x404f43,null))[_0x64da('0x3c')](handleError(_0x404f43,null));};exports[_0x64da('0x3e')]=function(_0x324644,_0x32f9e5){return db[_0x64da('0x1f')][_0x64da('0x3e')]()[_0x64da('0x17')](respondWithResult(_0x32f9e5,null))[_0x64da('0x3c')](handleError(_0x32f9e5,null));};exports[_0x64da('0x3f')]=function(_0x30b1cf,_0x3c2b1d){var _0x18e482={'raw':!![],'where':{}},_0x134cfc={},_0x384b25;return db['MailQueue'][_0x64da('0x40')]({'where':{'id':_0x30b1cf[_0x64da('0x29')]['id']}})[_0x64da('0x17')](handleEntityNotFound(_0x3c2b1d,null))[_0x64da('0x17')](function(_0x3cde17){if(_0x3cde17){_0x384b25=_0x3cde17[_0x64da('0x18')]({'plain':!![]});_0x134cfc['model']=_['keys'](db['UserMailQueue'][_0x64da('0x41')]);_0x134cfc[_0x64da('0x26')]=_['keys'](_0x30b1cf[_0x64da('0x26')]);_0x134cfc[_0x64da('0x2c')]=_[_0x64da('0x2d')](_0x134cfc[_0x64da('0x2a')],_0x134cfc[_0x64da('0x26')]);_0x18e482[_0x64da('0x2e')]=_[_0x64da('0x2d')](_0x134cfc[_0x64da('0x2a')],qs[_0x64da('0x2f')](_0x30b1cf[_0x64da('0x26')][_0x64da('0x2f')]));_0x18e482[_0x64da('0x2e')]=_0x18e482[_0x64da('0x2e')][_0x64da('0x30')]?_0x18e482[_0x64da('0x2e')]:_0x134cfc[_0x64da('0x2a')];if(!_0x30b1cf[_0x64da('0x26')]['hasOwnProperty'](_0x64da('0x42'))){_0x18e482[_0x64da('0x12')]=qs[_0x64da('0x12')](_0x30b1cf[_0x64da('0x26')][_0x64da('0x12')]);_0x18e482[_0x64da('0x10')]=qs[_0x64da('0x10')](_0x30b1cf[_0x64da('0x26')]['offset']);}_0x18e482[_0x64da('0x43')]=qs[_0x64da('0x44')](_0x30b1cf[_0x64da('0x26')][_0x64da('0x44')]);_0x18e482[_0x64da('0x24')]=qs[_0x64da('0x2c')](_[_0x64da('0x45')](_0x30b1cf[_0x64da('0x26')],_0x134cfc[_0x64da('0x2c')]));_0x18e482[_0x64da('0x24')][_0x64da('0x46')]=_0x3cde17['id'];if(_0x30b1cf[_0x64da('0x26')][_0x64da('0x47')]){_0x18e482[_0x64da('0x24')]=_[_0x64da('0x32')](_0x18e482[_0x64da('0x24')],{'$or':_[_0x64da('0x1e')](_0x18e482[_0x64da('0x2e')],function(_0x174feb){var _0x5554c4={};_0x5554c4[_0x174feb]={'$like':'%'+_0x30b1cf[_0x64da('0x26')][_0x64da('0x47')]+'%'};return _0x5554c4;})});}_0x18e482=_[_0x64da('0x32')]({},_0x18e482,_0x30b1cf[_0x64da('0x33')]);return db[_0x64da('0x48')][_0x64da('0x27')](_0x18e482);}})[_0x64da('0x17')](function(_0x995139){if(_0x995139){return db[_0x64da('0x49')][_0x64da('0x4a')]({'where':{'id':_['map'](_0x995139,_0x64da('0x4b')),'role':_0x64da('0x4c')},'attributes':['id',_0x64da('0x1b'),_0x64da('0x4d'),_0x64da('0x4e'),_0x64da('0x4f')]});}})['then'](function(_0x1e755d){if(_0x1e755d){return{'count':_0x1e755d[_0x64da('0x11')],'rows':_[_0x64da('0x1e')](_0x1e755d[_0x64da('0x50')],function(_0x5237be){return{'membername':_0x5237be[_0x64da('0x1b')],'UserId':_0x5237be['id'],'queue_name':_0x384b25['name'],'MailQueueId':_0x384b25['id'],'interface':util[_0x64da('0x51')](_0x64da('0x52'),_0x64da('0x53'),_0x5237be[_0x64da('0x1b')]),'penalty':0x0,'paused':_0x5237be[_0x64da('0x4d')],'createdAt':_0x5237be[_0x64da('0x4f')],'updatedAt':_0x5237be[_0x64da('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x64da('0x17')](respondWithFilteredResult(_0x3c2b1d,_0x18e482))[_0x64da('0x3c')](handleError(_0x3c2b1d,null));};exports[_0x64da('0x54')]=function(_0x5c5dc5,_0x26b7dc){var _0x459706={};var _0x1dcaf8={};var _0x55fbd1;var _0x2631e1;return db[_0x64da('0x1f')]['findOne']({'where':{'id':_0x5c5dc5['params']['id']}})[_0x64da('0x17')](handleEntityNotFound(_0x26b7dc,null))[_0x64da('0x17')](function(_0x20f707){if(_0x20f707){_0x55fbd1=_0x20f707;_0x1dcaf8['model']=_[_0x64da('0x2b')](db[_0x64da('0x55')]['rawAttributes']);_0x1dcaf8['query']=_[_0x64da('0x2b')](_0x5c5dc5['query']);_0x1dcaf8[_0x64da('0x2c')]=_['intersection'](_0x1dcaf8[_0x64da('0x2a')],_0x1dcaf8[_0x64da('0x26')]);_0x459706['attributes']=_[_0x64da('0x2d')](_0x1dcaf8[_0x64da('0x2a')],qs[_0x64da('0x2f')](_0x5c5dc5[_0x64da('0x26')]['fields']));_0x459706[_0x64da('0x2e')]=_0x459706['attributes'][_0x64da('0x30')]?_0x459706['attributes']:_0x1dcaf8[_0x64da('0x2a')];_0x459706[_0x64da('0x43')]=qs[_0x64da('0x44')](_0x5c5dc5['query']['sort']);_0x459706[_0x64da('0x24')]=qs[_0x64da('0x2c')](_[_0x64da('0x45')](_0x5c5dc5['query'],_0x1dcaf8['filters']));if(_0x5c5dc5['query'][_0x64da('0x47')]){_0x459706[_0x64da('0x24')]=_[_0x64da('0x32')](_0x459706[_0x64da('0x24')],{'$or':_['map'](_0x459706[_0x64da('0x2e')],function(_0x5ed950){var _0x1378de={};_0x1378de[_0x5ed950]={'$like':'%'+_0x5c5dc5[_0x64da('0x26')][_0x64da('0x47')]+'%'};return _0x1378de;})});}_0x459706=_['merge']({},_0x459706,_0x5c5dc5['options']);return _0x55fbd1['getTeams'](_0x459706);}})[_0x64da('0x17')](function(_0x1dfba0){if(_0x1dfba0){_0x2631e1=_0x1dfba0['length'];if(!_0x5c5dc5[_0x64da('0x26')][_0x64da('0x56')]('nolimit')){_0x459706[_0x64da('0x12')]=qs[_0x64da('0x12')](_0x5c5dc5[_0x64da('0x26')]['limit']);_0x459706[_0x64da('0x10')]=qs[_0x64da('0x10')](_0x5c5dc5[_0x64da('0x26')][_0x64da('0x10')]);}return _0x55fbd1[_0x64da('0x54')](_0x459706);}})[_0x64da('0x17')](function(_0x545e7f){if(_0x545e7f){return _0x545e7f?{'count':_0x2631e1,'rows':_0x545e7f}:null;}})['then'](respondWithResult(_0x26b7dc,null))['catch'](handleError(_0x26b7dc,null));};exports[_0x64da('0x57')]=function(_0x60ead3,_0x193935){var _0x4ac59a=_0x60ead3[_0x64da('0x36')]['ids'];return db[_0x64da('0x55')]['findAll']({'where':{'id':_0x4ac59a},'attributes':['id'],'include':[{'model':db[_0x64da('0x49')],'as':_0x64da('0x58'),'attributes':['id',_0x64da('0x1b'),'online',_0x64da('0x59'),_0x64da('0x5a')],'raw':!![]}]})[_0x64da('0x17')](function(_0x58f38e){if(_0x58f38e){var _0x367d26=_['flatMap'](_0x58f38e,function(_0x5de35a){var _0x32ed32=_0x5de35a[_0x64da('0x18')]({'plain':!![]});return _0x32ed32[_0x64da('0x58')];});return db[_0x64da('0x1f')][_0x64da('0x34')]({'where':{'id':_0x60ead3[_0x64da('0x29')]['id']}})[_0x64da('0x17')](function(_0x467dab){return db[_0x64da('0x5b')][_0x64da('0x5c')](function(_0x328298){return _0x467dab['addTeams'](_0x4ac59a,{'transaction':_0x328298})['then'](function(){return BPromise['each'](_0x367d26,function(_0x34b303){return db[_0x64da('0x48')]['findOrCreate']({'where':{'UserId':_0x34b303['id'],'MailQueueId':_0x60ead3['params']['id']},'transaction':_0x328298});});})['then'](function(){_0x367d26[_0x64da('0x5d')](function(_0x2b617f){socket[_0x64da('0x5e')](_0x64da('0x5f'),{'UserId':_0x2b617f['id'],'MailQueueId':_0x467dab['id']});});});});});}})[_0x64da('0x17')](respondWithStatusCode(_0x193935,null))['catch'](handleError(_0x193935,null));};exports[_0x64da('0x60')]=function(_0x35890e,_0x14ac33){return db[_0x64da('0x55')][_0x64da('0x27')]({'where':{'id':_0x35890e[_0x64da('0x26')][_0x64da('0x61')]},'attributes':['id'],'include':[{'model':db[_0x64da('0x49')],'as':_0x64da('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x14ac33,null))['then'](function(_0x3e529a){var _0x35c4d0=_[_0x64da('0x1e')](_0x3e529a,'id');var _0x48cdbc=[];var _0x4d0257=[];var _0x313e36=squel[_0x64da('0x62')]();_0x313e36[_0x64da('0x63')](_0x64da('0x64'))['from']('team_has_mail_queues','tq')['join'](_0x64da('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x35890e[_0x64da('0x29')]['id']);for(var _0x1e84cc=0x0;_0x1e84cc<_0x3e529a[_0x64da('0x30')];_0x1e84cc+=0x1){let _0x5e6a54=_0x3e529a[_0x1e84cc];for(var _0x11a357=0x0;_0x11a357<_0x5e6a54['Agents'][_0x64da('0x30')];_0x11a357+=0x1){let _0x233089=_0x5e6a54['Agents'][_0x11a357];var _0x56cbb1=_0x313e36[_0x64da('0x66')]();_0x56cbb1[_0x64da('0x24')](_0x64da('0x67'),_0x233089['id']);_0x4d0257[_0x64da('0x68')](db[_0x64da('0x5b')][_0x64da('0x26')](_0x56cbb1['toString'](),{'type':db[_0x64da('0x5b')][_0x64da('0x69')][_0x64da('0x6a')]})[_0x64da('0x17')](function(_0x2b24c7){if(_0x2b24c7[_0x64da('0x30')]===0x1){return _0x233089['id'];}else{var _0x4ceadb=_[_0x64da('0x6b')](_['map'](_0x2b24c7,_0x64da('0x6c')),function(_0x116195){return _[_0x64da('0x6d')](_0x35c4d0,_0x116195);});if(_0x4ceadb){return _0x233089['id'];}}}));}}return BPromise['all'](_0x4d0257)[_0x64da('0x17')](function(_0x3165f4){_0x48cdbc=_(_0x48cdbc)[_0x64da('0x6e')](_0x3165f4)[_0x64da('0x6f')]()['value']();return db[_0x64da('0x1f')][_0x64da('0x34')]({'where':{'id':_0x35890e['params']['id']}})[_0x64da('0x17')](function(_0x488014){return db[_0x64da('0x5b')]['transaction'](function(_0x49452d){return _0x488014[_0x64da('0x60')](_0x35890e[_0x64da('0x26')]['ids'],{'transaction':_0x49452d})[_0x64da('0x17')](function(){if(!_[_0x64da('0x70')](_0x48cdbc)){return _0x488014[_0x64da('0x71')](_0x48cdbc,{'transaction':_0x49452d});}})[_0x64da('0x17')](function(){_0x48cdbc[_0x64da('0x5d')](function(_0x276a7b){socket[_0x64da('0x5e')](_0x64da('0x72'),{'UserId':_0x276a7b,'MailQueueId':_0x488014['id']});});});});});});})[_0x64da('0x17')](respondWithStatusCode(_0x14ac33,null))['catch'](handleError(_0x14ac33,null));};exports[_0x64da('0x73')]=function(_0x4362ed,_0x250966){return db['MailQueue'][_0x64da('0x34')]({'where':{'id':_0x4362ed[_0x64da('0x29')]['id']}})[_0x64da('0x17')](handleEntityNotFound(_0x250966,null))[_0x64da('0x17')](function(_0x1d7b10){if(_0x1d7b10){return _0x1d7b10[_0x64da('0x73')](_0x4362ed[_0x64da('0x36')]['ids'],_['omit'](_0x4362ed[_0x64da('0x36')],[_0x64da('0x61'),'id'])||{})[_0x64da('0x74')](function(_0x3dbb6d){for(var _0x2412cc=0x0;_0x2412cc<_0x4362ed[_0x64da('0x36')][_0x64da('0x61')][_0x64da('0x30')];_0x2412cc+=0x1){socket[_0x64da('0x5e')](_0x64da('0x5f'),{'UserId':Number(_0x4362ed[_0x64da('0x36')]['ids'][_0x2412cc]),'MailQueueId':Number(_0x4362ed[_0x64da('0x29')]['id'])});}return _0x3dbb6d;});}})[_0x64da('0x17')](respondWithResult(_0x250966,null))['catch'](handleError(_0x250966,null));};exports[_0x64da('0x71')]=function(_0x158052,_0x23daf1){return db[_0x64da('0x1f')][_0x64da('0x34')]({'where':{'id':_0x158052[_0x64da('0x29')]['id']}})[_0x64da('0x17')](handleEntityNotFound(_0x23daf1,null))[_0x64da('0x17')](function(_0x21994f){if(_0x21994f){return _0x21994f[_0x64da('0x71')](_0x158052[_0x64da('0x26')]['ids'])[_0x64da('0x17')](function(){if(_['isArray'](_0x158052['query'][_0x64da('0x61')])){for(var _0x15cf24=0x0;_0x15cf24<_0x158052[_0x64da('0x26')]['ids'][_0x64da('0x30')];_0x15cf24+=0x1){socket[_0x64da('0x5e')]('userMailQueue:remove',{'UserId':Number(_0x158052[_0x64da('0x26')][_0x64da('0x61')][_0x15cf24]),'MailQueueId':Number(_0x158052[_0x64da('0x29')]['id'])});}}else{socket['emit'](_0x64da('0x72'),{'UserId':Number(_0x158052[_0x64da('0x26')]['ids']),'MailQueueId':Number(_0x158052[_0x64da('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x23daf1,null))['catch'](handleError(_0x23daf1,null));};exports[_0x64da('0x75')]=function(_0x1e7395,_0x432989){var _0x29859a={};var _0x185ca0={};var _0x2955ef;var _0x22ad0b;return db[_0x64da('0x1f')][_0x64da('0x40')]({'where':{'id':_0x1e7395[_0x64da('0x29')]['id']}})[_0x64da('0x17')](handleEntityNotFound(_0x432989,null))['then'](function(_0x5d5ac8){if(_0x5d5ac8){_0x2955ef=_0x5d5ac8;_0x185ca0[_0x64da('0x2a')]=_[_0x64da('0x2b')](db[_0x64da('0x49')][_0x64da('0x41')]);_0x185ca0[_0x64da('0x26')]=_[_0x64da('0x2b')](_0x1e7395[_0x64da('0x26')]);_0x185ca0['filters']=_['intersection'](_0x185ca0['model'],_0x185ca0[_0x64da('0x26')]);_0x29859a['attributes']=_['intersection'](_0x185ca0['model'],qs[_0x64da('0x2f')](_0x1e7395[_0x64da('0x26')][_0x64da('0x2f')]));_0x29859a[_0x64da('0x2e')]=_0x29859a['attributes'][_0x64da('0x30')]?_0x29859a[_0x64da('0x2e')]:_0x185ca0['model'];_0x29859a['order']=qs[_0x64da('0x44')](_0x1e7395[_0x64da('0x26')][_0x64da('0x44')]);_0x29859a[_0x64da('0x24')]=qs[_0x64da('0x2c')](_[_0x64da('0x45')](_0x1e7395[_0x64da('0x26')],_0x185ca0[_0x64da('0x2c')]));if(_0x1e7395[_0x64da('0x26')]['filter']){_0x29859a[_0x64da('0x24')]=_[_0x64da('0x32')](_0x29859a[_0x64da('0x24')],{'$or':_[_0x64da('0x1e')](_0x29859a['attributes'],function(_0x113a02){var _0x25551d={};_0x25551d[_0x113a02]={'$like':'%'+_0x1e7395['query'][_0x64da('0x47')]+'%'};return _0x25551d;})});}_0x29859a=_[_0x64da('0x32')]({},_0x29859a,_0x1e7395['options']);return _0x2955ef[_0x64da('0x75')](_0x29859a);}})[_0x64da('0x17')](function(_0x58a641){if(_0x58a641){_0x22ad0b=_0x58a641['length'];if(!_0x1e7395[_0x64da('0x26')]['hasOwnProperty'](_0x64da('0x42'))){_0x29859a['limit']=qs[_0x64da('0x12')](_0x1e7395[_0x64da('0x26')][_0x64da('0x12')]);_0x29859a[_0x64da('0x10')]=qs[_0x64da('0x10')](_0x1e7395[_0x64da('0x26')][_0x64da('0x10')]);}return _0x2955ef['getAgents'](_0x29859a);}})['then'](function(_0x565dcf){if(_0x565dcf){return _0x565dcf?{'count':_0x22ad0b,'rows':_0x565dcf}:null;}})[_0x64da('0x17')](respondWithResult(_0x432989,null))['catch'](handleError(_0x432989,null));}; \ No newline at end of file +var _0x6abd=['redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','getOptions','count','include','query','findAll','show','params','keys','intersection','model','fields','attributes','length','merge','options','find','create','body','user','get','role','MailQueues','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','nolimit','order','sort','where','filters','MailQueueId','filter','User','agent','mailPause','format','SIP','createdAt','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','spread','isArray','pick','getAgents','util','lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0x6abd,0x15e));var _0xd6ab=function(_0xbeb72d,_0x155799){_0xbeb72d=_0xbeb72d-0x0;var _0x42cc07=_0x6abd[_0xbeb72d];return _0x42cc07;};'use strict';var BPromise=require('bluebird');var util=require(_0xd6ab('0x0'));var _=require(_0xd6ab('0x1'));var squel=require(_0xd6ab('0x2'));var Redis=require(_0xd6ab('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xd6ab('0x4'))('api');var config=require(_0xd6ab('0x5'));var db=require(_0xd6ab('0x6'))['db'];config[_0xd6ab('0x7')]=_[_0xd6ab('0x8')](config['redis'],{'host':_0xd6ab('0x9'),'port':0x18eb});var socket=require(_0xd6ab('0xa'))(new Redis(config[_0xd6ab('0x7')]));require(_0xd6ab('0xb'))[_0xd6ab('0xc')](socket);function respondWithStatusCode(_0x489b67,_0x2eefa4){_0x2eefa4=_0x2eefa4||0xcc;return function(_0x5e88b7){if(_0x5e88b7){return _0x489b67[_0xd6ab('0xd')](_0x2eefa4);}return _0x489b67['status'](_0x2eefa4)[_0xd6ab('0xe')]();};}function respondWithResult(_0x4f3b9b,_0x1e18e4){_0x1e18e4=_0x1e18e4||0xc8;return function(_0x287b4b){if(_0x287b4b){return _0x4f3b9b[_0xd6ab('0xf')](_0x1e18e4)[_0xd6ab('0x10')](_0x287b4b);}};}function respondWithFilteredResult(_0x5145f2,_0xf8702c){return function(_0x446099){if(_0x446099){var _0x3c489b=typeof _0xf8702c['offset']===_0xd6ab('0x11')&&typeof _0xf8702c['limit']===_0xd6ab('0x11');var _0x205f8f=_0x446099['count'];var _0x3a8fe4=_0x3c489b?0x0:_0xf8702c[_0xd6ab('0x12')];var _0x4f2d38=_0x3c489b?_0x446099['count']:_0xf8702c['offset']+_0xf8702c[_0xd6ab('0x13')];var _0x384086;if(_0x4f2d38>=_0x205f8f){_0x4f2d38=_0x205f8f;_0x384086=0xc8;}else{_0x384086=0xce;}_0x5145f2[_0xd6ab('0xf')](_0x384086);return _0x5145f2[_0xd6ab('0x14')](_0xd6ab('0x15'),_0x3a8fe4+'-'+_0x4f2d38+'/'+_0x205f8f)['json'](_0x446099);}return null;};}function saveUpdates(_0x416a46){return function(_0x492999){if(_0x492999){return _0x492999[_0xd6ab('0x16')](_0x416a46)[_0xd6ab('0x17')](function(_0x36b264){return _0x36b264;});}return null;};}function removeEntity(_0x1c66fc){return function(_0x383218){if(_0x383218){return _0x383218[_0xd6ab('0x18')]()[_0xd6ab('0x17')](function(){var _0x1a4fd6=_0x383218['get']({'plain':!![]});var _0xf29ef0='MailQueues';return db['UserProfileResource'][_0xd6ab('0x18')]({'where':{'type':_0xf29ef0,'resourceId':_0x1a4fd6['id']}})[_0xd6ab('0x17')](function(){return _0x383218;});})['then'](function(){_0x1c66fc[_0xd6ab('0xf')](0xcc)[_0xd6ab('0xe')]();});}};}function handleEntityNotFound(_0x350827){return function(_0x31f855){if(!_0x31f855){_0x350827[_0xd6ab('0xd')](0x194);}return _0x31f855;};}function handleError(_0x499068,_0x202ddf){_0x202ddf=_0x202ddf||0x1f4;return function(_0x2865d9){logger[_0xd6ab('0x19')](_0x2865d9[_0xd6ab('0x1a')]);if(_0x2865d9[_0xd6ab('0x1b')]){delete _0x2865d9[_0xd6ab('0x1b')];}_0x499068[_0xd6ab('0xf')](_0x202ddf)[_0xd6ab('0x1c')](_0x2865d9);};}exports[_0xd6ab('0x1d')]=function(_0x4126f0,_0x13a20e){var _0x3b9340={};var _0x26b418={'count':0x0,'rows':[]};var _0x5e2ace=_[_0xd6ab('0x1e')](db[_0xd6ab('0x1f')][_0xd6ab('0x20')],function(_0x3680af){return{'name':_0x3680af[_0xd6ab('0x21')],'type':_0x3680af['type']['key']};});_0x3b9340=qs[_0xd6ab('0x22')](_0x5e2ace,_0x4126f0);var _0x73da3={'where':_0x3b9340['where']};return db['MailQueue'][_0xd6ab('0x23')](_0x73da3)[_0xd6ab('0x17')](function(_0x389bdc){_0x26b418['count']=_0x389bdc;_0x3b9340[_0xd6ab('0x24')]=qs[_0xd6ab('0x24')](_0x4126f0[_0xd6ab('0x25')]);return db[_0xd6ab('0x1f')][_0xd6ab('0x26')](_0x3b9340);})[_0xd6ab('0x17')](function(_0x5dac7c){_0x26b418['rows']=_0x5dac7c;return _0x26b418;})[_0xd6ab('0x17')](respondWithFilteredResult(_0x13a20e,_0x3b9340))['catch'](handleError(_0x13a20e,null));};exports[_0xd6ab('0x27')]=function(_0x3f746d,_0xfb0b5a){var _0x5e15c9={'raw':!![],'where':{'id':_0x3f746d[_0xd6ab('0x28')]['id']}},_0x2f08bc={};_0x2f08bc['model']=_[_0xd6ab('0x29')](db['MailQueue'][_0xd6ab('0x20')]);_0x2f08bc[_0xd6ab('0x25')]=_[_0xd6ab('0x29')](_0x3f746d[_0xd6ab('0x25')]);_0x2f08bc['filters']=_[_0xd6ab('0x2a')](_0x2f08bc['model'],_0x2f08bc[_0xd6ab('0x25')]);_0x5e15c9['attributes']=_['intersection'](_0x2f08bc[_0xd6ab('0x2b')],qs['fields'](_0x3f746d[_0xd6ab('0x25')][_0xd6ab('0x2c')]));_0x5e15c9['attributes']=_0x5e15c9[_0xd6ab('0x2d')][_0xd6ab('0x2e')]?_0x5e15c9[_0xd6ab('0x2d')]:_0x2f08bc[_0xd6ab('0x2b')];if(_0x3f746d['query']['includeAll']){_0x5e15c9[_0xd6ab('0x24')]=[{'all':!![]}];}_0x5e15c9=_[_0xd6ab('0x2f')]({},_0x5e15c9,_0x3f746d[_0xd6ab('0x30')]);return db[_0xd6ab('0x1f')][_0xd6ab('0x31')](_0x5e15c9)['then'](handleEntityNotFound(_0xfb0b5a,null))[_0xd6ab('0x17')](respondWithResult(_0xfb0b5a,null))['catch'](handleError(_0xfb0b5a,null));};exports['create']=function(_0x6347e1,_0x1dfe5b){return db[_0xd6ab('0x1f')][_0xd6ab('0x32')](_0x6347e1[_0xd6ab('0x33')],{})[_0xd6ab('0x17')](function(_0x25df08){var _0xdc45cc=_0x6347e1[_0xd6ab('0x34')][_0xd6ab('0x35')]({'plain':!![]});if(!_0xdc45cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdc45cc[_0xd6ab('0x36')]===_0xd6ab('0x34')){var _0xbc937c=_0x25df08[_0xd6ab('0x35')]({'plain':!![]});var _0x38d412=_0xd6ab('0x37');return db[_0xd6ab('0x38')][_0xd6ab('0x31')]({'where':{'name':_0x38d412,'userProfileId':_0xdc45cc[_0xd6ab('0x39')]},'raw':!![]})[_0xd6ab('0x17')](function(_0x2077b5){if(_0x2077b5&&_0x2077b5['autoAssociation']===0x0){return db[_0xd6ab('0x3a')]['create']({'name':_0xbc937c[_0xd6ab('0x1b')],'resourceId':_0xbc937c['id'],'type':_0x2077b5[_0xd6ab('0x1b')],'sectionId':_0x2077b5['id']},{})['then'](function(){return _0x25df08;});}else{return _0x25df08;}})[_0xd6ab('0x3b')](function(_0x5292dc){logger[_0xd6ab('0x19')](_0xd6ab('0x3c'),_0x5292dc);throw _0x5292dc;});}return _0x25df08;})[_0xd6ab('0x17')](respondWithResult(_0x1dfe5b,0xc9))['catch'](handleError(_0x1dfe5b,null));};exports[_0xd6ab('0x16')]=function(_0x436452,_0x29029b){if(_0x436452['body']['id']){delete _0x436452[_0xd6ab('0x33')]['id'];}return db[_0xd6ab('0x1f')][_0xd6ab('0x31')]({'where':{'id':_0x436452['params']['id']}})[_0xd6ab('0x17')](handleEntityNotFound(_0x29029b,null))[_0xd6ab('0x17')](saveUpdates(_0x436452['body'],null))['then'](respondWithResult(_0x29029b,null))['catch'](handleError(_0x29029b,null));};exports[_0xd6ab('0x18')]=function(_0x2a8f9b,_0x4281d4){return db[_0xd6ab('0x1f')]['find']({'where':{'id':_0x2a8f9b[_0xd6ab('0x28')]['id']}})[_0xd6ab('0x17')](handleEntityNotFound(_0x4281d4,null))['then'](removeEntity(_0x4281d4,null))[_0xd6ab('0x3b')](handleError(_0x4281d4,null));};exports[_0xd6ab('0x3d')]=function(_0x3185a3,_0x4b7feb){return db[_0xd6ab('0x1f')][_0xd6ab('0x3d')]()[_0xd6ab('0x17')](respondWithResult(_0x4b7feb,null))[_0xd6ab('0x3b')](handleError(_0x4b7feb,null));};exports['getMembers']=function(_0x137a50,_0x43a135){var _0x2d3db8={'raw':!![],'where':{}},_0x208039={},_0x125087;return db[_0xd6ab('0x1f')][_0xd6ab('0x3e')]({'where':{'id':_0x137a50['params']['id']}})['then'](handleEntityNotFound(_0x43a135,null))[_0xd6ab('0x17')](function(_0x2c8b1b){if(_0x2c8b1b){_0x125087=_0x2c8b1b['get']({'plain':!![]});_0x208039['model']=_[_0xd6ab('0x29')](db[_0xd6ab('0x3f')][_0xd6ab('0x20')]);_0x208039[_0xd6ab('0x25')]=_[_0xd6ab('0x29')](_0x137a50[_0xd6ab('0x25')]);_0x208039['filters']=_['intersection'](_0x208039[_0xd6ab('0x2b')],_0x208039[_0xd6ab('0x25')]);_0x2d3db8[_0xd6ab('0x2d')]=_[_0xd6ab('0x2a')](_0x208039[_0xd6ab('0x2b')],qs[_0xd6ab('0x2c')](_0x137a50['query'][_0xd6ab('0x2c')]));_0x2d3db8[_0xd6ab('0x2d')]=_0x2d3db8[_0xd6ab('0x2d')][_0xd6ab('0x2e')]?_0x2d3db8[_0xd6ab('0x2d')]:_0x208039[_0xd6ab('0x2b')];if(!_0x137a50[_0xd6ab('0x25')]['hasOwnProperty'](_0xd6ab('0x40'))){_0x2d3db8[_0xd6ab('0x13')]=qs[_0xd6ab('0x13')](_0x137a50['query']['limit']);_0x2d3db8['offset']=qs[_0xd6ab('0x12')](_0x137a50[_0xd6ab('0x25')][_0xd6ab('0x12')]);}_0x2d3db8[_0xd6ab('0x41')]=qs[_0xd6ab('0x42')](_0x137a50['query'][_0xd6ab('0x42')]);_0x2d3db8[_0xd6ab('0x43')]=qs[_0xd6ab('0x44')](_['pick'](_0x137a50[_0xd6ab('0x25')],_0x208039['filters']));_0x2d3db8[_0xd6ab('0x43')][_0xd6ab('0x45')]=_0x2c8b1b['id'];if(_0x137a50[_0xd6ab('0x25')][_0xd6ab('0x46')]){_0x2d3db8[_0xd6ab('0x43')]=_[_0xd6ab('0x2f')](_0x2d3db8[_0xd6ab('0x43')],{'$or':_[_0xd6ab('0x1e')](_0x2d3db8[_0xd6ab('0x2d')],function(_0x9f5357){var _0x3cee28={};_0x3cee28[_0x9f5357]={'$like':'%'+_0x137a50[_0xd6ab('0x25')]['filter']+'%'};return _0x3cee28;})});}_0x2d3db8=_['merge']({},_0x2d3db8,_0x137a50[_0xd6ab('0x30')]);return db[_0xd6ab('0x3f')][_0xd6ab('0x26')](_0x2d3db8);}})['then'](function(_0x2208a7){if(_0x2208a7){return db[_0xd6ab('0x47')]['findAndCountAll']({'where':{'id':_[_0xd6ab('0x1e')](_0x2208a7,'UserId'),'role':_0xd6ab('0x48')},'attributes':['id',_0xd6ab('0x1b'),_0xd6ab('0x49'),'updatedAt','createdAt']});}})[_0xd6ab('0x17')](function(_0x1fac7c){if(_0x1fac7c){return{'count':_0x1fac7c['count'],'rows':_[_0xd6ab('0x1e')](_0x1fac7c['rows'],function(_0x215f4f){return{'membername':_0x215f4f[_0xd6ab('0x1b')],'UserId':_0x215f4f['id'],'queue_name':_0x125087[_0xd6ab('0x1b')],'MailQueueId':_0x125087['id'],'interface':util[_0xd6ab('0x4a')]('%s/%s',_0xd6ab('0x4b'),_0x215f4f[_0xd6ab('0x1b')]),'penalty':0x0,'paused':_0x215f4f['mailPause'],'createdAt':_0x215f4f[_0xd6ab('0x4c')],'updatedAt':_0x215f4f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd6ab('0x17')](respondWithFilteredResult(_0x43a135,_0x2d3db8))['catch'](handleError(_0x43a135,null));};exports['getTeams']=function(_0x927e5,_0x47ef5a){var _0x81fcf0={};var _0x231f71={};var _0x4c6bc3;var _0x26a01d;return db['MailQueue'][_0xd6ab('0x3e')]({'where':{'id':_0x927e5[_0xd6ab('0x28')]['id']}})[_0xd6ab('0x17')](handleEntityNotFound(_0x47ef5a,null))[_0xd6ab('0x17')](function(_0xcd10d7){if(_0xcd10d7){_0x4c6bc3=_0xcd10d7;_0x231f71[_0xd6ab('0x2b')]=_['keys'](db[_0xd6ab('0x4d')][_0xd6ab('0x20')]);_0x231f71['query']=_[_0xd6ab('0x29')](_0x927e5[_0xd6ab('0x25')]);_0x231f71[_0xd6ab('0x44')]=_['intersection'](_0x231f71[_0xd6ab('0x2b')],_0x231f71[_0xd6ab('0x25')]);_0x81fcf0['attributes']=_[_0xd6ab('0x2a')](_0x231f71['model'],qs[_0xd6ab('0x2c')](_0x927e5[_0xd6ab('0x25')]['fields']));_0x81fcf0[_0xd6ab('0x2d')]=_0x81fcf0[_0xd6ab('0x2d')]['length']?_0x81fcf0['attributes']:_0x231f71[_0xd6ab('0x2b')];_0x81fcf0[_0xd6ab('0x41')]=qs[_0xd6ab('0x42')](_0x927e5[_0xd6ab('0x25')][_0xd6ab('0x42')]);_0x81fcf0[_0xd6ab('0x43')]=qs[_0xd6ab('0x44')](_['pick'](_0x927e5[_0xd6ab('0x25')],_0x231f71[_0xd6ab('0x44')]));if(_0x927e5['query'][_0xd6ab('0x46')]){_0x81fcf0['where']=_[_0xd6ab('0x2f')](_0x81fcf0[_0xd6ab('0x43')],{'$or':_[_0xd6ab('0x1e')](_0x81fcf0['attributes'],function(_0x4d7aad){var _0x45894e={};_0x45894e[_0x4d7aad]={'$like':'%'+_0x927e5['query']['filter']+'%'};return _0x45894e;})});}_0x81fcf0=_['merge']({},_0x81fcf0,_0x927e5['options']);return _0x4c6bc3['getTeams'](_0x81fcf0);}})[_0xd6ab('0x17')](function(_0x4d817e){if(_0x4d817e){_0x26a01d=_0x4d817e[_0xd6ab('0x2e')];if(!_0x927e5['query'][_0xd6ab('0x4e')](_0xd6ab('0x40'))){_0x81fcf0['limit']=qs['limit'](_0x927e5[_0xd6ab('0x25')]['limit']);_0x81fcf0[_0xd6ab('0x12')]=qs[_0xd6ab('0x12')](_0x927e5['query']['offset']);}return _0x4c6bc3['getTeams'](_0x81fcf0);}})[_0xd6ab('0x17')](function(_0x541b11){if(_0x541b11){return _0x541b11?{'count':_0x26a01d,'rows':_0x541b11}:null;}})[_0xd6ab('0x17')](respondWithResult(_0x47ef5a,null))[_0xd6ab('0x3b')](handleError(_0x47ef5a,null));};exports[_0xd6ab('0x4f')]=function(_0x328903,_0x34e9ad){var _0xf3ccca=_0x328903[_0xd6ab('0x33')][_0xd6ab('0x50')];return db[_0xd6ab('0x4d')]['findAll']({'where':{'id':_0xf3ccca},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd6ab('0x51'),'attributes':['id',_0xd6ab('0x1b'),_0xd6ab('0x52'),'voicePause',_0xd6ab('0x53')],'raw':!![]}]})['then'](function(_0x5c2926){if(_0x5c2926){var _0x18ca0d=_[_0xd6ab('0x54')](_0x5c2926,function(_0x34fbf6){var _0x4153b3=_0x34fbf6[_0xd6ab('0x35')]({'plain':!![]});return _0x4153b3[_0xd6ab('0x51')];});return db[_0xd6ab('0x1f')][_0xd6ab('0x31')]({'where':{'id':_0x328903[_0xd6ab('0x28')]['id']}})[_0xd6ab('0x17')](function(_0x3c0609){return db[_0xd6ab('0x55')][_0xd6ab('0x56')](function(_0x5ad77b){return _0x3c0609[_0xd6ab('0x4f')](_0xf3ccca,{'transaction':_0x5ad77b})['then'](function(){return BPromise[_0xd6ab('0x57')](_0x18ca0d,function(_0x129da8){return db[_0xd6ab('0x3f')][_0xd6ab('0x58')]({'where':{'UserId':_0x129da8['id'],'MailQueueId':_0x328903['params']['id']},'transaction':_0x5ad77b});});})[_0xd6ab('0x17')](function(){_0x18ca0d['forEach'](function(_0x1ee382){socket[_0xd6ab('0x59')](_0xd6ab('0x5a'),{'UserId':_0x1ee382['id'],'MailQueueId':_0x3c0609['id']});});});});});}})[_0xd6ab('0x17')](respondWithStatusCode(_0x34e9ad,null))['catch'](handleError(_0x34e9ad,null));};exports[_0xd6ab('0x5b')]=function(_0x1cf57b,_0x21fd64){return db[_0xd6ab('0x4d')][_0xd6ab('0x26')]({'where':{'id':_0x1cf57b[_0xd6ab('0x25')][_0xd6ab('0x50')]},'attributes':['id'],'include':[{'model':db[_0xd6ab('0x47')],'as':_0xd6ab('0x51'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd64,null))[_0xd6ab('0x17')](function(_0x422328){var _0x3f9f9e=_[_0xd6ab('0x1e')](_0x422328,'id');var _0x1905db=[];var _0x3c58b6=[];var _0x1b4747=squel['select']();_0x1b4747[_0xd6ab('0x5c')](_0xd6ab('0x5d'))[_0xd6ab('0x5e')](_0xd6ab('0x5f'),'tq')[_0xd6ab('0x60')](_0xd6ab('0x61'),'ut',_0xd6ab('0x62'))[_0xd6ab('0x43')](_0xd6ab('0x63'),_0x1cf57b[_0xd6ab('0x28')]['id']);for(var _0x213874=0x0;_0x213874<_0x422328['length'];_0x213874+=0x1){let _0x552223=_0x422328[_0x213874];for(var _0x577030=0x0;_0x577030<_0x552223[_0xd6ab('0x51')]['length'];_0x577030+=0x1){let _0x59ddf5=_0x552223[_0xd6ab('0x51')][_0x577030];var _0x482aec=_0x1b4747[_0xd6ab('0x64')]();_0x482aec['where'](_0xd6ab('0x65'),_0x59ddf5['id']);_0x3c58b6[_0xd6ab('0x66')](db[_0xd6ab('0x55')]['query'](_0x482aec['toString'](),{'type':db[_0xd6ab('0x55')][_0xd6ab('0x67')][_0xd6ab('0x68')]})[_0xd6ab('0x17')](function(_0x2e1ead){if(_0x2e1ead[_0xd6ab('0x2e')]===0x1){return _0x59ddf5['id'];}else{var _0x34cc70=_[_0xd6ab('0x69')](_[_0xd6ab('0x1e')](_0x2e1ead,'TeamId'),function(_0x25cc76){return _[_0xd6ab('0x6a')](_0x3f9f9e,_0x25cc76);});if(_0x34cc70){return _0x59ddf5['id'];}}}));}}return BPromise[_0xd6ab('0x6b')](_0x3c58b6)[_0xd6ab('0x17')](function(_0x47f1bd){_0x1905db=_(_0x1905db)[_0xd6ab('0x6c')](_0x47f1bd)[_0xd6ab('0x6d')]()['value']();return db[_0xd6ab('0x1f')][_0xd6ab('0x31')]({'where':{'id':_0x1cf57b[_0xd6ab('0x28')]['id']}})[_0xd6ab('0x17')](function(_0x36247c){return db['sequelize'][_0xd6ab('0x56')](function(_0x41b642){return _0x36247c[_0xd6ab('0x5b')](_0x1cf57b['query'][_0xd6ab('0x50')],{'transaction':_0x41b642})['then'](function(){if(!_[_0xd6ab('0x6e')](_0x1905db)){return _0x36247c[_0xd6ab('0x6f')](_0x1905db,{'transaction':_0x41b642});}})['then'](function(){_0x1905db[_0xd6ab('0x70')](function(_0x3318ae){socket[_0xd6ab('0x59')](_0xd6ab('0x71'),{'UserId':_0x3318ae,'MailQueueId':_0x36247c['id']});});});});});});})[_0xd6ab('0x17')](respondWithStatusCode(_0x21fd64,null))[_0xd6ab('0x3b')](handleError(_0x21fd64,null));};exports[_0xd6ab('0x72')]=function(_0xfbe9c8,_0x2f2d5){return db[_0xd6ab('0x1f')][_0xd6ab('0x31')]({'where':{'id':_0xfbe9c8['params']['id']}})['then'](handleEntityNotFound(_0x2f2d5,null))[_0xd6ab('0x17')](function(_0x570c10){if(_0x570c10){return _0x570c10[_0xd6ab('0x72')](_0xfbe9c8[_0xd6ab('0x33')][_0xd6ab('0x50')],_['omit'](_0xfbe9c8['body'],[_0xd6ab('0x50'),'id'])||{})[_0xd6ab('0x73')](function(_0x56620e){for(var _0x3cbbaa=0x0;_0x3cbbaa<_0xfbe9c8[_0xd6ab('0x33')][_0xd6ab('0x50')][_0xd6ab('0x2e')];_0x3cbbaa+=0x1){socket['emit'](_0xd6ab('0x5a'),{'UserId':Number(_0xfbe9c8['body'][_0xd6ab('0x50')][_0x3cbbaa]),'MailQueueId':Number(_0xfbe9c8[_0xd6ab('0x28')]['id'])});}return _0x56620e;});}})[_0xd6ab('0x17')](respondWithResult(_0x2f2d5,null))[_0xd6ab('0x3b')](handleError(_0x2f2d5,null));};exports[_0xd6ab('0x6f')]=function(_0x155a83,_0x5372e3){return db[_0xd6ab('0x1f')][_0xd6ab('0x31')]({'where':{'id':_0x155a83['params']['id']}})['then'](handleEntityNotFound(_0x5372e3,null))[_0xd6ab('0x17')](function(_0x1496aa){if(_0x1496aa){return _0x1496aa[_0xd6ab('0x6f')](_0x155a83[_0xd6ab('0x25')][_0xd6ab('0x50')])['then'](function(){if(_[_0xd6ab('0x74')](_0x155a83[_0xd6ab('0x25')][_0xd6ab('0x50')])){for(var _0x2954d6=0x0;_0x2954d6<_0x155a83['query'][_0xd6ab('0x50')][_0xd6ab('0x2e')];_0x2954d6+=0x1){socket[_0xd6ab('0x59')](_0xd6ab('0x71'),{'UserId':Number(_0x155a83['query'][_0xd6ab('0x50')][_0x2954d6]),'MailQueueId':Number(_0x155a83[_0xd6ab('0x28')]['id'])});}}else{socket[_0xd6ab('0x59')]('userMailQueue:remove',{'UserId':Number(_0x155a83[_0xd6ab('0x25')][_0xd6ab('0x50')]),'MailQueueId':Number(_0x155a83[_0xd6ab('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x5372e3,null))['catch'](handleError(_0x5372e3,null));};exports['getAgents']=function(_0x20a6fd,_0x2f2446){var _0x2794ca={};var _0x24592c={};var _0x1d9b4f;var _0xc82bc1;return db[_0xd6ab('0x1f')]['findOne']({'where':{'id':_0x20a6fd[_0xd6ab('0x28')]['id']}})['then'](handleEntityNotFound(_0x2f2446,null))['then'](function(_0x51276f){if(_0x51276f){_0x1d9b4f=_0x51276f;_0x24592c[_0xd6ab('0x2b')]=_['keys'](db[_0xd6ab('0x47')][_0xd6ab('0x20')]);_0x24592c[_0xd6ab('0x25')]=_[_0xd6ab('0x29')](_0x20a6fd[_0xd6ab('0x25')]);_0x24592c[_0xd6ab('0x44')]=_['intersection'](_0x24592c[_0xd6ab('0x2b')],_0x24592c['query']);_0x2794ca[_0xd6ab('0x2d')]=_['intersection'](_0x24592c[_0xd6ab('0x2b')],qs['fields'](_0x20a6fd[_0xd6ab('0x25')][_0xd6ab('0x2c')]));_0x2794ca[_0xd6ab('0x2d')]=_0x2794ca[_0xd6ab('0x2d')][_0xd6ab('0x2e')]?_0x2794ca[_0xd6ab('0x2d')]:_0x24592c[_0xd6ab('0x2b')];_0x2794ca['order']=qs[_0xd6ab('0x42')](_0x20a6fd[_0xd6ab('0x25')][_0xd6ab('0x42')]);_0x2794ca[_0xd6ab('0x43')]=qs['filters'](_[_0xd6ab('0x75')](_0x20a6fd[_0xd6ab('0x25')],_0x24592c['filters']));if(_0x20a6fd[_0xd6ab('0x25')]['filter']){_0x2794ca['where']=_['merge'](_0x2794ca[_0xd6ab('0x43')],{'$or':_[_0xd6ab('0x1e')](_0x2794ca['attributes'],function(_0x1161aa){var _0x54653d={};_0x54653d[_0x1161aa]={'$like':'%'+_0x20a6fd[_0xd6ab('0x25')]['filter']+'%'};return _0x54653d;})});}_0x2794ca=_[_0xd6ab('0x2f')]({},_0x2794ca,_0x20a6fd[_0xd6ab('0x30')]);return _0x1d9b4f[_0xd6ab('0x76')](_0x2794ca);}})[_0xd6ab('0x17')](function(_0x2ef54e){if(_0x2ef54e){_0xc82bc1=_0x2ef54e[_0xd6ab('0x2e')];if(!_0x20a6fd[_0xd6ab('0x25')][_0xd6ab('0x4e')](_0xd6ab('0x40'))){_0x2794ca[_0xd6ab('0x13')]=qs[_0xd6ab('0x13')](_0x20a6fd[_0xd6ab('0x25')]['limit']);_0x2794ca['offset']=qs[_0xd6ab('0x12')](_0x20a6fd[_0xd6ab('0x25')]['offset']);}return _0x1d9b4f[_0xd6ab('0x76')](_0x2794ca);}})[_0xd6ab('0x17')](function(_0x48949c){if(_0x48949c){return _0x48949c?{'count':_0xc82bc1,'rows':_0x48949c}:null;}})[_0xd6ab('0x17')](respondWithResult(_0x2f2446,null))['catch'](handleError(_0x2f2446,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e4b2eef..ed4798f 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 _0xcb24=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x193860,_0x3a13f0){var _0x4e1927=function(_0x1876de){while(--_0x1876de){_0x193860['push'](_0x193860['shift']());}};_0x4e1927(++_0x3a13f0);}(_0xcb24,0x128));var _0x4cb2=function(_0x20bd30,_0x1621f5){_0x20bd30=_0x20bd30-0x0;var _0x5cf33d=_0xcb24[_0x20bd30];return _0x5cf33d;};'use strict';var EventEmitter=require(_0x4cb2('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x4cb2('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4cb2('0x2')](0x0);var events={'afterCreate':_0x4cb2('0x3'),'afterUpdate':_0x4cb2('0x4'),'afterDestroy':_0x4cb2('0x5')};function emitEvent(_0x4124ab){return function(_0x523d50,_0x186ed0,_0x5348d4){MailQueueEvents[_0x4cb2('0x6')](_0x4124ab+':'+_0x523d50['id'],_0x523d50);MailQueueEvents['emit'](_0x4124ab,_0x523d50);_0x5348d4(null);};}for(var e in events){if(events[_0x4cb2('0x7')](e)){var event=events[e];MailQueue[_0x4cb2('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x67ce=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x67ce,0xdd));var _0xe67c=function(_0x345901,_0x187c05){_0x345901=_0x345901-0x0;var _0xd4fd06=_0x67ce[_0x345901];return _0xd4fd06;};'use strict';var EventEmitter=require(_0xe67c('0x0'));var MailQueue=require(_0xe67c('0x1'))['db'][_0xe67c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe67c('0x3')](0x0);var events={'afterCreate':_0xe67c('0x4'),'afterUpdate':_0xe67c('0x5'),'afterDestroy':_0xe67c('0x6')};function emitEvent(_0x9cd88){return function(_0x211ff9,_0x539174,_0x142fc0){MailQueueEvents[_0xe67c('0x7')](_0x9cd88+':'+_0x211ff9['id'],_0x211ff9);MailQueueEvents[_0xe67c('0x7')](_0x9cd88,_0x211ff9);_0x142fc0(null);};}for(var e in events){if(events[_0xe67c('0x8')](e)){var event=events[e];MailQueue[_0xe67c('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8aa3d43..574b475 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 _0xe82c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','MailQueue','mail_queues','lodash','../../config/logger','api','moment'];(function(_0x2d3d6,_0x558583){var _0xa65858=function(_0x2bdb85){while(--_0x2bdb85){_0x2d3d6['push'](_0x2d3d6['shift']());}};_0xa65858(++_0x558583);}(_0xe82c,0x1d0));var _0xce82=function(_0x1118d4,_0xac036a){_0x1118d4=_0x1118d4-0x0;var _0x3af9f0=_0xe82c[_0x1118d4];return _0x3af9f0;};'use strict';var _=require(_0xce82('0x0'));var util=require('util');var logger=require(_0xce82('0x1'))(_0xce82('0x2'));var moment=require(_0xce82('0x3'));var BPromise=require(_0xce82('0x4'));var rp=require(_0xce82('0x5'));var fs=require('fs');var path=require(_0xce82('0x6'));var rimraf=require(_0xce82('0x7'));var config=require(_0xce82('0x8'));var attributes=require('./mailQueue.attributes');module[_0xce82('0x9')]=function(_0x33352c,_0x414e14){return _0x33352c['define'](_0xce82('0xa'),attributes,{'tableName':_0xce82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc264=['exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','path','rimraf','./mailQueue.attributes'];(function(_0x21d506,_0x391166){var _0x9a21f0=function(_0xd47618){while(--_0xd47618){_0x21d506['push'](_0x21d506['shift']());}};_0x9a21f0(++_0x391166);}(_0xc264,0x72));var _0x4c26=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xc264[_0x25701b];return _0x3a8a2c;};'use strict';var _=require(_0x4c26('0x0'));var util=require(_0x4c26('0x1'));var logger=require(_0x4c26('0x2'))('api');var moment=require(_0x4c26('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c26('0x4'));var rimraf=require(_0x4c26('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c26('0x6'));module[_0x4c26('0x7')]=function(_0x3f7b9e,_0xb3031b){return _0x3f7b9e[_0x4c26('0x8')](_0x4c26('0x9'),attributes,{'tableName':_0x4c26('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 6328d1b..2d84cc1 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 _0xcdd0=['attributes','include','model','map','GetMailQueue','debug','ShowMailQueue','MailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','findAll','options'];(function(_0x4a6507,_0x558cf9){var _0x5efd8e=function(_0x25dc04){while(--_0x25dc04){_0x4a6507['push'](_0x4a6507['shift']());}};_0x5efd8e(++_0x558cf9);}(_0xcdd0,0x169));var _0x0cdd=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xcdd0[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var moment=require(_0x0cdd('0x2'));var BPromise=require(_0x0cdd('0x3'));var rs=require(_0x0cdd('0x4'));var fs=require('fs');var Redis=require(_0x0cdd('0x5'));var db=require(_0x0cdd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cdd('0x7'))('rpc');var config=require(_0x0cdd('0x8'));var jayson=require(_0x0cdd('0x9'));var client=jayson[_0x0cdd('0xa')][_0x0cdd('0xb')]({'port':0x232a});config[_0x0cdd('0xc')]=_[_0x0cdd('0xd')](config[_0x0cdd('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cdd('0xc')]));require('./mailQueue.socket')[_0x0cdd('0xe')](socket);function respondWithRpcPromise(_0x1f490f,_0x5c886c,_0xe61c35){return new BPromise(function(_0x555ec5,_0x2adc6b){return client[_0x0cdd('0xf')](_0x1f490f,_0xe61c35)[_0x0cdd('0x10')](function(_0x19d670){logger['info']('MailQueue,\x20%s,\x20%s',_0x5c886c,_0x0cdd('0x11'));logger['debug'](_0x0cdd('0x12'),_0x5c886c,_0x0cdd('0x11'),JSON[_0x0cdd('0x13')](_0x19d670));if(_0x19d670[_0x0cdd('0x14')]){if(_0x19d670[_0x0cdd('0x14')][_0x0cdd('0x15')]===0x1f4){logger[_0x0cdd('0x14')](_0x0cdd('0x16'),_0x5c886c,_0x19d670[_0x0cdd('0x14')]['message']);return _0x2adc6b(_0x19d670['error']['message']);}logger[_0x0cdd('0x14')](_0x0cdd('0x16'),_0x5c886c,_0x19d670['error'][_0x0cdd('0x17')]);return _0x555ec5(_0x19d670[_0x0cdd('0x14')][_0x0cdd('0x17')]);}else{logger[_0x0cdd('0x18')]('MailQueue,\x20%s,\x20%s',_0x5c886c,_0x0cdd('0x11'));_0x555ec5(_0x19d670[_0x0cdd('0x19')][_0x0cdd('0x17')]);}})[_0x0cdd('0x1a')](function(_0x34150d){logger[_0x0cdd('0x14')](_0x0cdd('0x16'),_0x5c886c,_0x34150d);_0x2adc6b(_0x34150d);});});}exports['GetMailQueue']=function(_0x3c9037){var _0x4e4b2b=this;return new Promise(function(_0x41cc4b,_0x4a5d44){return db['MailQueue'][_0x0cdd('0x1b')]({'raw':_0x3c9037[_0x0cdd('0x1c')]?_0x3c9037[_0x0cdd('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3c9037[_0x0cdd('0x1c')]?_0x3c9037[_0x0cdd('0x1c')]['where']||null:null,'attributes':_0x3c9037[_0x0cdd('0x1c')]?_0x3c9037['options'][_0x0cdd('0x1d')]||null:null,'limit':_0x3c9037[_0x0cdd('0x1c')]?_0x3c9037['options']['limit']||null:null,'include':_0x3c9037['options']?_0x3c9037[_0x0cdd('0x1c')][_0x0cdd('0x1e')]?_['map'](_0x3c9037['options'][_0x0cdd('0x1e')],function(_0x4a1b17){return{'model':db[_0x4a1b17[_0x0cdd('0x1f')]],'as':_0x4a1b17['as'],'attributes':_0x4a1b17[_0x0cdd('0x1d')],'include':_0x4a1b17[_0x0cdd('0x1e')]?_[_0x0cdd('0x20')](_0x4a1b17[_0x0cdd('0x1e')],function(_0x23bc6b){return{'model':db[_0x23bc6b[_0x0cdd('0x1f')]],'as':_0x23bc6b['as'],'attributes':_0x23bc6b['attributes'],'include':_0x23bc6b[_0x0cdd('0x1e')]?_[_0x0cdd('0x20')](_0x23bc6b['include'],function(_0x4ddfb4){return{'model':db[_0x4ddfb4[_0x0cdd('0x1f')]],'as':_0x4ddfb4['as'],'attributes':_0x4ddfb4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0cdd('0x10')](function(_0x211371){logger[_0x0cdd('0x18')](_0x0cdd('0x21'),_0x3c9037);logger[_0x0cdd('0x22')]('GetMailQueue',_0x3c9037,JSON['stringify'](_0x211371));_0x41cc4b(_0x211371);})['catch'](function(_0x3fc5d8){logger[_0x0cdd('0x14')](_0x0cdd('0x21'),_0x3fc5d8['message'],_0x3c9037);_0x4a5d44(_0x4e4b2b[_0x0cdd('0x14')](0x1f4,_0x3fc5d8[_0x0cdd('0x17')]));});});};exports[_0x0cdd('0x23')]=function(_0x295097){var _0x5ae539=this;return new Promise(function(_0x4d1904,_0x587a9d){return db[_0x0cdd('0x24')][_0x0cdd('0x25')]({'raw':_0x295097['options']?_0x295097['options'][_0x0cdd('0x26')]===undefined?!![]:![]:!![],'where':_0x295097['options']?_0x295097[_0x0cdd('0x1c')]['where']||null:null,'attributes':_0x295097['options']?_0x295097['options']['attributes']||null:null,'include':_0x295097[_0x0cdd('0x1c')]?_0x295097['options']['include']?_[_0x0cdd('0x20')](_0x295097[_0x0cdd('0x1c')][_0x0cdd('0x1e')],function(_0xcca16b){return{'model':db[_0xcca16b['model']],'as':_0xcca16b['as'],'attributes':_0xcca16b[_0x0cdd('0x1d')],'include':_0xcca16b[_0x0cdd('0x1e')]?_[_0x0cdd('0x20')](_0xcca16b[_0x0cdd('0x1e')],function(_0x25baf8){return{'model':db[_0x25baf8[_0x0cdd('0x1f')]],'as':_0x25baf8['as'],'attributes':_0x25baf8[_0x0cdd('0x1d')],'include':_0x25baf8[_0x0cdd('0x1e')]?_[_0x0cdd('0x20')](_0x25baf8[_0x0cdd('0x1e')],function(_0x1379b0){return{'model':db[_0x1379b0[_0x0cdd('0x1f')]],'as':_0x1379b0['as'],'attributes':_0x1379b0[_0x0cdd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eb4dd){logger[_0x0cdd('0x18')](_0x0cdd('0x23'),_0x295097);logger[_0x0cdd('0x22')]('ShowMailQueue',_0x295097,JSON[_0x0cdd('0x13')](_0x2eb4dd));_0x4d1904(_0x2eb4dd);})[_0x0cdd('0x1a')](function(_0x4e27e7){logger[_0x0cdd('0x14')]('ShowMailQueue',_0x4e27e7[_0x0cdd('0x17')],_0x295097);_0x587a9d(_0x5ae539['error'](0x1f4,_0x4e27e7[_0x0cdd('0x17')]));});});}; \ No newline at end of file +var _0xc6d8=['register','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','findAll','options','where','limit','include','model','attributes','map','ShowMailQueue','MailQueue','raw','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x245bf1,_0x444585){var _0x158c35=function(_0x27a837){while(--_0x27a837){_0x245bf1['push'](_0x245bf1['shift']());}};_0x158c35(++_0x444585);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x20d290,_0x40fc11){_0x20d290=_0x20d290-0x0;var _0x2bfa8f=_0xc6d8[_0x20d290];return _0x2bfa8f;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});config[_0x8c6d('0x9')]=_[_0x8c6d('0xa')](config['redis'],{'host':_0x8c6d('0xb'),'port':0x18eb});var socket=require(_0x8c6d('0xc'))(new Redis(config[_0x8c6d('0x9')]));require('./mailQueue.socket')[_0x8c6d('0xd')](socket);function respondWithRpcPromise(_0x1ec65c,_0x45e50e,_0x354fd5){return new BPromise(function(_0x426a82,_0x43a7ab){return client[_0x8c6d('0xe')](_0x1ec65c,_0x354fd5)[_0x8c6d('0xf')](function(_0x50af75){logger[_0x8c6d('0x10')]('MailQueue,\x20%s,\x20%s',_0x45e50e,'request\x20sent');logger[_0x8c6d('0x11')](_0x8c6d('0x12'),_0x45e50e,_0x8c6d('0x13'),JSON[_0x8c6d('0x14')](_0x50af75));if(_0x50af75[_0x8c6d('0x15')]){if(_0x50af75[_0x8c6d('0x15')][_0x8c6d('0x16')]===0x1f4){logger[_0x8c6d('0x15')](_0x8c6d('0x17'),_0x45e50e,_0x50af75[_0x8c6d('0x15')]['message']);return _0x43a7ab(_0x50af75[_0x8c6d('0x15')]['message']);}logger[_0x8c6d('0x15')]('MailQueue,\x20%s,\x20%s',_0x45e50e,_0x50af75[_0x8c6d('0x15')][_0x8c6d('0x18')]);return _0x426a82(_0x50af75['error'][_0x8c6d('0x18')]);}else{logger[_0x8c6d('0x10')]('MailQueue,\x20%s,\x20%s',_0x45e50e,_0x8c6d('0x13'));_0x426a82(_0x50af75['result']['message']);}})[_0x8c6d('0x19')](function(_0x5c962e){logger[_0x8c6d('0x15')](_0x8c6d('0x17'),_0x45e50e,_0x5c962e);_0x43a7ab(_0x5c962e);});});}exports[_0x8c6d('0x1a')]=function(_0xe58632){var _0x5ac817=this;return new Promise(function(_0x56854a,_0x5512be){return db['MailQueue'][_0x8c6d('0x1b')]({'raw':_0xe58632['options']?_0xe58632[_0x8c6d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xe58632['options']?_0xe58632[_0x8c6d('0x1c')][_0x8c6d('0x1d')]||null:null,'attributes':_0xe58632['options']?_0xe58632['options']['attributes']||null:null,'limit':_0xe58632['options']?_0xe58632[_0x8c6d('0x1c')][_0x8c6d('0x1e')]||null:null,'include':_0xe58632[_0x8c6d('0x1c')]?_0xe58632['options'][_0x8c6d('0x1f')]?_['map'](_0xe58632[_0x8c6d('0x1c')]['include'],function(_0x23c893){return{'model':db[_0x23c893[_0x8c6d('0x20')]],'as':_0x23c893['as'],'attributes':_0x23c893[_0x8c6d('0x21')],'include':_0x23c893[_0x8c6d('0x1f')]?_[_0x8c6d('0x22')](_0x23c893[_0x8c6d('0x1f')],function(_0x9c269d){return{'model':db[_0x9c269d[_0x8c6d('0x20')]],'as':_0x9c269d['as'],'attributes':_0x9c269d[_0x8c6d('0x21')],'include':_0x9c269d['include']?_['map'](_0x9c269d[_0x8c6d('0x1f')],function(_0x93a094){return{'model':db[_0x93a094[_0x8c6d('0x20')]],'as':_0x93a094['as'],'attributes':_0x93a094[_0x8c6d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0xf')](function(_0x316ca7){logger[_0x8c6d('0x10')](_0x8c6d('0x1a'),_0xe58632);logger[_0x8c6d('0x11')](_0x8c6d('0x1a'),_0xe58632,JSON[_0x8c6d('0x14')](_0x316ca7));_0x56854a(_0x316ca7);})[_0x8c6d('0x19')](function(_0x4e5203){logger[_0x8c6d('0x15')](_0x8c6d('0x1a'),_0x4e5203[_0x8c6d('0x18')],_0xe58632);_0x5512be(_0x5ac817[_0x8c6d('0x15')](0x1f4,_0x4e5203[_0x8c6d('0x18')]));});});};exports[_0x8c6d('0x23')]=function(_0x1383df){var _0x1857f9=this;return new Promise(function(_0x247448,_0x55cc8e){return db[_0x8c6d('0x24')]['find']({'raw':_0x1383df[_0x8c6d('0x1c')]?_0x1383df[_0x8c6d('0x1c')][_0x8c6d('0x25')]===undefined?!![]:![]:!![],'where':_0x1383df[_0x8c6d('0x1c')]?_0x1383df[_0x8c6d('0x1c')][_0x8c6d('0x1d')]||null:null,'attributes':_0x1383df['options']?_0x1383df['options'][_0x8c6d('0x21')]||null:null,'include':_0x1383df[_0x8c6d('0x1c')]?_0x1383df[_0x8c6d('0x1c')][_0x8c6d('0x1f')]?_['map'](_0x1383df[_0x8c6d('0x1c')][_0x8c6d('0x1f')],function(_0xdc33f5){return{'model':db[_0xdc33f5[_0x8c6d('0x20')]],'as':_0xdc33f5['as'],'attributes':_0xdc33f5[_0x8c6d('0x21')],'include':_0xdc33f5[_0x8c6d('0x1f')]?_['map'](_0xdc33f5[_0x8c6d('0x1f')],function(_0x2d3a36){return{'model':db[_0x2d3a36[_0x8c6d('0x20')]],'as':_0x2d3a36['as'],'attributes':_0x2d3a36[_0x8c6d('0x21')],'include':_0x2d3a36[_0x8c6d('0x1f')]?_[_0x8c6d('0x22')](_0x2d3a36[_0x8c6d('0x1f')],function(_0x301332){return{'model':db[_0x301332[_0x8c6d('0x20')]],'as':_0x301332['as'],'attributes':_0x301332[_0x8c6d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0xf')](function(_0x3254dd){logger['info'](_0x8c6d('0x23'),_0x1383df);logger[_0x8c6d('0x11')](_0x8c6d('0x23'),_0x1383df,JSON[_0x8c6d('0x14')](_0x3254dd));_0x247448(_0x3254dd);})[_0x8c6d('0x19')](function(_0x4e7cb7){logger[_0x8c6d('0x15')](_0x8c6d('0x23'),_0x4e7cb7['message'],_0x1383df);_0x55cc8e(_0x1857f9[_0x8c6d('0x15')](0x1f4,_0x4e7cb7[_0x8c6d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 2493a97..3296891 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 _0xfa28=['remove','update','emit','removeListener','length','mailQueue:','./mailQueue.events','save'];(function(_0x47f1e5,_0x199ebe){var _0x49e79e=function(_0x1ea8d5){while(--_0x1ea8d5){_0x47f1e5['push'](_0x47f1e5['shift']());}};_0x49e79e(++_0x199ebe);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xfa28[_0x13b02f];return _0x12e9a6;};'use strict';var MailQueueEvents=require(_0x8fa2('0x0'));var events=[_0x8fa2('0x1'),_0x8fa2('0x2'),_0x8fa2('0x3')];function createListener(_0x677728,_0x41c243){return function(_0x11fb52){_0x41c243[_0x8fa2('0x4')](_0x677728,_0x11fb52);};}function removeListener(_0x5dbd5d,_0x5facce){return function(){MailQueueEvents[_0x8fa2('0x5')](_0x5dbd5d,_0x5facce);};}exports['register']=function(_0x48263e){for(var _0x4df001=0x0,_0x4f3f6e=events[_0x8fa2('0x6')];_0x4df001<_0x4f3f6e;_0x4df001++){var _0x1035b5=events[_0x4df001];var _0x36c734=createListener(_0x8fa2('0x7')+_0x1035b5,_0x48263e);MailQueueEvents['on'](_0x1035b5,_0x36c734);}}; \ No newline at end of file +var _0xecfa=['mailQueue:','./mailQueue.events','save','update','emit','removeListener','length'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xecfa,0x8d));var _0xaecf=function(_0x1e244c,_0x1c0328){_0x1e244c=_0x1e244c-0x0;var _0x265534=_0xecfa[_0x1e244c];return _0x265534;};'use strict';var MailQueueEvents=require(_0xaecf('0x0'));var events=[_0xaecf('0x1'),'remove',_0xaecf('0x2')];function createListener(_0x5d9e9e,_0x277121){return function(_0x53cc9b){_0x277121[_0xaecf('0x3')](_0x5d9e9e,_0x53cc9b);};}function removeListener(_0x37093f,_0x2bd50e){return function(){MailQueueEvents[_0xaecf('0x4')](_0x37093f,_0x2bd50e);};}exports['register']=function(_0x1b1139){for(var _0x514621=0x0,_0x329efa=events[_0xaecf('0x5')];_0x514621<_0x329efa;_0x514621++){var _0x1e87ca=events[_0x514621];var _0x26a691=createListener(_0xaecf('0x6')+_0x1e87ca,_0x1b1139);MailQueueEvents['on'](_0x1e87ca,_0x26a691);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 9b8dda6..71224cd 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 _0xa2d6=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy','exports'];(function(_0x1c2ea4,_0x16ac04){var _0x575866=function(_0x47272b){while(--_0x47272b){_0x1c2ea4['push'](_0x1c2ea4['shift']());}};_0x575866(++_0x16ac04);}(_0xa2d6,0x1cc));var _0x6a2d=function(_0x2dbbe2,_0x11424b){_0x2dbbe2=_0x2dbbe2-0x0;var _0x2e3147=_0xa2d6[_0x2dbbe2];return _0x2e3147;};'use strict';var multer=require(_0x6a2d('0x0'));var util=require(_0x6a2d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a2d('0x2'));var router=express[_0x6a2d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6a2d('0x4'));var interaction=require(_0x6a2d('0x5'));var config=require(_0x6a2d('0x6'));var controller=require(_0x6a2d('0x7'));router[_0x6a2d('0x8')]('/',auth[_0x6a2d('0x9')](),controller[_0x6a2d('0xa')]);router[_0x6a2d('0x8')](_0x6a2d('0xb'),auth[_0x6a2d('0x9')](),controller[_0x6a2d('0xc')]);router[_0x6a2d('0x8')]('/:id',auth[_0x6a2d('0x9')](),controller[_0x6a2d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6a2d('0xe')](_0x6a2d('0xf'),auth[_0x6a2d('0x9')](),controller[_0x6a2d('0x10')]);router[_0x6a2d('0x11')](_0x6a2d('0xf'),auth['isAuthenticated'](),controller[_0x6a2d('0x12')]);module[_0x6a2d('0x13')]=router; \ No newline at end of file +var _0x09ad=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','index'];(function(_0x1a93a5,_0x13f256){var _0x4893a2=function(_0x4a176c){while(--_0x4a176c){_0x1a93a5['push'](_0x1a93a5['shift']());}};_0x4893a2(++_0x13f256);}(_0x09ad,0xc4));var _0xd09a=function(_0x2cc37d,_0x242f04){_0x2cc37d=_0x2cc37d-0x0;var _0x317c8f=_0x09ad[_0x2cc37d];return _0x317c8f;};'use strict';var multer=require(_0xd09a('0x0'));var util=require(_0xd09a('0x1'));var path=require(_0xd09a('0x2'));var timeout=require(_0xd09a('0x3'));var express=require(_0xd09a('0x4'));var router=express[_0xd09a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd09a('0x6'));var interaction=require(_0xd09a('0x7'));var config=require('../../config/environment');var controller=require(_0xd09a('0x8'));router[_0xd09a('0x9')]('/',auth['isAuthenticated'](),controller[_0xd09a('0xa')]);router['get'](_0xd09a('0xb'),auth[_0xd09a('0xc')](),controller[_0xd09a('0xd')]);router[_0xd09a('0x9')](_0xd09a('0xe'),auth[_0xd09a('0xc')](),controller[_0xd09a('0xf')]);router[_0xd09a('0x10')]('/',auth[_0xd09a('0xc')](),controller[_0xd09a('0x11')]);router[_0xd09a('0x12')](_0xd09a('0xe'),auth[_0xd09a('0xc')](),controller[_0xd09a('0x13')]);router[_0xd09a('0x14')](_0xd09a('0xe'),auth[_0xd09a('0xc')](),controller[_0xd09a('0x15')]);module[_0xd09a('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9cdce61..38e60f2 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 _0x12b6=['sequelize','exports','STRING','DATE','moment'];(function(_0x3daab5,_0x4c82c0){var _0x5c9961=function(_0xd26f32){while(--_0xd26f32){_0x3daab5['push'](_0x3daab5['shift']());}};_0x5c9961(++_0x4c82c0);}(_0x12b6,0x1e4));var _0x612b=function(_0x2186e4,_0x44ed5c){_0x2186e4=_0x2186e4-0x0;var _0x1d8c88=_0x12b6[_0x2186e4];return _0x1d8c88;};'use strict';var moment=require(_0x612b('0x0'));var Sequelize=require(_0x612b('0x1'));module[_0x612b('0x2')]={'uniqueid':{'type':Sequelize[_0x612b('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x612b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x612b('0x4')]},'exitAt':{'type':Sequelize[_0x612b('0x4')]},'reason':{'type':Sequelize[_0x612b('0x3')]}}; \ No newline at end of file +var _0x4b12=['STRING','DATE','moment','sequelize'];(function(_0xa5741d,_0x33d1ec){var _0x1fe4ea=function(_0x210b82){while(--_0x210b82){_0xa5741d['push'](_0xa5741d['shift']());}};_0x1fe4ea(++_0x33d1ec);}(_0x4b12,0x14a));var _0x24b1=function(_0x304c74,_0x2bed50){_0x304c74=_0x304c74-0x0;var _0x29d450=_0x4b12[_0x304c74];return _0x29d450;};'use strict';var moment=require(_0x24b1('0x0'));var Sequelize=require(_0x24b1('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x24b1('0x2')]},'joinAt':{'type':Sequelize[_0x24b1('0x3')]},'leaveAt':{'type':Sequelize[_0x24b1('0x3')]},'acceptAt':{'type':Sequelize[_0x24b1('0x3')]},'exitAt':{'type':Sequelize[_0x24b1('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c5d6a34..cd0e0e3 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 _0x958a=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x958a,0x128));var _0xa958=function(_0x111809,_0x54476c){_0x111809=_0x111809-0x0;var _0xf02ccc=_0x958a[_0x111809];return _0xf02ccc;};'use strict';var emlformat=require(_0xa958('0x0'));var rimraf=require(_0xa958('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa958('0x2'));var rp=require(_0xa958('0x3'));var moment=require(_0xa958('0x4'));var BPromise=require(_0xa958('0x5'));var Mustache=require(_0xa958('0x6'));var util=require('util');var path=require(_0xa958('0x7'));var sox=require('sox');var csv=require(_0xa958('0x8'));var ejs=require(_0xa958('0x9'));var fs=require('fs');var fs_extra=require(_0xa958('0xa'));var _=require(_0xa958('0xb'));var squel=require(_0xa958('0xc'));var crypto=require(_0xa958('0xd'));var jsforce=require(_0xa958('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa958('0xf'));var Papa=require(_0xa958('0x10'));var Redis=require(_0xa958('0x11'));var authService=require(_0xa958('0x12'));var qs=require(_0xa958('0x13'));var as=require(_0xa958('0x14'));var hardwareService=require(_0xa958('0x15'));var logger=require(_0xa958('0x16'))(_0xa958('0x17'));var utils=require(_0xa958('0x18'));var config=require(_0xa958('0x19'));var licenseUtil=require(_0xa958('0x1a'));var db=require(_0xa958('0x1b'))['db'];function respondWithStatusCode(_0x53bf27,_0x5063ae){_0x5063ae=_0x5063ae||0xcc;return function(_0x5bcc66){if(_0x5bcc66){return _0x53bf27[_0xa958('0x1c')](_0x5063ae);}return _0x53bf27[_0xa958('0x1d')](_0x5063ae)[_0xa958('0x1e')]();};}function respondWithResult(_0x591d4d,_0x3ebc66){_0x3ebc66=_0x3ebc66||0xc8;return function(_0x54c439){if(_0x54c439){return _0x591d4d['status'](_0x3ebc66)['json'](_0x54c439);}};}function respondWithFilteredResult(_0x1fe41e,_0x15fca8){return function(_0xb90ac6){if(_0xb90ac6){var _0x6a81c7=typeof _0x15fca8[_0xa958('0x1f')]===_0xa958('0x20')&&typeof _0x15fca8[_0xa958('0x21')]===_0xa958('0x20');var _0x4d836f=_0xb90ac6[_0xa958('0x22')];var _0x4eadc9=_0x6a81c7?0x0:_0x15fca8[_0xa958('0x1f')];var _0x70d13e=_0x6a81c7?_0xb90ac6['count']:_0x15fca8[_0xa958('0x1f')]+_0x15fca8[_0xa958('0x21')];var _0x47636f;if(_0x70d13e>=_0x4d836f){_0x70d13e=_0x4d836f;_0x47636f=0xc8;}else{_0x47636f=0xce;}_0x1fe41e[_0xa958('0x1d')](_0x47636f);return _0x1fe41e[_0xa958('0x23')](_0xa958('0x24'),_0x4eadc9+'-'+_0x70d13e+'/'+_0x4d836f)['json'](_0xb90ac6);}return null;};}function patchUpdates(_0x4a90c2){return function(_0x373661){try{jsonpatch[_0xa958('0x25')](_0x373661,_0x4a90c2,!![]);}catch(_0x16c0be){return BPromise['reject'](_0x16c0be);}return _0x373661[_0xa958('0x26')]();};}function saveUpdates(_0x383aa3,_0x5c091a){return function(_0x28cf12){if(_0x28cf12){return _0x28cf12[_0xa958('0x27')](_0x383aa3)['then'](function(_0x5c5a2b){return _0x5c5a2b;});}return null;};}function removeEntity(_0x201ed3,_0x40b51e){return function(_0x50b3c3){if(_0x50b3c3){return _0x50b3c3[_0xa958('0x28')]()[_0xa958('0x29')](function(){_0x201ed3[_0xa958('0x1d')](0xcc)[_0xa958('0x1e')]();});}};}function handleEntityNotFound(_0x16b04a,_0xf1436e){return function(_0x50fdb1){if(!_0x50fdb1){_0x16b04a[_0xa958('0x1c')](0x194);}return _0x50fdb1;};}function handleError(_0x48ef34,_0x43df63){_0x43df63=_0x43df63||0x1f4;return function(_0x3c2ea3){logger[_0xa958('0x2a')](_0x3c2ea3[_0xa958('0x2b')]);if(_0x3c2ea3[_0xa958('0x2c')]){delete _0x3c2ea3[_0xa958('0x2c')];}_0x48ef34[_0xa958('0x1d')](_0x43df63)[_0xa958('0x2d')](_0x3c2ea3);};}exports[_0xa958('0x2e')]=function(_0x404d07,_0x4c4c37){var _0x47895c={},_0xd2fcc9={},_0x4ef4f6={'count':0x0,'rows':[]};var _0x1febd2=_[_0xa958('0x2f')](db['MailQueueReport'][_0xa958('0x30')],function(_0x3d4711){return{'name':_0x3d4711[_0xa958('0x31')],'type':_0x3d4711[_0xa958('0x32')][_0xa958('0x33')]};});_0xd2fcc9['model']=_['map'](_0x1febd2,_0xa958('0x2c'));_0xd2fcc9['query']=_['keys'](_0x404d07[_0xa958('0x34')]);_0xd2fcc9[_0xa958('0x35')]=_[_0xa958('0x36')](_0xd2fcc9[_0xa958('0x37')],_0xd2fcc9[_0xa958('0x34')]);_0x47895c[_0xa958('0x38')]=_['intersection'](_0xd2fcc9[_0xa958('0x37')],qs['fields'](_0x404d07['query'][_0xa958('0x39')]));_0x47895c[_0xa958('0x38')]=_0x47895c[_0xa958('0x38')][_0xa958('0x3a')]?_0x47895c[_0xa958('0x38')]:_0xd2fcc9[_0xa958('0x37')];if(!_0x404d07[_0xa958('0x34')][_0xa958('0x3b')]('nolimit')){_0x47895c['limit']=qs[_0xa958('0x21')](_0x404d07[_0xa958('0x34')][_0xa958('0x21')]);_0x47895c[_0xa958('0x1f')]=qs[_0xa958('0x1f')](_0x404d07['query'][_0xa958('0x1f')]);}_0x47895c[_0xa958('0x3c')]=qs[_0xa958('0x3d')](_0x404d07[_0xa958('0x34')]['sort']);_0x47895c[_0xa958('0x3e')]=qs[_0xa958('0x35')](_[_0xa958('0x3f')](_0x404d07[_0xa958('0x34')],_0xd2fcc9[_0xa958('0x35')]),_0x1febd2);if(_0x404d07['query'][_0xa958('0x40')]){_0x47895c[_0xa958('0x3e')]=_[_0xa958('0x41')](_0x47895c[_0xa958('0x3e')],{'$or':_[_0xa958('0x2f')](_0x1febd2,function(_0x45603f){if(_0x45603f[_0xa958('0x32')]!==_0xa958('0x42')){var _0x2378df={};_0x2378df[_0x45603f[_0xa958('0x2c')]]={'$like':'%'+_0x404d07['query'][_0xa958('0x40')]+'%'};return _0x2378df;}})});}_0x47895c=_[_0xa958('0x41')]({},_0x47895c,_0x404d07[_0xa958('0x43')]);var _0x5d5ae1={'where':_0x47895c[_0xa958('0x3e')]};return db[_0xa958('0x44')]['count'](_0x5d5ae1)['then'](function(_0x53710e){_0x4ef4f6['count']=_0x53710e;if(_0x404d07[_0xa958('0x34')]['includeAll']){_0x47895c[_0xa958('0x45')]=[{'all':!![]}];}return db['MailQueueReport'][_0xa958('0x46')](_0x47895c);})[_0xa958('0x29')](function(_0x44fa44){_0x4ef4f6[_0xa958('0x47')]=_0x44fa44;return _0x4ef4f6;})[_0xa958('0x29')](respondWithFilteredResult(_0x4c4c37,_0x47895c))[_0xa958('0x48')](handleError(_0x4c4c37,null));};exports[_0xa958('0x49')]=function(_0x18f110,_0x517319){var _0x10e4ee={'raw':!![],'where':{'id':_0x18f110[_0xa958('0x4a')]['id']}},_0x38dfb4={};_0x38dfb4['model']=_['keys'](db['MailQueueReport'][_0xa958('0x30')]);_0x38dfb4[_0xa958('0x34')]=_[_0xa958('0x4b')](_0x18f110[_0xa958('0x34')]);_0x38dfb4[_0xa958('0x35')]=_['intersection'](_0x38dfb4[_0xa958('0x37')],_0x38dfb4[_0xa958('0x34')]);_0x10e4ee[_0xa958('0x38')]=_[_0xa958('0x36')](_0x38dfb4[_0xa958('0x37')],qs[_0xa958('0x39')](_0x18f110[_0xa958('0x34')][_0xa958('0x39')]));_0x10e4ee[_0xa958('0x38')]=_0x10e4ee[_0xa958('0x38')][_0xa958('0x3a')]?_0x10e4ee[_0xa958('0x38')]:_0x38dfb4[_0xa958('0x37')];if(_0x18f110[_0xa958('0x34')][_0xa958('0x4c')]){_0x10e4ee[_0xa958('0x45')]=[{'all':!![]}];}_0x10e4ee=_[_0xa958('0x41')]({},_0x10e4ee,_0x18f110['options']);return db['MailQueueReport']['find'](_0x10e4ee)[_0xa958('0x29')](handleEntityNotFound(_0x517319,null))[_0xa958('0x29')](respondWithResult(_0x517319,null))[_0xa958('0x48')](handleError(_0x517319,null));};exports[_0xa958('0x4d')]=function(_0x55ab45,_0x34faa2){return db[_0xa958('0x44')][_0xa958('0x4d')](_0x55ab45[_0xa958('0x4e')],{})[_0xa958('0x29')](respondWithResult(_0x34faa2,0xc9))['catch'](handleError(_0x34faa2,null));};exports[_0xa958('0x27')]=function(_0x2bbb2e,_0x3f8407){if(_0x2bbb2e['body']['id']){delete _0x2bbb2e[_0xa958('0x4e')]['id'];}return db['MailQueueReport'][_0xa958('0x4f')]({'where':{'id':_0x2bbb2e[_0xa958('0x4a')]['id']}})[_0xa958('0x29')](handleEntityNotFound(_0x3f8407,null))['then'](saveUpdates(_0x2bbb2e[_0xa958('0x4e')],null))['then'](respondWithResult(_0x3f8407,null))[_0xa958('0x48')](handleError(_0x3f8407,null));};exports[_0xa958('0x28')]=function(_0x85fc0d,_0x402d0a){return db[_0xa958('0x44')]['find']({'where':{'id':_0x85fc0d[_0xa958('0x4a')]['id']}})['then'](handleEntityNotFound(_0x402d0a,null))[_0xa958('0x29')](removeEntity(_0x402d0a,null))[_0xa958('0x48')](handleError(_0x402d0a,null));};exports['describe']=function(_0x17e4e7,_0x4f0a27){return db[_0xa958('0x44')][_0xa958('0x50')]()[_0xa958('0x29')](respondWithResult(_0x4f0a27,null))[_0xa958('0x48')](handleError(_0x4f0a27,null));}; \ No newline at end of file +var _0x958a=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x958a,0x128));var _0xa958=function(_0x2e300f,_0x5beb5a){_0x2e300f=_0x2e300f-0x0;var _0xb1f156=_0x958a[_0x2e300f];return _0xb1f156;};'use strict';var emlformat=require(_0xa958('0x0'));var rimraf=require(_0xa958('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa958('0x2'));var rp=require(_0xa958('0x3'));var moment=require(_0xa958('0x4'));var BPromise=require(_0xa958('0x5'));var Mustache=require(_0xa958('0x6'));var util=require('util');var path=require(_0xa958('0x7'));var sox=require('sox');var csv=require(_0xa958('0x8'));var ejs=require(_0xa958('0x9'));var fs=require('fs');var fs_extra=require(_0xa958('0xa'));var _=require(_0xa958('0xb'));var squel=require(_0xa958('0xc'));var crypto=require(_0xa958('0xd'));var jsforce=require(_0xa958('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa958('0xf'));var Papa=require(_0xa958('0x10'));var Redis=require(_0xa958('0x11'));var authService=require(_0xa958('0x12'));var qs=require(_0xa958('0x13'));var as=require(_0xa958('0x14'));var hardwareService=require(_0xa958('0x15'));var logger=require(_0xa958('0x16'))(_0xa958('0x17'));var utils=require(_0xa958('0x18'));var config=require(_0xa958('0x19'));var licenseUtil=require(_0xa958('0x1a'));var db=require(_0xa958('0x1b'))['db'];function respondWithStatusCode(_0x53bf27,_0x5063ae){_0x5063ae=_0x5063ae||0xcc;return function(_0x5bcc66){if(_0x5bcc66){return _0x53bf27[_0xa958('0x1c')](_0x5063ae);}return _0x53bf27[_0xa958('0x1d')](_0x5063ae)[_0xa958('0x1e')]();};}function respondWithResult(_0x591d4d,_0x3ebc66){_0x3ebc66=_0x3ebc66||0xc8;return function(_0x54c439){if(_0x54c439){return _0x591d4d['status'](_0x3ebc66)['json'](_0x54c439);}};}function respondWithFilteredResult(_0x1fe41e,_0x15fca8){return function(_0xb90ac6){if(_0xb90ac6){var _0x6a81c7=typeof _0x15fca8[_0xa958('0x1f')]===_0xa958('0x20')&&typeof _0x15fca8[_0xa958('0x21')]===_0xa958('0x20');var _0x4d836f=_0xb90ac6[_0xa958('0x22')];var _0x4eadc9=_0x6a81c7?0x0:_0x15fca8[_0xa958('0x1f')];var _0x70d13e=_0x6a81c7?_0xb90ac6['count']:_0x15fca8[_0xa958('0x1f')]+_0x15fca8[_0xa958('0x21')];var _0x47636f;if(_0x70d13e>=_0x4d836f){_0x70d13e=_0x4d836f;_0x47636f=0xc8;}else{_0x47636f=0xce;}_0x1fe41e[_0xa958('0x1d')](_0x47636f);return _0x1fe41e[_0xa958('0x23')](_0xa958('0x24'),_0x4eadc9+'-'+_0x70d13e+'/'+_0x4d836f)['json'](_0xb90ac6);}return null;};}function patchUpdates(_0x4a90c2){return function(_0x373661){try{jsonpatch[_0xa958('0x25')](_0x373661,_0x4a90c2,!![]);}catch(_0x16c0be){return BPromise['reject'](_0x16c0be);}return _0x373661[_0xa958('0x26')]();};}function saveUpdates(_0x383aa3,_0x5c091a){return function(_0x28cf12){if(_0x28cf12){return _0x28cf12[_0xa958('0x27')](_0x383aa3)['then'](function(_0x5c5a2b){return _0x5c5a2b;});}return null;};}function removeEntity(_0x201ed3,_0x40b51e){return function(_0x50b3c3){if(_0x50b3c3){return _0x50b3c3[_0xa958('0x28')]()[_0xa958('0x29')](function(){_0x201ed3[_0xa958('0x1d')](0xcc)[_0xa958('0x1e')]();});}};}function handleEntityNotFound(_0x16b04a,_0xf1436e){return function(_0x50fdb1){if(!_0x50fdb1){_0x16b04a[_0xa958('0x1c')](0x194);}return _0x50fdb1;};}function handleError(_0x48ef34,_0x43df63){_0x43df63=_0x43df63||0x1f4;return function(_0x3c2ea3){logger[_0xa958('0x2a')](_0x3c2ea3[_0xa958('0x2b')]);if(_0x3c2ea3[_0xa958('0x2c')]){delete _0x3c2ea3[_0xa958('0x2c')];}_0x48ef34[_0xa958('0x1d')](_0x43df63)[_0xa958('0x2d')](_0x3c2ea3);};}exports[_0xa958('0x2e')]=function(_0x404d07,_0x4c4c37){var _0x47895c={},_0xd2fcc9={},_0x4ef4f6={'count':0x0,'rows':[]};var _0x1febd2=_[_0xa958('0x2f')](db['MailQueueReport'][_0xa958('0x30')],function(_0x3d4711){return{'name':_0x3d4711[_0xa958('0x31')],'type':_0x3d4711[_0xa958('0x32')][_0xa958('0x33')]};});_0xd2fcc9['model']=_['map'](_0x1febd2,_0xa958('0x2c'));_0xd2fcc9['query']=_['keys'](_0x404d07[_0xa958('0x34')]);_0xd2fcc9[_0xa958('0x35')]=_[_0xa958('0x36')](_0xd2fcc9[_0xa958('0x37')],_0xd2fcc9[_0xa958('0x34')]);_0x47895c[_0xa958('0x38')]=_['intersection'](_0xd2fcc9[_0xa958('0x37')],qs['fields'](_0x404d07['query'][_0xa958('0x39')]));_0x47895c[_0xa958('0x38')]=_0x47895c[_0xa958('0x38')][_0xa958('0x3a')]?_0x47895c[_0xa958('0x38')]:_0xd2fcc9[_0xa958('0x37')];if(!_0x404d07[_0xa958('0x34')][_0xa958('0x3b')]('nolimit')){_0x47895c['limit']=qs[_0xa958('0x21')](_0x404d07[_0xa958('0x34')][_0xa958('0x21')]);_0x47895c[_0xa958('0x1f')]=qs[_0xa958('0x1f')](_0x404d07['query'][_0xa958('0x1f')]);}_0x47895c[_0xa958('0x3c')]=qs[_0xa958('0x3d')](_0x404d07[_0xa958('0x34')]['sort']);_0x47895c[_0xa958('0x3e')]=qs[_0xa958('0x35')](_[_0xa958('0x3f')](_0x404d07[_0xa958('0x34')],_0xd2fcc9[_0xa958('0x35')]),_0x1febd2);if(_0x404d07['query'][_0xa958('0x40')]){_0x47895c[_0xa958('0x3e')]=_[_0xa958('0x41')](_0x47895c[_0xa958('0x3e')],{'$or':_[_0xa958('0x2f')](_0x1febd2,function(_0x45603f){if(_0x45603f[_0xa958('0x32')]!==_0xa958('0x42')){var _0x2378df={};_0x2378df[_0x45603f[_0xa958('0x2c')]]={'$like':'%'+_0x404d07['query'][_0xa958('0x40')]+'%'};return _0x2378df;}})});}_0x47895c=_[_0xa958('0x41')]({},_0x47895c,_0x404d07[_0xa958('0x43')]);var _0x5d5ae1={'where':_0x47895c[_0xa958('0x3e')]};return db[_0xa958('0x44')]['count'](_0x5d5ae1)['then'](function(_0x53710e){_0x4ef4f6['count']=_0x53710e;if(_0x404d07[_0xa958('0x34')]['includeAll']){_0x47895c[_0xa958('0x45')]=[{'all':!![]}];}return db['MailQueueReport'][_0xa958('0x46')](_0x47895c);})[_0xa958('0x29')](function(_0x44fa44){_0x4ef4f6[_0xa958('0x47')]=_0x44fa44;return _0x4ef4f6;})[_0xa958('0x29')](respondWithFilteredResult(_0x4c4c37,_0x47895c))[_0xa958('0x48')](handleError(_0x4c4c37,null));};exports[_0xa958('0x49')]=function(_0x18f110,_0x517319){var _0x10e4ee={'raw':!![],'where':{'id':_0x18f110[_0xa958('0x4a')]['id']}},_0x38dfb4={};_0x38dfb4['model']=_['keys'](db['MailQueueReport'][_0xa958('0x30')]);_0x38dfb4[_0xa958('0x34')]=_[_0xa958('0x4b')](_0x18f110[_0xa958('0x34')]);_0x38dfb4[_0xa958('0x35')]=_['intersection'](_0x38dfb4[_0xa958('0x37')],_0x38dfb4[_0xa958('0x34')]);_0x10e4ee[_0xa958('0x38')]=_[_0xa958('0x36')](_0x38dfb4[_0xa958('0x37')],qs[_0xa958('0x39')](_0x18f110[_0xa958('0x34')][_0xa958('0x39')]));_0x10e4ee[_0xa958('0x38')]=_0x10e4ee[_0xa958('0x38')][_0xa958('0x3a')]?_0x10e4ee[_0xa958('0x38')]:_0x38dfb4[_0xa958('0x37')];if(_0x18f110[_0xa958('0x34')][_0xa958('0x4c')]){_0x10e4ee[_0xa958('0x45')]=[{'all':!![]}];}_0x10e4ee=_[_0xa958('0x41')]({},_0x10e4ee,_0x18f110['options']);return db['MailQueueReport']['find'](_0x10e4ee)[_0xa958('0x29')](handleEntityNotFound(_0x517319,null))[_0xa958('0x29')](respondWithResult(_0x517319,null))[_0xa958('0x48')](handleError(_0x517319,null));};exports[_0xa958('0x4d')]=function(_0x55ab45,_0x34faa2){return db[_0xa958('0x44')][_0xa958('0x4d')](_0x55ab45[_0xa958('0x4e')],{})[_0xa958('0x29')](respondWithResult(_0x34faa2,0xc9))['catch'](handleError(_0x34faa2,null));};exports[_0xa958('0x27')]=function(_0x2bbb2e,_0x3f8407){if(_0x2bbb2e['body']['id']){delete _0x2bbb2e[_0xa958('0x4e')]['id'];}return db['MailQueueReport'][_0xa958('0x4f')]({'where':{'id':_0x2bbb2e[_0xa958('0x4a')]['id']}})[_0xa958('0x29')](handleEntityNotFound(_0x3f8407,null))['then'](saveUpdates(_0x2bbb2e[_0xa958('0x4e')],null))['then'](respondWithResult(_0x3f8407,null))[_0xa958('0x48')](handleError(_0x3f8407,null));};exports[_0xa958('0x28')]=function(_0x85fc0d,_0x402d0a){return db[_0xa958('0x44')]['find']({'where':{'id':_0x85fc0d[_0xa958('0x4a')]['id']}})['then'](handleEntityNotFound(_0x402d0a,null))[_0xa958('0x29')](removeEntity(_0x402d0a,null))[_0xa958('0x48')](handleError(_0x402d0a,null));};exports['describe']=function(_0x17e4e7,_0x4f0a27){return db[_0xa958('0x44')][_0xa958('0x50')]()[_0xa958('0x29')](respondWithResult(_0x4f0a27,null))[_0xa958('0x48')](handleError(_0x4f0a27,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 5723900..df8e80f 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 _0xce9d=['rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','path'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xce9d,0x1ce));var _0xdce9=function(_0x464537,_0x437af4){_0x464537=_0x464537-0x0;var _0x2a4f85=_0xce9d[_0x464537];return _0x2a4f85;};'use strict';var _=require(_0xdce9('0x0'));var util=require(_0xdce9('0x1'));var logger=require(_0xdce9('0x2'))(_0xdce9('0x3'));var moment=require('moment');var BPromise=require(_0xdce9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdce9('0x5'));var rimraf=require(_0xdce9('0x6'));var config=require('../../config/environment');var attributes=require(_0xdce9('0x7'));module[_0xdce9('0x8')]=function(_0x3b2a80,_0x18841b){return _0x3b2a80[_0xdce9('0x9')](_0xdce9('0xa'),attributes,{'tableName':_0xdce9('0xb'),'paranoid':![],'indexes':[{'name':_0xdce9('0xc'),'fields':[_0xdce9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc743=['bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1a2632,_0x424a6d){var _0x563199=function(_0x4ec6a5){while(--_0x4ec6a5){_0x1a2632['push'](_0x1a2632['shift']());}};_0x563199(++_0x424a6d);}(_0xc743,0xa4));var _0x3c74=function(_0x307dc7,_0xad0582){_0x307dc7=_0x307dc7-0x0;var _0x2e400a=_0xc743[_0x307dc7];return _0x2e400a;};'use strict';var _=require(_0x3c74('0x0'));var util=require(_0x3c74('0x1'));var logger=require(_0x3c74('0x2'))(_0x3c74('0x3'));var moment=require('moment');var BPromise=require(_0x3c74('0x4'));var rp=require(_0x3c74('0x5'));var fs=require('fs');var path=require(_0x3c74('0x6'));var rimraf=require('rimraf');var config=require(_0x3c74('0x7'));var attributes=require(_0x3c74('0x8'));module[_0x3c74('0x9')]=function(_0x466161,_0x1bf120){return _0x466161[_0x3c74('0xa')](_0x3c74('0xb'),attributes,{'tableName':_0x3c74('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3c74('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index db2cebe..b2888b5 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x3ddd40,_0x681894){var _0x3fafa2=function(_0x302bcd){while(--_0x302bcd){_0x3ddd40['push'](_0x3ddd40['shift']());}};_0x3fafa2(++_0x681894);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x1fd450,_0x42cbf6){var _0x4cb0a5=function(_0x1384d4){while(--_0x1384d4){_0x1fd450['push'](_0x1fd450['shift']());}};_0x4cb0a5(++_0x42cbf6);}(_0x2ef3,0xba));var _0x32ef=function(_0x409be2,_0x9fdff3){_0x409be2=_0x409be2-0x0;var _0x5e3dc7=_0x2ef3[_0x409be2];return _0x5e3dc7;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a55c3ca..6f9ff19 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4ff30e,_0x55c7e1){var _0x53b5b9=function(_0x10ef2e){while(--_0x10ef2e){_0x4ff30e['push'](_0x4ff30e['shift']());}};_0x53b5b9(++_0x55c7e1);}(_0xe706,0xa3));var _0x6e70=function(_0x2d4340,_0x14bd7f){_0x2d4340=_0x2d4340-0x0;var _0x5a2e9e=_0xe706[_0x2d4340];return _0x5a2e9e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4059bb,_0x1d03ff){var _0x557623=function(_0xb1e20f){while(--_0xb1e20f){_0x4059bb['push'](_0x4059bb['shift']());}};_0x557623(++_0x1d03ff);}(_0x70e0,0x17b));var _0x070e=function(_0x525ea7,_0x3a4812){_0x525ea7=_0x525ea7-0x0;var _0x4bc79a=_0x70e0[_0x525ea7];return _0x4bc79a;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 03e534f..353e462 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 _0xdccd=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x310da1,_0x390f65){var _0x333d17=function(_0x27d0f8){while(--_0x27d0f8){_0x310da1['push'](_0x310da1['shift']());}};_0x333d17(++_0x390f65);}(_0xdccd,0x102));var _0xddcc=function(_0x1249c,_0x238c78){_0x1249c=_0x1249c-0x0;var _0x178822=_0xdccd[_0x1249c];return _0x178822;};'use strict';var Sequelize=require(_0xddcc('0x0'));module[_0xddcc('0x1')]={'description':{'type':Sequelize[_0xddcc('0x2')]},'host':{'type':Sequelize[_0xddcc('0x2')]},'authentication':{'type':Sequelize[_0xddcc('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xddcc('0x2')]},'port':{'type':Sequelize[_0xddcc('0x4')]},'tls':{'type':Sequelize[_0xddcc('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xddcc('0x2')],'defaultValue':_0xddcc('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xddcc('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xddcc('0x2')]},'modernAuthentication':{'type':Sequelize[_0xddcc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0bf=['INBOX','sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x59a5d6,_0x2b5cf1){var _0x2716d6=function(_0x30da0e){while(--_0x30da0e){_0x59a5d6['push'](_0x59a5d6['shift']());}};_0x2716d6(++_0x2b5cf1);}(_0xe0bf,0x123));var _0xfe0b=function(_0x4d084a,_0x365be4){_0x4d084a=_0x4d084a-0x0;var _0x27f1ad=_0xe0bf[_0x4d084a];return _0x27f1ad;};'use strict';var Sequelize=require(_0xfe0b('0x0'));module['exports']={'description':{'type':Sequelize[_0xfe0b('0x1')]},'host':{'type':Sequelize[_0xfe0b('0x1')]},'authentication':{'type':Sequelize[_0xfe0b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xfe0b('0x1')]},'password':{'type':Sequelize[_0xfe0b('0x1')]},'port':{'type':Sequelize[_0xfe0b('0x3')]},'tls':{'type':Sequelize[_0xfe0b('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xfe0b('0x1')],'defaultValue':_0xfe0b('0x4')},'connTimeout':{'type':Sequelize[_0xfe0b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfe0b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xfe0b('0x1')]},'modernAuthentication':{'type':Sequelize[_0xfe0b('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 e419530..410dbb9 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 _0x70eb=['rimraf','../../config/environment','./mailServerIn.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x6ff365,_0x585713){var _0x1761f9=function(_0x3eceee){while(--_0x3eceee){_0x6ff365['push'](_0x6ff365['shift']());}};_0x1761f9(++_0x585713);}(_0x70eb,0x1a8));var _0xb70e=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x70eb[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0xb70e('0x0'));var util=require(_0xb70e('0x1'));var logger=require(_0xb70e('0x2'))(_0xb70e('0x3'));var moment=require(_0xb70e('0x4'));var BPromise=require(_0xb70e('0x5'));var rp=require(_0xb70e('0x6'));var fs=require('fs');var path=require(_0xb70e('0x7'));var rimraf=require(_0xb70e('0x8'));var config=require(_0xb70e('0x9'));var attributes=require(_0xb70e('0xa'));module[_0xb70e('0xb')]=function(_0x22c72,_0x2c2141){return _0x22c72['define']('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5f9=['exports','define','MailServerIn','lodash','util','../../config/logger','api','bluebird','path','rimraf','./mailServerIn.attributes'];(function(_0x2e6f16,_0x32e173){var _0x357bc0=function(_0x4e10bd){while(--_0x4e10bd){_0x2e6f16['push'](_0x2e6f16['shift']());}};_0x357bc0(++_0x32e173);}(_0xb5f9,0x1f2));var _0x9b5f=function(_0x1bab93,_0x245dfa){_0x1bab93=_0x1bab93-0x0;var _0x292c04=_0xb5f9[_0x1bab93];return _0x292c04;};'use strict';var _=require(_0x9b5f('0x0'));var util=require(_0x9b5f('0x1'));var logger=require(_0x9b5f('0x2'))(_0x9b5f('0x3'));var moment=require('moment');var BPromise=require(_0x9b5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b5f('0x5'));var rimraf=require(_0x9b5f('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b5f('0x7'));module[_0x9b5f('0x8')]=function(_0x493728,_0x2b5cf1){return _0x493728[_0x9b5f('0x9')](_0x9b5f('0xa'),attributes,{'tableName':'mail_servers_in','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 1618605..edf6779 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 _0x81a4=['raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailServerIn','MailServerIn','options'];(function(_0x7978a5,_0x5a4e10){var _0x5a7ad3=function(_0x45b8f2){while(--_0x45b8f2){_0x7978a5['push'](_0x7978a5['shift']());}};_0x5a7ad3(++_0x5a4e10);}(_0x81a4,0x1a6));var _0x481a=function(_0x7ad6cb,_0xffee6c){_0x7ad6cb=_0x7ad6cb-0x0;var _0x22a0ba=_0x81a4[_0x7ad6cb];return _0x22a0ba;};'use strict';var _=require(_0x481a('0x0'));var util=require(_0x481a('0x1'));var moment=require(_0x481a('0x2'));var BPromise=require(_0x481a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x481a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x481a('0x5'));var logger=require(_0x481a('0x6'))(_0x481a('0x7'));var config=require('../../config/environment');var jayson=require(_0x481a('0x8'));var client=jayson[_0x481a('0x9')][_0x481a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b819,_0x4a5a92,_0x13ed10){return new BPromise(function(_0x13b771,_0x9b7dd5){return client[_0x481a('0xb')](_0x14b819,_0x13ed10)[_0x481a('0xc')](function(_0x59580e){logger['info'](_0x481a('0xd'),_0x4a5a92,_0x481a('0xe'));logger[_0x481a('0xf')](_0x481a('0x10'),_0x4a5a92,_0x481a('0xe'),JSON[_0x481a('0x11')](_0x59580e));if(_0x59580e[_0x481a('0x12')]){if(_0x59580e[_0x481a('0x12')][_0x481a('0x13')]===0x1f4){logger[_0x481a('0x12')]('MailServerIn,\x20%s,\x20%s',_0x4a5a92,_0x59580e['error'][_0x481a('0x14')]);return _0x9b7dd5(_0x59580e[_0x481a('0x12')][_0x481a('0x14')]);}logger[_0x481a('0x12')](_0x481a('0xd'),_0x4a5a92,_0x59580e[_0x481a('0x12')]['message']);return _0x13b771(_0x59580e[_0x481a('0x12')]['message']);}else{logger[_0x481a('0x15')](_0x481a('0xd'),_0x4a5a92,_0x481a('0xe'));_0x13b771(_0x59580e['result']['message']);}})[_0x481a('0x16')](function(_0xa5746f){logger[_0x481a('0x12')](_0x481a('0xd'),_0x4a5a92,_0xa5746f);_0x9b7dd5(_0xa5746f);});});}exports[_0x481a('0x17')]=function(_0x3186e3){var _0xe4e8fe=this;return new Promise(function(_0x2e6d4e,_0x38c15e){return db[_0x481a('0x18')]['findAll']({'raw':_0x3186e3[_0x481a('0x19')]?_0x3186e3[_0x481a('0x19')][_0x481a('0x1a')]===undefined?!![]:![]:!![],'where':_0x3186e3[_0x481a('0x19')]?_0x3186e3[_0x481a('0x19')]['where']||null:null,'attributes':_0x3186e3[_0x481a('0x19')]?_0x3186e3[_0x481a('0x19')][_0x481a('0x1b')]||null:null,'limit':_0x3186e3[_0x481a('0x19')]?_0x3186e3['options'][_0x481a('0x1c')]||null:null,'include':_0x3186e3[_0x481a('0x19')]?_0x3186e3[_0x481a('0x19')][_0x481a('0x1d')]?_[_0x481a('0x1e')](_0x3186e3[_0x481a('0x19')][_0x481a('0x1d')],function(_0x6a554b){return{'model':db[_0x6a554b['model']],'as':_0x6a554b['as'],'attributes':_0x6a554b[_0x481a('0x1b')],'include':_0x6a554b[_0x481a('0x1d')]?_['map'](_0x6a554b[_0x481a('0x1d')],function(_0x4916fa){return{'model':db[_0x4916fa[_0x481a('0x1f')]],'as':_0x4916fa['as'],'attributes':_0x4916fa[_0x481a('0x1b')],'include':_0x4916fa[_0x481a('0x1d')]?_[_0x481a('0x1e')](_0x4916fa['include'],function(_0x42acf4){return{'model':db[_0x42acf4[_0x481a('0x1f')]],'as':_0x42acf4['as'],'attributes':_0x42acf4[_0x481a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x481a('0xc')](function(_0x20aeb5){logger[_0x481a('0x15')]('GetMailServerIn',_0x3186e3);logger[_0x481a('0xf')](_0x481a('0x17'),_0x3186e3,JSON[_0x481a('0x11')](_0x20aeb5));_0x2e6d4e(_0x20aeb5);})[_0x481a('0x16')](function(_0x4e9d26){logger[_0x481a('0x12')](_0x481a('0x17'),_0x4e9d26[_0x481a('0x14')],_0x3186e3);_0x38c15e(_0xe4e8fe[_0x481a('0x12')](0x1f4,_0x4e9d26['message']));});});}; \ No newline at end of file +var _0x43c8=['GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','model','map','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x262a2a,_0x33aaca){var _0x4cc510=function(_0x49a596){while(--_0x49a596){_0x262a2a['push'](_0x262a2a['shift']());}};_0x4cc510(++_0x33aaca);}(_0x43c8,0xaf));var _0x843c=function(_0x28c567,_0x1db32){_0x28c567=_0x28c567-0x0;var _0xc2aec2=_0x43c8[_0x28c567];return _0xc2aec2;};'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});function respondWithRpcPromise(_0x15bb1f,_0xd198e5,_0x49aee7){return new BPromise(function(_0x327327,_0x41f56d){return client['request'](_0x15bb1f,_0x49aee7)[_0x843c('0xb')](function(_0x566777){logger['info'](_0x843c('0xc'),_0xd198e5,'request\x20sent');logger[_0x843c('0xd')](_0x843c('0xe'),_0xd198e5,_0x843c('0xf'),JSON[_0x843c('0x10')](_0x566777));if(_0x566777['error']){if(_0x566777[_0x843c('0x11')][_0x843c('0x12')]===0x1f4){logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x41f56d(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x327327(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}else{logger[_0x843c('0x14')]('MailServerIn,\x20%s,\x20%s',_0xd198e5,_0x843c('0xf'));_0x327327(_0x566777[_0x843c('0x15')][_0x843c('0x13')]);}})[_0x843c('0x16')](function(_0x16e8f6){logger['error'](_0x843c('0xc'),_0xd198e5,_0x16e8f6);_0x41f56d(_0x16e8f6);});});}exports[_0x843c('0x17')]=function(_0x1a7966){var _0x2acf94=this;return new Promise(function(_0x47d16a,_0xf53b50){return db[_0x843c('0x18')][_0x843c('0x19')]({'raw':_0x1a7966[_0x843c('0x1a')]?_0x1a7966[_0x843c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7966[_0x843c('0x1a')]?_0x1a7966['options'][_0x843c('0x1b')]||null:null,'attributes':_0x1a7966['options']?_0x1a7966[_0x843c('0x1a')][_0x843c('0x1c')]||null:null,'limit':_0x1a7966['options']?_0x1a7966[_0x843c('0x1a')][_0x843c('0x1d')]||null:null,'include':_0x1a7966[_0x843c('0x1a')]?_0x1a7966[_0x843c('0x1a')]['include']?_['map'](_0x1a7966['options'][_0x843c('0x1e')],function(_0x17e6ab){return{'model':db[_0x17e6ab[_0x843c('0x1f')]],'as':_0x17e6ab['as'],'attributes':_0x17e6ab[_0x843c('0x1c')],'include':_0x17e6ab[_0x843c('0x1e')]?_[_0x843c('0x20')](_0x17e6ab[_0x843c('0x1e')],function(_0x51f75b){return{'model':db[_0x51f75b[_0x843c('0x1f')]],'as':_0x51f75b['as'],'attributes':_0x51f75b[_0x843c('0x1c')],'include':_0x51f75b[_0x843c('0x1e')]?_['map'](_0x51f75b[_0x843c('0x1e')],function(_0x5caa13){return{'model':db[_0x5caa13[_0x843c('0x1f')]],'as':_0x5caa13['as'],'attributes':_0x5caa13[_0x843c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x843c('0xb')](function(_0x4f61af){logger[_0x843c('0x14')](_0x843c('0x17'),_0x1a7966);logger[_0x843c('0xd')](_0x843c('0x17'),_0x1a7966,JSON[_0x843c('0x10')](_0x4f61af));_0x47d16a(_0x4f61af);})[_0x843c('0x16')](function(_0x4e2a13){logger[_0x843c('0x11')]('GetMailServerIn',_0x4e2a13[_0x843c('0x13')],_0x1a7966);_0xf53b50(_0x2acf94[_0x843c('0x11')](0x1f4,_0x4e2a13[_0x843c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4f17dbe..f851d37 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(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x14a11a,_0x460709){_0x14a11a=_0x14a11a-0x0;var _0x212dd9=_0x7a54[_0x14a11a];return _0x212dd9;};'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 31d073a..a3aa05b 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 _0xfff0=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x4467f6,_0x5907a0){var _0x39fbc1=function(_0x206f77){while(--_0x206f77){_0x4467f6['push'](_0x4467f6['shift']());}};_0x39fbc1(++_0x5907a0);}(_0xfff0,0x139));var _0x0fff=function(_0x22c8e7,_0x3ae5c6){_0x22c8e7=_0x22c8e7-0x0;var _0x5e4bb2=_0xfff0[_0x22c8e7];return _0x5e4bb2;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'description':{'type':Sequelize[_0x0fff('0x1')]},'host':{'type':Sequelize[_0x0fff('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x0fff('0x1')]},'port':{'type':Sequelize[_0x0fff('0x2')]},'secure':{'type':Sequelize[_0x0fff('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0fff('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0fff('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb9a7=['BOOLEAN','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9a7,0x112));var _0x7b9a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xb9a7[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x7b9a('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x7b9a('0x1')]},'authentication':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 529ddad..5ed38e0 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 _0x4d07=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','index','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x1530fd,_0x4a3cb8){var _0x3094e0=function(_0x1b0734){while(--_0x1b0734){_0x1530fd['push'](_0x1530fd['shift']());}};_0x3094e0(++_0x4a3cb8);}(_0x4d07,0xd3));var _0x74d0=function(_0x482069,_0x3766dd){_0x482069=_0x482069-0x0;var _0x70b532=_0x4d07[_0x482069];return _0x70b532;};'use strict';var emlformat=require(_0x74d0('0x0'));var rimraf=require(_0x74d0('0x1'));var zipdir=require(_0x74d0('0x2'));var jsonpatch=require(_0x74d0('0x3'));var rp=require(_0x74d0('0x4'));var moment=require(_0x74d0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74d0('0x6'));var util=require('util');var path=require('path');var sox=require(_0x74d0('0x7'));var csv=require(_0x74d0('0x8'));var ejs=require(_0x74d0('0x9'));var fs=require('fs');var fs_extra=require(_0x74d0('0xa'));var _=require(_0x74d0('0xb'));var squel=require('squel');var crypto=require(_0x74d0('0xc'));var jsforce=require(_0x74d0('0xd'));var deskjs=require(_0x74d0('0xe'));var toCsv=require(_0x74d0('0x8'));var querystring=require(_0x74d0('0xf'));var Papa=require('papaparse');var Redis=require(_0x74d0('0x10'));var authService=require(_0x74d0('0x11'));var qs=require(_0x74d0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74d0('0x13'));var logger=require(_0x74d0('0x14'))(_0x74d0('0x15'));var utils=require(_0x74d0('0x16'));var config=require(_0x74d0('0x17'));var licenseUtil=require(_0x74d0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a3aec,_0x2900af){_0x2900af=_0x2900af||0xcc;return function(_0xe536b3){if(_0xe536b3){return _0x2a3aec['sendStatus'](_0x2900af);}return _0x2a3aec['status'](_0x2900af)['end']();};}function respondWithResult(_0x590be1,_0x51b909){_0x51b909=_0x51b909||0xc8;return function(_0x311ff2){if(_0x311ff2){return _0x590be1['status'](_0x51b909)[_0x74d0('0x19')](_0x311ff2);}};}function respondWithFilteredResult(_0x13b058,_0x236902){return function(_0x398a04){if(_0x398a04){var _0x421fa4=typeof _0x236902[_0x74d0('0x1a')]===_0x74d0('0x1b')&&typeof _0x236902[_0x74d0('0x1c')]===_0x74d0('0x1b');var _0x1f4450=_0x398a04[_0x74d0('0x1d')];var _0x5cbd54=_0x421fa4?0x0:_0x236902[_0x74d0('0x1a')];var _0x59dc7e=_0x421fa4?_0x398a04[_0x74d0('0x1d')]:_0x236902[_0x74d0('0x1a')]+_0x236902[_0x74d0('0x1c')];var _0xecad5f;if(_0x59dc7e>=_0x1f4450){_0x59dc7e=_0x1f4450;_0xecad5f=0xc8;}else{_0xecad5f=0xce;}_0x13b058[_0x74d0('0x1e')](_0xecad5f);return _0x13b058[_0x74d0('0x1f')](_0x74d0('0x20'),_0x5cbd54+'-'+_0x59dc7e+'/'+_0x1f4450)['json'](_0x398a04);}return null;};}function patchUpdates(_0x574d58){return function(_0x378600){try{jsonpatch[_0x74d0('0x21')](_0x378600,_0x574d58,!![]);}catch(_0x4503a8){return BPromise[_0x74d0('0x22')](_0x4503a8);}return _0x378600['save']();};}function saveUpdates(_0x356252,_0x7467cf){return function(_0x1cac88){if(_0x1cac88){return _0x1cac88['update'](_0x356252)[_0x74d0('0x23')](function(_0xdf2374){return _0xdf2374;});}return null;};}function removeEntity(_0x283910,_0x58f28f){return function(_0x121034){if(_0x121034){return _0x121034['destroy']()[_0x74d0('0x23')](function(){_0x283910[_0x74d0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7c1e57,_0x2553ef){return function(_0x414558){if(!_0x414558){_0x7c1e57[_0x74d0('0x24')](0x194);}return _0x414558;};}function handleError(_0x1a3eb0,_0x457185){_0x457185=_0x457185||0x1f4;return function(_0x5610a7){logger[_0x74d0('0x25')](_0x5610a7[_0x74d0('0x26')]);if(_0x5610a7[_0x74d0('0x27')]){delete _0x5610a7[_0x74d0('0x27')];}_0x1a3eb0['status'](_0x457185)['send'](_0x5610a7);};}exports[_0x74d0('0x28')]=function(_0x2ecb7e,_0x4b2443){var _0x1a9361={},_0x495a75={},_0x53e882={'count':0x0,'rows':[]};var _0xe56877=_['map'](db[_0x74d0('0x29')][_0x74d0('0x2a')],function(_0x35bed1){return{'name':_0x35bed1[_0x74d0('0x2b')],'type':_0x35bed1[_0x74d0('0x2c')][_0x74d0('0x2d')]};});_0x495a75['model']=_['map'](_0xe56877,_0x74d0('0x27'));_0x495a75[_0x74d0('0x2e')]=_[_0x74d0('0x2f')](_0x2ecb7e[_0x74d0('0x2e')]);_0x495a75[_0x74d0('0x30')]=_['intersection'](_0x495a75[_0x74d0('0x31')],_0x495a75['query']);_0x1a9361[_0x74d0('0x32')]=_['intersection'](_0x495a75[_0x74d0('0x31')],qs[_0x74d0('0x33')](_0x2ecb7e[_0x74d0('0x2e')][_0x74d0('0x33')]));_0x1a9361[_0x74d0('0x32')]=_0x1a9361[_0x74d0('0x32')][_0x74d0('0x34')]?_0x1a9361[_0x74d0('0x32')]:_0x495a75[_0x74d0('0x31')];if(!_0x2ecb7e[_0x74d0('0x2e')][_0x74d0('0x35')](_0x74d0('0x36'))){_0x1a9361['limit']=qs[_0x74d0('0x1c')](_0x2ecb7e[_0x74d0('0x2e')]['limit']);_0x1a9361[_0x74d0('0x1a')]=qs[_0x74d0('0x1a')](_0x2ecb7e['query']['offset']);}_0x1a9361['order']=qs[_0x74d0('0x37')](_0x2ecb7e[_0x74d0('0x2e')][_0x74d0('0x37')]);_0x1a9361[_0x74d0('0x38')]=qs[_0x74d0('0x30')](_[_0x74d0('0x39')](_0x2ecb7e[_0x74d0('0x2e')],_0x495a75[_0x74d0('0x30')]),_0xe56877);if(_0x2ecb7e[_0x74d0('0x2e')][_0x74d0('0x3a')]){_0x1a9361[_0x74d0('0x38')]=_[_0x74d0('0x3b')](_0x1a9361[_0x74d0('0x38')],{'$or':_[_0x74d0('0x3c')](_0xe56877,function(_0x164a67){if(_0x164a67[_0x74d0('0x2c')]!==_0x74d0('0x3d')){var _0x4089ea={};_0x4089ea[_0x164a67[_0x74d0('0x27')]]={'$like':'%'+_0x2ecb7e[_0x74d0('0x2e')][_0x74d0('0x3a')]+'%'};return _0x4089ea;}})});}_0x1a9361=_['merge']({},_0x1a9361,_0x2ecb7e[_0x74d0('0x3e')]);var _0x5ec471={'where':_0x1a9361['where']};return db[_0x74d0('0x29')][_0x74d0('0x1d')](_0x5ec471)[_0x74d0('0x23')](function(_0x3586c2){_0x53e882['count']=_0x3586c2;if(_0x2ecb7e[_0x74d0('0x2e')][_0x74d0('0x3f')]){_0x1a9361['include']=[{'all':!![]}];}return db[_0x74d0('0x29')][_0x74d0('0x40')](_0x1a9361);})[_0x74d0('0x23')](function(_0x4846b3){_0x53e882[_0x74d0('0x41')]=_0x4846b3;return _0x53e882;})['then'](respondWithFilteredResult(_0x4b2443,_0x1a9361))[_0x74d0('0x42')](handleError(_0x4b2443,null));};exports[_0x74d0('0x43')]=function(_0x5ea727,_0x1764f2){var _0x406132={'raw':!![],'where':{'id':_0x5ea727[_0x74d0('0x44')]['id']}},_0x3d0622={};_0x3d0622[_0x74d0('0x31')]=_['keys'](db[_0x74d0('0x29')][_0x74d0('0x2a')]);_0x3d0622[_0x74d0('0x2e')]=_[_0x74d0('0x2f')](_0x5ea727['query']);_0x3d0622['filters']=_['intersection'](_0x3d0622[_0x74d0('0x31')],_0x3d0622[_0x74d0('0x2e')]);_0x406132[_0x74d0('0x32')]=_[_0x74d0('0x45')](_0x3d0622['model'],qs[_0x74d0('0x33')](_0x5ea727[_0x74d0('0x2e')][_0x74d0('0x33')]));_0x406132['attributes']=_0x406132[_0x74d0('0x32')][_0x74d0('0x34')]?_0x406132[_0x74d0('0x32')]:_0x3d0622['model'];if(_0x5ea727['query']['includeAll']){_0x406132[_0x74d0('0x46')]=[{'all':!![]}];}_0x406132=_[_0x74d0('0x3b')]({},_0x406132,_0x5ea727[_0x74d0('0x3e')]);return db[_0x74d0('0x29')][_0x74d0('0x47')](_0x406132)[_0x74d0('0x23')](handleEntityNotFound(_0x1764f2,null))['then'](respondWithResult(_0x1764f2,null))[_0x74d0('0x42')](handleError(_0x1764f2,null));};exports['create']=function(_0x1bc305,_0x520837){return db[_0x74d0('0x29')][_0x74d0('0x48')](_0x1bc305[_0x74d0('0x49')],{})[_0x74d0('0x23')](respondWithResult(_0x520837,0xc9))[_0x74d0('0x42')](handleError(_0x520837,null));};exports[_0x74d0('0x4a')]=function(_0x249631,_0x54ee1c){if(_0x249631[_0x74d0('0x49')]['id']){delete _0x249631['body']['id'];}return db[_0x74d0('0x29')][_0x74d0('0x47')]({'where':{'id':_0x249631[_0x74d0('0x44')]['id']}})[_0x74d0('0x23')](handleEntityNotFound(_0x54ee1c,null))[_0x74d0('0x23')](saveUpdates(_0x249631[_0x74d0('0x49')],null))['then'](respondWithResult(_0x54ee1c,null))['catch'](handleError(_0x54ee1c,null));};exports[_0x74d0('0x4b')]=function(_0x20ceb8,_0x4089b3){return db['MailServerOut'][_0x74d0('0x47')]({'where':{'id':_0x20ceb8['params']['id']}})[_0x74d0('0x23')](handleEntityNotFound(_0x4089b3,null))[_0x74d0('0x23')](removeEntity(_0x4089b3,null))[_0x74d0('0x42')](handleError(_0x4089b3,null));}; \ No newline at end of file +var _0xd385=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','status','sendStatus','error','stack','send','MailServerOut','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','filter','merge','map','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xd385,0x11f));var _0x5d38=function(_0x164b9b,_0x20c789){_0x164b9b=_0x164b9b-0x0;var _0x592932=_0xd385[_0x164b9b];return _0x592932;};'use strict';var emlformat=require(_0x5d38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d38('0x1'));var jsonpatch=require(_0x5d38('0x2'));var rp=require(_0x5d38('0x3'));var moment=require(_0x5d38('0x4'));var BPromise=require(_0x5d38('0x5'));var Mustache=require(_0x5d38('0x6'));var util=require(_0x5d38('0x7'));var path=require(_0x5d38('0x8'));var sox=require(_0x5d38('0x9'));var csv=require(_0x5d38('0xa'));var ejs=require(_0x5d38('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d38('0xc'));var squel=require(_0x5d38('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d38('0xe'));var toCsv=require(_0x5d38('0xa'));var querystring=require(_0x5d38('0xf'));var Papa=require(_0x5d38('0x10'));var Redis=require(_0x5d38('0x11'));var authService=require(_0x5d38('0x12'));var qs=require(_0x5d38('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d38('0x14'));var logger=require(_0x5d38('0x15'))('api');var utils=require(_0x5d38('0x16'));var config=require(_0x5d38('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x436955,_0xa85d3c){_0xa85d3c=_0xa85d3c||0xcc;return function(_0x25cf30){if(_0x25cf30){return _0x436955['sendStatus'](_0xa85d3c);}return _0x436955['status'](_0xa85d3c)[_0x5d38('0x18')]();};}function respondWithResult(_0x4ad654,_0x3a495d){_0x3a495d=_0x3a495d||0xc8;return function(_0x494cb8){if(_0x494cb8){return _0x4ad654['status'](_0x3a495d)[_0x5d38('0x19')](_0x494cb8);}};}function respondWithFilteredResult(_0x4af58b,_0x1d3f82){return function(_0x6e3c16){if(_0x6e3c16){var _0xeed6bc=typeof _0x1d3f82[_0x5d38('0x1a')]===_0x5d38('0x1b')&&typeof _0x1d3f82[_0x5d38('0x1c')]===_0x5d38('0x1b');var _0x380dc7=_0x6e3c16[_0x5d38('0x1d')];var _0x847bed=_0xeed6bc?0x0:_0x1d3f82[_0x5d38('0x1a')];var _0x2ea1b5=_0xeed6bc?_0x6e3c16[_0x5d38('0x1d')]:_0x1d3f82['offset']+_0x1d3f82['limit'];var _0x4c6d74;if(_0x2ea1b5>=_0x380dc7){_0x2ea1b5=_0x380dc7;_0x4c6d74=0xc8;}else{_0x4c6d74=0xce;}_0x4af58b['status'](_0x4c6d74);return _0x4af58b[_0x5d38('0x1e')](_0x5d38('0x1f'),_0x847bed+'-'+_0x2ea1b5+'/'+_0x380dc7)['json'](_0x6e3c16);}return null;};}function patchUpdates(_0x4f6205){return function(_0x1c843c){try{jsonpatch[_0x5d38('0x20')](_0x1c843c,_0x4f6205,!![]);}catch(_0x58200d){return BPromise[_0x5d38('0x21')](_0x58200d);}return _0x1c843c[_0x5d38('0x22')]();};}function saveUpdates(_0x40fd53,_0x1ae89d){return function(_0xff92eb){if(_0xff92eb){return _0xff92eb[_0x5d38('0x23')](_0x40fd53)['then'](function(_0x3236de){return _0x3236de;});}return null;};}function removeEntity(_0x24d463,_0x142c77){return function(_0xd59d92){if(_0xd59d92){return _0xd59d92['destroy']()['then'](function(){_0x24d463[_0x5d38('0x24')](0xcc)[_0x5d38('0x18')]();});}};}function handleEntityNotFound(_0x249d3d,_0x5acd2c){return function(_0x2cd9a9){if(!_0x2cd9a9){_0x249d3d[_0x5d38('0x25')](0x194);}return _0x2cd9a9;};}function handleError(_0x425163,_0x251adb){_0x251adb=_0x251adb||0x1f4;return function(_0x298e52){logger[_0x5d38('0x26')](_0x298e52[_0x5d38('0x27')]);if(_0x298e52['name']){delete _0x298e52['name'];}_0x425163[_0x5d38('0x24')](_0x251adb)[_0x5d38('0x28')](_0x298e52);};}exports['index']=function(_0x551cb9,_0x12e726){var _0x5022f7={},_0x48b90f={},_0x358b3a={'count':0x0,'rows':[]};var _0xecb757=_['map'](db[_0x5d38('0x29')][_0x5d38('0x2a')],function(_0x2f387b){return{'name':_0x2f387b[_0x5d38('0x2b')],'type':_0x2f387b[_0x5d38('0x2c')]['key']};});_0x48b90f['model']=_['map'](_0xecb757,_0x5d38('0x2d'));_0x48b90f[_0x5d38('0x2e')]=_[_0x5d38('0x2f')](_0x551cb9[_0x5d38('0x2e')]);_0x48b90f[_0x5d38('0x30')]=_[_0x5d38('0x31')](_0x48b90f[_0x5d38('0x32')],_0x48b90f[_0x5d38('0x2e')]);_0x5022f7[_0x5d38('0x33')]=_[_0x5d38('0x31')](_0x48b90f['model'],qs[_0x5d38('0x34')](_0x551cb9[_0x5d38('0x2e')][_0x5d38('0x34')]));_0x5022f7[_0x5d38('0x33')]=_0x5022f7[_0x5d38('0x33')]['length']?_0x5022f7[_0x5d38('0x33')]:_0x48b90f[_0x5d38('0x32')];if(!_0x551cb9[_0x5d38('0x2e')][_0x5d38('0x35')]('nolimit')){_0x5022f7['limit']=qs['limit'](_0x551cb9['query'][_0x5d38('0x1c')]);_0x5022f7['offset']=qs['offset'](_0x551cb9[_0x5d38('0x2e')][_0x5d38('0x1a')]);}_0x5022f7['order']=qs[_0x5d38('0x36')](_0x551cb9['query'][_0x5d38('0x36')]);_0x5022f7[_0x5d38('0x37')]=qs['filters'](_['pick'](_0x551cb9[_0x5d38('0x2e')],_0x48b90f['filters']),_0xecb757);if(_0x551cb9['query'][_0x5d38('0x38')]){_0x5022f7[_0x5d38('0x37')]=_[_0x5d38('0x39')](_0x5022f7[_0x5d38('0x37')],{'$or':_[_0x5d38('0x3a')](_0xecb757,function(_0x33e492){if(_0x33e492[_0x5d38('0x2c')]!=='VIRTUAL'){var _0x3bd2a6={};_0x3bd2a6[_0x33e492[_0x5d38('0x2d')]]={'$like':'%'+_0x551cb9['query'][_0x5d38('0x38')]+'%'};return _0x3bd2a6;}})});}_0x5022f7=_['merge']({},_0x5022f7,_0x551cb9[_0x5d38('0x3b')]);var _0x2b2aad={'where':_0x5022f7['where']};return db[_0x5d38('0x29')][_0x5d38('0x1d')](_0x2b2aad)[_0x5d38('0x3c')](function(_0x39bc3a){_0x358b3a[_0x5d38('0x1d')]=_0x39bc3a;if(_0x551cb9[_0x5d38('0x2e')][_0x5d38('0x3d')]){_0x5022f7[_0x5d38('0x3e')]=[{'all':!![]}];}return db[_0x5d38('0x29')][_0x5d38('0x3f')](_0x5022f7);})['then'](function(_0x211d97){_0x358b3a[_0x5d38('0x40')]=_0x211d97;return _0x358b3a;})[_0x5d38('0x3c')](respondWithFilteredResult(_0x12e726,_0x5022f7))[_0x5d38('0x41')](handleError(_0x12e726,null));};exports[_0x5d38('0x42')]=function(_0x2c9c46,_0x319889){var _0x5f4bf1={'raw':!![],'where':{'id':_0x2c9c46[_0x5d38('0x43')]['id']}},_0x30eba9={};_0x30eba9[_0x5d38('0x32')]=_[_0x5d38('0x2f')](db['MailServerOut'][_0x5d38('0x2a')]);_0x30eba9[_0x5d38('0x2e')]=_['keys'](_0x2c9c46[_0x5d38('0x2e')]);_0x30eba9[_0x5d38('0x30')]=_['intersection'](_0x30eba9[_0x5d38('0x32')],_0x30eba9['query']);_0x5f4bf1[_0x5d38('0x33')]=_[_0x5d38('0x31')](_0x30eba9[_0x5d38('0x32')],qs['fields'](_0x2c9c46[_0x5d38('0x2e')][_0x5d38('0x34')]));_0x5f4bf1[_0x5d38('0x33')]=_0x5f4bf1[_0x5d38('0x33')][_0x5d38('0x44')]?_0x5f4bf1['attributes']:_0x30eba9[_0x5d38('0x32')];if(_0x2c9c46[_0x5d38('0x2e')]['includeAll']){_0x5f4bf1[_0x5d38('0x3e')]=[{'all':!![]}];}_0x5f4bf1=_[_0x5d38('0x39')]({},_0x5f4bf1,_0x2c9c46[_0x5d38('0x3b')]);return db[_0x5d38('0x29')][_0x5d38('0x45')](_0x5f4bf1)['then'](handleEntityNotFound(_0x319889,null))[_0x5d38('0x3c')](respondWithResult(_0x319889,null))['catch'](handleError(_0x319889,null));};exports[_0x5d38('0x46')]=function(_0x529f67,_0xd4288b){return db[_0x5d38('0x29')]['create'](_0x529f67[_0x5d38('0x47')],{})[_0x5d38('0x3c')](respondWithResult(_0xd4288b,0xc9))[_0x5d38('0x41')](handleError(_0xd4288b,null));};exports['update']=function(_0x568177,_0x5ccb96){if(_0x568177['body']['id']){delete _0x568177[_0x5d38('0x47')]['id'];}return db[_0x5d38('0x29')][_0x5d38('0x45')]({'where':{'id':_0x568177[_0x5d38('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ccb96,null))[_0x5d38('0x3c')](saveUpdates(_0x568177[_0x5d38('0x47')],null))[_0x5d38('0x3c')](respondWithResult(_0x5ccb96,null))[_0x5d38('0x41')](handleError(_0x5ccb96,null));};exports[_0x5d38('0x48')]=function(_0x344537,_0x45fa8d){return db['MailServerOut'][_0x5d38('0x45')]({'where':{'id':_0x344537[_0x5d38('0x43')]['id']}})[_0x5d38('0x3c')](handleEntityNotFound(_0x45fa8d,null))[_0x5d38('0x3c')](removeEntity(_0x45fa8d,null))[_0x5d38('0x41')](handleError(_0x45fa8d,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 8a66122..f6c28bf 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 _0x9b99=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x4c4e65,_0x197586){var _0x383b21=function(_0x53e422){while(--_0x53e422){_0x4c4e65['push'](_0x4c4e65['shift']());}};_0x383b21(++_0x197586);}(_0x9b99,0x123));var _0x99b9=function(_0x57aec9,_0x226509){_0x57aec9=_0x57aec9-0x0;var _0x12e7f9=_0x9b99[_0x57aec9];return _0x12e7f9;};'use strict';var _=require(_0x99b9('0x0'));var util=require(_0x99b9('0x1'));var logger=require(_0x99b9('0x2'))(_0x99b9('0x3'));var moment=require(_0x99b9('0x4'));var BPromise=require(_0x99b9('0x5'));var rp=require(_0x99b9('0x6'));var fs=require('fs');var path=require(_0x99b9('0x7'));var rimraf=require(_0x99b9('0x8'));var config=require(_0x99b9('0x9'));var attributes=require(_0x99b9('0xa'));module['exports']=function(_0x155b3b,_0x2e6056){return _0x155b3b[_0x99b9('0xb')](_0x99b9('0xc'),attributes,{'tableName':_0x99b9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99b5=['exports','define','MailServerOut','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x5c1747,_0x52896a){var _0x52fa80=function(_0x3022eb){while(--_0x3022eb){_0x5c1747['push'](_0x5c1747['shift']());}};_0x52fa80(++_0x52896a);}(_0x99b5,0x1a5));var _0x599b=function(_0x31c915,_0x231aa5){_0x31c915=_0x31c915-0x0;var _0x12cd56=_0x99b5[_0x31c915];return _0x12cd56;};'use strict';var _=require('lodash');var util=require(_0x599b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x599b('0x1'));var BPromise=require(_0x599b('0x2'));var rp=require(_0x599b('0x3'));var fs=require('fs');var path=require(_0x599b('0x4'));var rimraf=require(_0x599b('0x5'));var config=require(_0x599b('0x6'));var attributes=require(_0x599b('0x7'));module[_0x599b('0x8')]=function(_0x103522,_0x4d7941){return _0x103522[_0x599b('0x9')](_0x599b('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index d178760..a4d5d1f 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x995994,_0x5ac962){var _0xc58094=function(_0x37a6a1){while(--_0x37a6a1){_0x995994['push'](_0x995994['shift']());}};_0xc58094(++_0x5ac962);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ 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(_0x307a30,_0xfa8764){var _0x28f1d7=function(_0x498685){while(--_0x498685){_0x307a30['push'](_0x307a30['shift']());}};_0x28f1d7(++_0xfa8764);}(_0x5f2f,0x73));var _0xf5f2=function(_0x83f529,_0x3d55d7){_0x83f529=_0x83f529-0x0;var _0x4383b8=_0x5f2f[_0x83f529];return _0x4383b8;};'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 f34d9f7..ca567a7 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 _0x02e6=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x02e6,0x1b9));var _0x602e=function(_0x2fa38b,_0x350fe9){_0x2fa38b=_0x2fa38b-0x0;var _0x465e34=_0x02e6[_0x2fa38b];return _0x465e34;};'use strict';var multer=require(_0x602e('0x0'));var util=require(_0x602e('0x1'));var path=require('path');var timeout=require(_0x602e('0x2'));var express=require(_0x602e('0x3'));var router=express[_0x602e('0x4')]();var fs_extra=require(_0x602e('0x5'));var auth=require(_0x602e('0x6'));var interaction=require(_0x602e('0x7'));var config=require(_0x602e('0x8'));var controller=require(_0x602e('0x9'));router[_0x602e('0xa')]('/',auth[_0x602e('0xb')](),controller[_0x602e('0xc')]);router[_0x602e('0xa')](_0x602e('0xd'),auth[_0x602e('0xb')](),controller[_0x602e('0xe')]);router[_0x602e('0xa')](_0x602e('0xf'),auth['isAuthenticated'](),controller[_0x602e('0x10')]);router[_0x602e('0x11')]('/',auth['isAuthenticated'](),controller[_0x602e('0x12')]);router[_0x602e('0x13')](_0x602e('0xf'),auth[_0x602e('0xb')](),controller[_0x602e('0x14')]);router['delete'](_0x602e('0xf'),auth[_0x602e('0xb')](),controller[_0x602e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4972=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x21892b,_0x437127){var _0x21865b=function(_0x5b1b27){while(--_0x5b1b27){_0x21892b['push'](_0x21892b['shift']());}};_0x21865b(++_0x437127);}(_0x4972,0x78));var _0x2497=function(_0x1aaba3,_0x247d7a){_0x1aaba3=_0x1aaba3-0x0;var _0x39fa=_0x4972[_0x1aaba3];return _0x39fa;};'use strict';var multer=require(_0x2497('0x0'));var util=require(_0x2497('0x1'));var path=require(_0x2497('0x2'));var timeout=require(_0x2497('0x3'));var express=require(_0x2497('0x4'));var router=express['Router']();var fs_extra=require(_0x2497('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2497('0x6'));var controller=require('./mailSubstatus.controller');router[_0x2497('0x7')]('/',auth['isAuthenticated'](),controller[_0x2497('0x8')]);router[_0x2497('0x7')](_0x2497('0x9'),auth[_0x2497('0xa')](),controller[_0x2497('0xb')]);router[_0x2497('0x7')](_0x2497('0xc'),auth[_0x2497('0xa')](),controller[_0x2497('0xd')]);router['post']('/',auth[_0x2497('0xa')](),controller['create']);router[_0x2497('0xe')]('/:id',auth[_0x2497('0xa')](),controller[_0x2497('0xf')]);router[_0x2497('0x10')](_0x2497('0xc'),auth[_0x2497('0xa')](),controller[_0x2497('0x11')]);module[_0x2497('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 81e823d..02fee27 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 _0x39e6=['sequelize','STRING'];(function(_0x5968e6,_0xf04f7){var _0x1de9d0=function(_0x4be742){while(--_0x4be742){_0x5968e6['push'](_0x5968e6['shift']());}};_0x1de9d0(++_0xf04f7);}(_0x39e6,0x9e));var _0x639e=function(_0x57dded,_0x5cd4d9){_0x57dded=_0x57dded-0x0;var _0x1f88f3=_0x39e6[_0x57dded];return _0x1f88f3;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'name':{'type':Sequelize[_0x639e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfd2e=['sequelize','STRING'];(function(_0x2c8638,_0x17b9f1){var _0x59fa0e=function(_0xd09269){while(--_0xd09269){_0x2c8638['push'](_0x2c8638['shift']());}};_0x59fa0e(++_0x17b9f1);}(_0xfd2e,0x6e));var _0xefd2=function(_0xbc6126,_0x5ee179){_0xbc6126=_0xbc6126-0x0;var _0x22e573=_0xfd2e[_0xbc6126];return _0x22e573;};'use strict';var Sequelize=require(_0xefd2('0x0'));module['exports']={'name':{'type':Sequelize[_0xefd2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xefd2('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 523c213..1f4cce5 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 _0x8e26=['../../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','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','MailSubstatus','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8e26,0x134));var _0x68e2=function(_0x12d0c4,_0x682221){_0x12d0c4=_0x12d0c4-0x0;var _0x4eed30=_0x8e26[_0x12d0c4];return _0x4eed30;};'use strict';var emlformat=require(_0x68e2('0x0'));var rimraf=require(_0x68e2('0x1'));var zipdir=require(_0x68e2('0x2'));var jsonpatch=require(_0x68e2('0x3'));var rp=require(_0x68e2('0x4'));var moment=require(_0x68e2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x68e2('0x6'));var path=require('path');var sox=require(_0x68e2('0x7'));var csv=require(_0x68e2('0x8'));var ejs=require(_0x68e2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68e2('0xa'));var squel=require(_0x68e2('0xb'));var crypto=require(_0x68e2('0xc'));var jsforce=require(_0x68e2('0xd'));var deskjs=require(_0x68e2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x68e2('0xf'));var Papa=require(_0x68e2('0x10'));var Redis=require(_0x68e2('0x11'));var authService=require(_0x68e2('0x12'));var qs=require(_0x68e2('0x13'));var as=require(_0x68e2('0x14'));var hardwareService=require(_0x68e2('0x15'));var logger=require(_0x68e2('0x16'))(_0x68e2('0x17'));var utils=require('../../config/utils');var config=require(_0x68e2('0x18'));var licenseUtil=require(_0x68e2('0x19'));var db=require(_0x68e2('0x1a'))['db'];function respondWithStatusCode(_0x5651cf,_0x3c6611){_0x3c6611=_0x3c6611||0xcc;return function(_0x334595){if(_0x334595){return _0x5651cf[_0x68e2('0x1b')](_0x3c6611);}return _0x5651cf[_0x68e2('0x1c')](_0x3c6611)[_0x68e2('0x1d')]();};}function respondWithResult(_0xeadf5c,_0x460d72){_0x460d72=_0x460d72||0xc8;return function(_0x546017){if(_0x546017){return _0xeadf5c['status'](_0x460d72)[_0x68e2('0x1e')](_0x546017);}};}function respondWithFilteredResult(_0x7647e7,_0x4efb8b){return function(_0xf65a2a){if(_0xf65a2a){var _0x39c9c3=typeof _0x4efb8b[_0x68e2('0x1f')]===_0x68e2('0x20')&&typeof _0x4efb8b[_0x68e2('0x21')]===_0x68e2('0x20');var _0x35c78d=_0xf65a2a[_0x68e2('0x22')];var _0x2f1873=_0x39c9c3?0x0:_0x4efb8b[_0x68e2('0x1f')];var _0x40a5f=_0x39c9c3?_0xf65a2a[_0x68e2('0x22')]:_0x4efb8b['offset']+_0x4efb8b['limit'];var _0x33cdf7;if(_0x40a5f>=_0x35c78d){_0x40a5f=_0x35c78d;_0x33cdf7=0xc8;}else{_0x33cdf7=0xce;}_0x7647e7['status'](_0x33cdf7);return _0x7647e7[_0x68e2('0x23')](_0x68e2('0x24'),_0x2f1873+'-'+_0x40a5f+'/'+_0x35c78d)[_0x68e2('0x1e')](_0xf65a2a);}return null;};}function patchUpdates(_0x5db51d){return function(_0x4ca450){try{jsonpatch[_0x68e2('0x25')](_0x4ca450,_0x5db51d,!![]);}catch(_0x5426cd){return BPromise[_0x68e2('0x26')](_0x5426cd);}return _0x4ca450[_0x68e2('0x27')]();};}function saveUpdates(_0x2e8435,_0x37a08a){return function(_0x473ba0){if(_0x473ba0){return _0x473ba0[_0x68e2('0x28')](_0x2e8435)[_0x68e2('0x29')](function(_0x386e7e){return _0x386e7e;});}return null;};}function removeEntity(_0x34ca5c,_0x181abb){return function(_0x4c8dad){if(_0x4c8dad){return _0x4c8dad[_0x68e2('0x2a')]()[_0x68e2('0x29')](function(){_0x34ca5c[_0x68e2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x187bc2,_0x3c5512){return function(_0x4122cb){if(!_0x4122cb){_0x187bc2[_0x68e2('0x1b')](0x194);}return _0x4122cb;};}function handleError(_0x4e3a81,_0x55fabc){_0x55fabc=_0x55fabc||0x1f4;return function(_0x1bdcbf){logger[_0x68e2('0x2b')](_0x1bdcbf[_0x68e2('0x2c')]);if(_0x1bdcbf[_0x68e2('0x2d')]){delete _0x1bdcbf[_0x68e2('0x2d')];}_0x4e3a81[_0x68e2('0x1c')](_0x55fabc)[_0x68e2('0x2e')](_0x1bdcbf);};}exports[_0x68e2('0x2f')]=function(_0xf73bc4,_0x34fe0b){var _0x1e3223={},_0x35bc50={},_0x38ff80={'count':0x0,'rows':[]};var _0x4526f3=_[_0x68e2('0x30')](db['MailSubstatus'][_0x68e2('0x31')],function(_0x3e3b3f){return{'name':_0x3e3b3f[_0x68e2('0x32')],'type':_0x3e3b3f[_0x68e2('0x33')][_0x68e2('0x34')]};});_0x35bc50['model']=_[_0x68e2('0x30')](_0x4526f3,_0x68e2('0x2d'));_0x35bc50[_0x68e2('0x35')]=_['keys'](_0xf73bc4[_0x68e2('0x35')]);_0x35bc50['filters']=_[_0x68e2('0x36')](_0x35bc50[_0x68e2('0x37')],_0x35bc50['query']);_0x1e3223[_0x68e2('0x38')]=_[_0x68e2('0x36')](_0x35bc50[_0x68e2('0x37')],qs[_0x68e2('0x39')](_0xf73bc4[_0x68e2('0x35')][_0x68e2('0x39')]));_0x1e3223[_0x68e2('0x38')]=_0x1e3223[_0x68e2('0x38')][_0x68e2('0x3a')]?_0x1e3223[_0x68e2('0x38')]:_0x35bc50[_0x68e2('0x37')];if(!_0xf73bc4[_0x68e2('0x35')][_0x68e2('0x3b')]('nolimit')){_0x1e3223[_0x68e2('0x21')]=qs[_0x68e2('0x21')](_0xf73bc4['query'][_0x68e2('0x21')]);_0x1e3223[_0x68e2('0x1f')]=qs[_0x68e2('0x1f')](_0xf73bc4[_0x68e2('0x35')][_0x68e2('0x1f')]);}_0x1e3223[_0x68e2('0x3c')]=qs[_0x68e2('0x3d')](_0xf73bc4[_0x68e2('0x35')]['sort']);_0x1e3223[_0x68e2('0x3e')]=qs[_0x68e2('0x3f')](_[_0x68e2('0x40')](_0xf73bc4['query'],_0x35bc50[_0x68e2('0x3f')]),_0x4526f3);if(_0xf73bc4[_0x68e2('0x35')][_0x68e2('0x41')]){_0x1e3223[_0x68e2('0x3e')]=_['merge'](_0x1e3223[_0x68e2('0x3e')],{'$or':_['map'](_0x4526f3,function(_0x1e169d){if(_0x1e169d[_0x68e2('0x33')]!==_0x68e2('0x42')){var _0x3f8110={};_0x3f8110[_0x1e169d[_0x68e2('0x2d')]]={'$like':'%'+_0xf73bc4[_0x68e2('0x35')][_0x68e2('0x41')]+'%'};return _0x3f8110;}})});}_0x1e3223=_[_0x68e2('0x43')]({},_0x1e3223,_0xf73bc4[_0x68e2('0x44')]);var _0x3d2647={'where':_0x1e3223['where']};return db[_0x68e2('0x45')][_0x68e2('0x22')](_0x3d2647)[_0x68e2('0x29')](function(_0x27b5f6){_0x38ff80[_0x68e2('0x22')]=_0x27b5f6;if(_0xf73bc4[_0x68e2('0x35')][_0x68e2('0x46')]){_0x1e3223[_0x68e2('0x47')]=[{'all':!![]}];}return db['MailSubstatus'][_0x68e2('0x48')](_0x1e3223);})[_0x68e2('0x29')](function(_0x19eb89){_0x38ff80[_0x68e2('0x49')]=_0x19eb89;return _0x38ff80;})[_0x68e2('0x29')](respondWithFilteredResult(_0x34fe0b,_0x1e3223))['catch'](handleError(_0x34fe0b,null));};exports[_0x68e2('0x4a')]=function(_0x25daa0,_0x2a39d0){var _0x42c0fd={'raw':!![],'where':{'id':_0x25daa0[_0x68e2('0x4b')]['id']}},_0x1c33d0={};_0x1c33d0[_0x68e2('0x37')]=_['keys'](db[_0x68e2('0x45')][_0x68e2('0x31')]);_0x1c33d0['query']=_[_0x68e2('0x4c')](_0x25daa0[_0x68e2('0x35')]);_0x1c33d0[_0x68e2('0x3f')]=_[_0x68e2('0x36')](_0x1c33d0['model'],_0x1c33d0[_0x68e2('0x35')]);_0x42c0fd['attributes']=_[_0x68e2('0x36')](_0x1c33d0[_0x68e2('0x37')],qs[_0x68e2('0x39')](_0x25daa0[_0x68e2('0x35')]['fields']));_0x42c0fd['attributes']=_0x42c0fd[_0x68e2('0x38')][_0x68e2('0x3a')]?_0x42c0fd[_0x68e2('0x38')]:_0x1c33d0[_0x68e2('0x37')];if(_0x25daa0[_0x68e2('0x35')]['includeAll']){_0x42c0fd['include']=[{'all':!![]}];}_0x42c0fd=_[_0x68e2('0x43')]({},_0x42c0fd,_0x25daa0['options']);return db['MailSubstatus']['find'](_0x42c0fd)[_0x68e2('0x29')](handleEntityNotFound(_0x2a39d0,null))[_0x68e2('0x29')](respondWithResult(_0x2a39d0,null))[_0x68e2('0x4d')](handleError(_0x2a39d0,null));};exports[_0x68e2('0x4e')]=function(_0xe975c4,_0x5effd6){return db[_0x68e2('0x45')][_0x68e2('0x4e')](_0xe975c4[_0x68e2('0x4f')],{})['then'](respondWithResult(_0x5effd6,0xc9))[_0x68e2('0x4d')](handleError(_0x5effd6,null));};exports[_0x68e2('0x28')]=function(_0x3959eb,_0x318502){if(_0x3959eb[_0x68e2('0x4f')]['id']){delete _0x3959eb[_0x68e2('0x4f')]['id'];}return db[_0x68e2('0x45')][_0x68e2('0x50')]({'where':{'id':_0x3959eb['params']['id']}})[_0x68e2('0x29')](handleEntityNotFound(_0x318502,null))[_0x68e2('0x29')](saveUpdates(_0x3959eb[_0x68e2('0x4f')],null))[_0x68e2('0x29')](respondWithResult(_0x318502,null))[_0x68e2('0x4d')](handleError(_0x318502,null));};exports[_0x68e2('0x2a')]=function(_0x5bce20,_0x46882f){return db[_0x68e2('0x45')][_0x68e2('0x50')]({'where':{'id':_0x5bce20[_0x68e2('0x4b')]['id']}})[_0x68e2('0x29')](handleEntityNotFound(_0x46882f,null))['then'](removeEntity(_0x46882f,null))['catch'](handleError(_0x46882f,null));};exports[_0x68e2('0x51')]=function(_0x4d6f6e,_0x47b66f){return db['MailSubstatus'][_0x68e2('0x51')]()['then'](respondWithResult(_0x47b66f,null))[_0x68e2('0x4d')](handleError(_0x47b66f,null));}; \ No newline at end of file +var _0xe7a4=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','include','rows','catch','includeAll','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0xe7a4,0x163));var _0x4e7a=function(_0x40084c,_0x5e3c9a){_0x40084c=_0x40084c-0x0;var _0x42f6e1=_0xe7a4[_0x40084c];return _0x42f6e1;};'use strict';var emlformat=require(_0x4e7a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e7a('0x1'));var rp=require(_0x4e7a('0x2'));var moment=require('moment');var BPromise=require(_0x4e7a('0x3'));var Mustache=require(_0x4e7a('0x4'));var util=require(_0x4e7a('0x5'));var path=require('path');var sox=require(_0x4e7a('0x6'));var csv=require(_0x4e7a('0x7'));var ejs=require(_0x4e7a('0x8'));var fs=require('fs');var fs_extra=require(_0x4e7a('0x9'));var _=require(_0x4e7a('0xa'));var squel=require(_0x4e7a('0xb'));var crypto=require(_0x4e7a('0xc'));var jsforce=require(_0x4e7a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4e7a('0x7'));var querystring=require(_0x4e7a('0xe'));var Papa=require('papaparse');var Redis=require(_0x4e7a('0xf'));var authService=require(_0x4e7a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4e7a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e7a('0x12'))(_0x4e7a('0x13'));var utils=require(_0x4e7a('0x14'));var config=require(_0x4e7a('0x15'));var licenseUtil=require(_0x4e7a('0x16'));var db=require(_0x4e7a('0x17'))['db'];function respondWithStatusCode(_0x34da1c,_0x387cb1){_0x387cb1=_0x387cb1||0xcc;return function(_0x213755){if(_0x213755){return _0x34da1c[_0x4e7a('0x18')](_0x387cb1);}return _0x34da1c['status'](_0x387cb1)[_0x4e7a('0x19')]();};}function respondWithResult(_0x56ae17,_0x281bc4){_0x281bc4=_0x281bc4||0xc8;return function(_0x17b77b){if(_0x17b77b){return _0x56ae17['status'](_0x281bc4)['json'](_0x17b77b);}};}function respondWithFilteredResult(_0x1850be,_0x5b8bfe){return function(_0x260e35){if(_0x260e35){var _0x1003ba=typeof _0x5b8bfe[_0x4e7a('0x1a')]===_0x4e7a('0x1b')&&typeof _0x5b8bfe[_0x4e7a('0x1c')]===_0x4e7a('0x1b');var _0x5df892=_0x260e35[_0x4e7a('0x1d')];var _0x4d025a=_0x1003ba?0x0:_0x5b8bfe[_0x4e7a('0x1a')];var _0x98c9c6=_0x1003ba?_0x260e35[_0x4e7a('0x1d')]:_0x5b8bfe[_0x4e7a('0x1a')]+_0x5b8bfe[_0x4e7a('0x1c')];var _0x278526;if(_0x98c9c6>=_0x5df892){_0x98c9c6=_0x5df892;_0x278526=0xc8;}else{_0x278526=0xce;}_0x1850be[_0x4e7a('0x1e')](_0x278526);return _0x1850be[_0x4e7a('0x1f')](_0x4e7a('0x20'),_0x4d025a+'-'+_0x98c9c6+'/'+_0x5df892)[_0x4e7a('0x21')](_0x260e35);}return null;};}function patchUpdates(_0x520ec3){return function(_0x1ffa08){try{jsonpatch[_0x4e7a('0x22')](_0x1ffa08,_0x520ec3,!![]);}catch(_0x107be7){return BPromise[_0x4e7a('0x23')](_0x107be7);}return _0x1ffa08['save']();};}function saveUpdates(_0x190d13,_0x54cb98){return function(_0x473011){if(_0x473011){return _0x473011[_0x4e7a('0x24')](_0x190d13)[_0x4e7a('0x25')](function(_0x39786c){return _0x39786c;});}return null;};}function removeEntity(_0x55ccf9,_0x3ffac4){return function(_0x15eea5){if(_0x15eea5){return _0x15eea5[_0x4e7a('0x26')]()[_0x4e7a('0x25')](function(){_0x55ccf9[_0x4e7a('0x1e')](0xcc)[_0x4e7a('0x19')]();});}};}function handleEntityNotFound(_0x5bc39b,_0x3970cc){return function(_0x119983){if(!_0x119983){_0x5bc39b[_0x4e7a('0x18')](0x194);}return _0x119983;};}function handleError(_0x57efa0,_0x46e7ad){_0x46e7ad=_0x46e7ad||0x1f4;return function(_0x527dc7){logger[_0x4e7a('0x27')](_0x527dc7[_0x4e7a('0x28')]);if(_0x527dc7[_0x4e7a('0x29')]){delete _0x527dc7[_0x4e7a('0x29')];}_0x57efa0[_0x4e7a('0x1e')](_0x46e7ad)[_0x4e7a('0x2a')](_0x527dc7);};}exports[_0x4e7a('0x2b')]=function(_0x5682a5,_0x29b675){var _0x3f2761={},_0x295071={},_0x1ed350={'count':0x0,'rows':[]};var _0x1f87a3=_[_0x4e7a('0x2c')](db[_0x4e7a('0x2d')][_0x4e7a('0x2e')],function(_0x5a3a75){return{'name':_0x5a3a75['fieldName'],'type':_0x5a3a75[_0x4e7a('0x2f')][_0x4e7a('0x30')]};});_0x295071[_0x4e7a('0x31')]=_[_0x4e7a('0x2c')](_0x1f87a3,_0x4e7a('0x29'));_0x295071[_0x4e7a('0x32')]=_[_0x4e7a('0x33')](_0x5682a5['query']);_0x295071[_0x4e7a('0x34')]=_[_0x4e7a('0x35')](_0x295071[_0x4e7a('0x31')],_0x295071[_0x4e7a('0x32')]);_0x3f2761[_0x4e7a('0x36')]=_[_0x4e7a('0x35')](_0x295071[_0x4e7a('0x31')],qs[_0x4e7a('0x37')](_0x5682a5[_0x4e7a('0x32')]['fields']));_0x3f2761[_0x4e7a('0x36')]=_0x3f2761[_0x4e7a('0x36')][_0x4e7a('0x38')]?_0x3f2761[_0x4e7a('0x36')]:_0x295071[_0x4e7a('0x31')];if(!_0x5682a5[_0x4e7a('0x32')][_0x4e7a('0x39')]('nolimit')){_0x3f2761[_0x4e7a('0x1c')]=qs[_0x4e7a('0x1c')](_0x5682a5[_0x4e7a('0x32')][_0x4e7a('0x1c')]);_0x3f2761[_0x4e7a('0x1a')]=qs['offset'](_0x5682a5['query'][_0x4e7a('0x1a')]);}_0x3f2761[_0x4e7a('0x3a')]=qs[_0x4e7a('0x3b')](_0x5682a5[_0x4e7a('0x32')][_0x4e7a('0x3b')]);_0x3f2761['where']=qs[_0x4e7a('0x34')](_[_0x4e7a('0x3c')](_0x5682a5['query'],_0x295071[_0x4e7a('0x34')]),_0x1f87a3);if(_0x5682a5[_0x4e7a('0x32')][_0x4e7a('0x3d')]){_0x3f2761['where']=_[_0x4e7a('0x3e')](_0x3f2761[_0x4e7a('0x3f')],{'$or':_[_0x4e7a('0x2c')](_0x1f87a3,function(_0x3e8943){if(_0x3e8943['type']!==_0x4e7a('0x40')){var _0x12a75f={};_0x12a75f[_0x3e8943['name']]={'$like':'%'+_0x5682a5['query']['filter']+'%'};return _0x12a75f;}})});}_0x3f2761=_['merge']({},_0x3f2761,_0x5682a5[_0x4e7a('0x41')]);var _0x20ef30={'where':_0x3f2761[_0x4e7a('0x3f')]};return db[_0x4e7a('0x2d')][_0x4e7a('0x1d')](_0x20ef30)['then'](function(_0xc13655){_0x1ed350['count']=_0xc13655;if(_0x5682a5[_0x4e7a('0x32')]['includeAll']){_0x3f2761[_0x4e7a('0x42')]=[{'all':!![]}];}return db[_0x4e7a('0x2d')]['findAll'](_0x3f2761);})['then'](function(_0x46eb6e){_0x1ed350[_0x4e7a('0x43')]=_0x46eb6e;return _0x1ed350;})[_0x4e7a('0x25')](respondWithFilteredResult(_0x29b675,_0x3f2761))[_0x4e7a('0x44')](handleError(_0x29b675,null));};exports['show']=function(_0x5e791b,_0x4ad69a){var _0x2647bf={'raw':!![],'where':{'id':_0x5e791b['params']['id']}},_0x2c3544={};_0x2c3544[_0x4e7a('0x31')]=_[_0x4e7a('0x33')](db['MailSubstatus'][_0x4e7a('0x2e')]);_0x2c3544[_0x4e7a('0x32')]=_[_0x4e7a('0x33')](_0x5e791b[_0x4e7a('0x32')]);_0x2c3544[_0x4e7a('0x34')]=_['intersection'](_0x2c3544[_0x4e7a('0x31')],_0x2c3544[_0x4e7a('0x32')]);_0x2647bf[_0x4e7a('0x36')]=_[_0x4e7a('0x35')](_0x2c3544[_0x4e7a('0x31')],qs[_0x4e7a('0x37')](_0x5e791b[_0x4e7a('0x32')][_0x4e7a('0x37')]));_0x2647bf['attributes']=_0x2647bf[_0x4e7a('0x36')][_0x4e7a('0x38')]?_0x2647bf[_0x4e7a('0x36')]:_0x2c3544[_0x4e7a('0x31')];if(_0x5e791b[_0x4e7a('0x32')][_0x4e7a('0x45')]){_0x2647bf[_0x4e7a('0x42')]=[{'all':!![]}];}_0x2647bf=_[_0x4e7a('0x3e')]({},_0x2647bf,_0x5e791b[_0x4e7a('0x41')]);return db[_0x4e7a('0x2d')][_0x4e7a('0x46')](_0x2647bf)[_0x4e7a('0x25')](handleEntityNotFound(_0x4ad69a,null))['then'](respondWithResult(_0x4ad69a,null))[_0x4e7a('0x44')](handleError(_0x4ad69a,null));};exports[_0x4e7a('0x47')]=function(_0x2d7513,_0x1ccbf1){return db[_0x4e7a('0x2d')][_0x4e7a('0x47')](_0x2d7513[_0x4e7a('0x48')],{})['then'](respondWithResult(_0x1ccbf1,0xc9))[_0x4e7a('0x44')](handleError(_0x1ccbf1,null));};exports['update']=function(_0x2bc5b7,_0x7e1345){if(_0x2bc5b7[_0x4e7a('0x48')]['id']){delete _0x2bc5b7[_0x4e7a('0x48')]['id'];}return db[_0x4e7a('0x2d')]['find']({'where':{'id':_0x2bc5b7[_0x4e7a('0x49')]['id']}})[_0x4e7a('0x25')](handleEntityNotFound(_0x7e1345,null))['then'](saveUpdates(_0x2bc5b7[_0x4e7a('0x48')],null))['then'](respondWithResult(_0x7e1345,null))['catch'](handleError(_0x7e1345,null));};exports[_0x4e7a('0x26')]=function(_0x408cd8,_0x28289a){return db['MailSubstatus'][_0x4e7a('0x46')]({'where':{'id':_0x408cd8[_0x4e7a('0x49')]['id']}})[_0x4e7a('0x25')](handleEntityNotFound(_0x28289a,null))[_0x4e7a('0x25')](removeEntity(_0x28289a,null))[_0x4e7a('0x44')](handleError(_0x28289a,null));};exports[_0x4e7a('0x4a')]=function(_0x4b0aa0,_0x36c7f5){return db[_0x4e7a('0x2d')][_0x4e7a('0x4a')]()[_0x4e7a('0x25')](respondWithResult(_0x36c7f5,null))[_0x4e7a('0x44')](handleError(_0x36c7f5,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 20e82d4..919b1ef 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 _0x5544=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0x5544,0x179));var _0x4554=function(_0xe85725,_0x51444f){_0xe85725=_0xe85725-0x0;var _0x4da671=_0x5544[_0xe85725];return _0x4da671;};'use strict';var EventEmitter=require(_0x4554('0x0'));var MailSubstatus=require(_0x4554('0x1'))['db'][_0x4554('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4554('0x3')](0x0);var events={'afterUpdate':_0x4554('0x4')};function emitEvent(_0x412f47){return function(_0x2fb92f,_0x404d2d,_0x33c144){MailSubstatusEvents['emit'](_0x412f47+':'+_0x2fb92f['id'],_0x2fb92f);MailSubstatusEvents[_0x4554('0x5')](_0x412f47,_0x2fb92f);_0x33c144(null);};}for(var e in events){if(events[_0x4554('0x6')](e)){var event=events[e];MailSubstatus[_0x4554('0x7')](e,emitEvent(event));}}module[_0x4554('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x4f3f=['hook','exports','events','../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0x20d4e7,_0x5f29f7){var _0x125131=function(_0x10dc57){while(--_0x10dc57){_0x20d4e7['push'](_0x20d4e7['shift']());}};_0x125131(++_0x5f29f7);}(_0x4f3f,0x18a));var _0xf4f3=function(_0x400fe3,_0x4a3edc){_0x400fe3=_0x400fe3-0x0;var _0x33f3ec=_0x4f3f[_0x400fe3];return _0x33f3ec;};'use strict';var EventEmitter=require(_0xf4f3('0x0'));var MailSubstatus=require(_0xf4f3('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xf4f3('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x46053a){return function(_0x2847d5,_0x51521b,_0xcfa16d){MailSubstatusEvents['emit'](_0x46053a+':'+_0x2847d5['id'],_0x2847d5);MailSubstatusEvents[_0xf4f3('0x3')](_0x46053a,_0x2847d5);_0xcfa16d(null);};}for(var e in events){if(events[_0xf4f3('0x4')](e)){var event=events[e];MailSubstatus[_0xf4f3('0x5')](e,emitEvent(event));}}module[_0xf4f3('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3de5e0b..5e6137a 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 _0xe6e4=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','mail_substatuses','update'];(function(_0x1fe714,_0x18bbf3){var _0x46f6fa=function(_0x2bf23c){while(--_0x2bf23c){_0x1fe714['push'](_0x1fe714['shift']());}};_0x46f6fa(++_0x18bbf3);}(_0xe6e4,0x139));var _0x4e6e=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xe6e4[_0x51b0dc];return _0x13fa89;};'use strict';var attributes=require(_0x4e6e('0x0'));module[_0x4e6e('0x1')]=function(_0x50908d){var _0x25db01=_0x50908d[_0x4e6e('0x2')];return _0x50908d[_0x4e6e('0x3')]('MailSubstatus',attributes,{'tableName':_0x4e6e('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x280be0,_0x44cd95,_0x28220a){return _0x25db01['Condition'][_0x4e6e('0x5')]({'value':_0x280be0[_0x4e6e('0x6')]},{'where':{'field':_0x4e6e('0x7'),'value':_0x280be0[_0x4e6e('0x8')][_0x4e6e('0x6')]}})[_0x4e6e('0x9')](function(){_0x28220a();})[_0x4e6e('0xa')](function(_0x5debaf){_0x28220a(_0x5debaf);});}}});}; \ No newline at end of file +var _0xc801=['mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus'];(function(_0x38bffd,_0x3ecb9c){var _0x4e0013=function(_0x5a0233){while(--_0x5a0233){_0x38bffd['push'](_0x38bffd['shift']());}};_0x4e0013(++_0x3ecb9c);}(_0xc801,0x174));var _0x1c80=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc801[_0x29b609];return _0x54c952;};'use strict';var attributes=require(_0x1c80('0x0'));module[_0x1c80('0x1')]=function(_0x511ea1){var _0x37d119=_0x511ea1[_0x1c80('0x2')];return _0x511ea1[_0x1c80('0x3')](_0x1c80('0x4'),attributes,{'tableName':_0x1c80('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x415c1b,_0x48c1a0,_0xba009d){return _0x37d119[_0x1c80('0x6')][_0x1c80('0x7')]({'value':_0x415c1b['name']},{'where':{'field':_0x1c80('0x8'),'value':_0x415c1b[_0x1c80('0x9')][_0x1c80('0xa')]}})[_0x1c80('0xb')](function(){_0xba009d();})[_0x1c80('0xc')](function(_0x1a2ea4){_0xba009d(_0x1a2ea4);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 79d38c4..458ba39 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 _0x92ba=['../../config/logger','rpc','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x92371c,_0x113062){var _0x2e71db=function(_0x5bedc0){while(--_0x5bedc0){_0x92371c['push'](_0x92371c['shift']());}};_0x2e71db(++_0x113062);}(_0x92ba,0x1ad));var _0xa92b=function(_0x3652c2,_0x10dddc){_0x3652c2=_0x3652c2-0x0;var _0x574ffc=_0x92ba[_0x3652c2];return _0x574ffc;};'use strict';var _=require(_0xa92b('0x0'));var util=require(_0xa92b('0x1'));var moment=require(_0xa92b('0x2'));var BPromise=require(_0xa92b('0x3'));var rs=require(_0xa92b('0x4'));var fs=require('fs');var Redis=require(_0xa92b('0x5'));var db=require(_0xa92b('0x6'))['db'];var utils=require(_0xa92b('0x7'));var logger=require(_0xa92b('0x8'))(_0xa92b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa92b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56d523,_0x326343,_0x481d0b){return new BPromise(function(_0x38fb8b,_0x3674dd){return client[_0xa92b('0xb')](_0x56d523,_0x481d0b)[_0xa92b('0xc')](function(_0x1e4986){logger[_0xa92b('0xd')](_0xa92b('0xe'),_0x326343,_0xa92b('0xf'));logger[_0xa92b('0x10')](_0xa92b('0x11'),_0x326343,_0xa92b('0xf'),JSON[_0xa92b('0x12')](_0x1e4986));if(_0x1e4986[_0xa92b('0x13')]){if(_0x1e4986[_0xa92b('0x13')][_0xa92b('0x14')]===0x1f4){logger[_0xa92b('0x13')](_0xa92b('0xe'),_0x326343,_0x1e4986['error'][_0xa92b('0x15')]);return _0x3674dd(_0x1e4986[_0xa92b('0x13')]['message']);}logger['error'](_0xa92b('0xe'),_0x326343,_0x1e4986[_0xa92b('0x13')][_0xa92b('0x15')]);return _0x38fb8b(_0x1e4986[_0xa92b('0x13')][_0xa92b('0x15')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x326343,_0xa92b('0xf'));_0x38fb8b(_0x1e4986[_0xa92b('0x16')][_0xa92b('0x15')]);}})['catch'](function(_0x237821){logger[_0xa92b('0x13')](_0xa92b('0xe'),_0x326343,_0x237821);_0x3674dd(_0x237821);});});} \ No newline at end of file +var _0xce34=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2071fa,_0x1706bc){var _0x304c51=function(_0x1aeaae){while(--_0x1aeaae){_0x2071fa['push'](_0x2071fa['shift']());}};_0x304c51(++_0x1706bc);}(_0xce34,0xdd));var _0x4ce3=function(_0x130faf,_0x20f863){_0x130faf=_0x130faf-0x0;var _0x3c4fc1=_0xce34[_0x130faf];return _0x3c4fc1;};'use strict';var _=require(_0x4ce3('0x0'));var util=require(_0x4ce3('0x1'));var moment=require(_0x4ce3('0x2'));var BPromise=require(_0x4ce3('0x3'));var rs=require(_0x4ce3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ce3('0x6'))(_0x4ce3('0x7'));var config=require(_0x4ce3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ce3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x90a724,_0x4e3819,_0x510404){return new BPromise(function(_0x781e53,_0x40314f){return client[_0x4ce3('0xa')](_0x90a724,_0x510404)[_0x4ce3('0xb')](function(_0x11e631){logger[_0x4ce3('0xc')](_0x4ce3('0xd'),_0x4e3819,'request\x20sent');logger[_0x4ce3('0xe')](_0x4ce3('0xf'),_0x4e3819,_0x4ce3('0x10'),JSON[_0x4ce3('0x11')](_0x11e631));if(_0x11e631[_0x4ce3('0x12')]){if(_0x11e631[_0x4ce3('0x12')][_0x4ce3('0x13')]===0x1f4){logger['error'](_0x4ce3('0xd'),_0x4e3819,_0x11e631[_0x4ce3('0x12')]['message']);return _0x40314f(_0x11e631[_0x4ce3('0x12')][_0x4ce3('0x14')]);}logger[_0x4ce3('0x12')](_0x4ce3('0xd'),_0x4e3819,_0x11e631[_0x4ce3('0x12')][_0x4ce3('0x14')]);return _0x781e53(_0x11e631['error'][_0x4ce3('0x14')]);}else{logger[_0x4ce3('0xc')](_0x4ce3('0xd'),_0x4e3819,_0x4ce3('0x10'));_0x781e53(_0x11e631[_0x4ce3('0x15')][_0x4ce3('0x14')]);}})['catch'](function(_0x121785){logger[_0x4ce3('0x12')](_0x4ce3('0xd'),_0x4e3819,_0x121785);_0x40314f(_0x121785);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3af514a..03944e0 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 _0xc86d=['create','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x4f9787,_0x3b16c2){var _0x1ef560=function(_0x122aab){while(--_0x122aab){_0x4f9787['push'](_0x4f9787['shift']());}};_0x1ef560(++_0x3b16c2);}(_0xc86d,0xf0));var _0xdc86=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc86d[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xdc86('0x0'));var util=require(_0xdc86('0x1'));var path=require('path');var timeout=require(_0xdc86('0x2'));var express=require(_0xdc86('0x3'));var router=express[_0xdc86('0x4')]();var fs_extra=require(_0xdc86('0x5'));var auth=require(_0xdc86('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc86('0x7'));var controller=require(_0xdc86('0x8'));router['get']('/',auth[_0xdc86('0x9')](),controller[_0xdc86('0xa')]);router[_0xdc86('0xb')](_0xdc86('0xc'),auth[_0xdc86('0x9')](),controller[_0xdc86('0xd')]);router['get'](_0xdc86('0xe'),auth[_0xdc86('0x9')](),controller['show']);router['post']('/',auth[_0xdc86('0x9')](),controller[_0xdc86('0xf')]);router['put'](_0xdc86('0xe'),auth[_0xdc86('0x9')](),controller['update']);router[_0xdc86('0x10')](_0xdc86('0xe'),auth[_0xdc86('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3153=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x138f7c,_0x374b12){var _0x45ebd5=function(_0x328876){while(--_0x328876){_0x138f7c['push'](_0x138f7c['shift']());}};_0x45ebd5(++_0x374b12);}(_0x3153,0x14c));var _0x3315=function(_0x1dbb59,_0x4ea17e){_0x1dbb59=_0x1dbb59-0x0;var _0x123dc7=_0x3153[_0x1dbb59];return _0x123dc7;};'use strict';var multer=require(_0x3315('0x0'));var util=require(_0x3315('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3315('0x2'));var router=express[_0x3315('0x3')]();var fs_extra=require(_0x3315('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3315('0x5'));var config=require(_0x3315('0x6'));var controller=require(_0x3315('0x7'));router[_0x3315('0x8')]('/',auth[_0x3315('0x9')](),controller[_0x3315('0xa')]);router[_0x3315('0x8')](_0x3315('0xb'),auth[_0x3315('0x9')](),controller[_0x3315('0xc')]);router[_0x3315('0x8')](_0x3315('0xd'),auth[_0x3315('0x9')](),controller[_0x3315('0xe')]);router[_0x3315('0xf')]('/',auth[_0x3315('0x9')](),controller[_0x3315('0x10')]);router['put'](_0x3315('0xd'),auth[_0x3315('0x9')](),controller[_0x3315('0x11')]);router[_0x3315('0x12')](_0x3315('0xd'),auth[_0x3315('0x9')](),controller['destroy']);module[_0x3315('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3b5d29c..6708806 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x363b8e,_0x165eb0){var _0x47c29c=function(_0x3f8c14){while(--_0x3f8c14){_0x363b8e['push'](_0x363b8e['shift']());}};_0x47c29c(++_0x165eb0);}(_0x70e0,0x17b));var _0x070e=function(_0x3ae530,_0x57240b){_0x3ae530=_0x3ae530-0x0;var _0x57228b=_0x70e0[_0x3ae530];return _0x57228b;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5695d0,_0x497471){var _0x877b35=function(_0x2a4a0e){while(--_0x2a4a0e){_0x5695d0['push'](_0x5695d0['shift']());}};_0x877b35(++_0x497471);}(_0x70e0,0x17b));var _0x070e=function(_0xa387d5,_0x2fff90){_0xa387d5=_0xa387d5-0x0;var _0x1228eb=_0x70e0[_0xa387d5];return _0x1228eb;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 7271aba..a877660 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 _0x9ac2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','end','error','stack','name','MailTransferReport','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf'];(function(_0x11956b,_0x2568ff){var _0x94e83c=function(_0x15ecf4){while(--_0x15ecf4){_0x11956b['push'](_0x11956b['shift']());}};_0x94e83c(++_0x2568ff);}(_0x9ac2,0xe5));var _0x29ac=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x9ac2[_0x3f9584];return _0x9d54c;};'use strict';var emlformat=require(_0x29ac('0x0'));var rimraf=require(_0x29ac('0x1'));var zipdir=require(_0x29ac('0x2'));var jsonpatch=require(_0x29ac('0x3'));var rp=require(_0x29ac('0x4'));var moment=require(_0x29ac('0x5'));var BPromise=require(_0x29ac('0x6'));var Mustache=require('mustache');var util=require(_0x29ac('0x7'));var path=require(_0x29ac('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x29ac('0x9'));var fs=require('fs');var fs_extra=require(_0x29ac('0xa'));var _=require(_0x29ac('0xb'));var squel=require(_0x29ac('0xc'));var crypto=require(_0x29ac('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x29ac('0xe'));var toCsv=require(_0x29ac('0xf'));var querystring=require(_0x29ac('0x10'));var Papa=require(_0x29ac('0x11'));var Redis=require(_0x29ac('0x12'));var authService=require(_0x29ac('0x13'));var qs=require(_0x29ac('0x14'));var as=require(_0x29ac('0x15'));var hardwareService=require(_0x29ac('0x16'));var logger=require(_0x29ac('0x17'))(_0x29ac('0x18'));var utils=require(_0x29ac('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x29ac('0x1a'));var db=require(_0x29ac('0x1b'))['db'];function respondWithStatusCode(_0x1230e4,_0x553465){_0x553465=_0x553465||0xcc;return function(_0x527f0b){if(_0x527f0b){return _0x1230e4[_0x29ac('0x1c')](_0x553465);}return _0x1230e4[_0x29ac('0x1d')](_0x553465)['end']();};}function respondWithResult(_0x1338ef,_0x43dc7c){_0x43dc7c=_0x43dc7c||0xc8;return function(_0x45a8f9){if(_0x45a8f9){return _0x1338ef[_0x29ac('0x1d')](_0x43dc7c)['json'](_0x45a8f9);}};}function respondWithFilteredResult(_0x3ab00f,_0x22460b){return function(_0x7b618d){if(_0x7b618d){var _0x14aed1=typeof _0x22460b[_0x29ac('0x1e')]===_0x29ac('0x1f')&&typeof _0x22460b[_0x29ac('0x20')]===_0x29ac('0x1f');var _0x2cdc08=_0x7b618d[_0x29ac('0x21')];var _0x532cb5=_0x14aed1?0x0:_0x22460b['offset'];var _0x23aea2=_0x14aed1?_0x7b618d[_0x29ac('0x21')]:_0x22460b[_0x29ac('0x1e')]+_0x22460b[_0x29ac('0x20')];var _0x438204;if(_0x23aea2>=_0x2cdc08){_0x23aea2=_0x2cdc08;_0x438204=0xc8;}else{_0x438204=0xce;}_0x3ab00f[_0x29ac('0x1d')](_0x438204);return _0x3ab00f[_0x29ac('0x22')](_0x29ac('0x23'),_0x532cb5+'-'+_0x23aea2+'/'+_0x2cdc08)[_0x29ac('0x24')](_0x7b618d);}return null;};}function patchUpdates(_0x3fbb61){return function(_0x3c5b6a){try{jsonpatch['apply'](_0x3c5b6a,_0x3fbb61,!![]);}catch(_0x23513f){return BPromise[_0x29ac('0x25')](_0x23513f);}return _0x3c5b6a[_0x29ac('0x26')]();};}function saveUpdates(_0x163379,_0x4d6369){return function(_0x5c2cf0){if(_0x5c2cf0){return _0x5c2cf0[_0x29ac('0x27')](_0x163379)['then'](function(_0x2d291a){return _0x2d291a;});}return null;};}function removeEntity(_0x7b2037,_0x3dd008){return function(_0x2c3480){if(_0x2c3480){return _0x2c3480['destroy']()[_0x29ac('0x28')](function(){_0x7b2037[_0x29ac('0x1d')](0xcc)[_0x29ac('0x29')]();});}};}function handleEntityNotFound(_0x2db12b,_0x5ac89d){return function(_0x580f0a){if(!_0x580f0a){_0x2db12b['sendStatus'](0x194);}return _0x580f0a;};}function handleError(_0x358c52,_0x2c45b9){_0x2c45b9=_0x2c45b9||0x1f4;return function(_0x35f0de){logger[_0x29ac('0x2a')](_0x35f0de[_0x29ac('0x2b')]);if(_0x35f0de[_0x29ac('0x2c')]){delete _0x35f0de['name'];}_0x358c52[_0x29ac('0x1d')](_0x2c45b9)['send'](_0x35f0de);};}exports['index']=function(_0x1c6967,_0x2fb1a8){var _0x304903={},_0x32bc0e={},_0x42f972={'count':0x0,'rows':[]};var _0x4c9a20=_['map'](db[_0x29ac('0x2d')][_0x29ac('0x2e')],function(_0x284179){return{'name':_0x284179['fieldName'],'type':_0x284179['type'][_0x29ac('0x2f')]};});_0x32bc0e[_0x29ac('0x30')]=_[_0x29ac('0x31')](_0x4c9a20,_0x29ac('0x2c'));_0x32bc0e[_0x29ac('0x32')]=_[_0x29ac('0x33')](_0x1c6967[_0x29ac('0x32')]);_0x32bc0e['filters']=_[_0x29ac('0x34')](_0x32bc0e[_0x29ac('0x30')],_0x32bc0e['query']);_0x304903[_0x29ac('0x35')]=_[_0x29ac('0x34')](_0x32bc0e[_0x29ac('0x30')],qs[_0x29ac('0x36')](_0x1c6967[_0x29ac('0x32')]['fields']));_0x304903[_0x29ac('0x35')]=_0x304903[_0x29ac('0x35')][_0x29ac('0x37')]?_0x304903[_0x29ac('0x35')]:_0x32bc0e[_0x29ac('0x30')];if(!_0x1c6967[_0x29ac('0x32')][_0x29ac('0x38')](_0x29ac('0x39'))){_0x304903[_0x29ac('0x20')]=qs[_0x29ac('0x20')](_0x1c6967[_0x29ac('0x32')][_0x29ac('0x20')]);_0x304903[_0x29ac('0x1e')]=qs['offset'](_0x1c6967[_0x29ac('0x32')][_0x29ac('0x1e')]);}_0x304903[_0x29ac('0x3a')]=qs[_0x29ac('0x3b')](_0x1c6967[_0x29ac('0x32')][_0x29ac('0x3b')]);_0x304903['where']=qs[_0x29ac('0x3c')](_[_0x29ac('0x3d')](_0x1c6967[_0x29ac('0x32')],_0x32bc0e[_0x29ac('0x3c')]),_0x4c9a20);if(_0x1c6967['query']['filter']){_0x304903[_0x29ac('0x3e')]=_[_0x29ac('0x3f')](_0x304903[_0x29ac('0x3e')],{'$or':_[_0x29ac('0x31')](_0x4c9a20,function(_0x2086c1){if(_0x2086c1['type']!=='VIRTUAL'){var _0xee42ac={};_0xee42ac[_0x2086c1[_0x29ac('0x2c')]]={'$like':'%'+_0x1c6967[_0x29ac('0x32')][_0x29ac('0x40')]+'%'};return _0xee42ac;}})});}_0x304903=_['merge']({},_0x304903,_0x1c6967[_0x29ac('0x41')]);var _0x28291d={'where':_0x304903['where']};return db[_0x29ac('0x2d')][_0x29ac('0x21')](_0x28291d)['then'](function(_0x1ffbbc){_0x42f972[_0x29ac('0x21')]=_0x1ffbbc;if(_0x1c6967[_0x29ac('0x32')][_0x29ac('0x42')]){_0x304903[_0x29ac('0x43')]=[{'all':!![]}];}return db[_0x29ac('0x2d')]['findAll'](_0x304903);})[_0x29ac('0x28')](function(_0x12897a){_0x42f972[_0x29ac('0x44')]=_0x12897a;return _0x42f972;})[_0x29ac('0x28')](respondWithFilteredResult(_0x2fb1a8,_0x304903))[_0x29ac('0x45')](handleError(_0x2fb1a8,null));};exports[_0x29ac('0x46')]=function(_0x10423b,_0x2d7fa2){var _0x331fc2={'raw':!![],'where':{'id':_0x10423b[_0x29ac('0x47')]['id']}},_0x3eab73={};_0x3eab73[_0x29ac('0x30')]=_[_0x29ac('0x33')](db[_0x29ac('0x2d')]['rawAttributes']);_0x3eab73['query']=_[_0x29ac('0x33')](_0x10423b[_0x29ac('0x32')]);_0x3eab73[_0x29ac('0x3c')]=_[_0x29ac('0x34')](_0x3eab73[_0x29ac('0x30')],_0x3eab73[_0x29ac('0x32')]);_0x331fc2[_0x29ac('0x35')]=_[_0x29ac('0x34')](_0x3eab73[_0x29ac('0x30')],qs[_0x29ac('0x36')](_0x10423b['query'][_0x29ac('0x36')]));_0x331fc2[_0x29ac('0x35')]=_0x331fc2[_0x29ac('0x35')]['length']?_0x331fc2[_0x29ac('0x35')]:_0x3eab73['model'];if(_0x10423b[_0x29ac('0x32')][_0x29ac('0x42')]){_0x331fc2['include']=[{'all':!![]}];}_0x331fc2=_['merge']({},_0x331fc2,_0x10423b[_0x29ac('0x41')]);return db[_0x29ac('0x2d')]['find'](_0x331fc2)['then'](handleEntityNotFound(_0x2d7fa2,null))['then'](respondWithResult(_0x2d7fa2,null))[_0x29ac('0x45')](handleError(_0x2d7fa2,null));};exports[_0x29ac('0x48')]=function(_0x1de7c3,_0x1493fa){return db['MailTransferReport']['create'](_0x1de7c3['body'],{})[_0x29ac('0x28')](respondWithResult(_0x1493fa,0xc9))[_0x29ac('0x45')](handleError(_0x1493fa,null));};exports[_0x29ac('0x27')]=function(_0x3dc229,_0x309478){if(_0x3dc229[_0x29ac('0x49')]['id']){delete _0x3dc229[_0x29ac('0x49')]['id'];}return db[_0x29ac('0x2d')][_0x29ac('0x4a')]({'where':{'id':_0x3dc229[_0x29ac('0x47')]['id']}})[_0x29ac('0x28')](handleEntityNotFound(_0x309478,null))[_0x29ac('0x28')](saveUpdates(_0x3dc229[_0x29ac('0x49')],null))[_0x29ac('0x28')](respondWithResult(_0x309478,null))[_0x29ac('0x45')](handleError(_0x309478,null));};exports[_0x29ac('0x4b')]=function(_0x2e56c0,_0x1ebb62){return db[_0x29ac('0x2d')][_0x29ac('0x4a')]({'where':{'id':_0x2e56c0[_0x29ac('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ebb62,null))['then'](removeEntity(_0x1ebb62,null))['catch'](handleError(_0x1ebb62,null));};exports[_0x29ac('0x4c')]=function(_0x51aae6,_0xf86365){return db[_0x29ac('0x2d')]['describe']()[_0x29ac('0x28')](respondWithResult(_0xf86365,null))[_0x29ac('0x45')](handleError(_0xf86365,null));}; \ No newline at end of file +var _0xf9f2=['MailTransferReport','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','moment','bluebird','util','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','map'];(function(_0x57b2fd,_0x2f7b3b){var _0xd69521=function(_0x3ab25d){while(--_0x3ab25d){_0x57b2fd['push'](_0x57b2fd['shift']());}};_0xd69521(++_0x2f7b3b);}(_0xf9f2,0x66));var _0x2f9f=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0xf9f2[_0x2053ea];return _0x2232c4;};'use strict';var emlformat=require(_0x2f9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2f9f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2f9f('0x2'));var BPromise=require(_0x2f9f('0x3'));var Mustache=require('mustache');var util=require(_0x2f9f('0x4'));var path=require('path');var sox=require(_0x2f9f('0x5'));var csv=require('to-csv');var ejs=require(_0x2f9f('0x6'));var fs=require('fs');var fs_extra=require(_0x2f9f('0x7'));var _=require(_0x2f9f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f9f('0x9'));var querystring=require(_0x2f9f('0xa'));var Papa=require(_0x2f9f('0xb'));var Redis=require(_0x2f9f('0xc'));var authService=require(_0x2f9f('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2f9f('0xe'));var utils=require(_0x2f9f('0xf'));var config=require(_0x2f9f('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f9f('0x11'))['db'];function respondWithStatusCode(_0x2a0d1a,_0x4af63d){_0x4af63d=_0x4af63d||0xcc;return function(_0x49a460){if(_0x49a460){return _0x2a0d1a[_0x2f9f('0x12')](_0x4af63d);}return _0x2a0d1a[_0x2f9f('0x13')](_0x4af63d)[_0x2f9f('0x14')]();};}function respondWithResult(_0x28982e,_0x47653c){_0x47653c=_0x47653c||0xc8;return function(_0x4f1f00){if(_0x4f1f00){return _0x28982e[_0x2f9f('0x13')](_0x47653c)[_0x2f9f('0x15')](_0x4f1f00);}};}function respondWithFilteredResult(_0x56dc19,_0x392d40){return function(_0x5ede81){if(_0x5ede81){var _0x56bb11=typeof _0x392d40[_0x2f9f('0x16')]==='undefined'&&typeof _0x392d40[_0x2f9f('0x17')]===_0x2f9f('0x18');var _0x296bbe=_0x5ede81[_0x2f9f('0x19')];var _0x43a0ce=_0x56bb11?0x0:_0x392d40[_0x2f9f('0x16')];var _0x27d61f=_0x56bb11?_0x5ede81[_0x2f9f('0x19')]:_0x392d40[_0x2f9f('0x16')]+_0x392d40['limit'];var _0x42092a;if(_0x27d61f>=_0x296bbe){_0x27d61f=_0x296bbe;_0x42092a=0xc8;}else{_0x42092a=0xce;}_0x56dc19['status'](_0x42092a);return _0x56dc19[_0x2f9f('0x1a')](_0x2f9f('0x1b'),_0x43a0ce+'-'+_0x27d61f+'/'+_0x296bbe)['json'](_0x5ede81);}return null;};}function patchUpdates(_0x35a1ab){return function(_0x152b66){try{jsonpatch[_0x2f9f('0x1c')](_0x152b66,_0x35a1ab,!![]);}catch(_0xf6411f){return BPromise[_0x2f9f('0x1d')](_0xf6411f);}return _0x152b66[_0x2f9f('0x1e')]();};}function saveUpdates(_0x349732,_0x3700a5){return function(_0x530ad5){if(_0x530ad5){return _0x530ad5[_0x2f9f('0x1f')](_0x349732)['then'](function(_0x1996d4){return _0x1996d4;});}return null;};}function removeEntity(_0x5cad36,_0x542e5d){return function(_0x41e978){if(_0x41e978){return _0x41e978[_0x2f9f('0x20')]()[_0x2f9f('0x21')](function(){_0x5cad36[_0x2f9f('0x13')](0xcc)[_0x2f9f('0x14')]();});}};}function handleEntityNotFound(_0x2cedf8,_0x38969e){return function(_0xf128b3){if(!_0xf128b3){_0x2cedf8['sendStatus'](0x194);}return _0xf128b3;};}function handleError(_0x313d49,_0x2a88bf){_0x2a88bf=_0x2a88bf||0x1f4;return function(_0x4112a0){logger[_0x2f9f('0x22')](_0x4112a0[_0x2f9f('0x23')]);if(_0x4112a0['name']){delete _0x4112a0['name'];}_0x313d49[_0x2f9f('0x13')](_0x2a88bf)[_0x2f9f('0x24')](_0x4112a0);};}exports['index']=function(_0x3eae50,_0x5c4945){var _0x57c3d7={},_0x487063={},_0x4c0837={'count':0x0,'rows':[]};var _0x2fa812=_[_0x2f9f('0x25')](db[_0x2f9f('0x26')][_0x2f9f('0x27')],function(_0x40673c){return{'name':_0x40673c[_0x2f9f('0x28')],'type':_0x40673c[_0x2f9f('0x29')]['key']};});_0x487063[_0x2f9f('0x2a')]=_['map'](_0x2fa812,_0x2f9f('0x2b'));_0x487063['query']=_[_0x2f9f('0x2c')](_0x3eae50['query']);_0x487063[_0x2f9f('0x2d')]=_[_0x2f9f('0x2e')](_0x487063[_0x2f9f('0x2a')],_0x487063[_0x2f9f('0x2f')]);_0x57c3d7['attributes']=_[_0x2f9f('0x2e')](_0x487063[_0x2f9f('0x2a')],qs[_0x2f9f('0x30')](_0x3eae50[_0x2f9f('0x2f')][_0x2f9f('0x30')]));_0x57c3d7[_0x2f9f('0x31')]=_0x57c3d7[_0x2f9f('0x31')][_0x2f9f('0x32')]?_0x57c3d7['attributes']:_0x487063['model'];if(!_0x3eae50[_0x2f9f('0x2f')][_0x2f9f('0x33')](_0x2f9f('0x34'))){_0x57c3d7[_0x2f9f('0x17')]=qs[_0x2f9f('0x17')](_0x3eae50[_0x2f9f('0x2f')][_0x2f9f('0x17')]);_0x57c3d7[_0x2f9f('0x16')]=qs[_0x2f9f('0x16')](_0x3eae50[_0x2f9f('0x2f')][_0x2f9f('0x16')]);}_0x57c3d7[_0x2f9f('0x35')]=qs[_0x2f9f('0x36')](_0x3eae50['query'][_0x2f9f('0x36')]);_0x57c3d7[_0x2f9f('0x37')]=qs[_0x2f9f('0x2d')](_[_0x2f9f('0x38')](_0x3eae50[_0x2f9f('0x2f')],_0x487063[_0x2f9f('0x2d')]),_0x2fa812);if(_0x3eae50[_0x2f9f('0x2f')][_0x2f9f('0x39')]){_0x57c3d7['where']=_[_0x2f9f('0x3a')](_0x57c3d7[_0x2f9f('0x37')],{'$or':_[_0x2f9f('0x25')](_0x2fa812,function(_0x47bcd1){if(_0x47bcd1['type']!=='VIRTUAL'){var _0x5302a0={};_0x5302a0[_0x47bcd1[_0x2f9f('0x2b')]]={'$like':'%'+_0x3eae50['query'][_0x2f9f('0x39')]+'%'};return _0x5302a0;}})});}_0x57c3d7=_[_0x2f9f('0x3a')]({},_0x57c3d7,_0x3eae50[_0x2f9f('0x3b')]);var _0x106e86={'where':_0x57c3d7['where']};return db['MailTransferReport'][_0x2f9f('0x19')](_0x106e86)[_0x2f9f('0x21')](function(_0x4bd069){_0x4c0837[_0x2f9f('0x19')]=_0x4bd069;if(_0x3eae50['query'][_0x2f9f('0x3c')]){_0x57c3d7[_0x2f9f('0x3d')]=[{'all':!![]}];}return db[_0x2f9f('0x26')][_0x2f9f('0x3e')](_0x57c3d7);})[_0x2f9f('0x21')](function(_0x36a95a){_0x4c0837['rows']=_0x36a95a;return _0x4c0837;})['then'](respondWithFilteredResult(_0x5c4945,_0x57c3d7))[_0x2f9f('0x3f')](handleError(_0x5c4945,null));};exports[_0x2f9f('0x40')]=function(_0x15de49,_0x1b1596){var _0x1940d={'raw':!![],'where':{'id':_0x15de49[_0x2f9f('0x41')]['id']}},_0x4de8f4={};_0x4de8f4[_0x2f9f('0x2a')]=_[_0x2f9f('0x2c')](db[_0x2f9f('0x26')][_0x2f9f('0x27')]);_0x4de8f4[_0x2f9f('0x2f')]=_[_0x2f9f('0x2c')](_0x15de49[_0x2f9f('0x2f')]);_0x4de8f4[_0x2f9f('0x2d')]=_[_0x2f9f('0x2e')](_0x4de8f4[_0x2f9f('0x2a')],_0x4de8f4['query']);_0x1940d[_0x2f9f('0x31')]=_[_0x2f9f('0x2e')](_0x4de8f4[_0x2f9f('0x2a')],qs[_0x2f9f('0x30')](_0x15de49[_0x2f9f('0x2f')]['fields']));_0x1940d[_0x2f9f('0x31')]=_0x1940d[_0x2f9f('0x31')][_0x2f9f('0x32')]?_0x1940d[_0x2f9f('0x31')]:_0x4de8f4[_0x2f9f('0x2a')];if(_0x15de49['query'][_0x2f9f('0x3c')]){_0x1940d['include']=[{'all':!![]}];}_0x1940d=_[_0x2f9f('0x3a')]({},_0x1940d,_0x15de49[_0x2f9f('0x3b')]);return db[_0x2f9f('0x26')]['find'](_0x1940d)[_0x2f9f('0x21')](handleEntityNotFound(_0x1b1596,null))['then'](respondWithResult(_0x1b1596,null))[_0x2f9f('0x3f')](handleError(_0x1b1596,null));};exports['create']=function(_0x5a8f59,_0x1f13fe){return db[_0x2f9f('0x26')][_0x2f9f('0x42')](_0x5a8f59['body'],{})['then'](respondWithResult(_0x1f13fe,0xc9))['catch'](handleError(_0x1f13fe,null));};exports[_0x2f9f('0x1f')]=function(_0x1809ab,_0x7c5489){if(_0x1809ab[_0x2f9f('0x43')]['id']){delete _0x1809ab[_0x2f9f('0x43')]['id'];}return db[_0x2f9f('0x26')]['find']({'where':{'id':_0x1809ab['params']['id']}})[_0x2f9f('0x21')](handleEntityNotFound(_0x7c5489,null))[_0x2f9f('0x21')](saveUpdates(_0x1809ab[_0x2f9f('0x43')],null))['then'](respondWithResult(_0x7c5489,null))[_0x2f9f('0x3f')](handleError(_0x7c5489,null));};exports[_0x2f9f('0x20')]=function(_0x299f5e,_0x3e5b9f){return db['MailTransferReport'][_0x2f9f('0x44')]({'where':{'id':_0x299f5e[_0x2f9f('0x41')]['id']}})[_0x2f9f('0x21')](handleEntityNotFound(_0x3e5b9f,null))[_0x2f9f('0x21')](removeEntity(_0x3e5b9f,null))[_0x2f9f('0x3f')](handleError(_0x3e5b9f,null));};exports[_0x2f9f('0x45')]=function(_0x4fd38a,_0x584d6c){return db[_0x2f9f('0x26')][_0x2f9f('0x45')]()['then'](respondWithResult(_0x584d6c,null))[_0x2f9f('0x3f')](handleError(_0x584d6c,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index cb2f131..502b8bf 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 _0xba0b=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','api','moment','bluebird','request-promise'];(function(_0x50f146,_0x4abe95){var _0x8475b8=function(_0x39d0b4){while(--_0x39d0b4){_0x50f146['push'](_0x50f146['shift']());}};_0x8475b8(++_0x4abe95);}(_0xba0b,0x110));var _0xbba0=function(_0x4050d1,_0x1f3e68){_0x4050d1=_0x4050d1-0x0;var _0x2f341d=_0xba0b[_0x4050d1];return _0x2f341d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbba0('0x0'));var moment=require(_0xbba0('0x1'));var BPromise=require(_0xbba0('0x2'));var rp=require(_0xbba0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbba0('0x4'));var config=require(_0xbba0('0x5'));var attributes=require(_0xbba0('0x6'));module[_0xbba0('0x7')]=function(_0x203830,_0x5bf3d2){return _0x203830[_0xbba0('0x8')](_0xbba0('0x9'),attributes,{'tableName':_0xbba0('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbba0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4eea=['../../config/logger','moment','bluebird','path','rimraf','./mailTransferReport.attributes','exports','report_mail_transfer','uniqueid','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eea,0x149));var _0xa4ee=function(_0x4ae39a,_0x11f685){_0x4ae39a=_0x4ae39a-0x0;var _0x590901=_0x4eea[_0x4ae39a];return _0x590901;};'use strict';var _=require('lodash');var util=require(_0xa4ee('0x0'));var logger=require(_0xa4ee('0x1'))('api');var moment=require(_0xa4ee('0x2'));var BPromise=require(_0xa4ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4ee('0x4'));var rimraf=require(_0xa4ee('0x5'));var config=require('../../config/environment');var attributes=require(_0xa4ee('0x6'));module[_0xa4ee('0x7')]=function(_0xa0292e,_0x58c8cf){return _0xa0292e['define']('MailTransferReport',attributes,{'tableName':_0xa4ee('0x8'),'paranoid':![],'indexes':[{'name':_0xa4ee('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index eb56c6d..7b72553 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 _0x5a5c=['error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x5a5c,0x144));var _0xc5a5=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x5a5c[_0x5ecadc];return _0x565037;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc5a5('0x0'));var rs=require(_0xc5a5('0x1'));var fs=require('fs');var Redis=require(_0xc5a5('0x2'));var db=require(_0xc5a5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5a5('0x4'))('rpc');var config=require(_0xc5a5('0x5'));var jayson=require(_0xc5a5('0x6'));var client=jayson[_0xc5a5('0x7')][_0xc5a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4029bc,_0x55ae78,_0x15aee8){return new BPromise(function(_0x177e5b,_0x1bc73b){return client[_0xc5a5('0x9')](_0x4029bc,_0x15aee8)[_0xc5a5('0xa')](function(_0x28fbc1){logger[_0xc5a5('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x55ae78,_0xc5a5('0xc'));logger[_0xc5a5('0xd')](_0xc5a5('0xe'),_0x55ae78,_0xc5a5('0xc'),JSON[_0xc5a5('0xf')](_0x28fbc1));if(_0x28fbc1[_0xc5a5('0x10')]){if(_0x28fbc1[_0xc5a5('0x10')][_0xc5a5('0x11')]===0x1f4){logger[_0xc5a5('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x55ae78,_0x28fbc1[_0xc5a5('0x10')][_0xc5a5('0x12')]);return _0x1bc73b(_0x28fbc1[_0xc5a5('0x10')]['message']);}logger[_0xc5a5('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x55ae78,_0x28fbc1[_0xc5a5('0x10')]['message']);return _0x177e5b(_0x28fbc1['error']['message']);}else{logger[_0xc5a5('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x55ae78,_0xc5a5('0xc'));_0x177e5b(_0x28fbc1['result'][_0xc5a5('0x12')]);}})[_0xc5a5('0x13')](function(_0x22a142){logger[_0xc5a5('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x55ae78,_0x22a142);_0x1bc73b(_0x22a142);});});} \ No newline at end of file +var _0x733f=['http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x733f,0xb5));var _0xf733=function(_0xca80ee,_0x204a89){_0xca80ee=_0xca80ee-0x0;var _0x42436b=_0x733f[_0xca80ee];return _0x42436b;};'use strict';var _=require(_0xf733('0x0'));var util=require('util');var moment=require(_0xf733('0x1'));var BPromise=require(_0xf733('0x2'));var rs=require(_0xf733('0x3'));var fs=require('fs');var Redis=require(_0xf733('0x4'));var db=require(_0xf733('0x5'))['db'];var utils=require(_0xf733('0x6'));var logger=require('../../config/logger')(_0xf733('0x7'));var config=require(_0xf733('0x8'));var jayson=require(_0xf733('0x9'));var client=jayson[_0xf733('0xa')][_0xf733('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e0492,_0x30bb85,_0x1cb6f0){return new BPromise(function(_0x23b7af,_0x5c3039){return client[_0xf733('0xc')](_0x1e0492,_0x1cb6f0)[_0xf733('0xd')](function(_0x2b0bf8){logger[_0xf733('0xe')](_0xf733('0xf'),_0x30bb85,'request\x20sent');logger[_0xf733('0x10')](_0xf733('0x11'),_0x30bb85,_0xf733('0x12'),JSON[_0xf733('0x13')](_0x2b0bf8));if(_0x2b0bf8[_0xf733('0x14')]){if(_0x2b0bf8[_0xf733('0x14')][_0xf733('0x15')]===0x1f4){logger[_0xf733('0x14')](_0xf733('0xf'),_0x30bb85,_0x2b0bf8['error']['message']);return _0x5c3039(_0x2b0bf8[_0xf733('0x14')]['message']);}logger['error'](_0xf733('0xf'),_0x30bb85,_0x2b0bf8[_0xf733('0x14')]['message']);return _0x23b7af(_0x2b0bf8[_0xf733('0x14')][_0xf733('0x16')]);}else{logger[_0xf733('0xe')](_0xf733('0xf'),_0x30bb85,'request\x20sent');_0x23b7af(_0x2b0bf8[_0xf733('0x17')][_0xf733('0x16')]);}})['catch'](function(_0x875e34){logger[_0xf733('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x30bb85,_0x875e34);_0x5c3039(_0x875e34);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 86ef403..d6c9130 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 _0x3f68=['/describe','isAuthenticated','describe','/:id','post','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x84901d,_0x5ef90b){var _0xaaaf3b=function(_0x1ccaa6){while(--_0x1ccaa6){_0x84901d['push'](_0x84901d['shift']());}};_0xaaaf3b(++_0x5ef90b);}(_0x3f68,0x108));var _0x83f6=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0x3f68[_0x5d3394];return _0x102ca5;};'use strict';var multer=require(_0x83f6('0x0'));var util=require('util');var path=require(_0x83f6('0x1'));var timeout=require(_0x83f6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x83f6('0x3'));var auth=require(_0x83f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x83f6('0x5'));var controller=require('./memberReport.controller');router[_0x83f6('0x6')]('/',auth['isAuthenticated'](),controller[_0x83f6('0x7')]);router[_0x83f6('0x6')](_0x83f6('0x8'),auth[_0x83f6('0x9')](),controller[_0x83f6('0xa')]);router[_0x83f6('0x6')](_0x83f6('0xb'),auth[_0x83f6('0x9')](),controller['show']);router[_0x83f6('0xc')]('/',auth[_0x83f6('0x9')](),controller['create']);router[_0x83f6('0xd')](_0x83f6('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x83f6('0xe')](_0x83f6('0xb'),auth['isAuthenticated'](),controller[_0x83f6('0xf')]);module[_0x83f6('0x10')]=router; \ No newline at end of file +var _0xbdc9=['isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','get'];(function(_0x8e4da2,_0x2fc2ab){var _0xb88369=function(_0x15ebcb){while(--_0x15ebcb){_0x8e4da2['push'](_0x8e4da2['shift']());}};_0xb88369(++_0x2fc2ab);}(_0xbdc9,0x19a));var _0x9bdc=function(_0xd5aaa,_0x5a0ab8){_0xd5aaa=_0xd5aaa-0x0;var _0x2505c1=_0xbdc9[_0xd5aaa];return _0x2505c1;};'use strict';var multer=require('multer');var util=require(_0x9bdc('0x0'));var path=require('path');var timeout=require(_0x9bdc('0x1'));var express=require(_0x9bdc('0x2'));var router=express['Router']();var fs_extra=require(_0x9bdc('0x3'));var auth=require(_0x9bdc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x9bdc('0x5')]('/',auth[_0x9bdc('0x6')](),controller['index']);router[_0x9bdc('0x5')](_0x9bdc('0x7'),auth[_0x9bdc('0x6')](),controller[_0x9bdc('0x8')]);router[_0x9bdc('0x5')](_0x9bdc('0x9'),auth[_0x9bdc('0x6')](),controller[_0x9bdc('0xa')]);router['post']('/',auth[_0x9bdc('0x6')](),controller['create']);router[_0x9bdc('0xb')]('/:id',auth[_0x9bdc('0x6')](),controller[_0x9bdc('0xc')]);router[_0x9bdc('0xd')]('/:id',auth[_0x9bdc('0x6')](),controller[_0x9bdc('0xe')]);module[_0x9bdc('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index cd5d941..ff0e8f6 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 _0x660a=['getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x660a,0xba));var _0xa660=function(_0x32b79a,_0xd2538a){_0x32b79a=_0x32b79a-0x0;var _0x483450=_0x660a[_0x32b79a];return _0x483450;};'use strict';var Sequelize=require(_0xa660('0x0'));var moment=require('moment');module[_0xa660('0x1')]={'channel':{'type':Sequelize[_0xa660('0x2')]},'membername':{'type':Sequelize[_0xa660('0x2')]},'interface':{'type':Sequelize[_0xa660('0x2')]},'type':{'type':Sequelize[_0xa660('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xa660('0x3')},'duration':{'type':Sequelize[_0xa660('0x4')]},'enterAt':{'type':Sequelize[_0xa660('0x5')]},'exitAt':{'type':Sequelize[_0xa660('0x5')],'set':function(_0x270ae5){var _0x4ef713=moment(_0x270ae5);var _0x180f58=moment(this[_0xa660('0x6')](_0xa660('0x7')));var _0x37a7aa=_0x4ef713[_0xa660('0x8')](_0x180f58,_0xa660('0x9'));this[_0xa660('0xa')](_0xa660('0xb'),_0x270ae5);this[_0xa660('0xa')](_0xa660('0xc'),_0x37a7aa>=0x0?_0x37a7aa:null);}},'data1':{'type':Sequelize[_0xa660('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xa660('0x2')],'comment':_0xa660('0xd')},'data3':{'type':Sequelize[_0xa660('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xa660('0x2')],'comment':_0xa660('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0xa660('0xf')},'role':{'type':Sequelize[_0xa660('0x2')]},'internal':{'type':Sequelize[_0xa660('0x4')]},'uniqueid':{'type':Sequelize[_0xa660('0x2')]}}; \ No newline at end of file +var _0x2855=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2855,0x8c));var _0x5285=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x2855[_0x368bba];return _0x409f8f;};'use strict';var Sequelize=require(_0x5285('0x0'));var moment=require(_0x5285('0x1'));module[_0x5285('0x2')]={'channel':{'type':Sequelize[_0x5285('0x3')]},'membername':{'type':Sequelize[_0x5285('0x3')]},'interface':{'type':Sequelize[_0x5285('0x3')]},'type':{'type':Sequelize[_0x5285('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x5285('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5285('0x5')],'set':function(_0xf6f02e){var _0x1c93b9=moment(_0xf6f02e);var _0x24872d=moment(this[_0x5285('0x6')](_0x5285('0x7')));var _0x4e551c=_0x1c93b9[_0x5285('0x8')](_0x24872d,_0x5285('0x9'));this[_0x5285('0xa')]('exitAt',_0xf6f02e);this[_0x5285('0xa')](_0x5285('0xb'),_0x4e551c>=0x0?_0x4e551c:null);}},'data1':{'type':Sequelize[_0x5285('0x3')],'comment':_0x5285('0xc')},'data2':{'type':Sequelize[_0x5285('0x3')],'comment':_0x5285('0xd')},'data3':{'type':Sequelize[_0x5285('0x3')],'comment':_0x5285('0xe')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x5285('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x5285('0x4')]},'uniqueid':{'type':Sequelize[_0x5285('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b1531b7..4e8b96a 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(_0x1c013d,_0x15a3df){var _0xda7764=function(_0x5a8889){while(--_0x5a8889){_0x1c013d['push'](_0x1c013d['shift']());}};_0xda7764(++_0x15a3df);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x34e8,0x12c));var _0x834e=function(_0x5d702c,_0xf8db65){_0x5d702c=_0x5d702c-0x0;var _0x3459a6=_0x34e8[_0x5d702c];return _0x3459a6;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a2c6c44..2b68876 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 _0x4677=['exports','MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x47ade6,_0x27e7f5){var _0x3ad765=function(_0x473632){while(--_0x473632){_0x47ade6['push'](_0x47ade6['shift']());}};_0x3ad765(++_0x27e7f5);}(_0x4677,0x105));var _0x7467=function(_0xa6f2d,_0x15fd19){_0xa6f2d=_0xa6f2d-0x0;var _0x2078b7=_0x4677[_0xa6f2d];return _0x2078b7;};'use strict';var _=require(_0x7467('0x0'));var util=require(_0x7467('0x1'));var logger=require(_0x7467('0x2'))(_0x7467('0x3'));var moment=require(_0x7467('0x4'));var BPromise=require(_0x7467('0x5'));var rp=require(_0x7467('0x6'));var fs=require('fs');var path=require(_0x7467('0x7'));var rimraf=require(_0x7467('0x8'));var config=require(_0x7467('0x9'));var attributes=require(_0x7467('0xa'));module[_0x7467('0xb')]=function(_0x22af71,_0xf8b5c0){return _0x22af71['define'](_0x7467('0xc'),attributes,{'tableName':_0x7467('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x7467('0xe'),_0x7467('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9152=['request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','lodash','util','../../config/logger','api','bluebird'];(function(_0xc82c48,_0x389d70){var _0x31c073=function(_0x1eae1c){while(--_0x1eae1c){_0xc82c48['push'](_0xc82c48['shift']());}};_0x31c073(++_0x389d70);}(_0x9152,0xbf));var _0x2915=function(_0xf48a01,_0x592423){_0xf48a01=_0xf48a01-0x0;var _0x6fea47=_0x9152[_0xf48a01];return _0x6fea47;};'use strict';var _=require(_0x2915('0x0'));var util=require(_0x2915('0x1'));var logger=require(_0x2915('0x2'))(_0x2915('0x3'));var moment=require('moment');var BPromise=require(_0x2915('0x4'));var rp=require(_0x2915('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2915('0x6'));var config=require(_0x2915('0x7'));var attributes=require(_0x2915('0x8'));module[_0x2915('0x9')]=function(_0xf840d6,_0x1a9919){return _0xf840d6[_0x2915('0xa')](_0x2915('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x2915('0xc'),'fields':[_0x2915('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index acd0eb7..1246cfb 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 _0x7e02=['GetMemberReport','body','CreateMemberReport','limit','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','MemberReport','findAll','options','raw','where','attributes','map','include','model'];(function(_0x137e25,_0x3cd554){var _0x2483c7=function(_0x5ebbf6){while(--_0x5ebbf6){_0x137e25['push'](_0x137e25['shift']());}};_0x2483c7(++_0x3cd554);}(_0x7e02,0x71));var _0x27e0=function(_0x1d1fa6,_0x331dc0){_0x1d1fa6=_0x1d1fa6-0x0;var _0x5e1a83=_0x7e02[_0x1d1fa6];return _0x5e1a83;};'use strict';var _=require(_0x27e0('0x0'));var util=require(_0x27e0('0x1'));var moment=require(_0x27e0('0x2'));var BPromise=require(_0x27e0('0x3'));var rs=require(_0x27e0('0x4'));var fs=require('fs');var Redis=require(_0x27e0('0x5'));var db=require(_0x27e0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x27e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x27e0('0x8'));var client=jayson[_0x27e0('0x9')][_0x27e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cc944,_0x32bc79,_0x2dff51){return new BPromise(function(_0x44ae54,_0x272efb){return client['request'](_0x1cc944,_0x2dff51)[_0x27e0('0xb')](function(_0x5ec050){logger[_0x27e0('0xc')](_0x27e0('0xd'),_0x32bc79,'request\x20sent');logger[_0x27e0('0xe')](_0x27e0('0xf'),_0x32bc79,_0x27e0('0x10'),JSON[_0x27e0('0x11')](_0x5ec050));if(_0x5ec050[_0x27e0('0x12')]){if(_0x5ec050[_0x27e0('0x12')][_0x27e0('0x13')]===0x1f4){logger[_0x27e0('0x12')](_0x27e0('0xd'),_0x32bc79,_0x5ec050['error'][_0x27e0('0x14')]);return _0x272efb(_0x5ec050[_0x27e0('0x12')][_0x27e0('0x14')]);}logger['error'](_0x27e0('0xd'),_0x32bc79,_0x5ec050[_0x27e0('0x12')][_0x27e0('0x14')]);return _0x44ae54(_0x5ec050['error'][_0x27e0('0x14')]);}else{logger[_0x27e0('0xc')](_0x27e0('0xd'),_0x32bc79,_0x27e0('0x10'));_0x44ae54(_0x5ec050['result']['message']);}})[_0x27e0('0x15')](function(_0xe6b7b1){logger[_0x27e0('0x12')](_0x27e0('0xd'),_0x32bc79,_0xe6b7b1);_0x272efb(_0xe6b7b1);});});}exports['GetMemberReport']=function(_0x32597b){var _0x20a4cc=this;return new Promise(function(_0x12a91f,_0x1e141f){return db[_0x27e0('0x16')][_0x27e0('0x17')]({'raw':_0x32597b['options']?_0x32597b[_0x27e0('0x18')][_0x27e0('0x19')]===undefined?!![]:![]:!![],'where':_0x32597b['options']?_0x32597b[_0x27e0('0x18')][_0x27e0('0x1a')]||null:null,'attributes':_0x32597b[_0x27e0('0x18')]?_0x32597b[_0x27e0('0x18')][_0x27e0('0x1b')]||null:null,'limit':_0x32597b['options']?_0x32597b['options']['limit']||null:null,'include':_0x32597b[_0x27e0('0x18')]?_0x32597b[_0x27e0('0x18')]['include']?_[_0x27e0('0x1c')](_0x32597b[_0x27e0('0x18')][_0x27e0('0x1d')],function(_0x6f83ee){return{'model':db[_0x6f83ee[_0x27e0('0x1e')]],'as':_0x6f83ee['as'],'attributes':_0x6f83ee[_0x27e0('0x1b')],'include':_0x6f83ee[_0x27e0('0x1d')]?_[_0x27e0('0x1c')](_0x6f83ee[_0x27e0('0x1d')],function(_0x3068c4){return{'model':db[_0x3068c4[_0x27e0('0x1e')]],'as':_0x3068c4['as'],'attributes':_0x3068c4[_0x27e0('0x1b')],'include':_0x3068c4[_0x27e0('0x1d')]?_[_0x27e0('0x1c')](_0x3068c4[_0x27e0('0x1d')],function(_0x581ec9){return{'model':db[_0x581ec9[_0x27e0('0x1e')]],'as':_0x581ec9['as'],'attributes':_0x581ec9[_0x27e0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x27e0('0xb')](function(_0x7e00da){logger[_0x27e0('0xc')]('GetMemberReport',_0x32597b);logger['debug'](_0x27e0('0x1f'),_0x32597b,JSON[_0x27e0('0x11')](_0x7e00da));_0x12a91f(_0x7e00da);})[_0x27e0('0x15')](function(_0x304fe6){logger['error']('GetMemberReport',_0x304fe6[_0x27e0('0x14')],_0x32597b);_0x1e141f(_0x20a4cc[_0x27e0('0x12')](0x1f4,_0x304fe6['message']));});});};exports['CreateMemberReport']=function(_0x551794){var _0xdedb73=this;return new Promise(function(_0x384e11,_0x24605a){return db[_0x27e0('0x16')]['create'](_0x551794[_0x27e0('0x20')],{'raw':_0x551794[_0x27e0('0x18')]?_0x551794[_0x27e0('0x18')][_0x27e0('0x19')]===undefined?!![]:![]:!![]})[_0x27e0('0xb')](function(_0x2c98bd){logger[_0x27e0('0xc')](_0x27e0('0x21'),_0x551794);logger[_0x27e0('0xe')](_0x27e0('0x21'),_0x551794,JSON['stringify'](_0x2c98bd));_0x384e11(_0x2c98bd);})[_0x27e0('0x15')](function(_0xecebf7){logger['error']('CreateMemberReport',_0xecebf7[_0x27e0('0x14')],_0x551794);_0x24605a(_0xdedb73[_0x27e0('0x12')](0x1f4,_0xecebf7[_0x27e0('0x14')]));});});};exports['UpdateMemberReport']=function(_0x17e020){var _0x10eb01=this;return new Promise(function(_0x4d26f7,_0x352679){return db[_0x27e0('0x16')]['update'](_0x17e020[_0x27e0('0x20')],{'raw':_0x17e020[_0x27e0('0x18')]?_0x17e020['options'][_0x27e0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e020[_0x27e0('0x18')]?_0x17e020['options']['where']||null:null,'attributes':_0x17e020[_0x27e0('0x18')]?_0x17e020[_0x27e0('0x18')][_0x27e0('0x1b')]||null:null,'limit':_0x17e020[_0x27e0('0x18')]?_0x17e020['options'][_0x27e0('0x22')]||null:null})['then'](function(_0x3f1d73){logger[_0x27e0('0xc')](_0x27e0('0x23'),_0x17e020);logger['debug'](_0x27e0('0x23'),_0x17e020,JSON[_0x27e0('0x11')](_0x3f1d73));_0x4d26f7(_0x3f1d73);})['catch'](function(_0x4cf35f){logger[_0x27e0('0x12')](_0x27e0('0x23'),_0x4cf35f[_0x27e0('0x14')],_0x17e020);_0x352679(_0x10eb01[_0x27e0('0x12')](0x1f4,_0x4cf35f['message']));});});}; \ No newline at end of file +var _0xeda8=['findAll','options','raw','where','limit','include','model','map','attributes','then','CreateMemberReport','UpdateMemberReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','info','result','catch','GetMemberReport','MemberReport'];(function(_0xc0f72c,_0x108c3c){var _0x49ff6b=function(_0x557ac1){while(--_0x557ac1){_0xc0f72c['push'](_0xc0f72c['shift']());}};_0x49ff6b(++_0x108c3c);}(_0xeda8,0x104));var _0x8eda=function(_0x2a37d8,_0x123000){_0x2a37d8=_0x2a37d8-0x0;var _0x10b5a7=_0xeda8[_0x2a37d8];return _0x10b5a7;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('MemberReport,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('MemberReport,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});}exports[_0x8eda('0x19')]=function(_0x2a4d2b){var _0x496c77=this;return new Promise(function(_0x5e44b7,_0x6a6282){return db[_0x8eda('0x1a')][_0x8eda('0x1b')]({'raw':_0x2a4d2b[_0x8eda('0x1c')]?_0x2a4d2b[_0x8eda('0x1c')][_0x8eda('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a4d2b[_0x8eda('0x1c')]?_0x2a4d2b[_0x8eda('0x1c')][_0x8eda('0x1e')]||null:null,'attributes':_0x2a4d2b[_0x8eda('0x1c')]?_0x2a4d2b[_0x8eda('0x1c')]['attributes']||null:null,'limit':_0x2a4d2b[_0x8eda('0x1c')]?_0x2a4d2b['options'][_0x8eda('0x1f')]||null:null,'include':_0x2a4d2b['options']?_0x2a4d2b[_0x8eda('0x1c')][_0x8eda('0x20')]?_['map'](_0x2a4d2b['options']['include'],function(_0x2a4c99){return{'model':db[_0x2a4c99[_0x8eda('0x21')]],'as':_0x2a4c99['as'],'attributes':_0x2a4c99['attributes'],'include':_0x2a4c99[_0x8eda('0x20')]?_[_0x8eda('0x22')](_0x2a4c99['include'],function(_0x25e955){return{'model':db[_0x25e955[_0x8eda('0x21')]],'as':_0x25e955['as'],'attributes':_0x25e955[_0x8eda('0x23')],'include':_0x25e955[_0x8eda('0x20')]?_[_0x8eda('0x22')](_0x25e955['include'],function(_0x41b5a9){return{'model':db[_0x41b5a9['model']],'as':_0x41b5a9['as'],'attributes':_0x41b5a9[_0x8eda('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8eda('0x24')](function(_0x8337b4){logger['info'](_0x8eda('0x19'),_0x2a4d2b);logger[_0x8eda('0xf')](_0x8eda('0x19'),_0x2a4d2b,JSON['stringify'](_0x8337b4));_0x5e44b7(_0x8337b4);})[_0x8eda('0x18')](function(_0x11a999){logger['error'](_0x8eda('0x19'),_0x11a999[_0x8eda('0x15')],_0x2a4d2b);_0x6a6282(_0x496c77[_0x8eda('0x12')](0x1f4,_0x11a999[_0x8eda('0x15')]));});});};exports['CreateMemberReport']=function(_0x58dd55){var _0x54513c=this;return new Promise(function(_0x2611c6,_0x1c1cda){return db[_0x8eda('0x1a')]['create'](_0x58dd55['body'],{'raw':_0x58dd55['options']?_0x58dd55[_0x8eda('0x1c')][_0x8eda('0x1d')]===undefined?!![]:![]:!![]})[_0x8eda('0x24')](function(_0x47b64f){logger['info']('CreateMemberReport',_0x58dd55);logger[_0x8eda('0xf')](_0x8eda('0x25'),_0x58dd55,JSON[_0x8eda('0x11')](_0x47b64f));_0x2611c6(_0x47b64f);})[_0x8eda('0x18')](function(_0x3291b2){logger[_0x8eda('0x12')](_0x8eda('0x25'),_0x3291b2[_0x8eda('0x15')],_0x58dd55);_0x1c1cda(_0x54513c[_0x8eda('0x12')](0x1f4,_0x3291b2[_0x8eda('0x15')]));});});};exports[_0x8eda('0x26')]=function(_0x3132fd){var _0xc354d9=this;return new Promise(function(_0x34d24c,_0x4888bd){return db[_0x8eda('0x1a')][_0x8eda('0x27')](_0x3132fd[_0x8eda('0x28')],{'raw':_0x3132fd['options']?_0x3132fd['options'][_0x8eda('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3132fd[_0x8eda('0x1c')]?_0x3132fd[_0x8eda('0x1c')][_0x8eda('0x1e')]||null:null,'attributes':_0x3132fd['options']?_0x3132fd[_0x8eda('0x1c')][_0x8eda('0x23')]||null:null,'limit':_0x3132fd[_0x8eda('0x1c')]?_0x3132fd[_0x8eda('0x1c')][_0x8eda('0x1f')]||null:null})[_0x8eda('0x24')](function(_0x52ab6d){logger[_0x8eda('0x16')](_0x8eda('0x26'),_0x3132fd);logger[_0x8eda('0xf')](_0x8eda('0x26'),_0x3132fd,JSON[_0x8eda('0x11')](_0x52ab6d));_0x34d24c(_0x52ab6d);})[_0x8eda('0x18')](function(_0x54e1db){logger[_0x8eda('0x12')](_0x8eda('0x26'),_0x54e1db[_0x8eda('0x15')],_0x3132fd);_0x4888bd(_0xc354d9[_0x8eda('0x12')](0x1f4,_0x54e1db[_0x8eda('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 640a104..220576c 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 _0x1977=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x1977,0x141));var _0x7197=function(_0x1bca15,_0x1abc8d){_0x1bca15=_0x1bca15-0x0;var _0x1ed457=_0x1977[_0x1bca15];return _0x1ed457;};'use strict';var multer=require(_0x7197('0x0'));var util=require(_0x7197('0x1'));var path=require(_0x7197('0x2'));var timeout=require(_0x7197('0x3'));var express=require(_0x7197('0x4'));var router=express[_0x7197('0x5')]();var fs_extra=require(_0x7197('0x6'));var auth=require(_0x7197('0x7'));var interaction=require(_0x7197('0x8'));var config=require(_0x7197('0x9'));var controller=require(_0x7197('0xa'));router[_0x7197('0xb')]('/',controller[_0x7197('0xc')]);module[_0x7197('0xd')]=router; \ No newline at end of file +var _0xec90=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','connect-timeout','express'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0xec90,0x19c));var _0x0ec9=function(_0x50f6e5,_0x151ccb){_0x50f6e5=_0x50f6e5-0x0;var _0x5988c5=_0xec90[_0x50f6e5];return _0x5988c5;};'use strict';var multer=require(_0x0ec9('0x0'));var util=require(_0x0ec9('0x1'));var path=require('path');var timeout=require(_0x0ec9('0x2'));var express=require(_0x0ec9('0x3'));var router=express[_0x0ec9('0x4')]();var fs_extra=require(_0x0ec9('0x5'));var auth=require(_0x0ec9('0x6'));var interaction=require(_0x0ec9('0x7'));var config=require(_0x0ec9('0x8'));var controller=require(_0x0ec9('0x9'));router[_0x0ec9('0xa')]('/',controller[_0x0ec9('0xb')]);module[_0x0ec9('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 1d52d89..a38c716 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 _0x93d8=['sequelize','exports','version'];(function(_0x24f51f,_0x5e2566){var _0x13c24c=function(_0x23c5a2){while(--_0x23c5a2){_0x24f51f['push'](_0x24f51f['shift']());}};_0x13c24c(++_0x5e2566);}(_0x93d8,0xba));var _0x893d=function(_0x119f17,_0x183d49){_0x119f17=_0x119f17-0x0;var _0x5d8214=_0x93d8[_0x119f17];return _0x5d8214;};'use strict';var Sequelize=require(_0x893d('0x0'));module[_0x893d('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x893d('0x2')}}; \ No newline at end of file +var _0x6e20=['version','exports'];(function(_0x3846af,_0x333415){var _0x234f60=function(_0x112b37){while(--_0x112b37){_0x3846af['push'](_0x3846af['shift']());}};_0x234f60(++_0x333415);}(_0x6e20,0x115));var _0x06e2=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x6e20[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require('sequelize');module[_0x06e2('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x06e2('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index fef391e..0d20779 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 _0xc39a=['save','update','then','error','stack','name','index','map','Migration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject'];(function(_0x13e204,_0xd7e069){var _0xc65720=function(_0x241828){while(--_0x241828){_0x13e204['push'](_0x13e204['shift']());}};_0xc65720(++_0xd7e069);}(_0xc39a,0x64));var _0xac39=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xc39a[_0x34bc6c];return _0x168820;};'use strict';var emlformat=require(_0xac39('0x0'));var rimraf=require(_0xac39('0x1'));var zipdir=require(_0xac39('0x2'));var jsonpatch=require(_0xac39('0x3'));var rp=require('request-promise');var moment=require(_0xac39('0x4'));var BPromise=require(_0xac39('0x5'));var Mustache=require(_0xac39('0x6'));var util=require('util');var path=require(_0xac39('0x7'));var sox=require(_0xac39('0x8'));var csv=require(_0xac39('0x9'));var ejs=require(_0xac39('0xa'));var fs=require('fs');var fs_extra=require(_0xac39('0xb'));var _=require('lodash');var squel=require(_0xac39('0xc'));var crypto=require('crypto');var jsforce=require(_0xac39('0xd'));var deskjs=require(_0xac39('0xe'));var toCsv=require('to-csv');var querystring=require(_0xac39('0xf'));var Papa=require(_0xac39('0x10'));var Redis=require('ioredis');var authService=require(_0xac39('0x11'));var qs=require(_0xac39('0x12'));var as=require(_0xac39('0x13'));var hardwareService=require(_0xac39('0x14'));var logger=require(_0xac39('0x15'))(_0xac39('0x16'));var utils=require(_0xac39('0x17'));var config=require(_0xac39('0x18'));var licenseUtil=require(_0xac39('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c797e,_0x1d1492){_0x1d1492=_0x1d1492||0xcc;return function(_0x4c3802){if(_0x4c3802){return _0x2c797e[_0xac39('0x1a')](_0x1d1492);}return _0x2c797e[_0xac39('0x1b')](_0x1d1492)[_0xac39('0x1c')]();};}function respondWithResult(_0xee4d38,_0xf286c6){_0xf286c6=_0xf286c6||0xc8;return function(_0x101d20){if(_0x101d20){return _0xee4d38[_0xac39('0x1b')](_0xf286c6)['json'](_0x101d20);}};}function respondWithFilteredResult(_0x50db6c,_0x59917e){return function(_0x5cddd2){if(_0x5cddd2){var _0x2e8410=typeof _0x59917e[_0xac39('0x1d')]==='undefined'&&typeof _0x59917e[_0xac39('0x1e')]==='undefined';var _0x1f3db9=_0x5cddd2['count'];var _0x5193db=_0x2e8410?0x0:_0x59917e[_0xac39('0x1d')];var _0x34b0a3=_0x2e8410?_0x5cddd2[_0xac39('0x1f')]:_0x59917e['offset']+_0x59917e[_0xac39('0x1e')];var _0x10c9a4;if(_0x34b0a3>=_0x1f3db9){_0x34b0a3=_0x1f3db9;_0x10c9a4=0xc8;}else{_0x10c9a4=0xce;}_0x50db6c[_0xac39('0x1b')](_0x10c9a4);return _0x50db6c['set'](_0xac39('0x20'),_0x5193db+'-'+_0x34b0a3+'/'+_0x1f3db9)[_0xac39('0x21')](_0x5cddd2);}return null;};}function patchUpdates(_0x3ae806){return function(_0x3ce9e6){try{jsonpatch[_0xac39('0x22')](_0x3ce9e6,_0x3ae806,!![]);}catch(_0x138a0b){return BPromise[_0xac39('0x23')](_0x138a0b);}return _0x3ce9e6[_0xac39('0x24')]();};}function saveUpdates(_0x4f8ec2,_0x3cf095){return function(_0x1c7c0f){if(_0x1c7c0f){return _0x1c7c0f[_0xac39('0x25')](_0x4f8ec2)['then'](function(_0x127b9e){return _0x127b9e;});}return null;};}function removeEntity(_0x59ce96,_0x5e997a){return function(_0x1065c9){if(_0x1065c9){return _0x1065c9['destroy']()[_0xac39('0x26')](function(){_0x59ce96[_0xac39('0x1b')](0xcc)[_0xac39('0x1c')]();});}};}function handleEntityNotFound(_0x35cbba,_0x1d2e07){return function(_0x51adb4){if(!_0x51adb4){_0x35cbba['sendStatus'](0x194);}return _0x51adb4;};}function handleError(_0x426b8e,_0x525a79){_0x525a79=_0x525a79||0x1f4;return function(_0x2ea860){logger[_0xac39('0x27')](_0x2ea860[_0xac39('0x28')]);if(_0x2ea860[_0xac39('0x29')]){delete _0x2ea860[_0xac39('0x29')];}_0x426b8e[_0xac39('0x1b')](_0x525a79)['send'](_0x2ea860);};}exports[_0xac39('0x2a')]=function(_0xcc7fa,_0x2594e3){var _0x397304={},_0x24ad51={},_0x422bf9={'count':0x0,'rows':[]};var _0x183198=_[_0xac39('0x2b')](db[_0xac39('0x2c')][_0xac39('0x2d')],function(_0x18bd01){return{'name':_0x18bd01[_0xac39('0x2e')],'type':_0x18bd01[_0xac39('0x2f')]['key']};});_0x24ad51[_0xac39('0x30')]=_['map'](_0x183198,_0xac39('0x29'));_0x24ad51[_0xac39('0x31')]=_['keys'](_0xcc7fa[_0xac39('0x31')]);_0x24ad51[_0xac39('0x32')]=_[_0xac39('0x33')](_0x24ad51[_0xac39('0x30')],_0x24ad51[_0xac39('0x31')]);_0x397304[_0xac39('0x34')]=_[_0xac39('0x33')](_0x24ad51[_0xac39('0x30')],qs[_0xac39('0x35')](_0xcc7fa[_0xac39('0x31')][_0xac39('0x35')]));_0x397304[_0xac39('0x34')]=_0x397304[_0xac39('0x34')][_0xac39('0x36')]?_0x397304[_0xac39('0x34')]:_0x24ad51['model'];if(!_0xcc7fa[_0xac39('0x31')][_0xac39('0x37')](_0xac39('0x38'))){_0x397304['limit']=qs[_0xac39('0x1e')](_0xcc7fa[_0xac39('0x31')][_0xac39('0x1e')]);_0x397304[_0xac39('0x1d')]=qs[_0xac39('0x1d')](_0xcc7fa[_0xac39('0x31')][_0xac39('0x1d')]);}_0x397304['order']=qs['sort'](_0xcc7fa[_0xac39('0x31')][_0xac39('0x39')]);_0x397304[_0xac39('0x3a')]=qs[_0xac39('0x32')](_[_0xac39('0x3b')](_0xcc7fa[_0xac39('0x31')],_0x24ad51['filters']),_0x183198);if(_0xcc7fa[_0xac39('0x31')][_0xac39('0x3c')]){_0x397304[_0xac39('0x3a')]=_[_0xac39('0x3d')](_0x397304[_0xac39('0x3a')],{'$or':_['map'](_0x183198,function(_0x311175){if(_0x311175[_0xac39('0x2f')]!==_0xac39('0x3e')){var _0x458072={};_0x458072[_0x311175[_0xac39('0x29')]]={'$like':'%'+_0xcc7fa[_0xac39('0x31')]['filter']+'%'};return _0x458072;}})});}_0x397304=_[_0xac39('0x3d')]({},_0x397304,_0xcc7fa[_0xac39('0x3f')]);var _0x3713b4={'where':_0x397304['where']};return db[_0xac39('0x2c')][_0xac39('0x1f')](_0x3713b4)[_0xac39('0x26')](function(_0x361532){_0x422bf9[_0xac39('0x1f')]=_0x361532;if(_0xcc7fa[_0xac39('0x31')][_0xac39('0x40')]){_0x397304['include']=[{'all':!![]}];}return db[_0xac39('0x2c')][_0xac39('0x41')](_0x397304);})[_0xac39('0x26')](function(_0x55fb8e){_0x422bf9[_0xac39('0x42')]=_0x55fb8e;return _0x422bf9;})[_0xac39('0x26')](respondWithFilteredResult(_0x2594e3,_0x397304))[_0xac39('0x43')](handleError(_0x2594e3,null));}; \ No newline at end of file +var _0x40d9=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','update','then','destroy','name','index','map','Migration','rawAttributes','type','key','query','keys','filters'];(function(_0x43c5b4,_0x45f8ec){var _0x162684=function(_0x392f4d){while(--_0x392f4d){_0x43c5b4['push'](_0x43c5b4['shift']());}};_0x162684(++_0x45f8ec);}(_0x40d9,0x1ad));var _0x940d=function(_0x378a76,_0x511262){_0x378a76=_0x378a76-0x0;var _0x564bc0=_0x40d9[_0x378a76];return _0x564bc0;};'use strict';var emlformat=require(_0x940d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x940d('0x1'));var jsonpatch=require(_0x940d('0x2'));var rp=require(_0x940d('0x3'));var moment=require('moment');var BPromise=require(_0x940d('0x4'));var Mustache=require(_0x940d('0x5'));var util=require(_0x940d('0x6'));var path=require(_0x940d('0x7'));var sox=require('sox');var csv=require(_0x940d('0x8'));var ejs=require(_0x940d('0x9'));var fs=require('fs');var fs_extra=require(_0x940d('0xa'));var _=require('lodash');var squel=require(_0x940d('0xb'));var crypto=require(_0x940d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x940d('0xd'));var toCsv=require(_0x940d('0x8'));var querystring=require(_0x940d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x940d('0xf'));var qs=require(_0x940d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x940d('0x11'));var logger=require('../../config/logger')(_0x940d('0x12'));var utils=require('../../config/utils');var config=require(_0x940d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x940d('0x14'))['db'];function respondWithStatusCode(_0x4cc042,_0x455e42){_0x455e42=_0x455e42||0xcc;return function(_0x58f7b1){if(_0x58f7b1){return _0x4cc042[_0x940d('0x15')](_0x455e42);}return _0x4cc042[_0x940d('0x16')](_0x455e42)[_0x940d('0x17')]();};}function respondWithResult(_0x2e209f,_0x5c583b){_0x5c583b=_0x5c583b||0xc8;return function(_0x228c75){if(_0x228c75){return _0x2e209f[_0x940d('0x16')](_0x5c583b)[_0x940d('0x18')](_0x228c75);}};}function respondWithFilteredResult(_0xacb95,_0x28eeef){return function(_0x2b8ee8){if(_0x2b8ee8){var _0x49fd3a=typeof _0x28eeef[_0x940d('0x19')]==='undefined'&&typeof _0x28eeef['limit']===_0x940d('0x1a');var _0x412a44=_0x2b8ee8[_0x940d('0x1b')];var _0xbfaba2=_0x49fd3a?0x0:_0x28eeef[_0x940d('0x19')];var _0x1820b4=_0x49fd3a?_0x2b8ee8[_0x940d('0x1b')]:_0x28eeef[_0x940d('0x19')]+_0x28eeef[_0x940d('0x1c')];var _0x5537cd;if(_0x1820b4>=_0x412a44){_0x1820b4=_0x412a44;_0x5537cd=0xc8;}else{_0x5537cd=0xce;}_0xacb95['status'](_0x5537cd);return _0xacb95['set']('Content-Range',_0xbfaba2+'-'+_0x1820b4+'/'+_0x412a44)[_0x940d('0x18')](_0x2b8ee8);}return null;};}function patchUpdates(_0x510926){return function(_0x4abd67){try{jsonpatch[_0x940d('0x1d')](_0x4abd67,_0x510926,!![]);}catch(_0x1be067){return BPromise['reject'](_0x1be067);}return _0x4abd67['save']();};}function saveUpdates(_0x231d3a,_0x25a215){return function(_0x1fa66b){if(_0x1fa66b){return _0x1fa66b[_0x940d('0x1e')](_0x231d3a)[_0x940d('0x1f')](function(_0x174c22){return _0x174c22;});}return null;};}function removeEntity(_0x4cae25,_0x35496c){return function(_0x49d668){if(_0x49d668){return _0x49d668[_0x940d('0x20')]()[_0x940d('0x1f')](function(){_0x4cae25[_0x940d('0x16')](0xcc)[_0x940d('0x17')]();});}};}function handleEntityNotFound(_0x1433be,_0x4c25cb){return function(_0x4cbfe8){if(!_0x4cbfe8){_0x1433be[_0x940d('0x15')](0x194);}return _0x4cbfe8;};}function handleError(_0x30fcae,_0x460225){_0x460225=_0x460225||0x1f4;return function(_0x5d74ea){logger['error'](_0x5d74ea['stack']);if(_0x5d74ea[_0x940d('0x21')]){delete _0x5d74ea[_0x940d('0x21')];}_0x30fcae[_0x940d('0x16')](_0x460225)['send'](_0x5d74ea);};}exports[_0x940d('0x22')]=function(_0x2bca7a,_0x536bf0){var _0x5405e8={},_0x2c87ea={},_0x3ef28d={'count':0x0,'rows':[]};var _0x24b222=_[_0x940d('0x23')](db[_0x940d('0x24')][_0x940d('0x25')],function(_0x14a039){return{'name':_0x14a039['fieldName'],'type':_0x14a039[_0x940d('0x26')][_0x940d('0x27')]};});_0x2c87ea['model']=_[_0x940d('0x23')](_0x24b222,_0x940d('0x21'));_0x2c87ea[_0x940d('0x28')]=_[_0x940d('0x29')](_0x2bca7a[_0x940d('0x28')]);_0x2c87ea[_0x940d('0x2a')]=_[_0x940d('0x2b')](_0x2c87ea[_0x940d('0x2c')],_0x2c87ea['query']);_0x5405e8[_0x940d('0x2d')]=_[_0x940d('0x2b')](_0x2c87ea[_0x940d('0x2c')],qs[_0x940d('0x2e')](_0x2bca7a[_0x940d('0x28')]['fields']));_0x5405e8[_0x940d('0x2d')]=_0x5405e8[_0x940d('0x2d')][_0x940d('0x2f')]?_0x5405e8[_0x940d('0x2d')]:_0x2c87ea[_0x940d('0x2c')];if(!_0x2bca7a[_0x940d('0x28')][_0x940d('0x30')](_0x940d('0x31'))){_0x5405e8[_0x940d('0x1c')]=qs[_0x940d('0x1c')](_0x2bca7a['query'][_0x940d('0x1c')]);_0x5405e8[_0x940d('0x19')]=qs[_0x940d('0x19')](_0x2bca7a[_0x940d('0x28')][_0x940d('0x19')]);}_0x5405e8['order']=qs['sort'](_0x2bca7a['query']['sort']);_0x5405e8[_0x940d('0x32')]=qs[_0x940d('0x2a')](_[_0x940d('0x33')](_0x2bca7a[_0x940d('0x28')],_0x2c87ea['filters']),_0x24b222);if(_0x2bca7a['query'][_0x940d('0x34')]){_0x5405e8['where']=_[_0x940d('0x35')](_0x5405e8[_0x940d('0x32')],{'$or':_[_0x940d('0x23')](_0x24b222,function(_0x37f6b5){if(_0x37f6b5['type']!=='VIRTUAL'){var _0x14b9ce={};_0x14b9ce[_0x37f6b5['name']]={'$like':'%'+_0x2bca7a[_0x940d('0x28')][_0x940d('0x34')]+'%'};return _0x14b9ce;}})});}_0x5405e8=_[_0x940d('0x35')]({},_0x5405e8,_0x2bca7a['options']);var _0x3a2db5={'where':_0x5405e8[_0x940d('0x32')]};return db['Migration'][_0x940d('0x1b')](_0x3a2db5)[_0x940d('0x1f')](function(_0x48576a){_0x3ef28d[_0x940d('0x1b')]=_0x48576a;if(_0x2bca7a['query'][_0x940d('0x36')]){_0x5405e8[_0x940d('0x37')]=[{'all':!![]}];}return db[_0x940d('0x24')][_0x940d('0x38')](_0x5405e8);})[_0x940d('0x1f')](function(_0x1332d9){_0x3ef28d[_0x940d('0x39')]=_0x1332d9;return _0x3ef28d;})[_0x940d('0x1f')](respondWithFilteredResult(_0x536bf0,_0x5405e8))[_0x940d('0x3a')](handleError(_0x536bf0,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 38109d9..bcb65f0 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 _0x5e3c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','api'];(function(_0x25873f,_0x1888a5){var _0x6cdad4=function(_0x2703d3){while(--_0x2703d3){_0x25873f['push'](_0x25873f['shift']());}};_0x6cdad4(++_0x1888a5);}(_0x5e3c,0xe8));var _0xc5e3=function(_0x20a118,_0x1d0a1c){_0x20a118=_0x20a118-0x0;var _0x28ad93=_0x5e3c[_0x20a118];return _0x28ad93;};'use strict';var _=require('lodash');var util=require(_0xc5e3('0x0'));var logger=require('../../config/logger')(_0xc5e3('0x1'));var moment=require(_0xc5e3('0x2'));var BPromise=require(_0xc5e3('0x3'));var rp=require(_0xc5e3('0x4'));var fs=require('fs');var path=require(_0xc5e3('0x5'));var rimraf=require(_0xc5e3('0x6'));var config=require(_0xc5e3('0x7'));var attributes=require(_0xc5e3('0x8'));module[_0xc5e3('0x9')]=function(_0xd48f4d,_0x336f8c){return _0xd48f4d[_0xc5e3('0xa')](_0xc5e3('0xb'),attributes,{'tableName':_0xc5e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1809=['moment','bluebird','rimraf','../../config/environment','./migration.attributes','exports','Migration','lodash','util','../../config/logger'];(function(_0x441e18,_0x2a4780){var _0x4adf21=function(_0xe35818){while(--_0xe35818){_0x441e18['push'](_0x441e18['shift']());}};_0x4adf21(++_0x2a4780);}(_0x1809,0xa7));var _0x9180=function(_0x11b3d3,_0x52f58f){_0x11b3d3=_0x11b3d3-0x0;var _0x4bdf8b=_0x1809[_0x11b3d3];return _0x4bdf8b;};'use strict';var _=require(_0x9180('0x0'));var util=require(_0x9180('0x1'));var logger=require(_0x9180('0x2'))('api');var moment=require(_0x9180('0x3'));var BPromise=require(_0x9180('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9180('0x5'));var config=require(_0x9180('0x6'));var attributes=require(_0x9180('0x7'));module[_0x9180('0x8')]=function(_0x4c277b,_0x505c25){return _0x4c277b['define'](_0x9180('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 710a1f8..43b27f1 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 _0xc961=['moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x2bb66c,_0x36c6c6){var _0x1e0f98=function(_0x1e3412){while(--_0x1e3412){_0x2bb66c['push'](_0x2bb66c['shift']());}};_0x1e0f98(++_0x36c6c6);}(_0xc961,0x17a));var _0x1c96=function(_0x21b1e0,_0x59d6e4){_0x21b1e0=_0x21b1e0-0x0;var _0x18e44c=_0xc961[_0x21b1e0];return _0x18e44c;};'use strict';var _=require(_0x1c96('0x0'));var util=require(_0x1c96('0x1'));var moment=require(_0x1c96('0x2'));var BPromise=require(_0x1c96('0x3'));var rs=require(_0x1c96('0x4'));var fs=require('fs');var Redis=require(_0x1c96('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1c96('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c96('0x7'));var client=jayson['client'][_0x1c96('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4b23,_0x1f09ff,_0x307846){return new BPromise(function(_0x2e4fa5,_0x473a4c){return client['request'](_0x2d4b23,_0x307846)[_0x1c96('0x9')](function(_0x362e46){logger[_0x1c96('0xa')](_0x1c96('0xb'),_0x1f09ff,_0x1c96('0xc'));logger[_0x1c96('0xd')](_0x1c96('0xe'),_0x1f09ff,_0x1c96('0xc'),JSON[_0x1c96('0xf')](_0x362e46));if(_0x362e46[_0x1c96('0x10')]){if(_0x362e46[_0x1c96('0x10')][_0x1c96('0x11')]===0x1f4){logger['error'](_0x1c96('0xb'),_0x1f09ff,_0x362e46[_0x1c96('0x10')]['message']);return _0x473a4c(_0x362e46[_0x1c96('0x10')][_0x1c96('0x12')]);}logger[_0x1c96('0x10')](_0x1c96('0xb'),_0x1f09ff,_0x362e46[_0x1c96('0x10')][_0x1c96('0x12')]);return _0x2e4fa5(_0x362e46[_0x1c96('0x10')][_0x1c96('0x12')]);}else{logger[_0x1c96('0xa')](_0x1c96('0xb'),_0x1f09ff,_0x1c96('0xc'));_0x2e4fa5(_0x362e46[_0x1c96('0x13')][_0x1c96('0x12')]);}})['catch'](function(_0x32596e){logger['error'](_0x1c96('0xb'),_0x1f09ff,_0x32596e);_0x473a4c(_0x32596e);});});} \ No newline at end of file +var _0xdf0c=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4f47d5,_0x14bac5){var _0x507cc5=function(_0x53d62f){while(--_0x53d62f){_0x4f47d5['push'](_0x4f47d5['shift']());}};_0x507cc5(++_0x14bac5);}(_0xdf0c,0x1ab));var _0xcdf0=function(_0x321ddc,_0x58f72a){_0x321ddc=_0x321ddc-0x0;var _0x277f53=_0xdf0c[_0x321ddc];return _0x277f53;};'use strict';var _=require(_0xcdf0('0x0'));var util=require('util');var moment=require(_0xcdf0('0x1'));var BPromise=require(_0xcdf0('0x2'));var rs=require(_0xcdf0('0x3'));var fs=require('fs');var Redis=require(_0xcdf0('0x4'));var db=require(_0xcdf0('0x5'))['db'];var utils=require(_0xcdf0('0x6'));var logger=require(_0xcdf0('0x7'))('rpc');var config=require(_0xcdf0('0x8'));var jayson=require(_0xcdf0('0x9'));var client=jayson['client'][_0xcdf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe282be,_0x23b3a0,_0x5b39b8){return new BPromise(function(_0x62e18,_0x1ac036){return client[_0xcdf0('0xb')](_0xe282be,_0x5b39b8)[_0xcdf0('0xc')](function(_0x4aec53){logger[_0xcdf0('0xd')](_0xcdf0('0xe'),_0x23b3a0,_0xcdf0('0xf'));logger[_0xcdf0('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x23b3a0,_0xcdf0('0xf'),JSON[_0xcdf0('0x11')](_0x4aec53));if(_0x4aec53[_0xcdf0('0x12')]){if(_0x4aec53[_0xcdf0('0x12')][_0xcdf0('0x13')]===0x1f4){logger['error'](_0xcdf0('0xe'),_0x23b3a0,_0x4aec53[_0xcdf0('0x12')][_0xcdf0('0x14')]);return _0x1ac036(_0x4aec53['error'][_0xcdf0('0x14')]);}logger['error']('Migration,\x20%s,\x20%s',_0x23b3a0,_0x4aec53[_0xcdf0('0x12')][_0xcdf0('0x14')]);return _0x62e18(_0x4aec53['error'][_0xcdf0('0x14')]);}else{logger[_0xcdf0('0xd')](_0xcdf0('0xe'),_0x23b3a0,_0xcdf0('0xf'));_0x62e18(_0x4aec53[_0xcdf0('0x15')][_0xcdf0('0x14')]);}})[_0xcdf0('0x16')](function(_0x2d6627){logger[_0xcdf0('0x12')](_0xcdf0('0xe'),_0x23b3a0,_0x2d6627);_0x1ac036(_0x2d6627);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a423b46..2dc4c0a 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 _0xff01=['fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff01,0xb7));var _0x1ff0=function(_0x3a1243,_0x536bd6){_0x3a1243=_0x3a1243-0x0;var _0xb73735=_0xff01[_0x3a1243];return _0xb73735;};'use strict';var multer=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var path=require('path');var timeout=require(_0x1ff0('0x2'));var express=require('express');var router=express[_0x1ff0('0x3')]();var fs_extra=require(_0x1ff0('0x4'));var auth=require(_0x1ff0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1ff0('0x6'));var controller=require('./network.controller');router[_0x1ff0('0x7')]('/',auth['isAuthenticated'](),controller[_0x1ff0('0x8')]);router['get']('/:id',auth[_0x1ff0('0x9')](),controller[_0x1ff0('0xa')]);router['post']('/',auth[_0x1ff0('0x9')](),controller[_0x1ff0('0xb')]);router[_0x1ff0('0xc')](_0x1ff0('0xd'),auth[_0x1ff0('0x9')](),controller['update']);router[_0x1ff0('0xe')]('/:id',auth[_0x1ff0('0x9')](),controller[_0x1ff0('0xf')]);module[_0x1ff0('0x10')]=router; \ No newline at end of file +var _0xe585=['./network.controller','isAuthenticated','index','get','/:id','post','create','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x582333,_0x7e26eb){var _0x3656b6=function(_0x4e079e){while(--_0x4e079e){_0x582333['push'](_0x582333['shift']());}};_0x3656b6(++_0x7e26eb);}(_0xe585,0x9a));var _0x5e58=function(_0x2f4b88,_0x206c7e){_0x2f4b88=_0x2f4b88-0x0;var _0x17d54f=_0xe585[_0x2f4b88];return _0x17d54f;};'use strict';var multer=require(_0x5e58('0x0'));var util=require('util');var path=require(_0x5e58('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e58('0x2'));var router=express[_0x5e58('0x3')]();var fs_extra=require(_0x5e58('0x4'));var auth=require(_0x5e58('0x5'));var interaction=require(_0x5e58('0x6'));var config=require(_0x5e58('0x7'));var controller=require(_0x5e58('0x8'));router['get']('/',auth[_0x5e58('0x9')](),controller[_0x5e58('0xa')]);router[_0x5e58('0xb')](_0x5e58('0xc'),auth[_0x5e58('0x9')](),controller['show']);router[_0x5e58('0xd')]('/',auth[_0x5e58('0x9')](),controller[_0x5e58('0xe')]);router['put']('/:id',auth[_0x5e58('0x9')](),controller[_0x5e58('0xf')]);router[_0x5e58('0x10')](_0x5e58('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5e58('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f244c3c..626f87c 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 _0xffba=['externip','stun','turn','STRING','sequelize','exports','localnet'];(function(_0x20b510,_0x48caf7){var _0x507561=function(_0x2eb2e0){while(--_0x2eb2e0){_0x20b510['push'](_0x20b510['shift']());}};_0x507561(++_0x48caf7);}(_0xffba,0xc1));var _0xaffb=function(_0x4a93d8,_0x461d66){_0x4a93d8=_0x4a93d8-0x0;var _0x2e0457=_0xffba[_0x4a93d8];return _0x2e0457;};'use strict';var Sequelize=require(_0xaffb('0x0'));module[_0xaffb('0x1')]={'type':{'type':Sequelize['ENUM'](_0xaffb('0x2'),_0xaffb('0x3'),_0xaffb('0x4'),_0xaffb('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaffb('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc173=['turn','STRING','exports','ENUM','localnet','externip','stun'];(function(_0x122edb,_0x5b1482){var _0x37c349=function(_0x536c54){while(--_0x536c54){_0x122edb['push'](_0x122edb['shift']());}};_0x37c349(++_0x5b1482);}(_0xc173,0x1c2));var _0x3c17=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc173[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x3c17('0x0')]={'type':{'type':Sequelize[_0x3c17('0x1')](_0x3c17('0x2'),_0x3c17('0x3'),_0x3c17('0x4'),_0x3c17('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3c17('0x6')]},'password':{'type':Sequelize[_0x3c17('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index a1ed5ac..517305a 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 _0x107f=['find','create','body','toUpperCase','STUN','join','root','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','chan_sip.so','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','util','path','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','status','offset','undefined','limit','count','update','destroy','end','sendStatus','stack','name','map','Network','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll'];(function(_0x3a2be9,_0x221556){var _0x2777c4=function(_0x111671){while(--_0x111671){_0x3a2be9['push'](_0x3a2be9['shift']());}};_0x2777c4(++_0x221556);}(_0x107f,0x110));var _0xf107=function(_0x129c27,_0x333c44){_0x129c27=_0x129c27-0x0;var _0x5a8017=_0x107f[_0x129c27];return _0x5a8017;};'use strict';var util=require(_0xf107('0x0'));var path=require(_0xf107('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0xf107('0x2'));var logger=require(_0xf107('0x3'))('api');var config=require(_0xf107('0x4'));var db=require(_0xf107('0x5'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf107('0x6')][_0xf107('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x554055,_0x95a81a,_0x2b3ee6,_0x3769c7){return new Promise(function(_0x5090e6,_0xeddf4f){var _0x80cc6a=_0x3769c7||client;return _0x80cc6a['request'](_0x554055,_0x2b3ee6)[_0xf107('0x8')](function(_0x543559){logger['info'](_0xf107('0x9'),_0x95a81a,_0xf107('0xa'));logger[_0xf107('0xb')](_0xf107('0xc'),_0x95a81a,_0xf107('0xa'),JSON[_0xf107('0xd')](_0x543559));if(_0x543559[_0xf107('0xe')]){if(_0x543559['error'][_0xf107('0xf')]===0x1f4){logger[_0xf107('0xe')](_0xf107('0x9'),_0x95a81a,_0x543559['error']['message']);return _0xeddf4f(_0x543559[_0xf107('0xe')][_0xf107('0x10')]);}logger[_0xf107('0xe')](_0xf107('0x9'),_0x95a81a,_0x543559[_0xf107('0xe')]['message']);return _0x5090e6(_0x543559[_0xf107('0xe')][_0xf107('0x10')]);}else{logger[_0xf107('0x11')](_0xf107('0x9'),_0x95a81a,'request\x20sent');_0x5090e6(_0x543559['result'][_0xf107('0x10')]);}})['catch'](function(_0x10105b){logger[_0xf107('0xe')]('Network,\x20%s,\x20%s',_0x95a81a,_0x10105b);_0xeddf4f(_0x10105b);});});}function respondWithResult(_0x2ffc80,_0x26e20c){_0x26e20c=_0x26e20c||0xc8;return function(_0x31912d){if(_0x31912d){return _0x2ffc80[_0xf107('0x12')](_0x26e20c)['json'](_0x31912d);}};}function respondWithFilteredResult(_0xeb2db7,_0x44b6ad){return function(_0x590f37){if(_0x590f37){var _0x3e5ca8=typeof _0x44b6ad[_0xf107('0x13')]===_0xf107('0x14')&&typeof _0x44b6ad[_0xf107('0x15')]===_0xf107('0x14');var _0x25bf42=_0x590f37['count'];var _0x32bec5=_0x3e5ca8?0x0:_0x44b6ad['offset'];var _0x49c993=_0x3e5ca8?_0x590f37[_0xf107('0x16')]:_0x44b6ad[_0xf107('0x13')]+_0x44b6ad[_0xf107('0x15')];var _0x1c91a8;if(_0x49c993>=_0x25bf42){_0x49c993=_0x25bf42;_0x1c91a8=0xc8;}else{_0x1c91a8=0xce;}_0xeb2db7[_0xf107('0x12')](_0x1c91a8);return _0xeb2db7['set']('Content-Range',_0x32bec5+'-'+_0x49c993+'/'+_0x25bf42)['json'](_0x590f37);}return null;};}function saveUpdates(_0x53d220){return function(_0xf14eb9){if(_0xf14eb9){return _0xf14eb9[_0xf107('0x17')](_0x53d220)['then'](function(_0x5cf858){return _0x5cf858;});}return null;};}function removeEntity(_0x5291d5){return function(_0x5e0d34){if(_0x5e0d34){return _0x5e0d34[_0xf107('0x18')]()[_0xf107('0x8')](function(){_0x5291d5[_0xf107('0x12')](0xcc)[_0xf107('0x19')]();});}};}function handleEntityNotFound(_0xf16713){return function(_0x20a706){if(!_0x20a706){_0xf16713[_0xf107('0x1a')](0x194);}return _0x20a706;};}function handleError(_0x27197d,_0x3ba4a3){_0x3ba4a3=_0x3ba4a3||0x1f4;return function(_0x1d043e){logger[_0xf107('0xe')](_0x1d043e[_0xf107('0x1b')]);if(_0x1d043e['name']){delete _0x1d043e[_0xf107('0x1c')];}_0x27197d['status'](_0x3ba4a3)['send'](_0x1d043e);};}exports['index']=function(_0x34d48f,_0x33035f){var _0x2b4223={},_0x12d1f2={},_0xb7d779={'count':0x0,'rows':[]};var _0x2c9209=_[_0xf107('0x1d')](db[_0xf107('0x1e')][_0xf107('0x1f')],function(_0x1e09be){return{'name':_0x1e09be[_0xf107('0x20')],'type':_0x1e09be[_0xf107('0x21')][_0xf107('0x22')]};});_0x12d1f2[_0xf107('0x23')]=_['map'](_0x2c9209,_0xf107('0x1c'));_0x12d1f2['query']=_[_0xf107('0x24')](_0x34d48f[_0xf107('0x25')]);_0x12d1f2[_0xf107('0x26')]=_['intersection'](_0x12d1f2[_0xf107('0x23')],_0x12d1f2['query']);_0x2b4223[_0xf107('0x27')]=_[_0xf107('0x28')](_0x12d1f2[_0xf107('0x23')],qs[_0xf107('0x29')](_0x34d48f[_0xf107('0x25')][_0xf107('0x29')]));_0x2b4223[_0xf107('0x27')]=_0x2b4223['attributes'][_0xf107('0x2a')]?_0x2b4223[_0xf107('0x27')]:_0x12d1f2[_0xf107('0x23')];if(!_0x34d48f[_0xf107('0x25')][_0xf107('0x2b')](_0xf107('0x2c'))){_0x2b4223[_0xf107('0x15')]=qs[_0xf107('0x15')](_0x34d48f[_0xf107('0x25')][_0xf107('0x15')]);_0x2b4223[_0xf107('0x13')]=qs[_0xf107('0x13')](_0x34d48f[_0xf107('0x25')][_0xf107('0x13')]);}_0x2b4223[_0xf107('0x2d')]=qs[_0xf107('0x2e')](_0x34d48f[_0xf107('0x25')][_0xf107('0x2e')]);_0x2b4223[_0xf107('0x2f')]=qs['filters'](_[_0xf107('0x30')](_0x34d48f['query'],_0x12d1f2[_0xf107('0x26')]),_0x2c9209);if(_0x34d48f[_0xf107('0x25')][_0xf107('0x31')]){_0x2b4223[_0xf107('0x2f')]=_[_0xf107('0x32')](_0x2b4223[_0xf107('0x2f')],{'$or':_[_0xf107('0x1d')](_0x2c9209,function(_0x1361cb){if(_0x1361cb[_0xf107('0x21')]!==_0xf107('0x33')){var _0xe45fd7={};_0xe45fd7[_0x1361cb[_0xf107('0x1c')]]={'$like':'%'+_0x34d48f[_0xf107('0x25')]['filter']+'%'};return _0xe45fd7;}})});}_0x2b4223=_[_0xf107('0x32')]({},_0x2b4223,_0x34d48f[_0xf107('0x34')]);var _0x2b17bb={'where':_0x2b4223[_0xf107('0x2f')]};return db['Network']['count'](_0x2b17bb)['then'](function(_0x2aae31){_0xb7d779[_0xf107('0x16')]=_0x2aae31;if(_0x34d48f[_0xf107('0x25')]['includeAll']){_0x2b4223[_0xf107('0x35')]=[{'all':!![]}];}return db['Network'][_0xf107('0x36')](_0x2b4223);})['then'](function(_0x401184){_0xb7d779[_0xf107('0x37')]=_0x401184;return _0xb7d779;})[_0xf107('0x8')](respondWithFilteredResult(_0x33035f,_0x2b4223))[_0xf107('0x38')](handleError(_0x33035f,null));};exports[_0xf107('0x39')]=function(_0x58344e,_0x43b7e5){var _0x21421f={'raw':!![],'where':{'id':_0x58344e[_0xf107('0x3a')]['id']}},_0x303bb3={};_0x303bb3[_0xf107('0x23')]=_[_0xf107('0x24')](db['Network'][_0xf107('0x1f')]);_0x303bb3[_0xf107('0x25')]=_[_0xf107('0x24')](_0x58344e[_0xf107('0x25')]);_0x303bb3[_0xf107('0x26')]=_[_0xf107('0x28')](_0x303bb3[_0xf107('0x23')],_0x303bb3[_0xf107('0x25')]);_0x21421f[_0xf107('0x27')]=_[_0xf107('0x28')](_0x303bb3[_0xf107('0x23')],qs[_0xf107('0x29')](_0x58344e['query'][_0xf107('0x29')]));_0x21421f[_0xf107('0x27')]=_0x21421f[_0xf107('0x27')]['length']?_0x21421f['attributes']:_0x303bb3[_0xf107('0x23')];if(_0x58344e['query'][_0xf107('0x3b')]){_0x21421f[_0xf107('0x35')]=[{'all':!![]}];}_0x21421f=_[_0xf107('0x32')]({},_0x21421f,_0x58344e[_0xf107('0x34')]);return db[_0xf107('0x1e')][_0xf107('0x3c')](_0x21421f)[_0xf107('0x8')](handleEntityNotFound(_0x43b7e5,null))['then'](respondWithResult(_0x43b7e5,null))[_0xf107('0x38')](handleError(_0x43b7e5,null));};exports[_0xf107('0x3d')]=function(_0x5ba381,_0x5a4660){var _0x1665f1;return db[_0xf107('0x1e')][_0xf107('0x3d')](_0x5ba381[_0xf107('0x3e')],{'raw':!![]})[_0xf107('0x8')](function(_0x5457ec){_0x1665f1=_0x5457ec;return db['Network'][_0xf107('0x36')]({'where':{'type':_0x5ba381[_0xf107('0x3e')][_0xf107('0x21')]},'raw':!![]});})['then'](function(_0x49a6e7){if(_0x1665f1['type'][_0xf107('0x3f')]()==_0xf107('0x40')){var _0x519fa0=fs['readFileSync'](path[_0xf107('0x41')](config[_0xf107('0x42')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x30bd07=ejs[_0xf107('0x43')](_0x519fa0,{'networks':_0x49a6e7||[]});fs[_0xf107('0x44')](_0xf107('0x45'),_0x30bd07);return respondWithRpcPromise(_0xf107('0x46'),_0xf107('0x3d'),{'module':_0xf107('0x47')});}else if(_0x1665f1[_0xf107('0x21')][_0xf107('0x3f')]()==_0xf107('0x48')){var _0x3a6c4f=fs[_0xf107('0x49')](path[_0xf107('0x41')](config[_0xf107('0x42')],'server/files/templates/turn_multiple.ejs'),_0xf107('0x4a'));var _0x31baa5=ejs['render'](_0x3a6c4f,{'networks':_0x49a6e7||[]});fs[_0xf107('0x44')](_0xf107('0x4b'),_0x31baa5);return respondWithRpcPromise('Reload',_0xf107('0x3d'),{'module':_0xf107('0x47')});}else{var _0x70eac4=fs[_0xf107('0x49')](path['join'](config[_0xf107('0x42')],_0xf107('0x4c')),_0xf107('0x4a'));var _0x16bf86=ejs[_0xf107('0x43')](_0x70eac4,{'networks':_0x49a6e7||[]});fs[_0xf107('0x44')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x5ba381['body'][_0xf107('0x21')]['toLowerCase']()),_0x16bf86);return respondWithRpcPromise(_0xf107('0x46'),_0xf107('0x3d'),{'module':_0xf107('0x4d')});}})['then'](function(){return _0x1665f1;})[_0xf107('0x8')](respondWithResult(_0x5a4660,0xc9))[_0xf107('0x38')](handleError(_0x5a4660,null));};exports['update']=function(_0xd928ad,_0x2e2832){var _0x119871;return db[_0xf107('0x1e')][_0xf107('0x3c')]({'where':{'id':_0xd928ad[_0xf107('0x3a')]['id']}})[_0xf107('0x8')](handleEntityNotFound(_0x2e2832,null))['then'](saveUpdates(_0xd928ad[_0xf107('0x3e')],null))['then'](function(_0x4da601){if(_0x4da601){_0x119871=_0x4da601;return db[_0xf107('0x1e')][_0xf107('0x36')]({'where':{'type':_0x119871[_0xf107('0x21')]},'raw':!![]});}return null;})['then'](function(_0x5e8d8b){if(_0x119871['type'][_0xf107('0x3f')]()==_0xf107('0x40')){var _0x3781f9=fs[_0xf107('0x49')](path[_0xf107('0x41')](config[_0xf107('0x42')],_0xf107('0x4e')),_0xf107('0x4a'));var _0xe79a61=ejs['render'](_0x3781f9,{'networks':_0x5e8d8b||[]});fs[_0xf107('0x44')](_0xf107('0x45'),_0xe79a61);return respondWithRpcPromise(_0xf107('0x46'),_0xf107('0x17'),{'module':_0xf107('0x47')});}else if(_0x119871['type'][_0xf107('0x3f')]()=='TURN'){var _0x369f3f=fs['readFileSync'](path['join'](config[_0xf107('0x42')],_0xf107('0x4f')),'utf8');var _0x4ff937=ejs[_0xf107('0x43')](_0x369f3f,{'networks':_0x5e8d8b||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x4ff937);return respondWithRpcPromise(_0xf107('0x46'),_0xf107('0x17'),{'module':'res_stun_monitor.so'});}else{var _0x3f386b=fs[_0xf107('0x49')](path[_0xf107('0x41')](config[_0xf107('0x42')],_0xf107('0x4c')),'utf8');var _0x5bc2b0=ejs[_0xf107('0x43')](_0x3f386b,{'networks':_0x5e8d8b||[]});fs[_0xf107('0x44')](util[_0xf107('0x50')](_0xf107('0x51'),_0xd928ad[_0xf107('0x3e')]['type']['toLowerCase']()),_0x5bc2b0);return respondWithRpcPromise('Reload',_0xf107('0x17'),{'module':_0xf107('0x4d')});}})['then'](function(_0x31b99d){if(_0x31b99d){return _0x119871;}return null;})['then'](respondWithResult(_0x2e2832,null))[_0xf107('0x38')](handleError(_0x2e2832,null));};exports['destroy']=function(_0x3a07d2,_0x4d5596){var _0x37cc9f;return db['Network'][_0xf107('0x3c')]({'where':{'id':_0x3a07d2[_0xf107('0x3a')]['id']}})[_0xf107('0x8')](function(_0x593feb){_0x37cc9f=_0x593feb;return _0x593feb;})[_0xf107('0x8')](handleEntityNotFound(_0x4d5596,null))['then'](removeEntity(_0x4d5596,null))[_0xf107('0x8')](function(){if(_0x37cc9f){return db[_0xf107('0x1e')]['findAll']({'where':{'type':_0x37cc9f['type']},'raw':!![]});}})['then'](function(_0x2d8af3){if(_0x37cc9f['type'][_0xf107('0x3f')]()==_0xf107('0x40')){var _0x38d350=fs[_0xf107('0x49')](path[_0xf107('0x41')](config[_0xf107('0x42')],'server/files/templates/stun_multiple.ejs'),_0xf107('0x4a'));var _0x2dd9e7=ejs[_0xf107('0x43')](_0x38d350,{'networks':_0x2d8af3||[]});fs[_0xf107('0x44')](_0xf107('0x45'),_0x2dd9e7);return respondWithRpcPromise('Reload','destroy',{'module':_0xf107('0x47')});}else if(_0x37cc9f['type'][_0xf107('0x3f')]()==_0xf107('0x48')){var _0x406151=fs['readFileSync'](path[_0xf107('0x41')](config[_0xf107('0x42')],_0xf107('0x4f')),_0xf107('0x4a'));var _0x77b4bc=ejs[_0xf107('0x43')](_0x406151,{'networks':_0x2d8af3||[]});fs['writeFileSync'](_0xf107('0x4b'),_0x77b4bc);return respondWithRpcPromise('Reload','destroy',{'module':_0xf107('0x47')});}else{var _0x37a0ca=fs[_0xf107('0x49')](path['join'](config[_0xf107('0x42')],'server/files/templates/network.ejs'),_0xf107('0x4a'));var _0x2e37f1=ejs['render'](_0x37a0ca,{'networks':_0x2d8af3||[]});fs[_0xf107('0x44')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x37cc9f['type'][_0xf107('0x52')]()),_0x2e37f1);return respondWithRpcPromise(_0xf107('0x46'),_0xf107('0x18'),{'module':_0xf107('0x4d')});}})[_0xf107('0x38')](handleError(_0x4d5596,null));}; \ No newline at end of file +var _0xe6fc=['http','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','json','offset','undefined','count','limit','set','update','destroy','sendStatus','stack','name','send','map','Network','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','show','params','keys','intersection','include','find','create','body','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','toUpperCase','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','util','path','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x13c75c,_0x2d07e4){var _0x2c687e=function(_0x33c87a){while(--_0x33c87a){_0x13c75c['push'](_0x13c75c['shift']());}};_0x2c687e(++_0x2d07e4);}(_0xe6fc,0x19c));var _0xce6f=function(_0x2e55ad,_0x1d6a64){_0x2e55ad=_0x2e55ad-0x0;var _0xdcc15a=_0xe6fc[_0x2e55ad];return _0xdcc15a;};'use strict';var util=require(_0xce6f('0x0'));var path=require(_0xce6f('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xce6f('0x2'));var qs=require(_0xce6f('0x3'));var logger=require('../../config/logger')(_0xce6f('0x4'));var config=require(_0xce6f('0x5'));var db=require(_0xce6f('0x6'))['db'];var jayson=require(_0xce6f('0x7'));var client=jayson['client'][_0xce6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18ab74,_0x1c2d27,_0x35b1da,_0x4a2773){return new Promise(function(_0x96bb1a,_0x445cc8){var _0x17305b=_0x4a2773||client;return _0x17305b['request'](_0x18ab74,_0x35b1da)[_0xce6f('0x9')](function(_0x445ac0){logger[_0xce6f('0xa')](_0xce6f('0xb'),_0x1c2d27,'request\x20sent');logger['debug'](_0xce6f('0xc'),_0x1c2d27,'request\x20sent',JSON[_0xce6f('0xd')](_0x445ac0));if(_0x445ac0['error']){if(_0x445ac0['error'][_0xce6f('0xe')]===0x1f4){logger['error'](_0xce6f('0xb'),_0x1c2d27,_0x445ac0['error']['message']);return _0x445cc8(_0x445ac0['error']['message']);}logger[_0xce6f('0xf')](_0xce6f('0xb'),_0x1c2d27,_0x445ac0[_0xce6f('0xf')]['message']);return _0x96bb1a(_0x445ac0['error'][_0xce6f('0x10')]);}else{logger[_0xce6f('0xa')](_0xce6f('0xb'),_0x1c2d27,'request\x20sent');_0x96bb1a(_0x445ac0[_0xce6f('0x11')][_0xce6f('0x10')]);}})[_0xce6f('0x12')](function(_0xd7ccc2){logger[_0xce6f('0xf')]('Network,\x20%s,\x20%s',_0x1c2d27,_0xd7ccc2);_0x445cc8(_0xd7ccc2);});});}function respondWithResult(_0x2e8e52,_0x3d6451){_0x3d6451=_0x3d6451||0xc8;return function(_0x35615c){if(_0x35615c){return _0x2e8e52[_0xce6f('0x13')](_0x3d6451)[_0xce6f('0x14')](_0x35615c);}};}function respondWithFilteredResult(_0x4203f9,_0x3693b6){return function(_0x39c4b1){if(_0x39c4b1){var _0x272a8a=typeof _0x3693b6[_0xce6f('0x15')]===_0xce6f('0x16')&&typeof _0x3693b6['limit']===_0xce6f('0x16');var _0x47e699=_0x39c4b1[_0xce6f('0x17')];var _0x3d410f=_0x272a8a?0x0:_0x3693b6['offset'];var _0x536f8f=_0x272a8a?_0x39c4b1[_0xce6f('0x17')]:_0x3693b6[_0xce6f('0x15')]+_0x3693b6[_0xce6f('0x18')];var _0x45b8b0;if(_0x536f8f>=_0x47e699){_0x536f8f=_0x47e699;_0x45b8b0=0xc8;}else{_0x45b8b0=0xce;}_0x4203f9[_0xce6f('0x13')](_0x45b8b0);return _0x4203f9[_0xce6f('0x19')]('Content-Range',_0x3d410f+'-'+_0x536f8f+'/'+_0x47e699)[_0xce6f('0x14')](_0x39c4b1);}return null;};}function saveUpdates(_0x1a5674){return function(_0x363c4f){if(_0x363c4f){return _0x363c4f[_0xce6f('0x1a')](_0x1a5674)[_0xce6f('0x9')](function(_0x5b8004){return _0x5b8004;});}return null;};}function removeEntity(_0x5d5b33){return function(_0x3fa671){if(_0x3fa671){return _0x3fa671[_0xce6f('0x1b')]()[_0xce6f('0x9')](function(){_0x5d5b33[_0xce6f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46e3af){return function(_0x310caf){if(!_0x310caf){_0x46e3af[_0xce6f('0x1c')](0x194);}return _0x310caf;};}function handleError(_0x521382,_0x1a854e){_0x1a854e=_0x1a854e||0x1f4;return function(_0xafa725){logger[_0xce6f('0xf')](_0xafa725[_0xce6f('0x1d')]);if(_0xafa725[_0xce6f('0x1e')]){delete _0xafa725[_0xce6f('0x1e')];}_0x521382[_0xce6f('0x13')](_0x1a854e)[_0xce6f('0x1f')](_0xafa725);};}exports['index']=function(_0x116fd8,_0x2cd9bb){var _0x3cc7da={},_0x457ea5={},_0x53f43d={'count':0x0,'rows':[]};var _0x25f2ad=_[_0xce6f('0x20')](db[_0xce6f('0x21')][_0xce6f('0x22')],function(_0x54ab3a){return{'name':_0x54ab3a[_0xce6f('0x23')],'type':_0x54ab3a['type'][_0xce6f('0x24')]};});_0x457ea5[_0xce6f('0x25')]=_['map'](_0x25f2ad,'name');_0x457ea5[_0xce6f('0x26')]=_['keys'](_0x116fd8['query']);_0x457ea5[_0xce6f('0x27')]=_['intersection'](_0x457ea5[_0xce6f('0x25')],_0x457ea5[_0xce6f('0x26')]);_0x3cc7da[_0xce6f('0x28')]=_['intersection'](_0x457ea5[_0xce6f('0x25')],qs[_0xce6f('0x29')](_0x116fd8['query'][_0xce6f('0x29')]));_0x3cc7da[_0xce6f('0x28')]=_0x3cc7da[_0xce6f('0x28')][_0xce6f('0x2a')]?_0x3cc7da[_0xce6f('0x28')]:_0x457ea5[_0xce6f('0x25')];if(!_0x116fd8[_0xce6f('0x26')][_0xce6f('0x2b')](_0xce6f('0x2c'))){_0x3cc7da['limit']=qs[_0xce6f('0x18')](_0x116fd8[_0xce6f('0x26')][_0xce6f('0x18')]);_0x3cc7da[_0xce6f('0x15')]=qs[_0xce6f('0x15')](_0x116fd8['query'][_0xce6f('0x15')]);}_0x3cc7da[_0xce6f('0x2d')]=qs[_0xce6f('0x2e')](_0x116fd8[_0xce6f('0x26')][_0xce6f('0x2e')]);_0x3cc7da['where']=qs['filters'](_[_0xce6f('0x2f')](_0x116fd8[_0xce6f('0x26')],_0x457ea5['filters']),_0x25f2ad);if(_0x116fd8[_0xce6f('0x26')][_0xce6f('0x30')]){_0x3cc7da['where']=_['merge'](_0x3cc7da[_0xce6f('0x31')],{'$or':_[_0xce6f('0x20')](_0x25f2ad,function(_0x36cfb0){if(_0x36cfb0[_0xce6f('0x32')]!==_0xce6f('0x33')){var _0x2334fe={};_0x2334fe[_0x36cfb0[_0xce6f('0x1e')]]={'$like':'%'+_0x116fd8['query'][_0xce6f('0x30')]+'%'};return _0x2334fe;}})});}_0x3cc7da=_[_0xce6f('0x34')]({},_0x3cc7da,_0x116fd8[_0xce6f('0x35')]);var _0x23cf23={'where':_0x3cc7da[_0xce6f('0x31')]};return db[_0xce6f('0x21')]['count'](_0x23cf23)[_0xce6f('0x9')](function(_0x5eed51){_0x53f43d[_0xce6f('0x17')]=_0x5eed51;if(_0x116fd8[_0xce6f('0x26')][_0xce6f('0x36')]){_0x3cc7da['include']=[{'all':!![]}];}return db['Network'][_0xce6f('0x37')](_0x3cc7da);})[_0xce6f('0x9')](function(_0x3262f4){_0x53f43d['rows']=_0x3262f4;return _0x53f43d;})[_0xce6f('0x9')](respondWithFilteredResult(_0x2cd9bb,_0x3cc7da))[_0xce6f('0x12')](handleError(_0x2cd9bb,null));};exports[_0xce6f('0x38')]=function(_0x1529e9,_0x4928e1){var _0x4dc20f={'raw':!![],'where':{'id':_0x1529e9[_0xce6f('0x39')]['id']}},_0x32999a={};_0x32999a[_0xce6f('0x25')]=_['keys'](db['Network'][_0xce6f('0x22')]);_0x32999a[_0xce6f('0x26')]=_[_0xce6f('0x3a')](_0x1529e9['query']);_0x32999a[_0xce6f('0x27')]=_[_0xce6f('0x3b')](_0x32999a[_0xce6f('0x25')],_0x32999a[_0xce6f('0x26')]);_0x4dc20f[_0xce6f('0x28')]=_[_0xce6f('0x3b')](_0x32999a[_0xce6f('0x25')],qs[_0xce6f('0x29')](_0x1529e9[_0xce6f('0x26')][_0xce6f('0x29')]));_0x4dc20f[_0xce6f('0x28')]=_0x4dc20f[_0xce6f('0x28')][_0xce6f('0x2a')]?_0x4dc20f[_0xce6f('0x28')]:_0x32999a[_0xce6f('0x25')];if(_0x1529e9[_0xce6f('0x26')][_0xce6f('0x36')]){_0x4dc20f[_0xce6f('0x3c')]=[{'all':!![]}];}_0x4dc20f=_[_0xce6f('0x34')]({},_0x4dc20f,_0x1529e9['options']);return db[_0xce6f('0x21')][_0xce6f('0x3d')](_0x4dc20f)[_0xce6f('0x9')](handleEntityNotFound(_0x4928e1,null))[_0xce6f('0x9')](respondWithResult(_0x4928e1,null))[_0xce6f('0x12')](handleError(_0x4928e1,null));};exports[_0xce6f('0x3e')]=function(_0x1b4249,_0x331471){var _0x17cd8b;return db['Network']['create'](_0x1b4249[_0xce6f('0x3f')],{'raw':!![]})[_0xce6f('0x9')](function(_0x39efcb){_0x17cd8b=_0x39efcb;return db[_0xce6f('0x21')][_0xce6f('0x37')]({'where':{'type':_0x1b4249[_0xce6f('0x3f')][_0xce6f('0x32')]},'raw':!![]});})[_0xce6f('0x9')](function(_0x3bc677){if(_0x17cd8b['type']['toUpperCase']()==_0xce6f('0x40')){var _0x3b2f4b=fs[_0xce6f('0x41')](path[_0xce6f('0x42')](config['root'],_0xce6f('0x43')),_0xce6f('0x44'));var _0xedc2d=ejs[_0xce6f('0x45')](_0x3b2f4b,{'networks':_0x3bc677||[]});fs[_0xce6f('0x46')](_0xce6f('0x47'),_0xedc2d);return respondWithRpcPromise(_0xce6f('0x48'),_0xce6f('0x3e'),{'module':_0xce6f('0x49')});}else if(_0x17cd8b[_0xce6f('0x32')]['toUpperCase']()==_0xce6f('0x4a')){var _0x47499c=fs[_0xce6f('0x41')](path[_0xce6f('0x42')](config[_0xce6f('0x4b')],'server/files/templates/turn_multiple.ejs'),_0xce6f('0x44'));var _0x3574f2=ejs[_0xce6f('0x45')](_0x47499c,{'networks':_0x3bc677||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x3574f2);return respondWithRpcPromise(_0xce6f('0x48'),'create',{'module':_0xce6f('0x49')});}else{var _0x6b7962=fs['readFileSync'](path['join'](config[_0xce6f('0x4b')],'server/files/templates/network.ejs'),_0xce6f('0x44'));var _0x13859a=ejs['render'](_0x6b7962,{'networks':_0x3bc677||[]});fs['writeFileSync'](util[_0xce6f('0x4c')](_0xce6f('0x4d'),_0x1b4249[_0xce6f('0x3f')][_0xce6f('0x32')][_0xce6f('0x4e')]()),_0x13859a);return respondWithRpcPromise(_0xce6f('0x48'),_0xce6f('0x3e'),{'module':_0xce6f('0x4f')});}})[_0xce6f('0x9')](function(){return _0x17cd8b;})[_0xce6f('0x9')](respondWithResult(_0x331471,0xc9))['catch'](handleError(_0x331471,null));};exports[_0xce6f('0x1a')]=function(_0xf61cce,_0x21e1cd){var _0x217d24;return db[_0xce6f('0x21')]['find']({'where':{'id':_0xf61cce[_0xce6f('0x39')]['id']}})['then'](handleEntityNotFound(_0x21e1cd,null))[_0xce6f('0x9')](saveUpdates(_0xf61cce[_0xce6f('0x3f')],null))[_0xce6f('0x9')](function(_0x2f9c04){if(_0x2f9c04){_0x217d24=_0x2f9c04;return db[_0xce6f('0x21')]['findAll']({'where':{'type':_0x217d24[_0xce6f('0x32')]},'raw':!![]});}return null;})['then'](function(_0x30bcb0){if(_0x217d24['type'][_0xce6f('0x50')]()==_0xce6f('0x40')){var _0x37f854=fs[_0xce6f('0x41')](path[_0xce6f('0x42')](config['root'],_0xce6f('0x43')),_0xce6f('0x44'));var _0x5bb170=ejs[_0xce6f('0x45')](_0x37f854,{'networks':_0x30bcb0||[]});fs[_0xce6f('0x46')]('/etc/asterisk/stun_xcally.conf',_0x5bb170);return respondWithRpcPromise(_0xce6f('0x48'),_0xce6f('0x1a'),{'module':_0xce6f('0x49')});}else if(_0x217d24[_0xce6f('0x32')][_0xce6f('0x50')]()==_0xce6f('0x4a')){var _0x358950=fs[_0xce6f('0x41')](path[_0xce6f('0x42')](config[_0xce6f('0x4b')],_0xce6f('0x51')),_0xce6f('0x44'));var _0x2553c6=ejs[_0xce6f('0x45')](_0x358950,{'networks':_0x30bcb0||[]});fs[_0xce6f('0x46')](_0xce6f('0x52'),_0x2553c6);return respondWithRpcPromise(_0xce6f('0x48'),_0xce6f('0x1a'),{'module':_0xce6f('0x49')});}else{var _0x4617d2=fs[_0xce6f('0x41')](path[_0xce6f('0x42')](config['root'],_0xce6f('0x53')),_0xce6f('0x44'));var _0x1d46f7=ejs[_0xce6f('0x45')](_0x4617d2,{'networks':_0x30bcb0||[]});fs[_0xce6f('0x46')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xf61cce['body'][_0xce6f('0x32')]['toLowerCase']()),_0x1d46f7);return respondWithRpcPromise(_0xce6f('0x48'),_0xce6f('0x1a'),{'module':_0xce6f('0x4f')});}})[_0xce6f('0x9')](function(_0x4c19b5){if(_0x4c19b5){return _0x217d24;}return null;})[_0xce6f('0x9')](respondWithResult(_0x21e1cd,null))[_0xce6f('0x12')](handleError(_0x21e1cd,null));};exports[_0xce6f('0x1b')]=function(_0x1dba5a,_0x5867b6){var _0x18d200;return db[_0xce6f('0x21')][_0xce6f('0x3d')]({'where':{'id':_0x1dba5a['params']['id']}})[_0xce6f('0x9')](function(_0x227893){_0x18d200=_0x227893;return _0x227893;})[_0xce6f('0x9')](handleEntityNotFound(_0x5867b6,null))['then'](removeEntity(_0x5867b6,null))[_0xce6f('0x9')](function(){if(_0x18d200){return db[_0xce6f('0x21')][_0xce6f('0x37')]({'where':{'type':_0x18d200[_0xce6f('0x32')]},'raw':!![]});}})[_0xce6f('0x9')](function(_0x546bda){if(_0x18d200[_0xce6f('0x32')][_0xce6f('0x50')]()==_0xce6f('0x40')){var _0x88014c=fs[_0xce6f('0x41')](path['join'](config[_0xce6f('0x4b')],_0xce6f('0x43')),_0xce6f('0x44'));var _0x2b6da0=ejs[_0xce6f('0x45')](_0x88014c,{'networks':_0x546bda||[]});fs['writeFileSync'](_0xce6f('0x47'),_0x2b6da0);return respondWithRpcPromise('Reload','destroy',{'module':_0xce6f('0x49')});}else if(_0x18d200[_0xce6f('0x32')][_0xce6f('0x50')]()==_0xce6f('0x4a')){var _0x4e6dba=fs['readFileSync'](path[_0xce6f('0x42')](config['root'],_0xce6f('0x51')),_0xce6f('0x44'));var _0x556379=ejs[_0xce6f('0x45')](_0x4e6dba,{'networks':_0x546bda||[]});fs['writeFileSync'](_0xce6f('0x52'),_0x556379);return respondWithRpcPromise(_0xce6f('0x48'),_0xce6f('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x5151ad=fs[_0xce6f('0x41')](path[_0xce6f('0x42')](config[_0xce6f('0x4b')],_0xce6f('0x53')),_0xce6f('0x44'));var _0x3ba1b4=ejs[_0xce6f('0x45')](_0x5151ad,{'networks':_0x546bda||[]});fs[_0xce6f('0x46')](util[_0xce6f('0x4c')](_0xce6f('0x4d'),_0x18d200[_0xce6f('0x32')]['toLowerCase']()),_0x3ba1b4);return respondWithRpcPromise(_0xce6f('0x48'),_0xce6f('0x1b'),{'module':'chan_sip.so'});}})[_0xce6f('0x12')](handleError(_0x5867b6,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index aebd571..d1441d5 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 _0x4058=['api','moment','bluebird','request-promise','path','rimraf','define','Network','network','lodash','util','../../config/logger'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x4058,0x129));var _0x8405=function(_0x481c33,_0x44d580){_0x481c33=_0x481c33-0x0;var _0x462be3=_0x4058[_0x481c33];return _0x462be3;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var logger=require(_0x8405('0x2'))(_0x8405('0x3'));var moment=require(_0x8405('0x4'));var BPromise=require(_0x8405('0x5'));var rp=require(_0x8405('0x6'));var fs=require('fs');var path=require(_0x8405('0x7'));var rimraf=require(_0x8405('0x8'));var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x1db7ea,_0x257d43){return _0x1db7ea[_0x8405('0x9')](_0x8405('0xa'),attributes,{'tableName':_0x8405('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e54=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Network','lodash','api','moment'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x2e54,0x1dd));var _0x42e5=function(_0x386cd5,_0x19148c){_0x386cd5=_0x386cd5-0x0;var _0x283c50=_0x2e54[_0x386cd5];return _0x283c50;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x42e5('0x1'));var moment=require(_0x42e5('0x2'));var BPromise=require(_0x42e5('0x3'));var rp=require(_0x42e5('0x4'));var fs=require('fs');var path=require(_0x42e5('0x5'));var rimraf=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var attributes=require('./network.attributes');module[_0x42e5('0x8')]=function(_0x455f48,_0x38cb1b){return _0x455f48['define'](_0x42e5('0x9'),attributes,{'tableName':'network','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 b3c2cd2..7451be3 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x33cd4d,_0x4a646b){_0x33cd4d=_0x33cd4d-0x0;var _0x294fdc=_0x7a54[_0x33cd4d];return _0x294fdc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x5931b3,_0x2fac47){var _0xba87a3=function(_0x594b72){while(--_0x594b72){_0x5931b3['push'](_0x5931b3['shift']());}};_0xba87a3(++_0x2fac47);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 919c09d..3363c63 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 _0xb03e=['addApplications','/:id/users','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','addAnswer','/:id/notify','notify'];(function(_0xa26931,_0x43aab4){var _0x4696ee=function(_0x5946a4){while(--_0x5946a4){_0xa26931['push'](_0xa26931['shift']());}};_0x4696ee(++_0x43aab4);}(_0xb03e,0x1eb));var _0xeb03=function(_0x46ab36,_0x4e3e9a){_0x46ab36=_0x46ab36-0x0;var _0x2c7999=_0xb03e[_0x46ab36];return _0x2c7999;};'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('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0xa')](_0xeb03('0x14'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0xa')](_0xeb03('0x16'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x17')]);router[_0xeb03('0xa')]('/:id/users',auth[_0xeb03('0xb')](),controller[_0xeb03('0x18')]);router[_0xeb03('0x19')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0x19')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller['addDisposition']);router[_0xeb03('0x19')](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x1a')]);router[_0xeb03('0x19')](_0xeb03('0x1b'),controller[_0xeb03('0x1c')]);router[_0xeb03('0x19')](_0xeb03('0x14'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x1d')]);router[_0xeb03('0x19')](_0xeb03('0x1e'),auth[_0xeb03('0xb')](),controller['addAgents']);router[_0xeb03('0x19')](_0xeb03('0x1f'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x20')]);router[_0xeb03('0x21')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x22')]);router[_0xeb03('0x23')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x24')]);router[_0xeb03('0x23')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller['removeDispositions']);router[_0xeb03('0x23')](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x25')]);router[_0xeb03('0x23')](_0xeb03('0x1e'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x26')]);module[_0xeb03('0x27')]=router; \ No newline at end of file +var _0xfff0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','addDisposition','notify','post','addApplications','addAgents','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path'];(function(_0x2c886a,_0x43cd28){var _0x4979b5=function(_0x11fd23){while(--_0x11fd23){_0x2c886a['push'](_0x2c886a['shift']());}};_0x4979b5(++_0x43cd28);}(_0xfff0,0x139));var _0x0fff=function(_0x4f7482,_0x284455){_0x4f7482=_0x4f7482-0x0;var _0x346947=_0xfff0[_0x4f7482];return _0x346947;};'use strict';var multer=require('multer');var util=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express[_0x0fff('0x3')]();var fs_extra=require(_0x0fff('0x4'));var auth=require(_0x0fff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0fff('0x6'));var controller=require(_0x0fff('0x7'));router['get']('/',auth[_0x0fff('0x8')](),controller[_0x0fff('0x9')]);router[_0x0fff('0xa')]('/describe',auth[_0x0fff('0x8')](),controller['describe']);router[_0x0fff('0xa')]('/:id',auth[_0x0fff('0x8')](),controller[_0x0fff('0xb')]);router['get'](_0x0fff('0xc'),auth[_0x0fff('0x8')](),controller[_0x0fff('0xd')]);router[_0x0fff('0xa')](_0x0fff('0xe'),auth[_0x0fff('0x8')](),controller[_0x0fff('0xf')]);router[_0x0fff('0xa')](_0x0fff('0x10'),auth[_0x0fff('0x8')](),controller[_0x0fff('0x11')]);router['get'](_0x0fff('0x12'),auth['isAuthenticated'](),controller[_0x0fff('0x13')]);router[_0x0fff('0xa')](_0x0fff('0x14'),auth[_0x0fff('0x8')](),controller['getAgents']);router['post']('/',auth[_0x0fff('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0x0fff('0x8')](),controller[_0x0fff('0x15')]);router['post'](_0x0fff('0xe'),auth[_0x0fff('0x8')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x0fff('0x16')]);router[_0x0fff('0x17')](_0x0fff('0x10'),auth[_0x0fff('0x8')](),controller[_0x0fff('0x18')]);router[_0x0fff('0x17')]('/:id/users',auth[_0x0fff('0x8')](),controller[_0x0fff('0x19')]);router[_0x0fff('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0x0fff('0x1a')]);router[_0x0fff('0x1b')](_0x0fff('0x1c'),auth[_0x0fff('0x8')](),controller['update']);router[_0x0fff('0x1d')](_0x0fff('0x1c'),auth[_0x0fff('0x8')](),controller[_0x0fff('0x1e')]);router[_0x0fff('0x1d')](_0x0fff('0xc'),auth['isAuthenticated'](),controller[_0x0fff('0x1f')]);router[_0x0fff('0x1d')](_0x0fff('0xe'),auth[_0x0fff('0x8')](),controller[_0x0fff('0x20')]);router[_0x0fff('0x1d')]('/:id/users',auth[_0x0fff('0x8')](),controller[_0x0fff('0x21')]);module[_0x0fff('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 10222d2..9983091 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 _0x2642=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','BOOLEAN','INTEGER'];(function(_0xac7a28,_0x424fbb){var _0x507f02=function(_0x561194){while(--_0x561194){_0xac7a28['push'](_0xac7a28['shift']());}};_0x507f02(++_0x424fbb);}(_0x2642,0xa8));var _0x2264=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2642[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x2264('0x0'));var rs=require(_0x2264('0x1'));module[_0x2264('0x2')]={'name':{'type':Sequelize[_0x2264('0x3')],'unique':_0x2264('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x2264('0x3')]},'token':{'type':Sequelize[_0x2264('0x3')],'defaultValue':function(){return rs[_0x2264('0x5')]();}},'replyUri':{'type':Sequelize[_0x2264('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2264('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2264('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2264('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2264('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2264('0x3')]},'queueTransfer':{'type':Sequelize[_0x2264('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2264('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2264('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2264('0x8'),'set':function(_0x264902){if(!_0x264902)this[_0x2264('0x9')](_0x2264('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x264902);}}}; \ No newline at end of file +var _0xfac5=['mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x4e7b46,_0x1e5718){var _0x309599=function(_0x549658){while(--_0x549658){_0x4e7b46['push'](_0x4e7b46['shift']());}};_0x309599(++_0x1e5718);}(_0xfac5,0x114));var _0x5fac=function(_0x2b84e8,_0x4bb1a9){_0x2b84e8=_0x2b84e8-0x0;var _0x3f60be=_0xfac5[_0x2b84e8];return _0x3f60be;};'use strict';var Sequelize=require(_0x5fac('0x0'));var rs=require('randomstring');module[_0x5fac('0x1')]={'name':{'type':Sequelize[_0x5fac('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5fac('0x3')]();}},'replyUri':{'type':Sequelize[_0x5fac('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5fac('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5fac('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5fac('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5fac('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5fac('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5fac('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5fac('0x2')]},'queueTransfer':{'type':Sequelize[_0x5fac('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5fac('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5fac('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5fac('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5fac('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x5fac('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x5fac('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a1d25){if(!_0x1a1d25)this[_0x5fac('0x8')](_0x5fac('0x9'),null);this['setDataValue'](_0x5fac('0xa'),_0x1a1d25);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 848345e..e4b2896 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 _0x5655=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','count','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','Pause','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','List','OpenchannelApplication','account','Applications','list','applications','priority','asc','Contacts','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','startRouting','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','send','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util'];(function(_0x3db0ab,_0xb89f4f){var _0x5895ea=function(_0x4d17cd){while(--_0x4d17cd){_0x3db0ab['push'](_0x3db0ab['shift']());}};_0x5895ea(++_0xb89f4f);}(_0x5655,0x15e));var _0x5565=function(_0x96fa94,_0x255e13){_0x96fa94=_0x96fa94-0x0;var _0x3fc1ab=_0x5655[_0x96fa94];return _0x3fc1ab;};'use strict';var emlformat=require(_0x5565('0x0'));var rimraf=require(_0x5565('0x1'));var zipdir=require(_0x5565('0x2'));var jsonpatch=require(_0x5565('0x3'));var rp=require(_0x5565('0x4'));var moment=require(_0x5565('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5565('0x6'));var path=require('path');var sox=require(_0x5565('0x7'));var csv=require(_0x5565('0x8'));var ejs=require(_0x5565('0x9'));var fs=require('fs');var fs_extra=require(_0x5565('0xa'));var _=require(_0x5565('0xb'));var squel=require('squel');var crypto=require(_0x5565('0xc'));var jsforce=require(_0x5565('0xd'));var deskjs=require(_0x5565('0xe'));var toCsv=require(_0x5565('0x8'));var querystring=require(_0x5565('0xf'));var Papa=require(_0x5565('0x10'));var Redis=require('ioredis');var authService=require(_0x5565('0x11'));var qs=require(_0x5565('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5565('0x13'))(_0x5565('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5565('0x15'));var db=require(_0x5565('0x16'))['db'];config[_0x5565('0x17')]=_[_0x5565('0x18')](config[_0x5565('0x17')],{'host':_0x5565('0x19'),'port':0x18eb});var socket=require(_0x5565('0x1a'))(new Redis(config[_0x5565('0x17')]));require('./openchannelAccount.socket')[_0x5565('0x1b')](socket);var jayson=require(_0x5565('0x1c'));var client=jayson[_0x5565('0x1d')][_0x5565('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x5565('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x42b966,_0x2e252c,_0x2b31e0,_0x433461){return new BPromise(function(_0x592af2,_0x572993){var _0x2e61b0=_0x433461||client;return _0x2e61b0[_0x5565('0x1f')](_0x42b966,_0x2b31e0)['then'](function(_0x36d189){logger[_0x5565('0x20')](_0x5565('0x21'),_0x2e252c,_0x5565('0x22'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2e252c,_0x5565('0x22'),JSON[_0x5565('0x23')](_0x36d189));if(_0x36d189[_0x5565('0x24')]){if(_0x36d189[_0x5565('0x24')][_0x5565('0x25')]===0x1f4){logger[_0x5565('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x2e252c,_0x36d189[_0x5565('0x24')][_0x5565('0x26')]);return _0x572993(_0x36d189['error'][_0x5565('0x26')]);}logger[_0x5565('0x24')](_0x5565('0x21'),_0x2e252c,_0x36d189['error'][_0x5565('0x26')]);return _0x592af2(_0x36d189['error'][_0x5565('0x26')]);}else{logger[_0x5565('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x2e252c,'request\x20sent');_0x592af2(_0x36d189[_0x5565('0x27')][_0x5565('0x26')]);}})[_0x5565('0x28')](function(_0x53fe47){logger['error'](_0x5565('0x21'),_0x2e252c,_0x53fe47);_0x572993(_0x53fe47);});});}function respondWithStatusCode(_0x2d3615,_0x51f2fb){_0x51f2fb=_0x51f2fb||0xcc;return function(_0x37be5b){if(_0x37be5b){return _0x2d3615[_0x5565('0x29')](_0x51f2fb);}return _0x2d3615['status'](_0x51f2fb)[_0x5565('0x2a')]();};}function respondWithResult(_0x4eed17,_0x3d0171){_0x3d0171=_0x3d0171||0xc8;return function(_0x2fbd34){if(_0x2fbd34){return _0x4eed17[_0x5565('0x2b')](_0x3d0171)[_0x5565('0x2c')](_0x2fbd34);}};}function respondWithFilteredResult(_0x8d4988,_0x6a825a){return function(_0x168f16){if(_0x168f16){var _0x33bcb6=typeof _0x6a825a[_0x5565('0x2d')]==='undefined'&&typeof _0x6a825a[_0x5565('0x2e')]==='undefined';var _0x4b73f6=_0x168f16[_0x5565('0x2f')];var _0x5b032c=_0x33bcb6?0x0:_0x6a825a[_0x5565('0x2d')];var _0x392579=_0x33bcb6?_0x168f16[_0x5565('0x2f')]:_0x6a825a['offset']+_0x6a825a['limit'];var _0x33765b;if(_0x392579>=_0x4b73f6){_0x392579=_0x4b73f6;_0x33765b=0xc8;}else{_0x33765b=0xce;}_0x8d4988[_0x5565('0x2b')](_0x33765b);return _0x8d4988[_0x5565('0x30')]('Content-Range',_0x5b032c+'-'+_0x392579+'/'+_0x4b73f6)['json'](_0x168f16);}return null;};}function patchUpdates(_0x2ac2b3){return function(_0x5d08f5){try{jsonpatch[_0x5565('0x31')](_0x5d08f5,_0x2ac2b3,!![]);}catch(_0x5b8749){return BPromise[_0x5565('0x32')](_0x5b8749);}return _0x5d08f5['save']();};}function saveUpdates(_0x4bb864,_0xc04467){return function(_0x2a1024){if(_0x2a1024){return _0x2a1024['update'](_0x4bb864)[_0x5565('0x33')](function(_0x1cdb32){return _0x1cdb32;});}return null;};}function removeEntity(_0x20ca59,_0x3b3722){return function(_0x140718){if(_0x140718){return _0x140718[_0x5565('0x34')]()[_0x5565('0x33')](function(){var _0x1a7399=_0x140718[_0x5565('0x35')]({'plain':!![]});var _0x401bf1='OpenchannelAccounts';return db[_0x5565('0x36')][_0x5565('0x34')]({'where':{'type':_0x401bf1,'resourceId':_0x1a7399['id']}})['then'](function(){return _0x140718;});})[_0x5565('0x33')](function(){_0x20ca59[_0x5565('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x381e53,_0x26f44e){return function(_0x4cc382){if(!_0x4cc382){_0x381e53['sendStatus'](0x194);}return _0x4cc382;};}function handleError(_0x2260ba,_0x3ccd99){_0x3ccd99=_0x3ccd99||0x1f4;return function(_0x29b2f9){logger[_0x5565('0x24')](_0x29b2f9[_0x5565('0x37')]);if(_0x29b2f9[_0x5565('0x38')]){delete _0x29b2f9[_0x5565('0x38')];}_0x2260ba[_0x5565('0x2b')](_0x3ccd99)['send'](_0x29b2f9);};}exports['index']=function(_0x4c1254,_0x20af35){var _0x16a0f9={'include':[{'model':db['Pause'],'as':_0x5565('0x39')}]},_0x4efad9={},_0x466bf4={'count':0x0,'rows':[]};var _0x4a0b19=_['map'](db[_0x5565('0x3a')][_0x5565('0x3b')],function(_0xf33f0f){return{'name':_0xf33f0f['fieldName'],'type':_0xf33f0f[_0x5565('0x3c')]['key']};});_0x4efad9[_0x5565('0x3d')]=_['map'](_0x4a0b19,'name');_0x4efad9[_0x5565('0x3e')]=_['keys'](_0x4c1254[_0x5565('0x3e')]);_0x4efad9['filters']=_['intersection'](_0x4efad9[_0x5565('0x3d')],_0x4efad9[_0x5565('0x3e')]);_0x16a0f9[_0x5565('0x3f')]=_[_0x5565('0x40')](_0x4efad9[_0x5565('0x3d')],qs[_0x5565('0x41')](_0x4c1254[_0x5565('0x3e')]['fields']));_0x16a0f9[_0x5565('0x3f')]=_0x16a0f9[_0x5565('0x3f')][_0x5565('0x42')]?_0x16a0f9[_0x5565('0x3f')]:_0x4efad9[_0x5565('0x3d')];if(!_0x4c1254[_0x5565('0x3e')][_0x5565('0x43')](_0x5565('0x44'))){_0x16a0f9['limit']=qs['limit'](_0x4c1254['query'][_0x5565('0x2e')]);_0x16a0f9[_0x5565('0x2d')]=qs[_0x5565('0x2d')](_0x4c1254[_0x5565('0x3e')]['offset']);}_0x16a0f9[_0x5565('0x45')]=qs[_0x5565('0x46')](_0x4c1254[_0x5565('0x3e')][_0x5565('0x46')]);_0x16a0f9[_0x5565('0x47')]=qs[_0x5565('0x48')](_[_0x5565('0x49')](_0x4c1254['query'],_0x4efad9[_0x5565('0x48')]),_0x4a0b19);if(_0x4c1254[_0x5565('0x3e')][_0x5565('0x4a')]){_0x16a0f9[_0x5565('0x47')]=_[_0x5565('0x4b')](_0x16a0f9[_0x5565('0x47')],{'$or':_[_0x5565('0x4c')](_0x4a0b19,function(_0x7ede13){if(_0x7ede13['type']!==_0x5565('0x4d')){var _0x27232a={};_0x27232a[_0x7ede13['name']]={'$like':'%'+_0x4c1254[_0x5565('0x3e')][_0x5565('0x4a')]+'%'};return _0x27232a;}})});}_0x16a0f9=_['merge']({},_0x16a0f9,_0x4c1254['options']);var _0x354336={'where':_0x16a0f9['where']};return db[_0x5565('0x3a')][_0x5565('0x2f')](_0x354336)['then'](function(_0x16bff6){_0x466bf4['count']=_0x16bff6;if(_0x4c1254['query']['includeAll']){_0x16a0f9[_0x5565('0x4e')]=[{'all':!![]}];}return db[_0x5565('0x3a')][_0x5565('0x4f')](_0x16a0f9);})['then'](function(_0x57d2c8){_0x466bf4[_0x5565('0x50')]=_0x57d2c8;return _0x466bf4;})[_0x5565('0x33')](respondWithFilteredResult(_0x20af35,_0x16a0f9))[_0x5565('0x28')](handleError(_0x20af35,null));};exports[_0x5565('0x51')]=function(_0x143472,_0x522468){var _0x97e8eb={'raw':![],'where':{'id':_0x143472[_0x5565('0x52')]['id']},'include':[{'model':db[_0x5565('0x53')],'as':_0x5565('0x39')}]},_0x4c82d9={};_0x4c82d9[_0x5565('0x3d')]=_[_0x5565('0x54')](db[_0x5565('0x3a')][_0x5565('0x3b')]);_0x4c82d9[_0x5565('0x3e')]=_[_0x5565('0x54')](_0x143472[_0x5565('0x3e')]);_0x4c82d9[_0x5565('0x48')]=_[_0x5565('0x40')](_0x4c82d9[_0x5565('0x3d')],_0x4c82d9[_0x5565('0x3e')]);_0x97e8eb[_0x5565('0x3f')]=_[_0x5565('0x40')](_0x4c82d9[_0x5565('0x3d')],qs[_0x5565('0x41')](_0x143472[_0x5565('0x3e')][_0x5565('0x41')]));_0x97e8eb['attributes']=_0x97e8eb[_0x5565('0x3f')][_0x5565('0x42')]?_0x97e8eb[_0x5565('0x3f')]:_0x4c82d9[_0x5565('0x3d')];if(_0x143472[_0x5565('0x3e')][_0x5565('0x55')]){_0x97e8eb['include']=[{'all':!![]}];}_0x97e8eb=_[_0x5565('0x4b')]({},_0x97e8eb,_0x143472[_0x5565('0x56')]);return db[_0x5565('0x3a')][_0x5565('0x57')](_0x97e8eb)['then'](handleEntityNotFound(_0x522468,null))[_0x5565('0x33')](respondWithResult(_0x522468,null))['catch'](handleError(_0x522468,null));};exports[_0x5565('0x58')]=function(_0x3a5e7c,_0x45996c){return db[_0x5565('0x3a')][_0x5565('0x58')](_0x3a5e7c[_0x5565('0x59')],{})['then'](function(_0x2f0fdd){var _0x2db1e6=_0x3a5e7c[_0x5565('0x5a')][_0x5565('0x35')]({'plain':!![]});if(!_0x2db1e6)throw new Error(_0x5565('0x5b'));if(_0x2db1e6[_0x5565('0x5c')]===_0x5565('0x5a')){var _0x4f85af=_0x2f0fdd[_0x5565('0x35')]({'plain':!![]});var _0x4baa33='OpenchannelAccounts';return db[_0x5565('0x5d')]['find']({'where':{'name':_0x4baa33,'userProfileId':_0x2db1e6['userProfileId']},'raw':!![]})[_0x5565('0x33')](function(_0xcfeb4b){if(_0xcfeb4b&&_0xcfeb4b['autoAssociation']===0x0){return db[_0x5565('0x36')][_0x5565('0x58')]({'name':_0x4f85af['name'],'resourceId':_0x4f85af['id'],'type':_0xcfeb4b[_0x5565('0x38')],'sectionId':_0xcfeb4b['id']},{})['then'](function(){return _0x2f0fdd;});}else{return _0x2f0fdd;}})[_0x5565('0x28')](function(_0x1e29b1){logger[_0x5565('0x24')](_0x5565('0x5e'),_0x1e29b1);throw _0x1e29b1;});}return _0x2f0fdd;})[_0x5565('0x33')](respondWithResult(_0x45996c,0xc9))[_0x5565('0x28')](handleError(_0x45996c,null));};exports[_0x5565('0x5f')]=function(_0xf6f5b6,_0x2cfda0){if(_0xf6f5b6['body']['id']){delete _0xf6f5b6[_0x5565('0x59')]['id'];}return db[_0x5565('0x3a')][_0x5565('0x57')]({'where':{'id':_0xf6f5b6['params']['id']},'include':[{'model':db['Pause'],'as':_0x5565('0x39')}]})[_0x5565('0x33')](handleEntityNotFound(_0x2cfda0,null))['then'](saveUpdates(_0xf6f5b6[_0x5565('0x59')],null))['then'](respondWithResult(_0x2cfda0,null))[_0x5565('0x28')](handleError(_0x2cfda0,null));};exports[_0x5565('0x34')]=function(_0x130de7,_0x29b19a){return db[_0x5565('0x3a')][_0x5565('0x57')]({'where':{'id':_0x130de7[_0x5565('0x52')]['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x29b19a,null))[_0x5565('0x33')](removeEntity(_0x29b19a,null))['catch'](handleError(_0x29b19a,null));};exports[_0x5565('0x60')]=function(_0x1e7fa9,_0x274e77){return db['OpenchannelAccount'][_0x5565('0x60')]()[_0x5565('0x33')](respondWithResult(_0x274e77,null))[_0x5565('0x28')](handleError(_0x274e77,null));};exports['addDisposition']=function(_0x147382,_0x2e0ca6,_0x30aef3){if(_0x147382['body']['id']){delete _0x147382[_0x5565('0x59')]['id'];}return db[_0x5565('0x3a')][_0x5565('0x57')]({'where':{'id':_0x147382['params']['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x2e0ca6,null))[_0x5565('0x33')](function(_0x5900f7){if(_0x5900f7){_0x147382[_0x5565('0x59')][_0x5565('0x61')]=_0x5900f7['id'];return db[_0x5565('0x62')][_0x5565('0x58')](_0x147382[_0x5565('0x59')]);}})['then'](respondWithResult(_0x2e0ca6,null))[_0x5565('0x28')](handleError(_0x2e0ca6,null));};exports[_0x5565('0x63')]=function(_0x1d743c,_0xc45fc7,_0xd5bf96){var _0x4d538d={'raw':![],'where':{}};var _0x2cdce4={};var _0x186522={'count':0x0,'rows':[]};return db[_0x5565('0x3a')][_0x5565('0x64')]({'where':{'id':_0x1d743c[_0x5565('0x52')]['id']}})[_0x5565('0x33')](handleEntityNotFound(_0xc45fc7,null))[_0x5565('0x33')](function(_0x506050){if(_0x506050){_0x2cdce4[_0x5565('0x3d')]=_[_0x5565('0x54')](db[_0x5565('0x62')]['rawAttributes']);_0x2cdce4[_0x5565('0x3e')]=_[_0x5565('0x54')](_0x1d743c[_0x5565('0x3e')]);_0x2cdce4['filters']=_[_0x5565('0x40')](_0x2cdce4[_0x5565('0x3d')],_0x2cdce4['query']);_0x4d538d['attributes']=_['intersection'](_0x2cdce4[_0x5565('0x3d')],qs['fields'](_0x1d743c[_0x5565('0x3e')][_0x5565('0x41')]));_0x4d538d[_0x5565('0x3f')]=_0x4d538d[_0x5565('0x3f')][_0x5565('0x42')]?_0x4d538d['attributes']:_0x2cdce4[_0x5565('0x3d')];if(!_0x1d743c[_0x5565('0x3e')][_0x5565('0x43')]('nolimit')){_0x4d538d[_0x5565('0x2e')]=qs[_0x5565('0x2e')](_0x1d743c[_0x5565('0x3e')][_0x5565('0x2e')]);_0x4d538d['offset']=qs['offset'](_0x1d743c['query'][_0x5565('0x2d')]);}_0x4d538d['order']=qs[_0x5565('0x46')](_0x1d743c[_0x5565('0x3e')][_0x5565('0x46')]);_0x4d538d[_0x5565('0x47')]=qs[_0x5565('0x48')](_['pick'](_0x1d743c['query'],_0x2cdce4[_0x5565('0x48')]));_0x4d538d[_0x5565('0x47')][_0x5565('0x61')]=_0x506050['id'];if(_0x1d743c[_0x5565('0x3e')][_0x5565('0x4a')]){_0x4d538d[_0x5565('0x47')]=_[_0x5565('0x4b')](_0x4d538d[_0x5565('0x47')],{'$or':_['map'](_0x4d538d[_0x5565('0x3f')],function(_0x286064){var _0x250349={};_0x250349[_0x286064]={'$like':'%'+_0x1d743c[_0x5565('0x3e')][_0x5565('0x4a')]+'%'};return _0x250349;})});}_0x4d538d=_[_0x5565('0x4b')]({},_0x4d538d,_0x1d743c[_0x5565('0x56')]);return db['Disposition'][_0x5565('0x2f')]({'where':_0x4d538d[_0x5565('0x47')]})[_0x5565('0x33')](function(_0x43bdbb){_0x186522[_0x5565('0x2f')]=_0x43bdbb;if(_0x1d743c[_0x5565('0x3e')][_0x5565('0x55')]){_0x4d538d[_0x5565('0x4e')]=[{'all':!![]}];}return db[_0x5565('0x62')][_0x5565('0x4f')](_0x4d538d);})[_0x5565('0x33')](function(_0x5d629f){_0x186522[_0x5565('0x50')]=_0x5d629f;return _0x186522;});}})[_0x5565('0x33')](respondWithFilteredResult(_0xc45fc7,_0x4d538d))['catch'](handleError(_0xc45fc7,null));};exports[_0x5565('0x65')]=function(_0x105af8,_0x11933d,_0x2970f8){return db['OpenchannelAccount'][_0x5565('0x57')]({'where':{'id':_0x105af8[_0x5565('0x52')]['id']}})['then'](handleEntityNotFound(_0x11933d,null))[_0x5565('0x33')](function(_0x3f81d6){if(_0x3f81d6){return _0x3f81d6[_0x5565('0x65')](_0x105af8[_0x5565('0x3e')]['ids']);}})[_0x5565('0x33')](respondWithStatusCode(_0x11933d,null))[_0x5565('0x28')](handleError(_0x11933d,null));};exports[_0x5565('0x66')]=function(_0x3a4f18,_0x590631,_0x2bd36c){if(_0x3a4f18['body']['id']){delete _0x3a4f18[_0x5565('0x59')]['id'];}return db[_0x5565('0x3a')][_0x5565('0x57')]({'where':{'id':_0x3a4f18['params']['id']}})['then'](handleEntityNotFound(_0x590631,null))[_0x5565('0x33')](function(_0xe9027f){if(_0xe9027f){_0x3a4f18['body']['OpenchannelAccountId']=_0xe9027f['id'];return db[_0x5565('0x67')][_0x5565('0x58')](_0x3a4f18[_0x5565('0x59')]);}})[_0x5565('0x33')](respondWithResult(_0x590631,null))[_0x5565('0x28')](handleError(_0x590631,null));};exports[_0x5565('0x68')]=function(_0x23323c,_0x4ec8b0,_0xf4d6d7){var _0x1fc9f3={'raw':![],'where':{}};var _0x34f9c6={};var _0x4acab8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5565('0x64')]({'where':{'id':_0x23323c['params']['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x4ec8b0,null))['then'](function(_0x77a334){if(_0x77a334){_0x34f9c6[_0x5565('0x3d')]=_[_0x5565('0x54')](db['CannedAnswer']['rawAttributes']);_0x34f9c6[_0x5565('0x3e')]=_[_0x5565('0x54')](_0x23323c['query']);_0x34f9c6['filters']=_[_0x5565('0x40')](_0x34f9c6[_0x5565('0x3d')],_0x34f9c6[_0x5565('0x3e')]);_0x1fc9f3[_0x5565('0x3f')]=_[_0x5565('0x40')](_0x34f9c6[_0x5565('0x3d')],qs[_0x5565('0x41')](_0x23323c['query']['fields']));_0x1fc9f3[_0x5565('0x3f')]=_0x1fc9f3[_0x5565('0x3f')][_0x5565('0x42')]?_0x1fc9f3[_0x5565('0x3f')]:_0x34f9c6['model'];if(!_0x23323c[_0x5565('0x3e')][_0x5565('0x43')](_0x5565('0x44'))){_0x1fc9f3[_0x5565('0x2e')]=qs[_0x5565('0x2e')](_0x23323c[_0x5565('0x3e')][_0x5565('0x2e')]);_0x1fc9f3[_0x5565('0x2d')]=qs['offset'](_0x23323c[_0x5565('0x3e')]['offset']);}_0x1fc9f3['order']=qs[_0x5565('0x46')](_0x23323c['query']['sort']);_0x1fc9f3[_0x5565('0x47')]=qs[_0x5565('0x48')](_[_0x5565('0x49')](_0x23323c[_0x5565('0x3e')],_0x34f9c6[_0x5565('0x48')]));_0x1fc9f3[_0x5565('0x47')][_0x5565('0x61')]=_0x77a334['id'];if(_0x23323c[_0x5565('0x3e')][_0x5565('0x4a')]){_0x1fc9f3[_0x5565('0x47')]=_['merge'](_0x1fc9f3['where'],{'$or':_[_0x5565('0x4c')](_0x1fc9f3[_0x5565('0x3f')],function(_0x23d89d){var _0x362ce3={};_0x362ce3[_0x23d89d]={'$like':'%'+_0x23323c['query'][_0x5565('0x4a')]+'%'};return _0x362ce3;})});}_0x1fc9f3=_['merge']({},_0x1fc9f3,_0x23323c['options']);return db[_0x5565('0x67')][_0x5565('0x2f')]({'where':_0x1fc9f3['where']})['then'](function(_0x2516ef){_0x4acab8[_0x5565('0x2f')]=_0x2516ef;if(_0x23323c['query'][_0x5565('0x55')]){_0x1fc9f3[_0x5565('0x4e')]=[{'all':!![]}];}return db[_0x5565('0x67')][_0x5565('0x4f')](_0x1fc9f3);})['then'](function(_0x42ac95){_0x4acab8[_0x5565('0x50')]=_0x42ac95;return _0x4acab8;});}})['then'](respondWithFilteredResult(_0x4ec8b0,_0x1fc9f3))[_0x5565('0x28')](handleError(_0x4ec8b0,null));};exports['removeAnswers']=function(_0x3d1e2e,_0x576bf1,_0xcd0bf3){return db[_0x5565('0x3a')][_0x5565('0x57')]({'where':{'id':_0x3d1e2e[_0x5565('0x52')]['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x576bf1,null))['then'](function(_0xbcbe51){if(_0xbcbe51){return _0xbcbe51[_0x5565('0x69')](_0x3d1e2e[_0x5565('0x3e')][_0x5565('0x6a')]);}})['then'](respondWithStatusCode(_0x576bf1,null))['catch'](handleError(_0x576bf1,null));};exports[_0x5565('0x6b')]=function(_0xf4b8e0,_0x2ae7e8,_0x788680){var _0x4b44aa={'body':_0xf4b8e0[_0x5565('0x59')],'channel':_0x5565('0x6c')};var _0x2662dd=[];var _0x4e56ee=[];var _0x221a15={};var _0x47729a=![];return db[_0x5565('0x6d')][_0x5565('0x60')]()['then'](function(_0x3a0672){if(!_0x3a0672){throw new db[(_0x5565('0x6e'))][(_0x5565('0x6f'))](_0x5565('0x70'));}_0x2662dd=_[_0x5565('0x71')](_[_0x5565('0x54')](_0x3a0672),[_0x5565('0x72'),_0x5565('0x73')]);_0x4e56ee=_[_0x5565('0x71')](_[_0x5565('0x54')](_0x3a0672),[_0x5565('0x72'),_0x5565('0x73'),_0x5565('0x74'),'ListId']);if(_0xf4b8e0[_0x5565('0x59')]['id']){delete _0xf4b8e0[_0x5565('0x59')]['id'];}if(_[_0x5565('0x75')](_0xf4b8e0[_0x5565('0x59')][_0x5565('0x76')])){throw new db[(_0x5565('0x6e'))][(_0x5565('0x6f'))](_0x5565('0x77'));}if(_['isNil'](_0xf4b8e0[_0x5565('0x59')]['body'])||_0xf4b8e0['body'][_0x5565('0x59')]===''){throw new db['Sequelize'][(_0x5565('0x6f'))](_0x5565('0x78'));}if(_[_0x5565('0x75')](_0xf4b8e0[_0x5565('0x59')][_0x5565('0x79')])){throw new db[(_0x5565('0x6e'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e56ee);}if(!_['includes'](_0x4e56ee,_0xf4b8e0['body']['mapKey'])){throw new db['Sequelize'][(_0x5565('0x6f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e56ee);}_0x221a15[_0xf4b8e0['body'][_0x5565('0x79')]]=_0xf4b8e0['body'][_0x5565('0x76')];})[_0x5565('0x33')](function(){return db[_0x5565('0x3a')][_0x5565('0x57')]({'where':{'id':_0xf4b8e0[_0x5565('0x52')]['id']},'include':[{'model':db[_0x5565('0x7a')],'as':_0x5565('0x7b'),'include':[{'model':db[_0x5565('0x6d')],'as':'Contacts','where':_0x221a15,'limit':0x1,'order':[[_0x5565('0x73'),'DESC']]}]},{'model':db[_0x5565('0x7c')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x2ae7e8,null))[_0x5565('0x33')](function(_0x47f632){if(_0x47f632&&_0x47f632[_0x5565('0x7b')]){_0x4b44aa[_0x5565('0x7d')]=_0x47f632;_0x4b44aa['applications']=_0x47f632[_0x5565('0x7e')];_0x4b44aa[_0x5565('0x7f')]=_0x47f632[_0x5565('0x7b')];_0x4b44aa[_0x5565('0x80')]=_['orderBy'](_0x4b44aa[_0x5565('0x80')],[_0x5565('0x81')],[_0x5565('0x82')]);if(_0x4b44aa[_0x5565('0x7d')]['Applications']){delete _0x4b44aa[_0x5565('0x7d')][_0x5565('0x7e')];}if(_0x4b44aa[_0x5565('0x7d')][_0x5565('0x7b')]&&_0x4b44aa['account']['List'][_0x5565('0x83')][_0x5565('0x42')]){return _0x4b44aa[_0x5565('0x7d')][_0x5565('0x7b')][_0x5565('0x83')][0x0];}var _0x135226=_['defaults'](_0xf4b8e0[_0x5565('0x59')],{'firstName':_0xf4b8e0[_0x5565('0x59')][_0x5565('0x76')],'ListId':_0x47f632[_0x5565('0x84')]});_0x135226[_0xf4b8e0[_0x5565('0x59')][_0x5565('0x79')]]=_0xf4b8e0[_0x5565('0x59')][_0x5565('0x76')];return db[_0x5565('0x6d')]['create'](_0x135226,{'fields':_0x2662dd,'raw':!![]});}})[_0x5565('0x33')](handleEntityNotFound(_0x2ae7e8,null))[_0x5565('0x33')](function(_0x577840){_0x4b44aa[_0x5565('0x85')]=_0x577840;if(_0x577840){var _0x2bb8f8={'ContactId':_0x577840['id'],'OpenchannelAccountId':_0xf4b8e0[_0x5565('0x52')]['id'],'from':(_0x577840[_0x5565('0x86')]||'')+'\x20'+(_0x577840['lastName']||'')};var _0x4040d5={'OpenchannelAccountId':_0xf4b8e0[_0x5565('0x52')]['id'],'closed':![]};if(_0xf4b8e0[_0x5565('0x59')][_0x5565('0x87')]){_0x4040d5[_0x5565('0x87')]=_0xf4b8e0[_0x5565('0x59')][_0x5565('0x87')];return db[_0x5565('0x88')][_0x5565('0x57')]({'where':_0x4040d5})[_0x5565('0x33')](function(_0xb304fb){if(_0xb304fb){return[_0xb304fb,![]];}_0x2bb8f8[_0x5565('0x87')]=_0xf4b8e0[_0x5565('0x59')][_0x5565('0x87')];_0x2bb8f8[_0x5565('0x89')]=_0xf4b8e0[_0x5565('0x59')][_0x5565('0x89')];return db['OpenchannelInteraction'][_0x5565('0x58')](_0x2bb8f8)[_0x5565('0x33')](function(_0x15278c){return[_0x15278c,!![]];});});}else{_0x4040d5[_0x5565('0x87')]=null;}_0x4040d5['ContactId']=_0x577840['id'];return db[_0x5565('0x88')][_0x5565('0x57')]({'where':_0x4040d5})['then'](function(_0x22969f){if(_0x22969f){return[_0x22969f,![]];}return db[_0x5565('0x88')][_0x5565('0x58')](_0x2bb8f8)[_0x5565('0x33')](function(_0x4dc3a8){return[_0x4dc3a8,!![]];});});}})[_0x5565('0x8a')](function(_0x73c496,_0x5b6304){if(_0x73c496){_0x47729a=_0x5b6304;if(!_0x5b6304){var _0x356ddf={'from':(_0x4b44aa[_0x5565('0x85')][_0x5565('0x86')]||'')+'\x20'+(_0x4b44aa[_0x5565('0x85')][_0x5565('0x8b')]||'')};if(_0xf4b8e0[_0x5565('0x59')][_0x5565('0x87')]&&_0xf4b8e0[_0x5565('0x59')]['messageId']&&_0xf4b8e0[_0x5565('0x59')][_0x5565('0x87')]!=_0xf4b8e0[_0x5565('0x59')][_0x5565('0x8c')]){_0x356ddf[_0x5565('0x87')]=_0xf4b8e0[_0x5565('0x59')][_0x5565('0x8c')];}return _0x73c496[_0x5565('0x5f')](_0x356ddf);}else{return _0x73c496;}}})[_0x5565('0x33')](function(_0x381f95){_0x4b44aa[_0x5565('0x8d')]=_0x381f95[_0x5565('0x35')]({'plain':!![]});_0x4b44aa[_0x5565('0x8d')][_0x5565('0x8e')]=_0x47729a;if(_0x4b44aa[_0x5565('0x8d')]['created']){if(_0x4b44aa['account'][_0x5565('0x8f')]){_0x4b44aa[_0x5565('0x80')][_0x5565('0x90')]({'id':0x0,'priority':_0x4b44aa[_0x5565('0x80')][_0x5565('0x42')]+0x1,'app':_0x5565('0x91'),'appdata':'unmanaged','interval':_0x5565('0x92')});}}return db[_0x5565('0x93')]['create']({'body':_0xf4b8e0[_0x5565('0x59')][_0x5565('0x59')],'OpenchannelAccountId':_0xf4b8e0[_0x5565('0x52')]['id'],'OpenchannelInteractionId':_0x381f95['id'],'direction':'in','ContactId':_0x4b44aa[_0x5565('0x85')]['id'],'AttachmentId':_0xf4b8e0[_0x5565('0x59')][_0x5565('0x94')]});})[_0x5565('0x33')](function(_0x236840){_0x4b44aa[_0x5565('0x26')]=_0x236840;if(!_0x4b44aa[_0x5565('0x8d')][_0x5565('0x95')])return;return db[_0x5565('0x96')][_0x5565('0x57')]({'attributes':['id','name'],'where':{'id':_0x4b44aa[_0x5565('0x8d')]['UserId']}});})[_0x5565('0x33')](function(_0x360d69){if(_0x360d69){_0x4b44aa[_0x5565('0x80')][_0x5565('0x97')]({'id':0x0,'priority':0x0,'app':_0x5565('0x98'),'appdata':_0x360d69[_0x5565('0x38')]+','+(_0x4b44aa[_0x5565('0x7d')][_0x5565('0x99')]||0xa),'interval':'*,*,*,*'});}if(!_0x4b44aa[_0x5565('0x8d')][_0x5565('0x9a')])return;return db[_0x5565('0x9b')][_0x5565('0x57')]({'attributes':['id',_0x5565('0x38')],'where':{'id':_0x4b44aa[_0x5565('0x8d')][_0x5565('0x9a')]}});})[_0x5565('0x33')](function(_0x3c3794){if(_0x3c3794){_0x4b44aa[_0x5565('0x80')][_0x5565('0x97')]({'id':0x0,'priority':0x1,'app':_0x5565('0x9c'),'appdata':_0x3c3794[_0x5565('0x38')]+','+(_0x4b44aa[_0x5565('0x7d')]['waitForTheAssignedQueue']||0x12c),'interval':_0x5565('0x92')});}return respondWithRpcPromise('Start',_0x5565('0x9d'),_0x4b44aa);})[_0x5565('0x33')](function(_0x47b311){respondWithRpcPromise('EventManager','EventManager',{'event':_0x5565('0x6b'),'message':_0x47b311},client9002);return _0x47b311;})['then'](respondWithResult(_0x2ae7e8,null))['catch'](handleError(_0x2ae7e8,null));};exports[_0x5565('0x9e')]=function(_0x24e1c6,_0x422618){var _0x2b5cf4=_0x24e1c6[_0x5565('0x52')]['id'];var _0x40c140=_0x24e1c6[_0x5565('0x59')];var _0x4b5012=0xc8;var _0x4e6761=null;return db['sequelize'][_0x5565('0x9f')]({'isolationLevel':db[_0x5565('0xa0')][_0x5565('0xa1')][_0x5565('0xa2')][_0x5565('0xa3')]},function(_0x2709fe){return db[_0x5565('0x3a')][_0x5565('0x64')]({'where':{'id':_0x2b5cf4},'transaction':_0x2709fe})[_0x5565('0x33')](function(_0x320f88){if(_0x320f88){return db[_0x5565('0x7c')][_0x5565('0x34')]({'where':{'OpenchannelAccountId':_0x2b5cf4},'transaction':_0x2709fe})['then'](function(){var _0x2b04b4=_[_0x5565('0x4c')](_0x40c140,function(_0x3bca89){_0x3bca89[_0x5565('0x61')]=_0x2b5cf4;return _0x3bca89;});return db[_0x5565('0x7c')][_0x5565('0xa4')](_0x2b04b4,{'transaction':_0x2709fe});});}else{_0x4b5012=0x194;_0x4e6761=[];}});})[_0x5565('0x33')](function(){if(_0x4b5012!==0x194){return db[_0x5565('0x7c')][_0x5565('0xa5')]({'where':{'OpenchannelAccountId':_0x2b5cf4},'order':_0x5565('0x81')})[_0x5565('0x33')](function(_0x186fa3){_0x4e6761=_0x186fa3;});}})['catch'](function(_0x41d478){_0x4b5012=0x1f4;logger[_0x5565('0x24')](_0x41d478[_0x5565('0x37')]);if(_0x41d478['name']){delete _0x41d478[_0x5565('0x38')];}_0x4e6761=_0x41d478;})['finally'](function(){if(_0x4e6761===null){_0x422618[_0x5565('0x29')](_0x4b5012);}else{if(_0x4b5012===0x1f4){_0x422618[_0x5565('0x2b')](_0x4b5012)['send'](_0x4e6761);}else{_0x422618[_0x5565('0x2b')](_0x4b5012)[_0x5565('0x2c')](_0x4e6761);}}});};exports[_0x5565('0xa6')]=function(_0x10bbe7,_0x3222ba,_0x30ea2a){var _0x31c263={};var _0x2951b3={};var _0x2582a4;var _0x20267e;return db[_0x5565('0x3a')]['findOne']({'where':{'id':_0x10bbe7[_0x5565('0x52')]['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x3222ba,null))[_0x5565('0x33')](function(_0x428a1d){if(_0x428a1d){_0x2582a4=_0x428a1d;_0x2951b3['model']=_['keys'](db['OpenchannelApplication'][_0x5565('0x3b')]);_0x2951b3[_0x5565('0x3e')]=_[_0x5565('0x54')](_0x10bbe7[_0x5565('0x3e')]);_0x2951b3[_0x5565('0x48')]=_[_0x5565('0x40')](_0x2951b3['model'],_0x2951b3[_0x5565('0x3e')]);_0x31c263['attributes']=_[_0x5565('0x40')](_0x2951b3['model'],qs[_0x5565('0x41')](_0x10bbe7[_0x5565('0x3e')][_0x5565('0x41')]));_0x31c263[_0x5565('0x3f')]=_0x31c263[_0x5565('0x3f')][_0x5565('0x42')]?_0x31c263[_0x5565('0x3f')]:_0x2951b3[_0x5565('0x3d')];_0x31c263[_0x5565('0x45')]=qs[_0x5565('0x46')](_0x10bbe7[_0x5565('0x3e')][_0x5565('0x46')]);_0x31c263[_0x5565('0x47')]=qs[_0x5565('0x48')](_['pick'](_0x10bbe7[_0x5565('0x3e')],_0x2951b3[_0x5565('0x48')]));if(_0x10bbe7['query'][_0x5565('0x4a')]){_0x31c263[_0x5565('0x47')]=_[_0x5565('0x4b')](_0x31c263[_0x5565('0x47')],{'$or':_[_0x5565('0x4c')](_0x31c263['attributes'],function(_0x1b85c0){var _0x24555c={};_0x24555c[_0x1b85c0]={'$like':'%'+_0x10bbe7[_0x5565('0x3e')][_0x5565('0x4a')]+'%'};return _0x24555c;})});}_0x31c263=_['merge']({},_0x31c263,_0x10bbe7[_0x5565('0x56')]);return _0x2582a4[_0x5565('0xa6')](_0x31c263);}})[_0x5565('0x33')](function(_0x585fe6){if(_0x585fe6){_0x20267e=_0x585fe6[_0x5565('0x42')];if(!_0x10bbe7[_0x5565('0x3e')]['hasOwnProperty'](_0x5565('0x44'))){_0x31c263[_0x5565('0x2e')]=qs[_0x5565('0x2e')](_0x10bbe7[_0x5565('0x3e')]['limit']);_0x31c263[_0x5565('0x2d')]=qs[_0x5565('0x2d')](_0x10bbe7[_0x5565('0x3e')]['offset']);}return _0x2582a4[_0x5565('0xa6')](_0x31c263);}})['then'](function(_0x45b0ad){if(_0x45b0ad){return _0x45b0ad?{'count':_0x20267e,'rows':_0x45b0ad}:null;}})[_0x5565('0x33')](respondWithResult(_0x3222ba,null))[_0x5565('0x28')](handleError(_0x3222ba,null));};exports[_0x5565('0xa7')]=function(_0x4e2ce6,_0x34fbe1,_0x10f11b){var _0x5edf78={'raw':![],'where':{}};var _0xfa6cfe={};var _0x9b62b7={'count':0x0,'rows':[]};return db[_0x5565('0x3a')]['findOne']({'where':{'id':_0x4e2ce6[_0x5565('0x52')]['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x34fbe1,null))['then'](function(_0x226f77){if(_0x226f77){_0xfa6cfe[_0x5565('0x3d')]=_[_0x5565('0x54')](db[_0x5565('0x88')][_0x5565('0x3b')]);_0xfa6cfe[_0x5565('0x3e')]=_[_0x5565('0x54')](_0x4e2ce6[_0x5565('0x3e')]);_0xfa6cfe['filters']=_[_0x5565('0x40')](_0xfa6cfe['model'],_0xfa6cfe[_0x5565('0x3e')]);_0x5edf78['attributes']=_[_0x5565('0x40')](_0xfa6cfe[_0x5565('0x3d')],qs[_0x5565('0x41')](_0x4e2ce6['query']['fields']));_0x5edf78['attributes']=_0x5edf78[_0x5565('0x3f')][_0x5565('0x42')]?_0x5edf78[_0x5565('0x3f')]:_0xfa6cfe[_0x5565('0x3d')];if(!_0x4e2ce6['query'][_0x5565('0x43')]('nolimit')){_0x5edf78[_0x5565('0x2e')]=qs[_0x5565('0x2e')](_0x4e2ce6['query'][_0x5565('0x2e')]);_0x5edf78[_0x5565('0x2d')]=qs[_0x5565('0x2d')](_0x4e2ce6[_0x5565('0x3e')][_0x5565('0x2d')]);}_0x5edf78[_0x5565('0x45')]=qs[_0x5565('0x46')](_0x4e2ce6[_0x5565('0x3e')][_0x5565('0x46')]);_0x5edf78[_0x5565('0x47')]=qs[_0x5565('0x48')](_[_0x5565('0x49')](_0x4e2ce6['query'],_0xfa6cfe['filters']));_0x5edf78[_0x5565('0x47')][_0x5565('0x61')]=_0x226f77['id'];if(_0x4e2ce6[_0x5565('0x3e')][_0x5565('0x4a')]){_0x5edf78[_0x5565('0x47')]=_['merge'](_0x5edf78[_0x5565('0x47')],{'$or':_[_0x5565('0x4c')](_0x5edf78['attributes'],function(_0x22d66d){var _0x2ec545={};_0x2ec545[_0x22d66d]={'$like':'%'+_0x4e2ce6[_0x5565('0x3e')][_0x5565('0x4a')]+'%'};return _0x2ec545;})});}_0x5edf78=_[_0x5565('0x4b')]({},_0x5edf78,_0x4e2ce6[_0x5565('0x56')]);return db[_0x5565('0x88')][_0x5565('0x2f')]({'where':_0x5edf78['where']})[_0x5565('0x33')](function(_0x239636){_0x9b62b7[_0x5565('0x2f')]=_0x239636;if(_0x4e2ce6[_0x5565('0x3e')][_0x5565('0x55')]){_0x5edf78[_0x5565('0x4e')]=[{'model':db[_0x5565('0x6d')],'as':_0x5565('0xa8'),'required':![]},{'model':db[_0x5565('0x96')],'as':_0x5565('0xa9'),'attributes':['name',_0x5565('0xaa'),_0x5565('0xab')],'required':![]},{'model':db[_0x5565('0xac')],'as':_0x5565('0xad'),'attributes':['id',_0x5565('0x38'),'color'],'where':_0x4e2ce6['query']['tag']?{'id':_0x4e2ce6['query']['tag']}:undefined,'required':_0x4e2ce6[_0x5565('0x3e')][_0x5565('0xae')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x5edf78);})['then'](function(_0x592daf){_0x9b62b7[_0x5565('0x50')]=_0x592daf;return _0x9b62b7;});}})[_0x5565('0x33')](respondWithFilteredResult(_0x34fbe1,_0x5edf78))[_0x5565('0x28')](handleError(_0x34fbe1,null));};exports[_0x5565('0xaf')]=function(_0x27a086,_0x1c42d4,_0x56a0eb){return db['OpenchannelAccount']['find']({'where':{'id':_0x27a086['params']['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x1c42d4,null))[_0x5565('0x33')](function(_0x50945a){if(_0x50945a){return _0x50945a[_0x5565('0xaf')](_0x27a086[_0x5565('0x59')][_0x5565('0x6a')],_['omit'](_0x27a086[_0x5565('0x59')],[_0x5565('0x6a'),'id'])||{})['spread'](function(_0x257fd7){for(var _0x3b04be=0x0;_0x3b04be<_0x27a086[_0x5565('0x59')][_0x5565('0x6a')]['length'];_0x3b04be+=0x1){socket['emit'](_0x5565('0xb0'),{'UserId':Number(_0x27a086[_0x5565('0x59')][_0x5565('0x6a')][_0x3b04be]),'OpenchannelAccountId':Number(_0x27a086[_0x5565('0x52')]['id'])});}return _0x257fd7;});}})[_0x5565('0x33')](respondWithResult(_0x1c42d4,null))[_0x5565('0x28')](handleError(_0x1c42d4,null));};exports[_0x5565('0xb1')]=function(_0x2c6529,_0xe0095f,_0xfcfde){return db[_0x5565('0x3a')][_0x5565('0x57')]({'where':{'id':_0x2c6529[_0x5565('0x52')]['id']}})['then'](handleEntityNotFound(_0xe0095f,null))[_0x5565('0x33')](function(_0x4da8ad){if(_0x4da8ad){return _0x4da8ad[_0x5565('0xb1')](_0x2c6529[_0x5565('0x3e')][_0x5565('0x6a')])[_0x5565('0x33')](function(){if(_[_0x5565('0xb2')](_0x2c6529['query'][_0x5565('0x6a')])){for(var _0x15bb35=0x0;_0x15bb35<_0x2c6529[_0x5565('0x3e')]['ids'][_0x5565('0x42')];_0x15bb35+=0x1){socket[_0x5565('0xb3')](_0x5565('0xb4'),{'UserId':Number(_0x2c6529[_0x5565('0x3e')][_0x5565('0x6a')][_0x15bb35]),'OpenchannelAccountId':Number(_0x2c6529[_0x5565('0x52')]['id'])});}}else{socket[_0x5565('0xb3')](_0x5565('0xb4'),{'UserId':Number(_0x2c6529[_0x5565('0x3e')][_0x5565('0x6a')]),'OpenchannelAccountId':Number(_0x2c6529[_0x5565('0x52')]['id'])});}});}})[_0x5565('0x33')](respondWithStatusCode(_0xe0095f,null))[_0x5565('0x28')](handleError(_0xe0095f,null));};exports['getAgents']=function(_0x328e41,_0x16c47b,_0x47090b){var _0x13cb64={};var _0x4de23f={};var _0x17033b;var _0x489394;return db[_0x5565('0x3a')][_0x5565('0x64')]({'where':{'id':_0x328e41[_0x5565('0x52')]['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x16c47b,null))[_0x5565('0x33')](function(_0x55fb6e){if(_0x55fb6e){_0x17033b=_0x55fb6e;_0x4de23f[_0x5565('0x3d')]=_[_0x5565('0x54')](db[_0x5565('0x96')][_0x5565('0x3b')]);_0x4de23f[_0x5565('0x3e')]=_[_0x5565('0x54')](_0x328e41[_0x5565('0x3e')]);_0x4de23f[_0x5565('0x48')]=_['intersection'](_0x4de23f['model'],_0x4de23f[_0x5565('0x3e')]);_0x13cb64[_0x5565('0x3f')]=_[_0x5565('0x40')](_0x4de23f[_0x5565('0x3d')],qs[_0x5565('0x41')](_0x328e41[_0x5565('0x3e')][_0x5565('0x41')]));_0x13cb64['attributes']=_0x13cb64['attributes']['length']?_0x13cb64[_0x5565('0x3f')]:_0x4de23f[_0x5565('0x3d')];_0x13cb64[_0x5565('0x45')]=qs[_0x5565('0x46')](_0x328e41['query']['sort']);_0x13cb64[_0x5565('0x47')]=qs[_0x5565('0x48')](_[_0x5565('0x49')](_0x328e41[_0x5565('0x3e')],_0x4de23f['filters']));if(_0x328e41[_0x5565('0x3e')]['filter']){_0x13cb64[_0x5565('0x47')]=_[_0x5565('0x4b')](_0x13cb64[_0x5565('0x47')],{'$or':_[_0x5565('0x4c')](_0x13cb64[_0x5565('0x3f')],function(_0x31c0c3){var _0xeacf41={};_0xeacf41[_0x31c0c3]={'$like':'%'+_0x328e41[_0x5565('0x3e')][_0x5565('0x4a')]+'%'};return _0xeacf41;})});}_0x13cb64=_[_0x5565('0x4b')]({},_0x13cb64,_0x328e41[_0x5565('0x56')]);return _0x17033b[_0x5565('0xb5')](_0x13cb64);}})[_0x5565('0x33')](function(_0x3e461e){if(_0x3e461e){_0x489394=_0x3e461e['length'];if(!_0x328e41[_0x5565('0x3e')]['hasOwnProperty'](_0x5565('0x44'))){_0x13cb64[_0x5565('0x2e')]=qs[_0x5565('0x2e')](_0x328e41[_0x5565('0x3e')]['limit']);_0x13cb64[_0x5565('0x2d')]=qs['offset'](_0x328e41[_0x5565('0x3e')][_0x5565('0x2d')]);}return _0x17033b[_0x5565('0xb5')](_0x13cb64);}})[_0x5565('0x33')](function(_0x1fa153){if(_0x1fa153){return _0x1fa153?{'count':_0x489394,'rows':_0x1fa153}:null;}})[_0x5565('0x33')](respondWithResult(_0x16c47b,null))[_0x5565('0x28')](handleError(_0x16c47b,null));};exports[_0x5565('0xb6')]=function(_0x424aa0,_0x56dff7,_0xc84327){var _0x319b97,_0x232b7a,_0x42ba6b;if(_[_0x5565('0x75')](_0x424aa0[_0x5565('0x59')][_0x5565('0x59')])||_0x424aa0['body'][_0x5565('0x59')]===''){throw new db[(_0x5565('0x6e'))][(_0x5565('0x6f'))](_0x5565('0x78'));}if(_['isNil'](_0x424aa0[_0x5565('0x59')]['to'])){}_0x319b97=_0x424aa0['body']['to'];return db[_0x5565('0x3a')][_0x5565('0x64')]({'where':{'id':_0x424aa0['params']['id']}})[_0x5565('0x33')](handleEntityNotFound(_0x56dff7,null))[_0x5565('0x33')](function(_0x2017c9){if(_0x2017c9){return db['OpenchannelAccount'][_0x5565('0x57')]({'where':{'id':_0x2017c9['id']},'include':[{'model':db[_0x5565('0x7a')],'as':_0x5565('0x7b'),'include':[{'model':db[_0x5565('0x6d')],'as':_0x5565('0x83'),'where':{[_0x2017c9[_0x5565('0x79')]]:_0x319b97},'limit':0x1,'order':[[_0x5565('0x73'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x56dff7,null))['then'](function(_0x1d157a){if(_0x1d157a&&_0x1d157a[_0x5565('0x7b')]){_0x232b7a=_0x1d157a[_0x5565('0x35')]({'plain':!![]});if(_0x232b7a[_0x5565('0x7b')]&&_0x232b7a['List'][_0x5565('0x83')][_0x5565('0x42')]){return _0x232b7a['List'][_0x5565('0x83')][0x0];}return db[_0x5565('0x6d')][_0x5565('0x58')](_[_0x5565('0x18')](_0x424aa0['body'],{'firstName':_0x319b97,[_0x1d157a[_0x5565('0x79')]]:_0x319b97,'phone':_0x319b97,'ListId':_0x232b7a[_0x5565('0x84')]}));}})[_0x5565('0x33')](handleEntityNotFound(_0x56dff7,null))['then'](function(_0x5e2568){if(_0x5e2568){_0x42ba6b=_0x5e2568;return db[_0x5565('0x88')][_0x5565('0x57')]({'where':{'ContactId':_0x42ba6b['id'],'closed':![],'OpenchannelAccountId':_0x232b7a['id']}})['then'](function(_0x4e3ddc){if(_0x4e3ddc){return[_0x4e3ddc,![]];}return db['OpenchannelInteraction'][_0x5565('0x58')]({'UserId':_0x424aa0[_0x5565('0x5a')]['id'],'ContactId':_0x42ba6b['id'],'OpenchannelAccountId':_0x232b7a['id'],'lastMsgDirection':'out','firstMsgDirection':_0x5565('0xb7'),'Messages':[_[_0x5565('0x4b')](_0x424aa0[_0x5565('0x59')],{'read':![],'body':_0x424aa0['body'][_0x5565('0x59')],'OpenchannelAccountId':_0x232b7a['id'],'UserId':_0x424aa0[_0x5565('0x5a')]['id'],'ContactId':_0x42ba6b['id']})]},{'include':[{'model':db[_0x5565('0x93')],'as':'Messages'}]})[_0x5565('0x33')](function(_0x150453){return[_0x150453,!![]];});});}})[_0x5565('0x8a')](function(_0x360c9f,_0x4d67d8){if(_0x4d67d8){return _0x360c9f;}return db[_0x5565('0x93')][_0x5565('0x58')](_['merge'](_0x424aa0[_0x5565('0x59')],{'read':![],'body':_0x424aa0[_0x5565('0x59')][_0x5565('0x59')],'OpenchannelAccountId':_0x232b7a['id'],'OpenchannelInteractionId':_0x360c9f['id'],'UserId':_0x424aa0[_0x5565('0x5a')]['id'],'ContactId':_0x42ba6b['id']}))[_0x5565('0x33')](function(_0x239069){_0x360c9f[_0x5565('0xb8')][_0x5565('0xb9')]=[];_0x360c9f[_0x5565('0xb8')][_0x5565('0xb9')][_0x5565('0x90')](_0x239069[_0x5565('0xb8')]);return _0x360c9f;});});}})[_0x5565('0x33')](respondWithResult(_0x56dff7,null))[_0x5565('0x28')](handleError(_0x56dff7,null));}; \ No newline at end of file +var _0x4d07=['Owner','internal','Tag','Tags','color','tag','addAgents','ids','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','zip-dir','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','undefined','limit','offset','set','apply','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','model','keys','filters','attributes','intersection','fields','length','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelAccount','count','includeAll','include','findAll','rows','show','params','find','create','body','user','get','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','order','removeDispositions','addAnswer','CannedAnswer','nolimit','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','send','json','getApplications','getInteractions'];(function(_0x4ff701,_0x115108){var _0x4dbe21=function(_0xce90ed){while(--_0xce90ed){_0x4ff701['push'](_0x4ff701['shift']());}};_0x4dbe21(++_0x115108);}(_0x4d07,0x18e));var _0x74d0=function(_0x390db1,_0x325439){_0x390db1=_0x390db1-0x0;var _0x40ae66=_0x4d07[_0x390db1];return _0x40ae66;};'use strict';var emlformat=require(_0x74d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x74d0('0x2'));var util=require(_0x74d0('0x3'));var path=require(_0x74d0('0x4'));var sox=require(_0x74d0('0x5'));var csv=require(_0x74d0('0x6'));var ejs=require(_0x74d0('0x7'));var fs=require('fs');var fs_extra=require(_0x74d0('0x8'));var _=require(_0x74d0('0x9'));var squel=require(_0x74d0('0xa'));var crypto=require(_0x74d0('0xb'));var jsforce=require(_0x74d0('0xc'));var deskjs=require(_0x74d0('0xd'));var toCsv=require(_0x74d0('0x6'));var querystring=require('querystring');var Papa=require(_0x74d0('0xe'));var Redis=require(_0x74d0('0xf'));var authService=require(_0x74d0('0x10'));var qs=require(_0x74d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74d0('0x12'));var logger=require(_0x74d0('0x13'))(_0x74d0('0x14'));var utils=require(_0x74d0('0x15'));var config=require(_0x74d0('0x16'));var licenseUtil=require(_0x74d0('0x17'));var db=require('../../mysqldb')['db'];config[_0x74d0('0x18')]=_['defaults'](config[_0x74d0('0x18')],{'host':_0x74d0('0x19'),'port':0x18eb});var socket=require(_0x74d0('0x1a'))(new Redis(config[_0x74d0('0x18')]));require(_0x74d0('0x1b'))[_0x74d0('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x74d0('0x1d')][_0x74d0('0x1e')]({'port':0x232c});var client9002=jayson[_0x74d0('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1601d5,_0x3e3dee,_0x289266,_0x5bcde9){return new BPromise(function(_0x15b452,_0x3644cb){var _0x30f605=_0x5bcde9||client;return _0x30f605[_0x74d0('0x1f')](_0x1601d5,_0x289266)[_0x74d0('0x20')](function(_0x58ba46){logger[_0x74d0('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e3dee,_0x74d0('0x22'));logger[_0x74d0('0x23')](_0x74d0('0x24'),_0x3e3dee,_0x74d0('0x22'),JSON[_0x74d0('0x25')](_0x58ba46));if(_0x58ba46[_0x74d0('0x26')]){if(_0x58ba46[_0x74d0('0x26')][_0x74d0('0x27')]===0x1f4){logger[_0x74d0('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e3dee,_0x58ba46[_0x74d0('0x26')]['message']);return _0x3644cb(_0x58ba46[_0x74d0('0x26')][_0x74d0('0x28')]);}logger[_0x74d0('0x26')](_0x74d0('0x29'),_0x3e3dee,_0x58ba46[_0x74d0('0x26')][_0x74d0('0x28')]);return _0x15b452(_0x58ba46[_0x74d0('0x26')][_0x74d0('0x28')]);}else{logger[_0x74d0('0x21')](_0x74d0('0x29'),_0x3e3dee,_0x74d0('0x22'));_0x15b452(_0x58ba46[_0x74d0('0x2a')][_0x74d0('0x28')]);}})[_0x74d0('0x2b')](function(_0x4ed251){logger[_0x74d0('0x26')](_0x74d0('0x29'),_0x3e3dee,_0x4ed251);_0x3644cb(_0x4ed251);});});}function respondWithStatusCode(_0x2e0379,_0x319156){_0x319156=_0x319156||0xcc;return function(_0x6fbcba){if(_0x6fbcba){return _0x2e0379[_0x74d0('0x2c')](_0x319156);}return _0x2e0379[_0x74d0('0x2d')](_0x319156)[_0x74d0('0x2e')]();};}function respondWithResult(_0x34df7a,_0x5a3406){_0x5a3406=_0x5a3406||0xc8;return function(_0x48c495){if(_0x48c495){return _0x34df7a[_0x74d0('0x2d')](_0x5a3406)['json'](_0x48c495);}};}function respondWithFilteredResult(_0x18b4fd,_0x261fc6){return function(_0x2d9880){if(_0x2d9880){var _0x4c18d9=typeof _0x261fc6['offset']===_0x74d0('0x2f')&&typeof _0x261fc6[_0x74d0('0x30')]===_0x74d0('0x2f');var _0x5eda40=_0x2d9880['count'];var _0x9c0ee4=_0x4c18d9?0x0:_0x261fc6[_0x74d0('0x31')];var _0x38c7f0=_0x4c18d9?_0x2d9880['count']:_0x261fc6[_0x74d0('0x31')]+_0x261fc6[_0x74d0('0x30')];var _0x39b0dd;if(_0x38c7f0>=_0x5eda40){_0x38c7f0=_0x5eda40;_0x39b0dd=0xc8;}else{_0x39b0dd=0xce;}_0x18b4fd[_0x74d0('0x2d')](_0x39b0dd);return _0x18b4fd[_0x74d0('0x32')]('Content-Range',_0x9c0ee4+'-'+_0x38c7f0+'/'+_0x5eda40)['json'](_0x2d9880);}return null;};}function patchUpdates(_0x1bb302){return function(_0x2081da){try{jsonpatch[_0x74d0('0x33')](_0x2081da,_0x1bb302,!![]);}catch(_0x1beeb1){return BPromise['reject'](_0x1beeb1);}return _0x2081da[_0x74d0('0x34')]();};}function saveUpdates(_0x4864fe,_0x1959d8){return function(_0x31f662){if(_0x31f662){return _0x31f662[_0x74d0('0x35')](_0x4864fe)[_0x74d0('0x20')](function(_0x1ecea5){return _0x1ecea5;});}return null;};}function removeEntity(_0x38e706,_0x1cec93){return function(_0x18df4b){if(_0x18df4b){return _0x18df4b[_0x74d0('0x36')]()[_0x74d0('0x20')](function(){var _0xd4fe77=_0x18df4b['get']({'plain':!![]});var _0x29ac7a=_0x74d0('0x37');return db[_0x74d0('0x38')][_0x74d0('0x36')]({'where':{'type':_0x29ac7a,'resourceId':_0xd4fe77['id']}})[_0x74d0('0x20')](function(){return _0x18df4b;});})[_0x74d0('0x20')](function(){_0x38e706[_0x74d0('0x2d')](0xcc)[_0x74d0('0x2e')]();});}};}function handleEntityNotFound(_0x1c33b2,_0x1c6472){return function(_0x528d0d){if(!_0x528d0d){_0x1c33b2[_0x74d0('0x2c')](0x194);}return _0x528d0d;};}function handleError(_0xede124,_0x25f288){_0x25f288=_0x25f288||0x1f4;return function(_0x4a95a4){logger['error'](_0x4a95a4[_0x74d0('0x39')]);if(_0x4a95a4[_0x74d0('0x3a')]){delete _0x4a95a4['name'];}_0xede124[_0x74d0('0x2d')](_0x25f288)['send'](_0x4a95a4);};}exports[_0x74d0('0x3b')]=function(_0x30f3fb,_0x43c894){var _0x250cf4={'include':[{'model':db[_0x74d0('0x3c')],'as':_0x74d0('0x3d')}]},_0x123356={},_0xb04936={'count':0x0,'rows':[]};var _0x2dae77=_[_0x74d0('0x3e')](db['OpenchannelAccount'][_0x74d0('0x3f')],function(_0x1484b4){return{'name':_0x1484b4['fieldName'],'type':_0x1484b4['type']['key']};});_0x123356[_0x74d0('0x40')]=_['map'](_0x2dae77,_0x74d0('0x3a'));_0x123356['query']=_[_0x74d0('0x41')](_0x30f3fb['query']);_0x123356[_0x74d0('0x42')]=_['intersection'](_0x123356[_0x74d0('0x40')],_0x123356['query']);_0x250cf4[_0x74d0('0x43')]=_[_0x74d0('0x44')](_0x123356[_0x74d0('0x40')],qs[_0x74d0('0x45')](_0x30f3fb['query']['fields']));_0x250cf4[_0x74d0('0x43')]=_0x250cf4['attributes'][_0x74d0('0x46')]?_0x250cf4[_0x74d0('0x43')]:_0x123356[_0x74d0('0x40')];if(!_0x30f3fb[_0x74d0('0x47')][_0x74d0('0x48')]('nolimit')){_0x250cf4[_0x74d0('0x30')]=qs[_0x74d0('0x30')](_0x30f3fb['query'][_0x74d0('0x30')]);_0x250cf4[_0x74d0('0x31')]=qs[_0x74d0('0x31')](_0x30f3fb[_0x74d0('0x47')][_0x74d0('0x31')]);}_0x250cf4['order']=qs['sort'](_0x30f3fb['query'][_0x74d0('0x49')]);_0x250cf4[_0x74d0('0x4a')]=qs[_0x74d0('0x42')](_[_0x74d0('0x4b')](_0x30f3fb['query'],_0x123356['filters']),_0x2dae77);if(_0x30f3fb[_0x74d0('0x47')][_0x74d0('0x4c')]){_0x250cf4[_0x74d0('0x4a')]=_[_0x74d0('0x4d')](_0x250cf4[_0x74d0('0x4a')],{'$or':_[_0x74d0('0x3e')](_0x2dae77,function(_0x34db54){if(_0x34db54['type']!==_0x74d0('0x4e')){var _0x54a297={};_0x54a297[_0x34db54['name']]={'$like':'%'+_0x30f3fb[_0x74d0('0x47')]['filter']+'%'};return _0x54a297;}})});}_0x250cf4=_[_0x74d0('0x4d')]({},_0x250cf4,_0x30f3fb[_0x74d0('0x4f')]);var _0x3a9cfb={'where':_0x250cf4[_0x74d0('0x4a')]};return db[_0x74d0('0x50')]['count'](_0x3a9cfb)['then'](function(_0x4b7036){_0xb04936[_0x74d0('0x51')]=_0x4b7036;if(_0x30f3fb[_0x74d0('0x47')][_0x74d0('0x52')]){_0x250cf4[_0x74d0('0x53')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x74d0('0x54')](_0x250cf4);})[_0x74d0('0x20')](function(_0x1bf9cd){_0xb04936[_0x74d0('0x55')]=_0x1bf9cd;return _0xb04936;})[_0x74d0('0x20')](respondWithFilteredResult(_0x43c894,_0x250cf4))['catch'](handleError(_0x43c894,null));};exports[_0x74d0('0x56')]=function(_0x406a47,_0x52c5a9){var _0x3e34e6={'raw':![],'where':{'id':_0x406a47[_0x74d0('0x57')]['id']},'include':[{'model':db[_0x74d0('0x3c')],'as':_0x74d0('0x3d')}]},_0x436fdc={};_0x436fdc['model']=_[_0x74d0('0x41')](db[_0x74d0('0x50')][_0x74d0('0x3f')]);_0x436fdc[_0x74d0('0x47')]=_[_0x74d0('0x41')](_0x406a47[_0x74d0('0x47')]);_0x436fdc[_0x74d0('0x42')]=_[_0x74d0('0x44')](_0x436fdc['model'],_0x436fdc[_0x74d0('0x47')]);_0x3e34e6[_0x74d0('0x43')]=_['intersection'](_0x436fdc['model'],qs['fields'](_0x406a47['query'][_0x74d0('0x45')]));_0x3e34e6[_0x74d0('0x43')]=_0x3e34e6[_0x74d0('0x43')][_0x74d0('0x46')]?_0x3e34e6[_0x74d0('0x43')]:_0x436fdc[_0x74d0('0x40')];if(_0x406a47[_0x74d0('0x47')]['includeAll']){_0x3e34e6[_0x74d0('0x53')]=[{'all':!![]}];}_0x3e34e6=_['merge']({},_0x3e34e6,_0x406a47[_0x74d0('0x4f')]);return db['OpenchannelAccount'][_0x74d0('0x58')](_0x3e34e6)[_0x74d0('0x20')](handleEntityNotFound(_0x52c5a9,null))[_0x74d0('0x20')](respondWithResult(_0x52c5a9,null))[_0x74d0('0x2b')](handleError(_0x52c5a9,null));};exports[_0x74d0('0x59')]=function(_0x4147d9,_0x9b1176){return db[_0x74d0('0x50')][_0x74d0('0x59')](_0x4147d9[_0x74d0('0x5a')],{})[_0x74d0('0x20')](function(_0x196c27){var _0x206eba=_0x4147d9[_0x74d0('0x5b')][_0x74d0('0x5c')]({'plain':!![]});if(!_0x206eba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x206eba[_0x74d0('0x5d')]===_0x74d0('0x5b')){var _0x29091d=_0x196c27[_0x74d0('0x5c')]({'plain':!![]});var _0xaaabdd=_0x74d0('0x37');return db['UserProfileSection'][_0x74d0('0x58')]({'where':{'name':_0xaaabdd,'userProfileId':_0x206eba['userProfileId']},'raw':!![]})['then'](function(_0x547fff){if(_0x547fff&&_0x547fff['autoAssociation']===0x0){return db['UserProfileResource'][_0x74d0('0x59')]({'name':_0x29091d[_0x74d0('0x3a')],'resourceId':_0x29091d['id'],'type':_0x547fff['name'],'sectionId':_0x547fff['id']},{})[_0x74d0('0x20')](function(){return _0x196c27;});}else{return _0x196c27;}})[_0x74d0('0x2b')](function(_0x434dae){logger['error'](_0x74d0('0x5e'),_0x434dae);throw _0x434dae;});}return _0x196c27;})['then'](respondWithResult(_0x9b1176,0xc9))[_0x74d0('0x2b')](handleError(_0x9b1176,null));};exports[_0x74d0('0x35')]=function(_0xa5acbd,_0x599017){if(_0xa5acbd['body']['id']){delete _0xa5acbd['body']['id'];}return db['OpenchannelAccount'][_0x74d0('0x58')]({'where':{'id':_0xa5acbd[_0x74d0('0x57')]['id']},'include':[{'model':db[_0x74d0('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x74d0('0x20')](handleEntityNotFound(_0x599017,null))[_0x74d0('0x20')](saveUpdates(_0xa5acbd[_0x74d0('0x5a')],null))[_0x74d0('0x20')](respondWithResult(_0x599017,null))[_0x74d0('0x2b')](handleError(_0x599017,null));};exports[_0x74d0('0x36')]=function(_0x435e3f,_0x56e14d){return db[_0x74d0('0x50')][_0x74d0('0x58')]({'where':{'id':_0x435e3f[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x56e14d,null))[_0x74d0('0x20')](removeEntity(_0x56e14d,null))[_0x74d0('0x2b')](handleError(_0x56e14d,null));};exports['describe']=function(_0x3f43ce,_0x1b2181){return db[_0x74d0('0x50')][_0x74d0('0x5f')]()['then'](respondWithResult(_0x1b2181,null))[_0x74d0('0x2b')](handleError(_0x1b2181,null));};exports[_0x74d0('0x60')]=function(_0x56033a,_0x5dec3f,_0x365115){if(_0x56033a['body']['id']){delete _0x56033a[_0x74d0('0x5a')]['id'];}return db['OpenchannelAccount'][_0x74d0('0x58')]({'where':{'id':_0x56033a[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x5dec3f,null))['then'](function(_0x1ae6cf){if(_0x1ae6cf){_0x56033a[_0x74d0('0x5a')][_0x74d0('0x61')]=_0x1ae6cf['id'];return db['Disposition'][_0x74d0('0x59')](_0x56033a['body']);}})['then'](respondWithResult(_0x5dec3f,null))['catch'](handleError(_0x5dec3f,null));};exports[_0x74d0('0x62')]=function(_0x1fbaf2,_0x162254,_0x1ef775){var _0x2b4226={'raw':![],'where':{}};var _0x2fadf0={};var _0x2d556c={'count':0x0,'rows':[]};return db[_0x74d0('0x50')][_0x74d0('0x63')]({'where':{'id':_0x1fbaf2[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x162254,null))['then'](function(_0xc15742){if(_0xc15742){_0x2fadf0['model']=_[_0x74d0('0x41')](db[_0x74d0('0x64')][_0x74d0('0x3f')]);_0x2fadf0['query']=_['keys'](_0x1fbaf2[_0x74d0('0x47')]);_0x2fadf0['filters']=_[_0x74d0('0x44')](_0x2fadf0[_0x74d0('0x40')],_0x2fadf0[_0x74d0('0x47')]);_0x2b4226[_0x74d0('0x43')]=_[_0x74d0('0x44')](_0x2fadf0[_0x74d0('0x40')],qs['fields'](_0x1fbaf2[_0x74d0('0x47')]['fields']));_0x2b4226[_0x74d0('0x43')]=_0x2b4226[_0x74d0('0x43')][_0x74d0('0x46')]?_0x2b4226[_0x74d0('0x43')]:_0x2fadf0['model'];if(!_0x1fbaf2[_0x74d0('0x47')]['hasOwnProperty']('nolimit')){_0x2b4226[_0x74d0('0x30')]=qs['limit'](_0x1fbaf2[_0x74d0('0x47')][_0x74d0('0x30')]);_0x2b4226[_0x74d0('0x31')]=qs['offset'](_0x1fbaf2['query'][_0x74d0('0x31')]);}_0x2b4226[_0x74d0('0x65')]=qs[_0x74d0('0x49')](_0x1fbaf2[_0x74d0('0x47')][_0x74d0('0x49')]);_0x2b4226['where']=qs['filters'](_[_0x74d0('0x4b')](_0x1fbaf2[_0x74d0('0x47')],_0x2fadf0['filters']));_0x2b4226[_0x74d0('0x4a')][_0x74d0('0x61')]=_0xc15742['id'];if(_0x1fbaf2['query'][_0x74d0('0x4c')]){_0x2b4226[_0x74d0('0x4a')]=_['merge'](_0x2b4226[_0x74d0('0x4a')],{'$or':_[_0x74d0('0x3e')](_0x2b4226[_0x74d0('0x43')],function(_0x14ad53){var _0x547d02={};_0x547d02[_0x14ad53]={'$like':'%'+_0x1fbaf2[_0x74d0('0x47')][_0x74d0('0x4c')]+'%'};return _0x547d02;})});}_0x2b4226=_[_0x74d0('0x4d')]({},_0x2b4226,_0x1fbaf2[_0x74d0('0x4f')]);return db[_0x74d0('0x64')]['count']({'where':_0x2b4226[_0x74d0('0x4a')]})['then'](function(_0x23491d){_0x2d556c[_0x74d0('0x51')]=_0x23491d;if(_0x1fbaf2[_0x74d0('0x47')][_0x74d0('0x52')]){_0x2b4226[_0x74d0('0x53')]=[{'all':!![]}];}return db[_0x74d0('0x64')][_0x74d0('0x54')](_0x2b4226);})[_0x74d0('0x20')](function(_0x26f41d){_0x2d556c[_0x74d0('0x55')]=_0x26f41d;return _0x2d556c;});}})[_0x74d0('0x20')](respondWithFilteredResult(_0x162254,_0x2b4226))['catch'](handleError(_0x162254,null));};exports[_0x74d0('0x66')]=function(_0x125fa2,_0x4202c9,_0x1ceda2){return db[_0x74d0('0x50')]['find']({'where':{'id':_0x125fa2['params']['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x4202c9,null))[_0x74d0('0x20')](function(_0x4167fc){if(_0x4167fc){return _0x4167fc[_0x74d0('0x66')](_0x125fa2[_0x74d0('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x4202c9,null))[_0x74d0('0x2b')](handleError(_0x4202c9,null));};exports[_0x74d0('0x67')]=function(_0x2ba69e,_0x52aeca,_0x5e970d){if(_0x2ba69e[_0x74d0('0x5a')]['id']){delete _0x2ba69e[_0x74d0('0x5a')]['id'];}return db[_0x74d0('0x50')]['find']({'where':{'id':_0x2ba69e[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x52aeca,null))['then'](function(_0x27c944){if(_0x27c944){_0x2ba69e[_0x74d0('0x5a')][_0x74d0('0x61')]=_0x27c944['id'];return db[_0x74d0('0x68')]['create'](_0x2ba69e['body']);}})[_0x74d0('0x20')](respondWithResult(_0x52aeca,null))[_0x74d0('0x2b')](handleError(_0x52aeca,null));};exports['getAnswers']=function(_0x577007,_0x354c8d,_0x35469a){var _0xe241ff={'raw':![],'where':{}};var _0x16c553={};var _0x24f9a4={'count':0x0,'rows':[]};return db[_0x74d0('0x50')][_0x74d0('0x63')]({'where':{'id':_0x577007[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x354c8d,null))[_0x74d0('0x20')](function(_0x5754d7){if(_0x5754d7){_0x16c553[_0x74d0('0x40')]=_[_0x74d0('0x41')](db[_0x74d0('0x68')][_0x74d0('0x3f')]);_0x16c553[_0x74d0('0x47')]=_[_0x74d0('0x41')](_0x577007[_0x74d0('0x47')]);_0x16c553[_0x74d0('0x42')]=_[_0x74d0('0x44')](_0x16c553['model'],_0x16c553['query']);_0xe241ff['attributes']=_['intersection'](_0x16c553[_0x74d0('0x40')],qs['fields'](_0x577007['query'][_0x74d0('0x45')]));_0xe241ff['attributes']=_0xe241ff['attributes'][_0x74d0('0x46')]?_0xe241ff[_0x74d0('0x43')]:_0x16c553['model'];if(!_0x577007['query']['hasOwnProperty'](_0x74d0('0x69'))){_0xe241ff[_0x74d0('0x30')]=qs[_0x74d0('0x30')](_0x577007['query'][_0x74d0('0x30')]);_0xe241ff['offset']=qs[_0x74d0('0x31')](_0x577007[_0x74d0('0x47')][_0x74d0('0x31')]);}_0xe241ff['order']=qs[_0x74d0('0x49')](_0x577007[_0x74d0('0x47')][_0x74d0('0x49')]);_0xe241ff[_0x74d0('0x4a')]=qs['filters'](_['pick'](_0x577007[_0x74d0('0x47')],_0x16c553[_0x74d0('0x42')]));_0xe241ff[_0x74d0('0x4a')][_0x74d0('0x61')]=_0x5754d7['id'];if(_0x577007[_0x74d0('0x47')]['filter']){_0xe241ff[_0x74d0('0x4a')]=_[_0x74d0('0x4d')](_0xe241ff['where'],{'$or':_[_0x74d0('0x3e')](_0xe241ff[_0x74d0('0x43')],function(_0x54e594){var _0xba20fe={};_0xba20fe[_0x54e594]={'$like':'%'+_0x577007[_0x74d0('0x47')][_0x74d0('0x4c')]+'%'};return _0xba20fe;})});}_0xe241ff=_['merge']({},_0xe241ff,_0x577007[_0x74d0('0x4f')]);return db[_0x74d0('0x68')][_0x74d0('0x51')]({'where':_0xe241ff[_0x74d0('0x4a')]})[_0x74d0('0x20')](function(_0x23c9c8){_0x24f9a4[_0x74d0('0x51')]=_0x23c9c8;if(_0x577007[_0x74d0('0x47')]['includeAll']){_0xe241ff[_0x74d0('0x53')]=[{'all':!![]}];}return db[_0x74d0('0x68')][_0x74d0('0x54')](_0xe241ff);})[_0x74d0('0x20')](function(_0x499b63){_0x24f9a4[_0x74d0('0x55')]=_0x499b63;return _0x24f9a4;});}})[_0x74d0('0x20')](respondWithFilteredResult(_0x354c8d,_0xe241ff))[_0x74d0('0x2b')](handleError(_0x354c8d,null));};exports[_0x74d0('0x6a')]=function(_0x5f2909,_0x44f264,_0x191bc7){return db[_0x74d0('0x50')][_0x74d0('0x58')]({'where':{'id':_0x5f2909[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x44f264,null))[_0x74d0('0x20')](function(_0x3dd1c8){if(_0x3dd1c8){return _0x3dd1c8[_0x74d0('0x6a')](_0x5f2909[_0x74d0('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x44f264,null))['catch'](handleError(_0x44f264,null));};exports[_0x74d0('0x6b')]=function(_0x1e7aec,_0x1af42a,_0x5aaaa8){var _0x13118a={'body':_0x1e7aec[_0x74d0('0x5a')],'channel':_0x74d0('0x6c')};var _0x45d541=[];var _0x4c7127=[];var _0x3e09a8={};var _0x24e0c4=![];return db[_0x74d0('0x6d')][_0x74d0('0x5f')]()[_0x74d0('0x20')](function(_0x5932b3){if(!_0x5932b3){throw new db[(_0x74d0('0x6e'))]['ValidationError'](_0x74d0('0x6f'));}_0x45d541=_['difference'](_[_0x74d0('0x41')](_0x5932b3),[_0x74d0('0x70'),_0x74d0('0x71')]);_0x4c7127=_['difference'](_['keys'](_0x5932b3),['createdAt',_0x74d0('0x71'),_0x74d0('0x72'),'ListId']);if(_0x1e7aec['body']['id']){delete _0x1e7aec['body']['id'];}if(_[_0x74d0('0x73')](_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x74')])){throw new db[(_0x74d0('0x6e'))][(_0x74d0('0x75'))](_0x74d0('0x76'));}if(_[_0x74d0('0x73')](_0x1e7aec['body'][_0x74d0('0x5a')])||_0x1e7aec[_0x74d0('0x5a')]['body']===''){throw new db[(_0x74d0('0x6e'))][(_0x74d0('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x77')])){throw new db[(_0x74d0('0x6e'))]['ValidationError'](_0x74d0('0x78')+_0x4c7127);}if(!_[_0x74d0('0x79')](_0x4c7127,_0x1e7aec[_0x74d0('0x5a')]['mapKey'])){throw new db[(_0x74d0('0x6e'))][(_0x74d0('0x75'))](_0x74d0('0x7a')+_0x4c7127);}_0x3e09a8[_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x77')]]=_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x74')];})['then'](function(){return db[_0x74d0('0x50')]['find']({'where':{'id':_0x1e7aec[_0x74d0('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x74d0('0x7b'),'include':[{'model':db['CmContact'],'as':_0x74d0('0x7c'),'where':_0x3e09a8,'limit':0x1,'order':[[_0x74d0('0x71'),_0x74d0('0x7d')]]}]},{'model':db[_0x74d0('0x7e')],'as':_0x74d0('0x7f')}]});})[_0x74d0('0x20')](handleEntityNotFound(_0x1af42a,null))['then'](function(_0x384d59){if(_0x384d59&&_0x384d59[_0x74d0('0x7b')]){_0x13118a[_0x74d0('0x80')]=_0x384d59;_0x13118a[_0x74d0('0x81')]=_0x384d59[_0x74d0('0x7f')];_0x13118a['list']=_0x384d59[_0x74d0('0x7b')];_0x13118a['applications']=_[_0x74d0('0x82')](_0x13118a[_0x74d0('0x81')],[_0x74d0('0x83')],[_0x74d0('0x84')]);if(_0x13118a[_0x74d0('0x80')]['Applications']){delete _0x13118a[_0x74d0('0x80')][_0x74d0('0x7f')];}if(_0x13118a[_0x74d0('0x80')][_0x74d0('0x7b')]&&_0x13118a[_0x74d0('0x80')][_0x74d0('0x7b')][_0x74d0('0x7c')][_0x74d0('0x46')]){return _0x13118a[_0x74d0('0x80')][_0x74d0('0x7b')][_0x74d0('0x7c')][0x0];}var _0x122c4a=_[_0x74d0('0x85')](_0x1e7aec[_0x74d0('0x5a')],{'firstName':_0x1e7aec['body'][_0x74d0('0x74')],'ListId':_0x384d59['ListId']});_0x122c4a[_0x1e7aec[_0x74d0('0x5a')]['mapKey']]=_0x1e7aec['body'][_0x74d0('0x74')];return db[_0x74d0('0x6d')][_0x74d0('0x59')](_0x122c4a,{'fields':_0x45d541,'raw':!![]});}})[_0x74d0('0x20')](handleEntityNotFound(_0x1af42a,null))['then'](function(_0x3ba383){_0x13118a['contact']=_0x3ba383;if(_0x3ba383){var _0x16455e={'ContactId':_0x3ba383['id'],'OpenchannelAccountId':_0x1e7aec[_0x74d0('0x57')]['id'],'from':(_0x3ba383[_0x74d0('0x86')]||'')+'\x20'+(_0x3ba383[_0x74d0('0x87')]||'')};var _0x33e7b3={'OpenchannelAccountId':_0x1e7aec[_0x74d0('0x57')]['id'],'closed':![]};if(_0x1e7aec['body']['threadId']){_0x33e7b3[_0x74d0('0x88')]=_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x88')];return db[_0x74d0('0x89')]['find']({'where':_0x33e7b3})['then'](function(_0x4401d1){if(_0x4401d1){return[_0x4401d1,![]];}_0x16455e[_0x74d0('0x88')]=_0x1e7aec['body']['threadId'];_0x16455e['externalUrl']=_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x8a')];return db[_0x74d0('0x89')][_0x74d0('0x59')](_0x16455e)[_0x74d0('0x20')](function(_0x5ed856){return[_0x5ed856,!![]];});});}else{_0x33e7b3[_0x74d0('0x88')]=null;}_0x33e7b3[_0x74d0('0x8b')]=_0x3ba383['id'];return db['OpenchannelInteraction'][_0x74d0('0x58')]({'where':_0x33e7b3})[_0x74d0('0x20')](function(_0x3595a4){if(_0x3595a4){return[_0x3595a4,![]];}return db[_0x74d0('0x89')]['create'](_0x16455e)[_0x74d0('0x20')](function(_0x54d25b){return[_0x54d25b,!![]];});});}})[_0x74d0('0x8c')](function(_0x23e9ab,_0x5e027b){if(_0x23e9ab){_0x24e0c4=_0x5e027b;if(!_0x5e027b){var _0x3157e1={'from':(_0x13118a['contact'][_0x74d0('0x86')]||'')+'\x20'+(_0x13118a[_0x74d0('0x8d')][_0x74d0('0x87')]||'')};if(_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x88')]&&_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x8e')]&&_0x1e7aec[_0x74d0('0x5a')]['threadId']!=_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x8e')]){_0x3157e1[_0x74d0('0x88')]=_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x8e')];}return _0x23e9ab[_0x74d0('0x35')](_0x3157e1);}else{return _0x23e9ab;}}})[_0x74d0('0x20')](function(_0x419086){_0x13118a[_0x74d0('0x8f')]=_0x419086[_0x74d0('0x5c')]({'plain':!![]});_0x13118a[_0x74d0('0x8f')]['created']=_0x24e0c4;if(_0x13118a[_0x74d0('0x8f')][_0x74d0('0x90')]){if(_0x13118a[_0x74d0('0x80')][_0x74d0('0x91')]){_0x13118a[_0x74d0('0x81')][_0x74d0('0x92')]({'id':0x0,'priority':_0x13118a[_0x74d0('0x81')][_0x74d0('0x46')]+0x1,'app':_0x74d0('0x93'),'appdata':_0x74d0('0x94'),'interval':_0x74d0('0x95')});}}return db[_0x74d0('0x96')][_0x74d0('0x59')]({'body':_0x1e7aec[_0x74d0('0x5a')]['body'],'OpenchannelAccountId':_0x1e7aec[_0x74d0('0x57')]['id'],'OpenchannelInteractionId':_0x419086['id'],'direction':'in','ContactId':_0x13118a[_0x74d0('0x8d')]['id'],'AttachmentId':_0x1e7aec[_0x74d0('0x5a')][_0x74d0('0x97')]});})[_0x74d0('0x20')](function(_0x206304){_0x13118a[_0x74d0('0x28')]=_0x206304;if(!_0x13118a[_0x74d0('0x8f')][_0x74d0('0x98')])return;return db[_0x74d0('0x99')][_0x74d0('0x58')]({'attributes':['id',_0x74d0('0x3a')],'where':{'id':_0x13118a['interaction'][_0x74d0('0x98')]}});})['then'](function(_0x153344){if(_0x153344){_0x13118a[_0x74d0('0x81')][_0x74d0('0x9a')]({'id':0x0,'priority':0x0,'app':_0x74d0('0x9b'),'appdata':_0x153344[_0x74d0('0x3a')]+','+(_0x13118a[_0x74d0('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0x74d0('0x95')});}if(!_0x13118a[_0x74d0('0x8f')][_0x74d0('0x9c')])return;return db[_0x74d0('0x9d')][_0x74d0('0x58')]({'attributes':['id',_0x74d0('0x3a')],'where':{'id':_0x13118a[_0x74d0('0x8f')][_0x74d0('0x9c')]}});})[_0x74d0('0x20')](function(_0x274e61){if(_0x274e61){_0x13118a[_0x74d0('0x81')][_0x74d0('0x9a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x274e61[_0x74d0('0x3a')]+','+(_0x13118a['account'][_0x74d0('0x9e')]||0x12c),'interval':_0x74d0('0x95')});}return respondWithRpcPromise(_0x74d0('0x9f'),_0x74d0('0xa0'),_0x13118a);})[_0x74d0('0x20')](function(_0xaf6884){respondWithRpcPromise(_0x74d0('0xa1'),_0x74d0('0xa1'),{'event':'notify','message':_0xaf6884},client9002);return _0xaf6884;})['then'](respondWithResult(_0x1af42a,null))[_0x74d0('0x2b')](handleError(_0x1af42a,null));};exports['addApplications']=function(_0x17506f,_0x3a67c2){var _0x3e5fb2=_0x17506f['params']['id'];var _0x242321=_0x17506f[_0x74d0('0x5a')];var _0x5c2560=0xc8;var _0x228337=null;return db[_0x74d0('0xa2')]['transaction']({'isolationLevel':db['sequelize'][_0x74d0('0xa3')][_0x74d0('0xa4')][_0x74d0('0xa5')]},function(_0xc380d){return db[_0x74d0('0x50')]['findOne']({'where':{'id':_0x3e5fb2},'transaction':_0xc380d})[_0x74d0('0x20')](function(_0x56f586){if(_0x56f586){return db[_0x74d0('0x7e')]['destroy']({'where':{'OpenchannelAccountId':_0x3e5fb2},'transaction':_0xc380d})['then'](function(){var _0x274c1f=_[_0x74d0('0x3e')](_0x242321,function(_0x290f){_0x290f[_0x74d0('0x61')]=_0x3e5fb2;return _0x290f;});return db[_0x74d0('0x7e')][_0x74d0('0xa6')](_0x274c1f,{'transaction':_0xc380d});});}else{_0x5c2560=0x194;_0x228337=[];}});})[_0x74d0('0x20')](function(){if(_0x5c2560!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x3e5fb2},'order':_0x74d0('0x83')})[_0x74d0('0x20')](function(_0x4961a7){_0x228337=_0x4961a7;});}})['catch'](function(_0x34ca9c){_0x5c2560=0x1f4;logger[_0x74d0('0x26')](_0x34ca9c[_0x74d0('0x39')]);if(_0x34ca9c[_0x74d0('0x3a')]){delete _0x34ca9c['name'];}_0x228337=_0x34ca9c;})[_0x74d0('0xa7')](function(){if(_0x228337===null){_0x3a67c2[_0x74d0('0x2c')](_0x5c2560);}else{if(_0x5c2560===0x1f4){_0x3a67c2[_0x74d0('0x2d')](_0x5c2560)[_0x74d0('0xa8')](_0x228337);}else{_0x3a67c2['status'](_0x5c2560)[_0x74d0('0xa9')](_0x228337);}}});};exports[_0x74d0('0xaa')]=function(_0x25122e,_0x2f24c6,_0x27ef2c){var _0x41a553={};var _0x16cb46={};var _0x4b9473;var _0x5e4d23;return db[_0x74d0('0x50')]['findOne']({'where':{'id':_0x25122e[_0x74d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x2f24c6,null))[_0x74d0('0x20')](function(_0xacefd7){if(_0xacefd7){_0x4b9473=_0xacefd7;_0x16cb46[_0x74d0('0x40')]=_['keys'](db['OpenchannelApplication'][_0x74d0('0x3f')]);_0x16cb46['query']=_[_0x74d0('0x41')](_0x25122e['query']);_0x16cb46[_0x74d0('0x42')]=_['intersection'](_0x16cb46[_0x74d0('0x40')],_0x16cb46[_0x74d0('0x47')]);_0x41a553[_0x74d0('0x43')]=_['intersection'](_0x16cb46[_0x74d0('0x40')],qs[_0x74d0('0x45')](_0x25122e[_0x74d0('0x47')]['fields']));_0x41a553[_0x74d0('0x43')]=_0x41a553['attributes'][_0x74d0('0x46')]?_0x41a553[_0x74d0('0x43')]:_0x16cb46[_0x74d0('0x40')];_0x41a553[_0x74d0('0x65')]=qs[_0x74d0('0x49')](_0x25122e[_0x74d0('0x47')][_0x74d0('0x49')]);_0x41a553[_0x74d0('0x4a')]=qs['filters'](_[_0x74d0('0x4b')](_0x25122e['query'],_0x16cb46[_0x74d0('0x42')]));if(_0x25122e['query'][_0x74d0('0x4c')]){_0x41a553['where']=_[_0x74d0('0x4d')](_0x41a553[_0x74d0('0x4a')],{'$or':_[_0x74d0('0x3e')](_0x41a553['attributes'],function(_0x34a24c){var _0xce02ca={};_0xce02ca[_0x34a24c]={'$like':'%'+_0x25122e[_0x74d0('0x47')]['filter']+'%'};return _0xce02ca;})});}_0x41a553=_[_0x74d0('0x4d')]({},_0x41a553,_0x25122e['options']);return _0x4b9473['getApplications'](_0x41a553);}})['then'](function(_0x3cf3cd){if(_0x3cf3cd){_0x5e4d23=_0x3cf3cd[_0x74d0('0x46')];if(!_0x25122e[_0x74d0('0x47')][_0x74d0('0x48')]('nolimit')){_0x41a553['limit']=qs[_0x74d0('0x30')](_0x25122e[_0x74d0('0x47')][_0x74d0('0x30')]);_0x41a553['offset']=qs[_0x74d0('0x31')](_0x25122e[_0x74d0('0x47')][_0x74d0('0x31')]);}return _0x4b9473['getApplications'](_0x41a553);}})[_0x74d0('0x20')](function(_0x5a564a){if(_0x5a564a){return _0x5a564a?{'count':_0x5e4d23,'rows':_0x5a564a}:null;}})[_0x74d0('0x20')](respondWithResult(_0x2f24c6,null))[_0x74d0('0x2b')](handleError(_0x2f24c6,null));};exports[_0x74d0('0xab')]=function(_0x5c0f16,_0x36d56e,_0x4df2d3){var _0x5a3817={'raw':![],'where':{}};var _0xbefcb8={};var _0x1fc5e8={'count':0x0,'rows':[]};return db[_0x74d0('0x50')][_0x74d0('0x63')]({'where':{'id':_0x5c0f16[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x36d56e,null))[_0x74d0('0x20')](function(_0x54adea){if(_0x54adea){_0xbefcb8[_0x74d0('0x40')]=_[_0x74d0('0x41')](db[_0x74d0('0x89')]['rawAttributes']);_0xbefcb8['query']=_[_0x74d0('0x41')](_0x5c0f16[_0x74d0('0x47')]);_0xbefcb8[_0x74d0('0x42')]=_['intersection'](_0xbefcb8[_0x74d0('0x40')],_0xbefcb8[_0x74d0('0x47')]);_0x5a3817[_0x74d0('0x43')]=_[_0x74d0('0x44')](_0xbefcb8[_0x74d0('0x40')],qs['fields'](_0x5c0f16[_0x74d0('0x47')][_0x74d0('0x45')]));_0x5a3817[_0x74d0('0x43')]=_0x5a3817[_0x74d0('0x43')][_0x74d0('0x46')]?_0x5a3817[_0x74d0('0x43')]:_0xbefcb8[_0x74d0('0x40')];if(!_0x5c0f16[_0x74d0('0x47')][_0x74d0('0x48')](_0x74d0('0x69'))){_0x5a3817[_0x74d0('0x30')]=qs[_0x74d0('0x30')](_0x5c0f16[_0x74d0('0x47')][_0x74d0('0x30')]);_0x5a3817[_0x74d0('0x31')]=qs[_0x74d0('0x31')](_0x5c0f16[_0x74d0('0x47')][_0x74d0('0x31')]);}_0x5a3817[_0x74d0('0x65')]=qs[_0x74d0('0x49')](_0x5c0f16[_0x74d0('0x47')][_0x74d0('0x49')]);_0x5a3817[_0x74d0('0x4a')]=qs[_0x74d0('0x42')](_[_0x74d0('0x4b')](_0x5c0f16[_0x74d0('0x47')],_0xbefcb8[_0x74d0('0x42')]));_0x5a3817['where'][_0x74d0('0x61')]=_0x54adea['id'];if(_0x5c0f16['query'][_0x74d0('0x4c')]){_0x5a3817[_0x74d0('0x4a')]=_[_0x74d0('0x4d')](_0x5a3817[_0x74d0('0x4a')],{'$or':_[_0x74d0('0x3e')](_0x5a3817['attributes'],function(_0x5aab1d){var _0x2e5575={};_0x2e5575[_0x5aab1d]={'$like':'%'+_0x5c0f16['query'][_0x74d0('0x4c')]+'%'};return _0x2e5575;})});}_0x5a3817=_[_0x74d0('0x4d')]({},_0x5a3817,_0x5c0f16[_0x74d0('0x4f')]);return db[_0x74d0('0x89')]['count']({'where':_0x5a3817[_0x74d0('0x4a')]})[_0x74d0('0x20')](function(_0x567b2a){_0x1fc5e8[_0x74d0('0x51')]=_0x567b2a;if(_0x5c0f16[_0x74d0('0x47')][_0x74d0('0x52')]){_0x5a3817['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x74d0('0xac'),'attributes':[_0x74d0('0x3a'),'fullname',_0x74d0('0xad')],'required':![]},{'model':db[_0x74d0('0xae')],'as':_0x74d0('0xaf'),'attributes':['id',_0x74d0('0x3a'),_0x74d0('0xb0')],'where':_0x5c0f16[_0x74d0('0x47')][_0x74d0('0xb1')]?{'id':_0x5c0f16['query']['tag']}:undefined,'required':_0x5c0f16['query'][_0x74d0('0xb1')]?!![]:![]}];}return db[_0x74d0('0x89')]['findAll'](_0x5a3817);})[_0x74d0('0x20')](function(_0x34cc9c){_0x1fc5e8['rows']=_0x34cc9c;return _0x1fc5e8;});}})['then'](respondWithFilteredResult(_0x36d56e,_0x5a3817))[_0x74d0('0x2b')](handleError(_0x36d56e,null));};exports[_0x74d0('0xb2')]=function(_0x5b157e,_0x58ace9,_0x77b2f4){return db[_0x74d0('0x50')][_0x74d0('0x58')]({'where':{'id':_0x5b157e[_0x74d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x58ace9,null))[_0x74d0('0x20')](function(_0x19f316){if(_0x19f316){return _0x19f316[_0x74d0('0xb2')](_0x5b157e[_0x74d0('0x5a')][_0x74d0('0xb3')],_['omit'](_0x5b157e['body'],[_0x74d0('0xb3'),'id'])||{})[_0x74d0('0x8c')](function(_0x4d09b3){for(var _0x18796d=0x0;_0x18796d<_0x5b157e[_0x74d0('0x5a')][_0x74d0('0xb3')][_0x74d0('0x46')];_0x18796d+=0x1){socket[_0x74d0('0xb4')](_0x74d0('0xb5'),{'UserId':Number(_0x5b157e[_0x74d0('0x5a')][_0x74d0('0xb3')][_0x18796d]),'OpenchannelAccountId':Number(_0x5b157e[_0x74d0('0x57')]['id'])});}return _0x4d09b3;});}})['then'](respondWithResult(_0x58ace9,null))[_0x74d0('0x2b')](handleError(_0x58ace9,null));};exports[_0x74d0('0xb6')]=function(_0x315603,_0x4a2f9f,_0xb89fed){return db[_0x74d0('0x50')][_0x74d0('0x58')]({'where':{'id':_0x315603[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x4a2f9f,null))['then'](function(_0x3009f3){if(_0x3009f3){return _0x3009f3[_0x74d0('0xb6')](_0x315603['query'][_0x74d0('0xb3')])[_0x74d0('0x20')](function(){if(_[_0x74d0('0xb7')](_0x315603[_0x74d0('0x47')][_0x74d0('0xb3')])){for(var _0x42dd99=0x0;_0x42dd99<_0x315603[_0x74d0('0x47')][_0x74d0('0xb3')][_0x74d0('0x46')];_0x42dd99+=0x1){socket[_0x74d0('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x315603[_0x74d0('0x47')][_0x74d0('0xb3')][_0x42dd99]),'OpenchannelAccountId':Number(_0x315603[_0x74d0('0x57')]['id'])});}}else{socket[_0x74d0('0xb4')](_0x74d0('0xb8'),{'UserId':Number(_0x315603[_0x74d0('0x47')][_0x74d0('0xb3')]),'OpenchannelAccountId':Number(_0x315603[_0x74d0('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a2f9f,null))['catch'](handleError(_0x4a2f9f,null));};exports[_0x74d0('0xb9')]=function(_0x4cd18a,_0x35f66f,_0xfdf151){var _0x1b3b8d={};var _0x3c9a04={};var _0xd68ae7;var _0xe1f9e0;return db['OpenchannelAccount'][_0x74d0('0x63')]({'where':{'id':_0x4cd18a[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x35f66f,null))[_0x74d0('0x20')](function(_0x206d5c){if(_0x206d5c){_0xd68ae7=_0x206d5c;_0x3c9a04[_0x74d0('0x40')]=_[_0x74d0('0x41')](db[_0x74d0('0x99')][_0x74d0('0x3f')]);_0x3c9a04[_0x74d0('0x47')]=_[_0x74d0('0x41')](_0x4cd18a[_0x74d0('0x47')]);_0x3c9a04[_0x74d0('0x42')]=_['intersection'](_0x3c9a04[_0x74d0('0x40')],_0x3c9a04['query']);_0x1b3b8d[_0x74d0('0x43')]=_[_0x74d0('0x44')](_0x3c9a04[_0x74d0('0x40')],qs['fields'](_0x4cd18a[_0x74d0('0x47')][_0x74d0('0x45')]));_0x1b3b8d[_0x74d0('0x43')]=_0x1b3b8d['attributes']['length']?_0x1b3b8d[_0x74d0('0x43')]:_0x3c9a04[_0x74d0('0x40')];_0x1b3b8d[_0x74d0('0x65')]=qs['sort'](_0x4cd18a[_0x74d0('0x47')][_0x74d0('0x49')]);_0x1b3b8d[_0x74d0('0x4a')]=qs[_0x74d0('0x42')](_[_0x74d0('0x4b')](_0x4cd18a[_0x74d0('0x47')],_0x3c9a04[_0x74d0('0x42')]));if(_0x4cd18a[_0x74d0('0x47')][_0x74d0('0x4c')]){_0x1b3b8d['where']=_[_0x74d0('0x4d')](_0x1b3b8d[_0x74d0('0x4a')],{'$or':_[_0x74d0('0x3e')](_0x1b3b8d[_0x74d0('0x43')],function(_0x5bd3ae){var _0x240f6a={};_0x240f6a[_0x5bd3ae]={'$like':'%'+_0x4cd18a['query'][_0x74d0('0x4c')]+'%'};return _0x240f6a;})});}_0x1b3b8d=_[_0x74d0('0x4d')]({},_0x1b3b8d,_0x4cd18a[_0x74d0('0x4f')]);return _0xd68ae7[_0x74d0('0xb9')](_0x1b3b8d);}})[_0x74d0('0x20')](function(_0x55fef9){if(_0x55fef9){_0xe1f9e0=_0x55fef9['length'];if(!_0x4cd18a[_0x74d0('0x47')][_0x74d0('0x48')]('nolimit')){_0x1b3b8d[_0x74d0('0x30')]=qs[_0x74d0('0x30')](_0x4cd18a[_0x74d0('0x47')][_0x74d0('0x30')]);_0x1b3b8d[_0x74d0('0x31')]=qs[_0x74d0('0x31')](_0x4cd18a[_0x74d0('0x47')][_0x74d0('0x31')]);}return _0xd68ae7['getAgents'](_0x1b3b8d);}})['then'](function(_0x4bf68e){if(_0x4bf68e){return _0x4bf68e?{'count':_0xe1f9e0,'rows':_0x4bf68e}:null;}})[_0x74d0('0x20')](respondWithResult(_0x35f66f,null))['catch'](handleError(_0x35f66f,null));};exports[_0x74d0('0xa8')]=function(_0x4b0646,_0x2a2342,_0x2161f5){var _0x17bf9f,_0x4ffbb3,_0x211bf3;if(_['isNil'](_0x4b0646['body'][_0x74d0('0x5a')])||_0x4b0646[_0x74d0('0x5a')][_0x74d0('0x5a')]===''){throw new db[(_0x74d0('0x6e'))][(_0x74d0('0x75'))](_0x74d0('0xba'));}if(_[_0x74d0('0x73')](_0x4b0646[_0x74d0('0x5a')]['to'])){}_0x17bf9f=_0x4b0646[_0x74d0('0x5a')]['to'];return db[_0x74d0('0x50')][_0x74d0('0x63')]({'where':{'id':_0x4b0646[_0x74d0('0x57')]['id']}})[_0x74d0('0x20')](handleEntityNotFound(_0x2a2342,null))['then'](function(_0x25972e){if(_0x25972e){return db[_0x74d0('0x50')]['find']({'where':{'id':_0x25972e['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x74d0('0x7c'),'where':{[_0x25972e[_0x74d0('0x77')]]:_0x17bf9f},'limit':0x1,'order':[[_0x74d0('0x71'),_0x74d0('0x7d')]]}]}]})[_0x74d0('0x20')](handleEntityNotFound(_0x2a2342,null))[_0x74d0('0x20')](function(_0x2ed890){if(_0x2ed890&&_0x2ed890[_0x74d0('0x7b')]){_0x4ffbb3=_0x2ed890[_0x74d0('0x5c')]({'plain':!![]});if(_0x4ffbb3[_0x74d0('0x7b')]&&_0x4ffbb3['List'][_0x74d0('0x7c')][_0x74d0('0x46')]){return _0x4ffbb3[_0x74d0('0x7b')][_0x74d0('0x7c')][0x0];}return db[_0x74d0('0x6d')][_0x74d0('0x59')](_[_0x74d0('0x85')](_0x4b0646['body'],{'firstName':_0x17bf9f,[_0x2ed890[_0x74d0('0x77')]]:_0x17bf9f,'phone':_0x17bf9f,'ListId':_0x4ffbb3['ListId']}));}})[_0x74d0('0x20')](handleEntityNotFound(_0x2a2342,null))['then'](function(_0x300af6){if(_0x300af6){_0x211bf3=_0x300af6;return db[_0x74d0('0x89')]['find']({'where':{'ContactId':_0x211bf3['id'],'closed':![],'OpenchannelAccountId':_0x4ffbb3['id']}})[_0x74d0('0x20')](function(_0x50d233){if(_0x50d233){return[_0x50d233,![]];}return db[_0x74d0('0x89')][_0x74d0('0x59')]({'UserId':_0x4b0646[_0x74d0('0x5b')]['id'],'ContactId':_0x211bf3['id'],'OpenchannelAccountId':_0x4ffbb3['id'],'lastMsgDirection':'out','firstMsgDirection':_0x74d0('0xbb'),'Messages':[_['merge'](_0x4b0646[_0x74d0('0x5a')],{'read':![],'body':_0x4b0646['body'][_0x74d0('0x5a')],'OpenchannelAccountId':_0x4ffbb3['id'],'UserId':_0x4b0646[_0x74d0('0x5b')]['id'],'ContactId':_0x211bf3['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x74d0('0xbc')}]})['then'](function(_0x1f6416){return[_0x1f6416,!![]];});});}})[_0x74d0('0x8c')](function(_0x4382d2,_0x4e9b3e){if(_0x4e9b3e){return _0x4382d2;}return db[_0x74d0('0x96')][_0x74d0('0x59')](_[_0x74d0('0x4d')](_0x4b0646[_0x74d0('0x5a')],{'read':![],'body':_0x4b0646[_0x74d0('0x5a')][_0x74d0('0x5a')],'OpenchannelAccountId':_0x4ffbb3['id'],'OpenchannelInteractionId':_0x4382d2['id'],'UserId':_0x4b0646['user']['id'],'ContactId':_0x211bf3['id']}))[_0x74d0('0x20')](function(_0x29dc0d){_0x4382d2[_0x74d0('0xbd')][_0x74d0('0xbc')]=[];_0x4382d2[_0x74d0('0xbd')][_0x74d0('0xbc')]['push'](_0x29dc0d[_0x74d0('0xbd')]);return _0x4382d2;});});}})[_0x74d0('0x20')](respondWithResult(_0x2a2342,null))['catch'](handleError(_0x2a2342,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8400458..d151213 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 _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x4e31ed,_0xd37e34){var _0x5b35d8=function(_0x31a0a7){while(--_0x31a0a7){_0x4e31ed['push'](_0x4e31ed['shift']());}};_0x5b35d8(++_0xd37e34);}(_0x9348,0x10d));var _0x8934=function(_0x4c20b9,_0x29c7c2){_0x4c20b9=_0x4c20b9-0x0;var _0xb32eae=_0x9348[_0x4c20b9];return _0xb32eae;};'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 +var _0x5b02=['exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','remove','emit','hook'];(function(_0x58252d,_0x2070b3){var _0x55a98c=function(_0x4a2a1e){while(--_0x4a2a1e){_0x58252d['push'](_0x58252d['shift']());}};_0x55a98c(++_0x2070b3);}(_0x5b02,0xe9));var _0x25b0=function(_0x688895,_0x3f3236){_0x688895=_0x688895-0x0;var _0x2dda49=_0x5b02[_0x688895];return _0x2dda49;};'use strict';var EventEmitter=require(_0x25b0('0x0'));var OpenchannelAccount=require(_0x25b0('0x1'))['db'][_0x25b0('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x25b0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x25b0('0x4')};function emitEvent(_0x53493e){return function(_0x3e1d20,_0x31c9c2,_0x38dc14){OpenchannelAccountEvents[_0x25b0('0x5')](_0x53493e+':'+_0x3e1d20['id'],_0x3e1d20);OpenchannelAccountEvents[_0x25b0('0x5')](_0x53493e,_0x3e1d20);_0x38dc14(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x25b0('0x6')](e,emitEvent(event));}}module[_0x25b0('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index cc62572..0844a94 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(_0x3f3fe7,_0x14f076){var _0x4cefa3=function(_0x251f4c){while(--_0x251f4c){_0x3f3fe7['push'](_0x3f3fe7['shift']());}};_0x4cefa3(++_0x14f076);}(_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 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(_0x204cf8,_0x21801e){var _0x5939bf=function(_0x5b896a){while(--_0x5b896a){_0x204cf8['push'](_0x204cf8['shift']());}};_0x5939bf(++_0x21801e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 3b4f830..4f00ae8 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 _0x878f=['message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x386d37,_0x30f6ba){var _0x2e0678=function(_0x1714bd){while(--_0x1714bd){_0x386d37['push'](_0x386d37['shift']());}};_0x2e0678(++_0x30f6ba);}(_0x878f,0x173));var _0xf878=function(_0x60fe87,_0x26df1d){_0x60fe87=_0x60fe87-0x0;var _0x5de317=_0x878f[_0x60fe87];return _0x5de317;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xf878('0xb')]=_[_0xf878('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf878('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x307653,_0x2e6931,_0x223504){return new BPromise(function(_0x52edde,_0xb2863e){return client[_0xf878('0xd')](_0x307653,_0x223504)['then'](function(_0xdf76){logger['info'](_0xf878('0xe'),_0x2e6931,_0xf878('0xf'));logger[_0xf878('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2e6931,_0xf878('0xf'),JSON[_0xf878('0x11')](_0xdf76));if(_0xdf76[_0xf878('0x12')]){if(_0xdf76['error'][_0xf878('0x13')]===0x1f4){logger[_0xf878('0x12')](_0xf878('0xe'),_0x2e6931,_0xdf76['error']['message']);return _0xb2863e(_0xdf76[_0xf878('0x12')][_0xf878('0x14')]);}logger[_0xf878('0x12')](_0xf878('0xe'),_0x2e6931,_0xdf76[_0xf878('0x12')][_0xf878('0x14')]);return _0x52edde(_0xdf76[_0xf878('0x12')][_0xf878('0x14')]);}else{logger[_0xf878('0x15')](_0xf878('0xe'),_0x2e6931,_0xf878('0xf'));_0x52edde(_0xdf76['result'][_0xf878('0x14')]);}})[_0xf878('0x16')](function(_0x412de1){logger[_0xf878('0x12')](_0xf878('0xe'),_0x2e6931,_0x412de1);_0xb2863e(_0x412de1);});});} \ No newline at end of file +var _0x0427=['./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x515b75,_0x107b96){var _0x12ad22=function(_0x4d4a61){while(--_0x4d4a61){_0x515b75['push'](_0x515b75['shift']());}};_0x12ad22(++_0x107b96);}(_0x0427,0x137));var _0x7042=function(_0x32c11d,_0x2dfef7){_0x32c11d=_0x32c11d-0x0;var _0x31ea52=_0x0427[_0x32c11d];return _0x31ea52;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7042('0x0'));var BPromise=require(_0x7042('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7042('0x2'));var db=require(_0x7042('0x3'))['db'];var utils=require(_0x7042('0x4'));var logger=require(_0x7042('0x5'))(_0x7042('0x6'));var config=require(_0x7042('0x7'));var jayson=require(_0x7042('0x8'));var client=jayson['client'][_0x7042('0x9')]({'port':0x232a});config[_0x7042('0xa')]=_[_0x7042('0xb')](config[_0x7042('0xa')],{'host':_0x7042('0xc'),'port':0x18eb});var socket=require(_0x7042('0xd'))(new Redis(config[_0x7042('0xa')]));require(_0x7042('0xe'))[_0x7042('0xf')](socket);function respondWithRpcPromise(_0x5a29aa,_0x326210,_0x5c3f0f){return new BPromise(function(_0x5cf853,_0x50eefb){return client['request'](_0x5a29aa,_0x5c3f0f)[_0x7042('0x10')](function(_0x5636e8){logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x326210,_0x7042('0x13'),JSON[_0x7042('0x14')](_0x5636e8));if(_0x5636e8[_0x7042('0x15')]){if(_0x5636e8[_0x7042('0x15')][_0x7042('0x16')]===0x1f4){logger[_0x7042('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x326210,_0x5636e8[_0x7042('0x15')][_0x7042('0x17')]);return _0x50eefb(_0x5636e8[_0x7042('0x15')]['message']);}logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x5636e8['error'][_0x7042('0x17')]);return _0x5cf853(_0x5636e8['error']['message']);}else{logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));_0x5cf853(_0x5636e8[_0x7042('0x18')][_0x7042('0x17')]);}})['catch'](function(_0x438084){logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x438084);_0x50eefb(_0x438084);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index a50e67f..01296a4 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 _0x97a2=['remove','update','emit','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x2fd423,_0x194fcc){var _0x38cceb=function(_0x18aea4){while(--_0x18aea4){_0x2fd423['push'](_0x2fd423['shift']());}};_0x38cceb(++_0x194fcc);}(_0x97a2,0x1b1));var _0x297a=function(_0x557e4f,_0x12db61){_0x557e4f=_0x557e4f-0x0;var _0x213365=_0x97a2[_0x557e4f];return _0x213365;};'use strict';var OpenchannelAccountEvents=require(_0x297a('0x0'));var events=['save',_0x297a('0x1'),_0x297a('0x2')];function createListener(_0x25fc7c,_0xfb9aa2){return function(_0x14d6d3){_0xfb9aa2[_0x297a('0x3')](_0x25fc7c,_0x14d6d3);};}function removeListener(_0x2cf730,_0x42a0a0){return function(){OpenchannelAccountEvents['removeListener'](_0x2cf730,_0x42a0a0);};}exports[_0x297a('0x4')]=function(_0x2a420b){for(var _0x2c1f41=0x0,_0x8cbc92=events[_0x297a('0x5')];_0x2c1f41<_0x8cbc92;_0x2c1f41++){var _0x3d9c6a=events[_0x2c1f41];var _0x5ab57b=createListener(_0x297a('0x6')+_0x3d9c6a,_0x2a420b);OpenchannelAccountEvents['on'](_0x3d9c6a,_0x5ab57b);}}; \ No newline at end of file +var _0x07c3=['update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x4b7ad9,_0x5256f4){var _0x39b8df=function(_0x480d9e){while(--_0x480d9e){_0x4b7ad9['push'](_0x4b7ad9['shift']());}};_0x39b8df(++_0x5256f4);}(_0x07c3,0x1bf));var _0x307c=function(_0x450d4e,_0xcacc3){_0x450d4e=_0x450d4e-0x0;var _0x300304=_0x07c3[_0x450d4e];return _0x300304;};'use strict';var OpenchannelAccountEvents=require(_0x307c('0x0'));var events=[_0x307c('0x1'),_0x307c('0x2'),_0x307c('0x3')];function createListener(_0x39fd38,_0x8b0b1c){return function(_0x3b8f6e){_0x8b0b1c[_0x307c('0x4')](_0x39fd38,_0x3b8f6e);};}function removeListener(_0x52cf54,_0x37adf4){return function(){OpenchannelAccountEvents[_0x307c('0x5')](_0x52cf54,_0x37adf4);};}exports[_0x307c('0x6')]=function(_0x317066){for(var _0x250f22=0x0,_0x410ae8=events[_0x307c('0x7')];_0x250f22<_0x410ae8;_0x250f22++){var _0x3f5d08=events[_0x250f22];var _0xfb14bf=createListener(_0x307c('0x8')+_0x3f5d08,_0x317066);OpenchannelAccountEvents['on'](_0x3f5d08,_0xfb14bf);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d1f79f3..b1cecd1 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 _0xf114=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x4eb134,_0x58970f){var _0x12ce5a=function(_0x2e8b18){while(--_0x2e8b18){_0x4eb134['push'](_0x4eb134['shift']());}};_0x12ce5a(++_0x58970f);}(_0xf114,0x105));var _0x4f11=function(_0x55ffe1,_0x3f1add){_0x55ffe1=_0x55ffe1-0x0;var _0x3c5b32=_0xf114[_0x55ffe1];return _0x3c5b32;};'use strict';var multer=require('multer');var util=require(_0x4f11('0x0'));var path=require(_0x4f11('0x1'));var timeout=require(_0x4f11('0x2'));var express=require(_0x4f11('0x3'));var router=express[_0x4f11('0x4')]();var fs_extra=require(_0x4f11('0x5'));var auth=require(_0x4f11('0x6'));var interaction=require(_0x4f11('0x7'));var config=require(_0x4f11('0x8'));var controller=require(_0x4f11('0x9'));router[_0x4f11('0xa')]('/',auth[_0x4f11('0xb')](),controller['index']);router[_0x4f11('0xa')](_0x4f11('0xc'),auth[_0x4f11('0xb')](),controller[_0x4f11('0xd')]);router[_0x4f11('0xe')]('/',auth[_0x4f11('0xb')](),controller[_0x4f11('0xf')]);router[_0x4f11('0x10')](_0x4f11('0xc'),auth['isAuthenticated'](),controller[_0x4f11('0x11')]);router[_0x4f11('0x12')](_0x4f11('0xc'),auth[_0x4f11('0xb')](),controller[_0x4f11('0x13')]);module[_0x4f11('0x14')]=router; \ No newline at end of file +var _0x0077=['delete','/:id','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','show','create','put','update'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x0077,0x1c2));var _0x7007=function(_0x58e8e4,_0x850ae1){_0x58e8e4=_0x58e8e4-0x0;var _0x4bf674=_0x0077[_0x58e8e4];return _0x4bf674;};'use strict';var multer=require(_0x7007('0x0'));var util=require(_0x7007('0x1'));var path=require(_0x7007('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7007('0x3')]();var fs_extra=require(_0x7007('0x4'));var auth=require(_0x7007('0x5'));var interaction=require(_0x7007('0x6'));var config=require('../../config/environment');var controller=require(_0x7007('0x7'));router[_0x7007('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7007('0x8')]('/:id',auth[_0x7007('0x9')](),controller[_0x7007('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7007('0xb')]);router[_0x7007('0xc')]('/:id',auth[_0x7007('0x9')](),controller[_0x7007('0xd')]);router[_0x7007('0xe')](_0x7007('0xf'),auth['isAuthenticated'](),controller['destroy']);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 929d930..e83e81a 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 _0xc4d2=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x989986,_0x268417){var _0x444ed7=function(_0x1c3c6c){while(--_0x1c3c6c){_0x989986['push'](_0x989986['shift']());}};_0x444ed7(++_0x268417);}(_0xc4d2,0x1de));var _0x2c4d=function(_0x363eb8,_0x535817){_0x363eb8=_0x363eb8-0x0;var _0x360ffb=_0xc4d2[_0x363eb8];return _0x360ffb;};'use strict';var Sequelize=require(_0x2c4d('0x0'));module[_0x2c4d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2c4d('0x2')],'allowNull':![],'defaultValue':_0x2c4d('0x3')},'appdata':{'type':Sequelize[_0x2c4d('0x4')]()},'description':{'type':Sequelize[_0x2c4d('0x2')]},'interval':{'type':Sequelize[_0x2c4d('0x2')],'defaultValue':_0x2c4d('0x5')}}; \ No newline at end of file +var _0xb78d=['noop','TEXT','sequelize','exports','STRING'];(function(_0x56f407,_0x3e7fb7){var _0x4f295d=function(_0x6acf9f){while(--_0x6acf9f){_0x56f407['push'](_0x56f407['shift']());}};_0x4f295d(++_0x3e7fb7);}(_0xb78d,0x1e2));var _0xdb78=function(_0x450982,_0x30b4d4){_0x450982=_0x450982-0x0;var _0x881d3e=_0xb78d[_0x450982];return _0x881d3e;};'use strict';var Sequelize=require(_0xdb78('0x0'));module[_0xdb78('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdb78('0x2')],'allowNull':![],'defaultValue':_0xdb78('0x3')},'appdata':{'type':Sequelize[_0xdb78('0x4')]()},'description':{'type':Sequelize[_0xdb78('0x2')]},'interval':{'type':Sequelize[_0xdb78('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d78977a..3e26467 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 _0x41d9=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','merge','options','OpenchannelApplication','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x2180a8,_0x1db495){var _0x5f2fc1=function(_0x563685){while(--_0x563685){_0x2180a8['push'](_0x2180a8['shift']());}};_0x5f2fc1(++_0x1db495);}(_0x41d9,0x8f));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x941d('0x0'));var rimraf=require(_0x941d('0x1'));var zipdir=require(_0x941d('0x2'));var jsonpatch=require(_0x941d('0x3'));var rp=require('request-promise');var moment=require(_0x941d('0x4'));var BPromise=require(_0x941d('0x5'));var Mustache=require(_0x941d('0x6'));var util=require(_0x941d('0x7'));var path=require(_0x941d('0x8'));var sox=require(_0x941d('0x9'));var csv=require(_0x941d('0xa'));var ejs=require(_0x941d('0xb'));var fs=require('fs');var fs_extra=require(_0x941d('0xc'));var _=require(_0x941d('0xd'));var squel=require(_0x941d('0xe'));var crypto=require(_0x941d('0xf'));var jsforce=require(_0x941d('0x10'));var deskjs=require(_0x941d('0x11'));var toCsv=require(_0x941d('0xa'));var querystring=require(_0x941d('0x12'));var Papa=require(_0x941d('0x13'));var Redis=require(_0x941d('0x14'));var authService=require(_0x941d('0x15'));var qs=require(_0x941d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x941d('0x17'));var licenseUtil=require(_0x941d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x262db1,_0x312ecc){_0x312ecc=_0x312ecc||0xcc;return function(_0xf68387){if(_0xf68387){return _0x262db1[_0x941d('0x19')](_0x312ecc);}return _0x262db1[_0x941d('0x1a')](_0x312ecc)[_0x941d('0x1b')]();};}function respondWithResult(_0x258917,_0x1f191c){_0x1f191c=_0x1f191c||0xc8;return function(_0x502556){if(_0x502556){return _0x258917['status'](_0x1f191c)[_0x941d('0x1c')](_0x502556);}};}function respondWithFilteredResult(_0x2e0095,_0x3592e0){return function(_0x5d6d65){if(_0x5d6d65){var _0x53bab2=typeof _0x3592e0['offset']===_0x941d('0x1d')&&typeof _0x3592e0[_0x941d('0x1e')]==='undefined';var _0x51adbd=_0x5d6d65[_0x941d('0x1f')];var _0x8b6e34=_0x53bab2?0x0:_0x3592e0[_0x941d('0x20')];var _0x2edf8b=_0x53bab2?_0x5d6d65[_0x941d('0x1f')]:_0x3592e0['offset']+_0x3592e0['limit'];var _0x44dad9;if(_0x2edf8b>=_0x51adbd){_0x2edf8b=_0x51adbd;_0x44dad9=0xc8;}else{_0x44dad9=0xce;}_0x2e0095[_0x941d('0x1a')](_0x44dad9);return _0x2e0095[_0x941d('0x21')](_0x941d('0x22'),_0x8b6e34+'-'+_0x2edf8b+'/'+_0x51adbd)['json'](_0x5d6d65);}return null;};}function patchUpdates(_0x177a4e){return function(_0x55cbd0){try{jsonpatch[_0x941d('0x23')](_0x55cbd0,_0x177a4e,!![]);}catch(_0x473e07){return BPromise[_0x941d('0x24')](_0x473e07);}return _0x55cbd0[_0x941d('0x25')]();};}function saveUpdates(_0x49a33f,_0x47ff5d){return function(_0x209d7c){if(_0x209d7c){return _0x209d7c[_0x941d('0x26')](_0x49a33f)[_0x941d('0x27')](function(_0x2e8c69){return _0x2e8c69;});}return null;};}function removeEntity(_0x1f90ce,_0x238f39){return function(_0x596518){if(_0x596518){return _0x596518[_0x941d('0x28')]()['then'](function(){_0x1f90ce[_0x941d('0x1a')](0xcc)[_0x941d('0x1b')]();});}};}function handleEntityNotFound(_0x4126d2,_0x2d214){return function(_0x5dafda){if(!_0x5dafda){_0x4126d2[_0x941d('0x19')](0x194);}return _0x5dafda;};}function handleError(_0x44e46c,_0x2b6773){_0x2b6773=_0x2b6773||0x1f4;return function(_0x33c278){logger['error'](_0x33c278['stack']);if(_0x33c278['name']){delete _0x33c278[_0x941d('0x29')];}_0x44e46c[_0x941d('0x1a')](_0x2b6773)[_0x941d('0x2a')](_0x33c278);};}exports[_0x941d('0x2b')]=function(_0x120daa,_0x184ad1){var _0x457f14={},_0x3645b7={},_0x576fd1={'count':0x0,'rows':[]};var _0x44e906=_[_0x941d('0x2c')](db['OpenchannelApplication'][_0x941d('0x2d')],function(_0x6c1a82){return{'name':_0x6c1a82[_0x941d('0x2e')],'type':_0x6c1a82['type'][_0x941d('0x2f')]};});_0x3645b7[_0x941d('0x30')]=_[_0x941d('0x2c')](_0x44e906,'name');_0x3645b7[_0x941d('0x31')]=_[_0x941d('0x32')](_0x120daa['query']);_0x3645b7[_0x941d('0x33')]=_[_0x941d('0x34')](_0x3645b7[_0x941d('0x30')],_0x3645b7['query']);_0x457f14[_0x941d('0x35')]=_[_0x941d('0x34')](_0x3645b7[_0x941d('0x30')],qs[_0x941d('0x36')](_0x120daa['query']['fields']));_0x457f14[_0x941d('0x35')]=_0x457f14[_0x941d('0x35')][_0x941d('0x37')]?_0x457f14[_0x941d('0x35')]:_0x3645b7['model'];if(!_0x120daa[_0x941d('0x31')][_0x941d('0x38')](_0x941d('0x39'))){_0x457f14[_0x941d('0x1e')]=qs['limit'](_0x120daa[_0x941d('0x31')][_0x941d('0x1e')]);_0x457f14['offset']=qs[_0x941d('0x20')](_0x120daa[_0x941d('0x31')][_0x941d('0x20')]);}_0x457f14[_0x941d('0x3a')]=qs['sort'](_0x120daa['query'][_0x941d('0x3b')]);_0x457f14['where']=qs[_0x941d('0x33')](_['pick'](_0x120daa[_0x941d('0x31')],_0x3645b7[_0x941d('0x33')]),_0x44e906);if(_0x120daa[_0x941d('0x31')][_0x941d('0x3c')]){_0x457f14[_0x941d('0x3d')]=_['merge'](_0x457f14[_0x941d('0x3d')],{'$or':_[_0x941d('0x2c')](_0x44e906,function(_0x3ffc86){if(_0x3ffc86[_0x941d('0x3e')]!=='VIRTUAL'){var _0x1a3849={};_0x1a3849[_0x3ffc86[_0x941d('0x29')]]={'$like':'%'+_0x120daa[_0x941d('0x31')][_0x941d('0x3c')]+'%'};return _0x1a3849;}})});}_0x457f14=_[_0x941d('0x3f')]({},_0x457f14,_0x120daa[_0x941d('0x40')]);var _0x4b1f39={'where':_0x457f14['where']};return db[_0x941d('0x41')]['count'](_0x4b1f39)['then'](function(_0x38acf2){_0x576fd1[_0x941d('0x1f')]=_0x38acf2;if(_0x120daa[_0x941d('0x31')][_0x941d('0x42')]){_0x457f14['include']=[{'all':!![]}];}return db[_0x941d('0x41')][_0x941d('0x43')](_0x457f14);})[_0x941d('0x27')](function(_0x253182){_0x576fd1[_0x941d('0x44')]=_0x253182;return _0x576fd1;})[_0x941d('0x27')](respondWithFilteredResult(_0x184ad1,_0x457f14))[_0x941d('0x45')](handleError(_0x184ad1,null));};exports['show']=function(_0x14c185,_0x4632e4){var _0x27de93={'raw':!![],'where':{'id':_0x14c185[_0x941d('0x46')]['id']}},_0x335782={};_0x335782['model']=_[_0x941d('0x32')](db[_0x941d('0x41')]['rawAttributes']);_0x335782[_0x941d('0x31')]=_[_0x941d('0x32')](_0x14c185[_0x941d('0x31')]);_0x335782['filters']=_['intersection'](_0x335782[_0x941d('0x30')],_0x335782[_0x941d('0x31')]);_0x27de93['attributes']=_['intersection'](_0x335782['model'],qs[_0x941d('0x36')](_0x14c185[_0x941d('0x31')][_0x941d('0x36')]));_0x27de93[_0x941d('0x35')]=_0x27de93[_0x941d('0x35')][_0x941d('0x37')]?_0x27de93[_0x941d('0x35')]:_0x335782[_0x941d('0x30')];if(_0x14c185['query'][_0x941d('0x42')]){_0x27de93[_0x941d('0x47')]=[{'all':!![]}];}_0x27de93=_['merge']({},_0x27de93,_0x14c185[_0x941d('0x40')]);return db[_0x941d('0x41')][_0x941d('0x48')](_0x27de93)[_0x941d('0x27')](handleEntityNotFound(_0x4632e4,null))[_0x941d('0x27')](respondWithResult(_0x4632e4,null))['catch'](handleError(_0x4632e4,null));};exports[_0x941d('0x49')]=function(_0x3dc7f8,_0x3c3c6c){return db[_0x941d('0x41')]['create'](_0x3dc7f8[_0x941d('0x4a')],{})[_0x941d('0x27')](respondWithResult(_0x3c3c6c,0xc9))['catch'](handleError(_0x3c3c6c,null));};exports['update']=function(_0x115a43,_0x4e40cc){if(_0x115a43['body']['id']){delete _0x115a43[_0x941d('0x4a')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x115a43['params']['id']}})[_0x941d('0x27')](handleEntityNotFound(_0x4e40cc,null))[_0x941d('0x27')](saveUpdates(_0x115a43['body'],null))[_0x941d('0x27')](respondWithResult(_0x4e40cc,null))[_0x941d('0x45')](handleError(_0x4e40cc,null));};exports[_0x941d('0x28')]=function(_0x4edd46,_0x4db8b8){return db[_0x941d('0x41')]['find']({'where':{'id':_0x4edd46[_0x941d('0x46')]['id']}})[_0x941d('0x27')](handleEntityNotFound(_0x4db8b8,null))['then'](removeEntity(_0x4db8b8,null))[_0x941d('0x45')](handleError(_0x4db8b8,null));}; \ No newline at end of file +var _0x8c4d=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','catch','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xb1e954,_0x465784){var _0x41f928=function(_0xab6029){while(--_0xab6029){_0xb1e954['push'](_0xb1e954['shift']());}};_0x41f928(++_0x465784);}(_0x8c4d,0x1b0));var _0xd8c4=function(_0x41ecb2,_0x306e02){_0x41ecb2=_0x41ecb2-0x0;var _0x1137d9=_0x8c4d[_0x41ecb2];return _0x1137d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8c4('0x0'));var zipdir=require(_0xd8c4('0x1'));var jsonpatch=require(_0xd8c4('0x2'));var rp=require(_0xd8c4('0x3'));var moment=require(_0xd8c4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd8c4('0x5'));var path=require('path');var sox=require(_0xd8c4('0x6'));var csv=require('to-csv');var ejs=require(_0xd8c4('0x7'));var fs=require('fs');var fs_extra=require(_0xd8c4('0x8'));var _=require(_0xd8c4('0x9'));var squel=require(_0xd8c4('0xa'));var crypto=require('crypto');var jsforce=require(_0xd8c4('0xb'));var deskjs=require(_0xd8c4('0xc'));var toCsv=require(_0xd8c4('0xd'));var querystring=require(_0xd8c4('0xe'));var Papa=require(_0xd8c4('0xf'));var Redis=require('ioredis');var authService=require(_0xd8c4('0x10'));var qs=require(_0xd8c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8c4('0x12'));var logger=require(_0xd8c4('0x13'))('api');var utils=require(_0xd8c4('0x14'));var config=require(_0xd8c4('0x15'));var licenseUtil=require(_0xd8c4('0x16'));var db=require(_0xd8c4('0x17'))['db'];function respondWithStatusCode(_0x7dabc,_0x2fc5d0){_0x2fc5d0=_0x2fc5d0||0xcc;return function(_0x11623f){if(_0x11623f){return _0x7dabc[_0xd8c4('0x18')](_0x2fc5d0);}return _0x7dabc[_0xd8c4('0x19')](_0x2fc5d0)[_0xd8c4('0x1a')]();};}function respondWithResult(_0x4516ad,_0x1874f1){_0x1874f1=_0x1874f1||0xc8;return function(_0x130995){if(_0x130995){return _0x4516ad['status'](_0x1874f1)[_0xd8c4('0x1b')](_0x130995);}};}function respondWithFilteredResult(_0x3d64c3,_0x37d489){return function(_0xbb52d3){if(_0xbb52d3){var _0x4921ab=typeof _0x37d489[_0xd8c4('0x1c')]===_0xd8c4('0x1d')&&typeof _0x37d489[_0xd8c4('0x1e')]==='undefined';var _0x23a19d=_0xbb52d3[_0xd8c4('0x1f')];var _0x232d67=_0x4921ab?0x0:_0x37d489['offset'];var _0x262c5a=_0x4921ab?_0xbb52d3[_0xd8c4('0x1f')]:_0x37d489['offset']+_0x37d489['limit'];var _0x235a87;if(_0x262c5a>=_0x23a19d){_0x262c5a=_0x23a19d;_0x235a87=0xc8;}else{_0x235a87=0xce;}_0x3d64c3[_0xd8c4('0x19')](_0x235a87);return _0x3d64c3[_0xd8c4('0x20')](_0xd8c4('0x21'),_0x232d67+'-'+_0x262c5a+'/'+_0x23a19d)[_0xd8c4('0x1b')](_0xbb52d3);}return null;};}function patchUpdates(_0x3cc77c){return function(_0x5da47b){try{jsonpatch[_0xd8c4('0x22')](_0x5da47b,_0x3cc77c,!![]);}catch(_0x13dd3c){return BPromise['reject'](_0x13dd3c);}return _0x5da47b[_0xd8c4('0x23')]();};}function saveUpdates(_0xa36f77,_0x3ced78){return function(_0xebc28a){if(_0xebc28a){return _0xebc28a['update'](_0xa36f77)['then'](function(_0x30cac3){return _0x30cac3;});}return null;};}function removeEntity(_0x7111e7,_0xa481cd){return function(_0x1257f3){if(_0x1257f3){return _0x1257f3[_0xd8c4('0x24')]()[_0xd8c4('0x25')](function(){_0x7111e7['status'](0xcc)[_0xd8c4('0x1a')]();});}};}function handleEntityNotFound(_0x43a2a8,_0x1be639){return function(_0x4c0e31){if(!_0x4c0e31){_0x43a2a8['sendStatus'](0x194);}return _0x4c0e31;};}function handleError(_0x35bcfe,_0x360e34){_0x360e34=_0x360e34||0x1f4;return function(_0x4990e1){logger[_0xd8c4('0x26')](_0x4990e1[_0xd8c4('0x27')]);if(_0x4990e1['name']){delete _0x4990e1[_0xd8c4('0x28')];}_0x35bcfe[_0xd8c4('0x19')](_0x360e34)['send'](_0x4990e1);};}exports[_0xd8c4('0x29')]=function(_0xe0e164,_0x341c3b){var _0x434958={},_0x4ad372={},_0x10021c={'count':0x0,'rows':[]};var _0x30258c=_[_0xd8c4('0x2a')](db[_0xd8c4('0x2b')][_0xd8c4('0x2c')],function(_0x482c3b){return{'name':_0x482c3b[_0xd8c4('0x2d')],'type':_0x482c3b[_0xd8c4('0x2e')]['key']};});_0x4ad372['model']=_['map'](_0x30258c,'name');_0x4ad372[_0xd8c4('0x2f')]=_[_0xd8c4('0x30')](_0xe0e164[_0xd8c4('0x2f')]);_0x4ad372[_0xd8c4('0x31')]=_[_0xd8c4('0x32')](_0x4ad372['model'],_0x4ad372[_0xd8c4('0x2f')]);_0x434958['attributes']=_[_0xd8c4('0x32')](_0x4ad372[_0xd8c4('0x33')],qs[_0xd8c4('0x34')](_0xe0e164[_0xd8c4('0x2f')][_0xd8c4('0x34')]));_0x434958[_0xd8c4('0x35')]=_0x434958[_0xd8c4('0x35')][_0xd8c4('0x36')]?_0x434958['attributes']:_0x4ad372[_0xd8c4('0x33')];if(!_0xe0e164[_0xd8c4('0x2f')][_0xd8c4('0x37')](_0xd8c4('0x38'))){_0x434958[_0xd8c4('0x1e')]=qs[_0xd8c4('0x1e')](_0xe0e164[_0xd8c4('0x2f')][_0xd8c4('0x1e')]);_0x434958[_0xd8c4('0x1c')]=qs['offset'](_0xe0e164[_0xd8c4('0x2f')]['offset']);}_0x434958[_0xd8c4('0x39')]=qs[_0xd8c4('0x3a')](_0xe0e164[_0xd8c4('0x2f')][_0xd8c4('0x3a')]);_0x434958[_0xd8c4('0x3b')]=qs[_0xd8c4('0x31')](_[_0xd8c4('0x3c')](_0xe0e164[_0xd8c4('0x2f')],_0x4ad372[_0xd8c4('0x31')]),_0x30258c);if(_0xe0e164[_0xd8c4('0x2f')][_0xd8c4('0x3d')]){_0x434958['where']=_[_0xd8c4('0x3e')](_0x434958[_0xd8c4('0x3b')],{'$or':_[_0xd8c4('0x2a')](_0x30258c,function(_0x1bf611){if(_0x1bf611[_0xd8c4('0x2e')]!==_0xd8c4('0x3f')){var _0x44708a={};_0x44708a[_0x1bf611[_0xd8c4('0x28')]]={'$like':'%'+_0xe0e164[_0xd8c4('0x2f')][_0xd8c4('0x3d')]+'%'};return _0x44708a;}})});}_0x434958=_[_0xd8c4('0x3e')]({},_0x434958,_0xe0e164[_0xd8c4('0x40')]);var _0xa0408f={'where':_0x434958[_0xd8c4('0x3b')]};return db[_0xd8c4('0x2b')][_0xd8c4('0x1f')](_0xa0408f)[_0xd8c4('0x25')](function(_0x44c9ef){_0x10021c['count']=_0x44c9ef;if(_0xe0e164[_0xd8c4('0x2f')]['includeAll']){_0x434958[_0xd8c4('0x41')]=[{'all':!![]}];}return db[_0xd8c4('0x2b')]['findAll'](_0x434958);})[_0xd8c4('0x25')](function(_0x4b3800){_0x10021c[_0xd8c4('0x42')]=_0x4b3800;return _0x10021c;})[_0xd8c4('0x25')](respondWithFilteredResult(_0x341c3b,_0x434958))['catch'](handleError(_0x341c3b,null));};exports[_0xd8c4('0x43')]=function(_0x1f8c39,_0x13f8c1){var _0x95cc07={'raw':!![],'where':{'id':_0x1f8c39[_0xd8c4('0x44')]['id']}},_0xf0a8d7={};_0xf0a8d7[_0xd8c4('0x33')]=_['keys'](db[_0xd8c4('0x2b')][_0xd8c4('0x2c')]);_0xf0a8d7[_0xd8c4('0x2f')]=_[_0xd8c4('0x30')](_0x1f8c39['query']);_0xf0a8d7[_0xd8c4('0x31')]=_[_0xd8c4('0x32')](_0xf0a8d7[_0xd8c4('0x33')],_0xf0a8d7[_0xd8c4('0x2f')]);_0x95cc07[_0xd8c4('0x35')]=_['intersection'](_0xf0a8d7[_0xd8c4('0x33')],qs[_0xd8c4('0x34')](_0x1f8c39[_0xd8c4('0x2f')]['fields']));_0x95cc07[_0xd8c4('0x35')]=_0x95cc07[_0xd8c4('0x35')]['length']?_0x95cc07[_0xd8c4('0x35')]:_0xf0a8d7['model'];if(_0x1f8c39[_0xd8c4('0x2f')][_0xd8c4('0x45')]){_0x95cc07[_0xd8c4('0x41')]=[{'all':!![]}];}_0x95cc07=_['merge']({},_0x95cc07,_0x1f8c39['options']);return db['OpenchannelApplication']['find'](_0x95cc07)[_0xd8c4('0x25')](handleEntityNotFound(_0x13f8c1,null))[_0xd8c4('0x25')](respondWithResult(_0x13f8c1,null))[_0xd8c4('0x46')](handleError(_0x13f8c1,null));};exports['create']=function(_0x54e1df,_0x5a6328){return db[_0xd8c4('0x2b')][_0xd8c4('0x47')](_0x54e1df[_0xd8c4('0x48')],{})[_0xd8c4('0x25')](respondWithResult(_0x5a6328,0xc9))[_0xd8c4('0x46')](handleError(_0x5a6328,null));};exports[_0xd8c4('0x49')]=function(_0x15f570,_0x3f772e){if(_0x15f570['body']['id']){delete _0x15f570[_0xd8c4('0x48')]['id'];}return db[_0xd8c4('0x2b')][_0xd8c4('0x4a')]({'where':{'id':_0x15f570[_0xd8c4('0x44')]['id']}})[_0xd8c4('0x25')](handleEntityNotFound(_0x3f772e,null))[_0xd8c4('0x25')](saveUpdates(_0x15f570[_0xd8c4('0x48')],null))[_0xd8c4('0x25')](respondWithResult(_0x3f772e,null))[_0xd8c4('0x46')](handleError(_0x3f772e,null));};exports[_0xd8c4('0x24')]=function(_0x382732,_0x12c8a9){return db[_0xd8c4('0x2b')][_0xd8c4('0x4a')]({'where':{'id':_0x382732['params']['id']}})['then'](handleEntityNotFound(_0x12c8a9,null))[_0xd8c4('0x25')](removeEntity(_0x12c8a9,null))['catch'](handleError(_0x12c8a9,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index c6e89fb..3328624 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 _0xffcc=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x58abf2,_0xf47bfa){var _0x20bfec=function(_0x7a2837){while(--_0x7a2837){_0x58abf2['push'](_0x58abf2['shift']());}};_0x20bfec(++_0xf47bfa);}(_0xffcc,0x188));var _0xcffc=function(_0x47c2f6,_0x982f03){_0x47c2f6=_0x47c2f6-0x0;var _0x5ea4dc=_0xffcc[_0x47c2f6];return _0x5ea4dc;};'use strict';var _=require(_0xcffc('0x0'));var util=require(_0xcffc('0x1'));var logger=require(_0xcffc('0x2'))(_0xcffc('0x3'));var moment=require(_0xcffc('0x4'));var BPromise=require(_0xcffc('0x5'));var rp=require(_0xcffc('0x6'));var fs=require('fs');var path=require(_0xcffc('0x7'));var rimraf=require(_0xcffc('0x8'));var config=require(_0xcffc('0x9'));var attributes=require(_0xcffc('0xa'));module[_0xcffc('0xb')]=function(_0x293d57,_0x50b29d){return _0x293d57[_0xcffc('0xc')](_0xcffc('0xd'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcffc('0xe'),'collate':_0xcffc('0xf')});}; \ No newline at end of file +var _0x7b6d=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x31cd06,_0x190eaf){var _0xc9ec90=function(_0x3b0b75){while(--_0x3b0b75){_0x31cd06['push'](_0x31cd06['shift']());}};_0xc9ec90(++_0x190eaf);}(_0x7b6d,0x18a));var _0xd7b6=function(_0x5d79a2,_0x2a4419){_0x5d79a2=_0x5d79a2-0x0;var _0x43bec5=_0x7b6d[_0x5d79a2];return _0x43bec5;};'use strict';var _=require(_0xd7b6('0x0'));var util=require(_0xd7b6('0x1'));var logger=require('../../config/logger')(_0xd7b6('0x2'));var moment=require(_0xd7b6('0x3'));var BPromise=require(_0xd7b6('0x4'));var rp=require(_0xd7b6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7b6('0x6'));var config=require('../../config/environment');var attributes=require(_0xd7b6('0x7'));module[_0xd7b6('0x8')]=function(_0x3dd04d,_0xa4ee86){return _0x3dd04d[_0xd7b6('0x9')](_0xd7b6('0xa'),attributes,{'tableName':_0xd7b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd7b6('0xc'),'collate':_0xd7b6('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 87309cc..28f5448 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 _0x81d3=['update','options','raw','where','attributes','limit','stringify','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent','error','message','result','UpdateOpenchannelApplication'];(function(_0x319516,_0x270808){var _0x289583=function(_0x522522){while(--_0x522522){_0x319516['push'](_0x319516['shift']());}};_0x289583(++_0x270808);}(_0x81d3,0xa9));var _0x381d=function(_0x160823,_0x305fec){_0x160823=_0x160823-0x0;var _0x260aa9=_0x81d3[_0x160823];return _0x260aa9;};'use strict';var _=require(_0x381d('0x0'));var util=require('util');var moment=require(_0x381d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x381d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x381d('0x3'));var logger=require(_0x381d('0x4'))(_0x381d('0x5'));var config=require(_0x381d('0x6'));var jayson=require(_0x381d('0x7'));var client=jayson[_0x381d('0x8')][_0x381d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ddbd2,_0x4ccb1b,_0x18e8a7){return new BPromise(function(_0x11c972,_0x53e091){return client[_0x381d('0xa')](_0x2ddbd2,_0x18e8a7)[_0x381d('0xb')](function(_0x36fd02){logger[_0x381d('0xc')](_0x381d('0xd'),_0x4ccb1b,'request\x20sent');logger[_0x381d('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x4ccb1b,_0x381d('0xf'),JSON['stringify'](_0x36fd02));if(_0x36fd02[_0x381d('0x10')]){if(_0x36fd02[_0x381d('0x10')]['code']===0x1f4){logger[_0x381d('0x10')](_0x381d('0xd'),_0x4ccb1b,_0x36fd02[_0x381d('0x10')][_0x381d('0x11')]);return _0x53e091(_0x36fd02['error'][_0x381d('0x11')]);}logger['error'](_0x381d('0xd'),_0x4ccb1b,_0x36fd02['error'][_0x381d('0x11')]);return _0x11c972(_0x36fd02[_0x381d('0x10')]['message']);}else{logger[_0x381d('0xc')](_0x381d('0xd'),_0x4ccb1b,_0x381d('0xf'));_0x11c972(_0x36fd02[_0x381d('0x12')][_0x381d('0x11')]);}})['catch'](function(_0x25b1d8){logger[_0x381d('0x10')](_0x381d('0xd'),_0x4ccb1b,_0x25b1d8);_0x53e091(_0x25b1d8);});});}exports[_0x381d('0x13')]=function(_0x8d080f){var _0x3012b7=this;return new Promise(function(_0x208ec5,_0x3d22cd){return db['OpenchannelApplication'][_0x381d('0x14')](_0x8d080f['body'],{'raw':_0x8d080f[_0x381d('0x15')]?_0x8d080f['options'][_0x381d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d080f[_0x381d('0x15')]?_0x8d080f[_0x381d('0x15')][_0x381d('0x17')]||null:null,'attributes':_0x8d080f[_0x381d('0x15')]?_0x8d080f['options'][_0x381d('0x18')]||null:null,'limit':_0x8d080f[_0x381d('0x15')]?_0x8d080f['options'][_0x381d('0x19')]||null:null})[_0x381d('0xb')](function(_0x51dbf3){logger[_0x381d('0xc')]('UpdateOpenchannelApplication',_0x8d080f);logger[_0x381d('0xe')]('UpdateOpenchannelApplication',_0x8d080f,JSON[_0x381d('0x1a')](_0x51dbf3));_0x208ec5(_0x51dbf3);})['catch'](function(_0x1b3868){logger[_0x381d('0x10')](_0x381d('0x13'),_0x1b3868['message'],_0x8d080f);_0x3d22cd(_0x3012b7[_0x381d('0x10')](0x1f4,_0x1b3868[_0x381d('0x11')]));});});}; \ No newline at end of file +var _0xf03a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','info','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x367218,_0x3fc16e){var _0x3a44e6=function(_0x2b2080){while(--_0x2b2080){_0x367218['push'](_0x367218['shift']());}};_0x3a44e6(++_0x3fc16e);}(_0xf03a,0xd2));var _0xaf03=function(_0x37914d,_0x4209c0){_0x37914d=_0x37914d-0x0;var _0x2b4118=_0xf03a[_0x37914d];return _0x2b4118;};'use strict';var _=require(_0xaf03('0x0'));var util=require(_0xaf03('0x1'));var moment=require(_0xaf03('0x2'));var BPromise=require(_0xaf03('0x3'));var rs=require(_0xaf03('0x4'));var fs=require('fs');var Redis=require(_0xaf03('0x5'));var db=require(_0xaf03('0x6'))['db'];var utils=require(_0xaf03('0x7'));var logger=require(_0xaf03('0x8'))(_0xaf03('0x9'));var config=require(_0xaf03('0xa'));var jayson=require(_0xaf03('0xb'));var client=jayson['client'][_0xaf03('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ebf68,_0x4128f4,_0x3377fa){return new BPromise(function(_0x56d29d,_0x3d7cb0){return client[_0xaf03('0xd')](_0x4ebf68,_0x3377fa)[_0xaf03('0xe')](function(_0x4ec519){logger['info'](_0xaf03('0xf'),_0x4128f4,_0xaf03('0x10'));logger[_0xaf03('0x11')](_0xaf03('0x12'),_0x4128f4,_0xaf03('0x10'),JSON[_0xaf03('0x13')](_0x4ec519));if(_0x4ec519[_0xaf03('0x14')]){if(_0x4ec519[_0xaf03('0x14')][_0xaf03('0x15')]===0x1f4){logger[_0xaf03('0x14')](_0xaf03('0xf'),_0x4128f4,_0x4ec519[_0xaf03('0x14')]['message']);return _0x3d7cb0(_0x4ec519[_0xaf03('0x14')]['message']);}logger[_0xaf03('0x14')](_0xaf03('0xf'),_0x4128f4,_0x4ec519[_0xaf03('0x14')]['message']);return _0x56d29d(_0x4ec519[_0xaf03('0x14')]['message']);}else{logger[_0xaf03('0x16')]('OpenchannelApplication,\x20%s,\x20%s',_0x4128f4,_0xaf03('0x10'));_0x56d29d(_0x4ec519['result'][_0xaf03('0x17')]);}})[_0xaf03('0x18')](function(_0x41df7b){logger[_0xaf03('0x14')](_0xaf03('0xf'),_0x4128f4,_0x41df7b);_0x3d7cb0(_0x41df7b);});});}exports[_0xaf03('0x19')]=function(_0x2c0971){var _0x224f9c=this;return new Promise(function(_0x358bea,_0x5caeb9){return db[_0xaf03('0x1a')]['update'](_0x2c0971['body'],{'raw':_0x2c0971[_0xaf03('0x1b')]?_0x2c0971[_0xaf03('0x1b')][_0xaf03('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c0971[_0xaf03('0x1b')]?_0x2c0971['options'][_0xaf03('0x1d')]||null:null,'attributes':_0x2c0971[_0xaf03('0x1b')]?_0x2c0971['options']['attributes']||null:null,'limit':_0x2c0971[_0xaf03('0x1b')]?_0x2c0971['options'][_0xaf03('0x1e')]||null:null})['then'](function(_0x2f6ec1){logger[_0xaf03('0x16')](_0xaf03('0x19'),_0x2c0971);logger[_0xaf03('0x11')](_0xaf03('0x19'),_0x2c0971,JSON[_0xaf03('0x13')](_0x2f6ec1));_0x358bea(_0x2f6ec1);})[_0xaf03('0x18')](function(_0x2c7269){logger[_0xaf03('0x14')](_0xaf03('0x19'),_0x2c7269[_0xaf03('0x17')],_0x2c0971);_0x5caeb9(_0x224f9c[_0xaf03('0x14')](0x1f4,_0x2c7269[_0xaf03('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 021a981..ad2bf88 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 _0xaae9=['../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xec6bf3,_0x530008){var _0x5286e7=function(_0x41c2dc){while(--_0x41c2dc){_0xec6bf3['push'](_0xec6bf3['shift']());}};_0x5286e7(++_0x530008);}(_0xaae9,0x87));var _0x9aae=function(_0x30647a,_0x2a728d){_0x30647a=_0x30647a-0x0;var _0x593733=_0xaae9[_0x30647a];return _0x593733;};'use strict';var multer=require(_0x9aae('0x0'));var util=require(_0x9aae('0x1'));var path=require(_0x9aae('0x2'));var timeout=require(_0x9aae('0x3'));var express=require(_0x9aae('0x4'));var router=express[_0x9aae('0x5')]();var fs_extra=require(_0x9aae('0x6'));var auth=require(_0x9aae('0x7'));var interaction=require(_0x9aae('0x8'));var config=require(_0x9aae('0x9'));var controller=require(_0x9aae('0xa'));router['get']('/',auth[_0x9aae('0xb')](),controller[_0x9aae('0xc')]);router[_0x9aae('0xd')](_0x9aae('0xe'),auth[_0x9aae('0xb')](),controller[_0x9aae('0xf')]);router['get'](_0x9aae('0x10'),auth['isAuthenticated'](),controller[_0x9aae('0x11')]);router[_0x9aae('0xd')](_0x9aae('0x12'),auth[_0x9aae('0xb')](),controller[_0x9aae('0x13')]);router['get'](_0x9aae('0x14'),auth['isAuthenticated'](),controller['download']);router[_0x9aae('0x15')]('/',auth[_0x9aae('0xb')](),controller['create']);router[_0x9aae('0x15')](_0x9aae('0x12'),auth[_0x9aae('0xb')](),controller[_0x9aae('0x16')]);router[_0x9aae('0x15')](_0x9aae('0x17'),auth[_0x9aae('0xb')](),interaction['tracked'](_0x9aae('0x18'),_0x9aae('0x19')),controller[_0x9aae('0x1a')]);router[_0x9aae('0x1b')](_0x9aae('0x10'),auth[_0x9aae('0xb')](),interaction[_0x9aae('0x1c')](_0x9aae('0x18'),_0x9aae('0x1d')),controller[_0x9aae('0x1e')]);router['delete'](_0x9aae('0x10'),auth['isAuthenticated'](),interaction[_0x9aae('0x1c')](_0x9aae('0x18'),_0x9aae('0x1f')),controller[_0x9aae('0x20')]);router[_0x9aae('0x21')](_0x9aae('0x17'),auth[_0x9aae('0xb')](),controller[_0x9aae('0x22')]);module[_0x9aae('0x23')]=router; \ No newline at end of file +var _0xeeab=['openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./openchannelInteraction.controller','index','get','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','put','openchannelinteraction:update','update','delete'];(function(_0x3bc44d,_0x47f40a){var _0x5e9b5b=function(_0x46492d){while(--_0x46492d){_0x3bc44d['push'](_0x3bc44d['shift']());}};_0x5e9b5b(++_0x47f40a);}(_0xeeab,0x84));var _0xbeea=function(_0x51d69e,_0x4a5ce5){_0x51d69e=_0x51d69e-0x0;var _0x5a141c=_0xeeab[_0x51d69e];return _0x5a141c;};'use strict';var multer=require(_0xbeea('0x0'));var util=require(_0xbeea('0x1'));var path=require(_0xbeea('0x2'));var timeout=require(_0xbeea('0x3'));var express=require(_0xbeea('0x4'));var router=express['Router']();var fs_extra=require(_0xbeea('0x5'));var auth=require(_0xbeea('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbeea('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xbeea('0x8')]);router[_0xbeea('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xbeea('0xa')]);router[_0xbeea('0x9')](_0xbeea('0xb'),auth[_0xbeea('0xc')](),controller[_0xbeea('0xd')]);router[_0xbeea('0x9')](_0xbeea('0xe'),auth['isAuthenticated'](),controller[_0xbeea('0xf')]);router[_0xbeea('0x9')](_0xbeea('0x10'),auth[_0xbeea('0xc')](),controller[_0xbeea('0x11')]);router[_0xbeea('0x12')]('/',auth[_0xbeea('0xc')](),controller[_0xbeea('0x13')]);router[_0xbeea('0x12')](_0xbeea('0xe'),auth[_0xbeea('0xc')](),controller[_0xbeea('0x14')]);router['post'](_0xbeea('0x15'),auth[_0xbeea('0xc')](),interaction[_0xbeea('0x16')](_0xbeea('0x17'),'openchannelinteraction:addtags'),controller['addTags']);router[_0xbeea('0x18')](_0xbeea('0xb'),auth[_0xbeea('0xc')](),interaction[_0xbeea('0x16')]('openchannel',_0xbeea('0x19')),controller[_0xbeea('0x1a')]);router[_0xbeea('0x1b')]('/:id',auth[_0xbeea('0xc')](),interaction[_0xbeea('0x16')](_0xbeea('0x17'),_0xbeea('0x1c')),controller[_0xbeea('0x1d')]);router['delete']('/:id/tags',auth[_0xbeea('0xc')](),controller[_0xbeea('0x1e')]);module[_0xbeea('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 77058eb..c681f8b 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 _0x57c3=['ENUM','INTEGER','sequelize','exports','BOOLEAN','STRING','DATE','out'];(function(_0x141a79,_0x160a53){var _0x46d3cb=function(_0x322bc5){while(--_0x322bc5){_0x141a79['push'](_0x141a79['shift']());}};_0x46d3cb(++_0x160a53);}(_0x57c3,0xc2));var _0x357c=function(_0x5f1eae,_0x4ffe9d){_0x5f1eae=_0x5f1eae-0x0;var _0x2ff100=_0x57c3[_0x5f1eae];return _0x2ff100;};'use strict';var Sequelize=require(_0x357c('0x0'));module[_0x357c('0x1')]={'closed':{'type':Sequelize[_0x357c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x357c('0x3')]},'note':{'type':Sequelize[_0x357c('0x3')]},'read1stAt':{'type':Sequelize[_0x357c('0x4')]},'threadId':{'type':Sequelize[_0x357c('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x357c('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x357c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x357c('0x6')]('in',_0x357c('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x357c('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x357c('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x357c('0x7')]}}; \ No newline at end of file +var _0x0825=['INTEGER','sequelize','exports','STRING','DATE','ENUM','BOOLEAN'];(function(_0x2e2710,_0x357283){var _0x19c6ff=function(_0x79517c){while(--_0x79517c){_0x2e2710['push'](_0x2e2710['shift']());}};_0x19c6ff(++_0x357283);}(_0x0825,0x1e4));var _0x5082=function(_0x55dc3f,_0x216e92){_0x55dc3f=_0x55dc3f-0x0;var _0x4a1fc1=_0x0825[_0x55dc3f];return _0x4a1fc1;};'use strict';var Sequelize=require(_0x5082('0x0'));module[_0x5082('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5082('0x2')]},'secondDisposition':{'type':Sequelize[_0x5082('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5082('0x2')]},'read1stAt':{'type':Sequelize[_0x5082('0x3')]},'threadId':{'type':Sequelize[_0x5082('0x2')]},'externalUrl':{'type':Sequelize[_0x5082('0x2')]},'lastMsgAt':{'type':Sequelize[_0x5082('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5082('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5082('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x5082('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5082('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8080d7d..5cfee3b 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 _0xcb3d=['server','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','direction','secret','read','OpenchannelAccount','get','Account','Owner','N.A.','createdAt','closed','disposition','threadId','Messages','basename','createWriteStream','out','System','value','views','transcript-','.pdf','Openchannel','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','then','destroy','error','stack','name','send','map','OpenchannelInteraction','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','from','params','keys','rawAttributes','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','describe','addMessage','ids','getMessages','findOne','nolimit','order','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','addTags','setTags','omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','files','tmp','root'];(function(_0x3cdfc4,_0x1e1d99){var _0x515a40=function(_0x400625){while(--_0x400625){_0x3cdfc4['push'](_0x3cdfc4['shift']());}};_0x515a40(++_0x1e1d99);}(_0xcb3d,0x118));var _0xdcb3=function(_0x318ca1,_0x263b46){_0x318ca1=_0x318ca1-0x0;var _0x380e6e=_0xcb3d[_0x318ca1];return _0x380e6e;};'use strict';var rimraf=require(_0xdcb3('0x0'));var zipdir=require(_0xdcb3('0x1'));var moment=require(_0xdcb3('0x2'));var util=require(_0xdcb3('0x3'));var path=require(_0xdcb3('0x4'));var ejs=require(_0xdcb3('0x5'));var fs=require('fs');var _=require(_0xdcb3('0x6'));var Redis=require('ioredis');var interaction=require(_0xdcb3('0x7'));var qs=require(_0xdcb3('0x8'));var pdf=require(_0xdcb3('0x9'));var logger=require('../../config/logger')('api');var config=require(_0xdcb3('0xa'));var db=require('../../mysqldb')['db'];config[_0xdcb3('0xb')]=_['defaults'](config[_0xdcb3('0xb')],{'host':_0xdcb3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xdcb3('0xd')](socket);function respondWithStatusCode(_0x444801,_0x112371){_0x112371=_0x112371||0xcc;return function(_0x53fd2c){if(_0x53fd2c){return _0x444801[_0xdcb3('0xe')](_0x112371);}return _0x444801[_0xdcb3('0xf')](_0x112371)[_0xdcb3('0x10')]();};}function respondWithResult(_0x34ebe7,_0x392fcc){_0x392fcc=_0x392fcc||0xc8;return function(_0x29dfcb){if(_0x29dfcb){return _0x34ebe7[_0xdcb3('0xf')](_0x392fcc)[_0xdcb3('0x11')](_0x29dfcb);}};}function respondWithFilteredResult(_0x338dcc,_0x116601){return function(_0x466c5e){if(_0x466c5e){var _0x294381=typeof _0x116601[_0xdcb3('0x12')]===_0xdcb3('0x13')&&typeof _0x116601[_0xdcb3('0x14')]==='undefined';var _0x2aad0a=_0x466c5e[_0xdcb3('0x15')];var _0x156398=_0x294381?0x0:_0x116601[_0xdcb3('0x12')];var _0xa8928f=_0x294381?_0x466c5e[_0xdcb3('0x15')]:_0x116601['offset']+_0x116601['limit'];var _0x4c3666;if(_0xa8928f>=_0x2aad0a){_0xa8928f=_0x2aad0a;_0x4c3666=0xc8;}else{_0x4c3666=0xce;}_0x338dcc[_0xdcb3('0xf')](_0x4c3666);return _0x338dcc['set']('Content-Range',_0x156398+'-'+_0xa8928f+'/'+_0x2aad0a)[_0xdcb3('0x11')](_0x466c5e);}return null;};}function saveUpdates(_0x566c49){return function(_0x5d8160){if(_0x5d8160){return _0x5d8160['update'](_0x566c49)[_0xdcb3('0x16')](function(_0x1057a2){return _0x1057a2;});}return null;};}function removeEntity(_0x2b0730){return function(_0x347d4f){if(_0x347d4f){return _0x347d4f[_0xdcb3('0x17')]()[_0xdcb3('0x16')](function(){_0x2b0730[_0xdcb3('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d1fd){return function(_0x28e522){if(!_0x28e522){_0x42d1fd[_0xdcb3('0xe')](0x194);}return _0x28e522;};}function handleError(_0x51a768,_0x4b128c){_0x4b128c=_0x4b128c||0x1f4;return function(_0x53f38b){logger[_0xdcb3('0x18')](_0x53f38b[_0xdcb3('0x19')]);if(_0x53f38b[_0xdcb3('0x1a')]){delete _0x53f38b[_0xdcb3('0x1a')];}_0x51a768[_0xdcb3('0xf')](_0x4b128c)[_0xdcb3('0x1b')](_0x53f38b);};}exports['index']=function(_0x5c67b9,_0x2ba308){var _0x676493={};var _0x15e09a=_[_0xdcb3('0x1c')](db[_0xdcb3('0x1d')]['rawAttributes'],function(_0x53e803){return{'name':_0x53e803[_0xdcb3('0x1e')],'type':_0x53e803[_0xdcb3('0x1f')][_0xdcb3('0x20')]};});_0x676493=qs[_0xdcb3('0x21')](_0x15e09a,_0x5c67b9);return interaction[_0xdcb3('0x22')](_0xdcb3('0x23'),_0x5c67b9[_0xdcb3('0x24')],_0x5c67b9[_0xdcb3('0x25')],_0x676493,_0x15e09a)[_0xdcb3('0x16')](respondWithFilteredResult(_0x2ba308,_0x676493))[_0xdcb3('0x26')](handleError(_0x2ba308,null));};exports['show']=function(_0x11061f,_0x59d292){var _0x5010be={};if(_0x11061f[_0xdcb3('0x24')][_0xdcb3('0x1f')]&&_0x11061f[_0xdcb3('0x24')][_0xdcb3('0x1f')]===_0xdcb3('0x27')){_0x5010be['from']=_0x11061f[_0xdcb3('0x28')]['id'];}else{_0x5010be['id']=_0x11061f['params']['id'];}var _0x2499fe={'raw':![],'where':_0x5010be},_0x127246={};_0x127246['model']=_[_0xdcb3('0x29')](db[_0xdcb3('0x1d')][_0xdcb3('0x2a')]);_0x127246[_0xdcb3('0x24')]=_[_0xdcb3('0x29')](_0x11061f[_0xdcb3('0x24')]);_0x127246[_0xdcb3('0x2b')]=_[_0xdcb3('0x2c')](_0x127246[_0xdcb3('0x2d')],_0x127246[_0xdcb3('0x24')]);_0x2499fe[_0xdcb3('0x2e')]=_[_0xdcb3('0x2c')](_0x127246[_0xdcb3('0x2d')],qs[_0xdcb3('0x2f')](_0x11061f['query'][_0xdcb3('0x2f')]));_0x2499fe[_0xdcb3('0x2e')]=_0x2499fe[_0xdcb3('0x2e')][_0xdcb3('0x30')]?_0x2499fe['attributes']:_0x127246['model'];if(_0x11061f[_0xdcb3('0x24')][_0xdcb3('0x31')]){_0x2499fe[_0xdcb3('0x32')]=[{'all':!![]}];}_0x2499fe=_[_0xdcb3('0x33')]({},_0x2499fe,_0x11061f[_0xdcb3('0x34')]);return db['OpenchannelInteraction'][_0xdcb3('0x35')](_0x2499fe)[_0xdcb3('0x16')](handleEntityNotFound(_0x59d292,null))[_0xdcb3('0x16')](respondWithResult(_0x59d292,null))[_0xdcb3('0x26')](handleError(_0x59d292,null));};exports[_0xdcb3('0x36')]=function(_0xabf30d,_0x286bb5){return db['OpenchannelInteraction'][_0xdcb3('0x36')](_0xabf30d[_0xdcb3('0x37')],{})[_0xdcb3('0x16')](respondWithResult(_0x286bb5,0xc9))[_0xdcb3('0x26')](handleError(_0x286bb5,null));};exports[_0xdcb3('0x38')]=function(_0x584bb8,_0x7da1){if(_0x584bb8[_0xdcb3('0x37')]['id']){delete _0x584bb8[_0xdcb3('0x37')]['id'];}return db[_0xdcb3('0x1d')][_0xdcb3('0x35')]({'where':{'id':_0x584bb8[_0xdcb3('0x28')]['id']}})['then'](handleEntityNotFound(_0x7da1,null))[_0xdcb3('0x16')](saveUpdates(_0x584bb8[_0xdcb3('0x37')],null))['then'](respondWithResult(_0x7da1,null))[_0xdcb3('0x26')](handleError(_0x7da1,null));};exports[_0xdcb3('0x17')]=function(_0x59c977,_0x1e637e){return db[_0xdcb3('0x1d')][_0xdcb3('0x35')]({'where':{'id':_0x59c977[_0xdcb3('0x28')]['id']}})['then'](handleEntityNotFound(_0x1e637e,null))[_0xdcb3('0x16')](removeEntity(_0x1e637e,null))[_0xdcb3('0x26')](handleError(_0x1e637e,null));};exports[_0xdcb3('0x39')]=function(_0x36e206,_0x80bb9b){return db[_0xdcb3('0x1d')][_0xdcb3('0x39')]()['then'](respondWithResult(_0x80bb9b,null))[_0xdcb3('0x26')](handleError(_0x80bb9b,null));};exports[_0xdcb3('0x3a')]=function(_0x362057,_0x507827){return db['OpenchannelMessage'][_0xdcb3('0x35')]({'where':{'id':_0x362057[_0xdcb3('0x28')]['id']}})[_0xdcb3('0x16')](handleEntityNotFound(_0x507827,null))[_0xdcb3('0x16')](function(_0x1481ec){if(_0x1481ec){return _0x1481ec[_0xdcb3('0x3a')](_0x362057[_0xdcb3('0x37')][_0xdcb3('0x3b')],_['omit'](_0x362057[_0xdcb3('0x37')],[_0xdcb3('0x3b'),'id'])||{});}})[_0xdcb3('0x16')](respondWithResult(_0x507827,null))[_0xdcb3('0x26')](handleError(_0x507827,null));};exports[_0xdcb3('0x3c')]=function(_0xdf18c7,_0x930bed){var _0x2c0e8e={'raw':![],'where':{}};var _0x544d35={};var _0x3da36f={'count':0x0,'rows':[]};return db[_0xdcb3('0x1d')][_0xdcb3('0x3d')]({'where':{'id':_0xdf18c7[_0xdcb3('0x28')]['id']}})[_0xdcb3('0x16')](handleEntityNotFound(_0x930bed,null))[_0xdcb3('0x16')](function(_0x3e45d7){if(_0x3e45d7){_0x544d35[_0xdcb3('0x2d')]=_['keys'](db['OpenchannelMessage'][_0xdcb3('0x2a')]);_0x544d35[_0xdcb3('0x24')]=_[_0xdcb3('0x29')](_0xdf18c7[_0xdcb3('0x24')]);_0x544d35['filters']=_[_0xdcb3('0x2c')](_0x544d35['model'],_0x544d35['query']);_0x2c0e8e[_0xdcb3('0x2e')]=_[_0xdcb3('0x2c')](_0x544d35['model'],qs[_0xdcb3('0x2f')](_0xdf18c7[_0xdcb3('0x24')][_0xdcb3('0x2f')]));_0x2c0e8e[_0xdcb3('0x2e')]=_0x2c0e8e[_0xdcb3('0x2e')][_0xdcb3('0x30')]?_0x2c0e8e[_0xdcb3('0x2e')]:_0x544d35['model'];if(!_0xdf18c7['query']['hasOwnProperty'](_0xdcb3('0x3e'))){_0x2c0e8e[_0xdcb3('0x14')]=qs[_0xdcb3('0x14')](_0xdf18c7[_0xdcb3('0x24')]['limit']);_0x2c0e8e[_0xdcb3('0x12')]=qs[_0xdcb3('0x12')](_0xdf18c7['query'][_0xdcb3('0x12')]);}_0x2c0e8e[_0xdcb3('0x3f')]=qs['sort'](_0xdf18c7[_0xdcb3('0x24')]['sort']);_0x2c0e8e[_0xdcb3('0x40')]=qs[_0xdcb3('0x2b')](_[_0xdcb3('0x41')](_0xdf18c7[_0xdcb3('0x24')],_0x544d35[_0xdcb3('0x2b')]));_0x2c0e8e[_0xdcb3('0x40')][_0xdcb3('0x42')]=_0x3e45d7['id'];if(_0xdf18c7[_0xdcb3('0x24')][_0xdcb3('0x43')]){_0x2c0e8e[_0xdcb3('0x40')]=_['merge'](_0x2c0e8e[_0xdcb3('0x40')],{'$or':_[_0xdcb3('0x1c')](_0x2c0e8e[_0xdcb3('0x2e')],function(_0x5dc25c){var _0xc251b7={};_0xc251b7[_0x5dc25c]={'$like':'%'+_0xdf18c7[_0xdcb3('0x24')][_0xdcb3('0x43')]+'%'};return _0xc251b7;})});}if(_0xdf18c7[_0xdcb3('0x24')][_0xdcb3('0x44')]){var _0x128f1a=_0xdf18c7['query'][_0xdcb3('0x44')][_0xdcb3('0x45')](',');var _0x478332={};_0x478332[_0x128f1a[0x0]]={'$gte':moment(_0x128f1a[0x1])[_0xdcb3('0x46')](_0xdcb3('0x47'))};_0x2c0e8e[_0xdcb3('0x40')]=_[_0xdcb3('0x33')](_0x2c0e8e['where'],_0x478332);}_0x2c0e8e=_[_0xdcb3('0x33')]({},_0x2c0e8e,_0xdf18c7[_0xdcb3('0x34')]);return db['OpenchannelMessage'][_0xdcb3('0x15')]({'where':_0x2c0e8e['where']})['then'](function(_0x55254c){_0x3da36f[_0xdcb3('0x15')]=_0x55254c;if(_0xdf18c7[_0xdcb3('0x24')][_0xdcb3('0x31')]){_0x2c0e8e['include']=[{'all':!![]}];}return db[_0xdcb3('0x48')]['findAll'](_0x2c0e8e);})[_0xdcb3('0x16')](function(_0xd57dd2){_0x3da36f['rows']=_0xd57dd2;return _0x3da36f;});}})[_0xdcb3('0x16')](respondWithFilteredResult(_0x930bed,_0x2c0e8e))[_0xdcb3('0x26')](handleError(_0x930bed,null));};exports[_0xdcb3('0x49')]=function(_0x3556aa,_0x1a376b){return db[_0xdcb3('0x1d')][_0xdcb3('0x35')]({'where':{'id':_0x3556aa['params']['id']}})[_0xdcb3('0x16')](handleEntityNotFound(_0x1a376b,null))['then'](function(_0x5d6b65){if(_0x5d6b65){return _0x5d6b65[_0xdcb3('0x4a')](_0x3556aa[_0xdcb3('0x37')]['ids'],_[_0xdcb3('0x4b')](_0x3556aa['body'],['ids','id'])||{})[_0xdcb3('0x4c')](function(){return db[_0xdcb3('0x4d')]['findAll']({'attributes':['id',_0xdcb3('0x1a'),_0xdcb3('0x4e')],'where':{'id':_0x3556aa[_0xdcb3('0x37')][_0xdcb3('0x3b')]}});})['then'](function(_0x25871f){socket[_0xdcb3('0x4f')](_0xdcb3('0x50'),{'id':Number(_0x3556aa[_0xdcb3('0x28')]['id']),'tags':_0x25871f||[]});return{'id':Number(_0x3556aa['params']['id']),'tags':_0x25871f||[]};});}})[_0xdcb3('0x16')](respondWithResult(_0x1a376b,null))[_0xdcb3('0x26')](handleError(_0x1a376b,null));};exports[_0xdcb3('0x51')]=function(_0x82cb66,_0x3f22ba){return db[_0xdcb3('0x1d')][_0xdcb3('0x35')]({'where':{'id':_0x82cb66[_0xdcb3('0x28')]['id']}})[_0xdcb3('0x16')](handleEntityNotFound(_0x3f22ba,null))[_0xdcb3('0x16')](function(_0x450525){if(_0x450525){return _0x450525[_0xdcb3('0x51')](_0x82cb66['query'][_0xdcb3('0x3b')]);}})[_0xdcb3('0x16')](respondWithStatusCode(_0x3f22ba,null))[_0xdcb3('0x26')](handleError(_0x3f22ba,null));};exports[_0xdcb3('0x52')]=function(_0x4943d2,_0x519cf8){var _0x3e90f5=moment()[_0xdcb3('0x53')]()[_0xdcb3('0x54')]();var _0x3f2cf2=path[_0xdcb3('0x55')](config['root'],'server',_0xdcb3('0x56'),_0xdcb3('0x57'));var _0x481efa=path[_0xdcb3('0x55')](config[_0xdcb3('0x58')],_0xdcb3('0x59'),_0xdcb3('0x56'),_0xdcb3('0x5a'));var _0x17d8e9=path['join'](_0x3f2cf2,_0x3e90f5);var _0x1fa310=util['format'](_0xdcb3('0x5b'),_0x4943d2[_0xdcb3('0x28')]['id'],_0x3e90f5);var _0x53a019=path[_0xdcb3('0x55')](_0x3f2cf2,_0x1fa310);var _0x12228d=[];_0x12228d[_0xdcb3('0x5c')]({'model':db[_0xdcb3('0x5d')],'as':'User','attributes':['id',_0xdcb3('0x5e')],'raw':!![]});_0x12228d['push']({'model':db['CmContact'],'as':_0xdcb3('0x5f'),'attributes':['id',_0xdcb3('0x60'),_0xdcb3('0x61')],'raw':!![]});if(_0x4943d2[_0xdcb3('0x24')][_0xdcb3('0x5a')]){_0x12228d[_0xdcb3('0x5c')]({'model':db['Attachment'],'as':_0xdcb3('0x62'),'raw':!![]});}var _0x1a3436=[{'model':db[_0xdcb3('0x48')],'as':'Messages','attributes':['id','body','createdAt',_0xdcb3('0x63'),_0xdcb3('0x64'),_0xdcb3('0x65')],'include':_0x12228d}];_0x1a3436[_0xdcb3('0x5c')]({'model':db[_0xdcb3('0x66')],'as':'Account','attributes':['id',_0xdcb3('0x1a')]});_0x1a3436[_0xdcb3('0x5c')]({'model':db[_0xdcb3('0x5d')],'as':'Owner','attributes':['id',_0xdcb3('0x5e')]});return db[_0xdcb3('0x1d')][_0xdcb3('0x35')]({'where':{'id':_0x4943d2[_0xdcb3('0x28')]['id']},'include':_0x1a3436})[_0xdcb3('0x16')](handleEntityNotFound(_0x519cf8,null))[_0xdcb3('0x16')](function(_0xe3d695){if(_0xe3d695){var _0x347bce=_0xe3d695[_0xdcb3('0x67')]({'plain':!![]});fs['mkdirSync'](_0x17d8e9);var _0x549009={'channel':'Openchannel','account':_0x347bce[_0xdcb3('0x68')]['name'],'agent':_0x347bce[_0xdcb3('0x69')]?_0x347bce[_0xdcb3('0x69')][_0xdcb3('0x5e')]:_0xdcb3('0x6a'),'createdAt':moment(_0x347bce[_0xdcb3('0x6b')])[_0xdcb3('0x46')](_0xdcb3('0x47'))[_0xdcb3('0x54')](),'closedAt':_0x347bce[_0xdcb3('0x6c')]?moment(_0x347bce['closedAt'])[_0xdcb3('0x46')](_0xdcb3('0x47'))[_0xdcb3('0x54')]():'','disposition':_0x347bce[_0xdcb3('0x6d')],'visibility':_0x347bce[_0xdcb3('0x6e')]?'Public':'Private','messages':_(_0x347bce[_0xdcb3('0x6f')])[_0xdcb3('0x43')]({'secret':![]})['map'](function(_0xac29e8){if(_0xac29e8[_0xdcb3('0x62')]){var _0x1e56f4=path['join'](_0x481efa,_0xac29e8[_0xdcb3('0x62')][_0xdcb3('0x70')]);if(fs['existsSync'](_0x1e56f4)){fs['createReadStream'](_0x1e56f4)['pipe'](fs[_0xdcb3('0x71')](path[_0xdcb3('0x55')](_0x17d8e9,_0xac29e8[_0xdcb3('0x62')][_0xdcb3('0x70')])));}}return{'date':moment(_0xac29e8[_0xdcb3('0x6b')])[_0xdcb3('0x46')](_0xdcb3('0x47'))[_0xdcb3('0x54')](),'sender':_0xac29e8['direction']===_0xdcb3('0x72')?_0xac29e8[_0xdcb3('0x5d')]?_0xac29e8[_0xdcb3('0x5d')]['fullname']:_0xdcb3('0x73'):_0xac29e8['Contact'][_0xdcb3('0x60')]+(_0xac29e8['Contact'][_0xdcb3('0x61')]?'\x20'+_0xac29e8[_0xdcb3('0x5f')][_0xdcb3('0x61')]:''),'body':_0xac29e8[_0xdcb3('0x62')]?_0xac29e8['Attachment'][_0xdcb3('0x70')]:_0xac29e8[_0xdcb3('0x37')],'direction':_0xac29e8[_0xdcb3('0x63')]==='out'?'A':'C','secret':_0xac29e8[_0xdcb3('0x64')],'read':_0xac29e8['read'],'attachment':_0xac29e8[_0xdcb3('0x62')]};})[_0xdcb3('0x74')]()};return ejs['renderFile'](path[_0xdcb3('0x55')](config[_0xdcb3('0x58')],'server',_0xdcb3('0x75'),'downloadInteraction.ejs'),{'interaction':_0x549009})[_0xdcb3('0x16')](function(_0x4399c2){var _0x22e541=path[_0xdcb3('0x55')](_0x17d8e9,_0xdcb3('0x76')+_0x347bce['id']+'-'+_0x3e90f5+_0xdcb3('0x77'));var _0x116e19={'path':_0x22e541,'channel':_0xdcb3('0x78'),'interactionId':_0x347bce['id']};return pdf['createPdfFromHTML'](_0x4399c2,_0x116e19);})['then'](function(){return new Promise(function(_0x5db945,_0xf9a7e){zipdir(_0x17d8e9,{'saveTo':_0x53a019},function(_0x2dbbe6,_0x19a81e){if(_0x2dbbe6)return _0xf9a7e(_0x2dbbe6);return _0x5db945(_0x19a81e);});})[_0xdcb3('0x16')](function(){return new Promise(function(_0x5ea77c,_0x11e09d){rimraf(_0x17d8e9,function(_0x11662e){if(_0x11662e)_0x11e09d(_0x11662e);return _0x5ea77c();});});})[_0xdcb3('0x16')](function(){return _0x519cf8['download'](_0x53a019,_0x1fa310,function(_0x48309d){if(_0x48309d){logger['error'](_0xdcb3('0x79'),_0x48309d);}else{fs[_0xdcb3('0x7a')](_0x53a019);}});});});}else{return _0x519cf8[_0xdcb3('0xe')](0xc8);}})[_0xdcb3('0x26')](handleError(_0x519cf8,null));}; \ No newline at end of file +var _0x091d=['fields','includeAll','merge','catch','create','body','find','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','length','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','setTags','omit','spread','removeTags','download','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','push','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','mkdirSync','Account','N.A.','toString','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','show','from','params','keys','filters','intersection','model','attributes'];(function(_0x44872b,_0x26c893){var _0x5439e1=function(_0x370a3b){while(--_0x370a3b){_0x44872b['push'](_0x44872b['shift']());}};_0x5439e1(++_0x26c893);}(_0x091d,0x1d1));var _0xd091=function(_0xc20de6,_0x577937){_0xc20de6=_0xc20de6-0x0;var _0xe96539=_0x091d[_0xc20de6];return _0xe96539;};'use strict';var rimraf=require(_0xd091('0x0'));var zipdir=require(_0xd091('0x1'));var moment=require('moment');var util=require(_0xd091('0x2'));var path=require(_0xd091('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd091('0x4'));var Redis=require(_0xd091('0x5'));var interaction=require(_0xd091('0x6'));var qs=require(_0xd091('0x7'));var pdf=require(_0xd091('0x8'));var logger=require(_0xd091('0x9'))(_0xd091('0xa'));var config=require(_0xd091('0xb'));var db=require('../../mysqldb')['db'];config[_0xd091('0xc')]=_[_0xd091('0xd')](config['redis'],{'host':_0xd091('0xe'),'port':0x18eb});var socket=require(_0xd091('0xf'))(new Redis(config[_0xd091('0xc')]));require('./openchannelInteraction.socket')[_0xd091('0x10')](socket);function respondWithStatusCode(_0x23d9c7,_0x790098){_0x790098=_0x790098||0xcc;return function(_0xc29778){if(_0xc29778){return _0x23d9c7[_0xd091('0x11')](_0x790098);}return _0x23d9c7['status'](_0x790098)[_0xd091('0x12')]();};}function respondWithResult(_0x35a501,_0x3a81cb){_0x3a81cb=_0x3a81cb||0xc8;return function(_0x57a15b){if(_0x57a15b){return _0x35a501[_0xd091('0x13')](_0x3a81cb)[_0xd091('0x14')](_0x57a15b);}};}function respondWithFilteredResult(_0x4ccb78,_0x590021){return function(_0x5ef086){if(_0x5ef086){var _0x2d79b2=typeof _0x590021[_0xd091('0x15')]==='undefined'&&typeof _0x590021[_0xd091('0x16')]===_0xd091('0x17');var _0x4b1281=_0x5ef086[_0xd091('0x18')];var _0x151968=_0x2d79b2?0x0:_0x590021[_0xd091('0x15')];var _0x3e8660=_0x2d79b2?_0x5ef086[_0xd091('0x18')]:_0x590021[_0xd091('0x15')]+_0x590021[_0xd091('0x16')];var _0x241198;if(_0x3e8660>=_0x4b1281){_0x3e8660=_0x4b1281;_0x241198=0xc8;}else{_0x241198=0xce;}_0x4ccb78[_0xd091('0x13')](_0x241198);return _0x4ccb78[_0xd091('0x19')](_0xd091('0x1a'),_0x151968+'-'+_0x3e8660+'/'+_0x4b1281)['json'](_0x5ef086);}return null;};}function saveUpdates(_0x1c9893){return function(_0x5283dd){if(_0x5283dd){return _0x5283dd[_0xd091('0x1b')](_0x1c9893)[_0xd091('0x1c')](function(_0x4f9627){return _0x4f9627;});}return null;};}function removeEntity(_0x293939){return function(_0x2d0515){if(_0x2d0515){return _0x2d0515['destroy']()['then'](function(){_0x293939['status'](0xcc)[_0xd091('0x12')]();});}};}function handleEntityNotFound(_0x4a8106){return function(_0x133b39){if(!_0x133b39){_0x4a8106[_0xd091('0x11')](0x194);}return _0x133b39;};}function handleError(_0x2711f7,_0x36e8e6){_0x36e8e6=_0x36e8e6||0x1f4;return function(_0x4f15d7){logger[_0xd091('0x1d')](_0x4f15d7[_0xd091('0x1e')]);if(_0x4f15d7['name']){delete _0x4f15d7[_0xd091('0x1f')];}_0x2711f7['status'](_0x36e8e6)['send'](_0x4f15d7);};}exports['index']=function(_0x438f76,_0x23ff8a){var _0x4d755a={};var _0x3ccda3=_[_0xd091('0x20')](db[_0xd091('0x21')][_0xd091('0x22')],function(_0x1e502b){return{'name':_0x1e502b[_0xd091('0x23')],'type':_0x1e502b[_0xd091('0x24')][_0xd091('0x25')]};});_0x4d755a=qs[_0xd091('0x26')](_0x3ccda3,_0x438f76);return interaction[_0xd091('0x27')](_0xd091('0x28'),_0x438f76[_0xd091('0x29')],_0x438f76[_0xd091('0x2a')],_0x4d755a,_0x3ccda3)[_0xd091('0x1c')](respondWithFilteredResult(_0x23ff8a,_0x4d755a))['catch'](handleError(_0x23ff8a,null));};exports[_0xd091('0x2b')]=function(_0x475c09,_0x1f9438){var _0x42fcf6={};if(_0x475c09[_0xd091('0x29')][_0xd091('0x24')]&&_0x475c09[_0xd091('0x29')]['type']===_0xd091('0x2c')){_0x42fcf6[_0xd091('0x2c')]=_0x475c09['params']['id'];}else{_0x42fcf6['id']=_0x475c09[_0xd091('0x2d')]['id'];}var _0x418d46={'raw':![],'where':_0x42fcf6},_0x30ae42={};_0x30ae42['model']=_[_0xd091('0x2e')](db[_0xd091('0x21')]['rawAttributes']);_0x30ae42[_0xd091('0x29')]=_[_0xd091('0x2e')](_0x475c09[_0xd091('0x29')]);_0x30ae42[_0xd091('0x2f')]=_[_0xd091('0x30')](_0x30ae42[_0xd091('0x31')],_0x30ae42['query']);_0x418d46[_0xd091('0x32')]=_[_0xd091('0x30')](_0x30ae42[_0xd091('0x31')],qs[_0xd091('0x33')](_0x475c09[_0xd091('0x29')][_0xd091('0x33')]));_0x418d46[_0xd091('0x32')]=_0x418d46[_0xd091('0x32')]['length']?_0x418d46['attributes']:_0x30ae42[_0xd091('0x31')];if(_0x475c09['query'][_0xd091('0x34')]){_0x418d46['include']=[{'all':!![]}];}_0x418d46=_[_0xd091('0x35')]({},_0x418d46,_0x475c09['options']);return db['OpenchannelInteraction']['find'](_0x418d46)[_0xd091('0x1c')](handleEntityNotFound(_0x1f9438,null))[_0xd091('0x1c')](respondWithResult(_0x1f9438,null))[_0xd091('0x36')](handleError(_0x1f9438,null));};exports[_0xd091('0x37')]=function(_0x4bd51f,_0x538bc3){return db['OpenchannelInteraction'][_0xd091('0x37')](_0x4bd51f[_0xd091('0x38')],{})[_0xd091('0x1c')](respondWithResult(_0x538bc3,0xc9))[_0xd091('0x36')](handleError(_0x538bc3,null));};exports[_0xd091('0x1b')]=function(_0x5137bf,_0x6b45c0){if(_0x5137bf[_0xd091('0x38')]['id']){delete _0x5137bf[_0xd091('0x38')]['id'];}return db[_0xd091('0x21')][_0xd091('0x39')]({'where':{'id':_0x5137bf[_0xd091('0x2d')]['id']}})[_0xd091('0x1c')](handleEntityNotFound(_0x6b45c0,null))[_0xd091('0x1c')](saveUpdates(_0x5137bf[_0xd091('0x38')],null))['then'](respondWithResult(_0x6b45c0,null))['catch'](handleError(_0x6b45c0,null));};exports['destroy']=function(_0x59e42d,_0x4114ae){return db['OpenchannelInteraction'][_0xd091('0x39')]({'where':{'id':_0x59e42d[_0xd091('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4114ae,null))['then'](removeEntity(_0x4114ae,null))[_0xd091('0x36')](handleError(_0x4114ae,null));};exports[_0xd091('0x3a')]=function(_0x553bce,_0x2dbd85){return db[_0xd091('0x21')][_0xd091('0x3a')]()[_0xd091('0x1c')](respondWithResult(_0x2dbd85,null))[_0xd091('0x36')](handleError(_0x2dbd85,null));};exports[_0xd091('0x3b')]=function(_0x5ba362,_0x1fc9de){return db['OpenchannelMessage'][_0xd091('0x39')]({'where':{'id':_0x5ba362[_0xd091('0x2d')]['id']}})[_0xd091('0x1c')](handleEntityNotFound(_0x1fc9de,null))[_0xd091('0x1c')](function(_0x39c82b){if(_0x39c82b){return _0x39c82b[_0xd091('0x3b')](_0x5ba362[_0xd091('0x38')][_0xd091('0x3c')],_['omit'](_0x5ba362[_0xd091('0x38')],[_0xd091('0x3c'),'id'])||{});}})[_0xd091('0x1c')](respondWithResult(_0x1fc9de,null))[_0xd091('0x36')](handleError(_0x1fc9de,null));};exports[_0xd091('0x3d')]=function(_0x439905,_0x28314f){var _0x2a6ad3={'raw':![],'where':{}};var _0x3b0e82={};var _0x111516={'count':0x0,'rows':[]};return db[_0xd091('0x21')][_0xd091('0x3e')]({'where':{'id':_0x439905['params']['id']}})[_0xd091('0x1c')](handleEntityNotFound(_0x28314f,null))[_0xd091('0x1c')](function(_0x53415b){if(_0x53415b){_0x3b0e82[_0xd091('0x31')]=_[_0xd091('0x2e')](db[_0xd091('0x3f')][_0xd091('0x22')]);_0x3b0e82[_0xd091('0x29')]=_[_0xd091('0x2e')](_0x439905[_0xd091('0x29')]);_0x3b0e82[_0xd091('0x2f')]=_[_0xd091('0x30')](_0x3b0e82[_0xd091('0x31')],_0x3b0e82[_0xd091('0x29')]);_0x2a6ad3[_0xd091('0x32')]=_['intersection'](_0x3b0e82[_0xd091('0x31')],qs[_0xd091('0x33')](_0x439905[_0xd091('0x29')][_0xd091('0x33')]));_0x2a6ad3[_0xd091('0x32')]=_0x2a6ad3[_0xd091('0x32')][_0xd091('0x40')]?_0x2a6ad3[_0xd091('0x32')]:_0x3b0e82['model'];if(!_0x439905[_0xd091('0x29')]['hasOwnProperty']('nolimit')){_0x2a6ad3[_0xd091('0x16')]=qs[_0xd091('0x16')](_0x439905[_0xd091('0x29')]['limit']);_0x2a6ad3[_0xd091('0x15')]=qs[_0xd091('0x15')](_0x439905[_0xd091('0x29')][_0xd091('0x15')]);}_0x2a6ad3[_0xd091('0x41')]=qs['sort'](_0x439905[_0xd091('0x29')][_0xd091('0x42')]);_0x2a6ad3[_0xd091('0x43')]=qs['filters'](_[_0xd091('0x44')](_0x439905[_0xd091('0x29')],_0x3b0e82['filters']));_0x2a6ad3['where'][_0xd091('0x45')]=_0x53415b['id'];if(_0x439905['query'][_0xd091('0x46')]){_0x2a6ad3['where']=_[_0xd091('0x35')](_0x2a6ad3[_0xd091('0x43')],{'$or':_[_0xd091('0x20')](_0x2a6ad3[_0xd091('0x32')],function(_0x5643c5){var _0x5ee199={};_0x5ee199[_0x5643c5]={'$like':'%'+_0x439905['query'][_0xd091('0x46')]+'%'};return _0x5ee199;})});}if(_0x439905[_0xd091('0x29')][_0xd091('0x47')]){var _0x4a54a8=_0x439905[_0xd091('0x29')][_0xd091('0x47')][_0xd091('0x48')](',');var _0x519d47={};_0x519d47[_0x4a54a8[0x0]]={'$gte':moment(_0x4a54a8[0x1])['format'](_0xd091('0x49'))};_0x2a6ad3[_0xd091('0x43')]=_[_0xd091('0x35')](_0x2a6ad3[_0xd091('0x43')],_0x519d47);}_0x2a6ad3=_[_0xd091('0x35')]({},_0x2a6ad3,_0x439905[_0xd091('0x4a')]);return db[_0xd091('0x3f')][_0xd091('0x18')]({'where':_0x2a6ad3[_0xd091('0x43')]})[_0xd091('0x1c')](function(_0x1b6543){_0x111516[_0xd091('0x18')]=_0x1b6543;if(_0x439905[_0xd091('0x29')][_0xd091('0x34')]){_0x2a6ad3[_0xd091('0x4b')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xd091('0x27')](_0x2a6ad3);})[_0xd091('0x1c')](function(_0x1e5020){_0x111516[_0xd091('0x4c')]=_0x1e5020;return _0x111516;});}})['then'](respondWithFilteredResult(_0x28314f,_0x2a6ad3))[_0xd091('0x36')](handleError(_0x28314f,null));};exports[_0xd091('0x4d')]=function(_0x303fd0,_0x1c75ac){return db[_0xd091('0x21')][_0xd091('0x39')]({'where':{'id':_0x303fd0['params']['id']}})[_0xd091('0x1c')](handleEntityNotFound(_0x1c75ac,null))[_0xd091('0x1c')](function(_0x32e14e){if(_0x32e14e){return _0x32e14e[_0xd091('0x4e')](_0x303fd0[_0xd091('0x38')][_0xd091('0x3c')],_[_0xd091('0x4f')](_0x303fd0[_0xd091('0x38')],[_0xd091('0x3c'),'id'])||{})[_0xd091('0x50')](function(){return db['Tag'][_0xd091('0x27')]({'attributes':['id','name','color'],'where':{'id':_0x303fd0[_0xd091('0x38')][_0xd091('0x3c')]}});})['then'](function(_0x4b930e){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x303fd0['params']['id']),'tags':_0x4b930e||[]});return{'id':Number(_0x303fd0[_0xd091('0x2d')]['id']),'tags':_0x4b930e||[]};});}})['then'](respondWithResult(_0x1c75ac,null))[_0xd091('0x36')](handleError(_0x1c75ac,null));};exports['removeTags']=function(_0x2451aa,_0x20c678){return db[_0xd091('0x21')][_0xd091('0x39')]({'where':{'id':_0x2451aa[_0xd091('0x2d')]['id']}})['then'](handleEntityNotFound(_0x20c678,null))[_0xd091('0x1c')](function(_0x2942c7){if(_0x2942c7){return _0x2942c7[_0xd091('0x51')](_0x2451aa[_0xd091('0x29')][_0xd091('0x3c')]);}})[_0xd091('0x1c')](respondWithStatusCode(_0x20c678,null))['catch'](handleError(_0x20c678,null));};exports[_0xd091('0x52')]=function(_0x28f950,_0x59c617){var _0x4153ec=moment()['unix']()['toString']();var _0x4fc511=path['join'](config[_0xd091('0x53')],_0xd091('0x54'),_0xd091('0x55'),_0xd091('0x56'));var _0x33327b=path[_0xd091('0x57')](config[_0xd091('0x53')],_0xd091('0x54'),'files',_0xd091('0x58'));var _0x806df4=path[_0xd091('0x57')](_0x4fc511,_0x4153ec);var _0x31d61d=util[_0xd091('0x59')](_0xd091('0x5a'),_0x28f950[_0xd091('0x2d')]['id'],_0x4153ec);var _0x3a085a=path[_0xd091('0x57')](_0x4fc511,_0x31d61d);var _0x28a8a1=[];_0x28a8a1['push']({'model':db[_0xd091('0x5b')],'as':_0xd091('0x5b'),'attributes':['id',_0xd091('0x5c')],'raw':!![]});_0x28a8a1['push']({'model':db[_0xd091('0x5d')],'as':_0xd091('0x5e'),'attributes':['id',_0xd091('0x5f'),'lastName'],'raw':!![]});if(_0x28f950[_0xd091('0x29')][_0xd091('0x58')]){_0x28a8a1[_0xd091('0x60')]({'model':db[_0xd091('0x61')],'as':_0xd091('0x61'),'raw':!![]});}var _0x133d3f=[{'model':db['OpenchannelMessage'],'as':_0xd091('0x62'),'attributes':['id','body',_0xd091('0x63'),_0xd091('0x64'),_0xd091('0x65'),_0xd091('0x66')],'include':_0x28a8a1}];_0x133d3f[_0xd091('0x60')]({'model':db[_0xd091('0x67')],'as':'Account','attributes':['id','name']});_0x133d3f[_0xd091('0x60')]({'model':db[_0xd091('0x5b')],'as':_0xd091('0x68'),'attributes':['id',_0xd091('0x5c')]});return db[_0xd091('0x21')]['find']({'where':{'id':_0x28f950[_0xd091('0x2d')]['id']},'include':_0x133d3f})[_0xd091('0x1c')](handleEntityNotFound(_0x59c617,null))['then'](function(_0x175b4c){if(_0x175b4c){var _0x34c388=_0x175b4c['get']({'plain':!![]});fs[_0xd091('0x69')](_0x806df4);var _0x183fd5={'channel':'Openchannel','account':_0x34c388[_0xd091('0x6a')][_0xd091('0x1f')],'agent':_0x34c388[_0xd091('0x68')]?_0x34c388[_0xd091('0x68')]['fullname']:_0xd091('0x6b'),'createdAt':moment(_0x34c388['createdAt'])[_0xd091('0x59')](_0xd091('0x49'))[_0xd091('0x6c')](),'closedAt':_0x34c388[_0xd091('0x6d')]?moment(_0x34c388[_0xd091('0x6e')])[_0xd091('0x59')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd091('0x6c')]():'','disposition':_0x34c388[_0xd091('0x6f')],'visibility':_0x34c388[_0xd091('0x70')]?_0xd091('0x71'):_0xd091('0x72'),'messages':_(_0x34c388[_0xd091('0x62')])['filter']({'secret':![]})[_0xd091('0x20')](function(_0xb14f38){if(_0xb14f38[_0xd091('0x61')]){var _0x3e43d9=path['join'](_0x33327b,_0xb14f38[_0xd091('0x61')][_0xd091('0x73')]);if(fs[_0xd091('0x74')](_0x3e43d9)){fs[_0xd091('0x75')](_0x3e43d9)[_0xd091('0x76')](fs['createWriteStream'](path[_0xd091('0x57')](_0x806df4,_0xb14f38[_0xd091('0x61')]['basename'])));}}return{'date':moment(_0xb14f38[_0xd091('0x63')])['format'](_0xd091('0x49'))[_0xd091('0x6c')](),'sender':_0xb14f38['direction']===_0xd091('0x77')?_0xb14f38[_0xd091('0x5b')]?_0xb14f38[_0xd091('0x5b')]['fullname']:_0xd091('0x78'):_0xb14f38[_0xd091('0x5e')][_0xd091('0x5f')]+(_0xb14f38[_0xd091('0x5e')][_0xd091('0x79')]?'\x20'+_0xb14f38[_0xd091('0x5e')][_0xd091('0x79')]:''),'body':_0xb14f38[_0xd091('0x61')]?_0xb14f38[_0xd091('0x61')]['basename']:_0xb14f38[_0xd091('0x38')],'direction':_0xb14f38[_0xd091('0x64')]===_0xd091('0x77')?'A':'C','secret':_0xb14f38[_0xd091('0x65')],'read':_0xb14f38[_0xd091('0x66')],'attachment':_0xb14f38[_0xd091('0x61')]};})['value']()};return ejs[_0xd091('0x7a')](path[_0xd091('0x57')](config[_0xd091('0x53')],'server',_0xd091('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x183fd5})[_0xd091('0x1c')](function(_0x9ab4ef){var _0x3dddbb=path[_0xd091('0x57')](_0x806df4,_0xd091('0x7c')+_0x34c388['id']+'-'+_0x4153ec+_0xd091('0x7d'));var _0x10312d={'path':_0x3dddbb,'channel':'Openchannel','interactionId':_0x34c388['id']};return pdf[_0xd091('0x7e')](_0x9ab4ef,_0x10312d);})[_0xd091('0x1c')](function(){return new Promise(function(_0x148c45,_0x538c2c){zipdir(_0x806df4,{'saveTo':_0x3a085a},function(_0x294cec,_0xfeaa42){if(_0x294cec)return _0x538c2c(_0x294cec);return _0x148c45(_0xfeaa42);});})[_0xd091('0x1c')](function(){return new Promise(function(_0x589739,_0x457a0d){rimraf(_0x806df4,function(_0x18168b){if(_0x18168b)_0x457a0d(_0x18168b);return _0x589739();});});})[_0xd091('0x1c')](function(){return _0x59c617[_0xd091('0x52')](_0x3a085a,_0x31d61d,function(_0x5f4ac2){if(_0x5f4ac2){logger[_0xd091('0x1d')](_0xd091('0x7f'),_0x5f4ac2);}else{fs[_0xd091('0x80')](_0x3a085a);}});});});}else{return _0x59c617[_0xd091('0x11')](0xc8);}})[_0xd091('0x36')](handleError(_0x59c617,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2a5e1cc..0332445 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 _0xcd0d=['then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update','remove'];(function(_0x3171fa,_0xe9c0b3){var _0x41b8f3=function(_0x56325c){while(--_0x56325c){_0x3171fa['push'](_0x3171fa['shift']());}};_0x41b8f3(++_0xe9c0b3);}(_0xcd0d,0xa3));var _0xdcd0=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0xcd0d[_0x4521e3];return _0x46a272;};'use strict';var EventEmitter=require(_0xdcd0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xdcd0('0x1')];var OpenchannelMessage=require(_0xdcd0('0x2'))['db'][_0xdcd0('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdcd0('0x4'),'afterUpdate':_0xdcd0('0x5'),'afterDestroy':_0xdcd0('0x6')};function emitEvent(_0x240828){return function(_0x8e9062,_0x3c9332,_0x317252){_0x8e9062['getUsers']({'attributes':['id'],'raw':!![]})[_0xdcd0('0x7')](function(_0x81619){_0x8e9062[_0xdcd0('0x8')](_0xdcd0('0x9'),_0x81619[_0xdcd0('0xa')](function(_0x17d4ad){return{'id':_0x17d4ad['id']};}));return OpenchannelMessage[_0xdcd0('0xb')]({'where':{'OpenchannelInteractionId':_0x8e9062['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1daceb){_0x8e9062['setDataValue']('unreadMessages',_0x1daceb[_0xdcd0('0xc')]);OpenchannelInteractionEvents[_0xdcd0('0xd')](_0x240828+':'+_0x8e9062['id'],_0x8e9062);OpenchannelInteractionEvents[_0xdcd0('0xd')](_0x240828,_0x8e9062);_0x317252(null);})[_0xdcd0('0xe')](_0x317252(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xdcd0('0xf')](e,emitEvent(event));}}module[_0xdcd0('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc480=['catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x2a9779,_0x290230){var _0xd3ba80=function(_0x4255c1){while(--_0x4255c1){_0x2a9779['push'](_0x2a9779['shift']());}};_0xd3ba80(++_0x290230);}(_0xc480,0x1a6));var _0x0c48=function(_0x193ee9,_0x1e1813){_0x193ee9=_0x193ee9-0x0;var _0x311b0d=_0xc480[_0x193ee9];return _0x311b0d;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x0c48('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x0c48('0x0'))['db'][_0x0c48('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0c48('0x2')](0x0);var events={'afterCreate':_0x0c48('0x3'),'afterUpdate':_0x0c48('0x4'),'afterDestroy':_0x0c48('0x5')};function emitEvent(_0x36669d){return function(_0x214478,_0x1d2717,_0x36274e){_0x214478[_0x0c48('0x6')]({'attributes':['id'],'raw':!![]})[_0x0c48('0x7')](function(_0x2dab80){_0x214478[_0x0c48('0x8')](_0x0c48('0x9'),_0x2dab80[_0x0c48('0xa')](function(_0x580d5b){return{'id':_0x580d5b['id']};}));return OpenchannelMessage[_0x0c48('0xb')]({'where':{'OpenchannelInteractionId':_0x214478['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0c48('0x7')](function(_0x7a792e){_0x214478[_0x0c48('0x8')](_0x0c48('0xc'),_0x7a792e[_0x0c48('0xd')]);OpenchannelInteractionEvents['emit'](_0x36669d+':'+_0x214478['id'],_0x214478);OpenchannelInteractionEvents[_0x0c48('0xe')](_0x36669d,_0x214478);_0x36274e(null);})[_0x0c48('0xf')](_0x36274e(null));};}for(var e in events){if(events[_0x0c48('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x0c48('0x11')](e,emitEvent(event));}}module[_0x0c48('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index baf89f6..0103e54 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 _0x0216=['../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x1c5d67,_0x3ee771){var _0xe2ecd2=function(_0x3d0a68){while(--_0x3d0a68){_0x1c5d67['push'](_0x1c5d67['shift']());}};_0xe2ecd2(++_0x3ee771);}(_0x0216,0x149));var _0x6021=function(_0xf1f877,_0x32f76c){_0xf1f877=_0xf1f877-0x0;var _0x15aaf8=_0x0216[_0xf1f877];return _0x15aaf8;};'use strict';var _=require(_0x6021('0x0'));var util=require(_0x6021('0x1'));var logger=require('../../config/logger')(_0x6021('0x2'));var moment=require(_0x6021('0x3'));var BPromise=require(_0x6021('0x4'));var rp=require(_0x6021('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6021('0x6'));var config=require(_0x6021('0x7'));var attributes=require(_0x6021('0x8'));module['exports']=function(_0xd9c39,_0x159a2e){return _0xd9c39['define'](_0x6021('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6021('0xa'),'collate':_0x6021('0xb'),'hooks':{'beforeUpdate':function(_0x10ab25,_0x4d6b71,_0x463871){if(_0x10ab25[_0x6021('0xc')](_0x6021('0xd'))){_0x10ab25[_0x6021('0xe')]=moment()[_0x6021('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x463871(null,_0x10ab25);}}});}; \ No newline at end of file +var _0x5dd8=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','lodash'];(function(_0x3d43cb,_0x3d7050){var _0x3f7599=function(_0xd85ade){while(--_0xd85ade){_0x3d43cb['push'](_0x3d43cb['shift']());}};_0x3f7599(++_0x3d7050);}(_0x5dd8,0xc5));var _0x85dd=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x5dd8[_0x75ce5b];return _0x22195e;};'use strict';var _=require(_0x85dd('0x0'));var util=require(_0x85dd('0x1'));var logger=require(_0x85dd('0x2'))('api');var moment=require(_0x85dd('0x3'));var BPromise=require(_0x85dd('0x4'));var rp=require(_0x85dd('0x5'));var fs=require('fs');var path=require(_0x85dd('0x6'));var rimraf=require(_0x85dd('0x7'));var config=require(_0x85dd('0x8'));var attributes=require(_0x85dd('0x9'));module[_0x85dd('0xa')]=function(_0x3425ae,_0x54fbc7){return _0x3425ae[_0x85dd('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x85dd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x85dd('0xd'),'collate':_0x85dd('0xe'),'hooks':{'beforeUpdate':function(_0xba300f,_0x288877,_0x420f4d){if(_0xba300f[_0x85dd('0xf')](_0x85dd('0x10'))){_0xba300f['closedAt']=moment()[_0x85dd('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x420f4d(null,_0xba300f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1789d4c..010ac41 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 _0x35b6=['result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4c09f4,_0x60bb8f){var _0x393e5e=function(_0x1a489c){while(--_0x1a489c){_0x4c09f4['push'](_0x4c09f4['shift']());}};_0x393e5e(++_0x60bb8f);}(_0x35b6,0x90));var _0x635b=function(_0x10377e,_0x2433c9){_0x10377e=_0x10377e-0x0;var _0x3d6230=_0x35b6[_0x10377e];return _0x3d6230;};'use strict';var _=require(_0x635b('0x0'));var util=require('util');var moment=require(_0x635b('0x1'));var BPromise=require(_0x635b('0x2'));var rs=require(_0x635b('0x3'));var fs=require('fs');var Redis=require(_0x635b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x635b('0x5'));var logger=require(_0x635b('0x6'))(_0x635b('0x7'));var config=require(_0x635b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x635b('0x9')][_0x635b('0xa')]({'port':0x232a});config[_0x635b('0xb')]=_[_0x635b('0xc')](config[_0x635b('0xb')],{'host':_0x635b('0xd'),'port':0x18eb});var socket=require(_0x635b('0xe'))(new Redis(config[_0x635b('0xb')]));require('./openchannelInteraction.socket')[_0x635b('0xf')](socket);function respondWithRpcPromise(_0x19fa84,_0x6a6566,_0x5d6951){return new BPromise(function(_0x32ed3e,_0x562427){return client['request'](_0x19fa84,_0x5d6951)[_0x635b('0x10')](function(_0x1516ea){logger[_0x635b('0x11')](_0x635b('0x12'),_0x6a6566,_0x635b('0x13'));logger['debug'](_0x635b('0x14'),_0x6a6566,_0x635b('0x13'),JSON['stringify'](_0x1516ea));if(_0x1516ea[_0x635b('0x15')]){if(_0x1516ea['error'][_0x635b('0x16')]===0x1f4){logger[_0x635b('0x15')](_0x635b('0x12'),_0x6a6566,_0x1516ea[_0x635b('0x15')][_0x635b('0x17')]);return _0x562427(_0x1516ea[_0x635b('0x15')]['message']);}logger[_0x635b('0x15')](_0x635b('0x12'),_0x6a6566,_0x1516ea[_0x635b('0x15')][_0x635b('0x17')]);return _0x32ed3e(_0x1516ea[_0x635b('0x15')]['message']);}else{logger['info'](_0x635b('0x12'),_0x6a6566,'request\x20sent');_0x32ed3e(_0x1516ea[_0x635b('0x18')][_0x635b('0x17')]);}})[_0x635b('0x19')](function(_0x30e447){logger[_0x635b('0x15')](_0x635b('0x12'),_0x6a6566,_0x30e447);_0x562427(_0x30e447);});});}exports[_0x635b('0x1a')]=function(_0xad36f6){var _0x249e77=this;return new Promise(function(_0x3c71c9,_0x1b5831){return db[_0x635b('0x1b')][_0x635b('0x1c')](_0xad36f6[_0x635b('0x1d')],{'raw':_0xad36f6[_0x635b('0x1e')]?_0xad36f6['options'][_0x635b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xad36f6['options']?_0xad36f6[_0x635b('0x1e')][_0x635b('0x20')]||null:null,'attributes':_0xad36f6[_0x635b('0x1e')]?_0xad36f6['options'][_0x635b('0x21')]||null:null,'limit':_0xad36f6['options']?_0xad36f6[_0x635b('0x1e')][_0x635b('0x22')]||null:null})[_0x635b('0x10')](function(_0x8265fc){logger['info'](_0x635b('0x1a'),_0xad36f6);logger['debug'](_0x635b('0x1a'),_0xad36f6,JSON[_0x635b('0x23')](_0x8265fc));_0x3c71c9(_0x8265fc);})[_0x635b('0x19')](function(_0x252189){logger[_0x635b('0x15')](_0x635b('0x1a'),_0x252189[_0x635b('0x17')],_0xad36f6);_0x1b5831(_0x249e77[_0x635b('0x15')](0x1f4,_0x252189[_0x635b('0x17')]));});});};exports[_0x635b('0x24')]=function(_0x311971){return new Promise(function(_0x4640dc,_0x20934b){return db[_0x635b('0x1b')]['find']({'where':_0x311971[_0x635b('0x1e')]?_0x311971[_0x635b('0x1e')][_0x635b('0x20')]||null:null})[_0x635b('0x10')](function(_0x26c525){if(_0x26c525){return _0x26c525[_0x635b('0x25')](_0x311971['body'][_0x635b('0x26')],_[_0x635b('0x27')](_0x311971[_0x635b('0x1d')],[_0x635b('0x26'),'id'])||{});}})[_0x635b('0x28')](function(_0xccc3a1){logger['info'](_0x635b('0x29'),_0x311971);logger['debug'](_0x635b('0x29'),_0x311971,JSON['stringify'](_0xccc3a1));_0x4640dc(_0xccc3a1);})[_0x635b('0x19')](function(_0x18a6b){logger[_0x635b('0x15')](_0x635b('0x29'),_0x18a6b[_0x635b('0x17')],_0x311971);_0x20934b(_this[_0x635b('0x15')](0x1f4,_0x18a6b[_0x635b('0x17')]));});});}; \ No newline at end of file +var _0x9e72=['raw','options','where','catch','AddTagsToOpenchannelInteraction','find','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateOpenchannelInteraction','update','body'];(function(_0x3c5f9d,_0xbc1653){var _0x4f77b6=function(_0x53b68e){while(--_0x53b68e){_0x3c5f9d['push'](_0x3c5f9d['shift']());}};_0x4f77b6(++_0xbc1653);}(_0x9e72,0xd1));var _0x29e7=function(_0x2b2954,_0x12fc33){_0x2b2954=_0x2b2954-0x0;var _0xaec176=_0x9e72[_0x2b2954];return _0xaec176;};'use strict';var _=require(_0x29e7('0x0'));var util=require('util');var moment=require(_0x29e7('0x1'));var BPromise=require(_0x29e7('0x2'));var rs=require(_0x29e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29e7('0x4'))['db'];var utils=require(_0x29e7('0x5'));var logger=require(_0x29e7('0x6'))(_0x29e7('0x7'));var config=require(_0x29e7('0x8'));var jayson=require(_0x29e7('0x9'));var client=jayson[_0x29e7('0xa')][_0x29e7('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x29e7('0xc'),'port':0x18eb});var socket=require(_0x29e7('0xd'))(new Redis(config[_0x29e7('0xe')]));require('./openchannelInteraction.socket')[_0x29e7('0xf')](socket);function respondWithRpcPromise(_0x295857,_0xccbb4a,_0x26e198){return new BPromise(function(_0x1e2e1f,_0x15918b){return client[_0x29e7('0x10')](_0x295857,_0x26e198)[_0x29e7('0x11')](function(_0x511fb2){logger['info'](_0x29e7('0x12'),_0xccbb4a,_0x29e7('0x13'));logger[_0x29e7('0x14')](_0x29e7('0x15'),_0xccbb4a,_0x29e7('0x13'),JSON[_0x29e7('0x16')](_0x511fb2));if(_0x511fb2[_0x29e7('0x17')]){if(_0x511fb2['error'][_0x29e7('0x18')]===0x1f4){logger[_0x29e7('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0xccbb4a,_0x511fb2[_0x29e7('0x17')][_0x29e7('0x19')]);return _0x15918b(_0x511fb2[_0x29e7('0x17')][_0x29e7('0x19')]);}logger[_0x29e7('0x17')](_0x29e7('0x12'),_0xccbb4a,_0x511fb2[_0x29e7('0x17')]['message']);return _0x1e2e1f(_0x511fb2[_0x29e7('0x17')][_0x29e7('0x19')]);}else{logger[_0x29e7('0x1a')](_0x29e7('0x12'),_0xccbb4a,_0x29e7('0x13'));_0x1e2e1f(_0x511fb2[_0x29e7('0x1b')][_0x29e7('0x19')]);}})['catch'](function(_0x3e0579){logger[_0x29e7('0x17')](_0x29e7('0x12'),_0xccbb4a,_0x3e0579);_0x15918b(_0x3e0579);});});}exports[_0x29e7('0x1c')]=function(_0x58b10e){var _0x1b4c78=this;return new Promise(function(_0x13ec23,_0x5e5f8d){return db['OpenchannelInteraction'][_0x29e7('0x1d')](_0x58b10e[_0x29e7('0x1e')],{'raw':_0x58b10e['options']?_0x58b10e['options'][_0x29e7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b10e[_0x29e7('0x20')]?_0x58b10e[_0x29e7('0x20')][_0x29e7('0x21')]||null:null,'attributes':_0x58b10e[_0x29e7('0x20')]?_0x58b10e['options']['attributes']||null:null,'limit':_0x58b10e['options']?_0x58b10e[_0x29e7('0x20')]['limit']||null:null})['then'](function(_0x37425e){logger[_0x29e7('0x1a')](_0x29e7('0x1c'),_0x58b10e);logger[_0x29e7('0x14')](_0x29e7('0x1c'),_0x58b10e,JSON[_0x29e7('0x16')](_0x37425e));_0x13ec23(_0x37425e);})[_0x29e7('0x22')](function(_0x29d8e9){logger[_0x29e7('0x17')]('UpdateOpenchannelInteraction',_0x29d8e9[_0x29e7('0x19')],_0x58b10e);_0x5e5f8d(_0x1b4c78[_0x29e7('0x17')](0x1f4,_0x29d8e9[_0x29e7('0x19')]));});});};exports[_0x29e7('0x23')]=function(_0x2a3a83){return new Promise(function(_0x5d301a,_0x6060){return db['OpenchannelInteraction'][_0x29e7('0x24')]({'where':_0x2a3a83[_0x29e7('0x20')]?_0x2a3a83[_0x29e7('0x20')][_0x29e7('0x21')]||null:null})['then'](function(_0x4af6c6){if(_0x4af6c6){return _0x4af6c6['addTags'](_0x2a3a83['body']['ids'],_['omit'](_0x2a3a83['body'],[_0x29e7('0x25'),'id'])||{});}})[_0x29e7('0x26')](function(_0x2efabf){logger['info'](_0x29e7('0x27'),_0x2a3a83);logger[_0x29e7('0x14')](_0x29e7('0x27'),_0x2a3a83,JSON[_0x29e7('0x16')](_0x2efabf));_0x5d301a(_0x2efabf);})[_0x29e7('0x22')](function(_0x833b2e){logger[_0x29e7('0x17')]('AddTags',_0x833b2e[_0x29e7('0x19')],_0x2a3a83);_0x6060(_this[_0x29e7('0x17')](0x1f4,_0x833b2e[_0x29e7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index d936cfe..d89f849 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 _0x49a6=['save','remove','update','emit','register','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x2f1e33,_0x3b6dac){var _0x36732d=function(_0x1c6b70){while(--_0x1c6b70){_0x2f1e33['push'](_0x2f1e33['shift']());}};_0x36732d(++_0x3b6dac);}(_0x49a6,0x133));var _0x649a=function(_0x511664,_0x2a7df1){_0x511664=_0x511664-0x0;var _0x12c43d=_0x49a6[_0x511664];return _0x12c43d;};'use strict';var OpenchannelInteractionEvents=require(_0x649a('0x0'));var events=[_0x649a('0x1'),_0x649a('0x2'),_0x649a('0x3')];function createListener(_0x5cf8cc,_0x4a5435){return function(_0x889463){_0x4a5435[_0x649a('0x4')](_0x5cf8cc,_0x889463);};}function removeListener(_0xa3256b,_0x5d1e20){return function(){OpenchannelInteractionEvents['removeListener'](_0xa3256b,_0x5d1e20);};}exports[_0x649a('0x5')]=function(_0x1ca22d){for(var _0x1ff07f=0x0,_0x1f2abb=events['length'];_0x1ff07f<_0x1f2abb;_0x1ff07f++){var _0x2d788d=events[_0x1ff07f];var _0x5bd143=createListener(_0x649a('0x6')+_0x2d788d,_0x1ca22d);OpenchannelInteractionEvents['on'](_0x2d788d,_0x5bd143);}}; \ No newline at end of file +var _0x911d=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x5901c7,_0x169cb1){var _0x21e273=function(_0x237063){while(--_0x237063){_0x5901c7['push'](_0x5901c7['shift']());}};_0x21e273(++_0x169cb1);}(_0x911d,0x1e1));var _0xd911=function(_0x38df93,_0x1745db){_0x38df93=_0x38df93-0x0;var _0x3b4abd=_0x911d[_0x38df93];return _0x3b4abd;};'use strict';var OpenchannelInteractionEvents=require(_0xd911('0x0'));var events=[_0xd911('0x1'),_0xd911('0x2'),_0xd911('0x3')];function createListener(_0xf6a34,_0x8bad22){return function(_0xb88a70){_0x8bad22[_0xd911('0x4')](_0xf6a34,_0xb88a70);};}function removeListener(_0x4dab61,_0x5aa744){return function(){OpenchannelInteractionEvents[_0xd911('0x5')](_0x4dab61,_0x5aa744);};}exports[_0xd911('0x6')]=function(_0x6dc745){for(var _0x45d086=0x0,_0x39767e=events[_0xd911('0x7')];_0x45d086<_0x39767e;_0x45d086++){var _0x5c6225=events[_0x45d086];var _0x449d1a=createListener(_0xd911('0x8')+_0x5c6225,_0x6dc745);OpenchannelInteractionEvents['on'](_0x5c6225,_0x449d1a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 53f5740..de4ac8e 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x34ad09,_0xba8f16){var _0x4c8431=function(_0x78b555){while(--_0x78b555){_0x34ad09['push'](_0x34ad09['shift']());}};_0x4c8431(++_0xba8f16);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +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(_0x23c651,_0x143982){var _0xbe7bdb=function(_0x1979e2){while(--_0x1979e2){_0x23c651['push'](_0x23c651['shift']());}};_0xbe7bdb(++_0x143982);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0xcb91[_0x215dc8];return _0x583ea3;};'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 4f4c7d7..85999f0 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 _0x5c00=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x58e29f,_0x475e63){var _0x32a7ab=function(_0x1fe77b){while(--_0x1fe77b){_0x58e29f['push'](_0x58e29f['shift']());}};_0x32a7ab(++_0x475e63);}(_0x5c00,0x17e));var _0x05c0=function(_0x4d3b77,_0x3c789c){_0x4d3b77=_0x4d3b77-0x0;var _0x1a716a=_0x5c00[_0x4d3b77];return _0x1a716a;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'body':{'type':Sequelize[_0x05c0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x05c0('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x05c0('0x4')]('in',_0x05c0('0x5')),'defaultValue':_0x05c0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x05c0('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x26f9=['exports','medium','ENUM','out','DATE','STRING','TEXT','sequelize'];(function(_0x5ac29b,_0x309c14){var _0xc40617=function(_0x481fbc){while(--_0x481fbc){_0x5ac29b['push'](_0x5ac29b['shift']());}};_0xc40617(++_0x309c14);}(_0x26f9,0x16f));var _0x926f=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x26f9[_0x53f897];return _0x6879f8;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x926f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x926f('0x3')]('in',_0x926f('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x926f('0x5')]},'providerName':{'type':Sequelize[_0x926f('0x6')]},'providerResponse':{'type':Sequelize[_0x926f('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index db90694..3a49e78 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 _0xb35d=['EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','QueryTypes','User','email','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelMessage.socket','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','type','merge','options','findAll','rows','show','params','include','find','catch','create','body','update','destroy','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','get','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','fullname','internal','manual','SIP/%s','channel','motionChannel','event'];(function(_0x2b90b5,_0x433b15){var _0x493d80=function(_0x465ef6){while(--_0x465ef6){_0x2b90b5['push'](_0x2b90b5['shift']());}};_0x493d80(++_0x433b15);}(_0xb35d,0x19c));var _0xdb35=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0xb35d[_0x33bcdb];return _0x18a9bf;};'use strict';var emlformat=require(_0xdb35('0x0'));var rimraf=require(_0xdb35('0x1'));var zipdir=require(_0xdb35('0x2'));var jsonpatch=require(_0xdb35('0x3'));var rp=require(_0xdb35('0x4'));var moment=require(_0xdb35('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdb35('0x6'));var path=require(_0xdb35('0x7'));var sox=require('sox');var csv=require(_0xdb35('0x8'));var ejs=require(_0xdb35('0x9'));var fs=require('fs');var fs_extra=require(_0xdb35('0xa'));var _=require(_0xdb35('0xb'));var squel=require(_0xdb35('0xc'));var crypto=require(_0xdb35('0xd'));var jsforce=require(_0xdb35('0xe'));var deskjs=require(_0xdb35('0xf'));var toCsv=require(_0xdb35('0x8'));var querystring=require(_0xdb35('0x10'));var Papa=require(_0xdb35('0x11'));var Redis=require('ioredis');var authService=require(_0xdb35('0x12'));var qs=require(_0xdb35('0x13'));var as=require(_0xdb35('0x14'));var hardwareService=require(_0xdb35('0x15'));var logger=require(_0xdb35('0x16'))(_0xdb35('0x17'));var utils=require(_0xdb35('0x18'));var config=require(_0xdb35('0x19'));var licenseUtil=require(_0xdb35('0x1a'));var db=require('../../mysqldb')['db'];config[_0xdb35('0x1b')]=_[_0xdb35('0x1c')](config['redis'],{'host':_0xdb35('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb35('0x1b')]));require(_0xdb35('0x1e'))['register'](socket);var jayson=require(_0xdb35('0x1f'));var client=jayson[_0xdb35('0x20')][_0xdb35('0x21')]({'port':0x232c});var client9002=jayson[_0xdb35('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ecaae,_0x2216ca,_0xe01d0,_0x192ab3){return new BPromise(function(_0x2a1f0b,_0x2a23f7){var _0x224461=_0x192ab3||client;return _0x224461[_0xdb35('0x22')](_0x4ecaae,_0xe01d0)['then'](function(_0x952d76){logger[_0xdb35('0x23')](_0xdb35('0x24'),_0x2216ca,_0xdb35('0x25'));logger[_0xdb35('0x26')](_0xdb35('0x27'),_0x2216ca,_0xdb35('0x25'),JSON[_0xdb35('0x28')](_0x952d76));if(_0x952d76[_0xdb35('0x29')]){if(_0x952d76[_0xdb35('0x29')][_0xdb35('0x2a')]===0x1f4){logger[_0xdb35('0x29')](_0xdb35('0x24'),_0x2216ca,_0x952d76[_0xdb35('0x29')][_0xdb35('0x2b')]);return _0x2a23f7(_0x952d76['error'][_0xdb35('0x2b')]);}logger[_0xdb35('0x29')](_0xdb35('0x24'),_0x2216ca,_0x952d76[_0xdb35('0x29')][_0xdb35('0x2b')]);return _0x2a1f0b(_0x952d76[_0xdb35('0x29')][_0xdb35('0x2b')]);}else{logger['info'](_0xdb35('0x24'),_0x2216ca,'request\x20sent');_0x2a1f0b(_0x952d76[_0xdb35('0x2c')][_0xdb35('0x2b')]);}})['catch'](function(_0x4af409){logger[_0xdb35('0x29')](_0xdb35('0x24'),_0x2216ca,_0x4af409);_0x2a23f7(_0x4af409);});});}function respondWithStatusCode(_0x45857a,_0x343a0a){_0x343a0a=_0x343a0a||0xcc;return function(_0x3a112a){if(_0x3a112a){return _0x45857a['sendStatus'](_0x343a0a);}return _0x45857a['status'](_0x343a0a)[_0xdb35('0x2d')]();};}function respondWithResult(_0x409df7,_0x23f3d5){_0x23f3d5=_0x23f3d5||0xc8;return function(_0x598c4f){if(_0x598c4f){return _0x409df7[_0xdb35('0x2e')](_0x23f3d5)[_0xdb35('0x2f')](_0x598c4f);}};}function respondWithFilteredResult(_0x369d27,_0xf26c0d){return function(_0x1378d1){if(_0x1378d1){var _0x98074a=typeof _0xf26c0d['offset']===_0xdb35('0x30')&&typeof _0xf26c0d[_0xdb35('0x31')]===_0xdb35('0x30');var _0x46f2d6=_0x1378d1[_0xdb35('0x32')];var _0x18ea62=_0x98074a?0x0:_0xf26c0d['offset'];var _0x7816d4=_0x98074a?_0x1378d1[_0xdb35('0x32')]:_0xf26c0d[_0xdb35('0x33')]+_0xf26c0d['limit'];var _0x16bef4;if(_0x7816d4>=_0x46f2d6){_0x7816d4=_0x46f2d6;_0x16bef4=0xc8;}else{_0x16bef4=0xce;}_0x369d27[_0xdb35('0x2e')](_0x16bef4);return _0x369d27[_0xdb35('0x34')](_0xdb35('0x35'),_0x18ea62+'-'+_0x7816d4+'/'+_0x46f2d6)[_0xdb35('0x2f')](_0x1378d1);}return null;};}function patchUpdates(_0x4b124e){return function(_0x3bea05){try{jsonpatch['apply'](_0x3bea05,_0x4b124e,!![]);}catch(_0x5a0e61){return BPromise[_0xdb35('0x36')](_0x5a0e61);}return _0x3bea05[_0xdb35('0x37')]();};}function saveUpdates(_0x5e513e,_0x2fb864){return function(_0x387704){if(_0x387704){return _0x387704['update'](_0x5e513e)[_0xdb35('0x38')](function(_0x5ca1bf){return _0x5ca1bf;});}return null;};}function removeEntity(_0x5d402e,_0x36400b){return function(_0x491dd8){if(_0x491dd8){return _0x491dd8['destroy']()[_0xdb35('0x38')](function(){_0x5d402e[_0xdb35('0x2e')](0xcc)[_0xdb35('0x2d')]();});}};}function handleEntityNotFound(_0x21bb80,_0x253dff){return function(_0x2b1047){if(!_0x2b1047){_0x21bb80['sendStatus'](0x194);}return _0x2b1047;};}function handleError(_0x3ccc4f,_0xbfe007){_0xbfe007=_0xbfe007||0x1f4;return function(_0x17491d){logger['error'](_0x17491d[_0xdb35('0x39')]);if(_0x17491d[_0xdb35('0x3a')]){delete _0x17491d[_0xdb35('0x3a')];}_0x3ccc4f[_0xdb35('0x2e')](_0xbfe007)[_0xdb35('0x3b')](_0x17491d);};}exports[_0xdb35('0x3c')]=function(_0x340e3d,_0x3128b4){var _0x54d972={},_0x3291fc={},_0x417a0e={'count':0x0,'rows':[]};var _0x3b1c0c=_[_0xdb35('0x3d')](db[_0xdb35('0x3e')][_0xdb35('0x3f')],function(_0xba92ab){return{'name':_0xba92ab[_0xdb35('0x40')],'type':_0xba92ab['type'][_0xdb35('0x41')]};});_0x3291fc[_0xdb35('0x42')]=_[_0xdb35('0x3d')](_0x3b1c0c,_0xdb35('0x3a'));_0x3291fc[_0xdb35('0x43')]=_[_0xdb35('0x44')](_0x340e3d[_0xdb35('0x43')]);_0x3291fc[_0xdb35('0x45')]=_['intersection'](_0x3291fc[_0xdb35('0x42')],_0x3291fc[_0xdb35('0x43')]);_0x54d972[_0xdb35('0x46')]=_[_0xdb35('0x47')](_0x3291fc[_0xdb35('0x42')],qs['fields'](_0x340e3d[_0xdb35('0x43')][_0xdb35('0x48')]));_0x54d972[_0xdb35('0x46')]=_0x54d972['attributes'][_0xdb35('0x49')]?_0x54d972[_0xdb35('0x46')]:_0x3291fc['model'];if(!_0x340e3d[_0xdb35('0x43')]['hasOwnProperty'](_0xdb35('0x4a'))){_0x54d972[_0xdb35('0x31')]=qs[_0xdb35('0x31')](_0x340e3d[_0xdb35('0x43')][_0xdb35('0x31')]);_0x54d972['offset']=qs[_0xdb35('0x33')](_0x340e3d[_0xdb35('0x43')][_0xdb35('0x33')]);}_0x54d972['order']=qs[_0xdb35('0x4b')](_0x340e3d[_0xdb35('0x43')][_0xdb35('0x4b')]);_0x54d972[_0xdb35('0x4c')]=qs[_0xdb35('0x45')](_[_0xdb35('0x4d')](_0x340e3d[_0xdb35('0x43')],_0x3291fc[_0xdb35('0x45')]),_0x3b1c0c);if(_0x340e3d[_0xdb35('0x43')][_0xdb35('0x4e')]){_0x54d972['where']=_['merge'](_0x54d972[_0xdb35('0x4c')],{'$or':_[_0xdb35('0x3d')](_0x3b1c0c,function(_0x2bf6f9){if(_0x2bf6f9[_0xdb35('0x4f')]!=='VIRTUAL'){var _0x635db6={};_0x635db6[_0x2bf6f9[_0xdb35('0x3a')]]={'$like':'%'+_0x340e3d['query'][_0xdb35('0x4e')]+'%'};return _0x635db6;}})});}_0x54d972=_[_0xdb35('0x50')]({},_0x54d972,_0x340e3d[_0xdb35('0x51')]);var _0xffddd5={'where':_0x54d972['where']};return db[_0xdb35('0x3e')][_0xdb35('0x32')](_0xffddd5)[_0xdb35('0x38')](function(_0x32b842){_0x417a0e['count']=_0x32b842;if(_0x340e3d[_0xdb35('0x43')]['includeAll']){_0x54d972['include']=[{'all':!![]}];}return db[_0xdb35('0x3e')][_0xdb35('0x52')](_0x54d972);})[_0xdb35('0x38')](function(_0x44551c){_0x417a0e[_0xdb35('0x53')]=_0x44551c;return _0x417a0e;})[_0xdb35('0x38')](respondWithFilteredResult(_0x3128b4,_0x54d972))['catch'](handleError(_0x3128b4,null));};exports[_0xdb35('0x54')]=function(_0x4e9d63,_0x223bcc){var _0x7aedf6={'raw':!![],'where':{'id':_0x4e9d63[_0xdb35('0x55')]['id']}},_0x190fdd={};_0x190fdd[_0xdb35('0x42')]=_[_0xdb35('0x44')](db[_0xdb35('0x3e')][_0xdb35('0x3f')]);_0x190fdd['query']=_[_0xdb35('0x44')](_0x4e9d63['query']);_0x190fdd['filters']=_[_0xdb35('0x47')](_0x190fdd[_0xdb35('0x42')],_0x190fdd[_0xdb35('0x43')]);_0x7aedf6[_0xdb35('0x46')]=_[_0xdb35('0x47')](_0x190fdd['model'],qs['fields'](_0x4e9d63[_0xdb35('0x43')][_0xdb35('0x48')]));_0x7aedf6[_0xdb35('0x46')]=_0x7aedf6[_0xdb35('0x46')][_0xdb35('0x49')]?_0x7aedf6[_0xdb35('0x46')]:_0x190fdd[_0xdb35('0x42')];if(_0x4e9d63[_0xdb35('0x43')]['includeAll']){_0x7aedf6[_0xdb35('0x56')]=[{'all':!![]}];}_0x7aedf6=_['merge']({},_0x7aedf6,_0x4e9d63[_0xdb35('0x51')]);return db[_0xdb35('0x3e')][_0xdb35('0x57')](_0x7aedf6)[_0xdb35('0x38')](handleEntityNotFound(_0x223bcc,null))[_0xdb35('0x38')](respondWithResult(_0x223bcc,null))[_0xdb35('0x58')](handleError(_0x223bcc,null));};exports[_0xdb35('0x59')]=function(_0x4f41f8,_0x29fdaf){return db['OpenchannelMessage'][_0xdb35('0x59')](_0x4f41f8[_0xdb35('0x5a')],{})[_0xdb35('0x38')](respondWithResult(_0x29fdaf,0xc9))[_0xdb35('0x58')](handleError(_0x29fdaf,null));};exports[_0xdb35('0x5b')]=function(_0x22ebd6,_0x538931){if(_0x22ebd6[_0xdb35('0x5a')]['id']){delete _0x22ebd6['body']['id'];}return db[_0xdb35('0x3e')][_0xdb35('0x57')]({'where':{'id':_0x22ebd6['params']['id']}})[_0xdb35('0x38')](handleEntityNotFound(_0x538931,null))[_0xdb35('0x38')](saveUpdates(_0x22ebd6[_0xdb35('0x5a')],null))[_0xdb35('0x38')](respondWithResult(_0x538931,null))[_0xdb35('0x58')](handleError(_0x538931,null));};exports[_0xdb35('0x5c')]=function(_0x2a389e,_0x5aace0){return db[_0xdb35('0x3e')]['find']({'where':{'id':_0x2a389e['params']['id']}})[_0xdb35('0x38')](handleEntityNotFound(_0x5aace0,null))[_0xdb35('0x38')](removeEntity(_0x5aace0,null))[_0xdb35('0x58')](handleError(_0x5aace0,null));};exports['describe']=function(_0x11d22c,_0x5142cb){return db['OpenchannelMessage'][_0xdb35('0x5d')]()[_0xdb35('0x38')](respondWithResult(_0x5142cb,null))[_0xdb35('0x58')](handleError(_0x5142cb,null));};var interaction_log=require(_0xdb35('0x16'))(_0xdb35('0x5e'));exports[_0xdb35('0x5f')]=function(_0x11df71,_0x274463,_0x1869f4){var _0x269de0={'agent':{},'channel':_0xdb35('0x60')};if(_0x11df71['body']['id']){delete _0x11df71[_0xdb35('0x5a')]['id'];}_0x11df71[_0xdb35('0x5a')]['read']=!![];_0x11df71[_0xdb35('0x5a')][_0xdb35('0x61')]=moment()[_0xdb35('0x62')](_0xdb35('0x63'));_0x11df71[_0xdb35('0x5a')][_0xdb35('0x64')]=_0x11df71[_0xdb35('0x5a')]['UserId']||_0x11df71[_0xdb35('0x65')]['id'];_0x269de0[_0xdb35('0x66')]['id']=_0x11df71[_0xdb35('0x5a')][_0xdb35('0x64')];return db[_0xdb35('0x3e')][_0xdb35('0x57')]({'where':{'id':_0x11df71[_0xdb35('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x274463,null))[_0xdb35('0x38')](saveUpdates(_0x11df71['body'],null))[_0xdb35('0x38')](function(_0x447642){if(_0x447642){_0x269de0[_0xdb35('0x2b')]=_0x447642['get']({'plain':!![]});return db[_0xdb35('0x67')][_0xdb35('0x57')]({'where':{'id':_0x447642[_0xdb35('0x68')]}});}return null;})[_0xdb35('0x38')](handleEntityNotFound(_0x274463,null))['then'](function(_0x57fea8){if(_0x57fea8){return _0x57fea8[_0xdb35('0x5b')]({'UserId':_0x11df71[_0xdb35('0x5a')][_0xdb35('0x64')],'read1stAt':_[_0xdb35('0x69')](_0x57fea8['read1stAt'])?moment()[_0xdb35('0x62')](_0xdb35('0x63')):undefined});}return null;})[_0xdb35('0x38')](function(_0x55648c){if(_0x55648c){_0x269de0['interaction']=_0x55648c[_0xdb35('0x6a')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11df71['user']['id'],_0x11df71[_0xdb35('0x65')]['name'],_0x11df71['user'][_0xdb35('0x6b')],_0x269de0[_0xdb35('0x6c')]['id'],_0x11df71['body']?JSON[_0xdb35('0x28')](_0x11df71[_0xdb35('0x5a')]):_0xdb35('0x6d'));return respondWithRpcPromise(_0xdb35('0x6e'),_0xdb35('0x6f'),_0x269de0);}return null;})[_0xdb35('0x38')](function(_0x11563c){var _0x3e5449=_0xdb35('0x70')+_0x11563c[_0xdb35('0x2b')][_0xdb35('0x71')];return db[_0xdb35('0x72')][_0xdb35('0x43')](_0x3e5449,{'type':db['Sequelize']['QueryTypes'][_0xdb35('0x73')],'raw':!![]})[_0xdb35('0x38')](function(_0x318c0d){return _0x318c0d;});})['then'](function(_0x2009aa){if(_0x2009aa){_0x269de0[_0xdb35('0x2b')][_0xdb35('0x74')]=_0x2009aa[0x0];if(!_0x11df71[_0xdb35('0x5a')][_0xdb35('0x64')])return;return db['User'][_0xdb35('0x57')]({'where':{'id':_0x11df71[_0xdb35('0x5a')][_0xdb35('0x64')],'role':_0xdb35('0x66')},'attributes':['id',_0xdb35('0x3a'),_0xdb35('0x75'),'email',_0xdb35('0x76')],'raw':!![]});}return null;})[_0xdb35('0x38')](function(_0x2fc9a8){if(!_0x2fc9a8)return null;_0x269de0['message'][_0xdb35('0x66')]=_0x2fc9a8;return _0x269de0;})['then'](function(_0xecf3b9){if(_0xecf3b9){if(_0x11df71[_0xdb35('0x5a')][_0xdb35('0x77')]){_0x269de0['message']['interface']=util['format'](_0xdb35('0x78'),_0x11df71['user']['name']);_0x269de0['message']['channel']=_0x269de0[_0xdb35('0x79')];_0x269de0[_0xdb35('0x2b')][_0xdb35('0x7a')]=_0x269de0[_0xdb35('0x79')];_0x269de0[_0xdb35('0x2b')][_0xdb35('0x7b')]=_0xdb35('0x5f');return respondWithRpcPromise(_0xdb35('0x7c'),'EventManager',{'event':_0xdb35('0x7d'),'message':_0x269de0[_0xdb35('0x2b')]},client9002)['then'](function(){return _0x269de0;});}return _0x269de0;}return null;})[_0xdb35('0x38')](respondWithResult(_0x274463,null))[_0xdb35('0x58')](handleError(_0x274463,null));};var interaction_log=require(_0xdb35('0x16'))(_0xdb35('0x5e'));exports[_0xdb35('0x36')]=function(_0x2d44b0,_0x1843de,_0x1a09f5){var _0x46ae60={'agent':{},'channel':_0xdb35('0x60')};if(_0x2d44b0['body']['id']){delete _0x2d44b0[_0xdb35('0x5a')]['id'];}_0x2d44b0[_0xdb35('0x5a')][_0xdb35('0x64')]=_0x2d44b0[_0xdb35('0x5a')]['UserId']||_0x2d44b0[_0xdb35('0x65')]['id'];_0x46ae60[_0xdb35('0x66')]['id']=_0x2d44b0[_0xdb35('0x5a')][_0xdb35('0x64')];return db[_0xdb35('0x3e')][_0xdb35('0x57')]({'where':{'id':_0x2d44b0[_0xdb35('0x55')]['id'],'UserId':null}})[_0xdb35('0x38')](handleEntityNotFound(_0x1843de,null))['then'](function(_0x3e35c0){if(_0x3e35c0){_0x46ae60[_0xdb35('0x2b')]=_0x3e35c0['get']({'plain':!![]});return db[_0xdb35('0x67')]['find']({'where':{'id':_0x3e35c0[_0xdb35('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1843de,null))[_0xdb35('0x38')](function(_0x126fc0){if(_0x126fc0){_0x46ae60[_0xdb35('0x6c')]=_0x126fc0[_0xdb35('0x6a')]({'plain':!![]});interaction_log[_0xdb35('0x23')](_0xdb35('0x7e'),_0x2d44b0['user']['id'],_0x2d44b0[_0xdb35('0x65')][_0xdb35('0x3a')],_0x2d44b0[_0xdb35('0x65')][_0xdb35('0x6b')],_0x46ae60['interaction']['id'],_0x2d44b0[_0xdb35('0x5a')]?JSON[_0xdb35('0x28')](_0x2d44b0[_0xdb35('0x5a')]):_0xdb35('0x6d'));return respondWithRpcPromise(_0xdb35('0x7f'),'rejectMessage',_0x46ae60);}return null;})[_0xdb35('0x38')](function(_0x1c22b7){var _0x4ad8bb=_0xdb35('0x70')+_0x1c22b7[_0xdb35('0x2b')][_0xdb35('0x71')];return db['sequelize'][_0xdb35('0x43')](_0x4ad8bb,{'type':db[_0xdb35('0x80')][_0xdb35('0x81')][_0xdb35('0x73')],'raw':!![]})[_0xdb35('0x38')](function(_0x53cbfd){return _0x53cbfd;});})['then'](function(_0x394563){if(_0x394563){_0x46ae60[_0xdb35('0x2b')][_0xdb35('0x74')]=_0x394563[0x0];if(!_0x2d44b0[_0xdb35('0x5a')][_0xdb35('0x64')])return;return db[_0xdb35('0x82')][_0xdb35('0x57')]({'where':{'id':_0x2d44b0['body'][_0xdb35('0x64')],'role':_0xdb35('0x66')},'attributes':['id',_0xdb35('0x3a'),_0xdb35('0x75'),_0xdb35('0x83'),_0xdb35('0x76')],'raw':!![]});}return null;})[_0xdb35('0x38')](function(_0x2d89e1){if(!_0x2d89e1)return null;_0x46ae60[_0xdb35('0x2b')][_0xdb35('0x66')]=_0x2d89e1;return _0x46ae60;})[_0xdb35('0x38')](function(_0x5b6fe2){if(_0x5b6fe2){_0x5b6fe2[_0xdb35('0x2b')][_0xdb35('0x84')]=util[_0xdb35('0x62')](_0xdb35('0x78'),_0x2d44b0[_0xdb35('0x65')]['name']);_0x5b6fe2['message'][_0xdb35('0x79')]=_0x46ae60[_0xdb35('0x79')];_0x5b6fe2['message'][_0xdb35('0x7a')]=_0x46ae60['channel'];_0x5b6fe2['message'][_0xdb35('0x7b')]=_0xdb35('0x36');respondWithRpcPromise(_0xdb35('0x7c'),_0xdb35('0x7c'),{'event':_0xdb35('0x85'),'message':_0x5b6fe2['message']},client9002);return _0x46ae60;}return null;})[_0xdb35('0x38')](respondWithResult(_0x1843de,null))['catch'](handleError(_0x1843de,null));}; \ No newline at end of file +var _0x57fd=['../../mysqldb','redis','localhost','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','stack','name','send','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE: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','contact','User','agent','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','fullname','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x1c095c,_0x10aa6e){var _0x366e70=function(_0x532441){while(--_0x532441){_0x1c095c['push'](_0x1c095c['shift']());}};_0x366e70(++_0x10aa6e);}(_0x57fd,0xe6));var _0xd57f=function(_0x2ecd5b,_0x207cd9){_0x2ecd5b=_0x2ecd5b-0x0;var _0x362e17=_0x57fd[_0x2ecd5b];return _0x362e17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd57f('0x0'));var zipdir=require(_0xd57f('0x1'));var jsonpatch=require(_0xd57f('0x2'));var rp=require(_0xd57f('0x3'));var moment=require('moment');var BPromise=require(_0xd57f('0x4'));var Mustache=require(_0xd57f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd57f('0x6'));var csv=require(_0xd57f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd57f('0x8'));var _=require(_0xd57f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd57f('0xa'));var deskjs=require(_0xd57f('0xb'));var toCsv=require(_0xd57f('0x7'));var querystring=require(_0xd57f('0xc'));var Papa=require(_0xd57f('0xd'));var Redis=require(_0xd57f('0xe'));var authService=require(_0xd57f('0xf'));var qs=require(_0xd57f('0x10'));var as=require(_0xd57f('0x11'));var hardwareService=require(_0xd57f('0x12'));var logger=require('../../config/logger')(_0xd57f('0x13'));var utils=require(_0xd57f('0x14'));var config=require(_0xd57f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd57f('0x16'))['db'];config[_0xd57f('0x17')]=_['defaults'](config[_0xd57f('0x17')],{'host':_0xd57f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd57f('0x19')][_0xd57f('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0xd57f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x450800,_0x1725e9,_0x4988ab,_0x37809b){return new BPromise(function(_0x105028,_0x4bdb38){var _0xd564ef=_0x37809b||client;return _0xd564ef['request'](_0x450800,_0x4988ab)[_0xd57f('0x1b')](function(_0x4d4dcd){logger[_0xd57f('0x1c')](_0xd57f('0x1d'),_0x1725e9,_0xd57f('0x1e'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1725e9,_0xd57f('0x1e'),JSON[_0xd57f('0x1f')](_0x4d4dcd));if(_0x4d4dcd[_0xd57f('0x20')]){if(_0x4d4dcd[_0xd57f('0x20')][_0xd57f('0x21')]===0x1f4){logger[_0xd57f('0x20')](_0xd57f('0x1d'),_0x1725e9,_0x4d4dcd[_0xd57f('0x20')][_0xd57f('0x22')]);return _0x4bdb38(_0x4d4dcd['error'][_0xd57f('0x22')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1725e9,_0x4d4dcd[_0xd57f('0x20')][_0xd57f('0x22')]);return _0x105028(_0x4d4dcd[_0xd57f('0x20')][_0xd57f('0x22')]);}else{logger[_0xd57f('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x1725e9,'request\x20sent');_0x105028(_0x4d4dcd[_0xd57f('0x23')][_0xd57f('0x22')]);}})[_0xd57f('0x24')](function(_0x2baf84){logger[_0xd57f('0x20')](_0xd57f('0x1d'),_0x1725e9,_0x2baf84);_0x4bdb38(_0x2baf84);});});}function respondWithStatusCode(_0x4f6563,_0x951eca){_0x951eca=_0x951eca||0xcc;return function(_0x284a86){if(_0x284a86){return _0x4f6563[_0xd57f('0x25')](_0x951eca);}return _0x4f6563['status'](_0x951eca)[_0xd57f('0x26')]();};}function respondWithResult(_0x35bd73,_0x312899){_0x312899=_0x312899||0xc8;return function(_0x3f750b){if(_0x3f750b){return _0x35bd73['status'](_0x312899)[_0xd57f('0x27')](_0x3f750b);}};}function respondWithFilteredResult(_0x4ee00c,_0x49999e){return function(_0x256ccf){if(_0x256ccf){var _0xc0f156=typeof _0x49999e[_0xd57f('0x28')]===_0xd57f('0x29')&&typeof _0x49999e[_0xd57f('0x2a')]==='undefined';var _0x536ef2=_0x256ccf[_0xd57f('0x2b')];var _0x4e8f73=_0xc0f156?0x0:_0x49999e[_0xd57f('0x28')];var _0x1eb30d=_0xc0f156?_0x256ccf[_0xd57f('0x2b')]:_0x49999e[_0xd57f('0x28')]+_0x49999e[_0xd57f('0x2a')];var _0x4e5e3c;if(_0x1eb30d>=_0x536ef2){_0x1eb30d=_0x536ef2;_0x4e5e3c=0xc8;}else{_0x4e5e3c=0xce;}_0x4ee00c[_0xd57f('0x2c')](_0x4e5e3c);return _0x4ee00c[_0xd57f('0x2d')](_0xd57f('0x2e'),_0x4e8f73+'-'+_0x1eb30d+'/'+_0x536ef2)[_0xd57f('0x27')](_0x256ccf);}return null;};}function patchUpdates(_0x4fd6bf){return function(_0x409faf){try{jsonpatch[_0xd57f('0x2f')](_0x409faf,_0x4fd6bf,!![]);}catch(_0x59ace7){return BPromise[_0xd57f('0x30')](_0x59ace7);}return _0x409faf['save']();};}function saveUpdates(_0x3c7b05,_0x52bacc){return function(_0x2572c0){if(_0x2572c0){return _0x2572c0[_0xd57f('0x31')](_0x3c7b05)['then'](function(_0x61eb12){return _0x61eb12;});}return null;};}function removeEntity(_0x2fc7ba,_0x1f8730){return function(_0x2ff664){if(_0x2ff664){return _0x2ff664[_0xd57f('0x32')]()[_0xd57f('0x1b')](function(){_0x2fc7ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0dd3,_0x128be2){return function(_0x4d8b33){if(!_0x4d8b33){_0x4e0dd3[_0xd57f('0x25')](0x194);}return _0x4d8b33;};}function handleError(_0x9a5a62,_0x1f9714){_0x1f9714=_0x1f9714||0x1f4;return function(_0x328ca6){logger[_0xd57f('0x20')](_0x328ca6[_0xd57f('0x33')]);if(_0x328ca6[_0xd57f('0x34')]){delete _0x328ca6[_0xd57f('0x34')];}_0x9a5a62[_0xd57f('0x2c')](_0x1f9714)[_0xd57f('0x35')](_0x328ca6);};}exports['index']=function(_0x2e3352,_0x11bab8){var _0xea2078={},_0x1845b0={},_0x47a4c2={'count':0x0,'rows':[]};var _0x35c677=_[_0xd57f('0x36')](db['OpenchannelMessage']['rawAttributes'],function(_0x485eed){return{'name':_0x485eed[_0xd57f('0x37')],'type':_0x485eed['type'][_0xd57f('0x38')]};});_0x1845b0[_0xd57f('0x39')]=_['map'](_0x35c677,'name');_0x1845b0[_0xd57f('0x3a')]=_[_0xd57f('0x3b')](_0x2e3352['query']);_0x1845b0['filters']=_[_0xd57f('0x3c')](_0x1845b0[_0xd57f('0x39')],_0x1845b0[_0xd57f('0x3a')]);_0xea2078[_0xd57f('0x3d')]=_[_0xd57f('0x3c')](_0x1845b0[_0xd57f('0x39')],qs['fields'](_0x2e3352['query'][_0xd57f('0x3e')]));_0xea2078[_0xd57f('0x3d')]=_0xea2078['attributes'][_0xd57f('0x3f')]?_0xea2078['attributes']:_0x1845b0[_0xd57f('0x39')];if(!_0x2e3352[_0xd57f('0x3a')][_0xd57f('0x40')]('nolimit')){_0xea2078[_0xd57f('0x2a')]=qs[_0xd57f('0x2a')](_0x2e3352['query'][_0xd57f('0x2a')]);_0xea2078[_0xd57f('0x28')]=qs['offset'](_0x2e3352[_0xd57f('0x3a')][_0xd57f('0x28')]);}_0xea2078[_0xd57f('0x41')]=qs[_0xd57f('0x42')](_0x2e3352[_0xd57f('0x3a')][_0xd57f('0x42')]);_0xea2078[_0xd57f('0x43')]=qs[_0xd57f('0x44')](_[_0xd57f('0x45')](_0x2e3352['query'],_0x1845b0[_0xd57f('0x44')]),_0x35c677);if(_0x2e3352[_0xd57f('0x3a')][_0xd57f('0x46')]){_0xea2078['where']=_[_0xd57f('0x47')](_0xea2078[_0xd57f('0x43')],{'$or':_[_0xd57f('0x36')](_0x35c677,function(_0x4f0d40){if(_0x4f0d40[_0xd57f('0x48')]!==_0xd57f('0x49')){var _0x116a9f={};_0x116a9f[_0x4f0d40['name']]={'$like':'%'+_0x2e3352[_0xd57f('0x3a')][_0xd57f('0x46')]+'%'};return _0x116a9f;}})});}_0xea2078=_['merge']({},_0xea2078,_0x2e3352[_0xd57f('0x4a')]);var _0x3653f5={'where':_0xea2078[_0xd57f('0x43')]};return db[_0xd57f('0x4b')][_0xd57f('0x2b')](_0x3653f5)[_0xd57f('0x1b')](function(_0x25dda7){_0x47a4c2[_0xd57f('0x2b')]=_0x25dda7;if(_0x2e3352['query'][_0xd57f('0x4c')]){_0xea2078[_0xd57f('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xd57f('0x4e')](_0xea2078);})[_0xd57f('0x1b')](function(_0x3b664b){_0x47a4c2[_0xd57f('0x4f')]=_0x3b664b;return _0x47a4c2;})['then'](respondWithFilteredResult(_0x11bab8,_0xea2078))[_0xd57f('0x24')](handleError(_0x11bab8,null));};exports[_0xd57f('0x50')]=function(_0x555825,_0x3e377b){var _0x5f1b45={'raw':!![],'where':{'id':_0x555825[_0xd57f('0x51')]['id']}},_0x32596d={};_0x32596d[_0xd57f('0x39')]=_['keys'](db[_0xd57f('0x4b')][_0xd57f('0x52')]);_0x32596d[_0xd57f('0x3a')]=_['keys'](_0x555825['query']);_0x32596d[_0xd57f('0x44')]=_[_0xd57f('0x3c')](_0x32596d[_0xd57f('0x39')],_0x32596d[_0xd57f('0x3a')]);_0x5f1b45[_0xd57f('0x3d')]=_[_0xd57f('0x3c')](_0x32596d[_0xd57f('0x39')],qs[_0xd57f('0x3e')](_0x555825['query'][_0xd57f('0x3e')]));_0x5f1b45[_0xd57f('0x3d')]=_0x5f1b45[_0xd57f('0x3d')]['length']?_0x5f1b45[_0xd57f('0x3d')]:_0x32596d[_0xd57f('0x39')];if(_0x555825[_0xd57f('0x3a')][_0xd57f('0x4c')]){_0x5f1b45[_0xd57f('0x4d')]=[{'all':!![]}];}_0x5f1b45=_['merge']({},_0x5f1b45,_0x555825['options']);return db[_0xd57f('0x4b')][_0xd57f('0x53')](_0x5f1b45)[_0xd57f('0x1b')](handleEntityNotFound(_0x3e377b,null))['then'](respondWithResult(_0x3e377b,null))['catch'](handleError(_0x3e377b,null));};exports[_0xd57f('0x54')]=function(_0x240185,_0xda660c){return db[_0xd57f('0x4b')][_0xd57f('0x54')](_0x240185[_0xd57f('0x55')],{})[_0xd57f('0x1b')](respondWithResult(_0xda660c,0xc9))[_0xd57f('0x24')](handleError(_0xda660c,null));};exports[_0xd57f('0x31')]=function(_0x2e533a,_0x4c643c){if(_0x2e533a[_0xd57f('0x55')]['id']){delete _0x2e533a[_0xd57f('0x55')]['id'];}return db[_0xd57f('0x4b')][_0xd57f('0x53')]({'where':{'id':_0x2e533a['params']['id']}})[_0xd57f('0x1b')](handleEntityNotFound(_0x4c643c,null))[_0xd57f('0x1b')](saveUpdates(_0x2e533a[_0xd57f('0x55')],null))['then'](respondWithResult(_0x4c643c,null))[_0xd57f('0x24')](handleError(_0x4c643c,null));};exports[_0xd57f('0x32')]=function(_0x53e825,_0x429265){return db[_0xd57f('0x4b')]['find']({'where':{'id':_0x53e825[_0xd57f('0x51')]['id']}})[_0xd57f('0x1b')](handleEntityNotFound(_0x429265,null))['then'](removeEntity(_0x429265,null))[_0xd57f('0x24')](handleError(_0x429265,null));};exports[_0xd57f('0x56')]=function(_0x318059,_0x14e0d2){return db[_0xd57f('0x4b')][_0xd57f('0x56')]()[_0xd57f('0x1b')](respondWithResult(_0x14e0d2,null))[_0xd57f('0x24')](handleError(_0x14e0d2,null));};var interaction_log=require('../../config/logger')(_0xd57f('0x57'));exports[_0xd57f('0x58')]=function(_0x314ab1,_0x56ee9f,_0x3c2a4a){var _0x448e03={'agent':{},'channel':_0xd57f('0x59')};if(_0x314ab1[_0xd57f('0x55')]['id']){delete _0x314ab1[_0xd57f('0x55')]['id'];}_0x314ab1[_0xd57f('0x55')]['read']=!![];_0x314ab1[_0xd57f('0x55')]['readAt']=moment()[_0xd57f('0x5a')](_0xd57f('0x5b'));_0x314ab1[_0xd57f('0x55')][_0xd57f('0x5c')]=_0x314ab1['body']['UserId']||_0x314ab1[_0xd57f('0x5d')]['id'];_0x448e03['agent']['id']=_0x314ab1['body'][_0xd57f('0x5c')];return db[_0xd57f('0x4b')][_0xd57f('0x53')]({'where':{'id':_0x314ab1[_0xd57f('0x51')]['id'],'UserId':null}})[_0xd57f('0x1b')](handleEntityNotFound(_0x56ee9f,null))[_0xd57f('0x1b')](saveUpdates(_0x314ab1[_0xd57f('0x55')],null))['then'](function(_0x2440cf){if(_0x2440cf){_0x448e03[_0xd57f('0x22')]=_0x2440cf[_0xd57f('0x5e')]({'plain':!![]});return db[_0xd57f('0x5f')][_0xd57f('0x53')]({'where':{'id':_0x2440cf[_0xd57f('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x56ee9f,null))[_0xd57f('0x1b')](function(_0x193685){if(_0x193685){return _0x193685['update']({'UserId':_0x314ab1[_0xd57f('0x55')][_0xd57f('0x5c')],'read1stAt':_[_0xd57f('0x61')](_0x193685[_0xd57f('0x62')])?moment()[_0xd57f('0x5a')](_0xd57f('0x5b')):undefined});}return null;})[_0xd57f('0x1b')](function(_0x260b2b){if(_0x260b2b){_0x448e03['interaction']=_0x260b2b['get']({'plain':!![]});interaction_log[_0xd57f('0x1c')](_0xd57f('0x63'),_0x314ab1[_0xd57f('0x5d')]['id'],_0x314ab1[_0xd57f('0x5d')]['name'],_0x314ab1[_0xd57f('0x5d')][_0xd57f('0x64')],_0x448e03['interaction']['id'],_0x314ab1[_0xd57f('0x55')]?JSON[_0xd57f('0x1f')](_0x314ab1[_0xd57f('0x55')]):'null');return respondWithRpcPromise(_0xd57f('0x65'),_0xd57f('0x66'),_0x448e03);}return null;})[_0xd57f('0x1b')](function(_0x4145dc){var _0x320824=_0xd57f('0x67')+_0x4145dc[_0xd57f('0x22')][_0xd57f('0x68')];return db[_0xd57f('0x69')][_0xd57f('0x3a')](_0x320824,{'type':db[_0xd57f('0x6a')][_0xd57f('0x6b')]['SELECT'],'raw':!![]})[_0xd57f('0x1b')](function(_0xa31569){return _0xa31569;});})['then'](function(_0x9b4019){if(_0x9b4019){_0x448e03['message'][_0xd57f('0x6c')]=_0x9b4019[0x0];if(!_0x314ab1[_0xd57f('0x55')][_0xd57f('0x5c')])return;return db[_0xd57f('0x6d')]['find']({'where':{'id':_0x314ab1[_0xd57f('0x55')][_0xd57f('0x5c')],'role':_0xd57f('0x6e')},'attributes':['id',_0xd57f('0x34'),'fullname','email',_0xd57f('0x6f')],'raw':!![]});}return null;})[_0xd57f('0x1b')](function(_0xa0f6ac){if(!_0xa0f6ac)return null;_0x448e03[_0xd57f('0x22')][_0xd57f('0x6e')]=_0xa0f6ac;return _0x448e03;})[_0xd57f('0x1b')](function(_0x12dcef){if(_0x12dcef){if(_0x314ab1[_0xd57f('0x55')][_0xd57f('0x70')]){_0x448e03[_0xd57f('0x22')][_0xd57f('0x71')]=util[_0xd57f('0x5a')](_0xd57f('0x72'),_0x314ab1[_0xd57f('0x5d')]['name']);_0x448e03[_0xd57f('0x22')][_0xd57f('0x73')]=_0x448e03[_0xd57f('0x73')];_0x448e03[_0xd57f('0x22')][_0xd57f('0x74')]=_0x448e03[_0xd57f('0x73')];_0x448e03[_0xd57f('0x22')][_0xd57f('0x75')]=_0xd57f('0x58');return respondWithRpcPromise(_0xd57f('0x76'),_0xd57f('0x76'),{'event':_0xd57f('0x77'),'message':_0x448e03[_0xd57f('0x22')]},client9002)[_0xd57f('0x1b')](function(){return _0x448e03;});}return _0x448e03;}return null;})['then'](respondWithResult(_0x56ee9f,null))[_0xd57f('0x24')](handleError(_0x56ee9f,null));};var interaction_log=require('../../config/logger')(_0xd57f('0x57'));exports[_0xd57f('0x30')]=function(_0xf8293,_0x3a2a13,_0x7eaf85){var _0x5e217={'agent':{},'channel':_0xd57f('0x59')};if(_0xf8293[_0xd57f('0x55')]['id']){delete _0xf8293['body']['id'];}_0xf8293[_0xd57f('0x55')][_0xd57f('0x5c')]=_0xf8293['body'][_0xd57f('0x5c')]||_0xf8293['user']['id'];_0x5e217['agent']['id']=_0xf8293['body'][_0xd57f('0x5c')];return db[_0xd57f('0x4b')][_0xd57f('0x53')]({'where':{'id':_0xf8293[_0xd57f('0x51')]['id'],'UserId':null}})[_0xd57f('0x1b')](handleEntityNotFound(_0x3a2a13,null))[_0xd57f('0x1b')](function(_0x2ae6cc){if(_0x2ae6cc){_0x5e217[_0xd57f('0x22')]=_0x2ae6cc[_0xd57f('0x5e')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2ae6cc[_0xd57f('0x60')]}});}return null;})[_0xd57f('0x1b')](handleEntityNotFound(_0x3a2a13,null))[_0xd57f('0x1b')](function(_0x13ee41){if(_0x13ee41){_0x5e217[_0xd57f('0x78')]=_0x13ee41[_0xd57f('0x5e')]({'plain':!![]});interaction_log[_0xd57f('0x1c')](_0xd57f('0x79'),_0xf8293['user']['id'],_0xf8293[_0xd57f('0x5d')][_0xd57f('0x34')],_0xf8293['user'][_0xd57f('0x64')],_0x5e217[_0xd57f('0x78')]['id'],_0xf8293[_0xd57f('0x55')]?JSON['stringify'](_0xf8293[_0xd57f('0x55')]):'null');return respondWithRpcPromise('RejectMessage',_0xd57f('0x7a'),_0x5e217);}return null;})[_0xd57f('0x1b')](function(_0x5f0f18){var _0x4eaf18='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f0f18[_0xd57f('0x22')]['ContactId'];return db['sequelize'][_0xd57f('0x3a')](_0x4eaf18,{'type':db[_0xd57f('0x6a')][_0xd57f('0x6b')][_0xd57f('0x7b')],'raw':!![]})[_0xd57f('0x1b')](function(_0x4e4e32){return _0x4e4e32;});})[_0xd57f('0x1b')](function(_0x3ea817){if(_0x3ea817){_0x5e217[_0xd57f('0x22')][_0xd57f('0x6c')]=_0x3ea817[0x0];if(!_0xf8293[_0xd57f('0x55')]['UserId'])return;return db[_0xd57f('0x6d')]['find']({'where':{'id':_0xf8293[_0xd57f('0x55')][_0xd57f('0x5c')],'role':_0xd57f('0x6e')},'attributes':['id','name',_0xd57f('0x7c'),'email',_0xd57f('0x6f')],'raw':!![]});}return null;})[_0xd57f('0x1b')](function(_0x3b1f1e){if(!_0x3b1f1e)return null;_0x5e217[_0xd57f('0x22')]['agent']=_0x3b1f1e;return _0x5e217;})[_0xd57f('0x1b')](function(_0xfd0752){if(_0xfd0752){_0xfd0752[_0xd57f('0x22')][_0xd57f('0x71')]=util[_0xd57f('0x5a')]('SIP/%s',_0xf8293[_0xd57f('0x5d')]['name']);_0xfd0752['message'][_0xd57f('0x73')]=_0x5e217[_0xd57f('0x73')];_0xfd0752[_0xd57f('0x22')][_0xd57f('0x74')]=_0x5e217['channel'];_0xfd0752['message']['event']='reject';respondWithRpcPromise('EventManager',_0xd57f('0x76'),{'event':_0xd57f('0x7d'),'message':_0xfd0752['message']},client9002);return _0x5e217;}return null;})[_0xd57f('0x1b')](respondWithResult(_0x3a2a13,null))[_0xd57f('0x24')](handleError(_0x3a2a13,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a0a37a6..e0b7a9d 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 _0x1e89=['hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1e89,0x19d));var _0x91e8=function(_0x3940e8,_0x14ad62){_0x3940e8=_0x3940e8-0x0;var _0x5f2f46=_0x1e89[_0x3940e8];return _0x5f2f46;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x91e8('0x0'))['db'][_0x91e8('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x91e8('0x2')](0x0);var events={'afterCreate':_0x91e8('0x3'),'afterUpdate':_0x91e8('0x4'),'afterDestroy':_0x91e8('0x5')};function emitEvent(_0x18aa65){return function(_0xadd437,_0x4432b5,_0x53d90c){OpenchannelMessageEvents['emit'](_0x18aa65+':'+_0xadd437['id'],_0xadd437);OpenchannelMessageEvents[_0x91e8('0x6')](_0x18aa65,_0xadd437);_0x53d90c(null);};}for(var e in events){if(events[_0x91e8('0x7')](e)){var event=events[e];OpenchannelMessage[_0x91e8('0x8')](e,emitEvent(event));}}module[_0x91e8('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x44d5=['hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x475333,_0x6c1716){var _0x2059be=function(_0x4bfbe9){while(--_0x4bfbe9){_0x475333['push'](_0x475333['shift']());}};_0x2059be(++_0x6c1716);}(_0x44d5,0xda));var _0x544d=function(_0x25e296,_0x172c5e){_0x25e296=_0x25e296-0x0;var _0x3cd140=_0x44d5[_0x25e296];return _0x3cd140;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x544d('0x0'))['db'][_0x544d('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x544d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x544d('0x3'),'afterDestroy':_0x544d('0x4')};function emitEvent(_0x25fa9a){return function(_0x3cff30,_0x27e8c2,_0x3ea18e){OpenchannelMessageEvents['emit'](_0x25fa9a+':'+_0x3cff30['id'],_0x3cff30);OpenchannelMessageEvents[_0x544d('0x5')](_0x25fa9a,_0x3cff30);_0x3ea18e(null);};}for(var e in events){if(events[_0x544d('0x6')](e)){var event=events[e];OpenchannelMessage[_0x544d('0x7')](e,emitEvent(event));}}module[_0x544d('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c1b7b41..2318b01 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 _0xc641=['format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','body','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','secret','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0xc641,0x197));var _0x1c64=function(_0x52f627,_0x604c9e){_0x52f627=_0x52f627-0x0;var _0x39279f=_0xc641[_0x52f627];return _0x39279f;};'use strict';var _=require('lodash');var util=require(_0x1c64('0x0'));var logger=require(_0x1c64('0x1'))(_0x1c64('0x2'));var moment=require(_0x1c64('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c64('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c64('0x5'));var config=require(_0x1c64('0x6'));var attributes=require(_0x1c64('0x7'));module[_0x1c64('0x8')]=function(_0x5e4d90,_0x23da6a){return _0x5e4d90[_0x1c64('0x9')](_0x1c64('0xa'),attributes,{'tableName':_0x1c64('0xb'),'paranoid':![],'indexes':[{'name':_0x1c64('0xc'),'fields':['body'],'type':_0x1c64('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4007cf,_0x47683d,_0x3992ca){var _0x43280d=_0x5e4d90[_0x1c64('0xe')];var _0x596d63=_0x4007cf[_0x1c64('0xf')]({'plain':!![]});if(_0x596d63[_0x1c64('0x10')][_0x1c64('0x11')]()==='in'||_0x596d63[_0x1c64('0x10')]['toLowerCase']()==='out'&&!_0x596d63['secret']&&!_[_0x1c64('0x12')](_0x596d63[_0x1c64('0x13')])){_0x43280d[_0x1c64('0x14')][_0x1c64('0x15')]({'where':{'id':_0x596d63[_0x1c64('0x16')]}})[_0x1c64('0x17')](function(_0x1322ee){if(_0x1322ee){_0x1322ee[_0x1c64('0x18')]({'lastMsgAt':_0x596d63[_0x1c64('0x19')],'lastMsgDirection':_0x596d63['direction'][_0x1c64('0x11')]()});}})[_0x1c64('0x1a')](function(_0x310a42){console[_0x1c64('0x1b')](_0x310a42);});}if(_0x596d63['direction']===_0x1c64('0x1c')&&!_0x596d63[_0x1c64('0x1d')]){var _0xd2c751;_0x43280d['CmContact'][_0x1c64('0x1e')]()[_0x1c64('0x17')](function(_0x10036e){return _0x43280d[_0x1c64('0x1f')][_0x1c64('0x20')]({'where':{'id':_0x596d63[_0x1c64('0x21')]},'include':[{'model':_0x43280d[_0x1c64('0x14')],'as':_0x1c64('0x22'),'where':{'id':_0x596d63[_0x1c64('0x16')]},'limit':0x1,'include':[{'model':_0x43280d[_0x1c64('0x23')],'as':_0x1c64('0x24'),'attributes':_[_0x1c64('0x25')](_0x10036e)}]}]});})[_0x1c64('0x17')](function(_0x1eb8d5){_0xd2c751=_0x1eb8d5[_0x1c64('0xf')]({'plain':!![]});if(_0xd2c751&&_0xd2c751['replyUri']){logger[_0x1c64('0x26')](_0x1c64('0x27'),_0x1c64('0x28'),util[_0x1c64('0x29')](_0x1c64('0x2a'),_0x596d63['id'],_0xd2c751[_0x1c64('0x2b')]));if(_0xd2c751[_0x1c64('0x22')]&&_0xd2c751[_0x1c64('0x22')][_0x1c64('0x2c')]){_0x596d63[_0x1c64('0x2d')]=_[_0x1c64('0x2e')](_0xd2c751[_0x1c64('0x22')][0x0],_0x1c64('0x24'));_0x596d63['Contact']=_0xd2c751[_0x1c64('0x22')][0x0]['Contact'];}var _0x47683d={'method':_0x1c64('0x2f'),'uri':encodeURI(_0xd2c751[_0x1c64('0x2b')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x47683d[_0x1c64('0x30')]){case _0x1c64('0x31'):_0x47683d['qs']=_0x596d63;break;case'POST':_0x47683d[_0x1c64('0x32')]=_0x596d63;break;}return rp(_0x47683d)['then'](function(_0x59f4fe){logger[_0x1c64('0x26')](_0x1c64('0x27'),_0x1c64('0x28'),util[_0x1c64('0x29')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x596d63['id'],_0xd2c751[_0x1c64('0x2b')]));if(_0x59f4fe[_0x1c64('0x32')][_0x1c64('0x33')]&&_0x59f4fe[_0x1c64('0x32')][_0x1c64('0x33')]!=_0x596d63[_0x1c64('0x2d')][_0x1c64('0x33')]){return _0x43280d['OpenchannelInteraction'][_0x1c64('0x18')]({'threadId':_0x59f4fe[_0x1c64('0x32')][_0x1c64('0x33')]},{'where':{'id':_0x596d63[_0x1c64('0x2d')]['id']}});}else{return;}})[_0x1c64('0x17')](function(){return _0x4007cf[_0x1c64('0x18')]({'read':!![]});})[_0x1c64('0x1a')](function(_0x2a9df8){logger[_0x1c64('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0x1c64('0x28'),util[_0x1c64('0x34')](_0x2a9df8,{'showHidden':![],'depth':null}));_0x3992ca();});}else{_0x3992ca();}})[_0x1c64('0x35')](function(){_0x3992ca();});}else{_0x3992ca();}}},'charset':_0x1c64('0x36'),'collate':_0x1c64('0x37')});}; \ No newline at end of file +var _0x399b=['toLowerCase','out','UserId','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','info','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','omit','POST','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','afterCreate','inspect','finally','utf8mb4','lodash','../../config/logger','request-promise','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','get','direction'];(function(_0x22abf9,_0x1ce155){var _0xb5ebc6=function(_0x2b82a1){while(--_0x2b82a1){_0x22abf9['push'](_0x22abf9['shift']());}};_0xb5ebc6(++_0x1ce155);}(_0x399b,0x12e));var _0xb399=function(_0x48a0b5,_0x5ea365){_0x48a0b5=_0x48a0b5-0x0;var _0x217344=_0x399b[_0x48a0b5];return _0x217344;};'use strict';var _=require(_0xb399('0x0'));var util=require('util');var logger=require(_0xb399('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb399('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb399('0x3'));var attributes=require(_0xb399('0x4'));module[_0xb399('0x5')]=function(_0x2f8574,_0x5e6c14){return _0x2f8574[_0xb399('0x6')](_0xb399('0x7'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xb399('0x8'),'fields':[_0xb399('0x9')],'type':_0xb399('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdba868,_0x185471,_0x822775){var _0x4efbb0=_0x2f8574['models'];var _0x2f3416=_0xdba868[_0xb399('0xb')]({'plain':!![]});if(_0x2f3416[_0xb399('0xc')][_0xb399('0xd')]()==='in'||_0x2f3416[_0xb399('0xc')]['toLowerCase']()===_0xb399('0xe')&&!_0x2f3416['secret']&&!_['isNil'](_0x2f3416[_0xb399('0xf')])){_0x4efbb0['OpenchannelInteraction']['findOne']({'where':{'id':_0x2f3416[_0xb399('0x10')]}})[_0xb399('0x11')](function(_0x249f8f){if(_0x249f8f){_0x249f8f['update']({'lastMsgAt':_0x2f3416[_0xb399('0x12')],'lastMsgDirection':_0x2f3416[_0xb399('0xc')][_0xb399('0xd')]()});}})[_0xb399('0x13')](function(_0xfe60b1){console[_0xb399('0x14')](_0xfe60b1);});}if(_0x2f3416[_0xb399('0xc')]==='out'&&!_0x2f3416['secret']){var _0x2dcdea;_0x4efbb0[_0xb399('0x15')][_0xb399('0x16')]()[_0xb399('0x11')](function(_0x4e0375){return _0x4efbb0[_0xb399('0x17')][_0xb399('0x18')]({'where':{'id':_0x2f3416[_0xb399('0x19')]},'include':[{'model':_0x4efbb0[_0xb399('0x1a')],'as':_0xb399('0x1b'),'where':{'id':_0x2f3416['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x4efbb0[_0xb399('0x15')],'as':_0xb399('0x1c'),'attributes':_['keys'](_0x4e0375)}]}]});})[_0xb399('0x11')](function(_0x419ebf){_0x2dcdea=_0x419ebf[_0xb399('0xb')]({'plain':!![]});if(_0x2dcdea&&_0x2dcdea['replyUri']){logger[_0xb399('0x1d')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xb399('0x1e')](_0xb399('0x1f'),_0x2f3416['id'],_0x2dcdea[_0xb399('0x20')]));if(_0x2dcdea[_0xb399('0x1b')]&&_0x2dcdea[_0xb399('0x1b')]['length']){_0x2f3416['Interaction']=_[_0xb399('0x21')](_0x2dcdea['Interactions'][0x0],_0xb399('0x1c'));_0x2f3416['Contact']=_0x2dcdea[_0xb399('0x1b')][0x0][_0xb399('0x1c')];}var _0x185471={'method':_0xb399('0x22'),'uri':encodeURI(_0x2dcdea[_0xb399('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x185471['method']){case _0xb399('0x23'):_0x185471['qs']=_0x2f3416;break;case'POST':_0x185471['body']=_0x2f3416;break;}return rp(_0x185471)['then'](function(_0x3f461c){logger[_0xb399('0x1d')](_0xb399('0x24'),'afterCreate',util['format'](_0xb399('0x25'),_0x2f3416['id'],_0x2dcdea[_0xb399('0x20')]));if(_0x3f461c[_0xb399('0x9')][_0xb399('0x26')]&&_0x3f461c[_0xb399('0x9')]['threadId']!=_0x2f3416[_0xb399('0x27')]['threadId']){return _0x4efbb0[_0xb399('0x1a')]['update']({'threadId':_0x3f461c['body'][_0xb399('0x26')]},{'where':{'id':_0x2f3416[_0xb399('0x27')]['id']}});}else{return;}})[_0xb399('0x11')](function(){return _0xdba868[_0xb399('0x28')]({'read':!![]});})[_0xb399('0x13')](function(_0x7f5bfd){logger[_0xb399('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0xb399('0x29'),util[_0xb399('0x2a')](_0x7f5bfd,{'showHidden':![],'depth':null}));_0x822775();});}else{_0x822775();}})[_0xb399('0x2b')](function(){_0x822775();});}else{_0x822775();}}},'charset':_0xb399('0x2c'),'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 3a6d6d4..466cdd1 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x5d0e63,_0x4ce59c){var _0x3b0d95=function(_0x381d06){while(--_0x381d06){_0x5d0e63['push'](_0x5d0e63['shift']());}};_0x3b0d95(++_0x4ce59c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x0b0e[_0x210603];return _0x1bcb7d;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x331c1c,_0x13bef8){var _0x59040a=function(_0x524bbb){while(--_0x524bbb){_0x331c1c['push'](_0x331c1c['shift']());}};_0x59040a(++_0x13bef8);}(_0x2ef3,0xba));var _0x32ef=function(_0x2ce9e0,_0x18662d){_0x2ce9e0=_0x2ce9e0-0x0;var _0x2f8f69=_0x2ef3[_0x2ce9e0];return _0x2f8f69;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 9f2a55b..627f909 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 _0xcfab=['./openchannelMessage.events','remove','removeListener','register','length'];(function(_0x5073eb,_0x47074a){var _0x18e7bf=function(_0xc10a5){while(--_0xc10a5){_0x5073eb['push'](_0x5073eb['shift']());}};_0x18e7bf(++_0x47074a);}(_0xcfab,0x1e0));var _0xbcfa=function(_0x3c365e,_0x2afedb){_0x3c365e=_0x3c365e-0x0;var _0x4a7b59=_0xcfab[_0x3c365e];return _0x4a7b59;};'use strict';var OpenchannelMessageEvents=require(_0xbcfa('0x0'));var events=['save',_0xbcfa('0x1'),'update'];function createListener(_0x253680,_0x4cb4f2){return function(_0x26cfdc){_0x4cb4f2['emit'](_0x253680,_0x26cfdc);};}function removeListener(_0x5281df,_0x31c65d){return function(){OpenchannelMessageEvents[_0xbcfa('0x2')](_0x5281df,_0x31c65d);};}exports[_0xbcfa('0x3')]=function(_0x5d416a){for(var _0x2a8801=0x0,_0x12b146=events[_0xbcfa('0x4')];_0x2a8801<_0x12b146;_0x2a8801++){var _0x36bb2b=events[_0x2a8801];var _0x59e63b=createListener('openchannelMessage:'+_0x36bb2b,_0x5d416a);OpenchannelMessageEvents['on'](_0x36bb2b,_0x59e63b);}}; \ No newline at end of file +var _0x242e=['emit','removeListener','openchannelMessage:','./openchannelMessage.events','remove','update'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x242e,0x12f));var _0xe242=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x242e[_0x138adb];return _0x1b27f2;};'use strict';var OpenchannelMessageEvents=require(_0xe242('0x0'));var events=['save',_0xe242('0x1'),_0xe242('0x2')];function createListener(_0x5a24a7,_0x579440){return function(_0xf85009){_0x579440[_0xe242('0x3')](_0x5a24a7,_0xf85009);};}function removeListener(_0x35be65,_0x1da0f6){return function(){OpenchannelMessageEvents[_0xe242('0x4')](_0x35be65,_0x1da0f6);};}exports['register']=function(_0x53fdde){for(var _0x362bb0=0x0,_0x44a5a7=events['length'];_0x362bb0<_0x44a5a7;_0x362bb0++){var _0x28385b=events[_0x362bb0];var _0x1a4c05=createListener(_0xe242('0x5')+_0x28385b,_0x53fdde);OpenchannelMessageEvents['on'](_0x28385b,_0x1a4c05);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 0b2a582..32e8ecd 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 _0xf23c=['get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','update','delete','destroy','/:id/users','removeAgents','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0x24efe1,_0x48521b){var _0x17ef14=function(_0x17b791){while(--_0x17b791){_0x24efe1['push'](_0x24efe1['shift']());}};_0x17ef14(++_0x48521b);}(_0xf23c,0x131));var _0xcf23=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0xf23c[_0x254081];return _0x5d1e2a;};'use strict';var multer=require('multer');var util=require(_0xcf23('0x0'));var path=require(_0xcf23('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf23('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcf23('0x3'));var interaction=require(_0xcf23('0x4'));var config=require(_0xcf23('0x5'));var controller=require(_0xcf23('0x6'));router[_0xcf23('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xcf23('0x8')](),controller[_0xcf23('0x9')]);router[_0xcf23('0x7')](_0xcf23('0xa'),auth[_0xcf23('0x8')](),controller[_0xcf23('0xb')]);router['get'](_0xcf23('0xc'),auth[_0xcf23('0x8')](),controller[_0xcf23('0xd')]);router[_0xcf23('0x7')](_0xcf23('0xe'),auth['isAuthenticated'](),controller[_0xcf23('0xf')]);router['get']('/:id/users',auth[_0xcf23('0x8')](),controller['getAgents']);router[_0xcf23('0x10')]('/',auth['isAuthenticated'](),controller[_0xcf23('0x11')]);router[_0xcf23('0x10')](_0xcf23('0xe'),auth[_0xcf23('0x8')](),controller[_0xcf23('0x12')]);router[_0xcf23('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xcf23('0x13')]);router[_0xcf23('0x14')]('/:id',auth[_0xcf23('0x8')](),controller[_0xcf23('0x15')]);router[_0xcf23('0x16')](_0xcf23('0xa'),auth['isAuthenticated'](),controller[_0xcf23('0x17')]);router[_0xcf23('0x16')](_0xcf23('0xe'),auth[_0xcf23('0x8')](),controller['removeTeams']);router[_0xcf23('0x16')](_0xcf23('0x18'),auth[_0xcf23('0x8')](),controller[_0xcf23('0x19')]);module['exports']=router; \ No newline at end of file +var _0xe29c=['/:id/teams','getTeams','getAgents','create','post','/:id/users','put','delete','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers'];(function(_0x204d08,_0x27d5b6){var _0x142bd9=function(_0x20d8f6){while(--_0x20d8f6){_0x204d08['push'](_0x204d08['shift']());}};_0x142bd9(++_0x27d5b6);}(_0xe29c,0xe3));var _0xce29=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xe29c[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require(_0xce29('0x0'));var path=require('path');var timeout=require(_0xce29('0x1'));var express=require(_0xce29('0x2'));var router=express[_0xce29('0x3')]();var fs_extra=require(_0xce29('0x4'));var auth=require(_0xce29('0x5'));var interaction=require(_0xce29('0x6'));var config=require(_0xce29('0x7'));var controller=require(_0xce29('0x8'));router[_0xce29('0x9')]('/',auth[_0xce29('0xa')](),controller['index']);router['get'](_0xce29('0xb'),auth[_0xce29('0xa')](),controller[_0xce29('0xc')]);router['get'](_0xce29('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xce29('0x9')](_0xce29('0xe'),auth[_0xce29('0xa')](),controller[_0xce29('0xf')]);router[_0xce29('0x9')](_0xce29('0x10'),auth['isAuthenticated'](),controller[_0xce29('0x11')]);router['get']('/:id/users',auth[_0xce29('0xa')](),controller[_0xce29('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xce29('0x13')]);router[_0xce29('0x14')](_0xce29('0x10'),auth[_0xce29('0xa')](),controller['addTeams']);router[_0xce29('0x14')](_0xce29('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0xce29('0x16')]('/:id',auth[_0xce29('0xa')](),controller['update']);router[_0xce29('0x17')](_0xce29('0xd'),auth[_0xce29('0xa')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xce29('0xa')](),controller[_0xce29('0x18')]);router[_0xce29('0x17')](_0xce29('0x15'),auth[_0xce29('0xa')](),controller[_0xce29('0x19')]);module[_0xce29('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index aefbffa..afa5b41 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 _0xb583=['sequelize','exports','STRING','name','INTEGER','beepall','roundrobin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb583,0xe7));var _0x3b58=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb583[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x3b58('0x0'));module[_0x3b58('0x1')]={'name':{'type':Sequelize[_0x3b58('0x2')],'unique':_0x3b58('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3b58('0x2')]},'timeout':{'type':Sequelize[_0x3b58('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x3b58('0x5'),_0x3b58('0x6'))}}; \ No newline at end of file +var _0xca1c=['sequelize','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x46f799,_0x2c1268){var _0x520d23=function(_0x56efcb){while(--_0x56efcb){_0x46f799['push'](_0x46f799['shift']());}};_0x520d23(++_0x2c1268);}(_0xca1c,0x17a));var _0xcca1=function(_0x1ad811,_0x59678e){_0x1ad811=_0x1ad811-0x0;var _0x588dd4=_0xca1c[_0x1ad811];return _0x588dd4;};'use strict';var Sequelize=require(_0xcca1('0x0'));module['exports']={'name':{'type':Sequelize[_0xcca1('0x1')],'unique':_0xcca1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcca1('0x1')]},'timeout':{'type':Sequelize[_0xcca1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcca1('0x4')]('rrmemory','beepall',_0xcca1('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 3986ec8..fa47904 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 _0x39bd=['format','SIP','openchannelPause','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','bluebird','util','ioredis','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','where','include','findAll','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows'];(function(_0x2d1919,_0x3d10e4){var _0x3de419=function(_0x2f8aef){while(--_0x2f8aef){_0x2d1919['push'](_0x2d1919['shift']());}};_0x3de419(++_0x3d10e4);}(_0x39bd,0x18d));var _0xd39b=function(_0x465754,_0x5511a1){_0x465754=_0x465754-0x0;var _0xffe5c8=_0x39bd[_0x465754];return _0xffe5c8;};'use strict';var BPromise=require(_0xd39b('0x0'));var util=require(_0xd39b('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xd39b('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd39b('0x3'));var config=require(_0xd39b('0x4'));var db=require(_0xd39b('0x5'))['db'];config[_0xd39b('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd39b('0x7'))(new Redis(config[_0xd39b('0x6')]));require(_0xd39b('0x8'))[_0xd39b('0x9')](socket);function respondWithStatusCode(_0x20dc59,_0x3f2049){_0x3f2049=_0x3f2049||0xcc;return function(_0x2ddb03){if(_0x2ddb03){return _0x20dc59['sendStatus'](_0x3f2049);}return _0x20dc59[_0xd39b('0xa')](_0x3f2049)[_0xd39b('0xb')]();};}function respondWithResult(_0x5795d3,_0x1779fb){_0x1779fb=_0x1779fb||0xc8;return function(_0x58ba3e){if(_0x58ba3e){return _0x5795d3['status'](_0x1779fb)[_0xd39b('0xc')](_0x58ba3e);}};}function respondWithFilteredResult(_0x4e3889,_0x2838ff){return function(_0x189509){if(_0x189509){var _0x12342a=typeof _0x2838ff[_0xd39b('0xd')]===_0xd39b('0xe')&&typeof _0x2838ff[_0xd39b('0xf')]==='undefined';var _0x2d2621=_0x189509[_0xd39b('0x10')];var _0x3aa070=_0x12342a?0x0:_0x2838ff[_0xd39b('0xd')];var _0x49a990=_0x12342a?_0x189509[_0xd39b('0x10')]:_0x2838ff[_0xd39b('0xd')]+_0x2838ff[_0xd39b('0xf')];var _0x434a92;if(_0x49a990>=_0x2d2621){_0x49a990=_0x2d2621;_0x434a92=0xc8;}else{_0x434a92=0xce;}_0x4e3889[_0xd39b('0xa')](_0x434a92);return _0x4e3889[_0xd39b('0x11')]('Content-Range',_0x3aa070+'-'+_0x49a990+'/'+_0x2d2621)[_0xd39b('0xc')](_0x189509);}return null;};}function saveUpdates(_0x3298ad){return function(_0x518b69){if(_0x518b69){return _0x518b69['update'](_0x3298ad)[_0xd39b('0x12')](function(_0x527b0b){return _0x527b0b;});}return null;};}function removeEntity(_0x59b7af){return function(_0x2e5fd1){if(_0x2e5fd1){return _0x2e5fd1[_0xd39b('0x13')]()[_0xd39b('0x12')](function(){var _0x2c3f90=_0x2e5fd1[_0xd39b('0x14')]({'plain':!![]});var _0x396506=_0xd39b('0x15');return db[_0xd39b('0x16')][_0xd39b('0x13')]({'where':{'type':_0x396506,'resourceId':_0x2c3f90['id']}})[_0xd39b('0x12')](function(){return _0x2e5fd1;});})[_0xd39b('0x12')](function(){_0x59b7af[_0xd39b('0xa')](0xcc)[_0xd39b('0xb')]();});}};}function handleEntityNotFound(_0x43f444){return function(_0x4d4029){if(!_0x4d4029){_0x43f444[_0xd39b('0x17')](0x194);}return _0x4d4029;};}function handleError(_0x583dc4,_0x2c51b4){_0x2c51b4=_0x2c51b4||0x1f4;return function(_0x7d235a){logger[_0xd39b('0x18')](_0x7d235a[_0xd39b('0x19')]);if(_0x7d235a[_0xd39b('0x1a')]){delete _0x7d235a[_0xd39b('0x1a')];}_0x583dc4[_0xd39b('0xa')](_0x2c51b4)[_0xd39b('0x1b')](_0x7d235a);};}exports[_0xd39b('0x1c')]=function(_0x480380,_0x4d725e){var _0x1cac1e={};var _0x4ceff9={'count':0x0,'rows':[]};var _0x492801=_[_0xd39b('0x1d')](db[_0xd39b('0x1e')][_0xd39b('0x1f')],function(_0x3d4fa6){return{'name':_0x3d4fa6[_0xd39b('0x20')],'type':_0x3d4fa6[_0xd39b('0x21')][_0xd39b('0x22')]};});_0x1cac1e=qs['getOptions'](_0x492801,_0x480380);var _0x1a96e7={'where':_0x1cac1e[_0xd39b('0x23')]};return db['OpenchannelQueue'][_0xd39b('0x10')](_0x1a96e7)[_0xd39b('0x12')](function(_0x3abbce){_0x4ceff9[_0xd39b('0x10')]=_0x3abbce;_0x1cac1e[_0xd39b('0x24')]=qs['include'](_0x480380['query']);return db[_0xd39b('0x1e')][_0xd39b('0x25')](_0x1cac1e);})[_0xd39b('0x12')](function(_0x570d16){_0x4ceff9['rows']=_0x570d16;return _0x4ceff9;})['then'](respondWithFilteredResult(_0x4d725e,_0x1cac1e))[_0xd39b('0x26')](handleError(_0x4d725e,null));};exports[_0xd39b('0x27')]=function(_0x580851,_0x4ce0b7){var _0x2c1445={'raw':!![],'where':{'id':_0x580851[_0xd39b('0x28')]['id']}},_0x27734b={};_0x27734b[_0xd39b('0x29')]=_[_0xd39b('0x2a')](db[_0xd39b('0x1e')]['rawAttributes']);_0x27734b[_0xd39b('0x2b')]=_[_0xd39b('0x2a')](_0x580851[_0xd39b('0x2b')]);_0x27734b[_0xd39b('0x2c')]=_[_0xd39b('0x2d')](_0x27734b['model'],_0x27734b[_0xd39b('0x2b')]);_0x2c1445[_0xd39b('0x2e')]=_[_0xd39b('0x2d')](_0x27734b[_0xd39b('0x29')],qs[_0xd39b('0x2f')](_0x580851['query'][_0xd39b('0x2f')]));_0x2c1445[_0xd39b('0x2e')]=_0x2c1445['attributes'][_0xd39b('0x30')]?_0x2c1445[_0xd39b('0x2e')]:_0x27734b[_0xd39b('0x29')];if(_0x580851[_0xd39b('0x2b')][_0xd39b('0x31')]){_0x2c1445['include']=[{'all':!![]}];}_0x2c1445=_[_0xd39b('0x32')]({},_0x2c1445,_0x580851[_0xd39b('0x33')]);return db[_0xd39b('0x1e')]['find'](_0x2c1445)[_0xd39b('0x12')](handleEntityNotFound(_0x4ce0b7,null))[_0xd39b('0x12')](respondWithResult(_0x4ce0b7,null))['catch'](handleError(_0x4ce0b7,null));};exports['create']=function(_0x20ebeb,_0x35d2c9){return db[_0xd39b('0x1e')]['create'](_0x20ebeb[_0xd39b('0x34')],{})[_0xd39b('0x12')](function(_0x3cb352){var _0x2af02f=_0x20ebeb[_0xd39b('0x35')][_0xd39b('0x14')]({'plain':!![]});if(!_0x2af02f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2af02f[_0xd39b('0x36')]===_0xd39b('0x35')){var _0x5eba97=_0x3cb352['get']({'plain':!![]});var _0x2885c3=_0xd39b('0x15');return db[_0xd39b('0x37')][_0xd39b('0x38')]({'where':{'name':_0x2885c3,'userProfileId':_0x2af02f[_0xd39b('0x39')]},'raw':!![]})[_0xd39b('0x12')](function(_0x1ed191){if(_0x1ed191&&_0x1ed191[_0xd39b('0x3a')]===0x0){return db[_0xd39b('0x16')][_0xd39b('0x3b')]({'name':_0x5eba97[_0xd39b('0x1a')],'resourceId':_0x5eba97['id'],'type':_0x1ed191[_0xd39b('0x1a')],'sectionId':_0x1ed191['id']},{})[_0xd39b('0x12')](function(){return _0x3cb352;});}else{return _0x3cb352;}})[_0xd39b('0x26')](function(_0x36297e){logger[_0xd39b('0x18')](_0xd39b('0x3c'),_0x36297e);throw _0x36297e;});}return _0x3cb352;})['then'](respondWithResult(_0x35d2c9,0xc9))['catch'](handleError(_0x35d2c9,null));};exports[_0xd39b('0x3d')]=function(_0xcdf90b,_0x3ab0de){if(_0xcdf90b[_0xd39b('0x34')]['id']){delete _0xcdf90b['body']['id'];}return db[_0xd39b('0x1e')][_0xd39b('0x38')]({'where':{'id':_0xcdf90b[_0xd39b('0x28')]['id']}})[_0xd39b('0x12')](handleEntityNotFound(_0x3ab0de,null))['then'](saveUpdates(_0xcdf90b['body'],null))[_0xd39b('0x12')](respondWithResult(_0x3ab0de,null))[_0xd39b('0x26')](handleError(_0x3ab0de,null));};exports[_0xd39b('0x13')]=function(_0x5894ba,_0xf16528){return db['OpenchannelQueue'][_0xd39b('0x38')]({'where':{'id':_0x5894ba[_0xd39b('0x28')]['id']}})[_0xd39b('0x12')](handleEntityNotFound(_0xf16528,null))[_0xd39b('0x12')](removeEntity(_0xf16528,null))[_0xd39b('0x26')](handleError(_0xf16528,null));};exports[_0xd39b('0x3e')]=function(_0x4129b2,_0x338c47){return db[_0xd39b('0x1e')]['describe']()[_0xd39b('0x12')](respondWithResult(_0x338c47,null))[_0xd39b('0x26')](handleError(_0x338c47,null));};exports[_0xd39b('0x3f')]=function(_0x2d0a76,_0x1492cc){var _0x52256a={'raw':!![],'where':{}},_0x5e8aa9={},_0x104668;return db[_0xd39b('0x1e')][_0xd39b('0x40')]({'where':{'id':_0x2d0a76['params']['id']}})[_0xd39b('0x12')](handleEntityNotFound(_0x1492cc,null))[_0xd39b('0x12')](function(_0xe277aa){if(_0xe277aa){_0x104668=_0xe277aa[_0xd39b('0x14')]({'plain':!![]});_0x5e8aa9[_0xd39b('0x29')]=_[_0xd39b('0x2a')](db['UserOpenchannelQueue'][_0xd39b('0x1f')]);_0x5e8aa9[_0xd39b('0x2b')]=_[_0xd39b('0x2a')](_0x2d0a76['query']);_0x5e8aa9[_0xd39b('0x2c')]=_[_0xd39b('0x2d')](_0x5e8aa9[_0xd39b('0x29')],_0x5e8aa9['query']);_0x52256a[_0xd39b('0x2e')]=_['intersection'](_0x5e8aa9[_0xd39b('0x29')],qs[_0xd39b('0x2f')](_0x2d0a76[_0xd39b('0x2b')][_0xd39b('0x2f')]));_0x52256a[_0xd39b('0x2e')]=_0x52256a[_0xd39b('0x2e')][_0xd39b('0x30')]?_0x52256a[_0xd39b('0x2e')]:_0x5e8aa9[_0xd39b('0x29')];if(!_0x2d0a76[_0xd39b('0x2b')][_0xd39b('0x41')](_0xd39b('0x42'))){_0x52256a[_0xd39b('0xf')]=qs['limit'](_0x2d0a76[_0xd39b('0x2b')][_0xd39b('0xf')]);_0x52256a['offset']=qs[_0xd39b('0xd')](_0x2d0a76[_0xd39b('0x2b')]['offset']);}_0x52256a[_0xd39b('0x43')]=qs[_0xd39b('0x44')](_0x2d0a76[_0xd39b('0x2b')][_0xd39b('0x44')]);_0x52256a['where']=qs['filters'](_['pick'](_0x2d0a76[_0xd39b('0x2b')],_0x5e8aa9[_0xd39b('0x2c')]));_0x52256a[_0xd39b('0x23')][_0xd39b('0x45')]=_0xe277aa['id'];if(_0x2d0a76[_0xd39b('0x2b')][_0xd39b('0x46')]){_0x52256a['where']=_[_0xd39b('0x32')](_0x52256a[_0xd39b('0x23')],{'$or':_[_0xd39b('0x1d')](_0x52256a[_0xd39b('0x2e')],function(_0x2bc529){var _0x791fd4={};_0x791fd4[_0x2bc529]={'$like':'%'+_0x2d0a76['query']['filter']+'%'};return _0x791fd4;})});}_0x52256a=_[_0xd39b('0x32')]({},_0x52256a,_0x2d0a76[_0xd39b('0x33')]);return db[_0xd39b('0x47')][_0xd39b('0x25')](_0x52256a);}})[_0xd39b('0x12')](function(_0x4cda2f){if(_0x4cda2f){return db[_0xd39b('0x48')][_0xd39b('0x49')]({'where':{'id':_[_0xd39b('0x1d')](_0x4cda2f,_0xd39b('0x4a')),'role':_0xd39b('0x4b')},'attributes':['id',_0xd39b('0x1a'),'openchannelPause',_0xd39b('0x4c'),_0xd39b('0x4d')]});}})[_0xd39b('0x12')](function(_0xf3e3ea){if(_0xf3e3ea){return{'count':_0xf3e3ea['count'],'rows':_[_0xd39b('0x1d')](_0xf3e3ea[_0xd39b('0x4e')],function(_0x367414){return{'membername':_0x367414[_0xd39b('0x1a')],'UserId':_0x367414['id'],'queue_name':_0x104668[_0xd39b('0x1a')],'OpenchannelQueueId':_0x104668['id'],'interface':util[_0xd39b('0x4f')]('%s/%s',_0xd39b('0x50'),_0x367414['name']),'penalty':0x0,'paused':_0x367414[_0xd39b('0x51')],'createdAt':_0x367414[_0xd39b('0x4d')],'updatedAt':_0x367414[_0xd39b('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1492cc,_0x52256a))[_0xd39b('0x26')](handleError(_0x1492cc,null));};exports[_0xd39b('0x52')]=function(_0x40fcac,_0x39a239){var _0x32ccf1={};var _0x16d6f2={};var _0x52ffb8;var _0xbc5d2d;return db[_0xd39b('0x1e')][_0xd39b('0x40')]({'where':{'id':_0x40fcac[_0xd39b('0x28')]['id']}})[_0xd39b('0x12')](handleEntityNotFound(_0x39a239,null))[_0xd39b('0x12')](function(_0x23863){if(_0x23863){_0x52ffb8=_0x23863;_0x16d6f2['model']=_['keys'](db[_0xd39b('0x53')]['rawAttributes']);_0x16d6f2[_0xd39b('0x2b')]=_[_0xd39b('0x2a')](_0x40fcac[_0xd39b('0x2b')]);_0x16d6f2[_0xd39b('0x2c')]=_[_0xd39b('0x2d')](_0x16d6f2[_0xd39b('0x29')],_0x16d6f2[_0xd39b('0x2b')]);_0x32ccf1[_0xd39b('0x2e')]=_[_0xd39b('0x2d')](_0x16d6f2[_0xd39b('0x29')],qs['fields'](_0x40fcac['query']['fields']));_0x32ccf1['attributes']=_0x32ccf1[_0xd39b('0x2e')][_0xd39b('0x30')]?_0x32ccf1[_0xd39b('0x2e')]:_0x16d6f2['model'];_0x32ccf1[_0xd39b('0x43')]=qs[_0xd39b('0x44')](_0x40fcac['query'][_0xd39b('0x44')]);_0x32ccf1[_0xd39b('0x23')]=qs[_0xd39b('0x2c')](_[_0xd39b('0x54')](_0x40fcac[_0xd39b('0x2b')],_0x16d6f2[_0xd39b('0x2c')]));if(_0x40fcac['query'][_0xd39b('0x46')]){_0x32ccf1[_0xd39b('0x23')]=_[_0xd39b('0x32')](_0x32ccf1[_0xd39b('0x23')],{'$or':_[_0xd39b('0x1d')](_0x32ccf1[_0xd39b('0x2e')],function(_0x39c51c){var _0x274d67={};_0x274d67[_0x39c51c]={'$like':'%'+_0x40fcac[_0xd39b('0x2b')]['filter']+'%'};return _0x274d67;})});}_0x32ccf1=_['merge']({},_0x32ccf1,_0x40fcac[_0xd39b('0x33')]);return _0x52ffb8['getTeams'](_0x32ccf1);}})[_0xd39b('0x12')](function(_0x2b4702){if(_0x2b4702){_0xbc5d2d=_0x2b4702[_0xd39b('0x30')];if(!_0x40fcac['query'][_0xd39b('0x41')](_0xd39b('0x42'))){_0x32ccf1[_0xd39b('0xf')]=qs[_0xd39b('0xf')](_0x40fcac[_0xd39b('0x2b')]['limit']);_0x32ccf1[_0xd39b('0xd')]=qs[_0xd39b('0xd')](_0x40fcac[_0xd39b('0x2b')]['offset']);}return _0x52ffb8['getTeams'](_0x32ccf1);}})[_0xd39b('0x12')](function(_0x43af42){if(_0x43af42){return _0x43af42?{'count':_0xbc5d2d,'rows':_0x43af42}:null;}})[_0xd39b('0x12')](respondWithResult(_0x39a239,null))['catch'](handleError(_0x39a239,null));};exports[_0xd39b('0x55')]=function(_0x1fe0d8,_0x4310bb){var _0x17693a=_0x1fe0d8[_0xd39b('0x34')][_0xd39b('0x56')];return db[_0xd39b('0x53')][_0xd39b('0x25')]({'where':{'id':_0x17693a},'attributes':['id'],'include':[{'model':db[_0xd39b('0x48')],'as':_0xd39b('0x57'),'attributes':['id',_0xd39b('0x1a'),_0xd39b('0x58'),_0xd39b('0x59'),'interface'],'raw':!![]}]})[_0xd39b('0x12')](function(_0x4a466b){if(_0x4a466b){var _0x1cd321=_[_0xd39b('0x5a')](_0x4a466b,function(_0x33f47d){var _0x172e04=_0x33f47d[_0xd39b('0x14')]({'plain':!![]});return _0x172e04[_0xd39b('0x57')];});return db['OpenchannelQueue'][_0xd39b('0x38')]({'where':{'id':_0x1fe0d8[_0xd39b('0x28')]['id']}})[_0xd39b('0x12')](function(_0x21a005){return db[_0xd39b('0x5b')][_0xd39b('0x5c')](function(_0x4ac0d1){return _0x21a005[_0xd39b('0x55')](_0x17693a,{'transaction':_0x4ac0d1})['then'](function(){return BPromise[_0xd39b('0x5d')](_0x1cd321,function(_0xf115e){return db[_0xd39b('0x47')][_0xd39b('0x5e')]({'where':{'UserId':_0xf115e['id'],'OpenchannelQueueId':_0x1fe0d8['params']['id']},'transaction':_0x4ac0d1});});})[_0xd39b('0x12')](function(){_0x1cd321[_0xd39b('0x5f')](function(_0x5631fa){socket[_0xd39b('0x60')](_0xd39b('0x61'),{'UserId':_0x5631fa['id'],'OpenchannelQueueId':_0x21a005['id']});});});});});}})[_0xd39b('0x12')](respondWithStatusCode(_0x4310bb,null))[_0xd39b('0x26')](handleError(_0x4310bb,null));};exports[_0xd39b('0x62')]=function(_0xc6ec41,_0x8ae3da){return db[_0xd39b('0x53')][_0xd39b('0x25')]({'where':{'id':_0xc6ec41[_0xd39b('0x2b')][_0xd39b('0x56')]},'attributes':['id'],'include':[{'model':db[_0xd39b('0x48')],'as':_0xd39b('0x57'),'attributes':['id'],'raw':!![]}]})[_0xd39b('0x12')](handleEntityNotFound(_0x8ae3da,null))[_0xd39b('0x12')](function(_0x4a6ca7){var _0x133a64=_[_0xd39b('0x1d')](_0x4a6ca7,'id');var _0x3fd055=[];var _0x15bb96=[];var _0x4786f4=squel[_0xd39b('0x63')]();_0x4786f4['field'](_0xd39b('0x64'))['from']('team_has_openchannel_queues','tq')[_0xd39b('0x65')](_0xd39b('0x66'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd39b('0x67'),_0xc6ec41[_0xd39b('0x28')]['id']);for(var _0x1264c4=0x0;_0x1264c4<_0x4a6ca7[_0xd39b('0x30')];_0x1264c4+=0x1){let _0x58d821=_0x4a6ca7[_0x1264c4];for(var _0x5ee271=0x0;_0x5ee271<_0x58d821[_0xd39b('0x57')][_0xd39b('0x30')];_0x5ee271+=0x1){let _0x13d6f1=_0x58d821[_0xd39b('0x57')][_0x5ee271];var _0x3bf0f8=_0x4786f4[_0xd39b('0x68')]();_0x3bf0f8['where'](_0xd39b('0x69'),_0x13d6f1['id']);_0x15bb96['push'](db[_0xd39b('0x5b')][_0xd39b('0x2b')](_0x3bf0f8['toString'](),{'type':db[_0xd39b('0x5b')][_0xd39b('0x6a')][_0xd39b('0x6b')]})[_0xd39b('0x12')](function(_0x378388){if(_0x378388[_0xd39b('0x30')]===0x1){return _0x13d6f1['id'];}else{var _0x4cb294=_[_0xd39b('0x6c')](_['map'](_0x378388,_0xd39b('0x6d')),function(_0x49f1c5){return _[_0xd39b('0x6e')](_0x133a64,_0x49f1c5);});if(_0x4cb294){return _0x13d6f1['id'];}}}));}}return BPromise[_0xd39b('0x6f')](_0x15bb96)['then'](function(_0x19a4dd){_0x3fd055=_(_0x3fd055)[_0xd39b('0x70')](_0x19a4dd)['compact']()['value']();return db[_0xd39b('0x1e')][_0xd39b('0x38')]({'where':{'id':_0xc6ec41[_0xd39b('0x28')]['id']}})[_0xd39b('0x12')](function(_0x9d807d){return db['sequelize'][_0xd39b('0x5c')](function(_0x4e0fe7){return _0x9d807d[_0xd39b('0x62')](_0xc6ec41[_0xd39b('0x2b')][_0xd39b('0x56')],{'transaction':_0x4e0fe7})[_0xd39b('0x12')](function(){if(!_[_0xd39b('0x71')](_0x3fd055)){return _0x9d807d[_0xd39b('0x72')](_0x3fd055,{'transaction':_0x4e0fe7});}})[_0xd39b('0x12')](function(){_0x3fd055[_0xd39b('0x5f')](function(_0x5b7ae0){socket[_0xd39b('0x60')](_0xd39b('0x73'),{'UserId':_0x5b7ae0,'OpenchannelQueueId':_0x9d807d['id']});});});});});});})[_0xd39b('0x12')](respondWithStatusCode(_0x8ae3da,null))['catch'](handleError(_0x8ae3da,null));};exports[_0xd39b('0x74')]=function(_0x4f0bba,_0x11921c){return db[_0xd39b('0x1e')][_0xd39b('0x38')]({'where':{'id':_0x4f0bba[_0xd39b('0x28')]['id']}})[_0xd39b('0x12')](handleEntityNotFound(_0x11921c,null))[_0xd39b('0x12')](function(_0x48f307){if(_0x48f307){return _0x48f307['addAgents'](_0x4f0bba[_0xd39b('0x34')][_0xd39b('0x56')],_['omit'](_0x4f0bba['body'],[_0xd39b('0x56'),'id'])||{})['spread'](function(_0x378bbe){for(var _0x124f3b=0x0;_0x124f3b<_0x4f0bba[_0xd39b('0x34')][_0xd39b('0x56')][_0xd39b('0x30')];_0x124f3b+=0x1){socket[_0xd39b('0x60')](_0xd39b('0x61'),{'UserId':Number(_0x4f0bba[_0xd39b('0x34')][_0xd39b('0x56')][_0x124f3b]),'OpenchannelQueueId':Number(_0x4f0bba[_0xd39b('0x28')]['id'])});}return _0x378bbe;});}})[_0xd39b('0x12')](respondWithResult(_0x11921c,null))[_0xd39b('0x26')](handleError(_0x11921c,null));};exports['removeAgents']=function(_0x3fb0d4,_0x29ef59){return db[_0xd39b('0x1e')][_0xd39b('0x38')]({'where':{'id':_0x3fb0d4[_0xd39b('0x28')]['id']}})[_0xd39b('0x12')](handleEntityNotFound(_0x29ef59,null))[_0xd39b('0x12')](function(_0x329ae4){if(_0x329ae4){return _0x329ae4[_0xd39b('0x72')](_0x3fb0d4[_0xd39b('0x2b')][_0xd39b('0x56')])[_0xd39b('0x12')](function(){if(_[_0xd39b('0x75')](_0x3fb0d4[_0xd39b('0x2b')][_0xd39b('0x56')])){for(var _0x1222a2=0x0;_0x1222a2<_0x3fb0d4['query']['ids']['length'];_0x1222a2+=0x1){socket['emit'](_0xd39b('0x73'),{'UserId':Number(_0x3fb0d4[_0xd39b('0x2b')]['ids'][_0x1222a2]),'OpenchannelQueueId':Number(_0x3fb0d4[_0xd39b('0x28')]['id'])});}}else{socket['emit'](_0xd39b('0x73'),{'UserId':Number(_0x3fb0d4[_0xd39b('0x2b')][_0xd39b('0x56')]),'OpenchannelQueueId':Number(_0x3fb0d4['params']['id'])});}});}})[_0xd39b('0x12')](respondWithStatusCode(_0x29ef59,null))[_0xd39b('0x26')](handleError(_0x29ef59,null));};exports[_0xd39b('0x76')]=function(_0xc11b09,_0x12063b){var _0x4076a1={};var _0x2bbae2={};var _0x13ea51;var _0x329ab8;return db[_0xd39b('0x1e')][_0xd39b('0x40')]({'where':{'id':_0xc11b09[_0xd39b('0x28')]['id']}})[_0xd39b('0x12')](handleEntityNotFound(_0x12063b,null))[_0xd39b('0x12')](function(_0x250441){if(_0x250441){_0x13ea51=_0x250441;_0x2bbae2[_0xd39b('0x29')]=_[_0xd39b('0x2a')](db[_0xd39b('0x48')][_0xd39b('0x1f')]);_0x2bbae2['query']=_[_0xd39b('0x2a')](_0xc11b09[_0xd39b('0x2b')]);_0x2bbae2[_0xd39b('0x2c')]=_['intersection'](_0x2bbae2[_0xd39b('0x29')],_0x2bbae2[_0xd39b('0x2b')]);_0x4076a1[_0xd39b('0x2e')]=_[_0xd39b('0x2d')](_0x2bbae2[_0xd39b('0x29')],qs['fields'](_0xc11b09[_0xd39b('0x2b')][_0xd39b('0x2f')]));_0x4076a1[_0xd39b('0x2e')]=_0x4076a1['attributes']['length']?_0x4076a1[_0xd39b('0x2e')]:_0x2bbae2[_0xd39b('0x29')];_0x4076a1[_0xd39b('0x43')]=qs[_0xd39b('0x44')](_0xc11b09[_0xd39b('0x2b')]['sort']);_0x4076a1[_0xd39b('0x23')]=qs['filters'](_[_0xd39b('0x54')](_0xc11b09[_0xd39b('0x2b')],_0x2bbae2[_0xd39b('0x2c')]));if(_0xc11b09[_0xd39b('0x2b')][_0xd39b('0x46')]){_0x4076a1[_0xd39b('0x23')]=_['merge'](_0x4076a1[_0xd39b('0x23')],{'$or':_[_0xd39b('0x1d')](_0x4076a1[_0xd39b('0x2e')],function(_0x5bb785){var _0x199771={};_0x199771[_0x5bb785]={'$like':'%'+_0xc11b09[_0xd39b('0x2b')][_0xd39b('0x46')]+'%'};return _0x199771;})});}_0x4076a1=_[_0xd39b('0x32')]({},_0x4076a1,_0xc11b09[_0xd39b('0x33')]);return _0x13ea51['getAgents'](_0x4076a1);}})[_0xd39b('0x12')](function(_0x1bc583){if(_0x1bc583){_0x329ab8=_0x1bc583[_0xd39b('0x30')];if(!_0xc11b09[_0xd39b('0x2b')][_0xd39b('0x41')](_0xd39b('0x42'))){_0x4076a1[_0xd39b('0xf')]=qs[_0xd39b('0xf')](_0xc11b09[_0xd39b('0x2b')][_0xd39b('0xf')]);_0x4076a1[_0xd39b('0xd')]=qs[_0xd39b('0xd')](_0xc11b09[_0xd39b('0x2b')][_0xd39b('0xd')]);}return _0x13ea51['getAgents'](_0x4076a1);}})[_0xd39b('0x12')](function(_0x175132){if(_0x175132){return _0x175132?{'count':_0x329ab8,'rows':_0x175132}:null;}})[_0xd39b('0x12')](respondWithResult(_0x12063b,null))[_0xd39b('0x26')](handleError(_0x12063b,null));}; \ No newline at end of file +var _0xabcf=['offset','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','map','OpenchannelQueue','rawAttributes','type','where','include','findAll','rows','catch','show','params','model','query','keys','attributes','intersection','fields','length','merge','options','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','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','filters','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','emit','addAgents','omit','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','pick','bluebird','util','lodash','squel','../../config/logger','api','../../config/environment','redis','defaults','register','sendStatus','status','json','undefined','limit','count'];(function(_0x1063c5,_0x53ead5){var _0x4dcd91=function(_0x2284f3){while(--_0x2284f3){_0x1063c5['push'](_0x1063c5['shift']());}};_0x4dcd91(++_0x53ead5);}(_0xabcf,0xd4));var _0xfabc=function(_0x1d5855,_0xc600c9){_0x1d5855=_0x1d5855-0x0;var _0x3e238f=_0xabcf[_0x1d5855];return _0x3e238f;};'use strict';var BPromise=require(_0xfabc('0x0'));var util=require(_0xfabc('0x1'));var _=require(_0xfabc('0x2'));var squel=require(_0xfabc('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xfabc('0x4'))(_0xfabc('0x5'));var config=require(_0xfabc('0x6'));var db=require('../../mysqldb')['db'];config[_0xfabc('0x7')]=_[_0xfabc('0x8')](config[_0xfabc('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfabc('0x7')]));require('./openchannelQueue.socket')[_0xfabc('0x9')](socket);function respondWithStatusCode(_0x3bd480,_0x20d097){_0x20d097=_0x20d097||0xcc;return function(_0x153abf){if(_0x153abf){return _0x3bd480[_0xfabc('0xa')](_0x20d097);}return _0x3bd480[_0xfabc('0xb')](_0x20d097)['end']();};}function respondWithResult(_0x5d19ce,_0x265d59){_0x265d59=_0x265d59||0xc8;return function(_0x4607d5){if(_0x4607d5){return _0x5d19ce['status'](_0x265d59)[_0xfabc('0xc')](_0x4607d5);}};}function respondWithFilteredResult(_0x1fc44b,_0x567bf8){return function(_0x380d7f){if(_0x380d7f){var _0x42a600=typeof _0x567bf8['offset']===_0xfabc('0xd')&&typeof _0x567bf8[_0xfabc('0xe')]===_0xfabc('0xd');var _0x2eb16a=_0x380d7f[_0xfabc('0xf')];var _0x4b3478=_0x42a600?0x0:_0x567bf8[_0xfabc('0x10')];var _0x5e3be9=_0x42a600?_0x380d7f[_0xfabc('0xf')]:_0x567bf8[_0xfabc('0x10')]+_0x567bf8[_0xfabc('0xe')];var _0x264687;if(_0x5e3be9>=_0x2eb16a){_0x5e3be9=_0x2eb16a;_0x264687=0xc8;}else{_0x264687=0xce;}_0x1fc44b[_0xfabc('0xb')](_0x264687);return _0x1fc44b[_0xfabc('0x11')](_0xfabc('0x12'),_0x4b3478+'-'+_0x5e3be9+'/'+_0x2eb16a)['json'](_0x380d7f);}return null;};}function saveUpdates(_0x233e1d){return function(_0xd92491){if(_0xd92491){return _0xd92491[_0xfabc('0x13')](_0x233e1d)[_0xfabc('0x14')](function(_0x43cb83){return _0x43cb83;});}return null;};}function removeEntity(_0x38d2cb){return function(_0x2d14d6){if(_0x2d14d6){return _0x2d14d6[_0xfabc('0x15')]()[_0xfabc('0x14')](function(){var _0x4085f6=_0x2d14d6[_0xfabc('0x16')]({'plain':!![]});var _0xbee23d=_0xfabc('0x17');return db[_0xfabc('0x18')][_0xfabc('0x15')]({'where':{'type':_0xbee23d,'resourceId':_0x4085f6['id']}})[_0xfabc('0x14')](function(){return _0x2d14d6;});})[_0xfabc('0x14')](function(){_0x38d2cb[_0xfabc('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55bb6f){return function(_0x4a231a){if(!_0x4a231a){_0x55bb6f[_0xfabc('0xa')](0x194);}return _0x4a231a;};}function handleError(_0xd651d2,_0x57f69d){_0x57f69d=_0x57f69d||0x1f4;return function(_0x46d5ca){logger[_0xfabc('0x19')](_0x46d5ca['stack']);if(_0x46d5ca[_0xfabc('0x1a')]){delete _0x46d5ca['name'];}_0xd651d2[_0xfabc('0xb')](_0x57f69d)[_0xfabc('0x1b')](_0x46d5ca);};}exports['index']=function(_0x20b9a5,_0x250193){var _0x5e6117={};var _0x5b5be0={'count':0x0,'rows':[]};var _0x3a539c=_[_0xfabc('0x1c')](db[_0xfabc('0x1d')][_0xfabc('0x1e')],function(_0x504f58){return{'name':_0x504f58['fieldName'],'type':_0x504f58[_0xfabc('0x1f')]['key']};});_0x5e6117=qs['getOptions'](_0x3a539c,_0x20b9a5);var _0x25729c={'where':_0x5e6117[_0xfabc('0x20')]};return db[_0xfabc('0x1d')][_0xfabc('0xf')](_0x25729c)[_0xfabc('0x14')](function(_0x1720b7){_0x5b5be0[_0xfabc('0xf')]=_0x1720b7;_0x5e6117[_0xfabc('0x21')]=qs[_0xfabc('0x21')](_0x20b9a5['query']);return db[_0xfabc('0x1d')][_0xfabc('0x22')](_0x5e6117);})[_0xfabc('0x14')](function(_0x60325f){_0x5b5be0[_0xfabc('0x23')]=_0x60325f;return _0x5b5be0;})[_0xfabc('0x14')](respondWithFilteredResult(_0x250193,_0x5e6117))[_0xfabc('0x24')](handleError(_0x250193,null));};exports[_0xfabc('0x25')]=function(_0x3f0525,_0x33bfd5){var _0x2acbf5={'raw':!![],'where':{'id':_0x3f0525[_0xfabc('0x26')]['id']}},_0x55132e={};_0x55132e[_0xfabc('0x27')]=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x55132e[_0xfabc('0x28')]=_[_0xfabc('0x29')](_0x3f0525['query']);_0x55132e['filters']=_['intersection'](_0x55132e[_0xfabc('0x27')],_0x55132e['query']);_0x2acbf5[_0xfabc('0x2a')]=_[_0xfabc('0x2b')](_0x55132e[_0xfabc('0x27')],qs['fields'](_0x3f0525[_0xfabc('0x28')][_0xfabc('0x2c')]));_0x2acbf5[_0xfabc('0x2a')]=_0x2acbf5[_0xfabc('0x2a')][_0xfabc('0x2d')]?_0x2acbf5['attributes']:_0x55132e[_0xfabc('0x27')];if(_0x3f0525[_0xfabc('0x28')]['includeAll']){_0x2acbf5[_0xfabc('0x21')]=[{'all':!![]}];}_0x2acbf5=_[_0xfabc('0x2e')]({},_0x2acbf5,_0x3f0525[_0xfabc('0x2f')]);return db[_0xfabc('0x1d')][_0xfabc('0x30')](_0x2acbf5)[_0xfabc('0x14')](handleEntityNotFound(_0x33bfd5,null))[_0xfabc('0x14')](respondWithResult(_0x33bfd5,null))[_0xfabc('0x24')](handleError(_0x33bfd5,null));};exports['create']=function(_0x33741c,_0x4e2437){return db['OpenchannelQueue'][_0xfabc('0x31')](_0x33741c[_0xfabc('0x32')],{})['then'](function(_0x4a6510){var _0x5e5df6=_0x33741c[_0xfabc('0x33')][_0xfabc('0x16')]({'plain':!![]});if(!_0x5e5df6)throw new Error(_0xfabc('0x34'));if(_0x5e5df6[_0xfabc('0x35')]==='user'){var _0x470d83=_0x4a6510[_0xfabc('0x16')]({'plain':!![]});var _0x3df9eb=_0xfabc('0x17');return db[_0xfabc('0x36')][_0xfabc('0x30')]({'where':{'name':_0x3df9eb,'userProfileId':_0x5e5df6['userProfileId']},'raw':!![]})[_0xfabc('0x14')](function(_0x2fa5f1){if(_0x2fa5f1&&_0x2fa5f1[_0xfabc('0x37')]===0x0){return db[_0xfabc('0x18')][_0xfabc('0x31')]({'name':_0x470d83[_0xfabc('0x1a')],'resourceId':_0x470d83['id'],'type':_0x2fa5f1[_0xfabc('0x1a')],'sectionId':_0x2fa5f1['id']},{})[_0xfabc('0x14')](function(){return _0x4a6510;});}else{return _0x4a6510;}})[_0xfabc('0x24')](function(_0x5b9f45){logger[_0xfabc('0x19')](_0xfabc('0x38'),_0x5b9f45);throw _0x5b9f45;});}return _0x4a6510;})[_0xfabc('0x14')](respondWithResult(_0x4e2437,0xc9))['catch'](handleError(_0x4e2437,null));};exports[_0xfabc('0x13')]=function(_0xf90b29,_0xa6125b){if(_0xf90b29['body']['id']){delete _0xf90b29[_0xfabc('0x32')]['id'];}return db[_0xfabc('0x1d')][_0xfabc('0x30')]({'where':{'id':_0xf90b29['params']['id']}})[_0xfabc('0x14')](handleEntityNotFound(_0xa6125b,null))['then'](saveUpdates(_0xf90b29[_0xfabc('0x32')],null))[_0xfabc('0x14')](respondWithResult(_0xa6125b,null))['catch'](handleError(_0xa6125b,null));};exports['destroy']=function(_0x534105,_0x49cc77){return db[_0xfabc('0x1d')]['find']({'where':{'id':_0x534105[_0xfabc('0x26')]['id']}})['then'](handleEntityNotFound(_0x49cc77,null))['then'](removeEntity(_0x49cc77,null))['catch'](handleError(_0x49cc77,null));};exports[_0xfabc('0x39')]=function(_0x3665f7,_0x15d5ac){return db[_0xfabc('0x1d')]['describe']()[_0xfabc('0x14')](respondWithResult(_0x15d5ac,null))[_0xfabc('0x24')](handleError(_0x15d5ac,null));};exports['getMembers']=function(_0x2500e1,_0xc8652d){var _0x9efd75={'raw':!![],'where':{}},_0x19726e={},_0x13f8f1;return db[_0xfabc('0x1d')][_0xfabc('0x3a')]({'where':{'id':_0x2500e1[_0xfabc('0x26')]['id']}})['then'](handleEntityNotFound(_0xc8652d,null))[_0xfabc('0x14')](function(_0x523bcb){if(_0x523bcb){_0x13f8f1=_0x523bcb[_0xfabc('0x16')]({'plain':!![]});_0x19726e['model']=_[_0xfabc('0x29')](db[_0xfabc('0x3b')][_0xfabc('0x1e')]);_0x19726e[_0xfabc('0x28')]=_[_0xfabc('0x29')](_0x2500e1[_0xfabc('0x28')]);_0x19726e['filters']=_[_0xfabc('0x2b')](_0x19726e[_0xfabc('0x27')],_0x19726e[_0xfabc('0x28')]);_0x9efd75[_0xfabc('0x2a')]=_[_0xfabc('0x2b')](_0x19726e[_0xfabc('0x27')],qs['fields'](_0x2500e1['query'][_0xfabc('0x2c')]));_0x9efd75[_0xfabc('0x2a')]=_0x9efd75[_0xfabc('0x2a')]['length']?_0x9efd75['attributes']:_0x19726e[_0xfabc('0x27')];if(!_0x2500e1[_0xfabc('0x28')][_0xfabc('0x3c')](_0xfabc('0x3d'))){_0x9efd75['limit']=qs['limit'](_0x2500e1[_0xfabc('0x28')][_0xfabc('0xe')]);_0x9efd75[_0xfabc('0x10')]=qs['offset'](_0x2500e1[_0xfabc('0x28')]['offset']);}_0x9efd75[_0xfabc('0x3e')]=qs[_0xfabc('0x3f')](_0x2500e1['query']['sort']);_0x9efd75[_0xfabc('0x20')]=qs[_0xfabc('0x40')](_['pick'](_0x2500e1[_0xfabc('0x28')],_0x19726e[_0xfabc('0x40')]));_0x9efd75[_0xfabc('0x20')]['OpenchannelQueueId']=_0x523bcb['id'];if(_0x2500e1[_0xfabc('0x28')][_0xfabc('0x41')]){_0x9efd75[_0xfabc('0x20')]=_[_0xfabc('0x2e')](_0x9efd75[_0xfabc('0x20')],{'$or':_[_0xfabc('0x1c')](_0x9efd75[_0xfabc('0x2a')],function(_0x502634){var _0x138188={};_0x138188[_0x502634]={'$like':'%'+_0x2500e1[_0xfabc('0x28')][_0xfabc('0x41')]+'%'};return _0x138188;})});}_0x9efd75=_[_0xfabc('0x2e')]({},_0x9efd75,_0x2500e1[_0xfabc('0x2f')]);return db[_0xfabc('0x3b')][_0xfabc('0x22')](_0x9efd75);}})[_0xfabc('0x14')](function(_0x320b54){if(_0x320b54){return db[_0xfabc('0x42')][_0xfabc('0x43')]({'where':{'id':_[_0xfabc('0x1c')](_0x320b54,_0xfabc('0x44')),'role':_0xfabc('0x45')},'attributes':['id','name',_0xfabc('0x46'),_0xfabc('0x47'),_0xfabc('0x48')]});}})[_0xfabc('0x14')](function(_0x3b1475){if(_0x3b1475){return{'count':_0x3b1475[_0xfabc('0xf')],'rows':_['map'](_0x3b1475[_0xfabc('0x23')],function(_0x4b7fd5){return{'membername':_0x4b7fd5[_0xfabc('0x1a')],'UserId':_0x4b7fd5['id'],'queue_name':_0x13f8f1['name'],'OpenchannelQueueId':_0x13f8f1['id'],'interface':util[_0xfabc('0x49')](_0xfabc('0x4a'),_0xfabc('0x4b'),_0x4b7fd5[_0xfabc('0x1a')]),'penalty':0x0,'paused':_0x4b7fd5[_0xfabc('0x46')],'createdAt':_0x4b7fd5[_0xfabc('0x48')],'updatedAt':_0x4b7fd5[_0xfabc('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfabc('0x14')](respondWithFilteredResult(_0xc8652d,_0x9efd75))['catch'](handleError(_0xc8652d,null));};exports[_0xfabc('0x4c')]=function(_0x4320e3,_0x9a4b2a){var _0x45b7a2={};var _0x14bea8={};var _0x570954;var _0x184c94;return db['OpenchannelQueue'][_0xfabc('0x3a')]({'where':{'id':_0x4320e3[_0xfabc('0x26')]['id']}})[_0xfabc('0x14')](handleEntityNotFound(_0x9a4b2a,null))['then'](function(_0x3e6c23){if(_0x3e6c23){_0x570954=_0x3e6c23;_0x14bea8['model']=_['keys'](db['Team'][_0xfabc('0x1e')]);_0x14bea8[_0xfabc('0x28')]=_[_0xfabc('0x29')](_0x4320e3['query']);_0x14bea8['filters']=_[_0xfabc('0x2b')](_0x14bea8[_0xfabc('0x27')],_0x14bea8[_0xfabc('0x28')]);_0x45b7a2[_0xfabc('0x2a')]=_[_0xfabc('0x2b')](_0x14bea8[_0xfabc('0x27')],qs[_0xfabc('0x2c')](_0x4320e3[_0xfabc('0x28')][_0xfabc('0x2c')]));_0x45b7a2[_0xfabc('0x2a')]=_0x45b7a2['attributes']['length']?_0x45b7a2[_0xfabc('0x2a')]:_0x14bea8['model'];_0x45b7a2['order']=qs[_0xfabc('0x3f')](_0x4320e3['query'][_0xfabc('0x3f')]);_0x45b7a2[_0xfabc('0x20')]=qs['filters'](_['pick'](_0x4320e3[_0xfabc('0x28')],_0x14bea8['filters']));if(_0x4320e3['query']['filter']){_0x45b7a2[_0xfabc('0x20')]=_['merge'](_0x45b7a2[_0xfabc('0x20')],{'$or':_[_0xfabc('0x1c')](_0x45b7a2[_0xfabc('0x2a')],function(_0x551c73){var _0x199b33={};_0x199b33[_0x551c73]={'$like':'%'+_0x4320e3[_0xfabc('0x28')][_0xfabc('0x41')]+'%'};return _0x199b33;})});}_0x45b7a2=_[_0xfabc('0x2e')]({},_0x45b7a2,_0x4320e3[_0xfabc('0x2f')]);return _0x570954[_0xfabc('0x4c')](_0x45b7a2);}})[_0xfabc('0x14')](function(_0x3cda00){if(_0x3cda00){_0x184c94=_0x3cda00[_0xfabc('0x2d')];if(!_0x4320e3[_0xfabc('0x28')]['hasOwnProperty'](_0xfabc('0x3d'))){_0x45b7a2[_0xfabc('0xe')]=qs[_0xfabc('0xe')](_0x4320e3[_0xfabc('0x28')]['limit']);_0x45b7a2[_0xfabc('0x10')]=qs[_0xfabc('0x10')](_0x4320e3['query'][_0xfabc('0x10')]);}return _0x570954['getTeams'](_0x45b7a2);}})[_0xfabc('0x14')](function(_0x2a5318){if(_0x2a5318){return _0x2a5318?{'count':_0x184c94,'rows':_0x2a5318}:null;}})[_0xfabc('0x14')](respondWithResult(_0x9a4b2a,null))['catch'](handleError(_0x9a4b2a,null));};exports[_0xfabc('0x4d')]=function(_0xc4d57f,_0x589fc){var _0x265848=_0xc4d57f[_0xfabc('0x32')][_0xfabc('0x4e')];return db[_0xfabc('0x4f')]['findAll']({'where':{'id':_0x265848},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfabc('0x50'),'attributes':['id',_0xfabc('0x1a'),'online',_0xfabc('0x51'),'interface'],'raw':!![]}]})['then'](function(_0x1fcc58){if(_0x1fcc58){var _0x7cedb9=_[_0xfabc('0x52')](_0x1fcc58,function(_0x5a51ec){var _0x1dae72=_0x5a51ec[_0xfabc('0x16')]({'plain':!![]});return _0x1dae72[_0xfabc('0x50')];});return db['OpenchannelQueue'][_0xfabc('0x30')]({'where':{'id':_0xc4d57f[_0xfabc('0x26')]['id']}})['then'](function(_0x56c465){return db[_0xfabc('0x53')][_0xfabc('0x54')](function(_0x1add82){return _0x56c465[_0xfabc('0x4d')](_0x265848,{'transaction':_0x1add82})[_0xfabc('0x14')](function(){return BPromise['each'](_0x7cedb9,function(_0x2676ea){return db['UserOpenchannelQueue'][_0xfabc('0x55')]({'where':{'UserId':_0x2676ea['id'],'OpenchannelQueueId':_0xc4d57f[_0xfabc('0x26')]['id']},'transaction':_0x1add82});});})['then'](function(){_0x7cedb9[_0xfabc('0x56')](function(_0x139215){socket['emit'](_0xfabc('0x57'),{'UserId':_0x139215['id'],'OpenchannelQueueId':_0x56c465['id']});});});});});}})[_0xfabc('0x14')](respondWithStatusCode(_0x589fc,null))[_0xfabc('0x24')](handleError(_0x589fc,null));};exports[_0xfabc('0x58')]=function(_0x8dd0c4,_0x2f0ed4){return db[_0xfabc('0x4f')][_0xfabc('0x22')]({'where':{'id':_0x8dd0c4[_0xfabc('0x28')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f0ed4,null))['then'](function(_0x1e1f0a){var _0x1a9aff=_['map'](_0x1e1f0a,'id');var _0x1c5275=[];var _0x3e63d7=[];var _0x4ebbd8=squel[_0xfabc('0x59')]();_0x4ebbd8['field'](_0xfabc('0x5a'))[_0xfabc('0x5b')](_0xfabc('0x5c'),'tq')['join'](_0xfabc('0x5d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('OpenchannelQueueId\x20=\x20?',_0x8dd0c4[_0xfabc('0x26')]['id']);for(var _0x42f647=0x0;_0x42f647<_0x1e1f0a[_0xfabc('0x2d')];_0x42f647+=0x1){let _0x266541=_0x1e1f0a[_0x42f647];for(var _0x21f0ed=0x0;_0x21f0ed<_0x266541[_0xfabc('0x50')][_0xfabc('0x2d')];_0x21f0ed+=0x1){let _0x87a6cf=_0x266541[_0xfabc('0x50')][_0x21f0ed];var _0x2e6549=_0x4ebbd8[_0xfabc('0x5e')]();_0x2e6549[_0xfabc('0x20')](_0xfabc('0x5f'),_0x87a6cf['id']);_0x3e63d7['push'](db[_0xfabc('0x53')][_0xfabc('0x28')](_0x2e6549[_0xfabc('0x60')](),{'type':db[_0xfabc('0x53')][_0xfabc('0x61')][_0xfabc('0x62')]})['then'](function(_0xf81c86){if(_0xf81c86[_0xfabc('0x2d')]===0x1){return _0x87a6cf['id'];}else{var _0x101e7f=_[_0xfabc('0x63')](_[_0xfabc('0x1c')](_0xf81c86,_0xfabc('0x64')),function(_0x21def5){return _['includes'](_0x1a9aff,_0x21def5);});if(_0x101e7f){return _0x87a6cf['id'];}}}));}}return BPromise['all'](_0x3e63d7)['then'](function(_0x711fb){_0x1c5275=_(_0x1c5275)[_0xfabc('0x65')](_0x711fb)[_0xfabc('0x66')]()[_0xfabc('0x67')]();return db[_0xfabc('0x1d')][_0xfabc('0x30')]({'where':{'id':_0x8dd0c4[_0xfabc('0x26')]['id']}})[_0xfabc('0x14')](function(_0x2c731d){return db['sequelize'][_0xfabc('0x54')](function(_0x2ed853){return _0x2c731d[_0xfabc('0x58')](_0x8dd0c4[_0xfabc('0x28')][_0xfabc('0x4e')],{'transaction':_0x2ed853})['then'](function(){if(!_[_0xfabc('0x68')](_0x1c5275)){return _0x2c731d['removeAgents'](_0x1c5275,{'transaction':_0x2ed853});}})['then'](function(){_0x1c5275[_0xfabc('0x56')](function(_0x437ae5){socket[_0xfabc('0x69')]('userOpenchannelQueue:remove',{'UserId':_0x437ae5,'OpenchannelQueueId':_0x2c731d['id']});});});});});});})[_0xfabc('0x14')](respondWithStatusCode(_0x2f0ed4,null))[_0xfabc('0x24')](handleError(_0x2f0ed4,null));};exports[_0xfabc('0x6a')]=function(_0x17e4ef,_0x4c2b5e){return db[_0xfabc('0x1d')][_0xfabc('0x30')]({'where':{'id':_0x17e4ef[_0xfabc('0x26')]['id']}})[_0xfabc('0x14')](handleEntityNotFound(_0x4c2b5e,null))[_0xfabc('0x14')](function(_0x41f567){if(_0x41f567){return _0x41f567[_0xfabc('0x6a')](_0x17e4ef[_0xfabc('0x32')][_0xfabc('0x4e')],_[_0xfabc('0x6b')](_0x17e4ef[_0xfabc('0x32')],[_0xfabc('0x4e'),'id'])||{})[_0xfabc('0x6c')](function(_0x154468){for(var _0x3c1f14=0x0;_0x3c1f14<_0x17e4ef[_0xfabc('0x32')][_0xfabc('0x4e')][_0xfabc('0x2d')];_0x3c1f14+=0x1){socket['emit'](_0xfabc('0x57'),{'UserId':Number(_0x17e4ef[_0xfabc('0x32')][_0xfabc('0x4e')][_0x3c1f14]),'OpenchannelQueueId':Number(_0x17e4ef[_0xfabc('0x26')]['id'])});}return _0x154468;});}})['then'](respondWithResult(_0x4c2b5e,null))[_0xfabc('0x24')](handleError(_0x4c2b5e,null));};exports[_0xfabc('0x6d')]=function(_0x118464,_0x21a06e){return db[_0xfabc('0x1d')][_0xfabc('0x30')]({'where':{'id':_0x118464[_0xfabc('0x26')]['id']}})['then'](handleEntityNotFound(_0x21a06e,null))[_0xfabc('0x14')](function(_0x5870bc){if(_0x5870bc){return _0x5870bc[_0xfabc('0x6d')](_0x118464[_0xfabc('0x28')][_0xfabc('0x4e')])[_0xfabc('0x14')](function(){if(_[_0xfabc('0x6e')](_0x118464[_0xfabc('0x28')][_0xfabc('0x4e')])){for(var _0x294799=0x0;_0x294799<_0x118464[_0xfabc('0x28')][_0xfabc('0x4e')][_0xfabc('0x2d')];_0x294799+=0x1){socket[_0xfabc('0x69')](_0xfabc('0x6f'),{'UserId':Number(_0x118464['query']['ids'][_0x294799]),'OpenchannelQueueId':Number(_0x118464[_0xfabc('0x26')]['id'])});}}else{socket[_0xfabc('0x69')]('userOpenchannelQueue:remove',{'UserId':Number(_0x118464['query']['ids']),'OpenchannelQueueId':Number(_0x118464['params']['id'])});}});}})['then'](respondWithStatusCode(_0x21a06e,null))[_0xfabc('0x24')](handleError(_0x21a06e,null));};exports[_0xfabc('0x70')]=function(_0x25f094,_0x3db547){var _0x12e596={};var _0x121213={};var _0x2b6a4b;var _0x4f6859;return db[_0xfabc('0x1d')][_0xfabc('0x3a')]({'where':{'id':_0x25f094[_0xfabc('0x26')]['id']}})[_0xfabc('0x14')](handleEntityNotFound(_0x3db547,null))[_0xfabc('0x14')](function(_0x431060){if(_0x431060){_0x2b6a4b=_0x431060;_0x121213[_0xfabc('0x27')]=_['keys'](db[_0xfabc('0x42')][_0xfabc('0x1e')]);_0x121213[_0xfabc('0x28')]=_['keys'](_0x25f094[_0xfabc('0x28')]);_0x121213[_0xfabc('0x40')]=_[_0xfabc('0x2b')](_0x121213['model'],_0x121213[_0xfabc('0x28')]);_0x12e596['attributes']=_[_0xfabc('0x2b')](_0x121213[_0xfabc('0x27')],qs[_0xfabc('0x2c')](_0x25f094['query'][_0xfabc('0x2c')]));_0x12e596[_0xfabc('0x2a')]=_0x12e596['attributes']['length']?_0x12e596[_0xfabc('0x2a')]:_0x121213[_0xfabc('0x27')];_0x12e596['order']=qs[_0xfabc('0x3f')](_0x25f094[_0xfabc('0x28')][_0xfabc('0x3f')]);_0x12e596[_0xfabc('0x20')]=qs[_0xfabc('0x40')](_[_0xfabc('0x71')](_0x25f094[_0xfabc('0x28')],_0x121213[_0xfabc('0x40')]));if(_0x25f094[_0xfabc('0x28')][_0xfabc('0x41')]){_0x12e596[_0xfabc('0x20')]=_[_0xfabc('0x2e')](_0x12e596[_0xfabc('0x20')],{'$or':_[_0xfabc('0x1c')](_0x12e596[_0xfabc('0x2a')],function(_0x3f5cc){var _0x45e6a1={};_0x45e6a1[_0x3f5cc]={'$like':'%'+_0x25f094[_0xfabc('0x28')]['filter']+'%'};return _0x45e6a1;})});}_0x12e596=_[_0xfabc('0x2e')]({},_0x12e596,_0x25f094[_0xfabc('0x2f')]);return _0x2b6a4b[_0xfabc('0x70')](_0x12e596);}})['then'](function(_0x21a974){if(_0x21a974){_0x4f6859=_0x21a974[_0xfabc('0x2d')];if(!_0x25f094[_0xfabc('0x28')][_0xfabc('0x3c')](_0xfabc('0x3d'))){_0x12e596[_0xfabc('0xe')]=qs[_0xfabc('0xe')](_0x25f094[_0xfabc('0x28')][_0xfabc('0xe')]);_0x12e596[_0xfabc('0x10')]=qs[_0xfabc('0x10')](_0x25f094[_0xfabc('0x28')][_0xfabc('0x10')]);}return _0x2b6a4b['getAgents'](_0x12e596);}})['then'](function(_0x922b6c){if(_0x922b6c){return _0x922b6c?{'count':_0x4f6859,'rows':_0x922b6c}:null;}})[_0xfabc('0x14')](respondWithResult(_0x3db547,null))[_0xfabc('0x24')](handleError(_0x3db547,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 797e9de..70bd98e 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 _0x9934=['update','emit','hook','exports','../../mysqldb','OpenchannelQueue'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x9934,0x1de));var _0x4993=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x9934[_0x2070da];return _0x4f9fe1;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x4993('0x0'))['db'][_0x4993('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4993('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1d231f){return function(_0x5c02b8,_0x2691b0,_0x1ad85b){OpenchannelQueueEvents[_0x4993('0x3')](_0x1d231f+':'+_0x5c02b8['id'],_0x5c02b8);OpenchannelQueueEvents[_0x4993('0x3')](_0x1d231f,_0x5c02b8);_0x1ad85b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4993('0x4')](e,emitEvent(event));}}module[_0x4993('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xdf3e=['remove','emit','hook','exports','events','OpenchannelQueue','save'];(function(_0x4fafa4,_0x53a6f2){var _0x40795f=function(_0x5372e8){while(--_0x5372e8){_0x4fafa4['push'](_0x4fafa4['shift']());}};_0x40795f(++_0x53a6f2);}(_0xdf3e,0xeb));var _0xedf3=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xdf3e[_0x3d42d8];return _0x27fc41;};'use strict';var EventEmitter=require(_0xedf3('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xedf3('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xedf3('0x2'),'afterUpdate':'update','afterDestroy':_0xedf3('0x3')};function emitEvent(_0xe4f3db){return function(_0x28cbef,_0x55cf07,_0x547951){OpenchannelQueueEvents['emit'](_0xe4f3db+':'+_0x28cbef['id'],_0x28cbef);OpenchannelQueueEvents[_0xedf3('0x4')](_0xe4f3db,_0x28cbef);_0x547951(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xedf3('0x5')](e,emitEvent(event));}}module[_0xedf3('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 6bc028a..4ddb6a2 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 _0x7680=['path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','bluebird','request-promise'];(function(_0x1c6f42,_0x4ff2fb){var _0x443f36=function(_0x3b98f1){while(--_0x3b98f1){_0x1c6f42['push'](_0x1c6f42['shift']());}};_0x443f36(++_0x4ff2fb);}(_0x7680,0x104));var _0x0768=function(_0x5380cd,_0x1ea634){_0x5380cd=_0x5380cd-0x0;var _0x25dd61=_0x7680[_0x5380cd];return _0x25dd61;};'use strict';var _=require('lodash');var util=require(_0x0768('0x0'));var logger=require(_0x0768('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0768('0x2'));var rp=require(_0x0768('0x3'));var fs=require('fs');var path=require(_0x0768('0x4'));var rimraf=require('rimraf');var config=require(_0x0768('0x5'));var attributes=require(_0x0768('0x6'));module[_0x0768('0x7')]=function(_0x3abe32,_0x2136e5){return _0x3abe32[_0x0768('0x8')](_0x0768('0x9'),attributes,{'tableName':_0x0768('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger'];(function(_0x5a5e8b,_0x29d656){var _0x2b3a20=function(_0xda2ba6){while(--_0xda2ba6){_0x5a5e8b['push'](_0x5a5e8b['shift']());}};_0x2b3a20(++_0x29d656);}(_0x94da,0x1eb));var _0xa94d=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x94da[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0xa94d('0x0'));var util=require(_0xa94d('0x1'));var logger=require(_0xa94d('0x2'))(_0xa94d('0x3'));var moment=require(_0xa94d('0x4'));var BPromise=require(_0xa94d('0x5'));var rp=require(_0xa94d('0x6'));var fs=require('fs');var path=require(_0xa94d('0x7'));var rimraf=require(_0xa94d('0x8'));var config=require(_0xa94d('0x9'));var attributes=require('./openchannelQueue.attributes');module[_0xa94d('0xa')]=function(_0x5638e6,_0x51b686){return _0x5638e6['define'](_0xa94d('0xb'),attributes,{'tableName':_0xa94d('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 90b8bfa..520746e 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 _0x03e9=['message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','stringify','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x3344a5,_0x19d370){var _0x46b7e7=function(_0x45d3bd){while(--_0x45d3bd){_0x3344a5['push'](_0x3344a5['shift']());}};_0x46b7e7(++_0x19d370);}(_0x03e9,0x100));var _0x903e=function(_0x2b4c60,_0x38fc71){_0x2b4c60=_0x2b4c60-0x0;var _0x483494=_0x03e9[_0x2b4c60];return _0x483494;};'use strict';var _=require(_0x903e('0x0'));var util=require('util');var moment=require(_0x903e('0x1'));var BPromise=require(_0x903e('0x2'));var rs=require(_0x903e('0x3'));var fs=require('fs');var Redis=require(_0x903e('0x4'));var db=require(_0x903e('0x5'))['db'];var utils=require(_0x903e('0x6'));var logger=require(_0x903e('0x7'))(_0x903e('0x8'));var config=require(_0x903e('0x9'));var jayson=require(_0x903e('0xa'));var client=jayson[_0x903e('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x903e('0xc')],{'host':_0x903e('0xd'),'port':0x18eb});var socket=require(_0x903e('0xe'))(new Redis(config[_0x903e('0xc')]));require(_0x903e('0xf'))['register'](socket);function respondWithRpcPromise(_0xdf23ca,_0x15a098,_0x4b2524){return new BPromise(function(_0x1c88c4,_0x16474e){return client[_0x903e('0x10')](_0xdf23ca,_0x4b2524)[_0x903e('0x11')](function(_0x1e1161){logger[_0x903e('0x12')](_0x903e('0x13'),_0x15a098,'request\x20sent');logger[_0x903e('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x15a098,_0x903e('0x15'),JSON['stringify'](_0x1e1161));if(_0x1e1161[_0x903e('0x16')]){if(_0x1e1161[_0x903e('0x16')][_0x903e('0x17')]===0x1f4){logger[_0x903e('0x16')](_0x903e('0x13'),_0x15a098,_0x1e1161[_0x903e('0x16')]['message']);return _0x16474e(_0x1e1161[_0x903e('0x16')]['message']);}logger[_0x903e('0x16')](_0x903e('0x13'),_0x15a098,_0x1e1161[_0x903e('0x16')]['message']);return _0x1c88c4(_0x1e1161[_0x903e('0x16')][_0x903e('0x18')]);}else{logger[_0x903e('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x15a098,_0x903e('0x15'));_0x1c88c4(_0x1e1161[_0x903e('0x19')][_0x903e('0x18')]);}})[_0x903e('0x1a')](function(_0x2f3484){logger[_0x903e('0x16')](_0x903e('0x13'),_0x15a098,_0x2f3484);_0x16474e(_0x2f3484);});});}exports[_0x903e('0x1b')]=function(_0x27cb31){var _0xf80c0a=this;return new Promise(function(_0x36922b,_0x30901f){return db[_0x903e('0x1c')][_0x903e('0x1d')]({'raw':_0x27cb31['options']?_0x27cb31[_0x903e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x27cb31[_0x903e('0x1e')]?_0x27cb31[_0x903e('0x1e')][_0x903e('0x1f')]||null:null,'attributes':_0x27cb31[_0x903e('0x1e')]?_0x27cb31[_0x903e('0x1e')][_0x903e('0x20')]||null:null,'limit':_0x27cb31['options']?_0x27cb31[_0x903e('0x1e')][_0x903e('0x21')]||null:null,'include':_0x27cb31[_0x903e('0x1e')]?_0x27cb31[_0x903e('0x1e')][_0x903e('0x22')]?_[_0x903e('0x23')](_0x27cb31['options'][_0x903e('0x22')],function(_0x37632c){return{'model':db[_0x37632c[_0x903e('0x24')]],'as':_0x37632c['as'],'attributes':_0x37632c[_0x903e('0x20')],'include':_0x37632c[_0x903e('0x22')]?_[_0x903e('0x23')](_0x37632c[_0x903e('0x22')],function(_0x365c28){return{'model':db[_0x365c28['model']],'as':_0x365c28['as'],'attributes':_0x365c28[_0x903e('0x20')],'include':_0x365c28['include']?_[_0x903e('0x23')](_0x365c28[_0x903e('0x22')],function(_0x575af9){return{'model':db[_0x575af9[_0x903e('0x24')]],'as':_0x575af9['as'],'attributes':_0x575af9[_0x903e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x133f50){logger[_0x903e('0x12')](_0x903e('0x1b'),_0x27cb31);logger[_0x903e('0x14')]('GetOpenchannelQueue',_0x27cb31,JSON[_0x903e('0x25')](_0x133f50));_0x36922b(_0x133f50);})[_0x903e('0x1a')](function(_0x52be21){logger[_0x903e('0x16')](_0x903e('0x1b'),_0x52be21[_0x903e('0x18')],_0x27cb31);_0x30901f(_0xf80c0a[_0x903e('0x16')](0x1f4,_0x52be21[_0x903e('0x18')]));});});};exports[_0x903e('0x26')]=function(_0x48ef85){var _0x1e3c86=this;return new Promise(function(_0x3bbdc6,_0x3b6c0d){return db[_0x903e('0x1c')][_0x903e('0x27')]({'raw':_0x48ef85[_0x903e('0x1e')]?_0x48ef85['options']['raw']===undefined?!![]:![]:!![],'where':_0x48ef85[_0x903e('0x1e')]?_0x48ef85[_0x903e('0x1e')][_0x903e('0x1f')]||null:null,'attributes':_0x48ef85[_0x903e('0x1e')]?_0x48ef85['options'][_0x903e('0x20')]||null:null,'include':_0x48ef85['options']?_0x48ef85['options']['include']?_[_0x903e('0x23')](_0x48ef85[_0x903e('0x1e')][_0x903e('0x22')],function(_0x1a639e){return{'model':db[_0x1a639e[_0x903e('0x24')]],'as':_0x1a639e['as'],'attributes':_0x1a639e['attributes'],'include':_0x1a639e[_0x903e('0x22')]?_[_0x903e('0x23')](_0x1a639e[_0x903e('0x22')],function(_0x468ba6){return{'model':db[_0x468ba6['model']],'as':_0x468ba6['as'],'attributes':_0x468ba6['attributes'],'include':_0x468ba6[_0x903e('0x22')]?_[_0x903e('0x23')](_0x468ba6[_0x903e('0x22')],function(_0x1340e5){return{'model':db[_0x1340e5[_0x903e('0x24')]],'as':_0x1340e5['as'],'attributes':_0x1340e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x903e('0x11')](function(_0x2b5514){logger[_0x903e('0x12')](_0x903e('0x26'),_0x48ef85);logger['debug'](_0x903e('0x26'),_0x48ef85,JSON['stringify'](_0x2b5514));_0x3bbdc6(_0x2b5514);})[_0x903e('0x1a')](function(_0x669d3b){logger['error'](_0x903e('0x26'),_0x669d3b[_0x903e('0x18')],_0x48ef85);_0x3b6c0d(_0x1e3c86[_0x903e('0x16')](0x1f4,_0x669d3b['message']));});});}; \ No newline at end of file +var _0x16f2=['request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','raw','options','attributes','limit','include','model','map','then','debug','ShowOpenchannelQueue','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','./openchannelQueue.socket','register','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x3705f7,_0x2553c4){var _0x2a1cf2=function(_0x51f080){while(--_0x51f080){_0x3705f7['push'](_0x3705f7['shift']());}};_0x2a1cf2(++_0x2553c4);}(_0x16f2,0x1df));var _0x216f=function(_0x2e1058,_0x535e8c){_0x2e1058=_0x2e1058-0x0;var _0x3b9d5b=_0x16f2[_0x2e1058];return _0x3b9d5b;};'use strict';var _=require('lodash');var util=require(_0x216f('0x0'));var moment=require(_0x216f('0x1'));var BPromise=require(_0x216f('0x2'));var rs=require(_0x216f('0x3'));var fs=require('fs');var Redis=require(_0x216f('0x4'));var db=require(_0x216f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x216f('0x6'))(_0x216f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x216f('0x8')][_0x216f('0x9')]({'port':0x232a});config[_0x216f('0xa')]=_['defaults'](config['redis'],{'host':_0x216f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x216f('0xa')]));require(_0x216f('0xc'))[_0x216f('0xd')](socket);function respondWithRpcPromise(_0x496e48,_0x463c99,_0x18b1b4){return new BPromise(function(_0x330b64,_0x4dc195){return client['request'](_0x496e48,_0x18b1b4)['then'](function(_0xb25840){logger['info'](_0x216f('0xe'),_0x463c99,_0x216f('0xf'));logger['debug'](_0x216f('0x10'),_0x463c99,_0x216f('0xf'),JSON[_0x216f('0x11')](_0xb25840));if(_0xb25840[_0x216f('0x12')]){if(_0xb25840['error'][_0x216f('0x13')]===0x1f4){logger[_0x216f('0x12')](_0x216f('0xe'),_0x463c99,_0xb25840['error'][_0x216f('0x14')]);return _0x4dc195(_0xb25840[_0x216f('0x12')]['message']);}logger[_0x216f('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x463c99,_0xb25840['error'][_0x216f('0x14')]);return _0x330b64(_0xb25840[_0x216f('0x12')][_0x216f('0x14')]);}else{logger[_0x216f('0x15')](_0x216f('0xe'),_0x463c99,'request\x20sent');_0x330b64(_0xb25840[_0x216f('0x16')][_0x216f('0x14')]);}})[_0x216f('0x17')](function(_0x489708){logger[_0x216f('0x12')](_0x216f('0xe'),_0x463c99,_0x489708);_0x4dc195(_0x489708);});});}exports[_0x216f('0x18')]=function(_0x1a6a92){var _0x37b98f=this;return new Promise(function(_0x55c969,_0x54e1d9){return db[_0x216f('0x19')]['findAll']({'raw':_0x1a6a92['options']?_0x1a6a92['options'][_0x216f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a6a92['options']?_0x1a6a92['options']['where']||null:null,'attributes':_0x1a6a92[_0x216f('0x1b')]?_0x1a6a92[_0x216f('0x1b')][_0x216f('0x1c')]||null:null,'limit':_0x1a6a92[_0x216f('0x1b')]?_0x1a6a92['options'][_0x216f('0x1d')]||null:null,'include':_0x1a6a92[_0x216f('0x1b')]?_0x1a6a92[_0x216f('0x1b')][_0x216f('0x1e')]?_['map'](_0x1a6a92[_0x216f('0x1b')][_0x216f('0x1e')],function(_0x58020b){return{'model':db[_0x58020b[_0x216f('0x1f')]],'as':_0x58020b['as'],'attributes':_0x58020b[_0x216f('0x1c')],'include':_0x58020b[_0x216f('0x1e')]?_[_0x216f('0x20')](_0x58020b['include'],function(_0x473a09){return{'model':db[_0x473a09[_0x216f('0x1f')]],'as':_0x473a09['as'],'attributes':_0x473a09[_0x216f('0x1c')],'include':_0x473a09[_0x216f('0x1e')]?_['map'](_0x473a09['include'],function(_0x28487d){return{'model':db[_0x28487d[_0x216f('0x1f')]],'as':_0x28487d['as'],'attributes':_0x28487d['attributes']};}):[]};}):[]};}):[]:[]})[_0x216f('0x21')](function(_0x4bc642){logger[_0x216f('0x15')](_0x216f('0x18'),_0x1a6a92);logger[_0x216f('0x22')]('GetOpenchannelQueue',_0x1a6a92,JSON[_0x216f('0x11')](_0x4bc642));_0x55c969(_0x4bc642);})[_0x216f('0x17')](function(_0x25b4ce){logger[_0x216f('0x12')]('GetOpenchannelQueue',_0x25b4ce['message'],_0x1a6a92);_0x54e1d9(_0x37b98f[_0x216f('0x12')](0x1f4,_0x25b4ce['message']));});});};exports[_0x216f('0x23')]=function(_0x34079b){var _0xbab508=this;return new Promise(function(_0x311f23,_0x29446b){return db[_0x216f('0x19')][_0x216f('0x24')]({'raw':_0x34079b[_0x216f('0x1b')]?_0x34079b[_0x216f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x34079b['options']?_0x34079b['options'][_0x216f('0x25')]||null:null,'attributes':_0x34079b[_0x216f('0x1b')]?_0x34079b['options'][_0x216f('0x1c')]||null:null,'include':_0x34079b[_0x216f('0x1b')]?_0x34079b[_0x216f('0x1b')]['include']?_[_0x216f('0x20')](_0x34079b['options'][_0x216f('0x1e')],function(_0x335663){return{'model':db[_0x335663[_0x216f('0x1f')]],'as':_0x335663['as'],'attributes':_0x335663[_0x216f('0x1c')],'include':_0x335663[_0x216f('0x1e')]?_[_0x216f('0x20')](_0x335663[_0x216f('0x1e')],function(_0x39ced3){return{'model':db[_0x39ced3['model']],'as':_0x39ced3['as'],'attributes':_0x39ced3[_0x216f('0x1c')],'include':_0x39ced3[_0x216f('0x1e')]?_['map'](_0x39ced3[_0x216f('0x1e')],function(_0x72ca61){return{'model':db[_0x72ca61['model']],'as':_0x72ca61['as'],'attributes':_0x72ca61['attributes']};}):[]};}):[]};}):[]:[]})[_0x216f('0x21')](function(_0x476793){logger[_0x216f('0x15')](_0x216f('0x23'),_0x34079b);logger[_0x216f('0x22')](_0x216f('0x23'),_0x34079b,JSON['stringify'](_0x476793));_0x311f23(_0x476793);})[_0x216f('0x17')](function(_0x2d425e){logger[_0x216f('0x12')](_0x216f('0x23'),_0x2d425e['message'],_0x34079b);_0x29446b(_0xbab508['error'](0x1f4,_0x2d425e[_0x216f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 843273c..9863ecc 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 _0xa57b=['emit','removeListener','register','openchannelQueue:','save','remove'];(function(_0x3d205e,_0x2479c4){var _0x349231=function(_0x3ed66e){while(--_0x3ed66e){_0x3d205e['push'](_0x3d205e['shift']());}};_0x349231(++_0x2479c4);}(_0xa57b,0x9a));var _0xba57=function(_0x4f6b4c,_0x3f5b39){_0x4f6b4c=_0x4f6b4c-0x0;var _0x30826a=_0xa57b[_0x4f6b4c];return _0x30826a;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xba57('0x0'),_0xba57('0x1'),'update'];function createListener(_0x374cfd,_0xdd71d0){return function(_0x3656f1){_0xdd71d0[_0xba57('0x2')](_0x374cfd,_0x3656f1);};}function removeListener(_0x50a05c,_0x4cc72f){return function(){OpenchannelQueueEvents[_0xba57('0x3')](_0x50a05c,_0x4cc72f);};}exports[_0xba57('0x4')]=function(_0x22f4f8){for(var _0x104eaa=0x0,_0x7bbe9c=events['length'];_0x104eaa<_0x7bbe9c;_0x104eaa++){var _0x4f2ed0=events[_0x104eaa];var _0x5eb442=createListener(_0xba57('0x5')+_0x4f2ed0,_0x22f4f8);OpenchannelQueueEvents['on'](_0x4f2ed0,_0x5eb442);}}; \ No newline at end of file +var _0xaaa7=['openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','length'];(function(_0x412faa,_0x6d5ea8){var _0x204402=function(_0x1ddbe0){while(--_0x1ddbe0){_0x412faa['push'](_0x412faa['shift']());}};_0x204402(++_0x6d5ea8);}(_0xaaa7,0x104));var _0x7aaa=function(_0x12f9ba,_0x2ae335){_0x12f9ba=_0x12f9ba-0x0;var _0x1eea0c=_0xaaa7[_0x12f9ba];return _0x1eea0c;};'use strict';var OpenchannelQueueEvents=require(_0x7aaa('0x0'));var events=[_0x7aaa('0x1'),_0x7aaa('0x2'),_0x7aaa('0x3')];function createListener(_0x59c5a2,_0x1e8bdd){return function(_0x9dfb99){_0x1e8bdd[_0x7aaa('0x4')](_0x59c5a2,_0x9dfb99);};}function removeListener(_0x432e04,_0xb39b58){return function(){OpenchannelQueueEvents['removeListener'](_0x432e04,_0xb39b58);};}exports['register']=function(_0x9010e2){for(var _0x2f7f95=0x0,_0x5979e0=events[_0x7aaa('0x5')];_0x2f7f95<_0x5979e0;_0x2f7f95++){var _0x27cd44=events[_0x2f7f95];var _0x5012ca=createListener(_0x7aaa('0x6')+_0x27cd44,_0x9010e2);OpenchannelQueueEvents['on'](_0x27cd44,_0x5012ca);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 12e700a..9b5990d 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 _0xeb98=['index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated'];(function(_0x2ba665,_0x30361e){var _0xc5e4f5=function(_0x416a73){while(--_0x416a73){_0x2ba665['push'](_0x2ba665['shift']());}};_0xc5e4f5(++_0x30361e);}(_0xeb98,0x19a));var _0x8eb9=function(_0xb87a0b,_0xba13fe){_0xb87a0b=_0xb87a0b-0x0;var _0x366279=_0xeb98[_0xb87a0b];return _0x366279;};'use strict';var multer=require(_0x8eb9('0x0'));var util=require(_0x8eb9('0x1'));var path=require('path');var timeout=require(_0x8eb9('0x2'));var express=require('express');var router=express[_0x8eb9('0x3')]();var fs_extra=require(_0x8eb9('0x4'));var auth=require(_0x8eb9('0x5'));var interaction=require(_0x8eb9('0x6'));var config=require('../../config/environment');var controller=require(_0x8eb9('0x7'));router[_0x8eb9('0x8')]('/',auth[_0x8eb9('0x9')](),controller[_0x8eb9('0xa')]);router[_0x8eb9('0x8')](_0x8eb9('0xb'),auth[_0x8eb9('0x9')](),controller[_0x8eb9('0xc')]);router[_0x8eb9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8eb9('0xd')]);router[_0x8eb9('0xe')]('/',auth[_0x8eb9('0x9')](),controller[_0x8eb9('0xf')]);router[_0x8eb9('0x10')](_0x8eb9('0x11'),auth[_0x8eb9('0x9')](),controller[_0x8eb9('0x12')]);router[_0x8eb9('0x13')](_0x8eb9('0x11'),auth[_0x8eb9('0x9')](),controller[_0x8eb9('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd2f6=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','create','delete','destroy','exports','multer'];(function(_0x4367bd,_0x31c2ab){var _0x2254e4=function(_0x3c2998){while(--_0x3c2998){_0x4367bd['push'](_0x4367bd['shift']());}};_0x2254e4(++_0x31c2ab);}(_0xd2f6,0x1b7));var _0x6d2f=function(_0x2c3447,_0x441f4a){_0x2c3447=_0x2c3447-0x0;var _0x37dd03=_0xd2f6[_0x2c3447];return _0x37dd03;};'use strict';var multer=require(_0x6d2f('0x0'));var util=require(_0x6d2f('0x1'));var path=require(_0x6d2f('0x2'));var timeout=require(_0x6d2f('0x3'));var express=require('express');var router=express[_0x6d2f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d2f('0x5'));var interaction=require(_0x6d2f('0x6'));var config=require(_0x6d2f('0x7'));var controller=require(_0x6d2f('0x8'));router['get']('/',auth[_0x6d2f('0x9')](),controller[_0x6d2f('0xa')]);router['get'](_0x6d2f('0xb'),auth[_0x6d2f('0x9')](),controller[_0x6d2f('0xc')]);router[_0x6d2f('0xd')](_0x6d2f('0xe'),auth[_0x6d2f('0x9')](),controller[_0x6d2f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6d2f('0x10')]);router['put'](_0x6d2f('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x6d2f('0x11')](_0x6d2f('0xe'),auth[_0x6d2f('0x9')](),controller[_0x6d2f('0x12')]);module[_0x6d2f('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 957b261..566469a 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 _0xd1e4=['DATE','moment','exports','STRING'];(function(_0x11a3c3,_0x59acac){var _0x7afd2f=function(_0x14d853){while(--_0x14d853){_0x11a3c3['push'](_0x11a3c3['shift']());}};_0x7afd2f(++_0x59acac);}(_0xd1e4,0x8d));var _0x4d1e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd1e4[_0x413feb];return _0x40ee88;};'use strict';var moment=require(_0x4d1e('0x0'));var Sequelize=require('sequelize');module[_0x4d1e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4d1e('0x2')]},'joinAt':{'type':Sequelize[_0x4d1e('0x3')]},'leaveAt':{'type':Sequelize[_0x4d1e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4d1e('0x2')]}}; \ No newline at end of file +var _0x4751=['DATE','moment','exports','STRING'];(function(_0xd29f6b,_0x5c34c1){var _0x5d7c29=function(_0x2dbec3){while(--_0x2dbec3){_0xd29f6b['push'](_0xd29f6b['shift']());}};_0x5d7c29(++_0x5c34c1);}(_0x4751,0x85));var _0x1475=function(_0xb637af,_0x282e88){_0xb637af=_0xb637af-0x0;var _0x5016f9=_0x4751[_0xb637af];return _0x5016f9;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5171e03..88a81e8 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 _0xdfe2=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','count','Content-Range','json','apply','save','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','show','includeAll','find','catch','create','body','update','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel'];(function(_0x2ee01d,_0x48f7a7){var _0x24bc9f=function(_0x2c23fd){while(--_0x2c23fd){_0x2ee01d['push'](_0x2ee01d['shift']());}};_0x24bc9f(++_0x48f7a7);}(_0xdfe2,0x115));var _0x2dfe=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xdfe2[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dfe('0x0'));var zipdir=require(_0x2dfe('0x1'));var jsonpatch=require(_0x2dfe('0x2'));var rp=require('request-promise');var moment=require(_0x2dfe('0x3'));var BPromise=require(_0x2dfe('0x4'));var Mustache=require('mustache');var util=require(_0x2dfe('0x5'));var path=require('path');var sox=require(_0x2dfe('0x6'));var csv=require(_0x2dfe('0x7'));var ejs=require(_0x2dfe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dfe('0x9'));var squel=require(_0x2dfe('0xa'));var crypto=require(_0x2dfe('0xb'));var jsforce=require(_0x2dfe('0xc'));var deskjs=require(_0x2dfe('0xd'));var toCsv=require(_0x2dfe('0x7'));var querystring=require(_0x2dfe('0xe'));var Papa=require(_0x2dfe('0xf'));var Redis=require(_0x2dfe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2dfe('0x11'));var as=require(_0x2dfe('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dfe('0x13'))(_0x2dfe('0x14'));var utils=require('../../config/utils');var config=require(_0x2dfe('0x15'));var licenseUtil=require(_0x2dfe('0x16'));var db=require(_0x2dfe('0x17'))['db'];function respondWithStatusCode(_0x4a2078,_0x29b256){_0x29b256=_0x29b256||0xcc;return function(_0x5a021c){if(_0x5a021c){return _0x4a2078['sendStatus'](_0x29b256);}return _0x4a2078[_0x2dfe('0x18')](_0x29b256)[_0x2dfe('0x19')]();};}function respondWithResult(_0x10c672,_0xe00886){_0xe00886=_0xe00886||0xc8;return function(_0x203ec9){if(_0x203ec9){return _0x10c672['status'](_0xe00886)['json'](_0x203ec9);}};}function respondWithFilteredResult(_0x285638,_0x127b28){return function(_0x512295){if(_0x512295){var _0x2db60e=typeof _0x127b28[_0x2dfe('0x1a')]==='undefined'&&typeof _0x127b28[_0x2dfe('0x1b')]==='undefined';var _0x4f857e=_0x512295[_0x2dfe('0x1c')];var _0x59b489=_0x2db60e?0x0:_0x127b28['offset'];var _0x139dca=_0x2db60e?_0x512295[_0x2dfe('0x1c')]:_0x127b28[_0x2dfe('0x1a')]+_0x127b28['limit'];var _0x3b2194;if(_0x139dca>=_0x4f857e){_0x139dca=_0x4f857e;_0x3b2194=0xc8;}else{_0x3b2194=0xce;}_0x285638[_0x2dfe('0x18')](_0x3b2194);return _0x285638['set'](_0x2dfe('0x1d'),_0x59b489+'-'+_0x139dca+'/'+_0x4f857e)[_0x2dfe('0x1e')](_0x512295);}return null;};}function patchUpdates(_0xb5f034){return function(_0x83195){try{jsonpatch[_0x2dfe('0x1f')](_0x83195,_0xb5f034,!![]);}catch(_0x4ccfca){return BPromise['reject'](_0x4ccfca);}return _0x83195[_0x2dfe('0x20')]();};}function saveUpdates(_0x40afcf,_0x3d8b9e){return function(_0x123668){if(_0x123668){return _0x123668['update'](_0x40afcf)[_0x2dfe('0x21')](function(_0x4c1a00){return _0x4c1a00;});}return null;};}function removeEntity(_0x3a14e4,_0x19ba1a){return function(_0x390c2b){if(_0x390c2b){return _0x390c2b['destroy']()[_0x2dfe('0x21')](function(){_0x3a14e4['status'](0xcc)[_0x2dfe('0x19')]();});}};}function handleEntityNotFound(_0x23126b,_0x257776){return function(_0x4e5ad8){if(!_0x4e5ad8){_0x23126b['sendStatus'](0x194);}return _0x4e5ad8;};}function handleError(_0x331a65,_0xaf4f71){_0xaf4f71=_0xaf4f71||0x1f4;return function(_0x241502){logger[_0x2dfe('0x22')](_0x241502[_0x2dfe('0x23')]);if(_0x241502['name']){delete _0x241502[_0x2dfe('0x24')];}_0x331a65[_0x2dfe('0x18')](_0xaf4f71)[_0x2dfe('0x25')](_0x241502);};}exports[_0x2dfe('0x26')]=function(_0x20e800,_0x27286f){var _0x532df8={},_0x84733d={},_0x237487={'count':0x0,'rows':[]};var _0x4193c5=_[_0x2dfe('0x27')](db[_0x2dfe('0x28')][_0x2dfe('0x29')],function(_0x39f0d9){return{'name':_0x39f0d9['fieldName'],'type':_0x39f0d9[_0x2dfe('0x2a')][_0x2dfe('0x2b')]};});_0x84733d[_0x2dfe('0x2c')]=_[_0x2dfe('0x27')](_0x4193c5,_0x2dfe('0x24'));_0x84733d[_0x2dfe('0x2d')]=_[_0x2dfe('0x2e')](_0x20e800[_0x2dfe('0x2d')]);_0x84733d[_0x2dfe('0x2f')]=_[_0x2dfe('0x30')](_0x84733d[_0x2dfe('0x2c')],_0x84733d[_0x2dfe('0x2d')]);_0x532df8[_0x2dfe('0x31')]=_['intersection'](_0x84733d['model'],qs['fields'](_0x20e800[_0x2dfe('0x2d')][_0x2dfe('0x32')]));_0x532df8[_0x2dfe('0x31')]=_0x532df8[_0x2dfe('0x31')][_0x2dfe('0x33')]?_0x532df8['attributes']:_0x84733d[_0x2dfe('0x2c')];if(!_0x20e800[_0x2dfe('0x2d')][_0x2dfe('0x34')](_0x2dfe('0x35'))){_0x532df8[_0x2dfe('0x1b')]=qs[_0x2dfe('0x1b')](_0x20e800['query'][_0x2dfe('0x1b')]);_0x532df8[_0x2dfe('0x1a')]=qs['offset'](_0x20e800['query']['offset']);}_0x532df8['order']=qs[_0x2dfe('0x36')](_0x20e800['query'][_0x2dfe('0x36')]);_0x532df8[_0x2dfe('0x37')]=qs[_0x2dfe('0x2f')](_[_0x2dfe('0x38')](_0x20e800['query'],_0x84733d[_0x2dfe('0x2f')]),_0x4193c5);if(_0x20e800['query'][_0x2dfe('0x39')]){_0x532df8[_0x2dfe('0x37')]=_['merge'](_0x532df8[_0x2dfe('0x37')],{'$or':_[_0x2dfe('0x27')](_0x4193c5,function(_0x361c1a){if(_0x361c1a[_0x2dfe('0x2a')]!==_0x2dfe('0x3a')){var _0x2e02dd={};_0x2e02dd[_0x361c1a['name']]={'$like':'%'+_0x20e800['query'][_0x2dfe('0x39')]+'%'};return _0x2e02dd;}})});}_0x532df8=_[_0x2dfe('0x3b')]({},_0x532df8,_0x20e800[_0x2dfe('0x3c')]);var _0x2d10ea={'where':_0x532df8[_0x2dfe('0x37')]};return db['OpenchannelQueueReport'][_0x2dfe('0x1c')](_0x2d10ea)[_0x2dfe('0x21')](function(_0x36c8d7){_0x237487[_0x2dfe('0x1c')]=_0x36c8d7;if(_0x20e800[_0x2dfe('0x2d')]['includeAll']){_0x532df8[_0x2dfe('0x3d')]=[{'all':!![]}];}return db[_0x2dfe('0x28')]['findAll'](_0x532df8);})[_0x2dfe('0x21')](function(_0x8a21cd){_0x237487['rows']=_0x8a21cd;return _0x237487;})['then'](respondWithFilteredResult(_0x27286f,_0x532df8))['catch'](handleError(_0x27286f,null));};exports[_0x2dfe('0x3e')]=function(_0x3920a7,_0x36bd2c){var _0x2064ae={'raw':!![],'where':{'id':_0x3920a7['params']['id']}},_0x41ac39={};_0x41ac39[_0x2dfe('0x2c')]=_[_0x2dfe('0x2e')](db[_0x2dfe('0x28')]['rawAttributes']);_0x41ac39[_0x2dfe('0x2d')]=_[_0x2dfe('0x2e')](_0x3920a7[_0x2dfe('0x2d')]);_0x41ac39[_0x2dfe('0x2f')]=_[_0x2dfe('0x30')](_0x41ac39[_0x2dfe('0x2c')],_0x41ac39[_0x2dfe('0x2d')]);_0x2064ae[_0x2dfe('0x31')]=_[_0x2dfe('0x30')](_0x41ac39[_0x2dfe('0x2c')],qs[_0x2dfe('0x32')](_0x3920a7['query'][_0x2dfe('0x32')]));_0x2064ae[_0x2dfe('0x31')]=_0x2064ae[_0x2dfe('0x31')][_0x2dfe('0x33')]?_0x2064ae[_0x2dfe('0x31')]:_0x41ac39[_0x2dfe('0x2c')];if(_0x3920a7[_0x2dfe('0x2d')][_0x2dfe('0x3f')]){_0x2064ae[_0x2dfe('0x3d')]=[{'all':!![]}];}_0x2064ae=_[_0x2dfe('0x3b')]({},_0x2064ae,_0x3920a7['options']);return db[_0x2dfe('0x28')][_0x2dfe('0x40')](_0x2064ae)[_0x2dfe('0x21')](handleEntityNotFound(_0x36bd2c,null))[_0x2dfe('0x21')](respondWithResult(_0x36bd2c,null))[_0x2dfe('0x41')](handleError(_0x36bd2c,null));};exports[_0x2dfe('0x42')]=function(_0xa7bc6d,_0x51c0b0){return db[_0x2dfe('0x28')][_0x2dfe('0x42')](_0xa7bc6d[_0x2dfe('0x43')],{})[_0x2dfe('0x21')](respondWithResult(_0x51c0b0,0xc9))[_0x2dfe('0x41')](handleError(_0x51c0b0,null));};exports[_0x2dfe('0x44')]=function(_0x408764,_0x10f97e){if(_0x408764[_0x2dfe('0x43')]['id']){delete _0x408764['body']['id'];}return db['OpenchannelQueueReport'][_0x2dfe('0x40')]({'where':{'id':_0x408764[_0x2dfe('0x45')]['id']}})['then'](handleEntityNotFound(_0x10f97e,null))[_0x2dfe('0x21')](saveUpdates(_0x408764[_0x2dfe('0x43')],null))[_0x2dfe('0x21')](respondWithResult(_0x10f97e,null))[_0x2dfe('0x41')](handleError(_0x10f97e,null));};exports[_0x2dfe('0x46')]=function(_0x5441fb,_0x3f4288){return db[_0x2dfe('0x28')]['find']({'where':{'id':_0x5441fb[_0x2dfe('0x45')]['id']}})[_0x2dfe('0x21')](handleEntityNotFound(_0x3f4288,null))[_0x2dfe('0x21')](removeEntity(_0x3f4288,null))[_0x2dfe('0x41')](handleError(_0x3f4288,null));};exports[_0x2dfe('0x47')]=function(_0x2cfa3e,_0x46c773){return db[_0x2dfe('0x28')][_0x2dfe('0x47')]()['then'](respondWithResult(_0x46c773,null))[_0x2dfe('0x41')](handleError(_0x46c773,null));}; \ No newline at end of file +var _0xaa67=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','findAll','rows','catch','params','fields','length','includeAll','options','create','body','describe','eml-format','request-promise','moment','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x340c38,_0x429bd0){var _0x54088c=function(_0x30fce2){while(--_0x30fce2){_0x340c38['push'](_0x340c38['shift']());}};_0x54088c(++_0x429bd0);}(_0xaa67,0x13d));var _0x7aa6=function(_0x449978,_0x33e040){_0x449978=_0x449978-0x0;var _0xa232d4=_0xaa67[_0x449978];return _0xa232d4;};'use strict';var emlformat=require(_0x7aa6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7aa6('0x1'));var moment=require(_0x7aa6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7aa6('0x3'));var csv=require(_0x7aa6('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7aa6('0x5'));var squel=require(_0x7aa6('0x6'));var crypto=require('crypto');var jsforce=require(_0x7aa6('0x7'));var deskjs=require(_0x7aa6('0x8'));var toCsv=require(_0x7aa6('0x4'));var querystring=require('querystring');var Papa=require(_0x7aa6('0x9'));var Redis=require(_0x7aa6('0xa'));var authService=require(_0x7aa6('0xb'));var qs=require(_0x7aa6('0xc'));var as=require(_0x7aa6('0xd'));var hardwareService=require(_0x7aa6('0xe'));var logger=require(_0x7aa6('0xf'))(_0x7aa6('0x10'));var utils=require(_0x7aa6('0x11'));var config=require(_0x7aa6('0x12'));var licenseUtil=require(_0x7aa6('0x13'));var db=require(_0x7aa6('0x14'))['db'];function respondWithStatusCode(_0x19fa4c,_0x4acf4a){_0x4acf4a=_0x4acf4a||0xcc;return function(_0x1bb4c8){if(_0x1bb4c8){return _0x19fa4c[_0x7aa6('0x15')](_0x4acf4a);}return _0x19fa4c[_0x7aa6('0x16')](_0x4acf4a)['end']();};}function respondWithResult(_0x1d7717,_0x5360cd){_0x5360cd=_0x5360cd||0xc8;return function(_0x8136cf){if(_0x8136cf){return _0x1d7717[_0x7aa6('0x16')](_0x5360cd)[_0x7aa6('0x17')](_0x8136cf);}};}function respondWithFilteredResult(_0x510e82,_0x133329){return function(_0x138364){if(_0x138364){var _0x164649=typeof _0x133329[_0x7aa6('0x18')]===_0x7aa6('0x19')&&typeof _0x133329[_0x7aa6('0x1a')]===_0x7aa6('0x19');var _0x4ff61f=_0x138364['count'];var _0x1480a8=_0x164649?0x0:_0x133329['offset'];var _0x4b473d=_0x164649?_0x138364[_0x7aa6('0x1b')]:_0x133329[_0x7aa6('0x18')]+_0x133329['limit'];var _0x1fe55e;if(_0x4b473d>=_0x4ff61f){_0x4b473d=_0x4ff61f;_0x1fe55e=0xc8;}else{_0x1fe55e=0xce;}_0x510e82[_0x7aa6('0x16')](_0x1fe55e);return _0x510e82['set'](_0x7aa6('0x1c'),_0x1480a8+'-'+_0x4b473d+'/'+_0x4ff61f)[_0x7aa6('0x17')](_0x138364);}return null;};}function patchUpdates(_0x327bf6){return function(_0x4e425f){try{jsonpatch[_0x7aa6('0x1d')](_0x4e425f,_0x327bf6,!![]);}catch(_0x258e62){return BPromise[_0x7aa6('0x1e')](_0x258e62);}return _0x4e425f[_0x7aa6('0x1f')]();};}function saveUpdates(_0x5b0cd5,_0xaea203){return function(_0x5b4635){if(_0x5b4635){return _0x5b4635[_0x7aa6('0x20')](_0x5b0cd5)[_0x7aa6('0x21')](function(_0x29f6b3){return _0x29f6b3;});}return null;};}function removeEntity(_0x2a83af,_0x4a9708){return function(_0x4d4f89){if(_0x4d4f89){return _0x4d4f89[_0x7aa6('0x22')]()[_0x7aa6('0x21')](function(){_0x2a83af[_0x7aa6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57a736,_0x134cf9){return function(_0x1f828d){if(!_0x1f828d){_0x57a736[_0x7aa6('0x15')](0x194);}return _0x1f828d;};}function handleError(_0x3e65a8,_0x327540){_0x327540=_0x327540||0x1f4;return function(_0x168626){logger[_0x7aa6('0x23')](_0x168626[_0x7aa6('0x24')]);if(_0x168626[_0x7aa6('0x25')]){delete _0x168626['name'];}_0x3e65a8[_0x7aa6('0x16')](_0x327540)['send'](_0x168626);};}exports['index']=function(_0x2cb81e,_0x21d827){var _0x25167f={},_0x2b83b6={},_0x4966e0={'count':0x0,'rows':[]};var _0x123812=_[_0x7aa6('0x26')](db[_0x7aa6('0x27')][_0x7aa6('0x28')],function(_0x4e963e){return{'name':_0x4e963e[_0x7aa6('0x29')],'type':_0x4e963e[_0x7aa6('0x2a')]['key']};});_0x2b83b6[_0x7aa6('0x2b')]=_[_0x7aa6('0x26')](_0x123812,'name');_0x2b83b6[_0x7aa6('0x2c')]=_[_0x7aa6('0x2d')](_0x2cb81e[_0x7aa6('0x2c')]);_0x2b83b6['filters']=_[_0x7aa6('0x2e')](_0x2b83b6[_0x7aa6('0x2b')],_0x2b83b6[_0x7aa6('0x2c')]);_0x25167f[_0x7aa6('0x2f')]=_[_0x7aa6('0x2e')](_0x2b83b6[_0x7aa6('0x2b')],qs['fields'](_0x2cb81e[_0x7aa6('0x2c')]['fields']));_0x25167f[_0x7aa6('0x2f')]=_0x25167f['attributes']['length']?_0x25167f['attributes']:_0x2b83b6[_0x7aa6('0x2b')];if(!_0x2cb81e[_0x7aa6('0x2c')][_0x7aa6('0x30')]('nolimit')){_0x25167f[_0x7aa6('0x1a')]=qs[_0x7aa6('0x1a')](_0x2cb81e[_0x7aa6('0x2c')]['limit']);_0x25167f['offset']=qs[_0x7aa6('0x18')](_0x2cb81e[_0x7aa6('0x2c')][_0x7aa6('0x18')]);}_0x25167f[_0x7aa6('0x31')]=qs[_0x7aa6('0x32')](_0x2cb81e[_0x7aa6('0x2c')][_0x7aa6('0x32')]);_0x25167f[_0x7aa6('0x33')]=qs[_0x7aa6('0x34')](_[_0x7aa6('0x35')](_0x2cb81e[_0x7aa6('0x2c')],_0x2b83b6[_0x7aa6('0x34')]),_0x123812);if(_0x2cb81e[_0x7aa6('0x2c')][_0x7aa6('0x36')]){_0x25167f[_0x7aa6('0x33')]=_[_0x7aa6('0x37')](_0x25167f[_0x7aa6('0x33')],{'$or':_['map'](_0x123812,function(_0x4266bc){if(_0x4266bc['type']!=='VIRTUAL'){var _0x4eea26={};_0x4eea26[_0x4266bc['name']]={'$like':'%'+_0x2cb81e['query'][_0x7aa6('0x36')]+'%'};return _0x4eea26;}})});}_0x25167f=_[_0x7aa6('0x37')]({},_0x25167f,_0x2cb81e['options']);var _0x1eeac2={'where':_0x25167f['where']};return db[_0x7aa6('0x27')][_0x7aa6('0x1b')](_0x1eeac2)[_0x7aa6('0x21')](function(_0x388dfd){_0x4966e0[_0x7aa6('0x1b')]=_0x388dfd;if(_0x2cb81e[_0x7aa6('0x2c')]['includeAll']){_0x25167f['include']=[{'all':!![]}];}return db[_0x7aa6('0x27')][_0x7aa6('0x38')](_0x25167f);})['then'](function(_0x3badd2){_0x4966e0[_0x7aa6('0x39')]=_0x3badd2;return _0x4966e0;})[_0x7aa6('0x21')](respondWithFilteredResult(_0x21d827,_0x25167f))[_0x7aa6('0x3a')](handleError(_0x21d827,null));};exports['show']=function(_0x43e0ac,_0x13280f){var _0x4514c9={'raw':!![],'where':{'id':_0x43e0ac[_0x7aa6('0x3b')]['id']}},_0x3c9b8e={};_0x3c9b8e[_0x7aa6('0x2b')]=_[_0x7aa6('0x2d')](db[_0x7aa6('0x27')][_0x7aa6('0x28')]);_0x3c9b8e[_0x7aa6('0x2c')]=_['keys'](_0x43e0ac[_0x7aa6('0x2c')]);_0x3c9b8e[_0x7aa6('0x34')]=_[_0x7aa6('0x2e')](_0x3c9b8e['model'],_0x3c9b8e[_0x7aa6('0x2c')]);_0x4514c9[_0x7aa6('0x2f')]=_[_0x7aa6('0x2e')](_0x3c9b8e['model'],qs[_0x7aa6('0x3c')](_0x43e0ac['query']['fields']));_0x4514c9[_0x7aa6('0x2f')]=_0x4514c9['attributes'][_0x7aa6('0x3d')]?_0x4514c9[_0x7aa6('0x2f')]:_0x3c9b8e[_0x7aa6('0x2b')];if(_0x43e0ac[_0x7aa6('0x2c')][_0x7aa6('0x3e')]){_0x4514c9['include']=[{'all':!![]}];}_0x4514c9=_['merge']({},_0x4514c9,_0x43e0ac[_0x7aa6('0x3f')]);return db[_0x7aa6('0x27')]['find'](_0x4514c9)[_0x7aa6('0x21')](handleEntityNotFound(_0x13280f,null))[_0x7aa6('0x21')](respondWithResult(_0x13280f,null))['catch'](handleError(_0x13280f,null));};exports[_0x7aa6('0x40')]=function(_0x46e663,_0x2dd7c1){return db[_0x7aa6('0x27')][_0x7aa6('0x40')](_0x46e663[_0x7aa6('0x41')],{})[_0x7aa6('0x21')](respondWithResult(_0x2dd7c1,0xc9))[_0x7aa6('0x3a')](handleError(_0x2dd7c1,null));};exports[_0x7aa6('0x20')]=function(_0x3e283e,_0x2516d8){if(_0x3e283e[_0x7aa6('0x41')]['id']){delete _0x3e283e[_0x7aa6('0x41')]['id'];}return db[_0x7aa6('0x27')]['find']({'where':{'id':_0x3e283e[_0x7aa6('0x3b')]['id']}})[_0x7aa6('0x21')](handleEntityNotFound(_0x2516d8,null))[_0x7aa6('0x21')](saveUpdates(_0x3e283e[_0x7aa6('0x41')],null))[_0x7aa6('0x21')](respondWithResult(_0x2516d8,null))['catch'](handleError(_0x2516d8,null));};exports['destroy']=function(_0x14f23a,_0xb7d6a0){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x14f23a['params']['id']}})['then'](handleEntityNotFound(_0xb7d6a0,null))[_0x7aa6('0x21')](removeEntity(_0xb7d6a0,null))[_0x7aa6('0x3a')](handleError(_0xb7d6a0,null));};exports[_0x7aa6('0x42')]=function(_0x5a079e,_0x2c1361){return db['OpenchannelQueueReport'][_0x7aa6('0x42')]()[_0x7aa6('0x21')](respondWithResult(_0x2c1361,null))[_0x7aa6('0x3a')](handleError(_0x2c1361,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index f7c00e6..296a0d2 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x5fc3[_0x50cfc3];return _0x5c11ef;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2b7370,_0x4ae5af){var _0xd1f693=function(_0x15155a){while(--_0x15155a){_0x2b7370['push'](_0x2b7370['shift']());}};_0xd1f693(++_0x4ae5af);}(_0x7a54,0x106));var _0x47a5=function(_0xcc4725,_0x46b7e8){_0xcc4725=_0xcc4725-0x0;var _0x5d50a0=_0x7a54[_0xcc4725];return _0x5d50a0;};'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 c3503ad..ee5b1a4 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 _0x02ce=['options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelQueueReport','create','body'];(function(_0xc6344e,_0x7a460){var _0x3d3a7b=function(_0x2e6815){while(--_0x2e6815){_0xc6344e['push'](_0xc6344e['shift']());}};_0x3d3a7b(++_0x7a460);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5a48c3,_0x285586){_0x5a48c3=_0x5a48c3-0x0;var _0x243e9f=_0x02ce[_0x5a48c3];return _0x243e9f;};'use strict';var _=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var moment=require(_0xe02c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe02c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe02c('0x4'))['db'];var utils=require(_0xe02c('0x5'));var logger=require(_0xe02c('0x6'))(_0xe02c('0x7'));var config=require(_0xe02c('0x8'));var jayson=require(_0xe02c('0x9'));var client=jayson[_0xe02c('0xa')][_0xe02c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a87f,_0x4fecb3,_0x5eabb0){return new BPromise(function(_0x3c757e,_0x2d85d7){return client[_0xe02c('0xc')](_0x36a87f,_0x5eabb0)[_0xe02c('0xd')](function(_0x2afbf5){logger[_0xe02c('0xe')](_0xe02c('0xf'),_0x4fecb3,_0xe02c('0x10'));logger[_0xe02c('0x11')](_0xe02c('0x12'),_0x4fecb3,_0xe02c('0x10'),JSON[_0xe02c('0x13')](_0x2afbf5));if(_0x2afbf5[_0xe02c('0x14')]){if(_0x2afbf5[_0xe02c('0x14')][_0xe02c('0x15')]===0x1f4){logger[_0xe02c('0x14')](_0xe02c('0xf'),_0x4fecb3,_0x2afbf5[_0xe02c('0x14')]['message']);return _0x2d85d7(_0x2afbf5[_0xe02c('0x14')]['message']);}logger['error'](_0xe02c('0xf'),_0x4fecb3,_0x2afbf5['error'][_0xe02c('0x16')]);return _0x3c757e(_0x2afbf5['error'][_0xe02c('0x16')]);}else{logger['info'](_0xe02c('0xf'),_0x4fecb3,_0xe02c('0x10'));_0x3c757e(_0x2afbf5['result'][_0xe02c('0x16')]);}})[_0xe02c('0x17')](function(_0x51676c){logger[_0xe02c('0x14')](_0xe02c('0xf'),_0x4fecb3,_0x51676c);_0x2d85d7(_0x51676c);});});}exports['CreateOpenchannelQueueReport']=function(_0x52917f){var _0x3e37bf=this;return new Promise(function(_0x49604a,_0x1f8f37){return db[_0xe02c('0x18')][_0xe02c('0x19')](_0x52917f[_0xe02c('0x1a')],{'raw':_0x52917f[_0xe02c('0x1b')]?_0x52917f['options'][_0xe02c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4ea9b5){logger[_0xe02c('0xe')](_0xe02c('0x1d'),_0x52917f);logger['debug'](_0xe02c('0x1d'),_0x52917f,JSON[_0xe02c('0x13')](_0x4ea9b5));_0x49604a(_0x4ea9b5);})['catch'](function(_0x38dce2){logger[_0xe02c('0x14')](_0xe02c('0x1d'),_0x38dce2[_0xe02c('0x16')],_0x52917f);_0x1f8f37(_0x3e37bf[_0xe02c('0x14')](0x1f4,_0x38dce2[_0xe02c('0x16')]));});});};exports[_0xe02c('0x1e')]=function(_0xf41d4c){var _0xeae877=this;return new Promise(function(_0x18b538,_0x60b65e){return db['OpenchannelQueueReport'][_0xe02c('0x1f')](_0xf41d4c[_0xe02c('0x1a')],{'raw':_0xf41d4c[_0xe02c('0x1b')]?_0xf41d4c[_0xe02c('0x1b')][_0xe02c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf41d4c[_0xe02c('0x1b')]?_0xf41d4c[_0xe02c('0x1b')][_0xe02c('0x20')]||null:null,'attributes':_0xf41d4c['options']?_0xf41d4c[_0xe02c('0x1b')][_0xe02c('0x21')]||null:null,'limit':_0xf41d4c[_0xe02c('0x1b')]?_0xf41d4c['options'][_0xe02c('0x22')]||null:null})[_0xe02c('0xd')](function(_0x445421){logger[_0xe02c('0xe')](_0xe02c('0x1e'),_0xf41d4c);logger[_0xe02c('0x11')](_0xe02c('0x1e'),_0xf41d4c,JSON[_0xe02c('0x13')](_0x445421));_0x18b538(_0x445421);})[_0xe02c('0x17')](function(_0x288004){logger[_0xe02c('0x14')]('UpdateOpenchannelQueueReport',_0x288004[_0xe02c('0x16')],_0xf41d4c);_0x60b65e(_0xeae877[_0xe02c('0x14')](0x1f4,_0x288004[_0xe02c('0x16')]));});});}; \ No newline at end of file +var _0x536f=['../../config/logger','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','debug','catch','update','body','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d896b,_0x250748){var _0xede685=function(_0x4637d5){while(--_0x4637d5){_0x1d896b['push'](_0x1d896b['shift']());}};_0xede685(++_0x250748);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1df79c){var _0xddf70e=this;return new Promise(function(_0x2d9dfb,_0x252cae){return db[_0xf536('0x12')][_0xf536('0x17')](_0x1df79c[_0xf536('0x18')],{'raw':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')][_0xf536('0x1a')]||null:null,'attributes':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x1b')]||null:null,'limit':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')]['limit']||null:null})[_0xf536('0x9')](function(_0x485da0){logger[_0xf536('0x10')](_0xf536('0x1c'),_0x1df79c);logger[_0xf536('0x15')](_0xf536('0x1c'),_0x1df79c,JSON[_0xf536('0xc')](_0x485da0));_0x2d9dfb(_0x485da0);})[_0xf536('0x16')](function(_0x330c47){logger[_0xf536('0xd')](_0xf536('0x1c'),_0x330c47[_0xf536('0xf')],_0x1df79c);_0x252cae(_0xddf70e[_0xf536('0xd')](0x1f4,_0x330c47[_0xf536('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1a5e098..21eff33 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 _0xf1a3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xf1a3,0xcc));var _0x3f1a=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0xf1a3[_0x5756f8];return _0x3bb749;};'use strict';var multer=require(_0x3f1a('0x0'));var util=require(_0x3f1a('0x1'));var path=require(_0x3f1a('0x2'));var timeout=require(_0x3f1a('0x3'));var express=require(_0x3f1a('0x4'));var router=express[_0x3f1a('0x5')]();var fs_extra=require(_0x3f1a('0x6'));var auth=require(_0x3f1a('0x7'));var interaction=require(_0x3f1a('0x8'));var config=require('../../config/environment');var controller=require(_0x3f1a('0x9'));router['get']('/',auth[_0x3f1a('0xa')](),controller[_0x3f1a('0xb')]);router[_0x3f1a('0xc')](_0x3f1a('0xd'),auth[_0x3f1a('0xa')](),controller[_0x3f1a('0xe')]);router['get'](_0x3f1a('0xf'),auth[_0x3f1a('0xa')](),controller['show']);router['post']('/',auth[_0x3f1a('0xa')](),controller['create']);router[_0x3f1a('0x10')](_0x3f1a('0xf'),auth[_0x3f1a('0xa')](),controller[_0x3f1a('0x11')]);router['delete'](_0x3f1a('0xf'),auth[_0x3f1a('0xa')](),controller['destroy']);module[_0x3f1a('0x12')]=router; \ No newline at end of file +var _0xea93=['get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x23eb01,_0xca3f20){var _0x24a522=function(_0x45ab90){while(--_0x45ab90){_0x23eb01['push'](_0x23eb01['shift']());}};_0x24a522(++_0xca3f20);}(_0xea93,0x1ab));var _0x3ea9=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0xea93[_0x10dc64];return _0x9cf98d;};'use strict';var multer=require(_0x3ea9('0x0'));var util=require(_0x3ea9('0x1'));var path=require(_0x3ea9('0x2'));var timeout=require(_0x3ea9('0x3'));var express=require(_0x3ea9('0x4'));var router=express[_0x3ea9('0x5')]();var fs_extra=require(_0x3ea9('0x6'));var auth=require(_0x3ea9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3ea9('0x8'));var controller=require(_0x3ea9('0x9'));router[_0x3ea9('0xa')]('/',auth[_0x3ea9('0xb')](),controller[_0x3ea9('0xc')]);router['get'](_0x3ea9('0xd'),auth[_0x3ea9('0xb')](),controller[_0x3ea9('0xe')]);router['get']('/:id',auth[_0x3ea9('0xb')](),controller['show']);router[_0x3ea9('0xf')]('/',auth[_0x3ea9('0xb')](),controller[_0x3ea9('0x10')]);router[_0x3ea9('0x11')](_0x3ea9('0x12'),auth[_0x3ea9('0xb')](),controller[_0x3ea9('0x13')]);router[_0x3ea9('0x14')](_0x3ea9('0x12'),auth[_0x3ea9('0xb')](),controller[_0x3ea9('0x15')]);module[_0x3ea9('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index b5c2aa8..3ee99d1 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2b8a44,_0x4a622a){var _0x464028=function(_0x3a66f3){while(--_0x3a66f3){_0x2b8a44['push'](_0x2b8a44['shift']());}};_0x464028(++_0x4a622a);}(_0xaa88,0x137));var _0x8aa8=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0xaa88[_0x1139d0];return _0xcc01a6;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x14f10e,_0xdae41a){var _0x562cca=function(_0x2f003c){while(--_0x2f003c){_0x14f10e['push'](_0x14f10e['shift']());}};_0x562cca(++_0xdae41a);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c0825,_0x2b9d37){_0x2c0825=_0x2c0825-0x0;var _0x20c934=_0xedd9[_0x2c0825];return _0x20c934;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c70147e..89b6ef2 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 _0x3623=['fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','includeAll','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes'];(function(_0x461119,_0x28ce98){var _0x4b5ed3=function(_0x4fdafc){while(--_0x4fdafc){_0x461119['push'](_0x461119['shift']());}};_0x4b5ed3(++_0x28ce98);}(_0x3623,0xaf));var _0x3362=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0x3623[_0x149f32];return _0x11f475;};'use strict';var emlformat=require(_0x3362('0x0'));var rimraf=require(_0x3362('0x1'));var zipdir=require(_0x3362('0x2'));var jsonpatch=require(_0x3362('0x3'));var rp=require(_0x3362('0x4'));var moment=require(_0x3362('0x5'));var BPromise=require(_0x3362('0x6'));var Mustache=require(_0x3362('0x7'));var util=require(_0x3362('0x8'));var path=require(_0x3362('0x9'));var sox=require('sox');var csv=require(_0x3362('0xa'));var ejs=require(_0x3362('0xb'));var fs=require('fs');var fs_extra=require(_0x3362('0xc'));var _=require(_0x3362('0xd'));var squel=require(_0x3362('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3362('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3362('0xf'));var authService=require(_0x3362('0x10'));var qs=require(_0x3362('0x11'));var as=require(_0x3362('0x12'));var hardwareService=require(_0x3362('0x13'));var logger=require(_0x3362('0x14'))(_0x3362('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c6ac6,_0x3d1aa8){_0x3d1aa8=_0x3d1aa8||0xcc;return function(_0x57aa5f){if(_0x57aa5f){return _0x2c6ac6[_0x3362('0x16')](_0x3d1aa8);}return _0x2c6ac6[_0x3362('0x17')](_0x3d1aa8)[_0x3362('0x18')]();};}function respondWithResult(_0x35aeed,_0x1544e9){_0x1544e9=_0x1544e9||0xc8;return function(_0xaa2a12){if(_0xaa2a12){return _0x35aeed['status'](_0x1544e9)['json'](_0xaa2a12);}};}function respondWithFilteredResult(_0x1c7851,_0x5e95d9){return function(_0x47d116){if(_0x47d116){var _0x447d19=typeof _0x5e95d9[_0x3362('0x19')]==='undefined'&&typeof _0x5e95d9[_0x3362('0x1a')]==='undefined';var _0x472431=_0x47d116[_0x3362('0x1b')];var _0x5b0c18=_0x447d19?0x0:_0x5e95d9['offset'];var _0x3bb642=_0x447d19?_0x47d116[_0x3362('0x1b')]:_0x5e95d9[_0x3362('0x19')]+_0x5e95d9[_0x3362('0x1a')];var _0x2c5816;if(_0x3bb642>=_0x472431){_0x3bb642=_0x472431;_0x2c5816=0xc8;}else{_0x2c5816=0xce;}_0x1c7851[_0x3362('0x17')](_0x2c5816);return _0x1c7851[_0x3362('0x1c')](_0x3362('0x1d'),_0x5b0c18+'-'+_0x3bb642+'/'+_0x472431)['json'](_0x47d116);}return null;};}function patchUpdates(_0xdd7ddd){return function(_0x5a1bf1){try{jsonpatch[_0x3362('0x1e')](_0x5a1bf1,_0xdd7ddd,!![]);}catch(_0x35d328){return BPromise[_0x3362('0x1f')](_0x35d328);}return _0x5a1bf1['save']();};}function saveUpdates(_0x5da948,_0x21ccd5){return function(_0x674d1e){if(_0x674d1e){return _0x674d1e[_0x3362('0x20')](_0x5da948)[_0x3362('0x21')](function(_0x101cc8){return _0x101cc8;});}return null;};}function removeEntity(_0x1156c1,_0xadeca9){return function(_0xf761){if(_0xf761){return _0xf761['destroy']()[_0x3362('0x21')](function(){_0x1156c1[_0x3362('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x285bed,_0x4e721c){return function(_0x4e2e8b){if(!_0x4e2e8b){_0x285bed['sendStatus'](0x194);}return _0x4e2e8b;};}function handleError(_0x271169,_0x4696cb){_0x4696cb=_0x4696cb||0x1f4;return function(_0x3bcdee){logger[_0x3362('0x22')](_0x3bcdee[_0x3362('0x23')]);if(_0x3bcdee[_0x3362('0x24')]){delete _0x3bcdee[_0x3362('0x24')];}_0x271169['status'](_0x4696cb)['send'](_0x3bcdee);};}exports[_0x3362('0x25')]=function(_0x468b3d,_0x35a866){var _0x2d1730={},_0x2f000f={},_0x5942cb={'count':0x0,'rows':[]};var _0x21fd3d=_[_0x3362('0x26')](db[_0x3362('0x27')][_0x3362('0x28')],function(_0x16c73b){return{'name':_0x16c73b[_0x3362('0x29')],'type':_0x16c73b[_0x3362('0x2a')]['key']};});_0x2f000f[_0x3362('0x2b')]=_[_0x3362('0x26')](_0x21fd3d,'name');_0x2f000f[_0x3362('0x2c')]=_['keys'](_0x468b3d[_0x3362('0x2c')]);_0x2f000f[_0x3362('0x2d')]=_[_0x3362('0x2e')](_0x2f000f[_0x3362('0x2b')],_0x2f000f[_0x3362('0x2c')]);_0x2d1730[_0x3362('0x2f')]=_[_0x3362('0x2e')](_0x2f000f[_0x3362('0x2b')],qs[_0x3362('0x30')](_0x468b3d[_0x3362('0x2c')][_0x3362('0x30')]));_0x2d1730[_0x3362('0x2f')]=_0x2d1730[_0x3362('0x2f')][_0x3362('0x31')]?_0x2d1730[_0x3362('0x2f')]:_0x2f000f[_0x3362('0x2b')];if(!_0x468b3d['query']['hasOwnProperty'](_0x3362('0x32'))){_0x2d1730[_0x3362('0x1a')]=qs['limit'](_0x468b3d[_0x3362('0x2c')][_0x3362('0x1a')]);_0x2d1730[_0x3362('0x19')]=qs[_0x3362('0x19')](_0x468b3d[_0x3362('0x2c')][_0x3362('0x19')]);}_0x2d1730[_0x3362('0x33')]=qs[_0x3362('0x34')](_0x468b3d[_0x3362('0x2c')][_0x3362('0x34')]);_0x2d1730[_0x3362('0x35')]=qs['filters'](_[_0x3362('0x36')](_0x468b3d[_0x3362('0x2c')],_0x2f000f[_0x3362('0x2d')]),_0x21fd3d);if(_0x468b3d[_0x3362('0x2c')][_0x3362('0x37')]){_0x2d1730[_0x3362('0x35')]=_['merge'](_0x2d1730[_0x3362('0x35')],{'$or':_[_0x3362('0x26')](_0x21fd3d,function(_0x1d5b14){if(_0x1d5b14['type']!==_0x3362('0x38')){var _0x5a2e23={};_0x5a2e23[_0x1d5b14[_0x3362('0x24')]]={'$like':'%'+_0x468b3d[_0x3362('0x2c')][_0x3362('0x37')]+'%'};return _0x5a2e23;}})});}_0x2d1730=_[_0x3362('0x39')]({},_0x2d1730,_0x468b3d[_0x3362('0x3a')]);var _0x4ba817={'where':_0x2d1730['where']};return db[_0x3362('0x27')][_0x3362('0x1b')](_0x4ba817)[_0x3362('0x21')](function(_0x118347){_0x5942cb[_0x3362('0x1b')]=_0x118347;if(_0x468b3d['query']['includeAll']){_0x2d1730['include']=[{'all':!![]}];}return db[_0x3362('0x27')][_0x3362('0x3b')](_0x2d1730);})[_0x3362('0x21')](function(_0x57770a){_0x5942cb[_0x3362('0x3c')]=_0x57770a;return _0x5942cb;})[_0x3362('0x21')](respondWithFilteredResult(_0x35a866,_0x2d1730))[_0x3362('0x3d')](handleError(_0x35a866,null));};exports[_0x3362('0x3e')]=function(_0x405681,_0x3c8f5a){var _0x5a8a9c={'raw':!![],'where':{'id':_0x405681[_0x3362('0x3f')]['id']}},_0x43fe59={};_0x43fe59['model']=_[_0x3362('0x40')](db[_0x3362('0x27')][_0x3362('0x28')]);_0x43fe59[_0x3362('0x2c')]=_['keys'](_0x405681[_0x3362('0x2c')]);_0x43fe59['filters']=_[_0x3362('0x2e')](_0x43fe59[_0x3362('0x2b')],_0x43fe59[_0x3362('0x2c')]);_0x5a8a9c[_0x3362('0x2f')]=_[_0x3362('0x2e')](_0x43fe59[_0x3362('0x2b')],qs[_0x3362('0x30')](_0x405681[_0x3362('0x2c')][_0x3362('0x30')]));_0x5a8a9c['attributes']=_0x5a8a9c[_0x3362('0x2f')][_0x3362('0x31')]?_0x5a8a9c[_0x3362('0x2f')]:_0x43fe59[_0x3362('0x2b')];if(_0x405681[_0x3362('0x2c')][_0x3362('0x41')]){_0x5a8a9c[_0x3362('0x42')]=[{'all':!![]}];}_0x5a8a9c=_[_0x3362('0x39')]({},_0x5a8a9c,_0x405681[_0x3362('0x3a')]);return db[_0x3362('0x27')]['find'](_0x5a8a9c)[_0x3362('0x21')](handleEntityNotFound(_0x3c8f5a,null))[_0x3362('0x21')](respondWithResult(_0x3c8f5a,null))[_0x3362('0x3d')](handleError(_0x3c8f5a,null));};exports[_0x3362('0x43')]=function(_0x7f7d0a,_0x5b5052){return db[_0x3362('0x27')]['create'](_0x7f7d0a[_0x3362('0x44')],{})[_0x3362('0x21')](respondWithResult(_0x5b5052,0xc9))['catch'](handleError(_0x5b5052,null));};exports[_0x3362('0x20')]=function(_0x1016ba,_0x5e220f){if(_0x1016ba[_0x3362('0x44')]['id']){delete _0x1016ba['body']['id'];}return db[_0x3362('0x27')][_0x3362('0x45')]({'where':{'id':_0x1016ba[_0x3362('0x3f')]['id']}})[_0x3362('0x21')](handleEntityNotFound(_0x5e220f,null))[_0x3362('0x21')](saveUpdates(_0x1016ba[_0x3362('0x44')],null))[_0x3362('0x21')](respondWithResult(_0x5e220f,null))[_0x3362('0x3d')](handleError(_0x5e220f,null));};exports[_0x3362('0x46')]=function(_0x52d3c4,_0x3d02f3){return db[_0x3362('0x27')][_0x3362('0x45')]({'where':{'id':_0x52d3c4['params']['id']}})[_0x3362('0x21')](handleEntityNotFound(_0x3d02f3,null))[_0x3362('0x21')](removeEntity(_0x3d02f3,null))[_0x3362('0x3d')](handleError(_0x3d02f3,null));};exports[_0x3362('0x47')]=function(_0x7d7589,_0x2aaebf){return db[_0x3362('0x27')]['describe']()['then'](respondWithResult(_0x2aaebf,null))[_0x3362('0x3d')](handleError(_0x2aaebf,null));}; \ No newline at end of file +var _0xd970=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','send','map','OpenchannelTransferReport','rawAttributes','type','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','includeAll','include','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch'];(function(_0x5199af,_0x1eb67c){var _0x381974=function(_0x456a88){while(--_0x456a88){_0x5199af['push'](_0x5199af['shift']());}};_0x381974(++_0x1eb67c);}(_0xd970,0x129));var _0x0d97=function(_0x5bc856,_0x13a300){_0x5bc856=_0x5bc856-0x0;var _0x53251c=_0xd970[_0x5bc856];return _0x53251c;};'use strict';var emlformat=require(_0x0d97('0x0'));var rimraf=require(_0x0d97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d97('0x2'));var rp=require(_0x0d97('0x3'));var moment=require(_0x0d97('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d97('0x5'));var util=require(_0x0d97('0x6'));var path=require(_0x0d97('0x7'));var sox=require(_0x0d97('0x8'));var csv=require(_0x0d97('0x9'));var ejs=require(_0x0d97('0xa'));var fs=require('fs');var fs_extra=require(_0x0d97('0xb'));var _=require(_0x0d97('0xc'));var squel=require(_0x0d97('0xd'));var crypto=require('crypto');var jsforce=require(_0x0d97('0xe'));var deskjs=require(_0x0d97('0xf'));var toCsv=require(_0x0d97('0x9'));var querystring=require(_0x0d97('0x10'));var Papa=require('papaparse');var Redis=require(_0x0d97('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d97('0x12'));var as=require(_0x0d97('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d97('0x14'));var utils=require(_0x0d97('0x15'));var config=require(_0x0d97('0x16'));var licenseUtil=require(_0x0d97('0x17'));var db=require(_0x0d97('0x18'))['db'];function respondWithStatusCode(_0x2e37e0,_0x4f42f6){_0x4f42f6=_0x4f42f6||0xcc;return function(_0x18bb44){if(_0x18bb44){return _0x2e37e0[_0x0d97('0x19')](_0x4f42f6);}return _0x2e37e0['status'](_0x4f42f6)['end']();};}function respondWithResult(_0x19bfa3,_0x50afd0){_0x50afd0=_0x50afd0||0xc8;return function(_0x393dea){if(_0x393dea){return _0x19bfa3[_0x0d97('0x1a')](_0x50afd0)[_0x0d97('0x1b')](_0x393dea);}};}function respondWithFilteredResult(_0x3ff56d,_0x42d13d){return function(_0x4ea525){if(_0x4ea525){var _0x3288a8=typeof _0x42d13d[_0x0d97('0x1c')]===_0x0d97('0x1d')&&typeof _0x42d13d[_0x0d97('0x1e')]==='undefined';var _0x7d0630=_0x4ea525[_0x0d97('0x1f')];var _0x5cba3e=_0x3288a8?0x0:_0x42d13d['offset'];var _0x165172=_0x3288a8?_0x4ea525[_0x0d97('0x1f')]:_0x42d13d['offset']+_0x42d13d['limit'];var _0x187104;if(_0x165172>=_0x7d0630){_0x165172=_0x7d0630;_0x187104=0xc8;}else{_0x187104=0xce;}_0x3ff56d[_0x0d97('0x1a')](_0x187104);return _0x3ff56d['set'](_0x0d97('0x20'),_0x5cba3e+'-'+_0x165172+'/'+_0x7d0630)[_0x0d97('0x1b')](_0x4ea525);}return null;};}function patchUpdates(_0x413f61){return function(_0x596230){try{jsonpatch[_0x0d97('0x21')](_0x596230,_0x413f61,!![]);}catch(_0x353aca){return BPromise[_0x0d97('0x22')](_0x353aca);}return _0x596230['save']();};}function saveUpdates(_0x2c188d,_0x298f8c){return function(_0x235a12){if(_0x235a12){return _0x235a12[_0x0d97('0x23')](_0x2c188d)[_0x0d97('0x24')](function(_0x5087fe){return _0x5087fe;});}return null;};}function removeEntity(_0x835713,_0x4381ae){return function(_0x2357bb){if(_0x2357bb){return _0x2357bb[_0x0d97('0x25')]()[_0x0d97('0x24')](function(){_0x835713['status'](0xcc)[_0x0d97('0x26')]();});}};}function handleEntityNotFound(_0x436d48,_0x350fa4){return function(_0x2b23ed){if(!_0x2b23ed){_0x436d48[_0x0d97('0x19')](0x194);}return _0x2b23ed;};}function handleError(_0x136f31,_0x594d39){_0x594d39=_0x594d39||0x1f4;return function(_0x4c544a){logger[_0x0d97('0x27')](_0x4c544a[_0x0d97('0x28')]);if(_0x4c544a['name']){delete _0x4c544a['name'];}_0x136f31[_0x0d97('0x1a')](_0x594d39)[_0x0d97('0x29')](_0x4c544a);};}exports['index']=function(_0x49032c,_0x3d3468){var _0x55a4b6={},_0x1c90c0={},_0x48ae57={'count':0x0,'rows':[]};var _0x2fb7e4=_[_0x0d97('0x2a')](db[_0x0d97('0x2b')][_0x0d97('0x2c')],function(_0x338447){return{'name':_0x338447['fieldName'],'type':_0x338447[_0x0d97('0x2d')]['key']};});_0x1c90c0[_0x0d97('0x2e')]=_[_0x0d97('0x2a')](_0x2fb7e4,_0x0d97('0x2f'));_0x1c90c0[_0x0d97('0x30')]=_[_0x0d97('0x31')](_0x49032c[_0x0d97('0x30')]);_0x1c90c0['filters']=_[_0x0d97('0x32')](_0x1c90c0[_0x0d97('0x2e')],_0x1c90c0[_0x0d97('0x30')]);_0x55a4b6['attributes']=_[_0x0d97('0x32')](_0x1c90c0[_0x0d97('0x2e')],qs[_0x0d97('0x33')](_0x49032c['query'][_0x0d97('0x33')]));_0x55a4b6['attributes']=_0x55a4b6[_0x0d97('0x34')][_0x0d97('0x35')]?_0x55a4b6['attributes']:_0x1c90c0['model'];if(!_0x49032c[_0x0d97('0x30')][_0x0d97('0x36')](_0x0d97('0x37'))){_0x55a4b6[_0x0d97('0x1e')]=qs['limit'](_0x49032c[_0x0d97('0x30')][_0x0d97('0x1e')]);_0x55a4b6[_0x0d97('0x1c')]=qs[_0x0d97('0x1c')](_0x49032c[_0x0d97('0x30')][_0x0d97('0x1c')]);}_0x55a4b6[_0x0d97('0x38')]=qs[_0x0d97('0x39')](_0x49032c[_0x0d97('0x30')][_0x0d97('0x39')]);_0x55a4b6[_0x0d97('0x3a')]=qs[_0x0d97('0x3b')](_[_0x0d97('0x3c')](_0x49032c[_0x0d97('0x30')],_0x1c90c0[_0x0d97('0x3b')]),_0x2fb7e4);if(_0x49032c['query']['filter']){_0x55a4b6['where']=_[_0x0d97('0x3d')](_0x55a4b6[_0x0d97('0x3a')],{'$or':_[_0x0d97('0x2a')](_0x2fb7e4,function(_0x9400de){if(_0x9400de['type']!==_0x0d97('0x3e')){var _0x43408f={};_0x43408f[_0x9400de[_0x0d97('0x2f')]]={'$like':'%'+_0x49032c[_0x0d97('0x30')][_0x0d97('0x3f')]+'%'};return _0x43408f;}})});}_0x55a4b6=_[_0x0d97('0x3d')]({},_0x55a4b6,_0x49032c[_0x0d97('0x40')]);var _0x1b3610={'where':_0x55a4b6[_0x0d97('0x3a')]};return db[_0x0d97('0x2b')][_0x0d97('0x1f')](_0x1b3610)[_0x0d97('0x24')](function(_0x1e4e8d){_0x48ae57['count']=_0x1e4e8d;if(_0x49032c[_0x0d97('0x30')]['includeAll']){_0x55a4b6['include']=[{'all':!![]}];}return db[_0x0d97('0x2b')][_0x0d97('0x41')](_0x55a4b6);})['then'](function(_0x49f2fd){_0x48ae57[_0x0d97('0x42')]=_0x49f2fd;return _0x48ae57;})['then'](respondWithFilteredResult(_0x3d3468,_0x55a4b6))['catch'](handleError(_0x3d3468,null));};exports['show']=function(_0x7c904,_0x503071){var _0x4d2690={'raw':!![],'where':{'id':_0x7c904['params']['id']}},_0x3f77af={};_0x3f77af['model']=_[_0x0d97('0x31')](db[_0x0d97('0x2b')][_0x0d97('0x2c')]);_0x3f77af['query']=_['keys'](_0x7c904[_0x0d97('0x30')]);_0x3f77af[_0x0d97('0x3b')]=_['intersection'](_0x3f77af[_0x0d97('0x2e')],_0x3f77af[_0x0d97('0x30')]);_0x4d2690['attributes']=_[_0x0d97('0x32')](_0x3f77af['model'],qs[_0x0d97('0x33')](_0x7c904[_0x0d97('0x30')][_0x0d97('0x33')]));_0x4d2690[_0x0d97('0x34')]=_0x4d2690[_0x0d97('0x34')][_0x0d97('0x35')]?_0x4d2690[_0x0d97('0x34')]:_0x3f77af[_0x0d97('0x2e')];if(_0x7c904[_0x0d97('0x30')][_0x0d97('0x43')]){_0x4d2690[_0x0d97('0x44')]=[{'all':!![]}];}_0x4d2690=_[_0x0d97('0x3d')]({},_0x4d2690,_0x7c904[_0x0d97('0x40')]);return db[_0x0d97('0x2b')][_0x0d97('0x45')](_0x4d2690)[_0x0d97('0x24')](handleEntityNotFound(_0x503071,null))[_0x0d97('0x24')](respondWithResult(_0x503071,null))[_0x0d97('0x46')](handleError(_0x503071,null));};exports[_0x0d97('0x47')]=function(_0x3c9a9f,_0x37679d){return db[_0x0d97('0x2b')][_0x0d97('0x47')](_0x3c9a9f['body'],{})[_0x0d97('0x24')](respondWithResult(_0x37679d,0xc9))[_0x0d97('0x46')](handleError(_0x37679d,null));};exports[_0x0d97('0x23')]=function(_0xfb7b8e,_0x3889d9){if(_0xfb7b8e[_0x0d97('0x48')]['id']){delete _0xfb7b8e[_0x0d97('0x48')]['id'];}return db[_0x0d97('0x2b')]['find']({'where':{'id':_0xfb7b8e[_0x0d97('0x49')]['id']}})[_0x0d97('0x24')](handleEntityNotFound(_0x3889d9,null))[_0x0d97('0x24')](saveUpdates(_0xfb7b8e[_0x0d97('0x48')],null))['then'](respondWithResult(_0x3889d9,null))[_0x0d97('0x46')](handleError(_0x3889d9,null));};exports['destroy']=function(_0x31a31b,_0x44eb83){return db['OpenchannelTransferReport'][_0x0d97('0x45')]({'where':{'id':_0x31a31b[_0x0d97('0x49')]['id']}})['then'](handleEntityNotFound(_0x44eb83,null))[_0x0d97('0x24')](removeEntity(_0x44eb83,null))[_0x0d97('0x46')](handleError(_0x44eb83,null));};exports['describe']=function(_0x2a88e8,_0x3a1a68){return db['OpenchannelTransferReport'][_0x0d97('0x4a')]()[_0x0d97('0x24')](respondWithResult(_0x3a1a68,null))[_0x0d97('0x46')](handleError(_0x3a1a68,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a6820db..217239b 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 _0x8068=['define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8068,0x1b5));var _0x8806=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0x8068[_0x12e073];return _0x267748;};'use strict';var _=require(_0x8806('0x0'));var util=require(_0x8806('0x1'));var logger=require(_0x8806('0x2'))(_0x8806('0x3'));var moment=require(_0x8806('0x4'));var BPromise=require(_0x8806('0x5'));var rp=require(_0x8806('0x6'));var fs=require('fs');var path=require(_0x8806('0x7'));var rimraf=require(_0x8806('0x8'));var config=require('../../config/environment');var attributes=require(_0x8806('0x9'));module[_0x8806('0xa')]=function(_0x5d60bf,_0x387b4b){return _0x5d60bf[_0x8806('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0x8806('0xc'),'paranoid':![],'indexes':[{'name':_0x8806('0xd'),'fields':[_0x8806('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8379=['uniqueid','lodash','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3fbbd0,_0x269a1f){var _0x135c98=function(_0x19cda4){while(--_0x19cda4){_0x3fbbd0['push'](_0x3fbbd0['shift']());}};_0x135c98(++_0x269a1f);}(_0x8379,0x12a));var _0x9837=function(_0x1218dd,_0xc02985){_0x1218dd=_0x1218dd-0x0;var _0x339ee7=_0x8379[_0x1218dd];return _0x339ee7;};'use strict';var _=require(_0x9837('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9837('0x1'));var moment=require(_0x9837('0x2'));var BPromise=require('bluebird');var rp=require(_0x9837('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9837('0x4'));var config=require(_0x9837('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0x9837('0x6')]=function(_0x5b21d9,_0x48680f){return _0x5b21d9[_0x9837('0x7')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x9837('0x8'),'fields':[_0x9837('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index e95b9bd..6510c1b 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 _0x4f0d=['ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x40d5ce,_0x255ca5){var _0x11f28=function(_0x258b2f){while(--_0x258b2f){_0x40d5ce['push'](_0x40d5ce['shift']());}};_0x11f28(++_0x255ca5);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0xae9024,_0x17f58e){_0xae9024=_0xae9024-0x0;var _0x23e7d3=_0x4f0d[_0xae9024];return _0x23e7d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4f0('0x0'));var db=require(_0xd4f0('0x1'))['db'];var utils=require(_0xd4f0('0x2'));var logger=require('../../config/logger')(_0xd4f0('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd4f0('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16da18,_0x4dd938,_0x50e79f){return new BPromise(function(_0x19a779,_0x69309d){return client[_0xd4f0('0x5')](_0x16da18,_0x50e79f)[_0xd4f0('0x6')](function(_0x9b959f){logger['info'](_0xd4f0('0x7'),_0x4dd938,_0xd4f0('0x8'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4dd938,_0xd4f0('0x8'),JSON[_0xd4f0('0x9')](_0x9b959f));if(_0x9b959f['error']){if(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xb')]===0x1f4){logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x9b959f[_0xd4f0('0xa')]['message']);return _0x69309d(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);}logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);return _0x19a779(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);}else{logger[_0xd4f0('0xd')](_0xd4f0('0x7'),_0x4dd938,_0xd4f0('0x8'));_0x19a779(_0x9b959f[_0xd4f0('0xe')]['message']);}})['catch'](function(_0x169443){logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x169443);_0x69309d(_0x169443);});});} \ No newline at end of file +var _0x535f=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x535f,0x111));var _0xf535=function(_0x1a6156,_0x85c3c){_0x1a6156=_0x1a6156-0x0;var _0x480dda=_0x535f[_0x1a6156];return _0x480dda;};'use strict';var _=require('lodash');var util=require(_0xf535('0x0'));var moment=require(_0xf535('0x1'));var BPromise=require('bluebird');var rs=require(_0xf535('0x2'));var fs=require('fs');var Redis=require(_0xf535('0x3'));var db=require(_0xf535('0x4'))['db'];var utils=require(_0xf535('0x5'));var logger=require('../../config/logger')(_0xf535('0x6'));var config=require(_0xf535('0x7'));var jayson=require(_0xf535('0x8'));var client=jayson[_0xf535('0x9')][_0xf535('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc74104,_0x580328,_0x510b86){return new BPromise(function(_0x17f72e,_0x156c64){return client[_0xf535('0xb')](_0xc74104,_0x510b86)['then'](function(_0x244189){logger[_0xf535('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x580328,'request\x20sent');logger[_0xf535('0xd')](_0xf535('0xe'),_0x580328,'request\x20sent',JSON['stringify'](_0x244189));if(_0x244189[_0xf535('0xf')]){if(_0x244189[_0xf535('0xf')][_0xf535('0x10')]===0x1f4){logger[_0xf535('0xf')](_0xf535('0x11'),_0x580328,_0x244189['error'][_0xf535('0x12')]);return _0x156c64(_0x244189[_0xf535('0xf')][_0xf535('0x12')]);}logger[_0xf535('0xf')](_0xf535('0x11'),_0x580328,_0x244189[_0xf535('0xf')][_0xf535('0x12')]);return _0x17f72e(_0x244189[_0xf535('0xf')][_0xf535('0x12')]);}else{logger[_0xf535('0xc')](_0xf535('0x11'),_0x580328,'request\x20sent');_0x17f72e(_0x244189[_0xf535('0x13')][_0xf535('0x12')]);}})[_0xf535('0x14')](function(_0x3ffb1b){logger[_0xf535('0xf')](_0xf535('0x11'),_0x580328,_0x3ffb1b);_0x156c64(_0x3ffb1b);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 7f7be8c..1f832a3 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 _0xa4c7=['/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index'];(function(_0x7d4e73,_0x42deb6){var _0x3ba0f9=function(_0x566aff){while(--_0x566aff){_0x7d4e73['push'](_0x7d4e73['shift']());}};_0x3ba0f9(++_0x42deb6);}(_0xa4c7,0x182));var _0x7a4c=function(_0x4e9edd,_0xc33cca){_0x4e9edd=_0x4e9edd-0x0;var _0x2aa32a=_0xa4c7[_0x4e9edd];return _0x2aa32a;};'use strict';var multer=require(_0x7a4c('0x0'));var util=require(_0x7a4c('0x1'));var path=require(_0x7a4c('0x2'));var timeout=require(_0x7a4c('0x3'));var express=require(_0x7a4c('0x4'));var router=express[_0x7a4c('0x5')]();var fs_extra=require(_0x7a4c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7a4c('0x7'));var config=require(_0x7a4c('0x8'));var controller=require(_0x7a4c('0x9'));router[_0x7a4c('0xa')]('/',auth[_0x7a4c('0xb')](),controller[_0x7a4c('0xc')]);router[_0x7a4c('0xa')](_0x7a4c('0xd'),auth[_0x7a4c('0xb')](),controller[_0x7a4c('0xe')]);router[_0x7a4c('0xf')]('/',auth[_0x7a4c('0xb')](),controller[_0x7a4c('0x10')]);router['put'](_0x7a4c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x7a4c('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7a4c('0x12')]=router; \ No newline at end of file +var _0xa971=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x4152fa,_0x6dc7a3){var _0x3c3779=function(_0x13f093){while(--_0x13f093){_0x4152fa['push'](_0x4152fa['shift']());}};_0x3c3779(++_0x6dc7a3);}(_0xa971,0xc4));var _0x1a97=function(_0x3baa35,_0x55b516){_0x3baa35=_0x3baa35-0x0;var _0x416ab8=_0xa971[_0x3baa35];return _0x416ab8;};'use strict';var multer=require(_0x1a97('0x0'));var util=require(_0x1a97('0x1'));var path=require('path');var timeout=require(_0x1a97('0x2'));var express=require(_0x1a97('0x3'));var router=express[_0x1a97('0x4')]();var fs_extra=require(_0x1a97('0x5'));var auth=require(_0x1a97('0x6'));var interaction=require(_0x1a97('0x7'));var config=require(_0x1a97('0x8'));var controller=require(_0x1a97('0x9'));router[_0x1a97('0xa')]('/',auth[_0x1a97('0xb')](),controller[_0x1a97('0xc')]);router[_0x1a97('0xa')](_0x1a97('0xd'),auth['isAuthenticated'](),controller[_0x1a97('0xe')]);router[_0x1a97('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a97('0x10')](_0x1a97('0xd'),auth['isAuthenticated'](),controller[_0x1a97('0x11')]);router[_0x1a97('0x12')]('/:id',auth[_0x1a97('0xb')](),controller[_0x1a97('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 8e25b59..12d86e1 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 _0x6bba=['exports','STRING','name','sequelize'];(function(_0x488545,_0x4793c4){var _0x5f4de1=function(_0x167c18){while(--_0x167c18){_0x488545['push'](_0x488545['shift']());}};_0x5f4de1(++_0x4793c4);}(_0x6bba,0x127));var _0xa6bb=function(_0x2db756,_0x30f837){_0x2db756=_0x2db756-0x0;var _0x27baa6=_0x6bba[_0x2db756];return _0x27baa6;};'use strict';var Sequelize=require(_0xa6bb('0x0'));module[_0xa6bb('0x1')]={'name':{'type':Sequelize[_0xa6bb('0x2')],'unique':_0xa6bb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa6bb('0x2')]}}; \ No newline at end of file +var _0x6bfe=['STRING','sequelize'];(function(_0x117170,_0x35023d){var _0x10f9a1=function(_0x4624d7){while(--_0x4624d7){_0x117170['push'](_0x117170['shift']());}};_0x10f9a1(++_0x35023d);}(_0x6bfe,0x1ad));var _0xe6bf=function(_0x343474,_0x165ab9){_0x343474=_0x343474-0x0;var _0x12fc88=_0x6bfe[_0x343474];return _0x12fc88;};'use strict';var Sequelize=require(_0xe6bf('0x0'));module['exports']={'name':{'type':Sequelize[_0xe6bf('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe6bf('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3947597..00222b0 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 _0x42bb=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','Pause','rows','catch','show','params','rawAttributes','intersection','includeAll','include','find','create'];(function(_0x27f3aa,_0x2608a1){var _0x54982b=function(_0x530079){while(--_0x530079){_0x27f3aa['push'](_0x27f3aa['shift']());}};_0x54982b(++_0x2608a1);}(_0x42bb,0x164));var _0xb42b=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x42bb[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0xb42b('0x0'));var rimraf=require(_0xb42b('0x1'));var zipdir=require(_0xb42b('0x2'));var jsonpatch=require(_0xb42b('0x3'));var rp=require('request-promise');var moment=require(_0xb42b('0x4'));var BPromise=require(_0xb42b('0x5'));var Mustache=require(_0xb42b('0x6'));var util=require(_0xb42b('0x7'));var path=require(_0xb42b('0x8'));var sox=require(_0xb42b('0x9'));var csv=require(_0xb42b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb42b('0xb'));var _=require(_0xb42b('0xc'));var squel=require('squel');var crypto=require(_0xb42b('0xd'));var jsforce=require(_0xb42b('0xe'));var deskjs=require(_0xb42b('0xf'));var toCsv=require(_0xb42b('0xa'));var querystring=require(_0xb42b('0x10'));var Papa=require(_0xb42b('0x11'));var Redis=require(_0xb42b('0x12'));var authService=require(_0xb42b('0x13'));var qs=require(_0xb42b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb42b('0x15'));var logger=require(_0xb42b('0x16'))(_0xb42b('0x17'));var utils=require(_0xb42b('0x18'));var config=require(_0xb42b('0x19'));var licenseUtil=require(_0xb42b('0x1a'));var db=require(_0xb42b('0x1b'))['db'];function respondWithStatusCode(_0x2c3481,_0x4562d4){_0x4562d4=_0x4562d4||0xcc;return function(_0x5e8df4){if(_0x5e8df4){return _0x2c3481[_0xb42b('0x1c')](_0x4562d4);}return _0x2c3481[_0xb42b('0x1d')](_0x4562d4)[_0xb42b('0x1e')]();};}function respondWithResult(_0x11d30c,_0x551430){_0x551430=_0x551430||0xc8;return function(_0x10f39b){if(_0x10f39b){return _0x11d30c[_0xb42b('0x1d')](_0x551430)['json'](_0x10f39b);}};}function respondWithFilteredResult(_0x5c30d4,_0x118a1c){return function(_0x3665ec){if(_0x3665ec){var _0x596a5d=typeof _0x118a1c[_0xb42b('0x1f')]===_0xb42b('0x20')&&typeof _0x118a1c[_0xb42b('0x21')]===_0xb42b('0x20');var _0x1cf96a=_0x3665ec[_0xb42b('0x22')];var _0x19c6d6=_0x596a5d?0x0:_0x118a1c['offset'];var _0x23494c=_0x596a5d?_0x3665ec[_0xb42b('0x22')]:_0x118a1c[_0xb42b('0x1f')]+_0x118a1c[_0xb42b('0x21')];var _0x30c105;if(_0x23494c>=_0x1cf96a){_0x23494c=_0x1cf96a;_0x30c105=0xc8;}else{_0x30c105=0xce;}_0x5c30d4['status'](_0x30c105);return _0x5c30d4['set'](_0xb42b('0x23'),_0x19c6d6+'-'+_0x23494c+'/'+_0x1cf96a)[_0xb42b('0x24')](_0x3665ec);}return null;};}function patchUpdates(_0x2051b8){return function(_0xe247ec){try{jsonpatch[_0xb42b('0x25')](_0xe247ec,_0x2051b8,!![]);}catch(_0x2fb0cb){return BPromise[_0xb42b('0x26')](_0x2fb0cb);}return _0xe247ec[_0xb42b('0x27')]();};}function saveUpdates(_0x36365b,_0x3c25cc){return function(_0x393850){if(_0x393850){return _0x393850['update'](_0x36365b)[_0xb42b('0x28')](function(_0x1ee251){return _0x1ee251;});}return null;};}function removeEntity(_0x59361b,_0x195312){return function(_0x376b3c){if(_0x376b3c){return _0x376b3c[_0xb42b('0x29')]()[_0xb42b('0x28')](function(){var _0x3d6d1e=_0x376b3c[_0xb42b('0x2a')]({'plain':!![]});var _0x9b832=_0xb42b('0x2b');return db[_0xb42b('0x2c')][_0xb42b('0x29')]({'where':{'type':_0x9b832,'resourceId':_0x3d6d1e['id']}})['then'](function(){return _0x376b3c;});})[_0xb42b('0x28')](function(){_0x59361b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5be8e6,_0x28eac9){return function(_0x4c3df4){if(!_0x4c3df4){_0x5be8e6[_0xb42b('0x1c')](0x194);}return _0x4c3df4;};}function handleError(_0x51b97f,_0x252fad){_0x252fad=_0x252fad||0x1f4;return function(_0x42ed51){logger[_0xb42b('0x2d')](_0x42ed51[_0xb42b('0x2e')]);if(_0x42ed51[_0xb42b('0x2f')]){delete _0x42ed51[_0xb42b('0x2f')];}_0x51b97f[_0xb42b('0x1d')](_0x252fad)[_0xb42b('0x30')](_0x42ed51);};}exports['index']=function(_0x4220cb,_0x198a7c){var _0x414c7e={},_0x2e9cf4={},_0x5ec7da={'count':0x0,'rows':[]};var _0x2dcfa4=_[_0xb42b('0x31')](db['Pause']['rawAttributes'],function(_0x3c52cb){return{'name':_0x3c52cb[_0xb42b('0x32')],'type':_0x3c52cb['type']['key']};});_0x2e9cf4[_0xb42b('0x33')]=_['map'](_0x2dcfa4,_0xb42b('0x2f'));_0x2e9cf4[_0xb42b('0x34')]=_[_0xb42b('0x35')](_0x4220cb['query']);_0x2e9cf4[_0xb42b('0x36')]=_['intersection'](_0x2e9cf4[_0xb42b('0x33')],_0x2e9cf4[_0xb42b('0x34')]);_0x414c7e[_0xb42b('0x37')]=_['intersection'](_0x2e9cf4['model'],qs[_0xb42b('0x38')](_0x4220cb[_0xb42b('0x34')]['fields']));_0x414c7e[_0xb42b('0x37')]=_0x414c7e['attributes'][_0xb42b('0x39')]?_0x414c7e[_0xb42b('0x37')]:_0x2e9cf4[_0xb42b('0x33')];if(!_0x4220cb[_0xb42b('0x34')][_0xb42b('0x3a')](_0xb42b('0x3b'))){_0x414c7e[_0xb42b('0x21')]=qs[_0xb42b('0x21')](_0x4220cb[_0xb42b('0x34')][_0xb42b('0x21')]);_0x414c7e[_0xb42b('0x1f')]=qs[_0xb42b('0x1f')](_0x4220cb['query'][_0xb42b('0x1f')]);}_0x414c7e[_0xb42b('0x3c')]=qs[_0xb42b('0x3d')](_0x4220cb[_0xb42b('0x34')][_0xb42b('0x3d')]);_0x414c7e[_0xb42b('0x3e')]=qs[_0xb42b('0x36')](_['pick'](_0x4220cb[_0xb42b('0x34')],_0x2e9cf4[_0xb42b('0x36')]),_0x2dcfa4);if(_0x4220cb[_0xb42b('0x34')]['filter']){_0x414c7e[_0xb42b('0x3e')]=_[_0xb42b('0x3f')](_0x414c7e[_0xb42b('0x3e')],{'$or':_['map'](_0x2dcfa4,function(_0x590f92){if(_0x590f92[_0xb42b('0x40')]!==_0xb42b('0x41')){var _0x6af4d1={};_0x6af4d1[_0x590f92[_0xb42b('0x2f')]]={'$like':'%'+_0x4220cb[_0xb42b('0x34')][_0xb42b('0x42')]+'%'};return _0x6af4d1;}})});}_0x414c7e=_[_0xb42b('0x3f')]({},_0x414c7e,_0x4220cb[_0xb42b('0x43')]);var _0x4dd93a={'where':_0x414c7e['where']};return db[_0xb42b('0x44')][_0xb42b('0x22')](_0x4dd93a)[_0xb42b('0x28')](function(_0x559a7d){_0x5ec7da[_0xb42b('0x22')]=_0x559a7d;if(_0x4220cb[_0xb42b('0x34')]['includeAll']){_0x414c7e['include']=[{'all':!![]}];}return db[_0xb42b('0x44')]['findAll'](_0x414c7e);})[_0xb42b('0x28')](function(_0x8aeed8){_0x5ec7da[_0xb42b('0x45')]=_0x8aeed8;return _0x5ec7da;})[_0xb42b('0x28')](respondWithFilteredResult(_0x198a7c,_0x414c7e))[_0xb42b('0x46')](handleError(_0x198a7c,null));};exports[_0xb42b('0x47')]=function(_0x632891,_0x7d1de2){var _0x29bb70={'raw':!![],'where':{'id':_0x632891[_0xb42b('0x48')]['id']}},_0x59e8f3={};_0x59e8f3[_0xb42b('0x33')]=_['keys'](db[_0xb42b('0x44')][_0xb42b('0x49')]);_0x59e8f3['query']=_['keys'](_0x632891[_0xb42b('0x34')]);_0x59e8f3[_0xb42b('0x36')]=_[_0xb42b('0x4a')](_0x59e8f3['model'],_0x59e8f3[_0xb42b('0x34')]);_0x29bb70[_0xb42b('0x37')]=_[_0xb42b('0x4a')](_0x59e8f3['model'],qs[_0xb42b('0x38')](_0x632891['query'][_0xb42b('0x38')]));_0x29bb70[_0xb42b('0x37')]=_0x29bb70[_0xb42b('0x37')][_0xb42b('0x39')]?_0x29bb70[_0xb42b('0x37')]:_0x59e8f3[_0xb42b('0x33')];if(_0x632891['query'][_0xb42b('0x4b')]){_0x29bb70[_0xb42b('0x4c')]=[{'all':!![]}];}_0x29bb70=_[_0xb42b('0x3f')]({},_0x29bb70,_0x632891[_0xb42b('0x43')]);return db[_0xb42b('0x44')][_0xb42b('0x4d')](_0x29bb70)[_0xb42b('0x28')](handleEntityNotFound(_0x7d1de2,null))['then'](respondWithResult(_0x7d1de2,null))[_0xb42b('0x46')](handleError(_0x7d1de2,null));};exports[_0xb42b('0x4e')]=function(_0x4c3401,_0x16f2e5){return db[_0xb42b('0x44')]['create'](_0x4c3401['body'],{})['then'](function(_0x52b79e){var _0x2d6128=_0x4c3401[_0xb42b('0x4f')][_0xb42b('0x2a')]({'plain':!![]});if(!_0x2d6128)throw new Error(_0xb42b('0x50'));if(_0x2d6128[_0xb42b('0x51')]===_0xb42b('0x4f')){var _0x54b959=_0x52b79e['get']({'plain':!![]});var _0x1c7ee1=_0xb42b('0x2b');return db[_0xb42b('0x52')][_0xb42b('0x4d')]({'where':{'name':_0x1c7ee1,'userProfileId':_0x2d6128[_0xb42b('0x53')]},'raw':!![]})[_0xb42b('0x28')](function(_0x74de67){if(_0x74de67&&_0x74de67['autoAssociation']===0x0){return db[_0xb42b('0x2c')]['create']({'name':_0x54b959['name'],'resourceId':_0x54b959['id'],'type':_0x74de67[_0xb42b('0x2f')],'sectionId':_0x74de67['id']},{})[_0xb42b('0x28')](function(){return _0x52b79e;});}else{return _0x52b79e;}})[_0xb42b('0x46')](function(_0x3c2b61){logger[_0xb42b('0x2d')](_0xb42b('0x54'),_0x3c2b61);throw _0x3c2b61;});}return _0x52b79e;})[_0xb42b('0x28')](respondWithResult(_0x16f2e5,0xc9))['catch'](handleError(_0x16f2e5,null));};exports[_0xb42b('0x55')]=function(_0x5ed6fb,_0x57cc72){if(_0x5ed6fb[_0xb42b('0x56')]['id']){delete _0x5ed6fb['body']['id'];}return db['Pause'][_0xb42b('0x4d')]({'where':{'id':_0x5ed6fb[_0xb42b('0x48')]['id']}})[_0xb42b('0x28')](handleEntityNotFound(_0x57cc72,null))[_0xb42b('0x28')](saveUpdates(_0x5ed6fb[_0xb42b('0x56')],null))[_0xb42b('0x28')](respondWithResult(_0x57cc72,null))[_0xb42b('0x46')](handleError(_0x57cc72,null));};exports['destroy']=function(_0x58a5e0,_0x48e8d5){return db[_0xb42b('0x44')][_0xb42b('0x4d')]({'where':{'id':_0x58a5e0[_0xb42b('0x48')]['id']}})[_0xb42b('0x28')](handleEntityNotFound(_0x48e8d5,null))[_0xb42b('0x28')](removeEntity(_0x48e8d5,null))[_0xb42b('0x46')](handleError(_0x48e8d5,null));}; \ No newline at end of file +var _0x62f7=['intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','get','Pauses','then','sendStatus','error','name','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x62f7,0x67));var _0x762f=function(_0x51ff78,_0x35f3be){_0x51ff78=_0x51ff78-0x0;var _0x4efd0c=_0x62f7[_0x51ff78];return _0x4efd0c;};'use strict';var emlformat=require(_0x762f('0x0'));var rimraf=require(_0x762f('0x1'));var zipdir=require(_0x762f('0x2'));var jsonpatch=require(_0x762f('0x3'));var rp=require(_0x762f('0x4'));var moment=require(_0x762f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x762f('0x6'));var sox=require(_0x762f('0x7'));var csv=require(_0x762f('0x8'));var ejs=require(_0x762f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x762f('0xa'));var squel=require(_0x762f('0xb'));var crypto=require(_0x762f('0xc'));var jsforce=require(_0x762f('0xd'));var deskjs=require(_0x762f('0xe'));var toCsv=require(_0x762f('0x8'));var querystring=require(_0x762f('0xf'));var Papa=require(_0x762f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x762f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x762f('0x12'));var logger=require(_0x762f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x762f('0x14'));var licenseUtil=require(_0x762f('0x15'));var db=require(_0x762f('0x16'))['db'];function respondWithStatusCode(_0x58c50c,_0x2b3354){_0x2b3354=_0x2b3354||0xcc;return function(_0x464aba){if(_0x464aba){return _0x58c50c['sendStatus'](_0x2b3354);}return _0x58c50c[_0x762f('0x17')](_0x2b3354)[_0x762f('0x18')]();};}function respondWithResult(_0x3a2b20,_0x6852eb){_0x6852eb=_0x6852eb||0xc8;return function(_0x3129c8){if(_0x3129c8){return _0x3a2b20[_0x762f('0x17')](_0x6852eb)[_0x762f('0x19')](_0x3129c8);}};}function respondWithFilteredResult(_0x27ae07,_0x5d2088){return function(_0x38e447){if(_0x38e447){var _0x407636=typeof _0x5d2088['offset']===_0x762f('0x1a')&&typeof _0x5d2088[_0x762f('0x1b')]===_0x762f('0x1a');var _0x574a11=_0x38e447[_0x762f('0x1c')];var _0x15f411=_0x407636?0x0:_0x5d2088[_0x762f('0x1d')];var _0x3cda84=_0x407636?_0x38e447[_0x762f('0x1c')]:_0x5d2088[_0x762f('0x1d')]+_0x5d2088[_0x762f('0x1b')];var _0x43948f;if(_0x3cda84>=_0x574a11){_0x3cda84=_0x574a11;_0x43948f=0xc8;}else{_0x43948f=0xce;}_0x27ae07[_0x762f('0x17')](_0x43948f);return _0x27ae07['set'](_0x762f('0x1e'),_0x15f411+'-'+_0x3cda84+'/'+_0x574a11)[_0x762f('0x19')](_0x38e447);}return null;};}function patchUpdates(_0x16ea9e){return function(_0x1aa092){try{jsonpatch['apply'](_0x1aa092,_0x16ea9e,!![]);}catch(_0x4529f6){return BPromise[_0x762f('0x1f')](_0x4529f6);}return _0x1aa092['save']();};}function saveUpdates(_0x5e9ea8,_0x4b62f5){return function(_0x370a60){if(_0x370a60){return _0x370a60[_0x762f('0x20')](_0x5e9ea8)['then'](function(_0x1d98ae){return _0x1d98ae;});}return null;};}function removeEntity(_0x38baca,_0x41cdc6){return function(_0xd51380){if(_0xd51380){return _0xd51380['destroy']()['then'](function(){var _0xdd92c3=_0xd51380[_0x762f('0x21')]({'plain':!![]});var _0x58a57e=_0x762f('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x58a57e,'resourceId':_0xdd92c3['id']}})[_0x762f('0x23')](function(){return _0xd51380;});})['then'](function(){_0x38baca[_0x762f('0x17')](0xcc)[_0x762f('0x18')]();});}};}function handleEntityNotFound(_0x3d78e4,_0x12881e){return function(_0x4f9a4e){if(!_0x4f9a4e){_0x3d78e4[_0x762f('0x24')](0x194);}return _0x4f9a4e;};}function handleError(_0x2d5a7d,_0x5b466d){_0x5b466d=_0x5b466d||0x1f4;return function(_0x489609){logger[_0x762f('0x25')](_0x489609['stack']);if(_0x489609['name']){delete _0x489609[_0x762f('0x26')];}_0x2d5a7d[_0x762f('0x17')](_0x5b466d)['send'](_0x489609);};}exports[_0x762f('0x27')]=function(_0x4f6563,_0x2790e7){var _0x24111e={},_0x13e10b={},_0x10d78b={'count':0x0,'rows':[]};var _0x3657e6=_[_0x762f('0x28')](db[_0x762f('0x29')][_0x762f('0x2a')],function(_0x490260){return{'name':_0x490260[_0x762f('0x2b')],'type':_0x490260[_0x762f('0x2c')][_0x762f('0x2d')]};});_0x13e10b['model']=_[_0x762f('0x28')](_0x3657e6,_0x762f('0x26'));_0x13e10b[_0x762f('0x2e')]=_[_0x762f('0x2f')](_0x4f6563[_0x762f('0x2e')]);_0x13e10b[_0x762f('0x30')]=_[_0x762f('0x31')](_0x13e10b[_0x762f('0x32')],_0x13e10b[_0x762f('0x2e')]);_0x24111e[_0x762f('0x33')]=_[_0x762f('0x31')](_0x13e10b[_0x762f('0x32')],qs['fields'](_0x4f6563[_0x762f('0x2e')][_0x762f('0x34')]));_0x24111e[_0x762f('0x33')]=_0x24111e[_0x762f('0x33')][_0x762f('0x35')]?_0x24111e[_0x762f('0x33')]:_0x13e10b[_0x762f('0x32')];if(!_0x4f6563['query']['hasOwnProperty'](_0x762f('0x36'))){_0x24111e[_0x762f('0x1b')]=qs[_0x762f('0x1b')](_0x4f6563[_0x762f('0x2e')]['limit']);_0x24111e[_0x762f('0x1d')]=qs[_0x762f('0x1d')](_0x4f6563[_0x762f('0x2e')]['offset']);}_0x24111e[_0x762f('0x37')]=qs[_0x762f('0x38')](_0x4f6563[_0x762f('0x2e')][_0x762f('0x38')]);_0x24111e['where']=qs['filters'](_[_0x762f('0x39')](_0x4f6563[_0x762f('0x2e')],_0x13e10b[_0x762f('0x30')]),_0x3657e6);if(_0x4f6563[_0x762f('0x2e')][_0x762f('0x3a')]){_0x24111e[_0x762f('0x3b')]=_[_0x762f('0x3c')](_0x24111e[_0x762f('0x3b')],{'$or':_[_0x762f('0x28')](_0x3657e6,function(_0x3ec5e5){if(_0x3ec5e5[_0x762f('0x2c')]!==_0x762f('0x3d')){var _0x3fe55f={};_0x3fe55f[_0x3ec5e5[_0x762f('0x26')]]={'$like':'%'+_0x4f6563[_0x762f('0x2e')]['filter']+'%'};return _0x3fe55f;}})});}_0x24111e=_[_0x762f('0x3c')]({},_0x24111e,_0x4f6563[_0x762f('0x3e')]);var _0x1bb9ea={'where':_0x24111e[_0x762f('0x3b')]};return db[_0x762f('0x29')][_0x762f('0x1c')](_0x1bb9ea)[_0x762f('0x23')](function(_0x2e1fd6){_0x10d78b[_0x762f('0x1c')]=_0x2e1fd6;if(_0x4f6563['query'][_0x762f('0x3f')]){_0x24111e['include']=[{'all':!![]}];}return db[_0x762f('0x29')]['findAll'](_0x24111e);})[_0x762f('0x23')](function(_0x399d43){_0x10d78b['rows']=_0x399d43;return _0x10d78b;})['then'](respondWithFilteredResult(_0x2790e7,_0x24111e))[_0x762f('0x40')](handleError(_0x2790e7,null));};exports[_0x762f('0x41')]=function(_0x532599,_0x221474){var _0x1248bc={'raw':!![],'where':{'id':_0x532599['params']['id']}},_0x1864c2={};_0x1864c2[_0x762f('0x32')]=_[_0x762f('0x2f')](db[_0x762f('0x29')][_0x762f('0x2a')]);_0x1864c2[_0x762f('0x2e')]=_[_0x762f('0x2f')](_0x532599['query']);_0x1864c2[_0x762f('0x30')]=_[_0x762f('0x31')](_0x1864c2[_0x762f('0x32')],_0x1864c2[_0x762f('0x2e')]);_0x1248bc[_0x762f('0x33')]=_[_0x762f('0x31')](_0x1864c2[_0x762f('0x32')],qs[_0x762f('0x34')](_0x532599[_0x762f('0x2e')]['fields']));_0x1248bc['attributes']=_0x1248bc['attributes'][_0x762f('0x35')]?_0x1248bc['attributes']:_0x1864c2[_0x762f('0x32')];if(_0x532599[_0x762f('0x2e')][_0x762f('0x3f')]){_0x1248bc[_0x762f('0x42')]=[{'all':!![]}];}_0x1248bc=_['merge']({},_0x1248bc,_0x532599['options']);return db['Pause'][_0x762f('0x43')](_0x1248bc)[_0x762f('0x23')](handleEntityNotFound(_0x221474,null))[_0x762f('0x23')](respondWithResult(_0x221474,null))[_0x762f('0x40')](handleError(_0x221474,null));};exports['create']=function(_0x382335,_0x1a488f){return db[_0x762f('0x29')][_0x762f('0x44')](_0x382335[_0x762f('0x45')],{})['then'](function(_0x414747){var _0x39cb79=_0x382335[_0x762f('0x46')][_0x762f('0x21')]({'plain':!![]});if(!_0x39cb79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39cb79['role']===_0x762f('0x46')){var _0x4f0c3f=_0x414747[_0x762f('0x21')]({'plain':!![]});var _0x32af04='Pauses';return db[_0x762f('0x47')][_0x762f('0x43')]({'where':{'name':_0x32af04,'userProfileId':_0x39cb79[_0x762f('0x48')]},'raw':!![]})['then'](function(_0x15567e){if(_0x15567e&&_0x15567e[_0x762f('0x49')]===0x0){return db['UserProfileResource'][_0x762f('0x44')]({'name':_0x4f0c3f[_0x762f('0x26')],'resourceId':_0x4f0c3f['id'],'type':_0x15567e[_0x762f('0x26')],'sectionId':_0x15567e['id']},{})[_0x762f('0x23')](function(){return _0x414747;});}else{return _0x414747;}})[_0x762f('0x40')](function(_0x3945cf){logger['error'](_0x762f('0x4a'),_0x3945cf);throw _0x3945cf;});}return _0x414747;})['then'](respondWithResult(_0x1a488f,0xc9))['catch'](handleError(_0x1a488f,null));};exports[_0x762f('0x20')]=function(_0x24d01b,_0x378d89){if(_0x24d01b['body']['id']){delete _0x24d01b[_0x762f('0x45')]['id'];}return db[_0x762f('0x29')][_0x762f('0x43')]({'where':{'id':_0x24d01b[_0x762f('0x4b')]['id']}})[_0x762f('0x23')](handleEntityNotFound(_0x378d89,null))[_0x762f('0x23')](saveUpdates(_0x24d01b[_0x762f('0x45')],null))['then'](respondWithResult(_0x378d89,null))[_0x762f('0x40')](handleError(_0x378d89,null));};exports['destroy']=function(_0x39829c,_0x49188b){return db[_0x762f('0x29')]['find']({'where':{'id':_0x39829c[_0x762f('0x4b')]['id']}})[_0x762f('0x23')](handleEntityNotFound(_0x49188b,null))[_0x762f('0x23')](removeEntity(_0x49188b,null))[_0x762f('0x40')](handleError(_0x49188b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 330dceb..0e0d86a 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x2c9568,_0x22b2e3){var _0x42dd0d=function(_0x5ddae0){while(--_0x5ddae0){_0x2c9568['push'](_0x2c9568['shift']());}};_0x42dd0d(++_0x22b2e3);}(_0x326f,0xd1));var _0xf326=function(_0x5edbec,_0x4fdab1){_0x5edbec=_0x5edbec-0x0;var _0x37a560=_0x326f[_0x5edbec];return _0x37a560;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 4bfba97..5d265ff 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(_0xa6f170,_0x3ae180){var _0xde27b0=function(_0x5e796e){while(--_0x5e796e){_0xa6f170['push'](_0xa6f170['shift']());}};_0xde27b0(++_0x3ae180);}(_0xb10b,0x12a));var _0xbb10=function(_0xeb94a4,_0x166c7b){_0xeb94a4=_0xeb94a4-0x0;var _0x5a9285=_0xb10b[_0xeb94a4];return _0x5a9285;};'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(_0x52ef76,_0x39b289){var _0x1e32eb=function(_0x525815){while(--_0x525815){_0x52ef76['push'](_0x52ef76['shift']());}};_0x1e32eb(++_0x39b289);}(_0xb10b,0x12a));var _0xbb10=function(_0x36a5d0,_0x477b0f){_0x36a5d0=_0x36a5d0-0x0;var _0x2b0076=_0xb10b[_0x36a5d0];return _0x2b0076;};'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 8e1e4a2..e1f3b42 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 _0xc368=['show','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xc368,0x7b));var _0x8c36=function(_0x19ea3c,_0x25495c){_0x19ea3c=_0x19ea3c-0x0;var _0xd46843=_0xc368[_0x19ea3c];return _0xd46843;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x8c36('0xe')]);var upload=multer({'storage':multer[_0x8c36('0xf')]({'destination':function(_0x5132f6,_0x36cb13,_0x1c49a0){_0x1c49a0(null,path[_0x8c36('0x10')](config[_0x8c36('0x11')],_0x8c36('0x12')));},'filename':function(_0x451c24,_0xa09884,_0x23eb71){_0xa09884[_0x8c36('0x13')]=_0xa09884[_0x8c36('0x13')][_0x8c36('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23eb71(null,util[_0x8c36('0x15')](_0x8c36('0x16'),path[_0x8c36('0x17')](_0xa09884['originalname'],path[_0x8c36('0x18')](_0xa09884['originalname'])),Date[_0x8c36('0x19')](),path[_0x8c36('0x18')](_0xa09884[_0x8c36('0x13')])));}})});router[_0x8c36('0x1a')]('/',upload[_0x8c36('0x1b')](_0x8c36('0x1c')),controller[_0x8c36('0x1d')]);router[_0x8c36('0x1a')](_0x8c36('0xa'),controller['webhookPost']);router[_0x8c36('0x1e')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x1f')]);router[_0x8c36('0x20')]('/:id',auth[_0x8c36('0x9')](),controller[_0x8c36('0x20')]);module[_0x8c36('0x21')]=router; \ No newline at end of file +var _0x826a=['fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','now','post','single','file','webhookPost','put','update','delete','exports','util','connect-timeout','Router'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x826a,0x1aa));var _0xa826=function(_0x34d326,_0x43d183){_0x34d326=_0x34d326-0x0;var _0x48e348=_0x826a[_0x34d326];return _0x48e348;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var fs_extra=require(_0xa826('0x3'));var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router[_0xa826('0x7')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0x9')]);router[_0xa826('0x7')](_0xa826('0xa'),controller[_0xa826('0xb')]);router[_0xa826('0x7')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0xd')]);router[_0xa826('0x7')](_0xa826('0xe'),auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);var upload=multer({'storage':multer[_0xa826('0x10')]({'destination':function(_0x48df82,_0xbd22fc,_0x4b4caf){_0x4b4caf(null,path[_0xa826('0x11')](config[_0xa826('0x12')],_0xa826('0x13')));},'filename':function(_0xa55bd7,_0x212fac,_0x40838f){_0x212fac[_0xa826('0x14')]=_0x212fac['originalname'][_0xa826('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40838f(null,util['format'](_0xa826('0x16'),path[_0xa826('0x17')](_0x212fac['originalname'],path['extname'](_0x212fac['originalname'])),Date[_0xa826('0x18')](),path['extname'](_0x212fac['originalname'])));}})});router[_0xa826('0x19')]('/',upload[_0xa826('0x1a')](_0xa826('0x1b')),controller['upload']);router[_0xa826('0x19')](_0xa826('0xa'),controller[_0xa826('0x1c')]);router[_0xa826('0x1d')](_0xa826('0xc'),auth['isAuthenticated'](),controller[_0xa826('0x1e')]);router[_0xa826('0x1f')](_0xa826('0xc'),auth['isAuthenticated'](),controller['delete']);module[_0xa826('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 9ba537d..5536cbb 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 _0xc4ab=['STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x39cac6,_0x20bc35){var _0xc016b0=function(_0x394d72){while(--_0x394d72){_0x39cac6['push'](_0x39cac6['shift']());}};_0xc016b0(++_0x20bc35);}(_0xc4ab,0xef));var _0xbc4a=function(_0x5d889c,_0x42a08f){_0x5d889c=_0x5d889c-0x0;var _0x41a88c=_0xc4ab[_0x5d889c];return _0x41a88c;};'use strict';var Sequelize=require(_0xbc4a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc4a('0x1')]},'type':{'type':Sequelize[_0xbc4a('0x2')](_0xbc4a('0x3'),'script')},'description':{'type':Sequelize[_0xbc4a('0x4')]},'version':{'type':Sequelize[_0xbc4a('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xbc4a('0x5')},'active':{'type':Sequelize[_0xbc4a('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xbc4a('0x2')](_0xbc4a('0x7'),_0xbc4a('0x8'),_0xbc4a('0x9'),_0xbc4a('0xa')),'defaultValue':'always','comment':_0xbc4a('0xb')},'icon':{'type':Sequelize[_0xbc4a('0x1')]},'adminUrl':{'type':Sequelize[_0xbc4a('0x1')]},'agentUrl':{'type':Sequelize[_0xbc4a('0x1')]},'scriptName':{'type':Sequelize[_0xbc4a('0x1')]},'scriptPath':{'type':Sequelize[_0xbc4a('0x1')]}}; \ No newline at end of file +var _0xa936=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never'];(function(_0x44aff7,_0x479acd){var _0x202126=function(_0x5c1127){while(--_0x5c1127){_0x44aff7['push'](_0x44aff7['shift']());}};_0x202126(++_0x479acd);}(_0xa936,0x194));var _0x6a93=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xa936[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x6a93('0x0'));module[_0x6a93('0x1')]={'name':{'type':Sequelize[_0x6a93('0x2')]},'type':{'type':Sequelize[_0x6a93('0x3')](_0x6a93('0x4'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x6a93('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x6a93('0x6')},'active':{'type':Sequelize[_0x6a93('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x6a93('0x3')](_0x6a93('0x8'),_0x6a93('0x9'),_0x6a93('0xa'),_0x6a93('0xb')),'defaultValue':'always','comment':_0x6a93('0xc')},'icon':{'type':Sequelize[_0x6a93('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x6a93('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x6a93('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c8bc51c..87bd3fa 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 _0x74f5=['merge','options','find','download','join','root','server/files/plugins','format','%s.zip','basename','zip','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','Plugin\x20manifest\x20missing','manifest.json','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','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','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','name','send','map','Plugin','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','includeAll','catch','show','params','include'];(function(_0x1618fe,_0x24295b){var _0x17c445=function(_0x416680){while(--_0x416680){_0x1618fe['push'](_0x1618fe['shift']());}};_0x17c445(++_0x24295b);}(_0x74f5,0x103));var _0x574f=function(_0x9a8878,_0x2ef1b8){_0x9a8878=_0x9a8878-0x0;var _0x5f36a8=_0x74f5[_0x9a8878];return _0x5f36a8;};'use strict';var emlformat=require(_0x574f('0x0'));var rimraf=require(_0x574f('0x1'));var zipdir=require(_0x574f('0x2'));var jsonpatch=require(_0x574f('0x3'));var rp=require('request-promise');var moment=require(_0x574f('0x4'));var BPromise=require(_0x574f('0x5'));var Mustache=require(_0x574f('0x6'));var util=require(_0x574f('0x7'));var path=require(_0x574f('0x8'));var sox=require(_0x574f('0x9'));var csv=require('to-csv');var ejs=require(_0x574f('0xa'));var fs=require('fs');var fs_extra=require(_0x574f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x574f('0xc'));var deskjs=require(_0x574f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x574f('0xe'));var extract=require(_0x574f('0xf'));var rimraf=require(_0x574f('0x1'));var archiver=require('archiver');var Redis=require(_0x574f('0x10'));var authService=require(_0x574f('0x11'));var qs=require(_0x574f('0x12'));var as=require(_0x574f('0x13'));var hardwareService=require(_0x574f('0x14'));var logger=require(_0x574f('0x15'))(_0x574f('0x16'));var utils=require(_0x574f('0x17'));var config=require(_0x574f('0x18'));var licenseUtil=require(_0x574f('0x19'));var db=require(_0x574f('0x1a'))['db'];config[_0x574f('0x1b')]=_['defaults'](config['redis'],{'host':_0x574f('0x1c'),'port':0x18eb});var socket=require(_0x574f('0x1d'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x3c2a03,_0x1d0688){_0x1d0688=_0x1d0688||0xcc;return function(_0x34302e){if(_0x34302e){return _0x3c2a03[_0x574f('0x1e')](_0x1d0688);}return _0x3c2a03[_0x574f('0x1f')](_0x1d0688)[_0x574f('0x20')]();};}function respondWithResult(_0x5efdb2,_0x509fd9){_0x509fd9=_0x509fd9||0xc8;return function(_0x4fe726){if(_0x4fe726){return _0x5efdb2['status'](_0x509fd9)['json'](_0x4fe726);}};}function respondWithFilteredResult(_0x4d9c95,_0x3e29fe){return function(_0x506698){if(_0x506698){var _0x5e0326=typeof _0x3e29fe[_0x574f('0x21')]==='undefined'&&typeof _0x3e29fe[_0x574f('0x22')]===_0x574f('0x23');var _0x14dde7=_0x506698['count'];var _0x2f4db1=_0x5e0326?0x0:_0x3e29fe[_0x574f('0x21')];var _0x966fc3=_0x5e0326?_0x506698[_0x574f('0x24')]:_0x3e29fe[_0x574f('0x21')]+_0x3e29fe[_0x574f('0x22')];var _0x51aa1a;if(_0x966fc3>=_0x14dde7){_0x966fc3=_0x14dde7;_0x51aa1a=0xc8;}else{_0x51aa1a=0xce;}_0x4d9c95['status'](_0x51aa1a);return _0x4d9c95[_0x574f('0x25')](_0x574f('0x26'),_0x2f4db1+'-'+_0x966fc3+'/'+_0x14dde7)[_0x574f('0x27')](_0x506698);}return null;};}function patchUpdates(_0x46bad1){return function(_0x445eb6){try{jsonpatch[_0x574f('0x28')](_0x445eb6,_0x46bad1,!![]);}catch(_0x49a9b3){return BPromise[_0x574f('0x29')](_0x49a9b3);}return _0x445eb6[_0x574f('0x2a')]();};}function saveUpdates(_0x5ef8b5,_0x59e3ae){return function(_0x10a297){if(_0x10a297){return _0x10a297[_0x574f('0x2b')](_0x5ef8b5)['then'](function(_0x19e9a4){return _0x19e9a4;});}return null;};}function removeEntity(_0x5145a1,_0x355e44){return function(_0x515751){if(_0x515751){return _0x515751[_0x574f('0x2c')]()[_0x574f('0x2d')](function(){var _0x3d9e92=_0x515751[_0x574f('0x2e')]({'plain':!![]});var _0x411cfd=_0x574f('0x2f');return db[_0x574f('0x30')][_0x574f('0x2c')]({'where':{'type':_0x411cfd,'resourceId':_0x3d9e92['id']}})['then'](function(){return _0x515751;});})[_0x574f('0x2d')](function(){_0x5145a1[_0x574f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa3d8,_0x1257e5){return function(_0x2c5400){if(!_0x2c5400){_0x3fa3d8[_0x574f('0x1e')](0x194);}return _0x2c5400;};}function handleError(_0xadb887,_0x83ec6d){_0x83ec6d=_0x83ec6d||0x1f4;return function(_0x379b3d){logger['error'](_0x379b3d['stack']);if(_0x379b3d[_0x574f('0x31')]){delete _0x379b3d[_0x574f('0x31')];}_0xadb887[_0x574f('0x1f')](_0x83ec6d)[_0x574f('0x32')](_0x379b3d);};}exports['index']=function(_0x5d4fcf,_0x3e5500){var _0x28f402={},_0x239354={},_0x5d92e9={'count':0x0,'rows':[]};var _0x4c9ab3=_[_0x574f('0x33')](db[_0x574f('0x34')][_0x574f('0x35')],function(_0x123229){return{'name':_0x123229[_0x574f('0x36')],'type':_0x123229[_0x574f('0x37')][_0x574f('0x38')]};});_0x239354['model']=_[_0x574f('0x33')](_0x4c9ab3,_0x574f('0x31'));_0x239354[_0x574f('0x39')]=_[_0x574f('0x3a')](_0x5d4fcf[_0x574f('0x39')]);_0x239354[_0x574f('0x3b')]=_[_0x574f('0x3c')](_0x239354[_0x574f('0x3d')],_0x239354[_0x574f('0x39')]);_0x28f402[_0x574f('0x3e')]=_[_0x574f('0x3c')](_0x239354[_0x574f('0x3d')],qs[_0x574f('0x3f')](_0x5d4fcf[_0x574f('0x39')]['fields']));_0x28f402[_0x574f('0x3e')]=_0x28f402[_0x574f('0x3e')][_0x574f('0x40')]?_0x28f402[_0x574f('0x3e')]:_0x239354[_0x574f('0x3d')];if(!_0x5d4fcf[_0x574f('0x39')][_0x574f('0x41')](_0x574f('0x42'))){_0x28f402['limit']=qs[_0x574f('0x22')](_0x5d4fcf['query'][_0x574f('0x22')]);_0x28f402[_0x574f('0x21')]=qs[_0x574f('0x21')](_0x5d4fcf[_0x574f('0x39')][_0x574f('0x21')]);}_0x28f402['order']=qs['sort'](_0x5d4fcf[_0x574f('0x39')][_0x574f('0x43')]);_0x28f402[_0x574f('0x44')]=qs[_0x574f('0x3b')](_[_0x574f('0x45')](_0x5d4fcf['query'],_0x239354['filters']),_0x4c9ab3);if(_0x5d4fcf[_0x574f('0x39')]['filter']){_0x28f402[_0x574f('0x44')]=_['merge'](_0x28f402[_0x574f('0x44')],{'$or':_[_0x574f('0x33')](_0x4c9ab3,function(_0x497952){if(_0x497952[_0x574f('0x37')]!==_0x574f('0x46')){var _0x302ba9={};_0x302ba9[_0x497952[_0x574f('0x31')]]={'$like':'%'+_0x5d4fcf[_0x574f('0x39')][_0x574f('0x47')]+'%'};return _0x302ba9;}})});}_0x28f402=_['merge']({},_0x28f402,_0x5d4fcf['options']);var _0x13236d={'where':_0x28f402['where']};return db[_0x574f('0x34')][_0x574f('0x24')](_0x13236d)[_0x574f('0x2d')](function(_0x368aeb){_0x5d92e9[_0x574f('0x24')]=_0x368aeb;if(_0x5d4fcf[_0x574f('0x39')][_0x574f('0x48')]){_0x28f402['include']=[{'all':!![]}];}return db[_0x574f('0x34')]['findAll'](_0x28f402);})[_0x574f('0x2d')](function(_0x16223f){_0x5d92e9['rows']=_0x16223f;return _0x5d92e9;})[_0x574f('0x2d')](respondWithFilteredResult(_0x3e5500,_0x28f402))[_0x574f('0x49')](handleError(_0x3e5500,null));};exports[_0x574f('0x4a')]=function(_0x55fd78,_0x2a580a){var _0x41e214={'raw':!![],'where':{'id':_0x55fd78[_0x574f('0x4b')]['id']}},_0x56ed8a={};_0x56ed8a['model']=_['keys'](db['Plugin'][_0x574f('0x35')]);_0x56ed8a[_0x574f('0x39')]=_[_0x574f('0x3a')](_0x55fd78[_0x574f('0x39')]);_0x56ed8a[_0x574f('0x3b')]=_[_0x574f('0x3c')](_0x56ed8a[_0x574f('0x3d')],_0x56ed8a[_0x574f('0x39')]);_0x41e214['attributes']=_[_0x574f('0x3c')](_0x56ed8a[_0x574f('0x3d')],qs[_0x574f('0x3f')](_0x55fd78[_0x574f('0x39')][_0x574f('0x3f')]));_0x41e214[_0x574f('0x3e')]=_0x41e214[_0x574f('0x3e')]['length']?_0x41e214[_0x574f('0x3e')]:_0x56ed8a[_0x574f('0x3d')];if(_0x55fd78['query'][_0x574f('0x48')]){_0x41e214[_0x574f('0x4c')]=[{'all':!![]}];}_0x41e214=_[_0x574f('0x4d')]({},_0x41e214,_0x55fd78[_0x574f('0x4e')]);return db[_0x574f('0x34')][_0x574f('0x4f')](_0x41e214)[_0x574f('0x2d')](handleEntityNotFound(_0x2a580a,null))['then'](respondWithResult(_0x2a580a,null))['catch'](handleError(_0x2a580a,null));};exports[_0x574f('0x50')]=function(_0x178870,_0x228814,_0x494916){return db['Plugin'][_0x574f('0x4f')]({'where':{'id':_0x178870[_0x574f('0x4b')]['id']},'attributes':[_0x574f('0x31'),_0x574f('0x8')],'raw':!![]})[_0x574f('0x2d')](handleEntityNotFound(_0x228814,null))[_0x574f('0x2d')](function(_0x51a10a){if(_0x51a10a){var _0x28925c=path[_0x574f('0x51')](config[_0x574f('0x52')],_0x574f('0x53'),util[_0x574f('0x54')](_0x574f('0x55'),path[_0x574f('0x56')](_0x51a10a[_0x574f('0x8')])));var _0x28e4c5=fs['createWriteStream'](_0x28925c);var _0x438d1b=archiver(_0x574f('0x57'),{'zlib':{'level':0x9}});_0x438d1b['on']('warning',function(_0x2a7e86){if(_0x2a7e86[_0x574f('0x58')]==='ENOENT'){logger[_0x574f('0x59')](_0x2a7e86);}else{throw new db[(_0x574f('0x5a'))][(_0x574f('0x5b'))](_0x574f('0x5c'));}});_0x438d1b['on'](_0x574f('0x59'),function(_0x33a6c2){throw new db[(_0x574f('0x5a'))][(_0x574f('0x5b'))](_0x574f('0x5c'));});_0x438d1b['pipe'](_0x28e4c5);_0x438d1b[_0x574f('0x5d')]('**/*',{'cwd':path[_0x574f('0x51')](config[_0x574f('0x52')],_0x574f('0x53'),path[_0x574f('0x5e')](_0x51a10a['path'])),'ignore':[path[_0x574f('0x51')](path['basename'](_0x51a10a[_0x574f('0x8')]),_0x574f('0x5f')),path[_0x574f('0x51')](path['basename'](_0x51a10a[_0x574f('0x8')]),_0x574f('0x60'))],'nodir':!![]})[_0x574f('0x61')]();_0x28e4c5['on'](_0x574f('0x62'),function(){if(!fs[_0x574f('0x63')](_0x28925c)){throw new db[(_0x574f('0x5a'))]['Error'](_0x574f('0x64'));}return _0x228814['download'](_0x28925c,util[_0x574f('0x54')](_0x574f('0x55'),path[_0x574f('0x56')](_0x51a10a['path'])),function(_0x3bc8be){if(_0x3bc8be){throw new db[(_0x574f('0x5a'))][(_0x574f('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x574f('0x65')](_0x28925c);logger[_0x574f('0x66')](_0x574f('0x67'));logger[_0x574f('0x66')](_0x574f('0x68'));});});}return null;})['catch'](handleError(_0x228814,null));};exports[_0x574f('0x69')]=function(_0x17ef99,_0xb2fa8f,_0x18f53f){var _0x5ed090=path['basename'](_0x17ef99['file'][_0x574f('0x6a')],path[_0x574f('0x6b')](_0x17ef99[_0x574f('0x6c')][_0x574f('0x6a')]));var _0x217fa0=path['join'](config[_0x574f('0x52')],_0x574f('0x53'),_0x17ef99[_0x574f('0x6c')][_0x574f('0x6a')]);var _0x58b6c7=path['join'](config[_0x574f('0x52')],'server/files/plugins',_0x5ed090);logger['info'](_0x574f('0x6d'),_0x217fa0);logger[_0x574f('0x66')](_0x574f('0x6e'),_0x58b6c7);try{fs[_0x574f('0x6f')](_0x217fa0,parseInt(_0x574f('0x70'),0x8));extract(_0x217fa0,{'dir':_0x58b6c7},function(_0x661c68){if(_0x661c68){logger[_0x574f('0x59')](_0x661c68);handleError(_0x661c68,!![]);};var _0x450f89=fs[_0x574f('0x71')](_0x58b6c7);if(_0x450f89[_0x574f('0x40')]>0x1){removeReferences(_0x217fa0,_0x58b6c7);logger['error']('Invalid\x20plugin\x20structure');return _0x18f53f(new Error(_0x574f('0x72')));}var _0x495ec2=fs[_0x574f('0x73')](path[_0x574f('0x51')](_0x58b6c7,_0x450f89[0x0]));if(_0x495ec2[_0x574f('0x74')]()){removeReferences(_0x217fa0,_0x58b6c7);logger[_0x574f('0x59')](_0x574f('0x72'));return _0x18f53f(new Error(_0x574f('0x72')));}if(_0x495ec2['isDirectory']()){var _0x59e26c=fs[_0x574f('0x71')](path[_0x574f('0x51')](_0x58b6c7,_0x450f89[0x0]));if(_0x59e26c[_0x574f('0x40')]===0x0){removeReferences(_0x217fa0,_0x58b6c7);logger['error']('Invalid\x20plugin\x20structure');return _0x18f53f(new Error(_0x574f('0x72')));}var _0x407e04=_0x59e26c[_0x574f('0x75')](function(_0x436e0d){return _0x436e0d==='manifest.json';});if(!_0x407e04){return _0x18f53f(new Error(_0x574f('0x76')));}var _0x2eb605=fs['readFileSync'](path[_0x574f('0x51')](_0x58b6c7,_0x450f89[0x0],_0x574f('0x77')));var _0x3e79cd=JSON['parse'](_0x2eb605);if(_0x574f('0x23')==typeof _0x3e79cd['name']){return _0x18f53f(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x3e79cd[_0x574f('0x37')]){return _0x18f53f(new Error(_0x574f('0x78')));}if('undefined'==typeof _0x3e79cd[_0x574f('0x79')]){return _0x18f53f(new Error(_0x574f('0x7a')));}if(_0x574f('0x23')==typeof _0x3e79cd[_0x574f('0x7b')]){return _0x18f53f(new Error(_0x574f('0x7c')));}if(_0x3e79cd[_0x574f('0x37')]===_0x574f('0x7d')){if(_0x574f('0x23')==typeof _0x3e79cd[_0x574f('0x7b')][_0x574f('0x7e')]){return _0x18f53f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x574f('0x23')==typeof _0x3e79cd[_0x574f('0x7b')]['views'][_0x574f('0x7f')]&&_0x574f('0x23')==typeof _0x3e79cd['parameters'][_0x574f('0x7e')][_0x574f('0x80')]){return _0x18f53f(new Error(_0x574f('0x81')));}}else if(_0x3e79cd[_0x574f('0x37')]==='script'){if(_0x574f('0x23')==typeof _0x3e79cd[_0x574f('0x7b')][_0x574f('0x82')]){return _0x18f53f(new Error(_0x574f('0x83')));}if(_0x574f('0x23')==typeof _0x3e79cd['parameters'][_0x574f('0x84')]){return _0x18f53f(new Error(_0x574f('0x85')));}}else{return _0x18f53f(new Error(_0x574f('0x86')));}var _0x65d954=_0x3e79cd[_0x574f('0x31')];var _0x31475a=_0x3e79cd[_0x574f('0x87')];var _0x346c14=_0x3e79cd[_0x574f('0x37')];var _0x20909a=_0x3e79cd[_0x574f('0x88')]?_0x3e79cd['sidebar']:_0x574f('0x89');var _0x14de5f=_0x3e79cd['icon']?_0x3e79cd[_0x574f('0x8a')]:_0x574f('0x8b');var _0x4fdc06='';var _0x444a6b='';var _0x16fda1='';var _0x5ca739='';var _0x165fb0=_0x3e79cd['version'];if(_0x346c14==='html'){if(_0x574f('0x23')!=typeof _0x3e79cd[_0x574f('0x7b')][_0x574f('0x7e')][_0x574f('0x7f')]){var _0xb58772=_0x3e79cd[_0x574f('0x7b')][_0x574f('0x7e')][_0x574f('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x574f('0x8c')](_0xb58772)){_0x4fdc06=path[_0x574f('0x51')](_0x574f('0x8d'),_0x5ed090,_0x450f89[0x0],_0xb58772);}else{_0x4fdc06=_0xb58772;}}else{logger[_0x574f('0x66')](_0x574f('0x8e'));}if(_0x574f('0x23')!=typeof _0x3e79cd[_0x574f('0x7b')][_0x574f('0x7e')]['agent']){var _0x3aa52c=_0x3e79cd[_0x574f('0x7b')]['views'][_0x574f('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x574f('0x8c')](_0x3aa52c)){_0x444a6b=path['join'](_0x574f('0x8d'),_0x5ed090,_0x450f89[0x0],_0x3aa52c);}else{_0x444a6b=_0x3aa52c;}}else{logger[_0x574f('0x66')](_0x574f('0x8f'));}}else if(_0x346c14==='script'){_0x16fda1=_0x3e79cd[_0x574f('0x7b')][_0x574f('0x82')];_0x5ca739=_0x3e79cd[_0x574f('0x7b')][_0x574f('0x84')];if(_0x574f('0x23')!=typeof _0x3e79cd['parameters']['views']){if(_0x574f('0x23')!=typeof _0x3e79cd[_0x574f('0x7b')][_0x574f('0x7e')]['admin']){var _0xb58772=_0x3e79cd[_0x574f('0x7b')][_0x574f('0x7e')][_0x574f('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x574f('0x8c')](_0xb58772)){_0x4fdc06=path[_0x574f('0x51')](_0x574f('0x8d'),_0x5ed090,_0x450f89[0x0],_0xb58772);}else{_0x4fdc06=_0xb58772;}}if(_0x574f('0x23')!=typeof _0x3e79cd['parameters'][_0x574f('0x7e')][_0x574f('0x80')]){var _0x3aa52c=_0x3e79cd[_0x574f('0x7b')][_0x574f('0x7e')][_0x574f('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x574f('0x8c')](_0x3aa52c)){_0x444a6b=path['join'](_0x574f('0x8d'),_0x5ed090,_0x450f89[0x0],_0x3aa52c);}else{_0x444a6b=_0x3aa52c;}}}}var _0x4d75df={'name':_0x65d954,'description':_0x31475a,'path':path['join'](_0x5ed090,_0x450f89[0x0]),'type':_0x346c14,'sidebar':_0x20909a,'icon':_0x14de5f,'adminUrl':_0x4fdc06,'agentUrl':_0x444a6b,'scriptName':_0x16fda1,'scriptPath':_0x5ca739,'version':_0x165fb0};removeReferences(_0x217fa0,null);return db[_0x574f('0x34')][_0x574f('0x90')](_0x4d75df)[_0x574f('0x2d')](function(_0x5522af){var _0x4b28d0={'role':_0x17ef99[_0x574f('0x91')][_0x574f('0x92')],'userProfileId':_0x17ef99['body'][_0x574f('0x93')]};if(!_0x4b28d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b28d0[_0x574f('0x92')]===_0x574f('0x94')){var _0x1c8588=_0x5522af[_0x574f('0x2e')]({'plain':!![]});return db[_0x574f('0x95')]['find']({'where':{'name':'Plugins','userProfileId':_0x4b28d0[_0x574f('0x93')]},'raw':!![]})[_0x574f('0x2d')](function(_0xf08a8a){if(_0xf08a8a&&_0xf08a8a[_0x574f('0x96')]===0x0){return db[_0x574f('0x30')][_0x574f('0x90')]({'name':_0x1c8588['name'],'resourceId':_0x1c8588['id'],'type':_0xf08a8a[_0x574f('0x31')],'sectionId':_0xf08a8a['id']},{})[_0x574f('0x2d')](function(){return _0x5522af;});}else{return _0x5522af;}})['catch'](function(_0x257b06){logger['error'](_0x574f('0x97'),_0x257b06);throw _0x257b06;});}return _0x5522af;})[_0x574f('0x2d')](respondWithResult(_0xb2fa8f,null))[_0x574f('0x49')](handleError(_0xb2fa8f,null));}});}catch(_0x1fe190){_0xb2fa8f[_0x574f('0x1f')](0x1f4)[_0x574f('0x32')](_0x1fe190);}};function removeReferences(_0x5e0300,_0x452aa5){try{if(_0x5e0300){fs[_0x574f('0x65')](_0x5e0300);logger[_0x574f('0x66')](_0x574f('0x98'));}if(_0x452aa5){rimraf(_0x452aa5,function(){});logger['info'](_0x574f('0x99'));}}catch(_0x13d95c){logger[_0x574f('0x59')](_0x13d95c);}}exports[_0x574f('0x2b')]=function(_0x27bcca,_0x47e3c8,_0x4117db){return db['Plugin'][_0x574f('0x4f')]({'where':{'id':_0x27bcca[_0x574f('0x4b')]['id']}})[_0x574f('0x2d')](handleEntityNotFound(_0x47e3c8,null))[_0x574f('0x2d')](saveUpdates(_0x27bcca[_0x574f('0x91')],null))['then'](respondWithResult(_0x47e3c8,null))[_0x574f('0x49')](handleError(_0x47e3c8,null));};exports[_0x574f('0x9a')]=function(_0x4627c3,_0x57c3a8,_0xa42157){return db['Plugin'][_0x574f('0x4f')]({'where':{'id':_0x4627c3[_0x574f('0x4b')]['id']}})['then'](function(_0x3a4b94){if(_0x3a4b94){return _0x3a4b94[_0x574f('0x2c')]();}})[_0x574f('0x2d')](function(_0x51e59d){rimraf(path[_0x574f('0x51')](config[_0x574f('0x52')],_0x574f('0x53'),path[_0x574f('0x5e')](_0x51e59d[_0x574f('0x8')])),function(){});return _0x51e59d;})[_0x574f('0x2d')](handleEntityNotFound(_0x57c3a8,null))[_0x574f('0x2d')](respondWithStatusCode(_0x57c3a8,null))[_0x574f('0x49')](handleError(_0x57c3a8,null));};exports[_0x574f('0x9b')]=function(_0x1783d4,_0x96463,_0x38d82c){return BPromise[_0x574f('0x9c')]()['then'](function(){if(!_0x1783d4[_0x574f('0x39')][_0x574f('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1783d4[_0x574f('0x39')][_0x574f('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x40ff97=_0x1783d4[_0x574f('0x39')]['hostname']?_0x1783d4['query'][_0x574f('0x9e')]+':'+_0x1783d4[_0x574f('0x39')]['port']:_0x574f('0x9f')+_0x1783d4['query'][_0x574f('0x9d')];var _0x427068=_0x1783d4['query']['json']?_0x1783d4['query'][_0x574f('0x27')]:!![];var _0x22d49e=_0x1783d4[_0x574f('0x39')][_0x574f('0xa0')]?_0x1783d4[_0x574f('0x39')][_0x574f('0xa0')]:null;var _0x293fec={'method':_0x1783d4[_0x574f('0xa1')],'uri':util[_0x574f('0x54')](_0x574f('0xa2'),_0x40ff97,_0x1783d4[_0x574f('0x39')][_0x574f('0x8')]),'json':_0x427068,'resolveWithFullResponse':!![],'encoding':_0x22d49e,'qs':_0x1783d4[_0x574f('0x39')]};if(_0x1783d4[_0x574f('0xa3')]){_0x293fec[_0x574f('0xa3')]=_0x1783d4['headers'];if(_0x293fec['headers']['content-length']){delete _0x293fec[_0x574f('0xa3')][_0x574f('0xa4')];}}if(_0x293fec[_0x574f('0xa3')][_0x574f('0xa5')]){delete _0x293fec[_0x574f('0xa3')]['content-type'];}return rp(_0x293fec);})[_0x574f('0x2d')](function(_0x233a9f){if(_0x233a9f){_0x96463['set'](_0x233a9f[_0x574f('0xa3')]);logger['info'](_0x233a9f[_0x574f('0x91')]);if(_['endsWith'](_0x1783d4[_0x574f('0x39')]['path'],'download')&&_0x233a9f[_0x574f('0xa6')]==0x1f4){return _0x96463[_0x574f('0x1e')](_0x233a9f[_0x574f('0xa6')]);}else{return _0x96463[_0x574f('0x1f')](_0x233a9f['statusCode'])[_0x574f('0x32')](_0x233a9f[_0x574f('0x91')]);}}else{return _0x96463[_0x574f('0x1e')](0xc8);}})[_0x574f('0x49')](handleError(_0x96463,null));};exports['webhookPost']=function(_0x207427,_0x4070ea,_0x28f01b){return BPromise[_0x574f('0x9c')]()[_0x574f('0x2d')](function(){if(!_0x207427[_0x574f('0x39')][_0x574f('0x8')]){throw new Error(_0x574f('0xa7'));}if(!_0x207427[_0x574f('0x39')][_0x574f('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5351d2=_0x207427[_0x574f('0x39')][_0x574f('0x9e')]?_0x207427[_0x574f('0x39')][_0x574f('0x9e')]+':'+_0x207427[_0x574f('0x39')]['port']:_0x574f('0x9f')+_0x207427[_0x574f('0x39')]['port'];var _0x2c200d=_0x207427[_0x574f('0x39')]['json']?_0x207427[_0x574f('0x39')][_0x574f('0x27')]:!![];var _0x42b3ba=_0x207427[_0x574f('0x39')]['encoding']?_0x207427[_0x574f('0x39')][_0x574f('0xa0')]:null;var _0xb48882={'method':_0x207427[_0x574f('0xa1')],'uri':util[_0x574f('0x54')](_0x574f('0xa2'),_0x5351d2,_0x207427[_0x574f('0x39')][_0x574f('0x8')]),'json':_0x2c200d,'resolveWithFullResponse':!![],'encoding':_0x42b3ba,'body':_0x207427[_0x574f('0x91')]};if(_0x207427['headers']){_0xb48882[_0x574f('0xa3')]=_0x207427[_0x574f('0xa3')];if(_0xb48882[_0x574f('0xa3')][_0x574f('0xa4')]){delete _0xb48882[_0x574f('0xa3')][_0x574f('0xa4')];}}if(_0xb48882[_0x574f('0xa3')][_0x574f('0xa5')]){delete _0xb48882[_0x574f('0xa3')]['content-type'];}return rp(_0xb48882);})[_0x574f('0x2d')](function(_0x33bf72){if(_0x33bf72){_0x4070ea[_0x574f('0x25')](_0x33bf72[_0x574f('0xa3')]);logger[_0x574f('0x66')](_0x33bf72[_0x574f('0x91')]);return _0x4070ea['status'](_0x33bf72[_0x574f('0xa6')])['send'](_0x33bf72[_0x574f('0x91')]);}else{return _0x4070ea['sendStatus'](0xc8);}})[_0x574f('0x49')](handleError(_0x4070ea,null));}; \ No newline at end of file +var _0x74d4=['format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Plugins','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','download','params','join','root','server/files/plugins'];(function(_0x5e9b84,_0x41bd6f){var _0x274bd8=function(_0x497f92){while(--_0x497f92){_0x5e9b84['push'](_0x5e9b84['shift']());}};_0x274bd8(++_0x41bd6f);}(_0x74d4,0x103));var _0x474d=function(_0xea817b,_0x177ed2){_0xea817b=_0xea817b-0x0;var _0x48554b=_0x74d4[_0xea817b];return _0x48554b;};'use strict';var emlformat=require(_0x474d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x474d('0x1'));var moment=require('moment');var BPromise=require(_0x474d('0x2'));var Mustache=require(_0x474d('0x3'));var util=require('util');var path=require(_0x474d('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x474d('0x5'));var fs=require('fs');var fs_extra=require(_0x474d('0x6'));var _=require('lodash');var squel=require(_0x474d('0x7'));var crypto=require(_0x474d('0x8'));var jsforce=require(_0x474d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x474d('0xa'));var querystring=require('querystring');var Papa=require(_0x474d('0xb'));var extract=require('extract-zip');var rimraf=require(_0x474d('0xc'));var archiver=require(_0x474d('0xd'));var Redis=require(_0x474d('0xe'));var authService=require(_0x474d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x474d('0x10'))(_0x474d('0x11'));var utils=require(_0x474d('0x12'));var config=require(_0x474d('0x13'));var licenseUtil=require(_0x474d('0x14'));var db=require(_0x474d('0x15'))['db'];config['redis']=_[_0x474d('0x16')](config[_0x474d('0x17')],{'host':_0x474d('0x18'),'port':0x18eb});var socket=require(_0x474d('0x19'))(new Redis(config[_0x474d('0x17')]));require('./plugin.socket')[_0x474d('0x1a')](socket);function respondWithStatusCode(_0x4b8b8d,_0x9d724b){_0x9d724b=_0x9d724b||0xcc;return function(_0x518668){if(_0x518668){return _0x4b8b8d[_0x474d('0x1b')](_0x9d724b);}return _0x4b8b8d[_0x474d('0x1c')](_0x9d724b)[_0x474d('0x1d')]();};}function respondWithResult(_0x1d6f47,_0x478c92){_0x478c92=_0x478c92||0xc8;return function(_0x34e021){if(_0x34e021){return _0x1d6f47['status'](_0x478c92)[_0x474d('0x1e')](_0x34e021);}};}function respondWithFilteredResult(_0x4eb55d,_0x33cc7a){return function(_0x209366){if(_0x209366){var _0x2e09aa=typeof _0x33cc7a[_0x474d('0x1f')]===_0x474d('0x20')&&typeof _0x33cc7a[_0x474d('0x21')]==='undefined';var _0x3ff52c=_0x209366[_0x474d('0x22')];var _0x5de987=_0x2e09aa?0x0:_0x33cc7a['offset'];var _0x1dff63=_0x2e09aa?_0x209366[_0x474d('0x22')]:_0x33cc7a['offset']+_0x33cc7a['limit'];var _0x180889;if(_0x1dff63>=_0x3ff52c){_0x1dff63=_0x3ff52c;_0x180889=0xc8;}else{_0x180889=0xce;}_0x4eb55d[_0x474d('0x1c')](_0x180889);return _0x4eb55d[_0x474d('0x23')]('Content-Range',_0x5de987+'-'+_0x1dff63+'/'+_0x3ff52c)['json'](_0x209366);}return null;};}function patchUpdates(_0xc97464){return function(_0x2ee7e7){try{jsonpatch[_0x474d('0x24')](_0x2ee7e7,_0xc97464,!![]);}catch(_0x4cb907){return BPromise[_0x474d('0x25')](_0x4cb907);}return _0x2ee7e7[_0x474d('0x26')]();};}function saveUpdates(_0x44ee79,_0x3a244d){return function(_0x3b330a){if(_0x3b330a){return _0x3b330a[_0x474d('0x27')](_0x44ee79)[_0x474d('0x28')](function(_0x485fab){return _0x485fab;});}return null;};}function removeEntity(_0x5669b5,_0x21349c){return function(_0x5d2026){if(_0x5d2026){return _0x5d2026[_0x474d('0x29')]()[_0x474d('0x28')](function(){var _0x5eb3bf=_0x5d2026[_0x474d('0x2a')]({'plain':!![]});var _0x1e87ac=_0x474d('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e87ac,'resourceId':_0x5eb3bf['id']}})['then'](function(){return _0x5d2026;});})['then'](function(){_0x5669b5[_0x474d('0x1c')](0xcc)[_0x474d('0x1d')]();});}};}function handleEntityNotFound(_0xa48a13,_0x1d0087){return function(_0x22af24){if(!_0x22af24){_0xa48a13[_0x474d('0x1b')](0x194);}return _0x22af24;};}function handleError(_0x28fcc9,_0x3f3cd5){_0x3f3cd5=_0x3f3cd5||0x1f4;return function(_0x4468ec){logger[_0x474d('0x2c')](_0x4468ec[_0x474d('0x2d')]);if(_0x4468ec[_0x474d('0x2e')]){delete _0x4468ec[_0x474d('0x2e')];}_0x28fcc9[_0x474d('0x1c')](_0x3f3cd5)[_0x474d('0x2f')](_0x4468ec);};}exports[_0x474d('0x30')]=function(_0x2cd3b7,_0x576af7){var _0x17219d={},_0x5e402a={},_0x5a6df1={'count':0x0,'rows':[]};var _0x5f4f07=_[_0x474d('0x31')](db[_0x474d('0x32')][_0x474d('0x33')],function(_0x422639){return{'name':_0x422639[_0x474d('0x34')],'type':_0x422639[_0x474d('0x35')][_0x474d('0x36')]};});_0x5e402a[_0x474d('0x37')]=_[_0x474d('0x31')](_0x5f4f07,'name');_0x5e402a[_0x474d('0x38')]=_['keys'](_0x2cd3b7[_0x474d('0x38')]);_0x5e402a['filters']=_[_0x474d('0x39')](_0x5e402a[_0x474d('0x37')],_0x5e402a[_0x474d('0x38')]);_0x17219d['attributes']=_['intersection'](_0x5e402a['model'],qs[_0x474d('0x3a')](_0x2cd3b7[_0x474d('0x38')][_0x474d('0x3a')]));_0x17219d[_0x474d('0x3b')]=_0x17219d[_0x474d('0x3b')][_0x474d('0x3c')]?_0x17219d['attributes']:_0x5e402a['model'];if(!_0x2cd3b7[_0x474d('0x38')][_0x474d('0x3d')](_0x474d('0x3e'))){_0x17219d[_0x474d('0x21')]=qs['limit'](_0x2cd3b7['query']['limit']);_0x17219d['offset']=qs[_0x474d('0x1f')](_0x2cd3b7[_0x474d('0x38')][_0x474d('0x1f')]);}_0x17219d[_0x474d('0x3f')]=qs[_0x474d('0x40')](_0x2cd3b7['query']['sort']);_0x17219d[_0x474d('0x41')]=qs['filters'](_[_0x474d('0x42')](_0x2cd3b7[_0x474d('0x38')],_0x5e402a[_0x474d('0x43')]),_0x5f4f07);if(_0x2cd3b7[_0x474d('0x38')][_0x474d('0x44')]){_0x17219d['where']=_[_0x474d('0x45')](_0x17219d[_0x474d('0x41')],{'$or':_[_0x474d('0x31')](_0x5f4f07,function(_0xf99f3e){if(_0xf99f3e[_0x474d('0x35')]!==_0x474d('0x46')){var _0x23cad1={};_0x23cad1[_0xf99f3e[_0x474d('0x2e')]]={'$like':'%'+_0x2cd3b7[_0x474d('0x38')][_0x474d('0x44')]+'%'};return _0x23cad1;}})});}_0x17219d=_[_0x474d('0x45')]({},_0x17219d,_0x2cd3b7[_0x474d('0x47')]);var _0x92c4b0={'where':_0x17219d['where']};return db[_0x474d('0x32')][_0x474d('0x22')](_0x92c4b0)[_0x474d('0x28')](function(_0x472fd2){_0x5a6df1[_0x474d('0x22')]=_0x472fd2;if(_0x2cd3b7[_0x474d('0x38')][_0x474d('0x48')]){_0x17219d[_0x474d('0x49')]=[{'all':!![]}];}return db[_0x474d('0x32')][_0x474d('0x4a')](_0x17219d);})[_0x474d('0x28')](function(_0x10227b){_0x5a6df1[_0x474d('0x4b')]=_0x10227b;return _0x5a6df1;})[_0x474d('0x28')](respondWithFilteredResult(_0x576af7,_0x17219d))[_0x474d('0x4c')](handleError(_0x576af7,null));};exports[_0x474d('0x4d')]=function(_0x451505,_0xfc5b8c){var _0x44d770={'raw':!![],'where':{'id':_0x451505['params']['id']}},_0x3ec3b7={};_0x3ec3b7[_0x474d('0x37')]=_[_0x474d('0x4e')](db[_0x474d('0x32')]['rawAttributes']);_0x3ec3b7[_0x474d('0x38')]=_['keys'](_0x451505[_0x474d('0x38')]);_0x3ec3b7[_0x474d('0x43')]=_[_0x474d('0x39')](_0x3ec3b7[_0x474d('0x37')],_0x3ec3b7[_0x474d('0x38')]);_0x44d770['attributes']=_[_0x474d('0x39')](_0x3ec3b7['model'],qs[_0x474d('0x3a')](_0x451505['query'][_0x474d('0x3a')]));_0x44d770[_0x474d('0x3b')]=_0x44d770['attributes']['length']?_0x44d770[_0x474d('0x3b')]:_0x3ec3b7[_0x474d('0x37')];if(_0x451505[_0x474d('0x38')][_0x474d('0x48')]){_0x44d770['include']=[{'all':!![]}];}_0x44d770=_[_0x474d('0x45')]({},_0x44d770,_0x451505[_0x474d('0x47')]);return db[_0x474d('0x32')][_0x474d('0x4f')](_0x44d770)[_0x474d('0x28')](handleEntityNotFound(_0xfc5b8c,null))[_0x474d('0x28')](respondWithResult(_0xfc5b8c,null))[_0x474d('0x4c')](handleError(_0xfc5b8c,null));};exports[_0x474d('0x50')]=function(_0x4b9026,_0x38e971,_0xf43904){return db[_0x474d('0x32')][_0x474d('0x4f')]({'where':{'id':_0x4b9026[_0x474d('0x51')]['id']},'attributes':[_0x474d('0x2e'),_0x474d('0x4')],'raw':!![]})[_0x474d('0x28')](handleEntityNotFound(_0x38e971,null))['then'](function(_0x6b77e){if(_0x6b77e){var _0xd757f2=path[_0x474d('0x52')](config[_0x474d('0x53')],_0x474d('0x54'),util[_0x474d('0x55')](_0x474d('0x56'),path[_0x474d('0x57')](_0x6b77e['path'])));var _0x332454=fs[_0x474d('0x58')](_0xd757f2);var _0x5b3337=archiver(_0x474d('0x59'),{'zlib':{'level':0x9}});_0x5b3337['on'](_0x474d('0x5a'),function(_0x5eb897){if(_0x5eb897[_0x474d('0x5b')]===_0x474d('0x5c')){logger['error'](_0x5eb897);}else{throw new db[(_0x474d('0x5d'))][(_0x474d('0x5e'))](_0x474d('0x5f'));}});_0x5b3337['on'](_0x474d('0x2c'),function(_0x1fe750){throw new db[(_0x474d('0x5d'))][(_0x474d('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x5b3337['pipe'](_0x332454);_0x5b3337[_0x474d('0x60')](_0x474d('0x61'),{'cwd':path[_0x474d('0x52')](config[_0x474d('0x53')],_0x474d('0x54'),path[_0x474d('0x62')](_0x6b77e[_0x474d('0x4')])),'ignore':[path[_0x474d('0x52')](path[_0x474d('0x57')](_0x6b77e[_0x474d('0x4')]),'node_modules/**/*'),path[_0x474d('0x52')](path[_0x474d('0x57')](_0x6b77e['path']),_0x474d('0x63'))],'nodir':!![]})['finalize']();_0x332454['on'](_0x474d('0x64'),function(){if(!fs[_0x474d('0x65')](_0xd757f2)){throw new db[(_0x474d('0x5d'))][(_0x474d('0x5e'))](_0x474d('0x66'));}return _0x38e971['download'](_0xd757f2,util[_0x474d('0x55')](_0x474d('0x56'),path[_0x474d('0x57')](_0x6b77e[_0x474d('0x4')])),function(_0x3bcb2c){if(_0x3bcb2c){throw new db[(_0x474d('0x5d'))][(_0x474d('0x5e'))](_0x474d('0x67'));}fs[_0x474d('0x68')](_0xd757f2);logger[_0x474d('0x69')]('Download\x20completed');logger[_0x474d('0x69')](_0x474d('0x6a'));});});}return null;})[_0x474d('0x4c')](handleError(_0x38e971,null));};exports['upload']=function(_0x372860,_0x8fea1,_0x15f1da){var _0x56211a=path['basename'](_0x372860[_0x474d('0x6b')][_0x474d('0x6c')],path[_0x474d('0x6d')](_0x372860[_0x474d('0x6b')]['filename']));var _0x410474=path[_0x474d('0x52')](config[_0x474d('0x53')],_0x474d('0x54'),_0x372860[_0x474d('0x6b')][_0x474d('0x6c')]);var _0x21fc6e=path[_0x474d('0x52')](config[_0x474d('0x53')],_0x474d('0x54'),_0x56211a);logger[_0x474d('0x69')](_0x474d('0x6e'),_0x410474);logger['info'](_0x474d('0x6f'),_0x21fc6e);try{fs['chmodSync'](_0x410474,parseInt(_0x474d('0x70'),0x8));extract(_0x410474,{'dir':_0x21fc6e},function(_0x130871){if(_0x130871){logger[_0x474d('0x2c')](_0x130871);handleError(_0x130871,!![]);};var _0x3a930a=fs[_0x474d('0x71')](_0x21fc6e);if(_0x3a930a['length']>0x1){removeReferences(_0x410474,_0x21fc6e);logger[_0x474d('0x2c')](_0x474d('0x72'));return _0x15f1da(new Error(_0x474d('0x72')));}var _0x3c0a16=fs[_0x474d('0x73')](path[_0x474d('0x52')](_0x21fc6e,_0x3a930a[0x0]));if(_0x3c0a16[_0x474d('0x74')]()){removeReferences(_0x410474,_0x21fc6e);logger[_0x474d('0x2c')](_0x474d('0x72'));return _0x15f1da(new Error(_0x474d('0x72')));}if(_0x3c0a16[_0x474d('0x75')]()){var _0x5cbf1a=fs[_0x474d('0x71')](path[_0x474d('0x52')](_0x21fc6e,_0x3a930a[0x0]));if(_0x5cbf1a[_0x474d('0x3c')]===0x0){removeReferences(_0x410474,_0x21fc6e);logger[_0x474d('0x2c')](_0x474d('0x72'));return _0x15f1da(new Error(_0x474d('0x72')));}var _0x5e8bec=_0x5cbf1a[_0x474d('0x76')](function(_0x3f8633){return _0x3f8633===_0x474d('0x77');});if(!_0x5e8bec){return _0x15f1da(new Error(_0x474d('0x78')));}var _0x4164aa=fs['readFileSync'](path[_0x474d('0x52')](_0x21fc6e,_0x3a930a[0x0],_0x474d('0x77')));var _0x28e11d=JSON[_0x474d('0x79')](_0x4164aa);if(_0x474d('0x20')==typeof _0x28e11d[_0x474d('0x2e')]){return _0x15f1da(new Error(_0x474d('0x7a')));}if(_0x474d('0x20')==typeof _0x28e11d[_0x474d('0x35')]){return _0x15f1da(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x28e11d[_0x474d('0x7b')]){return _0x15f1da(new Error(_0x474d('0x7c')));}if(_0x474d('0x20')==typeof _0x28e11d[_0x474d('0x7d')]){return _0x15f1da(new Error(_0x474d('0x7e')));}if(_0x28e11d[_0x474d('0x35')]===_0x474d('0x7f')){if('undefined'==typeof _0x28e11d['parameters'][_0x474d('0x80')]){return _0x15f1da(new Error(_0x474d('0x81')));}if('undefined'==typeof _0x28e11d[_0x474d('0x7d')][_0x474d('0x80')][_0x474d('0x82')]&&'undefined'==typeof _0x28e11d['parameters'][_0x474d('0x80')][_0x474d('0x83')]){return _0x15f1da(new Error(_0x474d('0x84')));}}else if(_0x28e11d[_0x474d('0x35')]===_0x474d('0x85')){if('undefined'==typeof _0x28e11d[_0x474d('0x7d')][_0x474d('0x86')]){return _0x15f1da(new Error(_0x474d('0x87')));}if(_0x474d('0x20')==typeof _0x28e11d[_0x474d('0x7d')][_0x474d('0x88')]){return _0x15f1da(new Error(_0x474d('0x89')));}}else{return _0x15f1da(new Error(_0x474d('0x8a')));}var _0x43975b=_0x28e11d[_0x474d('0x2e')];var _0x2acfd1=_0x28e11d['description'];var _0x50d1ba=_0x28e11d[_0x474d('0x35')];var _0x145a6a=_0x28e11d[_0x474d('0x8b')]?_0x28e11d['sidebar']:_0x474d('0x8c');var _0x57cf7b=_0x28e11d[_0x474d('0x8d')]?_0x28e11d[_0x474d('0x8d')]:_0x474d('0x8e');var _0x25a7fb='';var _0x24b9bb='';var _0x2770d1='';var _0x378631='';var _0x39b7ba=_0x28e11d[_0x474d('0x7b')];if(_0x50d1ba===_0x474d('0x7f')){if(_0x474d('0x20')!=typeof _0x28e11d[_0x474d('0x7d')][_0x474d('0x80')][_0x474d('0x82')]){var _0x1d3890=_0x28e11d['parameters'][_0x474d('0x80')][_0x474d('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x474d('0x8f')](_0x1d3890)){_0x25a7fb=path[_0x474d('0x52')](_0x474d('0x90'),_0x56211a,_0x3a930a[0x0],_0x1d3890);}else{_0x25a7fb=_0x1d3890;}}else{logger[_0x474d('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x28e11d['parameters'][_0x474d('0x80')][_0x474d('0x83')]){var _0x52a376=_0x28e11d[_0x474d('0x7d')][_0x474d('0x80')][_0x474d('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x474d('0x8f')](_0x52a376)){_0x24b9bb=path[_0x474d('0x52')](_0x474d('0x90'),_0x56211a,_0x3a930a[0x0],_0x52a376);}else{_0x24b9bb=_0x52a376;}}else{logger['info'](_0x474d('0x91'));}}else if(_0x50d1ba===_0x474d('0x85')){_0x2770d1=_0x28e11d[_0x474d('0x7d')]['scriptName'];_0x378631=_0x28e11d['parameters'][_0x474d('0x88')];if(_0x474d('0x20')!=typeof _0x28e11d[_0x474d('0x7d')]['views']){if('undefined'!=typeof _0x28e11d[_0x474d('0x7d')]['views'][_0x474d('0x82')]){var _0x1d3890=_0x28e11d['parameters'][_0x474d('0x80')][_0x474d('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x474d('0x8f')](_0x1d3890)){_0x25a7fb=path['join'](_0x474d('0x90'),_0x56211a,_0x3a930a[0x0],_0x1d3890);}else{_0x25a7fb=_0x1d3890;}}if(_0x474d('0x20')!=typeof _0x28e11d[_0x474d('0x7d')][_0x474d('0x80')][_0x474d('0x83')]){var _0x52a376=_0x28e11d[_0x474d('0x7d')][_0x474d('0x80')][_0x474d('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x474d('0x8f')](_0x52a376)){_0x24b9bb=path[_0x474d('0x52')](_0x474d('0x90'),_0x56211a,_0x3a930a[0x0],_0x52a376);}else{_0x24b9bb=_0x52a376;}}}}var _0x2748ac={'name':_0x43975b,'description':_0x2acfd1,'path':path[_0x474d('0x52')](_0x56211a,_0x3a930a[0x0]),'type':_0x50d1ba,'sidebar':_0x145a6a,'icon':_0x57cf7b,'adminUrl':_0x25a7fb,'agentUrl':_0x24b9bb,'scriptName':_0x2770d1,'scriptPath':_0x378631,'version':_0x39b7ba};removeReferences(_0x410474,null);return db['Plugin'][_0x474d('0x92')](_0x2748ac)[_0x474d('0x28')](function(_0x14babe){var _0x44c5bc={'role':_0x372860[_0x474d('0x93')][_0x474d('0x94')],'userProfileId':_0x372860['body'][_0x474d('0x95')]};if(!_0x44c5bc)throw new Error(_0x474d('0x96'));if(_0x44c5bc['role']==='user'){var _0x1e9c8e=_0x14babe[_0x474d('0x2a')]({'plain':!![]});return db[_0x474d('0x97')][_0x474d('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x44c5bc[_0x474d('0x95')]},'raw':!![]})['then'](function(_0x193099){if(_0x193099&&_0x193099[_0x474d('0x98')]===0x0){return db[_0x474d('0x99')][_0x474d('0x92')]({'name':_0x1e9c8e[_0x474d('0x2e')],'resourceId':_0x1e9c8e['id'],'type':_0x193099[_0x474d('0x2e')],'sectionId':_0x193099['id']},{})[_0x474d('0x28')](function(){return _0x14babe;});}else{return _0x14babe;}})['catch'](function(_0x46bbd2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46bbd2);throw _0x46bbd2;});}return _0x14babe;})[_0x474d('0x28')](respondWithResult(_0x8fea1,null))[_0x474d('0x4c')](handleError(_0x8fea1,null));}});}catch(_0x497d99){_0x8fea1['status'](0x1f4)[_0x474d('0x2f')](_0x497d99);}};function removeReferences(_0x236bec,_0x320f26){try{if(_0x236bec){fs[_0x474d('0x68')](_0x236bec);logger['info'](_0x474d('0x9a'));}if(_0x320f26){rimraf(_0x320f26,function(){});logger['info'](_0x474d('0x9b'));}}catch(_0xc2d140){logger[_0x474d('0x2c')](_0xc2d140);}}exports[_0x474d('0x27')]=function(_0x21fe84,_0x2ade06,_0xf7670c){return db['Plugin']['find']({'where':{'id':_0x21fe84[_0x474d('0x51')]['id']}})[_0x474d('0x28')](handleEntityNotFound(_0x2ade06,null))[_0x474d('0x28')](saveUpdates(_0x21fe84['body'],null))[_0x474d('0x28')](respondWithResult(_0x2ade06,null))['catch'](handleError(_0x2ade06,null));};exports[_0x474d('0x9c')]=function(_0x4167d5,_0x27da35,_0x33412a){return db[_0x474d('0x32')][_0x474d('0x4f')]({'where':{'id':_0x4167d5[_0x474d('0x51')]['id']}})[_0x474d('0x28')](function(_0x59ab9b){if(_0x59ab9b){return _0x59ab9b['destroy']();}})[_0x474d('0x28')](function(_0x1b2e3b){rimraf(path[_0x474d('0x52')](config[_0x474d('0x53')],_0x474d('0x54'),path['dirname'](_0x1b2e3b[_0x474d('0x4')])),function(){});return _0x1b2e3b;})[_0x474d('0x28')](handleEntityNotFound(_0x27da35,null))['then'](respondWithStatusCode(_0x27da35,null))[_0x474d('0x4c')](handleError(_0x27da35,null));};exports[_0x474d('0x9d')]=function(_0x303ebc,_0x5c8acb,_0x359772){return BPromise['resolve']()[_0x474d('0x28')](function(){if(!_0x303ebc[_0x474d('0x38')][_0x474d('0x4')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x303ebc[_0x474d('0x38')][_0x474d('0x9e')]){throw new Error(_0x474d('0x9f'));}var _0x540f74=_0x303ebc[_0x474d('0x38')][_0x474d('0xa0')]?_0x303ebc[_0x474d('0x38')][_0x474d('0xa0')]+':'+_0x303ebc[_0x474d('0x38')][_0x474d('0x9e')]:_0x474d('0xa1')+_0x303ebc[_0x474d('0x38')]['port'];var _0x2a9614=_0x303ebc[_0x474d('0x38')][_0x474d('0x1e')]?_0x303ebc[_0x474d('0x38')][_0x474d('0x1e')]:!![];var _0x33c4d4=_0x303ebc[_0x474d('0x38')]['encoding']?_0x303ebc[_0x474d('0x38')][_0x474d('0xa2')]:null;var _0xcd5f50={'method':_0x303ebc[_0x474d('0xa3')],'uri':util[_0x474d('0x55')](_0x474d('0xa4'),_0x540f74,_0x303ebc[_0x474d('0x38')][_0x474d('0x4')]),'json':_0x2a9614,'resolveWithFullResponse':!![],'encoding':_0x33c4d4,'qs':_0x303ebc[_0x474d('0x38')]};if(_0x303ebc[_0x474d('0xa5')]){_0xcd5f50['headers']=_0x303ebc[_0x474d('0xa5')];if(_0xcd5f50[_0x474d('0xa5')][_0x474d('0xa6')]){delete _0xcd5f50[_0x474d('0xa5')][_0x474d('0xa6')];}}if(_0xcd5f50[_0x474d('0xa5')][_0x474d('0xa7')]){delete _0xcd5f50[_0x474d('0xa5')][_0x474d('0xa7')];}return rp(_0xcd5f50);})[_0x474d('0x28')](function(_0x494c57){if(_0x494c57){_0x5c8acb[_0x474d('0x23')](_0x494c57[_0x474d('0xa5')]);logger[_0x474d('0x69')](_0x494c57[_0x474d('0x93')]);if(_['endsWith'](_0x303ebc['query']['path'],'download')&&_0x494c57[_0x474d('0xa8')]==0x1f4){return _0x5c8acb[_0x474d('0x1b')](_0x494c57['statusCode']);}else{return _0x5c8acb[_0x474d('0x1c')](_0x494c57[_0x474d('0xa8')])[_0x474d('0x2f')](_0x494c57[_0x474d('0x93')]);}}else{return _0x5c8acb[_0x474d('0x1b')](0xc8);}})[_0x474d('0x4c')](handleError(_0x5c8acb,null));};exports[_0x474d('0xa9')]=function(_0x5585d4,_0xd50741,_0x460a38){return BPromise[_0x474d('0xaa')]()[_0x474d('0x28')](function(){if(!_0x5585d4[_0x474d('0x38')][_0x474d('0x4')]){throw new Error(_0x474d('0xab'));}if(!_0x5585d4['query']['port']){throw new Error(_0x474d('0x9f'));}var _0x221128=_0x5585d4['query'][_0x474d('0xa0')]?_0x5585d4[_0x474d('0x38')][_0x474d('0xa0')]+':'+_0x5585d4[_0x474d('0x38')][_0x474d('0x9e')]:_0x474d('0xa1')+_0x5585d4[_0x474d('0x38')]['port'];var _0x201329=_0x5585d4[_0x474d('0x38')]['json']?_0x5585d4['query'][_0x474d('0x1e')]:!![];var _0x1b96d4=_0x5585d4['query'][_0x474d('0xa2')]?_0x5585d4[_0x474d('0x38')]['encoding']:null;var _0x532113={'method':_0x5585d4[_0x474d('0xa3')],'uri':util[_0x474d('0x55')](_0x474d('0xa4'),_0x221128,_0x5585d4[_0x474d('0x38')]['path']),'json':_0x201329,'resolveWithFullResponse':!![],'encoding':_0x1b96d4,'body':_0x5585d4[_0x474d('0x93')]};if(_0x5585d4[_0x474d('0xa5')]){_0x532113[_0x474d('0xa5')]=_0x5585d4[_0x474d('0xa5')];if(_0x532113[_0x474d('0xa5')][_0x474d('0xa6')]){delete _0x532113['headers'][_0x474d('0xa6')];}}if(_0x532113['headers'][_0x474d('0xa7')]){delete _0x532113[_0x474d('0xa5')]['content-type'];}return rp(_0x532113);})['then'](function(_0x16ba9f){if(_0x16ba9f){_0xd50741[_0x474d('0x23')](_0x16ba9f[_0x474d('0xa5')]);logger[_0x474d('0x69')](_0x16ba9f[_0x474d('0x93')]);return _0xd50741['status'](_0x16ba9f[_0x474d('0xa8')])[_0x474d('0x2f')](_0x16ba9f[_0x474d('0x93')]);}else{return _0xd50741[_0x474d('0x1b')](0xc8);}})['catch'](handleError(_0xd50741,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 27fe971..510bd89 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 _0x5334=['../../mysqldb','Plugin','setMaxListeners','save','remove','hasOwnProperty','events'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x5334,0x84));var _0x4533=function(_0x3bab2a,_0x51d57a){_0x3bab2a=_0x3bab2a-0x0;var _0x266b22=_0x5334[_0x3bab2a];return _0x266b22;};'use strict';var EventEmitter=require(_0x4533('0x0'));var Plugin=require(_0x4533('0x1'))['db'][_0x4533('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x4533('0x3')](0x0);var events={'afterCreate':_0x4533('0x4'),'afterUpdate':'update','afterDestroy':_0x4533('0x5')};function emitEvent(_0x5176b5){return function(_0x42184d,_0x11ce61,_0x5cbca4){PluginEvents['emit'](_0x5176b5+':'+_0x42184d['id'],_0x42184d);PluginEvents['emit'](_0x5176b5,_0x42184d);_0x5cbca4(null);};}for(var e in events){if(events[_0x4533('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x9a96=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x9a96,0xd0));var _0x69a9=function(_0x10f998,_0x32322d){_0x10f998=_0x10f998-0x0;var _0x4b2149=_0x9a96[_0x10f998];return _0x4b2149;};'use strict';var EventEmitter=require(_0x69a9('0x0'));var Plugin=require(_0x69a9('0x1'))['db'][_0x69a9('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x69a9('0x3')](0x0);var events={'afterCreate':_0x69a9('0x4'),'afterUpdate':_0x69a9('0x5'),'afterDestroy':_0x69a9('0x6')};function emitEvent(_0x6c91e5){return function(_0x303516,_0x2480e1,_0xb7ac87){PluginEvents[_0x69a9('0x7')](_0x6c91e5+':'+_0x303516['id'],_0x303516);PluginEvents['emit'](_0x6c91e5,_0x303516);_0xb7ac87(null);};}for(var e in events){if(events[_0x69a9('0x8')](e)){var event=events[e];Plugin[_0x69a9('0x9')](e,emitEvent(event));}}module[_0x69a9('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index daa6169..99951a2 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 _0xe9e7=['../../config/environment','./plugin.attributes','define','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x20e06e,_0x15a44a){var _0x2b2387=function(_0x590bc5){while(--_0x590bc5){_0x20e06e['push'](_0x20e06e['shift']());}};_0x2b2387(++_0x15a44a);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0xc99073,_0x34ca58){_0xc99073=_0xc99073-0x0;var _0x21fdb4=_0xe9e7[_0xc99073];return _0x21fdb4;};'use strict';var _=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var logger=require(_0x7e9e('0x2'))('api');var moment=require(_0x7e9e('0x3'));var BPromise=require(_0x7e9e('0x4'));var rp=require(_0x7e9e('0x5'));var fs=require('fs');var path=require(_0x7e9e('0x6'));var rimraf=require(_0x7e9e('0x7'));var config=require(_0x7e9e('0x8'));var attributes=require(_0x7e9e('0x9'));module['exports']=function(_0x319f70,_0x134fac){return _0x319f70[_0x7e9e('0xa')]('Plugin',attributes,{'tableName':_0x7e9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4726=['define','Plugin','plugins','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x1a05c8,_0x115997){var _0x29f18d=function(_0xe0b024){while(--_0xe0b024){_0x1a05c8['push'](_0x1a05c8['shift']());}};_0x29f18d(++_0x115997);}(_0x4726,0xf3));var _0x6472=function(_0x2589c8,_0x2f0336){_0x2589c8=_0x2589c8-0x0;var _0x130534=_0x4726[_0x2589c8];return _0x130534;};'use strict';var _=require(_0x6472('0x0'));var util=require(_0x6472('0x1'));var logger=require(_0x6472('0x2'))('api');var moment=require(_0x6472('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6472('0x4'));var rimraf=require(_0x6472('0x5'));var config=require(_0x6472('0x6'));var attributes=require(_0x6472('0x7'));module[_0x6472('0x8')]=function(_0x47e6e4,_0x5d784d){return _0x47e6e4[_0x6472('0x9')](_0x6472('0xa'),attributes,{'tableName':_0x6472('0xb'),'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 d62f7fb..df7e2ed 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 _0x0f7f=['catch','CreatePlugin','Plugin','create','body','options','raw','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0f7f,0x1cf));var _0xf0f7=function(_0x42fe79,_0x5828b0){_0x42fe79=_0x42fe79-0x0;var _0x54ba61=_0x0f7f[_0x42fe79];return _0x54ba61;};'use strict';var _=require(_0xf0f7('0x0'));var util=require('util');var moment=require(_0xf0f7('0x1'));var BPromise=require('bluebird');var rs=require(_0xf0f7('0x2'));var fs=require('fs');var Redis=require(_0xf0f7('0x3'));var db=require(_0xf0f7('0x4'))['db'];var utils=require(_0xf0f7('0x5'));var logger=require('../../config/logger')(_0xf0f7('0x6'));var config=require(_0xf0f7('0x7'));var jayson=require(_0xf0f7('0x8'));var client=jayson[_0xf0f7('0x9')][_0xf0f7('0xa')]({'port':0x232a});config['redis']=_[_0xf0f7('0xb')](config[_0xf0f7('0xc')],{'host':_0xf0f7('0xd'),'port':0x18eb});var socket=require(_0xf0f7('0xe'))(new Redis(config[_0xf0f7('0xc')]));require(_0xf0f7('0xf'))[_0xf0f7('0x10')](socket);function respondWithRpcPromise(_0x5e4ac8,_0x9c72f2,_0x474ed1){return new BPromise(function(_0x3b8e6f,_0x89e84c){return client[_0xf0f7('0x11')](_0x5e4ac8,_0x474ed1)['then'](function(_0x683510){logger['info'](_0xf0f7('0x12'),_0x9c72f2,_0xf0f7('0x13'));logger[_0xf0f7('0x14')](_0xf0f7('0x15'),_0x9c72f2,_0xf0f7('0x13'),JSON[_0xf0f7('0x16')](_0x683510));if(_0x683510[_0xf0f7('0x17')]){if(_0x683510['error'][_0xf0f7('0x18')]===0x1f4){logger['error'](_0xf0f7('0x12'),_0x9c72f2,_0x683510[_0xf0f7('0x17')][_0xf0f7('0x19')]);return _0x89e84c(_0x683510[_0xf0f7('0x17')][_0xf0f7('0x19')]);}logger[_0xf0f7('0x17')](_0xf0f7('0x12'),_0x9c72f2,_0x683510['error']['message']);return _0x3b8e6f(_0x683510[_0xf0f7('0x17')][_0xf0f7('0x19')]);}else{logger['info'](_0xf0f7('0x12'),_0x9c72f2,_0xf0f7('0x13'));_0x3b8e6f(_0x683510[_0xf0f7('0x1a')][_0xf0f7('0x19')]);}})[_0xf0f7('0x1b')](function(_0x36e829){logger['error'](_0xf0f7('0x12'),_0x9c72f2,_0x36e829);_0x89e84c(_0x36e829);});});}exports[_0xf0f7('0x1c')]=function(_0x4e74b3){var _0x988db3=this;return new Promise(function(_0x389713,_0x46bcd1){return db[_0xf0f7('0x1d')][_0xf0f7('0x1e')](_0x4e74b3[_0xf0f7('0x1f')],{'raw':_0x4e74b3[_0xf0f7('0x20')]?_0x4e74b3[_0xf0f7('0x20')][_0xf0f7('0x21')]===undefined?!![]:![]:!![]})[_0xf0f7('0x22')](function(_0x3cf22f){logger['info'](_0xf0f7('0x1c'),_0x4e74b3);logger[_0xf0f7('0x14')](_0xf0f7('0x1c'),_0x4e74b3,JSON[_0xf0f7('0x16')](_0x3cf22f));_0x389713(_0x3cf22f);})[_0xf0f7('0x1b')](function(_0x25ea5d){logger[_0xf0f7('0x17')](_0xf0f7('0x1c'),_0x25ea5d['message'],_0x4e74b3);_0x46bcd1(_0x988db3[_0xf0f7('0x17')](0x1f4,_0x25ea5d['message']));});});}; \ No newline at end of file +var _0x30f7=['rpc','../../config/environment','jayson/promise','redis','localhost','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','then','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b8b98,_0x178c88){var _0x1fb023=function(_0x53aa9b){while(--_0x53aa9b){_0x4b8b98['push'](_0x4b8b98['shift']());}};_0x1fb023(++_0x178c88);}(_0x30f7,0x8b));var _0x730f=function(_0x294827,_0xfb1711){_0x294827=_0x294827-0x0;var _0x54e53e=_0x30f7[_0x294827];return _0x54e53e;};'use strict';var _=require(_0x730f('0x0'));var util=require(_0x730f('0x1'));var moment=require('moment');var BPromise=require(_0x730f('0x2'));var rs=require(_0x730f('0x3'));var fs=require('fs');var Redis=require(_0x730f('0x4'));var db=require(_0x730f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x730f('0x6'));var config=require(_0x730f('0x7'));var jayson=require(_0x730f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x730f('0x9')]=_['defaults'](config['redis'],{'host':_0x730f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x730f('0xb'))[_0x730f('0xc')](socket);function respondWithRpcPromise(_0x34e44e,_0x10aba2,_0x506bfc){return new BPromise(function(_0x1f841d,_0x5b29a9){return client[_0x730f('0xd')](_0x34e44e,_0x506bfc)['then'](function(_0x2b6179){logger[_0x730f('0xe')](_0x730f('0xf'),_0x10aba2,_0x730f('0x10'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x10aba2,_0x730f('0x10'),JSON[_0x730f('0x11')](_0x2b6179));if(_0x2b6179[_0x730f('0x12')]){if(_0x2b6179[_0x730f('0x12')][_0x730f('0x13')]===0x1f4){logger[_0x730f('0x12')](_0x730f('0xf'),_0x10aba2,_0x2b6179[_0x730f('0x12')][_0x730f('0x14')]);return _0x5b29a9(_0x2b6179[_0x730f('0x12')][_0x730f('0x14')]);}logger[_0x730f('0x12')](_0x730f('0xf'),_0x10aba2,_0x2b6179[_0x730f('0x12')][_0x730f('0x14')]);return _0x1f841d(_0x2b6179[_0x730f('0x12')]['message']);}else{logger['info'](_0x730f('0xf'),_0x10aba2,_0x730f('0x10'));_0x1f841d(_0x2b6179[_0x730f('0x15')][_0x730f('0x14')]);}})[_0x730f('0x16')](function(_0x9cc59c){logger[_0x730f('0x12')](_0x730f('0xf'),_0x10aba2,_0x9cc59c);_0x5b29a9(_0x9cc59c);});});}exports[_0x730f('0x17')]=function(_0x3ed495){var _0x15aa43=this;return new Promise(function(_0x50ff8e,_0x1a349c){return db[_0x730f('0x18')][_0x730f('0x19')](_0x3ed495['body'],{'raw':_0x3ed495['options']?_0x3ed495[_0x730f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x730f('0x1b')](function(_0x13e2bc){logger[_0x730f('0xe')](_0x730f('0x17'),_0x3ed495);logger[_0x730f('0x1c')]('CreatePlugin',_0x3ed495,JSON[_0x730f('0x11')](_0x13e2bc));_0x50ff8e(_0x13e2bc);})[_0x730f('0x16')](function(_0x27a09c){logger[_0x730f('0x12')]('CreatePlugin',_0x27a09c[_0x730f('0x14')],_0x3ed495);_0x1a349c(_0x15aa43[_0x730f('0x12')](0x1f4,_0x27a09c['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index be87fbf..e5b9944 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 _0xc29d=['./plugin.events','remove','update','emit','removeListener','register','length','plugin:'];(function(_0x26b53f,_0x528724){var _0x4dda26=function(_0x5acf06){while(--_0x5acf06){_0x26b53f['push'](_0x26b53f['shift']());}};_0x4dda26(++_0x528724);}(_0xc29d,0xf0));var _0xdc29=function(_0x18e83b,_0x25367c){_0x18e83b=_0x18e83b-0x0;var _0x4c6839=_0xc29d[_0x18e83b];return _0x4c6839;};'use strict';var PluginEvents=require(_0xdc29('0x0'));var events=['save',_0xdc29('0x1'),_0xdc29('0x2')];function createListener(_0xb918db,_0x46693a){return function(_0x3c5604){_0x46693a[_0xdc29('0x3')](_0xb918db,_0x3c5604);};}function removeListener(_0x439a45,_0x566a6c){return function(){PluginEvents[_0xdc29('0x4')](_0x439a45,_0x566a6c);};}exports[_0xdc29('0x5')]=function(_0x5e1144){for(var _0x3e4818=0x0,_0x425cc3=events[_0xdc29('0x6')];_0x3e4818<_0x425cc3;_0x3e4818++){var _0x244cf8=events[_0x3e4818];var _0xf3f142=createListener(_0xdc29('0x7')+_0x244cf8,_0x5e1144);PluginEvents['on'](_0x244cf8,_0xf3f142);}}; \ No newline at end of file +var _0xbe16=['./plugin.events','save','remove','update','removeListener','register','length','plugin:'];(function(_0x1b89be,_0x55ceec){var _0x55f150=function(_0xbf29fb){while(--_0xbf29fb){_0x1b89be['push'](_0x1b89be['shift']());}};_0x55f150(++_0x55ceec);}(_0xbe16,0x120));var _0x6be1=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xbe16[_0x2e4e19];return _0x9ba20b;};'use strict';var PluginEvents=require(_0x6be1('0x0'));var events=[_0x6be1('0x1'),_0x6be1('0x2'),_0x6be1('0x3')];function createListener(_0x5b9ba7,_0x4137f8){return function(_0x2029b9){_0x4137f8['emit'](_0x5b9ba7,_0x2029b9);};}function removeListener(_0x47052f,_0x38d8c1){return function(){PluginEvents[_0x6be1('0x4')](_0x47052f,_0x38d8c1);};}exports[_0x6be1('0x5')]=function(_0x562c1c){for(var _0x389eb2=0x0,_0x501c92=events[_0x6be1('0x6')];_0x389eb2<_0x501c92;_0x389eb2++){var _0x26061b=events[_0x389eb2];var _0x531cee=createListener(_0x6be1('0x7')+_0x26061b,_0x562c1c);PluginEvents['on'](_0x26061b,_0x531cee);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 146bc9e..071ef35 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(_0x331b37,_0x5a358a){var _0x17fc15=function(_0x5e81ac){while(--_0x5e81ac){_0x331b37['push'](_0x331b37['shift']());}};_0x17fc15(++_0x5a358a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x332bd3,_0x519304){var _0x51dd2c=function(_0x44753f){while(--_0x44753f){_0x332bd3['push'](_0x332bd3['shift']());}};_0x51dd2c(++_0x519304);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 cad4139..573ab82 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 _0xb469=['motion2','show','create','body','join','../../files/plugins','chdir','dirname','start','dump','catch','status','update','restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','error','stack','name','send','info','index','list','then','reject','express'];(function(_0x23fed8,_0x24c710){var _0x2836c8=function(_0x238e9f){while(--_0x238e9f){_0x23fed8['push'](_0x23fed8['shift']());}};_0x2836c8(++_0x24c710);}(_0xb469,0x13b));var _0x9b46=function(_0x48c09f,_0x590ecf){_0x48c09f=_0x48c09f-0x0;var _0x564670=_0xb469[_0x48c09f];return _0x564670;};'use strict';var _=require(_0x9b46('0x0'));var pm2=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var path=require(_0x9b46('0x4'));var exec=require(_0x9b46('0x5'))[_0x9b46('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x31f853,_0x45322f){return function(_0x538fc4){if(!_0x538fc4){_0x31f853[_0x9b46('0x7')](0x194);;}return _0x538fc4;};}function respondWithResult(_0x405d1c,_0x50b49e){_0x50b49e=_0x50b49e||0xc8;return function(_0x1b2dd3){if(_0x1b2dd3){return _0x405d1c['status'](_0x50b49e)['json'](_0x1b2dd3);}return null;};}function handleError(_0x34c0de,_0x545b6c){_0x545b6c=_0x545b6c||0x1f4;return function(_0x402595){logger[_0x9b46('0x8')](_0x402595[_0x9b46('0x9')]);if(_0x402595['name']){delete _0x402595[_0x9b46('0xa')];}_0x34c0de['status'](_0x545b6c)[_0x9b46('0xb')](_0x402595);};}function execChildProcess(){return new BPromise(function(_0x568d9a,_0x2c29a7){exec('npm\x20install',function(_0x672157,_0x233b6b,_0x563de4){logger[_0x9b46('0xc')](_0x233b6b);logger[_0x9b46('0xc')](_0x563de4);if(_0x672157){logger['error'](_0x672157);return _0x2c29a7(_0x672157);}return _0x568d9a(_0x233b6b);});});}exports[_0x9b46('0xd')]=function(_0x2cfb35,_0x3d9618){return pm2[_0x9b46('0xe')]()[_0x9b46('0xf')](function(_0x35c5c1){if(_0x35c5c1){var _0x2136bc=_[_0x9b46('0x10')](_0x35c5c1,function(_0x3f2b28){return _0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x11')||_0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x12');});return{'rows':_0x2136bc,'count':_0x2136bc['length']};}return null;})['then'](respondWithResult(_0x3d9618,null))['catch'](handleError(_0x3d9618,null));};exports[_0x9b46('0x13')]=function(_0x5a380c,_0x29fec9){return pm2['describe'](_0x5a380c['params']['id'])[_0x9b46('0xf')](respondWithResult(_0x29fec9,null))['then'](handleEntityNotFound(_0x29fec9,null))['catch'](handleError(_0x29fec9,null));};exports[_0x9b46('0x14')]=function(_0x3a15cc,_0x5a0d25){if(_0x3a15cc[_0x9b46('0x15')][_0x9b46('0xa')]&&_0x3a15cc['body']['script']){var _0xbec2ea=path[_0x9b46('0x16')](__dirname,_0x9b46('0x17'),_0x3a15cc['body']['script']);var _0x2b3440=process['cwd']();process[_0x9b46('0x18')](path[_0x9b46('0x19')](_0xbec2ea));return execChildProcess()['then'](function(_0xadff19){process['chdir'](_0x2b3440);return pm2[_0x9b46('0x1a')]({'name':_0x3a15cc[_0x9b46('0x15')]['name'],'script':_0xbec2ea});})[_0x9b46('0xf')](function(_0x31ca63){pm2[_0x9b46('0x1b')]();return _0x31ca63[0x0];})[_0x9b46('0xf')](respondWithResult(_0x5a0d25,0xc9))[_0x9b46('0x1c')](handleError(_0x5a0d25,null));}else{return _0x5a0d25[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x9b46('0x1e')]=function(_0x3ac37e,_0x478105){if(_0x3ac37e[_0x9b46('0x15')]['id']){delete _0x3ac37e[_0x9b46('0x15')]['id'];}var _0x2a79a5={'online':_0x9b46('0x1f'),'stopped':'stop'};if(_0x2a79a5[_0x9b46('0x20')](_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')])){return pm2[_0x2a79a5[_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')]]](_0x3ac37e[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](respondWithResult(_0x478105,0xc8))[_0x9b46('0x1c')](handleError(_0x478105,null));}else{return _0x478105[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':_0x9b46('0x22')});}};exports['destroy']=function(_0x1f722d,_0x27f326){if(_0x1f722d[_0x9b46('0x15')]['id']){delete _0x1f722d[_0x9b46('0x15')]['id'];}if(_0x1f722d[_0x9b46('0x21')]['id']){return pm2[_0x9b46('0x23')](_0x1f722d[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](function(_0x3ab49a){pm2[_0x9b46('0x1b')]();return _0x3ab49a[0x0];})[_0x9b46('0xf')](respondWithResult(_0x27f326,null))['catch'](handleError(_0x27f326,null));}else{return _0x27f326[_0x9b46('0x1d')](0x1f4)['send']({'message':_0x9b46('0x24')});}}; \ No newline at end of file +var _0x2bc6=['json','error','stack','name','send','npm\x20install','info','then','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','bluebird','status'];(function(_0x34ae76,_0x4cd562){var _0x5325eb=function(_0x29406a){while(--_0x29406a){_0x34ae76['push'](_0x34ae76['shift']());}};_0x5325eb(++_0x4cd562);}(_0x2bc6,0x163));var _0x62bc=function(_0x1ada36,_0x1af61c){_0x1ada36=_0x1ada36-0x0;var _0x3f8918=_0x2bc6[_0x1ada36];return _0x3f8918;};'use strict';var _=require(_0x62bc('0x0'));var pm2=require(_0x62bc('0x1'));var logger=require(_0x62bc('0x2'))('api');var path=require('path');var exec=require('child_process')['exec'];var BPromise=require(_0x62bc('0x3'));function handleEntityNotFound(_0x576608,_0x2a1959){return function(_0x2b12de){if(!_0x2b12de){_0x576608['sendStatus'](0x194);;}return _0x2b12de;};}function respondWithResult(_0x3cce26,_0x450cb6){_0x450cb6=_0x450cb6||0xc8;return function(_0x40af10){if(_0x40af10){return _0x3cce26[_0x62bc('0x4')](_0x450cb6)[_0x62bc('0x5')](_0x40af10);}return null;};}function handleError(_0x3f625c,_0x5bedeb){_0x5bedeb=_0x5bedeb||0x1f4;return function(_0x441722){logger[_0x62bc('0x6')](_0x441722[_0x62bc('0x7')]);if(_0x441722[_0x62bc('0x8')]){delete _0x441722['name'];}_0x3f625c[_0x62bc('0x4')](_0x5bedeb)[_0x62bc('0x9')](_0x441722);};}function execChildProcess(){return new BPromise(function(_0x1e3a57,_0x546acc){exec(_0x62bc('0xa'),function(_0x22e6c8,_0x256784,_0x444910){logger[_0x62bc('0xb')](_0x256784);logger[_0x62bc('0xb')](_0x444910);if(_0x22e6c8){logger[_0x62bc('0x6')](_0x22e6c8);return _0x546acc(_0x22e6c8);}return _0x1e3a57(_0x256784);});});}exports['index']=function(_0x2a96ae,_0x28390b){return pm2['list']()[_0x62bc('0xc')](function(_0x10230f){if(_0x10230f){var _0xc14ac9=_['reject'](_0x10230f,function(_0x263424){return _0x263424[_0x62bc('0x8')]==='express'||_0x263424['name']===_0x62bc('0xd');});return{'rows':_0xc14ac9,'count':_0xc14ac9[_0x62bc('0xe')]};}return null;})['then'](respondWithResult(_0x28390b,null))[_0x62bc('0xf')](handleError(_0x28390b,null));};exports[_0x62bc('0x10')]=function(_0xc1211c,_0x1e2405){return pm2[_0x62bc('0x11')](_0xc1211c[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](respondWithResult(_0x1e2405,null))[_0x62bc('0xc')](handleEntityNotFound(_0x1e2405,null))[_0x62bc('0xf')](handleError(_0x1e2405,null));};exports['create']=function(_0x5dd6f0,_0x2b2e5f){if(_0x5dd6f0[_0x62bc('0x13')][_0x62bc('0x8')]&&_0x5dd6f0['body'][_0x62bc('0x14')]){var _0x495f99=path[_0x62bc('0x15')](__dirname,_0x62bc('0x16'),_0x5dd6f0[_0x62bc('0x13')]['script']);var _0x3b8644=process[_0x62bc('0x17')]();process[_0x62bc('0x18')](path[_0x62bc('0x19')](_0x495f99));return execChildProcess()[_0x62bc('0xc')](function(_0x3b2eb0){process['chdir'](_0x3b8644);return pm2[_0x62bc('0x1a')]({'name':_0x5dd6f0[_0x62bc('0x13')][_0x62bc('0x8')],'script':_0x495f99});})[_0x62bc('0xc')](function(_0x117ebc){pm2['dump']();return _0x117ebc[0x0];})['then'](respondWithResult(_0x2b2e5f,0xc9))[_0x62bc('0xf')](handleError(_0x2b2e5f,null));}else{return _0x2b2e5f['status'](0x1f4)[_0x62bc('0x9')]({'message':_0x62bc('0x1b')});}};exports[_0x62bc('0x1c')]=function(_0x4a72d6,_0x3d55df){if(_0x4a72d6[_0x62bc('0x13')]['id']){delete _0x4a72d6[_0x62bc('0x13')]['id'];}var _0x5c03ac={'online':'restart','stopped':_0x62bc('0x1d')};if(_0x5c03ac[_0x62bc('0x1e')](_0x4a72d6[_0x62bc('0x13')]['status'])){return pm2[_0x5c03ac[_0x4a72d6[_0x62bc('0x13')][_0x62bc('0x4')]]](_0x4a72d6[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](respondWithResult(_0x3d55df,0xc8))['catch'](handleError(_0x3d55df,null));}else{return _0x3d55df[_0x62bc('0x4')](0x1f4)['send']({'message':_0x62bc('0x1f')});}};exports[_0x62bc('0x20')]=function(_0x32048f,_0x2dd7fd){if(_0x32048f[_0x62bc('0x13')]['id']){delete _0x32048f[_0x62bc('0x13')]['id'];}if(_0x32048f[_0x62bc('0x12')]['id']){return pm2[_0x62bc('0x21')](_0x32048f[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](function(_0x156f95){pm2[_0x62bc('0x22')]();return _0x156f95[0x0];})[_0x62bc('0xc')](respondWithResult(_0x2dd7fd,null))[_0x62bc('0xf')](handleError(_0x2dd7fd,null));}else{return _0x2dd7fd[_0x62bc('0x4')](0x1f4)[_0x62bc('0x9')]({'message':_0x62bc('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f023e79..c6f6a9f 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 _0x557f=['exports','Router','./realtime.controller','get','isAuthenticated','getAgents','/queues'];(function(_0x561226,_0x46623a){var _0x512604=function(_0x499718){while(--_0x499718){_0x561226['push'](_0x561226['shift']());}};_0x512604(++_0x46623a);}(_0x557f,0xbe));var _0xf557=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x557f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0xf557('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xf557('0x1'));router[_0xf557('0x2')]('/agents',auth[_0xf557('0x3')](),controller[_0xf557('0x4')]);router[_0xf557('0x2')](_0xf557('0x5'),auth[_0xf557('0x3')](),controller['getQueues']);module[_0xf557('0x6')]=router; \ No newline at end of file +var _0x606f=['isAuthenticated','getAgents','/queues','getQueues','exports','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x606f,0x13b));var _0xf606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x606f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0xf606('0x0')]();var auth=require(_0xf606('0x1'));var controller=require(_0xf606('0x2'));router[_0xf606('0x3')](_0xf606('0x4'),auth[_0xf606('0x5')](),controller[_0xf606('0x6')]);router[_0xf606('0x3')](_0xf606('0x7'),auth[_0xf606('0x5')](),controller[_0xf606('0x8')]);module[_0xf606('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 4a06b98..a6600ce 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 _0xfb8b=['status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','resolve','then','format','Channel\x20parameter\x20%s\x20is\x20invalid','channel','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getSortedAgentsIdsByStatus','map','User','key','role','agent','raw','sequelize','literal','FIELD(id,','forEach','*pause','push','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','rows','filterAgentAttributes','getAgentStatus','includes','pause','voice','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','pick','catch','getQueues','isValidChannel','startCase','rawAttributes','fieldName','name','type','dialActive','getOptions','outbound','QueueCampaigns','Queues','filter','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/queues','../../config/utils','../../errors/api','APIBadRequestError','handleError','undefined','limit','count','offset'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0xfb8b,0x9e));var _0xbfb8=function(_0x152a13,_0x2fc185){_0x152a13=_0x152a13-0x0;var _0x2c640d=_0xfb8b[_0x152a13];return _0x2c640d;};'use strict';var _=require(_0xbfb8('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require(_0xbfb8('0x1'));var qs=require('../../components/parsers/qs');var utils=require(_0xbfb8('0x2'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xbfb8('0x3'))[_0xbfb8('0x4')];var APIHandleError=require('../../errors/api')[_0xbfb8('0x5')];function respondWithFilteredResult(_0x2f6bdb,_0x4ce9ff){return function(_0x5c8025){if(_0x5c8025){var _0x2b9cb4=typeof _0x4ce9ff['offset']===_0xbfb8('0x6')&&typeof _0x4ce9ff[_0xbfb8('0x7')]===_0xbfb8('0x6');var _0x5a4757=_0x5c8025[_0xbfb8('0x8')];var _0x11fbee=_0x2b9cb4?0x0:_0x4ce9ff[_0xbfb8('0x9')];var _0x111d13=_0x2b9cb4?_0x5c8025[_0xbfb8('0x8')]:_0x4ce9ff[_0xbfb8('0x9')]+_0x4ce9ff[_0xbfb8('0x7')];var _0x58b1b0;if(_0x111d13>=_0x5a4757){_0x111d13=_0x5a4757;_0x58b1b0=0xc8;}else{_0x58b1b0=0xce;}_0x2f6bdb[_0xbfb8('0xa')](_0x58b1b0);return _0x2f6bdb[_0xbfb8('0xb')](_0xbfb8('0xc'),_0x11fbee+'-'+_0x111d13+'/'+_0x5a4757)[_0xbfb8('0xd')](_0x5c8025);}return null;};}exports[_0xbfb8('0xe')]=function(_0x469a03,_0x218a5d){var _0x107c15={'count':0x0,'rows':[]};var _0x27687e={};var _0x33c776;var _0x39ee2e=utils[_0xbfb8('0xf')]();var _0x307a40;var _0x477d9d;var _0x39221e=_0x469a03[_0xbfb8('0x10')][_0xbfb8('0x11')];var _0x598eaa=_0x469a03[_0xbfb8('0x10')]['globalStatusFilter'];var _0x27cc52=_0x469a03[_0xbfb8('0x10')][_0xbfb8('0x12')];var _0x347883=_0x598eaa==='pause'||_0x598eaa==='*pause'?!![]:![];var _0x279485=[];var _0x277c13;var _0x34f5be;Promise[_0xbfb8('0x13')]()[_0xbfb8('0x14')](function(){if(_0x469a03['query']['channel']){if(!utils['isValidChannel'](_0x469a03[_0xbfb8('0x10')]['channel'])){throw new APIBadRequestError(util[_0xbfb8('0x15')](_0xbfb8('0x16'),_0x469a03[_0xbfb8('0x10')][_0xbfb8('0x17')]));}_0x33c776=_0x469a03[_0xbfb8('0x10')][_0xbfb8('0x17')][_0xbfb8('0x18')]();}if(!_0x469a03['query'][_0xbfb8('0x19')]||!_0x469a03[_0xbfb8('0x10')][_0xbfb8('0x19')]['includes'](_0xbfb8('0x1a'))){_0x469a03[_0xbfb8('0x10')][_0xbfb8('0x19')]=rta[_0xbfb8('0x1b')](_0x469a03['query']['sort']);return;}var _0x225ff5=rta[_0xbfb8('0x1c')](_0x469a03['query'][_0xbfb8('0x19')]);_0x469a03[_0xbfb8('0x10')]['sort']=_0x225ff5[_0xbfb8('0x1d')][_0xbfb8('0x1e')](',');_0x277c13=_0x225ff5[_0xbfb8('0x1f')];})[_0xbfb8('0x14')](function(){if(!_0x39221e){return[];}return rta['getAgentIdsByQueues'](_0x39221e,_0x33c776);})[_0xbfb8('0x14')](function(_0x41d235){_0x279485=_0x41d235;return rta['getRealtimeAgents']();})[_0xbfb8('0x14')](function(_0x50d393){_0x477d9d=_0x50d393['rows'];if((!_0x598eaa||_0x347883)&&!_0x277c13){return _0x279485;}if(_0x277c13&&!_0x598eaa){return rta[_0xbfb8('0x20')](_0x477d9d,_0x279485,_0x277c13);}else{return rta['getAgentIdsByStatus'](_0x477d9d,_0x279485,_0x598eaa);}})[_0xbfb8('0x14')](function(_0x5641f2){_0x279485=_0x5641f2;var _0xe651ce=![];if(_0x279485['length']===0x0){if(_0x39221e||_0x598eaa){_0xe651ce=!![];}if(_0x347883){_0xe651ce=![];}}if(_0xe651ce){return _0x107c15;}var _0x52328d=_[_0xbfb8('0x21')](db[_0xbfb8('0x22')]['rawAttributes'],function(_0x455eb1){return{'name':_0x455eb1['fieldName'],'type':_0x455eb1['type'][_0xbfb8('0x23')]};});_0x469a03[_0xbfb8('0x10')][_0xbfb8('0x24')]=_0xbfb8('0x25');_0x27687e=qs['getOptions'](_0x52328d,_0x469a03);_0x27687e[_0xbfb8('0x26')]=!![];var _0x564990=[];if(_0x279485['length']>0x0){_0x564990['push']({'id':{'$in':_0x279485}});if(_0x277c13&&!_0x598eaa){_0x34f5be=[db[_0xbfb8('0x27')][_0xbfb8('0x28')](_0xbfb8('0x29')+_0x279485+')')];_0x27687e[_0xbfb8('0x1f')]=_0x34f5be;}}if(_0x347883){_0x39ee2e[_0xbfb8('0x2a')](function(_0x1ec8ce){var _0x34310f=!![];if(_0x598eaa===_0xbfb8('0x2b')&&_0x33c776!==_0x1ec8ce){_0x34310f=![];}_0x564990[_0xbfb8('0x2c')]({[_0x1ec8ce+_0xbfb8('0x2d')]:_0x34310f});});if(_0x27cc52){_0x564990[_0xbfb8('0x2c')]({'pauseType':_0x27cc52});}}else if(_0x598eaa){_0x39ee2e[_0xbfb8('0x2a')](function(_0x3e97f3){_0x564990[_0xbfb8('0x2c')]({[_0x3e97f3+'Pause']:![]});});}_0x27687e[_0xbfb8('0x2e')]=_[_0xbfb8('0x2f')](_0x27687e['where'],{'$and':_0x564990});if(_0x469a03[_0xbfb8('0x30')][_0xbfb8('0x24')]===_0xbfb8('0x30')){var _0x57746e={'params':{'id':_0x469a03['user'][_0xbfb8('0x31')]},'query':{'section':_0xbfb8('0x32'),'role':'agent','raw':!![],'ids':_0x279485,'customSorting':_0x34f5be}};if(_0x469a03[_0xbfb8('0x10')][_0xbfb8('0x33')]){_0x57746e['query'][_0xbfb8('0x33')]=!![];}if(_0x347883){_0x57746e[_0xbfb8('0x10')][_0xbfb8('0x34')]=_0x564990;}_0x57746e['query']=Object[_0xbfb8('0x35')](_0x57746e[_0xbfb8('0x10')],_['omit'](_0x469a03[_0xbfb8('0x10')],'id'));return db[_0xbfb8('0x36')][_0xbfb8('0x37')](_0x57746e);}return db[_0xbfb8('0x22')]['findAndCountAll'](_0x27687e);})[_0xbfb8('0x14')](function(_0x18d117){_0x107c15[_0xbfb8('0x8')]=_0x18d117[_0xbfb8('0x8')];_0x307a40=_0x18d117[_0xbfb8('0x38')];return _0x307a40[_0xbfb8('0x21')](function(_0x2c46a7){var _0x1de443=_['find'](_0x477d9d,['id',_0x2c46a7['id']]);if(_0x1de443){var _0x4e9baf=rta[_0xbfb8('0x39')](_0x1de443);_[_0xbfb8('0x2f')](_0x2c46a7,_0x4e9baf);}_0x2c46a7['globalStatus']=rta[_0xbfb8('0x3a')](_0x2c46a7);if(_0x2c46a7[_0xbfb8('0x1a')][_0xbfb8('0x3b')](_0xbfb8('0x3c'))){_0x39ee2e['forEach'](function(_0x550401){if(_0x2c46a7[_0x550401+_0xbfb8('0x2d')]){if(_0x550401===_0xbfb8('0x3d')){if(_0x2c46a7[_0xbfb8('0x3e')]!==_0xbfb8('0x3f')){_0x2c46a7[_0xbfb8('0x3e')]='pause';}}else{_0x2c46a7[_0x550401+_0xbfb8('0x40')]='pause';}}});}return _0x2c46a7;});})[_0xbfb8('0x14')](function(_0x20471a){if(!_0x277c13||_0x34f5be){return _0x20471a;}return rta['sortAgentsByStatus'](_0x20471a,_0x277c13);})[_0xbfb8('0x14')](function(_0x448494){var _0x379b5d=rta[_0xbfb8('0x41')]();_0x107c15['rows']=_0x448494[_0xbfb8('0x21')](function(_0x13b9ab){return _[_0xbfb8('0x42')](_0x13b9ab,_0x379b5d);});return _0x107c15;})[_0xbfb8('0x14')](respondWithFilteredResult(_0x218a5d,_0x27687e))[_0xbfb8('0x43')](APIHandleError(_0x218a5d));};exports[_0xbfb8('0x44')]=function(_0x1ee962,_0x17b153){var _0x3c1f05={'count':0x0,'rows':[]};var _0x4873d6={};var _0x1d4dea;var _0x32139b;var _0x5d3c66;Promise[_0xbfb8('0x13')]()[_0xbfb8('0x14')](function(){if(_0x1ee962[_0xbfb8('0x10')][_0xbfb8('0x17')]){if(!utils[_0xbfb8('0x45')](_0x1ee962[_0xbfb8('0x10')][_0xbfb8('0x17')])){throw new APIBadRequestError(util[_0xbfb8('0x15')](_0xbfb8('0x16'),_0x1ee962[_0xbfb8('0x10')][_0xbfb8('0x17')]));}_0x1d4dea=_0x1ee962['query'][_0xbfb8('0x17')][_0xbfb8('0x18')]();}var _0x5dfb40=_[_0xbfb8('0x46')](_0x1d4dea)+'Queue';var _0x3d8be=_[_0xbfb8('0x21')](db[_0x5dfb40][_0xbfb8('0x47')],function(_0xfc3eae){return{'name':_0xfc3eae[_0xbfb8('0x48')],'type':_0xfc3eae['type']['key']};});if(!_0x1ee962[_0xbfb8('0x10')]['fields']){var _0x3758c9=['id',_0xbfb8('0x49')];if(_0x1d4dea==='voice'){_0x3758c9[_0xbfb8('0x2c')](_0xbfb8('0x4a'));if(_0x1ee962[_0xbfb8('0x10')][_0xbfb8('0x4a')]==='outbound'){_0x3758c9[_0xbfb8('0x2c')]([_0xbfb8('0x4b'),'dialMethod']);}}_0x1ee962[_0xbfb8('0x10')][_0xbfb8('0x1d')]=_0x3758c9[_0xbfb8('0x1e')](',');}_0x4873d6=qs[_0xbfb8('0x4c')](_0x3d8be,_0x1ee962);if(_0x1ee962[_0xbfb8('0x30')][_0xbfb8('0x24')]===_0xbfb8('0x30')){var _0x497b82={'params':{'id':_0x1ee962[_0xbfb8('0x30')][_0xbfb8('0x31')]},'query':{'section':_0x1d4dea===_0xbfb8('0x3d')&&_0x1ee962[_0xbfb8('0x10')]['type']===_0xbfb8('0x4d')?_0xbfb8('0x4e'):_[_0xbfb8('0x46')](_0x1d4dea)+_0xbfb8('0x4f'),'type':_0x1ee962[_0xbfb8('0x10')]['type'],'nolimit':!![],'sort':'name','filter':_0x1ee962[_0xbfb8('0x10')][_0xbfb8('0x50')]}};_0x497b82[_0xbfb8('0x10')]=Object[_0xbfb8('0x35')](_0x497b82[_0xbfb8('0x10')],_0x1ee962[_0xbfb8('0x10')]);delete _0x497b82['query']['id'];return db[_0xbfb8('0x36')]['getResources'](_0x497b82);}return db[_0x5dfb40][_0xbfb8('0x51')](_0x4873d6);})[_0xbfb8('0x14')](function(_0x32c517){_0x3c1f05[_0xbfb8('0x8')]=_0x32c517[_0xbfb8('0x8')];_0x32139b=_0x32c517[_0xbfb8('0x38')];return rtq[_0xbfb8('0x52')](_0x1ee962,_0x1d4dea);})[_0xbfb8('0x14')](function(_0x3e2912){_0x5d3c66=_0x3e2912['rows'];return rtq[_0xbfb8('0x53')](_0x32139b,_0x5d3c66,_0x1d4dea,_0x1ee962[_0xbfb8('0x10')][_0xbfb8('0x4a')]);})[_0xbfb8('0x14')](function(_0x470a91){_0x3c1f05[_0xbfb8('0x38')]=_0x470a91;return _0x3c1f05;})[_0xbfb8('0x14')](respondWithFilteredResult(_0x17b153,_0x4873d6))[_0xbfb8('0x43')](APIHandleError(_0x17b153));}; \ No newline at end of file +var _0x547c=['resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName','type','role','agent','getOptions','push','FIELD(id,','Pause','forEach','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','getResources','findAndCountAll','find','filterAgentAttributes','globalStatus','pause','voice','voiceStatus','talking','pick','catch','getQueues','startCase','Queue','outbound','dialActive','dialMethod','QueueCampaigns','name','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','limit','undefined','count','status','set','json','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','*pause'];(function(_0x3b20ba,_0x2b2544){var _0x14f61d=function(_0x597073){while(--_0x597073){_0x3b20ba['push'](_0x3b20ba['shift']());}};_0x14f61d(++_0x2b2544);}(_0x547c,0x1d5));var _0xc547=function(_0x2c6889,_0x434f9d){_0x2c6889=_0x2c6889-0x0;var _0x51f448=_0x547c[_0x2c6889];return _0x51f448;};'use strict';var _=require(_0xc547('0x0'));var util=require(_0xc547('0x1'));var rta=require(_0xc547('0x2'));var rtq=require(_0xc547('0x3'));var qs=require(_0xc547('0x4'));var utils=require(_0xc547('0x5'));var db=require(_0xc547('0x6'))['db'];var APIBadRequestError=require(_0xc547('0x7'))[_0xc547('0x8')];var APIHandleError=require(_0xc547('0x7'))[_0xc547('0x9')];function respondWithFilteredResult(_0x41b1e2,_0x5316ab){return function(_0x4800dc){if(_0x4800dc){var _0x27f310=typeof _0x5316ab[_0xc547('0xa')]==='undefined'&&typeof _0x5316ab[_0xc547('0xb')]===_0xc547('0xc');var _0x45bbfc=_0x4800dc[_0xc547('0xd')];var _0x502549=_0x27f310?0x0:_0x5316ab['offset'];var _0x20eac6=_0x27f310?_0x4800dc[_0xc547('0xd')]:_0x5316ab['offset']+_0x5316ab['limit'];var _0x37596c;if(_0x20eac6>=_0x45bbfc){_0x20eac6=_0x45bbfc;_0x37596c=0xc8;}else{_0x37596c=0xce;}_0x41b1e2[_0xc547('0xe')](_0x37596c);return _0x41b1e2[_0xc547('0xf')]('Content-Range',_0x502549+'-'+_0x20eac6+'/'+_0x45bbfc)[_0xc547('0x10')](_0x4800dc);}return null;};}exports['getAgents']=function(_0x5731bf,_0x1103dd){var _0x562880={'count':0x0,'rows':[]};var _0x11f633={};var _0x3a06ba;var _0x8dfd96=utils[_0xc547('0x11')]();var _0x17801f;var _0x48266f;var _0x12cd70=_0x5731bf['query'][_0xc547('0x12')];var _0x319075=_0x5731bf[_0xc547('0x13')][_0xc547('0x14')];var _0xc54960=_0x5731bf[_0xc547('0x13')][_0xc547('0x15')];var _0x5d971d=_0x319075==='pause'||_0x319075===_0xc547('0x16')?!![]:![];var _0x43ef12=[];var _0x4b5aa7;var _0x380c17;Promise[_0xc547('0x17')]()['then'](function(){if(_0x5731bf[_0xc547('0x13')][_0xc547('0x18')]){if(!utils[_0xc547('0x19')](_0x5731bf[_0xc547('0x13')][_0xc547('0x18')])){throw new APIBadRequestError(util[_0xc547('0x1a')](_0xc547('0x1b'),_0x5731bf['query'][_0xc547('0x18')]));}_0x3a06ba=_0x5731bf[_0xc547('0x13')][_0xc547('0x18')][_0xc547('0x1c')]();}if(!_0x5731bf[_0xc547('0x13')]['sort']||!_0x5731bf['query'][_0xc547('0x1d')][_0xc547('0x1e')]('globalStatus')){_0x5731bf[_0xc547('0x13')][_0xc547('0x1d')]=rta[_0xc547('0x1f')](_0x5731bf[_0xc547('0x13')][_0xc547('0x1d')]);return;}var _0x7995ac=rta[_0xc547('0x20')](_0x5731bf[_0xc547('0x13')][_0xc547('0x1d')]);_0x5731bf[_0xc547('0x13')][_0xc547('0x1d')]=_0x7995ac[_0xc547('0x21')][_0xc547('0x22')](',');_0x4b5aa7=_0x7995ac[_0xc547('0x23')];})[_0xc547('0x24')](function(){if(!_0x12cd70){return[];}return rta[_0xc547('0x25')](_0x12cd70,_0x3a06ba);})[_0xc547('0x24')](function(_0x162d61){_0x43ef12=_0x162d61;return rta[_0xc547('0x26')]();})['then'](function(_0x3c4945){_0x48266f=_0x3c4945[_0xc547('0x27')];if((!_0x319075||_0x5d971d)&&!_0x4b5aa7){return _0x43ef12;}if(_0x4b5aa7&&!_0x319075){return rta[_0xc547('0x28')](_0x48266f,_0x43ef12,_0x4b5aa7);}else{return rta[_0xc547('0x29')](_0x48266f,_0x43ef12,_0x319075);}})[_0xc547('0x24')](function(_0x694394){_0x43ef12=_0x694394;var _0x1c9cf4=![];if(_0x43ef12[_0xc547('0x2a')]===0x0){if(_0x12cd70||_0x319075){_0x1c9cf4=!![];}if(_0x5d971d){_0x1c9cf4=![];}}if(_0x1c9cf4){return _0x562880;}var _0x713c1e=_[_0xc547('0x2b')](db['User'][_0xc547('0x2c')],function(_0x9bf4ce){return{'name':_0x9bf4ce[_0xc547('0x2d')],'type':_0x9bf4ce[_0xc547('0x2e')]['key']};});_0x5731bf[_0xc547('0x13')][_0xc547('0x2f')]=_0xc547('0x30');_0x11f633=qs[_0xc547('0x31')](_0x713c1e,_0x5731bf);_0x11f633['raw']=!![];var _0x27ba9a=[];if(_0x43ef12[_0xc547('0x2a')]>0x0){_0x27ba9a[_0xc547('0x32')]({'id':{'$in':_0x43ef12}});if(_0x4b5aa7&&!_0x319075){_0x380c17=[db['sequelize']['literal'](_0xc547('0x33')+_0x43ef12+')')];_0x11f633[_0xc547('0x23')]=_0x380c17;}}if(_0x5d971d){_0x8dfd96['forEach'](function(_0x5c3114){var _0x4dc5a8=!![];if(_0x319075===_0xc547('0x16')&&_0x3a06ba!==_0x5c3114){_0x4dc5a8=![];}_0x27ba9a[_0xc547('0x32')]({[_0x5c3114+_0xc547('0x34')]:_0x4dc5a8});});if(_0xc54960){_0x27ba9a[_0xc547('0x32')]({'pauseType':_0xc54960});}}else if(_0x319075){_0x8dfd96[_0xc547('0x35')](function(_0x26db91){_0x27ba9a[_0xc547('0x32')]({[_0x26db91+_0xc547('0x34')]:![]});});}_0x11f633[_0xc547('0x36')]=_[_0xc547('0x37')](_0x11f633[_0xc547('0x36')],{'$and':_0x27ba9a});if(_0x5731bf['user'][_0xc547('0x2f')]==='user'){var _0xc71315={'params':{'id':_0x5731bf[_0xc547('0x38')][_0xc547('0x39')]},'query':{'section':_0xc547('0x3a'),'role':'agent','raw':!![],'ids':_0x43ef12,'customSorting':_0x380c17}};if(_0x5731bf['query'][_0xc547('0x3b')]){_0xc71315[_0xc547('0x13')][_0xc547('0x3b')]=!![];}if(_0x5d971d){_0xc71315[_0xc547('0x13')][_0xc547('0x3c')]=_0x27ba9a;}_0xc71315[_0xc547('0x13')]=Object[_0xc547('0x3d')](_0xc71315[_0xc547('0x13')],_['omit'](_0x5731bf[_0xc547('0x13')],'id'));return db['UserProfile'][_0xc547('0x3e')](_0xc71315);}return db['User'][_0xc547('0x3f')](_0x11f633);})[_0xc547('0x24')](function(_0x3ca217){_0x562880['count']=_0x3ca217['count'];_0x17801f=_0x3ca217['rows'];return _0x17801f[_0xc547('0x2b')](function(_0x4ebe84){var _0x45945e=_[_0xc547('0x40')](_0x48266f,['id',_0x4ebe84['id']]);if(_0x45945e){var _0x77341d=rta[_0xc547('0x41')](_0x45945e);_[_0xc547('0x37')](_0x4ebe84,_0x77341d);}_0x4ebe84[_0xc547('0x42')]=rta['getAgentStatus'](_0x4ebe84);if(_0x4ebe84['globalStatus'][_0xc547('0x1e')](_0xc547('0x43'))){_0x8dfd96[_0xc547('0x35')](function(_0x409328){if(_0x4ebe84[_0x409328+'Pause']){if(_0x409328===_0xc547('0x44')){if(_0x4ebe84[_0xc547('0x45')]!==_0xc547('0x46')){_0x4ebe84[_0xc547('0x45')]='pause';}}else{_0x4ebe84[_0x409328+'Status']=_0xc547('0x43');}}});}return _0x4ebe84;});})[_0xc547('0x24')](function(_0x2a690a){if(!_0x4b5aa7||_0x380c17){return _0x2a690a;}return rta['sortAgentsByStatus'](_0x2a690a,_0x4b5aa7);})[_0xc547('0x24')](function(_0x53e9fd){var _0x4b4c09=rta['getRealtimeAgentsQueryFields']();_0x562880['rows']=_0x53e9fd[_0xc547('0x2b')](function(_0x305d81){return _[_0xc547('0x47')](_0x305d81,_0x4b4c09);});return _0x562880;})['then'](respondWithFilteredResult(_0x1103dd,_0x11f633))[_0xc547('0x48')](APIHandleError(_0x1103dd));};exports[_0xc547('0x49')]=function(_0x143992,_0x2e9d27){var _0x33872f={'count':0x0,'rows':[]};var _0x1c7a5d={};var _0x13ad11;var _0x3a3d9f;var _0x20a9c4;Promise[_0xc547('0x17')]()[_0xc547('0x24')](function(){if(_0x143992[_0xc547('0x13')][_0xc547('0x18')]){if(!utils[_0xc547('0x19')](_0x143992[_0xc547('0x13')][_0xc547('0x18')])){throw new APIBadRequestError(util[_0xc547('0x1a')](_0xc547('0x1b'),_0x143992[_0xc547('0x13')][_0xc547('0x18')]));}_0x13ad11=_0x143992[_0xc547('0x13')][_0xc547('0x18')][_0xc547('0x1c')]();}var _0x1981df=_[_0xc547('0x4a')](_0x13ad11)+_0xc547('0x4b');var _0x1e30ff=_['map'](db[_0x1981df][_0xc547('0x2c')],function(_0x338896){return{'name':_0x338896['fieldName'],'type':_0x338896['type']['key']};});if(!_0x143992[_0xc547('0x13')]['fields']){var _0x22c564=['id','name'];if(_0x13ad11===_0xc547('0x44')){_0x22c564[_0xc547('0x32')]('type');if(_0x143992[_0xc547('0x13')]['type']===_0xc547('0x4c')){_0x22c564[_0xc547('0x32')]([_0xc547('0x4d'),_0xc547('0x4e')]);}}_0x143992[_0xc547('0x13')][_0xc547('0x21')]=_0x22c564['join'](',');}_0x1c7a5d=qs[_0xc547('0x31')](_0x1e30ff,_0x143992);if(_0x143992['user'][_0xc547('0x2f')]===_0xc547('0x38')){var _0x3fa794={'params':{'id':_0x143992[_0xc547('0x38')][_0xc547('0x39')]},'query':{'section':_0x13ad11===_0xc547('0x44')&&_0x143992['query'][_0xc547('0x2e')]===_0xc547('0x4c')?_0xc547('0x4f'):_['startCase'](_0x13ad11)+'Queues','type':_0x143992[_0xc547('0x13')]['type'],'nolimit':!![],'sort':_0xc547('0x50'),'filter':_0x143992['query']['filter']}};_0x3fa794['query']=Object['assign'](_0x3fa794[_0xc547('0x13')],_0x143992[_0xc547('0x13')]);delete _0x3fa794[_0xc547('0x13')]['id'];return db['UserProfile'][_0xc547('0x3e')](_0x3fa794);}return db[_0x1981df][_0xc547('0x3f')](_0x1c7a5d);})[_0xc547('0x24')](function(_0x3cca32){_0x33872f['count']=_0x3cca32[_0xc547('0xd')];_0x3a3d9f=_0x3cca32[_0xc547('0x27')];return rtq[_0xc547('0x51')](_0x143992,_0x13ad11);})[_0xc547('0x24')](function(_0x54c1c0){_0x20a9c4=_0x54c1c0['rows'];return rtq['initializeQueues'](_0x3a3d9f,_0x20a9c4,_0x13ad11,_0x143992['query']['type']);})[_0xc547('0x24')](function(_0x55daf1){_0x33872f[_0xc547('0x27')]=_0x55daf1;return _0x33872f;})[_0xc547('0x24')](respondWithFilteredResult(_0x2e9d27,_0x1c7a5d))[_0xc547('0x48')](APIHandleError(_0x2e9d27));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 8bb72fb..f199b4b 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x26f34d,_0x4cad05){var _0xb06af7=function(_0x30775b){while(--_0x30775b){_0x26f34d['push'](_0x26f34d['shift']());}};_0xb06af7(++_0x4cad05);}(_0xe706,0xa3));var _0x6e70=function(_0x5f31b0,_0x5d6223){_0x5f31b0=_0x5f31b0-0x0;var _0x5eb946=_0xe706[_0x5f31b0];return _0x5eb946;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d65bd,_0x2feac9){var _0x12dc28=function(_0x2872a2){while(--_0x2872a2){_0x1d65bd['push'](_0x1d65bd['shift']());}};_0x12dc28(++_0x2feac9);}(_0xe706,0xa3));var _0x6e70=function(_0x1a9bdf,_0x43130a){_0x1a9bdf=_0x1a9bdf-0x0;var _0x61a042=_0xe706[_0x1a9bdf];return _0x61a042;};'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 0774ad3..2c950e6 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 _0x6869=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0x189d76,_0x3ad5ae){var _0x59115b=function(_0x45e714){while(--_0x45e714){_0x189d76['push'](_0x189d76['shift']());}};_0x59115b(++_0x3ad5ae);}(_0x6869,0xe2));var _0x9686=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6869[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x9686('0x0'));module[_0x9686('0x1')]={'state':{'type':Sequelize[_0x9686('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9686('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x9686('0x3')]},'ringtime':{'type':Sequelize[_0x9686('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9686('0x4')]},'campaigntype':{'type':Sequelize[_0x9686('0x4')]},'membername':{'type':Sequelize[_0x9686('0x4')]}}; \ No newline at end of file +var _0x44c2=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x44c2,0x100));var _0x244c=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x44c2[_0x2b8077];return _0x308091;};'use strict';var Sequelize=require(_0x244c('0x0'));module[_0x244c('0x1')]={'state':{'type':Sequelize[_0x244c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x244c('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x244c('0x3')]},'starttime':{'type':Sequelize[_0x244c('0x4')]},'responsetime':{'type':Sequelize[_0x244c('0x4')]},'ringtime':{'type':Sequelize[_0x244c('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x244c('0x3')]},'campaigntype':{'type':Sequelize[_0x244c('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index b701ca8..fa6e7a8 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 _0xc810=['report_agent_preview','lodash','util','moment','path','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xc810,0x1e1));var _0x0c81=function(_0x467fc7,_0x30674a){_0x467fc7=_0x467fc7-0x0;var _0x15bcd3=_0xc810[_0x467fc7];return _0x15bcd3;};'use strict';var _=require(_0x0c81('0x0'));var util=require(_0x0c81('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c81('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c81('0x3'));var rimraf=require('rimraf');var config=require(_0x0c81('0x4'));var attributes=require(_0x0c81('0x5'));module['exports']=function(_0xed78d4,_0x5d351d){return _0xed78d4['define'](_0x0c81('0x6'),attributes,{'tableName':_0x0c81('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x949b=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x949b,0x148));var _0xb949=function(_0x53145d,_0x2d1e61){_0x53145d=_0x53145d-0x0;var _0x365739=_0x949b[_0x53145d];return _0x365739;};'use strict';var _=require(_0xb949('0x0'));var util=require(_0xb949('0x1'));var logger=require('../../config/logger')(_0xb949('0x2'));var moment=require('moment');var BPromise=require(_0xb949('0x3'));var rp=require(_0xb949('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb949('0x5'));var config=require(_0xb949('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xb949('0x7')]=function(_0x59b8c3,_0x51eba3){return _0x59b8c3[_0xb949('0x8')](_0xb949('0x9'),attributes,{'tableName':_0xb949('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 8ade182..53ba7d0 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 _0x6d89=['../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x37de56,_0x2f9f52){var _0x37d097=function(_0x52da1f){while(--_0x52da1f){_0x37de56['push'](_0x37de56['shift']());}};_0x37d097(++_0x2f9f52);}(_0x6d89,0x14d));var _0x96d8=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x6d89[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x96d8('0x0'));var util=require(_0x96d8('0x1'));var moment=require(_0x96d8('0x2'));var BPromise=require(_0x96d8('0x3'));var rs=require(_0x96d8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96d8('0x5'))['db'];var utils=require(_0x96d8('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x96d8('0x7'));var client=jayson[_0x96d8('0x8')][_0x96d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a0fe2,_0x17f7a4,_0x58a59f){return new BPromise(function(_0x3c7230,_0x16e729){return client['request'](_0x4a0fe2,_0x58a59f)[_0x96d8('0xa')](function(_0x3d0db2){logger[_0x96d8('0xb')](_0x96d8('0xc'),_0x17f7a4,_0x96d8('0xd'));logger[_0x96d8('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x17f7a4,_0x96d8('0xd'),JSON[_0x96d8('0xf')](_0x3d0db2));if(_0x3d0db2[_0x96d8('0x10')]){if(_0x3d0db2[_0x96d8('0x10')][_0x96d8('0x11')]===0x1f4){logger['error'](_0x96d8('0xc'),_0x17f7a4,_0x3d0db2[_0x96d8('0x10')][_0x96d8('0x12')]);return _0x16e729(_0x3d0db2['error'][_0x96d8('0x12')]);}logger[_0x96d8('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x17f7a4,_0x3d0db2['error'][_0x96d8('0x12')]);return _0x3c7230(_0x3d0db2[_0x96d8('0x10')]['message']);}else{logger[_0x96d8('0xb')](_0x96d8('0xc'),_0x17f7a4,_0x96d8('0xd'));_0x3c7230(_0x3d0db2['result'][_0x96d8('0x12')]);}})[_0x96d8('0x13')](function(_0x2855f2){logger['error'](_0x96d8('0xc'),_0x17f7a4,_0x2855f2);_0x16e729(_0x2855f2);});});}exports[_0x96d8('0x14')]=function(_0xac61ee){var _0x11ff25=this;return new Promise(function(_0x1ba123,_0x14b3ab){return db[_0x96d8('0x15')][_0x96d8('0x16')](_0xac61ee[_0x96d8('0x17')],{'raw':_0xac61ee[_0x96d8('0x18')]?_0xac61ee[_0x96d8('0x18')][_0x96d8('0x19')]===undefined?!![]:![]:!![]})[_0x96d8('0xa')](function(_0x477c1d){logger[_0x96d8('0xb')](_0x96d8('0x14'),_0xac61ee);logger[_0x96d8('0xe')](_0x96d8('0x14'),_0xac61ee,JSON[_0x96d8('0xf')](_0x477c1d));_0x1ba123(_0x477c1d);})[_0x96d8('0x13')](function(_0x584e70){logger[_0x96d8('0x10')]('CreateReportAgentPreview',_0x584e70[_0x96d8('0x12')],_0xac61ee);_0x14b3ab(_0x11ff25[_0x96d8('0x10')](0x1f4,_0x584e70['message']));});});}; \ No newline at end of file +var _0x552d=['then','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0xd8dd11,_0x496fe4){var _0x11ce6e=function(_0x3bd913){while(--_0x3bd913){_0xd8dd11['push'](_0xd8dd11['shift']());}};_0x11ce6e(++_0x496fe4);}(_0x552d,0x1b9));var _0xd552=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x552d[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0xd552('0x0'));var moment=require(_0xd552('0x1'));var BPromise=require(_0xd552('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd552('0x3'))['db'];var utils=require(_0xd552('0x4'));var logger=require('../../config/logger')(_0xd552('0x5'));var config=require(_0xd552('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd552('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x553ba7,_0x4e3139,_0x5a3a6b){return new BPromise(function(_0x1d893b,_0x5e0150){return client[_0xd552('0x8')](_0x553ba7,_0x5a3a6b)[_0xd552('0x9')](function(_0x3dd09d){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x4e3139,'request\x20sent');logger[_0xd552('0xa')](_0xd552('0xb'),_0x4e3139,_0xd552('0xc'),JSON['stringify'](_0x3dd09d));if(_0x3dd09d['error']){if(_0x3dd09d[_0xd552('0xd')][_0xd552('0xe')]===0x1f4){logger['error'](_0xd552('0xf'),_0x4e3139,_0x3dd09d[_0xd552('0xd')]['message']);return _0x5e0150(_0x3dd09d['error'][_0xd552('0x10')]);}logger[_0xd552('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x4e3139,_0x3dd09d[_0xd552('0xd')][_0xd552('0x10')]);return _0x1d893b(_0x3dd09d['error'][_0xd552('0x10')]);}else{logger[_0xd552('0x11')](_0xd552('0xf'),_0x4e3139,_0xd552('0xc'));_0x1d893b(_0x3dd09d['result'][_0xd552('0x10')]);}})[_0xd552('0x12')](function(_0x18b1e1){logger[_0xd552('0xd')](_0xd552('0xf'),_0x4e3139,_0x18b1e1);_0x5e0150(_0x18b1e1);});});}exports[_0xd552('0x13')]=function(_0x5eb517){var _0x8cd123=this;return new Promise(function(_0x914918,_0x2d8e1b){return db[_0xd552('0x14')][_0xd552('0x15')](_0x5eb517[_0xd552('0x16')],{'raw':_0x5eb517['options']?_0x5eb517[_0xd552('0x17')][_0xd552('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x120123){logger[_0xd552('0x11')](_0xd552('0x13'),_0x5eb517);logger[_0xd552('0xa')](_0xd552('0x13'),_0x5eb517,JSON['stringify'](_0x120123));_0x914918(_0x120123);})['catch'](function(_0x4b68db){logger['error']('CreateReportAgentPreview',_0x4b68db[_0xd552('0x10')],_0x5eb517);_0x2d8e1b(_0x8cd123[_0xd552('0xd')](0x1f4,_0x4b68db[_0xd552('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7d37c95..8abb4cb 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 _0xe67b=['voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels'];(function(_0xe9b9b5,_0x820cf2){var _0x581105=function(_0x1f4046){while(--_0x1f4046){_0xe9b9b5['push'](_0xe9b9b5['shift']());}};_0x581105(++_0x820cf2);}(_0xe67b,0x81));var _0xbe67=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0xe67b[_0x4c7b20];return _0x4872bd;};'use strict';var multer=require('multer');var util=require(_0xbe67('0x0'));var path=require(_0xbe67('0x1'));var express=require(_0xbe67('0x2'));var router=express['Router']();var auth=require(_0xbe67('0x3'));var controller=require(_0xbe67('0x4'));router[_0xbe67('0x5')](_0xbe67('0x6'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x8')]);router[_0xbe67('0x5')](_0xbe67('0x9'),auth[_0xbe67('0x7')](),controller[_0xbe67('0xa')]);router[_0xbe67('0x5')](_0xbe67('0xb'),auth[_0xbe67('0x7')](),controller[_0xbe67('0xc')]);router[_0xbe67('0x5')]('/voice/queues',auth[_0xbe67('0x7')](),controller['voiceQueues']);router['get'](_0xbe67('0xd'),auth[_0xbe67('0x7')](),controller[_0xbe67('0xe')]);router[_0xbe67('0x5')]('/mail/queues',auth[_0xbe67('0x7')](),controller[_0xbe67('0xf')]);router[_0xbe67('0x5')](_0xbe67('0x10'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x11')]);router[_0xbe67('0x5')](_0xbe67('0x12'),auth[_0xbe67('0x7')](),controller['openchannelQueues']);router['get'](_0xbe67('0x13'),auth['isAuthenticated'](),controller[_0xbe67('0x14')]);router[_0xbe67('0x5')](_0xbe67('0x15'),auth[_0xbe67('0x7')](),controller['whatsappQueues']);router['get'](_0xbe67('0x16'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x17')]);router[_0xbe67('0x5')](_0xbe67('0x18'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x19')]);router[_0xbe67('0x5')](_0xbe67('0x1a'),auth['isAuthenticated'](),controller[_0xbe67('0x1b')]);router[_0xbe67('0x5')]('/voice/queues/channels/:uniqueid',auth[_0xbe67('0x7')](),controller[_0xbe67('0x1c')]);router[_0xbe67('0x5')](_0xbe67('0x1d'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x1e')]);router[_0xbe67('0x5')](_0xbe67('0x1f'),auth['isAuthenticated'](),controller[_0xbe67('0x20')]);router['get'](_0xbe67('0x21'),auth['isAuthenticated'](),controller[_0xbe67('0x22')]);router[_0xbe67('0x23')](_0xbe67('0x21'),auth[_0xbe67('0x7')](),controller['updateVoiceQueue']);router['get'](_0xbe67('0x24'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x25')]);router[_0xbe67('0x5')](_0xbe67('0x26'),auth[_0xbe67('0x7')](),controller['outboundChannels']);router[_0xbe67('0x5')](_0xbe67('0x27'),auth['isAuthenticated'](),controller['agents']);router[_0xbe67('0x23')](_0xbe67('0x28'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x29')]);router[_0xbe67('0x5')](_0xbe67('0x2a'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x2b')]);router['get'](_0xbe67('0x2c'),auth[_0xbe67('0x7')](),controller['trunks']);router[_0xbe67('0x5')](_0xbe67('0x2d'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x2e')]);router[_0xbe67('0x5')]('/fax/accounts',auth[_0xbe67('0x7')](),controller[_0xbe67('0x2f')]);router[_0xbe67('0x5')](_0xbe67('0x30'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xbe67('0x5')]('/mail/queues/waitinginteractions',auth[_0xbe67('0x7')](),controller[_0xbe67('0x31')]);router[_0xbe67('0x5')](_0xbe67('0x32'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x33')]);router['get'](_0xbe67('0x34'),auth[_0xbe67('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xbe67('0x5')](_0xbe67('0x35'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x36')]);router['get'](_0xbe67('0x37'),auth['isAuthenticated'](),controller[_0xbe67('0x38')]);router[_0xbe67('0x5')]('/fax/queues/waitinginteractions',auth[_0xbe67('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0xbe67('0x39')](_0xbe67('0x3a'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x3b')](_0xbe67('0x3c')));router['get'](_0xbe67('0x3d'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x3e')]);router[_0xbe67('0x39')](_0xbe67('0x3f'),auth[_0xbe67('0x7')](),controller['queueNotify'](_0xbe67('0x40')));router[_0xbe67('0x5')]('/chat/queues/:id',auth[_0xbe67('0x7')](),controller['showChatQueues']);router[_0xbe67('0x39')](_0xbe67('0x41'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x3b')](_0xbe67('0x42')));router[_0xbe67('0x5')](_0xbe67('0x43'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x44')]);router[_0xbe67('0x39')](_0xbe67('0x45'),auth[_0xbe67('0x7')](),controller[_0xbe67('0x3b')]('openchannel'));router[_0xbe67('0x5')](_0xbe67('0x46'),auth[_0xbe67('0x7')](),controller['showOpenchannelQueues']);router[_0xbe67('0x39')](_0xbe67('0x47'),auth[_0xbe67('0x7')](),controller['queueNotify'](_0xbe67('0x48')));router[_0xbe67('0x39')]('/whatsapp/queues/:id/notify',auth[_0xbe67('0x7')](),controller[_0xbe67('0x3b')](_0xbe67('0x49')));router[_0xbe67('0x5')]('/sms/queues/:id',auth[_0xbe67('0x7')](),controller[_0xbe67('0x4a')]);router[_0xbe67('0x5')](_0xbe67('0x4b'),auth[_0xbe67('0x7')](),controller['showWhatsappQueues']);router[_0xbe67('0x39')](_0xbe67('0x4c'),auth[_0xbe67('0x7')](),controller['agentNotify']);module[_0xbe67('0x4d')]=router; \ No newline at end of file +var _0x208b=['/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues'];(function(_0x5efddb,_0x1895af){var _0x400695=function(_0xe4e94f){while(--_0xe4e94f){_0x5efddb['push'](_0x5efddb['shift']());}};_0x400695(++_0x1895af);}(_0x208b,0xde));var _0xb208=function(_0x9c640c,_0x5aa82c){_0x9c640c=_0x9c640c-0x0;var _0x59c6de=_0x208b[_0x9c640c];return _0x59c6de;};'use strict';var multer=require(_0xb208('0x0'));var util=require(_0xb208('0x1'));var path=require('path');var express=require(_0xb208('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xb208('0x3'));router[_0xb208('0x4')](_0xb208('0x5'),auth[_0xb208('0x6')](),controller[_0xb208('0x7')]);router[_0xb208('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xb208('0x6')](),controller['voiceChannelMixMonitor']);router[_0xb208('0x4')](_0xb208('0x8'),auth[_0xb208('0x6')](),controller[_0xb208('0x9')]);router['get'](_0xb208('0xa'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0xb208('0x4')](_0xb208('0xb'),auth[_0xb208('0x6')](),controller[_0xb208('0xc')]);router[_0xb208('0x4')](_0xb208('0xd'),auth[_0xb208('0x6')](),controller[_0xb208('0xe')]);router[_0xb208('0x4')](_0xb208('0xf'),auth['isAuthenticated'](),controller[_0xb208('0x10')]);router['get'](_0xb208('0x11'),auth[_0xb208('0x6')](),controller[_0xb208('0x12')]);router['get'](_0xb208('0x13'),auth[_0xb208('0x6')](),controller[_0xb208('0x14')]);router[_0xb208('0x4')]('/whatsapp/queues',auth[_0xb208('0x6')](),controller[_0xb208('0x15')]);router[_0xb208('0x4')](_0xb208('0x16'),auth[_0xb208('0x6')](),controller['faxQueues']);router[_0xb208('0x4')](_0xb208('0x17'),auth[_0xb208('0x6')](),controller[_0xb208('0x18')]);router[_0xb208('0x4')](_0xb208('0x19'),auth['isAuthenticated'](),controller[_0xb208('0x1a')]);router[_0xb208('0x4')]('/voice/queues/channels/:uniqueid',auth[_0xb208('0x6')](),controller[_0xb208('0x1b')]);router[_0xb208('0x4')](_0xb208('0x1c'),auth[_0xb208('0x6')](),controller[_0xb208('0x1d')]);router[_0xb208('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xb208('0x6')](),controller[_0xb208('0x1e')]);router['get'](_0xb208('0x1f'),auth[_0xb208('0x6')](),controller[_0xb208('0x20')]);router[_0xb208('0x21')](_0xb208('0x1f'),auth[_0xb208('0x6')](),controller[_0xb208('0x22')]);router[_0xb208('0x4')](_0xb208('0x23'),auth[_0xb208('0x6')](),controller[_0xb208('0x24')]);router[_0xb208('0x4')](_0xb208('0x25'),auth[_0xb208('0x6')](),controller[_0xb208('0x26')]);router[_0xb208('0x4')](_0xb208('0x27'),auth[_0xb208('0x6')](),controller['agents']);router['put'](_0xb208('0x28'),auth[_0xb208('0x6')](),controller[_0xb208('0x29')]);router[_0xb208('0x4')](_0xb208('0x2a'),auth[_0xb208('0x6')](),controller[_0xb208('0x2b')]);router[_0xb208('0x4')](_0xb208('0x2c'),auth['isAuthenticated'](),controller['trunks']);router[_0xb208('0x4')](_0xb208('0x2d'),auth['isAuthenticated'](),controller[_0xb208('0x2e')]);router[_0xb208('0x4')](_0xb208('0x2f'),auth[_0xb208('0x6')](),controller[_0xb208('0x30')]);router[_0xb208('0x4')]('/chat/queues/waitinginteractions',auth[_0xb208('0x6')](),controller[_0xb208('0x31')]);router[_0xb208('0x4')]('/mail/queues/waitinginteractions',auth[_0xb208('0x6')](),controller[_0xb208('0x32')]);router[_0xb208('0x4')](_0xb208('0x33'),auth['isAuthenticated'](),controller[_0xb208('0x34')]);router['get'](_0xb208('0x35'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xb208('0x4')](_0xb208('0x36'),auth[_0xb208('0x6')](),controller[_0xb208('0x37')]);router[_0xb208('0x4')](_0xb208('0x38'),auth['isAuthenticated'](),controller[_0xb208('0x39')]);router[_0xb208('0x4')](_0xb208('0x3a'),auth[_0xb208('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0xb208('0x3b')](_0xb208('0x3c'),auth['isAuthenticated'](),controller[_0xb208('0x3d')]('mail'));router[_0xb208('0x4')](_0xb208('0x3e'),auth[_0xb208('0x6')](),controller['showMailQueues']);router['post']('/chat/queues/:id/notify',auth[_0xb208('0x6')](),controller['queueNotify'](_0xb208('0x3f')));router[_0xb208('0x4')](_0xb208('0x40'),auth[_0xb208('0x6')](),controller[_0xb208('0x41')]);router[_0xb208('0x3b')](_0xb208('0x42'),auth['isAuthenticated'](),controller['queueNotify']('fax'));router[_0xb208('0x4')]('/fax/queues/:id',auth[_0xb208('0x6')](),controller[_0xb208('0x43')]);router['post'](_0xb208('0x44'),auth[_0xb208('0x6')](),controller[_0xb208('0x3d')](_0xb208('0x45')));router[_0xb208('0x4')]('/openchannel/queues/:id',auth[_0xb208('0x6')](),controller[_0xb208('0x46')]);router[_0xb208('0x3b')](_0xb208('0x47'),auth['isAuthenticated'](),controller[_0xb208('0x3d')](_0xb208('0x48')));router['post'](_0xb208('0x49'),auth[_0xb208('0x6')](),controller[_0xb208('0x3d')]('whatsapp'));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xb208('0x4a')]);router[_0xb208('0x4')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0xb208('0x4b')]);router[_0xb208('0x3b')](_0xb208('0x4c'),auth[_0xb208('0x6')](),controller[_0xb208('0x4d')]);module[_0xb208('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5be239c..5c1a4ff 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x11c92e,_0x53e393){var _0x21f4ec=function(_0x54e276){while(--_0x54e276){_0x11c92e['push'](_0x11c92e['shift']());}};_0x21f4ec(++_0x53e393);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 4a7fd7c..1cb76ac 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 _0x1744=['/:id/run','run','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1744,0xef));var _0x4174=function(_0x27ed43,_0x90ce9a){_0x27ed43=_0x27ed43-0x0;var _0x35bb9f=_0x1744[_0x27ed43];return _0x35bb9f;};'use strict';var multer=require(_0x4174('0x0'));var util=require(_0x4174('0x1'));var path=require('path');var timeout=require(_0x4174('0x2'));var express=require(_0x4174('0x3'));var router=express[_0x4174('0x4')]();var fs_extra=require(_0x4174('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4174('0x6'));var config=require(_0x4174('0x7'));var controller=require('./schedule.controller');router[_0x4174('0x8')]('/',auth['isAuthenticated'](),controller[_0x4174('0x9')]);router['get'](_0x4174('0xa'),auth[_0x4174('0xb')](),controller[_0x4174('0xc')]);router[_0x4174('0x8')](_0x4174('0xd'),auth[_0x4174('0xb')](),controller[_0x4174('0xe')]);router[_0x4174('0xf')]('/',auth[_0x4174('0xb')](),controller[_0x4174('0x10')]);router[_0x4174('0x11')](_0x4174('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4174('0x12')](_0x4174('0xa'),auth['isAuthenticated'](),controller[_0x4174('0x13')]);module[_0x4174('0x14')]=router; \ No newline at end of file +var _0xab23=['run','post','create','put','delete','/:id','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab23,0x15b));var _0x3ab2=function(_0x1af970,_0x36cdb8){_0x1af970=_0x1af970-0x0;var _0x28216e=_0xab23[_0x1af970];return _0x28216e;};'use strict';var multer=require(_0x3ab2('0x0'));var util=require(_0x3ab2('0x1'));var path=require('path');var timeout=require(_0x3ab2('0x2'));var express=require('express');var router=express[_0x3ab2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3ab2('0x4'));var interaction=require(_0x3ab2('0x5'));var config=require(_0x3ab2('0x6'));var controller=require(_0x3ab2('0x7'));router[_0x3ab2('0x8')]('/',auth[_0x3ab2('0x9')](),controller[_0x3ab2('0xa')]);router[_0x3ab2('0x8')]('/:id',auth[_0x3ab2('0x9')](),controller[_0x3ab2('0xb')]);router[_0x3ab2('0x8')](_0x3ab2('0xc'),auth[_0x3ab2('0x9')](),controller[_0x3ab2('0xd')]);router[_0x3ab2('0xe')]('/',auth[_0x3ab2('0x9')](),controller[_0x3ab2('0xf')]);router[_0x3ab2('0x10')]('/:id',auth[_0x3ab2('0x9')](),controller['update']);router[_0x3ab2('0x11')](_0x3ab2('0x12'),auth[_0x3ab2('0x9')](),controller['destroy']);module[_0x3ab2('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a9b9f28..45ba5f3 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 _0xb4e6=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','hours','csv','xlsx','ENUM','custom','default','TEXT','sequelize','STRING'];(function(_0x5e6c19,_0x42d639){var _0x3b15e3=function(_0x2dcb4a){while(--_0x2dcb4a){_0x5e6c19['push'](_0x5e6c19['shift']());}};_0x3b15e3(++_0x42d639);}(_0xb4e6,0xb2));var _0x6b4e=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0xb4e6[_0x3a9635];return _0x10d08c;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'active':{'type':Sequelize[_0x6b4e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![],'defaultValue':_0x6b4e('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x6b4e('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6b4e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x6b4e('0x6'),_0x6b4e('0x7'),_0x6b4e('0x8'),_0x6b4e('0x9'),_0x6b4e('0xa'),_0x6b4e('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x6b4e('0xa')},'output':{'type':Sequelize['ENUM'](_0x6b4e('0xc'),'pdf',_0x6b4e('0xd')),'allowNull':![],'defaultValue':_0x6b4e('0xc')},'type':{'type':Sequelize[_0x6b4e('0xe')](_0x6b4e('0xf'),_0x6b4e('0x10')),'allowNull':![],'defaultValue':_0x6b4e('0xf')},'sendMail':{'type':Sequelize[_0x6b4e('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6b4e('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x6b4e('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdd1a=['quarters','weeks','days','hours','minutes','csv','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM'];(function(_0x30c1d6,_0x4de4ba){var _0x34433a=function(_0xb9761d){while(--_0xb9761d){_0x30c1d6['push'](_0x30c1d6['shift']());}};_0x34433a(++_0x4de4ba);}(_0xdd1a,0x169));var _0xadd1=function(_0x9bca15,_0x255415){_0x9bca15=_0x9bca15-0x0;var _0x183cdd=_0xdd1a[_0x9bca15];return _0x183cdd;};'use strict';var Sequelize=require(_0xadd1('0x0'));module[_0xadd1('0x1')]={'name':{'type':Sequelize[_0xadd1('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xadd1('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xadd1('0x2')],'allowNull':![],'defaultValue':_0xadd1('0x4')},'startAt':{'type':Sequelize[_0xadd1('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xadd1('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xadd1('0x6')]('years',_0xadd1('0x7'),'months',_0xadd1('0x8'),_0xadd1('0x9'),_0xadd1('0xa'),_0xadd1('0xb')),'allowNull':![],'defaultValue':_0xadd1('0x9')},'output':{'type':Sequelize[_0xadd1('0x6')](_0xadd1('0xc'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xadd1('0xc')},'type':{'type':Sequelize['ENUM']('custom',_0xadd1('0xd')),'allowNull':![],'defaultValue':_0xadd1('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xadd1('0x2')]},'cc':{'type':Sequelize[_0xadd1('0xf')]},'bcc':{'type':Sequelize[_0xadd1('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xadd1('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 39a8f1e..3edbed7 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 _0x558b=['get','Scheduler','UserProfileResource','stack','name','index','map','Schedule','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','params','keys','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x2d7745,_0x4fe6a6){var _0xab8b8=function(_0x424d56){while(--_0x424d56){_0x2d7745['push'](_0x2d7745['shift']());}};_0xab8b8(++_0x4fe6a6);}(_0x558b,0x83));var _0xb558=function(_0x8c4e2f,_0x416ff0){_0x8c4e2f=_0x8c4e2f-0x0;var _0x1c051f=_0x558b[_0x8c4e2f];return _0x1c051f;};'use strict';var emlformat=require(_0xb558('0x0'));var rimraf=require(_0xb558('0x1'));var zipdir=require(_0xb558('0x2'));var jsonpatch=require(_0xb558('0x3'));var rp=require(_0xb558('0x4'));var moment=require(_0xb558('0x5'));var BPromise=require(_0xb558('0x6'));var Mustache=require('mustache');var util=require(_0xb558('0x7'));var path=require(_0xb558('0x8'));var sox=require(_0xb558('0x9'));var csv=require('to-csv');var ejs=require(_0xb558('0xa'));var fs=require('fs');var fs_extra=require(_0xb558('0xb'));var _=require('lodash');var squel=require(_0xb558('0xc'));var crypto=require(_0xb558('0xd'));var jsforce=require(_0xb558('0xe'));var deskjs=require(_0xb558('0xf'));var toCsv=require(_0xb558('0x10'));var querystring=require(_0xb558('0x11'));var Papa=require(_0xb558('0x12'));var Redis=require('ioredis');var authService=require(_0xb558('0x13'));var qs=require(_0xb558('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb558('0x15'));var logger=require(_0xb558('0x16'))(_0xb558('0x17'));var utils=require(_0xb558('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb558('0x19'))['db'];function respondWithStatusCode(_0x96ae6b,_0x3914fa){_0x3914fa=_0x3914fa||0xcc;return function(_0x1a601f){if(_0x1a601f){return _0x96ae6b[_0xb558('0x1a')](_0x3914fa);}return _0x96ae6b[_0xb558('0x1b')](_0x3914fa)[_0xb558('0x1c')]();};}function respondWithResult(_0x377d1c,_0x3ef995){_0x3ef995=_0x3ef995||0xc8;return function(_0x2ac9cf){if(_0x2ac9cf){return _0x377d1c[_0xb558('0x1b')](_0x3ef995)[_0xb558('0x1d')](_0x2ac9cf);}};}function respondWithFilteredResult(_0x4a891b,_0x4cc125){return function(_0xb662b1){if(_0xb662b1){var _0x593fee=typeof _0x4cc125[_0xb558('0x1e')]===_0xb558('0x1f')&&typeof _0x4cc125[_0xb558('0x20')]===_0xb558('0x1f');var _0x1636cb=_0xb662b1['count'];var _0x30d86e=_0x593fee?0x0:_0x4cc125[_0xb558('0x1e')];var _0x25beae=_0x593fee?_0xb662b1[_0xb558('0x21')]:_0x4cc125[_0xb558('0x1e')]+_0x4cc125[_0xb558('0x20')];var _0x25b72f;if(_0x25beae>=_0x1636cb){_0x25beae=_0x1636cb;_0x25b72f=0xc8;}else{_0x25b72f=0xce;}_0x4a891b[_0xb558('0x1b')](_0x25b72f);return _0x4a891b[_0xb558('0x22')](_0xb558('0x23'),_0x30d86e+'-'+_0x25beae+'/'+_0x1636cb)[_0xb558('0x1d')](_0xb662b1);}return null;};}function patchUpdates(_0x2032f5){return function(_0x1ecabe){try{jsonpatch['apply'](_0x1ecabe,_0x2032f5,!![]);}catch(_0x1724a4){return BPromise[_0xb558('0x24')](_0x1724a4);}return _0x1ecabe[_0xb558('0x25')]();};}function saveUpdates(_0x34c43c,_0x13d464){return function(_0x151416){if(_0x151416){return _0x151416[_0xb558('0x26')](_0x34c43c)[_0xb558('0x27')](function(_0x54ad0d){return _0x54ad0d;});}return null;};}function removeEntity(_0x8bbb02,_0x2b6ab5){return function(_0x13d738){if(_0x13d738){return _0x13d738[_0xb558('0x28')]()[_0xb558('0x27')](function(){var _0xe8debe=_0x13d738[_0xb558('0x29')]({'plain':!![]});var _0x479b0a=_0xb558('0x2a');return db[_0xb558('0x2b')]['destroy']({'where':{'type':_0x479b0a,'resourceId':_0xe8debe['id']}})[_0xb558('0x27')](function(){return _0x13d738;});})[_0xb558('0x27')](function(){_0x8bbb02['status'](0xcc)[_0xb558('0x1c')]();});}};}function handleEntityNotFound(_0x14bf35,_0x23ba0f){return function(_0xefbae9){if(!_0xefbae9){_0x14bf35[_0xb558('0x1a')](0x194);}return _0xefbae9;};}function handleError(_0x15a50d,_0x2d22ca){_0x2d22ca=_0x2d22ca||0x1f4;return function(_0x3cd7a4){logger['error'](_0x3cd7a4[_0xb558('0x2c')]);if(_0x3cd7a4[_0xb558('0x2d')]){delete _0x3cd7a4['name'];}_0x15a50d['status'](_0x2d22ca)['send'](_0x3cd7a4);};}exports[_0xb558('0x2e')]=function(_0x2a03c2,_0x3c05fa){var _0x19f55f={},_0x518ddc={},_0x200247={'count':0x0,'rows':[]};var _0x52b694=_[_0xb558('0x2f')](db[_0xb558('0x30')]['rawAttributes'],function(_0x504d73){return{'name':_0x504d73[_0xb558('0x31')],'type':_0x504d73[_0xb558('0x32')][_0xb558('0x33')]};});_0x518ddc[_0xb558('0x34')]=_['map'](_0x52b694,'name');_0x518ddc[_0xb558('0x35')]=_['keys'](_0x2a03c2[_0xb558('0x35')]);_0x518ddc[_0xb558('0x36')]=_[_0xb558('0x37')](_0x518ddc[_0xb558('0x34')],_0x518ddc[_0xb558('0x35')]);_0x19f55f[_0xb558('0x38')]=_['intersection'](_0x518ddc[_0xb558('0x34')],qs['fields'](_0x2a03c2[_0xb558('0x35')][_0xb558('0x39')]));_0x19f55f[_0xb558('0x38')]=_0x19f55f[_0xb558('0x38')][_0xb558('0x3a')]?_0x19f55f['attributes']:_0x518ddc[_0xb558('0x34')];if(!_0x2a03c2[_0xb558('0x35')][_0xb558('0x3b')]('nolimit')){_0x19f55f[_0xb558('0x20')]=qs[_0xb558('0x20')](_0x2a03c2[_0xb558('0x35')][_0xb558('0x20')]);_0x19f55f[_0xb558('0x1e')]=qs[_0xb558('0x1e')](_0x2a03c2[_0xb558('0x35')][_0xb558('0x1e')]);}_0x19f55f[_0xb558('0x3c')]=qs[_0xb558('0x3d')](_0x2a03c2[_0xb558('0x35')][_0xb558('0x3d')]);_0x19f55f[_0xb558('0x3e')]=qs[_0xb558('0x36')](_[_0xb558('0x3f')](_0x2a03c2[_0xb558('0x35')],_0x518ddc[_0xb558('0x36')]),_0x52b694);if(_0x2a03c2[_0xb558('0x35')][_0xb558('0x40')]){_0x19f55f[_0xb558('0x3e')]=_[_0xb558('0x41')](_0x19f55f[_0xb558('0x3e')],{'$or':_[_0xb558('0x2f')](_0x52b694,function(_0x1eee32){if(_0x1eee32['type']!==_0xb558('0x42')){var _0x87b27e={};_0x87b27e[_0x1eee32[_0xb558('0x2d')]]={'$like':'%'+_0x2a03c2[_0xb558('0x35')][_0xb558('0x40')]+'%'};return _0x87b27e;}})});}_0x19f55f=_[_0xb558('0x41')]({},_0x19f55f,_0x2a03c2['options']);var _0x28e522={'where':_0x19f55f['where']};return db[_0xb558('0x30')][_0xb558('0x21')](_0x28e522)[_0xb558('0x27')](function(_0x70302b){_0x200247['count']=_0x70302b;if(_0x2a03c2[_0xb558('0x35')][_0xb558('0x43')]){_0x19f55f[_0xb558('0x44')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x19f55f);})[_0xb558('0x27')](function(_0x586d37){_0x200247['rows']=_0x586d37;return _0x200247;})[_0xb558('0x27')](respondWithFilteredResult(_0x3c05fa,_0x19f55f))[_0xb558('0x45')](handleError(_0x3c05fa,null));};exports['show']=function(_0xedcef4,_0x58e547){var _0x13ae8a={'raw':![],'where':{'id':_0xedcef4[_0xb558('0x46')]['id']}},_0x195f91={};_0x195f91['model']=_[_0xb558('0x47')](db[_0xb558('0x30')][_0xb558('0x48')]);_0x195f91['query']=_[_0xb558('0x47')](_0xedcef4[_0xb558('0x35')]);_0x195f91['filters']=_[_0xb558('0x37')](_0x195f91[_0xb558('0x34')],_0x195f91[_0xb558('0x35')]);_0x13ae8a[_0xb558('0x38')]=_[_0xb558('0x37')](_0x195f91[_0xb558('0x34')],qs[_0xb558('0x39')](_0xedcef4[_0xb558('0x35')][_0xb558('0x39')]));_0x13ae8a[_0xb558('0x38')]=_0x13ae8a[_0xb558('0x38')][_0xb558('0x3a')]?_0x13ae8a['attributes']:_0x195f91['model'];if(_0xedcef4[_0xb558('0x35')][_0xb558('0x43')]){_0x13ae8a['include']=[{'all':!![]}];}_0x13ae8a=_[_0xb558('0x41')]({},_0x13ae8a,_0xedcef4[_0xb558('0x49')]);return db['Schedule'][_0xb558('0x4a')](_0x13ae8a)['then'](handleEntityNotFound(_0x58e547,null))['then'](respondWithResult(_0x58e547,null))[_0xb558('0x45')](handleError(_0x58e547,null));};exports[_0xb558('0x4b')]=function(_0x291314,_0x2efa2b){return db[_0xb558('0x30')][_0xb558('0x4b')](_0x291314[_0xb558('0x4c')],{})['then'](function(_0x15fb37){var _0x51054e=_0x291314[_0xb558('0x4d')]['get']({'plain':!![]});if(!_0x51054e)throw new Error(_0xb558('0x4e'));if(_0x51054e[_0xb558('0x4f')]==='user'){var _0x212b10=_0x15fb37[_0xb558('0x29')]({'plain':!![]});var _0x4450f6=_0xb558('0x2a');return db[_0xb558('0x50')]['find']({'where':{'name':_0x4450f6,'userProfileId':_0x51054e['userProfileId']},'raw':!![]})[_0xb558('0x27')](function(_0x553482){if(_0x553482&&_0x553482[_0xb558('0x51')]===0x0){return db[_0xb558('0x2b')][_0xb558('0x4b')]({'name':_0x212b10[_0xb558('0x2d')],'resourceId':_0x212b10['id'],'type':_0x553482[_0xb558('0x2d')],'sectionId':_0x553482['id']},{})['then'](function(){return _0x15fb37;});}else{return _0x15fb37;}})[_0xb558('0x45')](function(_0x306447){logger[_0xb558('0x52')](_0xb558('0x53'),_0x306447);throw _0x306447;});}return _0x15fb37;})[_0xb558('0x27')](respondWithResult(_0x2efa2b,0xc9))[_0xb558('0x45')](handleError(_0x2efa2b,null));};exports[_0xb558('0x26')]=function(_0x4b2fe9,_0x30001f){if(_0x4b2fe9[_0xb558('0x4c')]['id']){delete _0x4b2fe9[_0xb558('0x4c')]['id'];}return db[_0xb558('0x30')][_0xb558('0x4a')]({'where':{'id':_0x4b2fe9[_0xb558('0x46')]['id']}})[_0xb558('0x27')](handleEntityNotFound(_0x30001f,null))[_0xb558('0x27')](saveUpdates(_0x4b2fe9[_0xb558('0x4c')],null))[_0xb558('0x27')](respondWithResult(_0x30001f,null))[_0xb558('0x45')](handleError(_0x30001f,null));};exports[_0xb558('0x28')]=function(_0x362336,_0x36f1f5){return db[_0xb558('0x30')][_0xb558('0x4a')]({'where':{'id':_0x362336[_0xb558('0x46')]['id']}})['then'](handleEntityNotFound(_0x36f1f5,null))[_0xb558('0x27')](removeEntity(_0x36f1f5,null))[_0xb558('0x45')](handleError(_0x36f1f5,null));};exports[_0xb558('0x54')]=function(_0x4d5c1a,_0x2848bf,_0xb01af1){var _0x1898f0=require(_0xb558('0x55'));return db['Schedule'][_0xb558('0x4a')]({'where':{'id':_0x4d5c1a['params']['id']},'raw':!![]})[_0xb558('0x27')](handleEntityNotFound(_0x2848bf,null))[_0xb558('0x27')](function(){_0x1898f0[_0xb558('0x54')](_0x4d5c1a[_0xb558('0x46')]['id']);})['then'](respondWithStatusCode(_0x2848bf,null))[_0xb558('0x45')](handleError(_0x2848bf,null));}; \ No newline at end of file +var _0xa493=['find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include'];(function(_0xd5bc13,_0x4b5b7c){var _0x5b9baf=function(_0x2f42c3){while(--_0x2f42c3){_0xd5bc13['push'](_0xd5bc13['shift']());}};_0x5b9baf(++_0x4b5b7c);}(_0xa493,0x107));var _0x3a49=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xa493[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0x3a49('0x0'));var rimraf=require(_0x3a49('0x1'));var zipdir=require(_0x3a49('0x2'));var jsonpatch=require(_0x3a49('0x3'));var rp=require('request-promise');var moment=require(_0x3a49('0x4'));var BPromise=require(_0x3a49('0x5'));var Mustache=require('mustache');var util=require(_0x3a49('0x6'));var path=require('path');var sox=require(_0x3a49('0x7'));var csv=require(_0x3a49('0x8'));var ejs=require(_0x3a49('0x9'));var fs=require('fs');var fs_extra=require(_0x3a49('0xa'));var _=require(_0x3a49('0xb'));var squel=require(_0x3a49('0xc'));var crypto=require(_0x3a49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3a49('0xe'));var toCsv=require(_0x3a49('0x8'));var querystring=require(_0x3a49('0xf'));var Papa=require(_0x3a49('0x10'));var Redis=require(_0x3a49('0x11'));var authService=require(_0x3a49('0x12'));var qs=require(_0x3a49('0x13'));var as=require(_0x3a49('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3a49('0x15'));var config=require(_0x3a49('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a49('0x17'))['db'];function respondWithStatusCode(_0x2430b0,_0x46437f){_0x46437f=_0x46437f||0xcc;return function(_0x5dd4ec){if(_0x5dd4ec){return _0x2430b0[_0x3a49('0x18')](_0x46437f);}return _0x2430b0[_0x3a49('0x19')](_0x46437f)[_0x3a49('0x1a')]();};}function respondWithResult(_0x7371d5,_0x2c0ace){_0x2c0ace=_0x2c0ace||0xc8;return function(_0x301657){if(_0x301657){return _0x7371d5[_0x3a49('0x19')](_0x2c0ace)[_0x3a49('0x1b')](_0x301657);}};}function respondWithFilteredResult(_0x509a03,_0x36d3c3){return function(_0x52bc86){if(_0x52bc86){var _0x5742f1=typeof _0x36d3c3[_0x3a49('0x1c')]===_0x3a49('0x1d')&&typeof _0x36d3c3[_0x3a49('0x1e')]==='undefined';var _0x42040f=_0x52bc86[_0x3a49('0x1f')];var _0xe0aa2e=_0x5742f1?0x0:_0x36d3c3[_0x3a49('0x1c')];var _0x6a8b83=_0x5742f1?_0x52bc86[_0x3a49('0x1f')]:_0x36d3c3[_0x3a49('0x1c')]+_0x36d3c3[_0x3a49('0x1e')];var _0x24eea7;if(_0x6a8b83>=_0x42040f){_0x6a8b83=_0x42040f;_0x24eea7=0xc8;}else{_0x24eea7=0xce;}_0x509a03[_0x3a49('0x19')](_0x24eea7);return _0x509a03[_0x3a49('0x20')](_0x3a49('0x21'),_0xe0aa2e+'-'+_0x6a8b83+'/'+_0x42040f)['json'](_0x52bc86);}return null;};}function patchUpdates(_0x2c0372){return function(_0x11ab70){try{jsonpatch['apply'](_0x11ab70,_0x2c0372,!![]);}catch(_0x3dbfa3){return BPromise['reject'](_0x3dbfa3);}return _0x11ab70[_0x3a49('0x22')]();};}function saveUpdates(_0x56a9e5,_0x17c467){return function(_0x637ead){if(_0x637ead){return _0x637ead[_0x3a49('0x23')](_0x56a9e5)['then'](function(_0xa74325){return _0xa74325;});}return null;};}function removeEntity(_0x21aede,_0x180e8b){return function(_0x182907){if(_0x182907){return _0x182907[_0x3a49('0x24')]()[_0x3a49('0x25')](function(){var _0xf240bc=_0x182907[_0x3a49('0x26')]({'plain':!![]});var _0x1f2fd7=_0x3a49('0x27');return db[_0x3a49('0x28')][_0x3a49('0x24')]({'where':{'type':_0x1f2fd7,'resourceId':_0xf240bc['id']}})['then'](function(){return _0x182907;});})[_0x3a49('0x25')](function(){_0x21aede[_0x3a49('0x19')](0xcc)[_0x3a49('0x1a')]();});}};}function handleEntityNotFound(_0x553d4d,_0x4f8489){return function(_0x18a7d4){if(!_0x18a7d4){_0x553d4d[_0x3a49('0x18')](0x194);}return _0x18a7d4;};}function handleError(_0x3f2547,_0x253ab4){_0x253ab4=_0x253ab4||0x1f4;return function(_0x18b38b){logger[_0x3a49('0x29')](_0x18b38b[_0x3a49('0x2a')]);if(_0x18b38b[_0x3a49('0x2b')]){delete _0x18b38b['name'];}_0x3f2547[_0x3a49('0x19')](_0x253ab4)[_0x3a49('0x2c')](_0x18b38b);};}exports[_0x3a49('0x2d')]=function(_0xc0b5d0,_0x5b4cc2){var _0x2553f8={},_0x3b1e14={},_0x353923={'count':0x0,'rows':[]};var _0x4787a4=_[_0x3a49('0x2e')](db[_0x3a49('0x2f')][_0x3a49('0x30')],function(_0x320944){return{'name':_0x320944[_0x3a49('0x31')],'type':_0x320944[_0x3a49('0x32')]['key']};});_0x3b1e14[_0x3a49('0x33')]=_[_0x3a49('0x2e')](_0x4787a4,_0x3a49('0x2b'));_0x3b1e14[_0x3a49('0x34')]=_[_0x3a49('0x35')](_0xc0b5d0[_0x3a49('0x34')]);_0x3b1e14[_0x3a49('0x36')]=_[_0x3a49('0x37')](_0x3b1e14['model'],_0x3b1e14[_0x3a49('0x34')]);_0x2553f8['attributes']=_[_0x3a49('0x37')](_0x3b1e14['model'],qs[_0x3a49('0x38')](_0xc0b5d0[_0x3a49('0x34')][_0x3a49('0x38')]));_0x2553f8[_0x3a49('0x39')]=_0x2553f8[_0x3a49('0x39')]['length']?_0x2553f8['attributes']:_0x3b1e14['model'];if(!_0xc0b5d0[_0x3a49('0x34')][_0x3a49('0x3a')]('nolimit')){_0x2553f8[_0x3a49('0x1e')]=qs[_0x3a49('0x1e')](_0xc0b5d0[_0x3a49('0x34')][_0x3a49('0x1e')]);_0x2553f8[_0x3a49('0x1c')]=qs[_0x3a49('0x1c')](_0xc0b5d0['query'][_0x3a49('0x1c')]);}_0x2553f8['order']=qs[_0x3a49('0x3b')](_0xc0b5d0[_0x3a49('0x34')][_0x3a49('0x3b')]);_0x2553f8[_0x3a49('0x3c')]=qs[_0x3a49('0x36')](_[_0x3a49('0x3d')](_0xc0b5d0[_0x3a49('0x34')],_0x3b1e14[_0x3a49('0x36')]),_0x4787a4);if(_0xc0b5d0[_0x3a49('0x34')][_0x3a49('0x3e')]){_0x2553f8[_0x3a49('0x3c')]=_[_0x3a49('0x3f')](_0x2553f8[_0x3a49('0x3c')],{'$or':_[_0x3a49('0x2e')](_0x4787a4,function(_0x300a0e){if(_0x300a0e[_0x3a49('0x32')]!==_0x3a49('0x40')){var _0x500553={};_0x500553[_0x300a0e[_0x3a49('0x2b')]]={'$like':'%'+_0xc0b5d0[_0x3a49('0x34')][_0x3a49('0x3e')]+'%'};return _0x500553;}})});}_0x2553f8=_['merge']({},_0x2553f8,_0xc0b5d0[_0x3a49('0x41')]);var _0x36ad02={'where':_0x2553f8[_0x3a49('0x3c')]};return db[_0x3a49('0x2f')]['count'](_0x36ad02)[_0x3a49('0x25')](function(_0x324b0e){_0x353923[_0x3a49('0x1f')]=_0x324b0e;if(_0xc0b5d0[_0x3a49('0x34')][_0x3a49('0x42')]){_0x2553f8['include']=[{'all':!![]}];}return db[_0x3a49('0x2f')][_0x3a49('0x43')](_0x2553f8);})[_0x3a49('0x25')](function(_0x138769){_0x353923[_0x3a49('0x44')]=_0x138769;return _0x353923;})[_0x3a49('0x25')](respondWithFilteredResult(_0x5b4cc2,_0x2553f8))[_0x3a49('0x45')](handleError(_0x5b4cc2,null));};exports[_0x3a49('0x46')]=function(_0x19f6c2,_0x3ac9bb){var _0x3f1784={'raw':![],'where':{'id':_0x19f6c2['params']['id']}},_0x4d0642={};_0x4d0642[_0x3a49('0x33')]=_['keys'](db['Schedule'][_0x3a49('0x30')]);_0x4d0642[_0x3a49('0x34')]=_[_0x3a49('0x35')](_0x19f6c2[_0x3a49('0x34')]);_0x4d0642[_0x3a49('0x36')]=_[_0x3a49('0x37')](_0x4d0642[_0x3a49('0x33')],_0x4d0642[_0x3a49('0x34')]);_0x3f1784['attributes']=_[_0x3a49('0x37')](_0x4d0642[_0x3a49('0x33')],qs[_0x3a49('0x38')](_0x19f6c2[_0x3a49('0x34')][_0x3a49('0x38')]));_0x3f1784[_0x3a49('0x39')]=_0x3f1784[_0x3a49('0x39')][_0x3a49('0x47')]?_0x3f1784[_0x3a49('0x39')]:_0x4d0642[_0x3a49('0x33')];if(_0x19f6c2['query']['includeAll']){_0x3f1784[_0x3a49('0x48')]=[{'all':!![]}];}_0x3f1784=_['merge']({},_0x3f1784,_0x19f6c2[_0x3a49('0x41')]);return db[_0x3a49('0x2f')][_0x3a49('0x49')](_0x3f1784)[_0x3a49('0x25')](handleEntityNotFound(_0x3ac9bb,null))[_0x3a49('0x25')](respondWithResult(_0x3ac9bb,null))[_0x3a49('0x45')](handleError(_0x3ac9bb,null));};exports[_0x3a49('0x4a')]=function(_0x24bdef,_0x5d9f68){return db['Schedule'][_0x3a49('0x4a')](_0x24bdef[_0x3a49('0x4b')],{})[_0x3a49('0x25')](function(_0x31053b){var _0x52f1d5=_0x24bdef[_0x3a49('0x4c')][_0x3a49('0x26')]({'plain':!![]});if(!_0x52f1d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52f1d5[_0x3a49('0x4d')]===_0x3a49('0x4c')){var _0x25a8ed=_0x31053b[_0x3a49('0x26')]({'plain':!![]});var _0x3c67c5=_0x3a49('0x27');return db[_0x3a49('0x4e')]['find']({'where':{'name':_0x3c67c5,'userProfileId':_0x52f1d5['userProfileId']},'raw':!![]})[_0x3a49('0x25')](function(_0x29d40f){if(_0x29d40f&&_0x29d40f[_0x3a49('0x4f')]===0x0){return db['UserProfileResource'][_0x3a49('0x4a')]({'name':_0x25a8ed[_0x3a49('0x2b')],'resourceId':_0x25a8ed['id'],'type':_0x29d40f[_0x3a49('0x2b')],'sectionId':_0x29d40f['id']},{})['then'](function(){return _0x31053b;});}else{return _0x31053b;}})[_0x3a49('0x45')](function(_0x1bc931){logger[_0x3a49('0x29')](_0x3a49('0x50'),_0x1bc931);throw _0x1bc931;});}return _0x31053b;})[_0x3a49('0x25')](respondWithResult(_0x5d9f68,0xc9))[_0x3a49('0x45')](handleError(_0x5d9f68,null));};exports['update']=function(_0x3f0ed6,_0x500e96){if(_0x3f0ed6[_0x3a49('0x4b')]['id']){delete _0x3f0ed6['body']['id'];}return db[_0x3a49('0x2f')][_0x3a49('0x49')]({'where':{'id':_0x3f0ed6[_0x3a49('0x51')]['id']}})[_0x3a49('0x25')](handleEntityNotFound(_0x500e96,null))[_0x3a49('0x25')](saveUpdates(_0x3f0ed6[_0x3a49('0x4b')],null))[_0x3a49('0x25')](respondWithResult(_0x500e96,null))[_0x3a49('0x45')](handleError(_0x500e96,null));};exports[_0x3a49('0x24')]=function(_0x42d193,_0x46547a){return db['Schedule'][_0x3a49('0x49')]({'where':{'id':_0x42d193[_0x3a49('0x51')]['id']}})['then'](handleEntityNotFound(_0x46547a,null))[_0x3a49('0x25')](removeEntity(_0x46547a,null))[_0x3a49('0x45')](handleError(_0x46547a,null));};exports[_0x3a49('0x52')]=function(_0x293407,_0x415087,_0x447789){var _0x5a0515=require(_0x3a49('0x53'));return db[_0x3a49('0x2f')][_0x3a49('0x49')]({'where':{'id':_0x293407[_0x3a49('0x51')]['id']},'raw':!![]})[_0x3a49('0x25')](handleEntityNotFound(_0x415087,null))[_0x3a49('0x25')](function(){_0x5a0515['run'](_0x293407['params']['id']);})[_0x3a49('0x25')](respondWithStatusCode(_0x415087,null))[_0x3a49('0x45')](handleError(_0x415087,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 36475b7..125eb9c 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 _0x9297=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules'];(function(_0x4392af,_0xec5afe){var _0x9fa8eb=function(_0x41d7a4){while(--_0x41d7a4){_0x4392af['push'](_0x4392af['shift']());}};_0x9fa8eb(++_0xec5afe);}(_0x9297,0x75));var _0x7929=function(_0x318f18,_0x3c2f89){_0x318f18=_0x318f18-0x0;var _0x42b3e5=_0x9297[_0x318f18];return _0x42b3e5;};'use strict';var _=require(_0x7929('0x0'));var util=require(_0x7929('0x1'));var logger=require(_0x7929('0x2'))(_0x7929('0x3'));var moment=require(_0x7929('0x4'));var BPromise=require(_0x7929('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7929('0x6'));var rimraf=require(_0x7929('0x7'));var config=require(_0x7929('0x8'));var attributes=require('./schedule.attributes');module[_0x7929('0x9')]=function(_0x4772b8,_0x416aa4){return _0x4772b8[_0x7929('0xa')](_0x7929('0xb'),attributes,{'tableName':_0x7929('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2d8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','api'];(function(_0x2b5c90,_0xe47c1e){var _0x11a3e3=function(_0x39577e){while(--_0x39577e){_0x2b5c90['push'](_0x2b5c90['shift']());}};_0x11a3e3(++_0xe47c1e);}(_0xf2d8,0x18f));var _0x8f2d=function(_0x41fcc3,_0x4f1d0b){_0x41fcc3=_0x41fcc3-0x0;var _0x34155a=_0xf2d8[_0x41fcc3];return _0x34155a;};'use strict';var _=require(_0x8f2d('0x0'));var util=require(_0x8f2d('0x1'));var logger=require(_0x8f2d('0x2'))(_0x8f2d('0x3'));var moment=require(_0x8f2d('0x4'));var BPromise=require(_0x8f2d('0x5'));var rp=require(_0x8f2d('0x6'));var fs=require('fs');var path=require(_0x8f2d('0x7'));var rimraf=require(_0x8f2d('0x8'));var config=require(_0x8f2d('0x9'));var attributes=require(_0x8f2d('0xa'));module[_0x8f2d('0xb')]=function(_0x18cd9c,_0x125791){return _0x18cd9c['define'](_0x8f2d('0xc'),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 94e1e74..1bfdb74 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 _0xc118=['client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x136073,_0x5a0859){var _0x574474=function(_0xc040ad){while(--_0xc040ad){_0x136073['push'](_0x136073['shift']());}};_0x574474(++_0x5a0859);}(_0xc118,0x15e));var _0x8c11=function(_0xd9b032,_0x37af18){_0xd9b032=_0xd9b032-0x0;var _0x550b42=_0xc118[_0xd9b032];return _0x550b42;};'use strict';var _=require(_0x8c11('0x0'));var util=require(_0x8c11('0x1'));var moment=require(_0x8c11('0x2'));var BPromise=require(_0x8c11('0x3'));var rs=require(_0x8c11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c11('0x5'))['db'];var utils=require(_0x8c11('0x6'));var logger=require(_0x8c11('0x7'))('rpc');var config=require(_0x8c11('0x8'));var jayson=require(_0x8c11('0x9'));var client=jayson[_0x8c11('0xa')][_0x8c11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x398f8f,_0x501512,_0x50973d){return new BPromise(function(_0x345389,_0x5b2349){return client[_0x8c11('0xc')](_0x398f8f,_0x50973d)[_0x8c11('0xd')](function(_0x233773){logger[_0x8c11('0xe')](_0x8c11('0xf'),_0x501512,'request\x20sent');logger[_0x8c11('0x10')](_0x8c11('0x11'),_0x501512,'request\x20sent',JSON[_0x8c11('0x12')](_0x233773));if(_0x233773[_0x8c11('0x13')]){if(_0x233773[_0x8c11('0x13')]['code']===0x1f4){logger[_0x8c11('0x13')]('Schedule,\x20%s,\x20%s',_0x501512,_0x233773[_0x8c11('0x13')]['message']);return _0x5b2349(_0x233773[_0x8c11('0x13')][_0x8c11('0x14')]);}logger['error'](_0x8c11('0xf'),_0x501512,_0x233773[_0x8c11('0x13')][_0x8c11('0x14')]);return _0x345389(_0x233773[_0x8c11('0x13')]['message']);}else{logger[_0x8c11('0xe')](_0x8c11('0xf'),_0x501512,_0x8c11('0x15'));_0x345389(_0x233773[_0x8c11('0x16')][_0x8c11('0x14')]);}})[_0x8c11('0x17')](function(_0x3331b4){logger['error'](_0x8c11('0xf'),_0x501512,_0x3331b4);_0x5b2349(_0x3331b4);});});} \ No newline at end of file +var _0x569a=['stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x4c5f1d,_0x2157bc){var _0x5e1109=function(_0x313aba){while(--_0x313aba){_0x4c5f1d['push'](_0x4c5f1d['shift']());}};_0x5e1109(++_0x2157bc);}(_0x569a,0x17f));var _0xa569=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x569a[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xa569('0x0'));var util=require(_0xa569('0x1'));var moment=require(_0xa569('0x2'));var BPromise=require(_0xa569('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa569('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa569('0x5'))('rpc');var config=require(_0xa569('0x6'));var jayson=require(_0xa569('0x7'));var client=jayson[_0xa569('0x8')][_0xa569('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbc2e77,_0x2d00db,_0x223d3c){return new BPromise(function(_0x2a8c00,_0x5eca17){return client['request'](_0xbc2e77,_0x223d3c)[_0xa569('0xa')](function(_0xfd2298){logger[_0xa569('0xb')](_0xa569('0xc'),_0x2d00db,_0xa569('0xd'));logger[_0xa569('0xe')](_0xa569('0xf'),_0x2d00db,_0xa569('0xd'),JSON[_0xa569('0x10')](_0xfd2298));if(_0xfd2298[_0xa569('0x11')]){if(_0xfd2298['error']['code']===0x1f4){logger[_0xa569('0x11')](_0xa569('0xc'),_0x2d00db,_0xfd2298[_0xa569('0x11')]['message']);return _0x5eca17(_0xfd2298['error'][_0xa569('0x12')]);}logger[_0xa569('0x11')](_0xa569('0xc'),_0x2d00db,_0xfd2298[_0xa569('0x11')][_0xa569('0x12')]);return _0x2a8c00(_0xfd2298[_0xa569('0x11')][_0xa569('0x12')]);}else{logger[_0xa569('0xb')]('Schedule,\x20%s,\x20%s',_0x2d00db,_0xa569('0xd'));_0x2a8c00(_0xfd2298[_0xa569('0x13')][_0xa569('0x12')]);}})[_0xa569('0x14')](function(_0x21f805){logger['error'](_0xa569('0xc'),_0x2d00db,_0x21f805);_0x5eca17(_0x21f805);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index fd1d93f..a7fa556 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 _0x80de=['/:id/download','post','create','/:id','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','show'];(function(_0x41c1db,_0x8cd877){var _0x599517=function(_0x429c67){while(--_0x429c67){_0x41c1db['push'](_0x41c1db['shift']());}};_0x599517(++_0x8cd877);}(_0x80de,0x1ce));var _0xe80d=function(_0x46c315,_0x52cbf2){_0x46c315=_0x46c315-0x0;var _0x1de511=_0x80de[_0x46c315];return _0x1de511;};'use strict';var multer=require('multer');var util=require(_0xe80d('0x0'));var path=require(_0xe80d('0x1'));var timeout=require(_0xe80d('0x2'));var express=require(_0xe80d('0x3'));var router=express[_0xe80d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe80d('0x5'));var interaction=require(_0xe80d('0x6'));var config=require(_0xe80d('0x7'));var controller=require(_0xe80d('0x8'));router[_0xe80d('0x9')]('/',auth[_0xe80d('0xa')](),controller[_0xe80d('0xb')]);router[_0xe80d('0x9')]('/describe',auth[_0xe80d('0xa')](),controller['describe']);router[_0xe80d('0x9')]('/:id',auth[_0xe80d('0xa')](),controller[_0xe80d('0xc')]);router['get'](_0xe80d('0xd'),auth[_0xe80d('0xa')](),controller['download']);router[_0xe80d('0xe')]('/',auth['isAuthenticated'](),controller[_0xe80d('0xf')]);router['put'](_0xe80d('0x10'),auth[_0xe80d('0xa')](),controller['update']);router[_0xe80d('0x11')](_0xe80d('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xe80d('0x12')]=router; \ No newline at end of file +var _0x5bf0=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id/download','download','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x508786,_0x26e090){var _0x2c9780=function(_0x29c8c0){while(--_0x29c8c0){_0x508786['push'](_0x508786['shift']());}};_0x2c9780(++_0x26e090);}(_0x5bf0,0xe2));var _0x05bf=function(_0x559ebc,_0xe759ed){_0x559ebc=_0x559ebc-0x0;var _0x4e20a0=_0x5bf0[_0x559ebc];return _0x4e20a0;};'use strict';var multer=require('multer');var util=require(_0x05bf('0x0'));var path=require(_0x05bf('0x1'));var timeout=require(_0x05bf('0x2'));var express=require(_0x05bf('0x3'));var router=express[_0x05bf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x05bf('0x5'));var config=require(_0x05bf('0x6'));var controller=require(_0x05bf('0x7'));router[_0x05bf('0x8')]('/',auth[_0x05bf('0x9')](),controller[_0x05bf('0xa')]);router['get']('/describe',auth[_0x05bf('0x9')](),controller[_0x05bf('0xb')]);router[_0x05bf('0x8')]('/:id',auth[_0x05bf('0x9')](),controller['show']);router[_0x05bf('0x8')](_0x05bf('0xc'),auth[_0x05bf('0x9')](),controller[_0x05bf('0xd')]);router[_0x05bf('0xe')]('/',auth[_0x05bf('0x9')](),controller[_0x05bf('0xf')]);router[_0x05bf('0x10')](_0x05bf('0x11'),auth[_0x05bf('0x9')](),controller[_0x05bf('0x12')]);router['delete'](_0x05bf('0x11'),auth['isAuthenticated'](),controller[_0x05bf('0x13')]);module[_0x05bf('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 63d46a8..9658e17 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 _0x8a5c=['VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','path','../../config/environment','exports'];(function(_0x99db94,_0x2bbed2){var _0x1c521b=function(_0x4d196d){while(--_0x4d196d){_0x99db94['push'](_0x99db94['shift']());}};_0x1c521b(++_0x2bbed2);}(_0x8a5c,0x136));var _0xc8a5=function(_0x4e520d,_0x56bab1){_0x4e520d=_0x4e520d-0x0;var _0x514112=_0x8a5c[_0x4e520d];return _0x514112;};'use strict';var Sequelize=require(_0xc8a5('0x0'));var moment=require(_0xc8a5('0x1'));var path=require(_0xc8a5('0x2'));var config=require(_0xc8a5('0x3'));module[_0xc8a5('0x4')]={'format':{'type':Sequelize[_0xc8a5('0x5')],'get':function(){return this[_0xc8a5('0x6')](_0xc8a5('0x7'))?path[_0xc8a5('0x8')](this['getDataValue'](_0xc8a5('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xc8a5('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xc8a5('0x9')],'set':function(_0xcee97e){var _0xd6de78=_0xcee97e[_0xc8a5('0xa')](/\\/g,'/');this['setDataValue'](_0xc8a5('0x7'),_0xd6de78);}},'rating':{'type':Sequelize[_0xc8a5('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc8a5('0xb')],'set':function(_0x2c1fe9){this[_0xc8a5('0xc')](_0xc8a5('0xd'),moment()[_0xc8a5('0xe')](_0x2c1fe9,'ms'));this[_0xc8a5('0xc')](_0xc8a5('0xf'),moment());this['setDataValue']('duration',_0x2c1fe9);}},'startedAt':{'type':Sequelize[_0xc8a5('0x10')],'get':function(){return moment(this['getDataValue'](_0xc8a5('0xd')))[_0xc8a5('0x11')](_0xc8a5('0x12'))[_0xc8a5('0x13')]();}},'closedAt':{'type':Sequelize[_0xc8a5('0x10')],'get':function(){return moment(this['getDataValue'](_0xc8a5('0xf')))[_0xc8a5('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xc8a5('0x13')]();}},'createdAt':{'type':Sequelize[_0xc8a5('0x10')],'get':function(){return moment(this[_0xc8a5('0x6')](_0xc8a5('0x14')))[_0xc8a5('0x11')](_0xc8a5('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0xc8a5('0x10')],'get':function(){return moment(this[_0xc8a5('0x6')]('updatedAt'))[_0xc8a5('0x11')](_0xc8a5('0x12'))['toString']();}}}; \ No newline at end of file +var _0x6a0b=['../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize'];(function(_0x1d5623,_0x43841a){var _0x16fe33=function(_0x43cce2){while(--_0x43cce2){_0x1d5623['push'](_0x1d5623['shift']());}};_0x16fe33(++_0x43841a);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x258d71,_0x371e8a){_0x258d71=_0x258d71-0x0;var _0x12ab49=_0x6a0b[_0x258d71];return _0x12ab49;};'use strict';var Sequelize=require(_0xb6a0('0x0'));var moment=require('moment');var path=require('path');var config=require(_0xb6a0('0x1'));module[_0xb6a0('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb6a0('0x3')](_0xb6a0('0x4'))?path[_0xb6a0('0x5')](this[_0xb6a0('0x3')](_0xb6a0('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb6a0('0x6')]},'value':{'type':Sequelize[_0xb6a0('0x6')],'set':function(_0x41bec1){var _0xef4451=_0x41bec1[_0xb6a0('0x7')](/\\/g,'/');this[_0xb6a0('0x8')](_0xb6a0('0x4'),_0xef4451);}},'rating':{'type':Sequelize[_0xb6a0('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb6a0('0x9')],'set':function(_0x4e3aaf){this['setDataValue']('startedAt',moment()['subtract'](_0x4e3aaf,'ms'));this['setDataValue'](_0xb6a0('0xa'),moment());this['setDataValue'](_0xb6a0('0xb'),_0x4e3aaf);}},'startedAt':{'type':Sequelize[_0xb6a0('0xc')],'get':function(){return moment(this['getDataValue'](_0xb6a0('0xd')))[_0xb6a0('0xe')](_0xb6a0('0xf'))[_0xb6a0('0x10')]();}},'closedAt':{'type':Sequelize[_0xb6a0('0xc')],'get':function(){return moment(this[_0xb6a0('0x3')](_0xb6a0('0xa')))[_0xb6a0('0xe')](_0xb6a0('0xf'))[_0xb6a0('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb6a0('0x3')](_0xb6a0('0x11')))[_0xb6a0('0xe')](_0xb6a0('0xf'))[_0xb6a0('0x10')]();}},'updatedAt':{'type':Sequelize[_0xb6a0('0xc')],'get':function(){return moment(this[_0xb6a0('0x3')](_0xb6a0('0x12')))[_0xb6a0('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xb6a0('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2e06cec..56883a5 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 _0xd6d6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2ae118,_0x372434){var _0x5f3d3d=function(_0xedb547){while(--_0xedb547){_0x2ae118['push'](_0x2ae118['shift']());}};_0x5f3d3d(++_0x372434);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x506225,_0xe02b52){_0x506225=_0x506225-0x0;var _0x334256=_0xd6d6[_0x506225];return _0x334256;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x34')](_['map'](_0xde3272,_0x6d6d('0x2b')),['format']);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x553645[_0x6d6d('0x35')]);_0x8a9a84[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x8a9a84['model'],qs[_0x6d6d('0x3a')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3a')]));_0x5273cd[_0x6d6d('0x38')]=_0x5273cd[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x5273cd[_0x6d6d('0x38')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x35')]['limit']);_0x5273cd[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x1f')]);}_0x5273cd['order']=qs['sort'](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3e')]);_0x5273cd[_0x6d6d('0x3f')]=qs['filters'](_[_0x6d6d('0x40')](_0x553645[_0x6d6d('0x35')],_0x8a9a84[_0x6d6d('0x37')]),_0xde3272);if(_0x553645[_0x6d6d('0x35')]['filter']){_0x5273cd['where']=_['merge'](_0x5273cd[_0x6d6d('0x3f')],{'$or':_[_0x6d6d('0x2d')](_0xde3272,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x31')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2b')]]={'$like':'%'+_0x553645[_0x6d6d('0x35')][_0x6d6d('0x41')]+'%'};return _0x253416;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x4b457d={'where':_0x5273cd[_0x6d6d('0x3f')]};return db[_0x6d6d('0x2e')][_0x6d6d('0x20')](_0x4b457d)[_0x6d6d('0x27')](function(_0x32275b){_0x57341f[_0x6d6d('0x20')]=_0x32275b;if(_0x553645[_0x6d6d('0x35')]['includeAll']){_0x5273cd[_0x6d6d('0x44')]=[{'all':!![]}];}return db[_0x6d6d('0x2e')][_0x6d6d('0x45')](_0x5273cd);})[_0x6d6d('0x27')](function(_0xe1aa77){_0x57341f['rows']=_0xe1aa77;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))[_0x6d6d('0x46')](handleError(_0x3edcce,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x33')]=_[_0x6d6d('0x36')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x43c03c[_0x6d6d('0x35')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x37')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x35')]);_0x15bf62[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x43c03c['model'],qs[_0x6d6d('0x3a')](_0x452de2['query'][_0x6d6d('0x3a')]));_0x15bf62[_0x6d6d('0x38')]=_0x15bf62[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x15bf62[_0x6d6d('0x38')]:_0x43c03c[_0x6d6d('0x33')];if(_0x452de2[_0x6d6d('0x35')]['includeAll']){_0x15bf62[_0x6d6d('0x44')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x42')]({},_0x15bf62,_0x452de2[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x47')](_0x15bf62)[_0x6d6d('0x27')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x27')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x46')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x48')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2e')][_0x6d6d('0x48')](_0x5e4c04[_0x6d6d('0x49')],{})[_0x6d6d('0x27')](respondWithResult(_0x4d78bb,0xc9))[_0x6d6d('0x46')](handleError(_0x4d78bb,null));};exports['update']=function(_0x47170d,_0x27b396){if(_0x47170d[_0x6d6d('0x49')]['id']){delete _0x47170d[_0x6d6d('0x49')]['id'];}delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4a')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4b')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4c')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4d')];return db['ScreenRecording'][_0x6d6d('0x47')]({'where':{'id':_0x47170d[_0x6d6d('0x4e')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x27b396,null))[_0x6d6d('0x27')](saveUpdates(_0x47170d[_0x6d6d('0x49')],null))['then'](respondWithResult(_0x27b396,null))[_0x6d6d('0x46')](handleError(_0x27b396,null));};exports[_0x6d6d('0x4f')]=function(_0x45340b,_0x4e4c3e){return db['ScreenRecording'][_0x6d6d('0x4f')]()['then'](respondWithResult(_0x4e4c3e,null))[_0x6d6d('0x46')](handleError(_0x4e4c3e,null));};exports[_0x6d6d('0x50')]=function(_0x32aaae,_0x268361,_0x4777a5){var _0x18e2de=require(_0x6d6d('0x51'));var _0x26c23a=![];var _0x1a8f33={};if(_0x32aaae[_0x6d6d('0x35')]['type']&&_0x32aaae[_0x6d6d('0x35')][_0x6d6d('0x31')]===_0x6d6d('0x52')){_0x1a8f33[_0x6d6d('0x52')]=_0x32aaae[_0x6d6d('0x4e')]['id'];}else{_0x1a8f33['id']=_0x32aaae[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')]['find']({'where':_0x1a8f33,'attributes':['id','value'],'raw':!![]})[_0x6d6d('0x27')](handleEntityNotFound(_0x268361,null))[_0x6d6d('0x27')](function(_0x5cc644){if(_0x5cc644){var _0x3e98a0=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x5cc644[_0x6d6d('0x4d')]);var _0xc6b96e=util[_0x6d6d('0x56')](_0x6d6d('0x57'),_0x3e98a0);if(fs[_0x6d6d('0x58')](_0xc6b96e)){_0x26c23a=!![];return _0x18e2de[_0x6d6d('0x59')](_0xc6b96e,_0x3e98a0,config[_0x6d6d('0x5a')][_0x6d6d('0x5b')])[_0x6d6d('0x27')](function(){return _0x5cc644;});}return _0x5cc644;}})[_0x6d6d('0x27')](function(_0x3065ea){if(_0x3065ea){var _0x50d8dd=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],'server/files/screen_recordings',_0x3065ea[_0x6d6d('0x4d')]);if(!fs[_0x6d6d('0x58')](_0x50d8dd)){throw new db[(_0x6d6d('0x5c'))][(_0x6d6d('0x5d'))](_0x6d6d('0x5e'));}if(_0x3065ea[_0x6d6d('0x5f')]){return _0x268361[_0x6d6d('0x50')](_0x50d8dd,_0x3065ea[_0x6d6d('0x5f')]+path[_0x6d6d('0x60')](_0x50d8dd),function(){if(_0x26c23a){fs['unlink'](_0x50d8dd);}});}else{return _0x268361['download'](_0x50d8dd,function(_0x22c3a1){if(_0x26c23a){fs[_0x6d6d('0x61')](_0x50d8dd);}});}}})[_0x6d6d('0x46')](function(_0x5de33f){if(_0x5de33f['message']===_0x6d6d('0x5e')){_0x268361['status'](0x194)[_0x6d6d('0x2c')]('Not\x20found');}else{return handleError(_0x268361,null);}});};exports[_0x6d6d('0x28')]=function(_0x367a6f,_0x21f14c){return db[_0x6d6d('0x2e')][_0x6d6d('0x47')]({'where':{'id':_0x367a6f[_0x6d6d('0x4e')]['id']}})['then'](function(_0x41e576){if(_['isNil'](_0x41e576)){throw new ReferenceError(_0x6d6d('0x62'));}return _0x41e576;})['then'](function(_0x2a21d8){var _0x3e48f7=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x2a21d8[_0x6d6d('0x4d')]);logger[_0x6d6d('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x3e48f7);if(!_['isNil'](_0x2a21d8[_0x6d6d('0x4d')])&&fs['existsSync'](_0x3e48f7)){logger[_0x6d6d('0x63')]('File:\x20\x22'+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}_0x3e48f7=_0x3e48f7+_0x6d6d('0x66');if(!_[_0x6d6d('0x67')](_0x2a21d8[_0x6d6d('0x4d')])&&fs[_0x6d6d('0x58')](_0x3e48f7)){logger['info'](_0x6d6d('0x68')+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}return _0x2a21d8;})[_0x6d6d('0x27')](function(_0x1ba731){if(!_0x1ba731)throw new InternalError();return _0x1ba731[_0x6d6d('0x28')]();})[_0x6d6d('0x27')](function(){_0x21f14c['status'](0xcc)[_0x6d6d('0x1b')]();})[_0x6d6d('0x46')](handleError(_0x21f14c,null));}; \ No newline at end of file +var _0x7bae=['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','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','find','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x25bb2f,_0x21c4ff){var _0x208b06=function(_0x2ca264){while(--_0x2ca264){_0x25bb2f['push'](_0x25bb2f['shift']());}};_0x208b06(++_0x21c4ff);}(_0x7bae,0x13b));var _0xe7ba=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x7bae[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['differenceBy'](_[_0xe7ba('0x2b')](_0x587c7d,'name'),['format']);_0x369451[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x31')]);_0x369451['filters']=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7[_0xe7ba('0x34')]=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x48c869['query'][_0xe7ba('0x35')]));_0x92fe7[_0xe7ba('0x34')]=_0x92fe7['attributes'][_0xe7ba('0x36')]?_0x92fe7[_0xe7ba('0x34')]:_0x369451[_0xe7ba('0x30')];if(!_0x48c869['query'][_0xe7ba('0x37')](_0xe7ba('0x38'))){_0x92fe7['limit']=qs[_0xe7ba('0x1e')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x92fe7['offset']=qs[_0xe7ba('0x20')](_0x48c869[_0xe7ba('0x31')]['offset']);}_0x92fe7[_0xe7ba('0x39')]=qs[_0xe7ba('0x3a')](_0x48c869[_0xe7ba('0x31')]['sort']);_0x92fe7['where']=qs[_0xe7ba('0x3b')](_[_0xe7ba('0x3c')](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x3b')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')]['filter']){_0x92fe7[_0xe7ba('0x3d')]=_[_0xe7ba('0x3e')](_0x92fe7[_0xe7ba('0x3d')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x5e9619){if(_0x5e9619[_0xe7ba('0x3f')]!==_0xe7ba('0x40')){var _0x46e31a={};_0x46e31a[_0x5e9619[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x41')]+'%'};return _0x46e31a;}})});}_0x92fe7=_[_0xe7ba('0x3e')]({},_0x92fe7,_0x48c869['options']);var _0x3429fa={'where':_0x92fe7[_0xe7ba('0x3d')]};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x3429fa)[_0xe7ba('0x26')](function(_0x3b3abe){_0x4bf5f9[_0xe7ba('0x1f')]=_0x3b3abe;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x42')]){_0x92fe7['include']=[{'all':!![]}];}return db[_0xe7ba('0x2c')][_0xe7ba('0x43')](_0x92fe7);})['then'](function(_0x5dae52){_0x4bf5f9[_0xe7ba('0x44')]=_0x5dae52;return _0x4bf5f9;})[_0xe7ba('0x26')](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x45')](handleError(_0x102925,null));};exports['show']=function(_0x249e1d,_0x82246e){var _0x3569b6={'raw':![],'where':{'id':_0x249e1d[_0xe7ba('0x46')]['id']}},_0x12770d={};_0x12770d['model']=_[_0xe7ba('0x32')](db['ScreenRecording'][_0xe7ba('0x2d')]);_0x12770d[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x249e1d[_0xe7ba('0x31')]);_0x12770d[_0xe7ba('0x3b')]=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],_0x12770d[_0xe7ba('0x31')]);_0x3569b6['attributes']=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x249e1d[_0xe7ba('0x31')][_0xe7ba('0x35')]));_0x3569b6[_0xe7ba('0x34')]=_0x3569b6[_0xe7ba('0x34')][_0xe7ba('0x36')]?_0x3569b6[_0xe7ba('0x34')]:_0x12770d[_0xe7ba('0x30')];if(_0x249e1d['query'][_0xe7ba('0x42')]){_0x3569b6['include']=[{'all':!![]}];}_0x3569b6=_[_0xe7ba('0x3e')]({},_0x3569b6,_0x249e1d[_0xe7ba('0x47')]);return db[_0xe7ba('0x2c')][_0xe7ba('0x48')](_0x3569b6)[_0xe7ba('0x26')](handleEntityNotFound(_0x82246e,null))[_0xe7ba('0x26')](respondWithResult(_0x82246e,null))['catch'](handleError(_0x82246e,null));};exports[_0xe7ba('0x49')]=function(_0x1cc668,_0x3f17ed){return db[_0xe7ba('0x2c')][_0xe7ba('0x49')](_0x1cc668[_0xe7ba('0x4a')],{})[_0xe7ba('0x26')](respondWithResult(_0x3f17ed,0xc9))[_0xe7ba('0x45')](handleError(_0x3f17ed,null));};exports[_0xe7ba('0x25')]=function(_0x1189bd,_0xbe2a32){if(_0x1189bd['body']['id']){delete _0x1189bd[_0xe7ba('0x4a')]['id'];}delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4b')];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4c')];delete _0x1189bd[_0xe7ba('0x4a')]['closedAt'];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4d')];return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x1189bd[_0xe7ba('0x46')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0xbe2a32,null))[_0xe7ba('0x26')](saveUpdates(_0x1189bd['body'],null))['then'](respondWithResult(_0xbe2a32,null))[_0xe7ba('0x45')](handleError(_0xbe2a32,null));};exports[_0xe7ba('0x4e')]=function(_0x285743,_0x5af106){return db[_0xe7ba('0x2c')][_0xe7ba('0x4e')]()[_0xe7ba('0x26')](respondWithResult(_0x5af106,null))[_0xe7ba('0x45')](handleError(_0x5af106,null));};exports[_0xe7ba('0x4f')]=function(_0x6b6f1,_0xf3a41f,_0x5e6612){var _0x2a6fdd=require(_0xe7ba('0x50'));var _0x316b51=![];var _0x5863c8={};if(_0x6b6f1[_0xe7ba('0x31')][_0xe7ba('0x3f')]&&_0x6b6f1['query'][_0xe7ba('0x3f')]===_0xe7ba('0x51')){_0x5863c8['uniqueid']=_0x6b6f1[_0xe7ba('0x46')]['id'];}else{_0x5863c8['id']=_0x6b6f1['params']['id'];}return db[_0xe7ba('0x2c')][_0xe7ba('0x48')]({'where':_0x5863c8,'attributes':['id',_0xe7ba('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xf3a41f,null))[_0xe7ba('0x26')](function(_0x1128be){if(_0x1128be){var _0x314549=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],'server/files/screen_recordings',_0x1128be[_0xe7ba('0x4d')]);var _0x455e50=util[_0xe7ba('0x54')](_0xe7ba('0x55'),_0x314549);if(fs[_0xe7ba('0x56')](_0x455e50)){_0x316b51=!![];return _0x2a6fdd['decryptFile'](_0x455e50,_0x314549,config[_0xe7ba('0x57')][_0xe7ba('0x58')])[_0xe7ba('0x26')](function(){return _0x1128be;});}return _0x1128be;}})[_0xe7ba('0x26')](function(_0x57b23e){if(_0x57b23e){var _0x3e31c1=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],_0xe7ba('0x59'),_0x57b23e[_0xe7ba('0x4d')]);if(!fs[_0xe7ba('0x56')](_0x3e31c1)){throw new db['Sequelize'][(_0xe7ba('0x5a'))](_0xe7ba('0x5b'));}if(_0x57b23e[_0xe7ba('0x5c')]){return _0xf3a41f['download'](_0x3e31c1,_0x57b23e[_0xe7ba('0x5c')]+path[_0xe7ba('0x5d')](_0x3e31c1),function(){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}else{return _0xf3a41f[_0xe7ba('0x4f')](_0x3e31c1,function(_0x45fb0f){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}}})[_0xe7ba('0x45')](function(_0x3351d5){if(_0x3351d5[_0xe7ba('0x5f')]===_0xe7ba('0x5b')){_0xf3a41f[_0xe7ba('0x1b')](0x194)[_0xe7ba('0x60')]('Not\x20found');}else{return handleError(_0xf3a41f,null);}});};exports[_0xe7ba('0x61')]=function(_0x384cea,_0x357af4){return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x384cea['params']['id']}})[_0xe7ba('0x26')](function(_0x194dff){if(_[_0xe7ba('0x62')](_0x194dff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x194dff;})['then'](function(_0x46d06e){var _0x2812af=path[_0xe7ba('0x52')](config['root'],_0xe7ba('0x59'),_0x46d06e[_0xe7ba('0x4d')]);logger[_0xe7ba('0x63')](_0xe7ba('0x64'),_0x2812af);if(!_[_0xe7ba('0x62')](_0x46d06e['value'])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7ba('0x66')](_0x2812af);}_0x2812af=_0x2812af+_0xe7ba('0x67');if(!_[_0xe7ba('0x62')](_0x46d06e[_0xe7ba('0x4d')])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+_0xe7ba('0x68'));fs[_0xe7ba('0x66')](_0x2812af);}return _0x46d06e;})[_0xe7ba('0x26')](function(_0x5a5394){if(!_0x5a5394)throw new InternalError();return _0x5a5394[_0xe7ba('0x61')]();})[_0xe7ba('0x26')](function(){_0x357af4[_0xe7ba('0x1b')](0xcc)[_0xe7ba('0x1c')]();})['catch'](handleError(_0x357af4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 91f4d58..be94513 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 _0x984d=['rimraf','exports','define','ScreenRecording','interactionid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x19ca62,_0x5e90ef){var _0x5907cc=function(_0x10c7d3){while(--_0x10c7d3){_0x19ca62['push'](_0x19ca62['shift']());}};_0x5907cc(++_0x5e90ef);}(_0x984d,0x69));var _0xd984=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x984d[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd984('0x0'))(_0xd984('0x1'));var moment=require('moment');var BPromise=require(_0xd984('0x2'));var rp=require(_0xd984('0x3'));var fs=require('fs');var path=require(_0xd984('0x4'));var rimraf=require(_0xd984('0x5'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xd984('0x6')]=function(_0x427e3b,_0x3c4769){return _0x427e3b[_0xd984('0x7')](_0xd984('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xd984('0x9'),'fields':[_0xd984('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ac6=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','lodash','../../config/logger','api','moment','request-promise'];(function(_0x28572f,_0x180774){var _0x827a7f=function(_0x5a16eb){while(--_0x5a16eb){_0x28572f['push'](_0x28572f['shift']());}};_0x827a7f(++_0x180774);}(_0x9ac6,0x1c3));var _0x69ac=function(_0x19e943,_0x5d2156){_0x19e943=_0x19e943-0x0;var _0x400b3a=_0x9ac6[_0x19e943];return _0x400b3a;};'use strict';var _=require(_0x69ac('0x0'));var util=require('util');var logger=require(_0x69ac('0x1'))(_0x69ac('0x2'));var moment=require(_0x69ac('0x3'));var BPromise=require('bluebird');var rp=require(_0x69ac('0x4'));var fs=require('fs');var path=require(_0x69ac('0x5'));var rimraf=require(_0x69ac('0x6'));var config=require(_0x69ac('0x7'));var attributes=require(_0x69ac('0x8'));module[_0x69ac('0x9')]=function(_0x908beb,_0x317a32){return _0x908beb[_0x69ac('0xa')]('ScreenRecording',attributes,{'tableName':_0x69ac('0xb'),'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 0694cbb..ef02268 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 _0x0af3=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x0af3,0x92));var _0x30af=function(_0x29fee9,_0x188dfe){_0x29fee9=_0x29fee9-0x0;var _0x35de61=_0x0af3[_0x29fee9];return _0x35de61;};'use strict';var _=require(_0x30af('0x0'));var util=require('util');var moment=require(_0x30af('0x1'));var BPromise=require(_0x30af('0x2'));var rs=require(_0x30af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30af('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30af('0x5'))('rpc');var config=require(_0x30af('0x6'));var jayson=require(_0x30af('0x7'));var client=jayson[_0x30af('0x8')][_0x30af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bac2b,_0x38c107,_0x421348){return new BPromise(function(_0x22987e,_0x4fe3f4){return client[_0x30af('0xa')](_0x5bac2b,_0x421348)['then'](function(_0x1016c1){logger['info'](_0x30af('0xb'),_0x38c107,_0x30af('0xc'));logger[_0x30af('0xd')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x38c107,_0x30af('0xc'),JSON[_0x30af('0xe')](_0x1016c1));if(_0x1016c1['error']){if(_0x1016c1[_0x30af('0xf')][_0x30af('0x10')]===0x1f4){logger['error'](_0x30af('0xb'),_0x38c107,_0x1016c1[_0x30af('0xf')][_0x30af('0x11')]);return _0x4fe3f4(_0x1016c1[_0x30af('0xf')]['message']);}logger[_0x30af('0xf')](_0x30af('0xb'),_0x38c107,_0x1016c1[_0x30af('0xf')][_0x30af('0x11')]);return _0x22987e(_0x1016c1[_0x30af('0xf')][_0x30af('0x11')]);}else{logger[_0x30af('0x12')](_0x30af('0xb'),_0x38c107,_0x30af('0xc'));_0x22987e(_0x1016c1[_0x30af('0x13')][_0x30af('0x11')]);}})[_0x30af('0x14')](function(_0x5b74e9){logger[_0x30af('0xf')](_0x30af('0xb'),_0x38c107,_0x5b74e9);_0x4fe3f4(_0x5b74e9);});});} \ No newline at end of file +var _0x4650=['then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xd8a962,_0x5d47fc){var _0x2ee234=function(_0x1221fc){while(--_0x1221fc){_0xd8a962['push'](_0xd8a962['shift']());}};_0x2ee234(++_0x5d47fc);}(_0x4650,0xaa));var _0x0465=function(_0x40b884,_0x38cd2e){_0x40b884=_0x40b884-0x0;var _0x254c4a=_0x4650[_0x40b884];return _0x254c4a;};'use strict';var _=require(_0x0465('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0465('0x1'));var rs=require(_0x0465('0x2'));var fs=require('fs');var Redis=require(_0x0465('0x3'));var db=require(_0x0465('0x4'))['db'];var utils=require(_0x0465('0x5'));var logger=require('../../config/logger')(_0x0465('0x6'));var config=require(_0x0465('0x7'));var jayson=require(_0x0465('0x8'));var client=jayson[_0x0465('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a35b1,_0x26e70c,_0x21bfd2){return new BPromise(function(_0x127cfc,_0x1a9498){return client['request'](_0x3a35b1,_0x21bfd2)[_0x0465('0xa')](function(_0x19086a){logger[_0x0465('0xb')](_0x0465('0xc'),_0x26e70c,_0x0465('0xd'));logger[_0x0465('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x26e70c,_0x0465('0xd'),JSON[_0x0465('0xf')](_0x19086a));if(_0x19086a[_0x0465('0x10')]){if(_0x19086a[_0x0465('0x10')][_0x0465('0x11')]===0x1f4){logger[_0x0465('0x10')](_0x0465('0xc'),_0x26e70c,_0x19086a[_0x0465('0x10')][_0x0465('0x12')]);return _0x1a9498(_0x19086a[_0x0465('0x10')][_0x0465('0x12')]);}logger[_0x0465('0x10')](_0x0465('0xc'),_0x26e70c,_0x19086a['error'][_0x0465('0x12')]);return _0x127cfc(_0x19086a[_0x0465('0x10')][_0x0465('0x12')]);}else{logger['info'](_0x0465('0xc'),_0x26e70c,_0x0465('0xd'));_0x127cfc(_0x19086a[_0x0465('0x13')][_0x0465('0x12')]);}})['catch'](function(_0x432517){logger[_0x0465('0x10')](_0x0465('0xc'),_0x26e70c,_0x432517);_0x1a9498(_0x432517);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 904c4f0..1b0cd6c 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 _0xb61a=['/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','format','logo','extname','single','file','addLogo','server/files/images/logos/','originalname','post','addLogoLogin','%s%s','preferred','favicon','put','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr'];(function(_0x5b1003,_0x4bfeb9){var _0x4a3ca8=function(_0x4f5bde){while(--_0x4f5bde){_0x5b1003['push'](_0x5b1003['shift']());}};_0x4a3ca8(++_0x4bfeb9);}(_0xb61a,0x10b));var _0xab61=function(_0x4c0c46,_0x1e9e29){_0x4c0c46=_0x4c0c46-0x0;var _0x47591e=_0xb61a[_0x4c0c46];return _0x47591e;};'use strict';var multer=require('multer');var util=require(_0xab61('0x0'));var path=require(_0xab61('0x1'));var timeout=require('connect-timeout');var express=require(_0xab61('0x2'));var router=express[_0xab61('0x3')]();var fs_extra=require(_0xab61('0x4'));var auth=require(_0xab61('0x5'));var interaction=require(_0xab61('0x6'));var config=require(_0xab61('0x7'));var controller=require(_0xab61('0x8'));router[_0xab61('0x9')]('/',auth[_0xab61('0xa')](),controller[_0xab61('0xb')]);router[_0xab61('0x9')](_0xab61('0xc'),controller['getDate']);router[_0xab61('0x9')](_0xab61('0xd'),controller[_0xab61('0xe')]);router[_0xab61('0x9')](_0xab61('0xf'),controller['getLogo']);router[_0xab61('0x9')](_0xab61('0x10'),controller[_0xab61('0x11')]);router[_0xab61('0x9')](_0xab61('0x12'),controller[_0xab61('0x13')]);router['get'](_0xab61('0x14'),controller['getPreferred']);router['get'](_0xab61('0x15'),controller[_0xab61('0x16')]);var upload=multer({'storage':multer[_0xab61('0x17')]({'destination':function(_0x426a83,_0x2191a3,_0x2ff68c){_0x2ff68c(null,path[_0xab61('0x18')](config[_0xab61('0x19')],'server/files/images/logos/'));},'filename':function(_0x47833f,_0x26af6a,_0x1c23fd){_0x1c23fd(null,util[_0xab61('0x1a')]('%s%s',_0xab61('0x1b'),path[_0xab61('0x1c')](_0x26af6a['originalname'])));}})});router['post'](_0xab61('0xf'),upload[_0xab61('0x1d')](_0xab61('0x1e')),controller[_0xab61('0x1f')]);var upload=multer({'storage':multer[_0xab61('0x17')]({'destination':function(_0x10cbfc,_0xcf1dcc,_0x33ac01){_0x33ac01(null,path[_0xab61('0x18')](config[_0xab61('0x19')],_0xab61('0x20')));},'filename':function(_0x396086,_0x311050,_0x2d66a3){_0x2d66a3(null,util[_0xab61('0x1a')]('%s%s','logologin',path[_0xab61('0x1c')](_0x311050[_0xab61('0x21')])));}})});router[_0xab61('0x22')]('/:id/logo_login',upload['single'](_0xab61('0x1e')),controller[_0xab61('0x23')]);var upload=multer({'storage':multer[_0xab61('0x17')]({'destination':function(_0x1b0ffa,_0x2dc36f,_0x2b0ebc){_0x2b0ebc(null,path[_0xab61('0x18')](config[_0xab61('0x19')],_0xab61('0x20')));},'filename':function(_0x554a0d,_0x4c801f,_0x5bc6d8){_0x5bc6d8(null,util[_0xab61('0x1a')](_0xab61('0x24'),_0xab61('0x25'),path[_0xab61('0x1c')](_0x4c801f[_0xab61('0x21')])));}})});router['post'](_0xab61('0x14'),upload['single'](_0xab61('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0xab61('0x17')]({'destination':function(_0xaec9d8,_0x41b888,_0x327fd6){_0x327fd6(null,path[_0xab61('0x18')](config[_0xab61('0x19')],'server/files/images/logos/'));},'filename':function(_0x48d10b,_0xea821e,_0xfa59e9){_0xfa59e9(null,util['format'](_0xab61('0x24'),_0xab61('0x26'),path[_0xab61('0x1c')](_0xea821e['originalname'])));}})});router[_0xab61('0x22')]('/:id/favicon',upload[_0xab61('0x1d')](_0xab61('0x1e')),controller['addFavicon']);router[_0xab61('0x27')](_0xab61('0xd'),auth[_0xab61('0xa')](),controller['update']);module[_0xab61('0x28')]=router; \ No newline at end of file +var _0x2c96=['./setting.controller','index','getDate','get','/:id','show','getLogo','/:id/logo_login','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','single','file','addLogo','root','originalname','post','preferred','addFavicon','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x282442,_0x135555){var _0xf97807=function(_0x345ce3){while(--_0x345ce3){_0x282442['push'](_0x282442['shift']());}};_0xf97807(++_0x135555);}(_0x2c96,0x1c0));var _0x62c9=function(_0x15bdde,_0x3ad7be){_0x15bdde=_0x15bdde-0x0;var _0x1d4772=_0x2c96[_0x15bdde];return _0x1d4772;};'use strict';var multer=require(_0x62c9('0x0'));var util=require(_0x62c9('0x1'));var path=require('path');var timeout=require(_0x62c9('0x2'));var express=require(_0x62c9('0x3'));var router=express[_0x62c9('0x4')]();var fs_extra=require(_0x62c9('0x5'));var auth=require(_0x62c9('0x6'));var interaction=require(_0x62c9('0x7'));var config=require('../../config/environment');var controller=require(_0x62c9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x62c9('0x9')]);router['get']('/now',controller[_0x62c9('0xa')]);router[_0x62c9('0xb')](_0x62c9('0xc'),controller[_0x62c9('0xd')]);router[_0x62c9('0xb')]('/:id/logo',controller[_0x62c9('0xe')]);router[_0x62c9('0xb')](_0x62c9('0xf'),controller['getLogoLogin']);router[_0x62c9('0xb')]('/:id/gdpr',controller[_0x62c9('0x10')]);router[_0x62c9('0xb')](_0x62c9('0x11'),controller['getPreferred']);router[_0x62c9('0xb')](_0x62c9('0x12'),controller[_0x62c9('0x13')]);var upload=multer({'storage':multer[_0x62c9('0x14')]({'destination':function(_0x587f87,_0x2ff106,_0x4ec6f1){_0x4ec6f1(null,path[_0x62c9('0x15')](config['root'],_0x62c9('0x16')));},'filename':function(_0x2dea37,_0x3c79e1,_0x4bd991){_0x4bd991(null,util[_0x62c9('0x17')](_0x62c9('0x18'),_0x62c9('0x19'),path[_0x62c9('0x1a')](_0x3c79e1['originalname'])));}})});router['post']('/:id/logo',upload[_0x62c9('0x1b')](_0x62c9('0x1c')),controller[_0x62c9('0x1d')]);var upload=multer({'storage':multer[_0x62c9('0x14')]({'destination':function(_0x2e48eb,_0x105a36,_0x756225){_0x756225(null,path[_0x62c9('0x15')](config[_0x62c9('0x1e')],'server/files/images/logos/'));},'filename':function(_0x390eb3,_0x4d7d6a,_0x23f859){_0x23f859(null,util[_0x62c9('0x17')](_0x62c9('0x18'),'logologin',path[_0x62c9('0x1a')](_0x4d7d6a[_0x62c9('0x1f')])));}})});router[_0x62c9('0x20')](_0x62c9('0xf'),upload[_0x62c9('0x1b')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x62c9('0x14')]({'destination':function(_0x38733d,_0x100dfe,_0x58143d){_0x58143d(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x5f1f8b,_0x324256,_0x346f2d){_0x346f2d(null,util[_0x62c9('0x17')]('%s%s',_0x62c9('0x21'),path[_0x62c9('0x1a')](_0x324256['originalname'])));}})});router[_0x62c9('0x20')]('/:id/preferred',upload[_0x62c9('0x1b')](_0x62c9('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28d835,_0x3c3ef9,_0x10cae8){_0x10cae8(null,path[_0x62c9('0x15')](config[_0x62c9('0x1e')],_0x62c9('0x16')));},'filename':function(_0x426e04,_0xa87794,_0xec4f93){_0xec4f93(null,util['format'](_0x62c9('0x18'),'favicon',path[_0x62c9('0x1a')](_0xa87794[_0x62c9('0x1f')])));}})});router['post']('/:id/favicon',upload['single'](_0x62c9('0x1c')),controller[_0x62c9('0x22')]);router['put']('/:id',auth[_0x62c9('0x23')](),controller[_0x62c9('0x24')]);module[_0x62c9('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7e1b1a0..badcbb9 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 _0x5de1=['alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN'];(function(_0x2cf207,_0x527404){var _0x48137f=function(_0x3b7111){while(--_0x3b7111){_0x2cf207['push'](_0x2cf207['shift']());}};_0x48137f(++_0x527404);}(_0x5de1,0x8e));var _0x15de=function(_0xc4c1ec,_0x5d8749){_0xc4c1ec=_0xc4c1ec-0x0;var _0x394982=_0x5de1[_0xc4c1ec];return _0x394982;};'use strict';var Sequelize=require(_0x15de('0x0'));module[_0x15de('0x1')]={'min_internal':{'type':Sequelize[_0x15de('0x2')](0xb),'unique':_0x15de('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x15de('0x2')](0xb),'unique':_0x15de('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x15de('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x15de('0x5')},'logo':{'type':Sequelize[_0x15de('0x6')]},'defaultLogo':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x15de('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x15de('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x15de('0x6')]},'turnaddr':{'type':Sequelize[_0x15de('0x6')]},'turnusername':{'type':Sequelize[_0x15de('0x6')]},'turnpassword':{'type':Sequelize[_0x15de('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x15de('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x15de('0x6')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x15de('0x6')],'defaultValue':_0x15de('0x8')},'chatTimeout':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x15de('0x6')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x15de('0x6')]},'defaultFavicon':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x15de('0x6')]},'sentiment':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x15de('0x2')]},'sentimentRegion':{'type':Sequelize[_0x15de('0x6')]},'language':{'type':Sequelize[_0x15de('0x6')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x15de('0x2')](0x2)[_0x15de('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x15de('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x15de('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x15de('0x2')](0x2)[_0x15de('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x15de('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x15de('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x15de('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x21ea=['INTEGER','alternate','UNSIGNED','sequelize','exports','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x21ea,0xd3));var _0xa21e=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x21ea[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xa21e('0x0'));module[_0xa21e('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa21e('0x2')],'defaultValue':_0xa21e('0x3')},'logo':{'type':Sequelize[_0xa21e('0x2')]},'defaultLogo':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa21e('0x2')]},'defaultLoginLogo':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa21e('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa21e('0x2')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xa21e('0x2')]},'turnpassword':{'type':Sequelize[_0xa21e('0x2')]},'pageTitle':{'type':Sequelize[_0xa21e('0x2')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa21e('0x5')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xa21e('0x2')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa21e('0x2')],'defaultValue':_0xa21e('0x6')},'chatTimeout':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa21e('0x2')]},'defaultFavicon':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa21e('0x5')]},'transcribeRegion':{'type':Sequelize[_0xa21e('0x2')]},'sentiment':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa21e('0x5')]},'sentimentRegion':{'type':Sequelize[_0xa21e('0x2')]},'language':{'type':Sequelize[_0xa21e('0x2')]},'bucket':{'type':Sequelize[_0xa21e('0x2')]},'googleSsoEnabled':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xa21e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xa21e('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa21e('0x5')](0x2)[_0xa21e('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xa21e('0x5')](0x2)[_0xa21e('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xa21e('0x5')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xa21e('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 4880576..757a1ca 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 _0x0fd4=['merge','options','find','body','params','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','default_loginLogo.svg','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','destroy','name','send','map','Setting','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','rawAttributes'];(function(_0x45de25,_0x1fa0a2){var _0x783497=function(_0x3b6858){while(--_0x3b6858){_0x45de25['push'](_0x45de25['shift']());}};_0x783497(++_0x1fa0a2);}(_0x0fd4,0xa1));var _0x40fd=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x0fd4[_0x2f0057];return _0x17f2c3;};'use strict';var emlformat=require(_0x40fd('0x0'));var rimraf=require(_0x40fd('0x1'));var zipdir=require(_0x40fd('0x2'));var jsonpatch=require(_0x40fd('0x3'));var rp=require(_0x40fd('0x4'));var moment=require(_0x40fd('0x5'));var BPromise=require(_0x40fd('0x6'));var Mustache=require(_0x40fd('0x7'));var util=require(_0x40fd('0x8'));var path=require(_0x40fd('0x9'));var sox=require(_0x40fd('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40fd('0xb'));var _=require('lodash');var squel=require(_0x40fd('0xc'));var crypto=require('crypto');var jsforce=require(_0x40fd('0xd'));var deskjs=require(_0x40fd('0xe'));var toCsv=require(_0x40fd('0xf'));var querystring=require(_0x40fd('0x10'));var Papa=require(_0x40fd('0x11'));var Redis=require(_0x40fd('0x12'));var authService=require(_0x40fd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x40fd('0x14'));var hardwareService=require(_0x40fd('0x15'));var logger=require(_0x40fd('0x16'))(_0x40fd('0x17'));var utils=require(_0x40fd('0x18'));var config=require(_0x40fd('0x19'));var licenseUtil=require(_0x40fd('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x40fd('0x1b'));var client=jayson[_0x40fd('0x1c')][_0x40fd('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5edbb7,_0x3a426f,_0x2e87d7,_0x1dc632){return new BPromise(function(_0x2d11a5,_0x2ca35f){var _0x1b97fa=_0x1dc632||client;return _0x1b97fa['request'](_0x5edbb7,_0x2e87d7)[_0x40fd('0x1e')](function(_0x37dbec){logger[_0x40fd('0x1f')](_0x40fd('0x20'),_0x3a426f,'request\x20sent');logger[_0x40fd('0x21')](_0x40fd('0x22'),_0x3a426f,_0x40fd('0x23'),JSON[_0x40fd('0x24')](_0x37dbec));if(_0x37dbec[_0x40fd('0x25')]){if(_0x37dbec['error'][_0x40fd('0x26')]===0x1f4){logger['error'](_0x40fd('0x20'),_0x3a426f,_0x37dbec[_0x40fd('0x25')][_0x40fd('0x27')]);return _0x2ca35f(_0x37dbec[_0x40fd('0x25')][_0x40fd('0x27')]);}logger['error'](_0x40fd('0x20'),_0x3a426f,_0x37dbec[_0x40fd('0x25')][_0x40fd('0x27')]);return _0x2d11a5(_0x37dbec['error']['message']);}else{logger['info'](_0x40fd('0x20'),_0x3a426f,_0x40fd('0x23'));_0x2d11a5(_0x37dbec[_0x40fd('0x28')]['message']);}})[_0x40fd('0x29')](function(_0x57a9e4){logger[_0x40fd('0x25')](_0x40fd('0x20'),_0x3a426f,_0x57a9e4);_0x2ca35f(_0x57a9e4);});});}function respondWithStatusCode(_0x133515,_0x51d108){_0x51d108=_0x51d108||0xcc;return function(_0x52679d){if(_0x52679d){return _0x133515[_0x40fd('0x2a')](_0x51d108);}return _0x133515[_0x40fd('0x2b')](_0x51d108)[_0x40fd('0x2c')]();};}function respondWithResult(_0x1166af,_0x53f592){_0x53f592=_0x53f592||0xc8;return function(_0x467043){if(_0x467043){return _0x1166af[_0x40fd('0x2b')](_0x53f592)[_0x40fd('0x2d')](_0x467043);}};}function respondWithFilteredResult(_0x5a4985,_0x4874b7){return function(_0xdc99cb){if(_0xdc99cb){var _0x15a791=typeof _0x4874b7[_0x40fd('0x2e')]===_0x40fd('0x2f')&&typeof _0x4874b7[_0x40fd('0x30')]==='undefined';var _0x1b2f2d=_0xdc99cb[_0x40fd('0x31')];var _0x312744=_0x15a791?0x0:_0x4874b7[_0x40fd('0x2e')];var _0x42884a=_0x15a791?_0xdc99cb['count']:_0x4874b7[_0x40fd('0x2e')]+_0x4874b7['limit'];var _0x370b64;if(_0x42884a>=_0x1b2f2d){_0x42884a=_0x1b2f2d;_0x370b64=0xc8;}else{_0x370b64=0xce;}_0x5a4985[_0x40fd('0x2b')](_0x370b64);return _0x5a4985[_0x40fd('0x32')]('Content-Range',_0x312744+'-'+_0x42884a+'/'+_0x1b2f2d)[_0x40fd('0x2d')](_0xdc99cb);}return null;};}function patchUpdates(_0x5e81e2){return function(_0x27a4ea){try{jsonpatch['apply'](_0x27a4ea,_0x5e81e2,!![]);}catch(_0x54408f){return BPromise['reject'](_0x54408f);}return _0x27a4ea[_0x40fd('0x33')]();};}function saveUpdates(_0x2fcd75,_0x19eb2d){return function(_0x16368d){if(_0x16368d){return _0x16368d[_0x40fd('0x34')](_0x2fcd75)[_0x40fd('0x1e')](function(_0x434172){return _0x434172;});}return null;};}function removeEntity(_0x355db9,_0x2fe31c){return function(_0x94494){if(_0x94494){return _0x94494[_0x40fd('0x35')]()[_0x40fd('0x1e')](function(){_0x355db9['status'](0xcc)[_0x40fd('0x2c')]();});}};}function handleEntityNotFound(_0x52c59e,_0x352a66){return function(_0x398325){if(!_0x398325){_0x52c59e[_0x40fd('0x2a')](0x194);}return _0x398325;};}function handleError(_0x5e06a7,_0x368e31){_0x368e31=_0x368e31||0x1f4;return function(_0x286ced){logger[_0x40fd('0x25')](_0x286ced['stack']);if(_0x286ced[_0x40fd('0x36')]){delete _0x286ced['name'];}_0x5e06a7[_0x40fd('0x2b')](_0x368e31)[_0x40fd('0x37')](_0x286ced);};}exports['index']=function(_0x4413d2,_0x12ccc4){var _0x55c108={},_0x5c60e4={},_0x3dd394={'count':0x0,'rows':[]};var _0x1e7baf=_[_0x40fd('0x38')](db[_0x40fd('0x39')]['rawAttributes'],function(_0x47d3d2){return{'name':_0x47d3d2['fieldName'],'type':_0x47d3d2['type']['key']};});_0x5c60e4[_0x40fd('0x3a')]=_[_0x40fd('0x38')](_0x1e7baf,_0x40fd('0x36'));_0x5c60e4[_0x40fd('0x3b')]=_[_0x40fd('0x3c')](_0x4413d2[_0x40fd('0x3b')]);_0x5c60e4[_0x40fd('0x3d')]=_[_0x40fd('0x3e')](_0x5c60e4['model'],_0x5c60e4[_0x40fd('0x3b')]);_0x55c108['attributes']=_[_0x40fd('0x3e')](_0x5c60e4['model'],qs['fields'](_0x4413d2['query'][_0x40fd('0x3f')]));_0x55c108[_0x40fd('0x40')]=_0x55c108[_0x40fd('0x40')][_0x40fd('0x41')]?_0x55c108['attributes']:_0x5c60e4[_0x40fd('0x3a')];if(!_0x4413d2[_0x40fd('0x3b')][_0x40fd('0x42')](_0x40fd('0x43'))){_0x55c108['limit']=qs[_0x40fd('0x30')](_0x4413d2['query'][_0x40fd('0x30')]);_0x55c108[_0x40fd('0x2e')]=qs[_0x40fd('0x2e')](_0x4413d2[_0x40fd('0x3b')]['offset']);}_0x55c108[_0x40fd('0x44')]=qs[_0x40fd('0x45')](_0x4413d2[_0x40fd('0x3b')][_0x40fd('0x45')]);_0x55c108[_0x40fd('0x46')]=qs['filters'](_[_0x40fd('0x47')](_0x4413d2['query'],_0x5c60e4[_0x40fd('0x3d')]),_0x1e7baf);if(_0x4413d2[_0x40fd('0x3b')][_0x40fd('0x48')]){_0x55c108[_0x40fd('0x46')]=_['merge'](_0x55c108[_0x40fd('0x46')],{'$or':_['map'](_0x1e7baf,function(_0x442112){if(_0x442112['type']!==_0x40fd('0x49')){var _0x277050={};_0x277050[_0x442112['name']]={'$like':'%'+_0x4413d2[_0x40fd('0x3b')][_0x40fd('0x48')]+'%'};return _0x277050;}})});}_0x55c108=_['merge']({},_0x55c108,_0x4413d2['options']);var _0x2323a3={'where':_0x55c108['where']};return db[_0x40fd('0x39')][_0x40fd('0x31')](_0x2323a3)[_0x40fd('0x1e')](function(_0x5c1243){_0x3dd394['count']=_0x5c1243;if(_0x4413d2[_0x40fd('0x3b')][_0x40fd('0x4a')]){_0x55c108[_0x40fd('0x4b')]=[{'all':!![]}];}return db[_0x40fd('0x39')][_0x40fd('0x4c')](_0x55c108);})['then'](function(_0x38194b){_0x3dd394[_0x40fd('0x4d')]=_0x38194b;return _0x3dd394;})[_0x40fd('0x1e')](respondWithFilteredResult(_0x12ccc4,_0x55c108))[_0x40fd('0x29')](handleError(_0x12ccc4,null));};exports['show']=function(_0x1124b9,_0x390e19){var _0x44b03a={'raw':![],'where':{'id':_0x1124b9['params']['id']}},_0x31aaa1={};_0x31aaa1[_0x40fd('0x3a')]=_['keys'](db[_0x40fd('0x39')][_0x40fd('0x4e')]);_0x31aaa1[_0x40fd('0x3b')]=_[_0x40fd('0x3c')](_0x1124b9[_0x40fd('0x3b')]);_0x31aaa1[_0x40fd('0x3d')]=_['intersection'](_0x31aaa1[_0x40fd('0x3a')],_0x31aaa1[_0x40fd('0x3b')]);_0x44b03a['attributes']=_['intersection'](_0x31aaa1['model'],qs[_0x40fd('0x3f')](_0x1124b9[_0x40fd('0x3b')]['fields']));_0x44b03a['attributes']=_0x44b03a['attributes']['length']?_0x44b03a[_0x40fd('0x40')]:_0x31aaa1[_0x40fd('0x3a')];if(_0x1124b9[_0x40fd('0x3b')][_0x40fd('0x4a')]){_0x44b03a['include']=[{'all':!![]}];}_0x44b03a=_[_0x40fd('0x4f')]({},_0x44b03a,_0x1124b9[_0x40fd('0x50')]);return db[_0x40fd('0x39')][_0x40fd('0x51')](_0x44b03a)['then'](handleEntityNotFound(_0x390e19,null))[_0x40fd('0x1e')](respondWithResult(_0x390e19,null))[_0x40fd('0x29')](handleError(_0x390e19,null));};exports[_0x40fd('0x34')]=function(_0x9add9d,_0x23b16e){if(_0x9add9d[_0x40fd('0x52')]['id']){delete _0x9add9d[_0x40fd('0x52')]['id'];}return db[_0x40fd('0x39')][_0x40fd('0x51')]({'where':{'id':_0x9add9d[_0x40fd('0x53')]['id']}})['then'](handleEntityNotFound(_0x23b16e,null))['then'](saveUpdates(_0x9add9d[_0x40fd('0x52')],null))['then'](respondWithResult(_0x23b16e,null))[_0x40fd('0x29')](handleError(_0x23b16e,null));};exports[_0x40fd('0x54')]=function(_0x5567c4,_0xa1c5e9,_0x10d997){if(_0x5567c4[_0x40fd('0x55')]&&_0x5567c4[_0x40fd('0x55')][_0x40fd('0x56')]){_0x5567c4[_0x40fd('0x52')][_0x40fd('0x57')]=_0x5567c4[_0x40fd('0x55')]['filename'];}return db[_0x40fd('0x39')][_0x40fd('0x51')]({'where':{'id':_0x5567c4[_0x40fd('0x53')]['id']}})[_0x40fd('0x1e')](handleEntityNotFound(_0xa1c5e9,null))[_0x40fd('0x1e')](saveUpdates(_0x5567c4[_0x40fd('0x52')],null))['then'](respondWithResult(_0xa1c5e9,null))[_0x40fd('0x29')](handleError(_0xa1c5e9,null));};exports[_0x40fd('0x58')]=function(_0x196b85,_0x445443,_0x16894d){if(_0x196b85[_0x40fd('0x55')]&&_0x196b85[_0x40fd('0x55')][_0x40fd('0x56')]){_0x196b85['body']['loginLogo']=_0x196b85['file']['filename'];}return db[_0x40fd('0x39')][_0x40fd('0x51')]({'where':{'id':_0x196b85['params']['id']}})[_0x40fd('0x1e')](handleEntityNotFound(_0x445443,null))[_0x40fd('0x1e')](saveUpdates(_0x196b85[_0x40fd('0x52')],null))[_0x40fd('0x1e')](respondWithResult(_0x445443,null))['catch'](handleError(_0x445443,null));};var utilLicense=require(_0x40fd('0x1a'));exports[_0x40fd('0x59')]=function(_0x362a22,_0x33c19e,_0x497c68){var _0x3e6dec=_0x40fd('0x5a');var _0xdf3407={'custom':![]};return utilLicense[_0x40fd('0x5b')]()[_0x40fd('0x1e')](function(_0x56cdab){if(_0x56cdab){_0xdf3407=_0x56cdab;}return db[_0x40fd('0x39')][_0x40fd('0x51')]({'where':{'id':_0x362a22[_0x40fd('0x53')]['id']},'attributes':['logo',_0x40fd('0x5c'),_0x40fd('0x5d'),'favicon','defaultLogo',_0x40fd('0x5e'),_0x40fd('0x5f'),_0x40fd('0x60')],'raw':!![]});})[_0x40fd('0x1e')](handleEntityNotFound(_0x33c19e,null))['then'](function(_0x695d9f){if(_0x695d9f){var _0x1a68d7=_0x695d9f[_0x40fd('0x57')]&&fs[_0x40fd('0x61')](path[_0x40fd('0x62')](config['root'],_0x3e6dec,_[_0x40fd('0x63')](_0x695d9f[_0x40fd('0x57')])))?path[_0x40fd('0x62')](config[_0x40fd('0x64')],_0x3e6dec,_['toLower'](_0x695d9f['logo'])):path[_0x40fd('0x62')](config[_0x40fd('0x64')],_0x3e6dec,_['toLower']('default_logo.svg'));var _0x1c9114=_0x40fd('0x65')+_[_0x40fd('0x66')](_0x40fd('0x57'));if(_0x695d9f[_0x1c9114]||!_0xdf3407[_0x40fd('0x67')]){_0x1a68d7=path[_0x40fd('0x62')](config[_0x40fd('0x64')],_0x3e6dec,_[_0x40fd('0x63')](_0x40fd('0x68')));}if(!fs['existsSync'](_0x1a68d7)){throw new db[(_0x40fd('0x69'))][(_0x40fd('0x6a'))](_[_0x40fd('0x66')](_0x40fd('0x57'))+_0x40fd('0x6b'));}return _0x33c19e[_0x40fd('0x6c')](_0x1a68d7);}})[_0x40fd('0x29')](handleError(_0x33c19e,null));};var utilLicense=require('../../config/license/util');exports[_0x40fd('0x6d')]=function(_0x1abda2,_0x257a6c,_0x5cf59b){var _0x34cd10=_0x40fd('0x5a');var _0x3e1e97={'custom':![]};return utilLicense['getLicense']()[_0x40fd('0x1e')](function(_0x4e9335){if(_0x4e9335){_0x3e1e97=_0x4e9335;}return db[_0x40fd('0x39')]['find']({'where':{'id':_0x1abda2[_0x40fd('0x53')]['id']},'attributes':['logo','loginLogo',_0x40fd('0x5d'),_0x40fd('0x6e'),'defaultLogo',_0x40fd('0x5e'),_0x40fd('0x5f'),_0x40fd('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x257a6c,null))[_0x40fd('0x1e')](function(_0x581635){if(_0x581635){var _0x49c18b=_0x581635[_0x40fd('0x5c')]&&fs['existsSync'](path[_0x40fd('0x62')](config[_0x40fd('0x64')],_0x34cd10,_[_0x40fd('0x63')](_0x581635[_0x40fd('0x5c')])))?path['join'](config[_0x40fd('0x64')],_0x34cd10,_[_0x40fd('0x63')](_0x581635[_0x40fd('0x5c')])):path['join'](config[_0x40fd('0x64')],_0x34cd10,_['toLower'](_0x40fd('0x6f')));var _0x16fa16=_0x40fd('0x65')+_[_0x40fd('0x66')]('loginLogo');if(_0x581635[_0x16fa16]||!_0x3e1e97[_0x40fd('0x67')]){_0x49c18b=path[_0x40fd('0x62')](config[_0x40fd('0x64')],_0x34cd10,_[_0x40fd('0x63')]('default_loginLogo.svg'));}if(!fs[_0x40fd('0x61')](_0x49c18b)){throw new db['Sequelize'][(_0x40fd('0x6a'))](_[_0x40fd('0x66')](_0x40fd('0x5c'))+'\x20not\x20found');}return _0x257a6c[_0x40fd('0x6c')](_0x49c18b);}})[_0x40fd('0x29')](handleError(_0x257a6c,null));};exports['gdpr']=function(_0x3038f9,_0x56475c){return db[_0x40fd('0x39')][_0x40fd('0x51')]({'where':{'id':_0x3038f9[_0x40fd('0x53')]['id']},'attributes':['securePassword']})[_0x40fd('0x1e')](respondWithResult(_0x56475c,null))['catch'](handleError(_0x56475c,null));};exports[_0x40fd('0x70')]=function(_0x5ab188,_0x5b527b,_0xd6bb4c){if(_0x5ab188[_0x40fd('0x55')]&&_0x5ab188[_0x40fd('0x55')]['filename']){_0x5ab188[_0x40fd('0x52')][_0x40fd('0x5d')]=_0x5ab188[_0x40fd('0x55')][_0x40fd('0x56')];}return db['Setting'][_0x40fd('0x51')]({'where':{'id':_0x5ab188[_0x40fd('0x53')]['id']}})[_0x40fd('0x1e')](handleEntityNotFound(_0x5b527b,null))['then'](saveUpdates(_0x5ab188['body'],null))[_0x40fd('0x1e')](respondWithResult(_0x5b527b,null))['catch'](handleError(_0x5b527b,null));};var utilLicense=require(_0x40fd('0x1a'));exports[_0x40fd('0x71')]=function(_0x257e11,_0x2e87aa,_0xcaa4ca){var _0x49103f=_0x40fd('0x5a');var _0x5c92a1={'custom':![]};return utilLicense[_0x40fd('0x5b')]()['then'](function(_0xdef38f){if(_0xdef38f){_0x5c92a1=_0xdef38f;}return db[_0x40fd('0x39')][_0x40fd('0x51')]({'where':{'id':_0x257e11[_0x40fd('0x53')]['id']},'attributes':[_0x40fd('0x57'),_0x40fd('0x5c'),'preferred','favicon','defaultLogo',_0x40fd('0x5e'),_0x40fd('0x5f'),_0x40fd('0x60')],'raw':!![]});})[_0x40fd('0x1e')](handleEntityNotFound(_0x2e87aa,null))[_0x40fd('0x1e')](function(_0x40ec78){if(_0x40ec78){var _0xab08c2=_0x40ec78[_0x40fd('0x5d')]&&fs[_0x40fd('0x61')](path[_0x40fd('0x62')](config[_0x40fd('0x64')],_0x49103f,_[_0x40fd('0x63')](_0x40ec78[_0x40fd('0x5d')])))?path[_0x40fd('0x62')](config['root'],_0x49103f,_[_0x40fd('0x63')](_0x40ec78[_0x40fd('0x5d')])):path['join'](config[_0x40fd('0x64')],_0x49103f,_[_0x40fd('0x63')](_0x40fd('0x72')));var _0x28b9f8=_0x40fd('0x65')+_[_0x40fd('0x66')](_0x40fd('0x5d'));if(_0x40ec78[_0x28b9f8]||!_0x5c92a1[_0x40fd('0x67')]||!_0x5c92a1[_0x40fd('0x5d')]){_0xab08c2=path[_0x40fd('0x62')](config[_0x40fd('0x64')],_0x49103f,_[_0x40fd('0x63')](_0x40fd('0x72')));}if(!fs[_0x40fd('0x61')](_0xab08c2)){throw new db[(_0x40fd('0x69'))]['ValidationError'](_['upperFirst'](_0x40fd('0x5d'))+'\x20not\x20found');}return _0x2e87aa['download'](_0xab08c2);}})['catch'](handleError(_0x2e87aa,null));};exports[_0x40fd('0x73')]=function(_0xfc725d,_0x48e3df,_0x351576){if(_0xfc725d[_0x40fd('0x55')]&&_0xfc725d[_0x40fd('0x55')][_0x40fd('0x56')]){_0xfc725d['body'][_0x40fd('0x6e')]=_0xfc725d[_0x40fd('0x55')]['filename'];}return db[_0x40fd('0x39')][_0x40fd('0x51')]({'where':{'id':_0xfc725d[_0x40fd('0x53')]['id']}})['then'](handleEntityNotFound(_0x48e3df,null))[_0x40fd('0x1e')](saveUpdates(_0xfc725d[_0x40fd('0x52')],null))['then'](respondWithResult(_0x48e3df,null))[_0x40fd('0x29')](handleError(_0x48e3df,null));};var utilLicense=require(_0x40fd('0x1a'));exports[_0x40fd('0x74')]=function(_0x153a23,_0x7ea3d,_0x3443bc){var _0x422cb5=_0x40fd('0x5a');var _0x1b2f64={'custom':![]};return utilLicense[_0x40fd('0x5b')]()[_0x40fd('0x1e')](function(_0xe801bc){if(_0xe801bc){_0x1b2f64=_0xe801bc;}return db[_0x40fd('0x39')][_0x40fd('0x51')]({'where':{'id':_0x153a23[_0x40fd('0x53')]['id']},'attributes':['logo','loginLogo',_0x40fd('0x5d'),_0x40fd('0x6e'),'defaultLogo','defaultLoginLogo',_0x40fd('0x5f'),_0x40fd('0x60')],'raw':!![]});})[_0x40fd('0x1e')](handleEntityNotFound(_0x7ea3d,null))[_0x40fd('0x1e')](function(_0xe2c269){if(_0xe2c269){var _0x2f25ac=_0xe2c269[_0x40fd('0x6e')]&&fs[_0x40fd('0x61')](path[_0x40fd('0x62')](config['root'],_0x422cb5,_[_0x40fd('0x63')](_0xe2c269['favicon'])))?path['join'](config[_0x40fd('0x64')],_0x422cb5,_[_0x40fd('0x63')](_0xe2c269['favicon'])):path[_0x40fd('0x62')](config[_0x40fd('0x64')],_0x422cb5,_[_0x40fd('0x63')](_0x40fd('0x75')));var _0x50dc21=_0x40fd('0x65')+_[_0x40fd('0x66')](_0x40fd('0x6e'));if(_0xe2c269[_0x50dc21]||!_0x1b2f64[_0x40fd('0x67')]){_0x2f25ac=path['join'](config['root'],_0x422cb5,_['toLower'](_0x40fd('0x75')));}if(!fs[_0x40fd('0x61')](_0x2f25ac)){throw new db[(_0x40fd('0x69'))][(_0x40fd('0x6a'))](_[_0x40fd('0x66')](_0x40fd('0x6e'))+_0x40fd('0x6b'));}return _0x7ea3d[_0x40fd('0x6c')](_0x2f25ac);}})[_0x40fd('0x29')](handleError(_0x7ea3d,null));};exports[_0x40fd('0x76')]=function(_0x5a3ad3,_0x2edbff){var _0x42ae63={'offset':moment()[_0x40fd('0x77')]()};_0x42ae63['now']=moment()[_0x40fd('0x77')](_0x42ae63[_0x40fd('0x2e')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x2edbff[_0x40fd('0x2b')](0xc8)[_0x40fd('0x37')](_0x42ae63);}; \ No newline at end of file +var _0x3738=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','Setting','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','map','VIRTUAL','name','merge','options','includeAll','include','rows','show','params','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','default','upperFirst','custom','existsSync','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','Sequelize','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x170981,_0x359bae){var _0xb2304=function(_0x44dda9){while(--_0x44dda9){_0x170981['push'](_0x170981['shift']());}};_0xb2304(++_0x359bae);}(_0x3738,0x1e5));var _0x8373=function(_0x5eb736,_0x5dcac5){_0x5eb736=_0x5eb736-0x0;var _0x183a13=_0x3738[_0x5eb736];return _0x183a13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8373('0x0'));var zipdir=require(_0x8373('0x1'));var jsonpatch=require(_0x8373('0x2'));var rp=require(_0x8373('0x3'));var moment=require(_0x8373('0x4'));var BPromise=require(_0x8373('0x5'));var Mustache=require(_0x8373('0x6'));var util=require(_0x8373('0x7'));var path=require(_0x8373('0x8'));var sox=require(_0x8373('0x9'));var csv=require(_0x8373('0xa'));var ejs=require(_0x8373('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8373('0xc'));var squel=require(_0x8373('0xd'));var crypto=require(_0x8373('0xe'));var jsforce=require(_0x8373('0xf'));var deskjs=require(_0x8373('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8373('0x11'));var Papa=require(_0x8373('0x12'));var Redis=require(_0x8373('0x13'));var authService=require(_0x8373('0x14'));var qs=require(_0x8373('0x15'));var as=require(_0x8373('0x16'));var hardwareService=require(_0x8373('0x17'));var logger=require(_0x8373('0x18'))('api');var utils=require(_0x8373('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8373('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8373('0x1b'));var client=jayson[_0x8373('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7042ed,_0x4f3ab0,_0x3b1be6,_0x1d08ca){return new BPromise(function(_0x527e4f,_0x35d01f){var _0x2d33f8=_0x1d08ca||client;return _0x2d33f8[_0x8373('0x1d')](_0x7042ed,_0x3b1be6)['then'](function(_0x23f545){logger[_0x8373('0x1e')](_0x8373('0x1f'),_0x4f3ab0,_0x8373('0x20'));logger[_0x8373('0x21')]('Setting,\x20%s,\x20%s,\x20%s',_0x4f3ab0,_0x8373('0x20'),JSON[_0x8373('0x22')](_0x23f545));if(_0x23f545[_0x8373('0x23')]){if(_0x23f545[_0x8373('0x23')]['code']===0x1f4){logger['error'](_0x8373('0x1f'),_0x4f3ab0,_0x23f545['error'][_0x8373('0x24')]);return _0x35d01f(_0x23f545[_0x8373('0x23')][_0x8373('0x24')]);}logger[_0x8373('0x23')]('Setting,\x20%s,\x20%s',_0x4f3ab0,_0x23f545[_0x8373('0x23')][_0x8373('0x24')]);return _0x527e4f(_0x23f545[_0x8373('0x23')][_0x8373('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x4f3ab0,_0x8373('0x20'));_0x527e4f(_0x23f545['result'][_0x8373('0x24')]);}})[_0x8373('0x25')](function(_0x2cfa4a){logger[_0x8373('0x23')]('Setting,\x20%s,\x20%s',_0x4f3ab0,_0x2cfa4a);_0x35d01f(_0x2cfa4a);});});}function respondWithStatusCode(_0x2b5ce4,_0x169841){_0x169841=_0x169841||0xcc;return function(_0x3552bf){if(_0x3552bf){return _0x2b5ce4[_0x8373('0x26')](_0x169841);}return _0x2b5ce4[_0x8373('0x27')](_0x169841)[_0x8373('0x28')]();};}function respondWithResult(_0x3de2e2,_0x322d81){_0x322d81=_0x322d81||0xc8;return function(_0x2af74d){if(_0x2af74d){return _0x3de2e2[_0x8373('0x27')](_0x322d81)['json'](_0x2af74d);}};}function respondWithFilteredResult(_0x7939eb,_0x23f6c1){return function(_0x3703ef){if(_0x3703ef){var _0x71b224=typeof _0x23f6c1[_0x8373('0x29')]===_0x8373('0x2a')&&typeof _0x23f6c1['limit']===_0x8373('0x2a');var _0x104cdb=_0x3703ef['count'];var _0x426d0e=_0x71b224?0x0:_0x23f6c1[_0x8373('0x29')];var _0x2074c4=_0x71b224?_0x3703ef[_0x8373('0x2b')]:_0x23f6c1[_0x8373('0x29')]+_0x23f6c1[_0x8373('0x2c')];var _0x1e4de4;if(_0x2074c4>=_0x104cdb){_0x2074c4=_0x104cdb;_0x1e4de4=0xc8;}else{_0x1e4de4=0xce;}_0x7939eb[_0x8373('0x27')](_0x1e4de4);return _0x7939eb[_0x8373('0x2d')](_0x8373('0x2e'),_0x426d0e+'-'+_0x2074c4+'/'+_0x104cdb)[_0x8373('0x2f')](_0x3703ef);}return null;};}function patchUpdates(_0x59f544){return function(_0x423c72){try{jsonpatch[_0x8373('0x30')](_0x423c72,_0x59f544,!![]);}catch(_0x3896bf){return BPromise['reject'](_0x3896bf);}return _0x423c72[_0x8373('0x31')]();};}function saveUpdates(_0x27c2ac,_0x1ce375){return function(_0x4a8a08){if(_0x4a8a08){return _0x4a8a08[_0x8373('0x32')](_0x27c2ac)[_0x8373('0x33')](function(_0x143453){return _0x143453;});}return null;};}function removeEntity(_0x3d6ac2,_0xad7420){return function(_0x2595bb){if(_0x2595bb){return _0x2595bb[_0x8373('0x34')]()['then'](function(){_0x3d6ac2[_0x8373('0x27')](0xcc)[_0x8373('0x28')]();});}};}function handleEntityNotFound(_0x5435d8,_0x3c4243){return function(_0x48a2e8){if(!_0x48a2e8){_0x5435d8[_0x8373('0x26')](0x194);}return _0x48a2e8;};}function handleError(_0x7d8d16,_0x411c37){_0x411c37=_0x411c37||0x1f4;return function(_0x62eaa3){logger[_0x8373('0x23')](_0x62eaa3[_0x8373('0x35')]);if(_0x62eaa3['name']){delete _0x62eaa3['name'];}_0x7d8d16[_0x8373('0x27')](_0x411c37)['send'](_0x62eaa3);};}exports['index']=function(_0x14df72,_0xc7a052){var _0x2ea463={},_0x375de1={},_0x2e9f80={'count':0x0,'rows':[]};var _0x518bc8=_['map'](db[_0x8373('0x36')][_0x8373('0x37')],function(_0x3a1783){return{'name':_0x3a1783['fieldName'],'type':_0x3a1783[_0x8373('0x38')][_0x8373('0x39')]};});_0x375de1['model']=_['map'](_0x518bc8,'name');_0x375de1[_0x8373('0x3a')]=_[_0x8373('0x3b')](_0x14df72[_0x8373('0x3a')]);_0x375de1['filters']=_[_0x8373('0x3c')](_0x375de1[_0x8373('0x3d')],_0x375de1[_0x8373('0x3a')]);_0x2ea463[_0x8373('0x3e')]=_[_0x8373('0x3c')](_0x375de1[_0x8373('0x3d')],qs[_0x8373('0x3f')](_0x14df72[_0x8373('0x3a')]['fields']));_0x2ea463['attributes']=_0x2ea463[_0x8373('0x3e')][_0x8373('0x40')]?_0x2ea463['attributes']:_0x375de1[_0x8373('0x3d')];if(!_0x14df72[_0x8373('0x3a')][_0x8373('0x41')](_0x8373('0x42'))){_0x2ea463[_0x8373('0x2c')]=qs[_0x8373('0x2c')](_0x14df72[_0x8373('0x3a')][_0x8373('0x2c')]);_0x2ea463[_0x8373('0x29')]=qs['offset'](_0x14df72[_0x8373('0x3a')][_0x8373('0x29')]);}_0x2ea463[_0x8373('0x43')]=qs[_0x8373('0x44')](_0x14df72[_0x8373('0x3a')][_0x8373('0x44')]);_0x2ea463['where']=qs[_0x8373('0x45')](_['pick'](_0x14df72['query'],_0x375de1[_0x8373('0x45')]),_0x518bc8);if(_0x14df72[_0x8373('0x3a')][_0x8373('0x46')]){_0x2ea463[_0x8373('0x47')]=_['merge'](_0x2ea463[_0x8373('0x47')],{'$or':_[_0x8373('0x48')](_0x518bc8,function(_0x23d868){if(_0x23d868['type']!==_0x8373('0x49')){var _0x255fae={};_0x255fae[_0x23d868[_0x8373('0x4a')]]={'$like':'%'+_0x14df72[_0x8373('0x3a')][_0x8373('0x46')]+'%'};return _0x255fae;}})});}_0x2ea463=_[_0x8373('0x4b')]({},_0x2ea463,_0x14df72[_0x8373('0x4c')]);var _0x3193ad={'where':_0x2ea463[_0x8373('0x47')]};return db[_0x8373('0x36')][_0x8373('0x2b')](_0x3193ad)[_0x8373('0x33')](function(_0x3fb268){_0x2e9f80['count']=_0x3fb268;if(_0x14df72[_0x8373('0x3a')][_0x8373('0x4d')]){_0x2ea463[_0x8373('0x4e')]=[{'all':!![]}];}return db[_0x8373('0x36')]['findAll'](_0x2ea463);})[_0x8373('0x33')](function(_0x32ec0b){_0x2e9f80[_0x8373('0x4f')]=_0x32ec0b;return _0x2e9f80;})[_0x8373('0x33')](respondWithFilteredResult(_0xc7a052,_0x2ea463))['catch'](handleError(_0xc7a052,null));};exports[_0x8373('0x50')]=function(_0x17a114,_0x2ba2d5){var _0x2f3e41={'raw':![],'where':{'id':_0x17a114[_0x8373('0x51')]['id']}},_0x594c50={};_0x594c50['model']=_[_0x8373('0x3b')](db[_0x8373('0x36')][_0x8373('0x37')]);_0x594c50[_0x8373('0x3a')]=_[_0x8373('0x3b')](_0x17a114[_0x8373('0x3a')]);_0x594c50['filters']=_['intersection'](_0x594c50[_0x8373('0x3d')],_0x594c50['query']);_0x2f3e41[_0x8373('0x3e')]=_[_0x8373('0x3c')](_0x594c50[_0x8373('0x3d')],qs[_0x8373('0x3f')](_0x17a114[_0x8373('0x3a')][_0x8373('0x3f')]));_0x2f3e41[_0x8373('0x3e')]=_0x2f3e41['attributes'][_0x8373('0x40')]?_0x2f3e41['attributes']:_0x594c50[_0x8373('0x3d')];if(_0x17a114[_0x8373('0x3a')][_0x8373('0x4d')]){_0x2f3e41[_0x8373('0x4e')]=[{'all':!![]}];}_0x2f3e41=_['merge']({},_0x2f3e41,_0x17a114['options']);return db[_0x8373('0x36')][_0x8373('0x52')](_0x2f3e41)['then'](handleEntityNotFound(_0x2ba2d5,null))[_0x8373('0x33')](respondWithResult(_0x2ba2d5,null))[_0x8373('0x25')](handleError(_0x2ba2d5,null));};exports['update']=function(_0x1c029c,_0x1f73e4){if(_0x1c029c['body']['id']){delete _0x1c029c[_0x8373('0x53')]['id'];}return db[_0x8373('0x36')]['find']({'where':{'id':_0x1c029c[_0x8373('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f73e4,null))['then'](saveUpdates(_0x1c029c[_0x8373('0x53')],null))['then'](respondWithResult(_0x1f73e4,null))[_0x8373('0x25')](handleError(_0x1f73e4,null));};exports['addLogo']=function(_0x1650cd,_0x3e7397,_0x2e49d7){if(_0x1650cd[_0x8373('0x54')]&&_0x1650cd[_0x8373('0x54')][_0x8373('0x55')]){_0x1650cd[_0x8373('0x53')][_0x8373('0x56')]=_0x1650cd[_0x8373('0x54')][_0x8373('0x55')];}return db['Setting'][_0x8373('0x52')]({'where':{'id':_0x1650cd[_0x8373('0x51')]['id']}})[_0x8373('0x33')](handleEntityNotFound(_0x3e7397,null))[_0x8373('0x33')](saveUpdates(_0x1650cd[_0x8373('0x53')],null))[_0x8373('0x33')](respondWithResult(_0x3e7397,null))[_0x8373('0x25')](handleError(_0x3e7397,null));};exports[_0x8373('0x57')]=function(_0x1406d0,_0x19a540,_0x3293dc){if(_0x1406d0[_0x8373('0x54')]&&_0x1406d0[_0x8373('0x54')][_0x8373('0x55')]){_0x1406d0[_0x8373('0x53')][_0x8373('0x58')]=_0x1406d0['file'][_0x8373('0x55')];}return db[_0x8373('0x36')][_0x8373('0x52')]({'where':{'id':_0x1406d0[_0x8373('0x51')]['id']}})[_0x8373('0x33')](handleEntityNotFound(_0x19a540,null))[_0x8373('0x33')](saveUpdates(_0x1406d0['body'],null))[_0x8373('0x33')](respondWithResult(_0x19a540,null))[_0x8373('0x25')](handleError(_0x19a540,null));};var utilLicense=require(_0x8373('0x1a'));exports[_0x8373('0x59')]=function(_0xf8dee0,_0x46b540,_0x56150f){var _0x1a739c=_0x8373('0x5a');var _0x487579={'custom':![]};return utilLicense[_0x8373('0x5b')]()[_0x8373('0x33')](function(_0x4c3b26){if(_0x4c3b26){_0x487579=_0x4c3b26;}return db['Setting']['find']({'where':{'id':_0xf8dee0[_0x8373('0x51')]['id']},'attributes':['logo','loginLogo','preferred',_0x8373('0x5c'),_0x8373('0x5d'),_0x8373('0x5e'),_0x8373('0x5f'),_0x8373('0x60')],'raw':!![]});})[_0x8373('0x33')](handleEntityNotFound(_0x46b540,null))[_0x8373('0x33')](function(_0x313ddd){if(_0x313ddd){var _0x3f0550=_0x313ddd[_0x8373('0x56')]&&fs['existsSync'](path[_0x8373('0x61')](config['root'],_0x1a739c,_[_0x8373('0x62')](_0x313ddd['logo'])))?path[_0x8373('0x61')](config[_0x8373('0x63')],_0x1a739c,_[_0x8373('0x62')](_0x313ddd[_0x8373('0x56')])):path['join'](config['root'],_0x1a739c,_[_0x8373('0x62')](_0x8373('0x64')));var _0x2ebc9c=_0x8373('0x65')+_[_0x8373('0x66')](_0x8373('0x56'));if(_0x313ddd[_0x2ebc9c]||!_0x487579[_0x8373('0x67')]){_0x3f0550=path[_0x8373('0x61')](config[_0x8373('0x63')],_0x1a739c,_[_0x8373('0x62')](_0x8373('0x64')));}if(!fs[_0x8373('0x68')](_0x3f0550)){throw new db['Sequelize'][(_0x8373('0x69'))](_[_0x8373('0x66')](_0x8373('0x56'))+_0x8373('0x6a'));}return _0x46b540[_0x8373('0x6b')](_0x3f0550);}})[_0x8373('0x25')](handleError(_0x46b540,null));};var utilLicense=require(_0x8373('0x1a'));exports[_0x8373('0x6c')]=function(_0x356731,_0x1b996f,_0x41b14b){var _0x1339c0='server/files/images/logos';var _0x21dea0={'custom':![]};return utilLicense[_0x8373('0x5b')]()[_0x8373('0x33')](function(_0x383f35){if(_0x383f35){_0x21dea0=_0x383f35;}return db['Setting'][_0x8373('0x52')]({'where':{'id':_0x356731[_0x8373('0x51')]['id']},'attributes':[_0x8373('0x56'),'loginLogo',_0x8373('0x6d'),_0x8373('0x5c'),_0x8373('0x5d'),_0x8373('0x5e'),_0x8373('0x5f'),_0x8373('0x60')],'raw':!![]});})[_0x8373('0x33')](handleEntityNotFound(_0x1b996f,null))[_0x8373('0x33')](function(_0x40fa10){if(_0x40fa10){var _0x3b8742=_0x40fa10[_0x8373('0x58')]&&fs[_0x8373('0x68')](path[_0x8373('0x61')](config[_0x8373('0x63')],_0x1339c0,_['toLower'](_0x40fa10[_0x8373('0x58')])))?path['join'](config['root'],_0x1339c0,_[_0x8373('0x62')](_0x40fa10[_0x8373('0x58')])):path[_0x8373('0x61')](config[_0x8373('0x63')],_0x1339c0,_[_0x8373('0x62')]('default_loginLogo.svg'));var _0x3941fc=_0x8373('0x65')+_[_0x8373('0x66')]('loginLogo');if(_0x40fa10[_0x3941fc]||!_0x21dea0['custom']){_0x3b8742=path[_0x8373('0x61')](config['root'],_0x1339c0,_['toLower'](_0x8373('0x6e')));}if(!fs[_0x8373('0x68')](_0x3b8742)){throw new db['Sequelize'][(_0x8373('0x69'))](_['upperFirst'](_0x8373('0x58'))+'\x20not\x20found');}return _0x1b996f['download'](_0x3b8742);}})[_0x8373('0x25')](handleError(_0x1b996f,null));};exports[_0x8373('0x6f')]=function(_0x587ced,_0x3f9a14){return db[_0x8373('0x36')][_0x8373('0x52')]({'where':{'id':_0x587ced[_0x8373('0x51')]['id']},'attributes':[_0x8373('0x70')]})[_0x8373('0x33')](respondWithResult(_0x3f9a14,null))[_0x8373('0x25')](handleError(_0x3f9a14,null));};exports[_0x8373('0x71')]=function(_0x230c66,_0xd8083e,_0x47ca94){if(_0x230c66[_0x8373('0x54')]&&_0x230c66[_0x8373('0x54')][_0x8373('0x55')]){_0x230c66['body'][_0x8373('0x6d')]=_0x230c66[_0x8373('0x54')][_0x8373('0x55')];}return db[_0x8373('0x36')][_0x8373('0x52')]({'where':{'id':_0x230c66[_0x8373('0x51')]['id']}})[_0x8373('0x33')](handleEntityNotFound(_0xd8083e,null))[_0x8373('0x33')](saveUpdates(_0x230c66[_0x8373('0x53')],null))[_0x8373('0x33')](respondWithResult(_0xd8083e,null))[_0x8373('0x25')](handleError(_0xd8083e,null));};var utilLicense=require(_0x8373('0x1a'));exports[_0x8373('0x72')]=function(_0x20b82f,_0x4d44e3,_0x238c77){var _0x18bac8=_0x8373('0x5a');var _0x16368d={'custom':![]};return utilLicense['getLicense']()[_0x8373('0x33')](function(_0x20b0df){if(_0x20b0df){_0x16368d=_0x20b0df;}return db[_0x8373('0x36')][_0x8373('0x52')]({'where':{'id':_0x20b82f[_0x8373('0x51')]['id']},'attributes':[_0x8373('0x56'),_0x8373('0x58'),_0x8373('0x6d'),_0x8373('0x5c'),_0x8373('0x5d'),'defaultLoginLogo',_0x8373('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4d44e3,null))[_0x8373('0x33')](function(_0x254601){if(_0x254601){var _0x364b51=_0x254601[_0x8373('0x6d')]&&fs[_0x8373('0x68')](path[_0x8373('0x61')](config['root'],_0x18bac8,_[_0x8373('0x62')](_0x254601['preferred'])))?path[_0x8373('0x61')](config['root'],_0x18bac8,_[_0x8373('0x62')](_0x254601[_0x8373('0x6d')])):path[_0x8373('0x61')](config[_0x8373('0x63')],_0x18bac8,_['toLower'](_0x8373('0x73')));var _0x1022c9=_0x8373('0x65')+_[_0x8373('0x66')](_0x8373('0x6d'));if(_0x254601[_0x1022c9]||!_0x16368d[_0x8373('0x67')]||!_0x16368d[_0x8373('0x6d')]){_0x364b51=path[_0x8373('0x61')](config[_0x8373('0x63')],_0x18bac8,_[_0x8373('0x62')](_0x8373('0x73')));}if(!fs[_0x8373('0x68')](_0x364b51)){throw new db[(_0x8373('0x74'))][(_0x8373('0x69'))](_['upperFirst'](_0x8373('0x6d'))+_0x8373('0x6a'));}return _0x4d44e3['download'](_0x364b51);}})[_0x8373('0x25')](handleError(_0x4d44e3,null));};exports['addFavicon']=function(_0x1c88fc,_0x2064fe,_0x398122){if(_0x1c88fc['file']&&_0x1c88fc[_0x8373('0x54')][_0x8373('0x55')]){_0x1c88fc[_0x8373('0x53')][_0x8373('0x5c')]=_0x1c88fc[_0x8373('0x54')][_0x8373('0x55')];}return db[_0x8373('0x36')][_0x8373('0x52')]({'where':{'id':_0x1c88fc['params']['id']}})[_0x8373('0x33')](handleEntityNotFound(_0x2064fe,null))[_0x8373('0x33')](saveUpdates(_0x1c88fc['body'],null))[_0x8373('0x33')](respondWithResult(_0x2064fe,null))[_0x8373('0x25')](handleError(_0x2064fe,null));};var utilLicense=require(_0x8373('0x1a'));exports[_0x8373('0x75')]=function(_0xc1f189,_0x17e55a,_0x3db3c0){var _0x4326a3=_0x8373('0x5a');var _0x2df59a={'custom':![]};return utilLicense[_0x8373('0x5b')]()[_0x8373('0x33')](function(_0x17faaa){if(_0x17faaa){_0x2df59a=_0x17faaa;}return db['Setting'][_0x8373('0x52')]({'where':{'id':_0xc1f189[_0x8373('0x51')]['id']},'attributes':[_0x8373('0x56'),'loginLogo','preferred',_0x8373('0x5c'),_0x8373('0x5d'),_0x8373('0x5e'),_0x8373('0x5f'),_0x8373('0x60')],'raw':!![]});})[_0x8373('0x33')](handleEntityNotFound(_0x17e55a,null))['then'](function(_0x533ccf){if(_0x533ccf){var _0x18570d=_0x533ccf[_0x8373('0x5c')]&&fs[_0x8373('0x68')](path[_0x8373('0x61')](config['root'],_0x4326a3,_[_0x8373('0x62')](_0x533ccf[_0x8373('0x5c')])))?path[_0x8373('0x61')](config[_0x8373('0x63')],_0x4326a3,_[_0x8373('0x62')](_0x533ccf[_0x8373('0x5c')])):path[_0x8373('0x61')](config['root'],_0x4326a3,_['toLower'](_0x8373('0x76')));var _0x53e8e2=_0x8373('0x65')+_[_0x8373('0x66')]('favicon');if(_0x533ccf[_0x53e8e2]||!_0x2df59a[_0x8373('0x67')]){_0x18570d=path['join'](config['root'],_0x4326a3,_['toLower']('default_favicon.ico'));}if(!fs[_0x8373('0x68')](_0x18570d)){throw new db[(_0x8373('0x74'))][(_0x8373('0x69'))](_[_0x8373('0x66')]('favicon')+_0x8373('0x6a'));}return _0x17e55a[_0x8373('0x6b')](_0x18570d);}})['catch'](handleError(_0x17e55a,null));};exports[_0x8373('0x77')]=function(_0x7c45b8,_0x5314fc){var _0x213d41={'offset':moment()[_0x8373('0x78')]()};_0x213d41['now']=moment()[_0x8373('0x78')](_0x213d41['offset'])[_0x8373('0x79')](_0x8373('0x7a'));return _0x5314fc['status'](0xc8)[_0x8373('0x7b')](_0x213d41);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 768d961..aea89ae 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0x3e74,0x175));var _0x43e7=function(_0x4535e5,_0x15b557){_0x4535e5=_0x4535e5-0x0;var _0x47f776=_0x3e74[_0x4535e5];return _0x47f776;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x415879,_0x3437a5){var _0x744cb4=function(_0x51a8fb){while(--_0x51a8fb){_0x415879['push'](_0x415879['shift']());}};_0x744cb4(++_0x3437a5);}(_0xedd9,0xfc));var _0x9edd=function(_0x51486d,_0x3c6ae4){_0x51486d=_0x51486d-0x0;var _0x490680=_0xedd9[_0x51486d];return _0x490680;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f2739d3..868b1db 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 _0x4a56=['result','ShowSetting','Setting','find','raw','options','attributes','include','map','model','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','Setting,\x20%s,\x20%s'];(function(_0x54c0b4,_0x583427){var _0x542f40=function(_0x597f7b){while(--_0x597f7b){_0x54c0b4['push'](_0x54c0b4['shift']());}};_0x542f40(++_0x583427);}(_0x4a56,0x8b));var _0x64a5=function(_0x1b5126,_0x4bf3b3){_0x1b5126=_0x1b5126-0x0;var _0x557a0e=_0x4a56[_0x1b5126];return _0x557a0e;};'use strict';var _=require(_0x64a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x64a5('0x1'));var rs=require(_0x64a5('0x2'));var fs=require('fs');var Redis=require(_0x64a5('0x3'));var db=require(_0x64a5('0x4'))['db'];var utils=require(_0x64a5('0x5'));var logger=require(_0x64a5('0x6'))(_0x64a5('0x7'));var config=require(_0x64a5('0x8'));var jayson=require(_0x64a5('0x9'));var client=jayson[_0x64a5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde52fb,_0x2eb300,_0x4a8458){return new BPromise(function(_0x61852b,_0x58d27a){return client[_0x64a5('0xb')](_0xde52fb,_0x4a8458)[_0x64a5('0xc')](function(_0x3960bf){logger['info']('Setting,\x20%s,\x20%s',_0x2eb300,_0x64a5('0xd'));logger[_0x64a5('0xe')](_0x64a5('0xf'),_0x2eb300,_0x64a5('0xd'),JSON[_0x64a5('0x10')](_0x3960bf));if(_0x3960bf[_0x64a5('0x11')]){if(_0x3960bf[_0x64a5('0x11')]['code']===0x1f4){logger[_0x64a5('0x11')]('Setting,\x20%s,\x20%s',_0x2eb300,_0x3960bf['error'][_0x64a5('0x12')]);return _0x58d27a(_0x3960bf[_0x64a5('0x11')][_0x64a5('0x12')]);}logger['error']('Setting,\x20%s,\x20%s',_0x2eb300,_0x3960bf['error'][_0x64a5('0x12')]);return _0x61852b(_0x3960bf[_0x64a5('0x11')][_0x64a5('0x12')]);}else{logger[_0x64a5('0x13')](_0x64a5('0x14'),_0x2eb300,'request\x20sent');_0x61852b(_0x3960bf[_0x64a5('0x15')][_0x64a5('0x12')]);}})['catch'](function(_0x424629){logger[_0x64a5('0x11')]('Setting,\x20%s,\x20%s',_0x2eb300,_0x424629);_0x58d27a(_0x424629);});});}exports[_0x64a5('0x16')]=function(_0x1129db){var _0x4ecc35=this;return new Promise(function(_0x1a8f2a,_0x26af68){return db[_0x64a5('0x17')][_0x64a5('0x18')]({'raw':_0x1129db['options']?_0x1129db['options'][_0x64a5('0x19')]===undefined?!![]:![]:!![],'where':_0x1129db[_0x64a5('0x1a')]?_0x1129db[_0x64a5('0x1a')]['where']||null:null,'attributes':_0x1129db[_0x64a5('0x1a')]?_0x1129db[_0x64a5('0x1a')][_0x64a5('0x1b')]||null:null,'include':_0x1129db['options']?_0x1129db['options'][_0x64a5('0x1c')]?_[_0x64a5('0x1d')](_0x1129db[_0x64a5('0x1a')][_0x64a5('0x1c')],function(_0x541759){return{'model':db[_0x541759[_0x64a5('0x1e')]],'as':_0x541759['as'],'attributes':_0x541759[_0x64a5('0x1b')],'include':_0x541759[_0x64a5('0x1c')]?_[_0x64a5('0x1d')](_0x541759['include'],function(_0x12aa6e){return{'model':db[_0x12aa6e[_0x64a5('0x1e')]],'as':_0x12aa6e['as'],'attributes':_0x12aa6e['attributes'],'include':_0x12aa6e['include']?_[_0x64a5('0x1d')](_0x12aa6e[_0x64a5('0x1c')],function(_0x14e6e8){return{'model':db[_0x14e6e8[_0x64a5('0x1e')]],'as':_0x14e6e8['as'],'attributes':_0x14e6e8[_0x64a5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3599da){logger[_0x64a5('0x13')]('ShowSetting',_0x1129db);logger[_0x64a5('0xe')]('ShowSetting',_0x1129db,JSON[_0x64a5('0x10')](_0x3599da));_0x1a8f2a(_0x3599da);})[_0x64a5('0x1f')](function(_0x2cb758){logger[_0x64a5('0x11')]('ShowSetting',_0x2cb758[_0x64a5('0x12')],_0x1129db);_0x26af68(_0x4ecc35[_0x64a5('0x11')](0x1f4,_0x2cb758['message']));});});}; \ No newline at end of file +var _0x1ff3=['jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e0097,_0x4afe37){var _0x256923=function(_0xecaa9a){while(--_0xecaa9a){_0x5e0097['push'](_0x5e0097['shift']());}};_0x256923(++_0x4afe37);}(_0x1ff3,0xdc));var _0x31ff=function(_0x49e2ee,_0x1f0dc3){_0x49e2ee=_0x49e2ee-0x0;var _0x4c0f50=_0x1ff3[_0x49e2ee];return _0x4c0f50;};'use strict';var _=require(_0x31ff('0x0'));var util=require(_0x31ff('0x1'));var moment=require(_0x31ff('0x2'));var BPromise=require(_0x31ff('0x3'));var rs=require(_0x31ff('0x4'));var fs=require('fs');var Redis=require(_0x31ff('0x5'));var db=require(_0x31ff('0x6'))['db'];var utils=require(_0x31ff('0x7'));var logger=require(_0x31ff('0x8'))(_0x31ff('0x9'));var config=require(_0x31ff('0xa'));var jayson=require(_0x31ff('0xb'));var client=jayson[_0x31ff('0xc')][_0x31ff('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x274a01,_0x627e97,_0x3d8eb8){return new BPromise(function(_0x283a1d,_0x274103){return client[_0x31ff('0xe')](_0x274a01,_0x3d8eb8)[_0x31ff('0xf')](function(_0x6c3399){logger[_0x31ff('0x10')](_0x31ff('0x11'),_0x627e97,'request\x20sent');logger[_0x31ff('0x12')]('Setting,\x20%s,\x20%s,\x20%s',_0x627e97,_0x31ff('0x13'),JSON[_0x31ff('0x14')](_0x6c3399));if(_0x6c3399[_0x31ff('0x15')]){if(_0x6c3399['error'][_0x31ff('0x16')]===0x1f4){logger[_0x31ff('0x15')](_0x31ff('0x11'),_0x627e97,_0x6c3399[_0x31ff('0x15')][_0x31ff('0x17')]);return _0x274103(_0x6c3399['error'][_0x31ff('0x17')]);}logger['error'](_0x31ff('0x11'),_0x627e97,_0x6c3399[_0x31ff('0x15')]['message']);return _0x283a1d(_0x6c3399[_0x31ff('0x15')][_0x31ff('0x17')]);}else{logger[_0x31ff('0x10')](_0x31ff('0x11'),_0x627e97,_0x31ff('0x13'));_0x283a1d(_0x6c3399[_0x31ff('0x18')][_0x31ff('0x17')]);}})[_0x31ff('0x19')](function(_0x20b7bc){logger[_0x31ff('0x15')](_0x31ff('0x11'),_0x627e97,_0x20b7bc);_0x274103(_0x20b7bc);});});}exports[_0x31ff('0x1a')]=function(_0x5a2391){var _0x1c75a0=this;return new Promise(function(_0x5e7d05,_0x1a6079){return db['Setting']['find']({'raw':_0x5a2391[_0x31ff('0x1b')]?_0x5a2391[_0x31ff('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5a2391[_0x31ff('0x1b')]?_0x5a2391[_0x31ff('0x1b')][_0x31ff('0x1c')]||null:null,'attributes':_0x5a2391['options']?_0x5a2391[_0x31ff('0x1b')][_0x31ff('0x1d')]||null:null,'include':_0x5a2391['options']?_0x5a2391[_0x31ff('0x1b')][_0x31ff('0x1e')]?_[_0x31ff('0x1f')](_0x5a2391['options'][_0x31ff('0x1e')],function(_0x25837c){return{'model':db[_0x25837c[_0x31ff('0x20')]],'as':_0x25837c['as'],'attributes':_0x25837c[_0x31ff('0x1d')],'include':_0x25837c[_0x31ff('0x1e')]?_[_0x31ff('0x1f')](_0x25837c[_0x31ff('0x1e')],function(_0x5ac21c){return{'model':db[_0x5ac21c['model']],'as':_0x5ac21c['as'],'attributes':_0x5ac21c[_0x31ff('0x1d')],'include':_0x5ac21c[_0x31ff('0x1e')]?_['map'](_0x5ac21c[_0x31ff('0x1e')],function(_0x33baf2){return{'model':db[_0x33baf2[_0x31ff('0x20')]],'as':_0x33baf2['as'],'attributes':_0x33baf2[_0x31ff('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36c7f6){logger[_0x31ff('0x10')](_0x31ff('0x1a'),_0x5a2391);logger[_0x31ff('0x12')](_0x31ff('0x1a'),_0x5a2391,JSON[_0x31ff('0x14')](_0x36c7f6));_0x5e7d05(_0x36c7f6);})[_0x31ff('0x19')](function(_0x530cda){logger[_0x31ff('0x15')](_0x31ff('0x1a'),_0x530cda[_0x31ff('0x17')],_0x5a2391);_0x1a6079(_0x1c75a0[_0x31ff('0x15')](0x1f4,_0x530cda[_0x31ff('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 611c5fb..63a7e23 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x425e00,_0x492d56){var _0x1eacfb=function(_0x2060fa){while(--_0x2060fa){_0x425e00['push'](_0x425e00['shift']());}};_0x1eacfb(++_0x492d56);}(_0x7a54,0x106));var _0x47a5=function(_0x1f3548,_0x186e82){_0x1f3548=_0x1f3548-0x0;var _0x59071f=_0x7a54[_0x1f3548];return _0x59071f;};'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/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x2492d9,_0x28fee9){var _0x2939c3=function(_0x3a9607){while(--_0x3a9607){_0x2492d9['push'](_0x2492d9['shift']());}};_0x2939c3(++_0x28fee9);}(_0x7a54,0x106));var _0x47a5=function(_0x83b7d8,_0x5a685c){_0x83b7d8=_0x83b7d8-0x0;var _0x1bd08b=_0x7a54[_0x83b7d8];return _0x1bd08b;};'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/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 69775a1..0f10265 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 _0x2af8=['bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','twilio','clickatell'];(function(_0x51554d,_0x284a07){var _0x4a7213=function(_0x454f0b){while(--_0x454f0b){_0x51554d['push'](_0x51554d['shift']());}};_0x4a7213(++_0x284a07);}(_0x2af8,0xa4));var _0x82af=function(_0x1f5bfb,_0x4b4ae6){_0x1f5bfb=_0x1f5bfb-0x0;var _0x2ab3a6=_0x2af8[_0x1f5bfb];return _0x2ab3a6;};'use strict';var Sequelize=require(_0x82af('0x0'));var rs=require('randomstring');module[_0x82af('0x1')]={'name':{'type':Sequelize[_0x82af('0x2')],'unique':_0x82af('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x82af('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x82af('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x82af('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x82af('0x2')]},'type':{'type':Sequelize[_0x82af('0x4')](_0x82af('0x5'),'skebby','connectel','clicksend','plivo',_0x82af('0x6'),_0x82af('0x7'),_0x82af('0x8'),_0x82af('0x9'),_0x82af('0xa'))},'accountSid':{'type':Sequelize[_0x82af('0x2')]},'authId':{'type':Sequelize[_0x82af('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x82af('0x2')]},'password':{'type':Sequelize[_0x82af('0x2')]},'apiKey':{'type':Sequelize[_0x82af('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x82af('0x2')]},'senderString':{'type':Sequelize[_0x82af('0x2')]},'deliveryReport':{'type':Sequelize[_0x82af('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x82af('0x2')]},'notificationTemplate':{'type':Sequelize[_0x82af('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x82af('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x82af('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x82af('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x82af('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x82af('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x82af('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x82af('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x82af('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x82af('0xd')],'comment':_0x82af('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x82af('0xb')],'defaultValue':![],'comment':_0x82af('0xf'),'set':function(_0x21f87c){if(!_0x21f87c)this['setDataValue'](_0x82af('0x10'),null);this[_0x82af('0x11')](_0x82af('0x12'),_0x21f87c);}}}; \ No newline at end of file +var _0xd70a=['intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','infobip'];(function(_0x4bfff5,_0xbd2a67){var _0x2383bc=function(_0x2d3f77){while(--_0x2d3f77){_0x4bfff5['push'](_0x4bfff5['shift']());}};_0x2383bc(++_0xbd2a67);}(_0xd70a,0xd8));var _0xad70=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xd70a[_0x361d3f];return _0x320229;};'use strict';var Sequelize=require(_0xad70('0x0'));var rs=require(_0xad70('0x1'));module['exports']={'name':{'type':Sequelize[_0xad70('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xad70('0x2')],'defaultValue':function(){return rs[_0xad70('0x3')]();}},'phone':{'type':Sequelize[_0xad70('0x2')]},'type':{'type':Sequelize[_0xad70('0x4')](_0xad70('0x5'),_0xad70('0x6'),'connectel','clicksend','plivo','clickatell','bandwidth','csc',_0xad70('0x7'),_0xad70('0x8'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xad70('0x2')]},'authToken':{'type':Sequelize[_0xad70('0x2')]},'smsMethod':{'type':Sequelize[_0xad70('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xad70('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xad70('0x2')]},'applicationId':{'type':Sequelize[_0xad70('0x2')]},'accountId':{'type':Sequelize[_0xad70('0x2')]},'senderString':{'type':Sequelize[_0xad70('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xad70('0x2')]},'notificationTemplate':{'type':Sequelize[_0xad70('0x9')],'defaultValue':function(){return _0xad70('0xa');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xad70('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xad70('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xad70('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xad70('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xad70('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad70('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xad70('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x442ee5){if(!_0x442ee5)this[_0xad70('0xd')](_0xad70('0xe'),null);this[_0xad70('0xd')](_0xad70('0xf'),_0x442ee5);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 0d02f76..7b1620e 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 _0x2305=['code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','model','name','query','keys','intersection','fields','attributes','length','order','sort','pick','filters','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','sms','SmsApplication','Applications','applications','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','SmsInteraction','spread','interaction','created','autoclose','close','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','unshift','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','user','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2305,0xc5));var _0x5230=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x2305[_0x482214];return _0x38d0cb;};'use strict';var emlformat=require(_0x5230('0x0'));var rimraf=require(_0x5230('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5230('0x2'));var BPromise=require(_0x5230('0x3'));var Mustache=require('mustache');var util=require(_0x5230('0x4'));var path=require(_0x5230('0x5'));var sox=require(_0x5230('0x6'));var csv=require(_0x5230('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5230('0x8'));var _=require(_0x5230('0x9'));var squel=require(_0x5230('0xa'));var crypto=require(_0x5230('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5230('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5230('0xd'));var Papa=require(_0x5230('0xe'));var Redis=require('ioredis');var authService=require(_0x5230('0xf'));var qs=require(_0x5230('0x10'));var as=require(_0x5230('0x11'));var hardwareService=require(_0x5230('0x12'));var logger=require(_0x5230('0x13'))('api');var utils=require(_0x5230('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5230('0x15'));var db=require(_0x5230('0x16'))['db'];config[_0x5230('0x17')]=_[_0x5230('0x18')](config[_0x5230('0x17')],{'host':_0x5230('0x19'),'port':0x18eb});var socket=require(_0x5230('0x1a'))(new Redis(config[_0x5230('0x17')]));require(_0x5230('0x1b'))[_0x5230('0x1c')](socket);var jayson=require(_0x5230('0x1d'));var client=jayson['client'][_0x5230('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x6475ea,_0x2903bb,_0x43938f,_0x26da21){return new BPromise(function(_0xa26dc7,_0x52214f){var _0xdf0450=_0x26da21||client;return _0xdf0450[_0x5230('0x1f')](_0x6475ea,_0x43938f)[_0x5230('0x20')](function(_0x135f7a){logger[_0x5230('0x21')](_0x5230('0x22'),_0x2903bb,_0x5230('0x23'));logger[_0x5230('0x24')](_0x5230('0x25'),_0x2903bb,_0x5230('0x23'),JSON['stringify'](_0x135f7a));if(_0x135f7a[_0x5230('0x26')]){if(_0x135f7a[_0x5230('0x26')][_0x5230('0x27')]===0x1f4){logger[_0x5230('0x26')](_0x5230('0x22'),_0x2903bb,_0x135f7a['error'][_0x5230('0x28')]);return _0x52214f(_0x135f7a['error'][_0x5230('0x28')]);}logger[_0x5230('0x26')](_0x5230('0x22'),_0x2903bb,_0x135f7a[_0x5230('0x26')][_0x5230('0x28')]);return _0xa26dc7(_0x135f7a[_0x5230('0x26')][_0x5230('0x28')]);}else{logger[_0x5230('0x21')](_0x5230('0x22'),_0x2903bb,'request\x20sent');_0xa26dc7(_0x135f7a[_0x5230('0x29')]['message']);}})[_0x5230('0x2a')](function(_0xb4d3b1){logger[_0x5230('0x26')](_0x5230('0x22'),_0x2903bb,_0xb4d3b1);_0x52214f(_0xb4d3b1);});});}function respondWithStatusCode(_0x2d0ac3,_0xf3a8ab){_0xf3a8ab=_0xf3a8ab||0xcc;return function(_0x1a32cb){if(_0x1a32cb){return _0x2d0ac3[_0x5230('0x2b')](_0xf3a8ab);}return _0x2d0ac3['status'](_0xf3a8ab)[_0x5230('0x2c')]();};}function respondWithResult(_0x429410,_0x4154){_0x4154=_0x4154||0xc8;return function(_0x2ce672){if(_0x2ce672){return _0x429410[_0x5230('0x2d')](_0x4154)[_0x5230('0x2e')](_0x2ce672);}};}function respondWithFilteredResult(_0x39ca3a,_0xedf218){return function(_0x494915){if(_0x494915){var _0x1c1c5e=typeof _0xedf218[_0x5230('0x2f')]===_0x5230('0x30')&&typeof _0xedf218[_0x5230('0x31')]===_0x5230('0x30');var _0x471c7a=_0x494915['count'];var _0x4cf0ae=_0x1c1c5e?0x0:_0xedf218[_0x5230('0x2f')];var _0x187d12=_0x1c1c5e?_0x494915['count']:_0xedf218[_0x5230('0x2f')]+_0xedf218[_0x5230('0x31')];var _0x2ee011;if(_0x187d12>=_0x471c7a){_0x187d12=_0x471c7a;_0x2ee011=0xc8;}else{_0x2ee011=0xce;}_0x39ca3a['status'](_0x2ee011);return _0x39ca3a[_0x5230('0x32')](_0x5230('0x33'),_0x4cf0ae+'-'+_0x187d12+'/'+_0x471c7a)['json'](_0x494915);}return null;};}function patchUpdates(_0x2f3865){return function(_0x52e296){try{jsonpatch[_0x5230('0x34')](_0x52e296,_0x2f3865,!![]);}catch(_0x336529){return BPromise[_0x5230('0x35')](_0x336529);}return _0x52e296[_0x5230('0x36')]();};}function saveUpdates(_0x416d6b,_0x136dde){return function(_0x44df2a){if(_0x44df2a){return _0x44df2a[_0x5230('0x37')](_0x416d6b)[_0x5230('0x20')](function(_0x22b7fa){return _0x22b7fa;});}return null;};}function removeEntity(_0x56292b,_0x2eae50){return function(_0x546242){if(_0x546242){return _0x546242[_0x5230('0x38')]()[_0x5230('0x20')](function(){var _0xbd00db=_0x546242['get']({'plain':!![]});var _0x407a3b=_0x5230('0x39');return db[_0x5230('0x3a')]['destroy']({'where':{'type':_0x407a3b,'resourceId':_0xbd00db['id']}})[_0x5230('0x20')](function(){return _0x546242;});})[_0x5230('0x20')](function(){_0x56292b[_0x5230('0x2d')](0xcc)[_0x5230('0x2c')]();});}};}function handleEntityNotFound(_0x57077b,_0x5c82dc){return function(_0x3e220c){if(!_0x3e220c){_0x57077b['sendStatus'](0x194);}return _0x3e220c;};}function handleError(_0x4b1be6,_0xb1c24f){_0xb1c24f=_0xb1c24f||0x1f4;return function(_0x19699b){logger[_0x5230('0x26')](_0x19699b[_0x5230('0x3b')]);if(_0x19699b['name']){delete _0x19699b['name'];}_0x4b1be6[_0x5230('0x2d')](_0xb1c24f)[_0x5230('0x3c')](_0x19699b);};}exports['index']=function(_0x5b4f62,_0x570db0){var _0x59dc0c={'include':[{'model':db[_0x5230('0x3d')],'as':_0x5230('0x3e')}]},_0x5c7bca={},_0x21af0c={'count':0x0,'rows':[]};var _0x315e69=_[_0x5230('0x3f')](db[_0x5230('0x40')][_0x5230('0x41')],function(_0x426234){return{'name':_0x426234['fieldName'],'type':_0x426234['type']['key']};});_0x5c7bca[_0x5230('0x42')]=_[_0x5230('0x3f')](_0x315e69,_0x5230('0x43'));_0x5c7bca[_0x5230('0x44')]=_[_0x5230('0x45')](_0x5b4f62[_0x5230('0x44')]);_0x5c7bca['filters']=_[_0x5230('0x46')](_0x5c7bca[_0x5230('0x42')],_0x5c7bca[_0x5230('0x44')]);_0x59dc0c['attributes']=_[_0x5230('0x46')](_0x5c7bca[_0x5230('0x42')],qs[_0x5230('0x47')](_0x5b4f62[_0x5230('0x44')][_0x5230('0x47')]));_0x59dc0c[_0x5230('0x48')]=_0x59dc0c['attributes'][_0x5230('0x49')]?_0x59dc0c[_0x5230('0x48')]:_0x5c7bca[_0x5230('0x42')];if(!_0x5b4f62[_0x5230('0x44')]['hasOwnProperty']('nolimit')){_0x59dc0c[_0x5230('0x31')]=qs[_0x5230('0x31')](_0x5b4f62['query']['limit']);_0x59dc0c[_0x5230('0x2f')]=qs[_0x5230('0x2f')](_0x5b4f62[_0x5230('0x44')][_0x5230('0x2f')]);}_0x59dc0c[_0x5230('0x4a')]=qs[_0x5230('0x4b')](_0x5b4f62[_0x5230('0x44')][_0x5230('0x4b')]);_0x59dc0c['where']=qs['filters'](_[_0x5230('0x4c')](_0x5b4f62[_0x5230('0x44')],_0x5c7bca[_0x5230('0x4d')]),_0x315e69);if(_0x5b4f62[_0x5230('0x44')][_0x5230('0x4e')]){_0x59dc0c[_0x5230('0x4f')]=_['merge'](_0x59dc0c['where'],{'$or':_[_0x5230('0x3f')](_0x315e69,function(_0x1b9f5b){if(_0x1b9f5b[_0x5230('0x50')]!==_0x5230('0x51')){var _0x19c9ca={};_0x19c9ca[_0x1b9f5b[_0x5230('0x43')]]={'$like':'%'+_0x5b4f62[_0x5230('0x44')][_0x5230('0x4e')]+'%'};return _0x19c9ca;}})});}_0x59dc0c=_[_0x5230('0x52')]({},_0x59dc0c,_0x5b4f62[_0x5230('0x53')]);var _0x4f6a81={'where':_0x59dc0c[_0x5230('0x4f')]};return db[_0x5230('0x40')][_0x5230('0x54')](_0x4f6a81)['then'](function(_0x225c58){_0x21af0c['count']=_0x225c58;if(_0x5b4f62['query'][_0x5230('0x55')]){_0x59dc0c[_0x5230('0x56')]=[{'all':!![]}];}return db[_0x5230('0x40')][_0x5230('0x57')](_0x59dc0c);})[_0x5230('0x20')](function(_0x249082){_0x21af0c[_0x5230('0x58')]=_0x249082;return _0x21af0c;})[_0x5230('0x20')](respondWithFilteredResult(_0x570db0,_0x59dc0c))['catch'](handleError(_0x570db0,null));};exports[_0x5230('0x59')]=function(_0x4cfb79,_0x470f73){var _0x2bfae7={'raw':![],'where':{'id':_0x4cfb79[_0x5230('0x5a')]['id']},'include':[{'model':db[_0x5230('0x3d')],'as':_0x5230('0x3e')}]},_0x4260c2={};_0x4260c2[_0x5230('0x42')]=_[_0x5230('0x45')](db['SmsAccount'][_0x5230('0x41')]);_0x4260c2['query']=_[_0x5230('0x45')](_0x4cfb79[_0x5230('0x44')]);_0x4260c2['filters']=_[_0x5230('0x46')](_0x4260c2[_0x5230('0x42')],_0x4260c2[_0x5230('0x44')]);_0x2bfae7[_0x5230('0x48')]=_['intersection'](_0x4260c2[_0x5230('0x42')],qs[_0x5230('0x47')](_0x4cfb79['query'][_0x5230('0x47')]));_0x2bfae7[_0x5230('0x48')]=_0x2bfae7[_0x5230('0x48')][_0x5230('0x49')]?_0x2bfae7[_0x5230('0x48')]:_0x4260c2[_0x5230('0x42')];if(_0x4cfb79[_0x5230('0x44')]['includeAll']){_0x2bfae7[_0x5230('0x56')]=[{'all':!![]}];}_0x2bfae7=_[_0x5230('0x52')]({},_0x2bfae7,_0x4cfb79[_0x5230('0x53')]);return db[_0x5230('0x40')][_0x5230('0x5b')](_0x2bfae7)['then'](handleEntityNotFound(_0x470f73,null))['then'](respondWithResult(_0x470f73,null))[_0x5230('0x2a')](handleError(_0x470f73,null));};exports[_0x5230('0x5c')]=function(_0x1ea320,_0x4381ff){return db[_0x5230('0x40')]['create'](_0x1ea320['body'],{})[_0x5230('0x20')](function(_0x174a29){var _0x1135fd=_0x1ea320['user']['get']({'plain':!![]});if(!_0x1135fd)throw new Error(_0x5230('0x5d'));if(_0x1135fd[_0x5230('0x5e')]==='user'){var _0x370c9b=_0x174a29[_0x5230('0x5f')]({'plain':!![]});var _0x4f5c6e=_0x5230('0x39');return db[_0x5230('0x60')][_0x5230('0x5b')]({'where':{'name':_0x4f5c6e,'userProfileId':_0x1135fd[_0x5230('0x61')]},'raw':!![]})[_0x5230('0x20')](function(_0x2dd162){if(_0x2dd162&&_0x2dd162[_0x5230('0x62')]===0x0){return db[_0x5230('0x3a')]['create']({'name':_0x370c9b[_0x5230('0x43')],'resourceId':_0x370c9b['id'],'type':_0x2dd162[_0x5230('0x43')],'sectionId':_0x2dd162['id']},{})[_0x5230('0x20')](function(){return _0x174a29;});}else{return _0x174a29;}})['catch'](function(_0x1d5814){logger['error'](_0x5230('0x63'),_0x1d5814);throw _0x1d5814;});}return _0x174a29;})[_0x5230('0x20')](respondWithResult(_0x4381ff,0xc9))[_0x5230('0x2a')](handleError(_0x4381ff,null));};exports[_0x5230('0x37')]=function(_0x112bc8,_0x3a906c){if(_0x112bc8['body']['id']){delete _0x112bc8['body']['id'];}return db[_0x5230('0x40')][_0x5230('0x5b')]({'where':{'id':_0x112bc8[_0x5230('0x5a')]['id']},'include':[{'model':db[_0x5230('0x3d')],'as':_0x5230('0x3e')}]})[_0x5230('0x20')](handleEntityNotFound(_0x3a906c,null))[_0x5230('0x20')](saveUpdates(_0x112bc8[_0x5230('0x64')],null))['then'](respondWithResult(_0x3a906c,null))[_0x5230('0x2a')](handleError(_0x3a906c,null));};exports[_0x5230('0x38')]=function(_0x5a31c4,_0x5366b5){return db[_0x5230('0x40')][_0x5230('0x5b')]({'where':{'id':_0x5a31c4[_0x5230('0x5a')]['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x5366b5,null))[_0x5230('0x20')](removeEntity(_0x5366b5,null))[_0x5230('0x2a')](handleError(_0x5366b5,null));};exports[_0x5230('0x65')]=function(_0x4eee2a,_0x4566a){return db[_0x5230('0x40')]['describe']()[_0x5230('0x20')](respondWithResult(_0x4566a,null))[_0x5230('0x2a')](handleError(_0x4566a,null));};exports[_0x5230('0x66')]=function(_0x1560e7,_0x343270,_0x11fe0c){if(_0x1560e7[_0x5230('0x64')]['id']){delete _0x1560e7[_0x5230('0x64')]['id'];}return db[_0x5230('0x40')][_0x5230('0x5b')]({'where':{'id':_0x1560e7[_0x5230('0x5a')]['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x343270,null))[_0x5230('0x20')](function(_0x4d88e7){if(_0x4d88e7){_0x1560e7[_0x5230('0x64')][_0x5230('0x67')]=_0x4d88e7['id'];return db[_0x5230('0x68')][_0x5230('0x5c')](_0x1560e7[_0x5230('0x64')]);}})[_0x5230('0x20')](respondWithResult(_0x343270,null))[_0x5230('0x2a')](handleError(_0x343270,null));};exports[_0x5230('0x69')]=function(_0x267908,_0x5b1a68,_0x213bc2){var _0x8cce80={'raw':![],'where':{}};var _0x2551c0={};var _0x2839ef={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x267908[_0x5230('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5b1a68,null))['then'](function(_0x146b0e){if(_0x146b0e){_0x2551c0[_0x5230('0x42')]=_[_0x5230('0x45')](db[_0x5230('0x68')][_0x5230('0x41')]);_0x2551c0['query']=_['keys'](_0x267908[_0x5230('0x44')]);_0x2551c0[_0x5230('0x4d')]=_[_0x5230('0x46')](_0x2551c0[_0x5230('0x42')],_0x2551c0[_0x5230('0x44')]);_0x8cce80[_0x5230('0x48')]=_[_0x5230('0x46')](_0x2551c0[_0x5230('0x42')],qs[_0x5230('0x47')](_0x267908['query'][_0x5230('0x47')]));_0x8cce80[_0x5230('0x48')]=_0x8cce80[_0x5230('0x48')]['length']?_0x8cce80[_0x5230('0x48')]:_0x2551c0[_0x5230('0x42')];if(!_0x267908['query'][_0x5230('0x6a')](_0x5230('0x6b'))){_0x8cce80[_0x5230('0x31')]=qs[_0x5230('0x31')](_0x267908[_0x5230('0x44')][_0x5230('0x31')]);_0x8cce80[_0x5230('0x2f')]=qs['offset'](_0x267908[_0x5230('0x44')]['offset']);}_0x8cce80[_0x5230('0x4a')]=qs[_0x5230('0x4b')](_0x267908[_0x5230('0x44')][_0x5230('0x4b')]);_0x8cce80[_0x5230('0x4f')]=qs[_0x5230('0x4d')](_[_0x5230('0x4c')](_0x267908[_0x5230('0x44')],_0x2551c0['filters']));_0x8cce80[_0x5230('0x4f')][_0x5230('0x67')]=_0x146b0e['id'];if(_0x267908[_0x5230('0x44')]['filter']){_0x8cce80[_0x5230('0x4f')]=_['merge'](_0x8cce80[_0x5230('0x4f')],{'$or':_[_0x5230('0x3f')](_0x8cce80['attributes'],function(_0x1ff7d4){var _0x55f853={};_0x55f853[_0x1ff7d4]={'$like':'%'+_0x267908[_0x5230('0x44')]['filter']+'%'};return _0x55f853;})});}_0x8cce80=_[_0x5230('0x52')]({},_0x8cce80,_0x267908['options']);return db[_0x5230('0x68')]['count']({'where':_0x8cce80['where']})[_0x5230('0x20')](function(_0x1b5df3){_0x2839ef['count']=_0x1b5df3;if(_0x267908[_0x5230('0x44')][_0x5230('0x55')]){_0x8cce80[_0x5230('0x56')]=[{'all':!![]}];}return db[_0x5230('0x68')][_0x5230('0x57')](_0x8cce80);})[_0x5230('0x20')](function(_0x44ba72){_0x2839ef[_0x5230('0x58')]=_0x44ba72;return _0x2839ef;});}})[_0x5230('0x20')](respondWithFilteredResult(_0x5b1a68,_0x8cce80))[_0x5230('0x2a')](handleError(_0x5b1a68,null));};exports['removeDispositions']=function(_0xb28184,_0x411c3a,_0x249185){return db[_0x5230('0x40')][_0x5230('0x5b')]({'where':{'id':_0xb28184[_0x5230('0x5a')]['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x411c3a,null))[_0x5230('0x20')](function(_0xc21525){if(_0xc21525){return _0xc21525[_0x5230('0x6c')](_0xb28184[_0x5230('0x44')][_0x5230('0x6d')]);}})[_0x5230('0x20')](respondWithStatusCode(_0x411c3a,null))['catch'](handleError(_0x411c3a,null));};exports[_0x5230('0x6e')]=function(_0xe7c727,_0x2786de,_0x59c184){if(_0xe7c727[_0x5230('0x64')]['id']){delete _0xe7c727[_0x5230('0x64')]['id'];}return db[_0x5230('0x40')][_0x5230('0x5b')]({'where':{'id':_0xe7c727[_0x5230('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2786de,null))[_0x5230('0x20')](function(_0x377f8a){if(_0x377f8a){_0xe7c727[_0x5230('0x64')][_0x5230('0x67')]=_0x377f8a['id'];return db[_0x5230('0x6f')][_0x5230('0x5c')](_0xe7c727['body']);}})[_0x5230('0x20')](respondWithResult(_0x2786de,null))['catch'](handleError(_0x2786de,null));};exports['getAnswers']=function(_0x16dc35,_0x3ab76f,_0x1d70c2){var _0x11d4c1={'raw':![],'where':{}};var _0x1e559f={};var _0x31df9e={'count':0x0,'rows':[]};return db[_0x5230('0x40')][_0x5230('0x70')]({'where':{'id':_0x16dc35['params']['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x3ab76f,null))['then'](function(_0x40644f){if(_0x40644f){_0x1e559f['model']=_['keys'](db[_0x5230('0x6f')]['rawAttributes']);_0x1e559f['query']=_['keys'](_0x16dc35['query']);_0x1e559f['filters']=_[_0x5230('0x46')](_0x1e559f[_0x5230('0x42')],_0x1e559f[_0x5230('0x44')]);_0x11d4c1[_0x5230('0x48')]=_['intersection'](_0x1e559f[_0x5230('0x42')],qs['fields'](_0x16dc35[_0x5230('0x44')][_0x5230('0x47')]));_0x11d4c1[_0x5230('0x48')]=_0x11d4c1[_0x5230('0x48')]['length']?_0x11d4c1[_0x5230('0x48')]:_0x1e559f[_0x5230('0x42')];if(!_0x16dc35[_0x5230('0x44')][_0x5230('0x6a')](_0x5230('0x6b'))){_0x11d4c1[_0x5230('0x31')]=qs[_0x5230('0x31')](_0x16dc35[_0x5230('0x44')][_0x5230('0x31')]);_0x11d4c1['offset']=qs[_0x5230('0x2f')](_0x16dc35[_0x5230('0x44')][_0x5230('0x2f')]);}_0x11d4c1['order']=qs[_0x5230('0x4b')](_0x16dc35[_0x5230('0x44')][_0x5230('0x4b')]);_0x11d4c1[_0x5230('0x4f')]=qs[_0x5230('0x4d')](_[_0x5230('0x4c')](_0x16dc35['query'],_0x1e559f[_0x5230('0x4d')]));_0x11d4c1[_0x5230('0x4f')][_0x5230('0x67')]=_0x40644f['id'];if(_0x16dc35['query'][_0x5230('0x4e')]){_0x11d4c1[_0x5230('0x4f')]=_[_0x5230('0x52')](_0x11d4c1[_0x5230('0x4f')],{'$or':_['map'](_0x11d4c1['attributes'],function(_0x489d9b){var _0x56704c={};_0x56704c[_0x489d9b]={'$like':'%'+_0x16dc35['query'][_0x5230('0x4e')]+'%'};return _0x56704c;})});}_0x11d4c1=_[_0x5230('0x52')]({},_0x11d4c1,_0x16dc35[_0x5230('0x53')]);return db['CannedAnswer'][_0x5230('0x54')]({'where':_0x11d4c1[_0x5230('0x4f')]})[_0x5230('0x20')](function(_0x1ba9e6){_0x31df9e[_0x5230('0x54')]=_0x1ba9e6;if(_0x16dc35[_0x5230('0x44')][_0x5230('0x55')]){_0x11d4c1[_0x5230('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5230('0x57')](_0x11d4c1);})[_0x5230('0x20')](function(_0x3225e6){_0x31df9e[_0x5230('0x58')]=_0x3225e6;return _0x31df9e;});}})[_0x5230('0x20')](respondWithFilteredResult(_0x3ab76f,_0x11d4c1))[_0x5230('0x2a')](handleError(_0x3ab76f,null));};exports[_0x5230('0x71')]=function(_0x3925a9,_0x1b9655,_0x15fca7){return db[_0x5230('0x40')][_0x5230('0x5b')]({'where':{'id':_0x3925a9['params']['id']}})['then'](handleEntityNotFound(_0x1b9655,null))[_0x5230('0x20')](function(_0x460d87){if(_0x460d87){return _0x460d87[_0x5230('0x71')](_0x3925a9[_0x5230('0x44')][_0x5230('0x6d')]);}})[_0x5230('0x20')](respondWithStatusCode(_0x1b9655,null))[_0x5230('0x2a')](handleError(_0x1b9655,null));};exports['notify']=function(_0x61bc5a,_0x2978dc,_0x55b960){var _0x13b538={'channel':_0x5230('0x72')};var _0x1f278c=[];var _0x174401=[];var _0x4e5fd0={};return db['SmsAccount'][_0x5230('0x5b')]({'where':{'id':_0x61bc5a[_0x5230('0x5a')]['id']},'include':[{'model':db[_0x5230('0x73')],'as':_0x5230('0x74')}]})[_0x5230('0x20')](handleEntityNotFound(_0x2978dc,null))[_0x5230('0x20')](function(_0x49136f){_0x13b538['account']=_0x49136f;_0x13b538[_0x5230('0x75')]=_['orderBy'](_0x49136f['Applications'],[_0x5230('0x76')],[_0x5230('0x77')]);if(_0x13b538[_0x5230('0x78')]['Applications']){delete _0x13b538['account'][_0x5230('0x74')];}return db[_0x5230('0x79')]['describe']();})[_0x5230('0x20')](function(_0x29a2ac){if(!_0x29a2ac){throw new db[(_0x5230('0x7a'))]['ValidationError'](_0x5230('0x7b'));}_0x1f278c=_[_0x5230('0x7c')](_['keys'](_0x29a2ac),['createdAt',_0x5230('0x7d')]);_0x174401=_['difference'](_[_0x5230('0x45')](_0x29a2ac),['createdAt',_0x5230('0x7d'),_0x5230('0x7e'),_0x5230('0x7f')]);_0x13b538[_0x5230('0x64')]={'mapKey':_0x5230('0x80')};if(_0x13b538[_0x5230('0x78')][_0x5230('0x50')]){switch(_0x13b538[_0x5230('0x78')][_0x5230('0x50')]){case _0x5230('0x81'):_0x13b538[_0x5230('0x64')][_0x5230('0x82')]=_0x61bc5a[_0x5230('0x64')]['From'];_0x13b538[_0x5230('0x64')][_0x5230('0x64')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x83')];_0x13b538[_0x5230('0x64')][_0x5230('0x84')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x85')];break;case _0x5230('0x86'):_0x13b538[_0x5230('0x64')][_0x5230('0x82')]='+'+_0x61bc5a[_0x5230('0x64')]['sender'];_0x13b538[_0x5230('0x64')]['body']=_0x61bc5a['body'][_0x5230('0x87')];break;case _0x5230('0x88'):_0x13b538['body'][_0x5230('0x82')]=_0x61bc5a[_0x5230('0x64')]['from'];_0x13b538[_0x5230('0x64')][_0x5230('0x64')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x28')];break;case _0x5230('0x89'):_0x13b538['body']['from']=_0x61bc5a[_0x5230('0x64')][_0x5230('0x82')];_0x13b538[_0x5230('0x64')][_0x5230('0x64')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x64')];_0x13b538[_0x5230('0x64')][_0x5230('0x84')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x8a')];break;case _0x5230('0x8b'):_0x13b538[_0x5230('0x64')][_0x5230('0x82')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x8c')];_0x13b538[_0x5230('0x64')][_0x5230('0x64')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x8d')];_0x13b538[_0x5230('0x64')][_0x5230('0x84')]=_0x61bc5a['body'][_0x5230('0x8e')];break;case _0x5230('0x8f'):_0x13b538['body']['from']='+'+_0x61bc5a[_0x5230('0x64')][_0x5230('0x90')][0x0][_0x5230('0x82')];_0x13b538['body'][_0x5230('0x64')]=_0x61bc5a['body'][_0x5230('0x90')][0x0][_0x5230('0x87')];_0x13b538[_0x5230('0x64')][_0x5230('0x84')]=_0x61bc5a[_0x5230('0x64')]['results'][0x0][_0x5230('0x84')];break;case _0x5230('0x91'):_0x13b538['body'][_0x5230('0x82')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x92')];_0x13b538[_0x5230('0x64')][_0x5230('0x64')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x93')][_0x5230('0x28')];break;case _0x5230('0x94'):_0x13b538[_0x5230('0x64')][_0x5230('0x82')]=_0x61bc5a['body'][_0x5230('0x95')];_0x13b538[_0x5230('0x64')][_0x5230('0x64')]=_0x61bc5a[_0x5230('0x64')][_0x5230('0x87')];_0x13b538[_0x5230('0x64')][_0x5230('0x84')]=_0x61bc5a[_0x5230('0x64')]['replyMessageId'];break;case _0x5230('0x96'):_0x13b538[_0x5230('0x64')][_0x5230('0x84')]=_0x61bc5a[_0x5230('0x64')][0x0][_0x5230('0x28')]['id'];_0x13b538['body']['from']=_0x61bc5a[_0x5230('0x64')][0x0]['message'][_0x5230('0x82')];_0x13b538[_0x5230('0x64')][_0x5230('0x64')]=_0x61bc5a[_0x5230('0x64')][0x0][_0x5230('0x28')][_0x5230('0x87')];break;case _0x5230('0x97'):_0x13b538[_0x5230('0x64')]['from']=_0x61bc5a['body']['from'];_0x13b538['body']['body']=_0x61bc5a[_0x5230('0x64')][_0x5230('0x28')];_0x13b538[_0x5230('0x64')][_0x5230('0x84')]=_0x61bc5a[_0x5230('0x64')]['refid'];break;}}if(_0x13b538['body']['id']){delete _0x13b538[_0x5230('0x64')]['id'];}if(_[_0x5230('0x98')](_0x13b538[_0x5230('0x64')]['from'])){throw new db[(_0x5230('0x7a'))][(_0x5230('0x99'))](_0x5230('0x9a'));}if(_[_0x5230('0x98')](_0x13b538[_0x5230('0x64')][_0x5230('0x64')])||_0x13b538[_0x5230('0x64')][_0x5230('0x64')]===''){throw new db[(_0x5230('0x7a'))]['ValidationError'](_0x5230('0x9b'));}if(_['isNil'](_0x13b538[_0x5230('0x64')][_0x5230('0x9c')])){throw new db['Sequelize'][(_0x5230('0x99'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x174401);}if(!_[_0x5230('0x9d')](_0x174401,_0x13b538[_0x5230('0x64')][_0x5230('0x9c')])){throw new db['Sequelize']['ValidationError'](_0x5230('0x9e')+_0x174401);}_0x4e5fd0[_0x13b538[_0x5230('0x64')][_0x5230('0x9c')]]=_0x13b538[_0x5230('0x64')][_0x5230('0x82')];return db[_0x5230('0x9f')][_0x5230('0x5b')]({'where':{'id':_0x13b538[_0x5230('0x78')][_0x5230('0x7f')]},'include':[{'model':db[_0x5230('0x79')],'as':_0x5230('0xa0'),'where':_0x4e5fd0,'limit':0x1,'order':[[_0x5230('0x7d'),'DESC']]}]});})[_0x5230('0x20')](handleEntityNotFound(_0x2978dc,null))['then'](function(_0x3d4d15){if(_0x3d4d15){_0x13b538['list']=_[_0x5230('0xa1')](_0x3d4d15,['Contacts']);if(_0x3d4d15[_0x5230('0xa0')][_0x5230('0x49')]){return _0x3d4d15[_0x5230('0xa0')][0x0];}var _0xd08ff2=_[_0x5230('0x18')](_0x13b538['body'],{'firstName':_0x13b538[_0x5230('0x64')]['from'],'ListId':_0x3d4d15['id']});_0xd08ff2[_0x13b538['body']['mapKey']]=_0x13b538[_0x5230('0x64')][_0x5230('0x82')];return db[_0x5230('0x79')]['create'](_0xd08ff2,{'fields':_0x1f278c,'raw':!![]});}})[_0x5230('0x20')](handleEntityNotFound(_0x2978dc,null))[_0x5230('0x20')](function(_0x383cc4){if(_0x383cc4){_0x13b538['contact']=_0x383cc4;var _0x1360b4={'ContactId':_0x383cc4['id'],'phone':_0x13b538[_0x5230('0x64')][_0x5230('0x82')],'SmsAccountId':_0x61bc5a['params']['id']};var _0x3f082d={'ContactId':_0x383cc4['id'],'SmsAccountId':_0x61bc5a[_0x5230('0x5a')]['id'],'closed':![]};return db[_0x5230('0xa2')][_0x5230('0x5b')]({'where':_0x3f082d})[_0x5230('0x20')](function(_0x2d94e9){if(_0x2d94e9){return[_0x2d94e9,![]];}return db[_0x5230('0xa2')][_0x5230('0x5c')](_0x1360b4)['then'](function(_0x59c033){return[_0x59c033,!![]];});});}})[_0x5230('0xa3')](function(_0x45481e,_0x51ecd9){_0x13b538[_0x5230('0xa4')]=_0x45481e['get']({'plain':!![]});_0x13b538[_0x5230('0xa4')][_0x5230('0xa5')]=![];if(_0x51ecd9){if(_0x13b538[_0x5230('0x78')][_0x5230('0xa6')]){_0x13b538[_0x5230('0x75')]['push']({'id':0x0,'priority':_0x13b538[_0x5230('0x75')][_0x5230('0x49')]+0x1,'app':_0x5230('0xa7'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x13b538[_0x5230('0xa4')]['created']=!![];}return db[_0x5230('0xa8')][_0x5230('0x5c')]({'phone':_0x13b538[_0x5230('0x64')][_0x5230('0x82')],'messageId':_0x13b538[_0x5230('0x64')]['messageId'],'body':_0x13b538[_0x5230('0x64')][_0x5230('0x64')],'SmsAccountId':_0x61bc5a[_0x5230('0x5a')]['id'],'SmsInteractionId':_0x45481e['id'],'direction':'in','ContactId':_0x45481e[_0x5230('0xa9')],'AttachmentId':_0x13b538[_0x5230('0x64')][_0x5230('0xaa')]});})[_0x5230('0x20')](function(_0x130624){_0x13b538[_0x5230('0x28')]=_0x130624;if(!_0x13b538[_0x5230('0xa4')][_0x5230('0xab')])return;return db['User'][_0x5230('0x5b')]({'attributes':['id','name'],'where':{'id':_0x13b538['interaction'][_0x5230('0xab')]}});})[_0x5230('0x20')](function(_0x5d7cdd){if(_0x5d7cdd){_0x13b538[_0x5230('0x75')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5230('0xac'),'appdata':_0x5d7cdd['name']+','+(_0x13b538['account'][_0x5230('0xad')]||0xa),'interval':_0x5230('0xae')});}if(!_0x13b538[_0x5230('0xa4')][_0x5230('0xaf')])return;return db[_0x5230('0xb0')][_0x5230('0x5b')]({'attributes':['id',_0x5230('0x43')],'where':{'id':_0x13b538['interaction']['queueId']}});})['then'](function(_0x2acda8){if(_0x2acda8){_0x13b538[_0x5230('0x75')][_0x5230('0xb1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2acda8[_0x5230('0x43')]+','+(_0x13b538[_0x5230('0x78')][_0x5230('0xb2')]||0x12c),'interval':_0x5230('0xae')});}return respondWithRpcPromise(_0x5230('0xb3'),_0x5230('0xb4'),_0x13b538);})['then'](function(_0xd425fd){if(_0xd425fd){var _0x76f6f1=0xc8;var _0x5470cb=_0x5230('0xb5');logger[_0x5230('0x21')](_0x5230('0x25'),_0x5470cb,_0x76f6f1,_0x5230('0xb6'));logger[_0x5230('0x24')](_0x5230('0xb7'),_0x5470cb,_0x76f6f1,_0x5230('0xb6'),JSON[_0x5230('0xb8')](_0xd425fd));if(_0x13b538[_0x5230('0x78')]['type']===_0x5230('0x81')){return _0x2978dc[_0x5230('0x2d')](_0x76f6f1)[_0x5230('0x32')](_0x5230('0xb9'),_0x5230('0xba'))[_0x5230('0x3c')]('\x0a');}else{return _0x2978dc[_0x5230('0x2d')](_0x76f6f1)[_0x5230('0x2e')](_0xd425fd);}}})[_0x5230('0x2a')](handleError(_0x2978dc,null));};exports[_0x5230('0xbb')]=function(_0x9a51e,_0xb32177){var _0x1eb8d7=_0x9a51e[_0x5230('0x5a')]['id'];var _0x33e0b8=_0x9a51e[_0x5230('0x64')];var _0x3083b1=0xc8;var _0xe89110=null;return db[_0x5230('0xbc')][_0x5230('0xbd')]({'isolationLevel':db[_0x5230('0xbc')][_0x5230('0xbe')][_0x5230('0xbf')][_0x5230('0xc0')]},function(_0x1ac48f){return db[_0x5230('0x40')][_0x5230('0x70')]({'where':{'id':_0x1eb8d7},'transaction':_0x1ac48f})[_0x5230('0x20')](function(_0x557bee){if(_0x557bee){return db[_0x5230('0x73')]['destroy']({'where':{'SmsAccountId':_0x1eb8d7},'transaction':_0x1ac48f})[_0x5230('0x20')](function(){var _0x2d6257=_['map'](_0x33e0b8,function(_0x47be4b){_0x47be4b[_0x5230('0x67')]=_0x1eb8d7;return _0x47be4b;});return db['SmsApplication']['bulkCreate'](_0x2d6257,{'transaction':_0x1ac48f});});}else{_0x3083b1=0x194;_0xe89110=[];}});})['then'](function(){if(_0x3083b1!==0x194){return db[_0x5230('0x73')]['findAndCountAll']({'where':{'SmsAccountId':_0x1eb8d7},'order':'priority'})[_0x5230('0x20')](function(_0x536419){_0xe89110=_0x536419;});}})[_0x5230('0x2a')](function(_0xc1e243){_0x3083b1=0x1f4;logger['error'](_0xc1e243[_0x5230('0x3b')]);if(_0xc1e243[_0x5230('0x43')]){delete _0xc1e243[_0x5230('0x43')];}_0xe89110=_0xc1e243;})[_0x5230('0xc1')](function(){if(_0xe89110===null){_0xb32177['sendStatus'](_0x3083b1);}else{if(_0x3083b1===0x1f4){_0xb32177[_0x5230('0x2d')](_0x3083b1)[_0x5230('0x3c')](_0xe89110);}else{_0xb32177[_0x5230('0x2d')](_0x3083b1)[_0x5230('0x2e')](_0xe89110);}}});};exports[_0x5230('0xc2')]=function(_0x57e112,_0x1be586,_0x3f9f43){var _0x4f8ceb={};var _0x239667={};var _0x11289a;var _0x37057f;return db[_0x5230('0x40')][_0x5230('0x70')]({'where':{'id':_0x57e112[_0x5230('0x5a')]['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x1be586,null))['then'](function(_0x5aec3e){if(_0x5aec3e){_0x11289a=_0x5aec3e;_0x239667[_0x5230('0x42')]=_['keys'](db['SmsApplication'][_0x5230('0x41')]);_0x239667['query']=_['keys'](_0x57e112[_0x5230('0x44')]);_0x239667[_0x5230('0x4d')]=_[_0x5230('0x46')](_0x239667[_0x5230('0x42')],_0x239667['query']);_0x4f8ceb[_0x5230('0x48')]=_['intersection'](_0x239667[_0x5230('0x42')],qs['fields'](_0x57e112[_0x5230('0x44')][_0x5230('0x47')]));_0x4f8ceb[_0x5230('0x48')]=_0x4f8ceb[_0x5230('0x48')][_0x5230('0x49')]?_0x4f8ceb['attributes']:_0x239667[_0x5230('0x42')];_0x4f8ceb[_0x5230('0x4a')]=qs[_0x5230('0x4b')](_0x57e112[_0x5230('0x44')][_0x5230('0x4b')]);_0x4f8ceb[_0x5230('0x4f')]=qs[_0x5230('0x4d')](_[_0x5230('0x4c')](_0x57e112[_0x5230('0x44')],_0x239667[_0x5230('0x4d')]));if(_0x57e112['query'][_0x5230('0x4e')]){_0x4f8ceb[_0x5230('0x4f')]=_['merge'](_0x4f8ceb['where'],{'$or':_[_0x5230('0x3f')](_0x4f8ceb[_0x5230('0x48')],function(_0x17f3fe){var _0x15220e={};_0x15220e[_0x17f3fe]={'$like':'%'+_0x57e112[_0x5230('0x44')][_0x5230('0x4e')]+'%'};return _0x15220e;})});}_0x4f8ceb=_[_0x5230('0x52')]({},_0x4f8ceb,_0x57e112[_0x5230('0x53')]);return _0x11289a[_0x5230('0xc2')](_0x4f8ceb);}})[_0x5230('0x20')](function(_0x3806fc){if(_0x3806fc){_0x37057f=_0x3806fc['length'];if(!_0x57e112[_0x5230('0x44')][_0x5230('0x6a')]('nolimit')){_0x4f8ceb[_0x5230('0x31')]=qs['limit'](_0x57e112['query'][_0x5230('0x31')]);_0x4f8ceb[_0x5230('0x2f')]=qs[_0x5230('0x2f')](_0x57e112[_0x5230('0x44')][_0x5230('0x2f')]);}return _0x11289a[_0x5230('0xc2')](_0x4f8ceb);}})['then'](function(_0x32d2e3){if(_0x32d2e3){return _0x32d2e3?{'count':_0x37057f,'rows':_0x32d2e3}:null;}})[_0x5230('0x20')](respondWithResult(_0x1be586,null))['catch'](handleError(_0x1be586,null));};exports[_0x5230('0xc3')]=function(_0x2b13c0,_0x492de6,_0x41cd47){var _0x533b32={'raw':![],'where':{}};var _0x1f4e81={};var _0x164823={'count':0x0,'rows':[]};return db[_0x5230('0x40')][_0x5230('0x70')]({'where':{'id':_0x2b13c0['params']['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x492de6,null))[_0x5230('0x20')](function(_0x3127b4){if(_0x3127b4){_0x1f4e81[_0x5230('0x42')]=_[_0x5230('0x45')](db['SmsInteraction']['rawAttributes']);_0x1f4e81[_0x5230('0x44')]=_[_0x5230('0x45')](_0x2b13c0[_0x5230('0x44')]);_0x1f4e81[_0x5230('0x4d')]=_['intersection'](_0x1f4e81[_0x5230('0x42')],_0x1f4e81[_0x5230('0x44')]);_0x533b32[_0x5230('0x48')]=_[_0x5230('0x46')](_0x1f4e81['model'],qs['fields'](_0x2b13c0[_0x5230('0x44')][_0x5230('0x47')]));_0x533b32[_0x5230('0x48')]=_0x533b32['attributes'][_0x5230('0x49')]?_0x533b32[_0x5230('0x48')]:_0x1f4e81[_0x5230('0x42')];if(!_0x2b13c0['query']['hasOwnProperty'](_0x5230('0x6b'))){_0x533b32['limit']=qs['limit'](_0x2b13c0['query'][_0x5230('0x31')]);_0x533b32[_0x5230('0x2f')]=qs[_0x5230('0x2f')](_0x2b13c0['query']['offset']);}_0x533b32['order']=qs['sort'](_0x2b13c0[_0x5230('0x44')][_0x5230('0x4b')]);_0x533b32[_0x5230('0x4f')]=qs[_0x5230('0x4d')](_['pick'](_0x2b13c0['query'],_0x1f4e81[_0x5230('0x4d')]));_0x533b32[_0x5230('0x4f')][_0x5230('0x67')]=_0x3127b4['id'];if(_0x2b13c0[_0x5230('0x44')][_0x5230('0x4e')]){_0x533b32[_0x5230('0x4f')]=_[_0x5230('0x52')](_0x533b32['where'],{'$or':_[_0x5230('0x3f')](_0x533b32[_0x5230('0x48')],function(_0x441b56){var _0x53b8d5={};_0x53b8d5[_0x441b56]={'$like':'%'+_0x2b13c0[_0x5230('0x44')][_0x5230('0x4e')]+'%'};return _0x53b8d5;})});}_0x533b32=_[_0x5230('0x52')]({},_0x533b32,_0x2b13c0['options']);return db[_0x5230('0xa2')][_0x5230('0x54')]({'where':_0x533b32[_0x5230('0x4f')]})['then'](function(_0x5caa63){_0x164823[_0x5230('0x54')]=_0x5caa63;if(_0x2b13c0[_0x5230('0x44')][_0x5230('0x55')]){_0x533b32[_0x5230('0x56')]=[{'model':db['CmContact'],'as':_0x5230('0xc4'),'required':![]},{'model':db[_0x5230('0xc5')],'as':'Owner','attributes':['name',_0x5230('0xc6'),_0x5230('0xc7')],'required':![]},{'model':db[_0x5230('0xc8')],'as':_0x5230('0xc9'),'attributes':['id',_0x5230('0x43'),_0x5230('0xca')],'where':_0x2b13c0[_0x5230('0x44')][_0x5230('0xcb')]?{'id':_0x2b13c0[_0x5230('0x44')][_0x5230('0xcb')]}:undefined,'required':_0x2b13c0[_0x5230('0x44')]['tag']?!![]:![]}];}return db[_0x5230('0xa2')][_0x5230('0x57')](_0x533b32);})['then'](function(_0x42deba){_0x164823['rows']=_0x42deba;return _0x164823;});}})['then'](respondWithFilteredResult(_0x492de6,_0x533b32))['catch'](handleError(_0x492de6,null));};exports[_0x5230('0x3c')]=function(_0x23784a,_0xa4aedb,_0x372cca){var _0x42df7a,_0x376fea,_0x345f35;if(_[_0x5230('0x98')](_0x23784a[_0x5230('0x64')][_0x5230('0x64')])||_0x23784a[_0x5230('0x64')][_0x5230('0x64')]===''){throw new db['Sequelize'][(_0x5230('0x99'))](_0x5230('0x9b'));}if(_[_0x5230('0x98')](_0x23784a[_0x5230('0x64')]['to'])){throw new db[(_0x5230('0x7a'))][(_0x5230('0x99'))](_0x5230('0xcc'));}_0x42df7a=_0x23784a[_0x5230('0x64')]['to'];return db[_0x5230('0x40')]['find']({'where':{'id':_0x23784a[_0x5230('0x5a')]['id']},'include':[{'model':db[_0x5230('0x9f')],'as':'List','include':[{'model':db[_0x5230('0x79')],'as':_0x5230('0xa0'),'where':{'mobile':_0x42df7a},'limit':0x1,'order':[[_0x5230('0x7d'),_0x5230('0xcd')]]}]}]})['then'](handleEntityNotFound(_0xa4aedb,null))['then'](function(_0x580d5f){if(_0x580d5f&&_0x580d5f['List']){_0x376fea=_0x580d5f[_0x5230('0x5f')]({'plain':!![]});if(_0x376fea[_0x5230('0xce')]&&_0x376fea[_0x5230('0xce')]['Contacts'][_0x5230('0x49')]){return _0x376fea[_0x5230('0xce')]['Contacts'][0x0];}return db['CmContact'][_0x5230('0x5c')](_['defaults'](_0x23784a[_0x5230('0x64')],{'firstName':_0x42df7a,'mobile':_0x42df7a,'phone':_0x42df7a,'ListId':_0x376fea[_0x5230('0x7f')]}));}})['then'](handleEntityNotFound(_0xa4aedb,null))[_0x5230('0x20')](function(_0x5a1234){if(_0x5a1234){_0x345f35=_0x5a1234;return db[_0x5230('0xa2')][_0x5230('0x5b')]({'where':{'ContactId':_0x345f35['id'],'closed':![],'SmsAccountId':_0x376fea['id']}})[_0x5230('0x20')](function(_0x375ec0){if(_0x375ec0){return[_0x375ec0,![]];}return db['SmsInteraction'][_0x5230('0x5c')]({'UserId':_0x23784a['user']['id'],'ContactId':_0x345f35['id'],'SmsAccountId':_0x376fea['id'],'phone':_0x42df7a,'firstMsgDirection':_0x5230('0xcf'),'Messages':[_[_0x5230('0x52')](_0x23784a[_0x5230('0x64')],{'read':![],'body':_0x23784a[_0x5230('0x64')][_0x5230('0x64')],'phone':_0x42df7a,'SmsAccountId':_0x376fea['id'],'UserId':_0x23784a['user']['id'],'ContactId':_0x345f35['id']})]},{'include':[{'model':db[_0x5230('0xa8')],'as':_0x5230('0xd0')}]})[_0x5230('0x20')](function(_0x50d0b5){return[_0x50d0b5,!![]];});});}})['spread'](function(_0x3fb146,_0x2dc9e8){if(_0x2dc9e8){return _0x3fb146;}return db['SmsMessage'][_0x5230('0x5c')](_['merge'](_0x23784a[_0x5230('0x64')],{'read':![],'body':_0x23784a['body']['body'],'phone':_0x42df7a,'SmsAccountId':_0x376fea['id'],'SmsInteractionId':_0x3fb146['id'],'UserId':_0x23784a[_0x5230('0xd1')]['id'],'ContactId':_0x345f35['id']}))[_0x5230('0x20')](function(_0x86c34c){_0x3fb146[_0x5230('0xd2')]['Messages']=[];_0x3fb146[_0x5230('0xd2')][_0x5230('0xd0')][_0x5230('0xd3')](_0x86c34c['dataValues']);return _0x3fb146;});})['then'](respondWithResult(_0xa4aedb,null))[_0x5230('0x2a')](handleError(_0xa4aedb,null));};exports[_0x5230('0x2d')]=function(_0xc4e021,_0x45a067,_0x36bf00){if(_0xc4e021['body']['id']){delete _0xc4e021[_0x5230('0x64')]['id'];}var _0x558529,_0x57c201,_0x11e7c9;return db[_0x5230('0x40')][_0x5230('0x5b')]({'where':{'id':_0xc4e021[_0x5230('0x5a')]['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x45a067,null))[_0x5230('0x20')](function(_0x5e9f4a){if(_0x5e9f4a){_0x11e7c9=_0x5e9f4a;logger[_0x5230('0x24')](_0x5230('0x25'),_0x5230('0x2d'),_0x5230('0xd4'),_0x5e9f4a[_0x5230('0x50')],util[_0x5230('0xd5')](_0xc4e021[_0x5230('0x64')],{'showHidden':![],'depth':null}));switch(_0x5e9f4a['type']){case _0x5230('0x86'):if(_0xc4e021[_0x5230('0x64')][_0x5230('0xd6')]&&_0xc4e021[_0x5230('0x64')][_0x5230('0x2d')]){_0x57c201=_0xc4e021[_0x5230('0x64')]['status'];return db[_0x5230('0xa8')][_0x5230('0x5b')]({'where':{'messageId':_0xc4e021[_0x5230('0x64')][_0x5230('0xd6')]}});}break;case _0x5230('0x88'):if(_0xc4e021[_0x5230('0x64')][_0x5230('0xd7')]&&_0xc4e021[_0x5230('0x64')][_0x5230('0xd8')]){_0x57c201=_0xc4e021[_0x5230('0x64')]['statusInt'];return db[_0x5230('0xa8')]['find']({'where':{'messageId':_0xc4e021['body'][_0x5230('0xd7')]}});}break;case'clicksend':if(_0xc4e021['body'][_0x5230('0x8a')]&&_0xc4e021[_0x5230('0x64')]['status_code']){_0x57c201=_0xc4e021[_0x5230('0x64')][_0x5230('0xd9')];return db[_0x5230('0xa8')]['find']({'where':{'messageId':_0xc4e021[_0x5230('0x64')][_0x5230('0x8a')]}});}break;case _0x5230('0x8f'):var _0x4bec15=_0xc4e021[_0x5230('0x64')]['results'][0x0];if(_0x4bec15[_0x5230('0x84')]&&_0x4bec15[_0x5230('0x2d')][_0x5230('0xda')]===_0x5230('0xdb')){_0x57c201=_0x4bec15[_0x5230('0x2d')][_0x5230('0xda')];return db[_0x5230('0xa8')][_0x5230('0x5b')]({'where':{'messageId':_0x4bec15[_0x5230('0x84')]}});}break;case'clickatell':if(_0xc4e021[_0x5230('0x64')]['messageId']&&_0xc4e021['body']['status']){_0x57c201=_0xc4e021[_0x5230('0x64')][_0x5230('0x2d')];return db[_0x5230('0xa8')][_0x5230('0x5b')]({'where':{'messageId':_0xc4e021['body']['messageId']}});}break;case'bandwidth':if(_0xc4e021[_0x5230('0x64')][0x0]['message']['id']){_0x57c201=_0xc4e021[_0x5230('0x64')][0x0]['type'];return db[_0x5230('0xa8')][_0x5230('0x5b')]({'where':{'messageId':_0xc4e021[_0x5230('0x64')][0x0][_0x5230('0x28')]['id']}});}break;case _0x5230('0x97'):if(_0xc4e021['body']['redif']&&_0xc4e021['body'][_0x5230('0x2d')]){_0x57c201=_0xc4e021['body']['status'];return db[_0x5230('0xa8')]['find']({'where':{'messageId':_0xc4e021[_0x5230('0x64')][_0x5230('0xdc')]}});}break;}}})[_0x5230('0x20')](handleEntityNotFound(_0x45a067,null))['then'](function(_0x2db3a9){if(_0x2db3a9){_0x558529=_0x2db3a9;switch(_0x11e7c9[_0x5230('0x50')]){case'skebby':if(_0x57c201==='DELIVERED'){return _0x558529[_0x5230('0x37')]({'read':!![]});}else{logger['error'](_0x5230('0x25'),'status',_0x5230('0x86'),util[_0x5230('0xd5')](_0xc4e021[_0x5230('0x64')],{'showHidden':![],'depth':null}));}break;case _0x5230('0x88'):if(_0x57c201==='1'){return _0x558529[_0x5230('0x37')]({'read':!![]});}else{logger[_0x5230('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5230('0x2d'),_0x5230('0x86'),util[_0x5230('0xd5')](_0xc4e021[_0x5230('0x64')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xc4e021[_0x5230('0x64')][_0x5230('0xdd')]&&_0x57c201>=0xc8&&_0x57c201<=0xce){return _0x558529[_0x5230('0x37')]({'read':!![]});}else{logger[_0x5230('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5230('0x2d'),'clicksend',util[_0x5230('0xd5')](_0xc4e021['body'],{'showHidden':![],'depth':null}));}break;case _0x5230('0x8f'):var _0x41a5db=_0xc4e021[_0x5230('0x64')][_0x5230('0x90')][0x0];if(_0x41a5db[_0x5230('0x2d')][_0x5230('0xda')]===_0x5230('0xdb')){return _0x558529[_0x5230('0x37')]({'read':!![]});}else{logger[_0x5230('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5230('0x2d'),'infobip',util[_0x5230('0xd5')](_0xc4e021[_0x5230('0x64')],{'showHidden':![],'depth':null}));}break;case _0x5230('0x94'):if(_0x57c201==_0x5230('0xde')||_0x57c201==_0x5230('0xdf')){return _0x558529['update']({'read':!![]});}else{logger[_0x5230('0x26')](_0x5230('0x25'),_0x5230('0x2d'),'clickatell',util[_0x5230('0xd5')](_0xc4e021['body'],{'showHidden':![],'depth':null}));}break;case _0x5230('0x96'):if(_0x57c201==_0x5230('0xe0')){return _0x558529[_0x5230('0x37')]({'read':!![]});}else{logger[_0x5230('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5230('0x2d'),_0x5230('0x96'),util[_0x5230('0xd5')](_0xc4e021[_0x5230('0x64')],{'showHidden':![],'depth':null}));}break;case _0x5230('0x97'):if(_0x57c201==='DELIVRD'||_0x57c201===_0x5230('0xe1')){return _0x558529[_0x5230('0x37')]({'read':!![]});}else{logger[_0x5230('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5230('0x2d'),'intelepeer',util[_0x5230('0xd5')](_0xc4e021[_0x5230('0x64')],{'showHidden':![],'depth':null}));}break;}return _0x558529;}})['then'](respondWithResult(_0x45a067,null))[_0x5230('0x2a')](handleError(_0x45a067,null));};exports[_0x5230('0xe2')]=function(_0x5a15a7,_0x5d631f,_0x445cbc){var _0x175cf4,_0x490667,_0x11ee32;return db['SmsAccount'][_0x5230('0x5b')]({'where':{'id':_0x5a15a7[_0x5230('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5d631f,null))['then'](function(_0x1a61bd){if(_0x1a61bd){_0x11ee32=_0x1a61bd;logger[_0x5230('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5230('0x2d'),_0x5230('0xd4'),_0x1a61bd['type'],util[_0x5230('0xd5')](_0x5a15a7[_0x5230('0x44')],{'showHidden':![],'depth':null}));switch(_0x1a61bd[_0x5230('0x50')]){case'csc':if(_0x5a15a7['query']['message-id']&&_0x5a15a7[_0x5230('0x44')][_0x5230('0xe3')]){_0x490667=_0x5a15a7['query'][_0x5230('0xe3')];return db[_0x5230('0xa8')][_0x5230('0x5b')]({'where':{'messageId':_0x5a15a7[_0x5230('0x44')][_0x5230('0xe4')]}});}break;}}})[_0x5230('0x20')](handleEntityNotFound(_0x5d631f,null))[_0x5230('0x20')](function(_0x6a878b){if(_0x6a878b){_0x175cf4=_0x6a878b;switch(_0x11ee32[_0x5230('0x50')]){case _0x5230('0x91'):if(_0x490667==='2'||_0x490667==='6'){return _0x175cf4[_0x5230('0x37')]({'read':!![]});}else{logger[_0x5230('0x26')](_0x5230('0x25'),_0x5230('0x2d'),_0x5230('0x91'),util[_0x5230('0xd5')](_0x5a15a7[_0x5230('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x175cf4;}})[_0x5230('0x20')](respondWithResult(_0x5d631f,null))[_0x5230('0x2a')](handleError(_0x5d631f,null));};exports['addAgents']=function(_0x22e8dd,_0x1147f8,_0x4071cb){return db[_0x5230('0x40')]['find']({'where':{'id':_0x22e8dd[_0x5230('0x5a')]['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x1147f8,null))[_0x5230('0x20')](function(_0x3a79af){if(_0x3a79af){return _0x3a79af[_0x5230('0xe5')](_0x22e8dd[_0x5230('0x64')][_0x5230('0x6d')],_[_0x5230('0xa1')](_0x22e8dd[_0x5230('0x64')],['ids','id'])||{})[_0x5230('0xa3')](function(_0x116244){for(var _0x57fdd5=0x0;_0x57fdd5<_0x22e8dd[_0x5230('0x64')][_0x5230('0x6d')]['length'];_0x57fdd5+=0x1){socket[_0x5230('0xe6')](_0x5230('0xe7'),{'UserId':Number(_0x22e8dd[_0x5230('0x64')]['ids'][_0x57fdd5]),'SmsAccountId':Number(_0x22e8dd[_0x5230('0x5a')]['id'])});}return _0x116244;});}})[_0x5230('0x20')](respondWithResult(_0x1147f8,null))[_0x5230('0x2a')](handleError(_0x1147f8,null));};exports[_0x5230('0xe8')]=function(_0x391cca,_0x39c90b,_0x16e754){return db['SmsAccount'][_0x5230('0x5b')]({'where':{'id':_0x391cca['params']['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x39c90b,null))['then'](function(_0x485ee6){if(_0x485ee6){return _0x485ee6[_0x5230('0xe8')](_0x391cca[_0x5230('0x44')][_0x5230('0x6d')])[_0x5230('0x20')](function(){if(_[_0x5230('0xe9')](_0x391cca[_0x5230('0x44')][_0x5230('0x6d')])){for(var _0x131b4c=0x0;_0x131b4c<_0x391cca[_0x5230('0x44')]['ids']['length'];_0x131b4c+=0x1){socket['emit'](_0x5230('0xea'),{'UserId':Number(_0x391cca[_0x5230('0x44')][_0x5230('0x6d')][_0x131b4c]),'SmsAccountId':Number(_0x391cca['params']['id'])});}}else{socket['emit'](_0x5230('0xea'),{'UserId':Number(_0x391cca[_0x5230('0x44')]['ids']),'SmsAccountId':Number(_0x391cca[_0x5230('0x5a')]['id'])});}});}})[_0x5230('0x20')](respondWithStatusCode(_0x39c90b,null))[_0x5230('0x2a')](handleError(_0x39c90b,null));};exports[_0x5230('0xeb')]=function(_0x2b5e27,_0x1cdce3,_0x4e49f8){var _0x15db21={};var _0xf06879={};var _0x412a8b;var _0xf46375;return db['SmsAccount'][_0x5230('0x70')]({'where':{'id':_0x2b5e27['params']['id']}})[_0x5230('0x20')](handleEntityNotFound(_0x1cdce3,null))[_0x5230('0x20')](function(_0x21ac88){if(_0x21ac88){_0x412a8b=_0x21ac88;_0xf06879[_0x5230('0x42')]=_[_0x5230('0x45')](db[_0x5230('0xc5')][_0x5230('0x41')]);_0xf06879[_0x5230('0x44')]=_[_0x5230('0x45')](_0x2b5e27['query']);_0xf06879['filters']=_['intersection'](_0xf06879[_0x5230('0x42')],_0xf06879[_0x5230('0x44')]);_0x15db21['attributes']=_[_0x5230('0x46')](_0xf06879[_0x5230('0x42')],qs[_0x5230('0x47')](_0x2b5e27[_0x5230('0x44')][_0x5230('0x47')]));_0x15db21[_0x5230('0x48')]=_0x15db21[_0x5230('0x48')][_0x5230('0x49')]?_0x15db21['attributes']:_0xf06879[_0x5230('0x42')];_0x15db21[_0x5230('0x4a')]=qs[_0x5230('0x4b')](_0x2b5e27[_0x5230('0x44')][_0x5230('0x4b')]);_0x15db21[_0x5230('0x4f')]=qs[_0x5230('0x4d')](_[_0x5230('0x4c')](_0x2b5e27['query'],_0xf06879[_0x5230('0x4d')]));if(_0x2b5e27[_0x5230('0x44')]['filter']){_0x15db21[_0x5230('0x4f')]=_[_0x5230('0x52')](_0x15db21['where'],{'$or':_[_0x5230('0x3f')](_0x15db21[_0x5230('0x48')],function(_0x476061){var _0x5b3d15={};_0x5b3d15[_0x476061]={'$like':'%'+_0x2b5e27[_0x5230('0x44')][_0x5230('0x4e')]+'%'};return _0x5b3d15;})});}_0x15db21=_[_0x5230('0x52')]({},_0x15db21,_0x2b5e27['options']);return _0x412a8b[_0x5230('0xeb')](_0x15db21);}})['then'](function(_0x186c36){if(_0x186c36){_0xf46375=_0x186c36[_0x5230('0x49')];if(!_0x2b5e27[_0x5230('0x44')]['hasOwnProperty'](_0x5230('0x6b'))){_0x15db21[_0x5230('0x31')]=qs[_0x5230('0x31')](_0x2b5e27[_0x5230('0x44')][_0x5230('0x31')]);_0x15db21[_0x5230('0x2f')]=qs['offset'](_0x2b5e27[_0x5230('0x44')]['offset']);}return _0x412a8b['getAgents'](_0x15db21);}})[_0x5230('0x20')](function(_0x2d7968){if(_0x2d7968){return _0x2d7968?{'count':_0xf46375,'rows':_0x2d7968}:null;}})['then'](respondWithResult(_0x1cdce3,null))['catch'](handleError(_0x1cdce3,null));}; \ No newline at end of file +var _0xa5f0=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','SmsQueue','queueId','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','tag','to\x20is\x20mandatory','List','user','out','dataValues','Messages','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','infobip','DELIVERED','groupName','bandwidth','intelepeer','redif','RECEIVED_BY_RECIPIENT','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','SmsAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','rows','show','params','keys','includeAll','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','priority','asc','Sequelize','createdAt','difference','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','refid','isNil','ValidationError'];(function(_0x4dbc5d,_0x2d0a51){var _0x45b461=function(_0x3e73ab){while(--_0x3e73ab){_0x4dbc5d['push'](_0x4dbc5d['shift']());}};_0x45b461(++_0x2d0a51);}(_0xa5f0,0x13c));var _0x0a5f=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa5f0[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a5f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a5f('0x1'));var rp=require(_0x0a5f('0x2'));var moment=require(_0x0a5f('0x3'));var BPromise=require(_0x0a5f('0x4'));var Mustache=require(_0x0a5f('0x5'));var util=require(_0x0a5f('0x6'));var path=require(_0x0a5f('0x7'));var sox=require(_0x0a5f('0x8'));var csv=require(_0x0a5f('0x9'));var ejs=require(_0x0a5f('0xa'));var fs=require('fs');var fs_extra=require(_0x0a5f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a5f('0xc'));var deskjs=require(_0x0a5f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a5f('0xe'));var Redis=require(_0x0a5f('0xf'));var authService=require(_0x0a5f('0x10'));var qs=require(_0x0a5f('0x11'));var as=require(_0x0a5f('0x12'));var hardwareService=require(_0x0a5f('0x13'));var logger=require('../../config/logger')(_0x0a5f('0x14'));var utils=require(_0x0a5f('0x15'));var config=require(_0x0a5f('0x16'));var licenseUtil=require(_0x0a5f('0x17'));var db=require(_0x0a5f('0x18'))['db'];config['redis']=_['defaults'](config[_0x0a5f('0x19')],{'host':_0x0a5f('0x1a'),'port':0x18eb});var socket=require(_0x0a5f('0x1b'))(new Redis(config[_0x0a5f('0x19')]));require(_0x0a5f('0x1c'))[_0x0a5f('0x1d')](socket);var jayson=require(_0x0a5f('0x1e'));var client=jayson[_0x0a5f('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x15630f,_0x54aeab,_0x3b3b15,_0x418033){return new BPromise(function(_0x20f4cd,_0x364efe){var _0x5a5382=_0x418033||client;return _0x5a5382[_0x0a5f('0x20')](_0x15630f,_0x3b3b15)[_0x0a5f('0x21')](function(_0x1cade6){logger[_0x0a5f('0x22')]('SmsAccount,\x20%s,\x20%s',_0x54aeab,_0x0a5f('0x23'));logger[_0x0a5f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x54aeab,'request\x20sent',JSON[_0x0a5f('0x25')](_0x1cade6));if(_0x1cade6[_0x0a5f('0x26')]){if(_0x1cade6[_0x0a5f('0x26')][_0x0a5f('0x27')]===0x1f4){logger['error'](_0x0a5f('0x28'),_0x54aeab,_0x1cade6[_0x0a5f('0x26')][_0x0a5f('0x29')]);return _0x364efe(_0x1cade6[_0x0a5f('0x26')][_0x0a5f('0x29')]);}logger['error'](_0x0a5f('0x28'),_0x54aeab,_0x1cade6[_0x0a5f('0x26')]['message']);return _0x20f4cd(_0x1cade6[_0x0a5f('0x26')][_0x0a5f('0x29')]);}else{logger['info'](_0x0a5f('0x28'),_0x54aeab,_0x0a5f('0x23'));_0x20f4cd(_0x1cade6[_0x0a5f('0x2a')][_0x0a5f('0x29')]);}})[_0x0a5f('0x2b')](function(_0x365207){logger[_0x0a5f('0x26')]('SmsAccount,\x20%s,\x20%s',_0x54aeab,_0x365207);_0x364efe(_0x365207);});});}function respondWithStatusCode(_0xa65455,_0x3bdd28){_0x3bdd28=_0x3bdd28||0xcc;return function(_0x1fa0ce){if(_0x1fa0ce){return _0xa65455['sendStatus'](_0x3bdd28);}return _0xa65455[_0x0a5f('0x2c')](_0x3bdd28)[_0x0a5f('0x2d')]();};}function respondWithResult(_0x3e8554,_0x5efc41){_0x5efc41=_0x5efc41||0xc8;return function(_0x2c6382){if(_0x2c6382){return _0x3e8554['status'](_0x5efc41)['json'](_0x2c6382);}};}function respondWithFilteredResult(_0x42b8b5,_0x2d325f){return function(_0x472433){if(_0x472433){var _0x437d1a=typeof _0x2d325f[_0x0a5f('0x2e')]===_0x0a5f('0x2f')&&typeof _0x2d325f[_0x0a5f('0x30')]===_0x0a5f('0x2f');var _0x58bbcd=_0x472433[_0x0a5f('0x31')];var _0x2a3396=_0x437d1a?0x0:_0x2d325f[_0x0a5f('0x2e')];var _0x421a52=_0x437d1a?_0x472433[_0x0a5f('0x31')]:_0x2d325f[_0x0a5f('0x2e')]+_0x2d325f['limit'];var _0x29bca2;if(_0x421a52>=_0x58bbcd){_0x421a52=_0x58bbcd;_0x29bca2=0xc8;}else{_0x29bca2=0xce;}_0x42b8b5[_0x0a5f('0x2c')](_0x29bca2);return _0x42b8b5[_0x0a5f('0x32')]('Content-Range',_0x2a3396+'-'+_0x421a52+'/'+_0x58bbcd)[_0x0a5f('0x33')](_0x472433);}return null;};}function patchUpdates(_0x18663e){return function(_0x54125f){try{jsonpatch[_0x0a5f('0x34')](_0x54125f,_0x18663e,!![]);}catch(_0x104e09){return BPromise[_0x0a5f('0x35')](_0x104e09);}return _0x54125f[_0x0a5f('0x36')]();};}function saveUpdates(_0x567661,_0x5718f5){return function(_0x5ef278){if(_0x5ef278){return _0x5ef278[_0x0a5f('0x37')](_0x567661)[_0x0a5f('0x21')](function(_0xf975ff){return _0xf975ff;});}return null;};}function removeEntity(_0x5720b3,_0x5c8819){return function(_0x44cc2c){if(_0x44cc2c){return _0x44cc2c['destroy']()[_0x0a5f('0x21')](function(){var _0x44254f=_0x44cc2c['get']({'plain':!![]});var _0x19805b=_0x0a5f('0x38');return db[_0x0a5f('0x39')][_0x0a5f('0x3a')]({'where':{'type':_0x19805b,'resourceId':_0x44254f['id']}})[_0x0a5f('0x21')](function(){return _0x44cc2c;});})[_0x0a5f('0x21')](function(){_0x5720b3['status'](0xcc)[_0x0a5f('0x2d')]();});}};}function handleEntityNotFound(_0x5a0e78,_0x43cad1){return function(_0x4e1bf7){if(!_0x4e1bf7){_0x5a0e78[_0x0a5f('0x3b')](0x194);}return _0x4e1bf7;};}function handleError(_0x267891,_0xea62ae){_0xea62ae=_0xea62ae||0x1f4;return function(_0x40e2db){logger[_0x0a5f('0x26')](_0x40e2db[_0x0a5f('0x3c')]);if(_0x40e2db[_0x0a5f('0x3d')]){delete _0x40e2db[_0x0a5f('0x3d')];}_0x267891[_0x0a5f('0x2c')](_0xea62ae)[_0x0a5f('0x3e')](_0x40e2db);};}exports[_0x0a5f('0x3f')]=function(_0x4593fe,_0x21b30d){var _0x12f377={'include':[{'model':db[_0x0a5f('0x40')],'as':_0x0a5f('0x41')}]},_0x25512c={},_0x3f6317={'count':0x0,'rows':[]};var _0x1bb178=_[_0x0a5f('0x42')](db[_0x0a5f('0x43')][_0x0a5f('0x44')],function(_0x2844d5){return{'name':_0x2844d5[_0x0a5f('0x45')],'type':_0x2844d5[_0x0a5f('0x46')]['key']};});_0x25512c['model']=_[_0x0a5f('0x42')](_0x1bb178,_0x0a5f('0x3d'));_0x25512c['query']=_['keys'](_0x4593fe['query']);_0x25512c[_0x0a5f('0x47')]=_[_0x0a5f('0x48')](_0x25512c[_0x0a5f('0x49')],_0x25512c['query']);_0x12f377['attributes']=_[_0x0a5f('0x48')](_0x25512c[_0x0a5f('0x49')],qs[_0x0a5f('0x4a')](_0x4593fe[_0x0a5f('0x4b')][_0x0a5f('0x4a')]));_0x12f377[_0x0a5f('0x4c')]=_0x12f377[_0x0a5f('0x4c')][_0x0a5f('0x4d')]?_0x12f377[_0x0a5f('0x4c')]:_0x25512c[_0x0a5f('0x49')];if(!_0x4593fe[_0x0a5f('0x4b')][_0x0a5f('0x4e')]('nolimit')){_0x12f377['limit']=qs[_0x0a5f('0x30')](_0x4593fe[_0x0a5f('0x4b')][_0x0a5f('0x30')]);_0x12f377[_0x0a5f('0x2e')]=qs[_0x0a5f('0x2e')](_0x4593fe[_0x0a5f('0x4b')][_0x0a5f('0x2e')]);}_0x12f377[_0x0a5f('0x4f')]=qs[_0x0a5f('0x50')](_0x4593fe[_0x0a5f('0x4b')][_0x0a5f('0x50')]);_0x12f377['where']=qs[_0x0a5f('0x47')](_[_0x0a5f('0x51')](_0x4593fe['query'],_0x25512c[_0x0a5f('0x47')]),_0x1bb178);if(_0x4593fe[_0x0a5f('0x4b')][_0x0a5f('0x52')]){_0x12f377[_0x0a5f('0x53')]=_[_0x0a5f('0x54')](_0x12f377[_0x0a5f('0x53')],{'$or':_[_0x0a5f('0x42')](_0x1bb178,function(_0x5eccb1){if(_0x5eccb1['type']!=='VIRTUAL'){var _0x536f21={};_0x536f21[_0x5eccb1[_0x0a5f('0x3d')]]={'$like':'%'+_0x4593fe['query'][_0x0a5f('0x52')]+'%'};return _0x536f21;}})});}_0x12f377=_[_0x0a5f('0x54')]({},_0x12f377,_0x4593fe['options']);var _0x21eef0={'where':_0x12f377[_0x0a5f('0x53')]};return db[_0x0a5f('0x43')][_0x0a5f('0x31')](_0x21eef0)['then'](function(_0x621a7f){_0x3f6317[_0x0a5f('0x31')]=_0x621a7f;if(_0x4593fe[_0x0a5f('0x4b')]['includeAll']){_0x12f377['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x12f377);})[_0x0a5f('0x21')](function(_0x12507f){_0x3f6317[_0x0a5f('0x55')]=_0x12507f;return _0x3f6317;})[_0x0a5f('0x21')](respondWithFilteredResult(_0x21b30d,_0x12f377))[_0x0a5f('0x2b')](handleError(_0x21b30d,null));};exports[_0x0a5f('0x56')]=function(_0x39fd32,_0x413742){var _0x1d7d6f={'raw':![],'where':{'id':_0x39fd32[_0x0a5f('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x0a5f('0x41')}]},_0x311458={};_0x311458[_0x0a5f('0x49')]=_[_0x0a5f('0x58')](db[_0x0a5f('0x43')]['rawAttributes']);_0x311458['query']=_[_0x0a5f('0x58')](_0x39fd32['query']);_0x311458[_0x0a5f('0x47')]=_[_0x0a5f('0x48')](_0x311458[_0x0a5f('0x49')],_0x311458[_0x0a5f('0x4b')]);_0x1d7d6f[_0x0a5f('0x4c')]=_['intersection'](_0x311458[_0x0a5f('0x49')],qs[_0x0a5f('0x4a')](_0x39fd32['query'][_0x0a5f('0x4a')]));_0x1d7d6f[_0x0a5f('0x4c')]=_0x1d7d6f[_0x0a5f('0x4c')]['length']?_0x1d7d6f[_0x0a5f('0x4c')]:_0x311458['model'];if(_0x39fd32[_0x0a5f('0x4b')][_0x0a5f('0x59')]){_0x1d7d6f[_0x0a5f('0x5a')]=[{'all':!![]}];}_0x1d7d6f=_[_0x0a5f('0x54')]({},_0x1d7d6f,_0x39fd32[_0x0a5f('0x5b')]);return db[_0x0a5f('0x43')][_0x0a5f('0x5c')](_0x1d7d6f)[_0x0a5f('0x21')](handleEntityNotFound(_0x413742,null))[_0x0a5f('0x21')](respondWithResult(_0x413742,null))[_0x0a5f('0x2b')](handleError(_0x413742,null));};exports[_0x0a5f('0x5d')]=function(_0x1c77c6,_0xa1f97){return db[_0x0a5f('0x43')]['create'](_0x1c77c6[_0x0a5f('0x5e')],{})[_0x0a5f('0x21')](function(_0x40e124){var _0x127aa9=_0x1c77c6['user']['get']({'plain':!![]});if(!_0x127aa9)throw new Error(_0x0a5f('0x5f'));if(_0x127aa9[_0x0a5f('0x60')]==='user'){var _0x27e654=_0x40e124[_0x0a5f('0x61')]({'plain':!![]});var _0x33db8d='SmsAccounts';return db[_0x0a5f('0x62')][_0x0a5f('0x5c')]({'where':{'name':_0x33db8d,'userProfileId':_0x127aa9['userProfileId']},'raw':!![]})[_0x0a5f('0x21')](function(_0x5a8156){if(_0x5a8156&&_0x5a8156['autoAssociation']===0x0){return db[_0x0a5f('0x39')][_0x0a5f('0x5d')]({'name':_0x27e654[_0x0a5f('0x3d')],'resourceId':_0x27e654['id'],'type':_0x5a8156[_0x0a5f('0x3d')],'sectionId':_0x5a8156['id']},{})[_0x0a5f('0x21')](function(){return _0x40e124;});}else{return _0x40e124;}})['catch'](function(_0x161f1f){logger[_0x0a5f('0x26')](_0x0a5f('0x63'),_0x161f1f);throw _0x161f1f;});}return _0x40e124;})[_0x0a5f('0x21')](respondWithResult(_0xa1f97,0xc9))['catch'](handleError(_0xa1f97,null));};exports[_0x0a5f('0x37')]=function(_0x2d4b2f,_0x431517){if(_0x2d4b2f[_0x0a5f('0x5e')]['id']){delete _0x2d4b2f['body']['id'];}return db[_0x0a5f('0x43')][_0x0a5f('0x5c')]({'where':{'id':_0x2d4b2f['params']['id']},'include':[{'model':db[_0x0a5f('0x40')],'as':_0x0a5f('0x41')}]})[_0x0a5f('0x21')](handleEntityNotFound(_0x431517,null))[_0x0a5f('0x21')](saveUpdates(_0x2d4b2f['body'],null))[_0x0a5f('0x21')](respondWithResult(_0x431517,null))[_0x0a5f('0x2b')](handleError(_0x431517,null));};exports[_0x0a5f('0x3a')]=function(_0xe375d4,_0xadf678){return db[_0x0a5f('0x43')][_0x0a5f('0x5c')]({'where':{'id':_0xe375d4[_0x0a5f('0x57')]['id']}})[_0x0a5f('0x21')](handleEntityNotFound(_0xadf678,null))[_0x0a5f('0x21')](removeEntity(_0xadf678,null))['catch'](handleError(_0xadf678,null));};exports['describe']=function(_0x2d3dd2,_0x59debc){return db[_0x0a5f('0x43')][_0x0a5f('0x64')]()[_0x0a5f('0x21')](respondWithResult(_0x59debc,null))[_0x0a5f('0x2b')](handleError(_0x59debc,null));};exports[_0x0a5f('0x65')]=function(_0x10e96a,_0x2c185a,_0x20eb19){if(_0x10e96a['body']['id']){delete _0x10e96a[_0x0a5f('0x5e')]['id'];}return db[_0x0a5f('0x43')][_0x0a5f('0x5c')]({'where':{'id':_0x10e96a[_0x0a5f('0x57')]['id']}})['then'](handleEntityNotFound(_0x2c185a,null))['then'](function(_0x4165b4){if(_0x4165b4){_0x10e96a[_0x0a5f('0x5e')]['SmsAccountId']=_0x4165b4['id'];return db[_0x0a5f('0x66')]['create'](_0x10e96a[_0x0a5f('0x5e')]);}})[_0x0a5f('0x21')](respondWithResult(_0x2c185a,null))[_0x0a5f('0x2b')](handleError(_0x2c185a,null));};exports[_0x0a5f('0x67')]=function(_0x6a4471,_0x3a6e96,_0x4de62b){var _0x37244e={'raw':![],'where':{}};var _0x1a76d2={};var _0x149f5e={'count':0x0,'rows':[]};return db[_0x0a5f('0x43')][_0x0a5f('0x68')]({'where':{'id':_0x6a4471[_0x0a5f('0x57')]['id']}})['then'](handleEntityNotFound(_0x3a6e96,null))['then'](function(_0x2a15b2){if(_0x2a15b2){_0x1a76d2['model']=_[_0x0a5f('0x58')](db['Disposition']['rawAttributes']);_0x1a76d2['query']=_[_0x0a5f('0x58')](_0x6a4471[_0x0a5f('0x4b')]);_0x1a76d2[_0x0a5f('0x47')]=_[_0x0a5f('0x48')](_0x1a76d2[_0x0a5f('0x49')],_0x1a76d2['query']);_0x37244e[_0x0a5f('0x4c')]=_[_0x0a5f('0x48')](_0x1a76d2[_0x0a5f('0x49')],qs[_0x0a5f('0x4a')](_0x6a4471[_0x0a5f('0x4b')][_0x0a5f('0x4a')]));_0x37244e[_0x0a5f('0x4c')]=_0x37244e[_0x0a5f('0x4c')][_0x0a5f('0x4d')]?_0x37244e[_0x0a5f('0x4c')]:_0x1a76d2[_0x0a5f('0x49')];if(!_0x6a4471[_0x0a5f('0x4b')][_0x0a5f('0x4e')](_0x0a5f('0x69'))){_0x37244e[_0x0a5f('0x30')]=qs[_0x0a5f('0x30')](_0x6a4471[_0x0a5f('0x4b')][_0x0a5f('0x30')]);_0x37244e[_0x0a5f('0x2e')]=qs[_0x0a5f('0x2e')](_0x6a4471[_0x0a5f('0x4b')]['offset']);}_0x37244e[_0x0a5f('0x4f')]=qs[_0x0a5f('0x50')](_0x6a4471[_0x0a5f('0x4b')][_0x0a5f('0x50')]);_0x37244e['where']=qs[_0x0a5f('0x47')](_[_0x0a5f('0x51')](_0x6a4471[_0x0a5f('0x4b')],_0x1a76d2[_0x0a5f('0x47')]));_0x37244e[_0x0a5f('0x53')]['SmsAccountId']=_0x2a15b2['id'];if(_0x6a4471[_0x0a5f('0x4b')][_0x0a5f('0x52')]){_0x37244e[_0x0a5f('0x53')]=_['merge'](_0x37244e[_0x0a5f('0x53')],{'$or':_[_0x0a5f('0x42')](_0x37244e['attributes'],function(_0x1e6873){var _0x2f8626={};_0x2f8626[_0x1e6873]={'$like':'%'+_0x6a4471[_0x0a5f('0x4b')][_0x0a5f('0x52')]+'%'};return _0x2f8626;})});}_0x37244e=_[_0x0a5f('0x54')]({},_0x37244e,_0x6a4471[_0x0a5f('0x5b')]);return db[_0x0a5f('0x66')]['count']({'where':_0x37244e[_0x0a5f('0x53')]})[_0x0a5f('0x21')](function(_0x18bc88){_0x149f5e[_0x0a5f('0x31')]=_0x18bc88;if(_0x6a4471[_0x0a5f('0x4b')]['includeAll']){_0x37244e['include']=[{'all':!![]}];}return db[_0x0a5f('0x66')][_0x0a5f('0x6a')](_0x37244e);})[_0x0a5f('0x21')](function(_0xfb3236){_0x149f5e[_0x0a5f('0x55')]=_0xfb3236;return _0x149f5e;});}})[_0x0a5f('0x21')](respondWithFilteredResult(_0x3a6e96,_0x37244e))[_0x0a5f('0x2b')](handleError(_0x3a6e96,null));};exports[_0x0a5f('0x6b')]=function(_0x12def7,_0x1228da,_0x222f6d){return db[_0x0a5f('0x43')][_0x0a5f('0x5c')]({'where':{'id':_0x12def7[_0x0a5f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1228da,null))[_0x0a5f('0x21')](function(_0x33036a){if(_0x33036a){return _0x33036a[_0x0a5f('0x6b')](_0x12def7[_0x0a5f('0x4b')][_0x0a5f('0x6c')]);}})[_0x0a5f('0x21')](respondWithStatusCode(_0x1228da,null))[_0x0a5f('0x2b')](handleError(_0x1228da,null));};exports[_0x0a5f('0x6d')]=function(_0x1dc4b8,_0x452ed3,_0x2e8ce9){if(_0x1dc4b8[_0x0a5f('0x5e')]['id']){delete _0x1dc4b8[_0x0a5f('0x5e')]['id'];}return db[_0x0a5f('0x43')][_0x0a5f('0x5c')]({'where':{'id':_0x1dc4b8[_0x0a5f('0x57')]['id']}})['then'](handleEntityNotFound(_0x452ed3,null))['then'](function(_0xf4a5b6){if(_0xf4a5b6){_0x1dc4b8[_0x0a5f('0x5e')][_0x0a5f('0x6e')]=_0xf4a5b6['id'];return db[_0x0a5f('0x6f')]['create'](_0x1dc4b8[_0x0a5f('0x5e')]);}})[_0x0a5f('0x21')](respondWithResult(_0x452ed3,null))[_0x0a5f('0x2b')](handleError(_0x452ed3,null));};exports[_0x0a5f('0x70')]=function(_0x34d9d0,_0x3548b7,_0x354d56){var _0x286c30={'raw':![],'where':{}};var _0x3c2400={};var _0x4cf2d6={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0a5f('0x68')]({'where':{'id':_0x34d9d0[_0x0a5f('0x57')]['id']}})[_0x0a5f('0x21')](handleEntityNotFound(_0x3548b7,null))[_0x0a5f('0x21')](function(_0x58e16e){if(_0x58e16e){_0x3c2400['model']=_[_0x0a5f('0x58')](db[_0x0a5f('0x6f')][_0x0a5f('0x44')]);_0x3c2400[_0x0a5f('0x4b')]=_[_0x0a5f('0x58')](_0x34d9d0[_0x0a5f('0x4b')]);_0x3c2400[_0x0a5f('0x47')]=_[_0x0a5f('0x48')](_0x3c2400[_0x0a5f('0x49')],_0x3c2400[_0x0a5f('0x4b')]);_0x286c30['attributes']=_[_0x0a5f('0x48')](_0x3c2400[_0x0a5f('0x49')],qs['fields'](_0x34d9d0[_0x0a5f('0x4b')][_0x0a5f('0x4a')]));_0x286c30[_0x0a5f('0x4c')]=_0x286c30['attributes']['length']?_0x286c30['attributes']:_0x3c2400[_0x0a5f('0x49')];if(!_0x34d9d0[_0x0a5f('0x4b')][_0x0a5f('0x4e')](_0x0a5f('0x69'))){_0x286c30[_0x0a5f('0x30')]=qs[_0x0a5f('0x30')](_0x34d9d0[_0x0a5f('0x4b')]['limit']);_0x286c30[_0x0a5f('0x2e')]=qs[_0x0a5f('0x2e')](_0x34d9d0[_0x0a5f('0x4b')][_0x0a5f('0x2e')]);}_0x286c30[_0x0a5f('0x4f')]=qs[_0x0a5f('0x50')](_0x34d9d0['query'][_0x0a5f('0x50')]);_0x286c30[_0x0a5f('0x53')]=qs['filters'](_[_0x0a5f('0x51')](_0x34d9d0[_0x0a5f('0x4b')],_0x3c2400[_0x0a5f('0x47')]));_0x286c30[_0x0a5f('0x53')][_0x0a5f('0x6e')]=_0x58e16e['id'];if(_0x34d9d0['query'][_0x0a5f('0x52')]){_0x286c30['where']=_[_0x0a5f('0x54')](_0x286c30[_0x0a5f('0x53')],{'$or':_[_0x0a5f('0x42')](_0x286c30[_0x0a5f('0x4c')],function(_0x3f78b4){var _0x3bafb6={};_0x3bafb6[_0x3f78b4]={'$like':'%'+_0x34d9d0['query'][_0x0a5f('0x52')]+'%'};return _0x3bafb6;})});}_0x286c30=_['merge']({},_0x286c30,_0x34d9d0['options']);return db[_0x0a5f('0x6f')][_0x0a5f('0x31')]({'where':_0x286c30[_0x0a5f('0x53')]})[_0x0a5f('0x21')](function(_0x5dc0d5){_0x4cf2d6['count']=_0x5dc0d5;if(_0x34d9d0[_0x0a5f('0x4b')][_0x0a5f('0x59')]){_0x286c30[_0x0a5f('0x5a')]=[{'all':!![]}];}return db[_0x0a5f('0x6f')][_0x0a5f('0x6a')](_0x286c30);})[_0x0a5f('0x21')](function(_0x1eba23){_0x4cf2d6[_0x0a5f('0x55')]=_0x1eba23;return _0x4cf2d6;});}})[_0x0a5f('0x21')](respondWithFilteredResult(_0x3548b7,_0x286c30))[_0x0a5f('0x2b')](handleError(_0x3548b7,null));};exports[_0x0a5f('0x71')]=function(_0x168f19,_0x499a4f,_0x42084d){return db[_0x0a5f('0x43')][_0x0a5f('0x5c')]({'where':{'id':_0x168f19[_0x0a5f('0x57')]['id']}})[_0x0a5f('0x21')](handleEntityNotFound(_0x499a4f,null))['then'](function(_0x23963c){if(_0x23963c){return _0x23963c[_0x0a5f('0x71')](_0x168f19[_0x0a5f('0x4b')][_0x0a5f('0x6c')]);}})[_0x0a5f('0x21')](respondWithStatusCode(_0x499a4f,null))[_0x0a5f('0x2b')](handleError(_0x499a4f,null));};exports[_0x0a5f('0x72')]=function(_0x139cc4,_0xe964a5,_0x2d6d77){var _0x4aaf9f={'channel':_0x0a5f('0x73')};var _0x128aae=[];var _0x45003c=[];var _0x271f12={};return db['SmsAccount'][_0x0a5f('0x5c')]({'where':{'id':_0x139cc4[_0x0a5f('0x57')]['id']},'include':[{'model':db[_0x0a5f('0x74')],'as':'Applications'}]})['then'](handleEntityNotFound(_0xe964a5,null))['then'](function(_0x5a63f2){_0x4aaf9f[_0x0a5f('0x75')]=_0x5a63f2;_0x4aaf9f[_0x0a5f('0x76')]=_['orderBy'](_0x5a63f2[_0x0a5f('0x77')],[_0x0a5f('0x78')],[_0x0a5f('0x79')]);if(_0x4aaf9f[_0x0a5f('0x75')][_0x0a5f('0x77')]){delete _0x4aaf9f[_0x0a5f('0x75')]['Applications'];}return db['CmContact']['describe']();})[_0x0a5f('0x21')](function(_0x4eb447){if(!_0x4eb447){throw new db[(_0x0a5f('0x7a'))]['ValidationError']('no\x20available\x20attributes');}_0x128aae=_['difference'](_['keys'](_0x4eb447),[_0x0a5f('0x7b'),'updatedAt']);_0x45003c=_[_0x0a5f('0x7c')](_[_0x0a5f('0x58')](_0x4eb447),[_0x0a5f('0x7b'),'updatedAt',_0x0a5f('0x7d'),'ListId']);_0x4aaf9f['body']={'mapKey':_0x0a5f('0x7e')};if(_0x4aaf9f['account']['type']){switch(_0x4aaf9f[_0x0a5f('0x75')][_0x0a5f('0x46')]){case _0x0a5f('0x7f'):_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')]=_0x139cc4['body'][_0x0a5f('0x81')];_0x4aaf9f[_0x0a5f('0x5e')]['body']=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x82')];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x83')]=_0x139cc4['body'][_0x0a5f('0x84')];break;case _0x0a5f('0x85'):_0x4aaf9f['body']['from']='+'+_0x139cc4['body'][_0x0a5f('0x86')];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x5e')]=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x87')];break;case'connectel':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')]=_0x139cc4['body'][_0x0a5f('0x80')];_0x4aaf9f[_0x0a5f('0x5e')]['body']=_0x139cc4[_0x0a5f('0x5e')]['message'];break;case _0x0a5f('0x88'):_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')]=_0x139cc4[_0x0a5f('0x5e')]['from'];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x5e')]=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x5e')];_0x4aaf9f['body'][_0x0a5f('0x83')]=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x89')];break;case _0x0a5f('0x8a'):_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')]=_0x139cc4['body'][_0x0a5f('0x81')];_0x4aaf9f['body'][_0x0a5f('0x5e')]=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x8b')];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x83')]=_0x139cc4['body'][_0x0a5f('0x8c')];break;case'infobip':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')]='+'+_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x8d')][0x0]['from'];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x5e')]=_0x139cc4[_0x0a5f('0x5e')]['results'][0x0][_0x0a5f('0x87')];_0x4aaf9f[_0x0a5f('0x5e')]['messageId']=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x8d')][0x0]['messageId'];break;case _0x0a5f('0x8e'):_0x4aaf9f['body'][_0x0a5f('0x80')]=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x8f')];_0x4aaf9f['body'][_0x0a5f('0x5e')]=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x90')][_0x0a5f('0x29')];break;case _0x0a5f('0x91'):_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')]=_0x139cc4[_0x0a5f('0x5e')]['fromNumber'];_0x4aaf9f[_0x0a5f('0x5e')]['body']=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x87')];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x83')]=_0x139cc4['body'][_0x0a5f('0x92')];break;case'bandwidth':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x83')]=_0x139cc4[_0x0a5f('0x5e')][0x0][_0x0a5f('0x29')]['id'];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')]=_0x139cc4[_0x0a5f('0x5e')][0x0]['message'][_0x0a5f('0x80')];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x5e')]=_0x139cc4[_0x0a5f('0x5e')][0x0]['message'][_0x0a5f('0x87')];break;case'intelepeer':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')]=_0x139cc4['body'][_0x0a5f('0x80')];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x5e')]=_0x139cc4['body'][_0x0a5f('0x29')];_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x83')]=_0x139cc4[_0x0a5f('0x5e')][_0x0a5f('0x93')];break;}}if(_0x4aaf9f[_0x0a5f('0x5e')]['id']){delete _0x4aaf9f[_0x0a5f('0x5e')]['id'];}if(_[_0x0a5f('0x94')](_0x4aaf9f[_0x0a5f('0x5e')]['from'])){throw new db['Sequelize'][(_0x0a5f('0x95'))]('from\x20is\x20mandatory');}if(_[_0x0a5f('0x94')](_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x5e')])||_0x4aaf9f['body'][_0x0a5f('0x5e')]===''){throw new db[(_0x0a5f('0x7a'))][(_0x0a5f('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0a5f('0x94')](_0x4aaf9f['body'][_0x0a5f('0x96')])){throw new db[(_0x0a5f('0x7a'))]['ValidationError'](_0x0a5f('0x97')+_0x45003c);}if(!_[_0x0a5f('0x98')](_0x45003c,_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x96')])){throw new db['Sequelize'][(_0x0a5f('0x95'))](_0x0a5f('0x99')+_0x45003c);}_0x271f12[_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x96')]]=_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')];return db[_0x0a5f('0x9a')][_0x0a5f('0x5c')]({'where':{'id':_0x4aaf9f['account'][_0x0a5f('0x9b')]},'include':[{'model':db[_0x0a5f('0x9c')],'as':_0x0a5f('0x9d'),'where':_0x271f12,'limit':0x1,'order':[['updatedAt',_0x0a5f('0x9e')]]}]});})[_0x0a5f('0x21')](handleEntityNotFound(_0xe964a5,null))[_0x0a5f('0x21')](function(_0x383fbf){if(_0x383fbf){_0x4aaf9f[_0x0a5f('0x9f')]=_[_0x0a5f('0xa0')](_0x383fbf,['Contacts']);if(_0x383fbf[_0x0a5f('0x9d')][_0x0a5f('0x4d')]){return _0x383fbf[_0x0a5f('0x9d')][0x0];}var _0x44555e=_['defaults'](_0x4aaf9f[_0x0a5f('0x5e')],{'firstName':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')],'ListId':_0x383fbf['id']});_0x44555e[_0x4aaf9f['body'][_0x0a5f('0x96')]]=_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')];return db[_0x0a5f('0x9c')][_0x0a5f('0x5d')](_0x44555e,{'fields':_0x128aae,'raw':!![]});}})[_0x0a5f('0x21')](handleEntityNotFound(_0xe964a5,null))[_0x0a5f('0x21')](function(_0x92a32f){if(_0x92a32f){_0x4aaf9f[_0x0a5f('0xa1')]=_0x92a32f;var _0x47ac7f={'ContactId':_0x92a32f['id'],'phone':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')],'SmsAccountId':_0x139cc4[_0x0a5f('0x57')]['id']};var _0x30898d={'ContactId':_0x92a32f['id'],'SmsAccountId':_0x139cc4[_0x0a5f('0x57')]['id'],'closed':![]};return db[_0x0a5f('0xa2')][_0x0a5f('0x5c')]({'where':_0x30898d})['then'](function(_0x33b79b){if(_0x33b79b){return[_0x33b79b,![]];}return db['SmsInteraction']['create'](_0x47ac7f)['then'](function(_0x4a1633){return[_0x4a1633,!![]];});});}})[_0x0a5f('0xa3')](function(_0x5bc9da,_0x37c74e){_0x4aaf9f[_0x0a5f('0xa4')]=_0x5bc9da[_0x0a5f('0x61')]({'plain':!![]});_0x4aaf9f[_0x0a5f('0xa4')][_0x0a5f('0xa5')]=![];if(_0x37c74e){if(_0x4aaf9f['account'][_0x0a5f('0xa6')]){_0x4aaf9f[_0x0a5f('0x76')]['push']({'id':0x0,'priority':_0x4aaf9f[_0x0a5f('0x76')][_0x0a5f('0x4d')]+0x1,'app':_0x0a5f('0xa7'),'appdata':_0x0a5f('0xa8'),'interval':_0x0a5f('0xa9')});}_0x4aaf9f['interaction'][_0x0a5f('0xa5')]=!![];}return db[_0x0a5f('0xaa')][_0x0a5f('0x5d')]({'phone':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x80')],'messageId':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x83')],'body':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0x5e')],'SmsAccountId':_0x139cc4[_0x0a5f('0x57')]['id'],'SmsInteractionId':_0x5bc9da['id'],'direction':'in','ContactId':_0x5bc9da[_0x0a5f('0xab')],'AttachmentId':_0x4aaf9f[_0x0a5f('0x5e')][_0x0a5f('0xac')]});})['then'](function(_0x13e0d3){_0x4aaf9f[_0x0a5f('0x29')]=_0x13e0d3;if(!_0x4aaf9f[_0x0a5f('0xa4')][_0x0a5f('0xad')])return;return db[_0x0a5f('0xae')]['find']({'attributes':['id','name'],'where':{'id':_0x4aaf9f['interaction'][_0x0a5f('0xad')]}});})[_0x0a5f('0x21')](function(_0x458308){if(_0x458308){_0x4aaf9f[_0x0a5f('0x76')][_0x0a5f('0xaf')]({'id':0x0,'priority':0x0,'app':_0x0a5f('0xb0'),'appdata':_0x458308['name']+','+(_0x4aaf9f[_0x0a5f('0x75')][_0x0a5f('0xb1')]||0xa),'interval':_0x0a5f('0xa9')});}if(!_0x4aaf9f['interaction']['queueId'])return;return db[_0x0a5f('0xb2')]['find']({'attributes':['id',_0x0a5f('0x3d')],'where':{'id':_0x4aaf9f[_0x0a5f('0xa4')][_0x0a5f('0xb3')]}});})[_0x0a5f('0x21')](function(_0x57bbff){if(_0x57bbff){_0x4aaf9f['applications'][_0x0a5f('0xaf')]({'id':0x0,'priority':0x1,'app':_0x0a5f('0xb4'),'appdata':_0x57bbff[_0x0a5f('0x3d')]+','+(_0x4aaf9f['account'][_0x0a5f('0xb5')]||0x12c),'interval':_0x0a5f('0xa9')});}return respondWithRpcPromise('Start',_0x0a5f('0xb6'),_0x4aaf9f);})[_0x0a5f('0x21')](function(_0x2b0099){if(_0x2b0099){var _0x3d97f8=0xc8;var _0x3a45b2=_0x0a5f('0xb7');logger[_0x0a5f('0x22')](_0x0a5f('0xb8'),_0x3a45b2,_0x3d97f8,'entity\x20found');logger[_0x0a5f('0x24')](_0x0a5f('0xb9'),_0x3a45b2,_0x3d97f8,_0x0a5f('0xba'),JSON[_0x0a5f('0x25')](_0x2b0099));if(_0x4aaf9f[_0x0a5f('0x75')][_0x0a5f('0x46')]===_0x0a5f('0x7f')){return _0xe964a5[_0x0a5f('0x2c')](_0x3d97f8)['set']('Content-Type',_0x0a5f('0xbb'))[_0x0a5f('0x3e')](_0x0a5f('0xbc'));}else{return _0xe964a5['status'](_0x3d97f8)['json'](_0x2b0099);}}})[_0x0a5f('0x2b')](handleError(_0xe964a5,null));};exports[_0x0a5f('0xbd')]=function(_0x650f74,_0x1d3d4f){var _0x33045d=_0x650f74[_0x0a5f('0x57')]['id'];var _0x37d0d2=_0x650f74[_0x0a5f('0x5e')];var _0x4d14d4=0xc8;var _0x314675=null;return db[_0x0a5f('0xbe')][_0x0a5f('0xbf')]({'isolationLevel':db[_0x0a5f('0xbe')]['Transaction'][_0x0a5f('0xc0')][_0x0a5f('0xc1')]},function(_0x3e7b6c){return db['SmsAccount']['findOne']({'where':{'id':_0x33045d},'transaction':_0x3e7b6c})[_0x0a5f('0x21')](function(_0x58f36f){if(_0x58f36f){return db[_0x0a5f('0x74')][_0x0a5f('0x3a')]({'where':{'SmsAccountId':_0x33045d},'transaction':_0x3e7b6c})[_0x0a5f('0x21')](function(){var _0x2489d0=_[_0x0a5f('0x42')](_0x37d0d2,function(_0x66d6ef){_0x66d6ef[_0x0a5f('0x6e')]=_0x33045d;return _0x66d6ef;});return db['SmsApplication'][_0x0a5f('0xc2')](_0x2489d0,{'transaction':_0x3e7b6c});});}else{_0x4d14d4=0x194;_0x314675=[];}});})[_0x0a5f('0x21')](function(){if(_0x4d14d4!==0x194){return db[_0x0a5f('0x74')]['findAndCountAll']({'where':{'SmsAccountId':_0x33045d},'order':_0x0a5f('0x78')})['then'](function(_0x5da379){_0x314675=_0x5da379;});}})[_0x0a5f('0x2b')](function(_0x4607d2){_0x4d14d4=0x1f4;logger[_0x0a5f('0x26')](_0x4607d2[_0x0a5f('0x3c')]);if(_0x4607d2['name']){delete _0x4607d2[_0x0a5f('0x3d')];}_0x314675=_0x4607d2;})[_0x0a5f('0xc3')](function(){if(_0x314675===null){_0x1d3d4f['sendStatus'](_0x4d14d4);}else{if(_0x4d14d4===0x1f4){_0x1d3d4f['status'](_0x4d14d4)[_0x0a5f('0x3e')](_0x314675);}else{_0x1d3d4f[_0x0a5f('0x2c')](_0x4d14d4)['json'](_0x314675);}}});};exports[_0x0a5f('0xc4')]=function(_0x37068a,_0x21a87e,_0x2bbde1){var _0x4293b1={};var _0x312409={};var _0x33091a;var _0x200d9b;return db[_0x0a5f('0x43')][_0x0a5f('0x68')]({'where':{'id':_0x37068a['params']['id']}})[_0x0a5f('0x21')](handleEntityNotFound(_0x21a87e,null))[_0x0a5f('0x21')](function(_0x522985){if(_0x522985){_0x33091a=_0x522985;_0x312409['model']=_['keys'](db[_0x0a5f('0x74')][_0x0a5f('0x44')]);_0x312409[_0x0a5f('0x4b')]=_['keys'](_0x37068a[_0x0a5f('0x4b')]);_0x312409['filters']=_[_0x0a5f('0x48')](_0x312409[_0x0a5f('0x49')],_0x312409[_0x0a5f('0x4b')]);_0x4293b1[_0x0a5f('0x4c')]=_['intersection'](_0x312409[_0x0a5f('0x49')],qs[_0x0a5f('0x4a')](_0x37068a[_0x0a5f('0x4b')][_0x0a5f('0x4a')]));_0x4293b1[_0x0a5f('0x4c')]=_0x4293b1[_0x0a5f('0x4c')]['length']?_0x4293b1[_0x0a5f('0x4c')]:_0x312409[_0x0a5f('0x49')];_0x4293b1[_0x0a5f('0x4f')]=qs['sort'](_0x37068a[_0x0a5f('0x4b')][_0x0a5f('0x50')]);_0x4293b1['where']=qs[_0x0a5f('0x47')](_['pick'](_0x37068a[_0x0a5f('0x4b')],_0x312409[_0x0a5f('0x47')]));if(_0x37068a[_0x0a5f('0x4b')][_0x0a5f('0x52')]){_0x4293b1[_0x0a5f('0x53')]=_['merge'](_0x4293b1['where'],{'$or':_[_0x0a5f('0x42')](_0x4293b1['attributes'],function(_0x517d46){var _0x33a23b={};_0x33a23b[_0x517d46]={'$like':'%'+_0x37068a[_0x0a5f('0x4b')][_0x0a5f('0x52')]+'%'};return _0x33a23b;})});}_0x4293b1=_[_0x0a5f('0x54')]({},_0x4293b1,_0x37068a[_0x0a5f('0x5b')]);return _0x33091a[_0x0a5f('0xc4')](_0x4293b1);}})[_0x0a5f('0x21')](function(_0x454979){if(_0x454979){_0x200d9b=_0x454979[_0x0a5f('0x4d')];if(!_0x37068a[_0x0a5f('0x4b')][_0x0a5f('0x4e')](_0x0a5f('0x69'))){_0x4293b1['limit']=qs[_0x0a5f('0x30')](_0x37068a['query'][_0x0a5f('0x30')]);_0x4293b1[_0x0a5f('0x2e')]=qs[_0x0a5f('0x2e')](_0x37068a[_0x0a5f('0x4b')]['offset']);}return _0x33091a[_0x0a5f('0xc4')](_0x4293b1);}})[_0x0a5f('0x21')](function(_0x5d4f23){if(_0x5d4f23){return _0x5d4f23?{'count':_0x200d9b,'rows':_0x5d4f23}:null;}})[_0x0a5f('0x21')](respondWithResult(_0x21a87e,null))[_0x0a5f('0x2b')](handleError(_0x21a87e,null));};exports[_0x0a5f('0xc5')]=function(_0x4bb6c0,_0x27e33c,_0x1f0f4f){var _0x2a601d={'raw':![],'where':{}};var _0x292d14={};var _0x16258b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0a5f('0x68')]({'where':{'id':_0x4bb6c0[_0x0a5f('0x57')]['id']}})[_0x0a5f('0x21')](handleEntityNotFound(_0x27e33c,null))[_0x0a5f('0x21')](function(_0x5559df){if(_0x5559df){_0x292d14['model']=_[_0x0a5f('0x58')](db[_0x0a5f('0xa2')]['rawAttributes']);_0x292d14[_0x0a5f('0x4b')]=_['keys'](_0x4bb6c0[_0x0a5f('0x4b')]);_0x292d14[_0x0a5f('0x47')]=_[_0x0a5f('0x48')](_0x292d14[_0x0a5f('0x49')],_0x292d14[_0x0a5f('0x4b')]);_0x2a601d[_0x0a5f('0x4c')]=_[_0x0a5f('0x48')](_0x292d14[_0x0a5f('0x49')],qs[_0x0a5f('0x4a')](_0x4bb6c0[_0x0a5f('0x4b')][_0x0a5f('0x4a')]));_0x2a601d[_0x0a5f('0x4c')]=_0x2a601d['attributes'][_0x0a5f('0x4d')]?_0x2a601d[_0x0a5f('0x4c')]:_0x292d14[_0x0a5f('0x49')];if(!_0x4bb6c0[_0x0a5f('0x4b')]['hasOwnProperty'](_0x0a5f('0x69'))){_0x2a601d[_0x0a5f('0x30')]=qs[_0x0a5f('0x30')](_0x4bb6c0['query']['limit']);_0x2a601d[_0x0a5f('0x2e')]=qs[_0x0a5f('0x2e')](_0x4bb6c0[_0x0a5f('0x4b')][_0x0a5f('0x2e')]);}_0x2a601d[_0x0a5f('0x4f')]=qs['sort'](_0x4bb6c0[_0x0a5f('0x4b')]['sort']);_0x2a601d[_0x0a5f('0x53')]=qs[_0x0a5f('0x47')](_['pick'](_0x4bb6c0[_0x0a5f('0x4b')],_0x292d14['filters']));_0x2a601d['where'][_0x0a5f('0x6e')]=_0x5559df['id'];if(_0x4bb6c0[_0x0a5f('0x4b')][_0x0a5f('0x52')]){_0x2a601d['where']=_[_0x0a5f('0x54')](_0x2a601d['where'],{'$or':_['map'](_0x2a601d[_0x0a5f('0x4c')],function(_0x33ab41){var _0x3e19ac={};_0x3e19ac[_0x33ab41]={'$like':'%'+_0x4bb6c0[_0x0a5f('0x4b')]['filter']+'%'};return _0x3e19ac;})});}_0x2a601d=_[_0x0a5f('0x54')]({},_0x2a601d,_0x4bb6c0[_0x0a5f('0x5b')]);return db[_0x0a5f('0xa2')]['count']({'where':_0x2a601d[_0x0a5f('0x53')]})[_0x0a5f('0x21')](function(_0x3ed8d8){_0x16258b[_0x0a5f('0x31')]=_0x3ed8d8;if(_0x4bb6c0['query']['includeAll']){_0x2a601d[_0x0a5f('0x5a')]=[{'model':db[_0x0a5f('0x9c')],'as':_0x0a5f('0xc6'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x0a5f('0x3d'),_0x0a5f('0xc7'),_0x0a5f('0xc8')],'required':![]},{'model':db[_0x0a5f('0xc9')],'as':'Tags','attributes':['id','name','color'],'where':_0x4bb6c0[_0x0a5f('0x4b')]['tag']?{'id':_0x4bb6c0[_0x0a5f('0x4b')][_0x0a5f('0xca')]}:undefined,'required':_0x4bb6c0[_0x0a5f('0x4b')][_0x0a5f('0xca')]?!![]:![]}];}return db[_0x0a5f('0xa2')]['findAll'](_0x2a601d);})[_0x0a5f('0x21')](function(_0x4a3366){_0x16258b[_0x0a5f('0x55')]=_0x4a3366;return _0x16258b;});}})[_0x0a5f('0x21')](respondWithFilteredResult(_0x27e33c,_0x2a601d))[_0x0a5f('0x2b')](handleError(_0x27e33c,null));};exports[_0x0a5f('0x3e')]=function(_0x571979,_0x2f6058,_0x41be5d){var _0x50c4de,_0x23b240,_0x365838;if(_[_0x0a5f('0x94')](_0x571979[_0x0a5f('0x5e')][_0x0a5f('0x5e')])||_0x571979[_0x0a5f('0x5e')][_0x0a5f('0x5e')]===''){throw new db['Sequelize'][(_0x0a5f('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0a5f('0x94')](_0x571979[_0x0a5f('0x5e')]['to'])){throw new db['Sequelize']['ValidationError'](_0x0a5f('0xcb'));}_0x50c4de=_0x571979[_0x0a5f('0x5e')]['to'];return db['SmsAccount'][_0x0a5f('0x5c')]({'where':{'id':_0x571979['params']['id']},'include':[{'model':db['CmList'],'as':_0x0a5f('0xcc'),'include':[{'model':db['CmContact'],'as':_0x0a5f('0x9d'),'where':{'mobile':_0x50c4de},'limit':0x1,'order':[['updatedAt',_0x0a5f('0x9e')]]}]}]})[_0x0a5f('0x21')](handleEntityNotFound(_0x2f6058,null))[_0x0a5f('0x21')](function(_0x1c7d54){if(_0x1c7d54&&_0x1c7d54['List']){_0x23b240=_0x1c7d54[_0x0a5f('0x61')]({'plain':!![]});if(_0x23b240['List']&&_0x23b240['List'][_0x0a5f('0x9d')][_0x0a5f('0x4d')]){return _0x23b240['List'][_0x0a5f('0x9d')][0x0];}return db[_0x0a5f('0x9c')][_0x0a5f('0x5d')](_['defaults'](_0x571979['body'],{'firstName':_0x50c4de,'mobile':_0x50c4de,'phone':_0x50c4de,'ListId':_0x23b240[_0x0a5f('0x9b')]}));}})[_0x0a5f('0x21')](handleEntityNotFound(_0x2f6058,null))['then'](function(_0x102a3c){if(_0x102a3c){_0x365838=_0x102a3c;return db[_0x0a5f('0xa2')][_0x0a5f('0x5c')]({'where':{'ContactId':_0x365838['id'],'closed':![],'SmsAccountId':_0x23b240['id']}})[_0x0a5f('0x21')](function(_0x2c448f){if(_0x2c448f){return[_0x2c448f,![]];}return db[_0x0a5f('0xa2')]['create']({'UserId':_0x571979[_0x0a5f('0xcd')]['id'],'ContactId':_0x365838['id'],'SmsAccountId':_0x23b240['id'],'phone':_0x50c4de,'firstMsgDirection':_0x0a5f('0xce'),'Messages':[_[_0x0a5f('0x54')](_0x571979[_0x0a5f('0x5e')],{'read':![],'body':_0x571979['body'][_0x0a5f('0x5e')],'phone':_0x50c4de,'SmsAccountId':_0x23b240['id'],'UserId':_0x571979[_0x0a5f('0xcd')]['id'],'ContactId':_0x365838['id']})]},{'include':[{'model':db[_0x0a5f('0xaa')],'as':'Messages'}]})[_0x0a5f('0x21')](function(_0x5bcd89){return[_0x5bcd89,!![]];});});}})[_0x0a5f('0xa3')](function(_0x2758e6,_0x2465cc){if(_0x2465cc){return _0x2758e6;}return db['SmsMessage'][_0x0a5f('0x5d')](_[_0x0a5f('0x54')](_0x571979[_0x0a5f('0x5e')],{'read':![],'body':_0x571979['body'][_0x0a5f('0x5e')],'phone':_0x50c4de,'SmsAccountId':_0x23b240['id'],'SmsInteractionId':_0x2758e6['id'],'UserId':_0x571979[_0x0a5f('0xcd')]['id'],'ContactId':_0x365838['id']}))[_0x0a5f('0x21')](function(_0x216f9a){_0x2758e6[_0x0a5f('0xcf')][_0x0a5f('0xd0')]=[];_0x2758e6[_0x0a5f('0xcf')][_0x0a5f('0xd0')][_0x0a5f('0xd1')](_0x216f9a[_0x0a5f('0xcf')]);return _0x2758e6;});})['then'](respondWithResult(_0x2f6058,null))[_0x0a5f('0x2b')](handleError(_0x2f6058,null));};exports['status']=function(_0x484fce,_0x271229,_0x52c2ec){if(_0x484fce[_0x0a5f('0x5e')]['id']){delete _0x484fce[_0x0a5f('0x5e')]['id'];}var _0x2e524c,_0x4c3f5d,_0x4db810;return db[_0x0a5f('0x43')]['find']({'where':{'id':_0x484fce[_0x0a5f('0x57')]['id']}})['then'](handleEntityNotFound(_0x271229,null))[_0x0a5f('0x21')](function(_0x20be66){if(_0x20be66){_0x4db810=_0x20be66;logger[_0x0a5f('0x24')](_0x0a5f('0xb8'),_0x0a5f('0x2c'),_0x0a5f('0xd2'),_0x20be66['type'],util[_0x0a5f('0xd3')](_0x484fce[_0x0a5f('0x5e')],{'showHidden':![],'depth':null}));switch(_0x20be66[_0x0a5f('0x46')]){case _0x0a5f('0x85'):if(_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0xd4')]&&_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0x2c')]){_0x4c3f5d=_0x484fce['body'][_0x0a5f('0x2c')];return db[_0x0a5f('0xaa')][_0x0a5f('0x5c')]({'where':{'messageId':_0x484fce['body'][_0x0a5f('0xd4')]}});}break;case _0x0a5f('0xd5'):if(_0x484fce['body'][_0x0a5f('0xd6')]&&_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0xd7')]){_0x4c3f5d=_0x484fce['body'][_0x0a5f('0xd7')];return db[_0x0a5f('0xaa')][_0x0a5f('0x5c')]({'where':{'messageId':_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0xd6')]}});}break;case _0x0a5f('0x88'):if(_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0x89')]&&_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0xd8')]){_0x4c3f5d=_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0xd8')];return db[_0x0a5f('0xaa')][_0x0a5f('0x5c')]({'where':{'messageId':_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0x89')]}});}break;case _0x0a5f('0xd9'):var _0x222bf4=_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0x8d')][0x0];if(_0x222bf4[_0x0a5f('0x83')]&&_0x222bf4['status']['groupName']===_0x0a5f('0xda')){_0x4c3f5d=_0x222bf4[_0x0a5f('0x2c')][_0x0a5f('0xdb')];return db[_0x0a5f('0xaa')][_0x0a5f('0x5c')]({'where':{'messageId':_0x222bf4['messageId']}});}break;case _0x0a5f('0x91'):if(_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0x83')]&&_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0x2c')]){_0x4c3f5d=_0x484fce['body'][_0x0a5f('0x2c')];return db['SmsMessage'][_0x0a5f('0x5c')]({'where':{'messageId':_0x484fce[_0x0a5f('0x5e')]['messageId']}});}break;case _0x0a5f('0xdc'):if(_0x484fce['body'][0x0][_0x0a5f('0x29')]['id']){_0x4c3f5d=_0x484fce[_0x0a5f('0x5e')][0x0][_0x0a5f('0x46')];return db[_0x0a5f('0xaa')][_0x0a5f('0x5c')]({'where':{'messageId':_0x484fce['body'][0x0][_0x0a5f('0x29')]['id']}});}break;case _0x0a5f('0xdd'):if(_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0xde')]&&_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0x2c')]){_0x4c3f5d=_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0x2c')];return db['SmsMessage'][_0x0a5f('0x5c')]({'where':{'messageId':_0x484fce[_0x0a5f('0x5e')][_0x0a5f('0xde')]}});}break;}}})[_0x0a5f('0x21')](handleEntityNotFound(_0x271229,null))[_0x0a5f('0x21')](function(_0x1abf99){if(_0x1abf99){_0x2e524c=_0x1abf99;switch(_0x4db810[_0x0a5f('0x46')]){case _0x0a5f('0x85'):if(_0x4c3f5d===_0x0a5f('0xda')){return _0x2e524c['update']({'read':!![]});}else{logger['error'](_0x0a5f('0xb8'),_0x0a5f('0x2c'),_0x0a5f('0x85'),util[_0x0a5f('0xd3')](_0x484fce[_0x0a5f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0a5f('0xd5'):if(_0x4c3f5d==='1'){return _0x2e524c['update']({'read':!![]});}else{logger[_0x0a5f('0x26')](_0x0a5f('0xb8'),_0x0a5f('0x2c'),'skebby',util[_0x0a5f('0xd3')](_0x484fce[_0x0a5f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0a5f('0x88'):if(!_0x484fce[_0x0a5f('0x5e')]['error_code']&&_0x4c3f5d>=0xc8&&_0x4c3f5d<=0xce){return _0x2e524c['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0a5f('0x88'),util[_0x0a5f('0xd3')](_0x484fce[_0x0a5f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0a5f('0xd9'):var _0x424650=_0x484fce['body'][_0x0a5f('0x8d')][0x0];if(_0x424650['status'][_0x0a5f('0xdb')]===_0x0a5f('0xda')){return _0x2e524c[_0x0a5f('0x37')]({'read':!![]});}else{logger[_0x0a5f('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0a5f('0xd9'),util[_0x0a5f('0xd3')](_0x484fce[_0x0a5f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0a5f('0x91'):if(_0x4c3f5d=='DELIVERED_TO_GATEWAY'||_0x4c3f5d==_0x0a5f('0xdf')){return _0x2e524c['update']({'read':!![]});}else{logger[_0x0a5f('0x26')](_0x0a5f('0xb8'),_0x0a5f('0x2c'),_0x0a5f('0x91'),util[_0x0a5f('0xd3')](_0x484fce[_0x0a5f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0a5f('0xdc'):if(_0x4c3f5d=='message-delivered'){return _0x2e524c['update']({'read':!![]});}else{logger[_0x0a5f('0x26')](_0x0a5f('0xb8'),'status','bandwidth',util['inspect'](_0x484fce[_0x0a5f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0a5f('0xdd'):if(_0x4c3f5d==='DELIVRD'||_0x4c3f5d==='ACCEPTD'){return _0x2e524c[_0x0a5f('0x37')]({'read':!![]});}else{logger['error'](_0x0a5f('0xb8'),_0x0a5f('0x2c'),_0x0a5f('0xdd'),util['inspect'](_0x484fce[_0x0a5f('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x2e524c;}})[_0x0a5f('0x21')](respondWithResult(_0x271229,null))[_0x0a5f('0x2b')](handleError(_0x271229,null));};exports[_0x0a5f('0xe0')]=function(_0x4954aa,_0x1fe251,_0x11ab69){var _0x1c0992,_0x33d26e,_0x1d44fa;return db[_0x0a5f('0x43')]['find']({'where':{'id':_0x4954aa[_0x0a5f('0x57')]['id']}})[_0x0a5f('0x21')](handleEntityNotFound(_0x1fe251,null))['then'](function(_0x36959d){if(_0x36959d){_0x1d44fa=_0x36959d;logger[_0x0a5f('0x24')](_0x0a5f('0xb8'),_0x0a5f('0x2c'),'received\x20delivery\x20report\x20from',_0x36959d[_0x0a5f('0x46')],util['inspect'](_0x4954aa[_0x0a5f('0x4b')],{'showHidden':![],'depth':null}));switch(_0x36959d[_0x0a5f('0x46')]){case _0x0a5f('0x8e'):if(_0x4954aa['query'][_0x0a5f('0xe1')]&&_0x4954aa[_0x0a5f('0x4b')]['state']){_0x33d26e=_0x4954aa[_0x0a5f('0x4b')][_0x0a5f('0xe2')];return db[_0x0a5f('0xaa')][_0x0a5f('0x5c')]({'where':{'messageId':_0x4954aa[_0x0a5f('0x4b')][_0x0a5f('0xe1')]}});}break;}}})[_0x0a5f('0x21')](handleEntityNotFound(_0x1fe251,null))[_0x0a5f('0x21')](function(_0x227d00){if(_0x227d00){_0x1c0992=_0x227d00;switch(_0x1d44fa[_0x0a5f('0x46')]){case _0x0a5f('0x8e'):if(_0x33d26e==='2'||_0x33d26e==='6'){return _0x1c0992[_0x0a5f('0x37')]({'read':!![]});}else{logger[_0x0a5f('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a5f('0x2c'),'csc',util[_0x0a5f('0xd3')](_0x4954aa[_0x0a5f('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x1c0992;}})['then'](respondWithResult(_0x1fe251,null))[_0x0a5f('0x2b')](handleError(_0x1fe251,null));};exports[_0x0a5f('0xe3')]=function(_0x22a9b1,_0x4df78f,_0x1e78d0){return db[_0x0a5f('0x43')]['find']({'where':{'id':_0x22a9b1[_0x0a5f('0x57')]['id']}})['then'](handleEntityNotFound(_0x4df78f,null))[_0x0a5f('0x21')](function(_0x2459db){if(_0x2459db){return _0x2459db[_0x0a5f('0xe3')](_0x22a9b1[_0x0a5f('0x5e')][_0x0a5f('0x6c')],_[_0x0a5f('0xa0')](_0x22a9b1[_0x0a5f('0x5e')],[_0x0a5f('0x6c'),'id'])||{})[_0x0a5f('0xa3')](function(_0xd5e752){for(var _0x1c18a1=0x0;_0x1c18a1<_0x22a9b1['body'][_0x0a5f('0x6c')][_0x0a5f('0x4d')];_0x1c18a1+=0x1){socket[_0x0a5f('0xe4')](_0x0a5f('0xe5'),{'UserId':Number(_0x22a9b1['body'][_0x0a5f('0x6c')][_0x1c18a1]),'SmsAccountId':Number(_0x22a9b1[_0x0a5f('0x57')]['id'])});}return _0xd5e752;});}})['then'](respondWithResult(_0x4df78f,null))[_0x0a5f('0x2b')](handleError(_0x4df78f,null));};exports[_0x0a5f('0xe6')]=function(_0x5139b8,_0x56debd,_0xd0495f){return db[_0x0a5f('0x43')][_0x0a5f('0x5c')]({'where':{'id':_0x5139b8[_0x0a5f('0x57')]['id']}})[_0x0a5f('0x21')](handleEntityNotFound(_0x56debd,null))[_0x0a5f('0x21')](function(_0x2bb48e){if(_0x2bb48e){return _0x2bb48e[_0x0a5f('0xe6')](_0x5139b8[_0x0a5f('0x4b')][_0x0a5f('0x6c')])['then'](function(){if(_['isArray'](_0x5139b8['query']['ids'])){for(var _0x3e287f=0x0;_0x3e287f<_0x5139b8[_0x0a5f('0x4b')][_0x0a5f('0x6c')][_0x0a5f('0x4d')];_0x3e287f+=0x1){socket[_0x0a5f('0xe4')](_0x0a5f('0xe7'),{'UserId':Number(_0x5139b8[_0x0a5f('0x4b')][_0x0a5f('0x6c')][_0x3e287f]),'SmsAccountId':Number(_0x5139b8[_0x0a5f('0x57')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x5139b8['query']['ids']),'SmsAccountId':Number(_0x5139b8[_0x0a5f('0x57')]['id'])});}});}})[_0x0a5f('0x21')](respondWithStatusCode(_0x56debd,null))[_0x0a5f('0x2b')](handleError(_0x56debd,null));};exports[_0x0a5f('0xe8')]=function(_0x3516cc,_0x3e874f,_0x371d39){var _0xf217eb={};var _0x1f4955={};var _0x349c55;var _0x6b079a;return db[_0x0a5f('0x43')][_0x0a5f('0x68')]({'where':{'id':_0x3516cc[_0x0a5f('0x57')]['id']}})[_0x0a5f('0x21')](handleEntityNotFound(_0x3e874f,null))[_0x0a5f('0x21')](function(_0x5ca1cf){if(_0x5ca1cf){_0x349c55=_0x5ca1cf;_0x1f4955['model']=_[_0x0a5f('0x58')](db[_0x0a5f('0xae')][_0x0a5f('0x44')]);_0x1f4955[_0x0a5f('0x4b')]=_[_0x0a5f('0x58')](_0x3516cc[_0x0a5f('0x4b')]);_0x1f4955[_0x0a5f('0x47')]=_[_0x0a5f('0x48')](_0x1f4955['model'],_0x1f4955[_0x0a5f('0x4b')]);_0xf217eb[_0x0a5f('0x4c')]=_[_0x0a5f('0x48')](_0x1f4955[_0x0a5f('0x49')],qs[_0x0a5f('0x4a')](_0x3516cc['query']['fields']));_0xf217eb[_0x0a5f('0x4c')]=_0xf217eb[_0x0a5f('0x4c')][_0x0a5f('0x4d')]?_0xf217eb[_0x0a5f('0x4c')]:_0x1f4955['model'];_0xf217eb[_0x0a5f('0x4f')]=qs[_0x0a5f('0x50')](_0x3516cc[_0x0a5f('0x4b')][_0x0a5f('0x50')]);_0xf217eb[_0x0a5f('0x53')]=qs[_0x0a5f('0x47')](_[_0x0a5f('0x51')](_0x3516cc[_0x0a5f('0x4b')],_0x1f4955[_0x0a5f('0x47')]));if(_0x3516cc[_0x0a5f('0x4b')][_0x0a5f('0x52')]){_0xf217eb[_0x0a5f('0x53')]=_[_0x0a5f('0x54')](_0xf217eb[_0x0a5f('0x53')],{'$or':_[_0x0a5f('0x42')](_0xf217eb['attributes'],function(_0x4ce9e8){var _0x5a40a3={};_0x5a40a3[_0x4ce9e8]={'$like':'%'+_0x3516cc[_0x0a5f('0x4b')][_0x0a5f('0x52')]+'%'};return _0x5a40a3;})});}_0xf217eb=_['merge']({},_0xf217eb,_0x3516cc[_0x0a5f('0x5b')]);return _0x349c55['getAgents'](_0xf217eb);}})['then'](function(_0x4a6cc8){if(_0x4a6cc8){_0x6b079a=_0x4a6cc8['length'];if(!_0x3516cc['query'][_0x0a5f('0x4e')](_0x0a5f('0x69'))){_0xf217eb[_0x0a5f('0x30')]=qs['limit'](_0x3516cc[_0x0a5f('0x4b')][_0x0a5f('0x30')]);_0xf217eb[_0x0a5f('0x2e')]=qs[_0x0a5f('0x2e')](_0x3516cc[_0x0a5f('0x4b')][_0x0a5f('0x2e')]);}return _0x349c55[_0x0a5f('0xe8')](_0xf217eb);}})[_0x0a5f('0x21')](function(_0x501060){if(_0x501060){return _0x501060?{'count':_0x6b079a,'rows':_0x501060}:null;}})[_0x0a5f('0x21')](respondWithResult(_0x3e874f,null))[_0x0a5f('0x2b')](handleError(_0x3e874f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index fd7e4c5..3134ac4 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 _0xb43b=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x3a251b,_0x7a5482){var _0x36986b=function(_0x5446e2){while(--_0x5446e2){_0x3a251b['push'](_0x3a251b['shift']());}};_0x36986b(++_0x7a5482);}(_0xb43b,0x74));var _0xbb43=function(_0x469eca,_0x2b1081){_0x469eca=_0x469eca-0x0;var _0x15da2=_0xb43b[_0x469eca];return _0x15da2;};'use strict';var EventEmitter=require(_0xbb43('0x0'));var SmsAccount=require(_0xbb43('0x1'))['db'][_0xbb43('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xbb43('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbb43('0x4')};function emitEvent(_0x4c93cf){return function(_0x292e4f,_0x2fe3ec,_0x3d173a){SmsAccountEvents['emit'](_0x4c93cf+':'+_0x292e4f['id'],_0x292e4f);SmsAccountEvents['emit'](_0x4c93cf,_0x292e4f);_0x3d173a(null);};}for(var e in events){if(events[_0xbb43('0x5')](e)){var event=events[e];SmsAccount[_0xbb43('0x6')](e,emitEvent(event));}}module[_0xbb43('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x9208=['remove','emit','hasOwnProperty','hook','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x5bc28a,_0x4e4a83){var _0x22d5f8=function(_0x21d600){while(--_0x21d600){_0x5bc28a['push'](_0x5bc28a['shift']());}};_0x22d5f8(++_0x4e4a83);}(_0x9208,0x82));var _0x8920=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9208[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x8920('0x0'))['db'][_0x8920('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8920('0x2')](0x0);var events={'afterCreate':_0x8920('0x3'),'afterUpdate':_0x8920('0x4'),'afterDestroy':_0x8920('0x5')};function emitEvent(_0x214697){return function(_0x58de44,_0x20e7f4,_0x2d6e4d){SmsAccountEvents['emit'](_0x214697+':'+_0x58de44['id'],_0x58de44);SmsAccountEvents[_0x8920('0x6')](_0x214697,_0x58de44);_0x2d6e4d(null);};}for(var e in events){if(events[_0x8920('0x7')](e)){var event=events[e];SmsAccount[_0x8920('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index c45d1d7..8e08a3c 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 _0x88be=['util','../../config/logger','api','moment','path','rimraf','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x3e7e4f,_0x5d53e4){var _0x4c2a04=function(_0x181538){while(--_0x181538){_0x3e7e4f['push'](_0x3e7e4f['shift']());}};_0x4c2a04(++_0x5d53e4);}(_0x88be,0x78));var _0xe88b=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x88be[_0x257642];return _0x3d813b;};'use strict';var _=require(_0xe88b('0x0'));var util=require(_0xe88b('0x1'));var logger=require(_0xe88b('0x2'))(_0xe88b('0x3'));var moment=require(_0xe88b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe88b('0x5'));var rimraf=require(_0xe88b('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xe88b('0x7')]=function(_0x3da8d7,_0x276299){return _0x3da8d7[_0xe88b('0x8')](_0xe88b('0x9'),attributes,{'tableName':_0xe88b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2094=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash'];(function(_0x3ac330,_0x36ba30){var _0x175869=function(_0x13e2b8){while(--_0x13e2b8){_0x3ac330['push'](_0x3ac330['shift']());}};_0x175869(++_0x36ba30);}(_0x2094,0x1a3));var _0x4209=function(_0x303051,_0x51af0f){_0x303051=_0x303051-0x0;var _0x1b5144=_0x2094[_0x303051];return _0x1b5144;};'use strict';var _=require(_0x4209('0x0'));var util=require('util');var logger=require(_0x4209('0x1'))(_0x4209('0x2'));var moment=require(_0x4209('0x3'));var BPromise=require(_0x4209('0x4'));var rp=require(_0x4209('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4209('0x6'));var config=require(_0x4209('0x7'));var attributes=require(_0x4209('0x8'));module[_0x4209('0x9')]=function(_0x572219,_0x32853f){return _0x572219[_0x4209('0xa')](_0x4209('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index fb68d1f..2b3cb44 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 _0xecd2=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','localhost','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes'];(function(_0x9731b4,_0x26aac3){var _0x3d7a66=function(_0x4be24c){while(--_0x4be24c){_0x9731b4['push'](_0x9731b4['shift']());}};_0x3d7a66(++_0x26aac3);}(_0xecd2,0x1cf));var _0x2ecd=function(_0x475b3a,_0x5bbece){_0x475b3a=_0x475b3a-0x0;var _0x3e8b6a=_0xecd2[_0x475b3a];return _0x3e8b6a;};'use strict';var _=require(_0x2ecd('0x0'));var util=require('util');var moment=require(_0x2ecd('0x1'));var BPromise=require(_0x2ecd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ecd('0x3'));var db=require(_0x2ecd('0x4'))['db'];var utils=require(_0x2ecd('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2ecd('0x6'));var client=jayson[_0x2ecd('0x7')]['http']({'port':0x232a});config[_0x2ecd('0x8')]=_['defaults'](config[_0x2ecd('0x8')],{'host':_0x2ecd('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ecd('0x8')]));require(_0x2ecd('0xa'))[_0x2ecd('0xb')](socket);function respondWithRpcPromise(_0x303421,_0x1cfaee,_0x426d4f){return new BPromise(function(_0x4a32de,_0x93f4c1){return client[_0x2ecd('0xc')](_0x303421,_0x426d4f)[_0x2ecd('0xd')](function(_0x184792){logger['info'](_0x2ecd('0xe'),_0x1cfaee,'request\x20sent');logger['debug'](_0x2ecd('0xf'),_0x1cfaee,'request\x20sent',JSON['stringify'](_0x184792));if(_0x184792['error']){if(_0x184792[_0x2ecd('0x10')][_0x2ecd('0x11')]===0x1f4){logger[_0x2ecd('0x10')]('SmsAccount,\x20%s,\x20%s',_0x1cfaee,_0x184792[_0x2ecd('0x10')]['message']);return _0x93f4c1(_0x184792[_0x2ecd('0x10')][_0x2ecd('0x12')]);}logger[_0x2ecd('0x10')](_0x2ecd('0xe'),_0x1cfaee,_0x184792[_0x2ecd('0x10')][_0x2ecd('0x12')]);return _0x4a32de(_0x184792[_0x2ecd('0x10')]['message']);}else{logger[_0x2ecd('0x13')](_0x2ecd('0xe'),_0x1cfaee,_0x2ecd('0x14'));_0x4a32de(_0x184792[_0x2ecd('0x15')][_0x2ecd('0x12')]);}})['catch'](function(_0x1edfc6){logger[_0x2ecd('0x10')]('SmsAccount,\x20%s,\x20%s',_0x1cfaee,_0x1edfc6);_0x93f4c1(_0x1edfc6);});});}exports[_0x2ecd('0x16')]=function(_0x58442b){var _0x4b4ec4=this;return new Promise(function(_0x3be441,_0x3f6d3b){return db[_0x2ecd('0x17')][_0x2ecd('0x18')]({'raw':_0x58442b['options']?_0x58442b[_0x2ecd('0x19')][_0x2ecd('0x1a')]===undefined?!![]:![]:!![],'where':_0x58442b[_0x2ecd('0x19')]?_0x58442b[_0x2ecd('0x19')][_0x2ecd('0x1b')]||null:null,'attributes':_0x58442b[_0x2ecd('0x19')]?_0x58442b[_0x2ecd('0x19')]['attributes']||null:null,'include':_0x58442b[_0x2ecd('0x19')]?_0x58442b['options'][_0x2ecd('0x1c')]?_[_0x2ecd('0x1d')](_0x58442b[_0x2ecd('0x19')]['include'],function(_0x3c6805){return{'model':db[_0x3c6805[_0x2ecd('0x1e')]],'as':_0x3c6805['as'],'attributes':_0x3c6805[_0x2ecd('0x1f')],'include':_0x3c6805['include']?_['map'](_0x3c6805[_0x2ecd('0x1c')],function(_0x215c9c){return{'model':db[_0x215c9c['model']],'as':_0x215c9c['as'],'attributes':_0x215c9c['attributes'],'include':_0x215c9c[_0x2ecd('0x1c')]?_['map'](_0x215c9c['include'],function(_0xd69a05){return{'model':db[_0xd69a05[_0x2ecd('0x1e')]],'as':_0xd69a05['as'],'attributes':_0xd69a05['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ecd('0xd')](function(_0x3f172d){logger[_0x2ecd('0x13')](_0x2ecd('0x16'),_0x58442b);logger['debug'](_0x2ecd('0x16'),_0x58442b,JSON['stringify'](_0x3f172d));_0x3be441(_0x3f172d);})[_0x2ecd('0x20')](function(_0x221634){logger[_0x2ecd('0x10')](_0x2ecd('0x16'),_0x221634['message'],_0x58442b);_0x3f6d3b(_0x4b4ec4[_0x2ecd('0x10')](0x1f4,_0x221634[_0x2ecd('0x12')]));});});}; \ No newline at end of file +var _0x55d1=['request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0x55d1,0x1cd));var _0x155d=function(_0x405a7a,_0x5937ac){_0x405a7a=_0x405a7a-0x0;var _0x4c9a54=_0x55d1[_0x405a7a];return _0x4c9a54;};'use strict';var _=require(_0x155d('0x0'));var util=require('util');var moment=require(_0x155d('0x1'));var BPromise=require(_0x155d('0x2'));var rs=require(_0x155d('0x3'));var fs=require('fs');var Redis=require(_0x155d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x155d('0x5'));var logger=require(_0x155d('0x6'))(_0x155d('0x7'));var config=require('../../config/environment');var jayson=require(_0x155d('0x8'));var client=jayson[_0x155d('0x9')]['http']({'port':0x232a});config[_0x155d('0xa')]=_['defaults'](config['redis'],{'host':_0x155d('0xb'),'port':0x18eb});var socket=require(_0x155d('0xc'))(new Redis(config[_0x155d('0xa')]));require(_0x155d('0xd'))[_0x155d('0xe')](socket);function respondWithRpcPromise(_0x14b8d4,_0x3ce3db,_0x540687){return new BPromise(function(_0x72394,_0x190a27){return client[_0x155d('0xf')](_0x14b8d4,_0x540687)['then'](function(_0x26dc47){logger[_0x155d('0x10')](_0x155d('0x11'),_0x3ce3db,'request\x20sent');logger[_0x155d('0x12')](_0x155d('0x13'),_0x3ce3db,_0x155d('0x14'),JSON[_0x155d('0x15')](_0x26dc47));if(_0x26dc47[_0x155d('0x16')]){if(_0x26dc47[_0x155d('0x16')][_0x155d('0x17')]===0x1f4){logger[_0x155d('0x16')](_0x155d('0x11'),_0x3ce3db,_0x26dc47[_0x155d('0x16')][_0x155d('0x18')]);return _0x190a27(_0x26dc47['error'][_0x155d('0x18')]);}logger[_0x155d('0x16')](_0x155d('0x11'),_0x3ce3db,_0x26dc47[_0x155d('0x16')][_0x155d('0x18')]);return _0x72394(_0x26dc47[_0x155d('0x16')][_0x155d('0x18')]);}else{logger[_0x155d('0x10')](_0x155d('0x11'),_0x3ce3db,_0x155d('0x14'));_0x72394(_0x26dc47[_0x155d('0x19')][_0x155d('0x18')]);}})[_0x155d('0x1a')](function(_0x45f4d0){logger[_0x155d('0x16')](_0x155d('0x11'),_0x3ce3db,_0x45f4d0);_0x190a27(_0x45f4d0);});});}exports[_0x155d('0x1b')]=function(_0x41550f){var _0x5172ce=this;return new Promise(function(_0x2ef7aa,_0x9c7943){return db[_0x155d('0x1c')][_0x155d('0x1d')]({'raw':_0x41550f[_0x155d('0x1e')]?_0x41550f[_0x155d('0x1e')][_0x155d('0x1f')]===undefined?!![]:![]:!![],'where':_0x41550f[_0x155d('0x1e')]?_0x41550f[_0x155d('0x1e')][_0x155d('0x20')]||null:null,'attributes':_0x41550f[_0x155d('0x1e')]?_0x41550f[_0x155d('0x1e')][_0x155d('0x21')]||null:null,'include':_0x41550f[_0x155d('0x1e')]?_0x41550f[_0x155d('0x1e')][_0x155d('0x22')]?_[_0x155d('0x23')](_0x41550f['options'][_0x155d('0x22')],function(_0x2a5c99){return{'model':db[_0x2a5c99['model']],'as':_0x2a5c99['as'],'attributes':_0x2a5c99['attributes'],'include':_0x2a5c99['include']?_[_0x155d('0x23')](_0x2a5c99[_0x155d('0x22')],function(_0x339138){return{'model':db[_0x339138['model']],'as':_0x339138['as'],'attributes':_0x339138[_0x155d('0x21')],'include':_0x339138['include']?_['map'](_0x339138['include'],function(_0x52120c){return{'model':db[_0x52120c['model']],'as':_0x52120c['as'],'attributes':_0x52120c[_0x155d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x155d('0x24')](function(_0x2fe8f5){logger[_0x155d('0x10')]('ShowSmsAccount',_0x41550f);logger[_0x155d('0x12')](_0x155d('0x1b'),_0x41550f,JSON[_0x155d('0x15')](_0x2fe8f5));_0x2ef7aa(_0x2fe8f5);})[_0x155d('0x1a')](function(_0x14831c){logger[_0x155d('0x16')](_0x155d('0x1b'),_0x14831c['message'],_0x41550f);_0x9c7943(_0x5172ce[_0x155d('0x16')](0x1f4,_0x14831c[_0x155d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a0f24ca..e63e84f 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 9d202ea..40ea386 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 _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(_0x375a22,_0x4c065d){var _0x573d9f=function(_0x3de1ac){while(--_0x3de1ac){_0x375a22['push'](_0x375a22['shift']());}};_0x573d9f(++_0x4c065d);}(_0x34e8,0x12c));var _0x834e=function(_0x5809d3,_0x3b3f47){_0x5809d3=_0x5809d3-0x0;var _0x419d9c=_0x34e8[_0x5809d3];return _0x419d9c;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f1361c5..d9d661e 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 _0x7f40=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x373440,_0x2fa7f0){var _0x4bbe6f=function(_0x3507f5){while(--_0x3507f5){_0x373440['push'](_0x373440['shift']());}};_0x4bbe6f(++_0x2fa7f0);}(_0x7f40,0x141));var _0x07f4=function(_0x44d920,_0x2d9a62){_0x44d920=_0x44d920-0x0;var _0x27df80=_0x7f40[_0x44d920];return _0x27df80;};'use strict';var Sequelize=require(_0x07f4('0x0'));module[_0x07f4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x07f4('0x2')],'allowNull':![],'defaultValue':_0x07f4('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x07f4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x07f4('0x4')}}; \ No newline at end of file +var _0x238a=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x1a562f,_0x476596){var _0x921847=function(_0x422049){while(--_0x422049){_0x1a562f['push'](_0x1a562f['shift']());}};_0x921847(++_0x476596);}(_0x238a,0x175));var _0xa238=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x238a[_0x172ed7];return _0xfa8f61;};'use strict';var Sequelize=require(_0xa238('0x0'));module[_0xa238('0x1')]={'priority':{'type':Sequelize[_0xa238('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa238('0x3')],'allowNull':![],'defaultValue':_0xa238('0x4')},'appdata':{'type':Sequelize[_0xa238('0x5')]()},'description':{'type':Sequelize[_0xa238('0x3')]},'interval':{'type':Sequelize[_0xa238('0x3')],'defaultValue':_0xa238('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6be2d5f..7bf7aed 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 _0xf330=['options','includeAll','include','findAll','rows','find','catch','create','params','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL'];(function(_0x16fc74,_0x5173a8){var _0x4e1164=function(_0x1b7889){while(--_0x1b7889){_0x16fc74['push'](_0x16fc74['shift']());}};_0x4e1164(++_0x5173a8);}(_0xf330,0x9a));var _0x0f33=function(_0x434a83,_0x7fe42c){_0x434a83=_0x434a83-0x0;var _0x2899b9=_0xf330[_0x434a83];return _0x2899b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f33('0x0'));var zipdir=require(_0x0f33('0x1'));var jsonpatch=require(_0x0f33('0x2'));var rp=require(_0x0f33('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f33('0x4'));var util=require(_0x0f33('0x5'));var path=require(_0x0f33('0x6'));var sox=require(_0x0f33('0x7'));var csv=require(_0x0f33('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f33('0x9'));var _=require('lodash');var squel=require(_0x0f33('0xa'));var crypto=require(_0x0f33('0xb'));var jsforce=require(_0x0f33('0xc'));var deskjs=require(_0x0f33('0xd'));var toCsv=require(_0x0f33('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0f33('0xe'));var authService=require(_0x0f33('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0f33('0x10'));var hardwareService=require(_0x0f33('0x11'));var logger=require(_0x0f33('0x12'))('api');var utils=require(_0x0f33('0x13'));var config=require(_0x0f33('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f33('0x15'))['db'];function respondWithStatusCode(_0x63ca05,_0x444693){_0x444693=_0x444693||0xcc;return function(_0x3b6e52){if(_0x3b6e52){return _0x63ca05[_0x0f33('0x16')](_0x444693);}return _0x63ca05['status'](_0x444693)[_0x0f33('0x17')]();};}function respondWithResult(_0x23734a,_0x71e74f){_0x71e74f=_0x71e74f||0xc8;return function(_0x557354){if(_0x557354){return _0x23734a[_0x0f33('0x18')](_0x71e74f)[_0x0f33('0x19')](_0x557354);}};}function respondWithFilteredResult(_0x2b7b56,_0x3fa1b9){return function(_0x16b4b7){if(_0x16b4b7){var _0xae547b=typeof _0x3fa1b9[_0x0f33('0x1a')]===_0x0f33('0x1b')&&typeof _0x3fa1b9[_0x0f33('0x1c')]===_0x0f33('0x1b');var _0x49a94c=_0x16b4b7['count'];var _0x4c7095=_0xae547b?0x0:_0x3fa1b9[_0x0f33('0x1a')];var _0x94e092=_0xae547b?_0x16b4b7[_0x0f33('0x1d')]:_0x3fa1b9[_0x0f33('0x1a')]+_0x3fa1b9[_0x0f33('0x1c')];var _0x423497;if(_0x94e092>=_0x49a94c){_0x94e092=_0x49a94c;_0x423497=0xc8;}else{_0x423497=0xce;}_0x2b7b56[_0x0f33('0x18')](_0x423497);return _0x2b7b56[_0x0f33('0x1e')]('Content-Range',_0x4c7095+'-'+_0x94e092+'/'+_0x49a94c)['json'](_0x16b4b7);}return null;};}function patchUpdates(_0x39bc25){return function(_0x5c5d3b){try{jsonpatch[_0x0f33('0x1f')](_0x5c5d3b,_0x39bc25,!![]);}catch(_0x3f21af){return BPromise[_0x0f33('0x20')](_0x3f21af);}return _0x5c5d3b[_0x0f33('0x21')]();};}function saveUpdates(_0x1118c4,_0x5e7070){return function(_0x1f79d5){if(_0x1f79d5){return _0x1f79d5[_0x0f33('0x22')](_0x1118c4)[_0x0f33('0x23')](function(_0x437393){return _0x437393;});}return null;};}function removeEntity(_0x8d8e93,_0xf77d90){return function(_0x5d4dfa){if(_0x5d4dfa){return _0x5d4dfa[_0x0f33('0x24')]()[_0x0f33('0x23')](function(){_0x8d8e93[_0x0f33('0x18')](0xcc)[_0x0f33('0x17')]();});}};}function handleEntityNotFound(_0x245eb9,_0x147983){return function(_0x4eae2f){if(!_0x4eae2f){_0x245eb9[_0x0f33('0x16')](0x194);}return _0x4eae2f;};}function handleError(_0x19f615,_0x2c4a08){_0x2c4a08=_0x2c4a08||0x1f4;return function(_0x16401f){logger[_0x0f33('0x25')](_0x16401f[_0x0f33('0x26')]);if(_0x16401f[_0x0f33('0x27')]){delete _0x16401f['name'];}_0x19f615[_0x0f33('0x18')](_0x2c4a08)[_0x0f33('0x28')](_0x16401f);};}exports['index']=function(_0x17add2,_0x3a4cf3){var _0xd1bd50={},_0x5ab030={},_0x160b79={'count':0x0,'rows':[]};var _0x4b63b9=_[_0x0f33('0x29')](db[_0x0f33('0x2a')][_0x0f33('0x2b')],function(_0x3b1552){return{'name':_0x3b1552[_0x0f33('0x2c')],'type':_0x3b1552[_0x0f33('0x2d')]['key']};});_0x5ab030['model']=_['map'](_0x4b63b9,_0x0f33('0x27'));_0x5ab030['query']=_[_0x0f33('0x2e')](_0x17add2[_0x0f33('0x2f')]);_0x5ab030['filters']=_[_0x0f33('0x30')](_0x5ab030[_0x0f33('0x31')],_0x5ab030[_0x0f33('0x2f')]);_0xd1bd50[_0x0f33('0x32')]=_[_0x0f33('0x30')](_0x5ab030[_0x0f33('0x31')],qs[_0x0f33('0x33')](_0x17add2[_0x0f33('0x2f')][_0x0f33('0x33')]));_0xd1bd50[_0x0f33('0x32')]=_0xd1bd50[_0x0f33('0x32')][_0x0f33('0x34')]?_0xd1bd50['attributes']:_0x5ab030[_0x0f33('0x31')];if(!_0x17add2['query']['hasOwnProperty'](_0x0f33('0x35'))){_0xd1bd50[_0x0f33('0x1c')]=qs[_0x0f33('0x1c')](_0x17add2[_0x0f33('0x2f')]['limit']);_0xd1bd50[_0x0f33('0x1a')]=qs[_0x0f33('0x1a')](_0x17add2[_0x0f33('0x2f')][_0x0f33('0x1a')]);}_0xd1bd50[_0x0f33('0x36')]=qs['sort'](_0x17add2['query'][_0x0f33('0x37')]);_0xd1bd50[_0x0f33('0x38')]=qs['filters'](_[_0x0f33('0x39')](_0x17add2[_0x0f33('0x2f')],_0x5ab030[_0x0f33('0x3a')]),_0x4b63b9);if(_0x17add2['query'][_0x0f33('0x3b')]){_0xd1bd50[_0x0f33('0x38')]=_[_0x0f33('0x3c')](_0xd1bd50[_0x0f33('0x38')],{'$or':_[_0x0f33('0x29')](_0x4b63b9,function(_0x4bcd55){if(_0x4bcd55['type']!==_0x0f33('0x3d')){var _0x6616e4={};_0x6616e4[_0x4bcd55[_0x0f33('0x27')]]={'$like':'%'+_0x17add2[_0x0f33('0x2f')]['filter']+'%'};return _0x6616e4;}})});}_0xd1bd50=_[_0x0f33('0x3c')]({},_0xd1bd50,_0x17add2[_0x0f33('0x3e')]);var _0x2d7f01={'where':_0xd1bd50['where']};return db[_0x0f33('0x2a')][_0x0f33('0x1d')](_0x2d7f01)[_0x0f33('0x23')](function(_0xdb5fe0){_0x160b79['count']=_0xdb5fe0;if(_0x17add2['query'][_0x0f33('0x3f')]){_0xd1bd50[_0x0f33('0x40')]=[{'all':!![]}];}return db[_0x0f33('0x2a')][_0x0f33('0x41')](_0xd1bd50);})[_0x0f33('0x23')](function(_0x2e3d4c){_0x160b79[_0x0f33('0x42')]=_0x2e3d4c;return _0x160b79;})[_0x0f33('0x23')](respondWithFilteredResult(_0x3a4cf3,_0xd1bd50))['catch'](handleError(_0x3a4cf3,null));};exports['show']=function(_0x13b2da,_0x1ecc4b){var _0x2130da={'raw':!![],'where':{'id':_0x13b2da['params']['id']}},_0x49fb16={};_0x49fb16[_0x0f33('0x31')]=_[_0x0f33('0x2e')](db[_0x0f33('0x2a')][_0x0f33('0x2b')]);_0x49fb16[_0x0f33('0x2f')]=_[_0x0f33('0x2e')](_0x13b2da['query']);_0x49fb16['filters']=_['intersection'](_0x49fb16['model'],_0x49fb16[_0x0f33('0x2f')]);_0x2130da[_0x0f33('0x32')]=_['intersection'](_0x49fb16['model'],qs['fields'](_0x13b2da[_0x0f33('0x2f')][_0x0f33('0x33')]));_0x2130da[_0x0f33('0x32')]=_0x2130da[_0x0f33('0x32')][_0x0f33('0x34')]?_0x2130da[_0x0f33('0x32')]:_0x49fb16[_0x0f33('0x31')];if(_0x13b2da[_0x0f33('0x2f')][_0x0f33('0x3f')]){_0x2130da['include']=[{'all':!![]}];}_0x2130da=_[_0x0f33('0x3c')]({},_0x2130da,_0x13b2da[_0x0f33('0x3e')]);return db[_0x0f33('0x2a')][_0x0f33('0x43')](_0x2130da)['then'](handleEntityNotFound(_0x1ecc4b,null))[_0x0f33('0x23')](respondWithResult(_0x1ecc4b,null))[_0x0f33('0x44')](handleError(_0x1ecc4b,null));};exports[_0x0f33('0x45')]=function(_0x224c4e,_0x16035a){return db[_0x0f33('0x2a')][_0x0f33('0x45')](_0x224c4e['body'],{})['then'](respondWithResult(_0x16035a,0xc9))[_0x0f33('0x44')](handleError(_0x16035a,null));};exports[_0x0f33('0x22')]=function(_0xa2ec67,_0x4fa41b){if(_0xa2ec67['body']['id']){delete _0xa2ec67['body']['id'];}return db['SmsApplication'][_0x0f33('0x43')]({'where':{'id':_0xa2ec67[_0x0f33('0x46')]['id']}})[_0x0f33('0x23')](handleEntityNotFound(_0x4fa41b,null))['then'](saveUpdates(_0xa2ec67[_0x0f33('0x47')],null))[_0x0f33('0x23')](respondWithResult(_0x4fa41b,null))['catch'](handleError(_0x4fa41b,null));};exports[_0x0f33('0x24')]=function(_0x404ebb,_0x6956d3){return db[_0x0f33('0x2a')][_0x0f33('0x43')]({'where':{'id':_0x404ebb[_0x0f33('0x46')]['id']}})[_0x0f33('0x23')](handleEntityNotFound(_0x6956d3,null))[_0x0f33('0x23')](removeEntity(_0x6956d3,null))[_0x0f33('0x44')](handleError(_0x6956d3,null));}; \ No newline at end of file +var _0x0414=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SmsApplication','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis'];(function(_0x3ed980,_0x428985){var _0x35a051=function(_0x5d9f2d){while(--_0x5d9f2d){_0x3ed980['push'](_0x3ed980['shift']());}};_0x35a051(++_0x428985);}(_0x0414,0x11c));var _0x4041=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x0414[_0x30d87a];return _0x48f64b;};'use strict';var emlformat=require(_0x4041('0x0'));var rimraf=require(_0x4041('0x1'));var zipdir=require(_0x4041('0x2'));var jsonpatch=require(_0x4041('0x3'));var rp=require(_0x4041('0x4'));var moment=require(_0x4041('0x5'));var BPromise=require(_0x4041('0x6'));var Mustache=require(_0x4041('0x7'));var util=require(_0x4041('0x8'));var path=require(_0x4041('0x9'));var sox=require(_0x4041('0xa'));var csv=require('to-csv');var ejs=require(_0x4041('0xb'));var fs=require('fs');var fs_extra=require(_0x4041('0xc'));var _=require('lodash');var squel=require(_0x4041('0xd'));var crypto=require(_0x4041('0xe'));var jsforce=require(_0x4041('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4041('0x10'));var querystring=require(_0x4041('0x11'));var Papa=require(_0x4041('0x12'));var Redis=require(_0x4041('0x13'));var authService=require(_0x4041('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4041('0x15'));var hardwareService=require(_0x4041('0x16'));var logger=require(_0x4041('0x17'))(_0x4041('0x18'));var utils=require(_0x4041('0x19'));var config=require(_0x4041('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4041('0x1b'))['db'];function respondWithStatusCode(_0x444d60,_0x177c15){_0x177c15=_0x177c15||0xcc;return function(_0x1d9803){if(_0x1d9803){return _0x444d60['sendStatus'](_0x177c15);}return _0x444d60['status'](_0x177c15)[_0x4041('0x1c')]();};}function respondWithResult(_0x37874d,_0x259480){_0x259480=_0x259480||0xc8;return function(_0x595824){if(_0x595824){return _0x37874d[_0x4041('0x1d')](_0x259480)[_0x4041('0x1e')](_0x595824);}};}function respondWithFilteredResult(_0x56fdb8,_0x3d03b2){return function(_0x13d2b1){if(_0x13d2b1){var _0x47e920=typeof _0x3d03b2[_0x4041('0x1f')]===_0x4041('0x20')&&typeof _0x3d03b2['limit']==='undefined';var _0x52ddcc=_0x13d2b1['count'];var _0x40bf1e=_0x47e920?0x0:_0x3d03b2['offset'];var _0x19be13=_0x47e920?_0x13d2b1['count']:_0x3d03b2[_0x4041('0x1f')]+_0x3d03b2[_0x4041('0x21')];var _0x3d17f6;if(_0x19be13>=_0x52ddcc){_0x19be13=_0x52ddcc;_0x3d17f6=0xc8;}else{_0x3d17f6=0xce;}_0x56fdb8[_0x4041('0x1d')](_0x3d17f6);return _0x56fdb8[_0x4041('0x22')](_0x4041('0x23'),_0x40bf1e+'-'+_0x19be13+'/'+_0x52ddcc)[_0x4041('0x1e')](_0x13d2b1);}return null;};}function patchUpdates(_0x4e9e7b){return function(_0x15f47c){try{jsonpatch[_0x4041('0x24')](_0x15f47c,_0x4e9e7b,!![]);}catch(_0x401a7c){return BPromise[_0x4041('0x25')](_0x401a7c);}return _0x15f47c[_0x4041('0x26')]();};}function saveUpdates(_0x7dff2e,_0x20f398){return function(_0x45d846){if(_0x45d846){return _0x45d846[_0x4041('0x27')](_0x7dff2e)[_0x4041('0x28')](function(_0x36ceeb){return _0x36ceeb;});}return null;};}function removeEntity(_0x5cd099,_0x8f2996){return function(_0x4d7897){if(_0x4d7897){return _0x4d7897[_0x4041('0x29')]()[_0x4041('0x28')](function(){_0x5cd099[_0x4041('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bbcfc,_0x55790b){return function(_0x177bef){if(!_0x177bef){_0x2bbcfc[_0x4041('0x2a')](0x194);}return _0x177bef;};}function handleError(_0x12e957,_0x2161d5){_0x2161d5=_0x2161d5||0x1f4;return function(_0x1a97f6){logger['error'](_0x1a97f6[_0x4041('0x2b')]);if(_0x1a97f6[_0x4041('0x2c')]){delete _0x1a97f6[_0x4041('0x2c')];}_0x12e957[_0x4041('0x1d')](_0x2161d5)[_0x4041('0x2d')](_0x1a97f6);};}exports[_0x4041('0x2e')]=function(_0x4e2db6,_0x52f764){var _0x5e9495={},_0x49e09d={},_0x4af396={'count':0x0,'rows':[]};var _0x27f0ab=_[_0x4041('0x2f')](db[_0x4041('0x30')]['rawAttributes'],function(_0x1eab57){return{'name':_0x1eab57['fieldName'],'type':_0x1eab57[_0x4041('0x31')]['key']};});_0x49e09d[_0x4041('0x32')]=_['map'](_0x27f0ab,'name');_0x49e09d[_0x4041('0x33')]=_['keys'](_0x4e2db6[_0x4041('0x33')]);_0x49e09d[_0x4041('0x34')]=_['intersection'](_0x49e09d[_0x4041('0x32')],_0x49e09d[_0x4041('0x33')]);_0x5e9495[_0x4041('0x35')]=_[_0x4041('0x36')](_0x49e09d['model'],qs[_0x4041('0x37')](_0x4e2db6[_0x4041('0x33')][_0x4041('0x37')]));_0x5e9495[_0x4041('0x35')]=_0x5e9495[_0x4041('0x35')][_0x4041('0x38')]?_0x5e9495[_0x4041('0x35')]:_0x49e09d['model'];if(!_0x4e2db6[_0x4041('0x33')]['hasOwnProperty'](_0x4041('0x39'))){_0x5e9495['limit']=qs[_0x4041('0x21')](_0x4e2db6[_0x4041('0x33')][_0x4041('0x21')]);_0x5e9495['offset']=qs[_0x4041('0x1f')](_0x4e2db6[_0x4041('0x33')][_0x4041('0x1f')]);}_0x5e9495[_0x4041('0x3a')]=qs[_0x4041('0x3b')](_0x4e2db6[_0x4041('0x33')][_0x4041('0x3b')]);_0x5e9495[_0x4041('0x3c')]=qs[_0x4041('0x34')](_['pick'](_0x4e2db6[_0x4041('0x33')],_0x49e09d['filters']),_0x27f0ab);if(_0x4e2db6[_0x4041('0x33')]['filter']){_0x5e9495['where']=_[_0x4041('0x3d')](_0x5e9495[_0x4041('0x3c')],{'$or':_[_0x4041('0x2f')](_0x27f0ab,function(_0xa640a7){if(_0xa640a7[_0x4041('0x31')]!==_0x4041('0x3e')){var _0x29b6af={};_0x29b6af[_0xa640a7[_0x4041('0x2c')]]={'$like':'%'+_0x4e2db6['query']['filter']+'%'};return _0x29b6af;}})});}_0x5e9495=_['merge']({},_0x5e9495,_0x4e2db6[_0x4041('0x3f')]);var _0x703ab4={'where':_0x5e9495[_0x4041('0x3c')]};return db[_0x4041('0x30')][_0x4041('0x40')](_0x703ab4)[_0x4041('0x28')](function(_0x2eaa65){_0x4af396[_0x4041('0x40')]=_0x2eaa65;if(_0x4e2db6['query'][_0x4041('0x41')]){_0x5e9495[_0x4041('0x42')]=[{'all':!![]}];}return db[_0x4041('0x30')]['findAll'](_0x5e9495);})[_0x4041('0x28')](function(_0x3ee197){_0x4af396[_0x4041('0x43')]=_0x3ee197;return _0x4af396;})[_0x4041('0x28')](respondWithFilteredResult(_0x52f764,_0x5e9495))[_0x4041('0x44')](handleError(_0x52f764,null));};exports[_0x4041('0x45')]=function(_0x3695f8,_0x43b7a4){var _0x359f09={'raw':!![],'where':{'id':_0x3695f8[_0x4041('0x46')]['id']}},_0x483231={};_0x483231[_0x4041('0x32')]=_[_0x4041('0x47')](db[_0x4041('0x30')][_0x4041('0x48')]);_0x483231[_0x4041('0x33')]=_[_0x4041('0x47')](_0x3695f8[_0x4041('0x33')]);_0x483231[_0x4041('0x34')]=_['intersection'](_0x483231[_0x4041('0x32')],_0x483231[_0x4041('0x33')]);_0x359f09['attributes']=_[_0x4041('0x36')](_0x483231[_0x4041('0x32')],qs[_0x4041('0x37')](_0x3695f8[_0x4041('0x33')]['fields']));_0x359f09[_0x4041('0x35')]=_0x359f09[_0x4041('0x35')]['length']?_0x359f09['attributes']:_0x483231['model'];if(_0x3695f8[_0x4041('0x33')]['includeAll']){_0x359f09[_0x4041('0x42')]=[{'all':!![]}];}_0x359f09=_[_0x4041('0x3d')]({},_0x359f09,_0x3695f8[_0x4041('0x3f')]);return db[_0x4041('0x30')][_0x4041('0x49')](_0x359f09)[_0x4041('0x28')](handleEntityNotFound(_0x43b7a4,null))[_0x4041('0x28')](respondWithResult(_0x43b7a4,null))[_0x4041('0x44')](handleError(_0x43b7a4,null));};exports[_0x4041('0x4a')]=function(_0x387167,_0x49e90f){return db[_0x4041('0x30')][_0x4041('0x4a')](_0x387167[_0x4041('0x4b')],{})['then'](respondWithResult(_0x49e90f,0xc9))[_0x4041('0x44')](handleError(_0x49e90f,null));};exports[_0x4041('0x27')]=function(_0x46eea4,_0x57bfda){if(_0x46eea4[_0x4041('0x4b')]['id']){delete _0x46eea4['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x46eea4[_0x4041('0x46')]['id']}})['then'](handleEntityNotFound(_0x57bfda,null))[_0x4041('0x28')](saveUpdates(_0x46eea4['body'],null))[_0x4041('0x28')](respondWithResult(_0x57bfda,null))[_0x4041('0x44')](handleError(_0x57bfda,null));};exports[_0x4041('0x29')]=function(_0x46fe10,_0x4d1993){return db[_0x4041('0x30')][_0x4041('0x49')]({'where':{'id':_0x46fe10[_0x4041('0x46')]['id']}})[_0x4041('0x28')](handleEntityNotFound(_0x4d1993,null))[_0x4041('0x28')](removeEntity(_0x4d1993,null))[_0x4041('0x44')](handleError(_0x4d1993,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 69231b0..965fc3f 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 _0x96aa=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes'];(function(_0x351d7c,_0x18830c){var _0x3b3ebb=function(_0x879567){while(--_0x879567){_0x351d7c['push'](_0x351d7c['shift']());}};_0x3b3ebb(++_0x18830c);}(_0x96aa,0x67));var _0xa96a=function(_0x565659,_0x19d1d6){_0x565659=_0x565659-0x0;var _0x4b9c6d=_0x96aa[_0x565659];return _0x4b9c6d;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var logger=require('../../config/logger')(_0xa96a('0x2'));var moment=require(_0xa96a('0x3'));var BPromise=require(_0xa96a('0x4'));var rp=require(_0xa96a('0x5'));var fs=require('fs');var path=require(_0xa96a('0x6'));var rimraf=require('rimraf');var config=require(_0xa96a('0x7'));var attributes=require(_0xa96a('0x8'));module['exports']=function(_0x464684,_0x2e9a41){return _0x464684[_0xa96a('0x9')](_0xa96a('0xa'),attributes,{'tableName':_0xa96a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa96a('0xc'),'collate':_0xa96a('0xd')});}; \ No newline at end of file +var _0x5bed=['api','moment','request-promise','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1dd6e7,_0x1cda2b){var _0xb53aa4=function(_0xd2ac7b){while(--_0xd2ac7b){_0x1dd6e7['push'](_0x1dd6e7['shift']());}};_0xb53aa4(++_0x1cda2b);}(_0x5bed,0x1de));var _0xd5be=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5bed[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xd5be('0x0'));var util=require(_0xd5be('0x1'));var logger=require(_0xd5be('0x2'))(_0xd5be('0x3'));var moment=require(_0xd5be('0x4'));var BPromise=require('bluebird');var rp=require(_0xd5be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5be('0x6'));var config=require(_0xd5be('0x7'));var attributes=require(_0xd5be('0x8'));module['exports']=function(_0x29e9a,_0x28430f){return _0x29e9a[_0xd5be('0x9')](_0xd5be('0xa'),attributes,{'tableName':_0xd5be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd5be('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index bbd4198..6b0f67c 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 _0x2d07=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d07,0x13a));var _0x72d0=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0x2d07[_0x8bb4c1];return _0x67a6e1;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var moment=require('moment');var BPromise=require(_0x72d0('0x2'));var rs=require(_0x72d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d0('0x4'))['db'];var utils=require(_0x72d0('0x5'));var logger=require(_0x72d0('0x6'))(_0x72d0('0x7'));var config=require(_0x72d0('0x8'));var jayson=require(_0x72d0('0x9'));var client=jayson['client'][_0x72d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdad2db,_0x2a4100,_0x47a826){return new BPromise(function(_0x4f2c34,_0x6d0ff6){return client['request'](_0xdad2db,_0x47a826)['then'](function(_0x5db523){logger[_0x72d0('0xb')](_0x72d0('0xc'),_0x2a4100,_0x72d0('0xd'));logger[_0x72d0('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2a4100,'request\x20sent',JSON['stringify'](_0x5db523));if(_0x5db523[_0x72d0('0xf')]){if(_0x5db523[_0x72d0('0xf')][_0x72d0('0x10')]===0x1f4){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x5db523['error'][_0x72d0('0x11')]);return _0x6d0ff6(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}logger['error'](_0x72d0('0xc'),_0x2a4100,_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);return _0x4f2c34(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}else{logger[_0x72d0('0xb')]('SmsApplication,\x20%s,\x20%s',_0x2a4100,_0x72d0('0xd'));_0x4f2c34(_0x5db523[_0x72d0('0x12')][_0x72d0('0x11')]);}})[_0x72d0('0x13')](function(_0x2a761c){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x2a761c);_0x6d0ff6(_0x2a761c);});});} \ No newline at end of file +var _0xcb9c=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0x3f4d0f,_0x61fcb8){var _0x116337=function(_0x3a45d0){while(--_0x3a45d0){_0x3f4d0f['push'](_0x3f4d0f['shift']());}};_0x116337(++_0x61fcb8);}(_0xcb9c,0x110));var _0xccb9=function(_0x65c3b5,_0x5ebdb3){_0x65c3b5=_0x65c3b5-0x0;var _0x5a290d=_0xcb9c[_0x65c3b5];return _0x5a290d;};'use strict';var _=require(_0xccb9('0x0'));var util=require(_0xccb9('0x1'));var moment=require(_0xccb9('0x2'));var BPromise=require(_0xccb9('0x3'));var rs=require(_0xccb9('0x4'));var fs=require('fs');var Redis=require(_0xccb9('0x5'));var db=require(_0xccb9('0x6'))['db'];var utils=require(_0xccb9('0x7'));var logger=require('../../config/logger')(_0xccb9('0x8'));var config=require(_0xccb9('0x9'));var jayson=require(_0xccb9('0xa'));var client=jayson['client'][_0xccb9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114fa3,_0x1d807e,_0x54e899){return new BPromise(function(_0x3dfe21,_0x378d39){return client[_0xccb9('0xc')](_0x114fa3,_0x54e899)[_0xccb9('0xd')](function(_0x47889f){logger[_0xccb9('0xe')](_0xccb9('0xf'),_0x1d807e,_0xccb9('0x10'));logger[_0xccb9('0x11')](_0xccb9('0x12'),_0x1d807e,'request\x20sent',JSON[_0xccb9('0x13')](_0x47889f));if(_0x47889f[_0xccb9('0x14')]){if(_0x47889f[_0xccb9('0x14')]['code']===0x1f4){logger[_0xccb9('0x14')](_0xccb9('0xf'),_0x1d807e,_0x47889f[_0xccb9('0x14')][_0xccb9('0x15')]);return _0x378d39(_0x47889f['error'][_0xccb9('0x15')]);}logger[_0xccb9('0x14')](_0xccb9('0xf'),_0x1d807e,_0x47889f[_0xccb9('0x14')][_0xccb9('0x15')]);return _0x3dfe21(_0x47889f[_0xccb9('0x14')][_0xccb9('0x15')]);}else{logger[_0xccb9('0xe')](_0xccb9('0xf'),_0x1d807e,'request\x20sent');_0x3dfe21(_0x47889f[_0xccb9('0x16')][_0xccb9('0x15')]);}})[_0xccb9('0x17')](function(_0x561ca6){logger['error'](_0xccb9('0xf'),_0x1d807e,_0x561ca6);_0x378d39(_0x561ca6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 064e492..bb6f653 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x49f1c1,_0x48224d){var _0x58c060=function(_0x2158c7){while(--_0x2158c7){_0x49f1c1['push'](_0x49f1c1['shift']());}};_0x58c060(++_0x48224d);}(_0x3c81,0x102));var _0x13c8=function(_0xe6ad8,_0x3aff15){_0xe6ad8=_0xe6ad8-0x0;var _0x57f611=_0x3c81[_0xe6ad8];return _0x57f611;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file +var _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x5c00,0x17e));var _0x05c0=function(_0x2dea58,_0x59d6f0){_0x2dea58=_0x2dea58-0x0;var _0x2b23c2=_0x5c00[_0x2dea58];return _0x2b23c2;};'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('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 83e8258..e82974e 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 _0x1ab1=['BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab1,0x12c));var _0x11ab=function(_0xda3831,_0x4076ce){_0xda3831=_0xda3831-0x0;var _0x12b659=_0x1ab1[_0xda3831];return _0x12b659;};'use strict';var Sequelize=require(_0x11ab('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x11ab('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x11ab('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x11ab('0x2')]},'read1stAt':{'type':Sequelize[_0x11ab('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x11ab('0x4')]('in',_0x11ab('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x11ab('0x4')]('in',_0x11ab('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x11ab('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x11ab('0x6')]}}; \ No newline at end of file +var _0x3d3d=['out','BOOLEAN','INTEGER','moment','exports','DATE','STRING','ENUM'];(function(_0x3ee68e,_0x36ce4a){var _0x5dc6f7=function(_0x559210){while(--_0x559210){_0x3ee68e['push'](_0x3ee68e['shift']());}};_0x5dc6f7(++_0x36ce4a);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd3d3('0x0'));module[_0xd3d3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd3d3('0x2')]},'disposition':{'type':Sequelize[_0xd3d3('0x3')]},'secondDisposition':{'type':Sequelize[_0xd3d3('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd3d3('0x3')]},'note':{'type':Sequelize[_0xd3d3('0x3')]},'phone':{'type':Sequelize[_0xd3d3('0x3')]},'read1stAt':{'type':Sequelize[_0xd3d3('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd3d3('0x4')]('in',_0xd3d3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd3d3('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd3d3('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd3d3('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd3d3('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index d7d782d..1411df8 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 _0x8aa2=['User','fullname','CmContact','Contact','firstName','createdAt','direction','Account','Owner','get','N.A.','closed','closedAt','Messages','out','System','lastName','read','renderFile','server','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','getOptions','findAll','query','user','catch','params','model','keys','SmsInteraction','intersection','fields','attributes','length','includeAll','include','merge','create','body','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','Tag','smsInteractionTags:save','removeTags','download','unix','toString','join','root','files','transcript-%d-%s.zip','push'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8aa2,0x8f));var _0x28aa=function(_0x4c5455,_0x344b10){_0x4c5455=_0x4c5455-0x0;var _0x450f60=_0x8aa2[_0x4c5455];return _0x450f60;};'use strict';var rimraf=require(_0x28aa('0x0'));var zipdir=require(_0x28aa('0x1'));var moment=require(_0x28aa('0x2'));var BPromise=require(_0x28aa('0x3'));var util=require(_0x28aa('0x4'));var path=require(_0x28aa('0x5'));var ejs=require(_0x28aa('0x6'));var fs=require('fs');var _=require(_0x28aa('0x7'));var Redis=require(_0x28aa('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x28aa('0x9'));var pdf=require(_0x28aa('0xa'));var logger=require(_0x28aa('0xb'))(_0x28aa('0xc'));var config=require('../../config/environment');var db=require(_0x28aa('0xd'))['db'];config[_0x28aa('0xe')]=_[_0x28aa('0xf')](config[_0x28aa('0xe')],{'host':_0x28aa('0x10'),'port':0x18eb});var socket=require(_0x28aa('0x11'))(new Redis(config[_0x28aa('0xe')]));require(_0x28aa('0x12'))['register'](socket);function respondWithStatusCode(_0x2469f5,_0xe57e86){_0xe57e86=_0xe57e86||0xcc;return function(_0x2466b0){if(_0x2466b0){return _0x2469f5[_0x28aa('0x13')](_0xe57e86);}return _0x2469f5[_0x28aa('0x14')](_0xe57e86)[_0x28aa('0x15')]();};}function respondWithResult(_0x649061,_0x3e2507){_0x3e2507=_0x3e2507||0xc8;return function(_0xac2e6f){if(_0xac2e6f){return _0x649061[_0x28aa('0x14')](_0x3e2507)['json'](_0xac2e6f);}};}function respondWithFilteredResult(_0x5a9756,_0x4df2f6){return function(_0x5325c7){if(_0x5325c7){var _0x32c02f=typeof _0x4df2f6[_0x28aa('0x16')]===_0x28aa('0x17')&&typeof _0x4df2f6['limit']===_0x28aa('0x17');var _0x5a9cb3=_0x5325c7[_0x28aa('0x18')];var _0x45a616=_0x32c02f?0x0:_0x4df2f6[_0x28aa('0x16')];var _0x41530c=_0x32c02f?_0x5325c7[_0x28aa('0x18')]:_0x4df2f6[_0x28aa('0x16')]+_0x4df2f6['limit'];var _0x523b93;if(_0x41530c>=_0x5a9cb3){_0x41530c=_0x5a9cb3;_0x523b93=0xc8;}else{_0x523b93=0xce;}_0x5a9756[_0x28aa('0x14')](_0x523b93);return _0x5a9756[_0x28aa('0x19')](_0x28aa('0x1a'),_0x45a616+'-'+_0x41530c+'/'+_0x5a9cb3)[_0x28aa('0x1b')](_0x5325c7);}return null;};}function saveUpdates(_0x4bb027){return function(_0x1315b7){if(_0x1315b7){return _0x1315b7[_0x28aa('0x1c')](_0x4bb027)[_0x28aa('0x1d')](function(_0x51e0ae){return _0x51e0ae;});}return null;};}function removeEntity(_0x326640){return function(_0xce356){if(_0xce356){return _0xce356[_0x28aa('0x1e')]()['then'](function(){_0x326640[_0x28aa('0x14')](0xcc)[_0x28aa('0x15')]();});}};}function handleEntityNotFound(_0x2d868c){return function(_0x52349c){if(!_0x52349c){_0x2d868c[_0x28aa('0x13')](0x194);}return _0x52349c;};}function handleError(_0x2af592,_0x122cdf){_0x122cdf=_0x122cdf||0x1f4;return function(_0x1108dd){logger[_0x28aa('0x1f')](_0x1108dd['stack']);if(_0x1108dd[_0x28aa('0x20')]){delete _0x1108dd[_0x28aa('0x20')];}_0x2af592[_0x28aa('0x14')](_0x122cdf)[_0x28aa('0x21')](_0x1108dd);};}exports[_0x28aa('0x22')]=function(_0x12643e,_0x1ad699){var _0x2c42ed={};var _0x1d4eab=_[_0x28aa('0x23')](db['SmsInteraction'][_0x28aa('0x24')],function(_0x24c0c7){return{'name':_0x24c0c7[_0x28aa('0x25')],'type':_0x24c0c7['type']['key']};});_0x2c42ed=qs[_0x28aa('0x26')](_0x1d4eab,_0x12643e);return interaction[_0x28aa('0x27')]('sms',_0x12643e[_0x28aa('0x28')],_0x12643e[_0x28aa('0x29')],_0x2c42ed,_0x1d4eab)[_0x28aa('0x1d')](respondWithFilteredResult(_0x1ad699,_0x2c42ed))[_0x28aa('0x2a')](handleError(_0x1ad699,null));};exports['show']=function(_0x2c14b8,_0x29bc98){var _0x3aabf5={'raw':![],'where':{'id':_0x2c14b8[_0x28aa('0x2b')]['id']}},_0x473098={};_0x473098[_0x28aa('0x2c')]=_[_0x28aa('0x2d')](db[_0x28aa('0x2e')][_0x28aa('0x24')]);_0x473098[_0x28aa('0x28')]=_[_0x28aa('0x2d')](_0x2c14b8[_0x28aa('0x28')]);_0x473098['filters']=_[_0x28aa('0x2f')](_0x473098[_0x28aa('0x2c')],_0x473098[_0x28aa('0x28')]);_0x3aabf5['attributes']=_[_0x28aa('0x2f')](_0x473098['model'],qs[_0x28aa('0x30')](_0x2c14b8['query'][_0x28aa('0x30')]));_0x3aabf5[_0x28aa('0x31')]=_0x3aabf5[_0x28aa('0x31')][_0x28aa('0x32')]?_0x3aabf5[_0x28aa('0x31')]:_0x473098['model'];if(_0x2c14b8[_0x28aa('0x28')][_0x28aa('0x33')]){_0x3aabf5[_0x28aa('0x34')]=[{'all':!![]}];}_0x3aabf5=_[_0x28aa('0x35')]({},_0x3aabf5,_0x2c14b8['options']);return db[_0x28aa('0x2e')]['find'](_0x3aabf5)['then'](handleEntityNotFound(_0x29bc98,null))[_0x28aa('0x1d')](respondWithResult(_0x29bc98,null))['catch'](handleError(_0x29bc98,null));};exports[_0x28aa('0x36')]=function(_0x34d391,_0x5f558a){return db[_0x28aa('0x2e')]['create'](_0x34d391[_0x28aa('0x37')],{})['then'](respondWithResult(_0x5f558a,0xc9))[_0x28aa('0x2a')](handleError(_0x5f558a,null));};exports['update']=function(_0x2d294b,_0x95e05f){if(_0x2d294b['body']['id']){delete _0x2d294b['body']['id'];}return db[_0x28aa('0x2e')]['find']({'where':{'id':_0x2d294b[_0x28aa('0x2b')]['id']}})['then'](handleEntityNotFound(_0x95e05f,null))[_0x28aa('0x1d')](saveUpdates(_0x2d294b[_0x28aa('0x37')],null))['then'](respondWithResult(_0x95e05f,null))[_0x28aa('0x2a')](handleError(_0x95e05f,null));};exports[_0x28aa('0x1e')]=function(_0x472bbb,_0x6ab7cc){return db[_0x28aa('0x2e')][_0x28aa('0x38')]({'where':{'id':_0x472bbb[_0x28aa('0x2b')]['id']}})['then'](handleEntityNotFound(_0x6ab7cc,null))[_0x28aa('0x1d')](removeEntity(_0x6ab7cc,null))[_0x28aa('0x2a')](handleError(_0x6ab7cc,null));};exports[_0x28aa('0x39')]=function(_0x1078d9,_0x48b18f){return db[_0x28aa('0x2e')][_0x28aa('0x39')]()['then'](respondWithResult(_0x48b18f,null))[_0x28aa('0x2a')](handleError(_0x48b18f,null));};exports[_0x28aa('0x3a')]=function(_0x44f8f4,_0x3200ac){return db[_0x28aa('0x3b')][_0x28aa('0x38')]({'where':{'id':_0x44f8f4[_0x28aa('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3200ac,null))[_0x28aa('0x1d')](function(_0x1402c0){if(_0x1402c0){return _0x1402c0[_0x28aa('0x3a')](_0x44f8f4[_0x28aa('0x37')][_0x28aa('0x3c')],_[_0x28aa('0x3d')](_0x44f8f4[_0x28aa('0x37')],[_0x28aa('0x3c'),'id'])||{});}})[_0x28aa('0x1d')](respondWithResult(_0x3200ac,null))['catch'](handleError(_0x3200ac,null));};exports[_0x28aa('0x3e')]=function(_0x22ce17,_0x3ca72f){var _0x5cce65={'raw':![],'where':{}};var _0x1c3fb1={};var _0x28f49e={'count':0x0,'rows':[]};return db[_0x28aa('0x2e')][_0x28aa('0x3f')]({'where':{'id':_0x22ce17[_0x28aa('0x2b')]['id']}})[_0x28aa('0x1d')](handleEntityNotFound(_0x3ca72f,null))[_0x28aa('0x1d')](function(_0x7336ea){if(_0x7336ea){_0x1c3fb1['model']=_[_0x28aa('0x2d')](db[_0x28aa('0x3b')][_0x28aa('0x24')]);_0x1c3fb1[_0x28aa('0x28')]=_[_0x28aa('0x2d')](_0x22ce17['query']);_0x1c3fb1['filters']=_[_0x28aa('0x2f')](_0x1c3fb1['model'],_0x1c3fb1[_0x28aa('0x28')]);_0x5cce65[_0x28aa('0x31')]=_['intersection'](_0x1c3fb1[_0x28aa('0x2c')],qs[_0x28aa('0x30')](_0x22ce17['query'][_0x28aa('0x30')]));_0x5cce65['attributes']=_0x5cce65[_0x28aa('0x31')][_0x28aa('0x32')]?_0x5cce65[_0x28aa('0x31')]:_0x1c3fb1[_0x28aa('0x2c')];if(!_0x22ce17['query'][_0x28aa('0x40')](_0x28aa('0x41'))){_0x5cce65[_0x28aa('0x42')]=qs[_0x28aa('0x42')](_0x22ce17[_0x28aa('0x28')][_0x28aa('0x42')]);_0x5cce65[_0x28aa('0x16')]=qs[_0x28aa('0x16')](_0x22ce17[_0x28aa('0x28')][_0x28aa('0x16')]);}_0x5cce65[_0x28aa('0x43')]=qs['sort'](_0x22ce17[_0x28aa('0x28')][_0x28aa('0x44')]);_0x5cce65['where']=qs[_0x28aa('0x45')](_[_0x28aa('0x46')](_0x22ce17['query'],_0x1c3fb1[_0x28aa('0x45')]));_0x5cce65[_0x28aa('0x47')][_0x28aa('0x48')]=_0x7336ea['id'];if(_0x22ce17[_0x28aa('0x28')][_0x28aa('0x49')]){_0x5cce65[_0x28aa('0x47')]=_[_0x28aa('0x35')](_0x5cce65[_0x28aa('0x47')],{'$or':_['map'](_0x5cce65[_0x28aa('0x31')],function(_0xe382ed){var _0x3a187f={};_0x3a187f[_0xe382ed]={'$like':'%'+_0x22ce17[_0x28aa('0x28')]['filter']+'%'};return _0x3a187f;})});}if(_0x22ce17[_0x28aa('0x28')][_0x28aa('0x4a')]){var _0x1cbeff=_0x22ce17[_0x28aa('0x28')][_0x28aa('0x4a')][_0x28aa('0x4b')](',');var _0xa69ee7={};_0xa69ee7[_0x1cbeff[0x0]]={'$gte':moment(_0x1cbeff[0x1])[_0x28aa('0x4c')](_0x28aa('0x4d'))};_0x5cce65[_0x28aa('0x47')]=_[_0x28aa('0x35')](_0x5cce65[_0x28aa('0x47')],_0xa69ee7);}_0x5cce65=_[_0x28aa('0x35')]({},_0x5cce65,_0x22ce17['options']);return db[_0x28aa('0x3b')][_0x28aa('0x18')]({'where':_0x5cce65['where']})[_0x28aa('0x1d')](function(_0x2cb699){_0x28f49e[_0x28aa('0x18')]=_0x2cb699;if(_0x22ce17[_0x28aa('0x28')][_0x28aa('0x33')]){_0x5cce65[_0x28aa('0x34')]=[{'all':!![]}];}return db[_0x28aa('0x3b')][_0x28aa('0x27')](_0x5cce65);})[_0x28aa('0x1d')](function(_0x1b81d7){_0x28f49e['rows']=_0x1b81d7;return _0x28f49e;});}})[_0x28aa('0x1d')](respondWithFilteredResult(_0x3ca72f,_0x5cce65))[_0x28aa('0x2a')](handleError(_0x3ca72f,null));};exports[_0x28aa('0x4e')]=function(_0x3f7c9a,_0x3f6302){return db['SmsInteraction'][_0x28aa('0x38')]({'where':{'id':_0x3f7c9a[_0x28aa('0x2b')]['id']}})[_0x28aa('0x1d')](handleEntityNotFound(_0x3f6302,null))[_0x28aa('0x1d')](function(_0x4c30f6){if(_0x4c30f6){return _0x4c30f6['setTags'](_0x3f7c9a[_0x28aa('0x37')][_0x28aa('0x3c')],_['omit'](_0x3f7c9a[_0x28aa('0x37')],['ids','id'])||{})[_0x28aa('0x4f')](function(){return db[_0x28aa('0x50')][_0x28aa('0x27')]({'attributes':['id',_0x28aa('0x20'),'color'],'where':{'id':_0x3f7c9a[_0x28aa('0x37')][_0x28aa('0x3c')]}});})['then'](function(_0x2b30c3){socket['emit'](_0x28aa('0x51'),{'id':Number(_0x3f7c9a[_0x28aa('0x2b')]['id']),'tags':_0x2b30c3||[]});return{'id':Number(_0x3f7c9a['params']['id']),'tags':_0x2b30c3||[]};});}})[_0x28aa('0x1d')](respondWithResult(_0x3f6302,null))[_0x28aa('0x2a')](handleError(_0x3f6302,null));};exports[_0x28aa('0x52')]=function(_0x134e19,_0x21b170){return db['SmsInteraction'][_0x28aa('0x38')]({'where':{'id':_0x134e19[_0x28aa('0x2b')]['id']}})['then'](handleEntityNotFound(_0x21b170,null))[_0x28aa('0x1d')](function(_0x36c305){if(_0x36c305){return _0x36c305[_0x28aa('0x52')](_0x134e19['query']['ids']);}})[_0x28aa('0x1d')](respondWithStatusCode(_0x21b170,null))[_0x28aa('0x2a')](handleError(_0x21b170,null));};exports[_0x28aa('0x53')]=function(_0x485beb,_0xa70199){var _0x19d09c=moment()[_0x28aa('0x54')]()[_0x28aa('0x55')]();var _0x2375e3=path[_0x28aa('0x56')](config[_0x28aa('0x57')],'server',_0x28aa('0x58'),'tmp');var _0x5e7fd2=path['join'](_0x2375e3,_0x19d09c);var _0x49a283=util['format'](_0x28aa('0x59'),_0x485beb['params']['id'],_0x19d09c);var _0x3f7eba=path[_0x28aa('0x56')](_0x2375e3,_0x49a283);var _0x340f2f=[];_0x340f2f[_0x28aa('0x5a')]({'model':db['User'],'as':_0x28aa('0x5b'),'attributes':['id',_0x28aa('0x5c')],'raw':!![]});_0x340f2f[_0x28aa('0x5a')]({'model':db[_0x28aa('0x5d')],'as':_0x28aa('0x5e'),'attributes':['id',_0x28aa('0x5f'),'lastName'],'raw':!![]});var _0x5924de=[{'model':db[_0x28aa('0x3b')],'as':'Messages','attributes':['id','body',_0x28aa('0x60'),_0x28aa('0x61'),'secret','read'],'include':_0x340f2f}];_0x5924de[_0x28aa('0x5a')]({'model':db['SmsAccount'],'as':_0x28aa('0x62'),'attributes':['id',_0x28aa('0x20')]});_0x5924de[_0x28aa('0x5a')]({'model':db['User'],'as':_0x28aa('0x63'),'attributes':['id','fullname']});return db[_0x28aa('0x2e')][_0x28aa('0x38')]({'where':{'id':_0x485beb[_0x28aa('0x2b')]['id']},'include':_0x5924de})[_0x28aa('0x1d')](handleEntityNotFound(_0xa70199,null))[_0x28aa('0x1d')](function(_0x5e7aae){if(_0x5e7aae){var _0x397818=_0x5e7aae[_0x28aa('0x64')]({'plain':!![]});fs['mkdirSync'](_0x5e7fd2);var _0x16d1d9={'channel':'Sms','account':_0x397818[_0x28aa('0x62')][_0x28aa('0x20')],'agent':_0x397818[_0x28aa('0x63')]?_0x397818[_0x28aa('0x63')][_0x28aa('0x5c')]:_0x28aa('0x65'),'createdAt':moment(_0x397818[_0x28aa('0x60')])[_0x28aa('0x4c')](_0x28aa('0x4d'))[_0x28aa('0x55')](),'closedAt':_0x397818[_0x28aa('0x66')]?moment(_0x397818[_0x28aa('0x67')])[_0x28aa('0x4c')](_0x28aa('0x4d'))[_0x28aa('0x55')]():'','disposition':_0x397818['disposition'],'messages':_(_0x397818[_0x28aa('0x68')])[_0x28aa('0x49')]({'secret':![]})['map'](function(_0xea4606){return{'date':moment(_0xea4606[_0x28aa('0x60')])[_0x28aa('0x4c')](_0x28aa('0x4d'))[_0x28aa('0x55')](),'sender':_0xea4606['direction']===_0x28aa('0x69')?_0xea4606['User']?_0xea4606['User'][_0x28aa('0x5c')]:_0x28aa('0x6a'):_0xea4606[_0x28aa('0x5e')][_0x28aa('0x5f')]+(_0xea4606[_0x28aa('0x5e')][_0x28aa('0x6b')]?'\x20'+_0xea4606[_0x28aa('0x5e')][_0x28aa('0x6b')]:''),'body':_0xea4606[_0x28aa('0x37')],'direction':_0xea4606[_0x28aa('0x61')]===_0x28aa('0x69')?'A':'C','secret':_0xea4606['secret'],'read':_0xea4606[_0x28aa('0x6c')]};})['value']()};return ejs[_0x28aa('0x6d')](path[_0x28aa('0x56')](config['root'],_0x28aa('0x6e'),'views',_0x28aa('0x6f')),{'interaction':_0x16d1d9})[_0x28aa('0x1d')](function(_0x22479b){var _0x33ea7a=path[_0x28aa('0x56')](_0x5e7fd2,_0x28aa('0x70')+_0x397818['id']+'-'+_0x19d09c+'.pdf');var _0x4154e1={'path':_0x33ea7a,'channel':_0x28aa('0x71'),'interactionId':_0x397818['id']};return pdf[_0x28aa('0x72')](_0x22479b,_0x4154e1);})['then'](function(){return new BPromise(function(_0x11cfb8,_0x56659c){zipdir(_0x5e7fd2,{'saveTo':_0x3f7eba},function(_0x1e0568,_0x4d9995){if(_0x1e0568)return _0x56659c(_0x1e0568);return _0x11cfb8(_0x4d9995);});})[_0x28aa('0x1d')](function(){return new BPromise(function(_0x4ba304,_0x2a1dee){rimraf(_0x5e7fd2,function(_0x760216){if(_0x760216)_0x2a1dee(_0x760216);return _0x4ba304();});});})[_0x28aa('0x1d')](function(){return _0xa70199[_0x28aa('0x53')](_0x3f7eba,_0x49a283,function(_0x343120){if(_0x343120){console[_0x28aa('0x73')]('err',_0x343120);}else{fs[_0x28aa('0x74')](_0x3f7eba);}});});});}else{return _0xa70199[_0x28aa('0x13')](0xc8);}})[_0x28aa('0x2a')](handleError(_0xa70199,null));}; \ No newline at end of file +var _0x72a6=['./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','sms','query','user','params','keys','intersection','model','attributes','fields','length','includeAll','merge','options','create','body','catch','destroy','find','describe','addMessage','ids','findOne','SmsMessage','filters','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','omit','spread','emit','removeTags','unix','toString','join','root','server','tmp','transcript-%d-%s.zip','push','CmContact','Contact','Messages','createdAt','direction','secret','read','SmsAccount','Account','User','Owner','fullname','get','mkdirSync','Sms','closed','disposition','out','System','firstName','lastName','value','views','transcript-','download','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x2bd7e6,_0x50e4c8){var _0x1f1e8c=function(_0x2e3d38){while(--_0x2e3d38){_0x2bd7e6['push'](_0x2bd7e6['shift']());}};_0x1f1e8c(++_0x50e4c8);}(_0x72a6,0x68));var _0x672a=function(_0x45944e,_0xf372a8){_0x45944e=_0x45944e-0x0;var _0x100b7f=_0x72a6[_0x45944e];return _0x100b7f;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x672a('0x0'));var moment=require(_0x672a('0x1'));var BPromise=require(_0x672a('0x2'));var util=require(_0x672a('0x3'));var path=require(_0x672a('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x672a('0x5'));var Redis=require(_0x672a('0x6'));var interaction=require(_0x672a('0x7'));var qs=require(_0x672a('0x8'));var pdf=require(_0x672a('0x9'));var logger=require(_0x672a('0xa'))(_0x672a('0xb'));var config=require(_0x672a('0xc'));var db=require(_0x672a('0xd'))['db'];config[_0x672a('0xe')]=_[_0x672a('0xf')](config[_0x672a('0xe')],{'host':_0x672a('0x10'),'port':0x18eb});var socket=require(_0x672a('0x11'))(new Redis(config[_0x672a('0xe')]));require(_0x672a('0x12'))[_0x672a('0x13')](socket);function respondWithStatusCode(_0x32ee8a,_0x1ea4bf){_0x1ea4bf=_0x1ea4bf||0xcc;return function(_0x6f9bae){if(_0x6f9bae){return _0x32ee8a[_0x672a('0x14')](_0x1ea4bf);}return _0x32ee8a[_0x672a('0x15')](_0x1ea4bf)[_0x672a('0x16')]();};}function respondWithResult(_0x20c0ac,_0x52ca21){_0x52ca21=_0x52ca21||0xc8;return function(_0x53f272){if(_0x53f272){return _0x20c0ac[_0x672a('0x15')](_0x52ca21)[_0x672a('0x17')](_0x53f272);}};}function respondWithFilteredResult(_0x3f6fbf,_0x5dded4){return function(_0x4c8200){if(_0x4c8200){var _0x3924ec=typeof _0x5dded4['offset']===_0x672a('0x18')&&typeof _0x5dded4[_0x672a('0x19')]===_0x672a('0x18');var _0x3845c1=_0x4c8200[_0x672a('0x1a')];var _0x350acb=_0x3924ec?0x0:_0x5dded4['offset'];var _0x2884de=_0x3924ec?_0x4c8200['count']:_0x5dded4[_0x672a('0x1b')]+_0x5dded4['limit'];var _0x54430e;if(_0x2884de>=_0x3845c1){_0x2884de=_0x3845c1;_0x54430e=0xc8;}else{_0x54430e=0xce;}_0x3f6fbf[_0x672a('0x15')](_0x54430e);return _0x3f6fbf[_0x672a('0x1c')]('Content-Range',_0x350acb+'-'+_0x2884de+'/'+_0x3845c1)[_0x672a('0x17')](_0x4c8200);}return null;};}function saveUpdates(_0x315710){return function(_0x2ccc49){if(_0x2ccc49){return _0x2ccc49[_0x672a('0x1d')](_0x315710)[_0x672a('0x1e')](function(_0x136ab0){return _0x136ab0;});}return null;};}function removeEntity(_0x109dba){return function(_0x7e2093){if(_0x7e2093){return _0x7e2093['destroy']()['then'](function(){_0x109dba[_0x672a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a93b2){return function(_0x101ff8){if(!_0x101ff8){_0x2a93b2['sendStatus'](0x194);}return _0x101ff8;};}function handleError(_0x6bd535,_0x32e551){_0x32e551=_0x32e551||0x1f4;return function(_0x3735c3){logger[_0x672a('0x1f')](_0x3735c3[_0x672a('0x20')]);if(_0x3735c3[_0x672a('0x21')]){delete _0x3735c3[_0x672a('0x21')];}_0x6bd535[_0x672a('0x15')](_0x32e551)[_0x672a('0x22')](_0x3735c3);};}exports[_0x672a('0x23')]=function(_0x2fcdc1,_0x52ce04){var _0x2505cc={};var _0x2e158c=_[_0x672a('0x24')](db[_0x672a('0x25')][_0x672a('0x26')],function(_0x518373){return{'name':_0x518373[_0x672a('0x27')],'type':_0x518373[_0x672a('0x28')][_0x672a('0x29')]};});_0x2505cc=qs[_0x672a('0x2a')](_0x2e158c,_0x2fcdc1);return interaction['findAll'](_0x672a('0x2b'),_0x2fcdc1[_0x672a('0x2c')],_0x2fcdc1[_0x672a('0x2d')],_0x2505cc,_0x2e158c)[_0x672a('0x1e')](respondWithFilteredResult(_0x52ce04,_0x2505cc))['catch'](handleError(_0x52ce04,null));};exports['show']=function(_0x283b5a,_0xf0d277){var _0x384f76={'raw':![],'where':{'id':_0x283b5a[_0x672a('0x2e')]['id']}},_0xdeb826={};_0xdeb826['model']=_[_0x672a('0x2f')](db[_0x672a('0x25')][_0x672a('0x26')]);_0xdeb826[_0x672a('0x2c')]=_[_0x672a('0x2f')](_0x283b5a[_0x672a('0x2c')]);_0xdeb826['filters']=_[_0x672a('0x30')](_0xdeb826[_0x672a('0x31')],_0xdeb826[_0x672a('0x2c')]);_0x384f76[_0x672a('0x32')]=_['intersection'](_0xdeb826[_0x672a('0x31')],qs[_0x672a('0x33')](_0x283b5a[_0x672a('0x2c')][_0x672a('0x33')]));_0x384f76[_0x672a('0x32')]=_0x384f76[_0x672a('0x32')][_0x672a('0x34')]?_0x384f76[_0x672a('0x32')]:_0xdeb826[_0x672a('0x31')];if(_0x283b5a[_0x672a('0x2c')][_0x672a('0x35')]){_0x384f76['include']=[{'all':!![]}];}_0x384f76=_[_0x672a('0x36')]({},_0x384f76,_0x283b5a[_0x672a('0x37')]);return db[_0x672a('0x25')]['find'](_0x384f76)['then'](handleEntityNotFound(_0xf0d277,null))[_0x672a('0x1e')](respondWithResult(_0xf0d277,null))['catch'](handleError(_0xf0d277,null));};exports[_0x672a('0x38')]=function(_0x2c891e,_0x2c1fc0){return db[_0x672a('0x25')][_0x672a('0x38')](_0x2c891e[_0x672a('0x39')],{})[_0x672a('0x1e')](respondWithResult(_0x2c1fc0,0xc9))[_0x672a('0x3a')](handleError(_0x2c1fc0,null));};exports[_0x672a('0x1d')]=function(_0x3039bc,_0xdb25aa){if(_0x3039bc[_0x672a('0x39')]['id']){delete _0x3039bc[_0x672a('0x39')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x3039bc[_0x672a('0x2e')]['id']}})['then'](handleEntityNotFound(_0xdb25aa,null))[_0x672a('0x1e')](saveUpdates(_0x3039bc['body'],null))[_0x672a('0x1e')](respondWithResult(_0xdb25aa,null))[_0x672a('0x3a')](handleError(_0xdb25aa,null));};exports[_0x672a('0x3b')]=function(_0x4a3a99,_0x972dea){return db['SmsInteraction'][_0x672a('0x3c')]({'where':{'id':_0x4a3a99[_0x672a('0x2e')]['id']}})[_0x672a('0x1e')](handleEntityNotFound(_0x972dea,null))[_0x672a('0x1e')](removeEntity(_0x972dea,null))[_0x672a('0x3a')](handleError(_0x972dea,null));};exports[_0x672a('0x3d')]=function(_0x12611f,_0x219354){return db[_0x672a('0x25')]['describe']()[_0x672a('0x1e')](respondWithResult(_0x219354,null))[_0x672a('0x3a')](handleError(_0x219354,null));};exports[_0x672a('0x3e')]=function(_0x2c8ea3,_0xfdb400){return db['SmsMessage'][_0x672a('0x3c')]({'where':{'id':_0x2c8ea3[_0x672a('0x2e')]['id']}})[_0x672a('0x1e')](handleEntityNotFound(_0xfdb400,null))[_0x672a('0x1e')](function(_0x45d2b9){if(_0x45d2b9){return _0x45d2b9['addMessage'](_0x2c8ea3[_0x672a('0x39')][_0x672a('0x3f')],_['omit'](_0x2c8ea3['body'],[_0x672a('0x3f'),'id'])||{});}})[_0x672a('0x1e')](respondWithResult(_0xfdb400,null))[_0x672a('0x3a')](handleError(_0xfdb400,null));};exports['getMessages']=function(_0x2d5a24,_0x5332ca){var _0x2bb26e={'raw':![],'where':{}};var _0x211dab={};var _0x462792={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x672a('0x40')]({'where':{'id':_0x2d5a24['params']['id']}})[_0x672a('0x1e')](handleEntityNotFound(_0x5332ca,null))[_0x672a('0x1e')](function(_0x192d3d){if(_0x192d3d){_0x211dab[_0x672a('0x31')]=_[_0x672a('0x2f')](db[_0x672a('0x41')][_0x672a('0x26')]);_0x211dab['query']=_[_0x672a('0x2f')](_0x2d5a24[_0x672a('0x2c')]);_0x211dab[_0x672a('0x42')]=_[_0x672a('0x30')](_0x211dab['model'],_0x211dab['query']);_0x2bb26e[_0x672a('0x32')]=_[_0x672a('0x30')](_0x211dab[_0x672a('0x31')],qs['fields'](_0x2d5a24[_0x672a('0x2c')][_0x672a('0x33')]));_0x2bb26e[_0x672a('0x32')]=_0x2bb26e['attributes']['length']?_0x2bb26e[_0x672a('0x32')]:_0x211dab[_0x672a('0x31')];if(!_0x2d5a24[_0x672a('0x2c')]['hasOwnProperty'](_0x672a('0x43'))){_0x2bb26e[_0x672a('0x19')]=qs[_0x672a('0x19')](_0x2d5a24[_0x672a('0x2c')]['limit']);_0x2bb26e['offset']=qs['offset'](_0x2d5a24[_0x672a('0x2c')][_0x672a('0x1b')]);}_0x2bb26e[_0x672a('0x44')]=qs['sort'](_0x2d5a24[_0x672a('0x2c')][_0x672a('0x45')]);_0x2bb26e[_0x672a('0x46')]=qs['filters'](_[_0x672a('0x47')](_0x2d5a24[_0x672a('0x2c')],_0x211dab[_0x672a('0x42')]));_0x2bb26e[_0x672a('0x46')]['SmsInteractionId']=_0x192d3d['id'];if(_0x2d5a24[_0x672a('0x2c')][_0x672a('0x48')]){_0x2bb26e[_0x672a('0x46')]=_[_0x672a('0x36')](_0x2bb26e[_0x672a('0x46')],{'$or':_[_0x672a('0x24')](_0x2bb26e[_0x672a('0x32')],function(_0x1303f3){var _0x2b5a94={};_0x2b5a94[_0x1303f3]={'$like':'%'+_0x2d5a24[_0x672a('0x2c')][_0x672a('0x48')]+'%'};return _0x2b5a94;})});}if(_0x2d5a24[_0x672a('0x2c')][_0x672a('0x49')]){var _0x5e51d7=_0x2d5a24[_0x672a('0x2c')][_0x672a('0x49')][_0x672a('0x4a')](',');var _0x15e871={};_0x15e871[_0x5e51d7[0x0]]={'$gte':moment(_0x5e51d7[0x1])[_0x672a('0x4b')](_0x672a('0x4c'))};_0x2bb26e[_0x672a('0x46')]=_['merge'](_0x2bb26e[_0x672a('0x46')],_0x15e871);}_0x2bb26e=_[_0x672a('0x36')]({},_0x2bb26e,_0x2d5a24[_0x672a('0x37')]);return db[_0x672a('0x41')][_0x672a('0x1a')]({'where':_0x2bb26e[_0x672a('0x46')]})[_0x672a('0x1e')](function(_0x2225c9){_0x462792['count']=_0x2225c9;if(_0x2d5a24[_0x672a('0x2c')][_0x672a('0x35')]){_0x2bb26e[_0x672a('0x4d')]=[{'all':!![]}];}return db[_0x672a('0x41')][_0x672a('0x4e')](_0x2bb26e);})['then'](function(_0x3ef897){_0x462792[_0x672a('0x4f')]=_0x3ef897;return _0x462792;});}})[_0x672a('0x1e')](respondWithFilteredResult(_0x5332ca,_0x2bb26e))[_0x672a('0x3a')](handleError(_0x5332ca,null));};exports[_0x672a('0x50')]=function(_0x3f9e67,_0x1b625d){return db[_0x672a('0x25')][_0x672a('0x3c')]({'where':{'id':_0x3f9e67[_0x672a('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1b625d,null))['then'](function(_0x3176e4){if(_0x3176e4){return _0x3176e4[_0x672a('0x51')](_0x3f9e67['body'][_0x672a('0x3f')],_[_0x672a('0x52')](_0x3f9e67[_0x672a('0x39')],[_0x672a('0x3f'),'id'])||{})[_0x672a('0x53')](function(){return db['Tag'][_0x672a('0x4e')]({'attributes':['id',_0x672a('0x21'),'color'],'where':{'id':_0x3f9e67[_0x672a('0x39')][_0x672a('0x3f')]}});})[_0x672a('0x1e')](function(_0x3dcdee){socket[_0x672a('0x54')]('smsInteractionTags:save',{'id':Number(_0x3f9e67['params']['id']),'tags':_0x3dcdee||[]});return{'id':Number(_0x3f9e67['params']['id']),'tags':_0x3dcdee||[]};});}})['then'](respondWithResult(_0x1b625d,null))['catch'](handleError(_0x1b625d,null));};exports[_0x672a('0x55')]=function(_0x515611,_0x5892af){return db[_0x672a('0x25')]['find']({'where':{'id':_0x515611[_0x672a('0x2e')]['id']}})[_0x672a('0x1e')](handleEntityNotFound(_0x5892af,null))['then'](function(_0x262ac3){if(_0x262ac3){return _0x262ac3[_0x672a('0x55')](_0x515611['query'][_0x672a('0x3f')]);}})[_0x672a('0x1e')](respondWithStatusCode(_0x5892af,null))[_0x672a('0x3a')](handleError(_0x5892af,null));};exports['download']=function(_0xfdc1c7,_0x4ebb7c){var _0x2b07d2=moment()[_0x672a('0x56')]()[_0x672a('0x57')]();var _0x2cdeaf=path[_0x672a('0x58')](config[_0x672a('0x59')],_0x672a('0x5a'),'files',_0x672a('0x5b'));var _0x270771=path[_0x672a('0x58')](_0x2cdeaf,_0x2b07d2);var _0x308279=util['format'](_0x672a('0x5c'),_0xfdc1c7[_0x672a('0x2e')]['id'],_0x2b07d2);var _0x53fc2e=path['join'](_0x2cdeaf,_0x308279);var _0x26d186=[];_0x26d186[_0x672a('0x5d')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x26d186[_0x672a('0x5d')]({'model':db[_0x672a('0x5e')],'as':_0x672a('0x5f'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x58fc75=[{'model':db[_0x672a('0x41')],'as':_0x672a('0x60'),'attributes':['id',_0x672a('0x39'),_0x672a('0x61'),_0x672a('0x62'),_0x672a('0x63'),_0x672a('0x64')],'include':_0x26d186}];_0x58fc75[_0x672a('0x5d')]({'model':db[_0x672a('0x65')],'as':_0x672a('0x66'),'attributes':['id',_0x672a('0x21')]});_0x58fc75[_0x672a('0x5d')]({'model':db[_0x672a('0x67')],'as':_0x672a('0x68'),'attributes':['id',_0x672a('0x69')]});return db[_0x672a('0x25')]['find']({'where':{'id':_0xfdc1c7[_0x672a('0x2e')]['id']},'include':_0x58fc75})[_0x672a('0x1e')](handleEntityNotFound(_0x4ebb7c,null))['then'](function(_0x3707fa){if(_0x3707fa){var _0x14bcd1=_0x3707fa[_0x672a('0x6a')]({'plain':!![]});fs[_0x672a('0x6b')](_0x270771);var _0x538c09={'channel':_0x672a('0x6c'),'account':_0x14bcd1[_0x672a('0x66')][_0x672a('0x21')],'agent':_0x14bcd1['Owner']?_0x14bcd1['Owner']['fullname']:'N.A.','createdAt':moment(_0x14bcd1[_0x672a('0x61')])['format'](_0x672a('0x4c'))[_0x672a('0x57')](),'closedAt':_0x14bcd1[_0x672a('0x6d')]?moment(_0x14bcd1['closedAt'])['format'](_0x672a('0x4c'))['toString']():'','disposition':_0x14bcd1[_0x672a('0x6e')],'messages':_(_0x14bcd1[_0x672a('0x60')])[_0x672a('0x48')]({'secret':![]})[_0x672a('0x24')](function(_0x25bf92){return{'date':moment(_0x25bf92[_0x672a('0x61')])[_0x672a('0x4b')](_0x672a('0x4c'))[_0x672a('0x57')](),'sender':_0x25bf92['direction']===_0x672a('0x6f')?_0x25bf92[_0x672a('0x67')]?_0x25bf92[_0x672a('0x67')][_0x672a('0x69')]:_0x672a('0x70'):_0x25bf92[_0x672a('0x5f')][_0x672a('0x71')]+(_0x25bf92[_0x672a('0x5f')]['lastName']?'\x20'+_0x25bf92[_0x672a('0x5f')][_0x672a('0x72')]:''),'body':_0x25bf92['body'],'direction':_0x25bf92[_0x672a('0x62')]===_0x672a('0x6f')?'A':'C','secret':_0x25bf92['secret'],'read':_0x25bf92[_0x672a('0x64')]};})[_0x672a('0x73')]()};return ejs['renderFile'](path['join'](config[_0x672a('0x59')],_0x672a('0x5a'),_0x672a('0x74'),'downloadInteraction.ejs'),{'interaction':_0x538c09})[_0x672a('0x1e')](function(_0x3acb75){var _0x426f38=path[_0x672a('0x58')](_0x270771,_0x672a('0x75')+_0x14bcd1['id']+'-'+_0x2b07d2+'.pdf');var _0x388d18={'path':_0x426f38,'channel':_0x672a('0x6c'),'interactionId':_0x14bcd1['id']};return pdf['createPdfFromHTML'](_0x3acb75,_0x388d18);})[_0x672a('0x1e')](function(){return new BPromise(function(_0x51bd58,_0x4b4443){zipdir(_0x270771,{'saveTo':_0x53fc2e},function(_0x4f3073,_0x4e1ed1){if(_0x4f3073)return _0x4b4443(_0x4f3073);return _0x51bd58(_0x4e1ed1);});})[_0x672a('0x1e')](function(){return new BPromise(function(_0x55730a,_0x1d2221){rimraf(_0x270771,function(_0x21f62c){if(_0x21f62c)_0x1d2221(_0x21f62c);return _0x55730a();});});})[_0x672a('0x1e')](function(){return _0x4ebb7c[_0x672a('0x76')](_0x53fc2e,_0x308279,function(_0x4f91df){if(_0x4f91df){console[_0x672a('0x77')](_0x672a('0x78'),_0x4f91df);}else{fs[_0x672a('0x79')](_0x53fc2e);}});});});}else{return _0x4ebb7c[_0x672a('0x14')](0xc8);}})['catch'](handleError(_0x4ebb7c,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 68206de..1aca6ba 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(_0x4d6298,_0x502f6b){var _0x57ccf0=function(_0x3cef94){while(--_0x3cef94){_0x4d6298['push'](_0x4d6298['shift']());}};_0x57ccf0(++_0x502f6b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'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 _0xb016=['setDataValue','Users','findAll','then','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save','update','remove','getUsers'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xb016,0x159));var _0x6b01=function(_0x33c79b,_0x154adf){_0x33c79b=_0x33c79b-0x0;var _0x29db14=_0xb016[_0x33c79b];return _0x29db14;};'use strict';var EventEmitter=require(_0x6b01('0x0'));var SmsInteraction=require(_0x6b01('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x6b01('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b01('0x3'),'afterUpdate':_0x6b01('0x4'),'afterDestroy':_0x6b01('0x5')};function emitEvent(_0x3b9de1){return function(_0x5964ca,_0x1b7dd6,_0x65407a){_0x5964ca[_0x6b01('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c5bfb){_0x5964ca[_0x6b01('0x7')](_0x6b01('0x8'),_0x5c5bfb['map'](function(_0x5f4636){return{'id':_0x5f4636['id']};}));return SmsMessage[_0x6b01('0x9')]({'where':{'SmsInteractionId':_0x5964ca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b01('0xa')](function(_0x2c4e48){_0x5964ca[_0x6b01('0x7')](_0x6b01('0xb'),_0x2c4e48['length']);SmsInteractionEvents['emit'](_0x3b9de1+':'+_0x5964ca['id'],_0x5964ca);SmsInteractionEvents[_0x6b01('0xc')](_0x3b9de1,_0x5964ca);_0x65407a(null);})[_0x6b01('0xd')](_0x65407a(null));};}for(var e in events){if(events[_0x6b01('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x6b01('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a5b2b0c..9add4f2 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 _0x47ef=['api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0x47ef,0x15e));var _0xf47e=function(_0x1c91db,_0x3eeda8){_0x1c91db=_0x1c91db-0x0;var _0x1ca15f=_0x47ef[_0x1c91db];return _0x1ca15f;};'use strict';var _=require(_0xf47e('0x0'));var util=require('util');var logger=require(_0xf47e('0x1'))(_0xf47e('0x2'));var moment=require(_0xf47e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf47e('0x4'));var fs=require('fs');var path=require(_0xf47e('0x5'));var rimraf=require(_0xf47e('0x6'));var config=require(_0xf47e('0x7'));var attributes=require(_0xf47e('0x8'));module[_0xf47e('0x9')]=function(_0x333883,_0x6ea381){return _0x333883[_0xf47e('0xa')](_0xf47e('0xb'),attributes,{'tableName':_0xf47e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4412f2,_0x5a88a5,_0x3f6cf7){if(_0x4412f2['changed'](_0xf47e('0xd'))){_0x4412f2[_0xf47e('0xe')]=moment()['format'](_0xf47e('0xf'));}_0x3f6cf7(null,_0x4412f2);}}});}; \ No newline at end of file +var _0x466c=['./smsInteraction.attributes','exports','define','changed','closed','format','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dfa3e,_0x293558){var _0x3ff9ed=function(_0x400e9b){while(--_0x400e9b){_0x3dfa3e['push'](_0x3dfa3e['shift']());}};_0x3ff9ed(++_0x293558);}(_0x466c,0x165));var _0xc466=function(_0x4c48e2,_0x2f5ab0){_0x4c48e2=_0x4c48e2-0x0;var _0x850de2=_0x466c[_0x4c48e2];return _0x850de2;};'use strict';var _=require('lodash');var util=require(_0xc466('0x0'));var logger=require(_0xc466('0x1'))('api');var moment=require(_0xc466('0x2'));var BPromise=require(_0xc466('0x3'));var rp=require(_0xc466('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc466('0x5'));var config=require(_0xc466('0x6'));var attributes=require(_0xc466('0x7'));module[_0xc466('0x8')]=function(_0x18e83d,_0x59860c){return _0x18e83d[_0xc466('0x9')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x197664,_0xbd92b3,_0x3d3fbc){if(_0x197664[_0xc466('0xa')](_0xc466('0xb'))){_0x197664['closedAt']=moment()[_0xc466('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3d3fbc(null,_0x197664);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f20617f..8d50dfe 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 _0x9981=['defaults','localhost','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','limit','catch','AddTagsToSmsInteraction','ids','omit','AddTags','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis'];(function(_0x59d12e,_0x1128ff){var _0x2f5ee4=function(_0x213beb){while(--_0x213beb){_0x59d12e['push'](_0x59d12e['shift']());}};_0x2f5ee4(++_0x1128ff);}(_0x9981,0x163));var _0x1998=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x9981[_0x101e7b];return _0x4995c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1998('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1998('0x1'))['db'];var utils=require(_0x1998('0x2'));var logger=require(_0x1998('0x3'))(_0x1998('0x4'));var config=require('../../config/environment');var jayson=require(_0x1998('0x5'));var client=jayson['client'][_0x1998('0x6')]({'port':0x232a});config[_0x1998('0x7')]=_[_0x1998('0x8')](config['redis'],{'host':_0x1998('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1998('0x7')]));require(_0x1998('0xa'))['register'](socket);function respondWithRpcPromise(_0x5eb76b,_0x2754ae,_0x314d80){return new BPromise(function(_0x74b6db,_0x277e19){return client[_0x1998('0xb')](_0x5eb76b,_0x314d80)[_0x1998('0xc')](function(_0x15499d){logger[_0x1998('0xd')](_0x1998('0xe'),_0x2754ae,_0x1998('0xf'));logger[_0x1998('0x10')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2754ae,'request\x20sent',JSON[_0x1998('0x11')](_0x15499d));if(_0x15499d['error']){if(_0x15499d['error']['code']===0x1f4){logger[_0x1998('0x12')](_0x1998('0xe'),_0x2754ae,_0x15499d[_0x1998('0x12')][_0x1998('0x13')]);return _0x277e19(_0x15499d['error'][_0x1998('0x13')]);}logger[_0x1998('0x12')](_0x1998('0xe'),_0x2754ae,_0x15499d['error']['message']);return _0x74b6db(_0x15499d[_0x1998('0x12')]['message']);}else{logger[_0x1998('0xd')](_0x1998('0xe'),_0x2754ae,_0x1998('0xf'));_0x74b6db(_0x15499d[_0x1998('0x14')][_0x1998('0x13')]);}})['catch'](function(_0x1d7ec9){logger['error'](_0x1998('0xe'),_0x2754ae,_0x1d7ec9);_0x277e19(_0x1d7ec9);});});}exports[_0x1998('0x15')]=function(_0x568fcf){var _0x1eec6b=this;return new Promise(function(_0x1b42d5,_0x4d4e89){return db[_0x1998('0x16')]['update'](_0x568fcf[_0x1998('0x17')],{'raw':_0x568fcf[_0x1998('0x18')]?_0x568fcf['options'][_0x1998('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x568fcf[_0x1998('0x18')]?_0x568fcf['options'][_0x1998('0x1a')]||null:null,'attributes':_0x568fcf[_0x1998('0x18')]?_0x568fcf[_0x1998('0x18')]['attributes']||null:null,'limit':_0x568fcf[_0x1998('0x18')]?_0x568fcf[_0x1998('0x18')][_0x1998('0x1b')]||null:null})[_0x1998('0xc')](function(_0x1a477a){logger['info'](_0x1998('0x15'),_0x568fcf);logger[_0x1998('0x10')]('UpdateSmsInteraction',_0x568fcf,JSON['stringify'](_0x1a477a));_0x1b42d5(_0x1a477a);})[_0x1998('0x1c')](function(_0xb4d01c){logger[_0x1998('0x12')](_0x1998('0x15'),_0xb4d01c[_0x1998('0x13')],_0x568fcf);_0x4d4e89(_0x1eec6b[_0x1998('0x12')](0x1f4,_0xb4d01c[_0x1998('0x13')]));});});};exports[_0x1998('0x1d')]=function(_0x5d441b){return new Promise(function(_0x406e2f,_0x106019){return db[_0x1998('0x16')]['find']({'where':_0x5d441b['options']?_0x5d441b[_0x1998('0x18')]['where']||null:null})[_0x1998('0xc')](function(_0x384b65){if(_0x384b65){return _0x384b65['addTags'](_0x5d441b['body'][_0x1998('0x1e')],_[_0x1998('0x1f')](_0x5d441b[_0x1998('0x17')],['ids','id'])||{});}})['spread'](function(_0x1f2aaf){logger['info'](_0x1998('0x20'),_0x5d441b);logger[_0x1998('0x10')](_0x1998('0x20'),_0x5d441b,JSON[_0x1998('0x11')](_0x1f2aaf));_0x406e2f(_0x1f2aaf);})[_0x1998('0x1c')](function(_0x518797){logger[_0x1998('0x12')](_0x1998('0x20'),_0x518797[_0x1998('0x13')],_0x5d441b);_0x106019(_this[_0x1998('0x12')](0x1f4,_0x518797[_0x1998('0x13')]));});});}; \ No newline at end of file +var _0x9c2f=['code','message','result','catch','UpdateSmsInteraction','options','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xd586c4,_0x8e2974){var _0x320768=function(_0xa5951c){while(--_0xa5951c){_0xd586c4['push'](_0xd586c4['shift']());}};_0x320768(++_0x8e2974);}(_0x9c2f,0x179));var _0xf9c2=function(_0x40cc74,_0x215029){_0x40cc74=_0x40cc74-0x0;var _0x597573=_0x9c2f[_0x40cc74];return _0x597573;};'use strict';var _=require(_0xf9c2('0x0'));var util=require(_0xf9c2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf9c2('0x2'));var fs=require('fs');var Redis=require(_0xf9c2('0x3'));var db=require(_0xf9c2('0x4'))['db'];var utils=require(_0xf9c2('0x5'));var logger=require(_0xf9c2('0x6'))(_0xf9c2('0x7'));var config=require('../../config/environment');var jayson=require(_0xf9c2('0x8'));var client=jayson['client'][_0xf9c2('0x9')]({'port':0x232a});config[_0xf9c2('0xa')]=_[_0xf9c2('0xb')](config[_0xf9c2('0xa')],{'host':_0xf9c2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9c2('0xa')]));require(_0xf9c2('0xd'))['register'](socket);function respondWithRpcPromise(_0x1b9e01,_0x248287,_0x1fd0e4){return new BPromise(function(_0x233c73,_0x31264e){return client[_0xf9c2('0xe')](_0x1b9e01,_0x1fd0e4)[_0xf9c2('0xf')](function(_0x2b9d40){logger[_0xf9c2('0x10')](_0xf9c2('0x11'),_0x248287,'request\x20sent');logger[_0xf9c2('0x12')](_0xf9c2('0x13'),_0x248287,_0xf9c2('0x14'),JSON[_0xf9c2('0x15')](_0x2b9d40));if(_0x2b9d40[_0xf9c2('0x16')]){if(_0x2b9d40['error'][_0xf9c2('0x17')]===0x1f4){logger[_0xf9c2('0x16')](_0xf9c2('0x11'),_0x248287,_0x2b9d40[_0xf9c2('0x16')]['message']);return _0x31264e(_0x2b9d40['error'][_0xf9c2('0x18')]);}logger['error'](_0xf9c2('0x11'),_0x248287,_0x2b9d40[_0xf9c2('0x16')][_0xf9c2('0x18')]);return _0x233c73(_0x2b9d40[_0xf9c2('0x16')][_0xf9c2('0x18')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x248287,_0xf9c2('0x14'));_0x233c73(_0x2b9d40[_0xf9c2('0x19')][_0xf9c2('0x18')]);}})[_0xf9c2('0x1a')](function(_0x52c6e2){logger[_0xf9c2('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x248287,_0x52c6e2);_0x31264e(_0x52c6e2);});});}exports[_0xf9c2('0x1b')]=function(_0x4c5be8){var _0x1635df=this;return new Promise(function(_0x58c63c,_0x1c197d){return db['SmsInteraction']['update'](_0x4c5be8['body'],{'raw':_0x4c5be8['options']?_0x4c5be8[_0xf9c2('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c5be8[_0xf9c2('0x1c')]?_0x4c5be8[_0xf9c2('0x1c')][_0xf9c2('0x1d')]||null:null,'attributes':_0x4c5be8['options']?_0x4c5be8[_0xf9c2('0x1c')][_0xf9c2('0x1e')]||null:null,'limit':_0x4c5be8[_0xf9c2('0x1c')]?_0x4c5be8[_0xf9c2('0x1c')][_0xf9c2('0x1f')]||null:null})[_0xf9c2('0xf')](function(_0x40c483){logger['info'](_0xf9c2('0x1b'),_0x4c5be8);logger['debug'](_0xf9c2('0x1b'),_0x4c5be8,JSON['stringify'](_0x40c483));_0x58c63c(_0x40c483);})[_0xf9c2('0x1a')](function(_0x24a9db){logger[_0xf9c2('0x16')]('UpdateSmsInteraction',_0x24a9db['message'],_0x4c5be8);_0x1c197d(_0x1635df[_0xf9c2('0x16')](0x1f4,_0x24a9db[_0xf9c2('0x18')]));});});};exports[_0xf9c2('0x20')]=function(_0x2d68e0){return new Promise(function(_0x222642,_0x38a848){return db[_0xf9c2('0x21')]['find']({'where':_0x2d68e0['options']?_0x2d68e0[_0xf9c2('0x1c')]['where']||null:null})[_0xf9c2('0xf')](function(_0x189993){if(_0x189993){return _0x189993[_0xf9c2('0x22')](_0x2d68e0[_0xf9c2('0x23')][_0xf9c2('0x24')],_[_0xf9c2('0x25')](_0x2d68e0['body'],[_0xf9c2('0x24'),'id'])||{});}})[_0xf9c2('0x26')](function(_0x49ea2d){logger[_0xf9c2('0x10')](_0xf9c2('0x27'),_0x2d68e0);logger[_0xf9c2('0x12')](_0xf9c2('0x27'),_0x2d68e0,JSON[_0xf9c2('0x15')](_0x49ea2d));_0x222642(_0x49ea2d);})[_0xf9c2('0x1a')](function(_0x258ff8){logger[_0xf9c2('0x16')](_0xf9c2('0x27'),_0x258ff8['message'],_0x2d68e0);_0x38a848(_this[_0xf9c2('0x16')](0x1f4,_0x258ff8[_0xf9c2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b059b0e..fda1650 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 _0x729c=['emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove','update'];(function(_0x2baf10,_0x1ce814){var _0x5907a3=function(_0x4cfbc1){while(--_0x4cfbc1){_0x2baf10['push'](_0x2baf10['shift']());}};_0x5907a3(++_0x1ce814);}(_0x729c,0x1c7));var _0xc729=function(_0x1e7819,_0x44078c){_0x1e7819=_0x1e7819-0x0;var _0xc23daf=_0x729c[_0x1e7819];return _0xc23daf;};'use strict';var SmsInteractionEvents=require(_0xc729('0x0'));var events=[_0xc729('0x1'),_0xc729('0x2'),_0xc729('0x3')];function createListener(_0xf446be,_0xd8125a){return function(_0x3856c4){_0xd8125a[_0xc729('0x4')](_0xf446be,_0x3856c4);};}function removeListener(_0x565712,_0x2e7c4d){return function(){SmsInteractionEvents[_0xc729('0x5')](_0x565712,_0x2e7c4d);};}exports[_0xc729('0x6')]=function(_0x462f13){for(var _0x2d71c8=0x0,_0x535a08=events[_0xc729('0x7')];_0x2d71c8<_0x535a08;_0x2d71c8++){var _0x5ab0e0=events[_0x2d71c8];var _0x18f021=createListener(_0xc729('0x8')+_0x5ab0e0,_0x462f13);SmsInteractionEvents['on'](_0x5ab0e0,_0x18f021);}}; \ No newline at end of file +var _0xa2ef=['removeListener','register','length','save','remove','update','emit'];(function(_0x46db1a,_0x193e03){var _0x256a68=function(_0x30212d){while(--_0x30212d){_0x46db1a['push'](_0x46db1a['shift']());}};_0x256a68(++_0x193e03);}(_0xa2ef,0x153));var _0xfa2e=function(_0x4a1fa1,_0x2db06b){_0x4a1fa1=_0x4a1fa1-0x0;var _0x21d32f=_0xa2ef[_0x4a1fa1];return _0x21d32f;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xfa2e('0x0'),_0xfa2e('0x1'),_0xfa2e('0x2')];function createListener(_0x1e59bf,_0x7e11c0){return function(_0x5bf41b){_0x7e11c0[_0xfa2e('0x3')](_0x1e59bf,_0x5bf41b);};}function removeListener(_0x5e12ca,_0x4948c8){return function(){SmsInteractionEvents[_0xfa2e('0x4')](_0x5e12ca,_0x4948c8);};}exports[_0xfa2e('0x5')]=function(_0x40d404){for(var _0x49a677=0x0,_0x558427=events[_0xfa2e('0x6')];_0x49a677<_0x558427;_0x49a677++){var _0x4f22a2=events[_0x49a677];var _0xaf15d=createListener('smsInteraction:'+_0x4f22a2,_0x40d404);SmsInteractionEvents['on'](_0x4f22a2,_0xaf15d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index dddc770..a77ff87 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 _0x14ca=['put','update','accept','reject','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms'];(function(_0x58c851,_0x1f3d96){var _0x534d8a=function(_0x10c1a0){while(--_0x10c1a0){_0x58c851['push'](_0x58c851['shift']());}};_0x534d8a(++_0x1f3d96);}(_0x14ca,0x148));var _0xa14c=function(_0x447730,_0x151c13){_0x447730=_0x447730-0x0;var _0x2f8683=_0x14ca[_0x447730];return _0x2f8683;};'use strict';var multer=require(_0xa14c('0x0'));var util=require(_0xa14c('0x1'));var path=require('path');var timeout=require(_0xa14c('0x2'));var express=require('express');var router=express[_0xa14c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa14c('0x4'));var interaction=require(_0xa14c('0x5'));var config=require('../../config/environment');var controller=require(_0xa14c('0x6'));router[_0xa14c('0x7')]('/',auth[_0xa14c('0x8')](),controller[_0xa14c('0x9')]);router['get'](_0xa14c('0xa'),auth[_0xa14c('0x8')](),controller[_0xa14c('0xb')]);router[_0xa14c('0x7')](_0xa14c('0xc'),auth[_0xa14c('0x8')](),controller[_0xa14c('0xd')]);router[_0xa14c('0xe')]('/',auth[_0xa14c('0x8')](),interaction[_0xa14c('0xf')](_0xa14c('0x10'),'smsmessage:create'),controller['create']);router[_0xa14c('0xe')]('/:id/status',controller['status']);router[_0xa14c('0x11')](_0xa14c('0xc'),auth['isAuthenticated'](),controller[_0xa14c('0x12')]);router[_0xa14c('0x11')]('/:id/accept',auth[_0xa14c('0x8')](),controller[_0xa14c('0x13')]);router[_0xa14c('0x11')]('/:id/reject',auth[_0xa14c('0x8')](),controller[_0xa14c('0x14')]);router[_0xa14c('0x15')](_0xa14c('0xc'),auth[_0xa14c('0x8')](),controller[_0xa14c('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5879=['Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x130154,_0x507d74){var _0x278863=function(_0xb2576e){while(--_0xb2576e){_0x130154['push'](_0x130154['shift']());}};_0x278863(++_0x507d74);}(_0x5879,0xdb));var _0x9587=function(_0x21c980,_0x3cac3d){_0x21c980=_0x21c980-0x0;var _0x2dc043=_0x5879[_0x21c980];return _0x2dc043;};'use strict';var multer=require(_0x9587('0x0'));var util=require(_0x9587('0x1'));var path=require(_0x9587('0x2'));var timeout=require(_0x9587('0x3'));var express=require(_0x9587('0x4'));var router=express[_0x9587('0x5')]();var fs_extra=require(_0x9587('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9587('0x7'));var config=require('../../config/environment');var controller=require(_0x9587('0x8'));router[_0x9587('0x9')]('/',auth[_0x9587('0xa')](),controller[_0x9587('0xb')]);router[_0x9587('0x9')]('/describe',auth[_0x9587('0xa')](),controller[_0x9587('0xc')]);router[_0x9587('0x9')](_0x9587('0xd'),auth[_0x9587('0xa')](),controller[_0x9587('0xe')]);router[_0x9587('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9587('0x10')](_0x9587('0x11'),_0x9587('0x12')),controller['create']);router[_0x9587('0xf')](_0x9587('0x13'),controller[_0x9587('0x14')]);router[_0x9587('0x15')]('/:id',auth[_0x9587('0xa')](),controller['update']);router[_0x9587('0x15')](_0x9587('0x16'),auth['isAuthenticated'](),controller[_0x9587('0x17')]);router[_0x9587('0x15')]('/:id/reject',auth[_0x9587('0xa')](),controller[_0x9587('0x18')]);router[_0x9587('0x19')](_0x9587('0xd'),auth[_0x9587('0xa')](),controller[_0x9587('0x1a')]);module[_0x9587('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 0fc925a..8ae5039 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 _0xe0d6=['TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','exports'];(function(_0x2803dc,_0x1cdaf1){var _0x552ae4=function(_0x15f1ef){while(--_0x15f1ef){_0x2803dc['push'](_0x2803dc['shift']());}};_0x552ae4(++_0x1cdaf1);}(_0xe0d6,0x13f));var _0x6e0d=function(_0x5be68d,_0x1187c4){_0x5be68d=_0x5be68d-0x0;var _0x3c287e=_0xe0d6[_0x5be68d];return _0x3c287e;};'use strict';var Sequelize=require('sequelize');module[_0x6e0d('0x0')]={'body':{'type':Sequelize[_0x6e0d('0x1')](_0x6e0d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6e0d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6e0d('0x4')]('in',_0x6e0d('0x5')),'defaultValue':_0x6e0d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x6e0d('0x6')]},'secret':{'type':Sequelize[_0x6e0d('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6e0d('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3e22=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x220283,_0x226cf){var _0x5986ac=function(_0x1e8e8c){while(--_0x1e8e8c){_0x220283['push'](_0x220283['shift']());}};_0x5986ac(++_0x226cf);}(_0x3e22,0x104));var _0x23e2=function(_0x56fbaa,_0x3bc5a6){_0x56fbaa=_0x56fbaa-0x0;var _0x49fbc1=_0x3e22[_0x56fbaa];return _0x49fbc1;};'use strict';var Sequelize=require(_0x23e2('0x0'));module[_0x23e2('0x1')]={'body':{'type':Sequelize[_0x23e2('0x2')](_0x23e2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x23e2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x23e2('0x5')]('in',_0x23e2('0x6')),'defaultValue':_0x23e2('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x23e2('0x7')]},'readAt':{'type':Sequelize[_0x23e2('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1b49e13..8297cc2 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 _0x9af6=['acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','fullname','internal','SIP/%s','motionChannel','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','moment','util','path','sox','ejs','lodash','squel','crypto','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','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','offset','limit','count','Content-Range','json','apply','reject','update','destroy','name','send','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','filters','includeAll','SmsMessage','find','create','body','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','email','manual','interface','channel','event','EventManager'];(function(_0x189dae,_0x24f23f){var _0x12bd7d=function(_0x54776c){while(--_0x54776c){_0x189dae['push'](_0x189dae['shift']());}};_0x12bd7d(++_0x24f23f);}(_0x9af6,0x1d7));var _0x69af=function(_0x45a571,_0x4989ea){_0x45a571=_0x45a571-0x0;var _0x42e2f4=_0x9af6[_0x45a571];return _0x42e2f4;};'use strict';var emlformat=require(_0x69af('0x0'));var rimraf=require(_0x69af('0x1'));var zipdir=require(_0x69af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x69af('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x69af('0x4'));var path=require(_0x69af('0x5'));var sox=require(_0x69af('0x6'));var csv=require('to-csv');var ejs=require(_0x69af('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69af('0x8'));var squel=require(_0x69af('0x9'));var crypto=require(_0x69af('0xa'));var jsforce=require(_0x69af('0xb'));var deskjs=require(_0x69af('0xc'));var toCsv=require(_0x69af('0xd'));var querystring=require(_0x69af('0xe'));var Papa=require(_0x69af('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69af('0x10'));var as=require(_0x69af('0x11'));var hardwareService=require(_0x69af('0x12'));var logger=require(_0x69af('0x13'))(_0x69af('0x14'));var utils=require(_0x69af('0x15'));var config=require(_0x69af('0x16'));var licenseUtil=require(_0x69af('0x17'));var db=require('../../mysqldb')['db'];config[_0x69af('0x18')]=_[_0x69af('0x19')](config[_0x69af('0x18')],{'host':_0x69af('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x69af('0x18')]));require(_0x69af('0x1b'))[_0x69af('0x1c')](socket);var jayson=require(_0x69af('0x1d'));var client=jayson[_0x69af('0x1e')][_0x69af('0x1f')]({'port':0x232c});var client9002=jayson[_0x69af('0x1e')][_0x69af('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x543ac0,_0x11feb8,_0x46ab23,_0x1061ff){return new BPromise(function(_0x2ce24c,_0x2be681){var _0x3ac9e6=_0x1061ff||client;return _0x3ac9e6['request'](_0x543ac0,_0x46ab23)[_0x69af('0x20')](function(_0x3cfb51){logger[_0x69af('0x21')](_0x69af('0x22'),_0x11feb8,_0x69af('0x23'));logger[_0x69af('0x24')](_0x69af('0x25'),_0x11feb8,_0x69af('0x23'),JSON['stringify'](_0x3cfb51));if(_0x3cfb51[_0x69af('0x26')]){if(_0x3cfb51[_0x69af('0x26')]['code']===0x1f4){logger['error'](_0x69af('0x22'),_0x11feb8,_0x3cfb51[_0x69af('0x26')][_0x69af('0x27')]);return _0x2be681(_0x3cfb51[_0x69af('0x26')][_0x69af('0x27')]);}logger['error'](_0x69af('0x22'),_0x11feb8,_0x3cfb51['error'][_0x69af('0x27')]);return _0x2ce24c(_0x3cfb51[_0x69af('0x26')][_0x69af('0x27')]);}else{logger[_0x69af('0x21')](_0x69af('0x22'),_0x11feb8,_0x69af('0x23'));_0x2ce24c(_0x3cfb51[_0x69af('0x28')][_0x69af('0x27')]);}})[_0x69af('0x29')](function(_0x4fd6d8){logger['error'](_0x69af('0x22'),_0x11feb8,_0x4fd6d8);_0x2be681(_0x4fd6d8);});});}function respondWithStatusCode(_0x181513,_0x6f686b){_0x6f686b=_0x6f686b||0xcc;return function(_0x5cfb8c){if(_0x5cfb8c){return _0x181513['sendStatus'](_0x6f686b);}return _0x181513[_0x69af('0x2a')](_0x6f686b)[_0x69af('0x2b')]();};}function respondWithResult(_0x24eb4d,_0x5ae83d){_0x5ae83d=_0x5ae83d||0xc8;return function(_0x1ce509){if(_0x1ce509){return _0x24eb4d[_0x69af('0x2a')](_0x5ae83d)['json'](_0x1ce509);}};}function respondWithFilteredResult(_0x5b29da,_0x2cec15){return function(_0x58e7d0){if(_0x58e7d0){var _0x41c479=typeof _0x2cec15[_0x69af('0x2c')]==='undefined'&&typeof _0x2cec15[_0x69af('0x2d')]==='undefined';var _0xa94f51=_0x58e7d0[_0x69af('0x2e')];var _0x11293a=_0x41c479?0x0:_0x2cec15['offset'];var _0xb1b484=_0x41c479?_0x58e7d0['count']:_0x2cec15[_0x69af('0x2c')]+_0x2cec15[_0x69af('0x2d')];var _0x5ddd2d;if(_0xb1b484>=_0xa94f51){_0xb1b484=_0xa94f51;_0x5ddd2d=0xc8;}else{_0x5ddd2d=0xce;}_0x5b29da['status'](_0x5ddd2d);return _0x5b29da['set'](_0x69af('0x2f'),_0x11293a+'-'+_0xb1b484+'/'+_0xa94f51)[_0x69af('0x30')](_0x58e7d0);}return null;};}function patchUpdates(_0x26ae1c){return function(_0x24bcab){try{jsonpatch[_0x69af('0x31')](_0x24bcab,_0x26ae1c,!![]);}catch(_0x31febd){return BPromise[_0x69af('0x32')](_0x31febd);}return _0x24bcab['save']();};}function saveUpdates(_0x76311f,_0x4b18d8){return function(_0x57aed3){if(_0x57aed3){return _0x57aed3[_0x69af('0x33')](_0x76311f)[_0x69af('0x20')](function(_0x255fec){return _0x255fec;});}return null;};}function removeEntity(_0x57be6b,_0x2b584b){return function(_0x1d56c8){if(_0x1d56c8){return _0x1d56c8[_0x69af('0x34')]()[_0x69af('0x20')](function(){_0x57be6b[_0x69af('0x2a')](0xcc)[_0x69af('0x2b')]();});}};}function handleEntityNotFound(_0x50cd02,_0x3e7c8b){return function(_0x5eed56){if(!_0x5eed56){_0x50cd02['sendStatus'](0x194);}return _0x5eed56;};}function handleError(_0x5d79ca,_0x3dbf15){_0x3dbf15=_0x3dbf15||0x1f4;return function(_0x4e7798){logger['error'](_0x4e7798['stack']);if(_0x4e7798['name']){delete _0x4e7798[_0x69af('0x35')];}_0x5d79ca[_0x69af('0x2a')](_0x3dbf15)[_0x69af('0x36')](_0x4e7798);};}exports['index']=function(_0x14500d,_0x3c9e3c){var _0x1eff46={},_0x33c304={},_0x3eb6fb={'count':0x0,'rows':[]};var _0x198b97=_[_0x69af('0x37')](db['SmsMessage'][_0x69af('0x38')],function(_0x1e2b70){return{'name':_0x1e2b70[_0x69af('0x39')],'type':_0x1e2b70['type'][_0x69af('0x3a')]};});_0x33c304['model']=_[_0x69af('0x37')](_0x198b97,_0x69af('0x35'));_0x33c304[_0x69af('0x3b')]=_[_0x69af('0x3c')](_0x14500d[_0x69af('0x3b')]);_0x33c304['filters']=_[_0x69af('0x3d')](_0x33c304[_0x69af('0x3e')],_0x33c304[_0x69af('0x3b')]);_0x1eff46[_0x69af('0x3f')]=_[_0x69af('0x3d')](_0x33c304[_0x69af('0x3e')],qs[_0x69af('0x40')](_0x14500d[_0x69af('0x3b')][_0x69af('0x40')]));_0x1eff46[_0x69af('0x3f')]=_0x1eff46['attributes'][_0x69af('0x41')]?_0x1eff46[_0x69af('0x3f')]:_0x33c304[_0x69af('0x3e')];if(!_0x14500d['query']['hasOwnProperty'](_0x69af('0x42'))){_0x1eff46[_0x69af('0x2d')]=qs[_0x69af('0x2d')](_0x14500d[_0x69af('0x3b')][_0x69af('0x2d')]);_0x1eff46[_0x69af('0x2c')]=qs[_0x69af('0x2c')](_0x14500d['query']['offset']);}_0x1eff46['order']=qs[_0x69af('0x43')](_0x14500d[_0x69af('0x3b')]['sort']);_0x1eff46[_0x69af('0x44')]=qs['filters'](_['pick'](_0x14500d[_0x69af('0x3b')],_0x33c304['filters']),_0x198b97);if(_0x14500d['query'][_0x69af('0x45')]){_0x1eff46[_0x69af('0x44')]=_['merge'](_0x1eff46[_0x69af('0x44')],{'$or':_[_0x69af('0x37')](_0x198b97,function(_0xb6ca35){if(_0xb6ca35['type']!==_0x69af('0x46')){var _0x55977f={};_0x55977f[_0xb6ca35[_0x69af('0x35')]]={'$like':'%'+_0x14500d[_0x69af('0x3b')][_0x69af('0x45')]+'%'};return _0x55977f;}})});}_0x1eff46=_[_0x69af('0x47')]({},_0x1eff46,_0x14500d[_0x69af('0x48')]);var _0x4f6eaf={'where':_0x1eff46[_0x69af('0x44')]};return db['SmsMessage'][_0x69af('0x2e')](_0x4f6eaf)['then'](function(_0x4e5b95){_0x3eb6fb[_0x69af('0x2e')]=_0x4e5b95;if(_0x14500d[_0x69af('0x3b')]['includeAll']){_0x1eff46[_0x69af('0x49')]=[{'all':!![]}];}return db['SmsMessage'][_0x69af('0x4a')](_0x1eff46);})[_0x69af('0x20')](function(_0x32cffc){_0x3eb6fb[_0x69af('0x4b')]=_0x32cffc;return _0x3eb6fb;})['then'](respondWithFilteredResult(_0x3c9e3c,_0x1eff46))['catch'](handleError(_0x3c9e3c,null));};exports[_0x69af('0x4c')]=function(_0x1f0eac,_0x1bfaf1){var _0x122da4={'raw':!![],'where':{'id':_0x1f0eac[_0x69af('0x4d')]['id']}},_0x4de750={};_0x4de750[_0x69af('0x3e')]=_[_0x69af('0x3c')](db['SmsMessage'][_0x69af('0x38')]);_0x4de750[_0x69af('0x3b')]=_['keys'](_0x1f0eac['query']);_0x4de750[_0x69af('0x4e')]=_['intersection'](_0x4de750['model'],_0x4de750[_0x69af('0x3b')]);_0x122da4[_0x69af('0x3f')]=_[_0x69af('0x3d')](_0x4de750['model'],qs[_0x69af('0x40')](_0x1f0eac['query'][_0x69af('0x40')]));_0x122da4['attributes']=_0x122da4['attributes']['length']?_0x122da4[_0x69af('0x3f')]:_0x4de750[_0x69af('0x3e')];if(_0x1f0eac[_0x69af('0x3b')][_0x69af('0x4f')]){_0x122da4[_0x69af('0x49')]=[{'all':!![]}];}_0x122da4=_[_0x69af('0x47')]({},_0x122da4,_0x1f0eac[_0x69af('0x48')]);return db[_0x69af('0x50')][_0x69af('0x51')](_0x122da4)[_0x69af('0x20')](handleEntityNotFound(_0x1bfaf1,null))[_0x69af('0x20')](respondWithResult(_0x1bfaf1,null))[_0x69af('0x29')](handleError(_0x1bfaf1,null));};exports[_0x69af('0x52')]=function(_0x155ad0,_0x16867a){return db[_0x69af('0x50')][_0x69af('0x52')](_0x155ad0['body'],{})[_0x69af('0x20')](respondWithResult(_0x16867a,0xc9))[_0x69af('0x29')](handleError(_0x16867a,null));};exports[_0x69af('0x33')]=function(_0x47f066,_0x414835){if(_0x47f066[_0x69af('0x53')]['id']){delete _0x47f066[_0x69af('0x53')]['id'];}return db[_0x69af('0x50')][_0x69af('0x51')]({'where':{'id':_0x47f066[_0x69af('0x4d')]['id']}})[_0x69af('0x20')](handleEntityNotFound(_0x414835,null))[_0x69af('0x20')](saveUpdates(_0x47f066[_0x69af('0x53')],null))[_0x69af('0x20')](respondWithResult(_0x414835,null))[_0x69af('0x29')](handleError(_0x414835,null));};exports[_0x69af('0x34')]=function(_0xd5fe1f,_0x15b0a1){return db['SmsMessage']['find']({'where':{'id':_0xd5fe1f[_0x69af('0x4d')]['id']}})[_0x69af('0x20')](handleEntityNotFound(_0x15b0a1,null))[_0x69af('0x20')](removeEntity(_0x15b0a1,null))[_0x69af('0x29')](handleError(_0x15b0a1,null));};exports[_0x69af('0x54')]=function(_0x4e77c2,_0x21c563){return db[_0x69af('0x50')][_0x69af('0x54')]()[_0x69af('0x20')](respondWithResult(_0x21c563,null))[_0x69af('0x29')](handleError(_0x21c563,null));};var interaction_log=require(_0x69af('0x13'))(_0x69af('0x55'));exports[_0x69af('0x56')]=function(_0x20c6e1,_0x193413,_0x23e8f1){var _0x36209f={'agent':{},'channel':_0x69af('0x57')};if(_0x20c6e1[_0x69af('0x53')]['id']){delete _0x20c6e1[_0x69af('0x53')]['id'];}_0x20c6e1[_0x69af('0x53')][_0x69af('0x58')]=!![];_0x20c6e1[_0x69af('0x53')]['readAt']=moment()[_0x69af('0x59')](_0x69af('0x5a'));_0x20c6e1['body']['UserId']=_0x20c6e1[_0x69af('0x53')][_0x69af('0x5b')]||_0x20c6e1[_0x69af('0x5c')]['id'];_0x36209f[_0x69af('0x5d')]['id']=_0x20c6e1[_0x69af('0x53')][_0x69af('0x5b')];return db[_0x69af('0x50')][_0x69af('0x51')]({'where':{'id':_0x20c6e1['params']['id'],'UserId':null}})[_0x69af('0x20')](handleEntityNotFound(_0x193413,null))[_0x69af('0x20')](saveUpdates(_0x20c6e1[_0x69af('0x53')],null))['then'](function(_0x289ad3){if(_0x289ad3){_0x36209f[_0x69af('0x27')]=_0x289ad3[_0x69af('0x5e')]({'plain':!![]});return db[_0x69af('0x5f')][_0x69af('0x51')]({'where':{'id':_0x289ad3[_0x69af('0x60')]}});}return null;})[_0x69af('0x20')](handleEntityNotFound(_0x193413,null))['then'](function(_0x34fe5d){if(_0x34fe5d){return _0x34fe5d[_0x69af('0x33')]({'UserId':_0x20c6e1[_0x69af('0x53')][_0x69af('0x5b')],'read1stAt':_[_0x69af('0x61')](_0x34fe5d[_0x69af('0x62')])?moment()[_0x69af('0x59')](_0x69af('0x5a')):undefined});}return null;})['then'](function(_0x2637f1){if(_0x2637f1){_0x36209f[_0x69af('0x63')]=_0x2637f1['get']({'plain':!![]});interaction_log['info'](_0x69af('0x64'),_0x20c6e1[_0x69af('0x5c')]['id'],_0x20c6e1[_0x69af('0x5c')][_0x69af('0x35')],_0x20c6e1[_0x69af('0x5c')][_0x69af('0x65')],_0x36209f['interaction']['id'],_0x20c6e1['body']?JSON[_0x69af('0x66')](_0x20c6e1[_0x69af('0x53')]):_0x69af('0x67'));return respondWithRpcPromise(_0x69af('0x68'),_0x69af('0x69'),_0x36209f);}return null;})[_0x69af('0x20')](function(_0xb4518){var _0x5757f9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xb4518['message'][_0x69af('0x6a')];return db[_0x69af('0x6b')][_0x69af('0x3b')](_0x5757f9,{'type':db[_0x69af('0x6c')][_0x69af('0x6d')][_0x69af('0x6e')],'raw':!![]})['then'](function(_0x3105a3){return _0x3105a3;});})[_0x69af('0x20')](function(_0x3b4b6e){if(_0x3b4b6e){_0x36209f[_0x69af('0x27')]['contact']=_0x3b4b6e[0x0];if(!_0x20c6e1[_0x69af('0x53')][_0x69af('0x5b')])return;return db['User']['find']({'where':{'id':_0x20c6e1[_0x69af('0x53')][_0x69af('0x5b')],'role':_0x69af('0x5d')},'attributes':['id',_0x69af('0x35'),'fullname',_0x69af('0x6f'),'internal'],'raw':!![]});}return null;})[_0x69af('0x20')](function(_0x4850d3){if(!_0x4850d3)return null;_0x36209f[_0x69af('0x27')][_0x69af('0x5d')]=_0x4850d3;return _0x36209f;})[_0x69af('0x20')](function(_0x472ddd){if(_0x472ddd){if(_0x20c6e1[_0x69af('0x53')][_0x69af('0x70')]){_0x36209f[_0x69af('0x27')][_0x69af('0x71')]=util[_0x69af('0x59')]('SIP/%s',_0x20c6e1[_0x69af('0x5c')]['name']);_0x36209f[_0x69af('0x27')]['channel']=_0x36209f[_0x69af('0x72')];_0x36209f[_0x69af('0x27')]['motionChannel']=_0x36209f['channel'];_0x36209f[_0x69af('0x27')][_0x69af('0x73')]=_0x69af('0x56');return respondWithRpcPromise(_0x69af('0x74'),_0x69af('0x74'),{'event':_0x69af('0x75'),'message':_0x36209f['message']},client9002)[_0x69af('0x20')](function(){return _0x36209f;});}return _0x36209f;}return null;})[_0x69af('0x20')](respondWithResult(_0x193413,null))[_0x69af('0x29')](handleError(_0x193413,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x69af('0x32')]=function(_0x3f0aff,_0x56ef70,_0x1cda71){var _0x238e0b={'agent':{},'channel':_0x69af('0x57')};if(_0x3f0aff[_0x69af('0x53')]['id']){delete _0x3f0aff[_0x69af('0x53')]['id'];}_0x3f0aff[_0x69af('0x53')]['UserId']=_0x3f0aff['body']['UserId']||_0x3f0aff['user']['id'];_0x238e0b['agent']['id']=_0x3f0aff[_0x69af('0x53')][_0x69af('0x5b')];return db['SmsMessage']['find']({'where':{'id':_0x3f0aff[_0x69af('0x4d')]['id'],'UserId':null}})[_0x69af('0x20')](handleEntityNotFound(_0x56ef70,null))[_0x69af('0x20')](function(_0x1d5c99){if(_0x1d5c99){_0x238e0b['message']=_0x1d5c99[_0x69af('0x5e')]({'plain':!![]});return db[_0x69af('0x5f')]['find']({'where':{'id':_0x1d5c99[_0x69af('0x60')]}});}return null;})[_0x69af('0x20')](handleEntityNotFound(_0x56ef70,null))[_0x69af('0x20')](function(_0x245f22){if(_0x245f22){_0x238e0b['interaction']=_0x245f22['get']({'plain':!![]});interaction_log[_0x69af('0x21')](_0x69af('0x76'),_0x3f0aff[_0x69af('0x5c')]['id'],_0x3f0aff[_0x69af('0x5c')][_0x69af('0x35')],_0x3f0aff[_0x69af('0x5c')]['role'],_0x238e0b[_0x69af('0x63')]['id'],_0x3f0aff[_0x69af('0x53')]?JSON[_0x69af('0x66')](_0x3f0aff['body']):_0x69af('0x67'));return respondWithRpcPromise('RejectMessage',_0x69af('0x77'),_0x238e0b);}return null;})['then'](function(_0x3690eb){var _0x40a7ff=_0x69af('0x78')+_0x3690eb[_0x69af('0x27')]['ContactId'];return db[_0x69af('0x6b')][_0x69af('0x3b')](_0x40a7ff,{'type':db[_0x69af('0x6c')][_0x69af('0x6d')][_0x69af('0x6e')],'raw':!![]})[_0x69af('0x20')](function(_0x3e14a2){return _0x3e14a2;});})[_0x69af('0x20')](function(_0x3264d4){if(_0x3264d4){_0x238e0b[_0x69af('0x27')][_0x69af('0x79')]=_0x3264d4[0x0];if(!_0x3f0aff[_0x69af('0x53')][_0x69af('0x5b')])return;return db[_0x69af('0x7a')][_0x69af('0x51')]({'where':{'id':_0x3f0aff['body'][_0x69af('0x5b')],'role':_0x69af('0x5d')},'attributes':['id',_0x69af('0x35'),_0x69af('0x7b'),_0x69af('0x6f'),_0x69af('0x7c')],'raw':!![]});}return null;})[_0x69af('0x20')](function(_0x4bb928){if(!_0x4bb928)return null;_0x238e0b[_0x69af('0x27')]['agent']=_0x4bb928;return _0x238e0b;})[_0x69af('0x20')](function(_0xe01d24){if(_0xe01d24){_0xe01d24[_0x69af('0x27')][_0x69af('0x71')]=util[_0x69af('0x59')](_0x69af('0x7d'),_0x3f0aff['user'][_0x69af('0x35')]);_0xe01d24[_0x69af('0x27')][_0x69af('0x72')]=_0x238e0b[_0x69af('0x72')];_0xe01d24[_0x69af('0x27')][_0x69af('0x7e')]=_0x238e0b[_0x69af('0x72')];_0xe01d24[_0x69af('0x27')][_0x69af('0x73')]=_0x69af('0x32');respondWithRpcPromise(_0x69af('0x74'),_0x69af('0x74'),{'event':_0x69af('0x7f'),'message':_0xe01d24['message']},client9002);return _0x238e0b;}return null;})[_0x69af('0x20')](respondWithResult(_0x56ef70,null))[_0x69af('0x29')](handleError(_0x56ef70,null));};exports[_0x69af('0x2a')]=function(_0x5a0896,_0xda37e3,_0x415452){if(_0x5a0896[_0x69af('0x53')]['id']){delete _0x5a0896[_0x69af('0x53')]['id'];}var _0x38d738;return db[_0x69af('0x50')][_0x69af('0x51')]({'where':{'id':_0x5a0896[_0x69af('0x4d')]['id']}})['then'](handleEntityNotFound(_0xda37e3,null))['then'](function(_0x131777){if(_0x131777){_0x38d738=_0x131777;return db[_0x69af('0x80')][_0x69af('0x51')]({'where':{'id':_0x131777['SmsAccountId']}});}})[_0x69af('0x20')](handleEntityNotFound(_0xda37e3,null))[_0x69af('0x20')](function(_0x42c195){if(_0x42c195){logger[_0x69af('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x69af('0x2a'),_0x69af('0x81'),_0x42c195[_0x69af('0x82')],util[_0x69af('0x83')](_0x5a0896[_0x69af('0x53')],{'showHidden':![],'depth':null}));switch(_0x42c195[_0x69af('0x82')]){case _0x69af('0x84'):if(_0x5a0896['body'][_0x69af('0x85')]&&_0x5a0896[_0x69af('0x53')][_0x69af('0x85')]===_0x38d738['messageId']){return _0x38d738[_0x69af('0x33')]({'read':!![]});}else{logger[_0x69af('0x26')](_0x69af('0x86'),_0x69af('0x2a'),_0x69af('0x84'),util[_0x69af('0x83')](_0x5a0896[_0x69af('0x53')],{'showHidden':![],'depth':null}));}break;case _0x69af('0x87'):if(_0x5a0896[_0x69af('0x53')][_0x69af('0x88')]&&_0x5a0896[_0x69af('0x53')][_0x69af('0x88')]===_0x38d738[_0x69af('0x89')]&&_[_0x69af('0x8a')]([_0x69af('0x8b'),_0x69af('0x8c')],_0x5a0896[_0x69af('0x53')][_0x69af('0x8d')])>=0x0){return _0x38d738[_0x69af('0x33')]({'read':!![]});}else{logger['error'](_0x69af('0x86'),_0x69af('0x2a'),_0x69af('0x8e'),util[_0x69af('0x83')](_0x5a0896[_0x69af('0x53')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3d1abb=_0x5a0896[_0x69af('0x53')][_0x69af('0x8f')][0x0];if(_0x3d1abb[_0x69af('0x2a')][_0x69af('0x90')]===_0x69af('0x91')){return _0x38d738[_0x69af('0x33')]({'read':!![]});}else{logger[_0x69af('0x26')](_0x69af('0x86'),_0x69af('0x2a'),_0x69af('0x92'),util[_0x69af('0x83')](_0x5a0896[_0x69af('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x38d738;}})[_0x69af('0x20')](respondWithResult(_0xda37e3,null))[_0x69af('0x29')](handleError(_0xda37e3,null));}; \ No newline at end of file +var _0x0b7f=['crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','options','SmsMessage','include','findAll','rows','show','params','includeAll','find','create','body','destroy','describe','../../config/logger','sms-interactions','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','format','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','stringify','null','rejectMessage','QueryTypes','contact','interface','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','DELIVERED','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xa2f7a1,_0x27fc70){var _0x2797e7=function(_0x4ec59f){while(--_0x4ec59f){_0xa2f7a1['push'](_0xa2f7a1['shift']());}};_0x2797e7(++_0x27fc70);}(_0x0b7f,0x115));var _0xf0b7=function(_0x4d5c85,_0x153f30){_0x4d5c85=_0x4d5c85-0x0;var _0x330b70=_0x0b7f[_0x4d5c85];return _0x330b70;};'use strict';var emlformat=require(_0xf0b7('0x0'));var rimraf=require(_0xf0b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0b7('0x2'));var rp=require('request-promise');var moment=require(_0xf0b7('0x3'));var BPromise=require(_0xf0b7('0x4'));var Mustache=require(_0xf0b7('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf0b7('0x6'));var csv=require(_0xf0b7('0x7'));var ejs=require(_0xf0b7('0x8'));var fs=require('fs');var fs_extra=require(_0xf0b7('0x9'));var _=require(_0xf0b7('0xa'));var squel=require('squel');var crypto=require(_0xf0b7('0xb'));var jsforce=require(_0xf0b7('0xc'));var deskjs=require(_0xf0b7('0xd'));var toCsv=require(_0xf0b7('0x7'));var querystring=require(_0xf0b7('0xe'));var Papa=require('papaparse');var Redis=require(_0xf0b7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0b7('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf0b7('0x11'));var config=require(_0xf0b7('0x12'));var licenseUtil=require(_0xf0b7('0x13'));var db=require(_0xf0b7('0x14'))['db'];config[_0xf0b7('0x15')]=_[_0xf0b7('0x16')](config[_0xf0b7('0x15')],{'host':_0xf0b7('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf0b7('0x18'))[_0xf0b7('0x19')](socket);var jayson=require(_0xf0b7('0x1a'));var client=jayson[_0xf0b7('0x1b')][_0xf0b7('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xf0b7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5c462,_0xfc8661,_0x1ac5d2,_0x5b33fc){return new BPromise(function(_0x303db6,_0x446164){var _0x1e8825=_0x5b33fc||client;return _0x1e8825[_0xf0b7('0x1d')](_0x5c462,_0x1ac5d2)['then'](function(_0x1e5fc9){logger[_0xf0b7('0x1e')](_0xf0b7('0x1f'),_0xfc8661,_0xf0b7('0x20'));logger[_0xf0b7('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc8661,_0xf0b7('0x20'),JSON['stringify'](_0x1e5fc9));if(_0x1e5fc9[_0xf0b7('0x22')]){if(_0x1e5fc9[_0xf0b7('0x22')][_0xf0b7('0x23')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0xfc8661,_0x1e5fc9[_0xf0b7('0x22')][_0xf0b7('0x24')]);return _0x446164(_0x1e5fc9[_0xf0b7('0x22')][_0xf0b7('0x24')]);}logger[_0xf0b7('0x22')](_0xf0b7('0x1f'),_0xfc8661,_0x1e5fc9[_0xf0b7('0x22')][_0xf0b7('0x24')]);return _0x303db6(_0x1e5fc9[_0xf0b7('0x22')]['message']);}else{logger[_0xf0b7('0x1e')](_0xf0b7('0x1f'),_0xfc8661,_0xf0b7('0x20'));_0x303db6(_0x1e5fc9[_0xf0b7('0x25')][_0xf0b7('0x24')]);}})[_0xf0b7('0x26')](function(_0x4724f1){logger[_0xf0b7('0x22')](_0xf0b7('0x1f'),_0xfc8661,_0x4724f1);_0x446164(_0x4724f1);});});}function respondWithStatusCode(_0x2c273e,_0x4c8e0d){_0x4c8e0d=_0x4c8e0d||0xcc;return function(_0xcf4de9){if(_0xcf4de9){return _0x2c273e[_0xf0b7('0x27')](_0x4c8e0d);}return _0x2c273e['status'](_0x4c8e0d)[_0xf0b7('0x28')]();};}function respondWithResult(_0x1b58bb,_0x3709a5){_0x3709a5=_0x3709a5||0xc8;return function(_0x55909c){if(_0x55909c){return _0x1b58bb[_0xf0b7('0x29')](_0x3709a5)[_0xf0b7('0x2a')](_0x55909c);}};}function respondWithFilteredResult(_0x131097,_0x4fda93){return function(_0x1cf15d){if(_0x1cf15d){var _0x2773ce=typeof _0x4fda93[_0xf0b7('0x2b')]===_0xf0b7('0x2c')&&typeof _0x4fda93[_0xf0b7('0x2d')]===_0xf0b7('0x2c');var _0x10643f=_0x1cf15d[_0xf0b7('0x2e')];var _0x3cb0ef=_0x2773ce?0x0:_0x4fda93[_0xf0b7('0x2b')];var _0x559510=_0x2773ce?_0x1cf15d[_0xf0b7('0x2e')]:_0x4fda93[_0xf0b7('0x2b')]+_0x4fda93[_0xf0b7('0x2d')];var _0x4df287;if(_0x559510>=_0x10643f){_0x559510=_0x10643f;_0x4df287=0xc8;}else{_0x4df287=0xce;}_0x131097[_0xf0b7('0x29')](_0x4df287);return _0x131097[_0xf0b7('0x2f')](_0xf0b7('0x30'),_0x3cb0ef+'-'+_0x559510+'/'+_0x10643f)[_0xf0b7('0x2a')](_0x1cf15d);}return null;};}function patchUpdates(_0x10b42c){return function(_0x2c5f82){try{jsonpatch[_0xf0b7('0x31')](_0x2c5f82,_0x10b42c,!![]);}catch(_0x10e670){return BPromise[_0xf0b7('0x32')](_0x10e670);}return _0x2c5f82['save']();};}function saveUpdates(_0x234e54,_0x5a95e2){return function(_0x479e87){if(_0x479e87){return _0x479e87[_0xf0b7('0x33')](_0x234e54)['then'](function(_0xa67a2){return _0xa67a2;});}return null;};}function removeEntity(_0x3bc56f,_0x6e83b){return function(_0x14f9de){if(_0x14f9de){return _0x14f9de['destroy']()[_0xf0b7('0x34')](function(){_0x3bc56f[_0xf0b7('0x29')](0xcc)[_0xf0b7('0x28')]();});}};}function handleEntityNotFound(_0x200085,_0x4f979f){return function(_0x1f9c7a){if(!_0x1f9c7a){_0x200085['sendStatus'](0x194);}return _0x1f9c7a;};}function handleError(_0x5c98ac,_0x47c4a9){_0x47c4a9=_0x47c4a9||0x1f4;return function(_0x53fccc){logger['error'](_0x53fccc[_0xf0b7('0x35')]);if(_0x53fccc[_0xf0b7('0x36')]){delete _0x53fccc[_0xf0b7('0x36')];}_0x5c98ac[_0xf0b7('0x29')](_0x47c4a9)[_0xf0b7('0x37')](_0x53fccc);};}exports[_0xf0b7('0x38')]=function(_0x3b105c,_0x299ebf){var _0x2538b5={},_0x503599={},_0x19894c={'count':0x0,'rows':[]};var _0x586778=_[_0xf0b7('0x39')](db['SmsMessage'][_0xf0b7('0x3a')],function(_0x364b24){return{'name':_0x364b24[_0xf0b7('0x3b')],'type':_0x364b24['type'][_0xf0b7('0x3c')]};});_0x503599[_0xf0b7('0x3d')]=_[_0xf0b7('0x39')](_0x586778,'name');_0x503599[_0xf0b7('0x3e')]=_[_0xf0b7('0x3f')](_0x3b105c[_0xf0b7('0x3e')]);_0x503599[_0xf0b7('0x40')]=_[_0xf0b7('0x41')](_0x503599[_0xf0b7('0x3d')],_0x503599[_0xf0b7('0x3e')]);_0x2538b5[_0xf0b7('0x42')]=_['intersection'](_0x503599[_0xf0b7('0x3d')],qs[_0xf0b7('0x43')](_0x3b105c[_0xf0b7('0x3e')][_0xf0b7('0x43')]));_0x2538b5[_0xf0b7('0x42')]=_0x2538b5[_0xf0b7('0x42')][_0xf0b7('0x44')]?_0x2538b5[_0xf0b7('0x42')]:_0x503599[_0xf0b7('0x3d')];if(!_0x3b105c['query'][_0xf0b7('0x45')](_0xf0b7('0x46'))){_0x2538b5[_0xf0b7('0x2d')]=qs[_0xf0b7('0x2d')](_0x3b105c['query']['limit']);_0x2538b5[_0xf0b7('0x2b')]=qs[_0xf0b7('0x2b')](_0x3b105c[_0xf0b7('0x3e')][_0xf0b7('0x2b')]);}_0x2538b5['order']=qs[_0xf0b7('0x47')](_0x3b105c[_0xf0b7('0x3e')][_0xf0b7('0x47')]);_0x2538b5[_0xf0b7('0x48')]=qs[_0xf0b7('0x40')](_['pick'](_0x3b105c[_0xf0b7('0x3e')],_0x503599[_0xf0b7('0x40')]),_0x586778);if(_0x3b105c['query']['filter']){_0x2538b5[_0xf0b7('0x48')]=_[_0xf0b7('0x49')](_0x2538b5[_0xf0b7('0x48')],{'$or':_[_0xf0b7('0x39')](_0x586778,function(_0x5191f2){if(_0x5191f2[_0xf0b7('0x4a')]!==_0xf0b7('0x4b')){var _0x373c1d={};_0x373c1d[_0x5191f2[_0xf0b7('0x36')]]={'$like':'%'+_0x3b105c[_0xf0b7('0x3e')]['filter']+'%'};return _0x373c1d;}})});}_0x2538b5=_[_0xf0b7('0x49')]({},_0x2538b5,_0x3b105c[_0xf0b7('0x4c')]);var _0x478db2={'where':_0x2538b5[_0xf0b7('0x48')]};return db[_0xf0b7('0x4d')][_0xf0b7('0x2e')](_0x478db2)['then'](function(_0x3324b1){_0x19894c[_0xf0b7('0x2e')]=_0x3324b1;if(_0x3b105c[_0xf0b7('0x3e')]['includeAll']){_0x2538b5[_0xf0b7('0x4e')]=[{'all':!![]}];}return db[_0xf0b7('0x4d')][_0xf0b7('0x4f')](_0x2538b5);})[_0xf0b7('0x34')](function(_0x1f6a48){_0x19894c[_0xf0b7('0x50')]=_0x1f6a48;return _0x19894c;})[_0xf0b7('0x34')](respondWithFilteredResult(_0x299ebf,_0x2538b5))[_0xf0b7('0x26')](handleError(_0x299ebf,null));};exports[_0xf0b7('0x51')]=function(_0x36cd4c,_0x3809a1){var _0x1c8ce5={'raw':!![],'where':{'id':_0x36cd4c[_0xf0b7('0x52')]['id']}},_0x535653={};_0x535653[_0xf0b7('0x3d')]=_[_0xf0b7('0x3f')](db[_0xf0b7('0x4d')]['rawAttributes']);_0x535653['query']=_[_0xf0b7('0x3f')](_0x36cd4c[_0xf0b7('0x3e')]);_0x535653[_0xf0b7('0x40')]=_[_0xf0b7('0x41')](_0x535653[_0xf0b7('0x3d')],_0x535653[_0xf0b7('0x3e')]);_0x1c8ce5[_0xf0b7('0x42')]=_['intersection'](_0x535653['model'],qs[_0xf0b7('0x43')](_0x36cd4c['query']['fields']));_0x1c8ce5[_0xf0b7('0x42')]=_0x1c8ce5[_0xf0b7('0x42')]['length']?_0x1c8ce5[_0xf0b7('0x42')]:_0x535653['model'];if(_0x36cd4c[_0xf0b7('0x3e')][_0xf0b7('0x53')]){_0x1c8ce5[_0xf0b7('0x4e')]=[{'all':!![]}];}_0x1c8ce5=_[_0xf0b7('0x49')]({},_0x1c8ce5,_0x36cd4c[_0xf0b7('0x4c')]);return db[_0xf0b7('0x4d')][_0xf0b7('0x54')](_0x1c8ce5)[_0xf0b7('0x34')](handleEntityNotFound(_0x3809a1,null))[_0xf0b7('0x34')](respondWithResult(_0x3809a1,null))['catch'](handleError(_0x3809a1,null));};exports['create']=function(_0x17ed74,_0x5b0865){return db[_0xf0b7('0x4d')][_0xf0b7('0x55')](_0x17ed74[_0xf0b7('0x56')],{})[_0xf0b7('0x34')](respondWithResult(_0x5b0865,0xc9))[_0xf0b7('0x26')](handleError(_0x5b0865,null));};exports[_0xf0b7('0x33')]=function(_0x379d6f,_0xbc3e53){if(_0x379d6f['body']['id']){delete _0x379d6f[_0xf0b7('0x56')]['id'];}return db[_0xf0b7('0x4d')][_0xf0b7('0x54')]({'where':{'id':_0x379d6f[_0xf0b7('0x52')]['id']}})['then'](handleEntityNotFound(_0xbc3e53,null))['then'](saveUpdates(_0x379d6f[_0xf0b7('0x56')],null))[_0xf0b7('0x34')](respondWithResult(_0xbc3e53,null))[_0xf0b7('0x26')](handleError(_0xbc3e53,null));};exports[_0xf0b7('0x57')]=function(_0x56c286,_0x45b44c){return db[_0xf0b7('0x4d')]['find']({'where':{'id':_0x56c286[_0xf0b7('0x52')]['id']}})['then'](handleEntityNotFound(_0x45b44c,null))[_0xf0b7('0x34')](removeEntity(_0x45b44c,null))[_0xf0b7('0x26')](handleError(_0x45b44c,null));};exports[_0xf0b7('0x58')]=function(_0x42dcf1,_0xf4f7aa){return db[_0xf0b7('0x4d')][_0xf0b7('0x58')]()[_0xf0b7('0x34')](respondWithResult(_0xf4f7aa,null))['catch'](handleError(_0xf4f7aa,null));};var interaction_log=require(_0xf0b7('0x59'))(_0xf0b7('0x5a'));exports['accept']=function(_0x53a3fe,_0x142276,_0x2d40c8){var _0x389387={'agent':{},'channel':'sms'};if(_0x53a3fe[_0xf0b7('0x56')]['id']){delete _0x53a3fe['body']['id'];}_0x53a3fe[_0xf0b7('0x56')][_0xf0b7('0x5b')]=!![];_0x53a3fe[_0xf0b7('0x56')][_0xf0b7('0x5c')]=moment()['format'](_0xf0b7('0x5d'));_0x53a3fe[_0xf0b7('0x56')][_0xf0b7('0x5e')]=_0x53a3fe[_0xf0b7('0x56')]['UserId']||_0x53a3fe[_0xf0b7('0x5f')]['id'];_0x389387[_0xf0b7('0x60')]['id']=_0x53a3fe['body']['UserId'];return db[_0xf0b7('0x4d')][_0xf0b7('0x54')]({'where':{'id':_0x53a3fe[_0xf0b7('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x142276,null))[_0xf0b7('0x34')](saveUpdates(_0x53a3fe[_0xf0b7('0x56')],null))[_0xf0b7('0x34')](function(_0x4ccddd){if(_0x4ccddd){_0x389387[_0xf0b7('0x24')]=_0x4ccddd[_0xf0b7('0x61')]({'plain':!![]});return db['SmsInteraction'][_0xf0b7('0x54')]({'where':{'id':_0x4ccddd[_0xf0b7('0x62')]}});}return null;})[_0xf0b7('0x34')](handleEntityNotFound(_0x142276,null))[_0xf0b7('0x34')](function(_0x5253cf){if(_0x5253cf){return _0x5253cf['update']({'UserId':_0x53a3fe[_0xf0b7('0x56')][_0xf0b7('0x5e')],'read1stAt':_[_0xf0b7('0x63')](_0x5253cf[_0xf0b7('0x64')])?moment()[_0xf0b7('0x65')](_0xf0b7('0x5d')):undefined});}return null;})[_0xf0b7('0x34')](function(_0x2fd37f){if(_0x2fd37f){_0x389387['interaction']=_0x2fd37f['get']({'plain':!![]});interaction_log[_0xf0b7('0x1e')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53a3fe[_0xf0b7('0x5f')]['id'],_0x53a3fe[_0xf0b7('0x5f')][_0xf0b7('0x36')],_0x53a3fe[_0xf0b7('0x5f')][_0xf0b7('0x66')],_0x389387[_0xf0b7('0x67')]['id'],_0x53a3fe[_0xf0b7('0x56')]?JSON['stringify'](_0x53a3fe[_0xf0b7('0x56')]):'null');return respondWithRpcPromise(_0xf0b7('0x68'),_0xf0b7('0x69'),_0x389387);}return null;})['then'](function(_0x54e200){var _0x2573c2=_0xf0b7('0x6a')+_0x54e200['message']['ContactId'];return db[_0xf0b7('0x6b')][_0xf0b7('0x3e')](_0x2573c2,{'type':db[_0xf0b7('0x6c')]['QueryTypes'][_0xf0b7('0x6d')],'raw':!![]})[_0xf0b7('0x34')](function(_0x4fc443){return _0x4fc443;});})[_0xf0b7('0x34')](function(_0x639ce){if(_0x639ce){_0x389387[_0xf0b7('0x24')]['contact']=_0x639ce[0x0];if(!_0x53a3fe['body'][_0xf0b7('0x5e')])return;return db[_0xf0b7('0x6e')]['find']({'where':{'id':_0x53a3fe[_0xf0b7('0x56')][_0xf0b7('0x5e')],'role':_0xf0b7('0x60')},'attributes':['id',_0xf0b7('0x36'),_0xf0b7('0x6f'),_0xf0b7('0x70'),_0xf0b7('0x71')],'raw':!![]});}return null;})['then'](function(_0x38ef01){if(!_0x38ef01)return null;_0x389387[_0xf0b7('0x24')]['agent']=_0x38ef01;return _0x389387;})[_0xf0b7('0x34')](function(_0x2a1e29){if(_0x2a1e29){if(_0x53a3fe[_0xf0b7('0x56')][_0xf0b7('0x72')]){_0x389387[_0xf0b7('0x24')]['interface']=util[_0xf0b7('0x65')](_0xf0b7('0x73'),_0x53a3fe['user'][_0xf0b7('0x36')]);_0x389387[_0xf0b7('0x24')][_0xf0b7('0x74')]=_0x389387[_0xf0b7('0x74')];_0x389387['message'][_0xf0b7('0x75')]=_0x389387[_0xf0b7('0x74')];_0x389387[_0xf0b7('0x24')][_0xf0b7('0x76')]=_0xf0b7('0x77');return respondWithRpcPromise(_0xf0b7('0x78'),_0xf0b7('0x78'),{'event':'acceptmessage','message':_0x389387[_0xf0b7('0x24')]},client9002)[_0xf0b7('0x34')](function(){return _0x389387;});}return _0x389387;}return null;})[_0xf0b7('0x34')](respondWithResult(_0x142276,null))['catch'](handleError(_0x142276,null));};var interaction_log=require(_0xf0b7('0x59'))(_0xf0b7('0x5a'));exports['reject']=function(_0x1e0ada,_0x345f5d,_0x1e9311){var _0x5e01e2={'agent':{},'channel':'sms'};if(_0x1e0ada[_0xf0b7('0x56')]['id']){delete _0x1e0ada[_0xf0b7('0x56')]['id'];}_0x1e0ada[_0xf0b7('0x56')][_0xf0b7('0x5e')]=_0x1e0ada[_0xf0b7('0x56')]['UserId']||_0x1e0ada[_0xf0b7('0x5f')]['id'];_0x5e01e2['agent']['id']=_0x1e0ada[_0xf0b7('0x56')][_0xf0b7('0x5e')];return db[_0xf0b7('0x4d')][_0xf0b7('0x54')]({'where':{'id':_0x1e0ada[_0xf0b7('0x52')]['id'],'UserId':null}})[_0xf0b7('0x34')](handleEntityNotFound(_0x345f5d,null))[_0xf0b7('0x34')](function(_0x46426d){if(_0x46426d){_0x5e01e2[_0xf0b7('0x24')]=_0x46426d[_0xf0b7('0x61')]({'plain':!![]});return db['SmsInteraction'][_0xf0b7('0x54')]({'where':{'id':_0x46426d[_0xf0b7('0x62')]}});}return null;})[_0xf0b7('0x34')](handleEntityNotFound(_0x345f5d,null))[_0xf0b7('0x34')](function(_0x4c2070){if(_0x4c2070){_0x5e01e2[_0xf0b7('0x67')]=_0x4c2070[_0xf0b7('0x61')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1e0ada[_0xf0b7('0x5f')]['id'],_0x1e0ada[_0xf0b7('0x5f')]['name'],_0x1e0ada[_0xf0b7('0x5f')][_0xf0b7('0x66')],_0x5e01e2[_0xf0b7('0x67')]['id'],_0x1e0ada[_0xf0b7('0x56')]?JSON[_0xf0b7('0x79')](_0x1e0ada['body']):_0xf0b7('0x7a'));return respondWithRpcPromise('RejectMessage',_0xf0b7('0x7b'),_0x5e01e2);}return null;})[_0xf0b7('0x34')](function(_0x383d34){var _0x1a4e1d=_0xf0b7('0x6a')+_0x383d34[_0xf0b7('0x24')]['ContactId'];return db[_0xf0b7('0x6b')][_0xf0b7('0x3e')](_0x1a4e1d,{'type':db[_0xf0b7('0x6c')][_0xf0b7('0x7c')][_0xf0b7('0x6d')],'raw':!![]})[_0xf0b7('0x34')](function(_0x71d845){return _0x71d845;});})[_0xf0b7('0x34')](function(_0x2ff659){if(_0x2ff659){_0x5e01e2[_0xf0b7('0x24')][_0xf0b7('0x7d')]=_0x2ff659[0x0];if(!_0x1e0ada[_0xf0b7('0x56')][_0xf0b7('0x5e')])return;return db[_0xf0b7('0x6e')][_0xf0b7('0x54')]({'where':{'id':_0x1e0ada[_0xf0b7('0x56')][_0xf0b7('0x5e')],'role':_0xf0b7('0x60')},'attributes':['id',_0xf0b7('0x36'),_0xf0b7('0x6f'),_0xf0b7('0x70'),_0xf0b7('0x71')],'raw':!![]});}return null;})[_0xf0b7('0x34')](function(_0x5dd527){if(!_0x5dd527)return null;_0x5e01e2[_0xf0b7('0x24')][_0xf0b7('0x60')]=_0x5dd527;return _0x5e01e2;})[_0xf0b7('0x34')](function(_0x4af914){if(_0x4af914){_0x4af914['message'][_0xf0b7('0x7e')]=util[_0xf0b7('0x65')](_0xf0b7('0x73'),_0x1e0ada[_0xf0b7('0x5f')]['name']);_0x4af914['message'][_0xf0b7('0x74')]=_0x5e01e2[_0xf0b7('0x74')];_0x4af914['message']['motionChannel']=_0x5e01e2[_0xf0b7('0x74')];_0x4af914['message'][_0xf0b7('0x76')]=_0xf0b7('0x32');respondWithRpcPromise(_0xf0b7('0x78'),_0xf0b7('0x78'),{'event':'rejectmessage','message':_0x4af914[_0xf0b7('0x24')]},client9002);return _0x5e01e2;}return null;})[_0xf0b7('0x34')](respondWithResult(_0x345f5d,null))[_0xf0b7('0x26')](handleError(_0x345f5d,null));};exports[_0xf0b7('0x29')]=function(_0x1b2f13,_0x87f627,_0x43b376){if(_0x1b2f13[_0xf0b7('0x56')]['id']){delete _0x1b2f13['body']['id'];}var _0x3f0170;return db['SmsMessage'][_0xf0b7('0x54')]({'where':{'id':_0x1b2f13[_0xf0b7('0x52')]['id']}})[_0xf0b7('0x34')](handleEntityNotFound(_0x87f627,null))['then'](function(_0x36dfbd){if(_0x36dfbd){_0x3f0170=_0x36dfbd;return db[_0xf0b7('0x7f')][_0xf0b7('0x54')]({'where':{'id':_0x36dfbd[_0xf0b7('0x80')]}});}})[_0xf0b7('0x34')](handleEntityNotFound(_0x87f627,null))[_0xf0b7('0x34')](function(_0xdf9b7b){if(_0xdf9b7b){logger[_0xf0b7('0x21')](_0xf0b7('0x81'),'status',_0xf0b7('0x82'),_0xdf9b7b[_0xf0b7('0x4a')],util['inspect'](_0x1b2f13[_0xf0b7('0x56')],{'showHidden':![],'depth':null}));switch(_0xdf9b7b[_0xf0b7('0x4a')]){case _0xf0b7('0x83'):if(_0x1b2f13[_0xf0b7('0x56')]['MessageSid']&&_0x1b2f13[_0xf0b7('0x56')][_0xf0b7('0x84')]===_0x3f0170[_0xf0b7('0x85')]){return _0x3f0170['update']({'read':!![]});}else{logger[_0xf0b7('0x22')](_0xf0b7('0x86'),_0xf0b7('0x29'),_0xf0b7('0x83'),util[_0xf0b7('0x87')](_0x1b2f13[_0xf0b7('0x56')],{'showHidden':![],'depth':null}));}break;case _0xf0b7('0x88'):if(_0x1b2f13[_0xf0b7('0x56')][_0xf0b7('0x89')]&&_0x1b2f13[_0xf0b7('0x56')]['MessageUUID']===_0x3f0170[_0xf0b7('0x85')]&&_[_0xf0b7('0x8a')]([_0xf0b7('0x8b'),'delivered'],_0x1b2f13[_0xf0b7('0x56')][_0xf0b7('0x8c')])>=0x0){return _0x3f0170[_0xf0b7('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf0b7('0x29'),_0xf0b7('0x8d'),util[_0xf0b7('0x87')](_0x1b2f13[_0xf0b7('0x56')],{'showHidden':![],'depth':null}));}break;case _0xf0b7('0x8e'):var _0x128d2f=_0x1b2f13[_0xf0b7('0x56')]['results'][0x0];if(_0x128d2f[_0xf0b7('0x29')]['groupName']===_0xf0b7('0x8f')){return _0x3f0170['update']({'read':!![]});}else{logger[_0xf0b7('0x22')](_0xf0b7('0x86'),_0xf0b7('0x29'),_0xf0b7('0x8e'),util[_0xf0b7('0x87')](_0x1b2f13[_0xf0b7('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x3f0170;}})[_0xf0b7('0x34')](respondWithResult(_0x87f627,null))[_0xf0b7('0x26')](handleError(_0x87f627,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index b99516a..72c2379 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 _0x77e2=['SmsMessage','save','remove','emit','hook','exports'];(function(_0xafc531,_0x704502){var _0x470586=function(_0x5ee6d9){while(--_0x5ee6d9){_0xafc531['push'](_0xafc531['shift']());}};_0x470586(++_0x704502);}(_0x77e2,0x156));var _0x277e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77e2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x277e('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x277e('0x1'),'afterUpdate':'update','afterDestroy':_0x277e('0x2')};function emitEvent(_0x19a923){return function(_0x3678c2,_0x258894,_0x52f793){SmsMessageEvents['emit'](_0x19a923+':'+_0x3678c2['id'],_0x3678c2);SmsMessageEvents[_0x277e('0x3')](_0x19a923,_0x3678c2);_0x52f793(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x277e('0x4')](e,emitEvent(event));}}module[_0x277e('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x4994=['hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','remove'];(function(_0x539565,_0x59a72b){var _0x2e1c51=function(_0x54fdbe){while(--_0x54fdbe){_0x539565['push'](_0x539565['shift']());}};_0x2e1c51(++_0x59a72b);}(_0x4994,0x10c));var _0x4499=function(_0x336ebc,_0x5fa207){_0x336ebc=_0x336ebc-0x0;var _0x4f0bdd=_0x4994[_0x336ebc];return _0x4f0bdd;};'use strict';var EventEmitter=require(_0x4499('0x0'));var SmsMessage=require(_0x4499('0x1'))['db'][_0x4499('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4499('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4499('0x4')};function emitEvent(_0x411b43){return function(_0x1dab0d,_0x37a931,_0x268c19){SmsMessageEvents['emit'](_0x411b43+':'+_0x1dab0d['id'],_0x1dab0d);SmsMessageEvents['emit'](_0x411b43,_0x1dab0d);_0x268c19(null);};}for(var e in events){if(events[_0x4499('0x5')](e)){var event=events[e];SmsMessage[_0x4499('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index bd35b7d..f0740fd 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 _0x96d1=['/api/sms/messages/','/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','update','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','head','clickSend','plivo','remote','authId','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','read','Missing\x20parameters:\x20base_url','crypto','keys','sort','length','apiKey','md5','digest','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','apiMessageId','bandwidth','applicationId','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','util','../../config/logger','api','request-promise','path','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create'];(function(_0x42b5c8,_0x285462){var _0x366bbf=function(_0x27cf26){while(--_0x27cf26){_0x42b5c8['push'](_0x42b5c8['shift']());}};_0x366bbf(++_0x285462);}(_0x96d1,0x1a2));var _0x196d=function(_0x3fbb3e,_0x31fccf){_0x3fbb3e=_0x3fbb3e-0x0;var _0x29a97f=_0x96d1[_0x3fbb3e];return _0x29a97f;};'use strict';var _=require('lodash');var util=require(_0x196d('0x0'));var logger=require(_0x196d('0x1'))(_0x196d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x196d('0x3'));var fs=require('fs');var path=require(_0x196d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x196d('0x5'));module['exports']=function(_0x15fec4,_0x5a2fec){return _0x15fec4[_0x196d('0x6')](_0x196d('0x7'),attributes,{'tableName':_0x196d('0x8'),'paranoid':![],'indexes':[{'name':_0x196d('0x9'),'fields':['messageId']},{'name':_0x196d('0xa'),'fields':[_0x196d('0xb')],'type':_0x196d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc79311,_0x193aee,_0x56e5bb){var _0x140684=_0x15fec4[_0x196d('0xd')];var _0x288e67=_0xc79311[_0x196d('0xe')]({'plain':!![]});if(_0x288e67[_0x196d('0xf')][_0x196d('0x10')]()==='in'||_0x288e67['direction']['toLowerCase']()===_0x196d('0x11')&&!_0x288e67[_0x196d('0x12')]&&!_[_0x196d('0x13')](_0x288e67[_0x196d('0x14')])&&!_[_0x196d('0x13')](_0x288e67[_0x196d('0x15')])){_0x140684[_0x196d('0x16')][_0x196d('0x17')]({'where':{'id':_0x288e67[_0x196d('0x15')]}})[_0x196d('0x18')](function(_0xed56dc){if(_0xed56dc){_0xed56dc['update']({'lastMsgAt':_0x288e67[_0x196d('0x19')],'lastMsgDirection':_0x288e67['direction'][_0x196d('0x10')]()});}})[_0x196d('0x1a')](function(_0x30a50f){console[_0x196d('0x1b')](_0x30a50f);});}if(_0x288e67[_0x196d('0xf')]==='out'&&!_0x288e67[_0x196d('0x12')]){var _0x3d8383;_0x140684[_0x196d('0x1c')][_0x196d('0x1d')]({'where':{'id':_0x288e67[_0x196d('0x1e')]},'raw':!![]})[_0x196d('0x18')](function(_0x5e2978){_0x3d8383=_0x5e2978;if(_0x3d8383&&_0x3d8383[_0x196d('0x1f')]){switch(_0x3d8383['type']){case _0x196d('0x20'):var _0x3360bf=require(_0x196d('0x20'));if(_0x3d8383[_0x196d('0x21')]&&_0x3d8383[_0x196d('0x22')]&&_0x3d8383[_0x196d('0x23')]){var _0x28df4d=new _0x3360bf(_0x3d8383[_0x196d('0x21')],_0x3d8383[_0x196d('0x22')]);_0x28df4d[_0x196d('0x24')][_0x196d('0x25')]({'body':_0x288e67['body'],'to':_0x288e67[_0x196d('0x23')],'from':_0x3d8383['phone'],'statusCallback':_0x3d8383['remote']+_0x196d('0x26')+_0x288e67['id']+_0x196d('0x27')+_0x3d8383[_0x196d('0x28')]})['then'](function(_0x89851c){if(_0x89851c['sid']){return _0xc79311['update']({'messageId':_0x89851c['sid']});}})[_0x196d('0x1a')](function(_0x4b39dd){logger['error'](_0x196d('0x29'),_0x196d('0x2a'),'twilio',util[_0x196d('0x2b')](_0x4b39dd,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x20'),_0x196d('0x2c'));}break;case'skebby':var _0xfc26e6='https://api.skebby.it/API/v1.0/REST/';if(_0x3d8383[_0x196d('0x2d')]&&_0x3d8383[_0x196d('0x2e')]){var _0x30376f={'recipient':[_0x288e67[_0x196d('0x23')]],'message':_0x288e67[_0x196d('0xb')],'message_type':_0x3d8383[_0x196d('0x2f')]};if(_0x3d8383[_0x196d('0x2f')]&&_0x3d8383[_0x196d('0x2f')]!=='SI'){_0x30376f[_0x196d('0x30')]=_0x3d8383[_0x196d('0x23')];}var _0x5804d6={'url':_0xfc26e6+_0x196d('0x31')+_0x3d8383['username']+'&password='+_0x3d8383[_0x196d('0x2e')],'method':_0x196d('0x32')};rp(_0x5804d6)['then'](function(_0x23f009){var _0x277a04=_0x23f009[_0x196d('0x33')](';');var _0x3057a8={'user_key':_0x277a04[0x0],'session_key':_0x277a04[0x1]};_0x5804d6={'url':_0xfc26e6+_0x196d('0x34'),'method':_0x196d('0x35'),'headers':{'user_key':_0x3057a8[_0x196d('0x36')],'Session_key':_0x3057a8[_0x196d('0x37')]},'json':!![],'body':_0x30376f};return rp(_0x5804d6);})['then'](function(_0x409006){if(_0x409006[_0x196d('0x38')]>=0x1){var _0x2e9b0b={'messageId':_0x409006[_0x196d('0x39')]};if(_0x3d8383[_0x196d('0x2f')]!=='GP'||!_0x3d8383[_0x196d('0x3a')]){_0x2e9b0b['read']=!![];}return _0xc79311['update'](_0x2e9b0b);}else{return logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),'skebby',util[_0x196d('0x2b')](_0x409006,{'showHidden':![],'depth':null}));}})[_0x196d('0x1a')](function(_0x3b5254){return logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),'skebby',util[_0x196d('0x2b')](_0x3b5254,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x3b'),_0x196d('0x3c'));}break;case _0x196d('0x3d'):if(_0x3d8383[_0x196d('0x22')]){var _0x454dc6={'recipient':_0x288e67[_0x196d('0x23')],'message':_0x288e67['body'],'sender':_0x3d8383[_0x196d('0x3e')]||_0x3d8383[_0x196d('0x23')],'authorization':_0x3d8383['authToken']};var _0x193aee={'method':_0x196d('0x35'),'uri':_0x196d('0x3f'),'body':_0x454dc6,'json':!![]};rp(_0x193aee)['then'](function(_0x433928){var _0x2abb5c={'messageId':_0x433928[_0x196d('0x40')]};if(!_0x3d8383['deliveryReport']){_0x2abb5c['read']=!![];}return _0xc79311[_0x196d('0x41')](_0x2abb5c);})['catch'](function(_0x165e6d){logger[_0x196d('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196d('0x2a'),_0x196d('0x3d'),util[_0x196d('0x2b')](_0x165e6d,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')](_0x196d('0x29'),'afterCreate','connectel',_0x196d('0x42'));}break;case _0x196d('0x43'):if(_0x3d8383[_0x196d('0x2d')]&&_0x3d8383[_0x196d('0x2e')]){var _0x454dc6={'messages':[{'source':'xCALLY\x20Motion','to':_0x288e67[_0x196d('0x23')],'body':_0x288e67[_0x196d('0xb')],'from':_0x3d8383[_0x196d('0x3e')]||_0x3d8383['phone']}]};var _0x3a8cee=util[_0x196d('0x44')](_0x196d('0x45'),_0x3d8383[_0x196d('0x2d')],_0x3d8383['password']);var _0x193aee={'method':_0x196d('0x35'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x454dc6,'headers':{'Authorization':util[_0x196d('0x44')](_0x196d('0x46'),new Buffer(_0x3a8cee)[_0x196d('0x47')](_0x196d('0x48')))},'json':!![]};rp(_0x193aee)['then'](function(_0x518435){if(_0x518435[_0x196d('0x49')]>=0xc8&&_0x518435['http_code']<=0xce){if(_0x518435[_0x196d('0x4a')]&&_0x518435['data']['queued_count']>0x0){var _0x5e8251=_[_0x196d('0x4b')](_0x518435[_0x196d('0x4a')]['messages']);var _0x18590f={'messageId':_0x5e8251['message_id']};if(!_0x3d8383[_0x196d('0x3a')]){_0x18590f['read']=!![];}return _0xc79311[_0x196d('0x41')](_0x18590f);}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x4c'),util[_0x196d('0x2b')](_0x518435,{'showHidden':![],'depth':null}));}}else{logger[_0x196d('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x196d('0x2b')](_0x518435,{'showHidden':![],'depth':null}));}})[_0x196d('0x1a')](function(_0x48e9a7){logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x4c'),util['inspect'](_0x48e9a7,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x4c'),_0x196d('0x3c'));}break;case _0x196d('0x4d'):if(_0x3d8383['authId']&&_0x3d8383[_0x196d('0x22')]){var _0x454dc6={'dst':_0x288e67[_0x196d('0x23')],'text':_0x288e67[_0x196d('0xb')],'src':_0x3d8383[_0x196d('0x3e')]||_0x3d8383['phone'],'url':_0x3d8383[_0x196d('0x4e')]+'/api/sms/messages/'+_0x288e67['id']+_0x196d('0x27')+_0x3d8383[_0x196d('0x28')]};var _0x3a8cee=util[_0x196d('0x44')](_0x196d('0x45'),_0x3d8383[_0x196d('0x4f')],_0x3d8383['authToken']);var _0x193aee={'method':'POST','uri':util[_0x196d('0x44')](_0x196d('0x50'),_0x3d8383[_0x196d('0x4f')]),'body':_0x454dc6,'headers':{'Authorization':util[_0x196d('0x44')](_0x196d('0x46'),new Buffer(_0x3a8cee)[_0x196d('0x47')](_0x196d('0x48')))},'json':!![]};rp(_0x193aee)[_0x196d('0x18')](function(_0x9dd2f6){var _0x5da3f2={'messageId':_0x9dd2f6['message_uuid'][0x0]};return _0xc79311[_0x196d('0x41')](_0x5da3f2);})[_0x196d('0x1a')](function(_0x29ce89){logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x4d'),util['inspect'](_0x29ce89,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')](_0x196d('0x29'),'afterCreate',_0x196d('0x4d'),_0x196d('0x51'));}break;case _0x196d('0x52'):if(_0x3d8383[_0x196d('0x2d')]&&_0x3d8383[_0x196d('0x2e')]){if(_0x3d8383[_0x196d('0x53')]){var _0x70f535={'method':_0x196d('0x35'),'uri':_0x3d8383['baseUrl']+'/auth/1/session','body':{'username':_0x3d8383[_0x196d('0x2d')],'password':_0x3d8383['password']},'json':!![]};return rp(_0x70f535)['then'](function(_0x4c2db4){var _0x5b1230={'method':_0x196d('0x35'),'uri':_0x3d8383[_0x196d('0x53')]+_0x196d('0x54'),'body':{'messages':[{'from':_0x3d8383[_0x196d('0x23')],'destinations':[{'to':_0x288e67[_0x196d('0x23')]}],'text':_0x288e67[_0x196d('0xb')],'notifyUrl':_0x3d8383[_0x196d('0x4e')]+_0x196d('0x26')+_0x288e67['id']+_0x196d('0x27')+_0x3d8383[_0x196d('0x28')],'notifyContentType':_0x196d('0x55'),'callbackData':_0x3d8383[_0x196d('0x23')]+';'+_0x288e67[_0x196d('0xb')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x4c2db4[_0x196d('0x28')]},'json':!![]};return rp(_0x5b1230)[_0x196d('0x18')](function(_0x4a8f46){if(_0x4a8f46[_0x196d('0x24')]){var _0x59ecce={'messageId':_0x4a8f46[_0x196d('0x24')][0x0]['messageId']};if(!_0x3d8383['deliveryReport']){_0x59ecce[_0x196d('0x56')]=!![];}return _0xc79311[_0x196d('0x41')](_0x59ecce);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196d('0x2a'),_0x196d('0x52'),util['inspect'](_0x4a8f46,{'showHidden':![],'depth':null}));}});})[_0x196d('0x1a')](function(_0x2705ec){return logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),'infobip',util[_0x196d('0x2b')](_0x2705ec,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x52'),_0x196d('0x57'));}}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x4c96d8=require(_0x196d('0x58'));if(_0x3d8383['apiKey']){var _0x783b87={};_0x783b87['login']=_0x3d8383[_0x196d('0x2d')];_0x783b87[_0x196d('0x23')]=_0x288e67[_0x196d('0x23')];_0x783b87['sender']=_0x3d8383[_0x196d('0x23')];_0x783b87['text']=_0x288e67[_0x196d('0xb')];_0x783b87['timestamp']=+new Date();var _0x5a14d2='';var _0x10f18f='';var _0x64a155=Object[_0x196d('0x59')](_0x783b87);_0x64a155[_0x196d('0x5a')]();for(var _0x15d72c=0x0;_0x15d72c<_0x64a155[_0x196d('0x5b')];_0x15d72c++){if(_0x5a14d2!=''){_0x5a14d2+='&';}_0x5a14d2+=_0x64a155[_0x15d72c]+'='+encodeURIComponent(_0x783b87[_0x64a155[_0x15d72c]]);_0x10f18f+=_0x783b87[_0x64a155[_0x15d72c]];}_0x10f18f+=_0x3d8383[_0x196d('0x5c')];_0x10f18f=_0x4c96d8['createHash'](_0x196d('0x5d'))[_0x196d('0x41')](_0x10f18f)[_0x196d('0x5e')]('hex');if(_0x5a14d2!==''){_0x5a14d2+='&';}_0x5a14d2+=_0x196d('0x5f')+_0x10f18f;var _0x5804d6={'method':'GET','uri':_0x3d8383[_0x196d('0x53')]+_0x196d('0x60')+_0x5a14d2,'json':!![]};return rp(_0x5804d6)['then'](function(_0x1124d9){var _0x9e76a6=Object['keys'](_0x1124d9);if(_0x1124d9[_0x9e76a6[0x0]][_0x196d('0x1b')]&&parseInt(_0x1124d9[_0x9e76a6[0x0]][_0x196d('0x1b')])===0x0){var _0x5c4ae0={'messageId':_0x1124d9[_0x9e76a6[0x0]]['id_sms']};if(!_0x3d8383[_0x196d('0x3a')]){_0x5c4ae0[_0x196d('0x56')]=!![];}return _0xc79311[_0x196d('0x41')](_0x5c4ae0);}else{return logger[_0x196d('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196d('0x2a'),'csc',util[_0x196d('0x2b')](_0x1124d9[_0x196d('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3f435c){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196d('0x2a'),_0x196d('0x61'),util[_0x196d('0x2b')](_0x3f435c,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x61'),_0x196d('0x62'));}break;case _0x196d('0x63'):if(_0x3d8383[_0x196d('0x5c')]){var _0x411d35={'method':_0x196d('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3d8383[_0x196d('0x5c')]},'body':{'content':_0x288e67[_0x196d('0xb')],'to':[_0x288e67[_0x196d('0x23')]],'from':_0x3d8383[_0x196d('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0x196d('0x64')},'json':!![]};rp(_0x411d35)['then'](function(_0x5dae8e){if(!_0x5dae8e[_0x196d('0x1b')]){var _0x5c3232={'messageId':_0x5dae8e[_0x196d('0x24')][0x0][_0x196d('0x65')]};if(!_0x3d8383[_0x196d('0x3a')]){_0x5c3232[_0x196d('0x56')]=!![];}return _0xc79311[_0x196d('0x41')](_0x5c3232);}else{return logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),'clickatell',util[_0x196d('0x2b')](_0x5dae8e[_0x196d('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4cdd93){return logger[_0x196d('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196d('0x2a'),'clickatell',util[_0x196d('0x2b')](_0x4cdd93,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x63'),_0x196d('0x62'));}break;case _0x196d('0x66'):if(_0x3d8383[_0x196d('0x2d')]&&_0x3d8383['password']){var _0x3a8cee=util[_0x196d('0x44')]('%s:%s',_0x3d8383[_0x196d('0x2d')],_0x3d8383[_0x196d('0x2e')]);var _0x193aee={'method':_0x196d('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3d8383['accountId']+'/messages','body':{'to':[_0x288e67[_0x196d('0x23')]],'text':_0x288e67['body'],'from':_0x3d8383[_0x196d('0x23')],'applicationId':_0x3d8383[_0x196d('0x67')]},'headers':{'Authorization':util['format'](_0x196d('0x46'),new Buffer(_0x3a8cee)[_0x196d('0x47')](_0x196d('0x48')))},'json':!![]};rp(_0x193aee)[_0x196d('0x18')](function(_0x1e37d3){if(_0x1e37d3['id']){var _0x2454ca={'messageId':_0x1e37d3['id']};return _0xc79311[_0x196d('0x41')](_0x2454ca);}else{logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x66'),util['inspect'](_0x1e37d3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x7bd311){logger[_0x196d('0x1b')](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x66'),util[_0x196d('0x2b')](_0x7bd311,{'showHidden':![],'depth':null}));});}else{logger[_0x196d('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196d('0x2a'),'bandwidth',_0x196d('0x3c'));}break;case _0x196d('0x68'):if(_0x3d8383[_0x196d('0x5c')]){var _0x20e7c6={};var _0x5804d6={'method':_0x196d('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x196d('0x69')+_0x3d8383[_0x196d('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x3d8383['phone'],'to':_0x288e67['phone'],'text':_0x288e67[_0x196d('0xb')]},'json':!![]};return rp(_0x5804d6)[_0x196d('0x18')](function(_0x3bfb79){if(_0x3bfb79[_0x196d('0x6a')]==0xca){_0x20e7c6[_0x196d('0x6b')]=_0x3bfb79;var _0x108118={'method':_0x196d('0x35'),'uri':_0x196d('0x6c'),'headers':{'Authorization':_0x196d('0x69')+_0x3d8383[_0x196d('0x5c')],'Content-Type':_0x196d('0x55')},'body':{'refid':_0x20e7c6[_0x196d('0x6b')][_0x196d('0x6d')]},'json':!![]};return rp(_0x108118)[_0x196d('0x18')](function(_0x25c69a){_0x20e7c6[_0x196d('0x6e')]=_0x25c69a;var _0x4ac88f={'messageId':_0x20e7c6[_0x196d('0x6b')]['refid'],'read':!![]};return _0xc79311[_0x196d('0x41')](_0x4ac88f);});}else{return logger[_0x196d('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196d('0x2a'),_0x196d('0x68'),util[_0x196d('0x2b')](_0x3bfb79,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2412a3){return logger['error'](_0x196d('0x29'),_0x196d('0x2a'),_0x196d('0x68'),util[_0x196d('0x2b')](_0x2412a3,{'showHidden':![],'depth':null}));});}else{return logger[_0x196d('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',_0x196d('0x6f'));}break;}}})[_0x196d('0x70')](function(){_0x56e5bb();});}else{_0x56e5bb();}}},'charset':_0x196d('0x71'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x090d=['SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','authToken','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','authId','message_uuid','infobip','baseUrl','/auth/1/session','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','apiKey','text','timestamp','sort','length','createHash','md5','hex','signature=','GET','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','Bearer\x20','application/json','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','remote','/api/sms/messages/','/status?token=','token','sid','catch'];(function(_0x8bca3f,_0x158cf8){var _0x448ab5=function(_0x5b5537){while(--_0x5b5537){_0x8bca3f['push'](_0x8bca3f['shift']());}};_0x448ab5(++_0x158cf8);}(_0x090d,0xd0));var _0xd090=function(_0x1ad23e,_0x4472dd){_0x1ad23e=_0x1ad23e-0x0;var _0x5b3df9=_0x090d[_0x1ad23e];return _0x5b3df9;};'use strict';var _=require(_0xd090('0x0'));var util=require(_0xd090('0x1'));var logger=require(_0xd090('0x2'))(_0xd090('0x3'));var moment=require(_0xd090('0x4'));var BPromise=require(_0xd090('0x5'));var rp=require(_0xd090('0x6'));var fs=require('fs');var path=require(_0xd090('0x7'));var rimraf=require(_0xd090('0x8'));var config=require(_0xd090('0x9'));var attributes=require(_0xd090('0xa'));module[_0xd090('0xb')]=function(_0x57455d,_0x9ca24e){return _0x57455d[_0xd090('0xc')]('SmsMessage',attributes,{'tableName':_0xd090('0xd'),'paranoid':![],'indexes':[{'name':_0xd090('0xe'),'fields':[_0xd090('0xe')]},{'name':'fti_sms_messages','fields':[_0xd090('0xf')],'type':_0xd090('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54a919,_0x32a6b6,_0x436622){var _0x1b8f8e=_0x57455d[_0xd090('0x11')];var _0x15e854=_0x54a919[_0xd090('0x12')]({'plain':!![]});if(_0x15e854['direction'][_0xd090('0x13')]()==='in'||_0x15e854[_0xd090('0x14')][_0xd090('0x13')]()===_0xd090('0x15')&&!_0x15e854[_0xd090('0x16')]&&!_[_0xd090('0x17')](_0x15e854[_0xd090('0x18')])&&!_[_0xd090('0x17')](_0x15e854['SmsInteractionId'])){_0x1b8f8e[_0xd090('0x19')]['findOne']({'where':{'id':_0x15e854[_0xd090('0x1a')]}})[_0xd090('0x1b')](function(_0x7448){if(_0x7448){_0x7448[_0xd090('0x1c')]({'lastMsgAt':_0x15e854[_0xd090('0x1d')],'lastMsgDirection':_0x15e854[_0xd090('0x14')]['toLowerCase']()});}})['catch'](function(_0x53b509){console[_0xd090('0x1e')](_0x53b509);});}if(_0x15e854['direction']===_0xd090('0x15')&&!_0x15e854[_0xd090('0x16')]){var _0x5495e3;_0x1b8f8e[_0xd090('0x1f')][_0xd090('0x20')]({'where':{'id':_0x15e854[_0xd090('0x21')]},'raw':!![]})['then'](function(_0x5376b7){_0x5495e3=_0x5376b7;if(_0x5495e3&&_0x5495e3['type']){switch(_0x5495e3[_0xd090('0x22')]){case _0xd090('0x23'):var _0x444e1d=require(_0xd090('0x23'));if(_0x5495e3['accountSid']&&_0x5495e3['authToken']&&_0x5495e3['phone']){var _0x43d8ae=new _0x444e1d(_0x5495e3[_0xd090('0x24')],_0x5495e3['authToken']);_0x43d8ae['messages']['create']({'body':_0x15e854['body'],'to':_0x15e854[_0xd090('0x25')],'from':_0x5495e3[_0xd090('0x25')],'statusCallback':_0x5495e3[_0xd090('0x26')]+_0xd090('0x27')+_0x15e854['id']+_0xd090('0x28')+_0x5495e3[_0xd090('0x29')]})[_0xd090('0x1b')](function(_0x39e88a){if(_0x39e88a['sid']){return _0x54a919[_0xd090('0x1c')]({'messageId':_0x39e88a[_0xd090('0x2a')]});}})[_0xd090('0x2b')](function(_0xe14953){logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x23'),util[_0xd090('0x2e')](_0xe14953,{'showHidden':![],'depth':null}));});}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x23'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xd090('0x2f'):var _0x1819df=_0xd090('0x30');if(_0x5495e3[_0xd090('0x31')]&&_0x5495e3[_0xd090('0x32')]){var _0x2932c4={'recipient':[_0x15e854['phone']],'message':_0x15e854[_0xd090('0xf')],'message_type':_0x5495e3['smsMethod']};if(_0x5495e3[_0xd090('0x33')]&&_0x5495e3['smsMethod']!=='SI'){_0x2932c4[_0xd090('0x34')]=_0x5495e3[_0xd090('0x25')];}var _0x5efff9={'url':_0x1819df+'login?username='+_0x5495e3[_0xd090('0x31')]+_0xd090('0x35')+_0x5495e3[_0xd090('0x32')],'method':'GET'};rp(_0x5efff9)[_0xd090('0x1b')](function(_0x4e683a){var _0x40d350=_0x4e683a[_0xd090('0x36')](';');var _0x459b84={'user_key':_0x40d350[0x0],'session_key':_0x40d350[0x1]};_0x5efff9={'url':_0x1819df+_0xd090('0x37'),'method':_0xd090('0x38'),'headers':{'user_key':_0x459b84[_0xd090('0x39')],'Session_key':_0x459b84[_0xd090('0x3a')]},'json':!![],'body':_0x2932c4};return rp(_0x5efff9);})['then'](function(_0x46f24b){if(_0x46f24b[_0xd090('0x3b')]>=0x1){var _0x459b52={'messageId':_0x46f24b[_0xd090('0x3c')]};if(_0x5495e3[_0xd090('0x33')]!=='GP'||!_0x5495e3['deliveryReport']){_0x459b52[_0xd090('0x3d')]=!![];}return _0x54a919[_0xd090('0x1c')](_0x459b52);}else{return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),'skebby',util[_0xd090('0x2e')](_0x46f24b,{'showHidden':![],'depth':null}));}})[_0xd090('0x2b')](function(_0x359731){return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x2f'),util[_0xd090('0x2e')](_0x359731,{'showHidden':![],'depth':null}));});}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),'skebby',_0xd090('0x3e'));}break;case _0xd090('0x3f'):if(_0x5495e3[_0xd090('0x40')]){var _0x282e3f={'recipient':_0x15e854[_0xd090('0x25')],'message':_0x15e854[_0xd090('0xf')],'sender':_0x5495e3['senderString']||_0x5495e3[_0xd090('0x25')],'authorization':_0x5495e3[_0xd090('0x40')]};var _0x32a6b6={'method':'POST','uri':_0xd090('0x41'),'body':_0x282e3f,'json':!![]};rp(_0x32a6b6)[_0xd090('0x1b')](function(_0x654477){var _0x2b9962={'messageId':_0x654477[_0xd090('0x42')]};if(!_0x5495e3[_0xd090('0x43')]){_0x2b9962[_0xd090('0x3d')]=!![];}return _0x54a919[_0xd090('0x1c')](_0x2b9962);})[_0xd090('0x2b')](function(_0x572123){logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),'connectel',util[_0xd090('0x2e')](_0x572123,{'showHidden':![],'depth':null}));});}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x3f'),_0xd090('0x44'));}break;case _0xd090('0x45'):if(_0x5495e3['username']&&_0x5495e3[_0xd090('0x32')]){var _0x282e3f={'messages':[{'source':_0xd090('0x46'),'to':_0x15e854[_0xd090('0x25')],'body':_0x15e854[_0xd090('0xf')],'from':_0x5495e3[_0xd090('0x47')]||_0x5495e3['phone']}]};var _0x24418b=util[_0xd090('0x48')](_0xd090('0x49'),_0x5495e3[_0xd090('0x31')],_0x5495e3['password']);var _0x32a6b6={'method':_0xd090('0x38'),'uri':_0xd090('0x4a'),'body':_0x282e3f,'headers':{'Authorization':util[_0xd090('0x48')](_0xd090('0x4b'),new Buffer(_0x24418b)[_0xd090('0x4c')](_0xd090('0x4d')))},'json':!![]};rp(_0x32a6b6)[_0xd090('0x1b')](function(_0x1e51cd){if(_0x1e51cd[_0xd090('0x4e')]>=0xc8&&_0x1e51cd[_0xd090('0x4e')]<=0xce){if(_0x1e51cd[_0xd090('0x4f')]&&_0x1e51cd[_0xd090('0x4f')][_0xd090('0x50')]>0x0){var _0x25e445=_[_0xd090('0x51')](_0x1e51cd[_0xd090('0x4f')]['messages']);var _0x1e8915={'messageId':_0x25e445[_0xd090('0x52')]};if(!_0x5495e3['deliveryReport']){_0x1e8915['read']=!![];}return _0x54a919[_0xd090('0x1c')](_0x1e8915);}else{logger['error'](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x53'),util[_0xd090('0x2e')](_0x1e51cd,{'showHidden':![],'depth':null}));}}else{logger[_0xd090('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd090('0x53'),util[_0xd090('0x2e')](_0x1e51cd,{'showHidden':![],'depth':null}));}})[_0xd090('0x2b')](function(_0x259387){logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),'clickSend',util[_0xd090('0x2e')](_0x259387,{'showHidden':![],'depth':null}));});}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),'afterCreate',_0xd090('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd090('0x54'):if(_0x5495e3['authId']&&_0x5495e3[_0xd090('0x40')]){var _0x282e3f={'dst':_0x15e854[_0xd090('0x25')],'text':_0x15e854[_0xd090('0xf')],'src':_0x5495e3[_0xd090('0x47')]||_0x5495e3['phone'],'url':_0x5495e3[_0xd090('0x26')]+_0xd090('0x27')+_0x15e854['id']+'/status?token='+_0x5495e3[_0xd090('0x29')]};var _0x24418b=util[_0xd090('0x48')](_0xd090('0x49'),_0x5495e3['authId'],_0x5495e3['authToken']);var _0x32a6b6={'method':_0xd090('0x38'),'uri':util[_0xd090('0x48')](_0xd090('0x55'),_0x5495e3[_0xd090('0x56')]),'body':_0x282e3f,'headers':{'Authorization':util[_0xd090('0x48')]('Basic\x20%s',new Buffer(_0x24418b)[_0xd090('0x4c')]('base64'))},'json':!![]};rp(_0x32a6b6)[_0xd090('0x1b')](function(_0x30775e){var _0x2534ec={'messageId':_0x30775e[_0xd090('0x57')][0x0]};return _0x54a919['update'](_0x2534ec);})[_0xd090('0x2b')](function(_0x5c1d8f){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd090('0x2d'),_0xd090('0x54'),util['inspect'](_0x5c1d8f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x54'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xd090('0x58'):if(_0x5495e3[_0xd090('0x31')]&&_0x5495e3[_0xd090('0x32')]){if(_0x5495e3[_0xd090('0x59')]){var _0x586d50={'method':'POST','uri':_0x5495e3[_0xd090('0x59')]+_0xd090('0x5a'),'body':{'username':_0x5495e3['username'],'password':_0x5495e3[_0xd090('0x32')]},'json':!![]};return rp(_0x586d50)[_0xd090('0x1b')](function(_0x977c74){var _0x3c610e={'method':_0xd090('0x38'),'uri':_0x5495e3[_0xd090('0x59')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5495e3[_0xd090('0x25')],'destinations':[{'to':_0x15e854[_0xd090('0x25')]}],'text':_0x15e854[_0xd090('0xf')],'notifyUrl':_0x5495e3[_0xd090('0x26')]+_0xd090('0x27')+_0x15e854['id']+'/status?token='+_0x5495e3[_0xd090('0x29')],'notifyContentType':'application/json','callbackData':_0x5495e3['phone']+';'+_0x15e854[_0xd090('0xf')]}]},'headers':{'Authorization':_0xd090('0x5b')+_0x977c74[_0xd090('0x29')]},'json':!![]};return rp(_0x3c610e)[_0xd090('0x1b')](function(_0x207a1b){if(_0x207a1b[_0xd090('0x5c')]){var _0x56c725={'messageId':_0x207a1b[_0xd090('0x5c')][0x0][_0xd090('0xe')]};if(!_0x5495e3[_0xd090('0x43')]){_0x56c725[_0xd090('0x3d')]=!![];}return _0x54a919[_0xd090('0x1c')](_0x56c725);}else{return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x58'),util[_0xd090('0x2e')](_0x207a1b,{'showHidden':![],'depth':null}));}});})[_0xd090('0x2b')](function(_0x25c18d){return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x58'),util[_0xd090('0x2e')](_0x25c18d,{'showHidden':![],'depth':null}));});}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x58'),_0xd090('0x5d'));}}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),'infobip',_0xd090('0x3e'));}break;case'csc':var _0x3a0878=require('crypto');if(_0x5495e3[_0xd090('0x5e')]){var _0x4215be={};_0x4215be['login']=_0x5495e3[_0xd090('0x31')];_0x4215be[_0xd090('0x25')]=_0x15e854[_0xd090('0x25')];_0x4215be['sender']=_0x5495e3[_0xd090('0x25')];_0x4215be[_0xd090('0x5f')]=_0x15e854['body'];_0x4215be[_0xd090('0x60')]=+new Date();var _0x3c6aed='';var _0x423514='';var _0x45a453=Object['keys'](_0x4215be);_0x45a453[_0xd090('0x61')]();for(var _0x2b1ff1=0x0;_0x2b1ff1<_0x45a453[_0xd090('0x62')];_0x2b1ff1++){if(_0x3c6aed!=''){_0x3c6aed+='&';}_0x3c6aed+=_0x45a453[_0x2b1ff1]+'='+encodeURIComponent(_0x4215be[_0x45a453[_0x2b1ff1]]);_0x423514+=_0x4215be[_0x45a453[_0x2b1ff1]];}_0x423514+=_0x5495e3['apiKey'];_0x423514=_0x3a0878[_0xd090('0x63')](_0xd090('0x64'))[_0xd090('0x1c')](_0x423514)['digest'](_0xd090('0x65'));if(_0x3c6aed!==''){_0x3c6aed+='&';}_0x3c6aed+=_0xd090('0x66')+_0x423514;var _0x5efff9={'method':_0xd090('0x67'),'uri':_0x5495e3[_0xd090('0x59')]+'/external/get/send.php?'+_0x3c6aed,'json':!![]};return rp(_0x5efff9)[_0xd090('0x1b')](function(_0xf15cbd){var _0x58a73d=Object[_0xd090('0x68')](_0xf15cbd);if(_0xf15cbd[_0x58a73d[0x0]][_0xd090('0x1e')]&&parseInt(_0xf15cbd[_0x58a73d[0x0]][_0xd090('0x1e')])===0x0){var _0x208b9d={'messageId':_0xf15cbd[_0x58a73d[0x0]][_0xd090('0x69')]};if(!_0x5495e3[_0xd090('0x43')]){_0x208b9d[_0xd090('0x3d')]=!![];}return _0x54a919['update'](_0x208b9d);}else{return logger[_0xd090('0x1e')](_0xd090('0x2c'),'afterCreate','csc',util[_0xd090('0x2e')](_0xf15cbd[_0xd090('0x1e')],{'showHidden':![],'depth':null}));}})[_0xd090('0x2b')](function(_0x5d9424){return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x6a'),util['inspect'](_0x5d9424,{'showHidden':![],'depth':null}));});}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x6a'),_0xd090('0x6b'));}break;case _0xd090('0x6c'):if(_0x5495e3[_0xd090('0x5e')]){var _0x343724={'method':_0xd090('0x38'),'uri':_0xd090('0x6d'),'headers':{'Authorization':_0x5495e3[_0xd090('0x5e')]},'body':{'content':_0x15e854['body'],'to':[_0x15e854[_0xd090('0x25')]],'from':_0x5495e3[_0xd090('0x25')],'binary':![],'clientMessageId':'uuid','charset':_0xd090('0x6e')},'json':!![]};rp(_0x343724)[_0xd090('0x1b')](function(_0x54650a){if(!_0x54650a[_0xd090('0x1e')]){var _0x362a33={'messageId':_0x54650a[_0xd090('0x5c')][0x0][_0xd090('0x6f')]};if(!_0x5495e3[_0xd090('0x43')]){_0x362a33[_0xd090('0x3d')]=!![];}return _0x54a919[_0xd090('0x1c')](_0x362a33);}else{return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x6c'),util['inspect'](_0x54650a[_0xd090('0x1e')],{'showHidden':![],'depth':null}));}})[_0xd090('0x2b')](function(_0xc89029){return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x6c'),util[_0xd090('0x2e')](_0xc89029,{'showHidden':![],'depth':null}));});}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),'afterCreate',_0xd090('0x6c'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x5495e3[_0xd090('0x31')]&&_0x5495e3[_0xd090('0x32')]){var _0x24418b=util[_0xd090('0x48')](_0xd090('0x49'),_0x5495e3[_0xd090('0x31')],_0x5495e3[_0xd090('0x32')]);var _0x32a6b6={'method':'POST','uri':_0xd090('0x70')+_0x5495e3[_0xd090('0x71')]+_0xd090('0x72'),'body':{'to':[_0x15e854[_0xd090('0x25')]],'text':_0x15e854[_0xd090('0xf')],'from':_0x5495e3[_0xd090('0x25')],'applicationId':_0x5495e3['applicationId']},'headers':{'Authorization':util[_0xd090('0x48')](_0xd090('0x4b'),new Buffer(_0x24418b)[_0xd090('0x4c')](_0xd090('0x4d')))},'json':!![]};rp(_0x32a6b6)['then'](function(_0x365aba){if(_0x365aba['id']){var _0x179e25={'messageId':_0x365aba['id']};return _0x54a919[_0xd090('0x1c')](_0x179e25);}else{logger['error'](_0xd090('0x2c'),'afterCreate','bandwidth',util[_0xd090('0x2e')](_0x365aba,{'showHidden':![],'depth':null}));}})[_0xd090('0x2b')](function(_0x1e686a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd090('0x73'),util[_0xd090('0x2e')](_0x1e686a,{'showHidden':![],'depth':null}));});}else{logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x73'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd090('0x74'):if(_0x5495e3['apiKey']){var _0x1798bc={};var _0x5efff9={'method':_0xd090('0x38'),'uri':_0xd090('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x5495e3[_0xd090('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x5495e3[_0xd090('0x25')],'to':_0x15e854['phone'],'text':_0x15e854[_0xd090('0xf')]},'json':!![]};return rp(_0x5efff9)[_0xd090('0x1b')](function(_0x172566){if(_0x172566['code']==0xca){_0x1798bc[_0xd090('0x76')]=_0x172566;var _0xe0cbf2={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xd090('0x77')+_0x5495e3[_0xd090('0x5e')],'Content-Type':_0xd090('0x78')},'body':{'refid':_0x1798bc[_0xd090('0x76')][_0xd090('0x79')]},'json':!![]};return rp(_0xe0cbf2)[_0xd090('0x1b')](function(_0xc9ef88){_0x1798bc[_0xd090('0x7a')]=_0xc9ef88;var _0x3c0ffc={'messageId':_0x1798bc[_0xd090('0x76')][_0xd090('0x79')],'read':!![]};return _0x54a919[_0xd090('0x1c')](_0x3c0ffc);});}else{return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),'intelepeer',util[_0xd090('0x2e')](_0x172566,{'showHidden':![],'depth':null}));}})[_0xd090('0x2b')](function(_0x48b908){return logger[_0xd090('0x1e')](_0xd090('0x2c'),_0xd090('0x2d'),_0xd090('0x74'),util['inspect'](_0x48b908,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd090('0x2c'),'afterCreate',_0xd090('0x74'),_0xd090('0x7b'));}break;}}})[_0xd090('0x7c')](function(){_0x436622();});}else{_0x436622();}}},'charset':'utf8mb4','collate':_0xd090('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 412695b..7480de6 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 _0x1bce=['request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','create','body','options','raw','CreateSmsMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x1bce,0x1e3));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe1bc('0x0'));var moment=require(_0xe1bc('0x1'));var BPromise=require('bluebird');var rs=require(_0xe1bc('0x2'));var fs=require('fs');var Redis=require(_0xe1bc('0x3'));var db=require(_0xe1bc('0x4'))['db'];var utils=require(_0xe1bc('0x5'));var logger=require(_0xe1bc('0x6'))(_0xe1bc('0x7'));var config=require(_0xe1bc('0x8'));var jayson=require(_0xe1bc('0x9'));var client=jayson[_0xe1bc('0xa')][_0xe1bc('0xb')]({'port':0x232a});config['redis']=_[_0xe1bc('0xc')](config[_0xe1bc('0xd')],{'host':_0xe1bc('0xe'),'port':0x18eb});var socket=require(_0xe1bc('0xf'))(new Redis(config['redis']));require(_0xe1bc('0x10'))[_0xe1bc('0x11')](socket);function respondWithRpcPromise(_0x34ddf9,_0x220b81,_0x47e4a6){return new BPromise(function(_0x3913f1,_0x385d2e){return client[_0xe1bc('0x12')](_0x34ddf9,_0x47e4a6)[_0xe1bc('0x13')](function(_0x2d3ed8){logger['info'](_0xe1bc('0x14'),_0x220b81,_0xe1bc('0x15'));logger[_0xe1bc('0x16')](_0xe1bc('0x17'),_0x220b81,'request\x20sent',JSON['stringify'](_0x2d3ed8));if(_0x2d3ed8[_0xe1bc('0x18')]){if(_0x2d3ed8['error'][_0xe1bc('0x19')]===0x1f4){logger[_0xe1bc('0x18')]('SmsMessage,\x20%s,\x20%s',_0x220b81,_0x2d3ed8[_0xe1bc('0x18')][_0xe1bc('0x1a')]);return _0x385d2e(_0x2d3ed8[_0xe1bc('0x18')][_0xe1bc('0x1a')]);}logger[_0xe1bc('0x18')](_0xe1bc('0x14'),_0x220b81,_0x2d3ed8[_0xe1bc('0x18')][_0xe1bc('0x1a')]);return _0x3913f1(_0x2d3ed8['error'][_0xe1bc('0x1a')]);}else{logger[_0xe1bc('0x1b')](_0xe1bc('0x14'),_0x220b81,'request\x20sent');_0x3913f1(_0x2d3ed8[_0xe1bc('0x1c')][_0xe1bc('0x1a')]);}})[_0xe1bc('0x1d')](function(_0x47fd65){logger[_0xe1bc('0x18')]('SmsMessage,\x20%s,\x20%s',_0x220b81,_0x47fd65);_0x385d2e(_0x47fd65);});});}exports['CreateSmsMessage']=function(_0x3a214f){var _0x4d3f4a=this;return new Promise(function(_0x48ad18,_0x51587c){return db['SmsMessage'][_0xe1bc('0x1e')](_0x3a214f[_0xe1bc('0x1f')],{'raw':_0x3a214f['options']?_0x3a214f[_0xe1bc('0x20')][_0xe1bc('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x2c968){logger[_0xe1bc('0x1b')]('CreateSmsMessage',_0x3a214f);logger[_0xe1bc('0x16')](_0xe1bc('0x22'),_0x3a214f,JSON[_0xe1bc('0x23')](_0x2c968));_0x48ad18(_0x2c968);})['catch'](function(_0x5b7cba){logger['error'](_0xe1bc('0x22'),_0x5b7cba[_0xe1bc('0x1a')],_0x3a214f);_0x51587c(_0x4d3f4a[_0xe1bc('0x18')](0x1f4,_0x5b7cba['message']));});});}; \ No newline at end of file +var _0x8dea=['redis','localhost','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSmsMessage','body','options','raw','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0x4132f2,_0x1c1f28){var _0x43d8f4=function(_0x1cdc02){while(--_0x1cdc02){_0x4132f2['push'](_0x4132f2['shift']());}};_0x43d8f4(++_0x1c1f28);}(_0x8dea,0x11c));var _0xa8de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8dea[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xa8de('0x0'));var moment=require(_0xa8de('0x1'));var BPromise=require(_0xa8de('0x2'));var rs=require(_0xa8de('0x3'));var fs=require('fs');var Redis=require(_0xa8de('0x4'));var db=require(_0xa8de('0x5'))['db'];var utils=require(_0xa8de('0x6'));var logger=require(_0xa8de('0x7'))(_0xa8de('0x8'));var config=require(_0xa8de('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa8de('0xa')][_0xa8de('0xb')]({'port':0x232a});config['redis']=_[_0xa8de('0xc')](config[_0xa8de('0xd')],{'host':_0xa8de('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8de('0xd')]));require(_0xa8de('0xf'))[_0xa8de('0x10')](socket);function respondWithRpcPromise(_0x3d83b1,_0x30eae9,_0x597d3c){return new BPromise(function(_0x44d571,_0x30b3d6){return client[_0xa8de('0x11')](_0x3d83b1,_0x597d3c)['then'](function(_0x560d77){logger[_0xa8de('0x12')](_0xa8de('0x13'),_0x30eae9,_0xa8de('0x14'));logger[_0xa8de('0x15')](_0xa8de('0x16'),_0x30eae9,_0xa8de('0x14'),JSON['stringify'](_0x560d77));if(_0x560d77['error']){if(_0x560d77[_0xa8de('0x17')][_0xa8de('0x18')]===0x1f4){logger[_0xa8de('0x17')](_0xa8de('0x13'),_0x30eae9,_0x560d77[_0xa8de('0x17')][_0xa8de('0x19')]);return _0x30b3d6(_0x560d77[_0xa8de('0x17')][_0xa8de('0x19')]);}logger['error'](_0xa8de('0x13'),_0x30eae9,_0x560d77[_0xa8de('0x17')]['message']);return _0x44d571(_0x560d77[_0xa8de('0x17')][_0xa8de('0x19')]);}else{logger[_0xa8de('0x12')](_0xa8de('0x13'),_0x30eae9,'request\x20sent');_0x44d571(_0x560d77['result'][_0xa8de('0x19')]);}})[_0xa8de('0x1a')](function(_0x3a1095){logger[_0xa8de('0x17')]('SmsMessage,\x20%s,\x20%s',_0x30eae9,_0x3a1095);_0x30b3d6(_0x3a1095);});});}exports[_0xa8de('0x1b')]=function(_0x50035b){var _0x1b26ab=this;return new Promise(function(_0x3a504b,_0x464f7c){return db['SmsMessage']['create'](_0x50035b[_0xa8de('0x1c')],{'raw':_0x50035b[_0xa8de('0x1d')]?_0x50035b[_0xa8de('0x1d')][_0xa8de('0x1e')]===undefined?!![]:![]:!![]})[_0xa8de('0x1f')](function(_0x5b2a24){logger[_0xa8de('0x12')]('CreateSmsMessage',_0x50035b);logger[_0xa8de('0x15')](_0xa8de('0x1b'),_0x50035b,JSON[_0xa8de('0x20')](_0x5b2a24));_0x3a504b(_0x5b2a24);})[_0xa8de('0x1a')](function(_0x42fedf){logger[_0xa8de('0x17')](_0xa8de('0x1b'),_0x42fedf[_0xa8de('0x19')],_0x50035b);_0x464f7c(_0x1b26ab['error'](0x1f4,_0x42fedf[_0xa8de('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 99abe32..1136c55 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 _0x31c1=['update','removeListener','register','length','smsMessage:','./smsMessage.events','remove'];(function(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0x31c1,0x108));var _0x131c=function(_0x4e6b13,_0x1c8a90){_0x4e6b13=_0x4e6b13-0x0;var _0x3ef334=_0x31c1[_0x4e6b13];return _0x3ef334;};'use strict';var SmsMessageEvents=require(_0x131c('0x0'));var events=['save',_0x131c('0x1'),_0x131c('0x2')];function createListener(_0x57d7a5,_0x2a622d){return function(_0x4120d7){_0x2a622d['emit'](_0x57d7a5,_0x4120d7);};}function removeListener(_0x3279b4,_0x28d4bd){return function(){SmsMessageEvents[_0x131c('0x3')](_0x3279b4,_0x28d4bd);};}exports[_0x131c('0x4')]=function(_0x29fded){for(var _0x2f2104=0x0,_0x404342=events[_0x131c('0x5')];_0x2f2104<_0x404342;_0x2f2104++){var _0x4ce0cf=events[_0x2f2104];var _0x19155c=createListener(_0x131c('0x6')+_0x4ce0cf,_0x29fded);SmsMessageEvents['on'](_0x4ce0cf,_0x19155c);}}; \ No newline at end of file +var _0x2138=['smsMessage:','save','update','emit','removeListener','register','length'];(function(_0x4a6719,_0x444fc5){var _0x36a0bd=function(_0x5e99f2){while(--_0x5e99f2){_0x4a6719['push'](_0x4a6719['shift']());}};_0x36a0bd(++_0x444fc5);}(_0x2138,0xb0));var _0x8213=function(_0x54d52c,_0x55b8d9){_0x54d52c=_0x54d52c-0x0;var _0x28f99e=_0x2138[_0x54d52c];return _0x28f99e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x8213('0x0'),'remove',_0x8213('0x1')];function createListener(_0x51f057,_0x49efdc){return function(_0x2dcb37){_0x49efdc[_0x8213('0x2')](_0x51f057,_0x2dcb37);};}function removeListener(_0x11d861,_0x235cd6){return function(){SmsMessageEvents[_0x8213('0x3')](_0x11d861,_0x235cd6);};}exports[_0x8213('0x4')]=function(_0x1034e4){for(var _0x3467d2=0x0,_0x5c0ed4=events[_0x8213('0x5')];_0x3467d2<_0x5c0ed4;_0x3467d2++){var _0x1289ec=events[_0x3467d2];var _0x16a40f=createListener(_0x8213('0x6')+_0x1289ec,_0x1034e4);SmsMessageEvents['on'](_0x1289ec,_0x16a40f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 80d0b73..8a50832 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 _0x81d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4e21fb,_0x1f8e4b){var _0x59e1cc=function(_0xf481b9){while(--_0xf481b9){_0x4e21fb['push'](_0x4e21fb['shift']());}};_0x59e1cc(++_0x1f8e4b);}(_0x81d7,0x72));var _0x781d=function(_0x5063b2,_0x59ebd2){_0x5063b2=_0x5063b2-0x0;var _0x16e911=_0x81d7[_0x5063b2];return _0x16e911;};'use strict';var multer=require(_0x781d('0x0'));var util=require(_0x781d('0x1'));var path=require(_0x781d('0x2'));var timeout=require(_0x781d('0x3'));var express=require(_0x781d('0x4'));var router=express[_0x781d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x781d('0x6'));var interaction=require(_0x781d('0x7'));var config=require(_0x781d('0x8'));var controller=require(_0x781d('0x9'));router['get']('/',auth[_0x781d('0xa')](),controller[_0x781d('0xb')]);router[_0x781d('0xc')](_0x781d('0xd'),auth['isAuthenticated'](),controller[_0x781d('0xe')]);router[_0x781d('0xc')](_0x781d('0xf'),auth[_0x781d('0xa')](),controller['show']);router[_0x781d('0xc')](_0x781d('0x10'),auth[_0x781d('0xa')](),controller['getMembers']);router[_0x781d('0xc')](_0x781d('0x11'),auth['isAuthenticated'](),controller[_0x781d('0x12')]);router[_0x781d('0xc')](_0x781d('0x13'),auth[_0x781d('0xa')](),controller[_0x781d('0x14')]);router[_0x781d('0x15')]('/',auth[_0x781d('0xa')](),controller[_0x781d('0x16')]);router['post'](_0x781d('0x11'),auth[_0x781d('0xa')](),controller[_0x781d('0x17')]);router[_0x781d('0x15')](_0x781d('0x13'),auth[_0x781d('0xa')](),controller[_0x781d('0x18')]);router['put'](_0x781d('0xf'),auth[_0x781d('0xa')](),controller[_0x781d('0x19')]);router[_0x781d('0x1a')](_0x781d('0xf'),auth[_0x781d('0xa')](),controller['destroy']);router[_0x781d('0x1a')]('/:id/teams',auth[_0x781d('0xa')](),controller[_0x781d('0x1b')]);router[_0x781d('0x1a')](_0x781d('0x13'),auth[_0x781d('0xa')](),controller[_0x781d('0x1c')]);module[_0x781d('0x1d')]=router; \ No newline at end of file +var _0x9641=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x9641,0x1c4));var _0x1964=function(_0x39ec3b,_0x853748){_0x39ec3b=_0x39ec3b-0x0;var _0x104228=_0x9641[_0x39ec3b];return _0x104228;};'use strict';var multer=require(_0x1964('0x0'));var util=require(_0x1964('0x1'));var path=require(_0x1964('0x2'));var timeout=require(_0x1964('0x3'));var express=require(_0x1964('0x4'));var router=express[_0x1964('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1964('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1964('0x7'));var controller=require(_0x1964('0x8'));router['get']('/',auth[_0x1964('0x9')](),controller[_0x1964('0xa')]);router[_0x1964('0xb')]('/describe',auth[_0x1964('0x9')](),controller[_0x1964('0xc')]);router['get'](_0x1964('0xd'),auth[_0x1964('0x9')](),controller[_0x1964('0xe')]);router[_0x1964('0xb')](_0x1964('0xf'),auth['isAuthenticated'](),controller[_0x1964('0x10')]);router[_0x1964('0xb')](_0x1964('0x11'),auth['isAuthenticated'](),controller[_0x1964('0x12')]);router[_0x1964('0xb')](_0x1964('0x13'),auth[_0x1964('0x9')](),controller[_0x1964('0x14')]);router[_0x1964('0x15')]('/',auth[_0x1964('0x9')](),controller[_0x1964('0x16')]);router[_0x1964('0x15')](_0x1964('0x11'),auth[_0x1964('0x9')](),controller['addTeams']);router[_0x1964('0x15')](_0x1964('0x13'),auth['isAuthenticated'](),controller[_0x1964('0x17')]);router[_0x1964('0x18')]('/:id',auth[_0x1964('0x9')](),controller['update']);router[_0x1964('0x19')](_0x1964('0xd'),auth['isAuthenticated'](),controller[_0x1964('0x1a')]);router[_0x1964('0x19')]('/:id/teams',auth[_0x1964('0x9')](),controller['removeTeams']);router[_0x1964('0x19')](_0x1964('0x13'),auth[_0x1964('0x9')](),controller[_0x1964('0x1b')]);module[_0x1964('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 12bf2af..5a29ef4 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 _0x247b=['sequelize','exports','name','ENUM','rrmemory','roundrobin'];(function(_0x2cd003,_0x16224b){var _0x38a245=function(_0x32c471){while(--_0x32c471){_0x2cd003['push'](_0x2cd003['shift']());}};_0x38a245(++_0x16224b);}(_0x247b,0xae));var _0xb247=function(_0x548097,_0x294480){_0x548097=_0x548097-0x0;var _0x3fb7ee=_0x247b[_0x548097];return _0x3fb7ee;};'use strict';var Sequelize=require(_0xb247('0x0'));module[_0xb247('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb247('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb247('0x3')](_0xb247('0x4'),'beepall',_0xb247('0x5'))}}; \ No newline at end of file +var _0x6da8=['exports','STRING','name','INTEGER','rrmemory','roundrobin','sequelize'];(function(_0xddb940,_0x414695){var _0x24ff00=function(_0x2c4699){while(--_0x2c4699){_0xddb940['push'](_0xddb940['shift']());}};_0x24ff00(++_0x414695);}(_0x6da8,0x1db));var _0x86da=function(_0x21c9f2,_0xb23867){_0x21c9f2=_0x21c9f2-0x0;var _0x168467=_0x6da8[_0x21c9f2];return _0x168467;};'use strict';var Sequelize=require(_0x86da('0x0'));module[_0x86da('0x1')]={'name':{'type':Sequelize[_0x86da('0x2')],'unique':_0x86da('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x86da('0x2')]},'timeout':{'type':Sequelize[_0x86da('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x86da('0x5'),'beepall',_0x86da('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 53f5573..c322810 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 _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x204d21,_0x5d3952){var _0x55df50=function(_0x52de7a){while(--_0x52de7a){_0x204d21['push'](_0x204d21['shift']());}};_0x55df50(++_0x5d3952);}(_0x5f2f,0x73));var _0xf5f2=function(_0x576270,_0x5f4cf1){_0x576270=_0x576270-0x0;var _0x3e01be=_0x5f2f[_0x576270];return _0x3e01be;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x503357,_0x1920f3){var _0x48ba12=function(_0x17b04b){while(--_0x17b04b){_0x503357['push'](_0x503357['shift']());}};_0x48ba12(++_0x1920f3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12f906,_0x56ec1e){_0x12f906=_0x12f906-0x0;var _0xafbc60=_0x5f2f[_0x12f906];return _0xafbc60;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 767f65f..485f152 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 _0xa66b=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xa66b,0x68));var _0xba66=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0xa66b[_0x589eb4];return _0xf50816;};'use strict';var EventEmitter=require(_0xba66('0x0'));var SmsQueue=require(_0xba66('0x1'))['db'][_0xba66('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xba66('0x3')](0x0);var events={'afterCreate':_0xba66('0x4'),'afterUpdate':_0xba66('0x5'),'afterDestroy':_0xba66('0x6')};function emitEvent(_0x161a46){return function(_0x491524,_0x5f3cde,_0xc01fbb){SmsQueueEvents[_0xba66('0x7')](_0x161a46+':'+_0x491524['id'],_0x491524);SmsQueueEvents[_0xba66('0x7')](_0x161a46,_0x491524);_0xc01fbb(null);};}for(var e in events){if(events[_0xba66('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xba66('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x7409=['emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x43a4c2,_0x4e400f){var _0x3cd4fb=function(_0x28ec58){while(--_0x28ec58){_0x43a4c2['push'](_0x43a4c2['shift']());}};_0x3cd4fb(++_0x4e400f);}(_0x7409,0x12f));var _0x9740=function(_0x57baa6,_0x3af298){_0x57baa6=_0x57baa6-0x0;var _0x303fbf=_0x7409[_0x57baa6];return _0x303fbf;};'use strict';var EventEmitter=require(_0x9740('0x0'));var SmsQueue=require(_0x9740('0x1'))['db'][_0x9740('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9740('0x3')](0x0);var events={'afterCreate':_0x9740('0x4'),'afterUpdate':_0x9740('0x5'),'afterDestroy':_0x9740('0x6')};function emitEvent(_0x56e798){return function(_0x4256f5,_0x4219ba,_0x6d0792){SmsQueueEvents['emit'](_0x56e798+':'+_0x4256f5['id'],_0x4256f5);SmsQueueEvents[_0x9740('0x7')](_0x56e798,_0x4256f5);_0x6d0792(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x9740('0x8')](e,emitEvent(event));}}module[_0x9740('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4866294..e9bbd39 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 _0xe837=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe837,0x1d3));var _0x7e83=function(_0x1d8a5d,_0x59a110){_0x1d8a5d=_0x1d8a5d-0x0;var _0x54d59f=_0xe837[_0x1d8a5d];return _0x54d59f;};'use strict';var _=require('lodash');var util=require(_0x7e83('0x0'));var logger=require(_0x7e83('0x1'))(_0x7e83('0x2'));var moment=require(_0x7e83('0x3'));var BPromise=require(_0x7e83('0x4'));var rp=require(_0x7e83('0x5'));var fs=require('fs');var path=require(_0x7e83('0x6'));var rimraf=require(_0x7e83('0x7'));var config=require(_0x7e83('0x8'));var attributes=require(_0x7e83('0x9'));module[_0x7e83('0xa')]=function(_0x53361d,_0x306f86){return _0x53361d['define'](_0x7e83('0xb'),attributes,{'tableName':_0x7e83('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8932=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','api','moment','bluebird','path','rimraf'];(function(_0x5e8981,_0x5ad60b){var _0x5a65ab=function(_0x328645){while(--_0x328645){_0x5e8981['push'](_0x5e8981['shift']());}};_0x5a65ab(++_0x5ad60b);}(_0x8932,0xec));var _0x2893=function(_0x2a392f,_0x3dd8b7){_0x2a392f=_0x2a392f-0x0;var _0x83b8bc=_0x8932[_0x2a392f];return _0x83b8bc;};'use strict';var _=require(_0x2893('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2893('0x1'));var moment=require(_0x2893('0x2'));var BPromise=require(_0x2893('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2893('0x4'));var rimraf=require(_0x2893('0x5'));var config=require('../../config/environment');var attributes=require(_0x2893('0x6'));module[_0x2893('0x7')]=function(_0x469d10,_0x345fbe){return _0x469d10[_0x2893('0x8')](_0x2893('0x9'),attributes,{'tableName':_0x2893('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 8cb5ca7..08da07d 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 _0xc457=['find','map','ShowSmsQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','raw','options','where','attributes','limit','include','model'];(function(_0x3860cf,_0x16b3c9){var _0x1da7c0=function(_0x1e5e48){while(--_0x1e5e48){_0x3860cf['push'](_0x3860cf['shift']());}};_0x1da7c0(++_0x16b3c9);}(_0xc457,0xed));var _0x7c45=function(_0x432bb9,_0x38f372){_0x432bb9=_0x432bb9-0x0;var _0x2cade6=_0xc457[_0x432bb9];return _0x2cade6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7c45('0x0'));var BPromise=require(_0x7c45('0x1'));var rs=require(_0x7c45('0x2'));var fs=require('fs');var Redis=require(_0x7c45('0x3'));var db=require(_0x7c45('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c45('0x5'))(_0x7c45('0x6'));var config=require(_0x7c45('0x7'));var jayson=require(_0x7c45('0x8'));var client=jayson['client'][_0x7c45('0x9')]({'port':0x232a});config[_0x7c45('0xa')]=_[_0x7c45('0xb')](config[_0x7c45('0xa')],{'host':_0x7c45('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c45('0xa')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x9f20ed,_0x1285c6,_0x273bf4){return new BPromise(function(_0x194056,_0x5431f9){return client[_0x7c45('0xd')](_0x9f20ed,_0x273bf4)[_0x7c45('0xe')](function(_0x100713){logger[_0x7c45('0xf')](_0x7c45('0x10'),_0x1285c6,_0x7c45('0x11'));logger[_0x7c45('0x12')](_0x7c45('0x13'),_0x1285c6,'request\x20sent',JSON[_0x7c45('0x14')](_0x100713));if(_0x100713[_0x7c45('0x15')]){if(_0x100713[_0x7c45('0x15')][_0x7c45('0x16')]===0x1f4){logger['error'](_0x7c45('0x10'),_0x1285c6,_0x100713[_0x7c45('0x15')][_0x7c45('0x17')]);return _0x5431f9(_0x100713[_0x7c45('0x15')][_0x7c45('0x17')]);}logger['error'](_0x7c45('0x10'),_0x1285c6,_0x100713[_0x7c45('0x15')][_0x7c45('0x17')]);return _0x194056(_0x100713[_0x7c45('0x15')][_0x7c45('0x17')]);}else{logger['info'](_0x7c45('0x10'),_0x1285c6,'request\x20sent');_0x194056(_0x100713[_0x7c45('0x18')]['message']);}})[_0x7c45('0x19')](function(_0x2bf1b1){logger[_0x7c45('0x15')](_0x7c45('0x10'),_0x1285c6,_0x2bf1b1);_0x5431f9(_0x2bf1b1);});});}exports[_0x7c45('0x1a')]=function(_0x333c4e){var _0x154efd=this;return new Promise(function(_0x1736bb,_0x1d87ce){return db[_0x7c45('0x1b')][_0x7c45('0x1c')]({'raw':_0x333c4e['options']?_0x333c4e['options'][_0x7c45('0x1d')]===undefined?!![]:![]:!![],'where':_0x333c4e[_0x7c45('0x1e')]?_0x333c4e['options'][_0x7c45('0x1f')]||null:null,'attributes':_0x333c4e['options']?_0x333c4e[_0x7c45('0x1e')][_0x7c45('0x20')]||null:null,'limit':_0x333c4e[_0x7c45('0x1e')]?_0x333c4e[_0x7c45('0x1e')][_0x7c45('0x21')]||null:null,'include':_0x333c4e[_0x7c45('0x1e')]?_0x333c4e['options'][_0x7c45('0x22')]?_['map'](_0x333c4e['options'][_0x7c45('0x22')],function(_0x165459){return{'model':db[_0x165459[_0x7c45('0x23')]],'as':_0x165459['as'],'attributes':_0x165459[_0x7c45('0x20')],'include':_0x165459[_0x7c45('0x22')]?_['map'](_0x165459['include'],function(_0x55b2bb){return{'model':db[_0x55b2bb['model']],'as':_0x55b2bb['as'],'attributes':_0x55b2bb[_0x7c45('0x20')],'include':_0x55b2bb[_0x7c45('0x22')]?_['map'](_0x55b2bb[_0x7c45('0x22')],function(_0x29580a){return{'model':db[_0x29580a[_0x7c45('0x23')]],'as':_0x29580a['as'],'attributes':_0x29580a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c45('0xe')](function(_0x3d74f2){logger[_0x7c45('0xf')](_0x7c45('0x1a'),_0x333c4e);logger[_0x7c45('0x12')](_0x7c45('0x1a'),_0x333c4e,JSON['stringify'](_0x3d74f2));_0x1736bb(_0x3d74f2);})[_0x7c45('0x19')](function(_0x2ec50f){logger[_0x7c45('0x15')](_0x7c45('0x1a'),_0x2ec50f[_0x7c45('0x17')],_0x333c4e);_0x1d87ce(_0x154efd['error'](0x1f4,_0x2ec50f[_0x7c45('0x17')]));});});};exports['ShowSmsQueue']=function(_0x5e1170){var _0x2e04ff=this;return new Promise(function(_0x58fc24,_0x449f8b){return db[_0x7c45('0x1b')][_0x7c45('0x24')]({'raw':_0x5e1170[_0x7c45('0x1e')]?_0x5e1170[_0x7c45('0x1e')][_0x7c45('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e1170[_0x7c45('0x1e')]?_0x5e1170['options'][_0x7c45('0x1f')]||null:null,'attributes':_0x5e1170['options']?_0x5e1170['options'][_0x7c45('0x20')]||null:null,'include':_0x5e1170['options']?_0x5e1170['options']['include']?_[_0x7c45('0x25')](_0x5e1170[_0x7c45('0x1e')][_0x7c45('0x22')],function(_0xb25b63){return{'model':db[_0xb25b63[_0x7c45('0x23')]],'as':_0xb25b63['as'],'attributes':_0xb25b63[_0x7c45('0x20')],'include':_0xb25b63[_0x7c45('0x22')]?_['map'](_0xb25b63['include'],function(_0x1e32f1){return{'model':db[_0x1e32f1['model']],'as':_0x1e32f1['as'],'attributes':_0x1e32f1[_0x7c45('0x20')],'include':_0x1e32f1[_0x7c45('0x22')]?_[_0x7c45('0x25')](_0x1e32f1['include'],function(_0x47e6f7){return{'model':db[_0x47e6f7[_0x7c45('0x23')]],'as':_0x47e6f7['as'],'attributes':_0x47e6f7[_0x7c45('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7c45('0xe')](function(_0x38c619){logger['info']('ShowSmsQueue',_0x5e1170);logger[_0x7c45('0x12')](_0x7c45('0x26'),_0x5e1170,JSON[_0x7c45('0x14')](_0x38c619));_0x58fc24(_0x38c619);})[_0x7c45('0x19')](function(_0x1081fe){logger['error'](_0x7c45('0x26'),_0x1081fe[_0x7c45('0x17')],_0x5e1170);_0x449f8b(_0x2e04ff[_0x7c45('0x15')](0x1f4,_0x1081fe[_0x7c45('0x17')]));});});}; \ No newline at end of file +var _0x95a6=['limit','include','map','model','attributes','GetSmsQueue','ShowSmsQueue','find','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','options','where'];(function(_0x3e74f4,_0x3e9c91){var _0x489758=function(_0x245904){while(--_0x245904){_0x3e74f4['push'](_0x3e74f4['shift']());}};_0x489758(++_0x3e9c91);}(_0x95a6,0xc7));var _0x695a=function(_0x290519,_0x86de94){_0x290519=_0x290519-0x0;var _0xb7cc4e=_0x95a6[_0x290519];return _0xb7cc4e;};'use strict';var _=require(_0x695a('0x0'));var util=require(_0x695a('0x1'));var moment=require('moment');var BPromise=require(_0x695a('0x2'));var rs=require(_0x695a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x695a('0x4'))['db'];var utils=require(_0x695a('0x5'));var logger=require(_0x695a('0x6'))(_0x695a('0x7'));var config=require(_0x695a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x695a('0x9')]({'port':0x232a});config[_0x695a('0xa')]=_['defaults'](config[_0x695a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x695a('0xb'))(new Redis(config[_0x695a('0xa')]));require('./smsQueue.socket')[_0x695a('0xc')](socket);function respondWithRpcPromise(_0x4aa759,_0x3c2e88,_0x5d17a2){return new BPromise(function(_0x31aa05,_0x5f1d27){return client[_0x695a('0xd')](_0x4aa759,_0x5d17a2)[_0x695a('0xe')](function(_0xf5374a){logger[_0x695a('0xf')](_0x695a('0x10'),_0x3c2e88,_0x695a('0x11'));logger[_0x695a('0x12')](_0x695a('0x13'),_0x3c2e88,'request\x20sent',JSON[_0x695a('0x14')](_0xf5374a));if(_0xf5374a['error']){if(_0xf5374a[_0x695a('0x15')][_0x695a('0x16')]===0x1f4){logger[_0x695a('0x15')](_0x695a('0x10'),_0x3c2e88,_0xf5374a['error']['message']);return _0x5f1d27(_0xf5374a['error'][_0x695a('0x17')]);}logger[_0x695a('0x15')](_0x695a('0x10'),_0x3c2e88,_0xf5374a[_0x695a('0x15')][_0x695a('0x17')]);return _0x31aa05(_0xf5374a[_0x695a('0x15')][_0x695a('0x17')]);}else{logger[_0x695a('0xf')]('SmsQueue,\x20%s,\x20%s',_0x3c2e88,_0x695a('0x11'));_0x31aa05(_0xf5374a[_0x695a('0x18')][_0x695a('0x17')]);}})[_0x695a('0x19')](function(_0x2ba9f1){logger[_0x695a('0x15')](_0x695a('0x10'),_0x3c2e88,_0x2ba9f1);_0x5f1d27(_0x2ba9f1);});});}exports['GetSmsQueue']=function(_0x788433){var _0x1ebff5=this;return new Promise(function(_0x294f4a,_0x229092){return db[_0x695a('0x1a')]['findAll']({'raw':_0x788433['options']?_0x788433[_0x695a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x788433[_0x695a('0x1b')]?_0x788433[_0x695a('0x1b')][_0x695a('0x1c')]||null:null,'attributes':_0x788433[_0x695a('0x1b')]?_0x788433['options']['attributes']||null:null,'limit':_0x788433[_0x695a('0x1b')]?_0x788433[_0x695a('0x1b')][_0x695a('0x1d')]||null:null,'include':_0x788433[_0x695a('0x1b')]?_0x788433[_0x695a('0x1b')][_0x695a('0x1e')]?_[_0x695a('0x1f')](_0x788433[_0x695a('0x1b')][_0x695a('0x1e')],function(_0x3de6a5){return{'model':db[_0x3de6a5[_0x695a('0x20')]],'as':_0x3de6a5['as'],'attributes':_0x3de6a5['attributes'],'include':_0x3de6a5[_0x695a('0x1e')]?_[_0x695a('0x1f')](_0x3de6a5[_0x695a('0x1e')],function(_0x322ef3){return{'model':db[_0x322ef3[_0x695a('0x20')]],'as':_0x322ef3['as'],'attributes':_0x322ef3[_0x695a('0x21')],'include':_0x322ef3[_0x695a('0x1e')]?_[_0x695a('0x1f')](_0x322ef3[_0x695a('0x1e')],function(_0x3eef5a){return{'model':db[_0x3eef5a[_0x695a('0x20')]],'as':_0x3eef5a['as'],'attributes':_0x3eef5a[_0x695a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x695a('0xe')](function(_0x4b4e64){logger[_0x695a('0xf')](_0x695a('0x22'),_0x788433);logger[_0x695a('0x12')]('GetSmsQueue',_0x788433,JSON['stringify'](_0x4b4e64));_0x294f4a(_0x4b4e64);})[_0x695a('0x19')](function(_0x3a66f7){logger['error']('GetSmsQueue',_0x3a66f7[_0x695a('0x17')],_0x788433);_0x229092(_0x1ebff5['error'](0x1f4,_0x3a66f7[_0x695a('0x17')]));});});};exports[_0x695a('0x23')]=function(_0x4e53bb){var _0x15dc33=this;return new Promise(function(_0xd053b,_0x57d0c5){return db[_0x695a('0x1a')][_0x695a('0x24')]({'raw':_0x4e53bb[_0x695a('0x1b')]?_0x4e53bb['options'][_0x695a('0x25')]===undefined?!![]:![]:!![],'where':_0x4e53bb[_0x695a('0x1b')]?_0x4e53bb[_0x695a('0x1b')][_0x695a('0x1c')]||null:null,'attributes':_0x4e53bb[_0x695a('0x1b')]?_0x4e53bb[_0x695a('0x1b')][_0x695a('0x21')]||null:null,'include':_0x4e53bb[_0x695a('0x1b')]?_0x4e53bb[_0x695a('0x1b')][_0x695a('0x1e')]?_[_0x695a('0x1f')](_0x4e53bb[_0x695a('0x1b')][_0x695a('0x1e')],function(_0x35a203){return{'model':db[_0x35a203[_0x695a('0x20')]],'as':_0x35a203['as'],'attributes':_0x35a203[_0x695a('0x21')],'include':_0x35a203[_0x695a('0x1e')]?_[_0x695a('0x1f')](_0x35a203['include'],function(_0x3c240c){return{'model':db[_0x3c240c['model']],'as':_0x3c240c['as'],'attributes':_0x3c240c[_0x695a('0x21')],'include':_0x3c240c[_0x695a('0x1e')]?_[_0x695a('0x1f')](_0x3c240c[_0x695a('0x1e')],function(_0x2193f9){return{'model':db[_0x2193f9[_0x695a('0x20')]],'as':_0x2193f9['as'],'attributes':_0x2193f9[_0x695a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b1cf2){logger['info']('ShowSmsQueue',_0x4e53bb);logger[_0x695a('0x12')]('ShowSmsQueue',_0x4e53bb,JSON['stringify'](_0x5b1cf2));_0xd053b(_0x5b1cf2);})['catch'](function(_0x5296ca){logger['error'](_0x695a('0x23'),_0x5296ca[_0x695a('0x17')],_0x4e53bb);_0x57d0c5(_0x15dc33[_0x695a('0x15')](0x1f4,_0x5296ca[_0x695a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index c153bd0..226da5d 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 _0x4b3b=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x152341,_0x8f0c56){var _0x440e1b=function(_0x33918f){while(--_0x33918f){_0x152341['push'](_0x152341['shift']());}};_0x440e1b(++_0x8f0c56);}(_0x4b3b,0x1e3));var _0xb4b3=function(_0x55cdd9,_0x44c5bf){_0x55cdd9=_0x55cdd9-0x0;var _0x41f611=_0x4b3b[_0x55cdd9];return _0x41f611;};'use strict';var SmsQueueEvents=require(_0xb4b3('0x0'));var events=[_0xb4b3('0x1'),_0xb4b3('0x2'),_0xb4b3('0x3')];function createListener(_0x53af2d,_0x1bd665){return function(_0xa403bb){_0x1bd665[_0xb4b3('0x4')](_0x53af2d,_0xa403bb);};}function removeListener(_0x36194d,_0x61bed9){return function(){SmsQueueEvents[_0xb4b3('0x5')](_0x36194d,_0x61bed9);};}exports[_0xb4b3('0x6')]=function(_0x464590){for(var _0x3f434f=0x0,_0x13332e=events[_0xb4b3('0x7')];_0x3f434f<_0x13332e;_0x3f434f++){var _0x3de398=events[_0x3f434f];var _0x55cd1b=createListener(_0xb4b3('0x8')+_0x3de398,_0x464590);SmsQueueEvents['on'](_0x3de398,_0x55cd1b);}}; \ No newline at end of file +var _0xa20d=['register','smsQueue:','./smsQueue.events','removeListener'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xa20d,0x192));var _0xda20=function(_0x184418,_0x294143){_0x184418=_0x184418-0x0;var _0x403a41=_0xa20d[_0x184418];return _0x403a41;};'use strict';var SmsQueueEvents=require(_0xda20('0x0'));var events=['save','remove','update'];function createListener(_0x20c921,_0x515b91){return function(_0x445c3f){_0x515b91['emit'](_0x20c921,_0x445c3f);};}function removeListener(_0x5c5c1f,_0x591155){return function(){SmsQueueEvents[_0xda20('0x1')](_0x5c5c1f,_0x591155);};}exports[_0xda20('0x2')]=function(_0x397301){for(var _0x534f95=0x0,_0x303a9b=events['length'];_0x534f95<_0x303a9b;_0x534f95++){var _0xbfec11=events[_0x534f95];var _0x33d210=createListener(_0xda20('0x3')+_0xbfec11,_0x397301);SmsQueueEvents['on'](_0xbfec11,_0x33d210);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b315f9b..c5e0583 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 _0xc80f=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3127a2,_0x2f1df7){var _0x40e6ce=function(_0x523391){while(--_0x523391){_0x3127a2['push'](_0x3127a2['shift']());}};_0x40e6ce(++_0x2f1df7);}(_0xc80f,0x7e));var _0xfc80=function(_0xbc9ccc,_0x9a2a16){_0xbc9ccc=_0xbc9ccc-0x0;var _0xc19306=_0xc80f[_0xbc9ccc];return _0xc19306;};'use strict';var multer=require(_0xfc80('0x0'));var util=require(_0xfc80('0x1'));var path=require(_0xfc80('0x2'));var timeout=require(_0xfc80('0x3'));var express=require(_0xfc80('0x4'));var router=express[_0xfc80('0x5')]();var fs_extra=require(_0xfc80('0x6'));var auth=require(_0xfc80('0x7'));var interaction=require(_0xfc80('0x8'));var config=require(_0xfc80('0x9'));var controller=require(_0xfc80('0xa'));router[_0xfc80('0xb')]('/',auth['isAuthenticated'](),controller[_0xfc80('0xc')]);router['get'](_0xfc80('0xd'),auth[_0xfc80('0xe')](),controller[_0xfc80('0xf')]);router[_0xfc80('0xb')](_0xfc80('0x10'),auth['isAuthenticated'](),controller[_0xfc80('0x11')]);router[_0xfc80('0x12')]('/',auth[_0xfc80('0xe')](),controller['create']);router[_0xfc80('0x13')](_0xfc80('0x10'),auth[_0xfc80('0xe')](),controller[_0xfc80('0x14')]);router[_0xfc80('0x15')](_0xfc80('0x10'),auth[_0xfc80('0xe')](),controller[_0xfc80('0x16')]);module[_0xfc80('0x17')]=router; \ No newline at end of file +var _0xa9e7=['put','/:id','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0xe4fc5f,_0x467b8d){var _0x4767f5=function(_0x589025){while(--_0x589025){_0xe4fc5f['push'](_0xe4fc5f['shift']());}};_0x4767f5(++_0x467b8d);}(_0xa9e7,0xfa));var _0x7a9e=function(_0x34df63,_0x40bd2f){_0x34df63=_0x34df63-0x0;var _0x391101=_0xa9e7[_0x34df63];return _0x391101;};'use strict';var multer=require(_0x7a9e('0x0'));var util=require(_0x7a9e('0x1'));var path=require(_0x7a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7a9e('0x3'));var auth=require(_0x7a9e('0x4'));var interaction=require(_0x7a9e('0x5'));var config=require(_0x7a9e('0x6'));var controller=require(_0x7a9e('0x7'));router[_0x7a9e('0x8')]('/',auth[_0x7a9e('0x9')](),controller[_0x7a9e('0xa')]);router['get'](_0x7a9e('0xb'),auth['isAuthenticated'](),controller[_0x7a9e('0xc')]);router[_0x7a9e('0x8')]('/:id',auth[_0x7a9e('0x9')](),controller[_0x7a9e('0xd')]);router[_0x7a9e('0xe')]('/',auth['isAuthenticated'](),controller[_0x7a9e('0xf')]);router[_0x7a9e('0x10')](_0x7a9e('0x11'),auth[_0x7a9e('0x9')](),controller['update']);router['delete'](_0x7a9e('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x7a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 434d3cf..8a09379 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 _0xcf6d=['STRING','DATE','moment','sequelize'];(function(_0xbae21b,_0x449cfb){var _0x10f16f=function(_0x4ae469){while(--_0x4ae469){_0xbae21b['push'](_0xbae21b['shift']());}};_0x10f16f(++_0x449cfb);}(_0xcf6d,0x102));var _0xdcf6=function(_0x72f2b9,_0x2c1ae6){_0x72f2b9=_0x72f2b9-0x0;var _0x1b858c=_0xcf6d[_0x72f2b9];return _0x1b858c;};'use strict';var moment=require(_0xdcf6('0x0'));var Sequelize=require(_0xdcf6('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdcf6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdcf6('0x2')]},'joinAt':{'type':Sequelize[_0xdcf6('0x3')]},'leaveAt':{'type':Sequelize[_0xdcf6('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdcf6('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac60=['sequelize','exports','STRING','DATE','moment'];(function(_0x4b093c,_0x24b4a2){var _0xe682a3=function(_0x22ae20){while(--_0x22ae20){_0x4b093c['push'](_0x4b093c['shift']());}};_0xe682a3(++_0x24b4a2);}(_0xac60,0x86));var _0x0ac6=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xac60[_0x4709c0];return _0x13348b;};'use strict';var moment=require(_0x0ac6('0x0'));var Sequelize=require(_0x0ac6('0x1'));module[_0x0ac6('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0ac6('0x3')]},'joinAt':{'type':Sequelize[_0x0ac6('0x4')]},'leaveAt':{'type':Sequelize[_0x0ac6('0x4')]},'acceptAt':{'type':Sequelize[_0x0ac6('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0ac6('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 3cd6084..5301114 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 _0xf6c2=['create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','include','find'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xf6c2,0x1a7));var _0x2f6c=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xf6c2[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f6c('0x0'));var zipdir=require(_0x2f6c('0x1'));var jsonpatch=require(_0x2f6c('0x2'));var rp=require(_0x2f6c('0x3'));var moment=require(_0x2f6c('0x4'));var BPromise=require(_0x2f6c('0x5'));var Mustache=require('mustache');var util=require(_0x2f6c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2f6c('0x7'));var ejs=require(_0x2f6c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2f6c('0x9'));var jsforce=require(_0x2f6c('0xa'));var deskjs=require(_0x2f6c('0xb'));var toCsv=require(_0x2f6c('0x7'));var querystring=require(_0x2f6c('0xc'));var Papa=require(_0x2f6c('0xd'));var Redis=require(_0x2f6c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2f6c('0xf'));var hardwareService=require(_0x2f6c('0x10'));var logger=require('../../config/logger')(_0x2f6c('0x11'));var utils=require('../../config/utils');var config=require(_0x2f6c('0x12'));var licenseUtil=require(_0x2f6c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x175d94,_0x3b974e){_0x3b974e=_0x3b974e||0xcc;return function(_0x18fda3){if(_0x18fda3){return _0x175d94['sendStatus'](_0x3b974e);}return _0x175d94[_0x2f6c('0x14')](_0x3b974e)[_0x2f6c('0x15')]();};}function respondWithResult(_0x1ab146,_0x1a4c60){_0x1a4c60=_0x1a4c60||0xc8;return function(_0x17924b){if(_0x17924b){return _0x1ab146[_0x2f6c('0x14')](_0x1a4c60)[_0x2f6c('0x16')](_0x17924b);}};}function respondWithFilteredResult(_0x4b4285,_0x161391){return function(_0x54ab1d){if(_0x54ab1d){var _0x5360e6=typeof _0x161391['offset']==='undefined'&&typeof _0x161391[_0x2f6c('0x17')]===_0x2f6c('0x18');var _0x39ae73=_0x54ab1d[_0x2f6c('0x19')];var _0x458f73=_0x5360e6?0x0:_0x161391['offset'];var _0x376b83=_0x5360e6?_0x54ab1d[_0x2f6c('0x19')]:_0x161391[_0x2f6c('0x1a')]+_0x161391[_0x2f6c('0x17')];var _0x5af425;if(_0x376b83>=_0x39ae73){_0x376b83=_0x39ae73;_0x5af425=0xc8;}else{_0x5af425=0xce;}_0x4b4285[_0x2f6c('0x14')](_0x5af425);return _0x4b4285[_0x2f6c('0x1b')](_0x2f6c('0x1c'),_0x458f73+'-'+_0x376b83+'/'+_0x39ae73)['json'](_0x54ab1d);}return null;};}function patchUpdates(_0x54a4f0){return function(_0xe3bf8b){try{jsonpatch[_0x2f6c('0x1d')](_0xe3bf8b,_0x54a4f0,!![]);}catch(_0x58bcd7){return BPromise[_0x2f6c('0x1e')](_0x58bcd7);}return _0xe3bf8b[_0x2f6c('0x1f')]();};}function saveUpdates(_0x306e3d,_0x2c5c8d){return function(_0x5c6fc2){if(_0x5c6fc2){return _0x5c6fc2[_0x2f6c('0x20')](_0x306e3d)[_0x2f6c('0x21')](function(_0x25692c){return _0x25692c;});}return null;};}function removeEntity(_0x36babe,_0x58090a){return function(_0x1d5dd8){if(_0x1d5dd8){return _0x1d5dd8[_0x2f6c('0x22')]()['then'](function(){_0x36babe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cb2a7,_0x239977){return function(_0x2f6429){if(!_0x2f6429){_0x3cb2a7['sendStatus'](0x194);}return _0x2f6429;};}function handleError(_0x4dc749,_0x3448d9){_0x3448d9=_0x3448d9||0x1f4;return function(_0x126ca0){logger[_0x2f6c('0x23')](_0x126ca0['stack']);if(_0x126ca0[_0x2f6c('0x24')]){delete _0x126ca0['name'];}_0x4dc749[_0x2f6c('0x14')](_0x3448d9)['send'](_0x126ca0);};}exports[_0x2f6c('0x25')]=function(_0x5f1684,_0x2e65d9){var _0x1137b5={},_0xbf0228={},_0x45f756={'count':0x0,'rows':[]};var _0x502789=_[_0x2f6c('0x26')](db[_0x2f6c('0x27')][_0x2f6c('0x28')],function(_0x114767){return{'name':_0x114767[_0x2f6c('0x29')],'type':_0x114767[_0x2f6c('0x2a')]['key']};});_0xbf0228[_0x2f6c('0x2b')]=_[_0x2f6c('0x26')](_0x502789,_0x2f6c('0x24'));_0xbf0228[_0x2f6c('0x2c')]=_['keys'](_0x5f1684[_0x2f6c('0x2c')]);_0xbf0228[_0x2f6c('0x2d')]=_[_0x2f6c('0x2e')](_0xbf0228[_0x2f6c('0x2b')],_0xbf0228[_0x2f6c('0x2c')]);_0x1137b5['attributes']=_[_0x2f6c('0x2e')](_0xbf0228[_0x2f6c('0x2b')],qs[_0x2f6c('0x2f')](_0x5f1684[_0x2f6c('0x2c')][_0x2f6c('0x2f')]));_0x1137b5[_0x2f6c('0x30')]=_0x1137b5[_0x2f6c('0x30')][_0x2f6c('0x31')]?_0x1137b5[_0x2f6c('0x30')]:_0xbf0228['model'];if(!_0x5f1684['query'][_0x2f6c('0x32')](_0x2f6c('0x33'))){_0x1137b5[_0x2f6c('0x17')]=qs['limit'](_0x5f1684[_0x2f6c('0x2c')][_0x2f6c('0x17')]);_0x1137b5['offset']=qs[_0x2f6c('0x1a')](_0x5f1684['query'][_0x2f6c('0x1a')]);}_0x1137b5[_0x2f6c('0x34')]=qs[_0x2f6c('0x35')](_0x5f1684[_0x2f6c('0x2c')][_0x2f6c('0x35')]);_0x1137b5[_0x2f6c('0x36')]=qs[_0x2f6c('0x2d')](_[_0x2f6c('0x37')](_0x5f1684[_0x2f6c('0x2c')],_0xbf0228[_0x2f6c('0x2d')]),_0x502789);if(_0x5f1684['query'][_0x2f6c('0x38')]){_0x1137b5[_0x2f6c('0x36')]=_[_0x2f6c('0x39')](_0x1137b5[_0x2f6c('0x36')],{'$or':_[_0x2f6c('0x26')](_0x502789,function(_0x648e14){if(_0x648e14['type']!=='VIRTUAL'){var _0x184f33={};_0x184f33[_0x648e14[_0x2f6c('0x24')]]={'$like':'%'+_0x5f1684[_0x2f6c('0x2c')][_0x2f6c('0x38')]+'%'};return _0x184f33;}})});}_0x1137b5=_[_0x2f6c('0x39')]({},_0x1137b5,_0x5f1684[_0x2f6c('0x3a')]);var _0x2a0e90={'where':_0x1137b5[_0x2f6c('0x36')]};return db['SmsQueueReport']['count'](_0x2a0e90)[_0x2f6c('0x21')](function(_0xcf15bb){_0x45f756[_0x2f6c('0x19')]=_0xcf15bb;if(_0x5f1684['query'][_0x2f6c('0x3b')]){_0x1137b5['include']=[{'all':!![]}];}return db[_0x2f6c('0x27')][_0x2f6c('0x3c')](_0x1137b5);})[_0x2f6c('0x21')](function(_0x38d7a5){_0x45f756[_0x2f6c('0x3d')]=_0x38d7a5;return _0x45f756;})['then'](respondWithFilteredResult(_0x2e65d9,_0x1137b5))[_0x2f6c('0x3e')](handleError(_0x2e65d9,null));};exports['show']=function(_0x5335cd,_0x2bbef4){var _0x501494={'raw':!![],'where':{'id':_0x5335cd[_0x2f6c('0x3f')]['id']}},_0x5d0ce3={};_0x5d0ce3[_0x2f6c('0x2b')]=_['keys'](db[_0x2f6c('0x27')]['rawAttributes']);_0x5d0ce3[_0x2f6c('0x2c')]=_[_0x2f6c('0x40')](_0x5335cd['query']);_0x5d0ce3[_0x2f6c('0x2d')]=_[_0x2f6c('0x2e')](_0x5d0ce3[_0x2f6c('0x2b')],_0x5d0ce3[_0x2f6c('0x2c')]);_0x501494['attributes']=_[_0x2f6c('0x2e')](_0x5d0ce3[_0x2f6c('0x2b')],qs[_0x2f6c('0x2f')](_0x5335cd[_0x2f6c('0x2c')][_0x2f6c('0x2f')]));_0x501494['attributes']=_0x501494['attributes'][_0x2f6c('0x31')]?_0x501494[_0x2f6c('0x30')]:_0x5d0ce3[_0x2f6c('0x2b')];if(_0x5335cd[_0x2f6c('0x2c')][_0x2f6c('0x3b')]){_0x501494[_0x2f6c('0x41')]=[{'all':!![]}];}_0x501494=_[_0x2f6c('0x39')]({},_0x501494,_0x5335cd[_0x2f6c('0x3a')]);return db[_0x2f6c('0x27')][_0x2f6c('0x42')](_0x501494)[_0x2f6c('0x21')](handleEntityNotFound(_0x2bbef4,null))[_0x2f6c('0x21')](respondWithResult(_0x2bbef4,null))[_0x2f6c('0x3e')](handleError(_0x2bbef4,null));};exports[_0x2f6c('0x43')]=function(_0x330856,_0x555c5b){return db[_0x2f6c('0x27')][_0x2f6c('0x43')](_0x330856[_0x2f6c('0x44')],{})['then'](respondWithResult(_0x555c5b,0xc9))[_0x2f6c('0x3e')](handleError(_0x555c5b,null));};exports['update']=function(_0x198987,_0x52eeda){if(_0x198987[_0x2f6c('0x44')]['id']){delete _0x198987[_0x2f6c('0x44')]['id'];}return db['SmsQueueReport'][_0x2f6c('0x42')]({'where':{'id':_0x198987[_0x2f6c('0x3f')]['id']}})[_0x2f6c('0x21')](handleEntityNotFound(_0x52eeda,null))[_0x2f6c('0x21')](saveUpdates(_0x198987[_0x2f6c('0x44')],null))[_0x2f6c('0x21')](respondWithResult(_0x52eeda,null))['catch'](handleError(_0x52eeda,null));};exports[_0x2f6c('0x22')]=function(_0x241d56,_0x4af042){return db['SmsQueueReport'][_0x2f6c('0x42')]({'where':{'id':_0x241d56[_0x2f6c('0x3f')]['id']}})[_0x2f6c('0x21')](handleEntityNotFound(_0x4af042,null))[_0x2f6c('0x21')](removeEntity(_0x4af042,null))[_0x2f6c('0x3e')](handleError(_0x4af042,null));};exports[_0x2f6c('0x45')]=function(_0x5735b3,_0x5ece83){return db[_0x2f6c('0x27')][_0x2f6c('0x45')]()['then'](respondWithResult(_0x5ece83,null))['catch'](handleError(_0x5ece83,null));}; \ No newline at end of file +var _0x3155=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','SmsQueueReport','count','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra'];(function(_0x4057ec,_0x425f09){var _0xe062c=function(_0x4a9644){while(--_0x4a9644){_0x4057ec['push'](_0x4057ec['shift']());}};_0xe062c(++_0x425f09);}(_0x3155,0x8a));var _0x5315=function(_0x262323,_0x4a81f1){_0x262323=_0x262323-0x0;var _0xa963c3=_0x3155[_0x262323];return _0xa963c3;};'use strict';var emlformat=require(_0x5315('0x0'));var rimraf=require(_0x5315('0x1'));var zipdir=require(_0x5315('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5315('0x3'));var moment=require(_0x5315('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5315('0x5'));var util=require(_0x5315('0x6'));var path=require(_0x5315('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5315('0x8'));var fs=require('fs');var fs_extra=require(_0x5315('0x9'));var _=require(_0x5315('0xa'));var squel=require(_0x5315('0xb'));var crypto=require(_0x5315('0xc'));var jsforce=require(_0x5315('0xd'));var deskjs=require(_0x5315('0xe'));var toCsv=require(_0x5315('0xf'));var querystring=require(_0x5315('0x10'));var Papa=require(_0x5315('0x11'));var Redis=require(_0x5315('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5315('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5315('0x14'));var logger=require(_0x5315('0x15'))(_0x5315('0x16'));var utils=require(_0x5315('0x17'));var config=require(_0x5315('0x18'));var licenseUtil=require(_0x5315('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fbe24,_0x28de97){_0x28de97=_0x28de97||0xcc;return function(_0x49138c){if(_0x49138c){return _0x2fbe24[_0x5315('0x1a')](_0x28de97);}return _0x2fbe24[_0x5315('0x1b')](_0x28de97)['end']();};}function respondWithResult(_0x4bc105,_0x3455ab){_0x3455ab=_0x3455ab||0xc8;return function(_0x1e7988){if(_0x1e7988){return _0x4bc105[_0x5315('0x1b')](_0x3455ab)['json'](_0x1e7988);}};}function respondWithFilteredResult(_0x2ae946,_0x11a9b3){return function(_0x44b2f9){if(_0x44b2f9){var _0x6013a3=typeof _0x11a9b3[_0x5315('0x1c')]===_0x5315('0x1d')&&typeof _0x11a9b3[_0x5315('0x1e')]===_0x5315('0x1d');var _0xc56639=_0x44b2f9['count'];var _0xf22452=_0x6013a3?0x0:_0x11a9b3[_0x5315('0x1c')];var _0x5c3d53=_0x6013a3?_0x44b2f9['count']:_0x11a9b3[_0x5315('0x1c')]+_0x11a9b3[_0x5315('0x1e')];var _0x3bf863;if(_0x5c3d53>=_0xc56639){_0x5c3d53=_0xc56639;_0x3bf863=0xc8;}else{_0x3bf863=0xce;}_0x2ae946[_0x5315('0x1b')](_0x3bf863);return _0x2ae946[_0x5315('0x1f')](_0x5315('0x20'),_0xf22452+'-'+_0x5c3d53+'/'+_0xc56639)[_0x5315('0x21')](_0x44b2f9);}return null;};}function patchUpdates(_0x5f0b74){return function(_0x4fba8d){try{jsonpatch['apply'](_0x4fba8d,_0x5f0b74,!![]);}catch(_0x3f7042){return BPromise[_0x5315('0x22')](_0x3f7042);}return _0x4fba8d[_0x5315('0x23')]();};}function saveUpdates(_0x11f01f,_0x3b9e4c){return function(_0x2b9fa3){if(_0x2b9fa3){return _0x2b9fa3[_0x5315('0x24')](_0x11f01f)[_0x5315('0x25')](function(_0x3cacf0){return _0x3cacf0;});}return null;};}function removeEntity(_0xee3a13,_0x3a6d8c){return function(_0x253a23){if(_0x253a23){return _0x253a23['destroy']()[_0x5315('0x25')](function(){_0xee3a13[_0x5315('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0e8f,_0xce8021){return function(_0x15ec4e){if(!_0x15ec4e){_0x3b0e8f[_0x5315('0x1a')](0x194);}return _0x15ec4e;};}function handleError(_0x8e6d9c,_0x9469c0){_0x9469c0=_0x9469c0||0x1f4;return function(_0x1d1eac){logger[_0x5315('0x26')](_0x1d1eac[_0x5315('0x27')]);if(_0x1d1eac['name']){delete _0x1d1eac[_0x5315('0x28')];}_0x8e6d9c[_0x5315('0x1b')](_0x9469c0)[_0x5315('0x29')](_0x1d1eac);};}exports[_0x5315('0x2a')]=function(_0x5e7681,_0x1827ce){var _0x6b8a81={},_0x4beef2={},_0xf174c9={'count':0x0,'rows':[]};var _0x9388ce=_[_0x5315('0x2b')](db['SmsQueueReport'][_0x5315('0x2c')],function(_0x3c71fe){return{'name':_0x3c71fe['fieldName'],'type':_0x3c71fe['type']['key']};});_0x4beef2[_0x5315('0x2d')]=_[_0x5315('0x2b')](_0x9388ce,'name');_0x4beef2[_0x5315('0x2e')]=_['keys'](_0x5e7681['query']);_0x4beef2[_0x5315('0x2f')]=_['intersection'](_0x4beef2['model'],_0x4beef2['query']);_0x6b8a81[_0x5315('0x30')]=_[_0x5315('0x31')](_0x4beef2[_0x5315('0x2d')],qs['fields'](_0x5e7681['query'][_0x5315('0x32')]));_0x6b8a81[_0x5315('0x30')]=_0x6b8a81[_0x5315('0x30')][_0x5315('0x33')]?_0x6b8a81[_0x5315('0x30')]:_0x4beef2[_0x5315('0x2d')];if(!_0x5e7681[_0x5315('0x2e')][_0x5315('0x34')](_0x5315('0x35'))){_0x6b8a81['limit']=qs['limit'](_0x5e7681['query'][_0x5315('0x1e')]);_0x6b8a81['offset']=qs[_0x5315('0x1c')](_0x5e7681[_0x5315('0x2e')][_0x5315('0x1c')]);}_0x6b8a81[_0x5315('0x36')]=qs[_0x5315('0x37')](_0x5e7681[_0x5315('0x2e')][_0x5315('0x37')]);_0x6b8a81[_0x5315('0x38')]=qs[_0x5315('0x2f')](_[_0x5315('0x39')](_0x5e7681[_0x5315('0x2e')],_0x4beef2[_0x5315('0x2f')]),_0x9388ce);if(_0x5e7681['query']['filter']){_0x6b8a81[_0x5315('0x38')]=_['merge'](_0x6b8a81[_0x5315('0x38')],{'$or':_[_0x5315('0x2b')](_0x9388ce,function(_0x4f56bd){if(_0x4f56bd['type']!==_0x5315('0x3a')){var _0x32fad4={};_0x32fad4[_0x4f56bd[_0x5315('0x28')]]={'$like':'%'+_0x5e7681[_0x5315('0x2e')][_0x5315('0x3b')]+'%'};return _0x32fad4;}})});}_0x6b8a81=_[_0x5315('0x3c')]({},_0x6b8a81,_0x5e7681['options']);var _0x30ad08={'where':_0x6b8a81['where']};return db[_0x5315('0x3d')][_0x5315('0x3e')](_0x30ad08)[_0x5315('0x25')](function(_0x5eb894){_0xf174c9[_0x5315('0x3e')]=_0x5eb894;if(_0x5e7681[_0x5315('0x2e')]['includeAll']){_0x6b8a81['include']=[{'all':!![]}];}return db[_0x5315('0x3d')]['findAll'](_0x6b8a81);})[_0x5315('0x25')](function(_0xb3ef61){_0xf174c9[_0x5315('0x3f')]=_0xb3ef61;return _0xf174c9;})[_0x5315('0x25')](respondWithFilteredResult(_0x1827ce,_0x6b8a81))[_0x5315('0x40')](handleError(_0x1827ce,null));};exports[_0x5315('0x41')]=function(_0x731765,_0x2b3cc2){var _0x3b5323={'raw':!![],'where':{'id':_0x731765[_0x5315('0x42')]['id']}},_0x3e5517={};_0x3e5517[_0x5315('0x2d')]=_[_0x5315('0x43')](db[_0x5315('0x3d')][_0x5315('0x2c')]);_0x3e5517['query']=_[_0x5315('0x43')](_0x731765[_0x5315('0x2e')]);_0x3e5517[_0x5315('0x2f')]=_['intersection'](_0x3e5517[_0x5315('0x2d')],_0x3e5517[_0x5315('0x2e')]);_0x3b5323[_0x5315('0x30')]=_[_0x5315('0x31')](_0x3e5517[_0x5315('0x2d')],qs[_0x5315('0x32')](_0x731765[_0x5315('0x2e')]['fields']));_0x3b5323['attributes']=_0x3b5323[_0x5315('0x30')]['length']?_0x3b5323[_0x5315('0x30')]:_0x3e5517[_0x5315('0x2d')];if(_0x731765[_0x5315('0x2e')][_0x5315('0x44')]){_0x3b5323['include']=[{'all':!![]}];}_0x3b5323=_[_0x5315('0x3c')]({},_0x3b5323,_0x731765[_0x5315('0x45')]);return db[_0x5315('0x3d')][_0x5315('0x46')](_0x3b5323)[_0x5315('0x25')](handleEntityNotFound(_0x2b3cc2,null))[_0x5315('0x25')](respondWithResult(_0x2b3cc2,null))[_0x5315('0x40')](handleError(_0x2b3cc2,null));};exports[_0x5315('0x47')]=function(_0x492790,_0x37931a){return db[_0x5315('0x3d')][_0x5315('0x47')](_0x492790[_0x5315('0x48')],{})[_0x5315('0x25')](respondWithResult(_0x37931a,0xc9))['catch'](handleError(_0x37931a,null));};exports[_0x5315('0x24')]=function(_0x564670,_0x369fd6){if(_0x564670[_0x5315('0x48')]['id']){delete _0x564670['body']['id'];}return db[_0x5315('0x3d')][_0x5315('0x46')]({'where':{'id':_0x564670[_0x5315('0x42')]['id']}})[_0x5315('0x25')](handleEntityNotFound(_0x369fd6,null))[_0x5315('0x25')](saveUpdates(_0x564670[_0x5315('0x48')],null))[_0x5315('0x25')](respondWithResult(_0x369fd6,null))[_0x5315('0x40')](handleError(_0x369fd6,null));};exports['destroy']=function(_0x725068,_0x47581c){return db[_0x5315('0x3d')][_0x5315('0x46')]({'where':{'id':_0x725068['params']['id']}})[_0x5315('0x25')](handleEntityNotFound(_0x47581c,null))[_0x5315('0x25')](removeEntity(_0x47581c,null))[_0x5315('0x40')](handleError(_0x47581c,null));};exports[_0x5315('0x49')]=function(_0x54b004,_0x26a0ad){return db[_0x5315('0x3d')][_0x5315('0x49')]()[_0x5315('0x25')](respondWithResult(_0x26a0ad,null))[_0x5315('0x40')](handleError(_0x26a0ad,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 52a2933..a62bd7b 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xc129be,_0x294f16){var _0x44fa8e=function(_0x213691){while(--_0x213691){_0xc129be['push'](_0xc129be['shift']());}};_0x44fa8e(++_0x294f16);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x41fb97,_0x552063){var _0xcd390=function(_0x345aa3){while(--_0x345aa3){_0x41fb97['push'](_0x41fb97['shift']());}};_0xcd390(++_0x552063);}(_0x70e0,0x17b));var _0x070e=function(_0x82b2b,_0x1f0883){_0x82b2b=_0x82b2b-0x0;var _0x1f8ce4=_0x70e0[_0x82b2b];return _0x1f8ce4;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7e6a33b..da5d6af 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 _0x43a6=['info','SmsQueueReport,\x20%s,\x20%s','debug','error','message','request\x20sent','result','CreateSmsQueueReport','create','options','then','stringify','UpdateSmsQueueReport','SmsQueueReport','update','body','raw','attributes','limit','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x41ac7c,_0x17dc4d){var _0x17d063=function(_0x4bb64c){while(--_0x4bb64c){_0x41ac7c['push'](_0x41ac7c['shift']());}};_0x17d063(++_0x17dc4d);}(_0x43a6,0x152));var _0x643a=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x43a6[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require(_0x643a('0x0'));var util=require(_0x643a('0x1'));var moment=require('moment');var BPromise=require(_0x643a('0x2'));var rs=require(_0x643a('0x3'));var fs=require('fs');var Redis=require(_0x643a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x643a('0x5'));var config=require(_0x643a('0x6'));var jayson=require(_0x643a('0x7'));var client=jayson['client'][_0x643a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42e4d4,_0x3bc4c6,_0x287d06){return new BPromise(function(_0x246c68,_0x2f289b){return client[_0x643a('0x9')](_0x42e4d4,_0x287d06)['then'](function(_0x52df2e){logger[_0x643a('0xa')](_0x643a('0xb'),_0x3bc4c6,'request\x20sent');logger[_0x643a('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3bc4c6,'request\x20sent',JSON['stringify'](_0x52df2e));if(_0x52df2e['error']){if(_0x52df2e[_0x643a('0xd')]['code']===0x1f4){logger[_0x643a('0xd')](_0x643a('0xb'),_0x3bc4c6,_0x52df2e['error'][_0x643a('0xe')]);return _0x2f289b(_0x52df2e['error']['message']);}logger[_0x643a('0xd')](_0x643a('0xb'),_0x3bc4c6,_0x52df2e[_0x643a('0xd')][_0x643a('0xe')]);return _0x246c68(_0x52df2e[_0x643a('0xd')][_0x643a('0xe')]);}else{logger['info'](_0x643a('0xb'),_0x3bc4c6,_0x643a('0xf'));_0x246c68(_0x52df2e[_0x643a('0x10')]['message']);}})['catch'](function(_0x44e222){logger[_0x643a('0xd')](_0x643a('0xb'),_0x3bc4c6,_0x44e222);_0x2f289b(_0x44e222);});});}exports[_0x643a('0x11')]=function(_0x3fb0b4){var _0xa8457b=this;return new Promise(function(_0x20539e,_0x3ecac0){return db['SmsQueueReport'][_0x643a('0x12')](_0x3fb0b4['body'],{'raw':_0x3fb0b4[_0x643a('0x13')]?_0x3fb0b4[_0x643a('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x643a('0x14')](function(_0x2b2cd6){logger[_0x643a('0xa')](_0x643a('0x11'),_0x3fb0b4);logger[_0x643a('0xc')](_0x643a('0x11'),_0x3fb0b4,JSON[_0x643a('0x15')](_0x2b2cd6));_0x20539e(_0x2b2cd6);})['catch'](function(_0xa741bc){logger[_0x643a('0xd')](_0x643a('0x11'),_0xa741bc[_0x643a('0xe')],_0x3fb0b4);_0x3ecac0(_0xa8457b['error'](0x1f4,_0xa741bc[_0x643a('0xe')]));});});};exports[_0x643a('0x16')]=function(_0x4593c0){var _0x2432c6=this;return new Promise(function(_0x58bc3b,_0x108b34){return db[_0x643a('0x17')][_0x643a('0x18')](_0x4593c0[_0x643a('0x19')],{'raw':_0x4593c0[_0x643a('0x13')]?_0x4593c0['options'][_0x643a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4593c0['options']?_0x4593c0['options']['where']||null:null,'attributes':_0x4593c0[_0x643a('0x13')]?_0x4593c0['options'][_0x643a('0x1b')]||null:null,'limit':_0x4593c0[_0x643a('0x13')]?_0x4593c0[_0x643a('0x13')][_0x643a('0x1c')]||null:null})['then'](function(_0x222163){logger['info'](_0x643a('0x16'),_0x4593c0);logger[_0x643a('0xc')](_0x643a('0x16'),_0x4593c0,JSON[_0x643a('0x15')](_0x222163));_0x58bc3b(_0x222163);})['catch'](function(_0x260f6b){logger[_0x643a('0xd')](_0x643a('0x16'),_0x260f6b[_0x643a('0xe')],_0x4593c0);_0x108b34(_0x2432c6[_0x643a('0xd')](0x1f4,_0x260f6b[_0x643a('0xe')]));});});}; \ No newline at end of file +var _0xef30=['client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x485599,_0x3bf1b9){var _0x2c491b=function(_0xd574f8){while(--_0xd574f8){_0x485599['push'](_0x485599['shift']());}};_0x2c491b(++_0x3bf1b9);}(_0xef30,0x132));var _0x0ef3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xef30[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0ef3('0x0'));var moment=require(_0x0ef3('0x1'));var BPromise=require(_0x0ef3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ef3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ef3('0x4'));var logger=require(_0x0ef3('0x5'))(_0x0ef3('0x6'));var config=require(_0x0ef3('0x7'));var jayson=require(_0x0ef3('0x8'));var client=jayson[_0x0ef3('0x9')][_0x0ef3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47272d,_0x1a2f2e,_0x1674ce){return new BPromise(function(_0x1eb6b3,_0x1f27df){return client[_0x0ef3('0xb')](_0x47272d,_0x1674ce)['then'](function(_0x2cc456){logger['info'](_0x0ef3('0xc'),_0x1a2f2e,_0x0ef3('0xd'));logger[_0x0ef3('0xe')](_0x0ef3('0xf'),_0x1a2f2e,'request\x20sent',JSON[_0x0ef3('0x10')](_0x2cc456));if(_0x2cc456['error']){if(_0x2cc456[_0x0ef3('0x11')][_0x0ef3('0x12')]===0x1f4){logger[_0x0ef3('0x11')](_0x0ef3('0xc'),_0x1a2f2e,_0x2cc456[_0x0ef3('0x11')][_0x0ef3('0x13')]);return _0x1f27df(_0x2cc456[_0x0ef3('0x11')][_0x0ef3('0x13')]);}logger[_0x0ef3('0x11')](_0x0ef3('0xc'),_0x1a2f2e,_0x2cc456[_0x0ef3('0x11')]['message']);return _0x1eb6b3(_0x2cc456[_0x0ef3('0x11')][_0x0ef3('0x13')]);}else{logger[_0x0ef3('0x14')](_0x0ef3('0xc'),_0x1a2f2e,_0x0ef3('0xd'));_0x1eb6b3(_0x2cc456[_0x0ef3('0x15')][_0x0ef3('0x13')]);}})[_0x0ef3('0x16')](function(_0x1eec96){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1a2f2e,_0x1eec96);_0x1f27df(_0x1eec96);});});}exports[_0x0ef3('0x17')]=function(_0x1aa53d){var _0x506168=this;return new Promise(function(_0x303808,_0x4ad3e5){return db[_0x0ef3('0x18')][_0x0ef3('0x19')](_0x1aa53d[_0x0ef3('0x1a')],{'raw':_0x1aa53d['options']?_0x1aa53d[_0x0ef3('0x1b')][_0x0ef3('0x1c')]===undefined?!![]:![]:!![]})[_0x0ef3('0x1d')](function(_0x29dc86){logger['info'](_0x0ef3('0x17'),_0x1aa53d);logger['debug'](_0x0ef3('0x17'),_0x1aa53d,JSON[_0x0ef3('0x10')](_0x29dc86));_0x303808(_0x29dc86);})['catch'](function(_0x62bc57){logger[_0x0ef3('0x11')](_0x0ef3('0x17'),_0x62bc57['message'],_0x1aa53d);_0x4ad3e5(_0x506168[_0x0ef3('0x11')](0x1f4,_0x62bc57[_0x0ef3('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x255f77){var _0x4be6c6=this;return new Promise(function(_0x5af286,_0x96a53f){return db['SmsQueueReport'][_0x0ef3('0x1e')](_0x255f77['body'],{'raw':_0x255f77[_0x0ef3('0x1b')]?_0x255f77[_0x0ef3('0x1b')][_0x0ef3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x255f77['options']?_0x255f77['options'][_0x0ef3('0x1f')]||null:null,'attributes':_0x255f77[_0x0ef3('0x1b')]?_0x255f77[_0x0ef3('0x1b')][_0x0ef3('0x20')]||null:null,'limit':_0x255f77[_0x0ef3('0x1b')]?_0x255f77[_0x0ef3('0x1b')][_0x0ef3('0x21')]||null:null})[_0x0ef3('0x1d')](function(_0x710365){logger[_0x0ef3('0x14')](_0x0ef3('0x22'),_0x255f77);logger[_0x0ef3('0xe')](_0x0ef3('0x22'),_0x255f77,JSON['stringify'](_0x710365));_0x5af286(_0x710365);})['catch'](function(_0x36b393){logger['error'](_0x0ef3('0x22'),_0x36b393[_0x0ef3('0x13')],_0x255f77);_0x96a53f(_0x4be6c6[_0x0ef3('0x11')](0x1f4,_0x36b393[_0x0ef3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ead5588..e5c6c68 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 _0xb66c=['./smsTransferReport.controller','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0xb66c,0x175));var _0xcb66=function(_0x239f9a,_0x1d9537){_0x239f9a=_0x239f9a-0x0;var _0x50c20a=_0xb66c[_0x239f9a];return _0x50c20a;};'use strict';var multer=require(_0xcb66('0x0'));var util=require('util');var path=require(_0xcb66('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb66('0x2'));var router=express[_0xcb66('0x3')]();var fs_extra=require(_0xcb66('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var controller=require(_0xcb66('0x7'));router[_0xcb66('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcb66('0x8')](_0xcb66('0x9'),auth[_0xcb66('0xa')](),controller[_0xcb66('0xb')]);router[_0xcb66('0x8')]('/:id',auth[_0xcb66('0xa')](),controller[_0xcb66('0xc')]);router[_0xcb66('0xd')]('/',auth[_0xcb66('0xa')](),controller[_0xcb66('0xe')]);router['put'](_0xcb66('0xf'),auth[_0xcb66('0xa')](),controller[_0xcb66('0x10')]);router[_0xcb66('0x11')]('/:id',auth[_0xcb66('0xa')](),controller[_0xcb66('0x12')]);module[_0xcb66('0x13')]=router; \ No newline at end of file +var _0x0689=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x227484,_0x1a51fe){var _0x50e03a=function(_0x1fd88a){while(--_0x1fd88a){_0x227484['push'](_0x227484['shift']());}};_0x50e03a(++_0x1a51fe);}(_0x0689,0x161));var _0x9068=function(_0x593467,_0x14e615){_0x593467=_0x593467-0x0;var _0x67a71b=_0x0689[_0x593467];return _0x67a71b;};'use strict';var multer=require('multer');var util=require(_0x9068('0x0'));var path=require('path');var timeout=require(_0x9068('0x1'));var express=require(_0x9068('0x2'));var router=express[_0x9068('0x3')]();var fs_extra=require(_0x9068('0x4'));var auth=require(_0x9068('0x5'));var interaction=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var controller=require(_0x9068('0x8'));router[_0x9068('0x9')]('/',auth[_0x9068('0xa')](),controller['index']);router[_0x9068('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9068('0xb')]);router[_0x9068('0x9')](_0x9068('0xc'),auth[_0x9068('0xa')](),controller[_0x9068('0xd')]);router[_0x9068('0xe')]('/',auth[_0x9068('0xa')](),controller[_0x9068('0xf')]);router[_0x9068('0x10')]('/:id',auth[_0x9068('0xa')](),controller[_0x9068('0x11')]);router[_0x9068('0x12')](_0x9068('0xc'),auth['isAuthenticated'](),controller[_0x9068('0x13')]);module[_0x9068('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 37d4910..809f9d2 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x452720,_0xb777e0){var _0x2c9eac=function(_0x1bb520){while(--_0x1bb520){_0x452720['push'](_0x452720['shift']());}};_0x2c9eac(++_0xb777e0);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1f7ec0,_0x3a2766){_0x1f7ec0=_0x1f7ec0-0x0;var _0x4bdc35=_0xf4eb[_0x1f7ec0];return _0x4bdc35;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x5e11ff,_0x247853){var _0x38498e=function(_0x410d6e){while(--_0x410d6e){_0x5e11ff['push'](_0x5e11ff['shift']());}};_0x38498e(++_0x247853);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index db5aed3..0b69f80 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 _0xd0de=['model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsTransferReport','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes'];(function(_0x20f39f,_0x1b6b7a){var _0x1f65cd=function(_0x4fbc1b){while(--_0x4fbc1b){_0x20f39f['push'](_0x20f39f['shift']());}};_0x1f65cd(++_0x1b6b7a);}(_0xd0de,0xf6));var _0xed0d=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0xd0de[_0x470e67];return _0x28bbde;};'use strict';var emlformat=require(_0xed0d('0x0'));var rimraf=require(_0xed0d('0x1'));var zipdir=require(_0xed0d('0x2'));var jsonpatch=require(_0xed0d('0x3'));var rp=require(_0xed0d('0x4'));var moment=require('moment');var BPromise=require(_0xed0d('0x5'));var Mustache=require(_0xed0d('0x6'));var util=require('util');var path=require(_0xed0d('0x7'));var sox=require(_0xed0d('0x8'));var csv=require('to-csv');var ejs=require(_0xed0d('0x9'));var fs=require('fs');var fs_extra=require(_0xed0d('0xa'));var _=require(_0xed0d('0xb'));var squel=require(_0xed0d('0xc'));var crypto=require(_0xed0d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xed0d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xed0d('0xf'));var Redis=require(_0xed0d('0x10'));var authService=require(_0xed0d('0x11'));var qs=require(_0xed0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed0d('0x13'));var logger=require(_0xed0d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xed0d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18b892,_0x5dde8a){_0x5dde8a=_0x5dde8a||0xcc;return function(_0x210fcc){if(_0x210fcc){return _0x18b892['sendStatus'](_0x5dde8a);}return _0x18b892[_0xed0d('0x16')](_0x5dde8a)[_0xed0d('0x17')]();};}function respondWithResult(_0x63ffc1,_0x528176){_0x528176=_0x528176||0xc8;return function(_0x335f02){if(_0x335f02){return _0x63ffc1[_0xed0d('0x16')](_0x528176)[_0xed0d('0x18')](_0x335f02);}};}function respondWithFilteredResult(_0x48040e,_0x3495a6){return function(_0x41c6eb){if(_0x41c6eb){var _0x5641e8=typeof _0x3495a6['offset']===_0xed0d('0x19')&&typeof _0x3495a6[_0xed0d('0x1a')]===_0xed0d('0x19');var _0x5463ac=_0x41c6eb[_0xed0d('0x1b')];var _0x579a91=_0x5641e8?0x0:_0x3495a6[_0xed0d('0x1c')];var _0x579a5b=_0x5641e8?_0x41c6eb[_0xed0d('0x1b')]:_0x3495a6[_0xed0d('0x1c')]+_0x3495a6[_0xed0d('0x1a')];var _0x3cf5dc;if(_0x579a5b>=_0x5463ac){_0x579a5b=_0x5463ac;_0x3cf5dc=0xc8;}else{_0x3cf5dc=0xce;}_0x48040e['status'](_0x3cf5dc);return _0x48040e['set'](_0xed0d('0x1d'),_0x579a91+'-'+_0x579a5b+'/'+_0x5463ac)[_0xed0d('0x18')](_0x41c6eb);}return null;};}function patchUpdates(_0x530e47){return function(_0xee29f3){try{jsonpatch['apply'](_0xee29f3,_0x530e47,!![]);}catch(_0x139e73){return BPromise[_0xed0d('0x1e')](_0x139e73);}return _0xee29f3['save']();};}function saveUpdates(_0xadcf34,_0x3a0b7a){return function(_0x22ee7d){if(_0x22ee7d){return _0x22ee7d[_0xed0d('0x1f')](_0xadcf34)[_0xed0d('0x20')](function(_0x5d98c0){return _0x5d98c0;});}return null;};}function removeEntity(_0x542102,_0x1047c5){return function(_0x478df6){if(_0x478df6){return _0x478df6[_0xed0d('0x21')]()['then'](function(){_0x542102[_0xed0d('0x16')](0xcc)[_0xed0d('0x17')]();});}};}function handleEntityNotFound(_0x9300f8,_0x2b5da2){return function(_0x3153b1){if(!_0x3153b1){_0x9300f8[_0xed0d('0x22')](0x194);}return _0x3153b1;};}function handleError(_0x33b7a6,_0x55ef41){_0x55ef41=_0x55ef41||0x1f4;return function(_0x485f90){logger[_0xed0d('0x23')](_0x485f90[_0xed0d('0x24')]);if(_0x485f90[_0xed0d('0x25')]){delete _0x485f90['name'];}_0x33b7a6[_0xed0d('0x16')](_0x55ef41)[_0xed0d('0x26')](_0x485f90);};}exports[_0xed0d('0x27')]=function(_0x21fecf,_0x419fe1){var _0x59144a={},_0x4ad8cc={},_0x504473={'count':0x0,'rows':[]};var _0x27bc82=_[_0xed0d('0x28')](db['SmsTransferReport'][_0xed0d('0x29')],function(_0x24415d){return{'name':_0x24415d['fieldName'],'type':_0x24415d['type']['key']};});_0x4ad8cc[_0xed0d('0x2a')]=_[_0xed0d('0x28')](_0x27bc82,_0xed0d('0x25'));_0x4ad8cc[_0xed0d('0x2b')]=_['keys'](_0x21fecf['query']);_0x4ad8cc[_0xed0d('0x2c')]=_['intersection'](_0x4ad8cc[_0xed0d('0x2a')],_0x4ad8cc[_0xed0d('0x2b')]);_0x59144a[_0xed0d('0x2d')]=_[_0xed0d('0x2e')](_0x4ad8cc[_0xed0d('0x2a')],qs[_0xed0d('0x2f')](_0x21fecf['query'][_0xed0d('0x2f')]));_0x59144a[_0xed0d('0x2d')]=_0x59144a['attributes'][_0xed0d('0x30')]?_0x59144a[_0xed0d('0x2d')]:_0x4ad8cc[_0xed0d('0x2a')];if(!_0x21fecf[_0xed0d('0x2b')][_0xed0d('0x31')](_0xed0d('0x32'))){_0x59144a[_0xed0d('0x1a')]=qs[_0xed0d('0x1a')](_0x21fecf[_0xed0d('0x2b')][_0xed0d('0x1a')]);_0x59144a['offset']=qs['offset'](_0x21fecf[_0xed0d('0x2b')][_0xed0d('0x1c')]);}_0x59144a[_0xed0d('0x33')]=qs[_0xed0d('0x34')](_0x21fecf[_0xed0d('0x2b')][_0xed0d('0x34')]);_0x59144a[_0xed0d('0x35')]=qs['filters'](_[_0xed0d('0x36')](_0x21fecf['query'],_0x4ad8cc[_0xed0d('0x2c')]),_0x27bc82);if(_0x21fecf['query'][_0xed0d('0x37')]){_0x59144a['where']=_[_0xed0d('0x38')](_0x59144a[_0xed0d('0x35')],{'$or':_[_0xed0d('0x28')](_0x27bc82,function(_0x480fcd){if(_0x480fcd[_0xed0d('0x39')]!==_0xed0d('0x3a')){var _0x5776da={};_0x5776da[_0x480fcd[_0xed0d('0x25')]]={'$like':'%'+_0x21fecf['query'][_0xed0d('0x37')]+'%'};return _0x5776da;}})});}_0x59144a=_[_0xed0d('0x38')]({},_0x59144a,_0x21fecf[_0xed0d('0x3b')]);var _0x22942a={'where':_0x59144a['where']};return db[_0xed0d('0x3c')][_0xed0d('0x1b')](_0x22942a)['then'](function(_0x31651d){_0x504473[_0xed0d('0x1b')]=_0x31651d;if(_0x21fecf[_0xed0d('0x2b')][_0xed0d('0x3d')]){_0x59144a[_0xed0d('0x3e')]=[{'all':!![]}];}return db[_0xed0d('0x3c')][_0xed0d('0x3f')](_0x59144a);})[_0xed0d('0x20')](function(_0x388828){_0x504473[_0xed0d('0x40')]=_0x388828;return _0x504473;})[_0xed0d('0x20')](respondWithFilteredResult(_0x419fe1,_0x59144a))[_0xed0d('0x41')](handleError(_0x419fe1,null));};exports['show']=function(_0x91f9c2,_0xc90183){var _0x54a894={'raw':!![],'where':{'id':_0x91f9c2[_0xed0d('0x42')]['id']}},_0x1d2904={};_0x1d2904[_0xed0d('0x2a')]=_[_0xed0d('0x43')](db[_0xed0d('0x3c')][_0xed0d('0x29')]);_0x1d2904[_0xed0d('0x2b')]=_[_0xed0d('0x43')](_0x91f9c2[_0xed0d('0x2b')]);_0x1d2904['filters']=_['intersection'](_0x1d2904[_0xed0d('0x2a')],_0x1d2904[_0xed0d('0x2b')]);_0x54a894[_0xed0d('0x2d')]=_[_0xed0d('0x2e')](_0x1d2904[_0xed0d('0x2a')],qs[_0xed0d('0x2f')](_0x91f9c2[_0xed0d('0x2b')][_0xed0d('0x2f')]));_0x54a894['attributes']=_0x54a894['attributes']['length']?_0x54a894['attributes']:_0x1d2904['model'];if(_0x91f9c2[_0xed0d('0x2b')][_0xed0d('0x3d')]){_0x54a894[_0xed0d('0x3e')]=[{'all':!![]}];}_0x54a894=_[_0xed0d('0x38')]({},_0x54a894,_0x91f9c2[_0xed0d('0x3b')]);return db[_0xed0d('0x3c')][_0xed0d('0x44')](_0x54a894)['then'](handleEntityNotFound(_0xc90183,null))['then'](respondWithResult(_0xc90183,null))[_0xed0d('0x41')](handleError(_0xc90183,null));};exports['create']=function(_0x2d244b,_0x2317d5){return db[_0xed0d('0x3c')][_0xed0d('0x45')](_0x2d244b['body'],{})[_0xed0d('0x20')](respondWithResult(_0x2317d5,0xc9))[_0xed0d('0x41')](handleError(_0x2317d5,null));};exports['update']=function(_0x1c7f2a,_0x391505){if(_0x1c7f2a[_0xed0d('0x46')]['id']){delete _0x1c7f2a[_0xed0d('0x46')]['id'];}return db[_0xed0d('0x3c')]['find']({'where':{'id':_0x1c7f2a[_0xed0d('0x42')]['id']}})[_0xed0d('0x20')](handleEntityNotFound(_0x391505,null))[_0xed0d('0x20')](saveUpdates(_0x1c7f2a['body'],null))[_0xed0d('0x20')](respondWithResult(_0x391505,null))['catch'](handleError(_0x391505,null));};exports[_0xed0d('0x21')]=function(_0x36853e,_0x26b0b1){return db['SmsTransferReport'][_0xed0d('0x44')]({'where':{'id':_0x36853e['params']['id']}})[_0xed0d('0x20')](handleEntityNotFound(_0x26b0b1,null))['then'](removeEntity(_0x26b0b1,null))[_0xed0d('0x41')](handleError(_0x26b0b1,null));};exports[_0xed0d('0x47')]=function(_0x370254,_0x1b5e40){return db['SmsTransferReport']['describe']()[_0xed0d('0x20')](respondWithResult(_0x1b5e40,null))[_0xed0d('0x41')](handleError(_0x1b5e40,null));}; \ No newline at end of file +var _0xab62=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','SmsTransferReport','params','keys','includeAll','catch','create','body','find','destroy','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab62,0x96));var _0x2ab6=function(_0x13c28e,_0x27b6ce){_0x13c28e=_0x13c28e-0x0;var _0x36710a=_0xab62[_0x13c28e];return _0x36710a;};'use strict';var emlformat=require(_0x2ab6('0x0'));var rimraf=require(_0x2ab6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ab6('0x2'));var rp=require(_0x2ab6('0x3'));var moment=require(_0x2ab6('0x4'));var BPromise=require(_0x2ab6('0x5'));var Mustache=require(_0x2ab6('0x6'));var util=require(_0x2ab6('0x7'));var path=require('path');var sox=require(_0x2ab6('0x8'));var csv=require(_0x2ab6('0x9'));var ejs=require(_0x2ab6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ab6('0xb'));var squel=require('squel');var crypto=require(_0x2ab6('0xc'));var jsforce=require(_0x2ab6('0xd'));var deskjs=require(_0x2ab6('0xe'));var toCsv=require(_0x2ab6('0x9'));var querystring=require(_0x2ab6('0xf'));var Papa=require(_0x2ab6('0x10'));var Redis=require(_0x2ab6('0x11'));var authService=require(_0x2ab6('0x12'));var qs=require(_0x2ab6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2ab6('0x14'));var utils=require(_0x2ab6('0x15'));var config=require(_0x2ab6('0x16'));var licenseUtil=require(_0x2ab6('0x17'));var db=require(_0x2ab6('0x18'))['db'];function respondWithStatusCode(_0x31d12d,_0x50fba6){_0x50fba6=_0x50fba6||0xcc;return function(_0x18ffb7){if(_0x18ffb7){return _0x31d12d[_0x2ab6('0x19')](_0x50fba6);}return _0x31d12d[_0x2ab6('0x1a')](_0x50fba6)[_0x2ab6('0x1b')]();};}function respondWithResult(_0x4ddb27,_0x116139){_0x116139=_0x116139||0xc8;return function(_0x1ffa14){if(_0x1ffa14){return _0x4ddb27[_0x2ab6('0x1a')](_0x116139)[_0x2ab6('0x1c')](_0x1ffa14);}};}function respondWithFilteredResult(_0x4e74b7,_0x46adcc){return function(_0x52176e){if(_0x52176e){var _0x542860=typeof _0x46adcc['offset']==='undefined'&&typeof _0x46adcc[_0x2ab6('0x1d')]===_0x2ab6('0x1e');var _0x50e49b=_0x52176e[_0x2ab6('0x1f')];var _0x14a95b=_0x542860?0x0:_0x46adcc[_0x2ab6('0x20')];var _0x24cb6e=_0x542860?_0x52176e[_0x2ab6('0x1f')]:_0x46adcc['offset']+_0x46adcc[_0x2ab6('0x1d')];var _0x2ef5ee;if(_0x24cb6e>=_0x50e49b){_0x24cb6e=_0x50e49b;_0x2ef5ee=0xc8;}else{_0x2ef5ee=0xce;}_0x4e74b7['status'](_0x2ef5ee);return _0x4e74b7[_0x2ab6('0x21')](_0x2ab6('0x22'),_0x14a95b+'-'+_0x24cb6e+'/'+_0x50e49b)[_0x2ab6('0x1c')](_0x52176e);}return null;};}function patchUpdates(_0x20b509){return function(_0x3d506f){try{jsonpatch[_0x2ab6('0x23')](_0x3d506f,_0x20b509,!![]);}catch(_0x24b70b){return BPromise[_0x2ab6('0x24')](_0x24b70b);}return _0x3d506f['save']();};}function saveUpdates(_0x3f057a,_0x436623){return function(_0x41ba11){if(_0x41ba11){return _0x41ba11[_0x2ab6('0x25')](_0x3f057a)['then'](function(_0x68d63c){return _0x68d63c;});}return null;};}function removeEntity(_0x4bb3b1,_0x5c9caf){return function(_0x2cd0bb){if(_0x2cd0bb){return _0x2cd0bb['destroy']()[_0x2ab6('0x26')](function(){_0x4bb3b1[_0x2ab6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21bc52,_0x21288d){return function(_0x56c494){if(!_0x56c494){_0x21bc52['sendStatus'](0x194);}return _0x56c494;};}function handleError(_0x3cfac3,_0x70f116){_0x70f116=_0x70f116||0x1f4;return function(_0x39b934){logger[_0x2ab6('0x27')](_0x39b934[_0x2ab6('0x28')]);if(_0x39b934[_0x2ab6('0x29')]){delete _0x39b934[_0x2ab6('0x29')];}_0x3cfac3[_0x2ab6('0x1a')](_0x70f116)[_0x2ab6('0x2a')](_0x39b934);};}exports[_0x2ab6('0x2b')]=function(_0x13b1ab,_0x2f7106){var _0x330d8e={},_0x4fbc47={},_0x30c526={'count':0x0,'rows':[]};var _0x4b85ed=_[_0x2ab6('0x2c')](db['SmsTransferReport'][_0x2ab6('0x2d')],function(_0xa634ce){return{'name':_0xa634ce[_0x2ab6('0x2e')],'type':_0xa634ce[_0x2ab6('0x2f')][_0x2ab6('0x30')]};});_0x4fbc47[_0x2ab6('0x31')]=_[_0x2ab6('0x2c')](_0x4b85ed,'name');_0x4fbc47['query']=_['keys'](_0x13b1ab[_0x2ab6('0x32')]);_0x4fbc47[_0x2ab6('0x33')]=_[_0x2ab6('0x34')](_0x4fbc47[_0x2ab6('0x31')],_0x4fbc47[_0x2ab6('0x32')]);_0x330d8e['attributes']=_[_0x2ab6('0x34')](_0x4fbc47[_0x2ab6('0x31')],qs[_0x2ab6('0x35')](_0x13b1ab[_0x2ab6('0x32')]['fields']));_0x330d8e[_0x2ab6('0x36')]=_0x330d8e[_0x2ab6('0x36')][_0x2ab6('0x37')]?_0x330d8e['attributes']:_0x4fbc47[_0x2ab6('0x31')];if(!_0x13b1ab[_0x2ab6('0x32')][_0x2ab6('0x38')](_0x2ab6('0x39'))){_0x330d8e[_0x2ab6('0x1d')]=qs['limit'](_0x13b1ab['query'][_0x2ab6('0x1d')]);_0x330d8e['offset']=qs['offset'](_0x13b1ab['query']['offset']);}_0x330d8e[_0x2ab6('0x3a')]=qs[_0x2ab6('0x3b')](_0x13b1ab['query'][_0x2ab6('0x3b')]);_0x330d8e[_0x2ab6('0x3c')]=qs[_0x2ab6('0x33')](_[_0x2ab6('0x3d')](_0x13b1ab[_0x2ab6('0x32')],_0x4fbc47['filters']),_0x4b85ed);if(_0x13b1ab[_0x2ab6('0x32')]['filter']){_0x330d8e['where']=_['merge'](_0x330d8e[_0x2ab6('0x3c')],{'$or':_[_0x2ab6('0x2c')](_0x4b85ed,function(_0x4ccce6){if(_0x4ccce6['type']!==_0x2ab6('0x3e')){var _0x8276d9={};_0x8276d9[_0x4ccce6[_0x2ab6('0x29')]]={'$like':'%'+_0x13b1ab['query']['filter']+'%'};return _0x8276d9;}})});}_0x330d8e=_[_0x2ab6('0x3f')]({},_0x330d8e,_0x13b1ab[_0x2ab6('0x40')]);var _0x3585b5={'where':_0x330d8e[_0x2ab6('0x3c')]};return db[_0x2ab6('0x41')]['count'](_0x3585b5)[_0x2ab6('0x26')](function(_0x57444d){_0x30c526[_0x2ab6('0x1f')]=_0x57444d;if(_0x13b1ab['query']['includeAll']){_0x330d8e['include']=[{'all':!![]}];}return db[_0x2ab6('0x41')]['findAll'](_0x330d8e);})[_0x2ab6('0x26')](function(_0x334b7c){_0x30c526['rows']=_0x334b7c;return _0x30c526;})[_0x2ab6('0x26')](respondWithFilteredResult(_0x2f7106,_0x330d8e))['catch'](handleError(_0x2f7106,null));};exports['show']=function(_0x2f8e0c,_0x2fe7a7){var _0x11ea40={'raw':!![],'where':{'id':_0x2f8e0c[_0x2ab6('0x42')]['id']}},_0x2ddb0c={};_0x2ddb0c['model']=_[_0x2ab6('0x43')](db[_0x2ab6('0x41')][_0x2ab6('0x2d')]);_0x2ddb0c[_0x2ab6('0x32')]=_['keys'](_0x2f8e0c[_0x2ab6('0x32')]);_0x2ddb0c[_0x2ab6('0x33')]=_[_0x2ab6('0x34')](_0x2ddb0c[_0x2ab6('0x31')],_0x2ddb0c['query']);_0x11ea40['attributes']=_['intersection'](_0x2ddb0c[_0x2ab6('0x31')],qs['fields'](_0x2f8e0c[_0x2ab6('0x32')]['fields']));_0x11ea40['attributes']=_0x11ea40['attributes']['length']?_0x11ea40[_0x2ab6('0x36')]:_0x2ddb0c[_0x2ab6('0x31')];if(_0x2f8e0c[_0x2ab6('0x32')][_0x2ab6('0x44')]){_0x11ea40['include']=[{'all':!![]}];}_0x11ea40=_['merge']({},_0x11ea40,_0x2f8e0c[_0x2ab6('0x40')]);return db[_0x2ab6('0x41')]['find'](_0x11ea40)['then'](handleEntityNotFound(_0x2fe7a7,null))[_0x2ab6('0x26')](respondWithResult(_0x2fe7a7,null))[_0x2ab6('0x45')](handleError(_0x2fe7a7,null));};exports[_0x2ab6('0x46')]=function(_0x429c82,_0x199388){return db[_0x2ab6('0x41')][_0x2ab6('0x46')](_0x429c82[_0x2ab6('0x47')],{})[_0x2ab6('0x26')](respondWithResult(_0x199388,0xc9))['catch'](handleError(_0x199388,null));};exports['update']=function(_0x12d78a,_0x793fce){if(_0x12d78a['body']['id']){delete _0x12d78a['body']['id'];}return db['SmsTransferReport'][_0x2ab6('0x48')]({'where':{'id':_0x12d78a[_0x2ab6('0x42')]['id']}})[_0x2ab6('0x26')](handleEntityNotFound(_0x793fce,null))['then'](saveUpdates(_0x12d78a[_0x2ab6('0x47')],null))['then'](respondWithResult(_0x793fce,null))['catch'](handleError(_0x793fce,null));};exports[_0x2ab6('0x49')]=function(_0x4cc343,_0x4b3678){return db['SmsTransferReport'][_0x2ab6('0x48')]({'where':{'id':_0x4cc343[_0x2ab6('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b3678,null))[_0x2ab6('0x26')](removeEntity(_0x4b3678,null))[_0x2ab6('0x45')](handleError(_0x4b3678,null));};exports[_0x2ab6('0x4a')]=function(_0x4b98e3,_0x4a60ee){return db[_0x2ab6('0x41')][_0x2ab6('0x4a')]()[_0x2ab6('0x26')](respondWithResult(_0x4a60ee,null))[_0x2ab6('0x45')](handleError(_0x4a60ee,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b045f44..64fcd46 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 _0xb016=['define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb016,0x129));var _0x6b01=function(_0x2ab840,_0x349fc6){_0x2ab840=_0x2ab840-0x0;var _0x48d423=_0xb016[_0x2ab840];return _0x48d423;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require(_0x6b01('0x2'))(_0x6b01('0x3'));var moment=require(_0x6b01('0x4'));var BPromise=require(_0x6b01('0x5'));var rp=require(_0x6b01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b01('0x7'));var config=require(_0x6b01('0x8'));var attributes=require(_0x6b01('0x9'));module[_0x6b01('0xa')]=function(_0x7bc7b1,_0xe5c773){return _0x7bc7b1[_0x6b01('0xb')]('SmsTransferReport',attributes,{'tableName':_0x6b01('0xc'),'paranoid':![],'indexes':[{'name':_0x6b01('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x536e=['../../config/environment','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x36472f,_0x50db34){var _0x5e31b6=function(_0x58674d){while(--_0x58674d){_0x36472f['push'](_0x36472f['shift']());}};_0x5e31b6(++_0x50db34);}(_0x536e,0x155));var _0xe536=function(_0x47643e,_0x337374){_0x47643e=_0x47643e-0x0;var _0x2aa5db=_0x536e[_0x47643e];return _0x2aa5db;};'use strict';var _=require(_0xe536('0x0'));var util=require(_0xe536('0x1'));var logger=require(_0xe536('0x2'))(_0xe536('0x3'));var moment=require(_0xe536('0x4'));var BPromise=require(_0xe536('0x5'));var rp=require(_0xe536('0x6'));var fs=require('fs');var path=require(_0xe536('0x7'));var rimraf=require(_0xe536('0x8'));var config=require(_0xe536('0x9'));var attributes=require(_0xe536('0xa'));module[_0xe536('0xb')]=function(_0x263c4f,_0x2991af){return _0x263c4f['define']('SmsTransferReport',attributes,{'tableName':_0xe536('0xc'),'paranoid':![],'indexes':[{'name':_0xe536('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index b9eb512..72e44f4 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 _0x00b3=['request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x293340,_0x44d592){var _0x3b34f4=function(_0x7227ae){while(--_0x7227ae){_0x293340['push'](_0x293340['shift']());}};_0x3b34f4(++_0x44d592);}(_0x00b3,0x97));var _0x300b=function(_0x19318f,_0x38b0cb){_0x19318f=_0x19318f-0x0;var _0x54a793=_0x00b3[_0x19318f];return _0x54a793;};'use strict';var _=require(_0x300b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x300b('0x1'));var rs=require(_0x300b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x300b('0x3'));var logger=require(_0x300b('0x4'))(_0x300b('0x5'));var config=require('../../config/environment');var jayson=require(_0x300b('0x6'));var client=jayson[_0x300b('0x7')][_0x300b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4294fe,_0x643a7b,_0x2cf1c5){return new BPromise(function(_0x103922,_0xcd2a68){return client[_0x300b('0x9')](_0x4294fe,_0x2cf1c5)[_0x300b('0xa')](function(_0x1b9048){logger[_0x300b('0xb')](_0x300b('0xc'),_0x643a7b,'request\x20sent');logger[_0x300b('0xd')](_0x300b('0xe'),_0x643a7b,_0x300b('0xf'),JSON['stringify'](_0x1b9048));if(_0x1b9048[_0x300b('0x10')]){if(_0x1b9048[_0x300b('0x10')]['code']===0x1f4){logger['error'](_0x300b('0xc'),_0x643a7b,_0x1b9048['error'][_0x300b('0x11')]);return _0xcd2a68(_0x1b9048[_0x300b('0x10')][_0x300b('0x11')]);}logger[_0x300b('0x10')](_0x300b('0xc'),_0x643a7b,_0x1b9048[_0x300b('0x10')]['message']);return _0x103922(_0x1b9048['error'][_0x300b('0x11')]);}else{logger[_0x300b('0xb')](_0x300b('0xc'),_0x643a7b,_0x300b('0xf'));_0x103922(_0x1b9048[_0x300b('0x12')][_0x300b('0x11')]);}})[_0x300b('0x13')](function(_0x3e1dbd){logger['error'](_0x300b('0xc'),_0x643a7b,_0x3e1dbd);_0xcd2a68(_0x3e1dbd);});});} \ No newline at end of file +var _0x55a5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x49b27f,_0x4898d2){var _0x178e58=function(_0x11f160){while(--_0x11f160){_0x49b27f['push'](_0x49b27f['shift']());}};_0x178e58(++_0x4898d2);}(_0x55a5,0xf7));var _0x555a=function(_0x185d2a,_0x308609){_0x185d2a=_0x185d2a-0x0;var _0x4dea27=_0x55a5[_0x185d2a];return _0x4dea27;};'use strict';var _=require(_0x555a('0x0'));var util=require('util');var moment=require(_0x555a('0x1'));var BPromise=require(_0x555a('0x2'));var rs=require(_0x555a('0x3'));var fs=require('fs');var Redis=require(_0x555a('0x4'));var db=require(_0x555a('0x5'))['db'];var utils=require(_0x555a('0x6'));var logger=require(_0x555a('0x7'))(_0x555a('0x8'));var config=require(_0x555a('0x9'));var jayson=require(_0x555a('0xa'));var client=jayson[_0x555a('0xb')][_0x555a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x365c37,_0x347461,_0x475b8d){return new BPromise(function(_0x4b5b8e,_0x2fed2e){return client[_0x555a('0xd')](_0x365c37,_0x475b8d)[_0x555a('0xe')](function(_0x23aeab){logger[_0x555a('0xf')](_0x555a('0x10'),_0x347461,_0x555a('0x11'));logger[_0x555a('0x12')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x347461,_0x555a('0x11'),JSON[_0x555a('0x13')](_0x23aeab));if(_0x23aeab[_0x555a('0x14')]){if(_0x23aeab[_0x555a('0x14')][_0x555a('0x15')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x347461,_0x23aeab['error']['message']);return _0x2fed2e(_0x23aeab[_0x555a('0x14')][_0x555a('0x16')]);}logger[_0x555a('0x14')](_0x555a('0x10'),_0x347461,_0x23aeab[_0x555a('0x14')][_0x555a('0x16')]);return _0x4b5b8e(_0x23aeab[_0x555a('0x14')][_0x555a('0x16')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x347461,'request\x20sent');_0x4b5b8e(_0x23aeab[_0x555a('0x17')][_0x555a('0x16')]);}})[_0x555a('0x18')](function(_0x5ef2c2){logger[_0x555a('0x14')](_0x555a('0x10'),_0x347461,_0x5ef2c2);_0x2fed2e(_0x5ef2c2);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d032113..e4376d5 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 _0x5a05=['express','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','format','%s-%s%s','basename','originalname','post','single','file','create','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a05,0xce));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x55a0('0x0'));var util=require(_0x55a0('0x1'));var path=require(_0x55a0('0x2'));var timeout=require(_0x55a0('0x3'));var express=require(_0x55a0('0x4'));var router=express['Router']();var fs_extra=require(_0x55a0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x55a0('0x6'));var config=require(_0x55a0('0x7'));var controller=require(_0x55a0('0x8'));router[_0x55a0('0x9')]('/',auth[_0x55a0('0xa')](),controller[_0x55a0('0xb')]);router['get'](_0x55a0('0xc'),auth[_0x55a0('0xa')](),controller[_0x55a0('0xd')]);router[_0x55a0('0x9')](_0x55a0('0xe'),auth[_0x55a0('0xa')](),controller[_0x55a0('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19dfe8,_0x363290,_0x3821a0){_0x3821a0(null,path[_0x55a0('0x10')](config[_0x55a0('0x11')],_0x55a0('0x12')));},'filename':function(_0x8b1652,_0x54f1ff,_0x36d300){_0x54f1ff['originalname']=_0x54f1ff['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36d300(null,util[_0x55a0('0x13')](_0x55a0('0x14'),path[_0x55a0('0x15')](_0x54f1ff['originalname'],path['extname'](_0x54f1ff[_0x55a0('0x16')])),Date['now'](),path['extname'](_0x54f1ff[_0x55a0('0x16')])));}})});router[_0x55a0('0x17')]('/',upload[_0x55a0('0x18')](_0x55a0('0x19')),controller[_0x55a0('0x1a')]);router['put'](_0x55a0('0xc'),auth[_0x55a0('0xa')](),controller[_0x55a0('0x1b')]);router['delete'](_0x55a0('0xc'),auth[_0x55a0('0xa')](),controller[_0x55a0('0x1c')]);module[_0x55a0('0x1d')]=router; \ No newline at end of file +var _0xfb80=['put','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','server/files/sounds/original/','format','%s-%s%s','basename','originalname','now','single','file','create'];(function(_0xe58f42,_0x13984a){var _0x5f2d91=function(_0x3f3efa){while(--_0x3f3efa){_0xe58f42['push'](_0xe58f42['shift']());}};_0x5f2d91(++_0x13984a);}(_0xfb80,0xe3));var _0x0fb8=function(_0x566601,_0x971d2e){_0x566601=_0x566601-0x0;var _0x2c34b4=_0xfb80[_0x566601];return _0x2c34b4;};'use strict';var multer=require(_0x0fb8('0x0'));var util=require(_0x0fb8('0x1'));var path=require('path');var timeout=require(_0x0fb8('0x2'));var express=require(_0x0fb8('0x3'));var router=express[_0x0fb8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0fb8('0x5'));var interaction=require(_0x0fb8('0x6'));var config=require(_0x0fb8('0x7'));var controller=require(_0x0fb8('0x8'));router[_0x0fb8('0x9')]('/',auth[_0x0fb8('0xa')](),controller[_0x0fb8('0xb')]);router[_0x0fb8('0x9')](_0x0fb8('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0fb8('0x9')](_0x0fb8('0xd'),auth[_0x0fb8('0xa')](),controller[_0x0fb8('0xe')]);var upload=multer({'storage':multer[_0x0fb8('0xf')]({'destination':function(_0x4739df,_0x3976cb,_0x7e165b){_0x7e165b(null,path['join'](config['root'],_0x0fb8('0x10')));},'filename':function(_0x3de5d9,_0x33fb09,_0x1f03e8){_0x33fb09['originalname']=_0x33fb09['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f03e8(null,util[_0x0fb8('0x11')](_0x0fb8('0x12'),path[_0x0fb8('0x13')](_0x33fb09[_0x0fb8('0x14')],path['extname'](_0x33fb09[_0x0fb8('0x14')])),Date[_0x0fb8('0x15')](),path['extname'](_0x33fb09[_0x0fb8('0x14')])));}})});router['post']('/',upload[_0x0fb8('0x16')](_0x0fb8('0x17')),controller[_0x0fb8('0x18')]);router[_0x0fb8('0x19')](_0x0fb8('0xc'),auth['isAuthenticated'](),controller[_0x0fb8('0x1a')]);router[_0x0fb8('0x1b')](_0x0fb8('0xc'),auth[_0x0fb8('0xa')](),controller[_0x0fb8('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 20585c9..74b2dd7 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 _0x61de=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x24cc27,_0x32acca){var _0xecb99e=function(_0xed3230){while(--_0xed3230){_0x24cc27['push'](_0x24cc27['shift']());}};_0xecb99e(++_0x32acca);}(_0x61de,0x1e7));var _0xe61d=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x61de[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0xe61d('0x0'));module[_0xe61d('0x1')]={'name':{'type':Sequelize[_0xe61d('0x2')],'unique':_0xe61d('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xe61d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xe61d('0x2')]},'original_format':{'type':Sequelize[_0xe61d('0x2')]},'original_duration':{'type':Sequelize[_0xe61d('0x4')]},'original_sampleCount':{'type':Sequelize[_0xe61d('0x5')]},'original_channelCount':{'type':Sequelize[_0xe61d('0x6')]},'original_bitRate':{'type':Sequelize[_0xe61d('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xe61d('0x2')]},'converted_duration':{'type':Sequelize[_0xe61d('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xe61d('0x5')]},'converted_channelCount':{'type':Sequelize[_0xe61d('0x6')]},'converted_bitRate':{'type':Sequelize[_0xe61d('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xe61d('0x6')]}}; \ No newline at end of file +var _0xf7f0=['sequelize','exports','name','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x3d86f4,_0x2a9220){var _0x5d8e87=function(_0x542c7c){while(--_0x542c7c){_0x3d86f4['push'](_0x3d86f4['shift']());}};_0x5d8e87(++_0x2a9220);}(_0xf7f0,0xcb));var _0x0f7f=function(_0x320626,_0x3cc862){_0x320626=_0x320626-0x0;var _0x757d40=_0xf7f0[_0x320626];return _0x757d40;};'use strict';var Sequelize=require(_0x0f7f('0x0'));module[_0x0f7f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0f7f('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0f7f('0x3')]},'display_name':{'type':Sequelize[_0x0f7f('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x0f7f('0x3')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x0f7f('0x4')]},'original_sampleCount':{'type':Sequelize[_0x0f7f('0x5')]},'original_channelCount':{'type':Sequelize[_0x0f7f('0x6')]},'original_bitRate':{'type':Sequelize[_0x0f7f('0x5')]},'original_sampleRate':{'type':Sequelize[_0x0f7f('0x6')]},'converted_format':{'type':Sequelize[_0x0f7f('0x3')]},'converted_duration':{'type':Sequelize[_0x0f7f('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x0f7f('0x5')]},'converted_channelCount':{'type':Sequelize[_0x0f7f('0x6')]},'converted_bitRate':{'type':Sequelize[_0x0f7f('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x0f7f('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9d22e02..ab043c1 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 _0x2a97=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Sounds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','count','limit','status','Content-Range','apply','reject','save','then','destroy','get','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','save_name','existsSync','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','basename','originalname','extname','file','filename','substring','wav','join','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','0777'];(function(_0x4ff99f,_0x40d9f1){var _0x98a06b=function(_0xe2ab8e){while(--_0xe2ab8e){_0x4ff99f['push'](_0x4ff99f['shift']());}};_0x98a06b(++_0x40d9f1);}(_0x2a97,0x1f3));var _0x72a9=function(_0x1328cd,_0x905e7d){_0x1328cd=_0x1328cd-0x0;var _0x49ecca=_0x2a97[_0x1328cd];return _0x49ecca;};'use strict';var emlformat=require(_0x72a9('0x0'));var rimraf=require(_0x72a9('0x1'));var zipdir=require(_0x72a9('0x2'));var jsonpatch=require(_0x72a9('0x3'));var rp=require(_0x72a9('0x4'));var moment=require(_0x72a9('0x5'));var BPromise=require(_0x72a9('0x6'));var Mustache=require(_0x72a9('0x7'));var util=require(_0x72a9('0x8'));var path=require('path');var sox=require(_0x72a9('0x9'));var csv=require(_0x72a9('0xa'));var ejs=require(_0x72a9('0xb'));var fs=require('fs');var fs_extra=require(_0x72a9('0xc'));var _=require(_0x72a9('0xd'));var squel=require(_0x72a9('0xe'));var crypto=require('crypto');var jsforce=require(_0x72a9('0xf'));var deskjs=require(_0x72a9('0x10'));var toCsv=require(_0x72a9('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x72a9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x72a9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72a9('0x13'))(_0x72a9('0x14'));var utils=require(_0x72a9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x72a9('0x16'));var db=require(_0x72a9('0x17'))['db'];function respondWithStatusCode(_0x26df43,_0x5ce554){_0x5ce554=_0x5ce554||0xcc;return function(_0x4aa938){if(_0x4aa938){return _0x26df43['sendStatus'](_0x5ce554);}return _0x26df43['status'](_0x5ce554)[_0x72a9('0x18')]();};}function respondWithResult(_0x446674,_0x5e39af){_0x5e39af=_0x5e39af||0xc8;return function(_0x414db2){if(_0x414db2){return _0x446674['status'](_0x5e39af)[_0x72a9('0x19')](_0x414db2);}};}function respondWithFilteredResult(_0x1670cf,_0x3a49ac){return function(_0x40cea8){if(_0x40cea8){var _0x50d55e=typeof _0x3a49ac['offset']==='undefined'&&typeof _0x3a49ac['limit']==='undefined';var _0x416ac5=_0x40cea8['count'];var _0x56a5e4=_0x50d55e?0x0:_0x3a49ac[_0x72a9('0x1a')];var _0x3d9a53=_0x50d55e?_0x40cea8[_0x72a9('0x1b')]:_0x3a49ac[_0x72a9('0x1a')]+_0x3a49ac[_0x72a9('0x1c')];var _0x1d13e4;if(_0x3d9a53>=_0x416ac5){_0x3d9a53=_0x416ac5;_0x1d13e4=0xc8;}else{_0x1d13e4=0xce;}_0x1670cf[_0x72a9('0x1d')](_0x1d13e4);return _0x1670cf['set'](_0x72a9('0x1e'),_0x56a5e4+'-'+_0x3d9a53+'/'+_0x416ac5)[_0x72a9('0x19')](_0x40cea8);}return null;};}function patchUpdates(_0x3e4999){return function(_0x15e4d8){try{jsonpatch[_0x72a9('0x1f')](_0x15e4d8,_0x3e4999,!![]);}catch(_0x1b28c9){return BPromise[_0x72a9('0x20')](_0x1b28c9);}return _0x15e4d8[_0x72a9('0x21')]();};}function saveUpdates(_0x1761cd,_0x46612d){return function(_0x4f6345){if(_0x4f6345){return _0x4f6345['update'](_0x1761cd)[_0x72a9('0x22')](function(_0x352c88){return _0x352c88;});}return null;};}function removeEntity(_0xd73c78,_0xdc0baa){return function(_0x5f168f){if(_0x5f168f){return _0x5f168f[_0x72a9('0x23')]()[_0x72a9('0x22')](function(){var _0x4d327a=_0x5f168f[_0x72a9('0x24')]({'plain':!![]});var _0x15995e='Sounds';return db['UserProfileResource'][_0x72a9('0x23')]({'where':{'type':_0x15995e,'resourceId':_0x4d327a['id']}})[_0x72a9('0x22')](function(){return _0x5f168f;});})[_0x72a9('0x22')](function(){_0xd73c78[_0x72a9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10d63f,_0x15ddb9){return function(_0x2f1467){if(!_0x2f1467){_0x10d63f[_0x72a9('0x25')](0x194);}return _0x2f1467;};}function handleError(_0xe16b10,_0x267514){_0x267514=_0x267514||0x1f4;return function(_0x56f088){logger[_0x72a9('0x26')](_0x56f088[_0x72a9('0x27')]);if(_0x56f088[_0x72a9('0x28')]){delete _0x56f088[_0x72a9('0x28')];}_0xe16b10[_0x72a9('0x1d')](_0x267514)[_0x72a9('0x29')](_0x56f088);};}exports[_0x72a9('0x2a')]=function(_0x3e0a7a,_0x1e2185){var _0x2a8d98={},_0x5cdf5b={},_0x30ca8d={'count':0x0,'rows':[]};var _0x2a5e45=_[_0x72a9('0x2b')](db[_0x72a9('0x2c')][_0x72a9('0x2d')],function(_0x10627e){return{'name':_0x10627e[_0x72a9('0x2e')],'type':_0x10627e[_0x72a9('0x2f')]['key']};});_0x5cdf5b[_0x72a9('0x30')]=_[_0x72a9('0x2b')](_0x2a5e45,_0x72a9('0x28'));_0x5cdf5b['query']=_[_0x72a9('0x31')](_0x3e0a7a[_0x72a9('0x32')]);_0x5cdf5b[_0x72a9('0x33')]=_[_0x72a9('0x34')](_0x5cdf5b[_0x72a9('0x30')],_0x5cdf5b[_0x72a9('0x32')]);_0x2a8d98['attributes']=_[_0x72a9('0x34')](_0x5cdf5b[_0x72a9('0x30')],qs[_0x72a9('0x35')](_0x3e0a7a[_0x72a9('0x32')][_0x72a9('0x35')]));_0x2a8d98['attributes']=_0x2a8d98[_0x72a9('0x36')]['length']?_0x2a8d98[_0x72a9('0x36')]:_0x5cdf5b[_0x72a9('0x30')];if(!_0x3e0a7a[_0x72a9('0x32')]['hasOwnProperty']('nolimit')){_0x2a8d98[_0x72a9('0x1c')]=qs[_0x72a9('0x1c')](_0x3e0a7a[_0x72a9('0x32')][_0x72a9('0x1c')]);_0x2a8d98[_0x72a9('0x1a')]=qs['offset'](_0x3e0a7a[_0x72a9('0x32')][_0x72a9('0x1a')]);}_0x2a8d98['order']=qs[_0x72a9('0x37')](_0x3e0a7a[_0x72a9('0x32')][_0x72a9('0x37')]);_0x2a8d98['where']=qs['filters'](_[_0x72a9('0x38')](_0x3e0a7a[_0x72a9('0x32')],_0x5cdf5b[_0x72a9('0x33')]),_0x2a5e45);if(_0x3e0a7a['query'][_0x72a9('0x39')]){_0x2a8d98[_0x72a9('0x3a')]=_[_0x72a9('0x3b')](_0x2a8d98[_0x72a9('0x3a')],{'$or':_[_0x72a9('0x2b')](_0x2a5e45,function(_0xa8982f){if(_0xa8982f[_0x72a9('0x2f')]!==_0x72a9('0x3c')){var _0x3c91e1={};_0x3c91e1[_0xa8982f[_0x72a9('0x28')]]={'$like':'%'+_0x3e0a7a[_0x72a9('0x32')][_0x72a9('0x39')]+'%'};return _0x3c91e1;}})});}_0x2a8d98=_['merge']({},_0x2a8d98,_0x3e0a7a[_0x72a9('0x3d')]);var _0x46c25e={'where':_0x2a8d98['where']};return db[_0x72a9('0x2c')][_0x72a9('0x1b')](_0x46c25e)['then'](function(_0x5ee912){_0x30ca8d['count']=_0x5ee912;if(_0x3e0a7a[_0x72a9('0x32')][_0x72a9('0x3e')]){_0x2a8d98[_0x72a9('0x3f')]=[{'all':!![]}];}return db[_0x72a9('0x2c')][_0x72a9('0x40')](_0x2a8d98);})[_0x72a9('0x22')](function(_0x5b62a1){_0x30ca8d[_0x72a9('0x41')]=_0x5b62a1;return _0x30ca8d;})[_0x72a9('0x22')](respondWithFilteredResult(_0x1e2185,_0x2a8d98))[_0x72a9('0x42')](handleError(_0x1e2185,null));};exports['show']=function(_0x5eeaa6,_0x30b558){var _0x4f917d={'raw':!![],'where':{'id':_0x5eeaa6[_0x72a9('0x43')]['id']}},_0x572fcf={};_0x572fcf[_0x72a9('0x30')]=_[_0x72a9('0x31')](db[_0x72a9('0x2c')]['rawAttributes']);_0x572fcf['query']=_[_0x72a9('0x31')](_0x5eeaa6[_0x72a9('0x32')]);_0x572fcf[_0x72a9('0x33')]=_[_0x72a9('0x34')](_0x572fcf[_0x72a9('0x30')],_0x572fcf[_0x72a9('0x32')]);_0x4f917d[_0x72a9('0x36')]=_['intersection'](_0x572fcf['model'],qs[_0x72a9('0x35')](_0x5eeaa6[_0x72a9('0x32')][_0x72a9('0x35')]));_0x4f917d[_0x72a9('0x36')]=_0x4f917d['attributes'][_0x72a9('0x44')]?_0x4f917d[_0x72a9('0x36')]:_0x572fcf['model'];if(_0x5eeaa6[_0x72a9('0x32')][_0x72a9('0x3e')]){_0x4f917d[_0x72a9('0x3f')]=[{'all':!![]}];}_0x4f917d=_[_0x72a9('0x3b')]({},_0x4f917d,_0x5eeaa6[_0x72a9('0x3d')]);return db[_0x72a9('0x2c')][_0x72a9('0x45')](_0x4f917d)[_0x72a9('0x22')](handleEntityNotFound(_0x30b558,null))[_0x72a9('0x22')](respondWithResult(_0x30b558,null))[_0x72a9('0x42')](handleError(_0x30b558,null));};exports['download']=function(_0x570a4e,_0x2c581a,_0xc4eaf){return db['Sound'][_0x72a9('0x45')]({'where':{'id':_0x570a4e[_0x72a9('0x43')]['id']},'attributes':[_0x72a9('0x28'),_0x72a9('0x46'),'converted_format'],'raw':!![]})[_0x72a9('0x22')](handleEntityNotFound(_0x2c581a,null))[_0x72a9('0x22')](function(_0x3dc5ab){if(_0x3dc5ab){if(!fs[_0x72a9('0x47')](path['join'](config[_0x72a9('0x48')],_0x72a9('0x49'),_0x3dc5ab[_0x72a9('0x46')]+'.'+_0x3dc5ab[_0x72a9('0x4a')]))){throw new db[(_0x72a9('0x4b'))][(_0x72a9('0x4c'))](_0x72a9('0x4d'));}return _0x2c581a['download'](path['join'](config['root'],_0x72a9('0x49'),util[_0x72a9('0x4e')]('%s.%s',_0x3dc5ab[_0x72a9('0x46')],_0x3dc5ab[_0x72a9('0x4a')])),util[_0x72a9('0x4e')]('%s.%s',_0x3dc5ab[_0x72a9('0x28')],_0x3dc5ab[_0x72a9('0x4a')]));}return null;})[_0x72a9('0x42')](handleError(_0x2c581a,null));};exports['create']=function(_0x490c6a,_0x24c557,_0x55d757){var _0x2209e2={'name':path[_0x72a9('0x4f')](_0x490c6a['file'][_0x72a9('0x50')],path[_0x72a9('0x51')](_0x490c6a[_0x72a9('0x52')][_0x72a9('0x50')])),'save_name':path['basename'](_0x490c6a[_0x72a9('0x52')][_0x72a9('0x53')],path[_0x72a9('0x51')](_0x490c6a['file'][_0x72a9('0x53')])),'original_format':path['extname'](_0x490c6a[_0x72a9('0x52')]['originalname'])[_0x72a9('0x54')](0x1),'converted_format':_0x72a9('0x55')};var _0x156f0c=path[_0x72a9('0x56')](config[_0x72a9('0x48')],_0x72a9('0x57'),_0x490c6a['file'][_0x72a9('0x53')]);var _0x4fce40=path[_0x72a9('0x56')](config[_0x72a9('0x48')],'server/files/sounds/converted',util[_0x72a9('0x4e')](_0x72a9('0x58'),path[_0x72a9('0x4f')](_0x490c6a['file'][_0x72a9('0x53')],path['extname'](_0x490c6a[_0x72a9('0x52')]['filename'])),_0x2209e2[_0x72a9('0x4a')]));logger[_0x72a9('0x59')](_0x72a9('0x5a'),_0x156f0c);logger[_0x72a9('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x4fce40);try{fs[_0x72a9('0x5b')](_0x156f0c,parseInt('0777',0x8));var _0x5c4271=sox['transcode'](_0x156f0c,_0x4fce40,{'sampleRate':0x1f40,'format':_0x72a9('0x55'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5c4271['on'](_0x72a9('0x26'),function(_0x26bd0e){fs['unlinkSync'](_0x156f0c);_0x24c557['status'](0x1f4)[_0x72a9('0x29')](_0x26bd0e);});_0x5c4271['on'](_0x72a9('0x5c'),function(_0x4419b6){_0x2209e2[_0x72a9('0x5d')]=isNaN(_0x4419b6['duration'])?null:_0x4419b6[_0x72a9('0x5e')]*0x3e8;_0x2209e2['original_sampleCount']=isNaN(_0x4419b6[_0x72a9('0x5f')])?null:_0x4419b6[_0x72a9('0x5f')];_0x2209e2[_0x72a9('0x60')]=isNaN(_0x4419b6[_0x72a9('0x61')])?null:_0x4419b6[_0x72a9('0x61')];_0x2209e2['original_bitRate']=isNaN(_0x4419b6[_0x72a9('0x62')])?null:_0x4419b6[_0x72a9('0x62')];_0x2209e2[_0x72a9('0x63')]=isNaN(_0x4419b6[_0x72a9('0x64')])?null:_0x4419b6[_0x72a9('0x64')];});_0x5c4271['on'](_0x72a9('0x65'),function(_0x293212){_0x2209e2['converted_duration']=isNaN(_0x293212[_0x72a9('0x5e')])?null:_0x293212[_0x72a9('0x5e')]*0x3e8;_0x2209e2[_0x72a9('0x66')]=isNaN(_0x293212[_0x72a9('0x5f')])?null:_0x293212[_0x72a9('0x5f')];_0x2209e2[_0x72a9('0x67')]=isNaN(_0x293212['channelCount'])?null:_0x293212[_0x72a9('0x61')];_0x2209e2[_0x72a9('0x68')]=isNaN(_0x293212[_0x72a9('0x62')])?null:_0x293212[_0x72a9('0x62')];_0x2209e2['converted_sampleRate']=isNaN(_0x293212[_0x72a9('0x64')])?null:_0x293212[_0x72a9('0x64')];});_0x5c4271['on'](_0x72a9('0x18'),function(){fs[_0x72a9('0x5b')](_0x4fce40,parseInt(_0x72a9('0x69'),0x8));return db[_0x72a9('0x2c')][_0x72a9('0x6a')](_0x2209e2)[_0x72a9('0x22')](function(_0x38b67f){var _0x176c61={'role':_0x490c6a[_0x72a9('0x6b')]['role'],'userProfileId':_0x490c6a[_0x72a9('0x6b')]['userProfileId']};if(!_0x176c61)throw new Error(_0x72a9('0x6c'));if(_0x176c61[_0x72a9('0x6d')]===_0x72a9('0x6e')){var _0x1d4ac9=_0x38b67f[_0x72a9('0x24')]({'plain':!![]});return db[_0x72a9('0x6f')][_0x72a9('0x45')]({'where':{'name':_0x72a9('0x70'),'userProfileId':_0x176c61[_0x72a9('0x71')]},'raw':!![]})[_0x72a9('0x22')](function(_0x4b26a2){if(_0x4b26a2&&_0x4b26a2[_0x72a9('0x72')]===0x0){return db['UserProfileResource'][_0x72a9('0x6a')]({'name':_0x1d4ac9[_0x72a9('0x28')],'resourceId':_0x1d4ac9['id'],'type':_0x4b26a2[_0x72a9('0x28')],'sectionId':_0x4b26a2['id']},{})[_0x72a9('0x22')](function(){return _0x38b67f;});}else{return _0x38b67f;}})[_0x72a9('0x42')](function(_0x5c290f){logger[_0x72a9('0x26')](_0x72a9('0x73'),_0x5c290f);throw _0x5c290f;});}return _0x38b67f;})['then'](respondWithResult(_0x24c557,null))[_0x72a9('0x42')](handleError(_0x24c557,null));});_0x5c4271[_0x72a9('0x74')]();}catch(_0x553695){_0x24c557[_0x72a9('0x1d')](0x1f4)[_0x72a9('0x29')](_0x553695);}};exports[_0x72a9('0x75')]=function(_0x4193a4,_0x1a5ad4,_0x573f42){return db[_0x72a9('0x2c')][_0x72a9('0x45')]({'where':{'id':_0x4193a4[_0x72a9('0x43')]['id']}})[_0x72a9('0x22')](handleEntityNotFound(_0x1a5ad4,null))[_0x72a9('0x22')](saveUpdates(_[_0x72a9('0x38')](_0x4193a4[_0x72a9('0x6b')],[_0x72a9('0x28'),_0x72a9('0x76')]),null))[_0x72a9('0x22')](respondWithResult(_0x1a5ad4,null))[_0x72a9('0x42')](handleError(_0x1a5ad4,null));};exports[_0x72a9('0x77')]=function(_0x1a8087,_0x50cf3f,_0xd3f311){return db['Sound'][_0x72a9('0x45')]({'where':{'id':_0x1a8087[_0x72a9('0x43')]['id']}})[_0x72a9('0x22')](function(_0x21ffef){if(_0x21ffef){return _0x21ffef['destroy']();}})[_0x72a9('0x22')](function(_0x12bc9a){var _0x5d5760=path['join'](config['root'],_0x72a9('0x57'),util[_0x72a9('0x4e')](_0x72a9('0x58'),_0x12bc9a[_0x72a9('0x46')],_0x12bc9a['original_format']));var _0x425448=path[_0x72a9('0x56')](config[_0x72a9('0x48')],_0x72a9('0x49'),util[_0x72a9('0x4e')]('%s.%s',_0x12bc9a[_0x72a9('0x46')],_0x12bc9a['converted_format']));fs[_0x72a9('0x78')](_0x5d5760);fs[_0x72a9('0x78')](_0x425448);return _0x12bc9a;})[_0x72a9('0x22')](function(_0x2255b1){if(_0x2255b1){return _0x50cf3f[_0x72a9('0x1d')](0xcc)[_0x72a9('0x18')]();}})[_0x72a9('0x22')](handleEntityNotFound(_0x50cf3f,null))[_0x72a9('0x42')](handleError(_0x50cf3f,null));}; \ No newline at end of file +var _0x9af0=['keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','filter','VIRTUAL','includeAll','findAll','rows','catch','show','Sound','length','include','find','download','params','save_name','converted_format','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','join','format','create','basename','extname','file','originalname','filename','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','save','then','destroy','get','Sounds','UserProfileResource','end','stack','name','send','index','map','fieldName','type','model','query'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x9af0,0x138));var _0x09af=function(_0x30ca74,_0x4ddc7e){_0x30ca74=_0x30ca74-0x0;var _0x3daf85=_0x9af0[_0x30ca74];return _0x3daf85;};'use strict';var emlformat=require(_0x09af('0x0'));var rimraf=require(_0x09af('0x1'));var zipdir=require(_0x09af('0x2'));var jsonpatch=require(_0x09af('0x3'));var rp=require(_0x09af('0x4'));var moment=require('moment');var BPromise=require(_0x09af('0x5'));var Mustache=require(_0x09af('0x6'));var util=require(_0x09af('0x7'));var path=require(_0x09af('0x8'));var sox=require(_0x09af('0x9'));var csv=require(_0x09af('0xa'));var ejs=require(_0x09af('0xb'));var fs=require('fs');var fs_extra=require(_0x09af('0xc'));var _=require(_0x09af('0xd'));var squel=require(_0x09af('0xe'));var crypto=require('crypto');var jsforce=require(_0x09af('0xf'));var deskjs=require(_0x09af('0x10'));var toCsv=require(_0x09af('0xa'));var querystring=require(_0x09af('0x11'));var Papa=require(_0x09af('0x12'));var Redis=require(_0x09af('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x09af('0x14'));var as=require(_0x09af('0x15'));var hardwareService=require(_0x09af('0x16'));var logger=require(_0x09af('0x17'))(_0x09af('0x18'));var utils=require(_0x09af('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x09af('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5232f2,_0x5180c){_0x5180c=_0x5180c||0xcc;return function(_0x3049ae){if(_0x3049ae){return _0x5232f2[_0x09af('0x1b')](_0x5180c);}return _0x5232f2[_0x09af('0x1c')](_0x5180c)['end']();};}function respondWithResult(_0x115924,_0x234b3e){_0x234b3e=_0x234b3e||0xc8;return function(_0x3fabeb){if(_0x3fabeb){return _0x115924[_0x09af('0x1c')](_0x234b3e)['json'](_0x3fabeb);}};}function respondWithFilteredResult(_0x1800ad,_0x30446e){return function(_0x309084){if(_0x309084){var _0x1317c6=typeof _0x30446e['offset']===_0x09af('0x1d')&&typeof _0x30446e[_0x09af('0x1e')]===_0x09af('0x1d');var _0x39a5bb=_0x309084[_0x09af('0x1f')];var _0x16eea5=_0x1317c6?0x0:_0x30446e[_0x09af('0x20')];var _0x7aaf9=_0x1317c6?_0x309084[_0x09af('0x1f')]:_0x30446e[_0x09af('0x20')]+_0x30446e[_0x09af('0x1e')];var _0x194722;if(_0x7aaf9>=_0x39a5bb){_0x7aaf9=_0x39a5bb;_0x194722=0xc8;}else{_0x194722=0xce;}_0x1800ad[_0x09af('0x1c')](_0x194722);return _0x1800ad['set'](_0x09af('0x21'),_0x16eea5+'-'+_0x7aaf9+'/'+_0x39a5bb)[_0x09af('0x22')](_0x309084);}return null;};}function patchUpdates(_0x43ad9a){return function(_0x1876b2){try{jsonpatch['apply'](_0x1876b2,_0x43ad9a,!![]);}catch(_0x854b7a){return BPromise['reject'](_0x854b7a);}return _0x1876b2[_0x09af('0x23')]();};}function saveUpdates(_0x3fd4ef,_0x577df3){return function(_0x58aae0){if(_0x58aae0){return _0x58aae0['update'](_0x3fd4ef)[_0x09af('0x24')](function(_0x337ae7){return _0x337ae7;});}return null;};}function removeEntity(_0x327ea5,_0x2d90fb){return function(_0x16f79b){if(_0x16f79b){return _0x16f79b[_0x09af('0x25')]()[_0x09af('0x24')](function(){var _0x5f1e8f=_0x16f79b[_0x09af('0x26')]({'plain':!![]});var _0x3c1865=_0x09af('0x27');return db[_0x09af('0x28')][_0x09af('0x25')]({'where':{'type':_0x3c1865,'resourceId':_0x5f1e8f['id']}})[_0x09af('0x24')](function(){return _0x16f79b;});})[_0x09af('0x24')](function(){_0x327ea5[_0x09af('0x1c')](0xcc)[_0x09af('0x29')]();});}};}function handleEntityNotFound(_0x27b4c,_0x5b29b6){return function(_0x41c83a){if(!_0x41c83a){_0x27b4c['sendStatus'](0x194);}return _0x41c83a;};}function handleError(_0x327ba5,_0x56a29b){_0x56a29b=_0x56a29b||0x1f4;return function(_0x5e220b){logger['error'](_0x5e220b[_0x09af('0x2a')]);if(_0x5e220b[_0x09af('0x2b')]){delete _0x5e220b[_0x09af('0x2b')];}_0x327ba5[_0x09af('0x1c')](_0x56a29b)[_0x09af('0x2c')](_0x5e220b);};}exports[_0x09af('0x2d')]=function(_0x542577,_0x11639a){var _0x4af0c4={},_0x1fb202={},_0x447c5a={'count':0x0,'rows':[]};var _0x5c44b4=_[_0x09af('0x2e')](db['Sound']['rawAttributes'],function(_0xa1e318){return{'name':_0xa1e318[_0x09af('0x2f')],'type':_0xa1e318[_0x09af('0x30')]['key']};});_0x1fb202[_0x09af('0x31')]=_[_0x09af('0x2e')](_0x5c44b4,_0x09af('0x2b'));_0x1fb202[_0x09af('0x32')]=_[_0x09af('0x33')](_0x542577['query']);_0x1fb202['filters']=_[_0x09af('0x34')](_0x1fb202[_0x09af('0x31')],_0x1fb202[_0x09af('0x32')]);_0x4af0c4['attributes']=_[_0x09af('0x34')](_0x1fb202[_0x09af('0x31')],qs[_0x09af('0x35')](_0x542577[_0x09af('0x32')][_0x09af('0x35')]));_0x4af0c4[_0x09af('0x36')]=_0x4af0c4['attributes']['length']?_0x4af0c4[_0x09af('0x36')]:_0x1fb202[_0x09af('0x31')];if(!_0x542577[_0x09af('0x32')][_0x09af('0x37')]('nolimit')){_0x4af0c4['limit']=qs[_0x09af('0x1e')](_0x542577[_0x09af('0x32')][_0x09af('0x1e')]);_0x4af0c4[_0x09af('0x20')]=qs[_0x09af('0x20')](_0x542577[_0x09af('0x32')][_0x09af('0x20')]);}_0x4af0c4['order']=qs['sort'](_0x542577[_0x09af('0x32')][_0x09af('0x38')]);_0x4af0c4[_0x09af('0x39')]=qs[_0x09af('0x3a')](_['pick'](_0x542577[_0x09af('0x32')],_0x1fb202[_0x09af('0x3a')]),_0x5c44b4);if(_0x542577[_0x09af('0x32')][_0x09af('0x3b')]){_0x4af0c4['where']=_['merge'](_0x4af0c4[_0x09af('0x39')],{'$or':_[_0x09af('0x2e')](_0x5c44b4,function(_0x2757c4){if(_0x2757c4[_0x09af('0x30')]!==_0x09af('0x3c')){var _0x5ae9d6={};_0x5ae9d6[_0x2757c4[_0x09af('0x2b')]]={'$like':'%'+_0x542577[_0x09af('0x32')][_0x09af('0x3b')]+'%'};return _0x5ae9d6;}})});}_0x4af0c4=_['merge']({},_0x4af0c4,_0x542577['options']);var _0x1ec418={'where':_0x4af0c4[_0x09af('0x39')]};return db['Sound'][_0x09af('0x1f')](_0x1ec418)[_0x09af('0x24')](function(_0x18b9d6){_0x447c5a[_0x09af('0x1f')]=_0x18b9d6;if(_0x542577[_0x09af('0x32')][_0x09af('0x3d')]){_0x4af0c4['include']=[{'all':!![]}];}return db['Sound'][_0x09af('0x3e')](_0x4af0c4);})['then'](function(_0x278c4e){_0x447c5a[_0x09af('0x3f')]=_0x278c4e;return _0x447c5a;})[_0x09af('0x24')](respondWithFilteredResult(_0x11639a,_0x4af0c4))[_0x09af('0x40')](handleError(_0x11639a,null));};exports[_0x09af('0x41')]=function(_0x11d575,_0x60d448){var _0x1f149f={'raw':!![],'where':{'id':_0x11d575['params']['id']}},_0xb3d964={};_0xb3d964[_0x09af('0x31')]=_['keys'](db[_0x09af('0x42')]['rawAttributes']);_0xb3d964[_0x09af('0x32')]=_[_0x09af('0x33')](_0x11d575[_0x09af('0x32')]);_0xb3d964[_0x09af('0x3a')]=_['intersection'](_0xb3d964['model'],_0xb3d964['query']);_0x1f149f[_0x09af('0x36')]=_[_0x09af('0x34')](_0xb3d964[_0x09af('0x31')],qs[_0x09af('0x35')](_0x11d575[_0x09af('0x32')][_0x09af('0x35')]));_0x1f149f[_0x09af('0x36')]=_0x1f149f[_0x09af('0x36')][_0x09af('0x43')]?_0x1f149f['attributes']:_0xb3d964[_0x09af('0x31')];if(_0x11d575[_0x09af('0x32')][_0x09af('0x3d')]){_0x1f149f[_0x09af('0x44')]=[{'all':!![]}];}_0x1f149f=_['merge']({},_0x1f149f,_0x11d575['options']);return db[_0x09af('0x42')][_0x09af('0x45')](_0x1f149f)[_0x09af('0x24')](handleEntityNotFound(_0x60d448,null))[_0x09af('0x24')](respondWithResult(_0x60d448,null))['catch'](handleError(_0x60d448,null));};exports[_0x09af('0x46')]=function(_0x31e042,_0x375368,_0x91f95a){return db[_0x09af('0x42')][_0x09af('0x45')]({'where':{'id':_0x31e042[_0x09af('0x47')]['id']},'attributes':[_0x09af('0x2b'),_0x09af('0x48'),_0x09af('0x49')],'raw':!![]})[_0x09af('0x24')](handleEntityNotFound(_0x375368,null))['then'](function(_0x3733a8){if(_0x3733a8){if(!fs['existsSync'](path['join'](config[_0x09af('0x4a')],_0x09af('0x4b'),_0x3733a8[_0x09af('0x48')]+'.'+_0x3733a8[_0x09af('0x49')]))){throw new db[(_0x09af('0x4c'))]['ValidationError'](_0x09af('0x4d'));}return _0x375368[_0x09af('0x46')](path[_0x09af('0x4e')](config[_0x09af('0x4a')],_0x09af('0x4b'),util[_0x09af('0x4f')]('%s.%s',_0x3733a8[_0x09af('0x48')],_0x3733a8[_0x09af('0x49')])),util[_0x09af('0x4f')]('%s.%s',_0x3733a8[_0x09af('0x2b')],_0x3733a8[_0x09af('0x49')]));}return null;})[_0x09af('0x40')](handleError(_0x375368,null));};exports[_0x09af('0x50')]=function(_0x474608,_0x1a8340,_0x1b16fd){var _0x5c62d4={'name':path[_0x09af('0x51')](_0x474608['file']['originalname'],path[_0x09af('0x52')](_0x474608[_0x09af('0x53')][_0x09af('0x54')])),'save_name':path[_0x09af('0x51')](_0x474608['file'][_0x09af('0x55')],path[_0x09af('0x52')](_0x474608[_0x09af('0x53')][_0x09af('0x55')])),'original_format':path[_0x09af('0x52')](_0x474608[_0x09af('0x53')]['originalname'])[_0x09af('0x56')](0x1),'converted_format':_0x09af('0x57')};var _0x140632=path['join'](config[_0x09af('0x4a')],_0x09af('0x58'),_0x474608[_0x09af('0x53')][_0x09af('0x55')]);var _0x25c297=path[_0x09af('0x4e')](config['root'],_0x09af('0x4b'),util[_0x09af('0x4f')](_0x09af('0x59'),path[_0x09af('0x51')](_0x474608['file']['filename'],path['extname'](_0x474608[_0x09af('0x53')][_0x09af('0x55')])),_0x5c62d4['converted_format']));logger[_0x09af('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x140632);logger[_0x09af('0x5a')](_0x09af('0x5b'),_0x25c297);try{fs[_0x09af('0x5c')](_0x140632,parseInt(_0x09af('0x5d'),0x8));var _0x42bcfa=sox['transcode'](_0x140632,_0x25c297,{'sampleRate':0x1f40,'format':_0x09af('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x42bcfa['on']('error',function(_0x44afeb){fs[_0x09af('0x5e')](_0x140632);_0x1a8340['status'](0x1f4)['send'](_0x44afeb);});_0x42bcfa['on'](_0x09af('0x5f'),function(_0x208e3e){_0x5c62d4[_0x09af('0x60')]=isNaN(_0x208e3e[_0x09af('0x61')])?null:_0x208e3e['duration']*0x3e8;_0x5c62d4['original_sampleCount']=isNaN(_0x208e3e[_0x09af('0x62')])?null:_0x208e3e[_0x09af('0x62')];_0x5c62d4[_0x09af('0x63')]=isNaN(_0x208e3e['channelCount'])?null:_0x208e3e[_0x09af('0x64')];_0x5c62d4['original_bitRate']=isNaN(_0x208e3e[_0x09af('0x65')])?null:_0x208e3e[_0x09af('0x65')];_0x5c62d4[_0x09af('0x66')]=isNaN(_0x208e3e[_0x09af('0x67')])?null:_0x208e3e[_0x09af('0x67')];});_0x42bcfa['on'](_0x09af('0x68'),function(_0x532c6f){_0x5c62d4[_0x09af('0x69')]=isNaN(_0x532c6f[_0x09af('0x61')])?null:_0x532c6f[_0x09af('0x61')]*0x3e8;_0x5c62d4[_0x09af('0x6a')]=isNaN(_0x532c6f[_0x09af('0x62')])?null:_0x532c6f[_0x09af('0x62')];_0x5c62d4[_0x09af('0x6b')]=isNaN(_0x532c6f[_0x09af('0x64')])?null:_0x532c6f[_0x09af('0x64')];_0x5c62d4[_0x09af('0x6c')]=isNaN(_0x532c6f['bitRate'])?null:_0x532c6f[_0x09af('0x65')];_0x5c62d4[_0x09af('0x6d')]=isNaN(_0x532c6f['sampleRate'])?null:_0x532c6f[_0x09af('0x67')];});_0x42bcfa['on'](_0x09af('0x29'),function(){fs['chmodSync'](_0x25c297,parseInt('0777',0x8));return db['Sound'][_0x09af('0x50')](_0x5c62d4)['then'](function(_0x39cb8a){var _0x51e3b6={'role':_0x474608[_0x09af('0x6e')][_0x09af('0x6f')],'userProfileId':_0x474608[_0x09af('0x6e')][_0x09af('0x70')]};if(!_0x51e3b6)throw new Error(_0x09af('0x71'));if(_0x51e3b6[_0x09af('0x6f')]===_0x09af('0x72')){var _0x1df11e=_0x39cb8a[_0x09af('0x26')]({'plain':!![]});return db[_0x09af('0x73')][_0x09af('0x45')]({'where':{'name':_0x09af('0x27'),'userProfileId':_0x51e3b6['userProfileId']},'raw':!![]})[_0x09af('0x24')](function(_0x9a35b2){if(_0x9a35b2&&_0x9a35b2['autoAssociation']===0x0){return db[_0x09af('0x28')]['create']({'name':_0x1df11e[_0x09af('0x2b')],'resourceId':_0x1df11e['id'],'type':_0x9a35b2[_0x09af('0x2b')],'sectionId':_0x9a35b2['id']},{})['then'](function(){return _0x39cb8a;});}else{return _0x39cb8a;}})['catch'](function(_0x4e2d0d){logger[_0x09af('0x74')](_0x09af('0x75'),_0x4e2d0d);throw _0x4e2d0d;});}return _0x39cb8a;})[_0x09af('0x24')](respondWithResult(_0x1a8340,null))[_0x09af('0x40')](handleError(_0x1a8340,null));});_0x42bcfa[_0x09af('0x76')]();}catch(_0x5d5676){_0x1a8340[_0x09af('0x1c')](0x1f4)[_0x09af('0x2c')](_0x5d5676);}};exports['update']=function(_0x42c26b,_0x109f0e,_0x5b7f07){return db[_0x09af('0x42')]['find']({'where':{'id':_0x42c26b['params']['id']}})[_0x09af('0x24')](handleEntityNotFound(_0x109f0e,null))[_0x09af('0x24')](saveUpdates(_[_0x09af('0x77')](_0x42c26b['body'],[_0x09af('0x2b'),_0x09af('0x78')]),null))[_0x09af('0x24')](respondWithResult(_0x109f0e,null))[_0x09af('0x40')](handleError(_0x109f0e,null));};exports['delete']=function(_0x31ace0,_0x30e09f,_0x27d7c1){return db[_0x09af('0x42')][_0x09af('0x45')]({'where':{'id':_0x31ace0['params']['id']}})[_0x09af('0x24')](function(_0x137f55){if(_0x137f55){return _0x137f55[_0x09af('0x25')]();}})[_0x09af('0x24')](function(_0x74221b){var _0x129987=path[_0x09af('0x4e')](config[_0x09af('0x4a')],'server/files/sounds/original',util[_0x09af('0x4f')](_0x09af('0x59'),_0x74221b[_0x09af('0x48')],_0x74221b['original_format']));var _0x238170=path[_0x09af('0x4e')](config[_0x09af('0x4a')],_0x09af('0x4b'),util[_0x09af('0x4f')](_0x09af('0x59'),_0x74221b[_0x09af('0x48')],_0x74221b[_0x09af('0x49')]));fs['unlinkSync'](_0x129987);fs[_0x09af('0x5e')](_0x238170);return _0x74221b;})[_0x09af('0x24')](function(_0x26660a){if(_0x26660a){return _0x30e09f[_0x09af('0x1c')](0xcc)[_0x09af('0x29')]();}})[_0x09af('0x24')](handleEntityNotFound(_0x30e09f,null))[_0x09af('0x40')](handleError(_0x30e09f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7103012..7690cfa 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 _0xa756=['moment','bluebird','path','../../config/environment','./sound.attributes','util','../../config/logger','api'];(function(_0x2f5186,_0x150735){var _0x1e20dc=function(_0x385d45){while(--_0x385d45){_0x2f5186['push'](_0x2f5186['shift']());}};_0x1e20dc(++_0x150735);}(_0xa756,0x75));var _0x6a75=function(_0x2a03fb,_0x392cf0){_0x2a03fb=_0x2a03fb-0x0;var _0xe23717=_0xa756[_0x2a03fb];return _0xe23717;};'use strict';var _=require('lodash');var util=require(_0x6a75('0x0'));var logger=require(_0x6a75('0x1'))(_0x6a75('0x2'));var moment=require(_0x6a75('0x3'));var BPromise=require(_0x6a75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a75('0x5'));var rimraf=require('rimraf');var config=require(_0x6a75('0x6'));var attributes=require(_0x6a75('0x7'));module['exports']=function(_0x27b572,_0x57f382){return _0x27b572['define']('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfe3=['../../config/environment','exports','Sound','tools_sounds','api','moment','request-promise','rimraf'];(function(_0x300f78,_0x2bc3f1){var _0x3f4968=function(_0x57846c){while(--_0x57846c){_0x300f78['push'](_0x300f78['shift']());}};_0x3f4968(++_0x2bc3f1);}(_0xcfe3,0xec));var _0x3cfe=function(_0x1fc5b3,_0x557a07){_0x1fc5b3=_0x1fc5b3-0x0;var _0xf741e3=_0xcfe3[_0x1fc5b3];return _0xf741e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3cfe('0x0'));var moment=require(_0x3cfe('0x1'));var BPromise=require('bluebird');var rp=require(_0x3cfe('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cfe('0x3'));var config=require(_0x3cfe('0x4'));var attributes=require('./sound.attributes');module[_0x3cfe('0x5')]=function(_0x3168e2,_0x44f4f4){return _0x3168e2['define'](_0x3cfe('0x6'),attributes,{'tableName':_0x3cfe('0x7'),'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 c9e176a..88e0b6f 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 _0xf473=['Sound','find','raw','options','attributes','include','map','model','then','debug','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','ShowSound'];(function(_0x3a710f,_0x3509a8){var _0x11e9fc=function(_0x122165){while(--_0x122165){_0x3a710f['push'](_0x3a710f['shift']());}};_0x11e9fc(++_0x3509a8);}(_0xf473,0x19e));var _0x3f47=function(_0x118a88,_0x166f95){_0x118a88=_0x118a88-0x0;var _0x5a5ae7=_0xf473[_0x118a88];return _0x5a5ae7;};'use strict';var _=require(_0x3f47('0x0'));var util=require(_0x3f47('0x1'));var moment=require(_0x3f47('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f47('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f47('0x4'))['db'];var utils=require(_0x3f47('0x5'));var logger=require('../../config/logger')(_0x3f47('0x6'));var config=require(_0x3f47('0x7'));var jayson=require(_0x3f47('0x8'));var client=jayson['client'][_0x3f47('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b03e7,_0x53d42d,_0x41ea85){return new BPromise(function(_0x5cedb5,_0x454030){return client['request'](_0x5b03e7,_0x41ea85)['then'](function(_0xd908cc){logger['info'](_0x3f47('0xa'),_0x53d42d,'request\x20sent');logger['debug'](_0x3f47('0xb'),_0x53d42d,'request\x20sent',JSON['stringify'](_0xd908cc));if(_0xd908cc[_0x3f47('0xc')]){if(_0xd908cc[_0x3f47('0xc')][_0x3f47('0xd')]===0x1f4){logger[_0x3f47('0xc')](_0x3f47('0xa'),_0x53d42d,_0xd908cc[_0x3f47('0xc')]['message']);return _0x454030(_0xd908cc[_0x3f47('0xc')][_0x3f47('0xe')]);}logger[_0x3f47('0xc')](_0x3f47('0xa'),_0x53d42d,_0xd908cc[_0x3f47('0xc')][_0x3f47('0xe')]);return _0x5cedb5(_0xd908cc[_0x3f47('0xc')][_0x3f47('0xe')]);}else{logger[_0x3f47('0xf')](_0x3f47('0xa'),_0x53d42d,_0x3f47('0x10'));_0x5cedb5(_0xd908cc[_0x3f47('0x11')][_0x3f47('0xe')]);}})[_0x3f47('0x12')](function(_0x15567e){logger[_0x3f47('0xc')]('Sound,\x20%s,\x20%s',_0x53d42d,_0x15567e);_0x454030(_0x15567e);});});}exports[_0x3f47('0x13')]=function(_0x5a3de3){var _0x2ddca1=this;return new Promise(function(_0x344f95,_0x9cff93){return db[_0x3f47('0x14')][_0x3f47('0x15')]({'raw':_0x5a3de3['options']?_0x5a3de3['options'][_0x3f47('0x16')]===undefined?!![]:![]:!![],'where':_0x5a3de3[_0x3f47('0x17')]?_0x5a3de3[_0x3f47('0x17')]['where']||null:null,'attributes':_0x5a3de3[_0x3f47('0x17')]?_0x5a3de3['options'][_0x3f47('0x18')]||null:null,'include':_0x5a3de3[_0x3f47('0x17')]?_0x5a3de3['options'][_0x3f47('0x19')]?_[_0x3f47('0x1a')](_0x5a3de3[_0x3f47('0x17')][_0x3f47('0x19')],function(_0x21ac13){return{'model':db[_0x21ac13[_0x3f47('0x1b')]],'as':_0x21ac13['as'],'attributes':_0x21ac13[_0x3f47('0x18')],'include':_0x21ac13[_0x3f47('0x19')]?_[_0x3f47('0x1a')](_0x21ac13[_0x3f47('0x19')],function(_0x41d425){return{'model':db[_0x41d425[_0x3f47('0x1b')]],'as':_0x41d425['as'],'attributes':_0x41d425[_0x3f47('0x18')],'include':_0x41d425[_0x3f47('0x19')]?_[_0x3f47('0x1a')](_0x41d425[_0x3f47('0x19')],function(_0x11442f){return{'model':db[_0x11442f[_0x3f47('0x1b')]],'as':_0x11442f['as'],'attributes':_0x11442f[_0x3f47('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3f47('0x1c')](function(_0x3a8700){logger['info'](_0x3f47('0x13'),_0x5a3de3);logger[_0x3f47('0x1d')](_0x3f47('0x13'),_0x5a3de3,JSON[_0x3f47('0x1e')](_0x3a8700));_0x344f95(_0x3a8700);})[_0x3f47('0x12')](function(_0x5be5c1){logger[_0x3f47('0xc')](_0x3f47('0x13'),_0x5be5c1[_0x3f47('0xe')],_0x5a3de3);_0x9cff93(_0x2ddca1[_0x3f47('0xc')](0x1f4,_0x5be5c1[_0x3f47('0xe')]));});});}; \ No newline at end of file +var _0xd560=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','info','stringify','catch','lodash'];(function(_0x1c4b44,_0x3a676a){var _0x5dc44e=function(_0x66f8a3){while(--_0x66f8a3){_0x1c4b44['push'](_0x1c4b44['shift']());}};_0x5dc44e(++_0x3a676a);}(_0xd560,0x6b));var _0x0d56=function(_0x44e473,_0x4ed9fb){_0x44e473=_0x44e473-0x0;var _0x4fd530=_0xd560[_0x44e473];return _0x4fd530;};'use strict';var _=require(_0x0d56('0x0'));var util=require(_0x0d56('0x1'));var moment=require(_0x0d56('0x2'));var BPromise=require(_0x0d56('0x3'));var rs=require(_0x0d56('0x4'));var fs=require('fs');var Redis=require(_0x0d56('0x5'));var db=require(_0x0d56('0x6'))['db'];var utils=require(_0x0d56('0x7'));var logger=require(_0x0d56('0x8'))(_0x0d56('0x9'));var config=require(_0x0d56('0xa'));var jayson=require(_0x0d56('0xb'));var client=jayson['client'][_0x0d56('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe41804,_0x2d747a,_0x1d3e21){return new BPromise(function(_0x26293f,_0xe22c7f){return client[_0x0d56('0xd')](_0xe41804,_0x1d3e21)[_0x0d56('0xe')](function(_0x2cada6){logger['info'](_0x0d56('0xf'),_0x2d747a,_0x0d56('0x10'));logger[_0x0d56('0x11')](_0x0d56('0x12'),_0x2d747a,_0x0d56('0x10'),JSON['stringify'](_0x2cada6));if(_0x2cada6[_0x0d56('0x13')]){if(_0x2cada6[_0x0d56('0x13')][_0x0d56('0x14')]===0x1f4){logger[_0x0d56('0x13')](_0x0d56('0xf'),_0x2d747a,_0x2cada6[_0x0d56('0x13')][_0x0d56('0x15')]);return _0xe22c7f(_0x2cada6['error'][_0x0d56('0x15')]);}logger['error'](_0x0d56('0xf'),_0x2d747a,_0x2cada6[_0x0d56('0x13')][_0x0d56('0x15')]);return _0x26293f(_0x2cada6[_0x0d56('0x13')][_0x0d56('0x15')]);}else{logger['info'](_0x0d56('0xf'),_0x2d747a,_0x0d56('0x10'));_0x26293f(_0x2cada6[_0x0d56('0x16')]['message']);}})['catch'](function(_0x473ed4){logger['error'](_0x0d56('0xf'),_0x2d747a,_0x473ed4);_0xe22c7f(_0x473ed4);});});}exports[_0x0d56('0x17')]=function(_0x1ed274){var _0x34fdfa=this;return new Promise(function(_0x5f42f4,_0x1c2c6c){return db[_0x0d56('0x18')][_0x0d56('0x19')]({'raw':_0x1ed274[_0x0d56('0x1a')]?_0x1ed274[_0x0d56('0x1a')][_0x0d56('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ed274[_0x0d56('0x1a')]?_0x1ed274[_0x0d56('0x1a')][_0x0d56('0x1c')]||null:null,'attributes':_0x1ed274[_0x0d56('0x1a')]?_0x1ed274['options'][_0x0d56('0x1d')]||null:null,'include':_0x1ed274['options']?_0x1ed274[_0x0d56('0x1a')][_0x0d56('0x1e')]?_[_0x0d56('0x1f')](_0x1ed274[_0x0d56('0x1a')][_0x0d56('0x1e')],function(_0xa71b63){return{'model':db[_0xa71b63[_0x0d56('0x20')]],'as':_0xa71b63['as'],'attributes':_0xa71b63[_0x0d56('0x1d')],'include':_0xa71b63['include']?_['map'](_0xa71b63['include'],function(_0x43d541){return{'model':db[_0x43d541[_0x0d56('0x20')]],'as':_0x43d541['as'],'attributes':_0x43d541[_0x0d56('0x1d')],'include':_0x43d541[_0x0d56('0x1e')]?_[_0x0d56('0x1f')](_0x43d541[_0x0d56('0x1e')],function(_0x1dcb00){return{'model':db[_0x1dcb00[_0x0d56('0x20')]],'as':_0x1dcb00['as'],'attributes':_0x1dcb00[_0x0d56('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d56('0xe')](function(_0x1031af){logger[_0x0d56('0x21')](_0x0d56('0x17'),_0x1ed274);logger[_0x0d56('0x11')](_0x0d56('0x17'),_0x1ed274,JSON[_0x0d56('0x22')](_0x1031af));_0x5f42f4(_0x1031af);})[_0x0d56('0x23')](function(_0x53d8c9){logger['error'](_0x0d56('0x17'),_0x53d8c9[_0x0d56('0x15')],_0x1ed274);_0x1c2c6c(_0x34fdfa['error'](0x1f4,_0x53d8c9[_0x0d56('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7a22435..5a7d1a5 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0x4fc2,0x111));var _0x24fc=function(_0x23d7c5,_0x2a7547){_0x23d7c5=_0x23d7c5-0x0;var _0x350950=_0x4fc2[_0x23d7c5];return _0x350950;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x4fc2,0x111));var _0x24fc=function(_0x50ee83,_0x106751){_0x50ee83=_0x50ee83-0x0;var _0x3099ea=_0x4fc2[_0x50ee83];return _0x3099ea;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6dc31bc..0748592 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 _0x6c6a=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x5dccda,_0x3c7e56){var _0x3bce32=function(_0x55f05a){while(--_0x55f05a){_0x5dccda['push'](_0x5dccda['shift']());}};_0x3bce32(++_0x3c7e56);}(_0x6c6a,0xba));var _0xa6c6=function(_0x3f3a28,_0x59932c){_0x3f3a28=_0x3f3a28-0x0;var _0x30969d=_0x6c6a[_0x3f3a28];return _0x30969d;};'use strict';var Sequelize=require(_0xa6c6('0x0'));module[_0xa6c6('0x1')]={'uniqueid':{'type':Sequelize[_0xa6c6('0x2')]},'body':{'type':Sequelize[_0xa6c6('0x3')](_0xa6c6('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xa6c6('0x5')]('in','out'),'defaultValue':_0xa6c6('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa6c6('0x3')]}}; \ No newline at end of file +var _0x148b=['out','sequelize','STRING','TEXT','medium'];(function(_0x4e0efc,_0xec862e){var _0x17c71d=function(_0x4c8b50){while(--_0x4c8b50){_0x4e0efc['push'](_0x4e0efc['shift']());}};_0x17c71d(++_0xec862e);}(_0x148b,0x92));var _0xb148=function(_0x37bb3e,_0x295424){_0x37bb3e=_0x37bb3e-0x0;var _0x5331d2=_0x148b[_0x37bb3e];return _0x5331d2;};'use strict';var Sequelize=require(_0xb148('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb148('0x1')]},'body':{'type':Sequelize[_0xb148('0x2')](_0xb148('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb148('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb148('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 624c852..3099454 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 _0xd0b3=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','rows','catch','show','find','create','body','params'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0xd0b3,0xcf));var _0x3d0b=function(_0x5c9d2c,_0x39d94e){_0x5c9d2c=_0x5c9d2c-0x0;var _0x8f3928=_0xd0b3[_0x5c9d2c];return _0x8f3928;};'use strict';var emlformat=require(_0x3d0b('0x0'));var rimraf=require(_0x3d0b('0x1'));var zipdir=require(_0x3d0b('0x2'));var jsonpatch=require(_0x3d0b('0x3'));var rp=require(_0x3d0b('0x4'));var moment=require(_0x3d0b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3d0b('0x6'));var util=require('util');var path=require(_0x3d0b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d0b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d0b('0x9'));var squel=require(_0x3d0b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d0b('0xb'));var toCsv=require(_0x3d0b('0xc'));var querystring=require(_0x3d0b('0xd'));var Papa=require(_0x3d0b('0xe'));var Redis=require(_0x3d0b('0xf'));var authService=require(_0x3d0b('0x10'));var qs=require(_0x3d0b('0x11'));var as=require(_0x3d0b('0x12'));var hardwareService=require(_0x3d0b('0x13'));var logger=require('../../config/logger')(_0x3d0b('0x14'));var utils=require('../../config/utils');var config=require(_0x3d0b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d0b('0x16'))['db'];function respondWithStatusCode(_0x4e9008,_0x113535){_0x113535=_0x113535||0xcc;return function(_0x1f5351){if(_0x1f5351){return _0x4e9008[_0x3d0b('0x17')](_0x113535);}return _0x4e9008[_0x3d0b('0x18')](_0x113535)[_0x3d0b('0x19')]();};}function respondWithResult(_0x35f9f9,_0x1b8acd){_0x1b8acd=_0x1b8acd||0xc8;return function(_0x4702d7){if(_0x4702d7){return _0x35f9f9[_0x3d0b('0x18')](_0x1b8acd)[_0x3d0b('0x1a')](_0x4702d7);}};}function respondWithFilteredResult(_0x2bf8c8,_0x1521d2){return function(_0x3b4631){if(_0x3b4631){var _0x3c77a8=typeof _0x1521d2[_0x3d0b('0x1b')]===_0x3d0b('0x1c')&&typeof _0x1521d2[_0x3d0b('0x1d')]===_0x3d0b('0x1c');var _0x3399e1=_0x3b4631[_0x3d0b('0x1e')];var _0x3ecf37=_0x3c77a8?0x0:_0x1521d2[_0x3d0b('0x1b')];var _0x466d37=_0x3c77a8?_0x3b4631[_0x3d0b('0x1e')]:_0x1521d2[_0x3d0b('0x1b')]+_0x1521d2[_0x3d0b('0x1d')];var _0x5376bc;if(_0x466d37>=_0x3399e1){_0x466d37=_0x3399e1;_0x5376bc=0xc8;}else{_0x5376bc=0xce;}_0x2bf8c8[_0x3d0b('0x18')](_0x5376bc);return _0x2bf8c8[_0x3d0b('0x1f')]('Content-Range',_0x3ecf37+'-'+_0x466d37+'/'+_0x3399e1)['json'](_0x3b4631);}return null;};}function patchUpdates(_0x4fadc1){return function(_0x25ac9e){try{jsonpatch[_0x3d0b('0x20')](_0x25ac9e,_0x4fadc1,!![]);}catch(_0xa5e42c){return BPromise[_0x3d0b('0x21')](_0xa5e42c);}return _0x25ac9e['save']();};}function saveUpdates(_0x16a70a,_0x3fdabe){return function(_0x990bdc){if(_0x990bdc){return _0x990bdc['update'](_0x16a70a)[_0x3d0b('0x22')](function(_0x2f0e2a){return _0x2f0e2a;});}return null;};}function removeEntity(_0x94cd3a,_0xbd0304){return function(_0x2863ae){if(_0x2863ae){return _0x2863ae[_0x3d0b('0x23')]()[_0x3d0b('0x22')](function(){_0x94cd3a['status'](0xcc)[_0x3d0b('0x19')]();});}};}function handleEntityNotFound(_0x461913,_0xce5356){return function(_0x3a36c5){if(!_0x3a36c5){_0x461913[_0x3d0b('0x17')](0x194);}return _0x3a36c5;};}function handleError(_0x2597ef,_0xc6776d){_0xc6776d=_0xc6776d||0x1f4;return function(_0x8cb54a){logger['error'](_0x8cb54a[_0x3d0b('0x24')]);if(_0x8cb54a[_0x3d0b('0x25')]){delete _0x8cb54a[_0x3d0b('0x25')];}_0x2597ef['status'](_0xc6776d)[_0x3d0b('0x26')](_0x8cb54a);};}exports[_0x3d0b('0x27')]=function(_0x5acaab,_0x17c8e0){var _0x370c2c={},_0x675e4f={},_0xe9061={'count':0x0,'rows':[]};var _0x52c49e=_[_0x3d0b('0x28')](db[_0x3d0b('0x29')][_0x3d0b('0x2a')],function(_0x27d884){return{'name':_0x27d884[_0x3d0b('0x2b')],'type':_0x27d884[_0x3d0b('0x2c')][_0x3d0b('0x2d')]};});_0x675e4f[_0x3d0b('0x2e')]=_[_0x3d0b('0x28')](_0x52c49e,_0x3d0b('0x25'));_0x675e4f['query']=_[_0x3d0b('0x2f')](_0x5acaab[_0x3d0b('0x30')]);_0x675e4f[_0x3d0b('0x31')]=_[_0x3d0b('0x32')](_0x675e4f['model'],_0x675e4f[_0x3d0b('0x30')]);_0x370c2c['attributes']=_[_0x3d0b('0x32')](_0x675e4f[_0x3d0b('0x2e')],qs['fields'](_0x5acaab[_0x3d0b('0x30')][_0x3d0b('0x33')]));_0x370c2c[_0x3d0b('0x34')]=_0x370c2c['attributes'][_0x3d0b('0x35')]?_0x370c2c[_0x3d0b('0x34')]:_0x675e4f[_0x3d0b('0x2e')];if(!_0x5acaab[_0x3d0b('0x30')][_0x3d0b('0x36')](_0x3d0b('0x37'))){_0x370c2c[_0x3d0b('0x1d')]=qs[_0x3d0b('0x1d')](_0x5acaab[_0x3d0b('0x30')][_0x3d0b('0x1d')]);_0x370c2c[_0x3d0b('0x1b')]=qs['offset'](_0x5acaab['query'][_0x3d0b('0x1b')]);}_0x370c2c['order']=qs[_0x3d0b('0x38')](_0x5acaab[_0x3d0b('0x30')][_0x3d0b('0x38')]);_0x370c2c[_0x3d0b('0x39')]=qs[_0x3d0b('0x31')](_['pick'](_0x5acaab['query'],_0x675e4f['filters']),_0x52c49e);if(_0x5acaab['query'][_0x3d0b('0x3a')]){_0x370c2c['where']=_[_0x3d0b('0x3b')](_0x370c2c[_0x3d0b('0x39')],{'$or':_[_0x3d0b('0x28')](_0x52c49e,function(_0x2c272e){if(_0x2c272e[_0x3d0b('0x2c')]!=='VIRTUAL'){var _0x4d0357={};_0x4d0357[_0x2c272e[_0x3d0b('0x25')]]={'$like':'%'+_0x5acaab[_0x3d0b('0x30')][_0x3d0b('0x3a')]+'%'};return _0x4d0357;}})});}_0x370c2c=_[_0x3d0b('0x3b')]({},_0x370c2c,_0x5acaab['options']);var _0x362ab6={'where':_0x370c2c[_0x3d0b('0x39')]};return db[_0x3d0b('0x29')]['count'](_0x362ab6)[_0x3d0b('0x22')](function(_0x49547d){_0xe9061[_0x3d0b('0x1e')]=_0x49547d;if(_0x5acaab[_0x3d0b('0x30')][_0x3d0b('0x3c')]){_0x370c2c[_0x3d0b('0x3d')]=[{'all':!![]}];}return db[_0x3d0b('0x29')]['findAll'](_0x370c2c);})[_0x3d0b('0x22')](function(_0x28fb32){_0xe9061[_0x3d0b('0x3e')]=_0x28fb32;return _0xe9061;})['then'](respondWithFilteredResult(_0x17c8e0,_0x370c2c))[_0x3d0b('0x3f')](handleError(_0x17c8e0,null));};exports[_0x3d0b('0x40')]=function(_0x176c63,_0x46e3e0){var _0x32d5b9={'raw':!![],'where':{'id':_0x176c63['params']['id']}},_0x445594={};_0x445594[_0x3d0b('0x2e')]=_[_0x3d0b('0x2f')](db[_0x3d0b('0x29')][_0x3d0b('0x2a')]);_0x445594[_0x3d0b('0x30')]=_[_0x3d0b('0x2f')](_0x176c63['query']);_0x445594[_0x3d0b('0x31')]=_['intersection'](_0x445594[_0x3d0b('0x2e')],_0x445594[_0x3d0b('0x30')]);_0x32d5b9[_0x3d0b('0x34')]=_[_0x3d0b('0x32')](_0x445594[_0x3d0b('0x2e')],qs[_0x3d0b('0x33')](_0x176c63['query'][_0x3d0b('0x33')]));_0x32d5b9[_0x3d0b('0x34')]=_0x32d5b9[_0x3d0b('0x34')][_0x3d0b('0x35')]?_0x32d5b9['attributes']:_0x445594[_0x3d0b('0x2e')];if(_0x176c63[_0x3d0b('0x30')][_0x3d0b('0x3c')]){_0x32d5b9[_0x3d0b('0x3d')]=[{'all':!![]}];}_0x32d5b9=_['merge']({},_0x32d5b9,_0x176c63['options']);return db['SquareMessage'][_0x3d0b('0x41')](_0x32d5b9)[_0x3d0b('0x22')](handleEntityNotFound(_0x46e3e0,null))[_0x3d0b('0x22')](respondWithResult(_0x46e3e0,null))['catch'](handleError(_0x46e3e0,null));};exports[_0x3d0b('0x42')]=function(_0x11887c,_0x21fffb){return db[_0x3d0b('0x29')][_0x3d0b('0x42')](_0x11887c[_0x3d0b('0x43')],{})['then'](respondWithResult(_0x21fffb,0xc9))[_0x3d0b('0x3f')](handleError(_0x21fffb,null));};exports['update']=function(_0x3d9f0f,_0x3e3de9){if(_0x3d9f0f[_0x3d0b('0x43')]['id']){delete _0x3d9f0f[_0x3d0b('0x43')]['id'];}return db[_0x3d0b('0x29')][_0x3d0b('0x41')]({'where':{'id':_0x3d9f0f[_0x3d0b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e3de9,null))[_0x3d0b('0x22')](saveUpdates(_0x3d9f0f[_0x3d0b('0x43')],null))[_0x3d0b('0x22')](respondWithResult(_0x3e3de9,null))[_0x3d0b('0x3f')](handleError(_0x3e3de9,null));};exports[_0x3d0b('0x23')]=function(_0x57033f,_0x2d658c){return db['SquareMessage'][_0x3d0b('0x41')]({'where':{'id':_0x57033f[_0x3d0b('0x44')]['id']}})[_0x3d0b('0x22')](handleEntityNotFound(_0x2d658c,null))[_0x3d0b('0x22')](removeEntity(_0x2d658c,null))['catch'](handleError(_0x2d658c,null));}; \ No newline at end of file +var _0x032a=['options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x4a5876,_0x4bedd9){var _0x22f36d=function(_0x2eb566){while(--_0x2eb566){_0x4a5876['push'](_0x4a5876['shift']());}};_0x22f36d(++_0x4bedd9);}(_0x032a,0x18d));var _0xa032=function(_0x3d9557,_0x5d09d2){_0x3d9557=_0x3d9557-0x0;var _0x359ff8=_0x032a[_0x3d9557];return _0x359ff8;};'use strict';var emlformat=require(_0xa032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa032('0x1'));var jsonpatch=require(_0xa032('0x2'));var rp=require(_0xa032('0x3'));var moment=require('moment');var BPromise=require(_0xa032('0x4'));var Mustache=require(_0xa032('0x5'));var util=require(_0xa032('0x6'));var path=require(_0xa032('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa032('0x8'));var fs=require('fs');var fs_extra=require(_0xa032('0x9'));var _=require(_0xa032('0xa'));var squel=require(_0xa032('0xb'));var crypto=require(_0xa032('0xc'));var jsforce=require(_0xa032('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa032('0xe'));var querystring=require(_0xa032('0xf'));var Papa=require(_0xa032('0x10'));var Redis=require(_0xa032('0x11'));var authService=require(_0xa032('0x12'));var qs=require(_0xa032('0x13'));var as=require(_0xa032('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa032('0x15'))(_0xa032('0x16'));var utils=require('../../config/utils');var config=require(_0xa032('0x17'));var licenseUtil=require(_0xa032('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4edc4a,_0x402cab){_0x402cab=_0x402cab||0xcc;return function(_0x45a923){if(_0x45a923){return _0x4edc4a['sendStatus'](_0x402cab);}return _0x4edc4a['status'](_0x402cab)[_0xa032('0x19')]();};}function respondWithResult(_0x234ad4,_0x1f87e1){_0x1f87e1=_0x1f87e1||0xc8;return function(_0x534787){if(_0x534787){return _0x234ad4[_0xa032('0x1a')](_0x1f87e1)['json'](_0x534787);}};}function respondWithFilteredResult(_0xe3c92a,_0x15bfdc){return function(_0x307e00){if(_0x307e00){var _0x13bca6=typeof _0x15bfdc[_0xa032('0x1b')]===_0xa032('0x1c')&&typeof _0x15bfdc[_0xa032('0x1d')]===_0xa032('0x1c');var _0x2fc7a3=_0x307e00[_0xa032('0x1e')];var _0x589305=_0x13bca6?0x0:_0x15bfdc[_0xa032('0x1b')];var _0x19d636=_0x13bca6?_0x307e00['count']:_0x15bfdc[_0xa032('0x1b')]+_0x15bfdc[_0xa032('0x1d')];var _0xec40b3;if(_0x19d636>=_0x2fc7a3){_0x19d636=_0x2fc7a3;_0xec40b3=0xc8;}else{_0xec40b3=0xce;}_0xe3c92a[_0xa032('0x1a')](_0xec40b3);return _0xe3c92a[_0xa032('0x1f')](_0xa032('0x20'),_0x589305+'-'+_0x19d636+'/'+_0x2fc7a3)['json'](_0x307e00);}return null;};}function patchUpdates(_0x49f389){return function(_0x48585e){try{jsonpatch[_0xa032('0x21')](_0x48585e,_0x49f389,!![]);}catch(_0x2dc761){return BPromise['reject'](_0x2dc761);}return _0x48585e[_0xa032('0x22')]();};}function saveUpdates(_0x52e7cd,_0x43299d){return function(_0x11cf1f){if(_0x11cf1f){return _0x11cf1f[_0xa032('0x23')](_0x52e7cd)[_0xa032('0x24')](function(_0x194d91){return _0x194d91;});}return null;};}function removeEntity(_0x2bae5d,_0x497c78){return function(_0x1dee33){if(_0x1dee33){return _0x1dee33[_0xa032('0x25')]()[_0xa032('0x24')](function(){_0x2bae5d[_0xa032('0x1a')](0xcc)[_0xa032('0x19')]();});}};}function handleEntityNotFound(_0x5d5719,_0x492757){return function(_0x2843ef){if(!_0x2843ef){_0x5d5719[_0xa032('0x26')](0x194);}return _0x2843ef;};}function handleError(_0x2dc826,_0x524835){_0x524835=_0x524835||0x1f4;return function(_0x4718f8){logger[_0xa032('0x27')](_0x4718f8[_0xa032('0x28')]);if(_0x4718f8[_0xa032('0x29')]){delete _0x4718f8[_0xa032('0x29')];}_0x2dc826[_0xa032('0x1a')](_0x524835)[_0xa032('0x2a')](_0x4718f8);};}exports[_0xa032('0x2b')]=function(_0x40c056,_0x2ca527){var _0x4e7ebd={},_0x51082e={},_0xad3e1={'count':0x0,'rows':[]};var _0x3c7f1a=_[_0xa032('0x2c')](db[_0xa032('0x2d')][_0xa032('0x2e')],function(_0x29b19d){return{'name':_0x29b19d[_0xa032('0x2f')],'type':_0x29b19d[_0xa032('0x30')][_0xa032('0x31')]};});_0x51082e[_0xa032('0x32')]=_['map'](_0x3c7f1a,_0xa032('0x29'));_0x51082e[_0xa032('0x33')]=_[_0xa032('0x34')](_0x40c056['query']);_0x51082e[_0xa032('0x35')]=_[_0xa032('0x36')](_0x51082e[_0xa032('0x32')],_0x51082e[_0xa032('0x33')]);_0x4e7ebd[_0xa032('0x37')]=_[_0xa032('0x36')](_0x51082e[_0xa032('0x32')],qs[_0xa032('0x38')](_0x40c056[_0xa032('0x33')]['fields']));_0x4e7ebd[_0xa032('0x37')]=_0x4e7ebd[_0xa032('0x37')]['length']?_0x4e7ebd['attributes']:_0x51082e[_0xa032('0x32')];if(!_0x40c056['query'][_0xa032('0x39')](_0xa032('0x3a'))){_0x4e7ebd[_0xa032('0x1d')]=qs[_0xa032('0x1d')](_0x40c056[_0xa032('0x33')]['limit']);_0x4e7ebd['offset']=qs[_0xa032('0x1b')](_0x40c056[_0xa032('0x33')][_0xa032('0x1b')]);}_0x4e7ebd['order']=qs[_0xa032('0x3b')](_0x40c056[_0xa032('0x33')][_0xa032('0x3b')]);_0x4e7ebd[_0xa032('0x3c')]=qs['filters'](_[_0xa032('0x3d')](_0x40c056[_0xa032('0x33')],_0x51082e[_0xa032('0x35')]),_0x3c7f1a);if(_0x40c056[_0xa032('0x33')]['filter']){_0x4e7ebd[_0xa032('0x3c')]=_[_0xa032('0x3e')](_0x4e7ebd[_0xa032('0x3c')],{'$or':_[_0xa032('0x2c')](_0x3c7f1a,function(_0x23ba4f){if(_0x23ba4f[_0xa032('0x30')]!==_0xa032('0x3f')){var _0x5512eb={};_0x5512eb[_0x23ba4f[_0xa032('0x29')]]={'$like':'%'+_0x40c056[_0xa032('0x33')][_0xa032('0x40')]+'%'};return _0x5512eb;}})});}_0x4e7ebd=_[_0xa032('0x3e')]({},_0x4e7ebd,_0x40c056[_0xa032('0x41')]);var _0x1bd8bc={'where':_0x4e7ebd[_0xa032('0x3c')]};return db[_0xa032('0x2d')]['count'](_0x1bd8bc)[_0xa032('0x24')](function(_0xe66f78){_0xad3e1[_0xa032('0x1e')]=_0xe66f78;if(_0x40c056[_0xa032('0x33')][_0xa032('0x42')]){_0x4e7ebd[_0xa032('0x43')]=[{'all':!![]}];}return db[_0xa032('0x2d')][_0xa032('0x44')](_0x4e7ebd);})['then'](function(_0x144387){_0xad3e1[_0xa032('0x45')]=_0x144387;return _0xad3e1;})['then'](respondWithFilteredResult(_0x2ca527,_0x4e7ebd))[_0xa032('0x46')](handleError(_0x2ca527,null));};exports[_0xa032('0x47')]=function(_0x4d5b9d,_0x3594c6){var _0x2fb74e={'raw':!![],'where':{'id':_0x4d5b9d[_0xa032('0x48')]['id']}},_0x34d3bf={};_0x34d3bf[_0xa032('0x32')]=_[_0xa032('0x34')](db[_0xa032('0x2d')][_0xa032('0x2e')]);_0x34d3bf[_0xa032('0x33')]=_['keys'](_0x4d5b9d[_0xa032('0x33')]);_0x34d3bf['filters']=_[_0xa032('0x36')](_0x34d3bf[_0xa032('0x32')],_0x34d3bf[_0xa032('0x33')]);_0x2fb74e[_0xa032('0x37')]=_[_0xa032('0x36')](_0x34d3bf['model'],qs[_0xa032('0x38')](_0x4d5b9d[_0xa032('0x33')]['fields']));_0x2fb74e[_0xa032('0x37')]=_0x2fb74e[_0xa032('0x37')][_0xa032('0x49')]?_0x2fb74e[_0xa032('0x37')]:_0x34d3bf['model'];if(_0x4d5b9d['query'][_0xa032('0x42')]){_0x2fb74e[_0xa032('0x43')]=[{'all':!![]}];}_0x2fb74e=_['merge']({},_0x2fb74e,_0x4d5b9d[_0xa032('0x41')]);return db[_0xa032('0x2d')]['find'](_0x2fb74e)[_0xa032('0x24')](handleEntityNotFound(_0x3594c6,null))[_0xa032('0x24')](respondWithResult(_0x3594c6,null))[_0xa032('0x46')](handleError(_0x3594c6,null));};exports[_0xa032('0x4a')]=function(_0x45667b,_0x45c786){return db[_0xa032('0x2d')]['create'](_0x45667b[_0xa032('0x4b')],{})[_0xa032('0x24')](respondWithResult(_0x45c786,0xc9))[_0xa032('0x46')](handleError(_0x45c786,null));};exports[_0xa032('0x23')]=function(_0x1a9db4,_0x101fcb){if(_0x1a9db4[_0xa032('0x4b')]['id']){delete _0x1a9db4[_0xa032('0x4b')]['id'];}return db['SquareMessage'][_0xa032('0x4c')]({'where':{'id':_0x1a9db4[_0xa032('0x48')]['id']}})[_0xa032('0x24')](handleEntityNotFound(_0x101fcb,null))[_0xa032('0x24')](saveUpdates(_0x1a9db4[_0xa032('0x4b')],null))[_0xa032('0x24')](respondWithResult(_0x101fcb,null))[_0xa032('0x46')](handleError(_0x101fcb,null));};exports['destroy']=function(_0x4dad73,_0x3af144){return db['SquareMessage'][_0xa032('0x4c')]({'where':{'id':_0x4dad73[_0xa032('0x48')]['id']}})[_0xa032('0x24')](handleEntityNotFound(_0x3af144,null))['then'](removeEntity(_0x3af144,null))[_0xa032('0x46')](handleError(_0x3af144,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6e7f040..fe8e7cb 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 _0xf8a4=['./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xd71e78,_0x102c46){var _0x49eb81=function(_0x54dda9){while(--_0x54dda9){_0xd71e78['push'](_0xd71e78['shift']());}};_0x49eb81(++_0x102c46);}(_0xf8a4,0x1a4));var _0x4f8a=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xf8a4[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x4f8a('0x0'));var util=require(_0x4f8a('0x1'));var logger=require(_0x4f8a('0x2'))(_0x4f8a('0x3'));var moment=require(_0x4f8a('0x4'));var BPromise=require(_0x4f8a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f8a('0x6'));var rimraf=require(_0x4f8a('0x7'));var config=require(_0x4f8a('0x8'));var attributes=require(_0x4f8a('0x9'));module['exports']=function(_0x1cb7d8,_0x3abf81){return _0x1cb7d8[_0x4f8a('0xa')](_0x4f8a('0xb'),attributes,{'tableName':_0x4f8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bcb=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','util','../../config/logger','api','request-promise'];(function(_0x2e900b,_0x521a3d){var _0x16f3a4=function(_0x76ef54){while(--_0x76ef54){_0x2e900b['push'](_0x2e900b['shift']());}};_0x16f3a4(++_0x521a3d);}(_0x1bcb,0xe2));var _0xb1bc=function(_0x3abe95,_0x2a7588){_0x3abe95=_0x3abe95-0x0;var _0x36c634=_0x1bcb[_0x3abe95];return _0x36c634;};'use strict';var _=require('lodash');var util=require(_0xb1bc('0x0'));var logger=require(_0xb1bc('0x1'))(_0xb1bc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb1bc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1bc('0x4'));var config=require(_0xb1bc('0x5'));var attributes=require(_0xb1bc('0x6'));module[_0xb1bc('0x7')]=function(_0x3c804d,_0x427e43){return _0x3c804d[_0xb1bc('0x8')]('SquareMessage',attributes,{'tableName':_0xb1bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 7aa6d7d..12d4b7f 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 _0xe8fc=['CreateSquareMessage','SquareMessage','create','options','raw','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0xe8fc,0xef));var _0xce8f=function(_0x5bda42,_0x3c45e3){_0x5bda42=_0x5bda42-0x0;var _0x27b619=_0xe8fc[_0x5bda42];return _0x27b619;};'use strict';var _=require(_0xce8f('0x0'));var util=require('util');var moment=require(_0xce8f('0x1'));var BPromise=require(_0xce8f('0x2'));var rs=require(_0xce8f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce8f('0x4'));var logger=require(_0xce8f('0x5'))('rpc');var config=require(_0xce8f('0x6'));var jayson=require(_0xce8f('0x7'));var client=jayson[_0xce8f('0x8')][_0xce8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x509841,_0x41690c,_0x2d5d94){return new BPromise(function(_0x5086dc,_0x10ab4d){return client[_0xce8f('0xa')](_0x509841,_0x2d5d94)['then'](function(_0x322834){logger[_0xce8f('0xb')](_0xce8f('0xc'),_0x41690c,_0xce8f('0xd'));logger[_0xce8f('0xe')](_0xce8f('0xf'),_0x41690c,_0xce8f('0xd'),JSON[_0xce8f('0x10')](_0x322834));if(_0x322834['error']){if(_0x322834['error'][_0xce8f('0x11')]===0x1f4){logger[_0xce8f('0x12')](_0xce8f('0xc'),_0x41690c,_0x322834[_0xce8f('0x12')]['message']);return _0x10ab4d(_0x322834[_0xce8f('0x12')][_0xce8f('0x13')]);}logger[_0xce8f('0x12')](_0xce8f('0xc'),_0x41690c,_0x322834['error']['message']);return _0x5086dc(_0x322834[_0xce8f('0x12')]['message']);}else{logger[_0xce8f('0xb')]('SquareMessage,\x20%s,\x20%s',_0x41690c,_0xce8f('0xd'));_0x5086dc(_0x322834['result'][_0xce8f('0x13')]);}})[_0xce8f('0x14')](function(_0x5f094b){logger[_0xce8f('0x12')](_0xce8f('0xc'),_0x41690c,_0x5f094b);_0x10ab4d(_0x5f094b);});});}exports[_0xce8f('0x15')]=function(_0x2e3f38){var _0x4d3894=this;return new Promise(function(_0x505d18,_0x5881a2){return db[_0xce8f('0x16')][_0xce8f('0x17')](_0x2e3f38['body'],{'raw':_0x2e3f38[_0xce8f('0x18')]?_0x2e3f38[_0xce8f('0x18')][_0xce8f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x13aa44){logger[_0xce8f('0xb')](_0xce8f('0x15'),_0x2e3f38);logger[_0xce8f('0xe')](_0xce8f('0x15'),_0x2e3f38,JSON[_0xce8f('0x10')](_0x13aa44));_0x505d18(_0x13aa44);})[_0xce8f('0x14')](function(_0x4fe0c0){logger[_0xce8f('0x12')]('CreateSquareMessage',_0x4fe0c0['message'],_0x2e3f38);_0x5881a2(_0x4d3894[_0xce8f('0x12')](0x1f4,_0x4fe0c0['message']));});});}; \ No newline at end of file +var _0x3606=['then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','options','raw'];(function(_0x3d12c6,_0x56b174){var _0x48bba8=function(_0x460b09){while(--_0x460b09){_0x3d12c6['push'](_0x3d12c6['shift']());}};_0x48bba8(++_0x56b174);}(_0x3606,0x135));var _0x6360=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x3606[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x6360('0x0'));var util=require(_0x6360('0x1'));var moment=require(_0x6360('0x2'));var BPromise=require(_0x6360('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6360('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6360('0x5'));var logger=require(_0x6360('0x6'))(_0x6360('0x7'));var config=require(_0x6360('0x8'));var jayson=require(_0x6360('0x9'));var client=jayson[_0x6360('0xa')][_0x6360('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f4bda,_0x2eebdf,_0x870a4a){return new BPromise(function(_0x5553d7,_0x1896fd){return client[_0x6360('0xc')](_0x5f4bda,_0x870a4a)['then'](function(_0x1ec407){logger[_0x6360('0xd')](_0x6360('0xe'),_0x2eebdf,_0x6360('0xf'));logger[_0x6360('0x10')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2eebdf,_0x6360('0xf'),JSON[_0x6360('0x11')](_0x1ec407));if(_0x1ec407[_0x6360('0x12')]){if(_0x1ec407[_0x6360('0x12')][_0x6360('0x13')]===0x1f4){logger[_0x6360('0x12')](_0x6360('0xe'),_0x2eebdf,_0x1ec407['error'][_0x6360('0x14')]);return _0x1896fd(_0x1ec407[_0x6360('0x12')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x2eebdf,_0x1ec407['error'][_0x6360('0x14')]);return _0x5553d7(_0x1ec407['error'][_0x6360('0x14')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x2eebdf,_0x6360('0xf'));_0x5553d7(_0x1ec407[_0x6360('0x15')][_0x6360('0x14')]);}})['catch'](function(_0x5da150){logger[_0x6360('0x12')](_0x6360('0xe'),_0x2eebdf,_0x5da150);_0x1896fd(_0x5da150);});});}exports[_0x6360('0x16')]=function(_0x1fea8c){var _0x423796=this;return new Promise(function(_0x1e25e4,_0x2015a4){return db[_0x6360('0x17')][_0x6360('0x18')](_0x1fea8c['body'],{'raw':_0x1fea8c[_0x6360('0x19')]?_0x1fea8c[_0x6360('0x19')][_0x6360('0x1a')]===undefined?!![]:![]:!![]})[_0x6360('0x1b')](function(_0x47149a){logger[_0x6360('0xd')](_0x6360('0x16'),_0x1fea8c);logger['debug']('CreateSquareMessage',_0x1fea8c,JSON['stringify'](_0x47149a));_0x1e25e4(_0x47149a);})['catch'](function(_0x45182c){logger[_0x6360('0x12')](_0x6360('0x16'),_0x45182c[_0x6360('0x14')],_0x1fea8c);_0x2015a4(_0x423796['error'](0x1f4,_0x45182c[_0x6360('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3237d23..072949b 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 _0x2c28=['index','/:id','show','15s','test','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x13a182,_0x292599){var _0x34edba=function(_0x54df99){while(--_0x54df99){_0x13a182['push'](_0x13a182['shift']());}};_0x34edba(++_0x292599);}(_0x2c28,0xbb));var _0x82c2=function(_0x5d14c6,_0xef6d82){_0x5d14c6=_0x5d14c6-0x0;var _0x49f240=_0x2c28[_0x5d14c6];return _0x49f240;};'use strict';var multer=require(_0x82c2('0x0'));var util=require(_0x82c2('0x1'));var path=require(_0x82c2('0x2'));var timeout=require(_0x82c2('0x3'));var express=require(_0x82c2('0x4'));var router=express[_0x82c2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x82c2('0x6'));var interaction=require(_0x82c2('0x7'));var config=require(_0x82c2('0x8'));var controller=require('./squareOdbc.controller');router[_0x82c2('0x9')]('/',auth[_0x82c2('0xa')](),controller[_0x82c2('0xb')]);router['get'](_0x82c2('0xc'),auth[_0x82c2('0xa')](),controller[_0x82c2('0xd')]);router['get']('/:id/test',auth['isAuthenticated'](),timeout(_0x82c2('0xe')),controller[_0x82c2('0xf')]);router[_0x82c2('0x10')]('/',auth[_0x82c2('0xa')](),controller['create']);router[_0x82c2('0x11')]('/:id',auth[_0x82c2('0xa')](),controller[_0x82c2('0x12')]);router[_0x82c2('0x13')](_0x82c2('0xc'),auth['isAuthenticated'](),controller[_0x82c2('0x14')]);module[_0x82c2('0x15')]=router; \ No newline at end of file +var _0xcf9b=['/:id','show','/:id/test','15s','test','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2bf948,_0x1ea985){var _0x33ea17=function(_0xea3ef4){while(--_0xea3ef4){_0x2bf948['push'](_0x2bf948['shift']());}};_0x33ea17(++_0x1ea985);}(_0xcf9b,0x1a8));var _0xbcf9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcf9b[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xbcf9('0x0'));var util=require(_0xbcf9('0x1'));var path=require(_0xbcf9('0x2'));var timeout=require(_0xbcf9('0x3'));var express=require(_0xbcf9('0x4'));var router=express[_0xbcf9('0x5')]();var fs_extra=require(_0xbcf9('0x6'));var auth=require(_0xbcf9('0x7'));var interaction=require(_0xbcf9('0x8'));var config=require(_0xbcf9('0x9'));var controller=require('./squareOdbc.controller');router[_0xbcf9('0xa')]('/',auth[_0xbcf9('0xb')](),controller[_0xbcf9('0xc')]);router[_0xbcf9('0xa')](_0xbcf9('0xd'),auth[_0xbcf9('0xb')](),controller[_0xbcf9('0xe')]);router[_0xbcf9('0xa')](_0xbcf9('0xf'),auth[_0xbcf9('0xb')](),timeout(_0xbcf9('0x10')),controller[_0xbcf9('0x11')]);router[_0xbcf9('0x12')]('/',auth[_0xbcf9('0xb')](),controller[_0xbcf9('0x13')]);router['put'](_0xbcf9('0xd'),auth[_0xbcf9('0xb')](),controller['update']);router[_0xbcf9('0x14')](_0xbcf9('0xd'),auth[_0xbcf9('0xb')](),controller[_0xbcf9('0x15')]);module[_0xbcf9('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index c69a3df..84cee3b 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 _0x12aa=['sequelize','exports','STRING','name'];(function(_0x43fb03,_0x4317e7){var _0x2e565d=function(_0x1c73af){while(--_0x1c73af){_0x43fb03['push'](_0x43fb03['shift']());}};_0x2e565d(++_0x4317e7);}(_0x12aa,0x78));var _0xa12a=function(_0x442137,_0x3419f5){_0x442137=_0x442137-0x0;var _0x3da144=_0x12aa[_0x442137];return _0x3da144;};'use strict';var Sequelize=require(_0xa12a('0x0'));module[_0xa12a('0x1')]={'name':{'type':Sequelize[_0xa12a('0x2')],'unique':_0xa12a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa12a('0x2')]},'description':{'type':Sequelize[_0xa12a('0x2')]}}; \ No newline at end of file +var _0x1859=['STRING','name','exports'];(function(_0x583c8b,_0xda2e28){var _0x3ee39e=function(_0x39996d){while(--_0x39996d){_0x583c8b['push'](_0x583c8b['shift']());}};_0x3ee39e(++_0xda2e28);}(_0x1859,0xcb));var _0x9185=function(_0x3c376f,_0x63aa74){_0x3c376f=_0x3c376f-0x0;var _0x408098=_0x1859[_0x3c376f];return _0x408098;};'use strict';var Sequelize=require('sequelize');module[_0x9185('0x0')]={'name':{'type':Sequelize[_0x9185('0x1')],'unique':_0x9185('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x9185('0x1')]},'description':{'type':Sequelize[_0x9185('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f6a44fe..46bbd33 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 _0x40ac=['key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','options','findAll','catch','show','params','rawAttributes','include','find','create','body','role','UserProfileSection','autoAssociation','error','odbc','openSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','ODBC','UserProfileResource','destroy','name','send','map','SquareOdbc'];(function(_0x54dead,_0x2dc10f){var _0x376a92=function(_0x1fa199){while(--_0x1fa199){_0x54dead['push'](_0x54dead['shift']());}};_0x376a92(++_0x2dc10f);}(_0x40ac,0xab));var _0xc40a=function(_0x45cf7c,_0x5090d5){_0x45cf7c=_0x45cf7c-0x0;var _0x1444b3=_0x40ac[_0x45cf7c];return _0x1444b3;};'use strict';var emlformat=require(_0xc40a('0x0'));var rimraf=require(_0xc40a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc40a('0x2'));var rp=require(_0xc40a('0x3'));var moment=require('moment');var BPromise=require(_0xc40a('0x4'));var Mustache=require(_0xc40a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc40a('0x6'));var csv=require(_0xc40a('0x7'));var ejs=require(_0xc40a('0x8'));var fs=require('fs');var fs_extra=require(_0xc40a('0x9'));var _=require('lodash');var squel=require(_0xc40a('0xa'));var crypto=require(_0xc40a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc40a('0xc'));var toCsv=require(_0xc40a('0x7'));var querystring=require(_0xc40a('0xd'));var Papa=require(_0xc40a('0xe'));var Redis=require('ioredis');var authService=require(_0xc40a('0xf'));var qs=require(_0xc40a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc40a('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc40a('0x12'));var licenseUtil=require(_0xc40a('0x13'));var db=require(_0xc40a('0x14'))['db'];function respondWithStatusCode(_0xe0be86,_0x4054da){_0x4054da=_0x4054da||0xcc;return function(_0x52202c){if(_0x52202c){return _0xe0be86[_0xc40a('0x15')](_0x4054da);}return _0xe0be86[_0xc40a('0x16')](_0x4054da)[_0xc40a('0x17')]();};}function respondWithResult(_0x3ca887,_0x1d7ee1){_0x1d7ee1=_0x1d7ee1||0xc8;return function(_0x2593c9){if(_0x2593c9){return _0x3ca887['status'](_0x1d7ee1)[_0xc40a('0x18')](_0x2593c9);}};}function respondWithFilteredResult(_0x5ec843,_0x5082be){return function(_0x209704){if(_0x209704){var _0x479461=typeof _0x5082be[_0xc40a('0x19')]===_0xc40a('0x1a')&&typeof _0x5082be[_0xc40a('0x1b')]===_0xc40a('0x1a');var _0x3f8748=_0x209704[_0xc40a('0x1c')];var _0x2512da=_0x479461?0x0:_0x5082be['offset'];var _0x69c071=_0x479461?_0x209704[_0xc40a('0x1c')]:_0x5082be[_0xc40a('0x19')]+_0x5082be[_0xc40a('0x1b')];var _0x5d35e6;if(_0x69c071>=_0x3f8748){_0x69c071=_0x3f8748;_0x5d35e6=0xc8;}else{_0x5d35e6=0xce;}_0x5ec843['status'](_0x5d35e6);return _0x5ec843[_0xc40a('0x1d')](_0xc40a('0x1e'),_0x2512da+'-'+_0x69c071+'/'+_0x3f8748)['json'](_0x209704);}return null;};}function patchUpdates(_0x5f00e3){return function(_0x318141){try{jsonpatch['apply'](_0x318141,_0x5f00e3,!![]);}catch(_0x4d6130){return BPromise[_0xc40a('0x1f')](_0x4d6130);}return _0x318141['save']();};}function saveUpdates(_0x25a03d,_0x472fe1){return function(_0x81a791){if(_0x81a791){return _0x81a791[_0xc40a('0x20')](_0x25a03d)[_0xc40a('0x21')](function(_0x2842e1){return _0x2842e1;});}return null;};}function removeEntity(_0x5ad77b,_0x27d5ca){return function(_0x27fa09){if(_0x27fa09){return _0x27fa09['destroy']()['then'](function(){var _0x5384ec=_0x27fa09[_0xc40a('0x22')]({'plain':!![]});var _0x247347=_0xc40a('0x23');return db[_0xc40a('0x24')][_0xc40a('0x25')]({'where':{'type':_0x247347,'resourceId':_0x5384ec['id']}})[_0xc40a('0x21')](function(){return _0x27fa09;});})[_0xc40a('0x21')](function(){_0x5ad77b['status'](0xcc)[_0xc40a('0x17')]();});}};}function handleEntityNotFound(_0x4bb28f,_0x53df0c){return function(_0x5531a4){if(!_0x5531a4){_0x4bb28f[_0xc40a('0x15')](0x194);}return _0x5531a4;};}function handleError(_0x2fbc83,_0x4d9172){_0x4d9172=_0x4d9172||0x1f4;return function(_0x35d1e6){logger['error'](_0x35d1e6['stack']);if(_0x35d1e6[_0xc40a('0x26')]){delete _0x35d1e6[_0xc40a('0x26')];}_0x2fbc83[_0xc40a('0x16')](_0x4d9172)[_0xc40a('0x27')](_0x35d1e6);};}exports['index']=function(_0x273a12,_0x76f20c){var _0x21c62a={},_0x16beba={},_0x32e9e2={'count':0x0,'rows':[]};var _0x48aa6f=_[_0xc40a('0x28')](db[_0xc40a('0x29')]['rawAttributes'],function(_0x376783){return{'name':_0x376783['fieldName'],'type':_0x376783['type'][_0xc40a('0x2a')]};});_0x16beba[_0xc40a('0x2b')]=_[_0xc40a('0x28')](_0x48aa6f,'name');_0x16beba[_0xc40a('0x2c')]=_[_0xc40a('0x2d')](_0x273a12[_0xc40a('0x2c')]);_0x16beba[_0xc40a('0x2e')]=_[_0xc40a('0x2f')](_0x16beba['model'],_0x16beba[_0xc40a('0x2c')]);_0x21c62a['attributes']=_[_0xc40a('0x2f')](_0x16beba[_0xc40a('0x2b')],qs[_0xc40a('0x30')](_0x273a12[_0xc40a('0x2c')]['fields']));_0x21c62a[_0xc40a('0x31')]=_0x21c62a['attributes'][_0xc40a('0x32')]?_0x21c62a[_0xc40a('0x31')]:_0x16beba[_0xc40a('0x2b')];if(!_0x273a12[_0xc40a('0x2c')]['hasOwnProperty']('nolimit')){_0x21c62a[_0xc40a('0x1b')]=qs['limit'](_0x273a12[_0xc40a('0x2c')][_0xc40a('0x1b')]);_0x21c62a[_0xc40a('0x19')]=qs['offset'](_0x273a12[_0xc40a('0x2c')]['offset']);}_0x21c62a[_0xc40a('0x33')]=qs[_0xc40a('0x34')](_0x273a12[_0xc40a('0x2c')][_0xc40a('0x34')]);_0x21c62a[_0xc40a('0x35')]=qs[_0xc40a('0x2e')](_['pick'](_0x273a12[_0xc40a('0x2c')],_0x16beba['filters']),_0x48aa6f);if(_0x273a12[_0xc40a('0x2c')]['filter']){_0x21c62a[_0xc40a('0x35')]=_[_0xc40a('0x36')](_0x21c62a[_0xc40a('0x35')],{'$or':_[_0xc40a('0x28')](_0x48aa6f,function(_0xa8188){if(_0xa8188['type']!=='VIRTUAL'){var _0x1655ac={};_0x1655ac[_0xa8188['name']]={'$like':'%'+_0x273a12[_0xc40a('0x2c')]['filter']+'%'};return _0x1655ac;}})});}_0x21c62a=_[_0xc40a('0x36')]({},_0x21c62a,_0x273a12[_0xc40a('0x37')]);var _0x4a29e0={'where':_0x21c62a[_0xc40a('0x35')]};return db[_0xc40a('0x29')][_0xc40a('0x1c')](_0x4a29e0)[_0xc40a('0x21')](function(_0x51d6c9){_0x32e9e2['count']=_0x51d6c9;if(_0x273a12['query']['includeAll']){_0x21c62a['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xc40a('0x38')](_0x21c62a);})[_0xc40a('0x21')](function(_0x2fadbc){_0x32e9e2['rows']=_0x2fadbc;return _0x32e9e2;})[_0xc40a('0x21')](respondWithFilteredResult(_0x76f20c,_0x21c62a))[_0xc40a('0x39')](handleError(_0x76f20c,null));};exports[_0xc40a('0x3a')]=function(_0x32620e,_0x3fd6df){var _0x4ac431={'raw':!![],'where':{'id':_0x32620e[_0xc40a('0x3b')]['id']}},_0x14a83a={};_0x14a83a[_0xc40a('0x2b')]=_[_0xc40a('0x2d')](db[_0xc40a('0x29')][_0xc40a('0x3c')]);_0x14a83a[_0xc40a('0x2c')]=_['keys'](_0x32620e[_0xc40a('0x2c')]);_0x14a83a[_0xc40a('0x2e')]=_['intersection'](_0x14a83a['model'],_0x14a83a['query']);_0x4ac431['attributes']=_[_0xc40a('0x2f')](_0x14a83a[_0xc40a('0x2b')],qs[_0xc40a('0x30')](_0x32620e[_0xc40a('0x2c')][_0xc40a('0x30')]));_0x4ac431[_0xc40a('0x31')]=_0x4ac431['attributes'][_0xc40a('0x32')]?_0x4ac431['attributes']:_0x14a83a[_0xc40a('0x2b')];if(_0x32620e[_0xc40a('0x2c')]['includeAll']){_0x4ac431[_0xc40a('0x3d')]=[{'all':!![]}];}_0x4ac431=_[_0xc40a('0x36')]({},_0x4ac431,_0x32620e[_0xc40a('0x37')]);return db[_0xc40a('0x29')][_0xc40a('0x3e')](_0x4ac431)['then'](handleEntityNotFound(_0x3fd6df,null))['then'](respondWithResult(_0x3fd6df,null))[_0xc40a('0x39')](handleError(_0x3fd6df,null));};exports[_0xc40a('0x3f')]=function(_0x5ed2f5,_0x20da5e){return db[_0xc40a('0x29')][_0xc40a('0x3f')](_0x5ed2f5[_0xc40a('0x40')],{})['then'](function(_0x4a9256){var _0x2f0b06=_0x5ed2f5['user'][_0xc40a('0x22')]({'plain':!![]});if(!_0x2f0b06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f0b06[_0xc40a('0x41')]==='user'){var _0x48d687=_0x4a9256[_0xc40a('0x22')]({'plain':!![]});var _0x1738c8='ODBC';return db[_0xc40a('0x42')][_0xc40a('0x3e')]({'where':{'name':_0x1738c8,'userProfileId':_0x2f0b06['userProfileId']},'raw':!![]})[_0xc40a('0x21')](function(_0x4fe6ca){if(_0x4fe6ca&&_0x4fe6ca[_0xc40a('0x43')]===0x0){return db[_0xc40a('0x24')]['create']({'name':_0x48d687['name'],'resourceId':_0x48d687['id'],'type':_0x4fe6ca[_0xc40a('0x26')],'sectionId':_0x4fe6ca['id']},{})['then'](function(){return _0x4a9256;});}else{return _0x4a9256;}})[_0xc40a('0x39')](function(_0x5a606a){logger[_0xc40a('0x44')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a606a);throw _0x5a606a;});}return _0x4a9256;})[_0xc40a('0x21')](respondWithResult(_0x20da5e,0xc9))[_0xc40a('0x39')](handleError(_0x20da5e,null));};exports['update']=function(_0x4c3be0,_0x3a630c){if(_0x4c3be0[_0xc40a('0x40')]['id']){delete _0x4c3be0['body']['id'];}return db[_0xc40a('0x29')][_0xc40a('0x3e')]({'where':{'id':_0x4c3be0[_0xc40a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3a630c,null))[_0xc40a('0x21')](saveUpdates(_0x4c3be0['body'],null))['then'](respondWithResult(_0x3a630c,null))[_0xc40a('0x39')](handleError(_0x3a630c,null));};exports[_0xc40a('0x25')]=function(_0x557554,_0x281b86){return db[_0xc40a('0x29')]['find']({'where':{'id':_0x557554['params']['id']}})[_0xc40a('0x21')](handleEntityNotFound(_0x281b86,null))['then'](removeEntity(_0x281b86,null))['catch'](handleError(_0x281b86,null));};exports['test']=function(_0x246567,_0x57113f,_0x211db3){var _0x236776;return db[_0xc40a('0x29')][_0xc40a('0x3e')]({'where':{'id':_0x246567[_0xc40a('0x3b')]['id']},'attributes':['id','dsn']})[_0xc40a('0x21')](handleEntityNotFound(_0x57113f,null))['then'](function(_0x3a8ada){if(_0x3a8ada){var _0x465585=require(_0xc40a('0x45'))();_0x465585[_0xc40a('0x46')](_0x3a8ada['dsn']);_0x465585['closeSync']();return _0x3a8ada;}})[_0xc40a('0x21')](respondWithResult(_0x57113f,null))[_0xc40a('0x39')](handleError(_0x57113f,null));}; \ No newline at end of file +var _0xe440=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','end','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x21eacf,_0x1d1f5b){var _0xbae3e=function(_0x17ed68){while(--_0x17ed68){_0x21eacf['push'](_0x21eacf['shift']());}};_0xbae3e(++_0x1d1f5b);}(_0xe440,0x1e5));var _0x0e44=function(_0x4ab4f4,_0x1220e2){_0x4ab4f4=_0x4ab4f4-0x0;var _0x1499e9=_0xe440[_0x4ab4f4];return _0x1499e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e44('0x0'));var zipdir=require(_0x0e44('0x1'));var jsonpatch=require(_0x0e44('0x2'));var rp=require(_0x0e44('0x3'));var moment=require(_0x0e44('0x4'));var BPromise=require(_0x0e44('0x5'));var Mustache=require(_0x0e44('0x6'));var util=require(_0x0e44('0x7'));var path=require(_0x0e44('0x8'));var sox=require(_0x0e44('0x9'));var csv=require(_0x0e44('0xa'));var ejs=require(_0x0e44('0xb'));var fs=require('fs');var fs_extra=require(_0x0e44('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0e44('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0e44('0xe'));var toCsv=require(_0x0e44('0xa'));var querystring=require(_0x0e44('0xf'));var Papa=require(_0x0e44('0x10'));var Redis=require(_0x0e44('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e44('0x12'));var as=require(_0x0e44('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e44('0x14'));var utils=require(_0x0e44('0x15'));var config=require(_0x0e44('0x16'));var licenseUtil=require(_0x0e44('0x17'));var db=require(_0x0e44('0x18'))['db'];function respondWithStatusCode(_0x951373,_0x299d73){_0x299d73=_0x299d73||0xcc;return function(_0x12c7f7){if(_0x12c7f7){return _0x951373[_0x0e44('0x19')](_0x299d73);}return _0x951373[_0x0e44('0x1a')](_0x299d73)['end']();};}function respondWithResult(_0x1ad2f6,_0x11114c){_0x11114c=_0x11114c||0xc8;return function(_0x87431a){if(_0x87431a){return _0x1ad2f6[_0x0e44('0x1a')](_0x11114c)[_0x0e44('0x1b')](_0x87431a);}};}function respondWithFilteredResult(_0x35aed9,_0x4ee614){return function(_0x4ed241){if(_0x4ed241){var _0x4986dd=typeof _0x4ee614['offset']===_0x0e44('0x1c')&&typeof _0x4ee614['limit']===_0x0e44('0x1c');var _0x6c5721=_0x4ed241[_0x0e44('0x1d')];var _0x9bff73=_0x4986dd?0x0:_0x4ee614['offset'];var _0x5890a7=_0x4986dd?_0x4ed241[_0x0e44('0x1d')]:_0x4ee614[_0x0e44('0x1e')]+_0x4ee614[_0x0e44('0x1f')];var _0x352a0e;if(_0x5890a7>=_0x6c5721){_0x5890a7=_0x6c5721;_0x352a0e=0xc8;}else{_0x352a0e=0xce;}_0x35aed9[_0x0e44('0x1a')](_0x352a0e);return _0x35aed9[_0x0e44('0x20')](_0x0e44('0x21'),_0x9bff73+'-'+_0x5890a7+'/'+_0x6c5721)['json'](_0x4ed241);}return null;};}function patchUpdates(_0xe20654){return function(_0x162eca){try{jsonpatch[_0x0e44('0x22')](_0x162eca,_0xe20654,!![]);}catch(_0x4a0f24){return BPromise[_0x0e44('0x23')](_0x4a0f24);}return _0x162eca['save']();};}function saveUpdates(_0x313448,_0x175eb3){return function(_0x4b369e){if(_0x4b369e){return _0x4b369e[_0x0e44('0x24')](_0x313448)[_0x0e44('0x25')](function(_0x181e71){return _0x181e71;});}return null;};}function removeEntity(_0x49cc14,_0x5574ae){return function(_0x2b2df6){if(_0x2b2df6){return _0x2b2df6[_0x0e44('0x26')]()[_0x0e44('0x25')](function(){var _0x11e539=_0x2b2df6[_0x0e44('0x27')]({'plain':!![]});var _0x5d7ff4='ODBC';return db['UserProfileResource'][_0x0e44('0x26')]({'where':{'type':_0x5d7ff4,'resourceId':_0x11e539['id']}})[_0x0e44('0x25')](function(){return _0x2b2df6;});})[_0x0e44('0x25')](function(){_0x49cc14['status'](0xcc)[_0x0e44('0x28')]();});}};}function handleEntityNotFound(_0x512837,_0x463959){return function(_0x3b456f){if(!_0x3b456f){_0x512837['sendStatus'](0x194);}return _0x3b456f;};}function handleError(_0x3c48c9,_0x11e0c6){_0x11e0c6=_0x11e0c6||0x1f4;return function(_0x16e48f){logger[_0x0e44('0x29')](_0x16e48f[_0x0e44('0x2a')]);if(_0x16e48f[_0x0e44('0x2b')]){delete _0x16e48f[_0x0e44('0x2b')];}_0x3c48c9[_0x0e44('0x1a')](_0x11e0c6)['send'](_0x16e48f);};}exports[_0x0e44('0x2c')]=function(_0x229af0,_0x30a52a){var _0x2542ef={},_0x443040={},_0x97c804={'count':0x0,'rows':[]};var _0x279c88=_[_0x0e44('0x2d')](db[_0x0e44('0x2e')][_0x0e44('0x2f')],function(_0x4b0ac7){return{'name':_0x4b0ac7[_0x0e44('0x30')],'type':_0x4b0ac7[_0x0e44('0x31')]['key']};});_0x443040[_0x0e44('0x32')]=_['map'](_0x279c88,_0x0e44('0x2b'));_0x443040[_0x0e44('0x33')]=_[_0x0e44('0x34')](_0x229af0[_0x0e44('0x33')]);_0x443040[_0x0e44('0x35')]=_['intersection'](_0x443040[_0x0e44('0x32')],_0x443040['query']);_0x2542ef['attributes']=_[_0x0e44('0x36')](_0x443040[_0x0e44('0x32')],qs[_0x0e44('0x37')](_0x229af0['query']['fields']));_0x2542ef[_0x0e44('0x38')]=_0x2542ef['attributes'][_0x0e44('0x39')]?_0x2542ef[_0x0e44('0x38')]:_0x443040[_0x0e44('0x32')];if(!_0x229af0['query'][_0x0e44('0x3a')](_0x0e44('0x3b'))){_0x2542ef[_0x0e44('0x1f')]=qs[_0x0e44('0x1f')](_0x229af0[_0x0e44('0x33')][_0x0e44('0x1f')]);_0x2542ef['offset']=qs[_0x0e44('0x1e')](_0x229af0[_0x0e44('0x33')]['offset']);}_0x2542ef['order']=qs['sort'](_0x229af0[_0x0e44('0x33')]['sort']);_0x2542ef[_0x0e44('0x3c')]=qs[_0x0e44('0x35')](_['pick'](_0x229af0[_0x0e44('0x33')],_0x443040['filters']),_0x279c88);if(_0x229af0[_0x0e44('0x33')][_0x0e44('0x3d')]){_0x2542ef[_0x0e44('0x3c')]=_[_0x0e44('0x3e')](_0x2542ef['where'],{'$or':_['map'](_0x279c88,function(_0x4d77ed){if(_0x4d77ed[_0x0e44('0x31')]!==_0x0e44('0x3f')){var _0xcbc31d={};_0xcbc31d[_0x4d77ed['name']]={'$like':'%'+_0x229af0['query'][_0x0e44('0x3d')]+'%'};return _0xcbc31d;}})});}_0x2542ef=_['merge']({},_0x2542ef,_0x229af0['options']);var _0x5660d2={'where':_0x2542ef[_0x0e44('0x3c')]};return db[_0x0e44('0x2e')][_0x0e44('0x1d')](_0x5660d2)['then'](function(_0x5114b4){_0x97c804[_0x0e44('0x1d')]=_0x5114b4;if(_0x229af0[_0x0e44('0x33')]['includeAll']){_0x2542ef[_0x0e44('0x40')]=[{'all':!![]}];}return db[_0x0e44('0x2e')][_0x0e44('0x41')](_0x2542ef);})['then'](function(_0x42df51){_0x97c804[_0x0e44('0x42')]=_0x42df51;return _0x97c804;})[_0x0e44('0x25')](respondWithFilteredResult(_0x30a52a,_0x2542ef))[_0x0e44('0x43')](handleError(_0x30a52a,null));};exports[_0x0e44('0x44')]=function(_0x1ed85b,_0x170053){var _0x55be21={'raw':!![],'where':{'id':_0x1ed85b[_0x0e44('0x45')]['id']}},_0x176cbe={};_0x176cbe[_0x0e44('0x32')]=_[_0x0e44('0x34')](db[_0x0e44('0x2e')]['rawAttributes']);_0x176cbe[_0x0e44('0x33')]=_[_0x0e44('0x34')](_0x1ed85b[_0x0e44('0x33')]);_0x176cbe[_0x0e44('0x35')]=_[_0x0e44('0x36')](_0x176cbe['model'],_0x176cbe[_0x0e44('0x33')]);_0x55be21['attributes']=_[_0x0e44('0x36')](_0x176cbe[_0x0e44('0x32')],qs[_0x0e44('0x37')](_0x1ed85b['query'][_0x0e44('0x37')]));_0x55be21['attributes']=_0x55be21['attributes'][_0x0e44('0x39')]?_0x55be21['attributes']:_0x176cbe['model'];if(_0x1ed85b[_0x0e44('0x33')][_0x0e44('0x46')]){_0x55be21[_0x0e44('0x40')]=[{'all':!![]}];}_0x55be21=_[_0x0e44('0x3e')]({},_0x55be21,_0x1ed85b[_0x0e44('0x47')]);return db['SquareOdbc'][_0x0e44('0x48')](_0x55be21)[_0x0e44('0x25')](handleEntityNotFound(_0x170053,null))[_0x0e44('0x25')](respondWithResult(_0x170053,null))[_0x0e44('0x43')](handleError(_0x170053,null));};exports['create']=function(_0x1cacb8,_0x4cff24){return db[_0x0e44('0x2e')][_0x0e44('0x49')](_0x1cacb8[_0x0e44('0x4a')],{})[_0x0e44('0x25')](function(_0x184040){var _0x29316a=_0x1cacb8[_0x0e44('0x4b')][_0x0e44('0x27')]({'plain':!![]});if(!_0x29316a)throw new Error(_0x0e44('0x4c'));if(_0x29316a[_0x0e44('0x4d')]===_0x0e44('0x4b')){var _0x4ebc5b=_0x184040[_0x0e44('0x27')]({'plain':!![]});var _0x3d336a='ODBC';return db[_0x0e44('0x4e')][_0x0e44('0x48')]({'where':{'name':_0x3d336a,'userProfileId':_0x29316a[_0x0e44('0x4f')]},'raw':!![]})[_0x0e44('0x25')](function(_0x27c452){if(_0x27c452&&_0x27c452['autoAssociation']===0x0){return db[_0x0e44('0x50')]['create']({'name':_0x4ebc5b[_0x0e44('0x2b')],'resourceId':_0x4ebc5b['id'],'type':_0x27c452[_0x0e44('0x2b')],'sectionId':_0x27c452['id']},{})[_0x0e44('0x25')](function(){return _0x184040;});}else{return _0x184040;}})[_0x0e44('0x43')](function(_0x44b1e1){logger[_0x0e44('0x29')](_0x0e44('0x51'),_0x44b1e1);throw _0x44b1e1;});}return _0x184040;})[_0x0e44('0x25')](respondWithResult(_0x4cff24,0xc9))[_0x0e44('0x43')](handleError(_0x4cff24,null));};exports[_0x0e44('0x24')]=function(_0x8d8e50,_0x45e2d3){if(_0x8d8e50[_0x0e44('0x4a')]['id']){delete _0x8d8e50[_0x0e44('0x4a')]['id'];}return db[_0x0e44('0x2e')][_0x0e44('0x48')]({'where':{'id':_0x8d8e50[_0x0e44('0x45')]['id']}})[_0x0e44('0x25')](handleEntityNotFound(_0x45e2d3,null))['then'](saveUpdates(_0x8d8e50[_0x0e44('0x4a')],null))[_0x0e44('0x25')](respondWithResult(_0x45e2d3,null))[_0x0e44('0x43')](handleError(_0x45e2d3,null));};exports[_0x0e44('0x26')]=function(_0x34e409,_0x2f2803){return db[_0x0e44('0x2e')][_0x0e44('0x48')]({'where':{'id':_0x34e409['params']['id']}})[_0x0e44('0x25')](handleEntityNotFound(_0x2f2803,null))[_0x0e44('0x25')](removeEntity(_0x2f2803,null))[_0x0e44('0x43')](handleError(_0x2f2803,null));};exports[_0x0e44('0x52')]=function(_0x751901,_0x161a67,_0x20e0f3){var _0x3f171a;return db[_0x0e44('0x2e')]['find']({'where':{'id':_0x751901[_0x0e44('0x45')]['id']},'attributes':['id',_0x0e44('0x53')]})[_0x0e44('0x25')](handleEntityNotFound(_0x161a67,null))['then'](function(_0x4dba12){if(_0x4dba12){var _0x3abba2=require('odbc')();_0x3abba2['openSync'](_0x4dba12[_0x0e44('0x53')]);_0x3abba2['closeSync']();return _0x4dba12;}})[_0x0e44('0x25')](respondWithResult(_0x161a67,null))[_0x0e44('0x43')](handleError(_0x161a67,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 536cefa..5d22943 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 _0xd825=['path','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc','lodash','util','api','moment','request-promise'];(function(_0x1815e6,_0x128ca6){var _0x46a2c5=function(_0x409daf){while(--_0x409daf){_0x1815e6['push'](_0x1815e6['shift']());}};_0x46a2c5(++_0x128ca6);}(_0xd825,0x7f));var _0x5d82=function(_0x280e1b,_0x46c4a8){_0x280e1b=_0x280e1b-0x0;var _0x2224c6=_0xd825[_0x280e1b];return _0x2224c6;};'use strict';var _=require(_0x5d82('0x0'));var util=require(_0x5d82('0x1'));var logger=require('../../config/logger')(_0x5d82('0x2'));var moment=require(_0x5d82('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d82('0x4'));var fs=require('fs');var path=require(_0x5d82('0x5'));var rimraf=require(_0x5d82('0x6'));var config=require(_0x5d82('0x7'));var attributes=require(_0x5d82('0x8'));module['exports']=function(_0x119ec4,_0x3f6f1c){return _0x119ec4['define'](_0x5d82('0x9'),attributes,{'tableName':_0x5d82('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b4d=['../../config/logger','api','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util'];(function(_0x1c1c83,_0x39f701){var _0x3a2650=function(_0xf17943){while(--_0xf17943){_0x1c1c83['push'](_0x1c1c83['shift']());}};_0x3a2650(++_0x39f701);}(_0x2b4d,0xfa));var _0xd2b4=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x2b4d[_0xc55d64];return _0x4194f6;};'use strict';var _=require(_0xd2b4('0x0'));var util=require(_0xd2b4('0x1'));var logger=require(_0xd2b4('0x2'))(_0xd2b4('0x3'));var moment=require('moment');var BPromise=require(_0xd2b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd2b4('0x5'));var config=require(_0xd2b4('0x6'));var attributes=require(_0xd2b4('0x7'));module[_0xd2b4('0x8')]=function(_0x2fa564,_0x504a7f){return _0x2fa564[_0xd2b4('0x9')](_0xd2b4('0xa'),attributes,{'tableName':_0xd2b4('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 6932412..a4d3f9b 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 _0x549c=['jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareOdbc','options','raw','where','include','model','attributes','map','then','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ffcfb,_0x55ead9){var _0x2eacf1=function(_0x159b6d){while(--_0x159b6d){_0x4ffcfb['push'](_0x4ffcfb['shift']());}};_0x2eacf1(++_0x55ead9);}(_0x549c,0x7a));var _0xc549=function(_0x3f706c,_0x1a5d98){_0x3f706c=_0x3f706c-0x0;var _0x488f6f=_0x549c[_0x3f706c];return _0x488f6f;};'use strict';var _=require(_0xc549('0x0'));var util=require(_0xc549('0x1'));var moment=require(_0xc549('0x2'));var BPromise=require(_0xc549('0x3'));var rs=require(_0xc549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc549('0x5'))['db'];var utils=require(_0xc549('0x6'));var logger=require(_0xc549('0x7'))(_0xc549('0x8'));var config=require(_0xc549('0x9'));var jayson=require(_0xc549('0xa'));var client=jayson[_0xc549('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249b03,_0x4536a3,_0x2404ee){return new BPromise(function(_0x333f76,_0x55dd7e){return client[_0xc549('0xc')](_0x249b03,_0x2404ee)['then'](function(_0x2645ff){logger[_0xc549('0xd')](_0xc549('0xe'),_0x4536a3,_0xc549('0xf'));logger[_0xc549('0x10')](_0xc549('0x11'),_0x4536a3,_0xc549('0xf'),JSON[_0xc549('0x12')](_0x2645ff));if(_0x2645ff[_0xc549('0x13')]){if(_0x2645ff[_0xc549('0x13')]['code']===0x1f4){logger[_0xc549('0x13')](_0xc549('0xe'),_0x4536a3,_0x2645ff[_0xc549('0x13')]['message']);return _0x55dd7e(_0x2645ff[_0xc549('0x13')][_0xc549('0x14')]);}logger['error'](_0xc549('0xe'),_0x4536a3,_0x2645ff[_0xc549('0x13')][_0xc549('0x14')]);return _0x333f76(_0x2645ff['error'][_0xc549('0x14')]);}else{logger[_0xc549('0xd')](_0xc549('0xe'),_0x4536a3,_0xc549('0xf'));_0x333f76(_0x2645ff[_0xc549('0x15')][_0xc549('0x14')]);}})[_0xc549('0x16')](function(_0x4aad4d){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x4536a3,_0x4aad4d);_0x55dd7e(_0x4aad4d);});});}exports['ShowSquareOdbc']=function(_0x16ded3){var _0x469584=this;return new Promise(function(_0x425add,_0x3ffea4){return db[_0xc549('0x17')]['find']({'raw':_0x16ded3[_0xc549('0x18')]?_0x16ded3['options'][_0xc549('0x19')]===undefined?!![]:![]:!![],'where':_0x16ded3[_0xc549('0x18')]?_0x16ded3[_0xc549('0x18')][_0xc549('0x1a')]||null:null,'attributes':_0x16ded3[_0xc549('0x18')]?_0x16ded3[_0xc549('0x18')]['attributes']||null:null,'include':_0x16ded3[_0xc549('0x18')]?_0x16ded3[_0xc549('0x18')]['include']?_['map'](_0x16ded3[_0xc549('0x18')][_0xc549('0x1b')],function(_0x4e4a33){return{'model':db[_0x4e4a33[_0xc549('0x1c')]],'as':_0x4e4a33['as'],'attributes':_0x4e4a33[_0xc549('0x1d')],'include':_0x4e4a33[_0xc549('0x1b')]?_[_0xc549('0x1e')](_0x4e4a33[_0xc549('0x1b')],function(_0x5afd92){return{'model':db[_0x5afd92['model']],'as':_0x5afd92['as'],'attributes':_0x5afd92[_0xc549('0x1d')],'include':_0x5afd92['include']?_['map'](_0x5afd92[_0xc549('0x1b')],function(_0x411a88){return{'model':db[_0x411a88['model']],'as':_0x411a88['as'],'attributes':_0x411a88['attributes']};}):[]};}):[]};}):[]:[]})[_0xc549('0x1f')](function(_0x293d50){logger[_0xc549('0xd')]('ShowSquareOdbc',_0x16ded3);logger[_0xc549('0x10')](_0xc549('0x20'),_0x16ded3,JSON['stringify'](_0x293d50));_0x425add(_0x293d50);})[_0xc549('0x16')](function(_0x2e6563){logger[_0xc549('0x13')](_0xc549('0x20'),_0x2e6563[_0xc549('0x14')],_0x16ded3);_0x3ffea4(_0x469584[_0xc549('0x13')](0x1f4,_0x2e6563['message']));});});}; \ No newline at end of file +var _0xe7c3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw','where','include','model','attributes','map','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0xe7c3,0xd8));var _0x3e7c=function(_0x55081c,_0x2ca7d6){_0x55081c=_0x55081c-0x0;var _0xe122a4=_0xe7c3[_0x55081c];return _0xe122a4;};'use strict';var _=require(_0x3e7c('0x0'));var util=require(_0x3e7c('0x1'));var moment=require(_0x3e7c('0x2'));var BPromise=require(_0x3e7c('0x3'));var rs=require(_0x3e7c('0x4'));var fs=require('fs');var Redis=require(_0x3e7c('0x5'));var db=require(_0x3e7c('0x6'))['db'];var utils=require(_0x3e7c('0x7'));var logger=require(_0x3e7c('0x8'))(_0x3e7c('0x9'));var config=require(_0x3e7c('0xa'));var jayson=require(_0x3e7c('0xb'));var client=jayson[_0x3e7c('0xc')][_0x3e7c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4deef1,_0x3193dd,_0x1ac8ae){return new BPromise(function(_0xb2b79b,_0x1e8843){return client[_0x3e7c('0xe')](_0x4deef1,_0x1ac8ae)[_0x3e7c('0xf')](function(_0x12465c){logger[_0x3e7c('0x10')](_0x3e7c('0x11'),_0x3193dd,_0x3e7c('0x12'));logger[_0x3e7c('0x13')](_0x3e7c('0x14'),_0x3193dd,'request\x20sent',JSON[_0x3e7c('0x15')](_0x12465c));if(_0x12465c['error']){if(_0x12465c[_0x3e7c('0x16')][_0x3e7c('0x17')]===0x1f4){logger[_0x3e7c('0x16')](_0x3e7c('0x11'),_0x3193dd,_0x12465c[_0x3e7c('0x16')][_0x3e7c('0x18')]);return _0x1e8843(_0x12465c[_0x3e7c('0x16')][_0x3e7c('0x18')]);}logger[_0x3e7c('0x16')](_0x3e7c('0x11'),_0x3193dd,_0x12465c[_0x3e7c('0x16')][_0x3e7c('0x18')]);return _0xb2b79b(_0x12465c[_0x3e7c('0x16')]['message']);}else{logger[_0x3e7c('0x10')](_0x3e7c('0x11'),_0x3193dd,_0x3e7c('0x12'));_0xb2b79b(_0x12465c[_0x3e7c('0x19')][_0x3e7c('0x18')]);}})[_0x3e7c('0x1a')](function(_0x4d27f6){logger['error'](_0x3e7c('0x11'),_0x3193dd,_0x4d27f6);_0x1e8843(_0x4d27f6);});});}exports['ShowSquareOdbc']=function(_0x5bef3d){var _0x3e4ca2=this;return new Promise(function(_0x2337c4,_0x2b5c4e){return db[_0x3e7c('0x1b')][_0x3e7c('0x1c')]({'raw':_0x5bef3d['options']?_0x5bef3d[_0x3e7c('0x1d')][_0x3e7c('0x1e')]===undefined?!![]:![]:!![],'where':_0x5bef3d[_0x3e7c('0x1d')]?_0x5bef3d[_0x3e7c('0x1d')][_0x3e7c('0x1f')]||null:null,'attributes':_0x5bef3d[_0x3e7c('0x1d')]?_0x5bef3d[_0x3e7c('0x1d')]['attributes']||null:null,'include':_0x5bef3d['options']?_0x5bef3d[_0x3e7c('0x1d')][_0x3e7c('0x20')]?_['map'](_0x5bef3d[_0x3e7c('0x1d')][_0x3e7c('0x20')],function(_0xe295e3){return{'model':db[_0xe295e3[_0x3e7c('0x21')]],'as':_0xe295e3['as'],'attributes':_0xe295e3[_0x3e7c('0x22')],'include':_0xe295e3[_0x3e7c('0x20')]?_[_0x3e7c('0x23')](_0xe295e3['include'],function(_0x4d15af){return{'model':db[_0x4d15af[_0x3e7c('0x21')]],'as':_0x4d15af['as'],'attributes':_0x4d15af[_0x3e7c('0x22')],'include':_0x4d15af[_0x3e7c('0x20')]?_[_0x3e7c('0x23')](_0x4d15af[_0x3e7c('0x20')],function(_0x75a90){return{'model':db[_0x75a90[_0x3e7c('0x21')]],'as':_0x75a90['as'],'attributes':_0x75a90[_0x3e7c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3e7c('0xf')](function(_0xc025dd){logger['info'](_0x3e7c('0x24'),_0x5bef3d);logger['debug']('ShowSquareOdbc',_0x5bef3d,JSON[_0x3e7c('0x15')](_0xc025dd));_0x2337c4(_0xc025dd);})[_0x3e7c('0x1a')](function(_0x6846ab){logger[_0x3e7c('0x16')](_0x3e7c('0x24'),_0x6846ab[_0x3e7c('0x18')],_0x5bef3d);_0x2b5c4e(_0x3e4ca2[_0x3e7c('0x16')](0x1f4,_0x6846ab[_0x3e7c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c00b86b..dbce61e 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 _0x0827=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0827,0x18d));var _0x7082=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x0827[_0x2d3ab3];return _0x321f9e;};'use strict';var multer=require(_0x7082('0x0'));var util=require(_0x7082('0x1'));var path=require(_0x7082('0x2'));var timeout=require(_0x7082('0x3'));var express=require(_0x7082('0x4'));var router=express[_0x7082('0x5')]();var fs_extra=require(_0x7082('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7082('0x7'));var controller=require(_0x7082('0x8'));router[_0x7082('0x9')]('/',auth[_0x7082('0xa')](),controller[_0x7082('0xb')]);router[_0x7082('0x9')](_0x7082('0xc'),auth[_0x7082('0xa')](),controller['show']);router[_0x7082('0xd')]('/',auth['isAuthenticated'](),controller[_0x7082('0xe')]);router[_0x7082('0xf')](_0x7082('0xc'),auth[_0x7082('0xa')](),controller[_0x7082('0x10')]);router['delete'](_0x7082('0xc'),auth[_0x7082('0xa')](),controller[_0x7082('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbad1=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','./squareProject.controller','get','index'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0xbad1,0x88));var _0x1bad=function(_0x8aba54,_0x4dbeb1){_0x8aba54=_0x8aba54-0x0;var _0x3db7be=_0xbad1[_0x8aba54];return _0x3db7be;};'use strict';var multer=require(_0x1bad('0x0'));var util=require(_0x1bad('0x1'));var path=require('path');var timeout=require(_0x1bad('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1bad('0x3'));var auth=require(_0x1bad('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bad('0x5'));router[_0x1bad('0x6')]('/',auth['isAuthenticated'](),controller[_0x1bad('0x7')]);router[_0x1bad('0x6')](_0x1bad('0x8'),auth[_0x1bad('0x9')](),controller[_0x1bad('0xa')]);router[_0x1bad('0xb')]('/',auth[_0x1bad('0x9')](),controller[_0x1bad('0xc')]);router[_0x1bad('0xd')](_0x1bad('0x8'),auth[_0x1bad('0x9')](),controller[_0x1bad('0xe')]);router[_0x1bad('0xf')](_0x1bad('0x8'),auth[_0x1bad('0x9')](),controller[_0x1bad('0x10')]);module[_0x1bad('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 6df14c2..6a79381 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 _0x8a60=['utf8','DATE','sequelize','exports','STRING','TEXT','BLOB','getDataValue','preproduction','long','production','toString'];(function(_0x5f07ce,_0x45a329){var _0x3ed915=function(_0xf69642){while(--_0xf69642){_0x5f07ce['push'](_0x5f07ce['shift']());}};_0x3ed915(++_0x45a329);}(_0x8a60,0x10a));var _0x08a6=function(_0x347999,_0x315e31){_0x347999=_0x347999-0x0;var _0x48aec3=_0x8a60[_0x347999];return _0x48aec3;};'use strict';var Sequelize=require(_0x08a6('0x0'));module[_0x08a6('0x1')]={'name':{'type':Sequelize[_0x08a6('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x08a6('0x2')]},'notes':{'type':Sequelize[_0x08a6('0x3')]},'preproduction':{'type':Sequelize[_0x08a6('0x4')]('long'),'get':function(){if(this[_0x08a6('0x5')]('preproduction')){return this['getDataValue'](_0x08a6('0x6'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x08a6('0x4')](_0x08a6('0x7')),'get':function(){if(this[_0x08a6('0x5')](_0x08a6('0x8'))){return this[_0x08a6('0x5')]('production')[_0x08a6('0x9')](_0x08a6('0xa'));}}},'savedAt':{'type':Sequelize[_0x08a6('0xb')]},'publishedAt':{'type':Sequelize[_0x08a6('0xb')]}}; \ No newline at end of file +var _0x4796=['production','DATE','sequelize','exports','STRING','BLOB','long','preproduction','toString','utf8','getDataValue'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x4796,0x70));var _0x6479=function(_0x4c610b,_0x119651){_0x4c610b=_0x4c610b-0x0;var _0x4e1159=_0x4796[_0x4c610b];return _0x4e1159;};'use strict';var Sequelize=require(_0x6479('0x0'));module[_0x6479('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6479('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x6479('0x3')](_0x6479('0x4')),'get':function(){if(this['getDataValue'](_0x6479('0x5'))){return this['getDataValue'](_0x6479('0x5'))[_0x6479('0x6')](_0x6479('0x7'));}}},'production':{'type':Sequelize[_0x6479('0x3')](_0x6479('0x4')),'get':function(){if(this['getDataValue']('production')){return this[_0x6479('0x8')](_0x6479('0x9'))[_0x6479('0x6')](_0x6479('0x7'));}}},'savedAt':{'type':Sequelize[_0x6479('0xa')]},'publishedAt':{'type':Sequelize[_0x6479('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 879a815..68fe959 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 _0x6eed=['send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','create','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','production','params','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','error','stack','name'];(function(_0x19f6ac,_0x508c58){var _0xcac7da=function(_0x3f597b){while(--_0x3f597b){_0x19f6ac['push'](_0x19f6ac['shift']());}};_0xcac7da(++_0x508c58);}(_0x6eed,0xaf));var _0xd6ee=function(_0xe82c4e,_0x1f19da){_0xe82c4e=_0xe82c4e-0x0;var _0x3b1bac=_0x6eed[_0xe82c4e];return _0x3b1bac;};'use strict';var _=require(_0xd6ee('0x0'));var Redis=require(_0xd6ee('0x1'));var qs=require(_0xd6ee('0x2'));var logger=require(_0xd6ee('0x3'))(_0xd6ee('0x4'));var config=require('../../config/environment');var db=require(_0xd6ee('0x5'))['db'];config[_0xd6ee('0x6')]=_[_0xd6ee('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd6ee('0x8'))(new Redis(config[_0xd6ee('0x6')]));require(_0xd6ee('0x9'))[_0xd6ee('0xa')](socket);function respondWithResult(_0x41f54b,_0x54568d){_0x54568d=_0x54568d||0xc8;return function(_0x39225f){if(_0x39225f){return _0x41f54b[_0xd6ee('0xb')](_0x54568d)[_0xd6ee('0xc')](_0x39225f);}};}function respondWithFilteredResult(_0x59893a,_0x1760fa){return function(_0x36be2d){if(_0x36be2d){var _0x48a62d=typeof _0x1760fa['offset']===_0xd6ee('0xd')&&typeof _0x1760fa[_0xd6ee('0xe')]===_0xd6ee('0xd');var _0x5db440=_0x36be2d[_0xd6ee('0xf')];var _0x52fee7=_0x48a62d?0x0:_0x1760fa[_0xd6ee('0x10')];var _0x5d4ed6=_0x48a62d?_0x36be2d[_0xd6ee('0xf')]:_0x1760fa[_0xd6ee('0x10')]+_0x1760fa[_0xd6ee('0xe')];var _0x392f9d;if(_0x5d4ed6>=_0x5db440){_0x5d4ed6=_0x5db440;_0x392f9d=0xc8;}else{_0x392f9d=0xce;}_0x59893a[_0xd6ee('0xb')](_0x392f9d);return _0x59893a[_0xd6ee('0x11')](_0xd6ee('0x12'),_0x52fee7+'-'+_0x5d4ed6+'/'+_0x5db440)[_0xd6ee('0xc')](_0x36be2d);}return null;};}function saveUpdates(_0x24ecaf){return function(_0x2d4513){if(_0x2d4513){return _0x2d4513[_0xd6ee('0x13')](_0x24ecaf)[_0xd6ee('0x14')](function(_0x45074d){return _0x45074d;});}return null;};}function removeEntity(_0x1f707a){return function(_0x3d04e5){if(_0x3d04e5){return _0x3d04e5[_0xd6ee('0x15')]()[_0xd6ee('0x14')](function(){var _0x4d30d3=_0x3d04e5[_0xd6ee('0x16')]({'plain':!![]});var _0x407116=_0xd6ee('0x17');return db[_0xd6ee('0x18')][_0xd6ee('0x15')]({'where':{'type':_0x407116,'resourceId':_0x4d30d3['id']}})['then'](function(){return _0x3d04e5;});})[_0xd6ee('0x14')](function(){var _0x175ff0=new Redis(config['redis']);_0x175ff0[_0xd6ee('0x19')](_0xd6ee('0x1a'),JSON[_0xd6ee('0x1b')]({'id':_0x3d04e5['id'],'deleted':!![]}));})[_0xd6ee('0x14')](function(){_0x1f707a[_0xd6ee('0xb')](0xcc)[_0xd6ee('0x1c')]();});}};}function handleEntityNotFound(_0x304caa){return function(_0x44ac60){if(!_0x44ac60){_0x304caa['sendStatus'](0x194);}return _0x44ac60;};}function handleError(_0x481244,_0x2ce3fb){_0x2ce3fb=_0x2ce3fb||0x1f4;return function(_0x3342bc){logger[_0xd6ee('0x1d')](_0x3342bc[_0xd6ee('0x1e')]);if(_0x3342bc[_0xd6ee('0x1f')]){delete _0x3342bc[_0xd6ee('0x1f')];}_0x481244[_0xd6ee('0xb')](_0x2ce3fb)[_0xd6ee('0x20')](_0x3342bc);};}exports['index']=function(_0x34ec3c,_0x1c961c){var _0x110272={},_0x31a223={},_0x1a5eb6={'count':0x0,'rows':[]};var _0x470d10=_[_0xd6ee('0x21')](db[_0xd6ee('0x22')][_0xd6ee('0x23')],function(_0x2cb23d){return{'name':_0x2cb23d[_0xd6ee('0x24')],'type':_0x2cb23d[_0xd6ee('0x25')][_0xd6ee('0x26')]};});_0x31a223[_0xd6ee('0x27')]=_[_0xd6ee('0x21')](_0x470d10,_0xd6ee('0x1f'));_0x31a223[_0xd6ee('0x28')]=_['keys'](_0x34ec3c[_0xd6ee('0x28')]);_0x31a223[_0xd6ee('0x29')]=_[_0xd6ee('0x2a')](_0x31a223[_0xd6ee('0x27')],_0x31a223[_0xd6ee('0x28')]);_0x110272[_0xd6ee('0x2b')]=_[_0xd6ee('0x2a')](_0x31a223[_0xd6ee('0x27')],qs[_0xd6ee('0x2c')](_0x34ec3c['query'][_0xd6ee('0x2c')]));_0x110272['attributes']=_0x110272[_0xd6ee('0x2b')][_0xd6ee('0x2d')]?_0x110272[_0xd6ee('0x2b')]:_0x31a223[_0xd6ee('0x27')];if(!_0x34ec3c['query']['hasOwnProperty'](_0xd6ee('0x2e'))){_0x110272['limit']=qs[_0xd6ee('0xe')](_0x34ec3c[_0xd6ee('0x28')][_0xd6ee('0xe')]);_0x110272[_0xd6ee('0x10')]=qs[_0xd6ee('0x10')](_0x34ec3c['query'][_0xd6ee('0x10')]);}_0x110272['order']=qs[_0xd6ee('0x2f')](_0x34ec3c[_0xd6ee('0x28')][_0xd6ee('0x2f')]);_0x110272[_0xd6ee('0x30')]=qs['filters'](_[_0xd6ee('0x31')](_0x34ec3c[_0xd6ee('0x28')],_0x31a223[_0xd6ee('0x29')]),_0x470d10);if(_0x34ec3c[_0xd6ee('0x28')][_0xd6ee('0x32')]){_0x110272[_0xd6ee('0x30')]=_[_0xd6ee('0x33')](_0x110272[_0xd6ee('0x30')],{'$or':_[_0xd6ee('0x21')](_0x470d10,function(_0xc8741a){if(_0xc8741a[_0xd6ee('0x25')]!==_0xd6ee('0x34')){var _0x56519a={};_0x56519a[_0xc8741a[_0xd6ee('0x1f')]]={'$like':'%'+_0x34ec3c['query'][_0xd6ee('0x32')]+'%'};return _0x56519a;}})});}_0x110272=_[_0xd6ee('0x33')]({},_0x110272,_0x34ec3c[_0xd6ee('0x35')]);var _0x269b43={'where':_0x110272[_0xd6ee('0x30')]};return db[_0xd6ee('0x22')]['count'](_0x269b43)['then'](function(_0x80b10f){_0x1a5eb6[_0xd6ee('0xf')]=_0x80b10f;if(_0x34ec3c['query'][_0xd6ee('0x36')]){_0x110272[_0xd6ee('0x37')]=[{'all':!![]}];}return db['SquareProject'][_0xd6ee('0x38')](_0x110272);})['then'](function(_0x25c924){_0x1a5eb6[_0xd6ee('0x39')]=_0x25c924;return _0x1a5eb6;})[_0xd6ee('0x14')](respondWithFilteredResult(_0x1c961c,_0x110272))['catch'](handleError(_0x1c961c,null));};exports[_0xd6ee('0x3a')]=function(_0x4e87f6,_0x3f7bd1){var _0x5dff81={'raw':![],'where':{'id':_0x4e87f6['params']['id']}},_0x11b47e={};_0x11b47e[_0xd6ee('0x27')]=_[_0xd6ee('0x3b')](db[_0xd6ee('0x22')][_0xd6ee('0x23')]);_0x11b47e[_0xd6ee('0x28')]=_[_0xd6ee('0x3b')](_0x4e87f6[_0xd6ee('0x28')]);_0x11b47e[_0xd6ee('0x29')]=_['intersection'](_0x11b47e['model'],_0x11b47e[_0xd6ee('0x28')]);_0x5dff81[_0xd6ee('0x2b')]=_[_0xd6ee('0x2a')](_0x11b47e[_0xd6ee('0x27')],qs[_0xd6ee('0x2c')](_0x4e87f6[_0xd6ee('0x28')][_0xd6ee('0x2c')]));_0x5dff81[_0xd6ee('0x2b')]=_0x5dff81[_0xd6ee('0x2b')][_0xd6ee('0x2d')]?_0x5dff81[_0xd6ee('0x2b')]:_0x11b47e['model'];if(_0x4e87f6['query'][_0xd6ee('0x36')]){_0x5dff81['include']=[{'all':!![]}];}_0x5dff81=_['merge']({},_0x5dff81,_0x4e87f6[_0xd6ee('0x35')]);return db[_0xd6ee('0x22')][_0xd6ee('0x3c')](_0x5dff81)[_0xd6ee('0x14')](handleEntityNotFound(_0x3f7bd1,null))[_0xd6ee('0x14')](respondWithResult(_0x3f7bd1,null))[_0xd6ee('0x3d')](handleError(_0x3f7bd1,null));};exports[_0xd6ee('0x3e')]=function(_0x4fa521,_0x72c2a1){return db[_0xd6ee('0x22')][_0xd6ee('0x3e')](_0x4fa521['body'],{})[_0xd6ee('0x14')](function(_0x204a88){var _0x315547=_0x4fa521['user'][_0xd6ee('0x16')]({'plain':!![]});if(!_0x315547)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x315547['role']===_0xd6ee('0x3f')){var _0xa47cd3=_0x204a88['get']({'plain':!![]});var _0x1cf094=_0xd6ee('0x17');return db[_0xd6ee('0x40')][_0xd6ee('0x3c')]({'where':{'name':_0x1cf094,'userProfileId':_0x315547['userProfileId']},'raw':!![]})[_0xd6ee('0x14')](function(_0x815a2){if(_0x815a2&&_0x815a2['autoAssociation']===0x0){return db[_0xd6ee('0x18')][_0xd6ee('0x3e')]({'name':_0xa47cd3[_0xd6ee('0x1f')],'resourceId':_0xa47cd3['id'],'type':_0x815a2[_0xd6ee('0x1f')],'sectionId':_0x815a2['id']},{})['then'](function(){return _0x204a88;});}else{return _0x204a88;}})[_0xd6ee('0x3d')](function(_0x3e6544){logger['error'](_0xd6ee('0x41'),_0x3e6544);throw _0x3e6544;});}return _0x204a88;})[_0xd6ee('0x14')](respondWithResult(_0x72c2a1,0xc9))['catch'](handleError(_0x72c2a1,null));};exports[_0xd6ee('0x13')]=function(_0x18b46e,_0x70f752){if(_0x18b46e[_0xd6ee('0x42')]['id']){delete _0x18b46e['body']['id'];}return db['SquareProject'][_0xd6ee('0x3c')]({'where':{'id':_0x18b46e['params']['id']}})[_0xd6ee('0x14')](handleEntityNotFound(_0x70f752,null))[_0xd6ee('0x14')](saveUpdates(_0x18b46e[_0xd6ee('0x42')],null))['then'](function(_0x357afc){if(!_0x357afc)return;var _0x37acfe=_0x357afc[_0xd6ee('0x16')]({'plain':!![]});return _0x37acfe;})[_0xd6ee('0x14')](function(_0x2beb9a){var _0x24497d=new Redis(config[_0xd6ee('0x6')]);_0x24497d[_0xd6ee('0x19')](_0xd6ee('0x1a'),JSON[_0xd6ee('0x1b')](_[_0xd6ee('0x31')](_0x2beb9a,['id',_0xd6ee('0x1f'),_0xd6ee('0x43')])));return _0x2beb9a;})[_0xd6ee('0x14')](respondWithResult(_0x70f752,null))[_0xd6ee('0x3d')](handleError(_0x70f752,null));};exports[_0xd6ee('0x15')]=function(_0xd70115,_0x185a6f){return db[_0xd6ee('0x22')]['find']({'where':{'id':_0xd70115[_0xd6ee('0x44')]['id']}})[_0xd6ee('0x14')](handleEntityNotFound(_0x185a6f,null))['then'](removeEntity(_0x185a6f,null))['catch'](handleError(_0x185a6f,null));}; \ No newline at end of file +var _0xd5ce=['role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','production','params','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','json','undefined','offset','count','limit','status','set','Content-Range','then','destroy','get','SquareProjects','publish','end','sendStatus','stack','name','map','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SquareProject','includeAll','include','findAll','rows','catch','rawAttributes','fields','length','find','create','body','user'];(function(_0x57aab0,_0x2432c3){var _0x2e2acb=function(_0x40f294){while(--_0x40f294){_0x57aab0['push'](_0x57aab0['shift']());}};_0x2e2acb(++_0x2432c3);}(_0xd5ce,0xd8));var _0xed5c=function(_0x18b477,_0x555d04){_0x18b477=_0x18b477-0x0;var _0x240b92=_0xd5ce[_0x18b477];return _0x240b92;};'use strict';var _=require(_0xed5c('0x0'));var Redis=require(_0xed5c('0x1'));var qs=require(_0xed5c('0x2'));var logger=require(_0xed5c('0x3'))(_0xed5c('0x4'));var config=require(_0xed5c('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xed5c('0x6')](config[_0xed5c('0x7')],{'host':_0xed5c('0x8'),'port':0x18eb});var socket=require(_0xed5c('0x9'))(new Redis(config[_0xed5c('0x7')]));require(_0xed5c('0xa'))[_0xed5c('0xb')](socket);function respondWithResult(_0x25cee6,_0x27c76c){_0x27c76c=_0x27c76c||0xc8;return function(_0x3ce7ea){if(_0x3ce7ea){return _0x25cee6['status'](_0x27c76c)[_0xed5c('0xc')](_0x3ce7ea);}};}function respondWithFilteredResult(_0x28e8d2,_0x2b99ee){return function(_0x236847){if(_0x236847){var _0x42debf=typeof _0x2b99ee['offset']===_0xed5c('0xd')&&typeof _0x2b99ee['limit']===_0xed5c('0xd');var _0x59684a=_0x236847['count'];var _0x286660=_0x42debf?0x0:_0x2b99ee[_0xed5c('0xe')];var _0x172203=_0x42debf?_0x236847[_0xed5c('0xf')]:_0x2b99ee[_0xed5c('0xe')]+_0x2b99ee[_0xed5c('0x10')];var _0x2deaae;if(_0x172203>=_0x59684a){_0x172203=_0x59684a;_0x2deaae=0xc8;}else{_0x2deaae=0xce;}_0x28e8d2[_0xed5c('0x11')](_0x2deaae);return _0x28e8d2[_0xed5c('0x12')](_0xed5c('0x13'),_0x286660+'-'+_0x172203+'/'+_0x59684a)[_0xed5c('0xc')](_0x236847);}return null;};}function saveUpdates(_0xad4c13){return function(_0x107273){if(_0x107273){return _0x107273['update'](_0xad4c13)[_0xed5c('0x14')](function(_0x3efac0){return _0x3efac0;});}return null;};}function removeEntity(_0x31254d){return function(_0x42670b){if(_0x42670b){return _0x42670b[_0xed5c('0x15')]()['then'](function(){var _0x3d1660=_0x42670b[_0xed5c('0x16')]({'plain':!![]});var _0xe055c4=_0xed5c('0x17');return db['UserProfileResource'][_0xed5c('0x15')]({'where':{'type':_0xe055c4,'resourceId':_0x3d1660['id']}})[_0xed5c('0x14')](function(){return _0x42670b;});})[_0xed5c('0x14')](function(){var _0x256301=new Redis(config[_0xed5c('0x7')]);_0x256301[_0xed5c('0x18')]('agi',JSON['stringify']({'id':_0x42670b['id'],'deleted':!![]}));})['then'](function(){_0x31254d[_0xed5c('0x11')](0xcc)[_0xed5c('0x19')]();});}};}function handleEntityNotFound(_0x12045c){return function(_0x1cda47){if(!_0x1cda47){_0x12045c[_0xed5c('0x1a')](0x194);}return _0x1cda47;};}function handleError(_0x2fe293,_0x27c8e8){_0x27c8e8=_0x27c8e8||0x1f4;return function(_0x1e6f7b){logger['error'](_0x1e6f7b[_0xed5c('0x1b')]);if(_0x1e6f7b[_0xed5c('0x1c')]){delete _0x1e6f7b[_0xed5c('0x1c')];}_0x2fe293[_0xed5c('0x11')](_0x27c8e8)['send'](_0x1e6f7b);};}exports['index']=function(_0x492a95,_0x1769fc){var _0x207eb9={},_0x4e6ec5={},_0x4dea1b={'count':0x0,'rows':[]};var _0x501b10=_[_0xed5c('0x1d')](db['SquareProject']['rawAttributes'],function(_0x12b8f3){return{'name':_0x12b8f3['fieldName'],'type':_0x12b8f3[_0xed5c('0x1e')][_0xed5c('0x1f')]};});_0x4e6ec5[_0xed5c('0x20')]=_['map'](_0x501b10,_0xed5c('0x1c'));_0x4e6ec5[_0xed5c('0x21')]=_[_0xed5c('0x22')](_0x492a95['query']);_0x4e6ec5[_0xed5c('0x23')]=_[_0xed5c('0x24')](_0x4e6ec5[_0xed5c('0x20')],_0x4e6ec5[_0xed5c('0x21')]);_0x207eb9[_0xed5c('0x25')]=_['intersection'](_0x4e6ec5[_0xed5c('0x20')],qs['fields'](_0x492a95[_0xed5c('0x21')]['fields']));_0x207eb9[_0xed5c('0x25')]=_0x207eb9[_0xed5c('0x25')]['length']?_0x207eb9[_0xed5c('0x25')]:_0x4e6ec5['model'];if(!_0x492a95[_0xed5c('0x21')][_0xed5c('0x26')](_0xed5c('0x27'))){_0x207eb9[_0xed5c('0x10')]=qs[_0xed5c('0x10')](_0x492a95['query']['limit']);_0x207eb9['offset']=qs[_0xed5c('0xe')](_0x492a95[_0xed5c('0x21')][_0xed5c('0xe')]);}_0x207eb9[_0xed5c('0x28')]=qs[_0xed5c('0x29')](_0x492a95[_0xed5c('0x21')]['sort']);_0x207eb9[_0xed5c('0x2a')]=qs['filters'](_['pick'](_0x492a95[_0xed5c('0x21')],_0x4e6ec5[_0xed5c('0x23')]),_0x501b10);if(_0x492a95[_0xed5c('0x21')][_0xed5c('0x2b')]){_0x207eb9[_0xed5c('0x2a')]=_[_0xed5c('0x2c')](_0x207eb9[_0xed5c('0x2a')],{'$or':_[_0xed5c('0x1d')](_0x501b10,function(_0x2a18fd){if(_0x2a18fd[_0xed5c('0x1e')]!==_0xed5c('0x2d')){var _0x2cd90b={};_0x2cd90b[_0x2a18fd[_0xed5c('0x1c')]]={'$like':'%'+_0x492a95['query']['filter']+'%'};return _0x2cd90b;}})});}_0x207eb9=_['merge']({},_0x207eb9,_0x492a95[_0xed5c('0x2e')]);var _0xe8e550={'where':_0x207eb9[_0xed5c('0x2a')]};return db[_0xed5c('0x2f')][_0xed5c('0xf')](_0xe8e550)[_0xed5c('0x14')](function(_0x52b628){_0x4dea1b['count']=_0x52b628;if(_0x492a95['query'][_0xed5c('0x30')]){_0x207eb9[_0xed5c('0x31')]=[{'all':!![]}];}return db[_0xed5c('0x2f')][_0xed5c('0x32')](_0x207eb9);})['then'](function(_0x2f360a){_0x4dea1b[_0xed5c('0x33')]=_0x2f360a;return _0x4dea1b;})[_0xed5c('0x14')](respondWithFilteredResult(_0x1769fc,_0x207eb9))[_0xed5c('0x34')](handleError(_0x1769fc,null));};exports['show']=function(_0x32850c,_0x4d8d4a){var _0x10cbbc={'raw':![],'where':{'id':_0x32850c['params']['id']}},_0x447082={};_0x447082['model']=_[_0xed5c('0x22')](db[_0xed5c('0x2f')][_0xed5c('0x35')]);_0x447082['query']=_['keys'](_0x32850c[_0xed5c('0x21')]);_0x447082[_0xed5c('0x23')]=_[_0xed5c('0x24')](_0x447082[_0xed5c('0x20')],_0x447082['query']);_0x10cbbc['attributes']=_[_0xed5c('0x24')](_0x447082[_0xed5c('0x20')],qs['fields'](_0x32850c[_0xed5c('0x21')][_0xed5c('0x36')]));_0x10cbbc['attributes']=_0x10cbbc['attributes'][_0xed5c('0x37')]?_0x10cbbc[_0xed5c('0x25')]:_0x447082[_0xed5c('0x20')];if(_0x32850c[_0xed5c('0x21')][_0xed5c('0x30')]){_0x10cbbc[_0xed5c('0x31')]=[{'all':!![]}];}_0x10cbbc=_[_0xed5c('0x2c')]({},_0x10cbbc,_0x32850c[_0xed5c('0x2e')]);return db[_0xed5c('0x2f')][_0xed5c('0x38')](_0x10cbbc)[_0xed5c('0x14')](handleEntityNotFound(_0x4d8d4a,null))[_0xed5c('0x14')](respondWithResult(_0x4d8d4a,null))[_0xed5c('0x34')](handleError(_0x4d8d4a,null));};exports[_0xed5c('0x39')]=function(_0x21376f,_0x1011bd){return db[_0xed5c('0x2f')][_0xed5c('0x39')](_0x21376f[_0xed5c('0x3a')],{})[_0xed5c('0x14')](function(_0x34c9a2){var _0x574cab=_0x21376f[_0xed5c('0x3b')]['get']({'plain':!![]});if(!_0x574cab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x574cab[_0xed5c('0x3c')]===_0xed5c('0x3b')){var _0x215b9d=_0x34c9a2['get']({'plain':!![]});var _0x4d3b65='SquareProjects';return db[_0xed5c('0x3d')][_0xed5c('0x38')]({'where':{'name':_0x4d3b65,'userProfileId':_0x574cab[_0xed5c('0x3e')]},'raw':!![]})[_0xed5c('0x14')](function(_0x42c4f9){if(_0x42c4f9&&_0x42c4f9['autoAssociation']===0x0){return db[_0xed5c('0x3f')]['create']({'name':_0x215b9d['name'],'resourceId':_0x215b9d['id'],'type':_0x42c4f9[_0xed5c('0x1c')],'sectionId':_0x42c4f9['id']},{})['then'](function(){return _0x34c9a2;});}else{return _0x34c9a2;}})[_0xed5c('0x34')](function(_0x53899b){logger[_0xed5c('0x40')](_0xed5c('0x41'),_0x53899b);throw _0x53899b;});}return _0x34c9a2;})['then'](respondWithResult(_0x1011bd,0xc9))[_0xed5c('0x34')](handleError(_0x1011bd,null));};exports['update']=function(_0x3e9d3f,_0x4fd627){if(_0x3e9d3f['body']['id']){delete _0x3e9d3f['body']['id'];}return db[_0xed5c('0x2f')]['find']({'where':{'id':_0x3e9d3f['params']['id']}})[_0xed5c('0x14')](handleEntityNotFound(_0x4fd627,null))['then'](saveUpdates(_0x3e9d3f[_0xed5c('0x3a')],null))['then'](function(_0x15b81d){if(!_0x15b81d)return;var _0x58adf6=_0x15b81d[_0xed5c('0x16')]({'plain':!![]});return _0x58adf6;})[_0xed5c('0x14')](function(_0x325c35){var _0xde6820=new Redis(config[_0xed5c('0x7')]);_0xde6820['publish'](_0xed5c('0x42'),JSON['stringify'](_['pick'](_0x325c35,['id',_0xed5c('0x1c'),_0xed5c('0x43')])));return _0x325c35;})[_0xed5c('0x14')](respondWithResult(_0x4fd627,null))[_0xed5c('0x34')](handleError(_0x4fd627,null));};exports['destroy']=function(_0x25e9d4,_0x1e0e35){return db['SquareProject']['find']({'where':{'id':_0x25e9d4[_0xed5c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e0e35,null))[_0xed5c('0x14')](removeEntity(_0x1e0e35,null))[_0xed5c('0x34')](handleError(_0x1e0e35,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 62f8d66..7d051bf 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 _0x57f5=['remove','emit','../../mysqldb','update'];(function(_0x1db998,_0x3c3f0c){var _0x56ca68=function(_0xf496d3){while(--_0xf496d3){_0x1db998['push'](_0x1db998['shift']());}};_0x56ca68(++_0x3c3f0c);}(_0x57f5,0x192));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x557f('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x557f('0x1'),'afterDestroy':_0x557f('0x2')};function emitEvent(_0xfc3ba1){return function(_0x5e91ab,_0x2299fc,_0x4cd973){SquareProjectEvents['emit'](_0xfc3ba1+':'+_0x5e91ab['id'],_0x5e91ab);SquareProjectEvents[_0x557f('0x3')](_0xfc3ba1,_0x5e91ab);_0x4cd973(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x8d2d=['setMaxListeners','hasOwnProperty','exports','../../mysqldb'];(function(_0x4cde41,_0x472b56){var _0x3cbc00=function(_0x5e9fd5){while(--_0x5e9fd5){_0x4cde41['push'](_0x4cde41['shift']());}};_0x3cbc00(++_0x472b56);}(_0x8d2d,0xff));var _0xd8d2=function(_0x2c8d2a,_0x160453){_0x2c8d2a=_0x2c8d2a-0x0;var _0x1dd4b4=_0x8d2d[_0x2c8d2a];return _0x1dd4b4;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xd8d2('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd8d2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3c36fb){return function(_0x2922b2,_0x47bf07,_0x23811d){SquareProjectEvents['emit'](_0x3c36fb+':'+_0x2922b2['id'],_0x2922b2);SquareProjectEvents['emit'](_0x3c36fb,_0x2922b2);_0x23811d(null);};}for(var e in events){if(events[_0xd8d2('0x2')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xd8d2('0x3')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 13782f1..bacb530 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 _0x438c=['rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','format','changed','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x438c,0x10a));var _0xc438=function(_0x2c48cf,_0xea8dc8){_0x2c48cf=_0x2c48cf-0x0;var _0x1347bb=_0x438c[_0x2c48cf];return _0x1347bb;};'use strict';var _=require('lodash');var util=require(_0xc438('0x0'));var logger=require(_0xc438('0x1'))(_0xc438('0x2'));var moment=require('moment');var BPromise=require(_0xc438('0x3'));var rp=require(_0xc438('0x4'));var fs=require('fs');var path=require(_0xc438('0x5'));var rimraf=require(_0xc438('0x6'));var config=require(_0xc438('0x7'));var attributes=require(_0xc438('0x8'));module[_0xc438('0x9')]=function(_0xfa6b80,_0x1463a6){return _0xfa6b80[_0xc438('0xa')](_0xc438('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xea16bd,_0x6fdc08,_0x1dfff2){if(_0xea16bd['changed']('preproduction')){_0xea16bd['savedAt']=moment()[_0xc438('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xea16bd[_0xc438('0xd')]('production')){_0xea16bd[_0xc438('0xe')]=moment()['format'](_0xc438('0xf'));}_0x1dfff2(null,_0xea16bd);}}});}; \ No newline at end of file +var _0x89f4=['request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','preproduction','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','format','lodash','../../config/logger','api','bluebird'];(function(_0x3bb9e3,_0x1fb1c4){var _0x381aa0=function(_0xb56b49){while(--_0xb56b49){_0x3bb9e3['push'](_0x3bb9e3['shift']());}};_0x381aa0(++_0x1fb1c4);}(_0x89f4,0x1ac));var _0x489f=function(_0x611ddc,_0x3dc8f1){_0x611ddc=_0x611ddc-0x0;var _0x270945=_0x89f4[_0x611ddc];return _0x270945;};'use strict';var _=require(_0x489f('0x0'));var util=require('util');var logger=require(_0x489f('0x1'))(_0x489f('0x2'));var moment=require('moment');var BPromise=require(_0x489f('0x3'));var rp=require(_0x489f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x489f('0x5'));var config=require(_0x489f('0x6'));var attributes=require(_0x489f('0x7'));module[_0x489f('0x8')]=function(_0x22225b,_0x23c365){return _0x22225b['define'](_0x489f('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3cd0b4,_0x1499fa,_0x1a1eec){if(_0x3cd0b4['changed'](_0x489f('0xa'))){_0x3cd0b4['savedAt']=moment()['format'](_0x489f('0xb'));}if(_0x3cd0b4[_0x489f('0xc')](_0x489f('0xd'))){_0x3cd0b4[_0x489f('0xe')]=moment()[_0x489f('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1a1eec(null,_0x3cd0b4);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index c9dc0d6..8460cdf 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 _0xed62=['lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','SquareProject','find','info','ShowSquareProject'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xed62,0xba));var _0x2ed6=function(_0x1ea388,_0x520560){_0x1ea388=_0x1ea388-0x0;var _0x3bc38d=_0xed62[_0x1ea388];return _0x3bc38d;};'use strict';var _=require(_0x2ed6('0x0'));var Redis=require(_0x2ed6('0x1'));var db=require(_0x2ed6('0x2'))['db'];var logger=require(_0x2ed6('0x3'))(_0x2ed6('0x4'));var config=require(_0x2ed6('0x5'));config[_0x2ed6('0x6')]=_[_0x2ed6('0x7')](config[_0x2ed6('0x6')],{'host':_0x2ed6('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ed6('0x6')]));require(_0x2ed6('0x9'))[_0x2ed6('0xa')](socket);exports[_0x2ed6('0xb')]=function(_0x2c1bf6){var _0x1468a4=this;return new Promise(function(_0x291fa6,_0x323857){return db['SquareProject'][_0x2ed6('0xc')]({'raw':_0x2c1bf6[_0x2ed6('0xd')]?_0x2c1bf6[_0x2ed6('0xd')][_0x2ed6('0xe')]===undefined?!![]:![]:!![],'where':_0x2c1bf6['options']?_0x2c1bf6[_0x2ed6('0xd')][_0x2ed6('0xf')]||null:null,'attributes':_0x2c1bf6['options']?_0x2c1bf6[_0x2ed6('0xd')][_0x2ed6('0x10')]||null:null,'limit':_0x2c1bf6[_0x2ed6('0xd')]?_0x2c1bf6[_0x2ed6('0xd')][_0x2ed6('0x11')]||null:null,'include':_0x2c1bf6[_0x2ed6('0xd')]?_0x2c1bf6[_0x2ed6('0xd')][_0x2ed6('0x12')]?_[_0x2ed6('0x13')](_0x2c1bf6[_0x2ed6('0xd')][_0x2ed6('0x12')],function(_0x2fe0ec){return{'model':db[_0x2fe0ec['model']],'as':_0x2fe0ec['as'],'attributes':_0x2fe0ec[_0x2ed6('0x10')],'include':_0x2fe0ec[_0x2ed6('0x12')]?_['map'](_0x2fe0ec[_0x2ed6('0x12')],function(_0x91a0cc){return{'model':db[_0x91a0cc[_0x2ed6('0x14')]],'as':_0x91a0cc['as'],'attributes':_0x91a0cc[_0x2ed6('0x10')],'include':_0x91a0cc[_0x2ed6('0x12')]?_[_0x2ed6('0x13')](_0x91a0cc[_0x2ed6('0x12')],function(_0x115f38){return{'model':db[_0x115f38[_0x2ed6('0x14')]],'as':_0x115f38['as'],'attributes':_0x115f38[_0x2ed6('0x10')]};}):[]};}):[]};}):[]:[]})[_0x2ed6('0x15')](function(_0x552744){logger['info'](_0x2ed6('0xb'),_0x2c1bf6);logger[_0x2ed6('0x16')](_0x2ed6('0xb'),_0x2c1bf6,JSON[_0x2ed6('0x17')](_0x552744));_0x291fa6(_0x552744);})[_0x2ed6('0x18')](function(_0x8f9e3b){logger[_0x2ed6('0x19')]('GetSquareProjects',_0x8f9e3b[_0x2ed6('0x1a')],_0x2c1bf6);_0x323857(_0x1468a4[_0x2ed6('0x19')](0x1f4,_0x8f9e3b[_0x2ed6('0x1a')]));});});};exports['ShowSquareProject']=function(_0xd677b9){var _0x46a111=this;return new Promise(function(_0x54d93e,_0x384017){return db[_0x2ed6('0x1b')][_0x2ed6('0x1c')]({'raw':_0xd677b9['options']?_0xd677b9[_0x2ed6('0xd')][_0x2ed6('0xe')]===undefined?!![]:![]:!![],'where':_0xd677b9[_0x2ed6('0xd')]?_0xd677b9[_0x2ed6('0xd')][_0x2ed6('0xf')]||null:null,'attributes':_0xd677b9['options']?_0xd677b9[_0x2ed6('0xd')][_0x2ed6('0x10')]||null:null,'include':_0xd677b9[_0x2ed6('0xd')]?_0xd677b9[_0x2ed6('0xd')]['include']?_[_0x2ed6('0x13')](_0xd677b9[_0x2ed6('0xd')][_0x2ed6('0x12')],function(_0x3437e0){return{'model':db[_0x3437e0[_0x2ed6('0x14')]],'as':_0x3437e0['as'],'attributes':_0x3437e0[_0x2ed6('0x10')],'include':_0x3437e0[_0x2ed6('0x12')]?_[_0x2ed6('0x13')](_0x3437e0[_0x2ed6('0x12')],function(_0x5d833d){return{'model':db[_0x5d833d[_0x2ed6('0x14')]],'as':_0x5d833d['as'],'attributes':_0x5d833d['attributes'],'include':_0x5d833d[_0x2ed6('0x12')]?_[_0x2ed6('0x13')](_0x5d833d['include'],function(_0x597ed3){return{'model':db[_0x597ed3[_0x2ed6('0x14')]],'as':_0x597ed3['as'],'attributes':_0x597ed3[_0x2ed6('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e5b47){logger[_0x2ed6('0x1d')](_0x2ed6('0x1e'),_0xd677b9);logger[_0x2ed6('0x16')](_0x2ed6('0x1e'),_0xd677b9,JSON[_0x2ed6('0x17')](_0x5e5b47));_0x54d93e(_0x5e5b47);})['catch'](function(_0x21e702){logger[_0x2ed6('0x19')](_0x2ed6('0x1e'),_0x21e702[_0x2ed6('0x1a')],_0xd677b9);_0x384017(_0x46a111[_0x2ed6('0x19')](0x1f4,_0x21e702[_0x2ed6('0x1a')]));});});}; \ No newline at end of file +var _0xf61f=['info','debug','stringify','catch','error','message','ShowSquareProject','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0xd62e94,_0x1fcf16){var _0x2cdeb9=function(_0x147e5f){while(--_0x147e5f){_0xd62e94['push'](_0xd62e94['shift']());}};_0x2cdeb9(++_0x1fcf16);}(_0xf61f,0x77));var _0xff61=function(_0xbc9917,_0x479324){_0xbc9917=_0xbc9917-0x0;var _0x20ab5a=_0xf61f[_0xbc9917];return _0x20ab5a;};'use strict';var _=require('lodash');var Redis=require(_0xff61('0x0'));var db=require(_0xff61('0x1'))['db'];var logger=require(_0xff61('0x2'))(_0xff61('0x3'));var config=require('../../config/environment');config[_0xff61('0x4')]=_[_0xff61('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff61('0x6'))(new Redis(config['redis']));require(_0xff61('0x7'))[_0xff61('0x8')](socket);exports[_0xff61('0x9')]=function(_0x38784d){var _0x4ecd8c=this;return new Promise(function(_0x4126b4,_0x141c54){return db[_0xff61('0xa')][_0xff61('0xb')]({'raw':_0x38784d[_0xff61('0xc')]?_0x38784d[_0xff61('0xc')][_0xff61('0xd')]===undefined?!![]:![]:!![],'where':_0x38784d[_0xff61('0xc')]?_0x38784d['options'][_0xff61('0xe')]||null:null,'attributes':_0x38784d['options']?_0x38784d[_0xff61('0xc')][_0xff61('0xf')]||null:null,'limit':_0x38784d[_0xff61('0xc')]?_0x38784d[_0xff61('0xc')][_0xff61('0x10')]||null:null,'include':_0x38784d['options']?_0x38784d[_0xff61('0xc')][_0xff61('0x11')]?_['map'](_0x38784d[_0xff61('0xc')][_0xff61('0x11')],function(_0x3c87e7){return{'model':db[_0x3c87e7['model']],'as':_0x3c87e7['as'],'attributes':_0x3c87e7['attributes'],'include':_0x3c87e7[_0xff61('0x11')]?_[_0xff61('0x12')](_0x3c87e7[_0xff61('0x11')],function(_0x393255){return{'model':db[_0x393255[_0xff61('0x13')]],'as':_0x393255['as'],'attributes':_0x393255[_0xff61('0xf')],'include':_0x393255[_0xff61('0x11')]?_[_0xff61('0x12')](_0x393255['include'],function(_0x30b4f5){return{'model':db[_0x30b4f5[_0xff61('0x13')]],'as':_0x30b4f5['as'],'attributes':_0x30b4f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xff61('0x14')](function(_0x231df6){logger[_0xff61('0x15')](_0xff61('0x9'),_0x38784d);logger[_0xff61('0x16')](_0xff61('0x9'),_0x38784d,JSON[_0xff61('0x17')](_0x231df6));_0x4126b4(_0x231df6);})[_0xff61('0x18')](function(_0x648741){logger[_0xff61('0x19')](_0xff61('0x9'),_0x648741[_0xff61('0x1a')],_0x38784d);_0x141c54(_0x4ecd8c[_0xff61('0x19')](0x1f4,_0x648741['message']));});});};exports[_0xff61('0x1b')]=function(_0x2bd041){var _0x5d2f39=this;return new Promise(function(_0x37c94f,_0x2fe8a1){return db[_0xff61('0xa')]['find']({'raw':_0x2bd041[_0xff61('0xc')]?_0x2bd041[_0xff61('0xc')][_0xff61('0xd')]===undefined?!![]:![]:!![],'where':_0x2bd041[_0xff61('0xc')]?_0x2bd041[_0xff61('0xc')][_0xff61('0xe')]||null:null,'attributes':_0x2bd041['options']?_0x2bd041[_0xff61('0xc')][_0xff61('0xf')]||null:null,'include':_0x2bd041[_0xff61('0xc')]?_0x2bd041[_0xff61('0xc')][_0xff61('0x11')]?_[_0xff61('0x12')](_0x2bd041[_0xff61('0xc')][_0xff61('0x11')],function(_0x1212b0){return{'model':db[_0x1212b0['model']],'as':_0x1212b0['as'],'attributes':_0x1212b0['attributes'],'include':_0x1212b0[_0xff61('0x11')]?_['map'](_0x1212b0[_0xff61('0x11')],function(_0xb60767){return{'model':db[_0xb60767[_0xff61('0x13')]],'as':_0xb60767['as'],'attributes':_0xb60767[_0xff61('0xf')],'include':_0xb60767['include']?_['map'](_0xb60767['include'],function(_0x40b44e){return{'model':db[_0x40b44e['model']],'as':_0x40b44e['as'],'attributes':_0x40b44e['attributes']};}):[]};}):[]};}):[]:[]})[_0xff61('0x14')](function(_0x593123){logger[_0xff61('0x15')](_0xff61('0x1b'),_0x2bd041);logger[_0xff61('0x16')](_0xff61('0x1b'),_0x2bd041,JSON['stringify'](_0x593123));_0x37c94f(_0x593123);})[_0xff61('0x18')](function(_0x4bb0d6){logger[_0xff61('0x19')](_0xff61('0x1b'),_0x4bb0d6[_0xff61('0x1a')],_0x2bd041);_0x2fe8a1(_0x5d2f39['error'](0x1f4,_0x4bb0d6[_0xff61('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f8f8295..6f5876c 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 _0xd790=['length','squareProject:','save','remove','emit','removeListener','register'];(function(_0x2ffd94,_0x402a3e){var _0x939950=function(_0x3674ae){while(--_0x3674ae){_0x2ffd94['push'](_0x2ffd94['shift']());}};_0x939950(++_0x402a3e);}(_0xd790,0x6b));var _0x0d79=function(_0x4a6bc4,_0xd27c47){_0x4a6bc4=_0x4a6bc4-0x0;var _0x2589b3=_0xd790[_0x4a6bc4];return _0x2589b3;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x0d79('0x0'),_0x0d79('0x1'),'update'];function createListener(_0x3cd846,_0x5b6f69){return function(_0x517509){_0x5b6f69[_0x0d79('0x2')](_0x3cd846,_0x517509);};}function removeListener(_0x1183f3,_0x1c9df6){return function(){SquareProjectEvents[_0x0d79('0x3')](_0x1183f3,_0x1c9df6);};}exports[_0x0d79('0x4')]=function(_0x2cb3d1){for(var _0x387a0c=0x0,_0x18dde8=events[_0x0d79('0x5')];_0x387a0c<_0x18dde8;_0x387a0c++){var _0x25a687=events[_0x387a0c];var _0x1c9efd=createListener(_0x0d79('0x6')+_0x25a687,_0x2cb3d1);SquareProjectEvents['on'](_0x25a687,_0x1c9efd);}}; \ No newline at end of file +var _0x1363=['save','remove','update','removeListener','register','./squareProject.events'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x1363,0x1eb));var _0x3136=function(_0x275cd6,_0x22b219){_0x275cd6=_0x275cd6-0x0;var _0x126303=_0x1363[_0x275cd6];return _0x126303;};'use strict';var SquareProjectEvents=require(_0x3136('0x0'));var events=[_0x3136('0x1'),_0x3136('0x2'),_0x3136('0x3')];function createListener(_0x40612f,_0x9590b4){return function(_0x498525){_0x9590b4['emit'](_0x40612f,_0x498525);};}function removeListener(_0xd1a948,_0x3a8af4){return function(){SquareProjectEvents[_0x3136('0x4')](_0xd1a948,_0x3a8af4);};}exports[_0x3136('0x5')]=function(_0x43abb9){for(var _0x296035=0x0,_0x11dbc5=events['length'];_0x296035<_0x11dbc5;_0x296035++){var _0x58cd35=events[_0x296035];var _0x1ab98f=createListener('squareProject:'+_0x58cd35,_0x43abb9);SquareProjectEvents['on'](_0x58cd35,_0x1ab98f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 383c048..ace4875 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5e964d,_0x5c259f){var _0x14db73=function(_0x5931e9){while(--_0x5931e9){_0x5e964d['push'](_0x5e964d['shift']());}};_0x14db73(++_0x5c259f);}(_0x5fab,0x177));var _0xb5fa=function(_0x34ed99,_0x3e346d){_0x34ed99=_0x34ed99-0x0;var _0x35d584=_0x5fab[_0x34ed99];return _0x35d584;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x1a1a30,_0x2a52cd){var _0x4195a4=function(_0x33e60b){while(--_0x33e60b){_0x1a1a30['push'](_0x1a1a30['shift']());}};_0x4195a4(++_0x2a52cd);}(_0x814b,0x1a2));var _0xb814=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0x814b[_0x557f5f];return _0x196eba;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index bb945e3..5bfb620 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 _0xeff8=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x704beb,_0x225471){var _0x33ba60=function(_0x5444b2){while(--_0x5444b2){_0x704beb['push'](_0x704beb['shift']());}};_0x33ba60(++_0x225471);}(_0xeff8,0x186));var _0x8eff=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xeff8[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8eff('0x2')]},'calleridname':{'type':Sequelize[_0x8eff('0x2')]},'context':{'type':Sequelize[_0x8eff('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8eff('0x2')]},'accountcode':{'type':Sequelize[_0x8eff('0x2')]},'dnid':{'type':Sequelize[_0x8eff('0x2')]},'projectName':{'type':Sequelize[_0x8eff('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8eff('0x2')]},'savePath':{'type':Sequelize[_0x8eff('0x2')]},'format':{'type':Sequelize[_0x8eff('0x3')],'get':function(){var _0x323b2='';var _0x491f01=this[_0x8eff('0x4')](_0x8eff('0x5'));if(_0x491f01){_0x323b2=_0x491f01[_0x8eff('0x6')](_0x491f01[_0x8eff('0x7')]('.'));}return _0x323b2;}}}; \ No newline at end of file +var _0x2eb2=['substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x2eb2,0x19f));var _0x22eb=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2eb2[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'uniqueid':{'type':Sequelize[_0x22eb('0x1')]},'callerid':{'type':Sequelize[_0x22eb('0x1')]},'calleridname':{'type':Sequelize[_0x22eb('0x1')]},'context':{'type':Sequelize[_0x22eb('0x1')]},'extension':{'type':Sequelize[_0x22eb('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x22eb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x22eb('0x1')]},'filename':{'type':Sequelize[_0x22eb('0x1')]},'savePath':{'type':Sequelize[_0x22eb('0x1')]},'format':{'type':Sequelize[_0x22eb('0x2')],'get':function(){var _0x4539d0='';var _0x396806=this[_0x22eb('0x3')](_0x22eb('0x4'));if(_0x396806){_0x4539d0=_0x396806[_0x22eb('0x5')](_0x396806[_0x22eb('0x6')]('.'));}return _0x4539d0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e6c804f..2776440 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 _0x6779=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','SquareRecording','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','download','uniqueid','savePath','format','secrets','existsSync','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','count','limit','status','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x6779,0x18f));var _0x9677=function(_0x3fb0fe,_0x32af65){_0x3fb0fe=_0x3fb0fe-0x0;var _0x38b17d=_0x6779[_0x3fb0fe];return _0x38b17d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9677('0x0'));var zipdir=require(_0x9677('0x1'));var jsonpatch=require(_0x9677('0x2'));var rp=require(_0x9677('0x3'));var moment=require(_0x9677('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9677('0x5'));var sox=require(_0x9677('0x6'));var csv=require(_0x9677('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9677('0x8'));var _=require('lodash');var squel=require(_0x9677('0x9'));var crypto=require('crypto');var jsforce=require(_0x9677('0xa'));var deskjs=require(_0x9677('0xb'));var toCsv=require(_0x9677('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9677('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9677('0xd'));var as=require(_0x9677('0xe'));var hardwareService=require(_0x9677('0xf'));var logger=require(_0x9677('0x10'))('api');var utils=require(_0x9677('0x11'));var config=require(_0x9677('0x12'));var licenseUtil=require(_0x9677('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33e824,_0x4f4a7a){_0x4f4a7a=_0x4f4a7a||0xcc;return function(_0x41af94){if(_0x41af94){return _0x33e824[_0x9677('0x14')](_0x4f4a7a);}return _0x33e824['status'](_0x4f4a7a)[_0x9677('0x15')]();};}function respondWithResult(_0x5d9fd2,_0x5705c0){_0x5705c0=_0x5705c0||0xc8;return function(_0x550ecc){if(_0x550ecc){return _0x5d9fd2['status'](_0x5705c0)['json'](_0x550ecc);}};}function respondWithFilteredResult(_0x15687a,_0x444619){return function(_0x265644){if(_0x265644){var _0x4afafd=typeof _0x444619[_0x9677('0x16')]==='undefined'&&typeof _0x444619['limit']==='undefined';var _0x48b582=_0x265644[_0x9677('0x17')];var _0x585f6d=_0x4afafd?0x0:_0x444619[_0x9677('0x16')];var _0x207b03=_0x4afafd?_0x265644[_0x9677('0x17')]:_0x444619['offset']+_0x444619[_0x9677('0x18')];var _0x4d462f;if(_0x207b03>=_0x48b582){_0x207b03=_0x48b582;_0x4d462f=0xc8;}else{_0x4d462f=0xce;}_0x15687a[_0x9677('0x19')](_0x4d462f);return _0x15687a['set']('Content-Range',_0x585f6d+'-'+_0x207b03+'/'+_0x48b582)[_0x9677('0x1a')](_0x265644);}return null;};}function patchUpdates(_0x5d10fc){return function(_0x2730d7){try{jsonpatch[_0x9677('0x1b')](_0x2730d7,_0x5d10fc,!![]);}catch(_0x86f75c){return BPromise[_0x9677('0x1c')](_0x86f75c);}return _0x2730d7['save']();};}function saveUpdates(_0x59d1bb,_0x4aa224){return function(_0x1c875e){if(_0x1c875e){return _0x1c875e[_0x9677('0x1d')](_0x59d1bb)[_0x9677('0x1e')](function(_0x10016c){return _0x10016c;});}return null;};}function removeEntity(_0x4c1157,_0x3ad45b){return function(_0x5d6ffb){if(_0x5d6ffb){return _0x5d6ffb[_0x9677('0x1f')]()[_0x9677('0x1e')](function(){_0x4c1157[_0x9677('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1be60a,_0x6a7139){return function(_0xd0b39f){if(!_0xd0b39f){_0x1be60a[_0x9677('0x14')](0x194);}return _0xd0b39f;};}function handleError(_0x5dd4e6,_0x566c66){_0x566c66=_0x566c66||0x1f4;return function(_0x5da84a){logger[_0x9677('0x20')](_0x5da84a[_0x9677('0x21')]);if(_0x5da84a['name']){delete _0x5da84a[_0x9677('0x22')];}_0x5dd4e6[_0x9677('0x19')](_0x566c66)[_0x9677('0x23')](_0x5da84a);};}exports[_0x9677('0x24')]=function(_0x21785e,_0xe669f){var _0x2a6ac1={},_0xe4cdb7={},_0x6a6d59={'count':0x0,'rows':[]};var _0x54ce48=_[_0x9677('0x25')](db['SquareRecording']['rawAttributes'],function(_0x575f9b){return{'name':_0x575f9b[_0x9677('0x26')],'type':_0x575f9b[_0x9677('0x27')][_0x9677('0x28')]};});_0xe4cdb7[_0x9677('0x29')]=_['map'](_0x54ce48,_0x9677('0x22'));_0xe4cdb7[_0x9677('0x2a')]=_[_0x9677('0x2b')](_0x21785e['query']);_0xe4cdb7[_0x9677('0x2c')]=_[_0x9677('0x2d')](_0xe4cdb7[_0x9677('0x29')],_0xe4cdb7['query']);_0x2a6ac1[_0x9677('0x2e')]=_[_0x9677('0x2d')](_0xe4cdb7['model'],qs[_0x9677('0x2f')](_0x21785e['query'][_0x9677('0x2f')]));_0x2a6ac1['attributes']=_0x2a6ac1['attributes'][_0x9677('0x30')]?_0x2a6ac1[_0x9677('0x2e')]:_0xe4cdb7[_0x9677('0x29')];if(!_0x21785e['query']['hasOwnProperty'](_0x9677('0x31'))){_0x2a6ac1[_0x9677('0x18')]=qs['limit'](_0x21785e[_0x9677('0x2a')]['limit']);_0x2a6ac1['offset']=qs[_0x9677('0x16')](_0x21785e[_0x9677('0x2a')][_0x9677('0x16')]);}_0x2a6ac1['order']=qs[_0x9677('0x32')](_0x21785e['query'][_0x9677('0x32')]);_0x2a6ac1[_0x9677('0x33')]=qs[_0x9677('0x2c')](_[_0x9677('0x34')](_0x21785e[_0x9677('0x2a')],_0xe4cdb7['filters']),_0x54ce48);if(_0x21785e[_0x9677('0x2a')][_0x9677('0x35')]){_0x2a6ac1[_0x9677('0x33')]=_[_0x9677('0x36')](_0x2a6ac1[_0x9677('0x33')],{'$or':_[_0x9677('0x25')](_0x54ce48,function(_0x1fe9d2){if(_0x1fe9d2[_0x9677('0x27')]!==_0x9677('0x37')){var _0x295e31={};_0x295e31[_0x1fe9d2[_0x9677('0x22')]]={'$like':'%'+_0x21785e[_0x9677('0x2a')][_0x9677('0x35')]+'%'};return _0x295e31;}})});}_0x2a6ac1=_[_0x9677('0x36')]({},_0x2a6ac1,_0x21785e['options']);var _0x48fc9c={'where':_0x2a6ac1[_0x9677('0x33')]};return db['SquareRecording'][_0x9677('0x17')](_0x48fc9c)[_0x9677('0x1e')](function(_0x2b8748){_0x6a6d59[_0x9677('0x17')]=_0x2b8748;if(_0x21785e[_0x9677('0x2a')][_0x9677('0x38')]){_0x2a6ac1[_0x9677('0x39')]=[{'all':!![]}];}return db[_0x9677('0x3a')][_0x9677('0x3b')](_0x2a6ac1);})['then'](function(_0x44f139){_0x6a6d59[_0x9677('0x3c')]=_0x44f139;return _0x6a6d59;})['then'](respondWithFilteredResult(_0xe669f,_0x2a6ac1))['catch'](handleError(_0xe669f,null));};exports[_0x9677('0x3d')]=function(_0x1428e5,_0x4a00b6){var _0x13874e={'raw':!![],'where':{'id':_0x1428e5[_0x9677('0x3e')]['id']}},_0x24a462={};_0x24a462[_0x9677('0x29')]=_[_0x9677('0x2b')](db[_0x9677('0x3a')][_0x9677('0x3f')]);_0x24a462[_0x9677('0x2a')]=_['keys'](_0x1428e5[_0x9677('0x2a')]);_0x24a462[_0x9677('0x2c')]=_[_0x9677('0x2d')](_0x24a462[_0x9677('0x29')],_0x24a462[_0x9677('0x2a')]);_0x13874e[_0x9677('0x2e')]=_[_0x9677('0x2d')](_0x24a462['model'],qs[_0x9677('0x2f')](_0x1428e5[_0x9677('0x2a')][_0x9677('0x2f')]));_0x13874e[_0x9677('0x2e')]=_0x13874e['attributes'][_0x9677('0x30')]?_0x13874e[_0x9677('0x2e')]:_0x24a462[_0x9677('0x29')];if(_0x1428e5[_0x9677('0x2a')]['includeAll']){_0x13874e[_0x9677('0x39')]=[{'all':!![]}];}_0x13874e=_[_0x9677('0x36')]({},_0x13874e,_0x1428e5[_0x9677('0x40')]);return db[_0x9677('0x3a')][_0x9677('0x41')](_0x13874e)[_0x9677('0x1e')](handleEntityNotFound(_0x4a00b6,null))[_0x9677('0x1e')](respondWithResult(_0x4a00b6,null))[_0x9677('0x42')](handleError(_0x4a00b6,null));};exports[_0x9677('0x43')]=function(_0x166535,_0x151d4c){return db['SquareRecording']['create'](_0x166535[_0x9677('0x44')],{})[_0x9677('0x1e')](respondWithResult(_0x151d4c,0xc9))[_0x9677('0x42')](handleError(_0x151d4c,null));};exports['update']=function(_0x25c31b,_0x2e96fd){if(_0x25c31b[_0x9677('0x44')]['id']){delete _0x25c31b[_0x9677('0x44')]['id'];}return db[_0x9677('0x3a')][_0x9677('0x41')]({'where':{'id':_0x25c31b[_0x9677('0x3e')]['id']}})[_0x9677('0x1e')](handleEntityNotFound(_0x2e96fd,null))[_0x9677('0x1e')](saveUpdates(_0x25c31b[_0x9677('0x44')],null))[_0x9677('0x1e')](respondWithResult(_0x2e96fd,null))[_0x9677('0x42')](handleError(_0x2e96fd,null));};exports[_0x9677('0x45')]=function(_0x29e1b9,_0x36b277,_0x3699ce){var _0x5989e2=require('../../components/encryptor');var _0x2bca6f=![];var _0x240114={};if(_0x29e1b9[_0x9677('0x2a')][_0x9677('0x27')]&&_0x29e1b9[_0x9677('0x2a')][_0x9677('0x27')]===_0x9677('0x46')){_0x240114[_0x9677('0x46')]=_0x29e1b9['params']['id'];}else{_0x240114['id']=_0x29e1b9[_0x9677('0x3e')]['id'];}return db['SquareRecording'][_0x9677('0x41')]({'where':_0x240114,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x36b277,null))['then'](function(_0x1b9566){if(_0x1b9566){var _0xfa6c0d=_0x1b9566[_0x9677('0x47')];var _0x3512e1=util[_0x9677('0x48')]('%s.cypher',_0xfa6c0d);if(fs['existsSync'](_0x3512e1)){_0x2bca6f=!![];return _0x5989e2['decryptFile'](_0x3512e1,_0xfa6c0d,config[_0x9677('0x49')]['recording'])[_0x9677('0x1e')](function(){return _0x1b9566;});}return _0x1b9566;}})[_0x9677('0x1e')](function(_0x2aac35){if(_0x2aac35){var _0x46a4e1=_0x2aac35[_0x9677('0x47')];if(!fs[_0x9677('0x4a')](_0x46a4e1)){throw new db['Sequelize'][(_0x9677('0x4b'))](_0x9677('0x4c'));}if(_0x2aac35[_0x9677('0x4d')]){return _0x36b277['download'](_0x46a4e1,_0x2aac35[_0x9677('0x4d')]+path[_0x9677('0x4e')](_0x46a4e1),function(){if(_0x2bca6f){fs[_0x9677('0x4f')](_0x46a4e1);}});}else{return _0x36b277[_0x9677('0x45')](_0x46a4e1,function(_0x6a602c){if(_0x2bca6f){fs['unlink'](_0x46a4e1);}});}}})[_0x9677('0x42')](function(_0x5bb898){if(_0x5bb898['message']===_0x9677('0x4c')){_0x36b277[_0x9677('0x19')](0x194)['send']('Not\x20found');}else{return handleError(_0x36b277,null);}});};exports[_0x9677('0x1f')]=function(_0x5c227c,_0x4eb9e9){return db[_0x9677('0x3a')][_0x9677('0x41')]({'where':{'id':_0x5c227c[_0x9677('0x3e')]['id']}})[_0x9677('0x1e')](function(_0xa550f9){if(_[_0x9677('0x50')](_0xa550f9)){throw new ReferenceError(_0x9677('0x51'));}return _0xa550f9;})['then'](function(_0xf680e9){var _0xa872ff=_0xf680e9[_0x9677('0x47')];logger['info'](_0x9677('0x52'),_0xa872ff);if(!_['isNil'](_0xf680e9[_0x9677('0x47')])&&fs['existsSync'](_0xa872ff)){logger[_0x9677('0x53')](_0x9677('0x54')+_0xa872ff+_0x9677('0x55'));fs[_0x9677('0x56')](_0xa872ff);}_0xa872ff=_0xa872ff+_0x9677('0x57');if(!_[_0x9677('0x50')](_0xf680e9[_0x9677('0x47')])&&fs[_0x9677('0x4a')](_0xa872ff)){logger[_0x9677('0x53')]('File:\x20\x22'+_0xa872ff+_0x9677('0x55'));fs['unlinkSync'](_0xa872ff);}return _0xf680e9;})['then'](function(_0x4694a0){if(!_0x4694a0)throw new InternalError();return _0x4694a0[_0x9677('0x1f')]();})[_0x9677('0x1e')](function(){_0x4eb9e9[_0x9677('0x19')](0xcc)[_0x9677('0x15')]();})[_0x9677('0x42')](handleError(_0x4eb9e9,null));}; \ No newline at end of file +var _0xa21e=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query'];(function(_0x2c33c4,_0x47e659){var _0x1aa34d=function(_0x1d3e3e){while(--_0x1d3e3e){_0x2c33c4['push'](_0x2c33c4['shift']());}};_0x1aa34d(++_0x47e659);}(_0xa21e,0x153));var _0xea21=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xa21e[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0xea21('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea21('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea21('0x2'));var moment=require('moment');var BPromise=require(_0xea21('0x3'));var Mustache=require(_0xea21('0x4'));var util=require('util');var path=require(_0xea21('0x5'));var sox=require('sox');var csv=require(_0xea21('0x6'));var ejs=require(_0xea21('0x7'));var fs=require('fs');var fs_extra=require(_0xea21('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea21('0x9'));var deskjs=require(_0xea21('0xa'));var toCsv=require(_0xea21('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xea21('0xb'));var authService=require(_0xea21('0xc'));var qs=require(_0xea21('0xd'));var as=require(_0xea21('0xe'));var hardwareService=require(_0xea21('0xf'));var logger=require(_0xea21('0x10'))('api');var utils=require(_0xea21('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xea21('0x12'));var db=require(_0xea21('0x13'))['db'];function respondWithStatusCode(_0x2025eb,_0x5593b9){_0x5593b9=_0x5593b9||0xcc;return function(_0x3b5777){if(_0x3b5777){return _0x2025eb['sendStatus'](_0x5593b9);}return _0x2025eb[_0xea21('0x14')](_0x5593b9)[_0xea21('0x15')]();};}function respondWithResult(_0x61b342,_0x3038c9){_0x3038c9=_0x3038c9||0xc8;return function(_0x415e56){if(_0x415e56){return _0x61b342[_0xea21('0x14')](_0x3038c9)['json'](_0x415e56);}};}function respondWithFilteredResult(_0x5e257e,_0x51adbc){return function(_0x2f9abc){if(_0x2f9abc){var _0x3b6f7a=typeof _0x51adbc[_0xea21('0x16')]===_0xea21('0x17')&&typeof _0x51adbc['limit']===_0xea21('0x17');var _0x58d361=_0x2f9abc[_0xea21('0x18')];var _0x50068a=_0x3b6f7a?0x0:_0x51adbc[_0xea21('0x16')];var _0x57c538=_0x3b6f7a?_0x2f9abc[_0xea21('0x18')]:_0x51adbc[_0xea21('0x16')]+_0x51adbc['limit'];var _0x3d8856;if(_0x57c538>=_0x58d361){_0x57c538=_0x58d361;_0x3d8856=0xc8;}else{_0x3d8856=0xce;}_0x5e257e['status'](_0x3d8856);return _0x5e257e[_0xea21('0x19')]('Content-Range',_0x50068a+'-'+_0x57c538+'/'+_0x58d361)[_0xea21('0x1a')](_0x2f9abc);}return null;};}function patchUpdates(_0xf66db3){return function(_0x4c0255){try{jsonpatch[_0xea21('0x1b')](_0x4c0255,_0xf66db3,!![]);}catch(_0x5de745){return BPromise[_0xea21('0x1c')](_0x5de745);}return _0x4c0255[_0xea21('0x1d')]();};}function saveUpdates(_0x31fa96,_0x89fa3d){return function(_0x3c2a61){if(_0x3c2a61){return _0x3c2a61['update'](_0x31fa96)[_0xea21('0x1e')](function(_0x21751a){return _0x21751a;});}return null;};}function removeEntity(_0x1b783c,_0x5c18d3){return function(_0x1b700f){if(_0x1b700f){return _0x1b700f[_0xea21('0x1f')]()[_0xea21('0x1e')](function(){_0x1b783c[_0xea21('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x340908,_0x39b2ee){return function(_0x587501){if(!_0x587501){_0x340908[_0xea21('0x20')](0x194);}return _0x587501;};}function handleError(_0x285ee1,_0x48220f){_0x48220f=_0x48220f||0x1f4;return function(_0xe5b702){logger[_0xea21('0x21')](_0xe5b702[_0xea21('0x22')]);if(_0xe5b702[_0xea21('0x23')]){delete _0xe5b702[_0xea21('0x23')];}_0x285ee1[_0xea21('0x14')](_0x48220f)[_0xea21('0x24')](_0xe5b702);};}exports[_0xea21('0x25')]=function(_0x4a2cf7,_0x447d2b){var _0x1239ba={},_0x4d778d={},_0x39f7e5={'count':0x0,'rows':[]};var _0xc913ff=_[_0xea21('0x26')](db[_0xea21('0x27')][_0xea21('0x28')],function(_0x57ce9d){return{'name':_0x57ce9d[_0xea21('0x29')],'type':_0x57ce9d['type'][_0xea21('0x2a')]};});_0x4d778d[_0xea21('0x2b')]=_[_0xea21('0x26')](_0xc913ff,_0xea21('0x23'));_0x4d778d[_0xea21('0x2c')]=_[_0xea21('0x2d')](_0x4a2cf7[_0xea21('0x2c')]);_0x4d778d[_0xea21('0x2e')]=_[_0xea21('0x2f')](_0x4d778d[_0xea21('0x2b')],_0x4d778d[_0xea21('0x2c')]);_0x1239ba[_0xea21('0x30')]=_[_0xea21('0x2f')](_0x4d778d[_0xea21('0x2b')],qs[_0xea21('0x31')](_0x4a2cf7['query'][_0xea21('0x31')]));_0x1239ba[_0xea21('0x30')]=_0x1239ba[_0xea21('0x30')][_0xea21('0x32')]?_0x1239ba['attributes']:_0x4d778d[_0xea21('0x2b')];if(!_0x4a2cf7[_0xea21('0x2c')][_0xea21('0x33')](_0xea21('0x34'))){_0x1239ba['limit']=qs[_0xea21('0x35')](_0x4a2cf7[_0xea21('0x2c')][_0xea21('0x35')]);_0x1239ba[_0xea21('0x16')]=qs[_0xea21('0x16')](_0x4a2cf7[_0xea21('0x2c')][_0xea21('0x16')]);}_0x1239ba[_0xea21('0x36')]=qs[_0xea21('0x37')](_0x4a2cf7[_0xea21('0x2c')][_0xea21('0x37')]);_0x1239ba[_0xea21('0x38')]=qs['filters'](_[_0xea21('0x39')](_0x4a2cf7['query'],_0x4d778d[_0xea21('0x2e')]),_0xc913ff);if(_0x4a2cf7[_0xea21('0x2c')]['filter']){_0x1239ba['where']=_[_0xea21('0x3a')](_0x1239ba['where'],{'$or':_[_0xea21('0x26')](_0xc913ff,function(_0x5ccc9b){if(_0x5ccc9b[_0xea21('0x3b')]!==_0xea21('0x3c')){var _0x4c4110={};_0x4c4110[_0x5ccc9b['name']]={'$like':'%'+_0x4a2cf7['query'][_0xea21('0x3d')]+'%'};return _0x4c4110;}})});}_0x1239ba=_['merge']({},_0x1239ba,_0x4a2cf7[_0xea21('0x3e')]);var _0x249b4b={'where':_0x1239ba[_0xea21('0x38')]};return db['SquareRecording'][_0xea21('0x18')](_0x249b4b)[_0xea21('0x1e')](function(_0x252864){_0x39f7e5[_0xea21('0x18')]=_0x252864;if(_0x4a2cf7['query'][_0xea21('0x3f')]){_0x1239ba['include']=[{'all':!![]}];}return db[_0xea21('0x27')]['findAll'](_0x1239ba);})['then'](function(_0x57e7b2){_0x39f7e5[_0xea21('0x40')]=_0x57e7b2;return _0x39f7e5;})['then'](respondWithFilteredResult(_0x447d2b,_0x1239ba))[_0xea21('0x41')](handleError(_0x447d2b,null));};exports[_0xea21('0x42')]=function(_0x345443,_0x2f0ad9){var _0x578e16={'raw':!![],'where':{'id':_0x345443[_0xea21('0x43')]['id']}},_0x58d6c5={};_0x58d6c5[_0xea21('0x2b')]=_[_0xea21('0x2d')](db['SquareRecording']['rawAttributes']);_0x58d6c5['query']=_[_0xea21('0x2d')](_0x345443[_0xea21('0x2c')]);_0x58d6c5[_0xea21('0x2e')]=_['intersection'](_0x58d6c5[_0xea21('0x2b')],_0x58d6c5[_0xea21('0x2c')]);_0x578e16[_0xea21('0x30')]=_['intersection'](_0x58d6c5[_0xea21('0x2b')],qs[_0xea21('0x31')](_0x345443['query'][_0xea21('0x31')]));_0x578e16[_0xea21('0x30')]=_0x578e16[_0xea21('0x30')][_0xea21('0x32')]?_0x578e16[_0xea21('0x30')]:_0x58d6c5[_0xea21('0x2b')];if(_0x345443[_0xea21('0x2c')][_0xea21('0x3f')]){_0x578e16[_0xea21('0x44')]=[{'all':!![]}];}_0x578e16=_[_0xea21('0x3a')]({},_0x578e16,_0x345443[_0xea21('0x3e')]);return db['SquareRecording'][_0xea21('0x45')](_0x578e16)[_0xea21('0x1e')](handleEntityNotFound(_0x2f0ad9,null))['then'](respondWithResult(_0x2f0ad9,null))['catch'](handleError(_0x2f0ad9,null));};exports[_0xea21('0x46')]=function(_0x4ff875,_0x302aad){return db[_0xea21('0x27')][_0xea21('0x46')](_0x4ff875[_0xea21('0x47')],{})[_0xea21('0x1e')](respondWithResult(_0x302aad,0xc9))[_0xea21('0x41')](handleError(_0x302aad,null));};exports[_0xea21('0x48')]=function(_0x35abf3,_0x1522da){if(_0x35abf3[_0xea21('0x47')]['id']){delete _0x35abf3['body']['id'];}return db[_0xea21('0x27')]['find']({'where':{'id':_0x35abf3[_0xea21('0x43')]['id']}})['then'](handleEntityNotFound(_0x1522da,null))[_0xea21('0x1e')](saveUpdates(_0x35abf3['body'],null))['then'](respondWithResult(_0x1522da,null))[_0xea21('0x41')](handleError(_0x1522da,null));};exports[_0xea21('0x49')]=function(_0x551f7b,_0x236652,_0x393bbb){var _0x28c132=require(_0xea21('0x4a'));var _0x2558b4=![];var _0x246656={};if(_0x551f7b['query'][_0xea21('0x3b')]&&_0x551f7b[_0xea21('0x2c')][_0xea21('0x3b')]===_0xea21('0x4b')){_0x246656[_0xea21('0x4b')]=_0x551f7b[_0xea21('0x43')]['id'];}else{_0x246656['id']=_0x551f7b['params']['id'];}return db[_0xea21('0x27')]['find']({'where':_0x246656,'attributes':['id',_0xea21('0x4c'),'filename'],'raw':!![]})[_0xea21('0x1e')](handleEntityNotFound(_0x236652,null))[_0xea21('0x1e')](function(_0x26eff6){if(_0x26eff6){var _0x48feda=_0x26eff6[_0xea21('0x4c')];var _0x51c775=util['format'](_0xea21('0x4d'),_0x48feda);if(fs[_0xea21('0x4e')](_0x51c775)){_0x2558b4=!![];return _0x28c132[_0xea21('0x4f')](_0x51c775,_0x48feda,config[_0xea21('0x50')][_0xea21('0x51')])[_0xea21('0x1e')](function(){return _0x26eff6;});}return _0x26eff6;}})['then'](function(_0x5067f5){if(_0x5067f5){var _0xa5c5f8=_0x5067f5[_0xea21('0x4c')];if(!fs['existsSync'](_0xa5c5f8)){throw new db[(_0xea21('0x52'))][(_0xea21('0x53'))](_0xea21('0x54'));}if(_0x5067f5[_0xea21('0x55')]){return _0x236652[_0xea21('0x49')](_0xa5c5f8,_0x5067f5[_0xea21('0x55')]+path[_0xea21('0x56')](_0xa5c5f8),function(){if(_0x2558b4){fs[_0xea21('0x57')](_0xa5c5f8);}});}else{return _0x236652[_0xea21('0x49')](_0xa5c5f8,function(_0x131cbb){if(_0x2558b4){fs[_0xea21('0x57')](_0xa5c5f8);}});}}})['catch'](function(_0x1fe5b2){if(_0x1fe5b2[_0xea21('0x58')]===_0xea21('0x54')){_0x236652['status'](0x194)[_0xea21('0x24')](_0xea21('0x59'));}else{return handleError(_0x236652,null);}});};exports[_0xea21('0x1f')]=function(_0x25d1a6,_0x5328d1){return db[_0xea21('0x27')]['find']({'where':{'id':_0x25d1a6[_0xea21('0x43')]['id']}})['then'](function(_0x5277a7){if(_[_0xea21('0x5a')](_0x5277a7)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5277a7;})[_0xea21('0x1e')](function(_0x433dfc){var _0x619aa2=_0x433dfc[_0xea21('0x4c')];logger[_0xea21('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x619aa2);if(!_[_0xea21('0x5a')](_0x433dfc[_0xea21('0x4c')])&&fs[_0xea21('0x4e')](_0x619aa2)){logger['info'](_0xea21('0x5c')+_0x619aa2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x619aa2);}_0x619aa2=_0x619aa2+_0xea21('0x5d');if(!_[_0xea21('0x5a')](_0x433dfc[_0xea21('0x4c')])&&fs['existsSync'](_0x619aa2)){logger[_0xea21('0x5b')]('File:\x20\x22'+_0x619aa2+_0xea21('0x5e'));fs[_0xea21('0x5f')](_0x619aa2);}return _0x433dfc;})[_0xea21('0x1e')](function(_0x12c2b7){if(!_0x12c2b7)throw new InternalError();return _0x12c2b7['destroy']();})[_0xea21('0x1e')](function(){_0x5328d1[_0xea21('0x14')](0xcc)[_0xea21('0x15')]();})['catch'](handleError(_0x5328d1,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 29d3743..41701c5 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 _0x25e7=['SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x453e58,_0x51523e){var _0x4be39c=function(_0x3f35fd){while(--_0x3f35fd){_0x453e58['push'](_0x453e58['shift']());}};_0x4be39c(++_0x51523e);}(_0x25e7,0x1d6));var _0x725e=function(_0x295771,_0x11e035){_0x295771=_0x295771-0x0;var _0x5130ee=_0x25e7[_0x295771];return _0x5130ee;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x2497a5,_0x480945){return _0x2497a5['define'](_0x725e('0xa'),attributes,{'tableName':_0x725e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','SquareRecording','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x583761,_0x119f81){var _0x4b72f0=function(_0x351cad){while(--_0x351cad){_0x583761['push'](_0x583761['shift']());}};_0x4b72f0(++_0x119f81);}(_0x524e,0x15e));var _0xe524=function(_0x345c7a,_0x2376dc){_0x345c7a=_0x345c7a-0x0;var _0x5d803c=_0x524e[_0x345c7a];return _0x5d803c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 19b471b..e3b65bb 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 _0xfb88=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateSquareRecording','SquareRecording','create','options','raw','catch'];(function(_0x4653c2,_0x3c92c4){var _0x1fc5a7=function(_0x3ead6f){while(--_0x3ead6f){_0x4653c2['push'](_0x4653c2['shift']());}};_0x1fc5a7(++_0x3c92c4);}(_0xfb88,0x1ed));var _0x8fb8=function(_0x47fb06,_0x2c2a13){_0x47fb06=_0x47fb06-0x0;var _0x56f4f2=_0xfb88[_0x47fb06];return _0x56f4f2;};'use strict';var _=require(_0x8fb8('0x0'));var util=require(_0x8fb8('0x1'));var moment=require(_0x8fb8('0x2'));var BPromise=require(_0x8fb8('0x3'));var rs=require(_0x8fb8('0x4'));var fs=require('fs');var Redis=require(_0x8fb8('0x5'));var db=require(_0x8fb8('0x6'))['db'];var utils=require(_0x8fb8('0x7'));var logger=require('../../config/logger')(_0x8fb8('0x8'));var config=require(_0x8fb8('0x9'));var jayson=require(_0x8fb8('0xa'));var client=jayson['client'][_0x8fb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b917f,_0x499f8d,_0x3d9ae9){return new BPromise(function(_0xc9e25f,_0x5e6a23){return client[_0x8fb8('0xc')](_0x5b917f,_0x3d9ae9)[_0x8fb8('0xd')](function(_0x10d5bd){logger['info'](_0x8fb8('0xe'),_0x499f8d,_0x8fb8('0xf'));logger[_0x8fb8('0x10')](_0x8fb8('0x11'),_0x499f8d,'request\x20sent',JSON[_0x8fb8('0x12')](_0x10d5bd));if(_0x10d5bd[_0x8fb8('0x13')]){if(_0x10d5bd[_0x8fb8('0x13')][_0x8fb8('0x14')]===0x1f4){logger['error'](_0x8fb8('0xe'),_0x499f8d,_0x10d5bd[_0x8fb8('0x13')][_0x8fb8('0x15')]);return _0x5e6a23(_0x10d5bd[_0x8fb8('0x13')]['message']);}logger['error'](_0x8fb8('0xe'),_0x499f8d,_0x10d5bd[_0x8fb8('0x13')][_0x8fb8('0x15')]);return _0xc9e25f(_0x10d5bd['error'][_0x8fb8('0x15')]);}else{logger[_0x8fb8('0x16')](_0x8fb8('0xe'),_0x499f8d,_0x8fb8('0xf'));_0xc9e25f(_0x10d5bd['result']['message']);}})['catch'](function(_0x263d66){logger['error'](_0x8fb8('0xe'),_0x499f8d,_0x263d66);_0x5e6a23(_0x263d66);});});}exports[_0x8fb8('0x17')]=function(_0x2a909c){var _0x3c9314=this;return new Promise(function(_0x4640c8,_0x112078){return db[_0x8fb8('0x18')][_0x8fb8('0x19')](_0x2a909c['body'],{'raw':_0x2a909c[_0x8fb8('0x1a')]?_0x2a909c[_0x8fb8('0x1a')][_0x8fb8('0x1b')]===undefined?!![]:![]:!![]})[_0x8fb8('0xd')](function(_0x305fc8){logger[_0x8fb8('0x16')]('CreateSquareRecording',_0x2a909c);logger[_0x8fb8('0x10')]('CreateSquareRecording',_0x2a909c,JSON[_0x8fb8('0x12')](_0x305fc8));_0x4640c8(_0x305fc8);})[_0x8fb8('0x1c')](function(_0x33094d){logger[_0x8fb8('0x13')]('CreateSquareRecording',_0x33094d[_0x8fb8('0x15')],_0x2a909c);_0x112078(_0x3c9314[_0x8fb8('0x13')](0x1f4,_0x33094d[_0x8fb8('0x15')]));});});}; \ No newline at end of file +var _0x7280=['request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4a7b2b,_0x3366e1){var _0x35e381=function(_0x4409db){while(--_0x4409db){_0x4a7b2b['push'](_0x4a7b2b['shift']());}};_0x35e381(++_0x3366e1);}(_0x7280,0x12a));var _0x0728=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7280[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0728('0x0'));var util=require(_0x0728('0x1'));var moment=require(_0x0728('0x2'));var BPromise=require(_0x0728('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0728('0x4'));var db=require(_0x0728('0x5'))['db'];var utils=require(_0x0728('0x6'));var logger=require(_0x0728('0x7'))('rpc');var config=require(_0x0728('0x8'));var jayson=require(_0x0728('0x9'));var client=jayson[_0x0728('0xa')][_0x0728('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27430d,_0x4741cf,_0x24f3cd){return new BPromise(function(_0x4b7ecf,_0x15b217){return client[_0x0728('0xc')](_0x27430d,_0x24f3cd)[_0x0728('0xd')](function(_0x2e96fd){logger[_0x0728('0xe')](_0x0728('0xf'),_0x4741cf,'request\x20sent');logger[_0x0728('0x10')](_0x0728('0x11'),_0x4741cf,_0x0728('0x12'),JSON[_0x0728('0x13')](_0x2e96fd));if(_0x2e96fd['error']){if(_0x2e96fd[_0x0728('0x14')][_0x0728('0x15')]===0x1f4){logger[_0x0728('0x14')]('SquareRecording,\x20%s,\x20%s',_0x4741cf,_0x2e96fd['error'][_0x0728('0x16')]);return _0x15b217(_0x2e96fd[_0x0728('0x14')][_0x0728('0x16')]);}logger[_0x0728('0x14')](_0x0728('0xf'),_0x4741cf,_0x2e96fd['error'][_0x0728('0x16')]);return _0x4b7ecf(_0x2e96fd[_0x0728('0x14')][_0x0728('0x16')]);}else{logger[_0x0728('0xe')](_0x0728('0xf'),_0x4741cf,_0x0728('0x12'));_0x4b7ecf(_0x2e96fd[_0x0728('0x17')]['message']);}})[_0x0728('0x18')](function(_0xe356d0){logger[_0x0728('0x14')](_0x0728('0xf'),_0x4741cf,_0xe356d0);_0x15b217(_0xe356d0);});});}exports['CreateSquareRecording']=function(_0x3c2a84){var _0x186560=this;return new Promise(function(_0xb325e3,_0x47c428){return db[_0x0728('0x19')][_0x0728('0x1a')](_0x3c2a84[_0x0728('0x1b')],{'raw':_0x3c2a84[_0x0728('0x1c')]?_0x3c2a84[_0x0728('0x1c')][_0x0728('0x1d')]===undefined?!![]:![]:!![]})[_0x0728('0xd')](function(_0x118aa7){logger[_0x0728('0xe')](_0x0728('0x1e'),_0x3c2a84);logger[_0x0728('0x10')]('CreateSquareRecording',_0x3c2a84,JSON[_0x0728('0x13')](_0x118aa7));_0xb325e3(_0x118aa7);})[_0x0728('0x18')](function(_0x390d9b){logger[_0x0728('0x14')](_0x0728('0x1e'),_0x390d9b[_0x0728('0x16')],_0x3c2a84);_0x47c428(_0x186560[_0x0728('0x14')](0x1f4,_0x390d9b[_0x0728('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c23cdcc..00bc7ff 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(_0x20e24d,_0x19f631){var _0x282faa=function(_0x436528){while(--_0x436528){_0x20e24d['push'](_0x20e24d['shift']());}};_0x282faa(++_0x19f631);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c0c9e,_0x3ecdee){_0x3c0c9e=_0x3c0c9e-0x0;var _0x5ba5fe=_0xb10b[_0x3c0c9e];return _0x5ba5fe;};'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(_0x1a0f6f,_0xb00402){var _0x31712d=function(_0xda980c){while(--_0xda980c){_0x1a0f6f['push'](_0x1a0f6f['shift']());}};_0x31712d(++_0xb00402);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 0c8d03c..8687586 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 _0xa71f=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3eeabc,_0x3b4f82){var _0x3d987f=function(_0x5a6e06){while(--_0x5a6e06){_0x3eeabc['push'](_0x3eeabc['shift']());}};_0x3d987f(++_0x3b4f82);}(_0xa71f,0x111));var _0xfa71=function(_0x13378a,_0x584f9e){_0x13378a=_0x13378a-0x0;var _0x543f77=_0xa71f[_0x13378a];return _0x543f77;};'use strict';var Sequelize=require(_0xfa71('0x0'));module[_0xfa71('0x1')]={'network':{'type':Sequelize[_0xfa71('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xfa71('0x2')]},'channel':{'type':Sequelize[_0xfa71('0x2')]},'language':{'type':Sequelize[_0xfa71('0x2')]},'type':{'type':Sequelize[_0xfa71('0x2')]},'uniqueid':{'type':Sequelize[_0xfa71('0x2')]},'version':{'type':Sequelize[_0xfa71('0x2')]},'callerid':{'type':Sequelize[_0xfa71('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xfa71('0x2')]},'callingani2':{'type':Sequelize[_0xfa71('0x2')]},'callington':{'type':Sequelize[_0xfa71('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xfa71('0x2')]},'rdnis':{'type':Sequelize[_0xfa71('0x2')]},'context':{'type':Sequelize[_0xfa71('0x2')]},'extension':{'type':Sequelize[_0xfa71('0x2')]},'priority':{'type':Sequelize[_0xfa71('0x2')]},'enhanced':{'type':Sequelize[_0xfa71('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xfa71('0x2')]},'project_name':{'type':Sequelize[_0xfa71('0x2')]},'joinAt':{'type':Sequelize[_0xfa71('0x3')]},'leaveAt':{'type':Sequelize[_0xfa71('0x3')]},'bot':{'type':Sequelize[_0xfa71('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa3c0=['DATE','STRING'];(function(_0x4a1528,_0x31803a){var _0x4af0ad=function(_0xed2f54){while(--_0xed2f54){_0x4a1528['push'](_0x4a1528['shift']());}};_0x4af0ad(++_0x31803a);}(_0xa3c0,0x183));var _0x0a3c=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xa3c0[_0x26da89];return _0xc95b7b;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x0a3c('0x0')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x0a3c('0x0')]},'channel':{'type':Sequelize[_0x0a3c('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0a3c('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x0a3c('0x0')]},'callerid':{'type':Sequelize[_0x0a3c('0x0')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x0a3c('0x0')]},'callingtns':{'type':Sequelize[_0x0a3c('0x0')]},'dnid':{'type':Sequelize[_0x0a3c('0x0')]},'rdnis':{'type':Sequelize[_0x0a3c('0x0')]},'context':{'type':Sequelize[_0x0a3c('0x0')]},'extension':{'type':Sequelize[_0x0a3c('0x0')]},'priority':{'type':Sequelize[_0x0a3c('0x0')]},'enhanced':{'type':Sequelize[_0x0a3c('0x0')]},'accountcode':{'type':Sequelize[_0x0a3c('0x0')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x0a3c('0x0')]},'joinAt':{'type':Sequelize[_0x0a3c('0x1')]},'leaveAt':{'type':Sequelize[_0x0a3c('0x1')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 0ba1d97..6f3df91 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 _0xfa67=['name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','SquareReport','include','findAll','rows','show','includeAll','create','body','catch','update','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','destroy','then','error','stack'];(function(_0x2b547b,_0x390c5a){var _0x389905=function(_0x3abbb2){while(--_0x3abbb2){_0x2b547b['push'](_0x2b547b['shift']());}};_0x389905(++_0x390c5a);}(_0xfa67,0x10b));var _0x7fa6=function(_0x50adbf,_0x3d55c9){_0x50adbf=_0x50adbf-0x0;var _0x33c290=_0xfa67[_0x50adbf];return _0x33c290;};'use strict';var emlformat=require(_0x7fa6('0x0'));var rimraf=require(_0x7fa6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fa6('0x2'));var rp=require(_0x7fa6('0x3'));var moment=require(_0x7fa6('0x4'));var BPromise=require(_0x7fa6('0x5'));var Mustache=require(_0x7fa6('0x6'));var util=require(_0x7fa6('0x7'));var path=require(_0x7fa6('0x8'));var sox=require(_0x7fa6('0x9'));var csv=require(_0x7fa6('0xa'));var ejs=require(_0x7fa6('0xb'));var fs=require('fs');var fs_extra=require(_0x7fa6('0xc'));var _=require(_0x7fa6('0xd'));var squel=require(_0x7fa6('0xe'));var crypto=require(_0x7fa6('0xf'));var jsforce=require(_0x7fa6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7fa6('0xa'));var querystring=require(_0x7fa6('0x11'));var Papa=require(_0x7fa6('0x12'));var Redis=require(_0x7fa6('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7fa6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7fa6('0x15'));var utils=require(_0x7fa6('0x16'));var config=require(_0x7fa6('0x17'));var licenseUtil=require(_0x7fa6('0x18'));var db=require(_0x7fa6('0x19'))['db'];function respondWithStatusCode(_0x3b961e,_0x19f506){_0x19f506=_0x19f506||0xcc;return function(_0x5038cc){if(_0x5038cc){return _0x3b961e[_0x7fa6('0x1a')](_0x19f506);}return _0x3b961e[_0x7fa6('0x1b')](_0x19f506)[_0x7fa6('0x1c')]();};}function respondWithResult(_0x5ea346,_0x51297e){_0x51297e=_0x51297e||0xc8;return function(_0x3c5e5b){if(_0x3c5e5b){return _0x5ea346[_0x7fa6('0x1b')](_0x51297e)[_0x7fa6('0x1d')](_0x3c5e5b);}};}function respondWithFilteredResult(_0x13ca9c,_0x33d3f6){return function(_0x2712ef){if(_0x2712ef){var _0x530711=typeof _0x33d3f6[_0x7fa6('0x1e')]===_0x7fa6('0x1f')&&typeof _0x33d3f6['limit']===_0x7fa6('0x1f');var _0x1d212a=_0x2712ef['count'];var _0x3dc02c=_0x530711?0x0:_0x33d3f6[_0x7fa6('0x1e')];var _0x2de759=_0x530711?_0x2712ef[_0x7fa6('0x20')]:_0x33d3f6[_0x7fa6('0x1e')]+_0x33d3f6['limit'];var _0x52990f;if(_0x2de759>=_0x1d212a){_0x2de759=_0x1d212a;_0x52990f=0xc8;}else{_0x52990f=0xce;}_0x13ca9c[_0x7fa6('0x1b')](_0x52990f);return _0x13ca9c['set'](_0x7fa6('0x21'),_0x3dc02c+'-'+_0x2de759+'/'+_0x1d212a)['json'](_0x2712ef);}return null;};}function patchUpdates(_0x2ab76c){return function(_0x19d01f){try{jsonpatch[_0x7fa6('0x22')](_0x19d01f,_0x2ab76c,!![]);}catch(_0x2bb673){return BPromise[_0x7fa6('0x23')](_0x2bb673);}return _0x19d01f[_0x7fa6('0x24')]();};}function saveUpdates(_0x4888f4,_0xb2f3c){return function(_0xbc5765){if(_0xbc5765){return _0xbc5765['update'](_0x4888f4)['then'](function(_0x19c164){return _0x19c164;});}return null;};}function removeEntity(_0xd0da18,_0x47f7fd){return function(_0x341098){if(_0x341098){return _0x341098[_0x7fa6('0x25')]()[_0x7fa6('0x26')](function(){_0xd0da18[_0x7fa6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6cc5,_0x278fa7){return function(_0x23682d){if(!_0x23682d){_0x3b6cc5[_0x7fa6('0x1a')](0x194);}return _0x23682d;};}function handleError(_0x355f79,_0x2c1e05){_0x2c1e05=_0x2c1e05||0x1f4;return function(_0x3a2b60){logger[_0x7fa6('0x27')](_0x3a2b60[_0x7fa6('0x28')]);if(_0x3a2b60[_0x7fa6('0x29')]){delete _0x3a2b60['name'];}_0x355f79[_0x7fa6('0x1b')](_0x2c1e05)['send'](_0x3a2b60);};}exports[_0x7fa6('0x2a')]=function(_0x4453b3,_0x2e328d){var _0x427c22={},_0x7b07d8={},_0x2a1ed7={'count':0x0,'rows':[]};var _0x8e8dfb=_[_0x7fa6('0x2b')](db['SquareReport'][_0x7fa6('0x2c')],function(_0x9062bf){return{'name':_0x9062bf[_0x7fa6('0x2d')],'type':_0x9062bf[_0x7fa6('0x2e')]['key']};});_0x7b07d8[_0x7fa6('0x2f')]=_[_0x7fa6('0x2b')](_0x8e8dfb,_0x7fa6('0x29'));_0x7b07d8['query']=_[_0x7fa6('0x30')](_0x4453b3[_0x7fa6('0x31')]);_0x7b07d8[_0x7fa6('0x32')]=_[_0x7fa6('0x33')](_0x7b07d8[_0x7fa6('0x2f')],_0x7b07d8['query']);_0x427c22[_0x7fa6('0x34')]=_[_0x7fa6('0x33')](_0x7b07d8[_0x7fa6('0x2f')],qs[_0x7fa6('0x35')](_0x4453b3[_0x7fa6('0x31')][_0x7fa6('0x35')]));_0x427c22[_0x7fa6('0x34')]=_0x427c22[_0x7fa6('0x34')][_0x7fa6('0x36')]?_0x427c22['attributes']:_0x7b07d8['model'];if(!_0x4453b3[_0x7fa6('0x31')]['hasOwnProperty'](_0x7fa6('0x37'))){_0x427c22[_0x7fa6('0x38')]=qs[_0x7fa6('0x38')](_0x4453b3['query'][_0x7fa6('0x38')]);_0x427c22['offset']=qs[_0x7fa6('0x1e')](_0x4453b3['query']['offset']);}_0x427c22[_0x7fa6('0x39')]=qs['sort'](_0x4453b3[_0x7fa6('0x31')][_0x7fa6('0x3a')]);_0x427c22[_0x7fa6('0x3b')]=qs['filters'](_[_0x7fa6('0x3c')](_0x4453b3[_0x7fa6('0x31')],_0x7b07d8[_0x7fa6('0x32')]),_0x8e8dfb);if(_0x4453b3['query'][_0x7fa6('0x3d')]){_0x427c22[_0x7fa6('0x3b')]=_[_0x7fa6('0x3e')](_0x427c22['where'],{'$or':_[_0x7fa6('0x2b')](_0x8e8dfb,function(_0x2082b9){if(_0x2082b9[_0x7fa6('0x2e')]!=='VIRTUAL'){var _0x2588fc={};_0x2588fc[_0x2082b9[_0x7fa6('0x29')]]={'$like':'%'+_0x4453b3['query']['filter']+'%'};return _0x2588fc;}})});}_0x427c22=_[_0x7fa6('0x3e')]({},_0x427c22,_0x4453b3[_0x7fa6('0x3f')]);var _0x1c5e42={'where':_0x427c22[_0x7fa6('0x3b')]};return db[_0x7fa6('0x40')][_0x7fa6('0x20')](_0x1c5e42)[_0x7fa6('0x26')](function(_0x1fdd6d){_0x2a1ed7[_0x7fa6('0x20')]=_0x1fdd6d;if(_0x4453b3[_0x7fa6('0x31')]['includeAll']){_0x427c22[_0x7fa6('0x41')]=[{'all':!![]}];}return db[_0x7fa6('0x40')][_0x7fa6('0x42')](_0x427c22);})[_0x7fa6('0x26')](function(_0x536371){_0x2a1ed7[_0x7fa6('0x43')]=_0x536371;return _0x2a1ed7;})[_0x7fa6('0x26')](respondWithFilteredResult(_0x2e328d,_0x427c22))['catch'](handleError(_0x2e328d,null));};exports[_0x7fa6('0x44')]=function(_0x201f9b,_0xeff69c){var _0x1910cd={'raw':!![],'where':{'id':_0x201f9b['params']['id']}},_0x432923={};_0x432923[_0x7fa6('0x2f')]=_['keys'](db['SquareReport'][_0x7fa6('0x2c')]);_0x432923[_0x7fa6('0x31')]=_[_0x7fa6('0x30')](_0x201f9b[_0x7fa6('0x31')]);_0x432923['filters']=_[_0x7fa6('0x33')](_0x432923[_0x7fa6('0x2f')],_0x432923[_0x7fa6('0x31')]);_0x1910cd[_0x7fa6('0x34')]=_[_0x7fa6('0x33')](_0x432923[_0x7fa6('0x2f')],qs['fields'](_0x201f9b[_0x7fa6('0x31')][_0x7fa6('0x35')]));_0x1910cd[_0x7fa6('0x34')]=_0x1910cd[_0x7fa6('0x34')]['length']?_0x1910cd[_0x7fa6('0x34')]:_0x432923[_0x7fa6('0x2f')];if(_0x201f9b[_0x7fa6('0x31')][_0x7fa6('0x45')]){_0x1910cd[_0x7fa6('0x41')]=[{'all':!![]}];}_0x1910cd=_['merge']({},_0x1910cd,_0x201f9b[_0x7fa6('0x3f')]);return db[_0x7fa6('0x40')]['find'](_0x1910cd)['then'](handleEntityNotFound(_0xeff69c,null))[_0x7fa6('0x26')](respondWithResult(_0xeff69c,null))['catch'](handleError(_0xeff69c,null));};exports[_0x7fa6('0x46')]=function(_0x153e63,_0x2af245){return db[_0x7fa6('0x40')]['create'](_0x153e63[_0x7fa6('0x47')],{})[_0x7fa6('0x26')](respondWithResult(_0x2af245,0xc9))[_0x7fa6('0x48')](handleError(_0x2af245,null));};exports[_0x7fa6('0x49')]=function(_0x11186f,_0x1373e7){if(_0x11186f[_0x7fa6('0x47')]['id']){delete _0x11186f[_0x7fa6('0x47')]['id'];}return db[_0x7fa6('0x40')][_0x7fa6('0x4a')]({'where':{'id':_0x11186f[_0x7fa6('0x4b')]['id']}})[_0x7fa6('0x26')](handleEntityNotFound(_0x1373e7,null))['then'](saveUpdates(_0x11186f[_0x7fa6('0x47')],null))[_0x7fa6('0x26')](respondWithResult(_0x1373e7,null))['catch'](handleError(_0x1373e7,null));};exports[_0x7fa6('0x25')]=function(_0x4f2a38,_0x28e402){return db[_0x7fa6('0x40')][_0x7fa6('0x4a')]({'where':{'id':_0x4f2a38[_0x7fa6('0x4b')]['id']}})[_0x7fa6('0x26')](handleEntityNotFound(_0x28e402,null))[_0x7fa6('0x26')](removeEntity(_0x28e402,null))[_0x7fa6('0x48')](handleError(_0x28e402,null));};exports[_0x7fa6('0x4c')]=function(_0x1a842f,_0x5cee1b){return db['SquareReport'][_0x7fa6('0x4c')]()[_0x7fa6('0x26')](respondWithResult(_0x5cee1b,null))['catch'](handleError(_0x5cee1b,null));}; \ No newline at end of file +var _0x13f5=['rawAttributes','fieldName','type','key','name','query','keys','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','SquareReport','include','findAll','params','intersection','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','send','index','map'];(function(_0x4e1053,_0x1bfa3c){var _0xce1b03=function(_0x5689f1){while(--_0x5689f1){_0x4e1053['push'](_0x4e1053['shift']());}};_0xce1b03(++_0x1bfa3c);}(_0x13f5,0x101));var _0x513f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f5[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x513f('0x0'));var rimraf=require(_0x513f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x513f('0x2'));var rp=require(_0x513f('0x3'));var moment=require(_0x513f('0x4'));var BPromise=require(_0x513f('0x5'));var Mustache=require(_0x513f('0x6'));var util=require(_0x513f('0x7'));var path=require(_0x513f('0x8'));var sox=require(_0x513f('0x9'));var csv=require(_0x513f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x513f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x513f('0xc'));var deskjs=require(_0x513f('0xd'));var toCsv=require(_0x513f('0xa'));var querystring=require('querystring');var Papa=require(_0x513f('0xe'));var Redis=require(_0x513f('0xf'));var authService=require(_0x513f('0x10'));var qs=require(_0x513f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x513f('0x12'));var logger=require(_0x513f('0x13'))(_0x513f('0x14'));var utils=require(_0x513f('0x15'));var config=require(_0x513f('0x16'));var licenseUtil=require(_0x513f('0x17'));var db=require(_0x513f('0x18'))['db'];function respondWithStatusCode(_0x250a8a,_0x221d76){_0x221d76=_0x221d76||0xcc;return function(_0x36e0ac){if(_0x36e0ac){return _0x250a8a['sendStatus'](_0x221d76);}return _0x250a8a['status'](_0x221d76)['end']();};}function respondWithResult(_0x5e41d6,_0xebb3c1){_0xebb3c1=_0xebb3c1||0xc8;return function(_0x368a48){if(_0x368a48){return _0x5e41d6[_0x513f('0x19')](_0xebb3c1)[_0x513f('0x1a')](_0x368a48);}};}function respondWithFilteredResult(_0x1a12c1,_0x2227aa){return function(_0xcd80eb){if(_0xcd80eb){var _0x47ecfb=typeof _0x2227aa[_0x513f('0x1b')]==='undefined'&&typeof _0x2227aa[_0x513f('0x1c')]==='undefined';var _0x3eb42e=_0xcd80eb[_0x513f('0x1d')];var _0x389859=_0x47ecfb?0x0:_0x2227aa[_0x513f('0x1b')];var _0xc1ad7d=_0x47ecfb?_0xcd80eb['count']:_0x2227aa[_0x513f('0x1b')]+_0x2227aa[_0x513f('0x1c')];var _0x1d420d;if(_0xc1ad7d>=_0x3eb42e){_0xc1ad7d=_0x3eb42e;_0x1d420d=0xc8;}else{_0x1d420d=0xce;}_0x1a12c1[_0x513f('0x19')](_0x1d420d);return _0x1a12c1[_0x513f('0x1e')](_0x513f('0x1f'),_0x389859+'-'+_0xc1ad7d+'/'+_0x3eb42e)[_0x513f('0x1a')](_0xcd80eb);}return null;};}function patchUpdates(_0x427ec8){return function(_0x103379){try{jsonpatch[_0x513f('0x20')](_0x103379,_0x427ec8,!![]);}catch(_0x496c5e){return BPromise[_0x513f('0x21')](_0x496c5e);}return _0x103379['save']();};}function saveUpdates(_0x4971b3,_0x1a879d){return function(_0x56e3bf){if(_0x56e3bf){return _0x56e3bf[_0x513f('0x22')](_0x4971b3)[_0x513f('0x23')](function(_0x26136d){return _0x26136d;});}return null;};}function removeEntity(_0x496367,_0x43c7e5){return function(_0x343ab3){if(_0x343ab3){return _0x343ab3[_0x513f('0x24')]()[_0x513f('0x23')](function(){_0x496367[_0x513f('0x19')](0xcc)[_0x513f('0x25')]();});}};}function handleEntityNotFound(_0x1248bb,_0xe943da){return function(_0x43080b){if(!_0x43080b){_0x1248bb[_0x513f('0x26')](0x194);}return _0x43080b;};}function handleError(_0x4842a0,_0x5ac197){_0x5ac197=_0x5ac197||0x1f4;return function(_0x52f501){logger[_0x513f('0x27')](_0x52f501['stack']);if(_0x52f501['name']){delete _0x52f501['name'];}_0x4842a0[_0x513f('0x19')](_0x5ac197)[_0x513f('0x28')](_0x52f501);};}exports[_0x513f('0x29')]=function(_0xd2e647,_0x543001){var _0x47659e={},_0x58d176={},_0x1a31d4={'count':0x0,'rows':[]};var _0xd4dcd5=_[_0x513f('0x2a')](db['SquareReport'][_0x513f('0x2b')],function(_0x122b6e){return{'name':_0x122b6e[_0x513f('0x2c')],'type':_0x122b6e[_0x513f('0x2d')][_0x513f('0x2e')]};});_0x58d176['model']=_['map'](_0xd4dcd5,_0x513f('0x2f'));_0x58d176[_0x513f('0x30')]=_[_0x513f('0x31')](_0xd2e647[_0x513f('0x30')]);_0x58d176['filters']=_['intersection'](_0x58d176['model'],_0x58d176[_0x513f('0x30')]);_0x47659e[_0x513f('0x32')]=_['intersection'](_0x58d176[_0x513f('0x33')],qs[_0x513f('0x34')](_0xd2e647[_0x513f('0x30')]['fields']));_0x47659e['attributes']=_0x47659e['attributes'][_0x513f('0x35')]?_0x47659e[_0x513f('0x32')]:_0x58d176[_0x513f('0x33')];if(!_0xd2e647[_0x513f('0x30')][_0x513f('0x36')](_0x513f('0x37'))){_0x47659e[_0x513f('0x1c')]=qs[_0x513f('0x1c')](_0xd2e647[_0x513f('0x30')][_0x513f('0x1c')]);_0x47659e['offset']=qs['offset'](_0xd2e647[_0x513f('0x30')]['offset']);}_0x47659e[_0x513f('0x38')]=qs['sort'](_0xd2e647[_0x513f('0x30')]['sort']);_0x47659e[_0x513f('0x39')]=qs[_0x513f('0x3a')](_[_0x513f('0x3b')](_0xd2e647[_0x513f('0x30')],_0x58d176[_0x513f('0x3a')]),_0xd4dcd5);if(_0xd2e647['query'][_0x513f('0x3c')]){_0x47659e[_0x513f('0x39')]=_[_0x513f('0x3d')](_0x47659e['where'],{'$or':_['map'](_0xd4dcd5,function(_0x17dc8f){if(_0x17dc8f[_0x513f('0x2d')]!==_0x513f('0x3e')){var _0x5ab2d4={};_0x5ab2d4[_0x17dc8f[_0x513f('0x2f')]]={'$like':'%'+_0xd2e647[_0x513f('0x30')][_0x513f('0x3c')]+'%'};return _0x5ab2d4;}})});}_0x47659e=_[_0x513f('0x3d')]({},_0x47659e,_0xd2e647[_0x513f('0x3f')]);var _0x2a9d72={'where':_0x47659e[_0x513f('0x39')]};return db[_0x513f('0x40')]['count'](_0x2a9d72)[_0x513f('0x23')](function(_0x369e21){_0x1a31d4['count']=_0x369e21;if(_0xd2e647['query']['includeAll']){_0x47659e[_0x513f('0x41')]=[{'all':!![]}];}return db[_0x513f('0x40')][_0x513f('0x42')](_0x47659e);})[_0x513f('0x23')](function(_0x3e5ba1){_0x1a31d4['rows']=_0x3e5ba1;return _0x1a31d4;})['then'](respondWithFilteredResult(_0x543001,_0x47659e))['catch'](handleError(_0x543001,null));};exports['show']=function(_0x36fc8d,_0x40cfc8){var _0x501d32={'raw':!![],'where':{'id':_0x36fc8d[_0x513f('0x43')]['id']}},_0x1c83b1={};_0x1c83b1[_0x513f('0x33')]=_['keys'](db[_0x513f('0x40')][_0x513f('0x2b')]);_0x1c83b1['query']=_[_0x513f('0x31')](_0x36fc8d['query']);_0x1c83b1[_0x513f('0x3a')]=_[_0x513f('0x44')](_0x1c83b1[_0x513f('0x33')],_0x1c83b1['query']);_0x501d32[_0x513f('0x32')]=_[_0x513f('0x44')](_0x1c83b1['model'],qs[_0x513f('0x34')](_0x36fc8d[_0x513f('0x30')][_0x513f('0x34')]));_0x501d32['attributes']=_0x501d32['attributes'][_0x513f('0x35')]?_0x501d32[_0x513f('0x32')]:_0x1c83b1['model'];if(_0x36fc8d[_0x513f('0x30')][_0x513f('0x45')]){_0x501d32[_0x513f('0x41')]=[{'all':!![]}];}_0x501d32=_['merge']({},_0x501d32,_0x36fc8d[_0x513f('0x3f')]);return db[_0x513f('0x40')][_0x513f('0x46')](_0x501d32)[_0x513f('0x23')](handleEntityNotFound(_0x40cfc8,null))[_0x513f('0x23')](respondWithResult(_0x40cfc8,null))[_0x513f('0x47')](handleError(_0x40cfc8,null));};exports['create']=function(_0x133fe6,_0x49a693){return db[_0x513f('0x40')][_0x513f('0x48')](_0x133fe6['body'],{})['then'](respondWithResult(_0x49a693,0xc9))[_0x513f('0x47')](handleError(_0x49a693,null));};exports[_0x513f('0x22')]=function(_0x4a834a,_0x4a248c){if(_0x4a834a[_0x513f('0x49')]['id']){delete _0x4a834a[_0x513f('0x49')]['id'];}return db[_0x513f('0x40')][_0x513f('0x46')]({'where':{'id':_0x4a834a['params']['id']}})[_0x513f('0x23')](handleEntityNotFound(_0x4a248c,null))[_0x513f('0x23')](saveUpdates(_0x4a834a[_0x513f('0x49')],null))[_0x513f('0x23')](respondWithResult(_0x4a248c,null))[_0x513f('0x47')](handleError(_0x4a248c,null));};exports[_0x513f('0x24')]=function(_0x1820e9,_0x3c56af){return db[_0x513f('0x40')][_0x513f('0x46')]({'where':{'id':_0x1820e9['params']['id']}})['then'](handleEntityNotFound(_0x3c56af,null))[_0x513f('0x23')](removeEntity(_0x3c56af,null))['catch'](handleError(_0x3c56af,null));};exports['describe']=function(_0x50b88a,_0x211534){return db[_0x513f('0x40')][_0x513f('0x4a')]()[_0x513f('0x23')](respondWithResult(_0x211534,null))[_0x513f('0x47')](handleError(_0x211534,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2f2f945..07b052a 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 _0xfa31=['util','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash'];(function(_0x4f7122,_0x35e5e5){var _0x1d1053=function(_0x37fd91){while(--_0x37fd91){_0x4f7122['push'](_0x4f7122['shift']());}};_0x1d1053(++_0x35e5e5);}(_0xfa31,0x1df));var _0x1fa3=function(_0x1ad504,_0x250514){_0x1ad504=_0x1ad504-0x0;var _0x3c7b52=_0xfa31[_0x1ad504];return _0x3c7b52;};'use strict';var _=require(_0x1fa3('0x0'));var util=require(_0x1fa3('0x1'));var logger=require('../../config/logger')(_0x1fa3('0x2'));var moment=require(_0x1fa3('0x3'));var BPromise=require(_0x1fa3('0x4'));var rp=require(_0x1fa3('0x5'));var fs=require('fs');var path=require(_0x1fa3('0x6'));var rimraf=require('rimraf');var config=require(_0x1fa3('0x7'));var attributes=require(_0x1fa3('0x8'));module['exports']=function(_0x553319,_0x4ea451){return _0x553319[_0x1fa3('0x9')](_0x1fa3('0xa'),attributes,{'tableName':_0x1fa3('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1fa3('0xc'),_0x1fa3('0xd')]},{'name':'leaveAt','fields':[_0x1fa3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x621b=['request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','api','moment','bluebird'];(function(_0x20e8d6,_0x4d9a75){var _0x44ea29=function(_0x1eb036){while(--_0x1eb036){_0x20e8d6['push'](_0x20e8d6['shift']());}};_0x44ea29(++_0x4d9a75);}(_0x621b,0x13e));var _0xb621=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x621b[_0x4fdcc0];return _0xc0ce94;};'use strict';var _=require('lodash');var util=require(_0xb621('0x0'));var logger=require(_0xb621('0x1'))(_0xb621('0x2'));var moment=require(_0xb621('0x3'));var BPromise=require(_0xb621('0x4'));var rp=require(_0xb621('0x5'));var fs=require('fs');var path=require(_0xb621('0x6'));var rimraf=require(_0xb621('0x7'));var config=require('../../config/environment');var attributes=require(_0xb621('0x8'));module[_0xb621('0x9')]=function(_0xf2f1ce,_0x241347){return _0xf2f1ce[_0xb621('0xa')](_0xb621('0xb'),attributes,{'tableName':_0xb621('0xc'),'paranoid':![],'indexes':[{'name':_0xb621('0xd'),'fields':[_0xb621('0xe'),_0xb621('0xf')]},{'name':_0xb621('0x10'),'fields':[_0xb621('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 223bfe9..6288ac9 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 _0x4cda=['create','body','options','raw','debug','catch','where','attributes','limit','UpdateSquareReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x4cda,0xd6));var _0xa4cd=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0x4cda[_0x50fda9];return _0x36b92b;};'use strict';var _=require(_0xa4cd('0x0'));var util=require('util');var moment=require(_0xa4cd('0x1'));var BPromise=require('bluebird');var rs=require(_0xa4cd('0x2'));var fs=require('fs');var Redis=require(_0xa4cd('0x3'));var db=require(_0xa4cd('0x4'))['db'];var utils=require(_0xa4cd('0x5'));var logger=require(_0xa4cd('0x6'))('rpc');var config=require(_0xa4cd('0x7'));var jayson=require(_0xa4cd('0x8'));var client=jayson[_0xa4cd('0x9')][_0xa4cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xade870,_0x2c6ed4,_0xdbca73){return new BPromise(function(_0x55e8e8,_0x5d6837){return client[_0xa4cd('0xb')](_0xade870,_0xdbca73)[_0xa4cd('0xc')](function(_0x4a73f6){logger[_0xa4cd('0xd')](_0xa4cd('0xe'),_0x2c6ed4,_0xa4cd('0xf'));logger['debug'](_0xa4cd('0x10'),_0x2c6ed4,_0xa4cd('0xf'),JSON[_0xa4cd('0x11')](_0x4a73f6));if(_0x4a73f6['error']){if(_0x4a73f6[_0xa4cd('0x12')][_0xa4cd('0x13')]===0x1f4){logger[_0xa4cd('0x12')]('SquareReport,\x20%s,\x20%s',_0x2c6ed4,_0x4a73f6[_0xa4cd('0x12')]['message']);return _0x5d6837(_0x4a73f6[_0xa4cd('0x12')][_0xa4cd('0x14')]);}logger[_0xa4cd('0x12')](_0xa4cd('0xe'),_0x2c6ed4,_0x4a73f6[_0xa4cd('0x12')]['message']);return _0x55e8e8(_0x4a73f6[_0xa4cd('0x12')][_0xa4cd('0x14')]);}else{logger[_0xa4cd('0xd')]('SquareReport,\x20%s,\x20%s',_0x2c6ed4,_0xa4cd('0xf'));_0x55e8e8(_0x4a73f6[_0xa4cd('0x15')][_0xa4cd('0x14')]);}})['catch'](function(_0x51bb1c){logger[_0xa4cd('0x12')](_0xa4cd('0xe'),_0x2c6ed4,_0x51bb1c);_0x5d6837(_0x51bb1c);});});}exports[_0xa4cd('0x16')]=function(_0x12c06e){var _0x54fbd3=this;return new Promise(function(_0xc67a,_0x43d701){return db[_0xa4cd('0x17')][_0xa4cd('0x18')](_0x12c06e[_0xa4cd('0x19')],{'raw':_0x12c06e[_0xa4cd('0x1a')]?_0x12c06e[_0xa4cd('0x1a')][_0xa4cd('0x1b')]===undefined?!![]:![]:!![]})[_0xa4cd('0xc')](function(_0x5ca445){logger['info']('CreateSquareReport',_0x12c06e);logger[_0xa4cd('0x1c')](_0xa4cd('0x16'),_0x12c06e,JSON[_0xa4cd('0x11')](_0x5ca445));_0xc67a(_0x5ca445);})[_0xa4cd('0x1d')](function(_0x92f0c1){logger[_0xa4cd('0x12')](_0xa4cd('0x16'),_0x92f0c1[_0xa4cd('0x14')],_0x12c06e);_0x43d701(_0x54fbd3['error'](0x1f4,_0x92f0c1[_0xa4cd('0x14')]));});});};exports['UpdateSquareReport']=function(_0x8996d1){var _0x1698d4=this;return new Promise(function(_0x337d59,_0x485074){return db[_0xa4cd('0x17')]['update'](_0x8996d1[_0xa4cd('0x19')],{'raw':_0x8996d1[_0xa4cd('0x1a')]?_0x8996d1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8996d1['options']?_0x8996d1[_0xa4cd('0x1a')][_0xa4cd('0x1e')]||null:null,'attributes':_0x8996d1[_0xa4cd('0x1a')]?_0x8996d1['options'][_0xa4cd('0x1f')]||null:null,'limit':_0x8996d1[_0xa4cd('0x1a')]?_0x8996d1[_0xa4cd('0x1a')][_0xa4cd('0x20')]||null:null})[_0xa4cd('0xc')](function(_0xcf857d){logger[_0xa4cd('0xd')](_0xa4cd('0x21'),_0x8996d1);logger[_0xa4cd('0x1c')]('UpdateSquareReport',_0x8996d1,JSON[_0xa4cd('0x11')](_0xcf857d));_0x337d59(_0xcf857d);})['catch'](function(_0x294284){logger['error'](_0xa4cd('0x21'),_0x294284[_0xa4cd('0x14')],_0x8996d1);_0x485074(_0x1698d4['error'](0x1f4,_0x294284[_0xa4cd('0x14')]));});});}; \ No newline at end of file +var _0xe9a3=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','raw','then','info','catch','update','options','where','attributes','limit','UpdateSquareReport','lodash'];(function(_0x21e0d4,_0x4eba3c){var _0x5a9b11=function(_0x562ae3){while(--_0x562ae3){_0x21e0d4['push'](_0x21e0d4['shift']());}};_0x5a9b11(++_0x4eba3c);}(_0xe9a3,0x1ee));var _0x3e9a=function(_0x2524ed,_0x1926f4){_0x2524ed=_0x2524ed-0x0;var _0x418f40=_0xe9a3[_0x2524ed];return _0x418f40;};'use strict';var _=require(_0x3e9a('0x0'));var util=require(_0x3e9a('0x1'));var moment=require('moment');var BPromise=require(_0x3e9a('0x2'));var rs=require(_0x3e9a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e9a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e9a('0x5'))(_0x3e9a('0x6'));var config=require(_0x3e9a('0x7'));var jayson=require(_0x3e9a('0x8'));var client=jayson[_0x3e9a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xce9308,_0x108676,_0x13aaac){return new BPromise(function(_0x15251d,_0x16575c){return client[_0x3e9a('0xa')](_0xce9308,_0x13aaac)['then'](function(_0x103428){logger['info'](_0x3e9a('0xb'),_0x108676,_0x3e9a('0xc'));logger[_0x3e9a('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x108676,'request\x20sent',JSON[_0x3e9a('0xe')](_0x103428));if(_0x103428[_0x3e9a('0xf')]){if(_0x103428[_0x3e9a('0xf')][_0x3e9a('0x10')]===0x1f4){logger['error'](_0x3e9a('0xb'),_0x108676,_0x103428['error'][_0x3e9a('0x11')]);return _0x16575c(_0x103428[_0x3e9a('0xf')]['message']);}logger[_0x3e9a('0xf')](_0x3e9a('0xb'),_0x108676,_0x103428[_0x3e9a('0xf')][_0x3e9a('0x11')]);return _0x15251d(_0x103428[_0x3e9a('0xf')]['message']);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x108676,_0x3e9a('0xc'));_0x15251d(_0x103428[_0x3e9a('0x12')][_0x3e9a('0x11')]);}})['catch'](function(_0x1a6983){logger[_0x3e9a('0xf')](_0x3e9a('0xb'),_0x108676,_0x1a6983);_0x16575c(_0x1a6983);});});}exports[_0x3e9a('0x13')]=function(_0x4b5511){var _0x1bdcc9=this;return new Promise(function(_0x3892fe,_0x30b1db){return db[_0x3e9a('0x14')][_0x3e9a('0x15')](_0x4b5511[_0x3e9a('0x16')],{'raw':_0x4b5511['options']?_0x4b5511['options'][_0x3e9a('0x17')]===undefined?!![]:![]:!![]})[_0x3e9a('0x18')](function(_0x3b8a44){logger[_0x3e9a('0x19')](_0x3e9a('0x13'),_0x4b5511);logger[_0x3e9a('0xd')](_0x3e9a('0x13'),_0x4b5511,JSON[_0x3e9a('0xe')](_0x3b8a44));_0x3892fe(_0x3b8a44);})[_0x3e9a('0x1a')](function(_0x5786c5){logger[_0x3e9a('0xf')](_0x3e9a('0x13'),_0x5786c5[_0x3e9a('0x11')],_0x4b5511);_0x30b1db(_0x1bdcc9['error'](0x1f4,_0x5786c5[_0x3e9a('0x11')]));});});};exports['UpdateSquareReport']=function(_0x42b929){var _0x4c8827=this;return new Promise(function(_0x1d81b6,_0x309daa){return db[_0x3e9a('0x14')][_0x3e9a('0x1b')](_0x42b929['body'],{'raw':_0x42b929[_0x3e9a('0x1c')]?_0x42b929['options'][_0x3e9a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42b929[_0x3e9a('0x1c')]?_0x42b929[_0x3e9a('0x1c')][_0x3e9a('0x1d')]||null:null,'attributes':_0x42b929['options']?_0x42b929[_0x3e9a('0x1c')][_0x3e9a('0x1e')]||null:null,'limit':_0x42b929['options']?_0x42b929['options'][_0x3e9a('0x1f')]||null:null})[_0x3e9a('0x18')](function(_0x48d9f0){logger['info'](_0x3e9a('0x20'),_0x42b929);logger[_0x3e9a('0xd')](_0x3e9a('0x20'),_0x42b929,JSON['stringify'](_0x48d9f0));_0x1d81b6(_0x48d9f0);})['catch'](function(_0x193ae5){logger['error'](_0x3e9a('0x20'),_0x193ae5[_0x3e9a('0x11')],_0x42b929);_0x309daa(_0x4c8827[_0x3e9a('0xf')](0x1f4,_0x193ae5[_0x3e9a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 137a00a..cdd8929 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 _0x334c=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x334c,0x11d));var _0xc334=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x334c[_0x457b64];return _0x437111;};'use strict';var multer=require('multer');var util=require(_0xc334('0x0'));var path=require(_0xc334('0x1'));var timeout=require(_0xc334('0x2'));var express=require(_0xc334('0x3'));var router=express[_0xc334('0x4')]();var fs_extra=require(_0xc334('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc334('0x6'));var config=require(_0xc334('0x7'));var controller=require(_0xc334('0x8'));router[_0xc334('0x9')]('/',auth[_0xc334('0xa')](),controller[_0xc334('0xb')]);router['get'](_0xc334('0xc'),auth[_0xc334('0xa')](),controller[_0xc334('0xd')]);router[_0xc334('0x9')](_0xc334('0xe'),auth[_0xc334('0xa')](),controller[_0xc334('0xf')]);router[_0xc334('0x10')]('/',auth[_0xc334('0xa')](),controller[_0xc334('0x11')]);router[_0xc334('0x12')]('/:id',auth[_0xc334('0xa')](),controller[_0xc334('0x13')]);router[_0xc334('0x14')](_0xc334('0xe'),auth[_0xc334('0xa')](),controller[_0xc334('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfe0a=['update','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','post','create','put'];(function(_0xed0de9,_0x44e273){var _0x343dea=function(_0x35598c){while(--_0x35598c){_0xed0de9['push'](_0xed0de9['shift']());}};_0x343dea(++_0x44e273);}(_0xfe0a,0x8b));var _0xafe0=function(_0x263c92,_0xd5a777){_0x263c92=_0x263c92-0x0;var _0x1ab2d7=_0xfe0a[_0x263c92];return _0x1ab2d7;};'use strict';var multer=require(_0xafe0('0x0'));var util=require(_0xafe0('0x1'));var path=require('path');var timeout=require(_0xafe0('0x2'));var express=require('express');var router=express[_0xafe0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xafe0('0x4'));var config=require(_0xafe0('0x5'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0xafe0('0x6')](),controller['index']);router[_0xafe0('0x7')](_0xafe0('0x8'),auth[_0xafe0('0x6')](),controller['describe']);router['get'](_0xafe0('0x9'),auth[_0xafe0('0x6')](),controller[_0xafe0('0xa')]);router[_0xafe0('0xb')]('/',auth[_0xafe0('0x6')](),controller[_0xafe0('0xc')]);router[_0xafe0('0xd')](_0xafe0('0x9'),auth[_0xafe0('0x6')](),controller[_0xafe0('0xe')]);router[_0xafe0('0xf')](_0xafe0('0x9'),auth[_0xafe0('0x6')](),controller[_0xafe0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f348ab1..10e59dc 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 _0x2a77=['STRING','TEXT','sequelize','exports'];(function(_0x5adfe9,_0x2929a0){var _0x8c67e5=function(_0x1c7e01){while(--_0x1c7e01){_0x5adfe9['push'](_0x5adfe9['shift']());}};_0x8c67e5(++_0x2929a0);}(_0x2a77,0x1de));var _0x72a7=function(_0x5e8906,_0x18f1e7){_0x5e8906=_0x5e8906-0x0;var _0x3b6622=_0x2a77[_0x5e8906];return _0x3b6622;};'use strict';var Sequelize=require(_0x72a7('0x0'));module[_0x72a7('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x72a7('0x2')]},'application':{'type':Sequelize[_0x72a7('0x2')]},'data':{'type':Sequelize[_0x72a7('0x3')]},'project_name':{'type':Sequelize[_0x72a7('0x2')]},'callerid':{'type':Sequelize[_0x72a7('0x2')]}}; \ No newline at end of file +var _0xb8c9=['sequelize','STRING','TEXT'];(function(_0x26022d,_0x27275a){var _0x4e9ffd=function(_0x3f271f){while(--_0x3f271f){_0x26022d['push'](_0x26022d['shift']());}};_0x4e9ffd(++_0x27275a);}(_0xb8c9,0x165));var _0x9b8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8c9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9b8c('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x9b8c('0x1')]},'application':{'type':Sequelize[_0x9b8c('0x1')]},'data':{'type':Sequelize[_0x9b8c('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9b8c('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 228e9bc..79ba3ee 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 _0x53f0=['count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4a95c4,_0x544ef3){var _0x2a2443=function(_0x4101f7){while(--_0x4101f7){_0x4a95c4['push'](_0x4a95c4['shift']());}};_0x2a2443(++_0x544ef3);}(_0x53f0,0x125));var _0x053f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53f0[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x053f('0x0'));var rimraf=require(_0x053f('0x1'));var zipdir=require(_0x053f('0x2'));var jsonpatch=require(_0x053f('0x3'));var rp=require('request-promise');var moment=require(_0x053f('0x4'));var BPromise=require(_0x053f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x053f('0x6'));var sox=require(_0x053f('0x7'));var csv=require(_0x053f('0x8'));var ejs=require(_0x053f('0x9'));var fs=require('fs');var fs_extra=require(_0x053f('0xa'));var _=require(_0x053f('0xb'));var squel=require(_0x053f('0xc'));var crypto=require(_0x053f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x053f('0xe'));var toCsv=require(_0x053f('0x8'));var querystring=require(_0x053f('0xf'));var Papa=require(_0x053f('0x10'));var Redis=require(_0x053f('0x11'));var authService=require(_0x053f('0x12'));var qs=require(_0x053f('0x13'));var as=require(_0x053f('0x14'));var hardwareService=require(_0x053f('0x15'));var logger=require(_0x053f('0x16'))(_0x053f('0x17'));var utils=require(_0x053f('0x18'));var config=require(_0x053f('0x19'));var licenseUtil=require(_0x053f('0x1a'));var db=require(_0x053f('0x1b'))['db'];function respondWithStatusCode(_0x4a384e,_0x350fcc){_0x350fcc=_0x350fcc||0xcc;return function(_0x4ac3d2){if(_0x4ac3d2){return _0x4a384e[_0x053f('0x1c')](_0x350fcc);}return _0x4a384e[_0x053f('0x1d')](_0x350fcc)[_0x053f('0x1e')]();};}function respondWithResult(_0x48133c,_0x1190a0){_0x1190a0=_0x1190a0||0xc8;return function(_0x32c6ca){if(_0x32c6ca){return _0x48133c[_0x053f('0x1d')](_0x1190a0)[_0x053f('0x1f')](_0x32c6ca);}};}function respondWithFilteredResult(_0x2b235,_0x44e702){return function(_0x2cd3ba){if(_0x2cd3ba){var _0x3d6a5d=typeof _0x44e702[_0x053f('0x20')]===_0x053f('0x21')&&typeof _0x44e702[_0x053f('0x22')]===_0x053f('0x21');var _0x51ebee=_0x2cd3ba[_0x053f('0x23')];var _0x64f317=_0x3d6a5d?0x0:_0x44e702['offset'];var _0x346c35=_0x3d6a5d?_0x2cd3ba['count']:_0x44e702[_0x053f('0x20')]+_0x44e702[_0x053f('0x22')];var _0x14109d;if(_0x346c35>=_0x51ebee){_0x346c35=_0x51ebee;_0x14109d=0xc8;}else{_0x14109d=0xce;}_0x2b235['status'](_0x14109d);return _0x2b235[_0x053f('0x24')]('Content-Range',_0x64f317+'-'+_0x346c35+'/'+_0x51ebee)[_0x053f('0x1f')](_0x2cd3ba);}return null;};}function patchUpdates(_0x249f25){return function(_0x3bd50f){try{jsonpatch[_0x053f('0x25')](_0x3bd50f,_0x249f25,!![]);}catch(_0x2650da){return BPromise[_0x053f('0x26')](_0x2650da);}return _0x3bd50f['save']();};}function saveUpdates(_0x392ff8,_0x4c8616){return function(_0x2428e9){if(_0x2428e9){return _0x2428e9[_0x053f('0x27')](_0x392ff8)[_0x053f('0x28')](function(_0x300c0f){return _0x300c0f;});}return null;};}function removeEntity(_0x377c8e,_0x526533){return function(_0x48cc33){if(_0x48cc33){return _0x48cc33[_0x053f('0x29')]()[_0x053f('0x28')](function(){_0x377c8e[_0x053f('0x1d')](0xcc)[_0x053f('0x1e')]();});}};}function handleEntityNotFound(_0x44c72d,_0x302e54){return function(_0x856070){if(!_0x856070){_0x44c72d[_0x053f('0x1c')](0x194);}return _0x856070;};}function handleError(_0x49a80d,_0x2ce5fc){_0x2ce5fc=_0x2ce5fc||0x1f4;return function(_0x5f0370){logger[_0x053f('0x2a')](_0x5f0370[_0x053f('0x2b')]);if(_0x5f0370[_0x053f('0x2c')]){delete _0x5f0370['name'];}_0x49a80d[_0x053f('0x1d')](_0x2ce5fc)[_0x053f('0x2d')](_0x5f0370);};}exports[_0x053f('0x2e')]=function(_0x10a135,_0x39d885){var _0x1bacb5={},_0x593849={},_0xc4d3fa={'count':0x0,'rows':[]};var _0x500e26=_[_0x053f('0x2f')](db[_0x053f('0x30')][_0x053f('0x31')],function(_0x1f6a6e){return{'name':_0x1f6a6e[_0x053f('0x32')],'type':_0x1f6a6e[_0x053f('0x33')][_0x053f('0x34')]};});_0x593849[_0x053f('0x35')]=_[_0x053f('0x2f')](_0x500e26,'name');_0x593849[_0x053f('0x36')]=_[_0x053f('0x37')](_0x10a135[_0x053f('0x36')]);_0x593849['filters']=_[_0x053f('0x38')](_0x593849['model'],_0x593849[_0x053f('0x36')]);_0x1bacb5[_0x053f('0x39')]=_[_0x053f('0x38')](_0x593849[_0x053f('0x35')],qs[_0x053f('0x3a')](_0x10a135['query'][_0x053f('0x3a')]));_0x1bacb5['attributes']=_0x1bacb5[_0x053f('0x39')]['length']?_0x1bacb5[_0x053f('0x39')]:_0x593849['model'];if(!_0x10a135['query'][_0x053f('0x3b')](_0x053f('0x3c'))){_0x1bacb5['limit']=qs[_0x053f('0x22')](_0x10a135['query'][_0x053f('0x22')]);_0x1bacb5[_0x053f('0x20')]=qs['offset'](_0x10a135[_0x053f('0x36')][_0x053f('0x20')]);}_0x1bacb5[_0x053f('0x3d')]=qs[_0x053f('0x3e')](_0x10a135['query'][_0x053f('0x3e')]);_0x1bacb5[_0x053f('0x3f')]=qs[_0x053f('0x40')](_[_0x053f('0x41')](_0x10a135[_0x053f('0x36')],_0x593849[_0x053f('0x40')]),_0x500e26);if(_0x10a135[_0x053f('0x36')]['filter']){_0x1bacb5['where']=_['merge'](_0x1bacb5[_0x053f('0x3f')],{'$or':_[_0x053f('0x2f')](_0x500e26,function(_0x581890){if(_0x581890[_0x053f('0x33')]!==_0x053f('0x42')){var _0x29d436={};_0x29d436[_0x581890[_0x053f('0x2c')]]={'$like':'%'+_0x10a135[_0x053f('0x36')][_0x053f('0x43')]+'%'};return _0x29d436;}})});}_0x1bacb5=_[_0x053f('0x44')]({},_0x1bacb5,_0x10a135[_0x053f('0x45')]);var _0x42af31={'where':_0x1bacb5[_0x053f('0x3f')]};return db[_0x053f('0x30')]['count'](_0x42af31)[_0x053f('0x28')](function(_0x1b451a){_0xc4d3fa['count']=_0x1b451a;if(_0x10a135[_0x053f('0x36')]['includeAll']){_0x1bacb5[_0x053f('0x46')]=[{'all':!![]}];}return db[_0x053f('0x30')][_0x053f('0x47')](_0x1bacb5);})[_0x053f('0x28')](function(_0x4eb3d4){_0xc4d3fa[_0x053f('0x48')]=_0x4eb3d4;return _0xc4d3fa;})[_0x053f('0x28')](respondWithFilteredResult(_0x39d885,_0x1bacb5))[_0x053f('0x49')](handleError(_0x39d885,null));};exports[_0x053f('0x4a')]=function(_0x142298,_0x34c295){var _0x2fbc61={'raw':!![],'where':{'id':_0x142298[_0x053f('0x4b')]['id']}},_0x5b5ef8={};_0x5b5ef8[_0x053f('0x35')]=_[_0x053f('0x37')](db[_0x053f('0x30')][_0x053f('0x31')]);_0x5b5ef8['query']=_[_0x053f('0x37')](_0x142298[_0x053f('0x36')]);_0x5b5ef8['filters']=_[_0x053f('0x38')](_0x5b5ef8[_0x053f('0x35')],_0x5b5ef8[_0x053f('0x36')]);_0x2fbc61[_0x053f('0x39')]=_['intersection'](_0x5b5ef8[_0x053f('0x35')],qs['fields'](_0x142298[_0x053f('0x36')][_0x053f('0x3a')]));_0x2fbc61[_0x053f('0x39')]=_0x2fbc61[_0x053f('0x39')][_0x053f('0x4c')]?_0x2fbc61[_0x053f('0x39')]:_0x5b5ef8[_0x053f('0x35')];if(_0x142298['query'][_0x053f('0x4d')]){_0x2fbc61[_0x053f('0x46')]=[{'all':!![]}];}_0x2fbc61=_[_0x053f('0x44')]({},_0x2fbc61,_0x142298[_0x053f('0x45')]);return db[_0x053f('0x30')][_0x053f('0x4e')](_0x2fbc61)['then'](handleEntityNotFound(_0x34c295,null))[_0x053f('0x28')](respondWithResult(_0x34c295,null))['catch'](handleError(_0x34c295,null));};exports[_0x053f('0x4f')]=function(_0x11a939,_0x210eff){return db['SquareDetailsReport'][_0x053f('0x4f')](_0x11a939[_0x053f('0x50')],{})[_0x053f('0x28')](respondWithResult(_0x210eff,0xc9))[_0x053f('0x49')](handleError(_0x210eff,null));};exports['update']=function(_0x3bd121,_0x464300){if(_0x3bd121[_0x053f('0x50')]['id']){delete _0x3bd121[_0x053f('0x50')]['id'];}return db['SquareDetailsReport'][_0x053f('0x4e')]({'where':{'id':_0x3bd121['params']['id']}})[_0x053f('0x28')](handleEntityNotFound(_0x464300,null))[_0x053f('0x28')](saveUpdates(_0x3bd121[_0x053f('0x50')],null))[_0x053f('0x28')](respondWithResult(_0x464300,null))[_0x053f('0x49')](handleError(_0x464300,null));};exports[_0x053f('0x29')]=function(_0x262ae9,_0xad660e){return db[_0x053f('0x30')]['find']({'where':{'id':_0x262ae9[_0x053f('0x4b')]['id']}})['then'](handleEntityNotFound(_0xad660e,null))[_0x053f('0x28')](removeEntity(_0xad660e,null))[_0x053f('0x49')](handleError(_0xad660e,null));};exports[_0x053f('0x51')]=function(_0x27663b,_0x372b5d){return db[_0x053f('0x30')]['describe']()['then'](respondWithResult(_0x372b5d,null))[_0x053f('0x49')](handleError(_0x372b5d,null));}; \ No newline at end of file +var _0x5eb6=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','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','count','limit','set','Content-Range','apply','reject','save','then','name','send','index','map','type','key','model','query','attributes','intersection','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','merge','find','create','body','update','destroy','describe','eml-format','rimraf'];(function(_0x284102,_0x574016){var _0x55b997=function(_0x24edfa){while(--_0x24edfa){_0x284102['push'](_0x284102['shift']());}};_0x55b997(++_0x574016);}(_0x5eb6,0x98));var _0x65eb=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5eb6[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x65eb('0x0'));var rimraf=require(_0x65eb('0x1'));var zipdir=require(_0x65eb('0x2'));var jsonpatch=require(_0x65eb('0x3'));var rp=require(_0x65eb('0x4'));var moment=require(_0x65eb('0x5'));var BPromise=require(_0x65eb('0x6'));var Mustache=require(_0x65eb('0x7'));var util=require(_0x65eb('0x8'));var path=require('path');var sox=require(_0x65eb('0x9'));var csv=require(_0x65eb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65eb('0xb'));var _=require('lodash');var squel=require(_0x65eb('0xc'));var crypto=require('crypto');var jsforce=require(_0x65eb('0xd'));var deskjs=require(_0x65eb('0xe'));var toCsv=require(_0x65eb('0xa'));var querystring=require(_0x65eb('0xf'));var Papa=require(_0x65eb('0x10'));var Redis=require(_0x65eb('0x11'));var authService=require(_0x65eb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x65eb('0x13'));var hardwareService=require(_0x65eb('0x14'));var logger=require('../../config/logger')(_0x65eb('0x15'));var utils=require(_0x65eb('0x16'));var config=require(_0x65eb('0x17'));var licenseUtil=require(_0x65eb('0x18'));var db=require(_0x65eb('0x19'))['db'];function respondWithStatusCode(_0x401700,_0x23ea3b){_0x23ea3b=_0x23ea3b||0xcc;return function(_0xaa8a41){if(_0xaa8a41){return _0x401700[_0x65eb('0x1a')](_0x23ea3b);}return _0x401700[_0x65eb('0x1b')](_0x23ea3b)[_0x65eb('0x1c')]();};}function respondWithResult(_0x33ccfc,_0x5a9bab){_0x5a9bab=_0x5a9bab||0xc8;return function(_0x3282b8){if(_0x3282b8){return _0x33ccfc[_0x65eb('0x1b')](_0x5a9bab)[_0x65eb('0x1d')](_0x3282b8);}};}function respondWithFilteredResult(_0x52e6ab,_0xd2c65c){return function(_0x2ce197){if(_0x2ce197){var _0xcc239c=typeof _0xd2c65c[_0x65eb('0x1e')]===_0x65eb('0x1f')&&typeof _0xd2c65c['limit']===_0x65eb('0x1f');var _0xb7be87=_0x2ce197[_0x65eb('0x20')];var _0x23b3ca=_0xcc239c?0x0:_0xd2c65c[_0x65eb('0x1e')];var _0x31d21f=_0xcc239c?_0x2ce197['count']:_0xd2c65c[_0x65eb('0x1e')]+_0xd2c65c[_0x65eb('0x21')];var _0x2b35ec;if(_0x31d21f>=_0xb7be87){_0x31d21f=_0xb7be87;_0x2b35ec=0xc8;}else{_0x2b35ec=0xce;}_0x52e6ab['status'](_0x2b35ec);return _0x52e6ab[_0x65eb('0x22')](_0x65eb('0x23'),_0x23b3ca+'-'+_0x31d21f+'/'+_0xb7be87)['json'](_0x2ce197);}return null;};}function patchUpdates(_0x434be7){return function(_0x2b1944){try{jsonpatch[_0x65eb('0x24')](_0x2b1944,_0x434be7,!![]);}catch(_0x479b4b){return BPromise[_0x65eb('0x25')](_0x479b4b);}return _0x2b1944[_0x65eb('0x26')]();};}function saveUpdates(_0x2a316d,_0x24161e){return function(_0x1fc7e3){if(_0x1fc7e3){return _0x1fc7e3['update'](_0x2a316d)['then'](function(_0x5b17cf){return _0x5b17cf;});}return null;};}function removeEntity(_0x3375fd,_0x48e0ae){return function(_0x371e35){if(_0x371e35){return _0x371e35['destroy']()[_0x65eb('0x27')](function(){_0x3375fd[_0x65eb('0x1b')](0xcc)[_0x65eb('0x1c')]();});}};}function handleEntityNotFound(_0x1e3dd2,_0x56115f){return function(_0x125b74){if(!_0x125b74){_0x1e3dd2[_0x65eb('0x1a')](0x194);}return _0x125b74;};}function handleError(_0x41372d,_0x191e79){_0x191e79=_0x191e79||0x1f4;return function(_0x236eb1){logger['error'](_0x236eb1['stack']);if(_0x236eb1[_0x65eb('0x28')]){delete _0x236eb1[_0x65eb('0x28')];}_0x41372d[_0x65eb('0x1b')](_0x191e79)[_0x65eb('0x29')](_0x236eb1);};}exports[_0x65eb('0x2a')]=function(_0x52c2c2,_0x2bb6c6){var _0x25a12b={},_0x25796f={},_0x39d664={'count':0x0,'rows':[]};var _0x2a4d8a=_[_0x65eb('0x2b')](db['SquareDetailsReport']['rawAttributes'],function(_0x51fcfc){return{'name':_0x51fcfc['fieldName'],'type':_0x51fcfc[_0x65eb('0x2c')][_0x65eb('0x2d')]};});_0x25796f[_0x65eb('0x2e')]=_[_0x65eb('0x2b')](_0x2a4d8a,_0x65eb('0x28'));_0x25796f['query']=_['keys'](_0x52c2c2[_0x65eb('0x2f')]);_0x25796f['filters']=_['intersection'](_0x25796f['model'],_0x25796f[_0x65eb('0x2f')]);_0x25a12b[_0x65eb('0x30')]=_[_0x65eb('0x31')](_0x25796f[_0x65eb('0x2e')],qs['fields'](_0x52c2c2[_0x65eb('0x2f')]['fields']));_0x25a12b['attributes']=_0x25a12b[_0x65eb('0x30')][_0x65eb('0x32')]?_0x25a12b[_0x65eb('0x30')]:_0x25796f[_0x65eb('0x2e')];if(!_0x52c2c2[_0x65eb('0x2f')][_0x65eb('0x33')]('nolimit')){_0x25a12b[_0x65eb('0x21')]=qs[_0x65eb('0x21')](_0x52c2c2['query'][_0x65eb('0x21')]);_0x25a12b['offset']=qs[_0x65eb('0x1e')](_0x52c2c2[_0x65eb('0x2f')][_0x65eb('0x1e')]);}_0x25a12b[_0x65eb('0x34')]=qs[_0x65eb('0x35')](_0x52c2c2[_0x65eb('0x2f')][_0x65eb('0x35')]);_0x25a12b[_0x65eb('0x36')]=qs[_0x65eb('0x37')](_[_0x65eb('0x38')](_0x52c2c2[_0x65eb('0x2f')],_0x25796f[_0x65eb('0x37')]),_0x2a4d8a);if(_0x52c2c2[_0x65eb('0x2f')][_0x65eb('0x39')]){_0x25a12b['where']=_['merge'](_0x25a12b[_0x65eb('0x36')],{'$or':_[_0x65eb('0x2b')](_0x2a4d8a,function(_0x47c2da){if(_0x47c2da['type']!==_0x65eb('0x3a')){var _0x9f3c20={};_0x9f3c20[_0x47c2da['name']]={'$like':'%'+_0x52c2c2[_0x65eb('0x2f')][_0x65eb('0x39')]+'%'};return _0x9f3c20;}})});}_0x25a12b=_['merge']({},_0x25a12b,_0x52c2c2['options']);var _0x19cbb1={'where':_0x25a12b[_0x65eb('0x36')]};return db[_0x65eb('0x3b')][_0x65eb('0x20')](_0x19cbb1)['then'](function(_0xf188cc){_0x39d664['count']=_0xf188cc;if(_0x52c2c2['query'][_0x65eb('0x3c')]){_0x25a12b[_0x65eb('0x3d')]=[{'all':!![]}];}return db[_0x65eb('0x3b')][_0x65eb('0x3e')](_0x25a12b);})[_0x65eb('0x27')](function(_0x16c517){_0x39d664[_0x65eb('0x3f')]=_0x16c517;return _0x39d664;})[_0x65eb('0x27')](respondWithFilteredResult(_0x2bb6c6,_0x25a12b))[_0x65eb('0x40')](handleError(_0x2bb6c6,null));};exports[_0x65eb('0x41')]=function(_0x1b816e,_0x212a0d){var _0x3edccd={'raw':!![],'where':{'id':_0x1b816e[_0x65eb('0x42')]['id']}},_0x4009b8={};_0x4009b8[_0x65eb('0x2e')]=_[_0x65eb('0x43')](db[_0x65eb('0x3b')][_0x65eb('0x44')]);_0x4009b8['query']=_[_0x65eb('0x43')](_0x1b816e['query']);_0x4009b8[_0x65eb('0x37')]=_['intersection'](_0x4009b8[_0x65eb('0x2e')],_0x4009b8[_0x65eb('0x2f')]);_0x3edccd[_0x65eb('0x30')]=_[_0x65eb('0x31')](_0x4009b8[_0x65eb('0x2e')],qs[_0x65eb('0x45')](_0x1b816e[_0x65eb('0x2f')][_0x65eb('0x45')]));_0x3edccd[_0x65eb('0x30')]=_0x3edccd[_0x65eb('0x30')][_0x65eb('0x32')]?_0x3edccd[_0x65eb('0x30')]:_0x4009b8[_0x65eb('0x2e')];if(_0x1b816e[_0x65eb('0x2f')][_0x65eb('0x3c')]){_0x3edccd[_0x65eb('0x3d')]=[{'all':!![]}];}_0x3edccd=_[_0x65eb('0x46')]({},_0x3edccd,_0x1b816e['options']);return db[_0x65eb('0x3b')][_0x65eb('0x47')](_0x3edccd)['then'](handleEntityNotFound(_0x212a0d,null))['then'](respondWithResult(_0x212a0d,null))[_0x65eb('0x40')](handleError(_0x212a0d,null));};exports['create']=function(_0x272611,_0x3cb856){return db['SquareDetailsReport'][_0x65eb('0x48')](_0x272611[_0x65eb('0x49')],{})[_0x65eb('0x27')](respondWithResult(_0x3cb856,0xc9))[_0x65eb('0x40')](handleError(_0x3cb856,null));};exports[_0x65eb('0x4a')]=function(_0x57c3f7,_0x5f7bb9){if(_0x57c3f7[_0x65eb('0x49')]['id']){delete _0x57c3f7['body']['id'];}return db[_0x65eb('0x3b')]['find']({'where':{'id':_0x57c3f7[_0x65eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x5f7bb9,null))[_0x65eb('0x27')](saveUpdates(_0x57c3f7['body'],null))['then'](respondWithResult(_0x5f7bb9,null))[_0x65eb('0x40')](handleError(_0x5f7bb9,null));};exports[_0x65eb('0x4b')]=function(_0x2b00ed,_0x2268b8){return db[_0x65eb('0x3b')][_0x65eb('0x47')]({'where':{'id':_0x2b00ed['params']['id']}})[_0x65eb('0x27')](handleEntityNotFound(_0x2268b8,null))['then'](removeEntity(_0x2268b8,null))[_0x65eb('0x40')](handleError(_0x2268b8,null));};exports[_0x65eb('0x4c')]=function(_0x5154e3,_0x2dd037){return db[_0x65eb('0x3b')][_0x65eb('0x4c')]()[_0x65eb('0x27')](respondWithResult(_0x2dd037,null))['catch'](handleError(_0x2dd037,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d530c83..666fcd9 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 _0xb5f6=['lodash','util','../../config/logger','moment','bluebird','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb5f6,0x1b0));var _0x6b5f=function(_0x260f28,_0x4e9b30){_0x260f28=_0x260f28-0x0;var _0x3aefcc=_0xb5f6[_0x260f28];return _0x3aefcc;};'use strict';var _=require(_0x6b5f('0x0'));var util=require(_0x6b5f('0x1'));var logger=require(_0x6b5f('0x2'))('api');var moment=require(_0x6b5f('0x3'));var BPromise=require(_0x6b5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b5f('0x5'));var attributes=require(_0x6b5f('0x6'));module[_0x6b5f('0x7')]=function(_0x45f90a,_0x1d3bd5){return _0x45f90a[_0x6b5f('0x8')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c80=['../../config/environment','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x57045f,_0x337b63){var _0x249bac=function(_0x39bbd3){while(--_0x39bbd3){_0x57045f['push'](_0x57045f['shift']());}};_0x249bac(++_0x337b63);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07c8('0x0'));var util=require(_0x07c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x07c8('0x2'));var BPromise=require(_0x07c8('0x3'));var rp=require(_0x07c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07c8('0x5'));var config=require(_0x07c8('0x6'));var attributes=require(_0x07c8('0x7'));module['exports']=function(_0xfe1ead,_0x56b8ca){return _0xfe1ead['define'](_0x07c8('0x8'),attributes,{'tableName':_0x07c8('0x9'),'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 ef5023f..1d063a9 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 _0x28f2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareDetailsReport','options','raw','CreateSquareDetailsReport','catch','lodash','util'];(function(_0x48d3fa,_0x3808a6){var _0x4c4995=function(_0x3fab11){while(--_0x3fab11){_0x48d3fa['push'](_0x48d3fa['shift']());}};_0x4c4995(++_0x3808a6);}(_0x28f2,0x193));var _0x228f=function(_0x576df3,_0x1e1d5f){_0x576df3=_0x576df3-0x0;var _0x180fdd=_0x28f2[_0x576df3];return _0x180fdd;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10da58,_0x4a4a44,_0x3ca074){return new BPromise(function(_0x455eb6,_0xf4b011){return client['request'](_0x10da58,_0x3ca074)[_0x228f('0xc')](function(_0x4d0038){logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,'request\x20sent');logger[_0x228f('0xf')](_0x228f('0x10'),_0x4a4a44,_0x228f('0x11'),JSON[_0x228f('0x12')](_0x4d0038));if(_0x4d0038[_0x228f('0x13')]){if(_0x4d0038['error'][_0x228f('0x14')]===0x1f4){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0xf4b011(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}logger[_0x228f('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0x455eb6(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}else{logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,_0x228f('0x11'));_0x455eb6(_0x4d0038['result'][_0x228f('0x15')]);}})['catch'](function(_0x20e687){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x20e687);_0xf4b011(_0x20e687);});});}exports['CreateSquareDetailsReport']=function(_0x2d4819){var _0x4e1968=this;return new Promise(function(_0x33e32e,_0x5b33a6){return db[_0x228f('0x16')]['create'](_0x2d4819['body'],{'raw':_0x2d4819[_0x228f('0x17')]?_0x2d4819['options'][_0x228f('0x18')]===undefined?!![]:![]:!![]})[_0x228f('0xc')](function(_0x1294a8){logger[_0x228f('0xd')](_0x228f('0x19'),_0x2d4819);logger[_0x228f('0xf')](_0x228f('0x19'),_0x2d4819,JSON[_0x228f('0x12')](_0x1294a8));_0x33e32e(_0x1294a8);})[_0x228f('0x1a')](function(_0x4ee0c9){logger[_0x228f('0x13')](_0x228f('0x19'),_0x4ee0c9[_0x228f('0x15')],_0x2d4819);_0x5b33a6(_0x4e1968[_0x228f('0x13')](0x1f4,_0x4ee0c9[_0x228f('0x15')]));});});}; \ No newline at end of file +var _0xefda=['SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d8f7d,_0x1a1cc6){var _0x443bac=function(_0x1dc1b8){while(--_0x1dc1b8){_0x2d8f7d['push'](_0x2d8f7d['shift']());}};_0x443bac(++_0x1a1cc6);}(_0xefda,0x96));var _0xaefd=function(_0x45e378,_0x5c525c){_0x45e378=_0x45e378-0x0;var _0x4b830d=_0xefda[_0x45e378];return _0x4b830d;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});}exports[_0xaefd('0x17')]=function(_0x9748f4){var _0x1737a1=this;return new Promise(function(_0x2db61b,_0x244956){return db['SquareDetailsReport'][_0xaefd('0x18')](_0x9748f4[_0xaefd('0x19')],{'raw':_0x9748f4[_0xaefd('0x1a')]?_0x9748f4[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![]})[_0xaefd('0xb')](function(_0x5282ed){logger[_0xaefd('0x14')](_0xaefd('0x17'),_0x9748f4);logger[_0xaefd('0xd')](_0xaefd('0x17'),_0x9748f4,JSON[_0xaefd('0xf')](_0x5282ed));_0x2db61b(_0x5282ed);})['catch'](function(_0x479486){logger['error'](_0xaefd('0x17'),_0x479486[_0xaefd('0x13')],_0x9748f4);_0x244956(_0x1737a1[_0xaefd('0x10')](0x1f4,_0x479486['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index df66994..7b71993 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 _0xe628=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express','Router'];(function(_0x2bc650,_0x2b7667){var _0x2e7c8d=function(_0x3a5c86){while(--_0x3a5c86){_0x2bc650['push'](_0x2bc650['shift']());}};_0x2e7c8d(++_0x2b7667);}(_0xe628,0x19e));var _0x8e62=function(_0x36910c,_0x5a3928){_0x36910c=_0x36910c-0x0;var _0x23d22a=_0xe628[_0x36910c];return _0x23d22a;};'use strict';var express=require(_0x8e62('0x0'));var router=express[_0x8e62('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x8e62('0x2'));router[_0x8e62('0x3')]('/',auth[_0x8e62('0x4')](),controller[_0x8e62('0x5')]);router[_0x8e62('0x3')](_0x8e62('0x6'),auth[_0x8e62('0x4')](),controller['killProcess']);module[_0x8e62('0x7')]=router; \ No newline at end of file +var _0xde8c=['/process/:pid/kill','killProcess','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0xb25fea,_0x1843f2){var _0x768c47=function(_0x14d397){while(--_0x14d397){_0xb25fea['push'](_0xb25fea['shift']());}};_0x768c47(++_0x1843f2);}(_0xde8c,0x17a));var _0xcde8=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xde8c[_0x1cb18a];return _0x22442e;};'use strict';var express=require('express');var router=express[_0xcde8('0x0')]();var auth=require(_0xcde8('0x1'));var controller=require(_0xcde8('0x2'));router[_0xcde8('0x3')]('/',auth[_0xcde8('0x4')](),controller[_0xcde8('0x5')]);router[_0xcde8('0x3')](_0xcde8('0x6'),auth['isAuthenticated'](),controller[_0xcde8('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 42cf3e9..f8d3986 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 _0x9108=['send','index','then','json','components/import/cm','format','params','pid','split','length','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status'];(function(_0x4dfe12,_0x4ab2c0){var _0x4018e0=function(_0x59bc0e){while(--_0x59bc0e){_0x4dfe12['push'](_0x4dfe12['shift']());}};_0x4018e0(++_0x4ab2c0);}(_0x9108,0xb6));var _0x8910=function(_0x363d4e,_0x78e9a1){_0x363d4e=_0x363d4e-0x0;var _0x8847d9=_0x9108[_0x363d4e];return _0x8847d9;};'use strict';var info=require('systeminformation');var exec=require(_0x8910('0x0'))[_0x8910('0x1')];var logger=require(_0x8910('0x2'))(_0x8910('0x3'));var util=require(_0x8910('0x4'));var BPromise=require(_0x8910('0x5'));var _=require('lodash');function handleError(_0x2af6a7,_0x4faf24,_0x169ba4){_0x4faf24=_0x4faf24||0x1f4;return function(_0x5b9e41){logger[_0x8910('0x6')](_0x8910('0x7'),_0x169ba4,_0x4faf24,util[_0x8910('0x8')](_0x5b9e41,{'showHidden':![],'depth':null}));delete _0x5b9e41['name'];_0x2af6a7[_0x8910('0x9')](_0x4faf24)[_0x8910('0xa')](_0x5b9e41);};}exports[_0x8910('0xb')]=function(_0x8bdd77,_0x54b327){return info['getAllData']()[_0x8910('0xc')](function(_0x16038d){return _0x54b327[_0x8910('0x9')](0xc8)[_0x8910('0xd')](_0x16038d);})['catch'](function(_0x1fdebb){return _0x54b327[_0x8910('0x9')](0x1f4)[_0x8910('0xd')](_0x1fdebb);});};exports['killProcess']=function(_0x5ada59,_0x1e92a8){var _0x5961b8=[_0x8910('0xe')];return new BPromise(function(_0xa9b970,_0x2620ed){return exec(util[_0x8910('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5ada59[_0x8910('0x10')][_0x8910('0x11')]),function(_0x5b8ea8,_0x3b87a7,_0x281be3){if(_0x5b8ea8){return _0x2620ed(_0x5b8ea8);}return _0xa9b970(_0x3b87a7);});})[_0x8910('0xc')](function(_0x191a81){var _0x4673a9=![];var _0x3249d9=_0x191a81[_0x8910('0x12')](/\n/);for(var _0x596a34=0x0,_0x531ab5=_0x5961b8[_0x8910('0x13')];_0x596a34<_0x531ab5,_0x4673a9===![];_0x596a34+=0x1){if(_0x191a81['indexOf'](_0x5961b8[_0x596a34])>=0x0){_0x4673a9=!![];}}if(!_0x4673a9){throw new Error(util[_0x8910('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5ada59[_0x8910('0x10')]['pid']));}process[_0x8910('0x14')](_0x5ada59[_0x8910('0x10')]['pid'],_0x8910('0x15'));return _0x1e92a8[_0x8910('0x9')](0xc8)['json']({'message':util[_0x8910('0xf')](_0x8910('0x16'),_0x5ada59[_0x8910('0x10')][_0x8910('0x11')])});})['catch'](handleError(_0x1e92a8,null,_0x8910('0x17')));}; \ No newline at end of file +var _0x1393=['then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','getAllData'];(function(_0x4d7521,_0x4ffe67){var _0x2a98bb=function(_0x31a011){while(--_0x31a011){_0x4d7521['push'](_0x4d7521['shift']());}};_0x2a98bb(++_0x4ffe67);}(_0x1393,0xef));var _0x3139=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1393[_0x4a9fb1];return _0x348672;};'use strict';var info=require(_0x3139('0x0'));var exec=require(_0x3139('0x1'))[_0x3139('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x3139('0x3'));var BPromise=require(_0x3139('0x4'));var _=require('lodash');function handleError(_0x24bda4,_0x2d90fb,_0x1ab944){_0x2d90fb=_0x2d90fb||0x1f4;return function(_0x208987){logger[_0x3139('0x5')](_0x3139('0x6'),_0x1ab944,_0x2d90fb,util['inspect'](_0x208987,{'showHidden':![],'depth':null}));delete _0x208987[_0x3139('0x7')];_0x24bda4[_0x3139('0x8')](_0x2d90fb)[_0x3139('0x9')](_0x208987);};}exports['index']=function(_0x5e13de,_0x1ac0fd){return info[_0x3139('0xa')]()[_0x3139('0xb')](function(_0x49d976){return _0x1ac0fd[_0x3139('0x8')](0xc8)[_0x3139('0xc')](_0x49d976);})[_0x3139('0xd')](function(_0x532a5c){return _0x1ac0fd['status'](0x1f4)['json'](_0x532a5c);});};exports['killProcess']=function(_0x47bfa4,_0x53c31a){var _0x324488=[_0x3139('0xe')];return new BPromise(function(_0x332f4f,_0x25196b){return exec(util[_0x3139('0xf')](_0x3139('0x10'),_0x47bfa4['params'][_0x3139('0x11')]),function(_0x5dd56f,_0x48d6a8,_0x5a6a24){if(_0x5dd56f){return _0x25196b(_0x5dd56f);}return _0x332f4f(_0x48d6a8);});})[_0x3139('0xb')](function(_0x378860){var _0x1a79e2=![];var _0x29e0ba=_0x378860['split'](/\n/);for(var _0x5b7a22=0x0,_0x107979=_0x324488[_0x3139('0x12')];_0x5b7a22<_0x107979,_0x1a79e2===![];_0x5b7a22+=0x1){if(_0x378860[_0x3139('0x13')](_0x324488[_0x5b7a22])>=0x0){_0x1a79e2=!![];}}if(!_0x1a79e2){throw new Error(util[_0x3139('0xf')](_0x3139('0x14'),_0x47bfa4[_0x3139('0x15')]['pid']));}process[_0x3139('0x16')](_0x47bfa4[_0x3139('0x15')][_0x3139('0x11')],_0x3139('0x17'));return _0x53c31a[_0x3139('0x8')](0xc8)[_0x3139('0xc')]({'message':util[_0x3139('0xf')](_0x3139('0x18'),_0x47bfa4['params'][_0x3139('0x11')])});})[_0x3139('0xd')](handleError(_0x53c31a,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index e999512..ec72588 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 _0x4c4e=['fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete','destroy','multer','path','connect-timeout','express'];(function(_0x2a3107,_0x56acf3){var _0x53768d=function(_0x2bf38b){while(--_0x2bf38b){_0x2a3107['push'](_0x2a3107['shift']());}};_0x53768d(++_0x56acf3);}(_0x4c4e,0x152));var _0xe4c4=function(_0x49bd4f,_0x3a556f){_0x49bd4f=_0x49bd4f-0x0;var _0x467ebb=_0x4c4e[_0x49bd4f];return _0x467ebb;};'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'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4c4('0xe')]('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);router[_0xe4c4('0x10')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['update']);router[_0xe4c4('0x11')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbd50,0x196));var _0x0bd5=function(_0x3932a1,_0x32b58a){_0x3932a1=_0x3932a1-0x0;var _0x3494c9=_0xbd50[_0x3932a1];return _0x3494c9;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index be940d5..b05ac53 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 _0xa958=['sequelize','STRING','name','#0091EA'];(function(_0x4d973c,_0x36153f){var _0x33d408=function(_0x4e1fc3){while(--_0x4e1fc3){_0x4d973c['push'](_0x4d973c['shift']());}};_0x33d408(++_0x36153f);}(_0xa958,0x94));var _0x8a95=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa958[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x8a95('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a95('0x1')],'unique':_0x8a95('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8a95('0x1')],'defaultValue':_0x8a95('0x3')},'description':{'type':Sequelize[_0x8a95('0x1')]}}; \ No newline at end of file +var _0x2c1b=['#0091EA','sequelize','exports','STRING','name'];(function(_0x2f691e,_0x3ec328){var _0x1128bf=function(_0x149118){while(--_0x149118){_0x2f691e['push'](_0x2f691e['shift']());}};_0x1128bf(++_0x3ec328);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x2c1b[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0xb2c1('0x0'));module[_0xb2c1('0x1')]={'name':{'type':Sequelize[_0xb2c1('0x2')],'unique':_0xb2c1('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb2c1('0x2')],'defaultValue':_0xb2c1('0x4')},'description':{'type':Sequelize[_0xb2c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 8a9eda8..a533149 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 _0x01a2=['destroy','get','Tags','UserProfileResource','stack','name','index','Tag','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','include','find','user','role','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then'];(function(_0x350f26,_0x74b8b7){var _0x4fecfb=function(_0x49e57f){while(--_0x49e57f){_0x350f26['push'](_0x350f26['shift']());}};_0x4fecfb(++_0x74b8b7);}(_0x01a2,0x1cb));var _0x201a=function(_0x48f034,_0x2ab9a7){_0x48f034=_0x48f034-0x0;var _0x38f4bc=_0x01a2[_0x48f034];return _0x38f4bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x201a('0x0'));var zipdir=require(_0x201a('0x1'));var jsonpatch=require(_0x201a('0x2'));var rp=require(_0x201a('0x3'));var moment=require(_0x201a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x201a('0x5'));var path=require(_0x201a('0x6'));var sox=require(_0x201a('0x7'));var csv=require(_0x201a('0x8'));var ejs=require(_0x201a('0x9'));var fs=require('fs');var fs_extra=require(_0x201a('0xa'));var _=require(_0x201a('0xb'));var squel=require(_0x201a('0xc'));var crypto=require(_0x201a('0xd'));var jsforce=require(_0x201a('0xe'));var deskjs=require(_0x201a('0xf'));var toCsv=require(_0x201a('0x8'));var querystring=require(_0x201a('0x10'));var Papa=require(_0x201a('0x11'));var Redis=require(_0x201a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x201a('0x13'));var as=require(_0x201a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x201a('0x15'));var utils=require(_0x201a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x201a('0x17'));var db=require(_0x201a('0x18'))['db'];function respondWithStatusCode(_0x19c6ef,_0x2e4f88){_0x2e4f88=_0x2e4f88||0xcc;return function(_0x1dd9df){if(_0x1dd9df){return _0x19c6ef[_0x201a('0x19')](_0x2e4f88);}return _0x19c6ef[_0x201a('0x1a')](_0x2e4f88)[_0x201a('0x1b')]();};}function respondWithResult(_0x534e7b,_0x526d84){_0x526d84=_0x526d84||0xc8;return function(_0x239f77){if(_0x239f77){return _0x534e7b['status'](_0x526d84)[_0x201a('0x1c')](_0x239f77);}};}function respondWithFilteredResult(_0x29ca5c,_0x5924bc){return function(_0x38c5eb){if(_0x38c5eb){var _0x57f5e2=typeof _0x5924bc[_0x201a('0x1d')]===_0x201a('0x1e')&&typeof _0x5924bc[_0x201a('0x1f')]===_0x201a('0x1e');var _0x28a443=_0x38c5eb['count'];var _0x12cc5f=_0x57f5e2?0x0:_0x5924bc[_0x201a('0x1d')];var _0x3d3009=_0x57f5e2?_0x38c5eb[_0x201a('0x20')]:_0x5924bc[_0x201a('0x1d')]+_0x5924bc[_0x201a('0x1f')];var _0x3c932b;if(_0x3d3009>=_0x28a443){_0x3d3009=_0x28a443;_0x3c932b=0xc8;}else{_0x3c932b=0xce;}_0x29ca5c['status'](_0x3c932b);return _0x29ca5c[_0x201a('0x21')]('Content-Range',_0x12cc5f+'-'+_0x3d3009+'/'+_0x28a443)[_0x201a('0x1c')](_0x38c5eb);}return null;};}function patchUpdates(_0x11e5dc){return function(_0x557e93){try{jsonpatch[_0x201a('0x22')](_0x557e93,_0x11e5dc,!![]);}catch(_0x794c79){return BPromise[_0x201a('0x23')](_0x794c79);}return _0x557e93[_0x201a('0x24')]();};}function saveUpdates(_0x437924,_0x465e64){return function(_0x3077a3){if(_0x3077a3){return _0x3077a3[_0x201a('0x25')](_0x437924)[_0x201a('0x26')](function(_0x3298b9){return _0x3298b9;});}return null;};}function removeEntity(_0x3abfdd,_0x1abf5d){return function(_0x60aeb5){if(_0x60aeb5){return _0x60aeb5[_0x201a('0x27')]()[_0x201a('0x26')](function(){var _0x59d919=_0x60aeb5[_0x201a('0x28')]({'plain':!![]});var _0x1c5d78=_0x201a('0x29');return db[_0x201a('0x2a')]['destroy']({'where':{'type':_0x1c5d78,'resourceId':_0x59d919['id']}})[_0x201a('0x26')](function(){return _0x60aeb5;});})[_0x201a('0x26')](function(){_0x3abfdd['status'](0xcc)[_0x201a('0x1b')]();});}};}function handleEntityNotFound(_0x5c43c0,_0x559d33){return function(_0x73806b){if(!_0x73806b){_0x5c43c0[_0x201a('0x19')](0x194);}return _0x73806b;};}function handleError(_0x162fc4,_0x2f6b9f){_0x2f6b9f=_0x2f6b9f||0x1f4;return function(_0x2ec8d5){logger['error'](_0x2ec8d5[_0x201a('0x2b')]);if(_0x2ec8d5[_0x201a('0x2c')]){delete _0x2ec8d5[_0x201a('0x2c')];}_0x162fc4[_0x201a('0x1a')](_0x2f6b9f)['send'](_0x2ec8d5);};}exports[_0x201a('0x2d')]=function(_0x44e6ab,_0xc086de){var _0x1f8fba={},_0x530ef5={},_0x55d6c5={'count':0x0,'rows':[]};var _0x1819cd=_['map'](db[_0x201a('0x2e')][_0x201a('0x2f')],function(_0x46e033){return{'name':_0x46e033[_0x201a('0x30')],'type':_0x46e033['type']['key']};});_0x530ef5['model']=_[_0x201a('0x31')](_0x1819cd,_0x201a('0x2c'));_0x530ef5[_0x201a('0x32')]=_[_0x201a('0x33')](_0x44e6ab[_0x201a('0x32')]);_0x530ef5[_0x201a('0x34')]=_[_0x201a('0x35')](_0x530ef5[_0x201a('0x36')],_0x530ef5[_0x201a('0x32')]);_0x1f8fba[_0x201a('0x37')]=_[_0x201a('0x35')](_0x530ef5[_0x201a('0x36')],qs[_0x201a('0x38')](_0x44e6ab['query'][_0x201a('0x38')]));_0x1f8fba['attributes']=_0x1f8fba[_0x201a('0x37')][_0x201a('0x39')]?_0x1f8fba[_0x201a('0x37')]:_0x530ef5[_0x201a('0x36')];if(!_0x44e6ab[_0x201a('0x32')]['hasOwnProperty']('nolimit')){_0x1f8fba[_0x201a('0x1f')]=qs['limit'](_0x44e6ab[_0x201a('0x32')][_0x201a('0x1f')]);_0x1f8fba[_0x201a('0x1d')]=qs[_0x201a('0x1d')](_0x44e6ab['query'][_0x201a('0x1d')]);}_0x1f8fba[_0x201a('0x3a')]=qs['sort'](_0x44e6ab[_0x201a('0x32')][_0x201a('0x3b')]);_0x1f8fba[_0x201a('0x3c')]=qs['filters'](_[_0x201a('0x3d')](_0x44e6ab[_0x201a('0x32')],_0x530ef5['filters']),_0x1819cd);if(_0x44e6ab[_0x201a('0x32')][_0x201a('0x3e')]){_0x1f8fba[_0x201a('0x3c')]=_[_0x201a('0x3f')](_0x1f8fba[_0x201a('0x3c')],{'$or':_[_0x201a('0x31')](_0x1819cd,function(_0x1c94e3){if(_0x1c94e3[_0x201a('0x40')]!==_0x201a('0x41')){var _0x47ca87={};_0x47ca87[_0x1c94e3[_0x201a('0x2c')]]={'$like':'%'+_0x44e6ab[_0x201a('0x32')][_0x201a('0x3e')]+'%'};return _0x47ca87;}})});}_0x1f8fba=_['merge']({},_0x1f8fba,_0x44e6ab[_0x201a('0x42')]);var _0x31e479={'where':_0x1f8fba[_0x201a('0x3c')]};return db[_0x201a('0x2e')][_0x201a('0x20')](_0x31e479)[_0x201a('0x26')](function(_0x5440b4){_0x55d6c5[_0x201a('0x20')]=_0x5440b4;if(_0x44e6ab[_0x201a('0x32')][_0x201a('0x43')]){_0x1f8fba['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x1f8fba);})[_0x201a('0x26')](function(_0x1277c2){_0x55d6c5[_0x201a('0x44')]=_0x1277c2;return _0x55d6c5;})['then'](respondWithFilteredResult(_0xc086de,_0x1f8fba))[_0x201a('0x45')](handleError(_0xc086de,null));};exports[_0x201a('0x46')]=function(_0x28bd2f,_0x4e2a31){var _0xddaea1={'raw':!![],'where':{'id':_0x28bd2f['params']['id']}},_0x4b873f={};_0x4b873f[_0x201a('0x36')]=_[_0x201a('0x33')](db[_0x201a('0x2e')]['rawAttributes']);_0x4b873f[_0x201a('0x32')]=_[_0x201a('0x33')](_0x28bd2f['query']);_0x4b873f[_0x201a('0x34')]=_[_0x201a('0x35')](_0x4b873f[_0x201a('0x36')],_0x4b873f[_0x201a('0x32')]);_0xddaea1['attributes']=_[_0x201a('0x35')](_0x4b873f[_0x201a('0x36')],qs[_0x201a('0x38')](_0x28bd2f[_0x201a('0x32')][_0x201a('0x38')]));_0xddaea1[_0x201a('0x37')]=_0xddaea1[_0x201a('0x37')][_0x201a('0x39')]?_0xddaea1['attributes']:_0x4b873f[_0x201a('0x36')];if(_0x28bd2f[_0x201a('0x32')]['includeAll']){_0xddaea1[_0x201a('0x47')]=[{'all':!![]}];}_0xddaea1=_[_0x201a('0x3f')]({},_0xddaea1,_0x28bd2f[_0x201a('0x42')]);return db['Tag'][_0x201a('0x48')](_0xddaea1)[_0x201a('0x26')](handleEntityNotFound(_0x4e2a31,null))[_0x201a('0x26')](respondWithResult(_0x4e2a31,null))['catch'](handleError(_0x4e2a31,null));};exports['create']=function(_0x18abb1,_0x19b1f7){return db[_0x201a('0x2e')]['create'](_0x18abb1['body'],{})[_0x201a('0x26')](function(_0x48158c){var _0x17a4d4=_0x18abb1[_0x201a('0x49')][_0x201a('0x28')]({'plain':!![]});if(!_0x17a4d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17a4d4[_0x201a('0x4a')]==='user'){var _0x18c239=_0x48158c[_0x201a('0x28')]({'plain':!![]});var _0x1701c4=_0x201a('0x29');return db[_0x201a('0x4b')]['find']({'where':{'name':_0x1701c4,'userProfileId':_0x17a4d4[_0x201a('0x4c')]},'raw':!![]})[_0x201a('0x26')](function(_0x2b1029){if(_0x2b1029&&_0x2b1029['autoAssociation']===0x0){return db[_0x201a('0x2a')][_0x201a('0x4d')]({'name':_0x18c239[_0x201a('0x2c')],'resourceId':_0x18c239['id'],'type':_0x2b1029[_0x201a('0x2c')],'sectionId':_0x2b1029['id']},{})[_0x201a('0x26')](function(){return _0x48158c;});}else{return _0x48158c;}})['catch'](function(_0xd02c83){logger[_0x201a('0x4e')](_0x201a('0x4f'),_0xd02c83);throw _0xd02c83;});}return _0x48158c;})[_0x201a('0x26')](respondWithResult(_0x19b1f7,0xc9))[_0x201a('0x45')](handleError(_0x19b1f7,null));};exports[_0x201a('0x25')]=function(_0x47cdfd,_0xdcb64d){if(_0x47cdfd[_0x201a('0x50')]['id']){delete _0x47cdfd[_0x201a('0x50')]['id'];}return db['Tag'][_0x201a('0x48')]({'where':{'id':_0x47cdfd['params']['id']}})[_0x201a('0x26')](handleEntityNotFound(_0xdcb64d,null))[_0x201a('0x26')](saveUpdates(_0x47cdfd[_0x201a('0x50')],null))[_0x201a('0x26')](respondWithResult(_0xdcb64d,null))[_0x201a('0x45')](handleError(_0xdcb64d,null));};exports['destroy']=function(_0x4ce083,_0x4e19ed){return db[_0x201a('0x2e')][_0x201a('0x48')]({'where':{'id':_0x4ce083[_0x201a('0x51')]['id']}})[_0x201a('0x26')](handleEntityNotFound(_0x4e19ed,null))[_0x201a('0x26')](removeEntity(_0x4e19ed,null))[_0x201a('0x45')](handleError(_0x4e19ed,null));};exports[_0x201a('0x52')]=function(_0x1d76c4,_0x4318c1){return db[_0x201a('0x2e')][_0x201a('0x52')]()[_0x201a('0x26')](respondWithResult(_0x4318c1,null))['catch'](handleError(_0x4318c1,null));}; \ No newline at end of file +var _0xb9f1=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','UserProfileResource','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3a2aa6,_0x2811b2){var _0x382694=function(_0xa690d0){while(--_0xa690d0){_0x3a2aa6['push'](_0x3a2aa6['shift']());}};_0x382694(++_0x2811b2);}(_0xb9f1,0xfc));var _0x1b9f=function(_0x1b8da9,_0x48aa0b){_0x1b8da9=_0x1b8da9-0x0;var _0x2e5ef1=_0xb9f1[_0x1b8da9];return _0x2e5ef1;};'use strict';var emlformat=require(_0x1b9f('0x0'));var rimraf=require(_0x1b9f('0x1'));var zipdir=require(_0x1b9f('0x2'));var jsonpatch=require(_0x1b9f('0x3'));var rp=require(_0x1b9f('0x4'));var moment=require(_0x1b9f('0x5'));var BPromise=require(_0x1b9f('0x6'));var Mustache=require(_0x1b9f('0x7'));var util=require(_0x1b9f('0x8'));var path=require(_0x1b9f('0x9'));var sox=require(_0x1b9f('0xa'));var csv=require(_0x1b9f('0xb'));var ejs=require(_0x1b9f('0xc'));var fs=require('fs');var fs_extra=require(_0x1b9f('0xd'));var _=require(_0x1b9f('0xe'));var squel=require(_0x1b9f('0xf'));var crypto=require(_0x1b9f('0x10'));var jsforce=require(_0x1b9f('0x11'));var deskjs=require(_0x1b9f('0x12'));var toCsv=require(_0x1b9f('0xb'));var querystring=require(_0x1b9f('0x13'));var Papa=require(_0x1b9f('0x14'));var Redis=require('ioredis');var authService=require(_0x1b9f('0x15'));var qs=require(_0x1b9f('0x16'));var as=require(_0x1b9f('0x17'));var hardwareService=require(_0x1b9f('0x18'));var logger=require(_0x1b9f('0x19'))(_0x1b9f('0x1a'));var utils=require(_0x1b9f('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x1b9f('0x1c'));var db=require(_0x1b9f('0x1d'))['db'];function respondWithStatusCode(_0x449097,_0x37b4b2){_0x37b4b2=_0x37b4b2||0xcc;return function(_0x5611e2){if(_0x5611e2){return _0x449097[_0x1b9f('0x1e')](_0x37b4b2);}return _0x449097[_0x1b9f('0x1f')](_0x37b4b2)[_0x1b9f('0x20')]();};}function respondWithResult(_0x25aa3c,_0xf1fedf){_0xf1fedf=_0xf1fedf||0xc8;return function(_0x4f6fcc){if(_0x4f6fcc){return _0x25aa3c[_0x1b9f('0x1f')](_0xf1fedf)['json'](_0x4f6fcc);}};}function respondWithFilteredResult(_0x20c011,_0x3c0226){return function(_0x43b2e4){if(_0x43b2e4){var _0x4a3551=typeof _0x3c0226[_0x1b9f('0x21')]===_0x1b9f('0x22')&&typeof _0x3c0226['limit']===_0x1b9f('0x22');var _0x412cfd=_0x43b2e4[_0x1b9f('0x23')];var _0x56930f=_0x4a3551?0x0:_0x3c0226['offset'];var _0x4c75c6=_0x4a3551?_0x43b2e4[_0x1b9f('0x23')]:_0x3c0226[_0x1b9f('0x21')]+_0x3c0226[_0x1b9f('0x24')];var _0x38eda5;if(_0x4c75c6>=_0x412cfd){_0x4c75c6=_0x412cfd;_0x38eda5=0xc8;}else{_0x38eda5=0xce;}_0x20c011['status'](_0x38eda5);return _0x20c011[_0x1b9f('0x25')]('Content-Range',_0x56930f+'-'+_0x4c75c6+'/'+_0x412cfd)['json'](_0x43b2e4);}return null;};}function patchUpdates(_0x2727fb){return function(_0x31b01f){try{jsonpatch[_0x1b9f('0x26')](_0x31b01f,_0x2727fb,!![]);}catch(_0x111b04){return BPromise[_0x1b9f('0x27')](_0x111b04);}return _0x31b01f[_0x1b9f('0x28')]();};}function saveUpdates(_0x57be0c,_0x327c95){return function(_0x10506c){if(_0x10506c){return _0x10506c[_0x1b9f('0x29')](_0x57be0c)[_0x1b9f('0x2a')](function(_0x1016de){return _0x1016de;});}return null;};}function removeEntity(_0x5bc85a,_0x101833){return function(_0x4d1152){if(_0x4d1152){return _0x4d1152[_0x1b9f('0x2b')]()['then'](function(){var _0x5d5b90=_0x4d1152[_0x1b9f('0x2c')]({'plain':!![]});var _0x1bb46f=_0x1b9f('0x2d');return db['UserProfileResource'][_0x1b9f('0x2b')]({'where':{'type':_0x1bb46f,'resourceId':_0x5d5b90['id']}})['then'](function(){return _0x4d1152;});})[_0x1b9f('0x2a')](function(){_0x5bc85a[_0x1b9f('0x1f')](0xcc)[_0x1b9f('0x20')]();});}};}function handleEntityNotFound(_0x12aafa,_0x19f4cb){return function(_0x53c31e){if(!_0x53c31e){_0x12aafa[_0x1b9f('0x1e')](0x194);}return _0x53c31e;};}function handleError(_0x2137cb,_0x205a59){_0x205a59=_0x205a59||0x1f4;return function(_0xc03724){logger[_0x1b9f('0x2e')](_0xc03724[_0x1b9f('0x2f')]);if(_0xc03724[_0x1b9f('0x30')]){delete _0xc03724[_0x1b9f('0x30')];}_0x2137cb['status'](_0x205a59)[_0x1b9f('0x31')](_0xc03724);};}exports[_0x1b9f('0x32')]=function(_0x15cf0d,_0x428532){var _0x3f0b0b={},_0x44ea7c={},_0x4245ac={'count':0x0,'rows':[]};var _0x3dcce1=_[_0x1b9f('0x33')](db[_0x1b9f('0x34')][_0x1b9f('0x35')],function(_0x3c38e9){return{'name':_0x3c38e9[_0x1b9f('0x36')],'type':_0x3c38e9[_0x1b9f('0x37')][_0x1b9f('0x38')]};});_0x44ea7c[_0x1b9f('0x39')]=_[_0x1b9f('0x33')](_0x3dcce1,_0x1b9f('0x30'));_0x44ea7c[_0x1b9f('0x3a')]=_[_0x1b9f('0x3b')](_0x15cf0d['query']);_0x44ea7c[_0x1b9f('0x3c')]=_[_0x1b9f('0x3d')](_0x44ea7c[_0x1b9f('0x39')],_0x44ea7c['query']);_0x3f0b0b[_0x1b9f('0x3e')]=_[_0x1b9f('0x3d')](_0x44ea7c['model'],qs[_0x1b9f('0x3f')](_0x15cf0d[_0x1b9f('0x3a')][_0x1b9f('0x3f')]));_0x3f0b0b[_0x1b9f('0x3e')]=_0x3f0b0b[_0x1b9f('0x3e')][_0x1b9f('0x40')]?_0x3f0b0b[_0x1b9f('0x3e')]:_0x44ea7c[_0x1b9f('0x39')];if(!_0x15cf0d[_0x1b9f('0x3a')]['hasOwnProperty']('nolimit')){_0x3f0b0b[_0x1b9f('0x24')]=qs[_0x1b9f('0x24')](_0x15cf0d[_0x1b9f('0x3a')]['limit']);_0x3f0b0b['offset']=qs[_0x1b9f('0x21')](_0x15cf0d[_0x1b9f('0x3a')][_0x1b9f('0x21')]);}_0x3f0b0b[_0x1b9f('0x41')]=qs[_0x1b9f('0x42')](_0x15cf0d[_0x1b9f('0x3a')][_0x1b9f('0x42')]);_0x3f0b0b[_0x1b9f('0x43')]=qs[_0x1b9f('0x3c')](_[_0x1b9f('0x44')](_0x15cf0d[_0x1b9f('0x3a')],_0x44ea7c[_0x1b9f('0x3c')]),_0x3dcce1);if(_0x15cf0d[_0x1b9f('0x3a')][_0x1b9f('0x45')]){_0x3f0b0b[_0x1b9f('0x43')]=_['merge'](_0x3f0b0b['where'],{'$or':_[_0x1b9f('0x33')](_0x3dcce1,function(_0x4cbf7e){if(_0x4cbf7e[_0x1b9f('0x37')]!==_0x1b9f('0x46')){var _0x7dfe45={};_0x7dfe45[_0x4cbf7e[_0x1b9f('0x30')]]={'$like':'%'+_0x15cf0d[_0x1b9f('0x3a')]['filter']+'%'};return _0x7dfe45;}})});}_0x3f0b0b=_[_0x1b9f('0x47')]({},_0x3f0b0b,_0x15cf0d[_0x1b9f('0x48')]);var _0x2fee34={'where':_0x3f0b0b[_0x1b9f('0x43')]};return db[_0x1b9f('0x34')]['count'](_0x2fee34)[_0x1b9f('0x2a')](function(_0x10dc79){_0x4245ac[_0x1b9f('0x23')]=_0x10dc79;if(_0x15cf0d[_0x1b9f('0x3a')][_0x1b9f('0x49')]){_0x3f0b0b['include']=[{'all':!![]}];}return db[_0x1b9f('0x34')][_0x1b9f('0x4a')](_0x3f0b0b);})[_0x1b9f('0x2a')](function(_0x3bafae){_0x4245ac[_0x1b9f('0x4b')]=_0x3bafae;return _0x4245ac;})[_0x1b9f('0x2a')](respondWithFilteredResult(_0x428532,_0x3f0b0b))['catch'](handleError(_0x428532,null));};exports[_0x1b9f('0x4c')]=function(_0x370416,_0x31036b){var _0x1455d8={'raw':!![],'where':{'id':_0x370416[_0x1b9f('0x4d')]['id']}},_0x4443df={};_0x4443df[_0x1b9f('0x39')]=_[_0x1b9f('0x3b')](db[_0x1b9f('0x34')][_0x1b9f('0x35')]);_0x4443df['query']=_[_0x1b9f('0x3b')](_0x370416['query']);_0x4443df['filters']=_[_0x1b9f('0x3d')](_0x4443df[_0x1b9f('0x39')],_0x4443df['query']);_0x1455d8['attributes']=_['intersection'](_0x4443df[_0x1b9f('0x39')],qs['fields'](_0x370416['query']['fields']));_0x1455d8[_0x1b9f('0x3e')]=_0x1455d8[_0x1b9f('0x3e')][_0x1b9f('0x40')]?_0x1455d8['attributes']:_0x4443df['model'];if(_0x370416[_0x1b9f('0x3a')][_0x1b9f('0x49')]){_0x1455d8['include']=[{'all':!![]}];}_0x1455d8=_[_0x1b9f('0x47')]({},_0x1455d8,_0x370416['options']);return db[_0x1b9f('0x34')]['find'](_0x1455d8)['then'](handleEntityNotFound(_0x31036b,null))[_0x1b9f('0x2a')](respondWithResult(_0x31036b,null))[_0x1b9f('0x4e')](handleError(_0x31036b,null));};exports[_0x1b9f('0x4f')]=function(_0x34b454,_0x32aca7){return db[_0x1b9f('0x34')][_0x1b9f('0x4f')](_0x34b454[_0x1b9f('0x50')],{})['then'](function(_0x2d3834){var _0xac65aa=_0x34b454[_0x1b9f('0x51')]['get']({'plain':!![]});if(!_0xac65aa)throw new Error(_0x1b9f('0x52'));if(_0xac65aa['role']===_0x1b9f('0x51')){var _0x1fc9cb=_0x2d3834[_0x1b9f('0x2c')]({'plain':!![]});var _0x549afc=_0x1b9f('0x2d');return db['UserProfileSection'][_0x1b9f('0x53')]({'where':{'name':_0x549afc,'userProfileId':_0xac65aa[_0x1b9f('0x54')]},'raw':!![]})[_0x1b9f('0x2a')](function(_0x1a5fde){if(_0x1a5fde&&_0x1a5fde['autoAssociation']===0x0){return db[_0x1b9f('0x55')]['create']({'name':_0x1fc9cb['name'],'resourceId':_0x1fc9cb['id'],'type':_0x1a5fde['name'],'sectionId':_0x1a5fde['id']},{})[_0x1b9f('0x2a')](function(){return _0x2d3834;});}else{return _0x2d3834;}})[_0x1b9f('0x4e')](function(_0x30e882){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30e882);throw _0x30e882;});}return _0x2d3834;})[_0x1b9f('0x2a')](respondWithResult(_0x32aca7,0xc9))[_0x1b9f('0x4e')](handleError(_0x32aca7,null));};exports[_0x1b9f('0x29')]=function(_0x417517,_0xe5199c){if(_0x417517[_0x1b9f('0x50')]['id']){delete _0x417517[_0x1b9f('0x50')]['id'];}return db[_0x1b9f('0x34')][_0x1b9f('0x53')]({'where':{'id':_0x417517[_0x1b9f('0x4d')]['id']}})[_0x1b9f('0x2a')](handleEntityNotFound(_0xe5199c,null))[_0x1b9f('0x2a')](saveUpdates(_0x417517[_0x1b9f('0x50')],null))[_0x1b9f('0x2a')](respondWithResult(_0xe5199c,null))[_0x1b9f('0x4e')](handleError(_0xe5199c,null));};exports[_0x1b9f('0x2b')]=function(_0x48155d,_0x59ef38){return db[_0x1b9f('0x34')][_0x1b9f('0x53')]({'where':{'id':_0x48155d['params']['id']}})[_0x1b9f('0x2a')](handleEntityNotFound(_0x59ef38,null))[_0x1b9f('0x2a')](removeEntity(_0x59ef38,null))[_0x1b9f('0x4e')](handleError(_0x59ef38,null));};exports[_0x1b9f('0x56')]=function(_0x59cb9a,_0x40276e){return db['Tag'][_0x1b9f('0x56')]()[_0x1b9f('0x2a')](respondWithResult(_0x40276e,null))['catch'](handleError(_0x40276e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fa51af1..dc48efa 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 _0x9370=['exports','define','Tag','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./tag.attributes'];(function(_0x3aa10f,_0x40aea4){var _0x381a0e=function(_0x135068){while(--_0x135068){_0x3aa10f['push'](_0x3aa10f['shift']());}};_0x381a0e(++_0x40aea4);}(_0x9370,0xc9));var _0x0937=function(_0x4f3bc9,_0x472e7d){_0x4f3bc9=_0x4f3bc9-0x0;var _0x5830ce=_0x9370[_0x4f3bc9];return _0x5830ce;};'use strict';var _=require('lodash');var util=require(_0x0937('0x0'));var logger=require(_0x0937('0x1'))('api');var moment=require(_0x0937('0x2'));var BPromise=require(_0x0937('0x3'));var rp=require(_0x0937('0x4'));var fs=require('fs');var path=require(_0x0937('0x5'));var rimraf=require('rimraf');var config=require(_0x0937('0x6'));var attributes=require(_0x0937('0x7'));module[_0x0937('0x8')]=function(_0x69de38,_0x241f3b){return _0x69de38[_0x0937('0x9')](_0x0937('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37a6=['../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x48ea83,_0xb7b30b){var _0x1f6925=function(_0x1f307f){while(--_0x1f307f){_0x48ea83['push'](_0x48ea83['shift']());}};_0x1f6925(++_0xb7b30b);}(_0x37a6,0x8d));var _0x637a=function(_0x363e19,_0x49d55){_0x363e19=_0x363e19-0x0;var _0x4be1a2=_0x37a6[_0x363e19];return _0x4be1a2;};'use strict';var _=require(_0x637a('0x0'));var util=require(_0x637a('0x1'));var logger=require(_0x637a('0x2'))(_0x637a('0x3'));var moment=require(_0x637a('0x4'));var BPromise=require(_0x637a('0x5'));var rp=require(_0x637a('0x6'));var fs=require('fs');var path=require(_0x637a('0x7'));var rimraf=require(_0x637a('0x8'));var config=require(_0x637a('0x9'));var attributes=require(_0x637a('0xa'));module[_0x637a('0xb')]=function(_0x4b7d5f,_0x41eea1){return _0x4b7d5f[_0x637a('0xc')](_0x637a('0xd'),attributes,{'tableName':_0x637a('0xe'),'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 1087e65..29f1151 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x57cfce,_0xa053c7){var _0x4103f9=function(_0x11a2ab){while(--_0x11a2ab){_0x57cfce['push'](_0x57cfce['shift']());}};_0x4103f9(++_0xa053c7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3b63b3,_0x32cd8e){_0x3b63b3=_0x3b63b3-0x0;var _0x116d1d=_0xb43b[_0x3b63b3];return _0x116d1d;};'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')]('Tag,\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')]('Tag,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('Tag,\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 +var _0xfa2b=['jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfa0549,_0x514f56){var _0x5b6725=function(_0x466a34){while(--_0x466a34){_0xfa0549['push'](_0xfa0549['shift']());}};_0x5b6725(++_0x514f56);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x43f9ca,_0x164718){_0x43f9ca=_0x43f9ca-0x0;var _0xb6bf52=_0xfa2b[_0x43f9ca];return _0xb6bf52;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rs=require(_0xbfa2('0x4'));var fs=require('fs');var Redis=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];var utils=require(_0xbfa2('0x7'));var logger=require(_0xbfa2('0x8'))(_0xbfa2('0x9'));var config=require(_0xbfa2('0xa'));var jayson=require(_0xbfa2('0xb'));var client=jayson[_0xbfa2('0xc')][_0xbfa2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ed93,_0x26e9bf,_0x4cd9ae){return new BPromise(function(_0x46a151,_0x4f17e6){return client[_0xbfa2('0xe')](_0x26ed93,_0x4cd9ae)[_0xbfa2('0xf')](function(_0x1b1c13){logger[_0xbfa2('0x10')](_0xbfa2('0x11'),_0x26e9bf,_0xbfa2('0x12'));logger[_0xbfa2('0x13')](_0xbfa2('0x14'),_0x26e9bf,_0xbfa2('0x12'),JSON['stringify'](_0x1b1c13));if(_0x1b1c13['error']){if(_0x1b1c13['error'][_0xbfa2('0x15')]===0x1f4){logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x4f17e6(_0x1b1c13[_0xbfa2('0x16')]['message']);}logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x46a151(_0x1b1c13[_0xbfa2('0x16')]['message']);}else{logger[_0xbfa2('0x10')]('Tag,\x20%s,\x20%s',_0x26e9bf,'request\x20sent');_0x46a151(_0x1b1c13[_0xbfa2('0x18')]['message']);}})['catch'](function(_0xab2c91){logger[_0xbfa2('0x16')]('Tag,\x20%s,\x20%s',_0x26e9bf,_0xab2c91);_0x4f17e6(_0xab2c91);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9452d22..00e0e40 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(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_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'));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 972e9cd..b34aca4 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 _0xd8b0=['exports','sequelize'];(function(_0x65e539,_0x583d3f){var _0x189751=function(_0x2c528c){while(--_0x2c528c){_0x65e539['push'](_0x65e539['shift']());}};_0x189751(++_0x583d3f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 43cbeb8..e0cda45 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 _0xe991=['fieldName','type','key','query','keys','filters','intersection','model','attributes','length','nolimit','sort','where','pick','filter','merge','options','then','includeAll','findAll','catch','show','params','fields','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','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','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','add','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','TeamVoiceQueue','User','findOrCreate','Queue:save','QueueId','online','voicePause','interface','format','SIP/%s','all','upsert','spread','removeAgents','isArray','emit','Queue:remove','TeamVoicePrefix','getAgents','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','stack','name','send','index','map','Team','rawAttributes'];(function(_0x441b1e,_0x249cda){var _0x45bbda=function(_0x74a1cd){while(--_0x74a1cd){_0x441b1e['push'](_0x441b1e['shift']());}};_0x45bbda(++_0x249cda);}(_0xe991,0x6c));var _0x1e99=function(_0x1e688c,_0x3172f4){_0x1e688c=_0x1e688c-0x0;var _0x37b359=_0xe991[_0x1e688c];return _0x37b359;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e99('0x0'));var jsonpatch=require(_0x1e99('0x1'));var rp=require(_0x1e99('0x2'));var moment=require(_0x1e99('0x3'));var BPromise=require(_0x1e99('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1e99('0x5'));var sox=require(_0x1e99('0x6'));var csv=require(_0x1e99('0x7'));var ejs=require(_0x1e99('0x8'));var fs=require('fs');var fs_extra=require(_0x1e99('0x9'));var _=require('lodash');var squel=require(_0x1e99('0xa'));var crypto=require(_0x1e99('0xb'));var jsforce=require(_0x1e99('0xc'));var deskjs=require(_0x1e99('0xd'));var toCsv=require(_0x1e99('0x7'));var querystring=require(_0x1e99('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e99('0xf'));var qs=require(_0x1e99('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e99('0x11'))(_0x1e99('0x12'));var utils=require(_0x1e99('0x13'));var config=require(_0x1e99('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e99('0x15'))['db'];config[_0x1e99('0x16')]=_[_0x1e99('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1e99('0x18'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x3e947e,_0x4a9deb){_0x4a9deb=_0x4a9deb||0xcc;return function(_0x2549b3){if(_0x2549b3){return _0x3e947e[_0x1e99('0x19')](_0x4a9deb);}return _0x3e947e[_0x1e99('0x1a')](_0x4a9deb)[_0x1e99('0x1b')]();};}function respondWithResult(_0x30cfcb,_0x2c6feb){_0x2c6feb=_0x2c6feb||0xc8;return function(_0x4d94df){if(_0x4d94df){return _0x30cfcb[_0x1e99('0x1a')](_0x2c6feb)['json'](_0x4d94df);}};}function respondWithFilteredResult(_0x32583d,_0x5961b9){return function(_0x5db3f9){if(_0x5db3f9){var _0x537f8c=typeof _0x5961b9[_0x1e99('0x1c')]==='undefined'&&typeof _0x5961b9[_0x1e99('0x1d')]==='undefined';var _0x5e9a1e=_0x5db3f9[_0x1e99('0x1e')];var _0x497410=_0x537f8c?0x0:_0x5961b9['offset'];var _0x15cd65=_0x537f8c?_0x5db3f9[_0x1e99('0x1e')]:_0x5961b9[_0x1e99('0x1c')]+_0x5961b9[_0x1e99('0x1d')];var _0x194b01;if(_0x15cd65>=_0x5e9a1e){_0x15cd65=_0x5e9a1e;_0x194b01=0xc8;}else{_0x194b01=0xce;}_0x32583d[_0x1e99('0x1a')](_0x194b01);return _0x32583d[_0x1e99('0x1f')](_0x1e99('0x20'),_0x497410+'-'+_0x15cd65+'/'+_0x5e9a1e)[_0x1e99('0x21')](_0x5db3f9);}return null;};}function patchUpdates(_0x35cc0c){return function(_0x2aca15){try{jsonpatch[_0x1e99('0x22')](_0x2aca15,_0x35cc0c,!![]);}catch(_0x453d82){return BPromise[_0x1e99('0x23')](_0x453d82);}return _0x2aca15[_0x1e99('0x24')]();};}function saveUpdates(_0x15e660,_0x474cf5){return function(_0x32ca7b){if(_0x32ca7b){return _0x32ca7b[_0x1e99('0x25')](_0x15e660)['then'](function(_0x49f6d){return _0x49f6d;});}return null;};}function handleEntityNotFound(_0x162892,_0x2e53ab){return function(_0x5ceecd){if(!_0x5ceecd){_0x162892[_0x1e99('0x19')](0x194);}return _0x5ceecd;};}function handleError(_0x2ddbbb,_0x56e3f7){_0x56e3f7=_0x56e3f7||0x1f4;return function(_0x17b5a6){logger['error'](_0x17b5a6[_0x1e99('0x26')]);if(_0x17b5a6[_0x1e99('0x27')]){delete _0x17b5a6[_0x1e99('0x27')];}_0x2ddbbb['status'](_0x56e3f7)[_0x1e99('0x28')](_0x17b5a6);};}exports[_0x1e99('0x29')]=function(_0x5bde6c,_0xf0e4ba){var _0x2fb82e={},_0x1c394a={},_0x5504ad={'count':0x0,'rows':[]};var _0x3bc2a5=_[_0x1e99('0x2a')](db[_0x1e99('0x2b')][_0x1e99('0x2c')],function(_0x4a8c28){return{'name':_0x4a8c28[_0x1e99('0x2d')],'type':_0x4a8c28[_0x1e99('0x2e')][_0x1e99('0x2f')]};});_0x1c394a['model']=_[_0x1e99('0x2a')](_0x3bc2a5,_0x1e99('0x27'));_0x1c394a[_0x1e99('0x30')]=_[_0x1e99('0x31')](_0x5bde6c[_0x1e99('0x30')]);_0x1c394a[_0x1e99('0x32')]=_[_0x1e99('0x33')](_0x1c394a[_0x1e99('0x34')],_0x1c394a[_0x1e99('0x30')]);_0x2fb82e[_0x1e99('0x35')]=_[_0x1e99('0x33')](_0x1c394a[_0x1e99('0x34')],qs['fields'](_0x5bde6c['query']['fields']));_0x2fb82e['attributes']=_0x2fb82e['attributes'][_0x1e99('0x36')]?_0x2fb82e['attributes']:_0x1c394a[_0x1e99('0x34')];if(!_0x5bde6c[_0x1e99('0x30')]['hasOwnProperty'](_0x1e99('0x37'))){_0x2fb82e['limit']=qs[_0x1e99('0x1d')](_0x5bde6c[_0x1e99('0x30')][_0x1e99('0x1d')]);_0x2fb82e['offset']=qs[_0x1e99('0x1c')](_0x5bde6c['query'][_0x1e99('0x1c')]);}_0x2fb82e['order']=qs[_0x1e99('0x38')](_0x5bde6c[_0x1e99('0x30')]['sort']);_0x2fb82e[_0x1e99('0x39')]=qs[_0x1e99('0x32')](_[_0x1e99('0x3a')](_0x5bde6c['query'],_0x1c394a[_0x1e99('0x32')]),_0x3bc2a5);if(_0x5bde6c[_0x1e99('0x30')][_0x1e99('0x3b')]){_0x2fb82e[_0x1e99('0x39')]=_[_0x1e99('0x3c')](_0x2fb82e[_0x1e99('0x39')],{'$or':_['map'](_0x3bc2a5,function(_0x5ac0fa){if(_0x5ac0fa[_0x1e99('0x2e')]!=='VIRTUAL'){var _0x501a95={};_0x501a95[_0x5ac0fa[_0x1e99('0x27')]]={'$like':'%'+_0x5bde6c[_0x1e99('0x30')][_0x1e99('0x3b')]+'%'};return _0x501a95;}})});}_0x2fb82e=_['merge']({},_0x2fb82e,_0x5bde6c[_0x1e99('0x3d')]);var _0xb75e2e={'where':_0x2fb82e['where']};return db[_0x1e99('0x2b')][_0x1e99('0x1e')](_0xb75e2e)[_0x1e99('0x3e')](function(_0x40f054){_0x5504ad[_0x1e99('0x1e')]=_0x40f054;if(_0x5bde6c[_0x1e99('0x30')][_0x1e99('0x3f')]){_0x2fb82e['include']=[{'all':!![]}];}return db[_0x1e99('0x2b')][_0x1e99('0x40')](_0x2fb82e);})[_0x1e99('0x3e')](function(_0x2b1859){_0x5504ad['rows']=_0x2b1859;return _0x5504ad;})['then'](respondWithFilteredResult(_0xf0e4ba,_0x2fb82e))[_0x1e99('0x41')](handleError(_0xf0e4ba,null));};exports[_0x1e99('0x42')]=function(_0x1591ba,_0x3e1052){var _0x472692={'raw':![],'where':{'id':_0x1591ba[_0x1e99('0x43')]['id']}},_0x4ce594={};_0x4ce594[_0x1e99('0x34')]=_[_0x1e99('0x31')](db['Team'][_0x1e99('0x2c')]);_0x4ce594[_0x1e99('0x30')]=_[_0x1e99('0x31')](_0x1591ba[_0x1e99('0x30')]);_0x4ce594[_0x1e99('0x32')]=_[_0x1e99('0x33')](_0x4ce594[_0x1e99('0x34')],_0x4ce594[_0x1e99('0x30')]);_0x472692[_0x1e99('0x35')]=_[_0x1e99('0x33')](_0x4ce594[_0x1e99('0x34')],qs['fields'](_0x1591ba[_0x1e99('0x30')][_0x1e99('0x44')]));_0x472692['attributes']=_0x472692['attributes'][_0x1e99('0x36')]?_0x472692[_0x1e99('0x35')]:_0x4ce594[_0x1e99('0x34')];if(_0x1591ba['query'][_0x1e99('0x3f')]){_0x472692[_0x1e99('0x45')]=[{'all':!![]}];}_0x472692=_[_0x1e99('0x3c')]({},_0x472692,_0x1591ba['options']);return db[_0x1e99('0x2b')][_0x1e99('0x46')](_0x472692)[_0x1e99('0x3e')](handleEntityNotFound(_0x3e1052,null))[_0x1e99('0x3e')](respondWithResult(_0x3e1052,null))[_0x1e99('0x41')](handleError(_0x3e1052,null));};exports[_0x1e99('0x47')]=function(_0x46080b,_0x2b37e4){return db[_0x1e99('0x2b')][_0x1e99('0x47')](_0x46080b[_0x1e99('0x48')],{})['then'](function(_0x44ad6b){var _0x1d15f9=_0x46080b[_0x1e99('0x49')][_0x1e99('0x4a')]({'plain':!![]});if(!_0x1d15f9)throw new Error(_0x1e99('0x4b'));if(_0x1d15f9[_0x1e99('0x4c')]===_0x1e99('0x49')){var _0x5cde68=_0x44ad6b['get']({'plain':!![]});var _0x501224=_0x1e99('0x4d');return db[_0x1e99('0x4e')][_0x1e99('0x46')]({'where':{'name':_0x501224,'userProfileId':_0x1d15f9['userProfileId']},'raw':!![]})[_0x1e99('0x3e')](function(_0x4e0121){if(_0x4e0121&&_0x4e0121[_0x1e99('0x4f')]===0x0){return db[_0x1e99('0x50')]['create']({'name':_0x5cde68['name'],'resourceId':_0x5cde68['id'],'type':_0x4e0121['name'],'sectionId':_0x4e0121['id']},{})['then'](function(){return _0x44ad6b;});}else{return _0x44ad6b;}})[_0x1e99('0x41')](function(_0x5c4367){logger[_0x1e99('0x51')](_0x1e99('0x52'),_0x5c4367);throw _0x5c4367;});}return _0x44ad6b;})[_0x1e99('0x3e')](respondWithResult(_0x2b37e4,0xc9))[_0x1e99('0x41')](handleError(_0x2b37e4,null));};exports[_0x1e99('0x25')]=function(_0x2a9f63,_0x428429){if(_0x2a9f63['body']['id']){delete _0x2a9f63['body']['id'];}return db[_0x1e99('0x2b')][_0x1e99('0x46')]({'where':{'id':_0x2a9f63[_0x1e99('0x43')]['id']}})[_0x1e99('0x3e')](handleEntityNotFound(_0x428429,null))['then'](saveUpdates(_0x2a9f63[_0x1e99('0x48')],null))['then'](respondWithResult(_0x428429,null))['catch'](handleError(_0x428429,null));};exports[_0x1e99('0x53')]=function(_0x87593a,_0x2f222e){var _0x903e60=_0x87593a[_0x1e99('0x43')]['id'];var _0x52d477=[];return db['sequelize']['transaction'](function(_0x23e6f0){var _0x20ba63=_0x1e99('0x54')+_0x903e60;return db[_0x1e99('0x55')][_0x1e99('0x30')](_0x20ba63,{'type':db[_0x1e99('0x56')][_0x1e99('0x57')][_0x1e99('0x58')],'raw':!![],'transaction':_0x23e6f0})['then'](function(_0x2184f2){_0x52d477=_['map'](_0x2184f2,function(_0x53a0d5){return Number(_0x53a0d5[_0x1e99('0x59')]);});})[_0x1e99('0x3e')](function(){var _0x23bf9a=_0x1e99('0x5a')+_0x903e60;return db[_0x1e99('0x55')]['query'](_0x23bf9a,{'type':db[_0x1e99('0x56')][_0x1e99('0x57')]['SELECT'],'raw':!![],'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(_0x32756e){var _0x5f440b=_['map'](_0x32756e,function(_0x286afc){return Number(_0x286afc['VoiceQueueId']);});return db[_0x1e99('0x5b')][_0x1e99('0x53')]({'where':{'UserId':{'$in':_0x52d477},'VoiceQueueId':{'$in':_0x5f440b}},'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(){var _0x583c0a=_0x1e99('0x5c')+_0x903e60;return db[_0x1e99('0x55')][_0x1e99('0x30')](_0x583c0a,{'type':db[_0x1e99('0x56')][_0x1e99('0x57')][_0x1e99('0x58')],'raw':!![],'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(_0x2bbb2b){var _0x2d5a29=_[_0x1e99('0x2a')](_0x2bbb2b,function(_0x514542){return Number(_0x514542[_0x1e99('0x5d')]);});return db[_0x1e99('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x52d477},'MailQueueId':{'$in':_0x2d5a29}},'transaction':_0x23e6f0});})['then'](function(){var _0xed49b1=_0x1e99('0x5f')+_0x903e60;return db[_0x1e99('0x55')][_0x1e99('0x30')](_0xed49b1,{'type':db[_0x1e99('0x56')][_0x1e99('0x57')][_0x1e99('0x58')],'raw':!![],'transaction':_0x23e6f0});})['then'](function(_0x41039f){var _0x2777b7=_[_0x1e99('0x2a')](_0x41039f,function(_0x2a9268){return Number(_0x2a9268[_0x1e99('0x60')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x52d477},'SmsQueueId':{'$in':_0x2777b7}},'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(){var _0xc281fd=_0x1e99('0x61')+_0x903e60;return db['sequelize'][_0x1e99('0x30')](_0xc281fd,{'type':db[_0x1e99('0x56')]['QueryTypes'][_0x1e99('0x58')],'raw':!![],'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(_0x1bee06){var _0x1af1ad=_['map'](_0x1bee06,function(_0x15e5c8){return Number(_0x15e5c8[_0x1e99('0x62')]);});return db[_0x1e99('0x63')][_0x1e99('0x53')]({'where':{'UserId':{'$in':_0x52d477},'ChatQueueId':{'$in':_0x1af1ad}},'transaction':_0x23e6f0});})['then'](function(){var _0x540659=_0x1e99('0x64')+_0x903e60;return db[_0x1e99('0x55')][_0x1e99('0x30')](_0x540659,{'type':db[_0x1e99('0x56')][_0x1e99('0x57')][_0x1e99('0x58')],'raw':!![],'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(_0x535847){var _0x3d2585=_[_0x1e99('0x2a')](_0x535847,function(_0x266302){return Number(_0x266302[_0x1e99('0x65')]);});return db[_0x1e99('0x66')][_0x1e99('0x53')]({'where':{'UserId':{'$in':_0x52d477},'FaxQueueId':{'$in':_0x3d2585}},'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(){var _0x2ea15d=_0x1e99('0x67')+_0x903e60;return db[_0x1e99('0x55')][_0x1e99('0x30')](_0x2ea15d,{'type':db[_0x1e99('0x56')][_0x1e99('0x57')][_0x1e99('0x58')],'raw':!![],'transaction':_0x23e6f0});})['then'](function(_0x2f7a55){var _0x261603=_[_0x1e99('0x2a')](_0x2f7a55,function(_0x397119){return Number(_0x397119['OpenchannelQueueId']);});return db[_0x1e99('0x68')][_0x1e99('0x53')]({'where':{'UserId':{'$in':_0x52d477},'OpenchannelQueueId':{'$in':_0x261603}},'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(){var _0x54f112=_0x1e99('0x69')+_0x903e60;return db[_0x1e99('0x55')][_0x1e99('0x30')](_0x54f112,{'type':db[_0x1e99('0x56')]['QueryTypes'][_0x1e99('0x58')],'raw':!![],'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(_0x12680e){var _0x27bb1c=_[_0x1e99('0x2a')](_0x12680e,function(_0x1984a6){return Number(_0x1984a6['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x1e99('0x53')]({'where':{'UserId':{'$in':_0x52d477},'WhatsappQueueId':{'$in':_0x27bb1c}},'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(){return db['TeamVoicePrefix'][_0x1e99('0x46')]({'where':{'TeamId':_0x903e60}});})[_0x1e99('0x3e')](function(_0x17cf99){if(_0x17cf99===null){return;}return db[_0x1e99('0x6a')][_0x1e99('0x53')]({'where':{'UserId':{'$in':_0x52d477},'VoicePrefixId':_0x17cf99[_0x1e99('0x6b')]},'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(){return db['Team'][_0x1e99('0x53')]({'where':{'id':_0x903e60},'cascade':!![],'transaction':_0x23e6f0});})[_0x1e99('0x3e')](function(_0x52b73d){if(_0x52b73d===0x0){_0x2f222e[_0x1e99('0x19')](0x194);}else{return db[_0x1e99('0x50')][_0x1e99('0x53')]({'where':{'type':_0x1e99('0x4d'),'resourceId':_0x903e60},'cascade':!![],'transaction':_0x23e6f0})[_0x1e99('0x3e')](function(){_0x2f222e[_0x1e99('0x1a')](0xcc)['end']();});}})[_0x1e99('0x41')](function(_0x296669){_0x2f222e[_0x1e99('0x1a')](0x1f4)[_0x1e99('0x28')](_0x296669);});});};exports[_0x1e99('0x6c')]=function(_0xa53e3f,_0x16ac94,_0x4bacbf){return db[_0x1e99('0x2b')][_0x1e99('0x6d')]({'where':{'id':_0xa53e3f[_0x1e99('0x43')]['id']}})[_0x1e99('0x3e')](handleEntityNotFound(_0x16ac94,null))['then'](function(_0x39fbcd){if(!_0xa53e3f[_0x1e99('0x30')][_0x1e99('0x6e')]||!utils[_0x1e99('0x6f')](_0xa53e3f[_0x1e99('0x30')][_0x1e99('0x6e')])){throw new db['Sequelize'][(_0x1e99('0x70'))](_0x1e99('0x71'));}var _0x37d383={};var _0x13f75d={};_0x13f75d[_0x1e99('0x34')]=_[_0x1e99('0x31')](db[_[_0x1e99('0x72')](_0xa53e3f['query'][_0x1e99('0x6e')][_0x1e99('0x73')]())+_0x1e99('0x74')][_0x1e99('0x2c')]);_0x13f75d[_0x1e99('0x30')]=_['keys'](_0xa53e3f[_0x1e99('0x30')]);_0x13f75d['filters']=_[_0x1e99('0x33')](_0x13f75d[_0x1e99('0x34')],_0x13f75d[_0x1e99('0x30')]);_0x37d383['attributes']=_[_0x1e99('0x33')](_0x13f75d[_0x1e99('0x34')],qs[_0x1e99('0x44')](_0xa53e3f[_0x1e99('0x30')][_0x1e99('0x44')]));_0x37d383[_0x1e99('0x35')]=_0x37d383[_0x1e99('0x35')][_0x1e99('0x36')]?_0x37d383[_0x1e99('0x35')]:_0x13f75d[_0x1e99('0x34')];_0x37d383['limit']=qs[_0x1e99('0x1d')](_0xa53e3f[_0x1e99('0x30')][_0x1e99('0x1d')]);_0x37d383[_0x1e99('0x1c')]=qs[_0x1e99('0x1c')](_0xa53e3f[_0x1e99('0x30')][_0x1e99('0x1c')]);_0x37d383[_0x1e99('0x75')]=qs[_0x1e99('0x38')](_0xa53e3f['query'][_0x1e99('0x38')]);_0x37d383[_0x1e99('0x39')]=qs[_0x1e99('0x32')](_[_0x1e99('0x3a')](_0xa53e3f[_0x1e99('0x30')],_0x13f75d[_0x1e99('0x32')]));_0x37d383=_['merge']({},_0x37d383,_0xa53e3f[_0x1e99('0x3d')]);return _0x39fbcd[_0x1e99('0x4a')+_[_0x1e99('0x72')](_0xa53e3f[_0x1e99('0x30')][_0x1e99('0x6e')]['toLowerCase']())+_0x1e99('0x76')](_0x37d383);})['then'](respondWithResult(_0x16ac94,null))['catch'](handleError(_0x16ac94,null));};exports[_0x1e99('0x77')]=function(_0x581f75,_0x15b9ef,_0x36146f){return db[_0x1e99('0x2b')][_0x1e99('0x6d')]({'where':{'id':_0x581f75['params']['id']}})[_0x1e99('0x3e')](function(_0x1a336d){if(_0x1a336d){if(!_0x581f75[_0x1e99('0x48')][_0x1e99('0x6e')]||!utils[_0x1e99('0x6f')](_0x581f75[_0x1e99('0x48')]['channel'])){throw new db[(_0x1e99('0x56'))][(_0x1e99('0x70'))]('Unknown\x20channel');}return _0x1a336d[_0x1e99('0x78')+_[_0x1e99('0x72')](_0x581f75[_0x1e99('0x48')][_0x1e99('0x6e')]['toLowerCase']())+_0x1e99('0x76')](_0x581f75['body'][_0x1e99('0x79')]);}return null;})[_0x1e99('0x3e')](handleEntityNotFound(_0x15b9ef,null))[_0x1e99('0x3e')](respondWithStatusCode(_0x15b9ef,null))[_0x1e99('0x41')](handleError(_0x15b9ef,null));};exports['removeQueues']=function(_0x1ea631,_0x15ce12,_0x1c1719){return db[_0x1e99('0x2b')]['findOne']({'where':{'id':_0x1ea631[_0x1e99('0x43')]['id']}})[_0x1e99('0x3e')](function(_0x13b165){if(_0x13b165){if(!_0x1ea631['query'][_0x1e99('0x6e')]||!utils[_0x1e99('0x6f')](_0x1ea631[_0x1e99('0x30')]['channel'])){throw new db[(_0x1e99('0x56'))][(_0x1e99('0x70'))]('Unknown\x20channel');}return _0x13b165['remove'+_[_0x1e99('0x72')](_0x1ea631['query'][_0x1e99('0x6e')][_0x1e99('0x73')]())+_0x1e99('0x76')](_0x1ea631['query'][_0x1e99('0x79')]);}return null;})[_0x1e99('0x3e')](handleEntityNotFound(_0x15ce12,null))[_0x1e99('0x3e')](respondWithStatusCode(_0x15ce12,null))[_0x1e99('0x41')](handleError(_0x15ce12,null));};exports[_0x1e99('0x7a')]=function(_0x4516cc,_0x53d35f){var _0x3cfa1f=_['isArray'](_0x4516cc[_0x1e99('0x48')]['ids'])?_0x4516cc['body'][_0x1e99('0x79')]:[_0x4516cc['body'][_0x1e99('0x79')]];var _0x427833=_0x4516cc[_0x1e99('0x43')]['id'];return db[_0x1e99('0x2b')]['find']({'where':{'id':_0x427833}})['then'](handleEntityNotFound(_0x53d35f,null))['then'](function(_0x1b24f2){if(_0x1b24f2){var _0x54b52d=[_0x1e99('0x7b'),_0x1e99('0x7c'),_0x1e99('0x7d'),_0x1e99('0x7e'),_0x1e99('0x7f'),_0x1e99('0x80'),_0x1e99('0x81')];return db['sequelize'][_0x1e99('0x82')](function(_0x2a4836){var _0x27a0f8=_[_0x1e99('0x2a')](_0x54b52d,function(_0x2694dd){var _0x4a9b9a={'attributes':['id','name']};if(_0x2694dd==='Voice'){_0x4a9b9a[_0x1e99('0x83')]={'attributes':[_0x1e99('0x84')]};}return _0x1b24f2[_0x1e99('0x4a')+_0x2694dd+'Queues'](_0x4a9b9a)[_0x1e99('0x3e')](function(_0x39b5f2){var _0xbbbdab=_[_0x1e99('0x2a')](_0x39b5f2,function(_0x4e8342){var _0x12847a=_['map'](_0x3cfa1f,function(_0x4aeb79){var _0x38cce9={'where':{'UserId':_0x4aeb79,[_0x2694dd+'QueueId']:_0x4e8342['id']},'transaction':_0x2a4836};if(_0x2694dd===_0x1e99('0x7b')){_0x38cce9[_0x1e99('0x17')]={'penalty':_0x4e8342[_0x1e99('0x85')][_0x1e99('0x84')]};}return db[_0x1e99('0x86')+_0x2694dd+_0x1e99('0x74')][_0x1e99('0x87')](_0x38cce9)[_0x1e99('0x3e')](function(){socket['emit']('user'+_0x2694dd+_0x1e99('0x88'),{'UserId':_0x4aeb79,[_0x2694dd+_0x1e99('0x89')]:_0x4e8342['id']});if(_0x2694dd!=='Voice'){return;}return db['User'][_0x1e99('0x40')]({'where':{'id':_0x3cfa1f,'online':0x1},'attributes':['id',_0x1e99('0x27'),_0x1e99('0x8a'),_0x1e99('0x8b'),_0x1e99('0x8c')],'raw':!![]})[_0x1e99('0x3e')](function(_0x178030){var _0x2ae9fa=_[_0x1e99('0x2a')](_0x178030,function(_0x1edcf2){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1edcf2[_0x1e99('0x27')],'UserId':_0x1edcf2['id'],'queue_name':_0x4e8342[_0x1e99('0x27')],'VoiceQueueId':_0x4e8342['id'],'interface':_['isNil'](_0x1edcf2[_0x1e99('0x8c')])?util[_0x1e99('0x8d')](_0x1e99('0x8e'),_0x1edcf2['name']):_0x1edcf2[_0x1e99('0x8c')],'paused':_0x1edcf2[_0x1e99('0x8b')]||![],'penalty':_0x4e8342['TeamVoiceQueue']['penalty']},{'transaction':_0x2a4836});});return Promise[_0x1e99('0x8f')](_0x2ae9fa);});});});return Promise[_0x1e99('0x8f')](_0x12847a);});return Promise['all'](_0xbbbdab);})[_0x1e99('0x3e')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x427833}})[_0x1e99('0x3e')](function(_0x149c39){if(_0x149c39){var _0x1002f0=_['map'](_0x3cfa1f,function(_0x970c94){db[_0x1e99('0x6a')][_0x1e99('0x90')]({'UserId':_0x970c94,'VoicePrefixId':_0x149c39['VoicePrefixId']});});return Promise[_0x1e99('0x8f')](_0x1002f0);}});});});return Promise[_0x1e99('0x8f')](_0x27a0f8)[_0x1e99('0x3e')](function(){return _0x1b24f2['addAgents'](_0x3cfa1f,{'transaction':_0x2a4836})[_0x1e99('0x91')](function(_0x5e4d83){return _0x5e4d83;});});});}})[_0x1e99('0x3e')](respondWithResult(_0x53d35f,null))[_0x1e99('0x41')](handleError(_0x53d35f,null));};exports[_0x1e99('0x92')]=function(_0x421a70,_0xbaceb6){var _0x117f15=_[_0x1e99('0x93')](_0x421a70['query'][_0x1e99('0x79')])?_0x421a70['query'][_0x1e99('0x79')]:[_0x421a70['query'][_0x1e99('0x79')]];var _0x441578=_0x421a70[_0x1e99('0x43')]['id'];return db[_0x1e99('0x2b')][_0x1e99('0x46')]({'where':{'id':_0x441578}})['then'](handleEntityNotFound(_0xbaceb6,null))[_0x1e99('0x3e')](function(_0x30802e){if(_0x30802e){var _0x37a0b1=[_0x1e99('0x7b'),_0x1e99('0x7c'),_0x1e99('0x7d'),_0x1e99('0x7e'),'Fax',_0x1e99('0x80'),_0x1e99('0x81')];return db['sequelize'][_0x1e99('0x82')](function(_0xc5d276){var _0x232550=_[_0x1e99('0x2a')](_0x37a0b1,function(_0x5a8023){var _0x10cf5a={'attributes':['id',_0x1e99('0x27')]};return _0x30802e[_0x1e99('0x4a')+_0x5a8023+_0x1e99('0x76')](_0x10cf5a)[_0x1e99('0x3e')](function(_0x5962c3){var _0x516974=_[_0x1e99('0x2a')](_0x5962c3,function(_0x405f81){return _0x405f81[_0x1e99('0x92')](_0x117f15,{'transaction':_0xc5d276})[_0x1e99('0x3e')](function(){var _0x387b78=_[_0x1e99('0x2a')](_0x117f15,function(_0x103b82){socket[_0x1e99('0x94')]('user'+_0x5a8023+_0x1e99('0x95'),{'UserId':Number(_0x103b82),[_0x5a8023+_0x1e99('0x89')]:_0x405f81['id']});if(_0x5a8023!==_0x1e99('0x7b')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x405f81['id'],'UserId':_0x103b82},'transaction':_0xc5d276});});return Promise[_0x1e99('0x8f')](_0x387b78);});});return Promise[_0x1e99('0x8f')](_0x516974);});});return Promise[_0x1e99('0x8f')](_0x232550)['then'](function(){return _0x30802e[_0x1e99('0x92')](_0x117f15,{'transaction':_0xc5d276});})[_0x1e99('0x3e')](function(){return db[_0x1e99('0x96')][_0x1e99('0x6d')]({'where':{'teamId':_0x441578}})[_0x1e99('0x3e')](function(_0x413bb6){if(_0x413bb6){var _0x2e56f1=_[_0x1e99('0x2a')](_0x117f15,function(_0x13d0ea){db[_0x1e99('0x6a')][_0x1e99('0x53')]({'where':{'UserId':_0x13d0ea,'VoicePrefixId':_0x413bb6['VoicePrefixId']}});});return Promise[_0x1e99('0x8f')](_0x2e56f1);}});});});}})[_0x1e99('0x3e')](respondWithStatusCode(_0xbaceb6,null))[_0x1e99('0x41')](handleError(_0xbaceb6,null));};exports[_0x1e99('0x97')]=function(_0x120140,_0x4bb6c7,_0x2113cd){var _0x4a66a9={};var _0x4da078={};var _0x421a7d;var _0x2f7394;return db['Team']['findOne']({'where':{'id':_0x120140[_0x1e99('0x43')]['id']}})[_0x1e99('0x3e')](handleEntityNotFound(_0x4bb6c7,null))[_0x1e99('0x3e')](function(_0x502ff7){if(_0x502ff7){_0x421a7d=_0x502ff7;_0x4da078[_0x1e99('0x34')]=_[_0x1e99('0x31')](db[_0x1e99('0x86')][_0x1e99('0x2c')]);_0x4da078[_0x1e99('0x30')]=_[_0x1e99('0x31')](_0x120140[_0x1e99('0x30')]);_0x4da078[_0x1e99('0x32')]=_[_0x1e99('0x33')](_0x4da078['model'],_0x4da078[_0x1e99('0x30')]);_0x4a66a9['attributes']=_[_0x1e99('0x33')](_0x4da078[_0x1e99('0x34')],qs[_0x1e99('0x44')](_0x120140[_0x1e99('0x30')][_0x1e99('0x44')]));_0x4a66a9[_0x1e99('0x35')]=_0x4a66a9[_0x1e99('0x35')][_0x1e99('0x36')]?_0x4a66a9[_0x1e99('0x35')]:_0x4da078[_0x1e99('0x34')];_0x4a66a9[_0x1e99('0x75')]=qs[_0x1e99('0x38')](_0x120140[_0x1e99('0x30')][_0x1e99('0x38')]);_0x4a66a9[_0x1e99('0x39')]=qs['filters'](_[_0x1e99('0x3a')](_0x120140[_0x1e99('0x30')],_0x4da078[_0x1e99('0x32')]));if(_0x120140[_0x1e99('0x30')][_0x1e99('0x3b')]){_0x4a66a9['where']=_[_0x1e99('0x3c')](_0x4a66a9[_0x1e99('0x39')],{'$or':_['map'](_0x4a66a9[_0x1e99('0x35')],function(_0x24c56e){var _0x39b429={};_0x39b429[_0x24c56e]={'$like':'%'+_0x120140[_0x1e99('0x30')][_0x1e99('0x3b')]+'%'};return _0x39b429;})});}_0x4a66a9=_[_0x1e99('0x3c')]({},_0x4a66a9,_0x120140[_0x1e99('0x3d')]);return _0x421a7d['getAgents'](_0x4a66a9);}})['then'](function(_0x11b378){if(_0x11b378){_0x2f7394=_0x11b378[_0x1e99('0x36')];if(!_0x120140[_0x1e99('0x30')][_0x1e99('0x98')](_0x1e99('0x37'))){_0x4a66a9[_0x1e99('0x1d')]=qs['limit'](_0x120140[_0x1e99('0x30')][_0x1e99('0x1d')]);_0x4a66a9['offset']=qs[_0x1e99('0x1c')](_0x120140[_0x1e99('0x30')][_0x1e99('0x1c')]);}return _0x421a7d[_0x1e99('0x97')](_0x4a66a9);}})['then'](function(_0x17fc8f){if(_0x17fc8f){return _0x17fc8f?{'count':_0x2f7394,'rows':_0x17fc8f}:null;}})[_0x1e99('0x3e')](respondWithResult(_0x4bb6c7,null))['catch'](handleError(_0x4bb6c7,null));}; \ No newline at end of file +var _0x04e1=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','apply','save','then','sendStatus','error','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','destroy','sequelize','transaction','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','UserFaxQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','Teams','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','addQueues','findOne','Queues','removeQueues','remove','ids','addAgents','isArray','Chat','Mail','Openchannel','Whatsapp','through','penalty','QueueId','Voice','TeamVoiceQueue','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Fax','Queue:remove','getAgents','eml-format','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1e9614,_0x390f51){var _0x2c871d=function(_0x28ea3c){while(--_0x28ea3c){_0x1e9614['push'](_0x1e9614['shift']());}};_0x2c871d(++_0x390f51);}(_0x04e1,0x19d));var _0x104e=function(_0x325e3d,_0x2c82b9){_0x325e3d=_0x325e3d-0x0;var _0x3285a5=_0x04e1[_0x325e3d];return _0x3285a5;};'use strict';var emlformat=require(_0x104e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x104e('0x1'));var BPromise=require(_0x104e('0x2'));var Mustache=require(_0x104e('0x3'));var util=require('util');var path=require(_0x104e('0x4'));var sox=require(_0x104e('0x5'));var csv=require(_0x104e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x104e('0x7'));var _=require(_0x104e('0x8'));var squel=require(_0x104e('0x9'));var crypto=require(_0x104e('0xa'));var jsforce=require(_0x104e('0xb'));var deskjs=require(_0x104e('0xc'));var toCsv=require(_0x104e('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x104e('0xd'));var authService=require(_0x104e('0xe'));var qs=require(_0x104e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x104e('0x10'));var utils=require(_0x104e('0x11'));var config=require(_0x104e('0x12'));var licenseUtil=require(_0x104e('0x13'));var db=require(_0x104e('0x14'))['db'];config[_0x104e('0x15')]=_[_0x104e('0x16')](config[_0x104e('0x15')],{'host':_0x104e('0x17'),'port':0x18eb});var socket=require(_0x104e('0x18'))(new Redis(config['redis']));require('./team.socket')[_0x104e('0x19')](socket);function respondWithStatusCode(_0x1d6a6f,_0x9112c7){_0x9112c7=_0x9112c7||0xcc;return function(_0x26a97d){if(_0x26a97d){return _0x1d6a6f['sendStatus'](_0x9112c7);}return _0x1d6a6f[_0x104e('0x1a')](_0x9112c7)[_0x104e('0x1b')]();};}function respondWithResult(_0x4c2399,_0x302735){_0x302735=_0x302735||0xc8;return function(_0x137aef){if(_0x137aef){return _0x4c2399[_0x104e('0x1a')](_0x302735)[_0x104e('0x1c')](_0x137aef);}};}function respondWithFilteredResult(_0x40961f,_0x1203be){return function(_0x32d6d9){if(_0x32d6d9){var _0x31987e=typeof _0x1203be[_0x104e('0x1d')]==='undefined'&&typeof _0x1203be[_0x104e('0x1e')]===_0x104e('0x1f');var _0x27e33d=_0x32d6d9['count'];var _0xc7af64=_0x31987e?0x0:_0x1203be['offset'];var _0x43ee76=_0x31987e?_0x32d6d9[_0x104e('0x20')]:_0x1203be['offset']+_0x1203be['limit'];var _0x1c8e18;if(_0x43ee76>=_0x27e33d){_0x43ee76=_0x27e33d;_0x1c8e18=0xc8;}else{_0x1c8e18=0xce;}_0x40961f['status'](_0x1c8e18);return _0x40961f[_0x104e('0x21')]('Content-Range',_0xc7af64+'-'+_0x43ee76+'/'+_0x27e33d)[_0x104e('0x1c')](_0x32d6d9);}return null;};}function patchUpdates(_0x10080a){return function(_0x31f3b4){try{jsonpatch[_0x104e('0x22')](_0x31f3b4,_0x10080a,!![]);}catch(_0x52bec3){return BPromise['reject'](_0x52bec3);}return _0x31f3b4[_0x104e('0x23')]();};}function saveUpdates(_0x461ad8,_0x52705e){return function(_0x52033f){if(_0x52033f){return _0x52033f['update'](_0x461ad8)[_0x104e('0x24')](function(_0x4f9816){return _0x4f9816;});}return null;};}function handleEntityNotFound(_0x23cabc,_0x56c41a){return function(_0xd2298f){if(!_0xd2298f){_0x23cabc[_0x104e('0x25')](0x194);}return _0xd2298f;};}function handleError(_0x288caa,_0x356372){_0x356372=_0x356372||0x1f4;return function(_0x34f951){logger[_0x104e('0x26')](_0x34f951['stack']);if(_0x34f951[_0x104e('0x27')]){delete _0x34f951[_0x104e('0x27')];}_0x288caa[_0x104e('0x1a')](_0x356372)[_0x104e('0x28')](_0x34f951);};}exports[_0x104e('0x29')]=function(_0x56eb56,_0x11f993){var _0x5cabec={},_0x321f64={},_0x1c5b40={'count':0x0,'rows':[]};var _0x12bb51=_[_0x104e('0x2a')](db[_0x104e('0x2b')][_0x104e('0x2c')],function(_0x123173){return{'name':_0x123173[_0x104e('0x2d')],'type':_0x123173['type'][_0x104e('0x2e')]};});_0x321f64[_0x104e('0x2f')]=_[_0x104e('0x2a')](_0x12bb51,_0x104e('0x27'));_0x321f64[_0x104e('0x30')]=_[_0x104e('0x31')](_0x56eb56[_0x104e('0x30')]);_0x321f64[_0x104e('0x32')]=_[_0x104e('0x33')](_0x321f64[_0x104e('0x2f')],_0x321f64['query']);_0x5cabec[_0x104e('0x34')]=_[_0x104e('0x33')](_0x321f64[_0x104e('0x2f')],qs['fields'](_0x56eb56[_0x104e('0x30')][_0x104e('0x35')]));_0x5cabec['attributes']=_0x5cabec['attributes'][_0x104e('0x36')]?_0x5cabec[_0x104e('0x34')]:_0x321f64[_0x104e('0x2f')];if(!_0x56eb56[_0x104e('0x30')]['hasOwnProperty'](_0x104e('0x37'))){_0x5cabec[_0x104e('0x1e')]=qs[_0x104e('0x1e')](_0x56eb56['query'][_0x104e('0x1e')]);_0x5cabec[_0x104e('0x1d')]=qs[_0x104e('0x1d')](_0x56eb56[_0x104e('0x30')]['offset']);}_0x5cabec[_0x104e('0x38')]=qs[_0x104e('0x39')](_0x56eb56[_0x104e('0x30')][_0x104e('0x39')]);_0x5cabec[_0x104e('0x3a')]=qs['filters'](_[_0x104e('0x3b')](_0x56eb56[_0x104e('0x30')],_0x321f64['filters']),_0x12bb51);if(_0x56eb56['query'][_0x104e('0x3c')]){_0x5cabec['where']=_[_0x104e('0x3d')](_0x5cabec[_0x104e('0x3a')],{'$or':_[_0x104e('0x2a')](_0x12bb51,function(_0x531574){if(_0x531574[_0x104e('0x3e')]!=='VIRTUAL'){var _0x3616c6={};_0x3616c6[_0x531574[_0x104e('0x27')]]={'$like':'%'+_0x56eb56[_0x104e('0x30')][_0x104e('0x3c')]+'%'};return _0x3616c6;}})});}_0x5cabec=_[_0x104e('0x3d')]({},_0x5cabec,_0x56eb56[_0x104e('0x3f')]);var _0x320dff={'where':_0x5cabec[_0x104e('0x3a')]};return db[_0x104e('0x2b')]['count'](_0x320dff)[_0x104e('0x24')](function(_0x55e806){_0x1c5b40[_0x104e('0x20')]=_0x55e806;if(_0x56eb56[_0x104e('0x30')][_0x104e('0x40')]){_0x5cabec[_0x104e('0x41')]=[{'all':!![]}];}return db[_0x104e('0x2b')][_0x104e('0x42')](_0x5cabec);})['then'](function(_0x36fa4a){_0x1c5b40[_0x104e('0x43')]=_0x36fa4a;return _0x1c5b40;})[_0x104e('0x24')](respondWithFilteredResult(_0x11f993,_0x5cabec))[_0x104e('0x44')](handleError(_0x11f993,null));};exports[_0x104e('0x45')]=function(_0x7ca2f3,_0x382c3c){var _0x5bb89b={'raw':![],'where':{'id':_0x7ca2f3[_0x104e('0x46')]['id']}},_0x46ac31={};_0x46ac31[_0x104e('0x2f')]=_['keys'](db[_0x104e('0x2b')][_0x104e('0x2c')]);_0x46ac31[_0x104e('0x30')]=_[_0x104e('0x31')](_0x7ca2f3[_0x104e('0x30')]);_0x46ac31['filters']=_[_0x104e('0x33')](_0x46ac31[_0x104e('0x2f')],_0x46ac31['query']);_0x5bb89b[_0x104e('0x34')]=_[_0x104e('0x33')](_0x46ac31['model'],qs[_0x104e('0x35')](_0x7ca2f3[_0x104e('0x30')][_0x104e('0x35')]));_0x5bb89b[_0x104e('0x34')]=_0x5bb89b['attributes'][_0x104e('0x36')]?_0x5bb89b['attributes']:_0x46ac31['model'];if(_0x7ca2f3[_0x104e('0x30')][_0x104e('0x40')]){_0x5bb89b[_0x104e('0x41')]=[{'all':!![]}];}_0x5bb89b=_[_0x104e('0x3d')]({},_0x5bb89b,_0x7ca2f3[_0x104e('0x3f')]);return db[_0x104e('0x2b')][_0x104e('0x47')](_0x5bb89b)[_0x104e('0x24')](handleEntityNotFound(_0x382c3c,null))[_0x104e('0x24')](respondWithResult(_0x382c3c,null))[_0x104e('0x44')](handleError(_0x382c3c,null));};exports['create']=function(_0x19a70a,_0x44ddcf){return db[_0x104e('0x2b')][_0x104e('0x48')](_0x19a70a[_0x104e('0x49')],{})[_0x104e('0x24')](function(_0x7d6589){var _0x262bdf=_0x19a70a['user'][_0x104e('0x4a')]({'plain':!![]});if(!_0x262bdf)throw new Error(_0x104e('0x4b'));if(_0x262bdf[_0x104e('0x4c')]===_0x104e('0x4d')){var _0x13f78e=_0x7d6589['get']({'plain':!![]});var _0x329988='Teams';return db[_0x104e('0x4e')][_0x104e('0x47')]({'where':{'name':_0x329988,'userProfileId':_0x262bdf['userProfileId']},'raw':!![]})[_0x104e('0x24')](function(_0x2101c6){if(_0x2101c6&&_0x2101c6[_0x104e('0x4f')]===0x0){return db[_0x104e('0x50')][_0x104e('0x48')]({'name':_0x13f78e[_0x104e('0x27')],'resourceId':_0x13f78e['id'],'type':_0x2101c6['name'],'sectionId':_0x2101c6['id']},{})[_0x104e('0x24')](function(){return _0x7d6589;});}else{return _0x7d6589;}})[_0x104e('0x44')](function(_0x35bf48){logger[_0x104e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35bf48);throw _0x35bf48;});}return _0x7d6589;})[_0x104e('0x24')](respondWithResult(_0x44ddcf,0xc9))[_0x104e('0x44')](handleError(_0x44ddcf,null));};exports['update']=function(_0x128298,_0x2fd19c){if(_0x128298[_0x104e('0x49')]['id']){delete _0x128298[_0x104e('0x49')]['id'];}return db[_0x104e('0x2b')]['find']({'where':{'id':_0x128298[_0x104e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fd19c,null))['then'](saveUpdates(_0x128298[_0x104e('0x49')],null))[_0x104e('0x24')](respondWithResult(_0x2fd19c,null))[_0x104e('0x44')](handleError(_0x2fd19c,null));};exports[_0x104e('0x51')]=function(_0x1046cd,_0x441d7a){var _0x445953=_0x1046cd['params']['id'];var _0x29a3f4=[];return db[_0x104e('0x52')][_0x104e('0x53')](function(_0x5dac3b){var _0x21650a='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x445953;return db['sequelize']['query'](_0x21650a,{'type':db['Sequelize']['QueryTypes'][_0x104e('0x54')],'raw':!![],'transaction':_0x5dac3b})['then'](function(_0x5f0100){_0x29a3f4=_[_0x104e('0x2a')](_0x5f0100,function(_0x47564a){return Number(_0x47564a['UserId']);});})[_0x104e('0x24')](function(){var _0xf27b35=_0x104e('0x55')+_0x445953;return db[_0x104e('0x52')][_0x104e('0x30')](_0xf27b35,{'type':db[_0x104e('0x56')]['QueryTypes'][_0x104e('0x54')],'raw':!![],'transaction':_0x5dac3b});})[_0x104e('0x24')](function(_0x576437){var _0xbac957=_[_0x104e('0x2a')](_0x576437,function(_0x442f4d){return Number(_0x442f4d['VoiceQueueId']);});return db[_0x104e('0x57')]['destroy']({'where':{'UserId':{'$in':_0x29a3f4},'VoiceQueueId':{'$in':_0xbac957}},'transaction':_0x5dac3b});})[_0x104e('0x24')](function(){var _0x4c0000=_0x104e('0x58')+_0x445953;return db[_0x104e('0x52')][_0x104e('0x30')](_0x4c0000,{'type':db['Sequelize'][_0x104e('0x59')]['SELECT'],'raw':!![],'transaction':_0x5dac3b});})[_0x104e('0x24')](function(_0x610ce8){var _0x2fdbe4=_[_0x104e('0x2a')](_0x610ce8,function(_0x5709bc){return Number(_0x5709bc[_0x104e('0x5a')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x29a3f4},'MailQueueId':{'$in':_0x2fdbe4}},'transaction':_0x5dac3b});})[_0x104e('0x24')](function(){var _0x10f25c=_0x104e('0x5b')+_0x445953;return db[_0x104e('0x52')][_0x104e('0x30')](_0x10f25c,{'type':db[_0x104e('0x56')][_0x104e('0x59')]['SELECT'],'raw':!![],'transaction':_0x5dac3b});})[_0x104e('0x24')](function(_0x29f8ac){var _0x3951a0=_['map'](_0x29f8ac,function(_0x4f36cf){return Number(_0x4f36cf['SmsQueueId']);});return db['UserSmsQueue'][_0x104e('0x51')]({'where':{'UserId':{'$in':_0x29a3f4},'SmsQueueId':{'$in':_0x3951a0}},'transaction':_0x5dac3b});})[_0x104e('0x24')](function(){var _0x583956='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x445953;return db[_0x104e('0x52')]['query'](_0x583956,{'type':db['Sequelize'][_0x104e('0x59')][_0x104e('0x54')],'raw':!![],'transaction':_0x5dac3b});})[_0x104e('0x24')](function(_0x2843cd){var _0x33105e=_['map'](_0x2843cd,function(_0x1a65dc){return Number(_0x1a65dc[_0x104e('0x5c')]);});return db[_0x104e('0x5d')][_0x104e('0x51')]({'where':{'UserId':{'$in':_0x29a3f4},'ChatQueueId':{'$in':_0x33105e}},'transaction':_0x5dac3b});})[_0x104e('0x24')](function(){var _0x3371b3='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x445953;return db[_0x104e('0x52')][_0x104e('0x30')](_0x3371b3,{'type':db[_0x104e('0x56')][_0x104e('0x59')]['SELECT'],'raw':!![],'transaction':_0x5dac3b});})[_0x104e('0x24')](function(_0x502056){var _0x36366f=_[_0x104e('0x2a')](_0x502056,function(_0x1bcd02){return Number(_0x1bcd02['FaxQueueId']);});return db[_0x104e('0x5e')][_0x104e('0x51')]({'where':{'UserId':{'$in':_0x29a3f4},'FaxQueueId':{'$in':_0x36366f}},'transaction':_0x5dac3b});})[_0x104e('0x24')](function(){var _0x5bc1bd='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x445953;return db[_0x104e('0x52')][_0x104e('0x30')](_0x5bc1bd,{'type':db[_0x104e('0x56')][_0x104e('0x59')][_0x104e('0x54')],'raw':!![],'transaction':_0x5dac3b});})['then'](function(_0x16c84f){var _0x5048a5=_[_0x104e('0x2a')](_0x16c84f,function(_0x33dcac){return Number(_0x33dcac['OpenchannelQueueId']);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x29a3f4},'OpenchannelQueueId':{'$in':_0x5048a5}},'transaction':_0x5dac3b});})['then'](function(){var _0xa4980b=_0x104e('0x5f')+_0x445953;return db[_0x104e('0x52')][_0x104e('0x30')](_0xa4980b,{'type':db['Sequelize'][_0x104e('0x59')][_0x104e('0x54')],'raw':!![],'transaction':_0x5dac3b});})[_0x104e('0x24')](function(_0x19052a){var _0x4fc765=_['map'](_0x19052a,function(_0x104c87){return Number(_0x104c87[_0x104e('0x60')]);});return db[_0x104e('0x61')]['destroy']({'where':{'UserId':{'$in':_0x29a3f4},'WhatsappQueueId':{'$in':_0x4fc765}},'transaction':_0x5dac3b});})[_0x104e('0x24')](function(){return db[_0x104e('0x62')][_0x104e('0x47')]({'where':{'TeamId':_0x445953}});})[_0x104e('0x24')](function(_0x520e54){if(_0x520e54===null){return;}return db['UserVoicePrefix'][_0x104e('0x51')]({'where':{'UserId':{'$in':_0x29a3f4},'VoicePrefixId':_0x520e54[_0x104e('0x63')]},'transaction':_0x5dac3b});})[_0x104e('0x24')](function(){return db[_0x104e('0x2b')][_0x104e('0x51')]({'where':{'id':_0x445953},'cascade':!![],'transaction':_0x5dac3b});})[_0x104e('0x24')](function(_0x1e5cfe){if(_0x1e5cfe===0x0){_0x441d7a[_0x104e('0x25')](0x194);}else{return db[_0x104e('0x50')]['destroy']({'where':{'type':_0x104e('0x64'),'resourceId':_0x445953},'cascade':!![],'transaction':_0x5dac3b})[_0x104e('0x24')](function(){_0x441d7a[_0x104e('0x1a')](0xcc)[_0x104e('0x1b')]();});}})['catch'](function(_0x1eb903){_0x441d7a['status'](0x1f4)[_0x104e('0x28')](_0x1eb903);});});};exports[_0x104e('0x65')]=function(_0x34801b,_0x3ca1df,_0x4f5042){return db[_0x104e('0x2b')]['findOne']({'where':{'id':_0x34801b[_0x104e('0x46')]['id']}})[_0x104e('0x24')](handleEntityNotFound(_0x3ca1df,null))[_0x104e('0x24')](function(_0xb8170){if(!_0x34801b['query'][_0x104e('0x66')]||!utils[_0x104e('0x67')](_0x34801b[_0x104e('0x30')][_0x104e('0x66')])){throw new db[(_0x104e('0x56'))][(_0x104e('0x68'))](_0x104e('0x69'));}var _0x1e0930={};var _0xbf4e44={};_0xbf4e44[_0x104e('0x2f')]=_[_0x104e('0x31')](db[_['capitalize'](_0x34801b[_0x104e('0x30')][_0x104e('0x66')][_0x104e('0x6a')]())+_0x104e('0x6b')][_0x104e('0x2c')]);_0xbf4e44['query']=_['keys'](_0x34801b[_0x104e('0x30')]);_0xbf4e44[_0x104e('0x32')]=_[_0x104e('0x33')](_0xbf4e44[_0x104e('0x2f')],_0xbf4e44[_0x104e('0x30')]);_0x1e0930['attributes']=_[_0x104e('0x33')](_0xbf4e44['model'],qs['fields'](_0x34801b['query'][_0x104e('0x35')]));_0x1e0930['attributes']=_0x1e0930[_0x104e('0x34')][_0x104e('0x36')]?_0x1e0930[_0x104e('0x34')]:_0xbf4e44[_0x104e('0x2f')];_0x1e0930[_0x104e('0x1e')]=qs[_0x104e('0x1e')](_0x34801b[_0x104e('0x30')][_0x104e('0x1e')]);_0x1e0930['offset']=qs[_0x104e('0x1d')](_0x34801b[_0x104e('0x30')][_0x104e('0x1d')]);_0x1e0930[_0x104e('0x38')]=qs['sort'](_0x34801b[_0x104e('0x30')][_0x104e('0x39')]);_0x1e0930[_0x104e('0x3a')]=qs[_0x104e('0x32')](_[_0x104e('0x3b')](_0x34801b['query'],_0xbf4e44[_0x104e('0x32')]));_0x1e0930=_[_0x104e('0x3d')]({},_0x1e0930,_0x34801b[_0x104e('0x3f')]);return _0xb8170[_0x104e('0x4a')+_[_0x104e('0x6c')](_0x34801b[_0x104e('0x30')][_0x104e('0x66')][_0x104e('0x6a')]())+'Queues'](_0x1e0930);})[_0x104e('0x24')](respondWithResult(_0x3ca1df,null))[_0x104e('0x44')](handleError(_0x3ca1df,null));};exports[_0x104e('0x6d')]=function(_0x211066,_0x61fed1,_0x483181){return db[_0x104e('0x2b')][_0x104e('0x6e')]({'where':{'id':_0x211066[_0x104e('0x46')]['id']}})[_0x104e('0x24')](function(_0x1088f0){if(_0x1088f0){if(!_0x211066[_0x104e('0x49')][_0x104e('0x66')]||!utils[_0x104e('0x67')](_0x211066[_0x104e('0x49')][_0x104e('0x66')])){throw new db[(_0x104e('0x56'))][(_0x104e('0x68'))](_0x104e('0x69'));}return _0x1088f0['add'+_['capitalize'](_0x211066[_0x104e('0x49')][_0x104e('0x66')]['toLowerCase']())+_0x104e('0x6f')](_0x211066['body']['ids']);}return null;})[_0x104e('0x24')](handleEntityNotFound(_0x61fed1,null))[_0x104e('0x24')](respondWithStatusCode(_0x61fed1,null))[_0x104e('0x44')](handleError(_0x61fed1,null));};exports[_0x104e('0x70')]=function(_0x191c73,_0x427b74,_0x5cee87){return db['Team']['findOne']({'where':{'id':_0x191c73[_0x104e('0x46')]['id']}})['then'](function(_0x532354){if(_0x532354){if(!_0x191c73['query'][_0x104e('0x66')]||!utils[_0x104e('0x67')](_0x191c73['query'][_0x104e('0x66')])){throw new db[(_0x104e('0x56'))][(_0x104e('0x68'))](_0x104e('0x69'));}return _0x532354[_0x104e('0x71')+_[_0x104e('0x6c')](_0x191c73[_0x104e('0x30')]['channel'][_0x104e('0x6a')]())+_0x104e('0x6f')](_0x191c73['query'][_0x104e('0x72')]);}return null;})[_0x104e('0x24')](handleEntityNotFound(_0x427b74,null))[_0x104e('0x24')](respondWithStatusCode(_0x427b74,null))[_0x104e('0x44')](handleError(_0x427b74,null));};exports[_0x104e('0x73')]=function(_0x2c79de,_0x21ac67){var _0x2d4604=_[_0x104e('0x74')](_0x2c79de[_0x104e('0x49')][_0x104e('0x72')])?_0x2c79de['body'][_0x104e('0x72')]:[_0x2c79de['body']['ids']];var _0x2a037d=_0x2c79de[_0x104e('0x46')]['id'];return db['Team'][_0x104e('0x47')]({'where':{'id':_0x2a037d}})[_0x104e('0x24')](handleEntityNotFound(_0x21ac67,null))['then'](function(_0x426a93){if(_0x426a93){var _0x44dce6=['Voice',_0x104e('0x75'),_0x104e('0x76'),'Sms','Fax',_0x104e('0x77'),_0x104e('0x78')];return db[_0x104e('0x52')][_0x104e('0x53')](function(_0x4822e2){var _0x147d4e=_[_0x104e('0x2a')](_0x44dce6,function(_0x4b5483){var _0x56466f={'attributes':['id',_0x104e('0x27')]};if(_0x4b5483==='Voice'){_0x56466f[_0x104e('0x79')]={'attributes':[_0x104e('0x7a')]};}return _0x426a93[_0x104e('0x4a')+_0x4b5483+_0x104e('0x6f')](_0x56466f)['then'](function(_0x2779c3){var _0x1beddb=_['map'](_0x2779c3,function(_0x104b0f){var _0x242c35=_['map'](_0x2d4604,function(_0x6c393b){var _0x51f335={'where':{'UserId':_0x6c393b,[_0x4b5483+_0x104e('0x7b')]:_0x104b0f['id']},'transaction':_0x4822e2};if(_0x4b5483===_0x104e('0x7c')){_0x51f335[_0x104e('0x16')]={'penalty':_0x104b0f[_0x104e('0x7d')][_0x104e('0x7a')]};}return db[_0x104e('0x7e')+_0x4b5483+_0x104e('0x6b')]['findOrCreate'](_0x51f335)[_0x104e('0x24')](function(){socket[_0x104e('0x7f')](_0x104e('0x4d')+_0x4b5483+_0x104e('0x80'),{'UserId':_0x6c393b,[_0x4b5483+_0x104e('0x7b')]:_0x104b0f['id']});if(_0x4b5483!=='Voice'){return;}return db['User'][_0x104e('0x42')]({'where':{'id':_0x2d4604,'online':0x1},'attributes':['id','name',_0x104e('0x81'),_0x104e('0x82'),_0x104e('0x83')],'raw':!![]})[_0x104e('0x24')](function(_0xf22a01){var _0x374116=_['map'](_0xf22a01,function(_0x14d82a){return db[_0x104e('0x84')][_0x104e('0x85')]({'membername':_0x14d82a[_0x104e('0x27')],'UserId':_0x14d82a['id'],'queue_name':_0x104b0f[_0x104e('0x27')],'VoiceQueueId':_0x104b0f['id'],'interface':_[_0x104e('0x86')](_0x14d82a[_0x104e('0x83')])?util[_0x104e('0x87')](_0x104e('0x88'),_0x14d82a[_0x104e('0x27')]):_0x14d82a['interface'],'paused':_0x14d82a[_0x104e('0x82')]||![],'penalty':_0x104b0f['TeamVoiceQueue'][_0x104e('0x7a')]},{'transaction':_0x4822e2});});return Promise[_0x104e('0x89')](_0x374116);});});});return Promise['all'](_0x242c35);});return Promise[_0x104e('0x89')](_0x1beddb);})['then'](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x2a037d}})[_0x104e('0x24')](function(_0x153056){if(_0x153056){var _0x134ae9=_[_0x104e('0x2a')](_0x2d4604,function(_0x365b69){db['UserVoicePrefix'][_0x104e('0x85')]({'UserId':_0x365b69,'VoicePrefixId':_0x153056[_0x104e('0x63')]});});return Promise[_0x104e('0x89')](_0x134ae9);}});});});return Promise[_0x104e('0x89')](_0x147d4e)[_0x104e('0x24')](function(){return _0x426a93[_0x104e('0x73')](_0x2d4604,{'transaction':_0x4822e2})[_0x104e('0x8a')](function(_0x124fa4){return _0x124fa4;});});});}})[_0x104e('0x24')](respondWithResult(_0x21ac67,null))[_0x104e('0x44')](handleError(_0x21ac67,null));};exports[_0x104e('0x8b')]=function(_0x2d6b07,_0x11bec6){var _0x3e1b2c=_[_0x104e('0x74')](_0x2d6b07['query']['ids'])?_0x2d6b07['query']['ids']:[_0x2d6b07[_0x104e('0x30')][_0x104e('0x72')]];var _0x3596bf=_0x2d6b07[_0x104e('0x46')]['id'];return db['Team'][_0x104e('0x47')]({'where':{'id':_0x3596bf}})['then'](handleEntityNotFound(_0x11bec6,null))[_0x104e('0x24')](function(_0xb5cd66){if(_0xb5cd66){var _0x59b0c8=[_0x104e('0x7c'),'Chat',_0x104e('0x76'),'Sms',_0x104e('0x8c'),_0x104e('0x77'),_0x104e('0x78')];return db['sequelize'][_0x104e('0x53')](function(_0x16e5a2){var _0x36c1f5=_[_0x104e('0x2a')](_0x59b0c8,function(_0x1228f8){var _0x557c9e={'attributes':['id',_0x104e('0x27')]};return _0xb5cd66[_0x104e('0x4a')+_0x1228f8+'Queues'](_0x557c9e)[_0x104e('0x24')](function(_0x23a30a){var _0x5ce470=_[_0x104e('0x2a')](_0x23a30a,function(_0x333a5d){return _0x333a5d[_0x104e('0x8b')](_0x3e1b2c,{'transaction':_0x16e5a2})[_0x104e('0x24')](function(){var _0x142ac2=_['map'](_0x3e1b2c,function(_0x5081e5){socket[_0x104e('0x7f')](_0x104e('0x4d')+_0x1228f8+_0x104e('0x8d'),{'UserId':Number(_0x5081e5),[_0x1228f8+'QueueId']:_0x333a5d['id']});if(_0x1228f8!==_0x104e('0x7c')){return;}return db[_0x104e('0x84')][_0x104e('0x51')]({'where':{'VoiceQueueId':_0x333a5d['id'],'UserId':_0x5081e5},'transaction':_0x16e5a2});});return Promise[_0x104e('0x89')](_0x142ac2);});});return Promise['all'](_0x5ce470);});});return Promise[_0x104e('0x89')](_0x36c1f5)[_0x104e('0x24')](function(){return _0xb5cd66[_0x104e('0x8b')](_0x3e1b2c,{'transaction':_0x16e5a2});})[_0x104e('0x24')](function(){return db[_0x104e('0x62')][_0x104e('0x6e')]({'where':{'teamId':_0x3596bf}})[_0x104e('0x24')](function(_0x26e6a5){if(_0x26e6a5){var _0x3d966f=_['map'](_0x3e1b2c,function(_0x2b9cdd){db['UserVoicePrefix'][_0x104e('0x51')]({'where':{'UserId':_0x2b9cdd,'VoicePrefixId':_0x26e6a5[_0x104e('0x63')]}});});return Promise[_0x104e('0x89')](_0x3d966f);}});});});}})[_0x104e('0x24')](respondWithStatusCode(_0x11bec6,null))[_0x104e('0x44')](handleError(_0x11bec6,null));};exports[_0x104e('0x8e')]=function(_0xfdcdf3,_0x283b19,_0x5c1a5d){var _0x34b094={};var _0x30a29c={};var _0x16d724;var _0x200371;return db['Team'][_0x104e('0x6e')]({'where':{'id':_0xfdcdf3[_0x104e('0x46')]['id']}})[_0x104e('0x24')](handleEntityNotFound(_0x283b19,null))[_0x104e('0x24')](function(_0x1e0d55){if(_0x1e0d55){_0x16d724=_0x1e0d55;_0x30a29c['model']=_[_0x104e('0x31')](db[_0x104e('0x7e')][_0x104e('0x2c')]);_0x30a29c[_0x104e('0x30')]=_[_0x104e('0x31')](_0xfdcdf3['query']);_0x30a29c['filters']=_['intersection'](_0x30a29c[_0x104e('0x2f')],_0x30a29c[_0x104e('0x30')]);_0x34b094['attributes']=_[_0x104e('0x33')](_0x30a29c[_0x104e('0x2f')],qs[_0x104e('0x35')](_0xfdcdf3['query'][_0x104e('0x35')]));_0x34b094[_0x104e('0x34')]=_0x34b094[_0x104e('0x34')][_0x104e('0x36')]?_0x34b094[_0x104e('0x34')]:_0x30a29c[_0x104e('0x2f')];_0x34b094[_0x104e('0x38')]=qs[_0x104e('0x39')](_0xfdcdf3[_0x104e('0x30')]['sort']);_0x34b094[_0x104e('0x3a')]=qs[_0x104e('0x32')](_[_0x104e('0x3b')](_0xfdcdf3[_0x104e('0x30')],_0x30a29c[_0x104e('0x32')]));if(_0xfdcdf3[_0x104e('0x30')]['filter']){_0x34b094['where']=_[_0x104e('0x3d')](_0x34b094[_0x104e('0x3a')],{'$or':_[_0x104e('0x2a')](_0x34b094['attributes'],function(_0x40f60d){var _0x38ef94={};_0x38ef94[_0x40f60d]={'$like':'%'+_0xfdcdf3[_0x104e('0x30')][_0x104e('0x3c')]+'%'};return _0x38ef94;})});}_0x34b094=_[_0x104e('0x3d')]({},_0x34b094,_0xfdcdf3[_0x104e('0x3f')]);return _0x16d724[_0x104e('0x8e')](_0x34b094);}})[_0x104e('0x24')](function(_0x269c48){if(_0x269c48){_0x200371=_0x269c48[_0x104e('0x36')];if(!_0xfdcdf3['query']['hasOwnProperty'](_0x104e('0x37'))){_0x34b094['limit']=qs[_0x104e('0x1e')](_0xfdcdf3[_0x104e('0x30')]['limit']);_0x34b094['offset']=qs[_0x104e('0x1d')](_0xfdcdf3[_0x104e('0x30')][_0x104e('0x1d')]);}return _0x16d724[_0x104e('0x8e')](_0x34b094);}})[_0x104e('0x24')](function(_0x4d6912){if(_0x4d6912){return _0x4d6912?{'count':_0x200371,'rows':_0x4d6912}:null;}})[_0x104e('0x24')](respondWithResult(_0x283b19,null))[_0x104e('0x44')](handleError(_0x283b19,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7c773f8..5f8ff96 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 _0x36c5=['../../mysqldb','Team','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3084c4,_0xe27867){var _0x4c94a6=function(_0x117404){while(--_0x117404){_0x3084c4['push'](_0x3084c4['shift']());}};_0x4c94a6(++_0xe27867);}(_0x36c5,0x149));var _0x536c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x536c('0x0'));var Team=require(_0x536c('0x1'))['db'][_0x536c('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x536c('0x3'),'afterUpdate':_0x536c('0x4'),'afterDestroy':_0x536c('0x5')};function emitEvent(_0x104d14){return function(_0x497c20,_0x30147d,_0x2d139a){TeamEvents[_0x536c('0x6')](_0x104d14+':'+_0x497c20['id'],_0x497c20);TeamEvents[_0x536c('0x6')](_0x104d14,_0x497c20);_0x2d139a(null);};}for(var e in events){if(events[_0x536c('0x7')](e)){var event=events[e];Team[_0x536c('0x8')](e,emitEvent(event));}}module[_0x536c('0x9')]=TeamEvents; \ No newline at end of file +var _0x1cc9=['hook','../../mysqldb','Team','setMaxListeners','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1cc9,0xba));var _0x91cc=function(_0x2a9c27,_0x43433e){_0x2a9c27=_0x2a9c27-0x0;var _0x3f6be1=_0x1cc9[_0x2a9c27];return _0x3f6be1;};'use strict';var EventEmitter=require('events');var Team=require(_0x91cc('0x0'))['db'][_0x91cc('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x91cc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x360f77){return function(_0x5381ef,_0x3369de,_0xbcdb8f){TeamEvents[_0x91cc('0x3')](_0x360f77+':'+_0x5381ef['id'],_0x5381ef);TeamEvents[_0x91cc('0x3')](_0x360f77,_0x5381ef);_0xbcdb8f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x91cc('0x4')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 3db139b..a64e011 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 _0x7afd=['Whatsapp','resolve','catch','./team.attributes','get','Queues','then','map','channel','exports','define','Team','teams','Chat','Fax','Sms'];(function(_0x2cb169,_0x38ec0a){var _0x54c758=function(_0x3f3cf4){while(--_0x3f3cf4){_0x2cb169['push'](_0x2cb169['shift']());}};_0x54c758(++_0x38ec0a);}(_0x7afd,0x103));var _0xd7af=function(_0x10e1ce,_0x1f28eb){_0x10e1ce=_0x10e1ce-0x0;var _0x5be2ea=_0x7afd[_0x10e1ce];return _0x5be2ea;};'use strict';var _=require('lodash');var attributes=require(_0xd7af('0x0'));function getQueuesByChannel(_0x28ae8f,_0x46abe7){var _0x1b5025=_0xd7af('0x1')+_0x46abe7+_0xd7af('0x2');return _0x28ae8f[_0x1b5025]()[_0xd7af('0x3')](function(_0x4279fc){return _[_0xd7af('0x4')](_0x4279fc,function(_0x12dab8){_0x12dab8['setDataValue'](_0xd7af('0x5'),_0x46abe7);return _0x12dab8;});})['catch'](function(_0x4a518b){throw _0x4a518b;});}module[_0xd7af('0x6')]=function(_0x3fbd3d){return _0x3fbd3d[_0xd7af('0x7')](_0xd7af('0x8'),attributes,{'tableName':_0xd7af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xa8631b=this;var _0x2d69bb=[_0xd7af('0xa'),_0xd7af('0xb'),'Mail','Openchannel',_0xd7af('0xc'),'Voice',_0xd7af('0xd')];return Promise[_0xd7af('0xe')]()['then'](function(){var _0x1cf31f=_[_0xd7af('0x4')](_0x2d69bb,function(_0x5c1f9c){return getQueuesByChannel(_0xa8631b,_0x5c1f9c);});return Promise['all'](_0x1cf31f);})[_0xd7af('0xf')](function(_0x111966){throw _0x111966;});}}});}; \ No newline at end of file +var _0x658b=['Openchannel','Sms','Voice','Whatsapp','resolve','map','lodash','./team.attributes','Queues','setDataValue','catch','define','Team','teams','Chat'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0x658b,0x6f));var _0xb658=function(_0xcadddf,_0x2e5bbb){_0xcadddf=_0xcadddf-0x0;var _0x36684e=_0x658b[_0xcadddf];return _0x36684e;};'use strict';var _=require(_0xb658('0x0'));var attributes=require(_0xb658('0x1'));function getQueuesByChannel(_0x450bcb,_0x3541a1){var _0x1c96d5='get'+_0x3541a1+_0xb658('0x2');return _0x450bcb[_0x1c96d5]()['then'](function(_0x4d34c1){return _['map'](_0x4d34c1,function(_0x21c2bb){_0x21c2bb[_0xb658('0x3')]('channel',_0x3541a1);return _0x21c2bb;});})[_0xb658('0x4')](function(_0x30e16e){throw _0x30e16e;});}module['exports']=function(_0xef809e){return _0xef809e[_0xb658('0x5')](_0xb658('0x6'),attributes,{'tableName':_0xb658('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5b9253=this;var _0x333003=[_0xb658('0x8'),'Fax','Mail',_0xb658('0x9'),_0xb658('0xa'),_0xb658('0xb'),_0xb658('0xc')];return Promise[_0xb658('0xd')]()['then'](function(){var _0xeebf9c=_[_0xb658('0xe')](_0x333003,function(_0x1db9b2){return getQueuesByChannel(_0x5b9253,_0x1db9b2);});return Promise['all'](_0xeebf9c);})[_0xb658('0x4')](function(_0x4f3ae3){throw _0x4f3ae3;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 77b4b9c..13b8726 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 _0x3c4a=['info','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','request','then'];(function(_0x5b6422,_0x53275c){var _0x164fae=function(_0xd0f8d1){while(--_0xd0f8d1){_0x5b6422['push'](_0x5b6422['shift']());}};_0x164fae(++_0x53275c);}(_0x3c4a,0x13e));var _0xa3c4=function(_0x3cc8b4,_0x33bc7d){_0x3cc8b4=_0x3cc8b4-0x0;var _0x20ff15=_0x3c4a[_0x3cc8b4];return _0x20ff15;};'use strict';var _=require(_0xa3c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa3c4('0x1'));var rs=require(_0xa3c4('0x2'));var fs=require('fs');var Redis=require(_0xa3c4('0x3'));var db=require(_0xa3c4('0x4'))['db'];var utils=require(_0xa3c4('0x5'));var logger=require(_0xa3c4('0x6'))('rpc');var config=require(_0xa3c4('0x7'));var jayson=require(_0xa3c4('0x8'));var client=jayson[_0xa3c4('0x9')][_0xa3c4('0xa')]({'port':0x232a});config[_0xa3c4('0xb')]=_[_0xa3c4('0xc')](config[_0xa3c4('0xb')],{'host':_0xa3c4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3c4('0xb')]));require(_0xa3c4('0xe'))[_0xa3c4('0xf')](socket);function respondWithRpcPromise(_0x2a7e38,_0x4d63e9,_0x37609a){return new BPromise(function(_0x26b5a8,_0x53200e){return client[_0xa3c4('0x10')](_0x2a7e38,_0x37609a)[_0xa3c4('0x11')](function(_0x3151c3){logger[_0xa3c4('0x12')]('Team,\x20%s,\x20%s',_0x4d63e9,_0xa3c4('0x13'));logger['debug'](_0xa3c4('0x14'),_0x4d63e9,'request\x20sent',JSON[_0xa3c4('0x15')](_0x3151c3));if(_0x3151c3[_0xa3c4('0x16')]){if(_0x3151c3[_0xa3c4('0x16')][_0xa3c4('0x17')]===0x1f4){logger['error'](_0xa3c4('0x18'),_0x4d63e9,_0x3151c3['error'][_0xa3c4('0x19')]);return _0x53200e(_0x3151c3[_0xa3c4('0x16')]['message']);}logger[_0xa3c4('0x16')](_0xa3c4('0x18'),_0x4d63e9,_0x3151c3['error'][_0xa3c4('0x19')]);return _0x26b5a8(_0x3151c3['error']['message']);}else{logger[_0xa3c4('0x12')]('Team,\x20%s,\x20%s',_0x4d63e9,'request\x20sent');_0x26b5a8(_0x3151c3[_0xa3c4('0x1a')]['message']);}})[_0xa3c4('0x1b')](function(_0x5778bb){logger['error'](_0xa3c4('0x18'),_0x4d63e9,_0x5778bb);_0x53200e(_0x5778bb);});});} \ No newline at end of file +var _0x0a56=['debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s'];(function(_0x25e69c,_0x44a34b){var _0x33f0d2=function(_0x2d70f0){while(--_0x2d70f0){_0x25e69c['push'](_0x25e69c['shift']());}};_0x33f0d2(++_0x44a34b);}(_0x0a56,0x132));var _0x60a5=function(_0x8dd02b,_0x5e54f0){_0x8dd02b=_0x8dd02b-0x0;var _0xced537=_0x0a56[_0x8dd02b];return _0xced537;};'use strict';var _=require(_0x60a5('0x0'));var util=require('util');var moment=require(_0x60a5('0x1'));var BPromise=require(_0x60a5('0x2'));var rs=require(_0x60a5('0x3'));var fs=require('fs');var Redis=require(_0x60a5('0x4'));var db=require(_0x60a5('0x5'))['db'];var utils=require(_0x60a5('0x6'));var logger=require('../../config/logger')(_0x60a5('0x7'));var config=require(_0x60a5('0x8'));var jayson=require(_0x60a5('0x9'));var client=jayson['client'][_0x60a5('0xa')]({'port':0x232a});config[_0x60a5('0xb')]=_['defaults'](config[_0x60a5('0xb')],{'host':_0x60a5('0xc'),'port':0x18eb});var socket=require(_0x60a5('0xd'))(new Redis(config['redis']));require('./team.socket')[_0x60a5('0xe')](socket);function respondWithRpcPromise(_0x32143b,_0x348a80,_0xcf5e43){return new BPromise(function(_0x319881,_0x277369){return client[_0x60a5('0xf')](_0x32143b,_0xcf5e43)[_0x60a5('0x10')](function(_0x368a0d){logger['info'](_0x60a5('0x11'),_0x348a80,'request\x20sent');logger[_0x60a5('0x12')](_0x60a5('0x13'),_0x348a80,_0x60a5('0x14'),JSON[_0x60a5('0x15')](_0x368a0d));if(_0x368a0d['error']){if(_0x368a0d[_0x60a5('0x16')][_0x60a5('0x17')]===0x1f4){logger[_0x60a5('0x16')]('Team,\x20%s,\x20%s',_0x348a80,_0x368a0d[_0x60a5('0x16')][_0x60a5('0x18')]);return _0x277369(_0x368a0d['error'][_0x60a5('0x18')]);}logger[_0x60a5('0x16')](_0x60a5('0x11'),_0x348a80,_0x368a0d[_0x60a5('0x16')][_0x60a5('0x18')]);return _0x319881(_0x368a0d['error'][_0x60a5('0x18')]);}else{logger[_0x60a5('0x19')]('Team,\x20%s,\x20%s',_0x348a80,_0x60a5('0x14'));_0x319881(_0x368a0d[_0x60a5('0x1a')][_0x60a5('0x18')]);}})['catch'](function(_0x5819db){logger[_0x60a5('0x16')](_0x60a5('0x11'),_0x348a80,_0x5819db);_0x277369(_0x5819db);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index cf9a356..81678ec 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 _0x3306=['save','remove','update','emit','register','length','team:','./team.events'];(function(_0xf12669,_0xd6b1db){var _0x589a90=function(_0x524017){while(--_0x524017){_0xf12669['push'](_0xf12669['shift']());}};_0x589a90(++_0xd6b1db);}(_0x3306,0x107));var _0x6330=function(_0x22e5b7,_0x5e8570){_0x22e5b7=_0x22e5b7-0x0;var _0x2cdc80=_0x3306[_0x22e5b7];return _0x2cdc80;};'use strict';var TeamEvents=require(_0x6330('0x0'));var events=[_0x6330('0x1'),_0x6330('0x2'),_0x6330('0x3')];function createListener(_0x4e47a7,_0x29210d){return function(_0x440976){_0x29210d[_0x6330('0x4')](_0x4e47a7,_0x440976);};}function removeListener(_0xcce390,_0x22ddc1){return function(){TeamEvents['removeListener'](_0xcce390,_0x22ddc1);};}exports[_0x6330('0x5')]=function(_0x457797){for(var _0x2942ec=0x0,_0x1f164b=events[_0x6330('0x6')];_0x2942ec<_0x1f164b;_0x2942ec++){var _0x4561f7=events[_0x2942ec];var _0x274386=createListener(_0x6330('0x7')+_0x4561f7,_0x457797);TeamEvents['on'](_0x4561f7,_0x274386);}}; \ No newline at end of file +var _0xe499=['register','length','team:','./team.events','save','remove','update','emit'];(function(_0x2693af,_0x24b01f){var _0x583afa=function(_0x4bfb88){while(--_0x4bfb88){_0x2693af['push'](_0x2693af['shift']());}};_0x583afa(++_0x24b01f);}(_0xe499,0xfb));var _0x9e49=function(_0x49988d,_0x15dae4){_0x49988d=_0x49988d-0x0;var _0x2259f7=_0xe499[_0x49988d];return _0x2259f7;};'use strict';var TeamEvents=require(_0x9e49('0x0'));var events=[_0x9e49('0x1'),_0x9e49('0x2'),_0x9e49('0x3')];function createListener(_0x50fa6a,_0x4a45e3){return function(_0x3b01d9){_0x4a45e3[_0x9e49('0x4')](_0x50fa6a,_0x3b01d9);};}function removeListener(_0x403a94,_0x4af577){return function(){TeamEvents['removeListener'](_0x403a94,_0x4af577);};}exports[_0x9e49('0x5')]=function(_0x312b96){for(var _0x57603a=0x0,_0x454174=events[_0x9e49('0x6')];_0x57603a<_0x454174;_0x57603a++){var _0x1034e9=events[_0x57603a];var _0x13bf1e=createListener(_0x9e49('0x7')+_0x1034e9,_0x312b96);TeamEvents['on'](_0x1034e9,_0x13bf1e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6b300fa..614aa5d 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 _0xc015=['sequelize','exports','INTEGER'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc015,0x81));var _0x5c01=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xc015[_0x211fef];return _0x5447bf;};'use strict';var Sequelize=require(_0x5c01('0x0'));module[_0x5c01('0x1')]={'TeamId':{'type':Sequelize[_0x5c01('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5c01('0x2')]}}; \ No newline at end of file +var _0x7e16=['INTEGER','sequelize','exports'];(function(_0x13ae88,_0x5ebeaf){var _0x55a594=function(_0x35b21c){while(--_0x35b21c){_0x13ae88['push'](_0x13ae88['shift']());}};_0x55a594(++_0x5ebeaf);}(_0x7e16,0x16f));var _0x67e1=function(_0x4c0714,_0x233504){_0x4c0714=_0x4c0714-0x0;var _0x154d68=_0x7e16[_0x4c0714];return _0x154d68;};'use strict';var Sequelize=require(_0x67e1('0x0'));module[_0x67e1('0x1')]={'TeamId':{'type':Sequelize[_0x67e1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x67e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2cd6bf2..dc81822 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 _0x1b0e=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x26b1bf,_0x564a4a){var _0x47c43c=function(_0x23277a){while(--_0x23277a){_0x26b1bf['push'](_0x26b1bf['shift']());}};_0x47c43c(++_0x564a4a);}(_0x1b0e,0x132));var _0xe1b0=function(_0x3bbf8f,_0xd0e68a){_0x3bbf8f=_0x3bbf8f-0x0;var _0x4153c2=_0x1b0e[_0x3bbf8f];return _0x4153c2;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var logger=require(_0xe1b0('0x2'))(_0xe1b0('0x3'));var moment=require(_0xe1b0('0x4'));var BPromise=require(_0xe1b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe1b0('0x6'));var config=require(_0xe1b0('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0xe1b0('0x8')]=function(_0x2a049f,_0xfb57ae){return _0x2a049f['define'](_0xe1b0('0x9'),attributes,{'tableName':_0xe1b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x315f=['team_has_voice_prefixes','lodash','../../config/logger','bluebird','./teamVoicePrefix.attributes','define','TeamVoicePrefix'];(function(_0x3d6eb1,_0x1f99b1){var _0x4e5356=function(_0x203406){while(--_0x203406){_0x3d6eb1['push'](_0x3d6eb1['shift']());}};_0x4e5356(++_0x1f99b1);}(_0x315f,0x174));var _0xf315=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x315f[_0x2a1b33];return _0x4c50e7;};'use strict';var _=require(_0xf315('0x0'));var util=require('util');var logger=require(_0xf315('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf315('0x2'));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(_0xf315('0x3'));module['exports']=function(_0x2794ff,_0x7d654f){return _0x2794ff[_0xf315('0x4')](_0xf315('0x5'),attributes,{'tableName':_0xf315('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 19a9ccb..b7c73c1 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x493814,_0x4eadf9){var _0x4e899d=function(_0x197ea5){while(--_0x197ea5){_0x493814['push'](_0x493814['shift']());}};_0x4e899d(++_0x4eadf9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3ab99f,_0x3b7378){var _0xe37398=function(_0x98cf12){while(--_0x98cf12){_0x3ab99f['push'](_0x3ab99f['shift']());}};_0xe37398(++_0x3b7378);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 9c1e79d..1a7e7ec 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11a6=['sequelize','exports','INTEGER'];(function(_0x5e0546,_0x3fd27a){var _0x48366e=function(_0x12f61a){while(--_0x12f61a){_0x5e0546['push'](_0x5e0546['shift']());}};_0x48366e(++_0x3fd27a);}(_0x11a6,0xfc));var _0x611a=function(_0xa91db4,_0x464dfe){_0xa91db4=_0xa91db4-0x0;var _0x17afae=_0x11a6[_0xa91db4];return _0x17afae;};'use strict';var Sequelize=require(_0x611a('0x0'));module[_0x611a('0x1')]={'penalty':{'type':Sequelize[_0x611a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe3aa=['INTEGER','sequelize'];(function(_0x2f045c,_0x2b914d){var _0x521e50=function(_0x4e3f39){while(--_0x4e3f39){_0x2f045c['push'](_0x2f045c['shift']());}};_0x521e50(++_0x2b914d);}(_0xe3aa,0x1e3));var _0xae3a=function(_0x295029,_0x4b883f){_0x295029=_0x295029-0x0;var _0x57e35b=_0xe3aa[_0x295029];return _0x57e35b;};'use strict';var Sequelize=require(_0xae3a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xae3a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index f919ae0..53b763d 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 _0xcdd0=['api','bluebird','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x2f3c97,_0x58b83d){var _0x16ca53=function(_0x473416){while(--_0x473416){_0x2f3c97['push'](_0x2f3c97['shift']());}};_0x16ca53(++_0x58b83d);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xcdd0[_0x5416db];return _0x243e35;};'use strict';var _=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var logger=require(_0x0cdd('0x2'))(_0x0cdd('0x3'));var moment=require('moment');var BPromise=require(_0x0cdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0cdd('0x5'));var config=require('../../config/environment');var attributes=require(_0x0cdd('0x6'));module[_0x0cdd('0x7')]=function(_0xe80a73,_0x5ca0f9){return _0xe80a73[_0x0cdd('0x8')](_0x0cdd('0x9'),attributes,{'tableName':_0x0cdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9335=['TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xb80db4,_0x57e0f5){var _0x5955b0=function(_0x2eb569){while(--_0x2eb569){_0xb80db4['push'](_0xb80db4['shift']());}};_0x5955b0(++_0x57e0f5);}(_0x9335,0xab));var _0x5933=function(_0x26826b,_0x653a08){_0x26826b=_0x26826b-0x0;var _0x59e4cd=_0x9335[_0x26826b];return _0x59e4cd;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var logger=require('../../config/logger')(_0x5933('0x2'));var moment=require(_0x5933('0x3'));var BPromise=require(_0x5933('0x4'));var rp=require(_0x5933('0x5'));var fs=require('fs');var path=require(_0x5933('0x6'));var rimraf=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x5933('0x9')]=function(_0x4de024,_0x553710){return _0x4de024[_0x5933('0xa')](_0x5933('0xb'),attributes,{'tableName':_0x5933('0xc'),'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 637db65..7d1d0e3 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 _0x5ed3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x267435,_0x3f8bb6){var _0x1e4fb1=function(_0x7e013c){while(--_0x7e013c){_0x267435['push'](_0x267435['shift']());}};_0x1e4fb1(++_0x3f8bb6);}(_0x5ed3,0x9e));var _0x35ed=function(_0x248854,_0x325e8e){_0x248854=_0x248854-0x0;var _0xfd6ab2=_0x5ed3[_0x248854];return _0xfd6ab2;};'use strict';var _=require(_0x35ed('0x0'));var util=require(_0x35ed('0x1'));var moment=require(_0x35ed('0x2'));var BPromise=require(_0x35ed('0x3'));var rs=require(_0x35ed('0x4'));var fs=require('fs');var Redis=require(_0x35ed('0x5'));var db=require(_0x35ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x35ed('0x7'))(_0x35ed('0x8'));var config=require(_0x35ed('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x35ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fce34,_0x2dcaa5,_0x4e95bf){return new BPromise(function(_0x314b27,_0x869cd3){return client[_0x35ed('0xb')](_0x1fce34,_0x4e95bf)[_0x35ed('0xc')](function(_0x146b6f){logger[_0x35ed('0xd')](_0x35ed('0xe'),_0x2dcaa5,'request\x20sent');logger[_0x35ed('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2dcaa5,_0x35ed('0x10'),JSON[_0x35ed('0x11')](_0x146b6f));if(_0x146b6f['error']){if(_0x146b6f[_0x35ed('0x12')][_0x35ed('0x13')]===0x1f4){logger[_0x35ed('0x12')](_0x35ed('0xe'),_0x2dcaa5,_0x146b6f['error'][_0x35ed('0x14')]);return _0x869cd3(_0x146b6f[_0x35ed('0x12')]['message']);}logger[_0x35ed('0x12')](_0x35ed('0xe'),_0x2dcaa5,_0x146b6f[_0x35ed('0x12')]['message']);return _0x314b27(_0x146b6f[_0x35ed('0x12')][_0x35ed('0x14')]);}else{logger[_0x35ed('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2dcaa5,_0x35ed('0x10'));_0x314b27(_0x146b6f[_0x35ed('0x15')]['message']);}})[_0x35ed('0x16')](function(_0x3ee110){logger[_0x35ed('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2dcaa5,_0x3ee110);_0x869cd3(_0x3ee110);});});} \ No newline at end of file +var _0x38e2=['../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','util','moment','ioredis','../../mysqldb','rpc'];(function(_0x1f8057,_0x29937c){var _0x530ae5=function(_0x1870ea){while(--_0x1870ea){_0x1f8057['push'](_0x1f8057['shift']());}};_0x530ae5(++_0x29937c);}(_0x38e2,0xff));var _0x238e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x38e2[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x238e('0x0'));var moment=require(_0x238e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x238e('0x2'));var db=require(_0x238e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x238e('0x4'));var config=require(_0x238e('0x5'));var jayson=require(_0x238e('0x6'));var client=jayson[_0x238e('0x7')][_0x238e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1ac1,_0x29f1fc,_0xe3694e){return new BPromise(function(_0x21fb2b,_0x4bd390){return client[_0x238e('0x9')](_0x5d1ac1,_0xe3694e)['then'](function(_0x3b3957){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x29f1fc,_0x238e('0xa'));logger[_0x238e('0xb')](_0x238e('0xc'),_0x29f1fc,'request\x20sent',JSON[_0x238e('0xd')](_0x3b3957));if(_0x3b3957[_0x238e('0xe')]){if(_0x3b3957[_0x238e('0xe')][_0x238e('0xf')]===0x1f4){logger[_0x238e('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x29f1fc,_0x3b3957[_0x238e('0xe')]['message']);return _0x4bd390(_0x3b3957[_0x238e('0xe')][_0x238e('0x10')]);}logger[_0x238e('0xe')](_0x238e('0x11'),_0x29f1fc,_0x3b3957[_0x238e('0xe')]['message']);return _0x21fb2b(_0x3b3957[_0x238e('0xe')][_0x238e('0x10')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x29f1fc,_0x238e('0xa'));_0x21fb2b(_0x3b3957[_0x238e('0x12')]['message']);}})[_0x238e('0x13')](function(_0x8034f2){logger[_0x238e('0xe')](_0x238e('0x11'),_0x29f1fc,_0x8034f2);_0x4bd390(_0x8034f2);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b2e015e..e021a74 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 _0xb96d=['create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./template.controller','get','isAuthenticated','index','/:id','post'];(function(_0x4cd663,_0x1ba308){var _0x54554f=function(_0x4995ad){while(--_0x4995ad){_0x4cd663['push'](_0x4cd663['shift']());}};_0x54554f(++_0x1ba308);}(_0xb96d,0x9e));var _0xdb96=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0xb96d[_0x870b62];return _0x2dcb39;};'use strict';var multer=require('multer');var util=require(_0xdb96('0x0'));var path=require(_0xdb96('0x1'));var timeout=require(_0xdb96('0x2'));var express=require('express');var router=express[_0xdb96('0x3')]();var fs_extra=require(_0xdb96('0x4'));var auth=require(_0xdb96('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdb96('0x6'));router[_0xdb96('0x7')]('/',auth[_0xdb96('0x8')](),controller[_0xdb96('0x9')]);router['get'](_0xdb96('0xa'),auth[_0xdb96('0x8')](),controller['show']);router[_0xdb96('0xb')]('/',auth['isAuthenticated'](),controller[_0xdb96('0xc')]);router[_0xdb96('0xd')]('/:id',auth[_0xdb96('0x8')](),controller[_0xdb96('0xe')]);router['delete'](_0xdb96('0xa'),auth[_0xdb96('0x8')](),controller[_0xdb96('0xf')]);module[_0xdb96('0x10')]=router; \ No newline at end of file +var _0x62cf=['delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x9e744,_0x441df3){var _0x542de7=function(_0x325c88){while(--_0x325c88){_0x9e744['push'](_0x9e744['shift']());}};_0x542de7(++_0x441df3);}(_0x62cf,0x81));var _0xf62c=function(_0x34c339,_0x537be5){_0x34c339=_0x34c339-0x0;var _0x2ed69c=_0x62cf[_0x34c339];return _0x2ed69c;};'use strict';var multer=require(_0xf62c('0x0'));var util=require('util');var path=require(_0xf62c('0x1'));var timeout=require('connect-timeout');var express=require(_0xf62c('0x2'));var router=express[_0xf62c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var controller=require(_0xf62c('0x6'));router[_0xf62c('0x7')]('/',auth[_0xf62c('0x8')](),controller[_0xf62c('0x9')]);router[_0xf62c('0x7')](_0xf62c('0xa'),auth[_0xf62c('0x8')](),controller['show']);router[_0xf62c('0xb')]('/',auth['isAuthenticated'](),controller[_0xf62c('0xc')]);router[_0xf62c('0xd')](_0xf62c('0xa'),auth[_0xf62c('0x8')](),controller[_0xf62c('0xe')]);router[_0xf62c('0xf')](_0xf62c('0xa'),auth[_0xf62c('0x8')](),controller[_0xf62c('0x10')]);module[_0xf62c('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b3829c6..9193610 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 _0x59de=['TEXT','sequelize','exports','STRING'];(function(_0x5bcbbd,_0x11a3d1){var _0x45bfb1=function(_0x1e8480){while(--_0x1e8480){_0x5bcbbd['push'](_0x5bcbbd['shift']());}};_0x45bfb1(++_0x11a3d1);}(_0x59de,0x1a9));var _0xe59d=function(_0x19d98e,_0x44d6db){_0x19d98e=_0x19d98e-0x0;var _0x1d3d6f=_0x59de[_0x19d98e];return _0x1d3d6f;};'use strict';var Sequelize=require(_0xe59d('0x0'));module[_0xe59d('0x1')]={'name':{'type':Sequelize[_0xe59d('0x2')]},'description':{'type':Sequelize[_0xe59d('0x2')]},'html':{'type':Sequelize[_0xe59d('0x3')]}}; \ No newline at end of file +var _0x2b77=['STRING','TEXT','exports'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x2b77,0xce));var _0x72b7=function(_0x255dd8,_0x139670){_0x255dd8=_0x255dd8-0x0;var _0x2619e2=_0x2b77[_0x255dd8];return _0x2619e2;};'use strict';var Sequelize=require('sequelize');module[_0x72b7('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x72b7('0x1')]},'html':{'type':Sequelize[_0x72b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index df654f7..e72c3a5 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 _0xfa0d=['send','index','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Template','includeAll','include','findAll','rows','params','keys','find','catch','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Templates','UserProfileResource','error','name'];(function(_0x35fa4a,_0xef4580){var _0x7e5bfe=function(_0x238715){while(--_0x238715){_0x35fa4a['push'](_0x35fa4a['shift']());}};_0x7e5bfe(++_0xef4580);}(_0xfa0d,0x16a));var _0xdfa0=function(_0x7eb6bd,_0x3b3488){_0x7eb6bd=_0x7eb6bd-0x0;var _0x5c530a=_0xfa0d[_0x7eb6bd];return _0x5c530a;};'use strict';var emlformat=require(_0xdfa0('0x0'));var rimraf=require(_0xdfa0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfa0('0x2'));var rp=require('request-promise');var moment=require(_0xdfa0('0x3'));var BPromise=require(_0xdfa0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdfa0('0x5'));var ejs=require(_0xdfa0('0x6'));var fs=require('fs');var fs_extra=require(_0xdfa0('0x7'));var _=require(_0xdfa0('0x8'));var squel=require(_0xdfa0('0x9'));var crypto=require(_0xdfa0('0xa'));var jsforce=require(_0xdfa0('0xb'));var deskjs=require(_0xdfa0('0xc'));var toCsv=require(_0xdfa0('0x5'));var querystring=require(_0xdfa0('0xd'));var Papa=require(_0xdfa0('0xe'));var Redis=require('ioredis');var authService=require(_0xdfa0('0xf'));var qs=require(_0xdfa0('0x10'));var as=require(_0xdfa0('0x11'));var hardwareService=require(_0xdfa0('0x12'));var logger=require('../../config/logger')(_0xdfa0('0x13'));var utils=require('../../config/utils');var config=require(_0xdfa0('0x14'));var licenseUtil=require(_0xdfa0('0x15'));var db=require(_0xdfa0('0x16'))['db'];function respondWithStatusCode(_0xcfa0f9,_0x485d7b){_0x485d7b=_0x485d7b||0xcc;return function(_0x97f7bc){if(_0x97f7bc){return _0xcfa0f9[_0xdfa0('0x17')](_0x485d7b);}return _0xcfa0f9[_0xdfa0('0x18')](_0x485d7b)[_0xdfa0('0x19')]();};}function respondWithResult(_0x25dbcf,_0x31d7f8){_0x31d7f8=_0x31d7f8||0xc8;return function(_0x1b24d9){if(_0x1b24d9){return _0x25dbcf[_0xdfa0('0x18')](_0x31d7f8)[_0xdfa0('0x1a')](_0x1b24d9);}};}function respondWithFilteredResult(_0xee54c,_0x35fc9c){return function(_0x50b54b){if(_0x50b54b){var _0x1cdc51=typeof _0x35fc9c[_0xdfa0('0x1b')]===_0xdfa0('0x1c')&&typeof _0x35fc9c['limit']===_0xdfa0('0x1c');var _0x4f37ba=_0x50b54b[_0xdfa0('0x1d')];var _0x1f2db7=_0x1cdc51?0x0:_0x35fc9c['offset'];var _0x5d3e95=_0x1cdc51?_0x50b54b[_0xdfa0('0x1d')]:_0x35fc9c['offset']+_0x35fc9c[_0xdfa0('0x1e')];var _0x246d65;if(_0x5d3e95>=_0x4f37ba){_0x5d3e95=_0x4f37ba;_0x246d65=0xc8;}else{_0x246d65=0xce;}_0xee54c['status'](_0x246d65);return _0xee54c[_0xdfa0('0x1f')](_0xdfa0('0x20'),_0x1f2db7+'-'+_0x5d3e95+'/'+_0x4f37ba)[_0xdfa0('0x1a')](_0x50b54b);}return null;};}function patchUpdates(_0x30a54e){return function(_0x2ff828){try{jsonpatch[_0xdfa0('0x21')](_0x2ff828,_0x30a54e,!![]);}catch(_0x15a348){return BPromise['reject'](_0x15a348);}return _0x2ff828[_0xdfa0('0x22')]();};}function saveUpdates(_0x354ca1,_0x4db209){return function(_0x49ae8c){if(_0x49ae8c){return _0x49ae8c[_0xdfa0('0x23')](_0x354ca1)['then'](function(_0x2d6ea6){return _0x2d6ea6;});}return null;};}function removeEntity(_0x375ecb,_0x1fc1d3){return function(_0x3d53b6){if(_0x3d53b6){return _0x3d53b6[_0xdfa0('0x24')]()[_0xdfa0('0x25')](function(){var _0x454261=_0x3d53b6[_0xdfa0('0x26')]({'plain':!![]});var _0x382e69=_0xdfa0('0x27');return db[_0xdfa0('0x28')]['destroy']({'where':{'type':_0x382e69,'resourceId':_0x454261['id']}})[_0xdfa0('0x25')](function(){return _0x3d53b6;});})[_0xdfa0('0x25')](function(){_0x375ecb[_0xdfa0('0x18')](0xcc)[_0xdfa0('0x19')]();});}};}function handleEntityNotFound(_0x5c8250,_0x2ab42a){return function(_0x3c4a5d){if(!_0x3c4a5d){_0x5c8250[_0xdfa0('0x17')](0x194);}return _0x3c4a5d;};}function handleError(_0x7b11cb,_0x3de0f0){_0x3de0f0=_0x3de0f0||0x1f4;return function(_0x1ba98d){logger[_0xdfa0('0x29')](_0x1ba98d['stack']);if(_0x1ba98d[_0xdfa0('0x2a')]){delete _0x1ba98d[_0xdfa0('0x2a')];}_0x7b11cb[_0xdfa0('0x18')](_0x3de0f0)[_0xdfa0('0x2b')](_0x1ba98d);};}exports[_0xdfa0('0x2c')]=function(_0x5086b5,_0x35d652){var _0x5cc857={},_0x598ea3={},_0x3c6f8c={'count':0x0,'rows':[]};var _0xa02d94=_['map'](db['Template']['rawAttributes'],function(_0x1b053b){return{'name':_0x1b053b[_0xdfa0('0x2d')],'type':_0x1b053b[_0xdfa0('0x2e')][_0xdfa0('0x2f')]};});_0x598ea3[_0xdfa0('0x30')]=_[_0xdfa0('0x31')](_0xa02d94,_0xdfa0('0x2a'));_0x598ea3['query']=_['keys'](_0x5086b5[_0xdfa0('0x32')]);_0x598ea3['filters']=_[_0xdfa0('0x33')](_0x598ea3[_0xdfa0('0x30')],_0x598ea3[_0xdfa0('0x32')]);_0x5cc857[_0xdfa0('0x34')]=_[_0xdfa0('0x33')](_0x598ea3[_0xdfa0('0x30')],qs[_0xdfa0('0x35')](_0x5086b5[_0xdfa0('0x32')]['fields']));_0x5cc857['attributes']=_0x5cc857[_0xdfa0('0x34')][_0xdfa0('0x36')]?_0x5cc857['attributes']:_0x598ea3[_0xdfa0('0x30')];if(!_0x5086b5['query'][_0xdfa0('0x37')]('nolimit')){_0x5cc857[_0xdfa0('0x1e')]=qs[_0xdfa0('0x1e')](_0x5086b5[_0xdfa0('0x32')]['limit']);_0x5cc857[_0xdfa0('0x1b')]=qs[_0xdfa0('0x1b')](_0x5086b5[_0xdfa0('0x32')][_0xdfa0('0x1b')]);}_0x5cc857[_0xdfa0('0x38')]=qs[_0xdfa0('0x39')](_0x5086b5[_0xdfa0('0x32')]['sort']);_0x5cc857[_0xdfa0('0x3a')]=qs[_0xdfa0('0x3b')](_[_0xdfa0('0x3c')](_0x5086b5[_0xdfa0('0x32')],_0x598ea3[_0xdfa0('0x3b')]),_0xa02d94);if(_0x5086b5['query'][_0xdfa0('0x3d')]){_0x5cc857[_0xdfa0('0x3a')]=_['merge'](_0x5cc857[_0xdfa0('0x3a')],{'$or':_[_0xdfa0('0x31')](_0xa02d94,function(_0x82352f){if(_0x82352f['type']!==_0xdfa0('0x3e')){var _0x5cfa68={};_0x5cfa68[_0x82352f[_0xdfa0('0x2a')]]={'$like':'%'+_0x5086b5['query'][_0xdfa0('0x3d')]+'%'};return _0x5cfa68;}})});}_0x5cc857=_[_0xdfa0('0x3f')]({},_0x5cc857,_0x5086b5[_0xdfa0('0x40')]);var _0x46e408={'where':_0x5cc857['where']};return db[_0xdfa0('0x41')][_0xdfa0('0x1d')](_0x46e408)[_0xdfa0('0x25')](function(_0x1a3bd5){_0x3c6f8c[_0xdfa0('0x1d')]=_0x1a3bd5;if(_0x5086b5[_0xdfa0('0x32')][_0xdfa0('0x42')]){_0x5cc857[_0xdfa0('0x43')]=[{'all':!![]}];}return db[_0xdfa0('0x41')][_0xdfa0('0x44')](_0x5cc857);})[_0xdfa0('0x25')](function(_0x5728a7){_0x3c6f8c[_0xdfa0('0x45')]=_0x5728a7;return _0x3c6f8c;})[_0xdfa0('0x25')](respondWithFilteredResult(_0x35d652,_0x5cc857))['catch'](handleError(_0x35d652,null));};exports['show']=function(_0x3ced8b,_0x2f6072){var _0x1722d0={'raw':!![],'where':{'id':_0x3ced8b[_0xdfa0('0x46')]['id']}},_0x1ddd0b={};_0x1ddd0b[_0xdfa0('0x30')]=_['keys'](db[_0xdfa0('0x41')]['rawAttributes']);_0x1ddd0b[_0xdfa0('0x32')]=_[_0xdfa0('0x47')](_0x3ced8b[_0xdfa0('0x32')]);_0x1ddd0b[_0xdfa0('0x3b')]=_[_0xdfa0('0x33')](_0x1ddd0b['model'],_0x1ddd0b['query']);_0x1722d0[_0xdfa0('0x34')]=_[_0xdfa0('0x33')](_0x1ddd0b[_0xdfa0('0x30')],qs[_0xdfa0('0x35')](_0x3ced8b[_0xdfa0('0x32')][_0xdfa0('0x35')]));_0x1722d0[_0xdfa0('0x34')]=_0x1722d0[_0xdfa0('0x34')][_0xdfa0('0x36')]?_0x1722d0[_0xdfa0('0x34')]:_0x1ddd0b[_0xdfa0('0x30')];if(_0x3ced8b[_0xdfa0('0x32')][_0xdfa0('0x42')]){_0x1722d0[_0xdfa0('0x43')]=[{'all':!![]}];}_0x1722d0=_[_0xdfa0('0x3f')]({},_0x1722d0,_0x3ced8b[_0xdfa0('0x40')]);return db['Template'][_0xdfa0('0x48')](_0x1722d0)[_0xdfa0('0x25')](handleEntityNotFound(_0x2f6072,null))[_0xdfa0('0x25')](respondWithResult(_0x2f6072,null))[_0xdfa0('0x49')](handleError(_0x2f6072,null));};exports[_0xdfa0('0x4a')]=function(_0x2f1429,_0x3c4c27){return db['Template']['create'](_0x2f1429[_0xdfa0('0x4b')],{})[_0xdfa0('0x25')](function(_0x310939){var _0x3dbec0=_0x2f1429['user'][_0xdfa0('0x26')]({'plain':!![]});if(!_0x3dbec0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dbec0[_0xdfa0('0x4c')]===_0xdfa0('0x4d')){var _0x341792=_0x310939[_0xdfa0('0x26')]({'plain':!![]});var _0x3daded='Templates';return db[_0xdfa0('0x4e')][_0xdfa0('0x48')]({'where':{'name':_0x3daded,'userProfileId':_0x3dbec0[_0xdfa0('0x4f')]},'raw':!![]})[_0xdfa0('0x25')](function(_0x5c2dae){if(_0x5c2dae&&_0x5c2dae[_0xdfa0('0x50')]===0x0){return db[_0xdfa0('0x28')]['create']({'name':_0x341792[_0xdfa0('0x2a')],'resourceId':_0x341792['id'],'type':_0x5c2dae['name'],'sectionId':_0x5c2dae['id']},{})['then'](function(){return _0x310939;});}else{return _0x310939;}})[_0xdfa0('0x49')](function(_0x22e721){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22e721);throw _0x22e721;});}return _0x310939;})[_0xdfa0('0x25')](respondWithResult(_0x3c4c27,0xc9))[_0xdfa0('0x49')](handleError(_0x3c4c27,null));};exports[_0xdfa0('0x23')]=function(_0x93a18c,_0x7c1674){if(_0x93a18c[_0xdfa0('0x4b')]['id']){delete _0x93a18c[_0xdfa0('0x4b')]['id'];}return db['Template'][_0xdfa0('0x48')]({'where':{'id':_0x93a18c[_0xdfa0('0x46')]['id']}})[_0xdfa0('0x25')](handleEntityNotFound(_0x7c1674,null))[_0xdfa0('0x25')](saveUpdates(_0x93a18c['body'],null))[_0xdfa0('0x25')](respondWithResult(_0x7c1674,null))[_0xdfa0('0x49')](handleError(_0x7c1674,null));};exports[_0xdfa0('0x24')]=function(_0x5e9512,_0x583858){return db[_0xdfa0('0x41')][_0xdfa0('0x48')]({'where':{'id':_0x5e9512['params']['id']}})[_0xdfa0('0x25')](handleEntityNotFound(_0x583858,null))['then'](removeEntity(_0x583858,null))[_0xdfa0('0x49')](handleError(_0x583858,null));}; \ No newline at end of file +var _0x08aa=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','get','Templates','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4b0d1f,_0x32c3a5){var _0xda90aa=function(_0x3d4df7){while(--_0x3d4df7){_0x4b0d1f['push'](_0x4b0d1f['shift']());}};_0xda90aa(++_0x32c3a5);}(_0x08aa,0x18c));var _0xa08a=function(_0x171924,_0x4f9bd1){_0x171924=_0x171924-0x0;var _0x276484=_0x08aa[_0x171924];return _0x276484;};'use strict';var emlformat=require(_0xa08a('0x0'));var rimraf=require(_0xa08a('0x1'));var zipdir=require(_0xa08a('0x2'));var jsonpatch=require(_0xa08a('0x3'));var rp=require(_0xa08a('0x4'));var moment=require(_0xa08a('0x5'));var BPromise=require(_0xa08a('0x6'));var Mustache=require('mustache');var util=require(_0xa08a('0x7'));var path=require(_0xa08a('0x8'));var sox=require(_0xa08a('0x9'));var csv=require(_0xa08a('0xa'));var ejs=require(_0xa08a('0xb'));var fs=require('fs');var fs_extra=require(_0xa08a('0xc'));var _=require('lodash');var squel=require(_0xa08a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa08a('0xe'));var toCsv=require(_0xa08a('0xa'));var querystring=require(_0xa08a('0xf'));var Papa=require(_0xa08a('0x10'));var Redis=require(_0xa08a('0x11'));var authService=require(_0xa08a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa08a('0x13'));var logger=require(_0xa08a('0x14'))('api');var utils=require(_0xa08a('0x15'));var config=require(_0xa08a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428457,_0x35d26c){_0x35d26c=_0x35d26c||0xcc;return function(_0x2e9d43){if(_0x2e9d43){return _0x428457['sendStatus'](_0x35d26c);}return _0x428457[_0xa08a('0x17')](_0x35d26c)['end']();};}function respondWithResult(_0xa8bc36,_0x3447fd){_0x3447fd=_0x3447fd||0xc8;return function(_0x5cd13a){if(_0x5cd13a){return _0xa8bc36[_0xa08a('0x17')](_0x3447fd)['json'](_0x5cd13a);}};}function respondWithFilteredResult(_0x5532fe,_0x442803){return function(_0x945cf9){if(_0x945cf9){var _0x167a20=typeof _0x442803[_0xa08a('0x18')]===_0xa08a('0x19')&&typeof _0x442803[_0xa08a('0x1a')]==='undefined';var _0x401199=_0x945cf9[_0xa08a('0x1b')];var _0x36cd3f=_0x167a20?0x0:_0x442803[_0xa08a('0x18')];var _0x3bbbae=_0x167a20?_0x945cf9[_0xa08a('0x1b')]:_0x442803['offset']+_0x442803[_0xa08a('0x1a')];var _0x35ce99;if(_0x3bbbae>=_0x401199){_0x3bbbae=_0x401199;_0x35ce99=0xc8;}else{_0x35ce99=0xce;}_0x5532fe[_0xa08a('0x17')](_0x35ce99);return _0x5532fe['set'](_0xa08a('0x1c'),_0x36cd3f+'-'+_0x3bbbae+'/'+_0x401199)[_0xa08a('0x1d')](_0x945cf9);}return null;};}function patchUpdates(_0x5f06ac){return function(_0x12b308){try{jsonpatch[_0xa08a('0x1e')](_0x12b308,_0x5f06ac,!![]);}catch(_0x318a10){return BPromise['reject'](_0x318a10);}return _0x12b308[_0xa08a('0x1f')]();};}function saveUpdates(_0xd819cc,_0x57815b){return function(_0x29839b){if(_0x29839b){return _0x29839b[_0xa08a('0x20')](_0xd819cc)[_0xa08a('0x21')](function(_0x3a8596){return _0x3a8596;});}return null;};}function removeEntity(_0x3e51ed,_0x5b2351){return function(_0x13d620){if(_0x13d620){return _0x13d620[_0xa08a('0x22')]()[_0xa08a('0x21')](function(){var _0x43a86c=_0x13d620[_0xa08a('0x23')]({'plain':!![]});var _0x34656a=_0xa08a('0x24');return db[_0xa08a('0x25')][_0xa08a('0x22')]({'where':{'type':_0x34656a,'resourceId':_0x43a86c['id']}})[_0xa08a('0x21')](function(){return _0x13d620;});})['then'](function(){_0x3e51ed[_0xa08a('0x17')](0xcc)[_0xa08a('0x26')]();});}};}function handleEntityNotFound(_0x5461a7,_0xd2e154){return function(_0x37d8fc){if(!_0x37d8fc){_0x5461a7[_0xa08a('0x27')](0x194);}return _0x37d8fc;};}function handleError(_0x4103e7,_0x46ac0a){_0x46ac0a=_0x46ac0a||0x1f4;return function(_0xdabcae){logger[_0xa08a('0x28')](_0xdabcae[_0xa08a('0x29')]);if(_0xdabcae[_0xa08a('0x2a')]){delete _0xdabcae['name'];}_0x4103e7[_0xa08a('0x17')](_0x46ac0a)[_0xa08a('0x2b')](_0xdabcae);};}exports[_0xa08a('0x2c')]=function(_0x1de249,_0x5df601){var _0x28973b={},_0x403110={},_0x45fa5d={'count':0x0,'rows':[]};var _0x1eee8b=_[_0xa08a('0x2d')](db[_0xa08a('0x2e')][_0xa08a('0x2f')],function(_0x5be138){return{'name':_0x5be138[_0xa08a('0x30')],'type':_0x5be138[_0xa08a('0x31')][_0xa08a('0x32')]};});_0x403110['model']=_[_0xa08a('0x2d')](_0x1eee8b,_0xa08a('0x2a'));_0x403110[_0xa08a('0x33')]=_['keys'](_0x1de249[_0xa08a('0x33')]);_0x403110[_0xa08a('0x34')]=_[_0xa08a('0x35')](_0x403110[_0xa08a('0x36')],_0x403110[_0xa08a('0x33')]);_0x28973b[_0xa08a('0x37')]=_[_0xa08a('0x35')](_0x403110['model'],qs[_0xa08a('0x38')](_0x1de249[_0xa08a('0x33')][_0xa08a('0x38')]));_0x28973b['attributes']=_0x28973b[_0xa08a('0x37')][_0xa08a('0x39')]?_0x28973b['attributes']:_0x403110[_0xa08a('0x36')];if(!_0x1de249[_0xa08a('0x33')][_0xa08a('0x3a')](_0xa08a('0x3b'))){_0x28973b[_0xa08a('0x1a')]=qs[_0xa08a('0x1a')](_0x1de249[_0xa08a('0x33')][_0xa08a('0x1a')]);_0x28973b[_0xa08a('0x18')]=qs[_0xa08a('0x18')](_0x1de249[_0xa08a('0x33')][_0xa08a('0x18')]);}_0x28973b[_0xa08a('0x3c')]=qs[_0xa08a('0x3d')](_0x1de249[_0xa08a('0x33')][_0xa08a('0x3d')]);_0x28973b[_0xa08a('0x3e')]=qs['filters'](_[_0xa08a('0x3f')](_0x1de249[_0xa08a('0x33')],_0x403110[_0xa08a('0x34')]),_0x1eee8b);if(_0x1de249[_0xa08a('0x33')]['filter']){_0x28973b[_0xa08a('0x3e')]=_[_0xa08a('0x40')](_0x28973b[_0xa08a('0x3e')],{'$or':_[_0xa08a('0x2d')](_0x1eee8b,function(_0x9c436c){if(_0x9c436c['type']!==_0xa08a('0x41')){var _0x1d71c1={};_0x1d71c1[_0x9c436c[_0xa08a('0x2a')]]={'$like':'%'+_0x1de249[_0xa08a('0x33')][_0xa08a('0x42')]+'%'};return _0x1d71c1;}})});}_0x28973b=_[_0xa08a('0x40')]({},_0x28973b,_0x1de249[_0xa08a('0x43')]);var _0x39aed0={'where':_0x28973b[_0xa08a('0x3e')]};return db[_0xa08a('0x2e')][_0xa08a('0x1b')](_0x39aed0)[_0xa08a('0x21')](function(_0x531ead){_0x45fa5d[_0xa08a('0x1b')]=_0x531ead;if(_0x1de249[_0xa08a('0x33')][_0xa08a('0x44')]){_0x28973b[_0xa08a('0x45')]=[{'all':!![]}];}return db['Template']['findAll'](_0x28973b);})[_0xa08a('0x21')](function(_0xb33d6){_0x45fa5d['rows']=_0xb33d6;return _0x45fa5d;})[_0xa08a('0x21')](respondWithFilteredResult(_0x5df601,_0x28973b))[_0xa08a('0x46')](handleError(_0x5df601,null));};exports[_0xa08a('0x47')]=function(_0x196a61,_0x7a3376){var _0x1c135d={'raw':!![],'where':{'id':_0x196a61[_0xa08a('0x48')]['id']}},_0x1cf680={};_0x1cf680[_0xa08a('0x36')]=_['keys'](db[_0xa08a('0x2e')]['rawAttributes']);_0x1cf680[_0xa08a('0x33')]=_['keys'](_0x196a61[_0xa08a('0x33')]);_0x1cf680['filters']=_['intersection'](_0x1cf680['model'],_0x1cf680['query']);_0x1c135d[_0xa08a('0x37')]=_['intersection'](_0x1cf680['model'],qs[_0xa08a('0x38')](_0x196a61[_0xa08a('0x33')]['fields']));_0x1c135d['attributes']=_0x1c135d[_0xa08a('0x37')]['length']?_0x1c135d[_0xa08a('0x37')]:_0x1cf680[_0xa08a('0x36')];if(_0x196a61[_0xa08a('0x33')][_0xa08a('0x44')]){_0x1c135d[_0xa08a('0x45')]=[{'all':!![]}];}_0x1c135d=_[_0xa08a('0x40')]({},_0x1c135d,_0x196a61['options']);return db[_0xa08a('0x2e')][_0xa08a('0x49')](_0x1c135d)[_0xa08a('0x21')](handleEntityNotFound(_0x7a3376,null))['then'](respondWithResult(_0x7a3376,null))['catch'](handleError(_0x7a3376,null));};exports[_0xa08a('0x4a')]=function(_0x3fb1ed,_0x129125){return db[_0xa08a('0x2e')][_0xa08a('0x4a')](_0x3fb1ed[_0xa08a('0x4b')],{})[_0xa08a('0x21')](function(_0x2e1863){var _0x5da01a=_0x3fb1ed[_0xa08a('0x4c')][_0xa08a('0x23')]({'plain':!![]});if(!_0x5da01a)throw new Error(_0xa08a('0x4d'));if(_0x5da01a['role']===_0xa08a('0x4c')){var _0x4482ce=_0x2e1863[_0xa08a('0x23')]({'plain':!![]});var _0x57f9f7='Templates';return db[_0xa08a('0x4e')][_0xa08a('0x49')]({'where':{'name':_0x57f9f7,'userProfileId':_0x5da01a[_0xa08a('0x4f')]},'raw':!![]})[_0xa08a('0x21')](function(_0x1d0587){if(_0x1d0587&&_0x1d0587[_0xa08a('0x50')]===0x0){return db[_0xa08a('0x25')][_0xa08a('0x4a')]({'name':_0x4482ce[_0xa08a('0x2a')],'resourceId':_0x4482ce['id'],'type':_0x1d0587[_0xa08a('0x2a')],'sectionId':_0x1d0587['id']},{})[_0xa08a('0x21')](function(){return _0x2e1863;});}else{return _0x2e1863;}})[_0xa08a('0x46')](function(_0x4fae21){logger[_0xa08a('0x28')](_0xa08a('0x51'),_0x4fae21);throw _0x4fae21;});}return _0x2e1863;})[_0xa08a('0x21')](respondWithResult(_0x129125,0xc9))['catch'](handleError(_0x129125,null));};exports[_0xa08a('0x20')]=function(_0x33e791,_0x3d3c2b){if(_0x33e791[_0xa08a('0x4b')]['id']){delete _0x33e791['body']['id'];}return db['Template'][_0xa08a('0x49')]({'where':{'id':_0x33e791[_0xa08a('0x48')]['id']}})[_0xa08a('0x21')](handleEntityNotFound(_0x3d3c2b,null))[_0xa08a('0x21')](saveUpdates(_0x33e791[_0xa08a('0x4b')],null))[_0xa08a('0x21')](respondWithResult(_0x3d3c2b,null))[_0xa08a('0x46')](handleError(_0x3d3c2b,null));};exports['destroy']=function(_0x1e8e53,_0x257880){return db['Template'][_0xa08a('0x49')]({'where':{'id':_0x1e8e53[_0xa08a('0x48')]['id']}})[_0xa08a('0x21')](handleEntityNotFound(_0x257880,null))[_0xa08a('0x21')](removeEntity(_0x257880,null))[_0xa08a('0x46')](handleError(_0x257880,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4597a50..6396980 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 _0x2514=['../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2514,0x1c6));var _0x4251=function(_0x1be8fb,_0x5b7eac){_0x1be8fb=_0x1be8fb-0x0;var _0x1b7897=_0x2514[_0x1be8fb];return _0x1b7897;};'use strict';var _=require(_0x4251('0x0'));var util=require(_0x4251('0x1'));var logger=require(_0x4251('0x2'))('api');var moment=require(_0x4251('0x3'));var BPromise=require(_0x4251('0x4'));var rp=require(_0x4251('0x5'));var fs=require('fs');var path=require(_0x4251('0x6'));var rimraf=require(_0x4251('0x7'));var config=require(_0x4251('0x8'));var attributes=require(_0x4251('0x9'));module[_0x4251('0xa')]=function(_0x17b360,_0x15986d){return _0x17b360[_0x4251('0xb')](_0x4251('0xc'),attributes,{'tableName':_0x4251('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dab=['./template.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x3dab,0xd4));var _0xb3da=function(_0x2156bf,_0x4c9d4a){_0x2156bf=_0x2156bf-0x0;var _0x3ad09d=_0x3dab[_0x2156bf];return _0x3ad09d;};'use strict';var _=require(_0xb3da('0x0'));var util=require(_0xb3da('0x1'));var logger=require(_0xb3da('0x2'))(_0xb3da('0x3'));var moment=require(_0xb3da('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3da('0x5'));var fs=require('fs');var path=require(_0xb3da('0x6'));var rimraf=require('rimraf');var config=require(_0xb3da('0x7'));var attributes=require(_0xb3da('0x8'));module[_0xb3da('0x9')]=function(_0x55b8ba,_0x4dd38b){return _0x55b8ba[_0xb3da('0xa')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 15b69bf..254ab93 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 _0x6b35=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','GetTemplate','findAll','options','raw','where','limit','include','map','model','attributes','util','moment'];(function(_0x4948a9,_0x2eb241){var _0x50c41d=function(_0x5b6022){while(--_0x5b6022){_0x4948a9['push'](_0x4948a9['shift']());}};_0x50c41d(++_0x2eb241);}(_0x6b35,0x6e));var _0x56b3=function(_0x195e10,_0x506903){_0x195e10=_0x195e10-0x0;var _0x491da0=_0x6b35[_0x195e10];return _0x491da0;};'use strict';var _=require('lodash');var util=require(_0x56b3('0x0'));var moment=require(_0x56b3('0x1'));var BPromise=require(_0x56b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56b3('0x3'))['db'];var utils=require(_0x56b3('0x4'));var logger=require(_0x56b3('0x5'))(_0x56b3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a33a5,_0x3486b9,_0xabf2d7){return new BPromise(function(_0x1ca183,_0x48a098){return client[_0x56b3('0x7')](_0x1a33a5,_0xabf2d7)[_0x56b3('0x8')](function(_0x3d6f0d){logger[_0x56b3('0x9')](_0x56b3('0xa'),_0x3486b9,_0x56b3('0xb'));logger[_0x56b3('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x3486b9,'request\x20sent',JSON['stringify'](_0x3d6f0d));if(_0x3d6f0d['error']){if(_0x3d6f0d['error'][_0x56b3('0xd')]===0x1f4){logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);return _0x48a098(_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);}logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);return _0x1ca183(_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);}else{logger[_0x56b3('0x9')]('Template,\x20%s,\x20%s',_0x3486b9,_0x56b3('0xb'));_0x1ca183(_0x3d6f0d[_0x56b3('0x10')][_0x56b3('0xf')]);}})[_0x56b3('0x11')](function(_0x3ab6cc){logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3ab6cc);_0x48a098(_0x3ab6cc);});});}exports[_0x56b3('0x12')]=function(_0x1183c1){var _0x2b217f=this;return new Promise(function(_0xefbf8b,_0x51ec69){return db['Template'][_0x56b3('0x13')]({'raw':_0x1183c1[_0x56b3('0x14')]?_0x1183c1[_0x56b3('0x14')][_0x56b3('0x15')]===undefined?!![]:![]:!![],'where':_0x1183c1['options']?_0x1183c1[_0x56b3('0x14')][_0x56b3('0x16')]||null:null,'attributes':_0x1183c1['options']?_0x1183c1[_0x56b3('0x14')]['attributes']||null:null,'limit':_0x1183c1[_0x56b3('0x14')]?_0x1183c1[_0x56b3('0x14')][_0x56b3('0x17')]||null:null,'include':_0x1183c1[_0x56b3('0x14')]?_0x1183c1['options'][_0x56b3('0x18')]?_[_0x56b3('0x19')](_0x1183c1[_0x56b3('0x14')][_0x56b3('0x18')],function(_0x587ed0){return{'model':db[_0x587ed0[_0x56b3('0x1a')]],'as':_0x587ed0['as'],'attributes':_0x587ed0['attributes'],'include':_0x587ed0[_0x56b3('0x18')]?_['map'](_0x587ed0[_0x56b3('0x18')],function(_0x2e4407){return{'model':db[_0x2e4407['model']],'as':_0x2e4407['as'],'attributes':_0x2e4407[_0x56b3('0x1b')],'include':_0x2e4407[_0x56b3('0x18')]?_[_0x56b3('0x19')](_0x2e4407[_0x56b3('0x18')],function(_0x313082){return{'model':db[_0x313082[_0x56b3('0x1a')]],'as':_0x313082['as'],'attributes':_0x313082[_0x56b3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x56b3('0x8')](function(_0x52e284){logger['info']('GetTemplate',_0x1183c1);logger['debug']('GetTemplate',_0x1183c1,JSON['stringify'](_0x52e284));_0xefbf8b(_0x52e284);})[_0x56b3('0x11')](function(_0x2b48d5){logger[_0x56b3('0xe')](_0x56b3('0x12'),_0x2b48d5['message'],_0x1183c1);_0x51ec69(_0x2b217f[_0x56b3('0xe')](0x1f4,_0x2b48d5['message']));});});}; \ No newline at end of file +var _0xc875=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','Template,\x20%s,\x20%s','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment'];(function(_0x458cd8,_0x2ef779){var _0x398706=function(_0xd0d1bb){while(--_0xd0d1bb){_0x458cd8['push'](_0x458cd8['shift']());}};_0x398706(++_0x2ef779);}(_0xc875,0x66));var _0x5c87=function(_0x44490f,_0x290717){_0x44490f=_0x44490f-0x0;var _0x9f0d18=_0xc875[_0x44490f];return _0x9f0d18;};'use strict';var _=require(_0x5c87('0x0'));var util=require(_0x5c87('0x1'));var moment=require(_0x5c87('0x2'));var BPromise=require(_0x5c87('0x3'));var rs=require(_0x5c87('0x4'));var fs=require('fs');var Redis=require(_0x5c87('0x5'));var db=require(_0x5c87('0x6'))['db'];var utils=require(_0x5c87('0x7'));var logger=require(_0x5c87('0x8'))(_0x5c87('0x9'));var config=require(_0x5c87('0xa'));var jayson=require(_0x5c87('0xb'));var client=jayson[_0x5c87('0xc')][_0x5c87('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x53fe17,_0x1e19a3,_0x2c1ccd){return new BPromise(function(_0x83821c,_0x47f59c){return client['request'](_0x53fe17,_0x2c1ccd)[_0x5c87('0xe')](function(_0x4255ed){logger[_0x5c87('0xf')]('Template,\x20%s,\x20%s',_0x1e19a3,_0x5c87('0x10'));logger[_0x5c87('0x11')](_0x5c87('0x12'),_0x1e19a3,_0x5c87('0x10'),JSON[_0x5c87('0x13')](_0x4255ed));if(_0x4255ed['error']){if(_0x4255ed[_0x5c87('0x14')]['code']===0x1f4){logger[_0x5c87('0x14')](_0x5c87('0x15'),_0x1e19a3,_0x4255ed['error'][_0x5c87('0x16')]);return _0x47f59c(_0x4255ed['error']['message']);}logger[_0x5c87('0x14')](_0x5c87('0x15'),_0x1e19a3,_0x4255ed[_0x5c87('0x14')][_0x5c87('0x16')]);return _0x83821c(_0x4255ed['error']['message']);}else{logger[_0x5c87('0xf')](_0x5c87('0x15'),_0x1e19a3,_0x5c87('0x10'));_0x83821c(_0x4255ed['result'][_0x5c87('0x16')]);}})[_0x5c87('0x17')](function(_0x1fc947){logger['error']('Template,\x20%s,\x20%s',_0x1e19a3,_0x1fc947);_0x47f59c(_0x1fc947);});});}exports[_0x5c87('0x18')]=function(_0x3d0086){var _0x11299e=this;return new Promise(function(_0x1a4967,_0x22c908){return db[_0x5c87('0x19')][_0x5c87('0x1a')]({'raw':_0x3d0086['options']?_0x3d0086[_0x5c87('0x1b')][_0x5c87('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d0086[_0x5c87('0x1b')]?_0x3d0086['options'][_0x5c87('0x1d')]||null:null,'attributes':_0x3d0086['options']?_0x3d0086[_0x5c87('0x1b')][_0x5c87('0x1e')]||null:null,'limit':_0x3d0086[_0x5c87('0x1b')]?_0x3d0086['options'][_0x5c87('0x1f')]||null:null,'include':_0x3d0086[_0x5c87('0x1b')]?_0x3d0086[_0x5c87('0x1b')][_0x5c87('0x20')]?_[_0x5c87('0x21')](_0x3d0086['options']['include'],function(_0x81a1da){return{'model':db[_0x81a1da[_0x5c87('0x22')]],'as':_0x81a1da['as'],'attributes':_0x81a1da[_0x5c87('0x1e')],'include':_0x81a1da[_0x5c87('0x20')]?_[_0x5c87('0x21')](_0x81a1da[_0x5c87('0x20')],function(_0x3fac19){return{'model':db[_0x3fac19['model']],'as':_0x3fac19['as'],'attributes':_0x3fac19[_0x5c87('0x1e')],'include':_0x3fac19[_0x5c87('0x20')]?_[_0x5c87('0x21')](_0x3fac19[_0x5c87('0x20')],function(_0x3a18a2){return{'model':db[_0x3a18a2['model']],'as':_0x3a18a2['as'],'attributes':_0x3a18a2[_0x5c87('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5c87('0xe')](function(_0x1e36d6){logger[_0x5c87('0xf')](_0x5c87('0x18'),_0x3d0086);logger[_0x5c87('0x11')](_0x5c87('0x18'),_0x3d0086,JSON[_0x5c87('0x13')](_0x1e36d6));_0x1a4967(_0x1e36d6);})['catch'](function(_0x57cc04){logger[_0x5c87('0x14')]('GetTemplate',_0x57cc04[_0x5c87('0x16')],_0x3d0086);_0x22c908(_0x11299e[_0x5c87('0x14')](0x1f4,_0x57cc04['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3c29c16..38b9943 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 _0x0e4a=['index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated'];(function(_0x1b6db3,_0x26930b){var _0x38a71e=function(_0x21dddd){while(--_0x21dddd){_0x1b6db3['push'](_0x1b6db3['shift']());}};_0x38a71e(++_0x26930b);}(_0x0e4a,0xd8));var _0xa0e4=function(_0x3cff37,_0xb48c41){_0x3cff37=_0x3cff37-0x0;var _0x283c6f=_0x0e4a[_0x3cff37];return _0x283c6f;};'use strict';var multer=require(_0xa0e4('0x0'));var util=require(_0xa0e4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa0e4('0x2')]();var fs_extra=require(_0xa0e4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa0e4('0x4'));var config=require(_0xa0e4('0x5'));var controller=require(_0xa0e4('0x6'));router[_0xa0e4('0x7')]('/',auth[_0xa0e4('0x8')](),controller[_0xa0e4('0x9')]);router['get']('/:id',auth[_0xa0e4('0x8')](),controller[_0xa0e4('0xa')]);router[_0xa0e4('0x7')](_0xa0e4('0xb'),auth['isAuthenticated'](),controller[_0xa0e4('0xc')]);router[_0xa0e4('0x7')](_0xa0e4('0xd'),auth[_0xa0e4('0x8')](),controller[_0xa0e4('0xe')]);router[_0xa0e4('0x7')](_0xa0e4('0xf'),auth[_0xa0e4('0x8')](),controller[_0xa0e4('0x10')]);router[_0xa0e4('0x11')]('/',auth[_0xa0e4('0x8')](),controller[_0xa0e4('0x12')]);router[_0xa0e4('0x11')](_0xa0e4('0xb'),auth[_0xa0e4('0x8')](),controller[_0xa0e4('0x13')]);router[_0xa0e4('0x11')](_0xa0e4('0xd'),auth['isAuthenticated'](),controller[_0xa0e4('0x14')]);router[_0xa0e4('0x11')](_0xa0e4('0xf'),auth[_0xa0e4('0x8')](),controller['addAction']);router['put'](_0xa0e4('0x15'),auth[_0xa0e4('0x8')](),controller[_0xa0e4('0x16')]);router['delete'](_0xa0e4('0x15'),auth['isAuthenticated'](),controller[_0xa0e4('0x17')]);module[_0xa0e4('0x18')]=router; \ No newline at end of file +var _0xc9d7=['../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xc9d7,0x149));var _0x7c9d=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xc9d7[_0x257495];return _0x3849aa;};'use strict';var multer=require(_0x7c9d('0x0'));var util=require(_0x7c9d('0x1'));var path=require(_0x7c9d('0x2'));var timeout=require(_0x7c9d('0x3'));var express=require(_0x7c9d('0x4'));var router=express[_0x7c9d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7c9d('0x6'));var interaction=require(_0x7c9d('0x7'));var config=require(_0x7c9d('0x8'));var controller=require(_0x7c9d('0x9'));router[_0x7c9d('0xa')]('/',auth[_0x7c9d('0xb')](),controller[_0x7c9d('0xc')]);router[_0x7c9d('0xa')]('/:id',auth[_0x7c9d('0xb')](),controller[_0x7c9d('0xd')]);router[_0x7c9d('0xa')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x7c9d('0xe')]);router[_0x7c9d('0xa')](_0x7c9d('0xf'),auth[_0x7c9d('0xb')](),controller[_0x7c9d('0x10')]);router[_0x7c9d('0xa')](_0x7c9d('0x11'),auth['isAuthenticated'](),controller['getActions']);router[_0x7c9d('0x12')]('/',auth['isAuthenticated'](),controller[_0x7c9d('0x13')]);router[_0x7c9d('0x12')](_0x7c9d('0x14'),auth[_0x7c9d('0xb')](),controller[_0x7c9d('0x15')]);router[_0x7c9d('0x12')](_0x7c9d('0xf'),auth[_0x7c9d('0xb')](),controller[_0x7c9d('0x16')]);router[_0x7c9d('0x12')]('/:id/actions',auth[_0x7c9d('0xb')](),controller[_0x7c9d('0x17')]);router['put'](_0x7c9d('0x18'),auth['isAuthenticated'](),controller['update']);router[_0x7c9d('0x19')](_0x7c9d('0x18'),auth[_0x7c9d('0xb')](),controller[_0x7c9d('0x1a')]);module[_0x7c9d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ca02054..d629087 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 _0x5fae=['sequelize','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5fae,0x93));var _0xe5fa=function(_0x377e11,_0x28ab14){_0x377e11=_0x377e11-0x0;var _0x54f09c=_0x5fae[_0x377e11];return _0x54f09c;};'use strict';var Sequelize=require(_0xe5fa('0x0'));module[_0xe5fa('0x1')]={'name':{'type':Sequelize[_0xe5fa('0x2')]},'channel':{'type':Sequelize[_0xe5fa('0x2')]},'description':{'type':Sequelize[_0xe5fa('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x945e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1d2c3c,_0xf082dc){var _0x3aa051=function(_0x5a1ea6){while(--_0x5a1ea6){_0x1d2c3c['push'](_0x1d2c3c['shift']());}};_0x3aa051(++_0xf082dc);}(_0x945e,0x1b9));var _0xe945=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x945e[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0xe945('0x0'));module[_0xe945('0x1')]={'name':{'type':Sequelize[_0xe945('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe945('0x2')]},'status':{'type':Sequelize[_0xe945('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 72bc0e4..fb5be53 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 _0xd75f=['set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','name','send','map','Trigger','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','addAnyCondition','Condition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count'];(function(_0xee7236,_0x26416a){var _0x5be403=function(_0x1a21bb){while(--_0x1a21bb){_0xee7236['push'](_0xee7236['shift']());}};_0x5be403(++_0x26416a);}(_0xd75f,0x166));var _0xfd75=function(_0x3b6ccb,_0x1893e6){_0x3b6ccb=_0x3b6ccb-0x0;var _0x1ac9da=_0xd75f[_0x3b6ccb];return _0x1ac9da;};'use strict';var emlformat=require(_0xfd75('0x0'));var rimraf=require(_0xfd75('0x1'));var zipdir=require(_0xfd75('0x2'));var jsonpatch=require(_0xfd75('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfd75('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfd75('0x5'));var sox=require(_0xfd75('0x6'));var csv=require(_0xfd75('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd75('0x8'));var _=require(_0xfd75('0x9'));var squel=require(_0xfd75('0xa'));var crypto=require(_0xfd75('0xb'));var jsforce=require(_0xfd75('0xc'));var deskjs=require(_0xfd75('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfd75('0xe'));var Papa=require(_0xfd75('0xf'));var Redis=require(_0xfd75('0x10'));var authService=require(_0xfd75('0x11'));var qs=require(_0xfd75('0x12'));var as=require(_0xfd75('0x13'));var hardwareService=require(_0xfd75('0x14'));var logger=require(_0xfd75('0x15'))(_0xfd75('0x16'));var utils=require(_0xfd75('0x17'));var config=require(_0xfd75('0x18'));var licenseUtil=require(_0xfd75('0x19'));var db=require(_0xfd75('0x1a'))['db'];function respondWithStatusCode(_0x1e88b7,_0x38a1ef){_0x38a1ef=_0x38a1ef||0xcc;return function(_0x49d327){if(_0x49d327){return _0x1e88b7[_0xfd75('0x1b')](_0x38a1ef);}return _0x1e88b7[_0xfd75('0x1c')](_0x38a1ef)['end']();};}function respondWithResult(_0xfa3311,_0x4c29ae){_0x4c29ae=_0x4c29ae||0xc8;return function(_0x8f5193){if(_0x8f5193){return _0xfa3311[_0xfd75('0x1c')](_0x4c29ae)[_0xfd75('0x1d')](_0x8f5193);}};}function respondWithFilteredResult(_0x1b6a8b,_0x41baba){return function(_0x4cbe07){if(_0x4cbe07){var _0x329f98=typeof _0x41baba['offset']===_0xfd75('0x1e')&&typeof _0x41baba[_0xfd75('0x1f')]===_0xfd75('0x1e');var _0x18a819=_0x4cbe07['count'];var _0x235b8c=_0x329f98?0x0:_0x41baba[_0xfd75('0x20')];var _0x515a26=_0x329f98?_0x4cbe07[_0xfd75('0x21')]:_0x41baba[_0xfd75('0x20')]+_0x41baba[_0xfd75('0x1f')];var _0x5de15d;if(_0x515a26>=_0x18a819){_0x515a26=_0x18a819;_0x5de15d=0xc8;}else{_0x5de15d=0xce;}_0x1b6a8b['status'](_0x5de15d);return _0x1b6a8b[_0xfd75('0x22')]('Content-Range',_0x235b8c+'-'+_0x515a26+'/'+_0x18a819)[_0xfd75('0x1d')](_0x4cbe07);}return null;};}function patchUpdates(_0x40e5c5){return function(_0x3df1e6){try{jsonpatch[_0xfd75('0x23')](_0x3df1e6,_0x40e5c5,!![]);}catch(_0x1354a3){return BPromise[_0xfd75('0x24')](_0x1354a3);}return _0x3df1e6[_0xfd75('0x25')]();};}function saveUpdates(_0x2fc55b,_0x183fc9){return function(_0x36dc92){if(_0x36dc92){return _0x36dc92[_0xfd75('0x26')](_0x2fc55b)[_0xfd75('0x27')](function(_0x7916c4){return _0x7916c4;});}return null;};}function removeEntity(_0x386e35,_0x9fa9cd){return function(_0x50910e){if(_0x50910e){return _0x50910e[_0xfd75('0x28')]()['then'](function(){var _0x48ba31=_0x50910e['get']({'plain':!![]});var _0x55280b=_0xfd75('0x29');return db[_0xfd75('0x2a')][_0xfd75('0x28')]({'where':{'type':_0x55280b,'resourceId':_0x48ba31['id']}})['then'](function(){return _0x50910e;});})[_0xfd75('0x27')](function(){_0x386e35['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x610bfc,_0x48aa78){return function(_0x4c99c3){if(!_0x4c99c3){_0x610bfc[_0xfd75('0x1b')](0x194);}return _0x4c99c3;};}function handleError(_0x55fa4b,_0x3d3ed6){_0x3d3ed6=_0x3d3ed6||0x1f4;return function(_0x2275e5){logger['error'](_0x2275e5['stack']);if(_0x2275e5['name']){delete _0x2275e5[_0xfd75('0x2b')];}_0x55fa4b[_0xfd75('0x1c')](_0x3d3ed6)[_0xfd75('0x2c')](_0x2275e5);};}exports['index']=function(_0x51b4c0,_0x32b4c9){var _0x359c1e={},_0x374ea0={},_0x3e5878={'count':0x0,'rows':[]};var _0x27919c=_[_0xfd75('0x2d')](db[_0xfd75('0x2e')]['rawAttributes'],function(_0x15162b){return{'name':_0x15162b[_0xfd75('0x2f')],'type':_0x15162b['type']['key']};});_0x374ea0[_0xfd75('0x30')]=_['map'](_0x27919c,_0xfd75('0x2b'));_0x374ea0[_0xfd75('0x31')]=_[_0xfd75('0x32')](_0x51b4c0[_0xfd75('0x31')]);_0x374ea0[_0xfd75('0x33')]=_[_0xfd75('0x34')](_0x374ea0[_0xfd75('0x30')],_0x374ea0[_0xfd75('0x31')]);_0x359c1e[_0xfd75('0x35')]=_[_0xfd75('0x34')](_0x374ea0[_0xfd75('0x30')],qs[_0xfd75('0x36')](_0x51b4c0['query']['fields']));_0x359c1e[_0xfd75('0x35')]=_0x359c1e[_0xfd75('0x35')]['length']?_0x359c1e[_0xfd75('0x35')]:_0x374ea0[_0xfd75('0x30')];if(!_0x51b4c0['query'][_0xfd75('0x37')](_0xfd75('0x38'))){_0x359c1e['limit']=qs[_0xfd75('0x1f')](_0x51b4c0[_0xfd75('0x31')][_0xfd75('0x1f')]);_0x359c1e[_0xfd75('0x20')]=qs[_0xfd75('0x20')](_0x51b4c0[_0xfd75('0x31')][_0xfd75('0x20')]);}_0x359c1e[_0xfd75('0x39')]=qs[_0xfd75('0x3a')](_0x51b4c0[_0xfd75('0x31')]['sort']);_0x359c1e[_0xfd75('0x3b')]=qs[_0xfd75('0x33')](_[_0xfd75('0x3c')](_0x51b4c0[_0xfd75('0x31')],_0x374ea0[_0xfd75('0x33')]),_0x27919c);if(_0x51b4c0[_0xfd75('0x31')][_0xfd75('0x3d')]){_0x359c1e[_0xfd75('0x3b')]=_[_0xfd75('0x3e')](_0x359c1e[_0xfd75('0x3b')],{'$or':_[_0xfd75('0x2d')](_0x27919c,function(_0x4ff66e){if(_0x4ff66e[_0xfd75('0x3f')]!==_0xfd75('0x40')){var _0x4f9af2={};_0x4f9af2[_0x4ff66e[_0xfd75('0x2b')]]={'$like':'%'+_0x51b4c0['query'][_0xfd75('0x3d')]+'%'};return _0x4f9af2;}})});}_0x359c1e=_[_0xfd75('0x3e')]({},_0x359c1e,_0x51b4c0[_0xfd75('0x41')]);var _0x3751c8={'where':_0x359c1e[_0xfd75('0x3b')]};return db[_0xfd75('0x2e')]['count'](_0x3751c8)[_0xfd75('0x27')](function(_0x29ea6b){_0x3e5878[_0xfd75('0x21')]=_0x29ea6b;if(_0x51b4c0[_0xfd75('0x31')][_0xfd75('0x42')]){_0x359c1e[_0xfd75('0x43')]=[{'all':!![]}];}return db[_0xfd75('0x2e')][_0xfd75('0x44')](_0x359c1e);})[_0xfd75('0x27')](function(_0x108c13){_0x3e5878[_0xfd75('0x45')]=_0x108c13;return _0x3e5878;})[_0xfd75('0x27')](respondWithFilteredResult(_0x32b4c9,_0x359c1e))[_0xfd75('0x46')](handleError(_0x32b4c9,null));};exports[_0xfd75('0x47')]=function(_0x4d7b77,_0x312e9e){var _0x4ebf80={'raw':![],'where':{'id':_0x4d7b77[_0xfd75('0x48')]['id']}},_0x2b2ead={};_0x2b2ead[_0xfd75('0x30')]=_[_0xfd75('0x32')](db[_0xfd75('0x2e')][_0xfd75('0x49')]);_0x2b2ead[_0xfd75('0x31')]=_['keys'](_0x4d7b77[_0xfd75('0x31')]);_0x2b2ead[_0xfd75('0x33')]=_[_0xfd75('0x34')](_0x2b2ead['model'],_0x2b2ead[_0xfd75('0x31')]);_0x4ebf80[_0xfd75('0x35')]=_[_0xfd75('0x34')](_0x2b2ead[_0xfd75('0x30')],qs[_0xfd75('0x36')](_0x4d7b77[_0xfd75('0x31')][_0xfd75('0x36')]));_0x4ebf80[_0xfd75('0x35')]=_0x4ebf80['attributes'][_0xfd75('0x4a')]?_0x4ebf80[_0xfd75('0x35')]:_0x2b2ead[_0xfd75('0x30')];if(_0x4d7b77[_0xfd75('0x31')][_0xfd75('0x42')]){_0x4ebf80['include']=[{'all':!![]}];}_0x4ebf80=_[_0xfd75('0x3e')]({},_0x4ebf80,_0x4d7b77[_0xfd75('0x41')]);return db[_0xfd75('0x2e')][_0xfd75('0x4b')](_0x4ebf80)[_0xfd75('0x27')](handleEntityNotFound(_0x312e9e,null))[_0xfd75('0x27')](respondWithResult(_0x312e9e,null))[_0xfd75('0x46')](handleError(_0x312e9e,null));};exports['create']=function(_0x538ace,_0x2858a3){return db[_0xfd75('0x2e')]['create'](_0x538ace['body'],{})[_0xfd75('0x27')](function(_0x3036f1){var _0x4d6791=_0x538ace[_0xfd75('0x4c')]['get']({'plain':!![]});if(!_0x4d6791)throw new Error(_0xfd75('0x4d'));if(_0x4d6791[_0xfd75('0x4e')]==='user'){var _0x423cd9=_0x3036f1[_0xfd75('0x4f')]({'plain':!![]});var _0x2d4b01=_0xfd75('0x29');return db[_0xfd75('0x50')][_0xfd75('0x4b')]({'where':{'name':_0x2d4b01,'userProfileId':_0x4d6791[_0xfd75('0x51')]},'raw':!![]})[_0xfd75('0x27')](function(_0x1798ae){if(_0x1798ae&&_0x1798ae[_0xfd75('0x52')]===0x0){return db[_0xfd75('0x2a')][_0xfd75('0x53')]({'name':_0x423cd9[_0xfd75('0x2b')],'resourceId':_0x423cd9['id'],'type':_0x1798ae[_0xfd75('0x2b')],'sectionId':_0x1798ae['id']},{})[_0xfd75('0x27')](function(){return _0x3036f1;});}else{return _0x3036f1;}})[_0xfd75('0x46')](function(_0xbe59ad){logger[_0xfd75('0x54')](_0xfd75('0x55'),_0xbe59ad);throw _0xbe59ad;});}return _0x3036f1;})['then'](respondWithResult(_0x2858a3,0xc9))[_0xfd75('0x46')](handleError(_0x2858a3,null));};exports[_0xfd75('0x26')]=function(_0x1441a5,_0x56b541){if(_0x1441a5[_0xfd75('0x56')]['id']){delete _0x1441a5[_0xfd75('0x56')]['id'];}return db[_0xfd75('0x2e')][_0xfd75('0x4b')]({'where':{'id':_0x1441a5[_0xfd75('0x48')]['id']}})['then'](handleEntityNotFound(_0x56b541,null))[_0xfd75('0x27')](saveUpdates(_0x1441a5[_0xfd75('0x56')],null))['then'](respondWithResult(_0x56b541,null))[_0xfd75('0x46')](handleError(_0x56b541,null));};exports['destroy']=function(_0x1d16ae,_0x17c44b){return db['Trigger'][_0xfd75('0x4b')]({'where':{'id':_0x1d16ae[_0xfd75('0x48')]['id']}})[_0xfd75('0x27')](handleEntityNotFound(_0x17c44b,null))[_0xfd75('0x27')](removeEntity(_0x17c44b,null))['catch'](handleError(_0x17c44b,null));};exports[_0xfd75('0x57')]=function(_0x427f1c,_0x2ea395,_0x4e13dc){if(_0x427f1c[_0xfd75('0x56')]['id']){delete _0x427f1c[_0xfd75('0x56')]['id'];}return db[_0xfd75('0x2e')][_0xfd75('0x4b')]({'where':{'id':_0x427f1c[_0xfd75('0x48')]['id']}})[_0xfd75('0x27')](handleEntityNotFound(_0x2ea395,null))['then'](function(_0x1e852d){if(_0x1e852d){_0x427f1c['body'][_0xfd75('0x58')]=_0x1e852d['id'];return db['Condition'][_0xfd75('0x53')](_0x427f1c[_0xfd75('0x56')]);}})[_0xfd75('0x27')](respondWithResult(_0x2ea395,null))[_0xfd75('0x46')](handleError(_0x2ea395,null));};exports[_0xfd75('0x59')]=function(_0x115369,_0x2658db,_0x5a6a34){if(_0x115369[_0xfd75('0x56')]['id']){delete _0x115369['body']['id'];}return db[_0xfd75('0x2e')][_0xfd75('0x4b')]({'where':{'id':_0x115369[_0xfd75('0x48')]['id']}})[_0xfd75('0x27')](handleEntityNotFound(_0x2658db,null))['then'](function(_0x241fc5){if(_0x241fc5){_0x115369['body']['TriggerAnyId']=_0x241fc5['id'];return db[_0xfd75('0x5a')][_0xfd75('0x53')](_0x115369[_0xfd75('0x56')]);}})['then'](respondWithResult(_0x2658db,null))[_0xfd75('0x46')](handleError(_0x2658db,null));};exports['getAllConditions']=function(_0x455b15,_0x16f181,_0x43c8f8){var _0x5afc94={};var _0x36ac87={};var _0x35ccb3;var _0x3e7a93;return db[_0xfd75('0x2e')]['findOne']({'where':{'id':_0x455b15[_0xfd75('0x48')]['id']}})[_0xfd75('0x27')](handleEntityNotFound(_0x16f181,null))[_0xfd75('0x27')](function(_0x2616db){if(_0x2616db){_0x35ccb3=_0x2616db;_0x36ac87[_0xfd75('0x30')]=_[_0xfd75('0x32')](db[_0xfd75('0x5a')][_0xfd75('0x49')]);_0x36ac87['query']=_[_0xfd75('0x32')](_0x455b15['query']);_0x36ac87[_0xfd75('0x33')]=_['intersection'](_0x36ac87[_0xfd75('0x30')],_0x36ac87[_0xfd75('0x31')]);_0x5afc94['attributes']=_[_0xfd75('0x34')](_0x36ac87[_0xfd75('0x30')],qs[_0xfd75('0x36')](_0x455b15[_0xfd75('0x31')][_0xfd75('0x36')]));_0x5afc94[_0xfd75('0x35')]=_0x5afc94[_0xfd75('0x35')]['length']?_0x5afc94[_0xfd75('0x35')]:_0x36ac87[_0xfd75('0x30')];_0x5afc94[_0xfd75('0x39')]=qs['sort'](_0x455b15[_0xfd75('0x31')][_0xfd75('0x3a')]);_0x5afc94[_0xfd75('0x3b')]=qs[_0xfd75('0x33')](_[_0xfd75('0x3c')](_0x455b15[_0xfd75('0x31')],_0x36ac87[_0xfd75('0x33')]));if(_0x455b15[_0xfd75('0x31')][_0xfd75('0x3d')]){_0x5afc94[_0xfd75('0x3b')]=_[_0xfd75('0x3e')](_0x5afc94['where'],{'$or':_[_0xfd75('0x2d')](_0x5afc94['attributes'],function(_0x5462fd){var _0x1f39a7={};_0x1f39a7[_0x5462fd]={'$like':'%'+_0x455b15[_0xfd75('0x31')][_0xfd75('0x3d')]+'%'};return _0x1f39a7;})});}_0x5afc94=_[_0xfd75('0x3e')]({},_0x5afc94,_0x455b15[_0xfd75('0x41')]);return _0x35ccb3[_0xfd75('0x5b')](_0x5afc94);}})[_0xfd75('0x27')](function(_0x48454c){if(_0x48454c){_0x3e7a93=_0x48454c[_0xfd75('0x4a')];if(!_0x455b15[_0xfd75('0x31')][_0xfd75('0x37')](_0xfd75('0x38'))){_0x5afc94[_0xfd75('0x1f')]=qs[_0xfd75('0x1f')](_0x455b15[_0xfd75('0x31')]['limit']);_0x5afc94[_0xfd75('0x20')]=qs[_0xfd75('0x20')](_0x455b15[_0xfd75('0x31')][_0xfd75('0x20')]);}return _0x35ccb3['getAllConditions'](_0x5afc94);}})['then'](function(_0x1ef6bf){if(_0x1ef6bf){return _0x1ef6bf?{'count':_0x3e7a93,'rows':_0x1ef6bf}:null;}})[_0xfd75('0x27')](respondWithResult(_0x16f181,null))[_0xfd75('0x46')](handleError(_0x16f181,null));};exports[_0xfd75('0x5c')]=function(_0x3234bc,_0x12cbcf,_0x19c122){var _0x12ec5b={};var _0xa29db5={};var _0x34ddfe;var _0x4bf1e0;return db[_0xfd75('0x2e')][_0xfd75('0x5d')]({'where':{'id':_0x3234bc[_0xfd75('0x48')]['id']}})['then'](handleEntityNotFound(_0x12cbcf,null))[_0xfd75('0x27')](function(_0x5a7eb1){if(_0x5a7eb1){_0x34ddfe=_0x5a7eb1;_0xa29db5[_0xfd75('0x30')]=_['keys'](db[_0xfd75('0x5a')][_0xfd75('0x49')]);_0xa29db5['query']=_[_0xfd75('0x32')](_0x3234bc['query']);_0xa29db5['filters']=_['intersection'](_0xa29db5[_0xfd75('0x30')],_0xa29db5[_0xfd75('0x31')]);_0x12ec5b[_0xfd75('0x35')]=_[_0xfd75('0x34')](_0xa29db5['model'],qs['fields'](_0x3234bc[_0xfd75('0x31')][_0xfd75('0x36')]));_0x12ec5b[_0xfd75('0x35')]=_0x12ec5b[_0xfd75('0x35')]['length']?_0x12ec5b[_0xfd75('0x35')]:_0xa29db5[_0xfd75('0x30')];_0x12ec5b[_0xfd75('0x39')]=qs[_0xfd75('0x3a')](_0x3234bc['query']['sort']);_0x12ec5b[_0xfd75('0x3b')]=qs['filters'](_[_0xfd75('0x3c')](_0x3234bc['query'],_0xa29db5[_0xfd75('0x33')]));if(_0x3234bc['query']['filter']){_0x12ec5b[_0xfd75('0x3b')]=_[_0xfd75('0x3e')](_0x12ec5b[_0xfd75('0x3b')],{'$or':_[_0xfd75('0x2d')](_0x12ec5b['attributes'],function(_0x327bc3){var _0x1e6d2f={};_0x1e6d2f[_0x327bc3]={'$like':'%'+_0x3234bc[_0xfd75('0x31')]['filter']+'%'};return _0x1e6d2f;})});}_0x12ec5b=_['merge']({},_0x12ec5b,_0x3234bc[_0xfd75('0x41')]);return _0x34ddfe['getAnyConditions'](_0x12ec5b);}})[_0xfd75('0x27')](function(_0xb0b392){if(_0xb0b392){_0x4bf1e0=_0xb0b392[_0xfd75('0x4a')];if(!_0x3234bc['query'][_0xfd75('0x37')](_0xfd75('0x38'))){_0x12ec5b[_0xfd75('0x1f')]=qs['limit'](_0x3234bc['query'][_0xfd75('0x1f')]);_0x12ec5b[_0xfd75('0x20')]=qs[_0xfd75('0x20')](_0x3234bc[_0xfd75('0x31')][_0xfd75('0x20')]);}return _0x34ddfe[_0xfd75('0x5c')](_0x12ec5b);}})['then'](function(_0x5da1ac){if(_0x5da1ac){return _0x5da1ac?{'count':_0x4bf1e0,'rows':_0x5da1ac}:null;}})[_0xfd75('0x27')](respondWithResult(_0x12cbcf,null))[_0xfd75('0x46')](handleError(_0x12cbcf,null));};exports[_0xfd75('0x5e')]=function(_0x337f17,_0x1d5a31,_0x489261){if(_0x337f17[_0xfd75('0x56')]['id']){delete _0x337f17[_0xfd75('0x56')]['id'];}return db[_0xfd75('0x2e')]['find']({'where':{'id':_0x337f17[_0xfd75('0x48')]['id']}})[_0xfd75('0x27')](handleEntityNotFound(_0x1d5a31,null))[_0xfd75('0x27')](function(_0x1fd167){if(_0x1fd167){_0x337f17[_0xfd75('0x56')][_0xfd75('0x5f')]=_0x1fd167['id'];return db['Action'][_0xfd75('0x53')](_0x337f17[_0xfd75('0x56')]);}})['then'](respondWithResult(_0x1d5a31,null))['catch'](handleError(_0x1d5a31,null));};exports[_0xfd75('0x60')]=function(_0x2dc336,_0x1e706f,_0x599f72){var _0x1b1f71={};var _0x350144={};var _0x2abdf7;var _0x3e3f5a;return db[_0xfd75('0x2e')]['findOne']({'where':{'id':_0x2dc336[_0xfd75('0x48')]['id']}})[_0xfd75('0x27')](handleEntityNotFound(_0x1e706f,null))[_0xfd75('0x27')](function(_0x2e22fb){if(_0x2e22fb){_0x2abdf7=_0x2e22fb;_0x350144[_0xfd75('0x30')]=_[_0xfd75('0x32')](db[_0xfd75('0x61')][_0xfd75('0x49')]);_0x350144[_0xfd75('0x31')]=_[_0xfd75('0x32')](_0x2dc336[_0xfd75('0x31')]);_0x350144[_0xfd75('0x33')]=_['intersection'](_0x350144[_0xfd75('0x30')],_0x350144[_0xfd75('0x31')]);_0x1b1f71[_0xfd75('0x35')]=_[_0xfd75('0x34')](_0x350144[_0xfd75('0x30')],qs[_0xfd75('0x36')](_0x2dc336[_0xfd75('0x31')][_0xfd75('0x36')]));_0x1b1f71[_0xfd75('0x35')]=_0x1b1f71[_0xfd75('0x35')]['length']?_0x1b1f71[_0xfd75('0x35')]:_0x350144[_0xfd75('0x30')];_0x1b1f71[_0xfd75('0x39')]=qs[_0xfd75('0x3a')](_0x2dc336[_0xfd75('0x31')][_0xfd75('0x3a')]);_0x1b1f71[_0xfd75('0x3b')]=qs[_0xfd75('0x33')](_['pick'](_0x2dc336[_0xfd75('0x31')],_0x350144[_0xfd75('0x33')]));if(_0x2dc336[_0xfd75('0x31')][_0xfd75('0x3d')]){_0x1b1f71['where']=_[_0xfd75('0x3e')](_0x1b1f71[_0xfd75('0x3b')],{'$or':_[_0xfd75('0x2d')](_0x1b1f71['attributes'],function(_0x10c67f){var _0x35c6b7={};_0x35c6b7[_0x10c67f]={'$like':'%'+_0x2dc336[_0xfd75('0x31')][_0xfd75('0x3d')]+'%'};return _0x35c6b7;})});}_0x1b1f71=_['merge']({},_0x1b1f71,_0x2dc336[_0xfd75('0x41')]);return _0x2abdf7[_0xfd75('0x60')](_0x1b1f71);}})[_0xfd75('0x27')](function(_0x411103){if(_0x411103){_0x3e3f5a=_0x411103['length'];if(!_0x2dc336[_0xfd75('0x31')][_0xfd75('0x37')]('nolimit')){_0x1b1f71[_0xfd75('0x1f')]=qs[_0xfd75('0x1f')](_0x2dc336[_0xfd75('0x31')][_0xfd75('0x1f')]);_0x1b1f71[_0xfd75('0x20')]=qs[_0xfd75('0x20')](_0x2dc336[_0xfd75('0x31')][_0xfd75('0x20')]);}return _0x2abdf7[_0xfd75('0x60')](_0x1b1f71);}})[_0xfd75('0x27')](function(_0x4f9f04){if(_0x4f9f04){return _0x4f9f04?{'count':_0x3e3f5a,'rows':_0x4f9f04}:null;}})[_0xfd75('0x27')](respondWithResult(_0x1e706f,null))['catch'](handleError(_0x1e706f,null));}; \ No newline at end of file +var _0x2426=['fields','length','hasOwnProperty','sort','filters','pick','filter','where','type','options','includeAll','include','findAll','catch','params','rawAttributes','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','order','getAllConditions','nolimit','getAnyConditions','findOne','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','Triggers','end','name','send','index','Trigger','fieldName','key','model','map','query','keys','intersection','attributes'];(function(_0x44e4a1,_0x3d053a){var _0x546ad3=function(_0x5dd44c){while(--_0x5dd44c){_0x44e4a1['push'](_0x44e4a1['shift']());}};_0x546ad3(++_0x3d053a);}(_0x2426,0x19f));var _0x6242=function(_0x3cfa48,_0x21e933){_0x3cfa48=_0x3cfa48-0x0;var _0x10f59a=_0x2426[_0x3cfa48];return _0x10f59a;};'use strict';var emlformat=require(_0x6242('0x0'));var rimraf=require(_0x6242('0x1'));var zipdir=require(_0x6242('0x2'));var jsonpatch=require(_0x6242('0x3'));var rp=require(_0x6242('0x4'));var moment=require(_0x6242('0x5'));var BPromise=require(_0x6242('0x6'));var Mustache=require(_0x6242('0x7'));var util=require('util');var path=require(_0x6242('0x8'));var sox=require(_0x6242('0x9'));var csv=require('to-csv');var ejs=require(_0x6242('0xa'));var fs=require('fs');var fs_extra=require(_0x6242('0xb'));var _=require(_0x6242('0xc'));var squel=require(_0x6242('0xd'));var crypto=require(_0x6242('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6242('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6242('0x10'));var Papa=require(_0x6242('0x11'));var Redis=require(_0x6242('0x12'));var authService=require(_0x6242('0x13'));var qs=require(_0x6242('0x14'));var as=require(_0x6242('0x15'));var hardwareService=require(_0x6242('0x16'));var logger=require(_0x6242('0x17'))(_0x6242('0x18'));var utils=require(_0x6242('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6242('0x1a'))['db'];function respondWithStatusCode(_0x2165c2,_0x5e21a1){_0x5e21a1=_0x5e21a1||0xcc;return function(_0x353be8){if(_0x353be8){return _0x2165c2[_0x6242('0x1b')](_0x5e21a1);}return _0x2165c2[_0x6242('0x1c')](_0x5e21a1)['end']();};}function respondWithResult(_0xd027ee,_0x4e1076){_0x4e1076=_0x4e1076||0xc8;return function(_0x2cb7ea){if(_0x2cb7ea){return _0xd027ee[_0x6242('0x1c')](_0x4e1076)[_0x6242('0x1d')](_0x2cb7ea);}};}function respondWithFilteredResult(_0x57cc38,_0x1ee15f){return function(_0x95c4ef){if(_0x95c4ef){var _0x5a42c0=typeof _0x1ee15f[_0x6242('0x1e')]===_0x6242('0x1f')&&typeof _0x1ee15f['limit']==='undefined';var _0x39fa32=_0x95c4ef[_0x6242('0x20')];var _0x43d287=_0x5a42c0?0x0:_0x1ee15f[_0x6242('0x1e')];var _0x1b3bc6=_0x5a42c0?_0x95c4ef['count']:_0x1ee15f[_0x6242('0x1e')]+_0x1ee15f[_0x6242('0x21')];var _0x11bfc5;if(_0x1b3bc6>=_0x39fa32){_0x1b3bc6=_0x39fa32;_0x11bfc5=0xc8;}else{_0x11bfc5=0xce;}_0x57cc38[_0x6242('0x1c')](_0x11bfc5);return _0x57cc38[_0x6242('0x22')]('Content-Range',_0x43d287+'-'+_0x1b3bc6+'/'+_0x39fa32)[_0x6242('0x1d')](_0x95c4ef);}return null;};}function patchUpdates(_0x1a7097){return function(_0x2062ab){try{jsonpatch[_0x6242('0x23')](_0x2062ab,_0x1a7097,!![]);}catch(_0x1b3b6f){return BPromise[_0x6242('0x24')](_0x1b3b6f);}return _0x2062ab[_0x6242('0x25')]();};}function saveUpdates(_0x47992f,_0x373cb5){return function(_0x24a142){if(_0x24a142){return _0x24a142[_0x6242('0x26')](_0x47992f)[_0x6242('0x27')](function(_0x4aa32e){return _0x4aa32e;});}return null;};}function removeEntity(_0x1c8e80,_0x40a049){return function(_0xab71cd){if(_0xab71cd){return _0xab71cd['destroy']()['then'](function(){var _0x59a91e=_0xab71cd[_0x6242('0x28')]({'plain':!![]});var _0x379960=_0x6242('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x379960,'resourceId':_0x59a91e['id']}})[_0x6242('0x27')](function(){return _0xab71cd;});})[_0x6242('0x27')](function(){_0x1c8e80[_0x6242('0x1c')](0xcc)[_0x6242('0x2a')]();});}};}function handleEntityNotFound(_0x10c915,_0x3db27d){return function(_0x7aae41){if(!_0x7aae41){_0x10c915[_0x6242('0x1b')](0x194);}return _0x7aae41;};}function handleError(_0x457a3e,_0x297966){_0x297966=_0x297966||0x1f4;return function(_0x4857f8){logger['error'](_0x4857f8['stack']);if(_0x4857f8['name']){delete _0x4857f8[_0x6242('0x2b')];}_0x457a3e[_0x6242('0x1c')](_0x297966)[_0x6242('0x2c')](_0x4857f8);};}exports[_0x6242('0x2d')]=function(_0x637ab,_0x3c58d6){var _0x2277b1={},_0x274ec7={},_0x18483f={'count':0x0,'rows':[]};var _0x49a726=_['map'](db[_0x6242('0x2e')]['rawAttributes'],function(_0x509f58){return{'name':_0x509f58[_0x6242('0x2f')],'type':_0x509f58['type'][_0x6242('0x30')]};});_0x274ec7[_0x6242('0x31')]=_[_0x6242('0x32')](_0x49a726,'name');_0x274ec7[_0x6242('0x33')]=_[_0x6242('0x34')](_0x637ab[_0x6242('0x33')]);_0x274ec7['filters']=_[_0x6242('0x35')](_0x274ec7[_0x6242('0x31')],_0x274ec7[_0x6242('0x33')]);_0x2277b1[_0x6242('0x36')]=_[_0x6242('0x35')](_0x274ec7[_0x6242('0x31')],qs[_0x6242('0x37')](_0x637ab[_0x6242('0x33')][_0x6242('0x37')]));_0x2277b1['attributes']=_0x2277b1[_0x6242('0x36')][_0x6242('0x38')]?_0x2277b1[_0x6242('0x36')]:_0x274ec7[_0x6242('0x31')];if(!_0x637ab[_0x6242('0x33')][_0x6242('0x39')]('nolimit')){_0x2277b1[_0x6242('0x21')]=qs[_0x6242('0x21')](_0x637ab[_0x6242('0x33')][_0x6242('0x21')]);_0x2277b1[_0x6242('0x1e')]=qs[_0x6242('0x1e')](_0x637ab[_0x6242('0x33')][_0x6242('0x1e')]);}_0x2277b1['order']=qs['sort'](_0x637ab['query'][_0x6242('0x3a')]);_0x2277b1['where']=qs[_0x6242('0x3b')](_[_0x6242('0x3c')](_0x637ab[_0x6242('0x33')],_0x274ec7[_0x6242('0x3b')]),_0x49a726);if(_0x637ab[_0x6242('0x33')][_0x6242('0x3d')]){_0x2277b1[_0x6242('0x3e')]=_['merge'](_0x2277b1['where'],{'$or':_[_0x6242('0x32')](_0x49a726,function(_0x584dbf){if(_0x584dbf[_0x6242('0x3f')]!=='VIRTUAL'){var _0x2c9dd3={};_0x2c9dd3[_0x584dbf['name']]={'$like':'%'+_0x637ab[_0x6242('0x33')][_0x6242('0x3d')]+'%'};return _0x2c9dd3;}})});}_0x2277b1=_['merge']({},_0x2277b1,_0x637ab[_0x6242('0x40')]);var _0x53612b={'where':_0x2277b1[_0x6242('0x3e')]};return db[_0x6242('0x2e')][_0x6242('0x20')](_0x53612b)[_0x6242('0x27')](function(_0x1cf11a){_0x18483f[_0x6242('0x20')]=_0x1cf11a;if(_0x637ab[_0x6242('0x33')][_0x6242('0x41')]){_0x2277b1[_0x6242('0x42')]=[{'all':!![]}];}return db[_0x6242('0x2e')][_0x6242('0x43')](_0x2277b1);})[_0x6242('0x27')](function(_0x35a81c){_0x18483f['rows']=_0x35a81c;return _0x18483f;})[_0x6242('0x27')](respondWithFilteredResult(_0x3c58d6,_0x2277b1))[_0x6242('0x44')](handleError(_0x3c58d6,null));};exports['show']=function(_0x5bf188,_0x3cbf4d){var _0x9301b3={'raw':![],'where':{'id':_0x5bf188[_0x6242('0x45')]['id']}},_0x5d30d7={};_0x5d30d7[_0x6242('0x31')]=_[_0x6242('0x34')](db[_0x6242('0x2e')][_0x6242('0x46')]);_0x5d30d7[_0x6242('0x33')]=_['keys'](_0x5bf188[_0x6242('0x33')]);_0x5d30d7[_0x6242('0x3b')]=_[_0x6242('0x35')](_0x5d30d7[_0x6242('0x31')],_0x5d30d7[_0x6242('0x33')]);_0x9301b3['attributes']=_[_0x6242('0x35')](_0x5d30d7[_0x6242('0x31')],qs[_0x6242('0x37')](_0x5bf188[_0x6242('0x33')][_0x6242('0x37')]));_0x9301b3[_0x6242('0x36')]=_0x9301b3[_0x6242('0x36')][_0x6242('0x38')]?_0x9301b3['attributes']:_0x5d30d7[_0x6242('0x31')];if(_0x5bf188[_0x6242('0x33')][_0x6242('0x41')]){_0x9301b3[_0x6242('0x42')]=[{'all':!![]}];}_0x9301b3=_[_0x6242('0x47')]({},_0x9301b3,_0x5bf188['options']);return db[_0x6242('0x2e')]['find'](_0x9301b3)[_0x6242('0x27')](handleEntityNotFound(_0x3cbf4d,null))['then'](respondWithResult(_0x3cbf4d,null))[_0x6242('0x44')](handleError(_0x3cbf4d,null));};exports[_0x6242('0x48')]=function(_0x558ccc,_0x59be5f){return db[_0x6242('0x2e')]['create'](_0x558ccc[_0x6242('0x49')],{})[_0x6242('0x27')](function(_0x44caae){var _0x338e69=_0x558ccc['user'][_0x6242('0x28')]({'plain':!![]});if(!_0x338e69)throw new Error(_0x6242('0x4a'));if(_0x338e69[_0x6242('0x4b')]==='user'){var _0x3b1c7d=_0x44caae['get']({'plain':!![]});var _0xcb859a=_0x6242('0x29');return db['UserProfileSection'][_0x6242('0x4c')]({'where':{'name':_0xcb859a,'userProfileId':_0x338e69[_0x6242('0x4d')]},'raw':!![]})[_0x6242('0x27')](function(_0x34e1b7){if(_0x34e1b7&&_0x34e1b7[_0x6242('0x4e')]===0x0){return db[_0x6242('0x4f')][_0x6242('0x48')]({'name':_0x3b1c7d[_0x6242('0x2b')],'resourceId':_0x3b1c7d['id'],'type':_0x34e1b7[_0x6242('0x2b')],'sectionId':_0x34e1b7['id']},{})[_0x6242('0x27')](function(){return _0x44caae;});}else{return _0x44caae;}})[_0x6242('0x44')](function(_0xde43f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xde43f4);throw _0xde43f4;});}return _0x44caae;})[_0x6242('0x27')](respondWithResult(_0x59be5f,0xc9))['catch'](handleError(_0x59be5f,null));};exports[_0x6242('0x26')]=function(_0x296a22,_0x3cdadb){if(_0x296a22[_0x6242('0x49')]['id']){delete _0x296a22[_0x6242('0x49')]['id'];}return db[_0x6242('0x2e')]['find']({'where':{'id':_0x296a22[_0x6242('0x45')]['id']}})[_0x6242('0x27')](handleEntityNotFound(_0x3cdadb,null))['then'](saveUpdates(_0x296a22[_0x6242('0x49')],null))[_0x6242('0x27')](respondWithResult(_0x3cdadb,null))['catch'](handleError(_0x3cdadb,null));};exports[_0x6242('0x50')]=function(_0x8a7968,_0x32f7c7){return db['Trigger'][_0x6242('0x4c')]({'where':{'id':_0x8a7968[_0x6242('0x45')]['id']}})[_0x6242('0x27')](handleEntityNotFound(_0x32f7c7,null))[_0x6242('0x27')](removeEntity(_0x32f7c7,null))[_0x6242('0x44')](handleError(_0x32f7c7,null));};exports[_0x6242('0x51')]=function(_0x2cbf65,_0x37a633,_0x3cac28){if(_0x2cbf65[_0x6242('0x49')]['id']){delete _0x2cbf65[_0x6242('0x49')]['id'];}return db['Trigger'][_0x6242('0x4c')]({'where':{'id':_0x2cbf65['params']['id']}})[_0x6242('0x27')](handleEntityNotFound(_0x37a633,null))['then'](function(_0x49bf9c){if(_0x49bf9c){_0x2cbf65[_0x6242('0x49')][_0x6242('0x52')]=_0x49bf9c['id'];return db[_0x6242('0x53')]['create'](_0x2cbf65[_0x6242('0x49')]);}})[_0x6242('0x27')](respondWithResult(_0x37a633,null))[_0x6242('0x44')](handleError(_0x37a633,null));};exports[_0x6242('0x54')]=function(_0x298f89,_0x2f27a6,_0x3e58ef){if(_0x298f89[_0x6242('0x49')]['id']){delete _0x298f89[_0x6242('0x49')]['id'];}return db[_0x6242('0x2e')][_0x6242('0x4c')]({'where':{'id':_0x298f89[_0x6242('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f27a6,null))[_0x6242('0x27')](function(_0x18c380){if(_0x18c380){_0x298f89[_0x6242('0x49')][_0x6242('0x55')]=_0x18c380['id'];return db[_0x6242('0x53')]['create'](_0x298f89[_0x6242('0x49')]);}})[_0x6242('0x27')](respondWithResult(_0x2f27a6,null))[_0x6242('0x44')](handleError(_0x2f27a6,null));};exports['getAllConditions']=function(_0x53b3a9,_0x413041,_0x16da61){var _0x349e4f={};var _0xe02028={};var _0x24210e;var _0x59362a;return db['Trigger']['findOne']({'where':{'id':_0x53b3a9['params']['id']}})[_0x6242('0x27')](handleEntityNotFound(_0x413041,null))['then'](function(_0x40cbe8){if(_0x40cbe8){_0x24210e=_0x40cbe8;_0xe02028[_0x6242('0x31')]=_[_0x6242('0x34')](db['Condition']['rawAttributes']);_0xe02028['query']=_['keys'](_0x53b3a9[_0x6242('0x33')]);_0xe02028[_0x6242('0x3b')]=_[_0x6242('0x35')](_0xe02028['model'],_0xe02028[_0x6242('0x33')]);_0x349e4f[_0x6242('0x36')]=_[_0x6242('0x35')](_0xe02028[_0x6242('0x31')],qs[_0x6242('0x37')](_0x53b3a9[_0x6242('0x33')]['fields']));_0x349e4f[_0x6242('0x36')]=_0x349e4f[_0x6242('0x36')]['length']?_0x349e4f[_0x6242('0x36')]:_0xe02028[_0x6242('0x31')];_0x349e4f[_0x6242('0x56')]=qs[_0x6242('0x3a')](_0x53b3a9[_0x6242('0x33')][_0x6242('0x3a')]);_0x349e4f[_0x6242('0x3e')]=qs['filters'](_[_0x6242('0x3c')](_0x53b3a9[_0x6242('0x33')],_0xe02028[_0x6242('0x3b')]));if(_0x53b3a9[_0x6242('0x33')][_0x6242('0x3d')]){_0x349e4f[_0x6242('0x3e')]=_[_0x6242('0x47')](_0x349e4f[_0x6242('0x3e')],{'$or':_[_0x6242('0x32')](_0x349e4f[_0x6242('0x36')],function(_0x53c6e7){var _0x581b79={};_0x581b79[_0x53c6e7]={'$like':'%'+_0x53b3a9['query'][_0x6242('0x3d')]+'%'};return _0x581b79;})});}_0x349e4f=_[_0x6242('0x47')]({},_0x349e4f,_0x53b3a9['options']);return _0x24210e[_0x6242('0x57')](_0x349e4f);}})[_0x6242('0x27')](function(_0x2e9202){if(_0x2e9202){_0x59362a=_0x2e9202[_0x6242('0x38')];if(!_0x53b3a9[_0x6242('0x33')][_0x6242('0x39')](_0x6242('0x58'))){_0x349e4f[_0x6242('0x21')]=qs[_0x6242('0x21')](_0x53b3a9[_0x6242('0x33')][_0x6242('0x21')]);_0x349e4f[_0x6242('0x1e')]=qs[_0x6242('0x1e')](_0x53b3a9[_0x6242('0x33')][_0x6242('0x1e')]);}return _0x24210e[_0x6242('0x57')](_0x349e4f);}})['then'](function(_0x1770d8){if(_0x1770d8){return _0x1770d8?{'count':_0x59362a,'rows':_0x1770d8}:null;}})[_0x6242('0x27')](respondWithResult(_0x413041,null))[_0x6242('0x44')](handleError(_0x413041,null));};exports[_0x6242('0x59')]=function(_0x1666e1,_0x12dc69,_0x3f5545){var _0x26455d={};var _0x1d8ac2={};var _0x206508;var _0x5d8704;return db['Trigger'][_0x6242('0x5a')]({'where':{'id':_0x1666e1[_0x6242('0x45')]['id']}})[_0x6242('0x27')](handleEntityNotFound(_0x12dc69,null))[_0x6242('0x27')](function(_0x15a1a8){if(_0x15a1a8){_0x206508=_0x15a1a8;_0x1d8ac2[_0x6242('0x31')]=_[_0x6242('0x34')](db[_0x6242('0x53')][_0x6242('0x46')]);_0x1d8ac2[_0x6242('0x33')]=_[_0x6242('0x34')](_0x1666e1[_0x6242('0x33')]);_0x1d8ac2[_0x6242('0x3b')]=_[_0x6242('0x35')](_0x1d8ac2[_0x6242('0x31')],_0x1d8ac2[_0x6242('0x33')]);_0x26455d['attributes']=_[_0x6242('0x35')](_0x1d8ac2[_0x6242('0x31')],qs[_0x6242('0x37')](_0x1666e1[_0x6242('0x33')][_0x6242('0x37')]));_0x26455d['attributes']=_0x26455d[_0x6242('0x36')][_0x6242('0x38')]?_0x26455d[_0x6242('0x36')]:_0x1d8ac2[_0x6242('0x31')];_0x26455d[_0x6242('0x56')]=qs[_0x6242('0x3a')](_0x1666e1[_0x6242('0x33')][_0x6242('0x3a')]);_0x26455d[_0x6242('0x3e')]=qs['filters'](_[_0x6242('0x3c')](_0x1666e1[_0x6242('0x33')],_0x1d8ac2[_0x6242('0x3b')]));if(_0x1666e1[_0x6242('0x33')][_0x6242('0x3d')]){_0x26455d[_0x6242('0x3e')]=_[_0x6242('0x47')](_0x26455d[_0x6242('0x3e')],{'$or':_[_0x6242('0x32')](_0x26455d[_0x6242('0x36')],function(_0x52169a){var _0x34c02d={};_0x34c02d[_0x52169a]={'$like':'%'+_0x1666e1[_0x6242('0x33')][_0x6242('0x3d')]+'%'};return _0x34c02d;})});}_0x26455d=_['merge']({},_0x26455d,_0x1666e1[_0x6242('0x40')]);return _0x206508[_0x6242('0x59')](_0x26455d);}})[_0x6242('0x27')](function(_0x45bd90){if(_0x45bd90){_0x5d8704=_0x45bd90['length'];if(!_0x1666e1[_0x6242('0x33')][_0x6242('0x39')](_0x6242('0x58'))){_0x26455d['limit']=qs[_0x6242('0x21')](_0x1666e1[_0x6242('0x33')][_0x6242('0x21')]);_0x26455d[_0x6242('0x1e')]=qs['offset'](_0x1666e1['query']['offset']);}return _0x206508[_0x6242('0x59')](_0x26455d);}})[_0x6242('0x27')](function(_0x484d91){if(_0x484d91){return _0x484d91?{'count':_0x5d8704,'rows':_0x484d91}:null;}})[_0x6242('0x27')](respondWithResult(_0x12dc69,null))[_0x6242('0x44')](handleError(_0x12dc69,null));};exports[_0x6242('0x5b')]=function(_0x213bc7,_0x4ca19b,_0x504377){if(_0x213bc7[_0x6242('0x49')]['id']){delete _0x213bc7[_0x6242('0x49')]['id'];}return db[_0x6242('0x2e')]['find']({'where':{'id':_0x213bc7['params']['id']}})[_0x6242('0x27')](handleEntityNotFound(_0x4ca19b,null))[_0x6242('0x27')](function(_0x90242f){if(_0x90242f){_0x213bc7['body']['TriggerId']=_0x90242f['id'];return db['Action'][_0x6242('0x48')](_0x213bc7[_0x6242('0x49')]);}})['then'](respondWithResult(_0x4ca19b,null))[_0x6242('0x44')](handleError(_0x4ca19b,null));};exports['getActions']=function(_0x50be99,_0x4180aa,_0x3a828b){var _0x469f9d={};var _0x9ac5d8={};var _0x561363;var _0x262610;return db[_0x6242('0x2e')][_0x6242('0x5a')]({'where':{'id':_0x50be99[_0x6242('0x45')]['id']}})[_0x6242('0x27')](handleEntityNotFound(_0x4180aa,null))[_0x6242('0x27')](function(_0x4e1b21){if(_0x4e1b21){_0x561363=_0x4e1b21;_0x9ac5d8['model']=_[_0x6242('0x34')](db[_0x6242('0x5c')][_0x6242('0x46')]);_0x9ac5d8[_0x6242('0x33')]=_[_0x6242('0x34')](_0x50be99[_0x6242('0x33')]);_0x9ac5d8['filters']=_[_0x6242('0x35')](_0x9ac5d8[_0x6242('0x31')],_0x9ac5d8['query']);_0x469f9d['attributes']=_['intersection'](_0x9ac5d8['model'],qs[_0x6242('0x37')](_0x50be99['query'][_0x6242('0x37')]));_0x469f9d[_0x6242('0x36')]=_0x469f9d[_0x6242('0x36')][_0x6242('0x38')]?_0x469f9d['attributes']:_0x9ac5d8[_0x6242('0x31')];_0x469f9d[_0x6242('0x56')]=qs[_0x6242('0x3a')](_0x50be99[_0x6242('0x33')][_0x6242('0x3a')]);_0x469f9d[_0x6242('0x3e')]=qs[_0x6242('0x3b')](_[_0x6242('0x3c')](_0x50be99[_0x6242('0x33')],_0x9ac5d8[_0x6242('0x3b')]));if(_0x50be99[_0x6242('0x33')][_0x6242('0x3d')]){_0x469f9d[_0x6242('0x3e')]=_[_0x6242('0x47')](_0x469f9d[_0x6242('0x3e')],{'$or':_[_0x6242('0x32')](_0x469f9d[_0x6242('0x36')],function(_0x1d69ec){var _0x2d59ec={};_0x2d59ec[_0x1d69ec]={'$like':'%'+_0x50be99['query'][_0x6242('0x3d')]+'%'};return _0x2d59ec;})});}_0x469f9d=_[_0x6242('0x47')]({},_0x469f9d,_0x50be99[_0x6242('0x40')]);return _0x561363[_0x6242('0x5d')](_0x469f9d);}})['then'](function(_0xb8ab42){if(_0xb8ab42){_0x262610=_0xb8ab42[_0x6242('0x38')];if(!_0x50be99[_0x6242('0x33')]['hasOwnProperty'](_0x6242('0x58'))){_0x469f9d[_0x6242('0x21')]=qs[_0x6242('0x21')](_0x50be99[_0x6242('0x33')][_0x6242('0x21')]);_0x469f9d['offset']=qs['offset'](_0x50be99[_0x6242('0x33')]['offset']);}return _0x561363[_0x6242('0x5d')](_0x469f9d);}})['then'](function(_0x3c1b16){if(_0x3c1b16){return _0x3c1b16?{'count':_0x262610,'rows':_0x3c1b16}:null;}})[_0x6242('0x27')](respondWithResult(_0x4180aa,null))['catch'](handleError(_0x4180aa,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 6579cfe..d1c5e5a 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 _0x5645=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5645,0x19e));var _0x5564=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x5645[_0x473738];return _0x1df4ae;};'use strict';var _=require(_0x5564('0x0'));var util=require(_0x5564('0x1'));var logger=require(_0x5564('0x2'))(_0x5564('0x3'));var moment=require(_0x5564('0x4'));var BPromise=require('bluebird');var rp=require(_0x5564('0x5'));var fs=require('fs');var path=require(_0x5564('0x6'));var rimraf=require(_0x5564('0x7'));var config=require(_0x5564('0x8'));var attributes=require(_0x5564('0x9'));module[_0x5564('0xa')]=function(_0x6d7911,_0x196e16){return _0x6d7911[_0x5564('0xb')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3ea=['../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x52505d,_0x443405){var _0x4e9247=function(_0x1bc1ed){while(--_0x1bc1ed){_0x52505d['push'](_0x52505d['shift']());}};_0x4e9247(++_0x443405);}(_0xb3ea,0x10d));var _0xab3e=function(_0x165904,_0x59b304){_0x165904=_0x165904-0x0;var _0x5151ab=_0xb3ea[_0x165904];return _0x5151ab;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var logger=require(_0xab3e('0x2'))('api');var moment=require(_0xab3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xab3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab3e('0x5'));var config=require(_0xab3e('0x6'));var attributes=require(_0xab3e('0x7'));module[_0xab3e('0x8')]=function(_0x135941,_0x570744){return _0x135941[_0xab3e('0x9')]('Trigger',attributes,{'tableName':_0xab3e('0xa'),'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 28dcf0b..e54e45c 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 _0x5084=['Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','include','map','model','attributes','debug','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x24df46,_0x40cc11){var _0x1cfbe5=function(_0x3f5ecb){while(--_0x3f5ecb){_0x24df46['push'](_0x24df46['shift']());}};_0x1cfbe5(++_0x40cc11);}(_0x5084,0xc7));var _0x4508=function(_0x443508,_0x5dbf10){_0x443508=_0x443508-0x0;var _0x544108=_0x5084[_0x443508];return _0x544108;};'use strict';var _=require(_0x4508('0x0'));var util=require(_0x4508('0x1'));var moment=require(_0x4508('0x2'));var BPromise=require(_0x4508('0x3'));var rs=require(_0x4508('0x4'));var fs=require('fs');var Redis=require(_0x4508('0x5'));var db=require(_0x4508('0x6'))['db'];var utils=require(_0x4508('0x7'));var logger=require('../../config/logger')(_0x4508('0x8'));var config=require(_0x4508('0x9'));var jayson=require(_0x4508('0xa'));var client=jayson[_0x4508('0xb')][_0x4508('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43366f,_0x2ed2c9,_0x74be72){return new BPromise(function(_0x299a4f,_0x42e0e2){return client['request'](_0x43366f,_0x74be72)[_0x4508('0xd')](function(_0x2ab0d0){logger[_0x4508('0xe')](_0x4508('0xf'),_0x2ed2c9,_0x4508('0x10'));logger['debug'](_0x4508('0x11'),_0x2ed2c9,'request\x20sent',JSON[_0x4508('0x12')](_0x2ab0d0));if(_0x2ab0d0[_0x4508('0x13')]){if(_0x2ab0d0[_0x4508('0x13')][_0x4508('0x14')]===0x1f4){logger[_0x4508('0x13')](_0x4508('0xf'),_0x2ed2c9,_0x2ab0d0[_0x4508('0x13')][_0x4508('0x15')]);return _0x42e0e2(_0x2ab0d0['error']['message']);}logger[_0x4508('0x13')]('Trigger,\x20%s,\x20%s',_0x2ed2c9,_0x2ab0d0[_0x4508('0x13')][_0x4508('0x15')]);return _0x299a4f(_0x2ab0d0['error'][_0x4508('0x15')]);}else{logger[_0x4508('0xe')](_0x4508('0xf'),_0x2ed2c9,_0x4508('0x10'));_0x299a4f(_0x2ab0d0[_0x4508('0x16')]['message']);}})[_0x4508('0x17')](function(_0xbe08c3){logger[_0x4508('0x13')](_0x4508('0xf'),_0x2ed2c9,_0xbe08c3);_0x42e0e2(_0xbe08c3);});});}exports[_0x4508('0x18')]=function(_0x22fbf2){var _0x353148=this;return new Promise(function(_0x1c5d1e,_0x297b5c){return db[_0x4508('0x19')]['findAll']({'raw':_0x22fbf2[_0x4508('0x1a')]?_0x22fbf2[_0x4508('0x1a')][_0x4508('0x1b')]===undefined?!![]:![]:!![],'where':_0x22fbf2[_0x4508('0x1a')]?_0x22fbf2['options'][_0x4508('0x1c')]||null:null,'attributes':_0x22fbf2[_0x4508('0x1a')]?_0x22fbf2[_0x4508('0x1a')]['attributes']||null:null,'limit':_0x22fbf2[_0x4508('0x1a')]?_0x22fbf2[_0x4508('0x1a')]['limit']||null:null,'include':_0x22fbf2[_0x4508('0x1a')]?_0x22fbf2[_0x4508('0x1a')][_0x4508('0x1d')]?_[_0x4508('0x1e')](_0x22fbf2[_0x4508('0x1a')]['include'],function(_0x5c8d2d){return{'model':db[_0x5c8d2d[_0x4508('0x1f')]],'as':_0x5c8d2d['as'],'attributes':_0x5c8d2d[_0x4508('0x20')],'include':_0x5c8d2d[_0x4508('0x1d')]?_['map'](_0x5c8d2d[_0x4508('0x1d')],function(_0x3169ff){return{'model':db[_0x3169ff['model']],'as':_0x3169ff['as'],'attributes':_0x3169ff[_0x4508('0x20')],'include':_0x3169ff[_0x4508('0x1d')]?_[_0x4508('0x1e')](_0x3169ff['include'],function(_0x3fbf00){return{'model':db[_0x3fbf00[_0x4508('0x1f')]],'as':_0x3fbf00['as'],'attributes':_0x3fbf00[_0x4508('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4508('0xd')](function(_0xa1347f){logger['info'](_0x4508('0x18'),_0x22fbf2);logger[_0x4508('0x21')](_0x4508('0x18'),_0x22fbf2,JSON[_0x4508('0x12')](_0xa1347f));_0x1c5d1e(_0xa1347f);})[_0x4508('0x17')](function(_0x264ba8){logger[_0x4508('0x13')](_0x4508('0x18'),_0x264ba8[_0x4508('0x15')],_0x22fbf2);_0x297b5c(_0x353148[_0x4508('0x13')](0x1f4,_0x264ba8[_0x4508('0x15')]));});});};exports['ShowTrigger']=function(_0x49bdf6){var _0x1a0de7=this;return new Promise(function(_0x5b5d8e,_0x2f26f2){return db['Trigger'][_0x4508('0x22')]({'raw':_0x49bdf6['options']?_0x49bdf6[_0x4508('0x1a')][_0x4508('0x1b')]===undefined?!![]:![]:!![],'where':_0x49bdf6[_0x4508('0x1a')]?_0x49bdf6[_0x4508('0x1a')]['where']||null:null,'attributes':_0x49bdf6[_0x4508('0x1a')]?_0x49bdf6[_0x4508('0x1a')]['attributes']||null:null,'include':_0x49bdf6[_0x4508('0x1a')]?_0x49bdf6['options'][_0x4508('0x1d')]?_['map'](_0x49bdf6[_0x4508('0x1a')][_0x4508('0x1d')],function(_0x2621af){return{'model':db[_0x2621af[_0x4508('0x1f')]],'as':_0x2621af['as'],'attributes':_0x2621af[_0x4508('0x20')],'include':_0x2621af['include']?_[_0x4508('0x1e')](_0x2621af[_0x4508('0x1d')],function(_0x49eb2e){return{'model':db[_0x49eb2e[_0x4508('0x1f')]],'as':_0x49eb2e['as'],'attributes':_0x49eb2e['attributes'],'include':_0x49eb2e[_0x4508('0x1d')]?_[_0x4508('0x1e')](_0x49eb2e['include'],function(_0x17748b){return{'model':db[_0x17748b[_0x4508('0x1f')]],'as':_0x17748b['as'],'attributes':_0x17748b[_0x4508('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4508('0xd')](function(_0x13e959){logger[_0x4508('0xe')](_0x4508('0x23'),_0x49bdf6);logger[_0x4508('0x21')](_0x4508('0x23'),_0x49bdf6,JSON['stringify'](_0x13e959));_0x5b5d8e(_0x13e959);})['catch'](function(_0xb00db5){logger[_0x4508('0x13')](_0x4508('0x23'),_0xb00db5[_0x4508('0x15')],_0x49bdf6);_0x2f26f2(_0x1a0de7[_0x4508('0x13')](0x1f4,_0xb00db5['message']));});});}; \ No newline at end of file +var _0x5823=['raw','where','attributes','limit','map','model','include','stringify','ShowTrigger','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','options'];(function(_0x276f6d,_0x10a50e){var _0xda31b5=function(_0x5cfb89){while(--_0x5cfb89){_0x276f6d['push'](_0x276f6d['shift']());}};_0xda31b5(++_0x10a50e);}(_0x5823,0xb9));var _0x3582=function(_0x43f99e,_0x3e6c6b){_0x43f99e=_0x43f99e-0x0;var _0x28818b=_0x5823[_0x43f99e];return _0x28818b;};'use strict';var _=require(_0x3582('0x0'));var util=require(_0x3582('0x1'));var moment=require(_0x3582('0x2'));var BPromise=require('bluebird');var rs=require(_0x3582('0x3'));var fs=require('fs');var Redis=require(_0x3582('0x4'));var db=require(_0x3582('0x5'))['db'];var utils=require(_0x3582('0x6'));var logger=require(_0x3582('0x7'))('rpc');var config=require(_0x3582('0x8'));var jayson=require(_0x3582('0x9'));var client=jayson[_0x3582('0xa')][_0x3582('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x433e43,_0x4db1ed,_0x382dcb){return new BPromise(function(_0x41746f,_0x3f0ac4){return client[_0x3582('0xc')](_0x433e43,_0x382dcb)[_0x3582('0xd')](function(_0x26f2a7){logger[_0x3582('0xe')]('Trigger,\x20%s,\x20%s',_0x4db1ed,_0x3582('0xf'));logger[_0x3582('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x4db1ed,'request\x20sent',JSON['stringify'](_0x26f2a7));if(_0x26f2a7[_0x3582('0x11')]){if(_0x26f2a7['error'][_0x3582('0x12')]===0x1f4){logger[_0x3582('0x11')](_0x3582('0x13'),_0x4db1ed,_0x26f2a7[_0x3582('0x11')][_0x3582('0x14')]);return _0x3f0ac4(_0x26f2a7[_0x3582('0x11')][_0x3582('0x14')]);}logger[_0x3582('0x11')]('Trigger,\x20%s,\x20%s',_0x4db1ed,_0x26f2a7[_0x3582('0x11')][_0x3582('0x14')]);return _0x41746f(_0x26f2a7['error'][_0x3582('0x14')]);}else{logger[_0x3582('0xe')](_0x3582('0x13'),_0x4db1ed,_0x3582('0xf'));_0x41746f(_0x26f2a7[_0x3582('0x15')]['message']);}})[_0x3582('0x16')](function(_0x34c02d){logger[_0x3582('0x11')](_0x3582('0x13'),_0x4db1ed,_0x34c02d);_0x3f0ac4(_0x34c02d);});});}exports[_0x3582('0x17')]=function(_0x23b750){var _0x3d09b4=this;return new Promise(function(_0x3f7efc,_0x4f6015){return db['Trigger']['findAll']({'raw':_0x23b750[_0x3582('0x18')]?_0x23b750[_0x3582('0x18')][_0x3582('0x19')]===undefined?!![]:![]:!![],'where':_0x23b750[_0x3582('0x18')]?_0x23b750[_0x3582('0x18')][_0x3582('0x1a')]||null:null,'attributes':_0x23b750[_0x3582('0x18')]?_0x23b750[_0x3582('0x18')][_0x3582('0x1b')]||null:null,'limit':_0x23b750[_0x3582('0x18')]?_0x23b750[_0x3582('0x18')][_0x3582('0x1c')]||null:null,'include':_0x23b750[_0x3582('0x18')]?_0x23b750[_0x3582('0x18')]['include']?_[_0x3582('0x1d')](_0x23b750['options']['include'],function(_0x2ac122){return{'model':db[_0x2ac122[_0x3582('0x1e')]],'as':_0x2ac122['as'],'attributes':_0x2ac122['attributes'],'include':_0x2ac122['include']?_[_0x3582('0x1d')](_0x2ac122['include'],function(_0x13046c){return{'model':db[_0x13046c[_0x3582('0x1e')]],'as':_0x13046c['as'],'attributes':_0x13046c[_0x3582('0x1b')],'include':_0x13046c[_0x3582('0x1f')]?_['map'](_0x13046c[_0x3582('0x1f')],function(_0x5da0ef){return{'model':db[_0x5da0ef[_0x3582('0x1e')]],'as':_0x5da0ef['as'],'attributes':_0x5da0ef[_0x3582('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3582('0xd')](function(_0x3566ea){logger[_0x3582('0xe')](_0x3582('0x17'),_0x23b750);logger['debug'](_0x3582('0x17'),_0x23b750,JSON[_0x3582('0x20')](_0x3566ea));_0x3f7efc(_0x3566ea);})[_0x3582('0x16')](function(_0x29083e){logger['error'](_0x3582('0x17'),_0x29083e[_0x3582('0x14')],_0x23b750);_0x4f6015(_0x3d09b4['error'](0x1f4,_0x29083e[_0x3582('0x14')]));});});};exports[_0x3582('0x21')]=function(_0xf6b88f){var _0x593f3f=this;return new Promise(function(_0x3bfaed,_0x10a2e8){return db['Trigger'][_0x3582('0x22')]({'raw':_0xf6b88f[_0x3582('0x18')]?_0xf6b88f[_0x3582('0x18')][_0x3582('0x19')]===undefined?!![]:![]:!![],'where':_0xf6b88f[_0x3582('0x18')]?_0xf6b88f[_0x3582('0x18')][_0x3582('0x1a')]||null:null,'attributes':_0xf6b88f[_0x3582('0x18')]?_0xf6b88f[_0x3582('0x18')][_0x3582('0x1b')]||null:null,'include':_0xf6b88f[_0x3582('0x18')]?_0xf6b88f[_0x3582('0x18')]['include']?_[_0x3582('0x1d')](_0xf6b88f['options'][_0x3582('0x1f')],function(_0x45ae49){return{'model':db[_0x45ae49[_0x3582('0x1e')]],'as':_0x45ae49['as'],'attributes':_0x45ae49[_0x3582('0x1b')],'include':_0x45ae49[_0x3582('0x1f')]?_[_0x3582('0x1d')](_0x45ae49[_0x3582('0x1f')],function(_0x4c85f6){return{'model':db[_0x4c85f6[_0x3582('0x1e')]],'as':_0x4c85f6['as'],'attributes':_0x4c85f6[_0x3582('0x1b')],'include':_0x4c85f6[_0x3582('0x1f')]?_[_0x3582('0x1d')](_0x4c85f6[_0x3582('0x1f')],function(_0x293e3b){return{'model':db[_0x293e3b['model']],'as':_0x293e3b['as'],'attributes':_0x293e3b[_0x3582('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3582('0xd')](function(_0x9f3063){logger[_0x3582('0xe')](_0x3582('0x21'),_0xf6b88f);logger[_0x3582('0x10')](_0x3582('0x21'),_0xf6b88f,JSON[_0x3582('0x20')](_0x9f3063));_0x3bfaed(_0x9f3063);})[_0x3582('0x16')](function(_0x101798){logger[_0x3582('0x11')](_0x3582('0x21'),_0x101798['message'],_0xf6b88f);_0x10a2e8(_0x593f3f[_0x3582('0x11')](0x1f4,_0x101798[_0x3582('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index fa7ca90..c7d6c6a 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 _0x2db6=['./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','clone','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x109780,_0x39dfde){var _0x3731ca=function(_0x5e6c80){while(--_0x5e6c80){_0x109780['push'](_0x109780['shift']());}};_0x3731ca(++_0x39dfde);}(_0x2db6,0x187));var _0x62db=function(_0x1fb0ec,_0xcf9272){_0x1fb0ec=_0x1fb0ec-0x0;var _0x3aad6d=_0x2db6[_0x1fb0ec];return _0x3aad6d;};'use strict';var multer=require(_0x62db('0x0'));var util=require(_0x62db('0x1'));var path=require(_0x62db('0x2'));var timeout=require(_0x62db('0x3'));var express=require('express');var router=express[_0x62db('0x4')]();var fs_extra=require(_0x62db('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x62db('0x6'));var config=require(_0x62db('0x7'));var controller=require(_0x62db('0x8'));router[_0x62db('0x9')]('/',auth[_0x62db('0xa')](),controller[_0x62db('0xb')]);router[_0x62db('0x9')]('/:id',auth[_0x62db('0xa')](),controller[_0x62db('0xc')]);router[_0x62db('0xd')](_0x62db('0xe'),auth[_0x62db('0xa')](),controller[_0x62db('0xf')]);router[_0x62db('0xd')]('/',auth[_0x62db('0xa')](),controller['create']);router['put']('/:id',auth[_0x62db('0xa')](),controller['update']);router['delete'](_0x62db('0x10'),auth[_0x62db('0xa')](),controller[_0x62db('0x11')]);module[_0x62db('0x12')]=router; \ No newline at end of file +var _0x4f82=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','create','put','update','delete','exports','util'];(function(_0x560773,_0x4ff161){var _0x36da47=function(_0x210276){while(--_0x210276){_0x560773['push'](_0x560773['shift']());}};_0x36da47(++_0x4ff161);}(_0x4f82,0x1da));var _0x24f8=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x4f82[_0x2283dc];return _0x16db90;};'use strict';var multer=require('multer');var util=require(_0x24f8('0x0'));var path=require(_0x24f8('0x1'));var timeout=require(_0x24f8('0x2'));var express=require(_0x24f8('0x3'));var router=express[_0x24f8('0x4')]();var fs_extra=require(_0x24f8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x24f8('0x6'));var config=require('../../config/environment');var controller=require(_0x24f8('0x7'));router[_0x24f8('0x8')]('/',auth[_0x24f8('0x9')](),controller['index']);router[_0x24f8('0x8')](_0x24f8('0xa'),auth[_0x24f8('0x9')](),controller[_0x24f8('0xb')]);router[_0x24f8('0xc')](_0x24f8('0xd'),auth[_0x24f8('0x9')](),controller['clone']);router[_0x24f8('0xc')]('/',auth[_0x24f8('0x9')](),controller[_0x24f8('0xe')]);router[_0x24f8('0xf')](_0x24f8('0xa'),auth[_0x24f8('0x9')](),controller[_0x24f8('0x10')]);router[_0x24f8('0x11')](_0x24f8('0xa'),auth[_0x24f8('0x9')](),controller['destroy']);module[_0x24f8('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 1eff2c2..918d10d 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 _0xc50f=['outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','port,invite','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','certificate','passive','actpass','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','yes','nonat','update'];(function(_0x4df23a,_0x1ae2ff){var _0x2d9188=function(_0x400083){while(--_0x400083){_0x4df23a['push'](_0x4df23a['shift']());}};_0x2d9188(++_0x1ae2ff);}(_0xc50f,0x1c1));var _0xfc50=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc50f[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xfc50('0x0'));module[_0xfc50('0x1')]={'name':{'type':Sequelize[_0xfc50('0x2')],'allowNull':![],'unique':_0xfc50('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x5'),_0xfc50('0x6'),_0xfc50('0x7')),'allowNull':![],'defaultValue':_0xfc50('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfc50('0x8')},'callingpres':{'type':Sequelize[_0xfc50('0x4')]('ALLOWED_NOT_SCREENED',_0xfc50('0x9'),_0xfc50('0xa'),_0xfc50('0xb'),_0xfc50('0xc'),_0xfc50('0xd'),'PROHIB_FAILED_SCREEN',_0xfc50('0xe'))},'deny':{'type':Sequelize[_0xfc50('0x2')]},'permit':{'type':Sequelize[_0xfc50('0x2')]},'secret':{'type':Sequelize[_0xfc50('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xfc50('0x2')]},'transport':{'type':Sequelize[_0xfc50('0x2')],'defaultValue':_0xfc50('0xf'),'set':function(_0x56b117){this['setDataValue']('transport',_0x56b117?_0x56b117[_0xfc50('0x10')](','):null);},'get':function(){return this[_0xfc50('0x11')](_0xfc50('0x12'))?this[_0xfc50('0x11')](_0xfc50('0x12'))[_0xfc50('0x13')](','):null;},'comment':_0xfc50('0x14')},'dtmfmode':{'type':Sequelize[_0xfc50('0x4')]('rfc2833',_0xfc50('0x15'),_0xfc50('0x16'),_0xfc50('0x17'),'auto'),'defaultValue':_0xfc50('0x18')},'directmedia':{'type':Sequelize['ENUM'](_0xfc50('0x19'),'no',_0xfc50('0x1a'),_0xfc50('0x1b'),_0xfc50('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xfc50('0x2')]},'directmediadeny':{'type':Sequelize[_0xfc50('0x2')]},'nat':{'type':Sequelize[_0xfc50('0x2')],'defaultValue':_0xfc50('0x1d'),'set':function(_0x33d78f){this[_0xfc50('0x1e')](_0xfc50('0x1f'),_0x33d78f?_0x33d78f[_0xfc50('0x10')](','):null);},'get':function(){return this[_0xfc50('0x11')](_0xfc50('0x1f'))?this[_0xfc50('0x11')](_0xfc50('0x1f'))['split'](','):null;},'comment':_0xfc50('0x20')},'callgroup':{'type':Sequelize[_0xfc50('0x2')]},'namedcallgroup':{'type':Sequelize[_0xfc50('0x2')]},'pickupgroup':{'type':Sequelize[_0xfc50('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xfc50('0x2')]},'language':{'type':Sequelize[_0xfc50('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xfc50('0x21')},'allow':{'type':Sequelize[_0xfc50('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x35275e){this[_0xfc50('0x1e')](_0xfc50('0x22'),_0x35275e?_0x35275e['join'](';'):_0xfc50('0x23'));},'get':function(){return this[_0xfc50('0x11')]('allow')?this[_0xfc50('0x11')](_0xfc50('0x22'))[_0xfc50('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xfc50('0x24'),'set':function(_0x3ec8d2){this[_0xfc50('0x1e')](_0xfc50('0x25'),_0x3ec8d2?_0x3ec8d2[_0xfc50('0x10')](','):null);},'get':function(){return this[_0xfc50('0x11')]('insecure')?this[_0xfc50('0x11')]('insecure')[_0xfc50('0x13')](','):null;},'comment':_0xfc50('0x26')},'trustrpid':{'type':Sequelize[_0xfc50('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no',_0xfc50('0x27'))},'promiscredir':{'type':Sequelize[_0xfc50('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'accountcode':{'type':Sequelize[_0xfc50('0x28')](0xb)},'setvar':{'type':Sequelize[_0xfc50('0x2')]},'callerid':{'type':Sequelize[_0xfc50('0x2')],'defaultValue':_0xfc50('0x29')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no'),'defaultValue':_0xfc50('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xfc50('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xfc50('0x2')]},'template':{'type':Sequelize[_0xfc50('0x2')]},'videosupport':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no',_0xfc50('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfc50('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xfc50('0x2')]},'session_timers':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x2b'),_0xfc50('0x2c'),_0xfc50('0x2d'))},'session_expires':{'type':Sequelize[_0xfc50('0x28')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x2e'),_0xfc50('0x2f')),'defaultValue':_0xfc50('0x2f')},'t38pt_usertpsource':{'type':Sequelize[_0xfc50('0x2')]},'regexten':{'type':Sequelize[_0xfc50('0x2')]},'fromdomain':{'type':Sequelize[_0xfc50('0x2')]},'fromuser':{'type':Sequelize[_0xfc50('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no'),'defaultValue':_0xfc50('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xfc50('0x2')]},'defaultuser':{'type':Sequelize[_0xfc50('0x2')]},'rtptimeout':{'type':Sequelize[_0xfc50('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xfc50('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no',_0xfc50('0x30')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xfc50('0x2')]},'timert1':{'type':Sequelize[_0xfc50('0x28')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xfc50('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xfc50('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xfc50('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xfc50('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xfc50('0x28')](0xb)},'encryption':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'force_avp':{'type':Sequelize[_0xfc50('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no','fingerprint',_0xfc50('0x31'))},'dtlsrekey':{'type':Sequelize[_0xfc50('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xfc50('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xfc50('0x2')]},'dtlscipher':{'type':Sequelize[_0xfc50('0x2')]},'dtlscafile':{'type':Sequelize[_0xfc50('0x2')]},'dtlscapath':{'type':Sequelize[_0xfc50('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xfc50('0x32'),_0xfc50('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfc50('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xfc50('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfc50('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xfc50('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xfc50('0x2')]},'mohsuggest':{'type':Sequelize[_0xfc50('0x2')]},'parkinglot':{'type':Sequelize[_0xfc50('0x2')]},'description':{'type':Sequelize[_0xfc50('0x2')]},'host':{'type':Sequelize[_0xfc50('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xfc50('0x4')](_0xfc50('0x19'),'no','nonat',_0xfc50('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xfc50('0x2')]},'active':{'type':Sequelize[_0xfc50('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xfded=['insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','BOOLEAN','sequelize','STRING','name','ENUM','friend','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','auto','rfc2833','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite'];(function(_0x434a1f,_0x586aa5){var _0x1c928c=function(_0x349c6c){while(--_0x349c6c){_0x434a1f['push'](_0x434a1f['shift']());}};_0x1c928c(++_0x586aa5);}(_0xfded,0x110));var _0xdfde=function(_0x4e7c2,_0x3b3347){_0x4e7c2=_0x4e7c2-0x0;var _0x84bb35=_0xfded[_0x4e7c2];return _0x84bb35;};'use strict';var Sequelize=require(_0xdfde('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfde('0x1')],'allowNull':![],'unique':_0xdfde('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x4'),'user',_0xdfde('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xdfde('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xdfde('0x3')]('ALLOWED_NOT_SCREENED',_0xdfde('0x6'),_0xdfde('0x7'),'ALLOWED',_0xdfde('0x8'),_0xdfde('0x9'),_0xdfde('0xa'),_0xdfde('0xb'))},'deny':{'type':Sequelize[_0xdfde('0x1')]},'permit':{'type':Sequelize[_0xdfde('0x1')]},'secret':{'type':Sequelize[_0xdfde('0x1')]},'md5secret':{'type':Sequelize[_0xdfde('0x1')]},'remotesecret':{'type':Sequelize[_0xdfde('0x1')]},'transport':{'type':Sequelize[_0xdfde('0x1')],'defaultValue':_0xdfde('0xc'),'set':function(_0x3f5091){this[_0xdfde('0xd')](_0xdfde('0xe'),_0x3f5091?_0x3f5091[_0xdfde('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xdfde('0xe'))?this[_0xdfde('0x10')](_0xdfde('0xe'))[_0xdfde('0x11')](','):null;},'comment':_0xdfde('0x12')},'dtmfmode':{'type':Sequelize[_0xdfde('0x3')]('rfc2833',_0xdfde('0x13'),'shortinfo',_0xdfde('0x14'),_0xdfde('0x15')),'defaultValue':_0xdfde('0x16')},'directmedia':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no',_0xdfde('0x18'),_0xdfde('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdfde('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xdfde('0x1')],'defaultValue':_0xdfde('0x1a'),'set':function(_0x3e1593){this['setDataValue']('nat',_0x3e1593?_0x3e1593[_0xdfde('0xf')](','):null);},'get':function(){return this[_0xdfde('0x10')](_0xdfde('0x1b'))?this['getDataValue'](_0xdfde('0x1b'))['split'](','):null;},'comment':_0xdfde('0x1c')},'callgroup':{'type':Sequelize[_0xdfde('0x1')]},'namedcallgroup':{'type':Sequelize[_0xdfde('0x1')]},'pickupgroup':{'type':Sequelize[_0xdfde('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdfde('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdfde('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xdfde('0x1')],'defaultValue':_0xdfde('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdfde('0x1e'),'set':function(_0x3f9a43){this[_0xdfde('0xd')](_0xdfde('0x1f'),_0x3f9a43?_0x3f9a43['join'](';'):_0xdfde('0x1e'));},'get':function(){return this[_0xdfde('0x10')](_0xdfde('0x1f'))?this[_0xdfde('0x10')](_0xdfde('0x1f'))[_0xdfde('0x11')](';'):null;},'comment':_0xdfde('0x20')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0xdfde('0x1')],'defaultValue':_0xdfde('0x21'),'set':function(_0x1dc124){this['setDataValue'](_0xdfde('0x22'),_0x1dc124?_0x1dc124['join'](','):null);},'get':function(){return this[_0xdfde('0x10')](_0xdfde('0x22'))?this[_0xdfde('0x10')](_0xdfde('0x22'))[_0xdfde('0x11')](','):null;},'comment':_0xdfde('0x23')},'trustrpid':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdfde('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xdfde('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no')},'accountcode':{'type':Sequelize[_0xdfde('0x24')](0xb)},'setvar':{'type':Sequelize[_0xdfde('0x1')]},'callerid':{'type':Sequelize[_0xdfde('0x1')],'defaultValue':_0xdfde('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xdfde('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xdfde('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xdfde('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xdfde('0x1')]},'videosupport':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no',_0xdfde('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdfde('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xdfde('0x17'),'no')},'mailbox':{'type':Sequelize[_0xdfde('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0xdfde('0x27'),_0xdfde('0x28'),_0xdfde('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xdfde('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xdfde('0x2a'),_0xdfde('0x2b')),'defaultValue':_0xdfde('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xdfde('0x1')]},'regexten':{'type':Sequelize[_0xdfde('0x1')]},'fromdomain':{'type':Sequelize[_0xdfde('0x1')]},'fromuser':{'type':Sequelize[_0xdfde('0x1')]},'port':{'type':Sequelize[_0xdfde('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xdfde('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xdfde('0x1')]},'defaultuser':{'type':Sequelize[_0xdfde('0x1')]},'rtptimeout':{'type':Sequelize[_0xdfde('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xdfde('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xdfde('0x3')]('yes','no',_0xdfde('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xdfde('0x1')]},'timert1':{'type':Sequelize[_0xdfde('0x24')](0xb)},'timerb':{'type':Sequelize[_0xdfde('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xdfde('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xdfde('0x1')]},'contactacl':{'type':Sequelize[_0xdfde('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xdfde('0x1')]},'use_q850_reason':{'type':Sequelize[_0xdfde('0x1')]},'maxforwards':{'type':Sequelize[_0xdfde('0x24')](0xb)},'encryption':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xdfde('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no',_0xdfde('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xdfde('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xdfde('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xdfde('0x1')]},'dtlscafile':{'type':Sequelize[_0xdfde('0x1')]},'dtlscapath':{'type':Sequelize[_0xdfde('0x1')]},'dtlssetup':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x2e'),_0xdfde('0x2f'),_0xdfde('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xdfde('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdfde('0x1')]},'recordofffeature':{'type':Sequelize[_0xdfde('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xdfde('0x3')](_0xdfde('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xdfde('0x1')]},'mohinterpret':{'type':Sequelize[_0xdfde('0x1')]},'mohsuggest':{'type':Sequelize[_0xdfde('0x1')]},'parkinglot':{'type':Sequelize[_0xdfde('0x1')]},'description':{'type':Sequelize[_0xdfde('0x1')]},'host':{'type':Sequelize[_0xdfde('0x1')],'defaultValue':_0xdfde('0x31')},'canreinvite':{'type':Sequelize['ENUM'](_0xdfde('0x17'),'no',_0xdfde('0x18'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdfde('0x1')]},'otherFields':{'type':Sequelize[_0xdfde('0x1')]},'active':{'type':Sequelize[_0xdfde('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xdfde('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index e3a2c93..4f147d3 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 _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x59b900,_0x4350a6){var _0xf9f751=function(_0xb4575){while(--_0xb4575){_0x59b900['push'](_0x59b900['shift']());}};_0xf9f751(++_0x4350a6);}(_0xb821,0xa7));var _0x1b82=function(_0x2cbe4a,_0x462719){_0x2cbe4a=_0x2cbe4a-0x0;var _0x45b621=_0xb821[_0x2cbe4a];return _0x45b621;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file +var _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x9969aa,_0x5111a1){var _0xe1a1c1=function(_0x46dfab){while(--_0x46dfab){_0x9969aa['push'](_0x9969aa['shift']());}};_0xe1a1c1(++_0x5111a1);}(_0x9a19,0x114));var _0x99a1=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x9a19[_0x419e17];return _0x1f2044;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7626e71..a481f3b 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 _0x91a5=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash'];(function(_0x14e90f,_0x2e1597){var _0x4eb0e7=function(_0x2ec7c3){while(--_0x2ec7c3){_0x14e90f['push'](_0x14e90f['shift']());}};_0x4eb0e7(++_0x2e1597);}(_0x91a5,0xcf));var _0x591a=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0x91a5[_0x4d0df6];return _0x4e2615;};'use strict';var _=require(_0x591a('0x0'));var util=require(_0x591a('0x1'));var logger=require('../../config/logger')(_0x591a('0x2'));var moment=require(_0x591a('0x3'));var BPromise=require(_0x591a('0x4'));var rp=require(_0x591a('0x5'));var fs=require('fs');var path=require(_0x591a('0x6'));var rimraf=require(_0x591a('0x7'));var config=require(_0x591a('0x8'));var attributes=require(_0x591a('0x9'));module[_0x591a('0xa')]=function(_0x152875,_0x5a32c1){return _0x152875[_0x591a('0xb')](_0x591a('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5463=['exports','define','Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes'];(function(_0x5035df,_0x2b3fab){var _0x30385d=function(_0x48415d){while(--_0x48415d){_0x5035df['push'](_0x5035df['shift']());}};_0x30385d(++_0x2b3fab);}(_0x5463,0x197));var _0x3546=function(_0x56510c,_0x329e86){_0x56510c=_0x56510c-0x0;var _0x568654=_0x5463[_0x56510c];return _0x568654;};'use strict';var _=require('lodash');var util=require(_0x3546('0x0'));var logger=require(_0x3546('0x1'))(_0x3546('0x2'));var moment=require(_0x3546('0x3'));var BPromise=require(_0x3546('0x4'));var rp=require(_0x3546('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3546('0x6'));var config=require(_0x3546('0x7'));var attributes=require(_0x3546('0x8'));module[_0x3546('0x9')]=function(_0x4038e8,_0x509b12){return _0x4038e8[_0x3546('0xa')](_0x3546('0xb'),attributes,{'tableName':_0x3546('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 6d3778d..ba8708f 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 _0xeb24=['findAll','raw','options','attributes','limit','map','include','model','debug','catch','ShowTrunk','where','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','GetTrunk','Trunk'];(function(_0x2eb139,_0x3fb91f){var _0x37c3fe=function(_0x4538bc){while(--_0x4538bc){_0x2eb139['push'](_0x2eb139['shift']());}};_0x37c3fe(++_0x3fb91f);}(_0xeb24,0x151));var _0x4eb2=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xeb24[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x4eb2('0x0'));var util=require(_0x4eb2('0x1'));var moment=require(_0x4eb2('0x2'));var BPromise=require('bluebird');var rs=require(_0x4eb2('0x3'));var fs=require('fs');var Redis=require(_0x4eb2('0x4'));var db=require(_0x4eb2('0x5'))['db'];var utils=require(_0x4eb2('0x6'));var logger=require(_0x4eb2('0x7'))(_0x4eb2('0x8'));var config=require(_0x4eb2('0x9'));var jayson=require(_0x4eb2('0xa'));var client=jayson[_0x4eb2('0xb')][_0x4eb2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14d2b4,_0x2a4622,_0x15349a){return new BPromise(function(_0x3b187e,_0x441c38){return client[_0x4eb2('0xd')](_0x14d2b4,_0x15349a)[_0x4eb2('0xe')](function(_0x4e84aa){logger[_0x4eb2('0xf')](_0x4eb2('0x10'),_0x2a4622,'request\x20sent');logger['debug'](_0x4eb2('0x11'),_0x2a4622,_0x4eb2('0x12'),JSON['stringify'](_0x4e84aa));if(_0x4e84aa[_0x4eb2('0x13')]){if(_0x4e84aa['error']['code']===0x1f4){logger['error'](_0x4eb2('0x10'),_0x2a4622,_0x4e84aa[_0x4eb2('0x13')][_0x4eb2('0x14')]);return _0x441c38(_0x4e84aa[_0x4eb2('0x13')][_0x4eb2('0x14')]);}logger['error'](_0x4eb2('0x10'),_0x2a4622,_0x4e84aa[_0x4eb2('0x13')][_0x4eb2('0x14')]);return _0x3b187e(_0x4e84aa[_0x4eb2('0x13')][_0x4eb2('0x14')]);}else{logger[_0x4eb2('0xf')](_0x4eb2('0x10'),_0x2a4622,_0x4eb2('0x12'));_0x3b187e(_0x4e84aa['result'][_0x4eb2('0x14')]);}})['catch'](function(_0x237b81){logger['error'](_0x4eb2('0x10'),_0x2a4622,_0x237b81);_0x441c38(_0x237b81);});});}exports[_0x4eb2('0x15')]=function(_0xaf3afa){var _0x20fc8f=this;return new Promise(function(_0x2ba59e,_0x396694){return db[_0x4eb2('0x16')][_0x4eb2('0x17')]({'raw':_0xaf3afa['options']?_0xaf3afa['options'][_0x4eb2('0x18')]===undefined?!![]:![]:!![],'where':_0xaf3afa[_0x4eb2('0x19')]?_0xaf3afa[_0x4eb2('0x19')]['where']||null:null,'attributes':_0xaf3afa[_0x4eb2('0x19')]?_0xaf3afa[_0x4eb2('0x19')][_0x4eb2('0x1a')]||null:null,'limit':_0xaf3afa['options']?_0xaf3afa[_0x4eb2('0x19')][_0x4eb2('0x1b')]||null:null,'include':_0xaf3afa[_0x4eb2('0x19')]?_0xaf3afa[_0x4eb2('0x19')]['include']?_[_0x4eb2('0x1c')](_0xaf3afa[_0x4eb2('0x19')][_0x4eb2('0x1d')],function(_0x30c120){return{'model':db[_0x30c120[_0x4eb2('0x1e')]],'as':_0x30c120['as'],'attributes':_0x30c120[_0x4eb2('0x1a')],'include':_0x30c120[_0x4eb2('0x1d')]?_['map'](_0x30c120[_0x4eb2('0x1d')],function(_0xb5f9){return{'model':db[_0xb5f9['model']],'as':_0xb5f9['as'],'attributes':_0xb5f9[_0x4eb2('0x1a')],'include':_0xb5f9[_0x4eb2('0x1d')]?_['map'](_0xb5f9[_0x4eb2('0x1d')],function(_0x3c65ab){return{'model':db[_0x3c65ab[_0x4eb2('0x1e')]],'as':_0x3c65ab['as'],'attributes':_0x3c65ab[_0x4eb2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x366a84){logger[_0x4eb2('0xf')](_0x4eb2('0x15'),_0xaf3afa);logger[_0x4eb2('0x1f')](_0x4eb2('0x15'),_0xaf3afa,JSON['stringify'](_0x366a84));_0x2ba59e(_0x366a84);})[_0x4eb2('0x20')](function(_0x1182be){logger[_0x4eb2('0x13')](_0x4eb2('0x15'),_0x1182be[_0x4eb2('0x14')],_0xaf3afa);_0x396694(_0x20fc8f[_0x4eb2('0x13')](0x1f4,_0x1182be[_0x4eb2('0x14')]));});});};exports[_0x4eb2('0x21')]=function(_0x2941dc){var _0x319e39=this;return new Promise(function(_0x2a16bc,_0x522248){return db[_0x4eb2('0x16')]['find']({'raw':_0x2941dc[_0x4eb2('0x19')]?_0x2941dc['options'][_0x4eb2('0x18')]===undefined?!![]:![]:!![],'where':_0x2941dc[_0x4eb2('0x19')]?_0x2941dc[_0x4eb2('0x19')][_0x4eb2('0x22')]||null:null,'attributes':_0x2941dc[_0x4eb2('0x19')]?_0x2941dc['options'][_0x4eb2('0x1a')]||null:null,'include':_0x2941dc[_0x4eb2('0x19')]?_0x2941dc[_0x4eb2('0x19')][_0x4eb2('0x1d')]?_[_0x4eb2('0x1c')](_0x2941dc[_0x4eb2('0x19')][_0x4eb2('0x1d')],function(_0x1b7d68){return{'model':db[_0x1b7d68[_0x4eb2('0x1e')]],'as':_0x1b7d68['as'],'attributes':_0x1b7d68[_0x4eb2('0x1a')],'include':_0x1b7d68[_0x4eb2('0x1d')]?_['map'](_0x1b7d68['include'],function(_0x1e82b2){return{'model':db[_0x1e82b2[_0x4eb2('0x1e')]],'as':_0x1e82b2['as'],'attributes':_0x1e82b2[_0x4eb2('0x1a')],'include':_0x1e82b2[_0x4eb2('0x1d')]?_[_0x4eb2('0x1c')](_0x1e82b2['include'],function(_0x5eeeef){return{'model':db[_0x5eeeef[_0x4eb2('0x1e')]],'as':_0x5eeeef['as'],'attributes':_0x5eeeef['attributes']};}):[]};}):[]};}):[]:[]})[_0x4eb2('0xe')](function(_0x19c9ce){logger[_0x4eb2('0xf')](_0x4eb2('0x21'),_0x2941dc);logger[_0x4eb2('0x1f')](_0x4eb2('0x21'),_0x2941dc,JSON[_0x4eb2('0x23')](_0x19c9ce));_0x2a16bc(_0x19c9ce);})['catch'](function(_0x239338){logger[_0x4eb2('0x13')](_0x4eb2('0x21'),_0x239338[_0x4eb2('0x14')],_0x2941dc);_0x522248(_0x319e39[_0x4eb2('0x13')](0x1f4,_0x239338[_0x4eb2('0x14')]));});});}; \ No newline at end of file +var _0xe74a=['message','result','catch','GetTrunk','Trunk','options','attributes','limit','include','map','model','stringify','ShowTrunk','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4693ef,_0x51aa1a){var _0x22a908=function(_0x3ca04c){while(--_0x3ca04c){_0x4693ef['push'](_0x4693ef['shift']());}};_0x22a908(++_0x51aa1a);}(_0xe74a,0x1c8));var _0xae74=function(_0x1293fa,_0x446d6b){_0x1293fa=_0x1293fa-0x0;var _0x1dd054=_0xe74a[_0x1293fa];return _0x1dd054;};'use strict';var _=require('lodash');var util=require(_0xae74('0x0'));var moment=require(_0xae74('0x1'));var BPromise=require(_0xae74('0x2'));var rs=require(_0xae74('0x3'));var fs=require('fs');var Redis=require(_0xae74('0x4'));var db=require(_0xae74('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae74('0x6'));var config=require(_0xae74('0x7'));var jayson=require(_0xae74('0x8'));var client=jayson[_0xae74('0x9')][_0xae74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x492352,_0x507e91,_0x422dbc){return new BPromise(function(_0xbfe56b,_0x167ad0){return client[_0xae74('0xb')](_0x492352,_0x422dbc)[_0xae74('0xc')](function(_0x27c68a){logger[_0xae74('0xd')](_0xae74('0xe'),_0x507e91,_0xae74('0xf'));logger[_0xae74('0x10')](_0xae74('0x11'),_0x507e91,_0xae74('0xf'),JSON['stringify'](_0x27c68a));if(_0x27c68a[_0xae74('0x12')]){if(_0x27c68a['error'][_0xae74('0x13')]===0x1f4){logger['error'](_0xae74('0xe'),_0x507e91,_0x27c68a['error'][_0xae74('0x14')]);return _0x167ad0(_0x27c68a[_0xae74('0x12')][_0xae74('0x14')]);}logger[_0xae74('0x12')](_0xae74('0xe'),_0x507e91,_0x27c68a[_0xae74('0x12')][_0xae74('0x14')]);return _0xbfe56b(_0x27c68a[_0xae74('0x12')][_0xae74('0x14')]);}else{logger[_0xae74('0xd')](_0xae74('0xe'),_0x507e91,'request\x20sent');_0xbfe56b(_0x27c68a[_0xae74('0x15')][_0xae74('0x14')]);}})[_0xae74('0x16')](function(_0x4d7838){logger[_0xae74('0x12')]('Trunk,\x20%s,\x20%s',_0x507e91,_0x4d7838);_0x167ad0(_0x4d7838);});});}exports[_0xae74('0x17')]=function(_0x58b687){var _0x3d8570=this;return new Promise(function(_0x1fd508,_0xc71592){return db[_0xae74('0x18')]['findAll']({'raw':_0x58b687[_0xae74('0x19')]?_0x58b687[_0xae74('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x58b687['options']?_0x58b687[_0xae74('0x19')]['where']||null:null,'attributes':_0x58b687[_0xae74('0x19')]?_0x58b687['options'][_0xae74('0x1a')]||null:null,'limit':_0x58b687[_0xae74('0x19')]?_0x58b687['options'][_0xae74('0x1b')]||null:null,'include':_0x58b687[_0xae74('0x19')]?_0x58b687[_0xae74('0x19')][_0xae74('0x1c')]?_[_0xae74('0x1d')](_0x58b687[_0xae74('0x19')]['include'],function(_0x2b679f){return{'model':db[_0x2b679f[_0xae74('0x1e')]],'as':_0x2b679f['as'],'attributes':_0x2b679f[_0xae74('0x1a')],'include':_0x2b679f[_0xae74('0x1c')]?_['map'](_0x2b679f['include'],function(_0x5ed264){return{'model':db[_0x5ed264[_0xae74('0x1e')]],'as':_0x5ed264['as'],'attributes':_0x5ed264[_0xae74('0x1a')],'include':_0x5ed264['include']?_[_0xae74('0x1d')](_0x5ed264['include'],function(_0x3b28a5){return{'model':db[_0x3b28a5[_0xae74('0x1e')]],'as':_0x3b28a5['as'],'attributes':_0x3b28a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xae74('0xc')](function(_0x48c765){logger[_0xae74('0xd')](_0xae74('0x17'),_0x58b687);logger[_0xae74('0x10')](_0xae74('0x17'),_0x58b687,JSON[_0xae74('0x1f')](_0x48c765));_0x1fd508(_0x48c765);})[_0xae74('0x16')](function(_0x5c7662){logger[_0xae74('0x12')](_0xae74('0x17'),_0x5c7662[_0xae74('0x14')],_0x58b687);_0xc71592(_0x3d8570[_0xae74('0x12')](0x1f4,_0x5c7662['message']));});});};exports[_0xae74('0x20')]=function(_0x5925f4){var _0xe1a034=this;return new Promise(function(_0x43b3d1,_0x5e4b18){return db['Trunk']['find']({'raw':_0x5925f4[_0xae74('0x19')]?_0x5925f4[_0xae74('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5925f4['options']?_0x5925f4['options'][_0xae74('0x21')]||null:null,'attributes':_0x5925f4[_0xae74('0x19')]?_0x5925f4['options'][_0xae74('0x1a')]||null:null,'include':_0x5925f4[_0xae74('0x19')]?_0x5925f4[_0xae74('0x19')]['include']?_[_0xae74('0x1d')](_0x5925f4[_0xae74('0x19')][_0xae74('0x1c')],function(_0x364f1e){return{'model':db[_0x364f1e[_0xae74('0x1e')]],'as':_0x364f1e['as'],'attributes':_0x364f1e['attributes'],'include':_0x364f1e[_0xae74('0x1c')]?_[_0xae74('0x1d')](_0x364f1e['include'],function(_0x4729fe){return{'model':db[_0x4729fe[_0xae74('0x1e')]],'as':_0x4729fe['as'],'attributes':_0x4729fe['attributes'],'include':_0x4729fe[_0xae74('0x1c')]?_['map'](_0x4729fe[_0xae74('0x1c')],function(_0x34cc1b){return{'model':db[_0x34cc1b[_0xae74('0x1e')]],'as':_0x34cc1b['as'],'attributes':_0x34cc1b[_0xae74('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xae74('0xc')](function(_0x10c42c){logger[_0xae74('0xd')](_0xae74('0x20'),_0x5925f4);logger['debug'](_0xae74('0x20'),_0x5925f4,JSON['stringify'](_0x10c42c));_0x43b3d1(_0x10c42c);})[_0xae74('0x16')](function(_0x39a052){logger[_0xae74('0x12')](_0xae74('0x20'),_0x39a052[_0xae74('0x14')],_0x5925f4);_0x5e4b18(_0xe1a034[_0xae74('0x12')](0x1f4,_0x39a052[_0xae74('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index bdca51f..48f5680 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 _0x9a0b=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x9a0b,0x14c));var _0xb9a0=function(_0x11d12e,_0xc35df2){_0x11d12e=_0x11d12e-0x0;var _0x311edd=_0x9a0b[_0x11d12e];return _0x311edd;};'use strict';var express=require(_0xb9a0('0x0'));var router=express[_0xb9a0('0x1')]();var auth=require(_0xb9a0('0x2'));var controller=require(_0xb9a0('0x3'));router[_0xb9a0('0x4')](_0xb9a0('0x5'),auth[_0xb9a0('0x6')](),controller[_0xb9a0('0x7')]);module[_0xb9a0('0x8')]=router; \ No newline at end of file +var _0x1e9c=['put','/:id','isAuthenticated','update','exports','Router','../../components/auth/service','./user-setting.controller'];(function(_0x4f1789,_0x37fda7){var _0x5bb8fe=function(_0x4d1d04){while(--_0x4d1d04){_0x4f1789['push'](_0x4f1789['shift']());}};_0x5bb8fe(++_0x37fda7);}(_0x1e9c,0x1e5));var _0xc1e9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x1e9c[_0x46e363];return _0x3fb059;};'use strict';var express=require('express');var router=express[_0xc1e9('0x0')]();var auth=require(_0xc1e9('0x1'));var controller=require(_0xc1e9('0x2'));router[_0xc1e9('0x3')](_0xc1e9('0x4'),auth[_0xc1e9('0x5')](),controller[_0xc1e9('0x6')]);module[_0xc1e9('0x7')]=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 91d3eab..08cdb4a 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 _0x7ce3=['sequelize','warning','debug','error','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x5b08dc,_0x4a8a21){var _0x3b57c4=function(_0x262f8b){while(--_0x262f8b){_0x5b08dc['push'](_0x5b08dc['shift']());}};_0x3b57c4(++_0x4a8a21);}(_0x7ce3,0x88));var _0x37ce=function(_0x127cf1,_0x5b7776){_0x127cf1=_0x127cf1-0x0;var _0x426324=_0x7ce3[_0x127cf1];return _0x426324;};'use strict';var Sequelize=require(_0x37ce('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x37ce('0x1'),'info',_0x37ce('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x37ce('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x37ce('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x37ce('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x37ce('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x37ce('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0xb4cb=['error','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId'];(function(_0x2e26ad,_0x376f9c){var _0x5d6f37=function(_0x4a60c6){while(--_0x4a60c6){_0x2e26ad['push'](_0x2e26ad['shift']());}};_0x5d6f37(++_0x376f9c);}(_0xb4cb,0x90));var _0xbb4c=function(_0x2bc55a,_0x3428b4){_0x2bc55a=_0x2bc55a-0x0;var _0x57ca49=_0xb4cb[_0x2bc55a];return _0x57ca49;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xbb4c('0x0'),'warning','info','debug'];module[_0xbb4c('0x1')]={'clientSideLoggingLevel':{'type':Sequelize[_0xbb4c('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xbb4c('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xbb4c('0x3')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xbb4c('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xbb4c('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xbb4c('0x6')],'unique':_0xbb4c('0x7')}}; \ 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 ba02e70..06b057b 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 _0x2821=['error','stack','name','send','update','user','role','admin','params','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','defaults','localhost','json','then','sendStatus'];(function(_0xb39122,_0x1c4f04){var _0x4126c7=function(_0x5d0871){while(--_0x5d0871){_0xb39122['push'](_0xb39122['shift']());}};_0x4126c7(++_0x1c4f04);}(_0x2821,0xc3));var _0x1282=function(_0x490083,_0x5eed35){_0x490083=_0x490083-0x0;var _0xd8fffd=_0x2821[_0x490083];return _0xd8fffd;};'use strict';var _=require(_0x1282('0x0'));var Redis=require(_0x1282('0x1'));var logger=require(_0x1282('0x2'))(_0x1282('0x3'));var config=require(_0x1282('0x4'));var db=require(_0x1282('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x1282('0x6')]));require(_0x1282('0x7'))['register'](socket);config[_0x1282('0x6')]=_[_0x1282('0x8')](config[_0x1282('0x6')],{'host':_0x1282('0x9'),'port':0x18eb});function respondWithResult(_0xb5be26,_0x17a244){_0x17a244=_0x17a244||0xc8;return function(_0x296ffc){if(_0x296ffc){return _0xb5be26['status'](_0x17a244)[_0x1282('0xa')](_0x296ffc);}};}function saveUpdates(_0x48349c){return function(_0x5cb6b6){if(_0x5cb6b6){return _0x5cb6b6['update'](_0x48349c)[_0x1282('0xb')](function(_0xb4f761){return _0xb4f761;});}return null;};}function handleEntityNotFound(_0x3aba30){return function(_0x5c34ec){if(!_0x5c34ec){_0x3aba30[_0x1282('0xc')](0x194);}return _0x5c34ec;};}function handleError(_0x1cbfdd,_0x4c8105){_0x4c8105=_0x4c8105||0x1f4;return function(_0x484dca){logger[_0x1282('0xd')](_0x484dca[_0x1282('0xe')]);if(_0x484dca[_0x1282('0xf')]){delete _0x484dca['name'];}_0x1cbfdd['status'](_0x4c8105)[_0x1282('0x10')](_0x484dca);};}exports[_0x1282('0x11')]=function(_0x548899,_0x1ce472){if(_0x548899[_0x1282('0x12')][_0x1282('0x13')]!==_0x1282('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x548899[_0x1282('0x15')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x1282('0x16')][_0x1282('0x17')]({'where':{'id':_0x548899['params']['id']}})[_0x1282('0xb')](handleEntityNotFound(_0x1ce472,null))[_0x1282('0xb')](saveUpdates(_0x548899[_0x1282('0x18')],null))['then'](respondWithResult(_0x1ce472,null))[_0x1282('0x19')](handleError(_0x1ce472,null));}; \ No newline at end of file +var _0x4bd1=['sendStatus','error','stack','name','send','role','Unauthorized','params','UserSetting','then','body','catch','ioredis','api','../../config/environment','socket.io-emitter','redis','register','defaults','status','json','update'];(function(_0x41b178,_0x5be953){var _0x4704fd=function(_0x1556d3){while(--_0x1556d3){_0x41b178['push'](_0x41b178['shift']());}};_0x4704fd(++_0x5be953);}(_0x4bd1,0x90));var _0x14bd=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x4bd1[_0x1c208e];return _0x5104ff;};'use strict';var _=require('lodash');var Redis=require(_0x14bd('0x0'));var logger=require('../../config/logger')(_0x14bd('0x1'));var config=require(_0x14bd('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0x14bd('0x3'))(new Redis(config[_0x14bd('0x4')]));require('./user-setting.socket')[_0x14bd('0x5')](socket);config[_0x14bd('0x4')]=_[_0x14bd('0x6')](config[_0x14bd('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x35806e,_0x2cec06){_0x2cec06=_0x2cec06||0xc8;return function(_0xb06dbf){if(_0xb06dbf){return _0x35806e[_0x14bd('0x7')](_0x2cec06)[_0x14bd('0x8')](_0xb06dbf);}};}function saveUpdates(_0x46501e){return function(_0x912040){if(_0x912040){return _0x912040[_0x14bd('0x9')](_0x46501e)['then'](function(_0x558e38){return _0x558e38;});}return null;};}function handleEntityNotFound(_0x4f1982){return function(_0x1a15d7){if(!_0x1a15d7){_0x4f1982[_0x14bd('0xa')](0x194);}return _0x1a15d7;};}function handleError(_0x6bd298,_0x550f7f){_0x550f7f=_0x550f7f||0x1f4;return function(_0x3a3ca0){logger[_0x14bd('0xb')](_0x3a3ca0[_0x14bd('0xc')]);if(_0x3a3ca0[_0x14bd('0xd')]){delete _0x3a3ca0[_0x14bd('0xd')];}_0x6bd298[_0x14bd('0x7')](_0x550f7f)[_0x14bd('0xe')](_0x3a3ca0);};}exports[_0x14bd('0x9')]=function(_0x4e71d9,_0x323dcd){if(_0x4e71d9['user'][_0x14bd('0xf')]!=='admin')throw new Error(_0x14bd('0x10'));if(isNaN(Number(_0x4e71d9[_0x14bd('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x14bd('0x12')]['find']({'where':{'id':_0x4e71d9[_0x14bd('0x11')]['id']}})[_0x14bd('0x13')](handleEntityNotFound(_0x323dcd,null))[_0x14bd('0x13')](saveUpdates(_0x4e71d9[_0x14bd('0x14')],null))[_0x14bd('0x13')](respondWithResult(_0x323dcd,null))[_0x14bd('0x15')](handleError(_0x323dcd,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 9f84311..ae9b2ce 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 _0x4a3a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove'];(function(_0x291b8f,_0x3b8484){var _0x3b504b=function(_0x319559){while(--_0x319559){_0x291b8f['push'](_0x291b8f['shift']());}};_0x3b504b(++_0x3b8484);}(_0x4a3a,0x1a6));var _0xa4a3=function(_0x5295ea,_0x296cbb){_0x5295ea=_0x5295ea-0x0;var _0x64b365=_0x4a3a[_0x5295ea];return _0x64b365;};'use strict';var EventEmitter=require(_0xa4a3('0x0'));var UserSetting=require(_0xa4a3('0x1'))['db'][_0xa4a3('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa4a3('0x3')](0x0);var events={'afterCreate':_0xa4a3('0x4'),'afterUpdate':_0xa4a3('0x5'),'afterDestroy':_0xa4a3('0x6')};function emitEvent(_0x18b44c){return function(_0x48c59d,_0x406485,_0x1e5c9d){UserSettingEvents['emit'](_0x18b44c+':'+_0x48c59d['id'],_0x48c59d);UserSettingEvents[_0xa4a3('0x7')](_0x18b44c,_0x48c59d);_0x1e5c9d(null);};}for(var e in events){if(events[_0xa4a3('0x8')](e)){var event=events[e];UserSetting[_0xa4a3('0x9')](e,emitEvent(event));}}module[_0xa4a3('0xa')]=UserSettingEvents; \ No newline at end of file +var _0xfcd3=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x30e9b5,_0x226d84){var _0x265371=function(_0x3a9db8){while(--_0x3a9db8){_0x30e9b5['push'](_0x30e9b5['shift']());}};_0x265371(++_0x226d84);}(_0xfcd3,0x1dd));var _0x3fcd=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xfcd3[_0x58afd5];return _0x3e503b;};'use strict';var EventEmitter=require(_0x3fcd('0x0'));var UserSetting=require(_0x3fcd('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x3fcd('0x2')](0x0);var events={'afterCreate':_0x3fcd('0x3'),'afterUpdate':_0x3fcd('0x4'),'afterDestroy':_0x3fcd('0x5')};function emitEvent(_0x1763cf){return function(_0x37cfd0,_0x18d655,_0x4bec81){UserSettingEvents[_0x3fcd('0x6')](_0x1763cf+':'+_0x37cfd0['id'],_0x37cfd0);UserSettingEvents['emit'](_0x1763cf,_0x37cfd0);_0x4bec81(null);};}for(var e in events){if(events[_0x3fcd('0x7')](e)){var event=events[e];UserSetting[_0x3fcd('0x8')](e,emitEvent(event));}}module[_0x3fcd('0x9')]=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 4a326ab..8f189ac 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 _0x6146=['./user-setting.attributes','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x6146,0xba));var _0x6614=function(_0x2f5c54,_0x2a0c19){_0x2f5c54=_0x2f5c54-0x0;var _0x57d450=_0x6146[_0x2f5c54];return _0x57d450;};'use strict';var attributes=require(_0x6614('0x0'));module['exports']=function(_0x31b3b4){return _0x31b3b4[_0x6614('0x1')](_0x6614('0x2'),attributes,{'tableName':_0x6614('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x296d09){if(!_0x296d09[_0x6614('0x4')])_0x296d09[_0x6614('0x5')]=null;else if(_0x296d09['clientSideLoggingEnabledSince']===null)_0x296d09[_0x6614('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xf996=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting','clientSideLoggingEnabled'];(function(_0x300e64,_0x238f83){var _0x1da2ad=function(_0x25171b){while(--_0x25171b){_0x300e64['push'](_0x300e64['shift']());}};_0x1da2ad(++_0x238f83);}(_0xf996,0x74));var _0x6f99=function(_0x10ac1c,_0x1e6143){_0x10ac1c=_0x10ac1c-0x0;var _0x8ecd64=_0xf996[_0x10ac1c];return _0x8ecd64;};'use strict';var attributes=require(_0x6f99('0x0'));module[_0x6f99('0x1')]=function(_0x31b31e){return _0x31b31e['define'](_0x6f99('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ceb57){if(!_0x5ceb57[_0x6f99('0x3')])_0x5ceb57[_0x6f99('0x4')]=null;else if(_0x5ceb57[_0x6f99('0x4')]===null)_0x5ceb57[_0x6f99('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 42421b4..1c75fdd 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 _0xb225=['./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','length'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb225,0x144));var _0x5b22=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xb225[_0x1c34e7];return _0x378cb1;};'use strict';var UserSettingEvents=require(_0x5b22('0x0'));var events=['save',_0x5b22('0x1'),_0x5b22('0x2')];function createListener(_0xf54cb2,_0x129039){return function(_0xe4f5b1){_0x129039[_0x5b22('0x3')](_0xf54cb2,_0xe4f5b1);if(_0xf54cb2===_0x5b22('0x4')){_0x129039[_0x5b22('0x3')](_0x5b22('0x5')+_0xe4f5b1[_0x5b22('0x6')],_0xe4f5b1);}};}exports[_0x5b22('0x7')]=function(_0xca6e79){for(var _0x1b53e1=0x0,_0x183709=events[_0x5b22('0x8')];_0x1b53e1<_0x183709;_0x1b53e1++){var _0x2890bf=events[_0x1b53e1];var _0x46b2ae=createListener('user-setting:'+_0x2890bf,_0xca6e79);UserSettingEvents['on'](_0x2890bf,_0x46b2ae);}}; \ No newline at end of file +var _0x5caa=['emit','user-setting:update','user-setting:update:user-','UserId','register','length','./user-setting.events','remove','update'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x5caa,0x72));var _0xa5ca=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x5caa[_0x31b5a5];return _0x364cc9;};'use strict';var UserSettingEvents=require(_0xa5ca('0x0'));var events=['save',_0xa5ca('0x1'),_0xa5ca('0x2')];function createListener(_0x93bb4a,_0x340bf3){return function(_0x31d5da){_0x340bf3[_0xa5ca('0x3')](_0x93bb4a,_0x31d5da);if(_0x93bb4a===_0xa5ca('0x4')){_0x340bf3['emit'](_0xa5ca('0x5')+_0x31d5da[_0xa5ca('0x6')],_0x31d5da);}};}exports[_0xa5ca('0x7')]=function(_0x51459a){for(var _0x56a0df=0x0,_0x1382d7=events[_0xa5ca('0x8')];_0x56a0df<_0x1382d7;_0x56a0df++){var _0x19bd00=events[_0x56a0df];var _0xcb0945=createListener('user-setting:'+_0x19bd00,_0x51459a);UserSettingEvents['on'](_0x19bd00,_0xcb0945);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index dc70d33..06338fa 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 _0xcf61=['whoami','/presence','getPresence','/:id','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','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeMailInteractions','removeSmsInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','messengerSoundNotification','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami'];(function(_0x10d1ec,_0x1a9016){var _0x2f6457=function(_0x1c2dc4){while(--_0x1c2dc4){_0x10d1ec['push'](_0x10d1ec['shift']());}};_0x2f6457(++_0x1a9016);}(_0xcf61,0xda));var _0x1cf6=function(_0x2f36b2,_0x8b9cf9){_0x2f36b2=_0x2f36b2-0x0;var _0x10439e=_0xcf61[_0x2f36b2];return _0x10439e;};'use strict';var multer=require('multer');var util=require(_0x1cf6('0x0'));var path=require(_0x1cf6('0x1'));var timeout=require('connect-timeout');var express=require(_0x1cf6('0x2'));var router=express[_0x1cf6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1cf6('0x4'));var config=require(_0x1cf6('0x5'));var controller=require('./user.controller');router[_0x1cf6('0x6')]('/',auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x8')]);router[_0x1cf6('0x6')](_0x1cf6('0x9'),auth['isAuthenticated'](),controller[_0x1cf6('0xa')]);router[_0x1cf6('0x6')](_0x1cf6('0xb'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0xc')]);router[_0x1cf6('0x6')](_0x1cf6('0xd'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0xe')]);router[_0x1cf6('0x6')](_0x1cf6('0xf'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x10')]);router[_0x1cf6('0x6')](_0x1cf6('0x11'),controller[_0x1cf6('0x12')]);router['get'](_0x1cf6('0x13'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x14')]);router[_0x1cf6('0x6')](_0x1cf6('0x15'),auth['isAuthenticated'](),controller[_0x1cf6('0x16')]);router[_0x1cf6('0x6')](_0x1cf6('0x17'),auth['isAuthenticated'](),controller[_0x1cf6('0x18')]);router['get'](_0x1cf6('0x19'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x1a')]);router[_0x1cf6('0x6')](_0x1cf6('0x1b'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x1c')]);router[_0x1cf6('0x6')](_0x1cf6('0x1d'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x1e')]);router[_0x1cf6('0x6')](_0x1cf6('0x1f'),auth[_0x1cf6('0x7')](),controller['getScreenRecordings']);router[_0x1cf6('0x6')](_0x1cf6('0x20'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x21')]);router[_0x1cf6('0x6')](_0x1cf6('0x22'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x23')]);router[_0x1cf6('0x6')]('/:id/mail/interactions',auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x24')]);router[_0x1cf6('0x6')](_0x1cf6('0x25'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x26')]);router[_0x1cf6('0x6')](_0x1cf6('0x27'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x28')]);router[_0x1cf6('0x6')]('/:id/whatsapp/interactions',auth[_0x1cf6('0x7')](),controller['getWhatsappInteractions']);router[_0x1cf6('0x6')](_0x1cf6('0x29'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x2a')]);router['get'](_0x1cf6('0x2b'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x2c')]);router[_0x1cf6('0x6')]('/:id/agents',auth['isAuthenticated'](),controller[_0x1cf6('0x2d')]);router['get'](_0x1cf6('0x2e'),auth[_0x1cf6('0x7')](),controller['getVoicePrefixes']);router['get'](_0x1cf6('0x2f'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x30')]);router[_0x1cf6('0x6')](_0x1cf6('0x31'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x32')]);router[_0x1cf6('0x6')](_0x1cf6('0x33'),auth[_0x1cf6('0x7')](),controller['getOpenchannelAccounts']);router[_0x1cf6('0x6')](_0x1cf6('0x34'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x1cf6('0x6')](_0x1cf6('0x35'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x36')]);router[_0x1cf6('0x6')](_0x1cf6('0x37'),auth['isAuthenticated'](),controller[_0x1cf6('0x38')]);router[_0x1cf6('0x6')](_0x1cf6('0x39'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x3a')]);router[_0x1cf6('0x6')](_0x1cf6('0x3b'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x3c')]);router[_0x1cf6('0x3d')](_0x1cf6('0x15'),auth[_0x1cf6('0x7')](),controller['addContacts']);router[_0x1cf6('0x3d')]('/',auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x3e')]);router[_0x1cf6('0x3d')](_0x1cf6('0x3f'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x40')]);router[_0x1cf6('0x3d')](_0x1cf6('0x17'),auth['isAuthenticated'](),controller[_0x1cf6('0x41')]);var upload=multer({'storage':multer[_0x1cf6('0x42')]({'destination':function(_0x7de886,_0x5b1713,_0x34e08c){_0x34e08c(null,path[_0x1cf6('0x43')](config[_0x1cf6('0x44')],_0x1cf6('0x45')));},'filename':function(_0xc7889b,_0x36e54c,_0x27ef93){_0x27ef93(null,util[_0x1cf6('0x46')](_0x1cf6('0x47'),Date[_0x1cf6('0x48')](),_0x36e54c['originalname']));}})});router[_0x1cf6('0x3d')]('/:id/avatar',upload[_0x1cf6('0x49')]('file'),controller[_0x1cf6('0x4a')]);router[_0x1cf6('0x3d')](_0x1cf6('0x4b'),auth['isAuthenticated'](),controller[_0x1cf6('0x4c')]);router[_0x1cf6('0x3d')](_0x1cf6('0x4d'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x4e')]);router[_0x1cf6('0x3d')](_0x1cf6('0x4f'),auth['isAuthenticated'](),controller[_0x1cf6('0x50')]);router[_0x1cf6('0x3d')](_0x1cf6('0x51'),auth['isAuthenticated'](),controller[_0x1cf6('0x52')]);router['post'](_0x1cf6('0x29'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x53')]);router[_0x1cf6('0x3d')](_0x1cf6('0x54'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x55')]);router[_0x1cf6('0x3d')](_0x1cf6('0x56'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x57')]);router[_0x1cf6('0x3d')](_0x1cf6('0x58'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x1cf6('0x3d')](_0x1cf6('0x59'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x5a')]);router[_0x1cf6('0x3d')](_0x1cf6('0x5b'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x5c')]);router[_0x1cf6('0x3d')](_0x1cf6('0x5d'),auth[_0x1cf6('0x7')](),controller['addWhatsappInteractions']);router[_0x1cf6('0x3d')](_0x1cf6('0x2f'),auth['isAuthenticated'](),controller[_0x1cf6('0x5e')]);router[_0x1cf6('0x3d')](_0x1cf6('0x31'),auth[_0x1cf6('0x7')](),controller['addMailAccounts']);router[_0x1cf6('0x3d')](_0x1cf6('0x33'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x5f')]);router[_0x1cf6('0x3d')](_0x1cf6('0x34'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x60')]);router[_0x1cf6('0x3d')]('/:id/chat_websites',auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x61')]);router[_0x1cf6('0x3d')](_0x1cf6('0x37'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x62')]);router[_0x1cf6('0x3d')](_0x1cf6('0x3b'),auth[_0x1cf6('0x7')](),controller['createApiKey']);router[_0x1cf6('0x63')]('/:id',auth['isAuthenticated'](),controller[_0x1cf6('0x64')]);router[_0x1cf6('0x63')](_0x1cf6('0x65'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x66')]);router[_0x1cf6('0x67')]('/:id/queues',auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x68')]);router[_0x1cf6('0x67')](_0x1cf6('0x29'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x69')]);router[_0x1cf6('0x67')](_0x1cf6('0xf'),auth[_0x1cf6('0x7')](),controller['destroy']);router[_0x1cf6('0x67')](_0x1cf6('0x54'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x1cf6('0x67')](_0x1cf6('0x56'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x6a')]);router[_0x1cf6('0x67')](_0x1cf6('0x58'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x1cf6('0x67')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x1cf6('0x6b')]);router[_0x1cf6('0x67')]('/:id/openchannel_interactions',auth[_0x1cf6('0x7')](),controller['removeOpenchannelInteractions']);router['delete'](_0x1cf6('0x5d'),auth[_0x1cf6('0x7')](),controller['removeWhatsappInteractions']);router[_0x1cf6('0x67')]('/:id/fax_accounts',auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x6c')]);router[_0x1cf6('0x67')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0x1cf6('0x33'),auth['isAuthenticated'](),controller[_0x1cf6('0x6d')]);router[_0x1cf6('0x67')](_0x1cf6('0x34'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x6e')]);router[_0x1cf6('0x67')](_0x1cf6('0x35'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x6f')]);router[_0x1cf6('0x67')](_0x1cf6('0x37'),auth[_0x1cf6('0x7')](),controller['removeWhatsappAccounts']);router[_0x1cf6('0x67')](_0x1cf6('0x3b'),auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x70')]);router['post']('/:id/messengerSoundNotification',auth[_0x1cf6('0x7')](),controller[_0x1cf6('0x71')]);module[_0x1cf6('0x72')]=router; \ No newline at end of file +var _0x48ac=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','getQueues','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','diskStorage','join','server/files/images/','%s-%s','now','originalname','single','addAvatar','/:id/login','login','logout','/:id/pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','/:id/queues','removeQueues','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','util','connect-timeout'];(function(_0x4e0149,_0x38f2a2){var _0x51db4c=function(_0x37c65){while(--_0x37c65){_0x4e0149['push'](_0x4e0149['shift']());}};_0x51db4c(++_0x38f2a2);}(_0x48ac,0xe0));var _0xc48a=function(_0x55f564,_0x477c00){_0x55f564=_0x55f564-0x0;var _0x19886b=_0x48ac[_0x55f564];return _0x19886b;};'use strict';var multer=require('multer');var util=require(_0xc48a('0x0'));var path=require('path');var timeout=require(_0xc48a('0x1'));var express=require(_0xc48a('0x2'));var router=express[_0xc48a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc48a('0x4'));var interaction=require(_0xc48a('0x5'));var config=require(_0xc48a('0x6'));var controller=require(_0xc48a('0x7'));router[_0xc48a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xc48a('0x9')](),controller[_0xc48a('0xa')]);router[_0xc48a('0x8')]('/whoami',auth[_0xc48a('0x9')](),controller[_0xc48a('0xb')]);router[_0xc48a('0x8')](_0xc48a('0xc'),auth[_0xc48a('0x9')](),controller[_0xc48a('0xd')]);router[_0xc48a('0x8')](_0xc48a('0xe'),auth[_0xc48a('0x9')](),controller[_0xc48a('0xf')]);router[_0xc48a('0x8')]('/:id/avatar',controller[_0xc48a('0x10')]);router[_0xc48a('0x8')](_0xc48a('0x11'),auth['isAuthenticated'](),controller[_0xc48a('0x12')]);router[_0xc48a('0x8')]('/:id/contacts',auth[_0xc48a('0x9')](),controller[_0xc48a('0x13')]);router[_0xc48a('0x8')]('/:id/queues',auth[_0xc48a('0x9')](),controller[_0xc48a('0x14')]);router[_0xc48a('0x8')]('/:id/queues_rt',auth[_0xc48a('0x9')](),controller[_0xc48a('0x15')]);router['get']('/:id/groups',auth[_0xc48a('0x9')](),controller['getGroups']);router[_0xc48a('0x8')](_0xc48a('0x16'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x17')]);router[_0xc48a('0x8')](_0xc48a('0x18'),auth[_0xc48a('0x9')](),controller['getScreenRecordings']);router[_0xc48a('0x8')](_0xc48a('0x19'),auth['isAuthenticated'](),controller[_0xc48a('0x1a')]);router['get'](_0xc48a('0x1b'),auth['isAuthenticated'](),controller[_0xc48a('0x1c')]);router[_0xc48a('0x8')](_0xc48a('0x1d'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x1e')]);router[_0xc48a('0x8')](_0xc48a('0x1f'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x20')]);router[_0xc48a('0x8')](_0xc48a('0x21'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xc48a('0x8')](_0xc48a('0x22'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x23')]);router['get']('/:id/teams',auth[_0xc48a('0x9')](),controller[_0xc48a('0x24')]);router[_0xc48a('0x8')]('/:id/lists',auth[_0xc48a('0x9')](),controller[_0xc48a('0x25')]);router[_0xc48a('0x8')](_0xc48a('0x26'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x27')]);router[_0xc48a('0x8')](_0xc48a('0x28'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x29')]);router['get']('/:id/fax_accounts',auth[_0xc48a('0x9')](),controller['getFaxAccounts']);router[_0xc48a('0x8')](_0xc48a('0x2a'),auth['isAuthenticated'](),controller[_0xc48a('0x2b')]);router[_0xc48a('0x8')](_0xc48a('0x2c'),auth['isAuthenticated'](),controller[_0xc48a('0x2d')]);router[_0xc48a('0x8')]('/:id/sms_accounts',auth[_0xc48a('0x9')](),controller[_0xc48a('0x2e')]);router[_0xc48a('0x8')](_0xc48a('0x2f'),auth[_0xc48a('0x9')](),controller['getChatWebsites']);router[_0xc48a('0x8')](_0xc48a('0x30'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x31')]);router[_0xc48a('0x8')](_0xc48a('0x32'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x33')]);router['get'](_0xc48a('0x34'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x35')]);router[_0xc48a('0x36')](_0xc48a('0x37'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x38')]);router['post']('/',auth[_0xc48a('0x9')](),controller[_0xc48a('0x39')]);router[_0xc48a('0x36')](_0xc48a('0x3a'),auth['isAuthenticated'](),controller[_0xc48a('0x3b')]);router[_0xc48a('0x36')]('/:id/queues',auth[_0xc48a('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0xc48a('0x3c')]({'destination':function(_0x53671c,_0x547f6b,_0x84ec08){_0x84ec08(null,path[_0xc48a('0x3d')](config['root'],_0xc48a('0x3e')));},'filename':function(_0x409c48,_0xba172b,_0x372bd8){_0x372bd8(null,util['format'](_0xc48a('0x3f'),Date[_0xc48a('0x40')](),_0xba172b[_0xc48a('0x41')]));}})});router[_0xc48a('0x36')]('/:id/avatar',upload[_0xc48a('0x42')]('file'),controller[_0xc48a('0x43')]);router[_0xc48a('0x36')](_0xc48a('0x44'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x45')]);router[_0xc48a('0x36')]('/:id/logout',auth[_0xc48a('0x9')](),controller[_0xc48a('0x46')]);router[_0xc48a('0x36')](_0xc48a('0x47'),auth[_0xc48a('0x9')](),controller['pause']);router[_0xc48a('0x36')](_0xc48a('0x48'),auth[_0xc48a('0x9')](),controller['unpause']);router[_0xc48a('0x36')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc48a('0x49')]);router[_0xc48a('0x36')](_0xc48a('0x4a'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x4b')]);router[_0xc48a('0x36')](_0xc48a('0x4c'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0xc48a('0x4d'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x4e')]);router[_0xc48a('0x36')](_0xc48a('0x4f'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x50')]);router[_0xc48a('0x36')](_0xc48a('0x51'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x52')]);router['post'](_0xc48a('0x53'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x54')]);router[_0xc48a('0x36')](_0xc48a('0x55'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x56')]);router[_0xc48a('0x36')](_0xc48a('0x2a'),auth['isAuthenticated'](),controller[_0xc48a('0x57')]);router[_0xc48a('0x36')](_0xc48a('0x2c'),auth[_0xc48a('0x9')](),controller['addOpenchannelAccounts']);router[_0xc48a('0x36')](_0xc48a('0x58'),auth['isAuthenticated'](),controller[_0xc48a('0x59')]);router[_0xc48a('0x36')](_0xc48a('0x2f'),auth[_0xc48a('0x9')](),controller['addChatWebsites']);router[_0xc48a('0x36')](_0xc48a('0x30'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x5a')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller[_0xc48a('0x5b')]);router[_0xc48a('0x5c')]('/:id',auth[_0xc48a('0x9')](),controller['update']);router[_0xc48a('0x5c')](_0xc48a('0x5d'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x5e')]);router[_0xc48a('0x5f')](_0xc48a('0x60'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x61')]);router[_0xc48a('0x5f')]('/:id/teams',auth[_0xc48a('0x9')](),controller['removeTeams']);router[_0xc48a('0x5f')](_0xc48a('0xe'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x62')]);router[_0xc48a('0x5f')]('/:id/chat_interactions',auth[_0xc48a('0x9')](),controller['removeChatInteractions']);router[_0xc48a('0x5f')](_0xc48a('0x4c'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x63')]);router[_0xc48a('0x5f')](_0xc48a('0x4d'),auth['isAuthenticated'](),controller[_0xc48a('0x64')]);router[_0xc48a('0x5f')](_0xc48a('0x4f'),auth['isAuthenticated'](),controller[_0xc48a('0x65')]);router[_0xc48a('0x5f')](_0xc48a('0x51'),auth['isAuthenticated'](),controller[_0xc48a('0x66')]);router['delete'](_0xc48a('0x53'),auth['isAuthenticated'](),controller[_0xc48a('0x67')]);router[_0xc48a('0x5f')](_0xc48a('0x55'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x68')]);router[_0xc48a('0x5f')](_0xc48a('0x2a'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x69')]);router['delete']('/:id/openchannel_accounts',auth[_0xc48a('0x9')](),controller['removeOpenchannelAccounts']);router[_0xc48a('0x5f')](_0xc48a('0x58'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x6a')]);router['delete']('/:id/chat_websites',auth[_0xc48a('0x9')](),controller[_0xc48a('0x6b')]);router[_0xc48a('0x5f')](_0xc48a('0x30'),auth['isAuthenticated'](),controller[_0xc48a('0x6c')]);router[_0xc48a('0x5f')]('/:id/api_key',auth[_0xc48a('0x9')](),controller[_0xc48a('0x6d')]);router[_0xc48a('0x36')](_0xc48a('0x6e'),auth[_0xc48a('0x9')](),controller[_0xc48a('0x6f')]);module[_0xc48a('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 71e635b..923b564 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 _0x3eed=['moment','util','STRING','name','defaultuser','The\x20name\x20of\x20the\x20user','setDataValue','fullname','callerid','format','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','peer','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','certificate','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3eed,0x164));var _0xd3ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3eed[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd3ee('0x0'));var util=require(_0xd3ee('0x1'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':![],'unique':_0xd3ee('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5cf39c){this['setDataValue'](_0xd3ee('0x3'),_0x5cf39c);this['setDataValue'](_0xd3ee('0x4'),_0x5cf39c);},'comment':_0xd3ee('0x5')},'fullname':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':![],'set':function(_0x4eb0e7){this[_0xd3ee('0x6')](_0xd3ee('0x7'),_0x4eb0e7);this[_0xd3ee('0x6')](_0xd3ee('0x8'),util[_0xd3ee('0x9')]('\x22%s\x22\x20<%s>',_0x4eb0e7,this[_0xd3ee('0xa')](_0xd3ee('0xb'))));}},'alias':{'type':Sequelize[_0xd3ee('0x2')]},'email':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1fee4e){if(_0x1fee4e){this[_0xd3ee('0x6')](_0xd3ee('0xc'),_0x1fee4e[_0xd3ee('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0xd3ee('0xe'),_0xd3ee('0xf'),_0xd3ee('0x10'),_0xd3ee('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xd3ee('0x12')},'internal':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0xf7750b){this['setDataValue'](_0xd3ee('0xb'),_0xf7750b);this[_0xd3ee('0x6')](_0xd3ee('0x14'),_0xf7750b);this[_0xd3ee('0x6')](_0xd3ee('0x8'),util[_0xd3ee('0x9')](_0xd3ee('0x15'),this['getDataValue']('fullname'),_0xf7750b));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xd3ee('0x2')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xd3ee('0x2')]},'country':{'type':Sequelize[_0xd3ee('0x2')]},'online':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd3ee('0x17')]},'voicePause':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xd3ee('0x2')],'defaultValue':_0xd3ee('0x18')},'lastPauseAt':{'type':Sequelize[_0xd3ee('0x17')]},'chatCapacity':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd3ee('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd3ee('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![],'defaultValue':_0xd3ee('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xd3ee('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd3ee('0x1a')]('friend','user',_0xd3ee('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xd3ee('0x1a')]('ALLOWED_NOT_SCREENED',_0xd3ee('0x1c'),'ALLOWED_FAILED_SCREEN',_0xd3ee('0x1d'),_0xd3ee('0x1e'),_0xd3ee('0x1f'),_0xd3ee('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x2bc7fa){this[_0xd3ee('0x6')](_0xd3ee('0x21'),_0x2bc7fa?_0x2bc7fa['join'](','):null);},'get':function(){return this[_0xd3ee('0xa')](_0xd3ee('0x21'))?this[_0xd3ee('0xa')](_0xd3ee('0x21'))[_0xd3ee('0x22')](','):null;},'comment':_0xd3ee('0x23')},'dtmfmode':{'type':Sequelize[_0xd3ee('0x1a')]('rfc2833','info',_0xd3ee('0x24'),_0xd3ee('0x25'),_0xd3ee('0x26')),'allowNull':!![],'defaultValue':_0xd3ee('0x27')},'directmedia':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no',_0xd3ee('0x29'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd3ee('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![],'defaultValue':_0xd3ee('0x2a'),'set':function(_0x230f01){this[_0xd3ee('0x6')](_0xd3ee('0x2b'),_0x230f01?_0x230f01[_0xd3ee('0x2c')](','):null);},'get':function(){return this['getDataValue'](_0xd3ee('0x2b'))?this[_0xd3ee('0xa')](_0xd3ee('0x2b'))[_0xd3ee('0x22')](','):null;},'comment':_0xd3ee('0x2d')},'callgroup':{'type':Sequelize[_0xd3ee('0x2')]},'namedcallgroup':{'type':Sequelize[_0xd3ee('0x2')]},'pickupgroup':{'type':Sequelize[_0xd3ee('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xd3ee('0x2')]},'language':{'type':Sequelize[_0xd3ee('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd3ee('0x2')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':![],'defaultValue':_0xd3ee('0x2e'),'set':function(_0x2ebd51){this[_0xd3ee('0x6')](_0xd3ee('0x2f'),_0x2ebd51?_0x2ebd51[_0xd3ee('0x2c')](';'):_0xd3ee('0x2e'));},'get':function(){return this['getDataValue']('allow')?this[_0xd3ee('0xa')](_0xd3ee('0x2f'))[_0xd3ee('0x22')](';'):null;},'comment':_0xd3ee('0x30')},'autoframing':{'type':Sequelize['ENUM'](_0xd3ee('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![],'set':function(_0x22c8f3){this[_0xd3ee('0x6')](_0xd3ee('0x31'),_0x22c8f3?_0x22c8f3[_0xd3ee('0x2c')](','):null);},'get':function(){return this['getDataValue'](_0xd3ee('0x31'))?this[_0xd3ee('0xa')](_0xd3ee('0x31'))[_0xd3ee('0x22')](','):null;},'comment':_0xd3ee('0x32')},'trustrpid':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd3ee('0x1a')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![],'defaultValue':_0xd3ee('0x33')},'amaflags':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![],'defaultValue':_0xd3ee('0x28')},'busylevel':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd3ee('0x1a')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xd3ee('0x1a')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no',_0xd3ee('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x35'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x36'),_0xd3ee('0x37')),'allowNull':!![],'defaultValue':_0xd3ee('0x37')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xd3ee('0x28')},'keepalive':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xd3ee('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xd3ee('0x1a')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no',_0xd3ee('0x38'),_0xd3ee('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd3ee('0x1a')]('active',_0xd3ee('0x3a'),_0xd3ee('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd3ee('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd3ee('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xd3ee('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xd3ee('0x28'),'no','nonat',_0xd3ee('0x3c'),_0xd3ee('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd3ee('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0xd3ee('0x17')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd3ee('0x3e')]},'showWebBar':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0,'set':function(_0x5d7422){this['setDataValue'](_0xd3ee('0x3f'),_0x5d7422);var _0x33d3f9=this[_0xd3ee('0x40')]({'plain':!![]});switch(_0x5d7422){case 0x0:case 0x1:var _0x1a152f=_0x33d3f9[_0xd3ee('0x21')]?_[_0xd3ee('0x41')](_0x33d3f9[_0xd3ee('0x21')])?_0x33d3f9[_0xd3ee('0x21')][_0xd3ee('0x2c')]():_0x33d3f9[_0xd3ee('0x21')]:_0xd3ee('0x42');if(_0x1a152f==='wss'){_0x1a152f=_0xd3ee('0x42');}this[_0xd3ee('0x6')]('transport',_0x1a152f);this[_0xd3ee('0x6')](_0xd3ee('0x43'),'no');this['setDataValue'](_0xd3ee('0x44'),null);this[_0xd3ee('0x6')](_0xd3ee('0x45'),null);this['setDataValue'](_0xd3ee('0x46'),null);this[_0xd3ee('0x6')](_0xd3ee('0x47'),null);this[_0xd3ee('0x6')](_0xd3ee('0x48'),null);this[_0xd3ee('0x6')](_0xd3ee('0x49'),null);this[_0xd3ee('0x6')](_0xd3ee('0x4a'),null);this[_0xd3ee('0x6')]('dtlsprivatekey',null);this[_0xd3ee('0x6')](_0xd3ee('0x4b'),'no');break;case 0x2:this[_0xd3ee('0x6')](_0xd3ee('0x21'),'wss');this[_0xd3ee('0x6')]('encryption',_0xd3ee('0x28'));this[_0xd3ee('0x6')](_0xd3ee('0x44'),'yes');this[_0xd3ee('0x6')](_0xd3ee('0x45'),_0xd3ee('0x28'));this[_0xd3ee('0x6')](_0xd3ee('0x46'),_0xd3ee('0x28'));this[_0xd3ee('0x6')](_0xd3ee('0x47'),_0xd3ee('0x28'));this[_0xd3ee('0x6')]('dtlsverify','no');this[_0xd3ee('0x6')]('dtlssetup',_0xd3ee('0x3b'));this[_0xd3ee('0x6')](_0xd3ee('0x4a'),_0x33d3f9[_0xd3ee('0x4a')]||_0xd3ee('0x4c'));this[_0xd3ee('0x6')](_0xd3ee('0x4d'),_0x33d3f9['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0xd3ee('0x4b'),_0xd3ee('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0xd3ee('0x3e')],'set':function(_0x4b2e66){this[_0xd3ee('0x6')](_0xd3ee('0x4e'),_0x4b2e66?_0x4b2e66[_0xd3ee('0x2c')](','):[]);},'get':function(){return this[_0xd3ee('0xa')](_0xd3ee('0x4e'))?_[_0xd3ee('0x4f')](this['getDataValue'](_0xd3ee('0x4e'))['split'](','),function(_0x50fab2){return parseInt(_0x50fab2,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd3ee('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xd3ee('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd3ee('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd3ee('0x1a')](_0xd3ee('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd3ee('0x50')],'get':function(){return this[_0xd3ee('0xa')](_0xd3ee('0x51'))?this[_0xd3ee('0xa')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xd3ee('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xd3ee('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x107c37){if(typeof _0x107c37===_0xd3ee('0x52')){var _0x505766=_0x107c37==='1'?!![]:_0x107c37==='0'?![]:_0x107c37===_0xd3ee('0x53')?!![]:_0x107c37===_0xd3ee('0x54')?![]:![];this[_0xd3ee('0x6')](_0xd3ee('0x55'),_0x505766);}else{this[_0xd3ee('0x6')]('screenrecording',_0x107c37);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1b0bf4){this[_0xd3ee('0x6')](_0xd3ee('0x56'),_0x1b0bf4);if(_0x1b0bf4===!![]){this[_0xd3ee('0x6')](_0xd3ee('0x57'),moment());this[_0xd3ee('0x6')]('loginAttempts',0x0);}else{this[_0xd3ee('0x6')](_0xd3ee('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0xd3ee('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd3ee('0x13')](0x5)[_0xd3ee('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xd3ee('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xd3ee('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x7173=['PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','rfc2833','info','shortinfo','auto','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','insecure','never','accept','originate','uac','uas','fingerprint','active','passive','TEXT','showWebBar','get','isArray','encryption','force_avp','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','avpf','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','name','setDataValue','defaultuser','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','user','agent','local','accountcode','BOOLEAN','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x56abbb,_0x3e54d0){var _0x5516e3=function(_0x226d9c){while(--_0x226d9c){_0x56abbb['push'](_0x56abbb['shift']());}};_0x5516e3(++_0x3e54d0);}(_0x7173,0xe8));var _0x3717=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7173[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3717('0x0'));var moment=require(_0x3717('0x1'));var util=require('util');var _=require(_0x3717('0x2'));module[_0x3717('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3717('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x20eb7f){this[_0x3717('0x5')]('name',_0x20eb7f);this[_0x3717('0x5')](_0x3717('0x6'),_0x20eb7f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x3717('0x7')],'allowNull':![],'set':function(_0x409e1d){this['setDataValue'](_0x3717('0x8'),_0x409e1d);this[_0x3717('0x5')](_0x3717('0x9'),util[_0x3717('0xa')](_0x3717('0xb'),_0x409e1d,this['getDataValue'](_0x3717('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3717('0x7')],'allowNull':![],'unique':_0x3717('0xd'),'validate':{'isEmail':!![]},'set':function(_0x46845e){if(_0x46845e){this['setDataValue'](_0x3717('0xd'),_0x46845e[_0x3717('0xe')]());}}},'role':{'type':Sequelize[_0x3717('0xf')]('admin',_0x3717('0x10'),_0x3717('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x3717('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3717('0x7')],'defaultValue':_0x3717('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x3717('0xc'),'set':function(_0xa9403c){this['setDataValue']('internal',_0xa9403c);this[_0x3717('0x5')](_0x3717('0x13'),_0xa9403c);this[_0x3717('0x5')]('callerid',util[_0x3717('0xa')](_0x3717('0xb'),this['getDataValue'](_0x3717('0x8')),_0xa9403c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x3717('0x7')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3717('0x7')]},'country':{'type':Sequelize[_0x3717('0x7')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3717('0x7')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x3717('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3717('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3717('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3717('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![],'defaultValue':_0x3717('0x17')},'ipaddr':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0x3717('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x18'),'user',_0x3717('0x19')),'allowNull':!![],'defaultValue':_0x3717('0x18')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3717('0x1a')},'callingpres':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x1b'),_0x3717('0x1c'),'ALLOWED_FAILED_SCREEN',_0x3717('0x1d'),_0x3717('0x1e'),_0x3717('0x1f'),_0x3717('0x20'),_0x3717('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![],'defaultValue':_0x3717('0x22'),'set':function(_0x5cff91){this['setDataValue']('transport',_0x5cff91?_0x5cff91[_0x3717('0x23')](','):null);},'get':function(){return this[_0x3717('0x24')](_0x3717('0x25'))?this['getDataValue'](_0x3717('0x25'))[_0x3717('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x27'),_0x3717('0x28'),_0x3717('0x29'),'inband',_0x3717('0x2a')),'allowNull':!![],'defaultValue':_0x3717('0x27')},'directmedia':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no',_0x3717('0x2c'),_0x3717('0x2d'),_0x3717('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3717('0x2f'),'set':function(_0x379eb2){this[_0x3717('0x5')](_0x3717('0x30'),_0x379eb2?_0x379eb2[_0x3717('0x23')](','):null);},'get':function(){return this[_0x3717('0x24')](_0x3717('0x30'))?this[_0x3717('0x24')](_0x3717('0x30'))[_0x3717('0x26')](','):null;},'comment':_0x3717('0x31')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x3717('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3717('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3717('0x7')]},'disallow':{'type':Sequelize[_0x3717('0x7')],'allowNull':![],'defaultValue':_0x3717('0x32')},'allow':{'type':Sequelize[_0x3717('0x7')],'allowNull':![],'defaultValue':_0x3717('0x33'),'set':function(_0x45351c){this[_0x3717('0x5')](_0x3717('0x34'),_0x45351c?_0x45351c['join'](';'):_0x3717('0x33'));},'get':function(){return this[_0x3717('0x24')](_0x3717('0x34'))?this[_0x3717('0x24')](_0x3717('0x34'))[_0x3717('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![],'set':function(_0x24a920){this['setDataValue']('insecure',_0x24a920?_0x24a920[_0x3717('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x3717('0x35'))?this[_0x3717('0x24')]('insecure')[_0x3717('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no',_0x3717('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x3717('0x2b')},'busylevel':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x3717('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3717('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x3717('0x37'),'refuse',_0x3717('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x39'),_0x3717('0x3a')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x3717('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x3717('0x2b')},'keepalive':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x3717('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x3717('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3717('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3717('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3717('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3717('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no',_0x3717('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x3c'),_0x3717('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3717('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x3717('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x3717('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no',_0x3717('0x2c'),_0x3717('0x2d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3717('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x3717('0x15')]},'passwordResetAt':{'type':Sequelize[_0x3717('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3717('0x3e')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5a39b8){this[_0x3717('0x5')](_0x3717('0x3f'),_0x5a39b8);var _0x370e1c=this[_0x3717('0x40')]({'plain':!![]});switch(_0x5a39b8){case 0x0:case 0x1:var _0x52c4db=_0x370e1c[_0x3717('0x25')]?_[_0x3717('0x41')](_0x370e1c[_0x3717('0x25')])?_0x370e1c[_0x3717('0x25')][_0x3717('0x23')]():_0x370e1c[_0x3717('0x25')]:'udp';if(_0x52c4db==='wss'){_0x52c4db='udp';}this['setDataValue']('transport',_0x52c4db);this[_0x3717('0x5')](_0x3717('0x42'),'no');this[_0x3717('0x5')]('avpf',null);this[_0x3717('0x5')](_0x3717('0x43'),null);this[_0x3717('0x5')]('icesupport',null);this[_0x3717('0x5')]('dtlsenable',null);this['setDataValue'](_0x3717('0x44'),null);this[_0x3717('0x5')](_0x3717('0x45'),null);this[_0x3717('0x5')](_0x3717('0x46'),null);this[_0x3717('0x5')](_0x3717('0x47'),null);this[_0x3717('0x5')](_0x3717('0x48'),'no');break;case 0x2:this[_0x3717('0x5')](_0x3717('0x25'),_0x3717('0x49'));this[_0x3717('0x5')](_0x3717('0x42'),_0x3717('0x2b'));this[_0x3717('0x5')](_0x3717('0x4a'),_0x3717('0x2b'));this[_0x3717('0x5')](_0x3717('0x43'),_0x3717('0x2b'));this[_0x3717('0x5')]('icesupport',_0x3717('0x2b'));this[_0x3717('0x5')]('dtlsenable',_0x3717('0x2b'));this['setDataValue'](_0x3717('0x44'),'no');this[_0x3717('0x5')](_0x3717('0x45'),_0x3717('0x4b'));this[_0x3717('0x5')]('dtlscertfile',_0x370e1c[_0x3717('0x46')]||_0x3717('0x4c'));this[_0x3717('0x5')]('dtlsprivatekey',_0x370e1c[_0x3717('0x47')]||_0x3717('0x4d'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2928f2){this[_0x3717('0x5')](_0x3717('0x4e'),_0x2928f2?_0x2928f2[_0x3717('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0x3717('0x4e'))?_[_0x3717('0x4f')](this[_0x3717('0x24')](_0x3717('0x4e'))[_0x3717('0x26')](','),function(_0x9d2c90){return parseInt(_0x9d2c90,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3717('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3717('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3717('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3717('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3717('0xf')](_0x3717('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3717('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3717('0x7')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3717('0x50')],'get':function(){return this['getDataValue'](_0x3717('0x51'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3717('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![],'set':function(_0x8aa7bc){if(typeof _0x8aa7bc===_0x3717('0x52')){var _0x3f8c2d=_0x8aa7bc==='1'?!![]:_0x8aa7bc==='0'?![]:_0x8aa7bc===_0x3717('0x53')?!![]:_0x8aa7bc===_0x3717('0x54')?![]:![];this[_0x3717('0x5')](_0x3717('0x55'),_0x3f8c2d);}else{this[_0x3717('0x5')](_0x3717('0x55'),_0x8aa7bc);}}},'blocked':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![],'set':function(_0x3c2a92){this[_0x3717('0x5')]('blocked',_0x3c2a92);if(_0x3c2a92===!![]){this['setDataValue']('blockedAt',moment());this[_0x3717('0x5')](_0x3717('0x56'),0x0);}else{this[_0x3717('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x3717('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3717('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x3717('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3717('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3717('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x3717('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x3717('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 68a18a5..827f131 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 _0x19f0=['x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','getDataValue','Voice','upsert','UserVoicePrefix','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','VoicePrefixId','getLists','getAgents','values','CmHopper','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$notIn','$like','$notLike','$overlap','$contains','lastName','Contact','dialActive','getApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','unknown','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','substring','uniqBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','SELECT','field','ui.','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','moment','path','lodash','squel','ioredis','../../components/contacts','../../components/realtime/agents','api','../../config/utils','../../errors/api','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','redis','defaults','localhost','http','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','User,\x20%s,\x20%s','message','catch','update','role','emit','destroy','admin','Users','user','agent','Telephones','telephone','ignore','value','find','name','UserProfileResource','end','send','rawAttributes','key','filter','password','salt','resetPasswordToken','resetPasswordExpires','md5secret','includes','index','getOptions','User','query','includeAll','userSetting','true','include','UserSetting','attributes','push','rows','openTabs','length','chat','dataValues','mail','openchannel','all','show','params','merge','options','body','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','email','103','113','110','104','106','107','108','109','100','111','115','create','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','userProfileId','UserProfileSection','Agents','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','map','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','enforcePasswordHistory','passwordHistoryLimit','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','Queue:save','voice','VoiceQueue','get','format','SIP/%s','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','sms','whatsapp','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','MAIL','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','findAll','findOne','model','Queue','keys','filters','intersection','fields','order','sort','where','Unknown\x20role','nolimit','getVoiceQueuesRt','pick','getGroups','UserId','VoiceRecording','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x19f0,0x93));var _0x019f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19f0[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x019f('0x0'));var util=require('util');var path=require(_0x019f('0x1'));var fs=require('fs');var _=require(_0x019f('0x2'));var squel=require(_0x019f('0x3'));var Redis=require(_0x019f('0x4'));var jayson=require('jayson/promise');var authService=require('../../components/auth/service');var contacts=require(_0x019f('0x5'));var qs=require('../../components/parsers/qs');var rta=require(_0x019f('0x6'));var logger=require('../../config/logger')(_0x019f('0x7'));var utils=require(_0x019f('0x8'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x019f('0x9'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x019f('0xa')];var APIForbiddenError=require(_0x019f('0x9'))[_0x019f('0xb')];var APIHandleError=require('../../errors/api')[_0x019f('0xc')];var db=require(_0x019f('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x019f('0xe')]));require('./user.socket')['register'](socket);config[_0x019f('0xe')]=_[_0x019f('0xf')](config[_0x019f('0xe')],{'host':_0x019f('0x10'),'port':0x18eb});var amiClient=jayson['client'][_0x019f('0x11')]({'port':0x232a});var values;function respondWithStatusCode(_0x430943,_0x45abdf){_0x45abdf=_0x45abdf||0xcc;return function(_0x464b2f){if(_0x464b2f){return _0x430943[_0x019f('0x12')](_0x45abdf);}return _0x430943[_0x019f('0x13')](_0x45abdf)['end']();};}function respondWithResult(_0x59e8a2,_0xcac8ec){_0xcac8ec=_0xcac8ec||0xc8;return function(_0xaaa314){if(_0xaaa314){return _0x59e8a2['status'](_0xcac8ec)[_0x019f('0x14')](_0xaaa314);}};}function respondWithFilteredResult(_0x14c537,_0x21877d){return function(_0x30e2fa){if(_0x30e2fa){var _0x59f2af=typeof _0x21877d[_0x019f('0x15')]===_0x019f('0x16')&&typeof _0x21877d[_0x019f('0x17')]===_0x019f('0x16');var _0xadd890=_0x30e2fa[_0x019f('0x18')];var _0x43e1b3=_0x59f2af?0x0:_0x21877d[_0x019f('0x15')];var _0x447097=_0x59f2af?_0x30e2fa['count']:_0x21877d[_0x019f('0x15')]+_0x21877d[_0x019f('0x17')];var _0x1206ba;if(_0x447097>=_0xadd890){_0x447097=_0xadd890;_0x1206ba=0xc8;}else{_0x1206ba=0xce;}_0x14c537[_0x019f('0x13')](_0x1206ba);return _0x14c537[_0x019f('0x19')](_0x019f('0x1a'),_0x43e1b3+'-'+_0x447097+'/'+_0xadd890)[_0x019f('0x14')](_0x30e2fa);}return null;};}function respondWithRpcPromise(_0x407372,_0x2437f4,_0x749ed7,_0x270eb1){return new Promise(function(_0x31caa7,_0x5c81f4){var _0x49d807=_0x270eb1||amiClient;return _0x49d807['request'](_0x407372,_0x749ed7)[_0x019f('0x1b')](function(_0x4786a0){logger[_0x019f('0x1c')]('User,\x20%s,\x20%s',_0x2437f4,_0x019f('0x1d'));logger['debug'](_0x019f('0x1e'),_0x2437f4,_0x019f('0x1d'),JSON['stringify'](_0x4786a0));if(_0x4786a0['error']){if(_0x4786a0[_0x019f('0x1f')]['code']===0x1f4){logger['error'](_0x019f('0x20'),_0x2437f4,_0x4786a0[_0x019f('0x1f')]['message']);return _0x5c81f4(_0x4786a0[_0x019f('0x1f')][_0x019f('0x21')]);}logger[_0x019f('0x1f')]('User,\x20%s,\x20%s',_0x2437f4,_0x4786a0['error'][_0x019f('0x21')]);return _0x31caa7(_0x4786a0['error']['message']);}else{logger[_0x019f('0x1c')](_0x019f('0x20'),_0x2437f4,'request\x20sent');_0x31caa7(_0x4786a0['result'][_0x019f('0x21')]);}})[_0x019f('0x22')](function(_0x4acf01){logger[_0x019f('0x1f')](_0x019f('0x20'),_0x2437f4,_0x4acf01);_0x5c81f4(_0x4acf01);});});}function saveUpdates(_0x3c0a90){return function(_0x3eccef){if(_0x3eccef){return _0x3eccef[_0x019f('0x23')](_0x3c0a90)['then'](function(_0x1daa2d){if(_0x1daa2d[_0x019f('0x24')]==='agent'){socket[_0x019f('0x25')]('userNotification:recalc:'+_0x1daa2d['id'],_0x1daa2d);}return _0x1daa2d;});}return null;};}function removeEntity(_0x315749,_0x4054bc){return function(_0x44b3a9){if(_0x44b3a9){return _0x44b3a9[_0x019f('0x26')]({'transaction':_0x4054bc})[_0x019f('0x1b')](function(){var _0x3834f8=_0x44b3a9['get']({'plain':!![]});if(_0x3834f8['role']===_0x019f('0x27'))return;var _0x501787=[{'name':_0x019f('0x28'),'value':_0x019f('0x29'),'ignore':!![]},{'name':'Agents','value':_0x019f('0x2a'),'ignore':![]},{'name':_0x019f('0x2b'),'value':_0x019f('0x2c'),'ignore':![]}];var _0x4f37c1=_(_0x501787)['filter'](_0x019f('0x2d'))['map'](_0x019f('0x2e'))[_0x019f('0x2e')]();if(_['includes'](_0x4f37c1,_0x3834f8[_0x019f('0x24')])){return;}var _0x1d0b91=_[_0x019f('0x2f')](_0x501787,['value',_0x3834f8[_0x019f('0x24')]])[_0x019f('0x30')];return db[_0x019f('0x31')]['destroy']({'where':{'type':_0x1d0b91,'resourceId':_0x3834f8['id']},'transaction':_0x4054bc})[_0x019f('0x1b')](function(){return _0x44b3a9;});})['then'](function(){_0x315749[_0x019f('0x13')](0xcc)[_0x019f('0x32')]();});}};}function handleEntityNotFound(_0x2f441a){return function(_0x5f5a67){if(!_0x5f5a67){_0x2f441a['sendStatus'](0x194);}return _0x5f5a67;};}function handleError(_0xcf0c68,_0x4de742){_0x4de742=_0x4de742||0x1f4;return function(_0xedc58a){logger[_0x019f('0x1f')](_0xedc58a['stack']);if(_0xedc58a[_0x019f('0x30')]){delete _0xedc58a[_0x019f('0x30')];}_0xcf0c68[_0x019f('0x13')](_0x4de742)[_0x019f('0x33')](_0xedc58a);};}function getUserAttributes(){return _(db['User'][_0x019f('0x34')])['map'](function(_0x29ea7b){return{'name':_0x29ea7b['fieldName'],'type':_0x29ea7b['type'][_0x019f('0x35')]};})[_0x019f('0x36')](function(_0x77b1d4){return![_0x019f('0x37'),_0x019f('0x38'),'previousPasswords',_0x019f('0x39'),_0x019f('0x3a'),_0x019f('0x3b')][_0x019f('0x3c')](_0x77b1d4[_0x019f('0x30')]);})[_0x019f('0x2e')]();}exports[_0x019f('0x3d')]=function(_0x1c73ca,_0x2c25d4){var _0x3f6631={},_0x1b99dc={'count':0x0,'rows':[]};var _0x2a35ca=getUserAttributes();_0x3f6631=qs[_0x019f('0x3e')](_0x2a35ca,_0x1c73ca);var _0x1f9e5f={'where':_0x3f6631['where']};return db[_0x019f('0x3f')][_0x019f('0x18')](_0x1f9e5f)['then'](function(_0x53cceb){_0x1b99dc[_0x019f('0x18')]=_0x53cceb;if(_0x1c73ca[_0x019f('0x40')][_0x019f('0x41')]){_0x3f6631['include']=[{'all':!![]}];}if(_0x1c73ca[_0x019f('0x40')][_0x019f('0x42')]===_0x019f('0x43')){_0x3f6631[_0x019f('0x44')]=[{'model':db[_0x019f('0x45')],'as':_0x019f('0x42')}];}if(!_[_0x019f('0x3c')](_0x3f6631[_0x019f('0x46')],'id')){_0x3f6631[_0x019f('0x46')][_0x019f('0x47')]('id');}return db['User']['findAll'](_0x3f6631);})[_0x019f('0x1b')](function(_0x4e7dc7){_0x1b99dc[_0x019f('0x48')]=_0x4e7dc7;if(_0x1c73ca[_0x019f('0x40')][_0x019f('0x49')]===_0x019f('0x43')){var _0x97842c=[];for(var _0x3fb219=0x0;_0x3fb219<_0x1b99dc[_0x019f('0x48')][_0x019f('0x4a')];_0x3fb219++){_0x97842c[_0x019f('0x47')](get_open_tabs(_0x019f('0x4b'),_0x1b99dc[_0x019f('0x48')][_0x3fb219][_0x019f('0x4c')]));_0x97842c[_0x019f('0x47')](get_open_tabs('sms',_0x1b99dc[_0x019f('0x48')][_0x3fb219][_0x019f('0x4c')]));_0x97842c[_0x019f('0x47')](get_open_tabs('fax',_0x1b99dc[_0x019f('0x48')][_0x3fb219][_0x019f('0x4c')]));_0x97842c[_0x019f('0x47')](get_open_tabs(_0x019f('0x4d'),_0x1b99dc[_0x019f('0x48')][_0x3fb219][_0x019f('0x4c')]));_0x97842c[_0x019f('0x47')](get_open_tabs(_0x019f('0x4e'),_0x1b99dc['rows'][_0x3fb219]['dataValues']));_0x97842c[_0x019f('0x47')](get_open_tabs('whatsapp',_0x1b99dc['rows'][_0x3fb219]['dataValues']));}return Promise[_0x019f('0x4f')](_0x97842c)[_0x019f('0x1b')](function(){return _0x1b99dc;});}else{return _0x1b99dc;}})[_0x019f('0x1b')](respondWithFilteredResult(_0x2c25d4,_0x3f6631))[_0x019f('0x22')](handleError(_0x2c25d4,null));};exports[_0x019f('0x50')]=function(_0x21da96,_0x6d4729){var _0x4bcd35=getUserAttributes();_0x21da96['query']['id']=_0x21da96[_0x019f('0x51')]['id'];var _0x772124=qs[_0x019f('0x3e')](_0x4bcd35,_0x21da96);if(_0x21da96['query'][_0x019f('0x41')]){_0x772124[_0x019f('0x44')]=[{'all':!![]}];}if(_0x21da96[_0x019f('0x40')][_0x019f('0x42')]===_0x019f('0x43')){_0x772124['include']=[{'model':db[_0x019f('0x45')],'as':_0x019f('0x42')}];}_0x772124=_[_0x019f('0x52')]({},_0x772124,_0x21da96[_0x019f('0x53')]);if(!_['includes'](_0x772124[_0x019f('0x46')],'id')){_0x772124[_0x019f('0x46')][_0x019f('0x47')]('id');}return db[_0x019f('0x3f')]['find'](_0x772124)['then'](handleEntityNotFound(_0x6d4729,null))[_0x019f('0x1b')](function(_0x1d0794){var _0x2115d0=[];values=_0x1d0794;if(_0x21da96[_0x019f('0x40')]['openTabs']===_0x019f('0x43')){_0x2115d0[_0x019f('0x47')](get_open_tabs('chat',_0x1d0794[_0x019f('0x4c')]));_0x2115d0[_0x019f('0x47')](get_open_tabs('sms',_0x1d0794['dataValues']));_0x2115d0[_0x019f('0x47')](get_open_tabs('openchannel',_0x1d0794[_0x019f('0x4c')]));_0x2115d0[_0x019f('0x47')](get_open_tabs('whatsapp',_0x1d0794[_0x019f('0x4c')]));_0x2115d0['push'](get_open_tabs('fax',_0x1d0794[_0x019f('0x4c')]));_0x2115d0[_0x019f('0x47')](get_open_tabs(_0x019f('0x4d'),_0x1d0794[_0x019f('0x4c')]));return Promise[_0x019f('0x4f')](_0x2115d0);}else{return values;}})[_0x019f('0x1b')](function(){return values;})['then'](respondWithResult(_0x6d4729,null))[_0x019f('0x22')](handleError(_0x6d4729,null));};exports[_0x019f('0x23')]=function(_0xc9400,_0x5bd0c5){if(_0xc9400[_0x019f('0x54')]['id']){delete _0xc9400[_0x019f('0x54')]['id'];}delete _0xc9400[_0x019f('0x54')][_0x019f('0x24')];return db['User'][_0x019f('0x2f')]({'where':{'id':_0xc9400['params']['id']}})['then'](handleEntityNotFound(_0x5bd0c5,null))[_0x019f('0x1b')](saveUpdates(_0xc9400[_0x019f('0x54')],null))['then'](respondWithResult(_0x5bd0c5,null))['catch'](handleError(_0x5bd0c5,null));};exports[_0x019f('0x55')]=function(_0x50498d,_0x108828){return db[_0x019f('0x3f')][_0x019f('0x55')]()[_0x019f('0x1b')](respondWithResult(_0x108828,null))[_0x019f('0x22')](handleError(_0x108828,null));};exports[_0x019f('0x56')]=function(_0x3e0b61,_0x3dc100){return db[_0x019f('0x3f')]['find']({'where':{'id':_0x3e0b61['params']['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x3dc100,null))['then'](function(_0x5e37bd){if(_0x5e37bd){return _0x5e37bd[_0x019f('0x56')](_0x3e0b61['body'][_0x019f('0x57')],_[_0x019f('0x58')](_0x3e0b61[_0x019f('0x54')],[_0x019f('0x57'),'id'])||{});}})[_0x019f('0x1b')](respondWithResult(_0x3dc100,null))[_0x019f('0x22')](handleError(_0x3dc100,null));};function validateUser(_0x9415f7){return new Promise(function(_0x573069,_0x3b6b90){if(_0x9415f7[_0x019f('0x59')])return _0x573069(_0x9415f7);return db[_0x019f('0x5a')][_0x019f('0x5b')](0x1)[_0x019f('0x1b')](function(_0x184f2f){if(_0x184f2f['securePassword'])authService[_0x019f('0x5c')](_0x9415f7['password']);db[_0x019f('0x3f')][_0x019f('0x5d')](_0x019f('0x59'))['then'](function(_0x27c690){if(_[_0x019f('0x5e')](_0x27c690)){_0x9415f7[_0x019f('0x59')]=_0x184f2f['min_internal']||0x1;return;}if(_[_0x019f('0x5e')](_0x184f2f[_0x019f('0x5f')])||_0x184f2f[_0x019f('0x5f')]===_0x27c690){_0x9415f7['internal']=_0x27c690+0x1;return;}if(_0x184f2f[_0x019f('0x5f')]>_0x27c690){_0x9415f7['internal']=_0x184f2f[_0x019f('0x5f')];return;}return db[_0x019f('0x60')][_0x019f('0x40')](_0x019f('0x61'),{'type':db['sequelize'][_0x019f('0x62')]['SELECT']})[_0x019f('0x1b')](function(_0x510b57){if(_0x510b57&&_0x510b57['length']){for(var _0x5022a7=0x0,_0x37756d=_0x510b57[_0x019f('0x4a')];_0x5022a7<_0x37756d&&_[_0x019f('0x5e')](_0x9415f7[_0x019f('0x59')]);_0x5022a7++){if(_0x184f2f[_0x019f('0x5f')]<=_0x510b57[_0x5022a7][_0x019f('0x63')]){_0x9415f7['internal']=_0x510b57[_0x5022a7]['from'];}else if(_0x184f2f[_0x019f('0x5f')]>_0x510b57[_0x5022a7][_0x019f('0x63')]&&_0x184f2f[_0x019f('0x5f')]<=_0x510b57[_0x5022a7]['to']){_0x9415f7['internal']=_0x184f2f[_0x019f('0x5f')];}}}if(_[_0x019f('0x5e')](_0x9415f7[_0x019f('0x59')])){_0x9415f7['internal']=_0x27c690+0x1;}return _0x573069(_0x9415f7);});});})[_0x019f('0x22')](function(_0x4c3102){_0x3b6b90(_0x4c3102);});});}function updateUser(_0x4c2743){return new Promise(function(_0xfd83a0,_0x2bb567){try{if(_0x4c2743[_0x019f('0x64')]){_0x4c2743[_0x019f('0x65')]=_0x4c2743['internal'];_0x4c2743[_0x019f('0x66')]={'mailbox':_0x4c2743['internal'],'password':_0x4c2743[_0x019f('0x37')],'fullname':_0x4c2743['fullname'],'email':_0x4c2743[_0x019f('0x67')]};}if(_0x4c2743[_0x019f('0x24')]===_0x019f('0x2a')){if(!_0x4c2743['permissions'])_0x4c2743['permissions']=['101','102',_0x019f('0x68'),_0x019f('0x69'),_0x019f('0x6a'),_0x019f('0x6b'),'105',_0x019f('0x6c'),_0x019f('0x6d'),_0x019f('0x6e'),_0x019f('0x6f'),_0x019f('0x70'),_0x019f('0x71'),'114',_0x019f('0x72')];}_0xfd83a0(_0x4c2743);}catch(_0x20ed95){_0x2bb567(_0x20ed95);}});}exports[_0x019f('0x73')]=function(_0x14fad1,_0x1a2e48){if(_0x14fad1[_0x019f('0x29')][_0x019f('0x24')]===_0x019f('0x2a'))throw new Error(_0x019f('0x74'));if(_0x14fad1[_0x019f('0x54')][_0x019f('0x24')]===_0x019f('0x29')&&_0x14fad1[_0x019f('0x29')][_0x019f('0x24')]!==_0x019f('0x27')){throw new Error(_0x019f('0x75'));}if(_0x14fad1[_0x019f('0x54')][_0x019f('0x24')]==='admin'&&_0x14fad1[_0x019f('0x29')][_0x019f('0x24')]!==_0x019f('0x27')){throw new Error(_0x019f('0x76'));}return licenseUtil[_0x019f('0x77')]([_0x14fad1[_0x019f('0x54')]])[_0x019f('0x1b')](function(){return validateUser(_0x14fad1[_0x019f('0x54')]);})[_0x019f('0x1b')](function(_0x4910e0){return updateUser(_0x4910e0)[_0x019f('0x1b')](function(_0x4a4507){if(_0x4a4507['role']===_0x019f('0x27')){_0x4a4507[_0x019f('0x78')]=_0x14fad1['user'][_0x019f('0x78')];delete _0x4a4507[_0x019f('0x79')];}return _0x4a4507;});})[_0x019f('0x1b')](function(_0x4e82cf){return db['User'][_0x019f('0x73')](_0x4e82cf,{'include':[{'model':db[_0x019f('0x66')],'as':_0x019f('0x66')}]});})[_0x019f('0x1b')](function(_0x5b7548){if(_0x14fad1[_0x019f('0x54')][_0x019f('0x24')]===_0x019f('0x29'))return _0x5b7548;if(_0x14fad1[_0x019f('0x29')][_0x019f('0x24')]!==_0x019f('0x29'))return _0x5b7548;return db[_0x019f('0x7a')][_0x019f('0x2f')]({'where':{'name':_0x5b7548[_0x019f('0x24')]==='agent'?_0x019f('0x7b'):_0x019f('0x2b'),'userProfileId':_0x14fad1['user'][_0x019f('0x79')]},'raw':!![]})[_0x019f('0x1b')](function(_0xf457ad){if(!_0xf457ad||_0xf457ad[_0x019f('0x7c')]!=0x0)return _0x5b7548;return db[_0x019f('0x31')]['create']({'name':_0x5b7548['name'],'resourceId':_0x5b7548['id'],'type':_0xf457ad[_0x019f('0x30')],'sectionId':_0xf457ad['id']},{})[_0x019f('0x1b')](function(){return _0x5b7548;});})[_0x019f('0x22')](function(_0x285acb){logger[_0x019f('0x1f')](_0x019f('0x7d'),_0x285acb);throw _0x285acb;});})[_0x019f('0x1b')](respondWithResult(_0x1a2e48,0xc9))[_0x019f('0x22')](handleError(_0x1a2e48,null));};exports[_0x019f('0x7e')]=function(_0x56addb,_0x49469a){var _0x4641ab=_0x56addb[_0x019f('0x54')];var _0x3e48a7=[];if(_0x56addb[_0x019f('0x29')][_0x019f('0x24')]==='agent')throw new Error(_0x019f('0x74'));if(_[_0x019f('0x7f')](_0x4641ab,['role','user'])&&_0x56addb[_0x019f('0x29')][_0x019f('0x24')]!==_0x019f('0x27')){throw new Error(_0x019f('0x75'));}if(_[_0x019f('0x7f')](_0x4641ab,[_0x019f('0x24'),_0x019f('0x27')])&&_0x56addb[_0x019f('0x29')][_0x019f('0x24')]!==_0x019f('0x27')){throw new Error(_0x019f('0x80'));}return licenseUtil[_0x019f('0x77')](_0x4641ab)[_0x019f('0x1b')](function(){return validateUser(_0x4641ab[0x0]);})['then'](function(){for(var _0x26a947=0x1;_0x26a947<_0x4641ab[_0x019f('0x4a')];_0x26a947++){var _0x355ffb=_0x4641ab[_0x26a947-0x1][_0x019f('0x59')];if(!_0x4641ab[_0x26a947][_0x019f('0x59')])_0x4641ab[_0x26a947][_0x019f('0x59')]=_0x355ffb+0x1;_0x3e48a7['push'](validateUser(_0x4641ab[_0x26a947]));}return Promise[_0x019f('0x4f')](_0x3e48a7);})[_0x019f('0x1b')](function(){_0x3e48a7=[];for(var _0x49dae9=0x0;_0x49dae9<_0x4641ab[_0x019f('0x4a')];_0x49dae9++){_0x3e48a7[_0x019f('0x47')](updateUser(_0x4641ab[_0x49dae9]));}return Promise[_0x019f('0x4f')](_0x3e48a7);})[_0x019f('0x1b')](function(){_0x3e48a7=_0x4641ab['map'](function(_0x29c905){return db[_0x019f('0x3f')]['create'](_0x29c905,{'include':[{'model':db[_0x019f('0x66')],'as':'VoiceMail'}]})[_0x019f('0x1b')](function(_0x527d88){_0x29c905['id']=_0x527d88['id'];return _0x29c905;});});return Promise['all'](_0x3e48a7);})[_0x019f('0x1b')](function(_0x2b2891){if(_0x56addb['body']['role']===_0x019f('0x29'))return _0x2b2891;if(_0x56addb[_0x019f('0x29')][_0x019f('0x24')]!=='user')return _0x2b2891;var _0x530ce2=_[_0x019f('0x7f')](_0x2b2891,function(_0x58a9f1){return _0x58a9f1[_0x019f('0x24')]==='agent'||_0x58a9f1[_0x019f('0x24')]===_0x019f('0x2c');});if(!_0x530ce2)return _0x2b2891;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x019f('0x7b'),'Telephones']},'userProfileId':_0x56addb[_0x019f('0x29')][_0x019f('0x79')]},'raw':!![]})['then'](function(_0xb49cc2){if(_['isEmpty'](_0xb49cc2)||!_[_0x019f('0x7f')](_0xb49cc2,[_0x019f('0x7c'),0x0]))return _0x2b2891;_0x3e48a7=[];var _0x2d528b=_(_0xb49cc2)[_0x019f('0x81')](function(_0x2fb506){if(_0x2fb506[_0x019f('0x7c')]===0x1)return;return _0x2fb506[_0x019f('0x30')]===_0x019f('0x7b')?'agent':'telephone';})['compact']()[_0x019f('0x2e')]();for(var _0x2d6e38=0x0;_0x2d6e38<_0x2b2891[_0x019f('0x4a')];_0x2d6e38++){if(!_[_0x019f('0x3c')](_0x2d528b,_0x2b2891[_0x2d6e38]['role']))return;var _0x1ef59d=_0x2b2891[_0x2d6e38][_0x019f('0x24')]==='agent'?_0x019f('0x7b'):_0x019f('0x2b');_0x3e48a7[_0x019f('0x47')](db[_0x019f('0x31')]['create']({'name':_0x2b2891[_0x2d6e38][_0x019f('0x30')],'resourceId':_0x2b2891[_0x2d6e38]['id'],'type':_0x1ef59d,'sectionId':_['find'](_0xb49cc2,['name',_0x1ef59d])['id']},{}));}return Promise[_0x019f('0x4f')](_0x3e48a7);});})[_0x019f('0x1b')](respondWithResult(_0x49469a,0xc9))[_0x019f('0x22')](handleError(_0x49469a,null));};exports[_0x019f('0x82')]=function(_0x30d3e5,_0x38fff3){if(_0x30d3e5[_0x019f('0x54')]['id']){delete _0x30d3e5[_0x019f('0x54')]['id'];}return db[_0x019f('0x3f')]['find']({'where':{'id':_0x30d3e5[_0x019f('0x51')]['id']}})[_0x019f('0x1b')](function(_0x1febee){if(!_0x1febee)return null;if(_0x1febee['id']===_0x30d3e5['user']['id']){if(!_0x30d3e5[_0x019f('0x54')][_0x019f('0x83')]||!_0x30d3e5['body'][_0x019f('0x84')]){throw new db[(_0x019f('0x85'))][(_0x019f('0x86'))](_0x019f('0x87'));}if(!_0x1febee['authenticate'](_0x30d3e5[_0x019f('0x54')]['oldPassword'])){throw new db[(_0x019f('0x85'))][(_0x019f('0x86'))](_0x019f('0x88'));}if(_0x30d3e5[_0x019f('0x54')][_0x019f('0x83')]===_0x30d3e5['body'][_0x019f('0x84')]){throw new db[(_0x019f('0x85'))][(_0x019f('0x86'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x30d3e5[_0x019f('0x29')][_0x019f('0x24')]===_0x019f('0x27')){if(!_0x30d3e5[_0x019f('0x54')]['newPassword']){throw new db[(_0x019f('0x85'))][(_0x019f('0x86'))](_0x019f('0x89'));}}else if(_0x30d3e5[_0x019f('0x29')]['role']===_0x019f('0x29')){if(!_0x30d3e5[_0x019f('0x54')][_0x019f('0x84')]){throw new db[(_0x019f('0x85'))][(_0x019f('0x86'))](_0x019f('0x89'));}if(_0x1febee[_0x019f('0x24')]!==_0x019f('0x2a')){throw new db['Sequelize']['ValidationError'](_0x019f('0x74'));}}else{throw new db[(_0x019f('0x85'))][(_0x019f('0x86'))](_0x019f('0x74'));}return _0x1febee;})[_0x019f('0x1b')](handleEntityNotFound(_0x38fff3,null))[_0x019f('0x1b')](function(_0x15c8ee){return db[_0x019f('0x5a')]['findOne']({'attributes':['id',_0x019f('0x8a'),_0x019f('0x8b'),_0x019f('0x8c')]})[_0x019f('0x1b')](function(_0x429bca){if(_0x429bca[_0x019f('0x8a')])authService[_0x019f('0x5c')](_0x30d3e5[_0x019f('0x54')]['newPassword']);if(!_0x429bca[_0x019f('0x8b')]||!_0x15c8ee['previousPasswords'])return _0x15c8ee;authService['validatePasswordHistory'](_0x30d3e5[_0x019f('0x54')]['newPassword'],_0x15c8ee['previousPasswords'],_0x429bca[_0x019f('0x8c')]);return _0x15c8ee;})[_0x019f('0x1b')](saveUpdates({'password':_0x30d3e5['body']['newPassword'],'passwordResetAt':_0x30d3e5[_0x019f('0x29')]['id']==_0x30d3e5['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x30d3e5[_0x019f('0x54')][_0x019f('0x84')],_0x15c8ee['previousPasswords'])},null));})[_0x019f('0x1b')](respondWithResult(_0x38fff3,null))[_0x019f('0x22')](handleError(_0x38fff3,null));};exports['addQueues']=function(_0x28d2d5,_0xbc396d){var _0x182087=_0x28d2d5[_0x019f('0x54')][_0x019f('0x8d')];return db[_0x019f('0x3f')][_0x019f('0x2f')]({'where':{'id':_0x28d2d5[_0x019f('0x51')]['id']},'attributes':['id','name',_0x019f('0x24'),_0x019f('0x8e'),_0x019f('0x8f'),_0x019f('0x90'),_0x019f('0x91')]})[_0x019f('0x1b')](handleEntityNotFound(_0xbc396d,null))[_0x019f('0x1b')](function(_0x54c52c){if(_0x54c52c){if(!utils[_0x019f('0x92')](_0x182087)){throw new db['Sequelize']['ValidationError'](_0x019f('0x93'));}return _0x54c52c[_0x019f('0x94')+_[_0x019f('0x95')](_0x182087[_0x019f('0x96')]())+_0x019f('0x97')](_0x28d2d5[_0x019f('0x54')][_0x019f('0x57')],{'penalty':_0x28d2d5[_0x019f('0x54')][_0x019f('0x98')]||0x0})['spread'](function(_0x369561){for(var _0x2f8a21=0x0;_0x2f8a21<_0x28d2d5[_0x019f('0x54')]['ids'][_0x019f('0x4a')];_0x2f8a21+=0x1){var _0x4f535a={'UserId':Number(_0x28d2d5[_0x019f('0x51')]['id'])};_0x4f535a[_[_0x019f('0x95')](_0x182087[_0x019f('0x96')]())+_0x019f('0x99')]=Number(_0x28d2d5['body'][_0x019f('0x57')][_0x2f8a21]);socket['emit']('user'+_[_0x019f('0x95')](_0x182087['toLowerCase']())+_0x019f('0x9a'),_0x4f535a);}return _0x369561;})['then'](function(){if(_0x182087===_0x019f('0x9b')){return db[_0x019f('0x9c')]['findAll']({'where':{'id':_0x28d2d5[_0x019f('0x54')][_0x019f('0x57')]||[]},'raw':!![],'attributes':['id',_0x019f('0x30')]});}})[_0x019f('0x1b')](function(_0x243d38){var _0x4771fd=_0x54c52c[_0x019f('0x9d')]({'plain':!![]});var _0x115011=[];if(_0x182087==='voice'&&_0x4771fd[_0x019f('0x24')]==='agent'&&_0x4771fd[_0x019f('0x8e')]){for(let _0xebab1a=0x0;_0xebab1a<_0x243d38[_0x019f('0x4a')];_0xebab1a+=0x1){_0x115011[_0x019f('0x47')]({'membername':_0x4771fd['name'],'UserId':_0x4771fd['id'],'queue_name':_0x243d38[_0xebab1a][_0x019f('0x30')],'VoiceQueueId':_0x243d38[_0xebab1a]['id'],'interface':_[_0x019f('0x5e')](_0x4771fd[_0x019f('0x91')])?util[_0x019f('0x9e')](_0x019f('0x9f'),_0x4771fd[_0x019f('0x30')]):_0x4771fd['interface'],'paused':_0x4771fd[_0x019f('0x90')]||![],'penalty':_0x28d2d5['body'][_0x019f('0x98')]||0x0});}return Promise[_0x019f('0x4f')](_0x115011['map'](function(_0x2cb7f4){return db[_0x019f('0xa0')]['upsert'](_0x2cb7f4);}));}return _0x54c52c;});}})[_0x019f('0x1b')](respondWithStatusCode(_0xbc396d,null))[_0x019f('0x22')](handleError(_0xbc396d,null));};exports[_0x019f('0xa1')]=function(_0x276324,_0x2fc45e){var _0x3ff34f,_0x10ba8a;return db['User'][_0x019f('0x2f')]({'where':{'id':_0x276324[_0x019f('0x51')]['id']},'attributes':['id','name',_0x019f('0x24')]})[_0x019f('0x1b')](handleEntityNotFound(_0x2fc45e,null))[_0x019f('0x1b')](function(_0x57709b){if(_0x57709b){_0x3ff34f=_0x57709b;if(!_0x276324[_0x019f('0x40')][_0x019f('0x8d')]||!utils[_0x019f('0x92')](_0x276324['query'][_0x019f('0x8d')])){throw new db[(_0x019f('0x85'))][(_0x019f('0x86'))](_0x019f('0x93'));}return _0x57709b[_0x019f('0xa2')+_['capitalize'](_0x276324[_0x019f('0x40')][_0x019f('0x8d')][_0x019f('0x96')]())+'Queues'](_0x276324[_0x019f('0x40')][_0x019f('0x57')]);}})[_0x019f('0x1b')](function(_0x3e2416){if(_[_0x019f('0xa3')](_0x276324[_0x019f('0x40')][_0x019f('0x57')])){for(var _0x490ca1=0x0;_0x490ca1<_0x276324[_0x019f('0x40')][_0x019f('0x57')][_0x019f('0x4a')];_0x490ca1+=0x1){_0x10ba8a={'UserId':Number(_0x276324[_0x019f('0x51')]['id'])};_0x10ba8a[_[_0x019f('0x95')](_0x276324[_0x019f('0x40')][_0x019f('0x8d')][_0x019f('0x96')]())+'QueueId']=Number(_0x276324[_0x019f('0x40')][_0x019f('0x57')][_0x490ca1]);socket[_0x019f('0x25')]('user'+_[_0x019f('0x95')](_0x276324['query'][_0x019f('0x8d')][_0x019f('0x96')]())+_0x019f('0xa4'),_0x10ba8a);}}else{_0x10ba8a={'UserId':Number(_0x276324[_0x019f('0x51')]['id'])};_0x10ba8a[_[_0x019f('0x95')](_0x276324['query'][_0x019f('0x8d')]['toLowerCase']())+'QueueId']=Number(_0x276324['query'][_0x019f('0x57')]);socket[_0x019f('0x25')]('user'+_[_0x019f('0x95')](_0x276324['query'][_0x019f('0x8d')]['toLowerCase']())+_0x019f('0xa4'),_0x10ba8a);}return _0x3e2416;})[_0x019f('0x1b')](function(){if(_0x276324[_0x019f('0x40')][_0x019f('0x8d')]===_0x019f('0x9b')){return db[_0x019f('0xa0')][_0x019f('0x26')]({'where':{'UserId':_0x276324['params']['id'],'VoiceQueueId':_0x276324['query'][_0x019f('0x57')]},'individualHooks':!![]})[_0x019f('0x1b')](function(){return _0x3ff34f;});}return _0x3ff34f;})[_0x019f('0x1b')](respondWithStatusCode(_0x2fc45e,null))[_0x019f('0x22')](handleError(_0x2fc45e,null));};exports[_0x019f('0xa5')]=function(_0x54926d,_0x250e2f){_0x54926d['body'][_0x019f('0xa6')]=_0x54926d['file'][_0x019f('0xa7')];return db['User'][_0x019f('0x2f')]({'where':{'id':_0x54926d[_0x019f('0x51')]['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x250e2f,null))['then'](saveUpdates(_0x54926d[_0x019f('0x54')],null))[_0x019f('0x1b')](respondWithResult(_0x250e2f,null))[_0x019f('0x22')](handleError(_0x250e2f,null));};exports[_0x019f('0xa8')]=function(_0x5a1e4d,_0x17609d){var _0x8b7b0e=path[_0x019f('0xa9')](config[_0x019f('0xaa')],_0x019f('0xab'));return db[_0x019f('0x3f')][_0x019f('0x2f')]({'where':{'id':_0x5a1e4d[_0x019f('0x51')]['id']},'attributes':['id',_0x019f('0xa6')],'raw':!![]})[_0x019f('0x1b')](handleEntityNotFound(_0x17609d,null))[_0x019f('0x1b')](function(_0x3e306e){if(_0x3e306e){if(_[_0x019f('0x5e')](_0x3e306e[_0x019f('0xa6')])){return _0x17609d[_0x019f('0xac')](_0x8b7b0e);}else{if(!fs[_0x019f('0xad')](path[_0x019f('0xa9')](config['root'],_0x019f('0xae'),_0x3e306e[_0x019f('0xa6')]))){return _0x17609d[_0x019f('0xac')](_0x8b7b0e);}return _0x17609d[_0x019f('0xac')](path[_0x019f('0xa9')](config[_0x019f('0xaa')],'server/files/images/',_0x3e306e[_0x019f('0xa6')]));}}})['catch'](handleError(_0x17609d,null));};exports[_0x019f('0xaf')]=function(_0x3440e0,_0x40a127){return db[_0x019f('0x3f')]['find']({'where':{'id':_0x3440e0[_0x019f('0x51')]['id']},'attributes':['id']})[_0x019f('0x1b')](handleEntityNotFound(_0x40a127,null))[_0x019f('0x1b')](function(_0x3a6bf0){var _0x39c635=[];values=_0x3a6bf0[_0x019f('0x4c')];_0x39c635[_0x019f('0x47')](get_open_tabs(_0x019f('0x4b'),_0x3a6bf0['dataValues']));_0x39c635[_0x019f('0x47')](get_open_tabs(_0x019f('0xb0'),_0x3a6bf0[_0x019f('0x4c')]));_0x39c635[_0x019f('0x47')](get_open_tabs(_0x019f('0x4e'),_0x3a6bf0[_0x019f('0x4c')]));_0x39c635[_0x019f('0x47')](get_open_tabs(_0x019f('0xb1'),_0x3a6bf0[_0x019f('0x4c')]));_0x39c635[_0x019f('0x47')](get_open_tabs('fax',_0x3a6bf0['dataValues']));_0x39c635[_0x019f('0x47')](get_open_tabs('mail',_0x3a6bf0[_0x019f('0x4c')]));return Promise[_0x019f('0x4f')](_0x39c635);})[_0x019f('0x1b')](function(_0x266e16){if(_0x266e16){var _0x41b8b5=_[_0x019f('0x81')](values[_0x019f('0xb2')],function(_0x92948){return{'channel':_0x019f('0xb3'),'id':_0x92948['id'],'createdAt':_0x92948[_0x019f('0xb4')]};});var _0x40d5e5=_[_0x019f('0x81')](values[_0x019f('0xb5')],function(_0x28c727){return{'channel':_0x019f('0xb6'),'id':_0x28c727['id'],'createdAt':_0x28c727['createdAt']};});var _0x48fb32=_['map'](values['OpenchannelOpenTabs'],function(_0x141216){return{'channel':_0x019f('0xb7'),'id':_0x141216['id'],'createdAt':_0x141216['createdAt']};});var _0x25496b=_[_0x019f('0x81')](values[_0x019f('0xb8')],function(_0xf35a67){return{'channel':_0x019f('0xb9'),'id':_0xf35a67['id'],'createdAt':_0xf35a67[_0x019f('0xb4')]};});var _0x16b2ad=_[_0x019f('0x81')](values['SmsOpenTabs'],function(_0x3d94f5){return{'channel':'SMS','id':_0x3d94f5['id'],'createdAt':_0x3d94f5[_0x019f('0xb4')]};});var _0x50b59a=_[_0x019f('0x81')](values[_0x019f('0xba')],function(_0x218636){return{'channel':_0x019f('0xbb'),'id':_0x218636['id'],'createdAt':_0x218636['createdAt']};});var _0x1832b5=_[_0x019f('0xbc')](_0x41b8b5,_0x40d5e5,_0x48fb32,_0x25496b,_0x16b2ad,_0x50b59a);var _0x3f881d={'count':_0x1832b5[_0x019f('0x4a')],'rows':_0x1832b5};return _0x3f881d;}else return null;})[_0x019f('0x1b')](respondWithResult(_0x40a127,null))[_0x019f('0x22')](handleError(_0x40a127,null));};exports[_0x019f('0xbd')]=function(_0x5b1a5c,_0x208672){var _0x536194={};return db[_0x019f('0x3f')]['findOne']({'where':{'id':_0x5b1a5c[_0x019f('0x51')]['id']}})[_0x019f('0x1b')](function(_0x2fb109){if(!_0x2fb109){throw new APINotFoundError(util[_0x019f('0x9e')](_0x019f('0xbe'),_0x5b1a5c['params']['id']));}return contacts[_0x019f('0x55')]();})[_0x019f('0x1b')](function(_0x375ab1){_0x5b1a5c[_0x019f('0x40')][_0x019f('0x3f')]=_0x5b1a5c['params']['id'];_0x536194=qs[_0x019f('0x3e')](_0x375ab1,_0x5b1a5c);if(_0x5b1a5c[_0x019f('0x40')][_0x019f('0xbf')](_0x019f('0x41'))){_0x536194['include']=[{'model':db[_0x019f('0xc0')],'as':_0x019f('0xc1'),'required':![]},{'model':db[_0x019f('0xc2')],'as':_0x019f('0xc3'),'attributes':['id','name',_0x019f('0xc4')],'where':_0x5b1a5c['query'][_0x019f('0xc5')]?{'id':_0x5b1a5c[_0x019f('0x40')][_0x019f('0xc5')]}:undefined,'required':_0x5b1a5c[_0x019f('0x40')][_0x019f('0xc5')]?!![]:![]}];}return contacts[_0x019f('0xc6')](_0x5b1a5c['query'],_0x5b1a5c['user'],_0x536194,_0x375ab1);})[_0x019f('0x1b')](respondWithFilteredResult(_0x208672,_0x536194))[_0x019f('0x22')](APIHandleError(_0x208672));};exports['getQueues']=function(_0x7147fc,_0x2aa703){var _0x5d0a93;var _0x34f798={};var _0xcbad75;return db[_0x019f('0x3f')][_0x019f('0xc7')]({'where':{'id':_0x7147fc[_0x019f('0x51')]['id']},'attributes':['id',_0x019f('0x30'),_0x019f('0x24')]})[_0x019f('0x1b')](handleEntityNotFound(_0x2aa703,null))[_0x019f('0x1b')](function(_0x169675){if(!utils[_0x019f('0x92')](_0x7147fc[_0x019f('0x40')][_0x019f('0x8d')])){throw new db['Sequelize'][(_0x019f('0x86'))]('Unknown\x20channel');}_0x5d0a93=_0x169675;var _0x37e7e4={};_0x37e7e4[_0x019f('0xc8')]=_['keys'](db[_['capitalize'](_0x7147fc[_0x019f('0x40')][_0x019f('0x8d')])+_0x019f('0xc9')][_0x019f('0x34')]);_0x37e7e4[_0x019f('0x40')]=_[_0x019f('0xca')](_0x7147fc[_0x019f('0x40')]);_0x37e7e4[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x37e7e4[_0x019f('0xc8')],_0x37e7e4[_0x019f('0x40')]);_0x34f798[_0x019f('0x46')]=_[_0x019f('0xcc')](_0x37e7e4[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x7147fc[_0x019f('0x40')][_0x019f('0xcd')]));_0x34f798[_0x019f('0x46')]=_0x34f798[_0x019f('0x46')][_0x019f('0x4a')]?_0x34f798[_0x019f('0x46')]:_0x37e7e4[_0x019f('0xc8')];_0x34f798[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x7147fc['query'][_0x019f('0xcf')]);_0x34f798[_0x019f('0xd0')]=qs['filters'](_['pick'](_0x7147fc[_0x019f('0x40')],_0x37e7e4[_0x019f('0xcb')]));if(_0x7147fc[_0x019f('0x40')][_0x019f('0x36')]){_0x34f798['where']=_[_0x019f('0x52')](_0x34f798['where'],{'$or':_[_0x019f('0x81')](_0x34f798[_0x019f('0x46')],function(_0x5f1a58){var _0x9f6aff={};_0x9f6aff[_0x5f1a58]={'$like':'%'+_0x7147fc[_0x019f('0x40')][_0x019f('0x36')]+'%'};return _0x9f6aff;})});}_0x34f798=_['merge']({},_0x34f798,_0x7147fc[_0x019f('0x53')]);switch(_0x5d0a93[_0x019f('0x24')]){case _0x019f('0x27'):return db[_['capitalize'](_0x7147fc[_0x019f('0x40')]['channel'])+_0x019f('0xc9')][_0x019f('0xc6')](_0x34f798);case _0x019f('0x29'):case _0x019f('0x2a'):return _0x5d0a93[_0x019f('0x9d')+_[_0x019f('0x95')](_0x7147fc[_0x019f('0x40')][_0x019f('0x8d')])+_0x019f('0x97')](_0x34f798);default:throw new db[(_0x019f('0x85'))]['ValidationError'](_0x019f('0xd1'));}})[_0x019f('0x1b')](function(_0x16fbea){_0xcbad75=_0x16fbea[_0x019f('0x4a')];if(!_0x7147fc['query']['hasOwnProperty'](_0x019f('0xd2'))){_0x34f798[_0x019f('0x17')]=qs[_0x019f('0x17')](_0x7147fc[_0x019f('0x40')][_0x019f('0x17')]);_0x34f798[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x7147fc[_0x019f('0x40')][_0x019f('0x15')]);}switch(_0x5d0a93[_0x019f('0x24')]){case _0x019f('0x27'):return db[_[_0x019f('0x95')](_0x7147fc[_0x019f('0x40')][_0x019f('0x8d')])+_0x019f('0xc9')][_0x019f('0xc6')](_0x34f798);case _0x019f('0x29'):case'agent':return _0x5d0a93[_0x019f('0x9d')+_['capitalize'](_0x7147fc[_0x019f('0x40')]['channel'])+_0x019f('0x97')](_0x34f798);}})[_0x019f('0x1b')](function(_0x156049){return{'count':_0xcbad75,'rows':_0x156049};})[_0x019f('0x1b')](respondWithResult(_0x2aa703,null))[_0x019f('0x22')](handleError(_0x2aa703,null));};exports[_0x019f('0xd3')]=function(_0x55e376,_0xca59b9){var _0x423239={};var _0x17f6fd={};var _0x10ee38;var _0x19b435;return db[_0x019f('0x3f')][_0x019f('0xc7')]({'where':{'id':_0x55e376[_0x019f('0x51')]['id']}})['then'](handleEntityNotFound(_0xca59b9,null))['then'](function(_0x23bfd6){if(_0x23bfd6){_0x10ee38=_0x23bfd6;_0x17f6fd[_0x019f('0xc8')]=_[_0x019f('0xca')](db[_0x019f('0xa0')][_0x019f('0x34')]);_0x17f6fd['query']=_[_0x019f('0xca')](_0x55e376['query']);_0x17f6fd[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x17f6fd['model'],_0x17f6fd[_0x019f('0x40')]);_0x423239[_0x019f('0x46')]=_[_0x019f('0xcc')](_0x17f6fd['model'],qs[_0x019f('0xcd')](_0x55e376[_0x019f('0x40')][_0x019f('0xcd')]));_0x423239[_0x019f('0x46')]=_0x423239[_0x019f('0x46')]['length']?_0x423239[_0x019f('0x46')]:_0x17f6fd[_0x019f('0xc8')];_0x423239[_0x019f('0xce')]=qs['sort'](_0x55e376[_0x019f('0x40')][_0x019f('0xcf')]);_0x423239[_0x019f('0xd0')]=qs[_0x019f('0xcb')](_['pick'](_0x55e376[_0x019f('0x40')],_0x17f6fd[_0x019f('0xcb')]));if(_0x55e376[_0x019f('0x40')][_0x019f('0x36')]){_0x423239[_0x019f('0xd0')]=_[_0x019f('0x52')](_0x423239[_0x019f('0xd0')],{'$or':_[_0x019f('0x81')](_0x423239[_0x019f('0x46')],function(_0x4211c1){var _0x4a2e3a={};_0x4a2e3a[_0x4211c1]={'$like':'%'+_0x55e376['query']['filter']+'%'};return _0x4a2e3a;})});}_0x423239=_[_0x019f('0x52')]({},_0x423239,_0x55e376[_0x019f('0x53')]);return _0x10ee38[_0x019f('0xd3')](_0x423239);}})[_0x019f('0x1b')](function(_0x492110){if(_0x492110){_0x19b435=_0x492110['length'];if(!_0x55e376['query']['hasOwnProperty'](_0x019f('0xd2'))){_0x423239[_0x019f('0x17')]=qs[_0x019f('0x17')](_0x55e376[_0x019f('0x40')][_0x019f('0x17')]);_0x423239[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x55e376[_0x019f('0x40')][_0x019f('0x15')]);}return _0x10ee38['getVoiceQueuesRt'](_0x423239);}})[_0x019f('0x1b')](function(_0x2f73d1){if(_0x2f73d1){return _0x2f73d1?{'count':_0x19b435,'rows':_0x2f73d1}:null;}})['then'](respondWithResult(_0xca59b9,null))[_0x019f('0x22')](handleError(_0xca59b9,null));};exports['getGroups']=function(_0x526a7a,_0x40909b){var _0x58b321={};var _0x2b0e55={};var _0xeae55f;var _0x36a63a;return db[_0x019f('0x3f')]['findOne']({'where':{'id':_0x526a7a[_0x019f('0x51')]['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x40909b,null))['then'](function(_0xc941bb){if(_0xc941bb){_0xeae55f=_0xc941bb;_0x2b0e55[_0x019f('0xc8')]=_['keys'](db['ChatGroup'][_0x019f('0x34')]);_0x2b0e55[_0x019f('0x40')]=_['keys'](_0x526a7a[_0x019f('0x40')]);_0x2b0e55[_0x019f('0xcb')]=_['intersection'](_0x2b0e55[_0x019f('0xc8')],_0x2b0e55[_0x019f('0x40')]);_0x58b321[_0x019f('0x46')]=_[_0x019f('0xcc')](_0x2b0e55[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x526a7a[_0x019f('0x40')]['fields']));_0x58b321[_0x019f('0x46')]=_0x58b321[_0x019f('0x46')][_0x019f('0x4a')]?_0x58b321['attributes']:_0x2b0e55[_0x019f('0xc8')];_0x58b321['order']=qs[_0x019f('0xcf')](_0x526a7a[_0x019f('0x40')][_0x019f('0xcf')]);_0x58b321[_0x019f('0xd0')]=qs['filters'](_[_0x019f('0xd4')](_0x526a7a[_0x019f('0x40')],_0x2b0e55[_0x019f('0xcb')]));if(_0x526a7a[_0x019f('0x40')][_0x019f('0x36')]){_0x58b321[_0x019f('0xd0')]=_['merge'](_0x58b321[_0x019f('0xd0')],{'$or':_['map'](_0x58b321[_0x019f('0x46')],function(_0x1ac956){var _0x459092={};_0x459092[_0x1ac956]={'$like':'%'+_0x526a7a['query'][_0x019f('0x36')]+'%'};return _0x459092;})});}_0x58b321=_[_0x019f('0x52')]({},_0x58b321,_0x526a7a[_0x019f('0x53')]);return _0xeae55f[_0x019f('0xd5')](_0x58b321);}})['then'](function(_0x2c6db6){if(_0x2c6db6){_0x36a63a=_0x2c6db6[_0x019f('0x4a')];if(!_0x526a7a[_0x019f('0x40')][_0x019f('0xbf')](_0x019f('0xd2'))){_0x58b321[_0x019f('0x17')]=qs['limit'](_0x526a7a['query'][_0x019f('0x17')]);_0x58b321['offset']=qs[_0x019f('0x15')](_0x526a7a[_0x019f('0x40')][_0x019f('0x15')]);}return _0xeae55f[_0x019f('0xd5')](_0x58b321);}})[_0x019f('0x1b')](function(_0x3892ca){if(_0x3892ca){return _0x3892ca?{'count':_0x36a63a,'rows':_0x3892ca}:null;}})[_0x019f('0x1b')](respondWithResult(_0x40909b,null))['catch'](handleError(_0x40909b,null));};exports['getRecordings']=function(_0x29d3ca,_0x3676b2){var _0x2bb395={'raw':!![],'where':{}};var _0x1f92b3={};var _0x51973a={'count':0x0,'rows':[]};return db[_0x019f('0x3f')][_0x019f('0xc7')]({'where':{'id':_0x29d3ca['params']['id']}})['then'](handleEntityNotFound(_0x3676b2,null))[_0x019f('0x1b')](function(_0x5345a2){if(_0x5345a2){_0x1f92b3[_0x019f('0xc8')]=_['keys'](db['VoiceRecording'][_0x019f('0x34')]);_0x1f92b3[_0x019f('0x40')]=_['keys'](_0x29d3ca[_0x019f('0x40')]);_0x1f92b3[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x1f92b3['model'],_0x1f92b3['query']);_0x2bb395[_0x019f('0x46')]=_['intersection'](_0x1f92b3[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x29d3ca[_0x019f('0x40')][_0x019f('0xcd')]));_0x2bb395[_0x019f('0x46')]=_0x2bb395[_0x019f('0x46')][_0x019f('0x4a')]?_0x2bb395[_0x019f('0x46')]:_0x1f92b3[_0x019f('0xc8')];if(!_0x29d3ca[_0x019f('0x40')]['hasOwnProperty']('nolimit')){_0x2bb395[_0x019f('0x17')]=qs[_0x019f('0x17')](_0x29d3ca[_0x019f('0x40')]['limit']);_0x2bb395[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x29d3ca[_0x019f('0x40')][_0x019f('0x15')]);}_0x2bb395['order']=qs[_0x019f('0xcf')](_0x29d3ca[_0x019f('0x40')][_0x019f('0xcf')]);_0x2bb395[_0x019f('0xd0')]=qs[_0x019f('0xcb')](_[_0x019f('0xd4')](_0x29d3ca[_0x019f('0x40')],_0x1f92b3[_0x019f('0xcb')]));_0x2bb395[_0x019f('0xd0')][_0x019f('0xd6')]=_0x5345a2['id'];if(_0x29d3ca[_0x019f('0x40')][_0x019f('0x36')]){_0x2bb395[_0x019f('0xd0')]=_[_0x019f('0x52')](_0x2bb395[_0x019f('0xd0')],{'$or':_[_0x019f('0x81')](_0x2bb395[_0x019f('0x46')],function(_0x53b5c7){var _0x911193={};_0x911193[_0x53b5c7]={'$like':'%'+_0x29d3ca[_0x019f('0x40')]['filter']+'%'};return _0x911193;})});}_0x2bb395=_[_0x019f('0x52')]({},_0x2bb395,_0x29d3ca['options']);return db[_0x019f('0xd7')]['count']({'where':_0x2bb395['where']})[_0x019f('0x1b')](function(_0x44655f){_0x51973a['count']=_0x44655f;if(_0x29d3ca[_0x019f('0x40')][_0x019f('0x41')]){_0x2bb395[_0x019f('0x44')]=[{'all':!![]}];}return db[_0x019f('0xd7')][_0x019f('0xc6')](_0x2bb395);})[_0x019f('0x1b')](function(_0x383b91){_0x51973a[_0x019f('0x48')]=_0x383b91;return _0x51973a;});}})[_0x019f('0x1b')](respondWithFilteredResult(_0x3676b2,_0x2bb395))[_0x019f('0x22')](handleError(_0x3676b2,null));};exports['getScreenRecordings']=function(_0x4f8215,_0x52f9a7){var _0x4198ef={'raw':!![],'where':{}};var _0x17ea73={};var _0x1f531d={'count':0x0,'rows':[]};return db[_0x019f('0x3f')][_0x019f('0xc7')]({'where':{'id':_0x4f8215['params']['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x52f9a7,null))[_0x019f('0x1b')](function(_0x242c87){if(_0x242c87){_0x17ea73[_0x019f('0xc8')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x17ea73[_0x019f('0x40')]=_[_0x019f('0xca')](_0x4f8215[_0x019f('0x40')]);_0x17ea73[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x17ea73[_0x019f('0xc8')],_0x17ea73['query']);_0x4198ef[_0x019f('0x46')]=_['intersection'](_0x17ea73['model'],qs[_0x019f('0xcd')](_0x4f8215[_0x019f('0x40')][_0x019f('0xcd')]));_0x4198ef[_0x019f('0x46')]=_0x4198ef[_0x019f('0x46')]['length']?_0x4198ef['attributes']:_0x17ea73[_0x019f('0xc8')];if(!_0x4f8215['query']['hasOwnProperty']('nolimit')){_0x4198ef[_0x019f('0x17')]=qs['limit'](_0x4f8215[_0x019f('0x40')][_0x019f('0x17')]);_0x4198ef[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x4f8215[_0x019f('0x40')][_0x019f('0x15')]);}_0x4198ef[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x4f8215[_0x019f('0x40')][_0x019f('0xcf')]);_0x4198ef[_0x019f('0xd0')]=qs[_0x019f('0xcb')](_[_0x019f('0xd4')](_0x4f8215[_0x019f('0x40')],_0x17ea73[_0x019f('0xcb')]));_0x4198ef[_0x019f('0xd0')][_0x019f('0xd6')]=_0x242c87['id'];if(_0x4f8215[_0x019f('0x40')][_0x019f('0x36')]){_0x4198ef[_0x019f('0xd0')]=_[_0x019f('0x52')](_0x4198ef['where'],{'$or':_[_0x019f('0x81')](_0x4198ef[_0x019f('0x46')],function(_0xbdcdc4){var _0x38768b={};_0x38768b[_0xbdcdc4]={'$like':'%'+_0x4f8215[_0x019f('0x40')][_0x019f('0x36')]+'%'};return _0x38768b;})});}_0x4198ef=_[_0x019f('0x52')]({},_0x4198ef,_0x4f8215['options']);return db[_0x019f('0xd8')][_0x019f('0x18')]({'where':_0x4198ef[_0x019f('0xd0')]})[_0x019f('0x1b')](function(_0x512d6b){_0x1f531d[_0x019f('0x18')]=_0x512d6b;if(_0x4f8215[_0x019f('0x40')][_0x019f('0x41')]){_0x4198ef[_0x019f('0x44')]=[{'all':!![]}];}return db[_0x019f('0xd8')]['findAll'](_0x4198ef);})[_0x019f('0x1b')](function(_0x4dcbeb){_0x1f531d[_0x019f('0x48')]=_0x4dcbeb;return _0x1f531d;});}})[_0x019f('0x1b')](respondWithFilteredResult(_0x52f9a7,_0x4198ef))['catch'](handleError(_0x52f9a7,null));};exports['getChatInteractions']=function(_0x1bd900,_0x334129){var _0x125202={};var _0x59aac0={};var _0x4d0bef;var _0x588717;return db[_0x019f('0x3f')]['findOne']({'where':{'id':_0x1bd900['params']['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x334129,null))['then'](function(_0x22ef1f){if(_0x22ef1f){_0x4d0bef=_0x22ef1f;_0x59aac0[_0x019f('0xc8')]=_['keys'](db[_0x019f('0xd9')][_0x019f('0x34')]);_0x59aac0[_0x019f('0x40')]=_['keys'](_0x1bd900[_0x019f('0x40')]);_0x59aac0[_0x019f('0xcb')]=_['intersection'](_0x59aac0['model'],_0x59aac0[_0x019f('0x40')]);_0x125202['attributes']=_['intersection'](_0x59aac0[_0x019f('0xc8')],qs['fields'](_0x1bd900['query'][_0x019f('0xcd')]));_0x125202[_0x019f('0x46')]=_0x125202[_0x019f('0x46')]['length']?_0x125202['attributes']:_0x59aac0[_0x019f('0xc8')];_0x125202[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x1bd900[_0x019f('0x40')][_0x019f('0xcf')]);_0x125202[_0x019f('0xd0')]=qs[_0x019f('0xcb')](_[_0x019f('0xd4')](_0x1bd900[_0x019f('0x40')],_0x59aac0[_0x019f('0xcb')]));if(_0x1bd900[_0x019f('0x40')]['filter']){_0x125202['where']=_['merge'](_0x125202[_0x019f('0xd0')],{'$or':_[_0x019f('0x81')](_0x125202[_0x019f('0x46')],function(_0x5ce315){var _0x5b3d6a={};_0x5b3d6a[_0x5ce315]={'$like':'%'+_0x1bd900[_0x019f('0x40')]['filter']+'%'};return _0x5b3d6a;})});}_0x125202=_['merge']({},_0x125202,_0x1bd900[_0x019f('0x53')]);return _0x4d0bef[_0x019f('0xda')](_0x125202);}})['then'](function(_0x31e33a){if(_0x31e33a){_0x588717=_0x31e33a[_0x019f('0x4a')];if(!_0x1bd900['query'][_0x019f('0xbf')](_0x019f('0xd2'))){_0x125202[_0x019f('0x17')]=qs['limit'](_0x1bd900[_0x019f('0x40')]['limit']);_0x125202[_0x019f('0x15')]=qs['offset'](_0x1bd900[_0x019f('0x40')][_0x019f('0x15')]);}return _0x4d0bef[_0x019f('0xda')](_0x125202);}})[_0x019f('0x1b')](function(_0x3b25b7){if(_0x3b25b7){return _0x3b25b7?{'count':_0x588717,'rows':_0x3b25b7}:null;}})['then'](respondWithResult(_0x334129,null))[_0x019f('0x22')](handleError(_0x334129,null));};exports[_0x019f('0xdb')]=function(_0x1c2b4c,_0x3cca10){var _0x1e15d6={};var _0x3f0697={};var _0x4f6b30;var _0x1f7f60;return db[_0x019f('0x3f')][_0x019f('0xc7')]({'where':{'id':_0x1c2b4c['params']['id']}})['then'](handleEntityNotFound(_0x3cca10,null))[_0x019f('0x1b')](function(_0x2c6b33){if(_0x2c6b33){_0x4f6b30=_0x2c6b33;_0x3f0697[_0x019f('0xc8')]=_[_0x019f('0xca')](db[_0x019f('0xdc')]['rawAttributes']);_0x3f0697[_0x019f('0x40')]=_['keys'](_0x1c2b4c[_0x019f('0x40')]);_0x3f0697[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x3f0697[_0x019f('0xc8')],_0x3f0697[_0x019f('0x40')]);_0x1e15d6[_0x019f('0x46')]=_['intersection'](_0x3f0697[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x1c2b4c[_0x019f('0x40')][_0x019f('0xcd')]));_0x1e15d6[_0x019f('0x46')]=_0x1e15d6[_0x019f('0x46')][_0x019f('0x4a')]?_0x1e15d6['attributes']:_0x3f0697['model'];_0x1e15d6[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x1c2b4c['query'][_0x019f('0xcf')]);_0x1e15d6[_0x019f('0xd0')]=qs['filters'](_[_0x019f('0xd4')](_0x1c2b4c[_0x019f('0x40')],_0x3f0697[_0x019f('0xcb')]));if(_0x1c2b4c[_0x019f('0x40')]['filter']){_0x1e15d6[_0x019f('0xd0')]=_['merge'](_0x1e15d6[_0x019f('0xd0')],{'$or':_[_0x019f('0x81')](_0x1e15d6[_0x019f('0x46')],function(_0x22ba2b){var _0x129dc9={};_0x129dc9[_0x22ba2b]={'$like':'%'+_0x1c2b4c[_0x019f('0x40')]['filter']+'%'};return _0x129dc9;})});}_0x1e15d6=_[_0x019f('0x52')]({},_0x1e15d6,_0x1c2b4c[_0x019f('0x53')]);return _0x4f6b30[_0x019f('0xdb')](_0x1e15d6);}})[_0x019f('0x1b')](function(_0x102e21){if(_0x102e21){_0x1f7f60=_0x102e21[_0x019f('0x4a')];if(!_0x1c2b4c[_0x019f('0x40')][_0x019f('0xbf')](_0x019f('0xd2'))){_0x1e15d6[_0x019f('0x17')]=qs[_0x019f('0x17')](_0x1c2b4c['query'][_0x019f('0x17')]);_0x1e15d6['offset']=qs[_0x019f('0x15')](_0x1c2b4c[_0x019f('0x40')][_0x019f('0x15')]);}return _0x4f6b30[_0x019f('0xdb')](_0x1e15d6);}})[_0x019f('0x1b')](function(_0x1f6422){if(_0x1f6422){return _0x1f6422?{'count':_0x1f7f60,'rows':_0x1f6422}:null;}})[_0x019f('0x1b')](respondWithResult(_0x3cca10,null))[_0x019f('0x22')](handleError(_0x3cca10,null));};exports[_0x019f('0xdd')]=function(_0x176c14,_0x40a994){var _0x3fbed9={'raw':!![],'where':{}};var _0x37adb8={};var _0x41e1e2={'count':0x0,'rows':[]};return db[_0x019f('0x3f')]['findOne']({'where':{'id':_0x176c14[_0x019f('0x51')]['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x40a994,null))['then'](function(_0x1fe19b){if(_0x1fe19b){_0x37adb8['model']=_[_0x019f('0xca')](db['MailInteraction'][_0x019f('0x34')]);_0x37adb8[_0x019f('0x40')]=_[_0x019f('0xca')](_0x176c14[_0x019f('0x40')]);_0x37adb8['filters']=_[_0x019f('0xcc')](_0x37adb8[_0x019f('0xc8')],_0x37adb8['query']);_0x3fbed9[_0x019f('0x46')]=_['intersection'](_0x37adb8[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x176c14['query']['fields']));_0x3fbed9[_0x019f('0x46')]=_0x3fbed9[_0x019f('0x46')][_0x019f('0x4a')]?_0x3fbed9[_0x019f('0x46')]:_0x37adb8[_0x019f('0xc8')];if(!_0x176c14[_0x019f('0x40')][_0x019f('0xbf')](_0x019f('0xd2'))){_0x3fbed9[_0x019f('0x17')]=qs['limit'](_0x176c14[_0x019f('0x40')][_0x019f('0x17')]);_0x3fbed9[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x176c14[_0x019f('0x40')][_0x019f('0x15')]);}_0x3fbed9[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x176c14[_0x019f('0x40')]['sort']);_0x3fbed9[_0x019f('0xd0')]=qs[_0x019f('0xcb')](_[_0x019f('0xd4')](_0x176c14[_0x019f('0x40')],_0x37adb8['filters']));_0x3fbed9[_0x019f('0xd0')][_0x019f('0xd6')]=_0x1fe19b['id'];if(_0x176c14[_0x019f('0x40')][_0x019f('0x36')]){_0x3fbed9[_0x019f('0xd0')]=_['merge'](_0x3fbed9[_0x019f('0xd0')],{'$or':_[_0x019f('0x81')](_0x3fbed9[_0x019f('0x46')],function(_0x5647d7){var _0x46b6b9={};_0x46b6b9[_0x5647d7]={'$like':'%'+_0x176c14['query']['filter']+'%'};return _0x46b6b9;})});}_0x3fbed9=_[_0x019f('0x52')]({},_0x3fbed9,_0x176c14['options']);return db[_0x019f('0xde')][_0x019f('0x18')]({'where':_0x3fbed9[_0x019f('0xd0')]})[_0x019f('0x1b')](function(_0x5c5781){_0x41e1e2[_0x019f('0x18')]=_0x5c5781;if(_0x176c14[_0x019f('0x40')][_0x019f('0x41')]){_0x3fbed9[_0x019f('0x44')]=[{'all':!![]}];}return db['MailInteraction'][_0x019f('0xc6')](_0x3fbed9);})['then'](function(_0x17a56c){_0x41e1e2[_0x019f('0x48')]=_0x17a56c;return _0x41e1e2;});}})['then'](respondWithFilteredResult(_0x40a994,_0x3fbed9))[_0x019f('0x22')](handleError(_0x40a994,null));};exports['getSmsInteractions']=function(_0x110acb,_0x169ef7){var _0x3dca58={};var _0x137f2c={};var _0x5dc01b;var _0x503142;return db[_0x019f('0x3f')][_0x019f('0xc7')]({'where':{'id':_0x110acb[_0x019f('0x51')]['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x169ef7,null))['then'](function(_0x3007fd){if(_0x3007fd){_0x5dc01b=_0x3007fd;_0x137f2c['model']=_[_0x019f('0xca')](db[_0x019f('0xdf')][_0x019f('0x34')]);_0x137f2c[_0x019f('0x40')]=_[_0x019f('0xca')](_0x110acb['query']);_0x137f2c[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x137f2c[_0x019f('0xc8')],_0x137f2c[_0x019f('0x40')]);_0x3dca58[_0x019f('0x46')]=_[_0x019f('0xcc')](_0x137f2c[_0x019f('0xc8')],qs['fields'](_0x110acb[_0x019f('0x40')][_0x019f('0xcd')]));_0x3dca58[_0x019f('0x46')]=_0x3dca58[_0x019f('0x46')]['length']?_0x3dca58['attributes']:_0x137f2c[_0x019f('0xc8')];_0x3dca58[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x110acb['query'][_0x019f('0xcf')]);_0x3dca58[_0x019f('0xd0')]=qs[_0x019f('0xcb')](_[_0x019f('0xd4')](_0x110acb[_0x019f('0x40')],_0x137f2c[_0x019f('0xcb')]));if(_0x110acb['query']['filter']){_0x3dca58[_0x019f('0xd0')]=_['merge'](_0x3dca58['where'],{'$or':_['map'](_0x3dca58[_0x019f('0x46')],function(_0x5566d0){var _0x58690c={};_0x58690c[_0x5566d0]={'$like':'%'+_0x110acb[_0x019f('0x40')][_0x019f('0x36')]+'%'};return _0x58690c;})});}_0x3dca58=_[_0x019f('0x52')]({},_0x3dca58,_0x110acb['options']);return _0x5dc01b[_0x019f('0xe0')](_0x3dca58);}})[_0x019f('0x1b')](function(_0x197584){if(_0x197584){_0x503142=_0x197584['length'];if(!_0x110acb[_0x019f('0x40')][_0x019f('0xbf')]('nolimit')){_0x3dca58[_0x019f('0x17')]=qs[_0x019f('0x17')](_0x110acb[_0x019f('0x40')]['limit']);_0x3dca58[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x110acb[_0x019f('0x40')][_0x019f('0x15')]);}return _0x5dc01b[_0x019f('0xe0')](_0x3dca58);}})[_0x019f('0x1b')](function(_0x3c8bcb){if(_0x3c8bcb){return _0x3c8bcb?{'count':_0x503142,'rows':_0x3c8bcb}:null;}})[_0x019f('0x1b')](respondWithResult(_0x169ef7,null))[_0x019f('0x22')](handleError(_0x169ef7,null));};exports[_0x019f('0xe1')]=function(_0x948364,_0x5b652e){var _0x25cb55={};var _0x421a25={};var _0x643664;var _0x482009;return db[_0x019f('0x3f')]['findOne']({'where':{'id':_0x948364[_0x019f('0x51')]['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x5b652e,null))[_0x019f('0x1b')](function(_0x55ee9b){if(_0x55ee9b){_0x643664=_0x55ee9b;_0x421a25[_0x019f('0xc8')]=_[_0x019f('0xca')](db[_0x019f('0xe2')][_0x019f('0x34')]);_0x421a25[_0x019f('0x40')]=_[_0x019f('0xca')](_0x948364[_0x019f('0x40')]);_0x421a25['filters']=_[_0x019f('0xcc')](_0x421a25[_0x019f('0xc8')],_0x421a25[_0x019f('0x40')]);_0x25cb55['attributes']=_[_0x019f('0xcc')](_0x421a25[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x948364['query'][_0x019f('0xcd')]));_0x25cb55[_0x019f('0x46')]=_0x25cb55[_0x019f('0x46')][_0x019f('0x4a')]?_0x25cb55[_0x019f('0x46')]:_0x421a25[_0x019f('0xc8')];_0x25cb55[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x948364[_0x019f('0x40')][_0x019f('0xcf')]);_0x25cb55['where']=qs['filters'](_[_0x019f('0xd4')](_0x948364[_0x019f('0x40')],_0x421a25[_0x019f('0xcb')]));if(_0x948364[_0x019f('0x40')][_0x019f('0x36')]){_0x25cb55[_0x019f('0xd0')]=_[_0x019f('0x52')](_0x25cb55['where'],{'$or':_[_0x019f('0x81')](_0x25cb55[_0x019f('0x46')],function(_0x27c7b2){var _0x315616={};_0x315616[_0x27c7b2]={'$like':'%'+_0x948364[_0x019f('0x40')][_0x019f('0x36')]+'%'};return _0x315616;})});}_0x25cb55=_['merge']({},_0x25cb55,_0x948364[_0x019f('0x53')]);return _0x643664[_0x019f('0xe1')](_0x25cb55);}})['then'](function(_0x5e6926){if(_0x5e6926){_0x482009=_0x5e6926[_0x019f('0x4a')];if(!_0x948364['query'][_0x019f('0xbf')]('nolimit')){_0x25cb55['limit']=qs[_0x019f('0x17')](_0x948364[_0x019f('0x40')][_0x019f('0x17')]);_0x25cb55[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x948364[_0x019f('0x40')][_0x019f('0x15')]);}return _0x643664[_0x019f('0xe1')](_0x25cb55);}})['then'](function(_0x6c5c8b){if(_0x6c5c8b){return _0x6c5c8b?{'count':_0x482009,'rows':_0x6c5c8b}:null;}})[_0x019f('0x1b')](respondWithResult(_0x5b652e,null))[_0x019f('0x22')](handleError(_0x5b652e,null));};exports['getWhatsappInteractions']=function(_0x83e554,_0x5debd8){var _0x2db18f={};var _0x2bd869={};var _0x142029;var _0x1a7153;return db[_0x019f('0x3f')][_0x019f('0xc7')]({'where':{'id':_0x83e554[_0x019f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5debd8,null))[_0x019f('0x1b')](function(_0x46b115){if(_0x46b115){_0x142029=_0x46b115;_0x2bd869[_0x019f('0xc8')]=_['keys'](db[_0x019f('0xe3')][_0x019f('0x34')]);_0x2bd869[_0x019f('0x40')]=_[_0x019f('0xca')](_0x83e554[_0x019f('0x40')]);_0x2bd869[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x2bd869[_0x019f('0xc8')],_0x2bd869[_0x019f('0x40')]);_0x2db18f['attributes']=_[_0x019f('0xcc')](_0x2bd869[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x83e554[_0x019f('0x40')]['fields']));_0x2db18f[_0x019f('0x46')]=_0x2db18f[_0x019f('0x46')][_0x019f('0x4a')]?_0x2db18f['attributes']:_0x2bd869[_0x019f('0xc8')];_0x2db18f[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x83e554[_0x019f('0x40')][_0x019f('0xcf')]);_0x2db18f[_0x019f('0xd0')]=qs[_0x019f('0xcb')](_[_0x019f('0xd4')](_0x83e554[_0x019f('0x40')],_0x2bd869['filters']));if(_0x83e554[_0x019f('0x40')][_0x019f('0x36')]){_0x2db18f['where']=_[_0x019f('0x52')](_0x2db18f[_0x019f('0xd0')],{'$or':_['map'](_0x2db18f[_0x019f('0x46')],function(_0x34e85d){var _0x14ea46={};_0x14ea46[_0x34e85d]={'$like':'%'+_0x83e554[_0x019f('0x40')][_0x019f('0x36')]+'%'};return _0x14ea46;})});}_0x2db18f=_[_0x019f('0x52')]({},_0x2db18f,_0x83e554[_0x019f('0x53')]);return _0x142029[_0x019f('0xe4')](_0x2db18f);}})[_0x019f('0x1b')](function(_0x33a79f){if(_0x33a79f){_0x1a7153=_0x33a79f['length'];if(!_0x83e554[_0x019f('0x40')][_0x019f('0xbf')]('nolimit')){_0x2db18f[_0x019f('0x17')]=qs['limit'](_0x83e554[_0x019f('0x40')][_0x019f('0x17')]);_0x2db18f['offset']=qs[_0x019f('0x15')](_0x83e554[_0x019f('0x40')][_0x019f('0x15')]);}return _0x142029[_0x019f('0xe4')](_0x2db18f);}})[_0x019f('0x1b')](function(_0x1f546b){if(_0x1f546b){return _0x1f546b?{'count':_0x1a7153,'rows':_0x1f546b}:null;}})[_0x019f('0x1b')](respondWithResult(_0x5debd8,null))[_0x019f('0x22')](handleError(_0x5debd8,null));};exports[_0x019f('0xe5')]=function(_0x5e1d0d,_0x46099b,_0x50c52f){var _0xa62c2d;var _0xb3847a;var _0x50b7b7;var _0x49db2f=!_[_0x019f('0x5e')](_0x5e1d0d[_0x019f('0x51')]['id'])?_0x5e1d0d[_0x019f('0x51')]['id']:!_[_0x019f('0x5e')](_0x5e1d0d[_0x019f('0x29')]['id'])?_0x5e1d0d[_0x019f('0x29')]['id']:null;return db[_0x019f('0x3f')][_0x019f('0x2f')]({'where':{'id':_0x49db2f,'role':{'$or':[_0x019f('0x27'),'user',_0x019f('0x2a')]}},'attributes':['id',_0x019f('0x30'),_0x019f('0xe6'),_0x019f('0xe7'),_0x019f('0x24'),_0x019f('0x59'),_0x019f('0x8f')]})[_0x019f('0x1b')](function(_0x298d71){if(_0x298d71){if(_0x298d71[_0x019f('0x24')]==='agent'){_0xa62c2d=_0x298d71;if(_0x5e1d0d[_0x019f('0x54')][_0x019f('0x91')]){_0x50b7b7=util[_0x019f('0x9e')](_0x019f('0xe8'),_0xa62c2d[_0x5e1d0d[_0x019f('0x54')][_0x019f('0x91')]]);}else if(_0x5e1d0d[_0x019f('0x54')][_0x019f('0xe9')]){_0x50b7b7=util[_0x019f('0x9e')](_0x019f('0x9f'),_0x5e1d0d['body'][_0x019f('0xe9')]);}else{_0x50b7b7=util['format'](_0x019f('0x9f'),_0xa62c2d[_0x019f('0x30')]);}socket['to'](util[_0x019f('0x9e')](_0x019f('0xea'),_0xa62c2d[_0x019f('0x30')]))[_0x019f('0x25')](_0x019f('0xeb'),{'user':{'id':_0xa62c2d['id'],'name':_0xa62c2d[_0x019f('0x30')]},'ip':_0x5e1d0d[_0x019f('0xec')][_0x019f('0xed')]||_0x5e1d0d[_0x019f('0xee')][_0x019f('0xef')]||_0x5e1d0d[_0x019f('0xf0')][_0x019f('0xef')]||_0x5e1d0d['connection'][_0x019f('0xf0')][_0x019f('0xef')]});return db[_0x019f('0xa0')][_0x019f('0x26')]({'where':{'membername':_0xa62c2d[_0x019f('0x30')]},'individualHooks':!![]});}}else{throw new db[(_0x019f('0x85'))][(_0x019f('0x86'))](_0x019f('0xf1'));}})[_0x019f('0x1b')](function(){if(_0xa62c2d){return _0xa62c2d[_0x019f('0xf2')]({'raw':!![]});}})[_0x019f('0x1b')](function(_0x2aad8a){if(_0xa62c2d){if(_0x2aad8a){_0xb3847a=_0x2aad8a;if(_0xb3847a['length']){var _0x1e8dca=_0xb3847a[_0x019f('0x81')](function(_0x4487e0){var _0x579239={'membername':_0xa62c2d[_0x019f('0x30')],'UserId':_0xa62c2d['id'],'queue_name':_0x4487e0['name'],'VoiceQueueId':_0x4487e0['id'],'interface':_0x50b7b7,'paused':_0xa62c2d[_0x019f('0x8f')]||![],'penalty':_0x4487e0[_0x019f('0xf3')]||0x0};return db[_0x019f('0xa0')]['upsert'](_0x579239);});return Promise['all'](_0x1e8dca);}}}})[_0x019f('0x1b')](function(){if(_0xa62c2d){return db[_0x019f('0xf4')]['findAll']({'where':{'membername':_0xa62c2d[_0x019f('0x30')],'exitAt':null}});}})[_0x019f('0x1b')](function(_0xe3530f){if(_0xa62c2d){var _0x417292=[];_0xe3530f[_0x019f('0xf5')](function(_0x3ac48f){_0x417292[_0x019f('0x47')](_0x3ac48f[_0x019f('0x23')]({'exitAt':moment()[_0x019f('0x9e')](_0x019f('0xf6'))}));});return Promise[_0x019f('0x4f')](_0x417292);}})['then'](function(){if(_0xa62c2d){var _0x5d70d1=[];var _0x2a77e5=[];var _0x1c6444=utils[_0x019f('0xf7')]();var _0x27db90={'membername':_0xa62c2d[_0x019f('0x30')],'interface':_0x50b7b7,'enterAt':moment()[_0x019f('0x9e')](_0x019f('0xf6')),'role':_0xa62c2d[_0x019f('0x24')],'internal':_0xa62c2d[_0x019f('0x59')]};_0x1c6444[_0x019f('0xf5')](function(_0x14848a){_0x5d70d1[_0x019f('0x47')](_[_0x019f('0x52')]({'channel':_0x14848a,'type':'LOGIN','data1':_0x5e1d0d[_0x019f('0x54')][_0x019f('0xf8')],'data2':_0x50b7b7},_0x27db90));if(_0xa62c2d[_0x019f('0x8f')]){_0x2a77e5[_0x019f('0x47')](_[_0x019f('0x52')]({'channel':_0x14848a,'type':_0x019f('0xf9'),'data1':_0x019f('0xfa')},_0x27db90));}});return db['MemberReport'][_0x019f('0x7e')](_0x5d70d1['concat'](_0x2a77e5),{'individualHooks':!![]});}})[_0x019f('0x1b')](function(){if(_0xa62c2d){return _0xa62c2d[_0x019f('0x23')]({'online':!![],'lastLoginAt':moment()['format'](_0x019f('0xf6')),'voicePause':_0xa62c2d[_0x019f('0x8f')]||![],'mailPause':_0xa62c2d['loginInPause']||![],'chatPause':_0xa62c2d[_0x019f('0x8f')]||![],'faxPause':_0xa62c2d['loginInPause']||![],'smsPause':_0xa62c2d[_0x019f('0x8f')]||![],'openchannelPause':_0xa62c2d['loginInPause']||![],'whatsappPause':_0xa62c2d[_0x019f('0x8f')]||![],'pauseType':_0xa62c2d[_0x019f('0x8f')]?_0x019f('0xfa'):null,'interface':_0x50b7b7,'lastPauseAt':moment()[_0x019f('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x019f('0x1b')](function(_0x21cbee){if(_0x5e1d0d[_0x019f('0xfb')]){return _0x50c52f();}else{return Promise[_0x019f('0xfc')](_0x21cbee)['then'](respondWithResult(_0x46099b,null));}})[_0x019f('0x22')](handleError(_0x46099b,null));};exports[_0x019f('0xfd')]=function(_0x3321a5,_0x4a84f7){var _0x5aaa7b;return db[_0x019f('0x3f')][_0x019f('0x2f')]({'where':{'id':_0x3321a5['params']['id'],'role':'agent'},'attributes':['id',_0x019f('0x30'),_0x019f('0x24')]})['then'](handleEntityNotFound(_0x4a84f7,null))[_0x019f('0x1b')](function(_0x1426eb){if(_0x1426eb){_0x5aaa7b=_0x1426eb;return db[_0x019f('0xa0')][_0x019f('0x26')]({'where':{'membername':_0x5aaa7b[_0x019f('0x30')]},'individualHooks':!![]});}})[_0x019f('0x1b')](function(){return db[_0x019f('0xf4')][_0x019f('0xc6')]({'where':{'membername':_0x5aaa7b[_0x019f('0x30')],'exitAt':null}});})[_0x019f('0x1b')](function(_0x39bb27){var _0x59aaef=[];_0x39bb27['forEach'](function(_0xca8391){_0x59aaef[_0x019f('0x47')](_0xca8391[_0x019f('0x23')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x019f('0x4f')](_0x59aaef);})[_0x019f('0x1b')](function(){return _0x5aaa7b[_0x019f('0x23')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x019f('0x1b')](respondWithResult(_0x4a84f7,null))[_0x019f('0x22')](handleError(_0x4a84f7,null));};exports[_0x019f('0xfe')]=function(_0x393593,_0x359c0a){var _0xa7436d;return db[_0x019f('0xa0')][_0x019f('0x23')]({'paused':0x1},{'where':{'UserId':_0x393593[_0x019f('0x51')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x019f('0x3f')][_0x019f('0x2f')]({'where':{'id':_0x393593[_0x019f('0x51')]['id'],'role':_0x019f('0x2a')},'attributes':['id',_0x019f('0x30'),'role',_0x019f('0x59'),_0x019f('0x91'),_0x019f('0x8e')]});})[_0x019f('0x1b')](handleEntityNotFound(_0x359c0a,null))[_0x019f('0x1b')](function(_0x54ac7f){if(_0x54ac7f){_0xa7436d=_0x54ac7f;return respondWithRpcPromise(_0x019f('0xff'),'pause',{'id':_0xa7436d['id'],'name':_0xa7436d[_0x019f('0x30')],'pause':!![]});}})[_0x019f('0x1b')](function(){if(_0xa7436d){return db[_0x019f('0xf4')][_0x019f('0xc6')]({'where':{'membername':_0xa7436d[_0x019f('0x30')],'type':'PAUSE','exitAt':null}});}})[_0x019f('0x1b')](function(_0x464e75){if(_0x464e75[_0x019f('0x4a')]){var _0x1f8e51=moment()[_0x019f('0x9e')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1e278d=0x0,_0x38e288=_0x464e75[_0x019f('0x4a')];_0x1e278d<_0x38e288;_0x1e278d++){_0x464e75[_0x1e278d][_0x019f('0x100')]({'exitAt':_0x1f8e51});}}})[_0x019f('0x1b')](function(){var _0x346970=[];var _0x144772=utils[_0x019f('0xf7')]();_0x144772[_0x019f('0xf5')](function(_0x52e480){_0x346970[_0x019f('0x47')]({'channel':_0x52e480,'membername':_0xa7436d['name'],'interface':_[_0x019f('0x5e')](_0xa7436d[_0x019f('0x91')])?util['format'](_0x019f('0x9f'),_0xa7436d[_0x019f('0x30')]):_0xa7436d['interface'],'type':_0x019f('0xf9'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x393593['body']['type']||'DEFAULT\x20PAUSE','role':_0xa7436d[_0x019f('0x24')],'internal':_0xa7436d[_0x019f('0x59')]});});return db[_0x019f('0xf4')][_0x019f('0x7e')](_0x346970,{'individualHooks':!![]});})['then'](function(){return _0xa7436d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x393593['body'][_0x019f('0x101')]||_0x019f('0x102'),'lastPauseAt':moment()[_0x019f('0x9e')](_0x019f('0xf6'))});})[_0x019f('0x1b')](respondWithResult(_0x359c0a,null))[_0x019f('0x22')](handleError(_0x359c0a,null));};exports[_0x019f('0x103')]=function(_0x511f2f,_0x274086){if(_0x511f2f[_0x019f('0x54')]['channel']&&!utils[_0x019f('0x92')](_0x511f2f['body'][_0x019f('0x8d')])){throw new APIBadRequestError(util[_0x019f('0x9e')](_0x019f('0x104'),_0x511f2f['body'][_0x019f('0x8d')]));}return db[_0x019f('0x3f')]['find']({'where':{'id':_0x511f2f[_0x019f('0x51')]['id']},'attributes':['id','name',_0x019f('0x24'),'internal',_0x019f('0x91'),_0x019f('0x8e'),'voicePause',_0x019f('0x105'),'chatPause',_0x019f('0x106'),_0x019f('0x107'),'smsPause','whatsappPause',_0x019f('0x108'),_0x019f('0x109')]})[_0x019f('0x1b')](function(_0x427a5b){if(!_0x427a5b){throw new APINotFoundError(util[_0x019f('0x9e')](_0x019f('0xbe'),_0x511f2f[_0x019f('0x51')]['id']));}return _0x427a5b[_0x019f('0x103')](_0x511f2f[_0x019f('0x54')][_0x019f('0x8d')]);})['then'](respondWithResult(_0x274086,null))[_0x019f('0x22')](APIHandleError(_0x274086));};exports['getTeams']=function(_0x29064f,_0x233a62){var _0x989ace={};var _0x447624={};var _0x5dee6f;var _0x1276fd;return db[_0x019f('0x3f')]['findOne']({'where':{'id':_0x29064f[_0x019f('0x51')]['id']}})['then'](handleEntityNotFound(_0x233a62,null))['then'](function(_0x46145f){if(_0x46145f){_0x5dee6f=_0x46145f;_0x447624['model']=_['keys'](db[_0x019f('0x10a')][_0x019f('0x34')]);_0x447624[_0x019f('0x40')]=_[_0x019f('0xca')](_0x29064f[_0x019f('0x40')]);_0x447624[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x447624[_0x019f('0xc8')],_0x447624[_0x019f('0x40')]);_0x989ace[_0x019f('0x46')]=_[_0x019f('0xcc')](_0x447624[_0x019f('0xc8')],qs['fields'](_0x29064f[_0x019f('0x40')][_0x019f('0xcd')]));_0x989ace[_0x019f('0x46')]=_0x989ace[_0x019f('0x46')][_0x019f('0x4a')]?_0x989ace[_0x019f('0x46')]:_0x447624[_0x019f('0xc8')];_0x989ace[_0x019f('0xce')]=qs['sort'](_0x29064f['query'][_0x019f('0xcf')]);_0x989ace[_0x019f('0xd0')]=qs[_0x019f('0xcb')](_['pick'](_0x29064f[_0x019f('0x40')],_0x447624[_0x019f('0xcb')]));if(_0x29064f[_0x019f('0x40')][_0x019f('0x36')]){_0x989ace[_0x019f('0xd0')]=_[_0x019f('0x52')](_0x989ace[_0x019f('0xd0')],{'$or':_[_0x019f('0x81')](_0x989ace[_0x019f('0x46')],function(_0x2ea678){var _0x3f78c5={};_0x3f78c5[_0x2ea678]={'$like':'%'+_0x29064f['query']['filter']+'%'};return _0x3f78c5;})});}_0x989ace=_['merge']({},_0x989ace,_0x29064f[_0x019f('0x53')]);return _0x5dee6f[_0x019f('0x10b')](_0x989ace);}})[_0x019f('0x1b')](function(_0x181e4f){if(_0x181e4f){_0x1276fd=_0x181e4f[_0x019f('0x4a')];if(!_0x29064f[_0x019f('0x40')][_0x019f('0xbf')](_0x019f('0xd2'))){_0x989ace[_0x019f('0x17')]=qs[_0x019f('0x17')](_0x29064f[_0x019f('0x40')][_0x019f('0x17')]);_0x989ace[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x29064f[_0x019f('0x40')][_0x019f('0x15')]);}return _0x5dee6f['getTeams'](_0x989ace);}})[_0x019f('0x1b')](function(_0x24fb7c){if(_0x24fb7c){return _0x24fb7c?{'count':_0x1276fd,'rows':_0x24fb7c}:null;}})[_0x019f('0x1b')](respondWithResult(_0x233a62,null))['catch'](handleError(_0x233a62,null));};exports[_0x019f('0x10c')]=function(_0x1947e9,_0x375fbc){var _0x5bbb6d=_0x1947e9[_0x019f('0x51')]['id'];var _0x22dcef=_0x1947e9['body']?_0x1947e9[_0x019f('0x54')][_0x019f('0x57')]:null;var _0x682a00=[];return Promise['resolve']()[_0x019f('0x1b')](function(){if(!_0x22dcef)throw new APIBadRequestError(_0x019f('0x10d'));})[_0x019f('0x1b')](function(){return db['User'][_0x019f('0xc7')]({'where':{'id':_0x5bbb6d}});})['then'](function(_0x134393){if(!_0x134393)throw new APINotFoundError(util[_0x019f('0x9e')](_0x019f('0xbe'),_0x1947e9[_0x019f('0x51')]['id']));return db[_0x019f('0x60')][_0x019f('0x10e')](function(_0x50a04c){return _0x134393[_0x019f('0x10c')](_0x22dcef,{'transaction':_0x50a04c})[_0x019f('0x1b')](function(){return db[_0x019f('0x10a')][_0x019f('0xc6')]({'where':{'id':{'$in':_0x22dcef}}});})[_0x019f('0x1b')](function(_0x149583){var _0x427972=_[_0x019f('0x81')](_0x149583,function(_0xd704ee){return _0xd704ee[_0x019f('0x10f')]();});return Promise[_0x019f('0x4f')](_0x427972);})[_0x019f('0x1b')](function(_0x502844){_0x682a00=_['flattenDeep'](_0x502844);var _0x3ca174=_['map'](_0x682a00,function(_0x44cc19){return _0x44cc19['addAgent'](_0x134393['id'],{'transaction':_0x50a04c});});return Promise[_0x019f('0x4f')](_0x3ca174);})[_0x019f('0x1b')](function(){if(!_0x134393[_0x019f('0x8e')])return;var _0x71233f=_[_0x019f('0x36')](_0x682a00,function(_0x5bfd2a){return _0x5bfd2a[_0x019f('0x110')](_0x019f('0x8d'))===_0x019f('0x111');});var _0x4a9bdc=_[_0x019f('0x81')](_0x71233f,function(_0x2d22a6){return db['UserVoiceQueueRt'][_0x019f('0x112')]({'membername':_0x134393[_0x019f('0x30')],'UserId':_0x134393['id'],'queue_name':_0x2d22a6[_0x019f('0x30')],'VoiceQueueId':_0x2d22a6['id'],'interface':_[_0x019f('0x5e')](_0x134393[_0x019f('0x91')])?util['format'](_0x019f('0x9f'),_0x134393[_0x019f('0x30')]):_0x134393[_0x019f('0x91')],'paused':_0x134393[_0x019f('0x90')]||![],'penalty':_0x134393['penalty']},{'transaction':_0x50a04c});});return Promise[_0x019f('0x4f')](_0x4a9bdc);})[_0x019f('0x1b')](function(){return db['TeamVoicePrefix'][_0x019f('0xc6')]({'where':{'teamId':{'$in':_0x22dcef}}});})[_0x019f('0x1b')](function(_0x49809b){var _0x54b1c4=_['map'](_0x49809b,function(_0x3d3b2e){return db[_0x019f('0x113')][_0x019f('0x73')]({'UserId':_0x134393['id'],'VoicePrefixId':_0x3d3b2e['VoicePrefixId']},{'transaction':_0x50a04c});});return Promise[_0x019f('0x4f')](_0x54b1c4);});});})[_0x019f('0x1b')](function(){for(var _0x1aa8c1=0x0;_0x1aa8c1<_0x682a00[_0x019f('0x4a')];_0x1aa8c1++){var _0xb576cc=_0x682a00[_0x1aa8c1][_0x019f('0x110')](_0x019f('0x8d'));var _0x55adf4=_0xb576cc+_0x019f('0x99');socket[_0x019f('0x25')](_0x019f('0x29')+_0xb576cc+'Queue:save',{'UserId':_0x5bbb6d,['queueField']:_0x682a00[_0x1aa8c1]['id']});}})['then'](respondWithStatusCode(_0x375fbc,null))[_0x019f('0x22')](APIHandleError(_0x375fbc));};exports[_0x019f('0x114')]=function(_0x279488,_0x5ba6fd){var _0x32fa53=_0x279488['params']['id'];var _0x544446=null;if(_0x279488[_0x019f('0x40')][_0x019f('0x57')]){_0x544446=_[_0x019f('0xa3')](_0x279488[_0x019f('0x40')][_0x019f('0x57')])?_0x279488[_0x019f('0x40')][_0x019f('0x57')]:[_0x279488['query'][_0x019f('0x57')]];}var _0x54b440=[];return Promise[_0x019f('0xfc')]()[_0x019f('0x1b')](function(){if(!_0x544446)throw new APIBadRequestError(_0x019f('0x115'));})['then'](function(){return db[_0x019f('0x3f')][_0x019f('0xc7')]({'where':{'id':_0x32fa53}});})['then'](function(_0x3cf534){if(!_0x3cf534)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x279488[_0x019f('0x51')]['id']));return db[_0x019f('0x60')]['transaction'](function(_0x3f9e96){return _0x3cf534['removeTeams'](_0x544446,{'transaction':_0x3f9e96})['then'](function(){return db['Team'][_0x019f('0xc6')]({'where':{'id':{'$in':_0x544446}}});})[_0x019f('0x1b')](function(_0x1e4b78){var _0x67d4cb=_[_0x019f('0x81')](_0x1e4b78,function(_0x1bc27e){return _0x1bc27e[_0x019f('0x10f')]();});return Promise[_0x019f('0x4f')](_0x67d4cb);})[_0x019f('0x1b')](function(_0x1550a8){_0x54b440=_[_0x019f('0x116')](_0x1550a8);var _0x2bc74a=_[_0x019f('0x81')](_0x54b440,function(_0x142e75){return _0x142e75[_0x019f('0x117')](_0x3cf534['id'],{'transaction':_0x3f9e96});});return Promise[_0x019f('0x4f')](_0x2bc74a);})[_0x019f('0x1b')](function(){if(!_0x3cf534[_0x019f('0x8e')])return;var _0x4f77fc=_[_0x019f('0x36')](_0x54b440,function(_0x5c3318){return _0x5c3318[_0x019f('0x110')]('channel')===_0x019f('0x111');});var _0x56bed9=_[_0x019f('0x81')](_0x4f77fc,function(_0x4c7c81){return db[_0x019f('0xa0')]['destroy']({'where':{'VoiceQueueId':_0x4c7c81['id'],'UserId':_0x3cf534['id']},'transaction':_0x3f9e96});});return Promise[_0x019f('0x4f')](_0x56bed9);})[_0x019f('0x1b')](function(){return db['TeamVoicePrefix'][_0x019f('0xc6')]({'where':{'teamId':{'$in':_0x544446}}});})[_0x019f('0x1b')](function(_0x29cc14){var _0x352cc2=_[_0x019f('0x81')](_0x29cc14,function(_0x1b68fc){return db['UserVoicePrefix'][_0x019f('0x26')]({'where':{'UserId':_0x3cf534['id'],'VoicePrefixId':_0x1b68fc[_0x019f('0x118')]}},{'transaction':_0x3f9e96});});return Promise[_0x019f('0x4f')](_0x352cc2);});});})[_0x019f('0x1b')](function(){for(var _0x304eec=0x0;_0x304eec<_0x54b440[_0x019f('0x4a')];_0x304eec++){var _0x27707c=_0x54b440[_0x304eec][_0x019f('0x110')]('channel');var _0x42fc88=_0x27707c+_0x019f('0x99');socket[_0x019f('0x25')](_0x019f('0x29')+_0x27707c+'Queue:remove',{'UserId':_0x32fa53,['queueField']:_0x54b440[_0x304eec]['id']});}})[_0x019f('0x1b')](respondWithStatusCode(_0x5ba6fd,null))[_0x019f('0x22')](APIHandleError(_0x5ba6fd));};exports[_0x019f('0x119')]=function(_0x579f43,_0x3f860d){var _0x4a501c={};var _0x26a611={};var _0x59c2c8;var _0x5b8cfc;return db[_0x019f('0x3f')]['findOne']({'where':{'id':_0x579f43[_0x019f('0x51')]['id']}})['then'](handleEntityNotFound(_0x3f860d,null))[_0x019f('0x1b')](function(_0x561d96){if(_0x561d96){_0x59c2c8=_0x561d96;_0x26a611[_0x019f('0xc8')]=_[_0x019f('0xca')](db[_0x019f('0xc0')]['rawAttributes']);_0x26a611['query']=_[_0x019f('0xca')](_0x579f43[_0x019f('0x40')]);_0x26a611['filters']=_[_0x019f('0xcc')](_0x26a611[_0x019f('0xc8')],_0x26a611[_0x019f('0x40')]);_0x4a501c[_0x019f('0x46')]=_['intersection'](_0x26a611[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x579f43[_0x019f('0x40')][_0x019f('0xcd')]));_0x4a501c[_0x019f('0x46')]=_0x4a501c['attributes'][_0x019f('0x4a')]?_0x4a501c[_0x019f('0x46')]:_0x26a611[_0x019f('0xc8')];_0x4a501c[_0x019f('0xce')]=qs[_0x019f('0xcf')](_0x579f43[_0x019f('0x40')][_0x019f('0xcf')]);_0x4a501c['where']=qs['filters'](_['pick'](_0x579f43[_0x019f('0x40')],_0x26a611[_0x019f('0xcb')]));if(_0x579f43['query'][_0x019f('0x36')]){_0x4a501c[_0x019f('0xd0')]=_[_0x019f('0x52')](_0x4a501c[_0x019f('0xd0')],{'$or':_[_0x019f('0x81')](_0x4a501c[_0x019f('0x46')],function(_0x5657d4){var _0x1b33c6={};_0x1b33c6[_0x5657d4]={'$like':'%'+_0x579f43[_0x019f('0x40')][_0x019f('0x36')]+'%'};return _0x1b33c6;})});}_0x4a501c=_[_0x019f('0x52')]({},_0x4a501c,_0x579f43['options']);return _0x59c2c8[_0x019f('0x119')](_0x4a501c);}})['then'](function(_0x3ea5ec){if(_0x3ea5ec){_0x5b8cfc=_0x3ea5ec['length'];if(!_0x579f43[_0x019f('0x40')]['hasOwnProperty']('nolimit')){_0x4a501c[_0x019f('0x17')]=qs[_0x019f('0x17')](_0x579f43[_0x019f('0x40')][_0x019f('0x17')]);_0x4a501c[_0x019f('0x15')]=qs[_0x019f('0x15')](_0x579f43['query'][_0x019f('0x15')]);}return _0x59c2c8['getLists'](_0x4a501c);}})[_0x019f('0x1b')](function(_0x4bcde5){if(_0x4bcde5){return _0x4bcde5?{'count':_0x5b8cfc,'rows':_0x4bcde5}:null;}})[_0x019f('0x1b')](respondWithResult(_0x3f860d,null))['catch'](handleError(_0x3f860d,null));};exports[_0x019f('0x11a')]=function(_0x429561,_0x19f6ea){var _0x395bb3={};var _0x2c45e6={};var _0x64c10d;return db['User'][_0x019f('0xc7')]({'where':{'id':_0x429561[_0x019f('0x51')]['id']}})[_0x019f('0x1b')](handleEntityNotFound(_0x19f6ea,null))[_0x019f('0x1b')](function(_0x2f0dc0){if(_0x2f0dc0){_0x64c10d=_0x2f0dc0;_0x2c45e6[_0x019f('0xc8')]=_[_0x019f('0xca')](db[_0x019f('0x3f')][_0x019f('0x34')]);_0x2c45e6[_0x019f('0x40')]=_[_0x019f('0xca')](_0x429561[_0x019f('0x40')]);_0x2c45e6[_0x019f('0xcb')]=_[_0x019f('0xcc')](_0x2c45e6[_0x019f('0xc8')],_0x2c45e6['query']);_0x395bb3[_0x019f('0x46')]=_['intersection'](_0x2c45e6[_0x019f('0xc8')],qs[_0x019f('0xcd')](_0x429561[_0x019f('0x40')][_0x019f('0xcd')]));_0x395bb3[_0x019f('0x46')]=_0x395bb3[_0x019f('0x46')]['length']?_0x395bb3[_0x019f('0x46')]:_0x2c45e6[_0x019f('0xc8')];_0x395bb3['order']=qs['sort'](_0x429561['query'][_0x019f('0xcf')]);_0x395bb3[_0x019f('0xd0')]=qs['filters'](_[_0x019f('0xd4')](_0x429561[_0x019f('0x40')],_0x2c45e6[_0x019f('0xcb')]));if(_0x429561[_0x019f('0x40')][_0x019f('0x36')]){_0x395bb3[_0x019f('0xd0')]=_['merge'](_0x395bb3[_0x019f('0xd0')],{'$or':_[_0x019f('0x81')](_0x395bb3['attributes'],function(_0x41f455){var _0x12c1ce={};_0x12c1ce[_0x41f455]={'$like':'%'+_0x429561[_0x019f('0x40')][_0x019f('0x36')]+'%'};return _0x12c1ce;})});}_0x395bb3[_0x019f('0xc8')]=db[_0x019f('0x3f')];_0x395bb3['as']=_0x019f('0x7b');_0x395bb3=_[_0x019f('0x52')]({},_0x395bb3,_0x429561['options']);return _0x64c10d[_0x019f('0xf2')]({'include':[_0x395bb3]});}})[_0x019f('0x1b')](function(_0x48f9aa){if(_0x48f9aa){var _0x31fa86={},_0x33dc1=[];for(var _0x2b1f1a=0x0;_0x2b1f1a<_0x48f9aa[_0x019f('0x4a')];_0x2b1f1a+=0x1){for(var _0x3acb5f=0x0,_0x5af69e;_0x3acb5f<_0x48f9aa[_0x2b1f1a][_0x019f('0x7b')][_0x019f('0x4a')];_0x3acb5f+=0x1){_0x5af69e=_0x48f9aa[_0x2b1f1a][_0x019f('0x7b')][_0x3acb5f]['get']({'plain':!![]});_0x31fa86[_0x5af69e['id']]=_0x5af69e;}}_0x31fa86=_[_0x019f('0x11b')](_0x31fa86);for(var _0x2f07bb=qs[_0x019f('0x15')](_0x429561[_0x019f('0x40')][_0x019f('0x15')]);_0x2f07bb<_0x31fa86[_0x019f('0x4a')]&&_0x33dc1[_0x019f('0x4a')]=_0x30518f){_0x20e943=_0x30518f;_0x1d71a8=0xc8;}else{_0x1d71a8=0xce;}_0x1b7189['status'](_0x1d71a8);return _0x1b7189[_0xb16f('0x1f')](_0xb16f('0x20'),_0x2a8848+'-'+_0x20e943+'/'+_0x30518f)[_0xb16f('0x1a')](_0x5460a7);}return null;};}function respondWithRpcPromise(_0x46c376,_0x1badee,_0xc84953,_0xb2743c){return new Promise(function(_0x21cc0d,_0x5497c4){var _0x42d75b=_0xb2743c||amiClient;return _0x42d75b[_0xb16f('0x21')](_0x46c376,_0xc84953)[_0xb16f('0x22')](function(_0x377e5f){logger[_0xb16f('0x23')](_0xb16f('0x24'),_0x1badee,'request\x20sent');logger[_0xb16f('0x25')](_0xb16f('0x26'),_0x1badee,_0xb16f('0x27'),JSON[_0xb16f('0x28')](_0x377e5f));if(_0x377e5f[_0xb16f('0x29')]){if(_0x377e5f[_0xb16f('0x29')][_0xb16f('0x2a')]===0x1f4){logger[_0xb16f('0x29')](_0xb16f('0x24'),_0x1badee,_0x377e5f[_0xb16f('0x29')][_0xb16f('0x2b')]);return _0x5497c4(_0x377e5f['error'][_0xb16f('0x2b')]);}logger[_0xb16f('0x29')]('User,\x20%s,\x20%s',_0x1badee,_0x377e5f[_0xb16f('0x29')]['message']);return _0x21cc0d(_0x377e5f[_0xb16f('0x29')]['message']);}else{logger[_0xb16f('0x23')](_0xb16f('0x24'),_0x1badee,_0xb16f('0x27'));_0x21cc0d(_0x377e5f[_0xb16f('0x2c')][_0xb16f('0x2b')]);}})['catch'](function(_0x487a68){logger[_0xb16f('0x29')](_0xb16f('0x24'),_0x1badee,_0x487a68);_0x5497c4(_0x487a68);});});}function saveUpdates(_0x39374b){return function(_0x321322){if(_0x321322){return _0x321322[_0xb16f('0x2d')](_0x39374b)['then'](function(_0x39ee02){if(_0x39ee02['role']==='agent'){socket[_0xb16f('0x2e')](_0xb16f('0x2f')+_0x39ee02['id'],_0x39ee02);}return _0x39ee02;});}return null;};}function removeEntity(_0x1961cf,_0x2458a6){return function(_0x820d64){if(_0x820d64){return _0x820d64[_0xb16f('0x30')]({'transaction':_0x2458a6})[_0xb16f('0x22')](function(){var _0x7eb72e=_0x820d64[_0xb16f('0x31')]({'plain':!![]});if(_0x7eb72e['role']===_0xb16f('0x32'))return;var _0x25514e=[{'name':'Users','value':_0xb16f('0x33'),'ignore':!![]},{'name':_0xb16f('0x34'),'value':'agent','ignore':![]},{'name':_0xb16f('0x35'),'value':_0xb16f('0x36'),'ignore':![]}];var _0x1799ec=_(_0x25514e)[_0xb16f('0x37')](_0xb16f('0x38'))[_0xb16f('0x39')](_0xb16f('0x3a'))[_0xb16f('0x3a')]();if(_['includes'](_0x1799ec,_0x7eb72e[_0xb16f('0x3b')])){return;}var _0x202647=_[_0xb16f('0x3c')](_0x25514e,[_0xb16f('0x3a'),_0x7eb72e[_0xb16f('0x3b')]])[_0xb16f('0x3d')];return db[_0xb16f('0x3e')][_0xb16f('0x30')]({'where':{'type':_0x202647,'resourceId':_0x7eb72e['id']},'transaction':_0x2458a6})[_0xb16f('0x22')](function(){return _0x820d64;});})[_0xb16f('0x22')](function(){_0x1961cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x539341){return function(_0x24b5fc){if(!_0x24b5fc){_0x539341[_0xb16f('0x3f')](0x194);}return _0x24b5fc;};}function handleError(_0x5006ef,_0x685bb1){_0x685bb1=_0x685bb1||0x1f4;return function(_0x3488f3){logger[_0xb16f('0x29')](_0x3488f3[_0xb16f('0x40')]);if(_0x3488f3['name']){delete _0x3488f3[_0xb16f('0x3d')];}_0x5006ef['status'](_0x685bb1)[_0xb16f('0x41')](_0x3488f3);};}function getUserAttributes(){return _(db[_0xb16f('0x42')][_0xb16f('0x43')])['map'](function(_0x420f75){return{'name':_0x420f75[_0xb16f('0x44')],'type':_0x420f75[_0xb16f('0x45')][_0xb16f('0x46')]};})['filter'](function(_0x21212f){return![_0xb16f('0x47'),_0xb16f('0x48'),_0xb16f('0x49'),_0xb16f('0x4a'),_0xb16f('0x4b'),_0xb16f('0x4c')][_0xb16f('0x4d')](_0x21212f[_0xb16f('0x3d')]);})[_0xb16f('0x3a')]();}exports['index']=function(_0x45573a,_0x365a92){var _0x32cb17={},_0x4d291b={'count':0x0,'rows':[]};var _0x6e9f8a=getUserAttributes();_0x32cb17=qs['getOptions'](_0x6e9f8a,_0x45573a);var _0x1333e4={'where':_0x32cb17[_0xb16f('0x4e')]};return db[_0xb16f('0x42')][_0xb16f('0x1d')](_0x1333e4)[_0xb16f('0x22')](function(_0x35989e){_0x4d291b['count']=_0x35989e;if(_0x45573a[_0xb16f('0x4f')][_0xb16f('0x50')]){_0x32cb17[_0xb16f('0x51')]=[{'all':!![]}];}if(_0x45573a[_0xb16f('0x4f')][_0xb16f('0x52')]===_0xb16f('0x53')){_0x32cb17['include']=[{'model':db[_0xb16f('0x54')],'as':_0xb16f('0x52')}];}if(!_['includes'](_0x32cb17[_0xb16f('0x55')],'id')){_0x32cb17[_0xb16f('0x55')][_0xb16f('0x56')]('id');}return db[_0xb16f('0x42')][_0xb16f('0x57')](_0x32cb17);})['then'](function(_0x9f7152){_0x4d291b[_0xb16f('0x58')]=_0x9f7152;if(_0x45573a[_0xb16f('0x4f')]['openTabs']===_0xb16f('0x53')){var _0x2ffa07=[];for(var _0x542e2d=0x0;_0x542e2d<_0x4d291b[_0xb16f('0x58')][_0xb16f('0x59')];_0x542e2d++){_0x2ffa07[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x5a'),_0x4d291b[_0xb16f('0x58')][_0x542e2d][_0xb16f('0x5b')]));_0x2ffa07[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x5c'),_0x4d291b[_0xb16f('0x58')][_0x542e2d][_0xb16f('0x5b')]));_0x2ffa07[_0xb16f('0x56')](get_open_tabs('fax',_0x4d291b['rows'][_0x542e2d][_0xb16f('0x5b')]));_0x2ffa07[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x5d'),_0x4d291b['rows'][_0x542e2d][_0xb16f('0x5b')]));_0x2ffa07[_0xb16f('0x56')](get_open_tabs('openchannel',_0x4d291b[_0xb16f('0x58')][_0x542e2d]['dataValues']));_0x2ffa07[_0xb16f('0x56')](get_open_tabs('whatsapp',_0x4d291b[_0xb16f('0x58')][_0x542e2d]['dataValues']));}return Promise[_0xb16f('0x5e')](_0x2ffa07)[_0xb16f('0x22')](function(){return _0x4d291b;});}else{return _0x4d291b;}})[_0xb16f('0x22')](respondWithFilteredResult(_0x365a92,_0x32cb17))[_0xb16f('0x5f')](handleError(_0x365a92,null));};exports[_0xb16f('0x60')]=function(_0x366747,_0x23d282){var _0x751420=getUserAttributes();_0x366747[_0xb16f('0x4f')]['id']=_0x366747[_0xb16f('0x61')]['id'];var _0x165e81=qs[_0xb16f('0x62')](_0x751420,_0x366747);if(_0x366747['query'][_0xb16f('0x50')]){_0x165e81[_0xb16f('0x51')]=[{'all':!![]}];}if(_0x366747['query'][_0xb16f('0x52')]===_0xb16f('0x53')){_0x165e81[_0xb16f('0x51')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x165e81=_['merge']({},_0x165e81,_0x366747[_0xb16f('0x63')]);if(!_['includes'](_0x165e81['attributes'],'id')){_0x165e81[_0xb16f('0x55')][_0xb16f('0x56')]('id');}return db[_0xb16f('0x42')][_0xb16f('0x3c')](_0x165e81)[_0xb16f('0x22')](handleEntityNotFound(_0x23d282,null))['then'](function(_0xfc3f05){var _0x1f4077=[];values=_0xfc3f05;if(_0x366747[_0xb16f('0x4f')][_0xb16f('0x64')]===_0xb16f('0x53')){_0x1f4077['push'](get_open_tabs(_0xb16f('0x5a'),_0xfc3f05['dataValues']));_0x1f4077[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x5c'),_0xfc3f05[_0xb16f('0x5b')]));_0x1f4077[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x65'),_0xfc3f05[_0xb16f('0x5b')]));_0x1f4077[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x66'),_0xfc3f05['dataValues']));_0x1f4077[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x67'),_0xfc3f05[_0xb16f('0x5b')]));_0x1f4077['push'](get_open_tabs(_0xb16f('0x5d'),_0xfc3f05[_0xb16f('0x5b')]));return Promise[_0xb16f('0x5e')](_0x1f4077);}else{return values;}})['then'](function(){return values;})[_0xb16f('0x22')](respondWithResult(_0x23d282,null))[_0xb16f('0x5f')](handleError(_0x23d282,null));};exports[_0xb16f('0x2d')]=function(_0x2cfb54,_0x49f66c){if(_0x2cfb54[_0xb16f('0x68')]['id']){delete _0x2cfb54[_0xb16f('0x68')]['id'];}delete _0x2cfb54[_0xb16f('0x68')][_0xb16f('0x3b')];return db['User'][_0xb16f('0x3c')]({'where':{'id':_0x2cfb54[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x49f66c,null))[_0xb16f('0x22')](saveUpdates(_0x2cfb54[_0xb16f('0x68')],null))[_0xb16f('0x22')](respondWithResult(_0x49f66c,null))['catch'](handleError(_0x49f66c,null));};exports['describe']=function(_0x505784,_0x14ddb7){return db[_0xb16f('0x42')][_0xb16f('0x69')]()[_0xb16f('0x22')](respondWithResult(_0x14ddb7,null))[_0xb16f('0x5f')](handleError(_0x14ddb7,null));};exports[_0xb16f('0x6a')]=function(_0x261e7c,_0x4a4c0e){return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x261e7c[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x4a4c0e,null))[_0xb16f('0x22')](function(_0x496df3){if(_0x496df3){return _0x496df3[_0xb16f('0x6a')](_0x261e7c[_0xb16f('0x68')][_0xb16f('0x6b')],_[_0xb16f('0x6c')](_0x261e7c[_0xb16f('0x68')],[_0xb16f('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x4a4c0e,null))[_0xb16f('0x5f')](handleError(_0x4a4c0e,null));};function validateUser(_0x415f5d){return new Promise(function(_0x32db50,_0x239edc){if(_0x415f5d[_0xb16f('0x6d')])return _0x32db50(_0x415f5d);return db['Setting'][_0xb16f('0x6e')](0x1)[_0xb16f('0x22')](function(_0x5e9f9a){if(_0x5e9f9a[_0xb16f('0x6f')])authService[_0xb16f('0x70')](_0x415f5d[_0xb16f('0x47')]);db[_0xb16f('0x42')][_0xb16f('0x71')]('internal')[_0xb16f('0x22')](function(_0x1197f1){if(_[_0xb16f('0x72')](_0x1197f1)){_0x415f5d[_0xb16f('0x6d')]=_0x5e9f9a[_0xb16f('0x73')]||0x1;return;}if(_[_0xb16f('0x72')](_0x5e9f9a[_0xb16f('0x73')])||_0x5e9f9a[_0xb16f('0x73')]===_0x1197f1){_0x415f5d[_0xb16f('0x6d')]=_0x1197f1+0x1;return;}if(_0x5e9f9a['min_internal']>_0x1197f1){_0x415f5d[_0xb16f('0x6d')]=_0x5e9f9a['min_internal'];return;}return db[_0xb16f('0x74')][_0xb16f('0x4f')](_0xb16f('0x75'),{'type':db[_0xb16f('0x74')][_0xb16f('0x76')][_0xb16f('0x77')]})[_0xb16f('0x22')](function(_0x317706){if(_0x317706&&_0x317706['length']){for(var _0x255246=0x0,_0x505295=_0x317706['length'];_0x255246<_0x505295&&_['isNil'](_0x415f5d[_0xb16f('0x6d')]);_0x255246++){if(_0x5e9f9a[_0xb16f('0x73')]<=_0x317706[_0x255246][_0xb16f('0x78')]){_0x415f5d[_0xb16f('0x6d')]=_0x317706[_0x255246][_0xb16f('0x78')];}else if(_0x5e9f9a['min_internal']>_0x317706[_0x255246][_0xb16f('0x78')]&&_0x5e9f9a[_0xb16f('0x73')]<=_0x317706[_0x255246]['to']){_0x415f5d['internal']=_0x5e9f9a[_0xb16f('0x73')];}}}if(_[_0xb16f('0x72')](_0x415f5d[_0xb16f('0x6d')])){_0x415f5d[_0xb16f('0x6d')]=_0x1197f1+0x1;}return _0x32db50(_0x415f5d);});});})['catch'](function(_0x21c998){_0x239edc(_0x21c998);});});}function updateUser(_0x3fc08e){return new Promise(function(_0x2b8729,_0x437ce1){try{if(_0x3fc08e[_0xb16f('0x79')]){_0x3fc08e[_0xb16f('0x7a')]=_0x3fc08e[_0xb16f('0x6d')];_0x3fc08e[_0xb16f('0x7b')]={'mailbox':_0x3fc08e[_0xb16f('0x6d')],'password':_0x3fc08e['password'],'fullname':_0x3fc08e[_0xb16f('0x7c')],'email':_0x3fc08e['email']};}if(_0x3fc08e[_0xb16f('0x3b')]===_0xb16f('0x7d')){if(!_0x3fc08e[_0xb16f('0x7e')])_0x3fc08e[_0xb16f('0x7e')]=[_0xb16f('0x7f'),'102',_0xb16f('0x80'),_0xb16f('0x81'),'110','104','105',_0xb16f('0x82'),_0xb16f('0x83'),_0xb16f('0x84'),_0xb16f('0x85'),_0xb16f('0x86'),_0xb16f('0x87'),_0xb16f('0x88'),'115'];}_0x2b8729(_0x3fc08e);}catch(_0x9fb3b5){_0x437ce1(_0x9fb3b5);}});}exports['create']=function(_0x5564aa,_0x4f501a){if(_0x5564aa[_0xb16f('0x33')][_0xb16f('0x3b')]===_0xb16f('0x7d'))throw new Error(_0xb16f('0x89'));if(_0x5564aa['body']['role']==='user'&&_0x5564aa[_0xb16f('0x33')][_0xb16f('0x3b')]!==_0xb16f('0x32')){throw new Error(_0xb16f('0x8a'));}if(_0x5564aa[_0xb16f('0x68')]['role']===_0xb16f('0x32')&&_0x5564aa['user'][_0xb16f('0x3b')]!==_0xb16f('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x5564aa[_0xb16f('0x68')]])['then'](function(){return validateUser(_0x5564aa[_0xb16f('0x68')]);})[_0xb16f('0x22')](function(_0x328413){return updateUser(_0x328413)[_0xb16f('0x22')](function(_0x21c23c){if(_0x21c23c[_0xb16f('0x3b')]===_0xb16f('0x32')){_0x21c23c['settingsEnabled']=_0x5564aa['user'][_0xb16f('0x8b')];delete _0x21c23c[_0xb16f('0x8c')];}return _0x21c23c;});})[_0xb16f('0x22')](function(_0x561caa){return db[_0xb16f('0x42')]['create'](_0x561caa,{'include':[{'model':db[_0xb16f('0x7b')],'as':_0xb16f('0x7b')}]});})[_0xb16f('0x22')](function(_0x21e313){if(_0x5564aa[_0xb16f('0x68')][_0xb16f('0x3b')]===_0xb16f('0x33'))return _0x21e313;if(_0x5564aa[_0xb16f('0x33')]['role']!==_0xb16f('0x33'))return _0x21e313;return db['UserProfileSection'][_0xb16f('0x3c')]({'where':{'name':_0x21e313['role']===_0xb16f('0x7d')?_0xb16f('0x34'):_0xb16f('0x35'),'userProfileId':_0x5564aa[_0xb16f('0x33')]['userProfileId']},'raw':!![]})[_0xb16f('0x22')](function(_0x20b009){if(!_0x20b009||_0x20b009[_0xb16f('0x8d')]!=0x0)return _0x21e313;return db['UserProfileResource'][_0xb16f('0x8e')]({'name':_0x21e313[_0xb16f('0x3d')],'resourceId':_0x21e313['id'],'type':_0x20b009['name'],'sectionId':_0x20b009['id']},{})[_0xb16f('0x22')](function(){return _0x21e313;});})[_0xb16f('0x5f')](function(_0x7a9c79){logger[_0xb16f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7a9c79);throw _0x7a9c79;});})[_0xb16f('0x22')](respondWithResult(_0x4f501a,0xc9))['catch'](handleError(_0x4f501a,null));};exports[_0xb16f('0x8f')]=function(_0x14e17a,_0x154a7f){var _0xb1475c=_0x14e17a[_0xb16f('0x68')];var _0x1b99d0=[];if(_0x14e17a[_0xb16f('0x33')][_0xb16f('0x3b')]===_0xb16f('0x7d'))throw new Error('Unauthorized');if(_[_0xb16f('0x90')](_0xb1475c,[_0xb16f('0x3b'),'user'])&&_0x14e17a[_0xb16f('0x33')][_0xb16f('0x3b')]!==_0xb16f('0x32')){throw new Error(_0xb16f('0x8a'));}if(_[_0xb16f('0x90')](_0xb1475c,[_0xb16f('0x3b'),_0xb16f('0x32')])&&_0x14e17a[_0xb16f('0x33')][_0xb16f('0x3b')]!==_0xb16f('0x32')){throw new Error(_0xb16f('0x91'));}return licenseUtil[_0xb16f('0x92')](_0xb1475c)[_0xb16f('0x22')](function(){return validateUser(_0xb1475c[0x0]);})['then'](function(){for(var _0xbd46e7=0x1;_0xbd46e7<_0xb1475c['length'];_0xbd46e7++){var _0x2ca6ca=_0xb1475c[_0xbd46e7-0x1][_0xb16f('0x6d')];if(!_0xb1475c[_0xbd46e7]['internal'])_0xb1475c[_0xbd46e7][_0xb16f('0x6d')]=_0x2ca6ca+0x1;_0x1b99d0[_0xb16f('0x56')](validateUser(_0xb1475c[_0xbd46e7]));}return Promise['all'](_0x1b99d0);})[_0xb16f('0x22')](function(){_0x1b99d0=[];for(var _0x688dab=0x0;_0x688dab<_0xb1475c[_0xb16f('0x59')];_0x688dab++){_0x1b99d0[_0xb16f('0x56')](updateUser(_0xb1475c[_0x688dab]));}return Promise[_0xb16f('0x5e')](_0x1b99d0);})[_0xb16f('0x22')](function(){_0x1b99d0=_0xb1475c[_0xb16f('0x39')](function(_0x1d3abe){return db[_0xb16f('0x42')][_0xb16f('0x8e')](_0x1d3abe,{'include':[{'model':db[_0xb16f('0x7b')],'as':_0xb16f('0x7b')}]})['then'](function(_0x54167a){_0x1d3abe['id']=_0x54167a['id'];return _0x1d3abe;});});return Promise[_0xb16f('0x5e')](_0x1b99d0);})[_0xb16f('0x22')](function(_0x153962){if(_0x14e17a['body']['role']===_0xb16f('0x33'))return _0x153962;if(_0x14e17a[_0xb16f('0x33')]['role']!=='user')return _0x153962;var _0x5bce74=_[_0xb16f('0x90')](_0x153962,function(_0x43638e){return _0x43638e[_0xb16f('0x3b')]==='agent'||_0x43638e[_0xb16f('0x3b')]==='telephone';});if(!_0x5bce74)return _0x153962;return db[_0xb16f('0x93')]['findAll']({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x14e17a[_0xb16f('0x33')][_0xb16f('0x8c')]},'raw':!![]})[_0xb16f('0x22')](function(_0x44dbf2){if(_[_0xb16f('0x94')](_0x44dbf2)||!_[_0xb16f('0x90')](_0x44dbf2,['autoAssociation',0x0]))return _0x153962;_0x1b99d0=[];var _0x1f82a8=_(_0x44dbf2)[_0xb16f('0x39')](function(_0x3f37ef){if(_0x3f37ef[_0xb16f('0x8d')]===0x1)return;return _0x3f37ef[_0xb16f('0x3d')]===_0xb16f('0x34')?_0xb16f('0x7d'):_0xb16f('0x36');})[_0xb16f('0x95')]()[_0xb16f('0x3a')]();for(var _0x1070dd=0x0;_0x1070dd<_0x153962[_0xb16f('0x59')];_0x1070dd++){if(!_['includes'](_0x1f82a8,_0x153962[_0x1070dd][_0xb16f('0x3b')]))return;var _0x2e0863=_0x153962[_0x1070dd][_0xb16f('0x3b')]===_0xb16f('0x7d')?_0xb16f('0x34'):_0xb16f('0x35');_0x1b99d0[_0xb16f('0x56')](db[_0xb16f('0x3e')][_0xb16f('0x8e')]({'name':_0x153962[_0x1070dd][_0xb16f('0x3d')],'resourceId':_0x153962[_0x1070dd]['id'],'type':_0x2e0863,'sectionId':_['find'](_0x44dbf2,['name',_0x2e0863])['id']},{}));}return Promise['all'](_0x1b99d0);});})[_0xb16f('0x22')](respondWithResult(_0x154a7f,0xc9))['catch'](handleError(_0x154a7f,null));};exports[_0xb16f('0x96')]=function(_0x46ce25,_0xdca41d){if(_0x46ce25['body']['id']){delete _0x46ce25[_0xb16f('0x68')]['id'];}return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x46ce25[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](function(_0x40afc2){if(!_0x40afc2)return null;if(_0x40afc2['id']===_0x46ce25['user']['id']){if(!_0x46ce25['body'][_0xb16f('0x97')]||!_0x46ce25[_0xb16f('0x68')][_0xb16f('0x98')]){throw new db[(_0xb16f('0x99'))][(_0xb16f('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x40afc2[_0xb16f('0x9b')](_0x46ce25[_0xb16f('0x68')]['oldPassword'])){throw new db['Sequelize'][(_0xb16f('0x9a'))](_0xb16f('0x9c'));}if(_0x46ce25['body'][_0xb16f('0x97')]===_0x46ce25[_0xb16f('0x68')][_0xb16f('0x98')]){throw new db['Sequelize']['ValidationError'](_0xb16f('0x9d'));}}else if(_0x46ce25[_0xb16f('0x33')][_0xb16f('0x3b')]===_0xb16f('0x32')){if(!_0x46ce25[_0xb16f('0x68')]['newPassword']){throw new db['Sequelize'][(_0xb16f('0x9a'))](_0xb16f('0x9e'));}}else if(_0x46ce25[_0xb16f('0x33')]['role']===_0xb16f('0x33')){if(!_0x46ce25[_0xb16f('0x68')][_0xb16f('0x98')]){throw new db[(_0xb16f('0x99'))][(_0xb16f('0x9a'))](_0xb16f('0x9e'));}if(_0x40afc2['role']!==_0xb16f('0x7d')){throw new db[(_0xb16f('0x99'))]['ValidationError'](_0xb16f('0x89'));}}else{throw new db[(_0xb16f('0x99'))]['ValidationError'](_0xb16f('0x89'));}return _0x40afc2;})[_0xb16f('0x22')](handleEntityNotFound(_0xdca41d,null))[_0xb16f('0x22')](function(_0xda271d){return db['Setting'][_0xb16f('0x9f')]({'attributes':['id',_0xb16f('0x6f'),_0xb16f('0xa0'),_0xb16f('0xa1')]})[_0xb16f('0x22')](function(_0x5de6f2){if(_0x5de6f2['securePassword'])authService[_0xb16f('0x70')](_0x46ce25[_0xb16f('0x68')]['newPassword']);if(!_0x5de6f2[_0xb16f('0xa0')]||!_0xda271d[_0xb16f('0x49')])return _0xda271d;authService[_0xb16f('0xa2')](_0x46ce25[_0xb16f('0x68')][_0xb16f('0x98')],_0xda271d['previousPasswords'],_0x5de6f2[_0xb16f('0xa1')]);return _0xda271d;})[_0xb16f('0x22')](saveUpdates({'password':_0x46ce25[_0xb16f('0x68')][_0xb16f('0x98')],'passwordResetAt':_0x46ce25[_0xb16f('0x33')]['id']==_0x46ce25[_0xb16f('0x61')]['id']?moment():null,'previousPasswords':authService[_0xb16f('0xa3')](_0x46ce25[_0xb16f('0x68')][_0xb16f('0x98')],_0xda271d[_0xb16f('0x49')])},null));})[_0xb16f('0x22')](respondWithResult(_0xdca41d,null))['catch'](handleError(_0xdca41d,null));};exports[_0xb16f('0xa4')]=function(_0x2fe85c,_0x3daadb){var _0x22e367=_0x2fe85c[_0xb16f('0x68')][_0xb16f('0xa5')];return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x2fe85c['params']['id']},'attributes':['id',_0xb16f('0x3d'),_0xb16f('0x3b'),'online',_0xb16f('0xa6'),'voicePause',_0xb16f('0xa7')]})[_0xb16f('0x22')](handleEntityNotFound(_0x3daadb,null))[_0xb16f('0x22')](function(_0x2cafbd){if(_0x2cafbd){if(!utils['isValidChannel'](_0x22e367)){throw new db[(_0xb16f('0x99'))][(_0xb16f('0x9a'))](_0xb16f('0xa8'));}return _0x2cafbd[_0xb16f('0xa9')+_[_0xb16f('0xaa')](_0x22e367[_0xb16f('0xab')]())+_0xb16f('0xac')](_0x2fe85c['body'][_0xb16f('0x6b')],{'penalty':_0x2fe85c[_0xb16f('0x68')][_0xb16f('0xad')]||0x0})[_0xb16f('0xae')](function(_0xc95317){for(var _0x54b47b=0x0;_0x54b47b<_0x2fe85c[_0xb16f('0x68')][_0xb16f('0x6b')][_0xb16f('0x59')];_0x54b47b+=0x1){var _0x43507a={'UserId':Number(_0x2fe85c[_0xb16f('0x61')]['id'])};_0x43507a[_[_0xb16f('0xaa')](_0x22e367[_0xb16f('0xab')]())+_0xb16f('0xaf')]=Number(_0x2fe85c[_0xb16f('0x68')][_0xb16f('0x6b')][_0x54b47b]);socket[_0xb16f('0x2e')](_0xb16f('0x33')+_[_0xb16f('0xaa')](_0x22e367[_0xb16f('0xab')]())+'Queue:save',_0x43507a);}return _0xc95317;})[_0xb16f('0x22')](function(){if(_0x22e367===_0xb16f('0xb0')){return db[_0xb16f('0xb1')][_0xb16f('0x57')]({'where':{'id':_0x2fe85c[_0xb16f('0x68')][_0xb16f('0x6b')]||[]},'raw':!![],'attributes':['id',_0xb16f('0x3d')]});}})[_0xb16f('0x22')](function(_0x389c53){var _0x25be80=_0x2cafbd[_0xb16f('0x31')]({'plain':!![]});var _0x3362c4=[];if(_0x22e367===_0xb16f('0xb0')&&_0x25be80[_0xb16f('0x3b')]==='agent'&&_0x25be80[_0xb16f('0xb2')]){for(let _0x2ea8a5=0x0;_0x2ea8a5<_0x389c53[_0xb16f('0x59')];_0x2ea8a5+=0x1){_0x3362c4['push']({'membername':_0x25be80[_0xb16f('0x3d')],'UserId':_0x25be80['id'],'queue_name':_0x389c53[_0x2ea8a5]['name'],'VoiceQueueId':_0x389c53[_0x2ea8a5]['id'],'interface':_['isNil'](_0x25be80[_0xb16f('0xa7')])?util[_0xb16f('0xb3')](_0xb16f('0xb4'),_0x25be80[_0xb16f('0x3d')]):_0x25be80[_0xb16f('0xa7')],'paused':_0x25be80['voicePause']||![],'penalty':_0x2fe85c[_0xb16f('0x68')][_0xb16f('0xad')]||0x0});}return Promise[_0xb16f('0x5e')](_0x3362c4[_0xb16f('0x39')](function(_0x4f1d2){return db['UserVoiceQueueRt'][_0xb16f('0xb5')](_0x4f1d2);}));}return _0x2cafbd;});}})['then'](respondWithStatusCode(_0x3daadb,null))[_0xb16f('0x5f')](handleError(_0x3daadb,null));};exports[_0xb16f('0xb6')]=function(_0x44f287,_0x3b8745){var _0x220fc7,_0x259d50;return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x44f287['params']['id']},'attributes':['id','name',_0xb16f('0x3b')]})['then'](handleEntityNotFound(_0x3b8745,null))[_0xb16f('0x22')](function(_0x5eb898){if(_0x5eb898){_0x220fc7=_0x5eb898;if(!_0x44f287[_0xb16f('0x4f')][_0xb16f('0xa5')]||!utils['isValidChannel'](_0x44f287[_0xb16f('0x4f')][_0xb16f('0xa5')])){throw new db[(_0xb16f('0x99'))][(_0xb16f('0x9a'))](_0xb16f('0xa8'));}return _0x5eb898[_0xb16f('0xb7')+_['capitalize'](_0x44f287[_0xb16f('0x4f')][_0xb16f('0xa5')]['toLowerCase']())+_0xb16f('0xac')](_0x44f287['query'][_0xb16f('0x6b')]);}})[_0xb16f('0x22')](function(_0xe25a29){if(_[_0xb16f('0xb8')](_0x44f287[_0xb16f('0x4f')][_0xb16f('0x6b')])){for(var _0x2be567=0x0;_0x2be567<_0x44f287[_0xb16f('0x4f')][_0xb16f('0x6b')][_0xb16f('0x59')];_0x2be567+=0x1){_0x259d50={'UserId':Number(_0x44f287[_0xb16f('0x61')]['id'])};_0x259d50[_[_0xb16f('0xaa')](_0x44f287[_0xb16f('0x4f')][_0xb16f('0xa5')]['toLowerCase']())+_0xb16f('0xaf')]=Number(_0x44f287[_0xb16f('0x4f')][_0xb16f('0x6b')][_0x2be567]);socket[_0xb16f('0x2e')](_0xb16f('0x33')+_['capitalize'](_0x44f287['query'][_0xb16f('0xa5')][_0xb16f('0xab')]())+_0xb16f('0xb9'),_0x259d50);}}else{_0x259d50={'UserId':Number(_0x44f287[_0xb16f('0x61')]['id'])};_0x259d50[_['capitalize'](_0x44f287['query'][_0xb16f('0xa5')]['toLowerCase']())+_0xb16f('0xaf')]=Number(_0x44f287[_0xb16f('0x4f')][_0xb16f('0x6b')]);socket[_0xb16f('0x2e')](_0xb16f('0x33')+_[_0xb16f('0xaa')](_0x44f287[_0xb16f('0x4f')][_0xb16f('0xa5')][_0xb16f('0xab')]())+_0xb16f('0xb9'),_0x259d50);}return _0xe25a29;})[_0xb16f('0x22')](function(){if(_0x44f287['query'][_0xb16f('0xa5')]===_0xb16f('0xb0')){return db[_0xb16f('0xba')][_0xb16f('0x30')]({'where':{'UserId':_0x44f287[_0xb16f('0x61')]['id'],'VoiceQueueId':_0x44f287['query']['ids']},'individualHooks':!![]})[_0xb16f('0x22')](function(){return _0x220fc7;});}return _0x220fc7;})['then'](respondWithStatusCode(_0x3b8745,null))[_0xb16f('0x5f')](handleError(_0x3b8745,null));};exports['addAvatar']=function(_0x4f071b,_0xa2fb0e){_0x4f071b['body'][_0xb16f('0xbb')]=_0x4f071b[_0xb16f('0xbc')][_0xb16f('0xbd')];return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x4f071b[_0xb16f('0x61')]['id']}})['then'](handleEntityNotFound(_0xa2fb0e,null))[_0xb16f('0x22')](saveUpdates(_0x4f071b[_0xb16f('0x68')],null))[_0xb16f('0x22')](respondWithResult(_0xa2fb0e,null))['catch'](handleError(_0xa2fb0e,null));};exports[_0xb16f('0xbe')]=function(_0x3aa858,_0x29d51e){var _0x55933b=path[_0xb16f('0xbf')](config[_0xb16f('0xc0')],_0xb16f('0xc1'));return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x3aa858[_0xb16f('0x61')]['id']},'attributes':['id',_0xb16f('0xbb')],'raw':!![]})['then'](handleEntityNotFound(_0x29d51e,null))[_0xb16f('0x22')](function(_0x23d158){if(_0x23d158){if(_[_0xb16f('0x72')](_0x23d158[_0xb16f('0xbb')])){return _0x29d51e['download'](_0x55933b);}else{if(!fs[_0xb16f('0xc2')](path[_0xb16f('0xbf')](config['root'],_0xb16f('0xc3'),_0x23d158['userpic']))){return _0x29d51e[_0xb16f('0xc4')](_0x55933b);}return _0x29d51e['download'](path[_0xb16f('0xbf')](config[_0xb16f('0xc0')],_0xb16f('0xc3'),_0x23d158['userpic']));}}})[_0xb16f('0x5f')](handleError(_0x29d51e,null));};exports['getOpenTabs']=function(_0x5eac7d,_0x3ec77e){return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x5eac7d[_0xb16f('0x61')]['id']},'attributes':['id']})[_0xb16f('0x22')](handleEntityNotFound(_0x3ec77e,null))[_0xb16f('0x22')](function(_0x2d6016){var _0x425ecb=[];values=_0x2d6016[_0xb16f('0x5b')];_0x425ecb[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x5a'),_0x2d6016[_0xb16f('0x5b')]));_0x425ecb[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x5c'),_0x2d6016[_0xb16f('0x5b')]));_0x425ecb[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x65'),_0x2d6016[_0xb16f('0x5b')]));_0x425ecb[_0xb16f('0x56')](get_open_tabs('whatsapp',_0x2d6016[_0xb16f('0x5b')]));_0x425ecb[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x67'),_0x2d6016[_0xb16f('0x5b')]));_0x425ecb[_0xb16f('0x56')](get_open_tabs(_0xb16f('0x5d'),_0x2d6016[_0xb16f('0x5b')]));return Promise[_0xb16f('0x5e')](_0x425ecb);})[_0xb16f('0x22')](function(_0xb5656a){if(_0xb5656a){var _0x75b2cd=_['map'](values[_0xb16f('0xc5')],function(_0x223112){return{'channel':'CHAT','id':_0x223112['id'],'createdAt':_0x223112[_0xb16f('0xc6')]};});var _0x5c0ffa=_[_0xb16f('0x39')](values[_0xb16f('0xc7')],function(_0x5cdf1d){return{'channel':_0xb16f('0xc8'),'id':_0x5cdf1d['id'],'createdAt':_0x5cdf1d[_0xb16f('0xc6')]};});var _0x5ae56b=_['map'](values[_0xb16f('0xc9')],function(_0x287a6f){return{'channel':_0xb16f('0xca'),'id':_0x287a6f['id'],'createdAt':_0x287a6f[_0xb16f('0xc6')]};});var _0x512df4=_[_0xb16f('0x39')](values[_0xb16f('0xcb')],function(_0x1110d0){return{'channel':_0xb16f('0xcc'),'id':_0x1110d0['id'],'createdAt':_0x1110d0[_0xb16f('0xc6')]};});var _0x847548=_[_0xb16f('0x39')](values[_0xb16f('0xcd')],function(_0x572ff6){return{'channel':_0xb16f('0xce'),'id':_0x572ff6['id'],'createdAt':_0x572ff6[_0xb16f('0xc6')]};});var _0x3ca761=_[_0xb16f('0x39')](values[_0xb16f('0xcf')],function(_0x28241e){return{'channel':'WHATSAPP','id':_0x28241e['id'],'createdAt':_0x28241e[_0xb16f('0xc6')]};});var _0x32c4d4=_[_0xb16f('0xd0')](_0x75b2cd,_0x5c0ffa,_0x5ae56b,_0x512df4,_0x847548,_0x3ca761);var _0x6906b7={'count':_0x32c4d4[_0xb16f('0x59')],'rows':_0x32c4d4};return _0x6906b7;}else return null;})[_0xb16f('0x22')](respondWithResult(_0x3ec77e,null))[_0xb16f('0x5f')](handleError(_0x3ec77e,null));};exports['getContacts']=function(_0x4cfec5,_0xbe7d7f){var _0x26d407={};return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x4cfec5[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](function(_0x189aa3){if(!_0x189aa3){throw new APINotFoundError(util[_0xb16f('0xb3')](_0xb16f('0xd1'),_0x4cfec5[_0xb16f('0x61')]['id']));}return contacts[_0xb16f('0x69')]();})[_0xb16f('0x22')](function(_0x3ddb6c){_0x4cfec5['query'][_0xb16f('0x42')]=_0x4cfec5[_0xb16f('0x61')]['id'];_0x26d407=qs[_0xb16f('0x62')](_0x3ddb6c,_0x4cfec5);if(_0x4cfec5[_0xb16f('0x4f')][_0xb16f('0xd2')](_0xb16f('0x50'))){_0x26d407[_0xb16f('0x51')]=[{'model':db[_0xb16f('0xd3')],'as':_0xb16f('0xd4'),'required':![]},{'model':db[_0xb16f('0xd5')],'as':_0xb16f('0xd6'),'attributes':['id','name','color'],'where':_0x4cfec5[_0xb16f('0x4f')][_0xb16f('0xd7')]?{'id':_0x4cfec5[_0xb16f('0x4f')][_0xb16f('0xd7')]}:undefined,'required':_0x4cfec5['query']['tag']?!![]:![]}];}return contacts[_0xb16f('0x57')](_0x4cfec5[_0xb16f('0x4f')],_0x4cfec5['user'],_0x26d407,_0x3ddb6c);})['then'](respondWithFilteredResult(_0xbe7d7f,_0x26d407))['catch'](APIHandleError(_0xbe7d7f));};exports[_0xb16f('0xd8')]=function(_0x40adcc,_0x2125ea){var _0x51d864;var _0x294eb5={};var _0x2a396a;return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x40adcc[_0xb16f('0x61')]['id']},'attributes':['id',_0xb16f('0x3d'),_0xb16f('0x3b')]})[_0xb16f('0x22')](handleEntityNotFound(_0x2125ea,null))[_0xb16f('0x22')](function(_0x430cd2){if(!utils[_0xb16f('0xd9')](_0x40adcc[_0xb16f('0x4f')][_0xb16f('0xa5')])){throw new db[(_0xb16f('0x99'))][(_0xb16f('0x9a'))](_0xb16f('0xa8'));}_0x51d864=_0x430cd2;var _0xc08259={};_0xc08259[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db[_['capitalize'](_0x40adcc['query'][_0xb16f('0xa5')])+_0xb16f('0xdc')][_0xb16f('0x43')]);_0xc08259['query']=_['keys'](_0x40adcc['query']);_0xc08259[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0xc08259['model'],_0xc08259[_0xb16f('0x4f')]);_0x294eb5[_0xb16f('0x55')]=_[_0xb16f('0xde')](_0xc08259['model'],qs[_0xb16f('0xdf')](_0x40adcc[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x294eb5[_0xb16f('0x55')]=_0x294eb5[_0xb16f('0x55')][_0xb16f('0x59')]?_0x294eb5[_0xb16f('0x55')]:_0xc08259[_0xb16f('0xda')];_0x294eb5[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x40adcc[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0x294eb5[_0xb16f('0x4e')]=qs['filters'](_[_0xb16f('0xe2')](_0x40adcc['query'],_0xc08259[_0xb16f('0xdd')]));if(_0x40adcc['query'][_0xb16f('0x37')]){_0x294eb5['where']=_[_0xb16f('0xe3')](_0x294eb5[_0xb16f('0x4e')],{'$or':_[_0xb16f('0x39')](_0x294eb5[_0xb16f('0x55')],function(_0xe4ea78){var _0x375820={};_0x375820[_0xe4ea78]={'$like':'%'+_0x40adcc[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x375820;})});}_0x294eb5=_[_0xb16f('0xe3')]({},_0x294eb5,_0x40adcc[_0xb16f('0x63')]);switch(_0x51d864['role']){case'admin':return db[_[_0xb16f('0xaa')](_0x40adcc[_0xb16f('0x4f')]['channel'])+_0xb16f('0xdc')][_0xb16f('0x57')](_0x294eb5);case _0xb16f('0x33'):case _0xb16f('0x7d'):return _0x51d864['get'+_['capitalize'](_0x40adcc[_0xb16f('0x4f')][_0xb16f('0xa5')])+_0xb16f('0xac')](_0x294eb5);default:throw new db[(_0xb16f('0x99'))][(_0xb16f('0x9a'))]('Unknown\x20role');}})[_0xb16f('0x22')](function(_0x3a923a){_0x2a396a=_0x3a923a[_0xb16f('0x59')];if(!_0x40adcc['query'][_0xb16f('0xd2')](_0xb16f('0xe4'))){_0x294eb5[_0xb16f('0x1c')]=qs[_0xb16f('0x1c')](_0x40adcc['query'][_0xb16f('0x1c')]);_0x294eb5[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0x40adcc[_0xb16f('0x4f')][_0xb16f('0x1e')]);}switch(_0x51d864[_0xb16f('0x3b')]){case _0xb16f('0x32'):return db[_[_0xb16f('0xaa')](_0x40adcc[_0xb16f('0x4f')]['channel'])+_0xb16f('0xdc')]['findAll'](_0x294eb5);case _0xb16f('0x33'):case'agent':return _0x51d864[_0xb16f('0x31')+_[_0xb16f('0xaa')](_0x40adcc[_0xb16f('0x4f')][_0xb16f('0xa5')])+'Queues'](_0x294eb5);}})['then'](function(_0x4336f5){return{'count':_0x2a396a,'rows':_0x4336f5};})['then'](respondWithResult(_0x2125ea,null))['catch'](handleError(_0x2125ea,null));};exports[_0xb16f('0xe5')]=function(_0x2c6b46,_0x2bd6d1){var _0x5485b2={};var _0xd0ff92={};var _0x43535e;var _0x275467;return db[_0xb16f('0x42')][_0xb16f('0x9f')]({'where':{'id':_0x2c6b46['params']['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x2bd6d1,null))['then'](function(_0x4df8d2){if(_0x4df8d2){_0x43535e=_0x4df8d2;_0xd0ff92[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db[_0xb16f('0xba')][_0xb16f('0x43')]);_0xd0ff92[_0xb16f('0x4f')]=_[_0xb16f('0xdb')](_0x2c6b46['query']);_0xd0ff92['filters']=_['intersection'](_0xd0ff92[_0xb16f('0xda')],_0xd0ff92[_0xb16f('0x4f')]);_0x5485b2['attributes']=_[_0xb16f('0xde')](_0xd0ff92['model'],qs[_0xb16f('0xdf')](_0x2c6b46[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x5485b2['attributes']=_0x5485b2['attributes'][_0xb16f('0x59')]?_0x5485b2[_0xb16f('0x55')]:_0xd0ff92['model'];_0x5485b2[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x2c6b46[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0x5485b2['where']=qs[_0xb16f('0xdd')](_[_0xb16f('0xe2')](_0x2c6b46[_0xb16f('0x4f')],_0xd0ff92[_0xb16f('0xdd')]));if(_0x2c6b46[_0xb16f('0x4f')][_0xb16f('0x37')]){_0x5485b2[_0xb16f('0x4e')]=_['merge'](_0x5485b2[_0xb16f('0x4e')],{'$or':_['map'](_0x5485b2[_0xb16f('0x55')],function(_0x3ee558){var _0x129ad3={};_0x129ad3[_0x3ee558]={'$like':'%'+_0x2c6b46[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x129ad3;})});}_0x5485b2=_[_0xb16f('0xe3')]({},_0x5485b2,_0x2c6b46['options']);return _0x43535e[_0xb16f('0xe5')](_0x5485b2);}})[_0xb16f('0x22')](function(_0x5b5c55){if(_0x5b5c55){_0x275467=_0x5b5c55[_0xb16f('0x59')];if(!_0x2c6b46[_0xb16f('0x4f')][_0xb16f('0xd2')](_0xb16f('0xe4'))){_0x5485b2[_0xb16f('0x1c')]=qs['limit'](_0x2c6b46[_0xb16f('0x4f')]['limit']);_0x5485b2[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0x2c6b46[_0xb16f('0x4f')]['offset']);}return _0x43535e[_0xb16f('0xe5')](_0x5485b2);}})[_0xb16f('0x22')](function(_0x5cf091){if(_0x5cf091){return _0x5cf091?{'count':_0x275467,'rows':_0x5cf091}:null;}})['then'](respondWithResult(_0x2bd6d1,null))['catch'](handleError(_0x2bd6d1,null));};exports[_0xb16f('0xe6')]=function(_0x584def,_0xc9b472){var _0x121609={};var _0x2f1fd8={};var _0x7cde8a;var _0x26c5cc;return db[_0xb16f('0x42')][_0xb16f('0x9f')]({'where':{'id':_0x584def[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0xc9b472,null))['then'](function(_0x2d9830){if(_0x2d9830){_0x7cde8a=_0x2d9830;_0x2f1fd8['model']=_['keys'](db[_0xb16f('0xe7')][_0xb16f('0x43')]);_0x2f1fd8[_0xb16f('0x4f')]=_[_0xb16f('0xdb')](_0x584def[_0xb16f('0x4f')]);_0x2f1fd8[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0x2f1fd8['model'],_0x2f1fd8[_0xb16f('0x4f')]);_0x121609[_0xb16f('0x55')]=_['intersection'](_0x2f1fd8[_0xb16f('0xda')],qs[_0xb16f('0xdf')](_0x584def[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x121609['attributes']=_0x121609[_0xb16f('0x55')][_0xb16f('0x59')]?_0x121609[_0xb16f('0x55')]:_0x2f1fd8[_0xb16f('0xda')];_0x121609['order']=qs[_0xb16f('0xe1')](_0x584def[_0xb16f('0x4f')]['sort']);_0x121609['where']=qs[_0xb16f('0xdd')](_['pick'](_0x584def[_0xb16f('0x4f')],_0x2f1fd8[_0xb16f('0xdd')]));if(_0x584def['query'][_0xb16f('0x37')]){_0x121609[_0xb16f('0x4e')]=_[_0xb16f('0xe3')](_0x121609[_0xb16f('0x4e')],{'$or':_['map'](_0x121609[_0xb16f('0x55')],function(_0x184191){var _0x33db9a={};_0x33db9a[_0x184191]={'$like':'%'+_0x584def[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x33db9a;})});}_0x121609=_[_0xb16f('0xe3')]({},_0x121609,_0x584def[_0xb16f('0x63')]);return _0x7cde8a[_0xb16f('0xe6')](_0x121609);}})[_0xb16f('0x22')](function(_0x4ed882){if(_0x4ed882){_0x26c5cc=_0x4ed882[_0xb16f('0x59')];if(!_0x584def[_0xb16f('0x4f')]['hasOwnProperty']('nolimit')){_0x121609['limit']=qs[_0xb16f('0x1c')](_0x584def[_0xb16f('0x4f')][_0xb16f('0x1c')]);_0x121609[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0x584def[_0xb16f('0x4f')][_0xb16f('0x1e')]);}return _0x7cde8a[_0xb16f('0xe6')](_0x121609);}})[_0xb16f('0x22')](function(_0x279e38){if(_0x279e38){return _0x279e38?{'count':_0x26c5cc,'rows':_0x279e38}:null;}})[_0xb16f('0x22')](respondWithResult(_0xc9b472,null))[_0xb16f('0x5f')](handleError(_0xc9b472,null));};exports[_0xb16f('0xe8')]=function(_0x912b9,_0x1a3483){var _0xe294db={'raw':!![],'where':{}};var _0x128da8={};var _0x1544b0={'count':0x0,'rows':[]};return db[_0xb16f('0x42')][_0xb16f('0x9f')]({'where':{'id':_0x912b9[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x1a3483,null))[_0xb16f('0x22')](function(_0x3cb9f7){if(_0x3cb9f7){_0x128da8[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db[_0xb16f('0xe9')][_0xb16f('0x43')]);_0x128da8['query']=_[_0xb16f('0xdb')](_0x912b9[_0xb16f('0x4f')]);_0x128da8[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0x128da8[_0xb16f('0xda')],_0x128da8[_0xb16f('0x4f')]);_0xe294db[_0xb16f('0x55')]=_[_0xb16f('0xde')](_0x128da8[_0xb16f('0xda')],qs['fields'](_0x912b9[_0xb16f('0x4f')]['fields']));_0xe294db[_0xb16f('0x55')]=_0xe294db['attributes'][_0xb16f('0x59')]?_0xe294db[_0xb16f('0x55')]:_0x128da8[_0xb16f('0xda')];if(!_0x912b9[_0xb16f('0x4f')][_0xb16f('0xd2')](_0xb16f('0xe4'))){_0xe294db['limit']=qs[_0xb16f('0x1c')](_0x912b9['query']['limit']);_0xe294db['offset']=qs[_0xb16f('0x1e')](_0x912b9[_0xb16f('0x4f')]['offset']);}_0xe294db[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x912b9[_0xb16f('0x4f')]['sort']);_0xe294db[_0xb16f('0x4e')]=qs['filters'](_['pick'](_0x912b9[_0xb16f('0x4f')],_0x128da8[_0xb16f('0xdd')]));_0xe294db[_0xb16f('0x4e')]['UserId']=_0x3cb9f7['id'];if(_0x912b9['query']['filter']){_0xe294db[_0xb16f('0x4e')]=_[_0xb16f('0xe3')](_0xe294db[_0xb16f('0x4e')],{'$or':_[_0xb16f('0x39')](_0xe294db[_0xb16f('0x55')],function(_0x152a99){var _0x8c4331={};_0x8c4331[_0x152a99]={'$like':'%'+_0x912b9[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x8c4331;})});}_0xe294db=_[_0xb16f('0xe3')]({},_0xe294db,_0x912b9[_0xb16f('0x63')]);return db[_0xb16f('0xe9')][_0xb16f('0x1d')]({'where':_0xe294db[_0xb16f('0x4e')]})['then'](function(_0x17884a){_0x1544b0['count']=_0x17884a;if(_0x912b9['query'][_0xb16f('0x50')]){_0xe294db[_0xb16f('0x51')]=[{'all':!![]}];}return db[_0xb16f('0xe9')][_0xb16f('0x57')](_0xe294db);})[_0xb16f('0x22')](function(_0x18f8bd){_0x1544b0[_0xb16f('0x58')]=_0x18f8bd;return _0x1544b0;});}})[_0xb16f('0x22')](respondWithFilteredResult(_0x1a3483,_0xe294db))[_0xb16f('0x5f')](handleError(_0x1a3483,null));};exports[_0xb16f('0xea')]=function(_0x37e86e,_0x2ef773){var _0x497a38={'raw':!![],'where':{}};var _0x3e2a2d={};var _0xcc7137={'count':0x0,'rows':[]};return db[_0xb16f('0x42')][_0xb16f('0x9f')]({'where':{'id':_0x37e86e[_0xb16f('0x61')]['id']}})['then'](handleEntityNotFound(_0x2ef773,null))[_0xb16f('0x22')](function(_0x4d69eb){if(_0x4d69eb){_0x3e2a2d[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db[_0xb16f('0xeb')]['rawAttributes']);_0x3e2a2d[_0xb16f('0x4f')]=_[_0xb16f('0xdb')](_0x37e86e[_0xb16f('0x4f')]);_0x3e2a2d[_0xb16f('0xdd')]=_['intersection'](_0x3e2a2d['model'],_0x3e2a2d[_0xb16f('0x4f')]);_0x497a38['attributes']=_[_0xb16f('0xde')](_0x3e2a2d[_0xb16f('0xda')],qs['fields'](_0x37e86e[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x497a38['attributes']=_0x497a38[_0xb16f('0x55')]['length']?_0x497a38[_0xb16f('0x55')]:_0x3e2a2d[_0xb16f('0xda')];if(!_0x37e86e[_0xb16f('0x4f')][_0xb16f('0xd2')](_0xb16f('0xe4'))){_0x497a38[_0xb16f('0x1c')]=qs[_0xb16f('0x1c')](_0x37e86e[_0xb16f('0x4f')][_0xb16f('0x1c')]);_0x497a38[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0x37e86e[_0xb16f('0x4f')][_0xb16f('0x1e')]);}_0x497a38[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x37e86e[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0x497a38[_0xb16f('0x4e')]=qs[_0xb16f('0xdd')](_[_0xb16f('0xe2')](_0x37e86e[_0xb16f('0x4f')],_0x3e2a2d[_0xb16f('0xdd')]));_0x497a38['where'][_0xb16f('0xec')]=_0x4d69eb['id'];if(_0x37e86e['query'][_0xb16f('0x37')]){_0x497a38[_0xb16f('0x4e')]=_[_0xb16f('0xe3')](_0x497a38[_0xb16f('0x4e')],{'$or':_[_0xb16f('0x39')](_0x497a38['attributes'],function(_0x4df896){var _0x39ccdd={};_0x39ccdd[_0x4df896]={'$like':'%'+_0x37e86e['query'][_0xb16f('0x37')]+'%'};return _0x39ccdd;})});}_0x497a38=_[_0xb16f('0xe3')]({},_0x497a38,_0x37e86e['options']);return db['ScreenRecording']['count']({'where':_0x497a38[_0xb16f('0x4e')]})[_0xb16f('0x22')](function(_0x46697b){_0xcc7137[_0xb16f('0x1d')]=_0x46697b;if(_0x37e86e['query']['includeAll']){_0x497a38[_0xb16f('0x51')]=[{'all':!![]}];}return db[_0xb16f('0xeb')][_0xb16f('0x57')](_0x497a38);})[_0xb16f('0x22')](function(_0x10e59e){_0xcc7137[_0xb16f('0x58')]=_0x10e59e;return _0xcc7137;});}})[_0xb16f('0x22')](respondWithFilteredResult(_0x2ef773,_0x497a38))[_0xb16f('0x5f')](handleError(_0x2ef773,null));};exports[_0xb16f('0xed')]=function(_0xca3a62,_0x4ae41b){var _0xae6a58={};var _0x5467d0={};var _0x533469;var _0x57a396;return db['User']['findOne']({'where':{'id':_0xca3a62[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x4ae41b,null))['then'](function(_0xa1bfec){if(_0xa1bfec){_0x533469=_0xa1bfec;_0x5467d0[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db[_0xb16f('0xee')][_0xb16f('0x43')]);_0x5467d0['query']=_['keys'](_0xca3a62['query']);_0x5467d0[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0x5467d0[_0xb16f('0xda')],_0x5467d0['query']);_0xae6a58['attributes']=_[_0xb16f('0xde')](_0x5467d0[_0xb16f('0xda')],qs['fields'](_0xca3a62['query'][_0xb16f('0xdf')]));_0xae6a58[_0xb16f('0x55')]=_0xae6a58[_0xb16f('0x55')][_0xb16f('0x59')]?_0xae6a58[_0xb16f('0x55')]:_0x5467d0['model'];_0xae6a58[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0xca3a62[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0xae6a58[_0xb16f('0x4e')]=qs[_0xb16f('0xdd')](_[_0xb16f('0xe2')](_0xca3a62[_0xb16f('0x4f')],_0x5467d0[_0xb16f('0xdd')]));if(_0xca3a62[_0xb16f('0x4f')][_0xb16f('0x37')]){_0xae6a58[_0xb16f('0x4e')]=_[_0xb16f('0xe3')](_0xae6a58[_0xb16f('0x4e')],{'$or':_[_0xb16f('0x39')](_0xae6a58['attributes'],function(_0x12d9ae){var _0x204b2d={};_0x204b2d[_0x12d9ae]={'$like':'%'+_0xca3a62[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x204b2d;})});}_0xae6a58=_['merge']({},_0xae6a58,_0xca3a62[_0xb16f('0x63')]);return _0x533469[_0xb16f('0xed')](_0xae6a58);}})[_0xb16f('0x22')](function(_0x12deb6){if(_0x12deb6){_0x57a396=_0x12deb6[_0xb16f('0x59')];if(!_0xca3a62[_0xb16f('0x4f')]['hasOwnProperty']('nolimit')){_0xae6a58[_0xb16f('0x1c')]=qs['limit'](_0xca3a62[_0xb16f('0x4f')]['limit']);_0xae6a58[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0xca3a62['query'][_0xb16f('0x1e')]);}return _0x533469['getChatInteractions'](_0xae6a58);}})[_0xb16f('0x22')](function(_0x25914e){if(_0x25914e){return _0x25914e?{'count':_0x57a396,'rows':_0x25914e}:null;}})[_0xb16f('0x22')](respondWithResult(_0x4ae41b,null))[_0xb16f('0x5f')](handleError(_0x4ae41b,null));};exports[_0xb16f('0xef')]=function(_0x4ae673,_0xdec513){var _0x4bbda7={};var _0xd8738d={};var _0x5c16a9;var _0x23f2bc;return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x4ae673[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0xdec513,null))['then'](function(_0x1fad5a){if(_0x1fad5a){_0x5c16a9=_0x1fad5a;_0xd8738d[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db['OpenchannelInteraction'][_0xb16f('0x43')]);_0xd8738d[_0xb16f('0x4f')]=_['keys'](_0x4ae673[_0xb16f('0x4f')]);_0xd8738d[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0xd8738d[_0xb16f('0xda')],_0xd8738d[_0xb16f('0x4f')]);_0x4bbda7[_0xb16f('0x55')]=_[_0xb16f('0xde')](_0xd8738d['model'],qs[_0xb16f('0xdf')](_0x4ae673[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x4bbda7[_0xb16f('0x55')]=_0x4bbda7[_0xb16f('0x55')][_0xb16f('0x59')]?_0x4bbda7[_0xb16f('0x55')]:_0xd8738d['model'];_0x4bbda7[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x4ae673[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0x4bbda7[_0xb16f('0x4e')]=qs['filters'](_['pick'](_0x4ae673[_0xb16f('0x4f')],_0xd8738d[_0xb16f('0xdd')]));if(_0x4ae673[_0xb16f('0x4f')][_0xb16f('0x37')]){_0x4bbda7['where']=_[_0xb16f('0xe3')](_0x4bbda7[_0xb16f('0x4e')],{'$or':_[_0xb16f('0x39')](_0x4bbda7['attributes'],function(_0x4eaed9){var _0x29689c={};_0x29689c[_0x4eaed9]={'$like':'%'+_0x4ae673[_0xb16f('0x4f')]['filter']+'%'};return _0x29689c;})});}_0x4bbda7=_[_0xb16f('0xe3')]({},_0x4bbda7,_0x4ae673[_0xb16f('0x63')]);return _0x5c16a9['getOpenchannelInteractions'](_0x4bbda7);}})['then'](function(_0x308ee4){if(_0x308ee4){_0x23f2bc=_0x308ee4['length'];if(!_0x4ae673[_0xb16f('0x4f')]['hasOwnProperty'](_0xb16f('0xe4'))){_0x4bbda7[_0xb16f('0x1c')]=qs[_0xb16f('0x1c')](_0x4ae673[_0xb16f('0x4f')]['limit']);_0x4bbda7[_0xb16f('0x1e')]=qs['offset'](_0x4ae673[_0xb16f('0x4f')][_0xb16f('0x1e')]);}return _0x5c16a9[_0xb16f('0xef')](_0x4bbda7);}})[_0xb16f('0x22')](function(_0xefe6d9){if(_0xefe6d9){return _0xefe6d9?{'count':_0x23f2bc,'rows':_0xefe6d9}:null;}})['then'](respondWithResult(_0xdec513,null))[_0xb16f('0x5f')](handleError(_0xdec513,null));};exports[_0xb16f('0xf0')]=function(_0x52e874,_0x3c34d8){var _0x3bc464={'raw':!![],'where':{}};var _0x1f6fcc={};var _0x621316={'count':0x0,'rows':[]};return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x52e874['params']['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x3c34d8,null))[_0xb16f('0x22')](function(_0x45093f){if(_0x45093f){_0x1f6fcc['model']=_['keys'](db[_0xb16f('0xf1')][_0xb16f('0x43')]);_0x1f6fcc[_0xb16f('0x4f')]=_['keys'](_0x52e874[_0xb16f('0x4f')]);_0x1f6fcc['filters']=_[_0xb16f('0xde')](_0x1f6fcc[_0xb16f('0xda')],_0x1f6fcc[_0xb16f('0x4f')]);_0x3bc464['attributes']=_['intersection'](_0x1f6fcc[_0xb16f('0xda')],qs[_0xb16f('0xdf')](_0x52e874[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x3bc464['attributes']=_0x3bc464[_0xb16f('0x55')][_0xb16f('0x59')]?_0x3bc464[_0xb16f('0x55')]:_0x1f6fcc[_0xb16f('0xda')];if(!_0x52e874[_0xb16f('0x4f')][_0xb16f('0xd2')](_0xb16f('0xe4'))){_0x3bc464[_0xb16f('0x1c')]=qs[_0xb16f('0x1c')](_0x52e874[_0xb16f('0x4f')][_0xb16f('0x1c')]);_0x3bc464['offset']=qs['offset'](_0x52e874[_0xb16f('0x4f')][_0xb16f('0x1e')]);}_0x3bc464['order']=qs[_0xb16f('0xe1')](_0x52e874[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0x3bc464[_0xb16f('0x4e')]=qs[_0xb16f('0xdd')](_[_0xb16f('0xe2')](_0x52e874[_0xb16f('0x4f')],_0x1f6fcc[_0xb16f('0xdd')]));_0x3bc464[_0xb16f('0x4e')][_0xb16f('0xec')]=_0x45093f['id'];if(_0x52e874[_0xb16f('0x4f')][_0xb16f('0x37')]){_0x3bc464['where']=_[_0xb16f('0xe3')](_0x3bc464['where'],{'$or':_[_0xb16f('0x39')](_0x3bc464[_0xb16f('0x55')],function(_0xe69835){var _0xbe5f99={};_0xbe5f99[_0xe69835]={'$like':'%'+_0x52e874[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0xbe5f99;})});}_0x3bc464=_[_0xb16f('0xe3')]({},_0x3bc464,_0x52e874[_0xb16f('0x63')]);return db[_0xb16f('0xf1')][_0xb16f('0x1d')]({'where':_0x3bc464[_0xb16f('0x4e')]})[_0xb16f('0x22')](function(_0x11ff8a){_0x621316[_0xb16f('0x1d')]=_0x11ff8a;if(_0x52e874[_0xb16f('0x4f')][_0xb16f('0x50')]){_0x3bc464[_0xb16f('0x51')]=[{'all':!![]}];}return db[_0xb16f('0xf1')][_0xb16f('0x57')](_0x3bc464);})[_0xb16f('0x22')](function(_0x4755ed){_0x621316[_0xb16f('0x58')]=_0x4755ed;return _0x621316;});}})['then'](respondWithFilteredResult(_0x3c34d8,_0x3bc464))[_0xb16f('0x5f')](handleError(_0x3c34d8,null));};exports['getSmsInteractions']=function(_0x586ea1,_0x3a020c){var _0x2a779e={};var _0x15a077={};var _0x462cda;var _0x1aa990;return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x586ea1[_0xb16f('0x61')]['id']}})['then'](handleEntityNotFound(_0x3a020c,null))[_0xb16f('0x22')](function(_0x430f35){if(_0x430f35){_0x462cda=_0x430f35;_0x15a077[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db[_0xb16f('0xf2')][_0xb16f('0x43')]);_0x15a077['query']=_[_0xb16f('0xdb')](_0x586ea1[_0xb16f('0x4f')]);_0x15a077[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0x15a077[_0xb16f('0xda')],_0x15a077['query']);_0x2a779e[_0xb16f('0x55')]=_[_0xb16f('0xde')](_0x15a077[_0xb16f('0xda')],qs[_0xb16f('0xdf')](_0x586ea1[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x2a779e['attributes']=_0x2a779e['attributes'][_0xb16f('0x59')]?_0x2a779e['attributes']:_0x15a077['model'];_0x2a779e[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x586ea1[_0xb16f('0x4f')]['sort']);_0x2a779e[_0xb16f('0x4e')]=qs[_0xb16f('0xdd')](_[_0xb16f('0xe2')](_0x586ea1['query'],_0x15a077[_0xb16f('0xdd')]));if(_0x586ea1[_0xb16f('0x4f')]['filter']){_0x2a779e[_0xb16f('0x4e')]=_['merge'](_0x2a779e[_0xb16f('0x4e')],{'$or':_[_0xb16f('0x39')](_0x2a779e[_0xb16f('0x55')],function(_0x14f2c9){var _0x36f32a={};_0x36f32a[_0x14f2c9]={'$like':'%'+_0x586ea1[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x36f32a;})});}_0x2a779e=_[_0xb16f('0xe3')]({},_0x2a779e,_0x586ea1[_0xb16f('0x63')]);return _0x462cda[_0xb16f('0xf3')](_0x2a779e);}})[_0xb16f('0x22')](function(_0x15a5f7){if(_0x15a5f7){_0x1aa990=_0x15a5f7[_0xb16f('0x59')];if(!_0x586ea1[_0xb16f('0x4f')][_0xb16f('0xd2')](_0xb16f('0xe4'))){_0x2a779e[_0xb16f('0x1c')]=qs['limit'](_0x586ea1[_0xb16f('0x4f')][_0xb16f('0x1c')]);_0x2a779e[_0xb16f('0x1e')]=qs['offset'](_0x586ea1['query'][_0xb16f('0x1e')]);}return _0x462cda[_0xb16f('0xf3')](_0x2a779e);}})['then'](function(_0x920a2a){if(_0x920a2a){return _0x920a2a?{'count':_0x1aa990,'rows':_0x920a2a}:null;}})['then'](respondWithResult(_0x3a020c,null))[_0xb16f('0x5f')](handleError(_0x3a020c,null));};exports[_0xb16f('0xf4')]=function(_0x465e72,_0x192cbd){var _0x5e2aa7={};var _0x4976e2={};var _0x22e767;var _0xfb2b62;return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x465e72[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x192cbd,null))['then'](function(_0x13ad09){if(_0x13ad09){_0x22e767=_0x13ad09;_0x4976e2[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db[_0xb16f('0xf5')]['rawAttributes']);_0x4976e2[_0xb16f('0x4f')]=_[_0xb16f('0xdb')](_0x465e72[_0xb16f('0x4f')]);_0x4976e2[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0x4976e2[_0xb16f('0xda')],_0x4976e2[_0xb16f('0x4f')]);_0x5e2aa7['attributes']=_[_0xb16f('0xde')](_0x4976e2[_0xb16f('0xda')],qs['fields'](_0x465e72[_0xb16f('0x4f')]['fields']));_0x5e2aa7[_0xb16f('0x55')]=_0x5e2aa7[_0xb16f('0x55')][_0xb16f('0x59')]?_0x5e2aa7[_0xb16f('0x55')]:_0x4976e2['model'];_0x5e2aa7[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x465e72[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0x5e2aa7[_0xb16f('0x4e')]=qs['filters'](_[_0xb16f('0xe2')](_0x465e72[_0xb16f('0x4f')],_0x4976e2['filters']));if(_0x465e72[_0xb16f('0x4f')][_0xb16f('0x37')]){_0x5e2aa7[_0xb16f('0x4e')]=_[_0xb16f('0xe3')](_0x5e2aa7['where'],{'$or':_[_0xb16f('0x39')](_0x5e2aa7['attributes'],function(_0x5daab6){var _0x21c639={};_0x21c639[_0x5daab6]={'$like':'%'+_0x465e72[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x21c639;})});}_0x5e2aa7=_[_0xb16f('0xe3')]({},_0x5e2aa7,_0x465e72[_0xb16f('0x63')]);return _0x22e767['getFaxInteractions'](_0x5e2aa7);}})[_0xb16f('0x22')](function(_0x3584ef){if(_0x3584ef){_0xfb2b62=_0x3584ef['length'];if(!_0x465e72[_0xb16f('0x4f')][_0xb16f('0xd2')](_0xb16f('0xe4'))){_0x5e2aa7[_0xb16f('0x1c')]=qs['limit'](_0x465e72[_0xb16f('0x4f')][_0xb16f('0x1c')]);_0x5e2aa7[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0x465e72[_0xb16f('0x4f')][_0xb16f('0x1e')]);}return _0x22e767['getFaxInteractions'](_0x5e2aa7);}})[_0xb16f('0x22')](function(_0x27de13){if(_0x27de13){return _0x27de13?{'count':_0xfb2b62,'rows':_0x27de13}:null;}})[_0xb16f('0x22')](respondWithResult(_0x192cbd,null))[_0xb16f('0x5f')](handleError(_0x192cbd,null));};exports[_0xb16f('0xf6')]=function(_0x430ccc,_0x7b447f){var _0x19a2b0={};var _0x314852={};var _0xf21ea8;var _0x3f3307;return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x430ccc['params']['id']}})['then'](handleEntityNotFound(_0x7b447f,null))[_0xb16f('0x22')](function(_0x35766a){if(_0x35766a){_0xf21ea8=_0x35766a;_0x314852[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db['WhatsappInteraction']['rawAttributes']);_0x314852[_0xb16f('0x4f')]=_[_0xb16f('0xdb')](_0x430ccc[_0xb16f('0x4f')]);_0x314852['filters']=_[_0xb16f('0xde')](_0x314852[_0xb16f('0xda')],_0x314852[_0xb16f('0x4f')]);_0x19a2b0['attributes']=_[_0xb16f('0xde')](_0x314852[_0xb16f('0xda')],qs[_0xb16f('0xdf')](_0x430ccc[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x19a2b0[_0xb16f('0x55')]=_0x19a2b0[_0xb16f('0x55')][_0xb16f('0x59')]?_0x19a2b0['attributes']:_0x314852[_0xb16f('0xda')];_0x19a2b0[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x430ccc['query'][_0xb16f('0xe1')]);_0x19a2b0[_0xb16f('0x4e')]=qs[_0xb16f('0xdd')](_['pick'](_0x430ccc[_0xb16f('0x4f')],_0x314852['filters']));if(_0x430ccc[_0xb16f('0x4f')]['filter']){_0x19a2b0[_0xb16f('0x4e')]=_[_0xb16f('0xe3')](_0x19a2b0[_0xb16f('0x4e')],{'$or':_[_0xb16f('0x39')](_0x19a2b0[_0xb16f('0x55')],function(_0xc57eaf){var _0x296276={};_0x296276[_0xc57eaf]={'$like':'%'+_0x430ccc[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x296276;})});}_0x19a2b0=_['merge']({},_0x19a2b0,_0x430ccc['options']);return _0xf21ea8[_0xb16f('0xf6')](_0x19a2b0);}})[_0xb16f('0x22')](function(_0x670fcf){if(_0x670fcf){_0x3f3307=_0x670fcf[_0xb16f('0x59')];if(!_0x430ccc['query'][_0xb16f('0xd2')](_0xb16f('0xe4'))){_0x19a2b0[_0xb16f('0x1c')]=qs['limit'](_0x430ccc[_0xb16f('0x4f')][_0xb16f('0x1c')]);_0x19a2b0[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0x430ccc[_0xb16f('0x4f')][_0xb16f('0x1e')]);}return _0xf21ea8[_0xb16f('0xf6')](_0x19a2b0);}})[_0xb16f('0x22')](function(_0x3bc3c3){if(_0x3bc3c3){return _0x3bc3c3?{'count':_0x3f3307,'rows':_0x3bc3c3}:null;}})['then'](respondWithResult(_0x7b447f,null))['catch'](handleError(_0x7b447f,null));};exports[_0xb16f('0xf7')]=function(_0x1c3bcc,_0x3aa5d9,_0x176805){var _0x2d35f8;var _0x181ec1;var _0x43233d;var _0x229fc6=!_['isNil'](_0x1c3bcc[_0xb16f('0x61')]['id'])?_0x1c3bcc[_0xb16f('0x61')]['id']:!_[_0xb16f('0x72')](_0x1c3bcc[_0xb16f('0x33')]['id'])?_0x1c3bcc['user']['id']:null;return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x229fc6,'role':{'$or':[_0xb16f('0x32'),_0xb16f('0x33'),_0xb16f('0x7d')]}},'attributes':['id','name',_0xb16f('0xf8'),_0xb16f('0xf9'),_0xb16f('0x3b'),_0xb16f('0x6d'),_0xb16f('0xa6')]})[_0xb16f('0x22')](function(_0x5aea64){if(_0x5aea64){if(_0x5aea64['role']===_0xb16f('0x7d')){_0x2d35f8=_0x5aea64;if(_0x1c3bcc[_0xb16f('0x68')][_0xb16f('0xa7')]){_0x43233d=util[_0xb16f('0xb3')](_0xb16f('0xfa'),_0x2d35f8[_0x1c3bcc[_0xb16f('0x68')]['interface']]);}else if(_0x1c3bcc[_0xb16f('0x68')]['intrf']){_0x43233d=util[_0xb16f('0xb3')]('SIP/%s',_0x1c3bcc[_0xb16f('0x68')][_0xb16f('0xfb')]);}else{_0x43233d=util[_0xb16f('0xb3')](_0xb16f('0xb4'),_0x2d35f8[_0xb16f('0x3d')]);}socket['to'](util[_0xb16f('0xb3')](_0xb16f('0xfc'),_0x2d35f8[_0xb16f('0x3d')]))[_0xb16f('0x2e')]('user:forcelogout',{'user':{'id':_0x2d35f8['id'],'name':_0x2d35f8[_0xb16f('0x3d')]},'ip':_0x1c3bcc['headers'][_0xb16f('0xfd')]||_0x1c3bcc[_0xb16f('0xfe')]['remoteAddress']||_0x1c3bcc[_0xb16f('0xff')][_0xb16f('0x100')]||_0x1c3bcc[_0xb16f('0xfe')][_0xb16f('0xff')][_0xb16f('0x100')]});return db['UserVoiceQueueRt'][_0xb16f('0x30')]({'where':{'membername':_0x2d35f8[_0xb16f('0x3d')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xb16f('0x9a'))](_0xb16f('0x101'));}})[_0xb16f('0x22')](function(){if(_0x2d35f8){return _0x2d35f8[_0xb16f('0x102')]({'raw':!![]});}})[_0xb16f('0x22')](function(_0x5ecfc3){if(_0x2d35f8){if(_0x5ecfc3){_0x181ec1=_0x5ecfc3;if(_0x181ec1[_0xb16f('0x59')]){var _0x24ea5e=_0x181ec1[_0xb16f('0x39')](function(_0x15ade6){var _0x35d3c4={'membername':_0x2d35f8[_0xb16f('0x3d')],'UserId':_0x2d35f8['id'],'queue_name':_0x15ade6[_0xb16f('0x3d')],'VoiceQueueId':_0x15ade6['id'],'interface':_0x43233d,'paused':_0x2d35f8['loginInPause']||![],'penalty':_0x15ade6['UserVoiceQueue.penalty']||0x0};return db[_0xb16f('0xba')]['upsert'](_0x35d3c4);});return Promise[_0xb16f('0x5e')](_0x24ea5e);}}}})[_0xb16f('0x22')](function(){if(_0x2d35f8){return db['MemberReport']['findAll']({'where':{'membername':_0x2d35f8[_0xb16f('0x3d')],'exitAt':null}});}})[_0xb16f('0x22')](function(_0x195b90){if(_0x2d35f8){var _0xdbcaec=[];_0x195b90[_0xb16f('0x103')](function(_0x3aed2d){_0xdbcaec['push'](_0x3aed2d['update']({'exitAt':moment()['format'](_0xb16f('0x104'))}));});return Promise[_0xb16f('0x5e')](_0xdbcaec);}})[_0xb16f('0x22')](function(){if(_0x2d35f8){var _0x595f4f=[];var _0x56232e=[];var _0x1cd163=utils[_0xb16f('0x105')]();var _0x2dff02={'membername':_0x2d35f8[_0xb16f('0x3d')],'interface':_0x43233d,'enterAt':moment()[_0xb16f('0xb3')](_0xb16f('0x104')),'role':_0x2d35f8[_0xb16f('0x3b')],'internal':_0x2d35f8[_0xb16f('0x6d')]};_0x1cd163[_0xb16f('0x103')](function(_0x1d9453){_0x595f4f[_0xb16f('0x56')](_[_0xb16f('0xe3')]({'channel':_0x1d9453,'type':_0xb16f('0x106'),'data1':_0x1c3bcc['body']['device'],'data2':_0x43233d},_0x2dff02));if(_0x2d35f8[_0xb16f('0xa6')]){_0x56232e['push'](_[_0xb16f('0xe3')]({'channel':_0x1d9453,'type':_0xb16f('0x107'),'data1':'LOGININPAUSE'},_0x2dff02));}});return db[_0xb16f('0x108')][_0xb16f('0x8f')](_0x595f4f[_0xb16f('0xd0')](_0x56232e),{'individualHooks':!![]});}})['then'](function(){if(_0x2d35f8){return _0x2d35f8[_0xb16f('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xb16f('0xb3')](_0xb16f('0x104')),'voicePause':_0x2d35f8[_0xb16f('0xa6')]||![],'mailPause':_0x2d35f8[_0xb16f('0xa6')]||![],'chatPause':_0x2d35f8['loginInPause']||![],'faxPause':_0x2d35f8[_0xb16f('0xa6')]||![],'smsPause':_0x2d35f8[_0xb16f('0xa6')]||![],'openchannelPause':_0x2d35f8['loginInPause']||![],'whatsappPause':_0x2d35f8[_0xb16f('0xa6')]||![],'pauseType':_0x2d35f8[_0xb16f('0xa6')]?'LOGININPAUSE':null,'interface':_0x43233d,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb16f('0x22')](function(_0x3d09f2){if(_0x1c3bcc[_0xb16f('0x109')]){return _0x176805();}else{return Promise['resolve'](_0x3d09f2)[_0xb16f('0x22')](respondWithResult(_0x3aa5d9,null));}})[_0xb16f('0x5f')](handleError(_0x3aa5d9,null));};exports[_0xb16f('0x10a')]=function(_0x408587,_0x5f06ce){var _0x44627f;return db[_0xb16f('0x42')][_0xb16f('0x3c')]({'where':{'id':_0x408587[_0xb16f('0x61')]['id'],'role':_0xb16f('0x7d')},'attributes':['id',_0xb16f('0x3d'),_0xb16f('0x3b')]})[_0xb16f('0x22')](handleEntityNotFound(_0x5f06ce,null))[_0xb16f('0x22')](function(_0x38f672){if(_0x38f672){_0x44627f=_0x38f672;return db[_0xb16f('0xba')]['destroy']({'where':{'membername':_0x44627f[_0xb16f('0x3d')]},'individualHooks':!![]});}})[_0xb16f('0x22')](function(){return db[_0xb16f('0x108')][_0xb16f('0x57')]({'where':{'membername':_0x44627f[_0xb16f('0x3d')],'exitAt':null}});})[_0xb16f('0x22')](function(_0x3b58c8){var _0x28052c=[];_0x3b58c8['forEach'](function(_0x3737a0){_0x28052c['push'](_0x3737a0['update']({'exitAt':moment()[_0xb16f('0xb3')](_0xb16f('0x104'))}));});return Promise[_0xb16f('0x5e')](_0x28052c);})[_0xb16f('0x22')](function(){return _0x44627f[_0xb16f('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb16f('0x22')](respondWithResult(_0x5f06ce,null))[_0xb16f('0x5f')](handleError(_0x5f06ce,null));};exports[_0xb16f('0x10b')]=function(_0x55b80b,_0x1e114b){var _0x331731;return db[_0xb16f('0xba')][_0xb16f('0x2d')]({'paused':0x1},{'where':{'UserId':_0x55b80b[_0xb16f('0x61')]['id']},'individualHooks':!![]})[_0xb16f('0x22')](function(){return db['User'][_0xb16f('0x3c')]({'where':{'id':_0x55b80b[_0xb16f('0x61')]['id'],'role':_0xb16f('0x7d')},'attributes':['id','name',_0xb16f('0x3b'),_0xb16f('0x6d'),_0xb16f('0xa7'),_0xb16f('0xb2')]});})['then'](handleEntityNotFound(_0x1e114b,null))[_0xb16f('0x22')](function(_0xa3578c){if(_0xa3578c){_0x331731=_0xa3578c;return respondWithRpcPromise(_0xb16f('0x10c'),'pause',{'id':_0x331731['id'],'name':_0x331731['name'],'pause':!![]});}})[_0xb16f('0x22')](function(){if(_0x331731){return db[_0xb16f('0x108')][_0xb16f('0x57')]({'where':{'membername':_0x331731[_0xb16f('0x3d')],'type':_0xb16f('0x107'),'exitAt':null}});}})[_0xb16f('0x22')](function(_0x3a91f6){if(_0x3a91f6[_0xb16f('0x59')]){var _0x1a93f3=moment()[_0xb16f('0xb3')](_0xb16f('0x104'));for(var _0x4672c7=0x0,_0x1b6699=_0x3a91f6[_0xb16f('0x59')];_0x4672c7<_0x1b6699;_0x4672c7++){_0x3a91f6[_0x4672c7]['updateAttributes']({'exitAt':_0x1a93f3});}}})['then'](function(){var _0x908342=[];var _0x3c1d84=utils['getChannels']();_0x3c1d84[_0xb16f('0x103')](function(_0x2cfb25){_0x908342[_0xb16f('0x56')]({'channel':_0x2cfb25,'membername':_0x331731[_0xb16f('0x3d')],'interface':_[_0xb16f('0x72')](_0x331731[_0xb16f('0xa7')])?util['format']('SIP/%s',_0x331731[_0xb16f('0x3d')]):_0x331731[_0xb16f('0xa7')],'type':_0xb16f('0x107'),'enterAt':moment()[_0xb16f('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x55b80b[_0xb16f('0x68')][_0xb16f('0x45')]||_0xb16f('0x10d'),'role':_0x331731[_0xb16f('0x3b')],'internal':_0x331731['internal']});});return db['MemberReport'][_0xb16f('0x8f')](_0x908342,{'individualHooks':!![]});})[_0xb16f('0x22')](function(){return _0x331731[_0xb16f('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x55b80b[_0xb16f('0x68')][_0xb16f('0x45')]||_0xb16f('0x10d'),'lastPauseAt':moment()[_0xb16f('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xb16f('0x22')](respondWithResult(_0x1e114b,null))[_0xb16f('0x5f')](handleError(_0x1e114b,null));};exports[_0xb16f('0x10e')]=function(_0x3958c3,_0x281fbc){if(_0x3958c3['body'][_0xb16f('0xa5')]&&!utils[_0xb16f('0xd9')](_0x3958c3[_0xb16f('0x68')]['channel'])){throw new APIBadRequestError(util['format'](_0xb16f('0x10f'),_0x3958c3['body'][_0xb16f('0xa5')]));}return db['User'][_0xb16f('0x3c')]({'where':{'id':_0x3958c3[_0xb16f('0x61')]['id']},'attributes':['id',_0xb16f('0x3d'),_0xb16f('0x3b'),_0xb16f('0x6d'),_0xb16f('0xa7'),'online',_0xb16f('0x110'),_0xb16f('0x111'),_0xb16f('0x112'),_0xb16f('0x113'),_0xb16f('0x114'),_0xb16f('0x115'),_0xb16f('0x116'),_0xb16f('0x117'),_0xb16f('0x118')]})[_0xb16f('0x22')](function(_0x4d6980){if(!_0x4d6980){throw new APINotFoundError(util[_0xb16f('0xb3')](_0xb16f('0xd1'),_0x3958c3['params']['id']));}return _0x4d6980[_0xb16f('0x10e')](_0x3958c3['body'][_0xb16f('0xa5')]);})[_0xb16f('0x22')](respondWithResult(_0x281fbc,null))[_0xb16f('0x5f')](APIHandleError(_0x281fbc));};exports[_0xb16f('0x119')]=function(_0x250333,_0x5dd479){var _0x495b00={};var _0x101d72={};var _0x5d5b95;var _0x1faa3b;return db[_0xb16f('0x42')][_0xb16f('0x9f')]({'where':{'id':_0x250333['params']['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x5dd479,null))[_0xb16f('0x22')](function(_0x563645){if(_0x563645){_0x5d5b95=_0x563645;_0x101d72['model']=_[_0xb16f('0xdb')](db[_0xb16f('0x11a')]['rawAttributes']);_0x101d72['query']=_[_0xb16f('0xdb')](_0x250333['query']);_0x101d72[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0x101d72[_0xb16f('0xda')],_0x101d72['query']);_0x495b00['attributes']=_[_0xb16f('0xde')](_0x101d72[_0xb16f('0xda')],qs['fields'](_0x250333[_0xb16f('0x4f')][_0xb16f('0xdf')]));_0x495b00['attributes']=_0x495b00[_0xb16f('0x55')][_0xb16f('0x59')]?_0x495b00['attributes']:_0x101d72[_0xb16f('0xda')];_0x495b00[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x250333[_0xb16f('0x4f')]['sort']);_0x495b00[_0xb16f('0x4e')]=qs[_0xb16f('0xdd')](_['pick'](_0x250333[_0xb16f('0x4f')],_0x101d72[_0xb16f('0xdd')]));if(_0x250333['query'][_0xb16f('0x37')]){_0x495b00['where']=_['merge'](_0x495b00['where'],{'$or':_[_0xb16f('0x39')](_0x495b00[_0xb16f('0x55')],function(_0x3de5fa){var _0x2b70b7={};_0x2b70b7[_0x3de5fa]={'$like':'%'+_0x250333[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x2b70b7;})});}_0x495b00=_['merge']({},_0x495b00,_0x250333[_0xb16f('0x63')]);return _0x5d5b95['getTeams'](_0x495b00);}})[_0xb16f('0x22')](function(_0x44a364){if(_0x44a364){_0x1faa3b=_0x44a364['length'];if(!_0x250333[_0xb16f('0x4f')]['hasOwnProperty'](_0xb16f('0xe4'))){_0x495b00[_0xb16f('0x1c')]=qs['limit'](_0x250333[_0xb16f('0x4f')][_0xb16f('0x1c')]);_0x495b00[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0x250333['query']['offset']);}return _0x5d5b95[_0xb16f('0x119')](_0x495b00);}})[_0xb16f('0x22')](function(_0x1305ef){if(_0x1305ef){return _0x1305ef?{'count':_0x1faa3b,'rows':_0x1305ef}:null;}})['then'](respondWithResult(_0x5dd479,null))['catch'](handleError(_0x5dd479,null));};exports[_0xb16f('0x11b')]=function(_0x48bdf0,_0x4812f6){var _0x221777=_0x48bdf0[_0xb16f('0x61')]['id'];var _0x3c0207=_0x48bdf0[_0xb16f('0x68')]?_0x48bdf0['body'][_0xb16f('0x6b')]:null;var _0x3a4489=[];return Promise[_0xb16f('0x11c')]()[_0xb16f('0x22')](function(){if(!_0x3c0207)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xb16f('0x22')](function(){return db[_0xb16f('0x42')][_0xb16f('0x9f')]({'where':{'id':_0x221777}});})[_0xb16f('0x22')](function(_0x2dad09){if(!_0x2dad09)throw new APINotFoundError(util[_0xb16f('0xb3')](_0xb16f('0xd1'),_0x48bdf0['params']['id']));return db['sequelize'][_0xb16f('0x11d')](function(_0x3e1e6c){return _0x2dad09[_0xb16f('0x11b')](_0x3c0207,{'transaction':_0x3e1e6c})[_0xb16f('0x22')](function(){return db['Team'][_0xb16f('0x57')]({'where':{'id':{'$in':_0x3c0207}}});})[_0xb16f('0x22')](function(_0x5e77d1){var _0x36c66e=_[_0xb16f('0x39')](_0x5e77d1,function(_0x35d9bd){return _0x35d9bd[_0xb16f('0x11e')]();});return Promise[_0xb16f('0x5e')](_0x36c66e);})[_0xb16f('0x22')](function(_0x22da83){_0x3a4489=_[_0xb16f('0x11f')](_0x22da83);var _0x49a4cf=_['map'](_0x3a4489,function(_0x476d82){return _0x476d82[_0xb16f('0x120')](_0x2dad09['id'],{'transaction':_0x3e1e6c});});return Promise[_0xb16f('0x5e')](_0x49a4cf);})['then'](function(){if(!_0x2dad09[_0xb16f('0xb2')])return;var _0x44828e=_[_0xb16f('0x37')](_0x3a4489,function(_0x5f68ff){return _0x5f68ff[_0xb16f('0x121')](_0xb16f('0xa5'))==='Voice';});var _0x2299ab=_[_0xb16f('0x39')](_0x44828e,function(_0x326a98){return db[_0xb16f('0xba')][_0xb16f('0xb5')]({'membername':_0x2dad09[_0xb16f('0x3d')],'UserId':_0x2dad09['id'],'queue_name':_0x326a98[_0xb16f('0x3d')],'VoiceQueueId':_0x326a98['id'],'interface':_[_0xb16f('0x72')](_0x2dad09['interface'])?util[_0xb16f('0xb3')](_0xb16f('0xb4'),_0x2dad09[_0xb16f('0x3d')]):_0x2dad09[_0xb16f('0xa7')],'paused':_0x2dad09[_0xb16f('0x110')]||![],'penalty':_0x2dad09['penalty']},{'transaction':_0x3e1e6c});});return Promise[_0xb16f('0x5e')](_0x2299ab);})[_0xb16f('0x22')](function(){return db[_0xb16f('0x122')][_0xb16f('0x57')]({'where':{'teamId':{'$in':_0x3c0207}}});})[_0xb16f('0x22')](function(_0xc5dc06){var _0x343bf9=_[_0xb16f('0x39')](_0xc5dc06,function(_0x24f505){return db[_0xb16f('0x123')][_0xb16f('0x8e')]({'UserId':_0x2dad09['id'],'VoicePrefixId':_0x24f505['VoicePrefixId']},{'transaction':_0x3e1e6c});});return Promise['all'](_0x343bf9);});});})[_0xb16f('0x22')](function(){for(var _0x9d5159=0x0;_0x9d5159<_0x3a4489[_0xb16f('0x59')];_0x9d5159++){var _0xf9e85a=_0x3a4489[_0x9d5159][_0xb16f('0x121')](_0xb16f('0xa5'));var _0x3ab524=_0xf9e85a+_0xb16f('0xaf');socket[_0xb16f('0x2e')]('user'+_0xf9e85a+'Queue:save',{'UserId':_0x221777,['queueField']:_0x3a4489[_0x9d5159]['id']});}})[_0xb16f('0x22')](respondWithStatusCode(_0x4812f6,null))['catch'](APIHandleError(_0x4812f6));};exports[_0xb16f('0x124')]=function(_0x3b14de,_0x4eabf2){var _0x16ddbb=_0x3b14de['params']['id'];var _0x28a8ba=null;if(_0x3b14de[_0xb16f('0x4f')][_0xb16f('0x6b')]){_0x28a8ba=_[_0xb16f('0xb8')](_0x3b14de['query'][_0xb16f('0x6b')])?_0x3b14de[_0xb16f('0x4f')]['ids']:[_0x3b14de[_0xb16f('0x4f')][_0xb16f('0x6b')]];}var _0x4b34a2=[];return Promise[_0xb16f('0x11c')]()[_0xb16f('0x22')](function(){if(!_0x28a8ba)throw new APIBadRequestError(_0xb16f('0x125'));})['then'](function(){return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x16ddbb}});})['then'](function(_0x3b07a0){if(!_0x3b07a0)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x3b14de[_0xb16f('0x61')]['id']));return db[_0xb16f('0x74')][_0xb16f('0x11d')](function(_0x396f8){return _0x3b07a0[_0xb16f('0x124')](_0x28a8ba,{'transaction':_0x396f8})[_0xb16f('0x22')](function(){return db[_0xb16f('0x11a')]['findAll']({'where':{'id':{'$in':_0x28a8ba}}});})[_0xb16f('0x22')](function(_0x5ce496){var _0x3e2bc0=_[_0xb16f('0x39')](_0x5ce496,function(_0x355bea){return _0x355bea[_0xb16f('0x11e')]();});return Promise[_0xb16f('0x5e')](_0x3e2bc0);})['then'](function(_0x4f9080){_0x4b34a2=_[_0xb16f('0x11f')](_0x4f9080);var _0x4f54b3=_['map'](_0x4b34a2,function(_0x2edce0){return _0x2edce0[_0xb16f('0x126')](_0x3b07a0['id'],{'transaction':_0x396f8});});return Promise[_0xb16f('0x5e')](_0x4f54b3);})[_0xb16f('0x22')](function(){if(!_0x3b07a0[_0xb16f('0xb2')])return;var _0x577a14=_[_0xb16f('0x37')](_0x4b34a2,function(_0x2c871a){return _0x2c871a[_0xb16f('0x121')](_0xb16f('0xa5'))===_0xb16f('0x127');});var _0x4c7dc5=_[_0xb16f('0x39')](_0x577a14,function(_0x579a3c){return db['UserVoiceQueueRt'][_0xb16f('0x30')]({'where':{'VoiceQueueId':_0x579a3c['id'],'UserId':_0x3b07a0['id']},'transaction':_0x396f8});});return Promise[_0xb16f('0x5e')](_0x4c7dc5);})[_0xb16f('0x22')](function(){return db[_0xb16f('0x122')][_0xb16f('0x57')]({'where':{'teamId':{'$in':_0x28a8ba}}});})[_0xb16f('0x22')](function(_0x212405){var _0x3a4a83=_[_0xb16f('0x39')](_0x212405,function(_0x4222a8){return db[_0xb16f('0x123')][_0xb16f('0x30')]({'where':{'UserId':_0x3b07a0['id'],'VoicePrefixId':_0x4222a8['VoicePrefixId']}},{'transaction':_0x396f8});});return Promise[_0xb16f('0x5e')](_0x3a4a83);});});})[_0xb16f('0x22')](function(){for(var _0x1d7141=0x0;_0x1d7141<_0x4b34a2[_0xb16f('0x59')];_0x1d7141++){var _0x49720f=_0x4b34a2[_0x1d7141]['getDataValue'](_0xb16f('0xa5'));var _0x3ad617=_0x49720f+'QueueId';socket[_0xb16f('0x2e')](_0xb16f('0x33')+_0x49720f+_0xb16f('0xb9'),{'UserId':_0x16ddbb,['queueField']:_0x4b34a2[_0x1d7141]['id']});}})['then'](respondWithStatusCode(_0x4eabf2,null))['catch'](APIHandleError(_0x4eabf2));};exports[_0xb16f('0x128')]=function(_0x1032b7,_0x254cb9){var _0x262cbb={};var _0x17e532={};var _0x4ee803;var _0x4ff8ab;return db['User'][_0xb16f('0x9f')]({'where':{'id':_0x1032b7[_0xb16f('0x61')]['id']}})[_0xb16f('0x22')](handleEntityNotFound(_0x254cb9,null))['then'](function(_0x12daa4){if(_0x12daa4){_0x4ee803=_0x12daa4;_0x17e532[_0xb16f('0xda')]=_[_0xb16f('0xdb')](db[_0xb16f('0xd3')][_0xb16f('0x43')]);_0x17e532[_0xb16f('0x4f')]=_[_0xb16f('0xdb')](_0x1032b7['query']);_0x17e532[_0xb16f('0xdd')]=_[_0xb16f('0xde')](_0x17e532[_0xb16f('0xda')],_0x17e532['query']);_0x262cbb[_0xb16f('0x55')]=_['intersection'](_0x17e532[_0xb16f('0xda')],qs[_0xb16f('0xdf')](_0x1032b7['query'][_0xb16f('0xdf')]));_0x262cbb[_0xb16f('0x55')]=_0x262cbb[_0xb16f('0x55')][_0xb16f('0x59')]?_0x262cbb[_0xb16f('0x55')]:_0x17e532[_0xb16f('0xda')];_0x262cbb[_0xb16f('0xe0')]=qs[_0xb16f('0xe1')](_0x1032b7[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0x262cbb['where']=qs[_0xb16f('0xdd')](_[_0xb16f('0xe2')](_0x1032b7['query'],_0x17e532[_0xb16f('0xdd')]));if(_0x1032b7[_0xb16f('0x4f')]['filter']){_0x262cbb[_0xb16f('0x4e')]=_[_0xb16f('0xe3')](_0x262cbb[_0xb16f('0x4e')],{'$or':_[_0xb16f('0x39')](_0x262cbb[_0xb16f('0x55')],function(_0x34d43a){var _0x23e518={};_0x23e518[_0x34d43a]={'$like':'%'+_0x1032b7[_0xb16f('0x4f')][_0xb16f('0x37')]+'%'};return _0x23e518;})});}_0x262cbb=_[_0xb16f('0xe3')]({},_0x262cbb,_0x1032b7['options']);return _0x4ee803['getLists'](_0x262cbb);}})['then'](function(_0xe59e51){if(_0xe59e51){_0x4ff8ab=_0xe59e51['length'];if(!_0x1032b7[_0xb16f('0x4f')]['hasOwnProperty'](_0xb16f('0xe4'))){_0x262cbb[_0xb16f('0x1c')]=qs[_0xb16f('0x1c')](_0x1032b7['query']['limit']);_0x262cbb['offset']=qs[_0xb16f('0x1e')](_0x1032b7['query']['offset']);}return _0x4ee803['getLists'](_0x262cbb);}})['then'](function(_0x3cee5f){if(_0x3cee5f){return _0x3cee5f?{'count':_0x4ff8ab,'rows':_0x3cee5f}:null;}})[_0xb16f('0x22')](respondWithResult(_0x254cb9,null))[_0xb16f('0x5f')](handleError(_0x254cb9,null));};exports[_0xb16f('0x129')]=function(_0x303bb3,_0x31d900){var _0x3653c2={};var _0x5b4ecc={};var _0x1f2064;return db[_0xb16f('0x42')][_0xb16f('0x9f')]({'where':{'id':_0x303bb3[_0xb16f('0x61')]['id']}})['then'](handleEntityNotFound(_0x31d900,null))[_0xb16f('0x22')](function(_0x2c713d){if(_0x2c713d){_0x1f2064=_0x2c713d;_0x5b4ecc[_0xb16f('0xda')]=_['keys'](db[_0xb16f('0x42')][_0xb16f('0x43')]);_0x5b4ecc['query']=_['keys'](_0x303bb3[_0xb16f('0x4f')]);_0x5b4ecc['filters']=_[_0xb16f('0xde')](_0x5b4ecc[_0xb16f('0xda')],_0x5b4ecc[_0xb16f('0x4f')]);_0x3653c2[_0xb16f('0x55')]=_[_0xb16f('0xde')](_0x5b4ecc[_0xb16f('0xda')],qs['fields'](_0x303bb3['query'][_0xb16f('0xdf')]));_0x3653c2['attributes']=_0x3653c2[_0xb16f('0x55')][_0xb16f('0x59')]?_0x3653c2[_0xb16f('0x55')]:_0x5b4ecc[_0xb16f('0xda')];_0x3653c2[_0xb16f('0xe0')]=qs['sort'](_0x303bb3[_0xb16f('0x4f')][_0xb16f('0xe1')]);_0x3653c2['where']=qs['filters'](_[_0xb16f('0xe2')](_0x303bb3['query'],_0x5b4ecc[_0xb16f('0xdd')]));if(_0x303bb3[_0xb16f('0x4f')][_0xb16f('0x37')]){_0x3653c2[_0xb16f('0x4e')]=_[_0xb16f('0xe3')](_0x3653c2['where'],{'$or':_['map'](_0x3653c2[_0xb16f('0x55')],function(_0x49578c){var _0x33b021={};_0x33b021[_0x49578c]={'$like':'%'+_0x303bb3['query']['filter']+'%'};return _0x33b021;})});}_0x3653c2[_0xb16f('0xda')]=db[_0xb16f('0x42')];_0x3653c2['as']=_0xb16f('0x34');_0x3653c2=_[_0xb16f('0xe3')]({},_0x3653c2,_0x303bb3[_0xb16f('0x63')]);return _0x1f2064[_0xb16f('0x102')]({'include':[_0x3653c2]});}})['then'](function(_0x2e31e4){if(_0x2e31e4){var _0x3b2365={},_0x37b3fe=[];for(var _0x1f8dbe=0x0;_0x1f8dbe<_0x2e31e4[_0xb16f('0x59')];_0x1f8dbe+=0x1){for(var _0x15a959=0x0,_0x3f81d8;_0x15a959<_0x2e31e4[_0x1f8dbe][_0xb16f('0x34')][_0xb16f('0x59')];_0x15a959+=0x1){_0x3f81d8=_0x2e31e4[_0x1f8dbe]['Agents'][_0x15a959]['get']({'plain':!![]});_0x3b2365[_0x3f81d8['id']]=_0x3f81d8;}}_0x3b2365=_[_0xb16f('0x12a')](_0x3b2365);for(var _0x21a1d9=qs[_0xb16f('0x1e')](_0x303bb3[_0xb16f('0x4f')]['offset']);_0x21a1d9<_0x3b2365[_0xb16f('0x59')]&&_0x37b3fe[_0xb16f('0x59')]=_0x2f6d8c['agents']){throw new Error(_0x0b0e('0x4c'));}})[_0x0b0e('0x16')](function(){if(_0x52124a){return db[_0x0b0e('0x26')][_0x0b0e('0x4d')]({'where':{'membername':_0x52124a[_0x0b0e('0x20')]},'individualHooks':!![]});}})[_0x0b0e('0x16')](function(){if(_0x52124a){return _0x52124a['getVoiceQueues']({'raw':!![]});}})[_0x0b0e('0x16')](function(_0x593946){if(_0x52124a){if(_0x593946){var _0xed7e9f=[];_0x526b40=_0x593946;if(_0x526b40['length']){for(var _0x383971=0x0;_0x383971<_0x526b40[_0x0b0e('0x29')];_0x383971++){_0xed7e9f['push'](db[_0x0b0e('0x26')][_0x0b0e('0x4e')]({'membername':_0x52124a[_0x0b0e('0x20')],'UserId':_0x52124a['id'],'queue_name':_0x526b40[_0x383971][_0x0b0e('0x20')],'VoiceQueueId':_0x526b40[_0x383971]['id'],'interface':_0x460e71,'paused':_0x52124a[_0x0b0e('0x48')]||![],'penalty':_0x526b40[_0x383971][_0x0b0e('0x4f')]||0x0}));}return BPromise[_0x0b0e('0x45')](_0xed7e9f);}}}})['then'](function(){if(_0x52124a){return db[_0x0b0e('0x44')][_0x0b0e('0xd')]({'where':{'membername':_0x52124a[_0x0b0e('0x20')],'exitAt':null}});}})[_0x0b0e('0x16')](function(_0x5b0e79){if(_0x52124a){if(_0x5b0e79&&_0x5b0e79[_0x0b0e('0x29')]){var _0x5a396e=[];_0x5b0e79[_0x0b0e('0x2d')](function(_0xd8cd9e){_0x5a396e[_0x0b0e('0x2e')](_0xd8cd9e[_0x0b0e('0x27')]({'exitAt':moment()[_0x0b0e('0x2a')](_0x0b0e('0x2b'))}));});return BPromise[_0x0b0e('0x45')](_0x5a396e);}}})['then'](function(){if(_0x52124a){var _0x4f87e4=[];var _0x67bc11=[];var _0x339269=utils[_0x0b0e('0x2c')]();var _0x1090c6={'membername':_0x52124a['name'],'interface':_0x460e71,'enterAt':moment()['format'](_0x0b0e('0x2b')),'role':_0x52124a[_0x0b0e('0x21')],'internal':_0x52124a[_0x0b0e('0x22')]};_0x339269[_0x0b0e('0x2d')](function(_0x42b826){_0x4f87e4['push'](_[_0x0b0e('0x50')]({'channel':_0x42b826,'type':_0x0b0e('0x51'),'data1':_0x0b0e('0x52'),'data2':_0x460e71},_0x1090c6));if(_0x52124a[_0x0b0e('0x48')]){_0x67bc11[_0x0b0e('0x2e')](_[_0x0b0e('0x50')]({'channel':_0x42b826,'type':_0x0b0e('0x28'),'data1':_0x0b0e('0x53')},_0x1090c6));}});return db['MemberReport'][_0x0b0e('0x33')](_0x4f87e4[_0x0b0e('0x54')](_0x67bc11),{'individualHooks':!![]});}})[_0x0b0e('0x16')](function(){if(_0x52124a){return _0x52124a[_0x0b0e('0x27')]({'online':!![],'lastLoginAt':moment()[_0x0b0e('0x2a')](_0x0b0e('0x2b')),'voicePause':_0x52124a[_0x0b0e('0x48')]||![],'mailPause':_0x52124a['loginInPause']||![],'chatPause':_0x52124a[_0x0b0e('0x48')]||![],'faxPause':_0x52124a[_0x0b0e('0x48')]||![],'smsPause':_0x52124a[_0x0b0e('0x48')]||![],'openchannelPause':_0x52124a[_0x0b0e('0x48')]||![],'pauseType':_0x52124a[_0x0b0e('0x48')]?_0x0b0e('0x53'):null,'lastPauseAt':moment()[_0x0b0e('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x460e71});}})[_0x0b0e('0x16')](function(_0x574c77){_0x223472(_0x574c77);})[_0x0b0e('0x1a')](function(_0x2b6643){_0x13e95f(_0x35706d[_0x0b0e('0x1e')](0x1f4,_0x2b6643['message']));});});}; \ No newline at end of file +var _0xe6ad=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','GetUser','User','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowUser','PauseUser','find','where','role','internal','interface','update','MemberReport','findAll','name','PAUSE','length','format','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','agents','UserVoiceQueueRt','upsert','LOGIN','callysquare','merge','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0xe6ad,0x10f));var _0xde6a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe6ad[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xde6a('0x0'));var util=require(_0xde6a('0x1'));var moment=require(_0xde6a('0x2'));var BPromise=require(_0xde6a('0x3'));var Redis=require(_0xde6a('0x4'));var db=require(_0xde6a('0x5'))['db'];var utils=require(_0xde6a('0x6'));var logger=require(_0xde6a('0x7'))(_0xde6a('0x8'));var config=require(_0xde6a('0x9'));config['redis']=_['defaults'](config[_0xde6a('0xa')],{'host':_0xde6a('0xb'),'port':0x18eb});var socket=require(_0xde6a('0xc'))(new Redis(config[_0xde6a('0xa')]));require(_0xde6a('0xd'))['register'](socket);exports[_0xde6a('0xe')]=function(_0x11249b){var _0x484086=this;return new Promise(function(_0x29f548,_0x57a25b){return db[_0xde6a('0xf')]['findAll']({'raw':_0x11249b['options']?_0x11249b[_0xde6a('0x10')][_0xde6a('0x11')]===undefined?!![]:![]:!![],'where':_0x11249b['options']?_0x11249b[_0xde6a('0x10')]['where']||null:null,'attributes':_0x11249b[_0xde6a('0x10')]?_0x11249b[_0xde6a('0x10')][_0xde6a('0x12')]||null:null,'limit':_0x11249b['options']?_0x11249b[_0xde6a('0x10')][_0xde6a('0x13')]||null:null,'include':_0x11249b[_0xde6a('0x10')]?_0x11249b[_0xde6a('0x10')][_0xde6a('0x14')]?_[_0xde6a('0x15')](_0x11249b[_0xde6a('0x10')][_0xde6a('0x14')],function(_0x209b0e){return{'model':db[_0x209b0e[_0xde6a('0x16')]],'as':_0x209b0e['as'],'attributes':_0x209b0e[_0xde6a('0x12')],'include':_0x209b0e[_0xde6a('0x14')]?_[_0xde6a('0x15')](_0x209b0e[_0xde6a('0x14')],function(_0x592cc1){return{'model':db[_0x592cc1[_0xde6a('0x16')]],'as':_0x592cc1['as'],'attributes':_0x592cc1[_0xde6a('0x12')],'include':_0x592cc1['include']?_[_0xde6a('0x15')](_0x592cc1[_0xde6a('0x14')],function(_0x143226){return{'model':db[_0x143226[_0xde6a('0x16')]],'as':_0x143226['as'],'attributes':_0x143226[_0xde6a('0x12')]};}):[]};}):[]};}):[]:[]})[_0xde6a('0x17')](function(_0x34d9d4){logger[_0xde6a('0x18')](_0xde6a('0xe'),_0x11249b);logger[_0xde6a('0x19')](_0xde6a('0xe'),_0x11249b,JSON[_0xde6a('0x1a')](_0x34d9d4));_0x29f548(_0x34d9d4);})[_0xde6a('0x1b')](function(_0x50166c){logger['error']('GetUser',_0x50166c[_0xde6a('0x1c')],_0x11249b);_0x57a25b(_0x484086[_0xde6a('0x1d')](0x1f4,_0x50166c['message']));});});};exports[_0xde6a('0x1e')]=function(_0x5ee874){var _0x336699=this;return new Promise(function(_0x2b2e58,_0xef4a8f){return db[_0xde6a('0xf')]['find']({'raw':_0x5ee874[_0xde6a('0x10')]?_0x5ee874['options'][_0xde6a('0x11')]===undefined?!![]:![]:!![],'where':_0x5ee874[_0xde6a('0x10')]?_0x5ee874['options']['where']||null:null,'attributes':_0x5ee874['options']?_0x5ee874['options'][_0xde6a('0x12')]||null:null,'include':_0x5ee874[_0xde6a('0x10')]?_0x5ee874[_0xde6a('0x10')][_0xde6a('0x14')]?_['map'](_0x5ee874[_0xde6a('0x10')][_0xde6a('0x14')],function(_0xa1f239){return{'model':db[_0xa1f239[_0xde6a('0x16')]],'as':_0xa1f239['as'],'attributes':_0xa1f239[_0xde6a('0x12')],'include':_0xa1f239[_0xde6a('0x14')]?_[_0xde6a('0x15')](_0xa1f239[_0xde6a('0x14')],function(_0x3848c9){return{'model':db[_0x3848c9['model']],'as':_0x3848c9['as'],'attributes':_0x3848c9[_0xde6a('0x12')],'include':_0x3848c9[_0xde6a('0x14')]?_[_0xde6a('0x15')](_0x3848c9[_0xde6a('0x14')],function(_0x5f1afe){return{'model':db[_0x5f1afe[_0xde6a('0x16')]],'as':_0x5f1afe['as'],'attributes':_0x5f1afe[_0xde6a('0x12')]};}):[]};}):[]};}):[]:[]})[_0xde6a('0x17')](function(_0x5ea225){logger[_0xde6a('0x18')](_0xde6a('0x1e'),_0x5ee874);logger[_0xde6a('0x19')](_0xde6a('0x1e'),_0x5ee874,JSON['stringify'](_0x5ea225));_0x2b2e58(_0x5ea225);})['catch'](function(_0x39c6a0){logger['error'](_0xde6a('0x1e'),_0x39c6a0[_0xde6a('0x1c')],_0x5ee874);_0xef4a8f(_0x336699[_0xde6a('0x1d')](0x1f4,_0x39c6a0[_0xde6a('0x1c')]));});});};exports[_0xde6a('0x1f')]=function(_0x4aff33){var _0x4bd34e;return db[_0xde6a('0xf')][_0xde6a('0x20')]({'where':_0x4aff33[_0xde6a('0x10')][_0xde6a('0x21')]||{},'attributes':['id','name',_0xde6a('0x22'),_0xde6a('0x23'),_0xde6a('0x24')]})[_0xde6a('0x17')](function(_0x307fbb){if(!_0x307fbb){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4aff33['params']['id']));}_0x4bd34e=_0x307fbb;return db['UserVoiceQueueRt'][_0xde6a('0x25')]({'paused':0x1},{'where':{'UserId':_0x4bd34e['id']},'individualHooks':!![]});})[_0xde6a('0x17')](function(){return db[_0xde6a('0x26')][_0xde6a('0x27')]({'where':{'membername':_0x4bd34e[_0xde6a('0x28')],'type':_0xde6a('0x29'),'exitAt':null}});})['then'](function(_0x1e06a8){if(_0x1e06a8&&_0x1e06a8[_0xde6a('0x2a')]){var _0x327207=moment()[_0xde6a('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3e88fe=0x0,_0x56b80d=_0x1e06a8[_0xde6a('0x2a')];_0x3e88fe<_0x56b80d;_0x3e88fe++){_0x1e06a8[_0x3e88fe][_0xde6a('0x2c')]({'exitAt':_0x327207});}}})[_0xde6a('0x17')](function(){var _0x4e30a9=[];var _0xa1d3fa=utils[_0xde6a('0x2d')]();_0xa1d3fa[_0xde6a('0x2e')](function(_0x5e195b){_0x4e30a9[_0xde6a('0x2f')]({'channel':_0x5e195b,'membername':_0x4bd34e[_0xde6a('0x28')],'interface':_[_0xde6a('0x30')](_0x4bd34e[_0xde6a('0x24')])?util[_0xde6a('0x2b')](_0xde6a('0x31'),_0x4bd34e[_0xde6a('0x28')]):_0x4bd34e[_0xde6a('0x24')],'type':_0xde6a('0x29'),'enterAt':moment()[_0xde6a('0x2b')](_0xde6a('0x32')),'data1':_0x4aff33[_0xde6a('0x33')]['type']||_0xde6a('0x34'),'role':_0x4bd34e[_0xde6a('0x22')],'internal':_0x4bd34e['internal'],'uniqueid':_0x4aff33[_0xde6a('0x33')][_0xde6a('0x35')]||null});});return db[_0xde6a('0x26')][_0xde6a('0x36')](_0x4e30a9,{'individualHooks':!![]});})[_0xde6a('0x17')](function(){return _0x4bd34e[_0xde6a('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4aff33['body'][_0xde6a('0x37')]||_0xde6a('0x34'),'lastPauseAt':moment()[_0xde6a('0x2b')](_0xde6a('0x32'))});})[_0xde6a('0x1b')](function(_0x1ec910){throw _0x1ec910;});};exports[_0xde6a('0x38')]=function(_0x23418f){return Promise[_0xde6a('0x39')]()[_0xde6a('0x17')](function(){if(_0x23418f[_0xde6a('0x33')][_0xde6a('0x3a')]&&!utils[_0xde6a('0x3b')](_0x23418f[_0xde6a('0x33')][_0xde6a('0x3a')])){throw new Error(util[_0xde6a('0x2b')](_0xde6a('0x3c'),_0x23418f[_0xde6a('0x33')][_0xde6a('0x3a')]));}return db[_0xde6a('0xf')][_0xde6a('0x3d')]({'where':_0x23418f[_0xde6a('0x10')][_0xde6a('0x21')]||{},'attributes':['id',_0xde6a('0x28'),_0xde6a('0x22'),_0xde6a('0x23'),_0xde6a('0x24'),_0xde6a('0x3e'),_0xde6a('0x3f'),'mailPause',_0xde6a('0x40'),_0xde6a('0x41'),'openchannelPause',_0xde6a('0x42'),_0xde6a('0x43'),_0xde6a('0x44'),_0xde6a('0x45')]});})[_0xde6a('0x17')](function(_0x4c4bd0){if(!_0x4c4bd0){throw new Error(util[_0xde6a('0x2b')](_0xde6a('0x46'),_0x23418f[_0xde6a('0x47')]['id']));}return _0x4c4bd0[_0xde6a('0x48')](_0x23418f[_0xde6a('0x33')]['channel'],_0xde6a('0x49'));})['catch'](function(_0x27872e){throw _0x27872e;});};exports[_0xde6a('0x4a')]=function(_0x1c3fd2){var _0x1e2e9e=this;return new Promise(function(_0x2aae4e,_0x5de032){var _0x1a05c0;return db[_0xde6a('0xf')][_0xde6a('0x3d')]({'where':_0x1c3fd2['options']['where']||{},'attributes':['id',_0xde6a('0x28')]})[_0xde6a('0x17')](function(_0xda1d55){if(_0xda1d55){_0x1a05c0=_0xda1d55;return db['UserVoiceQueueRt'][_0xde6a('0x4b')]({'where':{'membername':_0x1a05c0[_0xde6a('0x28')]},'individualHooks':!![]});}})[_0xde6a('0x17')](function(){if(_0x1a05c0){return db[_0xde6a('0x26')][_0xde6a('0x27')]({'where':{'membername':_0x1a05c0[_0xde6a('0x28')],'exitAt':null}});}})['then'](function(_0x2b6328){if(_0x1a05c0){if(_0x2b6328&&_0x2b6328[_0xde6a('0x2a')]){var _0x19ebc1=[];_0x2b6328[_0xde6a('0x2e')](function(_0x14a9d9){_0x19ebc1[_0xde6a('0x2f')](_0x14a9d9[_0xde6a('0x25')]({'exitAt':moment()[_0xde6a('0x2b')](_0xde6a('0x32'))}));});return BPromise[_0xde6a('0x4c')](_0x19ebc1);}}})[_0xde6a('0x17')](function(){if(_0x1a05c0){return _0x1a05c0[_0xde6a('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x2d3f74){_0x2aae4e(_0x2d3f74);})[_0xde6a('0x1b')](function(_0x3680aa){_0x5de032(_0x1e2e9e[_0xde6a('0x1d')](0x1f4,_0x3680aa['message']));});});};exports[_0xde6a('0x4d')]=function(_0x427d41){var _0x155813=this;return new Promise(function(_0x2d51a6,_0x49cd75){var _0x5e96a5;var _0x2cc802;var _0x274b1f;var _0x5e7bca;return db[_0xde6a('0xf')][_0xde6a('0x3d')]({'where':_0x427d41[_0xde6a('0x10')][_0xde6a('0x21')]||{},'attributes':['id','name',_0xde6a('0x22'),_0xde6a('0x4e'),_0xde6a('0x4f'),'internal',_0xde6a('0x50'),_0xde6a('0x24')]})[_0xde6a('0x17')](function(_0xa1355d){if(_0xa1355d){_0x5e96a5=_0xa1355d;_0x5e7bca=_0x427d41['body'][_0xde6a('0x24')]?_0x427d41[_0xde6a('0x33')][_0xde6a('0x24')]:util['format'](_0xde6a('0x31'),_0x5e96a5['name']);return db[_0xde6a('0xf')][_0xde6a('0x51')]({'where':{'role':_0xde6a('0x52'),'online':!![],'id':{'$ne':_0x5e96a5['id']}}});}})[_0xde6a('0x17')](function(_0xa19900){if(_0xa19900){_0x274b1f=_0xa19900;return require(_0xde6a('0x53'))['getLicense']();}})[_0xde6a('0x17')](function(_0x11e7f0){if(_0x11e7f0&&_0x11e7f0['agents']&&_0x274b1f>=_0x11e7f0[_0xde6a('0x54')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xde6a('0x17')](function(){if(_0x5e96a5){return db[_0xde6a('0x55')][_0xde6a('0x4b')]({'where':{'membername':_0x5e96a5[_0xde6a('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x5e96a5){return _0x5e96a5['getVoiceQueues']({'raw':!![]});}})[_0xde6a('0x17')](function(_0x15e5be){if(_0x5e96a5){if(_0x15e5be){var _0x12bb12=[];_0x2cc802=_0x15e5be;if(_0x2cc802['length']){for(var _0x2803f6=0x0;_0x2803f6<_0x2cc802['length'];_0x2803f6++){_0x12bb12[_0xde6a('0x2f')](db[_0xde6a('0x55')][_0xde6a('0x56')]({'membername':_0x5e96a5[_0xde6a('0x28')],'UserId':_0x5e96a5['id'],'queue_name':_0x2cc802[_0x2803f6][_0xde6a('0x28')],'VoiceQueueId':_0x2cc802[_0x2803f6]['id'],'interface':_0x5e7bca,'paused':_0x5e96a5[_0xde6a('0x50')]||![],'penalty':_0x2cc802[_0x2803f6]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xde6a('0x4c')](_0x12bb12);}}}})[_0xde6a('0x17')](function(){if(_0x5e96a5){return db[_0xde6a('0x26')]['findAll']({'where':{'membername':_0x5e96a5[_0xde6a('0x28')],'exitAt':null}});}})[_0xde6a('0x17')](function(_0x5ba40f){if(_0x5e96a5){if(_0x5ba40f&&_0x5ba40f['length']){var _0x2bcc4c=[];_0x5ba40f[_0xde6a('0x2e')](function(_0x582e81){_0x2bcc4c[_0xde6a('0x2f')](_0x582e81[_0xde6a('0x25')]({'exitAt':moment()[_0xde6a('0x2b')](_0xde6a('0x32'))}));});return BPromise[_0xde6a('0x4c')](_0x2bcc4c);}}})[_0xde6a('0x17')](function(){if(_0x5e96a5){var _0x526504=[];var _0x1f8867=[];var _0xe963b4=utils[_0xde6a('0x2d')]();var _0x5ad1de={'membername':_0x5e96a5[_0xde6a('0x28')],'interface':_0x5e7bca,'enterAt':moment()[_0xde6a('0x2b')](_0xde6a('0x32')),'role':_0x5e96a5[_0xde6a('0x22')],'internal':_0x5e96a5['internal']};_0xe963b4[_0xde6a('0x2e')](function(_0x1d552c){_0x526504['push'](_['merge']({'channel':_0x1d552c,'type':_0xde6a('0x57'),'data1':_0xde6a('0x58'),'data2':_0x5e7bca},_0x5ad1de));if(_0x5e96a5[_0xde6a('0x50')]){_0x1f8867[_0xde6a('0x2f')](_[_0xde6a('0x59')]({'channel':_0x1d552c,'type':'PAUSE','data1':_0xde6a('0x5a')},_0x5ad1de));}});return db[_0xde6a('0x26')][_0xde6a('0x36')](_0x526504[_0xde6a('0x5b')](_0x1f8867),{'individualHooks':!![]});}})[_0xde6a('0x17')](function(){if(_0x5e96a5){return _0x5e96a5['update']({'online':!![],'lastLoginAt':moment()[_0xde6a('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5e96a5[_0xde6a('0x50')]||![],'mailPause':_0x5e96a5[_0xde6a('0x50')]||![],'chatPause':_0x5e96a5[_0xde6a('0x50')]||![],'faxPause':_0x5e96a5[_0xde6a('0x50')]||![],'smsPause':_0x5e96a5['loginInPause']||![],'openchannelPause':_0x5e96a5[_0xde6a('0x50')]||![],'pauseType':_0x5e96a5[_0xde6a('0x50')]?_0xde6a('0x5a'):null,'lastPauseAt':moment()[_0xde6a('0x2b')](_0xde6a('0x32')),'interface':_0x5e7bca});}})['then'](function(_0x46e710){_0x2d51a6(_0x46e710);})[_0xde6a('0x1b')](function(_0x55746e){_0x49cd75(_0x155813[_0xde6a('0x1d')](0x1f4,_0x55746e[_0xde6a('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5c4b391..d6519b6 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 _0x676a=['user:','./user.events','save','remove','update','removeListener','register','length'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x676a,0x181));var _0xa676=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x676a[_0x46aff0];return _0x9d78cf;};'use strict';var UserEvents=require(_0xa676('0x0'));var events=[_0xa676('0x1'),_0xa676('0x2'),_0xa676('0x3')];function createListener(_0x400bb4,_0x4a4bd5){return function(_0x56fa7f){_0x4a4bd5['emit'](_0x400bb4,_0x56fa7f);};}function removeListener(_0x589a23,_0x2c369b){return function(){UserEvents[_0xa676('0x4')](_0x589a23,_0x2c369b);};}exports[_0xa676('0x5')]=function(_0x3cbac8){for(var _0x2b10f7=0x0,_0x3088e8=events[_0xa676('0x6')];_0x2b10f7<_0x3088e8;_0x2b10f7++){var _0x4dcaa3=events[_0x2b10f7];var _0x3b7b48=createListener(_0xa676('0x7')+_0x4dcaa3,_0x3cbac8);UserEvents['on'](_0x4dcaa3,_0x3b7b48);}}; \ No newline at end of file +var _0xaf0a=['length','./user.events','remove','emit','register'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0xaf0a,0x1cd));var _0xaaf0=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xaf0a[_0x1a7846];return _0x48049;};'use strict';var UserEvents=require(_0xaaf0('0x0'));var events=['save',_0xaaf0('0x1'),'update'];function createListener(_0x14ac6c,_0x376a9b){return function(_0x2e0da6){_0x376a9b[_0xaaf0('0x2')](_0x14ac6c,_0x2e0da6);};}function removeListener(_0x54d6c5,_0x5cdb56){return function(){UserEvents['removeListener'](_0x54d6c5,_0x5cdb56);};}exports[_0xaaf0('0x3')]=function(_0x708f0a){for(var _0x5a6778=0x0,_0x49d8cd=events[_0xaaf0('0x4')];_0x5a6778<_0x49d8cd;_0x5a6778++){var _0x79cf1c=events[_0x5a6778];var _0x5c386c=createListener('user:'+_0x79cf1c,_0x708f0a);UserEvents['on'](_0x79cf1c,_0x5c386c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 2e49b3e..455ff35 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x391566,_0xbf8b1){var _0x89d416=function(_0x3ba99b){while(--_0x3ba99b){_0x391566['push'](_0x391566['shift']());}};_0x89d416(++_0xbf8b1);}(_0xe706,0xa3));var _0x6e70=function(_0xd60cb,_0x25496e){_0xd60cb=_0xd60cb-0x0;var _0x47eecd=_0xe706[_0xd60cb];return _0x47eecd;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3b8129,_0x1dd2a4){var _0x4a0b4d=function(_0x24a9df){while(--_0x24a9df){_0x3b8129['push'](_0x3b8129['shift']());}};_0x4a0b4d(++_0x1dd2a4);}(_0x70e0,0x17b));var _0x070e=function(_0x308a04,_0x15a9bf){_0x308a04=_0x308a04-0x0;var _0x2ba3a3=_0x70e0[_0x308a04];return _0x2ba3a3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 0a088be..f2eba70 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 _0xa994=['sequelize','INTEGER'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0xa994,0xde));var _0x4a99=function(_0x12ea09,_0x120d25){_0x12ea09=_0x12ea09-0x0;var _0x19a96f=_0xa994[_0x12ea09];return _0x19a96f;};'use strict';var Sequelize=require(_0x4a99('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4a99('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1a1c=['exports','INTEGER','sequelize'];(function(_0x26d0e8,_0x42951c){var _0x3ebfa0=function(_0x2222bf){while(--_0x2222bf){_0x26d0e8['push'](_0x26d0e8['shift']());}};_0x3ebfa0(++_0x42951c);}(_0x1a1c,0xfe));var _0xc1a1=function(_0x2b89b3,_0x34f40d){_0x2b89b3=_0x2b89b3-0x0;var _0x316b4a=_0x1a1c[_0x2b89b3];return _0x316b4a;};'use strict';var Sequelize=require(_0xc1a1('0x0'));module[_0xc1a1('0x1')]={'penalty':{'type':Sequelize[_0xc1a1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index f93c72a..4ef41d8 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 _0x5f55=['moment','request-promise','./userChatQueue.attributes','exports','define','user_has_chat_queues','util','../../config/logger','api'];(function(_0x2840b3,_0x3a771b){var _0xe24afe=function(_0x1de84f){while(--_0x1de84f){_0x2840b3['push'](_0x2840b3['shift']());}};_0xe24afe(++_0x3a771b);}(_0x5f55,0x1b6));var _0x55f5=function(_0x15411f,_0x42bef8){_0x15411f=_0x15411f-0x0;var _0x555650=_0x5f55[_0x15411f];return _0x555650;};'use strict';var _=require('lodash');var util=require(_0x55f5('0x0'));var logger=require(_0x55f5('0x1'))(_0x55f5('0x2'));var moment=require(_0x55f5('0x3'));var BPromise=require('bluebird');var rp=require(_0x55f5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x55f5('0x5'));module[_0x55f5('0x6')]=function(_0x232589,_0x42cb33){return _0x232589[_0x55f5('0x7')]('UserChatQueue',attributes,{'tableName':_0x55f5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x029f=['bluebird','rimraf','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x029f,0x124));var _0xf029=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x029f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf029('0x0'));var util=require(_0xf029('0x1'));var logger=require(_0xf029('0x2'))(_0xf029('0x3'));var moment=require(_0xf029('0x4'));var BPromise=require(_0xf029('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf029('0x6'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xf029('0x7')]=function(_0x1ce8fb,_0x34290f){return _0x1ce8fb[_0xf029('0x8')](_0xf029('0x9'),attributes,{'tableName':_0xf029('0xa'),'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 eb5f8eb..62312f2 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 _0x78e5=['client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x6450e9,_0x1523fd){var _0x1fa94a=function(_0x25b6dc){while(--_0x25b6dc){_0x6450e9['push'](_0x6450e9['shift']());}};_0x1fa94a(++_0x1523fd);}(_0x78e5,0xd1));var _0x578e=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x78e5[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x578e('0x0'));var moment=require(_0x578e('0x1'));var BPromise=require(_0x578e('0x2'));var rs=require(_0x578e('0x3'));var fs=require('fs');var Redis=require(_0x578e('0x4'));var db=require(_0x578e('0x5'))['db'];var utils=require(_0x578e('0x6'));var logger=require(_0x578e('0x7'))(_0x578e('0x8'));var config=require(_0x578e('0x9'));var jayson=require(_0x578e('0xa'));var client=jayson[_0x578e('0xb')][_0x578e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1781ec,_0x26a531,_0xb580be){return new BPromise(function(_0x2896b9,_0x15482b){return client[_0x578e('0xd')](_0x1781ec,_0xb580be)['then'](function(_0x282c4b){logger['info'](_0x578e('0xe'),_0x26a531,_0x578e('0xf'));logger['debug'](_0x578e('0x10'),_0x26a531,'request\x20sent',JSON['stringify'](_0x282c4b));if(_0x282c4b[_0x578e('0x11')]){if(_0x282c4b[_0x578e('0x11')]['code']===0x1f4){logger[_0x578e('0x11')](_0x578e('0xe'),_0x26a531,_0x282c4b[_0x578e('0x11')]['message']);return _0x15482b(_0x282c4b[_0x578e('0x11')][_0x578e('0x12')]);}logger[_0x578e('0x11')](_0x578e('0xe'),_0x26a531,_0x282c4b[_0x578e('0x11')][_0x578e('0x12')]);return _0x2896b9(_0x282c4b['error'][_0x578e('0x12')]);}else{logger[_0x578e('0x13')](_0x578e('0xe'),_0x26a531,_0x578e('0xf'));_0x2896b9(_0x282c4b[_0x578e('0x14')][_0x578e('0x12')]);}})[_0x578e('0x15')](function(_0x489dbc){logger[_0x578e('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x26a531,_0x489dbc);_0x15482b(_0x489dbc);});});} \ No newline at end of file +var _0xa5a6=['http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1c85df,_0x5be2a6){var _0x582183=function(_0x36dc19){while(--_0x36dc19){_0x1c85df['push'](_0x1c85df['shift']());}};_0x582183(++_0x5be2a6);}(_0xa5a6,0xe7));var _0x6a5a=function(_0x25ea25,_0x570998){_0x25ea25=_0x25ea25-0x0;var _0x1d453c=_0xa5a6[_0x25ea25];return _0x1d453c;};'use strict';var _=require(_0x6a5a('0x0'));var util=require('util');var moment=require(_0x6a5a('0x1'));var BPromise=require(_0x6a5a('0x2'));var rs=require(_0x6a5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a5a('0x4'));var logger=require(_0x6a5a('0x5'))('rpc');var config=require(_0x6a5a('0x6'));var jayson=require(_0x6a5a('0x7'));var client=jayson[_0x6a5a('0x8')][_0x6a5a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46357a,_0x516672,_0x11c60b){return new BPromise(function(_0x53f3ea,_0x370054){return client['request'](_0x46357a,_0x11c60b)['then'](function(_0x721464){logger[_0x6a5a('0xa')](_0x6a5a('0xb'),_0x516672,_0x6a5a('0xc'));logger[_0x6a5a('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x516672,'request\x20sent',JSON[_0x6a5a('0xe')](_0x721464));if(_0x721464['error']){if(_0x721464[_0x6a5a('0xf')][_0x6a5a('0x10')]===0x1f4){logger[_0x6a5a('0xf')](_0x6a5a('0xb'),_0x516672,_0x721464[_0x6a5a('0xf')][_0x6a5a('0x11')]);return _0x370054(_0x721464[_0x6a5a('0xf')][_0x6a5a('0x11')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x516672,_0x721464['error'][_0x6a5a('0x11')]);return _0x53f3ea(_0x721464[_0x6a5a('0xf')]['message']);}else{logger[_0x6a5a('0xa')](_0x6a5a('0xb'),_0x516672,_0x6a5a('0xc'));_0x53f3ea(_0x721464[_0x6a5a('0x12')][_0x6a5a('0x11')]);}})[_0x6a5a('0x13')](function(_0x4e605b){logger[_0x6a5a('0xf')](_0x6a5a('0xb'),_0x516672,_0x4e605b);_0x370054(_0x4e605b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 077e22c..3fd8dc8 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3e1cca,_0x5acfc2){var _0x479671=function(_0x46df5a){while(--_0x46df5a){_0x3e1cca['push'](_0x3e1cca['shift']());}};_0x479671(++_0x5acfc2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2c776e,_0x4eba21){var _0x159ea8=function(_0x348cab){while(--_0x348cab){_0x2c776e['push'](_0x2c776e['shift']());}};_0x159ea8(++_0x4eba21);}(_0xedd9,0xfc));var _0x9edd=function(_0x4dbcbe,_0x18e31d){_0x4dbcbe=_0x4dbcbe-0x0;var _0x4cefa1=_0xedd9[_0x4dbcbe];return _0x4cefa1;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e342769..9ae0709 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 _0x8f34=['INTEGER','STRING','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8f34,0x6e));var _0x48f3=function(_0x16e7a1,_0x4d8eda){_0x16e7a1=_0x16e7a1-0x0;var _0x43ce6a=_0x8f34[_0x16e7a1];return _0x43ce6a;};'use strict';var Sequelize=require(_0x48f3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x48f3('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x48f3('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x48f3('0x2')]}}; \ No newline at end of file +var _0x38e6=['sequelize','exports','INTEGER','STRING'];(function(_0x4aac5b,_0x458bc7){var _0x284f85=function(_0x2b6f3b){while(--_0x2b6f3b){_0x4aac5b['push'](_0x4aac5b['shift']());}};_0x284f85(++_0x458bc7);}(_0x38e6,0x168));var _0x638e=function(_0x1c32df,_0x38d919){_0x1c32df=_0x1c32df-0x0;var _0x5765e8=_0x38e6[_0x1c32df];return _0x5765e8;};'use strict';var Sequelize=require(_0x638e('0x0'));module[_0x638e('0x1')]={'penalty':{'type':Sequelize[_0x638e('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x638e('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 74adc09..476c669 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 _0x1b41=['api','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','util'];(function(_0x365ed4,_0x572c95){var _0x59bbfe=function(_0x4a9ced){while(--_0x4a9ced){_0x365ed4['push'](_0x365ed4['shift']());}};_0x59bbfe(++_0x572c95);}(_0x1b41,0xfb));var _0x11b4=function(_0x57beaf,_0x165fb5){_0x57beaf=_0x57beaf-0x0;var _0x1f23c6=_0x1b41[_0x57beaf];return _0x1f23c6;};'use strict';var _=require('lodash');var util=require(_0x11b4('0x0'));var logger=require('../../config/logger')(_0x11b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x11b4('0x2'));var rimraf=require(_0x11b4('0x3'));var config=require(_0x11b4('0x4'));var attributes=require(_0x11b4('0x5'));module[_0x11b4('0x6')]=function(_0xf1ba5a,_0x5272c2){return _0xf1ba5a[_0x11b4('0x7')](_0x11b4('0x8'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4fc=['UserFaxQueue','user_has_fax_queues','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x592c4e,_0x600445){var _0x43b052=function(_0x471ea4){while(--_0x471ea4){_0x592c4e['push'](_0x592c4e['shift']());}};_0x43b052(++_0x600445);}(_0xc4fc,0x152));var _0xcc4f=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xc4fc[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcc4f('0x0'))('api');var moment=require(_0xcc4f('0x1'));var BPromise=require(_0xcc4f('0x2'));var rp=require(_0xcc4f('0x3'));var fs=require('fs');var path=require(_0xcc4f('0x4'));var rimraf=require(_0xcc4f('0x5'));var config=require(_0xcc4f('0x6'));var attributes=require(_0xcc4f('0x7'));module[_0xcc4f('0x8')]=function(_0x461a19,_0xa87248){return _0x461a19[_0xcc4f('0x9')](_0xcc4f('0xa'),attributes,{'tableName':_0xcc4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 4c0c613..e2b5682 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 _0x0832=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x3abdd1,_0x15d287){var _0x12a254=function(_0x1c04d0){while(--_0x1c04d0){_0x3abdd1['push'](_0x3abdd1['shift']());}};_0x12a254(++_0x15d287);}(_0x0832,0x14a));var _0x2083=function(_0x1167c0,_0x35949a){_0x1167c0=_0x1167c0-0x0;var _0x20219d=_0x0832[_0x1167c0];return _0x20219d;};'use strict';var _=require(_0x2083('0x0'));var util=require(_0x2083('0x1'));var moment=require(_0x2083('0x2'));var BPromise=require('bluebird');var rs=require(_0x2083('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2083('0x4'));var logger=require(_0x2083('0x5'))('rpc');var config=require(_0x2083('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2083('0x7')][_0x2083('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ab2fb,_0x380603,_0x18eb1c){return new BPromise(function(_0x362736,_0x5cfa45){return client[_0x2083('0x9')](_0x5ab2fb,_0x18eb1c)[_0x2083('0xa')](function(_0x1e87b7){logger[_0x2083('0xb')](_0x2083('0xc'),_0x380603,'request\x20sent');logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x380603,_0x2083('0xd'),JSON[_0x2083('0xe')](_0x1e87b7));if(_0x1e87b7[_0x2083('0xf')]){if(_0x1e87b7['error'][_0x2083('0x10')]===0x1f4){logger[_0x2083('0xf')](_0x2083('0xc'),_0x380603,_0x1e87b7[_0x2083('0xf')][_0x2083('0x11')]);return _0x5cfa45(_0x1e87b7[_0x2083('0xf')][_0x2083('0x11')]);}logger[_0x2083('0xf')](_0x2083('0xc'),_0x380603,_0x1e87b7[_0x2083('0xf')][_0x2083('0x11')]);return _0x362736(_0x1e87b7[_0x2083('0xf')][_0x2083('0x11')]);}else{logger[_0x2083('0xb')](_0x2083('0xc'),_0x380603,_0x2083('0xd'));_0x362736(_0x1e87b7['result'][_0x2083('0x11')]);}})['catch'](function(_0x132a60){logger[_0x2083('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x380603,_0x132a60);_0x5cfa45(_0x132a60);});});} \ No newline at end of file +var _0x0d5f=['../../config/logger','jayson/promise','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x147b33,_0x3d906e){var _0x3f66d8=function(_0x2d9878){while(--_0x2d9878){_0x147b33['push'](_0x147b33['shift']());}};_0x3f66d8(++_0x3d906e);}(_0x0d5f,0x107));var _0xf0d5=function(_0x462bcf,_0x2112ae){_0x462bcf=_0x462bcf-0x0;var _0x54bbcb=_0x0d5f[_0x462bcf];return _0x54bbcb;};'use strict';var _=require(_0xf0d5('0x0'));var util=require(_0xf0d5('0x1'));var moment=require(_0xf0d5('0x2'));var BPromise=require(_0xf0d5('0x3'));var rs=require(_0xf0d5('0x4'));var fs=require('fs');var Redis=require(_0xf0d5('0x5'));var db=require(_0xf0d5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0d5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf0d5('0x8'));var client=jayson['client'][_0xf0d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31b6fa,_0x29d74b,_0x38e869){return new BPromise(function(_0x1c6f4c,_0xa30b07){return client['request'](_0x31b6fa,_0x38e869)['then'](function(_0x56c0e4){logger[_0xf0d5('0xa')](_0xf0d5('0xb'),_0x29d74b,_0xf0d5('0xc'));logger[_0xf0d5('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x29d74b,'request\x20sent',JSON['stringify'](_0x56c0e4));if(_0x56c0e4[_0xf0d5('0xe')]){if(_0x56c0e4[_0xf0d5('0xe')][_0xf0d5('0xf')]===0x1f4){logger['error'](_0xf0d5('0xb'),_0x29d74b,_0x56c0e4[_0xf0d5('0xe')]['message']);return _0xa30b07(_0x56c0e4[_0xf0d5('0xe')]['message']);}logger[_0xf0d5('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x29d74b,_0x56c0e4[_0xf0d5('0xe')][_0xf0d5('0x10')]);return _0x1c6f4c(_0x56c0e4['error'][_0xf0d5('0x10')]);}else{logger[_0xf0d5('0xa')](_0xf0d5('0xb'),_0x29d74b,_0xf0d5('0xc'));_0x1c6f4c(_0x56c0e4['result']['message']);}})[_0xf0d5('0x11')](function(_0x571490){logger[_0xf0d5('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x29d74b,_0x571490);_0xa30b07(_0x571490);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8401f55..2ed8edd 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x38b187,_0x33190d){var _0x4878e4=function(_0x3f713b){while(--_0x3f713b){_0x38b187['push'](_0x38b187['shift']());}};_0x4878e4(++_0x33190d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0xcb91[_0x2265da];return _0x430c2b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1c08f8,_0x367831){var _0x31c27b=function(_0x57e3d2){while(--_0x57e3d2){_0x1c08f8['push'](_0x1c08f8['shift']());}};_0x31c27b(++_0x367831);}(_0x70e0,0x17b));var _0x070e=function(_0x13e2eb,_0x4d6e66){_0x13e2eb=_0x13e2eb-0x0;var _0x5b06aa=_0x70e0[_0x13e2eb];return _0x5b06aa;};'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 1bc41cc..0a11283 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 _0x9306=['sequelize','exports'];(function(_0x11ae17,_0x5859e1){var _0x17d457=function(_0x1bff19){while(--_0x1bff19){_0x11ae17['push'](_0x11ae17['shift']());}};_0x17d457(++_0x5859e1);}(_0x9306,0x1b4));var _0x6930=function(_0x2ad869,_0x6bb786){_0x2ad869=_0x2ad869-0x0;var _0x30450c=_0x9306[_0x2ad869];return _0x30450c;};'use strict';var Sequelize=require(_0x6930('0x0'));module[_0x6930('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd30e=['sequelize','exports'];(function(_0x45ad59,_0x5aea24){var _0x2750d4=function(_0x20131d){while(--_0x20131d){_0x45ad59['push'](_0x45ad59['shift']());}};_0x2750d4(++_0x5aea24);}(_0xd30e,0x130));var _0xed30=function(_0x3bbb8c,_0x3e6eab){_0x3bbb8c=_0x3bbb8c-0x0;var _0x440654=_0xd30e[_0x3bbb8c];return _0x440654;};'use strict';var Sequelize=require(_0xed30('0x0'));module[_0xed30('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 31de377..7b9267d 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 _0x8175=['user_has_mail_queues','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','define','UserMailQueue'];(function(_0x45fbf5,_0x3ba0b7){var _0x51186f=function(_0x236fc7){while(--_0x236fc7){_0x45fbf5['push'](_0x45fbf5['shift']());}};_0x51186f(++_0x3ba0b7);}(_0x8175,0x11f));var _0x5817=function(_0x6505c,_0x5329a7){_0x6505c=_0x6505c-0x0;var _0x1a7a96=_0x8175[_0x6505c];return _0x1a7a96;};'use strict';var _=require('lodash');var util=require(_0x5817('0x0'));var logger=require(_0x5817('0x1'))('api');var moment=require(_0x5817('0x2'));var BPromise=require(_0x5817('0x3'));var rp=require(_0x5817('0x4'));var fs=require('fs');var path=require(_0x5817('0x5'));var rimraf=require('rimraf');var config=require(_0x5817('0x6'));var attributes=require(_0x5817('0x7'));module['exports']=function(_0x46722c,_0x234fe6){return _0x46722c[_0x5817('0x8')](_0x5817('0x9'),attributes,{'tableName':_0x5817('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa939=['./userMailQueue.attributes','user_has_mail_queues','util','../../config/logger','moment','request-promise','path'];(function(_0x5d5f0f,_0x156fe1){var _0x4caac1=function(_0x403766){while(--_0x403766){_0x5d5f0f['push'](_0x5d5f0f['shift']());}};_0x4caac1(++_0x156fe1);}(_0xa939,0x198));var _0x9a93=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa939[_0xf50820];return _0x2a9b10;};'use strict';var _=require('lodash');var util=require(_0x9a93('0x0'));var logger=require(_0x9a93('0x1'))('api');var moment=require(_0x9a93('0x2'));var BPromise=require('bluebird');var rp=require(_0x9a93('0x3'));var fs=require('fs');var path=require(_0x9a93('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9a93('0x5'));module['exports']=function(_0xd5fd5b,_0x337e15){return _0xd5fd5b['define']('UserMailQueue',attributes,{'tableName':_0x9a93('0x6'),'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 175353d..69ab9c9 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 _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\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'];(function(_0xd3f9cd,_0x51d864){var _0x27010a=function(_0x3cdb76){while(--_0x3cdb76){_0xd3f9cd['push'](_0xd3f9cd['shift']());}};_0x27010a(++_0x51d864);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x53c506,_0x1c0fe8){_0x53c506=_0x53c506-0x0;var _0x165888=_0x7fbe[_0x53c506];return _0x165888;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x59b43c,_0x36a0db){_0x59b43c=_0x59b43c-0x0;var _0x200a78=_0x1cb9[_0x59b43c];return _0x200a78;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index b6193e1..b773c89 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 _0x6b8c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xc533ef,_0x25a924){var _0x494bf7=function(_0x326974){while(--_0x326974){_0xc533ef['push'](_0xc533ef['shift']());}};_0x494bf7(++_0x25a924);}(_0x6b8c,0x19d));var _0xc6b8=function(_0x243dc7,_0x5e3641){_0x243dc7=_0x243dc7-0x0;var _0x3351f6=_0x6b8c[_0x243dc7];return _0x3351f6;};'use strict';var multer=require(_0xc6b8('0x0'));var util=require(_0xc6b8('0x1'));var path=require(_0xc6b8('0x2'));var timeout=require(_0xc6b8('0x3'));var express=require(_0xc6b8('0x4'));var router=express[_0xc6b8('0x5')]();var fs_extra=require(_0xc6b8('0x6'));var auth=require(_0xc6b8('0x7'));var interaction=require(_0xc6b8('0x8'));var config=require(_0xc6b8('0x9'));var controller=require(_0xc6b8('0xa'));router[_0xc6b8('0xb')]('/',auth['isAuthenticated'](),controller[_0xc6b8('0xc')]);module[_0xc6b8('0xd')]=router; \ No newline at end of file +var _0xe912=['post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller'];(function(_0xd031a2,_0x578240){var _0xaee713=function(_0x6bc8b0){while(--_0x6bc8b0){_0xd031a2['push'](_0xd031a2['shift']());}};_0xaee713(++_0x578240);}(_0xe912,0x1f2));var _0x2e91=function(_0x4dfde0,_0xce701f){_0x4dfde0=_0x4dfde0-0x0;var _0x26bfbf=_0xe912[_0x4dfde0];return _0x26bfbf;};'use strict';var multer=require(_0x2e91('0x0'));var util=require(_0x2e91('0x1'));var path=require(_0x2e91('0x2'));var timeout=require(_0x2e91('0x3'));var express=require('express');var router=express[_0x2e91('0x4')]();var fs_extra=require(_0x2e91('0x5'));var auth=require(_0x2e91('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2e91('0x7'));var controller=require(_0x2e91('0x8'));router[_0x2e91('0x9')]('/',auth[_0x2e91('0xa')](),controller[_0x2e91('0xb')]);module[_0x2e91('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 89358c6..13d8dd1 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 _0xca51=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x4fdd2c,_0x48f796){var _0x1ed27c=function(_0x1295c0){while(--_0x1295c0){_0x4fdd2c['push'](_0x4fdd2c['shift']());}};_0x1ed27c(++_0x48f796);}(_0xca51,0x132));var _0x1ca5=function(_0x4c3a00,_0x14b250){_0x4c3a00=_0x4c3a00-0x0;var _0x4b7e13=_0xca51[_0x4c3a00];return _0x4b7e13;};'use strict';var Sequelize=require(_0x1ca5('0x0'));module[_0x1ca5('0x1')]={'body':{'type':Sequelize[_0x1ca5('0x2')]},'senderName':{'type':Sequelize[_0x1ca5('0x3')]},'recipientsId':{'type':Sequelize[_0x1ca5('0x2')]},'recipientsDescription':{'type':Sequelize[_0x1ca5('0x3')]},'beep':{'type':Sequelize[_0x1ca5('0x4')]}}; \ No newline at end of file +var _0xa545=['exports','STRING','TEXT','sequelize'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0xa545,0x8f));var _0x5a54=function(_0x3cdb4a,_0x233b8e){_0x3cdb4a=_0x3cdb4a-0x0;var _0x5d3c4f=_0xa545[_0x3cdb4a];return _0x5d3c4f;};'use strict';var Sequelize=require(_0x5a54('0x0'));module[_0x5a54('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5a54('0x2')]},'recipientsId':{'type':Sequelize[_0x5a54('0x3')]},'recipientsDescription':{'type':Sequelize[_0x5a54('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d6a6d78..5f071ae 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 _0x1069=['findOne','html','startCase','User','ids','queue','replace','Queue','all','union','flatten','getAgents','map','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/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','sendStatus','end','status','json','offset','limit','undefined','count','apply','update','then','stack','name','send','text','body','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','hasOwnProperty','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','voicequeue','team','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','beep','SenderId','join','transaction','create','forEach','recipient','userNotification:send','catch'];(function(_0x15e3e3,_0x46c695){var _0x54bc5b=function(_0x28ad82){while(--_0x28ad82){_0x15e3e3['push'](_0x15e3e3['shift']());}};_0x54bc5b(++_0x46c695);}(_0x1069,0x68));var _0x9106=function(_0x91e802,_0x3cfcaa){_0x91e802=_0x91e802-0x0;var _0x35b3ef=_0x1069[_0x91e802];return _0x35b3ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9106('0x0'));var zipdir=require(_0x9106('0x1'));var jsonpatch=require(_0x9106('0x2'));var rp=require(_0x9106('0x3'));var moment=require(_0x9106('0x4'));var BPromise=require(_0x9106('0x5'));var Mustache=require(_0x9106('0x6'));var util=require(_0x9106('0x7'));var path=require(_0x9106('0x8'));var sox=require(_0x9106('0x9'));var csv=require(_0x9106('0xa'));var ejs=require(_0x9106('0xb'));var fs=require('fs');var fs_extra=require(_0x9106('0xc'));var _=require(_0x9106('0xd'));var squel=require(_0x9106('0xe'));var crypto=require(_0x9106('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9106('0xa'));var querystring=require(_0x9106('0x10'));var Papa=require(_0x9106('0x11'));var Redis=require(_0x9106('0x12'));var authService=require(_0x9106('0x13'));var qs=require(_0x9106('0x14'));var as=require(_0x9106('0x15'));var hardwareService=require(_0x9106('0x16'));var logger=require(_0x9106('0x17'))(_0x9106('0x18'));var utils=require('../../config/utils');var config=require(_0x9106('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9106('0x1a'))['db'];config[_0x9106('0x1b')]=_[_0x9106('0x1c')](config[_0x9106('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9106('0x1d'))(new Redis(config[_0x9106('0x1b')]));require(_0x9106('0x1e'))['register'](socket);function respondWithStatusCode(_0x4e43a6,_0x1f450a){_0x1f450a=_0x1f450a||0xcc;return function(_0x263a94){if(_0x263a94){return _0x4e43a6[_0x9106('0x1f')](_0x1f450a);}return _0x4e43a6['status'](_0x1f450a)[_0x9106('0x20')]();};}function respondWithResult(_0x1c595d,_0x5bfd32){_0x5bfd32=_0x5bfd32||0xc8;return function(_0x14abee){if(_0x14abee){return _0x1c595d[_0x9106('0x21')](_0x5bfd32)[_0x9106('0x22')](_0x14abee);}};}function respondWithFilteredResult(_0x3e12e9,_0x383f46){return function(_0x28db62){if(_0x28db62){var _0x3ed682=typeof _0x383f46[_0x9106('0x23')]==='undefined'&&typeof _0x383f46[_0x9106('0x24')]===_0x9106('0x25');var _0x573a81=_0x28db62[_0x9106('0x26')];var _0x105a8a=_0x3ed682?0x0:_0x383f46['offset'];var _0x18279e=_0x3ed682?_0x28db62[_0x9106('0x26')]:_0x383f46[_0x9106('0x23')]+_0x383f46['limit'];var _0x5ac4f2;if(_0x18279e>=_0x573a81){_0x18279e=_0x573a81;_0x5ac4f2=0xc8;}else{_0x5ac4f2=0xce;}_0x3e12e9[_0x9106('0x21')](_0x5ac4f2);return _0x3e12e9['set']('Content-Range',_0x105a8a+'-'+_0x18279e+'/'+_0x573a81)['json'](_0x28db62);}return null;};}function patchUpdates(_0x5d97e2){return function(_0x24daa0){try{jsonpatch[_0x9106('0x27')](_0x24daa0,_0x5d97e2,!![]);}catch(_0x48aa9c){return BPromise['reject'](_0x48aa9c);}return _0x24daa0['save']();};}function saveUpdates(_0x20329d,_0x41d1f2){return function(_0x20f171){if(_0x20f171){return _0x20f171[_0x9106('0x28')](_0x20329d)[_0x9106('0x29')](function(_0x1507fa){return _0x1507fa;});}return null;};}function removeEntity(_0x3a1ee9,_0x1ae81a){return function(_0x5daad8){if(_0x5daad8){return _0x5daad8['destroy']()[_0x9106('0x29')](function(){_0x3a1ee9[_0x9106('0x21')](0xcc)[_0x9106('0x20')]();});}};}function handleEntityNotFound(_0x694000,_0x453298){return function(_0xaa5e9d){if(!_0xaa5e9d){_0x694000[_0x9106('0x1f')](0x194);}return _0xaa5e9d;};}function handleError(_0x13c3ab,_0x501e22){_0x501e22=_0x501e22||0x1f4;return function(_0x9cec7e){logger['error'](_0x9cec7e[_0x9106('0x2a')]);if(_0x9cec7e[_0x9106('0x2b')]){delete _0x9cec7e[_0x9106('0x2b')];}_0x13c3ab[_0x9106('0x21')](_0x501e22)[_0x9106('0x2c')](_0x9cec7e);};}exports['sendUserNotification']=function(_0x142294,_0x490cd2,_0x1ac314){if(!_0x142294['body']['hasOwnProperty'](_0x9106('0x2d'))&&!_0x142294[_0x9106('0x2e')]['hasOwnProperty']('TemplateId')){throw new db[(_0x9106('0x2f'))]['ValidationError'](_0x9106('0x30'));}else{if(_0x142294[_0x9106('0x2e')]['hasOwnProperty'](_0x9106('0x31'))&&!_0x142294[_0x9106('0x2e')][_0x9106('0x32')](_0x9106('0x33'))){throw new db[(_0x9106('0x2f'))][(_0x9106('0x34'))](_0x9106('0x35'));}if(!_0x142294[_0x9106('0x2e')][_0x9106('0x32')](_0x9106('0x36'))){throw new db[(_0x9106('0x2f'))][(_0x9106('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x56f3b1=JSON['parse'](_0x142294['body'][_0x9106('0x36')]);}catch(_0x41ff74){logger[_0x9106('0x37')](_0x41ff74);throw new db[(_0x9106('0x2f'))][(_0x9106('0x34'))](_0x9106('0x38'));}var _0x9d4e20=['chatqueue',_0x9106('0x39'),_0x9106('0x3a'),_0x9106('0x3b'),'smsqueue',_0x9106('0x3c'),'whatsappqueue',_0x9106('0x3d'),'user'];if(_['some'](_0x56f3b1,function(_0x79bc77){return!_[_0x9106('0x3e')](_0x9d4e20,_0x79bc77[_0x9106('0x3f')][_0x9106('0x40')]());})){throw new db[(_0x9106('0x2f'))][(_0x9106('0x34'))](_0x9106('0x41'));}}}var _0x1e0aa8={};_0x1e0aa8['senderName']=_0x142294['body'][_0x9106('0x32')]('senderName')?_0x142294[_0x9106('0x2e')][_0x9106('0x42')]:_0x142294[_0x9106('0x43')]['fullname'];_0x1e0aa8[_0x9106('0x44')]=_['isEmpty'](_0x142294[_0x9106('0x2e')][_0x9106('0x44')])?null:_0x142294[_0x9106('0x2e')][_0x9106('0x44')];_0x1e0aa8[_0x9106('0x45')]=_0x142294[_0x9106('0x2e')][_0x9106('0x45')]||![];_0x1e0aa8[_0x9106('0x46')]=_0x142294[_0x9106('0x43')]['id'];return getContent(_0x142294[_0x9106('0x2e')])[_0x9106('0x29')](function(_0x38665e){_0x1e0aa8[_0x9106('0x2e')]=_0x38665e;return getRecipients(_0x56f3b1);})[_0x9106('0x29')](function(_0x377448){_0x1e0aa8['recipientsId']=_['sortBy'](_0x377448)[_0x9106('0x47')](',');return db['sequelize'][_0x9106('0x48')](function(_0x2ff7c8){return db['UserNotification'][_0x9106('0x49')](_0x1e0aa8,{'raw':!![],'transaction':_0x2ff7c8})['then'](function(_0x483bb4){var _0x230f9f={'sender':_0x1e0aa8[_0x9106('0x42')],'description':_0x1e0aa8[_0x9106('0x44')],'content':_0x1e0aa8['body'],'beep':_0x1e0aa8['beep']};_0x377448[_0x9106('0x4a')](function(_0x536671){_0x230f9f[_0x9106('0x4b')]=_0x536671;socket['emit'](_0x9106('0x4c'),_0x230f9f);});return _0x483bb4;});});})[_0x9106('0x29')](respondWithResult(_0x490cd2,0xc9))[_0x9106('0x4d')](handleError(_0x490cd2,null));};function getContent(_0x3f07ce){return new BPromise(function(_0x179249,_0x4723cf){if(_0x3f07ce[_0x9106('0x2d')]){_0x179249(_0x3f07ce['text']);return;}return db['Template'][_0x9106('0x4e')]({'attributes':[_0x9106('0x4f')],'where':{'id':_0x3f07ce[_0x9106('0x31')]},'raw':!![]})[_0x9106('0x29')](function(_0x21b2d6){if(!_0x21b2d6)throw new db[(_0x9106('0x2f'))][(_0x9106('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x38dd37=Mustache['render'](_0x21b2d6[_0x9106('0x4f')],_0x3f07ce['view']);_0x179249(_0x38dd37);})[_0x9106('0x4d')](function(_0x4ca8b3){_0x4723cf(_0x4ca8b3);});});}function getRecipients(_0x2a0312){return new BPromise(function(_0x1e122f,_0x171225){var _0x7cb00c=[];var _0x43608b=[];_0x2a0312['forEach'](function(_0x15792a){var _0x11e036=_[_0x9106('0x50')](_0x15792a[_0x9106('0x3f')][_0x9106('0x40')]());if(_0x11e036===_0x9106('0x51')){_0x7cb00c=_['union'](_0x7cb00c,_0x15792a[_0x9106('0x52')]);}else{if(_[_0x9106('0x3e')](_0x11e036,_0x9106('0x53')))_0x11e036=_0x11e036[_0x9106('0x54')](_0x9106('0x53'),_0x9106('0x55'));_0x15792a[_0x9106('0x52')]['forEach'](function(_0x18f589){_0x43608b['push'](getAgents(_0x11e036,_0x18f589));});}});return BPromise[_0x9106('0x56')](_0x43608b)[_0x9106('0x29')](function(_0x47f33d){_0x7cb00c=_[_0x9106('0x57')](_0x7cb00c,_[_0x9106('0x58')](_0x47f33d));_0x1e122f(_0x7cb00c);})['catch'](function(_0x300d18){_0x171225(_0x300d18);});});}function getAgents(_0x31b7d8,_0x10aa98){return new BPromise(function(_0x5bf5a0,_0xc4c096){return db[_0x31b7d8][_0x9106('0x4e')]({'where':{'id':_0x10aa98}})[_0x9106('0x29')](function(_0x52113a){return _0x52113a[_0x9106('0x59')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4731a3){var _0x12343f=_[_0x9106('0x5a')](_0x4731a3,'id');_0x5bf5a0(_0x12343f);});})[_0x9106('0x4d')](function(_0x30cc8a){_0xc4c096(_0x30cc8a);});});} \ No newline at end of file +var _0xe85e=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','transaction','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','Queue','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x41c904,_0x3d92e5){var _0x56df70=function(_0x2c4d17){while(--_0x2c4d17){_0x41c904['push'](_0x41c904['shift']());}};_0x56df70(++_0x3d92e5);}(_0xe85e,0x12f));var _0xee85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee85('0x0'));var rimraf=require(_0xee85('0x1'));var zipdir=require(_0xee85('0x2'));var jsonpatch=require(_0xee85('0x3'));var rp=require(_0xee85('0x4'));var moment=require('moment');var BPromise=require(_0xee85('0x5'));var Mustache=require(_0xee85('0x6'));var util=require(_0xee85('0x7'));var path=require(_0xee85('0x8'));var sox=require(_0xee85('0x9'));var csv=require(_0xee85('0xa'));var ejs=require(_0xee85('0xb'));var fs=require('fs');var fs_extra=require(_0xee85('0xc'));var _=require('lodash');var squel=require(_0xee85('0xd'));var crypto=require('crypto');var jsforce=require(_0xee85('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xee85('0xa'));var querystring=require('querystring');var Papa=require(_0xee85('0xf'));var Redis=require('ioredis');var authService=require(_0xee85('0x10'));var qs=require(_0xee85('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee85('0x12'));var logger=require(_0xee85('0x13'))(_0xee85('0x14'));var utils=require(_0xee85('0x15'));var config=require(_0xee85('0x16'));var licenseUtil=require(_0xee85('0x17'));var db=require(_0xee85('0x18'))['db'];config[_0xee85('0x19')]=_[_0xee85('0x1a')](config[_0xee85('0x19')],{'host':_0xee85('0x1b'),'port':0x18eb});var socket=require(_0xee85('0x1c'))(new Redis(config[_0xee85('0x19')]));require('./userNotification.socket')[_0xee85('0x1d')](socket);function respondWithStatusCode(_0x58ab62,_0xc8d630){_0xc8d630=_0xc8d630||0xcc;return function(_0x15d5ca){if(_0x15d5ca){return _0x58ab62[_0xee85('0x1e')](_0xc8d630);}return _0x58ab62[_0xee85('0x1f')](_0xc8d630)[_0xee85('0x20')]();};}function respondWithResult(_0x2209de,_0x10f90e){_0x10f90e=_0x10f90e||0xc8;return function(_0x25d335){if(_0x25d335){return _0x2209de[_0xee85('0x1f')](_0x10f90e)[_0xee85('0x21')](_0x25d335);}};}function respondWithFilteredResult(_0x1567ed,_0x33aed0){return function(_0x1cfc25){if(_0x1cfc25){var _0x359c63=typeof _0x33aed0[_0xee85('0x22')]===_0xee85('0x23')&&typeof _0x33aed0['limit']==='undefined';var _0x2c16f8=_0x1cfc25['count'];var _0x12bb23=_0x359c63?0x0:_0x33aed0[_0xee85('0x22')];var _0x359180=_0x359c63?_0x1cfc25['count']:_0x33aed0[_0xee85('0x22')]+_0x33aed0[_0xee85('0x24')];var _0x2318e2;if(_0x359180>=_0x2c16f8){_0x359180=_0x2c16f8;_0x2318e2=0xc8;}else{_0x2318e2=0xce;}_0x1567ed[_0xee85('0x1f')](_0x2318e2);return _0x1567ed[_0xee85('0x25')](_0xee85('0x26'),_0x12bb23+'-'+_0x359180+'/'+_0x2c16f8)[_0xee85('0x21')](_0x1cfc25);}return null;};}function patchUpdates(_0x4b65c5){return function(_0x5d172f){try{jsonpatch[_0xee85('0x27')](_0x5d172f,_0x4b65c5,!![]);}catch(_0x2a09ed){return BPromise[_0xee85('0x28')](_0x2a09ed);}return _0x5d172f['save']();};}function saveUpdates(_0x4b5f9a,_0x332800){return function(_0x4a5035){if(_0x4a5035){return _0x4a5035[_0xee85('0x29')](_0x4b5f9a)[_0xee85('0x2a')](function(_0x294842){return _0x294842;});}return null;};}function removeEntity(_0xa8b70f,_0x404fe3){return function(_0x453961){if(_0x453961){return _0x453961[_0xee85('0x2b')]()[_0xee85('0x2a')](function(){_0xa8b70f[_0xee85('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c68f7,_0x47a1c8){return function(_0x1d3d64){if(!_0x1d3d64){_0x5c68f7['sendStatus'](0x194);}return _0x1d3d64;};}function handleError(_0xff365,_0x306f4c){_0x306f4c=_0x306f4c||0x1f4;return function(_0x57ff01){logger['error'](_0x57ff01[_0xee85('0x2c')]);if(_0x57ff01[_0xee85('0x2d')]){delete _0x57ff01[_0xee85('0x2d')];}_0xff365['status'](_0x306f4c)[_0xee85('0x2e')](_0x57ff01);};}exports[_0xee85('0x2f')]=function(_0x531bf0,_0x137d90,_0x19517c){if(!_0x531bf0[_0xee85('0x30')][_0xee85('0x31')](_0xee85('0x32'))&&!_0x531bf0[_0xee85('0x30')]['hasOwnProperty']('TemplateId')){throw new db[(_0xee85('0x33'))][(_0xee85('0x34'))](_0xee85('0x35'));}else{if(_0x531bf0[_0xee85('0x30')][_0xee85('0x31')](_0xee85('0x36'))&&!_0x531bf0[_0xee85('0x30')][_0xee85('0x31')](_0xee85('0x37'))){throw new db[(_0xee85('0x33'))][(_0xee85('0x34'))](_0xee85('0x38'));}if(!_0x531bf0[_0xee85('0x30')]['hasOwnProperty'](_0xee85('0x39'))){throw new db[(_0xee85('0x33'))][(_0xee85('0x34'))](_0xee85('0x3a'));}else{try{var _0x22f54b=JSON[_0xee85('0x3b')](_0x531bf0['body'][_0xee85('0x39')]);}catch(_0x174959){logger[_0xee85('0x3c')](_0x174959);throw new db[(_0xee85('0x33'))][(_0xee85('0x34'))](_0xee85('0x3d'));}var _0x3f5690=[_0xee85('0x3e'),_0xee85('0x3f'),_0xee85('0x40'),_0xee85('0x41'),_0xee85('0x42'),'voicequeue',_0xee85('0x43'),_0xee85('0x44'),_0xee85('0x45')];if(_['some'](_0x22f54b,function(_0x16a503){return!_[_0xee85('0x46')](_0x3f5690,_0x16a503[_0xee85('0x47')][_0xee85('0x48')]());})){throw new db[(_0xee85('0x33'))]['ValidationError'](_0xee85('0x49'));}}}var _0x336ddc={};_0x336ddc[_0xee85('0x4a')]=_0x531bf0[_0xee85('0x30')]['hasOwnProperty'](_0xee85('0x4a'))?_0x531bf0[_0xee85('0x30')][_0xee85('0x4a')]:_0x531bf0['user'][_0xee85('0x4b')];_0x336ddc[_0xee85('0x4c')]=_[_0xee85('0x4d')](_0x531bf0[_0xee85('0x30')]['recipientsDescription'])?null:_0x531bf0[_0xee85('0x30')][_0xee85('0x4c')];_0x336ddc[_0xee85('0x4e')]=_0x531bf0['body'][_0xee85('0x4e')]||![];_0x336ddc['SenderId']=_0x531bf0[_0xee85('0x45')]['id'];return getContent(_0x531bf0[_0xee85('0x30')])[_0xee85('0x2a')](function(_0x3bc6c9){_0x336ddc[_0xee85('0x30')]=_0x3bc6c9;return getRecipients(_0x22f54b);})[_0xee85('0x2a')](function(_0xf28391){_0x336ddc['recipientsId']=_[_0xee85('0x4f')](_0xf28391)[_0xee85('0x50')](',');return db[_0xee85('0x51')][_0xee85('0x52')](function(_0x568dad){return db['UserNotification']['create'](_0x336ddc,{'raw':!![],'transaction':_0x568dad})[_0xee85('0x2a')](function(_0x2f643b){var _0x2fbaa0={'sender':_0x336ddc[_0xee85('0x4a')],'description':_0x336ddc[_0xee85('0x4c')],'content':_0x336ddc[_0xee85('0x30')],'beep':_0x336ddc['beep']};_0xf28391[_0xee85('0x53')](function(_0x478e72){_0x2fbaa0[_0xee85('0x54')]=_0x478e72;socket[_0xee85('0x55')](_0xee85('0x56'),_0x2fbaa0);});return _0x2f643b;});});})[_0xee85('0x2a')](respondWithResult(_0x137d90,0xc9))[_0xee85('0x57')](handleError(_0x137d90,null));};function getContent(_0xb7ea89){return new BPromise(function(_0x2498a5,_0x17a2b5){if(_0xb7ea89[_0xee85('0x32')]){_0x2498a5(_0xb7ea89[_0xee85('0x32')]);return;}return db[_0xee85('0x58')][_0xee85('0x59')]({'attributes':[_0xee85('0x5a')],'where':{'id':_0xb7ea89['TemplateId']},'raw':!![]})[_0xee85('0x2a')](function(_0x5c5051){if(!_0x5c5051)throw new db[(_0xee85('0x33'))][(_0xee85('0x34'))](_0xee85('0x5b'));var _0x4339d8=Mustache[_0xee85('0x5c')](_0x5c5051[_0xee85('0x5a')],_0xb7ea89[_0xee85('0x37')]);_0x2498a5(_0x4339d8);})[_0xee85('0x57')](function(_0xd950f4){_0x17a2b5(_0xd950f4);});});}function getRecipients(_0x2eb76d){return new BPromise(function(_0x83383d,_0xb30f92){var _0x460f91=[];var _0x19b915=[];_0x2eb76d[_0xee85('0x53')](function(_0x4dcaa5){var _0x22a205=_[_0xee85('0x5d')](_0x4dcaa5[_0xee85('0x47')][_0xee85('0x48')]());if(_0x22a205===_0xee85('0x5e')){_0x460f91=_[_0xee85('0x5f')](_0x460f91,_0x4dcaa5[_0xee85('0x60')]);}else{if(_[_0xee85('0x46')](_0x22a205,'queue'))_0x22a205=_0x22a205['replace'](_0xee85('0x61'),_0xee85('0x62'));_0x4dcaa5[_0xee85('0x60')][_0xee85('0x53')](function(_0x3d92df){_0x19b915['push'](getAgents(_0x22a205,_0x3d92df));});}});return BPromise[_0xee85('0x63')](_0x19b915)[_0xee85('0x2a')](function(_0x3f6122){_0x460f91=_[_0xee85('0x5f')](_0x460f91,_[_0xee85('0x64')](_0x3f6122));_0x83383d(_0x460f91);})[_0xee85('0x57')](function(_0x513b8a){_0xb30f92(_0x513b8a);});});}function getAgents(_0x4ec30e,_0x124854){return new BPromise(function(_0x42b749,_0x4b7da0){return db[_0x4ec30e][_0xee85('0x59')]({'where':{'id':_0x124854}})[_0xee85('0x2a')](function(_0x5478d8){return _0x5478d8[_0xee85('0x65')]({'attributes':['id'],'raw':!![]})[_0xee85('0x2a')](function(_0x3a9892){var _0x1eae93=_[_0xee85('0x66')](_0x3a9892,'id');_0x42b749(_0x1eae93);});})[_0xee85('0x57')](function(_0x295afc){_0x4b7da0(_0x295afc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8101784..152255d 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 _0xda17=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x20ae9d,_0x77e369){var _0x1a616f=function(_0x2c7e76){while(--_0x2c7e76){_0x20ae9d['push'](_0x20ae9d['shift']());}};_0x1a616f(++_0x77e369);}(_0xda17,0x1b1));var _0x7da1=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xda17[_0x47b58b];return _0x46bebe;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x7da1('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7da1('0x1'),'afterUpdate':_0x7da1('0x2'),'afterDestroy':_0x7da1('0x3')};function emitEvent(_0x5ca8c1){return function(_0x1aeae7,_0x1678c5,_0x45c20e){UserNotificationEvents[_0x7da1('0x4')](_0x5ca8c1+':'+_0x1aeae7['id'],_0x1aeae7);UserNotificationEvents[_0x7da1('0x4')](_0x5ca8c1,_0x1aeae7);_0x45c20e(null);};}for(var e in events){if(events[_0x7da1('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x7da1('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xba20=['hasOwnProperty','../../mysqldb','UserNotification','setMaxListeners','save','update','emit'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xba20,0x1ba));var _0x0ba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba20[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x0ba2('0x0'))['db'][_0x0ba2('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0ba2('0x2')](0x0);var events={'afterCreate':_0x0ba2('0x3'),'afterUpdate':_0x0ba2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x485387){return function(_0x45a4e4,_0x168035,_0x400c0a){UserNotificationEvents[_0x0ba2('0x5')](_0x485387+':'+_0x45a4e4['id'],_0x45a4e4);UserNotificationEvents['emit'](_0x485387,_0x45a4e4);_0x400c0a(null);};}for(var e in events){if(events[_0x0ba2('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 75e6feb..5de318a 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 _0x7d4b=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports','define','UserNotification','userNotifications'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d4b,0x12d));var _0xb7d4=function(_0x45890f,_0x3cd244){_0x45890f=_0x45890f-0x0;var _0x563d75=_0x7d4b[_0x45890f];return _0x563d75;};'use strict';var _=require(_0xb7d4('0x0'));var util=require(_0xb7d4('0x1'));var logger=require('../../config/logger')(_0xb7d4('0x2'));var moment=require(_0xb7d4('0x3'));var BPromise=require('bluebird');var rp=require(_0xb7d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7d4('0x5'));var config=require(_0xb7d4('0x6'));var attributes=require('./userNotification.attributes');module[_0xb7d4('0x7')]=function(_0x54c387,_0x54d5b3){return _0x54c387[_0xb7d4('0x8')](_0xb7d4('0x9'),attributes,{'tableName':_0xb7d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7d4('0xb'),'collate':_0xb7d4('0xc')});}; \ No newline at end of file +var _0x5a03=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications'];(function(_0x5f4dd2,_0x2c8dfa){var _0x31ef2d=function(_0x70a057){while(--_0x70a057){_0x5f4dd2['push'](_0x5f4dd2['shift']());}};_0x31ef2d(++_0x2c8dfa);}(_0x5a03,0x160));var _0x35a0=function(_0x2c4a49,_0x130c01){_0x2c4a49=_0x2c4a49-0x0;var _0x483b6f=_0x5a03[_0x2c4a49];return _0x483b6f;};'use strict';var _=require(_0x35a0('0x0'));var util=require(_0x35a0('0x1'));var logger=require(_0x35a0('0x2'))('api');var moment=require(_0x35a0('0x3'));var BPromise=require(_0x35a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a0('0x5'));var rimraf=require(_0x35a0('0x6'));var config=require(_0x35a0('0x7'));var attributes=require(_0x35a0('0x8'));module[_0x35a0('0x9')]=function(_0x467160,_0x53032f){return _0x467160[_0x35a0('0xa')]('UserNotification',attributes,{'tableName':_0x35a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35a0('0xc'),'collate':_0x35a0('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c514626..f47fcba 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 _0x2cb4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','code','error','message','catch','util'];(function(_0x25f695,_0x397127){var _0x264a78=function(_0x13b976){while(--_0x13b976){_0x25f695['push'](_0x25f695['shift']());}};_0x264a78(++_0x397127);}(_0x2cb4,0xfb));var _0x42cb=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x2cb4[_0x879e31];return _0x3467e8;};'use strict';var _=require('lodash');var util=require(_0x42cb('0x0'));var moment=require(_0x42cb('0x1'));var BPromise=require(_0x42cb('0x2'));var rs=require(_0x42cb('0x3'));var fs=require('fs');var Redis=require(_0x42cb('0x4'));var db=require(_0x42cb('0x5'))['db'];var utils=require(_0x42cb('0x6'));var logger=require(_0x42cb('0x7'))(_0x42cb('0x8'));var config=require(_0x42cb('0x9'));var jayson=require(_0x42cb('0xa'));var client=jayson[_0x42cb('0xb')][_0x42cb('0xc')]({'port':0x232a});config[_0x42cb('0xd')]=_[_0x42cb('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x42cb('0xf'))(new Redis(config[_0x42cb('0xd')]));require(_0x42cb('0x10'))[_0x42cb('0x11')](socket);function respondWithRpcPromise(_0x3fc04f,_0x48b91c,_0x3809b2){return new BPromise(function(_0x140b48,_0x4cc450){return client['request'](_0x3fc04f,_0x3809b2)[_0x42cb('0x12')](function(_0x52b951){logger[_0x42cb('0x13')](_0x42cb('0x14'),_0x48b91c,_0x42cb('0x15'));logger[_0x42cb('0x16')](_0x42cb('0x17'),_0x48b91c,_0x42cb('0x15'),JSON['stringify'](_0x52b951));if(_0x52b951['error']){if(_0x52b951['error'][_0x42cb('0x18')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x48b91c,_0x52b951[_0x42cb('0x19')][_0x42cb('0x1a')]);return _0x4cc450(_0x52b951[_0x42cb('0x19')][_0x42cb('0x1a')]);}logger[_0x42cb('0x19')](_0x42cb('0x14'),_0x48b91c,_0x52b951[_0x42cb('0x19')][_0x42cb('0x1a')]);return _0x140b48(_0x52b951['error']['message']);}else{logger[_0x42cb('0x13')](_0x42cb('0x14'),_0x48b91c,_0x42cb('0x15'));_0x140b48(_0x52b951['result']['message']);}})[_0x42cb('0x1b')](function(_0x4ace7b){logger[_0x42cb('0x19')]('UserNotification,\x20%s,\x20%s',_0x48b91c,_0x4ace7b);_0x4cc450(_0x4ace7b);});});} \ No newline at end of file +var _0xed2d=['client','http','localhost','socket.io-emitter','redis','./userNotification.socket','register','then','info','request\x20sent','debug','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ac432,_0x34f760){var _0x50d1b2=function(_0x359514){while(--_0x359514){_0x2ac432['push'](_0x2ac432['shift']());}};_0x50d1b2(++_0x34f760);}(_0xed2d,0x1d2));var _0xded2=function(_0x402983,_0x5b1129){_0x402983=_0x402983-0x0;var _0x2dfa7e=_0xed2d[_0x402983];return _0x2dfa7e;};'use strict';var _=require('lodash');var util=require(_0xded2('0x0'));var moment=require(_0xded2('0x1'));var BPromise=require(_0xded2('0x2'));var rs=require(_0xded2('0x3'));var fs=require('fs');var Redis=require(_0xded2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xded2('0x5'));var logger=require(_0xded2('0x6'))(_0xded2('0x7'));var config=require(_0xded2('0x8'));var jayson=require(_0xded2('0x9'));var client=jayson[_0xded2('0xa')][_0xded2('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xded2('0xc'),'port':0x18eb});var socket=require(_0xded2('0xd'))(new Redis(config[_0xded2('0xe')]));require(_0xded2('0xf'))[_0xded2('0x10')](socket);function respondWithRpcPromise(_0x2329fd,_0x4971c3,_0x428000){return new BPromise(function(_0x2eae31,_0x3dab60){return client['request'](_0x2329fd,_0x428000)[_0xded2('0x11')](function(_0x10fed0){logger[_0xded2('0x12')]('UserNotification,\x20%s,\x20%s',_0x4971c3,_0xded2('0x13'));logger[_0xded2('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x4971c3,_0xded2('0x13'),JSON[_0xded2('0x15')](_0x10fed0));if(_0x10fed0[_0xded2('0x16')]){if(_0x10fed0[_0xded2('0x16')][_0xded2('0x17')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x4971c3,_0x10fed0[_0xded2('0x16')][_0xded2('0x18')]);return _0x3dab60(_0x10fed0['error'][_0xded2('0x18')]);}logger[_0xded2('0x16')]('UserNotification,\x20%s,\x20%s',_0x4971c3,_0x10fed0[_0xded2('0x16')]['message']);return _0x2eae31(_0x10fed0[_0xded2('0x16')][_0xded2('0x18')]);}else{logger['info'](_0xded2('0x19'),_0x4971c3,_0xded2('0x13'));_0x2eae31(_0x10fed0[_0xded2('0x1a')]['message']);}})[_0xded2('0x1b')](function(_0xf6273c){logger[_0xded2('0x16')](_0xded2('0x19'),_0x4971c3,_0xf6273c);_0x3dab60(_0xf6273c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index d9c695d..db06776 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 _0x0ab3=['remove','update','removeListener','length','userNotification:','./userNotification.events'];(function(_0xc2d811,_0x3e871e){var _0x3de7fa=function(_0x17bad9){while(--_0x17bad9){_0xc2d811['push'](_0xc2d811['shift']());}};_0x3de7fa(++_0x3e871e);}(_0x0ab3,0x1af));var _0x30ab=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0ab3[_0x167cc1];return _0x10bc4b;};'use strict';var UserNotificationEvents=require(_0x30ab('0x0'));var events=['save',_0x30ab('0x1'),_0x30ab('0x2')];function createListener(_0x31d9a4,_0x5d7d80){return function(_0x11163e){_0x5d7d80['emit'](_0x31d9a4,_0x11163e);};}function removeListener(_0x380740,_0x237802){return function(){UserNotificationEvents[_0x30ab('0x3')](_0x380740,_0x237802);};}exports['register']=function(_0x379b53){for(var _0x310838=0x0,_0x2ff1b7=events[_0x30ab('0x4')];_0x310838<_0x2ff1b7;_0x310838++){var _0x4cf9f9=events[_0x310838];var _0x59fefa=createListener(_0x30ab('0x5')+_0x4cf9f9,_0x379b53);UserNotificationEvents['on'](_0x4cf9f9,_0x59fefa);}}; \ No newline at end of file +var _0x55d3=['update','emit','register','length','userNotification:','save','remove'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x55d3,0x1a2));var _0x355d=function(_0x16038b,_0x3e7c40){_0x16038b=_0x16038b-0x0;var _0x1e2896=_0x55d3[_0x16038b];return _0x1e2896;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x355d('0x0'),_0x355d('0x1'),_0x355d('0x2')];function createListener(_0x12e30e,_0x1ccb71){return function(_0x2f7a1c){_0x1ccb71[_0x355d('0x3')](_0x12e30e,_0x2f7a1c);};}function removeListener(_0x1e74e0,_0x443df7){return function(){UserNotificationEvents['removeListener'](_0x1e74e0,_0x443df7);};}exports[_0x355d('0x4')]=function(_0x3c3a32){for(var _0x4ef588=0x0,_0xbd9b80=events[_0x355d('0x5')];_0x4ef588<_0xbd9b80;_0x4ef588++){var _0x290946=events[_0x4ef588];var _0x52143f=createListener(_0x355d('0x6')+_0x290946,_0x3c3a32);UserNotificationEvents['on'](_0x290946,_0x52143f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 5596d83..bd3485a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x16030e,_0x155a9a){var _0x5874f6=function(_0x3d0127){while(--_0x3d0127){_0x16030e['push'](_0x16030e['shift']());}};_0x5874f6(++_0x155a9a);}(_0x70e0,0x17b));var _0x070e=function(_0x443867,_0x20e03c){_0x443867=_0x443867-0x0;var _0x5d081e=_0x70e0[_0x443867];return _0x5d081e;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x292037,_0x3fbd07){var _0x4e3bff=function(_0x43e77e){while(--_0x43e77e){_0x292037['push'](_0x292037['shift']());}};_0x4e3bff(++_0x3fbd07);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 56e0eb8..3628280 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 _0xc0ec=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0ec,0x85));var _0xcc0e=function(_0x7bfa48,_0x2e57b6){_0x7bfa48=_0x7bfa48-0x0;var _0x155d53=_0xc0ec[_0x7bfa48];return _0x155d53;};'use strict';var Sequelize=require(_0xcc0e('0x0'));module[_0xcc0e('0x1')]={'penalty':{'type':Sequelize[_0xcc0e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4453=['sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4453,0x9c));var _0x3445=function(_0xd985de,_0x1a704a){_0xd985de=_0xd985de-0x0;var _0x1d9e79=_0x4453[_0xd985de];return _0x1d9e79;};'use strict';var Sequelize=require(_0x3445('0x0'));module[_0x3445('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 65f2108..cd6b26a 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 _0xc244=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','moment','request-promise','path'];(function(_0x3e24ac,_0x134afd){var _0x1b54d1=function(_0x13afae){while(--_0x13afae){_0x3e24ac['push'](_0x3e24ac['shift']());}};_0x1b54d1(++_0x134afd);}(_0xc244,0x127));var _0x4c24=function(_0x354bea,_0x4e6ba1){_0x354bea=_0x354bea-0x0;var _0x264010=_0xc244[_0x354bea];return _0x264010;};'use strict';var _=require('lodash');var util=require(_0x4c24('0x0'));var logger=require(_0x4c24('0x1'))('api');var moment=require(_0x4c24('0x2'));var BPromise=require('bluebird');var rp=require(_0x4c24('0x3'));var fs=require('fs');var path=require(_0x4c24('0x4'));var rimraf=require(_0x4c24('0x5'));var config=require(_0x4c24('0x6'));var attributes=require(_0x4c24('0x7'));module[_0x4c24('0x8')]=function(_0x26a7a0,_0x774dbd){return _0x26a7a0[_0x4c24('0x9')](_0x4c24('0xa'),attributes,{'tableName':_0x4c24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x829e=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x43c8b8,_0x5e8934){var _0x413be3=function(_0x23969c){while(--_0x23969c){_0x43c8b8['push'](_0x43c8b8['shift']());}};_0x413be3(++_0x5e8934);}(_0x829e,0xf2));var _0xe829=function(_0x34d64f,_0x318aea){_0x34d64f=_0x34d64f-0x0;var _0x2684ad=_0x829e[_0x34d64f];return _0x2684ad;};'use strict';var _=require(_0xe829('0x0'));var util=require(_0xe829('0x1'));var logger=require(_0xe829('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe829('0x3'));var rp=require(_0xe829('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe829('0x5'));var config=require(_0xe829('0x6'));var attributes=require(_0xe829('0x7'));module[_0xe829('0x8')]=function(_0x4fb336,_0x544ee0){return _0x4fb336[_0xe829('0x9')](_0xe829('0xa'),attributes,{'tableName':_0xe829('0xb'),'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 064f045..9c499db 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 _0xfcfa=['info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x234775,_0x532eff){var _0x5d830c=function(_0x426682){while(--_0x426682){_0x234775['push'](_0x234775['shift']());}};_0x5d830c(++_0x532eff);}(_0xfcfa,0x10c));var _0xafcf=function(_0x520454,_0x53c33c){_0x520454=_0x520454-0x0;var _0x335f01=_0xfcfa[_0x520454];return _0x335f01;};'use strict';var _=require(_0xafcf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xafcf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafcf('0x2'))['db'];var utils=require(_0xafcf('0x3'));var logger=require(_0xafcf('0x4'))(_0xafcf('0x5'));var config=require(_0xafcf('0x6'));var jayson=require(_0xafcf('0x7'));var client=jayson[_0xafcf('0x8')][_0xafcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb29d,_0x1b1b9c,_0x3440ff){return new BPromise(function(_0x540896,_0x342782){return client[_0xafcf('0xa')](_0x5eb29d,_0x3440ff)[_0xafcf('0xb')](function(_0x33b722){logger[_0xafcf('0xc')](_0xafcf('0xd'),_0x1b1b9c,'request\x20sent');logger[_0xafcf('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1b1b9c,_0xafcf('0xf'),JSON['stringify'](_0x33b722));if(_0x33b722[_0xafcf('0x10')]){if(_0x33b722[_0xafcf('0x10')]['code']===0x1f4){logger['error'](_0xafcf('0xd'),_0x1b1b9c,_0x33b722[_0xafcf('0x10')][_0xafcf('0x11')]);return _0x342782(_0x33b722[_0xafcf('0x10')][_0xafcf('0x11')]);}logger['error'](_0xafcf('0xd'),_0x1b1b9c,_0x33b722[_0xafcf('0x10')][_0xafcf('0x11')]);return _0x540896(_0x33b722['error'][_0xafcf('0x11')]);}else{logger[_0xafcf('0xc')](_0xafcf('0xd'),_0x1b1b9c,_0xafcf('0xf'));_0x540896(_0x33b722[_0xafcf('0x12')][_0xafcf('0x11')]);}})[_0xafcf('0x13')](function(_0x574387){logger[_0xafcf('0x10')](_0xafcf('0xd'),_0x1b1b9c,_0x574387);_0x342782(_0x574387);});});} \ No newline at end of file +var _0x5633=['rpc','../../config/environment','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x5633,0x105));var _0x3563=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5633[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x3563('0x0'));var util=require(_0x3563('0x1'));var moment=require('moment');var BPromise=require(_0x3563('0x2'));var rs=require(_0x3563('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3563('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3563('0x5'));var config=require(_0x3563('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3563('0x7')][_0x3563('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x254aa5,_0x39d87e,_0x407b03){return new BPromise(function(_0x4d8044,_0x533e05){return client['request'](_0x254aa5,_0x407b03)['then'](function(_0x378fcf){logger['info'](_0x3563('0x9'),_0x39d87e,_0x3563('0xa'));logger[_0x3563('0xb')](_0x3563('0xc'),_0x39d87e,_0x3563('0xa'),JSON['stringify'](_0x378fcf));if(_0x378fcf[_0x3563('0xd')]){if(_0x378fcf[_0x3563('0xd')][_0x3563('0xe')]===0x1f4){logger[_0x3563('0xd')](_0x3563('0x9'),_0x39d87e,_0x378fcf[_0x3563('0xd')][_0x3563('0xf')]);return _0x533e05(_0x378fcf[_0x3563('0xd')][_0x3563('0xf')]);}logger[_0x3563('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x39d87e,_0x378fcf[_0x3563('0xd')][_0x3563('0xf')]);return _0x4d8044(_0x378fcf['error']['message']);}else{logger[_0x3563('0x10')](_0x3563('0x9'),_0x39d87e,'request\x20sent');_0x4d8044(_0x378fcf[_0x3563('0x11')]['message']);}})[_0x3563('0x12')](function(_0x4bf2f8){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x39d87e,_0x4bf2f8);_0x533e05(_0x4bf2f8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ef0c6e5..c42a604 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 _0x9652=['/:id/clone','addSections','addResources','put','delete','destroy','removeResources','exports','multer','path','express','Router','../../config/environment','./userProfile.controller','index','get','isAuthenticated','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9652,0x198));var _0x2965=function(_0x16d578,_0x3cbca3){_0x16d578=_0x16d578-0x0;var _0x3c0177=_0x9652[_0x16d578];return _0x3c0177;};'use strict';var multer=require(_0x2965('0x0'));var util=require('util');var path=require(_0x2965('0x1'));var timeout=require('connect-timeout');var express=require(_0x2965('0x2'));var router=express[_0x2965('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2965('0x4'));var controller=require(_0x2965('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x2965('0x6')]);router[_0x2965('0x7')]('/describe',auth[_0x2965('0x8')](),controller[_0x2965('0x9')]);router[_0x2965('0x7')](_0x2965('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2965('0x7')](_0x2965('0xb'),auth[_0x2965('0x8')](),controller[_0x2965('0xc')]);router[_0x2965('0x7')](_0x2965('0xd'),auth[_0x2965('0x8')](),controller[_0x2965('0xe')]);router[_0x2965('0xf')]('/',auth[_0x2965('0x8')](),controller[_0x2965('0x10')]);router[_0x2965('0xf')](_0x2965('0x11'),auth[_0x2965('0x8')](),controller['clone']);router['post'](_0x2965('0xb'),auth[_0x2965('0x8')](),controller[_0x2965('0x12')]);router[_0x2965('0xf')](_0x2965('0xd'),auth[_0x2965('0x8')](),controller[_0x2965('0x13')]);router[_0x2965('0x14')]('/:id',auth[_0x2965('0x8')](),controller['update']);router[_0x2965('0x15')](_0x2965('0xa'),auth['isAuthenticated'](),controller[_0x2965('0x16')]);router['delete'](_0x2965('0xb'),auth[_0x2965('0x8')](),controller['removeSections']);router[_0x2965('0x15')]('/:id/resources',auth[_0x2965('0x8')](),controller[_0x2965('0x17')]);module[_0x2965('0x18')]=router; \ No newline at end of file +var _0x0c0f=['addSections','/:id/resources','addResources','put','update','delete','destroy','removeSections','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','post','create','/:id/clone','clone'];(function(_0x36e928,_0x5f3cf5){var _0x192a89=function(_0x1cfeb5){while(--_0x1cfeb5){_0x36e928['push'](_0x36e928['shift']());}};_0x192a89(++_0x5f3cf5);}(_0x0c0f,0xd4));var _0xf0c0=function(_0x546d22,_0x244340){_0x546d22=_0x546d22-0x0;var _0x301966=_0x0c0f[_0x546d22];return _0x301966;};'use strict';var multer=require('multer');var util=require(_0xf0c0('0x0'));var path=require(_0xf0c0('0x1'));var timeout=require(_0xf0c0('0x2'));var express=require(_0xf0c0('0x3'));var router=express['Router']();var fs_extra=require(_0xf0c0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf0c0('0x5'));var config=require(_0xf0c0('0x6'));var controller=require(_0xf0c0('0x7'));router[_0xf0c0('0x8')]('/',auth[_0xf0c0('0x9')](),controller[_0xf0c0('0xa')]);router[_0xf0c0('0x8')]('/describe',auth[_0xf0c0('0x9')](),controller[_0xf0c0('0xb')]);router['get'](_0xf0c0('0xc'),auth[_0xf0c0('0x9')](),controller[_0xf0c0('0xd')]);router[_0xf0c0('0x8')](_0xf0c0('0xe'),auth['isAuthenticated'](),controller[_0xf0c0('0xf')]);router[_0xf0c0('0x8')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router[_0xf0c0('0x10')]('/',auth[_0xf0c0('0x9')](),controller[_0xf0c0('0x11')]);router['post'](_0xf0c0('0x12'),auth[_0xf0c0('0x9')](),controller[_0xf0c0('0x13')]);router[_0xf0c0('0x10')](_0xf0c0('0xe'),auth['isAuthenticated'](),controller[_0xf0c0('0x14')]);router['post'](_0xf0c0('0x15'),auth['isAuthenticated'](),controller[_0xf0c0('0x16')]);router[_0xf0c0('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xf0c0('0x18')]);router[_0xf0c0('0x19')](_0xf0c0('0xc'),auth['isAuthenticated'](),controller[_0xf0c0('0x1a')]);router[_0xf0c0('0x19')](_0xf0c0('0xe'),auth[_0xf0c0('0x9')](),controller[_0xf0c0('0x1b')]);router[_0xf0c0('0x19')](_0xf0c0('0x15'),auth[_0xf0c0('0x9')](),controller['removeResources']);module[_0xf0c0('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 6c10941..9fb6126 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 _0x6b22=['getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING','setDataValue','join'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x6b22,0x1b4));var _0x26b2=function(_0x766a52,_0x50ffb2){_0x766a52=_0x766a52-0x0;var _0x5b6e24=_0x6b22[_0x766a52];return _0x5b6e24;};'use strict';var Sequelize=require(_0x26b2('0x0'));module[_0x26b2('0x1')]={'name':{'type':Sequelize[_0x26b2('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x26b2('0x2')],'set':function(_0xba944b){this[_0x26b2('0x3')]('crudPermissions',_0xba944b?_0xba944b[_0x26b2('0x4')](''):[]);},'get':function(){return this[_0x26b2('0x5')]('crudPermissions')?this['getDataValue'](_0x26b2('0x6'))[_0x26b2('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x26b2('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x26b2('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x26b2('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x26b2('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x867d=['setDataValue','join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x867d,0xdd));var _0xd867=function(_0x4beeb5,_0x3963d8){_0x4beeb5=_0x4beeb5-0x0;var _0x570e68=_0x867d[_0x4beeb5];return _0x570e68;};'use strict';var Sequelize=require(_0xd867('0x0'));module[_0xd867('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd867('0x2')},'crudPermissions':{'type':Sequelize[_0xd867('0x3')],'set':function(_0x48f29f){this[_0xd867('0x4')]('crudPermissions',_0x48f29f?_0x48f29f[_0xd867('0x5')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xd867('0x6')]('crudPermissions')[_0xd867('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd867('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd867('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd867('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd867('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xd867('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index caec076..18a4dc8 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 _0x8796=['catch','length','createdAt','updatedAt','crudPermissions','body','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','omit','userProfileId','Resources','update','destroy','describe','addSections','sequelize','each','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x8796,0x18d));var _0x6879=function(_0x50b507,_0x48dc14){_0x50b507=_0x50b507-0x0;var _0x167ca=_0x8796[_0x50b507];return _0x167ca;};'use strict';var emlformat=require(_0x6879('0x0'));var rimraf=require(_0x6879('0x1'));var zipdir=require(_0x6879('0x2'));var jsonpatch=require(_0x6879('0x3'));var rp=require(_0x6879('0x4'));var moment=require(_0x6879('0x5'));var BPromise=require(_0x6879('0x6'));var Mustache=require(_0x6879('0x7'));var util=require(_0x6879('0x8'));var path=require('path');var sox=require(_0x6879('0x9'));var csv=require(_0x6879('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6879('0xb'));var _=require('lodash');var squel=require(_0x6879('0xc'));var crypto=require(_0x6879('0xd'));var jsforce=require(_0x6879('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6879('0xa'));var querystring=require(_0x6879('0xf'));var Papa=require(_0x6879('0x10'));var Redis=require(_0x6879('0x11'));var authService=require(_0x6879('0x12'));var qs=require(_0x6879('0x13'));var as=require(_0x6879('0x14'));var hardwareService=require(_0x6879('0x15'));var logger=require(_0x6879('0x16'))(_0x6879('0x17'));var utils=require(_0x6879('0x18'));var config=require(_0x6879('0x19'));var licenseUtil=require(_0x6879('0x1a'));var db=require(_0x6879('0x1b'))['db'];config[_0x6879('0x1c')]=_[_0x6879('0x1d')](config[_0x6879('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x6879('0x1e'))(new Redis(config[_0x6879('0x1c')]));require(_0x6879('0x1f'))[_0x6879('0x20')](socket);function respondWithStatusCode(_0x5e198b,_0x45a97f){_0x45a97f=_0x45a97f||0xcc;return function(_0x59c300){if(_0x59c300){return _0x5e198b[_0x6879('0x21')](_0x45a97f);}return _0x5e198b[_0x6879('0x22')](_0x45a97f)[_0x6879('0x23')]();};}function respondWithResult(_0xcd14fa,_0x3ef29){_0x3ef29=_0x3ef29||0xc8;return function(_0x3a9f8f){if(_0x3a9f8f){return _0xcd14fa[_0x6879('0x22')](_0x3ef29)[_0x6879('0x24')](_0x3a9f8f);}};}function respondWithFilteredResult(_0x261932,_0x3099df){return function(_0x555943){if(_0x555943){var _0x5f5d57=typeof _0x3099df[_0x6879('0x25')]==='undefined'&&typeof _0x3099df[_0x6879('0x26')]===_0x6879('0x27');var _0x14d791=_0x555943[_0x6879('0x28')];var _0x203bba=_0x5f5d57?0x0:_0x3099df[_0x6879('0x25')];var _0x314aba=_0x5f5d57?_0x555943[_0x6879('0x28')]:_0x3099df[_0x6879('0x25')]+_0x3099df[_0x6879('0x26')];var _0x2f0416;if(_0x314aba>=_0x14d791){_0x314aba=_0x14d791;_0x2f0416=0xc8;}else{_0x2f0416=0xce;}_0x261932[_0x6879('0x22')](_0x2f0416);return _0x261932['set']('Content-Range',_0x203bba+'-'+_0x314aba+'/'+_0x14d791)['json'](_0x555943);}return null;};}function patchUpdates(_0x2628e0){return function(_0x3ae2a8){try{jsonpatch[_0x6879('0x29')](_0x3ae2a8,_0x2628e0,!![]);}catch(_0x342a7d){return BPromise[_0x6879('0x2a')](_0x342a7d);}return _0x3ae2a8[_0x6879('0x2b')]();};}function saveUpdates(_0xecb01a,_0xffe378){return function(_0x526d48){if(_0x526d48){return _0x526d48['update'](_0xecb01a)[_0x6879('0x2c')](function(_0x58aab7){return _0x58aab7;});}return null;};}function removeEntity(_0x4853e5,_0x23ce86){return function(_0x40f029){if(_0x40f029){return _0x40f029['destroy']()[_0x6879('0x2c')](function(){_0x4853e5[_0x6879('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ed156,_0x3b253d){return function(_0x42c2fb){if(!_0x42c2fb){_0x1ed156[_0x6879('0x21')](0x194);}return _0x42c2fb;};}function handleError(_0x412249,_0x53ac3c){_0x53ac3c=_0x53ac3c||0x1f4;return function(_0x370bf4){logger[_0x6879('0x2d')](_0x370bf4[_0x6879('0x2e')]);if(_0x370bf4[_0x6879('0x2f')]){delete _0x370bf4[_0x6879('0x2f')];}_0x412249[_0x6879('0x22')](_0x53ac3c)[_0x6879('0x30')](_0x370bf4);};}exports[_0x6879('0x31')]=function(_0x26fd07,_0x59e9bb){var _0x13e117={},_0x5ba5a6={},_0x3370a5={'count':0x0,'rows':[]};var _0x3c8092=_['map'](db[_0x6879('0x32')][_0x6879('0x33')],function(_0x5ed4f7){return{'name':_0x5ed4f7[_0x6879('0x34')],'type':_0x5ed4f7[_0x6879('0x35')][_0x6879('0x36')]};});_0x5ba5a6[_0x6879('0x37')]=_[_0x6879('0x38')](_0x3c8092,'name');_0x5ba5a6['query']=_[_0x6879('0x39')](_0x26fd07[_0x6879('0x3a')]);_0x5ba5a6[_0x6879('0x3b')]=_[_0x6879('0x3c')](_0x5ba5a6[_0x6879('0x37')],_0x5ba5a6['query']);_0x13e117[_0x6879('0x3d')]=_[_0x6879('0x3c')](_0x5ba5a6[_0x6879('0x37')],qs['fields'](_0x26fd07['query'][_0x6879('0x3e')]));_0x13e117[_0x6879('0x3d')]=_0x13e117['attributes']['length']?_0x13e117[_0x6879('0x3d')]:_0x5ba5a6[_0x6879('0x37')];if(!_0x26fd07[_0x6879('0x3a')][_0x6879('0x3f')]('nolimit')){_0x13e117[_0x6879('0x26')]=qs['limit'](_0x26fd07[_0x6879('0x3a')][_0x6879('0x26')]);_0x13e117['offset']=qs[_0x6879('0x25')](_0x26fd07['query'][_0x6879('0x25')]);}_0x13e117['order']=qs[_0x6879('0x40')](_0x26fd07[_0x6879('0x3a')][_0x6879('0x40')]);_0x13e117['where']=qs['filters'](_[_0x6879('0x41')](_0x26fd07['query'],_0x5ba5a6[_0x6879('0x3b')]),_0x3c8092);if(_0x26fd07[_0x6879('0x3a')][_0x6879('0x42')]){_0x13e117['where']=_[_0x6879('0x43')](_0x13e117[_0x6879('0x44')],{'$or':_['map'](_0x3c8092,function(_0x5e3700){if(_0x5e3700[_0x6879('0x35')]!==_0x6879('0x45')){var _0x13c7d9={};_0x13c7d9[_0x5e3700[_0x6879('0x2f')]]={'$like':'%'+_0x26fd07[_0x6879('0x3a')][_0x6879('0x42')]+'%'};return _0x13c7d9;}})});}_0x13e117=_[_0x6879('0x43')]({},_0x13e117,_0x26fd07['options']);var _0x3fdd07={'where':_0x13e117[_0x6879('0x44')]};return db[_0x6879('0x32')]['count'](_0x3fdd07)['then'](function(_0x22e43d){_0x3370a5[_0x6879('0x28')]=_0x22e43d;if(_0x26fd07[_0x6879('0x3a')][_0x6879('0x46')]){_0x13e117[_0x6879('0x47')]=[{'all':!![]}];}return db[_0x6879('0x32')][_0x6879('0x48')](_0x13e117);})[_0x6879('0x2c')](function(_0x1e9c8c){_0x3370a5[_0x6879('0x49')]=_0x1e9c8c;return _0x3370a5;})[_0x6879('0x2c')](respondWithFilteredResult(_0x59e9bb,_0x13e117))['catch'](handleError(_0x59e9bb,null));};exports[_0x6879('0x4a')]=function(_0x277aac,_0x2811b8){var _0x99743d={'raw':![],'where':{'id':_0x277aac[_0x6879('0x4b')]['id']}},_0x78de41={};_0x78de41[_0x6879('0x37')]=_[_0x6879('0x39')](db[_0x6879('0x32')][_0x6879('0x33')]);_0x78de41[_0x6879('0x3a')]=_['keys'](_0x277aac['query']);_0x78de41[_0x6879('0x3b')]=_['intersection'](_0x78de41['model'],_0x78de41['query']);_0x99743d[_0x6879('0x3d')]=_[_0x6879('0x3c')](_0x78de41[_0x6879('0x37')],qs[_0x6879('0x3e')](_0x277aac[_0x6879('0x3a')][_0x6879('0x3e')]));_0x99743d[_0x6879('0x3d')]=_0x99743d[_0x6879('0x3d')]['length']?_0x99743d[_0x6879('0x3d')]:_0x78de41[_0x6879('0x37')];if(_0x277aac[_0x6879('0x3a')][_0x6879('0x46')]){_0x99743d[_0x6879('0x47')]=[{'all':!![]}];}_0x99743d=_[_0x6879('0x43')]({},_0x99743d,_0x277aac[_0x6879('0x4c')]);return db[_0x6879('0x32')][_0x6879('0x4d')](_0x99743d)[_0x6879('0x2c')](handleEntityNotFound(_0x2811b8,null))[_0x6879('0x2c')](respondWithResult(_0x2811b8,null))['catch'](handleError(_0x2811b8,null));};exports[_0x6879('0x4e')]=function(_0x20bae1,_0x42bed8){return db['UserProfile'][_0x6879('0x4e')](_0x20bae1['body'],{})[_0x6879('0x2c')](respondWithResult(_0x42bed8,0xc9))[_0x6879('0x4f')](handleError(_0x42bed8,null));};exports['clone']=function(_0x30c0b,_0x128bf1){var _0x58ef73={'where':{'id':_0x30c0b['params']['id']}},_0x192920={};_0x192920[_0x6879('0x37')]=_['keys'](db[_0x6879('0x32')][_0x6879('0x33')]);_0x58ef73[_0x6879('0x3d')]=_[_0x6879('0x3c')](_0x192920[_0x6879('0x37')],qs['fields'](_0x30c0b[_0x6879('0x3a')][_0x6879('0x3e')]));_0x58ef73[_0x6879('0x3d')]=_0x58ef73[_0x6879('0x3d')][_0x6879('0x50')]?_0x58ef73[_0x6879('0x3d')]:_0x192920[_0x6879('0x37')];if(_0x30c0b[_0x6879('0x3a')][_0x6879('0x46')]){_0x58ef73['include']=[{'all':!![]}];}_0x58ef73=_[_0x6879('0x43')]({},_0x58ef73,_0x30c0b[_0x6879('0x4c')]);return db[_0x6879('0x32')][_0x6879('0x4d')](_0x58ef73)[_0x6879('0x2c')](handleEntityNotFound(_0x128bf1,null))['then'](function(_0x4642b1){if(_0x4642b1){var _0x4c2100=_0x4642b1['get']({'plain':!![]});_0x4c2100=qs['omit'](_0x4c2100,['id',_0x6879('0x51'),_0x6879('0x52'),_0x6879('0x53')]);_0x30c0b[_0x6879('0x54')]=_['omit'](_0x30c0b[_0x6879('0x54')],['id','createdAt',_0x6879('0x52')]);return db['sequelize'][_0x6879('0x55')](function(_0x15adb0){return db[_0x6879('0x32')][_0x6879('0x4e')](_[_0x6879('0x43')](_0x4c2100,_0x30c0b[_0x6879('0x54')]),{'include':_0x30c0b[_0x6879('0x3a')][_0x6879('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x15adb0})[_0x6879('0x2c')](function(_0x32ba48){var _0xa32e80=_0x32ba48[_0x6879('0x56')]({'plain':!![]});return db[_0x6879('0x57')][_0x6879('0x48')]({'where':{'userProfileId':_0x30c0b[_0x6879('0x4b')]['id']},'raw':!![]})['then'](function(_0x158136){if(_0x158136){return BPromise['each'](_0x158136,function(_0x4bad4a){return new BPromise(function(_0x4f1399,_0x31f67c){if(_0x4bad4a['autoAssociation']===null||_0x4bad4a[_0x6879('0x58')]===0x1)_0x4f1399(null);return db[_0x6879('0x59')][_0x6879('0x48')]({'where':{'sectionId':_0x4bad4a['id']},'raw':!![]})[_0x6879('0x2c')](function(_0x8b159e){var _0xabe638=_[_0x6879('0x38')](_0x8b159e,function(_0x31693f){return qs['omit'](_0x31693f,['id',_0x6879('0x51'),'updatedAt',_0x6879('0x5a')]);});_0x4f1399(_0xabe638);})[_0x6879('0x4f')](function(_0x30b600){_0x31f67c(_0x30b600);});})[_0x6879('0x2c')](function(_0x1b4f97){var _0x42c400=qs[_0x6879('0x5b')](_0x4bad4a,['id','createdAt',_0x6879('0x52')]);_0x42c400[_0x6879('0x5c')]=_0xa32e80['id'];if(_0x1b4f97)_0x42c400[_0x6879('0x5d')]=_0x1b4f97;return _0x42c400;})[_0x6879('0x2c')](function(_0x1ef766){return db[_0x6879('0x57')][_0x6879('0x4e')](_0x1ef766,{'include':[{'model':db['UserProfileResource'],'as':_0x6879('0x5d')}],'raw':!![],'transaction':_0x15adb0});});})[_0x6879('0x2c')](function(){return _0xa32e80;});}});});});}})[_0x6879('0x2c')](respondWithResult(_0x128bf1,0xc9))[_0x6879('0x4f')](handleError(_0x128bf1,null));};exports[_0x6879('0x5e')]=function(_0x34963c,_0x54a0c4){if(_0x34963c[_0x6879('0x54')]['id']){delete _0x34963c[_0x6879('0x54')]['id'];}return db['UserProfile'][_0x6879('0x4d')]({'where':{'id':_0x34963c[_0x6879('0x4b')]['id']}})[_0x6879('0x2c')](handleEntityNotFound(_0x54a0c4,null))[_0x6879('0x2c')](saveUpdates(_0x34963c[_0x6879('0x54')],null))[_0x6879('0x2c')](respondWithResult(_0x54a0c4,null))[_0x6879('0x4f')](handleError(_0x54a0c4,null));};exports[_0x6879('0x5f')]=function(_0xa0cf0f,_0x266afb){return db['UserProfile'][_0x6879('0x4d')]({'where':{'id':_0xa0cf0f[_0x6879('0x4b')]['id']}})[_0x6879('0x2c')](handleEntityNotFound(_0x266afb,null))['then'](removeEntity(_0x266afb,null))[_0x6879('0x4f')](handleError(_0x266afb,null));};exports['describe']=function(_0x213f32,_0x38ad91){return db[_0x6879('0x32')][_0x6879('0x60')]()[_0x6879('0x2c')](respondWithResult(_0x38ad91,null))[_0x6879('0x4f')](handleError(_0x38ad91,null));};exports[_0x6879('0x61')]=function(_0x2685bc,_0x70c04e){var _0x14ed77=_0x2685bc[_0x6879('0x54')];return db[_0x6879('0x32')][_0x6879('0x4d')]({'where':{'id':_0x2685bc[_0x6879('0x4b')]['id']}})[_0x6879('0x2c')](handleEntityNotFound(_0x70c04e,null))[_0x6879('0x2c')](function(_0xe095b){if(_0xe095b){return db[_0x6879('0x62')]['transaction'](function(_0x58c31e){return db['UserProfileSection'][_0x6879('0x5f')]({'where':{'userProfileId':_0x2685bc['params']['id'],'sectionId':_[_0x6879('0x38')](_0x14ed77,function(_0xd75c48){return _0xd75c48[_0x6879('0x5a')];})},'transaction':_0x58c31e})[_0x6879('0x2c')](function(){var _0x4b2ca0=_[_0x6879('0x38')](_0x14ed77,function(_0x13b6c7){_0x13b6c7[_0x6879('0x5c')]=_0x2685bc['params']['id'];return _0x13b6c7;});var _0x5751ff=[];return BPromise[_0x6879('0x63')](_0x4b2ca0,function(_0x33b185){return db[_0x6879('0x57')][_0x6879('0x4e')](_0x33b185,{'include':[{'model':db['UserProfileResource'],'as':_0x6879('0x5d')}],'raw':!![],'transaction':_0x58c31e})[_0x6879('0x2c')](function(_0xb36c1e){_0x5751ff[_0x6879('0x64')](_0xb36c1e['get']({'plain':!![]}));});})[_0x6879('0x2c')](function(){return _0x5751ff;});});});}})[_0x6879('0x2c')](function(_0x2bc65e){return _0x2bc65e;})[_0x6879('0x2c')](respondWithResult(_0x70c04e,null))[_0x6879('0x4f')](handleError(_0x70c04e,null));};exports[_0x6879('0x65')]=function(_0x4e1f86,_0x4212af){var _0x2051f8;return db[_0x6879('0x32')]['find']({'where':{'id':_0x4e1f86[_0x6879('0x4b')]['id']},'attributes':['id',_0x6879('0x2f')]})['then'](handleEntityNotFound(_0x4212af,null))[_0x6879('0x2c')](function(_0x5203e0){if(_0x5203e0){_0x2051f8=_0x5203e0;return db[_0x6879('0x57')][_0x6879('0x5f')]({'where':{'userProfileId':_0x4e1f86[_0x6879('0x4b')]['id'],'sectionId':_0x4e1f86[_0x6879('0x3a')]['ids']}});}})[_0x6879('0x2c')](function(){return _0x2051f8;})[_0x6879('0x2c')](respondWithStatusCode(_0x4212af,null))[_0x6879('0x4f')](handleError(_0x4212af,null));};exports[_0x6879('0x66')]=function(_0x6207cb,_0x51cb5d){var _0x1bf3df=[];var _0xf20c18=[];return db[_0x6879('0x57')][_0x6879('0x48')]({'where':{'userProfileId':_0x6207cb[_0x6879('0x4b')]['id']},'raw':!![]})['then'](function(_0xbbefb7){_0x1bf3df=_[_0x6879('0x42')](_0xbbefb7,function(_0x4cf86f){return _0x4cf86f[_0x6879('0x67')]===0x1||_[_0x6879('0x68')]([0x3eb,0x709],_0x4cf86f[_0x6879('0x5a')]);});if(!_[_0x6879('0x69')](_0x1bf3df)){return _[_0x6879('0x38')](_0x1bf3df,function(_0x3221ba){return _0x3221ba[_0x6879('0x5a')];});}else{return;}})[_0x6879('0x2c')](function(_0x47db10){if(_0x47db10)_0xf20c18=_0x47db10;if(_[_0x6879('0x68')](_0xf20c18,0x64)){var _0xf38512=_[_0x6879('0x4d')](_0x1bf3df,{'sectionId':0x64});return hasDefaultDashboard(_0xf38512)[_0x6879('0x2c')](function(_0x12fb52){return _['map'](_0x1bf3df,function(_0x26be5e){if(_0x26be5e[_0x6879('0x5a')]===0x64){_0x26be5e[_0x6879('0x6a')]=_0x12fb52;}return _0x26be5e;});});}else{return;}})[_0x6879('0x2c')](function(_0x4407dc){if(_0x4407dc)_0x1bf3df=_0x4407dc;if(_[_0x6879('0x68')](_0xf20c18,0x3eb)){var _0x53562e=_[_0x6879('0x4d')](_0x1bf3df,{'sectionId':0x3eb});return getCustomDashboards(_0x53562e)[_0x6879('0x2c')](function(_0x1b4649){return _[_0x6879('0x38')](_0x1bf3df,function(_0x2d2530){if(_0x53562e[_0x6879('0x67')]){if(_0x2d2530[_0x6879('0x5a')]===0x3eb){_0x2d2530[_0x6879('0x6a')]=_0x1b4649;}}else{if(_0x2d2530[_0x6879('0x5a')]===0x64){if(!_0x2d2530['subsections']){_0x2d2530[_0x6879('0x6a')]=[];}_0x2d2530['subsections']=_0x2d2530[_0x6879('0x6a')]['concat'](_0x1b4649);}}return _0x2d2530;});});}else{return;}})[_0x6879('0x2c')](function(_0x23e9e4){if(_0x23e9e4)_0x1bf3df=_0x23e9e4;if(_[_0x6879('0x68')](_0xf20c18,0x709)){var _0x42374e=_[_0x6879('0x4d')](_0x1bf3df,{'sectionId':0x709});return getPlugins(_0x42374e)[_0x6879('0x2c')](function(_0x47a98c){if(_0x42374e[_0x6879('0x67')]){return _[_0x6879('0x38')](_0x1bf3df,function(_0xc85bf7){if(_0xc85bf7[_0x6879('0x5a')]===0x709){_0xc85bf7[_0x6879('0x6a')]=_0x47a98c;}return _0xc85bf7;});}else{var _0x4e9dd4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x47a98c};var _0x12d7e5=_[_0x6879('0x38')](_0x1bf3df);_0x12d7e5[_0x6879('0x64')](_0x4e9dd4);return _0x12d7e5;}});}else{return;}})[_0x6879('0x2c')](function(_0x8d1179){if(_0x8d1179)_0x1bf3df=_0x8d1179;return _[_0x6879('0x42')](_0x1bf3df,[_0x6879('0x67'),0x1]);})[_0x6879('0x2c')](respondWithResult(_0x51cb5d,null))['catch'](handleError(_0x51cb5d,null));};function hasDefaultDashboard(_0xe04ad9){var _0x2bf0f2=[0x65];return new BPromise(function(_0xbf4757,_0xa92b11){try{if(_0xe04ad9[_0x6879('0x58')]){_0xbf4757(_0x2bf0f2);}else{return db[_0x6879('0x59')][_0x6879('0x6b')]({'where':{'sectionId':_0xe04ad9['id']},'raw':!![]})[_0x6879('0x2c')](function(_0x533e17){_0x533e17?_0xbf4757(_0x2bf0f2):_0xbf4757();});}}catch(_0x576bbe){_0xa92b11(_0x576bbe);}});}function getCustomDashboards(_0x330b68){var _0x195f4d=[];return new BPromise(function(_0x129e3c,_0x49a101){try{if(_0x330b68[_0x6879('0x58')]){return db[_0x6879('0x6c')][_0x6879('0x48')]({'raw':!![]})[_0x6879('0x2c')](function(_0x59947d){_0x59947d[_0x6879('0x6d')](function(_0x5380c3){_0x195f4d[_0x6879('0x64')](_0x5380c3['id']+0x1869f);});_0x129e3c(_0x195f4d);});}else{return db[_0x6879('0x59')][_0x6879('0x48')]({'where':{'sectionId':_0x330b68['id']},'raw':!![]})[_0x6879('0x2c')](function(_0x2ace9f){_0x2ace9f['forEach'](function(_0x46a8f6){_0x195f4d['push'](_0x46a8f6[_0x6879('0x6e')]+0x1869f);});_0x129e3c(_0x195f4d);});}}catch(_0x4104d2){_0x49a101(_0x4104d2);}});}function getPlugins(_0x2bc525){var _0x51a7e0=[];return new BPromise(function(_0x3791b2,_0x418b9b){try{if(_0x2bc525[_0x6879('0x58')]){return db[_0x6879('0x6f')][_0x6879('0x48')]({'raw':!![]})[_0x6879('0x2c')](function(_0x1f2422){_0x1f2422[_0x6879('0x6d')](function(_0x115127){_0x51a7e0[_0x6879('0x64')](_0x115127['id']+0x15b38);});_0x3791b2(_0x51a7e0);});}else{return db['UserProfileResource'][_0x6879('0x48')]({'where':{'sectionId':_0x2bc525['id']},'raw':!![]})[_0x6879('0x2c')](function(_0x5cd925){_0x5cd925['forEach'](function(_0x44c5d3){_0x51a7e0[_0x6879('0x64')](_0x44c5d3['resourceId']+0x15b38);});_0x3791b2(_0x51a7e0);});}}catch(_0x3b4f45){_0x418b9b(_0x3b4f45);}});}exports[_0x6879('0x70')]=function(_0x3eee77,_0x160f11){return db[_0x6879('0x32')][_0x6879('0x4d')]({'where':{'id':_0x3eee77[_0x6879('0x4b')]['id']}})['then'](handleEntityNotFound(_0x160f11,null))[_0x6879('0x2c')](function(_0x14214a){if(_0x14214a){return db['sequelize'][_0x6879('0x55')](function(_0x5d351c){return db[_0x6879('0x57')][_0x6879('0x48')]({'where':{'userProfileId':_0x3eee77[_0x6879('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x6879('0x2c')](function(_0x480953){if(_0x480953){return db[_0x6879('0x57')]['destroy']({'where':{'userProfileId':_0x3eee77['params']['id'],'id':_[_0x6879('0x38')](_0x480953,function(_0x22d6e6){return _0x22d6e6['id'];})},'transaction':_0x5d351c});}})[_0x6879('0x2c')](function(_0x579fc0){var _0x544b7a=_['map'](_0x3eee77[_0x6879('0x54')],function(_0x1cd208){_0x1cd208[_0x6879('0x5c')]=_0x3eee77[_0x6879('0x4b')]['id'];return _0x1cd208;});return db[_0x6879('0x57')]['bulkCreate'](_0x544b7a,{'raw':!![],'transaction':_0x5d351c});})[_0x6879('0x2c')](function(_0x2ad33b){var _0xfe55a6=_[_0x6879('0x42')](_[_0x6879('0x38')](_0x2ad33b,function(_0x1ce078){return _0x1ce078[_0x6879('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0xfe55a6){return db[_0x6879('0x57')]['findAll']({'where':{'userProfileId':_0x3eee77[_0x6879('0x4b')]['id'],'sectionId':_['map'](_0xfe55a6,function(_0x20e9be){return _0x20e9be[_0x6879('0x5a')];})},'attributes':['id',_0x6879('0x5a')],'raw':!![]})['then'](function(_0x5b229d){var _0x179326=_[_0x6879('0x38')](_0x3eee77[_0x6879('0x54')],function(_0x886522){_0x886522[_0x6879('0x5c')]=_0x3eee77['params']['id'];return _0x886522;});return db[_0x6879('0x59')]['bulkCreate'](_0x179326,{'raw':!![],'transaction':_0x5d351c});});}})[_0x6879('0x4f')](handleError(_0x160f11,null));});}})['then'](function(_0x449725){var _0x25a208=_[_0x6879('0x38')](_0x449725,function(_0x35e490){return _0x35e490[_0x6879('0x56')]({'plain':!![]});});})[_0x6879('0x2c')](respondWithResult(_0x160f11,null))['catch'](handleError(_0x160f11,null));};exports[_0x6879('0x71')]=function(_0x26c65d,_0x5e945b,_0x32b4f3){return db[_0x6879('0x32')][_0x6879('0x4d')]({'where':{'id':_0x26c65d['params']['id']}})[_0x6879('0x2c')](handleEntityNotFound(_0x5e945b,null))[_0x6879('0x2c')](function(_0x77e09b){if(_0x77e09b){return _0x77e09b[_0x6879('0x71')](_0x26c65d[_0x6879('0x3a')][_0x6879('0x72')]);}})[_0x6879('0x2c')](respondWithStatusCode(_0x5e945b,null))[_0x6879('0x4f')](handleError(_0x5e945b,null));};exports[_0x6879('0x73')]=function(_0x36e3c4,_0x8d067f){var _0x1a69e2={};if(!_0x36e3c4['query'][_0x6879('0x74')])throw new Error(_0x6879('0x75'));if(!_0x36e3c4['query'][_0x6879('0x3f')](_0x6879('0x76'))){_0x1a69e2[_0x6879('0x26')]=qs[_0x6879('0x26')](_0x36e3c4['query'][_0x6879('0x26')]);_0x1a69e2[_0x6879('0x25')]=qs[_0x6879('0x25')](_0x36e3c4[_0x6879('0x3a')][_0x6879('0x25')]);}return db[_0x6879('0x32')][_0x6879('0x4d')]({'where':{'id':_0x36e3c4[_0x6879('0x4b')]['id']}})[_0x6879('0x2c')](function(_0x5303da){if(!_0x5303da)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x36e3c4[_0x6879('0x4b')]['id']);return db[_0x6879('0x32')][_0x6879('0x73')](_0x36e3c4);})[_0x6879('0x2c')](respondWithFilteredResult(_0x8d067f,_0x1a69e2))[_0x6879('0x4f')](handleError(_0x8d067f,null));}; \ No newline at end of file +var _0x50ec=['sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','UserProfile','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','create','body','catch','params','get','omit','createdAt','crudPermissions','transaction','UserProfileSection','autoAssociation','UserProfileResource','updatedAt','userProfileId','Resources','destroy','describe','sequelize','sectionId','push','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','Plugin','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50ec,0xc9));var _0xc50e=function(_0x278fb8,_0x1c2c50){_0x278fb8=_0x278fb8-0x0;var _0x17b97a=_0x50ec[_0x278fb8];return _0x17b97a;};'use strict';var emlformat=require(_0xc50e('0x0'));var rimraf=require(_0xc50e('0x1'));var zipdir=require(_0xc50e('0x2'));var jsonpatch=require(_0xc50e('0x3'));var rp=require(_0xc50e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc50e('0x5'));var util=require('util');var path=require(_0xc50e('0x6'));var sox=require(_0xc50e('0x7'));var csv=require(_0xc50e('0x8'));var ejs=require(_0xc50e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc50e('0xa'));var squel=require(_0xc50e('0xb'));var crypto=require(_0xc50e('0xc'));var jsforce=require(_0xc50e('0xd'));var deskjs=require(_0xc50e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc50e('0xf'));var Redis=require('ioredis');var authService=require(_0xc50e('0x10'));var qs=require(_0xc50e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc50e('0x12'));var logger=require(_0xc50e('0x13'))(_0xc50e('0x14'));var utils=require(_0xc50e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc50e('0x16'));var db=require(_0xc50e('0x17'))['db'];config['redis']=_[_0xc50e('0x18')](config[_0xc50e('0x19')],{'host':_0xc50e('0x1a'),'port':0x18eb});var socket=require(_0xc50e('0x1b'))(new Redis(config[_0xc50e('0x19')]));require('./userProfile.socket')[_0xc50e('0x1c')](socket);function respondWithStatusCode(_0x220f32,_0xf17caa){_0xf17caa=_0xf17caa||0xcc;return function(_0x15812d){if(_0x15812d){return _0x220f32[_0xc50e('0x1d')](_0xf17caa);}return _0x220f32[_0xc50e('0x1e')](_0xf17caa)[_0xc50e('0x1f')]();};}function respondWithResult(_0x3e19d9,_0x20172c){_0x20172c=_0x20172c||0xc8;return function(_0x40e9e9){if(_0x40e9e9){return _0x3e19d9['status'](_0x20172c)[_0xc50e('0x20')](_0x40e9e9);}};}function respondWithFilteredResult(_0x58d3ba,_0x3097b2){return function(_0x19bc4c){if(_0x19bc4c){var _0x19b32f=typeof _0x3097b2[_0xc50e('0x21')]===_0xc50e('0x22')&&typeof _0x3097b2['limit']==='undefined';var _0x1f358f=_0x19bc4c[_0xc50e('0x23')];var _0xee4c8f=_0x19b32f?0x0:_0x3097b2[_0xc50e('0x21')];var _0x5c8bc8=_0x19b32f?_0x19bc4c[_0xc50e('0x23')]:_0x3097b2['offset']+_0x3097b2['limit'];var _0x510f92;if(_0x5c8bc8>=_0x1f358f){_0x5c8bc8=_0x1f358f;_0x510f92=0xc8;}else{_0x510f92=0xce;}_0x58d3ba[_0xc50e('0x1e')](_0x510f92);return _0x58d3ba[_0xc50e('0x24')](_0xc50e('0x25'),_0xee4c8f+'-'+_0x5c8bc8+'/'+_0x1f358f)[_0xc50e('0x20')](_0x19bc4c);}return null;};}function patchUpdates(_0x108178){return function(_0x3f01dc){try{jsonpatch[_0xc50e('0x26')](_0x3f01dc,_0x108178,!![]);}catch(_0x24c5ab){return BPromise[_0xc50e('0x27')](_0x24c5ab);}return _0x3f01dc[_0xc50e('0x28')]();};}function saveUpdates(_0x1ec0e7,_0x33f9a7){return function(_0x4ac95a){if(_0x4ac95a){return _0x4ac95a[_0xc50e('0x29')](_0x1ec0e7)[_0xc50e('0x2a')](function(_0x18e52d){return _0x18e52d;});}return null;};}function removeEntity(_0x1659ae,_0x26022a){return function(_0x227040){if(_0x227040){return _0x227040['destroy']()[_0xc50e('0x2a')](function(){_0x1659ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xccfd10,_0x228bf7){return function(_0x3c7f71){if(!_0x3c7f71){_0xccfd10[_0xc50e('0x1d')](0x194);}return _0x3c7f71;};}function handleError(_0x341e5f,_0x4f846f){_0x4f846f=_0x4f846f||0x1f4;return function(_0x42561c){logger[_0xc50e('0x2b')](_0x42561c[_0xc50e('0x2c')]);if(_0x42561c['name']){delete _0x42561c[_0xc50e('0x2d')];}_0x341e5f[_0xc50e('0x1e')](_0x4f846f)['send'](_0x42561c);};}exports[_0xc50e('0x2e')]=function(_0x236846,_0x6a1d32){var _0x2e9b0e={},_0x507adb={},_0x7e7bfe={'count':0x0,'rows':[]};var _0x3a5628=_[_0xc50e('0x2f')](db[_0xc50e('0x30')][_0xc50e('0x31')],function(_0x55f4bf){return{'name':_0x55f4bf['fieldName'],'type':_0x55f4bf['type'][_0xc50e('0x32')]};});_0x507adb[_0xc50e('0x33')]=_['map'](_0x3a5628,_0xc50e('0x2d'));_0x507adb[_0xc50e('0x34')]=_[_0xc50e('0x35')](_0x236846[_0xc50e('0x34')]);_0x507adb[_0xc50e('0x36')]=_[_0xc50e('0x37')](_0x507adb[_0xc50e('0x33')],_0x507adb[_0xc50e('0x34')]);_0x2e9b0e['attributes']=_[_0xc50e('0x37')](_0x507adb['model'],qs[_0xc50e('0x38')](_0x236846[_0xc50e('0x34')][_0xc50e('0x38')]));_0x2e9b0e['attributes']=_0x2e9b0e[_0xc50e('0x39')][_0xc50e('0x3a')]?_0x2e9b0e[_0xc50e('0x39')]:_0x507adb[_0xc50e('0x33')];if(!_0x236846[_0xc50e('0x34')][_0xc50e('0x3b')](_0xc50e('0x3c'))){_0x2e9b0e[_0xc50e('0x3d')]=qs[_0xc50e('0x3d')](_0x236846[_0xc50e('0x34')][_0xc50e('0x3d')]);_0x2e9b0e[_0xc50e('0x21')]=qs[_0xc50e('0x21')](_0x236846[_0xc50e('0x34')][_0xc50e('0x21')]);}_0x2e9b0e['order']=qs[_0xc50e('0x3e')](_0x236846[_0xc50e('0x34')][_0xc50e('0x3e')]);_0x2e9b0e['where']=qs[_0xc50e('0x36')](_['pick'](_0x236846[_0xc50e('0x34')],_0x507adb['filters']),_0x3a5628);if(_0x236846[_0xc50e('0x34')][_0xc50e('0x3f')]){_0x2e9b0e[_0xc50e('0x40')]=_['merge'](_0x2e9b0e[_0xc50e('0x40')],{'$or':_['map'](_0x3a5628,function(_0x47521f){if(_0x47521f[_0xc50e('0x41')]!==_0xc50e('0x42')){var _0x25682f={};_0x25682f[_0x47521f[_0xc50e('0x2d')]]={'$like':'%'+_0x236846[_0xc50e('0x34')][_0xc50e('0x3f')]+'%'};return _0x25682f;}})});}_0x2e9b0e=_[_0xc50e('0x43')]({},_0x2e9b0e,_0x236846[_0xc50e('0x44')]);var _0x1e33be={'where':_0x2e9b0e[_0xc50e('0x40')]};return db[_0xc50e('0x30')][_0xc50e('0x23')](_0x1e33be)['then'](function(_0xd077f8){_0x7e7bfe[_0xc50e('0x23')]=_0xd077f8;if(_0x236846[_0xc50e('0x34')][_0xc50e('0x45')]){_0x2e9b0e[_0xc50e('0x46')]=[{'all':!![]}];}return db[_0xc50e('0x30')][_0xc50e('0x47')](_0x2e9b0e);})['then'](function(_0x121ad0){_0x7e7bfe[_0xc50e('0x48')]=_0x121ad0;return _0x7e7bfe;})[_0xc50e('0x2a')](respondWithFilteredResult(_0x6a1d32,_0x2e9b0e))['catch'](handleError(_0x6a1d32,null));};exports[_0xc50e('0x49')]=function(_0x5c8bef,_0x3429e7){var _0x3647e6={'raw':![],'where':{'id':_0x5c8bef['params']['id']}},_0xaea724={};_0xaea724[_0xc50e('0x33')]=_[_0xc50e('0x35')](db['UserProfile']['rawAttributes']);_0xaea724['query']=_[_0xc50e('0x35')](_0x5c8bef[_0xc50e('0x34')]);_0xaea724[_0xc50e('0x36')]=_['intersection'](_0xaea724[_0xc50e('0x33')],_0xaea724[_0xc50e('0x34')]);_0x3647e6[_0xc50e('0x39')]=_['intersection'](_0xaea724[_0xc50e('0x33')],qs['fields'](_0x5c8bef[_0xc50e('0x34')][_0xc50e('0x38')]));_0x3647e6[_0xc50e('0x39')]=_0x3647e6['attributes'][_0xc50e('0x3a')]?_0x3647e6[_0xc50e('0x39')]:_0xaea724['model'];if(_0x5c8bef[_0xc50e('0x34')][_0xc50e('0x45')]){_0x3647e6['include']=[{'all':!![]}];}_0x3647e6=_['merge']({},_0x3647e6,_0x5c8bef[_0xc50e('0x44')]);return db[_0xc50e('0x30')][_0xc50e('0x4a')](_0x3647e6)['then'](handleEntityNotFound(_0x3429e7,null))[_0xc50e('0x2a')](respondWithResult(_0x3429e7,null))['catch'](handleError(_0x3429e7,null));};exports[_0xc50e('0x4b')]=function(_0x28c7b2,_0x444ad4){return db[_0xc50e('0x30')][_0xc50e('0x4b')](_0x28c7b2[_0xc50e('0x4c')],{})[_0xc50e('0x2a')](respondWithResult(_0x444ad4,0xc9))[_0xc50e('0x4d')](handleError(_0x444ad4,null));};exports['clone']=function(_0x35c0ae,_0x3d898b){var _0x439ab5={'where':{'id':_0x35c0ae[_0xc50e('0x4e')]['id']}},_0x205e88={};_0x205e88['model']=_[_0xc50e('0x35')](db[_0xc50e('0x30')][_0xc50e('0x31')]);_0x439ab5[_0xc50e('0x39')]=_['intersection'](_0x205e88[_0xc50e('0x33')],qs[_0xc50e('0x38')](_0x35c0ae[_0xc50e('0x34')][_0xc50e('0x38')]));_0x439ab5[_0xc50e('0x39')]=_0x439ab5[_0xc50e('0x39')][_0xc50e('0x3a')]?_0x439ab5[_0xc50e('0x39')]:_0x205e88[_0xc50e('0x33')];if(_0x35c0ae[_0xc50e('0x34')][_0xc50e('0x45')]){_0x439ab5[_0xc50e('0x46')]=[{'all':!![]}];}_0x439ab5=_[_0xc50e('0x43')]({},_0x439ab5,_0x35c0ae[_0xc50e('0x44')]);return db[_0xc50e('0x30')][_0xc50e('0x4a')](_0x439ab5)[_0xc50e('0x2a')](handleEntityNotFound(_0x3d898b,null))[_0xc50e('0x2a')](function(_0x2a88b7){if(_0x2a88b7){var _0x414425=_0x2a88b7[_0xc50e('0x4f')]({'plain':!![]});_0x414425=qs[_0xc50e('0x50')](_0x414425,['id',_0xc50e('0x51'),'updatedAt',_0xc50e('0x52')]);_0x35c0ae[_0xc50e('0x4c')]=_['omit'](_0x35c0ae['body'],['id',_0xc50e('0x51'),'updatedAt']);return db['sequelize'][_0xc50e('0x53')](function(_0x4079d9){return db['UserProfile'][_0xc50e('0x4b')](_['merge'](_0x414425,_0x35c0ae['body']),{'include':_0x35c0ae[_0xc50e('0x34')][_0xc50e('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x4079d9})[_0xc50e('0x2a')](function(_0x557cb1){var _0x4e06f7=_0x557cb1[_0xc50e('0x4f')]({'plain':!![]});return db[_0xc50e('0x54')][_0xc50e('0x47')]({'where':{'userProfileId':_0x35c0ae[_0xc50e('0x4e')]['id']},'raw':!![]})[_0xc50e('0x2a')](function(_0xddd0e0){if(_0xddd0e0){return BPromise['each'](_0xddd0e0,function(_0x2717a5){return new BPromise(function(_0x530c1d,_0x17aa74){if(_0x2717a5[_0xc50e('0x55')]===null||_0x2717a5['autoAssociation']===0x1)_0x530c1d(null);return db[_0xc50e('0x56')]['findAll']({'where':{'sectionId':_0x2717a5['id']},'raw':!![]})['then'](function(_0x21daf6){var _0x529f34=_['map'](_0x21daf6,function(_0x41753a){return qs['omit'](_0x41753a,['id',_0xc50e('0x51'),_0xc50e('0x57'),'sectionId']);});_0x530c1d(_0x529f34);})[_0xc50e('0x4d')](function(_0x2250f3){_0x17aa74(_0x2250f3);});})[_0xc50e('0x2a')](function(_0x4988b9){var _0x4bf5f7=qs[_0xc50e('0x50')](_0x2717a5,['id',_0xc50e('0x51'),_0xc50e('0x57')]);_0x4bf5f7[_0xc50e('0x58')]=_0x4e06f7['id'];if(_0x4988b9)_0x4bf5f7['Resources']=_0x4988b9;return _0x4bf5f7;})[_0xc50e('0x2a')](function(_0x431ee1){return db[_0xc50e('0x54')][_0xc50e('0x4b')](_0x431ee1,{'include':[{'model':db[_0xc50e('0x56')],'as':_0xc50e('0x59')}],'raw':!![],'transaction':_0x4079d9});});})[_0xc50e('0x2a')](function(){return _0x4e06f7;});}});});});}})[_0xc50e('0x2a')](respondWithResult(_0x3d898b,0xc9))[_0xc50e('0x4d')](handleError(_0x3d898b,null));};exports[_0xc50e('0x29')]=function(_0x586d42,_0xf1b50c){if(_0x586d42['body']['id']){delete _0x586d42[_0xc50e('0x4c')]['id'];}return db['UserProfile'][_0xc50e('0x4a')]({'where':{'id':_0x586d42[_0xc50e('0x4e')]['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0xf1b50c,null))['then'](saveUpdates(_0x586d42['body'],null))['then'](respondWithResult(_0xf1b50c,null))['catch'](handleError(_0xf1b50c,null));};exports[_0xc50e('0x5a')]=function(_0x53f364,_0x291abf){return db[_0xc50e('0x30')][_0xc50e('0x4a')]({'where':{'id':_0x53f364[_0xc50e('0x4e')]['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x291abf,null))[_0xc50e('0x2a')](removeEntity(_0x291abf,null))[_0xc50e('0x4d')](handleError(_0x291abf,null));};exports[_0xc50e('0x5b')]=function(_0x1c80d5,_0x53685d){return db[_0xc50e('0x30')][_0xc50e('0x5b')]()[_0xc50e('0x2a')](respondWithResult(_0x53685d,null))[_0xc50e('0x4d')](handleError(_0x53685d,null));};exports['addSections']=function(_0x28dba2,_0x603f3b){var _0x335bbf=_0x28dba2['body'];return db[_0xc50e('0x30')][_0xc50e('0x4a')]({'where':{'id':_0x28dba2[_0xc50e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x603f3b,null))[_0xc50e('0x2a')](function(_0x164f62){if(_0x164f62){return db[_0xc50e('0x5c')][_0xc50e('0x53')](function(_0x75c4f2){return db[_0xc50e('0x54')]['destroy']({'where':{'userProfileId':_0x28dba2[_0xc50e('0x4e')]['id'],'sectionId':_[_0xc50e('0x2f')](_0x335bbf,function(_0x1db866){return _0x1db866[_0xc50e('0x5d')];})},'transaction':_0x75c4f2})[_0xc50e('0x2a')](function(){var _0xc984a3=_[_0xc50e('0x2f')](_0x335bbf,function(_0x5958eb){_0x5958eb[_0xc50e('0x58')]=_0x28dba2['params']['id'];return _0x5958eb;});var _0x2a73e3=[];return BPromise['each'](_0xc984a3,function(_0x37b2bb){return db[_0xc50e('0x54')]['create'](_0x37b2bb,{'include':[{'model':db[_0xc50e('0x56')],'as':_0xc50e('0x59')}],'raw':!![],'transaction':_0x75c4f2})['then'](function(_0xf2ea36){_0x2a73e3[_0xc50e('0x5e')](_0xf2ea36[_0xc50e('0x4f')]({'plain':!![]}));});})[_0xc50e('0x2a')](function(){return _0x2a73e3;});});});}})[_0xc50e('0x2a')](function(_0x20f8c4){return _0x20f8c4;})[_0xc50e('0x2a')](respondWithResult(_0x603f3b,null))['catch'](handleError(_0x603f3b,null));};exports[_0xc50e('0x5f')]=function(_0x1fdea0,_0x25457){var _0x2db9a1;return db['UserProfile'][_0xc50e('0x4a')]({'where':{'id':_0x1fdea0[_0xc50e('0x4e')]['id']},'attributes':['id',_0xc50e('0x2d')]})[_0xc50e('0x2a')](handleEntityNotFound(_0x25457,null))['then'](function(_0x523140){if(_0x523140){_0x2db9a1=_0x523140;return db[_0xc50e('0x54')]['destroy']({'where':{'userProfileId':_0x1fdea0[_0xc50e('0x4e')]['id'],'sectionId':_0x1fdea0[_0xc50e('0x34')]['ids']}});}})['then'](function(){return _0x2db9a1;})[_0xc50e('0x2a')](respondWithStatusCode(_0x25457,null))['catch'](handleError(_0x25457,null));};exports[_0xc50e('0x60')]=function(_0x590bee,_0x5be0ec){var _0xad0ece=[];var _0x301932=[];return db[_0xc50e('0x54')][_0xc50e('0x47')]({'where':{'userProfileId':_0x590bee['params']['id']},'raw':!![]})[_0xc50e('0x2a')](function(_0x5151e9){_0xad0ece=_['filter'](_0x5151e9,function(_0x2435bc){return _0x2435bc[_0xc50e('0x61')]===0x1||_[_0xc50e('0x62')]([0x3eb,0x709],_0x2435bc[_0xc50e('0x5d')]);});if(!_[_0xc50e('0x63')](_0xad0ece)){return _['map'](_0xad0ece,function(_0x13f93f){return _0x13f93f[_0xc50e('0x5d')];});}else{return;}})[_0xc50e('0x2a')](function(_0x33bc1d){if(_0x33bc1d)_0x301932=_0x33bc1d;if(_[_0xc50e('0x62')](_0x301932,0x64)){var _0x5cf0c2=_[_0xc50e('0x4a')](_0xad0ece,{'sectionId':0x64});return hasDefaultDashboard(_0x5cf0c2)['then'](function(_0x4ec41a){return _[_0xc50e('0x2f')](_0xad0ece,function(_0x4a7307){if(_0x4a7307[_0xc50e('0x5d')]===0x64){_0x4a7307[_0xc50e('0x64')]=_0x4ec41a;}return _0x4a7307;});});}else{return;}})[_0xc50e('0x2a')](function(_0x4d5232){if(_0x4d5232)_0xad0ece=_0x4d5232;if(_['includes'](_0x301932,0x3eb)){var _0x111fd7=_[_0xc50e('0x4a')](_0xad0ece,{'sectionId':0x3eb});return getCustomDashboards(_0x111fd7)[_0xc50e('0x2a')](function(_0xb4e969){return _[_0xc50e('0x2f')](_0xad0ece,function(_0x832446){if(_0x111fd7[_0xc50e('0x61')]){if(_0x832446[_0xc50e('0x5d')]===0x3eb){_0x832446['subsections']=_0xb4e969;}}else{if(_0x832446[_0xc50e('0x5d')]===0x64){if(!_0x832446[_0xc50e('0x64')]){_0x832446[_0xc50e('0x64')]=[];}_0x832446['subsections']=_0x832446[_0xc50e('0x64')][_0xc50e('0x65')](_0xb4e969);}}return _0x832446;});});}else{return;}})[_0xc50e('0x2a')](function(_0x4d7f18){if(_0x4d7f18)_0xad0ece=_0x4d7f18;if(_[_0xc50e('0x62')](_0x301932,0x709)){var _0x3c6f01=_[_0xc50e('0x4a')](_0xad0ece,{'sectionId':0x709});return getPlugins(_0x3c6f01)['then'](function(_0x2c7aa7){if(_0x3c6f01[_0xc50e('0x61')]){return _[_0xc50e('0x2f')](_0xad0ece,function(_0x3ba831){if(_0x3ba831[_0xc50e('0x5d')]===0x709){_0x3ba831[_0xc50e('0x64')]=_0x2c7aa7;}return _0x3ba831;});}else{var _0x4f1b87={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2c7aa7};var _0x4d20f7=_['map'](_0xad0ece);_0x4d20f7[_0xc50e('0x5e')](_0x4f1b87);return _0x4d20f7;}});}else{return;}})['then'](function(_0x127943){if(_0x127943)_0xad0ece=_0x127943;return _[_0xc50e('0x3f')](_0xad0ece,[_0xc50e('0x61'),0x1]);})[_0xc50e('0x2a')](respondWithResult(_0x5be0ec,null))['catch'](handleError(_0x5be0ec,null));};function hasDefaultDashboard(_0x152412){var _0xedfb0a=[0x65];return new BPromise(function(_0x12bc67,_0x578c27){try{if(_0x152412[_0xc50e('0x55')]){_0x12bc67(_0xedfb0a);}else{return db[_0xc50e('0x56')][_0xc50e('0x66')]({'where':{'sectionId':_0x152412['id']},'raw':!![]})['then'](function(_0x4f8185){_0x4f8185?_0x12bc67(_0xedfb0a):_0x12bc67();});}}catch(_0x3bb916){_0x578c27(_0x3bb916);}});}function getCustomDashboards(_0x4f6ad3){var _0x35a207=[];return new BPromise(function(_0x4372c4,_0x465b7c){try{if(_0x4f6ad3[_0xc50e('0x55')]){return db[_0xc50e('0x67')]['findAll']({'raw':!![]})[_0xc50e('0x2a')](function(_0x21fa53){_0x21fa53['forEach'](function(_0x24a45b){_0x35a207[_0xc50e('0x5e')](_0x24a45b['id']+0x1869f);});_0x4372c4(_0x35a207);});}else{return db[_0xc50e('0x56')][_0xc50e('0x47')]({'where':{'sectionId':_0x4f6ad3['id']},'raw':!![]})[_0xc50e('0x2a')](function(_0x1aa199){_0x1aa199['forEach'](function(_0x3c7138){_0x35a207[_0xc50e('0x5e')](_0x3c7138['resourceId']+0x1869f);});_0x4372c4(_0x35a207);});}}catch(_0x270c80){_0x465b7c(_0x270c80);}});}function getPlugins(_0x45c3da){var _0x409fd2=[];return new BPromise(function(_0x19bee9,_0x71bafb){try{if(_0x45c3da['autoAssociation']){return db[_0xc50e('0x68')]['findAll']({'raw':!![]})[_0xc50e('0x2a')](function(_0x489888){_0x489888[_0xc50e('0x69')](function(_0x19baab){_0x409fd2[_0xc50e('0x5e')](_0x19baab['id']+0x15b38);});_0x19bee9(_0x409fd2);});}else{return db[_0xc50e('0x56')][_0xc50e('0x47')]({'where':{'sectionId':_0x45c3da['id']},'raw':!![]})[_0xc50e('0x2a')](function(_0xfb8098){_0xfb8098[_0xc50e('0x69')](function(_0x4aea2c){_0x409fd2[_0xc50e('0x5e')](_0x4aea2c[_0xc50e('0x6a')]+0x15b38);});_0x19bee9(_0x409fd2);});}}catch(_0x2db44d){_0x71bafb(_0x2db44d);}});}exports[_0xc50e('0x6b')]=function(_0x80d661,_0x5d59b8){return db['UserProfile'][_0xc50e('0x4a')]({'where':{'id':_0x80d661[_0xc50e('0x4e')]['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x5d59b8,null))[_0xc50e('0x2a')](function(_0x4e76a3){if(_0x4e76a3){return db[_0xc50e('0x5c')][_0xc50e('0x53')](function(_0x545b43){return db[_0xc50e('0x54')][_0xc50e('0x47')]({'where':{'userProfileId':_0x80d661[_0xc50e('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0xc50e('0x2a')](function(_0x23e82b){if(_0x23e82b){return db[_0xc50e('0x54')][_0xc50e('0x5a')]({'where':{'userProfileId':_0x80d661['params']['id'],'id':_['map'](_0x23e82b,function(_0x273c13){return _0x273c13['id'];})},'transaction':_0x545b43});}})['then'](function(_0x4e9c1e){var _0x15a81f=_[_0xc50e('0x2f')](_0x80d661[_0xc50e('0x4c')],function(_0xae9e2e){_0xae9e2e[_0xc50e('0x58')]=_0x80d661[_0xc50e('0x4e')]['id'];return _0xae9e2e;});return db[_0xc50e('0x54')][_0xc50e('0x6c')](_0x15a81f,{'raw':!![],'transaction':_0x545b43});})[_0xc50e('0x2a')](function(_0x224704){var _0x341eb0=_['filter'](_[_0xc50e('0x2f')](_0x224704,function(_0x22e641){return _0x22e641[_0xc50e('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x341eb0){return db[_0xc50e('0x54')][_0xc50e('0x47')]({'where':{'userProfileId':_0x80d661[_0xc50e('0x4e')]['id'],'sectionId':_[_0xc50e('0x2f')](_0x341eb0,function(_0x7edc63){return _0x7edc63[_0xc50e('0x5d')];})},'attributes':['id',_0xc50e('0x5d')],'raw':!![]})[_0xc50e('0x2a')](function(_0x5ab0a0){var _0x31b69e=_['map'](_0x80d661[_0xc50e('0x4c')],function(_0x917377){_0x917377[_0xc50e('0x58')]=_0x80d661[_0xc50e('0x4e')]['id'];return _0x917377;});return db[_0xc50e('0x56')][_0xc50e('0x6c')](_0x31b69e,{'raw':!![],'transaction':_0x545b43});});}})[_0xc50e('0x4d')](handleError(_0x5d59b8,null));});}})[_0xc50e('0x2a')](function(_0x1489cb){var _0x54f223=_[_0xc50e('0x2f')](_0x1489cb,function(_0xf83ca9){return _0xf83ca9[_0xc50e('0x4f')]({'plain':!![]});});})[_0xc50e('0x2a')](respondWithResult(_0x5d59b8,null))['catch'](handleError(_0x5d59b8,null));};exports[_0xc50e('0x6d')]=function(_0x5998cc,_0x3a440f,_0x47cd73){return db[_0xc50e('0x30')][_0xc50e('0x4a')]({'where':{'id':_0x5998cc['params']['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x3a440f,null))[_0xc50e('0x2a')](function(_0x562fdf){if(_0x562fdf){return _0x562fdf[_0xc50e('0x6d')](_0x5998cc[_0xc50e('0x34')][_0xc50e('0x6e')]);}})[_0xc50e('0x2a')](respondWithStatusCode(_0x3a440f,null))[_0xc50e('0x4d')](handleError(_0x3a440f,null));};exports[_0xc50e('0x6f')]=function(_0x144b5c,_0x31c934){var _0x531199={};if(!_0x144b5c['query'][_0xc50e('0x70')])throw new Error(_0xc50e('0x71'));if(!_0x144b5c[_0xc50e('0x34')][_0xc50e('0x3b')]('nolimit')){_0x531199['limit']=qs[_0xc50e('0x3d')](_0x144b5c['query']['limit']);_0x531199[_0xc50e('0x21')]=qs[_0xc50e('0x21')](_0x144b5c[_0xc50e('0x34')][_0xc50e('0x21')]);}return db[_0xc50e('0x30')][_0xc50e('0x4a')]({'where':{'id':_0x144b5c['params']['id']}})[_0xc50e('0x2a')](function(_0x2b6d8a){if(!_0x2b6d8a)throw new Error(_0xc50e('0x72')+_0x144b5c[_0xc50e('0x4e')]['id']);return db[_0xc50e('0x30')]['getResources'](_0x144b5c);})[_0xc50e('0x2a')](respondWithFilteredResult(_0x31c934,_0x531199))[_0xc50e('0x4d')](handleError(_0x31c934,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d62af5b..7237de8 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 _0x8710=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x393894,_0x48a6f8){var _0x513692=function(_0x1a32d9){while(--_0x1a32d9){_0x393894['push'](_0x393894['shift']());}};_0x513692(++_0x48a6f8);}(_0x8710,0x68));var _0x0871=function(_0x42fe01,_0x188699){_0x42fe01=_0x42fe01-0x0;var _0x370e40=_0x8710[_0x42fe01];return _0x370e40;};'use strict';var EventEmitter=require(_0x0871('0x0'));var UserProfile=require(_0x0871('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0871('0x2')](0x0);var events={'afterCreate':_0x0871('0x3'),'afterUpdate':_0x0871('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ac8cf){return function(_0x825b5,_0x48a450,_0x3bd909){UserProfileEvents['emit'](_0x2ac8cf+':'+_0x825b5['id'],_0x825b5);UserProfileEvents[_0x0871('0x5')](_0x2ac8cf,_0x825b5);_0x3bd909(null);};}for(var e in events){if(events[_0x0871('0x6')](e)){var event=events[e];UserProfile[_0x0871('0x7')](e,emitEvent(event));}}module[_0x0871('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x49c1=['UserProfile','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x9861ff,_0x41fb17){var _0x48852b=function(_0x557001){while(--_0x557001){_0x9861ff['push'](_0x9861ff['shift']());}};_0x48852b(++_0x41fb17);}(_0x49c1,0xef));var _0x149c=function(_0x4c4e44,_0x22d77c){_0x4c4e44=_0x4c4e44-0x0;var _0x57ed07=_0x49c1[_0x4c4e44];return _0x57ed07;};'use strict';var EventEmitter=require(_0x149c('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x149c('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x149c('0x2')](0x0);var events={'afterCreate':_0x149c('0x3'),'afterUpdate':'update','afterDestroy':_0x149c('0x4')};function emitEvent(_0x2297bf){return function(_0x4c3294,_0xdb4fdf,_0x8c3ab2){UserProfileEvents['emit'](_0x2297bf+':'+_0x4c3294['id'],_0x4c3294);UserProfileEvents[_0x149c('0x5')](_0x2297bf,_0x4c3294);_0x8c3ab2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x149c('0x6')](e,emitEvent(event));}}module[_0x149c('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 597dfdc..2453733 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 _0x6cd8=['limit','offset','order','sort','where','pick','merge','key','foreignKey','forEach','includeAll','include','reportType','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','mail','openchannel','lodash','./userProfile.attributes','exports','filter','field','value','findAll','associatedResources','map','catch','model','resolve','UserProfileResource','then','AnalyticExtractedReport','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','name','projects','JscriptyProject','contacts','ListId','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','QueueCampaigns','VoiceQueue','type','outbound','musiconholds','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','trunks','variables','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','_interactions','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','keys','filters','intersection','attributes','fields','nolimit'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x6cd8,0x19a));var _0x86cd=function(_0x1fa7fb,_0x2ca0fc){_0x1fa7fb=_0x1fa7fb-0x0;var _0x118163=_0x6cd8[_0x1fa7fb];return _0x118163;};'use strict';var _=require(_0x86cd('0x0'));var attributes=require(_0x86cd('0x1'));var squel=require('squel');module[_0x86cd('0x2')]=function(_0x248918){var _0x1e75dd=_0x248918['models'];function _0x400a79(_0x342c93,_0x4c2d88){return new Promise(function(_0x5206c7,_0x12fd8e){if(!_0x4c2d88)return _0x5206c7(null);var _0x3ff13f=_0x4c2d88[_0x86cd('0x3')]?{[_0x4c2d88[_0x86cd('0x3')][_0x86cd('0x4')]]:_0x4c2d88['filter'][_0x86cd('0x5')]}:undefined;return _0x1e75dd[_0x342c93][_0x86cd('0x6')]({'where':_0x3ff13f,'raw':!![]})['then'](function(_0x2d1792){_0x4c2d88[_0x86cd('0x7')]=_[_0x86cd('0x8')](_0x2d1792,'id');_0x5206c7(_0x4c2d88);})[_0x86cd('0x9')](function(_0x3e927b){_0x12fd8e(_0x3e927b);});});}function _0x4374c7(_0x127a15,_0x57d141){return new Promise(function(_0x284332,_0x13322f){var _0x3cbbcd=_0x127a15['filter']?{[_0x127a15[_0x86cd('0x3')][_0x86cd('0x4')]]:_0x127a15[_0x86cd('0x3')][_0x86cd('0x5')]}:undefined;return _0x1e75dd[_0x127a15[_0x86cd('0xa')]][_0x86cd('0x6')]({'where':_0x3cbbcd,'raw':!![]})['then'](function(_0x5e8dc7){_0x57d141['associatedResources']=_[_0x86cd('0x8')](_0x5e8dc7,function(_0x4837a){return _0x4837a['name'];});_0x284332(_0x57d141);})[_0x86cd('0x9')](function(_0x26b61d){_0x13322f(_0x26b61d);});});}function _0x29d6d5(_0x360d28,_0xc25cdf,_0x4872e3){if(!_0xc25cdf)return Promise[_0x86cd('0xb')](null);return new Promise(function(_0x11adf9,_0x1b37e7){return _0x1e75dd[_0x86cd('0xc')][_0x86cd('0x6')]({'where':{'sectionId':_0xc25cdf['id']},'raw':!![]})[_0x86cd('0xd')](function(_0x11e381){if(_0x360d28[_0x86cd('0x4')]&&_0x360d28[_0x86cd('0x4')]!=='id'){_0xc25cdf[_0x86cd('0x7')]=_[_0x86cd('0x8')](_0x11e381,function(_0x286846){return _0x286846[_0x360d28[_0x86cd('0x4')]];});}else{if(_0x4872e3===_0x86cd('0xe')){_0xc25cdf[_0x86cd('0x7')]=_[_0x86cd('0x8')](_0x11e381,function(_0x1cfbb7){return{'id':_0x1cfbb7[_0x86cd('0xf')],'type':_0x1cfbb7['type']};});}else{_0xc25cdf[_0x86cd('0x7')]=_['map'](_0x11e381,function(_0x5b3419){return _0x5b3419['resourceId'];});}}_0x11adf9(_0xc25cdf);})[_0x86cd('0x9')](function(_0x13567d){_0x1b37e7(_0x13567d);});});}function _0x397c12(_0x662ecd,_0x5338f4){var _0x1bb59f={'parentSections':[]};switch(_0x662ecd['toLowerCase']()){case _0x86cd('0x10'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x12');break;case _0x86cd('0x13'):_0x1bb59f['childModel']=_0x86cd('0x14');break;case _0x86cd('0x15'):_0x1bb59f['childModel']='SquareRecording';_0x1bb59f[_0x86cd('0x16')]=[{'name':'SquareProjects','field':_0x86cd('0x17'),'foreignKey':'projectName'}];break;case _0x86cd('0x18'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x19');break;case _0x86cd('0x1a'):_0x1bb59f[_0x86cd('0x11')]='CmContact';_0x1bb59f[_0x86cd('0x16')]=[{'name':'Lists','field':'id','foreignKey':_0x86cd('0x1b')}];break;case'lists':_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x1c');break;case _0x86cd('0x1d'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x1e');break;case'globalcustomfields':_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x1f');break;case _0x86cd('0x20'):_0x1bb59f[_0x86cd('0x11')]='ChatQueue';break;case'chatwebsites':_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x21');break;case'faxqueues':_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x22');break;case _0x86cd('0x23'):_0x1bb59f['childModel']=_0x86cd('0x24');break;case _0x86cd('0x25'):case'internalroutes':case _0x86cd('0x26'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x27');break;case _0x86cd('0x28'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x29');break;case _0x86cd('0x2a'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x2b');break;case'voicerecordings':_0x1bb59f['childModel']=_0x86cd('0x2c');_0x1bb59f['parentSections']=[{'name':_0x86cd('0x2d'),'field':_0x86cd('0x17'),'foreignKey':'membername','model':_0x86cd('0x2e'),'filter':{'field':_0x86cd('0x2f'),'value':[_0x86cd('0x30')]}},{'name':_0x86cd('0x31'),'field':'name','foreignKey':_0x86cd('0x32'),'model':_0x86cd('0x2e'),'filter':{'field':_0x86cd('0x2f'),'value':[_0x86cd('0x33')]}},{'name':_0x86cd('0x34'),'field':_0x86cd('0x17'),'foreignKey':_0x86cd('0x35'),'model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':_0x86cd('0x36'),'field':_0x86cd('0x17'),'foreignKey':'queue','model':_0x86cd('0x37'),'filter':{'field':_0x86cd('0x38'),'value':[_0x86cd('0x39')]}}];break;case _0x86cd('0x3a'):_0x1bb59f[_0x86cd('0x11')]='VoiceMusicOnHold';break;case'chanspies':_0x1bb59f['childModel']='VoiceChanSpy';break;case _0x86cd('0x3b'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x3c');break;case _0x86cd('0x3d'):_0x1bb59f['childModel']='Campaign';break;case _0x86cd('0x3e'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x3f');break;case _0x86cd('0x40'):_0x1bb59f[_0x86cd('0x11')]='MailAccount';break;case'mailsubstatuses':_0x1bb59f['childModel']=_0x86cd('0x41');break;case'openchannelqueues':_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x42');break;case _0x86cd('0x43'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x44');break;case _0x86cd('0x45'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x46');break;case'smsaccounts':_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x47');break;case _0x86cd('0x48'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x49');break;case _0x86cd('0x4a'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x4b');break;case _0x86cd('0x4c'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x4d');break;case'voicequeues':case _0x86cd('0x4e'):_0x1bb59f[_0x86cd('0x11')]='VoiceQueue';if(_0x5338f4){_0x1bb59f['parentSections']=[{'name':'VoiceQueues'},{'name':_0x86cd('0x36')}];}break;case _0x86cd('0x4f'):case _0x86cd('0x50'):case _0x86cd('0x51'):_0x1bb59f[_0x86cd('0x11')]='User';if(_0x5338f4){_0x1bb59f[_0x86cd('0x16')]=[{'name':_0x86cd('0x52'),'filter':{'field':_0x86cd('0x2f'),'value':[_0x86cd('0x53'),_0x86cd('0x54')]},'ignore':!![]},{'name':_0x86cd('0x2d')},{'name':_0x86cd('0x31')}];}break;case _0x86cd('0x55'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x56');break;case _0x86cd('0x57'):_0x1bb59f['childModel']=_0x86cd('0x58');break;case _0x86cd('0x59'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x5a');break;case _0x86cd('0x5b'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x5c');break;case _0x86cd('0x5d'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x5e');break;case _0x86cd('0x5f'):_0x1bb59f[_0x86cd('0x11')]='ZohoAccount';break;case _0x86cd('0x60'):_0x1bb59f[_0x86cd('0x11')]='User';break;case _0x86cd('0x61'):_0x1bb59f['childModel']='CannedAnswer';break;case _0x86cd('0x62'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x63');break;case _0x86cd('0x64'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x65');break;case _0x86cd('0x66'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x67');break;case _0x86cd('0x68'):_0x1bb59f['childModel']='Pause';break;case _0x86cd('0x69'):_0x1bb59f['childModel']=_0x86cd('0x6a');break;case'sounds':_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x6b');break;case _0x86cd('0x6c'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x6d');break;case _0x86cd('0x6e'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x6f');break;case _0x86cd('0x70'):_0x1bb59f[_0x86cd('0x11')]='Trigger';break;case _0x86cd('0x71'):_0x1bb59f[_0x86cd('0x11')]='Trunk';break;case _0x86cd('0x72'):_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x73');break;case _0x86cd('0x74'):_0x1bb59f['childModel']=_0x86cd('0x75');break;case _0x86cd('0x76'):_0x1bb59f[_0x86cd('0x11')]='AnalyticExtractedReport';_0x1bb59f[_0x86cd('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0x86cd('0x77')}];break;case'metrics':_0x1bb59f[_0x86cd('0x11')]=_0x86cd('0x78');break;}return _0x1bb59f;}function _0x31909c(_0x2fe871,_0x55ec92){var _0x1177ca=_0x2fe871[_0x86cd('0x79')](0x0)['toUpperCase']()+_0x2fe871[_0x86cd('0x7a')](0x1);var _0x271343={'type':_0x1e75dd[_0x86cd('0x7b')][_0x86cd('0x7c')][_0x86cd('0x7d')],'raw':!![]};return new Promise(function(_0x3c0ca4,_0x54bede){var _0x418da8=squel[_0x86cd('0x7e')]()[_0x86cd('0x4')](_0x86cd('0x7f')+_0x1177ca+'InteractionId','id')[_0x86cd('0x4')](_0x86cd('0x80'))[_0x86cd('0x81')]('user_has_'+_0x2fe871+_0x86cd('0x82'),'ui')['where']('ui.UserId\x20=\x20?',_0x55ec92['id']);return _0x1e75dd[_0x86cd('0x83')][_0x86cd('0x84')](_0x418da8[_0x86cd('0x85')](),_0x271343)[_0x86cd('0xd')](function(_0x1520d6){_0x55ec92[_0x1177ca+_0x86cd('0x86')]=_0x1520d6;_0x3c0ca4(_0x1520d6);})[_0x86cd('0x9')](function(_0x2bcd29){_0x54bede(_0x2bcd29);});});}return _0x248918[_0x86cd('0x87')](_0x86cd('0x88'),attributes,{'tableName':_0x86cd('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5e8963){var _0x1a4574=require('../../components/parsers/qs');var _0x4e1798={'raw':_0x5e8963[_0x86cd('0x84')][_0x86cd('0x8a')],'where':{}};var _0x10c792={};var _0xd2365={'count':0x0,'rows':[]};var _0x588909=_0x5e8963['query'][_0x86cd('0x8b')];var _0x58ed25=_0x5e8963[_0x86cd('0x84')][_0x86cd('0x8c')]||![];var _0x3a3764=_0x397c12(_0x588909,_0x58ed25);if(!_0x3a3764[_0x86cd('0x11')])throw new Error(_0x86cd('0x8d')+_0x588909+'\x27');var _0x3c58e9=[{'name':_0x588909}];if(!_[_0x86cd('0x8e')](_0x3a3764[_0x86cd('0x16')]))_0x3c58e9=_0x3a3764['parentSections'];var _0xb623c6=[];for(var _0x126c51=0x0;_0x126c51<_0x3c58e9[_0x86cd('0x8f')];_0x126c51++){_0xb623c6[_0x86cd('0x90')](_0x1e75dd[_0x86cd('0x91')][_0x86cd('0x92')]({'where':{'userProfileId':_0x5e8963[_0x86cd('0x93')]['id'],'name':_0x3c58e9[_0x126c51]['name']},'raw':!![]}));}return Promise[_0x86cd('0x94')](_0xb623c6)['then'](function(_0xcdb81){var _0x2d469f=_[_0x86cd('0x3')](_0xcdb81,function(_0x4d3410){return _0x4d3410?_0x4d3410:undefined;});var _0x131847=_[_0x86cd('0x3')](_0x3c58e9,[_0x86cd('0x95'),!![]]);var _0x3386d8=_[_0x86cd('0x8e')](_0x2d469f)&&_[_0x86cd('0x8e')](_0x131847)?null:_[_0x86cd('0x96')](_0x131847,_0x2d469f);if(!_0x3386d8)return null;var _0x27553f=[];for(var _0x1082ba=0x0;_0x1082ba<_0x3386d8[_0x86cd('0x8f')];_0x1082ba++){var _0x3d8ced=_[_0x86cd('0x92')](_0x3c58e9,function(_0x589bb3){return _0x3386d8[_0x1082ba]?_0x589bb3[_0x86cd('0x17')]===_0x3386d8[_0x1082ba][_0x86cd('0x17')]:null;});if(_0x3d8ced){if(_0x3386d8[_0x1082ba][_0x86cd('0x95')]){_0x27553f['push'](_0x400a79(_0x3a3764[_0x86cd('0x11')],_0x3386d8[_0x1082ba]));}else{if(!_0x3386d8[_0x1082ba]['autoAssociation']){_0x27553f[_0x86cd('0x90')](_0x29d6d5(_0x3d8ced,_0x3386d8[_0x1082ba],_0x3a3764[_0x86cd('0x11')]));}else{if(_0x3d8ced[_0x86cd('0xa')]){_0x27553f[_0x86cd('0x90')](_0x4374c7(_0x3d8ced,_0x3386d8[_0x1082ba]));}}}}}return Promise[_0x86cd('0x94')](_0x27553f);})['then'](function(_0x1492fb){var _0x2e105c=_0x1492fb;var _0x402c52=null;if(_0x2e105c){_0x402c52=_0x2e105c[_0x86cd('0x8f')]===0x1?_0x2e105c[0x0]:null;}if(!_0x402c52&&!_0x2e105c)return _0xd2365;var _0x422c93=_0x1e75dd[_0x3a3764['childModel']]['rawAttributes'];_0x10c792[_0x86cd('0xa')]=_[_0x86cd('0x97')](_0x422c93);_0x10c792['query']=_[_0x86cd('0x97')](_0x5e8963[_0x86cd('0x84')]);_0x10c792[_0x86cd('0x98')]=_[_0x86cd('0x99')](_0x10c792[_0x86cd('0xa')],_0x10c792['query']);_0x4e1798[_0x86cd('0x9a')]=_[_0x86cd('0x99')](_0x10c792[_0x86cd('0xa')],_0x1a4574[_0x86cd('0x9b')](_0x5e8963[_0x86cd('0x84')][_0x86cd('0x9b')]));_0x4e1798[_0x86cd('0x9a')]=_0x4e1798[_0x86cd('0x9a')][_0x86cd('0x8f')]?_0x4e1798[_0x86cd('0x9a')]:_0x10c792[_0x86cd('0xa')];if(!_0x5e8963[_0x86cd('0x84')]['hasOwnProperty'](_0x86cd('0x9c'))){_0x4e1798[_0x86cd('0x9d')]=_0x1a4574['limit'](_0x5e8963[_0x86cd('0x84')]['limit']);_0x4e1798['offset']=_0x1a4574[_0x86cd('0x9e')](_0x5e8963[_0x86cd('0x84')][_0x86cd('0x9e')]);}_0x4e1798[_0x86cd('0x9f')]=_0x1a4574[_0x86cd('0xa0')](_0x5e8963[_0x86cd('0x84')]['sort']);_0x4e1798[_0x86cd('0xa1')]=_0x1a4574[_0x86cd('0x98')](_[_0x86cd('0xa2')](_0x5e8963[_0x86cd('0x84')],_0x10c792[_0x86cd('0x98')]));if(_0x5e8963['query'][_0x86cd('0x3')]){_0x4e1798[_0x86cd('0xa1')]=_[_0x86cd('0xa3')](_0x4e1798[_0x86cd('0xa1')],{'$or':_[_0x86cd('0x8')](_0x422c93,function(_0x1baabf){if(_0x1baabf[_0x86cd('0x38')][_0x86cd('0xa4')]!=='VIRTUAL'){var _0x2a0fd0={};_0x2a0fd0[_0x1baabf[_0x86cd('0x4')]]={'$like':'%'+_0x5e8963[_0x86cd('0x84')]['filter']+'%'};return _0x2a0fd0;}})});}var _0x434427=[];var _0x4e3e51=null;var _0x4d16a8={};if(_0x402c52){_0x4e3e51=_[_0x86cd('0x92')](_0x3c58e9,[_0x86cd('0x17'),_0x402c52[_0x86cd('0x17')]]);if(_0x4e3e51['field']){_0x4d16a8={};if(_0x3a3764[_0x86cd('0x11')]===_0x86cd('0xe')){_0x4d16a8[_0x4e3e51[_0x86cd('0xa5')]]=_[_0x86cd('0x8')](_0x402c52[_0x86cd('0x7')],'id');}else{_0x4d16a8[_0x4e3e51[_0x86cd('0xa5')]]=_0x402c52[_0x86cd('0x7')];}_0x434427['push'](_0x4d16a8);}else{_0x4e1798[_0x86cd('0xa1')]['id']=_0x402c52[_0x86cd('0x7')];}}else{for(var _0x39612f=0x0;_0x39612f<_0x2e105c['length'];_0x39612f++){_0x4e3e51=_[_0x86cd('0x92')](_0x3c58e9,[_0x86cd('0x17'),_0x2e105c[_0x39612f][_0x86cd('0x17')]]);if(_0x4e3e51[_0x86cd('0x4')]){_0x4d16a8={};_0x4d16a8[_0x4e3e51[_0x86cd('0xa5')]]=_0x2e105c[_0x39612f]['associatedResources'];_0x434427[_0x86cd('0x90')](_0x4d16a8);}else{if(!_0x4e1798['where']['id'])_0x4e1798[_0x86cd('0xa1')]['id']=[];_0x2e105c[_0x39612f]['associatedResources'][_0x86cd('0xa6')](function(_0x4ad9de){_0x4e1798['where']['id'][_0x86cd('0x90')](_0x4ad9de);});}}}if(!_[_0x86cd('0x8e')](_0x434427)){_0x4e1798[_0x86cd('0xa1')]=_[_0x86cd('0xa3')](_0x4e1798['where'],{'$and':{'$or':_0x434427}});}_0x4e1798=_[_0x86cd('0xa3')]({},_0x4e1798,_0x5e8963['options']);if(_0x402c52&&!_0x402c52['autoAssociation']&&_0x3a3764[_0x86cd('0x11')]===_0x86cd('0xe')){if(_0x5e8963[_0x86cd('0x84')][_0x86cd('0xa7')]){_0x4e1798[_0x86cd('0xa8')]=[{'all':!![]}];}return _0x1e75dd[_0x3a3764[_0x86cd('0x11')]][_0x86cd('0x6')](_0x4e1798)['then'](function(_0x46e269){var _0x590e13=[];_0x46e269[_0x86cd('0xa6')](function(_0x3f2456){var _0x162944;switch(_0x3f2456[_0x86cd('0xa9')]){case'default':_0x162944=_[_0x86cd('0x92')](_0x402c52[_0x86cd('0x7')],function(_0x3dad62){return _0x3dad62['id']===_0x3f2456['reportId']&&_0x3dad62['type']==='DefaultReports';});break;case _0x86cd('0xaa'):_0x162944=_['find'](_0x402c52['associatedResources'],function(_0x1943e5){return _0x1943e5['id']===_0x3f2456[_0x86cd('0x77')]&&_0x1943e5['type']===_0x86cd('0xab');});break;}if(_0x162944)_0x590e13[_0x86cd('0x90')](_0x3f2456);});_0xd2365[_0x86cd('0xac')]=_0x590e13[_0x86cd('0x8f')];_0xd2365[_0x86cd('0xad')]=_0x590e13;return _0xd2365;});}else{if(!_[_0x86cd('0x8e')](_0x5e8963[_0x86cd('0x84')][_0x86cd('0xae')])){_0x4e1798[_0x86cd('0xa1')]['id']=_0x4e1798[_0x86cd('0xa1')]['id']?_[_0x86cd('0x99')](_0x4e1798['where']['id'],_0x5e8963[_0x86cd('0x84')][_0x86cd('0xae')]):_0x5e8963[_0x86cd('0x84')][_0x86cd('0xae')];if(_0x5e8963[_0x86cd('0x84')][_0x86cd('0xaf')]){_0x4e1798['order']=_0x5e8963[_0x86cd('0x84')][_0x86cd('0xaf')];}}if(_0x5e8963[_0x86cd('0x84')][_0x86cd('0xb0')]){_0x4e1798[_0x86cd('0xa1')]=_[_0x86cd('0xa3')](_0x4e1798[_0x86cd('0xa1')],{'$and':_0x5e8963[_0x86cd('0x84')][_0x86cd('0xb0')]});}return _0x1e75dd[_0x3a3764[_0x86cd('0x11')]]['count']({'where':_0x4e1798['where']})[_0x86cd('0xd')](function(_0x322a46){_0xd2365[_0x86cd('0xac')]=_0x322a46;if(_0x5e8963[_0x86cd('0x84')][_0x86cd('0xa7')]){if(_0x3a3764[_0x86cd('0x11')]===_0x86cd('0xb1')){_0x4e1798[_0x86cd('0xa8')]=[{'model':_0x1e75dd[_0x86cd('0x6d')],'as':_0x86cd('0xb2'),'attributes':['id','name',_0x86cd('0xb3')],'required':_0x5e8963[_0x86cd('0x84')][_0x86cd('0xb4')]?!![]:![]},{'model':_0x1e75dd[_0x86cd('0x6d')],'as':_0x86cd('0xb5'),'attributes':['id',_0x86cd('0x17'),'color'],'through':_0x5e8963['query'][_0x86cd('0xb4')]?{'attributes':[],'where':{'TagId':_0x5e8963[_0x86cd('0x84')][_0x86cd('0xb4')]||undefined}}:{},'required':_0x5e8963[_0x86cd('0x84')][_0x86cd('0xb4')]?!![]:![]}];}else{_0x4e1798[_0x86cd('0xa8')]=[{'all':!![]}];}}return _0x1e75dd[_0x3a3764['childModel']][_0x86cd('0x6')](_0x4e1798);})['then'](function(_0x35e5ac){_0xd2365[_0x86cd('0xad')]=_0x35e5ac;if(_0x588909==='Agents'&&_0x5e8963['query'][_0x86cd('0xb6')]===_0x86cd('0xb7')){var _0x3723ca=[];for(var _0x1dbacc=0x0;_0x1dbacc<_0xd2365['rows'][_0x86cd('0x8f')];_0x1dbacc++){_0x3723ca['push'](_0x31909c(_0x86cd('0xb8'),_0xd2365[_0x86cd('0xad')][_0x1dbacc]['dataValues']));_0x3723ca[_0x86cd('0x90')](_0x31909c('sms',_0xd2365[_0x86cd('0xad')][_0x1dbacc][_0x86cd('0xb9')]));_0x3723ca[_0x86cd('0x90')](_0x31909c(_0x86cd('0xba'),_0xd2365[_0x86cd('0xad')][_0x1dbacc]['dataValues']));_0x3723ca[_0x86cd('0x90')](_0x31909c(_0x86cd('0xbb'),_0xd2365[_0x86cd('0xad')][_0x1dbacc][_0x86cd('0xb9')]));_0x3723ca[_0x86cd('0x90')](_0x31909c(_0x86cd('0xbc'),_0xd2365[_0x86cd('0xad')][_0x1dbacc][_0x86cd('0xb9')]));_0x3723ca[_0x86cd('0x90')](_0x31909c('whatsapp',_0xd2365[_0x86cd('0xad')][_0x1dbacc][_0x86cd('0xb9')]));}return Promise[_0x86cd('0x94')](_0x3723ca)[_0x86cd('0xd')](function(){return _0xd2365;});}return _0xd2365;});}});}}});}; \ No newline at end of file +var _0x8f47=['sequelize','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','union','push','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','pick','merge','key','foreignKey','forEach','options','autoAssociation','reportType','default','reportId','DefaultReports','custom','CustomReports','count','rows','ids','intersection','customSorting','extraQueryConditions','includeAll','include','color','tag','ThroughTags','openTabs','true','chat','sms','dataValues','openchannel','whatsapp','lodash','./userProfile.attributes','squel','models','filter','field','value','findAll','map','catch','model','then','name','resolve','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','Campaign','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','Schedule','tags','Tag','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','slice','Sequelize','SELECT','select','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?'];(function(_0x28e3bb,_0x370579){var _0x1f46b9=function(_0x143567){while(--_0x143567){_0x28e3bb['push'](_0x28e3bb['shift']());}};_0x1f46b9(++_0x370579);}(_0x8f47,0xf7));var _0x78f4=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0x8f47[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require(_0x78f4('0x0'));var attributes=require(_0x78f4('0x1'));var squel=require(_0x78f4('0x2'));module['exports']=function(_0x1b835b){var _0x49d293=_0x1b835b[_0x78f4('0x3')];function _0x253482(_0x5d7a75,_0x421473){return new Promise(function(_0x13a132,_0x65339a){if(!_0x421473)return _0x13a132(null);var _0x5563aa=_0x421473[_0x78f4('0x4')]?{[_0x421473['filter'][_0x78f4('0x5')]]:_0x421473[_0x78f4('0x4')][_0x78f4('0x6')]}:undefined;return _0x49d293[_0x5d7a75][_0x78f4('0x7')]({'where':_0x5563aa,'raw':!![]})['then'](function(_0x219911){_0x421473['associatedResources']=_[_0x78f4('0x8')](_0x219911,'id');_0x13a132(_0x421473);})[_0x78f4('0x9')](function(_0xe08519){_0x65339a(_0xe08519);});});}function _0x216117(_0x236d8c,_0x2fca14){return new Promise(function(_0x123faf,_0x1d9904){var _0xf3a59c=_0x236d8c['filter']?{[_0x236d8c[_0x78f4('0x4')][_0x78f4('0x5')]]:_0x236d8c[_0x78f4('0x4')]['value']}:undefined;return _0x49d293[_0x236d8c[_0x78f4('0xa')]][_0x78f4('0x7')]({'where':_0xf3a59c,'raw':!![]})[_0x78f4('0xb')](function(_0x3cc0fb){_0x2fca14['associatedResources']=_[_0x78f4('0x8')](_0x3cc0fb,function(_0x1e371a){return _0x1e371a[_0x78f4('0xc')];});_0x123faf(_0x2fca14);})[_0x78f4('0x9')](function(_0x3e84a1){_0x1d9904(_0x3e84a1);});});}function _0x114073(_0x93b48d,_0x5a2660,_0x2d4c17){if(!_0x5a2660)return Promise[_0x78f4('0xd')](null);return new Promise(function(_0x1807ac,_0x4a9bb6){return _0x49d293['UserProfileResource'][_0x78f4('0x7')]({'where':{'sectionId':_0x5a2660['id']},'raw':!![]})['then'](function(_0x2c84c1){if(_0x93b48d[_0x78f4('0x5')]&&_0x93b48d['field']!=='id'){_0x5a2660[_0x78f4('0xe')]=_['map'](_0x2c84c1,function(_0x3e1b4a){return _0x3e1b4a[_0x93b48d[_0x78f4('0x5')]];});}else{if(_0x2d4c17===_0x78f4('0xf')){_0x5a2660['associatedResources']=_[_0x78f4('0x8')](_0x2c84c1,function(_0x5c96c7){return{'id':_0x5c96c7[_0x78f4('0x10')],'type':_0x5c96c7[_0x78f4('0x11')]};});}else{_0x5a2660[_0x78f4('0xe')]=_['map'](_0x2c84c1,function(_0x459ece){return _0x459ece[_0x78f4('0x10')];});}}_0x1807ac(_0x5a2660);})[_0x78f4('0x9')](function(_0x15c2e9){_0x4a9bb6(_0x15c2e9);});});}function _0x43427d(_0x443831,_0x216243){var _0x46189c={'parentSections':[]};switch(_0x443831[_0x78f4('0x12')]()){case _0x78f4('0x13'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x15');break;case _0x78f4('0x16'):_0x46189c['childModel']=_0x78f4('0x17');break;case _0x78f4('0x18'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x19');_0x46189c[_0x78f4('0x1a')]=[{'name':_0x78f4('0x1b'),'field':_0x78f4('0xc'),'foreignKey':'projectName'}];break;case _0x78f4('0x1c'):_0x46189c['childModel']=_0x78f4('0x1d');break;case _0x78f4('0x1e'):_0x46189c[_0x78f4('0x14')]='CmContact';_0x46189c['parentSections']=[{'name':_0x78f4('0x1f'),'field':'id','foreignKey':_0x78f4('0x20')}];break;case _0x78f4('0x21'):_0x46189c[_0x78f4('0x14')]='CmList';break;case'companies':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x22');break;case'globalcustomfields':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x23');break;case _0x78f4('0x24'):_0x46189c['childModel']=_0x78f4('0x25');break;case'chatwebsites':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x26');break;case _0x78f4('0x27'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x28');break;case _0x78f4('0x29'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x2a');break;case _0x78f4('0x2b'):case'internalroutes':case _0x78f4('0x2c'):_0x46189c[_0x78f4('0x14')]='VoiceExtension';break;case _0x78f4('0x2d'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x2e');break;case'voicemails':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x2f');break;case _0x78f4('0x30'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x31');_0x46189c[_0x78f4('0x1a')]=[{'name':_0x78f4('0x32'),'field':'name','foreignKey':_0x78f4('0x33'),'model':_0x78f4('0x34'),'filter':{'field':_0x78f4('0x35'),'value':[_0x78f4('0x36')]}},{'name':_0x78f4('0x37'),'field':_0x78f4('0xc'),'foreignKey':_0x78f4('0x33'),'model':'User','filter':{'field':_0x78f4('0x35'),'value':[_0x78f4('0x38')]}},{'name':_0x78f4('0x39'),'field':_0x78f4('0xc'),'foreignKey':_0x78f4('0x3a'),'model':_0x78f4('0x3b'),'filter':{'field':_0x78f4('0x11'),'value':[_0x78f4('0x3c')]}},{'name':'QueueCampaigns','field':_0x78f4('0xc'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x78f4('0x11'),'value':[_0x78f4('0x3d')]}}];break;case _0x78f4('0x3e'):_0x46189c['childModel']=_0x78f4('0x3f');break;case'chanspies':_0x46189c[_0x78f4('0x14')]='VoiceChanSpy';break;case _0x78f4('0x40'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x41');break;case'ivrcampaigns':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x42');break;case'mailqueues':_0x46189c[_0x78f4('0x14')]='MailQueue';break;case _0x78f4('0x43'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x44');break;case _0x78f4('0x45'):_0x46189c['childModel']=_0x78f4('0x46');break;case _0x78f4('0x47'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x48');break;case'openchannelaccounts':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x49');break;case'smsqueues':_0x46189c[_0x78f4('0x14')]='SmsQueue';break;case _0x78f4('0x4a'):_0x46189c['childModel']=_0x78f4('0x4b');break;case'whatsappqueues':_0x46189c['childModel']=_0x78f4('0x4c');break;case _0x78f4('0x4d'):_0x46189c[_0x78f4('0x14')]='WhatsappAccount';break;case _0x78f4('0x4e'):_0x46189c['childModel']=_0x78f4('0x4f');break;case'voicequeues':case _0x78f4('0x50'):_0x46189c['childModel']=_0x78f4('0x3b');if(_0x216243){_0x46189c[_0x78f4('0x1a')]=[{'name':'VoiceQueues'},{'name':_0x78f4('0x51')}];}break;case _0x78f4('0x52'):case _0x78f4('0x53'):case _0x78f4('0x54'):_0x46189c[_0x78f4('0x14')]='User';if(_0x216243){_0x46189c[_0x78f4('0x1a')]=[{'name':_0x78f4('0x55'),'filter':{'field':_0x78f4('0x35'),'value':[_0x78f4('0x56'),_0x78f4('0x57')]},'ignore':!![]},{'name':_0x78f4('0x32')},{'name':'Telephones'}];}break;case _0x78f4('0x58'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x59');break;case _0x78f4('0x5a'):_0x46189c['childModel']='SalesforceAccount';break;case _0x78f4('0x5b'):_0x46189c[_0x78f4('0x14')]='FreshdeskAccount';break;case _0x78f4('0x5c'):_0x46189c[_0x78f4('0x14')]='SugarcrmAccount';break;case _0x78f4('0x5d'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x5e');break;case _0x78f4('0x5f'):_0x46189c['childModel']=_0x78f4('0x60');break;case _0x78f4('0x61'):_0x46189c['childModel']='User';break;case _0x78f4('0x62'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x63');break;case'dispositions':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x64');break;case _0x78f4('0x65'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x66');break;case _0x78f4('0x67'):_0x46189c[_0x78f4('0x14')]='Interval';break;case _0x78f4('0x68'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x69');break;case'scheduler':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x6a');break;case'sounds':_0x46189c['childModel']='Sound';break;case _0x78f4('0x6b'):_0x46189c['childModel']=_0x78f4('0x6c');break;case'templates':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x6d');break;case _0x78f4('0x6e'):_0x46189c['childModel']=_0x78f4('0x6f');break;case'trunks':_0x46189c[_0x78f4('0x14')]=_0x78f4('0x70');break;case _0x78f4('0x71'):_0x46189c['childModel']=_0x78f4('0x72');break;case _0x78f4('0x73'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0x74');break;case _0x78f4('0x75'):_0x46189c[_0x78f4('0x14')]=_0x78f4('0xf');_0x46189c[_0x78f4('0x1a')]=[{'name':_0x78f4('0x76'),'field':'id','foreignKey':'reportId'}];break;case _0x78f4('0x77'):_0x46189c[_0x78f4('0x14')]='AnalyticMetric';break;}return _0x46189c;}function _0x34a32c(_0x1f10f5,_0x5813ab){var _0x2d79e6=_0x1f10f5['charAt'](0x0)['toUpperCase']()+_0x1f10f5[_0x78f4('0x78')](0x1);var _0xa3f972={'type':_0x49d293[_0x78f4('0x79')]['QueryTypes'][_0x78f4('0x7a')],'raw':!![]};return new Promise(function(_0x16f994,_0x4368b9){var _0x471a96=squel[_0x78f4('0x7b')]()[_0x78f4('0x5')]('ui.'+_0x2d79e6+'InteractionId','id')[_0x78f4('0x5')](_0x78f4('0x7c'))[_0x78f4('0x7d')](_0x78f4('0x7e')+_0x1f10f5+'_interactions','ui')[_0x78f4('0x7f')](_0x78f4('0x80'),_0x5813ab['id']);return _0x49d293[_0x78f4('0x81')]['query'](_0x471a96[_0x78f4('0x82')](),_0xa3f972)[_0x78f4('0xb')](function(_0x4491ac){_0x5813ab[_0x2d79e6+_0x78f4('0x83')]=_0x4491ac;_0x16f994(_0x4491ac);})[_0x78f4('0x9')](function(_0x318687){_0x4368b9(_0x318687);});});}return _0x1b835b['define'](_0x78f4('0x84'),attributes,{'tableName':_0x78f4('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1c16a3){var _0x3fa5bf=require(_0x78f4('0x86'));var _0x3f4785={'raw':_0x1c16a3[_0x78f4('0x87')][_0x78f4('0x88')],'where':{}};var _0x15593d={};var _0x52f343={'count':0x0,'rows':[]};var _0x5d484b=_0x1c16a3[_0x78f4('0x87')][_0x78f4('0x89')];var _0x24d31e=_0x1c16a3[_0x78f4('0x87')][_0x78f4('0x8a')]||![];var _0x2fe03f=_0x43427d(_0x5d484b,_0x24d31e);if(!_0x2fe03f['childModel'])throw new Error(_0x78f4('0x8b')+_0x5d484b+'\x27');var _0x19fdce=[{'name':_0x5d484b}];if(!_[_0x78f4('0x8c')](_0x2fe03f[_0x78f4('0x1a')]))_0x19fdce=_0x2fe03f['parentSections'];var _0x245217=[];for(var _0x5651d0=0x0;_0x5651d0<_0x19fdce[_0x78f4('0x8d')];_0x5651d0++){_0x245217['push'](_0x49d293['UserProfileSection'][_0x78f4('0x8e')]({'where':{'userProfileId':_0x1c16a3[_0x78f4('0x8f')]['id'],'name':_0x19fdce[_0x5651d0][_0x78f4('0xc')]},'raw':!![]}));}return Promise[_0x78f4('0x90')](_0x245217)[_0x78f4('0xb')](function(_0x51dd51){var _0x4d5a59=_[_0x78f4('0x4')](_0x51dd51,function(_0x2a133b){return _0x2a133b?_0x2a133b:undefined;});var _0x2a8e0d=_['filter'](_0x19fdce,[_0x78f4('0x91'),!![]]);var _0x1e467f=_[_0x78f4('0x8c')](_0x4d5a59)&&_[_0x78f4('0x8c')](_0x2a8e0d)?null:_[_0x78f4('0x92')](_0x2a8e0d,_0x4d5a59);if(!_0x1e467f)return null;var _0x48ab7d=[];for(var _0x34d02a=0x0;_0x34d02a<_0x1e467f['length'];_0x34d02a++){var _0x5c57bc=_[_0x78f4('0x8e')](_0x19fdce,function(_0x171783){return _0x1e467f[_0x34d02a]?_0x171783[_0x78f4('0xc')]===_0x1e467f[_0x34d02a][_0x78f4('0xc')]:null;});if(_0x5c57bc){if(_0x1e467f[_0x34d02a][_0x78f4('0x91')]){_0x48ab7d[_0x78f4('0x93')](_0x253482(_0x2fe03f[_0x78f4('0x14')],_0x1e467f[_0x34d02a]));}else{if(!_0x1e467f[_0x34d02a]['autoAssociation']){_0x48ab7d[_0x78f4('0x93')](_0x114073(_0x5c57bc,_0x1e467f[_0x34d02a],_0x2fe03f[_0x78f4('0x14')]));}else{if(_0x5c57bc[_0x78f4('0xa')]){_0x48ab7d[_0x78f4('0x93')](_0x216117(_0x5c57bc,_0x1e467f[_0x34d02a]));}}}}}return Promise['all'](_0x48ab7d);})[_0x78f4('0xb')](function(_0x4e52f4){var _0x3a40bb=_0x4e52f4;var _0x26847d=null;if(_0x3a40bb){_0x26847d=_0x3a40bb[_0x78f4('0x8d')]===0x1?_0x3a40bb[0x0]:null;}if(!_0x26847d&&!_0x3a40bb)return _0x52f343;var _0xf48fbd=_0x49d293[_0x2fe03f[_0x78f4('0x14')]]['rawAttributes'];_0x15593d[_0x78f4('0xa')]=_[_0x78f4('0x94')](_0xf48fbd);_0x15593d[_0x78f4('0x87')]=_['keys'](_0x1c16a3[_0x78f4('0x87')]);_0x15593d[_0x78f4('0x95')]=_['intersection'](_0x15593d[_0x78f4('0xa')],_0x15593d['query']);_0x3f4785[_0x78f4('0x96')]=_['intersection'](_0x15593d[_0x78f4('0xa')],_0x3fa5bf['fields'](_0x1c16a3['query'][_0x78f4('0x97')]));_0x3f4785[_0x78f4('0x96')]=_0x3f4785['attributes'][_0x78f4('0x8d')]?_0x3f4785[_0x78f4('0x96')]:_0x15593d[_0x78f4('0xa')];if(!_0x1c16a3[_0x78f4('0x87')][_0x78f4('0x98')](_0x78f4('0x99'))){_0x3f4785['limit']=_0x3fa5bf[_0x78f4('0x9a')](_0x1c16a3[_0x78f4('0x87')][_0x78f4('0x9a')]);_0x3f4785[_0x78f4('0x9b')]=_0x3fa5bf['offset'](_0x1c16a3[_0x78f4('0x87')][_0x78f4('0x9b')]);}_0x3f4785[_0x78f4('0x9c')]=_0x3fa5bf['sort'](_0x1c16a3[_0x78f4('0x87')]['sort']);_0x3f4785[_0x78f4('0x7f')]=_0x3fa5bf[_0x78f4('0x95')](_[_0x78f4('0x9d')](_0x1c16a3[_0x78f4('0x87')],_0x15593d[_0x78f4('0x95')]));if(_0x1c16a3[_0x78f4('0x87')][_0x78f4('0x4')]){_0x3f4785['where']=_[_0x78f4('0x9e')](_0x3f4785[_0x78f4('0x7f')],{'$or':_[_0x78f4('0x8')](_0xf48fbd,function(_0x2f1b09){if(_0x2f1b09[_0x78f4('0x11')][_0x78f4('0x9f')]!=='VIRTUAL'){var _0x444b80={};_0x444b80[_0x2f1b09[_0x78f4('0x5')]]={'$like':'%'+_0x1c16a3[_0x78f4('0x87')][_0x78f4('0x4')]+'%'};return _0x444b80;}})});}var _0x564f6d=[];var _0x12a4db=null;var _0x2ab87b={};if(_0x26847d){_0x12a4db=_[_0x78f4('0x8e')](_0x19fdce,[_0x78f4('0xc'),_0x26847d['name']]);if(_0x12a4db[_0x78f4('0x5')]){_0x2ab87b={};if(_0x2fe03f[_0x78f4('0x14')]==='AnalyticExtractedReport'){_0x2ab87b[_0x12a4db[_0x78f4('0xa0')]]=_['map'](_0x26847d['associatedResources'],'id');}else{_0x2ab87b[_0x12a4db['foreignKey']]=_0x26847d['associatedResources'];}_0x564f6d[_0x78f4('0x93')](_0x2ab87b);}else{_0x3f4785[_0x78f4('0x7f')]['id']=_0x26847d[_0x78f4('0xe')];}}else{for(var _0x28a733=0x0;_0x28a733<_0x3a40bb[_0x78f4('0x8d')];_0x28a733++){_0x12a4db=_[_0x78f4('0x8e')](_0x19fdce,['name',_0x3a40bb[_0x28a733][_0x78f4('0xc')]]);if(_0x12a4db[_0x78f4('0x5')]){_0x2ab87b={};_0x2ab87b[_0x12a4db[_0x78f4('0xa0')]]=_0x3a40bb[_0x28a733]['associatedResources'];_0x564f6d[_0x78f4('0x93')](_0x2ab87b);}else{if(!_0x3f4785[_0x78f4('0x7f')]['id'])_0x3f4785[_0x78f4('0x7f')]['id']=[];_0x3a40bb[_0x28a733][_0x78f4('0xe')][_0x78f4('0xa1')](function(_0x3b0f58){_0x3f4785[_0x78f4('0x7f')]['id'][_0x78f4('0x93')](_0x3b0f58);});}}}if(!_[_0x78f4('0x8c')](_0x564f6d)){_0x3f4785[_0x78f4('0x7f')]=_[_0x78f4('0x9e')](_0x3f4785['where'],{'$and':{'$or':_0x564f6d}});}_0x3f4785=_['merge']({},_0x3f4785,_0x1c16a3[_0x78f4('0xa2')]);if(_0x26847d&&!_0x26847d[_0x78f4('0xa3')]&&_0x2fe03f[_0x78f4('0x14')]===_0x78f4('0xf')){if(_0x1c16a3[_0x78f4('0x87')]['includeAll']){_0x3f4785['include']=[{'all':!![]}];}return _0x49d293[_0x2fe03f[_0x78f4('0x14')]][_0x78f4('0x7')](_0x3f4785)['then'](function(_0x5bfaec){var _0xa5af42=[];_0x5bfaec[_0x78f4('0xa1')](function(_0xbbfeb3){var _0x59787f;switch(_0xbbfeb3[_0x78f4('0xa4')]){case _0x78f4('0xa5'):_0x59787f=_[_0x78f4('0x8e')](_0x26847d[_0x78f4('0xe')],function(_0x4cb139){return _0x4cb139['id']===_0xbbfeb3[_0x78f4('0xa6')]&&_0x4cb139[_0x78f4('0x11')]===_0x78f4('0xa7');});break;case _0x78f4('0xa8'):_0x59787f=_['find'](_0x26847d[_0x78f4('0xe')],function(_0x341436){return _0x341436['id']===_0xbbfeb3[_0x78f4('0xa6')]&&_0x341436[_0x78f4('0x11')]===_0x78f4('0xa9');});break;}if(_0x59787f)_0xa5af42['push'](_0xbbfeb3);});_0x52f343[_0x78f4('0xaa')]=_0xa5af42['length'];_0x52f343[_0x78f4('0xab')]=_0xa5af42;return _0x52f343;});}else{if(!_[_0x78f4('0x8c')](_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xac')])){_0x3f4785['where']['id']=_0x3f4785[_0x78f4('0x7f')]['id']?_[_0x78f4('0xad')](_0x3f4785[_0x78f4('0x7f')]['id'],_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xac')]):_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xac')];if(_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xae')]){_0x3f4785[_0x78f4('0x9c')]=_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xae')];}}if(_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xaf')]){_0x3f4785[_0x78f4('0x7f')]=_[_0x78f4('0x9e')](_0x3f4785[_0x78f4('0x7f')],{'$and':_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xaf')]});}return _0x49d293[_0x2fe03f[_0x78f4('0x14')]][_0x78f4('0xaa')]({'where':_0x3f4785[_0x78f4('0x7f')]})[_0x78f4('0xb')](function(_0x428e87){_0x52f343[_0x78f4('0xaa')]=_0x428e87;if(_0x1c16a3['query'][_0x78f4('0xb0')]){if(_0x2fe03f[_0x78f4('0x14')]==='CmContact'){_0x3f4785[_0x78f4('0xb1')]=[{'model':_0x49d293[_0x78f4('0x6c')],'as':'Tags','attributes':['id','name',_0x78f4('0xb2')],'required':_0x1c16a3['query'][_0x78f4('0xb3')]?!![]:![]},{'model':_0x49d293[_0x78f4('0x6c')],'as':_0x78f4('0xb4'),'attributes':['id',_0x78f4('0xc'),_0x78f4('0xb2')],'through':_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xb3')]?{'attributes':[],'where':{'TagId':_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xb3')]||undefined}}:{},'required':_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xb3')]?!![]:![]}];}else{_0x3f4785[_0x78f4('0xb1')]=[{'all':!![]}];}}return _0x49d293[_0x2fe03f['childModel']][_0x78f4('0x7')](_0x3f4785);})['then'](function(_0x33331c){_0x52f343[_0x78f4('0xab')]=_0x33331c;if(_0x5d484b==='Agents'&&_0x1c16a3[_0x78f4('0x87')][_0x78f4('0xb5')]===_0x78f4('0xb6')){var _0x4397e9=[];for(var _0x4d13a4=0x0;_0x4d13a4<_0x52f343[_0x78f4('0xab')][_0x78f4('0x8d')];_0x4d13a4++){_0x4397e9['push'](_0x34a32c(_0x78f4('0xb7'),_0x52f343['rows'][_0x4d13a4]['dataValues']));_0x4397e9['push'](_0x34a32c(_0x78f4('0xb8'),_0x52f343[_0x78f4('0xab')][_0x4d13a4][_0x78f4('0xb9')]));_0x4397e9['push'](_0x34a32c('fax',_0x52f343[_0x78f4('0xab')][_0x4d13a4][_0x78f4('0xb9')]));_0x4397e9[_0x78f4('0x93')](_0x34a32c('mail',_0x52f343['rows'][_0x4d13a4][_0x78f4('0xb9')]));_0x4397e9[_0x78f4('0x93')](_0x34a32c(_0x78f4('0xba'),_0x52f343[_0x78f4('0xab')][_0x4d13a4][_0x78f4('0xb9')]));_0x4397e9[_0x78f4('0x93')](_0x34a32c(_0x78f4('0xbb'),_0x52f343[_0x78f4('0xab')][_0x4d13a4][_0x78f4('0xb9')]));}return Promise[_0x78f4('0x90')](_0x4397e9)['then'](function(){return _0x52f343;});}return _0x52f343;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 53611e9..dc20cf1 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 _0x8212=['UserProfile,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x320f49,_0x3a28d9){var _0x5c5e1a=function(_0x2398ca){while(--_0x2398ca){_0x320f49['push'](_0x320f49['shift']());}};_0x5c5e1a(++_0x3a28d9);}(_0x8212,0xb3));var _0x2821=function(_0x4f0317,_0xb2e5a1){_0x4f0317=_0x4f0317-0x0;var _0x4e24e3=_0x8212[_0x4f0317];return _0x4e24e3;};'use strict';var _=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var moment=require('moment');var BPromise=require(_0x2821('0x2'));var rs=require(_0x2821('0x3'));var fs=require('fs');var Redis=require(_0x2821('0x4'));var db=require(_0x2821('0x5'))['db'];var utils=require(_0x2821('0x6'));var logger=require(_0x2821('0x7'))(_0x2821('0x8'));var config=require(_0x2821('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2821('0xa')]['http']({'port':0x232a});config[_0x2821('0xb')]=_[_0x2821('0xc')](config['redis'],{'host':_0x2821('0xd'),'port':0x18eb});var socket=require(_0x2821('0xe'))(new Redis(config[_0x2821('0xb')]));require(_0x2821('0xf'))[_0x2821('0x10')](socket);function respondWithRpcPromise(_0x17d352,_0x258b64,_0x1a6eb6){return new BPromise(function(_0x379eee,_0x4aa28d){return client[_0x2821('0x11')](_0x17d352,_0x1a6eb6)[_0x2821('0x12')](function(_0x7c120a){logger['info']('UserProfile,\x20%s,\x20%s',_0x258b64,'request\x20sent');logger['debug'](_0x2821('0x13'),_0x258b64,_0x2821('0x14'),JSON[_0x2821('0x15')](_0x7c120a));if(_0x7c120a[_0x2821('0x16')]){if(_0x7c120a[_0x2821('0x16')][_0x2821('0x17')]===0x1f4){logger['error'](_0x2821('0x18'),_0x258b64,_0x7c120a['error']['message']);return _0x4aa28d(_0x7c120a[_0x2821('0x16')][_0x2821('0x19')]);}logger[_0x2821('0x16')](_0x2821('0x18'),_0x258b64,_0x7c120a['error'][_0x2821('0x19')]);return _0x379eee(_0x7c120a['error'][_0x2821('0x19')]);}else{logger[_0x2821('0x1a')](_0x2821('0x18'),_0x258b64,_0x2821('0x14'));_0x379eee(_0x7c120a[_0x2821('0x1b')][_0x2821('0x19')]);}})[_0x2821('0x1c')](function(_0x1a7966){logger['error'](_0x2821('0x18'),_0x258b64,_0x1a7966);_0x4aa28d(_0x1a7966);});});} \ No newline at end of file +var _0x5ae0=['randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment'];(function(_0x1d5b20,_0x1399de){var _0x3beec0=function(_0x34ed07){while(--_0x34ed07){_0x1d5b20['push'](_0x1d5b20['shift']());}};_0x3beec0(++_0x1399de);}(_0x5ae0,0xf8));var _0x05ae=function(_0x37aba7,_0x1c7ed0){_0x37aba7=_0x37aba7-0x0;var _0x48fa69=_0x5ae0[_0x37aba7];return _0x48fa69;};'use strict';var _=require('lodash');var util=require(_0x05ae('0x0'));var moment=require(_0x05ae('0x1'));var BPromise=require('bluebird');var rs=require(_0x05ae('0x2'));var fs=require('fs');var Redis=require(_0x05ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x05ae('0x4'));var logger=require(_0x05ae('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x05ae('0x6'));var client=jayson[_0x05ae('0x7')][_0x05ae('0x8')]({'port':0x232a});config['redis']=_[_0x05ae('0x9')](config[_0x05ae('0xa')],{'host':_0x05ae('0xb'),'port':0x18eb});var socket=require(_0x05ae('0xc'))(new Redis(config[_0x05ae('0xa')]));require(_0x05ae('0xd'))[_0x05ae('0xe')](socket);function respondWithRpcPromise(_0x42169a,_0x40d1bf,_0x272094){return new BPromise(function(_0x3e0498,_0x1629c0){return client[_0x05ae('0xf')](_0x42169a,_0x272094)[_0x05ae('0x10')](function(_0xb5944b){logger[_0x05ae('0x11')](_0x05ae('0x12'),_0x40d1bf,_0x05ae('0x13'));logger[_0x05ae('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x40d1bf,'request\x20sent',JSON['stringify'](_0xb5944b));if(_0xb5944b['error']){if(_0xb5944b[_0x05ae('0x15')][_0x05ae('0x16')]===0x1f4){logger[_0x05ae('0x15')](_0x05ae('0x12'),_0x40d1bf,_0xb5944b[_0x05ae('0x15')][_0x05ae('0x17')]);return _0x1629c0(_0xb5944b[_0x05ae('0x15')][_0x05ae('0x17')]);}logger[_0x05ae('0x15')]('UserProfile,\x20%s,\x20%s',_0x40d1bf,_0xb5944b[_0x05ae('0x15')][_0x05ae('0x17')]);return _0x3e0498(_0xb5944b[_0x05ae('0x15')][_0x05ae('0x17')]);}else{logger[_0x05ae('0x11')](_0x05ae('0x12'),_0x40d1bf,_0x05ae('0x13'));_0x3e0498(_0xb5944b[_0x05ae('0x18')][_0x05ae('0x17')]);}})['catch'](function(_0x1bfea0){logger[_0x05ae('0x15')]('UserProfile,\x20%s,\x20%s',_0x40d1bf,_0x1bfea0);_0x1629c0(_0x1bfea0);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 7c7c28a..efc920e 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 _0x09d3=['register','length','./userProfile.events','remove','update','emit','removeListener'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x09d3,0xf0));var _0x309d=function(_0x3b0fad,_0x28af06){_0x3b0fad=_0x3b0fad-0x0;var _0x4d1910=_0x09d3[_0x3b0fad];return _0x4d1910;};'use strict';var UserProfileEvents=require(_0x309d('0x0'));var events=['save',_0x309d('0x1'),_0x309d('0x2')];function createListener(_0x986391,_0x392efb){return function(_0x426c42){_0x392efb[_0x309d('0x3')](_0x986391,_0x426c42);};}function removeListener(_0x12844a,_0x40f631){return function(){UserProfileEvents[_0x309d('0x4')](_0x12844a,_0x40f631);};}exports[_0x309d('0x5')]=function(_0x18d38c){for(var _0x3ce372=0x0,_0x22d949=events[_0x309d('0x6')];_0x3ce372<_0x22d949;_0x3ce372++){var _0x4a920d=events[_0x3ce372];var _0x3e557a=createListener('userProfile:'+_0x4a920d,_0x18d38c);UserProfileEvents['on'](_0x4a920d,_0x3e557a);}}; \ No newline at end of file +var _0x880a=['length','userProfile:','save','remove','update','removeListener','register'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x880a,0x1bb));var _0xa880=function(_0x2bfb02,_0x4d80d7){_0x2bfb02=_0x2bfb02-0x0;var _0x75eabf=_0x880a[_0x2bfb02];return _0x75eabf;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xa880('0x0'),_0xa880('0x1'),_0xa880('0x2')];function createListener(_0x3343e0,_0x1ee422){return function(_0x6d2c40){_0x1ee422['emit'](_0x3343e0,_0x6d2c40);};}function removeListener(_0x1d1ba9,_0x444cd6){return function(){UserProfileEvents[_0xa880('0x3')](_0x1d1ba9,_0x444cd6);};}exports[_0xa880('0x4')]=function(_0x11e22f){for(var _0x3eefdf=0x0,_0x5ea89e=events[_0xa880('0x5')];_0x3eefdf<_0x5ea89e;_0x3eefdf++){var _0xd65416=events[_0x3eefdf];var _0x2a4495=createListener(_0xa880('0x6')+_0xd65416,_0x11e22f);UserProfileEvents['on'](_0xd65416,_0x2a4495);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d1c1a8a..8d58a61 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 _0xeff6=['/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index'];(function(_0x3bf780,_0x38917d){var _0x145df2=function(_0x1caaf9){while(--_0x1caaf9){_0x3bf780['push'](_0x3bf780['shift']());}};_0x145df2(++_0x38917d);}(_0xeff6,0x114));var _0x6eff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeff6[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x6eff('0x0'));var path=require(_0x6eff('0x1'));var timeout=require(_0x6eff('0x2'));var express=require('express');var router=express[_0x6eff('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6eff('0x4'));var config=require('../../config/environment');var controller=require(_0x6eff('0x5'));router[_0x6eff('0x6')]('/',auth[_0x6eff('0x7')](),controller[_0x6eff('0x8')]);router[_0x6eff('0x6')](_0x6eff('0x9'),auth[_0x6eff('0x7')](),controller[_0x6eff('0xa')]);router[_0x6eff('0x6')](_0x6eff('0xb'),auth['isAuthenticated'](),controller[_0x6eff('0xc')]);router[_0x6eff('0xd')]('/',auth[_0x6eff('0x7')](),controller[_0x6eff('0xe')]);router[_0x6eff('0xf')](_0x6eff('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6eff('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6eff('0x11')]);module[_0x6eff('0x12')]=router; \ No newline at end of file +var _0x70e1=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','./userProfileResource.controller','get','isAuthenticated','/describe','/:id'];(function(_0x255e53,_0x5df37c){var _0x2967d8=function(_0x28dbd1){while(--_0x28dbd1){_0x255e53['push'](_0x255e53['shift']());}};_0x2967d8(++_0x5df37c);}(_0x70e1,0x111));var _0x170e=function(_0x4a0066,_0x16fb7e){_0x4a0066=_0x4a0066-0x0;var _0x611761=_0x70e1[_0x4a0066];return _0x611761;};'use strict';var multer=require(_0x170e('0x0'));var util=require(_0x170e('0x1'));var path=require(_0x170e('0x2'));var timeout=require(_0x170e('0x3'));var express=require(_0x170e('0x4'));var router=express[_0x170e('0x5')]();var fs_extra=require(_0x170e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x170e('0x7'));router[_0x170e('0x8')]('/',auth[_0x170e('0x9')](),controller['index']);router['get'](_0x170e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x170e('0x8')](_0x170e('0xb'),auth['isAuthenticated'](),controller[_0x170e('0xc')]);router[_0x170e('0xd')]('/',auth[_0x170e('0x9')](),controller[_0x170e('0xe')]);router[_0x170e('0xf')]('/:id',auth[_0x170e('0x9')](),controller[_0x170e('0x10')]);router[_0x170e('0x11')](_0x170e('0xb'),auth[_0x170e('0x9')](),controller[_0x170e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index eaeaf41..047a789 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 _0x50c2=['INTEGER','sequelize','STRING'];(function(_0x169e1c,_0x2bb938){var _0x2ebf75=function(_0x428a79){while(--_0x428a79){_0x169e1c['push'](_0x169e1c['shift']());}};_0x2ebf75(++_0x2bb938);}(_0x50c2,0x1db));var _0x250c=function(_0x49b193,_0x2abf8b){_0x49b193=_0x49b193-0x0;var _0x20691b=_0x50c2[_0x49b193];return _0x20691b;};'use strict';var Sequelize=require(_0x250c('0x0'));module['exports']={'name':{'type':Sequelize[_0x250c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x250c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x250c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8455=['exports','STRING','INTEGER'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0x8455,0x69));var _0x5845=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8455[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x5845('0x0')]={'name':{'type':Sequelize[_0x5845('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5845('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5845('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7cbf960..5f16e55 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 _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','UserProfileResource','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x896e,0x1e9));var _0xe896=function(_0x110eca,_0x3c3808){_0x110eca=_0x110eca-0x0;var _0xd6908e=_0x896e[_0x110eca];return _0xd6908e;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['UserProfileResource'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['UserProfileResource'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file +var _0x33af=['findAll','rows','catch','show','params','length','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0x457c42,_0x64c1d){var _0xb04c71=function(_0x34d453){while(--_0x34d453){_0x457c42['push'](_0x457c42['shift']());}};_0xb04c71(++_0x64c1d);}(_0x33af,0xec));var _0xf33a=function(_0x28fd11,_0xb7b5ca){_0x28fd11=_0x28fd11-0x0;var _0x51caa0=_0x33af[_0x28fd11];return _0x51caa0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['UserProfileResource'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));};exports[_0xf33a('0x4a')]=function(_0xd40707,_0x36cba8){return db['UserProfileResource'][_0xf33a('0x4a')]()[_0xf33a('0x26')](respondWithResult(_0x36cba8,null))[_0xf33a('0x42')](handleError(_0x36cba8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 338e42c..b5cbcab 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 _0x46ed=['compositeIndex','resourceId','lodash','util','api','bluebird','request-promise','rimraf','exports','define','UserProfileResource'];(function(_0x2eff62,_0x1fcf11){var _0x4d10bb=function(_0x5b2a91){while(--_0x5b2a91){_0x2eff62['push'](_0x2eff62['shift']());}};_0x4d10bb(++_0x1fcf11);}(_0x46ed,0xb2));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require('moment');var BPromise=require(_0xd46e('0x3'));var rp=require(_0xd46e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd46e('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xd46e('0x6')]=function(_0xab6549,_0xea9205){return _0xab6549[_0xd46e('0x7')](_0xd46e('0x8'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xd46e('0x9'),'fields':[_0xd46e('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fdb=['bluebird','request-promise','path','rimraf','../../config/environment','define','UserProfileResource','user_profile_has_resources','compositeIndex','lodash','util','../../config/logger','api'];(function(_0x15a363,_0x1a84a2){var _0x95b1c4=function(_0x11a81f){while(--_0x11a81f){_0x15a363['push'](_0x15a363['shift']());}};_0x95b1c4(++_0x1a84a2);}(_0x5fdb,0x98));var _0xb5fd=function(_0x1b4974,_0x39a6d0){_0x1b4974=_0x1b4974-0x0;var _0x248368=_0x5fdb[_0x1b4974];return _0x248368;};'use strict';var _=require(_0xb5fd('0x0'));var util=require(_0xb5fd('0x1'));var logger=require(_0xb5fd('0x2'))(_0xb5fd('0x3'));var moment=require('moment');var BPromise=require(_0xb5fd('0x4'));var rp=require(_0xb5fd('0x5'));var fs=require('fs');var path=require(_0xb5fd('0x6'));var rimraf=require(_0xb5fd('0x7'));var config=require(_0xb5fd('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x59ac1d,_0x2adc41){return _0x59ac1d[_0xb5fd('0x9')](_0xb5fd('0xa'),attributes,{'tableName':_0xb5fd('0xb'),'paranoid':![],'indexes':[{'name':_0xb5fd('0xc'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d37aeef..5441cbd 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 _0x8752=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0x8752,0x110));var _0x2875=function(_0x542136,_0x174911){_0x542136=_0x542136-0x0;var _0x5ef27f=_0x8752[_0x542136];return _0x5ef27f;};'use strict';var _=require(_0x2875('0x0'));var util=require(_0x2875('0x1'));var moment=require(_0x2875('0x2'));var BPromise=require(_0x2875('0x3'));var rs=require(_0x2875('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2875('0x5'))['db'];var utils=require(_0x2875('0x6'));var logger=require(_0x2875('0x7'))('rpc');var config=require(_0x2875('0x8'));var jayson=require(_0x2875('0x9'));var client=jayson[_0x2875('0xa')][_0x2875('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49467,_0x65f25d,_0x7f6c47){return new BPromise(function(_0xf011d3,_0x3f468c){return client[_0x2875('0xc')](_0x49467,_0x7f6c47)['then'](function(_0x249bf4){logger[_0x2875('0xd')](_0x2875('0xe'),_0x65f25d,_0x2875('0xf'));logger['debug'](_0x2875('0x10'),_0x65f25d,_0x2875('0xf'),JSON[_0x2875('0x11')](_0x249bf4));if(_0x249bf4[_0x2875('0x12')]){if(_0x249bf4['error'][_0x2875('0x13')]===0x1f4){logger[_0x2875('0x12')](_0x2875('0xe'),_0x65f25d,_0x249bf4[_0x2875('0x12')][_0x2875('0x14')]);return _0x3f468c(_0x249bf4[_0x2875('0x12')][_0x2875('0x14')]);}logger[_0x2875('0x12')](_0x2875('0xe'),_0x65f25d,_0x249bf4[_0x2875('0x12')][_0x2875('0x14')]);return _0xf011d3(_0x249bf4[_0x2875('0x12')]['message']);}else{logger['info'](_0x2875('0xe'),_0x65f25d,_0x2875('0xf'));_0xf011d3(_0x249bf4[_0x2875('0x15')][_0x2875('0x14')]);}})[_0x2875('0x16')](function(_0xb00779){logger[_0x2875('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x65f25d,_0xb00779);_0x3f468c(_0xb00779);});});} \ No newline at end of file +var _0x7a9f=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x400322,_0x4353a8){var _0xfdd597=function(_0xd914b6){while(--_0xd914b6){_0x400322['push'](_0x400322['shift']());}};_0xfdd597(++_0x4353a8);}(_0x7a9f,0xb1));var _0xf7a9=function(_0x5e26b2,_0x43ec01){_0x5e26b2=_0x5e26b2-0x0;var _0x3d1de2=_0x7a9f[_0x5e26b2];return _0x3d1de2;};'use strict';var _=require('lodash');var util=require(_0xf7a9('0x0'));var moment=require(_0xf7a9('0x1'));var BPromise=require(_0xf7a9('0x2'));var rs=require(_0xf7a9('0x3'));var fs=require('fs');var Redis=require(_0xf7a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf7a9('0x5'))(_0xf7a9('0x6'));var config=require(_0xf7a9('0x7'));var jayson=require(_0xf7a9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4022df,_0x20b982,_0x4111b7){return new BPromise(function(_0x2c9ce0,_0x3dff10){return client[_0xf7a9('0x9')](_0x4022df,_0x4111b7)[_0xf7a9('0xa')](function(_0x527b31){logger[_0xf7a9('0xb')](_0xf7a9('0xc'),_0x20b982,_0xf7a9('0xd'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x20b982,_0xf7a9('0xd'),JSON[_0xf7a9('0xe')](_0x527b31));if(_0x527b31[_0xf7a9('0xf')]){if(_0x527b31[_0xf7a9('0xf')][_0xf7a9('0x10')]===0x1f4){logger[_0xf7a9('0xf')](_0xf7a9('0xc'),_0x20b982,_0x527b31[_0xf7a9('0xf')][_0xf7a9('0x11')]);return _0x3dff10(_0x527b31[_0xf7a9('0xf')]['message']);}logger[_0xf7a9('0xf')](_0xf7a9('0xc'),_0x20b982,_0x527b31[_0xf7a9('0xf')][_0xf7a9('0x11')]);return _0x2c9ce0(_0x527b31['error']['message']);}else{logger['info'](_0xf7a9('0xc'),_0x20b982,_0xf7a9('0xd'));_0x2c9ce0(_0x527b31[_0xf7a9('0x12')][_0xf7a9('0x11')]);}})[_0xf7a9('0x13')](function(_0x2569e2){logger[_0xf7a9('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x20b982,_0x2569e2);_0x3dff10(_0x2569e2);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7462ee9..6b195c1 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 _0x5f70=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x1f4bc5,_0x37a7d0){var _0x37b0bf=function(_0x310adc){while(--_0x310adc){_0x1f4bc5['push'](_0x1f4bc5['shift']());}};_0x37b0bf(++_0x37a7d0);}(_0x5f70,0x162));var _0x05f7=function(_0x483d53,_0x4ef42d){_0x483d53=_0x483d53-0x0;var _0x1a3e8d=_0x5f70[_0x483d53];return _0x1a3e8d;};'use strict';var multer=require(_0x05f7('0x0'));var util=require(_0x05f7('0x1'));var path=require(_0x05f7('0x2'));var timeout=require(_0x05f7('0x3'));var express=require(_0x05f7('0x4'));var router=express['Router']();var fs_extra=require(_0x05f7('0x5'));var auth=require(_0x05f7('0x6'));var interaction=require(_0x05f7('0x7'));var config=require(_0x05f7('0x8'));var controller=require('./userProfileSection.controller');router[_0x05f7('0x9')]('/',auth[_0x05f7('0xa')](),controller[_0x05f7('0xb')]);router['get'](_0x05f7('0xc'),auth[_0x05f7('0xa')](),controller[_0x05f7('0xd')]);router[_0x05f7('0x9')](_0x05f7('0xe'),auth['isAuthenticated'](),controller[_0x05f7('0xf')]);router[_0x05f7('0x10')]('/',auth['isAuthenticated'](),controller[_0x05f7('0x11')]);router[_0x05f7('0x12')](_0x05f7('0xe'),auth[_0x05f7('0xa')](),controller['update']);router['delete'](_0x05f7('0xe'),auth[_0x05f7('0xa')](),controller[_0x05f7('0x13')]);module[_0x05f7('0x14')]=router; \ No newline at end of file +var _0x1932=['update','delete','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','post','create'];(function(_0x27deda,_0x300d08){var _0x29c0eb=function(_0x2d9a77){while(--_0x2d9a77){_0x27deda['push'](_0x27deda['shift']());}};_0x29c0eb(++_0x300d08);}(_0x1932,0x121));var _0x2193=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x1932[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x2193('0x0'));var util=require(_0x2193('0x1'));var path=require(_0x2193('0x2'));var timeout=require(_0x2193('0x3'));var express=require('express');var router=express[_0x2193('0x4')]();var fs_extra=require(_0x2193('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2193('0x6'));var controller=require(_0x2193('0x7'));router[_0x2193('0x8')]('/',auth['isAuthenticated'](),controller[_0x2193('0x9')]);router[_0x2193('0x8')](_0x2193('0xa'),auth[_0x2193('0xb')](),controller[_0x2193('0xc')]);router[_0x2193('0x8')]('/:id',auth[_0x2193('0xb')](),controller['show']);router[_0x2193('0xd')]('/',auth['isAuthenticated'](),controller[_0x2193('0xe')]);router['put']('/:id',auth[_0x2193('0xb')](),controller[_0x2193('0xf')]);router[_0x2193('0x10')](_0x2193('0x11'),auth[_0x2193('0xb')](),controller['destroy']);module[_0x2193('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 4c31ac4..1ccea17 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 _0x5b12=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions'];(function(_0x159c62,_0x1a8d5b){var _0x275cbe=function(_0x4f0629){while(--_0x4f0629){_0x159c62['push'](_0x159c62['shift']());}};_0x275cbe(++_0x1a8d5b);}(_0x5b12,0xa3));var _0x25b1=function(_0x448f56,_0x36a3a7){_0x448f56=_0x448f56-0x0;var _0x4c26cf=_0x5b12[_0x448f56];return _0x4c26cf;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x25b1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x25b1('0x2')],'set':function(_0x47995b){this[_0x25b1('0x5')]('crudPermissions',_0x47995b?_0x47995b['join'](''):[]);},'get':function(){return this[_0x25b1('0x6')]('crudPermissions')?this['getDataValue'](_0x25b1('0x7'))[_0x25b1('0x8')](''):[];}}}; \ No newline at end of file +var _0xb9be=['exports','STRING','INTEGER','BOOLEAN','join','getDataValue','crudPermissions','split','sequelize'];(function(_0x2f9527,_0x5b56bc){var _0x1b0e25=function(_0x3c21db){while(--_0x3c21db){_0x2f9527['push'](_0x2f9527['shift']());}};_0x1b0e25(++_0x5b56bc);}(_0xb9be,0xc5));var _0xeb9b=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0xb9be[_0x1b1a3b];return _0x385347;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'name':{'type':Sequelize[_0xeb9b('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb9b('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb9b('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb9b('0x2')],'set':function(_0x288aaa){this['setDataValue']('crudPermissions',_0x288aaa?_0x288aaa[_0xeb9b('0x5')](''):[]);},'get':function(){return this[_0xeb9b('0x6')](_0xeb9b('0x7'))?this['getDataValue'](_0xeb9b('0x7'))[_0xeb9b('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 7ea4e06..e2d49e4 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 _0xb703=['filter','merge','options','includeAll','include','rows','catch','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x5b174b,_0x404869){var _0x47ee37=function(_0x467947){while(--_0x467947){_0x5b174b['push'](_0x5b174b['shift']());}};_0x47ee37(++_0x404869);}(_0xb703,0x1b6));var _0x3b70=function(_0x430b16,_0x23f619){_0x430b16=_0x430b16-0x0;var _0x1abfdf=_0xb703[_0x430b16];return _0x1abfdf;};'use strict';var emlformat=require(_0x3b70('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b70('0x1'));var rp=require(_0x3b70('0x2'));var moment=require(_0x3b70('0x3'));var BPromise=require(_0x3b70('0x4'));var Mustache=require(_0x3b70('0x5'));var util=require(_0x3b70('0x6'));var path=require('path');var sox=require(_0x3b70('0x7'));var csv=require('to-csv');var ejs=require(_0x3b70('0x8'));var fs=require('fs');var fs_extra=require(_0x3b70('0x9'));var _=require(_0x3b70('0xa'));var squel=require(_0x3b70('0xb'));var crypto=require(_0x3b70('0xc'));var jsforce=require(_0x3b70('0xd'));var deskjs=require(_0x3b70('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3b70('0xf'));var Papa=require(_0x3b70('0x10'));var Redis=require('ioredis');var authService=require(_0x3b70('0x11'));var qs=require(_0x3b70('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b70('0x13'));var logger=require('../../config/logger')(_0x3b70('0x14'));var utils=require(_0x3b70('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b70('0x16'))['db'];function respondWithStatusCode(_0x4e03d4,_0x3ab1b0){_0x3ab1b0=_0x3ab1b0||0xcc;return function(_0x4078f7){if(_0x4078f7){return _0x4e03d4[_0x3b70('0x17')](_0x3ab1b0);}return _0x4e03d4[_0x3b70('0x18')](_0x3ab1b0)[_0x3b70('0x19')]();};}function respondWithResult(_0x4b74cb,_0x7fd234){_0x7fd234=_0x7fd234||0xc8;return function(_0x19ee47){if(_0x19ee47){return _0x4b74cb[_0x3b70('0x18')](_0x7fd234)[_0x3b70('0x1a')](_0x19ee47);}};}function respondWithFilteredResult(_0x2d4659,_0x265840){return function(_0x2c0351){if(_0x2c0351){var _0x357d33=typeof _0x265840['offset']===_0x3b70('0x1b')&&typeof _0x265840[_0x3b70('0x1c')]===_0x3b70('0x1b');var _0x4751ef=_0x2c0351[_0x3b70('0x1d')];var _0x1d0ae3=_0x357d33?0x0:_0x265840[_0x3b70('0x1e')];var _0xb4652b=_0x357d33?_0x2c0351['count']:_0x265840['offset']+_0x265840[_0x3b70('0x1c')];var _0x4eadc5;if(_0xb4652b>=_0x4751ef){_0xb4652b=_0x4751ef;_0x4eadc5=0xc8;}else{_0x4eadc5=0xce;}_0x2d4659[_0x3b70('0x18')](_0x4eadc5);return _0x2d4659['set'](_0x3b70('0x1f'),_0x1d0ae3+'-'+_0xb4652b+'/'+_0x4751ef)[_0x3b70('0x1a')](_0x2c0351);}return null;};}function patchUpdates(_0x1933ee){return function(_0x2c981b){try{jsonpatch[_0x3b70('0x20')](_0x2c981b,_0x1933ee,!![]);}catch(_0x23b81f){return BPromise[_0x3b70('0x21')](_0x23b81f);}return _0x2c981b[_0x3b70('0x22')]();};}function saveUpdates(_0xd329e5,_0x2b9887){return function(_0x51bd85){if(_0x51bd85){return _0x51bd85[_0x3b70('0x23')](_0xd329e5)[_0x3b70('0x24')](function(_0x29dc50){return _0x29dc50;});}return null;};}function removeEntity(_0x56963e,_0xf9624d){return function(_0x2ddf61){if(_0x2ddf61){return _0x2ddf61[_0x3b70('0x25')]()[_0x3b70('0x24')](function(){_0x56963e[_0x3b70('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1080bd,_0x6025f){return function(_0x1295aa){if(!_0x1295aa){_0x1080bd[_0x3b70('0x17')](0x194);}return _0x1295aa;};}function handleError(_0x7e36e0,_0x5cd5a6){_0x5cd5a6=_0x5cd5a6||0x1f4;return function(_0x479a2e){logger['error'](_0x479a2e['stack']);if(_0x479a2e[_0x3b70('0x26')]){delete _0x479a2e[_0x3b70('0x26')];}_0x7e36e0[_0x3b70('0x18')](_0x5cd5a6)[_0x3b70('0x27')](_0x479a2e);};}exports[_0x3b70('0x28')]=function(_0x201e21,_0x260381){var _0x1092d9={},_0x34345f={},_0x31af73={'count':0x0,'rows':[]};var _0x490d68=_['map'](db[_0x3b70('0x29')][_0x3b70('0x2a')],function(_0x4e8207){return{'name':_0x4e8207[_0x3b70('0x2b')],'type':_0x4e8207[_0x3b70('0x2c')][_0x3b70('0x2d')]};});_0x34345f[_0x3b70('0x2e')]=_[_0x3b70('0x2f')](_0x490d68,'name');_0x34345f['query']=_[_0x3b70('0x30')](_0x201e21[_0x3b70('0x31')]);_0x34345f[_0x3b70('0x32')]=_[_0x3b70('0x33')](_0x34345f[_0x3b70('0x2e')],_0x34345f['query']);_0x1092d9[_0x3b70('0x34')]=_['intersection'](_0x34345f[_0x3b70('0x2e')],qs[_0x3b70('0x35')](_0x201e21[_0x3b70('0x31')][_0x3b70('0x35')]));_0x1092d9[_0x3b70('0x34')]=_0x1092d9[_0x3b70('0x34')][_0x3b70('0x36')]?_0x1092d9['attributes']:_0x34345f[_0x3b70('0x2e')];if(!_0x201e21['query'][_0x3b70('0x37')]('nolimit')){_0x1092d9[_0x3b70('0x1c')]=qs['limit'](_0x201e21[_0x3b70('0x31')][_0x3b70('0x1c')]);_0x1092d9[_0x3b70('0x1e')]=qs[_0x3b70('0x1e')](_0x201e21['query'][_0x3b70('0x1e')]);}_0x1092d9['order']=qs[_0x3b70('0x38')](_0x201e21['query'][_0x3b70('0x38')]);_0x1092d9[_0x3b70('0x39')]=qs['filters'](_[_0x3b70('0x3a')](_0x201e21['query'],_0x34345f[_0x3b70('0x32')]),_0x490d68);if(_0x201e21[_0x3b70('0x31')][_0x3b70('0x3b')]){_0x1092d9['where']=_[_0x3b70('0x3c')](_0x1092d9[_0x3b70('0x39')],{'$or':_[_0x3b70('0x2f')](_0x490d68,function(_0x50a66d){if(_0x50a66d[_0x3b70('0x2c')]!=='VIRTUAL'){var _0x10b61d={};_0x10b61d[_0x50a66d[_0x3b70('0x26')]]={'$like':'%'+_0x201e21['query'][_0x3b70('0x3b')]+'%'};return _0x10b61d;}})});}_0x1092d9=_[_0x3b70('0x3c')]({},_0x1092d9,_0x201e21[_0x3b70('0x3d')]);var _0x1ca18a={'where':_0x1092d9[_0x3b70('0x39')]};return db['UserProfileSection'][_0x3b70('0x1d')](_0x1ca18a)[_0x3b70('0x24')](function(_0x55e827){_0x31af73[_0x3b70('0x1d')]=_0x55e827;if(_0x201e21[_0x3b70('0x31')][_0x3b70('0x3e')]){_0x1092d9[_0x3b70('0x3f')]=[{'all':!![]}];}return db[_0x3b70('0x29')]['findAll'](_0x1092d9);})['then'](function(_0x2aa3fe){_0x31af73[_0x3b70('0x40')]=_0x2aa3fe;return _0x31af73;})[_0x3b70('0x24')](respondWithFilteredResult(_0x260381,_0x1092d9))[_0x3b70('0x41')](handleError(_0x260381,null));};exports['show']=function(_0xc2664b,_0x26e6a6){var _0xd6c56b={'raw':![],'where':{'id':_0xc2664b['params']['id']}},_0x1d4e49={};_0x1d4e49['model']=_[_0x3b70('0x30')](db['UserProfileSection'][_0x3b70('0x2a')]);_0x1d4e49[_0x3b70('0x31')]=_[_0x3b70('0x30')](_0xc2664b[_0x3b70('0x31')]);_0x1d4e49[_0x3b70('0x32')]=_[_0x3b70('0x33')](_0x1d4e49[_0x3b70('0x2e')],_0x1d4e49[_0x3b70('0x31')]);_0xd6c56b['attributes']=_['intersection'](_0x1d4e49[_0x3b70('0x2e')],qs['fields'](_0xc2664b[_0x3b70('0x31')][_0x3b70('0x35')]));_0xd6c56b['attributes']=_0xd6c56b[_0x3b70('0x34')]['length']?_0xd6c56b[_0x3b70('0x34')]:_0x1d4e49[_0x3b70('0x2e')];if(_0xc2664b[_0x3b70('0x31')][_0x3b70('0x3e')]){_0xd6c56b[_0x3b70('0x3f')]=[{'all':!![]}];}_0xd6c56b=_[_0x3b70('0x3c')]({},_0xd6c56b,_0xc2664b[_0x3b70('0x3d')]);return db[_0x3b70('0x29')][_0x3b70('0x42')](_0xd6c56b)[_0x3b70('0x24')](handleEntityNotFound(_0x26e6a6,null))[_0x3b70('0x24')](respondWithResult(_0x26e6a6,null))['catch'](handleError(_0x26e6a6,null));};exports[_0x3b70('0x43')]=function(_0x3cae1e,_0x15b3bb){return db[_0x3b70('0x29')]['create'](_0x3cae1e[_0x3b70('0x44')],{})['then'](respondWithResult(_0x15b3bb,0xc9))[_0x3b70('0x41')](handleError(_0x15b3bb,null));};exports[_0x3b70('0x23')]=function(_0x5f3390,_0xa61a8){if(_0x5f3390[_0x3b70('0x44')]['id']){delete _0x5f3390[_0x3b70('0x44')]['id'];}return db[_0x3b70('0x29')][_0x3b70('0x42')]({'where':{'id':_0x5f3390[_0x3b70('0x45')]['id']}})[_0x3b70('0x24')](handleEntityNotFound(_0xa61a8,null))[_0x3b70('0x24')](saveUpdates(_0x5f3390[_0x3b70('0x44')],null))[_0x3b70('0x24')](respondWithResult(_0xa61a8,null))[_0x3b70('0x41')](handleError(_0xa61a8,null));};exports[_0x3b70('0x25')]=function(_0x427055,_0x438941){return db['UserProfileSection'][_0x3b70('0x42')]({'where':{'id':_0x427055[_0x3b70('0x45')]['id']}})[_0x3b70('0x24')](handleEntityNotFound(_0x438941,null))[_0x3b70('0x24')](removeEntity(_0x438941,null))[_0x3b70('0x41')](handleError(_0x438941,null));};exports['describe']=function(_0x2ec491,_0x31ffd0){return db[_0x3b70('0x29')][_0x3b70('0x46')]()['then'](respondWithResult(_0x31ffd0,null))[_0x3b70('0x41')](handleError(_0x31ffd0,null));}; \ No newline at end of file +var _0x0dc2=['apply','save','update','then','destroy','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x11a6f2,_0x23b094){var _0x5c2a55=function(_0x5bcc93){while(--_0x5bcc93){_0x11a6f2['push'](_0x11a6f2['shift']());}};_0x5c2a55(++_0x23b094);}(_0x0dc2,0xbb));var _0x20dc=function(_0x98c7bb,_0x158d62){_0x98c7bb=_0x98c7bb-0x0;var _0x5dd35b=_0x0dc2[_0x98c7bb];return _0x5dd35b;};'use strict';var emlformat=require(_0x20dc('0x0'));var rimraf=require(_0x20dc('0x1'));var zipdir=require(_0x20dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x20dc('0x3'));var Mustache=require(_0x20dc('0x4'));var util=require(_0x20dc('0x5'));var path=require(_0x20dc('0x6'));var sox=require(_0x20dc('0x7'));var csv=require(_0x20dc('0x8'));var ejs=require(_0x20dc('0x9'));var fs=require('fs');var fs_extra=require(_0x20dc('0xa'));var _=require(_0x20dc('0xb'));var squel=require(_0x20dc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x20dc('0x8'));var querystring=require(_0x20dc('0xd'));var Papa=require(_0x20dc('0xe'));var Redis=require(_0x20dc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x20dc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20dc('0x11'));var logger=require(_0x20dc('0x12'))('api');var utils=require(_0x20dc('0x13'));var config=require(_0x20dc('0x14'));var licenseUtil=require(_0x20dc('0x15'));var db=require(_0x20dc('0x16'))['db'];function respondWithStatusCode(_0x4a6793,_0x5bf26a){_0x5bf26a=_0x5bf26a||0xcc;return function(_0x232780){if(_0x232780){return _0x4a6793[_0x20dc('0x17')](_0x5bf26a);}return _0x4a6793['status'](_0x5bf26a)[_0x20dc('0x18')]();};}function respondWithResult(_0x30c58b,_0x2900e3){_0x2900e3=_0x2900e3||0xc8;return function(_0x3545b1){if(_0x3545b1){return _0x30c58b[_0x20dc('0x19')](_0x2900e3)[_0x20dc('0x1a')](_0x3545b1);}};}function respondWithFilteredResult(_0x2c2042,_0x125239){return function(_0x1793b0){if(_0x1793b0){var _0x4be343=typeof _0x125239[_0x20dc('0x1b')]===_0x20dc('0x1c')&&typeof _0x125239[_0x20dc('0x1d')]==='undefined';var _0x5841f3=_0x1793b0[_0x20dc('0x1e')];var _0x251014=_0x4be343?0x0:_0x125239[_0x20dc('0x1b')];var _0x342d90=_0x4be343?_0x1793b0[_0x20dc('0x1e')]:_0x125239[_0x20dc('0x1b')]+_0x125239['limit'];var _0x1c3a17;if(_0x342d90>=_0x5841f3){_0x342d90=_0x5841f3;_0x1c3a17=0xc8;}else{_0x1c3a17=0xce;}_0x2c2042[_0x20dc('0x19')](_0x1c3a17);return _0x2c2042[_0x20dc('0x1f')]('Content-Range',_0x251014+'-'+_0x342d90+'/'+_0x5841f3)['json'](_0x1793b0);}return null;};}function patchUpdates(_0xac493){return function(_0xca7451){try{jsonpatch[_0x20dc('0x20')](_0xca7451,_0xac493,!![]);}catch(_0x20d809){return BPromise['reject'](_0x20d809);}return _0xca7451[_0x20dc('0x21')]();};}function saveUpdates(_0x2635cf,_0x25d22f){return function(_0x4f69a8){if(_0x4f69a8){return _0x4f69a8[_0x20dc('0x22')](_0x2635cf)[_0x20dc('0x23')](function(_0x4c878d){return _0x4c878d;});}return null;};}function removeEntity(_0x4ee32e,_0x4f349e){return function(_0x117a6e){if(_0x117a6e){return _0x117a6e[_0x20dc('0x24')]()[_0x20dc('0x23')](function(){_0x4ee32e[_0x20dc('0x19')](0xcc)[_0x20dc('0x18')]();});}};}function handleEntityNotFound(_0x24de1b,_0x490cee){return function(_0x32b676){if(!_0x32b676){_0x24de1b[_0x20dc('0x17')](0x194);}return _0x32b676;};}function handleError(_0x224bbf,_0x52429e){_0x52429e=_0x52429e||0x1f4;return function(_0x69cb40){logger['error'](_0x69cb40[_0x20dc('0x25')]);if(_0x69cb40[_0x20dc('0x26')]){delete _0x69cb40[_0x20dc('0x26')];}_0x224bbf[_0x20dc('0x19')](_0x52429e)[_0x20dc('0x27')](_0x69cb40);};}exports[_0x20dc('0x28')]=function(_0x49a14e,_0x16a2b0){var _0xb8a3d0={},_0x348b4f={},_0x479f03={'count':0x0,'rows':[]};var _0x2701ee=_[_0x20dc('0x29')](db[_0x20dc('0x2a')][_0x20dc('0x2b')],function(_0x4ea7d2){return{'name':_0x4ea7d2[_0x20dc('0x2c')],'type':_0x4ea7d2['type'][_0x20dc('0x2d')]};});_0x348b4f[_0x20dc('0x2e')]=_['map'](_0x2701ee,_0x20dc('0x26'));_0x348b4f['query']=_[_0x20dc('0x2f')](_0x49a14e[_0x20dc('0x30')]);_0x348b4f[_0x20dc('0x31')]=_['intersection'](_0x348b4f['model'],_0x348b4f[_0x20dc('0x30')]);_0xb8a3d0[_0x20dc('0x32')]=_[_0x20dc('0x33')](_0x348b4f['model'],qs[_0x20dc('0x34')](_0x49a14e['query']['fields']));_0xb8a3d0[_0x20dc('0x32')]=_0xb8a3d0[_0x20dc('0x32')]['length']?_0xb8a3d0[_0x20dc('0x32')]:_0x348b4f[_0x20dc('0x2e')];if(!_0x49a14e['query'][_0x20dc('0x35')](_0x20dc('0x36'))){_0xb8a3d0[_0x20dc('0x1d')]=qs[_0x20dc('0x1d')](_0x49a14e['query'][_0x20dc('0x1d')]);_0xb8a3d0[_0x20dc('0x1b')]=qs['offset'](_0x49a14e[_0x20dc('0x30')][_0x20dc('0x1b')]);}_0xb8a3d0[_0x20dc('0x37')]=qs[_0x20dc('0x38')](_0x49a14e[_0x20dc('0x30')][_0x20dc('0x38')]);_0xb8a3d0[_0x20dc('0x39')]=qs['filters'](_['pick'](_0x49a14e[_0x20dc('0x30')],_0x348b4f[_0x20dc('0x31')]),_0x2701ee);if(_0x49a14e[_0x20dc('0x30')][_0x20dc('0x3a')]){_0xb8a3d0[_0x20dc('0x39')]=_['merge'](_0xb8a3d0[_0x20dc('0x39')],{'$or':_[_0x20dc('0x29')](_0x2701ee,function(_0x36d27a){if(_0x36d27a['type']!==_0x20dc('0x3b')){var _0x2537f1={};_0x2537f1[_0x36d27a['name']]={'$like':'%'+_0x49a14e['query'][_0x20dc('0x3a')]+'%'};return _0x2537f1;}})});}_0xb8a3d0=_[_0x20dc('0x3c')]({},_0xb8a3d0,_0x49a14e[_0x20dc('0x3d')]);var _0x5e4684={'where':_0xb8a3d0['where']};return db['UserProfileSection'][_0x20dc('0x1e')](_0x5e4684)[_0x20dc('0x23')](function(_0x17d4d3){_0x479f03['count']=_0x17d4d3;if(_0x49a14e['query'][_0x20dc('0x3e')]){_0xb8a3d0[_0x20dc('0x3f')]=[{'all':!![]}];}return db[_0x20dc('0x2a')]['findAll'](_0xb8a3d0);})['then'](function(_0x2c322a){_0x479f03[_0x20dc('0x40')]=_0x2c322a;return _0x479f03;})[_0x20dc('0x23')](respondWithFilteredResult(_0x16a2b0,_0xb8a3d0))[_0x20dc('0x41')](handleError(_0x16a2b0,null));};exports[_0x20dc('0x42')]=function(_0x251157,_0x43348a){var _0x40c018={'raw':![],'where':{'id':_0x251157['params']['id']}},_0x19741c={};_0x19741c[_0x20dc('0x2e')]=_[_0x20dc('0x2f')](db[_0x20dc('0x2a')][_0x20dc('0x2b')]);_0x19741c[_0x20dc('0x30')]=_['keys'](_0x251157[_0x20dc('0x30')]);_0x19741c[_0x20dc('0x31')]=_[_0x20dc('0x33')](_0x19741c['model'],_0x19741c['query']);_0x40c018[_0x20dc('0x32')]=_['intersection'](_0x19741c['model'],qs[_0x20dc('0x34')](_0x251157[_0x20dc('0x30')][_0x20dc('0x34')]));_0x40c018[_0x20dc('0x32')]=_0x40c018[_0x20dc('0x32')][_0x20dc('0x43')]?_0x40c018['attributes']:_0x19741c[_0x20dc('0x2e')];if(_0x251157[_0x20dc('0x30')][_0x20dc('0x3e')]){_0x40c018[_0x20dc('0x3f')]=[{'all':!![]}];}_0x40c018=_[_0x20dc('0x3c')]({},_0x40c018,_0x251157['options']);return db[_0x20dc('0x2a')][_0x20dc('0x44')](_0x40c018)[_0x20dc('0x23')](handleEntityNotFound(_0x43348a,null))['then'](respondWithResult(_0x43348a,null))['catch'](handleError(_0x43348a,null));};exports['create']=function(_0x2548de,_0x15f0f7){return db['UserProfileSection'][_0x20dc('0x45')](_0x2548de[_0x20dc('0x46')],{})[_0x20dc('0x23')](respondWithResult(_0x15f0f7,0xc9))[_0x20dc('0x41')](handleError(_0x15f0f7,null));};exports[_0x20dc('0x22')]=function(_0x27c930,_0x5848aa){if(_0x27c930[_0x20dc('0x46')]['id']){delete _0x27c930[_0x20dc('0x46')]['id'];}return db[_0x20dc('0x2a')][_0x20dc('0x44')]({'where':{'id':_0x27c930['params']['id']}})[_0x20dc('0x23')](handleEntityNotFound(_0x5848aa,null))[_0x20dc('0x23')](saveUpdates(_0x27c930[_0x20dc('0x46')],null))['then'](respondWithResult(_0x5848aa,null))['catch'](handleError(_0x5848aa,null));};exports[_0x20dc('0x24')]=function(_0x57fb25,_0xed3a53){return db[_0x20dc('0x2a')]['find']({'where':{'id':_0x57fb25[_0x20dc('0x47')]['id']}})[_0x20dc('0x23')](handleEntityNotFound(_0xed3a53,null))[_0x20dc('0x23')](removeEntity(_0xed3a53,null))[_0x20dc('0x41')](handleError(_0xed3a53,null));};exports[_0x20dc('0x48')]=function(_0x53e11d,_0x721fbf){return db[_0x20dc('0x2a')][_0x20dc('0x48')]()[_0x20dc('0x23')](respondWithResult(_0x721fbf,null))[_0x20dc('0x41')](handleError(_0x721fbf,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 73a3f94..6fa7abf 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 _0xb692=['moment','rimraf','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb692,0x141));var _0x2b69=function(_0x3bd4e5,_0x33854f){_0x3bd4e5=_0x3bd4e5-0x0;var _0x2d1522=_0xb692[_0x3bd4e5];return _0x2d1522;};'use strict';var _=require(_0x2b69('0x0'));var util=require(_0x2b69('0x1'));var logger=require(_0x2b69('0x2'))('api');var moment=require(_0x2b69('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b69('0x4'));var config=require(_0x2b69('0x5'));var attributes=require(_0x2b69('0x6'));module[_0x2b69('0x7')]=function(_0x5141f6,_0x28d53e){return _0x5141f6['define']('UserProfileSection',attributes,{'tableName':_0x2b69('0x8'),'paranoid':![],'indexes':[{'name':_0x2b69('0x9'),'fields':[_0x2b69('0xa'),_0x2b69('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb6ba=['request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','api','moment'];(function(_0x3359b0,_0x13700a){var _0x2e823b=function(_0x187257){while(--_0x187257){_0x3359b0['push'](_0x3359b0['shift']());}};_0x2e823b(++_0x13700a);}(_0xb6ba,0x1f4));var _0xab6b=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0xb6ba[_0x460150];return _0x340677;};'use strict';var _=require(_0xab6b('0x0'));var util=require(_0xab6b('0x1'));var logger=require('../../config/logger')(_0xab6b('0x2'));var moment=require(_0xab6b('0x3'));var BPromise=require('bluebird');var rp=require(_0xab6b('0x4'));var fs=require('fs');var path=require(_0xab6b('0x5'));var rimraf=require('rimraf');var config=require(_0xab6b('0x6'));var attributes=require(_0xab6b('0x7'));module[_0xab6b('0x8')]=function(_0x131408,_0x2f7b32){return _0x131408[_0xab6b('0x9')](_0xab6b('0xa'),attributes,{'tableName':_0xab6b('0xb'),'paranoid':![],'indexes':[{'name':_0xab6b('0xc'),'fields':[_0xab6b('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 4e92012..2ff0848 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 _0x51f2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1ddbc9,_0x571e52){var _0x53ac99=function(_0x6ec29){while(--_0x6ec29){_0x1ddbc9['push'](_0x1ddbc9['shift']());}};_0x53ac99(++_0x571e52);}(_0x51f2,0xeb));var _0x251f=function(_0x30aac0,_0x57a574){_0x30aac0=_0x30aac0-0x0;var _0x234de7=_0x51f2[_0x30aac0];return _0x234de7;};'use strict';var _=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var moment=require(_0x251f('0x2'));var BPromise=require(_0x251f('0x3'));var rs=require(_0x251f('0x4'));var fs=require('fs');var Redis=require(_0x251f('0x5'));var db=require(_0x251f('0x6'))['db'];var utils=require(_0x251f('0x7'));var logger=require(_0x251f('0x8'))('rpc');var config=require(_0x251f('0x9'));var jayson=require(_0x251f('0xa'));var client=jayson[_0x251f('0xb')][_0x251f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18c6ab,_0x57150e,_0x1f01da){return new BPromise(function(_0x37469e,_0x2cf6e4){return client[_0x251f('0xd')](_0x18c6ab,_0x1f01da)['then'](function(_0x2cc76f){logger[_0x251f('0xe')](_0x251f('0xf'),_0x57150e,_0x251f('0x10'));logger['debug'](_0x251f('0x11'),_0x57150e,_0x251f('0x10'),JSON[_0x251f('0x12')](_0x2cc76f));if(_0x2cc76f[_0x251f('0x13')]){if(_0x2cc76f['error'][_0x251f('0x14')]===0x1f4){logger[_0x251f('0x13')](_0x251f('0xf'),_0x57150e,_0x2cc76f[_0x251f('0x13')][_0x251f('0x15')]);return _0x2cf6e4(_0x2cc76f[_0x251f('0x13')][_0x251f('0x15')]);}logger[_0x251f('0x13')](_0x251f('0xf'),_0x57150e,_0x2cc76f[_0x251f('0x13')][_0x251f('0x15')]);return _0x37469e(_0x2cc76f['error'][_0x251f('0x15')]);}else{logger[_0x251f('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x57150e,_0x251f('0x10'));_0x37469e(_0x2cc76f[_0x251f('0x16')][_0x251f('0x15')]);}})[_0x251f('0x17')](function(_0x9f7fb2){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x57150e,_0x9f7fb2);_0x2cf6e4(_0x9f7fb2);});});} \ No newline at end of file +var _0xdf85=['../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4442ff,_0x5e93e5){var _0x3bb5e2=function(_0xed83c0){while(--_0xed83c0){_0x4442ff['push'](_0x4442ff['shift']());}};_0x3bb5e2(++_0x5e93e5);}(_0xdf85,0x12c));var _0x5df8=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xdf85[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0x5df8('0x0'));var moment=require('moment');var BPromise=require(_0x5df8('0x1'));var rs=require(_0x5df8('0x2'));var fs=require('fs');var Redis=require(_0x5df8('0x3'));var db=require(_0x5df8('0x4'))['db'];var utils=require(_0x5df8('0x5'));var logger=require(_0x5df8('0x6'))(_0x5df8('0x7'));var config=require(_0x5df8('0x8'));var jayson=require(_0x5df8('0x9'));var client=jayson[_0x5df8('0xa')][_0x5df8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa871,_0xeeaef8,_0x12384d){return new BPromise(function(_0x3dec2d,_0x2b0aee){return client[_0x5df8('0xc')](_0x4aa871,_0x12384d)[_0x5df8('0xd')](function(_0x172560){logger[_0x5df8('0xe')](_0x5df8('0xf'),_0xeeaef8,_0x5df8('0x10'));logger['debug'](_0x5df8('0x11'),_0xeeaef8,_0x5df8('0x10'),JSON[_0x5df8('0x12')](_0x172560));if(_0x172560[_0x5df8('0x13')]){if(_0x172560[_0x5df8('0x13')]['code']===0x1f4){logger[_0x5df8('0x13')]('UserProfileSection,\x20%s,\x20%s',_0xeeaef8,_0x172560[_0x5df8('0x13')]['message']);return _0x2b0aee(_0x172560[_0x5df8('0x13')][_0x5df8('0x14')]);}logger[_0x5df8('0x13')]('UserProfileSection,\x20%s,\x20%s',_0xeeaef8,_0x172560[_0x5df8('0x13')][_0x5df8('0x14')]);return _0x3dec2d(_0x172560[_0x5df8('0x13')][_0x5df8('0x14')]);}else{logger[_0x5df8('0xe')](_0x5df8('0xf'),_0xeeaef8,_0x5df8('0x10'));_0x3dec2d(_0x172560[_0x5df8('0x15')][_0x5df8('0x14')]);}})['catch'](function(_0x103bff){logger[_0x5df8('0x13')]('UserProfileSection,\x20%s,\x20%s',_0xeeaef8,_0x103bff);_0x2b0aee(_0x103bff);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9c82ddd..0b985e0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x405ec3,_0x44a135){var _0x553b6b=function(_0x5cf096){while(--_0x5cf096){_0x405ec3['push'](_0x405ec3['shift']());}};_0x553b6b(++_0x44a135);}(_0x70e0,0x17b));var _0x070e=function(_0x1dd94c,_0x13e4c3){_0x1dd94c=_0x1dd94c-0x0;var _0x306bba=_0x70e0[_0x1dd94c];return _0x306bba;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 809ea16..7581a50 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 _0x3a9a=['sequelize','INTEGER'];(function(_0x5cb1a5,_0x13016f){var _0x533f56=function(_0x1e5a46){while(--_0x1e5a46){_0x5cb1a5['push'](_0x5cb1a5['shift']());}};_0x533f56(++_0x13016f);}(_0x3a9a,0x122));var _0xa3a9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3a9a[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xa3a9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa3a9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf897=['sequelize','exports','INTEGER'];(function(_0x45f9bb,_0x53b1e9){var _0x18c90c=function(_0x27a87e){while(--_0x27a87e){_0x45f9bb['push'](_0x45f9bb['shift']());}};_0x18c90c(++_0x53b1e9);}(_0xf897,0xe4));var _0x7f89=function(_0x1f6f10,_0xf954ea){_0x1f6f10=_0x1f6f10-0x0;var _0x138327=_0xf897[_0x1f6f10];return _0x138327;};'use strict';var Sequelize=require(_0x7f89('0x0'));module[_0x7f89('0x1')]={'penalty':{'type':Sequelize[_0x7f89('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0a47149..04f81e7 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 _0x8af6=['rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xbec867,_0x2c636f){var _0x58ee38=function(_0xd6293d){while(--_0xd6293d){_0xbec867['push'](_0xbec867['shift']());}};_0x58ee38(++_0x2c636f);}(_0x8af6,0x76));var _0x68af=function(_0x3da863,_0x57297e){_0x3da863=_0x3da863-0x0;var _0x5352b5=_0x8af6[_0x3da863];return _0x5352b5;};'use strict';var _=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var logger=require(_0x68af('0x2'))(_0x68af('0x3'));var moment=require(_0x68af('0x4'));var BPromise=require(_0x68af('0x5'));var rp=require(_0x68af('0x6'));var fs=require('fs');var path=require(_0x68af('0x7'));var rimraf=require(_0x68af('0x8'));var config=require(_0x68af('0x9'));var attributes=require('./userSmsQueue.attributes');module[_0x68af('0xa')]=function(_0x5a23da,_0x36e91a){return _0x5a23da[_0x68af('0xb')](_0x68af('0xc'),attributes,{'tableName':_0x68af('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa3f=['rimraf','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x27698a,_0x497c4a){var _0x57f373=function(_0x453436){while(--_0x453436){_0x27698a['push'](_0x27698a['shift']());}};_0x57f373(++_0x497c4a);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x25b8b1,_0xe0b951){_0x25b8b1=_0x25b8b1-0x0;var _0x2d04f7=_0xaa3f[_0x25b8b1];return _0x2d04f7;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'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 7c8b4f5..eef1c73 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 _0x3593=['../../config/logger','rpc','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x278066,_0x3c4582){var _0x6e9759=function(_0x5a5945){while(--_0x5a5945){_0x278066['push'](_0x278066['shift']());}};_0x6e9759(++_0x3c4582);}(_0x3593,0xb1));var _0x3359=function(_0x1d044d,_0x389c9c){_0x1d044d=_0x1d044d-0x0;var _0x3afc63=_0x3593[_0x1d044d];return _0x3afc63;};'use strict';var _=require(_0x3359('0x0'));var util=require(_0x3359('0x1'));var moment=require(_0x3359('0x2'));var BPromise=require(_0x3359('0x3'));var rs=require(_0x3359('0x4'));var fs=require('fs');var Redis=require(_0x3359('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3359('0x6'));var logger=require(_0x3359('0x7'))(_0x3359('0x8'));var config=require('../../config/environment');var jayson=require(_0x3359('0x9'));var client=jayson[_0x3359('0xa')][_0x3359('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ee9a4,_0x9f57e0,_0x41c760){return new BPromise(function(_0x92e256,_0x204c72){return client['request'](_0x4ee9a4,_0x41c760)[_0x3359('0xc')](function(_0x5a2c42){logger[_0x3359('0xd')](_0x3359('0xe'),_0x9f57e0,_0x3359('0xf'));logger[_0x3359('0x10')](_0x3359('0x11'),_0x9f57e0,_0x3359('0xf'),JSON[_0x3359('0x12')](_0x5a2c42));if(_0x5a2c42[_0x3359('0x13')]){if(_0x5a2c42[_0x3359('0x13')][_0x3359('0x14')]===0x1f4){logger[_0x3359('0x13')](_0x3359('0xe'),_0x9f57e0,_0x5a2c42['error'][_0x3359('0x15')]);return _0x204c72(_0x5a2c42[_0x3359('0x13')]['message']);}logger['error'](_0x3359('0xe'),_0x9f57e0,_0x5a2c42[_0x3359('0x13')][_0x3359('0x15')]);return _0x92e256(_0x5a2c42['error'][_0x3359('0x15')]);}else{logger[_0x3359('0xd')](_0x3359('0xe'),_0x9f57e0,_0x3359('0xf'));_0x92e256(_0x5a2c42[_0x3359('0x16')]['message']);}})['catch'](function(_0x5908ac){logger['error'](_0x3359('0xe'),_0x9f57e0,_0x5908ac);_0x204c72(_0x5908ac);});});} \ No newline at end of file +var _0x0c2b=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4ec805,_0x3b8515){var _0x386805=function(_0x58c4c0){while(--_0x58c4c0){_0x4ec805['push'](_0x4ec805['shift']());}};_0x386805(++_0x3b8515);}(_0x0c2b,0x86));var _0xb0c2=function(_0x1daaf9,_0x5c3f22){_0x1daaf9=_0x1daaf9-0x0;var _0x46f51c=_0x0c2b[_0x1daaf9];return _0x46f51c;};'use strict';var _=require(_0xb0c2('0x0'));var util=require(_0xb0c2('0x1'));var moment=require('moment');var BPromise=require(_0xb0c2('0x2'));var rs=require(_0xb0c2('0x3'));var fs=require('fs');var Redis=require(_0xb0c2('0x4'));var db=require(_0xb0c2('0x5'))['db'];var utils=require(_0xb0c2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb0c2('0x7'));var client=jayson[_0xb0c2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52d873,_0xd42fef,_0x18c72f){return new BPromise(function(_0x110ff6,_0xa40ccf){return client['request'](_0x52d873,_0x18c72f)['then'](function(_0x55c10a){logger[_0xb0c2('0x9')](_0xb0c2('0xa'),_0xd42fef,_0xb0c2('0xb'));logger[_0xb0c2('0xc')](_0xb0c2('0xd'),_0xd42fef,_0xb0c2('0xb'),JSON['stringify'](_0x55c10a));if(_0x55c10a[_0xb0c2('0xe')]){if(_0x55c10a[_0xb0c2('0xe')][_0xb0c2('0xf')]===0x1f4){logger[_0xb0c2('0xe')](_0xb0c2('0xa'),_0xd42fef,_0x55c10a[_0xb0c2('0xe')][_0xb0c2('0x10')]);return _0xa40ccf(_0x55c10a[_0xb0c2('0xe')][_0xb0c2('0x10')]);}logger[_0xb0c2('0xe')](_0xb0c2('0xa'),_0xd42fef,_0x55c10a[_0xb0c2('0xe')][_0xb0c2('0x10')]);return _0x110ff6(_0x55c10a['error'][_0xb0c2('0x10')]);}else{logger[_0xb0c2('0x9')](_0xb0c2('0xa'),_0xd42fef,_0xb0c2('0xb'));_0x110ff6(_0x55c10a[_0xb0c2('0x11')][_0xb0c2('0x10')]);}})[_0xb0c2('0x12')](function(_0x2e7bcf){logger['error'](_0xb0c2('0xa'),_0xd42fef,_0x2e7bcf);_0xa40ccf(_0x2e7bcf);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e3e15d3..21b4d10 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 _0x0792=['sequelize','exports','INTEGER'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x0792,0xc0));var _0x2079=function(_0x37d29a,_0x4e999a){_0x37d29a=_0x37d29a-0x0;var _0x3948ad=_0x0792[_0x37d29a];return _0x3948ad;};'use strict';var Sequelize=require(_0x2079('0x0'));module[_0x2079('0x1')]={'UserId':{'type':Sequelize[_0x2079('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2079('0x2')]}}; \ No newline at end of file +var _0xf57a=['sequelize','exports','INTEGER'];(function(_0x3491c2,_0x2ad9c5){var _0x108824=function(_0xef923){while(--_0xef923){_0x3491c2['push'](_0x3491c2['shift']());}};_0x108824(++_0x2ad9c5);}(_0xf57a,0x1e6));var _0xaf57=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xf57a[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xaf57('0x0'));module[_0xaf57('0x1')]={'UserId':{'type':Sequelize[_0xaf57('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index f7c7e23..3370faa 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(_0x2e6bbc,_0x4d0bf1){var _0x54f4f6=function(_0x1e90e7){while(--_0x1e90e7){_0x2e6bbc['push'](_0x2e6bbc['shift']());}};_0x54f4f6(++_0x4d0bf1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x43071b,_0x4b616b){var _0x40fdc7=function(_0x115189){while(--_0x115189){_0x43071b['push'](_0x43071b['shift']());}};_0x40fdc7(++_0x4b616b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 1f20d6b..bc4614f 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x7709d5,_0x3a0bc4){var _0x36e23c=function(_0xaeb4e3){while(--_0xaeb4e3){_0x7709d5['push'](_0x7709d5['shift']());}};_0x36e23c(++_0x3a0bc4);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');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(_0x136cc4,_0x5892b0){var _0x3c2a35=function(_0x530995){while(--_0x530995){_0x136cc4['push'](_0x136cc4['shift']());}};_0x3c2a35(++_0x5892b0);}(_0x70e0,0x17b));var _0x070e=function(_0x27623c,_0x191334){_0x27623c=_0x27623c-0x0;var _0x2e41f0=_0x70e0[_0x27623c];return _0x2e41f0;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 03768e9..1aabf52 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 _0x4d85=['INTEGER','sequelize'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x4d85,0x99));var _0x54d8=function(_0x3c6128,_0x441a23){_0x3c6128=_0x3c6128-0x0;var _0x346a78=_0x4d85[_0x3c6128];return _0x346a78;};'use strict';var Sequelize=require(_0x54d8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x54d8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa3d8=['INTEGER','sequelize'];(function(_0x23acad,_0x503d09){var _0x55b6fd=function(_0x3192ee){while(--_0x3192ee){_0x23acad['push'](_0x23acad['shift']());}};_0x55b6fd(++_0x503d09);}(_0xa3d8,0x1f1));var _0x8a3d=function(_0x265785,_0x489978){_0x265785=_0x265785-0x0;var _0xcc3c47=_0xa3d8[_0x265785];return _0xcc3c47;};'use strict';var Sequelize=require(_0x8a3d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8a3d('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 1c419ad..57b8ef4 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 _0xd45a=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xd45a,0x1e8));var _0xad45=function(_0x28d8a3,_0x11f82d){_0x28d8a3=_0x28d8a3-0x0;var _0x300986=_0xd45a[_0x28d8a3];return _0x300986;};'use strict';var _=require(_0xad45('0x0'));var util=require('util');var logger=require(_0xad45('0x1'))(_0xad45('0x2'));var moment=require(_0xad45('0x3'));var BPromise=require(_0xad45('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad45('0x5'));var rimraf=require(_0xad45('0x6'));var config=require(_0xad45('0x7'));var attributes=require(_0xad45('0x8'));module[_0xad45('0x9')]=function(_0x186564,_0x42c438){return _0x186564[_0xad45('0xa')](_0xad45('0xb'),attributes,{'tableName':_0xad45('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa6=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfaa6,0xdd));var _0x6faa=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0xfaa6[_0x2ae8ce];return _0x4bf686;};'use strict';var _=require(_0x6faa('0x0'));var util=require(_0x6faa('0x1'));var logger=require(_0x6faa('0x2'))(_0x6faa('0x3'));var moment=require(_0x6faa('0x4'));var BPromise=require(_0x6faa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6faa('0x6'));var rimraf=require('rimraf');var config=require(_0x6faa('0x7'));var attributes=require(_0x6faa('0x8'));module[_0x6faa('0x9')]=function(_0x4dd73c,_0xa55342){return _0x4dd73c[_0x6faa('0xa')](_0x6faa('0xb'),attributes,{'tableName':_0x6faa('0xc'),'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 26583f4..54518de 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 _0x8f01=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x570df4,_0x4606c3){var _0x5caae7=function(_0x594136){while(--_0x594136){_0x570df4['push'](_0x570df4['shift']());}};_0x5caae7(++_0x4606c3);}(_0x8f01,0x6a));var _0x18f0=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x8f01[_0x487496];return _0x539dc8;};'use strict';var _=require(_0x18f0('0x0'));var util=require(_0x18f0('0x1'));var moment=require(_0x18f0('0x2'));var BPromise=require(_0x18f0('0x3'));var rs=require(_0x18f0('0x4'));var fs=require('fs');var Redis=require(_0x18f0('0x5'));var db=require(_0x18f0('0x6'))['db'];var utils=require(_0x18f0('0x7'));var logger=require(_0x18f0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x18f0('0x9'));var client=jayson[_0x18f0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b257f,_0x44cd07,_0x4c4c9b){return new BPromise(function(_0x2d0cd3,_0x339ac2){return client['request'](_0x3b257f,_0x4c4c9b)['then'](function(_0x46fbbc){logger['info'](_0x18f0('0xb'),_0x44cd07,_0x18f0('0xc'));logger[_0x18f0('0xd')](_0x18f0('0xe'),_0x44cd07,_0x18f0('0xc'),JSON[_0x18f0('0xf')](_0x46fbbc));if(_0x46fbbc[_0x18f0('0x10')]){if(_0x46fbbc['error']['code']===0x1f4){logger[_0x18f0('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x44cd07,_0x46fbbc['error'][_0x18f0('0x11')]);return _0x339ac2(_0x46fbbc[_0x18f0('0x10')][_0x18f0('0x11')]);}logger[_0x18f0('0x10')](_0x18f0('0xb'),_0x44cd07,_0x46fbbc[_0x18f0('0x10')][_0x18f0('0x11')]);return _0x2d0cd3(_0x46fbbc[_0x18f0('0x10')][_0x18f0('0x11')]);}else{logger[_0x18f0('0x12')](_0x18f0('0xb'),_0x44cd07,'request\x20sent');_0x2d0cd3(_0x46fbbc[_0x18f0('0x13')][_0x18f0('0x11')]);}})[_0x18f0('0x14')](function(_0x26fcef){logger[_0x18f0('0x10')](_0x18f0('0xb'),_0x44cd07,_0x26fcef);_0x339ac2(_0x26fcef);});});} \ No newline at end of file +var _0xcdbc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','request\x20sent','debug','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','lodash','bluebird'];(function(_0x39e47a,_0x24ecc9){var _0x1a3ef2=function(_0x143fbf){while(--_0x143fbf){_0x39e47a['push'](_0x39e47a['shift']());}};_0x1a3ef2(++_0x24ecc9);}(_0xcdbc,0xe8));var _0xccdb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcdbc[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xccdb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xccdb('0x1'));var rs=require(_0xccdb('0x2'));var fs=require('fs');var Redis=require(_0xccdb('0x3'));var db=require(_0xccdb('0x4'))['db'];var utils=require(_0xccdb('0x5'));var logger=require(_0xccdb('0x6'))(_0xccdb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17f458,_0x48145a,_0x56311a){return new BPromise(function(_0x1bdec7,_0x1b28aa){return client[_0xccdb('0x8')](_0x17f458,_0x56311a)['then'](function(_0x12c510){logger[_0xccdb('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x48145a,_0xccdb('0xa'));logger[_0xccdb('0xb')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x48145a,_0xccdb('0xa'),JSON[_0xccdb('0xc')](_0x12c510));if(_0x12c510[_0xccdb('0xd')]){if(_0x12c510[_0xccdb('0xd')][_0xccdb('0xe')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x48145a,_0x12c510[_0xccdb('0xd')][_0xccdb('0xf')]);return _0x1b28aa(_0x12c510[_0xccdb('0xd')][_0xccdb('0xf')]);}logger[_0xccdb('0xd')](_0xccdb('0x10'),_0x48145a,_0x12c510['error'][_0xccdb('0xf')]);return _0x1bdec7(_0x12c510['error']['message']);}else{logger[_0xccdb('0x9')](_0xccdb('0x10'),_0x48145a,_0xccdb('0xa'));_0x1bdec7(_0x12c510['result']['message']);}})[_0xccdb('0x11')](function(_0x502d00){logger[_0xccdb('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x48145a,_0x502d00);_0x1b28aa(_0x502d00);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0f1407e..4483a06 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x45210d,_0x329e83){var _0x38aea3=function(_0x42d9e1){while(--_0x42d9e1){_0x45210d['push'](_0x45210d['shift']());}};_0x38aea3(++_0x329e83);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3d9640,_0x29f196){var _0x4806ad=function(_0x5c6cdd){while(--_0x5c6cdd){_0x3d9640['push'](_0x3d9640['shift']());}};_0x4806ad(++_0x29f196);}(_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 37abc64..6a006b1 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 _0x06f4=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize','exports'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x06f4,0x136));var _0x406f=function(_0x220f15,_0x1bed53){_0x220f15=_0x220f15-0x0;var _0x776634=_0x06f4[_0x220f15];return _0x776634;};'use strict';var Sequelize=require(_0x406f('0x0'));module[_0x406f('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x406f('0x2')},'membername':{'type':Sequelize[_0x406f('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x406f('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x406f('0x2')},'VoiceQueueId':{'type':Sequelize[_0x406f('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x406f('0x3')],'allowNull':![],'unique':_0x406f('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x406f('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x406f('0x4')](0xb),'defaultValue':0x0,'comment':_0x406f('0x2')}}; \ No newline at end of file +var _0x2499=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x2849d3,_0x558165){var _0x39ace3=function(_0x33c311){while(--_0x33c311){_0x2849d3['push'](_0x2849d3['shift']());}};_0x39ace3(++_0x558165);}(_0x2499,0x7d));var _0x9249=function(_0x4cc065,_0x5ca328){_0x4cc065=_0x4cc065-0x0;var _0x59fb94=_0x2499[_0x4cc065];return _0x59fb94;};'use strict';var Sequelize=require(_0x9249('0x0'));module[_0x9249('0x1')]={'uniqueid':{'type':Sequelize[_0x9249('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9249('0x3')},'membername':{'type':Sequelize[_0x9249('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x9249('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9249('0x4')],'allowNull':![],'unique':_0x9249('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x9249('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x9249('0x4')],'allowNull':![],'unique':_0x9249('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x9249('0x2')](0xb),'defaultValue':0x0,'comment':_0x9249('0x3')},'paused':{'type':Sequelize[_0x9249('0x2')](0xb),'defaultValue':0x0,'comment':_0x9249('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6b07898..cdb1b15 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 _0x4076=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x4076,0x19f));var _0x6407=function(_0x162883,_0x9d5fd2){_0x162883=_0x162883-0x0;var _0x12fea6=_0x4076[_0x162883];return _0x12fea6;};'use strict';var EventEmitter=require(_0x6407('0x0'));var UserVoiceQueueRt=require(_0x6407('0x1'))['db'][_0x6407('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6407('0x3')](0x0);var events={'afterCreate':_0x6407('0x4'),'afterUpdate':_0x6407('0x5'),'afterDestroy':_0x6407('0x6')};function emitEvent(_0x18f12f){return function(_0x1997c9,_0x472d57,_0x3f3e95){UserVoiceQueueRtEvents['emit'](_0x18f12f+':'+_0x1997c9['id'],_0x1997c9);UserVoiceQueueRtEvents[_0x6407('0x7')](_0x18f12f,_0x1997c9);_0x3f3e95(null);};}for(var e in events){if(events[_0x6407('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x6407('0x9')](e,emitEvent(event));}}module[_0x6407('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9185=['hook','events','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x547747,_0x1ec3ee){var _0x29b0a4=function(_0x2cd5c0){while(--_0x2cd5c0){_0x547747['push'](_0x547747['shift']());}};_0x29b0a4(++_0x1ec3ee);}(_0x9185,0x139));var _0x5918=function(_0x117f18,_0x43cb2b){_0x117f18=_0x117f18-0x0;var _0x2d04e6=_0x9185[_0x117f18];return _0x2d04e6;};'use strict';var EventEmitter=require(_0x5918('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x5918('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5918('0x2')](0x0);var events={'afterCreate':_0x5918('0x3'),'afterUpdate':_0x5918('0x4'),'afterDestroy':_0x5918('0x5')};function emitEvent(_0x2f8557){return function(_0x1d2754,_0x3d033d,_0x2e14fa){UserVoiceQueueRtEvents[_0x5918('0x6')](_0x2f8557+':'+_0x1d2754['id'],_0x1d2754);UserVoiceQueueRtEvents[_0x5918('0x6')](_0x2f8557,_0x1d2754);_0x2e14fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5918('0x7')](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 eea0ec8..debaf38 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 _0x35c3=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment'];(function(_0x35beb2,_0x47393a){var _0x5574bd=function(_0x4ba22e){while(--_0x4ba22e){_0x35beb2['push'](_0x35beb2['shift']());}};_0x5574bd(++_0x47393a);}(_0x35c3,0x1b6));var _0x335c=function(_0x3002be,_0x5f689f){_0x3002be=_0x3002be-0x0;var _0x35a592=_0x35c3[_0x3002be];return _0x35a592;};'use strict';var _=require(_0x335c('0x0'));var util=require(_0x335c('0x1'));var logger=require('../../config/logger')(_0x335c('0x2'));var moment=require(_0x335c('0x3'));var BPromise=require('bluebird');var rp=require(_0x335c('0x4'));var fs=require('fs');var path=require(_0x335c('0x5'));var rimraf=require(_0x335c('0x6'));var config=require(_0x335c('0x7'));var attributes=require(_0x335c('0x8'));module[_0x335c('0x9')]=function(_0x3a14a5,_0x27ad95){return _0x3a14a5[_0x335c('0xa')](_0x335c('0xb'),attributes,{'tableName':_0x335c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03c0=['exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x4d052b,_0x177132){var _0x5bd57f=function(_0x11927a){while(--_0x11927a){_0x4d052b['push'](_0x4d052b['shift']());}};_0x5bd57f(++_0x177132);}(_0x03c0,0x1c6));var _0x003c=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0x03c0[_0x4932a6];return _0x3b45b9;};'use strict';var _=require(_0x003c('0x0'));var util=require(_0x003c('0x1'));var logger=require(_0x003c('0x2'))(_0x003c('0x3'));var moment=require(_0x003c('0x4'));var BPromise=require(_0x003c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x003c('0x6'));var config=require(_0x003c('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x003c('0x8')]=function(_0x5e6646,_0x548197){return _0x5e6646[_0x003c('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0x003c('0xa'),'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 f81eb4a..35c4631 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 _0xa518=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','raw','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xa518,0x187));var _0x8a51=function(_0x114984,_0x5c9593){_0x114984=_0x114984-0x0;var _0x44822b=_0xa518[_0x114984];return _0x44822b;};'use strict';var _=require(_0x8a51('0x0'));var util=require(_0x8a51('0x1'));var moment=require(_0x8a51('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a51('0x3'));var fs=require('fs');var Redis=require(_0x8a51('0x4'));var db=require(_0x8a51('0x5'))['db'];var utils=require(_0x8a51('0x6'));var logger=require(_0x8a51('0x7'))(_0x8a51('0x8'));var config=require(_0x8a51('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8a51('0xa')][_0x8a51('0xb')]({'port':0x232a});config[_0x8a51('0xc')]=_[_0x8a51('0xd')](config[_0x8a51('0xc')],{'host':_0x8a51('0xe'),'port':0x18eb});var socket=require(_0x8a51('0xf'))(new Redis(config[_0x8a51('0xc')]));require(_0x8a51('0x10'))[_0x8a51('0x11')](socket);function respondWithRpcPromise(_0x1f86fa,_0x8e90c8,_0x3cb9bf){return new BPromise(function(_0x291861,_0x506ccc){return client[_0x8a51('0x12')](_0x1f86fa,_0x3cb9bf)['then'](function(_0x1351de){logger['info'](_0x8a51('0x13'),_0x8e90c8,'request\x20sent');logger[_0x8a51('0x14')](_0x8a51('0x15'),_0x8e90c8,_0x8a51('0x16'),JSON[_0x8a51('0x17')](_0x1351de));if(_0x1351de['error']){if(_0x1351de[_0x8a51('0x18')][_0x8a51('0x19')]===0x1f4){logger[_0x8a51('0x18')](_0x8a51('0x13'),_0x8e90c8,_0x1351de[_0x8a51('0x18')][_0x8a51('0x1a')]);return _0x506ccc(_0x1351de[_0x8a51('0x18')][_0x8a51('0x1a')]);}logger[_0x8a51('0x18')](_0x8a51('0x13'),_0x8e90c8,_0x1351de[_0x8a51('0x18')]['message']);return _0x291861(_0x1351de[_0x8a51('0x18')]['message']);}else{logger[_0x8a51('0x1b')](_0x8a51('0x13'),_0x8e90c8,_0x8a51('0x16'));_0x291861(_0x1351de[_0x8a51('0x1c')]['message']);}})[_0x8a51('0x1d')](function(_0x533ee4){logger[_0x8a51('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x8e90c8,_0x533ee4);_0x506ccc(_0x533ee4);});});}exports['GetVoiceQueueRtPauses']=function(_0x14a52d){var _0xd8b42a=this;return new Promise(function(_0x8084fc,_0x43182a){return db[_0x8a51('0x1e')][_0x8a51('0x1f')]({'raw':_0x14a52d['options']?_0x14a52d['options'][_0x8a51('0x20')]===undefined?!![]:![]:!![],'where':_0x14a52d[_0x8a51('0x21')]?_0x14a52d[_0x8a51('0x21')][_0x8a51('0x22')]||null:null,'attributes':[[db[_0x8a51('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8a51('0x23')][_0x8a51('0x24')](_0x8a51('0x25')))),_0x8a51('0x26')]]})['then'](function(_0x3b40e6){logger[_0x8a51('0x1b')](_0x8a51('0x27'),_0x14a52d);logger[_0x8a51('0x14')](_0x8a51('0x27'),_0x14a52d,JSON[_0x8a51('0x17')](_0x3b40e6));_0x8084fc(_0x3b40e6);})[_0x8a51('0x1d')](function(_0x40df70){logger[_0x8a51('0x18')](_0x8a51('0x27'),_0x40df70[_0x8a51('0x1a')],_0x14a52d);_0x43182a(_0xd8b42a[_0x8a51('0x18')](0x1f4,_0x40df70[_0x8a51('0x1a')]));});});}; \ No newline at end of file +var _0x23c8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','stringify','lodash','moment'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x23c8,0x142));var _0x823c=function(_0x4fc671,_0x2d446e){_0x4fc671=_0x4fc671-0x0;var _0x426412=_0x23c8[_0x4fc671];return _0x426412;};'use strict';var _=require(_0x823c('0x0'));var util=require('util');var moment=require(_0x823c('0x1'));var BPromise=require('bluebird');var rs=require(_0x823c('0x2'));var fs=require('fs');var Redis=require(_0x823c('0x3'));var db=require(_0x823c('0x4'))['db'];var utils=require(_0x823c('0x5'));var logger=require(_0x823c('0x6'))('rpc');var config=require(_0x823c('0x7'));var jayson=require(_0x823c('0x8'));var client=jayson[_0x823c('0x9')]['http']({'port':0x232a});config['redis']=_[_0x823c('0xa')](config['redis'],{'host':_0x823c('0xb'),'port':0x18eb});var socket=require(_0x823c('0xc'))(new Redis(config[_0x823c('0xd')]));require('./userVoiceQueueRt.socket')[_0x823c('0xe')](socket);function respondWithRpcPromise(_0x4fef09,_0x1466e3,_0x4b5990){return new BPromise(function(_0x325edd,_0x4601c2){return client[_0x823c('0xf')](_0x4fef09,_0x4b5990)['then'](function(_0x449948){logger['info'](_0x823c('0x10'),_0x1466e3,_0x823c('0x11'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1466e3,_0x823c('0x11'),JSON['stringify'](_0x449948));if(_0x449948[_0x823c('0x12')]){if(_0x449948[_0x823c('0x12')][_0x823c('0x13')]===0x1f4){logger[_0x823c('0x12')](_0x823c('0x10'),_0x1466e3,_0x449948[_0x823c('0x12')][_0x823c('0x14')]);return _0x4601c2(_0x449948[_0x823c('0x12')][_0x823c('0x14')]);}logger[_0x823c('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1466e3,_0x449948[_0x823c('0x12')][_0x823c('0x14')]);return _0x325edd(_0x449948[_0x823c('0x12')][_0x823c('0x14')]);}else{logger['info'](_0x823c('0x10'),_0x1466e3,_0x823c('0x11'));_0x325edd(_0x449948[_0x823c('0x15')][_0x823c('0x14')]);}})[_0x823c('0x16')](function(_0x3a7a0f){logger[_0x823c('0x12')](_0x823c('0x10'),_0x1466e3,_0x3a7a0f);_0x4601c2(_0x3a7a0f);});});}exports[_0x823c('0x17')]=function(_0x2b8f67){var _0x230295=this;return new Promise(function(_0x5ef1e7,_0xa9901b){return db[_0x823c('0x18')][_0x823c('0x19')]({'raw':_0x2b8f67[_0x823c('0x1a')]?_0x2b8f67[_0x823c('0x1a')][_0x823c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b8f67[_0x823c('0x1a')]?_0x2b8f67[_0x823c('0x1a')][_0x823c('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x823c('0x1d'),db[_0x823c('0x1e')]['fn']('IF',db[_0x823c('0x1e')][_0x823c('0x1f')](_0x823c('0x20')))),_0x823c('0x21')]]})[_0x823c('0x22')](function(_0x5773a8){logger['info'](_0x823c('0x17'),_0x2b8f67);logger['debug'](_0x823c('0x17'),_0x2b8f67,JSON[_0x823c('0x23')](_0x5773a8));_0x5ef1e7(_0x5773a8);})[_0x823c('0x16')](function(_0x1a2bdf){logger['error'](_0x823c('0x17'),_0x1a2bdf['message'],_0x2b8f67);_0xa9901b(_0x230295[_0x823c('0x12')](0x1f4,_0x1a2bdf[_0x823c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5f7891f..f980aea 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 _0x44ff=['remove','update','userVoiceQueueRt:','save'];(function(_0x9bd30e,_0x2a22f8){var _0x424d08=function(_0x396f22){while(--_0x396f22){_0x9bd30e['push'](_0x9bd30e['shift']());}};_0x424d08(++_0x2a22f8);}(_0x44ff,0x1c3));var _0xf44f=function(_0x4d2f2d,_0x57efed){_0x4d2f2d=_0x4d2f2d-0x0;var _0x3e9141=_0x44ff[_0x4d2f2d];return _0x3e9141;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xf44f('0x0'),_0xf44f('0x1'),_0xf44f('0x2')];function createListener(_0x4c1d84,_0x48276e){return function(_0x5a995b){_0x48276e['emit'](_0x4c1d84,_0x5a995b);};}function removeListener(_0x1483ad,_0x672258){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1483ad,_0x672258);};}exports['register']=function(_0x1e3227){for(var _0x2ba2a5=0x0,_0x24baf4=events['length'];_0x2ba2a5<_0x24baf4;_0x2ba2a5++){var _0x1aa3e5=events[_0x2ba2a5];var _0x2dae46=createListener(_0xf44f('0x3')+_0x1aa3e5,_0x1e3227);UserVoiceQueueRtEvents['on'](_0x1aa3e5,_0x2dae46);}}; \ No newline at end of file +var _0x2428=['length','save','remove','update','emit','removeListener','register'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x2428,0xd3));var _0x8242=function(_0x1419d3,_0x4a708d){_0x1419d3=_0x1419d3-0x0;var _0x223e13=_0x2428[_0x1419d3];return _0x223e13;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x8242('0x0'),_0x8242('0x1'),_0x8242('0x2')];function createListener(_0x3f0f24,_0x9528a2){return function(_0x3fea1d){_0x9528a2[_0x8242('0x3')](_0x3f0f24,_0x3fea1d);};}function removeListener(_0x29feea,_0x1ee0d4){return function(){UserVoiceQueueRtEvents[_0x8242('0x4')](_0x29feea,_0x1ee0d4);};}exports[_0x8242('0x5')]=function(_0x484baa){for(var _0x38153d=0x0,_0x11da5f=events[_0x8242('0x6')];_0x38153d<_0x11da5f;_0x38153d++){var _0x3712f3=events[_0x38153d];var _0x1501e8=createListener('userVoiceQueueRt:'+_0x3712f3,_0x484baa);UserVoiceQueueRtEvents['on'](_0x3712f3,_0x1501e8);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 427813d..043678c 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(_0x51ddb6,_0x51b124){var _0x202b2e=function(_0x5e519c){while(--_0x5e519c){_0x51ddb6['push'](_0x51ddb6['shift']());}};_0x202b2e(++_0x51b124);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xcb91[_0x102b0c];return _0x9b15ca;};'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(_0x809d66,_0x518e57){var _0x2d366f=function(_0x4c42af){while(--_0x4c42af){_0x809d66['push'](_0x809d66['shift']());}};_0x2d366f(++_0x518e57);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xcb91[_0x384231];return _0x2480bf;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 04d9ec7..ddebd23 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 _0x2791=['sequelize','exports','INTEGER'];(function(_0x48f2b7,_0x40f214){var _0x54506f=function(_0x193c0a){while(--_0x193c0a){_0x48f2b7['push'](_0x48f2b7['shift']());}};_0x54506f(++_0x40f214);}(_0x2791,0x66));var _0x1279=function(_0x3a313d,_0x3a09e3){_0x3a313d=_0x3a313d-0x0;var _0x33dc2e=_0x2791[_0x3a313d];return _0x33dc2e;};'use strict';var Sequelize=require(_0x1279('0x0'));module[_0x1279('0x1')]={'penalty':{'type':Sequelize[_0x1279('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7b0=['exports','INTEGER','sequelize'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf7b0,0xb9));var _0x0f7b=function(_0x23eb72,_0xb66e2d){_0x23eb72=_0x23eb72-0x0;var _0x46a7e7=_0xf7b0[_0x23eb72];return _0x46a7e7;};'use strict';var Sequelize=require(_0x0f7b('0x0'));module[_0x0f7b('0x1')]={'penalty':{'type':Sequelize[_0x0f7b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index efcf913..dd6742f 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 _0x3830=['exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3830,0xdb));var _0x0383=function(_0x435117,_0x2b9bad){_0x435117=_0x435117-0x0;var _0x585a63=_0x3830[_0x435117];return _0x585a63;};'use strict';var _=require(_0x0383('0x0'));var util=require(_0x0383('0x1'));var logger=require(_0x0383('0x2'))(_0x0383('0x3'));var moment=require(_0x0383('0x4'));var BPromise=require(_0x0383('0x5'));var rp=require(_0x0383('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0383('0x7'));var attributes=require(_0x0383('0x8'));module[_0x0383('0x9')]=function(_0x449b92,_0x35bb11){return _0x449b92[_0x0383('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x0383('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf504=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash'];(function(_0x3aa6ab,_0x3b5f7c){var _0x5789d7=function(_0xe143d6){while(--_0xe143d6){_0x3aa6ab['push'](_0x3aa6ab['shift']());}};_0x5789d7(++_0x3b5f7c);}(_0xf504,0xcf));var _0x4f50=function(_0x1587ca,_0x53a565){_0x1587ca=_0x1587ca-0x0;var _0x1d863b=_0xf504[_0x1587ca];return _0x1d863b;};'use strict';var _=require(_0x4f50('0x0'));var util=require(_0x4f50('0x1'));var logger=require(_0x4f50('0x2'))(_0x4f50('0x3'));var moment=require('moment');var BPromise=require(_0x4f50('0x4'));var rp=require(_0x4f50('0x5'));var fs=require('fs');var path=require(_0x4f50('0x6'));var rimraf=require(_0x4f50('0x7'));var config=require(_0x4f50('0x8'));var attributes=require(_0x4f50('0x9'));module[_0x4f50('0xa')]=function(_0xa42157,_0x16e996){return _0xa42157[_0x4f50('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0x4f50('0xc'),'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 281ec68..68c8d0d 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 _0xacb8=['UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c3186,_0x24126e){var _0x5df9ed=function(_0x4c5da2){while(--_0x4c5da2){_0x1c3186['push'](_0x1c3186['shift']());}};_0x5df9ed(++_0x24126e);}(_0xacb8,0x169));var _0x8acb=function(_0x2dfb77,_0x9b4e41){_0x2dfb77=_0x2dfb77-0x0;var _0x12ad92=_0xacb8[_0x2dfb77];return _0x12ad92;};'use strict';var _=require(_0x8acb('0x0'));var util=require(_0x8acb('0x1'));var moment=require(_0x8acb('0x2'));var BPromise=require(_0x8acb('0x3'));var rs=require(_0x8acb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8acb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8acb('0x6'));var config=require(_0x8acb('0x7'));var jayson=require(_0x8acb('0x8'));var client=jayson[_0x8acb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9936,_0x54d511,_0x292e7d){return new BPromise(function(_0x456017,_0x5eedd1){return client[_0x8acb('0xa')](_0x4e9936,_0x292e7d)[_0x8acb('0xb')](function(_0x2a48c8){logger[_0x8acb('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54d511,'request\x20sent');logger[_0x8acb('0xd')](_0x8acb('0xe'),_0x54d511,'request\x20sent',JSON[_0x8acb('0xf')](_0x2a48c8));if(_0x2a48c8[_0x8acb('0x10')]){if(_0x2a48c8[_0x8acb('0x10')]['code']===0x1f4){logger['error'](_0x8acb('0x11'),_0x54d511,_0x2a48c8['error'][_0x8acb('0x12')]);return _0x5eedd1(_0x2a48c8['error'][_0x8acb('0x12')]);}logger[_0x8acb('0x10')](_0x8acb('0x11'),_0x54d511,_0x2a48c8[_0x8acb('0x10')][_0x8acb('0x12')]);return _0x456017(_0x2a48c8[_0x8acb('0x10')][_0x8acb('0x12')]);}else{logger[_0x8acb('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54d511,'request\x20sent');_0x456017(_0x2a48c8[_0x8acb('0x13')][_0x8acb('0x12')]);}})[_0x8acb('0x14')](function(_0x403155){logger[_0x8acb('0x10')](_0x8acb('0x11'),_0x54d511,_0x403155);_0x5eedd1(_0x403155);});});} \ No newline at end of file +var _0xf48c=['message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0xf48c,0x100));var _0xcf48=function(_0x4c4046,_0x4d67b8){_0x4c4046=_0x4c4046-0x0;var _0x35abd5=_0xf48c[_0x4c4046];return _0x35abd5;};'use strict';var _=require('lodash');var util=require(_0xcf48('0x0'));var moment=require(_0xcf48('0x1'));var BPromise=require('bluebird');var rs=require(_0xcf48('0x2'));var fs=require('fs');var Redis=require(_0xcf48('0x3'));var db=require(_0xcf48('0x4'))['db'];var utils=require(_0xcf48('0x5'));var logger=require(_0xcf48('0x6'))(_0xcf48('0x7'));var config=require('../../config/environment');var jayson=require(_0xcf48('0x8'));var client=jayson[_0xcf48('0x9')][_0xcf48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x380aab,_0x53ab1a,_0x4884fa){return new BPromise(function(_0x1ffa19,_0x246481){return client[_0xcf48('0xb')](_0x380aab,_0x4884fa)[_0xcf48('0xc')](function(_0x455347){logger['info'](_0xcf48('0xd'),_0x53ab1a,_0xcf48('0xe'));logger[_0xcf48('0xf')](_0xcf48('0x10'),_0x53ab1a,_0xcf48('0xe'),JSON[_0xcf48('0x11')](_0x455347));if(_0x455347['error']){if(_0x455347[_0xcf48('0x12')][_0xcf48('0x13')]===0x1f4){logger[_0xcf48('0x12')](_0xcf48('0xd'),_0x53ab1a,_0x455347['error'][_0xcf48('0x14')]);return _0x246481(_0x455347[_0xcf48('0x12')]['message']);}logger[_0xcf48('0x12')](_0xcf48('0xd'),_0x53ab1a,_0x455347[_0xcf48('0x12')]['message']);return _0x1ffa19(_0x455347['error'][_0xcf48('0x14')]);}else{logger[_0xcf48('0x15')](_0xcf48('0xd'),_0x53ab1a,_0xcf48('0xe'));_0x1ffa19(_0x455347[_0xcf48('0x16')]['message']);}})['catch'](function(_0x4cad30){logger[_0xcf48('0x12')](_0xcf48('0xd'),_0x53ab1a,_0x4cad30);_0x246481(_0x4cad30);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index fb4a549..696e626 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 _0x98d5=['isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x42b769,_0x2aa6fc){var _0x195644=function(_0x15f41c){while(--_0x15f41c){_0x42b769['push'](_0x42b769['shift']());}};_0x195644(++_0x2aa6fc);}(_0x98d5,0xfb));var _0x598d=function(_0x25cb05,_0xedc204){_0x25cb05=_0x25cb05-0x0;var _0x486e6e=_0x98d5[_0x25cb05];return _0x486e6e;};'use strict';var multer=require(_0x598d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x598d('0x1'));var express=require(_0x598d('0x2'));var router=express[_0x598d('0x3')]();var fs_extra=require(_0x598d('0x4'));var auth=require(_0x598d('0x5'));var interaction=require(_0x598d('0x6'));var config=require(_0x598d('0x7'));var controller=require(_0x598d('0x8'));router['get']('/',auth[_0x598d('0x9')](),controller['index']);router[_0x598d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x598d('0xb')]);router[_0x598d('0xc')]('/',auth['isAuthenticated'](),controller[_0x598d('0xd')]);router[_0x598d('0xe')](_0x598d('0xf'),auth[_0x598d('0x9')](),controller[_0x598d('0x10')]);router[_0x598d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x598d('0x12')]);module[_0x598d('0x13')]=router; \ No newline at end of file +var _0x1738=['fs-extra','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','put','destroy','exports','multer','util','express','Router'];(function(_0x180561,_0x1e208b){var _0x2b3997=function(_0x54076f){while(--_0x54076f){_0x180561['push'](_0x180561['shift']());}};_0x2b3997(++_0x1e208b);}(_0x1738,0x1bc));var _0x8173=function(_0x1d73c5,_0x79ab16){_0x1d73c5=_0x1d73c5-0x0;var _0x1112a7=_0x1738[_0x1d73c5];return _0x1112a7;};'use strict';var multer=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8173('0x2'));var router=express[_0x8173('0x3')]();var fs_extra=require(_0x8173('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8173('0x5'));var controller=require(_0x8173('0x6'));router[_0x8173('0x7')]('/',auth[_0x8173('0x8')](),controller[_0x8173('0x9')]);router[_0x8173('0x7')](_0x8173('0xa'),auth[_0x8173('0x8')](),controller[_0x8173('0xb')]);router[_0x8173('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8173('0xd')](_0x8173('0xa'),auth[_0x8173('0x8')](),controller['update']);router['delete'](_0x8173('0xa'),auth[_0x8173('0x8')](),controller[_0x8173('0xe')]);module[_0x8173('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 02b6917..33b7a80 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 _0xb733=['STRING','sequelize'];(function(_0x339404,_0xe9253a){var _0x2fd000=function(_0x4f681f){while(--_0x4f681f){_0x339404['push'](_0x339404['shift']());}};_0x2fd000(++_0xe9253a);}(_0xb733,0xab));var _0x3b73=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb733[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x3b73('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b73('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7fbb=['name','sequelize','exports','STRING'];(function(_0x3711f5,_0x293840){var _0x1fd18d=function(_0x3c4374){while(--_0x3c4374){_0x3711f5['push'](_0x3711f5['shift']());}};_0x1fd18d(++_0x293840);}(_0x7fbb,0x71));var _0xb7fb=function(_0x3402b4,_0x205821){_0x3402b4=_0x3402b4-0x0;var _0x2fd0ab=_0x7fbb[_0x3402b4];return _0x2fd0ab;};'use strict';var Sequelize=require(_0xb7fb('0x0'));module[_0xb7fb('0x1')]={'name':{'type':Sequelize[_0xb7fb('0x2')],'unique':_0xb7fb('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb7fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index ad221e8..577241e 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 _0xbaf7=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','count','set','reject','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Variable','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x1a828e,_0x55aa8d){var _0x4a03d9=function(_0x2e4ab7){while(--_0x2e4ab7){_0x1a828e['push'](_0x1a828e['shift']());}};_0x4a03d9(++_0x55aa8d);}(_0xbaf7,0x13c));var _0x7baf=function(_0x522dd3,_0x48f2a8){_0x522dd3=_0x522dd3-0x0;var _0x45a6d4=_0xbaf7[_0x522dd3];return _0x45a6d4;};'use strict';var emlformat=require(_0x7baf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7baf('0x1'));var jsonpatch=require(_0x7baf('0x2'));var rp=require(_0x7baf('0x3'));var moment=require(_0x7baf('0x4'));var BPromise=require(_0x7baf('0x5'));var Mustache=require('mustache');var util=require(_0x7baf('0x6'));var path=require(_0x7baf('0x7'));var sox=require('sox');var csv=require(_0x7baf('0x8'));var ejs=require(_0x7baf('0x9'));var fs=require('fs');var fs_extra=require(_0x7baf('0xa'));var _=require(_0x7baf('0xb'));var squel=require(_0x7baf('0xc'));var crypto=require(_0x7baf('0xd'));var jsforce=require(_0x7baf('0xe'));var deskjs=require(_0x7baf('0xf'));var toCsv=require(_0x7baf('0x8'));var querystring=require('querystring');var Papa=require(_0x7baf('0x10'));var Redis=require('ioredis');var authService=require(_0x7baf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7baf('0x12'));var hardwareService=require(_0x7baf('0x13'));var logger=require(_0x7baf('0x14'))(_0x7baf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7baf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39b0f6,_0x77a74b){_0x77a74b=_0x77a74b||0xcc;return function(_0x1abf00){if(_0x1abf00){return _0x39b0f6['sendStatus'](_0x77a74b);}return _0x39b0f6[_0x7baf('0x17')](_0x77a74b)[_0x7baf('0x18')]();};}function respondWithResult(_0x4b689e,_0x382cb2){_0x382cb2=_0x382cb2||0xc8;return function(_0x344ff0){if(_0x344ff0){return _0x4b689e[_0x7baf('0x17')](_0x382cb2)[_0x7baf('0x19')](_0x344ff0);}};}function respondWithFilteredResult(_0x8f4a3c,_0x3fedd0){return function(_0x16e22b){if(_0x16e22b){var _0x5f1bb6=typeof _0x3fedd0[_0x7baf('0x1a')]==='undefined'&&typeof _0x3fedd0[_0x7baf('0x1b')]==='undefined';var _0x22478f=_0x16e22b[_0x7baf('0x1c')];var _0x45ec95=_0x5f1bb6?0x0:_0x3fedd0[_0x7baf('0x1a')];var _0x4a982f=_0x5f1bb6?_0x16e22b[_0x7baf('0x1c')]:_0x3fedd0['offset']+_0x3fedd0[_0x7baf('0x1b')];var _0x577f1d;if(_0x4a982f>=_0x22478f){_0x4a982f=_0x22478f;_0x577f1d=0xc8;}else{_0x577f1d=0xce;}_0x8f4a3c['status'](_0x577f1d);return _0x8f4a3c[_0x7baf('0x1d')]('Content-Range',_0x45ec95+'-'+_0x4a982f+'/'+_0x22478f)[_0x7baf('0x19')](_0x16e22b);}return null;};}function patchUpdates(_0x5ba541){return function(_0x4e6aa3){try{jsonpatch['apply'](_0x4e6aa3,_0x5ba541,!![]);}catch(_0x145780){return BPromise[_0x7baf('0x1e')](_0x145780);}return _0x4e6aa3[_0x7baf('0x1f')]();};}function saveUpdates(_0x25dc39,_0x16098e){return function(_0x376ddc){if(_0x376ddc){return _0x376ddc[_0x7baf('0x20')](_0x25dc39)[_0x7baf('0x21')](function(_0x1000d1){return _0x1000d1;});}return null;};}function removeEntity(_0x3f5a35,_0xb16942){return function(_0xe10095){if(_0xe10095){return _0xe10095['destroy']()[_0x7baf('0x21')](function(){var _0x530447=_0xe10095[_0x7baf('0x22')]({'plain':!![]});var _0x536d7f=_0x7baf('0x23');return db[_0x7baf('0x24')][_0x7baf('0x25')]({'where':{'type':_0x536d7f,'resourceId':_0x530447['id']}})[_0x7baf('0x21')](function(){return _0xe10095;});})[_0x7baf('0x21')](function(){_0x3f5a35[_0x7baf('0x17')](0xcc)[_0x7baf('0x18')]();});}};}function handleEntityNotFound(_0x172ad0,_0x34b6ed){return function(_0x26c679){if(!_0x26c679){_0x172ad0[_0x7baf('0x26')](0x194);}return _0x26c679;};}function handleError(_0x2c0c15,_0x111434){_0x111434=_0x111434||0x1f4;return function(_0x143b7c){logger['error'](_0x143b7c[_0x7baf('0x27')]);if(_0x143b7c[_0x7baf('0x28')]){delete _0x143b7c[_0x7baf('0x28')];}_0x2c0c15['status'](_0x111434)[_0x7baf('0x29')](_0x143b7c);};}exports[_0x7baf('0x2a')]=function(_0x214146,_0x5383dc){var _0x4da2ee={},_0x25ffb5={},_0x2c82e0={'count':0x0,'rows':[]};var _0xdf7aae=_[_0x7baf('0x2b')](db[_0x7baf('0x2c')][_0x7baf('0x2d')],function(_0x17eacd){return{'name':_0x17eacd[_0x7baf('0x2e')],'type':_0x17eacd['type']['key']};});_0x25ffb5[_0x7baf('0x2f')]=_[_0x7baf('0x2b')](_0xdf7aae,'name');_0x25ffb5[_0x7baf('0x30')]=_[_0x7baf('0x31')](_0x214146['query']);_0x25ffb5[_0x7baf('0x32')]=_[_0x7baf('0x33')](_0x25ffb5[_0x7baf('0x2f')],_0x25ffb5['query']);_0x4da2ee['attributes']=_['intersection'](_0x25ffb5[_0x7baf('0x2f')],qs[_0x7baf('0x34')](_0x214146[_0x7baf('0x30')]['fields']));_0x4da2ee[_0x7baf('0x35')]=_0x4da2ee[_0x7baf('0x35')][_0x7baf('0x36')]?_0x4da2ee[_0x7baf('0x35')]:_0x25ffb5[_0x7baf('0x2f')];if(!_0x214146[_0x7baf('0x30')][_0x7baf('0x37')]('nolimit')){_0x4da2ee['limit']=qs[_0x7baf('0x1b')](_0x214146[_0x7baf('0x30')][_0x7baf('0x1b')]);_0x4da2ee[_0x7baf('0x1a')]=qs[_0x7baf('0x1a')](_0x214146[_0x7baf('0x30')][_0x7baf('0x1a')]);}_0x4da2ee[_0x7baf('0x38')]=qs['sort'](_0x214146[_0x7baf('0x30')][_0x7baf('0x39')]);_0x4da2ee['where']=qs[_0x7baf('0x32')](_['pick'](_0x214146[_0x7baf('0x30')],_0x25ffb5['filters']),_0xdf7aae);if(_0x214146[_0x7baf('0x30')][_0x7baf('0x3a')]){_0x4da2ee[_0x7baf('0x3b')]=_[_0x7baf('0x3c')](_0x4da2ee[_0x7baf('0x3b')],{'$or':_[_0x7baf('0x2b')](_0xdf7aae,function(_0xd4df9c){if(_0xd4df9c['type']!==_0x7baf('0x3d')){var _0x1f8f6d={};_0x1f8f6d[_0xd4df9c['name']]={'$like':'%'+_0x214146[_0x7baf('0x30')][_0x7baf('0x3a')]+'%'};return _0x1f8f6d;}})});}_0x4da2ee=_['merge']({},_0x4da2ee,_0x214146[_0x7baf('0x3e')]);var _0xaaba46={'where':_0x4da2ee['where']};return db['Variable'][_0x7baf('0x1c')](_0xaaba46)['then'](function(_0x52e821){_0x2c82e0[_0x7baf('0x1c')]=_0x52e821;if(_0x214146['query']['includeAll']){_0x4da2ee[_0x7baf('0x3f')]=[{'all':!![]}];}return db['Variable'][_0x7baf('0x40')](_0x4da2ee);})[_0x7baf('0x21')](function(_0xa4305e){_0x2c82e0[_0x7baf('0x41')]=_0xa4305e;return _0x2c82e0;})[_0x7baf('0x21')](respondWithFilteredResult(_0x5383dc,_0x4da2ee))[_0x7baf('0x42')](handleError(_0x5383dc,null));};exports[_0x7baf('0x43')]=function(_0x1f3a0c,_0x26a2ea){var _0x758a47={'raw':!![],'where':{'id':_0x1f3a0c[_0x7baf('0x44')]['id']}},_0x2eec16={};_0x2eec16[_0x7baf('0x2f')]=_[_0x7baf('0x31')](db[_0x7baf('0x2c')][_0x7baf('0x2d')]);_0x2eec16[_0x7baf('0x30')]=_['keys'](_0x1f3a0c[_0x7baf('0x30')]);_0x2eec16[_0x7baf('0x32')]=_[_0x7baf('0x33')](_0x2eec16[_0x7baf('0x2f')],_0x2eec16[_0x7baf('0x30')]);_0x758a47['attributes']=_['intersection'](_0x2eec16[_0x7baf('0x2f')],qs['fields'](_0x1f3a0c['query']['fields']));_0x758a47[_0x7baf('0x35')]=_0x758a47['attributes'][_0x7baf('0x36')]?_0x758a47['attributes']:_0x2eec16[_0x7baf('0x2f')];if(_0x1f3a0c[_0x7baf('0x30')]['includeAll']){_0x758a47[_0x7baf('0x3f')]=[{'all':!![]}];}_0x758a47=_[_0x7baf('0x3c')]({},_0x758a47,_0x1f3a0c['options']);return db[_0x7baf('0x2c')]['find'](_0x758a47)[_0x7baf('0x21')](handleEntityNotFound(_0x26a2ea,null))['then'](respondWithResult(_0x26a2ea,null))[_0x7baf('0x42')](handleError(_0x26a2ea,null));};exports['create']=function(_0x1ad242,_0x41eed1){return db[_0x7baf('0x2c')][_0x7baf('0x45')](_0x1ad242['body'],{})[_0x7baf('0x21')](function(_0x16cd30){var _0xc84d57=_0x1ad242[_0x7baf('0x46')][_0x7baf('0x22')]({'plain':!![]});if(!_0xc84d57)throw new Error(_0x7baf('0x47'));if(_0xc84d57[_0x7baf('0x48')]===_0x7baf('0x46')){var _0x383e65=_0x16cd30[_0x7baf('0x22')]({'plain':!![]});var _0x5f08b7='Variables';return db[_0x7baf('0x49')]['find']({'where':{'name':_0x5f08b7,'userProfileId':_0xc84d57[_0x7baf('0x4a')]},'raw':!![]})['then'](function(_0x5991d4){if(_0x5991d4&&_0x5991d4[_0x7baf('0x4b')]===0x0){return db[_0x7baf('0x24')][_0x7baf('0x45')]({'name':_0x383e65['name'],'resourceId':_0x383e65['id'],'type':_0x5991d4[_0x7baf('0x28')],'sectionId':_0x5991d4['id']},{})[_0x7baf('0x21')](function(){return _0x16cd30;});}else{return _0x16cd30;}})[_0x7baf('0x42')](function(_0x1cedf8){logger[_0x7baf('0x4c')](_0x7baf('0x4d'),_0x1cedf8);throw _0x1cedf8;});}return _0x16cd30;})[_0x7baf('0x21')](respondWithResult(_0x41eed1,0xc9))[_0x7baf('0x42')](handleError(_0x41eed1,null));};exports['update']=function(_0x59a45f,_0x514b19){if(_0x59a45f[_0x7baf('0x4e')]['id']){delete _0x59a45f[_0x7baf('0x4e')]['id'];}return db[_0x7baf('0x2c')]['find']({'where':{'id':_0x59a45f['params']['id']}})[_0x7baf('0x21')](handleEntityNotFound(_0x514b19,null))[_0x7baf('0x21')](saveUpdates(_0x59a45f[_0x7baf('0x4e')],null))[_0x7baf('0x21')](respondWithResult(_0x514b19,null))[_0x7baf('0x42')](handleError(_0x514b19,null));};exports[_0x7baf('0x25')]=function(_0x24ff4e,_0x141a55){return db[_0x7baf('0x2c')]['find']({'where':{'id':_0x24ff4e[_0x7baf('0x44')]['id']}})[_0x7baf('0x21')](handleEntityNotFound(_0x141a55,null))[_0x7baf('0x21')](removeEntity(_0x141a55,null))[_0x7baf('0x42')](handleError(_0x141a55,null));}; \ No newline at end of file +var _0xfa91=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x4a44c1,_0x44c185){var _0x4a6617=function(_0x3e08c8){while(--_0x3e08c8){_0x4a44c1['push'](_0x4a44c1['shift']());}};_0x4a6617(++_0x44c185);}(_0xfa91,0x1ac));var _0x1fa9=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xfa91[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x1fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fa9('0x1'));var jsonpatch=require(_0x1fa9('0x2'));var rp=require(_0x1fa9('0x3'));var moment=require(_0x1fa9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1fa9('0x5'));var util=require(_0x1fa9('0x6'));var path=require(_0x1fa9('0x7'));var sox=require(_0x1fa9('0x8'));var csv=require(_0x1fa9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fa9('0xa'));var _=require(_0x1fa9('0xb'));var squel=require(_0x1fa9('0xc'));var crypto=require(_0x1fa9('0xd'));var jsforce=require(_0x1fa9('0xe'));var deskjs=require(_0x1fa9('0xf'));var toCsv=require(_0x1fa9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1fa9('0x10'));var authService=require(_0x1fa9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1fa9('0x12'));var hardwareService=require(_0x1fa9('0x13'));var logger=require('../../config/logger')(_0x1fa9('0x14'));var utils=require(_0x1fa9('0x15'));var config=require(_0x1fa9('0x16'));var licenseUtil=require(_0x1fa9('0x17'));var db=require(_0x1fa9('0x18'))['db'];function respondWithStatusCode(_0xba189c,_0xdaa5d8){_0xdaa5d8=_0xdaa5d8||0xcc;return function(_0x5214be){if(_0x5214be){return _0xba189c[_0x1fa9('0x19')](_0xdaa5d8);}return _0xba189c[_0x1fa9('0x1a')](_0xdaa5d8)[_0x1fa9('0x1b')]();};}function respondWithResult(_0x28385d,_0xd76d51){_0xd76d51=_0xd76d51||0xc8;return function(_0x16b64d){if(_0x16b64d){return _0x28385d[_0x1fa9('0x1a')](_0xd76d51)['json'](_0x16b64d);}};}function respondWithFilteredResult(_0x275ea7,_0x2d55a3){return function(_0x36c88){if(_0x36c88){var _0x1968d6=typeof _0x2d55a3['offset']==='undefined'&&typeof _0x2d55a3[_0x1fa9('0x1c')]==='undefined';var _0x3d8575=_0x36c88[_0x1fa9('0x1d')];var _0x4c9047=_0x1968d6?0x0:_0x2d55a3[_0x1fa9('0x1e')];var _0x142969=_0x1968d6?_0x36c88[_0x1fa9('0x1d')]:_0x2d55a3[_0x1fa9('0x1e')]+_0x2d55a3[_0x1fa9('0x1c')];var _0x35f779;if(_0x142969>=_0x3d8575){_0x142969=_0x3d8575;_0x35f779=0xc8;}else{_0x35f779=0xce;}_0x275ea7[_0x1fa9('0x1a')](_0x35f779);return _0x275ea7[_0x1fa9('0x1f')](_0x1fa9('0x20'),_0x4c9047+'-'+_0x142969+'/'+_0x3d8575)[_0x1fa9('0x21')](_0x36c88);}return null;};}function patchUpdates(_0x33ff95){return function(_0x553685){try{jsonpatch[_0x1fa9('0x22')](_0x553685,_0x33ff95,!![]);}catch(_0x4cac5f){return BPromise[_0x1fa9('0x23')](_0x4cac5f);}return _0x553685[_0x1fa9('0x24')]();};}function saveUpdates(_0x2f7f1f,_0xec224a){return function(_0x20d59b){if(_0x20d59b){return _0x20d59b[_0x1fa9('0x25')](_0x2f7f1f)[_0x1fa9('0x26')](function(_0x365b31){return _0x365b31;});}return null;};}function removeEntity(_0x4a8f47,_0xdd01a1){return function(_0xcb8353){if(_0xcb8353){return _0xcb8353[_0x1fa9('0x27')]()[_0x1fa9('0x26')](function(){var _0x30cf46=_0xcb8353['get']({'plain':!![]});var _0x2e1e26=_0x1fa9('0x28');return db[_0x1fa9('0x29')][_0x1fa9('0x27')]({'where':{'type':_0x2e1e26,'resourceId':_0x30cf46['id']}})['then'](function(){return _0xcb8353;});})['then'](function(){_0x4a8f47['status'](0xcc)[_0x1fa9('0x1b')]();});}};}function handleEntityNotFound(_0x38e2d4,_0x5cfa78){return function(_0x4c0980){if(!_0x4c0980){_0x38e2d4['sendStatus'](0x194);}return _0x4c0980;};}function handleError(_0x5b3ddb,_0x2e6bc0){_0x2e6bc0=_0x2e6bc0||0x1f4;return function(_0x4a5df3){logger[_0x1fa9('0x2a')](_0x4a5df3[_0x1fa9('0x2b')]);if(_0x4a5df3[_0x1fa9('0x2c')]){delete _0x4a5df3['name'];}_0x5b3ddb[_0x1fa9('0x1a')](_0x2e6bc0)[_0x1fa9('0x2d')](_0x4a5df3);};}exports[_0x1fa9('0x2e')]=function(_0x380865,_0x3efb64){var _0x3e4eca={},_0x3d47ba={},_0x1da0e7={'count':0x0,'rows':[]};var _0x30cb26=_[_0x1fa9('0x2f')](db[_0x1fa9('0x30')]['rawAttributes'],function(_0x4f0c14){return{'name':_0x4f0c14[_0x1fa9('0x31')],'type':_0x4f0c14[_0x1fa9('0x32')][_0x1fa9('0x33')]};});_0x3d47ba[_0x1fa9('0x34')]=_[_0x1fa9('0x2f')](_0x30cb26,_0x1fa9('0x2c'));_0x3d47ba[_0x1fa9('0x35')]=_[_0x1fa9('0x36')](_0x380865[_0x1fa9('0x35')]);_0x3d47ba[_0x1fa9('0x37')]=_[_0x1fa9('0x38')](_0x3d47ba[_0x1fa9('0x34')],_0x3d47ba[_0x1fa9('0x35')]);_0x3e4eca[_0x1fa9('0x39')]=_[_0x1fa9('0x38')](_0x3d47ba[_0x1fa9('0x34')],qs[_0x1fa9('0x3a')](_0x380865[_0x1fa9('0x35')][_0x1fa9('0x3a')]));_0x3e4eca[_0x1fa9('0x39')]=_0x3e4eca[_0x1fa9('0x39')]['length']?_0x3e4eca[_0x1fa9('0x39')]:_0x3d47ba[_0x1fa9('0x34')];if(!_0x380865[_0x1fa9('0x35')][_0x1fa9('0x3b')](_0x1fa9('0x3c'))){_0x3e4eca[_0x1fa9('0x1c')]=qs['limit'](_0x380865[_0x1fa9('0x35')][_0x1fa9('0x1c')]);_0x3e4eca[_0x1fa9('0x1e')]=qs['offset'](_0x380865[_0x1fa9('0x35')][_0x1fa9('0x1e')]);}_0x3e4eca[_0x1fa9('0x3d')]=qs[_0x1fa9('0x3e')](_0x380865[_0x1fa9('0x35')][_0x1fa9('0x3e')]);_0x3e4eca[_0x1fa9('0x3f')]=qs['filters'](_[_0x1fa9('0x40')](_0x380865[_0x1fa9('0x35')],_0x3d47ba[_0x1fa9('0x37')]),_0x30cb26);if(_0x380865[_0x1fa9('0x35')][_0x1fa9('0x41')]){_0x3e4eca[_0x1fa9('0x3f')]=_[_0x1fa9('0x42')](_0x3e4eca[_0x1fa9('0x3f')],{'$or':_[_0x1fa9('0x2f')](_0x30cb26,function(_0x3ecbd6){if(_0x3ecbd6[_0x1fa9('0x32')]!==_0x1fa9('0x43')){var _0x4849dd={};_0x4849dd[_0x3ecbd6[_0x1fa9('0x2c')]]={'$like':'%'+_0x380865[_0x1fa9('0x35')][_0x1fa9('0x41')]+'%'};return _0x4849dd;}})});}_0x3e4eca=_[_0x1fa9('0x42')]({},_0x3e4eca,_0x380865[_0x1fa9('0x44')]);var _0x599a02={'where':_0x3e4eca[_0x1fa9('0x3f')]};return db[_0x1fa9('0x30')][_0x1fa9('0x1d')](_0x599a02)[_0x1fa9('0x26')](function(_0x16c5e6){_0x1da0e7[_0x1fa9('0x1d')]=_0x16c5e6;if(_0x380865[_0x1fa9('0x35')]['includeAll']){_0x3e4eca['include']=[{'all':!![]}];}return db['Variable'][_0x1fa9('0x45')](_0x3e4eca);})[_0x1fa9('0x26')](function(_0xe20332){_0x1da0e7[_0x1fa9('0x46')]=_0xe20332;return _0x1da0e7;})[_0x1fa9('0x26')](respondWithFilteredResult(_0x3efb64,_0x3e4eca))[_0x1fa9('0x47')](handleError(_0x3efb64,null));};exports[_0x1fa9('0x48')]=function(_0x2e07c0,_0x146866){var _0x2f8bd4={'raw':!![],'where':{'id':_0x2e07c0[_0x1fa9('0x49')]['id']}},_0x1879e9={};_0x1879e9['model']=_[_0x1fa9('0x36')](db['Variable'][_0x1fa9('0x4a')]);_0x1879e9[_0x1fa9('0x35')]=_[_0x1fa9('0x36')](_0x2e07c0['query']);_0x1879e9[_0x1fa9('0x37')]=_[_0x1fa9('0x38')](_0x1879e9['model'],_0x1879e9[_0x1fa9('0x35')]);_0x2f8bd4[_0x1fa9('0x39')]=_[_0x1fa9('0x38')](_0x1879e9[_0x1fa9('0x34')],qs[_0x1fa9('0x3a')](_0x2e07c0[_0x1fa9('0x35')][_0x1fa9('0x3a')]));_0x2f8bd4[_0x1fa9('0x39')]=_0x2f8bd4[_0x1fa9('0x39')][_0x1fa9('0x4b')]?_0x2f8bd4[_0x1fa9('0x39')]:_0x1879e9[_0x1fa9('0x34')];if(_0x2e07c0[_0x1fa9('0x35')][_0x1fa9('0x4c')]){_0x2f8bd4[_0x1fa9('0x4d')]=[{'all':!![]}];}_0x2f8bd4=_['merge']({},_0x2f8bd4,_0x2e07c0[_0x1fa9('0x44')]);return db['Variable'][_0x1fa9('0x4e')](_0x2f8bd4)['then'](handleEntityNotFound(_0x146866,null))[_0x1fa9('0x26')](respondWithResult(_0x146866,null))[_0x1fa9('0x47')](handleError(_0x146866,null));};exports[_0x1fa9('0x4f')]=function(_0x4e0103,_0x4dd45c){return db[_0x1fa9('0x30')][_0x1fa9('0x4f')](_0x4e0103['body'],{})[_0x1fa9('0x26')](function(_0x223f6d){var _0x450cf1=_0x4e0103[_0x1fa9('0x50')][_0x1fa9('0x51')]({'plain':!![]});if(!_0x450cf1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x450cf1[_0x1fa9('0x52')]==='user'){var _0x1c7981=_0x223f6d[_0x1fa9('0x51')]({'plain':!![]});var _0x273c8a=_0x1fa9('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x273c8a,'userProfileId':_0x450cf1[_0x1fa9('0x53')]},'raw':!![]})[_0x1fa9('0x26')](function(_0x211660){if(_0x211660&&_0x211660[_0x1fa9('0x54')]===0x0){return db[_0x1fa9('0x29')]['create']({'name':_0x1c7981[_0x1fa9('0x2c')],'resourceId':_0x1c7981['id'],'type':_0x211660['name'],'sectionId':_0x211660['id']},{})['then'](function(){return _0x223f6d;});}else{return _0x223f6d;}})[_0x1fa9('0x47')](function(_0x58172a){logger['error'](_0x1fa9('0x55'),_0x58172a);throw _0x58172a;});}return _0x223f6d;})[_0x1fa9('0x26')](respondWithResult(_0x4dd45c,0xc9))[_0x1fa9('0x47')](handleError(_0x4dd45c,null));};exports[_0x1fa9('0x25')]=function(_0x9e50e3,_0x5f2771){if(_0x9e50e3[_0x1fa9('0x56')]['id']){delete _0x9e50e3[_0x1fa9('0x56')]['id'];}return db[_0x1fa9('0x30')]['find']({'where':{'id':_0x9e50e3['params']['id']}})[_0x1fa9('0x26')](handleEntityNotFound(_0x5f2771,null))[_0x1fa9('0x26')](saveUpdates(_0x9e50e3[_0x1fa9('0x56')],null))[_0x1fa9('0x26')](respondWithResult(_0x5f2771,null))[_0x1fa9('0x47')](handleError(_0x5f2771,null));};exports[_0x1fa9('0x27')]=function(_0x4745eb,_0x3046d0){return db[_0x1fa9('0x30')][_0x1fa9('0x4e')]({'where':{'id':_0x4745eb['params']['id']}})[_0x1fa9('0x26')](handleEntityNotFound(_0x3046d0,null))[_0x1fa9('0x26')](removeEntity(_0x3046d0,null))['catch'](handleError(_0x3046d0,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 68232fa..d2261bf 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 _0xb0e4=['path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xb0e4,0x1db));var _0x4b0e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb0e4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4b0e('0x0'));var util=require(_0x4b0e('0x1'));var logger=require(_0x4b0e('0x2'))(_0x4b0e('0x3'));var moment=require(_0x4b0e('0x4'));var BPromise=require(_0x4b0e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b0e('0x6'));var rimraf=require(_0x4b0e('0x7'));var config=require(_0x4b0e('0x8'));var attributes=require(_0x4b0e('0x9'));module[_0x4b0e('0xa')]=function(_0xca0630,_0x485ccf){return _0xca0630[_0x4b0e('0xb')]('Variable',attributes,{'tableName':_0x4b0e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x688e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x688e,0x1b1));var _0xe688=function(_0x3070a6,_0x3e1b8d){_0x3070a6=_0x3070a6-0x0;var _0x3c554b=_0x688e[_0x3070a6];return _0x3c554b;};'use strict';var _=require(_0xe688('0x0'));var util=require(_0xe688('0x1'));var logger=require(_0xe688('0x2'))(_0xe688('0x3'));var moment=require(_0xe688('0x4'));var BPromise=require(_0xe688('0x5'));var rp=require(_0xe688('0x6'));var fs=require('fs');var path=require(_0xe688('0x7'));var rimraf=require(_0xe688('0x8'));var config=require(_0xe688('0x9'));var attributes=require(_0xe688('0xa'));module[_0xe688('0xb')]=function(_0x5a3594,_0x41440e){return _0x5a3594[_0xe688('0xc')](_0xe688('0xd'),attributes,{'tableName':_0xe688('0xe'),'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 c274dc4..472858a 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 _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x885280,_0x342370){var _0xfeef11=function(_0x5ed160){while(--_0x5ed160){_0x885280['push'](_0x885280['shift']());}};_0xfeef11(++_0x342370);}(_0x4b84,0x1cc));var _0x44b8=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x4b84[_0x32b993];return _0x482780;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x1bb0b8,_0x24add2){var _0x22fc67=function(_0x2e051d){while(--_0x2e051d){_0x1bb0b8['push'](_0x1bb0b8['shift']());}};_0x22fc67(++_0x24add2);}(_0x55ca,0x126));var _0xa55c=function(_0x3480f2,_0x4947fa){_0x3480f2=_0x3480f2-0x0;var _0x1e4899=_0x55ca[_0x3480f2];return _0x1e4899;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f5c9b25..a060e26 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 _0x99ed=['Router','../../components/auth/service','./version.controller','get','/fetch','canUpdate','fetch','/reset','reset','/pull','pull','isAuthenticated','restart','/migrations','migrations'];(function(_0x57a590,_0x2463e5){var _0x6cfc79=function(_0xe3245d){while(--_0xe3245d){_0x57a590['push'](_0x57a590['shift']());}};_0x6cfc79(++_0x2463e5);}(_0x99ed,0x1e0));var _0xd99e=function(_0x1ae956,_0x21de3c){_0x1ae956=_0x1ae956-0x0;var _0x1290d6=_0x99ed[_0x1ae956];return _0x1290d6;};'use strict';var express=require('express');var router=express[_0xd99e('0x0')]();var auth=require(_0xd99e('0x1'));var controller=require(_0xd99e('0x2'));router[_0xd99e('0x3')]('/',controller['index']);router['get'](_0xd99e('0x4'),auth['isAuthenticated'](),auth[_0xd99e('0x5')](),controller[_0xd99e('0x6')]);router['get'](_0xd99e('0x7'),auth['isAuthenticated'](),auth[_0xd99e('0x5')](),controller[_0xd99e('0x8')]);router['get'](_0xd99e('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xd99e('0xa')]);router[_0xd99e('0x3')]('/restart',auth[_0xd99e('0xb')](),controller[_0xd99e('0xc')]);router[_0xd99e('0x3')](_0xd99e('0xd'),controller[_0xd99e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4d06=['../../components/auth/service','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','/restart','/migrations','migrations','express'];(function(_0x558130,_0x3e16b7){var _0x4b6b0a=function(_0x30d6fa){while(--_0x30d6fa){_0x558130['push'](_0x558130['shift']());}};_0x4b6b0a(++_0x3e16b7);}(_0x4d06,0xd1));var _0x64d0=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0x4d06[_0xb8cfbe];return _0x227d51;};'use strict';var express=require(_0x64d0('0x0'));var router=express['Router']();var auth=require(_0x64d0('0x1'));var controller=require('./version.controller');router['get']('/',controller['index']);router[_0x64d0('0x2')](_0x64d0('0x3'),auth[_0x64d0('0x4')](),auth['canUpdate'](),controller[_0x64d0('0x5')]);router[_0x64d0('0x2')](_0x64d0('0x6'),auth[_0x64d0('0x4')](),auth[_0x64d0('0x7')](),controller[_0x64d0('0x8')]);router[_0x64d0('0x2')](_0x64d0('0x9'),auth[_0x64d0('0x4')](),auth[_0x64d0('0x7')](),controller[_0x64d0('0xa')]);router[_0x64d0('0x2')](_0x64d0('0xb'),auth['isAuthenticated'](),controller['restart']);router[_0x64d0('0x2')](_0x64d0('0xc'),controller[_0x64d0('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8cc073c..a761b77 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 _0xeb36=['catch','migrations','join','replace','push','sort','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xeb36,0xa4));var _0x6eb3=function(_0x4bf606,_0xd9bef8){_0x4bf606=_0x4bf606-0x0;var _0x3e60bb=_0xeb36[_0x4bf606];return _0x3e60bb;};'use strict';var Umzug=require(_0x6eb3('0x0'));var path=require(_0x6eb3('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6eb3('0x2'))(module,_0x6eb3('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x6eb3('0x4'))[_0x6eb3('0x5')];var db=require(_0x6eb3('0x6'))['db'];var config=require(_0x6eb3('0x7'));var pm2=require(_0x6eb3('0x8'));var logger=require('../../config/logger')(_0x6eb3('0x9'));var git=require(_0x6eb3('0xa'))(config[_0x6eb3('0xb')]);exports[_0x6eb3('0xc')]=function(_0xbbd186,_0x4301f2){var _0x5bf97d={'current':module[_0x6eb3('0xd')][_0x6eb3('0x3')],'phonebar':0x2};if(_0xbbd186[_0x6eb3('0xe')]&&_0xbbd186[_0x6eb3('0xe')]['latest']){return git['fetch']()['tags'](function(_0x1280ef,_0x235b95){_0x5bf97d['latest']=(_0x1280ef?module['exports'][_0x6eb3('0x3')]:_0x235b95[_0x6eb3('0xf')])||_0x6eb3('0x10');return _0x4301f2[_0x6eb3('0x11')](0xc8)[_0x6eb3('0x12')](_0x5bf97d);});}else{return _0x4301f2[_0x6eb3('0x11')](0xc8)['json'](_0x5bf97d);}};exports[_0x6eb3('0x13')]=function(_0x2a6326,_0x107ff8){return git[_0x6eb3('0x13')]([_0x6eb3('0x14'),_0x6eb3('0x15')],function(_0x1eeb1f){if(_0x1eeb1f){logger[_0x6eb3('0x16')](_0x1eeb1f);return _0x107ff8[_0x6eb3('0x11')](0x1f4)[_0x6eb3('0x12')](_0x1eeb1f);}logger[_0x6eb3('0x17')](_0x6eb3('0x18'));return _0x107ff8['status'](0xc8)[_0x6eb3('0x12')]({'output':_0x6eb3('0x19')});});};exports[_0x6eb3('0x1a')]=function(_0x36a582,_0xfc6192){return git[_0x6eb3('0x1a')]([_0x6eb3('0x1b'),'FETCH_HEAD'],function(_0x3a97c4){if(_0x3a97c4){logger['error'](_0x3a97c4);return _0xfc6192[_0x6eb3('0x11')](0x1f4)[_0x6eb3('0x12')](_0x3a97c4);}logger['info'](_0x6eb3('0x1c'));return _0xfc6192[_0x6eb3('0x11')](0xc8)[_0x6eb3('0x12')]({'output':_0x6eb3('0x1d')});});};exports[_0x6eb3('0x1e')]=function(_0x25c72c,_0x470956){exec(_0x6eb3('0x1f'),function(_0x230018,_0x558040,_0x49df09){logger[_0x6eb3('0x17')](_0x558040);logger[_0x6eb3('0x17')](_0x49df09);if(_0x230018){logger[_0x6eb3('0x16')](_0x230018);return _0x470956[_0x6eb3('0x11')](0x1f4)[_0x6eb3('0x12')](_0x230018);}return _0x470956[_0x6eb3('0x11')](0xc8)['json']({'output':_0x558040});});};exports['restart']=function(_0x9c5969,_0x130f96){return pm2[_0x6eb3('0x20')]('motion2')[_0x6eb3('0x21')](function(_0x3ae057){logger[_0x6eb3('0x17')](_0x6eb3('0x22'),_0x3ae057);return _0x130f96[_0x6eb3('0x11')](0xc8)[_0x6eb3('0x12')]({'output':_0x6eb3('0x23')});})[_0x6eb3('0x24')](function(_0x32eaff){logger[_0x6eb3('0x16')](_0x32eaff);return _0x130f96[_0x6eb3('0x11')](0x1f4)[_0x6eb3('0x12')](_0x32eaff);});};exports[_0x6eb3('0x25')]=function(_0x54944b,_0x130947){var _0x41b49b=fs['readdirSync'](path[_0x6eb3('0x26')](config[_0x6eb3('0xb')],'server',_0x6eb3('0x25')));var _0x24d805=[];for(var _0x328777=0x0;_0x328777<_0x41b49b['length'];_0x328777++){var _0x580012=_0x41b49b[_0x328777][_0x6eb3('0x27')]('.js','');if(compareVersions(module['exports'][_0x6eb3('0x3')],_0x580012)===-0x1){_0x24d805[_0x6eb3('0x28')](_0x580012);}}if(_0x24d805['length']){var _0x377e6a=_0x24d805[_0x6eb3('0x29')](compareVersions);var _0x5c1d70=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x6eb3('0x3')},'migrations':{'params':[db[_0x6eb3('0x2a')][_0x6eb3('0x2b')](),db[_0x6eb3('0x2a')]['constructor'],function(){throw new Error(_0x6eb3('0x2c'));}],'path':path['join'](config[_0x6eb3('0xb')],_0x6eb3('0x2d'),_0x6eb3('0x25')),'pattern':/\.js$/}});_0x5c1d70['up']({'migrations':_[_0x6eb3('0x2e')](_0x377e6a,function(_0x5906ec){return _0x5906ec+'.js';})})[_0x6eb3('0x21')](function(){return _0x130947[_0x6eb3('0x11')](0xc8)[_0x6eb3('0x12')]({'output':_0x6eb3('0x2f')+module[_0x6eb3('0xd')]['version']+_0x6eb3('0x30')+_['last'](_0x377e6a),'migrations':_[_0x6eb3('0x26')](_0x377e6a)});})[_0x6eb3('0x24')](function(_0x133e87){if(_0x133e87 instanceof db['sequelize']['UniqueConstraintError']){return _0x130947[_0x6eb3('0x11')](0xc8)[_0x6eb3('0x12')]({'output':_0x6eb3('0x31')});}else{return _0x130947[_0x6eb3('0x11')](0x1f4)[_0x6eb3('0x12')](_0x133e87);}});}else{return _0x130947[_0x6eb3('0x11')](0xc8)[_0x6eb3('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x4d64=['latest','2.0.0','json','status','error','info','git\x20fetch','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','fetch'];(function(_0x4d3f63,_0x267277){var _0x508d41=function(_0x25ec5f){while(--_0x25ec5f){_0x4d3f63['push'](_0x4d3f63['shift']());}};_0x508d41(++_0x267277);}(_0x4d64,0xee));var _0x44d6=function(_0x5d755e,_0x5306e8){_0x5d755e=_0x5d755e-0x0;var _0x320fd3=_0x4d64[_0x5d755e];return _0x320fd3;};'use strict';var Umzug=require(_0x44d6('0x0'));var path=require(_0x44d6('0x1'));var fs=require('fs');var _=require(_0x44d6('0x2'));var pkginfo=require(_0x44d6('0x3'))(module,_0x44d6('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x44d6('0x5'))[_0x44d6('0x6')];var db=require(_0x44d6('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x44d6('0x8'));var logger=require(_0x44d6('0x9'))(_0x44d6('0xa'));var git=require(_0x44d6('0xb'))(config[_0x44d6('0xc')]);exports[_0x44d6('0xd')]=function(_0x1261cc,_0x1bc3ad){var _0x59ac79={'current':module[_0x44d6('0xe')][_0x44d6('0x4')],'phonebar':0x2};if(_0x1261cc[_0x44d6('0xf')]&&_0x1261cc['query']['latest']){return git[_0x44d6('0x10')]()['tags'](function(_0x70e029,_0x11c818){_0x59ac79[_0x44d6('0x11')]=(_0x70e029?module[_0x44d6('0xe')][_0x44d6('0x4')]:_0x11c818[_0x44d6('0x11')])||_0x44d6('0x12');return _0x1bc3ad['status'](0xc8)[_0x44d6('0x13')](_0x59ac79);});}else{return _0x1bc3ad[_0x44d6('0x14')](0xc8)[_0x44d6('0x13')](_0x59ac79);}};exports[_0x44d6('0x10')]=function(_0x39ff87,_0x499c3b){return git[_0x44d6('0x10')](['origin','master'],function(_0x66fdfd){if(_0x66fdfd){logger[_0x44d6('0x15')](_0x66fdfd);return _0x499c3b[_0x44d6('0x14')](0x1f4)[_0x44d6('0x13')](_0x66fdfd);}logger[_0x44d6('0x16')](_0x44d6('0x17'));return _0x499c3b['status'](0xc8)[_0x44d6('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x44d6('0x18')]=function(_0x529f6b,_0x7a8110){return git[_0x44d6('0x18')](['--hard','FETCH_HEAD'],function(_0x1b3e6a){if(_0x1b3e6a){logger[_0x44d6('0x15')](_0x1b3e6a);return _0x7a8110['status'](0x1f4)[_0x44d6('0x13')](_0x1b3e6a);}logger['info'](_0x44d6('0x19'));return _0x7a8110[_0x44d6('0x14')](0xc8)[_0x44d6('0x13')]({'output':_0x44d6('0x1a')});});};exports['pull']=function(_0x1e35ac,_0x50a1bf){exec(_0x44d6('0x1b'),function(_0x175ac4,_0x54bcbd,_0x1039a3){logger[_0x44d6('0x16')](_0x54bcbd);logger[_0x44d6('0x16')](_0x1039a3);if(_0x175ac4){logger['error'](_0x175ac4);return _0x50a1bf[_0x44d6('0x14')](0x1f4)[_0x44d6('0x13')](_0x175ac4);}return _0x50a1bf[_0x44d6('0x14')](0xc8)[_0x44d6('0x13')]({'output':_0x54bcbd});});};exports[_0x44d6('0x1c')]=function(_0x3d84c0,_0x4ffffc){return pm2[_0x44d6('0x1c')]('motion2')['then'](function(_0x4febda){logger[_0x44d6('0x16')](_0x44d6('0x1d'),_0x4febda);return _0x4ffffc[_0x44d6('0x14')](0xc8)[_0x44d6('0x13')]({'output':_0x44d6('0x1e')});})[_0x44d6('0x1f')](function(_0x56ca25){logger[_0x44d6('0x15')](_0x56ca25);return _0x4ffffc['status'](0x1f4)[_0x44d6('0x13')](_0x56ca25);});};exports[_0x44d6('0x20')]=function(_0x497eb2,_0x5a2bb1){var _0xb2b9b7=fs[_0x44d6('0x21')](path[_0x44d6('0x22')](config[_0x44d6('0xc')],_0x44d6('0x23'),_0x44d6('0x20')));var _0xe0ca33=[];for(var _0x263e19=0x0;_0x263e19<_0xb2b9b7[_0x44d6('0x24')];_0x263e19++){var _0x29b907=_0xb2b9b7[_0x263e19]['replace'](_0x44d6('0x25'),'');if(compareVersions(module['exports']['version'],_0x29b907)===-0x1){_0xe0ca33[_0x44d6('0x26')](_0x29b907);}}if(_0xe0ca33[_0x44d6('0x24')]){var _0x1c5008=_0xe0ca33[_0x44d6('0x27')](compareVersions);var _0x5afa88=new Umzug({'storage':_0x44d6('0x28'),'storageOptions':{'model':db[_0x44d6('0x29')],'modelName':'Migration','columnName':_0x44d6('0x4')},'migrations':{'params':[db[_0x44d6('0x28')][_0x44d6('0x2a')](),db[_0x44d6('0x28')][_0x44d6('0x2b')],function(){throw new Error(_0x44d6('0x2c'));}],'path':path[_0x44d6('0x22')](config[_0x44d6('0xc')],'server',_0x44d6('0x20')),'pattern':/\.js$/}});_0x5afa88['up']({'migrations':_[_0x44d6('0x2d')](_0x1c5008,function(_0xb1e069){return _0xb1e069+'.js';})})['then'](function(){return _0x5a2bb1[_0x44d6('0x14')](0xc8)['json']({'output':_0x44d6('0x2e')+module['exports'][_0x44d6('0x4')]+_0x44d6('0x2f')+_[_0x44d6('0x30')](_0x1c5008),'migrations':_[_0x44d6('0x22')](_0x1c5008)});})[_0x44d6('0x1f')](function(_0x1c5b52){if(_0x1c5b52 instanceof db['sequelize'][_0x44d6('0x31')]){return _0x5a2bb1[_0x44d6('0x14')](0xc8)[_0x44d6('0x13')]({'output':_0x44d6('0x32')});}else{return _0x5a2bb1[_0x44d6('0x14')](0x1f4)[_0x44d6('0x13')](_0x1c5b52);}});}else{return _0x5a2bb1[_0x44d6('0x14')](0xc8)[_0x44d6('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d56b606..d9ce391 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 _0x7f39=['create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post'];(function(_0x3acae3,_0x488377){var _0xa180d=function(_0xd1d3b0){while(--_0xd1d3b0){_0x3acae3['push'](_0x3acae3['shift']());}};_0xa180d(++_0x488377);}(_0x7f39,0x131));var _0x97f3=function(_0x455fea,_0x51f808){_0x455fea=_0x455fea-0x0;var _0x32f39b=_0x7f39[_0x455fea];return _0x32f39b;};'use strict';var multer=require('multer');var util=require(_0x97f3('0x0'));var path=require(_0x97f3('0x1'));var timeout=require(_0x97f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x97f3('0x3'));var auth=require(_0x97f3('0x4'));var interaction=require(_0x97f3('0x5'));var config=require(_0x97f3('0x6'));var controller=require(_0x97f3('0x7'));router[_0x97f3('0x8')]('/',auth['isAuthenticated'](),controller[_0x97f3('0x9')]);router[_0x97f3('0x8')](_0x97f3('0xa'),auth[_0x97f3('0xb')](),controller[_0x97f3('0xc')]);router[_0x97f3('0x8')](_0x97f3('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x97f3('0xe')]('/',auth[_0x97f3('0xb')](),controller[_0x97f3('0xf')]);router[_0x97f3('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x97f3('0x11')](_0x97f3('0xd'),auth[_0x97f3('0xb')](),controller[_0x97f3('0x12')]);module[_0x97f3('0x13')]=router; \ No newline at end of file +var _0x7041=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','describe','show','post','create','/:id','update','delete','isAuthenticated','destroy','exports','multer','connect-timeout'];(function(_0x341524,_0x4bb5d1){var _0x2a3a8c=function(_0xbbd9ae){while(--_0xbbd9ae){_0x341524['push'](_0x341524['shift']());}};_0x2a3a8c(++_0x4bb5d1);}(_0x7041,0xda));var _0x1704=function(_0x39fd35,_0x4dc7d0){_0x39fd35=_0x39fd35-0x0;var _0x29e8b0=_0x7041[_0x39fd35];return _0x29e8b0;};'use strict';var multer=require(_0x1704('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1704('0x1'));var express=require(_0x1704('0x2'));var router=express['Router']();var fs_extra=require(_0x1704('0x3'));var auth=require(_0x1704('0x4'));var interaction=require(_0x1704('0x5'));var config=require(_0x1704('0x6'));var controller=require(_0x1704('0x7'));router[_0x1704('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1704('0x8')](_0x1704('0x9'),auth['isAuthenticated'](),controller[_0x1704('0xa')]);router[_0x1704('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1704('0xb')]);router[_0x1704('0xc')]('/',auth['isAuthenticated'](),controller[_0x1704('0xd')]);router['put'](_0x1704('0xe'),auth['isAuthenticated'](),controller[_0x1704('0xf')]);router[_0x1704('0x10')]('/:id',auth[_0x1704('0x11')](),controller[_0x1704('0x12')]);module[_0x1704('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 07a7160..53e6c46 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 _0x6947=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6947,0x72));var _0x7694=function(_0xd1734e,_0x2d22ad){_0xd1734e=_0xd1734e-0x0;var _0x41ef4c=_0x6947[_0xd1734e];return _0x41ef4c;};'use strict';var Sequelize=require('sequelize');module[_0x7694('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7694('0x1')]},'calleridnum':{'type':Sequelize[_0x7694('0x1')]},'calleridname':{'type':Sequelize[_0x7694('0x1')]},'queue':{'type':Sequelize[_0x7694('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7694('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7694('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x7694('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x7694('0x2')]},'agentdumpAt':{'type':Sequelize[_0x7694('0x2')]},'holdtime':{'type':Sequelize[_0x7694('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7694('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7694('0x3')]},'agentacw':{'type':Sequelize[_0x7694('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x7694('0x1')]},'lastevent':{'type':Sequelize[_0x7694('0x1')]},'channel':{'type':Sequelize[_0x7694('0x1')]},'channelstate':{'type':Sequelize[_0x7694('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7694('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7694('0x1')]},'connectedlinename':{'type':Sequelize[_0x7694('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7694('0x1')]},'context':{'type':Sequelize[_0x7694('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7694('0x1')]},'destchannel':{'type':Sequelize[_0x7694('0x1')]},'destchannelstate':{'type':Sequelize[_0x7694('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7694('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7694('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7694('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7694('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7694('0x1')]},'destpriority':{'type':Sequelize[_0x7694('0x1')]},'destuniqueid':{'type':Sequelize[_0x7694('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7694('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x7694('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7694('0x1')],'comment':_0x7694('0x5')},'transferexten':{'type':Sequelize[_0x7694('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7694('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xde9f=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x19dd8a,_0x4af545){var _0x6245d3=function(_0x16e70b){while(--_0x16e70b){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x6245d3(++_0x4af545);}(_0xde9f,0x118));var _0xfde9=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0xde9f[_0x32cf96];return _0x125cc1;};'use strict';var Sequelize=require(_0xfde9('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfde9('0x1')]},'calleridnum':{'type':Sequelize[_0xfde9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xfde9('0x1')]},'interface':{'type':Sequelize[_0xfde9('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xfde9('0x2')]},'agentconnectAt':{'type':Sequelize[_0xfde9('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xfde9('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xfde9('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xfde9('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfde9('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfde9('0x4')]},'agentacw':{'type':Sequelize[_0xfde9('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfde9('0x4')]},'reason':{'type':Sequelize[_0xfde9('0x1')]},'lastevent':{'type':Sequelize[_0xfde9('0x1')]},'channel':{'type':Sequelize[_0xfde9('0x1')]},'channelstate':{'type':Sequelize[_0xfde9('0x4')]},'channelstatedesc':{'type':Sequelize[_0xfde9('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfde9('0x1')]},'connectedlinename':{'type':Sequelize[_0xfde9('0x1')]},'language':{'type':Sequelize[_0xfde9('0x1')]},'accountcode':{'type':Sequelize[_0xfde9('0x1')]},'context':{'type':Sequelize[_0xfde9('0x1')]},'exten':{'type':Sequelize[_0xfde9('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfde9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xfde9('0x1')]},'destcalleridnum':{'type':Sequelize[_0xfde9('0x1')]},'destcalleridname':{'type':Sequelize[_0xfde9('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfde9('0x1')]},'destaccountcode':{'type':Sequelize[_0xfde9('0x1')]},'destcontext':{'type':Sequelize[_0xfde9('0x1')]},'destexten':{'type':Sequelize[_0xfde9('0x1')]},'destpriority':{'type':Sequelize[_0xfde9('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfde9('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xfde9('0x1')]},'transfer':{'type':Sequelize[_0xfde9('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfde9('0x5')},'transferexten':{'type':Sequelize[_0xfde9('0x1')]},'transferuniqueid':{'type':Sequelize[_0xfde9('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 42331cb..26c1426 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(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 dbca301..1aba1cc 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 _0x63b6=['rimraf','../../config/environment','./voiceAgentReport.attributes','define','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0xa03344,_0x581292){var _0x38acfd=function(_0x1b1e8c){while(--_0x1b1e8c){_0xa03344['push'](_0xa03344['shift']());}};_0x38acfd(++_0x581292);}(_0x63b6,0x127));var _0x663b=function(_0x115d39,_0x3ada31){_0x115d39=_0x115d39-0x0;var _0xb8fdcf=_0x63b6[_0x115d39];return _0xb8fdcf;};'use strict';var _=require(_0x663b('0x0'));var util=require(_0x663b('0x1'));var logger=require(_0x663b('0x2'))('api');var moment=require(_0x663b('0x3'));var BPromise=require('bluebird');var rp=require(_0x663b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x663b('0x5'));var config=require(_0x663b('0x6'));var attributes=require(_0x663b('0x7'));module['exports']=function(_0x4486b1,_0x57e43e){return _0x4486b1[_0x663b('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x663b('0x9'),'paranoid':![],'indexes':[{'fields':[_0x663b('0xa'),_0x663b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x093a=['api','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger'];(function(_0x11765b,_0x59fab7){var _0x5e651e=function(_0x48f17d){while(--_0x48f17d){_0x11765b['push'](_0x11765b['shift']());}};_0x5e651e(++_0x59fab7);}(_0x093a,0x16a));var _0xa093=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0x093a[_0x158e3b];return _0x551a1d;};'use strict';var _=require('lodash');var util=require(_0xa093('0x0'));var logger=require(_0xa093('0x1'))(_0xa093('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa093('0x3'));var fs=require('fs');var path=require(_0xa093('0x4'));var rimraf=require(_0xa093('0x5'));var config=require(_0xa093('0x6'));var attributes=require(_0xa093('0x7'));module[_0xa093('0x8')]=function(_0x2346f1,_0x145f58){return _0x2346f1[_0xa093('0x9')](_0xa093('0xa'),attributes,{'tableName':_0xa093('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa093('0xc'),_0xa093('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b24c26f..ce13b10 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 _0x04b3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','raw','catch','UpdateVoiceAgentReport','body','options','where','attributes','limit'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0x04b3,0x1ad));var _0x304b=function(_0x32304f,_0x1493bd){_0x32304f=_0x32304f-0x0;var _0x5245cf=_0x04b3[_0x32304f];return _0x5245cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x304b('0x0'));var BPromise=require(_0x304b('0x1'));var rs=require(_0x304b('0x2'));var fs=require('fs');var Redis=require(_0x304b('0x3'));var db=require(_0x304b('0x4'))['db'];var utils=require(_0x304b('0x5'));var logger=require(_0x304b('0x6'))('rpc');var config=require(_0x304b('0x7'));var jayson=require(_0x304b('0x8'));var client=jayson[_0x304b('0x9')][_0x304b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x232c49,_0x4d3cdf,_0x1fdfbf){return new BPromise(function(_0x3b2257,_0x55f43c){return client['request'](_0x232c49,_0x1fdfbf)[_0x304b('0xb')](function(_0x401f5f){logger[_0x304b('0xc')](_0x304b('0xd'),_0x4d3cdf,_0x304b('0xe'));logger[_0x304b('0xf')](_0x304b('0x10'),_0x4d3cdf,_0x304b('0xe'),JSON[_0x304b('0x11')](_0x401f5f));if(_0x401f5f[_0x304b('0x12')]){if(_0x401f5f[_0x304b('0x12')][_0x304b('0x13')]===0x1f4){logger[_0x304b('0x12')](_0x304b('0xd'),_0x4d3cdf,_0x401f5f['error'][_0x304b('0x14')]);return _0x55f43c(_0x401f5f[_0x304b('0x12')]['message']);}logger[_0x304b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x4d3cdf,_0x401f5f[_0x304b('0x12')][_0x304b('0x14')]);return _0x3b2257(_0x401f5f[_0x304b('0x12')][_0x304b('0x14')]);}else{logger['info'](_0x304b('0xd'),_0x4d3cdf,_0x304b('0xe'));_0x3b2257(_0x401f5f[_0x304b('0x15')]['message']);}})['catch'](function(_0x3703a7){logger[_0x304b('0x12')](_0x304b('0xd'),_0x4d3cdf,_0x3703a7);_0x55f43c(_0x3703a7);});});}exports[_0x304b('0x16')]=function(_0x18d926){var _0x255926=this;return new Promise(function(_0x4d22e4,_0x189045){return db[_0x304b('0x17')][_0x304b('0x18')](_0x18d926['body'],{'raw':_0x18d926['options']?_0x18d926['options'][_0x304b('0x19')]===undefined?!![]:![]:!![]})[_0x304b('0xb')](function(_0x5921b2){logger['info'](_0x304b('0x16'),_0x18d926);logger[_0x304b('0xf')](_0x304b('0x16'),_0x18d926,JSON[_0x304b('0x11')](_0x5921b2));_0x4d22e4(_0x5921b2);})[_0x304b('0x1a')](function(_0x48aba3){logger[_0x304b('0x12')](_0x304b('0x16'),_0x48aba3['message'],_0x18d926);_0x189045(_0x255926[_0x304b('0x12')](0x1f4,_0x48aba3[_0x304b('0x14')]));});});};exports[_0x304b('0x1b')]=function(_0xc3ff74){var _0x211dcc=this;return new Promise(function(_0x24bfbf,_0x285d26){return db[_0x304b('0x17')]['update'](_0xc3ff74[_0x304b('0x1c')],{'raw':_0xc3ff74[_0x304b('0x1d')]?_0xc3ff74['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc3ff74[_0x304b('0x1d')]?_0xc3ff74[_0x304b('0x1d')][_0x304b('0x1e')]||null:null,'attributes':_0xc3ff74['options']?_0xc3ff74['options'][_0x304b('0x1f')]||null:null,'limit':_0xc3ff74[_0x304b('0x1d')]?_0xc3ff74[_0x304b('0x1d')][_0x304b('0x20')]||null:null})[_0x304b('0xb')](function(_0xf1f907){logger[_0x304b('0xc')](_0x304b('0x1b'),_0xc3ff74);logger['debug'](_0x304b('0x1b'),_0xc3ff74,JSON[_0x304b('0x11')](_0xf1f907));_0x24bfbf(_0xf1f907);})['catch'](function(_0x42d153){logger['error'](_0x304b('0x1b'),_0x42d153[_0x304b('0x14')],_0xc3ff74);_0x285d26(_0x211dcc[_0x304b('0x12')](0x1f4,_0x42d153['message']));});});}; \ No newline at end of file +var _0xae41=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','create','body','options','UpdateVoiceAgentReport','VoiceAgentReport','update','raw','attributes','limit','catch','lodash'];(function(_0x10521d,_0x79d3ab){var _0x313bc0=function(_0x5e62ad){while(--_0x5e62ad){_0x10521d['push'](_0x10521d['shift']());}};_0x313bc0(++_0x79d3ab);}(_0xae41,0x197));var _0x1ae4=function(_0x52787b,_0xa10e8b){_0x52787b=_0x52787b-0x0;var _0x229759=_0xae41[_0x52787b];return _0x229759;};'use strict';var _=require(_0x1ae4('0x0'));var util=require(_0x1ae4('0x1'));var moment=require(_0x1ae4('0x2'));var BPromise=require(_0x1ae4('0x3'));var rs=require(_0x1ae4('0x4'));var fs=require('fs');var Redis=require(_0x1ae4('0x5'));var db=require(_0x1ae4('0x6'))['db'];var utils=require(_0x1ae4('0x7'));var logger=require(_0x1ae4('0x8'))(_0x1ae4('0x9'));var config=require(_0x1ae4('0xa'));var jayson=require(_0x1ae4('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8977f7,_0x150ccf,_0x367ece){return new BPromise(function(_0x4ada94,_0x5834f1){return client['request'](_0x8977f7,_0x367ece)[_0x1ae4('0xc')](function(_0x50a09a){logger[_0x1ae4('0xd')](_0x1ae4('0xe'),_0x150ccf,_0x1ae4('0xf'));logger[_0x1ae4('0x10')](_0x1ae4('0x11'),_0x150ccf,_0x1ae4('0xf'),JSON[_0x1ae4('0x12')](_0x50a09a));if(_0x50a09a[_0x1ae4('0x13')]){if(_0x50a09a[_0x1ae4('0x13')][_0x1ae4('0x14')]===0x1f4){logger[_0x1ae4('0x13')](_0x1ae4('0xe'),_0x150ccf,_0x50a09a[_0x1ae4('0x13')]['message']);return _0x5834f1(_0x50a09a[_0x1ae4('0x13')][_0x1ae4('0x15')]);}logger[_0x1ae4('0x13')](_0x1ae4('0xe'),_0x150ccf,_0x50a09a[_0x1ae4('0x13')][_0x1ae4('0x15')]);return _0x4ada94(_0x50a09a[_0x1ae4('0x13')][_0x1ae4('0x15')]);}else{logger[_0x1ae4('0xd')](_0x1ae4('0xe'),_0x150ccf,_0x1ae4('0xf'));_0x4ada94(_0x50a09a[_0x1ae4('0x16')]['message']);}})['catch'](function(_0x3fd982){logger[_0x1ae4('0x13')](_0x1ae4('0xe'),_0x150ccf,_0x3fd982);_0x5834f1(_0x3fd982);});});}exports[_0x1ae4('0x17')]=function(_0x163b2f){var _0x5c93a7=this;return new Promise(function(_0x4c70bd,_0x87ba12){return db['VoiceAgentReport'][_0x1ae4('0x18')](_0x163b2f[_0x1ae4('0x19')],{'raw':_0x163b2f[_0x1ae4('0x1a')]?_0x163b2f[_0x1ae4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x1ae4('0xc')](function(_0x2dcb97){logger[_0x1ae4('0xd')](_0x1ae4('0x17'),_0x163b2f);logger[_0x1ae4('0x10')](_0x1ae4('0x17'),_0x163b2f,JSON[_0x1ae4('0x12')](_0x2dcb97));_0x4c70bd(_0x2dcb97);})['catch'](function(_0xf68763){logger[_0x1ae4('0x13')](_0x1ae4('0x17'),_0xf68763[_0x1ae4('0x15')],_0x163b2f);_0x87ba12(_0x5c93a7[_0x1ae4('0x13')](0x1f4,_0xf68763[_0x1ae4('0x15')]));});});};exports[_0x1ae4('0x1b')]=function(_0x3a955b){var _0x50c631=this;return new Promise(function(_0x50bbe9,_0x3a0b5a){return db[_0x1ae4('0x1c')][_0x1ae4('0x1d')](_0x3a955b[_0x1ae4('0x19')],{'raw':_0x3a955b[_0x1ae4('0x1a')]?_0x3a955b[_0x1ae4('0x1a')][_0x1ae4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a955b[_0x1ae4('0x1a')]?_0x3a955b[_0x1ae4('0x1a')]['where']||null:null,'attributes':_0x3a955b['options']?_0x3a955b[_0x1ae4('0x1a')][_0x1ae4('0x1f')]||null:null,'limit':_0x3a955b[_0x1ae4('0x1a')]?_0x3a955b[_0x1ae4('0x1a')][_0x1ae4('0x20')]||null:null})['then'](function(_0xb5eabb){logger['info'](_0x1ae4('0x1b'),_0x3a955b);logger[_0x1ae4('0x10')](_0x1ae4('0x1b'),_0x3a955b,JSON[_0x1ae4('0x12')](_0xb5eabb));_0x50bbe9(_0xb5eabb);})[_0x1ae4('0x21')](function(_0x2eff3d){logger[_0x1ae4('0x13')](_0x1ae4('0x1b'),_0x2eff3d[_0x1ae4('0x15')],_0x3a955b);_0x3a0b5a(_0x50c631[_0x1ae4('0x13')](0x1f4,_0x2eff3d[_0x1ae4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 2b3a9db..addb3a8 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 _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','delete','destroy'];(function(_0x38ef31,_0x1d5315){var _0x20d1b8=function(_0x565fe5){while(--_0x565fe5){_0x38ef31['push'](_0x38ef31['shift']());}};_0x20d1b8(++_0x1d5315);}(_0x2bd8,0x130));var _0x82bd=function(_0x3e958f,_0x519b1e){_0x3e958f=_0x3e958f-0x0;var _0x469381=_0x2bd8[_0x3e958f];return _0x469381;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x82bd('0xa')](),controller['create']);router['put'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x82bd('0xe')](_0x82bd('0xd'),auth['isAuthenticated'](),controller[_0x82bd('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5fc3=['/:id','show','post','create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe'];(function(_0x15d98c,_0x45a56a){var _0x59823c=function(_0x221623){while(--_0x221623){_0x15d98c['push'](_0x15d98c['shift']());}};_0x59823c(++_0x45a56a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x5fc3[_0x6eb833];return _0xdfc38c;};'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('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index a67386c..d9d59a5 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 _0x5a87=['inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','exports','STRING','ENUM'];(function(_0xcf851e,_0x1fce90){var _0x5d7a34=function(_0x7a79ce){while(--_0x7a79ce){_0xcf851e['push'](_0xcf851e['shift']());}};_0x5d7a34(++_0x1fce90);}(_0x5a87,0x194));var _0x75a8=function(_0x4d63cb,_0x3fdcc5){_0x4d63cb=_0x4d63cb-0x0;var _0x230efe=_0x5a87[_0x4d63cb];return _0x230efe;};'use strict';var Sequelize=require('sequelize');module[_0x75a8('0x0')]={'uniqueid':{'type':Sequelize[_0x75a8('0x1')]},'type':{'type':Sequelize[_0x75a8('0x2')](_0x75a8('0x3'),_0x75a8('0x4'),_0x75a8('0x5'),_0x75a8('0x6'),_0x75a8('0x7'),_0x75a8('0x8'))},'tag':{'type':Sequelize[_0x75a8('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x75a8('0x1')]},'destination':{'type':Sequelize[_0x75a8('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x75a8('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x75a8('0x1')]},'lastapplication':{'type':Sequelize[_0x75a8('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x75a8('0x9')]},'answertime':{'type':Sequelize[_0x75a8('0x9')]},'endtime':{'type':Sequelize[_0x75a8('0x9')]},'duration':{'type':Sequelize[_0x75a8('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x75a8('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x75a8('0x1')]},'amaflags':{'type':Sequelize[_0x75a8('0x1')]},'userfield':{'type':Sequelize[_0x75a8('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x75a8('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x75a8('0x1')]},'note':{'type':Sequelize[_0x75a8('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x75a8('0x1')]}}; \ No newline at end of file +var _0xe5fe=['internal','outbound','outbound-fax','dialer','STRING','DATE','INTEGER','sequelize','ENUM','inbound'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xe5fe,0x93));var _0xee5f=function(_0x1c2f16,_0x4b4f3e){_0x1c2f16=_0x1c2f16-0x0;var _0xb33346=_0xe5fe[_0x1c2f16];return _0xb33346;};'use strict';var Sequelize=require(_0xee5f('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xee5f('0x1')](_0xee5f('0x2'),_0xee5f('0x3'),_0xee5f('0x4'),'inbound-fax',_0xee5f('0x5'),_0xee5f('0x6'))},'tag':{'type':Sequelize[_0xee5f('0x7')]},'accountcode':{'type':Sequelize[_0xee5f('0x7')]},'source':{'type':Sequelize[_0xee5f('0x7')]},'destination':{'type':Sequelize[_0xee5f('0x7')]},'destinationcontext':{'type':Sequelize[_0xee5f('0x7')]},'callerid':{'type':Sequelize[_0xee5f('0x7')]},'channel':{'type':Sequelize[_0xee5f('0x7')]},'destinationchannel':{'type':Sequelize[_0xee5f('0x7')]},'lastapplication':{'type':Sequelize[_0xee5f('0x7')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xee5f('0x8')]},'systemanswertime':{'type':Sequelize[_0xee5f('0x8')]},'answertime':{'type':Sequelize[_0xee5f('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xee5f('0x7')]},'amaflags':{'type':Sequelize[_0xee5f('0x7')]},'userfield':{'type':Sequelize[_0xee5f('0x7')]},'userDisposition':{'type':Sequelize[_0xee5f('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xee5f('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xee5f('0x7')]},'prefix':{'type':Sequelize[_0xee5f('0x7')]},'routeid':{'type':Sequelize[_0xee5f('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5b58239..4af7083 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x2ef3,0xba));var _0x32ef=function(_0x5303ed,_0x1bc03a){_0x5303ed=_0x5303ed-0x0;var _0xbad7ee=_0x2ef3[_0x5303ed];return _0xbad7ee;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 2104405..9031b00 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 _0xf958=['lodash','../../config/logger','moment','request-promise','path','rimraf','exports','define','report_call','uniqueid'];(function(_0x371100,_0x838d3e){var _0x18c97c=function(_0x52ce89){while(--_0x52ce89){_0x371100['push'](_0x371100['shift']());}};_0x18c97c(++_0x838d3e);}(_0xf958,0xe6));var _0x8f95=function(_0x528d4f,_0x38e3ef){_0x528d4f=_0x528d4f-0x0;var _0x5425a4=_0xf958[_0x528d4f];return _0x5425a4;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var logger=require(_0x8f95('0x1'))('api');var moment=require(_0x8f95('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f95('0x3'));var fs=require('fs');var path=require(_0x8f95('0x4'));var rimraf=require(_0x8f95('0x5'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x8f95('0x6')]=function(_0x10a425,_0x281f38){return _0x10a425[_0x8f95('0x7')]('VoiceCallReport',attributes,{'tableName':_0x8f95('0x8'),'paranoid':![],'indexes':[{'fields':[_0x8f95('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd42c=['path','rimraf','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0x983dc2,_0x5cca11){var _0x4b0315=function(_0x1042f9){while(--_0x1042f9){_0x983dc2['push'](_0x983dc2['shift']());}};_0x4b0315(++_0x5cca11);}(_0xd42c,0xb6));var _0xcd42=function(_0xf486e7,_0xeeb7c3){_0xf486e7=_0xf486e7-0x0;var _0x30ca63=_0xd42c[_0xf486e7];return _0x30ca63;};'use strict';var _=require('lodash');var util=require(_0xcd42('0x0'));var logger=require(_0xcd42('0x1'))(_0xcd42('0x2'));var moment=require(_0xcd42('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd42('0x4'));var fs=require('fs');var path=require(_0xcd42('0x5'));var rimraf=require(_0xcd42('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd42('0x7'));module[_0xcd42('0x8')]=function(_0x383a65,_0x6bb221){return _0x383a65['define'](_0xcd42('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xcd42('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 50ff79d..aed5fc6 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 _0x81d0=['rpc','../../config/environment','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x10a9de,_0x3473b0){var _0x1b3317=function(_0x3d862c){while(--_0x3d862c){_0x10a9de['push'](_0x10a9de['shift']());}};_0x1b3317(++_0x3473b0);}(_0x81d0,0x8e));var _0x081d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x081d('0x0'));var BPromise=require(_0x081d('0x1'));var rs=require(_0x081d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x081d('0x3'))['db'];var utils=require(_0x081d('0x4'));var logger=require(_0x081d('0x5'))(_0x081d('0x6'));var config=require(_0x081d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x081d('0x8')][_0x081d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4648e9,_0x273fee,_0x57165e){return new BPromise(function(_0xf3519d,_0x33ce20){return client[_0x081d('0xa')](_0x4648e9,_0x57165e)['then'](function(_0x202ff2){logger[_0x081d('0xb')](_0x081d('0xc'),_0x273fee,_0x081d('0xd'));logger[_0x081d('0xe')](_0x081d('0xf'),_0x273fee,_0x081d('0xd'),JSON[_0x081d('0x10')](_0x202ff2));if(_0x202ff2[_0x081d('0x11')]){if(_0x202ff2['error'][_0x081d('0x12')]===0x1f4){logger[_0x081d('0x11')](_0x081d('0xc'),_0x273fee,_0x202ff2[_0x081d('0x11')][_0x081d('0x13')]);return _0x33ce20(_0x202ff2[_0x081d('0x11')][_0x081d('0x13')]);}logger[_0x081d('0x11')](_0x081d('0xc'),_0x273fee,_0x202ff2[_0x081d('0x11')][_0x081d('0x13')]);return _0xf3519d(_0x202ff2[_0x081d('0x11')]['message']);}else{logger[_0x081d('0xb')](_0x081d('0xc'),_0x273fee,_0x081d('0xd'));_0xf3519d(_0x202ff2['result'][_0x081d('0x13')]);}})['catch'](function(_0x466b23){logger[_0x081d('0x11')](_0x081d('0xc'),_0x273fee,_0x466b23);_0x33ce20(_0x466b23);});});}exports[_0x081d('0x14')]=function(_0x43bc5e){var _0x46c43f=this;return new Promise(function(_0x46cc67,_0x1e810c){return db[_0x081d('0x15')][_0x081d('0x16')]({'raw':_0x43bc5e[_0x081d('0x17')]?_0x43bc5e[_0x081d('0x17')][_0x081d('0x18')]===undefined?!![]:![]:!![],'where':_0x43bc5e[_0x081d('0x17')]?_0x43bc5e[_0x081d('0x17')][_0x081d('0x19')]||null:null,'attributes':_0x43bc5e[_0x081d('0x17')]?_0x43bc5e['options'][_0x081d('0x1a')]||null:null,'limit':_0x43bc5e['options']?_0x43bc5e['options'][_0x081d('0x1b')]||null:null,'include':_0x43bc5e[_0x081d('0x17')]?_0x43bc5e[_0x081d('0x17')][_0x081d('0x1c')]?_[_0x081d('0x1d')](_0x43bc5e[_0x081d('0x17')][_0x081d('0x1c')],function(_0x4e5829){return{'model':db[_0x4e5829['model']],'as':_0x4e5829['as'],'attributes':_0x4e5829[_0x081d('0x1a')],'include':_0x4e5829[_0x081d('0x1c')]?_['map'](_0x4e5829[_0x081d('0x1c')],function(_0x56b9bd){return{'model':db[_0x56b9bd[_0x081d('0x1e')]],'as':_0x56b9bd['as'],'attributes':_0x56b9bd[_0x081d('0x1a')],'include':_0x56b9bd[_0x081d('0x1c')]?_[_0x081d('0x1d')](_0x56b9bd[_0x081d('0x1c')],function(_0x1ebcd2){return{'model':db[_0x1ebcd2['model']],'as':_0x1ebcd2['as'],'attributes':_0x1ebcd2[_0x081d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x081d('0x1f')](function(_0xbb0ec8){logger[_0x081d('0xb')](_0x081d('0x14'),_0x43bc5e);logger[_0x081d('0xe')](_0x081d('0x14'),_0x43bc5e,JSON[_0x081d('0x10')](_0xbb0ec8));_0x46cc67(_0xbb0ec8);})[_0x081d('0x20')](function(_0x1196c0){logger[_0x081d('0x11')](_0x081d('0x14'),_0x1196c0[_0x081d('0x13')],_0x43bc5e);_0x1e810c(_0x46c43f[_0x081d('0x11')](0x1f4,_0x1196c0['message']));});});};exports[_0x081d('0x21')]=function(_0x4d7dd7){var _0x47fe2b=this;return new Promise(function(_0x5b78a1,_0x298e54){return db['VoiceCallReport'][_0x081d('0x22')](_0x4d7dd7[_0x081d('0x23')],{'raw':_0x4d7dd7[_0x081d('0x17')]?_0x4d7dd7[_0x081d('0x17')][_0x081d('0x18')]===undefined?!![]:![]:!![]})[_0x081d('0x1f')](function(_0x1e3573){logger['info'](_0x081d('0x21'),_0x4d7dd7);logger['debug']('CreateVoiceCallReport',_0x4d7dd7,JSON[_0x081d('0x10')](_0x1e3573));_0x5b78a1(_0x1e3573);})[_0x081d('0x20')](function(_0x390dd1){logger[_0x081d('0x11')](_0x081d('0x21'),_0x390dd1[_0x081d('0x13')],_0x4d7dd7);_0x298e54(_0x47fe2b['error'](0x1f4,_0x390dd1['message']));});});};exports[_0x081d('0x24')]=function(_0x33305d){var _0x585375=this;return new Promise(function(_0x1e386c,_0x13bfde){return db['VoiceCallReport']['update'](_0x33305d[_0x081d('0x23')],{'raw':_0x33305d[_0x081d('0x17')]?_0x33305d[_0x081d('0x17')][_0x081d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33305d[_0x081d('0x17')]?_0x33305d['options'][_0x081d('0x19')]||null:null,'attributes':_0x33305d[_0x081d('0x17')]?_0x33305d[_0x081d('0x17')][_0x081d('0x1a')]||null:null,'limit':_0x33305d[_0x081d('0x17')]?_0x33305d[_0x081d('0x17')]['limit']||null:null})[_0x081d('0x1f')](function(_0x2d3a59){logger[_0x081d('0xb')]('UpdateVoiceCallReport',_0x33305d);logger[_0x081d('0xe')](_0x081d('0x24'),_0x33305d,JSON[_0x081d('0x10')](_0x2d3a59));_0x1e386c(_0x2d3a59);})[_0x081d('0x20')](function(_0x4f53d6){logger[_0x081d('0x11')](_0x081d('0x24'),_0x4f53d6['message'],_0x33305d);_0x13bfde(_0x585375[_0x081d('0x11')](0x1f4,_0x4f53d6[_0x081d('0x13')]));});});}; \ No newline at end of file +var _0x995a=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','include','map','model','stringify','CreateVoiceCallReport','create','body','update','where','limit','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5dbc7d,_0x1e0053){var _0x3eaf2b=function(_0x15039d){while(--_0x15039d){_0x5dbc7d['push'](_0x5dbc7d['shift']());}};_0x3eaf2b(++_0x1e0053);}(_0x995a,0xa0));var _0xa995=function(_0x5d4502,_0x2b8e81){_0x5d4502=_0x5d4502-0x0;var _0x189c90=_0x995a[_0x5d4502];return _0x189c90;};'use strict';var _=require(_0xa995('0x0'));var util=require(_0xa995('0x1'));var moment=require(_0xa995('0x2'));var BPromise=require(_0xa995('0x3'));var rs=require(_0xa995('0x4'));var fs=require('fs');var Redis=require(_0xa995('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa995('0x6'));var logger=require(_0xa995('0x7'))(_0xa995('0x8'));var config=require(_0xa995('0x9'));var jayson=require(_0xa995('0xa'));var client=jayson[_0xa995('0xb')][_0xa995('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44c22d,_0x28ec8c,_0x352a4b){return new BPromise(function(_0x1e5db6,_0x2adf6f){return client[_0xa995('0xd')](_0x44c22d,_0x352a4b)[_0xa995('0xe')](function(_0x2ed48b){logger[_0xa995('0xf')](_0xa995('0x10'),_0x28ec8c,_0xa995('0x11'));logger[_0xa995('0x12')](_0xa995('0x13'),_0x28ec8c,'request\x20sent',JSON['stringify'](_0x2ed48b));if(_0x2ed48b['error']){if(_0x2ed48b[_0xa995('0x14')][_0xa995('0x15')]===0x1f4){logger[_0xa995('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x28ec8c,_0x2ed48b['error'][_0xa995('0x16')]);return _0x2adf6f(_0x2ed48b[_0xa995('0x14')][_0xa995('0x16')]);}logger[_0xa995('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x28ec8c,_0x2ed48b[_0xa995('0x14')][_0xa995('0x16')]);return _0x1e5db6(_0x2ed48b[_0xa995('0x14')][_0xa995('0x16')]);}else{logger[_0xa995('0xf')](_0xa995('0x10'),_0x28ec8c,_0xa995('0x11'));_0x1e5db6(_0x2ed48b[_0xa995('0x17')][_0xa995('0x16')]);}})[_0xa995('0x18')](function(_0x5f3e09){logger[_0xa995('0x14')](_0xa995('0x10'),_0x28ec8c,_0x5f3e09);_0x2adf6f(_0x5f3e09);});});}exports[_0xa995('0x19')]=function(_0x14cac1){var _0x4daa0d=this;return new Promise(function(_0x315934,_0x429dac){return db[_0xa995('0x1a')][_0xa995('0x1b')]({'raw':_0x14cac1['options']?_0x14cac1[_0xa995('0x1c')][_0xa995('0x1d')]===undefined?!![]:![]:!![],'where':_0x14cac1[_0xa995('0x1c')]?_0x14cac1['options']['where']||null:null,'attributes':_0x14cac1[_0xa995('0x1c')]?_0x14cac1[_0xa995('0x1c')][_0xa995('0x1e')]||null:null,'limit':_0x14cac1[_0xa995('0x1c')]?_0x14cac1[_0xa995('0x1c')]['limit']||null:null,'include':_0x14cac1[_0xa995('0x1c')]?_0x14cac1[_0xa995('0x1c')][_0xa995('0x1f')]?_[_0xa995('0x20')](_0x14cac1[_0xa995('0x1c')][_0xa995('0x1f')],function(_0xef83c8){return{'model':db[_0xef83c8[_0xa995('0x21')]],'as':_0xef83c8['as'],'attributes':_0xef83c8[_0xa995('0x1e')],'include':_0xef83c8[_0xa995('0x1f')]?_[_0xa995('0x20')](_0xef83c8['include'],function(_0x1a51ca){return{'model':db[_0x1a51ca[_0xa995('0x21')]],'as':_0x1a51ca['as'],'attributes':_0x1a51ca[_0xa995('0x1e')],'include':_0x1a51ca[_0xa995('0x1f')]?_[_0xa995('0x20')](_0x1a51ca[_0xa995('0x1f')],function(_0x48bfa8){return{'model':db[_0x48bfa8[_0xa995('0x21')]],'as':_0x48bfa8['as'],'attributes':_0x48bfa8[_0xa995('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15e625){logger[_0xa995('0xf')](_0xa995('0x19'),_0x14cac1);logger[_0xa995('0x12')](_0xa995('0x19'),_0x14cac1,JSON[_0xa995('0x22')](_0x15e625));_0x315934(_0x15e625);})['catch'](function(_0x1163a8){logger['error'](_0xa995('0x19'),_0x1163a8[_0xa995('0x16')],_0x14cac1);_0x429dac(_0x4daa0d['error'](0x1f4,_0x1163a8[_0xa995('0x16')]));});});};exports[_0xa995('0x23')]=function(_0x271ebd){var _0x5eb9a0=this;return new Promise(function(_0x284a37,_0x4e564d){return db[_0xa995('0x1a')][_0xa995('0x24')](_0x271ebd[_0xa995('0x25')],{'raw':_0x271ebd[_0xa995('0x1c')]?_0x271ebd['options']['raw']===undefined?!![]:![]:!![]})[_0xa995('0xe')](function(_0x38dfe0){logger[_0xa995('0xf')](_0xa995('0x23'),_0x271ebd);logger[_0xa995('0x12')](_0xa995('0x23'),_0x271ebd,JSON[_0xa995('0x22')](_0x38dfe0));_0x284a37(_0x38dfe0);})[_0xa995('0x18')](function(_0x117797){logger[_0xa995('0x14')]('CreateVoiceCallReport',_0x117797[_0xa995('0x16')],_0x271ebd);_0x4e564d(_0x5eb9a0['error'](0x1f4,_0x117797['message']));});});};exports['UpdateVoiceCallReport']=function(_0x3eb95c){var _0x370eca=this;return new Promise(function(_0x287fed,_0x55016e){return db[_0xa995('0x1a')][_0xa995('0x26')](_0x3eb95c[_0xa995('0x25')],{'raw':_0x3eb95c[_0xa995('0x1c')]?_0x3eb95c[_0xa995('0x1c')][_0xa995('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3eb95c[_0xa995('0x1c')]?_0x3eb95c[_0xa995('0x1c')][_0xa995('0x27')]||null:null,'attributes':_0x3eb95c[_0xa995('0x1c')]?_0x3eb95c[_0xa995('0x1c')][_0xa995('0x1e')]||null:null,'limit':_0x3eb95c[_0xa995('0x1c')]?_0x3eb95c[_0xa995('0x1c')][_0xa995('0x28')]||null:null})['then'](function(_0x431c32){logger[_0xa995('0xf')](_0xa995('0x29'),_0x3eb95c);logger['debug'](_0xa995('0x29'),_0x3eb95c,JSON['stringify'](_0x431c32));_0x287fed(_0x431c32);})[_0xa995('0x18')](function(_0x4fdf49){logger[_0xa995('0x14')]('UpdateVoiceCallReport',_0x4fdf49[_0xa995('0x16')],_0x3eb95c);_0x55016e(_0x370eca['error'](0x1f4,_0x4fdf49[_0xa995('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 78a64fe..b7b891a 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 _0xe262=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','put','/:id'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xe262,0x92));var _0x2e26=function(_0x5d2217,_0x53663a){_0x5d2217=_0x5d2217-0x0;var _0x5a18fc=_0xe262[_0x5d2217];return _0x5a18fc;};'use strict';var multer=require(_0x2e26('0x0'));var util=require('util');var path=require(_0x2e26('0x1'));var timeout=require(_0x2e26('0x2'));var express=require(_0x2e26('0x3'));var router=express[_0x2e26('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2e26('0x5'));var interaction=require(_0x2e26('0x6'));var config=require(_0x2e26('0x7'));var controller=require(_0x2e26('0x8'));router[_0x2e26('0x9')]('/',auth[_0x2e26('0xa')](),controller['index']);router[_0x2e26('0x9')]('/:id',auth[_0x2e26('0xa')](),controller[_0x2e26('0xb')]);router['post']('/',auth[_0x2e26('0xa')](),controller['create']);router[_0x2e26('0xc')](_0x2e26('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2e26('0xd'),auth['isAuthenticated'](),controller[_0x2e26('0xe')]);module[_0x2e26('0xf')]=router; \ No newline at end of file +var _0x315c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','multer','util','path'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x315c,0xd5));var _0xc315=function(_0x1d4e74,_0x390f70){_0x1d4e74=_0x1d4e74-0x0;var _0x57d1af=_0x315c[_0x1d4e74];return _0x57d1af;};'use strict';var multer=require(_0xc315('0x0'));var util=require(_0xc315('0x1'));var path=require(_0xc315('0x2'));var timeout=require('connect-timeout');var express=require(_0xc315('0x3'));var router=express[_0xc315('0x4')]();var fs_extra=require(_0xc315('0x5'));var auth=require(_0xc315('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc315('0x7'));var controller=require(_0xc315('0x8'));router[_0xc315('0x9')]('/',auth[_0xc315('0xa')](),controller[_0xc315('0xb')]);router[_0xc315('0x9')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller[_0xc315('0xd')]);router[_0xc315('0xe')]('/',auth[_0xc315('0xa')](),controller[_0xc315('0xf')]);router[_0xc315('0x10')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller['update']);router[_0xc315('0x11')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index b73267b..22a2fe7 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 _0x0143=['sequelize','exports','STRING','name','setDataValue','getDataValue','options','BOOLEAN'];(function(_0x5440e5,_0x56fac9){var _0x6c5beb=function(_0x381227){while(--_0x381227){_0x5440e5['push'](_0x5440e5['shift']());}};_0x6c5beb(++_0x56fac9);}(_0x0143,0x118));var _0x3014=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0143[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x3014('0x0'));module[_0x3014('0x1')]={'name':{'type':Sequelize[_0x3014('0x2')]},'prefix':{'type':Sequelize[_0x3014('0x2')],'unique':_0x3014('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x561c95){this[_0x3014('0x4')]('options',_0x561c95?_0x561c95['join'](''):[]);},'get':function(){return this[_0x3014('0x5')](_0x3014('0x6'))?this[_0x3014('0x5')](_0x3014('0x6'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x3014('0x2')]},'record':{'type':Sequelize[_0x3014('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3014('0x2')]}}; \ No newline at end of file +var _0x7a3a=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0xfca471,_0x5df94e){var _0x50c157=function(_0x20340e){while(--_0x20340e){_0xfca471['push'](_0xfca471['shift']());}};_0x50c157(++_0x5df94e);}(_0x7a3a,0x1c9));var _0xa7a3=function(_0x4a9a12,_0x2b4203){_0x4a9a12=_0x4a9a12-0x0;var _0x1dbdbe=_0x7a3a[_0x4a9a12];return _0x1dbdbe;};'use strict';var Sequelize=require(_0xa7a3('0x0'));module[_0xa7a3('0x1')]={'name':{'type':Sequelize[_0xa7a3('0x2')]},'prefix':{'type':Sequelize[_0xa7a3('0x2')],'unique':_0xa7a3('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xa7a3('0x2')],'set':function(_0x3f3069){this[_0xa7a3('0x4')]('options',_0x3f3069?_0x3f3069['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this['getDataValue']('options')[_0xa7a3('0x5')](''):[];}},'auth':{'type':Sequelize[_0xa7a3('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xa7a3('0x2')]},'record':{'type':Sequelize[_0xa7a3('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa7a3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 51f9ca7..a8991c9 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 _0xe062=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','send','index','map','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','VoiceChanSpy','includeAll','findAll','rows','catch','show','keys','include','find','create','body','user','UserProfileSection','userProfileId','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x556287,_0x347888){var _0x1ad6a9=function(_0x35ae6d){while(--_0x35ae6d){_0x556287['push'](_0x556287['shift']());}};_0x1ad6a9(++_0x347888);}(_0xe062,0xd5));var _0x2e06=function(_0x382b6c,_0x223137){_0x382b6c=_0x382b6c-0x0;var _0x140b82=_0xe062[_0x382b6c];return _0x140b82;};'use strict';var emlformat=require(_0x2e06('0x0'));var rimraf=require(_0x2e06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e06('0x2'));var rp=require(_0x2e06('0x3'));var moment=require(_0x2e06('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e06('0x5'));var path=require(_0x2e06('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e06('0x7'));var fs=require('fs');var fs_extra=require(_0x2e06('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e06('0x9'));var jsforce=require(_0x2e06('0xa'));var deskjs=require(_0x2e06('0xb'));var toCsv=require(_0x2e06('0xc'));var querystring=require(_0x2e06('0xd'));var Papa=require(_0x2e06('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2e06('0xf'));var as=require(_0x2e06('0x10'));var hardwareService=require(_0x2e06('0x11'));var logger=require('../../config/logger')(_0x2e06('0x12'));var utils=require(_0x2e06('0x13'));var config=require(_0x2e06('0x14'));var licenseUtil=require(_0x2e06('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b6a33,_0x11520b){_0x11520b=_0x11520b||0xcc;return function(_0x542f63){if(_0x542f63){return _0x2b6a33[_0x2e06('0x16')](_0x11520b);}return _0x2b6a33[_0x2e06('0x17')](_0x11520b)['end']();};}function respondWithResult(_0x745e06,_0x2a3a2a){_0x2a3a2a=_0x2a3a2a||0xc8;return function(_0x9a3ab4){if(_0x9a3ab4){return _0x745e06[_0x2e06('0x17')](_0x2a3a2a)[_0x2e06('0x18')](_0x9a3ab4);}};}function respondWithFilteredResult(_0x15b8f5,_0x5e4795){return function(_0x3b307d){if(_0x3b307d){var _0x330e5e=typeof _0x5e4795[_0x2e06('0x19')]===_0x2e06('0x1a')&&typeof _0x5e4795[_0x2e06('0x1b')]===_0x2e06('0x1a');var _0x23da6b=_0x3b307d[_0x2e06('0x1c')];var _0x1418e4=_0x330e5e?0x0:_0x5e4795['offset'];var _0x209942=_0x330e5e?_0x3b307d[_0x2e06('0x1c')]:_0x5e4795['offset']+_0x5e4795[_0x2e06('0x1b')];var _0x173e14;if(_0x209942>=_0x23da6b){_0x209942=_0x23da6b;_0x173e14=0xc8;}else{_0x173e14=0xce;}_0x15b8f5[_0x2e06('0x17')](_0x173e14);return _0x15b8f5[_0x2e06('0x1d')](_0x2e06('0x1e'),_0x1418e4+'-'+_0x209942+'/'+_0x23da6b)[_0x2e06('0x18')](_0x3b307d);}return null;};}function patchUpdates(_0x337421){return function(_0x38ec0f){try{jsonpatch[_0x2e06('0x1f')](_0x38ec0f,_0x337421,!![]);}catch(_0x223d24){return BPromise[_0x2e06('0x20')](_0x223d24);}return _0x38ec0f[_0x2e06('0x21')]();};}function saveUpdates(_0x4609fc,_0x2a31d7){return function(_0x27d028){if(_0x27d028){return _0x27d028[_0x2e06('0x22')](_0x4609fc)[_0x2e06('0x23')](function(_0x22c571){return _0x22c571;});}return null;};}function removeEntity(_0x4963eb,_0x21eea1){return function(_0x1c1e6f){if(_0x1c1e6f){return _0x1c1e6f[_0x2e06('0x24')]()[_0x2e06('0x23')](function(){var _0x1eeffb=_0x1c1e6f[_0x2e06('0x25')]({'plain':!![]});var _0x73d502=_0x2e06('0x26');return db[_0x2e06('0x27')]['destroy']({'where':{'type':_0x73d502,'resourceId':_0x1eeffb['id']}})[_0x2e06('0x23')](function(){return _0x1c1e6f;});})[_0x2e06('0x23')](function(){_0x4963eb[_0x2e06('0x17')](0xcc)[_0x2e06('0x28')]();});}};}function handleEntityNotFound(_0xd54278,_0x5ca0e2){return function(_0x455bf3){if(!_0x455bf3){_0xd54278['sendStatus'](0x194);}return _0x455bf3;};}function handleError(_0x1ed86f,_0x258adf){_0x258adf=_0x258adf||0x1f4;return function(_0x577278){logger[_0x2e06('0x29')](_0x577278[_0x2e06('0x2a')]);if(_0x577278[_0x2e06('0x2b')]){delete _0x577278['name'];}_0x1ed86f['status'](_0x258adf)[_0x2e06('0x2c')](_0x577278);};}exports[_0x2e06('0x2d')]=function(_0x11d757,_0x305316){var _0x394619={},_0x63e387={},_0x25b1f2={'count':0x0,'rows':[]};var _0xdcf571=_[_0x2e06('0x2e')](db['VoiceChanSpy']['rawAttributes'],function(_0x4dfc10){return{'name':_0x4dfc10['fieldName'],'type':_0x4dfc10[_0x2e06('0x2f')][_0x2e06('0x30')]};});_0x63e387['model']=_[_0x2e06('0x2e')](_0xdcf571,_0x2e06('0x2b'));_0x63e387[_0x2e06('0x31')]=_['keys'](_0x11d757[_0x2e06('0x31')]);_0x63e387[_0x2e06('0x32')]=_['intersection'](_0x63e387[_0x2e06('0x33')],_0x63e387[_0x2e06('0x31')]);_0x394619[_0x2e06('0x34')]=_[_0x2e06('0x35')](_0x63e387['model'],qs[_0x2e06('0x36')](_0x11d757[_0x2e06('0x31')][_0x2e06('0x36')]));_0x394619[_0x2e06('0x34')]=_0x394619['attributes'][_0x2e06('0x37')]?_0x394619[_0x2e06('0x34')]:_0x63e387['model'];if(!_0x11d757['query']['hasOwnProperty'](_0x2e06('0x38'))){_0x394619['limit']=qs['limit'](_0x11d757[_0x2e06('0x31')][_0x2e06('0x1b')]);_0x394619[_0x2e06('0x19')]=qs['offset'](_0x11d757[_0x2e06('0x31')]['offset']);}_0x394619[_0x2e06('0x39')]=qs['sort'](_0x11d757[_0x2e06('0x31')][_0x2e06('0x3a')]);_0x394619['where']=qs['filters'](_[_0x2e06('0x3b')](_0x11d757[_0x2e06('0x31')],_0x63e387[_0x2e06('0x32')]),_0xdcf571);if(_0x11d757[_0x2e06('0x31')]['filter']){_0x394619[_0x2e06('0x3c')]=_['merge'](_0x394619['where'],{'$or':_[_0x2e06('0x2e')](_0xdcf571,function(_0x52b195){if(_0x52b195['type']!==_0x2e06('0x3d')){var _0x2164af={};_0x2164af[_0x52b195[_0x2e06('0x2b')]]={'$like':'%'+_0x11d757[_0x2e06('0x31')][_0x2e06('0x3e')]+'%'};return _0x2164af;}})});}_0x394619=_[_0x2e06('0x3f')]({},_0x394619,_0x11d757[_0x2e06('0x40')]);var _0x3b6f8c={'where':_0x394619[_0x2e06('0x3c')]};return db[_0x2e06('0x41')]['count'](_0x3b6f8c)[_0x2e06('0x23')](function(_0x2befb1){_0x25b1f2[_0x2e06('0x1c')]=_0x2befb1;if(_0x11d757[_0x2e06('0x31')][_0x2e06('0x42')]){_0x394619['include']=[{'all':!![]}];}return db[_0x2e06('0x41')][_0x2e06('0x43')](_0x394619);})['then'](function(_0x4fbc3b){_0x25b1f2[_0x2e06('0x44')]=_0x4fbc3b;return _0x25b1f2;})[_0x2e06('0x23')](respondWithFilteredResult(_0x305316,_0x394619))[_0x2e06('0x45')](handleError(_0x305316,null));};exports[_0x2e06('0x46')]=function(_0x5bdbce,_0x379fe7){var _0x4ba79c={'raw':![],'where':{'id':_0x5bdbce['params']['id']}},_0x2709f8={};_0x2709f8[_0x2e06('0x33')]=_[_0x2e06('0x47')](db[_0x2e06('0x41')]['rawAttributes']);_0x2709f8[_0x2e06('0x31')]=_[_0x2e06('0x47')](_0x5bdbce['query']);_0x2709f8[_0x2e06('0x32')]=_[_0x2e06('0x35')](_0x2709f8[_0x2e06('0x33')],_0x2709f8[_0x2e06('0x31')]);_0x4ba79c[_0x2e06('0x34')]=_['intersection'](_0x2709f8[_0x2e06('0x33')],qs[_0x2e06('0x36')](_0x5bdbce[_0x2e06('0x31')]['fields']));_0x4ba79c[_0x2e06('0x34')]=_0x4ba79c['attributes'][_0x2e06('0x37')]?_0x4ba79c['attributes']:_0x2709f8[_0x2e06('0x33')];if(_0x5bdbce['query'][_0x2e06('0x42')]){_0x4ba79c[_0x2e06('0x48')]=[{'all':!![]}];}_0x4ba79c=_['merge']({},_0x4ba79c,_0x5bdbce[_0x2e06('0x40')]);return db[_0x2e06('0x41')][_0x2e06('0x49')](_0x4ba79c)[_0x2e06('0x23')](handleEntityNotFound(_0x379fe7,null))[_0x2e06('0x23')](respondWithResult(_0x379fe7,null))['catch'](handleError(_0x379fe7,null));};exports[_0x2e06('0x4a')]=function(_0x508fff,_0x1de5dd){return db['VoiceChanSpy'][_0x2e06('0x4a')](_0x508fff[_0x2e06('0x4b')],{})[_0x2e06('0x23')](function(_0x43b04e){var _0x4bace6=_0x508fff[_0x2e06('0x4c')][_0x2e06('0x25')]({'plain':!![]});if(!_0x4bace6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bace6['role']===_0x2e06('0x4c')){var _0x53628b=_0x43b04e[_0x2e06('0x25')]({'plain':!![]});var _0x11a5be='ChanSpies';return db[_0x2e06('0x4d')][_0x2e06('0x49')]({'where':{'name':_0x11a5be,'userProfileId':_0x4bace6[_0x2e06('0x4e')]},'raw':!![]})[_0x2e06('0x23')](function(_0x3e9bb4){if(_0x3e9bb4&&_0x3e9bb4['autoAssociation']===0x0){return db['UserProfileResource'][_0x2e06('0x4a')]({'name':_0x53628b[_0x2e06('0x2b')],'resourceId':_0x53628b['id'],'type':_0x3e9bb4[_0x2e06('0x2b')],'sectionId':_0x3e9bb4['id']},{})[_0x2e06('0x23')](function(){return _0x43b04e;});}else{return _0x43b04e;}})['catch'](function(_0x1d8bb8){logger[_0x2e06('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d8bb8);throw _0x1d8bb8;});}return _0x43b04e;})[_0x2e06('0x23')](respondWithResult(_0x1de5dd,0xc9))[_0x2e06('0x45')](handleError(_0x1de5dd,null));};exports['update']=function(_0x5ba6ec,_0x342446){if(_0x5ba6ec[_0x2e06('0x4b')]['id']){delete _0x5ba6ec[_0x2e06('0x4b')]['id'];}return db[_0x2e06('0x41')][_0x2e06('0x49')]({'where':{'id':_0x5ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x342446,null))['then'](saveUpdates(_0x5ba6ec[_0x2e06('0x4b')],null))[_0x2e06('0x23')](respondWithResult(_0x342446,null))[_0x2e06('0x45')](handleError(_0x342446,null));};exports[_0x2e06('0x24')]=function(_0x574de3,_0x4abc51){return db['VoiceChanSpy'][_0x2e06('0x49')]({'where':{'id':_0x574de3[_0x2e06('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4abc51,null))[_0x2e06('0x23')](removeEntity(_0x4abc51,null))['catch'](handleError(_0x4abc51,null));}; \ No newline at end of file +var _0x8e63=['update','then','destroy','get','ChanSpies','UserProfileResource','end','error','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x40d6f4,_0x522e31){var _0x299097=function(_0x21796f){while(--_0x21796f){_0x40d6f4['push'](_0x40d6f4['shift']());}};_0x299097(++_0x522e31);}(_0x8e63,0x7c));var _0x38e6=function(_0x5c6a60,_0x57fe65){_0x5c6a60=_0x5c6a60-0x0;var _0x28e17b=_0x8e63[_0x5c6a60];return _0x28e17b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38e6('0x1'));var moment=require(_0x38e6('0x2'));var BPromise=require(_0x38e6('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38e6('0x4'));var sox=require(_0x38e6('0x5'));var csv=require(_0x38e6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38e6('0x7'));var _=require(_0x38e6('0x8'));var squel=require(_0x38e6('0x9'));var crypto=require(_0x38e6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38e6('0x6'));var querystring=require(_0x38e6('0xb'));var Papa=require(_0x38e6('0xc'));var Redis=require(_0x38e6('0xd'));var authService=require(_0x38e6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38e6('0xf'));var logger=require('../../config/logger')(_0x38e6('0x10'));var utils=require('../../config/utils');var config=require(_0x38e6('0x11'));var licenseUtil=require(_0x38e6('0x12'));var db=require(_0x38e6('0x13'))['db'];function respondWithStatusCode(_0x14d2cf,_0x2e2585){_0x2e2585=_0x2e2585||0xcc;return function(_0x57c207){if(_0x57c207){return _0x14d2cf[_0x38e6('0x14')](_0x2e2585);}return _0x14d2cf[_0x38e6('0x15')](_0x2e2585)['end']();};}function respondWithResult(_0x1fcdeb,_0xfd7f2){_0xfd7f2=_0xfd7f2||0xc8;return function(_0x229f18){if(_0x229f18){return _0x1fcdeb[_0x38e6('0x15')](_0xfd7f2)[_0x38e6('0x16')](_0x229f18);}};}function respondWithFilteredResult(_0x46b525,_0x55208f){return function(_0x279688){if(_0x279688){var _0x36a263=typeof _0x55208f[_0x38e6('0x17')]===_0x38e6('0x18')&&typeof _0x55208f[_0x38e6('0x19')]==='undefined';var _0x91997a=_0x279688['count'];var _0x800418=_0x36a263?0x0:_0x55208f[_0x38e6('0x17')];var _0x57ded4=_0x36a263?_0x279688[_0x38e6('0x1a')]:_0x55208f['offset']+_0x55208f[_0x38e6('0x19')];var _0x521453;if(_0x57ded4>=_0x91997a){_0x57ded4=_0x91997a;_0x521453=0xc8;}else{_0x521453=0xce;}_0x46b525[_0x38e6('0x15')](_0x521453);return _0x46b525[_0x38e6('0x1b')](_0x38e6('0x1c'),_0x800418+'-'+_0x57ded4+'/'+_0x91997a)[_0x38e6('0x16')](_0x279688);}return null;};}function patchUpdates(_0x3f1d54){return function(_0x41bb24){try{jsonpatch['apply'](_0x41bb24,_0x3f1d54,!![]);}catch(_0x5f3f67){return BPromise['reject'](_0x5f3f67);}return _0x41bb24[_0x38e6('0x1d')]();};}function saveUpdates(_0x58dc63,_0x4a82f6){return function(_0x2d995f){if(_0x2d995f){return _0x2d995f[_0x38e6('0x1e')](_0x58dc63)[_0x38e6('0x1f')](function(_0x2a8a11){return _0x2a8a11;});}return null;};}function removeEntity(_0x5f5ab2,_0x140fc3){return function(_0x4530a7){if(_0x4530a7){return _0x4530a7[_0x38e6('0x20')]()['then'](function(){var _0x832025=_0x4530a7[_0x38e6('0x21')]({'plain':!![]});var _0x24e3d6=_0x38e6('0x22');return db[_0x38e6('0x23')][_0x38e6('0x20')]({'where':{'type':_0x24e3d6,'resourceId':_0x832025['id']}})[_0x38e6('0x1f')](function(){return _0x4530a7;});})[_0x38e6('0x1f')](function(){_0x5f5ab2['status'](0xcc)[_0x38e6('0x24')]();});}};}function handleEntityNotFound(_0x491588,_0x23902b){return function(_0x4d2b24){if(!_0x4d2b24){_0x491588[_0x38e6('0x14')](0x194);}return _0x4d2b24;};}function handleError(_0x16ed33,_0x43f05f){_0x43f05f=_0x43f05f||0x1f4;return function(_0x1afc04){logger[_0x38e6('0x25')](_0x1afc04['stack']);if(_0x1afc04[_0x38e6('0x26')]){delete _0x1afc04[_0x38e6('0x26')];}_0x16ed33[_0x38e6('0x15')](_0x43f05f)[_0x38e6('0x27')](_0x1afc04);};}exports[_0x38e6('0x28')]=function(_0x526569,_0x468310){var _0x192893={},_0x39eafd={},_0x3ce1c2={'count':0x0,'rows':[]};var _0xe7489=_[_0x38e6('0x29')](db[_0x38e6('0x2a')]['rawAttributes'],function(_0x220c19){return{'name':_0x220c19[_0x38e6('0x2b')],'type':_0x220c19[_0x38e6('0x2c')][_0x38e6('0x2d')]};});_0x39eafd[_0x38e6('0x2e')]=_[_0x38e6('0x29')](_0xe7489,_0x38e6('0x26'));_0x39eafd['query']=_[_0x38e6('0x2f')](_0x526569[_0x38e6('0x30')]);_0x39eafd[_0x38e6('0x31')]=_[_0x38e6('0x32')](_0x39eafd[_0x38e6('0x2e')],_0x39eafd[_0x38e6('0x30')]);_0x192893[_0x38e6('0x33')]=_['intersection'](_0x39eafd[_0x38e6('0x2e')],qs[_0x38e6('0x34')](_0x526569[_0x38e6('0x30')][_0x38e6('0x34')]));_0x192893['attributes']=_0x192893[_0x38e6('0x33')][_0x38e6('0x35')]?_0x192893['attributes']:_0x39eafd[_0x38e6('0x2e')];if(!_0x526569[_0x38e6('0x30')][_0x38e6('0x36')](_0x38e6('0x37'))){_0x192893['limit']=qs[_0x38e6('0x19')](_0x526569[_0x38e6('0x30')][_0x38e6('0x19')]);_0x192893[_0x38e6('0x17')]=qs['offset'](_0x526569[_0x38e6('0x30')][_0x38e6('0x17')]);}_0x192893[_0x38e6('0x38')]=qs[_0x38e6('0x39')](_0x526569[_0x38e6('0x30')][_0x38e6('0x39')]);_0x192893[_0x38e6('0x3a')]=qs['filters'](_[_0x38e6('0x3b')](_0x526569[_0x38e6('0x30')],_0x39eafd['filters']),_0xe7489);if(_0x526569['query'][_0x38e6('0x3c')]){_0x192893[_0x38e6('0x3a')]=_[_0x38e6('0x3d')](_0x192893[_0x38e6('0x3a')],{'$or':_[_0x38e6('0x29')](_0xe7489,function(_0x2cb64c){if(_0x2cb64c[_0x38e6('0x2c')]!==_0x38e6('0x3e')){var _0x200c9e={};_0x200c9e[_0x2cb64c[_0x38e6('0x26')]]={'$like':'%'+_0x526569['query'][_0x38e6('0x3c')]+'%'};return _0x200c9e;}})});}_0x192893=_[_0x38e6('0x3d')]({},_0x192893,_0x526569[_0x38e6('0x3f')]);var _0xb486bb={'where':_0x192893[_0x38e6('0x3a')]};return db['VoiceChanSpy'][_0x38e6('0x1a')](_0xb486bb)['then'](function(_0x7a8077){_0x3ce1c2[_0x38e6('0x1a')]=_0x7a8077;if(_0x526569[_0x38e6('0x30')][_0x38e6('0x40')]){_0x192893[_0x38e6('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x38e6('0x42')](_0x192893);})[_0x38e6('0x1f')](function(_0x5f4ae3){_0x3ce1c2[_0x38e6('0x43')]=_0x5f4ae3;return _0x3ce1c2;})[_0x38e6('0x1f')](respondWithFilteredResult(_0x468310,_0x192893))[_0x38e6('0x44')](handleError(_0x468310,null));};exports['show']=function(_0x1904b5,_0x295e5c){var _0x49a021={'raw':![],'where':{'id':_0x1904b5[_0x38e6('0x45')]['id']}},_0x454d58={};_0x454d58[_0x38e6('0x2e')]=_[_0x38e6('0x2f')](db[_0x38e6('0x2a')]['rawAttributes']);_0x454d58[_0x38e6('0x30')]=_['keys'](_0x1904b5[_0x38e6('0x30')]);_0x454d58[_0x38e6('0x31')]=_['intersection'](_0x454d58[_0x38e6('0x2e')],_0x454d58[_0x38e6('0x30')]);_0x49a021['attributes']=_[_0x38e6('0x32')](_0x454d58[_0x38e6('0x2e')],qs[_0x38e6('0x34')](_0x1904b5['query'][_0x38e6('0x34')]));_0x49a021[_0x38e6('0x33')]=_0x49a021[_0x38e6('0x33')]['length']?_0x49a021['attributes']:_0x454d58[_0x38e6('0x2e')];if(_0x1904b5[_0x38e6('0x30')]['includeAll']){_0x49a021[_0x38e6('0x41')]=[{'all':!![]}];}_0x49a021=_[_0x38e6('0x3d')]({},_0x49a021,_0x1904b5[_0x38e6('0x3f')]);return db[_0x38e6('0x2a')][_0x38e6('0x46')](_0x49a021)[_0x38e6('0x1f')](handleEntityNotFound(_0x295e5c,null))[_0x38e6('0x1f')](respondWithResult(_0x295e5c,null))['catch'](handleError(_0x295e5c,null));};exports['create']=function(_0x447808,_0x5d1e7b){return db[_0x38e6('0x2a')][_0x38e6('0x47')](_0x447808['body'],{})['then'](function(_0x3ffa84){var _0x358baa=_0x447808['user'][_0x38e6('0x21')]({'plain':!![]});if(!_0x358baa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x358baa['role']===_0x38e6('0x48')){var _0x432179=_0x3ffa84[_0x38e6('0x21')]({'plain':!![]});var _0x1b6291=_0x38e6('0x22');return db['UserProfileSection'][_0x38e6('0x46')]({'where':{'name':_0x1b6291,'userProfileId':_0x358baa[_0x38e6('0x49')]},'raw':!![]})[_0x38e6('0x1f')](function(_0x957a2a){if(_0x957a2a&&_0x957a2a[_0x38e6('0x4a')]===0x0){return db[_0x38e6('0x23')][_0x38e6('0x47')]({'name':_0x432179['name'],'resourceId':_0x432179['id'],'type':_0x957a2a['name'],'sectionId':_0x957a2a['id']},{})['then'](function(){return _0x3ffa84;});}else{return _0x3ffa84;}})[_0x38e6('0x44')](function(_0x3cdcbd){logger['error'](_0x38e6('0x4b'),_0x3cdcbd);throw _0x3cdcbd;});}return _0x3ffa84;})[_0x38e6('0x1f')](respondWithResult(_0x5d1e7b,0xc9))[_0x38e6('0x44')](handleError(_0x5d1e7b,null));};exports[_0x38e6('0x1e')]=function(_0x38590e,_0x34ab19){if(_0x38590e[_0x38e6('0x4c')]['id']){delete _0x38590e[_0x38e6('0x4c')]['id'];}return db[_0x38e6('0x2a')][_0x38e6('0x46')]({'where':{'id':_0x38590e['params']['id']}})[_0x38e6('0x1f')](handleEntityNotFound(_0x34ab19,null))[_0x38e6('0x1f')](saveUpdates(_0x38590e[_0x38e6('0x4c')],null))[_0x38e6('0x1f')](respondWithResult(_0x34ab19,null))[_0x38e6('0x44')](handleError(_0x34ab19,null));};exports[_0x38e6('0x20')]=function(_0x1175e0,_0x503418){return db[_0x38e6('0x2a')][_0x38e6('0x46')]({'where':{'id':_0x1175e0[_0x38e6('0x45')]['id']}})[_0x38e6('0x1f')](handleEntityNotFound(_0x503418,null))['then'](removeEntity(_0x503418,null))['catch'](handleError(_0x503418,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index debb83d..c8008af 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 _0xac8e=['name','options','join','StopMixMonitor','length','concat','internal','findAll','then','catch','exports','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy'];(function(_0x59baf9,_0xeee47e){var _0x1f91d3=function(_0x54edfa){while(--_0x54edfa){_0x59baf9['push'](_0x59baf9['shift']());}};_0x1f91d3(++_0xeee47e);}(_0xac8e,0x18c));var _0xeac8=function(_0x41bb2c,_0x2306ca){_0x41bb2c=_0x41bb2c-0x0;var _0x2ac138=_0xac8e[_0x41bb2c];return _0x2ac138;};'use strict';var _=require(_0xeac8('0x0'));var util=require(_0xeac8('0x1'));var BPromise=require(_0xeac8('0x2'));var attributes=require(_0xeac8('0x3'));var getUserApplications=function(_0x12c7e2,_0x49556c,_0x3c20a1){var _0x5ab35c=0x1;var _0x31b7f6=[];var _0x5ea9ab={'context':_0x49556c[_0xeac8('0x4')]||_0xeac8('0x5'),'exten':util[_0xeac8('0x6')](_0xeac8('0x7'),_0x12c7e2[_0xeac8('0x8')],_0x3c20a1),'type':_0xeac8('0x9'),'isApp':![],'ChanSpyId':_0x12c7e2['id'],'UserId':_0x49556c['id']};_0x31b7f6[_0xeac8('0xa')](_[_0xeac8('0xb')]({'app':_0xeac8('0xc'),'appdata':util[_0xeac8('0x6')](_0xeac8('0xd'),_0xeac8('0xe')),'priority':_0x5ab35c++},_0x5ea9ab));if(_0x12c7e2[_0xeac8('0xf')]){_0x31b7f6[_0xeac8('0xa')](_[_0xeac8('0xb')]({'app':_0xeac8('0x10'),'appdata':util['format'](_0xeac8('0x11'),_0x12c7e2[_0xeac8('0x12')]),'priority':_0x5ab35c++},_0x5ea9ab));}if(_0x12c7e2[_0xeac8('0x13')]){_0x31b7f6[_0xeac8('0xa')](_[_0xeac8('0xb')]({'app':'Authenticate','appdata':_0x12c7e2[_0xeac8('0x14')],'priority':_0x5ab35c++},_0x5ea9ab));}_0x31b7f6[_0xeac8('0xa')](_['merge']({'app':_0xeac8('0x15'),'appdata':util[_0xeac8('0x6')]('SIP/%s,%s',_0x49556c[_0xeac8('0x16')],_0x12c7e2[_0xeac8('0x17')]?_0x12c7e2[_0xeac8('0x17')][_0xeac8('0x18')](''):''),'priority':_0x5ab35c++},_0x5ea9ab));if(_0x12c7e2[_0xeac8('0xf')]){_0x31b7f6[_0xeac8('0xa')](_[_0xeac8('0xb')]({'app':_0xeac8('0x19'),'priority':_0x5ab35c++},_0x5ea9ab));}return _0x31b7f6;};var getChanSpyApplications=function(_0x2ae328,_0x1ba19e){var _0x54af05=[];for(var _0x1c965b=0x0,_0xc0af3f=0x1;_0x1c965b<_0x1ba19e[_0xeac8('0x1a')];_0x1c965b++,_0xc0af3f=0x1){_0x54af05=_0x54af05[_0xeac8('0x1b')](getUserApplications(_0x2ae328,_0x1ba19e[_0x1c965b],_0x1ba19e[_0x1c965b][_0xeac8('0x1c')]));if(_0x1ba19e[_0x1c965b]['internal']!=_0x1ba19e[_0x1c965b][_0xeac8('0x16')]){_0x54af05=_0x54af05['concat'](getUserApplications(_0x2ae328,_0x1ba19e[_0x1c965b],_0x1ba19e[_0x1c965b][_0xeac8('0x16')]));}}return _0x54af05;};var getChanSpyPromise=function(_0x3b4ea2,_0x22157f){return new BPromise(function(_0x112030,_0x3ecd9a){return _0x3b4ea2['User'][_0xeac8('0x1d')]({'attributes':['id',_0xeac8('0x16'),_0xeac8('0x1c')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xeac8('0x1e')](function(_0x38f076){if(_0x38f076){return _0x112030(getChanSpyApplications(_0x22157f,_0x38f076));}return _0x112030([]);})[_0xeac8('0x1f')](function(_0xa9214d){_0x3ecd9a(_0xa9214d);});});};module[_0xeac8('0x20')]=function(_0x5455c5,_0x3048b4){var _0x5d08a7=_0x5455c5['models'];return _0x5455c5[_0xeac8('0x21')]('VoiceChanSpy',attributes,{'tableName':_0xeac8('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x11c399,_0xa5d168,_0x578d09){return getChanSpyPromise(_0x5d08a7,_0x11c399)[_0xeac8('0x1e')](function(_0x3623ae){if(_0x3623ae&&_0x3623ae[_0xeac8('0x1a')]){return _0x5d08a7[_0xeac8('0x23')][_0xeac8('0x24')](_0x3623ae);}})[_0xeac8('0x1e')](function(){_0x578d09();})[_0xeac8('0x1f')](function(_0x17a56f){_0x578d09(_0x17a56f);});},'afterUpdate':function(_0x16326a,_0x390c12,_0x44f934){return _0x5d08a7[_0xeac8('0x23')]['destroy']({'where':{'ChanSpyId':_0x16326a['id']}})[_0xeac8('0x1e')](function(){return getChanSpyPromise(_0x5d08a7,_0x16326a);})['then'](function(_0x18deb9){if(_0x18deb9&&_0x18deb9[_0xeac8('0x1a')]){return _0x5d08a7[_0xeac8('0x23')][_0xeac8('0x24')](_0x18deb9);}})[_0xeac8('0x1e')](function(){_0x44f934();})['catch'](function(_0x440e38){_0x44f934(_0x440e38);});},'afterDestroy':function(_0x2c1ba1,_0x532891,_0x5ede89){return _0x5d08a7['VoiceExtension'][_0xeac8('0x25')]({'where':{'ChanSpyId':_0x2c1ba1['id']}})[_0xeac8('0x1e')](function(){_0x5ede89();})[_0xeac8('0x1f')](function(_0x1acafb){_0x5ede89(_0x1acafb);});}}});}; \ No newline at end of file +var _0x98a4=['then','models','VoiceChanSpy','voice_chanspy','length','bulkCreate','VoiceExtension','catch','destroy','util','./voiceChanSpy.attributes','context','format','%s%s','merge','Set','CDR(type)=%s','record','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','internal','concat','findAll','agent'];(function(_0x2fa2d6,_0x5d7dc8){var _0x3eb8ab=function(_0x23081f){while(--_0x23081f){_0x2fa2d6['push'](_0x2fa2d6['shift']());}};_0x3eb8ab(++_0x5d7dc8);}(_0x98a4,0x1c3));var _0x498a=function(_0x43a83b,_0x848a9b){_0x43a83b=_0x43a83b-0x0;var _0x5cb06a=_0x98a4[_0x43a83b];return _0x5cb06a;};'use strict';var _=require('lodash');var util=require(_0x498a('0x0'));var BPromise=require('bluebird');var attributes=require(_0x498a('0x1'));var getUserApplications=function(_0x5375e9,_0x562cff,_0x61e64){var _0x59b8b9=0x1;var _0x33b23d=[];var _0xe75802={'context':_0x562cff[_0x498a('0x2')]||'from-sip','exten':util[_0x498a('0x3')](_0x498a('0x4'),_0x5375e9['prefix'],_0x61e64),'type':'system','isApp':![],'ChanSpyId':_0x5375e9['id'],'UserId':_0x562cff['id']};_0x33b23d['push'](_[_0x498a('0x5')]({'app':_0x498a('0x6'),'appdata':util['format'](_0x498a('0x7'),'chanspy'),'priority':_0x59b8b9++},_0xe75802));if(_0x5375e9[_0x498a('0x8')]){_0x33b23d[_0x498a('0x9')](_[_0x498a('0x5')]({'app':_0x498a('0xa'),'appdata':util[_0x498a('0x3')](_0x498a('0xb'),_0x5375e9['recordingFormat']),'priority':_0x59b8b9++},_0xe75802));}if(_0x5375e9[_0x498a('0xc')]){_0x33b23d[_0x498a('0x9')](_['merge']({'app':_0x498a('0xd'),'appdata':_0x5375e9[_0x498a('0xe')],'priority':_0x59b8b9++},_0xe75802));}_0x33b23d[_0x498a('0x9')](_['merge']({'app':_0x498a('0xf'),'appdata':util['format'](_0x498a('0x10'),_0x562cff[_0x498a('0x11')],_0x5375e9[_0x498a('0x12')]?_0x5375e9[_0x498a('0x12')][_0x498a('0x13')](''):''),'priority':_0x59b8b9++},_0xe75802));if(_0x5375e9[_0x498a('0x8')]){_0x33b23d[_0x498a('0x9')](_['merge']({'app':_0x498a('0x14'),'priority':_0x59b8b9++},_0xe75802));}return _0x33b23d;};var getChanSpyApplications=function(_0x463a3a,_0x372315){var _0x28d154=[];for(var _0x9047f3=0x0,_0x5dcab2=0x1;_0x9047f3<_0x372315['length'];_0x9047f3++,_0x5dcab2=0x1){_0x28d154=_0x28d154['concat'](getUserApplications(_0x463a3a,_0x372315[_0x9047f3],_0x372315[_0x9047f3][_0x498a('0x15')]));if(_0x372315[_0x9047f3][_0x498a('0x15')]!=_0x372315[_0x9047f3][_0x498a('0x11')]){_0x28d154=_0x28d154[_0x498a('0x16')](getUserApplications(_0x463a3a,_0x372315[_0x9047f3],_0x372315[_0x9047f3]['name']));}}return _0x28d154;};var getChanSpyPromise=function(_0x5bf1d9,_0x17f7c4){return new BPromise(function(_0x473f05,_0x45e882){return _0x5bf1d9['User'][_0x498a('0x17')]({'attributes':['id','name',_0x498a('0x15')],'where':{'role':_0x498a('0x18'),'chanspy':!![]},'raw':!![]})[_0x498a('0x19')](function(_0x21213e){if(_0x21213e){return _0x473f05(getChanSpyApplications(_0x17f7c4,_0x21213e));}return _0x473f05([]);})['catch'](function(_0x5870d7){_0x45e882(_0x5870d7);});});};module['exports']=function(_0x2ac1bf,_0x587c64){var _0x106eca=_0x2ac1bf[_0x498a('0x1a')];return _0x2ac1bf['define'](_0x498a('0x1b'),attributes,{'tableName':_0x498a('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x38bb28,_0x14e0ab,_0x4ecf56){return getChanSpyPromise(_0x106eca,_0x38bb28)[_0x498a('0x19')](function(_0x240ceb){if(_0x240ceb&&_0x240ceb[_0x498a('0x1d')]){return _0x106eca['VoiceExtension'][_0x498a('0x1e')](_0x240ceb);}})['then'](function(){_0x4ecf56();})['catch'](function(_0x582dc1){_0x4ecf56(_0x582dc1);});},'afterUpdate':function(_0x4101b6,_0x167c43,_0x2de827){return _0x106eca['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x4101b6['id']}})[_0x498a('0x19')](function(){return getChanSpyPromise(_0x106eca,_0x4101b6);})[_0x498a('0x19')](function(_0x477ad2){if(_0x477ad2&&_0x477ad2[_0x498a('0x1d')]){return _0x106eca[_0x498a('0x1f')][_0x498a('0x1e')](_0x477ad2);}})[_0x498a('0x19')](function(){_0x2de827();})[_0x498a('0x20')](function(_0x215f96){_0x2de827(_0x215f96);});},'afterDestroy':function(_0x1a3c85,_0x33e045,_0xddc247){return _0x106eca[_0x498a('0x1f')][_0x498a('0x21')]({'where':{'ChanSpyId':_0x1a3c85['id']}})[_0x498a('0x19')](function(){_0xddc247();})[_0x498a('0x20')](function(_0x49a8cb){_0xddc247(_0x49a8cb);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8e2fc82..321ef4e 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 _0xb9a7=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x3ad2e5,_0x94d414){var _0xc4e565=function(_0x2c96e3){while(--_0x2c96e3){_0x3ad2e5['push'](_0x3ad2e5['shift']());}};_0xc4e565(++_0x94d414);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xb9a7[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file +var _0xb469=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1be5aa,_0x42fefb){var _0x8848c1=function(_0x466706){while(--_0x466706){_0x1be5aa['push'](_0x1be5aa['shift']());}};_0x8848c1(++_0x42fefb);}(_0xb469,0x13b));var _0x9b46=function(_0x23de42,_0x456eeb){_0x23de42=_0x23de42-0x0;var _0x335141=_0xb469[_0x23de42];return _0x335141;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2a782f9..99c37ba 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 _0x5f89=['delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','/:id','isAuthenticated','show','post','create','update'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5f89,0x93));var _0x95f8=function(_0x2b6125,_0x54c196){_0x2b6125=_0x2b6125-0x0;var _0xda91be=_0x5f89[_0x2b6125];return _0xda91be;};'use strict';var multer=require('multer');var util=require(_0x95f8('0x0'));var path=require('path');var timeout=require(_0x95f8('0x1'));var express=require('express');var router=express[_0x95f8('0x2')]();var fs_extra=require(_0x95f8('0x3'));var auth=require(_0x95f8('0x4'));var interaction=require(_0x95f8('0x5'));var config=require(_0x95f8('0x6'));var controller=require(_0x95f8('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x95f8('0x8')](_0x95f8('0x9'),auth[_0x95f8('0xa')](),controller[_0x95f8('0xb')]);router[_0x95f8('0xc')]('/',auth['isAuthenticated'](),controller[_0x95f8('0xd')]);router['put'](_0x95f8('0x9'),auth[_0x95f8('0xa')](),controller[_0x95f8('0xe')]);router[_0x95f8('0xf')](_0x95f8('0x9'),auth[_0x95f8('0xa')](),controller[_0x95f8('0x10')]);module[_0x95f8('0x11')]=router; \ No newline at end of file +var _0xf16c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4642e9,_0x33df6c){var _0x19842d=function(_0xa3ad8e){while(--_0xa3ad8e){_0x4642e9['push'](_0x4642e9['shift']());}};_0x19842d(++_0x33df6c);}(_0xf16c,0x15e));var _0xcf16=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf16c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xcf16('0x0'));var util=require(_0xcf16('0x1'));var path=require(_0xcf16('0x2'));var timeout=require(_0xcf16('0x3'));var express=require(_0xcf16('0x4'));var router=express[_0xcf16('0x5')]();var fs_extra=require(_0xcf16('0x6'));var auth=require(_0xcf16('0x7'));var interaction=require(_0xcf16('0x8'));var config=require(_0xcf16('0x9'));var controller=require(_0xcf16('0xa'));router[_0xcf16('0xb')]('/',auth[_0xcf16('0xc')](),controller['index']);router['get'](_0xcf16('0xd'),auth[_0xcf16('0xc')](),controller[_0xcf16('0xe')]);router[_0xcf16('0xf')]('/',auth[_0xcf16('0xc')](),controller[_0xcf16('0x10')]);router[_0xcf16('0x11')]('/:id',auth[_0xcf16('0xc')](),controller[_0xcf16('0x12')]);router[_0xcf16('0x13')]('/:id',auth[_0xcf16('0xc')](),controller[_0xcf16('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index aad3dc6..0a3cf3e 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 _0xaa89=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x897252,_0x3b8070){var _0x48d7c3=function(_0x5e5a21){while(--_0x5e5a21){_0x897252['push'](_0x897252['shift']());}};_0x48d7c3(++_0x3b8070);}(_0xaa89,0x130));var _0x9aa8=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xaa89[_0x496738];return _0xee1381;};'use strict';var Sequelize=require(_0x9aa8('0x0'));module[_0x9aa8('0x1')]={'name':{'type':Sequelize[_0x9aa8('0x2')],'unique':_0x9aa8('0x3')},'description':{'type':Sequelize[_0x9aa8('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9aa8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xac75=['BOOLEAN','sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac75,0x11e));var _0x5ac7=function(_0x43701f,_0x3768dc){_0x43701f=_0x43701f-0x0;var _0x38f900=_0xac75[_0x43701f];return _0x38f900;};'use strict';var Sequelize=require(_0x5ac7('0x0'));module[_0x5ac7('0x1')]={'name':{'type':Sequelize[_0x5ac7('0x2')],'unique':_0x5ac7('0x3')},'description':{'type':Sequelize[_0x5ac7('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5ac7('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 258482d..d0b8e60 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 _0x9d3e=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','chan_sip.so','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','crypto','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','http','request','then','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','Contexts','stack','name','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','intersection','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x668230,_0x5ce8b0){var _0x2c22da=function(_0x35cfce){while(--_0x35cfce){_0x668230['push'](_0x668230['shift']());}};_0x2c22da(++_0x5ce8b0);}(_0x9d3e,0x1a1));var _0xe9d3=function(_0x4020e1,_0x2e8efc){_0x4020e1=_0x4020e1-0x0;var _0x5610eb=_0x9d3e[_0x4020e1];return _0x5610eb;};'use strict';var emlformat=require(_0xe9d3('0x0'));var rimraf=require(_0xe9d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9d3('0x3'));var Mustache=require(_0xe9d3('0x4'));var util=require(_0xe9d3('0x5'));var path=require(_0xe9d3('0x6'));var sox=require(_0xe9d3('0x7'));var csv=require(_0xe9d3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe9d3('0x9'));var crypto=require(_0xe9d3('0xa'));var jsforce=require(_0xe9d3('0xb'));var deskjs=require(_0xe9d3('0xc'));var toCsv=require(_0xe9d3('0x8'));var querystring=require('querystring');var Papa=require(_0xe9d3('0xd'));var Redis=require(_0xe9d3('0xe'));var authService=require(_0xe9d3('0xf'));var qs=require(_0xe9d3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9d3('0x11'));var logger=require(_0xe9d3('0x12'))(_0xe9d3('0x13'));var utils=require(_0xe9d3('0x14'));var config=require(_0xe9d3('0x15'));var licenseUtil=require(_0xe9d3('0x16'));var db=require(_0xe9d3('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xe9d3('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x150675,_0x16ffca,_0x20bc87,_0x2e7b81){return new BPromise(function(_0x197483,_0x370773){var _0x26312c=_0x2e7b81||client;return _0x26312c[_0xe9d3('0x19')](_0x150675,_0x20bc87)[_0xe9d3('0x1a')](function(_0x4e221c){logger['info']('VoiceContext,\x20%s,\x20%s',_0x16ffca,'request\x20sent');logger[_0xe9d3('0x1b')](_0xe9d3('0x1c'),_0x16ffca,_0xe9d3('0x1d'),JSON[_0xe9d3('0x1e')](_0x4e221c));if(_0x4e221c[_0xe9d3('0x1f')]){if(_0x4e221c[_0xe9d3('0x1f')][_0xe9d3('0x20')]===0x1f4){logger[_0xe9d3('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x16ffca,_0x4e221c[_0xe9d3('0x1f')][_0xe9d3('0x21')]);return _0x370773(_0x4e221c[_0xe9d3('0x1f')][_0xe9d3('0x21')]);}logger[_0xe9d3('0x1f')](_0xe9d3('0x22'),_0x16ffca,_0x4e221c['error']['message']);return _0x197483(_0x4e221c[_0xe9d3('0x1f')]['message']);}else{logger[_0xe9d3('0x23')](_0xe9d3('0x22'),_0x16ffca,_0xe9d3('0x1d'));_0x197483(_0x4e221c[_0xe9d3('0x24')][_0xe9d3('0x21')]);}})[_0xe9d3('0x25')](function(_0x2b4666){logger[_0xe9d3('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x16ffca,_0x2b4666);_0x370773(_0x2b4666);});});}function respondWithStatusCode(_0x5b0bce,_0x2fa993){_0x2fa993=_0x2fa993||0xcc;return function(_0x22b5f8){if(_0x22b5f8){return _0x5b0bce[_0xe9d3('0x26')](_0x2fa993);}return _0x5b0bce[_0xe9d3('0x27')](_0x2fa993)[_0xe9d3('0x28')]();};}function respondWithResult(_0x11510a,_0x4ae275){_0x4ae275=_0x4ae275||0xc8;return function(_0x5abd6e){if(_0x5abd6e){return _0x11510a[_0xe9d3('0x27')](_0x4ae275)[_0xe9d3('0x29')](_0x5abd6e);}};}function respondWithFilteredResult(_0x131f16,_0x2cdcd9){return function(_0x2c49c9){if(_0x2c49c9){var _0xa5a2ca=typeof _0x2cdcd9['offset']==='undefined'&&typeof _0x2cdcd9[_0xe9d3('0x2a')]===_0xe9d3('0x2b');var _0x504423=_0x2c49c9[_0xe9d3('0x2c')];var _0x3bee02=_0xa5a2ca?0x0:_0x2cdcd9[_0xe9d3('0x2d')];var _0x96e92e=_0xa5a2ca?_0x2c49c9[_0xe9d3('0x2c')]:_0x2cdcd9[_0xe9d3('0x2d')]+_0x2cdcd9[_0xe9d3('0x2a')];var _0x414f5e;if(_0x96e92e>=_0x504423){_0x96e92e=_0x504423;_0x414f5e=0xc8;}else{_0x414f5e=0xce;}_0x131f16[_0xe9d3('0x27')](_0x414f5e);return _0x131f16[_0xe9d3('0x2e')](_0xe9d3('0x2f'),_0x3bee02+'-'+_0x96e92e+'/'+_0x504423)[_0xe9d3('0x29')](_0x2c49c9);}return null;};}function patchUpdates(_0x1ed275){return function(_0x5f29f5){try{jsonpatch[_0xe9d3('0x30')](_0x5f29f5,_0x1ed275,!![]);}catch(_0x1d6476){return BPromise['reject'](_0x1d6476);}return _0x5f29f5[_0xe9d3('0x31')]();};}function saveUpdates(_0x2172ed,_0x465e66){return function(_0x53466c){if(_0x53466c){return _0x53466c[_0xe9d3('0x32')](_0x2172ed)[_0xe9d3('0x1a')](function(_0x293bec){return _0x293bec;});}return null;};}function removeEntity(_0x154710,_0x5c6689){return function(_0x1197cb){if(_0x1197cb){return _0x1197cb[_0xe9d3('0x33')]()[_0xe9d3('0x1a')](function(){var _0x1c33ee=_0x1197cb['get']({'plain':!![]});var _0x1f8fd5=_0xe9d3('0x34');return db['UserProfileResource'][_0xe9d3('0x33')]({'where':{'type':_0x1f8fd5,'resourceId':_0x1c33ee['id']}})['then'](function(){return _0x1197cb;});})['then'](function(){_0x154710[_0xe9d3('0x27')](0xcc)[_0xe9d3('0x28')]();});}};}function handleEntityNotFound(_0x4453e5,_0x4f6e74){return function(_0x2962e6){if(!_0x2962e6){_0x4453e5[_0xe9d3('0x26')](0x194);}return _0x2962e6;};}function handleError(_0x436e9f,_0x187047){_0x187047=_0x187047||0x1f4;return function(_0xa0e237){logger[_0xe9d3('0x1f')](_0xa0e237[_0xe9d3('0x35')]);if(_0xa0e237['name']){delete _0xa0e237[_0xe9d3('0x36')];}_0x436e9f[_0xe9d3('0x27')](_0x187047)['send'](_0xa0e237);};}exports['index']=function(_0xd83948,_0x519fa4){var _0x4bffbb={},_0x6ddefe={},_0x37c299={'count':0x0,'rows':[]};var _0x63f55d=_['map'](db[_0xe9d3('0x37')][_0xe9d3('0x38')],function(_0x1cae81){return{'name':_0x1cae81[_0xe9d3('0x39')],'type':_0x1cae81[_0xe9d3('0x3a')][_0xe9d3('0x3b')]};});_0x6ddefe[_0xe9d3('0x3c')]=_['map'](_0x63f55d,_0xe9d3('0x36'));_0x6ddefe[_0xe9d3('0x3d')]=_[_0xe9d3('0x3e')](_0xd83948[_0xe9d3('0x3d')]);_0x6ddefe[_0xe9d3('0x3f')]=_['intersection'](_0x6ddefe['model'],_0x6ddefe['query']);_0x4bffbb[_0xe9d3('0x40')]=_['intersection'](_0x6ddefe[_0xe9d3('0x3c')],qs[_0xe9d3('0x41')](_0xd83948[_0xe9d3('0x3d')][_0xe9d3('0x41')]));_0x4bffbb[_0xe9d3('0x40')]=_0x4bffbb[_0xe9d3('0x40')][_0xe9d3('0x42')]?_0x4bffbb[_0xe9d3('0x40')]:_0x6ddefe[_0xe9d3('0x3c')];if(!_0xd83948[_0xe9d3('0x3d')][_0xe9d3('0x43')]('nolimit')){_0x4bffbb[_0xe9d3('0x2a')]=qs['limit'](_0xd83948['query'][_0xe9d3('0x2a')]);_0x4bffbb[_0xe9d3('0x2d')]=qs['offset'](_0xd83948[_0xe9d3('0x3d')][_0xe9d3('0x2d')]);}_0x4bffbb['order']=qs[_0xe9d3('0x44')](_0xd83948[_0xe9d3('0x3d')][_0xe9d3('0x44')]);_0x4bffbb[_0xe9d3('0x45')]=qs[_0xe9d3('0x3f')](_['pick'](_0xd83948[_0xe9d3('0x3d')],_0x6ddefe[_0xe9d3('0x3f')]),_0x63f55d);if(_0xd83948[_0xe9d3('0x3d')][_0xe9d3('0x46')]){_0x4bffbb[_0xe9d3('0x45')]=_['merge'](_0x4bffbb[_0xe9d3('0x45')],{'$or':_[_0xe9d3('0x47')](_0x63f55d,function(_0x56e34a){if(_0x56e34a['type']!==_0xe9d3('0x48')){var _0x129156={};_0x129156[_0x56e34a[_0xe9d3('0x36')]]={'$like':'%'+_0xd83948[_0xe9d3('0x3d')]['filter']+'%'};return _0x129156;}})});}_0x4bffbb=_[_0xe9d3('0x49')]({},_0x4bffbb,_0xd83948[_0xe9d3('0x4a')]);var _0x3d2f17={'where':_0x4bffbb['where']};return db['VoiceContext'][_0xe9d3('0x2c')](_0x3d2f17)[_0xe9d3('0x1a')](function(_0x546806){_0x37c299[_0xe9d3('0x2c')]=_0x546806;if(_0xd83948[_0xe9d3('0x3d')][_0xe9d3('0x4b')]){_0x4bffbb[_0xe9d3('0x4c')]=[{'all':!![]}];}return db[_0xe9d3('0x37')][_0xe9d3('0x4d')](_0x4bffbb);})['then'](function(_0x50629e){_0x37c299[_0xe9d3('0x4e')]=_0x50629e;return _0x37c299;})[_0xe9d3('0x1a')](respondWithFilteredResult(_0x519fa4,_0x4bffbb))[_0xe9d3('0x25')](handleError(_0x519fa4,null));};exports[_0xe9d3('0x4f')]=function(_0x28d17,_0x46375a){var _0x3bd27c={'raw':![],'where':{'id':_0x28d17['params']['id']}},_0x312be7={};_0x312be7[_0xe9d3('0x3c')]=_['keys'](db['VoiceContext'][_0xe9d3('0x38')]);_0x312be7['query']=_[_0xe9d3('0x3e')](_0x28d17[_0xe9d3('0x3d')]);_0x312be7['filters']=_['intersection'](_0x312be7[_0xe9d3('0x3c')],_0x312be7[_0xe9d3('0x3d')]);_0x3bd27c[_0xe9d3('0x40')]=_[_0xe9d3('0x50')](_0x312be7[_0xe9d3('0x3c')],qs[_0xe9d3('0x41')](_0x28d17[_0xe9d3('0x3d')]['fields']));_0x3bd27c[_0xe9d3('0x40')]=_0x3bd27c[_0xe9d3('0x40')][_0xe9d3('0x42')]?_0x3bd27c['attributes']:_0x312be7['model'];if(_0x28d17[_0xe9d3('0x3d')][_0xe9d3('0x4b')]){_0x3bd27c[_0xe9d3('0x4c')]=[{'all':!![]}];}_0x3bd27c=_['merge']({},_0x3bd27c,_0x28d17[_0xe9d3('0x4a')]);return db[_0xe9d3('0x37')][_0xe9d3('0x51')](_0x3bd27c)['then'](handleEntityNotFound(_0x46375a,null))['then'](respondWithResult(_0x46375a,null))[_0xe9d3('0x25')](handleError(_0x46375a,null));};exports['create']=function(_0x37035c,_0x1fa23a,_0x1fda2c){var _0x2e532b;return db[_0xe9d3('0x37')][_0xe9d3('0x52')](_0x37035c[_0xe9d3('0x53')],{'raw':!![]})[_0xe9d3('0x1a')](function(_0x2c683a){_0x2e532b=_0x2c683a;return db[_0xe9d3('0x37')][_0xe9d3('0x4d')]({'raw':!![]});})[_0xe9d3('0x1a')](function(_0x2db746){var _0x31ee8a=fs[_0xe9d3('0x54')](path[_0xe9d3('0x55')](config[_0xe9d3('0x56')],_0xe9d3('0x57')),_0xe9d3('0x58'));var _0x13375c=ejs[_0xe9d3('0x59')](_0x31ee8a,{'contexts':_0x2db746||[]});fs[_0xe9d3('0x5a')](_0xe9d3('0x5b'),_0x13375c);})['then'](function(){return respondWithRpcPromise(_0xe9d3('0x5c'),_0xe9d3('0x52'),{'module':'chan_sip.so'});})[_0xe9d3('0x1a')](function(){var _0x446304=_0x37035c['user'][_0xe9d3('0x5d')]({'plain':!![]});if(!_0x446304)throw new Error(_0xe9d3('0x5e'));if(_0x446304[_0xe9d3('0x5f')]===_0xe9d3('0x60')){var _0x400563=_0x2e532b['get']({'plain':!![]});return db[_0xe9d3('0x61')]['find']({'where':{'name':'Contexts','userProfileId':_0x446304['userProfileId']},'raw':!![]})[_0xe9d3('0x1a')](function(_0x5111d8){if(_0x5111d8&&_0x5111d8[_0xe9d3('0x62')]===0x0){return db[_0xe9d3('0x63')][_0xe9d3('0x52')]({'name':_0x400563['name'],'resourceId':_0x400563['id'],'type':_0x5111d8[_0xe9d3('0x36')],'sectionId':_0x5111d8['id']},{})['then'](function(){return _0x2e532b;});}else{return _0x2e532b;}})['catch'](function(_0x586232){logger['error'](_0xe9d3('0x64'),_0x586232);throw _0x586232;});}return _0x2e532b;})['then'](respondWithResult(_0x1fa23a,0xc9))[_0xe9d3('0x25')](handleError(_0x1fa23a,null));};exports['update']=function(_0xd2db37,_0x582606,_0x1a5596){var _0x592eae;return db[_0xe9d3('0x37')][_0xe9d3('0x51')]({'where':{'id':_0xd2db37['params']['id']}})[_0xe9d3('0x1a')](handleEntityNotFound(_0x582606,null))['then'](saveUpdates(_0xd2db37[_0xe9d3('0x53')],null))['then'](function(_0x32c95e){if(_0x32c95e){_0x592eae=_0x32c95e;return db[_0xe9d3('0x37')][_0xe9d3('0x4d')]({'raw':!![]});}})['then'](function(_0x271a34){var _0x3b75d8=fs[_0xe9d3('0x54')](path[_0xe9d3('0x55')](config[_0xe9d3('0x56')],_0xe9d3('0x57')),_0xe9d3('0x58'));var _0x154771=ejs['render'](_0x3b75d8,{'contexts':_0x271a34||[]});fs['writeFileSync'](_0xe9d3('0x5b'),_0x154771);})[_0xe9d3('0x1a')](function(){return respondWithRpcPromise(_0xe9d3('0x5c'),_0xe9d3('0x32'),{'module':_0xe9d3('0x65')});})['then'](function(){return _0x592eae;})[_0xe9d3('0x1a')](respondWithResult(_0x582606,null))[_0xe9d3('0x25')](handleError(_0x582606,null));};exports[_0xe9d3('0x33')]=function(_0x578a5c,_0x59ac16,_0x3359af){var _0x540552;return db['VoiceContext'][_0xe9d3('0x51')]({'where':{'id':_0x578a5c[_0xe9d3('0x66')]['id']}})[_0xe9d3('0x1a')](handleEntityNotFound(_0x59ac16,null))['then'](removeEntity(_0x59ac16,null))['then'](function(){return db['VoiceContext'][_0xe9d3('0x4d')]({'raw':!![]});})['then'](function(_0x2a6a96){var _0xf48cce=fs[_0xe9d3('0x54')](path[_0xe9d3('0x55')](config[_0xe9d3('0x56')],_0xe9d3('0x57')),_0xe9d3('0x58'));var _0x49cb6b=ejs[_0xe9d3('0x59')](_0xf48cce,{'contexts':_0x2a6a96});fs[_0xe9d3('0x5a')](_0xe9d3('0x5b'),_0x49cb6b);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});})[_0xe9d3('0x25')](handleError(_0x59ac16,null));}; \ No newline at end of file +var _0xa082=['debug','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','find','create','join','root','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','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','readFileSync','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0x2e865d,_0x51a11a){var _0x11f353=function(_0x150389){while(--_0x150389){_0x2e865d['push'](_0x2e865d['shift']());}};_0x11f353(++_0x51a11a);}(_0xa082,0x1f3));var _0x2a08=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xa082[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a08('0x0'));var zipdir=require(_0x2a08('0x1'));var jsonpatch=require(_0x2a08('0x2'));var rp=require(_0x2a08('0x3'));var moment=require('moment');var BPromise=require(_0x2a08('0x4'));var Mustache=require(_0x2a08('0x5'));var util=require(_0x2a08('0x6'));var path=require(_0x2a08('0x7'));var sox=require(_0x2a08('0x8'));var csv=require(_0x2a08('0x9'));var ejs=require(_0x2a08('0xa'));var fs=require('fs');var fs_extra=require(_0x2a08('0xb'));var _=require('lodash');var squel=require(_0x2a08('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a08('0xd'));var deskjs=require(_0x2a08('0xe'));var toCsv=require(_0x2a08('0x9'));var querystring=require(_0x2a08('0xf'));var Papa=require(_0x2a08('0x10'));var Redis=require('ioredis');var authService=require(_0x2a08('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2a08('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a08('0x13'))(_0x2a08('0x14'));var utils=require(_0x2a08('0x15'));var config=require(_0x2a08('0x16'));var licenseUtil=require(_0x2a08('0x17'));var db=require(_0x2a08('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2a08('0x19')][_0x2a08('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x233fb3,_0x38f91c,_0x36e83c,_0x4612ba){return new BPromise(function(_0x38dbf5,_0x1d3a5f){var _0x35667a=_0x4612ba||client;return _0x35667a[_0x2a08('0x1b')](_0x233fb3,_0x36e83c)[_0x2a08('0x1c')](function(_0x375af1){logger['info'](_0x2a08('0x1d'),_0x38f91c,_0x2a08('0x1e'));logger[_0x2a08('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x38f91c,'request\x20sent',JSON[_0x2a08('0x20')](_0x375af1));if(_0x375af1[_0x2a08('0x21')]){if(_0x375af1[_0x2a08('0x21')][_0x2a08('0x22')]===0x1f4){logger['error'](_0x2a08('0x1d'),_0x38f91c,_0x375af1['error']['message']);return _0x1d3a5f(_0x375af1[_0x2a08('0x21')][_0x2a08('0x23')]);}logger['error'](_0x2a08('0x1d'),_0x38f91c,_0x375af1[_0x2a08('0x21')][_0x2a08('0x23')]);return _0x38dbf5(_0x375af1['error'][_0x2a08('0x23')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x38f91c,'request\x20sent');_0x38dbf5(_0x375af1[_0x2a08('0x24')][_0x2a08('0x23')]);}})[_0x2a08('0x25')](function(_0x207186){logger[_0x2a08('0x21')](_0x2a08('0x1d'),_0x38f91c,_0x207186);_0x1d3a5f(_0x207186);});});}function respondWithStatusCode(_0x2744fc,_0x2ba862){_0x2ba862=_0x2ba862||0xcc;return function(_0x3e4819){if(_0x3e4819){return _0x2744fc[_0x2a08('0x26')](_0x2ba862);}return _0x2744fc['status'](_0x2ba862)[_0x2a08('0x27')]();};}function respondWithResult(_0xa3e4a3,_0x21f66f){_0x21f66f=_0x21f66f||0xc8;return function(_0x4134d9){if(_0x4134d9){return _0xa3e4a3[_0x2a08('0x28')](_0x21f66f)['json'](_0x4134d9);}};}function respondWithFilteredResult(_0x58ae00,_0x24e705){return function(_0x1d79f5){if(_0x1d79f5){var _0x530348=typeof _0x24e705[_0x2a08('0x29')]===_0x2a08('0x2a')&&typeof _0x24e705[_0x2a08('0x2b')]===_0x2a08('0x2a');var _0x5a5139=_0x1d79f5[_0x2a08('0x2c')];var _0x49867c=_0x530348?0x0:_0x24e705[_0x2a08('0x29')];var _0x453e6a=_0x530348?_0x1d79f5[_0x2a08('0x2c')]:_0x24e705[_0x2a08('0x29')]+_0x24e705[_0x2a08('0x2b')];var _0x9c3444;if(_0x453e6a>=_0x5a5139){_0x453e6a=_0x5a5139;_0x9c3444=0xc8;}else{_0x9c3444=0xce;}_0x58ae00[_0x2a08('0x28')](_0x9c3444);return _0x58ae00['set'](_0x2a08('0x2d'),_0x49867c+'-'+_0x453e6a+'/'+_0x5a5139)['json'](_0x1d79f5);}return null;};}function patchUpdates(_0x1c1985){return function(_0x5a1594){try{jsonpatch[_0x2a08('0x2e')](_0x5a1594,_0x1c1985,!![]);}catch(_0x1d546a){return BPromise[_0x2a08('0x2f')](_0x1d546a);}return _0x5a1594[_0x2a08('0x30')]();};}function saveUpdates(_0x3d68da,_0x3d2324){return function(_0x1d9099){if(_0x1d9099){return _0x1d9099[_0x2a08('0x31')](_0x3d68da)['then'](function(_0x51e23c){return _0x51e23c;});}return null;};}function removeEntity(_0x47f688,_0x5a9530){return function(_0x277931){if(_0x277931){return _0x277931['destroy']()[_0x2a08('0x1c')](function(){var _0xfcbbe=_0x277931[_0x2a08('0x32')]({'plain':!![]});var _0x5a1837='Contexts';return db[_0x2a08('0x33')]['destroy']({'where':{'type':_0x5a1837,'resourceId':_0xfcbbe['id']}})[_0x2a08('0x1c')](function(){return _0x277931;});})[_0x2a08('0x1c')](function(){_0x47f688[_0x2a08('0x28')](0xcc)[_0x2a08('0x27')]();});}};}function handleEntityNotFound(_0x4fc3f3,_0x18f4b0){return function(_0x487555){if(!_0x487555){_0x4fc3f3['sendStatus'](0x194);}return _0x487555;};}function handleError(_0xeb5d7d,_0x2c4a52){_0x2c4a52=_0x2c4a52||0x1f4;return function(_0x5467a7){logger['error'](_0x5467a7[_0x2a08('0x34')]);if(_0x5467a7[_0x2a08('0x35')]){delete _0x5467a7[_0x2a08('0x35')];}_0xeb5d7d['status'](_0x2c4a52)[_0x2a08('0x36')](_0x5467a7);};}exports[_0x2a08('0x37')]=function(_0x5b12b0,_0x4a00f8){var _0x608a74={},_0x22e371={},_0x1b24f1={'count':0x0,'rows':[]};var _0x21fab7=_['map'](db[_0x2a08('0x38')][_0x2a08('0x39')],function(_0x2954c4){return{'name':_0x2954c4[_0x2a08('0x3a')],'type':_0x2954c4[_0x2a08('0x3b')]['key']};});_0x22e371[_0x2a08('0x3c')]=_[_0x2a08('0x3d')](_0x21fab7,_0x2a08('0x35'));_0x22e371[_0x2a08('0x3e')]=_[_0x2a08('0x3f')](_0x5b12b0[_0x2a08('0x3e')]);_0x22e371['filters']=_[_0x2a08('0x40')](_0x22e371[_0x2a08('0x3c')],_0x22e371[_0x2a08('0x3e')]);_0x608a74[_0x2a08('0x41')]=_[_0x2a08('0x40')](_0x22e371[_0x2a08('0x3c')],qs[_0x2a08('0x42')](_0x5b12b0[_0x2a08('0x3e')][_0x2a08('0x42')]));_0x608a74[_0x2a08('0x41')]=_0x608a74[_0x2a08('0x41')][_0x2a08('0x43')]?_0x608a74['attributes']:_0x22e371[_0x2a08('0x3c')];if(!_0x5b12b0[_0x2a08('0x3e')][_0x2a08('0x44')](_0x2a08('0x45'))){_0x608a74[_0x2a08('0x2b')]=qs[_0x2a08('0x2b')](_0x5b12b0['query']['limit']);_0x608a74[_0x2a08('0x29')]=qs['offset'](_0x5b12b0[_0x2a08('0x3e')][_0x2a08('0x29')]);}_0x608a74[_0x2a08('0x46')]=qs[_0x2a08('0x47')](_0x5b12b0[_0x2a08('0x3e')][_0x2a08('0x47')]);_0x608a74[_0x2a08('0x48')]=qs[_0x2a08('0x49')](_[_0x2a08('0x4a')](_0x5b12b0['query'],_0x22e371[_0x2a08('0x49')]),_0x21fab7);if(_0x5b12b0['query'][_0x2a08('0x4b')]){_0x608a74[_0x2a08('0x48')]=_[_0x2a08('0x4c')](_0x608a74[_0x2a08('0x48')],{'$or':_[_0x2a08('0x3d')](_0x21fab7,function(_0x7c9c5f){if(_0x7c9c5f[_0x2a08('0x3b')]!==_0x2a08('0x4d')){var _0x33540e={};_0x33540e[_0x7c9c5f[_0x2a08('0x35')]]={'$like':'%'+_0x5b12b0[_0x2a08('0x3e')][_0x2a08('0x4b')]+'%'};return _0x33540e;}})});}_0x608a74=_[_0x2a08('0x4c')]({},_0x608a74,_0x5b12b0[_0x2a08('0x4e')]);var _0x2c826a={'where':_0x608a74['where']};return db[_0x2a08('0x38')][_0x2a08('0x2c')](_0x2c826a)[_0x2a08('0x1c')](function(_0x3f821c){_0x1b24f1[_0x2a08('0x2c')]=_0x3f821c;if(_0x5b12b0[_0x2a08('0x3e')]['includeAll']){_0x608a74[_0x2a08('0x4f')]=[{'all':!![]}];}return db[_0x2a08('0x38')][_0x2a08('0x50')](_0x608a74);})['then'](function(_0x50b67f){_0x1b24f1[_0x2a08('0x51')]=_0x50b67f;return _0x1b24f1;})[_0x2a08('0x1c')](respondWithFilteredResult(_0x4a00f8,_0x608a74))[_0x2a08('0x25')](handleError(_0x4a00f8,null));};exports[_0x2a08('0x52')]=function(_0x3e2e81,_0x255e42){var _0x42986e={'raw':![],'where':{'id':_0x3e2e81['params']['id']}},_0x4baedf={};_0x4baedf['model']=_[_0x2a08('0x3f')](db[_0x2a08('0x38')][_0x2a08('0x39')]);_0x4baedf[_0x2a08('0x3e')]=_[_0x2a08('0x3f')](_0x3e2e81[_0x2a08('0x3e')]);_0x4baedf[_0x2a08('0x49')]=_[_0x2a08('0x40')](_0x4baedf[_0x2a08('0x3c')],_0x4baedf[_0x2a08('0x3e')]);_0x42986e['attributes']=_[_0x2a08('0x40')](_0x4baedf[_0x2a08('0x3c')],qs['fields'](_0x3e2e81[_0x2a08('0x3e')][_0x2a08('0x42')]));_0x42986e['attributes']=_0x42986e['attributes'][_0x2a08('0x43')]?_0x42986e['attributes']:_0x4baedf[_0x2a08('0x3c')];if(_0x3e2e81['query']['includeAll']){_0x42986e[_0x2a08('0x4f')]=[{'all':!![]}];}_0x42986e=_[_0x2a08('0x4c')]({},_0x42986e,_0x3e2e81[_0x2a08('0x4e')]);return db['VoiceContext'][_0x2a08('0x53')](_0x42986e)[_0x2a08('0x1c')](handleEntityNotFound(_0x255e42,null))[_0x2a08('0x1c')](respondWithResult(_0x255e42,null))[_0x2a08('0x25')](handleError(_0x255e42,null));};exports[_0x2a08('0x54')]=function(_0x3a5219,_0x134e9c,_0xa4bd18){var _0x27e058;return db[_0x2a08('0x38')]['create'](_0x3a5219['body'],{'raw':!![]})[_0x2a08('0x1c')](function(_0x510288){_0x27e058=_0x510288;return db[_0x2a08('0x38')][_0x2a08('0x50')]({'raw':!![]});})[_0x2a08('0x1c')](function(_0x1a5a2b){var _0x2cb410=fs['readFileSync'](path[_0x2a08('0x55')](config[_0x2a08('0x56')],_0x2a08('0x57')),_0x2a08('0x58'));var _0x2409bf=ejs[_0x2a08('0x59')](_0x2cb410,{'contexts':_0x1a5a2b||[]});fs[_0x2a08('0x5a')](_0x2a08('0x5b'),_0x2409bf);})[_0x2a08('0x1c')](function(){return respondWithRpcPromise(_0x2a08('0x5c'),_0x2a08('0x54'),{'module':_0x2a08('0x5d')});})[_0x2a08('0x1c')](function(){var _0x206ec1=_0x3a5219[_0x2a08('0x5e')][_0x2a08('0x32')]({'plain':!![]});if(!_0x206ec1)throw new Error(_0x2a08('0x5f'));if(_0x206ec1[_0x2a08('0x60')]==='user'){var _0x121f8c=_0x27e058[_0x2a08('0x32')]({'plain':!![]});return db[_0x2a08('0x61')]['find']({'where':{'name':_0x2a08('0x62'),'userProfileId':_0x206ec1[_0x2a08('0x63')]},'raw':!![]})[_0x2a08('0x1c')](function(_0x1476ad){if(_0x1476ad&&_0x1476ad[_0x2a08('0x64')]===0x0){return db[_0x2a08('0x33')][_0x2a08('0x54')]({'name':_0x121f8c[_0x2a08('0x35')],'resourceId':_0x121f8c['id'],'type':_0x1476ad[_0x2a08('0x35')],'sectionId':_0x1476ad['id']},{})[_0x2a08('0x1c')](function(){return _0x27e058;});}else{return _0x27e058;}})['catch'](function(_0x473194){logger[_0x2a08('0x21')](_0x2a08('0x65'),_0x473194);throw _0x473194;});}return _0x27e058;})['then'](respondWithResult(_0x134e9c,0xc9))[_0x2a08('0x25')](handleError(_0x134e9c,null));};exports['update']=function(_0x5eec3a,_0x239153,_0x4fc543){var _0x2b0111;return db[_0x2a08('0x38')][_0x2a08('0x53')]({'where':{'id':_0x5eec3a[_0x2a08('0x66')]['id']}})['then'](handleEntityNotFound(_0x239153,null))[_0x2a08('0x1c')](saveUpdates(_0x5eec3a[_0x2a08('0x67')],null))[_0x2a08('0x1c')](function(_0x5118ab){if(_0x5118ab){_0x2b0111=_0x5118ab;return db[_0x2a08('0x38')][_0x2a08('0x50')]({'raw':!![]});}})['then'](function(_0x18b82e){var _0x540f27=fs[_0x2a08('0x68')](path[_0x2a08('0x55')](config[_0x2a08('0x56')],'server/files/templates/context.ejs'),_0x2a08('0x58'));var _0x1f5449=ejs[_0x2a08('0x59')](_0x540f27,{'contexts':_0x18b82e||[]});fs[_0x2a08('0x5a')](_0x2a08('0x5b'),_0x1f5449);})[_0x2a08('0x1c')](function(){return respondWithRpcPromise('Reload',_0x2a08('0x31'),{'module':_0x2a08('0x5d')});})[_0x2a08('0x1c')](function(){return _0x2b0111;})[_0x2a08('0x1c')](respondWithResult(_0x239153,null))[_0x2a08('0x25')](handleError(_0x239153,null));};exports['destroy']=function(_0x1fe632,_0x28264b,_0x275ec4){var _0x21c12a;return db[_0x2a08('0x38')][_0x2a08('0x53')]({'where':{'id':_0x1fe632[_0x2a08('0x66')]['id']}})[_0x2a08('0x1c')](handleEntityNotFound(_0x28264b,null))['then'](removeEntity(_0x28264b,null))[_0x2a08('0x1c')](function(){return db['VoiceContext'][_0x2a08('0x50')]({'raw':!![]});})[_0x2a08('0x1c')](function(_0x2637f6){var _0x14bfdd=fs[_0x2a08('0x68')](path[_0x2a08('0x55')](config['root'],'server/files/templates/context.ejs'),_0x2a08('0x58'));var _0x3911f5=ejs['render'](_0x14bfdd,{'contexts':_0x2637f6});fs[_0x2a08('0x5a')](_0x2a08('0x5b'),_0x3911f5);return respondWithRpcPromise(_0x2a08('0x5c'),_0x2a08('0x69'),{'module':_0x2a08('0x5d')});})[_0x2a08('0x25')](handleError(_0x28264b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 27f481f..7fc3e2c 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 _0xef2b=['moment','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger','api'];(function(_0x2bfe0b,_0x2f8965){var _0x44e266=function(_0x118cc3){while(--_0x118cc3){_0x2bfe0b['push'](_0x2bfe0b['shift']());}};_0x44e266(++_0x2f8965);}(_0xef2b,0x164));var _0xbef2=function(_0x160254,_0x2726cd){_0x160254=_0x160254-0x0;var _0x35eb61=_0xef2b[_0x160254];return _0x35eb61;};'use strict';var _=require(_0xbef2('0x0'));var util=require(_0xbef2('0x1'));var logger=require(_0xbef2('0x2'))(_0xbef2('0x3'));var moment=require(_0xbef2('0x4'));var BPromise=require('bluebird');var rp=require(_0xbef2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbef2('0x6'));var config=require(_0xbef2('0x7'));var attributes=require(_0xbef2('0x8'));module[_0xbef2('0x9')]=function(_0x5e4f61,_0x3a90fa){return _0x5e4f61['define'](_0xbef2('0xa'),attributes,{'tableName':_0xbef2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c49=['define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x15d707,_0x57ea06){var _0x280702=function(_0xcfb961){while(--_0xcfb961){_0x15d707['push'](_0x15d707['shift']());}};_0x280702(++_0x57ea06);}(_0x2c49,0xc3));var _0x92c4=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0x2c49[_0x3877c1];return _0x59056a;};'use strict';var _=require(_0x92c4('0x0'));var util=require(_0x92c4('0x1'));var logger=require(_0x92c4('0x2'))(_0x92c4('0x3'));var moment=require(_0x92c4('0x4'));var BPromise=require('bluebird');var rp=require(_0x92c4('0x5'));var fs=require('fs');var path=require(_0x92c4('0x6'));var rimraf=require('rimraf');var config=require(_0x92c4('0x7'));var attributes=require('./voiceContext.attributes');module[_0x92c4('0x8')]=function(_0x2ec56a,_0x356a2e){return _0x2ec56a[_0x92c4('0x9')](_0x92c4('0xa'),attributes,{'tableName':_0x92c4('0xb'),'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 d806a4a..7f602ba 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 _0x119c=['rpc','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x193d9d,_0x5e0c76){var _0x28511f=function(_0x2e7075){while(--_0x2e7075){_0x193d9d['push'](_0x193d9d['shift']());}};_0x28511f(++_0x5e0c76);}(_0x119c,0xea));var _0xc119=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x119c[_0x5b64a1];return _0x4b6f55;};'use strict';var _=require('lodash');var util=require(_0xc119('0x0'));var moment=require('moment');var BPromise=require(_0xc119('0x1'));var rs=require(_0xc119('0x2'));var fs=require('fs');var Redis=require(_0xc119('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc119('0x4'));var logger=require(_0xc119('0x5'))(_0xc119('0x6'));var config=require('../../config/environment');var jayson=require(_0xc119('0x7'));var client=jayson['client'][_0xc119('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57bc8a,_0x16b3d2,_0x3dbd20){return new BPromise(function(_0x900301,_0x312f19){return client[_0xc119('0x9')](_0x57bc8a,_0x3dbd20)[_0xc119('0xa')](function(_0x367745){logger[_0xc119('0xb')](_0xc119('0xc'),_0x16b3d2,_0xc119('0xd'));logger[_0xc119('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x16b3d2,_0xc119('0xd'),JSON['stringify'](_0x367745));if(_0x367745[_0xc119('0xf')]){if(_0x367745[_0xc119('0xf')][_0xc119('0x10')]===0x1f4){logger[_0xc119('0xf')](_0xc119('0xc'),_0x16b3d2,_0x367745[_0xc119('0xf')]['message']);return _0x312f19(_0x367745['error'][_0xc119('0x11')]);}logger[_0xc119('0xf')](_0xc119('0xc'),_0x16b3d2,_0x367745[_0xc119('0xf')][_0xc119('0x11')]);return _0x900301(_0x367745['error'][_0xc119('0x11')]);}else{logger['info'](_0xc119('0xc'),_0x16b3d2,_0xc119('0xd'));_0x900301(_0x367745[_0xc119('0x12')][_0xc119('0x11')]);}})[_0xc119('0x13')](function(_0x3645e9){logger[_0xc119('0xf')](_0xc119('0xc'),_0x16b3d2,_0x3645e9);_0x312f19(_0x3645e9);});});} \ No newline at end of file +var _0x8721=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8721,0xd9));var _0x1872=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x8721[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x1872('0x0'));var util=require(_0x1872('0x1'));var moment=require(_0x1872('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1872('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1872('0x4'));var config=require(_0x1872('0x5'));var jayson=require(_0x1872('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2dc064,_0x3b80c8,_0x4230d7){return new BPromise(function(_0x4d019e,_0x2aaad6){return client[_0x1872('0x7')](_0x2dc064,_0x4230d7)[_0x1872('0x8')](function(_0x2c2b48){logger[_0x1872('0x9')](_0x1872('0xa'),_0x3b80c8,_0x1872('0xb'));logger[_0x1872('0xc')](_0x1872('0xd'),_0x3b80c8,_0x1872('0xb'),JSON[_0x1872('0xe')](_0x2c2b48));if(_0x2c2b48['error']){if(_0x2c2b48[_0x1872('0xf')][_0x1872('0x10')]===0x1f4){logger[_0x1872('0xf')](_0x1872('0xa'),_0x3b80c8,_0x2c2b48['error'][_0x1872('0x11')]);return _0x2aaad6(_0x2c2b48[_0x1872('0xf')][_0x1872('0x11')]);}logger[_0x1872('0xf')]('VoiceContext,\x20%s,\x20%s',_0x3b80c8,_0x2c2b48['error'][_0x1872('0x11')]);return _0x4d019e(_0x2c2b48[_0x1872('0xf')][_0x1872('0x11')]);}else{logger[_0x1872('0x9')](_0x1872('0xa'),_0x3b80c8,_0x1872('0xb'));_0x4d019e(_0x2c2b48['result']['message']);}})[_0x1872('0x12')](function(_0x3299df){logger[_0x1872('0xf')]('VoiceContext,\x20%s,\x20%s',_0x3b80c8,_0x3299df);_0x2aaad6(_0x3299df);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3f751e9..a904182 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 _0x865c=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x3dda43,_0x1c149c){var _0x54702f=function(_0x16c3ff){while(--_0x16c3ff){_0x3dda43['push'](_0x3dda43['shift']());}};_0x54702f(++_0x1c149c);}(_0x865c,0x91));var _0xc865=function(_0x2a0603,_0x55535c){_0x2a0603=_0x2a0603-0x0;var _0x10429c=_0x865c[_0x2a0603];return _0x10429c;};'use strict';var multer=require(_0xc865('0x0'));var util=require(_0xc865('0x1'));var path=require('path');var timeout=require(_0xc865('0x2'));var express=require('express');var router=express[_0xc865('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc865('0x4'));var interaction=require(_0xc865('0x5'));var config=require(_0xc865('0x6'));var controller=require(_0xc865('0x7'));router[_0xc865('0x8')]('/',auth['isAuthenticated'](),controller[_0xc865('0x9')]);router[_0xc865('0x8')](_0xc865('0xa'),auth[_0xc865('0xb')](),controller[_0xc865('0xc')]);router[_0xc865('0x8')](_0xc865('0xd'),auth[_0xc865('0xb')](),controller[_0xc865('0xe')]);router[_0xc865('0xf')]('/',auth[_0xc865('0xb')](),controller[_0xc865('0x10')]);router[_0xc865('0x11')](_0xc865('0xd'),auth['isAuthenticated'](),controller[_0xc865('0x12')]);router['delete'](_0xc865('0xd'),auth[_0xc865('0xb')](),controller[_0xc865('0x13')]);module[_0xc865('0x14')]=router; \ No newline at end of file +var _0x718d=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','destroy'];(function(_0x1a25cd,_0x5f4d6e){var _0x51aecb=function(_0x53152d){while(--_0x53152d){_0x1a25cd['push'](_0x1a25cd['shift']());}};_0x51aecb(++_0x5f4d6e);}(_0x718d,0x1c9));var _0xd718=function(_0x5986cb,_0x77a33d){_0x5986cb=_0x5986cb-0x0;var _0x53bad9=_0x718d[_0x5986cb];return _0x53bad9;};'use strict';var multer=require(_0xd718('0x0'));var util=require(_0xd718('0x1'));var path=require(_0xd718('0x2'));var timeout=require(_0xd718('0x3'));var express=require(_0xd718('0x4'));var router=express['Router']();var fs_extra=require(_0xd718('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd718('0x6'));var config=require(_0xd718('0x7'));var controller=require(_0xd718('0x8'));router[_0xd718('0x9')]('/',auth[_0xd718('0xa')](),controller['index']);router[_0xd718('0x9')](_0xd718('0xb'),auth['isAuthenticated'](),controller[_0xd718('0xc')]);router[_0xd718('0x9')](_0xd718('0xd'),auth[_0xd718('0xa')](),controller[_0xd718('0xe')]);router[_0xd718('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd718('0x10')](_0xd718('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd718('0xd'),auth[_0xd718('0xa')](),controller[_0xd718('0x11')]);module[_0xd718('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a3518fe..8b01b45 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 _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x2ef608,_0x53a7b1){var _0x56aa07=function(_0x318e2b){while(--_0x318e2b){_0x2ef608['push'](_0x2ef608['shift']());}};_0x56aa07(++_0x53a7b1);}(_0x8ef6,0xf2));var _0x68ef=function(_0x571c1d,_0x5e8756){_0x571c1d=_0x571c1d-0x0;var _0x5c6f48=_0x8ef6[_0x571c1d];return _0x5c6f48;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x4729b9,_0x13cdab){var _0x1a8119=function(_0x924095){while(--_0x924095){_0x4729b9['push'](_0x4729b9['shift']());}};_0x1a8119(++_0x13cdab);}(_0x55ca,0x126));var _0xa55c=function(_0x2bd440,_0xfb5a9d){_0x2bd440=_0x2bd440-0x0;var _0x58f325=_0x55ca[_0x2bd440];return _0x58f325;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9f8bdcd..b349f0b 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 _0xa671=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','then','catch','show','params','find','create','body','update','describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','stack','name','map','VoiceDialReport','rawAttributes','fieldName','key','model','keys','query'];(function(_0x3167b2,_0x5d2c07){var _0x38c75b=function(_0x3b0210){while(--_0x3b0210){_0x3167b2['push'](_0x3167b2['shift']());}};_0x38c75b(++_0x5d2c07);}(_0xa671,0xa7));var _0x1a67=function(_0x3d29db,_0x418bec){_0x3d29db=_0x3d29db-0x0;var _0x492f1=_0xa671[_0x3d29db];return _0x492f1;};'use strict';var emlformat=require(_0x1a67('0x0'));var rimraf=require(_0x1a67('0x1'));var zipdir=require(_0x1a67('0x2'));var jsonpatch=require(_0x1a67('0x3'));var rp=require(_0x1a67('0x4'));var moment=require(_0x1a67('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1a67('0x6'));var util=require(_0x1a67('0x7'));var path=require(_0x1a67('0x8'));var sox=require(_0x1a67('0x9'));var csv=require(_0x1a67('0xa'));var ejs=require(_0x1a67('0xb'));var fs=require('fs');var fs_extra=require(_0x1a67('0xc'));var _=require(_0x1a67('0xd'));var squel=require(_0x1a67('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1a67('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1a67('0x10'));var Papa=require('papaparse');var Redis=require(_0x1a67('0x11'));var authService=require(_0x1a67('0x12'));var qs=require(_0x1a67('0x13'));var as=require(_0x1a67('0x14'));var hardwareService=require(_0x1a67('0x15'));var logger=require(_0x1a67('0x16'))(_0x1a67('0x17'));var utils=require(_0x1a67('0x18'));var config=require(_0x1a67('0x19'));var licenseUtil=require(_0x1a67('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4baa98,_0x2f5bf8){_0x2f5bf8=_0x2f5bf8||0xcc;return function(_0x26648b){if(_0x26648b){return _0x4baa98[_0x1a67('0x1b')](_0x2f5bf8);}return _0x4baa98[_0x1a67('0x1c')](_0x2f5bf8)[_0x1a67('0x1d')]();};}function respondWithResult(_0x32c07f,_0x52e155){_0x52e155=_0x52e155||0xc8;return function(_0x1a09e3){if(_0x1a09e3){return _0x32c07f[_0x1a67('0x1c')](_0x52e155)[_0x1a67('0x1e')](_0x1a09e3);}};}function respondWithFilteredResult(_0x3c416a,_0x37145a){return function(_0x5f490a){if(_0x5f490a){var _0x9f7732=typeof _0x37145a[_0x1a67('0x1f')]==='undefined'&&typeof _0x37145a[_0x1a67('0x20')]===_0x1a67('0x21');var _0x4523b6=_0x5f490a[_0x1a67('0x22')];var _0x8b3259=_0x9f7732?0x0:_0x37145a['offset'];var _0x3982a4=_0x9f7732?_0x5f490a[_0x1a67('0x22')]:_0x37145a['offset']+_0x37145a[_0x1a67('0x20')];var _0x2b7dd0;if(_0x3982a4>=_0x4523b6){_0x3982a4=_0x4523b6;_0x2b7dd0=0xc8;}else{_0x2b7dd0=0xce;}_0x3c416a['status'](_0x2b7dd0);return _0x3c416a[_0x1a67('0x23')]('Content-Range',_0x8b3259+'-'+_0x3982a4+'/'+_0x4523b6)[_0x1a67('0x1e')](_0x5f490a);}return null;};}function patchUpdates(_0x5e8819){return function(_0x5a2a02){try{jsonpatch[_0x1a67('0x24')](_0x5a2a02,_0x5e8819,!![]);}catch(_0xc99605){return BPromise[_0x1a67('0x25')](_0xc99605);}return _0x5a2a02[_0x1a67('0x26')]();};}function saveUpdates(_0x599497,_0x3ab885){return function(_0x46a6bd){if(_0x46a6bd){return _0x46a6bd['update'](_0x599497)['then'](function(_0x580867){return _0x580867;});}return null;};}function removeEntity(_0x4ebee8,_0x21e764){return function(_0x5bf005){if(_0x5bf005){return _0x5bf005['destroy']()['then'](function(){_0x4ebee8[_0x1a67('0x1c')](0xcc)[_0x1a67('0x1d')]();});}};}function handleEntityNotFound(_0x4e3ce0,_0x2fa467){return function(_0x700cf1){if(!_0x700cf1){_0x4e3ce0['sendStatus'](0x194);}return _0x700cf1;};}function handleError(_0x483c53,_0x348cdb){_0x348cdb=_0x348cdb||0x1f4;return function(_0x48c78d){logger['error'](_0x48c78d[_0x1a67('0x27')]);if(_0x48c78d[_0x1a67('0x28')]){delete _0x48c78d['name'];}_0x483c53['status'](_0x348cdb)['send'](_0x48c78d);};}exports['index']=function(_0x44c104,_0x25b171){var _0x34ff9b={},_0x4860df={},_0x204add={'count':0x0,'rows':[]};var _0x411025=_[_0x1a67('0x29')](db[_0x1a67('0x2a')][_0x1a67('0x2b')],function(_0x425e1d){return{'name':_0x425e1d[_0x1a67('0x2c')],'type':_0x425e1d['type'][_0x1a67('0x2d')]};});_0x4860df[_0x1a67('0x2e')]=_[_0x1a67('0x29')](_0x411025,_0x1a67('0x28'));_0x4860df['query']=_[_0x1a67('0x2f')](_0x44c104[_0x1a67('0x30')]);_0x4860df[_0x1a67('0x31')]=_[_0x1a67('0x32')](_0x4860df['model'],_0x4860df[_0x1a67('0x30')]);_0x34ff9b[_0x1a67('0x33')]=_[_0x1a67('0x32')](_0x4860df[_0x1a67('0x2e')],qs[_0x1a67('0x34')](_0x44c104[_0x1a67('0x30')][_0x1a67('0x34')]));_0x34ff9b[_0x1a67('0x33')]=_0x34ff9b[_0x1a67('0x33')][_0x1a67('0x35')]?_0x34ff9b[_0x1a67('0x33')]:_0x4860df[_0x1a67('0x2e')];if(!_0x44c104['query'][_0x1a67('0x36')]('nolimit')){_0x34ff9b['limit']=qs[_0x1a67('0x20')](_0x44c104[_0x1a67('0x30')][_0x1a67('0x20')]);_0x34ff9b[_0x1a67('0x1f')]=qs[_0x1a67('0x1f')](_0x44c104[_0x1a67('0x30')][_0x1a67('0x1f')]);}_0x34ff9b[_0x1a67('0x37')]=qs[_0x1a67('0x38')](_0x44c104['query'][_0x1a67('0x38')]);_0x34ff9b[_0x1a67('0x39')]=qs[_0x1a67('0x31')](_['pick'](_0x44c104[_0x1a67('0x30')],_0x4860df[_0x1a67('0x31')]),_0x411025);if(_0x44c104[_0x1a67('0x30')][_0x1a67('0x3a')]){_0x34ff9b[_0x1a67('0x39')]=_[_0x1a67('0x3b')](_0x34ff9b['where'],{'$or':_[_0x1a67('0x29')](_0x411025,function(_0x281869){if(_0x281869['type']!==_0x1a67('0x3c')){var _0x13cb7e={};_0x13cb7e[_0x281869[_0x1a67('0x28')]]={'$like':'%'+_0x44c104['query'][_0x1a67('0x3a')]+'%'};return _0x13cb7e;}})});}_0x34ff9b=_[_0x1a67('0x3b')]({},_0x34ff9b,_0x44c104['options']);var _0x5dcaab={'where':_0x34ff9b[_0x1a67('0x39')]};return db[_0x1a67('0x2a')][_0x1a67('0x22')](_0x5dcaab)['then'](function(_0xf7899e){_0x204add[_0x1a67('0x22')]=_0xf7899e;if(_0x44c104[_0x1a67('0x30')][_0x1a67('0x3d')]){_0x34ff9b[_0x1a67('0x3e')]=[{'all':!![]}];}return db[_0x1a67('0x2a')]['findAll'](_0x34ff9b);})['then'](function(_0x119786){_0x204add['rows']=_0x119786;return _0x204add;})[_0x1a67('0x3f')](respondWithFilteredResult(_0x25b171,_0x34ff9b))[_0x1a67('0x40')](handleError(_0x25b171,null));};exports[_0x1a67('0x41')]=function(_0x56f9f8,_0x24de64){var _0x3553c3={'raw':!![],'where':{'id':_0x56f9f8[_0x1a67('0x42')]['id']}},_0x338ea0={};_0x338ea0[_0x1a67('0x2e')]=_[_0x1a67('0x2f')](db[_0x1a67('0x2a')]['rawAttributes']);_0x338ea0[_0x1a67('0x30')]=_[_0x1a67('0x2f')](_0x56f9f8[_0x1a67('0x30')]);_0x338ea0[_0x1a67('0x31')]=_[_0x1a67('0x32')](_0x338ea0[_0x1a67('0x2e')],_0x338ea0['query']);_0x3553c3[_0x1a67('0x33')]=_[_0x1a67('0x32')](_0x338ea0[_0x1a67('0x2e')],qs['fields'](_0x56f9f8[_0x1a67('0x30')][_0x1a67('0x34')]));_0x3553c3[_0x1a67('0x33')]=_0x3553c3[_0x1a67('0x33')]['length']?_0x3553c3[_0x1a67('0x33')]:_0x338ea0[_0x1a67('0x2e')];if(_0x56f9f8[_0x1a67('0x30')][_0x1a67('0x3d')]){_0x3553c3[_0x1a67('0x3e')]=[{'all':!![]}];}_0x3553c3=_[_0x1a67('0x3b')]({},_0x3553c3,_0x56f9f8['options']);return db['VoiceDialReport'][_0x1a67('0x43')](_0x3553c3)['then'](handleEntityNotFound(_0x24de64,null))[_0x1a67('0x3f')](respondWithResult(_0x24de64,null))[_0x1a67('0x40')](handleError(_0x24de64,null));};exports['create']=function(_0x304041,_0x656434){return db[_0x1a67('0x2a')][_0x1a67('0x44')](_0x304041[_0x1a67('0x45')],{})['then'](respondWithResult(_0x656434,0xc9))['catch'](handleError(_0x656434,null));};exports[_0x1a67('0x46')]=function(_0x50082d,_0x323c71){if(_0x50082d['body']['id']){delete _0x50082d[_0x1a67('0x45')]['id'];}return db[_0x1a67('0x2a')][_0x1a67('0x43')]({'where':{'id':_0x50082d[_0x1a67('0x42')]['id']}})[_0x1a67('0x3f')](handleEntityNotFound(_0x323c71,null))['then'](saveUpdates(_0x50082d[_0x1a67('0x45')],null))[_0x1a67('0x3f')](respondWithResult(_0x323c71,null))[_0x1a67('0x40')](handleError(_0x323c71,null));};exports['destroy']=function(_0x2e00e5,_0x135a75){return db[_0x1a67('0x2a')]['find']({'where':{'id':_0x2e00e5[_0x1a67('0x42')]['id']}})[_0x1a67('0x3f')](handleEntityNotFound(_0x135a75,null))[_0x1a67('0x3f')](removeEntity(_0x135a75,null))['catch'](handleError(_0x135a75,null));};exports[_0x1a67('0x47')]=function(_0x59c7b5,_0x118984){return db[_0x1a67('0x2a')][_0x1a67('0x47')]()[_0x1a67('0x3f')](respondWithResult(_0x118984,null))[_0x1a67('0x40')](handleError(_0x118984,null));}; \ No newline at end of file +var _0x8ec9=['lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','ejs'];(function(_0x58da7e,_0x475d3e){var _0x535603=function(_0x2d28cc){while(--_0x2d28cc){_0x58da7e['push'](_0x58da7e['shift']());}};_0x535603(++_0x475d3e);}(_0x8ec9,0x114));var _0x98ec=function(_0x345e73,_0x1dd123){_0x345e73=_0x345e73-0x0;var _0x3721cd=_0x8ec9[_0x345e73];return _0x3721cd;};'use strict';var emlformat=require(_0x98ec('0x0'));var rimraf=require(_0x98ec('0x1'));var zipdir=require(_0x98ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98ec('0x3'));var moment=require(_0x98ec('0x4'));var BPromise=require(_0x98ec('0x5'));var Mustache=require(_0x98ec('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98ec('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98ec('0x8'));var squel=require(_0x98ec('0x9'));var crypto=require(_0x98ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x98ec('0xb'));var toCsv=require(_0x98ec('0xc'));var querystring=require(_0x98ec('0xd'));var Papa=require(_0x98ec('0xe'));var Redis=require(_0x98ec('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x98ec('0x10'));var as=require(_0x98ec('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x98ec('0x12'));var utils=require(_0x98ec('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x577f92,_0x2626f6){_0x2626f6=_0x2626f6||0xcc;return function(_0x109930){if(_0x109930){return _0x577f92[_0x98ec('0x14')](_0x2626f6);}return _0x577f92[_0x98ec('0x15')](_0x2626f6)[_0x98ec('0x16')]();};}function respondWithResult(_0x28ac74,_0x421186){_0x421186=_0x421186||0xc8;return function(_0x4c911a){if(_0x4c911a){return _0x28ac74['status'](_0x421186)[_0x98ec('0x17')](_0x4c911a);}};}function respondWithFilteredResult(_0x3f0b92,_0x67d062){return function(_0x4dfa38){if(_0x4dfa38){var _0x59362a=typeof _0x67d062[_0x98ec('0x18')]===_0x98ec('0x19')&&typeof _0x67d062[_0x98ec('0x1a')]===_0x98ec('0x19');var _0x220abf=_0x4dfa38[_0x98ec('0x1b')];var _0x31ff37=_0x59362a?0x0:_0x67d062[_0x98ec('0x18')];var _0x24a03b=_0x59362a?_0x4dfa38[_0x98ec('0x1b')]:_0x67d062[_0x98ec('0x18')]+_0x67d062['limit'];var _0x5895d8;if(_0x24a03b>=_0x220abf){_0x24a03b=_0x220abf;_0x5895d8=0xc8;}else{_0x5895d8=0xce;}_0x3f0b92['status'](_0x5895d8);return _0x3f0b92['set']('Content-Range',_0x31ff37+'-'+_0x24a03b+'/'+_0x220abf)[_0x98ec('0x17')](_0x4dfa38);}return null;};}function patchUpdates(_0x3aa5a3){return function(_0x18ebb1){try{jsonpatch[_0x98ec('0x1c')](_0x18ebb1,_0x3aa5a3,!![]);}catch(_0x177a9a){return BPromise[_0x98ec('0x1d')](_0x177a9a);}return _0x18ebb1[_0x98ec('0x1e')]();};}function saveUpdates(_0x25b65d,_0xb6c723){return function(_0x45cf0e){if(_0x45cf0e){return _0x45cf0e['update'](_0x25b65d)[_0x98ec('0x1f')](function(_0xc81e90){return _0xc81e90;});}return null;};}function removeEntity(_0x3e327a,_0x5dbcdb){return function(_0x48d739){if(_0x48d739){return _0x48d739[_0x98ec('0x20')]()[_0x98ec('0x1f')](function(){_0x3e327a[_0x98ec('0x15')](0xcc)[_0x98ec('0x16')]();});}};}function handleEntityNotFound(_0x503a7d,_0x3ba279){return function(_0x248774){if(!_0x248774){_0x503a7d[_0x98ec('0x14')](0x194);}return _0x248774;};}function handleError(_0x674cfc,_0x7e8b02){_0x7e8b02=_0x7e8b02||0x1f4;return function(_0x4ade9d){logger[_0x98ec('0x21')](_0x4ade9d[_0x98ec('0x22')]);if(_0x4ade9d[_0x98ec('0x23')]){delete _0x4ade9d[_0x98ec('0x23')];}_0x674cfc[_0x98ec('0x15')](_0x7e8b02)[_0x98ec('0x24')](_0x4ade9d);};}exports[_0x98ec('0x25')]=function(_0x1d5363,_0x4b2476){var _0x5a15e8={},_0x49a461={},_0x5872f7={'count':0x0,'rows':[]};var _0x15c80c=_['map'](db[_0x98ec('0x26')][_0x98ec('0x27')],function(_0x5ebfac){return{'name':_0x5ebfac[_0x98ec('0x28')],'type':_0x5ebfac[_0x98ec('0x29')][_0x98ec('0x2a')]};});_0x49a461[_0x98ec('0x2b')]=_[_0x98ec('0x2c')](_0x15c80c,_0x98ec('0x23'));_0x49a461[_0x98ec('0x2d')]=_[_0x98ec('0x2e')](_0x1d5363[_0x98ec('0x2d')]);_0x49a461[_0x98ec('0x2f')]=_[_0x98ec('0x30')](_0x49a461[_0x98ec('0x2b')],_0x49a461[_0x98ec('0x2d')]);_0x5a15e8[_0x98ec('0x31')]=_[_0x98ec('0x30')](_0x49a461[_0x98ec('0x2b')],qs['fields'](_0x1d5363[_0x98ec('0x2d')][_0x98ec('0x32')]));_0x5a15e8['attributes']=_0x5a15e8['attributes'][_0x98ec('0x33')]?_0x5a15e8[_0x98ec('0x31')]:_0x49a461[_0x98ec('0x2b')];if(!_0x1d5363[_0x98ec('0x2d')][_0x98ec('0x34')](_0x98ec('0x35'))){_0x5a15e8[_0x98ec('0x1a')]=qs['limit'](_0x1d5363[_0x98ec('0x2d')][_0x98ec('0x1a')]);_0x5a15e8[_0x98ec('0x18')]=qs[_0x98ec('0x18')](_0x1d5363[_0x98ec('0x2d')]['offset']);}_0x5a15e8[_0x98ec('0x36')]=qs[_0x98ec('0x37')](_0x1d5363[_0x98ec('0x2d')][_0x98ec('0x37')]);_0x5a15e8[_0x98ec('0x38')]=qs[_0x98ec('0x2f')](_[_0x98ec('0x39')](_0x1d5363[_0x98ec('0x2d')],_0x49a461[_0x98ec('0x2f')]),_0x15c80c);if(_0x1d5363[_0x98ec('0x2d')][_0x98ec('0x3a')]){_0x5a15e8['where']=_[_0x98ec('0x3b')](_0x5a15e8[_0x98ec('0x38')],{'$or':_[_0x98ec('0x2c')](_0x15c80c,function(_0x1e9fea){if(_0x1e9fea['type']!=='VIRTUAL'){var _0x46382e={};_0x46382e[_0x1e9fea[_0x98ec('0x23')]]={'$like':'%'+_0x1d5363[_0x98ec('0x2d')][_0x98ec('0x3a')]+'%'};return _0x46382e;}})});}_0x5a15e8=_[_0x98ec('0x3b')]({},_0x5a15e8,_0x1d5363['options']);var _0x5c6dde={'where':_0x5a15e8['where']};return db[_0x98ec('0x26')][_0x98ec('0x1b')](_0x5c6dde)[_0x98ec('0x1f')](function(_0x37cd1c){_0x5872f7['count']=_0x37cd1c;if(_0x1d5363['query'][_0x98ec('0x3c')]){_0x5a15e8['include']=[{'all':!![]}];}return db[_0x98ec('0x26')][_0x98ec('0x3d')](_0x5a15e8);})['then'](function(_0x408f8b){_0x5872f7[_0x98ec('0x3e')]=_0x408f8b;return _0x5872f7;})[_0x98ec('0x1f')](respondWithFilteredResult(_0x4b2476,_0x5a15e8))[_0x98ec('0x3f')](handleError(_0x4b2476,null));};exports['show']=function(_0x1c686a,_0x373590){var _0x18c4ed={'raw':!![],'where':{'id':_0x1c686a['params']['id']}},_0x3890dd={};_0x3890dd[_0x98ec('0x2b')]=_[_0x98ec('0x2e')](db[_0x98ec('0x26')][_0x98ec('0x27')]);_0x3890dd['query']=_[_0x98ec('0x2e')](_0x1c686a[_0x98ec('0x2d')]);_0x3890dd['filters']=_[_0x98ec('0x30')](_0x3890dd['model'],_0x3890dd[_0x98ec('0x2d')]);_0x18c4ed[_0x98ec('0x31')]=_[_0x98ec('0x30')](_0x3890dd[_0x98ec('0x2b')],qs[_0x98ec('0x32')](_0x1c686a['query'][_0x98ec('0x32')]));_0x18c4ed[_0x98ec('0x31')]=_0x18c4ed['attributes']['length']?_0x18c4ed[_0x98ec('0x31')]:_0x3890dd[_0x98ec('0x2b')];if(_0x1c686a['query'][_0x98ec('0x3c')]){_0x18c4ed['include']=[{'all':!![]}];}_0x18c4ed=_[_0x98ec('0x3b')]({},_0x18c4ed,_0x1c686a[_0x98ec('0x40')]);return db[_0x98ec('0x26')][_0x98ec('0x41')](_0x18c4ed)['then'](handleEntityNotFound(_0x373590,null))['then'](respondWithResult(_0x373590,null))[_0x98ec('0x3f')](handleError(_0x373590,null));};exports['create']=function(_0x43df19,_0x101a95){return db['VoiceDialReport'][_0x98ec('0x42')](_0x43df19[_0x98ec('0x43')],{})[_0x98ec('0x1f')](respondWithResult(_0x101a95,0xc9))[_0x98ec('0x3f')](handleError(_0x101a95,null));};exports[_0x98ec('0x44')]=function(_0x3b63d4,_0x41f2df){if(_0x3b63d4[_0x98ec('0x43')]['id']){delete _0x3b63d4[_0x98ec('0x43')]['id'];}return db[_0x98ec('0x26')][_0x98ec('0x41')]({'where':{'id':_0x3b63d4[_0x98ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x41f2df,null))[_0x98ec('0x1f')](saveUpdates(_0x3b63d4['body'],null))[_0x98ec('0x1f')](respondWithResult(_0x41f2df,null))['catch'](handleError(_0x41f2df,null));};exports['destroy']=function(_0x242951,_0x6d8b36){return db['VoiceDialReport'][_0x98ec('0x41')]({'where':{'id':_0x242951[_0x98ec('0x45')]['id']}})[_0x98ec('0x1f')](handleEntityNotFound(_0x6d8b36,null))[_0x98ec('0x1f')](removeEntity(_0x6d8b36,null))[_0x98ec('0x3f')](handleError(_0x6d8b36,null));};exports[_0x98ec('0x46')]=function(_0x34b066,_0x2ee71d){return db[_0x98ec('0x26')][_0x98ec('0x46')]()[_0x98ec('0x1f')](respondWithResult(_0x2ee71d,null))[_0x98ec('0x3f')](handleError(_0x2ee71d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5ed61b0..2b28ba0 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 _0x1d6d=['uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x5c070b,_0x3598ad){var _0x591e0e=function(_0x53ab05){while(--_0x53ab05){_0x5c070b['push'](_0x5c070b['shift']());}};_0x591e0e(++_0x3598ad);}(_0x1d6d,0xf8));var _0xd1d6=function(_0x392dfa,_0x5ea5f0){_0x392dfa=_0x392dfa-0x0;var _0x30b84e=_0x1d6d[_0x392dfa];return _0x30b84e;};'use strict';var _=require(_0xd1d6('0x0'));var util=require(_0xd1d6('0x1'));var logger=require('../../config/logger')(_0xd1d6('0x2'));var moment=require(_0xd1d6('0x3'));var BPromise=require('bluebird');var rp=require(_0xd1d6('0x4'));var fs=require('fs');var path=require(_0xd1d6('0x5'));var rimraf=require(_0xd1d6('0x6'));var config=require(_0xd1d6('0x7'));var attributes=require(_0xd1d6('0x8'));module[_0xd1d6('0x9')]=function(_0xc744c8,_0x2ee182){return _0xc744c8[_0xd1d6('0xa')](_0xd1d6('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xd1d6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3a0=['../../config/environment','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x205d8f,_0x336839){var _0x11747b=function(_0x36068c){while(--_0x36068c){_0x205d8f['push'](_0x205d8f['shift']());}};_0x11747b(++_0x336839);}(_0xd3a0,0x1c5));var _0x0d3a=function(_0x37c925,_0x2ee082){_0x37c925=_0x37c925-0x0;var _0xa19ebc=_0xd3a0[_0x37c925];return _0xa19ebc;};'use strict';var _=require(_0x0d3a('0x0'));var util=require(_0x0d3a('0x1'));var logger=require(_0x0d3a('0x2'))(_0x0d3a('0x3'));var moment=require(_0x0d3a('0x4'));var BPromise=require(_0x0d3a('0x5'));var rp=require(_0x0d3a('0x6'));var fs=require('fs');var path=require(_0x0d3a('0x7'));var rimraf=require(_0x0d3a('0x8'));var config=require(_0x0d3a('0x9'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x1a80ff,_0x8fd46a){return _0x1a80ff[_0x0d3a('0xa')](_0x0d3a('0xb'),attributes,{'tableName':_0x0d3a('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0d3a('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 d8b42aa..9a35ad2 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 _0xd0bf=['update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','options','raw','debug','UpdateVoiceDialReport','VoiceDialReport'];(function(_0x12f61e,_0x1330ed){var _0x3c742a=function(_0x40679d){while(--_0x40679d){_0x12f61e['push'](_0x12f61e['shift']());}};_0x3c742a(++_0x1330ed);}(_0xd0bf,0x158));var _0xfd0b=function(_0x41972e,_0x49cdf3){_0x41972e=_0x41972e-0x0;var _0x23f0bf=_0xd0bf[_0x41972e];return _0x23f0bf;};'use strict';var _=require(_0xfd0b('0x0'));var util=require('util');var moment=require(_0xfd0b('0x1'));var BPromise=require(_0xfd0b('0x2'));var rs=require(_0xfd0b('0x3'));var fs=require('fs');var Redis=require(_0xfd0b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd0b('0x5'));var logger=require('../../config/logger')(_0xfd0b('0x6'));var config=require(_0xfd0b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd0b('0x8')][_0xfd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb414b8,_0x3ab771,_0x55fa53){return new BPromise(function(_0x2d2ea8,_0xb63ae){return client[_0xfd0b('0xa')](_0xb414b8,_0x55fa53)[_0xfd0b('0xb')](function(_0x298a8b){logger[_0xfd0b('0xc')](_0xfd0b('0xd'),_0x3ab771,'request\x20sent');logger['debug'](_0xfd0b('0xe'),_0x3ab771,_0xfd0b('0xf'),JSON[_0xfd0b('0x10')](_0x298a8b));if(_0x298a8b[_0xfd0b('0x11')]){if(_0x298a8b['error'][_0xfd0b('0x12')]===0x1f4){logger[_0xfd0b('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3ab771,_0x298a8b['error'][_0xfd0b('0x13')]);return _0xb63ae(_0x298a8b['error']['message']);}logger['error'](_0xfd0b('0xd'),_0x3ab771,_0x298a8b[_0xfd0b('0x11')][_0xfd0b('0x13')]);return _0x2d2ea8(_0x298a8b['error']['message']);}else{logger[_0xfd0b('0xc')](_0xfd0b('0xd'),_0x3ab771,_0xfd0b('0xf'));_0x2d2ea8(_0x298a8b[_0xfd0b('0x14')][_0xfd0b('0x13')]);}})[_0xfd0b('0x15')](function(_0x52b5bf){logger[_0xfd0b('0x11')](_0xfd0b('0xd'),_0x3ab771,_0x52b5bf);_0xb63ae(_0x52b5bf);});});}exports[_0xfd0b('0x16')]=function(_0x220ecd){var _0x1c2cc1=this;return new Promise(function(_0x429751,_0x50cd52){return db['VoiceDialReport']['create'](_0x220ecd['body'],{'raw':_0x220ecd['options']?_0x220ecd[_0xfd0b('0x17')][_0xfd0b('0x18')]===undefined?!![]:![]:!![]})[_0xfd0b('0xb')](function(_0x5f1dcf){logger[_0xfd0b('0xc')]('CreateVoiceDialReport',_0x220ecd);logger[_0xfd0b('0x19')](_0xfd0b('0x16'),_0x220ecd,JSON[_0xfd0b('0x10')](_0x5f1dcf));_0x429751(_0x5f1dcf);})['catch'](function(_0x1ea4a0){logger['error'](_0xfd0b('0x16'),_0x1ea4a0['message'],_0x220ecd);_0x50cd52(_0x1c2cc1[_0xfd0b('0x11')](0x1f4,_0x1ea4a0[_0xfd0b('0x13')]));});});};exports[_0xfd0b('0x1a')]=function(_0x5e4958){var _0x5a3f70=this;return new Promise(function(_0x21c4bf,_0xb952ec){return db[_0xfd0b('0x1b')][_0xfd0b('0x1c')](_0x5e4958['body'],{'raw':_0x5e4958['options']?_0x5e4958[_0xfd0b('0x17')][_0xfd0b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e4958[_0xfd0b('0x17')]?_0x5e4958[_0xfd0b('0x17')][_0xfd0b('0x1d')]||null:null,'attributes':_0x5e4958['options']?_0x5e4958[_0xfd0b('0x17')]['attributes']||null:null,'limit':_0x5e4958['options']?_0x5e4958[_0xfd0b('0x17')][_0xfd0b('0x1e')]||null:null})[_0xfd0b('0xb')](function(_0x2d0b4c){logger[_0xfd0b('0xc')]('UpdateVoiceDialReport',_0x5e4958);logger['debug'](_0xfd0b('0x1a'),_0x5e4958,JSON[_0xfd0b('0x10')](_0x2d0b4c));_0x21c4bf(_0x2d0b4c);})[_0xfd0b('0x15')](function(_0x1c5d64){logger[_0xfd0b('0x11')]('UpdateVoiceDialReport',_0x1c5d64[_0xfd0b('0x13')],_0x5e4958);_0xb952ec(_0x5a3f70[_0xfd0b('0x11')](0x1f4,_0x1c5d64[_0xfd0b('0x13')]));});});}; \ No newline at end of file +var _0x3024=['VoiceDialReport','create','body','options','raw','where','attributes','UpdateVoiceDialReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','code','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport'];(function(_0x59e7c0,_0xd813e3){var _0x368030=function(_0x47b96a){while(--_0x47b96a){_0x59e7c0['push'](_0x59e7c0['shift']());}};_0x368030(++_0xd813e3);}(_0x3024,0xef));var _0x4302=function(_0x46945f,_0xe8c85d){_0x46945f=_0x46945f-0x0;var _0x465a48=_0x3024[_0x46945f];return _0x465a48;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var moment=require(_0x4302('0x2'));var BPromise=require(_0x4302('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4302('0x4'));var db=require(_0x4302('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4302('0x6'))(_0x4302('0x7'));var config=require(_0x4302('0x8'));var jayson=require(_0x4302('0x9'));var client=jayson[_0x4302('0xa')][_0x4302('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11782a,_0x1ef55d,_0xac6eff){return new BPromise(function(_0x4a8365,_0x8b9b09){return client[_0x4302('0xc')](_0x11782a,_0xac6eff)[_0x4302('0xd')](function(_0x4b5a64){logger[_0x4302('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x1ef55d,_0x4302('0xf'));logger[_0x4302('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1ef55d,'request\x20sent',JSON[_0x4302('0x11')](_0x4b5a64));if(_0x4b5a64['error']){if(_0x4b5a64['error'][_0x4302('0x12')]===0x1f4){logger[_0x4302('0x13')](_0x4302('0x14'),_0x1ef55d,_0x4b5a64[_0x4302('0x13')]['message']);return _0x8b9b09(_0x4b5a64[_0x4302('0x13')][_0x4302('0x15')]);}logger[_0x4302('0x13')](_0x4302('0x14'),_0x1ef55d,_0x4b5a64[_0x4302('0x13')][_0x4302('0x15')]);return _0x4a8365(_0x4b5a64[_0x4302('0x13')][_0x4302('0x15')]);}else{logger[_0x4302('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x1ef55d,_0x4302('0xf'));_0x4a8365(_0x4b5a64[_0x4302('0x16')][_0x4302('0x15')]);}})[_0x4302('0x17')](function(_0x25785a){logger[_0x4302('0x13')](_0x4302('0x14'),_0x1ef55d,_0x25785a);_0x8b9b09(_0x25785a);});});}exports[_0x4302('0x18')]=function(_0x48add6){var _0x10b94e=this;return new Promise(function(_0x36c336,_0x3b6078){return db[_0x4302('0x19')][_0x4302('0x1a')](_0x48add6[_0x4302('0x1b')],{'raw':_0x48add6['options']?_0x48add6['options']['raw']===undefined?!![]:![]:!![]})[_0x4302('0xd')](function(_0x4555b2){logger[_0x4302('0xe')](_0x4302('0x18'),_0x48add6);logger['debug'](_0x4302('0x18'),_0x48add6,JSON[_0x4302('0x11')](_0x4555b2));_0x36c336(_0x4555b2);})[_0x4302('0x17')](function(_0xe5180d){logger['error'](_0x4302('0x18'),_0xe5180d['message'],_0x48add6);_0x3b6078(_0x10b94e[_0x4302('0x13')](0x1f4,_0xe5180d['message']));});});};exports['UpdateVoiceDialReport']=function(_0x423677){var _0x5dc8a8=this;return new Promise(function(_0x4be36b,_0x75b137){return db[_0x4302('0x19')]['update'](_0x423677[_0x4302('0x1b')],{'raw':_0x423677[_0x4302('0x1c')]?_0x423677[_0x4302('0x1c')][_0x4302('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x423677[_0x4302('0x1c')]?_0x423677['options'][_0x4302('0x1e')]||null:null,'attributes':_0x423677['options']?_0x423677[_0x4302('0x1c')][_0x4302('0x1f')]||null:null,'limit':_0x423677['options']?_0x423677[_0x4302('0x1c')]['limit']||null:null})[_0x4302('0xd')](function(_0x46168e){logger['info'](_0x4302('0x20'),_0x423677);logger[_0x4302('0x10')](_0x4302('0x20'),_0x423677,JSON[_0x4302('0x11')](_0x46168e));_0x4be36b(_0x46168e);})['catch'](function(_0x3088f9){logger[_0x4302('0x13')](_0x4302('0x20'),_0x3088f9[_0x4302('0x15')],_0x423677);_0x75b137(_0x5dc8a8['error'](0x1f4,_0x3088f9[_0x4302('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 376f0d9..09587a8 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 _0x051f=['isAuthenticated','show','post','create','addApplications','put','update','/:id','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index'];(function(_0x4737b1,_0x134e8f){var _0xeb81cb=function(_0x3c2b23){while(--_0x3c2b23){_0x4737b1['push'](_0x4737b1['shift']());}};_0xeb81cb(++_0x134e8f);}(_0x051f,0x1be));var _0xf051=function(_0x2a4a40,_0xccdc79){_0x2a4a40=_0x2a4a40-0x0;var _0x524c63=_0x051f[_0x2a4a40];return _0x524c63;};'use strict';var multer=require(_0xf051('0x0'));var util=require('util');var path=require(_0xf051('0x1'));var timeout=require(_0xf051('0x2'));var express=require(_0xf051('0x3'));var router=express[_0xf051('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf051('0x5'));var config=require(_0xf051('0x6'));var controller=require(_0xf051('0x7'));router[_0xf051('0x8')]('/',auth['isAuthenticated'](),controller[_0xf051('0x9')]);router[_0xf051('0x8')]('/:id',auth[_0xf051('0xa')](),controller[_0xf051('0xb')]);router[_0xf051('0xc')]('/',auth[_0xf051('0xa')](),controller[_0xf051('0xd')]);router[_0xf051('0xc')]('/:id/applications',auth[_0xf051('0xa')](),controller[_0xf051('0xe')]);router[_0xf051('0xf')]('/:id',auth[_0xf051('0xa')](),controller[_0xf051('0x10')]);router['delete'](_0xf051('0x11'),auth[_0xf051('0xa')](),controller['destroy']);module[_0xf051('0x12')]=router; \ No newline at end of file +var _0x48cd=['update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','post','create','addApplications'];(function(_0x519cc4,_0x59d532){var _0x34f572=function(_0x28dc6a){while(--_0x28dc6a){_0x519cc4['push'](_0x519cc4['shift']());}};_0x34f572(++_0x59d532);}(_0x48cd,0x11c));var _0xd48c=function(_0x26e70e,_0x2d7057){_0x26e70e=_0x26e70e-0x0;var _0x3dfd69=_0x48cd[_0x26e70e];return _0x3dfd69;};'use strict';var multer=require(_0xd48c('0x0'));var util=require(_0xd48c('0x1'));var path=require(_0xd48c('0x2'));var timeout=require(_0xd48c('0x3'));var express=require(_0xd48c('0x4'));var router=express[_0xd48c('0x5')]();var fs_extra=require(_0xd48c('0x6'));var auth=require(_0xd48c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd48c('0x8'));var controller=require(_0xd48c('0x9'));router[_0xd48c('0xa')]('/',auth[_0xd48c('0xb')](),controller[_0xd48c('0xc')]);router[_0xd48c('0xa')]('/:id',auth[_0xd48c('0xb')](),controller['show']);router[_0xd48c('0xd')]('/',auth[_0xd48c('0xb')](),controller[_0xd48c('0xe')]);router[_0xd48c('0xd')]('/:id/applications',auth[_0xd48c('0xb')](),controller[_0xd48c('0xf')]);router['put']('/:id',auth[_0xd48c('0xb')](),controller[_0xd48c('0x10')]);router['delete'](_0xd48c('0x11'),auth[_0xd48c('0xb')](),controller[_0xd48c('0x12')]);module[_0xd48c('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 545c4b0..7d3faf4 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d8b('0x2')},'priority':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0d8b('0x2')},'tag':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0d8b('0x4')](_0x0d8b('0x5'),_0x0d8b('0x6'),'internal',_0x0d8b('0x7'),_0x0d8b('0x8'),'system',_0x0d8b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0d8b('0x3')]},'interval':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':_0x0d8b('0xa')},'IntervalId':{'type':Sequelize[_0x0d8b('0xb')]},'isApp':{'type':Sequelize[_0x0d8b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d8b('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0xd')},'answer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'));}}}; \ No newline at end of file +var _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x48f47d,_0x7f1ab6){var _0x531973=function(_0x203404){while(--_0x203404){_0x48f47d['push'](_0x48f47d['shift']());}};_0x531973(++_0x7f1ab6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 06ad03a..a2b4f73 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 _0xa67a=['name','UserProfileResource','sendStatus','send','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','VIRTUAL','merge','options','VoiceExtension','includeAll','include','findAll','show','params','create','startsWith','body','exten','concat','user','role','get','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','cutdigits','alias','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','error','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','find'];(function(_0x468ddb,_0x1c5598){var _0xd6dda3=function(_0x80a6e1){while(--_0x80a6e1){_0x468ddb['push'](_0x468ddb['shift']());}};_0xd6dda3(++_0x1c5598);}(_0xa67a,0x91));var _0xaa67=function(_0x3056e7,_0x246752){_0x3056e7=_0x3056e7-0x0;var _0x5747ba=_0xa67a[_0x3056e7];return _0x5747ba;};'use strict';var _=require(_0xaa67('0x0'));var Redis=require(_0xaa67('0x1'));var qs=require(_0xaa67('0x2'));var logger=require(_0xaa67('0x3'))(_0xaa67('0x4'));var config=require(_0xaa67('0x5'));var db=require(_0xaa67('0x6'))['db'];config[_0xaa67('0x7')]=_[_0xaa67('0x8')](config['redis'],{'host':_0xaa67('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaa67('0xa'))[_0xaa67('0xb')](socket);function respondWithStatusCode(_0x4365ac,_0x36b8f4){_0x36b8f4=_0x36b8f4||0xcc;return function(_0x342f24){if(_0x342f24){return _0x4365ac['sendStatus'](_0x36b8f4);}return _0x4365ac[_0xaa67('0xc')](_0x36b8f4)[_0xaa67('0xd')]();};}function respondWithResult(_0x2e6ed2,_0x28885c){_0x28885c=_0x28885c||0xc8;return function(_0x27d076){if(_0x27d076){return _0x2e6ed2[_0xaa67('0xc')](_0x28885c)['json'](_0x27d076);}};}function respondWithFilteredResult(_0x1496e3,_0x380570){return function(_0x3f1771){if(_0x3f1771){var _0x19689b=typeof _0x380570[_0xaa67('0xe')]===_0xaa67('0xf')&&typeof _0x380570[_0xaa67('0x10')]===_0xaa67('0xf');var _0x328674=_0x3f1771['count'];var _0x162628=_0x19689b?0x0:_0x380570[_0xaa67('0xe')];var _0x593eb2=_0x19689b?_0x3f1771[_0xaa67('0x11')]:_0x380570['offset']+_0x380570[_0xaa67('0x10')];var _0x40bb30;if(_0x593eb2>=_0x328674){_0x593eb2=_0x328674;_0x40bb30=0xc8;}else{_0x40bb30=0xce;}_0x1496e3['status'](_0x40bb30);return _0x1496e3[_0xaa67('0x12')](_0xaa67('0x13'),_0x162628+'-'+_0x593eb2+'/'+_0x328674)[_0xaa67('0x14')](_0x3f1771);}return null;};}function removeEntity(_0x127a6f){return function(_0x74b3da){if(_0x74b3da){return _0x74b3da[_0xaa67('0x15')]()[_0xaa67('0x16')](function(){var _0x564dfe=_0x74b3da['get']({'plain':!![]});var _0x39c27c=[{'name':_0xaa67('0x17'),'value':_0xaa67('0x18'),'ignore':![]},{'name':_0xaa67('0x19'),'value':_0xaa67('0x1a'),'ignore':![]},{'name':_0xaa67('0x1b'),'value':_0xaa67('0x1c'),'ignore':![]}];var _0x27b6af=_(_0x39c27c)[_0xaa67('0x1d')]('ignore')[_0xaa67('0x1e')](_0xaa67('0x1f'))[_0xaa67('0x1f')]();if(_[_0xaa67('0x20')](_0x27b6af,_0x564dfe[_0xaa67('0x21')])){return;}var _0x1c629b=_[_0xaa67('0x22')](_0x39c27c,[_0xaa67('0x1f'),_0x564dfe[_0xaa67('0x21')]])[_0xaa67('0x23')];return db[_0xaa67('0x24')]['destroy']({'where':{'type':_0x1c629b,'resourceId':_0x564dfe['id']}})[_0xaa67('0x16')](function(){return _0x74b3da;});})[_0xaa67('0x16')](function(){_0x127a6f[_0xaa67('0xc')](0xcc)[_0xaa67('0xd')]();});}};}function handleEntityNotFound(_0x3046a5){return function(_0x11a347){if(!_0x11a347){_0x3046a5[_0xaa67('0x25')](0x194);}return _0x11a347;};}function handleError(_0x4b4e02,_0x55c5b4){_0x55c5b4=_0x55c5b4||0x1f4;return function(_0x57fcc2){logger['error'](_0x57fcc2['stack']);if(_0x57fcc2[_0xaa67('0x23')]){delete _0x57fcc2['name'];}_0x4b4e02[_0xaa67('0xc')](_0x55c5b4)[_0xaa67('0x26')](_0x57fcc2);};}exports['index']=function(_0x281a86,_0x3948d9){var _0x42dd2d={},_0x5b3e75={},_0x300dd5={'count':0x0,'rows':[]};var _0x1309e9=_[_0xaa67('0x1e')](db['VoiceExtension'][_0xaa67('0x27')],function(_0xea9e5c){return{'name':_0xea9e5c['fieldName'],'type':_0xea9e5c[_0xaa67('0x21')][_0xaa67('0x28')]};});_0x5b3e75[_0xaa67('0x29')]=_[_0xaa67('0x1e')](_0x1309e9,_0xaa67('0x23'));_0x5b3e75[_0xaa67('0x2a')]=_[_0xaa67('0x2b')](_0x281a86['query']);_0x5b3e75[_0xaa67('0x2c')]=_[_0xaa67('0x2d')](_0x5b3e75['model'],_0x5b3e75['query']);_0x42dd2d['attributes']=_[_0xaa67('0x2d')](_0x5b3e75['model'],qs[_0xaa67('0x2e')](_0x281a86[_0xaa67('0x2a')][_0xaa67('0x2e')]));_0x42dd2d[_0xaa67('0x2f')]=_0x42dd2d[_0xaa67('0x2f')][_0xaa67('0x30')]?_0x42dd2d['attributes']:_0x5b3e75[_0xaa67('0x29')];if(!_0x281a86[_0xaa67('0x2a')]['hasOwnProperty'](_0xaa67('0x31'))){_0x42dd2d[_0xaa67('0x10')]=qs[_0xaa67('0x10')](_0x281a86[_0xaa67('0x2a')][_0xaa67('0x10')]);_0x42dd2d[_0xaa67('0xe')]=qs[_0xaa67('0xe')](_0x281a86['query'][_0xaa67('0xe')]);}_0x42dd2d['order']=qs[_0xaa67('0x32')](_0x281a86[_0xaa67('0x2a')]['sort']);_0x42dd2d[_0xaa67('0x33')]=qs[_0xaa67('0x2c')](_['pick'](_0x281a86['query'],_0x5b3e75[_0xaa67('0x2c')]),_0x1309e9);if(_0x281a86[_0xaa67('0x2a')][_0xaa67('0x1d')]){_0x42dd2d[_0xaa67('0x33')]=_['merge'](_0x42dd2d[_0xaa67('0x33')],{'$or':_[_0xaa67('0x1e')](_0x1309e9,function(_0x383c90){if(_0x383c90['type']!==_0xaa67('0x34')){var _0xd5e603={};_0xd5e603[_0x383c90['name']]={'$like':'%'+_0x281a86[_0xaa67('0x2a')][_0xaa67('0x1d')]+'%'};return _0xd5e603;}})});}_0x42dd2d=_[_0xaa67('0x35')]({},_0x42dd2d,_0x281a86[_0xaa67('0x36')]);var _0x3611f8={'where':_0x42dd2d['where']};return db[_0xaa67('0x37')][_0xaa67('0x11')](_0x3611f8)[_0xaa67('0x16')](function(_0x3fa3b3){_0x300dd5[_0xaa67('0x11')]=_0x3fa3b3;if(_0x281a86[_0xaa67('0x2a')][_0xaa67('0x38')]){_0x42dd2d[_0xaa67('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0xaa67('0x3a')](_0x42dd2d);})[_0xaa67('0x16')](function(_0x474567){_0x300dd5['rows']=_0x474567;return _0x300dd5;})[_0xaa67('0x16')](respondWithFilteredResult(_0x3948d9,_0x42dd2d))['catch'](handleError(_0x3948d9,null));};exports[_0xaa67('0x3b')]=function(_0x50184a,_0x1370ff){var _0x432199={'raw':![],'where':{'id':_0x50184a[_0xaa67('0x3c')]['id']}},_0x4022a0={};_0x4022a0['model']=_['keys'](db[_0xaa67('0x37')][_0xaa67('0x27')]);_0x4022a0['query']=_[_0xaa67('0x2b')](_0x50184a[_0xaa67('0x2a')]);_0x4022a0[_0xaa67('0x2c')]=_[_0xaa67('0x2d')](_0x4022a0[_0xaa67('0x29')],_0x4022a0[_0xaa67('0x2a')]);_0x432199[_0xaa67('0x2f')]=_[_0xaa67('0x2d')](_0x4022a0[_0xaa67('0x29')],qs[_0xaa67('0x2e')](_0x50184a[_0xaa67('0x2a')][_0xaa67('0x2e')]));_0x432199[_0xaa67('0x2f')]=_0x432199[_0xaa67('0x2f')][_0xaa67('0x30')]?_0x432199[_0xaa67('0x2f')]:_0x4022a0['model'];if(_0x50184a[_0xaa67('0x2a')][_0xaa67('0x38')]){_0x432199[_0xaa67('0x39')]=[{'all':!![]}];}_0x432199=_[_0xaa67('0x35')]({},_0x432199,_0x50184a[_0xaa67('0x36')]);return db[_0xaa67('0x37')][_0xaa67('0x22')](_0x432199)[_0xaa67('0x16')](handleEntityNotFound(_0x1370ff,null))[_0xaa67('0x16')](respondWithResult(_0x1370ff,null))['catch'](handleError(_0x1370ff,null));};exports['destroy']=function(_0x45df9a,_0x346c34){return db[_0xaa67('0x37')][_0xaa67('0x22')]({'where':{'id':_0x45df9a[_0xaa67('0x3c')]['id']}})[_0xaa67('0x16')](handleEntityNotFound(_0x346c34,null))['then'](removeEntity(_0x346c34,null))['catch'](handleError(_0x346c34,null));};exports[_0xaa67('0x3d')]=function(_0x4924db,_0x7e3eb){if(_0x4924db['body'][_0xaa67('0x21')]==='outbound'&&!_[_0xaa67('0x3e')](_0x4924db[_0xaa67('0x3f')][_0xaa67('0x40')],'_')){_0x4924db[_0xaa67('0x3f')][_0xaa67('0x40')]='_'[_0xaa67('0x41')](_0x4924db[_0xaa67('0x3f')][_0xaa67('0x40')]);}return db['VoiceExtension'][_0xaa67('0x3d')](_0x4924db['body'],{'raw':![]})['then'](function(_0x3fd8e3){var _0x12f4a2=_0x4924db[_0xaa67('0x42')]['get']({'plain':!![]});if(!_0x12f4a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12f4a2[_0xaa67('0x43')]===_0xaa67('0x42')){var _0x458f0a=_0x3fd8e3[_0xaa67('0x44')]({'plain':!![]});var _0x1417d2=[{'name':'InboundRoutes','value':_0xaa67('0x18')},{'name':_0xaa67('0x19'),'value':_0xaa67('0x1a')},{'name':_0xaa67('0x1b'),'value':'internal'}];var _0x3edcd5=_['find'](_0x1417d2,['value',_0x458f0a[_0xaa67('0x21')]])['name'];return db[_0xaa67('0x45')][_0xaa67('0x22')]({'where':{'name':_0x3edcd5,'userProfileId':_0x12f4a2[_0xaa67('0x46')]},'raw':!![]})[_0xaa67('0x16')](function(_0x44bbef){if(_0x44bbef&&_0x44bbef[_0xaa67('0x47')]===0x0){return db[_0xaa67('0x24')]['create']({'name':_0x458f0a[_0xaa67('0x23')],'resourceId':_0x458f0a['id'],'type':_0x44bbef[_0xaa67('0x23')],'sectionId':_0x44bbef['id']},{})['then'](function(){return _0x3fd8e3;});}else{return _0x3fd8e3;}})[_0xaa67('0x48')](function(_0x4916e2){logger['error'](_0xaa67('0x49'),_0x4916e2);throw _0x4916e2;});}return _0x3fd8e3;})[_0xaa67('0x16')](respondWithResult(_0x7e3eb,0xc9))[_0xaa67('0x48')](handleError(_0x7e3eb,null));};exports['update']=function(_0x42047d,_0x1275e3){if(_0x42047d[_0xaa67('0x3f')]['id']){delete _0x42047d['body']['id'];}return db[_0xaa67('0x37')]['find']({'where':{'id':_0x42047d[_0xaa67('0x3c')]['id']}})[_0xaa67('0x16')](handleEntityNotFound(_0x1275e3,null))[_0xaa67('0x16')](function(_0x46209c){if(_0x46209c){return db[_0xaa67('0x37')][_0xaa67('0x4a')](_[_0xaa67('0x4b')](_0x42047d[_0xaa67('0x3f')],[_0xaa67('0x40'),_0xaa67('0x4c'),'description','recordingFormat',_0xaa67('0x4d'),'mandatoryDisposition',_0xaa67('0x4e')]),{'where':{'context':_0x46209c[_0xaa67('0x4c')],'exten':_0x46209c[_0xaa67('0x40')]},'individualHooks':!![]})[_0xaa67('0x16')](function(_0x47b851){return _0x47b851;});}return null;})[_0xaa67('0x16')](respondWithStatusCode(_0x1275e3,null))[_0xaa67('0x48')](handleError(_0x1275e3,null));};exports['addApplications']=function(_0x2eb6b2,_0x3a0932){var _0x5d07ae=_0x2eb6b2['params']['id'];var _0xeea745=_0x2eb6b2[_0xaa67('0x3f')];var _0xb06120=0xc8;var _0x560c34=null;return db[_0xaa67('0x4f')][_0xaa67('0x50')]({'isolationLevel':db[_0xaa67('0x4f')][_0xaa67('0x51')]['ISOLATION_LEVELS'][_0xaa67('0x52')]},function(_0x817dd6){return db[_0xaa67('0x37')]['findOne']({'where':{'id':_0x5d07ae},'transaction':_0x817dd6})[_0xaa67('0x16')](function(_0x21c5d7){if(_0x21c5d7){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x5d07ae},'transaction':_0x817dd6})[_0xaa67('0x16')](function(){var _0x1933ab=_[_0xaa67('0x1e')](_0xeea745,function(_0x3bd9f4){_0x3bd9f4[_0xaa67('0x53')]=_0x5d07ae;_0x3bd9f4[_0xaa67('0x54')]=!![];return _0x3bd9f4;});return _0x21c5d7[_0xaa67('0x55')](_0x1933ab);})[_0xaa67('0x16')](function(_0x2c0dda){return db[_0xaa67('0x37')][_0xaa67('0x56')](_0x2c0dda,{'transaction':_0x817dd6});});}else{_0xb06120=0x194;_0x560c34=[];}});})[_0xaa67('0x16')](function(){if(_0xb06120!==0x194){return db[_0xaa67('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5d07ae},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x5ee6fe){_0x560c34=_0x5ee6fe;});}})[_0xaa67('0x48')](function(_0x44c4c8){_0xb06120=0x1f4;logger[_0xaa67('0x57')](_0x44c4c8[_0xaa67('0x58')]);if(_0x44c4c8['name']){delete _0x44c4c8['name'];}_0x560c34=_0x44c4c8;})[_0xaa67('0x59')](function(){if(_0x560c34===null){_0x3a0932[_0xaa67('0x25')](_0xb06120);}else{if(_0xb06120===0x1f4){_0x3a0932[_0xaa67('0xc')](_0xb06120)['send'](_0x560c34);}else{_0x3a0932['status'](_0xb06120)[_0xaa67('0x14')](_0x560c34);}}});}; \ No newline at end of file +var _0x88b8=['findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','register','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','VoiceExtension','includeAll','include','findAll','show','keys','options','catch','params','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','READ_COMMITTED'];(function(_0x17d629,_0x24caab){var _0x59966b=function(_0x4816e2){while(--_0x4816e2){_0x17d629['push'](_0x17d629['shift']());}};_0x59966b(++_0x24caab);}(_0x88b8,0x11f));var _0x888b=function(_0x4601f3,_0x4d2401){_0x4601f3=_0x4601f3-0x0;var _0x2afb49=_0x88b8[_0x4601f3];return _0x2afb49;};'use strict';var _=require('lodash');var Redis=require(_0x888b('0x0'));var qs=require(_0x888b('0x1'));var logger=require(_0x888b('0x2'))(_0x888b('0x3'));var config=require(_0x888b('0x4'));var db=require(_0x888b('0x5'))['db'];config['redis']=_[_0x888b('0x6')](config[_0x888b('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x888b('0x7')]));require('./voiceExtension.socket')[_0x888b('0x8')](socket);function respondWithStatusCode(_0x26b5f3,_0x52f323){_0x52f323=_0x52f323||0xcc;return function(_0x19c7e0){if(_0x19c7e0){return _0x26b5f3[_0x888b('0x9')](_0x52f323);}return _0x26b5f3['status'](_0x52f323)[_0x888b('0xa')]();};}function respondWithResult(_0x3715ca,_0x579f72){_0x579f72=_0x579f72||0xc8;return function(_0x69d503){if(_0x69d503){return _0x3715ca[_0x888b('0xb')](_0x579f72)[_0x888b('0xc')](_0x69d503);}};}function respondWithFilteredResult(_0x4766c9,_0x36f2ab){return function(_0x5935e4){if(_0x5935e4){var _0x5944b4=typeof _0x36f2ab['offset']===_0x888b('0xd')&&typeof _0x36f2ab['limit']===_0x888b('0xd');var _0x1f7080=_0x5935e4[_0x888b('0xe')];var _0x8d6dd1=_0x5944b4?0x0:_0x36f2ab[_0x888b('0xf')];var _0x1f1641=_0x5944b4?_0x5935e4[_0x888b('0xe')]:_0x36f2ab[_0x888b('0xf')]+_0x36f2ab[_0x888b('0x10')];var _0xd5303e;if(_0x1f1641>=_0x1f7080){_0x1f1641=_0x1f7080;_0xd5303e=0xc8;}else{_0xd5303e=0xce;}_0x4766c9[_0x888b('0xb')](_0xd5303e);return _0x4766c9[_0x888b('0x11')](_0x888b('0x12'),_0x8d6dd1+'-'+_0x1f1641+'/'+_0x1f7080)['json'](_0x5935e4);}return null;};}function removeEntity(_0x927df4){return function(_0x572c1b){if(_0x572c1b){return _0x572c1b[_0x888b('0x13')]()[_0x888b('0x14')](function(){var _0x40e3d6=_0x572c1b[_0x888b('0x15')]({'plain':!![]});var _0x66d394=[{'name':_0x888b('0x16'),'value':_0x888b('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0x888b('0x18'),'ignore':![]},{'name':_0x888b('0x19'),'value':_0x888b('0x1a'),'ignore':![]}];var _0x3829e3=_(_0x66d394)['filter']('ignore')[_0x888b('0x1b')](_0x888b('0x1c'))[_0x888b('0x1c')]();if(_[_0x888b('0x1d')](_0x3829e3,_0x40e3d6[_0x888b('0x1e')])){return;}var _0x3a6d19=_[_0x888b('0x1f')](_0x66d394,['value',_0x40e3d6['type']])[_0x888b('0x20')];return db[_0x888b('0x21')][_0x888b('0x13')]({'where':{'type':_0x3a6d19,'resourceId':_0x40e3d6['id']}})[_0x888b('0x14')](function(){return _0x572c1b;});})[_0x888b('0x14')](function(){_0x927df4[_0x888b('0xb')](0xcc)[_0x888b('0xa')]();});}};}function handleEntityNotFound(_0x1d8f40){return function(_0x4bcccd){if(!_0x4bcccd){_0x1d8f40[_0x888b('0x9')](0x194);}return _0x4bcccd;};}function handleError(_0x28536d,_0x3ab4a1){_0x3ab4a1=_0x3ab4a1||0x1f4;return function(_0x56c25f){logger[_0x888b('0x22')](_0x56c25f[_0x888b('0x23')]);if(_0x56c25f['name']){delete _0x56c25f[_0x888b('0x20')];}_0x28536d[_0x888b('0xb')](_0x3ab4a1)[_0x888b('0x24')](_0x56c25f);};}exports[_0x888b('0x25')]=function(_0x4f88d9,_0x66fe5f){var _0x18f43b={},_0x5b99fd={},_0x5b2a21={'count':0x0,'rows':[]};var _0x4911a9=_[_0x888b('0x1b')](db['VoiceExtension'][_0x888b('0x26')],function(_0x279c6e){return{'name':_0x279c6e[_0x888b('0x27')],'type':_0x279c6e[_0x888b('0x1e')][_0x888b('0x28')]};});_0x5b99fd[_0x888b('0x29')]=_[_0x888b('0x1b')](_0x4911a9,'name');_0x5b99fd[_0x888b('0x2a')]=_['keys'](_0x4f88d9[_0x888b('0x2a')]);_0x5b99fd[_0x888b('0x2b')]=_[_0x888b('0x2c')](_0x5b99fd['model'],_0x5b99fd['query']);_0x18f43b[_0x888b('0x2d')]=_[_0x888b('0x2c')](_0x5b99fd[_0x888b('0x29')],qs[_0x888b('0x2e')](_0x4f88d9[_0x888b('0x2a')][_0x888b('0x2e')]));_0x18f43b[_0x888b('0x2d')]=_0x18f43b[_0x888b('0x2d')][_0x888b('0x2f')]?_0x18f43b[_0x888b('0x2d')]:_0x5b99fd['model'];if(!_0x4f88d9[_0x888b('0x2a')][_0x888b('0x30')](_0x888b('0x31'))){_0x18f43b[_0x888b('0x10')]=qs['limit'](_0x4f88d9[_0x888b('0x2a')]['limit']);_0x18f43b[_0x888b('0xf')]=qs[_0x888b('0xf')](_0x4f88d9[_0x888b('0x2a')]['offset']);}_0x18f43b[_0x888b('0x32')]=qs[_0x888b('0x33')](_0x4f88d9[_0x888b('0x2a')][_0x888b('0x33')]);_0x18f43b[_0x888b('0x34')]=qs[_0x888b('0x2b')](_[_0x888b('0x35')](_0x4f88d9[_0x888b('0x2a')],_0x5b99fd['filters']),_0x4911a9);if(_0x4f88d9[_0x888b('0x2a')]['filter']){_0x18f43b['where']=_[_0x888b('0x36')](_0x18f43b[_0x888b('0x34')],{'$or':_['map'](_0x4911a9,function(_0x1d8824){if(_0x1d8824[_0x888b('0x1e')]!=='VIRTUAL'){var _0x5cc52d={};_0x5cc52d[_0x1d8824['name']]={'$like':'%'+_0x4f88d9[_0x888b('0x2a')][_0x888b('0x37')]+'%'};return _0x5cc52d;}})});}_0x18f43b=_[_0x888b('0x36')]({},_0x18f43b,_0x4f88d9['options']);var _0x169e8f={'where':_0x18f43b['where']};return db[_0x888b('0x38')]['count'](_0x169e8f)[_0x888b('0x14')](function(_0x1026cb){_0x5b2a21[_0x888b('0xe')]=_0x1026cb;if(_0x4f88d9[_0x888b('0x2a')][_0x888b('0x39')]){_0x18f43b[_0x888b('0x3a')]=[{'all':!![]}];}return db[_0x888b('0x38')][_0x888b('0x3b')](_0x18f43b);})[_0x888b('0x14')](function(_0x161607){_0x5b2a21['rows']=_0x161607;return _0x5b2a21;})[_0x888b('0x14')](respondWithFilteredResult(_0x66fe5f,_0x18f43b))['catch'](handleError(_0x66fe5f,null));};exports[_0x888b('0x3c')]=function(_0x3f563d,_0x21dae2){var _0x57a9ba={'raw':![],'where':{'id':_0x3f563d['params']['id']}},_0x4f0076={};_0x4f0076[_0x888b('0x29')]=_['keys'](db['VoiceExtension'][_0x888b('0x26')]);_0x4f0076[_0x888b('0x2a')]=_[_0x888b('0x3d')](_0x3f563d[_0x888b('0x2a')]);_0x4f0076[_0x888b('0x2b')]=_[_0x888b('0x2c')](_0x4f0076[_0x888b('0x29')],_0x4f0076[_0x888b('0x2a')]);_0x57a9ba['attributes']=_[_0x888b('0x2c')](_0x4f0076[_0x888b('0x29')],qs[_0x888b('0x2e')](_0x3f563d['query'][_0x888b('0x2e')]));_0x57a9ba[_0x888b('0x2d')]=_0x57a9ba['attributes']['length']?_0x57a9ba[_0x888b('0x2d')]:_0x4f0076['model'];if(_0x3f563d[_0x888b('0x2a')][_0x888b('0x39')]){_0x57a9ba[_0x888b('0x3a')]=[{'all':!![]}];}_0x57a9ba=_[_0x888b('0x36')]({},_0x57a9ba,_0x3f563d[_0x888b('0x3e')]);return db[_0x888b('0x38')][_0x888b('0x1f')](_0x57a9ba)['then'](handleEntityNotFound(_0x21dae2,null))[_0x888b('0x14')](respondWithResult(_0x21dae2,null))[_0x888b('0x3f')](handleError(_0x21dae2,null));};exports[_0x888b('0x13')]=function(_0x5cb83b,_0x3704e2){return db[_0x888b('0x38')][_0x888b('0x1f')]({'where':{'id':_0x5cb83b[_0x888b('0x40')]['id']}})['then'](handleEntityNotFound(_0x3704e2,null))['then'](removeEntity(_0x3704e2,null))[_0x888b('0x3f')](handleError(_0x3704e2,null));};exports['create']=function(_0x20bc41,_0x1de4d6){if(_0x20bc41[_0x888b('0x41')][_0x888b('0x1e')]===_0x888b('0x18')&&!_[_0x888b('0x42')](_0x20bc41[_0x888b('0x41')][_0x888b('0x43')],'_')){_0x20bc41[_0x888b('0x41')]['exten']='_'[_0x888b('0x44')](_0x20bc41[_0x888b('0x41')]['exten']);}return db[_0x888b('0x38')][_0x888b('0x45')](_0x20bc41[_0x888b('0x41')],{'raw':![]})[_0x888b('0x14')](function(_0x21528e){var _0x444fce=_0x20bc41[_0x888b('0x46')][_0x888b('0x15')]({'plain':!![]});if(!_0x444fce)throw new Error(_0x888b('0x47'));if(_0x444fce[_0x888b('0x48')]===_0x888b('0x46')){var _0x1d3f8c=_0x21528e[_0x888b('0x15')]({'plain':!![]});var _0x16777c=[{'name':_0x888b('0x16'),'value':_0x888b('0x17')},{'name':_0x888b('0x49'),'value':_0x888b('0x18')},{'name':_0x888b('0x19'),'value':_0x888b('0x1a')}];var _0x581975=_[_0x888b('0x1f')](_0x16777c,['value',_0x1d3f8c[_0x888b('0x1e')]])[_0x888b('0x20')];return db[_0x888b('0x4a')][_0x888b('0x1f')]({'where':{'name':_0x581975,'userProfileId':_0x444fce[_0x888b('0x4b')]},'raw':!![]})['then'](function(_0x4753e1){if(_0x4753e1&&_0x4753e1[_0x888b('0x4c')]===0x0){return db[_0x888b('0x21')]['create']({'name':_0x1d3f8c[_0x888b('0x20')],'resourceId':_0x1d3f8c['id'],'type':_0x4753e1[_0x888b('0x20')],'sectionId':_0x4753e1['id']},{})['then'](function(){return _0x21528e;});}else{return _0x21528e;}})[_0x888b('0x3f')](function(_0x1487b4){logger[_0x888b('0x22')](_0x888b('0x4d'),_0x1487b4);throw _0x1487b4;});}return _0x21528e;})[_0x888b('0x14')](respondWithResult(_0x1de4d6,0xc9))['catch'](handleError(_0x1de4d6,null));};exports[_0x888b('0x4e')]=function(_0x18f94b,_0x37b95d){if(_0x18f94b[_0x888b('0x41')]['id']){delete _0x18f94b[_0x888b('0x41')]['id'];}return db[_0x888b('0x38')]['find']({'where':{'id':_0x18f94b['params']['id']}})[_0x888b('0x14')](handleEntityNotFound(_0x37b95d,null))[_0x888b('0x14')](function(_0x162d88){if(_0x162d88){return db[_0x888b('0x38')][_0x888b('0x4e')](_[_0x888b('0x35')](_0x18f94b[_0x888b('0x41')],[_0x888b('0x43'),_0x888b('0x4f'),_0x888b('0x50'),_0x888b('0x51'),_0x888b('0x52'),_0x888b('0x53'),'alias']),{'where':{'context':_0x162d88[_0x888b('0x4f')],'exten':_0x162d88['exten']},'individualHooks':!![]})['then'](function(_0x5387d0){return _0x5387d0;});}return null;})[_0x888b('0x14')](respondWithStatusCode(_0x37b95d,null))[_0x888b('0x3f')](handleError(_0x37b95d,null));};exports[_0x888b('0x54')]=function(_0x5aa576,_0x3fe1d4){var _0xd4510f=_0x5aa576[_0x888b('0x40')]['id'];var _0x581e78=_0x5aa576[_0x888b('0x41')];var _0x571385=0xc8;var _0x3ab4c8=null;return db[_0x888b('0x55')][_0x888b('0x56')]({'isolationLevel':db[_0x888b('0x55')][_0x888b('0x57')]['ISOLATION_LEVELS'][_0x888b('0x58')]},function(_0x38fdd7){return db[_0x888b('0x38')][_0x888b('0x59')]({'where':{'id':_0xd4510f},'transaction':_0x38fdd7})['then'](function(_0x19d72c){if(_0x19d72c){return db['VoiceExtension'][_0x888b('0x13')]({'where':{'VoiceExtensionId':_0xd4510f},'transaction':_0x38fdd7})[_0x888b('0x14')](function(){var _0x2dcc05=_[_0x888b('0x1b')](_0x581e78,function(_0x50371d){_0x50371d[_0x888b('0x5a')]=_0xd4510f;_0x50371d[_0x888b('0x5b')]=!![];return _0x50371d;});return _0x19d72c['createRouting'](_0x2dcc05);})[_0x888b('0x14')](function(_0x5b0bd2){return db[_0x888b('0x38')][_0x888b('0x5c')](_0x5b0bd2,{'transaction':_0x38fdd7});});}else{_0x571385=0x194;_0x3ab4c8=[];}});})[_0x888b('0x14')](function(){if(_0x571385!==0x194){return db[_0x888b('0x38')][_0x888b('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0xd4510f},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x615e01){_0x3ab4c8=_0x615e01;});}})['catch'](function(_0x3d59b9){_0x571385=0x1f4;logger['error'](_0x3d59b9[_0x888b('0x23')]);if(_0x3d59b9['name']){delete _0x3d59b9[_0x888b('0x20')];}_0x3ab4c8=_0x3d59b9;})['finally'](function(){if(_0x3ab4c8===null){_0x3fe1d4[_0x888b('0x9')](_0x571385);}else{if(_0x571385===0x1f4){_0x3fe1d4['status'](_0x571385)['send'](_0x3ab4c8);}else{_0x3fe1d4[_0x888b('0xb')](_0x571385)[_0x888b('0xc')](_0x3ab4c8);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3b956d6..e65db04 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 _0x9f23=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','events'];(function(_0x5982a5,_0x3dc07b){var _0x159c80=function(_0x274c92){while(--_0x274c92){_0x5982a5['push'](_0x5982a5['shift']());}};_0x159c80(++_0x3dc07b);}(_0x9f23,0x1bf));var _0x39f2=function(_0x1e0963,_0x3096cc){_0x1e0963=_0x1e0963-0x0;var _0x3ef4b7=_0x9f23[_0x1e0963];return _0x3ef4b7;};'use strict';var EventEmitter=require(_0x39f2('0x0'));var VoiceExtension=require(_0x39f2('0x1'))['db'][_0x39f2('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x39f2('0x3')](0x0);var events={'afterCreate':_0x39f2('0x4'),'afterUpdate':_0x39f2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x181935){return function(_0x2599d9,_0x349896,_0x5a7066){VoiceExtensionEvents['emit'](_0x181935+':'+_0x2599d9['id'],_0x2599d9);VoiceExtensionEvents[_0x39f2('0x6')](_0x181935,_0x2599d9);_0x5a7066(null);};}for(var e in events){if(events[_0x39f2('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xef45=['exports','VoiceExtension','save','update','emit'];(function(_0x41ee65,_0x3a462b){var _0x1d8828=function(_0x319a28){while(--_0x319a28){_0x41ee65['push'](_0x41ee65['shift']());}};_0x1d8828(++_0x3a462b);}(_0xef45,0x15a));var _0x5ef4=function(_0x4d7775,_0x808554){_0x4d7775=_0x4d7775-0x0;var _0x4ff7db=_0xef45[_0x4d7775];return _0x4ff7db;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x5ef4('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ef4('0x1'),'afterUpdate':_0x5ef4('0x2'),'afterDestroy':'remove'};function emitEvent(_0x38f9e9){return function(_0x2b8e96,_0x37f228,_0x5ec971){VoiceExtensionEvents[_0x5ef4('0x3')](_0x38f9e9+':'+_0x2b8e96['id'],_0x2b8e96);VoiceExtensionEvents[_0x5ef4('0x3')](_0x38f9e9,_0x2b8e96);_0x5ec971(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x5ef4('0x4')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 51739ea..9975182 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 _0x8e69=['tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','voice_extensions','then','Hangup','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','name','param','split','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','length','*,*,*,*','intervals','map','filter','toLowerCase'];(function(_0x3b8e27,_0x5cd428){var _0x120592=function(_0x92c062){while(--_0x92c062){_0x3b8e27['push'](_0x3b8e27['shift']());}};_0x120592(++_0x5cd428);}(_0x8e69,0x111));var _0x98e6=function(_0x4365ea,_0x1d67f6){_0x4365ea=_0x4365ea-0x0;var _0x362b63=_0x8e69[_0x4365ea];return _0x362b63;};'use strict';var _=require('lodash');var attributes=require(_0x98e6('0x0'));module[_0x98e6('0x1')]=function(_0x3ba70e){var _0x24b05c=_0x3ba70e[_0x98e6('0x2')];function _0x27e5d9(_0x1fb38f){var _0x5680c1=0x2;var _0x3b92a3=[{'type':_0x1fb38f['type'],'app':_0x98e6('0x3'),'appdata':_0x98e6('0x4')+_0x1fb38f[_0x98e6('0x5')],'context':_0x1fb38f[_0x98e6('0x6')],'exten':_0x1fb38f['exten'],'priority':_0x5680c1++,'VoiceExtensionId':_0x1fb38f['id']}];if(_0x1fb38f['type']===_0x98e6('0x7')){_0x3b92a3[_0x98e6('0x8')]({'type':_0x98e6('0x7'),'app':'Set','appdata':_0x98e6('0x9')+_0x1fb38f['id'],'context':_0x1fb38f[_0x98e6('0x6')],'exten':_0x1fb38f[_0x98e6('0xa')],'priority':_0x5680c1++,'VoiceExtensionId':_0x1fb38f['id']});}_0x3b92a3[_0x98e6('0x8')]({'type':_0x1fb38f[_0x98e6('0x5')],'app':_0x98e6('0x3'),'appdata':_0x98e6('0xb'),'context':_0x1fb38f[_0x98e6('0x6')],'exten':_0x1fb38f[_0x98e6('0xa')],'priority':_0x5680c1++,'VoiceExtensionId':_0x1fb38f['id']},{'type':_0x1fb38f[_0x98e6('0x5')],'app':'Set','appdata':_0x98e6('0xc'),'context':_0x1fb38f[_0x98e6('0x6')],'exten':_0x1fb38f[_0x98e6('0xa')],'priority':_0x5680c1++,'VoiceExtensionId':_0x1fb38f['id']},{'type':_0x1fb38f[_0x98e6('0x5')],'app':_0x98e6('0x3'),'appdata':_0x98e6('0xd'),'context':_0x1fb38f[_0x98e6('0x6')],'exten':_0x1fb38f[_0x98e6('0xa')],'priority':_0x5680c1++,'VoiceExtensionId':_0x1fb38f['id']});return _0x3b92a3;}function _0x8a5291(_0x4cd069){var _0x3fa873=0x2;var _0x1fa0b5=[{'type':'outbound','app':_0x98e6('0x3'),'appdata':_0x98e6('0xe'),'context':_0x4cd069['context'],'exten':_0x4cd069['exten'],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':_0x98e6('0xf'),'app':_0x98e6('0x3'),'appdata':_0x98e6('0x10')+(_0x4cd069[_0x98e6('0x11')]?_0x98e6('0x12')+_0x4cd069[_0x98e6('0x11')]+'}':_0x98e6('0x13')),'context':_0x4cd069[_0x98e6('0x6')],'exten':_0x4cd069[_0x98e6('0xa')],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':_0x98e6('0xf'),'app':'Set','appdata':_0x98e6('0x9')+_0x4cd069['id'],'context':_0x4cd069['context'],'exten':_0x4cd069[_0x98e6('0xa')],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':_0x98e6('0xf'),'app':_0x98e6('0x14'),'appdata':_0x98e6('0x15')+(_0x3fa873+0x2)+_0x98e6('0x16')+(_0x3fa873+0x1)+')','context':_0x4cd069['context'],'exten':_0x4cd069['exten'],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':_0x98e6('0xf'),'app':_0x98e6('0x3'),'appdata':_0x4cd069['cutdigits']?_0x98e6('0x17')+_0x4cd069[_0x98e6('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x4cd069['context'],'exten':_0x4cd069[_0x98e6('0xa')],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':_0x98e6('0xf'),'app':'Set','appdata':_0x98e6('0xb'),'context':_0x4cd069[_0x98e6('0x6')],'exten':_0x4cd069['exten'],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':_0x98e6('0xf'),'app':_0x98e6('0x3'),'appdata':_0x98e6('0xc'),'context':_0x4cd069[_0x98e6('0x6')],'exten':_0x4cd069['exten'],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':'outbound','app':_0x98e6('0x3'),'appdata':_0x98e6('0xd'),'context':_0x4cd069[_0x98e6('0x6')],'exten':_0x4cd069[_0x98e6('0xa')],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':_0x98e6('0xf'),'app':_0x98e6('0x3'),'appdata':_0x98e6('0x18')+_0x4cd069['id'],'context':_0x4cd069[_0x98e6('0x6')],'exten':_0x4cd069[_0x98e6('0xa')],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']}];if(_0x4cd069[_0x98e6('0x19')](_0x98e6('0x1a'))&&_0x4cd069[_0x98e6('0x1a')]!==_0x98e6('0x1b')){_0x1fa0b5[_0x98e6('0x8')]({'type':_0x98e6('0xf'),'app':_0x98e6('0x3'),'appdata':_0x98e6('0x1c'),'context':_0x4cd069['context'],'exten':_0x4cd069['exten'],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']},{'type':_0x98e6('0xf'),'app':_0x98e6('0x3'),'appdata':_0x98e6('0x1d')+_0x4cd069[_0x98e6('0x1a')]||_0x98e6('0x1e'),'context':_0x4cd069[_0x98e6('0x6')],'exten':_0x4cd069[_0x98e6('0xa')],'priority':_0x3fa873++,'VoiceExtensionId':_0x4cd069['id']});}return _0x1fa0b5;}function _0x41f573(_0x4920cf,_0x5a2357){var _0x1eed08=[{'name':_0x98e6('0x1f'),'param':0x0},{'name':_0x98e6('0x20'),'param':0x1},{'name':_0x98e6('0x21'),'param':0x2},{'name':_0x98e6('0x22'),'param':0x3}];var _0x5d0232={};var _0xc02e73=_0x5a2357['split'](',');var _0x3f55db=[];for(var _0xb11748=0x0;_0xb11748<_0x1eed08['length'];_0xb11748++){switch(_0x1eed08[_0xb11748][_0x98e6('0x23')]){case'trunk':_0x5d0232[_0x98e6('0x1f')]=_0xc02e73[_0x1eed08[_0xb11748][_0x98e6('0x24')]][_0x98e6('0x25')]('/')[0x1];_0x5d0232[_0x98e6('0x26')]=_0xc02e73[_0x1eed08[_0xb11748]['param']][_0x98e6('0x25')]('/')[0x2];_0x5d0232['prefix']=_0x5d0232[_0x98e6('0x26')]?_0x5d0232[_0x98e6('0x26')][_0x98e6('0x25')]('$')[0x0]:undefined;_0x5d0232['phone']=_0x4920cf[_0x98e6('0x11')]?(_0x5d0232['prefix']||'')+_0x98e6('0x12')+_0x4920cf[_0x98e6('0x11')]+'}':(_0x5d0232[_0x98e6('0x27')]||'')+'${EXTEN}';_0x3f55db[_0x1eed08[_0xb11748]['param']]=[_0x98e6('0x28'),_0x5d0232[_0x98e6('0x1f')],_0x5d0232[_0x98e6('0x26')]][_0x98e6('0x29')]('/');break;case _0x98e6('0x21'):_0x5d0232[_0x98e6('0x21')]=_0xc02e73[_0x1eed08[_0xb11748][_0x98e6('0x24')]];if(_0x4920cf[_0x98e6('0x1a')]!==_0x98e6('0x1b')){if(_0x5d0232[_0x98e6('0x21')][_0x98e6('0x2a')](_0x98e6('0x2b'))<0x0){_0x5d0232[_0x98e6('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x5d0232['options']=_0x5d0232[_0x98e6('0x21')]['replace'](_0x98e6('0x2b'),'');}_0x3f55db[_0x1eed08[_0xb11748][_0x98e6('0x24')]]=_0x5d0232['options'];break;default:_0x3f55db[_0x1eed08[_0xb11748]['param']]=_0xc02e73[_0x1eed08[_0xb11748][_0x98e6('0x24')]];}}return _0x3f55db[_0x98e6('0x29')](',');}function _0x32d45a(_0x5b5460,_0x3a6db2,_0x112535){return new Promise(function(_0x54a824,_0x4627a4){var _0x28abf7=[];if(_[_0x98e6('0x2c')](_0x3a6db2))return _0x54a824(_0x28abf7);_0x24b05c[_0x98e6('0x2d')][_0x98e6('0x2e')]({'attributes':['id',_0x98e6('0x2f'),_0x98e6('0x30')],'raw':!![]})['then'](function(_0xd2545f){for(var _0x69c979=0x0,_0x284f8b=0x0;_0x69c979<_0x3a6db2[_0x98e6('0x31')];_0x69c979++,_0x284f8b=0x0){var _0x5e9414=_0x3a6db2[_0x69c979];var _0x545796=[];var _0xc4d87b=[];delete _0x5e9414['id'];if(_0x5e9414[_0x98e6('0x2f')]!==_0x98e6('0x32')){_0x5e9414['intervals']=[_0x5e9414[_0x98e6('0x2f')]];}else{_0x5e9414[_0x98e6('0x33')]=_0x5e9414['IntervalId']?_[_0x98e6('0x34')](_[_0x98e6('0x35')](_0xd2545f,{'IntervalId':_0x5e9414[_0x98e6('0x30')]}),_0x98e6('0x2f')):[];}_0x5e9414['context']=_0x5b5460[_0x98e6('0x6')];_0x5e9414[_0x98e6('0xa')]=_0x5b5460[_0x98e6('0xa')];if(_0x5e9414['type'])_0x5e9414[_0x98e6('0x5')]=_0x5e9414[_0x98e6('0x5')][_0x98e6('0x36')]();if(_0x5b5460[_0x98e6('0x5')]===_0x98e6('0xf')){if(_0x5e9414[_0x98e6('0x19')]('tag')&&_0x5e9414[_0x98e6('0x37')]&&_0x5e9414[_0x98e6('0x37')]!=='--'){_0x545796['push']({'type':_0x5e9414[_0x98e6('0x5')]['toLowerCase'](),'app':_0x98e6('0x3'),'appdata':_0x98e6('0x38')+_0x5e9414[_0x98e6('0x37')],'context':_0x5b5460['context'],'exten':_0x5b5460[_0x98e6('0xa')],'priority':_0x5e9414[_0x98e6('0x33')][_0x98e6('0x31')]+_0x112535+_0x284f8b++,'VoiceExtensionId':_0x5b5460['id']});}_0x545796[_0x98e6('0x8')]({'type':_0x5e9414[_0x98e6('0x5')][_0x98e6('0x36')](),'app':_0x98e6('0x14'),'appdata':_0x98e6('0x39')+(_0x5e9414[_0x98e6('0x3a')]?'Set(CALLERID(all)='+_0x5e9414[_0x98e6('0x3a')]+')':'NoOp(No\x20number\x20available)'),'context':_0x5b5460[_0x98e6('0x6')],'exten':_0x5b5460[_0x98e6('0xa')],'priority':_0x5e9414[_0x98e6('0x33')][_0x98e6('0x31')]+_0x112535+_0x284f8b++,'VoiceExtensionId':_0x5b5460['id']});}else{if(_0x5e9414[_0x98e6('0x19')](_0x98e6('0x3b'))){if([_0x98e6('0x3c'),_0x98e6('0x3d')][_0x98e6('0x3e')](_0x5e9414[_0x98e6('0x3f')][_0x98e6('0x36')]())&&_0x5e9414[_0x98e6('0x40')]!=='custom'){if(_0x5e9414['answer']){_0x545796[_0x98e6('0x8')]({'type':_0x5e9414['type'][_0x98e6('0x36')](),'app':_0x98e6('0x14'),'appdata':_0x98e6('0x41'),'context':_0x5b5460[_0x98e6('0x6')],'exten':_0x5b5460[_0x98e6('0xa')],'priority':_0x5e9414[_0x98e6('0x33')][_0x98e6('0x31')]+_0x112535+_0x284f8b++,'VoiceExtensionId':_0x5b5460['id']});_0x545796[_0x98e6('0x8')]({'type':_0x5e9414[_0x98e6('0x5')]['toLowerCase'](),'app':_0x98e6('0x3'),'appdata':_0x98e6('0x42'),'context':_0x5b5460[_0x98e6('0x6')],'exten':_0x5b5460['exten'],'priority':_0x5e9414[_0x98e6('0x33')][_0x98e6('0x31')]+_0x112535+_0x284f8b++,'VoiceExtensionId':_0x5b5460['id']});}else{_0x545796[_0x98e6('0x8')]({'type':_0x5e9414[_0x98e6('0x5')]['toLowerCase'](),'app':_0x98e6('0x14'),'appdata':_0x98e6('0x43'),'context':_0x5b5460[_0x98e6('0x6')],'exten':_0x5b5460[_0x98e6('0xa')],'priority':_0x5e9414[_0x98e6('0x33')]['length']+_0x112535+_0x284f8b++,'VoiceExtensionId':_0x5b5460['id']});_0x545796['push']({'type':_0x5e9414['type'][_0x98e6('0x36')](),'app':_0x98e6('0x3'),'appdata':_0x98e6('0x44'),'context':_0x5b5460[_0x98e6('0x6')],'exten':_0x5b5460[_0x98e6('0xa')],'priority':_0x5e9414[_0x98e6('0x33')][_0x98e6('0x31')]+_0x112535+_0x284f8b++,'VoiceExtensionId':_0x5b5460['id']});}}}}for(var _0x18669f=0x0;_0x18669f<_0x5e9414[_0x98e6('0x33')]['length'];_0x18669f++){var _0x396cd9=_0x112535+_0x5e9414[_0x98e6('0x33')][_0x98e6('0x31')];var _0x480d1b=_0x18669f===_0x5e9414[_0x98e6('0x33')][_0x98e6('0x31')]-0x1?_0x112535+_0x545796[_0x98e6('0x31')]+_0xc4d87b[_0x98e6('0x31')]+0x2:_0x112535+_0x18669f+0x1;_0x545796['splice'](_0x18669f,0x0,{'type':_0x5b5460[_0x98e6('0x5')],'app':'GotoIfTime','appdata':_0x5e9414[_0x98e6('0x33')][_0x18669f]+'?'+_0x5b5460[_0x98e6('0x6')]+_0x98e6('0x45')+_0x396cd9+':'+_0x5b5460[_0x98e6('0x6')]+_0x98e6('0x45')+_0x480d1b,'exten':_0x5b5460['exten'],'context':_0x5b5460[_0x98e6('0x6')],'priority':_0x112535+_0x18669f,'VoiceExtensionId':_0x5b5460['id']});}if(_0x5e9414[_0x98e6('0x40')]===_0x98e6('0x46')){_0x5e9414[_0x98e6('0x47')]=_0x41f573(_0x5b5460,_0x5e9414[_0x98e6('0x47')]);}if(_0x5e9414[_0x98e6('0x40')]===_0x98e6('0x48')){_0x545796[_0x98e6('0x8')]({'type':_0x5e9414[_0x98e6('0x5')][_0x98e6('0x36')](),'app':_0x98e6('0x3'),'appdata':_0x98e6('0x49'),'context':_0x5b5460[_0x98e6('0x6')],'exten':_0x5b5460[_0x98e6('0xa')],'priority':_0x5e9414[_0x98e6('0x33')]['length']+_0x112535+_0x284f8b++,'VoiceExtensionId':_0x5b5460['id']});}_0x5e9414[_0x98e6('0x4a')]=_0x545796[_0x98e6('0x31')]?_['last'](_0x545796)[_0x98e6('0x4a')]+0x1:_0x112535;_0x28abf7=_[_0x98e6('0x4b')](_0x28abf7,_0x545796,[_0x5e9414],_0xc4d87b);_0x112535=_[_0x98e6('0x4c')](_0x28abf7)[_0x98e6('0x4a')]+0x1;}return _0x54a824(_0x28abf7);})[_0x98e6('0x4d')](function(_0x4b05aa){_0x4627a4(_0x4b05aa);});});}return _0x3ba70e[_0x98e6('0x4e')]('VoiceExtension',attributes,{'tableName':_0x98e6('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x11b0a8){var _0x47eac5=this['get']({'plain':!![]});var _0x149f8d=_0x47eac5[_0x98e6('0x5')]===_0x98e6('0xf')?_0x8a5291(_0x47eac5):_0x27e5d9(_0x47eac5);return _0x32d45a(_0x47eac5,_0x11b0a8,_[_0x98e6('0x4c')](_0x149f8d)[_0x98e6('0x4a')]+0x1)[_0x98e6('0x50')](function(_0x154a29){var _0x1bf6d2=_[_0x98e6('0x4b')](_0x149f8d,_0x154a29);_0x1bf6d2[_0x98e6('0x8')]({'type':_0x47eac5[_0x98e6('0x5')],'app':_0x98e6('0x51'),'exten':_0x47eac5[_0x98e6('0xa')],'context':_0x47eac5['context'],'priority':_['last'](_0x1bf6d2)[_0x98e6('0x4a')]+0x1,'VoiceExtensionId':_0x47eac5['id']});return _0x1bf6d2;});}}});}; \ No newline at end of file +var _0xd8aa=['then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','length','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','queue','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-ANSWER=0','context','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','timeout','options','url','split','name','trunk','phone','param','prefix','${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval'];(function(_0x407de4,_0x39b031){var _0x49b3a5=function(_0x10ea52){while(--_0x10ea52){_0x407de4['push'](_0x407de4['shift']());}};_0x49b3a5(++_0x39b031);}(_0xd8aa,0x77));var _0xad8a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd8aa[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xad8a('0x0'));var attributes=require(_0xad8a('0x1'));module[_0xad8a('0x2')]=function(_0x4adbdc){var _0x4bafdd=_0x4adbdc[_0xad8a('0x3')];function _0x562aad(_0x35be75){var _0x305876=0x2;var _0x1ae1d3=[{'type':_0x35be75[_0xad8a('0x4')],'app':_0xad8a('0x5'),'appdata':_0xad8a('0x6')+_0x35be75[_0xad8a('0x4')],'context':_0x35be75['context'],'exten':_0x35be75['exten'],'priority':_0x305876++,'VoiceExtensionId':_0x35be75['id']}];if(_0x35be75['type']===_0xad8a('0x7')){_0x1ae1d3[_0xad8a('0x8')]({'type':_0xad8a('0x7'),'app':_0xad8a('0x5'),'appdata':_0xad8a('0x9')+_0x35be75['id'],'context':_0x35be75['context'],'exten':_0x35be75[_0xad8a('0xa')],'priority':_0x305876++,'VoiceExtensionId':_0x35be75['id']});}_0x1ae1d3[_0xad8a('0x8')]({'type':_0x35be75[_0xad8a('0x4')],'app':'Set','appdata':_0xad8a('0xb'),'context':_0x35be75[_0xad8a('0xc')],'exten':_0x35be75[_0xad8a('0xa')],'priority':_0x305876++,'VoiceExtensionId':_0x35be75['id']},{'type':_0x35be75[_0xad8a('0x4')],'app':_0xad8a('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x35be75[_0xad8a('0xc')],'exten':_0x35be75[_0xad8a('0xa')],'priority':_0x305876++,'VoiceExtensionId':_0x35be75['id']},{'type':_0x35be75['type'],'app':_0xad8a('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x35be75[_0xad8a('0xc')],'exten':_0x35be75[_0xad8a('0xa')],'priority':_0x305876++,'VoiceExtensionId':_0x35be75['id']});return _0x1ae1d3;}function _0x4d73eb(_0x270e76){var _0x36675a=0x2;var _0x27ebee=[{'type':_0xad8a('0xd'),'app':_0xad8a('0x5'),'appdata':_0xad8a('0xe'),'context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76['exten'],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':_0xad8a('0xd'),'app':'Set','appdata':_0xad8a('0xf')+(_0x270e76['cutdigits']?_0xad8a('0x10')+_0x270e76[_0xad8a('0x11')]+'}':'${EXTEN}'),'context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':'outbound','app':_0xad8a('0x5'),'appdata':_0xad8a('0x9')+_0x270e76['id'],'context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':_0xad8a('0xd'),'app':'ExecIf','appdata':_0xad8a('0x12')+(_0x36675a+0x2)+'):Goto('+(_0x36675a+0x1)+')','context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':'outbound','app':_0xad8a('0x5'),'appdata':_0x270e76[_0xad8a('0x11')]?_0xad8a('0x13')+_0x270e76[_0xad8a('0x11')]+'}':_0xad8a('0x14'),'context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':_0xad8a('0xd'),'app':_0xad8a('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x270e76['context'],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':_0xad8a('0xd'),'app':_0xad8a('0x5'),'appdata':_0xad8a('0x15'),'context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':_0xad8a('0xd'),'app':_0xad8a('0x5'),'appdata':_0xad8a('0x16'),'context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':_0xad8a('0xd'),'app':_0xad8a('0x5'),'appdata':_0xad8a('0x17')+_0x270e76['id'],'context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']}];if(_0x270e76[_0xad8a('0x18')](_0xad8a('0x19'))&&_0x270e76[_0xad8a('0x19')]!==_0xad8a('0x1a')){_0x27ebee[_0xad8a('0x8')]({'type':'outbound','app':_0xad8a('0x5'),'appdata':_0xad8a('0x1b'),'context':_0x270e76['context'],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']},{'type':_0xad8a('0xd'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x270e76[_0xad8a('0x19')]||_0xad8a('0x1c'),'context':_0x270e76[_0xad8a('0xc')],'exten':_0x270e76[_0xad8a('0xa')],'priority':_0x36675a++,'VoiceExtensionId':_0x270e76['id']});}return _0x27ebee;}function _0x3f0a01(_0x19244f,_0x51f4e3){var _0x37c643=[{'name':'trunk','param':0x0},{'name':_0xad8a('0x1d'),'param':0x1},{'name':_0xad8a('0x1e'),'param':0x2},{'name':_0xad8a('0x1f'),'param':0x3}];var _0x3f451b={};var _0x2d0785=_0x51f4e3[_0xad8a('0x20')](',');var _0x4a50a8=[];for(var _0x112061=0x0;_0x112061<_0x37c643['length'];_0x112061++){switch(_0x37c643[_0x112061][_0xad8a('0x21')]){case'trunk':_0x3f451b[_0xad8a('0x22')]=_0x2d0785[_0x37c643[_0x112061]['param']][_0xad8a('0x20')]('/')[0x1];_0x3f451b[_0xad8a('0x23')]=_0x2d0785[_0x37c643[_0x112061][_0xad8a('0x24')]]['split']('/')[0x2];_0x3f451b[_0xad8a('0x25')]=_0x3f451b[_0xad8a('0x23')]?_0x3f451b[_0xad8a('0x23')][_0xad8a('0x20')]('$')[0x0]:undefined;_0x3f451b[_0xad8a('0x23')]=_0x19244f['cutdigits']?(_0x3f451b[_0xad8a('0x25')]||'')+_0xad8a('0x10')+_0x19244f[_0xad8a('0x11')]+'}':(_0x3f451b[_0xad8a('0x25')]||'')+_0xad8a('0x26');_0x4a50a8[_0x37c643[_0x112061][_0xad8a('0x24')]]=[_0xad8a('0x27'),_0x3f451b[_0xad8a('0x22')],_0x3f451b[_0xad8a('0x23')]][_0xad8a('0x28')]('/');break;case _0xad8a('0x1e'):_0x3f451b['options']=_0x2d0785[_0x37c643[_0x112061][_0xad8a('0x24')]];if(_0x19244f[_0xad8a('0x19')]!==_0xad8a('0x1a')){if(_0x3f451b['options'][_0xad8a('0x29')](_0xad8a('0x2a'))<0x0){_0x3f451b[_0xad8a('0x1e')]+=_0xad8a('0x2a');}}else{_0x3f451b['options']=_0x3f451b[_0xad8a('0x1e')]['replace'](_0xad8a('0x2a'),'');}_0x4a50a8[_0x37c643[_0x112061][_0xad8a('0x24')]]=_0x3f451b['options'];break;default:_0x4a50a8[_0x37c643[_0x112061][_0xad8a('0x24')]]=_0x2d0785[_0x37c643[_0x112061][_0xad8a('0x24')]];}}return _0x4a50a8[_0xad8a('0x28')](',');}function _0x244397(_0x4ac747,_0xcd706c,_0xd80e06){return new Promise(function(_0x5a992a,_0x274163){var _0x42d1c9=[];if(_[_0xad8a('0x2b')](_0xcd706c))return _0x5a992a(_0x42d1c9);_0x4bafdd[_0xad8a('0x2c')][_0xad8a('0x2d')]({'attributes':['id',_0xad8a('0x2e'),'IntervalId'],'raw':!![]})[_0xad8a('0x2f')](function(_0x6e8c88){for(var _0x1c9b04=0x0,_0x2ca99f=0x0;_0x1c9b04<_0xcd706c['length'];_0x1c9b04++,_0x2ca99f=0x0){var _0x141180=_0xcd706c[_0x1c9b04];var _0x3de7c4=[];var _0x3ee73c=[];delete _0x141180['id'];if(_0x141180[_0xad8a('0x2e')]!==_0xad8a('0x30')){_0x141180[_0xad8a('0x31')]=[_0x141180[_0xad8a('0x2e')]];}else{_0x141180[_0xad8a('0x31')]=_0x141180[_0xad8a('0x32')]?_[_0xad8a('0x33')](_[_0xad8a('0x34')](_0x6e8c88,{'IntervalId':_0x141180[_0xad8a('0x32')]}),_0xad8a('0x2e')):[];}_0x141180[_0xad8a('0xc')]=_0x4ac747[_0xad8a('0xc')];_0x141180['exten']=_0x4ac747[_0xad8a('0xa')];if(_0x141180[_0xad8a('0x4')])_0x141180[_0xad8a('0x4')]=_0x141180[_0xad8a('0x4')][_0xad8a('0x35')]();if(_0x4ac747[_0xad8a('0x4')]==='outbound'){if(_0x141180['hasOwnProperty'](_0xad8a('0x36'))&&_0x141180['tag']&&_0x141180[_0xad8a('0x36')]!=='--'){_0x3de7c4[_0xad8a('0x8')]({'type':_0x141180[_0xad8a('0x4')]['toLowerCase'](),'app':_0xad8a('0x5'),'appdata':_0xad8a('0x37')+_0x141180[_0xad8a('0x36')],'context':_0x4ac747[_0xad8a('0xc')],'exten':_0x4ac747['exten'],'priority':_0x141180['intervals'][_0xad8a('0x38')]+_0xd80e06+_0x2ca99f++,'VoiceExtensionId':_0x4ac747['id']});}_0x3de7c4[_0xad8a('0x8')]({'type':_0x141180[_0xad8a('0x4')][_0xad8a('0x35')](),'app':_0xad8a('0x39'),'appdata':_0xad8a('0x3a')+(_0x141180[_0xad8a('0x3b')]?'Set(CALLERID(all)='+_0x141180[_0xad8a('0x3b')]+')':'NoOp(No\x20number\x20available)'),'context':_0x4ac747[_0xad8a('0xc')],'exten':_0x4ac747[_0xad8a('0xa')],'priority':_0x141180[_0xad8a('0x31')][_0xad8a('0x38')]+_0xd80e06+_0x2ca99f++,'VoiceExtensionId':_0x4ac747['id']});}else{if(_0x141180['hasOwnProperty']('answer')){if([_0xad8a('0x3c'),'playback'][_0xad8a('0x3d')](_0x141180[_0xad8a('0x3e')][_0xad8a('0x35')]())&&_0x141180[_0xad8a('0x3f')]!==_0xad8a('0x40')){if(_0x141180[_0xad8a('0x41')]){_0x3de7c4[_0xad8a('0x8')]({'type':_0x141180[_0xad8a('0x4')]['toLowerCase'](),'app':_0xad8a('0x39'),'appdata':_0xad8a('0x42'),'context':_0x4ac747[_0xad8a('0xc')],'exten':_0x4ac747['exten'],'priority':_0x141180[_0xad8a('0x31')][_0xad8a('0x38')]+_0xd80e06+_0x2ca99f++,'VoiceExtensionId':_0x4ac747['id']});_0x3de7c4[_0xad8a('0x8')]({'type':_0x141180[_0xad8a('0x4')]['toLowerCase'](),'app':_0xad8a('0x5'),'appdata':_0xad8a('0x43'),'context':_0x4ac747[_0xad8a('0xc')],'exten':_0x4ac747[_0xad8a('0xa')],'priority':_0x141180[_0xad8a('0x31')][_0xad8a('0x38')]+_0xd80e06+_0x2ca99f++,'VoiceExtensionId':_0x4ac747['id']});}else{_0x3de7c4[_0xad8a('0x8')]({'type':_0x141180[_0xad8a('0x4')][_0xad8a('0x35')](),'app':_0xad8a('0x39'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4ac747[_0xad8a('0xc')],'exten':_0x4ac747[_0xad8a('0xa')],'priority':_0x141180[_0xad8a('0x31')][_0xad8a('0x38')]+_0xd80e06+_0x2ca99f++,'VoiceExtensionId':_0x4ac747['id']});_0x3de7c4[_0xad8a('0x8')]({'type':_0x141180[_0xad8a('0x4')][_0xad8a('0x35')](),'app':_0xad8a('0x5'),'appdata':_0xad8a('0x44'),'context':_0x4ac747[_0xad8a('0xc')],'exten':_0x4ac747[_0xad8a('0xa')],'priority':_0x141180[_0xad8a('0x31')][_0xad8a('0x38')]+_0xd80e06+_0x2ca99f++,'VoiceExtensionId':_0x4ac747['id']});}}}}for(var _0x4dac2d=0x0;_0x4dac2d<_0x141180[_0xad8a('0x31')][_0xad8a('0x38')];_0x4dac2d++){var _0x39a024=_0xd80e06+_0x141180[_0xad8a('0x31')][_0xad8a('0x38')];var _0xe4675e=_0x4dac2d===_0x141180[_0xad8a('0x31')][_0xad8a('0x38')]-0x1?_0xd80e06+_0x3de7c4[_0xad8a('0x38')]+_0x3ee73c[_0xad8a('0x38')]+0x2:_0xd80e06+_0x4dac2d+0x1;_0x3de7c4['splice'](_0x4dac2d,0x0,{'type':_0x4ac747['type'],'app':'GotoIfTime','appdata':_0x141180[_0xad8a('0x31')][_0x4dac2d]+'?'+_0x4ac747['context']+_0xad8a('0x45')+_0x39a024+':'+_0x4ac747[_0xad8a('0xc')]+',${EXTEN},'+_0xe4675e,'exten':_0x4ac747[_0xad8a('0xa')],'context':_0x4ac747[_0xad8a('0xc')],'priority':_0xd80e06+_0x4dac2d,'VoiceExtensionId':_0x4ac747['id']});}if(_0x141180[_0xad8a('0x3f')]===_0xad8a('0x46')){_0x141180['appdata']=_0x3f0a01(_0x4ac747,_0x141180[_0xad8a('0x47')]);}if(_0x141180['appType']===_0xad8a('0x48')){_0x3de7c4[_0xad8a('0x8')]({'type':_0x141180[_0xad8a('0x4')][_0xad8a('0x35')](),'app':'Set','appdata':_0xad8a('0x49'),'context':_0x4ac747[_0xad8a('0xc')],'exten':_0x4ac747[_0xad8a('0xa')],'priority':_0x141180[_0xad8a('0x31')][_0xad8a('0x38')]+_0xd80e06+_0x2ca99f++,'VoiceExtensionId':_0x4ac747['id']});}_0x141180[_0xad8a('0x4a')]=_0x3de7c4[_0xad8a('0x38')]?_[_0xad8a('0x4b')](_0x3de7c4)[_0xad8a('0x4a')]+0x1:_0xd80e06;_0x42d1c9=_[_0xad8a('0x4c')](_0x42d1c9,_0x3de7c4,[_0x141180],_0x3ee73c);_0xd80e06=_[_0xad8a('0x4b')](_0x42d1c9)[_0xad8a('0x4a')]+0x1;}return _0x5a992a(_0x42d1c9);})[_0xad8a('0x4d')](function(_0x3d85c1){_0x274163(_0x3d85c1);});});}return _0x4adbdc[_0xad8a('0x4e')](_0xad8a('0x4f'),attributes,{'tableName':_0xad8a('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x521a04){var _0x242174=this[_0xad8a('0x51')]({'plain':!![]});var _0x2d02ae=_0x242174[_0xad8a('0x4')]===_0xad8a('0xd')?_0x4d73eb(_0x242174):_0x562aad(_0x242174);return _0x244397(_0x242174,_0x521a04,_[_0xad8a('0x4b')](_0x2d02ae)[_0xad8a('0x4a')]+0x1)[_0xad8a('0x2f')](function(_0x4c886c){var _0x2268a0=_[_0xad8a('0x4c')](_0x2d02ae,_0x4c886c);_0x2268a0[_0xad8a('0x8')]({'type':_0x242174[_0xad8a('0x4')],'app':_0xad8a('0x52'),'exten':_0x242174[_0xad8a('0xa')],'context':_0x242174[_0xad8a('0xc')],'priority':_['last'](_0x2268a0)['priority']+0x1,'VoiceExtensionId':_0x242174['id']});return _0x2268a0;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index ddf47a5..746a548 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 _0x7ed1=['where','attributes','limit','map','include','model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceExtension','findAll','options','raw'];(function(_0x8b0f43,_0x1c57b8){var _0x3f4425=function(_0x16e59a){while(--_0x16e59a){_0x8b0f43['push'](_0x8b0f43['shift']());}};_0x3f4425(++_0x1c57b8);}(_0x7ed1,0xca));var _0x17ed=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7ed1[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x17ed('0x0'));var util=require('util');var moment=require(_0x17ed('0x1'));var BPromise=require(_0x17ed('0x2'));var rs=require(_0x17ed('0x3'));var fs=require('fs');var Redis=require(_0x17ed('0x4'));var db=require(_0x17ed('0x5'))['db'];var utils=require(_0x17ed('0x6'));var logger=require('../../config/logger')(_0x17ed('0x7'));var config=require(_0x17ed('0x8'));var jayson=require(_0x17ed('0x9'));var client=jayson[_0x17ed('0xa')]['http']({'port':0x232a});config['redis']=_[_0x17ed('0xb')](config[_0x17ed('0xc')],{'host':_0x17ed('0xd'),'port':0x18eb});var socket=require(_0x17ed('0xe'))(new Redis(config['redis']));require(_0x17ed('0xf'))[_0x17ed('0x10')](socket);function respondWithRpcPromise(_0x25cd40,_0x415d22,_0x29c926){return new BPromise(function(_0x1d50b0,_0x59a471){return client[_0x17ed('0x11')](_0x25cd40,_0x29c926)['then'](function(_0x4c8f8e){logger[_0x17ed('0x12')](_0x17ed('0x13'),_0x415d22,_0x17ed('0x14'));logger[_0x17ed('0x15')](_0x17ed('0x16'),_0x415d22,'request\x20sent',JSON[_0x17ed('0x17')](_0x4c8f8e));if(_0x4c8f8e[_0x17ed('0x18')]){if(_0x4c8f8e[_0x17ed('0x18')]['code']===0x1f4){logger[_0x17ed('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x415d22,_0x4c8f8e['error'][_0x17ed('0x19')]);return _0x59a471(_0x4c8f8e['error'][_0x17ed('0x19')]);}logger[_0x17ed('0x18')](_0x17ed('0x13'),_0x415d22,_0x4c8f8e[_0x17ed('0x18')]['message']);return _0x1d50b0(_0x4c8f8e[_0x17ed('0x18')][_0x17ed('0x19')]);}else{logger[_0x17ed('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x415d22,'request\x20sent');_0x1d50b0(_0x4c8f8e[_0x17ed('0x1a')][_0x17ed('0x19')]);}})[_0x17ed('0x1b')](function(_0x22e43d){logger[_0x17ed('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x415d22,_0x22e43d);_0x59a471(_0x22e43d);});});}exports[_0x17ed('0x1c')]=function(_0x3dc4cb){var _0x4d51b6=this;return new Promise(function(_0x2cac50,_0x3368aa){return db['VoiceExtension'][_0x17ed('0x1d')]({'raw':_0x3dc4cb[_0x17ed('0x1e')]?_0x3dc4cb[_0x17ed('0x1e')][_0x17ed('0x1f')]===undefined?!![]:![]:!![],'where':_0x3dc4cb[_0x17ed('0x1e')]?_0x3dc4cb[_0x17ed('0x1e')][_0x17ed('0x20')]||null:null,'attributes':_0x3dc4cb['options']?_0x3dc4cb[_0x17ed('0x1e')][_0x17ed('0x21')]||null:null,'limit':_0x3dc4cb['options']?_0x3dc4cb['options'][_0x17ed('0x22')]||null:null,'include':_0x3dc4cb['options']?_0x3dc4cb['options']['include']?_[_0x17ed('0x23')](_0x3dc4cb['options'][_0x17ed('0x24')],function(_0x225721){return{'model':db[_0x225721[_0x17ed('0x25')]],'as':_0x225721['as'],'attributes':_0x225721['attributes'],'include':_0x225721[_0x17ed('0x24')]?_[_0x17ed('0x23')](_0x225721[_0x17ed('0x24')],function(_0x4d1de9){return{'model':db[_0x4d1de9['model']],'as':_0x4d1de9['as'],'attributes':_0x4d1de9[_0x17ed('0x21')],'include':_0x4d1de9[_0x17ed('0x24')]?_[_0x17ed('0x23')](_0x4d1de9['include'],function(_0x38bb50){return{'model':db[_0x38bb50[_0x17ed('0x25')]],'as':_0x38bb50['as'],'attributes':_0x38bb50[_0x17ed('0x21')]};}):[]};}):[]};}):[]:[]})[_0x17ed('0x26')](function(_0x52db34){logger[_0x17ed('0x12')](_0x17ed('0x1c'),_0x3dc4cb);logger['debug'](_0x17ed('0x1c'),_0x3dc4cb,JSON[_0x17ed('0x17')](_0x52db34));_0x2cac50(_0x52db34);})[_0x17ed('0x1b')](function(_0x529966){logger[_0x17ed('0x18')](_0x17ed('0x1c'),_0x529966[_0x17ed('0x19')],_0x3dc4cb);_0x3368aa(_0x4d51b6[_0x17ed('0x18')](0x1f4,_0x529966['message']));});});}; \ No newline at end of file +var _0xdfe7=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetVoiceExtension','findAll','options','attributes','include','map','model','debug','stringify','catch','util','moment','randomstring','ioredis'];(function(_0x42c14e,_0x502a16){var _0x3c2e7a=function(_0x5e88f7){while(--_0x5e88f7){_0x42c14e['push'](_0x42c14e['shift']());}};_0x3c2e7a(++_0x502a16);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x22419c,_0x462996){_0x22419c=_0x22419c-0x0;var _0x16e2ba=_0xdfe7[_0x22419c];return _0x16e2ba;};'use strict';var _=require('lodash');var util=require(_0x7dfe('0x0'));var moment=require(_0x7dfe('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dfe('0x2'));var fs=require('fs');var Redis=require(_0x7dfe('0x3'));var db=require(_0x7dfe('0x4'))['db'];var utils=require(_0x7dfe('0x5'));var logger=require('../../config/logger')(_0x7dfe('0x6'));var config=require(_0x7dfe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7dfe('0x8')][_0x7dfe('0x9')]({'port':0x232a});config[_0x7dfe('0xa')]=_[_0x7dfe('0xb')](config['redis'],{'host':_0x7dfe('0xc'),'port':0x18eb});var socket=require(_0x7dfe('0xd'))(new Redis(config[_0x7dfe('0xa')]));require(_0x7dfe('0xe'))['register'](socket);function respondWithRpcPromise(_0x3d875d,_0x398f92,_0x2a9fd2){return new BPromise(function(_0x34d85d,_0x5cdb37){return client['request'](_0x3d875d,_0x2a9fd2)[_0x7dfe('0xf')](function(_0xe6249b){logger[_0x7dfe('0x10')](_0x7dfe('0x11'),_0x398f92,'request\x20sent');logger['debug'](_0x7dfe('0x12'),_0x398f92,'request\x20sent',JSON['stringify'](_0xe6249b));if(_0xe6249b[_0x7dfe('0x13')]){if(_0xe6249b['error'][_0x7dfe('0x14')]===0x1f4){logger[_0x7dfe('0x13')](_0x7dfe('0x11'),_0x398f92,_0xe6249b['error'][_0x7dfe('0x15')]);return _0x5cdb37(_0xe6249b[_0x7dfe('0x13')][_0x7dfe('0x15')]);}logger[_0x7dfe('0x13')](_0x7dfe('0x11'),_0x398f92,_0xe6249b[_0x7dfe('0x13')][_0x7dfe('0x15')]);return _0x34d85d(_0xe6249b[_0x7dfe('0x13')][_0x7dfe('0x15')]);}else{logger[_0x7dfe('0x10')](_0x7dfe('0x11'),_0x398f92,_0x7dfe('0x16'));_0x34d85d(_0xe6249b[_0x7dfe('0x17')]['message']);}})['catch'](function(_0x2ab297){logger[_0x7dfe('0x13')](_0x7dfe('0x11'),_0x398f92,_0x2ab297);_0x5cdb37(_0x2ab297);});});}exports[_0x7dfe('0x18')]=function(_0xc9eefa){var _0x1ed7ba=this;return new Promise(function(_0x20849f,_0x3bc56d){return db['VoiceExtension'][_0x7dfe('0x19')]({'raw':_0xc9eefa[_0x7dfe('0x1a')]?_0xc9eefa[_0x7dfe('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xc9eefa[_0x7dfe('0x1a')]?_0xc9eefa[_0x7dfe('0x1a')]['where']||null:null,'attributes':_0xc9eefa[_0x7dfe('0x1a')]?_0xc9eefa[_0x7dfe('0x1a')][_0x7dfe('0x1b')]||null:null,'limit':_0xc9eefa['options']?_0xc9eefa[_0x7dfe('0x1a')]['limit']||null:null,'include':_0xc9eefa[_0x7dfe('0x1a')]?_0xc9eefa[_0x7dfe('0x1a')][_0x7dfe('0x1c')]?_[_0x7dfe('0x1d')](_0xc9eefa[_0x7dfe('0x1a')][_0x7dfe('0x1c')],function(_0x3f6571){return{'model':db[_0x3f6571[_0x7dfe('0x1e')]],'as':_0x3f6571['as'],'attributes':_0x3f6571[_0x7dfe('0x1b')],'include':_0x3f6571[_0x7dfe('0x1c')]?_[_0x7dfe('0x1d')](_0x3f6571['include'],function(_0x59da37){return{'model':db[_0x59da37[_0x7dfe('0x1e')]],'as':_0x59da37['as'],'attributes':_0x59da37[_0x7dfe('0x1b')],'include':_0x59da37[_0x7dfe('0x1c')]?_[_0x7dfe('0x1d')](_0x59da37['include'],function(_0x908aa4){return{'model':db[_0x908aa4[_0x7dfe('0x1e')]],'as':_0x908aa4['as'],'attributes':_0x908aa4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7dfe('0xf')](function(_0x10aaa1){logger[_0x7dfe('0x10')](_0x7dfe('0x18'),_0xc9eefa);logger[_0x7dfe('0x1f')](_0x7dfe('0x18'),_0xc9eefa,JSON[_0x7dfe('0x20')](_0x10aaa1));_0x20849f(_0x10aaa1);})[_0x7dfe('0x21')](function(_0x37bb83){logger[_0x7dfe('0x13')]('GetVoiceExtension',_0x37bb83['message'],_0xc9eefa);_0x3bc56d(_0x1ed7ba['error'](0x1f4,_0x37bb83[_0x7dfe('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 3070b4f..a35f780 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x268c2f,_0x16bb95){var _0x59afce=function(_0x157972){while(--_0x157972){_0x268c2f['push'](_0x268c2f['shift']());}};_0x59afce(++_0x16bb95);}(_0xe14b,0x93));var _0xbe14=function(_0x407592,_0xcb7e43){_0x407592=_0x407592-0x0;var _0x2298a8=_0xe14b[_0x407592];return _0x2298a8;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x58ca15,_0x4c03d7){var _0x67d3a0=function(_0x463455){while(--_0x463455){_0x58ca15['push'](_0x58ca15['shift']());}};_0x67d3a0(++_0x4c03d7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0x5fc3[_0x58999b];return _0x5efc3a;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index e054acf..4a73972 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 _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update'];(function(_0x47c902,_0x220fd2){var _0x1ad6a0=function(_0xf9fdb0){while(--_0xf9fdb0){_0x47c902['push'](_0x47c902['shift']());}};_0x1ad6a0(++_0x220fd2);}(_0xadb5,0xad));var _0x5adb=function(_0x3aebe7,_0x209cd4){_0x3aebe7=_0x3aebe7-0x0;var _0x3b4782=_0xadb5[_0x3aebe7];return _0x3b4782;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./voiceMail.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file +var _0x0120=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','update','delete'];(function(_0x4a0f40,_0x35720e){var _0x9865a3=function(_0x5c4b19){while(--_0x5c4b19){_0x4a0f40['push'](_0x4a0f40['shift']());}};_0x9865a3(++_0x35720e);}(_0x0120,0x6f));var _0x0012=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0120[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var path=require(_0x0012('0x2'));var timeout=require(_0x0012('0x3'));var express=require(_0x0012('0x4'));var router=express[_0x0012('0x5')]();var fs_extra=require(_0x0012('0x6'));var auth=require(_0x0012('0x7'));var interaction=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var controller=require(_0x0012('0xa'));router[_0x0012('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0012('0xc'),auth[_0x0012('0xd')](),controller[_0x0012('0xe')]);router[_0x0012('0xb')](_0x0012('0xf'),auth['isAuthenticated'](),controller[_0x0012('0x10')]);router[_0x0012('0x11')]('/',auth[_0x0012('0xd')](),controller[_0x0012('0x12')]);router['put'](_0x0012('0xc'),auth['isAuthenticated'](),controller[_0x0012('0x13')]);router[_0x0012('0x14')](_0x0012('0xc'),auth[_0x0012('0xd')](),controller[_0x0012('0x15')]);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 6d0c2a8..76facf4 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 _0xdcd7=['string','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox','email'];(function(_0x3f4bef,_0x359a87){var _0x1989b7=function(_0xe0ffca){while(--_0xe0ffca){_0x3f4bef['push'](_0x3f4bef['shift']());}};_0x1989b7(++_0x359a87);}(_0xdcd7,0x16b));var _0x7dcd=function(_0x3be603,_0x5f139c){_0x3be603=_0x3be603-0x0;var _0x221620=_0xdcd7[_0x3be603];return _0x221620;};'use strict';var Sequelize=require(_0x7dcd('0x0'));module[_0x7dcd('0x1')]={'customer_id':{'type':Sequelize[_0x7dcd('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x7dcd('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7dcd('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7dcd('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58b9cd){this['setDataValue'](_0x7dcd('0x4'),typeof _0x58b9cd===_0x7dcd('0x5')&&_0x58b9cd[_0x7dcd('0x6')]()?_0x58b9cd[_0x7dcd('0x6')]():null);}},'pager':{'type':Sequelize[_0x7dcd('0x2')]},'tz':{'type':Sequelize[_0x7dcd('0x2')],'defaultValue':_0x7dcd('0x7')},'attach':{'type':Sequelize['ENUM'](_0x7dcd('0x8'),'no'),'defaultValue':_0x7dcd('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7dcd('0x9')]('yes','no'),'defaultValue':_0x7dcd('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x7dcd('0x2')]},'review':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7dcd('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7dcd('0x9')](_0x7dcd('0x8'),'no'),'defaultValue':_0x7dcd('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x7dcd('0x2')]},'emailbody':{'type':Sequelize[_0x7dcd('0x2')]},'maxsecs':{'type':Sequelize[_0x7dcd('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7dcd('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7dcd('0xc')],'get':function(){return this['getDataValue']('fullname')+_0x7dcd('0xd')+this[_0x7dcd('0xe')](_0x7dcd('0xf'));}}}; \ No newline at end of file +var _0xc4dc=['fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','getDataValue'];(function(_0xb92fbb,_0x3d8312){var _0x422eb8=function(_0x3ef3e8){while(--_0x3ef3e8){_0xb92fbb['push'](_0xb92fbb['shift']());}};_0x422eb8(++_0x3d8312);}(_0xc4dc,0x1f3));var _0xcc4d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc4dc[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xcc4d('0x0'));module[_0xcc4d('0x1')]={'customer_id':{'type':Sequelize[_0xcc4d('0x2')]},'context':{'type':Sequelize[_0xcc4d('0x2')],'defaultValue':_0xcc4d('0x3'),'unique':_0xcc4d('0x4')},'mailbox':{'type':Sequelize[_0xcc4d('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xcc4d('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x50e701){this[_0xcc4d('0x5')](_0xcc4d('0x6'),typeof _0x50e701===_0xcc4d('0x7')&&_0x50e701['trim']()?_0x50e701[_0xcc4d('0x8')]():null);}},'pager':{'type':Sequelize[_0xcc4d('0x2')]},'tz':{'type':Sequelize[_0xcc4d('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xcc4d('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xcc4d('0x9')](_0xcc4d('0xa'),'no'),'defaultValue':_0xcc4d('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xcc4d('0x2')]},'callback':{'type':Sequelize[_0xcc4d('0x2')]},'review':{'type':Sequelize[_0xcc4d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xcc4d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xcc4d('0x9')](_0xcc4d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xcc4d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xcc4d('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xcc4d('0x9')](_0xcc4d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xcc4d('0x9')](_0xcc4d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xcc4d('0xa'),'no'),'defaultValue':_0xcc4d('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xcc4d('0x9')](_0xcc4d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xcc4d('0x9')](_0xcc4d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xcc4d('0x9')](_0xcc4d('0xa'),'no'),'defaultValue':_0xcc4d('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xcc4d('0x2')]},'emailbody':{'type':Sequelize[_0xcc4d('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xcc4d('0xc')](_0xcc4d('0xd'))+_0xcc4d('0xe')+this[_0xcc4d('0xc')](_0xcc4d('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 62c1708..8ed069b 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 _0x0972=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','Voicemails','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','length','options'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x0972,0x64));var _0x2097=function(_0x3025c9,_0x3f3f2a){_0x3025c9=_0x3025c9-0x0;var _0x5082f5=_0x0972[_0x3025c9];return _0x5082f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];function respondWithStatusCode(_0x3b2f94,_0x170005){_0x170005=_0x170005||0xcc;return function(_0x16871b){if(_0x16871b){return _0x3b2f94[_0x2097('0x1a')](_0x170005);}return _0x3b2f94[_0x2097('0x1b')](_0x170005)[_0x2097('0x1c')]();};}function respondWithResult(_0x1c9ef9,_0x2c3e41){_0x2c3e41=_0x2c3e41||0xc8;return function(_0x354387){if(_0x354387){return _0x1c9ef9['status'](_0x2c3e41)[_0x2097('0x1d')](_0x354387);}};}function respondWithFilteredResult(_0x35c062,_0x4d31bc){return function(_0x4eec05){if(_0x4eec05){var _0x4fc8c5=typeof _0x4d31bc[_0x2097('0x1e')]==='undefined'&&typeof _0x4d31bc[_0x2097('0x1f')]===_0x2097('0x20');var _0x43fec9=_0x4eec05[_0x2097('0x21')];var _0x44c584=_0x4fc8c5?0x0:_0x4d31bc['offset'];var _0x324652=_0x4fc8c5?_0x4eec05[_0x2097('0x21')]:_0x4d31bc[_0x2097('0x1e')]+_0x4d31bc[_0x2097('0x1f')];var _0x1d3804;if(_0x324652>=_0x43fec9){_0x324652=_0x43fec9;_0x1d3804=0xc8;}else{_0x1d3804=0xce;}_0x35c062[_0x2097('0x1b')](_0x1d3804);return _0x35c062[_0x2097('0x22')](_0x2097('0x23'),_0x44c584+'-'+_0x324652+'/'+_0x43fec9)['json'](_0x4eec05);}return null;};}function patchUpdates(_0x4d957e){return function(_0xf65dc6){try{jsonpatch['apply'](_0xf65dc6,_0x4d957e,!![]);}catch(_0x227c00){return BPromise[_0x2097('0x24')](_0x227c00);}return _0xf65dc6['save']();};}function saveUpdates(_0x442db7,_0x5b0582){return function(_0x2e17c8){if(_0x2e17c8){return _0x2e17c8[_0x2097('0x25')](_0x442db7)[_0x2097('0x26')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x36b15e,_0x35047b){return function(_0x56390a){if(_0x56390a){return _0x56390a[_0x2097('0x27')]()['then'](function(){var _0x3f9279=_0x56390a[_0x2097('0x28')]({'plain':!![]});var _0x345875=_0x2097('0x29');return db['UserProfileResource'][_0x2097('0x27')]({'where':{'type':_0x345875,'resourceId':_0x3f9279['id']}})[_0x2097('0x26')](function(){return _0x56390a;});})['then'](function(){_0x36b15e[_0x2097('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b879,_0x48ae06){return function(_0xbc0339){if(!_0xbc0339){_0x29b879[_0x2097('0x1a')](0x194);}return _0xbc0339;};}function handleError(_0x407a2a,_0x7eefb4){_0x7eefb4=_0x7eefb4||0x1f4;return function(_0x410afa){logger[_0x2097('0x2a')](_0x410afa[_0x2097('0x2b')]);if(_0x410afa['name']){delete _0x410afa[_0x2097('0x2c')];}_0x407a2a[_0x2097('0x1b')](_0x7eefb4)['send'](_0x410afa);};}exports[_0x2097('0x2d')]=function(_0x41487d,_0x59fb84){var _0x4d0916={},_0x312c77={},_0x11b051={'count':0x0,'rows':[]};var _0x1649c8=_[_0x2097('0x2e')](db[_0x2097('0x2f')][_0x2097('0x30')],function(_0x56c538){return{'name':_0x56c538[_0x2097('0x31')],'type':_0x56c538['type'][_0x2097('0x32')]};});_0x312c77[_0x2097('0x33')]=_[_0x2097('0x2e')](_0x1649c8,_0x2097('0x2c'));_0x312c77[_0x2097('0x34')]=_[_0x2097('0x35')](_0x41487d[_0x2097('0x34')]);_0x312c77[_0x2097('0x36')]=_[_0x2097('0x37')](_0x312c77['model'],_0x312c77[_0x2097('0x34')]);_0x4d0916[_0x2097('0x38')]=_[_0x2097('0x37')](_0x312c77['model'],qs[_0x2097('0x39')](_0x41487d[_0x2097('0x34')][_0x2097('0x39')]));_0x4d0916[_0x2097('0x38')]=_0x4d0916['attributes']['length']?_0x4d0916['attributes']:_0x312c77[_0x2097('0x33')];if(!_0x41487d[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x4d0916[_0x2097('0x1f')]=qs[_0x2097('0x1f')](_0x41487d['query'][_0x2097('0x1f')]);_0x4d0916[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x41487d[_0x2097('0x34')][_0x2097('0x1e')]);}_0x4d0916[_0x2097('0x3c')]=qs['sort'](_0x41487d[_0x2097('0x34')][_0x2097('0x3d')]);_0x4d0916[_0x2097('0x3e')]=qs['filters'](_['pick'](_0x41487d[_0x2097('0x34')],_0x312c77[_0x2097('0x36')]),_0x1649c8);if(_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]){_0x4d0916[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x4d0916[_0x2097('0x3e')],{'$or':_[_0x2097('0x2e')](_0x1649c8,function(_0x23c4a5){if(_0x23c4a5[_0x2097('0x41')]!==_0x2097('0x42')){var _0x1ef92a={};_0x1ef92a[_0x23c4a5['name']]={'$like':'%'+_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1ef92a;}})});}_0x4d0916=_[_0x2097('0x40')]({},_0x4d0916,_0x41487d['options']);var _0x1394df={'where':_0x4d0916[_0x2097('0x3e')]};return db[_0x2097('0x2f')][_0x2097('0x21')](_0x1394df)[_0x2097('0x26')](function(_0xd4d89e){_0x11b051[_0x2097('0x21')]=_0xd4d89e;if(_0x41487d[_0x2097('0x34')]['includeAll']){_0x4d0916[_0x2097('0x43')]=[{'all':!![]}];}return db[_0x2097('0x2f')][_0x2097('0x44')](_0x4d0916);})[_0x2097('0x26')](function(_0x12e0e2){_0x11b051[_0x2097('0x45')]=_0x12e0e2;return _0x11b051;})[_0x2097('0x26')](respondWithFilteredResult(_0x59fb84,_0x4d0916))[_0x2097('0x46')](handleError(_0x59fb84,null));};exports['show']=function(_0x3fc3fe,_0x5869d8){var _0x3e0739={'raw':!![],'where':{'id':_0x3fc3fe[_0x2097('0x47')]['id']}},_0x298e49={};_0x298e49[_0x2097('0x33')]=_[_0x2097('0x35')](db['VoiceMail'][_0x2097('0x30')]);_0x298e49[_0x2097('0x34')]=_[_0x2097('0x35')](_0x3fc3fe[_0x2097('0x34')]);_0x298e49[_0x2097('0x36')]=_['intersection'](_0x298e49[_0x2097('0x33')],_0x298e49[_0x2097('0x34')]);_0x3e0739[_0x2097('0x38')]=_[_0x2097('0x37')](_0x298e49[_0x2097('0x33')],qs[_0x2097('0x39')](_0x3fc3fe[_0x2097('0x34')][_0x2097('0x39')]));_0x3e0739['attributes']=_0x3e0739[_0x2097('0x38')][_0x2097('0x48')]?_0x3e0739[_0x2097('0x38')]:_0x298e49[_0x2097('0x33')];if(_0x3fc3fe['query']['includeAll']){_0x3e0739['include']=[{'all':!![]}];}_0x3e0739=_[_0x2097('0x40')]({},_0x3e0739,_0x3fc3fe[_0x2097('0x49')]);return db['VoiceMail'][_0x2097('0x4a')](_0x3e0739)[_0x2097('0x26')](handleEntityNotFound(_0x5869d8,null))['then'](respondWithResult(_0x5869d8,null))['catch'](handleError(_0x5869d8,null));};exports[_0x2097('0x4b')]=function(_0x21829d,_0x1b4de6){return db['VoiceMail'][_0x2097('0x4b')](_0x21829d[_0x2097('0x4c')],{})['then'](function(_0x86a05a){var _0x2682a9=_0x21829d[_0x2097('0x4d')][_0x2097('0x28')]({'plain':!![]});if(!_0x2682a9)throw new Error(_0x2097('0x4e'));if(_0x2682a9['role']==='user'){var _0x140b41=_0x86a05a[_0x2097('0x28')]({'plain':!![]});var _0x329632='Voicemails';return db['UserProfileSection'][_0x2097('0x4a')]({'where':{'name':_0x329632,'userProfileId':_0x2682a9[_0x2097('0x4f')]},'raw':!![]})['then'](function(_0x41cd90){if(_0x41cd90&&_0x41cd90[_0x2097('0x50')]===0x0){return db[_0x2097('0x51')][_0x2097('0x4b')]({'name':_0x140b41[_0x2097('0x2c')],'resourceId':_0x140b41['id'],'type':_0x41cd90['name'],'sectionId':_0x41cd90['id']},{})[_0x2097('0x26')](function(){return _0x86a05a;});}else{return _0x86a05a;}})[_0x2097('0x46')](function(_0x190859){logger['error'](_0x2097('0x52'),_0x190859);throw _0x190859;});}return _0x86a05a;})[_0x2097('0x26')](respondWithResult(_0x1b4de6,0xc9))['catch'](handleError(_0x1b4de6,null));};exports[_0x2097('0x25')]=function(_0x4d6ed6,_0x30b4cd){if(_0x4d6ed6['body']['id']){delete _0x4d6ed6['body']['id'];}return db['VoiceMail'][_0x2097('0x4a')]({'where':{'id':_0x4d6ed6['params']['id']}})['then'](handleEntityNotFound(_0x30b4cd,null))[_0x2097('0x26')](saveUpdates(_0x4d6ed6['body'],null))[_0x2097('0x26')](respondWithResult(_0x30b4cd,null))[_0x2097('0x46')](handleError(_0x30b4cd,null));};exports['destroy']=function(_0x3e799f,_0x3e2e45){return db[_0x2097('0x2f')][_0x2097('0x4a')]({'where':{'id':_0x3e799f[_0x2097('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e2e45,null))[_0x2097('0x26')](removeEntity(_0x3e2e45,null))['catch'](handleError(_0x3e2e45,null));};exports[_0x2097('0x53')]=function(_0x140e43,_0x24f166,_0x55e3cd){return db[_0x2097('0x2f')][_0x2097('0x54')]({'where':{'id':_0x140e43[_0x2097('0x47')]['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x24f166,null))[_0x2097('0x26')](function(_0x56cfbf){var _0x5b9fa2;var _0x265eac={},_0x275578={};_0x275578['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x275578[_0x2097('0x34')]=_['keys'](_0x140e43[_0x2097('0x34')]);_0x275578[_0x2097('0x36')]=_['intersection'](_0x275578[_0x2097('0x33')],_0x275578[_0x2097('0x34')]);_0x265eac[_0x2097('0x38')]=_[_0x2097('0x37')](_0x275578[_0x2097('0x33')],qs[_0x2097('0x39')](_0x140e43[_0x2097('0x34')][_0x2097('0x39')]));_0x265eac[_0x2097('0x38')]=_0x265eac['attributes'][_0x2097('0x48')]?_0x265eac[_0x2097('0x38')]:_0x275578[_0x2097('0x33')];if(!_0x140e43[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x265eac['limit']=qs[_0x2097('0x1f')](_0x140e43[_0x2097('0x34')][_0x2097('0x1f')]);_0x265eac[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x140e43['query'][_0x2097('0x1e')]);}_0x265eac[_0x2097('0x3c')]=qs['sort'](_0x140e43['query']['sort']);_0x265eac[_0x2097('0x3e')]=qs[_0x2097('0x36')](_[_0x2097('0x55')](_0x140e43[_0x2097('0x34')],_0x275578[_0x2097('0x36')]));if(_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]){_0x265eac[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x265eac['where'],{'$or':_['map'](_0x265eac[_0x2097('0x38')],function(_0x34d832){var _0x1eeb30={};_0x1eeb30[_0x34d832]={'$like':'%'+_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1eeb30;})});}_0x265eac[_0x2097('0x3e')]=_['merge'](_0x265eac[_0x2097('0x3e')],{'mailboxuser':_0x56cfbf[_0x2097('0x56')]});_0x265eac=_[_0x2097('0x40')]({},_0x265eac,_0x140e43[_0x2097('0x49')]);return db['VoiceMailMessage']['findAndCountAll'](_0x265eac)[_0x2097('0x26')](respondWithFilteredResult(_0x24f166,_0x265eac));})[_0x2097('0x46')](handleError(_0x24f166,null));}; \ No newline at end of file +var _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','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','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x50affd,_0xad5f73){var _0xcb28da=function(_0x5c0828){while(--_0x5c0828){_0x50affd['push'](_0x50affd['shift']());}};_0xcb28da(++_0xad5f73);}(_0x34b7,0x196));var _0x734b=function(_0x528622,_0xcb18f0){_0x528622=_0x528622-0x0;var _0x1b12a0=_0x34b7[_0x528622];return _0x1b12a0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c60fdf4..f7b7021 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 _0x188c=['voice_voicemail','mailbox_context','context','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x4f10b2,_0x2953e5){var _0x16effd=function(_0x2c9dea){while(--_0x2c9dea){_0x4f10b2['push'](_0x4f10b2['shift']());}};_0x16effd(++_0x2953e5);}(_0x188c,0x9f));var _0xc188=function(_0xf2dc32,_0x2f00dd){_0xf2dc32=_0xf2dc32-0x0;var _0x2d6d45=_0x188c[_0xf2dc32];return _0x2d6d45;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc188('0x0'))('api');var moment=require(_0xc188('0x1'));var BPromise=require('bluebird');var rp=require(_0xc188('0x2'));var fs=require('fs');var path=require(_0xc188('0x3'));var rimraf=require(_0xc188('0x4'));var config=require(_0xc188('0x5'));var attributes=require(_0xc188('0x6'));module[_0xc188('0x7')]=function(_0x5c102a,_0x5adbc2){return _0x5c102a[_0xc188('0x8')](_0xc188('0x9'),attributes,{'tableName':_0xc188('0xa'),'paranoid':![],'indexes':[{'name':_0xc188('0xb'),'fields':['mailbox',_0xc188('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ab=['util','api','moment','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2ab,0x86));var _0xbd2a=function(_0x3bb7d9,_0x8239a1){_0x3bb7d9=_0x3bb7d9-0x0;var _0x297933=_0xd2ab[_0x3bb7d9];return _0x297933;};'use strict';var _=require(_0xbd2a('0x0'));var util=require(_0xbd2a('0x1'));var logger=require('../../config/logger')(_0xbd2a('0x2'));var moment=require(_0xbd2a('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd2a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd2a('0x5'));var config=require(_0xbd2a('0x6'));var attributes=require(_0xbd2a('0x7'));module[_0xbd2a('0x8')]=function(_0x199ebb,_0xa53b3f){return _0x199ebb[_0xbd2a('0x9')](_0xbd2a('0xa'),attributes,{'tableName':_0xbd2a('0xb'),'paranoid':![],'indexes':[{'name':_0xbd2a('0xc'),'fields':[_0xbd2a('0xd'),_0xbd2a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 591ca59..f4ce198 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 _0x40ef=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4eebb3,_0x423fad){var _0x1fc547=function(_0x57abea){while(--_0x57abea){_0x4eebb3['push'](_0x4eebb3['shift']());}};_0x1fc547(++_0x423fad);}(_0x40ef,0x14b));var _0xf40e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x40ef[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf40e('0x0'));var util=require(_0xf40e('0x1'));var moment=require(_0xf40e('0x2'));var BPromise=require(_0xf40e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf40e('0x4'))['db'];var utils=require(_0xf40e('0x5'));var logger=require(_0xf40e('0x6'))(_0xf40e('0x7'));var config=require(_0xf40e('0x8'));var jayson=require(_0xf40e('0x9'));var client=jayson['client'][_0xf40e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ed855,_0x36bcce,_0x2bc6a5){return new BPromise(function(_0x20f9db,_0x2bfc42){return client[_0xf40e('0xb')](_0x4ed855,_0x2bc6a5)['then'](function(_0x140c6d){logger[_0xf40e('0xc')](_0xf40e('0xd'),_0x36bcce,_0xf40e('0xe'));logger[_0xf40e('0xf')](_0xf40e('0x10'),_0x36bcce,'request\x20sent',JSON[_0xf40e('0x11')](_0x140c6d));if(_0x140c6d[_0xf40e('0x12')]){if(_0x140c6d[_0xf40e('0x12')][_0xf40e('0x13')]===0x1f4){logger[_0xf40e('0x12')](_0xf40e('0xd'),_0x36bcce,_0x140c6d[_0xf40e('0x12')]['message']);return _0x2bfc42(_0x140c6d[_0xf40e('0x12')][_0xf40e('0x14')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x36bcce,_0x140c6d['error'][_0xf40e('0x14')]);return _0x20f9db(_0x140c6d[_0xf40e('0x12')][_0xf40e('0x14')]);}else{logger['info'](_0xf40e('0xd'),_0x36bcce,_0xf40e('0xe'));_0x20f9db(_0x140c6d[_0xf40e('0x15')][_0xf40e('0x14')]);}})['catch'](function(_0xcdead1){logger[_0xf40e('0x12')](_0xf40e('0xd'),_0x36bcce,_0xcdead1);_0x2bfc42(_0xcdead1);});});} \ No newline at end of file +var _0x2796=['jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x2796,0x6f));var _0x6279=function(_0xa11f04,_0xb04e95){_0xa11f04=_0xa11f04-0x0;var _0x4c5433=_0x2796[_0xa11f04];return _0x4c5433;};'use strict';var _=require('lodash');var util=require(_0x6279('0x0'));var moment=require(_0x6279('0x1'));var BPromise=require(_0x6279('0x2'));var rs=require(_0x6279('0x3'));var fs=require('fs');var Redis=require(_0x6279('0x4'));var db=require(_0x6279('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6279('0x6'))(_0x6279('0x7'));var config=require(_0x6279('0x8'));var jayson=require(_0x6279('0x9'));var client=jayson[_0x6279('0xa')][_0x6279('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39452c,_0x123547,_0x33617f){return new BPromise(function(_0x386196,_0x5f0baa){return client[_0x6279('0xc')](_0x39452c,_0x33617f)[_0x6279('0xd')](function(_0x31c41d){logger[_0x6279('0xe')]('VoiceMail,\x20%s,\x20%s',_0x123547,_0x6279('0xf'));logger[_0x6279('0x10')](_0x6279('0x11'),_0x123547,_0x6279('0xf'),JSON['stringify'](_0x31c41d));if(_0x31c41d[_0x6279('0x12')]){if(_0x31c41d[_0x6279('0x12')][_0x6279('0x13')]===0x1f4){logger[_0x6279('0x12')](_0x6279('0x14'),_0x123547,_0x31c41d[_0x6279('0x12')][_0x6279('0x15')]);return _0x5f0baa(_0x31c41d['error'][_0x6279('0x15')]);}logger[_0x6279('0x12')](_0x6279('0x14'),_0x123547,_0x31c41d['error']['message']);return _0x386196(_0x31c41d[_0x6279('0x12')][_0x6279('0x15')]);}else{logger[_0x6279('0xe')]('VoiceMail,\x20%s,\x20%s',_0x123547,_0x6279('0xf'));_0x386196(_0x31c41d[_0x6279('0x16')][_0x6279('0x15')]);}})[_0x6279('0x17')](function(_0x44b7cc){logger['error']('VoiceMail,\x20%s,\x20%s',_0x123547,_0x44b7cc);_0x5f0baa(_0x44b7cc);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d15cfea..43a1fe3 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 _0x44be=['delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','index','get','/:id','show','isAuthenticated','download','put'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x44be,0x1ac));var _0xe44b=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x44be[_0x3f55de];return _0x2698de;};'use strict';var multer=require('multer');var util=require(_0xe44b('0x0'));var path=require(_0xe44b('0x1'));var timeout=require('connect-timeout');var express=require(_0xe44b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe44b('0x3'));var interaction=require(_0xe44b('0x4'));var config=require(_0xe44b('0x5'));var controller=require(_0xe44b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe44b('0x7')]);router[_0xe44b('0x8')](_0xe44b('0x9'),auth['isAuthenticated'](),controller[_0xe44b('0xa')]);router['get']('/:id/download',auth[_0xe44b('0xb')](),controller[_0xe44b('0xc')]);router['post']('/',auth[_0xe44b('0xb')](),controller['create']);router[_0xe44b('0xd')](_0xe44b('0x9'),auth[_0xe44b('0xb')](),controller['update']);router[_0xe44b('0xe')](_0xe44b('0x9'),auth[_0xe44b('0xb')](),controller[_0xe44b('0xf')]);module[_0xe44b('0x10')]=router; \ No newline at end of file +var _0x65cf=['isAuthenticated','show','/:id/download','post','put','/:id','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x15ff23,_0x50181d){var _0x13bccd=function(_0x3a3bac){while(--_0x3a3bac){_0x15ff23['push'](_0x15ff23['shift']());}};_0x13bccd(++_0x50181d);}(_0x65cf,0x108));var _0xf65c=function(_0x1b124d,_0x43e5cf){_0x1b124d=_0x1b124d-0x0;var _0x1a9688=_0x65cf[_0x1b124d];return _0x1a9688;};'use strict';var multer=require('multer');var util=require(_0xf65c('0x0'));var path=require(_0xf65c('0x1'));var timeout=require(_0xf65c('0x2'));var express=require(_0xf65c('0x3'));var router=express[_0xf65c('0x4')]();var fs_extra=require(_0xf65c('0x5'));var auth=require(_0xf65c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xf65c('0x7')]('/',auth[_0xf65c('0x8')](),controller['index']);router[_0xf65c('0x7')]('/:id',auth[_0xf65c('0x8')](),controller[_0xf65c('0x9')]);router[_0xf65c('0x7')](_0xf65c('0xa'),auth[_0xf65c('0x8')](),controller['download']);router[_0xf65c('0xb')]('/',auth[_0xf65c('0x8')](),controller['create']);router[_0xf65c('0xc')](_0xf65c('0xd'),auth[_0xf65c('0x8')](),controller[_0xf65c('0xe')]);router[_0xf65c('0xf')](_0xf65c('0xd'),auth[_0xf65c('0x8')](),controller['destroy']);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 3bd0ab1..e56ff23 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 _0x6fde=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','literal'];(function(_0x4debfa,_0x59bfc9){var _0x2aeceb=function(_0x56250f){while(--_0x56250f){_0x4debfa['push'](_0x4debfa['shift']());}};_0x2aeceb(++_0x59bfc9);}(_0x6fde,0x1d4));var _0xe6fd=function(_0x282aab,_0x4e1d9d){_0x282aab=_0x282aab-0x0;var _0x202e47=_0x6fde[_0x282aab];return _0x202e47;};'use strict';var Sequelize=require(_0xe6fd('0x0'));module[_0xe6fd('0x1')]={'name':{'type':Sequelize[_0xe6fd('0x2')],'get':function(_0x338061){return this[_0xe6fd('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe6fd('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xe6fd('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe6fd('0x5')],'defaultValue':''},'stamp':{'type':_0xe6fd('0x7'),'defaultValue':Sequelize[_0xe6fd('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x8c4b=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x164274,_0x478d54){var _0x3a31e9=function(_0x5daa76){while(--_0x5daa76){_0x164274['push'](_0x164274['shift']());}};_0x3a31e9(++_0x478d54);}(_0x8c4b,0x155));var _0xb8c4=function(_0x22bda9,_0x4637b7){_0x22bda9=_0x22bda9-0x0;var _0x43af19=_0x8c4b[_0x22bda9];return _0x43af19;};'use strict';var Sequelize=require(_0xb8c4('0x0'));module[_0xb8c4('0x1')]={'name':{'type':Sequelize[_0xb8c4('0x2')],'get':function(_0xc8547b){return this[_0xb8c4('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xb8c4('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb8c4('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xb8c4('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xb8c4('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb8c4('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xb8c4('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb8c4('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xb8c4('0x6')](_0xb8c4('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xb8c4('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb8c4('0x5')],'defaultValue':''},'stamp':{'type':_0xb8c4('0x8'),'defaultValue':Sequelize[_0xb8c4('0x9')](_0xb8c4('0xa'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 449f390..cc23293 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 _0x8217=['include','then','rows','catch','params','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','error','stack','name','send','VoiceMailMessage','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','length','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x4c08a2,_0x3c808f){var _0x1f1fd6=function(_0x23cc9e){while(--_0x23cc9e){_0x4c08a2['push'](_0x4c08a2['shift']());}};_0x1f1fd6(++_0x3c808f);}(_0x8217,0x66));var _0x7821=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x8217[_0x3c97e3];return _0x9bb0ed;};'use strict';var emlformat=require(_0x7821('0x0'));var rimraf=require(_0x7821('0x1'));var zipdir=require(_0x7821('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7821('0x3'));var Mustache=require(_0x7821('0x4'));var util=require(_0x7821('0x5'));var path=require(_0x7821('0x6'));var sox=require(_0x7821('0x7'));var csv=require(_0x7821('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7821('0x9'));var _=require(_0x7821('0xa'));var squel=require('squel');var crypto=require(_0x7821('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7821('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7821('0xd'));var Papa=require(_0x7821('0xe'));var Redis=require(_0x7821('0xf'));var authService=require(_0x7821('0x10'));var qs=require(_0x7821('0x11'));var as=require(_0x7821('0x12'));var hardwareService=require(_0x7821('0x13'));var logger=require(_0x7821('0x14'))(_0x7821('0x15'));var utils=require(_0x7821('0x16'));var config=require(_0x7821('0x17'));var licenseUtil=require(_0x7821('0x18'));var db=require(_0x7821('0x19'))['db'];function respondWithStatusCode(_0x4b6b26,_0x59b996){_0x59b996=_0x59b996||0xcc;return function(_0x357ed1){if(_0x357ed1){return _0x4b6b26[_0x7821('0x1a')](_0x59b996);}return _0x4b6b26['status'](_0x59b996)[_0x7821('0x1b')]();};}function respondWithResult(_0x431acf,_0x448c3c){_0x448c3c=_0x448c3c||0xc8;return function(_0xa09274){if(_0xa09274){return _0x431acf['status'](_0x448c3c)[_0x7821('0x1c')](_0xa09274);}};}function respondWithFilteredResult(_0xa0adb,_0xfa3c99){return function(_0x2a7be6){if(_0x2a7be6){var _0x4525e6=typeof _0xfa3c99[_0x7821('0x1d')]===_0x7821('0x1e')&&typeof _0xfa3c99[_0x7821('0x1f')]===_0x7821('0x1e');var _0x458246=_0x2a7be6[_0x7821('0x20')];var _0x22e5de=_0x4525e6?0x0:_0xfa3c99[_0x7821('0x1d')];var _0x5b4f80=_0x4525e6?_0x2a7be6[_0x7821('0x20')]:_0xfa3c99[_0x7821('0x1d')]+_0xfa3c99['limit'];var _0x342642;if(_0x5b4f80>=_0x458246){_0x5b4f80=_0x458246;_0x342642=0xc8;}else{_0x342642=0xce;}_0xa0adb[_0x7821('0x21')](_0x342642);return _0xa0adb[_0x7821('0x22')](_0x7821('0x23'),_0x22e5de+'-'+_0x5b4f80+'/'+_0x458246)[_0x7821('0x1c')](_0x2a7be6);}return null;};}function patchUpdates(_0x1968cd){return function(_0x45da76){try{jsonpatch[_0x7821('0x24')](_0x45da76,_0x1968cd,!![]);}catch(_0x5e933c){return BPromise['reject'](_0x5e933c);}return _0x45da76[_0x7821('0x25')]();};}function saveUpdates(_0x29e36a,_0x3e02d2){return function(_0x5fe848){if(_0x5fe848){return _0x5fe848[_0x7821('0x26')](_0x29e36a)['then'](function(_0x33320f){return _0x33320f;});}return null;};}function removeEntity(_0x45a39d,_0x4c6066){return function(_0x20393f){if(_0x20393f){return _0x20393f['destroy']()['then'](function(){_0x45a39d[_0x7821('0x21')](0xcc)[_0x7821('0x1b')]();});}};}function handleEntityNotFound(_0x30fb3a,_0x4b5886){return function(_0x3ab659){if(!_0x3ab659){_0x30fb3a[_0x7821('0x1a')](0x194);}return _0x3ab659;};}function handleError(_0x8d3db7,_0x544d53){_0x544d53=_0x544d53||0x1f4;return function(_0x29d16b){logger[_0x7821('0x27')](_0x29d16b[_0x7821('0x28')]);if(_0x29d16b['name']){delete _0x29d16b[_0x7821('0x29')];}_0x8d3db7[_0x7821('0x21')](_0x544d53)[_0x7821('0x2a')](_0x29d16b);};}exports['index']=function(_0x28d0ce,_0x2007b9){var _0x514641={},_0x57184f={},_0x4248d9={'count':0x0,'rows':[]};var _0x3af23f=_['map'](db[_0x7821('0x2b')][_0x7821('0x2c')],function(_0x5dcb0d){return{'name':_0x5dcb0d['fieldName'],'type':_0x5dcb0d['type'][_0x7821('0x2d')]};});_0x57184f[_0x7821('0x2e')]=_['differenceBy'](_[_0x7821('0x2f')](_0x3af23f,_0x7821('0x29')),[_0x7821('0x29')]);_0x57184f[_0x7821('0x30')]=_[_0x7821('0x31')](_0x28d0ce['query']);_0x57184f['filters']=_['intersection'](_0x57184f['model'],_0x57184f[_0x7821('0x30')]);_0x514641[_0x7821('0x32')]=_[_0x7821('0x33')](_0x57184f['model'],qs[_0x7821('0x34')](_0x28d0ce[_0x7821('0x30')][_0x7821('0x34')]));_0x514641['attributes']=_0x514641[_0x7821('0x32')][_0x7821('0x35')]?_0x514641[_0x7821('0x32')]:_0x57184f['model'];if(!_0x28d0ce[_0x7821('0x30')]['hasOwnProperty']('nolimit')){_0x514641[_0x7821('0x1f')]=qs[_0x7821('0x1f')](_0x28d0ce[_0x7821('0x30')]['limit']);_0x514641[_0x7821('0x1d')]=qs[_0x7821('0x1d')](_0x28d0ce[_0x7821('0x30')][_0x7821('0x1d')]);}_0x514641['order']=qs[_0x7821('0x36')](_0x28d0ce[_0x7821('0x30')][_0x7821('0x36')]);_0x514641[_0x7821('0x37')]=qs[_0x7821('0x38')](_[_0x7821('0x39')](_0x28d0ce['query'],_0x57184f[_0x7821('0x38')]),_0x3af23f);if(_0x28d0ce[_0x7821('0x30')][_0x7821('0x3a')]){_0x514641[_0x7821('0x37')]=_[_0x7821('0x3b')](_0x514641['where'],{'$or':_[_0x7821('0x2f')](_0x3af23f,function(_0x22aa9e){if(_0x22aa9e[_0x7821('0x3c')]!==_0x7821('0x3d')){var _0x3fa315={};_0x3fa315[_0x22aa9e[_0x7821('0x29')]]={'$like':'%'+_0x28d0ce[_0x7821('0x30')]['filter']+'%'};return _0x3fa315;}})});}_0x514641=_['merge']({},_0x514641,_0x28d0ce[_0x7821('0x3e')]);var _0x34fa76={'where':_0x514641[_0x7821('0x37')]};return db[_0x7821('0x2b')][_0x7821('0x20')](_0x34fa76)['then'](function(_0x16c7f8){_0x4248d9[_0x7821('0x20')]=_0x16c7f8;if(_0x28d0ce[_0x7821('0x30')][_0x7821('0x3f')]){_0x514641[_0x7821('0x40')]=[{'all':!![]}];}return db[_0x7821('0x2b')]['findAll'](_0x514641);})[_0x7821('0x41')](function(_0x4b8dd8){_0x4248d9[_0x7821('0x42')]=_0x4b8dd8;return _0x4248d9;})[_0x7821('0x41')](respondWithFilteredResult(_0x2007b9,_0x514641))[_0x7821('0x43')](handleError(_0x2007b9,null));};exports['show']=function(_0x3031ba,_0x1e03f6){var _0x25ff10={'raw':!![],'where':{'id':_0x3031ba[_0x7821('0x44')]['id']}},_0x1578aa={};_0x1578aa[_0x7821('0x2e')]=_[_0x7821('0x31')](db[_0x7821('0x2b')][_0x7821('0x2c')]);_0x1578aa['query']=_[_0x7821('0x31')](_0x3031ba[_0x7821('0x30')]);_0x1578aa[_0x7821('0x38')]=_[_0x7821('0x33')](_0x1578aa[_0x7821('0x2e')],_0x1578aa[_0x7821('0x30')]);_0x25ff10[_0x7821('0x32')]=_[_0x7821('0x33')](_0x1578aa[_0x7821('0x2e')],qs['fields'](_0x3031ba[_0x7821('0x30')][_0x7821('0x34')]));_0x25ff10['attributes']=_0x25ff10[_0x7821('0x32')]['length']?_0x25ff10[_0x7821('0x32')]:_0x1578aa['model'];if(_0x3031ba[_0x7821('0x30')]['includeAll']){_0x25ff10[_0x7821('0x40')]=[{'all':!![]}];}_0x25ff10=_['merge']({},_0x25ff10,_0x3031ba[_0x7821('0x3e')]);return db[_0x7821('0x2b')][_0x7821('0x45')](_0x25ff10)['then'](handleEntityNotFound(_0x1e03f6,null))['then'](respondWithResult(_0x1e03f6,null))[_0x7821('0x43')](handleError(_0x1e03f6,null));};exports[_0x7821('0x46')]=function(_0x4f29ed,_0x3cb245){return db[_0x7821('0x2b')]['create'](_0x4f29ed['body'],{})[_0x7821('0x41')](respondWithResult(_0x3cb245,0xc9))[_0x7821('0x43')](handleError(_0x3cb245,null));};exports[_0x7821('0x26')]=function(_0x4d6166,_0x48f0e6){if(_0x4d6166['body']['id']){delete _0x4d6166[_0x7821('0x47')]['id'];}return db['VoiceMailMessage'][_0x7821('0x45')]({'where':{'id':_0x4d6166[_0x7821('0x44')]['id']}})[_0x7821('0x41')](handleEntityNotFound(_0x48f0e6,null))[_0x7821('0x41')](saveUpdates(_0x4d6166[_0x7821('0x47')],null))[_0x7821('0x41')](respondWithResult(_0x48f0e6,null))[_0x7821('0x43')](handleError(_0x48f0e6,null));};exports[_0x7821('0x48')]=function(_0x24e44b,_0x4a1fba){return db[_0x7821('0x2b')]['find']({'where':{'id':_0x24e44b[_0x7821('0x44')]['id']}})[_0x7821('0x41')](handleEntityNotFound(_0x4a1fba,null))[_0x7821('0x41')](removeEntity(_0x4a1fba,null))[_0x7821('0x43')](handleError(_0x4a1fba,null));};exports[_0x7821('0x49')]=function(_0x245438,_0x2d2c56,_0x5f394e){return db[_0x7821('0x2b')][_0x7821('0x45')]({'where':{'id':_0x245438[_0x7821('0x44')]['id']},'attributes':['id',_0x7821('0x4a'),_0x7821('0x4b')]})[_0x7821('0x41')](handleEntityNotFound(_0x2d2c56,null))['then'](function(_0x41d8de){if(_0x41d8de){if(!_0x41d8de[_0x7821('0x4a')]){throw new db[(_0x7821('0x4c'))][(_0x7821('0x4d'))](_0x7821('0x4e'));}var _0x57e521={'Content-Type':_0x7821('0x4f'),'Content-Disposition':_0x7821('0x50')};if(_0x41d8de[_0x7821('0x4b')]){_0x57e521['Content-Disposition']=_0x7821('0x51')+_0x41d8de[_0x7821('0x4b')]+_0x7821('0x52');}_0x2d2c56[_0x7821('0x22')](_0x57e521);return _0x2d2c56[_0x7821('0x2a')](new Buffer(_0x41d8de[_0x7821('0x4a')]));}})['catch'](handleError(_0x2d2c56,null));}; \ No newline at end of file +var _0x3c06=['fields','nolimit','order','sort','pick','where','merge','options','count','include','findAll','rows','show','params','keys','includeAll','catch','create','body','update','find','download','recording','VoiceMailMessage\x20not\x20found','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','offset','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','attributes','intersection'];(function(_0x1b3cef,_0x109a83){var _0x5115e3=function(_0x1016bd){while(--_0x1016bd){_0x1b3cef['push'](_0x1b3cef['shift']());}};_0x5115e3(++_0x109a83);}(_0x3c06,0x1b6));var _0x63c0=function(_0x25a9f9,_0x1c6c37){_0x25a9f9=_0x25a9f9-0x0;var _0x3d0d38=_0x3c06[_0x25a9f9];return _0x3d0d38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63c0('0x0'));var zipdir=require(_0x63c0('0x1'));var jsonpatch=require(_0x63c0('0x2'));var rp=require(_0x63c0('0x3'));var moment=require('moment');var BPromise=require(_0x63c0('0x4'));var Mustache=require(_0x63c0('0x5'));var util=require(_0x63c0('0x6'));var path=require(_0x63c0('0x7'));var sox=require(_0x63c0('0x8'));var csv=require(_0x63c0('0x9'));var ejs=require(_0x63c0('0xa'));var fs=require('fs');var fs_extra=require(_0x63c0('0xb'));var _=require('lodash');var squel=require(_0x63c0('0xc'));var crypto=require(_0x63c0('0xd'));var jsforce=require(_0x63c0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x63c0('0x9'));var querystring=require(_0x63c0('0xf'));var Papa=require(_0x63c0('0x10'));var Redis=require('ioredis');var authService=require(_0x63c0('0x11'));var qs=require(_0x63c0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63c0('0x13'));var logger=require(_0x63c0('0x14'))(_0x63c0('0x15'));var utils=require(_0x63c0('0x16'));var config=require(_0x63c0('0x17'));var licenseUtil=require(_0x63c0('0x18'));var db=require(_0x63c0('0x19'))['db'];function respondWithStatusCode(_0x2d549e,_0xd55600){_0xd55600=_0xd55600||0xcc;return function(_0x1bb65f){if(_0x1bb65f){return _0x2d549e['sendStatus'](_0xd55600);}return _0x2d549e[_0x63c0('0x1a')](_0xd55600)['end']();};}function respondWithResult(_0x121b91,_0x5c0803){_0x5c0803=_0x5c0803||0xc8;return function(_0xe5230c){if(_0xe5230c){return _0x121b91[_0x63c0('0x1a')](_0x5c0803)[_0x63c0('0x1b')](_0xe5230c);}};}function respondWithFilteredResult(_0x4dfee5,_0x30422a){return function(_0xdddd62){if(_0xdddd62){var _0x18be4d=typeof _0x30422a['offset']==='undefined'&&typeof _0x30422a[_0x63c0('0x1c')]===_0x63c0('0x1d');var _0x38287e=_0xdddd62['count'];var _0x29c90f=_0x18be4d?0x0:_0x30422a[_0x63c0('0x1e')];var _0x234c9d=_0x18be4d?_0xdddd62['count']:_0x30422a[_0x63c0('0x1e')]+_0x30422a['limit'];var _0xbd451d;if(_0x234c9d>=_0x38287e){_0x234c9d=_0x38287e;_0xbd451d=0xc8;}else{_0xbd451d=0xce;}_0x4dfee5[_0x63c0('0x1a')](_0xbd451d);return _0x4dfee5['set'](_0x63c0('0x1f'),_0x29c90f+'-'+_0x234c9d+'/'+_0x38287e)[_0x63c0('0x1b')](_0xdddd62);}return null;};}function patchUpdates(_0x50682e){return function(_0x13cd76){try{jsonpatch[_0x63c0('0x20')](_0x13cd76,_0x50682e,!![]);}catch(_0x138b14){return BPromise['reject'](_0x138b14);}return _0x13cd76[_0x63c0('0x21')]();};}function saveUpdates(_0x3063d9,_0x425d5e){return function(_0x4631c7){if(_0x4631c7){return _0x4631c7['update'](_0x3063d9)[_0x63c0('0x22')](function(_0x2a5c7b){return _0x2a5c7b;});}return null;};}function removeEntity(_0x332ee5,_0x3b403f){return function(_0x4cdded){if(_0x4cdded){return _0x4cdded[_0x63c0('0x23')]()[_0x63c0('0x22')](function(){_0x332ee5['status'](0xcc)[_0x63c0('0x24')]();});}};}function handleEntityNotFound(_0x4c2c00,_0x1ac171){return function(_0x39e2d9){if(!_0x39e2d9){_0x4c2c00[_0x63c0('0x25')](0x194);}return _0x39e2d9;};}function handleError(_0x172495,_0x100d12){_0x100d12=_0x100d12||0x1f4;return function(_0x211aef){logger[_0x63c0('0x26')](_0x211aef[_0x63c0('0x27')]);if(_0x211aef['name']){delete _0x211aef[_0x63c0('0x28')];}_0x172495['status'](_0x100d12)[_0x63c0('0x29')](_0x211aef);};}exports['index']=function(_0x58f467,_0x2248bc){var _0x123bc6={},_0xff87d2={},_0x19fdda={'count':0x0,'rows':[]};var _0x4947a6=_[_0x63c0('0x2a')](db[_0x63c0('0x2b')][_0x63c0('0x2c')],function(_0x3935d6){return{'name':_0x3935d6[_0x63c0('0x2d')],'type':_0x3935d6[_0x63c0('0x2e')][_0x63c0('0x2f')]};});_0xff87d2[_0x63c0('0x30')]=_[_0x63c0('0x31')](_[_0x63c0('0x2a')](_0x4947a6,_0x63c0('0x28')),[_0x63c0('0x28')]);_0xff87d2[_0x63c0('0x32')]=_['keys'](_0x58f467[_0x63c0('0x32')]);_0xff87d2[_0x63c0('0x33')]=_['intersection'](_0xff87d2[_0x63c0('0x30')],_0xff87d2['query']);_0x123bc6[_0x63c0('0x34')]=_[_0x63c0('0x35')](_0xff87d2['model'],qs[_0x63c0('0x36')](_0x58f467[_0x63c0('0x32')][_0x63c0('0x36')]));_0x123bc6[_0x63c0('0x34')]=_0x123bc6[_0x63c0('0x34')]['length']?_0x123bc6[_0x63c0('0x34')]:_0xff87d2[_0x63c0('0x30')];if(!_0x58f467['query']['hasOwnProperty'](_0x63c0('0x37'))){_0x123bc6[_0x63c0('0x1c')]=qs[_0x63c0('0x1c')](_0x58f467[_0x63c0('0x32')]['limit']);_0x123bc6[_0x63c0('0x1e')]=qs[_0x63c0('0x1e')](_0x58f467[_0x63c0('0x32')][_0x63c0('0x1e')]);}_0x123bc6[_0x63c0('0x38')]=qs['sort'](_0x58f467[_0x63c0('0x32')][_0x63c0('0x39')]);_0x123bc6['where']=qs['filters'](_[_0x63c0('0x3a')](_0x58f467[_0x63c0('0x32')],_0xff87d2[_0x63c0('0x33')]),_0x4947a6);if(_0x58f467[_0x63c0('0x32')]['filter']){_0x123bc6[_0x63c0('0x3b')]=_['merge'](_0x123bc6[_0x63c0('0x3b')],{'$or':_['map'](_0x4947a6,function(_0x4d0417){if(_0x4d0417[_0x63c0('0x2e')]!=='VIRTUAL'){var _0x4af082={};_0x4af082[_0x4d0417[_0x63c0('0x28')]]={'$like':'%'+_0x58f467[_0x63c0('0x32')]['filter']+'%'};return _0x4af082;}})});}_0x123bc6=_[_0x63c0('0x3c')]({},_0x123bc6,_0x58f467[_0x63c0('0x3d')]);var _0xbd769b={'where':_0x123bc6['where']};return db[_0x63c0('0x2b')][_0x63c0('0x3e')](_0xbd769b)[_0x63c0('0x22')](function(_0x1ce12b){_0x19fdda['count']=_0x1ce12b;if(_0x58f467[_0x63c0('0x32')]['includeAll']){_0x123bc6[_0x63c0('0x3f')]=[{'all':!![]}];}return db[_0x63c0('0x2b')][_0x63c0('0x40')](_0x123bc6);})[_0x63c0('0x22')](function(_0x1bd8c2){_0x19fdda[_0x63c0('0x41')]=_0x1bd8c2;return _0x19fdda;})[_0x63c0('0x22')](respondWithFilteredResult(_0x2248bc,_0x123bc6))['catch'](handleError(_0x2248bc,null));};exports[_0x63c0('0x42')]=function(_0x4a663b,_0x1260a0){var _0x49c41b={'raw':!![],'where':{'id':_0x4a663b[_0x63c0('0x43')]['id']}},_0x57fff9={};_0x57fff9[_0x63c0('0x30')]=_[_0x63c0('0x44')](db[_0x63c0('0x2b')][_0x63c0('0x2c')]);_0x57fff9[_0x63c0('0x32')]=_[_0x63c0('0x44')](_0x4a663b[_0x63c0('0x32')]);_0x57fff9[_0x63c0('0x33')]=_[_0x63c0('0x35')](_0x57fff9[_0x63c0('0x30')],_0x57fff9[_0x63c0('0x32')]);_0x49c41b['attributes']=_[_0x63c0('0x35')](_0x57fff9[_0x63c0('0x30')],qs['fields'](_0x4a663b['query']['fields']));_0x49c41b[_0x63c0('0x34')]=_0x49c41b[_0x63c0('0x34')]['length']?_0x49c41b['attributes']:_0x57fff9[_0x63c0('0x30')];if(_0x4a663b[_0x63c0('0x32')][_0x63c0('0x45')]){_0x49c41b[_0x63c0('0x3f')]=[{'all':!![]}];}_0x49c41b=_[_0x63c0('0x3c')]({},_0x49c41b,_0x4a663b[_0x63c0('0x3d')]);return db['VoiceMailMessage']['find'](_0x49c41b)[_0x63c0('0x22')](handleEntityNotFound(_0x1260a0,null))[_0x63c0('0x22')](respondWithResult(_0x1260a0,null))[_0x63c0('0x46')](handleError(_0x1260a0,null));};exports[_0x63c0('0x47')]=function(_0x7cb927,_0x498e07){return db[_0x63c0('0x2b')]['create'](_0x7cb927[_0x63c0('0x48')],{})['then'](respondWithResult(_0x498e07,0xc9))[_0x63c0('0x46')](handleError(_0x498e07,null));};exports[_0x63c0('0x49')]=function(_0x23365d,_0x317e12){if(_0x23365d[_0x63c0('0x48')]['id']){delete _0x23365d['body']['id'];}return db[_0x63c0('0x2b')][_0x63c0('0x4a')]({'where':{'id':_0x23365d[_0x63c0('0x43')]['id']}})[_0x63c0('0x22')](handleEntityNotFound(_0x317e12,null))['then'](saveUpdates(_0x23365d[_0x63c0('0x48')],null))['then'](respondWithResult(_0x317e12,null))['catch'](handleError(_0x317e12,null));};exports['destroy']=function(_0x3b01d5,_0x47490f){return db[_0x63c0('0x2b')][_0x63c0('0x4a')]({'where':{'id':_0x3b01d5['params']['id']}})[_0x63c0('0x22')](handleEntityNotFound(_0x47490f,null))[_0x63c0('0x22')](removeEntity(_0x47490f,null))[_0x63c0('0x46')](handleError(_0x47490f,null));};exports[_0x63c0('0x4b')]=function(_0x41fe25,_0x4b7635,_0x2b7bdf){return db[_0x63c0('0x2b')][_0x63c0('0x4a')]({'where':{'id':_0x41fe25[_0x63c0('0x43')]['id']},'attributes':['id',_0x63c0('0x4c'),'msg_id']})['then'](handleEntityNotFound(_0x4b7635,null))[_0x63c0('0x22')](function(_0x2ea7b4){if(_0x2ea7b4){if(!_0x2ea7b4['recording']){throw new db['Sequelize']['ValidationError'](_0x63c0('0x4d'));}var _0x38ffa2={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x2ea7b4[_0x63c0('0x4e')]){_0x38ffa2[_0x63c0('0x4f')]=_0x63c0('0x50')+_0x2ea7b4[_0x63c0('0x4e')]+_0x63c0('0x51');}_0x4b7635['set'](_0x38ffa2);return _0x4b7635[_0x63c0('0x29')](new Buffer(_0x2ea7b4[_0x63c0('0x4c')]));}})['catch'](handleError(_0x4b7635,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2d5a5d4..4c57c7e 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 _0x40c4=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x20c729,_0x5296dc){var _0x2d9350=function(_0x33c92e){while(--_0x33c92e){_0x20c729['push'](_0x20c729['shift']());}};_0x2d9350(++_0x5296dc);}(_0x40c4,0x181));var _0x440c=function(_0x4c8890,_0x34c779){_0x4c8890=_0x4c8890-0x0;var _0x2e7ed5=_0x40c4[_0x4c8890];return _0x2e7ed5;};'use strict';var _=require('lodash');var util=require(_0x440c('0x0'));var logger=require(_0x440c('0x1'))(_0x440c('0x2'));var moment=require('moment');var BPromise=require(_0x440c('0x3'));var rp=require(_0x440c('0x4'));var fs=require('fs');var path=require(_0x440c('0x5'));var rimraf=require(_0x440c('0x6'));var config=require(_0x440c('0x7'));var attributes=require(_0x440c('0x8'));module[_0x440c('0x9')]=function(_0x2fe8cf,_0x42bb32){return _0x2fe8cf[_0x440c('0xa')](_0x440c('0xb'),attributes,{'tableName':_0x440c('0xc'),'paranoid':![],'indexes':[{'name':_0x440c('0xd'),'fields':[_0x440c('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2456=['moment','bluebird','request-promise','path','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0x27fa78,_0x2118a0){var _0x1446e1=function(_0x5d2d87){while(--_0x5d2d87){_0x27fa78['push'](_0x27fa78['shift']());}};_0x1446e1(++_0x2118a0);}(_0x2456,0x1d2));var _0x6245=function(_0x215187,_0x2b94ee){_0x215187=_0x215187-0x0;var _0x358cd1=_0x2456[_0x215187];return _0x358cd1;};'use strict';var _=require('lodash');var util=require(_0x6245('0x0'));var logger=require(_0x6245('0x1'))('api');var moment=require(_0x6245('0x2'));var BPromise=require(_0x6245('0x3'));var rp=require(_0x6245('0x4'));var fs=require('fs');var path=require(_0x6245('0x5'));var rimraf=require(_0x6245('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x6245('0x7')]=function(_0x4e61c4,_0x18b899){return _0x4e61c4[_0x6245('0x8')](_0x6245('0x9'),attributes,{'tableName':_0x6245('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x6245('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 07711b4..e325cf0 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 _0x357f=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x42e8b1,_0x41843f){var _0x378f8e=function(_0x37d072){while(--_0x37d072){_0x42e8b1['push'](_0x42e8b1['shift']());}};_0x378f8e(++_0x41843f);}(_0x357f,0x125));var _0xf357=function(_0x4fe82c,_0xc0be8a){_0x4fe82c=_0x4fe82c-0x0;var _0x253da3=_0x357f[_0x4fe82c];return _0x253da3;};'use strict';var _=require(_0xf357('0x0'));var util=require(_0xf357('0x1'));var moment=require(_0xf357('0x2'));var BPromise=require(_0xf357('0x3'));var rs=require(_0xf357('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf357('0x5'))['db'];var utils=require(_0xf357('0x6'));var logger=require(_0xf357('0x7'))('rpc');var config=require(_0xf357('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf357('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cfc9f,_0x31164d,_0xae30d5){return new BPromise(function(_0x280481,_0x305474){return client['request'](_0x4cfc9f,_0xae30d5)[_0xf357('0xa')](function(_0x2f4d07){logger['info'](_0xf357('0xb'),_0x31164d,_0xf357('0xc'));logger['debug'](_0xf357('0xd'),_0x31164d,'request\x20sent',JSON['stringify'](_0x2f4d07));if(_0x2f4d07[_0xf357('0xe')]){if(_0x2f4d07[_0xf357('0xe')][_0xf357('0xf')]===0x1f4){logger[_0xf357('0xe')](_0xf357('0xb'),_0x31164d,_0x2f4d07[_0xf357('0xe')]['message']);return _0x305474(_0x2f4d07[_0xf357('0xe')]['message']);}logger[_0xf357('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x31164d,_0x2f4d07[_0xf357('0xe')][_0xf357('0x10')]);return _0x280481(_0x2f4d07[_0xf357('0xe')][_0xf357('0x10')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x31164d,_0xf357('0xc'));_0x280481(_0x2f4d07['result']['message']);}})['catch'](function(_0xbdc0f8){logger[_0xf357('0xe')](_0xf357('0xb'),_0x31164d,_0xbdc0f8);_0x305474(_0xbdc0f8);});});} \ No newline at end of file +var _0x4688=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x57252f,_0x1798b2){var _0x5ad1ae=function(_0x1cc75b){while(--_0x1cc75b){_0x57252f['push'](_0x57252f['shift']());}};_0x5ad1ae(++_0x1798b2);}(_0x4688,0x192));var _0x8468=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x4688[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x8468('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8468('0x1'));var fs=require('fs');var Redis=require(_0x8468('0x2'));var db=require(_0x8468('0x3'))['db'];var utils=require(_0x8468('0x4'));var logger=require(_0x8468('0x5'))(_0x8468('0x6'));var config=require(_0x8468('0x7'));var jayson=require(_0x8468('0x8'));var client=jayson[_0x8468('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5616df,_0x1b117e,_0x307d1e){return new BPromise(function(_0x348480,_0x55bcd9){return client[_0x8468('0xa')](_0x5616df,_0x307d1e)[_0x8468('0xb')](function(_0x5ab84f){logger[_0x8468('0xc')](_0x8468('0xd'),_0x1b117e,_0x8468('0xe'));logger[_0x8468('0xf')](_0x8468('0x10'),_0x1b117e,_0x8468('0xe'),JSON[_0x8468('0x11')](_0x5ab84f));if(_0x5ab84f[_0x8468('0x12')]){if(_0x5ab84f[_0x8468('0x12')][_0x8468('0x13')]===0x1f4){logger[_0x8468('0x12')](_0x8468('0xd'),_0x1b117e,_0x5ab84f[_0x8468('0x12')][_0x8468('0x14')]);return _0x55bcd9(_0x5ab84f[_0x8468('0x12')]['message']);}logger['error'](_0x8468('0xd'),_0x1b117e,_0x5ab84f['error']['message']);return _0x348480(_0x5ab84f[_0x8468('0x12')]['message']);}else{logger['info'](_0x8468('0xd'),_0x1b117e,'request\x20sent');_0x348480(_0x5ab84f[_0x8468('0x15')][_0x8468('0x14')]);}})[_0x8468('0x16')](function(_0x2eed21){logger[_0x8468('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x1b117e,_0x2eed21);_0x55bcd9(_0x2eed21);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 07b624c..8d831fd 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 _0x8edd=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound'];(function(_0x39e309,_0x1b260b){var _0x180c8a=function(_0x1056a3){while(--_0x1056a3){_0x39e309['push'](_0x39e309['shift']());}};_0x180c8a(++_0x1b260b);}(_0x8edd,0xea));var _0xd8ed=function(_0x51c463,_0x1313c2){_0x51c463=_0x51c463-0x0;var _0x4666a7=_0x8edd[_0x51c463];return _0x4666a7;};'use strict';var multer=require(_0xd8ed('0x0'));var util=require(_0xd8ed('0x1'));var path=require(_0xd8ed('0x2'));var timeout=require(_0xd8ed('0x3'));var express=require(_0xd8ed('0x4'));var router=express[_0xd8ed('0x5')]();var fs_extra=require(_0xd8ed('0x6'));var auth=require(_0xd8ed('0x7'));var interaction=require(_0xd8ed('0x8'));var config=require(_0xd8ed('0x9'));var controller=require(_0xd8ed('0xa'));router[_0xd8ed('0xb')]('/',auth[_0xd8ed('0xc')](),controller[_0xd8ed('0xd')]);router['get'](_0xd8ed('0xe'),auth['isAuthenticated'](),controller[_0xd8ed('0xf')]);router['get'](_0xd8ed('0x10'),auth[_0xd8ed('0xc')](),controller[_0xd8ed('0x11')]);router[_0xd8ed('0x12')]('/',auth[_0xd8ed('0xc')](),controller['create']);router[_0xd8ed('0x12')](_0xd8ed('0x10'),auth[_0xd8ed('0xc')](),controller[_0xd8ed('0x13')]);router[_0xd8ed('0x14')](_0xd8ed('0xe'),auth[_0xd8ed('0xc')](),controller[_0xd8ed('0x15')]);router[_0xd8ed('0x16')](_0xd8ed('0xe'),auth['isAuthenticated'](),controller[_0xd8ed('0x17')]);router[_0xd8ed('0x16')](_0xd8ed('0x18'),auth[_0xd8ed('0xc')](),controller[_0xd8ed('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc785=['show','/:id/sounds','getSounds','create','post','addSound','put','delete','destroy','/:id/sounds/:id2','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0xc785,0x155));var _0x5c78=function(_0x599f1b,_0x479baf){_0x599f1b=_0x599f1b-0x0;var _0x367622=_0xc785[_0x599f1b];return _0x367622;};'use strict';var multer=require(_0x5c78('0x0'));var util=require(_0x5c78('0x1'));var path=require('path');var timeout=require(_0x5c78('0x2'));var express=require(_0x5c78('0x3'));var router=express[_0x5c78('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5c78('0x5'));var interaction=require(_0x5c78('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x5c78('0x7')]('/',auth[_0x5c78('0x8')](),controller[_0x5c78('0x9')]);router[_0x5c78('0x7')](_0x5c78('0xa'),auth['isAuthenticated'](),controller[_0x5c78('0xb')]);router['get'](_0x5c78('0xc'),auth['isAuthenticated'](),controller[_0x5c78('0xd')]);router['post']('/',auth[_0x5c78('0x8')](),controller[_0x5c78('0xe')]);router[_0x5c78('0xf')]('/:id/sounds',auth[_0x5c78('0x8')](),controller[_0x5c78('0x10')]);router[_0x5c78('0x11')](_0x5c78('0xa'),auth[_0x5c78('0x8')](),controller['update']);router[_0x5c78('0x12')](_0x5c78('0xa'),auth['isAuthenticated'](),controller[_0x5c78('0x13')]);router[_0x5c78('0x12')](_0x5c78('0x14'),auth[_0x5c78('0x8')](),controller['removeSound']);module[_0x5c78('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index bad5677..e654316 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 _0x96e9=['sequelize','exports','STRING','ENUM','quietmp3nb','mp3','files','alpha','BOOLEAN'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x96e9,0x14d));var _0x996e=function(_0x233765,_0x58b722){_0x233765=_0x233765-0x0;var _0x46493d=_0x96e9[_0x233765];return _0x46493d;};'use strict';var Sequelize=require(_0x996e('0x0'));module[_0x996e('0x1')]={'name':{'type':Sequelize[_0x996e('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x996e('0x3')]('custom','files','mp3nb',_0x996e('0x4'),'quietmp3',_0x996e('0x5')),'allowNull':!![],'defaultValue':_0x996e('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x996e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x996e('0x2')],'allowNull':!![],'defaultValue':_0x996e('0x7')},'format':{'type':Sequelize[_0x996e('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x996e('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0317=['exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','TIMESTAMP'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x0317,0x1b9));var _0x7031=function(_0x2a418f,_0x39b19c){_0x2a418f=_0x2a418f-0x0;var _0x5ebd7e=_0x0317[_0x2a418f];return _0x5ebd7e;};'use strict';var Sequelize=require('sequelize');module[_0x7031('0x0')]={'name':{'type':Sequelize[_0x7031('0x1')],'allowNull':![],'unique':_0x7031('0x2')},'mode':{'type':Sequelize[_0x7031('0x3')](_0x7031('0x4'),_0x7031('0x5'),_0x7031('0x6'),_0x7031('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7031('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7031('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x7031('0x1')],'allowNull':!![]},'stamp':{'type':_0x7031('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index bd1828d..ed753ef 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 _0xf93d=['zip-dir','fast-json-patch','bluebird','util','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','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','options','includeAll','include','findAll','rows','show','params','length','catch','find','body','create','sequelize','mode','join','server/files/moh','files','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','transaction','readdirSync','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','createdAt','root','server/files/sounds/converted','format','%s.%s','save_name','extname','converted_format','symlinkSync','Sequelize','removeSound','id2','pick','merge','getSounds','rimraf'];(function(_0x3bb885,_0x2412be){var _0x3274f6=function(_0x3d33e7){while(--_0x3d33e7){_0x3bb885['push'](_0x3bb885['shift']());}};_0x3274f6(++_0x2412be);}(_0xf93d,0x146));var _0xdf93=function(_0xa1898c,_0x30b5fa){_0xa1898c=_0xa1898c-0x0;var _0x48bfe2=_0xf93d[_0xa1898c];return _0x48bfe2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf93('0x0'));var zipdir=require(_0xdf93('0x1'));var jsonpatch=require(_0xdf93('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf93('0x3'));var Mustache=require('mustache');var util=require(_0xdf93('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xdf93('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf93('0x6'));var _=require(_0xdf93('0x7'));var squel=require(_0xdf93('0x8'));var crypto=require(_0xdf93('0x9'));var jsforce=require(_0xdf93('0xa'));var deskjs=require(_0xdf93('0xb'));var toCsv=require(_0xdf93('0x5'));var querystring=require('querystring');var Papa=require(_0xdf93('0xc'));var Redis=require(_0xdf93('0xd'));var authService=require(_0xdf93('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdf93('0xf'));var hardwareService=require(_0xdf93('0x10'));var logger=require(_0xdf93('0x11'))(_0xdf93('0x12'));var utils=require('../../config/utils');var config=require(_0xdf93('0x13'));var licenseUtil=require(_0xdf93('0x14'));var db=require(_0xdf93('0x15'))['db'];function respondWithStatusCode(_0x54cf99,_0x492ceb){_0x492ceb=_0x492ceb||0xcc;return function(_0x3ffa93){if(_0x3ffa93){return _0x54cf99[_0xdf93('0x16')](_0x492ceb);}return _0x54cf99[_0xdf93('0x17')](_0x492ceb)[_0xdf93('0x18')]();};}function respondWithResult(_0x36bb25,_0x31c5fb){_0x31c5fb=_0x31c5fb||0xc8;return function(_0x31a9cb){if(_0x31a9cb){return _0x36bb25[_0xdf93('0x17')](_0x31c5fb)[_0xdf93('0x19')](_0x31a9cb);}};}function respondWithFilteredResult(_0x588b82,_0x1cb06c){return function(_0x53b1ec){if(_0x53b1ec){var _0x49017e=typeof _0x1cb06c[_0xdf93('0x1a')]===_0xdf93('0x1b')&&typeof _0x1cb06c[_0xdf93('0x1c')]===_0xdf93('0x1b');var _0x5e8e08=_0x53b1ec[_0xdf93('0x1d')];var _0x2f9d6b=_0x49017e?0x0:_0x1cb06c[_0xdf93('0x1a')];var _0xcec470=_0x49017e?_0x53b1ec[_0xdf93('0x1d')]:_0x1cb06c[_0xdf93('0x1a')]+_0x1cb06c[_0xdf93('0x1c')];var _0x2ac0fa;if(_0xcec470>=_0x5e8e08){_0xcec470=_0x5e8e08;_0x2ac0fa=0xc8;}else{_0x2ac0fa=0xce;}_0x588b82[_0xdf93('0x17')](_0x2ac0fa);return _0x588b82[_0xdf93('0x1e')](_0xdf93('0x1f'),_0x2f9d6b+'-'+_0xcec470+'/'+_0x5e8e08)[_0xdf93('0x19')](_0x53b1ec);}return null;};}function patchUpdates(_0x3e371b){return function(_0x1d9b06){try{jsonpatch['apply'](_0x1d9b06,_0x3e371b,!![]);}catch(_0x226000){return BPromise[_0xdf93('0x20')](_0x226000);}return _0x1d9b06[_0xdf93('0x21')]();};}function saveUpdates(_0x9e024a,_0x2a9bce){return function(_0x56e003){if(_0x56e003){return _0x56e003[_0xdf93('0x22')](_0x9e024a)[_0xdf93('0x23')](function(_0x21ce9b){return _0x21ce9b;});}return null;};}function removeEntity(_0x3e8c36,_0x30b5e5){return function(_0x53b173){if(_0x53b173){return _0x53b173[_0xdf93('0x24')]()[_0xdf93('0x23')](function(){var _0x421ecb=_0x53b173[_0xdf93('0x25')]({'plain':!![]});var _0x3e662c=_0xdf93('0x26');return db[_0xdf93('0x27')]['destroy']({'where':{'type':_0x3e662c,'resourceId':_0x421ecb['id']}})[_0xdf93('0x23')](function(){return _0x53b173;});})['then'](function(){_0x3e8c36['status'](0xcc)[_0xdf93('0x18')]();});}};}function handleEntityNotFound(_0x53668a,_0x1c799d){return function(_0xac9988){if(!_0xac9988){_0x53668a['sendStatus'](0x194);}return _0xac9988;};}function handleError(_0x594360,_0x7c4908){_0x7c4908=_0x7c4908||0x1f4;return function(_0x1f5dd8){logger[_0xdf93('0x28')](_0x1f5dd8['stack']);if(_0x1f5dd8[_0xdf93('0x29')]){delete _0x1f5dd8[_0xdf93('0x29')];}_0x594360[_0xdf93('0x17')](_0x7c4908)[_0xdf93('0x2a')](_0x1f5dd8);};}exports['index']=function(_0x20fea3,_0x2c55e){var _0xa73c96={},_0x2e634e={},_0x4b6127={'count':0x0,'rows':[]};var _0x1b7e86=_[_0xdf93('0x2b')](db[_0xdf93('0x2c')][_0xdf93('0x2d')],function(_0x314599){return{'name':_0x314599[_0xdf93('0x2e')],'type':_0x314599['type'][_0xdf93('0x2f')]};});_0x2e634e[_0xdf93('0x30')]=_[_0xdf93('0x2b')](_0x1b7e86,_0xdf93('0x29'));_0x2e634e['query']=_[_0xdf93('0x31')](_0x20fea3[_0xdf93('0x32')]);_0x2e634e[_0xdf93('0x33')]=_[_0xdf93('0x34')](_0x2e634e[_0xdf93('0x30')],_0x2e634e[_0xdf93('0x32')]);_0xa73c96[_0xdf93('0x35')]=_['intersection'](_0x2e634e[_0xdf93('0x30')],qs[_0xdf93('0x36')](_0x20fea3[_0xdf93('0x32')]['fields']));_0xa73c96['attributes']=_0xa73c96[_0xdf93('0x35')]['length']?_0xa73c96[_0xdf93('0x35')]:_0x2e634e['model'];if(!_0x20fea3[_0xdf93('0x32')][_0xdf93('0x37')](_0xdf93('0x38'))){_0xa73c96[_0xdf93('0x1c')]=qs[_0xdf93('0x1c')](_0x20fea3[_0xdf93('0x32')][_0xdf93('0x1c')]);_0xa73c96['offset']=qs[_0xdf93('0x1a')](_0x20fea3[_0xdf93('0x32')][_0xdf93('0x1a')]);}_0xa73c96[_0xdf93('0x39')]=qs[_0xdf93('0x3a')](_0x20fea3[_0xdf93('0x32')][_0xdf93('0x3a')]);delete _0x20fea3[_0xdf93('0x32')]['sort'];_0xa73c96['where']=qs[_0xdf93('0x33')](_['pick'](_0x20fea3[_0xdf93('0x32')],_0x2e634e[_0xdf93('0x33')]),_0x1b7e86);if(_0x20fea3[_0xdf93('0x32')][_0xdf93('0x3b')]){_0xa73c96[_0xdf93('0x3c')]=_['merge'](_0xa73c96['where'],{'$or':_['map'](_0x1b7e86,function(_0x5cd7b7){if(_0x5cd7b7['type']!=='VIRTUAL'){var _0x1ebf1c={};_0x1ebf1c[_0x5cd7b7[_0xdf93('0x29')]]={'$like':'%'+_0x20fea3[_0xdf93('0x32')][_0xdf93('0x3b')]+'%'};return _0x1ebf1c;}})});}_0xa73c96=_['merge']({},_0xa73c96,_0x20fea3[_0xdf93('0x3d')]);var _0x42bfa4={'where':_0xa73c96[_0xdf93('0x3c')]};return db[_0xdf93('0x2c')]['count'](_0x42bfa4)['then'](function(_0x38f688){_0x4b6127[_0xdf93('0x1d')]=_0x38f688;if(_0x20fea3[_0xdf93('0x32')][_0xdf93('0x3e')]){_0xa73c96[_0xdf93('0x3f')]=[{'all':!![]}];}return db[_0xdf93('0x2c')][_0xdf93('0x40')](_0xa73c96);})[_0xdf93('0x23')](function(_0x31a089){_0x4b6127[_0xdf93('0x41')]=_0x31a089;return _0x4b6127;})[_0xdf93('0x23')](respondWithFilteredResult(_0x2c55e,_0xa73c96))['catch'](handleError(_0x2c55e,null));};exports[_0xdf93('0x42')]=function(_0x2e6a52,_0x23aa1a){var _0x271fbd={'raw':![],'where':{'id':_0x2e6a52[_0xdf93('0x43')]['id']}},_0x49d9fe={};_0x49d9fe[_0xdf93('0x30')]=_[_0xdf93('0x31')](db[_0xdf93('0x2c')][_0xdf93('0x2d')]);_0x49d9fe[_0xdf93('0x32')]=_['keys'](_0x2e6a52[_0xdf93('0x32')]);_0x49d9fe[_0xdf93('0x33')]=_[_0xdf93('0x34')](_0x49d9fe[_0xdf93('0x30')],_0x49d9fe[_0xdf93('0x32')]);_0x271fbd[_0xdf93('0x35')]=_[_0xdf93('0x34')](_0x49d9fe[_0xdf93('0x30')],qs[_0xdf93('0x36')](_0x2e6a52['query'][_0xdf93('0x36')]));_0x271fbd[_0xdf93('0x35')]=_0x271fbd[_0xdf93('0x35')][_0xdf93('0x44')]?_0x271fbd[_0xdf93('0x35')]:_0x49d9fe[_0xdf93('0x30')];if(_0x2e6a52['query'][_0xdf93('0x3e')]){_0x271fbd[_0xdf93('0x3f')]=[{'all':!![]}];}_0x271fbd=_['merge']({},_0x271fbd,_0x2e6a52[_0xdf93('0x3d')]);return db[_0xdf93('0x2c')]['find'](_0x271fbd)[_0xdf93('0x23')](handleEntityNotFound(_0x23aa1a,null))[_0xdf93('0x23')](respondWithResult(_0x23aa1a,null))[_0xdf93('0x45')](handleError(_0x23aa1a,null));};exports[_0xdf93('0x22')]=function(_0xae3d71,_0x4c528e){if(_0xae3d71['body']['id']){delete _0xae3d71['body']['id'];}return db[_0xdf93('0x2c')][_0xdf93('0x46')]({'where':{'id':_0xae3d71['params']['id']}})['then'](handleEntityNotFound(_0x4c528e,null))[_0xdf93('0x23')](saveUpdates(_0xae3d71[_0xdf93('0x47')],null))['then'](respondWithResult(_0x4c528e,null))[_0xdf93('0x45')](handleError(_0x4c528e,null));};exports[_0xdf93('0x48')]=function(_0x3551c6,_0x398778,_0x5c5074){return db[_0xdf93('0x49')]['transaction'](function(_0x34fdc0){if(_0x3551c6[_0xdf93('0x47')][_0xdf93('0x4a')]==='files'){_0x3551c6[_0xdf93('0x47')]['directory']=path[_0xdf93('0x4b')](config['root'],_0xdf93('0x4c'),_0x3551c6[_0xdf93('0x47')]['name']);}return db[_0xdf93('0x2c')][_0xdf93('0x48')](_0x3551c6[_0xdf93('0x47')],{'transaction':_0x34fdc0})['then'](function(_0x4f8b4f){if(_0x3551c6['body'][_0xdf93('0x4a')]===_0xdf93('0x4d')){fs[_0xdf93('0x4e')](_0x4f8b4f[_0xdf93('0x4f')],parseInt(_0xdf93('0x50'),0x8));}var _0x2f820f=_0x3551c6[_0xdf93('0x51')]['get']({'plain':!![]});if(!_0x2f820f)throw new Error(_0xdf93('0x52'));if(_0x2f820f[_0xdf93('0x53')]===_0xdf93('0x51')){var _0x28a3db=_0x4f8b4f['get']({'plain':!![]});return db[_0xdf93('0x54')][_0xdf93('0x46')]({'where':{'name':_0xdf93('0x26'),'userProfileId':_0x2f820f['userProfileId']},'raw':!![]})[_0xdf93('0x23')](function(_0x48dc21){if(_0x48dc21&&_0x48dc21['autoAssociation']===0x0){return db[_0xdf93('0x27')][_0xdf93('0x48')]({'name':_0x28a3db[_0xdf93('0x29')],'resourceId':_0x28a3db['id'],'type':_0x48dc21[_0xdf93('0x29')],'sectionId':_0x48dc21['id']},{})[_0xdf93('0x23')](function(){return _0x4f8b4f;});}else{return _0x4f8b4f;}})[_0xdf93('0x45')](function(_0x4af925){logger[_0xdf93('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4af925);});}return _0x4f8b4f;});})[_0xdf93('0x23')](respondWithResult(_0x398778,0xc9))[_0xdf93('0x45')](handleError(_0x398778,null));};exports[_0xdf93('0x24')]=function(_0x5e52b3,_0x592879,_0x4db261){var _0x436800;return db[_0xdf93('0x2c')][_0xdf93('0x46')]({'where':{'id':_0x5e52b3[_0xdf93('0x43')]['id']}})[_0xdf93('0x23')](function(_0x7628e8){if(_0x7628e8){return db[_0xdf93('0x49')][_0xdf93('0x55')](function(_0x31eabd){return _0x7628e8[_0xdf93('0x24')]({'transaction':_0x31eabd,'raw':!![]})[_0xdf93('0x23')](function(_0x4933ac){if(_0x4933ac[_0xdf93('0x4f')]){fs[_0xdf93('0x56')](_0x4933ac[_0xdf93('0x4f')])['forEach'](function(_0x48072c){fs[_0xdf93('0x57')](path[_0xdf93('0x4b')](_0x4933ac['directory'],_0x48072c));});fs[_0xdf93('0x58')](_0x4933ac['directory']);}return _0x4933ac;});})[_0xdf93('0x45')](function(_0x454769){throw new db['Sequelize'][(_0xdf93('0x59'))](_0x454769[_0xdf93('0x5a')]);});}})['then'](handleEntityNotFound(_0x592879,null))[_0xdf93('0x23')](removeEntity(_0x592879,null))[_0xdf93('0x45')](handleError(_0x592879,null));};exports[_0xdf93('0x5b')]=function(_0x47bfde,_0x30a554,_0x2a9a3){return db['sequelize'][_0xdf93('0x55')](function(_0x5dbc73){var _0x500efb;return db[_0xdf93('0x2c')]['find']({'where':{'id':_0x47bfde[_0xdf93('0x43')]['id']}})[_0xdf93('0x23')](function(_0x5b4da1){if(_0x5b4da1){_0x500efb=_0x5b4da1;return _0x5b4da1['addSound'](_0x47bfde[_0xdf93('0x47')]['id'],{'transaction':_0x5dbc73});}})[_0xdf93('0x23')](function(_0x167752){if(_0x167752){return db[_0xdf93('0x5c')][_0xdf93('0x5d')]({'where':{'id':_0x47bfde['body']['id']},'attributes':['id',_0xdf93('0x29'),'save_name','converted_format',_0xdf93('0x5e')],'raw':!![]});}})[_0xdf93('0x23')](function(_0xd430f1){if(_0xd430f1){var _0x12ad5a=path[_0xdf93('0x4b')](config[_0xdf93('0x5f')],_0xdf93('0x60'),util[_0xdf93('0x61')](_0xdf93('0x62'),path['basename'](_0xd430f1[_0xdf93('0x63')],path[_0xdf93('0x64')](_0xd430f1[_0xdf93('0x63')])),_0xd430f1[_0xdf93('0x65')]));var _0x22f1bf=path[_0xdf93('0x4b')](config['root'],_0xdf93('0x4c'),_0x500efb[_0xdf93('0x29')],util[_0xdf93('0x61')](_0xdf93('0x62'),_0xd430f1[_0xdf93('0x29')],_0xd430f1['converted_format']));fs[_0xdf93('0x66')](_0x12ad5a,_0x22f1bf);return _0xd430f1;}})[_0xdf93('0x45')](function(_0x164ef0){throw new db[(_0xdf93('0x67'))][(_0xdf93('0x59'))](_0x164ef0[_0xdf93('0x5a')]);});})[_0xdf93('0x23')](handleEntityNotFound(_0x30a554,null))[_0xdf93('0x23')](respondWithResult(_0x30a554,0xc9))['catch'](handleError(_0x30a554,null));};exports[_0xdf93('0x68')]=function(_0x48085c,_0x4bd1cb,_0x9e398e){return db['sequelize']['transaction'](function(_0x3d2fcd){var _0x30209c;return db[_0xdf93('0x2c')][_0xdf93('0x5d')]({'where':{'id':_0x48085c['params']['id']}})['then'](handleEntityNotFound(_0x4bd1cb,null))[_0xdf93('0x23')](function(_0x435792){if(_0x435792){_0x30209c=_0x435792;return _0x435792[_0xdf93('0x68')](_0x48085c['params'][_0xdf93('0x69')]);}})[_0xdf93('0x23')](function(_0x361057){if(_0x361057){return db[_0xdf93('0x5c')]['findOne']({'where':{'id':_0x48085c[_0xdf93('0x43')]['id2']},'attributes':['id',_0xdf93('0x29'),'save_name','converted_format',_0xdf93('0x5e')],'raw':!![]});}})['then'](function(_0x279669){if(_0x279669){fs[_0xdf93('0x57')](path[_0xdf93('0x4b')](_0x30209c[_0xdf93('0x4f')],util['format'](_0xdf93('0x62'),_0x279669[_0xdf93('0x29')],_0x279669[_0xdf93('0x65')])));return _0x279669;}})[_0xdf93('0x45')](function(_0x5ed987){throw new db['Sequelize']['ValidationError'](_0x5ed987[_0xdf93('0x5a')]);});})[_0xdf93('0x23')](handleEntityNotFound(_0x4bd1cb,null))['then'](respondWithStatusCode(_0x4bd1cb,0xcc))[_0xdf93('0x45')](handleError(_0x4bd1cb,null));};exports['getSounds']=function(_0xcc7d2e,_0x58f0fe,_0x5b72f0){var _0x16bb3c={};var _0xa2d93f={};var _0x4f4929;var _0x28e659;return db[_0xdf93('0x2c')]['findOne']({'where':{'id':_0xcc7d2e[_0xdf93('0x43')]['id']}})[_0xdf93('0x23')](handleEntityNotFound(_0x58f0fe,null))[_0xdf93('0x23')](function(_0x488e31){if(_0x488e31){_0x4f4929=_0x488e31;_0xa2d93f['model']=_[_0xdf93('0x31')](db[_0xdf93('0x5c')]['rawAttributes']);_0xa2d93f[_0xdf93('0x32')]=_[_0xdf93('0x31')](_0xcc7d2e['query']);_0xa2d93f['filters']=_[_0xdf93('0x34')](_0xa2d93f[_0xdf93('0x30')],_0xa2d93f['query']);_0x16bb3c[_0xdf93('0x35')]=_[_0xdf93('0x34')](_0xa2d93f[_0xdf93('0x30')],qs[_0xdf93('0x36')](_0xcc7d2e[_0xdf93('0x32')][_0xdf93('0x36')]));_0x16bb3c[_0xdf93('0x35')]=_0x16bb3c[_0xdf93('0x35')][_0xdf93('0x44')]?_0x16bb3c[_0xdf93('0x35')]:_0xa2d93f[_0xdf93('0x30')];_0x16bb3c[_0xdf93('0x39')]=qs[_0xdf93('0x3a')](_0xcc7d2e['query'][_0xdf93('0x3a')]);_0x16bb3c[_0xdf93('0x3c')]=qs[_0xdf93('0x33')](_[_0xdf93('0x6a')](_0xcc7d2e[_0xdf93('0x32')],_0xa2d93f[_0xdf93('0x33')]));if(_0xcc7d2e['query'][_0xdf93('0x3b')]){_0x16bb3c[_0xdf93('0x3c')]=_[_0xdf93('0x6b')](_0x16bb3c[_0xdf93('0x3c')],{'$or':_[_0xdf93('0x2b')](_0x16bb3c[_0xdf93('0x35')],function(_0x4b4a76){var _0x481c7d={};_0x481c7d[_0x4b4a76]={'$like':'%'+_0xcc7d2e[_0xdf93('0x32')][_0xdf93('0x3b')]+'%'};return _0x481c7d;})});}_0x16bb3c=_['merge']({},_0x16bb3c,_0xcc7d2e[_0xdf93('0x3d')]);return _0x4f4929[_0xdf93('0x6c')](_0x16bb3c);}})['then'](function(_0x56d50b){if(_0x56d50b){_0x28e659=_0x56d50b[_0xdf93('0x44')];if(!_0xcc7d2e[_0xdf93('0x32')][_0xdf93('0x37')]('nolimit')){_0x16bb3c[_0xdf93('0x1c')]=qs[_0xdf93('0x1c')](_0xcc7d2e['query']['limit']);_0x16bb3c[_0xdf93('0x1a')]=qs[_0xdf93('0x1a')](_0xcc7d2e[_0xdf93('0x32')][_0xdf93('0x1a')]);}return _0x4f4929['getSounds'](_0x16bb3c);}})[_0xdf93('0x23')](function(_0x2c1717){if(_0x2c1717){return _0x2c1717?{'count':_0x28e659,'rows':_0x2c1717}:null;}})[_0xdf93('0x23')](respondWithResult(_0x58f0fe,null))[_0xdf93('0x45')](handleError(_0x58f0fe,null));}; \ No newline at end of file +var _0x4d20=['desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','destroy','get','MusicOnHolds','UserProfileResource','then','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','update','body','find','catch','create','sequelize','transaction','mode','directory','root','server/files/moh','files','mkdirSync','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','converted_format','symlinkSync','removeSound','id2','ValidationError','fields','order','getSounds','nolimit','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4d20,0x67));var _0x04d2=function(_0x22c096,_0x540fc9){_0x22c096=_0x22c096-0x0;var _0x50e037=_0x4d20[_0x22c096];return _0x50e037;};'use strict';var emlformat=require(_0x04d2('0x0'));var rimraf=require(_0x04d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04d2('0x2'));var rp=require('request-promise');var moment=require(_0x04d2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x04d2('0x4'));var util=require('util');var path=require(_0x04d2('0x5'));var sox=require(_0x04d2('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x04d2('0x7'));var _=require(_0x04d2('0x8'));var squel=require(_0x04d2('0x9'));var crypto=require(_0x04d2('0xa'));var jsforce=require(_0x04d2('0xb'));var deskjs=require(_0x04d2('0xc'));var toCsv=require(_0x04d2('0xd'));var querystring=require(_0x04d2('0xe'));var Papa=require(_0x04d2('0xf'));var Redis=require('ioredis');var authService=require(_0x04d2('0x10'));var qs=require(_0x04d2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04d2('0x12'));var logger=require('../../config/logger')(_0x04d2('0x13'));var utils=require(_0x04d2('0x14'));var config=require(_0x04d2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x04d2('0x16'))['db'];function respondWithStatusCode(_0x5bc15f,_0x471021){_0x471021=_0x471021||0xcc;return function(_0x9bd000){if(_0x9bd000){return _0x5bc15f[_0x04d2('0x17')](_0x471021);}return _0x5bc15f[_0x04d2('0x18')](_0x471021)[_0x04d2('0x19')]();};}function respondWithResult(_0x435219,_0xbd6a8c){_0xbd6a8c=_0xbd6a8c||0xc8;return function(_0x91515d){if(_0x91515d){return _0x435219[_0x04d2('0x18')](_0xbd6a8c)[_0x04d2('0x1a')](_0x91515d);}};}function respondWithFilteredResult(_0x4a17bc,_0x5f46b8){return function(_0x1d820b){if(_0x1d820b){var _0x5b6edb=typeof _0x5f46b8['offset']===_0x04d2('0x1b')&&typeof _0x5f46b8['limit']==='undefined';var _0x4607bd=_0x1d820b[_0x04d2('0x1c')];var _0x35eb7c=_0x5b6edb?0x0:_0x5f46b8[_0x04d2('0x1d')];var _0x3514cd=_0x5b6edb?_0x1d820b[_0x04d2('0x1c')]:_0x5f46b8[_0x04d2('0x1d')]+_0x5f46b8[_0x04d2('0x1e')];var _0x31ee9a;if(_0x3514cd>=_0x4607bd){_0x3514cd=_0x4607bd;_0x31ee9a=0xc8;}else{_0x31ee9a=0xce;}_0x4a17bc[_0x04d2('0x18')](_0x31ee9a);return _0x4a17bc['set'](_0x04d2('0x1f'),_0x35eb7c+'-'+_0x3514cd+'/'+_0x4607bd)[_0x04d2('0x1a')](_0x1d820b);}return null;};}function patchUpdates(_0x53511b){return function(_0x2790e7){try{jsonpatch[_0x04d2('0x20')](_0x2790e7,_0x53511b,!![]);}catch(_0x33bcce){return BPromise[_0x04d2('0x21')](_0x33bcce);}return _0x2790e7[_0x04d2('0x22')]();};}function saveUpdates(_0x160e45,_0x100de7){return function(_0x2ef225){if(_0x2ef225){return _0x2ef225['update'](_0x160e45)['then'](function(_0xb5e818){return _0xb5e818;});}return null;};}function removeEntity(_0x1ea512,_0x194fe4){return function(_0x2316ab){if(_0x2316ab){return _0x2316ab[_0x04d2('0x23')]()['then'](function(){var _0x22e09c=_0x2316ab[_0x04d2('0x24')]({'plain':!![]});var _0x50c6f5=_0x04d2('0x25');return db[_0x04d2('0x26')][_0x04d2('0x23')]({'where':{'type':_0x50c6f5,'resourceId':_0x22e09c['id']}})[_0x04d2('0x27')](function(){return _0x2316ab;});})[_0x04d2('0x27')](function(){_0x1ea512['status'](0xcc)[_0x04d2('0x19')]();});}};}function handleEntityNotFound(_0x408740,_0x1ac0b0){return function(_0x2e2cb3){if(!_0x2e2cb3){_0x408740[_0x04d2('0x17')](0x194);}return _0x2e2cb3;};}function handleError(_0x101d93,_0x4e50f7){_0x4e50f7=_0x4e50f7||0x1f4;return function(_0x204472){logger[_0x04d2('0x28')](_0x204472[_0x04d2('0x29')]);if(_0x204472[_0x04d2('0x2a')]){delete _0x204472[_0x04d2('0x2a')];}_0x101d93[_0x04d2('0x18')](_0x4e50f7)[_0x04d2('0x2b')](_0x204472);};}exports[_0x04d2('0x2c')]=function(_0x5654f0,_0x1605ce){var _0x3397b0={},_0x2cf5ff={},_0x5fbe4b={'count':0x0,'rows':[]};var _0x2ff09f=_[_0x04d2('0x2d')](db[_0x04d2('0x2e')][_0x04d2('0x2f')],function(_0x4ebaab){return{'name':_0x4ebaab[_0x04d2('0x30')],'type':_0x4ebaab[_0x04d2('0x31')][_0x04d2('0x32')]};});_0x2cf5ff[_0x04d2('0x33')]=_['map'](_0x2ff09f,'name');_0x2cf5ff[_0x04d2('0x34')]=_[_0x04d2('0x35')](_0x5654f0[_0x04d2('0x34')]);_0x2cf5ff[_0x04d2('0x36')]=_[_0x04d2('0x37')](_0x2cf5ff[_0x04d2('0x33')],_0x2cf5ff[_0x04d2('0x34')]);_0x3397b0[_0x04d2('0x38')]=_[_0x04d2('0x37')](_0x2cf5ff[_0x04d2('0x33')],qs['fields'](_0x5654f0[_0x04d2('0x34')]['fields']));_0x3397b0[_0x04d2('0x38')]=_0x3397b0[_0x04d2('0x38')]['length']?_0x3397b0[_0x04d2('0x38')]:_0x2cf5ff[_0x04d2('0x33')];if(!_0x5654f0['query'][_0x04d2('0x39')]('nolimit')){_0x3397b0[_0x04d2('0x1e')]=qs[_0x04d2('0x1e')](_0x5654f0[_0x04d2('0x34')][_0x04d2('0x1e')]);_0x3397b0[_0x04d2('0x1d')]=qs[_0x04d2('0x1d')](_0x5654f0[_0x04d2('0x34')][_0x04d2('0x1d')]);}_0x3397b0['order']=qs[_0x04d2('0x3a')](_0x5654f0['query'][_0x04d2('0x3a')]);delete _0x5654f0[_0x04d2('0x34')][_0x04d2('0x3a')];_0x3397b0[_0x04d2('0x3b')]=qs[_0x04d2('0x36')](_[_0x04d2('0x3c')](_0x5654f0[_0x04d2('0x34')],_0x2cf5ff[_0x04d2('0x36')]),_0x2ff09f);if(_0x5654f0['query'][_0x04d2('0x3d')]){_0x3397b0[_0x04d2('0x3b')]=_[_0x04d2('0x3e')](_0x3397b0[_0x04d2('0x3b')],{'$or':_[_0x04d2('0x2d')](_0x2ff09f,function(_0x2b06ad){if(_0x2b06ad[_0x04d2('0x31')]!==_0x04d2('0x3f')){var _0xc5162e={};_0xc5162e[_0x2b06ad[_0x04d2('0x2a')]]={'$like':'%'+_0x5654f0['query'][_0x04d2('0x3d')]+'%'};return _0xc5162e;}})});}_0x3397b0=_[_0x04d2('0x3e')]({},_0x3397b0,_0x5654f0[_0x04d2('0x40')]);var _0xfe16af={'where':_0x3397b0[_0x04d2('0x3b')]};return db[_0x04d2('0x2e')]['count'](_0xfe16af)[_0x04d2('0x27')](function(_0xc5d72e){_0x5fbe4b[_0x04d2('0x1c')]=_0xc5d72e;if(_0x5654f0[_0x04d2('0x34')][_0x04d2('0x41')]){_0x3397b0[_0x04d2('0x42')]=[{'all':!![]}];}return db[_0x04d2('0x2e')][_0x04d2('0x43')](_0x3397b0);})[_0x04d2('0x27')](function(_0x4ca810){_0x5fbe4b[_0x04d2('0x44')]=_0x4ca810;return _0x5fbe4b;})[_0x04d2('0x27')](respondWithFilteredResult(_0x1605ce,_0x3397b0))['catch'](handleError(_0x1605ce,null));};exports[_0x04d2('0x45')]=function(_0x304bff,_0x1b7383){var _0x50dd6e={'raw':![],'where':{'id':_0x304bff[_0x04d2('0x46')]['id']}},_0x4c54d9={};_0x4c54d9[_0x04d2('0x33')]=_['keys'](db[_0x04d2('0x2e')]['rawAttributes']);_0x4c54d9[_0x04d2('0x34')]=_['keys'](_0x304bff[_0x04d2('0x34')]);_0x4c54d9['filters']=_[_0x04d2('0x37')](_0x4c54d9[_0x04d2('0x33')],_0x4c54d9[_0x04d2('0x34')]);_0x50dd6e[_0x04d2('0x38')]=_['intersection'](_0x4c54d9['model'],qs['fields'](_0x304bff[_0x04d2('0x34')]['fields']));_0x50dd6e[_0x04d2('0x38')]=_0x50dd6e[_0x04d2('0x38')][_0x04d2('0x47')]?_0x50dd6e['attributes']:_0x4c54d9[_0x04d2('0x33')];if(_0x304bff[_0x04d2('0x34')][_0x04d2('0x41')]){_0x50dd6e['include']=[{'all':!![]}];}_0x50dd6e=_[_0x04d2('0x3e')]({},_0x50dd6e,_0x304bff[_0x04d2('0x40')]);return db['VoiceMusicOnHold']['find'](_0x50dd6e)[_0x04d2('0x27')](handleEntityNotFound(_0x1b7383,null))[_0x04d2('0x27')](respondWithResult(_0x1b7383,null))['catch'](handleError(_0x1b7383,null));};exports[_0x04d2('0x48')]=function(_0x2c29a8,_0x566910){if(_0x2c29a8[_0x04d2('0x49')]['id']){delete _0x2c29a8[_0x04d2('0x49')]['id'];}return db[_0x04d2('0x2e')][_0x04d2('0x4a')]({'where':{'id':_0x2c29a8[_0x04d2('0x46')]['id']}})[_0x04d2('0x27')](handleEntityNotFound(_0x566910,null))['then'](saveUpdates(_0x2c29a8['body'],null))[_0x04d2('0x27')](respondWithResult(_0x566910,null))[_0x04d2('0x4b')](handleError(_0x566910,null));};exports[_0x04d2('0x4c')]=function(_0x57a761,_0x2abcbe,_0x5af9ef){return db[_0x04d2('0x4d')][_0x04d2('0x4e')](function(_0x5581d5){if(_0x57a761[_0x04d2('0x49')][_0x04d2('0x4f')]==='files'){_0x57a761[_0x04d2('0x49')][_0x04d2('0x50')]=path['join'](config[_0x04d2('0x51')],_0x04d2('0x52'),_0x57a761['body'][_0x04d2('0x2a')]);}return db['VoiceMusicOnHold'][_0x04d2('0x4c')](_0x57a761[_0x04d2('0x49')],{'transaction':_0x5581d5})[_0x04d2('0x27')](function(_0x67061b){if(_0x57a761[_0x04d2('0x49')][_0x04d2('0x4f')]===_0x04d2('0x53')){fs[_0x04d2('0x54')](_0x67061b['directory'],parseInt('0777',0x8));}var _0x281f10=_0x57a761[_0x04d2('0x55')][_0x04d2('0x24')]({'plain':!![]});if(!_0x281f10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x281f10[_0x04d2('0x56')]==='user'){var _0x5e22b9=_0x67061b[_0x04d2('0x24')]({'plain':!![]});return db[_0x04d2('0x57')][_0x04d2('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x281f10[_0x04d2('0x58')]},'raw':!![]})[_0x04d2('0x27')](function(_0x194157){if(_0x194157&&_0x194157[_0x04d2('0x59')]===0x0){return db[_0x04d2('0x26')][_0x04d2('0x4c')]({'name':_0x5e22b9[_0x04d2('0x2a')],'resourceId':_0x5e22b9['id'],'type':_0x194157[_0x04d2('0x2a')],'sectionId':_0x194157['id']},{})[_0x04d2('0x27')](function(){return _0x67061b;});}else{return _0x67061b;}})[_0x04d2('0x4b')](function(_0xa2dfe0){logger['error'](_0x04d2('0x5a'),_0xa2dfe0);});}return _0x67061b;});})[_0x04d2('0x27')](respondWithResult(_0x2abcbe,0xc9))[_0x04d2('0x4b')](handleError(_0x2abcbe,null));};exports[_0x04d2('0x23')]=function(_0x9323c9,_0x36cc77,_0x4e7fe7){var _0x438d50;return db[_0x04d2('0x2e')][_0x04d2('0x4a')]({'where':{'id':_0x9323c9[_0x04d2('0x46')]['id']}})[_0x04d2('0x27')](function(_0x123ded){if(_0x123ded){return db['sequelize'][_0x04d2('0x4e')](function(_0x4ece37){return _0x123ded[_0x04d2('0x23')]({'transaction':_0x4ece37,'raw':!![]})[_0x04d2('0x27')](function(_0x14800a){if(_0x14800a[_0x04d2('0x50')]){fs[_0x04d2('0x5b')](_0x14800a[_0x04d2('0x50')])['forEach'](function(_0x2ccf44){fs[_0x04d2('0x5c')](path['join'](_0x14800a['directory'],_0x2ccf44));});fs[_0x04d2('0x5d')](_0x14800a[_0x04d2('0x50')]);}return _0x14800a;});})[_0x04d2('0x4b')](function(_0x24adc9){throw new db[(_0x04d2('0x5e'))]['ValidationError'](_0x24adc9[_0x04d2('0x5f')]);});}})[_0x04d2('0x27')](handleEntityNotFound(_0x36cc77,null))[_0x04d2('0x27')](removeEntity(_0x36cc77,null))['catch'](handleError(_0x36cc77,null));};exports[_0x04d2('0x60')]=function(_0x3f47cd,_0x619b6c,_0x2c68d4){return db[_0x04d2('0x4d')][_0x04d2('0x4e')](function(_0x38201f){var _0x4a7510;return db[_0x04d2('0x2e')]['find']({'where':{'id':_0x3f47cd[_0x04d2('0x46')]['id']}})[_0x04d2('0x27')](function(_0x1be41d){if(_0x1be41d){_0x4a7510=_0x1be41d;return _0x1be41d[_0x04d2('0x60')](_0x3f47cd['body']['id'],{'transaction':_0x38201f});}})[_0x04d2('0x27')](function(_0x5e0086){if(_0x5e0086){return db[_0x04d2('0x61')][_0x04d2('0x62')]({'where':{'id':_0x3f47cd[_0x04d2('0x49')]['id']},'attributes':['id','name',_0x04d2('0x63'),'converted_format',_0x04d2('0x64')],'raw':!![]});}})[_0x04d2('0x27')](function(_0x113c56){if(_0x113c56){var _0x5413f8=path[_0x04d2('0x65')](config['root'],_0x04d2('0x66'),util[_0x04d2('0x67')](_0x04d2('0x68'),path[_0x04d2('0x69')](_0x113c56[_0x04d2('0x63')],path['extname'](_0x113c56[_0x04d2('0x63')])),_0x113c56['converted_format']));var _0x499ae0=path['join'](config[_0x04d2('0x51')],_0x04d2('0x52'),_0x4a7510[_0x04d2('0x2a')],util['format'](_0x04d2('0x68'),_0x113c56['name'],_0x113c56[_0x04d2('0x6a')]));fs[_0x04d2('0x6b')](_0x5413f8,_0x499ae0);return _0x113c56;}})[_0x04d2('0x4b')](function(_0xffb7ad){throw new db[(_0x04d2('0x5e'))]['ValidationError'](_0xffb7ad[_0x04d2('0x5f')]);});})['then'](handleEntityNotFound(_0x619b6c,null))['then'](respondWithResult(_0x619b6c,0xc9))[_0x04d2('0x4b')](handleError(_0x619b6c,null));};exports[_0x04d2('0x6c')]=function(_0x538948,_0x3f6f8d,_0x55b88c){return db[_0x04d2('0x4d')]['transaction'](function(_0x1e2982){var _0x41eaf9;return db[_0x04d2('0x2e')]['findOne']({'where':{'id':_0x538948[_0x04d2('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f6f8d,null))['then'](function(_0x5b7c2d){if(_0x5b7c2d){_0x41eaf9=_0x5b7c2d;return _0x5b7c2d[_0x04d2('0x6c')](_0x538948[_0x04d2('0x46')][_0x04d2('0x6d')]);}})[_0x04d2('0x27')](function(_0xce47c6){if(_0xce47c6){return db[_0x04d2('0x61')]['findOne']({'where':{'id':_0x538948[_0x04d2('0x46')][_0x04d2('0x6d')]},'attributes':['id',_0x04d2('0x2a'),_0x04d2('0x63'),_0x04d2('0x6a'),'createdAt'],'raw':!![]});}})[_0x04d2('0x27')](function(_0x1e5728){if(_0x1e5728){fs['unlinkSync'](path[_0x04d2('0x65')](_0x41eaf9[_0x04d2('0x50')],util['format'](_0x04d2('0x68'),_0x1e5728[_0x04d2('0x2a')],_0x1e5728['converted_format'])));return _0x1e5728;}})['catch'](function(_0x3e9a72){throw new db['Sequelize'][(_0x04d2('0x6e'))](_0x3e9a72[_0x04d2('0x5f')]);});})[_0x04d2('0x27')](handleEntityNotFound(_0x3f6f8d,null))[_0x04d2('0x27')](respondWithStatusCode(_0x3f6f8d,0xcc))[_0x04d2('0x4b')](handleError(_0x3f6f8d,null));};exports['getSounds']=function(_0x51eef9,_0x2376ad,_0x215794){var _0x9ff9f3={};var _0x2404db={};var _0x4539a1;var _0x7f3cf3;return db['VoiceMusicOnHold'][_0x04d2('0x62')]({'where':{'id':_0x51eef9[_0x04d2('0x46')]['id']}})[_0x04d2('0x27')](handleEntityNotFound(_0x2376ad,null))[_0x04d2('0x27')](function(_0x253033){if(_0x253033){_0x4539a1=_0x253033;_0x2404db[_0x04d2('0x33')]=_[_0x04d2('0x35')](db['Sound'][_0x04d2('0x2f')]);_0x2404db[_0x04d2('0x34')]=_[_0x04d2('0x35')](_0x51eef9['query']);_0x2404db[_0x04d2('0x36')]=_[_0x04d2('0x37')](_0x2404db[_0x04d2('0x33')],_0x2404db[_0x04d2('0x34')]);_0x9ff9f3[_0x04d2('0x38')]=_[_0x04d2('0x37')](_0x2404db['model'],qs[_0x04d2('0x6f')](_0x51eef9[_0x04d2('0x34')][_0x04d2('0x6f')]));_0x9ff9f3[_0x04d2('0x38')]=_0x9ff9f3[_0x04d2('0x38')][_0x04d2('0x47')]?_0x9ff9f3[_0x04d2('0x38')]:_0x2404db[_0x04d2('0x33')];_0x9ff9f3[_0x04d2('0x70')]=qs[_0x04d2('0x3a')](_0x51eef9[_0x04d2('0x34')][_0x04d2('0x3a')]);_0x9ff9f3[_0x04d2('0x3b')]=qs[_0x04d2('0x36')](_[_0x04d2('0x3c')](_0x51eef9['query'],_0x2404db[_0x04d2('0x36')]));if(_0x51eef9[_0x04d2('0x34')][_0x04d2('0x3d')]){_0x9ff9f3['where']=_[_0x04d2('0x3e')](_0x9ff9f3[_0x04d2('0x3b')],{'$or':_[_0x04d2('0x2d')](_0x9ff9f3[_0x04d2('0x38')],function(_0x3443f7){var _0x206cf7={};_0x206cf7[_0x3443f7]={'$like':'%'+_0x51eef9[_0x04d2('0x34')][_0x04d2('0x3d')]+'%'};return _0x206cf7;})});}_0x9ff9f3=_[_0x04d2('0x3e')]({},_0x9ff9f3,_0x51eef9[_0x04d2('0x40')]);return _0x4539a1[_0x04d2('0x71')](_0x9ff9f3);}})[_0x04d2('0x27')](function(_0xe3a5c){if(_0xe3a5c){_0x7f3cf3=_0xe3a5c[_0x04d2('0x47')];if(!_0x51eef9['query'][_0x04d2('0x39')](_0x04d2('0x72'))){_0x9ff9f3[_0x04d2('0x1e')]=qs['limit'](_0x51eef9[_0x04d2('0x34')]['limit']);_0x9ff9f3[_0x04d2('0x1d')]=qs['offset'](_0x51eef9[_0x04d2('0x34')][_0x04d2('0x1d')]);}return _0x4539a1['getSounds'](_0x9ff9f3);}})[_0x04d2('0x27')](function(_0x21703d){if(_0x21703d){return _0x21703d?{'count':_0x7f3cf3,'rows':_0x21703d}:null;}})[_0x04d2('0x27')](respondWithResult(_0x2376ad,null))[_0x04d2('0x4b')](handleError(_0x2376ad,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0f2d6f2..863fd3a 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 _0x8ccf=['./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x18d0f7,_0x4ac90a){var _0x50cdc4=function(_0x186674){while(--_0x186674){_0x18d0f7['push'](_0x18d0f7['shift']());}};_0x50cdc4(++_0x4ac90a);}(_0x8ccf,0xeb));var _0xf8cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ccf[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xf8cc('0x0'));var logger=require(_0xf8cc('0x1'))(_0xf8cc('0x2'));var moment=require(_0xf8cc('0x3'));var BPromise=require('bluebird');var rp=require(_0xf8cc('0x4'));var fs=require('fs');var path=require(_0xf8cc('0x5'));var rimraf=require(_0xf8cc('0x6'));var config=require('../../config/environment');var attributes=require(_0xf8cc('0x7'));module[_0xf8cc('0x8')]=function(_0x914be0,_0x34d7d1){return _0x914be0['define'](_0xf8cc('0x9'),attributes,{'tableName':_0xf8cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75c5=['rimraf','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','path'];(function(_0xbef815,_0x4deda0){var _0x298277=function(_0x20e5e0){while(--_0x20e5e0){_0xbef815['push'](_0xbef815['shift']());}};_0x298277(++_0x4deda0);}(_0x75c5,0xb5));var _0x575c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75c5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x575c('0x0'));var util=require(_0x575c('0x1'));var logger=require('../../config/logger')(_0x575c('0x2'));var moment=require(_0x575c('0x3'));var BPromise=require(_0x575c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x575c('0x5'));var rimraf=require(_0x575c('0x6'));var config=require(_0x575c('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x27c428,_0x1c59db){return _0x27c428[_0x575c('0x8')](_0x575c('0x9'),attributes,{'tableName':_0x575c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 4e76a5d..94175d0 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1afe4f,_0x4e5259){var _0x2cd64f=function(_0x556e37){while(--_0x556e37){_0x1afe4f['push'](_0x1afe4f['shift']());}};_0x2cd64f(++_0x4e5259);}(_0x70e0,0x17b));var _0x070e=function(_0x51a7a6,_0x3edfdf){_0x51a7a6=_0x51a7a6-0x0;var _0x206965=_0x70e0[_0x51a7a6];return _0x206965;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1e40c1,_0x52d526){var _0x330087=function(_0x2fe55d){while(--_0x2fe55d){_0x1e40c1['push'](_0x1e40c1['shift']());}};_0x330087(++_0x52d526);}(_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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8afff4b..e3c3d30 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 _0xf041=['Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/:id/users','getAgents','getTeams','post','create','addAgents','/:id/teams','update','destroy','delete','removeAgents','removeTeams','exports','path','connect-timeout','express'];(function(_0x5ba206,_0x3f85ad){var _0xbb0c62=function(_0x9967e5){while(--_0x9967e5){_0x5ba206['push'](_0x5ba206['shift']());}};_0xbb0c62(++_0x3f85ad);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f04('0x0'));var timeout=require(_0x1f04('0x1'));var express=require(_0x1f04('0x2'));var router=express[_0x1f04('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f04('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f04('0x5'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x1f04('0x6')](),controller['index']);router[_0x1f04('0x7')](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x9')]);router['get'](_0x1f04('0xa'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xb')]);router[_0x1f04('0x7')](_0x1f04('0xc'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xd')]);router[_0x1f04('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1f04('0xe')]);router[_0x1f04('0xf')]('/',auth[_0x1f04('0x6')](),controller[_0x1f04('0x10')]);router[_0x1f04('0xf')](_0x1f04('0xc'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x11')]);router[_0x1f04('0xf')](_0x1f04('0x12'),auth[_0x1f04('0x6')](),controller['addTeams']);router['put'](_0x1f04('0xa'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x13')]);router['delete'](_0x1f04('0xa'),auth['isAuthenticated'](),controller[_0x1f04('0x14')]);router[_0x1f04('0x15')](_0x1f04('0xc'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x16')]);router[_0x1f04('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1f04('0x17')]);module[_0x1f04('0x18')]=router; \ No newline at end of file +var _0x8250=['connect-timeout','Router','fs-extra','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','/:id','show','/:id/teams','getTeams','post','/:id/users','addAgents','delete','destroy','removeAgents','removeTeams','exports','multer','util','path'];(function(_0x516999,_0x2b4092){var _0x8fe032=function(_0x54833d){while(--_0x54833d){_0x516999['push'](_0x516999['shift']());}};_0x8fe032(++_0x2b4092);}(_0x8250,0xfa));var _0x0825=function(_0x1a898e,_0x2fb731){_0x1a898e=_0x1a898e-0x0;var _0x4f5989=_0x8250[_0x1a898e];return _0x4f5989;};'use strict';var multer=require(_0x0825('0x0'));var util=require(_0x0825('0x1'));var path=require(_0x0825('0x2'));var timeout=require(_0x0825('0x3'));var express=require('express');var router=express[_0x0825('0x4')]();var fs_extra=require(_0x0825('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0825('0x6'));var config=require('../../config/environment');var controller=require(_0x0825('0x7'));router['get']('/',auth[_0x0825('0x8')](),controller[_0x0825('0x9')]);router[_0x0825('0xa')]('/describe',auth[_0x0825('0x8')](),controller['describe']);router[_0x0825('0xa')](_0x0825('0xb'),auth[_0x0825('0x8')](),controller[_0x0825('0xc')]);router[_0x0825('0xa')]('/:id/users',auth[_0x0825('0x8')](),controller['getAgents']);router[_0x0825('0xa')](_0x0825('0xd'),auth[_0x0825('0x8')](),controller[_0x0825('0xe')]);router[_0x0825('0xf')]('/',auth[_0x0825('0x8')](),controller['create']);router[_0x0825('0xf')](_0x0825('0x10'),auth[_0x0825('0x8')](),controller[_0x0825('0x11')]);router[_0x0825('0xf')](_0x0825('0xd'),auth[_0x0825('0x8')](),controller['addTeams']);router['put']('/:id',auth[_0x0825('0x8')](),controller['update']);router[_0x0825('0x12')](_0x0825('0xb'),auth[_0x0825('0x8')](),controller[_0x0825('0x13')]);router[_0x0825('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x0825('0x14')]);router['delete']('/:id/teams',auth[_0x0825('0x8')](),controller[_0x0825('0x15')]);module[_0x0825('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1c7b381..6691668 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 _0xcb3e=['INTEGER','sequelize','exports','STRING','name','system-'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0xcb3e,0xbb));var _0xecb3=function(_0x21545d,_0x50f771){_0x21545d=_0x21545d-0x0;var _0x3d782b=_0xcb3e[_0x21545d];return _0x3d782b;};'use strict';var Sequelize=require(_0xecb3('0x0'));module[_0xecb3('0x1')]={'name':{'type':Sequelize[_0xecb3('0x2')],'allowNull':![],'unique':_0xecb3('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x206574){return _0xecb3('0x4')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xecb3('0x2')]},'callerIdAll':{'type':Sequelize[_0xecb3('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xecb3('0x5')]}}; \ No newline at end of file +var _0x3138=['system-','sequelize','exports','STRING','name'];(function(_0x5cf4e1,_0x441370){var _0x98ea6c=function(_0x44a18b){while(--_0x44a18b){_0x5cf4e1['push'](_0x5cf4e1['shift']());}};_0x98ea6c(++_0x441370);}(_0x3138,0xe7));var _0x8313=function(_0x39634b,_0x52ab27){_0x39634b=_0x39634b-0x0;var _0x508502=_0x3138[_0x39634b];return _0x508502;};'use strict';var Sequelize=require(_0x8313('0x0'));module[_0x8313('0x1')]={'name':{'type':Sequelize[_0x8313('0x2')],'allowNull':![],'unique':_0x8313('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5e1d5b){return _0x8313('0x4')+this['getDataValue'](_0x8313('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x8313('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7988778..4dd8ae5 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 _0x4325=['every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','undefined','limit','count','offset','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','map','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','find','findById','addAgents','ids','omit','spread','userVoicePrefix:save','userVoicePrefix:remove','emit','getAgents','getTeams','Team','addTeams','User','Agents','online','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT'];(function(_0x2664e9,_0x4e6d67){var _0xaf6d78=function(_0x27aa5c){while(--_0x27aa5c){_0x2664e9['push'](_0x2664e9['shift']());}};_0xaf6d78(++_0x4e6d67);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];config['redis']=_[_0x5432('0x17')](config[_0x5432('0x18')],{'host':_0x5432('0x19'),'port':0x18eb});var socket=require(_0x5432('0x1a'))(new Redis(config[_0x5432('0x18')]));require(_0x5432('0x1b'))['register'](socket);function respondWithStatusCode(_0x5617ce,_0x43bb16){_0x43bb16=_0x43bb16||0xcc;return function(_0x44e70c){if(_0x44e70c){return _0x5617ce[_0x5432('0x1c')](_0x43bb16);}return _0x5617ce[_0x5432('0x1d')](_0x43bb16)[_0x5432('0x1e')]();};}function respondWithResult(_0x11db3c,_0x5e18e8){_0x5e18e8=_0x5e18e8||0xc8;return function(_0x2cf409){if(_0x2cf409){return _0x11db3c['status'](_0x5e18e8)[_0x5432('0x1f')](_0x2cf409);}};}function respondWithFilteredResult(_0x3de07a,_0x333152){return function(_0x32fe60){if(_0x32fe60){var _0x4221a8=typeof _0x333152['offset']===_0x5432('0x20')&&typeof _0x333152[_0x5432('0x21')]===_0x5432('0x20');var _0x2bfe04=_0x32fe60[_0x5432('0x22')];var _0x451de4=_0x4221a8?0x0:_0x333152[_0x5432('0x23')];var _0x5da6ea=_0x4221a8?_0x32fe60[_0x5432('0x22')]:_0x333152[_0x5432('0x23')]+_0x333152[_0x5432('0x21')];var _0xa6c864;if(_0x5da6ea>=_0x2bfe04){_0x5da6ea=_0x2bfe04;_0xa6c864=0xc8;}else{_0xa6c864=0xce;}_0x3de07a[_0x5432('0x1d')](_0xa6c864);return _0x3de07a['set']('Content-Range',_0x451de4+'-'+_0x5da6ea+'/'+_0x2bfe04)['json'](_0x32fe60);}return null;};}function patchUpdates(_0x61827e){return function(_0xb900f2){try{jsonpatch[_0x5432('0x24')](_0xb900f2,_0x61827e,!![]);}catch(_0x1f4870){return BPromise['reject'](_0x1f4870);}return _0xb900f2['save']();};}function saveUpdates(_0x3e0b66,_0x8ed74b){return function(_0x4a40fc){if(_0x4a40fc){return _0x4a40fc[_0x5432('0x25')](_0x3e0b66)[_0x5432('0x26')](function(_0x637582){return _0x637582;});}return null;};}function removeEntity(_0x4b6ea5,_0xd9928a){return function(_0xccefeb){if(_0xccefeb){return _0xccefeb[_0x5432('0x27')]()['then'](function(){var _0x4ab09d=_0xccefeb[_0x5432('0x28')]({'plain':!![]});var _0x2114b8='VoicePrefixes';return db[_0x5432('0x29')][_0x5432('0x27')]({'where':{'type':_0x2114b8,'resourceId':_0x4ab09d['id']}})[_0x5432('0x26')](function(){return _0xccefeb;});})['then'](function(){_0x4b6ea5[_0x5432('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4821be,_0x6fc7f5){return function(_0x4a52ba){if(!_0x4a52ba){_0x4821be[_0x5432('0x1c')](0x194);}return _0x4a52ba;};}function handleError(_0x578281,_0x59a866){_0x59a866=_0x59a866||0x1f4;return function(_0x465a09){logger[_0x5432('0x2a')](_0x465a09[_0x5432('0x2b')]);if(_0x465a09['name']){delete _0x465a09[_0x5432('0x2c')];}_0x578281[_0x5432('0x1d')](_0x59a866)[_0x5432('0x2d')](_0x465a09);};}exports[_0x5432('0x2e')]=function(_0x1a5612,_0x308b4c){var _0x431765={},_0x444178={},_0x34a152={'count':0x0,'rows':[]};var _0x5abaf7=_['map'](db[_0x5432('0x2f')][_0x5432('0x30')],function(_0x2ebffa){return{'name':_0x2ebffa[_0x5432('0x31')],'type':_0x2ebffa[_0x5432('0x32')]['key']};});_0x444178[_0x5432('0x33')]=_['map'](_0x5abaf7,_0x5432('0x2c'));_0x444178[_0x5432('0x34')]=_[_0x5432('0x35')](_0x1a5612[_0x5432('0x34')]);_0x444178[_0x5432('0x36')]=_[_0x5432('0x37')](_0x444178['model'],_0x444178[_0x5432('0x34')]);_0x431765[_0x5432('0x38')]=_[_0x5432('0x37')](_0x444178[_0x5432('0x33')],qs['fields'](_0x1a5612[_0x5432('0x34')][_0x5432('0x39')]));_0x431765[_0x5432('0x38')]=_0x431765[_0x5432('0x38')][_0x5432('0x3a')]?_0x431765[_0x5432('0x38')]:_0x444178[_0x5432('0x33')];if(!_0x1a5612[_0x5432('0x34')][_0x5432('0x3b')](_0x5432('0x3c'))){_0x431765[_0x5432('0x21')]=qs[_0x5432('0x21')](_0x1a5612[_0x5432('0x34')][_0x5432('0x21')]);_0x431765['offset']=qs[_0x5432('0x23')](_0x1a5612['query'][_0x5432('0x23')]);}_0x431765[_0x5432('0x3d')]=qs[_0x5432('0x3e')](_0x1a5612[_0x5432('0x34')]['sort']);_0x431765['where']=qs['filters'](_[_0x5432('0x3f')](_0x1a5612[_0x5432('0x34')],_0x444178[_0x5432('0x36')]),_0x5abaf7);if(_0x1a5612[_0x5432('0x34')]['filter']){_0x431765[_0x5432('0x40')]=_[_0x5432('0x41')](_0x431765[_0x5432('0x40')],{'$or':_['map'](_0x5abaf7,function(_0x219ddc){if(_0x219ddc[_0x5432('0x32')]!=='VIRTUAL'){var _0x3eb446={};_0x3eb446[_0x219ddc[_0x5432('0x2c')]]={'$like':'%'+_0x1a5612['query'][_0x5432('0x42')]+'%'};return _0x3eb446;}})});}_0x431765=_['merge']({},_0x431765,_0x1a5612[_0x5432('0x43')]);var _0x2d4cb0={'where':_0x431765[_0x5432('0x40')]};return db[_0x5432('0x2f')]['count'](_0x2d4cb0)[_0x5432('0x26')](function(_0x4b93b4){_0x34a152[_0x5432('0x22')]=_0x4b93b4;if(_0x1a5612[_0x5432('0x34')][_0x5432('0x44')]){_0x431765[_0x5432('0x45')]=[{'all':!![]}];}return db[_0x5432('0x2f')][_0x5432('0x46')](_0x431765);})[_0x5432('0x26')](function(_0x4ab024){_0x34a152[_0x5432('0x47')]=_0x4ab024;return _0x34a152;})[_0x5432('0x26')](respondWithFilteredResult(_0x308b4c,_0x431765))[_0x5432('0x48')](handleError(_0x308b4c,null));};exports[_0x5432('0x49')]=function(_0x24f090,_0x29a39d){var _0x2134c9={'raw':![],'where':{'id':_0x24f090[_0x5432('0x4a')]['id']}},_0x5d183a={};_0x5d183a[_0x5432('0x33')]=_[_0x5432('0x35')](db[_0x5432('0x2f')][_0x5432('0x30')]);_0x5d183a['query']=_[_0x5432('0x35')](_0x24f090['query']);_0x5d183a[_0x5432('0x36')]=_[_0x5432('0x37')](_0x5d183a['model'],_0x5d183a[_0x5432('0x34')]);_0x2134c9['attributes']=_[_0x5432('0x37')](_0x5d183a[_0x5432('0x33')],qs['fields'](_0x24f090['query'][_0x5432('0x39')]));_0x2134c9[_0x5432('0x38')]=_0x2134c9[_0x5432('0x38')][_0x5432('0x3a')]?_0x2134c9[_0x5432('0x38')]:_0x5d183a[_0x5432('0x33')];if(_0x24f090[_0x5432('0x34')]['includeAll']){_0x2134c9[_0x5432('0x45')]=[{'all':!![]}];}_0x2134c9=_[_0x5432('0x41')]({},_0x2134c9,_0x24f090[_0x5432('0x43')]);return db['VoicePrefix']['find'](_0x2134c9)['then'](handleEntityNotFound(_0x29a39d,null))['then'](respondWithResult(_0x29a39d,null))[_0x5432('0x48')](handleError(_0x29a39d,null));};exports[_0x5432('0x27')]=function(_0x21d39b,_0xaeae36){return db[_0x5432('0x2f')]['find']({'where':{'id':_0x21d39b[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](handleEntityNotFound(_0xaeae36,null))[_0x5432('0x26')](removeEntity(_0xaeae36,null))['catch'](handleError(_0xaeae36,null));};exports[_0x5432('0x4b')]=function(_0x9e921,_0x2c2bce){return db[_0x5432('0x2f')][_0x5432('0x4b')]()['then'](respondWithResult(_0x2c2bce,null))[_0x5432('0x48')](handleError(_0x2c2bce,null));};exports['create']=function(_0x2fd527,_0x56090e){var _0x1f4d0c;return db[_0x5432('0x4c')]['transaction'](function(_0x7129e2){return db['VoicePrefix'][_0x5432('0x4d')](_0x2fd527[_0x5432('0x4e')],{'transaction':_0x7129e2})[_0x5432('0x26')](function(_0x7af1aa){_0x1f4d0c=_0x7af1aa['get']({'plain':!![]});return db[_0x5432('0x4f')]['find']({'where':{'id':_0x1f4d0c[_0x5432('0x50')]},'raw':!![]})['then'](function(_0x1c5c5c){return createVoicePrefixExtensions(_0x1f4d0c,_0x1c5c5c,_0x7129e2);});});})[_0x5432('0x26')](function(){var _0x37d69b=_0x2fd527[_0x5432('0x51')][_0x5432('0x28')]({'plain':!![]});if(!_0x37d69b)throw new Error(_0x5432('0x52'));if(_0x37d69b[_0x5432('0x53')]===_0x5432('0x51')){var _0x3e0259=_0x1f4d0c;return db[_0x5432('0x54')]['find']({'where':{'name':_0x5432('0x55'),'userProfileId':_0x37d69b[_0x5432('0x56')]},'raw':!![]})['then'](function(_0x324691){if(_0x324691&&_0x324691[_0x5432('0x57')]===0x0){return db[_0x5432('0x29')][_0x5432('0x4d')]({'name':_0x3e0259[_0x5432('0x2c')],'resourceId':_0x3e0259['id'],'type':_0x324691['name'],'sectionId':_0x324691['id']},{})['then'](function(){return _0x1f4d0c;});}else{return _0x1f4d0c;}})['catch'](function(_0x567f91){logger[_0x5432('0x2a')](_0x5432('0x58'),_0x567f91);throw _0x567f91;});}return _0x1f4d0c;})[_0x5432('0x26')](respondWithResult(_0x56090e,null))['catch'](handleError(_0x56090e,null));};function Extension(_0xb6f66a,_0x12768f,_0x304f4f,_0x3d39f7){this[_0x5432('0x59')]=_0x5432('0x5a');this[_0x5432('0x5b')]=_0xb6f66a;this[_0x5432('0x5c')]=_0x304f4f;this[_0x5432('0x32')]=_0x5432('0x5d');this[_0x5432('0x5e')]='Voice\x20Prefix\x20Extension';this[_0x5432('0x5f')]=_0x12768f;this[_0x5432('0x60')]=_0x3d39f7;}function createVoicePrefixExtensions(_0xa070cb,_0x46c8b4,_0x197df9){return new BPromise(function(_0x4a60e7,_0x24d570){var _0x524e2a=new Extension(formatPrefixName(_0xa070cb[_0x5432('0x61')]),0x1,_0x5432('0x62'),_0x5432('0x63'));_0x524e2a[_0x5432('0x64')]=_0xa070cb['id'];return db[_0x5432('0x4f')][_0x5432('0x4d')](_0x524e2a,{'transaction':_0x197df9})[_0x5432('0x26')](function(_0x119c47){var _0x388600=_0x119c47[_0x5432('0x28')]({'plain':!![]});var _0x131fc1=_[_0x5432('0x65')](addVoicePrefixExtensions(_0xa070cb,_0x46c8b4),function(_0x18d05c){_0x18d05c[_0x5432('0x50')]=_0x388600['id'];_0x18d05c[_0x5432('0x64')]=_0xa070cb['id'];return _0x18d05c;});return db[_0x5432('0x4f')][_0x5432('0x66')](_0x131fc1,{'transaction':_0x197df9})[_0x5432('0x26')](function(_0x521c0c){if(!_0x521c0c){return _0x24d570(_0x5432('0x67'));}else{return _0x4a60e7(_0x521c0c);}})['catch'](function(_0x1d5412){return _0x24d570(_0x1d5412);});});;});};function addVoicePrefixExtensions(_0x281684,_0x5aebe8){var _0x32fdfc=[];var _0x33d39a=formatPrefixName(_0x281684[_0x5432('0x61')]);_0x32fdfc[_0x5432('0x68')](new Extension(_0x33d39a,0x2,'Set',_0x5432('0x69')+_0x281684['name']));if(_0x281684[_0x5432('0x6a')]){_0x32fdfc[_0x5432('0x68')](new Extension(_0x33d39a,0x3,_0x5432('0x6b'),_0x5432('0x6c')+_0x281684[_0x5432('0x6a')]));}else{_0x32fdfc[_0x5432('0x68')](new Extension(_0x33d39a,0x3,'NoOp',_0x5432('0x6d')));}_0x32fdfc[_0x5432('0x68')](new Extension(_0x33d39a,0x4,'goto',_0x5aebe8['context']+','+_0x5432('0x6e')+(0x8+_0x281684['name'][_0x5432('0x3a')])+'}'+','+0x1));return _0x32fdfc;}function formatPrefixName(_0x53318b){var _0x67ff0e='_';for(var _0x5237b1=0x0;_0x5237b1<_0x53318b[_0x5432('0x3a')];_0x5237b1++){if(_0x53318b['charAt'](_0x5237b1)=='-'){_0x67ff0e+=_0x53318b['charAt'](_0x5237b1);}else{_0x67ff0e+='['+_0x53318b[_0x5432('0x6f')](_0x5237b1)+']';}}_0x67ff0e+='.';return _0x67ff0e;}exports[_0x5432('0x25')]=function(_0x22e052,_0x50b478,_0x4c3e6f){var _0x571d27=_0x22e052[_0x5432('0x4e')];_0x571d27[_0x5432('0x61')]=_0x5432('0x70')+_0x571d27['name']+'-';return db['sequelize'][_0x5432('0x71')](function(_0x433a50){return db[_0x5432('0x2f')][_0x5432('0x25')](_0x571d27,{'where':{'id':_0x571d27['id']},'transaction':_0x433a50})[_0x5432('0x26')](function(){return db[_0x5432('0x4f')][_0x5432('0x27')]({'where':{'VoicePrefixId':_0x571d27['id']},'transaction':_0x433a50})[_0x5432('0x26')](function(){return db['VoiceExtension'][_0x5432('0x72')]({'where':{'id':_0x571d27['VoiceExtensionId']},'raw':!![]})[_0x5432('0x26')](function(_0x1d9833){return createVoicePrefixExtensions(_0x571d27,_0x1d9833,_0x433a50);});});});})[_0x5432('0x26')](function(){return db[_0x5432('0x2f')][_0x5432('0x73')](_0x571d27['id']);})[_0x5432('0x26')](respondWithResult(_0x50b478,null))[_0x5432('0x48')](handleError(_0x50b478,null));};exports['addAgents']=function(_0x32a25d,_0x2b199f,_0x585a31){return db[_0x5432('0x2f')]['find']({'where':{'id':_0x32a25d[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](handleEntityNotFound(_0x2b199f,null))[_0x5432('0x26')](function(_0x1da26a){if(_0x1da26a){return _0x1da26a[_0x5432('0x74')](_0x32a25d[_0x5432('0x4e')][_0x5432('0x75')],_[_0x5432('0x76')](_0x32a25d['body'],[_0x5432('0x75'),'id'])||{})[_0x5432('0x77')](function(_0x57f0c5){for(var _0xb2495d=0x0;_0xb2495d<_0x32a25d[_0x5432('0x4e')][_0x5432('0x75')][_0x5432('0x3a')];_0xb2495d+=0x1){socket['emit'](_0x5432('0x78'),{'UserId':Number(_0x32a25d[_0x5432('0x4e')][_0x5432('0x75')][_0xb2495d]),'VoicePrefixId':Number(_0x32a25d[_0x5432('0x4a')]['id'])});}return _0x57f0c5;});}})[_0x5432('0x26')](respondWithResult(_0x2b199f,null))[_0x5432('0x48')](handleError(_0x2b199f,null));};exports['removeAgents']=function(_0x48c72d,_0x5ab0ba,_0x5550ed){return db[_0x5432('0x2f')]['find']({'where':{'id':_0x48c72d[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](handleEntityNotFound(_0x5ab0ba,null))['then'](function(_0x5c0af1){if(_0x5c0af1){return _0x5c0af1['removeAgents'](_0x48c72d['query'][_0x5432('0x75')])[_0x5432('0x26')](function(){if(_['isArray'](_0x48c72d[_0x5432('0x34')][_0x5432('0x75')])){for(var _0x2f7984=0x0;_0x2f7984<_0x48c72d['query'][_0x5432('0x75')][_0x5432('0x3a')];_0x2f7984+=0x1){socket['emit'](_0x5432('0x79'),{'UserId':Number(_0x48c72d['query'][_0x5432('0x75')][_0x2f7984]),'VoicePrefixId':Number(_0x48c72d[_0x5432('0x4a')]['id'])});}}else{socket[_0x5432('0x7a')](_0x5432('0x79'),{'UserId':Number(_0x48c72d[_0x5432('0x34')][_0x5432('0x75')]),'VoicePrefixId':Number(_0x48c72d['params']['id'])});}});}})[_0x5432('0x26')](respondWithStatusCode(_0x5ab0ba,null))[_0x5432('0x48')](handleError(_0x5ab0ba,null));};exports['getAgents']=function(_0x45b0bb,_0x2e4b88,_0x2dd2d8){var _0x247340={};var _0x287302={};var _0x3aad8f;var _0x4ef243;return db[_0x5432('0x2f')]['findOne']({'where':{'id':_0x45b0bb['params']['id']}})['then'](handleEntityNotFound(_0x2e4b88,null))[_0x5432('0x26')](function(_0x4e9aae){if(_0x4e9aae){_0x3aad8f=_0x4e9aae;_0x287302['model']=_[_0x5432('0x35')](db['User'][_0x5432('0x30')]);_0x287302[_0x5432('0x34')]=_[_0x5432('0x35')](_0x45b0bb[_0x5432('0x34')]);_0x287302[_0x5432('0x36')]=_[_0x5432('0x37')](_0x287302[_0x5432('0x33')],_0x287302[_0x5432('0x34')]);_0x247340[_0x5432('0x38')]=_[_0x5432('0x37')](_0x287302[_0x5432('0x33')],qs[_0x5432('0x39')](_0x45b0bb['query'][_0x5432('0x39')]));_0x247340['attributes']=_0x247340[_0x5432('0x38')][_0x5432('0x3a')]?_0x247340[_0x5432('0x38')]:_0x287302['model'];_0x247340[_0x5432('0x3d')]=qs[_0x5432('0x3e')](_0x45b0bb[_0x5432('0x34')][_0x5432('0x3e')]);_0x247340[_0x5432('0x40')]=qs['filters'](_[_0x5432('0x3f')](_0x45b0bb[_0x5432('0x34')],_0x287302[_0x5432('0x36')]));if(_0x45b0bb[_0x5432('0x34')][_0x5432('0x42')]){_0x247340[_0x5432('0x40')]=_[_0x5432('0x41')](_0x247340[_0x5432('0x40')],{'$or':_[_0x5432('0x65')](_0x247340[_0x5432('0x38')],function(_0x70a811){var _0x76baf6={};_0x76baf6[_0x70a811]={'$like':'%'+_0x45b0bb[_0x5432('0x34')][_0x5432('0x42')]+'%'};return _0x76baf6;})});}_0x247340=_['merge']({},_0x247340,_0x45b0bb[_0x5432('0x43')]);return _0x3aad8f['getAgents'](_0x247340);}})[_0x5432('0x26')](function(_0x4a1f88){if(_0x4a1f88){_0x4ef243=_0x4a1f88[_0x5432('0x3a')];if(!_0x45b0bb[_0x5432('0x34')][_0x5432('0x3b')](_0x5432('0x3c'))){_0x247340['limit']=qs[_0x5432('0x21')](_0x45b0bb[_0x5432('0x34')][_0x5432('0x21')]);_0x247340[_0x5432('0x23')]=qs[_0x5432('0x23')](_0x45b0bb[_0x5432('0x34')][_0x5432('0x23')]);}return _0x3aad8f[_0x5432('0x7b')](_0x247340);}})[_0x5432('0x26')](function(_0x57c88d){if(_0x57c88d){return _0x57c88d?{'count':_0x4ef243,'rows':_0x57c88d}:null;}})[_0x5432('0x26')](respondWithResult(_0x2e4b88,null))[_0x5432('0x48')](handleError(_0x2e4b88,null));};exports[_0x5432('0x7c')]=function(_0x123f20,_0x1452e2,_0x7d64ee){var _0x928200={};var _0x5700e0={};var _0x109c7c;var _0x258dbf;return db[_0x5432('0x2f')]['findOne']({'where':{'id':_0x123f20[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](handleEntityNotFound(_0x1452e2,null))[_0x5432('0x26')](function(_0x1e5890){if(_0x1e5890){_0x109c7c=_0x1e5890;_0x5700e0[_0x5432('0x33')]=_[_0x5432('0x35')](db[_0x5432('0x7d')][_0x5432('0x30')]);_0x5700e0[_0x5432('0x34')]=_[_0x5432('0x35')](_0x123f20[_0x5432('0x34')]);_0x5700e0[_0x5432('0x36')]=_[_0x5432('0x37')](_0x5700e0['model'],_0x5700e0[_0x5432('0x34')]);_0x928200[_0x5432('0x38')]=_[_0x5432('0x37')](_0x5700e0['model'],qs[_0x5432('0x39')](_0x123f20['query'][_0x5432('0x39')]));_0x928200[_0x5432('0x38')]=_0x928200[_0x5432('0x38')]['length']?_0x928200[_0x5432('0x38')]:_0x5700e0[_0x5432('0x33')];_0x928200[_0x5432('0x3d')]=qs[_0x5432('0x3e')](_0x123f20[_0x5432('0x34')][_0x5432('0x3e')]);_0x928200['where']=qs['filters'](_[_0x5432('0x3f')](_0x123f20[_0x5432('0x34')],_0x5700e0['filters']));if(_0x123f20['query'][_0x5432('0x42')]){_0x928200['where']=_['merge'](_0x928200[_0x5432('0x40')],{'$or':_[_0x5432('0x65')](_0x928200[_0x5432('0x38')],function(_0x1eeb50){var _0xd8b0ac={};_0xd8b0ac[_0x1eeb50]={'$like':'%'+_0x123f20['query'][_0x5432('0x42')]+'%'};return _0xd8b0ac;})});}_0x928200=_[_0x5432('0x41')]({},_0x928200,_0x123f20[_0x5432('0x43')]);return _0x109c7c[_0x5432('0x7c')](_0x928200);}})[_0x5432('0x26')](function(_0x2c9bc4){if(_0x2c9bc4){_0x258dbf=_0x2c9bc4[_0x5432('0x3a')];if(!_0x123f20[_0x5432('0x34')][_0x5432('0x3b')](_0x5432('0x3c'))){_0x928200[_0x5432('0x21')]=qs[_0x5432('0x21')](_0x123f20[_0x5432('0x34')]['limit']);_0x928200[_0x5432('0x23')]=qs['offset'](_0x123f20[_0x5432('0x34')][_0x5432('0x23')]);}return _0x109c7c[_0x5432('0x7c')](_0x928200);}})[_0x5432('0x26')](function(_0x13705e){if(_0x13705e){return _0x13705e?{'count':_0x258dbf,'rows':_0x13705e}:null;}})[_0x5432('0x26')](respondWithResult(_0x1452e2,null))[_0x5432('0x48')](handleError(_0x1452e2,null));};exports[_0x5432('0x7e')]=function(_0x5705f6,_0x362987,_0x2392e0){var _0x2b788b=_0x5705f6[_0x5432('0x4e')]['ids'];var _0xa5f72b;return db[_0x5432('0x7d')][_0x5432('0x46')]({'where':{'id':_0x2b788b},'attributes':['id'],'include':[{'model':db[_0x5432('0x7f')],'as':_0x5432('0x80'),'attributes':['id',_0x5432('0x2c'),_0x5432('0x81'),'voicePause',_0x5432('0x82')],'raw':!![]}]})[_0x5432('0x26')](function(_0x5da672){if(_0x5da672){_0xa5f72b=_0x5da672;var _0x15596b=_['flatMap'](_0x5da672,function(_0x24aa72){var _0x6f1b4c=_0x24aa72[_0x5432('0x28')]({'plain':!![]});return _0x6f1b4c[_0x5432('0x80')];});return db[_0x5432('0x2f')]['find']({'where':{'id':_0x5705f6[_0x5432('0x4a')]['id']}})['then'](function(_0x57ae36){return db[_0x5432('0x4c')][_0x5432('0x71')](function(_0x4f0aa2){return _0x57ae36[_0x5432('0x7e')](_0x2b788b,{'transaction':_0x4f0aa2})[_0x5432('0x26')](function(){return BPromise[_0x5432('0x83')](_0xa5f72b,function(_0x5c7dc5){return db[_0x5432('0x84')][_0x5432('0x85')]({'TeamId':_0x5c7dc5['id'],'VoicePrefixId':_0x5705f6[_0x5432('0x4a')]['id']},{'transaction':_0x4f0aa2});});})[_0x5432('0x26')](function(){return BPromise[_0x5432('0x83')](_0x15596b,function(_0x121470){return db[_0x5432('0x86')]['findOrCreate']({'where':{'UserId':_0x121470['id'],'VoicePrefixId':_0x5705f6[_0x5432('0x4a')]['id']},'transaction':_0x4f0aa2});});})[_0x5432('0x26')](function(){_0x15596b[_0x5432('0x87')](function(_0x30a9dd){socket['emit']('userVoicePrefix:save',{'UserId':_0x30a9dd['id'],'VoicePrefixId':_0x57ae36['id']});});});});});}})['then'](respondWithStatusCode(_0x362987,null))['catch'](handleError(_0x362987,null));};exports['removeTeams']=function(_0x51c579,_0x4ee5e3,_0x554b3a){return db['Team'][_0x5432('0x46')]({'where':{'id':_0x51c579[_0x5432('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5432('0x7f')],'as':_0x5432('0x80'),'attributes':['id'],'raw':!![]}]})[_0x5432('0x26')](handleEntityNotFound(_0x4ee5e3,null))[_0x5432('0x26')](function(_0x5b3282){var _0x2911cd=_[_0x5432('0x65')](_0x5b3282,'id');var _0x2e6e58=[];var _0x31411e=[];var _0x2f528d=squel['select']();_0x2f528d['field'](_0x5432('0x88'))['from']('team_has_voice_prefixes','tq')[_0x5432('0x89')](_0x5432('0x8a'),'ut',_0x5432('0x8b'))['where'](_0x5432('0x8c'),_0x51c579['params']['id']);for(var _0x7e34f=0x0;_0x7e34f<_0x5b3282[_0x5432('0x3a')];_0x7e34f+=0x1){let _0x55bafc=_0x5b3282[_0x7e34f];for(var _0x159697=0x0;_0x159697<_0x55bafc[_0x5432('0x80')][_0x5432('0x3a')];_0x159697+=0x1){let _0x3806e7=_0x55bafc['Agents'][_0x159697];var _0x1a25ad=_0x2f528d[_0x5432('0x8d')]();_0x1a25ad[_0x5432('0x40')](_0x5432('0x8e'),_0x3806e7['id']);_0x31411e[_0x5432('0x68')](db[_0x5432('0x4c')][_0x5432('0x34')](_0x1a25ad[_0x5432('0x8f')](),{'type':db[_0x5432('0x4c')][_0x5432('0x90')][_0x5432('0x91')]})['then'](function(_0x5c2521){if(_0x5c2521[_0x5432('0x3a')]===0x1){return _0x3806e7['id'];}else{var _0x4a0122=_[_0x5432('0x92')](_[_0x5432('0x65')](_0x5c2521,_0x5432('0x93')),function(_0x1d294d){return _[_0x5432('0x94')](_0x2911cd,_0x1d294d);});if(_0x4a0122){return _0x3806e7['id'];}}}));}}return BPromise['all'](_0x31411e)['then'](function(_0x5c0b87){_0x2e6e58=_(_0x2e6e58)[_0x5432('0x95')](_0x5c0b87)[_0x5432('0x96')]()[_0x5432('0x97')]();return db['VoicePrefix'][_0x5432('0x72')]({'where':{'id':_0x51c579[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](function(_0x54284e){return db[_0x5432('0x4c')][_0x5432('0x71')](function(_0x20a20d){return _0x54284e[_0x5432('0x98')](_0x51c579['query']['ids'],{'transaction':_0x20a20d})[_0x5432('0x26')](function(){if(!_[_0x5432('0x99')](_0x2e6e58)){return _0x54284e[_0x5432('0x9a')](_0x2e6e58,{'transaction':_0x20a20d});}})[_0x5432('0x26')](function(){_0x2e6e58['forEach'](function(_0xbdbc76){socket[_0x5432('0x7a')](_0x5432('0x79'),{'UserId':_0xbdbc76,'VoicePrefixId':_0x54284e['id']});});});});});});})['then'](respondWithStatusCode(_0x4ee5e3,null))[_0x5432('0x48')](handleError(_0x4ee5e3,null));}; \ No newline at end of file +var _0x896e=['userVoicePrefix:save','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','isEmpty','forEach','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','VoicePrefix','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','destroy','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','params','addAgents','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','order','hasOwnProperty','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate'];(function(_0x5456a8,_0x2a5cec){var _0x41d7d=function(_0x518af8){while(--_0x518af8){_0x5456a8['push'](_0x5456a8['shift']());}};_0x41d7d(++_0x2a5cec);}(_0x896e,0x1e9));var _0xe896=function(_0x48cd64,_0x162bed){_0x48cd64=_0x48cd64-0x0;var _0x28cdd5=_0x896e[_0x48cd64];return _0x28cdd5;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];config[_0xe896('0x1a')]=_['defaults'](config[_0xe896('0x1a')],{'host':_0xe896('0x1b'),'port':0x18eb});var socket=require(_0xe896('0x1c'))(new Redis(config['redis']));require(_0xe896('0x1d'))[_0xe896('0x1e')](socket);function respondWithStatusCode(_0x1e7ef8,_0x564758){_0x564758=_0x564758||0xcc;return function(_0x5a7957){if(_0x5a7957){return _0x1e7ef8[_0xe896('0x1f')](_0x564758);}return _0x1e7ef8[_0xe896('0x20')](_0x564758)['end']();};}function respondWithResult(_0x5e78d6,_0x11f41c){_0x11f41c=_0x11f41c||0xc8;return function(_0x16e272){if(_0x16e272){return _0x5e78d6['status'](_0x11f41c)[_0xe896('0x21')](_0x16e272);}};}function respondWithFilteredResult(_0x4e062a,_0x41cbd7){return function(_0x32f86d){if(_0x32f86d){var _0x2d4cf0=typeof _0x41cbd7['offset']===_0xe896('0x22')&&typeof _0x41cbd7[_0xe896('0x23')]===_0xe896('0x22');var _0xbebbe1=_0x32f86d[_0xe896('0x24')];var _0x3ac8b8=_0x2d4cf0?0x0:_0x41cbd7[_0xe896('0x25')];var _0x32d3d3=_0x2d4cf0?_0x32f86d['count']:_0x41cbd7[_0xe896('0x25')]+_0x41cbd7['limit'];var _0x5d2c8d;if(_0x32d3d3>=_0xbebbe1){_0x32d3d3=_0xbebbe1;_0x5d2c8d=0xc8;}else{_0x5d2c8d=0xce;}_0x4e062a[_0xe896('0x20')](_0x5d2c8d);return _0x4e062a[_0xe896('0x26')](_0xe896('0x27'),_0x3ac8b8+'-'+_0x32d3d3+'/'+_0xbebbe1)[_0xe896('0x21')](_0x32f86d);}return null;};}function patchUpdates(_0x498469){return function(_0x468479){try{jsonpatch['apply'](_0x468479,_0x498469,!![]);}catch(_0x5001f7){return BPromise[_0xe896('0x28')](_0x5001f7);}return _0x468479[_0xe896('0x29')]();};}function saveUpdates(_0x1e952a,_0x2e2c10){return function(_0x20e295){if(_0x20e295){return _0x20e295[_0xe896('0x2a')](_0x1e952a)[_0xe896('0x2b')](function(_0x4b71cc){return _0x4b71cc;});}return null;};}function removeEntity(_0x390128,_0x163a75){return function(_0xc3cd05){if(_0xc3cd05){return _0xc3cd05['destroy']()[_0xe896('0x2b')](function(){var _0xd50fe2=_0xc3cd05[_0xe896('0x2c')]({'plain':!![]});var _0xe93aa0=_0xe896('0x2d');return db[_0xe896('0x2e')]['destroy']({'where':{'type':_0xe93aa0,'resourceId':_0xd50fe2['id']}})[_0xe896('0x2b')](function(){return _0xc3cd05;});})[_0xe896('0x2b')](function(){_0x390128[_0xe896('0x20')](0xcc)[_0xe896('0x2f')]();});}};}function handleEntityNotFound(_0xace03f,_0x5e0d9b){return function(_0x47c268){if(!_0x47c268){_0xace03f['sendStatus'](0x194);}return _0x47c268;};}function handleError(_0x504d7c,_0x562ddd){_0x562ddd=_0x562ddd||0x1f4;return function(_0x291290){logger[_0xe896('0x30')](_0x291290[_0xe896('0x31')]);if(_0x291290[_0xe896('0x32')]){delete _0x291290[_0xe896('0x32')];}_0x504d7c[_0xe896('0x20')](_0x562ddd)[_0xe896('0x33')](_0x291290);};}exports[_0xe896('0x34')]=function(_0x4ab96b,_0x4ce052){var _0x142d29={},_0x255dd1={},_0x29be89={'count':0x0,'rows':[]};var _0x76c0c3=_['map'](db[_0xe896('0x35')]['rawAttributes'],function(_0x57c6e8){return{'name':_0x57c6e8[_0xe896('0x36')],'type':_0x57c6e8[_0xe896('0x37')][_0xe896('0x38')]};});_0x255dd1['model']=_['map'](_0x76c0c3,'name');_0x255dd1[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x4ab96b[_0xe896('0x39')]);_0x255dd1[_0xe896('0x3b')]=_[_0xe896('0x3c')](_0x255dd1['model'],_0x255dd1[_0xe896('0x39')]);_0x142d29[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x255dd1[_0xe896('0x3e')],qs[_0xe896('0x3f')](_0x4ab96b[_0xe896('0x39')][_0xe896('0x3f')]));_0x142d29[_0xe896('0x3d')]=_0x142d29['attributes'][_0xe896('0x40')]?_0x142d29[_0xe896('0x3d')]:_0x255dd1['model'];if(!_0x4ab96b[_0xe896('0x39')]['hasOwnProperty'](_0xe896('0x41'))){_0x142d29['limit']=qs[_0xe896('0x23')](_0x4ab96b['query'][_0xe896('0x23')]);_0x142d29[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x4ab96b[_0xe896('0x39')][_0xe896('0x25')]);}_0x142d29['order']=qs['sort'](_0x4ab96b[_0xe896('0x39')][_0xe896('0x42')]);_0x142d29[_0xe896('0x43')]=qs[_0xe896('0x3b')](_[_0xe896('0x44')](_0x4ab96b['query'],_0x255dd1['filters']),_0x76c0c3);if(_0x4ab96b[_0xe896('0x39')][_0xe896('0x45')]){_0x142d29['where']=_['merge'](_0x142d29[_0xe896('0x43')],{'$or':_[_0xe896('0x46')](_0x76c0c3,function(_0x911adb){if(_0x911adb[_0xe896('0x37')]!==_0xe896('0x47')){var _0x41fa6f={};_0x41fa6f[_0x911adb[_0xe896('0x32')]]={'$like':'%'+_0x4ab96b[_0xe896('0x39')][_0xe896('0x45')]+'%'};return _0x41fa6f;}})});}_0x142d29=_[_0xe896('0x48')]({},_0x142d29,_0x4ab96b[_0xe896('0x49')]);var _0x1bc76a={'where':_0x142d29['where']};return db[_0xe896('0x35')][_0xe896('0x24')](_0x1bc76a)['then'](function(_0x57366b){_0x29be89['count']=_0x57366b;if(_0x4ab96b[_0xe896('0x39')][_0xe896('0x4a')]){_0x142d29[_0xe896('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0xe896('0x4c')](_0x142d29);})[_0xe896('0x2b')](function(_0x55a8ba){_0x29be89['rows']=_0x55a8ba;return _0x29be89;})['then'](respondWithFilteredResult(_0x4ce052,_0x142d29))[_0xe896('0x4d')](handleError(_0x4ce052,null));};exports[_0xe896('0x4e')]=function(_0x16927a,_0x402aef){var _0x4452aa={'raw':![],'where':{'id':_0x16927a['params']['id']}},_0x2ae833={};_0x2ae833[_0xe896('0x3e')]=_[_0xe896('0x3a')](db['VoicePrefix'][_0xe896('0x4f')]);_0x2ae833[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x16927a[_0xe896('0x39')]);_0x2ae833['filters']=_[_0xe896('0x3c')](_0x2ae833[_0xe896('0x3e')],_0x2ae833[_0xe896('0x39')]);_0x4452aa[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x2ae833[_0xe896('0x3e')],qs['fields'](_0x16927a[_0xe896('0x39')]['fields']));_0x4452aa[_0xe896('0x3d')]=_0x4452aa[_0xe896('0x3d')][_0xe896('0x40')]?_0x4452aa[_0xe896('0x3d')]:_0x2ae833[_0xe896('0x3e')];if(_0x16927a[_0xe896('0x39')]['includeAll']){_0x4452aa[_0xe896('0x4b')]=[{'all':!![]}];}_0x4452aa=_[_0xe896('0x48')]({},_0x4452aa,_0x16927a['options']);return db[_0xe896('0x35')][_0xe896('0x50')](_0x4452aa)['then'](handleEntityNotFound(_0x402aef,null))[_0xe896('0x2b')](respondWithResult(_0x402aef,null))['catch'](handleError(_0x402aef,null));};exports[_0xe896('0x51')]=function(_0xb90690,_0x3fd073){return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0xb90690['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x3fd073,null))[_0xe896('0x2b')](removeEntity(_0x3fd073,null))[_0xe896('0x4d')](handleError(_0x3fd073,null));};exports['describe']=function(_0x2ceae5,_0x5d205b){return db['VoicePrefix'][_0xe896('0x52')]()[_0xe896('0x2b')](respondWithResult(_0x5d205b,null))['catch'](handleError(_0x5d205b,null));};exports[_0xe896('0x53')]=function(_0x3d137b,_0x5bfd1e){var _0x58497a;return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x5b8719){return db[_0xe896('0x35')][_0xe896('0x53')](_0x3d137b[_0xe896('0x56')],{'transaction':_0x5b8719})[_0xe896('0x2b')](function(_0x16d1c8){_0x58497a=_0x16d1c8[_0xe896('0x2c')]({'plain':!![]});return db[_0xe896('0x57')][_0xe896('0x50')]({'where':{'id':_0x58497a[_0xe896('0x58')]},'raw':!![]})[_0xe896('0x2b')](function(_0x357302){return createVoicePrefixExtensions(_0x58497a,_0x357302,_0x5b8719);});});})['then'](function(){var _0x1d7e31=_0x3d137b[_0xe896('0x59')][_0xe896('0x2c')]({'plain':!![]});if(!_0x1d7e31)throw new Error(_0xe896('0x5a'));if(_0x1d7e31[_0xe896('0x5b')]===_0xe896('0x59')){var _0x157946=_0x58497a;return db[_0xe896('0x5c')][_0xe896('0x50')]({'where':{'name':_0xe896('0x2d'),'userProfileId':_0x1d7e31[_0xe896('0x5d')]},'raw':!![]})[_0xe896('0x2b')](function(_0x5d8265){if(_0x5d8265&&_0x5d8265[_0xe896('0x5e')]===0x0){return db[_0xe896('0x2e')][_0xe896('0x53')]({'name':_0x157946['name'],'resourceId':_0x157946['id'],'type':_0x5d8265['name'],'sectionId':_0x5d8265['id']},{})['then'](function(){return _0x58497a;});}else{return _0x58497a;}})[_0xe896('0x4d')](function(_0x29aa11){logger[_0xe896('0x30')](_0xe896('0x5f'),_0x29aa11);throw _0x29aa11;});}return _0x58497a;})['then'](respondWithResult(_0x5bfd1e,null))[_0xe896('0x4d')](handleError(_0x5bfd1e,null));};function Extension(_0x28396c,_0x57ed84,_0x3c893a,_0x5d6c1c){this[_0xe896('0x60')]=_0xe896('0x61');this['exten']=_0x28396c;this[_0xe896('0x62')]=_0x3c893a;this[_0xe896('0x37')]='system';this['description']=_0xe896('0x63');this[_0xe896('0x64')]=_0x57ed84;this[_0xe896('0x65')]=_0x5d6c1c;}function createVoicePrefixExtensions(_0x11291a,_0x2a1858,_0x4e4092){return new BPromise(function(_0xdadb92,_0x3c82d1){var _0x113b00=new Extension(formatPrefixName(_0x11291a[_0xe896('0x66')]),0x1,'NoOp','Voice\x20Prefix');_0x113b00[_0xe896('0x67')]=_0x11291a['id'];return db[_0xe896('0x57')]['create'](_0x113b00,{'transaction':_0x4e4092})[_0xe896('0x2b')](function(_0x4f2d6e){var _0x3ccaad=_0x4f2d6e[_0xe896('0x2c')]({'plain':!![]});var _0xce2b25=_[_0xe896('0x46')](addVoicePrefixExtensions(_0x11291a,_0x2a1858),function(_0x11b001){_0x11b001[_0xe896('0x58')]=_0x3ccaad['id'];_0x11b001[_0xe896('0x67')]=_0x11291a['id'];return _0x11b001;});return db[_0xe896('0x57')][_0xe896('0x68')](_0xce2b25,{'transaction':_0x4e4092})[_0xe896('0x2b')](function(_0xcb329a){if(!_0xcb329a){return _0x3c82d1(_0xe896('0x69'));}else{return _0xdadb92(_0xcb329a);}})[_0xe896('0x4d')](function(_0x14d88e){return _0x3c82d1(_0x14d88e);});});;});};function addVoicePrefixExtensions(_0x468fd7,_0x33bd1b){var _0x404b42=[];var _0x26e75d=formatPrefixName(_0x468fd7[_0xe896('0x66')]);_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x2,_0xe896('0x6b'),_0xe896('0x6c')+_0x468fd7['name']));if(_0x468fd7['callerIdAll']){_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x3,_0xe896('0x6b'),'PREFIX-CALLERIDALL='+_0x468fd7[_0xe896('0x6d')]));}else{_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x3,_0xe896('0x6e'),_0xe896('0x6f')));}_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x4,_0xe896('0x70'),_0x33bd1b[_0xe896('0x60')]+','+_0xe896('0x71')+(0x8+_0x468fd7[_0xe896('0x32')][_0xe896('0x40')])+'}'+','+0x1));return _0x404b42;}function formatPrefixName(_0x1479c8){var _0x4e417a='_';for(var _0x3d299a=0x0;_0x3d299a<_0x1479c8[_0xe896('0x40')];_0x3d299a++){if(_0x1479c8['charAt'](_0x3d299a)=='-'){_0x4e417a+=_0x1479c8[_0xe896('0x72')](_0x3d299a);}else{_0x4e417a+='['+_0x1479c8['charAt'](_0x3d299a)+']';}}_0x4e417a+='.';return _0x4e417a;}exports['update']=function(_0x1f3e10,_0x1bbeeb,_0x4fd476){var _0x56223c=_0x1f3e10[_0xe896('0x56')];_0x56223c['prefix']='system-'+_0x56223c[_0xe896('0x32')]+'-';return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x539f6d){return db[_0xe896('0x35')][_0xe896('0x2a')](_0x56223c,{'where':{'id':_0x56223c['id']},'transaction':_0x539f6d})[_0xe896('0x2b')](function(){return db['VoiceExtension'][_0xe896('0x51')]({'where':{'VoicePrefixId':_0x56223c['id']},'transaction':_0x539f6d})[_0xe896('0x2b')](function(){return db[_0xe896('0x57')][_0xe896('0x50')]({'where':{'id':_0x56223c['VoiceExtensionId']},'raw':!![]})[_0xe896('0x2b')](function(_0x37d951){return createVoicePrefixExtensions(_0x56223c,_0x37d951,_0x539f6d);});});});})[_0xe896('0x2b')](function(){return db[_0xe896('0x35')]['findById'](_0x56223c['id']);})[_0xe896('0x2b')](respondWithResult(_0x1bbeeb,null))[_0xe896('0x4d')](handleError(_0x1bbeeb,null));};exports['addAgents']=function(_0x2d910b,_0x129ff2,_0x35ed8c){return db[_0xe896('0x35')]['find']({'where':{'id':_0x2d910b[_0xe896('0x73')]['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x129ff2,null))[_0xe896('0x2b')](function(_0x1ea3ea){if(_0x1ea3ea){return _0x1ea3ea[_0xe896('0x74')](_0x2d910b[_0xe896('0x56')]['ids'],_['omit'](_0x2d910b['body'],[_0xe896('0x75'),'id'])||{})[_0xe896('0x76')](function(_0x10421d){for(var _0x270121=0x0;_0x270121<_0x2d910b[_0xe896('0x56')][_0xe896('0x75')][_0xe896('0x40')];_0x270121+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x2d910b[_0xe896('0x56')]['ids'][_0x270121]),'VoicePrefixId':Number(_0x2d910b[_0xe896('0x73')]['id'])});}return _0x10421d;});}})['then'](respondWithResult(_0x129ff2,null))[_0xe896('0x4d')](handleError(_0x129ff2,null));};exports['removeAgents']=function(_0x2d2978,_0x36994f,_0x2ffb63){return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0x2d2978['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x36994f,null))[_0xe896('0x2b')](function(_0x690a75){if(_0x690a75){return _0x690a75[_0xe896('0x77')](_0x2d2978[_0xe896('0x39')][_0xe896('0x75')])[_0xe896('0x2b')](function(){if(_['isArray'](_0x2d2978[_0xe896('0x39')]['ids'])){for(var _0x2008a9=0x0;_0x2008a9<_0x2d2978[_0xe896('0x39')][_0xe896('0x75')]['length'];_0x2008a9+=0x1){socket[_0xe896('0x78')](_0xe896('0x79'),{'UserId':Number(_0x2d2978[_0xe896('0x39')][_0xe896('0x75')][_0x2008a9]),'VoicePrefixId':Number(_0x2d2978[_0xe896('0x73')]['id'])});}}else{socket[_0xe896('0x78')](_0xe896('0x79'),{'UserId':Number(_0x2d2978[_0xe896('0x39')][_0xe896('0x75')]),'VoicePrefixId':Number(_0x2d2978[_0xe896('0x73')]['id'])});}});}})[_0xe896('0x2b')](respondWithStatusCode(_0x36994f,null))['catch'](handleError(_0x36994f,null));};exports[_0xe896('0x7a')]=function(_0x317880,_0x3d3a1b,_0x3b0f36){var _0x48885e={};var _0x12f5f6={};var _0x129fe0;var _0x8089;return db[_0xe896('0x35')][_0xe896('0x7b')]({'where':{'id':_0x317880[_0xe896('0x73')]['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x3d3a1b,null))[_0xe896('0x2b')](function(_0x1f37e4){if(_0x1f37e4){_0x129fe0=_0x1f37e4;_0x12f5f6[_0xe896('0x3e')]=_[_0xe896('0x3a')](db[_0xe896('0x7c')]['rawAttributes']);_0x12f5f6[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x317880[_0xe896('0x39')]);_0x12f5f6['filters']=_[_0xe896('0x3c')](_0x12f5f6['model'],_0x12f5f6['query']);_0x48885e[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x12f5f6[_0xe896('0x3e')],qs['fields'](_0x317880[_0xe896('0x39')][_0xe896('0x3f')]));_0x48885e['attributes']=_0x48885e['attributes'][_0xe896('0x40')]?_0x48885e[_0xe896('0x3d')]:_0x12f5f6[_0xe896('0x3e')];_0x48885e[_0xe896('0x7d')]=qs[_0xe896('0x42')](_0x317880[_0xe896('0x39')][_0xe896('0x42')]);_0x48885e['where']=qs['filters'](_[_0xe896('0x44')](_0x317880['query'],_0x12f5f6['filters']));if(_0x317880[_0xe896('0x39')][_0xe896('0x45')]){_0x48885e[_0xe896('0x43')]=_[_0xe896('0x48')](_0x48885e['where'],{'$or':_[_0xe896('0x46')](_0x48885e[_0xe896('0x3d')],function(_0x487d67){var _0x13da47={};_0x13da47[_0x487d67]={'$like':'%'+_0x317880[_0xe896('0x39')][_0xe896('0x45')]+'%'};return _0x13da47;})});}_0x48885e=_[_0xe896('0x48')]({},_0x48885e,_0x317880[_0xe896('0x49')]);return _0x129fe0[_0xe896('0x7a')](_0x48885e);}})[_0xe896('0x2b')](function(_0x1c5812){if(_0x1c5812){_0x8089=_0x1c5812[_0xe896('0x40')];if(!_0x317880[_0xe896('0x39')][_0xe896('0x7e')](_0xe896('0x41'))){_0x48885e[_0xe896('0x23')]=qs['limit'](_0x317880[_0xe896('0x39')][_0xe896('0x23')]);_0x48885e[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x317880[_0xe896('0x39')][_0xe896('0x25')]);}return _0x129fe0[_0xe896('0x7a')](_0x48885e);}})[_0xe896('0x2b')](function(_0x2bf6d5){if(_0x2bf6d5){return _0x2bf6d5?{'count':_0x8089,'rows':_0x2bf6d5}:null;}})[_0xe896('0x2b')](respondWithResult(_0x3d3a1b,null))['catch'](handleError(_0x3d3a1b,null));};exports['getTeams']=function(_0x41e6c4,_0x42c83c,_0x3822cd){var _0x56ee2d={};var _0x100804={};var _0x13b335;var _0x54f5e5;return db[_0xe896('0x35')][_0xe896('0x7b')]({'where':{'id':_0x41e6c4['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x42c83c,null))[_0xe896('0x2b')](function(_0x20cfaf){if(_0x20cfaf){_0x13b335=_0x20cfaf;_0x100804[_0xe896('0x3e')]=_[_0xe896('0x3a')](db[_0xe896('0x7f')][_0xe896('0x4f')]);_0x100804[_0xe896('0x39')]=_['keys'](_0x41e6c4[_0xe896('0x39')]);_0x100804[_0xe896('0x3b')]=_[_0xe896('0x3c')](_0x100804[_0xe896('0x3e')],_0x100804[_0xe896('0x39')]);_0x56ee2d['attributes']=_[_0xe896('0x3c')](_0x100804[_0xe896('0x3e')],qs[_0xe896('0x3f')](_0x41e6c4['query'][_0xe896('0x3f')]));_0x56ee2d[_0xe896('0x3d')]=_0x56ee2d[_0xe896('0x3d')][_0xe896('0x40')]?_0x56ee2d[_0xe896('0x3d')]:_0x100804[_0xe896('0x3e')];_0x56ee2d[_0xe896('0x7d')]=qs[_0xe896('0x42')](_0x41e6c4[_0xe896('0x39')]['sort']);_0x56ee2d[_0xe896('0x43')]=qs['filters'](_[_0xe896('0x44')](_0x41e6c4[_0xe896('0x39')],_0x100804[_0xe896('0x3b')]));if(_0x41e6c4[_0xe896('0x39')]['filter']){_0x56ee2d[_0xe896('0x43')]=_[_0xe896('0x48')](_0x56ee2d['where'],{'$or':_[_0xe896('0x46')](_0x56ee2d[_0xe896('0x3d')],function(_0x474924){var _0x498987={};_0x498987[_0x474924]={'$like':'%'+_0x41e6c4[_0xe896('0x39')]['filter']+'%'};return _0x498987;})});}_0x56ee2d=_['merge']({},_0x56ee2d,_0x41e6c4[_0xe896('0x49')]);return _0x13b335[_0xe896('0x80')](_0x56ee2d);}})['then'](function(_0x1cf246){if(_0x1cf246){_0x54f5e5=_0x1cf246[_0xe896('0x40')];if(!_0x41e6c4['query']['hasOwnProperty']('nolimit')){_0x56ee2d['limit']=qs[_0xe896('0x23')](_0x41e6c4[_0xe896('0x39')][_0xe896('0x23')]);_0x56ee2d[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x41e6c4[_0xe896('0x39')][_0xe896('0x25')]);}return _0x13b335[_0xe896('0x80')](_0x56ee2d);}})['then'](function(_0xd345d8){if(_0xd345d8){return _0xd345d8?{'count':_0x54f5e5,'rows':_0xd345d8}:null;}})[_0xe896('0x2b')](respondWithResult(_0x42c83c,null))[_0xe896('0x4d')](handleError(_0x42c83c,null));};exports[_0xe896('0x81')]=function(_0x5a254b,_0x4f4d26,_0x2f30a9){var _0x33fbb8=_0x5a254b['body']['ids'];var _0x419fc7;return db[_0xe896('0x7f')][_0xe896('0x4c')]({'where':{'id':_0x33fbb8},'attributes':['id'],'include':[{'model':db[_0xe896('0x7c')],'as':_0xe896('0x82'),'attributes':['id','name',_0xe896('0x83'),_0xe896('0x84'),_0xe896('0x85')],'raw':!![]}]})['then'](function(_0x231dcd){if(_0x231dcd){_0x419fc7=_0x231dcd;var _0x219ef1=_[_0xe896('0x86')](_0x231dcd,function(_0xdeaa37){var _0x43676c=_0xdeaa37['get']({'plain':!![]});return _0x43676c[_0xe896('0x82')];});return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0x5a254b['params']['id']}})[_0xe896('0x2b')](function(_0x5bfd3b){return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x1e1820){return _0x5bfd3b[_0xe896('0x81')](_0x33fbb8,{'transaction':_0x1e1820})[_0xe896('0x2b')](function(){return BPromise[_0xe896('0x87')](_0x419fc7,function(_0x4870d7){return db['TeamVoicePrefix'][_0xe896('0x88')]({'TeamId':_0x4870d7['id'],'VoicePrefixId':_0x5a254b['params']['id']},{'transaction':_0x1e1820});});})[_0xe896('0x2b')](function(){return BPromise[_0xe896('0x87')](_0x219ef1,function(_0x5ac4ad){return db[_0xe896('0x89')][_0xe896('0x8a')]({'where':{'UserId':_0x5ac4ad['id'],'VoicePrefixId':_0x5a254b['params']['id']},'transaction':_0x1e1820});});})[_0xe896('0x2b')](function(){_0x219ef1['forEach'](function(_0x326c67){socket[_0xe896('0x78')](_0xe896('0x8b'),{'UserId':_0x326c67['id'],'VoicePrefixId':_0x5bfd3b['id']});});});});});}})[_0xe896('0x2b')](respondWithStatusCode(_0x4f4d26,null))['catch'](handleError(_0x4f4d26,null));};exports[_0xe896('0x8c')]=function(_0x25b297,_0x111c0d,_0x22ac85){return db[_0xe896('0x7f')][_0xe896('0x4c')]({'where':{'id':_0x25b297[_0xe896('0x39')][_0xe896('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe896('0x7c')],'as':_0xe896('0x82'),'attributes':['id'],'raw':!![]}]})[_0xe896('0x2b')](handleEntityNotFound(_0x111c0d,null))[_0xe896('0x2b')](function(_0x23049d){var _0x39e735=_[_0xe896('0x46')](_0x23049d,'id');var _0xc0cb7c=[];var _0x16b398=[];var _0x4edeaf=squel[_0xe896('0x8d')]();_0x4edeaf[_0xe896('0x8e')]('tq.TeamId')['from'](_0xe896('0x8f'),'tq')[_0xe896('0x90')](_0xe896('0x91'),'ut',_0xe896('0x92'))[_0xe896('0x43')](_0xe896('0x93'),_0x25b297[_0xe896('0x73')]['id']);for(var _0x46a4f0=0x0;_0x46a4f0<_0x23049d['length'];_0x46a4f0+=0x1){let _0x13eb9a=_0x23049d[_0x46a4f0];for(var _0x3c70a3=0x0;_0x3c70a3<_0x13eb9a[_0xe896('0x82')][_0xe896('0x40')];_0x3c70a3+=0x1){let _0x59bea9=_0x13eb9a[_0xe896('0x82')][_0x3c70a3];var _0x54b2f0=_0x4edeaf['clone']();_0x54b2f0[_0xe896('0x43')](_0xe896('0x94'),_0x59bea9['id']);_0x16b398[_0xe896('0x6a')](db[_0xe896('0x54')][_0xe896('0x39')](_0x54b2f0[_0xe896('0x95')](),{'type':db[_0xe896('0x54')]['QueryTypes'][_0xe896('0x96')]})[_0xe896('0x2b')](function(_0x98bc8){if(_0x98bc8[_0xe896('0x40')]===0x1){return _0x59bea9['id'];}else{var _0xe78476=_[_0xe896('0x97')](_[_0xe896('0x46')](_0x98bc8,_0xe896('0x98')),function(_0x3c377e){return _['includes'](_0x39e735,_0x3c377e);});if(_0xe78476){return _0x59bea9['id'];}}}));}}return BPromise[_0xe896('0x99')](_0x16b398)[_0xe896('0x2b')](function(_0x4983ea){_0xc0cb7c=_(_0xc0cb7c)[_0xe896('0x9a')](_0x4983ea)['compact']()['value']();return db[_0xe896('0x35')]['find']({'where':{'id':_0x25b297['params']['id']}})[_0xe896('0x2b')](function(_0x1af1a2){return db[_0xe896('0x54')]['transaction'](function(_0x2b72af){return _0x1af1a2['removeTeams'](_0x25b297[_0xe896('0x39')][_0xe896('0x75')],{'transaction':_0x2b72af})['then'](function(){if(!_[_0xe896('0x9b')](_0xc0cb7c)){return _0x1af1a2[_0xe896('0x77')](_0xc0cb7c,{'transaction':_0x2b72af});}})['then'](function(){_0xc0cb7c[_0xe896('0x9c')](function(_0x5478f3){socket['emit']('userVoicePrefix:remove',{'UserId':_0x5478f3,'VoicePrefixId':_0x1af1a2['id']});});});});});});})[_0xe896('0x2b')](respondWithStatusCode(_0x111c0d,null))['catch'](handleError(_0x111c0d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0e9dc82..a68b329 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 _0x4e1b=['hook','exports','events','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2304fe,_0x1a84f3){var _0x570d32=function(_0x69c7cd){while(--_0x69c7cd){_0x2304fe['push'](_0x2304fe['shift']());}};_0x570d32(++_0x1a84f3);}(_0x4e1b,0x80));var _0xb4e1=function(_0x1d0354,_0x594f6c){_0x1d0354=_0x1d0354-0x0;var _0x21f916=_0x4e1b[_0x1d0354];return _0x21f916;};'use strict';var EventEmitter=require(_0xb4e1('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xb4e1('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb4e1('0x2')](0x0);var events={'afterCreate':_0xb4e1('0x3'),'afterUpdate':'update','afterDestroy':_0xb4e1('0x4')};function emitEvent(_0x1d9b2d){return function(_0xbbc6cd,_0x154c9f,_0x3278aa){VoicePrefixEvents[_0xb4e1('0x5')](_0x1d9b2d+':'+_0xbbc6cd['id'],_0xbbc6cd);VoicePrefixEvents['emit'](_0x1d9b2d,_0xbbc6cd);_0x3278aa(null);};}for(var e in events){if(events[_0xb4e1('0x6')](e)){var event=events[e];VoicePrefix[_0xb4e1('0x7')](e,emitEvent(event));}}module[_0xb4e1('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xaedf=['../../mysqldb','VoicePrefix','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x57ad1f,_0x47426e){var _0x49f7e0=function(_0x3c5fa9){while(--_0x3c5fa9){_0x57ad1f['push'](_0x57ad1f['shift']());}};_0x49f7e0(++_0x47426e);}(_0xaedf,0x1b8));var _0xfaed=function(_0x5ab815,_0x1c81b4){_0x5ab815=_0x5ab815-0x0;var _0x344f0f=_0xaedf[_0x5ab815];return _0x344f0f;};'use strict';var EventEmitter=require(_0xfaed('0x0'));var VoicePrefix=require(_0xfaed('0x1'))['db'][_0xfaed('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xfaed('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfaed('0x4')};function emitEvent(_0x3382d7){return function(_0x480d52,_0x1deceb,_0x41ff4a){VoicePrefixEvents['emit'](_0x3382d7+':'+_0x480d52['id'],_0x480d52);VoicePrefixEvents[_0xfaed('0x5')](_0x3382d7,_0x480d52);_0x41ff4a(null);};}for(var e in events){if(events[_0xfaed('0x6')](e)){var event=events[e];VoicePrefix[_0xfaed('0x7')](e,emitEvent(event));}}module[_0xfaed('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d22a825..d0dec60 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 _0x1292=['exports','VoicePrefix','voice_prefixes','lodash','api','moment','request-promise','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x4ab580,_0x153dc6){var _0x52d775=function(_0x5a1c16){while(--_0x5a1c16){_0x4ab580['push'](_0x4ab580['shift']());}};_0x52d775(++_0x153dc6);}(_0x1292,0xfd));var _0x2129=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x1292[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x2129('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2129('0x1'));var moment=require(_0x2129('0x2'));var BPromise=require('bluebird');var rp=require(_0x2129('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2129('0x4'));var config=require(_0x2129('0x5'));var attributes=require(_0x2129('0x6'));module[_0x2129('0x7')]=function(_0x485211,_0x326c7f){return _0x485211['define'](_0x2129('0x8'),attributes,{'tableName':_0x2129('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd0b=['bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfd0b,0x19f));var _0xbfd0=function(_0x43a605,_0x5a6f54){_0x43a605=_0x43a605-0x0;var _0x3f30e6=_0xfd0b[_0x43a605];return _0x3f30e6;};'use strict';var _=require(_0xbfd0('0x0'));var util=require(_0xbfd0('0x1'));var logger=require(_0xbfd0('0x2'))(_0xbfd0('0x3'));var moment=require(_0xbfd0('0x4'));var BPromise=require(_0xbfd0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbfd0('0x6'));var rimraf=require(_0xbfd0('0x7'));var config=require(_0xbfd0('0x8'));var attributes=require(_0xbfd0('0x9'));module[_0xbfd0('0xa')]=function(_0x1361c3,_0x53b906){return _0x1361c3[_0xbfd0('0xb')](_0xbfd0('0xc'),attributes,{'tableName':_0xbfd0('0xd'),'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 b321b37..c415410 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 _0x0024=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x0024,0xa8));var _0x4002=function(_0x1870a0,_0x46fa14){_0x1870a0=_0x1870a0-0x0;var _0x2682f9=_0x0024[_0x1870a0];return _0x2682f9;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var moment=require('moment');var BPromise=require(_0x4002('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4002('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4002('0x3'))(_0x4002('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4002('0x5')][_0x4002('0x6')]({'port':0x232a});config[_0x4002('0x7')]=_[_0x4002('0x8')](config['redis'],{'host':_0x4002('0x9'),'port':0x18eb});var socket=require(_0x4002('0xa'))(new Redis(config[_0x4002('0x7')]));require(_0x4002('0xb'))['register'](socket);function respondWithRpcPromise(_0x5f32c7,_0x21c971,_0x26fd5d){return new BPromise(function(_0x397864,_0x12c368){return client[_0x4002('0xc')](_0x5f32c7,_0x26fd5d)['then'](function(_0x53c0ef){logger['info'](_0x4002('0xd'),_0x21c971,_0x4002('0xe'));logger[_0x4002('0xf')](_0x4002('0x10'),_0x21c971,'request\x20sent',JSON[_0x4002('0x11')](_0x53c0ef));if(_0x53c0ef[_0x4002('0x12')]){if(_0x53c0ef[_0x4002('0x12')][_0x4002('0x13')]===0x1f4){logger[_0x4002('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x12c368(_0x53c0ef[_0x4002('0x12')][_0x4002('0x14')]);}logger[_0x4002('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x397864(_0x53c0ef['error'][_0x4002('0x14')]);}else{logger[_0x4002('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x4002('0xe'));_0x397864(_0x53c0ef['result']['message']);}})['catch'](function(_0x22820f){logger[_0x4002('0x12')](_0x4002('0xd'),_0x21c971,_0x22820f);_0x12c368(_0x22820f);});});} \ No newline at end of file +var _0x9e6d=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x52e9e3,_0xe465a7){var _0x960a8d=function(_0x572a0d){while(--_0x572a0d){_0x52e9e3['push'](_0x52e9e3['shift']());}};_0x960a8d(++_0xe465a7);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x1b3440,_0x2af3d0){_0x1b3440=_0x1b3440-0x0;var _0x102ba4=_0x9e6d[_0x1b3440];return _0x102ba4;};'use strict';var _=require(_0xd9e6('0x0'));var util=require('util');var moment=require(_0xd9e6('0x1'));var BPromise=require(_0xd9e6('0x2'));var rs=require(_0xd9e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9e6('0x4'))['db'];var utils=require(_0xd9e6('0x5'));var logger=require(_0xd9e6('0x6'))(_0xd9e6('0x7'));var config=require('../../config/environment');var jayson=require(_0xd9e6('0x8'));var client=jayson[_0xd9e6('0x9')]['http']({'port':0x232a});config['redis']=_[_0xd9e6('0xa')](config[_0xd9e6('0xb')],{'host':_0xd9e6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9e6('0xb')]));require(_0xd9e6('0xd'))['register'](socket);function respondWithRpcPromise(_0x6430c2,_0x1290ce,_0x4cd004){return new BPromise(function(_0x48c82b,_0xbac70b){return client[_0xd9e6('0xe')](_0x6430c2,_0x4cd004)[_0xd9e6('0xf')](function(_0xc63bc9){logger[_0xd9e6('0x10')](_0xd9e6('0x11'),_0x1290ce,_0xd9e6('0x12'));logger[_0xd9e6('0x13')](_0xd9e6('0x14'),_0x1290ce,'request\x20sent',JSON[_0xd9e6('0x15')](_0xc63bc9));if(_0xc63bc9[_0xd9e6('0x16')]){if(_0xc63bc9['error']['code']===0x1f4){logger[_0xd9e6('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x1290ce,_0xc63bc9[_0xd9e6('0x16')][_0xd9e6('0x17')]);return _0xbac70b(_0xc63bc9[_0xd9e6('0x16')][_0xd9e6('0x17')]);}logger[_0xd9e6('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x1290ce,_0xc63bc9['error'][_0xd9e6('0x17')]);return _0x48c82b(_0xc63bc9['error'][_0xd9e6('0x17')]);}else{logger[_0xd9e6('0x10')](_0xd9e6('0x11'),_0x1290ce,_0xd9e6('0x12'));_0x48c82b(_0xc63bc9[_0xd9e6('0x18')][_0xd9e6('0x17')]);}})[_0xd9e6('0x19')](function(_0x342e4e){logger[_0xd9e6('0x16')](_0xd9e6('0x11'),_0x1290ce,_0x342e4e);_0xbac70b(_0x342e4e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f3d7212..cb5037d 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 _0x3df4=['emit','register','voicePrefix:','remove','update'];(function(_0x506f52,_0x465874){var _0x34f19a=function(_0x2e8872){while(--_0x2e8872){_0x506f52['push'](_0x506f52['shift']());}};_0x34f19a(++_0x465874);}(_0x3df4,0x102));var _0x43df=function(_0xa1348,_0x2ca465){_0xa1348=_0xa1348-0x0;var _0x482ff5=_0x3df4[_0xa1348];return _0x482ff5;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x43df('0x0'),_0x43df('0x1')];function createListener(_0x40bf18,_0x206707){return function(_0x38a050){_0x206707[_0x43df('0x2')](_0x40bf18,_0x38a050);};}function removeListener(_0x4297f4,_0x5affd4){return function(){VoicePrefixEvents['removeListener'](_0x4297f4,_0x5affd4);};}exports[_0x43df('0x3')]=function(_0x3111bf){for(var _0x3af1ec=0x0,_0x43fd8c=events['length'];_0x3af1ec<_0x43fd8c;_0x3af1ec++){var _0x5863be=events[_0x3af1ec];var _0x2492a9=createListener(_0x43df('0x4')+_0x5863be,_0x3111bf);VoicePrefixEvents['on'](_0x5863be,_0x2492a9);}}; \ No newline at end of file +var _0x938c=['./voicePrefix.events','save','update','removeListener','register','length','voicePrefix:'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x938c,0x11f));var _0xc938=function(_0x3843fc,_0x4ce264){_0x3843fc=_0x3843fc-0x0;var _0x2cbdb9=_0x938c[_0x3843fc];return _0x2cbdb9;};'use strict';var VoicePrefixEvents=require(_0xc938('0x0'));var events=[_0xc938('0x1'),'remove',_0xc938('0x2')];function createListener(_0x5cd37a,_0x502809){return function(_0x257b7c){_0x502809['emit'](_0x5cd37a,_0x257b7c);};}function removeListener(_0x15a960,_0xa06f0c){return function(){VoicePrefixEvents[_0xc938('0x3')](_0x15a960,_0xa06f0c);};}exports[_0xc938('0x4')]=function(_0x235110){for(var _0x8cfbb6=0x0,_0x5c08fe=events[_0xc938('0x5')];_0x8cfbb6<_0x5c08fe;_0x8cfbb6++){var _0x6e8871=events[_0x8cfbb6];var _0x52fbb1=createListener(_0xc938('0x6')+_0x6e8871,_0x235110);VoicePrefixEvents['on'](_0x6e8871,_0x52fbb1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ab46037..2c3b756 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(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0xb10b,0x12a));var _0xbb10=function(_0x527a53,_0x3265d6){_0x527a53=_0x527a53-0x0;var _0x2332f5=_0xb10b[_0x527a53];return _0x2332f5;};'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(_0x1dad92,_0x2f948c){var _0x90a9f6=function(_0x5644db){while(--_0x5644db){_0x1dad92['push'](_0x1dad92['shift']());}};_0x90a9f6(++_0x2f948c);}(_0xb10b,0x12a));var _0xbb10=function(_0xd745e9,_0x537598){_0xd745e9=_0xd745e9-0x0;var _0x5f02a2=_0xb10b[_0xd745e9];return _0x5f02a2;};'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 1c4b237..ee479b8 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 _0xffb4=['default','ringall','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','includes','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','power','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\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','mandatoryDisposition','sequelize','exports','name','ENUM','outbound','inbound','STRING'];(function(_0x39a970,_0x2ee05d){var _0x6f5386=function(_0x80a654){while(--_0x80a654){_0x39a970['push'](_0x39a970['shift']());}};_0x6f5386(++_0x2ee05d);}(_0xffb4,0x149));var _0x4ffb=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xffb4[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x4ffb('0x0'));module[_0x4ffb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4ffb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4ffb('0x3')]('inbound',_0x4ffb('0x4')),'allowNull':![],'defaultValue':_0x4ffb('0x5')},'musiconhold':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':_0x4ffb('0x7')},'announce':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0x4ffb('0x3')]('rr',_0x4ffb('0x8'),'leastrecent',_0x4ffb('0x9'),'random',_0x4ffb('0xa'),'linear',_0x4ffb('0xb'),_0x4ffb('0xc')),'allowNull':![],'defaultValue':_0x4ffb('0x8'),'set':function(_0x3e660f){this[_0x4ffb('0xd')](_0x4ffb('0xe'),_0x3e660f?_0x3e660f:_0x4ffb('0xa'));},'get':function(){var _0x112c48=this[_0x4ffb('0xf')](_0x4ffb('0x10'));var _0x3a3318=this[_0x4ffb('0xf')](_0x4ffb('0x11'));var _0x5033d1=this['getDataValue'](_0x4ffb('0xe'));if(_0x112c48===_0x4ffb('0x4')){if(_0x3a3318==='preview'){return null;}if(_0x3a3318===_0x4ffb('0x12')&&![_0x4ffb('0xa'),_0x4ffb('0x13')][_0x4ffb('0x14')](_0x5033d1)){this[_0x4ffb('0xd')](_0x4ffb('0xe'),_0x4ffb('0xa'));}}return _0x5033d1;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4ffb('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4ffb('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4ffb('0x6')]},'weight':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4ffb('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no'),'defaultValue':_0x4ffb('0x16')},'autopause':{'type':Sequelize[_0x4ffb('0x3')]('yes','no',_0x4ffb('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4ffb('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4ffb('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4ffb('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4ffb('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no'),'defaultValue':_0x4ffb('0x16')},'announce_holdtime':{'type':Sequelize[_0x4ffb('0x3')]('yes','no',_0x4ffb('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x4ffb('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4ffb('0x6')]},'queue_youarenext':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4ffb('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x4ffb('0x6')]},'queue_quantity1':{'type':Sequelize[_0x4ffb('0x6')]},'queue_quantity2':{'type':Sequelize[_0x4ffb('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x4ffb('0x6')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2fb166){this['setDataValue'](_0x4ffb('0x19'),_0x2fb166?_0x2fb166[_0x4ffb('0x1a')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this['getDataValue'](_0x4ffb('0x19'))[_0x4ffb('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':'yes','set':function(_0xb9fb7b){this['setDataValue'](_0x4ffb('0x1c'),_0xb9fb7b?_0xb9fb7b[_0x4ffb('0x1a')](','):undefined);},'get':function(){return this[_0x4ffb('0xf')](_0x4ffb('0x1c'))?this['getDataValue'](_0x4ffb('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1d6325){this[_0x4ffb('0xd')]('leavewhenempty',_0x1d6325?_0x1d6325[_0x4ffb('0x1a')](','):undefined);},'get':function(){return this[_0x4ffb('0xf')](_0x4ffb('0x1d'))?this[_0x4ffb('0xf')](_0x4ffb('0x1d'))[_0x4ffb('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x4ffb('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4ffb('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x4ffb('0x1e')],'defaultValue':0x0,'set':function(_0x10ce00){this[_0x4ffb('0xd')](_0x4ffb('0x1f'),_0x10ce00);if(_0x10ce00){if(this[_0x4ffb('0xf')](_0x4ffb('0x20'))<0x2){this[_0x4ffb('0xd')](_0x4ffb('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4ffb('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x4ffb('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x21'),_0x4ffb('0x22'),_0x4ffb('0x23'),'predictive','booked'),'defaultValue':_0x4ffb('0x22'),'comment':_0x4ffb('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4ffb('0x25')},'dialLimitQueue':{'type':Sequelize[_0x4ffb('0x15')](0x4)[_0x4ffb('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4ffb('0x27')},'dialPowerLevel':{'type':Sequelize[_0x4ffb('0x28')](0x2)[_0x4ffb('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4ffb('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x4ffb('0x3')]('agentBusyFactor',_0x4ffb('0x2a')),'defaultValue':_0x4ffb('0x2a'),'comment':_0x4ffb('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4ffb('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x4ffb('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ffb('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':_0x4ffb('0x2e'),'comment':_0x4ffb('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ffb('0x30')},'dialQueueProject':{'type':Sequelize[_0x4ffb('0x6')],'comment':_0x4ffb('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ffb('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4ffb('0x15')](0x5)[_0x4ffb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ffb('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ffb('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4ffb('0x15')](0x5)[_0x4ffb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x4ffb('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4ffb('0x15')](0x5)[_0x4ffb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ffb('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4ffb('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4ffb('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4ffb('0x6')],'defaultValue':_0x4ffb('0x38')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x39'),_0x4ffb('0x3a'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4ffb('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x4ffb('0x15')](0x9)[_0x4ffb('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4ffb('0x3c')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x4ffb('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4ffb('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4ffb('0x15')](0x9)[_0x4ffb('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4ffb('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4ffb('0x15')](0x9)[_0x4ffb('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4ffb('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x4ffb('0x15')](0x9)[_0x4ffb('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4ffb('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4ffb('0x15')](0x9)[_0x4ffb('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4ffb('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4ffb('0x15')](0x9)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4ffb('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4ffb('0x15')](0x5)[_0x4ffb('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4ffb('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4ffb('0x15')](0x9)[_0x4ffb('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4ffb('0x44')},'dialRecallMeTimeout':{'type':Sequelize[_0x4ffb('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4ffb('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4ffb('0x3')](_0x4ffb('0x46'),_0x4ffb('0x47')),'defaultValue':_0x4ffb('0x46')},'dialQueueProject2':{'type':Sequelize[_0x4ffb('0x6')],'comment':_0x4ffb('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4ffb('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4ffb('0x48')},'dialCutDigit':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ffb('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4ffb('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ffb('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ffb('0x4b')},'dialDropRetryFrequency':{'type':Sequelize[_0x4ffb('0x15')](0x5)[_0x4ffb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ffb('0x4c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4ffb('0x15')](0x5)[_0x4ffb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ffb('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ffb('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4ffb('0x15')](0x5)[_0x4ffb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4ffb('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ffb('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ffb('0x15')],'allowNull':!![],'comment':_0x4ffb('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x4ffb('0x1e')],'defaultValue':![],'comment':_0x4ffb('0x51'),'set':function(_0xf50a25){if(!_0xf50a25)this['setDataValue'](_0x4ffb('0x52'),null);this[_0x4ffb('0xd')](_0x4ffb('0x53'),_0xf50a25);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x4ffb('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4ffb('0x15')](0x3)[_0x4ffb('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x4ffb('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c41=['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.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.'];(function(_0xc67c69,_0x261d5b){var _0xec099f=function(_0x5e9397){while(--_0x5e9397){_0xc67c69['push'](_0xc67c69['shift']());}};_0xec099f(++_0x261d5b);}(_0x3c41,0x1c4));var _0x13c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3c41[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x13c4('0x0'));module[_0x13c4('0x1')]={'name':{'type':Sequelize[_0x13c4('0x2')],'allowNull':![],'unique':_0x13c4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x5'),_0x13c4('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':_0x13c4('0x7')},'announce':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall','leastrecent','fewestcalls',_0x13c4('0x8'),_0x13c4('0x9'),_0x13c4('0xa'),_0x13c4('0xb'),_0x13c4('0xc')),'allowNull':![],'defaultValue':_0x13c4('0xd'),'set':function(_0x7ba62e){this[_0x13c4('0xe')](_0x13c4('0xf'),_0x7ba62e?_0x7ba62e:_0x13c4('0x9'));},'get':function(){var _0x134851=this[_0x13c4('0x10')](_0x13c4('0x11'));var _0x2f1c87=this[_0x13c4('0x10')](_0x13c4('0x12'));var _0x2629cf=this[_0x13c4('0x10')](_0x13c4('0xf'));if(_0x134851===_0x13c4('0x6')){if(_0x2f1c87===_0x13c4('0x13')){return null;}if(_0x2f1c87===_0x13c4('0x14')&&![_0x13c4('0x9'),_0x13c4('0x15')]['includes'](_0x2629cf)){this[_0x13c4('0xe')](_0x13c4('0xf'),_0x13c4('0x9'));}}return _0x2629cf;}},'servicelevel':{'type':Sequelize[_0x13c4('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x13c4('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x13c4('0x2')]},'weight':{'type':Sequelize[_0x13c4('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x13c4('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x13c4('0x4')]('yes','no'),'defaultValue':_0x13c4('0x17')},'autopause':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x17'),'no',_0x13c4('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x13c4('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x13c4('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x13c4('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x13c4('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x13c4('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x13c4('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x13c4('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x13c4('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x13c4('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x17'),'no'),'defaultValue':_0x13c4('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x13c4('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x13c4('0x4')]('yes','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[_0x13c4('0x2')]},'queue_youarenext':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x13c4('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x13c4('0x2')]},'queue_quantity1':{'type':Sequelize[_0x13c4('0x2')]},'queue_quantity2':{'type':Sequelize[_0x13c4('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x13c4('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x13c4('0x19')],'set':function(_0x15672c){this[_0x13c4('0xe')](_0x13c4('0x1a'),_0x15672c?_0x15672c[_0x13c4('0x1b')](','):[]);},'get':function(){return this[_0x13c4('0x10')](_0x13c4('0x1a'))?this[_0x13c4('0x10')](_0x13c4('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':_0x13c4('0x17'),'set':function(_0x883425){this['setDataValue'](_0x13c4('0x1c'),_0x883425?_0x883425[_0x13c4('0x1b')](','):undefined);},'get':function(){return this[_0x13c4('0x10')](_0x13c4('0x1c'))?this[_0x13c4('0x10')](_0x13c4('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':'no','set':function(_0x3acc70){this[_0x13c4('0xe')](_0x13c4('0x1d'),_0x3acc70?_0x3acc70['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x13c4('0x1d'))?this[_0x13c4('0x10')]('leavewhenempty')[_0x13c4('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x13c4('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x13c4('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x13c4('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x13c4('0x2')]},'description':{'type':Sequelize[_0x13c4('0x2')]},'acw':{'type':Sequelize[_0x13c4('0x1f')],'defaultValue':0x0,'set':function(_0x3f90f7){this[_0x13c4('0xe')](_0x13c4('0x20'),_0x3f90f7);if(_0x3f90f7){if(this[_0x13c4('0x10')](_0x13c4('0x21'))<0x2){this[_0x13c4('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x13c4('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x13c4('0x1f')],'defaultValue':0x0,'comment':_0x13c4('0x22')},'dialMethod':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x13'),'progressive',_0x13c4('0x23'),_0x13c4('0x24'),_0x13c4('0x14')),'defaultValue':'progressive','comment':_0x13c4('0x25')},'dialLimitChannel':{'type':Sequelize[_0x13c4('0x16')](0x4)[_0x13c4('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x13c4('0x27')},'dialLimitQueue':{'type':Sequelize[_0x13c4('0x16')](0x4)[_0x13c4('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x13c4('0x28')},'dialPowerLevel':{'type':Sequelize[_0x13c4('0x29')](0x2)[_0x13c4('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x13c4('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x13c4('0x4')](_0x13c4('0x2b'),_0x13c4('0x2c')),'defaultValue':_0x13c4('0x2c'),'comment':_0x13c4('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x13c4('0x29')](0x2)[_0x13c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x13c4('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0x13c4('0x16')](0x3)[_0x13c4('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x13c4('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x13c4('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x13c4('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x13c4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13c4('0x30')},'dialQueueOptions':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':'tTxX','comment':_0x13c4('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x13c4('0x16')](0x3)[_0x13c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13c4('0x32')},'dialQueueProject':{'type':Sequelize[_0x13c4('0x2')],'comment':_0x13c4('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x13c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13c4('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x13c4('0x16')](0x5)[_0x13c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13c4('0x35')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13c4('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x13c4('0x16')](0x5)[_0x13c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13c4('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x13c4('0x16')](0x5)[_0x13c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13c4('0x38')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x13c4('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x13c4('0x39')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x13c4('0x3a'),'never','onlyIfOpen'),'defaultValue':_0x13c4('0x3a')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x13c4('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x13c4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x13c4('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x13c4('0x16')](0x9)[_0x13c4('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x13c4('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x13c4('0x16')](0x9)[_0x13c4('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x13c4('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x13c4('0x16')](0x9)[_0x13c4('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x13c4('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x13c4('0x16')](0x9)[_0x13c4('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x13c4('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x13c4('0x16')](0x9)[_0x13c4('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x13c4('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x13c4('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x13c4('0x16')](0x5)[_0x13c4('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x13c4('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x13c4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x13c4('0x44')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x13c4('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x13c4('0x45'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x13c4('0x2')],'comment':_0x13c4('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x13c4('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x13c4('0x16')](0x3)[_0x13c4('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x13c4('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x13c4('0x16')](0x3)[_0x13c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x13c4('0x16')](0x5)[_0x13c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13c4('0x46')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x13c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13c4('0x47')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13c4('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x13c4('0x16')](0x3)[_0x13c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13c4('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x13c4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13c4('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x13c4('0x16')](0x3)[_0x13c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13c4('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x13c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13c4('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x13c4('0x16')](0x3)[_0x13c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13c4('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x13c4('0x16')](0x5)[_0x13c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13c4('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13c4('0x16')],'allowNull':!![],'comment':_0x13c4('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x13c4('0x1f')],'defaultValue':![],'comment':_0x13c4('0x50'),'set':function(_0x286168){if(!_0x286168)this['setDataValue'](_0x13c4('0x51'),null);this[_0x13c4('0xe')]('mandatoryDisposition',_0x286168);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x13c4('0x16')](0x3)[_0x13c4('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x13c4('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x13c4('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x13c4('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x13c4('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 8145973..563cca5 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 _0x34e8=['body','role','user','QueueCampaigns','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','includeAll','merge','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','where','filter','CmHopper','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userVoiceQueue:remove','spread','push','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','CmListId','ListId','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','ContactId','cm_contacts','ListId\x20=\x20?','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','map','value','type','UserProfileResource','error','stack','name','VoiceQueue','rawAttributes','fieldName','key','getOptions','include','query','findAll','catch','show','keys','filters','model','attributes','intersection','fields','length','create'];(function(_0x2f18d7,_0x517eab){var _0x4003fa=function(_0x5ea82f){while(--_0x5ea82f){_0x2f18d7['push'](_0x2f18d7['shift']());}};_0x4003fa(++_0x517eab);}(_0x34e8,0x12c));var _0x834e=function(_0x4e1605,_0x5e0056){_0x4e1605=_0x4e1605-0x0;var _0x36a932=_0x34e8[_0x4e1605];return _0x36a932;};'use strict';var moment=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));var squel=require('squel');var Redis=require(_0x834e('0x4'));var qs=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var config=require(_0x834e('0x8'));var db=require(_0x834e('0x9'))['db'];config[_0x834e('0xa')]=_['defaults'](config[_0x834e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x834e('0xb'))(new Redis(config[_0x834e('0xa')]));require(_0x834e('0xc'))[_0x834e('0xd')](socket);function respondWithStatusCode(_0x33ea05,_0x23501c){_0x23501c=_0x23501c||0xcc;return function(_0x363786){if(_0x363786){return _0x33ea05[_0x834e('0xe')](_0x23501c);}return _0x33ea05[_0x834e('0xf')](_0x23501c)[_0x834e('0x10')]();};}function respondWithResult(_0x1e41fe,_0x36e124){_0x36e124=_0x36e124||0xc8;return function(_0x14038b){if(_0x14038b){return _0x1e41fe[_0x834e('0xf')](_0x36e124)[_0x834e('0x11')](_0x14038b);}};}function respondWithFilteredResult(_0x1e00de,_0x2fd95c){return function(_0x538bb3){if(_0x538bb3){var _0x5e5b6d=typeof _0x2fd95c[_0x834e('0x12')]==='undefined'&&typeof _0x2fd95c[_0x834e('0x13')]===_0x834e('0x14');var _0x28e659=_0x538bb3[_0x834e('0x15')];var _0x50e860=_0x5e5b6d?0x0:_0x2fd95c[_0x834e('0x12')];var _0x302cbd=_0x5e5b6d?_0x538bb3['count']:_0x2fd95c[_0x834e('0x12')]+_0x2fd95c['limit'];var _0x38a8cd;if(_0x302cbd>=_0x28e659){_0x302cbd=_0x28e659;_0x38a8cd=0xc8;}else{_0x38a8cd=0xce;}_0x1e00de[_0x834e('0xf')](_0x38a8cd);return _0x1e00de['set'](_0x834e('0x16'),_0x50e860+'-'+_0x302cbd+'/'+_0x28e659)[_0x834e('0x11')](_0x538bb3);}return null;};}function saveUpdates(_0x370fb5){return function(_0x50b3f6){if(_0x50b3f6){return _0x50b3f6[_0x834e('0x17')](_0x370fb5)[_0x834e('0x18')](function(_0x34e41a){return _0x34e41a;});}return null;};}function removeEntity(_0xb993a1){return function(_0x237947){if(_0x237947){return _0x237947[_0x834e('0x19')]()[_0x834e('0x18')](function(){var _0x595515=_0x237947[_0x834e('0x1a')]({'plain':!![]});var _0x1fd2c6=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c'),'ignore':![]},{'name':'QueueCampaigns','value':_0x834e('0x1d'),'ignore':![]}];var _0x62f8f1=_(_0x1fd2c6)['filter'](_0x834e('0x1e'))[_0x834e('0x1f')](_0x834e('0x20'))['value']();if(_['includes'](_0x62f8f1,_0x595515[_0x834e('0x21')])){return;}var _0x34563b=_['find'](_0x1fd2c6,[_0x834e('0x20'),_0x595515[_0x834e('0x21')]])['name'];return db[_0x834e('0x22')][_0x834e('0x19')]({'where':{'type':_0x34563b,'resourceId':_0x595515['id']}})[_0x834e('0x18')](function(){return _0x237947;});})['then'](function(){_0xb993a1[_0x834e('0xf')](0xcc)[_0x834e('0x10')]();});}};}function handleEntityNotFound(_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x5e1cc5[_0x834e('0xe')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x23')](_0x3f1b0b[_0x834e('0x24')]);if(_0x3f1b0b[_0x834e('0x25')]){delete _0x3f1b0b[_0x834e('0x25')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={};var _0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x1f')](db[_0x834e('0x26')][_0x834e('0x27')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x28')],'type':_0x1e026a[_0x834e('0x21')][_0x834e('0x29')]};});_0x567cea=qs[_0x834e('0x2a')](_0x5dacc1,_0x58c1d7);var _0x278db3={'where':_0x567cea['where']};return db[_0x834e('0x26')]['count'](_0x278db3)[_0x834e('0x18')](function(_0x3787b0){_0x106d6a[_0x834e('0x15')]=_0x3787b0;_0x567cea[_0x834e('0x2b')]=qs[_0x834e('0x2b')](_0x58c1d7[_0x834e('0x2c')]);return db[_0x834e('0x26')][_0x834e('0x2d')](_0x567cea);})[_0x834e('0x18')](function(_0x12b2bc){_0x106d6a['rows']=_0x12b2bc;return _0x106d6a;})[_0x834e('0x18')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x2e')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x2f')]=function(_0xaf01f4,_0x595cc0){var _0x3f88ad={'raw':![],'where':{'id':_0xaf01f4['params']['id']}},_0x379d60={};_0x379d60['model']=_['keys'](db[_0x834e('0x26')][_0x834e('0x27')]);_0x379d60[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xaf01f4[_0x834e('0x2c')]);_0x379d60[_0x834e('0x31')]=_['intersection'](_0x379d60[_0x834e('0x32')],_0x379d60['query']);_0x3f88ad[_0x834e('0x33')]=_[_0x834e('0x34')](_0x379d60['model'],qs[_0x834e('0x35')](_0xaf01f4[_0x834e('0x2c')]['fields']));_0x3f88ad['attributes']=_0x3f88ad[_0x834e('0x33')][_0x834e('0x36')]?_0x3f88ad[_0x834e('0x33')]:_0x379d60[_0x834e('0x32')];if(_0xaf01f4[_0x834e('0x2c')]['includeAll']){_0x3f88ad[_0x834e('0x2b')]=[{'all':!![]}];}_0x3f88ad=_['merge']({},_0x3f88ad,_0xaf01f4['options']);return db[_0x834e('0x26')]['find'](_0x3f88ad)[_0x834e('0x18')](handleEntityNotFound(_0x595cc0,null))[_0x834e('0x18')](respondWithResult(_0x595cc0,null))[_0x834e('0x2e')](handleError(_0x595cc0,null));};exports[_0x834e('0x37')]=function(_0x2b7933,_0x574ea8){return db[_0x834e('0x26')][_0x834e('0x37')](_0x2b7933[_0x834e('0x38')],{})['then'](function(_0x35380e){var _0x16ac45=_0x2b7933['user'][_0x834e('0x1a')]({'plain':!![]});if(!_0x16ac45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16ac45[_0x834e('0x39')]===_0x834e('0x3a')){var _0x4a18bb=_0x35380e['get']({'plain':!![]});var _0x22ea21=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c')},{'name':_0x834e('0x3b'),'value':_0x834e('0x1d')}];var _0x23feea=_[_0x834e('0x3c')](_0x22ea21,['value',_0x4a18bb[_0x834e('0x21')]])['name'];return db[_0x834e('0x3d')]['find']({'where':{'name':_0x23feea,'userProfileId':_0x16ac45[_0x834e('0x3e')]},'raw':!![]})['then'](function(_0x361f60){if(_0x361f60&&_0x361f60[_0x834e('0x3f')]===0x0){return db['UserProfileResource'][_0x834e('0x37')]({'name':_0x4a18bb[_0x834e('0x25')],'resourceId':_0x4a18bb['id'],'type':_0x361f60[_0x834e('0x25')],'sectionId':_0x361f60['id']},{})[_0x834e('0x18')](function(){return _0x35380e;});}else{return _0x35380e;}})[_0x834e('0x2e')](function(_0x1a7149){logger[_0x834e('0x23')](_0x834e('0x40'),_0x1a7149);throw _0x1a7149;});}return _0x35380e;})[_0x834e('0x18')](respondWithResult(_0x574ea8,0xc9))[_0x834e('0x2e')](handleError(_0x574ea8,null));};exports['clone']=function(_0x3124be,_0x6fff27){var _0x47a8a9={'where':{'id':_0x3124be[_0x834e('0x41')]['id']}},_0x112306={};_0x112306[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x26')][_0x834e('0x27')]);_0x47a8a9['attributes']=_['intersection'](_0x112306[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3124be[_0x834e('0x2c')][_0x834e('0x35')]));_0x47a8a9[_0x834e('0x33')]=_0x47a8a9[_0x834e('0x33')][_0x834e('0x36')]?_0x47a8a9[_0x834e('0x33')]:_0x112306[_0x834e('0x32')];if(_0x3124be[_0x834e('0x2c')][_0x834e('0x42')]){_0x47a8a9[_0x834e('0x2b')]=[{'all':!![]}];}_0x47a8a9=_[_0x834e('0x43')]({},_0x47a8a9,_0x3124be[_0x834e('0x44')]);return db[_0x834e('0x26')][_0x834e('0x3c')](_0x47a8a9)[_0x834e('0x18')](handleEntityNotFound(_0x6fff27,null))[_0x834e('0x18')](function(_0x420841){if(_0x420841){var _0x1adf86=_0x420841['get']({'plain':!![]});_0x1adf86=qs[_0x834e('0x45')](_0x1adf86,['id',_0x834e('0x46'),'updatedAt']);_0x3124be[_0x834e('0x38')]=_[_0x834e('0x45')](_0x3124be['body'],['id',_0x834e('0x46'),_0x834e('0x47')]);return db[_0x834e('0x26')][_0x834e('0x37')](_[_0x834e('0x43')](_0x1adf86,_0x3124be[_0x834e('0x38')]),{'include':_0x3124be[_0x834e('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0x834e('0x18')](function(_0x8bc6c6){var _0x3e0550=_0x3124be[_0x834e('0x3a')][_0x834e('0x1a')]({'plain':!![]});if(!_0x3e0550)throw new Error(_0x834e('0x48'));if(_0x3e0550[_0x834e('0x39')]===_0x834e('0x3a')){var _0x5afa07=_0x8bc6c6[_0x834e('0x1a')]({'plain':!![]});var _0x4dc104=[{'name':_0x834e('0x1b'),'value':'inbound'},{'name':_0x834e('0x3b'),'value':'outbound'}];var _0x527eef=_[_0x834e('0x3c')](_0x4dc104,[_0x834e('0x20'),_0x5afa07['type']])['name'];return db[_0x834e('0x3d')][_0x834e('0x3c')]({'where':{'name':_0x527eef,'userProfileId':_0x3e0550[_0x834e('0x3e')]},'raw':!![]})[_0x834e('0x18')](function(_0x21c417){if(_0x21c417&&_0x21c417[_0x834e('0x3f')]===0x0){return db[_0x834e('0x22')][_0x834e('0x37')]({'name':_0x5afa07['name'],'resourceId':_0x5afa07['id'],'type':_0x21c417[_0x834e('0x25')],'sectionId':_0x21c417['id']},{})[_0x834e('0x18')](function(){return _0x8bc6c6;});}else{return _0x8bc6c6;}})['catch'](function(_0x281342){logger['error'](_0x834e('0x40'),_0x281342);throw _0x281342;});}return _0x8bc6c6;});}})[_0x834e('0x18')](respondWithResult(_0x6fff27,0xc9))['catch'](handleError(_0x6fff27,null));};exports[_0x834e('0x17')]=function(_0x37ee0e,_0x2de29a){if(_0x37ee0e[_0x834e('0x38')]['id']){delete _0x37ee0e['body']['id'];}return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x37ee0e[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2de29a,null))[_0x834e('0x18')](saveUpdates(_0x37ee0e[_0x834e('0x38')],null))[_0x834e('0x18')](respondWithResult(_0x2de29a,null))[_0x834e('0x2e')](handleError(_0x2de29a,null));};exports[_0x834e('0x19')]=function(_0x125f37,_0x3a1426){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x125f37[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x3a1426,null))[_0x834e('0x18')](removeEntity(_0x3a1426,null))[_0x834e('0x2e')](handleError(_0x3a1426,null));};exports[_0x834e('0x49')]=function(_0x460a7a,_0x17b8e3){var _0x297cce={'raw':![],'where':{}};var _0x14ed83={};var _0x193a15={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x460a7a[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x17b8e3,null))[_0x834e('0x18')](function(_0x25d6f4){if(_0x25d6f4){_0x14ed83[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmHopper'][_0x834e('0x27')]);_0x14ed83['query']=_['keys'](_0x460a7a[_0x834e('0x2c')]);_0x14ed83[_0x834e('0x31')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],_0x14ed83[_0x834e('0x2c')]);_0x297cce[_0x834e('0x33')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],qs['fields'](_0x460a7a[_0x834e('0x2c')]['fields']));_0x297cce[_0x834e('0x33')]=_0x297cce[_0x834e('0x33')]['length']?_0x297cce['attributes']:_0x14ed83[_0x834e('0x32')];if(!_0x460a7a[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x297cce[_0x834e('0x13')]=qs['limit'](_0x460a7a[_0x834e('0x2c')][_0x834e('0x13')]);_0x297cce[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x12')]);}_0x297cce[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x4e')]);_0x297cce['where']=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x460a7a[_0x834e('0x2c')],_0x14ed83[_0x834e('0x31')]));_0x297cce['where'][_0x834e('0x50')]=_0x25d6f4['id'];if(_0x460a7a['query']['filter']){_0x297cce['where']=_[_0x834e('0x43')](_0x297cce[_0x834e('0x51')],{'$or':_['map'](_0x297cce[_0x834e('0x33')],function(_0x1b200d){var _0x4d4477={};_0x4d4477[_0x1b200d]={'$like':'%'+_0x460a7a[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4d4477;})});}_0x297cce=_['merge']({},_0x297cce,_0x460a7a['options']);return db[_0x834e('0x53')][_0x834e('0x15')]({'where':_0x297cce[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x1d8e7){_0x193a15['count']=_0x1d8e7;if(_0x460a7a[_0x834e('0x2c')]['includeAll']){_0x297cce[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x53')][_0x834e('0x2d')](_0x297cce);})['then'](function(_0x33a3cd){_0x193a15[_0x834e('0x54')]=_0x33a3cd;return _0x193a15;});}})['then'](respondWithFilteredResult(_0x17b8e3,_0x297cce))[_0x834e('0x2e')](handleError(_0x17b8e3,null));};exports[_0x834e('0x55')]=function(_0xb4e130,_0x50d0a3){var _0x214014={'raw':!![],'where':{}};var _0x1d4e66={};var _0x402692={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0xb4e130[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x50d0a3,null))[_0x834e('0x18')](function(_0xd49002){if(_0xd49002){_0x1d4e66[_0x834e('0x32')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x1d4e66[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xb4e130[_0x834e('0x2c')]);_0x1d4e66[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d4e66['model'],_0x1d4e66['query']);_0x214014[_0x834e('0x33')]=_[_0x834e('0x34')](_0x1d4e66[_0x834e('0x32')],qs[_0x834e('0x35')](_0xb4e130[_0x834e('0x2c')]['fields']));_0x214014[_0x834e('0x33')]=_0x214014[_0x834e('0x33')][_0x834e('0x36')]?_0x214014['attributes']:_0x1d4e66[_0x834e('0x32')];if(!_0xb4e130[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x214014[_0x834e('0x13')]=qs['limit'](_0xb4e130['query'][_0x834e('0x13')]);_0x214014[_0x834e('0x12')]=qs['offset'](_0xb4e130[_0x834e('0x2c')]['offset']);}_0x214014[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0xb4e130[_0x834e('0x2c')]['sort']);_0x214014[_0x834e('0x51')]=qs['filters'](_['pick'](_0xb4e130['query'],_0x1d4e66[_0x834e('0x31')]));_0x214014[_0x834e('0x51')][_0x834e('0x50')]=_0xd49002['id'];if(_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]){_0x214014[_0x834e('0x51')]=_[_0x834e('0x43')](_0x214014[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x214014['attributes'],function(_0x2f775a){var _0x54e70d={};_0x54e70d[_0x2f775a]={'$like':'%'+_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x54e70d;})});}_0x214014=_[_0x834e('0x43')]({},_0x214014,_0xb4e130[_0x834e('0x44')]);return db[_0x834e('0x56')][_0x834e('0x15')]({'where':_0x214014['where']})['then'](function(_0xeb096d){_0x402692[_0x834e('0x15')]=_0xeb096d;if(_0xb4e130['query'][_0x834e('0x42')]){_0x214014[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x56')][_0x834e('0x2d')](_0x214014);})[_0x834e('0x18')](function(_0x5a75e3){_0x402692[_0x834e('0x54')]=_0x5a75e3;return _0x402692;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x50d0a3,_0x214014))['catch'](handleError(_0x50d0a3,null));};exports['getHopperFinals']=function(_0x5ede29,_0x1e5252){var _0x1f3e26={'raw':!![],'where':{}};var _0x4f716d={};var _0x23ce49={'count':0x0,'rows':[]};return db[_0x834e('0x26')]['findOne']({'where':{'id':_0x5ede29[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e5252,null))['then'](function(_0x41dfd9){if(_0x41dfd9){_0x4f716d[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x57')]['rawAttributes']);_0x4f716d[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5ede29[_0x834e('0x2c')]);_0x4f716d[_0x834e('0x31')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],_0x4f716d[_0x834e('0x2c')]);_0x1f3e26[_0x834e('0x33')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x35')]));_0x1f3e26[_0x834e('0x33')]=_0x1f3e26[_0x834e('0x33')][_0x834e('0x36')]?_0x1f3e26[_0x834e('0x33')]:_0x4f716d[_0x834e('0x32')];if(!_0x5ede29[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1f3e26[_0x834e('0x13')]=qs['limit'](_0x5ede29[_0x834e('0x2c')][_0x834e('0x13')]);_0x1f3e26[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x12')]);}_0x1f3e26[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5ede29[_0x834e('0x2c')]['sort']);_0x1f3e26['where']=qs['filters'](_[_0x834e('0x4f')](_0x5ede29['query'],_0x4f716d[_0x834e('0x31')]));_0x1f3e26[_0x834e('0x51')][_0x834e('0x50')]=_0x41dfd9['id'];if(_0x5ede29['query'][_0x834e('0x52')]){_0x1f3e26[_0x834e('0x51')]=_[_0x834e('0x43')](_0x1f3e26[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x1f3e26[_0x834e('0x33')],function(_0x528052){var _0x10dd7b={};_0x10dd7b[_0x528052]={'$like':'%'+_0x5ede29[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x10dd7b;})});}_0x1f3e26=_[_0x834e('0x43')]({},_0x1f3e26,_0x5ede29[_0x834e('0x44')]);return db['CmHopperFinal']['count']({'where':_0x1f3e26['where']})['then'](function(_0x1dfa2e){_0x23ce49[_0x834e('0x15')]=_0x1dfa2e;if(_0x5ede29['query'][_0x834e('0x42')]){_0x1f3e26[_0x834e('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x834e('0x2d')](_0x1f3e26);})[_0x834e('0x18')](function(_0xbf7693){_0x23ce49[_0x834e('0x54')]=_0xbf7693;return _0x23ce49;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x1e5252,_0x1f3e26))[_0x834e('0x2e')](handleError(_0x1e5252,null));};exports['getHopperBlacks']=function(_0x5a49fc,_0x43b92f){var _0x30ab20={'raw':!![],'where':{}};var _0x1d2e12={};var _0x58bdd6={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5a49fc['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x43b92f,null))[_0x834e('0x18')](function(_0x216d1f){if(_0x216d1f){_0x1d2e12[_0x834e('0x32')]=_['keys'](db[_0x834e('0x58')]['rawAttributes']);_0x1d2e12['query']=_[_0x834e('0x30')](_0x5a49fc[_0x834e('0x2c')]);_0x1d2e12[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d2e12[_0x834e('0x32')],_0x1d2e12[_0x834e('0x2c')]);_0x30ab20['attributes']=_['intersection'](_0x1d2e12[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x35')]));_0x30ab20[_0x834e('0x33')]=_0x30ab20[_0x834e('0x33')][_0x834e('0x36')]?_0x30ab20['attributes']:_0x1d2e12[_0x834e('0x32')];if(!_0x5a49fc[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x30ab20[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x13')]);_0x30ab20[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x12')]);}_0x30ab20[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x4e')]);_0x30ab20[_0x834e('0x51')]=qs['filters'](_[_0x834e('0x4f')](_0x5a49fc[_0x834e('0x2c')],_0x1d2e12['filters']));_0x30ab20[_0x834e('0x51')]['VoiceQueueId']=_0x216d1f['id'];if(_0x5a49fc[_0x834e('0x2c')]['filter']){_0x30ab20[_0x834e('0x51')]=_['merge'](_0x30ab20[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x30ab20[_0x834e('0x33')],function(_0x1aac37){var _0x57ee25={};_0x57ee25[_0x1aac37]={'$like':'%'+_0x5a49fc[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x57ee25;})});}_0x30ab20=_[_0x834e('0x43')]({},_0x30ab20,_0x5a49fc[_0x834e('0x44')]);return db[_0x834e('0x58')][_0x834e('0x15')]({'where':_0x30ab20[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x2aa430){_0x58bdd6[_0x834e('0x15')]=_0x2aa430;if(_0x5a49fc[_0x834e('0x2c')][_0x834e('0x42')]){_0x30ab20[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x58')][_0x834e('0x2d')](_0x30ab20);})[_0x834e('0x18')](function(_0xe84914){_0x58bdd6['rows']=_0xe84914;return _0x58bdd6;});}})['then'](respondWithFilteredResult(_0x43b92f,_0x30ab20))[_0x834e('0x2e')](handleError(_0x43b92f,null));};exports[_0x834e('0x59')]=function(_0x3f52b9,_0x213303){var _0x3bf1b6={};var _0x31f336={};var _0x22f90d;var _0x40fd40;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x3f52b9[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x213303,null))['then'](function(_0x1bd254){if(_0x1bd254){_0x22f90d=_0x1bd254;_0x31f336['model']=_[_0x834e('0x30')](db[_0x834e('0x5a')][_0x834e('0x27')]);_0x31f336['query']=_[_0x834e('0x30')](_0x3f52b9[_0x834e('0x2c')]);_0x31f336['filters']=_['intersection'](_0x31f336[_0x834e('0x32')],_0x31f336[_0x834e('0x2c')]);_0x3bf1b6['attributes']=_[_0x834e('0x34')](_0x31f336[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x35')]));_0x3bf1b6['attributes']=_0x3bf1b6['attributes'][_0x834e('0x36')]?_0x3bf1b6['attributes']:_0x31f336['model'];_0x3bf1b6['order']=qs[_0x834e('0x4e')](_0x3f52b9[_0x834e('0x2c')]['sort']);_0x3bf1b6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x3f52b9[_0x834e('0x2c')],_0x31f336['filters']));if(_0x3f52b9[_0x834e('0x2c')][_0x834e('0x52')]){_0x3bf1b6[_0x834e('0x51')]=_['merge'](_0x3bf1b6[_0x834e('0x51')],{'$or':_['map'](_0x3bf1b6[_0x834e('0x33')],function(_0x4af2a2){var _0x461420={};_0x461420[_0x4af2a2]={'$like':'%'+_0x3f52b9[_0x834e('0x2c')]['filter']+'%'};return _0x461420;})});}_0x3bf1b6=_[_0x834e('0x43')]({},_0x3bf1b6,_0x3f52b9[_0x834e('0x44')]);return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})[_0x834e('0x18')](function(_0x410895){if(_0x410895){_0x40fd40=_0x410895[_0x834e('0x36')];if(!_0x3f52b9['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x3bf1b6[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x13')]);_0x3bf1b6['offset']=qs[_0x834e('0x12')](_0x3f52b9['query']['offset']);}return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})['then'](function(_0x4c5da4){if(_0x4c5da4){return _0x4c5da4?{'count':_0x40fd40,'rows':_0x4c5da4}:null;}})[_0x834e('0x18')](respondWithResult(_0x213303,null))[_0x834e('0x2e')](handleError(_0x213303,null));};exports[_0x834e('0x5b')]=function(_0x2e5886,_0x38fbc4){var _0x3e0ee6=_0x2e5886[_0x834e('0x38')][_0x834e('0x5c')];var _0x1d3ca9=_[_0x834e('0x1f')](_0x3e0ee6,'id');return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0x1d3ca9},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id','name',_0x834e('0x5f'),'voicePause',_0x834e('0x60')],'raw':!![]}]})[_0x834e('0x18')](function(_0x284412){if(_0x284412){var _0x2cdbe0=_['flatMap'](_0x284412,function(_0x5f558a){var _0x37d8dd=_0x5f558a[_0x834e('0x1a')]({'plain':!![]});_0x37d8dd['Agents'][_0x834e('0x61')](function(_0xfa7b14){_0xfa7b14['penalty']=_[_0x834e('0x3c')](_0x3e0ee6,{'id':_0x37d8dd['id']})[_0x834e('0x62')];});return _0x37d8dd[_0x834e('0x5e')];});return db[_0x834e('0x26')]['find']({'where':{'id':_0x2e5886['params']['id']}})['then'](function(_0x48e14c){return db[_0x834e('0x63')][_0x834e('0x64')](function(_0x47891e){return _0x48e14c[_0x834e('0x5b')](_0x1d3ca9,{'transaction':_0x47891e})['then'](function(){return BPromise[_0x834e('0x65')](_0x3e0ee6,function(_0x13b39a){return db[_0x834e('0x66')][_0x834e('0x67')]({'TeamId':_0x13b39a['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id'],'penalty':_0x13b39a[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){return BPromise['each'](_0x2cdbe0,function(_0x12a0f3){return db[_0x834e('0x68')]['findOrCreate']({'where':{'UserId':_0x12a0f3['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id']},'defaults':{'penalty':_0x12a0f3[_0x834e('0x62')]},'transaction':_0x47891e});});})['then'](function(){return BPromise['each'](_['filter'](_0x2cdbe0,{'online':!![]}),function(_0x3edbbb){return db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x3edbbb['name'],'UserId':_0x3edbbb['id'],'queue_name':_0x48e14c[_0x834e('0x25')],'VoiceQueueId':_0x48e14c['id'],'interface':_[_0x834e('0x6a')](_0x3edbbb[_0x834e('0x60')])?util[_0x834e('0x6b')](_0x834e('0x6c'),_0x3edbbb[_0x834e('0x25')]):_0x3edbbb[_0x834e('0x60')],'paused':_0x3edbbb[_0x834e('0x6d')]||![],'penalty':_0x3edbbb[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){_0x2cdbe0['forEach'](function(_0x5d6b66){socket[_0x834e('0x6e')](_0x834e('0x6f'),{'UserId':_0x5d6b66['id'],'VoiceQueueId':_0x48e14c['id']});});});});});}})[_0x834e('0x18')](respondWithStatusCode(_0x38fbc4,null))[_0x834e('0x2e')](handleError(_0x38fbc4,null));};exports[_0x834e('0x70')]=function(_0xd22e8f,_0x281922){return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')]},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x281922,null))[_0x834e('0x18')](function(_0x3b13be){var _0x3f5b2e=_[_0x834e('0x1f')](_0x3b13be,'id');var _0x495697=[];var _0x5943a3=[];var _0x4e7c43=squel[_0x834e('0x72')]();_0x4e7c43[_0x834e('0x73')](_0x834e('0x74'))[_0x834e('0x75')](_0x834e('0x76'),'tq')[_0x834e('0x77')](_0x834e('0x78'),'ut',_0x834e('0x79'))['where']('VoiceQueueId\x20=\x20?',_0xd22e8f['params']['id']);for(var _0x5a5602=0x0;_0x5a5602<_0x3b13be[_0x834e('0x36')];_0x5a5602+=0x1){let _0xd108fa=_0x3b13be[_0x5a5602];for(var _0x37defd=0x0;_0x37defd<_0xd108fa[_0x834e('0x5e')][_0x834e('0x36')];_0x37defd+=0x1){let _0x386e10=_0xd108fa[_0x834e('0x5e')][_0x37defd];var _0x29ef2f=_0x4e7c43[_0x834e('0x7a')]();_0x29ef2f['where']('ut.UserId\x20=\x20?',_0x386e10['id']);_0x5943a3['push'](db['sequelize'][_0x834e('0x2c')](_0x29ef2f[_0x834e('0x7b')](),{'type':db[_0x834e('0x63')][_0x834e('0x7c')][_0x834e('0x7d')]})[_0x834e('0x18')](function(_0x416bea){if(_0x416bea[_0x834e('0x36')]===0x1){return _0x386e10['id'];}else{var _0x86d08c=_[_0x834e('0x7e')](_[_0x834e('0x1f')](_0x416bea,_0x834e('0x7f')),function(_0x1fd72b){return _[_0x834e('0x80')](_0x3f5b2e,_0x1fd72b);});if(_0x86d08c){return _0x386e10['id'];}}}));}}return BPromise[_0x834e('0x81')](_0x5943a3)[_0x834e('0x18')](function(_0x5022f2){_0x495697=_(_0x495697)[_0x834e('0x82')](_0x5022f2)['compact']()[_0x834e('0x20')]();return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0xd22e8f['params']['id']}})[_0x834e('0x18')](function(_0x3d9d85){return db['sequelize']['transaction'](function(_0x1c3b23){return _0x3d9d85[_0x834e('0x70')](_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')],{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){if(!_[_0x834e('0x83')](_0x495697)){return _0x3d9d85[_0x834e('0x84')](_0x495697,{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){return db['UserVoiceQueueRt'][_0x834e('0x19')]({'where':{'VoiceQueueId':_0xd22e8f[_0x834e('0x41')]['id'],'UserId':_0x495697},'transaction':_0x1c3b23});});}})[_0x834e('0x18')](function(){_0x495697[_0x834e('0x61')](function(_0x1912e6){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':_0x1912e6,'VoiceQueueId':_0x3d9d85['id']});});});});});});})['then'](respondWithStatusCode(_0x281922,null))[_0x834e('0x2e')](handleError(_0x281922,null));};exports['addAgents']=function(_0x586fa5,_0x1115b7){var _0x1e0bc9,_0x4b16fa;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x586fa5['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x1115b7,null))[_0x834e('0x18')](function(_0x5d994e){if(_0x5d994e){_0x4b16fa=_0x5d994e;return _0x5d994e['addAgents'](_0x586fa5[_0x834e('0x38')][_0x834e('0x71')],_['omit'](_0x586fa5['body'],[_0x834e('0x71'),'id'])||{})[_0x834e('0x86')](function(_0x5d6f5e){for(var _0x480290=0x0;_0x480290<_0x586fa5['body']['ids'][_0x834e('0x36')];_0x480290+=0x1){socket['emit'](_0x834e('0x6f'),{'UserId':Number(_0x586fa5['body'][_0x834e('0x71')][_0x480290]),'VoiceQueueId':Number(_0x586fa5[_0x834e('0x41')]['id'])});}return _0x5d6f5e;});}})[_0x834e('0x18')](function(_0x3d2569){_0x1e0bc9=_0x3d2569||[];if(_0x4b16fa){return db['User'][_0x834e('0x2d')]({'where':{'id':_0x586fa5[_0x834e('0x38')][_0x834e('0x71')]},'attributes':['id',_0x834e('0x25'),_0x834e('0x5f'),_0x834e('0x6d'),_0x834e('0x60')],'raw':!![]});}})[_0x834e('0x18')](function(_0x464ae6){if(!_[_0x834e('0x83')](_0x464ae6)){var _0x590e52=[];for(var _0x40e12e=0x0;_0x40e12e<_0x464ae6['length'];_0x40e12e++){if(_0x464ae6[_0x40e12e][_0x834e('0x5f')]){_0x590e52[_0x834e('0x87')](db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x464ae6[_0x40e12e][_0x834e('0x25')],'UserId':_0x464ae6[_0x40e12e]['id'],'queue_name':_0x4b16fa['name'],'VoiceQueueId':_0x4b16fa['id'],'interface':_[_0x834e('0x6a')](_0x464ae6[_0x40e12e]['interface'])?util['format'](_0x834e('0x6c'),_0x464ae6[_0x40e12e][_0x834e('0x25')]):_0x464ae6[_0x40e12e][_0x834e('0x60')],'paused':_0x464ae6[_0x40e12e]['voicePause']||![],'penalty':_0x586fa5[_0x834e('0x38')][_0x834e('0x62')]||0x0}));}}return BPromise[_0x834e('0x81')](_0x590e52);}})[_0x834e('0x18')](function(){return _0x1e0bc9;})[_0x834e('0x18')](respondWithResult(_0x1115b7,null))[_0x834e('0x2e')](handleError(_0x1115b7,null));};exports[_0x834e('0x84')]=function(_0x687dab,_0x125787){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x687dab['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x125787,null))[_0x834e('0x18')](function(_0x121d4f){if(_0x121d4f){return _0x121d4f[_0x834e('0x84')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])['then'](function(){if(_[_0x834e('0x88')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])){for(var _0x37dea1=0x0;_0x37dea1<_0x687dab[_0x834e('0x2c')][_0x834e('0x71')][_0x834e('0x36')];_0x37dea1+=0x1){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':Number(_0x687dab[_0x834e('0x2c')]['ids'][_0x37dea1]),'VoiceQueueId':Number(_0x687dab['params']['id'])});}}else{socket[_0x834e('0x6e')]('userVoiceQueue:remove',{'UserId':Number(_0x687dab[_0x834e('0x2c')][_0x834e('0x71')]),'VoiceQueueId':Number(_0x687dab[_0x834e('0x41')]['id'])});}});}})[_0x834e('0x18')](function(_0x1daa58){return db[_0x834e('0x69')]['destroy']({'where':{'VoiceQueueId':_0x687dab[_0x834e('0x41')]['id'],'UserId':_0x687dab['query']['ids']}})['then'](function(){return _0x1daa58;});})[_0x834e('0x18')](respondWithStatusCode(_0x125787,null))[_0x834e('0x2e')](handleError(_0x125787,null));};exports['getAgents']=function(_0x5cb379,_0x494e08){var _0x2515f6={};var _0x45c8e6={};var _0x3512d8;var _0x5e0bfe;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5cb379[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x494e08,null))[_0x834e('0x18')](function(_0x3c1a19){if(_0x3c1a19){_0x3512d8=_0x3c1a19;_0x45c8e6['model']=_['keys'](db['User']['rawAttributes']);_0x45c8e6[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5cb379[_0x834e('0x2c')]);_0x45c8e6[_0x834e('0x31')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],_0x45c8e6[_0x834e('0x2c')]);_0x2515f6[_0x834e('0x33')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x35')]));_0x2515f6[_0x834e('0x33')]=_0x2515f6[_0x834e('0x33')]['length']?_0x2515f6['attributes']:_0x45c8e6[_0x834e('0x32')];_0x2515f6[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5cb379['query'][_0x834e('0x4e')]);_0x2515f6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x5cb379[_0x834e('0x2c')],_0x45c8e6[_0x834e('0x31')]));if(_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]){_0x2515f6[_0x834e('0x51')]=_['merge'](_0x2515f6[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x2515f6[_0x834e('0x33')],function(_0x2f1de8){var _0x4b6834={};_0x4b6834[_0x2f1de8]={'$like':'%'+_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4b6834;})});}_0x2515f6=_[_0x834e('0x43')]({},_0x2515f6,_0x5cb379[_0x834e('0x44')]);return _0x3512d8[_0x834e('0x89')](_0x2515f6);}})[_0x834e('0x18')](function(_0x3f6ead){if(_0x3f6ead){_0x5e0bfe=_0x3f6ead[_0x834e('0x36')];if(!_0x5cb379[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x2515f6['limit']=qs[_0x834e('0x13')](_0x5cb379['query'][_0x834e('0x13')]);_0x2515f6[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x3512d8['getAgents'](_0x2515f6);}})[_0x834e('0x18')](function(_0x29f970){if(_0x29f970){return _0x29f970?{'count':_0x5e0bfe,'rows':_0x29f970}:null;}})['then'](respondWithResult(_0x494e08,null))['catch'](handleError(_0x494e08,null));};exports[_0x834e('0x8a')]=function(_0x4db3c5,_0x4e6a75){var _0x57a989={};var _0x26cb93={};var _0x39bd0c;var _0xbd9400;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x4db3c5[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x4e6a75,null))['then'](function(_0x28825c){if(_0x28825c){_0x39bd0c=_0x28825c;_0x26cb93[_0x834e('0x32')]=_['keys'](db['UserVoiceQueueRt'][_0x834e('0x27')]);_0x26cb93[_0x834e('0x2c')]=_['keys'](_0x4db3c5['query']);_0x26cb93[_0x834e('0x31')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],_0x26cb93['query']);_0x57a989[_0x834e('0x33')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],qs['fields'](_0x4db3c5[_0x834e('0x2c')]['fields']));_0x57a989[_0x834e('0x33')]=_0x57a989[_0x834e('0x33')][_0x834e('0x36')]?_0x57a989[_0x834e('0x33')]:_0x26cb93[_0x834e('0x32')];_0x57a989['order']=qs[_0x834e('0x4e')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x4e')]);_0x57a989[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x4db3c5['query'],_0x26cb93[_0x834e('0x31')]));if(_0x4db3c5[_0x834e('0x2c')][_0x834e('0x52')]){_0x57a989['where']=_[_0x834e('0x43')](_0x57a989[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x57a989[_0x834e('0x33')],function(_0x53faec){var _0x3cc563={};_0x3cc563[_0x53faec]={'$like':'%'+_0x4db3c5[_0x834e('0x2c')]['filter']+'%'};return _0x3cc563;})});}_0x57a989=_[_0x834e('0x43')]({},_0x57a989,_0x4db3c5[_0x834e('0x44')]);return _0x39bd0c[_0x834e('0x8a')](_0x57a989);}})[_0x834e('0x18')](function(_0x4b0246){if(_0x4b0246){_0xbd9400=_0x4b0246[_0x834e('0x36')];if(!_0x4db3c5['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x57a989[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x13')]);_0x57a989['offset']=qs['offset'](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x39bd0c['getMembers'](_0x57a989);}})[_0x834e('0x18')](function(_0x4af796){return _0x4af796?{'count':_0xbd9400,'rows':_0x4af796}:null;})[_0x834e('0x18')](respondWithResult(_0x4e6a75,null))[_0x834e('0x2e')](handleError(_0x4e6a75,null));};exports[_0x834e('0x8b')]=function(_0x151b58,_0x2ec7b0){var _0x1ca24b={};var _0x36836f={};var _0x56ae60;var _0x122b03;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x151b58[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2ec7b0,null))['then'](function(_0x167642){if(_0x167642){_0x56ae60=_0x167642;_0x36836f[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmList']['rawAttributes']);_0x36836f['query']=_[_0x834e('0x30')](_0x151b58[_0x834e('0x2c')]);_0x36836f[_0x834e('0x31')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],_0x36836f[_0x834e('0x2c')]);_0x1ca24b[_0x834e('0x33')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],qs[_0x834e('0x35')](_0x151b58[_0x834e('0x2c')]['fields']));_0x1ca24b[_0x834e('0x33')]=_0x1ca24b[_0x834e('0x33')][_0x834e('0x36')]?_0x1ca24b[_0x834e('0x33')]:_0x36836f[_0x834e('0x32')];_0x1ca24b[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x151b58[_0x834e('0x2c')]['sort']);_0x1ca24b[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x151b58[_0x834e('0x2c')],_0x36836f[_0x834e('0x31')]));if(_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]){_0x1ca24b['where']=_['merge'](_0x1ca24b[_0x834e('0x51')],{'$or':_['map'](_0x1ca24b[_0x834e('0x33')],function(_0x433cb4){var _0x18638d={};_0x18638d[_0x433cb4]={'$like':'%'+_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x18638d;})});}_0x1ca24b=_['merge']({},_0x1ca24b,_0x151b58[_0x834e('0x44')]);return _0x56ae60['getLists'](_0x1ca24b);}})['then'](function(_0x3d8b08){if(_0x3d8b08){_0x122b03=_0x3d8b08[_0x834e('0x36')];if(!_0x151b58[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1ca24b[_0x834e('0x13')]=qs['limit'](_0x151b58[_0x834e('0x2c')][_0x834e('0x13')]);_0x1ca24b['offset']=qs[_0x834e('0x12')](_0x151b58[_0x834e('0x2c')]['offset']);}return _0x56ae60[_0x834e('0x8b')](_0x1ca24b);}})[_0x834e('0x18')](function(_0x47a239){if(_0x47a239){return _0x47a239?{'count':_0x122b03,'rows':_0x47a239}:null;}})[_0x834e('0x18')](respondWithResult(_0x2ec7b0,null))[_0x834e('0x2e')](handleError(_0x2ec7b0,null));};exports[_0x834e('0x8c')]=function(_0x3b658a,_0x34a13d){var _0x29b8fd=moment()[_0x834e('0x6b')](_0x834e('0x8d'));var _0x208bbe,_0xe0b3;return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x3b658a[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x34a13d,null))[_0x834e('0x18')](function(_0x371767){if(_0x371767){_0xe0b3=_0x371767;return _0x371767[_0x834e('0x8c')](_0x3b658a[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x3b658a[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x5af6fc){var _0x2ddbc0;_0x208bbe=_0x5af6fc||[];var _0x1cd122=[];if(_0x5af6fc){for(var _0x49be08=0x0;_0x49be08<_0x5af6fc['length'];_0x49be08+=0x1){var _0x563f20=_0x5af6fc[_0x49be08][_0x834e('0x1a')]({'plain':!![]});_0xe0b3[_0x834e('0x8e')]=_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]?_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]:_0xe0b3[_0x834e('0x8e')];switch(_0xe0b3['dialCheckDuplicateType']){case'always':_0x2ddbc0=squel['insert']()['into'](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt','ContactId','ListId',_0x834e('0x50'),'createdAt','updatedAt'],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','updatedAt')['from']('cm_contacts')['where'](_0x834e('0x95'))[_0x834e('0x51')]('ListId\x20=\x20?',_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0x834e('0x75')](_0x834e('0x98'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]()))[_0x834e('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))['from'](_0x834e('0x8f'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;case _0x834e('0x9b'):_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt',_0x834e('0x9e'),'ListId',_0x834e('0x50'),'createdAt',_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')['field'](_0x563f20['CmListId'][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),_0x834e('0x50'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))['field']('\x27'+_0x29b8fd+'\x27','updatedAt')[_0x834e('0x75')](_0x834e('0x9f'))[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))[_0x834e('0x75')](_0x834e('0x8f'))[_0x834e('0x51')]('VoiceQueueId\x20=\x20?',_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;default:_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')](['phone','scheduledAt',_0x834e('0x9e'),'ListId','VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel['select']()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','scheduledAt')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))['from']('cm_contacts')[_0x834e('0x51')](_0x834e('0x95'))['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96')))[_0x834e('0x7b')]();}_0x1cd122[_0x834e('0x87')](db[_0x834e('0x63')]['query'](_0x2ddbc0));}return BPromise['all'](_0x1cd122);}})['then'](function(){var _0xbafedb=[];var _0x1d004f=squel[_0x834e('0x9c')]()['into']('cm_hopper_additional_phones')[_0x834e('0x90')]([_0x834e('0xa1'),_0x834e('0x91'),_0x834e('0xa2'),_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0xa3'))[_0x834e('0x73')](_0x834e('0xa4'))['field'](_0x834e('0xa5'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','createdAt')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))[_0x834e('0x75')](_0x834e('0xa6'),'ci')[_0x834e('0x77')](_0x834e('0x8f'),'h',_0x834e('0xa7'))[_0x834e('0x51')](_0x834e('0xa8'),_0x29b8fd)[_0x834e('0x51')](_0x834e('0xa9'),_0x834e('0xaa')))[_0x834e('0x7b')]();_0xbafedb[_0x834e('0x87')](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d004f));return BPromise[_0x834e('0x81')](_0xbafedb);})[_0x834e('0x18')](function(){return _0x208bbe;})[_0x834e('0x18')](respondWithResult(_0x34a13d,null))[_0x834e('0x2e')](handleError(_0x34a13d,null));};exports[_0x834e('0xab')]=function(_0x239efd,_0x2f7170){return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x239efd[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2f7170,null))[_0x834e('0x18')](function(_0x3fd7a3){if(_0x3fd7a3){return _0x3fd7a3[_0x834e('0xab')](_0x239efd[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x41d0a7){if(_0x41d0a7){return db[_0x834e('0x53')][_0x834e('0x19')]({'where':{'ListId':_0x239efd['query'][_0x834e('0x71')],'VoiceQueueId':_0x239efd[_0x834e('0x41')]['id']}})['then'](function(){return _0x41d0a7;});}})[_0x834e('0x18')](respondWithStatusCode(_0x2f7170,null))[_0x834e('0x2e')](handleError(_0x2f7170,null));};exports['getBlackLists']=function(_0x16a7a9,_0x18b8c7){var _0x576ece={};var _0x51c877={};var _0x54915f;var _0x32d06c;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x16a7a9[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x18b8c7,null))[_0x834e('0x18')](function(_0x132711){if(_0x132711){_0x54915f=_0x132711;_0x51c877[_0x834e('0x32')]=_['keys'](db[_0x834e('0xac')][_0x834e('0x27')]);_0x51c877[_0x834e('0x2c')]=_['keys'](_0x16a7a9[_0x834e('0x2c')]);_0x51c877[_0x834e('0x31')]=_['intersection'](_0x51c877[_0x834e('0x32')],_0x51c877[_0x834e('0x2c')]);_0x576ece['attributes']=_[_0x834e('0x34')](_0x51c877[_0x834e('0x32')],qs[_0x834e('0x35')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x35')]));_0x576ece['attributes']=_0x576ece['attributes'][_0x834e('0x36')]?_0x576ece[_0x834e('0x33')]:_0x51c877[_0x834e('0x32')];_0x576ece['order']=qs[_0x834e('0x4e')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x4e')]);_0x576ece[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x16a7a9['query'],_0x51c877[_0x834e('0x31')]));if(_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]){_0x576ece[_0x834e('0x51')]=_[_0x834e('0x43')](_0x576ece['where'],{'$or':_['map'](_0x576ece[_0x834e('0x33')],function(_0x5eca84){var _0xcb4fe4={};_0xcb4fe4[_0x5eca84]={'$like':'%'+_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0xcb4fe4;})});}_0x576ece=_[_0x834e('0x43')]({},_0x576ece,_0x16a7a9[_0x834e('0x44')]);return _0x54915f[_0x834e('0xad')](_0x576ece);}})[_0x834e('0x18')](function(_0x5b4718){if(_0x5b4718){_0x32d06c=_0x5b4718[_0x834e('0x36')];if(!_0x16a7a9[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x576ece[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x16a7a9['query'][_0x834e('0x13')]);_0x576ece['offset']=qs[_0x834e('0x12')](_0x16a7a9['query'][_0x834e('0x12')]);}return _0x54915f[_0x834e('0xad')](_0x576ece);}})['then'](function(_0x3757bf){if(_0x3757bf){return _0x3757bf?{'count':_0x32d06c,'rows':_0x3757bf}:null;}})['then'](respondWithResult(_0x18b8c7,null))[_0x834e('0x2e')](handleError(_0x18b8c7,null));};exports[_0x834e('0xae')]=function(_0x395b48,_0x5b4208){var _0x4c9b90;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x395b48[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x5b4208,null))[_0x834e('0x18')](function(_0x414ff2){if(_0x414ff2){return _0x414ff2[_0x834e('0xae')](_0x395b48[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x395b48[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x3aeca7){var _0x1d9e00;_0x4c9b90=_0x3aeca7||[];var _0x11db76=[];if(_0x3aeca7){for(var _0x37f058=0x0;_0x37f058<_0x3aeca7[_0x834e('0x36')];_0x37f058+=0x1){var _0x354497=_0x3aeca7[_0x37f058]['get']({'plain':!![]});_0x1d9e00=squel[_0x834e('0x9c')]()['into'](_0x834e('0xaf'))[_0x834e('0x90')]([_0x834e('0x91'),_0x834e('0x9e'),_0x834e('0x94'),'VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x354497[_0x834e('0x93')]['toString'](),'ListId')['field'](_0x395b48['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('NOW()',_0x834e('0x46'))[_0x834e('0x73')](_0x834e('0xb0'),'updatedAt')[_0x834e('0x75')]('cm_contacts')[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')[_0x834e('0x51')]('ListId\x20=\x20?',_0x354497[_0x834e('0x93')][_0x834e('0x7b')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x11db76['push'](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d9e00));}return BPromise['all'](_0x11db76);}})[_0x834e('0x18')](function(){return _0x4c9b90;})[_0x834e('0x18')](respondWithResult(_0x5b4208,null))[_0x834e('0x2e')](handleError(_0x5b4208,null));};exports['removeBlackLists']=function(_0x5cb260,_0x5b3fda){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x5cb260[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b3fda,null))[_0x834e('0x18')](function(_0x1e5e2a){if(_0x1e5e2a){return _0x1e5e2a[_0x834e('0xb1')](_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x549c2f){if(_0x549c2f){return db['CmHopperBlack'][_0x834e('0x19')]({'where':{'ListId':_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')],'VoiceQueueId':_0x5cb260[_0x834e('0x41')]['id']}})[_0x834e('0x18')](function(){return _0x549c2f;});}})[_0x834e('0x18')](respondWithStatusCode(_0x5b3fda,null))[_0x834e('0x2e')](handleError(_0x5b3fda,null));}; \ No newline at end of file +var _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x40e121,_0x51c9bf){var _0x3585c7=function(_0x3e7b20){while(--_0x3e7b20){_0x40e121['push'](_0x40e121['shift']());}};_0x3585c7(++_0x51c9bf);}(_0x5fc3,0xa8));var _0x35fc=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x5fc3[_0x7c0074];return _0x13e95b;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index af13203..2c38088 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 _0x6784=['hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','remove'];(function(_0x1df890,_0x5d54e4){var _0xf26a12=function(_0x1e1e0c){while(--_0x1e1e0c){_0x1df890['push'](_0x1df890['shift']());}};_0xf26a12(++_0x5d54e4);}(_0x6784,0x116));var _0x4678=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x6784[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require(_0x4678('0x0'));var VoiceQueue=require(_0x4678('0x1'))['db'][_0x4678('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4678('0x3')};function emitEvent(_0x270e33){return function(_0x320e0a,_0xfa0ff3,_0x44df88){VoiceQueueEvents['emit'](_0x270e33+':'+_0x320e0a['id'],_0x320e0a);VoiceQueueEvents['emit'](_0x270e33,_0x320e0a);_0x44df88(null);};}for(var e in events){if(events[_0x4678('0x4')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x4678('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0xdd78=['../../mysqldb','VoiceQueue','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5d77e5,_0x414096){var _0x16923a=function(_0x8b869b){while(--_0x8b869b){_0x5d77e5['push'](_0x5d77e5['shift']());}};_0x16923a(++_0x414096);}(_0xdd78,0x15e));var _0x8dd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd78[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x8dd7('0x0'));var VoiceQueue=require(_0x8dd7('0x1'))['db'][_0x8dd7('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8dd7('0x3'),'afterUpdate':_0x8dd7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5cf64c){return function(_0x5a1b4a,_0x2d8a95,_0x46ae5a){VoiceQueueEvents[_0x8dd7('0x5')](_0x5cf64c+':'+_0x5a1b4a['id'],_0x5a1b4a);VoiceQueueEvents[_0x8dd7('0x5')](_0x5cf64c,_0x5a1b4a);_0x46ae5a(null);};}for(var e in events){if(events[_0x8dd7('0x6')](e)){var event=events[e];VoiceQueue[_0x8dd7('0x7')](e,emitEvent(event));}}module[_0x8dd7('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3e6d499..d1f6ff8 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x56fbaa,_0x3bc5a6){var _0x49fbc1=function(_0x19b08b){while(--_0x19b08b){_0x56fbaa['push'](_0x56fbaa['shift']());}};_0x49fbc1(++_0x3bc5a6);}(_0x70e0,0x17b));var _0x070e=function(_0x6de1b3,_0x2d2da3){_0x6de1b3=_0x6de1b3-0x0;var _0x27df24=_0x70e0[_0x6de1b3];return _0x27df24;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x4cf09a,_0x45c108){var _0x4cb22f=function(_0x171eac){while(--_0x171eac){_0x4cf09a['push'](_0x4cf09a['shift']());}};_0x4cb22f(++_0x45c108);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ca5253c..717b288 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 _0x1a60=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','where','attributes','include','model','map','then','GetVoiceQueue','debug','ShowVoiceQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x41d24e,_0x14fbc9){var _0x39850e=function(_0x5dc82d){while(--_0x5dc82d){_0x41d24e['push'](_0x41d24e['shift']());}};_0x39850e(++_0x14fbc9);}(_0x1a60,0x98));var _0x01a6=function(_0x2f2267,_0x18a559){_0x2f2267=_0x2f2267-0x0;var _0x5e6c8e=_0x1a60[_0x2f2267];return _0x5e6c8e;};'use strict';var _=require(_0x01a6('0x0'));var util=require(_0x01a6('0x1'));var moment=require(_0x01a6('0x2'));var BPromise=require('bluebird');var rs=require(_0x01a6('0x3'));var fs=require('fs');var Redis=require(_0x01a6('0x4'));var db=require(_0x01a6('0x5'))['db'];var utils=require(_0x01a6('0x6'));var logger=require(_0x01a6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x01a6('0x8'));var client=jayson[_0x01a6('0x9')]['http']({'port':0x232a});config[_0x01a6('0xa')]=_[_0x01a6('0xb')](config[_0x01a6('0xa')],{'host':_0x01a6('0xc'),'port':0x18eb});var socket=require(_0x01a6('0xd'))(new Redis(config[_0x01a6('0xa')]));require(_0x01a6('0xe'))['register'](socket);function respondWithRpcPromise(_0x47aea2,_0x3b2e0c,_0x27b6c6){return new BPromise(function(_0xbb6334,_0x7f5a9){return client[_0x01a6('0xf')](_0x47aea2,_0x27b6c6)['then'](function(_0x9bf5fc){logger[_0x01a6('0x10')](_0x01a6('0x11'),_0x3b2e0c,_0x01a6('0x12'));logger['debug'](_0x01a6('0x13'),_0x3b2e0c,_0x01a6('0x12'),JSON[_0x01a6('0x14')](_0x9bf5fc));if(_0x9bf5fc[_0x01a6('0x15')]){if(_0x9bf5fc['error'][_0x01a6('0x16')]===0x1f4){logger[_0x01a6('0x15')](_0x01a6('0x11'),_0x3b2e0c,_0x9bf5fc[_0x01a6('0x15')][_0x01a6('0x17')]);return _0x7f5a9(_0x9bf5fc[_0x01a6('0x15')][_0x01a6('0x17')]);}logger[_0x01a6('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x3b2e0c,_0x9bf5fc['error'][_0x01a6('0x17')]);return _0xbb6334(_0x9bf5fc['error'][_0x01a6('0x17')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x3b2e0c,'request\x20sent');_0xbb6334(_0x9bf5fc[_0x01a6('0x18')][_0x01a6('0x17')]);}})[_0x01a6('0x19')](function(_0x38eca0){logger['error'](_0x01a6('0x11'),_0x3b2e0c,_0x38eca0);_0x7f5a9(_0x38eca0);});});}exports['GetVoiceQueue']=function(_0x228a8a){var _0xa0fd70=this;return new Promise(function(_0x235621,_0x5afea3){return db[_0x01a6('0x1a')][_0x01a6('0x1b')]({'raw':_0x228a8a[_0x01a6('0x1c')]?_0x228a8a[_0x01a6('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x228a8a[_0x01a6('0x1c')]?_0x228a8a['options'][_0x01a6('0x1d')]||null:null,'attributes':_0x228a8a[_0x01a6('0x1c')]?_0x228a8a[_0x01a6('0x1c')][_0x01a6('0x1e')]||null:null,'limit':_0x228a8a[_0x01a6('0x1c')]?_0x228a8a[_0x01a6('0x1c')]['limit']||null:null,'include':_0x228a8a[_0x01a6('0x1c')]?_0x228a8a[_0x01a6('0x1c')]['include']?_['map'](_0x228a8a[_0x01a6('0x1c')][_0x01a6('0x1f')],function(_0x5e5a39){return{'model':db[_0x5e5a39[_0x01a6('0x20')]],'as':_0x5e5a39['as'],'attributes':_0x5e5a39['attributes'],'include':_0x5e5a39[_0x01a6('0x1f')]?_[_0x01a6('0x21')](_0x5e5a39[_0x01a6('0x1f')],function(_0x45b884){return{'model':db[_0x45b884[_0x01a6('0x20')]],'as':_0x45b884['as'],'attributes':_0x45b884['attributes'],'include':_0x45b884['include']?_['map'](_0x45b884[_0x01a6('0x1f')],function(_0x2a7bf3){return{'model':db[_0x2a7bf3[_0x01a6('0x20')]],'as':_0x2a7bf3['as'],'attributes':_0x2a7bf3['attributes']};}):[]};}):[]};}):[]:[]})[_0x01a6('0x22')](function(_0x5ecb08){logger[_0x01a6('0x10')](_0x01a6('0x23'),_0x228a8a);logger[_0x01a6('0x24')](_0x01a6('0x23'),_0x228a8a,JSON[_0x01a6('0x14')](_0x5ecb08));_0x235621(_0x5ecb08);})['catch'](function(_0x50dc66){logger[_0x01a6('0x15')](_0x01a6('0x23'),_0x50dc66[_0x01a6('0x17')],_0x228a8a);_0x5afea3(_0xa0fd70['error'](0x1f4,_0x50dc66[_0x01a6('0x17')]));});});};exports[_0x01a6('0x25')]=function(_0x1f06ae){var _0x3c1417=this;return new Promise(function(_0x48a975,_0x548573){return db[_0x01a6('0x1a')][_0x01a6('0x26')]({'raw':_0x1f06ae[_0x01a6('0x1c')]?_0x1f06ae[_0x01a6('0x1c')][_0x01a6('0x27')]===undefined?!![]:![]:!![],'where':_0x1f06ae[_0x01a6('0x1c')]?_0x1f06ae['options'][_0x01a6('0x1d')]||null:null,'attributes':_0x1f06ae[_0x01a6('0x1c')]?_0x1f06ae[_0x01a6('0x1c')][_0x01a6('0x1e')]||null:null,'include':_0x1f06ae['options']?_0x1f06ae[_0x01a6('0x1c')][_0x01a6('0x1f')]?_[_0x01a6('0x21')](_0x1f06ae['options'][_0x01a6('0x1f')],function(_0x1f424f){return{'model':db[_0x1f424f[_0x01a6('0x20')]],'as':_0x1f424f['as'],'attributes':_0x1f424f[_0x01a6('0x1e')],'include':_0x1f424f[_0x01a6('0x1f')]?_[_0x01a6('0x21')](_0x1f424f['include'],function(_0x565be1){return{'model':db[_0x565be1[_0x01a6('0x20')]],'as':_0x565be1['as'],'attributes':_0x565be1[_0x01a6('0x1e')],'include':_0x565be1[_0x01a6('0x1f')]?_[_0x01a6('0x21')](_0x565be1[_0x01a6('0x1f')],function(_0x36e38c){return{'model':db[_0x36e38c['model']],'as':_0x36e38c['as'],'attributes':_0x36e38c[_0x01a6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x01a6('0x22')](function(_0x4b5272){logger[_0x01a6('0x10')](_0x01a6('0x25'),_0x1f06ae);logger[_0x01a6('0x24')](_0x01a6('0x25'),_0x1f06ae,JSON[_0x01a6('0x14')](_0x4b5272));_0x48a975(_0x4b5272);})['catch'](function(_0x2bbff0){logger[_0x01a6('0x15')]('ShowVoiceQueue',_0x2bbff0[_0x01a6('0x17')],_0x1f06ae);_0x548573(_0x3c1417[_0x01a6('0x15')](0x1f4,_0x2bbff0[_0x01a6('0x17')]));});});}; \ No newline at end of file +var _0x1afb=['ShowVoiceQueue','raw','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','attributes','limit','map','include','model'];(function(_0x17efbe,_0x25b0b7){var _0x4ecff1=function(_0xc37d53){while(--_0xc37d53){_0x17efbe['push'](_0x17efbe['shift']());}};_0x4ecff1(++_0x25b0b7);}(_0x1afb,0x150));var _0xb1af=function(_0x34a128,_0x43d993){_0x34a128=_0x34a128-0x0;var _0x170823=_0x1afb[_0x34a128];return _0x170823;};'use strict';var _=require(_0xb1af('0x0'));var util=require(_0xb1af('0x1'));var moment=require(_0xb1af('0x2'));var BPromise=require(_0xb1af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1af('0x4'));var db=require(_0xb1af('0x5'))['db'];var utils=require(_0xb1af('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb1af('0x7')]({'port':0x232a});config[_0xb1af('0x8')]=_[_0xb1af('0x9')](config[_0xb1af('0x8')],{'host':_0xb1af('0xa'),'port':0x18eb});var socket=require(_0xb1af('0xb'))(new Redis(config[_0xb1af('0x8')]));require('./voiceQueue.socket')[_0xb1af('0xc')](socket);function respondWithRpcPromise(_0x23e46e,_0x5d5363,_0x1cd5bc){return new BPromise(function(_0x55b32b,_0x2e5a60){return client[_0xb1af('0xd')](_0x23e46e,_0x1cd5bc)[_0xb1af('0xe')](function(_0x2eab3d){logger[_0xb1af('0xf')](_0xb1af('0x10'),_0x5d5363,_0xb1af('0x11'));logger[_0xb1af('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5d5363,_0xb1af('0x11'),JSON[_0xb1af('0x13')](_0x2eab3d));if(_0x2eab3d['error']){if(_0x2eab3d['error'][_0xb1af('0x14')]===0x1f4){logger[_0xb1af('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x5d5363,_0x2eab3d[_0xb1af('0x15')][_0xb1af('0x16')]);return _0x2e5a60(_0x2eab3d[_0xb1af('0x15')][_0xb1af('0x16')]);}logger[_0xb1af('0x15')](_0xb1af('0x10'),_0x5d5363,_0x2eab3d['error'][_0xb1af('0x16')]);return _0x55b32b(_0x2eab3d[_0xb1af('0x15')][_0xb1af('0x16')]);}else{logger['info'](_0xb1af('0x10'),_0x5d5363,_0xb1af('0x11'));_0x55b32b(_0x2eab3d[_0xb1af('0x17')][_0xb1af('0x16')]);}})[_0xb1af('0x18')](function(_0x128ab3){logger[_0xb1af('0x15')](_0xb1af('0x10'),_0x5d5363,_0x128ab3);_0x2e5a60(_0x128ab3);});});}exports[_0xb1af('0x19')]=function(_0x4c942a){var _0x1ff2e2=this;return new Promise(function(_0x29442a,_0x207b13){return db[_0xb1af('0x1a')][_0xb1af('0x1b')]({'raw':_0x4c942a[_0xb1af('0x1c')]?_0x4c942a['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c942a[_0xb1af('0x1c')]?_0x4c942a['options']['where']||null:null,'attributes':_0x4c942a[_0xb1af('0x1c')]?_0x4c942a[_0xb1af('0x1c')][_0xb1af('0x1d')]||null:null,'limit':_0x4c942a[_0xb1af('0x1c')]?_0x4c942a[_0xb1af('0x1c')][_0xb1af('0x1e')]||null:null,'include':_0x4c942a[_0xb1af('0x1c')]?_0x4c942a[_0xb1af('0x1c')]['include']?_[_0xb1af('0x1f')](_0x4c942a[_0xb1af('0x1c')][_0xb1af('0x20')],function(_0x44d407){return{'model':db[_0x44d407[_0xb1af('0x21')]],'as':_0x44d407['as'],'attributes':_0x44d407[_0xb1af('0x1d')],'include':_0x44d407[_0xb1af('0x20')]?_[_0xb1af('0x1f')](_0x44d407[_0xb1af('0x20')],function(_0xd5b791){return{'model':db[_0xd5b791[_0xb1af('0x21')]],'as':_0xd5b791['as'],'attributes':_0xd5b791[_0xb1af('0x1d')],'include':_0xd5b791[_0xb1af('0x20')]?_['map'](_0xd5b791[_0xb1af('0x20')],function(_0x3f47a9){return{'model':db[_0x3f47a9[_0xb1af('0x21')]],'as':_0x3f47a9['as'],'attributes':_0x3f47a9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56d970){logger['info'](_0xb1af('0x19'),_0x4c942a);logger['debug']('GetVoiceQueue',_0x4c942a,JSON[_0xb1af('0x13')](_0x56d970));_0x29442a(_0x56d970);})[_0xb1af('0x18')](function(_0x4b1af2){logger[_0xb1af('0x15')](_0xb1af('0x19'),_0x4b1af2[_0xb1af('0x16')],_0x4c942a);_0x207b13(_0x1ff2e2[_0xb1af('0x15')](0x1f4,_0x4b1af2[_0xb1af('0x16')]));});});};exports[_0xb1af('0x22')]=function(_0x42a66f){var _0x5ac02a=this;return new Promise(function(_0x2fa3ca,_0xefc3c3){return db[_0xb1af('0x1a')]['find']({'raw':_0x42a66f['options']?_0x42a66f[_0xb1af('0x1c')][_0xb1af('0x23')]===undefined?!![]:![]:!![],'where':_0x42a66f['options']?_0x42a66f[_0xb1af('0x1c')][_0xb1af('0x24')]||null:null,'attributes':_0x42a66f[_0xb1af('0x1c')]?_0x42a66f['options'][_0xb1af('0x1d')]||null:null,'include':_0x42a66f[_0xb1af('0x1c')]?_0x42a66f[_0xb1af('0x1c')][_0xb1af('0x20')]?_[_0xb1af('0x1f')](_0x42a66f[_0xb1af('0x1c')]['include'],function(_0x34f875){return{'model':db[_0x34f875[_0xb1af('0x21')]],'as':_0x34f875['as'],'attributes':_0x34f875[_0xb1af('0x1d')],'include':_0x34f875[_0xb1af('0x20')]?_[_0xb1af('0x1f')](_0x34f875[_0xb1af('0x20')],function(_0x3708e2){return{'model':db[_0x3708e2[_0xb1af('0x21')]],'as':_0x3708e2['as'],'attributes':_0x3708e2[_0xb1af('0x1d')],'include':_0x3708e2[_0xb1af('0x20')]?_[_0xb1af('0x1f')](_0x3708e2[_0xb1af('0x20')],function(_0x5e49d0){return{'model':db[_0x5e49d0[_0xb1af('0x21')]],'as':_0x5e49d0['as'],'attributes':_0x5e49d0[_0xb1af('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb1af('0xe')](function(_0x26f658){logger[_0xb1af('0xf')](_0xb1af('0x22'),_0x42a66f);logger['debug'](_0xb1af('0x22'),_0x42a66f,JSON[_0xb1af('0x13')](_0x26f658));_0x2fa3ca(_0x26f658);})[_0xb1af('0x18')](function(_0x2402c7){logger['error'](_0xb1af('0x22'),_0x2402c7[_0xb1af('0x16')],_0x42a66f);_0xefc3c3(_0x5ac02a[_0xb1af('0x15')](0x1f4,_0x2402c7['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7a3ce52..09bbbcb 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 _0xd35c=['remove','update','emit','removeListener','register','length','./voiceQueue.events'];(function(_0xe9ba2c,_0xfc7a6f){var _0x3f88a6=function(_0x3a02da){while(--_0x3a02da){_0xe9ba2c['push'](_0xe9ba2c['shift']());}};_0x3f88a6(++_0xfc7a6f);}(_0xd35c,0x18e));var _0xcd35=function(_0x5ddbc2,_0x1e4a76){_0x5ddbc2=_0x5ddbc2-0x0;var _0x1243d6=_0xd35c[_0x5ddbc2];return _0x1243d6;};'use strict';var VoiceQueueEvents=require(_0xcd35('0x0'));var events=['save',_0xcd35('0x1'),_0xcd35('0x2')];function createListener(_0x7156b6,_0x5708a1){return function(_0x513f95){_0x5708a1[_0xcd35('0x3')](_0x7156b6,_0x513f95);};}function removeListener(_0x5e2edc,_0x20a653){return function(){VoiceQueueEvents[_0xcd35('0x4')](_0x5e2edc,_0x20a653);};}exports[_0xcd35('0x5')]=function(_0x59746a){for(var _0x4e3176=0x0,_0x2c0b23=events[_0xcd35('0x6')];_0x4e3176<_0x2c0b23;_0x4e3176++){var _0x21b849=events[_0x4e3176];var _0x5d64eb=createListener('voiceQueue:'+_0x21b849,_0x59746a);VoiceQueueEvents['on'](_0x21b849,_0x5d64eb);}}; \ No newline at end of file +var _0xd022=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x163bfd,_0x516d5b){var _0x372594=function(_0xc6937){while(--_0xc6937){_0x163bfd['push'](_0x163bfd['shift']());}};_0x372594(++_0x516d5b);}(_0xd022,0xe4));var _0x2d02=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd022[_0x21549c];return _0x426cbd;};'use strict';var VoiceQueueEvents=require(_0x2d02('0x0'));var events=[_0x2d02('0x1'),_0x2d02('0x2'),_0x2d02('0x3')];function createListener(_0x196baa,_0x211ba2){return function(_0x28c45e){_0x211ba2[_0x2d02('0x4')](_0x196baa,_0x28c45e);};}function removeListener(_0x5d8ecf,_0x179407){return function(){VoiceQueueEvents[_0x2d02('0x5')](_0x5d8ecf,_0x179407);};}exports[_0x2d02('0x6')]=function(_0x5ea620){for(var _0x12b585=0x0,_0x575e7f=events[_0x2d02('0x7')];_0x12b585<_0x575e7f;_0x12b585++){var _0x5554b0=events[_0x12b585];var _0x564358=createListener(_0x2d02('0x8')+_0x5554b0,_0x5ea620);VoiceQueueEvents['on'](_0x5554b0,_0x564358);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 117195f..32cba0f 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 _0x9efe=['../../config/environment','get','isAuthenticated','index','/describe','getVoiceQueuesReport','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a090b,_0x563434){var _0x346057=function(_0x96b0b0){while(--_0x96b0b0){_0x3a090b['push'](_0x3a090b['shift']());}};_0x346057(++_0x563434);}(_0x9efe,0xbe));var _0xe9ef=function(_0x2931d6,_0x3eff03){_0x2931d6=_0x2931d6-0x0;var _0x288cc9=_0x9efe[_0x2931d6];return _0x288cc9;};'use strict';var multer=require(_0xe9ef('0x0'));var util=require(_0xe9ef('0x1'));var path=require(_0xe9ef('0x2'));var timeout=require(_0xe9ef('0x3'));var express=require('express');var router=express[_0xe9ef('0x4')]();var fs_extra=require(_0xe9ef('0x5'));var auth=require(_0xe9ef('0x6'));var interaction=require(_0xe9ef('0x7'));var config=require(_0xe9ef('0x8'));var controller=require('./voiceQueueReport.controller');router[_0xe9ef('0x9')]('/',auth[_0xe9ef('0xa')](),controller[_0xe9ef('0xb')]);router[_0xe9ef('0x9')](_0xe9ef('0xc'),auth[_0xe9ef('0xa')](),controller['describe']);router[_0xe9ef('0x9')]('/index',auth['isAuthenticated'](),controller[_0xe9ef('0xd')]);router[_0xe9ef('0x9')](_0xe9ef('0xe'),auth[_0xe9ef('0xa')](),controller[_0xe9ef('0xf')]);router[_0xe9ef('0x10')]('/',auth[_0xe9ef('0xa')](),controller[_0xe9ef('0x11')]);router[_0xe9ef('0x12')](_0xe9ef('0xe'),auth[_0xe9ef('0xa')](),controller['update']);router[_0xe9ef('0x13')]('/:id',auth[_0xe9ef('0xa')](),controller[_0xe9ef('0x14')]);module[_0xe9ef('0x15')]=router; \ No newline at end of file +var _0x9e74=['express','fs-extra','./voiceQueueReport.controller','get','isAuthenticated','index','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','util','path','connect-timeout'];(function(_0x2b5e27,_0x97c14b){var _0x3be977=function(_0x12ba0e){while(--_0x12ba0e){_0x2b5e27['push'](_0x2b5e27['shift']());}};_0x3be977(++_0x97c14b);}(_0x9e74,0x1bf));var _0x49e7=function(_0x16a5b9,_0x260ff0){_0x16a5b9=_0x16a5b9-0x0;var _0x1be85b=_0x9e74[_0x16a5b9];return _0x1be85b;};'use strict';var multer=require('multer');var util=require(_0x49e7('0x0'));var path=require(_0x49e7('0x1'));var timeout=require(_0x49e7('0x2'));var express=require(_0x49e7('0x3'));var router=express['Router']();var fs_extra=require(_0x49e7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49e7('0x5'));router[_0x49e7('0x6')]('/',auth[_0x49e7('0x7')](),controller[_0x49e7('0x8')]);router[_0x49e7('0x6')]('/describe',auth[_0x49e7('0x7')](),controller['describe']);router[_0x49e7('0x6')](_0x49e7('0x9'),auth[_0x49e7('0x7')](),controller[_0x49e7('0xa')]);router[_0x49e7('0x6')](_0x49e7('0xb'),auth['isAuthenticated'](),controller[_0x49e7('0xc')]);router[_0x49e7('0xd')]('/',auth[_0x49e7('0x7')](),controller[_0x49e7('0xe')]);router[_0x49e7('0xf')](_0x49e7('0xb'),auth['isAuthenticated'](),controller[_0x49e7('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x49e7('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 cb3edbb..09b8e34 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 _0x81df=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN'];(function(_0x4c3c0f,_0x3612fe){var _0x4d3d07=function(_0x133a76){while(--_0x133a76){_0x4c3c0f['push'](_0x4c3c0f['shift']());}};_0x4d3d07(++_0x3612fe);}(_0x81df,0x1cf));var _0xf81d=function(_0x23405a,_0x506558){_0x23405a=_0x23405a-0x0;var _0x321d14=_0x81df[_0x23405a];return _0x321d14;};'use strict';var Sequelize=require(_0xf81d('0x0'));var moment=require(_0xf81d('0x1'));module[_0xf81d('0x2')]={'type':{'type':Sequelize[_0xf81d('0x3')]},'uniqueid':{'type':Sequelize[_0xf81d('0x3')]},'calleridnum':{'type':Sequelize[_0xf81d('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xf81d('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xf81d('0x4')],'set':function(_0x5ac530){var _0x212653=moment(_0x5ac530);var _0x16a133=moment(this[_0xf81d('0x5')]('queuecallerjoinAt'))['format'](_0xf81d('0x6'));var _0x1b9856=_0x212653[_0xf81d('0x7')](_0x16a133,_0xf81d('0x8'));this[_0xf81d('0x9')]('queuecallerleaveAt',_0x5ac530);this['setDataValue'](_0xf81d('0xa'),_0x1b9856||null);}},'position':{'type':Sequelize[_0xf81d('0xb')]},'count':{'type':Sequelize[_0xf81d('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf81d('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xf81d('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xf81d('0x3')],'comment':_0xf81d('0xd')},'originalposition':{'type':Sequelize[_0xf81d('0xb')]},'channel':{'type':Sequelize[_0xf81d('0x3')]},'connectedlinenum':{'type':Sequelize[_0xf81d('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf81d('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf81d('0x3')]},'priority':{'type':Sequelize[_0xf81d('0x3')]},'holdtime':{'type':Sequelize[_0xf81d('0xb')]},'mohtime':{'type':Sequelize[_0xf81d('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf81d('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xf81d('0x3')]},'disposition':{'type':Sequelize[_0xf81d('0x3')]},'secondDisposition':{'type':Sequelize[_0xf81d('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xf81d('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0xf81d('0x3')]}}; \ No newline at end of file +var _0x9767=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x1b1d6b,_0x491fc5){var _0x3435b=function(_0x2c1a6e){while(--_0x2c1a6e){_0x1b1d6b['push'](_0x1b1d6b['shift']());}};_0x3435b(++_0x491fc5);}(_0x9767,0x1ef));var _0x7976=function(_0x34f459,_0x16a381){_0x34f459=_0x34f459-0x0;var _0x157b24=_0x9767[_0x34f459];return _0x157b24;};'use strict';var Sequelize=require(_0x7976('0x0'));var moment=require('moment');module[_0x7976('0x1')]={'type':{'type':Sequelize[_0x7976('0x2')]},'uniqueid':{'type':Sequelize[_0x7976('0x2')]},'calleridnum':{'type':Sequelize[_0x7976('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7976('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7976('0x3')],'set':function(_0x542545){var _0x502491=moment(_0x542545);var _0x194a85=moment(this[_0x7976('0x4')](_0x7976('0x5')))['format'](_0x7976('0x6'));var _0x986dda=_0x502491[_0x7976('0x7')](_0x194a85,_0x7976('0x8'));this[_0x7976('0x9')](_0x7976('0xa'),_0x542545);this[_0x7976('0x9')](_0x7976('0xb'),_0x986dda||null);}},'position':{'type':Sequelize[_0x7976('0xc')]},'count':{'type':Sequelize[_0x7976('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7976('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x7976('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7976('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7976('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7976('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7976('0x2')],'comment':_0x7976('0xe')},'originalposition':{'type':Sequelize[_0x7976('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7976('0x2')]},'connectedlinename':{'type':Sequelize[_0x7976('0x2')]},'accountcode':{'type':Sequelize[_0x7976('0x2')]},'context':{'type':Sequelize[_0x7976('0x2')]},'exten':{'type':Sequelize[_0x7976('0x2')]},'priority':{'type':Sequelize[_0x7976('0x2')]},'holdtime':{'type':Sequelize[_0x7976('0xc')]},'mohtime':{'type':Sequelize[_0x7976('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7976('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7976('0x2')]},'transfer':{'type':Sequelize[_0x7976('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7976('0x2')],'comment':_0x7976('0xf')},'transferexten':{'type':Sequelize[_0x7976('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7976('0x2')]},'disposition':{'type':Sequelize[_0x7976('0x2')]},'secondDisposition':{'type':Sequelize[_0x7976('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x7976('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x7976('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 7741352..9a8e9dd 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 _0xb2ea=['localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','merge','where','VIRTUAL','filter','VoiceQueueReport','includeAll','include','findAll','rows','show','options','find','create','body','catch','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis'];(function(_0x239309,_0xd95bfe){var _0x3cfab8=function(_0x25e9ed){while(--_0x25e9ed){_0x239309['push'](_0x239309['shift']());}};_0x3cfab8(++_0xd95bfe);}(_0xb2ea,0x89));var _0xab2e=function(_0x375c0b,_0x567d67){_0x375c0b=_0x375c0b-0x0;var _0x4c4bec=_0xb2ea[_0x375c0b];return _0x4c4bec;};'use strict';var emlformat=require(_0xab2e('0x0'));var rimraf=require(_0xab2e('0x1'));var zipdir=require(_0xab2e('0x2'));var jsonpatch=require(_0xab2e('0x3'));var rp=require(_0xab2e('0x4'));var moment=require(_0xab2e('0x5'));var BPromise=require(_0xab2e('0x6'));var Mustache=require(_0xab2e('0x7'));var util=require(_0xab2e('0x8'));var path=require('path');var sox=require(_0xab2e('0x9'));var csv=require(_0xab2e('0xa'));var ejs=require(_0xab2e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab2e('0xc'));var squel=require('squel');var crypto=require(_0xab2e('0xd'));var jsforce=require(_0xab2e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xab2e('0xa'));var querystring=require('querystring');var Papa=require(_0xab2e('0xf'));var Redis=require(_0xab2e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab2e('0x11'));var hardwareService=require(_0xab2e('0x12'));var logger=require(_0xab2e('0x13'))(_0xab2e('0x14'));var utils=require(_0xab2e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab2e('0x16'))['db'];config['redis']=_[_0xab2e('0x17')](config[_0xab2e('0x18')],{'host':_0xab2e('0x19'),'port':0x18eb});var socket=require(_0xab2e('0x1a'))(new Redis(config[_0xab2e('0x18')]));require(_0xab2e('0x1b'))[_0xab2e('0x1c')](socket);function respondWithStatusCode(_0x285376,_0x4dfb5c){_0x4dfb5c=_0x4dfb5c||0xcc;return function(_0x53e3ee){if(_0x53e3ee){return _0x285376[_0xab2e('0x1d')](_0x4dfb5c);}return _0x285376[_0xab2e('0x1e')](_0x4dfb5c)[_0xab2e('0x1f')]();};}function respondWithResult(_0x4e7838,_0x1d3934){_0x1d3934=_0x1d3934||0xc8;return function(_0x3c41e6){if(_0x3c41e6){return _0x4e7838[_0xab2e('0x1e')](_0x1d3934)[_0xab2e('0x20')](_0x3c41e6);}};}function respondWithFilteredResult(_0x185a5c,_0x26a98d){return function(_0x4eba4c){if(_0x4eba4c){var _0x4608a6=typeof _0x26a98d[_0xab2e('0x21')]===_0xab2e('0x22')&&typeof _0x26a98d[_0xab2e('0x23')]==='undefined';var _0xbec820=_0x4eba4c[_0xab2e('0x24')];var _0x1ad1ff=_0x4608a6?0x0:_0x26a98d[_0xab2e('0x21')];var _0x171f84=_0x4608a6?_0x4eba4c[_0xab2e('0x24')]:_0x26a98d[_0xab2e('0x21')]+_0x26a98d[_0xab2e('0x23')];var _0x4b4d3d;if(_0x171f84>=_0xbec820){_0x171f84=_0xbec820;_0x4b4d3d=0xc8;}else{_0x4b4d3d=0xce;}_0x185a5c['status'](_0x4b4d3d);return _0x185a5c[_0xab2e('0x25')](_0xab2e('0x26'),_0x1ad1ff+'-'+_0x171f84+'/'+_0xbec820)[_0xab2e('0x20')](_0x4eba4c);}return null;};}function patchUpdates(_0x435215){return function(_0x2f60c9){try{jsonpatch[_0xab2e('0x27')](_0x2f60c9,_0x435215,!![]);}catch(_0x2f9b7b){return BPromise['reject'](_0x2f9b7b);}return _0x2f60c9[_0xab2e('0x28')]();};}function saveUpdates(_0x5e52a9,_0x69156){return function(_0x447888){if(_0x447888){return _0x447888[_0xab2e('0x29')](_0x5e52a9)[_0xab2e('0x2a')](function(_0x5805af){return _0x5805af;});}return null;};}function removeEntity(_0x1fea13,_0x199a0b){return function(_0x42c421){if(_0x42c421){return _0x42c421[_0xab2e('0x2b')]()['then'](function(){_0x1fea13[_0xab2e('0x1e')](0xcc)[_0xab2e('0x1f')]();});}};}function handleEntityNotFound(_0x3043a8,_0x148c02){return function(_0x23e271){if(!_0x23e271){_0x3043a8[_0xab2e('0x1d')](0x194);}return _0x23e271;};}function handleError(_0x54daac,_0x48ed92){_0x48ed92=_0x48ed92||0x1f4;return function(_0x56a950){logger[_0xab2e('0x2c')](_0x56a950[_0xab2e('0x2d')]);if(_0x56a950[_0xab2e('0x2e')]){delete _0x56a950['name'];}_0x54daac[_0xab2e('0x1e')](_0x48ed92)[_0xab2e('0x2f')](_0x56a950);};}exports['index']=function(_0x4adf1e,_0x2a341e){var _0x45207b={},_0x16c7d9={},_0x3ff343={'count':0x0,'rows':[]};var _0x5551e7=_[_0xab2e('0x30')](db['VoiceQueueReport'][_0xab2e('0x31')],function(_0x408d26){return{'name':_0x408d26['fieldName'],'type':_0x408d26[_0xab2e('0x32')][_0xab2e('0x33')]};});_0x16c7d9[_0xab2e('0x34')]=_[_0xab2e('0x30')](_0x5551e7,_0xab2e('0x2e'));_0x16c7d9[_0xab2e('0x35')]=_[_0xab2e('0x36')](_0x4adf1e[_0xab2e('0x35')]);_0x16c7d9['filters']=_[_0xab2e('0x37')](_0x16c7d9['model'],_0x16c7d9[_0xab2e('0x35')]);_0x45207b[_0xab2e('0x38')]=_[_0xab2e('0x37')](_0x16c7d9[_0xab2e('0x34')],qs[_0xab2e('0x39')](_0x4adf1e[_0xab2e('0x35')][_0xab2e('0x39')]));_0x45207b[_0xab2e('0x38')]=_0x45207b['attributes'][_0xab2e('0x3a')]?_0x45207b[_0xab2e('0x38')]:_0x16c7d9[_0xab2e('0x34')];if(!_0x4adf1e[_0xab2e('0x35')]['hasOwnProperty'](_0xab2e('0x3b'))){_0x45207b[_0xab2e('0x23')]=qs[_0xab2e('0x23')](_0x4adf1e[_0xab2e('0x35')][_0xab2e('0x23')]);_0x45207b[_0xab2e('0x21')]=qs['offset'](_0x4adf1e['query'][_0xab2e('0x21')]);}_0x45207b['order']=qs['sort'](_0x4adf1e[_0xab2e('0x35')][_0xab2e('0x3c')]);_0x45207b['where']=qs[_0xab2e('0x3d')](_[_0xab2e('0x3e')](_0x4adf1e['query'],_0x16c7d9['filters']),_0x5551e7);if(_0x4adf1e[_0xab2e('0x35')]['filter']){_0x45207b['where']=_[_0xab2e('0x3f')](_0x45207b[_0xab2e('0x40')],{'$or':_['map'](_0x5551e7,function(_0x433ba3){if(_0x433ba3[_0xab2e('0x32')]!==_0xab2e('0x41')){var _0x5117d5={};_0x5117d5[_0x433ba3[_0xab2e('0x2e')]]={'$like':'%'+_0x4adf1e[_0xab2e('0x35')][_0xab2e('0x42')]+'%'};return _0x5117d5;}})});}_0x45207b=_['merge']({},_0x45207b,_0x4adf1e['options']);var _0x478946={'where':_0x45207b[_0xab2e('0x40')]};return db[_0xab2e('0x43')]['count'](_0x478946)[_0xab2e('0x2a')](function(_0x472310){_0x3ff343['count']=_0x472310;if(_0x4adf1e[_0xab2e('0x35')][_0xab2e('0x44')]){_0x45207b[_0xab2e('0x45')]=[{'all':!![]}];}return db[_0xab2e('0x43')][_0xab2e('0x46')](_0x45207b);})[_0xab2e('0x2a')](function(_0x30ba80){_0x3ff343[_0xab2e('0x47')]=_0x30ba80;return _0x3ff343;})[_0xab2e('0x2a')](respondWithFilteredResult(_0x2a341e,_0x45207b))['catch'](handleError(_0x2a341e,null));};exports[_0xab2e('0x48')]=function(_0x23cf6b,_0x4cddbc){var _0x118140={'raw':![],'where':{'id':_0x23cf6b['params']['id']}},_0x1a8332={};_0x1a8332[_0xab2e('0x34')]=_[_0xab2e('0x36')](db['VoiceQueueReport'][_0xab2e('0x31')]);_0x1a8332[_0xab2e('0x35')]=_[_0xab2e('0x36')](_0x23cf6b[_0xab2e('0x35')]);_0x1a8332[_0xab2e('0x3d')]=_[_0xab2e('0x37')](_0x1a8332['model'],_0x1a8332['query']);_0x118140[_0xab2e('0x38')]=_['intersection'](_0x1a8332[_0xab2e('0x34')],qs[_0xab2e('0x39')](_0x23cf6b[_0xab2e('0x35')][_0xab2e('0x39')]));_0x118140[_0xab2e('0x38')]=_0x118140[_0xab2e('0x38')][_0xab2e('0x3a')]?_0x118140[_0xab2e('0x38')]:_0x1a8332[_0xab2e('0x34')];if(_0x23cf6b['query'][_0xab2e('0x44')]){_0x118140[_0xab2e('0x45')]=[{'all':!![]}];}_0x118140=_['merge']({},_0x118140,_0x23cf6b[_0xab2e('0x49')]);return db[_0xab2e('0x43')][_0xab2e('0x4a')](_0x118140)[_0xab2e('0x2a')](handleEntityNotFound(_0x4cddbc,null))[_0xab2e('0x2a')](respondWithResult(_0x4cddbc,null))['catch'](handleError(_0x4cddbc,null));};exports[_0xab2e('0x4b')]=function(_0x396806,_0xe1d750){return db[_0xab2e('0x43')][_0xab2e('0x4b')](_0x396806[_0xab2e('0x4c')],{})[_0xab2e('0x2a')](respondWithResult(_0xe1d750,0xc9))[_0xab2e('0x4d')](handleError(_0xe1d750,null));};exports['update']=function(_0x1d85de,_0xed96b0){if(_0x1d85de[_0xab2e('0x4c')]['id']){delete _0x1d85de[_0xab2e('0x4c')]['id'];}return db[_0xab2e('0x43')][_0xab2e('0x4a')]({'where':{'id':_0x1d85de['params']['id']}})[_0xab2e('0x2a')](handleEntityNotFound(_0xed96b0,null))[_0xab2e('0x2a')](saveUpdates(_0x1d85de[_0xab2e('0x4c')],null))[_0xab2e('0x2a')](respondWithResult(_0xed96b0,null))['catch'](handleError(_0xed96b0,null));};exports['destroy']=function(_0x2500e0,_0x4dbe91){return db[_0xab2e('0x43')][_0xab2e('0x4a')]({'where':{'id':_0x2500e0['params']['id']}})[_0xab2e('0x2a')](handleEntityNotFound(_0x4dbe91,null))[_0xab2e('0x2a')](removeEntity(_0x4dbe91,null))['catch'](handleError(_0x4dbe91,null));};exports[_0xab2e('0x4e')]=function(_0x2dfbb8,_0x27d15a){return db[_0xab2e('0x43')][_0xab2e('0x4e')]()['then'](respondWithResult(_0x27d15a,null))[_0xab2e('0x4d')](handleError(_0x27d15a,null));};exports[_0xab2e('0x4f')]=function(_0x525301,_0x5e9c47){var _0x5126be={},_0x22da43={},_0x39babf={'count':0x0,'rows':[]};_0x22da43[_0xab2e('0x34')]=_[_0xab2e('0x36')](db['VoiceQueueReport'][_0xab2e('0x31')]);_0x22da43[_0xab2e('0x35')]=_[_0xab2e('0x36')](_0x525301[_0xab2e('0x35')]);_0x22da43[_0xab2e('0x3d')]=_[_0xab2e('0x37')](_0x22da43[_0xab2e('0x34')],_0x22da43['query']);_0x5126be[_0xab2e('0x38')]=_[_0xab2e('0x37')](_0x22da43[_0xab2e('0x34')],qs[_0xab2e('0x39')](_0x525301[_0xab2e('0x35')]['fields']));_0x5126be[_0xab2e('0x38')]=_0x5126be[_0xab2e('0x38')]['length']?_0x5126be[_0xab2e('0x38')]:_0x22da43[_0xab2e('0x34')];if(!_0x525301[_0xab2e('0x35')][_0xab2e('0x50')](_0xab2e('0x3b'))){_0x5126be['limit']=qs[_0xab2e('0x23')](_0x525301[_0xab2e('0x35')][_0xab2e('0x23')]);_0x5126be[_0xab2e('0x21')]=qs[_0xab2e('0x21')](_0x525301[_0xab2e('0x35')][_0xab2e('0x21')]);}_0x5126be['order']=qs['sort'](_0x525301[_0xab2e('0x35')][_0xab2e('0x3c')]);_0x5126be[_0xab2e('0x40')]=qs[_0xab2e('0x3d')](_[_0xab2e('0x3e')](_0x525301[_0xab2e('0x35')],_0x22da43[_0xab2e('0x3d')]));if(_0x525301['query'][_0xab2e('0x42')]){_0x5126be['where']=_[_0xab2e('0x3f')](_0x5126be[_0xab2e('0x40')],{'$or':_[_0xab2e('0x30')](_0x5126be[_0xab2e('0x38')],function(_0x1e9e29){var _0x241a7c={};_0x241a7c[_0x1e9e29]={'$like':'%'+_0x525301[_0xab2e('0x35')]['filter']+'%'};return _0x241a7c;})});}_0x5126be=_[_0xab2e('0x3f')]({},_0x5126be,_0x525301[_0xab2e('0x49')]);var _0x20acc9={'where':_0x5126be[_0xab2e('0x40')]};return db[_0xab2e('0x43')][_0xab2e('0x24')](_0x20acc9)[_0xab2e('0x2a')](function(_0x875e32){_0x39babf[_0xab2e('0x24')]=_0x875e32;if(_0x525301[_0xab2e('0x35')][_0xab2e('0x44')]){_0x5126be[_0xab2e('0x45')]=[{'all':!![]}];}return db[_0xab2e('0x43')]['findAll'](_0x5126be);})['then'](function(_0xc3038c){_0x39babf[_0xab2e('0x47')]=_0xc3038c;return _0x39babf;})[_0xab2e('0x2a')](respondWithFilteredResult(_0x5e9c47,_0x5126be,_0xab2e('0x4f')))[_0xab2e('0x4d')](handleError(_0x5e9c47,null,_0xab2e('0x4f')));}; \ No newline at end of file +var _0x5fd9=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','VoiceQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','order','sort','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x5fd9,0x94));var _0x95fd=function(_0x459349,_0x2e6797){_0x459349=_0x459349-0x0;var _0x35de00=_0x5fd9[_0x459349];return _0x35de00;};'use strict';var emlformat=require(_0x95fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95fd('0x1'));var jsonpatch=require(_0x95fd('0x2'));var rp=require(_0x95fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95fd('0x4'));var util=require(_0x95fd('0x5'));var path=require(_0x95fd('0x6'));var sox=require(_0x95fd('0x7'));var csv=require(_0x95fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95fd('0x9'));var _=require('lodash');var squel=require(_0x95fd('0xa'));var crypto=require(_0x95fd('0xb'));var jsforce=require(_0x95fd('0xc'));var deskjs=require(_0x95fd('0xd'));var toCsv=require(_0x95fd('0x8'));var querystring=require(_0x95fd('0xe'));var Papa=require(_0x95fd('0xf'));var Redis=require(_0x95fd('0x10'));var authService=require(_0x95fd('0x11'));var qs=require(_0x95fd('0x12'));var as=require(_0x95fd('0x13'));var hardwareService=require(_0x95fd('0x14'));var logger=require(_0x95fd('0x15'))(_0x95fd('0x16'));var utils=require(_0x95fd('0x17'));var config=require(_0x95fd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x95fd('0x19'))['db'];config[_0x95fd('0x1a')]=_['defaults'](config[_0x95fd('0x1a')],{'host':_0x95fd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x501f11,_0x2d2562){_0x2d2562=_0x2d2562||0xcc;return function(_0x38e045){if(_0x38e045){return _0x501f11[_0x95fd('0x1c')](_0x2d2562);}return _0x501f11[_0x95fd('0x1d')](_0x2d2562)[_0x95fd('0x1e')]();};}function respondWithResult(_0x21dd55,_0x355838){_0x355838=_0x355838||0xc8;return function(_0x198735){if(_0x198735){return _0x21dd55[_0x95fd('0x1d')](_0x355838)[_0x95fd('0x1f')](_0x198735);}};}function respondWithFilteredResult(_0x41eebf,_0x4750e8){return function(_0x10c8bc){if(_0x10c8bc){var _0x387bc4=typeof _0x4750e8[_0x95fd('0x20')]===_0x95fd('0x21')&&typeof _0x4750e8[_0x95fd('0x22')]===_0x95fd('0x21');var _0x51fe44=_0x10c8bc[_0x95fd('0x23')];var _0x3c12ce=_0x387bc4?0x0:_0x4750e8['offset'];var _0x1ca0e0=_0x387bc4?_0x10c8bc['count']:_0x4750e8[_0x95fd('0x20')]+_0x4750e8[_0x95fd('0x22')];var _0x4770ad;if(_0x1ca0e0>=_0x51fe44){_0x1ca0e0=_0x51fe44;_0x4770ad=0xc8;}else{_0x4770ad=0xce;}_0x41eebf['status'](_0x4770ad);return _0x41eebf[_0x95fd('0x24')](_0x95fd('0x25'),_0x3c12ce+'-'+_0x1ca0e0+'/'+_0x51fe44)['json'](_0x10c8bc);}return null;};}function patchUpdates(_0x8e697e){return function(_0x2687a8){try{jsonpatch[_0x95fd('0x26')](_0x2687a8,_0x8e697e,!![]);}catch(_0x4bee1b){return BPromise[_0x95fd('0x27')](_0x4bee1b);}return _0x2687a8[_0x95fd('0x28')]();};}function saveUpdates(_0x245132,_0x5c20dd){return function(_0x382cf5){if(_0x382cf5){return _0x382cf5[_0x95fd('0x29')](_0x245132)[_0x95fd('0x2a')](function(_0xc5319){return _0xc5319;});}return null;};}function removeEntity(_0xd2bc06,_0x2c3dfa){return function(_0x23b554){if(_0x23b554){return _0x23b554[_0x95fd('0x2b')]()[_0x95fd('0x2a')](function(){_0xd2bc06['status'](0xcc)[_0x95fd('0x1e')]();});}};}function handleEntityNotFound(_0x292b50,_0x263bfd){return function(_0x11ef5a){if(!_0x11ef5a){_0x292b50[_0x95fd('0x1c')](0x194);}return _0x11ef5a;};}function handleError(_0x1dac03,_0x24d180){_0x24d180=_0x24d180||0x1f4;return function(_0x50a319){logger[_0x95fd('0x2c')](_0x50a319[_0x95fd('0x2d')]);if(_0x50a319[_0x95fd('0x2e')]){delete _0x50a319['name'];}_0x1dac03['status'](_0x24d180)['send'](_0x50a319);};}exports['index']=function(_0x44231f,_0x4ca342){var _0x26ebf5={},_0x2018b5={},_0x2df8c2={'count':0x0,'rows':[]};var _0x139677=_[_0x95fd('0x2f')](db[_0x95fd('0x30')][_0x95fd('0x31')],function(_0x3e889c){return{'name':_0x3e889c[_0x95fd('0x32')],'type':_0x3e889c['type']['key']};});_0x2018b5[_0x95fd('0x33')]=_['map'](_0x139677,'name');_0x2018b5[_0x95fd('0x34')]=_[_0x95fd('0x35')](_0x44231f[_0x95fd('0x34')]);_0x2018b5[_0x95fd('0x36')]=_[_0x95fd('0x37')](_0x2018b5[_0x95fd('0x33')],_0x2018b5[_0x95fd('0x34')]);_0x26ebf5[_0x95fd('0x38')]=_[_0x95fd('0x37')](_0x2018b5[_0x95fd('0x33')],qs[_0x95fd('0x39')](_0x44231f['query'][_0x95fd('0x39')]));_0x26ebf5['attributes']=_0x26ebf5['attributes'][_0x95fd('0x3a')]?_0x26ebf5[_0x95fd('0x38')]:_0x2018b5[_0x95fd('0x33')];if(!_0x44231f[_0x95fd('0x34')][_0x95fd('0x3b')](_0x95fd('0x3c'))){_0x26ebf5[_0x95fd('0x22')]=qs[_0x95fd('0x22')](_0x44231f['query'][_0x95fd('0x22')]);_0x26ebf5[_0x95fd('0x20')]=qs['offset'](_0x44231f[_0x95fd('0x34')]['offset']);}_0x26ebf5['order']=qs['sort'](_0x44231f[_0x95fd('0x34')]['sort']);_0x26ebf5[_0x95fd('0x3d')]=qs[_0x95fd('0x36')](_[_0x95fd('0x3e')](_0x44231f[_0x95fd('0x34')],_0x2018b5[_0x95fd('0x36')]),_0x139677);if(_0x44231f['query']['filter']){_0x26ebf5[_0x95fd('0x3d')]=_[_0x95fd('0x3f')](_0x26ebf5[_0x95fd('0x3d')],{'$or':_[_0x95fd('0x2f')](_0x139677,function(_0x43b31d){if(_0x43b31d['type']!=='VIRTUAL'){var _0x14b213={};_0x14b213[_0x43b31d['name']]={'$like':'%'+_0x44231f[_0x95fd('0x34')][_0x95fd('0x40')]+'%'};return _0x14b213;}})});}_0x26ebf5=_[_0x95fd('0x3f')]({},_0x26ebf5,_0x44231f[_0x95fd('0x41')]);var _0x2a8da6={'where':_0x26ebf5[_0x95fd('0x3d')]};return db[_0x95fd('0x30')][_0x95fd('0x23')](_0x2a8da6)[_0x95fd('0x2a')](function(_0x23ee35){_0x2df8c2[_0x95fd('0x23')]=_0x23ee35;if(_0x44231f[_0x95fd('0x34')]['includeAll']){_0x26ebf5[_0x95fd('0x42')]=[{'all':!![]}];}return db[_0x95fd('0x30')][_0x95fd('0x43')](_0x26ebf5);})[_0x95fd('0x2a')](function(_0x51dc58){_0x2df8c2[_0x95fd('0x44')]=_0x51dc58;return _0x2df8c2;})['then'](respondWithFilteredResult(_0x4ca342,_0x26ebf5))[_0x95fd('0x45')](handleError(_0x4ca342,null));};exports[_0x95fd('0x46')]=function(_0x4af01c,_0x3866e4){var _0x448313={'raw':![],'where':{'id':_0x4af01c[_0x95fd('0x47')]['id']}},_0x357eaf={};_0x357eaf[_0x95fd('0x33')]=_[_0x95fd('0x35')](db[_0x95fd('0x30')][_0x95fd('0x31')]);_0x357eaf['query']=_['keys'](_0x4af01c[_0x95fd('0x34')]);_0x357eaf[_0x95fd('0x36')]=_[_0x95fd('0x37')](_0x357eaf[_0x95fd('0x33')],_0x357eaf[_0x95fd('0x34')]);_0x448313['attributes']=_[_0x95fd('0x37')](_0x357eaf[_0x95fd('0x33')],qs[_0x95fd('0x39')](_0x4af01c['query'][_0x95fd('0x39')]));_0x448313[_0x95fd('0x38')]=_0x448313[_0x95fd('0x38')]['length']?_0x448313[_0x95fd('0x38')]:_0x357eaf[_0x95fd('0x33')];if(_0x4af01c[_0x95fd('0x34')][_0x95fd('0x48')]){_0x448313[_0x95fd('0x42')]=[{'all':!![]}];}_0x448313=_['merge']({},_0x448313,_0x4af01c['options']);return db['VoiceQueueReport'][_0x95fd('0x49')](_0x448313)[_0x95fd('0x2a')](handleEntityNotFound(_0x3866e4,null))[_0x95fd('0x2a')](respondWithResult(_0x3866e4,null))[_0x95fd('0x45')](handleError(_0x3866e4,null));};exports[_0x95fd('0x4a')]=function(_0x12bd5a,_0x33c72b){return db[_0x95fd('0x30')]['create'](_0x12bd5a[_0x95fd('0x4b')],{})[_0x95fd('0x2a')](respondWithResult(_0x33c72b,0xc9))[_0x95fd('0x45')](handleError(_0x33c72b,null));};exports[_0x95fd('0x29')]=function(_0x4f248b,_0x7eed33){if(_0x4f248b['body']['id']){delete _0x4f248b[_0x95fd('0x4b')]['id'];}return db[_0x95fd('0x30')][_0x95fd('0x49')]({'where':{'id':_0x4f248b[_0x95fd('0x47')]['id']}})[_0x95fd('0x2a')](handleEntityNotFound(_0x7eed33,null))[_0x95fd('0x2a')](saveUpdates(_0x4f248b[_0x95fd('0x4b')],null))['then'](respondWithResult(_0x7eed33,null))[_0x95fd('0x45')](handleError(_0x7eed33,null));};exports['destroy']=function(_0x5362c2,_0xac164b){return db[_0x95fd('0x30')][_0x95fd('0x49')]({'where':{'id':_0x5362c2['params']['id']}})[_0x95fd('0x2a')](handleEntityNotFound(_0xac164b,null))[_0x95fd('0x2a')](removeEntity(_0xac164b,null))[_0x95fd('0x45')](handleError(_0xac164b,null));};exports[_0x95fd('0x4c')]=function(_0x2b73a5,_0x120b91){return db[_0x95fd('0x30')][_0x95fd('0x4c')]()['then'](respondWithResult(_0x120b91,null))['catch'](handleError(_0x120b91,null));};exports['getVoiceQueuesReport']=function(_0x198349,_0x5bea0c){var _0x4c11aa={},_0x2bfff3={},_0x487d3d={'count':0x0,'rows':[]};_0x2bfff3[_0x95fd('0x33')]=_['keys'](db['VoiceQueueReport'][_0x95fd('0x31')]);_0x2bfff3[_0x95fd('0x34')]=_[_0x95fd('0x35')](_0x198349[_0x95fd('0x34')]);_0x2bfff3[_0x95fd('0x36')]=_[_0x95fd('0x37')](_0x2bfff3[_0x95fd('0x33')],_0x2bfff3['query']);_0x4c11aa[_0x95fd('0x38')]=_[_0x95fd('0x37')](_0x2bfff3[_0x95fd('0x33')],qs[_0x95fd('0x39')](_0x198349[_0x95fd('0x34')][_0x95fd('0x39')]));_0x4c11aa[_0x95fd('0x38')]=_0x4c11aa[_0x95fd('0x38')]['length']?_0x4c11aa[_0x95fd('0x38')]:_0x2bfff3['model'];if(!_0x198349[_0x95fd('0x34')][_0x95fd('0x3b')](_0x95fd('0x3c'))){_0x4c11aa[_0x95fd('0x22')]=qs[_0x95fd('0x22')](_0x198349[_0x95fd('0x34')]['limit']);_0x4c11aa['offset']=qs[_0x95fd('0x20')](_0x198349[_0x95fd('0x34')][_0x95fd('0x20')]);}_0x4c11aa[_0x95fd('0x4d')]=qs[_0x95fd('0x4e')](_0x198349[_0x95fd('0x34')][_0x95fd('0x4e')]);_0x4c11aa[_0x95fd('0x3d')]=qs[_0x95fd('0x36')](_[_0x95fd('0x3e')](_0x198349[_0x95fd('0x34')],_0x2bfff3[_0x95fd('0x36')]));if(_0x198349[_0x95fd('0x34')][_0x95fd('0x40')]){_0x4c11aa[_0x95fd('0x3d')]=_[_0x95fd('0x3f')](_0x4c11aa[_0x95fd('0x3d')],{'$or':_[_0x95fd('0x2f')](_0x4c11aa[_0x95fd('0x38')],function(_0x511080){var _0x2c6f7a={};_0x2c6f7a[_0x511080]={'$like':'%'+_0x198349[_0x95fd('0x34')][_0x95fd('0x40')]+'%'};return _0x2c6f7a;})});}_0x4c11aa=_[_0x95fd('0x3f')]({},_0x4c11aa,_0x198349[_0x95fd('0x41')]);var _0x242842={'where':_0x4c11aa[_0x95fd('0x3d')]};return db[_0x95fd('0x30')][_0x95fd('0x23')](_0x242842)[_0x95fd('0x2a')](function(_0x1581bb){_0x487d3d[_0x95fd('0x23')]=_0x1581bb;if(_0x198349[_0x95fd('0x34')][_0x95fd('0x48')]){_0x4c11aa[_0x95fd('0x42')]=[{'all':!![]}];}return db[_0x95fd('0x30')][_0x95fd('0x43')](_0x4c11aa);})['then'](function(_0xc2e844){_0x487d3d['rows']=_0xc2e844;return _0x487d3d;})[_0x95fd('0x2a')](respondWithFilteredResult(_0x5bea0c,_0x4c11aa,_0x95fd('0x4f')))[_0x95fd('0x45')](handleError(_0x5bea0c,null,_0x95fd('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index a37644e..2b90271 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 _0xa0fb=['../../mysqldb','VoiceQueueReport','save','update','remove','hook','exports','events'];(function(_0x94ac96,_0x22880d){var _0x3c37d8=function(_0x5101b0){while(--_0x5101b0){_0x94ac96['push'](_0x94ac96['shift']());}};_0x3c37d8(++_0x22880d);}(_0xa0fb,0x1e7));var _0xba0f=function(_0x4f86e4,_0x1fc805){_0x4f86e4=_0x4f86e4-0x0;var _0x48957d=_0xa0fb[_0x4f86e4];return _0x48957d;};'use strict';var EventEmitter=require(_0xba0f('0x0'));var VoiceQueueReport=require(_0xba0f('0x1'))['db'][_0xba0f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xba0f('0x3'),'afterUpdate':_0xba0f('0x4'),'afterDestroy':_0xba0f('0x5')};function emitEvent(_0x13e27a){return function(_0x3630c2,_0x15769c,_0x3b43d2){VoiceQueueReportEvents['emit'](_0x13e27a+':'+_0x3630c2['id'],_0x3630c2);VoiceQueueReportEvents['emit'](_0x13e27a,_0x3630c2);_0x3b43d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xba0f('0x6')](e,emitEvent(event));}}module[_0xba0f('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x46ad=['hook','events','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x41e6ef,_0x56d8e1){var _0x1f2511=function(_0x225b96){while(--_0x225b96){_0x41e6ef['push'](_0x41e6ef['shift']());}};_0x1f2511(++_0x56d8e1);}(_0x46ad,0x1a9));var _0xd46a=function(_0x4507bc,_0x46e50c){_0x4507bc=_0x4507bc-0x0;var _0x81c12d=_0x46ad[_0x4507bc];return _0x81c12d;};'use strict';var EventEmitter=require(_0xd46a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xd46a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd46a('0x2')](0x0);var events={'afterCreate':_0xd46a('0x3'),'afterUpdate':_0xd46a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51c608){return function(_0x4c09cd,_0x44c612,_0x378c7b){VoiceQueueReportEvents[_0xd46a('0x5')](_0x51c608+':'+_0x4c09cd['id'],_0x4c09cd);VoiceQueueReportEvents[_0xd46a('0x5')](_0x51c608,_0x4c09cd);_0x378c7b(null);};}for(var e in events){if(events[_0xd46a('0x6')](e)){var event=events[e];VoiceQueueReport[_0xd46a('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 17cd31a..981db28 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 _0x59a6=['../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x418f0b,_0xe47fcf){var _0x4c0491=function(_0xf1922e){while(--_0xf1922e){_0x418f0b['push'](_0x418f0b['shift']());}};_0x4c0491(++_0xe47fcf);}(_0x59a6,0x1ee));var _0x659a=function(_0x10c05b,_0x165dfc){_0x10c05b=_0x10c05b-0x0;var _0x51de37=_0x59a6[_0x10c05b];return _0x51de37;};'use strict';var _=require(_0x659a('0x0'));var util=require('util');var logger=require(_0x659a('0x1'))(_0x659a('0x2'));var moment=require(_0x659a('0x3'));var BPromise=require(_0x659a('0x4'));var rp=require(_0x659a('0x5'));var fs=require('fs');var path=require(_0x659a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x659a('0x7'));module[_0x659a('0x8')]=function(_0x2b89e2,_0xdfa381){return _0x2b89e2[_0x659a('0x9')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x659a('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x651c=['bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','util','api','moment'];(function(_0xe18234,_0x2d2dad){var _0x3c9078=function(_0x2c16a3){while(--_0x2c16a3){_0xe18234['push'](_0xe18234['shift']());}};_0x3c9078(++_0x2d2dad);}(_0x651c,0x11e));var _0xc651=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x651c[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require(_0xc651('0x0'));var util=require(_0xc651('0x1'));var logger=require('../../config/logger')(_0xc651('0x2'));var moment=require(_0xc651('0x3'));var BPromise=require(_0xc651('0x4'));var rp=require(_0xc651('0x5'));var fs=require('fs');var path=require(_0xc651('0x6'));var rimraf=require(_0xc651('0x7'));var config=require(_0xc651('0x8'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x31cc19,_0x1a0a60){return _0x31cc19[_0xc651('0x9')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index b51d4c1..0174c3c 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 _0x8102=['attributes','limit','include','map','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','raw','UpdateVoiceQueueReport','update','body','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','findAll','options','where'];(function(_0x10ec59,_0x2ca8bb){var _0x235394=function(_0xa2a97e){while(--_0xa2a97e){_0x10ec59['push'](_0x10ec59['shift']());}};_0x235394(++_0x2ca8bb);}(_0x8102,0x8f));var _0x2810=function(_0x49fff7,_0x82f4e1){_0x49fff7=_0x49fff7-0x0;var _0x2d73dd=_0x8102[_0x49fff7];return _0x2d73dd;};'use strict';var _=require(_0x2810('0x0'));var util=require('util');var moment=require(_0x2810('0x1'));var BPromise=require(_0x2810('0x2'));var rs=require(_0x2810('0x3'));var fs=require('fs');var Redis=require(_0x2810('0x4'));var db=require(_0x2810('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2810('0x6'))(_0x2810('0x7'));var config=require(_0x2810('0x8'));var jayson=require(_0x2810('0x9'));var client=jayson[_0x2810('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2810('0xb')],{'host':_0x2810('0xc'),'port':0x18eb});var socket=require(_0x2810('0xd'))(new Redis(config['redis']));require(_0x2810('0xe'))[_0x2810('0xf')](socket);function respondWithRpcPromise(_0x46be77,_0x4f83e6,_0x3b79e0){return new BPromise(function(_0x4f2289,_0x4447d9){return client[_0x2810('0x10')](_0x46be77,_0x3b79e0)[_0x2810('0x11')](function(_0x57dfb3){logger[_0x2810('0x12')](_0x2810('0x13'),_0x4f83e6,_0x2810('0x14'));logger[_0x2810('0x15')](_0x2810('0x16'),_0x4f83e6,_0x2810('0x14'),JSON['stringify'](_0x57dfb3));if(_0x57dfb3['error']){if(_0x57dfb3[_0x2810('0x17')]['code']===0x1f4){logger[_0x2810('0x17')](_0x2810('0x13'),_0x4f83e6,_0x57dfb3[_0x2810('0x17')][_0x2810('0x18')]);return _0x4447d9(_0x57dfb3[_0x2810('0x17')]['message']);}logger[_0x2810('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x4f83e6,_0x57dfb3[_0x2810('0x17')][_0x2810('0x18')]);return _0x4f2289(_0x57dfb3[_0x2810('0x17')][_0x2810('0x18')]);}else{logger[_0x2810('0x12')](_0x2810('0x13'),_0x4f83e6,_0x2810('0x14'));_0x4f2289(_0x57dfb3['result']['message']);}})[_0x2810('0x19')](function(_0x3cffb6){logger[_0x2810('0x17')](_0x2810('0x13'),_0x4f83e6,_0x3cffb6);_0x4447d9(_0x3cffb6);});});}exports['GetVoiceQueueReport']=function(_0x117384){var _0xd44dae=this;return new Promise(function(_0xa6f0ba,_0x180f3d){return db['VoiceQueueReport'][_0x2810('0x1a')]({'raw':_0x117384['options']?_0x117384['options']['raw']===undefined?!![]:![]:!![],'where':_0x117384[_0x2810('0x1b')]?_0x117384['options'][_0x2810('0x1c')]||null:null,'attributes':_0x117384['options']?_0x117384[_0x2810('0x1b')][_0x2810('0x1d')]||null:null,'limit':_0x117384[_0x2810('0x1b')]?_0x117384[_0x2810('0x1b')][_0x2810('0x1e')]||null:null,'include':_0x117384['options']?_0x117384['options'][_0x2810('0x1f')]?_[_0x2810('0x20')](_0x117384['options'][_0x2810('0x1f')],function(_0x30d903){return{'model':db[_0x30d903[_0x2810('0x21')]],'as':_0x30d903['as'],'attributes':_0x30d903['attributes'],'include':_0x30d903['include']?_[_0x2810('0x20')](_0x30d903[_0x2810('0x1f')],function(_0x3f8e3c){return{'model':db[_0x3f8e3c[_0x2810('0x21')]],'as':_0x3f8e3c['as'],'attributes':_0x3f8e3c[_0x2810('0x1d')],'include':_0x3f8e3c[_0x2810('0x1f')]?_[_0x2810('0x20')](_0x3f8e3c['include'],function(_0x1db7d3){return{'model':db[_0x1db7d3[_0x2810('0x21')]],'as':_0x1db7d3['as'],'attributes':_0x1db7d3[_0x2810('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b317){logger[_0x2810('0x12')](_0x2810('0x22'),_0x117384);logger['debug'](_0x2810('0x22'),_0x117384,JSON[_0x2810('0x23')](_0x36b317));_0xa6f0ba(_0x36b317);})['catch'](function(_0x38c094){logger[_0x2810('0x17')](_0x2810('0x22'),_0x38c094[_0x2810('0x18')],_0x117384);_0x180f3d(_0xd44dae[_0x2810('0x17')](0x1f4,_0x38c094[_0x2810('0x18')]));});});};exports[_0x2810('0x24')]=function(_0x17a666){var _0x4b09da=this;return new Promise(function(_0x48789b,_0x1d73db){return db[_0x2810('0x25')][_0x2810('0x26')](_0x17a666['body'],{'raw':_0x17a666['options']?_0x17a666[_0x2810('0x1b')][_0x2810('0x27')]===undefined?!![]:![]:!![]})[_0x2810('0x11')](function(_0x2ac15f){logger[_0x2810('0x12')](_0x2810('0x24'),_0x17a666);logger['debug'](_0x2810('0x24'),_0x17a666,JSON[_0x2810('0x23')](_0x2ac15f));_0x48789b(_0x2ac15f);})[_0x2810('0x19')](function(_0x1c99bb){logger['error']('CreateVoiceQueueReport',_0x1c99bb[_0x2810('0x18')],_0x17a666);_0x1d73db(_0x4b09da[_0x2810('0x17')](0x1f4,_0x1c99bb[_0x2810('0x18')]));});});};exports[_0x2810('0x28')]=function(_0x3e6232){var _0x4f9b94=this;return new Promise(function(_0x450546,_0x4c0376){return db[_0x2810('0x25')][_0x2810('0x29')](_0x3e6232[_0x2810('0x2a')],{'raw':_0x3e6232[_0x2810('0x1b')]?_0x3e6232['options'][_0x2810('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6232[_0x2810('0x1b')]?_0x3e6232[_0x2810('0x1b')][_0x2810('0x1c')]||null:null,'attributes':_0x3e6232[_0x2810('0x1b')]?_0x3e6232['options'][_0x2810('0x1d')]||null:null,'limit':_0x3e6232[_0x2810('0x1b')]?_0x3e6232[_0x2810('0x1b')][_0x2810('0x1e')]||null:null})[_0x2810('0x11')](function(_0x2a63b7){logger[_0x2810('0x12')]('UpdateVoiceQueueReport',_0x3e6232);logger[_0x2810('0x15')](_0x2810('0x28'),_0x3e6232,JSON[_0x2810('0x23')](_0x2a63b7));_0x450546(_0x2a63b7);})[_0x2810('0x19')](function(_0x59bb20){logger[_0x2810('0x17')]('UpdateVoiceQueueReport',_0x59bb20[_0x2810('0x18')],_0x3e6232);_0x4c0376(_0x4f9b94[_0x2810('0x17')](0x1f4,_0x59bb20[_0x2810('0x18')]));});});}; \ No newline at end of file +var _0xf990=['result','catch','GetVoiceQueueReport','findAll','options','where','attributes','limit','include','model','map','debug','stringify','CreateVoiceQueueReport','VoiceQueueReport','body','raw','update','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x2f3d2b,_0x450c70){var _0x30e056=function(_0x156dc9){while(--_0x156dc9){_0x2f3d2b['push'](_0x2f3d2b['shift']());}};_0x30e056(++_0x450c70);}(_0xf990,0xbf));var _0x0f99=function(_0x2f4db3,_0x6b109d){_0x2f4db3=_0x2f4db3-0x0;var _0x39ce3e=_0xf990[_0x2f4db3];return _0x39ce3e;};'use strict';var _=require(_0x0f99('0x0'));var util=require(_0x0f99('0x1'));var moment=require('moment');var BPromise=require(_0x0f99('0x2'));var rs=require(_0x0f99('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f99('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f99('0x5'))(_0x0f99('0x6'));var config=require(_0x0f99('0x7'));var jayson=require(_0x0f99('0x8'));var client=jayson['client'][_0x0f99('0x9')]({'port':0x232a});config[_0x0f99('0xa')]=_['defaults'](config['redis'],{'host':_0x0f99('0xb'),'port':0x18eb});var socket=require(_0x0f99('0xc'))(new Redis(config[_0x0f99('0xa')]));require(_0x0f99('0xd'))[_0x0f99('0xe')](socket);function respondWithRpcPromise(_0x457a1a,_0x2af229,_0x1f6549){return new BPromise(function(_0xb96569,_0x3762c2){return client[_0x0f99('0xf')](_0x457a1a,_0x1f6549)[_0x0f99('0x10')](function(_0x5a0abb){logger[_0x0f99('0x11')](_0x0f99('0x12'),_0x2af229,'request\x20sent');logger['debug'](_0x0f99('0x13'),_0x2af229,'request\x20sent',JSON['stringify'](_0x5a0abb));if(_0x5a0abb[_0x0f99('0x14')]){if(_0x5a0abb[_0x0f99('0x14')][_0x0f99('0x15')]===0x1f4){logger[_0x0f99('0x14')](_0x0f99('0x12'),_0x2af229,_0x5a0abb['error'][_0x0f99('0x16')]);return _0x3762c2(_0x5a0abb['error'][_0x0f99('0x16')]);}logger[_0x0f99('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2af229,_0x5a0abb[_0x0f99('0x14')][_0x0f99('0x16')]);return _0xb96569(_0x5a0abb[_0x0f99('0x14')]['message']);}else{logger[_0x0f99('0x11')](_0x0f99('0x12'),_0x2af229,_0x0f99('0x17'));_0xb96569(_0x5a0abb[_0x0f99('0x18')][_0x0f99('0x16')]);}})[_0x0f99('0x19')](function(_0x330d8f){logger[_0x0f99('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2af229,_0x330d8f);_0x3762c2(_0x330d8f);});});}exports[_0x0f99('0x1a')]=function(_0x4aaa6f){var _0x5c8fbc=this;return new Promise(function(_0x5ef77e,_0x139602){return db['VoiceQueueReport'][_0x0f99('0x1b')]({'raw':_0x4aaa6f[_0x0f99('0x1c')]?_0x4aaa6f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4aaa6f[_0x0f99('0x1c')]?_0x4aaa6f['options'][_0x0f99('0x1d')]||null:null,'attributes':_0x4aaa6f[_0x0f99('0x1c')]?_0x4aaa6f[_0x0f99('0x1c')][_0x0f99('0x1e')]||null:null,'limit':_0x4aaa6f[_0x0f99('0x1c')]?_0x4aaa6f['options'][_0x0f99('0x1f')]||null:null,'include':_0x4aaa6f[_0x0f99('0x1c')]?_0x4aaa6f['options']['include']?_['map'](_0x4aaa6f[_0x0f99('0x1c')][_0x0f99('0x20')],function(_0x213422){return{'model':db[_0x213422[_0x0f99('0x21')]],'as':_0x213422['as'],'attributes':_0x213422[_0x0f99('0x1e')],'include':_0x213422[_0x0f99('0x20')]?_[_0x0f99('0x22')](_0x213422['include'],function(_0x15c4bb){return{'model':db[_0x15c4bb['model']],'as':_0x15c4bb['as'],'attributes':_0x15c4bb[_0x0f99('0x1e')],'include':_0x15c4bb['include']?_[_0x0f99('0x22')](_0x15c4bb[_0x0f99('0x20')],function(_0x2d5bff){return{'model':db[_0x2d5bff[_0x0f99('0x21')]],'as':_0x2d5bff['as'],'attributes':_0x2d5bff[_0x0f99('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0f99('0x10')](function(_0x559c95){logger[_0x0f99('0x11')](_0x0f99('0x1a'),_0x4aaa6f);logger[_0x0f99('0x23')](_0x0f99('0x1a'),_0x4aaa6f,JSON[_0x0f99('0x24')](_0x559c95));_0x5ef77e(_0x559c95);})[_0x0f99('0x19')](function(_0x3839f7){logger[_0x0f99('0x14')](_0x0f99('0x1a'),_0x3839f7[_0x0f99('0x16')],_0x4aaa6f);_0x139602(_0x5c8fbc[_0x0f99('0x14')](0x1f4,_0x3839f7[_0x0f99('0x16')]));});});};exports[_0x0f99('0x25')]=function(_0x2395e9){var _0x53ec4e=this;return new Promise(function(_0x55d187,_0x4b5a23){return db[_0x0f99('0x26')]['create'](_0x2395e9[_0x0f99('0x27')],{'raw':_0x2395e9[_0x0f99('0x1c')]?_0x2395e9[_0x0f99('0x1c')][_0x0f99('0x28')]===undefined?!![]:![]:!![]})['then'](function(_0x5a43e0){logger[_0x0f99('0x11')](_0x0f99('0x25'),_0x2395e9);logger[_0x0f99('0x23')](_0x0f99('0x25'),_0x2395e9,JSON[_0x0f99('0x24')](_0x5a43e0));_0x55d187(_0x5a43e0);})[_0x0f99('0x19')](function(_0x1f85cc){logger[_0x0f99('0x14')](_0x0f99('0x25'),_0x1f85cc['message'],_0x2395e9);_0x4b5a23(_0x53ec4e[_0x0f99('0x14')](0x1f4,_0x1f85cc[_0x0f99('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x2249e7){var _0x5b8dfb=this;return new Promise(function(_0x2014a1,_0x5c9553){return db[_0x0f99('0x26')][_0x0f99('0x29')](_0x2249e7['body'],{'raw':_0x2249e7[_0x0f99('0x1c')]?_0x2249e7[_0x0f99('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2249e7['options']?_0x2249e7['options']['where']||null:null,'attributes':_0x2249e7['options']?_0x2249e7['options']['attributes']||null:null,'limit':_0x2249e7['options']?_0x2249e7[_0x0f99('0x1c')][_0x0f99('0x1f')]||null:null})['then'](function(_0x422ef9){logger['info'](_0x0f99('0x2a'),_0x2249e7);logger[_0x0f99('0x23')](_0x0f99('0x2a'),_0x2249e7,JSON[_0x0f99('0x24')](_0x422ef9));_0x2014a1(_0x422ef9);})[_0x0f99('0x19')](function(_0x71bc47){logger['error'](_0x0f99('0x2a'),_0x71bc47[_0x0f99('0x16')],_0x2249e7);_0x5c9553(_0x5b8dfb[_0x0f99('0x14')](0x1f4,_0x71bc47['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9d906bc..f232e58 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 _0xb1d3=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','emit'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x45bea0,_0x4ad009){_0x45bea0=_0x45bea0-0x0;var _0x3c529b=_0xb1d3[_0x45bea0];return _0x3c529b;};'use strict';var VoiceQueueReportEvents=require(_0x3b1d('0x0'));var events=['save','remove','update'];function createListener(_0x1ca377,_0x49262a){return function(_0x8705ca){_0x49262a[_0x3b1d('0x1')](_0x1ca377,_0x8705ca);};}function removeListener(_0x5b94ab,_0x18e301){return function(){VoiceQueueReportEvents[_0x3b1d('0x2')](_0x5b94ab,_0x18e301);};}exports[_0x3b1d('0x3')]=function(_0x477115){for(var _0x524e93=0x0,_0x5cbdab=events[_0x3b1d('0x4')];_0x524e93<_0x5cbdab;_0x524e93++){var _0x233d62=events[_0x524e93];var _0x36457=createListener(_0x3b1d('0x5')+_0x233d62,_0x477115);VoiceQueueReportEvents['on'](_0x233d62,_0x36457);}}; \ No newline at end of file +var _0x2cbe=['register','voiceQueueReport:','save','remove','update','removeListener'];(function(_0x1f8d07,_0x1a2a18){var _0x272750=function(_0x5a82d4){while(--_0x5a82d4){_0x1f8d07['push'](_0x1f8d07['shift']());}};_0x272750(++_0x1a2a18);}(_0x2cbe,0x110));var _0xe2cb=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x2cbe[_0x5e709a];return _0x57401a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xe2cb('0x0'),_0xe2cb('0x1'),_0xe2cb('0x2')];function createListener(_0x447144,_0x59b5cb){return function(_0x487b5e){_0x59b5cb['emit'](_0x447144,_0x487b5e);};}function removeListener(_0x23f36c,_0x2826bf){return function(){VoiceQueueReportEvents[_0xe2cb('0x3')](_0x23f36c,_0x2826bf);};}exports[_0xe2cb('0x4')]=function(_0x468d75){for(var _0x4abcca=0x0,_0x3307fb=events['length'];_0x4abcca<_0x3307fb;_0x4abcca++){var _0x488165=events[_0x4abcca];var _0x3399a3=createListener(_0xe2cb('0x5')+_0x488165,_0x468d75);VoiceQueueReportEvents['on'](_0x488165,_0x3399a3);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 18a1d8f..68497bd 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 _0x4351=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x9e1f8,_0x9d7d57){var _0x3731b6=function(_0x4a24f4){while(--_0x4a24f4){_0x9e1f8['push'](_0x9e1f8['shift']());}};_0x3731b6(++_0x9d7d57);}(_0x4351,0xb2));var _0x1435=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4351[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1435('0x0'));var util=require('util');var path=require(_0x1435('0x1'));var timeout=require(_0x1435('0x2'));var express=require(_0x1435('0x3'));var router=express[_0x1435('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1435('0x5'));var interaction=require(_0x1435('0x6'));var config=require(_0x1435('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x1435('0x8')]('/',auth['isAuthenticated'](),controller[_0x1435('0x9')]);router[_0x1435('0x8')](_0x1435('0xa'),auth[_0x1435('0xb')](),controller[_0x1435('0xc')]);router[_0x1435('0xd')]('/',auth[_0x1435('0xb')](),controller[_0x1435('0xe')]);router[_0x1435('0xf')](_0x1435('0xa'),auth[_0x1435('0xb')](),controller[_0x1435('0x10')]);router[_0x1435('0x11')](_0x1435('0xa'),auth[_0x1435('0xb')](),controller[_0x1435('0x12')]);module[_0x1435('0x13')]=router; \ No newline at end of file +var _0xd1e4=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x3f16e8,_0x41d3f8){var _0x306b8e=function(_0x58af0c){while(--_0x58af0c){_0x3f16e8['push'](_0x3f16e8['shift']());}};_0x306b8e(++_0x41d3f8);}(_0xd1e4,0xc5));var _0x4d1e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd1e4[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x4d1e('0x0'));var util=require('util');var path=require(_0x4d1e('0x1'));var timeout=require(_0x4d1e('0x2'));var express=require(_0x4d1e('0x3'));var router=express[_0x4d1e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d1e('0x5'));var config=require(_0x4d1e('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x4d1e('0x7')]('/',auth[_0x4d1e('0x8')](),controller[_0x4d1e('0x9')]);router[_0x4d1e('0x7')](_0x4d1e('0xa'),auth[_0x4d1e('0x8')](),controller[_0x4d1e('0xb')]);router[_0x4d1e('0xc')]('/',auth[_0x4d1e('0x8')](),controller['create']);router[_0x4d1e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4d1e('0xe')]);router[_0x4d1e('0xf')](_0x4d1e('0xa'),auth[_0x4d1e('0x8')](),controller[_0x4d1e('0x10')]);module[_0x4d1e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 42490e4..0f13241 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 _0xec55=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x1129fa,_0x522668){var _0x572fbc=function(_0x4afb19){while(--_0x4afb19){_0x1129fa['push'](_0x1129fa['shift']());}};_0x572fbc(++_0x522668);}(_0xec55,0x96));var _0x5ec5=function(_0x3a3eb3,_0x5dd30d){_0x3a3eb3=_0x3a3eb3-0x0;var _0x2a251e=_0xec55[_0x3a3eb3];return _0x2a251e;};'use strict';var Sequelize=require(_0x5ec5('0x0'));var moment=require(_0x5ec5('0x1'));module[_0x5ec5('0x2')]={'time':{'type':Sequelize[_0x5ec5('0x3')]},'callid':{'type':Sequelize[_0x5ec5('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5ec5('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5ec5('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5ec5('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5ec5('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5ec5('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5ec5('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5ec5('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5ec5('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x5ec5('0x5')](_0x5ec5('0x6'))}}; \ No newline at end of file +var _0x6298=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x34dd3c,_0x12616c){var _0x19beab=function(_0x327c96){while(--_0x327c96){_0x34dd3c['push'](_0x34dd3c['shift']());}};_0x19beab(++_0x12616c);}(_0x6298,0x183));var _0x8629=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6298[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8629('0x0'));var moment=require(_0x8629('0x1'));module[_0x8629('0x2')]={'time':{'type':Sequelize[_0x8629('0x3')]},'callid':{'type':Sequelize[_0x8629('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x8629('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8629('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8629('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8629('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x8629('0x4')](_0x8629('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 939788e..8d89abb 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 _0xaa80=['key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type'];(function(_0x6a7a93,_0x5da48d){var _0x46d2f5=function(_0x1e888b){while(--_0x1e888b){_0x6a7a93['push'](_0x6a7a93['shift']());}};_0x46d2f5(++_0x5da48d);}(_0xaa80,0xad));var _0x0aa8=function(_0x71d35a,_0x4608e0){_0x71d35a=_0x71d35a-0x0;var _0x2fcd4c=_0xaa80[_0x71d35a];return _0x2fcd4c;};'use strict';var emlformat=require(_0x0aa8('0x0'));var rimraf=require(_0x0aa8('0x1'));var zipdir=require(_0x0aa8('0x2'));var jsonpatch=require(_0x0aa8('0x3'));var rp=require(_0x0aa8('0x4'));var moment=require(_0x0aa8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0aa8('0x6'));var util=require('util');var path=require(_0x0aa8('0x7'));var sox=require(_0x0aa8('0x8'));var csv=require(_0x0aa8('0x9'));var ejs=require(_0x0aa8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0aa8('0xb'));var squel=require(_0x0aa8('0xc'));var crypto=require('crypto');var jsforce=require(_0x0aa8('0xd'));var deskjs=require(_0x0aa8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0aa8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0aa8('0x10'));var as=require(_0x0aa8('0x11'));var hardwareService=require(_0x0aa8('0x12'));var logger=require(_0x0aa8('0x13'))(_0x0aa8('0x14'));var utils=require(_0x0aa8('0x15'));var config=require(_0x0aa8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf8bf5f,_0x3995d4){_0x3995d4=_0x3995d4||0xcc;return function(_0x3d6d9c){if(_0x3d6d9c){return _0xf8bf5f[_0x0aa8('0x17')](_0x3995d4);}return _0xf8bf5f[_0x0aa8('0x18')](_0x3995d4)[_0x0aa8('0x19')]();};}function respondWithResult(_0x220816,_0x126d24){_0x126d24=_0x126d24||0xc8;return function(_0x3c99c3){if(_0x3c99c3){return _0x220816[_0x0aa8('0x18')](_0x126d24)[_0x0aa8('0x1a')](_0x3c99c3);}};}function respondWithFilteredResult(_0x7fe688,_0x22d3f3){return function(_0x24eac6){if(_0x24eac6){var _0xb55bc2=typeof _0x22d3f3[_0x0aa8('0x1b')]==='undefined'&&typeof _0x22d3f3[_0x0aa8('0x1c')]===_0x0aa8('0x1d');var _0x2fc596=_0x24eac6[_0x0aa8('0x1e')];var _0x27fe88=_0xb55bc2?0x0:_0x22d3f3[_0x0aa8('0x1b')];var _0x519f21=_0xb55bc2?_0x24eac6[_0x0aa8('0x1e')]:_0x22d3f3[_0x0aa8('0x1b')]+_0x22d3f3[_0x0aa8('0x1c')];var _0x5cc624;if(_0x519f21>=_0x2fc596){_0x519f21=_0x2fc596;_0x5cc624=0xc8;}else{_0x5cc624=0xce;}_0x7fe688[_0x0aa8('0x18')](_0x5cc624);return _0x7fe688[_0x0aa8('0x1f')](_0x0aa8('0x20'),_0x27fe88+'-'+_0x519f21+'/'+_0x2fc596)['json'](_0x24eac6);}return null;};}function patchUpdates(_0x113cb6){return function(_0x2f2db9){try{jsonpatch[_0x0aa8('0x21')](_0x2f2db9,_0x113cb6,!![]);}catch(_0x2394bf){return BPromise[_0x0aa8('0x22')](_0x2394bf);}return _0x2f2db9['save']();};}function saveUpdates(_0x444e5a,_0x301b1f){return function(_0x19ae7d){if(_0x19ae7d){return _0x19ae7d['update'](_0x444e5a)[_0x0aa8('0x23')](function(_0x1bdee4){return _0x1bdee4;});}return null;};}function removeEntity(_0x45b468,_0x48b558){return function(_0x24954d){if(_0x24954d){return _0x24954d['destroy']()['then'](function(){_0x45b468[_0x0aa8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe1250,_0x274d69){return function(_0xa474ec){if(!_0xa474ec){_0xbe1250[_0x0aa8('0x17')](0x194);}return _0xa474ec;};}function handleError(_0x2642c9,_0xb165f1){_0xb165f1=_0xb165f1||0x1f4;return function(_0x285a78){logger['error'](_0x285a78['stack']);if(_0x285a78[_0x0aa8('0x24')]){delete _0x285a78[_0x0aa8('0x24')];}_0x2642c9[_0x0aa8('0x18')](_0xb165f1)[_0x0aa8('0x25')](_0x285a78);};}exports[_0x0aa8('0x26')]=function(_0x204e46,_0x36206b){var _0x52d6e1={},_0x494cec={},_0x52632c={'count':0x0,'rows':[]};var _0x158d44=_['map'](db[_0x0aa8('0x27')][_0x0aa8('0x28')],function(_0x3c4521){return{'name':_0x3c4521[_0x0aa8('0x29')],'type':_0x3c4521[_0x0aa8('0x2a')][_0x0aa8('0x2b')]};});_0x494cec[_0x0aa8('0x2c')]=_[_0x0aa8('0x2d')](_0x158d44,_0x0aa8('0x24'));_0x494cec[_0x0aa8('0x2e')]=_['keys'](_0x204e46[_0x0aa8('0x2e')]);_0x494cec['filters']=_['intersection'](_0x494cec['model'],_0x494cec[_0x0aa8('0x2e')]);_0x52d6e1[_0x0aa8('0x2f')]=_[_0x0aa8('0x30')](_0x494cec[_0x0aa8('0x2c')],qs[_0x0aa8('0x31')](_0x204e46['query'][_0x0aa8('0x31')]));_0x52d6e1[_0x0aa8('0x2f')]=_0x52d6e1['attributes'][_0x0aa8('0x32')]?_0x52d6e1['attributes']:_0x494cec[_0x0aa8('0x2c')];if(!_0x204e46[_0x0aa8('0x2e')][_0x0aa8('0x33')](_0x0aa8('0x34'))){_0x52d6e1['limit']=qs[_0x0aa8('0x1c')](_0x204e46[_0x0aa8('0x2e')]['limit']);_0x52d6e1[_0x0aa8('0x1b')]=qs[_0x0aa8('0x1b')](_0x204e46[_0x0aa8('0x2e')]['offset']);}_0x52d6e1[_0x0aa8('0x35')]=qs[_0x0aa8('0x36')](_0x204e46[_0x0aa8('0x2e')][_0x0aa8('0x36')]);_0x52d6e1['where']=qs[_0x0aa8('0x37')](_['pick'](_0x204e46[_0x0aa8('0x2e')],_0x494cec[_0x0aa8('0x37')]),_0x158d44);if(_0x204e46[_0x0aa8('0x2e')][_0x0aa8('0x38')]){_0x52d6e1[_0x0aa8('0x39')]=_[_0x0aa8('0x3a')](_0x52d6e1[_0x0aa8('0x39')],{'$or':_[_0x0aa8('0x2d')](_0x158d44,function(_0x4a62d1){if(_0x4a62d1[_0x0aa8('0x2a')]!==_0x0aa8('0x3b')){var _0x343bd7={};_0x343bd7[_0x4a62d1[_0x0aa8('0x24')]]={'$like':'%'+_0x204e46[_0x0aa8('0x2e')][_0x0aa8('0x38')]+'%'};return _0x343bd7;}})});}_0x52d6e1=_['merge']({},_0x52d6e1,_0x204e46[_0x0aa8('0x3c')]);var _0x5a7661={'where':_0x52d6e1['where']};return db[_0x0aa8('0x27')][_0x0aa8('0x1e')](_0x5a7661)[_0x0aa8('0x23')](function(_0x4e5a81){_0x52632c[_0x0aa8('0x1e')]=_0x4e5a81;if(_0x204e46[_0x0aa8('0x2e')][_0x0aa8('0x3d')]){_0x52d6e1[_0x0aa8('0x3e')]=[{'all':!![]}];}return db[_0x0aa8('0x27')]['findAll'](_0x52d6e1);})[_0x0aa8('0x23')](function(_0x5a1227){_0x52632c['rows']=_0x5a1227;return _0x52632c;})[_0x0aa8('0x23')](respondWithFilteredResult(_0x36206b,_0x52d6e1))[_0x0aa8('0x3f')](handleError(_0x36206b,null));};exports[_0x0aa8('0x40')]=function(_0x1326f5,_0x31a11c){var _0x51ef7c={'raw':!![],'where':{'id':_0x1326f5[_0x0aa8('0x41')]['id']}},_0x24e36b={};_0x24e36b[_0x0aa8('0x2c')]=_[_0x0aa8('0x42')](db[_0x0aa8('0x27')][_0x0aa8('0x28')]);_0x24e36b['query']=_[_0x0aa8('0x42')](_0x1326f5[_0x0aa8('0x2e')]);_0x24e36b[_0x0aa8('0x37')]=_['intersection'](_0x24e36b['model'],_0x24e36b[_0x0aa8('0x2e')]);_0x51ef7c[_0x0aa8('0x2f')]=_[_0x0aa8('0x30')](_0x24e36b[_0x0aa8('0x2c')],qs['fields'](_0x1326f5[_0x0aa8('0x2e')]['fields']));_0x51ef7c[_0x0aa8('0x2f')]=_0x51ef7c[_0x0aa8('0x2f')][_0x0aa8('0x32')]?_0x51ef7c[_0x0aa8('0x2f')]:_0x24e36b[_0x0aa8('0x2c')];if(_0x1326f5['query'][_0x0aa8('0x3d')]){_0x51ef7c[_0x0aa8('0x3e')]=[{'all':!![]}];}_0x51ef7c=_['merge']({},_0x51ef7c,_0x1326f5[_0x0aa8('0x3c')]);return db['VoiceQueuesLog'][_0x0aa8('0x43')](_0x51ef7c)[_0x0aa8('0x23')](handleEntityNotFound(_0x31a11c,null))[_0x0aa8('0x23')](respondWithResult(_0x31a11c,null))[_0x0aa8('0x3f')](handleError(_0x31a11c,null));};exports[_0x0aa8('0x44')]=function(_0x1c937d,_0x1c0e11){return db[_0x0aa8('0x27')][_0x0aa8('0x44')](_0x1c937d[_0x0aa8('0x45')],{})[_0x0aa8('0x23')](respondWithResult(_0x1c0e11,0xc9))[_0x0aa8('0x3f')](handleError(_0x1c0e11,null));};exports[_0x0aa8('0x46')]=function(_0x1410ed,_0x2ce9b8){if(_0x1410ed[_0x0aa8('0x45')]['id']){delete _0x1410ed['body']['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x1410ed['params']['id']}})['then'](handleEntityNotFound(_0x2ce9b8,null))['then'](saveUpdates(_0x1410ed['body'],null))['then'](respondWithResult(_0x2ce9b8,null))[_0x0aa8('0x3f')](handleError(_0x2ce9b8,null));};exports[_0x0aa8('0x47')]=function(_0x184ea3,_0x56df86){return db[_0x0aa8('0x27')][_0x0aa8('0x43')]({'where':{'id':_0x184ea3[_0x0aa8('0x41')]['id']}})[_0x0aa8('0x23')](handleEntityNotFound(_0x56df86,null))[_0x0aa8('0x23')](removeEntity(_0x56df86,null))[_0x0aa8('0x3f')](handleError(_0x56df86,null));}; \ No newline at end of file +var _0x3b53=['params','length','catch','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x3b53,0x1af));var _0x33b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b53[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33b5('0x0'));var zipdir=require(_0x33b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33b5('0x2'));var moment=require(_0x33b5('0x3'));var BPromise=require(_0x33b5('0x4'));var Mustache=require(_0x33b5('0x5'));var util=require(_0x33b5('0x6'));var path=require('path');var sox=require(_0x33b5('0x7'));var csv=require(_0x33b5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33b5('0x9'));var _=require(_0x33b5('0xa'));var squel=require('squel');var crypto=require(_0x33b5('0xb'));var jsforce=require(_0x33b5('0xc'));var deskjs=require(_0x33b5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x33b5('0xe'));var Papa=require('papaparse');var Redis=require(_0x33b5('0xf'));var authService=require(_0x33b5('0x10'));var qs=require(_0x33b5('0x11'));var as=require(_0x33b5('0x12'));var hardwareService=require(_0x33b5('0x13'));var logger=require(_0x33b5('0x14'))(_0x33b5('0x15'));var utils=require(_0x33b5('0x16'));var config=require(_0x33b5('0x17'));var licenseUtil=require(_0x33b5('0x18'));var db=require(_0x33b5('0x19'))['db'];function respondWithStatusCode(_0x5d1a31,_0x5820fa){_0x5820fa=_0x5820fa||0xcc;return function(_0x3c8ae4){if(_0x3c8ae4){return _0x5d1a31[_0x33b5('0x1a')](_0x5820fa);}return _0x5d1a31[_0x33b5('0x1b')](_0x5820fa)[_0x33b5('0x1c')]();};}function respondWithResult(_0x222b05,_0x5b474c){_0x5b474c=_0x5b474c||0xc8;return function(_0x265ddc){if(_0x265ddc){return _0x222b05[_0x33b5('0x1b')](_0x5b474c)['json'](_0x265ddc);}};}function respondWithFilteredResult(_0x1f4258,_0x20039b){return function(_0x750fbc){if(_0x750fbc){var _0x545cce=typeof _0x20039b[_0x33b5('0x1d')]===_0x33b5('0x1e')&&typeof _0x20039b['limit']==='undefined';var _0x310605=_0x750fbc['count'];var _0x26c404=_0x545cce?0x0:_0x20039b['offset'];var _0x5c308e=_0x545cce?_0x750fbc[_0x33b5('0x1f')]:_0x20039b[_0x33b5('0x1d')]+_0x20039b[_0x33b5('0x20')];var _0x2d2877;if(_0x5c308e>=_0x310605){_0x5c308e=_0x310605;_0x2d2877=0xc8;}else{_0x2d2877=0xce;}_0x1f4258['status'](_0x2d2877);return _0x1f4258['set'](_0x33b5('0x21'),_0x26c404+'-'+_0x5c308e+'/'+_0x310605)['json'](_0x750fbc);}return null;};}function patchUpdates(_0x47e2a3){return function(_0x1ab890){try{jsonpatch[_0x33b5('0x22')](_0x1ab890,_0x47e2a3,!![]);}catch(_0x1314c0){return BPromise[_0x33b5('0x23')](_0x1314c0);}return _0x1ab890[_0x33b5('0x24')]();};}function saveUpdates(_0x2169e3,_0x451257){return function(_0x1a50eb){if(_0x1a50eb){return _0x1a50eb[_0x33b5('0x25')](_0x2169e3)[_0x33b5('0x26')](function(_0x51dc3c){return _0x51dc3c;});}return null;};}function removeEntity(_0x3421e3,_0x49ceca){return function(_0x5358c1){if(_0x5358c1){return _0x5358c1[_0x33b5('0x27')]()[_0x33b5('0x26')](function(){_0x3421e3[_0x33b5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3892c4,_0x338695){return function(_0x4c304e){if(!_0x4c304e){_0x3892c4[_0x33b5('0x1a')](0x194);}return _0x4c304e;};}function handleError(_0x486bb5,_0x1dae04){_0x1dae04=_0x1dae04||0x1f4;return function(_0x3e8dae){logger[_0x33b5('0x28')](_0x3e8dae['stack']);if(_0x3e8dae['name']){delete _0x3e8dae[_0x33b5('0x29')];}_0x486bb5['status'](_0x1dae04)['send'](_0x3e8dae);};}exports[_0x33b5('0x2a')]=function(_0x43040c,_0x24d1a8){var _0x263b27={},_0x4444c7={},_0x5cf623={'count':0x0,'rows':[]};var _0x57f223=_[_0x33b5('0x2b')](db[_0x33b5('0x2c')][_0x33b5('0x2d')],function(_0x3284b7){return{'name':_0x3284b7[_0x33b5('0x2e')],'type':_0x3284b7[_0x33b5('0x2f')][_0x33b5('0x30')]};});_0x4444c7[_0x33b5('0x31')]=_['map'](_0x57f223,_0x33b5('0x29'));_0x4444c7['query']=_[_0x33b5('0x32')](_0x43040c['query']);_0x4444c7[_0x33b5('0x33')]=_[_0x33b5('0x34')](_0x4444c7[_0x33b5('0x31')],_0x4444c7['query']);_0x263b27[_0x33b5('0x35')]=_[_0x33b5('0x34')](_0x4444c7[_0x33b5('0x31')],qs[_0x33b5('0x36')](_0x43040c[_0x33b5('0x37')][_0x33b5('0x36')]));_0x263b27[_0x33b5('0x35')]=_0x263b27[_0x33b5('0x35')]['length']?_0x263b27[_0x33b5('0x35')]:_0x4444c7[_0x33b5('0x31')];if(!_0x43040c[_0x33b5('0x37')][_0x33b5('0x38')](_0x33b5('0x39'))){_0x263b27[_0x33b5('0x20')]=qs['limit'](_0x43040c[_0x33b5('0x37')][_0x33b5('0x20')]);_0x263b27['offset']=qs[_0x33b5('0x1d')](_0x43040c['query'][_0x33b5('0x1d')]);}_0x263b27[_0x33b5('0x3a')]=qs[_0x33b5('0x3b')](_0x43040c[_0x33b5('0x37')]['sort']);_0x263b27['where']=qs[_0x33b5('0x33')](_['pick'](_0x43040c[_0x33b5('0x37')],_0x4444c7[_0x33b5('0x33')]),_0x57f223);if(_0x43040c[_0x33b5('0x37')]['filter']){_0x263b27[_0x33b5('0x3c')]=_[_0x33b5('0x3d')](_0x263b27[_0x33b5('0x3c')],{'$or':_[_0x33b5('0x2b')](_0x57f223,function(_0x52e976){if(_0x52e976['type']!==_0x33b5('0x3e')){var _0x14a24a={};_0x14a24a[_0x52e976[_0x33b5('0x29')]]={'$like':'%'+_0x43040c['query']['filter']+'%'};return _0x14a24a;}})});}_0x263b27=_[_0x33b5('0x3d')]({},_0x263b27,_0x43040c[_0x33b5('0x3f')]);var _0x38780a={'where':_0x263b27[_0x33b5('0x3c')]};return db[_0x33b5('0x2c')][_0x33b5('0x1f')](_0x38780a)[_0x33b5('0x26')](function(_0x52819f){_0x5cf623[_0x33b5('0x1f')]=_0x52819f;if(_0x43040c[_0x33b5('0x37')][_0x33b5('0x40')]){_0x263b27[_0x33b5('0x41')]=[{'all':!![]}];}return db[_0x33b5('0x2c')]['findAll'](_0x263b27);})[_0x33b5('0x26')](function(_0x40831c){_0x5cf623['rows']=_0x40831c;return _0x5cf623;})['then'](respondWithFilteredResult(_0x24d1a8,_0x263b27))['catch'](handleError(_0x24d1a8,null));};exports['show']=function(_0xf81ca6,_0x59d194){var _0x2d69f5={'raw':!![],'where':{'id':_0xf81ca6[_0x33b5('0x42')]['id']}},_0x3cb863={};_0x3cb863[_0x33b5('0x31')]=_[_0x33b5('0x32')](db['VoiceQueuesLog'][_0x33b5('0x2d')]);_0x3cb863['query']=_[_0x33b5('0x32')](_0xf81ca6[_0x33b5('0x37')]);_0x3cb863[_0x33b5('0x33')]=_['intersection'](_0x3cb863['model'],_0x3cb863['query']);_0x2d69f5[_0x33b5('0x35')]=_[_0x33b5('0x34')](_0x3cb863[_0x33b5('0x31')],qs[_0x33b5('0x36')](_0xf81ca6[_0x33b5('0x37')]['fields']));_0x2d69f5[_0x33b5('0x35')]=_0x2d69f5[_0x33b5('0x35')][_0x33b5('0x43')]?_0x2d69f5['attributes']:_0x3cb863['model'];if(_0xf81ca6[_0x33b5('0x37')][_0x33b5('0x40')]){_0x2d69f5[_0x33b5('0x41')]=[{'all':!![]}];}_0x2d69f5=_['merge']({},_0x2d69f5,_0xf81ca6[_0x33b5('0x3f')]);return db[_0x33b5('0x2c')]['find'](_0x2d69f5)[_0x33b5('0x26')](handleEntityNotFound(_0x59d194,null))[_0x33b5('0x26')](respondWithResult(_0x59d194,null))[_0x33b5('0x44')](handleError(_0x59d194,null));};exports['create']=function(_0x3ec3d0,_0x35977b){return db['VoiceQueuesLog']['create'](_0x3ec3d0[_0x33b5('0x45')],{})[_0x33b5('0x26')](respondWithResult(_0x35977b,0xc9))['catch'](handleError(_0x35977b,null));};exports[_0x33b5('0x25')]=function(_0x525287,_0x3392b2){if(_0x525287[_0x33b5('0x45')]['id']){delete _0x525287[_0x33b5('0x45')]['id'];}return db['VoiceQueuesLog'][_0x33b5('0x46')]({'where':{'id':_0x525287[_0x33b5('0x42')]['id']}})[_0x33b5('0x26')](handleEntityNotFound(_0x3392b2,null))[_0x33b5('0x26')](saveUpdates(_0x525287[_0x33b5('0x45')],null))[_0x33b5('0x26')](respondWithResult(_0x3392b2,null))['catch'](handleError(_0x3392b2,null));};exports[_0x33b5('0x27')]=function(_0x10d07c,_0x5058cd){return db[_0x33b5('0x2c')]['find']({'where':{'id':_0x10d07c[_0x33b5('0x42')]['id']}})[_0x33b5('0x26')](handleEntityNotFound(_0x5058cd,null))[_0x33b5('0x26')](removeEntity(_0x5058cd,null))[_0x33b5('0x44')](handleError(_0x5058cd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0228e8e..cfcf2d5 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 _0x8388=['exports','define','VoiceQueuesLog','voice_queues_log','event','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8388,0x18d));var _0x8838=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x8388[_0x27dba4];return _0x35ec9d;};'use strict';var _=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var logger=require(_0x8838('0x2'))(_0x8838('0x3'));var moment=require('moment');var BPromise=require(_0x8838('0x4'));var rp=require(_0x8838('0x5'));var fs=require('fs');var path=require(_0x8838('0x6'));var rimraf=require(_0x8838('0x7'));var config=require(_0x8838('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x8838('0x9')]=function(_0x471568,_0x49cac2){return _0x471568[_0x8838('0xa')](_0x8838('0xb'),attributes,{'tableName':_0x8838('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x8838('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x8d00=['voice_queues_log','event_dtm','event','dtm','util','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','define'];(function(_0x44c00e,_0x384fd8){var _0x5b3574=function(_0x1b4c3c){while(--_0x1b4c3c){_0x44c00e['push'](_0x44c00e['shift']());}};_0x5b3574(++_0x384fd8);}(_0x8d00,0x160));var _0x08d0=function(_0x3115b5,_0x41081a){_0x3115b5=_0x3115b5-0x0;var _0xa85868=_0x8d00[_0x3115b5];return _0xa85868;};'use strict';var _=require('lodash');var util=require(_0x08d0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x08d0('0x1'));var BPromise=require(_0x08d0('0x2'));var rp=require(_0x08d0('0x3'));var fs=require('fs');var path=require(_0x08d0('0x4'));var rimraf=require('rimraf');var config=require(_0x08d0('0x5'));var attributes=require(_0x08d0('0x6'));module['exports']=function(_0x1a63bb,_0x1038ea){return _0x1a63bb[_0x08d0('0x7')]('VoiceQueuesLog',attributes,{'tableName':_0x08d0('0x8'),'paranoid':![],'indexes':[{'name':_0x08d0('0x9'),'fields':[_0x08d0('0xa'),_0x08d0('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 d2655a1..c78f28f 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 _0x9c2f=['../../config/logger','rpc','../../config/environment','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x425036,_0x39bebc){var _0x7fc880=function(_0x54493c){while(--_0x54493c){_0x425036['push'](_0x425036['shift']());}};_0x7fc880(++_0x39bebc);}(_0x9c2f,0x1c8));var _0xf9c2=function(_0x4d817f,_0x414fa2){_0x4d817f=_0x4d817f-0x0;var _0x65cfa0=_0x9c2f[_0x4d817f];return _0x65cfa0;};'use strict';var _=require('lodash');var util=require(_0xf9c2('0x0'));var moment=require(_0xf9c2('0x1'));var BPromise=require(_0xf9c2('0x2'));var rs=require(_0xf9c2('0x3'));var fs=require('fs');var Redis=require(_0xf9c2('0x4'));var db=require(_0xf9c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9c2('0x6'))(_0xf9c2('0x7'));var config=require(_0xf9c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf9c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f9cf9,_0x4a6198,_0xb71b7d){return new BPromise(function(_0x47d3f8,_0x5c69b6){return client['request'](_0x3f9cf9,_0xb71b7d)[_0xf9c2('0xa')](function(_0x1c7bf9){logger[_0xf9c2('0xb')](_0xf9c2('0xc'),_0x4a6198,_0xf9c2('0xd'));logger[_0xf9c2('0xe')](_0xf9c2('0xf'),_0x4a6198,_0xf9c2('0xd'),JSON['stringify'](_0x1c7bf9));if(_0x1c7bf9[_0xf9c2('0x10')]){if(_0x1c7bf9[_0xf9c2('0x10')][_0xf9c2('0x11')]===0x1f4){logger[_0xf9c2('0x10')](_0xf9c2('0xc'),_0x4a6198,_0x1c7bf9['error'][_0xf9c2('0x12')]);return _0x5c69b6(_0x1c7bf9[_0xf9c2('0x10')][_0xf9c2('0x12')]);}logger[_0xf9c2('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a6198,_0x1c7bf9[_0xf9c2('0x10')][_0xf9c2('0x12')]);return _0x47d3f8(_0x1c7bf9[_0xf9c2('0x10')][_0xf9c2('0x12')]);}else{logger[_0xf9c2('0xb')](_0xf9c2('0xc'),_0x4a6198,_0xf9c2('0xd'));_0x47d3f8(_0x1c7bf9[_0xf9c2('0x13')][_0xf9c2('0x12')]);}})[_0xf9c2('0x14')](function(_0x3320bb){logger[_0xf9c2('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a6198,_0x3320bb);_0x5c69b6(_0x3320bb);});});} \ No newline at end of file +var _0x04a8=['http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x108fad,_0x19a592){var _0x274d0d=function(_0x256e66){while(--_0x256e66){_0x108fad['push'](_0x108fad['shift']());}};_0x274d0d(++_0x19a592);}(_0x04a8,0x153));var _0x804a=function(_0x16ef44,_0x514b13){_0x16ef44=_0x16ef44-0x0;var _0xaff1e6=_0x04a8[_0x16ef44];return _0xaff1e6;};'use strict';var _=require(_0x804a('0x0'));var util=require('util');var moment=require(_0x804a('0x1'));var BPromise=require(_0x804a('0x2'));var rs=require(_0x804a('0x3'));var fs=require('fs');var Redis=require(_0x804a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x804a('0x5'));var logger=require(_0x804a('0x6'))(_0x804a('0x7'));var config=require(_0x804a('0x8'));var jayson=require(_0x804a('0x9'));var client=jayson[_0x804a('0xa')][_0x804a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c35b6,_0x2f02c3,_0x5a12c1){return new BPromise(function(_0x3f470f,_0x1bd66a){return client[_0x804a('0xc')](_0x5c35b6,_0x5a12c1)[_0x804a('0xd')](function(_0x745417){logger[_0x804a('0xe')](_0x804a('0xf'),_0x2f02c3,_0x804a('0x10'));logger[_0x804a('0x11')](_0x804a('0x12'),_0x2f02c3,_0x804a('0x10'),JSON[_0x804a('0x13')](_0x745417));if(_0x745417['error']){if(_0x745417[_0x804a('0x14')][_0x804a('0x15')]===0x1f4){logger[_0x804a('0x14')](_0x804a('0xf'),_0x2f02c3,_0x745417[_0x804a('0x14')][_0x804a('0x16')]);return _0x1bd66a(_0x745417[_0x804a('0x14')]['message']);}logger[_0x804a('0x14')](_0x804a('0xf'),_0x2f02c3,_0x745417[_0x804a('0x14')][_0x804a('0x16')]);return _0x3f470f(_0x745417['error'][_0x804a('0x16')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x2f02c3,'request\x20sent');_0x3f470f(_0x745417[_0x804a('0x17')][_0x804a('0x16')]);}})[_0x804a('0x18')](function(_0x4823cc){logger[_0x804a('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2f02c3,_0x4823cc);_0x1bd66a(_0x4823cc);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0529338..e5a5d7a 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 _0xf881=['describe','show','/:id/download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','put','/:id','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x412cf9,_0x1a4932){var _0x9d24e4=function(_0x108070){while(--_0x108070){_0x412cf9['push'](_0x412cf9['shift']());}};_0x9d24e4(++_0x1a4932);}(_0xf881,0x199));var _0x1f88=function(_0x4baa75,_0x4e4bd4){_0x4baa75=_0x4baa75-0x0;var _0x21ae9c=_0xf881[_0x4baa75];return _0x21ae9c;};'use strict';var multer=require('multer');var util=require(_0x1f88('0x0'));var path=require(_0x1f88('0x1'));var timeout=require(_0x1f88('0x2'));var express=require('express');var router=express[_0x1f88('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f88('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f88('0x5'));var controller=require('./voiceRecording.controller');router[_0x1f88('0x6')]('/',auth[_0x1f88('0x7')](),controller['index']);router[_0x1f88('0x6')](_0x1f88('0x8'),auth['isAuthenticated'](),controller[_0x1f88('0x9')]);router[_0x1f88('0x6')]('/:id',auth[_0x1f88('0x7')](),controller[_0x1f88('0xa')]);router[_0x1f88('0x6')](_0x1f88('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x1f88('0x6')](_0x1f88('0xc'),controller[_0x1f88('0xd')]);router[_0x1f88('0x6')]('/:id/transcribe',auth[_0x1f88('0x7')](),controller[_0x1f88('0xe')]);router[_0x1f88('0xf')]('/',auth[_0x1f88('0x7')](),controller[_0x1f88('0x10')]);router['post'](_0x1f88('0x11'),auth[_0x1f88('0x7')](),controller['runTranscribe']);router[_0x1f88('0x12')](_0x1f88('0x13'),auth[_0x1f88('0x7')](),controller['update']);router[_0x1f88('0x14')](_0x1f88('0x13'),auth[_0x1f88('0x7')](),controller[_0x1f88('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe5ac=['post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','create'];(function(_0xb2a070,_0x2f9bfb){var _0x556b46=function(_0x17f1fa){while(--_0x17f1fa){_0xb2a070['push'](_0xb2a070['shift']());}};_0x556b46(++_0x2f9bfb);}(_0xe5ac,0x113));var _0xce5a=function(_0x1d7183,_0x2ae02e){_0x1d7183=_0x1d7183-0x0;var _0x57b91a=_0xe5ac[_0x1d7183];return _0x57b91a;};'use strict';var multer=require(_0xce5a('0x0'));var util=require(_0xce5a('0x1'));var path=require(_0xce5a('0x2'));var timeout=require(_0xce5a('0x3'));var express=require(_0xce5a('0x4'));var router=express[_0xce5a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xce5a('0x6'));var interaction=require(_0xce5a('0x7'));var config=require(_0xce5a('0x8'));var controller=require(_0xce5a('0x9'));router[_0xce5a('0xa')]('/',auth[_0xce5a('0xb')](),controller[_0xce5a('0xc')]);router[_0xce5a('0xa')](_0xce5a('0xd'),auth[_0xce5a('0xb')](),controller[_0xce5a('0xe')]);router[_0xce5a('0xa')](_0xce5a('0xf'),auth[_0xce5a('0xb')](),controller['show']);router[_0xce5a('0xa')](_0xce5a('0x10'),auth[_0xce5a('0xb')](),controller[_0xce5a('0x11')]);router[_0xce5a('0xa')](_0xce5a('0x12'),controller['downloads']);router[_0xce5a('0xa')](_0xce5a('0x13'),auth[_0xce5a('0xb')](),controller[_0xce5a('0x14')]);router['post']('/',auth[_0xce5a('0xb')](),controller[_0xce5a('0x15')]);router[_0xce5a('0x16')](_0xce5a('0x13'),auth[_0xce5a('0xb')](),controller['runTranscribe']);router[_0xce5a('0x17')](_0xce5a('0xf'),auth[_0xce5a('0xb')](),controller[_0xce5a('0x18')]);router[_0xce5a('0x19')](_0xce5a('0xf'),auth['isAuthenticated'](),controller[_0xce5a('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e7d4d88..f28fc74 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(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 1cce5b9..27ef0c2 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 _0x7efa=['downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','fast-json-patch','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','VoiceRecording','rawAttributes','key','model','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','col','token','$and','push','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','ValidationError','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','updateAttributes','writeFile'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x7efa,0x95));var _0xa7ef=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x7efa[_0x4c8a8f];return _0x404500;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7ef('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa7ef('0x1'));var util=require('util');var path=require(_0xa7ef('0x2'));var sox=require(_0xa7ef('0x3'));var csv=require('to-csv');var ejs=require(_0xa7ef('0x4'));var fs=require('fs');var fs_extra=require(_0xa7ef('0x5'));var _=require(_0xa7ef('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa7ef('0x7'));var deskjs=require(_0xa7ef('0x8'));var toCsv=require(_0xa7ef('0x9'));var querystring=require(_0xa7ef('0xa'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xa7ef('0xb'));var Redis=require(_0xa7ef('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa7ef('0xd'));var as=require(_0xa7ef('0xe'));var hardwareService=require(_0xa7ef('0xf'));var logger=require(_0xa7ef('0x10'))(_0xa7ef('0x11'));var utils=require(_0xa7ef('0x12'));var config=require(_0xa7ef('0x13'));var licenseUtil=require(_0xa7ef('0x14'));var db=require(_0xa7ef('0x15'))['db'];function respondWithStatusCode(_0xedff70,_0x43d94f){_0x43d94f=_0x43d94f||0xcc;return function(_0x2a930d){if(_0x2a930d){return _0xedff70[_0xa7ef('0x16')](_0x43d94f);}return _0xedff70['status'](_0x43d94f)[_0xa7ef('0x17')]();};}function respondWithResult(_0x2e05b9,_0x48f890){_0x48f890=_0x48f890||0xc8;return function(_0x21e462){if(_0x21e462){return _0x2e05b9[_0xa7ef('0x18')](_0x48f890)['json'](_0x21e462);}};}function respondWithFilteredResult(_0x6a7504,_0x4122a5){return function(_0x747927){if(_0x747927){var _0x34120d=typeof _0x4122a5[_0xa7ef('0x19')]===_0xa7ef('0x1a')&&typeof _0x4122a5['limit']===_0xa7ef('0x1a');var _0x24a71f=_0x747927[_0xa7ef('0x1b')];var _0x56cff9=_0x34120d?0x0:_0x4122a5[_0xa7ef('0x19')];var _0x3f428c=_0x34120d?_0x747927[_0xa7ef('0x1b')]:_0x4122a5[_0xa7ef('0x19')]+_0x4122a5[_0xa7ef('0x1c')];var _0x3b1220;if(_0x3f428c>=_0x24a71f){_0x3f428c=_0x24a71f;_0x3b1220=0xc8;}else{_0x3b1220=0xce;}_0x6a7504[_0xa7ef('0x18')](_0x3b1220);return _0x6a7504[_0xa7ef('0x1d')](_0xa7ef('0x1e'),_0x56cff9+'-'+_0x3f428c+'/'+_0x24a71f)['json'](_0x747927);}return null;};}function patchUpdates(_0x34c193){return function(_0x3f563c){try{jsonpatch[_0xa7ef('0x1f')](_0x3f563c,_0x34c193,!![]);}catch(_0x3dffde){return BPromise['reject'](_0x3dffde);}return _0x3f563c[_0xa7ef('0x20')]();};}function saveUpdates(_0x2bfde3,_0x9c0e6c){return function(_0x110605){if(_0x110605){return _0x110605[_0xa7ef('0x21')](_0x2bfde3)[_0xa7ef('0x22')](function(_0xfa1068){return _0xfa1068;});}return null;};}function removeEntity(_0x1bb267,_0x53fd28){return function(_0x4b95ea){if(_0x4b95ea){return _0x4b95ea[_0xa7ef('0x23')]()[_0xa7ef('0x22')](function(){_0x1bb267['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d914a,_0x49cac1){return function(_0x5f3bc0){if(!_0x5f3bc0){_0x3d914a[_0xa7ef('0x16')](0x194);}return _0x5f3bc0;};}function handleError(_0x449bfd,_0x1b1594){_0x1b1594=_0x1b1594||0x1f4;return function(_0x8c55d9){logger[_0xa7ef('0x24')](_0x8c55d9[_0xa7ef('0x25')]);if(_0x8c55d9[_0xa7ef('0x26')]){delete _0x8c55d9['name'];}_0x449bfd[_0xa7ef('0x18')](_0x1b1594)['send'](_0x8c55d9);};}exports['index']=function(_0x161dcc,_0x3a7838){var _0x437c13={},_0x547d61={},_0x6b6f07={'count':0x0,'rows':[]};var _0x5cb0b5=_['map'](db[_0xa7ef('0x27')][_0xa7ef('0x28')],function(_0x2835bf){return{'name':_0x2835bf['fieldName'],'type':_0x2835bf['type'][_0xa7ef('0x29')]};});_0x547d61[_0xa7ef('0x2a')]=_['differenceBy'](_[_0xa7ef('0x2b')](_0x5cb0b5,_0xa7ef('0x26')),[_0xa7ef('0x2c')]);_0x547d61[_0xa7ef('0x2d')]=_[_0xa7ef('0x2e')](_0x161dcc[_0xa7ef('0x2d')]);_0x547d61[_0xa7ef('0x2f')]=_[_0xa7ef('0x30')](_0x547d61[_0xa7ef('0x2a')],_0x547d61[_0xa7ef('0x2d')]);_0x437c13[_0xa7ef('0x31')]=_[_0xa7ef('0x30')](_0x547d61['model'],qs[_0xa7ef('0x32')](_0x161dcc[_0xa7ef('0x2d')][_0xa7ef('0x32')]));_0x437c13[_0xa7ef('0x31')]=_0x437c13['attributes'][_0xa7ef('0x33')]?_0x437c13[_0xa7ef('0x31')]:_0x547d61[_0xa7ef('0x2a')];if(!_0x161dcc[_0xa7ef('0x2d')][_0xa7ef('0x34')]('nolimit')){_0x437c13[_0xa7ef('0x1c')]=qs[_0xa7ef('0x1c')](_0x161dcc['query'][_0xa7ef('0x1c')]);_0x437c13[_0xa7ef('0x19')]=qs[_0xa7ef('0x19')](_0x161dcc[_0xa7ef('0x2d')][_0xa7ef('0x19')]);}_0x437c13[_0xa7ef('0x35')]=qs['sort'](_0x161dcc[_0xa7ef('0x2d')][_0xa7ef('0x36')]);_0x437c13[_0xa7ef('0x37')]=qs[_0xa7ef('0x2f')](_[_0xa7ef('0x38')](_0x161dcc[_0xa7ef('0x2d')],_0x547d61[_0xa7ef('0x2f')]),_0x5cb0b5);if(_0x161dcc[_0xa7ef('0x2d')][_0xa7ef('0x39')]){_0x437c13[_0xa7ef('0x37')]=_[_0xa7ef('0x3a')](_0x437c13[_0xa7ef('0x37')],{'$or':_[_0xa7ef('0x2b')](_0x5cb0b5,function(_0x3092c9){if(_0x3092c9[_0xa7ef('0x3b')]!==_0xa7ef('0x3c')){var _0x2eb8ca={};_0x2eb8ca[_0x3092c9['name']]={'$like':'%'+_0x161dcc['query'][_0xa7ef('0x39')]+'%'};return _0x2eb8ca;}})});}_0x437c13=_[_0xa7ef('0x3a')]({},_0x437c13,_0x161dcc['options']);var _0x505fe6={'where':_0x437c13[_0xa7ef('0x37')]};return db[_0xa7ef('0x27')]['count'](_0x505fe6)[_0xa7ef('0x22')](function(_0x26396a){_0x6b6f07['count']=_0x26396a;if(_0x161dcc['query'][_0xa7ef('0x3d')]){_0x437c13[_0xa7ef('0x3e')]=[{'all':!![]}];}return db[_0xa7ef('0x27')][_0xa7ef('0x3f')](_0x437c13);})[_0xa7ef('0x22')](function(_0x408464){_0x6b6f07[_0xa7ef('0x40')]=_0x408464;return _0x6b6f07;})['then'](respondWithFilteredResult(_0x3a7838,_0x437c13))[_0xa7ef('0x41')](handleError(_0x3a7838,null));};exports[_0xa7ef('0x42')]=function(_0x4ddce8,_0x2c5761){var _0xc0c85={'raw':![],'where':{'id':_0x4ddce8[_0xa7ef('0x43')]['id']}},_0x46f26f={};_0x46f26f[_0xa7ef('0x2a')]=_[_0xa7ef('0x2e')](db[_0xa7ef('0x27')][_0xa7ef('0x28')]);_0x46f26f[_0xa7ef('0x2d')]=_[_0xa7ef('0x2e')](_0x4ddce8[_0xa7ef('0x2d')]);_0x46f26f['filters']=_[_0xa7ef('0x30')](_0x46f26f['model'],_0x46f26f['query']);_0xc0c85[_0xa7ef('0x31')]=_[_0xa7ef('0x30')](_0x46f26f['model'],qs[_0xa7ef('0x32')](_0x4ddce8[_0xa7ef('0x2d')]['fields']));_0xc0c85[_0xa7ef('0x31')]=_0xc0c85[_0xa7ef('0x31')][_0xa7ef('0x33')]?_0xc0c85[_0xa7ef('0x31')]:_0x46f26f[_0xa7ef('0x2a')];if(_0x4ddce8['query'][_0xa7ef('0x3d')]){_0xc0c85[_0xa7ef('0x3e')]=[{'all':!![]}];}_0xc0c85=_[_0xa7ef('0x3a')]({},_0xc0c85,_0x4ddce8['options']);return db[_0xa7ef('0x27')][_0xa7ef('0x44')](_0xc0c85)[_0xa7ef('0x22')](handleEntityNotFound(_0x2c5761,null))[_0xa7ef('0x22')](respondWithResult(_0x2c5761,null))[_0xa7ef('0x41')](handleError(_0x2c5761,null));};exports['create']=function(_0x599a1e,_0x354eb2){return db[_0xa7ef('0x27')]['create'](_0x599a1e[_0xa7ef('0x45')],{})[_0xa7ef('0x22')](respondWithResult(_0x354eb2,0xc9))['catch'](handleError(_0x354eb2,null));};exports['update']=function(_0x17ef75,_0x56116c){if(_0x17ef75[_0xa7ef('0x45')]['id']){delete _0x17ef75[_0xa7ef('0x45')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x17ef75[_0xa7ef('0x43')]['id']}})[_0xa7ef('0x22')](handleEntityNotFound(_0x56116c,null))[_0xa7ef('0x22')](saveUpdates(_0x17ef75[_0xa7ef('0x45')],null))[_0xa7ef('0x22')](respondWithResult(_0x56116c,null))[_0xa7ef('0x41')](handleError(_0x56116c,null));};exports[_0xa7ef('0x46')]=function(_0x43eb9f,_0x16fe67){return db[_0xa7ef('0x27')][_0xa7ef('0x46')]()[_0xa7ef('0x22')](respondWithResult(_0x16fe67,null))['catch'](handleError(_0x16fe67,null));};exports[_0xa7ef('0x47')]=function(_0x25fb82,_0x4e996c,_0x2109f4){var _0x348403=require('../../components/encryptor');var _0x2f54ac=![];var _0xca51ad={};if(_0x25fb82['query'][_0xa7ef('0x3b')]&&_0x25fb82[_0xa7ef('0x2d')][_0xa7ef('0x3b')]===_0xa7ef('0x48')){_0xca51ad[_0xa7ef('0x48')]=_0x25fb82['params']['id'];}else{_0xca51ad['id']=_0x25fb82['params']['id'];}return db['VoiceRecording'][_0xa7ef('0x44')]({'where':_0xca51ad,'attributes':['id','value'],'raw':!![]})[_0xa7ef('0x22')](handleEntityNotFound(_0x4e996c,null))['then'](function(_0x58da92){if(_0x58da92){var _0x263df5=_0x58da92[_0xa7ef('0x49')];var _0x10d6b9=util[_0xa7ef('0x2c')](_0xa7ef('0x4a'),_0x263df5);if(fs[_0xa7ef('0x4b')](_0x10d6b9)){_0x2f54ac=!![];return _0x348403[_0xa7ef('0x4c')](_0x10d6b9,_0x263df5,config[_0xa7ef('0x4d')][_0xa7ef('0x4e')])['then'](function(){return _0x58da92;});}return _0x58da92;}})[_0xa7ef('0x22')](function(_0x2ce752){if(_0x2ce752){var _0x357823=_0x2ce752[_0xa7ef('0x49')];if(!fs[_0xa7ef('0x4b')](_0x357823)){throw new db[(_0xa7ef('0x4f'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2ce752[_0xa7ef('0x50')]){return _0x4e996c[_0xa7ef('0x47')](_0x357823,_0x2ce752[_0xa7ef('0x50')]+path[_0xa7ef('0x51')](_0x357823),function(){if(_0x2f54ac){fs[_0xa7ef('0x52')](_0x357823);}});}else{return _0x4e996c['download'](_0x357823,function(_0x3a6149){if(_0x2f54ac){fs[_0xa7ef('0x52')](_0x357823);}});}}})[_0xa7ef('0x41')](function(_0x168c7b){if(_0x168c7b[_0xa7ef('0x53')]===_0xa7ef('0x54')){_0x4e996c['status'](0x194)['send'](_0xa7ef('0x55'));}else{return handleError(_0x4e996c,null);}});};exports[_0xa7ef('0x56')]=function(_0xf60adb,_0x62fb64,_0x4e779f){var _0x40d2da=require('../../components/encryptor');var _0x1413f1=![];var _0x3de3a6={'$and':[db[_0xa7ef('0x57')][_0xa7ef('0x37')](db[_0xa7ef('0x57')]['fn']('MD5',db[_0xa7ef('0x57')][_0xa7ef('0x58')]('uniqueid')),_0xf60adb[_0xa7ef('0x2d')][_0xa7ef('0x59')])]};if(_0xf60adb[_0xa7ef('0x2d')][_0xa7ef('0x3b')]&&_0xf60adb[_0xa7ef('0x2d')][_0xa7ef('0x3b')]===_0xa7ef('0x48')){_0x3de3a6[_0xa7ef('0x5a')][_0xa7ef('0x5b')]({'uniqueid':_0xf60adb[_0xa7ef('0x43')]['id']});}else{_0x3de3a6['$and'][_0xa7ef('0x5b')]({'id':_0xf60adb[_0xa7ef('0x43')]['id']});}return db[_0xa7ef('0x27')][_0xa7ef('0x44')]({'where':_0x3de3a6,'attributes':['id',_0xa7ef('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x62fb64,null))['then'](function(_0x42afdf){if(_0x42afdf){var _0x6b159a=util[_0xa7ef('0x2c')](_0xa7ef('0x4a'),_0x42afdf[_0xa7ef('0x49')]);if(fs['existsSync'](_0x6b159a)){_0x1413f1=!![];return _0x40d2da['decryptFile'](_0x6b159a,_0x42afdf[_0xa7ef('0x49')],config[_0xa7ef('0x4d')][_0xa7ef('0x4e')])['then'](function(){return _0x42afdf;});}return _0x42afdf;}})[_0xa7ef('0x22')](function(_0x138feb){if(_0x138feb){if(!fs['existsSync'](_0x138feb[_0xa7ef('0x49')])){throw new db[(_0xa7ef('0x4f'))]['ValidationError'](_0xa7ef('0x54'));}if(_0x138feb[_0xa7ef('0x50')]){return _0x62fb64[_0xa7ef('0x47')](_0x138feb[_0xa7ef('0x49')],_0x138feb[_0xa7ef('0x50')]+path[_0xa7ef('0x51')](_0x138feb['value']),function(){if(_0x1413f1){fs['unlink'](_0x138feb[_0xa7ef('0x49')]);}});}else{return _0x62fb64[_0xa7ef('0x47')](_0x138feb[_0xa7ef('0x49')],function(_0x599b06){if(_0x1413f1){fs[_0xa7ef('0x52')](_0x138feb[_0xa7ef('0x49')]);}});}}})[_0xa7ef('0x41')](handleError(_0x62fb64,null));};exports['destroy']=function(_0x27a95d,_0x315d7c){return db['VoiceRecording'][_0xa7ef('0x44')]({'where':{'id':_0x27a95d[_0xa7ef('0x43')]['id']}})[_0xa7ef('0x22')](function(_0x26db44){if(_['isNil'](_0x26db44)){throw new ReferenceError(_0xa7ef('0x5c'));}return _0x26db44;})[_0xa7ef('0x22')](function(_0x51baba){var _0x406b05=_0x51baba[_0xa7ef('0x49')];logger['info'](_0xa7ef('0x5d'),_0x406b05);if(!_[_0xa7ef('0x5e')](_0x51baba[_0xa7ef('0x49')])&&fs['existsSync'](_0x406b05)){logger['info'](_0xa7ef('0x5f')+_0x406b05+_0xa7ef('0x60'));fs[_0xa7ef('0x61')](_0x406b05);}_0x406b05=_0x406b05+_0xa7ef('0x62');if(!_['isNil'](_0x51baba['value'])&&fs[_0xa7ef('0x4b')](_0x406b05)){logger[_0xa7ef('0x63')](_0xa7ef('0x5f')+_0x406b05+_0xa7ef('0x60'));fs[_0xa7ef('0x61')](_0x406b05);}return _0x51baba;})[_0xa7ef('0x22')](function(_0x40fcd0){if(!_0x40fcd0)throw new InternalError();return _0x40fcd0[_0xa7ef('0x23')]();})[_0xa7ef('0x22')](function(){_0x315d7c[_0xa7ef('0x18')](0xcc)[_0xa7ef('0x17')]();})[_0xa7ef('0x41')](handleError(_0x315d7c,null));};function getBucketslist(_0xf12a9d,_0x6ba611,_0x536006){return new Promise(function(_0x773d0e,_0x351e42){var _0x3c6a08=new AWS['S3']({'accessKeyId':_0x6ba611,'secretAccessKey':_0xf12a9d,'region':_0x536006});_0x3c6a08['listBuckets']({},function(_0x1cf800,_0x240b7a){if(_0x1cf800){return _0x351e42(_0x1cf800);}else{return _0x773d0e(_0x240b7a);}});});}function createBucket(_0x137136,_0x14faca,_0x2b02a7,_0x32a567){return new Promise(function(_0x364fa6,_0x45a0be){var _0x331a38=new AWS['S3']({'accessKeyId':_0x14faca,'secretAccessKey':_0x137136,'region':_0x2b02a7});_0x331a38['createBucket']({'Bucket':_0x32a567},function(_0x24fcc7,_0x2b4440){if(_0x24fcc7){return _0x45a0be(_0x24fcc7);}else{return _0x364fa6(_0x2b4440);}});});}function uploadFile(_0x107f0d,_0x35462a,_0x1c0151,_0x1da590,_0x36d1fb,_0x338815){return new Promise(function(_0x4f3f17,_0x45a9fa){var _0x2026cd=new AWS['S3']({'accessKeyId':_0x35462a,'secretAccessKey':_0x107f0d,'region':_0x1c0151});_0x2026cd[_0xa7ef('0x64')]({'Bucket':_0x1da590,'Key':_0x36d1fb,'Body':_0x338815},function(_0x1f0c6c,_0x3df0f2){if(_0x1f0c6c){return _0x45a9fa(_0x1f0c6c);}else{return _0x4f3f17(_0x3df0f2);}});});}function startTranscribe(_0x4c174b,_0x5512d1,_0x470e5a,_0x4880a7,_0x2768cf,_0x41c4bd){return new Promise(function(_0x1b0506,_0x568fce){var _0x5605bb=new AWS[(_0xa7ef('0x65'))]({'accessKeyId':_0x5512d1,'secretAccessKey':_0x4c174b,'region':_0x470e5a});_0x5605bb['startTranscriptionJob']({'TranscriptionJobName':_0x4880a7,'LanguageCode':_0x2768cf,'Media':{'MediaFileUri':_0x41c4bd}},function(_0x419fe9,_0x52bf81){if(_0x419fe9){return _0x568fce(_0x419fe9);}else{return _0x1b0506(_0x52bf81);}});});}function transcribe(_0x1de5c1,_0x28ffc7,_0x5369f9,_0x587dbd,_0x3a7e6e,_0x19f5f7,_0x3a6998){return new Promise(function(_0xbec0fb,_0x22e543){var _0x583e2d={};logger['info'](util['format'](_0xa7ef('0x66'),_0x1de5c1,_0x3a7e6e));return uploadFile(_0x28ffc7,_0x5369f9,_0x587dbd,_0x3a7e6e,path[_0xa7ef('0x67')](_0x19f5f7),fs[_0xa7ef('0x68')](_0x19f5f7))[_0xa7ef('0x22')](function(_0x525fa3){logger['info'](util[_0xa7ef('0x2c')](_0xa7ef('0x69'),_0x1de5c1,_0x3a7e6e,_0x525fa3[_0xa7ef('0x6a')]));_0x583e2d[_0xa7ef('0x6b')]=_0x525fa3[_0xa7ef('0x6c')];_0x583e2d[_0xa7ef('0x6d')]=_0x525fa3[_0xa7ef('0x6a')];logger[_0xa7ef('0x63')](util[_0xa7ef('0x2c')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1de5c1));return startTranscribe(_0x28ffc7,_0x5369f9,_0x587dbd,uuidv4(),_0x3a6998,_0x525fa3[_0xa7ef('0x6a')]);})['then'](function(_0x559fec){logger['info'](util[_0xa7ef('0x2c')](_0xa7ef('0x6e'),_0x1de5c1,_0x559fec['TranscriptionJob'][_0xa7ef('0x6f')]));_0x583e2d[_0xa7ef('0x70')]=_0x559fec[_0xa7ef('0x71')]['TranscriptionJobName'];_0x583e2d[_0xa7ef('0x72')]=_0x559fec[_0xa7ef('0x71')][_0xa7ef('0x73')];return _0xbec0fb(_0x583e2d);})[_0xa7ef('0x41')](function(_0x29e9ea){return _0x22e543(_0x29e9ea);});});}exports[_0xa7ef('0x74')]=function(_0x4c3646,_0x195ccd,_0xe7d771){var _0x3b2e7c;var _0x15d550;var _0xb58ffb;var _0xa1986a=require(_0xa7ef('0x75'));return db[_0xa7ef('0x27')][_0xa7ef('0x76')]({'where':{'id':_0x4c3646[_0xa7ef('0x43')]['id']}})[_0xa7ef('0x22')](function(_0x3a6119){if(_0x3a6119){var _0x5bb58f=util[_0xa7ef('0x2c')](_0xa7ef('0x4a'),_0x3a6119[_0xa7ef('0x49')]);if(fs[_0xa7ef('0x4b')](_0x5bb58f)){cypher=!![];return _0xa1986a[_0xa7ef('0x4c')](_0x5bb58f,_0x3a6119[_0xa7ef('0x49')],config[_0xa7ef('0x4d')][_0xa7ef('0x4e')])[_0xa7ef('0x22')](function(){return _0x3a6119;});}return _0x3a6119;}})[_0xa7ef('0x22')](function(_0x2b88ac){if(!_0x2b88ac){throw new db['Sequelize'][(_0xa7ef('0x77'))]('Voice\x20Recording\x20not\x20found');}_0x15d550=_0x2b88ac;return db[_0xa7ef('0x78')][_0xa7ef('0x76')]({'where':{'id':0x1}});})[_0xa7ef('0x22')](handleEntityNotFound(_0x195ccd,null))[_0xa7ef('0x22')](function(_0x53a16c){if(_0x53a16c){_0x3b2e7c=_0x53a16c;if(!_0x3b2e7c['transcribe']||!_0x3b2e7c[_0xa7ef('0x79')]||!_0x3b2e7c[_0xa7ef('0x7a')]||!_0x3b2e7c[_0xa7ef('0x7b')]||!_0x3b2e7c[_0xa7ef('0x6b')]){throw new db[(_0xa7ef('0x4f'))][(_0xa7ef('0x77'))](_0xa7ef('0x7c'));}if(_0x4c3646[_0xa7ef('0x45')][_0xa7ef('0x7d')]&&(!_0x3b2e7c[_0xa7ef('0x7e')]||!_0x3b2e7c[_0xa7ef('0x7f')]||!_0x3b2e7c[_0xa7ef('0x80')]||!_0x3b2e7c[_0xa7ef('0x7b')]||!_0x3b2e7c[_0xa7ef('0x6b')])){throw new db[(_0xa7ef('0x4f'))][(_0xa7ef('0x77'))](_0xa7ef('0x81'));}return db[_0xa7ef('0x82')][_0xa7ef('0x76')]({'where':{'id':_0x3b2e7c['transcribeAccountId']}});}})[_0xa7ef('0x22')](function(_0x3b6ed3){if(!_0x3b6ed3){throw new db['Sequelize']['ValidationError'](_0xa7ef('0x83'));}if(!_0x3b6ed3[_0xa7ef('0x84')]||!_0x3b6ed3[_0xa7ef('0x85')]){throw new db[(_0xa7ef('0x4f'))][(_0xa7ef('0x77'))]('Cloud\x20Provider\x20not\x20configured');}_0xb58ffb=_0x3b6ed3;return getBucketslist(_0xb58ffb[_0xa7ef('0x84')],_0xb58ffb[_0xa7ef('0x85')],_0x3b2e7c[_0xa7ef('0x7a')]);})['then'](function(_0x3600b5){if(_0x3600b5&&_0x3600b5[_0xa7ef('0x86')]){var _0x25b1b2=_[_0xa7ef('0x44')](_0x3600b5[_0xa7ef('0x86')],function(_0x3774eb){return _0x3774eb['Name']===_0x3b2e7c['bucket'];});if(!_0x25b1b2){logger[_0xa7ef('0x63')](util[_0xa7ef('0x2c')](_0xa7ef('0x87'),_0x4c3646[_0xa7ef('0x43')]['id'],_0x3b2e7c[_0xa7ef('0x6b')]));return createBucket(_0xb58ffb['data1'],_0xb58ffb[_0xa7ef('0x85')],_0x3b2e7c['transcribeRegion'],_0x3b2e7c['bucket']);}logger['info'](util[_0xa7ef('0x2c')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4c3646['params']['id'],_0x3b2e7c[_0xa7ef('0x6b')]));return;}})[_0xa7ef('0x22')](function(_0x160c27){if(_0x15d550[_0xa7ef('0x72')]===_0xa7ef('0x88')){return transcribe(_0x4c3646[_0xa7ef('0x43')]['id'],_0xb58ffb[_0xa7ef('0x84')],_0xb58ffb[_0xa7ef('0x85')],_0x3b2e7c['transcribeRegion'],_0x3b2e7c['bucket'],_0x15d550[_0xa7ef('0x49')],_0x3b2e7c[_0xa7ef('0x7b')]);}else{logger[_0xa7ef('0x63')](util[_0xa7ef('0x2c')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4c3646[_0xa7ef('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xa7ef('0x22')](function(_0x3ae893){if(_0x3ae893){_0x3ae893['tempSentiment']=_0x4c3646[_0xa7ef('0x45')][_0xa7ef('0x7d')];return _0x15d550[_0xa7ef('0x89')](_0x3ae893);}})[_0xa7ef('0x22')](respondWithResult(_0x195ccd,null))[_0xa7ef('0x41')](handleError(_0x195ccd,null));};function writeFile(_0xb8a1b6,_0x521b55){return new Promise(function(_0x738aab,_0x4fe851){fs[_0xa7ef('0x8a')](_0x521b55,_0xb8a1b6,function(_0x33d5b7,_0x5592f9){if(_0x33d5b7){return _0x4fe851(_0x33d5b7);}else{return _0x738aab(_0x5592f9);}});});}exports[_0xa7ef('0x8b')]=function(_0x307b12,_0x5e1a2b,_0x35fe0c){return db[_0xa7ef('0x27')][_0xa7ef('0x76')]({'where':{'id':_0x307b12[_0xa7ef('0x43')]['id']}})[_0xa7ef('0x22')](handleEntityNotFound(_0x5e1a2b))[_0xa7ef('0x22')](function(_0x24a866){if(_0x24a866&&_0x24a866['fileText']){var _0x31bb1b=_0x24a866[_0xa7ef('0x8c')];var _0x12f828=config[_0xa7ef('0x8d')]+'/server/files/transcribes/transcribe_'+_0x24a866['id']+_0xa7ef('0x8e');if(fs[_0xa7ef('0x4b')](_0x12f828)){return _0x12f828;}return writeFile(_0x31bb1b,_0x12f828)[_0xa7ef('0x22')](function(){return _0x12f828;});}else{throw new db['Sequelize'][(_0xa7ef('0x77'))](_0xa7ef('0x8f'));}})['then'](function(_0x2ebe45){return _0x5e1a2b['download'](_0x2ebe45);})[_0xa7ef('0x41')](handleError(_0x5e1a2b));}; \ No newline at end of file +var _0x0148=['sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','differenceBy','format','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','VoiceRecording','includeAll','include','findAll','rows','catch','keys','options','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','secrets','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','findOne','%s.cypher','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x0148,0x140));var _0x8014=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x0148[_0x1203f];return _0x365f0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8014('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8014('0x1'));var rp=require(_0x8014('0x2'));var moment=require(_0x8014('0x3'));var BPromise=require(_0x8014('0x4'));var Mustache=require('mustache');var util=require(_0x8014('0x5'));var path=require(_0x8014('0x6'));var sox=require(_0x8014('0x7'));var csv=require(_0x8014('0x8'));var ejs=require(_0x8014('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8014('0xa'));var squel=require(_0x8014('0xb'));var crypto=require(_0x8014('0xc'));var jsforce=require(_0x8014('0xd'));var deskjs=require(_0x8014('0xe'));var toCsv=require(_0x8014('0x8'));var querystring=require(_0x8014('0xf'));var Papa=require(_0x8014('0x10'));var AWS=require(_0x8014('0x11'));var uuidv4=require(_0x8014('0x12'));var Redis=require(_0x8014('0x13'));var authService=require(_0x8014('0x14'));var qs=require(_0x8014('0x15'));var as=require(_0x8014('0x16'));var hardwareService=require(_0x8014('0x17'));var logger=require('../../config/logger')(_0x8014('0x18'));var utils=require(_0x8014('0x19'));var config=require(_0x8014('0x1a'));var licenseUtil=require(_0x8014('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x214f69,_0x59af8a){_0x59af8a=_0x59af8a||0xcc;return function(_0x18a259){if(_0x18a259){return _0x214f69[_0x8014('0x1c')](_0x59af8a);}return _0x214f69[_0x8014('0x1d')](_0x59af8a)[_0x8014('0x1e')]();};}function respondWithResult(_0x4457e2,_0x434dbb){_0x434dbb=_0x434dbb||0xc8;return function(_0x2d3b5b){if(_0x2d3b5b){return _0x4457e2[_0x8014('0x1d')](_0x434dbb)['json'](_0x2d3b5b);}};}function respondWithFilteredResult(_0x1b3e04,_0x4f8741){return function(_0x5f8a63){if(_0x5f8a63){var _0x181ed6=typeof _0x4f8741[_0x8014('0x1f')]===_0x8014('0x20')&&typeof _0x4f8741[_0x8014('0x21')]==='undefined';var _0x2c7471=_0x5f8a63[_0x8014('0x22')];var _0x428bd3=_0x181ed6?0x0:_0x4f8741[_0x8014('0x1f')];var _0xb4412e=_0x181ed6?_0x5f8a63[_0x8014('0x22')]:_0x4f8741[_0x8014('0x1f')]+_0x4f8741[_0x8014('0x21')];var _0x5a6701;if(_0xb4412e>=_0x2c7471){_0xb4412e=_0x2c7471;_0x5a6701=0xc8;}else{_0x5a6701=0xce;}_0x1b3e04[_0x8014('0x1d')](_0x5a6701);return _0x1b3e04['set'](_0x8014('0x23'),_0x428bd3+'-'+_0xb4412e+'/'+_0x2c7471)[_0x8014('0x24')](_0x5f8a63);}return null;};}function patchUpdates(_0x16cdb9){return function(_0x1b7098){try{jsonpatch['apply'](_0x1b7098,_0x16cdb9,!![]);}catch(_0x28ae89){return BPromise[_0x8014('0x25')](_0x28ae89);}return _0x1b7098[_0x8014('0x26')]();};}function saveUpdates(_0xb7b4e3,_0x4639a4){return function(_0x2d5d0f){if(_0x2d5d0f){return _0x2d5d0f[_0x8014('0x27')](_0xb7b4e3)[_0x8014('0x28')](function(_0x522831){return _0x522831;});}return null;};}function removeEntity(_0x37ac14,_0x538212){return function(_0x7c9076){if(_0x7c9076){return _0x7c9076[_0x8014('0x29')]()[_0x8014('0x28')](function(){_0x37ac14[_0x8014('0x1d')](0xcc)[_0x8014('0x1e')]();});}};}function handleEntityNotFound(_0x13fe4c,_0x37118f){return function(_0x58cb45){if(!_0x58cb45){_0x13fe4c[_0x8014('0x1c')](0x194);}return _0x58cb45;};}function handleError(_0x2c37b4,_0xfddd08){_0xfddd08=_0xfddd08||0x1f4;return function(_0x4daed6){logger['error'](_0x4daed6[_0x8014('0x2a')]);if(_0x4daed6[_0x8014('0x2b')]){delete _0x4daed6[_0x8014('0x2b')];}_0x2c37b4['status'](_0xfddd08)[_0x8014('0x2c')](_0x4daed6);};}exports[_0x8014('0x2d')]=function(_0x40af0e,_0x297eb1){var _0x386a8d={},_0x5e6169={},_0x50b558={'count':0x0,'rows':[]};var _0x1b9ab6=_[_0x8014('0x2e')](db['VoiceRecording'][_0x8014('0x2f')],function(_0x43b143){return{'name':_0x43b143['fieldName'],'type':_0x43b143['type'][_0x8014('0x30')]};});_0x5e6169['model']=_[_0x8014('0x31')](_[_0x8014('0x2e')](_0x1b9ab6,'name'),[_0x8014('0x32')]);_0x5e6169[_0x8014('0x33')]=_['keys'](_0x40af0e[_0x8014('0x33')]);_0x5e6169[_0x8014('0x34')]=_[_0x8014('0x35')](_0x5e6169[_0x8014('0x36')],_0x5e6169['query']);_0x386a8d['attributes']=_[_0x8014('0x35')](_0x5e6169[_0x8014('0x36')],qs[_0x8014('0x37')](_0x40af0e['query'][_0x8014('0x37')]));_0x386a8d[_0x8014('0x38')]=_0x386a8d[_0x8014('0x38')][_0x8014('0x39')]?_0x386a8d['attributes']:_0x5e6169[_0x8014('0x36')];if(!_0x40af0e[_0x8014('0x33')][_0x8014('0x3a')](_0x8014('0x3b'))){_0x386a8d[_0x8014('0x21')]=qs[_0x8014('0x21')](_0x40af0e[_0x8014('0x33')]['limit']);_0x386a8d[_0x8014('0x1f')]=qs[_0x8014('0x1f')](_0x40af0e[_0x8014('0x33')]['offset']);}_0x386a8d['order']=qs[_0x8014('0x3c')](_0x40af0e[_0x8014('0x33')][_0x8014('0x3c')]);_0x386a8d[_0x8014('0x3d')]=qs[_0x8014('0x34')](_['pick'](_0x40af0e['query'],_0x5e6169[_0x8014('0x34')]),_0x1b9ab6);if(_0x40af0e[_0x8014('0x33')]['filter']){_0x386a8d['where']=_[_0x8014('0x3e')](_0x386a8d[_0x8014('0x3d')],{'$or':_['map'](_0x1b9ab6,function(_0xb66e9a){if(_0xb66e9a[_0x8014('0x3f')]!=='VIRTUAL'){var _0xfb792b={};_0xfb792b[_0xb66e9a[_0x8014('0x2b')]]={'$like':'%'+_0x40af0e[_0x8014('0x33')]['filter']+'%'};return _0xfb792b;}})});}_0x386a8d=_['merge']({},_0x386a8d,_0x40af0e['options']);var _0x153df9={'where':_0x386a8d[_0x8014('0x3d')]};return db[_0x8014('0x40')][_0x8014('0x22')](_0x153df9)[_0x8014('0x28')](function(_0x523204){_0x50b558[_0x8014('0x22')]=_0x523204;if(_0x40af0e[_0x8014('0x33')][_0x8014('0x41')]){_0x386a8d[_0x8014('0x42')]=[{'all':!![]}];}return db[_0x8014('0x40')][_0x8014('0x43')](_0x386a8d);})['then'](function(_0x1da110){_0x50b558[_0x8014('0x44')]=_0x1da110;return _0x50b558;})[_0x8014('0x28')](respondWithFilteredResult(_0x297eb1,_0x386a8d))[_0x8014('0x45')](handleError(_0x297eb1,null));};exports['show']=function(_0x51a67f,_0x59a314){var _0x3946fd={'raw':![],'where':{'id':_0x51a67f['params']['id']}},_0x4558e9={};_0x4558e9[_0x8014('0x36')]=_['keys'](db[_0x8014('0x40')][_0x8014('0x2f')]);_0x4558e9[_0x8014('0x33')]=_[_0x8014('0x46')](_0x51a67f[_0x8014('0x33')]);_0x4558e9[_0x8014('0x34')]=_[_0x8014('0x35')](_0x4558e9['model'],_0x4558e9[_0x8014('0x33')]);_0x3946fd['attributes']=_[_0x8014('0x35')](_0x4558e9[_0x8014('0x36')],qs[_0x8014('0x37')](_0x51a67f['query'][_0x8014('0x37')]));_0x3946fd[_0x8014('0x38')]=_0x3946fd[_0x8014('0x38')][_0x8014('0x39')]?_0x3946fd[_0x8014('0x38')]:_0x4558e9['model'];if(_0x51a67f[_0x8014('0x33')][_0x8014('0x41')]){_0x3946fd[_0x8014('0x42')]=[{'all':!![]}];}_0x3946fd=_[_0x8014('0x3e')]({},_0x3946fd,_0x51a67f[_0x8014('0x47')]);return db['VoiceRecording'][_0x8014('0x48')](_0x3946fd)['then'](handleEntityNotFound(_0x59a314,null))[_0x8014('0x28')](respondWithResult(_0x59a314,null))[_0x8014('0x45')](handleError(_0x59a314,null));};exports['create']=function(_0x302942,_0x45c1b0){return db[_0x8014('0x40')][_0x8014('0x49')](_0x302942[_0x8014('0x4a')],{})['then'](respondWithResult(_0x45c1b0,0xc9))[_0x8014('0x45')](handleError(_0x45c1b0,null));};exports[_0x8014('0x27')]=function(_0xd0b663,_0xc56be3){if(_0xd0b663[_0x8014('0x4a')]['id']){delete _0xd0b663[_0x8014('0x4a')]['id'];}return db[_0x8014('0x40')][_0x8014('0x48')]({'where':{'id':_0xd0b663[_0x8014('0x4b')]['id']}})[_0x8014('0x28')](handleEntityNotFound(_0xc56be3,null))[_0x8014('0x28')](saveUpdates(_0xd0b663[_0x8014('0x4a')],null))[_0x8014('0x28')](respondWithResult(_0xc56be3,null))['catch'](handleError(_0xc56be3,null));};exports[_0x8014('0x4c')]=function(_0x56410d,_0x7ef3e7){return db[_0x8014('0x40')][_0x8014('0x4c')]()[_0x8014('0x28')](respondWithResult(_0x7ef3e7,null))[_0x8014('0x45')](handleError(_0x7ef3e7,null));};exports[_0x8014('0x4d')]=function(_0x15153d,_0x3eb559,_0x25c00e){var _0x3b3f0c=require(_0x8014('0x4e'));var _0x23d663=![];var _0x4d6820={};if(_0x15153d[_0x8014('0x33')][_0x8014('0x3f')]&&_0x15153d['query'][_0x8014('0x3f')]==='uniqueid'){_0x4d6820[_0x8014('0x4f')]=_0x15153d[_0x8014('0x4b')]['id'];}else{_0x4d6820['id']=_0x15153d[_0x8014('0x4b')]['id'];}return db[_0x8014('0x40')]['find']({'where':_0x4d6820,'attributes':['id',_0x8014('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x3eb559,null))[_0x8014('0x28')](function(_0x11caff){if(_0x11caff){var _0x59a805=_0x11caff[_0x8014('0x50')];var _0x525a83=util['format']('%s.cypher',_0x59a805);if(fs[_0x8014('0x51')](_0x525a83)){_0x23d663=!![];return _0x3b3f0c[_0x8014('0x52')](_0x525a83,_0x59a805,config['secrets'][_0x8014('0x53')])[_0x8014('0x28')](function(){return _0x11caff;});}return _0x11caff;}})['then'](function(_0x3a91f3){if(_0x3a91f3){var _0x55a5e8=_0x3a91f3[_0x8014('0x50')];if(!fs['existsSync'](_0x55a5e8)){throw new db[(_0x8014('0x54'))][(_0x8014('0x55'))](_0x8014('0x56'));}if(_0x3a91f3[_0x8014('0x57')]){return _0x3eb559[_0x8014('0x4d')](_0x55a5e8,_0x3a91f3[_0x8014('0x57')]+path[_0x8014('0x58')](_0x55a5e8),function(){if(_0x23d663){fs[_0x8014('0x59')](_0x55a5e8);}});}else{return _0x3eb559[_0x8014('0x4d')](_0x55a5e8,function(_0x1110b1){if(_0x23d663){fs[_0x8014('0x59')](_0x55a5e8);}});}}})[_0x8014('0x45')](function(_0x3a96af){if(_0x3a96af[_0x8014('0x5a')]===_0x8014('0x56')){_0x3eb559[_0x8014('0x1d')](0x194)[_0x8014('0x2c')]('Not\x20found');}else{return handleError(_0x3eb559,null);}});};exports[_0x8014('0x5b')]=function(_0x391ef8,_0x287698,_0x1bc62b){var _0x533a70=require(_0x8014('0x4e'));var _0x3e506a=![];var _0x298f02={'$and':[db[_0x8014('0x5c')]['where'](db[_0x8014('0x5c')]['fn'](_0x8014('0x5d'),db[_0x8014('0x5c')][_0x8014('0x5e')]('uniqueid')),_0x391ef8[_0x8014('0x33')][_0x8014('0x5f')])]};if(_0x391ef8[_0x8014('0x33')][_0x8014('0x3f')]&&_0x391ef8[_0x8014('0x33')][_0x8014('0x3f')]==='uniqueid'){_0x298f02[_0x8014('0x60')][_0x8014('0x61')]({'uniqueid':_0x391ef8[_0x8014('0x4b')]['id']});}else{_0x298f02[_0x8014('0x60')][_0x8014('0x61')]({'id':_0x391ef8[_0x8014('0x4b')]['id']});}return db['VoiceRecording'][_0x8014('0x48')]({'where':_0x298f02,'attributes':['id',_0x8014('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x287698,null))['then'](function(_0x780167){if(_0x780167){var _0x49eed1=util[_0x8014('0x32')]('%s.cypher',_0x780167[_0x8014('0x50')]);if(fs[_0x8014('0x51')](_0x49eed1)){_0x3e506a=!![];return _0x533a70['decryptFile'](_0x49eed1,_0x780167[_0x8014('0x50')],config[_0x8014('0x62')][_0x8014('0x53')])[_0x8014('0x28')](function(){return _0x780167;});}return _0x780167;}})['then'](function(_0x3b20ce){if(_0x3b20ce){if(!fs[_0x8014('0x51')](_0x3b20ce[_0x8014('0x50')])){throw new db[(_0x8014('0x54'))][(_0x8014('0x55'))](_0x8014('0x56'));}if(_0x3b20ce[_0x8014('0x57')]){return _0x287698[_0x8014('0x4d')](_0x3b20ce['value'],_0x3b20ce['filename']+path[_0x8014('0x58')](_0x3b20ce[_0x8014('0x50')]),function(){if(_0x3e506a){fs[_0x8014('0x59')](_0x3b20ce[_0x8014('0x50')]);}});}else{return _0x287698[_0x8014('0x4d')](_0x3b20ce[_0x8014('0x50')],function(_0x418ebd){if(_0x3e506a){fs[_0x8014('0x59')](_0x3b20ce[_0x8014('0x50')]);}});}}})[_0x8014('0x45')](handleError(_0x287698,null));};exports['destroy']=function(_0x281fff,_0x2d718b){return db['VoiceRecording'][_0x8014('0x48')]({'where':{'id':_0x281fff[_0x8014('0x4b')]['id']}})[_0x8014('0x28')](function(_0x1f316f){if(_[_0x8014('0x63')](_0x1f316f)){throw new ReferenceError(_0x8014('0x64'));}return _0x1f316f;})[_0x8014('0x28')](function(_0x5efebc){var _0x20d7dc=_0x5efebc[_0x8014('0x50')];logger[_0x8014('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x20d7dc);if(!_[_0x8014('0x63')](_0x5efebc[_0x8014('0x50')])&&fs[_0x8014('0x51')](_0x20d7dc)){logger['info'](_0x8014('0x66')+_0x20d7dc+_0x8014('0x67'));fs[_0x8014('0x68')](_0x20d7dc);}_0x20d7dc=_0x20d7dc+_0x8014('0x69');if(!_[_0x8014('0x63')](_0x5efebc[_0x8014('0x50')])&&fs['existsSync'](_0x20d7dc)){logger[_0x8014('0x65')]('File:\x20\x22'+_0x20d7dc+_0x8014('0x67'));fs[_0x8014('0x68')](_0x20d7dc);}return _0x5efebc;})['then'](function(_0x2e8ce4){if(!_0x2e8ce4)throw new InternalError();return _0x2e8ce4[_0x8014('0x29')]();})[_0x8014('0x28')](function(){_0x2d718b[_0x8014('0x1d')](0xcc)[_0x8014('0x1e')]();})[_0x8014('0x45')](handleError(_0x2d718b,null));};function getBucketslist(_0x3984c5,_0x12d2b2,_0xd58e85){return new Promise(function(_0x409d23,_0x433861){var _0x9e9c3c=new AWS['S3']({'accessKeyId':_0x12d2b2,'secretAccessKey':_0x3984c5,'region':_0xd58e85});_0x9e9c3c['listBuckets']({},function(_0x3a2cf1,_0x39175c){if(_0x3a2cf1){return _0x433861(_0x3a2cf1);}else{return _0x409d23(_0x39175c);}});});}function createBucket(_0xf7df6c,_0xd6c80c,_0xe3cfc1,_0x20e304){return new Promise(function(_0x8a5613,_0x1be495){var _0x324315=new AWS['S3']({'accessKeyId':_0xd6c80c,'secretAccessKey':_0xf7df6c,'region':_0xe3cfc1});_0x324315[_0x8014('0x6a')]({'Bucket':_0x20e304},function(_0x42b55f,_0x40184e){if(_0x42b55f){return _0x1be495(_0x42b55f);}else{return _0x8a5613(_0x40184e);}});});}function uploadFile(_0x3eb3bf,_0xd5231d,_0x59e972,_0x36fefd,_0x196539,_0x52c2d1){return new Promise(function(_0x123d3c,_0x4300d7){var _0xd97f14=new AWS['S3']({'accessKeyId':_0xd5231d,'secretAccessKey':_0x3eb3bf,'region':_0x59e972});_0xd97f14['upload']({'Bucket':_0x36fefd,'Key':_0x196539,'Body':_0x52c2d1},function(_0xbe5ae3,_0x5b3590){if(_0xbe5ae3){return _0x4300d7(_0xbe5ae3);}else{return _0x123d3c(_0x5b3590);}});});}function startTranscribe(_0x8ca837,_0xd39406,_0xb50430,_0x278601,_0x2ca7de,_0x423cc3){return new Promise(function(_0x2345fc,_0x2e78bf){var _0x587563=new AWS['TranscribeService']({'accessKeyId':_0xd39406,'secretAccessKey':_0x8ca837,'region':_0xb50430});_0x587563[_0x8014('0x6b')]({'TranscriptionJobName':_0x278601,'LanguageCode':_0x2ca7de,'Media':{'MediaFileUri':_0x423cc3}},function(_0x39920b,_0x143bd1){if(_0x39920b){return _0x2e78bf(_0x39920b);}else{return _0x2345fc(_0x143bd1);}});});}function transcribe(_0x723f95,_0x4bfe60,_0x21e15c,_0x213dd3,_0x577968,_0x158d18,_0x3579b7){return new Promise(function(_0x1625f5,_0x4abe6e){var _0x2759a6={};logger[_0x8014('0x65')](util[_0x8014('0x32')](_0x8014('0x6c'),_0x723f95,_0x577968));return uploadFile(_0x4bfe60,_0x21e15c,_0x213dd3,_0x577968,path['basename'](_0x158d18),fs['readFileSync'](_0x158d18))[_0x8014('0x28')](function(_0x323841){logger['info'](util[_0x8014('0x32')](_0x8014('0x6d'),_0x723f95,_0x577968,_0x323841['Location']));_0x2759a6[_0x8014('0x6e')]=_0x323841[_0x8014('0x6f')];_0x2759a6['location']=_0x323841['Location'];logger[_0x8014('0x65')](util[_0x8014('0x32')](_0x8014('0x70'),_0x723f95));return startTranscribe(_0x4bfe60,_0x21e15c,_0x213dd3,uuidv4(),_0x3579b7,_0x323841[_0x8014('0x71')]);})[_0x8014('0x28')](function(_0x19e0aa){logger[_0x8014('0x65')](util[_0x8014('0x32')](_0x8014('0x72'),_0x723f95,_0x19e0aa[_0x8014('0x73')][_0x8014('0x74')]));_0x2759a6[_0x8014('0x75')]=_0x19e0aa['TranscriptionJob'][_0x8014('0x74')];_0x2759a6['transcribeStatus']=_0x19e0aa[_0x8014('0x73')][_0x8014('0x76')];return _0x1625f5(_0x2759a6);})[_0x8014('0x45')](function(_0x2d0e48){return _0x4abe6e(_0x2d0e48);});});}exports['runTranscribe']=function(_0x2b4047,_0x105cfe,_0x922cb6){var _0x2fe378;var _0x5b6d2c;var _0x14ece7;var _0x833b3e=require(_0x8014('0x4e'));return db[_0x8014('0x40')][_0x8014('0x77')]({'where':{'id':_0x2b4047['params']['id']}})[_0x8014('0x28')](function(_0x3a311a){if(_0x3a311a){var _0x45ba75=util[_0x8014('0x32')](_0x8014('0x78'),_0x3a311a['value']);if(fs[_0x8014('0x51')](_0x45ba75)){cypher=!![];return _0x833b3e[_0x8014('0x52')](_0x45ba75,_0x3a311a[_0x8014('0x50')],config[_0x8014('0x62')]['recording'])[_0x8014('0x28')](function(){return _0x3a311a;});}return _0x3a311a;}})[_0x8014('0x28')](function(_0x1315c3){if(!_0x1315c3){throw new db[(_0x8014('0x54'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x5b6d2c=_0x1315c3;return db['Setting'][_0x8014('0x77')]({'where':{'id':0x1}});})[_0x8014('0x28')](handleEntityNotFound(_0x105cfe,null))[_0x8014('0x28')](function(_0x59f979){if(_0x59f979){_0x2fe378=_0x59f979;if(!_0x2fe378[_0x8014('0x79')]||!_0x2fe378[_0x8014('0x7a')]||!_0x2fe378[_0x8014('0x7b')]||!_0x2fe378[_0x8014('0x7c')]||!_0x2fe378[_0x8014('0x6e')]){throw new db[(_0x8014('0x54'))][(_0x8014('0x55'))](_0x8014('0x7d'));}if(_0x2b4047[_0x8014('0x4a')][_0x8014('0x7e')]&&(!_0x2fe378['sentiment']||!_0x2fe378[_0x8014('0x7f')]||!_0x2fe378[_0x8014('0x80')]||!_0x2fe378[_0x8014('0x7c')]||!_0x2fe378[_0x8014('0x6e')])){throw new db[(_0x8014('0x54'))][(_0x8014('0x55'))](_0x8014('0x81'));}return db[_0x8014('0x82')][_0x8014('0x77')]({'where':{'id':_0x2fe378[_0x8014('0x7a')]}});}})['then'](function(_0x30a107){if(!_0x30a107){throw new db[(_0x8014('0x54'))][(_0x8014('0x55'))](_0x8014('0x83'));}if(!_0x30a107[_0x8014('0x84')]||!_0x30a107[_0x8014('0x85')]){throw new db['Sequelize']['ValidationError'](_0x8014('0x86'));}_0x14ece7=_0x30a107;return getBucketslist(_0x14ece7[_0x8014('0x84')],_0x14ece7[_0x8014('0x85')],_0x2fe378[_0x8014('0x7b')]);})['then'](function(_0x4339a4){if(_0x4339a4&&_0x4339a4[_0x8014('0x87')]){var _0x9c8015=_[_0x8014('0x48')](_0x4339a4[_0x8014('0x87')],function(_0x1c7041){return _0x1c7041[_0x8014('0x88')]===_0x2fe378['bucket'];});if(!_0x9c8015){logger[_0x8014('0x65')](util[_0x8014('0x32')](_0x8014('0x89'),_0x2b4047[_0x8014('0x4b')]['id'],_0x2fe378['bucket']));return createBucket(_0x14ece7[_0x8014('0x84')],_0x14ece7[_0x8014('0x85')],_0x2fe378[_0x8014('0x7b')],_0x2fe378[_0x8014('0x6e')]);}logger[_0x8014('0x65')](util[_0x8014('0x32')](_0x8014('0x8a'),_0x2b4047[_0x8014('0x4b')]['id'],_0x2fe378[_0x8014('0x6e')]));return;}})[_0x8014('0x28')](function(_0x117ac9){if(_0x5b6d2c[_0x8014('0x8b')]===_0x8014('0x8c')){return transcribe(_0x2b4047[_0x8014('0x4b')]['id'],_0x14ece7['data1'],_0x14ece7['data2'],_0x2fe378[_0x8014('0x7b')],_0x2fe378[_0x8014('0x6e')],_0x5b6d2c[_0x8014('0x50')],_0x2fe378[_0x8014('0x7c')]);}else{logger[_0x8014('0x65')](util[_0x8014('0x32')](_0x8014('0x8d'),_0x2b4047[_0x8014('0x4b')]['id']));return{'transcribeStatus':_0x8014('0x8e')};}})['then'](function(_0x40339b){if(_0x40339b){_0x40339b['tempSentiment']=_0x2b4047[_0x8014('0x4a')][_0x8014('0x7e')];return _0x5b6d2c[_0x8014('0x8f')](_0x40339b);}})[_0x8014('0x28')](respondWithResult(_0x105cfe,null))['catch'](handleError(_0x105cfe,null));};function writeFile(_0x40518e,_0x507b7a){return new Promise(function(_0x5f2733,_0x3a1924){fs[_0x8014('0x90')](_0x507b7a,_0x40518e,function(_0x2cff6d,_0x549846){if(_0x2cff6d){return _0x3a1924(_0x2cff6d);}else{return _0x5f2733(_0x549846);}});});}exports[_0x8014('0x91')]=function(_0x459c93,_0x5d38a6,_0x1c1437){return db['VoiceRecording']['findOne']({'where':{'id':_0x459c93['params']['id']}})['then'](handleEntityNotFound(_0x5d38a6))[_0x8014('0x28')](function(_0x10f0a5){if(_0x10f0a5&&_0x10f0a5['fileText']){var _0x1a5cb2=_0x10f0a5[_0x8014('0x92')];var _0x1a20d2=config['root']+_0x8014('0x93')+_0x10f0a5['id']+'.txt';if(fs[_0x8014('0x51')](_0x1a20d2)){return _0x1a20d2;}return writeFile(_0x1a5cb2,_0x1a20d2)[_0x8014('0x28')](function(){return _0x1a20d2;});}else{throw new db[(_0x8014('0x54'))][(_0x8014('0x55'))](_0x8014('0x94'));}})['then'](function(_0xc81342){return _0x5d38a6[_0x8014('0x4d')](_0xc81342);})['catch'](handleError(_0x5d38a6));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 979b6b4..00d1d9f 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 _0xb90d=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xb90d,0x17a));var _0xdb90=function(_0xf8769b,_0xb5b74e){_0xf8769b=_0xf8769b-0x0;var _0x197c18=_0xb90d[_0xf8769b];return _0x197c18;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xdb90('0x0')]=function(_0x334fbe,_0x34bf24){return _0x334fbe[_0xdb90('0x1')](_0xdb90('0x2'),attributes,{'tableName':_0xdb90('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdb90('0x4')]},{'name':_0xdb90('0x5'),'fields':[_0xdb90('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8388=['transcribeStatus','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid'];(function(_0x5a96e2,_0x1c8245){var _0x551158=function(_0x178bac){while(--_0x178bac){_0x5a96e2['push'](_0x5a96e2['shift']());}};_0x551158(++_0x1c8245);}(_0x8388,0x18d));var _0x8838=function(_0x5e7514,_0x30c2e1){_0x5e7514=_0x5e7514-0x0;var _0x12f472=_0x8388[_0x5e7514];return _0x12f472;};'use strict';var attributes=require(_0x8838('0x0'));module[_0x8838('0x1')]=function(_0x13cdc3,_0x3666a3){return _0x13cdc3['define'](_0x8838('0x2'),attributes,{'tableName':_0x8838('0x3'),'paranoid':![],'indexes':[{'name':_0x8838('0x4'),'fields':[_0x8838('0x4')]},{'name':_0x8838('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 05620bd..392d07d 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 _0x5f66=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','UpdateVoiceRecording','update','raw','options','where','attributes','../../components/encryptor','findOne','callRecordingEncryption','body','existsSync','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','bluebird'];(function(_0x9b11d7,_0x4a7808){var _0x4f4953=function(_0x15ef42){while(--_0x15ef42){_0x9b11d7['push'](_0x9b11d7['shift']());}};_0x4f4953(++_0x4a7808);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['VoiceRecording'][_0x65f6('0x16')](_0x1f974c['body'],{'raw':_0x1f974c['options']?_0x1f974c['options'][_0x65f6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f974c[_0x65f6('0x18')]?_0x1f974c['options'][_0x65f6('0x19')]||null:null,'attributes':_0x1f974c[_0x65f6('0x18')]?_0x1f974c[_0x65f6('0x18')][_0x65f6('0x1a')]||null:null,'limit':_0x1f974c[_0x65f6('0x18')]?_0x1f974c[_0x65f6('0x18')]['limit']||null:null})[_0x65f6('0xa')](function(_0x4bb39e){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')]('UpdateVoiceRecording',_0x1f974c,JSON[_0x65f6('0xf')](_0x4bb39e));_0x18380e(_0x4bb39e);})[_0x65f6('0x14')](function(_0x2317ce){logger[_0x65f6('0x12')]('UpdateVoiceRecording',_0x2317ce[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x2317ce[_0x65f6('0x11')]));});});};exports['CreateVoiceRecording']=function(_0x5cb131){var _0x4fde2f=this;return new Promise(function(_0x29abdb,_0x16cde8){var _0x4b2292=require(_0x65f6('0x1b'));var _0x28f710;return db['Setting'][_0x65f6('0x1c')]({'attributes':['id',_0x65f6('0x1d')],'where':{'id':0x1},'raw':!![]})[_0x65f6('0xa')](function(_0x559330){_0x28f710=_0x559330;return db['VoiceRecording']['create'](_0x5cb131[_0x65f6('0x1e')]);})[_0x65f6('0xa')](function(_0x4344b3){if(_0x28f710[_0x65f6('0x1d')]&&fs[_0x65f6('0x1f')](_0x4344b3[_0x65f6('0x20')])){var _0x144e55=util['format']('%s.cypher',_0x4344b3[_0x65f6('0x20')]);return _0x4b2292[_0x65f6('0x21')](_0x4344b3['value'],_0x144e55,config['secrets'][_0x65f6('0x22')])[_0x65f6('0xa')](function(){fs[_0x65f6('0x23')](_0x4344b3[_0x65f6('0x20')]);logger[_0x65f6('0x13')](_0x65f6('0x24'));return _0x4344b3;});}return _0x4344b3;})['then'](function(_0x103265){logger[_0x65f6('0x13')](_0x65f6('0x25'),_0x5cb131);logger['debug'](_0x65f6('0x25'),_0x5cb131,JSON[_0x65f6('0xf')](_0x103265));_0x29abdb(_0x103265);})[_0x65f6('0x14')](function(_0x45510a){logger[_0x65f6('0x12')](_0x65f6('0x25'),_0x45510a['message'],_0x5cb131);_0x16cde8(_0x4fde2f[_0x65f6('0x12')](0x1f4,_0x45510a[_0x65f6('0x11')]));});});}; \ No newline at end of file +var _0xa46e=['then','request\x20sent','debug','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','info','result','catch','VoiceRecording','update','options','raw','where','attributes','findOne','callRecordingEncryption','create','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x242a98,_0x13988e){var _0x580999=function(_0x341927){while(--_0x341927){_0x242a98['push'](_0x242a98['shift']());}};_0x580999(++_0x13988e);}(_0xa46e,0x8a));var _0xea46=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xa46e[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['UpdateVoiceRecording']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')](_0x19d5c1['body'],{'raw':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options'][_0xea46('0x19')]||null:null,'attributes':_0x19d5c1['options']?_0x19d5c1['options'][_0xea46('0x1a')]||null:null,'limit':_0x19d5c1['options']?_0x19d5c1['options']['limit']||null:null})[_0xea46('0xa')](function(_0x36f982){logger[_0xea46('0x12')]('UpdateVoiceRecording',_0x19d5c1);logger[_0xea46('0xc')]('UpdateVoiceRecording',_0x19d5c1,JSON[_0xea46('0xd')](_0x36f982));_0x5cf5dd(_0x36f982);})[_0xea46('0x14')](function(_0x528eae){logger[_0xea46('0xe')]('UpdateVoiceRecording',_0x528eae[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d[_0xea46('0xe')](0x1f4,_0x528eae[_0xea46('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5d2de1){var _0x44e797=this;return new Promise(function(_0x38ac07,_0x4b369c){var _0x3b3928=require('../../components/encryptor');var _0x11129d;return db['Setting'][_0xea46('0x1b')]({'attributes':['id',_0xea46('0x1c')],'where':{'id':0x1},'raw':!![]})[_0xea46('0xa')](function(_0x44517d){_0x11129d=_0x44517d;return db[_0xea46('0x15')][_0xea46('0x1d')](_0x5d2de1['body']);})[_0xea46('0xa')](function(_0x338e96){if(_0x11129d[_0xea46('0x1c')]&&fs['existsSync'](_0x338e96[_0xea46('0x1e')])){var _0x3cdf96=util[_0xea46('0x1f')]('%s.cypher',_0x338e96['value']);return _0x3b3928['encryptFile'](_0x338e96[_0xea46('0x1e')],_0x3cdf96,config[_0xea46('0x20')][_0xea46('0x21')])[_0xea46('0xa')](function(){fs[_0xea46('0x22')](_0x338e96[_0xea46('0x1e')]);logger[_0xea46('0x12')](_0xea46('0x23'));return _0x338e96;});}return _0x338e96;})[_0xea46('0xa')](function(_0x1c7201){logger[_0xea46('0x12')]('CreateVoiceRecording',_0x5d2de1);logger[_0xea46('0xc')](_0xea46('0x24'),_0x5d2de1,JSON[_0xea46('0xd')](_0x1c7201));_0x38ac07(_0x1c7201);})[_0xea46('0x14')](function(_0x1472c0){logger[_0xea46('0xe')](_0xea46('0x24'),_0x1472c0['message'],_0x5d2de1);_0x4b369c(_0x44e797[_0xea46('0xe')](0x1f4,_0x1472c0[_0xea46('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 5130884..adafbbc 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 _0xe07d=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','show','post','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x1276c9,_0x5f5565){var _0x5292a9=function(_0x2ec90d){while(--_0x2ec90d){_0x1276c9['push'](_0x1276c9['shift']());}};_0x5292a9(++_0x5f5565);}(_0xe07d,0x127));var _0xde07=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xe07d[_0x1f9f37];return _0x21c080;};'use strict';var multer=require(_0xde07('0x0'));var util=require(_0xde07('0x1'));var path=require(_0xde07('0x2'));var timeout=require(_0xde07('0x3'));var express=require(_0xde07('0x4'));var router=express[_0xde07('0x5')]();var fs_extra=require(_0xde07('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xde07('0x7'));var config=require(_0xde07('0x8'));var controller=require(_0xde07('0x9'));router[_0xde07('0xa')]('/',auth[_0xde07('0xb')](),controller['index']);router[_0xde07('0xa')](_0xde07('0xc'),auth[_0xde07('0xb')](),controller['describe']);router[_0xde07('0xa')]('/:id',auth[_0xde07('0xb')](),controller[_0xde07('0xd')]);router[_0xde07('0xe')]('/',auth[_0xde07('0xb')](),controller['create']);router[_0xde07('0xf')]('/:id',auth[_0xde07('0xb')](),controller[_0xde07('0x10')]);router[_0xde07('0x11')](_0xde07('0x12'),auth[_0xde07('0xb')](),controller[_0xde07('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa9ce=['put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x5c2fff,_0x1392d0){var _0x49ea84=function(_0x55a5d2){while(--_0x55a5d2){_0x5c2fff['push'](_0x5c2fff['shift']());}};_0x49ea84(++_0x1392d0);}(_0xa9ce,0xa3));var _0xea9c=function(_0x5bd9eb,_0x3b629b){_0x5bd9eb=_0x5bd9eb-0x0;var _0x1290ee=_0xa9ce[_0x5bd9eb];return _0x1290ee;};'use strict';var multer=require(_0xea9c('0x0'));var util=require('util');var path=require(_0xea9c('0x1'));var timeout=require(_0xea9c('0x2'));var express=require(_0xea9c('0x3'));var router=express[_0xea9c('0x4')]();var fs_extra=require(_0xea9c('0x5'));var auth=require(_0xea9c('0x6'));var interaction=require(_0xea9c('0x7'));var config=require('../../config/environment');var controller=require(_0xea9c('0x8'));router[_0xea9c('0x9')]('/',auth['isAuthenticated'](),controller[_0xea9c('0xa')]);router['get'](_0xea9c('0xb'),auth[_0xea9c('0xc')](),controller[_0xea9c('0xd')]);router['get'](_0xea9c('0xe'),auth['isAuthenticated'](),controller[_0xea9c('0xf')]);router[_0xea9c('0x10')]('/',auth[_0xea9c('0xc')](),controller['create']);router[_0xea9c('0x11')](_0xea9c('0xe'),auth[_0xea9c('0xc')](),controller[_0xea9c('0x12')]);router['delete'](_0xea9c('0xe'),auth['isAuthenticated'](),controller[_0xea9c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 703fa8e..10b5429 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 _0x6343=['exports','ENUM','STRING','Yes','moment'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0x6343,0x1e9));var _0x3634=function(_0x594820,_0xe972b){_0x594820=_0x594820-0x0;var _0xa37b5c=_0x6343[_0x594820];return _0xa37b5c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3634('0x0'));module[_0x3634('0x1')]={'type':{'type':Sequelize[_0x3634('0x2')]('blind','attended')},'result':{'type':Sequelize[_0x3634('0x3')]},'transfererchannel':{'type':Sequelize[_0x3634('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x3634('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x3634('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x3634('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x3634('0x3')]},'transfereechannel':{'type':Sequelize[_0x3634('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x3634('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x3634('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3634('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3634('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x3634('0x3')]},'transfereecontext':{'type':Sequelize[_0x3634('0x3')]},'transfereeexten':{'type':Sequelize[_0x3634('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x3634('0x3')]},'isexternal':{'type':Sequelize[_0x3634('0x2')](_0x3634('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc828=['attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x32d467,_0x3b6459){var _0x59a376=function(_0x128cb6){while(--_0x128cb6){_0x32d467['push'](_0x32d467['shift']());}};_0x59a376(++_0x3b6459);}(_0xc828,0x14c));var _0x8c82=function(_0xeb5eec,_0x4d641b){_0xeb5eec=_0xeb5eec-0x0;var _0x4ad861=_0xc828[_0xeb5eec];return _0x4ad861;};'use strict';var Sequelize=require(_0x8c82('0x0'));var moment=require(_0x8c82('0x1'));module[_0x8c82('0x2')]={'type':{'type':Sequelize[_0x8c82('0x3')]('blind',_0x8c82('0x4'))},'result':{'type':Sequelize[_0x8c82('0x5')]},'transfererchannel':{'type':Sequelize[_0x8c82('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8c82('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8c82('0x5')]},'transferercontext':{'type':Sequelize[_0x8c82('0x5')]},'transfererexten':{'type':Sequelize[_0x8c82('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x8c82('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8c82('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8c82('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8c82('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8c82('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8c82('0x5')]},'transfereeexten':{'type':Sequelize[_0x8c82('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8c82('0x5')]},'isexternal':{'type':Sequelize[_0x8c82('0x3')](_0x8c82('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8c82('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8d8551b..b7cac26 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 _0x1e88=['set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','VoiceTransferReport','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','intersection','find','update','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','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','sendStatus','end','status','json','undefined','count','limit'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1e88,0x153));var _0x81e8=function(_0x5c8841,_0x41cf8f){_0x5c8841=_0x5c8841-0x0;var _0x535bca=_0x1e88[_0x5c8841];return _0x535bca;};'use strict';var emlformat=require(_0x81e8('0x0'));var rimraf=require(_0x81e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x81e8('0x2'));var moment=require(_0x81e8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x81e8('0x4'));var util=require(_0x81e8('0x5'));var path=require('path');var sox=require(_0x81e8('0x6'));var csv=require('to-csv');var ejs=require(_0x81e8('0x7'));var fs=require('fs');var fs_extra=require(_0x81e8('0x8'));var _=require('lodash');var squel=require(_0x81e8('0x9'));var crypto=require('crypto');var jsforce=require(_0x81e8('0xa'));var deskjs=require(_0x81e8('0xb'));var toCsv=require(_0x81e8('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x81e8('0xd'));var authService=require(_0x81e8('0xe'));var qs=require(_0x81e8('0xf'));var as=require(_0x81e8('0x10'));var hardwareService=require(_0x81e8('0x11'));var logger=require(_0x81e8('0x12'))(_0x81e8('0x13'));var utils=require(_0x81e8('0x14'));var config=require(_0x81e8('0x15'));var licenseUtil=require(_0x81e8('0x16'));var db=require(_0x81e8('0x17'))['db'];function respondWithStatusCode(_0x57a4ee,_0x60ea16){_0x60ea16=_0x60ea16||0xcc;return function(_0x1aa7f1){if(_0x1aa7f1){return _0x57a4ee[_0x81e8('0x18')](_0x60ea16);}return _0x57a4ee['status'](_0x60ea16)[_0x81e8('0x19')]();};}function respondWithResult(_0x156418,_0x1c7552){_0x1c7552=_0x1c7552||0xc8;return function(_0x498f16){if(_0x498f16){return _0x156418[_0x81e8('0x1a')](_0x1c7552)[_0x81e8('0x1b')](_0x498f16);}};}function respondWithFilteredResult(_0x20594f,_0x40d08c){return function(_0x5ba9ad){if(_0x5ba9ad){var _0xff9cf8=typeof _0x40d08c['offset']===_0x81e8('0x1c')&&typeof _0x40d08c['limit']===_0x81e8('0x1c');var _0x3d2e19=_0x5ba9ad['count'];var _0x51b953=_0xff9cf8?0x0:_0x40d08c['offset'];var _0x5f54e3=_0xff9cf8?_0x5ba9ad[_0x81e8('0x1d')]:_0x40d08c['offset']+_0x40d08c[_0x81e8('0x1e')];var _0x44530e;if(_0x5f54e3>=_0x3d2e19){_0x5f54e3=_0x3d2e19;_0x44530e=0xc8;}else{_0x44530e=0xce;}_0x20594f[_0x81e8('0x1a')](_0x44530e);return _0x20594f[_0x81e8('0x1f')](_0x81e8('0x20'),_0x51b953+'-'+_0x5f54e3+'/'+_0x3d2e19)[_0x81e8('0x1b')](_0x5ba9ad);}return null;};}function patchUpdates(_0x5e00db){return function(_0x9d3c18){try{jsonpatch['apply'](_0x9d3c18,_0x5e00db,!![]);}catch(_0x29226e){return BPromise[_0x81e8('0x21')](_0x29226e);}return _0x9d3c18[_0x81e8('0x22')]();};}function saveUpdates(_0x90ac67,_0x5ae1b0){return function(_0x1675e1){if(_0x1675e1){return _0x1675e1['update'](_0x90ac67)[_0x81e8('0x23')](function(_0x58e3d2){return _0x58e3d2;});}return null;};}function removeEntity(_0x1b65e6,_0x1c1aee){return function(_0x2418f8){if(_0x2418f8){return _0x2418f8[_0x81e8('0x24')]()[_0x81e8('0x23')](function(){_0x1b65e6[_0x81e8('0x1a')](0xcc)[_0x81e8('0x19')]();});}};}function handleEntityNotFound(_0x1505e4,_0x36db94){return function(_0x16fad4){if(!_0x16fad4){_0x1505e4['sendStatus'](0x194);}return _0x16fad4;};}function handleError(_0xc9e59,_0x154258){_0x154258=_0x154258||0x1f4;return function(_0x1100cb){logger['error'](_0x1100cb[_0x81e8('0x25')]);if(_0x1100cb['name']){delete _0x1100cb[_0x81e8('0x26')];}_0xc9e59[_0x81e8('0x1a')](_0x154258)[_0x81e8('0x27')](_0x1100cb);};}exports[_0x81e8('0x28')]=function(_0x271296,_0xf90d48){var _0x4c1c3c={},_0x4a996f={},_0x3f657b={'count':0x0,'rows':[]};var _0x3b413a=_[_0x81e8('0x29')](db[_0x81e8('0x2a')]['rawAttributes'],function(_0xe2ce08){return{'name':_0xe2ce08['fieldName'],'type':_0xe2ce08[_0x81e8('0x2b')][_0x81e8('0x2c')]};});_0x4a996f['model']=_[_0x81e8('0x29')](_0x3b413a,'name');_0x4a996f[_0x81e8('0x2d')]=_[_0x81e8('0x2e')](_0x271296['query']);_0x4a996f[_0x81e8('0x2f')]=_['intersection'](_0x4a996f[_0x81e8('0x30')],_0x4a996f[_0x81e8('0x2d')]);_0x4c1c3c[_0x81e8('0x31')]=_['intersection'](_0x4a996f[_0x81e8('0x30')],qs[_0x81e8('0x32')](_0x271296[_0x81e8('0x2d')]['fields']));_0x4c1c3c[_0x81e8('0x31')]=_0x4c1c3c[_0x81e8('0x31')][_0x81e8('0x33')]?_0x4c1c3c[_0x81e8('0x31')]:_0x4a996f[_0x81e8('0x30')];if(!_0x271296[_0x81e8('0x2d')][_0x81e8('0x34')](_0x81e8('0x35'))){_0x4c1c3c[_0x81e8('0x1e')]=qs['limit'](_0x271296[_0x81e8('0x2d')]['limit']);_0x4c1c3c['offset']=qs['offset'](_0x271296['query'][_0x81e8('0x36')]);}_0x4c1c3c[_0x81e8('0x37')]=qs['sort'](_0x271296[_0x81e8('0x2d')][_0x81e8('0x38')]);_0x4c1c3c[_0x81e8('0x39')]=qs[_0x81e8('0x2f')](_[_0x81e8('0x3a')](_0x271296[_0x81e8('0x2d')],_0x4a996f['filters']),_0x3b413a);if(_0x271296[_0x81e8('0x2d')][_0x81e8('0x3b')]){_0x4c1c3c[_0x81e8('0x39')]=_['merge'](_0x4c1c3c['where'],{'$or':_[_0x81e8('0x29')](_0x3b413a,function(_0x5763cb){if(_0x5763cb[_0x81e8('0x2b')]!==_0x81e8('0x3c')){var _0x3cdd60={};_0x3cdd60[_0x5763cb[_0x81e8('0x26')]]={'$like':'%'+_0x271296[_0x81e8('0x2d')][_0x81e8('0x3b')]+'%'};return _0x3cdd60;}})});}_0x4c1c3c=_[_0x81e8('0x3d')]({},_0x4c1c3c,_0x271296[_0x81e8('0x3e')]);var _0x40539d={'where':_0x4c1c3c['where']};return db[_0x81e8('0x2a')][_0x81e8('0x1d')](_0x40539d)[_0x81e8('0x23')](function(_0x3fd51b){_0x3f657b[_0x81e8('0x1d')]=_0x3fd51b;if(_0x271296['query'][_0x81e8('0x3f')]){_0x4c1c3c[_0x81e8('0x40')]=[{'all':!![]}];}return db[_0x81e8('0x2a')][_0x81e8('0x41')](_0x4c1c3c);})[_0x81e8('0x23')](function(_0x46dfa8){_0x3f657b['rows']=_0x46dfa8;return _0x3f657b;})[_0x81e8('0x23')](respondWithFilteredResult(_0xf90d48,_0x4c1c3c))[_0x81e8('0x42')](handleError(_0xf90d48,null));};exports['show']=function(_0x27751e,_0x1fa0eb){var _0x1610a3={'raw':!![],'where':{'id':_0x27751e[_0x81e8('0x43')]['id']}},_0x342bc2={};_0x342bc2[_0x81e8('0x30')]=_[_0x81e8('0x2e')](db[_0x81e8('0x2a')][_0x81e8('0x44')]);_0x342bc2[_0x81e8('0x2d')]=_['keys'](_0x27751e[_0x81e8('0x2d')]);_0x342bc2[_0x81e8('0x2f')]=_[_0x81e8('0x45')](_0x342bc2[_0x81e8('0x30')],_0x342bc2[_0x81e8('0x2d')]);_0x1610a3['attributes']=_[_0x81e8('0x45')](_0x342bc2[_0x81e8('0x30')],qs[_0x81e8('0x32')](_0x27751e[_0x81e8('0x2d')]['fields']));_0x1610a3[_0x81e8('0x31')]=_0x1610a3[_0x81e8('0x31')][_0x81e8('0x33')]?_0x1610a3[_0x81e8('0x31')]:_0x342bc2[_0x81e8('0x30')];if(_0x27751e[_0x81e8('0x2d')]['includeAll']){_0x1610a3[_0x81e8('0x40')]=[{'all':!![]}];}_0x1610a3=_['merge']({},_0x1610a3,_0x27751e[_0x81e8('0x3e')]);return db['VoiceTransferReport'][_0x81e8('0x46')](_0x1610a3)[_0x81e8('0x23')](handleEntityNotFound(_0x1fa0eb,null))[_0x81e8('0x23')](respondWithResult(_0x1fa0eb,null))[_0x81e8('0x42')](handleError(_0x1fa0eb,null));};exports['create']=function(_0x1565ec,_0x1c9455){return db['VoiceTransferReport']['create'](_0x1565ec['body'],{})[_0x81e8('0x23')](respondWithResult(_0x1c9455,0xc9))['catch'](handleError(_0x1c9455,null));};exports[_0x81e8('0x47')]=function(_0x656712,_0x8e5dd3){if(_0x656712[_0x81e8('0x48')]['id']){delete _0x656712['body']['id'];}return db['VoiceTransferReport'][_0x81e8('0x46')]({'where':{'id':_0x656712['params']['id']}})[_0x81e8('0x23')](handleEntityNotFound(_0x8e5dd3,null))[_0x81e8('0x23')](saveUpdates(_0x656712[_0x81e8('0x48')],null))[_0x81e8('0x23')](respondWithResult(_0x8e5dd3,null))[_0x81e8('0x42')](handleError(_0x8e5dd3,null));};exports[_0x81e8('0x24')]=function(_0x1ff741,_0x50d9da){return db[_0x81e8('0x2a')][_0x81e8('0x46')]({'where':{'id':_0x1ff741[_0x81e8('0x43')]['id']}})[_0x81e8('0x23')](handleEntityNotFound(_0x50d9da,null))['then'](removeEntity(_0x50d9da,null))[_0x81e8('0x42')](handleError(_0x50d9da,null));};exports[_0x81e8('0x49')]=function(_0x18e4cd,_0x28dd99){return db['VoiceTransferReport'][_0x81e8('0x49')]()['then'](respondWithResult(_0x28dd99,null))[_0x81e8('0x42')](handleError(_0x28dd99,null));}; \ No newline at end of file +var _0xbbbf=['name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','find','describe','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','error'];(function(_0x21cbcd,_0x4ba851){var _0x59a138=function(_0x28accd){while(--_0x28accd){_0x21cbcd['push'](_0x21cbcd['shift']());}};_0x59a138(++_0x4ba851);}(_0xbbbf,0x1c5));var _0xfbbb=function(_0x221972,_0xa3bdb6){_0x221972=_0x221972-0x0;var _0x2c6eac=_0xbbbf[_0x221972];return _0x2c6eac;};'use strict';var emlformat=require(_0xfbbb('0x0'));var rimraf=require(_0xfbbb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfbbb('0x2'));var moment=require(_0xfbbb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfbbb('0x4'));var util=require('util');var path=require(_0xfbbb('0x5'));var sox=require(_0xfbbb('0x6'));var csv=require(_0xfbbb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbbb('0x8'));var _=require(_0xfbbb('0x9'));var squel=require(_0xfbbb('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfbbb('0xb'));var toCsv=require(_0xfbbb('0x7'));var querystring=require('querystring');var Papa=require(_0xfbbb('0xc'));var Redis=require(_0xfbbb('0xd'));var authService=require(_0xfbbb('0xe'));var qs=require(_0xfbbb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbbb('0x10'));var logger=require('../../config/logger')(_0xfbbb('0x11'));var utils=require(_0xfbbb('0x12'));var config=require(_0xfbbb('0x13'));var licenseUtil=require(_0xfbbb('0x14'));var db=require(_0xfbbb('0x15'))['db'];function respondWithStatusCode(_0x63794,_0x33efb5){_0x33efb5=_0x33efb5||0xcc;return function(_0xee4885){if(_0xee4885){return _0x63794[_0xfbbb('0x16')](_0x33efb5);}return _0x63794[_0xfbbb('0x17')](_0x33efb5)[_0xfbbb('0x18')]();};}function respondWithResult(_0x2c0816,_0x8a7b13){_0x8a7b13=_0x8a7b13||0xc8;return function(_0x5ce9b2){if(_0x5ce9b2){return _0x2c0816[_0xfbbb('0x17')](_0x8a7b13)['json'](_0x5ce9b2);}};}function respondWithFilteredResult(_0x22ba92,_0x392727){return function(_0x5b971b){if(_0x5b971b){var _0x51d91b=typeof _0x392727['offset']===_0xfbbb('0x19')&&typeof _0x392727[_0xfbbb('0x1a')]===_0xfbbb('0x19');var _0x558f2f=_0x5b971b[_0xfbbb('0x1b')];var _0x221710=_0x51d91b?0x0:_0x392727[_0xfbbb('0x1c')];var _0x2f3091=_0x51d91b?_0x5b971b[_0xfbbb('0x1b')]:_0x392727[_0xfbbb('0x1c')]+_0x392727[_0xfbbb('0x1a')];var _0x427655;if(_0x2f3091>=_0x558f2f){_0x2f3091=_0x558f2f;_0x427655=0xc8;}else{_0x427655=0xce;}_0x22ba92[_0xfbbb('0x17')](_0x427655);return _0x22ba92['set'](_0xfbbb('0x1d'),_0x221710+'-'+_0x2f3091+'/'+_0x558f2f)[_0xfbbb('0x1e')](_0x5b971b);}return null;};}function patchUpdates(_0x3d5f34){return function(_0x4e5959){try{jsonpatch[_0xfbbb('0x1f')](_0x4e5959,_0x3d5f34,!![]);}catch(_0x5930e5){return BPromise[_0xfbbb('0x20')](_0x5930e5);}return _0x4e5959[_0xfbbb('0x21')]();};}function saveUpdates(_0x136aaf,_0x5a8e89){return function(_0x385d4c){if(_0x385d4c){return _0x385d4c[_0xfbbb('0x22')](_0x136aaf)[_0xfbbb('0x23')](function(_0x3c9eca){return _0x3c9eca;});}return null;};}function removeEntity(_0x7bc943,_0xbe4e0){return function(_0x3df0d8){if(_0x3df0d8){return _0x3df0d8['destroy']()[_0xfbbb('0x23')](function(){_0x7bc943['status'](0xcc)[_0xfbbb('0x18')]();});}};}function handleEntityNotFound(_0x2b7895,_0x3ff883){return function(_0x83748d){if(!_0x83748d){_0x2b7895[_0xfbbb('0x16')](0x194);}return _0x83748d;};}function handleError(_0xa925cf,_0xf87ee0){_0xf87ee0=_0xf87ee0||0x1f4;return function(_0x5a06f5){logger[_0xfbbb('0x24')](_0x5a06f5['stack']);if(_0x5a06f5[_0xfbbb('0x25')]){delete _0x5a06f5[_0xfbbb('0x25')];}_0xa925cf[_0xfbbb('0x17')](_0xf87ee0)[_0xfbbb('0x26')](_0x5a06f5);};}exports[_0xfbbb('0x27')]=function(_0x1a3583,_0x4eeb25){var _0x5be58b={},_0x174f27={},_0x55a1fb={'count':0x0,'rows':[]};var _0x25653f=_['map'](db[_0xfbbb('0x28')][_0xfbbb('0x29')],function(_0x45f64d){return{'name':_0x45f64d[_0xfbbb('0x2a')],'type':_0x45f64d[_0xfbbb('0x2b')]['key']};});_0x174f27['model']=_[_0xfbbb('0x2c')](_0x25653f,_0xfbbb('0x25'));_0x174f27[_0xfbbb('0x2d')]=_[_0xfbbb('0x2e')](_0x1a3583['query']);_0x174f27[_0xfbbb('0x2f')]=_[_0xfbbb('0x30')](_0x174f27[_0xfbbb('0x31')],_0x174f27['query']);_0x5be58b[_0xfbbb('0x32')]=_[_0xfbbb('0x30')](_0x174f27['model'],qs[_0xfbbb('0x33')](_0x1a3583[_0xfbbb('0x2d')][_0xfbbb('0x33')]));_0x5be58b[_0xfbbb('0x32')]=_0x5be58b['attributes']['length']?_0x5be58b['attributes']:_0x174f27[_0xfbbb('0x31')];if(!_0x1a3583[_0xfbbb('0x2d')][_0xfbbb('0x34')](_0xfbbb('0x35'))){_0x5be58b['limit']=qs['limit'](_0x1a3583[_0xfbbb('0x2d')][_0xfbbb('0x1a')]);_0x5be58b[_0xfbbb('0x1c')]=qs[_0xfbbb('0x1c')](_0x1a3583[_0xfbbb('0x2d')][_0xfbbb('0x1c')]);}_0x5be58b[_0xfbbb('0x36')]=qs[_0xfbbb('0x37')](_0x1a3583[_0xfbbb('0x2d')][_0xfbbb('0x37')]);_0x5be58b[_0xfbbb('0x38')]=qs['filters'](_['pick'](_0x1a3583[_0xfbbb('0x2d')],_0x174f27[_0xfbbb('0x2f')]),_0x25653f);if(_0x1a3583[_0xfbbb('0x2d')][_0xfbbb('0x39')]){_0x5be58b['where']=_[_0xfbbb('0x3a')](_0x5be58b[_0xfbbb('0x38')],{'$or':_[_0xfbbb('0x2c')](_0x25653f,function(_0x10df66){if(_0x10df66['type']!==_0xfbbb('0x3b')){var _0x5e1780={};_0x5e1780[_0x10df66[_0xfbbb('0x25')]]={'$like':'%'+_0x1a3583['query']['filter']+'%'};return _0x5e1780;}})});}_0x5be58b=_[_0xfbbb('0x3a')]({},_0x5be58b,_0x1a3583['options']);var _0xab7598={'where':_0x5be58b[_0xfbbb('0x38')]};return db[_0xfbbb('0x28')][_0xfbbb('0x1b')](_0xab7598)[_0xfbbb('0x23')](function(_0xb949e5){_0x55a1fb[_0xfbbb('0x1b')]=_0xb949e5;if(_0x1a3583[_0xfbbb('0x2d')][_0xfbbb('0x3c')]){_0x5be58b[_0xfbbb('0x3d')]=[{'all':!![]}];}return db[_0xfbbb('0x28')][_0xfbbb('0x3e')](_0x5be58b);})[_0xfbbb('0x23')](function(_0x4628cb){_0x55a1fb['rows']=_0x4628cb;return _0x55a1fb;})['then'](respondWithFilteredResult(_0x4eeb25,_0x5be58b))[_0xfbbb('0x3f')](handleError(_0x4eeb25,null));};exports['show']=function(_0x4fb9b6,_0x302233){var _0x16d03b={'raw':!![],'where':{'id':_0x4fb9b6[_0xfbbb('0x40')]['id']}},_0x206173={};_0x206173[_0xfbbb('0x31')]=_['keys'](db[_0xfbbb('0x28')][_0xfbbb('0x29')]);_0x206173[_0xfbbb('0x2d')]=_[_0xfbbb('0x2e')](_0x4fb9b6[_0xfbbb('0x2d')]);_0x206173['filters']=_[_0xfbbb('0x30')](_0x206173[_0xfbbb('0x31')],_0x206173[_0xfbbb('0x2d')]);_0x16d03b[_0xfbbb('0x32')]=_[_0xfbbb('0x30')](_0x206173['model'],qs[_0xfbbb('0x33')](_0x4fb9b6[_0xfbbb('0x2d')][_0xfbbb('0x33')]));_0x16d03b[_0xfbbb('0x32')]=_0x16d03b[_0xfbbb('0x32')]['length']?_0x16d03b[_0xfbbb('0x32')]:_0x206173[_0xfbbb('0x31')];if(_0x4fb9b6[_0xfbbb('0x2d')][_0xfbbb('0x3c')]){_0x16d03b[_0xfbbb('0x3d')]=[{'all':!![]}];}_0x16d03b=_[_0xfbbb('0x3a')]({},_0x16d03b,_0x4fb9b6[_0xfbbb('0x41')]);return db[_0xfbbb('0x28')]['find'](_0x16d03b)['then'](handleEntityNotFound(_0x302233,null))[_0xfbbb('0x23')](respondWithResult(_0x302233,null))[_0xfbbb('0x3f')](handleError(_0x302233,null));};exports['create']=function(_0x32fb35,_0x519bd7){return db[_0xfbbb('0x28')][_0xfbbb('0x42')](_0x32fb35['body'],{})[_0xfbbb('0x23')](respondWithResult(_0x519bd7,0xc9))[_0xfbbb('0x3f')](handleError(_0x519bd7,null));};exports[_0xfbbb('0x22')]=function(_0x1adc3,_0xb13d26){if(_0x1adc3[_0xfbbb('0x43')]['id']){delete _0x1adc3[_0xfbbb('0x43')]['id'];}return db[_0xfbbb('0x28')][_0xfbbb('0x44')]({'where':{'id':_0x1adc3['params']['id']}})[_0xfbbb('0x23')](handleEntityNotFound(_0xb13d26,null))[_0xfbbb('0x23')](saveUpdates(_0x1adc3['body'],null))['then'](respondWithResult(_0xb13d26,null))[_0xfbbb('0x3f')](handleError(_0xb13d26,null));};exports['destroy']=function(_0x2a3a19,_0x2e630c){return db['VoiceTransferReport']['find']({'where':{'id':_0x2a3a19[_0xfbbb('0x40')]['id']}})[_0xfbbb('0x23')](handleEntityNotFound(_0x2e630c,null))['then'](removeEntity(_0x2e630c,null))[_0xfbbb('0x3f')](handleError(_0x2e630c,null));};exports['describe']=function(_0x4d610b,_0x3e380d){return db[_0xfbbb('0x28')][_0xfbbb('0x45')]()['then'](respondWithResult(_0x3e380d,null))[_0xfbbb('0x3f')](handleError(_0x3e380d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d6401f9..a82e888 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 _0xd5d5=['api','moment','request-promise','path','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x286822,_0x5b5f44){var _0x14c777=function(_0x2015af){while(--_0x2015af){_0x286822['push'](_0x286822['shift']());}};_0x14c777(++_0x5b5f44);}(_0xd5d5,0x135));var _0x5d5d=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0xd5d5[_0x4ed32d];return _0xf624df;};'use strict';var _=require(_0x5d5d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5d5d('0x1'));var moment=require(_0x5d5d('0x2'));var BPromise=require('bluebird');var rp=require(_0x5d5d('0x3'));var fs=require('fs');var path=require(_0x5d5d('0x4'));var rimraf=require('rimraf');var config=require(_0x5d5d('0x5'));var attributes=require('./voiceTransferReport.attributes');module[_0x5d5d('0x6')]=function(_0x1090c7,_0x1f3383){return _0x1090c7[_0x5d5d('0x7')](_0x5d5d('0x8'),attributes,{'tableName':_0x5d5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a83=['../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x56ab45,_0x282dfd){var _0x5a27c5=function(_0x2a040e){while(--_0x2a040e){_0x56ab45['push'](_0x56ab45['shift']());}};_0x5a27c5(++_0x282dfd);}(_0x7a83,0x17f));var _0x37a8=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x7a83[_0x1305e3];return _0x1068e9;};'use strict';var _=require(_0x37a8('0x0'));var util=require(_0x37a8('0x1'));var logger=require(_0x37a8('0x2'))(_0x37a8('0x3'));var moment=require(_0x37a8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37a8('0x5'));var rimraf=require(_0x37a8('0x6'));var config=require(_0x37a8('0x7'));var attributes=require(_0x37a8('0x8'));module['exports']=function(_0x33d8c8,_0x52c6c1){return _0x33d8c8['define'](_0x37a8('0x9'),attributes,{'tableName':_0x37a8('0xa'),'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 a55ef97..04fd878 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 _0xeda2=['raw','then','CreateVoiceTransferReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','catch','VoiceTransferReport','create','body','options'];(function(_0x3c0b58,_0x1deb43){var _0x1854ee=function(_0x5d4a02){while(--_0x5d4a02){_0x3c0b58['push'](_0x3c0b58['shift']());}};_0x1854ee(++_0x1deb43);}(_0xeda2,0x1c5));var _0x2eda=function(_0x5c908c,_0x4bcfab){_0x5c908c=_0x5c908c-0x0;var _0x39325f=_0xeda2[_0x5c908c];return _0x39325f;};'use strict';var _=require(_0x2eda('0x0'));var util=require(_0x2eda('0x1'));var moment=require('moment');var BPromise=require(_0x2eda('0x2'));var rs=require(_0x2eda('0x3'));var fs=require('fs');var Redis=require(_0x2eda('0x4'));var db=require(_0x2eda('0x5'))['db'];var utils=require(_0x2eda('0x6'));var logger=require(_0x2eda('0x7'))(_0x2eda('0x8'));var config=require(_0x2eda('0x9'));var jayson=require(_0x2eda('0xa'));var client=jayson[_0x2eda('0xb')][_0x2eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x255401,_0x7ea3fb,_0x57741b){return new BPromise(function(_0x51990b,_0x35e2cf){return client[_0x2eda('0xd')](_0x255401,_0x57741b)['then'](function(_0x3cf23f){logger[_0x2eda('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x7ea3fb,_0x2eda('0xf'));logger[_0x2eda('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x7ea3fb,'request\x20sent',JSON[_0x2eda('0x11')](_0x3cf23f));if(_0x3cf23f['error']){if(_0x3cf23f[_0x2eda('0x12')][_0x2eda('0x13')]===0x1f4){logger[_0x2eda('0x12')](_0x2eda('0x14'),_0x7ea3fb,_0x3cf23f[_0x2eda('0x12')]['message']);return _0x35e2cf(_0x3cf23f[_0x2eda('0x12')][_0x2eda('0x15')]);}logger[_0x2eda('0x12')](_0x2eda('0x14'),_0x7ea3fb,_0x3cf23f[_0x2eda('0x12')][_0x2eda('0x15')]);return _0x51990b(_0x3cf23f[_0x2eda('0x12')][_0x2eda('0x15')]);}else{logger[_0x2eda('0xe')](_0x2eda('0x14'),_0x7ea3fb,_0x2eda('0xf'));_0x51990b(_0x3cf23f['result'][_0x2eda('0x15')]);}})[_0x2eda('0x16')](function(_0x321955){logger[_0x2eda('0x12')](_0x2eda('0x14'),_0x7ea3fb,_0x321955);_0x35e2cf(_0x321955);});});}exports['CreateVoiceTransferReport']=function(_0x337648){var _0x196cc8=this;return new Promise(function(_0x503c2f,_0x2c1e5e){return db[_0x2eda('0x17')][_0x2eda('0x18')](_0x337648[_0x2eda('0x19')],{'raw':_0x337648['options']?_0x337648[_0x2eda('0x1a')][_0x2eda('0x1b')]===undefined?!![]:![]:!![]})[_0x2eda('0x1c')](function(_0x3f8d6a){logger[_0x2eda('0xe')](_0x2eda('0x1d'),_0x337648);logger['debug'](_0x2eda('0x1d'),_0x337648,JSON[_0x2eda('0x11')](_0x3f8d6a));_0x503c2f(_0x3f8d6a);})[_0x2eda('0x16')](function(_0x17424c){logger[_0x2eda('0x12')](_0x2eda('0x1d'),_0x17424c[_0x2eda('0x15')],_0x337648);_0x2c1e5e(_0x196cc8[_0x2eda('0x12')](0x1f4,_0x17424c['message']));});});}; \ No newline at end of file +var _0x925d=['stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','bluebird','randomstring','../../config/utils','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x925d,0x12a));var _0xd925=function(_0x28f23e,_0x127c90){_0x28f23e=_0x28f23e-0x0;var _0x22e8d2=_0x925d[_0x28f23e];return _0x22e8d2;};'use strict';var _=require(_0xd925('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd925('0x1'));var rs=require(_0xd925('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd925('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd925('0x4'));var client=jayson[_0xd925('0x5')][_0xd925('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x113343,_0x37e047,_0x5e7915){return new BPromise(function(_0x416b26,_0xd8055b){return client[_0xd925('0x7')](_0x113343,_0x5e7915)[_0xd925('0x8')](function(_0x1bc76f){logger[_0xd925('0x9')](_0xd925('0xa'),_0x37e047,'request\x20sent');logger[_0xd925('0xb')](_0xd925('0xc'),_0x37e047,_0xd925('0xd'),JSON[_0xd925('0xe')](_0x1bc76f));if(_0x1bc76f[_0xd925('0xf')]){if(_0x1bc76f[_0xd925('0xf')][_0xd925('0x10')]===0x1f4){logger[_0xd925('0xf')](_0xd925('0xa'),_0x37e047,_0x1bc76f[_0xd925('0xf')][_0xd925('0x11')]);return _0xd8055b(_0x1bc76f[_0xd925('0xf')]['message']);}logger[_0xd925('0xf')](_0xd925('0xa'),_0x37e047,_0x1bc76f['error'][_0xd925('0x11')]);return _0x416b26(_0x1bc76f[_0xd925('0xf')][_0xd925('0x11')]);}else{logger['info'](_0xd925('0xa'),_0x37e047,_0xd925('0xd'));_0x416b26(_0x1bc76f[_0xd925('0x12')][_0xd925('0x11')]);}})[_0xd925('0x13')](function(_0x8c535f){logger[_0xd925('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x37e047,_0x8c535f);_0xd8055b(_0x8c535f);});});}exports[_0xd925('0x14')]=function(_0x1c0fdf){var _0x6ce74f=this;return new Promise(function(_0x49240f,_0x46c9f3){return db[_0xd925('0x15')][_0xd925('0x16')](_0x1c0fdf['body'],{'raw':_0x1c0fdf[_0xd925('0x17')]?_0x1c0fdf[_0xd925('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x203237){logger[_0xd925('0x9')](_0xd925('0x14'),_0x1c0fdf);logger[_0xd925('0xb')](_0xd925('0x14'),_0x1c0fdf,JSON[_0xd925('0xe')](_0x203237));_0x49240f(_0x203237);})[_0xd925('0x13')](function(_0x2a41fb){logger[_0xd925('0xf')]('CreateVoiceTransferReport',_0x2a41fb[_0xd925('0x11')],_0x1c0fdf);_0x46c9f3(_0x6ce74f['error'](0x1f4,_0x2a41fb[_0xd925('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6512305..a9d9e12 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 _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x3a964c,_0x471d85){var _0x2a60c0=function(_0x7f4f2f){while(--_0x7f4f2f){_0x3a964c['push'](_0x3a964c['shift']());}};_0x2a60c0(++_0x471d85);}(_0xdace,0xc5));var _0xedac=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xdace[_0x120376];return _0x28c529;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file +var _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x49482e,_0x5800e5){var _0x18fd01=function(_0x20011d){while(--_0x20011d){_0x49482e['push'](_0x49482e['shift']());}};_0x18fd01(++_0x5800e5);}(_0x9f62,0x154));var _0x29f6=function(_0x228ca3,_0x41129c){_0x228ca3=_0x228ca3-0x0;var _0x1f8003=_0x9f62[_0x228ca3];return _0x1f8003;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 10aa1d2..2b84c76 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 _0xee24=['stack','name','status','send','NotFound','then','code','message','User','findOne','agent','rows','UserId','sessionId','length','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','info','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error'];(function(_0x16fd4c,_0x1eee83){var _0x44711c=function(_0x5b3b12){while(--_0x5b3b12){_0x16fd4c['push'](_0x16fd4c['shift']());}};_0x44711c(++_0x1eee83);}(_0xee24,0x1a6));var _0x4ee2=function(_0x34fd6a,_0x5305ed){_0x34fd6a=_0x34fd6a-0x0;var _0xa1805f=_0xee24[_0x34fd6a];return _0xa1805f;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x4ee2('0x0'));var db=require(_0x4ee2('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var jayson=require(_0x4ee2('0x4'));var amiClient=jayson[_0x4ee2('0x5')]['http']({'port':0x232a});var logger=require(_0x4ee2('0x6'))(_0x4ee2('0x7'));var Redis=require(_0x4ee2('0x8'));config[_0x4ee2('0x9')]=_['defaults'](config[_0x4ee2('0x9')],{'host':_0x4ee2('0xa'),'port':0x18eb});var io=require(_0x4ee2('0xb'))(new Redis(config[_0x4ee2('0x9')]));var Schema=require(_0x4ee2('0xc'));var originateValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'callNumber':{'type':_0x4ee2('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4ee2('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x4ee2('0xf'),'required':[!![],_0x4ee2('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4ee2('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]}});function emit(_0x1b95c5,_0x14bc72,_0x3b742c){logger['info'](_0x1b95c5,_0x14bc72,JSON[_0x4ee2('0x11')](_0x3b742c));io['to'](_0x1b95c5)[_0x4ee2('0x12')](_0x14bc72,_0x3b742c);}function handleError(_0x3d0308){return function(_0x4aba2b){console[_0x4ee2('0x13')](_0x4ee2('0x14'),_0x4aba2b,_0x4aba2b instanceof RangeError);logger[_0x4ee2('0x15')](_0x4aba2b[_0x4ee2('0x16')]);if(_0x4aba2b instanceof RangeError){if(_0x4aba2b[_0x4ee2('0x17')]){delete _0x4aba2b[_0x4ee2('0x17')];}_0x3d0308[_0x4ee2('0x18')](0x194)[_0x4ee2('0x19')](_0x4aba2b);}else{if(_0x4aba2b['name']){delete _0x4aba2b['name'];}_0x3d0308[_0x4ee2('0x18')](0x1f4)['send'](_0x4aba2b);}};}function checkError(){return function(_0x34c281){if(!_0x34c281){throw new RangeError(_0x4ee2('0x1a'));}return _0x34c281;};}function respondWithRpcPromise(_0x1d9a37,_0x416a78){return new BPromise(function(_0x4507d6,_0x53f246){var _0x1d5037=amiClient;return _0x1d5037['request'](_0x1d9a37,_0x416a78)[_0x4ee2('0x1b')](function(_0x3e6344){if(_0x3e6344[_0x4ee2('0x15')]){if(_0x3e6344[_0x4ee2('0x15')][_0x4ee2('0x1c')]===0x1f4){return _0x53f246(_0x3e6344[_0x4ee2('0x15')][_0x4ee2('0x1d')]);}return _0x4507d6(_0x3e6344['error'][_0x4ee2('0x1d')]);}else{_0x4507d6(_0x3e6344['result']);}})['catch'](function(_0xebd95f){_0x53f246(_0xebd95f);});});}function getAgent(_0x291734){return db[_0x4ee2('0x1e')][_0x4ee2('0x1f')]({'where':{'id':_0x291734,'role':_0x4ee2('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x50005e,_0x404fba){return new BPromise(function(_0x2a078f,_0x562a4d){var _0x2fe02a=respondWithRpcPromise('VoiceChannels');var _0x49b1be=getAgent(_0x50005e);Promise['all']([_0x2fe02a,_0x49b1be])[_0x4ee2('0x1b')](function(_0x970fa6){var _0x50da2d=_0x970fa6[0x0];var _0x3f68b9=_0x970fa6[0x1];var _0x6775f7=_['filter'](_0x50da2d[_0x4ee2('0x21')],function(_0x4bf072){return _0x4bf072[_0x4ee2('0x22')]==_0x3f68b9['id']&&_0x4bf072[_0x4ee2('0x23')]==_0x404fba;});if(_0x6775f7[_0x4ee2('0x24')]==0x1){_0x2a078f(_0x3f68b9);}else{_0x562a4d(new RangeError('sessionId\x20'+_0x404fba+'\x20not\x20found!'));}});});}exports[_0x4ee2('0x25')]=function(_0x14f164,_0x3ab2a1){logger['info'](_0x4ee2('0x26'),_0x14f164[_0x4ee2('0x27')]);var _0x1fca9f=originateValidation[_0x4ee2('0xc')](_0x14f164[_0x4ee2('0x27')]);if(_0x1fca9f[_0x4ee2('0x24')]>0x0){return _0x3ab2a1[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x1fca9f);}var _0x256bea=_0x14f164[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0x25db8f=_0x14f164['body'][_0x4ee2('0x2a')];var _0x287ff3=_0x14f164['body'][_0x4ee2('0x2b')];var _0x21968c=_0x14f164[_0x4ee2('0x27')][_0x4ee2('0x2c')];return getAgent(_0x256bea)[_0x4ee2('0x1b')](function(_0x429a90){logger[_0x4ee2('0x2d')]('entityFound:',_0x429a90[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x429a90['name']),_0x4ee2('0x30'),{'callNumber':_0x25db8f,'callerId':_0x287ff3,'callbackUrl':_0x21968c});return _0x3ab2a1['status'](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x31')});})[_0x4ee2('0x32')](handleError(_0x3ab2a1));};exports[_0x4ee2('0x33')]=function(_0x3c7282,_0x52fa55){logger['info']('hangup\x20fired:',_0x3c7282[_0x4ee2('0x27')]);var _0x3f2c6a=hangupValidation[_0x4ee2('0xc')](_0x3c7282[_0x4ee2('0x27')]);if(_0x3f2c6a[_0x4ee2('0x24')]>0x0){return _0x52fa55[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x3f2c6a);}var _0x29c4b3=_0x3c7282[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0x57b506=_0x3c7282['body'][_0x4ee2('0x23')];return getAgent(_0x29c4b3)[_0x4ee2('0x1b')](function(_0x1255ff){logger['info'](_0x4ee2('0x34'),_0x1255ff[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x1255ff[_0x4ee2('0x17')]),_0x4ee2('0x35'),{'sessionId':_0x57b506});return _0x52fa55[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x36')});})[_0x4ee2('0x32')](handleError(_0x52fa55));};exports['answer']=function(_0x5d4395,_0x3e7f65){logger[_0x4ee2('0x2d')](_0x4ee2('0x37'),_0x5d4395['body']);var _0x1ef1d5=answerValidation['validate'](_0x5d4395[_0x4ee2('0x27')]);if(_0x1ef1d5['length']>0x0){return _0x3e7f65[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x1ef1d5);}var _0x41607a=_0x5d4395['body'][_0x4ee2('0x29')];var _0x4e7a92=_0x5d4395[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x41607a)[_0x4ee2('0x1b')](function(_0x38a25a){logger['info'](_0x4ee2('0x34'),_0x38a25a[_0x4ee2('0x17')]);emit(util['format'](_0x4ee2('0x2f'),_0x38a25a['name']),'webbar:answer',{'sessionId':_0x4e7a92});return _0x3e7f65[_0x4ee2('0x18')](0xc8)['json']({'error':![],'message':_0x4ee2('0x38')});})['catch'](handleError(_0x3e7f65));};exports[_0x4ee2('0x39')]=function(_0x4641b8,_0x39237a){logger['info'](_0x4ee2('0x3a'),_0x4641b8[_0x4ee2('0x27')]);var _0x44ada1=holdValidation[_0x4ee2('0xc')](_0x4641b8[_0x4ee2('0x27')]);if(_0x44ada1['length']>0x0){return _0x39237a[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x44ada1);}var _0x535c11=_0x4641b8['body'][_0x4ee2('0x29')];var _0x54e734=_0x4641b8[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x535c11)['then'](function(_0x43ca98){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x43ca98['name']);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x43ca98['name']),'webbar:hold',{'sessionId':_0x54e734});return _0x39237a['status'](0xc8)['json']({'error':![],'message':_0x4ee2('0x3b')});})[_0x4ee2('0x32')](handleError(_0x39237a));};exports['unhold']=function(_0x1379c0,_0x3d25fb){logger[_0x4ee2('0x2d')](_0x4ee2('0x3c'),_0x1379c0[_0x4ee2('0x27')]);var _0x152519=unholdValidation[_0x4ee2('0xc')](_0x1379c0['body']);if(_0x152519[_0x4ee2('0x24')]>0x0){return _0x3d25fb['status'](0x190)[_0x4ee2('0x28')](_0x152519);}var _0x14a86d=_0x1379c0[_0x4ee2('0x27')]['userId'];var _0x386a59=_0x1379c0[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x14a86d)['then'](function(_0x53a6c8){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x53a6c8[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')]('user:%s',_0x53a6c8[_0x4ee2('0x17')]),_0x4ee2('0x3d'),{'sessionId':_0x386a59});return _0x3d25fb[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x3e')});})[_0x4ee2('0x32')](handleError(_0x3d25fb));};exports[_0x4ee2('0x3f')]=function(_0x3c65ca,_0x279c28){logger[_0x4ee2('0x2d')](_0x4ee2('0x40'),_0x279c28[_0x4ee2('0x27')]);var _0x58dac3=callsValidation['validate'](_0x3c65ca[_0x4ee2('0x27')]);if(_0x58dac3[_0x4ee2('0x24')]>0x0){return _0x279c28[_0x4ee2('0x18')](0x190)['json'](_0x58dac3);}var _0x578908=_0x3c65ca[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0xf00660=respondWithRpcPromise('VoiceChannels');var _0x45294c=getAgent(_0x578908);return Promise[_0x4ee2('0x41')]([_0xf00660,_0x45294c])[_0x4ee2('0x1b')](function(_0x3ef445){var _0x430dfc=_0x3ef445[0x0];var _0x5a9dac=_0x3ef445[0x1];var _0x55e0a4=_[_0x4ee2('0x42')](_0x430dfc[_0x4ee2('0x21')],function(_0x47f36e){return _0x47f36e[_0x4ee2('0x22')]==_0x5a9dac['id'];});return _0x279c28[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'count':_0x55e0a4[_0x4ee2('0x24')],'rows':_0x55e0a4});})[_0x4ee2('0x32')](handleError(_0x279c28));};exports['conference']=function(_0x344e1c,_0x56a88b){logger[_0x4ee2('0x2d')](_0x4ee2('0x43'),_0x344e1c['body']);var _0x1bb9e3=conferenceValidation[_0x4ee2('0xc')](_0x344e1c[_0x4ee2('0x27')]);if(_0x1bb9e3[_0x4ee2('0x24')]>0x0){return _0x56a88b['status'](0x190)[_0x4ee2('0x28')](_0x1bb9e3);}var _0x380682=_0x344e1c['body'][_0x4ee2('0x29')];return getAgent(_0x380682)[_0x4ee2('0x1b')](function(_0x33992f){logger[_0x4ee2('0x2d')]('entityFound:',_0x33992f[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x33992f[_0x4ee2('0x17')]),_0x4ee2('0x44'));return _0x56a88b[_0x4ee2('0x18')](0xc8)['json']({'error':![],'message':_0x4ee2('0x45')});})[_0x4ee2('0x32')](handleError(_0x56a88b));};exports[_0x4ee2('0x46')]=function(_0xd2a358,_0x4f34c1){logger[_0x4ee2('0x2d')](_0x4ee2('0x47'),_0xd2a358[_0x4ee2('0x27')]);var _0x54f7ab=transferValidation['validate'](_0xd2a358['body']);if(_0x54f7ab[_0x4ee2('0x24')]>0x0){return _0x4f34c1['status'](0x190)[_0x4ee2('0x28')](_0x54f7ab);}var _0xcdf9c2=_0xd2a358[_0x4ee2('0x27')]['userId'];var _0x5a5a9e=_0xd2a358[_0x4ee2('0x27')][_0x4ee2('0x23')];var _0x4217f9=_0xd2a358[_0x4ee2('0x27')][_0x4ee2('0x48')];return getAgent(_0xcdf9c2)[_0x4ee2('0x1b')](function(_0x5cc907){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x5cc907[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x5cc907[_0x4ee2('0x17')]),_0x4ee2('0x49'),{'sessionId':_0x5a5a9e,'transferNumber':_0x4217f9});return _0x4f34c1[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4f34c1));}; \ No newline at end of file +var _0x37f8=['string','callNumber\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','error','stack','name','send','status','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','\x20not\x20found!','originate','originate\x20fired:','length','json','body','callbackUrl','entityFound:','format','user:%s','hangup','hangup\x20fired:','sessionId','info','hangup\x20executed!','answer','answer\x20fired:','userId','webbar:answer','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','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','jayson/promise','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0x37f8,0xd2));var _0x837f=function(_0x57d689,_0x534f5b){_0x57d689=_0x57d689-0x0;var _0x16c0f7=_0x37f8[_0x57d689];return _0x16c0f7;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x837f('0x0'));var db=require(_0x837f('0x1'))['db'];var config=require(_0x837f('0x2'));var util=require(_0x837f('0x3'));var BPromise=require('bluebird');var jayson=require(_0x837f('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config[_0x837f('0x5')]=_[_0x837f('0x6')](config[_0x837f('0x5')],{'host':_0x837f('0x7'),'port':0x18eb});var io=require(_0x837f('0x8'))(new Redis(config[_0x837f('0x5')]));var Schema=require(_0x837f('0x9'));var originateValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'callNumber':{'type':_0x837f('0xc'),'required':[!![],_0x837f('0xd')]},'callerId':{'type':_0x837f('0xc')},'callbackUrl':{'type':_0x837f('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'sessionId':{'type':_0x837f('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x837f('0xc'),'required':[!![],_0x837f('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'sessionId':{'type':_0x837f('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x837f('0xb')]},'sessionId':{'type':_0x837f('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]}});function emit(_0x546352,_0x11f37a,_0x2f2617){logger['info'](_0x546352,_0x11f37a,JSON[_0x837f('0xf')](_0x2f2617));io['to'](_0x546352)[_0x837f('0x10')](_0x11f37a,_0x2f2617);}function handleError(_0x28baaf){return function(_0x1d17b3){console['log'](_0x837f('0x11'),_0x1d17b3,_0x1d17b3 instanceof RangeError);logger[_0x837f('0x12')](_0x1d17b3[_0x837f('0x13')]);if(_0x1d17b3 instanceof RangeError){if(_0x1d17b3[_0x837f('0x14')]){delete _0x1d17b3[_0x837f('0x14')];}_0x28baaf['status'](0x194)[_0x837f('0x15')](_0x1d17b3);}else{if(_0x1d17b3[_0x837f('0x14')]){delete _0x1d17b3[_0x837f('0x14')];}_0x28baaf[_0x837f('0x16')](0x1f4)[_0x837f('0x15')](_0x1d17b3);}};}function checkError(){return function(_0x55dc1e){if(!_0x55dc1e){throw new RangeError(_0x837f('0x17'));}return _0x55dc1e;};}function respondWithRpcPromise(_0x37d7e0,_0x287c6e){return new BPromise(function(_0xe68eb1,_0xa0af78){var _0x237656=amiClient;return _0x237656[_0x837f('0x18')](_0x37d7e0,_0x287c6e)[_0x837f('0x19')](function(_0x11a9b3){if(_0x11a9b3[_0x837f('0x12')]){if(_0x11a9b3[_0x837f('0x12')][_0x837f('0x1a')]===0x1f4){return _0xa0af78(_0x11a9b3[_0x837f('0x12')][_0x837f('0x1b')]);}return _0xe68eb1(_0x11a9b3[_0x837f('0x12')][_0x837f('0x1b')]);}else{_0xe68eb1(_0x11a9b3[_0x837f('0x1c')]);}})[_0x837f('0x1d')](function(_0x1a6f26){_0xa0af78(_0x1a6f26);});});}function getAgent(_0x3af34f){return db[_0x837f('0x1e')][_0x837f('0x1f')]({'where':{'id':_0x3af34f,'role':_0x837f('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x3f467d,_0x2df32d){return new BPromise(function(_0x4290e6,_0x5d7af3){var _0x530f6d=respondWithRpcPromise(_0x837f('0x21'));var _0x1ab2e4=getAgent(_0x3f467d);Promise[_0x837f('0x22')]([_0x530f6d,_0x1ab2e4])[_0x837f('0x19')](function(_0x30a3d9){var _0x387533=_0x30a3d9[0x0];var _0x323565=_0x30a3d9[0x1];var _0x507984=_[_0x837f('0x23')](_0x387533[_0x837f('0x24')],function(_0x266871){return _0x266871[_0x837f('0x25')]==_0x323565['id']&&_0x266871['sessionId']==_0x2df32d;});if(_0x507984['length']==0x1){_0x4290e6(_0x323565);}else{_0x5d7af3(new RangeError('sessionId\x20'+_0x2df32d+_0x837f('0x26')));}});});}exports[_0x837f('0x27')]=function(_0x2f6ab5,_0x422498){logger['info'](_0x837f('0x28'),_0x2f6ab5['body']);var _0x3997ab=originateValidation['validate'](_0x2f6ab5['body']);if(_0x3997ab[_0x837f('0x29')]>0x0){return _0x422498[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x3997ab);}var _0x5200a9=_0x2f6ab5[_0x837f('0x2b')]['userId'];var _0x56ddfc=_0x2f6ab5[_0x837f('0x2b')]['callNumber'];var _0x2c3337=_0x2f6ab5[_0x837f('0x2b')]['callerId'];var _0x245342=_0x2f6ab5[_0x837f('0x2b')][_0x837f('0x2c')];return getAgent(_0x5200a9)[_0x837f('0x19')](function(_0x26bde0){logger['info'](_0x837f('0x2d'),_0x26bde0[_0x837f('0x14')]);emit(util[_0x837f('0x2e')](_0x837f('0x2f'),_0x26bde0[_0x837f('0x14')]),'webbar:originate',{'callNumber':_0x56ddfc,'callerId':_0x2c3337,'callbackUrl':_0x245342});return _0x422498['status'](0xc8)[_0x837f('0x2a')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x422498));};exports[_0x837f('0x30')]=function(_0x1c7352,_0x554b11){logger['info'](_0x837f('0x31'),_0x1c7352[_0x837f('0x2b')]);var _0x1e0584=hangupValidation['validate'](_0x1c7352[_0x837f('0x2b')]);if(_0x1e0584[_0x837f('0x29')]>0x0){return _0x554b11[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x1e0584);}var _0x2ed1de=_0x1c7352['body']['userId'];var _0x3a9566=_0x1c7352[_0x837f('0x2b')][_0x837f('0x32')];return getAgent(_0x2ed1de)['then'](function(_0x5e001c){logger[_0x837f('0x33')](_0x837f('0x2d'),_0x5e001c[_0x837f('0x14')]);emit(util['format'](_0x837f('0x2f'),_0x5e001c[_0x837f('0x14')]),'webbar:hangup',{'sessionId':_0x3a9566});return _0x554b11['status'](0xc8)['json']({'error':![],'message':_0x837f('0x34')});})[_0x837f('0x1d')](handleError(_0x554b11));};exports[_0x837f('0x35')]=function(_0x4591db,_0x15e50d){logger[_0x837f('0x33')](_0x837f('0x36'),_0x4591db[_0x837f('0x2b')]);var _0xdbd892=answerValidation[_0x837f('0x9')](_0x4591db['body']);if(_0xdbd892[_0x837f('0x29')]>0x0){return _0x15e50d[_0x837f('0x16')](0x190)['json'](_0xdbd892);}var _0xc2e307=_0x4591db[_0x837f('0x2b')][_0x837f('0x37')];var _0x443e7c=_0x4591db[_0x837f('0x2b')][_0x837f('0x32')];return getAgent(_0xc2e307)['then'](function(_0x24c03c){logger[_0x837f('0x33')](_0x837f('0x2d'),_0x24c03c[_0x837f('0x14')]);emit(util[_0x837f('0x2e')](_0x837f('0x2f'),_0x24c03c[_0x837f('0x14')]),_0x837f('0x38'),{'sessionId':_0x443e7c});return _0x15e50d['status'](0xc8)[_0x837f('0x2a')]({'error':![],'message':_0x837f('0x39')});})['catch'](handleError(_0x15e50d));};exports[_0x837f('0x3a')]=function(_0x400ccd,_0x5ce967){logger[_0x837f('0x33')](_0x837f('0x3b'),_0x400ccd[_0x837f('0x2b')]);var _0x45af4a=holdValidation[_0x837f('0x9')](_0x400ccd[_0x837f('0x2b')]);if(_0x45af4a['length']>0x0){return _0x5ce967[_0x837f('0x16')](0x190)['json'](_0x45af4a);}var _0x1146ef=_0x400ccd[_0x837f('0x2b')][_0x837f('0x37')];var _0x39ce8b=_0x400ccd[_0x837f('0x2b')][_0x837f('0x32')];return getAgent(_0x1146ef)['then'](function(_0x554f74){logger['info'](_0x837f('0x2d'),_0x554f74[_0x837f('0x14')]);emit(util['format'](_0x837f('0x2f'),_0x554f74['name']),_0x837f('0x3c'),{'sessionId':_0x39ce8b});return _0x5ce967[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'error':![],'message':_0x837f('0x3d')});})[_0x837f('0x1d')](handleError(_0x5ce967));};exports[_0x837f('0x3e')]=function(_0x4d9156,_0x23406b){logger['info'](_0x837f('0x3f'),_0x4d9156[_0x837f('0x2b')]);var _0x3734a6=unholdValidation['validate'](_0x4d9156[_0x837f('0x2b')]);if(_0x3734a6[_0x837f('0x29')]>0x0){return _0x23406b[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x3734a6);}var _0x1dec94=_0x4d9156[_0x837f('0x2b')]['userId'];var _0x5446d8=_0x4d9156[_0x837f('0x2b')][_0x837f('0x32')];return getAgent(_0x1dec94)[_0x837f('0x19')](function(_0x4c36f0){logger[_0x837f('0x33')]('entityFound:',_0x4c36f0[_0x837f('0x14')]);emit(util['format'](_0x837f('0x2f'),_0x4c36f0[_0x837f('0x14')]),_0x837f('0x40'),{'sessionId':_0x5446d8});return _0x23406b[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'error':![],'message':_0x837f('0x41')});})[_0x837f('0x1d')](handleError(_0x23406b));};exports[_0x837f('0x42')]=function(_0x2322d8,_0x3b9899){logger[_0x837f('0x33')](_0x837f('0x43'),_0x3b9899['body']);var _0x4ade1b=callsValidation[_0x837f('0x9')](_0x2322d8['body']);if(_0x4ade1b[_0x837f('0x29')]>0x0){return _0x3b9899[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x4ade1b);}var _0x11bde4=_0x2322d8[_0x837f('0x2b')][_0x837f('0x37')];var _0x438d93=respondWithRpcPromise(_0x837f('0x21'));var _0x145e5d=getAgent(_0x11bde4);return Promise[_0x837f('0x22')]([_0x438d93,_0x145e5d])[_0x837f('0x19')](function(_0x13d01a){var _0x2b528a=_0x13d01a[0x0];var _0x48440f=_0x13d01a[0x1];var _0x476acd=_[_0x837f('0x23')](_0x2b528a[_0x837f('0x24')],function(_0x5acfab){return _0x5acfab[_0x837f('0x25')]==_0x48440f['id'];});return _0x3b9899[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'count':_0x476acd[_0x837f('0x29')],'rows':_0x476acd});})[_0x837f('0x1d')](handleError(_0x3b9899));};exports[_0x837f('0x44')]=function(_0x536075,_0x48fa74){logger[_0x837f('0x33')](_0x837f('0x45'),_0x536075[_0x837f('0x2b')]);var _0x5a2868=conferenceValidation[_0x837f('0x9')](_0x536075[_0x837f('0x2b')]);if(_0x5a2868[_0x837f('0x29')]>0x0){return _0x48fa74[_0x837f('0x16')](0x190)['json'](_0x5a2868);}var _0x35f2f3=_0x536075[_0x837f('0x2b')][_0x837f('0x37')];return getAgent(_0x35f2f3)['then'](function(_0x53c966){logger['info'](_0x837f('0x2d'),_0x53c966[_0x837f('0x14')]);emit(util[_0x837f('0x2e')](_0x837f('0x2f'),_0x53c966[_0x837f('0x14')]),_0x837f('0x46'));return _0x48fa74[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'error':![],'message':_0x837f('0x47')});})[_0x837f('0x1d')](handleError(_0x48fa74));};exports[_0x837f('0x48')]=function(_0x1022a7,_0x1b6747){logger[_0x837f('0x33')]('transfer\x20fired:',_0x1022a7['body']);var _0x50a01e=transferValidation[_0x837f('0x9')](_0x1022a7[_0x837f('0x2b')]);if(_0x50a01e[_0x837f('0x29')]>0x0){return _0x1b6747[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x50a01e);}var _0xf00bc5=_0x1022a7['body'][_0x837f('0x37')];var _0x239981=_0x1022a7['body'][_0x837f('0x32')];var _0x1d43f6=_0x1022a7[_0x837f('0x2b')]['transferNumber'];return getAgent(_0xf00bc5)[_0x837f('0x19')](function(_0x365bff){logger[_0x837f('0x33')]('entityFound:',_0x365bff['name']);emit(util[_0x837f('0x2e')]('user:%s',_0x365bff[_0x837f('0x14')]),_0x837f('0x49'),{'sessionId':_0x239981,'transferNumber':_0x1d43f6});return _0x1b6747[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0x837f('0x1d')](handleError(_0x1b6747));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d7538df..55d0b69 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 _0x5850=['path','express','Router','fs-extra','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','post','create','addDisposition','addAnswer','/:id/users','/:id/applications','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x589c33,_0x13ec38){var _0x37c3e7=function(_0xc7856f){while(--_0xc7856f){_0x589c33['push'](_0x589c33['shift']());}};_0x37c3e7(++_0x13ec38);}(_0x5850,0x8e));var _0x0585=function(_0x912a89,_0x3a41f2){_0x912a89=_0x912a89-0x0;var _0x422e3e=_0x5850[_0x912a89];return _0x422e3e;};'use strict';var multer=require(_0x0585('0x0'));var util=require(_0x0585('0x1'));var path=require(_0x0585('0x2'));var timeout=require('connect-timeout');var express=require(_0x0585('0x3'));var router=express[_0x0585('0x4')]();var fs_extra=require(_0x0585('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0585('0x6'));var controller=require(_0x0585('0x7'));router[_0x0585('0x8')]('/',auth[_0x0585('0x9')](),controller[_0x0585('0xa')]);router[_0x0585('0x8')](_0x0585('0xb'),auth[_0x0585('0x9')](),controller[_0x0585('0xc')]);router[_0x0585('0x8')](_0x0585('0xd'),auth[_0x0585('0x9')](),controller[_0x0585('0xe')]);router[_0x0585('0x8')](_0x0585('0xf'),auth[_0x0585('0x9')](),controller[_0x0585('0x10')]);router[_0x0585('0x8')](_0x0585('0x11'),auth[_0x0585('0x9')](),controller['getAnswers']);router[_0x0585('0x8')]('/:id/users',auth[_0x0585('0x9')](),controller['getAgents']);router[_0x0585('0x8')]('/:id/applications',auth[_0x0585('0x9')](),controller[_0x0585('0x12')]);router[_0x0585('0x13')]('/',auth[_0x0585('0x9')](),controller[_0x0585('0x14')]);router[_0x0585('0x13')](_0x0585('0xf'),auth[_0x0585('0x9')](),controller[_0x0585('0x15')]);router[_0x0585('0x13')](_0x0585('0x11'),auth[_0x0585('0x9')](),controller[_0x0585('0x16')]);router['post'](_0x0585('0x17'),auth['isAuthenticated'](),controller['addAgents']);router[_0x0585('0x13')](_0x0585('0x18'),auth[_0x0585('0x9')](),controller['addApplications']);router[_0x0585('0x13')](_0x0585('0x19'),controller[_0x0585('0x1a')]);router['post'](_0x0585('0x1b'),auth['isAuthenticated'](),controller['send']);router[_0x0585('0x1c')](_0x0585('0xd'),auth[_0x0585('0x9')](),controller[_0x0585('0x1d')]);router['delete'](_0x0585('0xd'),auth['isAuthenticated'](),controller[_0x0585('0x1e')]);router[_0x0585('0x1f')](_0x0585('0xf'),auth[_0x0585('0x9')](),controller[_0x0585('0x20')]);router[_0x0585('0x1f')](_0x0585('0x11'),auth['isAuthenticated'](),controller[_0x0585('0x21')]);router['delete'](_0x0585('0x17'),auth[_0x0585('0x9')](),controller[_0x0585('0x22')]);module[_0x0585('0x23')]=router; \ No newline at end of file +var _0xaa3c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','addApplications','/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout'];(function(_0x1254a5,_0x2ba0be){var _0x2fbf81=function(_0x1f5c83){while(--_0x1f5c83){_0x1254a5['push'](_0x1254a5['shift']());}};_0x2fbf81(++_0x2ba0be);}(_0xaa3c,0x72));var _0xcaa3=function(_0xa79c20,_0x10a785){_0xa79c20=_0xa79c20-0x0;var _0x58fbfc=_0xaa3c[_0xa79c20];return _0x58fbfc;};'use strict';var multer=require(_0xcaa3('0x0'));var util=require(_0xcaa3('0x1'));var path=require('path');var timeout=require(_0xcaa3('0x2'));var express=require(_0xcaa3('0x3'));var router=express[_0xcaa3('0x4')]();var fs_extra=require(_0xcaa3('0x5'));var auth=require(_0xcaa3('0x6'));var interaction=require(_0xcaa3('0x7'));var config=require(_0xcaa3('0x8'));var controller=require(_0xcaa3('0x9'));router['get']('/',auth[_0xcaa3('0xa')](),controller[_0xcaa3('0xb')]);router[_0xcaa3('0xc')]('/describe',auth[_0xcaa3('0xa')](),controller[_0xcaa3('0xd')]);router['get'](_0xcaa3('0xe'),auth[_0xcaa3('0xa')](),controller[_0xcaa3('0xf')]);router[_0xcaa3('0xc')](_0xcaa3('0x10'),auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x11')]);router['get']('/:id/canned_answers',auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x12')]);router[_0xcaa3('0xc')](_0xcaa3('0x13'),auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x14')]);router[_0xcaa3('0xc')](_0xcaa3('0x15'),auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x16')]);router[_0xcaa3('0x17')]('/',auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x18')]);router[_0xcaa3('0x17')](_0xcaa3('0x10'),auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x19')]);router[_0xcaa3('0x17')](_0xcaa3('0x1a'),auth[_0xcaa3('0xa')](),controller['addAnswer']);router[_0xcaa3('0x17')]('/:id/users',auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x1b')]);router['post']('/:id/applications',auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x1c')]);router['post'](_0xcaa3('0x1d'),controller['notify']);router[_0xcaa3('0x17')](_0xcaa3('0x1e'),auth['isAuthenticated'](),controller[_0xcaa3('0x1f')]);router[_0xcaa3('0x20')](_0xcaa3('0xe'),auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x21')]);router['delete'](_0xcaa3('0xe'),auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x22')]);router[_0xcaa3('0x23')]('/:id/dispositions',auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x24')]);router[_0xcaa3('0x23')]('/:id/canned_answers',auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x25')]);router[_0xcaa3('0x23')](_0xcaa3('0x13'),auth[_0xcaa3('0xa')](),controller[_0xcaa3('0x26')]);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 6887551..fe1e15a 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 _0xb65d=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xb65d,0x7e));var _0xdb65=function(_0x9f14f4,_0x2a6410){_0x9f14f4=_0x9f14f4-0x0;var _0x5cb56c=_0xb65d[_0x9f14f4];return _0x5cb56c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xdb65('0x0'));module[_0xdb65('0x1')]={'name':{'type':Sequelize[_0xdb65('0x2')],'unique':_0xdb65('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xdb65('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xdb65('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xdb65('0x2')],'defaultValue':function(){return rs[_0xdb65('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdb65('0x5')]('twilio',_0xdb65('0x6'))},'accountSid':{'type':Sequelize[_0xdb65('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdb65('0x2')]},'notificationTemplate':{'type':Sequelize[_0xdb65('0x7')],'defaultValue':function(){return _0xdb65('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdb65('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdb65('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdb65('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdb65('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdb65('0xa')],'comment':_0xdb65('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xdb65('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5653c7){if(!_0x5653c7){this[_0xdb65('0xc')](_0xdb65('0xd'),null);}this[_0xdb65('0xc')](_0xdb65('0xe'),_0x5653c7);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xab98=['exports','STRING','name','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x5c4d27,_0x5b0822){var _0x1dda1a=function(_0x5ea638){while(--_0x5ea638){_0x5c4d27['push'](_0x5c4d27['shift']());}};_0x1dda1a(++_0x5b0822);}(_0xab98,0x1c0));var _0x8ab9=function(_0xdaf890,_0x15d793){_0xdaf890=_0xdaf890-0x0;var _0x17b443=_0xab98[_0xdaf890];return _0x17b443;};'use strict';var Sequelize=require(_0x8ab9('0x0'));var rs=require(_0x8ab9('0x1'));module[_0x8ab9('0x2')]={'name':{'type':Sequelize[_0x8ab9('0x3')],'unique':_0x8ab9('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x8ab9('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8ab9('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x8ab9('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8ab9('0x5')](_0x8ab9('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0x8ab9('0x3')]},'baseUrl':{'type':Sequelize[_0x8ab9('0x3')]},'authToken':{'type':Sequelize[_0x8ab9('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8ab9('0x7');}},'notificationSound':{'type':Sequelize[_0x8ab9('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8ab9('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8ab9('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8ab9('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8ab9('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8ab9('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8ab9('0x9')],'comment':_0x8ab9('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x8ab9('0x8')],'defaultValue':![],'comment':_0x8ab9('0xb'),'set':function(_0x3c79d2){if(!_0x3c79d2){this[_0x8ab9('0xc')](_0x8ab9('0xd'),null);}this['setDataValue'](_0x8ab9('0xe'),_0x3c79d2);}},'description':{'type':Sequelize[_0x8ab9('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 3328e3e..19e9f0e 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 _0x2f8b=['offset','set','Content-Range','apply','reject','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','show','params','mandatoryDispositionPause','options','find','catch','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','body','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','messageId','MessageSid','notifications','from','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','undefined','limit'];(function(_0x38d4e5,_0x16acad){var _0x336665=function(_0x3be119){while(--_0x3be119){_0x38d4e5['push'](_0x38d4e5['shift']());}};_0x336665(++_0x16acad);}(_0x2f8b,0x96));var _0xb2f8=function(_0x99508b,_0x738feb){_0x99508b=_0x99508b-0x0;var _0x693e60=_0x2f8b[_0x99508b];return _0x693e60;};'use strict';var emlformat=require(_0xb2f8('0x0'));var rimraf=require(_0xb2f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2f8('0x2'));var rp=require(_0xb2f8('0x3'));var moment=require(_0xb2f8('0x4'));var BPromise=require(_0xb2f8('0x5'));var Mustache=require(_0xb2f8('0x6'));var util=require(_0xb2f8('0x7'));var path=require(_0xb2f8('0x8'));var sox=require('sox');var csv=require(_0xb2f8('0x9'));var ejs=require(_0xb2f8('0xa'));var fs=require('fs');var fs_extra=require(_0xb2f8('0xb'));var _=require('lodash');var squel=require(_0xb2f8('0xc'));var crypto=require('crypto');var jsforce=require(_0xb2f8('0xd'));var deskjs=require(_0xb2f8('0xe'));var toCsv=require(_0xb2f8('0x9'));var querystring=require(_0xb2f8('0xf'));var Papa=require(_0xb2f8('0x10'));var Redis=require(_0xb2f8('0x11'));var authService=require(_0xb2f8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb2f8('0x13'));var hardwareService=require(_0xb2f8('0x14'));var logger=require(_0xb2f8('0x15'))(_0xb2f8('0x16'));var utils=require(_0xb2f8('0x17'));var config=require(_0xb2f8('0x18'));var licenseUtil=require(_0xb2f8('0x19'));var db=require(_0xb2f8('0x1a'))['db'];config[_0xb2f8('0x1b')]=_[_0xb2f8('0x1c')](config[_0xb2f8('0x1b')],{'host':_0xb2f8('0x1d'),'port':0x18eb});var socket=require(_0xb2f8('0x1e'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xb2f8('0x1f')](socket);var jayson=require(_0xb2f8('0x20'));var client=jayson['client'][_0xb2f8('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x6d73fd,_0x3c30a6,_0x2097e7,_0x57d3c8){return new BPromise(function(_0x4aabd4,_0x2a39a4){var _0x20ebf9=_0x57d3c8||client;return _0x20ebf9['request'](_0x6d73fd,_0x2097e7)[_0xb2f8('0x22')](function(_0x31e436){logger['info'](_0xb2f8('0x23'),_0x3c30a6,'request\x20sent');logger[_0xb2f8('0x24')](_0xb2f8('0x25'),_0x3c30a6,_0xb2f8('0x26'),JSON[_0xb2f8('0x27')](_0x31e436));if(_0x31e436[_0xb2f8('0x28')]){if(_0x31e436[_0xb2f8('0x28')][_0xb2f8('0x29')]===0x1f4){logger[_0xb2f8('0x28')](_0xb2f8('0x23'),_0x3c30a6,_0x31e436[_0xb2f8('0x28')]['message']);return _0x2a39a4(_0x31e436[_0xb2f8('0x28')]['message']);}logger[_0xb2f8('0x28')](_0xb2f8('0x23'),_0x3c30a6,_0x31e436[_0xb2f8('0x28')][_0xb2f8('0x2a')]);return _0x4aabd4(_0x31e436['error'][_0xb2f8('0x2a')]);}else{logger[_0xb2f8('0x2b')](_0xb2f8('0x23'),_0x3c30a6,'request\x20sent');_0x4aabd4(_0x31e436[_0xb2f8('0x2c')]['message']);}})['catch'](function(_0x184b24){logger[_0xb2f8('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x3c30a6,_0x184b24);_0x2a39a4(_0x184b24);});});}function respondWithStatusCode(_0x78fa37,_0x3643e4){_0x3643e4=_0x3643e4||0xcc;return function(_0x52e72b){if(_0x52e72b){return _0x78fa37[_0xb2f8('0x2d')](_0x3643e4);}return _0x78fa37[_0xb2f8('0x2e')](_0x3643e4)[_0xb2f8('0x2f')]();};}function respondWithResult(_0x55e4a3,_0x42355d){_0x42355d=_0x42355d||0xc8;return function(_0x3ca25b){if(_0x3ca25b){return _0x55e4a3[_0xb2f8('0x2e')](_0x42355d)[_0xb2f8('0x30')](_0x3ca25b);}};}function respondWithFilteredResult(_0x2ceb6e,_0x5de25e){return function(_0x2a2dcf){if(_0x2a2dcf){var _0x190115=typeof _0x5de25e['offset']===_0xb2f8('0x31')&&typeof _0x5de25e[_0xb2f8('0x32')]===_0xb2f8('0x31');var _0x40d9d0=_0x2a2dcf['count'];var _0x2695e7=_0x190115?0x0:_0x5de25e[_0xb2f8('0x33')];var _0x196a14=_0x190115?_0x2a2dcf['count']:_0x5de25e[_0xb2f8('0x33')]+_0x5de25e['limit'];var _0x19f582;if(_0x196a14>=_0x40d9d0){_0x196a14=_0x40d9d0;_0x19f582=0xc8;}else{_0x19f582=0xce;}_0x2ceb6e[_0xb2f8('0x2e')](_0x19f582);return _0x2ceb6e[_0xb2f8('0x34')](_0xb2f8('0x35'),_0x2695e7+'-'+_0x196a14+'/'+_0x40d9d0)[_0xb2f8('0x30')](_0x2a2dcf);}return null;};}function patchUpdates(_0x31f922){return function(_0x47720c){try{jsonpatch[_0xb2f8('0x36')](_0x47720c,_0x31f922,!![]);}catch(_0x38fb3a){return BPromise[_0xb2f8('0x37')](_0x38fb3a);}return _0x47720c['save']();};}function saveUpdates(_0xd3b017,_0x28f7ca){return function(_0x3d9df0){if(_0x3d9df0){return _0x3d9df0[_0xb2f8('0x38')](_0xd3b017)['then'](function(_0x17a62c){return _0x17a62c;});}return null;};}function removeEntity(_0xda8928,_0x3e05b1){return function(_0x20fbfe){if(_0x20fbfe){return _0x20fbfe[_0xb2f8('0x39')]()['then'](function(){var _0x3454ee=_0x20fbfe['get']({'plain':!![]});var _0x5d952f=_0xb2f8('0x3a');return db[_0xb2f8('0x3b')][_0xb2f8('0x39')]({'where':{'type':_0x5d952f,'resourceId':_0x3454ee['id']}})[_0xb2f8('0x22')](function(){return _0x20fbfe;});})[_0xb2f8('0x22')](function(){_0xda8928[_0xb2f8('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9a9a,_0x225d68){return function(_0x3f4295){if(!_0x3f4295){_0x2d9a9a['sendStatus'](0x194);}return _0x3f4295;};}function handleError(_0x4ca67a,_0x4d0b98){_0x4d0b98=_0x4d0b98||0x1f4;return function(_0x16f724){logger[_0xb2f8('0x28')](_0x16f724[_0xb2f8('0x3c')]);if(_0x16f724['name']){delete _0x16f724[_0xb2f8('0x3d')];}_0x4ca67a[_0xb2f8('0x2e')](_0x4d0b98)[_0xb2f8('0x3e')](_0x16f724);};}exports[_0xb2f8('0x3f')]=function(_0x340b3e,_0x11ad54){var _0x1e4428={'include':[{'model':db[_0xb2f8('0x40')],'as':'mandatoryDispositionPause'}]},_0x54ede4={},_0x144505={'count':0x0,'rows':[]};var _0x34cc83=_[_0xb2f8('0x41')](db[_0xb2f8('0x42')][_0xb2f8('0x43')],function(_0x7ac8e5){return{'name':_0x7ac8e5[_0xb2f8('0x44')],'type':_0x7ac8e5[_0xb2f8('0x45')][_0xb2f8('0x46')]};});_0x54ede4[_0xb2f8('0x47')]=_[_0xb2f8('0x41')](_0x34cc83,'name');_0x54ede4[_0xb2f8('0x48')]=_[_0xb2f8('0x49')](_0x340b3e[_0xb2f8('0x48')]);_0x54ede4[_0xb2f8('0x4a')]=_[_0xb2f8('0x4b')](_0x54ede4[_0xb2f8('0x47')],_0x54ede4['query']);_0x1e4428[_0xb2f8('0x4c')]=_[_0xb2f8('0x4b')](_0x54ede4['model'],qs[_0xb2f8('0x4d')](_0x340b3e[_0xb2f8('0x48')][_0xb2f8('0x4d')]));_0x1e4428['attributes']=_0x1e4428[_0xb2f8('0x4c')][_0xb2f8('0x4e')]?_0x1e4428['attributes']:_0x54ede4['model'];if(!_0x340b3e[_0xb2f8('0x48')][_0xb2f8('0x4f')]('nolimit')){_0x1e4428[_0xb2f8('0x32')]=qs['limit'](_0x340b3e[_0xb2f8('0x48')][_0xb2f8('0x32')]);_0x1e4428[_0xb2f8('0x33')]=qs[_0xb2f8('0x33')](_0x340b3e[_0xb2f8('0x48')]['offset']);}_0x1e4428[_0xb2f8('0x50')]=qs[_0xb2f8('0x51')](_0x340b3e['query'][_0xb2f8('0x51')]);_0x1e4428[_0xb2f8('0x52')]=qs[_0xb2f8('0x4a')](_[_0xb2f8('0x53')](_0x340b3e['query'],_0x54ede4[_0xb2f8('0x4a')]),_0x34cc83);if(_0x340b3e['query'][_0xb2f8('0x54')]){_0x1e4428['where']=_[_0xb2f8('0x55')](_0x1e4428[_0xb2f8('0x52')],{'$or':_[_0xb2f8('0x41')](_0x34cc83,function(_0x324216){if(_0x324216[_0xb2f8('0x45')]!==_0xb2f8('0x56')){var _0x5763f4={};_0x5763f4[_0x324216[_0xb2f8('0x3d')]]={'$like':'%'+_0x340b3e[_0xb2f8('0x48')][_0xb2f8('0x54')]+'%'};return _0x5763f4;}})});}_0x1e4428=_[_0xb2f8('0x55')]({},_0x1e4428,_0x340b3e['options']);var _0x1d42c1={'where':_0x1e4428['where']};return db[_0xb2f8('0x42')][_0xb2f8('0x57')](_0x1d42c1)['then'](function(_0x1155ff){_0x144505[_0xb2f8('0x57')]=_0x1155ff;if(_0x340b3e[_0xb2f8('0x48')][_0xb2f8('0x58')]){_0x1e4428[_0xb2f8('0x59')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xb2f8('0x5a')](_0x1e4428);})[_0xb2f8('0x22')](function(_0x139354){_0x144505['rows']=_0x139354;return _0x144505;})[_0xb2f8('0x22')](respondWithFilteredResult(_0x11ad54,_0x1e4428))['catch'](handleError(_0x11ad54,null));};exports[_0xb2f8('0x5b')]=function(_0x28c367,_0x24b6ec){var _0x437790={'raw':![],'where':{'id':_0x28c367[_0xb2f8('0x5c')]['id']},'include':[{'model':db[_0xb2f8('0x40')],'as':_0xb2f8('0x5d')}]},_0x51e992={};_0x51e992[_0xb2f8('0x47')]=_['keys'](db['WhatsappAccount'][_0xb2f8('0x43')]);_0x51e992[_0xb2f8('0x48')]=_['keys'](_0x28c367[_0xb2f8('0x48')]);_0x51e992['filters']=_[_0xb2f8('0x4b')](_0x51e992[_0xb2f8('0x47')],_0x51e992[_0xb2f8('0x48')]);_0x437790[_0xb2f8('0x4c')]=_[_0xb2f8('0x4b')](_0x51e992[_0xb2f8('0x47')],qs['fields'](_0x28c367[_0xb2f8('0x48')][_0xb2f8('0x4d')]));_0x437790[_0xb2f8('0x4c')]=_0x437790[_0xb2f8('0x4c')]['length']?_0x437790[_0xb2f8('0x4c')]:_0x51e992['model'];if(_0x28c367[_0xb2f8('0x48')][_0xb2f8('0x58')]){_0x437790[_0xb2f8('0x59')]=[{'all':!![]}];}_0x437790=_[_0xb2f8('0x55')]({},_0x437790,_0x28c367[_0xb2f8('0x5e')]);return db[_0xb2f8('0x42')][_0xb2f8('0x5f')](_0x437790)[_0xb2f8('0x22')](handleEntityNotFound(_0x24b6ec,null))[_0xb2f8('0x22')](respondWithResult(_0x24b6ec,null))[_0xb2f8('0x60')](handleError(_0x24b6ec,null));};exports['create']=function(_0x5347a1,_0x2b453b){return db[_0xb2f8('0x42')]['create'](_0x5347a1['body'],{})['then'](function(_0x3ceba4){var _0x55d894=_0x5347a1[_0xb2f8('0x61')][_0xb2f8('0x62')]({'plain':!![]});if(!_0x55d894)throw new Error(_0xb2f8('0x63'));if(_0x55d894['role']===_0xb2f8('0x61')){var _0x4ec32a=_0x3ceba4['get']({'plain':!![]});var _0x594f02=_0xb2f8('0x3a');return db[_0xb2f8('0x64')][_0xb2f8('0x5f')]({'where':{'name':_0x594f02,'userProfileId':_0x55d894[_0xb2f8('0x65')]},'raw':!![]})[_0xb2f8('0x22')](function(_0x5af46e){if(_0x5af46e&&_0x5af46e[_0xb2f8('0x66')]===0x0){return db[_0xb2f8('0x3b')][_0xb2f8('0x67')]({'name':_0x4ec32a[_0xb2f8('0x3d')],'resourceId':_0x4ec32a['id'],'type':_0x5af46e['name'],'sectionId':_0x5af46e['id']},{})[_0xb2f8('0x22')](function(){return _0x3ceba4;});}else{return _0x3ceba4;}})['catch'](function(_0xed0baa){logger[_0xb2f8('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xed0baa);throw _0xed0baa;});}return _0x3ceba4;})['then'](respondWithResult(_0x2b453b,0xc9))[_0xb2f8('0x60')](handleError(_0x2b453b,null));};exports[_0xb2f8('0x38')]=function(_0x24e90b,_0x3f250a){if(_0x24e90b[_0xb2f8('0x68')]['id']){delete _0x24e90b[_0xb2f8('0x68')]['id'];}return db[_0xb2f8('0x42')]['find']({'where':{'id':_0x24e90b['params']['id']},'include':[{'model':db[_0xb2f8('0x40')],'as':'mandatoryDispositionPause'}]})[_0xb2f8('0x22')](handleEntityNotFound(_0x3f250a,null))[_0xb2f8('0x22')](saveUpdates(_0x24e90b[_0xb2f8('0x68')],null))[_0xb2f8('0x22')](respondWithResult(_0x3f250a,null))[_0xb2f8('0x60')](handleError(_0x3f250a,null));};exports[_0xb2f8('0x39')]=function(_0x4ba64b,_0x501d7e){return db[_0xb2f8('0x42')][_0xb2f8('0x5f')]({'where':{'id':_0x4ba64b[_0xb2f8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x501d7e,null))[_0xb2f8('0x22')](removeEntity(_0x501d7e,null))['catch'](handleError(_0x501d7e,null));};exports[_0xb2f8('0x69')]=function(_0x1173b7,_0xf12acc){return db[_0xb2f8('0x42')]['describe']()['then'](respondWithResult(_0xf12acc,null))[_0xb2f8('0x60')](handleError(_0xf12acc,null));};exports[_0xb2f8('0x6a')]=function(_0x4701a6,_0x143df7,_0xcf6c17){if(_0x4701a6[_0xb2f8('0x68')]['id']){delete _0x4701a6['body']['id'];}return db[_0xb2f8('0x42')]['find']({'where':{'id':_0x4701a6[_0xb2f8('0x5c')]['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x143df7,null))[_0xb2f8('0x22')](function(_0x38e829){if(_0x38e829){_0x4701a6['body'][_0xb2f8('0x6b')]=_0x38e829['id'];return db['Disposition']['create'](_0x4701a6['body']);}})['then'](respondWithResult(_0x143df7,null))[_0xb2f8('0x60')](handleError(_0x143df7,null));};exports[_0xb2f8('0x6c')]=function(_0x3f77fb,_0x427cee,_0x12f1d6){var _0x53db48={'raw':![],'where':{}};var _0x28c6c2={};var _0x3016af={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xb2f8('0x6d')]({'where':{'id':_0x3f77fb[_0xb2f8('0x5c')]['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x427cee,null))[_0xb2f8('0x22')](function(_0xd2f16c){if(_0xd2f16c){_0x28c6c2[_0xb2f8('0x47')]=_[_0xb2f8('0x49')](db[_0xb2f8('0x6e')][_0xb2f8('0x43')]);_0x28c6c2[_0xb2f8('0x48')]=_[_0xb2f8('0x49')](_0x3f77fb[_0xb2f8('0x48')]);_0x28c6c2[_0xb2f8('0x4a')]=_['intersection'](_0x28c6c2[_0xb2f8('0x47')],_0x28c6c2[_0xb2f8('0x48')]);_0x53db48[_0xb2f8('0x4c')]=_[_0xb2f8('0x4b')](_0x28c6c2[_0xb2f8('0x47')],qs[_0xb2f8('0x4d')](_0x3f77fb[_0xb2f8('0x48')]['fields']));_0x53db48[_0xb2f8('0x4c')]=_0x53db48[_0xb2f8('0x4c')][_0xb2f8('0x4e')]?_0x53db48['attributes']:_0x28c6c2[_0xb2f8('0x47')];if(!_0x3f77fb[_0xb2f8('0x48')]['hasOwnProperty'](_0xb2f8('0x6f'))){_0x53db48[_0xb2f8('0x32')]=qs[_0xb2f8('0x32')](_0x3f77fb[_0xb2f8('0x48')][_0xb2f8('0x32')]);_0x53db48[_0xb2f8('0x33')]=qs[_0xb2f8('0x33')](_0x3f77fb[_0xb2f8('0x48')][_0xb2f8('0x33')]);}_0x53db48[_0xb2f8('0x50')]=qs[_0xb2f8('0x51')](_0x3f77fb[_0xb2f8('0x48')]['sort']);_0x53db48[_0xb2f8('0x52')]=qs[_0xb2f8('0x4a')](_[_0xb2f8('0x53')](_0x3f77fb[_0xb2f8('0x48')],_0x28c6c2['filters']));_0x53db48['where'][_0xb2f8('0x6b')]=_0xd2f16c['id'];if(_0x3f77fb[_0xb2f8('0x48')]['filter']){_0x53db48[_0xb2f8('0x52')]=_[_0xb2f8('0x55')](_0x53db48['where'],{'$or':_[_0xb2f8('0x41')](_0x53db48[_0xb2f8('0x4c')],function(_0x31bed1){var _0x550feb={};_0x550feb[_0x31bed1]={'$like':'%'+_0x3f77fb[_0xb2f8('0x48')]['filter']+'%'};return _0x550feb;})});}_0x53db48=_[_0xb2f8('0x55')]({},_0x53db48,_0x3f77fb['options']);return db[_0xb2f8('0x6e')][_0xb2f8('0x57')]({'where':_0x53db48['where']})['then'](function(_0x30d76a){_0x3016af['count']=_0x30d76a;if(_0x3f77fb[_0xb2f8('0x48')][_0xb2f8('0x58')]){_0x53db48['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x53db48);})[_0xb2f8('0x22')](function(_0x133cad){_0x3016af['rows']=_0x133cad;return _0x3016af;});}})['then'](respondWithFilteredResult(_0x427cee,_0x53db48))[_0xb2f8('0x60')](handleError(_0x427cee,null));};exports[_0xb2f8('0x70')]=function(_0x9d2772,_0x135b41,_0x1b76f1){return db['WhatsappAccount'][_0xb2f8('0x5f')]({'where':{'id':_0x9d2772[_0xb2f8('0x5c')]['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x135b41,null))[_0xb2f8('0x22')](function(_0x5a6377){if(_0x5a6377){return _0x5a6377['removeDispositions'](_0x9d2772[_0xb2f8('0x48')][_0xb2f8('0x71')]);}})['then'](respondWithStatusCode(_0x135b41,null))[_0xb2f8('0x60')](handleError(_0x135b41,null));};exports[_0xb2f8('0x72')]=function(_0x52759c,_0x1afd7f,_0x6eaa14){if(_0x52759c[_0xb2f8('0x68')]['id']){delete _0x52759c[_0xb2f8('0x68')]['id'];}return db[_0xb2f8('0x42')][_0xb2f8('0x5f')]({'where':{'id':_0x52759c['params']['id']}})['then'](handleEntityNotFound(_0x1afd7f,null))[_0xb2f8('0x22')](function(_0x38405b){if(_0x38405b){_0x52759c[_0xb2f8('0x68')]['WhatsappAccountId']=_0x38405b['id'];return db[_0xb2f8('0x73')][_0xb2f8('0x67')](_0x52759c[_0xb2f8('0x68')]);}})[_0xb2f8('0x22')](respondWithResult(_0x1afd7f,null))[_0xb2f8('0x60')](handleError(_0x1afd7f,null));};exports['getAnswers']=function(_0x3388f0,_0x572d3d,_0x5c7415){var _0x1809e2={'raw':![],'where':{}};var _0x4e96c3={};var _0x11e155={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xb2f8('0x6d')]({'where':{'id':_0x3388f0[_0xb2f8('0x5c')]['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x572d3d,null))[_0xb2f8('0x22')](function(_0x3f7f4b){if(_0x3f7f4b){_0x4e96c3[_0xb2f8('0x47')]=_[_0xb2f8('0x49')](db[_0xb2f8('0x73')][_0xb2f8('0x43')]);_0x4e96c3[_0xb2f8('0x48')]=_[_0xb2f8('0x49')](_0x3388f0[_0xb2f8('0x48')]);_0x4e96c3[_0xb2f8('0x4a')]=_[_0xb2f8('0x4b')](_0x4e96c3[_0xb2f8('0x47')],_0x4e96c3[_0xb2f8('0x48')]);_0x1809e2[_0xb2f8('0x4c')]=_[_0xb2f8('0x4b')](_0x4e96c3[_0xb2f8('0x47')],qs[_0xb2f8('0x4d')](_0x3388f0['query'][_0xb2f8('0x4d')]));_0x1809e2[_0xb2f8('0x4c')]=_0x1809e2[_0xb2f8('0x4c')][_0xb2f8('0x4e')]?_0x1809e2[_0xb2f8('0x4c')]:_0x4e96c3[_0xb2f8('0x47')];if(!_0x3388f0[_0xb2f8('0x48')][_0xb2f8('0x4f')]('nolimit')){_0x1809e2[_0xb2f8('0x32')]=qs[_0xb2f8('0x32')](_0x3388f0[_0xb2f8('0x48')][_0xb2f8('0x32')]);_0x1809e2[_0xb2f8('0x33')]=qs[_0xb2f8('0x33')](_0x3388f0[_0xb2f8('0x48')]['offset']);}_0x1809e2[_0xb2f8('0x50')]=qs[_0xb2f8('0x51')](_0x3388f0[_0xb2f8('0x48')]['sort']);_0x1809e2[_0xb2f8('0x52')]=qs['filters'](_[_0xb2f8('0x53')](_0x3388f0[_0xb2f8('0x48')],_0x4e96c3[_0xb2f8('0x4a')]));_0x1809e2[_0xb2f8('0x52')][_0xb2f8('0x6b')]=_0x3f7f4b['id'];if(_0x3388f0[_0xb2f8('0x48')][_0xb2f8('0x54')]){_0x1809e2[_0xb2f8('0x52')]=_[_0xb2f8('0x55')](_0x1809e2[_0xb2f8('0x52')],{'$or':_[_0xb2f8('0x41')](_0x1809e2[_0xb2f8('0x4c')],function(_0x3481c6){var _0x2a9456={};_0x2a9456[_0x3481c6]={'$like':'%'+_0x3388f0[_0xb2f8('0x48')][_0xb2f8('0x54')]+'%'};return _0x2a9456;})});}_0x1809e2=_['merge']({},_0x1809e2,_0x3388f0[_0xb2f8('0x5e')]);return db[_0xb2f8('0x73')][_0xb2f8('0x57')]({'where':_0x1809e2[_0xb2f8('0x52')]})[_0xb2f8('0x22')](function(_0x39f17a){_0x11e155[_0xb2f8('0x57')]=_0x39f17a;if(_0x3388f0[_0xb2f8('0x48')][_0xb2f8('0x58')]){_0x1809e2[_0xb2f8('0x59')]=[{'all':!![]}];}return db[_0xb2f8('0x73')][_0xb2f8('0x5a')](_0x1809e2);})[_0xb2f8('0x22')](function(_0x17333e){_0x11e155['rows']=_0x17333e;return _0x11e155;});}})['then'](respondWithFilteredResult(_0x572d3d,_0x1809e2))[_0xb2f8('0x60')](handleError(_0x572d3d,null));};exports[_0xb2f8('0x74')]=function(_0x211886,_0x302c4b,_0xc1ec9d){return db[_0xb2f8('0x42')]['find']({'where':{'id':_0x211886['params']['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x302c4b,null))[_0xb2f8('0x22')](function(_0x4d3e7f){if(_0x4d3e7f){return _0x4d3e7f[_0xb2f8('0x74')](_0x211886['query'][_0xb2f8('0x71')]);}})[_0xb2f8('0x22')](respondWithStatusCode(_0x302c4b,null))[_0xb2f8('0x60')](handleError(_0x302c4b,null));};exports[_0xb2f8('0x75')]=function(_0x216b3f,_0x3d22dd,_0xe27a97){return db[_0xb2f8('0x42')][_0xb2f8('0x5f')]({'where':{'id':_0x216b3f[_0xb2f8('0x5c')]['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x3d22dd,null))['then'](function(_0xfbae43){if(_0xfbae43){return _0xfbae43[_0xb2f8('0x75')](_0x216b3f[_0xb2f8('0x68')][_0xb2f8('0x71')],_[_0xb2f8('0x76')](_0x216b3f[_0xb2f8('0x68')],['ids','id'])||{})[_0xb2f8('0x77')](function(_0xf464c1){for(var _0x4aaee7=0x0;_0x4aaee7<_0x216b3f[_0xb2f8('0x68')][_0xb2f8('0x71')][_0xb2f8('0x4e')];_0x4aaee7+=0x1){socket[_0xb2f8('0x78')]('userWhatsappAccount:save',{'UserId':Number(_0x216b3f[_0xb2f8('0x68')][_0xb2f8('0x71')][_0x4aaee7]),'WhatsappAccountId':Number(_0x216b3f[_0xb2f8('0x5c')]['id'])});}return _0xf464c1;});}})[_0xb2f8('0x22')](respondWithResult(_0x3d22dd,null))[_0xb2f8('0x60')](handleError(_0x3d22dd,null));};exports[_0xb2f8('0x79')]=function(_0x2a5af8,_0x4c03dc,_0x2a4ca2){return db[_0xb2f8('0x42')]['find']({'where':{'id':_0x2a5af8[_0xb2f8('0x5c')]['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x4c03dc,null))[_0xb2f8('0x22')](function(_0x585e7f){if(_0x585e7f){return _0x585e7f[_0xb2f8('0x79')](_0x2a5af8['query'][_0xb2f8('0x71')])[_0xb2f8('0x22')](function(){if(_['isArray'](_0x2a5af8[_0xb2f8('0x48')][_0xb2f8('0x71')])){for(var _0x5bb3d9=0x0;_0x5bb3d9<_0x2a5af8[_0xb2f8('0x48')]['ids'][_0xb2f8('0x4e')];_0x5bb3d9+=0x1){socket[_0xb2f8('0x78')](_0xb2f8('0x7a'),{'UserId':Number(_0x2a5af8[_0xb2f8('0x48')][_0xb2f8('0x71')][_0x5bb3d9]),'WhatsappAccountId':Number(_0x2a5af8[_0xb2f8('0x5c')]['id'])});}}else{socket[_0xb2f8('0x78')](_0xb2f8('0x7a'),{'UserId':Number(_0x2a5af8[_0xb2f8('0x48')][_0xb2f8('0x71')]),'WhatsappAccountId':Number(_0x2a5af8[_0xb2f8('0x5c')]['id'])});}});}})[_0xb2f8('0x22')](respondWithStatusCode(_0x4c03dc,null))[_0xb2f8('0x60')](handleError(_0x4c03dc,null));};exports[_0xb2f8('0x7b')]=function(_0x40a220,_0x1484e1,_0x3e753a){var _0x5b9775={};var _0x3b42ac={};var _0x1ad553;var _0x3f48ef;return db[_0xb2f8('0x42')]['findOne']({'where':{'id':_0x40a220[_0xb2f8('0x5c')]['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x1484e1,null))[_0xb2f8('0x22')](function(_0x12ae08){if(_0x12ae08){_0x1ad553=_0x12ae08;_0x3b42ac[_0xb2f8('0x47')]=_[_0xb2f8('0x49')](db[_0xb2f8('0x7c')][_0xb2f8('0x43')]);_0x3b42ac[_0xb2f8('0x48')]=_[_0xb2f8('0x49')](_0x40a220[_0xb2f8('0x48')]);_0x3b42ac[_0xb2f8('0x4a')]=_['intersection'](_0x3b42ac[_0xb2f8('0x47')],_0x3b42ac[_0xb2f8('0x48')]);_0x5b9775[_0xb2f8('0x4c')]=_['intersection'](_0x3b42ac[_0xb2f8('0x47')],qs['fields'](_0x40a220[_0xb2f8('0x48')][_0xb2f8('0x4d')]));_0x5b9775[_0xb2f8('0x4c')]=_0x5b9775['attributes'][_0xb2f8('0x4e')]?_0x5b9775[_0xb2f8('0x4c')]:_0x3b42ac[_0xb2f8('0x47')];_0x5b9775[_0xb2f8('0x50')]=qs[_0xb2f8('0x51')](_0x40a220['query'][_0xb2f8('0x51')]);_0x5b9775[_0xb2f8('0x52')]=qs['filters'](_[_0xb2f8('0x53')](_0x40a220['query'],_0x3b42ac['filters']));if(_0x40a220[_0xb2f8('0x48')][_0xb2f8('0x54')]){_0x5b9775[_0xb2f8('0x52')]=_[_0xb2f8('0x55')](_0x5b9775['where'],{'$or':_[_0xb2f8('0x41')](_0x5b9775[_0xb2f8('0x4c')],function(_0x4ddf87){var _0x2449a6={};_0x2449a6[_0x4ddf87]={'$like':'%'+_0x40a220[_0xb2f8('0x48')][_0xb2f8('0x54')]+'%'};return _0x2449a6;})});}_0x5b9775=_[_0xb2f8('0x55')]({},_0x5b9775,_0x40a220['options']);return _0x1ad553[_0xb2f8('0x7b')](_0x5b9775);}})[_0xb2f8('0x22')](function(_0x1827cc){if(_0x1827cc){_0x3f48ef=_0x1827cc[_0xb2f8('0x4e')];if(!_0x40a220[_0xb2f8('0x48')][_0xb2f8('0x4f')]('nolimit')){_0x5b9775[_0xb2f8('0x32')]=qs[_0xb2f8('0x32')](_0x40a220[_0xb2f8('0x48')]['limit']);_0x5b9775[_0xb2f8('0x33')]=qs[_0xb2f8('0x33')](_0x40a220[_0xb2f8('0x48')][_0xb2f8('0x33')]);}return _0x1ad553[_0xb2f8('0x7b')](_0x5b9775);}})[_0xb2f8('0x22')](function(_0x345769){if(_0x345769){return _0x345769?{'count':_0x3f48ef,'rows':_0x345769}:null;}})[_0xb2f8('0x22')](respondWithResult(_0x1484e1,null))['catch'](handleError(_0x1484e1,null));};exports[_0xb2f8('0x7d')]=function(_0x1adee6,_0x503c87){var _0x423a34=_0x1adee6[_0xb2f8('0x5c')]['id'];var _0x525e4b=_0x1adee6['body'];var _0x3da60c=0xc8;var _0x4f0a52=null;return db[_0xb2f8('0x7e')]['transaction']({'isolationLevel':db[_0xb2f8('0x7e')][_0xb2f8('0x7f')][_0xb2f8('0x80')]['READ_COMMITTED']},function(_0x3f0485){return db['WhatsappAccount'][_0xb2f8('0x6d')]({'where':{'id':_0x423a34},'transaction':_0x3f0485})[_0xb2f8('0x22')](function(_0x6e063e){if(_0x6e063e){return db[_0xb2f8('0x81')][_0xb2f8('0x39')]({'where':{'WhatsappAccountId':_0x423a34},'transaction':_0x3f0485})['then'](function(){var _0x3ed67d=_[_0xb2f8('0x41')](_0x525e4b,function(_0x2103c1){_0x2103c1['WhatsappAccountId']=_0x423a34;return _0x2103c1;});return db['WhatsappApplication'][_0xb2f8('0x82')](_0x3ed67d,{'transaction':_0x3f0485});});}else{_0x3da60c=0x194;_0x4f0a52=[];}});})[_0xb2f8('0x22')](function(){if(_0x3da60c!==0x194){return db[_0xb2f8('0x81')][_0xb2f8('0x83')]({'where':{'WhatsappAccountId':_0x423a34},'order':'priority'})[_0xb2f8('0x22')](function(_0x289882){_0x4f0a52=_0x289882;});}})[_0xb2f8('0x60')](function(_0x56f275){_0x3da60c=0x1f4;logger['error'](_0x56f275[_0xb2f8('0x3c')]);if(_0x56f275['name']){delete _0x56f275[_0xb2f8('0x3d')];}_0x4f0a52=_0x56f275;})[_0xb2f8('0x84')](function(){if(_0x4f0a52===null){_0x503c87[_0xb2f8('0x2d')](_0x3da60c);}else{if(_0x3da60c===0x1f4){_0x503c87[_0xb2f8('0x2e')](_0x3da60c)[_0xb2f8('0x3e')](_0x4f0a52);}else{_0x503c87[_0xb2f8('0x2e')](_0x3da60c)['json'](_0x4f0a52);}}});};exports[_0xb2f8('0x85')]=function(_0x10aab6,_0x50aab6,_0x563319){var _0xa1c492={};var _0xe6404c={};var _0x5a8921;var _0x3e1faf;return db[_0xb2f8('0x42')]['findOne']({'where':{'id':_0x10aab6['params']['id']}})[_0xb2f8('0x22')](handleEntityNotFound(_0x50aab6,null))[_0xb2f8('0x22')](function(_0x12a01b){if(_0x12a01b){_0x5a8921=_0x12a01b;_0xe6404c[_0xb2f8('0x47')]=_[_0xb2f8('0x49')](db[_0xb2f8('0x81')][_0xb2f8('0x43')]);_0xe6404c['query']=_['keys'](_0x10aab6[_0xb2f8('0x48')]);_0xe6404c[_0xb2f8('0x4a')]=_[_0xb2f8('0x4b')](_0xe6404c[_0xb2f8('0x47')],_0xe6404c[_0xb2f8('0x48')]);_0xa1c492[_0xb2f8('0x4c')]=_[_0xb2f8('0x4b')](_0xe6404c[_0xb2f8('0x47')],qs[_0xb2f8('0x4d')](_0x10aab6[_0xb2f8('0x48')]['fields']));_0xa1c492[_0xb2f8('0x4c')]=_0xa1c492[_0xb2f8('0x4c')]['length']?_0xa1c492[_0xb2f8('0x4c')]:_0xe6404c['model'];_0xa1c492['order']=qs['sort'](_0x10aab6[_0xb2f8('0x48')][_0xb2f8('0x51')]);_0xa1c492[_0xb2f8('0x52')]=qs[_0xb2f8('0x4a')](_[_0xb2f8('0x53')](_0x10aab6['query'],_0xe6404c[_0xb2f8('0x4a')]));if(_0x10aab6['query'][_0xb2f8('0x54')]){_0xa1c492[_0xb2f8('0x52')]=_[_0xb2f8('0x55')](_0xa1c492[_0xb2f8('0x52')],{'$or':_[_0xb2f8('0x41')](_0xa1c492[_0xb2f8('0x4c')],function(_0x5f4a6a){var _0x5b0038={};_0x5b0038[_0x5f4a6a]={'$like':'%'+_0x10aab6[_0xb2f8('0x48')][_0xb2f8('0x54')]+'%'};return _0x5b0038;})});}_0xa1c492=_[_0xb2f8('0x55')]({},_0xa1c492,_0x10aab6[_0xb2f8('0x5e')]);return _0x5a8921[_0xb2f8('0x85')](_0xa1c492);}})[_0xb2f8('0x22')](function(_0x518902){if(_0x518902){_0x3e1faf=_0x518902[_0xb2f8('0x4e')];if(!_0x10aab6[_0xb2f8('0x48')][_0xb2f8('0x4f')](_0xb2f8('0x6f'))){_0xa1c492['limit']=qs['limit'](_0x10aab6[_0xb2f8('0x48')][_0xb2f8('0x32')]);_0xa1c492['offset']=qs[_0xb2f8('0x33')](_0x10aab6[_0xb2f8('0x48')]['offset']);}return _0x5a8921['getApplications'](_0xa1c492);}})[_0xb2f8('0x22')](function(_0x33697f){if(_0x33697f){return _0x33697f?{'count':_0x3e1faf,'rows':_0x33697f}:null;}})[_0xb2f8('0x22')](respondWithResult(_0x50aab6,null))[_0xb2f8('0x60')](handleError(_0x50aab6,null));};exports[_0xb2f8('0x86')]=function(_0x48cd26,_0x2595eb,_0x464649){var _0x453c07={'channel':_0xb2f8('0x87')};var _0x10d574=[];var _0x3d6fa5=[];var _0x4a2a6e={};return db['WhatsappAccount'][_0xb2f8('0x5f')]({'where':{'id':_0x48cd26[_0xb2f8('0x5c')]['id']},'include':[{'model':db[_0xb2f8('0x81')],'as':_0xb2f8('0x88')}]})[_0xb2f8('0x22')](handleEntityNotFound(_0x2595eb,null))[_0xb2f8('0x22')](function(_0x5d6c41){_0x453c07[_0xb2f8('0x89')]=_0x5d6c41;if(_0x453c07[_0xb2f8('0x89')]&&_0x453c07['account'][_0xb2f8('0x45')]===_0xb2f8('0x8a')&&_0x48cd26[_0xb2f8('0x68')][_0xb2f8('0x8b')]){if(_0x48cd26['body']['statuses'][_0xb2f8('0x4e')]===0x0)return;if(_0x48cd26[_0xb2f8('0x68')]['statuses'][0x0][_0xb2f8('0x8c')]!==_0xb2f8('0x8d'))return;return db['WhatsappMessage'][_0xb2f8('0x38')]({'read':!![],'readAt':_0x48cd26[_0xb2f8('0x68')]['statuses'][0x0][_0xb2f8('0x8e')]},{'where':{'messageId':_0x48cd26[_0xb2f8('0x68')][_0xb2f8('0x8b')][0x0][_0xb2f8('0x8f')]},'individualHooks':!![]})[_0xb2f8('0x22')](function(_0x2f5e66){return _0x2595eb[_0xb2f8('0x2e')](0xc8)['json'](_0x2f5e66);});}_0x453c07[_0xb2f8('0x90')]=_[_0xb2f8('0x91')](_0x5d6c41[_0xb2f8('0x88')],[_0xb2f8('0x92')],[_0xb2f8('0x93')]);if(_0x453c07['account'][_0xb2f8('0x88')]){delete _0x453c07[_0xb2f8('0x89')][_0xb2f8('0x88')];}return db[_0xb2f8('0x94')][_0xb2f8('0x69')]()[_0xb2f8('0x22')](function(_0x365cd6){if(!_0x365cd6){throw new db[(_0xb2f8('0x95'))][(_0xb2f8('0x96'))](_0xb2f8('0x97'));}_0x10d574=_[_0xb2f8('0x98')](_['keys'](_0x365cd6),[_0xb2f8('0x99'),_0xb2f8('0x9a')]);_0x3d6fa5=_[_0xb2f8('0x98')](_['keys'](_0x365cd6),[_0xb2f8('0x99'),_0xb2f8('0x9a'),_0xb2f8('0x9b'),_0xb2f8('0x9c')]);_0x453c07[_0xb2f8('0x68')]={'mapKey':_0xb2f8('0x9d')};if(_0x453c07['account']&&_0x453c07['account'][_0xb2f8('0x45')]===_0xb2f8('0x9e')){_0x453c07[_0xb2f8('0x68')]['from']=_0x48cd26[_0xb2f8('0x68')][_0xb2f8('0x9f')][_0xb2f8('0xa0')]('whatsapp:','');_0x453c07[_0xb2f8('0x68')][_0xb2f8('0x68')]=_0x48cd26[_0xb2f8('0x68')]['Body'];_0x453c07[_0xb2f8('0x68')][_0xb2f8('0xa1')]=_0x48cd26[_0xb2f8('0x68')][_0xb2f8('0xa2')];}if(_0x453c07[_0xb2f8('0x89')]&&_0x453c07['account'][_0xb2f8('0x45')]==='sinch'){_0x453c07[_0xb2f8('0x68')]['from']=_0x48cd26[_0xb2f8('0x68')][_0xb2f8('0xa3')][0x0][_0xb2f8('0xa4')];_0x453c07['body'][_0xb2f8('0x68')]=_0x48cd26[_0xb2f8('0x68')]['notifications'][0x0][_0xb2f8('0x2a')][_0xb2f8('0x68')];_0x453c07['body']['messageId']=_0x48cd26[_0xb2f8('0x68')]['notifications'][0x0][_0xb2f8('0x8f')];}if(_0x453c07['body']['id']){delete _0x453c07['body']['id'];}if(_[_0xb2f8('0xa5')](_0x453c07[_0xb2f8('0x68')][_0xb2f8('0xa4')])){throw new db[(_0xb2f8('0x95'))][(_0xb2f8('0x96'))](_0xb2f8('0xa6'));}if(_['isNil'](_0x453c07[_0xb2f8('0x68')][_0xb2f8('0x68')])||_0x453c07[_0xb2f8('0x68')][_0xb2f8('0x68')]===''){throw new db[(_0xb2f8('0x95'))]['ValidationError'](_0xb2f8('0xa7'));}if(_['isNil'](_0x453c07['body'][_0xb2f8('0xa8')])){throw new db[(_0xb2f8('0x95'))][(_0xb2f8('0x96'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d6fa5);}if(!_[_0xb2f8('0xa9')](_0x3d6fa5,_0x453c07[_0xb2f8('0x68')][_0xb2f8('0xa8')])){throw new db['Sequelize'][(_0xb2f8('0x96'))](_0xb2f8('0xaa')+_0x3d6fa5);}_0x4a2a6e[_0x453c07[_0xb2f8('0x68')]['mapKey']]=_0x453c07['body'][_0xb2f8('0xa4')];return db[_0xb2f8('0xab')][_0xb2f8('0x5f')]({'where':{'id':_0x453c07[_0xb2f8('0x89')][_0xb2f8('0x9c')]},'include':[{'model':db[_0xb2f8('0x94')],'as':_0xb2f8('0xac'),'where':_0x4a2a6e,'limit':0x1,'order':[[_0xb2f8('0x9a'),'DESC']]}]});})[_0xb2f8('0x22')](handleEntityNotFound(_0x2595eb,null))['then'](function(_0x3f730a){if(_0x3f730a){_0x453c07[_0xb2f8('0xad')]=_['omit'](_0x3f730a,[_0xb2f8('0xac')]);if(_0x3f730a[_0xb2f8('0xac')][_0xb2f8('0x4e')]){return _0x3f730a['Contacts'][0x0];}var _0x475f6e=_[_0xb2f8('0x1c')](_0x453c07[_0xb2f8('0x68')],{'firstName':_0x453c07['body']['from'],'ListId':_0x3f730a['id']});_0x475f6e[_0x453c07[_0xb2f8('0x68')][_0xb2f8('0xa8')]]=_0x453c07[_0xb2f8('0x68')][_0xb2f8('0xa4')];return db['CmContact']['create'](_0x475f6e,{'fields':_0x10d574,'raw':!![]});}})['then'](handleEntityNotFound(_0x2595eb,null))[_0xb2f8('0x22')](function(_0x381ef8){if(_0x381ef8){_0x453c07['contact']=_0x381ef8;var _0x12f498={'ContactId':_0x381ef8['id'],'phone':_0x453c07[_0xb2f8('0x68')]['from'],'WhatsappAccountId':_0x48cd26['params']['id']};var _0x4297ac={'ContactId':_0x381ef8['id'],'WhatsappAccountId':_0x48cd26[_0xb2f8('0x5c')]['id'],'closed':![]};return db[_0xb2f8('0xae')]['find']({'where':_0x4297ac})['then'](function(_0x28c8a9){if(_0x28c8a9){return[_0x28c8a9,![]];}return db[_0xb2f8('0xae')][_0xb2f8('0x67')](_0x12f498)['then'](function(_0xa46ced){return[_0xa46ced,!![]];});});}})[_0xb2f8('0x77')](function(_0xb3ead3,_0x895bed){_0x453c07['interaction']=_0xb3ead3['get']({'plain':!![]});_0x453c07[_0xb2f8('0xaf')][_0xb2f8('0xb0')]=![];if(_0x895bed){if(_0x453c07[_0xb2f8('0x89')][_0xb2f8('0xb1')]){_0x453c07[_0xb2f8('0x90')][_0xb2f8('0xb2')]({'id':0x0,'priority':_0x453c07['applications']['length']+0x1,'app':_0xb2f8('0xb3'),'appdata':_0xb2f8('0xb4'),'interval':_0xb2f8('0xb5')});}_0x453c07[_0xb2f8('0xaf')][_0xb2f8('0xb0')]=!![];}return db[_0xb2f8('0xb6')][_0xb2f8('0x67')]({'phone':_0x453c07[_0xb2f8('0x68')][_0xb2f8('0xa4')],'messageId':_0x453c07[_0xb2f8('0x68')][_0xb2f8('0xa1')],'body':_0x453c07[_0xb2f8('0x68')][_0xb2f8('0x68')],'WhatsappAccountId':_0x48cd26['params']['id'],'WhatsappInteractionId':_0xb3ead3['id'],'direction':'in','ContactId':_0xb3ead3['ContactId'],'AttachmentId':_0x453c07[_0xb2f8('0x68')]['AttachmentId']});})[_0xb2f8('0x22')](function(_0x30ac46){_0x453c07[_0xb2f8('0x2a')]=_0x30ac46;if(!_0x453c07[_0xb2f8('0xaf')][_0xb2f8('0xb7')])return;return db[_0xb2f8('0x7c')][_0xb2f8('0x5f')]({'attributes':['id',_0xb2f8('0x3d')],'where':{'id':_0x453c07[_0xb2f8('0xaf')][_0xb2f8('0xb7')]}});})[_0xb2f8('0x22')](function(_0x534bfb){if(_0x534bfb){_0x453c07[_0xb2f8('0x90')][_0xb2f8('0xb8')]({'id':0x0,'priority':0x0,'app':_0xb2f8('0xb9'),'appdata':_0x534bfb[_0xb2f8('0x3d')]+','+(_0x453c07[_0xb2f8('0x89')][_0xb2f8('0xba')]||0xa),'interval':_0xb2f8('0xb5')});}if(!_0x453c07[_0xb2f8('0xaf')][_0xb2f8('0xbb')])return;return db[_0xb2f8('0xbc')]['find']({'attributes':['id',_0xb2f8('0x3d')],'where':{'id':_0x453c07[_0xb2f8('0xaf')][_0xb2f8('0xbb')]}});})[_0xb2f8('0x22')](function(_0x52db86){if(_0x52db86){_0x453c07[_0xb2f8('0x90')][_0xb2f8('0xb8')]({'id':0x0,'priority':0x1,'app':_0xb2f8('0xbd'),'appdata':_0x52db86[_0xb2f8('0x3d')]+','+(_0x453c07[_0xb2f8('0x89')][_0xb2f8('0xbe')]||0x12c),'interval':_0xb2f8('0xb5')});}return respondWithRpcPromise('Start','startRouting',_0x453c07);})[_0xb2f8('0x22')](function(_0x7d1d1){if(_0x7d1d1){var _0x3c6b20=0xc8;var _0x11576d=_0xb2f8('0xbf');logger['info'](_0xb2f8('0x25'),_0x11576d,_0x3c6b20,_0xb2f8('0xc0'));logger[_0xb2f8('0x24')](_0xb2f8('0xc1'),_0x11576d,_0x3c6b20,_0xb2f8('0xc0'),JSON['stringify'](_0x7d1d1));if(_0x453c07[_0xb2f8('0x89')]['type']===_0xb2f8('0x9e')){return _0x2595eb[_0xb2f8('0x2e')](_0x3c6b20)[_0xb2f8('0x34')](_0xb2f8('0xc2'),_0xb2f8('0xc3'))[_0xb2f8('0x3e')](_0xb2f8('0xc4'));}else{return _0x2595eb[_0xb2f8('0x2e')](_0x3c6b20)[_0xb2f8('0x30')](_0x7d1d1);}}});})[_0xb2f8('0x60')](handleError(_0x2595eb,null));};exports['send']=function(_0x3979f8,_0x266197,_0x11d68c){var _0x538c38,_0x1930fb,_0x14691c;if(_['isNil'](_0x3979f8[_0xb2f8('0x68')][_0xb2f8('0x68')])||_0x3979f8[_0xb2f8('0x68')][_0xb2f8('0x68')]===''){throw new db[(_0xb2f8('0x95'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3979f8['body']['to'])){throw new db[(_0xb2f8('0x95'))][(_0xb2f8('0x96'))](_0xb2f8('0xc5'));}_0x538c38=_0x3979f8[_0xb2f8('0x68')]['to'];return db[_0xb2f8('0x42')]['find']({'where':{'id':_0x3979f8['params']['id']},'include':[{'model':db['CmList'],'as':_0xb2f8('0xc6'),'include':[{'model':db[_0xb2f8('0x94')],'as':_0xb2f8('0xac'),'where':{'mobile':_0x538c38},'limit':0x1,'order':[[_0xb2f8('0x9a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x266197,null))['then'](function(_0x17f37e){if(_0x17f37e&&_0x17f37e[_0xb2f8('0xc6')]){_0x1930fb=_0x17f37e['get']({'plain':!![]});if(_0x1930fb[_0xb2f8('0xc6')]&&_0x1930fb[_0xb2f8('0xc6')][_0xb2f8('0xac')][_0xb2f8('0x4e')]){return _0x1930fb[_0xb2f8('0xc6')][_0xb2f8('0xac')][0x0];}return db[_0xb2f8('0x94')][_0xb2f8('0x67')](_[_0xb2f8('0x1c')](_0x3979f8[_0xb2f8('0x68')],{'firstName':_0x538c38,'mobile':_0x538c38,'phone':_0x538c38,'ListId':_0x1930fb[_0xb2f8('0x9c')]}));}})[_0xb2f8('0x22')](handleEntityNotFound(_0x266197,null))[_0xb2f8('0x22')](function(_0x49a645){if(_0x49a645){_0x14691c=_0x49a645;return db['WhatsappInteraction'][_0xb2f8('0x5f')]({'where':{'ContactId':_0x14691c['id'],'closed':![],'WhatsappAccountId':_0x1930fb['id']}})[_0xb2f8('0x22')](function(_0x27c601){if(_0x27c601){return[_0x27c601,![]];}return db[_0xb2f8('0xae')][_0xb2f8('0x67')]({'UserId':_0x3979f8[_0xb2f8('0x61')]['id'],'ContactId':_0x14691c['id'],'WhatsappAccountId':_0x1930fb['id'],'phone':_0x538c38,'firstMsgDirection':_0xb2f8('0xc7'),'Messages':[_['merge'](_0x3979f8[_0xb2f8('0x68')],{'read':![],'body':_0x3979f8['body'][_0xb2f8('0x68')],'phone':_0x538c38,'WhatsappAccountId':_0x1930fb['id'],'UserId':_0x3979f8[_0xb2f8('0x61')]['id'],'ContactId':_0x14691c['id']})]},{'include':[{'model':db[_0xb2f8('0xb6')],'as':_0xb2f8('0xc8')}]})[_0xb2f8('0x22')](function(_0x5555ee){return[_0x5555ee,!![]];});});}})[_0xb2f8('0x77')](function(_0x3404c6,_0x5d36b1){if(_0x5d36b1){return _0x3404c6;}return db[_0xb2f8('0xb6')][_0xb2f8('0x67')](_['merge'](_0x3979f8['body'],{'read':![],'body':_0x3979f8[_0xb2f8('0x68')][_0xb2f8('0x68')],'phone':_0x538c38,'WhatsappAccountId':_0x1930fb['id'],'WhatsappInteractionId':_0x3404c6['id'],'UserId':_0x3979f8[_0xb2f8('0x61')]['id'],'ContactId':_0x14691c['id']}))[_0xb2f8('0x22')](function(_0xcfa8ec){_0x3404c6['dataValues'][_0xb2f8('0xc8')]=[];_0x3404c6['dataValues'][_0xb2f8('0xc8')][_0xb2f8('0xb2')](_0xcfa8ec['dataValues']);return _0x3404c6;});})[_0xb2f8('0x22')](respondWithResult(_0x266197,null))['catch'](handleError(_0x266197,null));}; \ No newline at end of file +var _0xd3cc=['queueId','WhatsappQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','result','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','params','Pause','keys','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','sort','rows','removeDispositions','ids','CannedAnswer','getAnswers','options','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','WhatsappApplication','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','timestamp','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','replace','whatsapp:','from','notifications','messageId','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','CmList','ListId','Contacts','DESC','omit','defaults','WhatsappInteraction','interaction','created','push','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','agent','*,*,*,*'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd3cc,0xd4));var _0xcd3c=function(_0xc2c4e3,_0xcd01a8){_0xc2c4e3=_0xc2c4e3-0x0;var _0xb5243d=_0xd3cc[_0xc2c4e3];return _0xb5243d;};'use strict';var emlformat=require(_0xcd3c('0x0'));var rimraf=require(_0xcd3c('0x1'));var zipdir=require(_0xcd3c('0x2'));var jsonpatch=require(_0xcd3c('0x3'));var rp=require(_0xcd3c('0x4'));var moment=require(_0xcd3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcd3c('0x6'));var util=require(_0xcd3c('0x7'));var path=require(_0xcd3c('0x8'));var sox=require(_0xcd3c('0x9'));var csv=require(_0xcd3c('0xa'));var ejs=require(_0xcd3c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd3c('0xc'));var squel=require('squel');var crypto=require(_0xcd3c('0xd'));var jsforce=require(_0xcd3c('0xe'));var deskjs=require(_0xcd3c('0xf'));var toCsv=require(_0xcd3c('0xa'));var querystring=require(_0xcd3c('0x10'));var Papa=require(_0xcd3c('0x11'));var Redis=require(_0xcd3c('0x12'));var authService=require(_0xcd3c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcd3c('0x14'));var hardwareService=require(_0xcd3c('0x15'));var logger=require(_0xcd3c('0x16'))(_0xcd3c('0x17'));var utils=require('../../config/utils');var config=require(_0xcd3c('0x18'));var licenseUtil=require(_0xcd3c('0x19'));var db=require('../../mysqldb')['db'];config[_0xcd3c('0x1a')]=_['defaults'](config[_0xcd3c('0x1a')],{'host':_0xcd3c('0x1b'),'port':0x18eb});var socket=require(_0xcd3c('0x1c'))(new Redis(config[_0xcd3c('0x1a')]));require(_0xcd3c('0x1d'))[_0xcd3c('0x1e')](socket);var jayson=require(_0xcd3c('0x1f'));var client=jayson['client'][_0xcd3c('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2c1836,_0x2da301,_0x4e74d3,_0x156529){return new BPromise(function(_0x8a2a0c,_0x26059e){var _0x4c02f9=_0x156529||client;return _0x4c02f9[_0xcd3c('0x21')](_0x2c1836,_0x4e74d3)[_0xcd3c('0x22')](function(_0x4a4b33){logger[_0xcd3c('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x2da301,_0xcd3c('0x24'));logger[_0xcd3c('0x25')](_0xcd3c('0x26'),_0x2da301,_0xcd3c('0x24'),JSON[_0xcd3c('0x27')](_0x4a4b33));if(_0x4a4b33[_0xcd3c('0x28')]){if(_0x4a4b33['error']['code']===0x1f4){logger[_0xcd3c('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x2da301,_0x4a4b33['error']['message']);return _0x26059e(_0x4a4b33[_0xcd3c('0x28')]['message']);}logger[_0xcd3c('0x28')](_0xcd3c('0x29'),_0x2da301,_0x4a4b33[_0xcd3c('0x28')]['message']);return _0x8a2a0c(_0x4a4b33[_0xcd3c('0x28')]['message']);}else{logger[_0xcd3c('0x23')](_0xcd3c('0x29'),_0x2da301,_0xcd3c('0x24'));_0x8a2a0c(_0x4a4b33[_0xcd3c('0x2a')][_0xcd3c('0x2b')]);}})[_0xcd3c('0x2c')](function(_0x2b8fa8){logger['error'](_0xcd3c('0x29'),_0x2da301,_0x2b8fa8);_0x26059e(_0x2b8fa8);});});}function respondWithStatusCode(_0x4e5349,_0x2c3548){_0x2c3548=_0x2c3548||0xcc;return function(_0x562089){if(_0x562089){return _0x4e5349['sendStatus'](_0x2c3548);}return _0x4e5349[_0xcd3c('0x2d')](_0x2c3548)[_0xcd3c('0x2e')]();};}function respondWithResult(_0x292ad5,_0x465e4f){_0x465e4f=_0x465e4f||0xc8;return function(_0x13f360){if(_0x13f360){return _0x292ad5[_0xcd3c('0x2d')](_0x465e4f)[_0xcd3c('0x2f')](_0x13f360);}};}function respondWithFilteredResult(_0x3ba584,_0x365808){return function(_0x5c3595){if(_0x5c3595){var _0x5dd5b0=typeof _0x365808[_0xcd3c('0x30')]===_0xcd3c('0x31')&&typeof _0x365808[_0xcd3c('0x32')]==='undefined';var _0x23b150=_0x5c3595[_0xcd3c('0x33')];var _0x281243=_0x5dd5b0?0x0:_0x365808['offset'];var _0xa7c744=_0x5dd5b0?_0x5c3595[_0xcd3c('0x33')]:_0x365808['offset']+_0x365808[_0xcd3c('0x32')];var _0xaaedff;if(_0xa7c744>=_0x23b150){_0xa7c744=_0x23b150;_0xaaedff=0xc8;}else{_0xaaedff=0xce;}_0x3ba584[_0xcd3c('0x2d')](_0xaaedff);return _0x3ba584[_0xcd3c('0x34')](_0xcd3c('0x35'),_0x281243+'-'+_0xa7c744+'/'+_0x23b150)[_0xcd3c('0x2f')](_0x5c3595);}return null;};}function patchUpdates(_0x30e75b){return function(_0x1c113d){try{jsonpatch['apply'](_0x1c113d,_0x30e75b,!![]);}catch(_0x28edf4){return BPromise['reject'](_0x28edf4);}return _0x1c113d['save']();};}function saveUpdates(_0x5c77ae,_0xa3c8a1){return function(_0x272f13){if(_0x272f13){return _0x272f13[_0xcd3c('0x36')](_0x5c77ae)[_0xcd3c('0x22')](function(_0x23b9ce){return _0x23b9ce;});}return null;};}function removeEntity(_0x384ff1,_0x580bdf){return function(_0x145c9a){if(_0x145c9a){return _0x145c9a[_0xcd3c('0x37')]()[_0xcd3c('0x22')](function(){var _0x33e735=_0x145c9a[_0xcd3c('0x38')]({'plain':!![]});var _0x5512b1=_0xcd3c('0x39');return db[_0xcd3c('0x3a')][_0xcd3c('0x37')]({'where':{'type':_0x5512b1,'resourceId':_0x33e735['id']}})[_0xcd3c('0x22')](function(){return _0x145c9a;});})[_0xcd3c('0x22')](function(){_0x384ff1[_0xcd3c('0x2d')](0xcc)[_0xcd3c('0x2e')]();});}};}function handleEntityNotFound(_0x90d8cc,_0x1ced8d){return function(_0x43408c){if(!_0x43408c){_0x90d8cc[_0xcd3c('0x3b')](0x194);}return _0x43408c;};}function handleError(_0x991fab,_0x142645){_0x142645=_0x142645||0x1f4;return function(_0xcd8f31){logger['error'](_0xcd8f31[_0xcd3c('0x3c')]);if(_0xcd8f31[_0xcd3c('0x3d')]){delete _0xcd8f31['name'];}_0x991fab[_0xcd3c('0x2d')](_0x142645)[_0xcd3c('0x3e')](_0xcd8f31);};}exports[_0xcd3c('0x3f')]=function(_0x84d27b,_0x29b7da){var _0x478bac={'include':[{'model':db['Pause'],'as':_0xcd3c('0x40')}]},_0x2023c5={},_0x550238={'count':0x0,'rows':[]};var _0xfb24bd=_[_0xcd3c('0x41')](db[_0xcd3c('0x42')][_0xcd3c('0x43')],function(_0xc5e6df){return{'name':_0xc5e6df['fieldName'],'type':_0xc5e6df['type'][_0xcd3c('0x44')]};});_0x2023c5[_0xcd3c('0x45')]=_[_0xcd3c('0x41')](_0xfb24bd,_0xcd3c('0x3d'));_0x2023c5[_0xcd3c('0x46')]=_['keys'](_0x84d27b[_0xcd3c('0x46')]);_0x2023c5[_0xcd3c('0x47')]=_[_0xcd3c('0x48')](_0x2023c5[_0xcd3c('0x45')],_0x2023c5['query']);_0x478bac['attributes']=_[_0xcd3c('0x48')](_0x2023c5[_0xcd3c('0x45')],qs['fields'](_0x84d27b[_0xcd3c('0x46')][_0xcd3c('0x49')]));_0x478bac[_0xcd3c('0x4a')]=_0x478bac['attributes']['length']?_0x478bac[_0xcd3c('0x4a')]:_0x2023c5[_0xcd3c('0x45')];if(!_0x84d27b[_0xcd3c('0x46')][_0xcd3c('0x4b')](_0xcd3c('0x4c'))){_0x478bac[_0xcd3c('0x32')]=qs[_0xcd3c('0x32')](_0x84d27b['query'][_0xcd3c('0x32')]);_0x478bac[_0xcd3c('0x30')]=qs[_0xcd3c('0x30')](_0x84d27b[_0xcd3c('0x46')][_0xcd3c('0x30')]);}_0x478bac[_0xcd3c('0x4d')]=qs['sort'](_0x84d27b[_0xcd3c('0x46')]['sort']);_0x478bac[_0xcd3c('0x4e')]=qs[_0xcd3c('0x47')](_[_0xcd3c('0x4f')](_0x84d27b[_0xcd3c('0x46')],_0x2023c5[_0xcd3c('0x47')]),_0xfb24bd);if(_0x84d27b[_0xcd3c('0x46')][_0xcd3c('0x50')]){_0x478bac[_0xcd3c('0x4e')]=_[_0xcd3c('0x51')](_0x478bac[_0xcd3c('0x4e')],{'$or':_[_0xcd3c('0x41')](_0xfb24bd,function(_0x4162f1){if(_0x4162f1[_0xcd3c('0x52')]!==_0xcd3c('0x53')){var _0x3a2792={};_0x3a2792[_0x4162f1[_0xcd3c('0x3d')]]={'$like':'%'+_0x84d27b['query'][_0xcd3c('0x50')]+'%'};return _0x3a2792;}})});}_0x478bac=_[_0xcd3c('0x51')]({},_0x478bac,_0x84d27b['options']);var _0x1438a5={'where':_0x478bac[_0xcd3c('0x4e')]};return db[_0xcd3c('0x42')][_0xcd3c('0x33')](_0x1438a5)[_0xcd3c('0x22')](function(_0x4c6d33){_0x550238[_0xcd3c('0x33')]=_0x4c6d33;if(_0x84d27b['query'][_0xcd3c('0x54')]){_0x478bac['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x478bac);})[_0xcd3c('0x22')](function(_0x130635){_0x550238['rows']=_0x130635;return _0x550238;})[_0xcd3c('0x22')](respondWithFilteredResult(_0x29b7da,_0x478bac))[_0xcd3c('0x2c')](handleError(_0x29b7da,null));};exports['show']=function(_0x51ef35,_0x2cd39f){var _0x15c3f9={'raw':![],'where':{'id':_0x51ef35[_0xcd3c('0x55')]['id']},'include':[{'model':db[_0xcd3c('0x56')],'as':_0xcd3c('0x40')}]},_0x12c749={};_0x12c749['model']=_[_0xcd3c('0x57')](db[_0xcd3c('0x42')][_0xcd3c('0x43')]);_0x12c749[_0xcd3c('0x46')]=_[_0xcd3c('0x57')](_0x51ef35['query']);_0x12c749[_0xcd3c('0x47')]=_[_0xcd3c('0x48')](_0x12c749[_0xcd3c('0x45')],_0x12c749[_0xcd3c('0x46')]);_0x15c3f9[_0xcd3c('0x4a')]=_[_0xcd3c('0x48')](_0x12c749[_0xcd3c('0x45')],qs[_0xcd3c('0x49')](_0x51ef35[_0xcd3c('0x46')]['fields']));_0x15c3f9[_0xcd3c('0x4a')]=_0x15c3f9[_0xcd3c('0x4a')][_0xcd3c('0x58')]?_0x15c3f9[_0xcd3c('0x4a')]:_0x12c749[_0xcd3c('0x45')];if(_0x51ef35[_0xcd3c('0x46')][_0xcd3c('0x54')]){_0x15c3f9[_0xcd3c('0x59')]=[{'all':!![]}];}_0x15c3f9=_[_0xcd3c('0x51')]({},_0x15c3f9,_0x51ef35['options']);return db[_0xcd3c('0x42')][_0xcd3c('0x5a')](_0x15c3f9)[_0xcd3c('0x22')](handleEntityNotFound(_0x2cd39f,null))[_0xcd3c('0x22')](respondWithResult(_0x2cd39f,null))[_0xcd3c('0x2c')](handleError(_0x2cd39f,null));};exports[_0xcd3c('0x5b')]=function(_0x200481,_0x1988ca){return db[_0xcd3c('0x42')][_0xcd3c('0x5b')](_0x200481['body'],{})['then'](function(_0xf46f12){var _0x3a2f24=_0x200481['user'][_0xcd3c('0x38')]({'plain':!![]});if(!_0x3a2f24)throw new Error(_0xcd3c('0x5c'));if(_0x3a2f24[_0xcd3c('0x5d')]===_0xcd3c('0x5e')){var _0x588cd1=_0xf46f12[_0xcd3c('0x38')]({'plain':!![]});var _0x39267e=_0xcd3c('0x39');return db[_0xcd3c('0x5f')]['find']({'where':{'name':_0x39267e,'userProfileId':_0x3a2f24['userProfileId']},'raw':!![]})[_0xcd3c('0x22')](function(_0x692d99){if(_0x692d99&&_0x692d99[_0xcd3c('0x60')]===0x0){return db['UserProfileResource'][_0xcd3c('0x5b')]({'name':_0x588cd1[_0xcd3c('0x3d')],'resourceId':_0x588cd1['id'],'type':_0x692d99[_0xcd3c('0x3d')],'sectionId':_0x692d99['id']},{})[_0xcd3c('0x22')](function(){return _0xf46f12;});}else{return _0xf46f12;}})[_0xcd3c('0x2c')](function(_0x225284){logger[_0xcd3c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x225284);throw _0x225284;});}return _0xf46f12;})[_0xcd3c('0x22')](respondWithResult(_0x1988ca,0xc9))[_0xcd3c('0x2c')](handleError(_0x1988ca,null));};exports[_0xcd3c('0x36')]=function(_0x1510d1,_0x537ea9){if(_0x1510d1[_0xcd3c('0x61')]['id']){delete _0x1510d1[_0xcd3c('0x61')]['id'];}return db[_0xcd3c('0x42')]['find']({'where':{'id':_0x1510d1[_0xcd3c('0x55')]['id']},'include':[{'model':db[_0xcd3c('0x56')],'as':_0xcd3c('0x40')}]})[_0xcd3c('0x22')](handleEntityNotFound(_0x537ea9,null))[_0xcd3c('0x22')](saveUpdates(_0x1510d1['body'],null))['then'](respondWithResult(_0x537ea9,null))[_0xcd3c('0x2c')](handleError(_0x537ea9,null));};exports['destroy']=function(_0x490cd8,_0xbe928){return db[_0xcd3c('0x42')][_0xcd3c('0x5a')]({'where':{'id':_0x490cd8['params']['id']}})['then'](handleEntityNotFound(_0xbe928,null))[_0xcd3c('0x22')](removeEntity(_0xbe928,null))[_0xcd3c('0x2c')](handleError(_0xbe928,null));};exports[_0xcd3c('0x62')]=function(_0x5a29f1,_0x3287fd){return db['WhatsappAccount'][_0xcd3c('0x62')]()[_0xcd3c('0x22')](respondWithResult(_0x3287fd,null))['catch'](handleError(_0x3287fd,null));};exports[_0xcd3c('0x63')]=function(_0x2508ad,_0x26502b,_0x4816a4){if(_0x2508ad[_0xcd3c('0x61')]['id']){delete _0x2508ad[_0xcd3c('0x61')]['id'];}return db[_0xcd3c('0x42')][_0xcd3c('0x5a')]({'where':{'id':_0x2508ad[_0xcd3c('0x55')]['id']}})['then'](handleEntityNotFound(_0x26502b,null))[_0xcd3c('0x22')](function(_0xec9460){if(_0xec9460){_0x2508ad['body'][_0xcd3c('0x64')]=_0xec9460['id'];return db[_0xcd3c('0x65')][_0xcd3c('0x5b')](_0x2508ad[_0xcd3c('0x61')]);}})[_0xcd3c('0x22')](respondWithResult(_0x26502b,null))[_0xcd3c('0x2c')](handleError(_0x26502b,null));};exports[_0xcd3c('0x66')]=function(_0x513f76,_0x2aad10,_0x2024ba){var _0x3f7bb9={'raw':![],'where':{}};var _0x357511={};var _0x2795c4={'count':0x0,'rows':[]};return db[_0xcd3c('0x42')][_0xcd3c('0x67')]({'where':{'id':_0x513f76['params']['id']}})[_0xcd3c('0x22')](handleEntityNotFound(_0x2aad10,null))[_0xcd3c('0x22')](function(_0x3e405f){if(_0x3e405f){_0x357511['model']=_[_0xcd3c('0x57')](db['Disposition'][_0xcd3c('0x43')]);_0x357511[_0xcd3c('0x46')]=_[_0xcd3c('0x57')](_0x513f76['query']);_0x357511[_0xcd3c('0x47')]=_[_0xcd3c('0x48')](_0x357511[_0xcd3c('0x45')],_0x357511[_0xcd3c('0x46')]);_0x3f7bb9[_0xcd3c('0x4a')]=_[_0xcd3c('0x48')](_0x357511[_0xcd3c('0x45')],qs[_0xcd3c('0x49')](_0x513f76['query'][_0xcd3c('0x49')]));_0x3f7bb9[_0xcd3c('0x4a')]=_0x3f7bb9['attributes'][_0xcd3c('0x58')]?_0x3f7bb9[_0xcd3c('0x4a')]:_0x357511[_0xcd3c('0x45')];if(!_0x513f76[_0xcd3c('0x46')][_0xcd3c('0x4b')](_0xcd3c('0x4c'))){_0x3f7bb9[_0xcd3c('0x32')]=qs[_0xcd3c('0x32')](_0x513f76[_0xcd3c('0x46')][_0xcd3c('0x32')]);_0x3f7bb9['offset']=qs['offset'](_0x513f76[_0xcd3c('0x46')][_0xcd3c('0x30')]);}_0x3f7bb9['order']=qs[_0xcd3c('0x68')](_0x513f76[_0xcd3c('0x46')]['sort']);_0x3f7bb9[_0xcd3c('0x4e')]=qs[_0xcd3c('0x47')](_[_0xcd3c('0x4f')](_0x513f76[_0xcd3c('0x46')],_0x357511[_0xcd3c('0x47')]));_0x3f7bb9['where'][_0xcd3c('0x64')]=_0x3e405f['id'];if(_0x513f76[_0xcd3c('0x46')]['filter']){_0x3f7bb9[_0xcd3c('0x4e')]=_[_0xcd3c('0x51')](_0x3f7bb9[_0xcd3c('0x4e')],{'$or':_['map'](_0x3f7bb9[_0xcd3c('0x4a')],function(_0x4d26c9){var _0x44d23d={};_0x44d23d[_0x4d26c9]={'$like':'%'+_0x513f76[_0xcd3c('0x46')][_0xcd3c('0x50')]+'%'};return _0x44d23d;})});}_0x3f7bb9=_[_0xcd3c('0x51')]({},_0x3f7bb9,_0x513f76['options']);return db[_0xcd3c('0x65')]['count']({'where':_0x3f7bb9['where']})['then'](function(_0x4fd514){_0x2795c4[_0xcd3c('0x33')]=_0x4fd514;if(_0x513f76[_0xcd3c('0x46')][_0xcd3c('0x54')]){_0x3f7bb9[_0xcd3c('0x59')]=[{'all':!![]}];}return db[_0xcd3c('0x65')]['findAll'](_0x3f7bb9);})[_0xcd3c('0x22')](function(_0x19f68d){_0x2795c4[_0xcd3c('0x69')]=_0x19f68d;return _0x2795c4;});}})[_0xcd3c('0x22')](respondWithFilteredResult(_0x2aad10,_0x3f7bb9))['catch'](handleError(_0x2aad10,null));};exports[_0xcd3c('0x6a')]=function(_0x428719,_0x3091b9,_0x1b2874){return db['WhatsappAccount'][_0xcd3c('0x5a')]({'where':{'id':_0x428719[_0xcd3c('0x55')]['id']}})['then'](handleEntityNotFound(_0x3091b9,null))[_0xcd3c('0x22')](function(_0x5532f9){if(_0x5532f9){return _0x5532f9[_0xcd3c('0x6a')](_0x428719['query'][_0xcd3c('0x6b')]);}})[_0xcd3c('0x22')](respondWithStatusCode(_0x3091b9,null))['catch'](handleError(_0x3091b9,null));};exports['addAnswer']=function(_0x6c076f,_0x165700,_0x3c67e2){if(_0x6c076f[_0xcd3c('0x61')]['id']){delete _0x6c076f['body']['id'];}return db[_0xcd3c('0x42')][_0xcd3c('0x5a')]({'where':{'id':_0x6c076f[_0xcd3c('0x55')]['id']}})['then'](handleEntityNotFound(_0x165700,null))[_0xcd3c('0x22')](function(_0x3f809b){if(_0x3f809b){_0x6c076f[_0xcd3c('0x61')][_0xcd3c('0x64')]=_0x3f809b['id'];return db[_0xcd3c('0x6c')][_0xcd3c('0x5b')](_0x6c076f[_0xcd3c('0x61')]);}})[_0xcd3c('0x22')](respondWithResult(_0x165700,null))[_0xcd3c('0x2c')](handleError(_0x165700,null));};exports[_0xcd3c('0x6d')]=function(_0x40c407,_0x4d2c3f,_0x1600dd){var _0x289b53={'raw':![],'where':{}};var _0x2e1d58={};var _0x462279={'count':0x0,'rows':[]};return db[_0xcd3c('0x42')][_0xcd3c('0x67')]({'where':{'id':_0x40c407[_0xcd3c('0x55')]['id']}})[_0xcd3c('0x22')](handleEntityNotFound(_0x4d2c3f,null))[_0xcd3c('0x22')](function(_0x2009b7){if(_0x2009b7){_0x2e1d58['model']=_[_0xcd3c('0x57')](db[_0xcd3c('0x6c')][_0xcd3c('0x43')]);_0x2e1d58[_0xcd3c('0x46')]=_[_0xcd3c('0x57')](_0x40c407['query']);_0x2e1d58[_0xcd3c('0x47')]=_[_0xcd3c('0x48')](_0x2e1d58[_0xcd3c('0x45')],_0x2e1d58[_0xcd3c('0x46')]);_0x289b53[_0xcd3c('0x4a')]=_['intersection'](_0x2e1d58[_0xcd3c('0x45')],qs[_0xcd3c('0x49')](_0x40c407[_0xcd3c('0x46')]['fields']));_0x289b53[_0xcd3c('0x4a')]=_0x289b53[_0xcd3c('0x4a')]['length']?_0x289b53[_0xcd3c('0x4a')]:_0x2e1d58[_0xcd3c('0x45')];if(!_0x40c407[_0xcd3c('0x46')][_0xcd3c('0x4b')](_0xcd3c('0x4c'))){_0x289b53['limit']=qs[_0xcd3c('0x32')](_0x40c407[_0xcd3c('0x46')][_0xcd3c('0x32')]);_0x289b53[_0xcd3c('0x30')]=qs[_0xcd3c('0x30')](_0x40c407[_0xcd3c('0x46')]['offset']);}_0x289b53['order']=qs[_0xcd3c('0x68')](_0x40c407[_0xcd3c('0x46')]['sort']);_0x289b53[_0xcd3c('0x4e')]=qs[_0xcd3c('0x47')](_['pick'](_0x40c407[_0xcd3c('0x46')],_0x2e1d58[_0xcd3c('0x47')]));_0x289b53[_0xcd3c('0x4e')][_0xcd3c('0x64')]=_0x2009b7['id'];if(_0x40c407[_0xcd3c('0x46')][_0xcd3c('0x50')]){_0x289b53[_0xcd3c('0x4e')]=_[_0xcd3c('0x51')](_0x289b53[_0xcd3c('0x4e')],{'$or':_['map'](_0x289b53[_0xcd3c('0x4a')],function(_0x1762e6){var _0x14360a={};_0x14360a[_0x1762e6]={'$like':'%'+_0x40c407[_0xcd3c('0x46')][_0xcd3c('0x50')]+'%'};return _0x14360a;})});}_0x289b53=_[_0xcd3c('0x51')]({},_0x289b53,_0x40c407[_0xcd3c('0x6e')]);return db['CannedAnswer']['count']({'where':_0x289b53['where']})[_0xcd3c('0x22')](function(_0x283185){_0x462279['count']=_0x283185;if(_0x40c407[_0xcd3c('0x46')][_0xcd3c('0x54')]){_0x289b53[_0xcd3c('0x59')]=[{'all':!![]}];}return db[_0xcd3c('0x6c')]['findAll'](_0x289b53);})[_0xcd3c('0x22')](function(_0x213787){_0x462279[_0xcd3c('0x69')]=_0x213787;return _0x462279;});}})[_0xcd3c('0x22')](respondWithFilteredResult(_0x4d2c3f,_0x289b53))[_0xcd3c('0x2c')](handleError(_0x4d2c3f,null));};exports[_0xcd3c('0x6f')]=function(_0x5d7cd7,_0x46df58,_0x5d6eab){return db[_0xcd3c('0x42')][_0xcd3c('0x5a')]({'where':{'id':_0x5d7cd7[_0xcd3c('0x55')]['id']}})['then'](handleEntityNotFound(_0x46df58,null))[_0xcd3c('0x22')](function(_0x538d69){if(_0x538d69){return _0x538d69['removeAnswers'](_0x5d7cd7['query']['ids']);}})[_0xcd3c('0x22')](respondWithStatusCode(_0x46df58,null))['catch'](handleError(_0x46df58,null));};exports[_0xcd3c('0x70')]=function(_0x4ba779,_0x34f546,_0x49bb0a){return db[_0xcd3c('0x42')][_0xcd3c('0x5a')]({'where':{'id':_0x4ba779['params']['id']}})[_0xcd3c('0x22')](handleEntityNotFound(_0x34f546,null))[_0xcd3c('0x22')](function(_0x1c5b80){if(_0x1c5b80){return _0x1c5b80[_0xcd3c('0x70')](_0x4ba779[_0xcd3c('0x61')]['ids'],_['omit'](_0x4ba779[_0xcd3c('0x61')],[_0xcd3c('0x6b'),'id'])||{})[_0xcd3c('0x71')](function(_0x26e9af){for(var _0x458a4d=0x0;_0x458a4d<_0x4ba779['body'][_0xcd3c('0x6b')]['length'];_0x458a4d+=0x1){socket[_0xcd3c('0x72')](_0xcd3c('0x73'),{'UserId':Number(_0x4ba779[_0xcd3c('0x61')]['ids'][_0x458a4d]),'WhatsappAccountId':Number(_0x4ba779[_0xcd3c('0x55')]['id'])});}return _0x26e9af;});}})['then'](respondWithResult(_0x34f546,null))[_0xcd3c('0x2c')](handleError(_0x34f546,null));};exports[_0xcd3c('0x74')]=function(_0x2fe3d7,_0x1ac1f9,_0x5c6737){return db[_0xcd3c('0x42')][_0xcd3c('0x5a')]({'where':{'id':_0x2fe3d7['params']['id']}})[_0xcd3c('0x22')](handleEntityNotFound(_0x1ac1f9,null))[_0xcd3c('0x22')](function(_0x26adc9){if(_0x26adc9){return _0x26adc9[_0xcd3c('0x74')](_0x2fe3d7[_0xcd3c('0x46')]['ids'])[_0xcd3c('0x22')](function(){if(_[_0xcd3c('0x75')](_0x2fe3d7['query']['ids'])){for(var _0x593fdf=0x0;_0x593fdf<_0x2fe3d7['query'][_0xcd3c('0x6b')][_0xcd3c('0x58')];_0x593fdf+=0x1){socket[_0xcd3c('0x72')](_0xcd3c('0x76'),{'UserId':Number(_0x2fe3d7['query'][_0xcd3c('0x6b')][_0x593fdf]),'WhatsappAccountId':Number(_0x2fe3d7[_0xcd3c('0x55')]['id'])});}}else{socket[_0xcd3c('0x72')](_0xcd3c('0x76'),{'UserId':Number(_0x2fe3d7['query'][_0xcd3c('0x6b')]),'WhatsappAccountId':Number(_0x2fe3d7[_0xcd3c('0x55')]['id'])});}});}})[_0xcd3c('0x22')](respondWithStatusCode(_0x1ac1f9,null))[_0xcd3c('0x2c')](handleError(_0x1ac1f9,null));};exports[_0xcd3c('0x77')]=function(_0xf4f5e5,_0x33e54e,_0x7e46e1){var _0x5382bc={};var _0x247002={};var _0x5bda51;var _0x2557f7;return db['WhatsappAccount'][_0xcd3c('0x67')]({'where':{'id':_0xf4f5e5[_0xcd3c('0x55')]['id']}})['then'](handleEntityNotFound(_0x33e54e,null))[_0xcd3c('0x22')](function(_0x2e758b){if(_0x2e758b){_0x5bda51=_0x2e758b;_0x247002[_0xcd3c('0x45')]=_[_0xcd3c('0x57')](db[_0xcd3c('0x78')]['rawAttributes']);_0x247002[_0xcd3c('0x46')]=_[_0xcd3c('0x57')](_0xf4f5e5[_0xcd3c('0x46')]);_0x247002[_0xcd3c('0x47')]=_[_0xcd3c('0x48')](_0x247002[_0xcd3c('0x45')],_0x247002[_0xcd3c('0x46')]);_0x5382bc['attributes']=_['intersection'](_0x247002[_0xcd3c('0x45')],qs[_0xcd3c('0x49')](_0xf4f5e5[_0xcd3c('0x46')][_0xcd3c('0x49')]));_0x5382bc[_0xcd3c('0x4a')]=_0x5382bc['attributes'][_0xcd3c('0x58')]?_0x5382bc[_0xcd3c('0x4a')]:_0x247002[_0xcd3c('0x45')];_0x5382bc[_0xcd3c('0x4d')]=qs['sort'](_0xf4f5e5['query'][_0xcd3c('0x68')]);_0x5382bc[_0xcd3c('0x4e')]=qs[_0xcd3c('0x47')](_[_0xcd3c('0x4f')](_0xf4f5e5['query'],_0x247002['filters']));if(_0xf4f5e5[_0xcd3c('0x46')][_0xcd3c('0x50')]){_0x5382bc[_0xcd3c('0x4e')]=_[_0xcd3c('0x51')](_0x5382bc[_0xcd3c('0x4e')],{'$or':_[_0xcd3c('0x41')](_0x5382bc[_0xcd3c('0x4a')],function(_0x317d6e){var _0x2753fa={};_0x2753fa[_0x317d6e]={'$like':'%'+_0xf4f5e5[_0xcd3c('0x46')][_0xcd3c('0x50')]+'%'};return _0x2753fa;})});}_0x5382bc=_[_0xcd3c('0x51')]({},_0x5382bc,_0xf4f5e5[_0xcd3c('0x6e')]);return _0x5bda51[_0xcd3c('0x77')](_0x5382bc);}})[_0xcd3c('0x22')](function(_0x3c1fd3){if(_0x3c1fd3){_0x2557f7=_0x3c1fd3[_0xcd3c('0x58')];if(!_0xf4f5e5['query']['hasOwnProperty'](_0xcd3c('0x4c'))){_0x5382bc['limit']=qs[_0xcd3c('0x32')](_0xf4f5e5[_0xcd3c('0x46')][_0xcd3c('0x32')]);_0x5382bc[_0xcd3c('0x30')]=qs['offset'](_0xf4f5e5[_0xcd3c('0x46')]['offset']);}return _0x5bda51[_0xcd3c('0x77')](_0x5382bc);}})[_0xcd3c('0x22')](function(_0x154adf){if(_0x154adf){return _0x154adf?{'count':_0x2557f7,'rows':_0x154adf}:null;}})['then'](respondWithResult(_0x33e54e,null))[_0xcd3c('0x2c')](handleError(_0x33e54e,null));};exports[_0xcd3c('0x79')]=function(_0xc0ecff,_0x46341d){var _0x3ca648=_0xc0ecff['params']['id'];var _0x16d413=_0xc0ecff['body'];var _0x26f546=0xc8;var _0xe5a554=null;return db[_0xcd3c('0x7a')][_0xcd3c('0x7b')]({'isolationLevel':db[_0xcd3c('0x7a')][_0xcd3c('0x7c')][_0xcd3c('0x7d')]['READ_COMMITTED']},function(_0x1d3339){return db[_0xcd3c('0x42')]['findOne']({'where':{'id':_0x3ca648},'transaction':_0x1d3339})[_0xcd3c('0x22')](function(_0x7550c){if(_0x7550c){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x3ca648},'transaction':_0x1d3339})[_0xcd3c('0x22')](function(){var _0x406a41=_['map'](_0x16d413,function(_0x259d2c){_0x259d2c[_0xcd3c('0x64')]=_0x3ca648;return _0x259d2c;});return db['WhatsappApplication'][_0xcd3c('0x7e')](_0x406a41,{'transaction':_0x1d3339});});}else{_0x26f546=0x194;_0xe5a554=[];}});})[_0xcd3c('0x22')](function(){if(_0x26f546!==0x194){return db[_0xcd3c('0x7f')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x3ca648},'order':_0xcd3c('0x80')})[_0xcd3c('0x22')](function(_0x8fbac5){_0xe5a554=_0x8fbac5;});}})[_0xcd3c('0x2c')](function(_0x35d27c){_0x26f546=0x1f4;logger['error'](_0x35d27c[_0xcd3c('0x3c')]);if(_0x35d27c[_0xcd3c('0x3d')]){delete _0x35d27c[_0xcd3c('0x3d')];}_0xe5a554=_0x35d27c;})[_0xcd3c('0x81')](function(){if(_0xe5a554===null){_0x46341d[_0xcd3c('0x3b')](_0x26f546);}else{if(_0x26f546===0x1f4){_0x46341d[_0xcd3c('0x2d')](_0x26f546)[_0xcd3c('0x3e')](_0xe5a554);}else{_0x46341d[_0xcd3c('0x2d')](_0x26f546)[_0xcd3c('0x2f')](_0xe5a554);}}});};exports['getApplications']=function(_0x3dbe36,_0x4ca195,_0x4d5f15){var _0x4215da={};var _0x5ed05e={};var _0x354e95;var _0xc08629;return db[_0xcd3c('0x42')][_0xcd3c('0x67')]({'where':{'id':_0x3dbe36['params']['id']}})['then'](handleEntityNotFound(_0x4ca195,null))[_0xcd3c('0x22')](function(_0x15a81e){if(_0x15a81e){_0x354e95=_0x15a81e;_0x5ed05e[_0xcd3c('0x45')]=_['keys'](db['WhatsappApplication'][_0xcd3c('0x43')]);_0x5ed05e[_0xcd3c('0x46')]=_[_0xcd3c('0x57')](_0x3dbe36['query']);_0x5ed05e[_0xcd3c('0x47')]=_['intersection'](_0x5ed05e[_0xcd3c('0x45')],_0x5ed05e[_0xcd3c('0x46')]);_0x4215da[_0xcd3c('0x4a')]=_['intersection'](_0x5ed05e['model'],qs[_0xcd3c('0x49')](_0x3dbe36['query'][_0xcd3c('0x49')]));_0x4215da['attributes']=_0x4215da[_0xcd3c('0x4a')][_0xcd3c('0x58')]?_0x4215da[_0xcd3c('0x4a')]:_0x5ed05e[_0xcd3c('0x45')];_0x4215da[_0xcd3c('0x4d')]=qs[_0xcd3c('0x68')](_0x3dbe36[_0xcd3c('0x46')][_0xcd3c('0x68')]);_0x4215da['where']=qs['filters'](_['pick'](_0x3dbe36[_0xcd3c('0x46')],_0x5ed05e['filters']));if(_0x3dbe36['query'][_0xcd3c('0x50')]){_0x4215da[_0xcd3c('0x4e')]=_[_0xcd3c('0x51')](_0x4215da[_0xcd3c('0x4e')],{'$or':_['map'](_0x4215da[_0xcd3c('0x4a')],function(_0xba759d){var _0x213a4b={};_0x213a4b[_0xba759d]={'$like':'%'+_0x3dbe36[_0xcd3c('0x46')][_0xcd3c('0x50')]+'%'};return _0x213a4b;})});}_0x4215da=_[_0xcd3c('0x51')]({},_0x4215da,_0x3dbe36['options']);return _0x354e95['getApplications'](_0x4215da);}})['then'](function(_0x16b630){if(_0x16b630){_0xc08629=_0x16b630[_0xcd3c('0x58')];if(!_0x3dbe36['query'][_0xcd3c('0x4b')]('nolimit')){_0x4215da[_0xcd3c('0x32')]=qs[_0xcd3c('0x32')](_0x3dbe36[_0xcd3c('0x46')][_0xcd3c('0x32')]);_0x4215da[_0xcd3c('0x30')]=qs[_0xcd3c('0x30')](_0x3dbe36[_0xcd3c('0x46')][_0xcd3c('0x30')]);}return _0x354e95[_0xcd3c('0x82')](_0x4215da);}})[_0xcd3c('0x22')](function(_0x3f55cb){if(_0x3f55cb){return _0x3f55cb?{'count':_0xc08629,'rows':_0x3f55cb}:null;}})[_0xcd3c('0x22')](respondWithResult(_0x4ca195,null))[_0xcd3c('0x2c')](handleError(_0x4ca195,null));};exports[_0xcd3c('0x83')]=function(_0x22f8f0,_0x29319f,_0x2b2804){var _0x38a874={'channel':_0xcd3c('0x84')};var _0x462965=[];var _0x6c6546=[];var _0x27a04e={};return db[_0xcd3c('0x42')][_0xcd3c('0x5a')]({'where':{'id':_0x22f8f0['params']['id']},'include':[{'model':db[_0xcd3c('0x7f')],'as':_0xcd3c('0x85')}]})[_0xcd3c('0x22')](handleEntityNotFound(_0x29319f,null))['then'](function(_0x1dfdce){_0x38a874[_0xcd3c('0x86')]=_0x1dfdce;if(_0x38a874[_0xcd3c('0x86')]&&_0x38a874['account'][_0xcd3c('0x52')]===_0xcd3c('0x87')&&_0x22f8f0[_0xcd3c('0x61')][_0xcd3c('0x88')]){if(_0x22f8f0['body']['statuses'][_0xcd3c('0x58')]===0x0)return;if(_0x22f8f0[_0xcd3c('0x61')][_0xcd3c('0x88')][0x0][_0xcd3c('0x89')]!=='read')return;return db['WhatsappMessage'][_0xcd3c('0x36')]({'read':!![],'readAt':_0x22f8f0[_0xcd3c('0x61')][_0xcd3c('0x88')][0x0][_0xcd3c('0x8a')]},{'where':{'messageId':_0x22f8f0[_0xcd3c('0x61')][_0xcd3c('0x88')][0x0]['message_id']},'individualHooks':!![]})[_0xcd3c('0x22')](function(_0x551365){return _0x29319f[_0xcd3c('0x2d')](0xc8)['json'](_0x551365);});}_0x38a874[_0xcd3c('0x8b')]=_[_0xcd3c('0x8c')](_0x1dfdce[_0xcd3c('0x85')],[_0xcd3c('0x80')],['asc']);if(_0x38a874['account'][_0xcd3c('0x85')]){delete _0x38a874[_0xcd3c('0x86')][_0xcd3c('0x85')];}return db[_0xcd3c('0x8d')]['describe']()[_0xcd3c('0x22')](function(_0xe1bd63){if(!_0xe1bd63){throw new db[(_0xcd3c('0x8e'))][(_0xcd3c('0x8f'))](_0xcd3c('0x90'));}_0x462965=_[_0xcd3c('0x91')](_[_0xcd3c('0x57')](_0xe1bd63),[_0xcd3c('0x92'),_0xcd3c('0x93')]);_0x6c6546=_['difference'](_['keys'](_0xe1bd63),[_0xcd3c('0x92'),'updatedAt',_0xcd3c('0x94'),'ListId']);_0x38a874[_0xcd3c('0x61')]={'mapKey':_0xcd3c('0x95')};if(_0x38a874[_0xcd3c('0x86')]&&_0x38a874[_0xcd3c('0x86')][_0xcd3c('0x52')]===_0xcd3c('0x96')){_0x38a874[_0xcd3c('0x61')]['from']=_0x22f8f0[_0xcd3c('0x61')]['From'][_0xcd3c('0x97')](_0xcd3c('0x98'),'');_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x61')]=_0x22f8f0[_0xcd3c('0x61')]['Body'];_0x38a874[_0xcd3c('0x61')]['messageId']=_0x22f8f0[_0xcd3c('0x61')]['MessageSid'];}if(_0x38a874['account']&&_0x38a874['account']['type']===_0xcd3c('0x87')){_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x99')]=_0x22f8f0[_0xcd3c('0x61')][_0xcd3c('0x9a')][0x0]['from'];_0x38a874['body']['body']=_0x22f8f0[_0xcd3c('0x61')][_0xcd3c('0x9a')][0x0][_0xcd3c('0x2b')]['body'];_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x9b')]=_0x22f8f0[_0xcd3c('0x61')][_0xcd3c('0x9a')][0x0]['message_id'];}if(_0x38a874['body']['id']){delete _0x38a874['body']['id'];}if(_['isNil'](_0x38a874[_0xcd3c('0x61')]['from'])){throw new db['Sequelize']['ValidationError'](_0xcd3c('0x9c'));}if(_[_0xcd3c('0x9d')](_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x61')])||_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x61')]===''){throw new db['Sequelize'][(_0xcd3c('0x8f'))](_0xcd3c('0x9e'));}if(_[_0xcd3c('0x9d')](_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x9f')])){throw new db['Sequelize'][(_0xcd3c('0x8f'))](_0xcd3c('0xa0')+_0x6c6546);}if(!_['includes'](_0x6c6546,_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x9f')])){throw new db[(_0xcd3c('0x8e'))][(_0xcd3c('0x8f'))](_0xcd3c('0xa1')+_0x6c6546);}_0x27a04e[_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x9f')]]=_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x99')];return db[_0xcd3c('0xa2')][_0xcd3c('0x5a')]({'where':{'id':_0x38a874[_0xcd3c('0x86')][_0xcd3c('0xa3')]},'include':[{'model':db['CmContact'],'as':_0xcd3c('0xa4'),'where':_0x27a04e,'limit':0x1,'order':[[_0xcd3c('0x93'),_0xcd3c('0xa5')]]}]});})['then'](handleEntityNotFound(_0x29319f,null))[_0xcd3c('0x22')](function(_0x1e052f){if(_0x1e052f){_0x38a874['list']=_[_0xcd3c('0xa6')](_0x1e052f,[_0xcd3c('0xa4')]);if(_0x1e052f[_0xcd3c('0xa4')][_0xcd3c('0x58')]){return _0x1e052f[_0xcd3c('0xa4')][0x0];}var _0x3b0d43=_[_0xcd3c('0xa7')](_0x38a874['body'],{'firstName':_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x99')],'ListId':_0x1e052f['id']});_0x3b0d43[_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x9f')]]=_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x99')];return db[_0xcd3c('0x8d')][_0xcd3c('0x5b')](_0x3b0d43,{'fields':_0x462965,'raw':!![]});}})['then'](handleEntityNotFound(_0x29319f,null))[_0xcd3c('0x22')](function(_0x440404){if(_0x440404){_0x38a874['contact']=_0x440404;var _0x1c904c={'ContactId':_0x440404['id'],'phone':_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x99')],'WhatsappAccountId':_0x22f8f0[_0xcd3c('0x55')]['id']};var _0x110ea7={'ContactId':_0x440404['id'],'WhatsappAccountId':_0x22f8f0[_0xcd3c('0x55')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xcd3c('0x5a')]({'where':_0x110ea7})['then'](function(_0x3438d1){if(_0x3438d1){return[_0x3438d1,![]];}return db[_0xcd3c('0xa8')][_0xcd3c('0x5b')](_0x1c904c)[_0xcd3c('0x22')](function(_0xd6a9fc){return[_0xd6a9fc,!![]];});});}})[_0xcd3c('0x71')](function(_0x31074f,_0x181562){_0x38a874['interaction']=_0x31074f['get']({'plain':!![]});_0x38a874[_0xcd3c('0xa9')][_0xcd3c('0xaa')]=![];if(_0x181562){if(_0x38a874['account']['autoclose']){_0x38a874['applications'][_0xcd3c('0xab')]({'id':0x0,'priority':_0x38a874[_0xcd3c('0x8b')][_0xcd3c('0x58')]+0x1,'app':_0xcd3c('0xac'),'appdata':_0xcd3c('0xad'),'interval':'*,*,*,*'});}_0x38a874[_0xcd3c('0xa9')][_0xcd3c('0xaa')]=!![];}return db[_0xcd3c('0xae')][_0xcd3c('0x5b')]({'phone':_0x38a874['body'][_0xcd3c('0x99')],'messageId':_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x9b')],'body':_0x38a874[_0xcd3c('0x61')][_0xcd3c('0x61')],'WhatsappAccountId':_0x22f8f0[_0xcd3c('0x55')]['id'],'WhatsappInteractionId':_0x31074f['id'],'direction':'in','ContactId':_0x31074f[_0xcd3c('0xaf')],'AttachmentId':_0x38a874[_0xcd3c('0x61')][_0xcd3c('0xb0')]});})[_0xcd3c('0x22')](function(_0x14ca33){_0x38a874['message']=_0x14ca33;if(!_0x38a874[_0xcd3c('0xa9')][_0xcd3c('0xb1')])return;return db[_0xcd3c('0x78')][_0xcd3c('0x5a')]({'attributes':['id','name'],'where':{'id':_0x38a874[_0xcd3c('0xa9')][_0xcd3c('0xb1')]}});})['then'](function(_0x438d41){if(_0x438d41){_0x38a874['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xcd3c('0xb2'),'appdata':_0x438d41[_0xcd3c('0x3d')]+','+(_0x38a874[_0xcd3c('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0xcd3c('0xb3')});}if(!_0x38a874['interaction'][_0xcd3c('0xb4')])return;return db[_0xcd3c('0xb5')][_0xcd3c('0x5a')]({'attributes':['id',_0xcd3c('0x3d')],'where':{'id':_0x38a874['interaction'][_0xcd3c('0xb4')]}});})[_0xcd3c('0x22')](function(_0x505b72){if(_0x505b72){_0x38a874[_0xcd3c('0x8b')][_0xcd3c('0xb6')]({'id':0x0,'priority':0x1,'app':_0xcd3c('0xb7'),'appdata':_0x505b72[_0xcd3c('0x3d')]+','+(_0x38a874[_0xcd3c('0x86')][_0xcd3c('0xb8')]||0x12c),'interval':_0xcd3c('0xb3')});}return respondWithRpcPromise(_0xcd3c('0xb9'),_0xcd3c('0xba'),_0x38a874);})['then'](function(_0x39297a){if(_0x39297a){var _0x56cabb=0xc8;var _0x39ce7d=_0xcd3c('0xbb');logger[_0xcd3c('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x39ce7d,_0x56cabb,_0xcd3c('0xbc'));logger[_0xcd3c('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x39ce7d,_0x56cabb,_0xcd3c('0xbc'),JSON['stringify'](_0x39297a));if(_0x38a874[_0xcd3c('0x86')][_0xcd3c('0x52')]===_0xcd3c('0x96')){return _0x29319f['status'](_0x56cabb)['set'](_0xcd3c('0xbd'),'text/xml')['send'](_0xcd3c('0xbe'));}else{return _0x29319f[_0xcd3c('0x2d')](_0x56cabb)[_0xcd3c('0x2f')](_0x39297a);}}});})[_0xcd3c('0x2c')](handleError(_0x29319f,null));};exports[_0xcd3c('0x3e')]=function(_0x253c5f,_0x30a7bc,_0x2c7468){var _0x4b9419,_0x55f998,_0x573fdf;if(_[_0xcd3c('0x9d')](_0x253c5f[_0xcd3c('0x61')][_0xcd3c('0x61')])||_0x253c5f[_0xcd3c('0x61')]['body']===''){throw new db[(_0xcd3c('0x8e'))][(_0xcd3c('0x8f'))](_0xcd3c('0x9e'));}if(_[_0xcd3c('0x9d')](_0x253c5f[_0xcd3c('0x61')]['to'])){throw new db[(_0xcd3c('0x8e'))][(_0xcd3c('0x8f'))](_0xcd3c('0xbf'));}_0x4b9419=_0x253c5f['body']['to'];return db[_0xcd3c('0x42')][_0xcd3c('0x5a')]({'where':{'id':_0x253c5f[_0xcd3c('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xcd3c('0x8d')],'as':'Contacts','where':{'mobile':_0x4b9419},'limit':0x1,'order':[[_0xcd3c('0x93'),_0xcd3c('0xa5')]]}]}]})[_0xcd3c('0x22')](handleEntityNotFound(_0x30a7bc,null))[_0xcd3c('0x22')](function(_0x342ca1){if(_0x342ca1&&_0x342ca1[_0xcd3c('0xc0')]){_0x55f998=_0x342ca1[_0xcd3c('0x38')]({'plain':!![]});if(_0x55f998[_0xcd3c('0xc0')]&&_0x55f998[_0xcd3c('0xc0')][_0xcd3c('0xa4')][_0xcd3c('0x58')]){return _0x55f998[_0xcd3c('0xc0')][_0xcd3c('0xa4')][0x0];}return db[_0xcd3c('0x8d')][_0xcd3c('0x5b')](_[_0xcd3c('0xa7')](_0x253c5f[_0xcd3c('0x61')],{'firstName':_0x4b9419,'mobile':_0x4b9419,'phone':_0x4b9419,'ListId':_0x55f998[_0xcd3c('0xa3')]}));}})['then'](handleEntityNotFound(_0x30a7bc,null))[_0xcd3c('0x22')](function(_0x25326c){if(_0x25326c){_0x573fdf=_0x25326c;return db[_0xcd3c('0xa8')][_0xcd3c('0x5a')]({'where':{'ContactId':_0x573fdf['id'],'closed':![],'WhatsappAccountId':_0x55f998['id']}})['then'](function(_0x197b7b){if(_0x197b7b){return[_0x197b7b,![]];}return db['WhatsappInteraction'][_0xcd3c('0x5b')]({'UserId':_0x253c5f[_0xcd3c('0x5e')]['id'],'ContactId':_0x573fdf['id'],'WhatsappAccountId':_0x55f998['id'],'phone':_0x4b9419,'firstMsgDirection':_0xcd3c('0xc1'),'Messages':[_[_0xcd3c('0x51')](_0x253c5f[_0xcd3c('0x61')],{'read':![],'body':_0x253c5f[_0xcd3c('0x61')][_0xcd3c('0x61')],'phone':_0x4b9419,'WhatsappAccountId':_0x55f998['id'],'UserId':_0x253c5f[_0xcd3c('0x5e')]['id'],'ContactId':_0x573fdf['id']})]},{'include':[{'model':db[_0xcd3c('0xae')],'as':_0xcd3c('0xc2')}]})[_0xcd3c('0x22')](function(_0x269d46){return[_0x269d46,!![]];});});}})['spread'](function(_0x58ed69,_0x4d1c1f){if(_0x4d1c1f){return _0x58ed69;}return db[_0xcd3c('0xae')]['create'](_[_0xcd3c('0x51')](_0x253c5f[_0xcd3c('0x61')],{'read':![],'body':_0x253c5f[_0xcd3c('0x61')]['body'],'phone':_0x4b9419,'WhatsappAccountId':_0x55f998['id'],'WhatsappInteractionId':_0x58ed69['id'],'UserId':_0x253c5f[_0xcd3c('0x5e')]['id'],'ContactId':_0x573fdf['id']}))[_0xcd3c('0x22')](function(_0x466cb3){_0x58ed69[_0xcd3c('0xc3')][_0xcd3c('0xc2')]=[];_0x58ed69['dataValues'][_0xcd3c('0xc2')]['push'](_0x466cb3['dataValues']);return _0x58ed69;});})[_0xcd3c('0x22')](respondWithResult(_0x30a7bc,null))[_0xcd3c('0x2c')](handleError(_0x30a7bc,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 1bb4d13..d93172a 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 _0x4b69=['WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x4b69,0x9e));var _0x94b6=function(_0x455549,_0x58cf94){_0x455549=_0x455549-0x0;var _0x290c62=_0x4b69[_0x455549];return _0x290c62;};'use strict';var EventEmitter=require(_0x94b6('0x0'));var WhatsappAccount=require(_0x94b6('0x1'))['db'][_0x94b6('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x94b6('0x3')](0x0);var events={'afterCreate':_0x94b6('0x4'),'afterUpdate':_0x94b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x16ef07){return function(_0xcb32a5,_0x23040a,_0x403ebf){WhatsappAccountEvents[_0x94b6('0x6')](_0x16ef07+':'+_0xcb32a5['id'],_0xcb32a5);WhatsappAccountEvents[_0x94b6('0x6')](_0x16ef07,_0xcb32a5);_0x403ebf(null);};}for(var e in events){if(events[_0x94b6('0x7')](e)){var event=events[e];WhatsappAccount[_0x94b6('0x8')](e,emitEvent(event));}}module[_0x94b6('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x17db=['remove','emit','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x4703f1,_0xab71e4){var _0x583347=function(_0x538f5f){while(--_0x538f5f){_0x4703f1['push'](_0x4703f1['shift']());}};_0x583347(++_0xab71e4);}(_0x17db,0x1eb));var _0xb17d=function(_0x356709,_0x4c6bf8){_0x356709=_0x356709-0x0;var _0x291cde=_0x17db[_0x356709];return _0x291cde;};'use strict';var EventEmitter=require(_0xb17d('0x0'));var WhatsappAccount=require(_0xb17d('0x1'))['db'][_0xb17d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb17d('0x3')](0x0);var events={'afterCreate':_0xb17d('0x4'),'afterUpdate':'update','afterDestroy':_0xb17d('0x5')};function emitEvent(_0xbfa5f0){return function(_0x52e290,_0x4da14c,_0x5457b5){WhatsappAccountEvents[_0xb17d('0x6')](_0xbfa5f0+':'+_0x52e290['id'],_0x52e290);WhatsappAccountEvents['emit'](_0xbfa5f0,_0x52e290);_0x5457b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xb17d('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 028e036..0b27aa4 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 _0xa8d7=['bluebird','request-promise','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api'];(function(_0x15cce1,_0x23fae1){var _0x2579f2=function(_0x28c481){while(--_0x28c481){_0x15cce1['push'](_0x15cce1['shift']());}};_0x2579f2(++_0x23fae1);}(_0xa8d7,0x147));var _0x7a8d=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0xa8d7[_0x4f6d08];return _0x53a9c6;};'use strict';var _=require(_0x7a8d('0x0'));var util=require('util');var logger=require(_0x7a8d('0x1'))(_0x7a8d('0x2'));var moment=require('moment');var BPromise=require(_0x7a8d('0x3'));var rp=require(_0x7a8d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a8d('0x5'));var config=require('../../config/environment');var attributes=require(_0x7a8d('0x6'));module['exports']=function(_0x36669b,_0xf09d18){return _0x36669b[_0x7a8d('0x7')](_0x7a8d('0x8'),attributes,{'tableName':_0x7a8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8f9=['request-promise','path','rimraf','exports','define','WhatsappAccount','lodash','util','../../config/logger','api','moment'];(function(_0x34924a,_0x33282f){var _0xb15e40=function(_0xf42cf3){while(--_0xf42cf3){_0x34924a['push'](_0x34924a['shift']());}};_0xb15e40(++_0x33282f);}(_0xe8f9,0x8a));var _0x9e8f=function(_0x1c9a61,_0x2be741){_0x1c9a61=_0x1c9a61-0x0;var _0x209fbe=_0xe8f9[_0x1c9a61];return _0x209fbe;};'use strict';var _=require(_0x9e8f('0x0'));var util=require(_0x9e8f('0x1'));var logger=require(_0x9e8f('0x2'))(_0x9e8f('0x3'));var moment=require(_0x9e8f('0x4'));var BPromise=require('bluebird');var rp=require(_0x9e8f('0x5'));var fs=require('fs');var path=require(_0x9e8f('0x6'));var rimraf=require(_0x9e8f('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x9e8f('0x8')]=function(_0x190769,_0x3366ef){return _0x190769[_0x9e8f('0x9')](_0x9e8f('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 6418bba..4f73814 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 _0x818b=['model','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x818b,0x1ca));var _0xb818=function(_0x44b6cb,_0x2ef17b){_0x44b6cb=_0x44b6cb-0x0;var _0x56b2bb=_0x818b[_0x44b6cb];return _0x56b2bb;};'use strict';var _=require(_0xb818('0x0'));var util=require(_0xb818('0x1'));var moment=require(_0xb818('0x2'));var BPromise=require(_0xb818('0x3'));var rs=require(_0xb818('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb818('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb818('0x6'))(_0xb818('0x7'));var config=require(_0xb818('0x8'));var jayson=require(_0xb818('0x9'));var client=jayson[_0xb818('0xa')][_0xb818('0xb')]({'port':0x232a});config[_0xb818('0xc')]=_[_0xb818('0xd')](config[_0xb818('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb818('0xc')]));require(_0xb818('0xe'))[_0xb818('0xf')](socket);function respondWithRpcPromise(_0x2d9be5,_0xd7339b,_0x72c3d9){return new BPromise(function(_0x3566ac,_0x1f4e0a){return client[_0xb818('0x10')](_0x2d9be5,_0x72c3d9)[_0xb818('0x11')](function(_0x18eb3c){logger[_0xb818('0x12')](_0xb818('0x13'),_0xd7339b,_0xb818('0x14'));logger[_0xb818('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xd7339b,_0xb818('0x14'),JSON[_0xb818('0x16')](_0x18eb3c));if(_0x18eb3c[_0xb818('0x17')]){if(_0x18eb3c[_0xb818('0x17')][_0xb818('0x18')]===0x1f4){logger[_0xb818('0x17')](_0xb818('0x13'),_0xd7339b,_0x18eb3c[_0xb818('0x17')][_0xb818('0x19')]);return _0x1f4e0a(_0x18eb3c[_0xb818('0x17')][_0xb818('0x19')]);}logger[_0xb818('0x17')](_0xb818('0x13'),_0xd7339b,_0x18eb3c['error'][_0xb818('0x19')]);return _0x3566ac(_0x18eb3c['error'][_0xb818('0x19')]);}else{logger['info'](_0xb818('0x13'),_0xd7339b,_0xb818('0x14'));_0x3566ac(_0x18eb3c[_0xb818('0x1a')][_0xb818('0x19')]);}})[_0xb818('0x1b')](function(_0x1176a0){logger['error'](_0xb818('0x13'),_0xd7339b,_0x1176a0);_0x1f4e0a(_0x1176a0);});});}exports[_0xb818('0x1c')]=function(_0x5d76d1){var _0x15ecde=this;return new Promise(function(_0x1fe302,_0x2d0799){return db[_0xb818('0x1d')][_0xb818('0x1e')]({'raw':_0x5d76d1[_0xb818('0x1f')]?_0x5d76d1[_0xb818('0x1f')][_0xb818('0x20')]===undefined?!![]:![]:!![],'where':_0x5d76d1[_0xb818('0x1f')]?_0x5d76d1[_0xb818('0x1f')][_0xb818('0x21')]||null:null,'attributes':_0x5d76d1[_0xb818('0x1f')]?_0x5d76d1[_0xb818('0x1f')][_0xb818('0x22')]||null:null,'include':_0x5d76d1[_0xb818('0x1f')]?_0x5d76d1[_0xb818('0x1f')]['include']?_['map'](_0x5d76d1[_0xb818('0x1f')][_0xb818('0x23')],function(_0x20af87){return{'model':db[_0x20af87[_0xb818('0x24')]],'as':_0x20af87['as'],'attributes':_0x20af87[_0xb818('0x22')],'include':_0x20af87[_0xb818('0x23')]?_[_0xb818('0x25')](_0x20af87['include'],function(_0x29fe9a){return{'model':db[_0x29fe9a[_0xb818('0x24')]],'as':_0x29fe9a['as'],'attributes':_0x29fe9a['attributes'],'include':_0x29fe9a[_0xb818('0x23')]?_[_0xb818('0x25')](_0x29fe9a[_0xb818('0x23')],function(_0x253268){return{'model':db[_0x253268[_0xb818('0x24')]],'as':_0x253268['as'],'attributes':_0x253268[_0xb818('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc2a86d){logger['info'](_0xb818('0x1c'),_0x5d76d1);logger[_0xb818('0x15')](_0xb818('0x1c'),_0x5d76d1,JSON['stringify'](_0xc2a86d));_0x1fe302(_0xc2a86d);})[_0xb818('0x1b')](function(_0x529f9e){logger[_0xb818('0x17')](_0xb818('0x1c'),_0x529f9e[_0xb818('0x19')],_0x5d76d1);_0x2d0799(_0x15ecde[_0xb818('0x17')](0x1f4,_0x529f9e[_0xb818('0x19')]));});});}; \ No newline at end of file +var _0xfe05=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfe05,0x131));var _0x5fe0=function(_0x499bd9,_0x3a41d1){_0x499bd9=_0x499bd9-0x0;var _0x5707aa=_0xfe05[_0x499bd9];return _0x5707aa;};'use strict';var _=require(_0x5fe0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5fe0('0x1'));var rs=require(_0x5fe0('0x2'));var fs=require('fs');var Redis=require(_0x5fe0('0x3'));var db=require(_0x5fe0('0x4'))['db'];var utils=require(_0x5fe0('0x5'));var logger=require(_0x5fe0('0x6'))(_0x5fe0('0x7'));var config=require(_0x5fe0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5fe0('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5fe0('0xa')],{'host':_0x5fe0('0xb'),'port':0x18eb});var socket=require(_0x5fe0('0xc'))(new Redis(config[_0x5fe0('0xa')]));require(_0x5fe0('0xd'))[_0x5fe0('0xe')](socket);function respondWithRpcPromise(_0xb90fc2,_0x8bd6e6,_0xbbbfb7){return new BPromise(function(_0x347f56,_0x2a7096){return client['request'](_0xb90fc2,_0xbbbfb7)[_0x5fe0('0xf')](function(_0x37869f){logger['info'](_0x5fe0('0x10'),_0x8bd6e6,_0x5fe0('0x11'));logger[_0x5fe0('0x12')](_0x5fe0('0x13'),_0x8bd6e6,_0x5fe0('0x11'),JSON[_0x5fe0('0x14')](_0x37869f));if(_0x37869f[_0x5fe0('0x15')]){if(_0x37869f['error'][_0x5fe0('0x16')]===0x1f4){logger[_0x5fe0('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x8bd6e6,_0x37869f['error']['message']);return _0x2a7096(_0x37869f[_0x5fe0('0x15')][_0x5fe0('0x17')]);}logger['error'](_0x5fe0('0x10'),_0x8bd6e6,_0x37869f['error']['message']);return _0x347f56(_0x37869f['error'][_0x5fe0('0x17')]);}else{logger[_0x5fe0('0x18')](_0x5fe0('0x10'),_0x8bd6e6,'request\x20sent');_0x347f56(_0x37869f[_0x5fe0('0x19')]['message']);}})['catch'](function(_0x567358){logger[_0x5fe0('0x15')](_0x5fe0('0x10'),_0x8bd6e6,_0x567358);_0x2a7096(_0x567358);});});}exports[_0x5fe0('0x1a')]=function(_0x1742b0){var _0x334311=this;return new Promise(function(_0x20405d,_0x11e96c){return db[_0x5fe0('0x1b')][_0x5fe0('0x1c')]({'raw':_0x1742b0[_0x5fe0('0x1d')]?_0x1742b0[_0x5fe0('0x1d')][_0x5fe0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1742b0[_0x5fe0('0x1d')]?_0x1742b0[_0x5fe0('0x1d')][_0x5fe0('0x1f')]||null:null,'attributes':_0x1742b0[_0x5fe0('0x1d')]?_0x1742b0[_0x5fe0('0x1d')][_0x5fe0('0x20')]||null:null,'include':_0x1742b0['options']?_0x1742b0[_0x5fe0('0x1d')][_0x5fe0('0x21')]?_[_0x5fe0('0x22')](_0x1742b0['options']['include'],function(_0x37b31d){return{'model':db[_0x37b31d[_0x5fe0('0x23')]],'as':_0x37b31d['as'],'attributes':_0x37b31d[_0x5fe0('0x20')],'include':_0x37b31d[_0x5fe0('0x21')]?_[_0x5fe0('0x22')](_0x37b31d[_0x5fe0('0x21')],function(_0x5d96a0){return{'model':db[_0x5d96a0[_0x5fe0('0x23')]],'as':_0x5d96a0['as'],'attributes':_0x5d96a0['attributes'],'include':_0x5d96a0[_0x5fe0('0x21')]?_['map'](_0x5d96a0[_0x5fe0('0x21')],function(_0x4b32a5){return{'model':db[_0x4b32a5[_0x5fe0('0x23')]],'as':_0x4b32a5['as'],'attributes':_0x4b32a5[_0x5fe0('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x323694){logger[_0x5fe0('0x18')](_0x5fe0('0x1a'),_0x1742b0);logger[_0x5fe0('0x12')]('ShowWhatsappAccount',_0x1742b0,JSON[_0x5fe0('0x14')](_0x323694));_0x20405d(_0x323694);})['catch'](function(_0x4ded7b){logger[_0x5fe0('0x15')](_0x5fe0('0x1a'),_0x4ded7b[_0x5fe0('0x17')],_0x1742b0);_0x11e96c(_0x334311[_0x5fe0('0x15')](0x1f4,_0x4ded7b[_0x5fe0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index a4389dc..ffaf0cb 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 _0xffa3=['remove','update','emit','removeListener','register','whatsappAccount:'];(function(_0x24e016,_0x4edfbc){var _0x432336=function(_0x4a656c){while(--_0x4a656c){_0x24e016['push'](_0x24e016['shift']());}};_0x432336(++_0x4edfbc);}(_0xffa3,0x10e));var _0x3ffa=function(_0x1301b4,_0x2fb602){_0x1301b4=_0x1301b4-0x0;var _0x4252dc=_0xffa3[_0x1301b4];return _0x4252dc;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x3ffa('0x0'),_0x3ffa('0x1')];function createListener(_0x110039,_0x53293a){return function(_0x542286){_0x53293a[_0x3ffa('0x2')](_0x110039,_0x542286);};}function removeListener(_0x5908b3,_0x300b2f){return function(){WhatsappAccountEvents[_0x3ffa('0x3')](_0x5908b3,_0x300b2f);};}exports[_0x3ffa('0x4')]=function(_0x5db54b){for(var _0x400e4a=0x0,_0x240db2=events['length'];_0x400e4a<_0x240db2;_0x400e4a++){var _0x17b5b4=events[_0x400e4a];var _0x3b4fdd=createListener(_0x3ffa('0x5')+_0x17b5b4,_0x5db54b);WhatsappAccountEvents['on'](_0x17b5b4,_0x3b4fdd);}}; \ No newline at end of file +var _0x9390=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x5f0c22,_0x1d5e74){var _0x40a8d6=function(_0x4c6b04){while(--_0x4c6b04){_0x5f0c22['push'](_0x5f0c22['shift']());}};_0x40a8d6(++_0x1d5e74);}(_0x9390,0x1f1));var _0x0939=function(_0x21ad33,_0x1411a7){_0x21ad33=_0x21ad33-0x0;var _0x25eb72=_0x9390[_0x21ad33];return _0x25eb72;};'use strict';var WhatsappAccountEvents=require(_0x0939('0x0'));var events=[_0x0939('0x1'),_0x0939('0x2'),_0x0939('0x3')];function createListener(_0x2e5c80,_0x4d347d){return function(_0x32d5ac){_0x4d347d[_0x0939('0x4')](_0x2e5c80,_0x32d5ac);};}function removeListener(_0x34c2d6,_0x3bb9a3){return function(){WhatsappAccountEvents[_0x0939('0x5')](_0x34c2d6,_0x3bb9a3);};}exports[_0x0939('0x6')]=function(_0x164e12){for(var _0x1648b3=0x0,_0xafa62e=events[_0x0939('0x7')];_0x1648b3<_0xafa62e;_0x1648b3++){var _0x578d2d=events[_0x1648b3];var _0x4fafc5=createListener(_0x0939('0x8')+_0x578d2d,_0x164e12);WhatsappAccountEvents['on'](_0x578d2d,_0x4fafc5);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c5d6e04..cea5420 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 _0xa236=['update','delete','exports','multer','util','connect-timeout','Router','./whatsappApplication.controller','get','isAuthenticated','/:id','show','put'];(function(_0x4f2498,_0x6428e1){var _0xe9a958=function(_0x174154){while(--_0x174154){_0x4f2498['push'](_0x4f2498['shift']());}};_0xe9a958(++_0x6428e1);}(_0xa236,0xe0));var _0x6a23=function(_0x5205ec,_0x85b986){_0x5205ec=_0x5205ec-0x0;var _0x1fbcd6=_0xa236[_0x5205ec];return _0x1fbcd6;};'use strict';var multer=require(_0x6a23('0x0'));var util=require(_0x6a23('0x1'));var path=require('path');var timeout=require(_0x6a23('0x2'));var express=require('express');var router=express[_0x6a23('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6a23('0x4'));router[_0x6a23('0x5')]('/',auth[_0x6a23('0x6')](),controller['index']);router[_0x6a23('0x5')](_0x6a23('0x7'),auth[_0x6a23('0x6')](),controller[_0x6a23('0x8')]);router['post']('/',auth[_0x6a23('0x6')](),controller['create']);router[_0x6a23('0x9')](_0x6a23('0x7'),auth[_0x6a23('0x6')](),controller[_0x6a23('0xa')]);router[_0x6a23('0xb')]('/:id',auth[_0x6a23('0x6')](),controller['destroy']);module[_0x6a23('0xc')]=router; \ No newline at end of file +var _0x0c58=['Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','put','update','destroy','exports','multer','util','express'];(function(_0x42b3e3,_0x3e2593){var _0x622dcb=function(_0xaa400e){while(--_0xaa400e){_0x42b3e3['push'](_0x42b3e3['shift']());}};_0x622dcb(++_0x3e2593);}(_0x0c58,0x1a6));var _0x80c5=function(_0x1180d4,_0xfc5134){_0x1180d4=_0x1180d4-0x0;var _0x3742db=_0x0c58[_0x1180d4];return _0x3742db;};'use strict';var multer=require(_0x80c5('0x0'));var util=require(_0x80c5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x80c5('0x2'));var router=express[_0x80c5('0x3')]();var fs_extra=require(_0x80c5('0x4'));var auth=require(_0x80c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x80c5('0x6'));var controller=require(_0x80c5('0x7'));router[_0x80c5('0x8')]('/',auth[_0x80c5('0x9')](),controller[_0x80c5('0xa')]);router[_0x80c5('0x8')](_0x80c5('0xb'),auth[_0x80c5('0x9')](),controller['show']);router[_0x80c5('0xc')]('/',auth[_0x80c5('0x9')](),controller['create']);router[_0x80c5('0xd')](_0x80c5('0xb'),auth[_0x80c5('0x9')](),controller[_0x80c5('0xe')]);router['delete']('/:id',auth[_0x80c5('0x9')](),controller[_0x80c5('0xf')]);module[_0x80c5('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index db48da7..b8e90c6 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 _0x4ca5=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x4ca5,0x12d));var _0x54ca=function(_0x34bb23,_0x303400){_0x34bb23=_0x34bb23-0x0;var _0x1a1a9b=_0x4ca5[_0x34bb23];return _0x1a1a9b;};'use strict';var Sequelize=require(_0x54ca('0x0'));module[_0x54ca('0x1')]={'priority':{'type':Sequelize[_0x54ca('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x54ca('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x54ca('0x4')],'defaultValue':_0x54ca('0x5')}}; \ No newline at end of file +var _0x256a=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2053ff,_0x4dce3c){var _0x37599c=function(_0x180073){while(--_0x180073){_0x2053ff['push'](_0x2053ff['shift']());}};_0x37599c(++_0x4dce3c);}(_0x256a,0x1dd));var _0xa256=function(_0x219a31,_0x625fc8){_0x219a31=_0x219a31-0x0;var _0x326442=_0x256a[_0x219a31];return _0x326442;};'use strict';var Sequelize=require(_0xa256('0x0'));module[_0xa256('0x1')]={'priority':{'type':Sequelize[_0xa256('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa256('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa256('0x4')]()},'description':{'type':Sequelize[_0xa256('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa256('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 67c24de..f817b8c 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 _0x79a3=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','WhatsappApplication','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring'];(function(_0x2bcaab,_0xd84e77){var _0x1b49ba=function(_0x2c9252){while(--_0x2c9252){_0x2bcaab['push'](_0x2bcaab['shift']());}};_0x1b49ba(++_0xd84e77);}(_0x79a3,0x80));var _0x379a=function(_0x26ed12,_0x4c0151){_0x26ed12=_0x26ed12-0x0;var _0x2fd84c=_0x79a3[_0x26ed12];return _0x2fd84c;};'use strict';var emlformat=require(_0x379a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x379a('0x1'));var jsonpatch=require(_0x379a('0x2'));var rp=require('request-promise');var moment=require(_0x379a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x379a('0x4'));var sox=require(_0x379a('0x5'));var csv=require(_0x379a('0x6'));var ejs=require(_0x379a('0x7'));var fs=require('fs');var fs_extra=require(_0x379a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x379a('0x9'));var deskjs=require(_0x379a('0xa'));var toCsv=require(_0x379a('0x6'));var querystring=require(_0x379a('0xb'));var Papa=require(_0x379a('0xc'));var Redis=require(_0x379a('0xd'));var authService=require(_0x379a('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x379a('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x379a('0x10'));var config=require(_0x379a('0x11'));var licenseUtil=require(_0x379a('0x12'));var db=require(_0x379a('0x13'))['db'];function respondWithStatusCode(_0x4fa4c8,_0x51d2f4){_0x51d2f4=_0x51d2f4||0xcc;return function(_0x4c69a6){if(_0x4c69a6){return _0x4fa4c8[_0x379a('0x14')](_0x51d2f4);}return _0x4fa4c8[_0x379a('0x15')](_0x51d2f4)[_0x379a('0x16')]();};}function respondWithResult(_0x17adab,_0x561cbf){_0x561cbf=_0x561cbf||0xc8;return function(_0x55a38d){if(_0x55a38d){return _0x17adab[_0x379a('0x15')](_0x561cbf)[_0x379a('0x17')](_0x55a38d);}};}function respondWithFilteredResult(_0x3626b0,_0x3651b2){return function(_0x59f698){if(_0x59f698){var _0x56bbd5=typeof _0x3651b2[_0x379a('0x18')]==='undefined'&&typeof _0x3651b2[_0x379a('0x19')]===_0x379a('0x1a');var _0x1c217d=_0x59f698['count'];var _0x48f0a9=_0x56bbd5?0x0:_0x3651b2[_0x379a('0x18')];var _0xd6cc17=_0x56bbd5?_0x59f698['count']:_0x3651b2[_0x379a('0x18')]+_0x3651b2[_0x379a('0x19')];var _0x51d67c;if(_0xd6cc17>=_0x1c217d){_0xd6cc17=_0x1c217d;_0x51d67c=0xc8;}else{_0x51d67c=0xce;}_0x3626b0['status'](_0x51d67c);return _0x3626b0['set'](_0x379a('0x1b'),_0x48f0a9+'-'+_0xd6cc17+'/'+_0x1c217d)['json'](_0x59f698);}return null;};}function patchUpdates(_0x263df8){return function(_0x1cdebe){try{jsonpatch[_0x379a('0x1c')](_0x1cdebe,_0x263df8,!![]);}catch(_0x120997){return BPromise[_0x379a('0x1d')](_0x120997);}return _0x1cdebe[_0x379a('0x1e')]();};}function saveUpdates(_0x1d3f0f,_0x1b1b98){return function(_0x4c0dda){if(_0x4c0dda){return _0x4c0dda[_0x379a('0x1f')](_0x1d3f0f)[_0x379a('0x20')](function(_0x28aedc){return _0x28aedc;});}return null;};}function removeEntity(_0x22737a,_0x31752c){return function(_0x2bf6d8){if(_0x2bf6d8){return _0x2bf6d8[_0x379a('0x21')]()['then'](function(){_0x22737a[_0x379a('0x15')](0xcc)[_0x379a('0x16')]();});}};}function handleEntityNotFound(_0x18bb37,_0x516ddf){return function(_0x483ddd){if(!_0x483ddd){_0x18bb37[_0x379a('0x14')](0x194);}return _0x483ddd;};}function handleError(_0x599efb,_0x13e665){_0x13e665=_0x13e665||0x1f4;return function(_0xc1fc5a){logger['error'](_0xc1fc5a[_0x379a('0x22')]);if(_0xc1fc5a[_0x379a('0x23')]){delete _0xc1fc5a[_0x379a('0x23')];}_0x599efb['status'](_0x13e665)[_0x379a('0x24')](_0xc1fc5a);};}exports['index']=function(_0x2a1765,_0x33d5f7){var _0xa803f7={},_0x3f92b1={},_0x4eed7e={'count':0x0,'rows':[]};var _0x1153e9=_[_0x379a('0x25')](db[_0x379a('0x26')][_0x379a('0x27')],function(_0x30c9ab){return{'name':_0x30c9ab['fieldName'],'type':_0x30c9ab[_0x379a('0x28')][_0x379a('0x29')]};});_0x3f92b1[_0x379a('0x2a')]=_[_0x379a('0x25')](_0x1153e9,_0x379a('0x23'));_0x3f92b1['query']=_[_0x379a('0x2b')](_0x2a1765[_0x379a('0x2c')]);_0x3f92b1[_0x379a('0x2d')]=_[_0x379a('0x2e')](_0x3f92b1[_0x379a('0x2a')],_0x3f92b1[_0x379a('0x2c')]);_0xa803f7['attributes']=_['intersection'](_0x3f92b1[_0x379a('0x2a')],qs['fields'](_0x2a1765[_0x379a('0x2c')][_0x379a('0x2f')]));_0xa803f7[_0x379a('0x30')]=_0xa803f7['attributes']['length']?_0xa803f7[_0x379a('0x30')]:_0x3f92b1[_0x379a('0x2a')];if(!_0x2a1765[_0x379a('0x2c')][_0x379a('0x31')]('nolimit')){_0xa803f7[_0x379a('0x19')]=qs[_0x379a('0x19')](_0x2a1765[_0x379a('0x2c')][_0x379a('0x19')]);_0xa803f7['offset']=qs[_0x379a('0x18')](_0x2a1765[_0x379a('0x2c')][_0x379a('0x18')]);}_0xa803f7[_0x379a('0x32')]=qs[_0x379a('0x33')](_0x2a1765[_0x379a('0x2c')][_0x379a('0x33')]);_0xa803f7[_0x379a('0x34')]=qs[_0x379a('0x2d')](_[_0x379a('0x35')](_0x2a1765['query'],_0x3f92b1[_0x379a('0x2d')]),_0x1153e9);if(_0x2a1765[_0x379a('0x2c')][_0x379a('0x36')]){_0xa803f7['where']=_[_0x379a('0x37')](_0xa803f7[_0x379a('0x34')],{'$or':_['map'](_0x1153e9,function(_0x4c031c){if(_0x4c031c['type']!==_0x379a('0x38')){var _0x1fc9dd={};_0x1fc9dd[_0x4c031c[_0x379a('0x23')]]={'$like':'%'+_0x2a1765['query']['filter']+'%'};return _0x1fc9dd;}})});}_0xa803f7=_['merge']({},_0xa803f7,_0x2a1765[_0x379a('0x39')]);var _0x88df47={'where':_0xa803f7[_0x379a('0x34')]};return db[_0x379a('0x26')][_0x379a('0x3a')](_0x88df47)[_0x379a('0x20')](function(_0x140f5e){_0x4eed7e[_0x379a('0x3a')]=_0x140f5e;if(_0x2a1765[_0x379a('0x2c')][_0x379a('0x3b')]){_0xa803f7['include']=[{'all':!![]}];}return db[_0x379a('0x26')][_0x379a('0x3c')](_0xa803f7);})[_0x379a('0x20')](function(_0x476d7b){_0x4eed7e[_0x379a('0x3d')]=_0x476d7b;return _0x4eed7e;})[_0x379a('0x20')](respondWithFilteredResult(_0x33d5f7,_0xa803f7))[_0x379a('0x3e')](handleError(_0x33d5f7,null));};exports[_0x379a('0x3f')]=function(_0x17b5f3,_0x1d3c66){var _0x2d0e3f={'raw':!![],'where':{'id':_0x17b5f3[_0x379a('0x40')]['id']}},_0x5ada4c={};_0x5ada4c[_0x379a('0x2a')]=_['keys'](db[_0x379a('0x26')][_0x379a('0x27')]);_0x5ada4c[_0x379a('0x2c')]=_['keys'](_0x17b5f3[_0x379a('0x2c')]);_0x5ada4c[_0x379a('0x2d')]=_['intersection'](_0x5ada4c[_0x379a('0x2a')],_0x5ada4c[_0x379a('0x2c')]);_0x2d0e3f[_0x379a('0x30')]=_['intersection'](_0x5ada4c[_0x379a('0x2a')],qs[_0x379a('0x2f')](_0x17b5f3[_0x379a('0x2c')]['fields']));_0x2d0e3f['attributes']=_0x2d0e3f[_0x379a('0x30')][_0x379a('0x41')]?_0x2d0e3f[_0x379a('0x30')]:_0x5ada4c[_0x379a('0x2a')];if(_0x17b5f3['query'][_0x379a('0x3b')]){_0x2d0e3f[_0x379a('0x42')]=[{'all':!![]}];}_0x2d0e3f=_['merge']({},_0x2d0e3f,_0x17b5f3['options']);return db[_0x379a('0x26')][_0x379a('0x43')](_0x2d0e3f)['then'](handleEntityNotFound(_0x1d3c66,null))[_0x379a('0x20')](respondWithResult(_0x1d3c66,null))[_0x379a('0x3e')](handleError(_0x1d3c66,null));};exports[_0x379a('0x44')]=function(_0x1d113c,_0x7abb23){return db[_0x379a('0x26')][_0x379a('0x44')](_0x1d113c[_0x379a('0x45')],{})[_0x379a('0x20')](respondWithResult(_0x7abb23,0xc9))[_0x379a('0x3e')](handleError(_0x7abb23,null));};exports['update']=function(_0x1f75e7,_0xb85859){if(_0x1f75e7[_0x379a('0x45')]['id']){delete _0x1f75e7[_0x379a('0x45')]['id'];}return db[_0x379a('0x26')]['find']({'where':{'id':_0x1f75e7[_0x379a('0x40')]['id']}})[_0x379a('0x20')](handleEntityNotFound(_0xb85859,null))[_0x379a('0x20')](saveUpdates(_0x1f75e7[_0x379a('0x45')],null))[_0x379a('0x20')](respondWithResult(_0xb85859,null))['catch'](handleError(_0xb85859,null));};exports[_0x379a('0x21')]=function(_0x41581a,_0x35cefe){return db[_0x379a('0x26')][_0x379a('0x43')]({'where':{'id':_0x41581a[_0x379a('0x40')]['id']}})[_0x379a('0x20')](handleEntityNotFound(_0x35cefe,null))[_0x379a('0x20')](removeEntity(_0x35cefe,null))[_0x379a('0x3e')](handleError(_0x35cefe,null));}; \ No newline at end of file +var _0x5454=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','catch','create','body','find','params','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'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5454,0x15b));var _0x4545=function(_0x46486a,_0x27147e){_0x46486a=_0x46486a-0x0;var _0x352844=_0x5454[_0x46486a];return _0x352844;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4545('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4545('0x1'));var util=require(_0x4545('0x2'));var path=require(_0x4545('0x3'));var sox=require(_0x4545('0x4'));var csv=require('to-csv');var ejs=require(_0x4545('0x5'));var fs=require('fs');var fs_extra=require(_0x4545('0x6'));var _=require(_0x4545('0x7'));var squel=require(_0x4545('0x8'));var crypto=require(_0x4545('0x9'));var jsforce=require(_0x4545('0xa'));var deskjs=require(_0x4545('0xb'));var toCsv=require(_0x4545('0xc'));var querystring=require(_0x4545('0xd'));var Papa=require(_0x4545('0xe'));var Redis=require(_0x4545('0xf'));var authService=require(_0x4545('0x10'));var qs=require(_0x4545('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4545('0x12'));var logger=require(_0x4545('0x13'))(_0x4545('0x14'));var utils=require(_0x4545('0x15'));var config=require(_0x4545('0x16'));var licenseUtil=require(_0x4545('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3844a3,_0x20a4d8){_0x20a4d8=_0x20a4d8||0xcc;return function(_0x353e42){if(_0x353e42){return _0x3844a3[_0x4545('0x18')](_0x20a4d8);}return _0x3844a3[_0x4545('0x19')](_0x20a4d8)[_0x4545('0x1a')]();};}function respondWithResult(_0x3e7088,_0x347072){_0x347072=_0x347072||0xc8;return function(_0x36bb8e){if(_0x36bb8e){return _0x3e7088[_0x4545('0x19')](_0x347072)[_0x4545('0x1b')](_0x36bb8e);}};}function respondWithFilteredResult(_0x4b5700,_0xb10472){return function(_0x3577f5){if(_0x3577f5){var _0x2416b0=typeof _0xb10472[_0x4545('0x1c')]==='undefined'&&typeof _0xb10472['limit']===_0x4545('0x1d');var _0x29effa=_0x3577f5[_0x4545('0x1e')];var _0x2e13e0=_0x2416b0?0x0:_0xb10472[_0x4545('0x1c')];var _0x33393b=_0x2416b0?_0x3577f5[_0x4545('0x1e')]:_0xb10472[_0x4545('0x1c')]+_0xb10472['limit'];var _0x52a21c;if(_0x33393b>=_0x29effa){_0x33393b=_0x29effa;_0x52a21c=0xc8;}else{_0x52a21c=0xce;}_0x4b5700[_0x4545('0x19')](_0x52a21c);return _0x4b5700['set'](_0x4545('0x1f'),_0x2e13e0+'-'+_0x33393b+'/'+_0x29effa)[_0x4545('0x1b')](_0x3577f5);}return null;};}function patchUpdates(_0x67e408){return function(_0x6b3bc){try{jsonpatch[_0x4545('0x20')](_0x6b3bc,_0x67e408,!![]);}catch(_0x2a39cf){return BPromise[_0x4545('0x21')](_0x2a39cf);}return _0x6b3bc[_0x4545('0x22')]();};}function saveUpdates(_0x550dfb,_0x580b57){return function(_0x431b5d){if(_0x431b5d){return _0x431b5d['update'](_0x550dfb)[_0x4545('0x23')](function(_0x4f8a76){return _0x4f8a76;});}return null;};}function removeEntity(_0x293c18,_0x4c47c0){return function(_0x519489){if(_0x519489){return _0x519489[_0x4545('0x24')]()[_0x4545('0x23')](function(){_0x293c18[_0x4545('0x19')](0xcc)[_0x4545('0x1a')]();});}};}function handleEntityNotFound(_0x344633,_0x39eaa1){return function(_0x43033c){if(!_0x43033c){_0x344633[_0x4545('0x18')](0x194);}return _0x43033c;};}function handleError(_0xac3456,_0x2a6842){_0x2a6842=_0x2a6842||0x1f4;return function(_0x3e5807){logger[_0x4545('0x25')](_0x3e5807[_0x4545('0x26')]);if(_0x3e5807[_0x4545('0x27')]){delete _0x3e5807[_0x4545('0x27')];}_0xac3456[_0x4545('0x19')](_0x2a6842)['send'](_0x3e5807);};}exports[_0x4545('0x28')]=function(_0x2c256b,_0x853476){var _0x394a8e={},_0xb9c5ee={},_0x531250={'count':0x0,'rows':[]};var _0x157fe5=_[_0x4545('0x29')](db[_0x4545('0x2a')][_0x4545('0x2b')],function(_0x1da2a9){return{'name':_0x1da2a9[_0x4545('0x2c')],'type':_0x1da2a9['type'][_0x4545('0x2d')]};});_0xb9c5ee[_0x4545('0x2e')]=_[_0x4545('0x29')](_0x157fe5,_0x4545('0x27'));_0xb9c5ee[_0x4545('0x2f')]=_[_0x4545('0x30')](_0x2c256b[_0x4545('0x2f')]);_0xb9c5ee[_0x4545('0x31')]=_[_0x4545('0x32')](_0xb9c5ee[_0x4545('0x2e')],_0xb9c5ee[_0x4545('0x2f')]);_0x394a8e['attributes']=_[_0x4545('0x32')](_0xb9c5ee['model'],qs[_0x4545('0x33')](_0x2c256b[_0x4545('0x2f')]['fields']));_0x394a8e[_0x4545('0x34')]=_0x394a8e[_0x4545('0x34')][_0x4545('0x35')]?_0x394a8e[_0x4545('0x34')]:_0xb9c5ee[_0x4545('0x2e')];if(!_0x2c256b[_0x4545('0x2f')][_0x4545('0x36')]('nolimit')){_0x394a8e[_0x4545('0x37')]=qs[_0x4545('0x37')](_0x2c256b[_0x4545('0x2f')][_0x4545('0x37')]);_0x394a8e[_0x4545('0x1c')]=qs[_0x4545('0x1c')](_0x2c256b['query'][_0x4545('0x1c')]);}_0x394a8e[_0x4545('0x38')]=qs[_0x4545('0x39')](_0x2c256b[_0x4545('0x2f')][_0x4545('0x39')]);_0x394a8e[_0x4545('0x3a')]=qs[_0x4545('0x31')](_[_0x4545('0x3b')](_0x2c256b[_0x4545('0x2f')],_0xb9c5ee['filters']),_0x157fe5);if(_0x2c256b['query']['filter']){_0x394a8e[_0x4545('0x3a')]=_['merge'](_0x394a8e[_0x4545('0x3a')],{'$or':_[_0x4545('0x29')](_0x157fe5,function(_0x1d19f6){if(_0x1d19f6[_0x4545('0x3c')]!=='VIRTUAL'){var _0x5e54b7={};_0x5e54b7[_0x1d19f6[_0x4545('0x27')]]={'$like':'%'+_0x2c256b['query'][_0x4545('0x3d')]+'%'};return _0x5e54b7;}})});}_0x394a8e=_[_0x4545('0x3e')]({},_0x394a8e,_0x2c256b[_0x4545('0x3f')]);var _0x211092={'where':_0x394a8e[_0x4545('0x3a')]};return db['WhatsappApplication']['count'](_0x211092)[_0x4545('0x23')](function(_0x43c4ce){_0x531250[_0x4545('0x1e')]=_0x43c4ce;if(_0x2c256b['query'][_0x4545('0x40')]){_0x394a8e[_0x4545('0x41')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x4545('0x42')](_0x394a8e);})['then'](function(_0x239246){_0x531250[_0x4545('0x43')]=_0x239246;return _0x531250;})[_0x4545('0x23')](respondWithFilteredResult(_0x853476,_0x394a8e))[_0x4545('0x44')](handleError(_0x853476,null));};exports['show']=function(_0x1ca5d3,_0x632ec1){var _0x3d308e={'raw':!![],'where':{'id':_0x1ca5d3['params']['id']}},_0x299869={};_0x299869['model']=_[_0x4545('0x30')](db['WhatsappApplication'][_0x4545('0x2b')]);_0x299869[_0x4545('0x2f')]=_[_0x4545('0x30')](_0x1ca5d3[_0x4545('0x2f')]);_0x299869[_0x4545('0x31')]=_[_0x4545('0x32')](_0x299869[_0x4545('0x2e')],_0x299869[_0x4545('0x2f')]);_0x3d308e['attributes']=_[_0x4545('0x32')](_0x299869[_0x4545('0x2e')],qs[_0x4545('0x33')](_0x1ca5d3['query'][_0x4545('0x33')]));_0x3d308e[_0x4545('0x34')]=_0x3d308e[_0x4545('0x34')][_0x4545('0x35')]?_0x3d308e[_0x4545('0x34')]:_0x299869[_0x4545('0x2e')];if(_0x1ca5d3[_0x4545('0x2f')][_0x4545('0x40')]){_0x3d308e['include']=[{'all':!![]}];}_0x3d308e=_[_0x4545('0x3e')]({},_0x3d308e,_0x1ca5d3['options']);return db[_0x4545('0x2a')]['find'](_0x3d308e)[_0x4545('0x23')](handleEntityNotFound(_0x632ec1,null))[_0x4545('0x23')](respondWithResult(_0x632ec1,null))[_0x4545('0x44')](handleError(_0x632ec1,null));};exports['create']=function(_0x20f054,_0x2ece03){return db[_0x4545('0x2a')][_0x4545('0x45')](_0x20f054[_0x4545('0x46')],{})[_0x4545('0x23')](respondWithResult(_0x2ece03,0xc9))['catch'](handleError(_0x2ece03,null));};exports['update']=function(_0x499246,_0x563835){if(_0x499246[_0x4545('0x46')]['id']){delete _0x499246[_0x4545('0x46')]['id'];}return db[_0x4545('0x2a')][_0x4545('0x47')]({'where':{'id':_0x499246[_0x4545('0x48')]['id']}})[_0x4545('0x23')](handleEntityNotFound(_0x563835,null))[_0x4545('0x23')](saveUpdates(_0x499246['body'],null))['then'](respondWithResult(_0x563835,null))[_0x4545('0x44')](handleError(_0x563835,null));};exports[_0x4545('0x24')]=function(_0x33a6d2,_0x2946b5){return db[_0x4545('0x2a')][_0x4545('0x47')]({'where':{'id':_0x33a6d2['params']['id']}})[_0x4545('0x23')](handleEntityNotFound(_0x2946b5,null))[_0x4545('0x23')](removeEntity(_0x2946b5,null))['catch'](handleError(_0x2946b5,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ffecb6a..43f3071 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 _0xcb66=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb66,0x19f));var _0x6cb6=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xcb66[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var moment=require(_0x6cb6('0x3'));var BPromise=require(_0x6cb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cb6('0x5'));var rimraf=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var attributes=require(_0x6cb6('0x8'));module[_0x6cb6('0x9')]=function(_0x506d14,_0x53078d){return _0x506d14[_0x6cb6('0xa')](_0x6cb6('0xb'),attributes,{'tableName':_0x6cb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6cb6('0xd'),'collate':_0x6cb6('0xe')});}; \ No newline at end of file +var _0x544a=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x544a,0xbd));var _0xa544=function(_0x4cdbb0,_0x4252f3){_0x4cdbb0=_0x4cdbb0-0x0;var _0xc8b074=_0x544a[_0x4cdbb0];return _0xc8b074;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var logger=require(_0xa544('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa544('0x4'));var rimraf=require(_0xa544('0x5'));var config=require('../../config/environment');var attributes=require(_0xa544('0x6'));module[_0xa544('0x7')]=function(_0x2f5992,_0x15a604){return _0x2f5992[_0xa544('0x8')]('WhatsappApplication',attributes,{'tableName':_0xa544('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa544('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a7447bf..20679a6 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 _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2e24d4,_0x3cad21){var _0x4888ee=function(_0x2a5ba6){while(--_0x2a5ba6){_0x2e24d4['push'](_0x2e24d4['shift']());}};_0x4888ee(++_0x3cad21);}(_0xe14d,0x1ee));var _0xde14=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xe14d[_0x166742];return _0xb7814a;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x1551ac,_0x46d4e7){var _0x216b26=function(_0x36160d){while(--_0x36160d){_0x1551ac['push'](_0x1551ac['shift']());}};_0x216b26(++_0x46d4e7);}(_0x55ca,0x126));var _0xa55c=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x55ca[_0x25df80];return _0x17b6d0;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2d589cb..9fc65b0 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 _0x6596=['whatsappinteraction:destroy','delete','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update'];(function(_0x883955,_0x5c72f2){var _0x238226=function(_0x5eee00){while(--_0x5eee00){_0x883955['push'](_0x883955['shift']());}};_0x238226(++_0x5c72f2);}(_0x6596,0x1d3));var _0x6659=function(_0x594ac0,_0x59e8f1){_0x594ac0=_0x594ac0-0x0;var _0x11f326=_0x6596[_0x594ac0];return _0x11f326;};'use strict';var multer=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var path=require('path');var timeout=require(_0x6659('0x2'));var express=require(_0x6659('0x3'));var router=express[_0x6659('0x4')]();var fs_extra=require(_0x6659('0x5'));var auth=require(_0x6659('0x6'));var interaction=require(_0x6659('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6659('0x8')]('/',auth[_0x6659('0x9')](),controller[_0x6659('0xa')]);router[_0x6659('0x8')](_0x6659('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6659('0x8')](_0x6659('0xc'),auth[_0x6659('0x9')](),controller[_0x6659('0xd')]);router[_0x6659('0x8')](_0x6659('0xe'),auth['isAuthenticated'](),controller[_0x6659('0xf')]);router['get']('/:id/download',auth[_0x6659('0x9')](),controller['download']);router[_0x6659('0x10')]('/',auth[_0x6659('0x9')](),controller[_0x6659('0x11')]);router[_0x6659('0x10')]('/:id/messages',auth[_0x6659('0x9')](),controller[_0x6659('0x12')]);router['post'](_0x6659('0x13'),auth[_0x6659('0x9')](),interaction[_0x6659('0x14')](_0x6659('0x15'),_0x6659('0x16')),controller[_0x6659('0x17')]);router['put'](_0x6659('0xc'),auth[_0x6659('0x9')](),interaction[_0x6659('0x14')](_0x6659('0x15'),_0x6659('0x18')),controller[_0x6659('0x19')]);router['delete']('/:id',auth[_0x6659('0x9')](),interaction['tracked'](_0x6659('0x15'),_0x6659('0x1a')),controller['destroy']);router[_0x6659('0x1b')]('/:id/tags',auth[_0x6659('0x9')](),controller[_0x6659('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x236d=['../../components/interaction/service','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4cfdb5,_0x4c6a16){var _0xabac11=function(_0x5e38df){while(--_0x5e38df){_0x4cfdb5['push'](_0x4cfdb5['shift']());}};_0xabac11(++_0x4c6a16);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd236('0x0'));var util=require(_0xd236('0x1'));var path=require('path');var timeout=require(_0xd236('0x2'));var express=require('express');var router=express[_0xd236('0x3')]();var fs_extra=require(_0xd236('0x4'));var auth=require(_0xd236('0x5'));var interaction=require(_0xd236('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0xd236('0x7')]('/',auth[_0xd236('0x8')](),controller[_0xd236('0x9')]);router[_0xd236('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd236('0xa')]);router[_0xd236('0x7')]('/:id',auth[_0xd236('0x8')](),controller[_0xd236('0xb')]);router['get'](_0xd236('0xc'),auth[_0xd236('0x8')](),controller[_0xd236('0xd')]);router['get'](_0xd236('0xe'),auth[_0xd236('0x8')](),controller[_0xd236('0xf')]);router['post']('/',auth[_0xd236('0x8')](),controller[_0xd236('0x10')]);router[_0xd236('0x11')](_0xd236('0xc'),auth[_0xd236('0x8')](),controller[_0xd236('0x12')]);router[_0xd236('0x11')](_0xd236('0x13'),auth[_0xd236('0x8')](),interaction[_0xd236('0x14')](_0xd236('0x15'),_0xd236('0x16')),controller[_0xd236('0x17')]);router[_0xd236('0x18')](_0xd236('0x19'),auth[_0xd236('0x8')](),interaction[_0xd236('0x14')](_0xd236('0x15'),_0xd236('0x1a')),controller[_0xd236('0x1b')]);router['delete']('/:id',auth[_0xd236('0x8')](),interaction[_0xd236('0x14')]('whatsapp',_0xd236('0x1c')),controller[_0xd236('0x1d')]);router[_0xd236('0x1e')]('/:id/tags',auth[_0xd236('0x8')](),controller[_0xd236('0x1f')]);module[_0xd236('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9374651..eefba4a 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 _0x6df9=['moment','BOOLEAN','STRING','DATE','out','INTEGER','sequelize'];(function(_0x5effb6,_0x16e03b){var _0xc5b590=function(_0x1f14d9){while(--_0x1f14d9){_0x5effb6['push'](_0x5effb6['shift']());}};_0xc5b590(++_0x16e03b);}(_0x6df9,0x84));var _0x96df=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6df9[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x96df('0x0'));var moment=require(_0x96df('0x1'));module['exports']={'closed':{'type':Sequelize[_0x96df('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x96df('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x96df('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x96df('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x96df('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x96df('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x96df('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x96df('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96df('0x6')]}}; \ No newline at end of file +var _0x1c3d=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x54e9b9,_0xb80d0b){var _0x2a51cc=function(_0x4c9cc6){while(--_0x4c9cc6){_0x54e9b9['push'](_0x54e9b9['shift']());}};_0x2a51cc(++_0xb80d0b);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x6e083c,_0x4c5e7a){_0x6e083c=_0x6e083c-0x0;var _0x36b572=_0x1c3d[_0x6e083c];return _0x36b572;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd1c3('0x0'));module[_0xd1c3('0x1')]={'closed':{'type':Sequelize[_0xd1c3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd1c3('0x3')]},'disposition':{'type':Sequelize[_0xd1c3('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd1c3('0x4')]},'phone':{'type':Sequelize[_0xd1c3('0x4')]},'read1stAt':{'type':Sequelize[_0xd1c3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd1c3('0x5')]('in',_0xd1c3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd1c3('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd1c3('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd1c3('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f07e516..8f4d757 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 _0xb21b=['../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','findAll','query','catch','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','WhatsappInteraction','find','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','color','whatsappInteractionTags:save','removeTags','download','toString','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','Attachment','direction','secret','WhatsappAccount','Owner','get','mkdirSync','fullname','N.A.','createdAt','closedAt','Messages','existsSync','createReadStream','pipe','out','System','lastName','basename','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','unlinkSync','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service'];(function(_0x13c491,_0x2909a9){var _0x24bf67=function(_0x3514cf){while(--_0x3514cf){_0x13c491['push'](_0x13c491['shift']());}};_0x24bf67(++_0x2909a9);}(_0xb21b,0x1ec));var _0xbb21=function(_0x2d4e1b,_0x58a1d3){_0x2d4e1b=_0x2d4e1b-0x0;var _0x2a0fde=_0xb21b[_0x2d4e1b];return _0x2a0fde;};'use strict';var rimraf=require(_0xbb21('0x0'));var zipdir=require('zip-dir');var moment=require(_0xbb21('0x1'));var BPromise=require('bluebird');var util=require(_0xbb21('0x2'));var path=require(_0xbb21('0x3'));var ejs=require(_0xbb21('0x4'));var fs=require('fs');var _=require(_0xbb21('0x5'));var Redis=require(_0xbb21('0x6'));var interaction=require(_0xbb21('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xbb21('0x8'));var logger=require('../../config/logger')(_0xbb21('0x9'));var config=require(_0xbb21('0xa'));var db=require(_0xbb21('0xb'))['db'];config[_0xbb21('0xc')]=_[_0xbb21('0xd')](config[_0xbb21('0xc')],{'host':_0xbb21('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb21('0xc')]));require(_0xbb21('0xf'))['register'](socket);function respondWithStatusCode(_0x2ec9a7,_0x40ede5){_0x40ede5=_0x40ede5||0xcc;return function(_0x1ac89d){if(_0x1ac89d){return _0x2ec9a7[_0xbb21('0x10')](_0x40ede5);}return _0x2ec9a7[_0xbb21('0x11')](_0x40ede5)[_0xbb21('0x12')]();};}function respondWithResult(_0x54258e,_0xbaeabb){_0xbaeabb=_0xbaeabb||0xc8;return function(_0x4e6844){if(_0x4e6844){return _0x54258e[_0xbb21('0x11')](_0xbaeabb)[_0xbb21('0x13')](_0x4e6844);}};}function respondWithFilteredResult(_0x4c0b6b,_0xb8cce2){return function(_0x31537c){if(_0x31537c){var _0x48d7cd=typeof _0xb8cce2['offset']===_0xbb21('0x14')&&typeof _0xb8cce2[_0xbb21('0x15')]===_0xbb21('0x14');var _0x460b6f=_0x31537c[_0xbb21('0x16')];var _0x51c9b8=_0x48d7cd?0x0:_0xb8cce2[_0xbb21('0x17')];var _0x58902f=_0x48d7cd?_0x31537c[_0xbb21('0x16')]:_0xb8cce2[_0xbb21('0x17')]+_0xb8cce2[_0xbb21('0x15')];var _0x1c226b;if(_0x58902f>=_0x460b6f){_0x58902f=_0x460b6f;_0x1c226b=0xc8;}else{_0x1c226b=0xce;}_0x4c0b6b[_0xbb21('0x11')](_0x1c226b);return _0x4c0b6b[_0xbb21('0x18')](_0xbb21('0x19'),_0x51c9b8+'-'+_0x58902f+'/'+_0x460b6f)['json'](_0x31537c);}return null;};}function saveUpdates(_0x192849){return function(_0xb7d773){if(_0xb7d773){return _0xb7d773[_0xbb21('0x1a')](_0x192849)[_0xbb21('0x1b')](function(_0x576efb){return _0x576efb;});}return null;};}function removeEntity(_0x452475){return function(_0x4dadcc){if(_0x4dadcc){return _0x4dadcc[_0xbb21('0x1c')]()[_0xbb21('0x1b')](function(){_0x452475[_0xbb21('0x11')](0xcc)[_0xbb21('0x12')]();});}};}function handleEntityNotFound(_0x552bca){return function(_0x5b5429){if(!_0x5b5429){_0x552bca[_0xbb21('0x10')](0x194);}return _0x5b5429;};}function handleError(_0x33005b,_0xdd8d8e){_0xdd8d8e=_0xdd8d8e||0x1f4;return function(_0x33b5fb){logger[_0xbb21('0x1d')](_0x33b5fb[_0xbb21('0x1e')]);if(_0x33b5fb[_0xbb21('0x1f')]){delete _0x33b5fb[_0xbb21('0x1f')];}_0x33005b[_0xbb21('0x11')](_0xdd8d8e)[_0xbb21('0x20')](_0x33b5fb);};}exports[_0xbb21('0x21')]=function(_0x322e8c,_0x303c1c){var _0x4016c3={};var _0x4e18c3=_['map'](db['WhatsappInteraction'][_0xbb21('0x22')],function(_0x1b76b5){return{'name':_0x1b76b5[_0xbb21('0x23')],'type':_0x1b76b5[_0xbb21('0x24')][_0xbb21('0x25')]};});_0x4016c3=qs['getOptions'](_0x4e18c3,_0x322e8c);return interaction[_0xbb21('0x26')]('whatsapp',_0x322e8c[_0xbb21('0x27')],_0x322e8c['user'],_0x4016c3,_0x4e18c3)[_0xbb21('0x1b')](respondWithFilteredResult(_0x303c1c,_0x4016c3))[_0xbb21('0x28')](handleError(_0x303c1c,null));};exports['show']=function(_0xe13e31,_0x4e28fe){var _0x52d014={'raw':![],'where':{'id':_0xe13e31[_0xbb21('0x29')]['id']}},_0x108519={};_0x108519[_0xbb21('0x2a')]=_[_0xbb21('0x2b')](db['WhatsappInteraction'][_0xbb21('0x22')]);_0x108519[_0xbb21('0x27')]=_[_0xbb21('0x2b')](_0xe13e31['query']);_0x108519[_0xbb21('0x2c')]=_[_0xbb21('0x2d')](_0x108519[_0xbb21('0x2a')],_0x108519[_0xbb21('0x27')]);_0x52d014[_0xbb21('0x2e')]=_[_0xbb21('0x2d')](_0x108519['model'],qs['fields'](_0xe13e31[_0xbb21('0x27')][_0xbb21('0x2f')]));_0x52d014[_0xbb21('0x2e')]=_0x52d014[_0xbb21('0x2e')][_0xbb21('0x30')]?_0x52d014['attributes']:_0x108519[_0xbb21('0x2a')];if(_0xe13e31['query']['includeAll']){_0x52d014[_0xbb21('0x31')]=[{'all':!![]}];}_0x52d014=_[_0xbb21('0x32')]({},_0x52d014,_0xe13e31[_0xbb21('0x33')]);return db[_0xbb21('0x34')][_0xbb21('0x35')](_0x52d014)[_0xbb21('0x1b')](handleEntityNotFound(_0x4e28fe,null))[_0xbb21('0x1b')](respondWithResult(_0x4e28fe,null))[_0xbb21('0x28')](handleError(_0x4e28fe,null));};exports[_0xbb21('0x36')]=function(_0x26aaf1,_0x567c5c){return db[_0xbb21('0x34')][_0xbb21('0x36')](_0x26aaf1[_0xbb21('0x37')],{})[_0xbb21('0x1b')](respondWithResult(_0x567c5c,0xc9))[_0xbb21('0x28')](handleError(_0x567c5c,null));};exports[_0xbb21('0x1a')]=function(_0x380333,_0x1fce9d){if(_0x380333[_0xbb21('0x37')]['id']){delete _0x380333[_0xbb21('0x37')]['id'];}return db[_0xbb21('0x34')][_0xbb21('0x35')]({'where':{'id':_0x380333[_0xbb21('0x29')]['id']}})[_0xbb21('0x1b')](handleEntityNotFound(_0x1fce9d,null))[_0xbb21('0x1b')](saveUpdates(_0x380333[_0xbb21('0x37')],null))[_0xbb21('0x1b')](respondWithResult(_0x1fce9d,null))[_0xbb21('0x28')](handleError(_0x1fce9d,null));};exports[_0xbb21('0x1c')]=function(_0x11ac7f,_0x3887b4){return db[_0xbb21('0x34')][_0xbb21('0x35')]({'where':{'id':_0x11ac7f[_0xbb21('0x29')]['id']}})['then'](handleEntityNotFound(_0x3887b4,null))[_0xbb21('0x1b')](removeEntity(_0x3887b4,null))[_0xbb21('0x28')](handleError(_0x3887b4,null));};exports[_0xbb21('0x38')]=function(_0x5059ff,_0x53667d){return db[_0xbb21('0x34')][_0xbb21('0x38')]()[_0xbb21('0x1b')](respondWithResult(_0x53667d,null))[_0xbb21('0x28')](handleError(_0x53667d,null));};exports[_0xbb21('0x39')]=function(_0x4cde66,_0x4d4419){return db[_0xbb21('0x3a')][_0xbb21('0x35')]({'where':{'id':_0x4cde66[_0xbb21('0x29')]['id']}})[_0xbb21('0x1b')](handleEntityNotFound(_0x4d4419,null))['then'](function(_0x191b44){if(_0x191b44){return _0x191b44[_0xbb21('0x39')](_0x4cde66['body'][_0xbb21('0x3b')],_[_0xbb21('0x3c')](_0x4cde66['body'],['ids','id'])||{});}})[_0xbb21('0x1b')](respondWithResult(_0x4d4419,null))[_0xbb21('0x28')](handleError(_0x4d4419,null));};exports[_0xbb21('0x3d')]=function(_0x36a486,_0x19c202){var _0xf467bc={'raw':![],'where':{}};var _0x56c658={};var _0x47e8b1={'count':0x0,'rows':[]};return db[_0xbb21('0x34')]['findOne']({'where':{'id':_0x36a486[_0xbb21('0x29')]['id']}})[_0xbb21('0x1b')](handleEntityNotFound(_0x19c202,null))[_0xbb21('0x1b')](function(_0x575ce3){if(_0x575ce3){_0x56c658[_0xbb21('0x2a')]=_[_0xbb21('0x2b')](db[_0xbb21('0x3a')]['rawAttributes']);_0x56c658[_0xbb21('0x27')]=_['keys'](_0x36a486[_0xbb21('0x27')]);_0x56c658[_0xbb21('0x2c')]=_[_0xbb21('0x2d')](_0x56c658[_0xbb21('0x2a')],_0x56c658[_0xbb21('0x27')]);_0xf467bc['attributes']=_[_0xbb21('0x2d')](_0x56c658['model'],qs[_0xbb21('0x2f')](_0x36a486[_0xbb21('0x27')][_0xbb21('0x2f')]));_0xf467bc['attributes']=_0xf467bc[_0xbb21('0x2e')][_0xbb21('0x30')]?_0xf467bc['attributes']:_0x56c658[_0xbb21('0x2a')];if(!_0x36a486['query'][_0xbb21('0x3e')](_0xbb21('0x3f'))){_0xf467bc['limit']=qs['limit'](_0x36a486[_0xbb21('0x27')][_0xbb21('0x15')]);_0xf467bc[_0xbb21('0x17')]=qs[_0xbb21('0x17')](_0x36a486[_0xbb21('0x27')][_0xbb21('0x17')]);}_0xf467bc[_0xbb21('0x40')]=qs[_0xbb21('0x41')](_0x36a486['query']['sort']);_0xf467bc[_0xbb21('0x42')]=qs[_0xbb21('0x2c')](_[_0xbb21('0x43')](_0x36a486[_0xbb21('0x27')],_0x56c658[_0xbb21('0x2c')]));_0xf467bc[_0xbb21('0x42')]['WhatsappInteractionId']=_0x575ce3['id'];if(_0x36a486[_0xbb21('0x27')][_0xbb21('0x44')]){_0xf467bc[_0xbb21('0x42')]=_[_0xbb21('0x32')](_0xf467bc[_0xbb21('0x42')],{'$or':_[_0xbb21('0x45')](_0xf467bc[_0xbb21('0x2e')],function(_0x1c9aae){var _0x73b9a3={};_0x73b9a3[_0x1c9aae]={'$like':'%'+_0x36a486[_0xbb21('0x27')][_0xbb21('0x44')]+'%'};return _0x73b9a3;})});}if(_0x36a486[_0xbb21('0x27')][_0xbb21('0x46')]){var _0x12d9fe=_0x36a486[_0xbb21('0x27')]['$gte'][_0xbb21('0x47')](',');var _0x2be382={};_0x2be382[_0x12d9fe[0x0]]={'$gte':moment(_0x12d9fe[0x1])[_0xbb21('0x48')](_0xbb21('0x49'))};_0xf467bc[_0xbb21('0x42')]=_[_0xbb21('0x32')](_0xf467bc['where'],_0x2be382);}_0xf467bc=_['merge']({},_0xf467bc,_0x36a486[_0xbb21('0x33')]);return db['WhatsappMessage']['count']({'where':_0xf467bc['where']})[_0xbb21('0x1b')](function(_0x96e9da){_0x47e8b1[_0xbb21('0x16')]=_0x96e9da;if(_0x36a486[_0xbb21('0x27')][_0xbb21('0x4a')]){_0xf467bc[_0xbb21('0x31')]=[{'all':!![]}];}return db[_0xbb21('0x3a')][_0xbb21('0x26')](_0xf467bc);})[_0xbb21('0x1b')](function(_0x4bff1f){_0x47e8b1[_0xbb21('0x4b')]=_0x4bff1f;return _0x47e8b1;});}})[_0xbb21('0x1b')](respondWithFilteredResult(_0x19c202,_0xf467bc))['catch'](handleError(_0x19c202,null));};exports[_0xbb21('0x4c')]=function(_0x30a80a,_0x52a20e){return db[_0xbb21('0x34')][_0xbb21('0x35')]({'where':{'id':_0x30a80a[_0xbb21('0x29')]['id']}})[_0xbb21('0x1b')](handleEntityNotFound(_0x52a20e,null))['then'](function(_0x3096bb){if(_0x3096bb){return _0x3096bb[_0xbb21('0x4d')](_0x30a80a[_0xbb21('0x37')][_0xbb21('0x3b')],_[_0xbb21('0x3c')](_0x30a80a[_0xbb21('0x37')],['ids','id'])||{})[_0xbb21('0x4e')](function(){return db['Tag']['findAll']({'attributes':['id',_0xbb21('0x1f'),_0xbb21('0x4f')],'where':{'id':_0x30a80a[_0xbb21('0x37')]['ids']}});})[_0xbb21('0x1b')](function(_0xe46c44){socket['emit'](_0xbb21('0x50'),{'id':Number(_0x30a80a[_0xbb21('0x29')]['id']),'tags':_0xe46c44||[]});return{'id':Number(_0x30a80a['params']['id']),'tags':_0xe46c44||[]};});}})[_0xbb21('0x1b')](respondWithResult(_0x52a20e,null))[_0xbb21('0x28')](handleError(_0x52a20e,null));};exports[_0xbb21('0x51')]=function(_0x4bc07f,_0x3c07a8){return db[_0xbb21('0x34')][_0xbb21('0x35')]({'where':{'id':_0x4bc07f[_0xbb21('0x29')]['id']}})[_0xbb21('0x1b')](handleEntityNotFound(_0x3c07a8,null))[_0xbb21('0x1b')](function(_0x115d42){if(_0x115d42){return _0x115d42[_0xbb21('0x51')](_0x4bc07f['query'][_0xbb21('0x3b')]);}})[_0xbb21('0x1b')](respondWithStatusCode(_0x3c07a8,null))['catch'](handleError(_0x3c07a8,null));};exports[_0xbb21('0x52')]=function(_0x42f712,_0x21a115){var _0x31ecc4=moment()['unix']()[_0xbb21('0x53')]();var _0x3d451a=path['join'](config[_0xbb21('0x54')],_0xbb21('0x55'),_0xbb21('0x56'),_0xbb21('0x57'));var _0x4d334a=path['join'](config[_0xbb21('0x54')],_0xbb21('0x55'),_0xbb21('0x56'),_0xbb21('0x58'));var _0x8fbfdc=path[_0xbb21('0x59')](_0x3d451a,_0x31ecc4);var _0x61af2f=util[_0xbb21('0x48')](_0xbb21('0x5a'),_0x42f712[_0xbb21('0x29')]['id'],_0x31ecc4);var _0x553467=path[_0xbb21('0x59')](_0x3d451a,_0x61af2f);var _0x201445=[];_0x201445['push']({'model':db['User'],'as':_0xbb21('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x201445[_0xbb21('0x5c')]({'model':db[_0xbb21('0x5d')],'as':_0xbb21('0x5e'),'attributes':['id',_0xbb21('0x5f'),'lastName'],'raw':!![]});if(_0x42f712['query'][_0xbb21('0x58')]){_0x201445[_0xbb21('0x5c')]({'model':db['Attachment'],'as':_0xbb21('0x60'),'raw':!![]});}var _0x5f13f8=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body','createdAt',_0xbb21('0x61'),_0xbb21('0x62'),'read'],'include':_0x201445}];_0x5f13f8[_0xbb21('0x5c')]({'model':db[_0xbb21('0x63')],'as':'Account','attributes':['id',_0xbb21('0x1f')]});_0x5f13f8['push']({'model':db[_0xbb21('0x5b')],'as':_0xbb21('0x64'),'attributes':['id','fullname']});return db[_0xbb21('0x34')][_0xbb21('0x35')]({'where':{'id':_0x42f712[_0xbb21('0x29')]['id']},'include':_0x5f13f8})[_0xbb21('0x1b')](handleEntityNotFound(_0x21a115,null))[_0xbb21('0x1b')](function(_0x361e34){if(_0x361e34){var _0x1d6bbf=_0x361e34[_0xbb21('0x65')]({'plain':!![]});fs[_0xbb21('0x66')](_0x8fbfdc);var _0x1900e1={'channel':'Whatsapp','account':_0x1d6bbf['Account'][_0xbb21('0x1f')],'agent':_0x1d6bbf['Owner']?_0x1d6bbf[_0xbb21('0x64')][_0xbb21('0x67')]:_0xbb21('0x68'),'createdAt':moment(_0x1d6bbf[_0xbb21('0x69')])[_0xbb21('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbb21('0x53')](),'closedAt':_0x1d6bbf['closed']?moment(_0x1d6bbf[_0xbb21('0x6a')])[_0xbb21('0x48')](_0xbb21('0x49'))[_0xbb21('0x53')]():'','disposition':_0x1d6bbf['disposition'],'messages':_(_0x1d6bbf[_0xbb21('0x6b')])[_0xbb21('0x44')]({'secret':![]})[_0xbb21('0x45')](function(_0x564e4a){if(_0x564e4a[_0xbb21('0x60')]){var _0x4ea415=path[_0xbb21('0x59')](_0x4d334a,_0x564e4a[_0xbb21('0x60')]['basename']);if(fs[_0xbb21('0x6c')](_0x4ea415)){fs[_0xbb21('0x6d')](_0x4ea415)[_0xbb21('0x6e')](fs['createWriteStream'](path[_0xbb21('0x59')](_0x8fbfdc,_0x564e4a['Attachment']['basename'])));}}return{'date':moment(_0x564e4a['createdAt'])[_0xbb21('0x48')](_0xbb21('0x49'))['toString'](),'sender':_0x564e4a[_0xbb21('0x61')]===_0xbb21('0x6f')?_0x564e4a[_0xbb21('0x5b')]?_0x564e4a[_0xbb21('0x5b')]['fullname']:_0xbb21('0x70'):_0x564e4a['Contact'][_0xbb21('0x5f')]+(_0x564e4a['Contact'][_0xbb21('0x71')]?'\x20'+_0x564e4a[_0xbb21('0x5e')][_0xbb21('0x71')]:''),'body':_0x564e4a[_0xbb21('0x60')]?_0x564e4a[_0xbb21('0x60')][_0xbb21('0x72')]:_0x564e4a[_0xbb21('0x37')],'direction':_0x564e4a[_0xbb21('0x61')]==='out'?'A':'C','secret':_0x564e4a[_0xbb21('0x62')],'read':_0x564e4a[_0xbb21('0x73')],'attachment':_0x564e4a[_0xbb21('0x60')]};})[_0xbb21('0x74')]()};return ejs[_0xbb21('0x75')](path[_0xbb21('0x59')](config[_0xbb21('0x54')],'server',_0xbb21('0x76'),_0xbb21('0x77')),{'interaction':_0x1900e1})[_0xbb21('0x1b')](function(_0x5ad775){var _0x5d2caa=path[_0xbb21('0x59')](_0x8fbfdc,_0xbb21('0x78')+_0x1d6bbf['id']+'-'+_0x31ecc4+_0xbb21('0x79'));var _0x210a20={'path':_0x5d2caa,'channel':_0xbb21('0x7a'),'interactionId':_0x1d6bbf['id']};return pdf[_0xbb21('0x7b')](_0x5ad775,_0x210a20);})[_0xbb21('0x1b')](function(){return new BPromise(function(_0x4d6f80,_0x3cc2eb){zipdir(_0x8fbfdc,{'saveTo':_0x553467},function(_0x463b4f,_0x1b9cea){if(_0x463b4f)return _0x3cc2eb(_0x463b4f);return _0x4d6f80(_0x1b9cea);});})[_0xbb21('0x1b')](function(){return new BPromise(function(_0x1aa63c,_0x211e96){rimraf(_0x8fbfdc,function(_0x2959fd){if(_0x2959fd)_0x211e96(_0x2959fd);return _0x1aa63c();});});})[_0xbb21('0x1b')](function(){return _0x21a115[_0xbb21('0x52')](_0x553467,_0x61af2f,function(_0x57cddc){if(_0x57cddc){console['log']('err',_0x57cddc);}else{fs[_0xbb21('0x7c')](_0x553467);}});});});}else{return _0x21a115[_0xbb21('0x10')](0xc8);}})[_0xbb21('0x28')](handleError(_0x21a115,null));}; \ No newline at end of file +var _0xf8a8=['filters','intersection','attributes','fields','length','merge','options','WhatsappInteraction','find','catch','create','body','describe','addMessage','WhatsappMessage','omit','findOne','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','addTags','setTags','ids','Tag','emit','whatsappInteractionTags:save','removeTags','download','toString','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','User','CmContact','Contact','lastName','Attachment','createdAt','direction','read','push','WhatsappAccount','Account','Owner','fullname','mkdirSync','Whatsapp','N.A.','closed','Messages','basename','existsSync','createReadStream','out','firstName','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','show','params','model','keys'];(function(_0x11e870,_0x2c22f8){var _0x54f943=function(_0x2606d9){while(--_0x2606d9){_0x11e870['push'](_0x11e870['shift']());}};_0x54f943(++_0x2c22f8);}(_0xf8a8,0x14f));var _0x8f8a=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xf8a8[_0x47a7d0];return _0xb9bd08;};'use strict';var rimraf=require(_0x8f8a('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8f8a('0x1'));var BPromise=require(_0x8f8a('0x2'));var util=require(_0x8f8a('0x3'));var path=require(_0x8f8a('0x4'));var ejs=require(_0x8f8a('0x5'));var fs=require('fs');var _=require(_0x8f8a('0x6'));var Redis=require(_0x8f8a('0x7'));var interaction=require(_0x8f8a('0x8'));var qs=require(_0x8f8a('0x9'));var pdf=require(_0x8f8a('0xa'));var logger=require(_0x8f8a('0xb'))(_0x8f8a('0xc'));var config=require(_0x8f8a('0xd'));var db=require('../../mysqldb')['db'];config[_0x8f8a('0xe')]=_[_0x8f8a('0xf')](config[_0x8f8a('0xe')],{'host':_0x8f8a('0x10'),'port':0x18eb});var socket=require(_0x8f8a('0x11'))(new Redis(config[_0x8f8a('0xe')]));require(_0x8f8a('0x12'))['register'](socket);function respondWithStatusCode(_0x39254e,_0x5e852e){_0x5e852e=_0x5e852e||0xcc;return function(_0x395dbe){if(_0x395dbe){return _0x39254e[_0x8f8a('0x13')](_0x5e852e);}return _0x39254e[_0x8f8a('0x14')](_0x5e852e)['end']();};}function respondWithResult(_0xda9623,_0x36eed6){_0x36eed6=_0x36eed6||0xc8;return function(_0x3594fe){if(_0x3594fe){return _0xda9623['status'](_0x36eed6)['json'](_0x3594fe);}};}function respondWithFilteredResult(_0x313ae1,_0x40605d){return function(_0x3745b4){if(_0x3745b4){var _0x4540b4=typeof _0x40605d['offset']===_0x8f8a('0x15')&&typeof _0x40605d[_0x8f8a('0x16')]===_0x8f8a('0x15');var _0x255c1b=_0x3745b4['count'];var _0x29dd59=_0x4540b4?0x0:_0x40605d['offset'];var _0x2c9b9b=_0x4540b4?_0x3745b4[_0x8f8a('0x17')]:_0x40605d[_0x8f8a('0x18')]+_0x40605d[_0x8f8a('0x16')];var _0x1eae02;if(_0x2c9b9b>=_0x255c1b){_0x2c9b9b=_0x255c1b;_0x1eae02=0xc8;}else{_0x1eae02=0xce;}_0x313ae1[_0x8f8a('0x14')](_0x1eae02);return _0x313ae1[_0x8f8a('0x19')](_0x8f8a('0x1a'),_0x29dd59+'-'+_0x2c9b9b+'/'+_0x255c1b)[_0x8f8a('0x1b')](_0x3745b4);}return null;};}function saveUpdates(_0x34108d){return function(_0x427f3e){if(_0x427f3e){return _0x427f3e[_0x8f8a('0x1c')](_0x34108d)[_0x8f8a('0x1d')](function(_0x1089de){return _0x1089de;});}return null;};}function removeEntity(_0x337a8d){return function(_0x2a0770){if(_0x2a0770){return _0x2a0770[_0x8f8a('0x1e')]()['then'](function(){_0x337a8d[_0x8f8a('0x14')](0xcc)[_0x8f8a('0x1f')]();});}};}function handleEntityNotFound(_0xf97d29){return function(_0x30ebe5){if(!_0x30ebe5){_0xf97d29['sendStatus'](0x194);}return _0x30ebe5;};}function handleError(_0x3ea25a,_0x3d8623){_0x3d8623=_0x3d8623||0x1f4;return function(_0x118bab){logger['error'](_0x118bab[_0x8f8a('0x20')]);if(_0x118bab[_0x8f8a('0x21')]){delete _0x118bab[_0x8f8a('0x21')];}_0x3ea25a[_0x8f8a('0x14')](_0x3d8623)[_0x8f8a('0x22')](_0x118bab);};}exports[_0x8f8a('0x23')]=function(_0x3a93db,_0x70b98d){var _0x1e587e={};var _0x28d815=_[_0x8f8a('0x24')](db['WhatsappInteraction'][_0x8f8a('0x25')],function(_0x28e98e){return{'name':_0x28e98e[_0x8f8a('0x26')],'type':_0x28e98e['type'][_0x8f8a('0x27')]};});_0x1e587e=qs[_0x8f8a('0x28')](_0x28d815,_0x3a93db);return interaction[_0x8f8a('0x29')](_0x8f8a('0x2a'),_0x3a93db[_0x8f8a('0x2b')],_0x3a93db[_0x8f8a('0x2c')],_0x1e587e,_0x28d815)[_0x8f8a('0x1d')](respondWithFilteredResult(_0x70b98d,_0x1e587e))['catch'](handleError(_0x70b98d,null));};exports[_0x8f8a('0x2d')]=function(_0x27acb0,_0x389a3c){var _0x2b11c9={'raw':![],'where':{'id':_0x27acb0[_0x8f8a('0x2e')]['id']}},_0x110604={};_0x110604[_0x8f8a('0x2f')]=_[_0x8f8a('0x30')](db['WhatsappInteraction'][_0x8f8a('0x25')]);_0x110604[_0x8f8a('0x2b')]=_[_0x8f8a('0x30')](_0x27acb0['query']);_0x110604[_0x8f8a('0x31')]=_[_0x8f8a('0x32')](_0x110604['model'],_0x110604[_0x8f8a('0x2b')]);_0x2b11c9[_0x8f8a('0x33')]=_[_0x8f8a('0x32')](_0x110604[_0x8f8a('0x2f')],qs[_0x8f8a('0x34')](_0x27acb0[_0x8f8a('0x2b')]['fields']));_0x2b11c9[_0x8f8a('0x33')]=_0x2b11c9[_0x8f8a('0x33')][_0x8f8a('0x35')]?_0x2b11c9['attributes']:_0x110604[_0x8f8a('0x2f')];if(_0x27acb0['query']['includeAll']){_0x2b11c9['include']=[{'all':!![]}];}_0x2b11c9=_[_0x8f8a('0x36')]({},_0x2b11c9,_0x27acb0[_0x8f8a('0x37')]);return db[_0x8f8a('0x38')][_0x8f8a('0x39')](_0x2b11c9)[_0x8f8a('0x1d')](handleEntityNotFound(_0x389a3c,null))[_0x8f8a('0x1d')](respondWithResult(_0x389a3c,null))[_0x8f8a('0x3a')](handleError(_0x389a3c,null));};exports['create']=function(_0x4d471d,_0x303e04){return db['WhatsappInteraction'][_0x8f8a('0x3b')](_0x4d471d[_0x8f8a('0x3c')],{})['then'](respondWithResult(_0x303e04,0xc9))[_0x8f8a('0x3a')](handleError(_0x303e04,null));};exports['update']=function(_0x217de0,_0x4acf54){if(_0x217de0[_0x8f8a('0x3c')]['id']){delete _0x217de0['body']['id'];}return db['WhatsappInteraction'][_0x8f8a('0x39')]({'where':{'id':_0x217de0[_0x8f8a('0x2e')]['id']}})[_0x8f8a('0x1d')](handleEntityNotFound(_0x4acf54,null))['then'](saveUpdates(_0x217de0['body'],null))['then'](respondWithResult(_0x4acf54,null))[_0x8f8a('0x3a')](handleError(_0x4acf54,null));};exports[_0x8f8a('0x1e')]=function(_0x2cafc7,_0x16634e){return db['WhatsappInteraction'][_0x8f8a('0x39')]({'where':{'id':_0x2cafc7[_0x8f8a('0x2e')]['id']}})[_0x8f8a('0x1d')](handleEntityNotFound(_0x16634e,null))['then'](removeEntity(_0x16634e,null))['catch'](handleError(_0x16634e,null));};exports[_0x8f8a('0x3d')]=function(_0x4aeacd,_0x47eb06){return db[_0x8f8a('0x38')]['describe']()[_0x8f8a('0x1d')](respondWithResult(_0x47eb06,null))[_0x8f8a('0x3a')](handleError(_0x47eb06,null));};exports[_0x8f8a('0x3e')]=function(_0x1d1906,_0x5356c5){return db[_0x8f8a('0x3f')]['find']({'where':{'id':_0x1d1906[_0x8f8a('0x2e')]['id']}})[_0x8f8a('0x1d')](handleEntityNotFound(_0x5356c5,null))[_0x8f8a('0x1d')](function(_0xca80ae){if(_0xca80ae){return _0xca80ae[_0x8f8a('0x3e')](_0x1d1906['body']['ids'],_[_0x8f8a('0x40')](_0x1d1906[_0x8f8a('0x3c')],['ids','id'])||{});}})[_0x8f8a('0x1d')](respondWithResult(_0x5356c5,null))[_0x8f8a('0x3a')](handleError(_0x5356c5,null));};exports['getMessages']=function(_0x2c0439,_0x3a4e05){var _0x207706={'raw':![],'where':{}};var _0x52b835={};var _0x3d4a76={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x8f8a('0x41')]({'where':{'id':_0x2c0439[_0x8f8a('0x2e')]['id']}})[_0x8f8a('0x1d')](handleEntityNotFound(_0x3a4e05,null))[_0x8f8a('0x1d')](function(_0x43277c){if(_0x43277c){_0x52b835[_0x8f8a('0x2f')]=_['keys'](db[_0x8f8a('0x3f')][_0x8f8a('0x25')]);_0x52b835['query']=_[_0x8f8a('0x30')](_0x2c0439[_0x8f8a('0x2b')]);_0x52b835[_0x8f8a('0x31')]=_[_0x8f8a('0x32')](_0x52b835[_0x8f8a('0x2f')],_0x52b835[_0x8f8a('0x2b')]);_0x207706[_0x8f8a('0x33')]=_[_0x8f8a('0x32')](_0x52b835[_0x8f8a('0x2f')],qs[_0x8f8a('0x34')](_0x2c0439[_0x8f8a('0x2b')]['fields']));_0x207706['attributes']=_0x207706[_0x8f8a('0x33')][_0x8f8a('0x35')]?_0x207706[_0x8f8a('0x33')]:_0x52b835[_0x8f8a('0x2f')];if(!_0x2c0439[_0x8f8a('0x2b')][_0x8f8a('0x42')](_0x8f8a('0x43'))){_0x207706[_0x8f8a('0x16')]=qs[_0x8f8a('0x16')](_0x2c0439['query'][_0x8f8a('0x16')]);_0x207706[_0x8f8a('0x18')]=qs[_0x8f8a('0x18')](_0x2c0439[_0x8f8a('0x2b')]['offset']);}_0x207706[_0x8f8a('0x44')]=qs[_0x8f8a('0x45')](_0x2c0439[_0x8f8a('0x2b')][_0x8f8a('0x45')]);_0x207706[_0x8f8a('0x46')]=qs[_0x8f8a('0x31')](_['pick'](_0x2c0439[_0x8f8a('0x2b')],_0x52b835[_0x8f8a('0x31')]));_0x207706[_0x8f8a('0x46')][_0x8f8a('0x47')]=_0x43277c['id'];if(_0x2c0439[_0x8f8a('0x2b')][_0x8f8a('0x48')]){_0x207706[_0x8f8a('0x46')]=_['merge'](_0x207706[_0x8f8a('0x46')],{'$or':_[_0x8f8a('0x24')](_0x207706[_0x8f8a('0x33')],function(_0x33cb22){var _0x3050f8={};_0x3050f8[_0x33cb22]={'$like':'%'+_0x2c0439[_0x8f8a('0x2b')][_0x8f8a('0x48')]+'%'};return _0x3050f8;})});}if(_0x2c0439['query'][_0x8f8a('0x49')]){var _0x3a9016=_0x2c0439[_0x8f8a('0x2b')][_0x8f8a('0x49')][_0x8f8a('0x4a')](',');var _0x21eb7={};_0x21eb7[_0x3a9016[0x0]]={'$gte':moment(_0x3a9016[0x1])[_0x8f8a('0x4b')](_0x8f8a('0x4c'))};_0x207706['where']=_[_0x8f8a('0x36')](_0x207706[_0x8f8a('0x46')],_0x21eb7);}_0x207706=_['merge']({},_0x207706,_0x2c0439[_0x8f8a('0x37')]);return db[_0x8f8a('0x3f')][_0x8f8a('0x17')]({'where':_0x207706[_0x8f8a('0x46')]})[_0x8f8a('0x1d')](function(_0x4a405d){_0x3d4a76[_0x8f8a('0x17')]=_0x4a405d;if(_0x2c0439[_0x8f8a('0x2b')][_0x8f8a('0x4d')]){_0x207706[_0x8f8a('0x4e')]=[{'all':!![]}];}return db[_0x8f8a('0x3f')][_0x8f8a('0x29')](_0x207706);})[_0x8f8a('0x1d')](function(_0x1a947b){_0x3d4a76[_0x8f8a('0x4f')]=_0x1a947b;return _0x3d4a76;});}})[_0x8f8a('0x1d')](respondWithFilteredResult(_0x3a4e05,_0x207706))[_0x8f8a('0x3a')](handleError(_0x3a4e05,null));};exports[_0x8f8a('0x50')]=function(_0x4a56fb,_0x482a99){return db[_0x8f8a('0x38')][_0x8f8a('0x39')]({'where':{'id':_0x4a56fb['params']['id']}})[_0x8f8a('0x1d')](handleEntityNotFound(_0x482a99,null))[_0x8f8a('0x1d')](function(_0x4ef806){if(_0x4ef806){return _0x4ef806[_0x8f8a('0x51')](_0x4a56fb[_0x8f8a('0x3c')][_0x8f8a('0x52')],_[_0x8f8a('0x40')](_0x4a56fb[_0x8f8a('0x3c')],[_0x8f8a('0x52'),'id'])||{})['spread'](function(){return db[_0x8f8a('0x53')][_0x8f8a('0x29')]({'attributes':['id',_0x8f8a('0x21'),'color'],'where':{'id':_0x4a56fb['body'][_0x8f8a('0x52')]}});})[_0x8f8a('0x1d')](function(_0x109440){socket[_0x8f8a('0x54')](_0x8f8a('0x55'),{'id':Number(_0x4a56fb['params']['id']),'tags':_0x109440||[]});return{'id':Number(_0x4a56fb[_0x8f8a('0x2e')]['id']),'tags':_0x109440||[]};});}})['then'](respondWithResult(_0x482a99,null))['catch'](handleError(_0x482a99,null));};exports[_0x8f8a('0x56')]=function(_0x360198,_0x504e87){return db[_0x8f8a('0x38')]['find']({'where':{'id':_0x360198[_0x8f8a('0x2e')]['id']}})[_0x8f8a('0x1d')](handleEntityNotFound(_0x504e87,null))['then'](function(_0x388b5e){if(_0x388b5e){return _0x388b5e[_0x8f8a('0x56')](_0x360198[_0x8f8a('0x2b')][_0x8f8a('0x52')]);}})['then'](respondWithStatusCode(_0x504e87,null))[_0x8f8a('0x3a')](handleError(_0x504e87,null));};exports[_0x8f8a('0x57')]=function(_0x1e1ba6,_0x278cf9){var _0x36ee62=moment()['unix']()[_0x8f8a('0x58')]();var _0x30bf11=path['join'](config[_0x8f8a('0x59')],'server',_0x8f8a('0x5a'),_0x8f8a('0x5b'));var _0x2c16d2=path[_0x8f8a('0x5c')](config['root'],_0x8f8a('0x5d'),_0x8f8a('0x5a'),_0x8f8a('0x5e'));var _0x3e048e=path[_0x8f8a('0x5c')](_0x30bf11,_0x36ee62);var _0xdbd498=util['format'](_0x8f8a('0x5f'),_0x1e1ba6[_0x8f8a('0x2e')]['id'],_0x36ee62);var _0x50d9be=path[_0x8f8a('0x5c')](_0x30bf11,_0xdbd498);var _0x1d6ece=[];_0x1d6ece['push']({'model':db[_0x8f8a('0x60')],'as':_0x8f8a('0x60'),'attributes':['id','fullname'],'raw':!![]});_0x1d6ece['push']({'model':db[_0x8f8a('0x61')],'as':_0x8f8a('0x62'),'attributes':['id','firstName',_0x8f8a('0x63')],'raw':!![]});if(_0x1e1ba6['query'][_0x8f8a('0x5e')]){_0x1d6ece['push']({'model':db[_0x8f8a('0x64')],'as':'Attachment','raw':!![]});}var _0x10857c=[{'model':db[_0x8f8a('0x3f')],'as':'Messages','attributes':['id',_0x8f8a('0x3c'),_0x8f8a('0x65'),_0x8f8a('0x66'),'secret',_0x8f8a('0x67')],'include':_0x1d6ece}];_0x10857c[_0x8f8a('0x68')]({'model':db[_0x8f8a('0x69')],'as':_0x8f8a('0x6a'),'attributes':['id','name']});_0x10857c[_0x8f8a('0x68')]({'model':db['User'],'as':_0x8f8a('0x6b'),'attributes':['id',_0x8f8a('0x6c')]});return db[_0x8f8a('0x38')][_0x8f8a('0x39')]({'where':{'id':_0x1e1ba6[_0x8f8a('0x2e')]['id']},'include':_0x10857c})[_0x8f8a('0x1d')](handleEntityNotFound(_0x278cf9,null))['then'](function(_0x4f7de1){if(_0x4f7de1){var _0x5b627d=_0x4f7de1['get']({'plain':!![]});fs[_0x8f8a('0x6d')](_0x3e048e);var _0x522006={'channel':_0x8f8a('0x6e'),'account':_0x5b627d[_0x8f8a('0x6a')][_0x8f8a('0x21')],'agent':_0x5b627d[_0x8f8a('0x6b')]?_0x5b627d['Owner']['fullname']:_0x8f8a('0x6f'),'createdAt':moment(_0x5b627d['createdAt'])[_0x8f8a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8f8a('0x58')](),'closedAt':_0x5b627d[_0x8f8a('0x70')]?moment(_0x5b627d['closedAt'])[_0x8f8a('0x4b')](_0x8f8a('0x4c'))['toString']():'','disposition':_0x5b627d['disposition'],'messages':_(_0x5b627d[_0x8f8a('0x71')])[_0x8f8a('0x48')]({'secret':![]})[_0x8f8a('0x24')](function(_0x5ddf69){if(_0x5ddf69[_0x8f8a('0x64')]){var _0x1e561f=path[_0x8f8a('0x5c')](_0x2c16d2,_0x5ddf69['Attachment'][_0x8f8a('0x72')]);if(fs[_0x8f8a('0x73')](_0x1e561f)){fs[_0x8f8a('0x74')](_0x1e561f)['pipe'](fs['createWriteStream'](path[_0x8f8a('0x5c')](_0x3e048e,_0x5ddf69[_0x8f8a('0x64')]['basename'])));}}return{'date':moment(_0x5ddf69['createdAt'])[_0x8f8a('0x4b')](_0x8f8a('0x4c'))[_0x8f8a('0x58')](),'sender':_0x5ddf69[_0x8f8a('0x66')]===_0x8f8a('0x75')?_0x5ddf69[_0x8f8a('0x60')]?_0x5ddf69['User'][_0x8f8a('0x6c')]:'System':_0x5ddf69['Contact'][_0x8f8a('0x76')]+(_0x5ddf69[_0x8f8a('0x62')]['lastName']?'\x20'+_0x5ddf69[_0x8f8a('0x62')]['lastName']:''),'body':_0x5ddf69['Attachment']?_0x5ddf69['Attachment']['basename']:_0x5ddf69[_0x8f8a('0x3c')],'direction':_0x5ddf69[_0x8f8a('0x66')]==='out'?'A':'C','secret':_0x5ddf69[_0x8f8a('0x77')],'read':_0x5ddf69['read'],'attachment':_0x5ddf69[_0x8f8a('0x64')]};})[_0x8f8a('0x78')]()};return ejs[_0x8f8a('0x79')](path['join'](config[_0x8f8a('0x59')],_0x8f8a('0x5d'),_0x8f8a('0x7a'),_0x8f8a('0x7b')),{'interaction':_0x522006})['then'](function(_0x2ec44e){var _0x2001f3=path[_0x8f8a('0x5c')](_0x3e048e,_0x8f8a('0x7c')+_0x5b627d['id']+'-'+_0x36ee62+'.pdf');var _0xf47859={'path':_0x2001f3,'channel':_0x8f8a('0x6e'),'interactionId':_0x5b627d['id']};return pdf[_0x8f8a('0x7d')](_0x2ec44e,_0xf47859);})['then'](function(){return new BPromise(function(_0x42ab56,_0xb63135){zipdir(_0x3e048e,{'saveTo':_0x50d9be},function(_0x319db0,_0x206486){if(_0x319db0)return _0xb63135(_0x319db0);return _0x42ab56(_0x206486);});})[_0x8f8a('0x1d')](function(){return new BPromise(function(_0x5bd5f6,_0x514722){rimraf(_0x3e048e,function(_0x24175f){if(_0x24175f)_0x514722(_0x24175f);return _0x5bd5f6();});});})[_0x8f8a('0x1d')](function(){return _0x278cf9['download'](_0x50d9be,_0xdbd498,function(_0x222e58){if(_0x222e58){console['log'](_0x8f8a('0x7e'),_0x222e58);}else{fs[_0x8f8a('0x7f')](_0x50d9be);}});});});}else{return _0x278cf9[_0x8f8a('0x13')](0xc8);}})['catch'](handleError(_0x278cf9,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 0a91c35..7a47aa9 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 _0x7d5a=['hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x51a957,_0x5d8230){var _0x3eb585=function(_0x5f51f8){while(--_0x5f51f8){_0x51a957['push'](_0x51a957['shift']());}};_0x3eb585(++_0x5d8230);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x22265e,_0x1544be){_0x22265e=_0x22265e-0x0;var _0x34190e=_0x7d5a[_0x22265e];return _0x34190e;};'use strict';var EventEmitter=require(_0xa7d5('0x0'));var WhatsappInteraction=require(_0xa7d5('0x1'))['db'][_0xa7d5('0x2')];var WhatsappMessage=require(_0xa7d5('0x1'))['db'][_0xa7d5('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa7d5('0x4')](0x0);var events={'afterCreate':_0xa7d5('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x36059b){return function(_0xab0a1f,_0x252e92,_0x284432){_0xab0a1f[_0xa7d5('0x6')]({'attributes':['id'],'raw':!![]})[_0xa7d5('0x7')](function(_0x5a8f8a){_0xab0a1f[_0xa7d5('0x8')](_0xa7d5('0x9'),_0x5a8f8a[_0xa7d5('0xa')](function(_0x16004f){return{'id':_0x16004f['id']};}));return WhatsappMessage[_0xa7d5('0xb')]({'where':{'WhatsappInteractionId':_0xab0a1f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa7d5('0x7')](function(_0x350515){_0xab0a1f['setDataValue'](_0xa7d5('0xc'),_0x350515[_0xa7d5('0xd')]);WhatsappInteractionEvents[_0xa7d5('0xe')](_0x36059b+':'+_0xab0a1f['id'],_0xab0a1f);WhatsappInteractionEvents['emit'](_0x36059b,_0xab0a1f);_0x284432(null);})[_0xa7d5('0xf')](_0x284432(null));};}for(var e in events){if(events[_0xa7d5('0x10')](e)){var event=events[e];WhatsappInteraction[_0xa7d5('0x11')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x1c8a=['map','findAll','length','emit','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','then','setDataValue','Users'];(function(_0x1129c2,_0x1d6951){var _0x5937c3=function(_0x1d74f6){while(--_0x1d74f6){_0x1129c2['push'](_0x1129c2['shift']());}};_0x5937c3(++_0x1d6951);}(_0x1c8a,0x140));var _0xa1c8=function(_0x4d5721,_0x3333c9){_0x4d5721=_0x4d5721-0x0;var _0xe85884=_0x1c8a[_0x4d5721];return _0xe85884;};'use strict';var EventEmitter=require(_0xa1c8('0x0'));var WhatsappInteraction=require(_0xa1c8('0x1'))['db'][_0xa1c8('0x2')];var WhatsappMessage=require(_0xa1c8('0x1'))['db'][_0xa1c8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa1c8('0x4'),'afterUpdate':'update','afterDestroy':_0xa1c8('0x5')};function emitEvent(_0x1cdee0){return function(_0x4668e8,_0x559330,_0x331282){_0x4668e8[_0xa1c8('0x6')]({'attributes':['id'],'raw':!![]})[_0xa1c8('0x7')](function(_0x57d2d4){_0x4668e8[_0xa1c8('0x8')](_0xa1c8('0x9'),_0x57d2d4[_0xa1c8('0xa')](function(_0x4a5d71){return{'id':_0x4a5d71['id']};}));return WhatsappMessage[_0xa1c8('0xb')]({'where':{'WhatsappInteractionId':_0x4668e8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa1c8('0x7')](function(_0x6e2ad7){_0x4668e8['setDataValue']('unreadMessages',_0x6e2ad7[_0xa1c8('0xc')]);WhatsappInteractionEvents['emit'](_0x1cdee0+':'+_0x4668e8['id'],_0x4668e8);WhatsappInteractionEvents[_0xa1c8('0xd')](_0x1cdee0,_0x4668e8);_0x331282(null);})['catch'](_0x331282(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xa1c8('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index a68a357..5471b94 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 _0x676b=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x676b,0x6d));var _0xb676=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x676b[_0x318840];return _0x223da4;};'use strict';var _=require('lodash');var util=require(_0xb676('0x0'));var logger=require(_0xb676('0x1'))(_0xb676('0x2'));var moment=require('moment');var BPromise=require(_0xb676('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb676('0x4'));var rimraf=require('rimraf');var config=require(_0xb676('0x5'));var attributes=require(_0xb676('0x6'));module[_0xb676('0x7')]=function(_0x3173f0,_0x4fbf36){return _0x3173f0[_0xb676('0x8')](_0xb676('0x9'),attributes,{'tableName':_0xb676('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x489057,_0x411885,_0x3d187a){if(_0x489057['changed'](_0xb676('0xb'))){_0x489057[_0xb676('0xc')]=moment()[_0xb676('0xd')](_0xb676('0xe'));}_0x3d187a(null,_0x489057);}}});}; \ No newline at end of file +var _0x0379=['changed','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappInteraction.attributes','exports','define'];(function(_0x4fe538,_0x2edd83){var _0xc82f1c=function(_0x1ae098){while(--_0x1ae098){_0x4fe538['push'](_0x4fe538['shift']());}};_0xc82f1c(++_0x2edd83);}(_0x0379,0xff));var _0x9037=function(_0x57f753,_0x3f9a25){_0x57f753=_0x57f753-0x0;var _0x3eec5a=_0x0379[_0x57f753];return _0x3eec5a;};'use strict';var _=require(_0x9037('0x0'));var util=require(_0x9037('0x1'));var logger=require(_0x9037('0x2'))(_0x9037('0x3'));var moment=require(_0x9037('0x4'));var BPromise=require(_0x9037('0x5'));var rp=require(_0x9037('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9037('0x7'));var config=require('../../config/environment');var attributes=require(_0x9037('0x8'));module[_0x9037('0x9')]=function(_0x33f7a0,_0x391ab3){return _0x33f7a0[_0x9037('0xa')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40456e,_0x4f86fb,_0x486a10){if(_0x40456e[_0x9037('0xb')](_0x9037('0xc'))){_0x40456e[_0x9037('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x486a10(null,_0x40456e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f68ba24..0bef810 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 _0x6943=['request','then','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','info','catch','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register'];(function(_0x2ac17b,_0x4fe715){var _0x4a2a2e=function(_0x1ef546){while(--_0x1ef546){_0x2ac17b['push'](_0x2ac17b['shift']());}};_0x4a2a2e(++_0x4fe715);}(_0x6943,0x1bb));var _0x3694=function(_0x4b6420,_0x126201){_0x4b6420=_0x4b6420-0x0;var _0x37076f=_0x6943[_0x4b6420];return _0x37076f;};'use strict';var _=require('lodash');var util=require(_0x3694('0x0'));var moment=require(_0x3694('0x1'));var BPromise=require(_0x3694('0x2'));var rs=require(_0x3694('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3694('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3694('0x5'))('rpc');var config=require(_0x3694('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3694('0x7')][_0x3694('0x8')]({'port':0x232a});config[_0x3694('0x9')]=_[_0x3694('0xa')](config[_0x3694('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3694('0xb'))(new Redis(config[_0x3694('0x9')]));require('./whatsappInteraction.socket')[_0x3694('0xc')](socket);function respondWithRpcPromise(_0x17059b,_0x1ecc21,_0x5100e0){return new BPromise(function(_0x25da37,_0x9bb3cf){return client[_0x3694('0xd')](_0x17059b,_0x5100e0)[_0x3694('0xe')](function(_0x426ca6){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x1ecc21,_0x3694('0xf'));logger['debug'](_0x3694('0x10'),_0x1ecc21,_0x3694('0xf'),JSON[_0x3694('0x11')](_0x426ca6));if(_0x426ca6['error']){if(_0x426ca6[_0x3694('0x12')]['code']===0x1f4){logger[_0x3694('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x1ecc21,_0x426ca6[_0x3694('0x12')]['message']);return _0x9bb3cf(_0x426ca6['error']['message']);}logger['error'](_0x3694('0x13'),_0x1ecc21,_0x426ca6[_0x3694('0x12')][_0x3694('0x14')]);return _0x25da37(_0x426ca6[_0x3694('0x12')]['message']);}else{logger[_0x3694('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x1ecc21,_0x3694('0xf'));_0x25da37(_0x426ca6['result'][_0x3694('0x14')]);}})[_0x3694('0x16')](function(_0x5d9488){logger[_0x3694('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x1ecc21,_0x5d9488);_0x9bb3cf(_0x5d9488);});});}exports['UpdateWhatsappInteraction']=function(_0x3b94fa){var _0x29aa9f=this;return new Promise(function(_0x10fa6f,_0x2857dd){return db['WhatsappInteraction']['update'](_0x3b94fa[_0x3694('0x17')],{'raw':_0x3b94fa[_0x3694('0x18')]?_0x3b94fa[_0x3694('0x18')][_0x3694('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b94fa[_0x3694('0x18')]?_0x3b94fa['options'][_0x3694('0x1a')]||null:null,'attributes':_0x3b94fa[_0x3694('0x18')]?_0x3b94fa[_0x3694('0x18')][_0x3694('0x1b')]||null:null,'limit':_0x3b94fa[_0x3694('0x18')]?_0x3b94fa['options'][_0x3694('0x1c')]||null:null})['then'](function(_0x1026c6){logger[_0x3694('0x15')](_0x3694('0x1d'),_0x3b94fa);logger[_0x3694('0x1e')](_0x3694('0x1d'),_0x3b94fa,JSON[_0x3694('0x11')](_0x1026c6));_0x10fa6f(_0x1026c6);})[_0x3694('0x16')](function(_0x248ff6){logger[_0x3694('0x12')]('UpdateWhatsappInteraction',_0x248ff6[_0x3694('0x14')],_0x3b94fa);_0x2857dd(_0x29aa9f['error'](0x1f4,_0x248ff6['message']));});});};exports[_0x3694('0x1f')]=function(_0x4deaf2){return new Promise(function(_0x5bdb3d,_0x51f3c9){return db[_0x3694('0x20')][_0x3694('0x21')]({'where':_0x4deaf2[_0x3694('0x18')]?_0x4deaf2[_0x3694('0x18')][_0x3694('0x1a')]||null:null})[_0x3694('0xe')](function(_0x3aa302){if(_0x3aa302){return _0x3aa302[_0x3694('0x22')](_0x4deaf2[_0x3694('0x17')][_0x3694('0x23')],_[_0x3694('0x24')](_0x4deaf2[_0x3694('0x17')],['ids','id'])||{});}})['spread'](function(_0x23db72){logger[_0x3694('0x15')](_0x3694('0x25'),_0x4deaf2);logger[_0x3694('0x1e')](_0x3694('0x25'),_0x4deaf2,JSON[_0x3694('0x11')](_0x23db72));_0x5bdb3d(_0x23db72);})[_0x3694('0x16')](function(_0x43106d){logger[_0x3694('0x12')](_0x3694('0x25'),_0x43106d[_0x3694('0x14')],_0x4deaf2);_0x51f3c9(_this[_0x3694('0x12')](0x1f4,_0x43106d[_0x3694('0x14')]));});});}; \ No newline at end of file +var _0xa3c0=['redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','debug','stringify','AddTagsToWhatsappInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4f6ea8,_0x191395){var _0x39f538=function(_0x8aa4c9){while(--_0x8aa4c9){_0x4f6ea8['push'](_0x4f6ea8['shift']());}};_0x39f538(++_0x191395);}(_0xa3c0,0x1b6));var _0x0a3c=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xa3c0[_0x43d16c];return _0x208cce;};'use strict';var _=require(_0x0a3c('0x0'));var util=require(_0x0a3c('0x1'));var moment=require(_0x0a3c('0x2'));var BPromise=require(_0x0a3c('0x3'));var rs=require(_0x0a3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a3c('0x5'))['db'];var utils=require(_0x0a3c('0x6'));var logger=require('../../config/logger')(_0x0a3c('0x7'));var config=require(_0x0a3c('0x8'));var jayson=require(_0x0a3c('0x9'));var client=jayson[_0x0a3c('0xa')][_0x0a3c('0xb')]({'port':0x232a});config[_0x0a3c('0xc')]=_[_0x0a3c('0xd')](config[_0x0a3c('0xc')],{'host':_0x0a3c('0xe'),'port':0x18eb});var socket=require(_0x0a3c('0xf'))(new Redis(config[_0x0a3c('0xc')]));require(_0x0a3c('0x10'))['register'](socket);function respondWithRpcPromise(_0xf43c35,_0x276c1b,_0xd60db5){return new BPromise(function(_0x430914,_0x4e8131){return client[_0x0a3c('0x11')](_0xf43c35,_0xd60db5)[_0x0a3c('0x12')](function(_0x1e2efb){logger[_0x0a3c('0x13')](_0x0a3c('0x14'),_0x276c1b,_0x0a3c('0x15'));logger['debug'](_0x0a3c('0x16'),_0x276c1b,'request\x20sent',JSON['stringify'](_0x1e2efb));if(_0x1e2efb[_0x0a3c('0x17')]){if(_0x1e2efb[_0x0a3c('0x17')][_0x0a3c('0x18')]===0x1f4){logger[_0x0a3c('0x17')](_0x0a3c('0x14'),_0x276c1b,_0x1e2efb[_0x0a3c('0x17')][_0x0a3c('0x19')]);return _0x4e8131(_0x1e2efb[_0x0a3c('0x17')][_0x0a3c('0x19')]);}logger[_0x0a3c('0x17')](_0x0a3c('0x14'),_0x276c1b,_0x1e2efb[_0x0a3c('0x17')][_0x0a3c('0x19')]);return _0x430914(_0x1e2efb['error'][_0x0a3c('0x19')]);}else{logger[_0x0a3c('0x13')](_0x0a3c('0x14'),_0x276c1b,_0x0a3c('0x15'));_0x430914(_0x1e2efb[_0x0a3c('0x1a')][_0x0a3c('0x19')]);}})[_0x0a3c('0x1b')](function(_0x5e38ea){logger[_0x0a3c('0x17')](_0x0a3c('0x14'),_0x276c1b,_0x5e38ea);_0x4e8131(_0x5e38ea);});});}exports['UpdateWhatsappInteraction']=function(_0x1551a9){var _0x40debb=this;return new Promise(function(_0x3d120b,_0x3cfbca){return db[_0x0a3c('0x1c')][_0x0a3c('0x1d')](_0x1551a9[_0x0a3c('0x1e')],{'raw':_0x1551a9[_0x0a3c('0x1f')]?_0x1551a9[_0x0a3c('0x1f')][_0x0a3c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1551a9[_0x0a3c('0x1f')]?_0x1551a9[_0x0a3c('0x1f')][_0x0a3c('0x21')]||null:null,'attributes':_0x1551a9[_0x0a3c('0x1f')]?_0x1551a9['options'][_0x0a3c('0x22')]||null:null,'limit':_0x1551a9[_0x0a3c('0x1f')]?_0x1551a9[_0x0a3c('0x1f')][_0x0a3c('0x23')]||null:null})[_0x0a3c('0x12')](function(_0xbe242e){logger[_0x0a3c('0x13')](_0x0a3c('0x24'),_0x1551a9);logger[_0x0a3c('0x25')](_0x0a3c('0x24'),_0x1551a9,JSON[_0x0a3c('0x26')](_0xbe242e));_0x3d120b(_0xbe242e);})[_0x0a3c('0x1b')](function(_0x2dbb58){logger[_0x0a3c('0x17')]('UpdateWhatsappInteraction',_0x2dbb58[_0x0a3c('0x19')],_0x1551a9);_0x3cfbca(_0x40debb[_0x0a3c('0x17')](0x1f4,_0x2dbb58[_0x0a3c('0x19')]));});});};exports[_0x0a3c('0x27')]=function(_0x3708ef){return new Promise(function(_0x31cd97,_0x2b5b2a){return db[_0x0a3c('0x1c')][_0x0a3c('0x28')]({'where':_0x3708ef[_0x0a3c('0x1f')]?_0x3708ef[_0x0a3c('0x1f')][_0x0a3c('0x21')]||null:null})[_0x0a3c('0x12')](function(_0x4085bf){if(_0x4085bf){return _0x4085bf[_0x0a3c('0x29')](_0x3708ef[_0x0a3c('0x1e')]['ids'],_[_0x0a3c('0x2a')](_0x3708ef[_0x0a3c('0x1e')],['ids','id'])||{});}})[_0x0a3c('0x2b')](function(_0x5f541d){logger[_0x0a3c('0x13')](_0x0a3c('0x2c'),_0x3708ef);logger[_0x0a3c('0x25')](_0x0a3c('0x2c'),_0x3708ef,JSON[_0x0a3c('0x26')](_0x5f541d));_0x31cd97(_0x5f541d);})[_0x0a3c('0x1b')](function(_0x30ec5f){logger[_0x0a3c('0x17')](_0x0a3c('0x2c'),_0x30ec5f[_0x0a3c('0x19')],_0x3708ef);_0x2b5b2a(_this['error'](0x1f4,_0x30ec5f[_0x0a3c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 42d7b98..da9e312 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 _0x248c=['remove','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x3bfc3e,_0x124e8a){var _0x2320b5=function(_0x1aa803){while(--_0x1aa803){_0x3bfc3e['push'](_0x3bfc3e['shift']());}};_0x2320b5(++_0x124e8a);}(_0x248c,0x186));var _0xc248=function(_0x3006c9,_0x2a5beb){_0x3006c9=_0x3006c9-0x0;var _0x24ecab=_0x248c[_0x3006c9];return _0x24ecab;};'use strict';var WhatsappInteractionEvents=require(_0xc248('0x0'));var events=[_0xc248('0x1'),_0xc248('0x2'),'update'];function createListener(_0x5de08b,_0x2a7b63){return function(_0x193f75){_0x2a7b63[_0xc248('0x3')](_0x5de08b,_0x193f75);};}function removeListener(_0x12fa45,_0xf5852f){return function(){WhatsappInteractionEvents[_0xc248('0x4')](_0x12fa45,_0xf5852f);};}exports[_0xc248('0x5')]=function(_0x310cd7){for(var _0xec4581=0x0,_0x4f757c=events[_0xc248('0x6')];_0xec4581<_0x4f757c;_0xec4581++){var _0x306e76=events[_0xec4581];var _0x20011f=createListener(_0xc248('0x7')+_0x306e76,_0x310cd7);WhatsappInteractionEvents['on'](_0x306e76,_0x20011f);}}; \ No newline at end of file +var _0xa006=['emit','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa006,0xf7));var _0x6a00=function(_0x5dd66e,_0x2ba50a){_0x5dd66e=_0x5dd66e-0x0;var _0x28da42=_0xa006[_0x5dd66e];return _0x28da42;};'use strict';var WhatsappInteractionEvents=require(_0x6a00('0x0'));var events=['save',_0x6a00('0x1'),_0x6a00('0x2')];function createListener(_0x314eef,_0x455cda){return function(_0x33468c){_0x455cda[_0x6a00('0x3')](_0x314eef,_0x33468c);};}function removeListener(_0x5afb77,_0x499298){return function(){WhatsappInteractionEvents['removeListener'](_0x5afb77,_0x499298);};}exports['register']=function(_0x2513b5){for(var _0x5731f2=0x0,_0x3a6d64=events['length'];_0x5731f2<_0x3a6d64;_0x5731f2++){var _0x108057=events[_0x5731f2];var _0x31355d=createListener(_0x6a00('0x4')+_0x108057,_0x2513b5);WhatsappInteractionEvents['on'](_0x108057,_0x31355d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b3ef532..74eb79f 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 _0x0098=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x471fd1,_0x416195){var _0x9fbebd=function(_0x2c5631){while(--_0x2c5631){_0x471fd1['push'](_0x471fd1['shift']());}};_0x9fbebd(++_0x416195);}(_0x0098,0x154));var _0x8009=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x0098[_0x45bf86];return _0x1f02b7;};'use strict';var multer=require(_0x8009('0x0'));var util=require(_0x8009('0x1'));var path=require(_0x8009('0x2'));var timeout=require(_0x8009('0x3'));var express=require(_0x8009('0x4'));var router=express[_0x8009('0x5')]();var fs_extra=require(_0x8009('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8009('0x7'));var config=require(_0x8009('0x8'));var controller=require('./whatsappMessage.controller');router[_0x8009('0x9')]('/',auth[_0x8009('0xa')](),controller['index']);router[_0x8009('0x9')](_0x8009('0xb'),auth['isAuthenticated'](),controller[_0x8009('0xc')]);router[_0x8009('0x9')](_0x8009('0xd'),auth['isAuthenticated'](),controller[_0x8009('0xe')]);router[_0x8009('0xf')]('/',auth['isAuthenticated'](),interaction[_0x8009('0x10')](_0x8009('0x11'),_0x8009('0x12')),controller[_0x8009('0x13')]);router[_0x8009('0xf')](_0x8009('0x14'),controller[_0x8009('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8009('0x16')]);router[_0x8009('0x17')](_0x8009('0x18'),auth[_0x8009('0xa')](),controller['accept']);router[_0x8009('0x17')](_0x8009('0x19'),auth[_0x8009('0xa')](),controller[_0x8009('0x1a')]);router[_0x8009('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x8009('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x91ab=['status','put','update','/:id/reject','reject','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','isAuthenticated','index','get','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status'];(function(_0x211e40,_0x3422d7){var _0x2abf3c=function(_0x4e74ef){while(--_0x4e74ef){_0x211e40['push'](_0x211e40['shift']());}};_0x2abf3c(++_0x3422d7);}(_0x91ab,0x164));var _0xb91a=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x91ab[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require(_0xb91a('0x0'));var util=require(_0xb91a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb91a('0x2'));var router=express[_0xb91a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb91a('0x4'));var interaction=require(_0xb91a('0x5'));var config=require('../../config/environment');var controller=require(_0xb91a('0x6'));router['get']('/',auth[_0xb91a('0x7')](),controller[_0xb91a('0x8')]);router[_0xb91a('0x9')]('/describe',auth[_0xb91a('0x7')](),controller[_0xb91a('0xa')]);router['get'](_0xb91a('0xb'),auth[_0xb91a('0x7')](),controller[_0xb91a('0xc')]);router[_0xb91a('0xd')]('/',auth[_0xb91a('0x7')](),interaction[_0xb91a('0xe')](_0xb91a('0xf'),_0xb91a('0x10')),controller[_0xb91a('0x11')]);router[_0xb91a('0xd')](_0xb91a('0x12'),controller[_0xb91a('0x13')]);router[_0xb91a('0x14')]('/:id',auth[_0xb91a('0x7')](),controller[_0xb91a('0x15')]);router[_0xb91a('0x14')]('/:id/accept',auth[_0xb91a('0x7')](),controller['accept']);router[_0xb91a('0x14')](_0xb91a('0x16'),auth[_0xb91a('0x7')](),controller[_0xb91a('0x17')]);router['delete']('/:id',auth[_0xb91a('0x7')](),controller[_0xb91a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4a977d6..b7c4cb6 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 _0x5fa2=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5fa2,0x1b2));var _0x25fa=function(_0x2fd8bc,_0x579585){_0x2fd8bc=_0x2fd8bc-0x0;var _0x2ead7f=_0x5fa2[_0x2fd8bc];return _0x2ead7f;};'use strict';var Sequelize=require(_0x25fa('0x0'));module[_0x25fa('0x1')]={'body':{'type':Sequelize[_0x25fa('0x2')](_0x25fa('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x25fa('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x25fa('0x5')]('in',_0x25fa('0x6')),'defaultValue':_0x25fa('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x25fa('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x25fa('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x25fa('0x7')]},'providerResponse':{'type':Sequelize[_0x25fa('0x2')]}}; \ No newline at end of file +var _0xb164=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb164,0x188));var _0x4b16=function(_0x56497c,_0x2ad77f){_0x56497c=_0x56497c-0x0;var _0x18f66f=_0xb164[_0x56497c];return _0x18f66f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x4b16('0x0')](_0x4b16('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4b16('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b16('0x3')]('in',_0x4b16('0x4')),'defaultValue':_0x4b16('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4b16('0x5')](0xbe)},'phone':{'type':Sequelize[_0x4b16('0x5')]},'readAt':{'type':Sequelize[_0x4b16('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4b16('0x5')]},'providerResponse':{'type':Sequelize[_0x4b16('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d53b538..a3afa83 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 _0xb8d4=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','stack','map','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','WhatsappMessage','count','includeAll','include','rows','params','rawAttributes','create','body','update','find','describe','whatsapp-interactions','accept','whatsapp','readAt','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','interface','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x280f66,_0x562820){var _0x3a256c=function(_0x3a1cec){while(--_0x3a1cec){_0x280f66['push'](_0x280f66['shift']());}};_0x3a256c(++_0x562820);}(_0xb8d4,0x10c));var _0x4b8d=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb8d4[_0x9df060];return _0x338dfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b8d('0x0'));var zipdir=require(_0x4b8d('0x1'));var jsonpatch=require(_0x4b8d('0x2'));var rp=require(_0x4b8d('0x3'));var moment=require(_0x4b8d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4b8d('0x5'));var util=require('util');var path=require(_0x4b8d('0x6'));var sox=require(_0x4b8d('0x7'));var csv=require(_0x4b8d('0x8'));var ejs=require(_0x4b8d('0x9'));var fs=require('fs');var fs_extra=require(_0x4b8d('0xa'));var _=require(_0x4b8d('0xb'));var squel=require(_0x4b8d('0xc'));var crypto=require(_0x4b8d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b8d('0xe'));var Papa=require('papaparse');var Redis=require(_0x4b8d('0xf'));var authService=require(_0x4b8d('0x10'));var qs=require(_0x4b8d('0x11'));var as=require(_0x4b8d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b8d('0x13'))('api');var utils=require(_0x4b8d('0x14'));var config=require(_0x4b8d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b8d('0x16'))['db'];config['redis']=_[_0x4b8d('0x17')](config[_0x4b8d('0x18')],{'host':_0x4b8d('0x19'),'port':0x18eb});var socket=require(_0x4b8d('0x1a'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x4b8d('0x1b')](socket);var jayson=require(_0x4b8d('0x1c'));var client=jayson[_0x4b8d('0x1d')][_0x4b8d('0x1e')]({'port':0x232c});var client9002=jayson[_0x4b8d('0x1d')][_0x4b8d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x574d17,_0x44bf82,_0x1eaa7d,_0x192e61){return new BPromise(function(_0x128898,_0x1142ce){var _0x202ee3=_0x192e61||client;return _0x202ee3[_0x4b8d('0x1f')](_0x574d17,_0x1eaa7d)[_0x4b8d('0x20')](function(_0x281d54){logger['info'](_0x4b8d('0x21'),_0x44bf82,_0x4b8d('0x22'));logger['debug'](_0x4b8d('0x23'),_0x44bf82,'request\x20sent',JSON['stringify'](_0x281d54));if(_0x281d54[_0x4b8d('0x24')]){if(_0x281d54[_0x4b8d('0x24')][_0x4b8d('0x25')]===0x1f4){logger[_0x4b8d('0x24')](_0x4b8d('0x21'),_0x44bf82,_0x281d54[_0x4b8d('0x24')][_0x4b8d('0x26')]);return _0x1142ce(_0x281d54[_0x4b8d('0x24')][_0x4b8d('0x26')]);}logger[_0x4b8d('0x24')](_0x4b8d('0x21'),_0x44bf82,_0x281d54['error']['message']);return _0x128898(_0x281d54[_0x4b8d('0x24')][_0x4b8d('0x26')]);}else{logger[_0x4b8d('0x27')](_0x4b8d('0x21'),_0x44bf82,_0x4b8d('0x22'));_0x128898(_0x281d54[_0x4b8d('0x28')][_0x4b8d('0x26')]);}})[_0x4b8d('0x29')](function(_0x2eb411){logger['error'](_0x4b8d('0x21'),_0x44bf82,_0x2eb411);_0x1142ce(_0x2eb411);});});}function respondWithStatusCode(_0x5b925b,_0x3b6063){_0x3b6063=_0x3b6063||0xcc;return function(_0x5905b9){if(_0x5905b9){return _0x5b925b[_0x4b8d('0x2a')](_0x3b6063);}return _0x5b925b[_0x4b8d('0x2b')](_0x3b6063)[_0x4b8d('0x2c')]();};}function respondWithResult(_0x3eb309,_0x29e020){_0x29e020=_0x29e020||0xc8;return function(_0x9a1ea2){if(_0x9a1ea2){return _0x3eb309[_0x4b8d('0x2b')](_0x29e020)[_0x4b8d('0x2d')](_0x9a1ea2);}};}function respondWithFilteredResult(_0x4ccc1b,_0x4794cf){return function(_0x4dc1c5){if(_0x4dc1c5){var _0x210ee3=typeof _0x4794cf[_0x4b8d('0x2e')]===_0x4b8d('0x2f')&&typeof _0x4794cf[_0x4b8d('0x30')]===_0x4b8d('0x2f');var _0x41d6b6=_0x4dc1c5['count'];var _0x362aa0=_0x210ee3?0x0:_0x4794cf['offset'];var _0x1e13e6=_0x210ee3?_0x4dc1c5['count']:_0x4794cf[_0x4b8d('0x2e')]+_0x4794cf[_0x4b8d('0x30')];var _0x1067ed;if(_0x1e13e6>=_0x41d6b6){_0x1e13e6=_0x41d6b6;_0x1067ed=0xc8;}else{_0x1067ed=0xce;}_0x4ccc1b[_0x4b8d('0x2b')](_0x1067ed);return _0x4ccc1b[_0x4b8d('0x31')](_0x4b8d('0x32'),_0x362aa0+'-'+_0x1e13e6+'/'+_0x41d6b6)[_0x4b8d('0x2d')](_0x4dc1c5);}return null;};}function patchUpdates(_0x164896){return function(_0x2eb14c){try{jsonpatch[_0x4b8d('0x33')](_0x2eb14c,_0x164896,!![]);}catch(_0x31ca6c){return BPromise[_0x4b8d('0x34')](_0x31ca6c);}return _0x2eb14c[_0x4b8d('0x35')]();};}function saveUpdates(_0x104397,_0xedefb1){return function(_0x47bfad){if(_0x47bfad){return _0x47bfad['update'](_0x104397)[_0x4b8d('0x20')](function(_0x4324bb){return _0x4324bb;});}return null;};}function removeEntity(_0x346756,_0x54bcbe){return function(_0x554c61){if(_0x554c61){return _0x554c61[_0x4b8d('0x36')]()[_0x4b8d('0x20')](function(){_0x346756[_0x4b8d('0x2b')](0xcc)[_0x4b8d('0x2c')]();});}};}function handleEntityNotFound(_0x2e1670,_0x4ef573){return function(_0x5ba813){if(!_0x5ba813){_0x2e1670['sendStatus'](0x194);}return _0x5ba813;};}function handleError(_0x504640,_0x39e3bb){_0x39e3bb=_0x39e3bb||0x1f4;return function(_0x58aff2){logger[_0x4b8d('0x24')](_0x58aff2[_0x4b8d('0x37')]);if(_0x58aff2['name']){delete _0x58aff2['name'];}_0x504640[_0x4b8d('0x2b')](_0x39e3bb)['send'](_0x58aff2);};}exports['index']=function(_0xdb26ca,_0x41c8fb){var _0x2afc58={},_0x3515f9={},_0x48e686={'count':0x0,'rows':[]};var _0x6fbbe6=_[_0x4b8d('0x38')](db['WhatsappMessage']['rawAttributes'],function(_0x24cd5b){return{'name':_0x24cd5b[_0x4b8d('0x39')],'type':_0x24cd5b['type'][_0x4b8d('0x3a')]};});_0x3515f9[_0x4b8d('0x3b')]=_['map'](_0x6fbbe6,_0x4b8d('0x3c'));_0x3515f9[_0x4b8d('0x3d')]=_[_0x4b8d('0x3e')](_0xdb26ca[_0x4b8d('0x3d')]);_0x3515f9['filters']=_[_0x4b8d('0x3f')](_0x3515f9[_0x4b8d('0x3b')],_0x3515f9[_0x4b8d('0x3d')]);_0x2afc58[_0x4b8d('0x40')]=_[_0x4b8d('0x3f')](_0x3515f9[_0x4b8d('0x3b')],qs[_0x4b8d('0x41')](_0xdb26ca[_0x4b8d('0x3d')]['fields']));_0x2afc58['attributes']=_0x2afc58[_0x4b8d('0x40')][_0x4b8d('0x42')]?_0x2afc58['attributes']:_0x3515f9[_0x4b8d('0x3b')];if(!_0xdb26ca['query'][_0x4b8d('0x43')](_0x4b8d('0x44'))){_0x2afc58[_0x4b8d('0x30')]=qs[_0x4b8d('0x30')](_0xdb26ca[_0x4b8d('0x3d')][_0x4b8d('0x30')]);_0x2afc58[_0x4b8d('0x2e')]=qs['offset'](_0xdb26ca[_0x4b8d('0x3d')][_0x4b8d('0x2e')]);}_0x2afc58[_0x4b8d('0x45')]=qs['sort'](_0xdb26ca[_0x4b8d('0x3d')][_0x4b8d('0x46')]);_0x2afc58[_0x4b8d('0x47')]=qs[_0x4b8d('0x48')](_[_0x4b8d('0x49')](_0xdb26ca['query'],_0x3515f9[_0x4b8d('0x48')]),_0x6fbbe6);if(_0xdb26ca[_0x4b8d('0x3d')][_0x4b8d('0x4a')]){_0x2afc58[_0x4b8d('0x47')]=_[_0x4b8d('0x4b')](_0x2afc58[_0x4b8d('0x47')],{'$or':_[_0x4b8d('0x38')](_0x6fbbe6,function(_0x553fbd){if(_0x553fbd[_0x4b8d('0x4c')]!==_0x4b8d('0x4d')){var _0x20cd69={};_0x20cd69[_0x553fbd['name']]={'$like':'%'+_0xdb26ca[_0x4b8d('0x3d')][_0x4b8d('0x4a')]+'%'};return _0x20cd69;}})});}_0x2afc58=_['merge']({},_0x2afc58,_0xdb26ca[_0x4b8d('0x4e')]);var _0x189715={'where':_0x2afc58[_0x4b8d('0x47')]};return db[_0x4b8d('0x4f')][_0x4b8d('0x50')](_0x189715)['then'](function(_0x1aee28){_0x48e686[_0x4b8d('0x50')]=_0x1aee28;if(_0xdb26ca[_0x4b8d('0x3d')][_0x4b8d('0x51')]){_0x2afc58[_0x4b8d('0x52')]=[{'all':!![]}];}return db[_0x4b8d('0x4f')]['findAll'](_0x2afc58);})[_0x4b8d('0x20')](function(_0x4f49b4){_0x48e686[_0x4b8d('0x53')]=_0x4f49b4;return _0x48e686;})[_0x4b8d('0x20')](respondWithFilteredResult(_0x41c8fb,_0x2afc58))[_0x4b8d('0x29')](handleError(_0x41c8fb,null));};exports['show']=function(_0xc750ac,_0x4faa1a){var _0x5c33fc={'raw':!![],'where':{'id':_0xc750ac[_0x4b8d('0x54')]['id']}},_0x45f961={};_0x45f961[_0x4b8d('0x3b')]=_[_0x4b8d('0x3e')](db[_0x4b8d('0x4f')][_0x4b8d('0x55')]);_0x45f961['query']=_['keys'](_0xc750ac['query']);_0x45f961[_0x4b8d('0x48')]=_[_0x4b8d('0x3f')](_0x45f961['model'],_0x45f961[_0x4b8d('0x3d')]);_0x5c33fc[_0x4b8d('0x40')]=_['intersection'](_0x45f961['model'],qs[_0x4b8d('0x41')](_0xc750ac[_0x4b8d('0x3d')][_0x4b8d('0x41')]));_0x5c33fc[_0x4b8d('0x40')]=_0x5c33fc['attributes'][_0x4b8d('0x42')]?_0x5c33fc[_0x4b8d('0x40')]:_0x45f961['model'];if(_0xc750ac['query'][_0x4b8d('0x51')]){_0x5c33fc[_0x4b8d('0x52')]=[{'all':!![]}];}_0x5c33fc=_[_0x4b8d('0x4b')]({},_0x5c33fc,_0xc750ac['options']);return db[_0x4b8d('0x4f')]['find'](_0x5c33fc)[_0x4b8d('0x20')](handleEntityNotFound(_0x4faa1a,null))[_0x4b8d('0x20')](respondWithResult(_0x4faa1a,null))[_0x4b8d('0x29')](handleError(_0x4faa1a,null));};exports[_0x4b8d('0x56')]=function(_0x1b7d29,_0x4eaa21){return db[_0x4b8d('0x4f')][_0x4b8d('0x56')](_0x1b7d29[_0x4b8d('0x57')],{})['then'](respondWithResult(_0x4eaa21,0xc9))[_0x4b8d('0x29')](handleError(_0x4eaa21,null));};exports[_0x4b8d('0x58')]=function(_0x5c1bd9,_0x19789b){if(_0x5c1bd9[_0x4b8d('0x57')]['id']){delete _0x5c1bd9['body']['id'];}return db[_0x4b8d('0x4f')][_0x4b8d('0x59')]({'where':{'id':_0x5c1bd9[_0x4b8d('0x54')]['id']}})['then'](handleEntityNotFound(_0x19789b,null))[_0x4b8d('0x20')](saveUpdates(_0x5c1bd9['body'],null))['then'](respondWithResult(_0x19789b,null))[_0x4b8d('0x29')](handleError(_0x19789b,null));};exports[_0x4b8d('0x36')]=function(_0x347424,_0x3405b8){return db[_0x4b8d('0x4f')][_0x4b8d('0x59')]({'where':{'id':_0x347424[_0x4b8d('0x54')]['id']}})[_0x4b8d('0x20')](handleEntityNotFound(_0x3405b8,null))[_0x4b8d('0x20')](removeEntity(_0x3405b8,null))[_0x4b8d('0x29')](handleError(_0x3405b8,null));};exports[_0x4b8d('0x5a')]=function(_0x285cc0,_0x2dba90){return db[_0x4b8d('0x4f')][_0x4b8d('0x5a')]()[_0x4b8d('0x20')](respondWithResult(_0x2dba90,null))['catch'](handleError(_0x2dba90,null));};var interaction_log=require(_0x4b8d('0x13'))(_0x4b8d('0x5b'));exports[_0x4b8d('0x5c')]=function(_0x153e44,_0x41762b,_0x2547d3){var _0x5e765f={'agent':{},'channel':_0x4b8d('0x5d')};if(_0x153e44[_0x4b8d('0x57')]['id']){delete _0x153e44[_0x4b8d('0x57')]['id'];}_0x153e44[_0x4b8d('0x57')]['read']=!![];_0x153e44[_0x4b8d('0x57')][_0x4b8d('0x5e')]=moment()[_0x4b8d('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x153e44[_0x4b8d('0x57')][_0x4b8d('0x60')]=_0x153e44[_0x4b8d('0x57')][_0x4b8d('0x60')]||_0x153e44[_0x4b8d('0x61')]['id'];_0x5e765f[_0x4b8d('0x62')]['id']=_0x153e44[_0x4b8d('0x57')][_0x4b8d('0x60')];return db[_0x4b8d('0x4f')]['find']({'where':{'id':_0x153e44['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x41762b,null))['then'](saveUpdates(_0x153e44['body'],null))[_0x4b8d('0x20')](function(_0x5cc671){if(_0x5cc671){_0x5e765f[_0x4b8d('0x26')]=_0x5cc671[_0x4b8d('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x4b8d('0x59')]({'where':{'id':_0x5cc671[_0x4b8d('0x64')]}});}return null;})[_0x4b8d('0x20')](handleEntityNotFound(_0x41762b,null))[_0x4b8d('0x20')](function(_0x46207f){if(_0x46207f){return _0x46207f[_0x4b8d('0x58')]({'UserId':_0x153e44[_0x4b8d('0x57')][_0x4b8d('0x60')],'read1stAt':_[_0x4b8d('0x65')](_0x46207f[_0x4b8d('0x66')])?moment()[_0x4b8d('0x5f')](_0x4b8d('0x67')):undefined});}return null;})[_0x4b8d('0x20')](function(_0x4bb39e){if(_0x4bb39e){_0x5e765f[_0x4b8d('0x68')]=_0x4bb39e[_0x4b8d('0x63')]({'plain':!![]});interaction_log[_0x4b8d('0x27')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x153e44[_0x4b8d('0x61')]['id'],_0x153e44[_0x4b8d('0x61')][_0x4b8d('0x3c')],_0x153e44[_0x4b8d('0x61')][_0x4b8d('0x69')],_0x5e765f['interaction']['id'],_0x153e44[_0x4b8d('0x57')]?JSON[_0x4b8d('0x6a')](_0x153e44[_0x4b8d('0x57')]):_0x4b8d('0x6b'));return respondWithRpcPromise(_0x4b8d('0x6c'),_0x4b8d('0x6d'),_0x5e765f);}return null;})[_0x4b8d('0x20')](function(_0x3df61e){var _0x567566=_0x4b8d('0x6e')+_0x3df61e[_0x4b8d('0x26')][_0x4b8d('0x6f')];return db[_0x4b8d('0x70')][_0x4b8d('0x3d')](_0x567566,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x5f423b){return _0x5f423b;});})[_0x4b8d('0x20')](function(_0xdb074a){if(_0xdb074a){_0x5e765f[_0x4b8d('0x26')][_0x4b8d('0x71')]=_0xdb074a[0x0];if(!_0x153e44[_0x4b8d('0x57')][_0x4b8d('0x60')])return;return db[_0x4b8d('0x72')][_0x4b8d('0x59')]({'where':{'id':_0x153e44['body'][_0x4b8d('0x60')],'role':'agent'},'attributes':['id',_0x4b8d('0x3c'),_0x4b8d('0x73'),_0x4b8d('0x74'),_0x4b8d('0x75')],'raw':!![]});}return null;})['then'](function(_0x49e7d2){if(!_0x49e7d2)return null;_0x5e765f[_0x4b8d('0x26')][_0x4b8d('0x62')]=_0x49e7d2;return _0x5e765f;})[_0x4b8d('0x20')](function(_0x528c45){if(_0x528c45){if(_0x153e44[_0x4b8d('0x57')][_0x4b8d('0x76')]){_0x5e765f['message']['interface']=util[_0x4b8d('0x5f')](_0x4b8d('0x77'),_0x153e44[_0x4b8d('0x61')][_0x4b8d('0x3c')]);_0x5e765f[_0x4b8d('0x26')]['channel']=_0x5e765f[_0x4b8d('0x78')];_0x5e765f[_0x4b8d('0x26')][_0x4b8d('0x79')]=_0x5e765f[_0x4b8d('0x78')];_0x5e765f[_0x4b8d('0x26')][_0x4b8d('0x7a')]=_0x4b8d('0x5c');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x4b8d('0x7b'),'message':_0x5e765f['message']},client9002)[_0x4b8d('0x20')](function(){return _0x5e765f;});}return _0x5e765f;}return null;})[_0x4b8d('0x20')](respondWithResult(_0x41762b,null))[_0x4b8d('0x29')](handleError(_0x41762b,null));};var interaction_log=require(_0x4b8d('0x13'))(_0x4b8d('0x5b'));exports[_0x4b8d('0x34')]=function(_0x1e9b5d,_0x241018,_0x55641c){var _0x4c5f2e={'agent':{},'channel':'whatsapp'};if(_0x1e9b5d[_0x4b8d('0x57')]['id']){delete _0x1e9b5d[_0x4b8d('0x57')]['id'];}_0x1e9b5d[_0x4b8d('0x57')][_0x4b8d('0x60')]=_0x1e9b5d['body'][_0x4b8d('0x60')]||_0x1e9b5d[_0x4b8d('0x61')]['id'];_0x4c5f2e[_0x4b8d('0x62')]['id']=_0x1e9b5d[_0x4b8d('0x57')]['UserId'];return db[_0x4b8d('0x4f')]['find']({'where':{'id':_0x1e9b5d[_0x4b8d('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x241018,null))[_0x4b8d('0x20')](function(_0x404514){if(_0x404514){_0x4c5f2e[_0x4b8d('0x26')]=_0x404514[_0x4b8d('0x63')]({'plain':!![]});return db[_0x4b8d('0x7c')]['find']({'where':{'id':_0x404514[_0x4b8d('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x241018,null))[_0x4b8d('0x20')](function(_0x137c24){if(_0x137c24){_0x4c5f2e['interaction']=_0x137c24[_0x4b8d('0x63')]({'plain':!![]});interaction_log[_0x4b8d('0x27')](_0x4b8d('0x7d'),_0x1e9b5d['user']['id'],_0x1e9b5d[_0x4b8d('0x61')][_0x4b8d('0x3c')],_0x1e9b5d['user'][_0x4b8d('0x69')],_0x4c5f2e[_0x4b8d('0x68')]['id'],_0x1e9b5d[_0x4b8d('0x57')]?JSON['stringify'](_0x1e9b5d[_0x4b8d('0x57')]):_0x4b8d('0x6b'));return respondWithRpcPromise(_0x4b8d('0x7e'),_0x4b8d('0x7f'),_0x4c5f2e);}return null;})[_0x4b8d('0x20')](function(_0x2fa53b){var _0x5b28c8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2fa53b[_0x4b8d('0x26')]['ContactId'];return db[_0x4b8d('0x70')][_0x4b8d('0x3d')](_0x5b28c8,{'type':db[_0x4b8d('0x80')][_0x4b8d('0x81')][_0x4b8d('0x82')],'raw':!![]})[_0x4b8d('0x20')](function(_0x22ae4c){return _0x22ae4c;});})[_0x4b8d('0x20')](function(_0x4fde2d){if(_0x4fde2d){_0x4c5f2e[_0x4b8d('0x26')]['contact']=_0x4fde2d[0x0];if(!_0x1e9b5d[_0x4b8d('0x57')]['UserId'])return;return db[_0x4b8d('0x72')]['find']({'where':{'id':_0x1e9b5d[_0x4b8d('0x57')][_0x4b8d('0x60')],'role':'agent'},'attributes':['id',_0x4b8d('0x3c'),_0x4b8d('0x73'),_0x4b8d('0x74'),_0x4b8d('0x75')],'raw':!![]});}return null;})['then'](function(_0x4f3787){if(!_0x4f3787)return null;_0x4c5f2e[_0x4b8d('0x26')][_0x4b8d('0x62')]=_0x4f3787;return _0x4c5f2e;})[_0x4b8d('0x20')](function(_0x431bdc){if(_0x431bdc){_0x431bdc[_0x4b8d('0x26')][_0x4b8d('0x83')]=util[_0x4b8d('0x5f')](_0x4b8d('0x77'),_0x1e9b5d[_0x4b8d('0x61')][_0x4b8d('0x3c')]);_0x431bdc[_0x4b8d('0x26')]['channel']=_0x4c5f2e['channel'];_0x431bdc[_0x4b8d('0x26')][_0x4b8d('0x79')]=_0x4c5f2e['channel'];_0x431bdc[_0x4b8d('0x26')][_0x4b8d('0x7a')]=_0x4b8d('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0x4b8d('0x84'),'message':_0x431bdc[_0x4b8d('0x26')]},client9002);return _0x4c5f2e;}return null;})[_0x4b8d('0x20')](respondWithResult(_0x241018,null))[_0x4b8d('0x29')](handleError(_0x241018,null));};exports['status']=function(_0x2addcb,_0x1dff2d,_0x2b7cbd){if(_0x2addcb[_0x4b8d('0x57')]['id']){delete _0x2addcb[_0x4b8d('0x57')]['id'];}var _0x420760;return db[_0x4b8d('0x4f')][_0x4b8d('0x59')]({'where':{'id':_0x2addcb['params']['id']}})[_0x4b8d('0x20')](handleEntityNotFound(_0x1dff2d,null))[_0x4b8d('0x20')](function(_0x4f8e84){if(_0x4f8e84){_0x420760=_0x4f8e84;return db['WhatsappAccount'][_0x4b8d('0x59')]({'where':{'id':_0x4f8e84[_0x4b8d('0x85')]}});}})[_0x4b8d('0x20')](handleEntityNotFound(_0x1dff2d,null))[_0x4b8d('0x20')](function(_0x287665){if(_0x287665){logger['debug'](_0x4b8d('0x86'),_0x4b8d('0x2b'),_0x4b8d('0x87'),_0x287665['type'],util[_0x4b8d('0x88')](_0x2addcb[_0x4b8d('0x57')],{'showHidden':![],'depth':null}));switch(_0x287665['type']){case _0x4b8d('0x89'):if(_0x2addcb[_0x4b8d('0x57')][_0x4b8d('0x8a')]&&_0x2addcb[_0x4b8d('0x57')][_0x4b8d('0x8a')]===_0x420760[_0x4b8d('0x8b')]&&_0x2addcb['body'][_0x4b8d('0x8c')]&&_0x2addcb[_0x4b8d('0x57')][_0x4b8d('0x8c')]===_0x4b8d('0x8d')){return _0x420760[_0x4b8d('0x58')]({'read':!![]});}else{logger['error'](_0x4b8d('0x8e'),'status','twilio',util[_0x4b8d('0x88')](_0x2addcb['body'],{'showHidden':![],'depth':null}));}break;}return _0x420760;}})['then'](respondWithResult(_0x1dff2d,null))[_0x4b8d('0x29')](handleError(_0x1dff2d,null));}; \ No newline at end of file +var _0x824b=['keys','rawAttributes','create','body','update','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE: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','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','destroy','stack','name','send','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','show','params'];(function(_0x122996,_0x541c74){var _0x31d610=function(_0x44a93e){while(--_0x44a93e){_0x122996['push'](_0x122996['shift']());}};_0x31d610(++_0x541c74);}(_0x824b,0xc6));var _0xb824=function(_0x39703d,_0x2555fe){_0x39703d=_0x39703d-0x0;var _0x3891b0=_0x824b[_0x39703d];return _0x3891b0;};'use strict';var emlformat=require(_0xb824('0x0'));var rimraf=require(_0xb824('0x1'));var zipdir=require(_0xb824('0x2'));var jsonpatch=require(_0xb824('0x3'));var rp=require(_0xb824('0x4'));var moment=require(_0xb824('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb824('0x6'));var util=require(_0xb824('0x7'));var path=require(_0xb824('0x8'));var sox=require(_0xb824('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb824('0xa'));var _=require(_0xb824('0xb'));var squel=require(_0xb824('0xc'));var crypto=require(_0xb824('0xd'));var jsforce=require(_0xb824('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb824('0xf'));var Papa=require(_0xb824('0x10'));var Redis=require(_0xb824('0x11'));var authService=require(_0xb824('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb824('0x13'));var hardwareService=require(_0xb824('0x14'));var logger=require(_0xb824('0x15'))('api');var utils=require(_0xb824('0x16'));var config=require(_0xb824('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb824('0x18'))['db'];config[_0xb824('0x19')]=_[_0xb824('0x1a')](config[_0xb824('0x19')],{'host':_0xb824('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb824('0x1c'))[_0xb824('0x1d')](socket);var jayson=require(_0xb824('0x1e'));var client=jayson[_0xb824('0x1f')][_0xb824('0x20')]({'port':0x232c});var client9002=jayson[_0xb824('0x1f')][_0xb824('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x368b40,_0x4eff92,_0xf55fc5,_0x5cb15f){return new BPromise(function(_0x422ac0,_0x5dea8c){var _0x2f2e98=_0x5cb15f||client;return _0x2f2e98['request'](_0x368b40,_0xf55fc5)[_0xb824('0x21')](function(_0x38307f){logger[_0xb824('0x22')](_0xb824('0x23'),_0x4eff92,_0xb824('0x24'));logger[_0xb824('0x25')](_0xb824('0x26'),_0x4eff92,_0xb824('0x24'),JSON[_0xb824('0x27')](_0x38307f));if(_0x38307f[_0xb824('0x28')]){if(_0x38307f['error']['code']===0x1f4){logger['error'](_0xb824('0x23'),_0x4eff92,_0x38307f[_0xb824('0x28')]['message']);return _0x5dea8c(_0x38307f[_0xb824('0x28')][_0xb824('0x29')]);}logger[_0xb824('0x28')](_0xb824('0x23'),_0x4eff92,_0x38307f['error'][_0xb824('0x29')]);return _0x422ac0(_0x38307f[_0xb824('0x28')][_0xb824('0x29')]);}else{logger[_0xb824('0x22')](_0xb824('0x23'),_0x4eff92,'request\x20sent');_0x422ac0(_0x38307f[_0xb824('0x2a')]['message']);}})[_0xb824('0x2b')](function(_0x467be5){logger[_0xb824('0x28')](_0xb824('0x23'),_0x4eff92,_0x467be5);_0x5dea8c(_0x467be5);});});}function respondWithStatusCode(_0x2a3645,_0x101df8){_0x101df8=_0x101df8||0xcc;return function(_0x247d18){if(_0x247d18){return _0x2a3645[_0xb824('0x2c')](_0x101df8);}return _0x2a3645[_0xb824('0x2d')](_0x101df8)[_0xb824('0x2e')]();};}function respondWithResult(_0x1edee2,_0x280d4f){_0x280d4f=_0x280d4f||0xc8;return function(_0x5edf3b){if(_0x5edf3b){return _0x1edee2['status'](_0x280d4f)['json'](_0x5edf3b);}};}function respondWithFilteredResult(_0x5870bc,_0x3e0ddc){return function(_0x33732f){if(_0x33732f){var _0x4bfdfe=typeof _0x3e0ddc[_0xb824('0x2f')]===_0xb824('0x30')&&typeof _0x3e0ddc[_0xb824('0x31')]===_0xb824('0x30');var _0x5a5b6c=_0x33732f[_0xb824('0x32')];var _0x13e0f3=_0x4bfdfe?0x0:_0x3e0ddc['offset'];var _0x1eb083=_0x4bfdfe?_0x33732f[_0xb824('0x32')]:_0x3e0ddc[_0xb824('0x2f')]+_0x3e0ddc['limit'];var _0xcf367a;if(_0x1eb083>=_0x5a5b6c){_0x1eb083=_0x5a5b6c;_0xcf367a=0xc8;}else{_0xcf367a=0xce;}_0x5870bc[_0xb824('0x2d')](_0xcf367a);return _0x5870bc[_0xb824('0x33')]('Content-Range',_0x13e0f3+'-'+_0x1eb083+'/'+_0x5a5b6c)[_0xb824('0x34')](_0x33732f);}return null;};}function patchUpdates(_0x419ebd){return function(_0x988d87){try{jsonpatch[_0xb824('0x35')](_0x988d87,_0x419ebd,!![]);}catch(_0x2d632e){return BPromise[_0xb824('0x36')](_0x2d632e);}return _0x988d87[_0xb824('0x37')]();};}function saveUpdates(_0x14bdef,_0x52fedc){return function(_0x21fc93){if(_0x21fc93){return _0x21fc93['update'](_0x14bdef)[_0xb824('0x21')](function(_0x4b538b){return _0x4b538b;});}return null;};}function removeEntity(_0x5bf641,_0x5410fd){return function(_0x31c829){if(_0x31c829){return _0x31c829[_0xb824('0x38')]()[_0xb824('0x21')](function(){_0x5bf641[_0xb824('0x2d')](0xcc)[_0xb824('0x2e')]();});}};}function handleEntityNotFound(_0x5b0420,_0x54b20b){return function(_0x35e684){if(!_0x35e684){_0x5b0420[_0xb824('0x2c')](0x194);}return _0x35e684;};}function handleError(_0x38c745,_0x2a983f){_0x2a983f=_0x2a983f||0x1f4;return function(_0x69e67){logger[_0xb824('0x28')](_0x69e67[_0xb824('0x39')]);if(_0x69e67[_0xb824('0x3a')]){delete _0x69e67['name'];}_0x38c745['status'](_0x2a983f)[_0xb824('0x3b')](_0x69e67);};}exports['index']=function(_0x543142,_0x51964b){var _0x2e3b8f={},_0x5f1898={},_0xae0e02={'count':0x0,'rows':[]};var _0x2d862d=_['map'](db['WhatsappMessage']['rawAttributes'],function(_0x140cf6){return{'name':_0x140cf6[_0xb824('0x3c')],'type':_0x140cf6[_0xb824('0x3d')]['key']};});_0x5f1898[_0xb824('0x3e')]=_[_0xb824('0x3f')](_0x2d862d,_0xb824('0x3a'));_0x5f1898[_0xb824('0x40')]=_['keys'](_0x543142[_0xb824('0x40')]);_0x5f1898[_0xb824('0x41')]=_[_0xb824('0x42')](_0x5f1898[_0xb824('0x3e')],_0x5f1898[_0xb824('0x40')]);_0x2e3b8f[_0xb824('0x43')]=_[_0xb824('0x42')](_0x5f1898[_0xb824('0x3e')],qs[_0xb824('0x44')](_0x543142[_0xb824('0x40')][_0xb824('0x44')]));_0x2e3b8f['attributes']=_0x2e3b8f['attributes'][_0xb824('0x45')]?_0x2e3b8f[_0xb824('0x43')]:_0x5f1898[_0xb824('0x3e')];if(!_0x543142[_0xb824('0x40')][_0xb824('0x46')]('nolimit')){_0x2e3b8f[_0xb824('0x31')]=qs[_0xb824('0x31')](_0x543142[_0xb824('0x40')]['limit']);_0x2e3b8f[_0xb824('0x2f')]=qs[_0xb824('0x2f')](_0x543142[_0xb824('0x40')][_0xb824('0x2f')]);}_0x2e3b8f[_0xb824('0x47')]=qs[_0xb824('0x48')](_0x543142[_0xb824('0x40')]['sort']);_0x2e3b8f[_0xb824('0x49')]=qs['filters'](_[_0xb824('0x4a')](_0x543142[_0xb824('0x40')],_0x5f1898[_0xb824('0x41')]),_0x2d862d);if(_0x543142[_0xb824('0x40')][_0xb824('0x4b')]){_0x2e3b8f['where']=_[_0xb824('0x4c')](_0x2e3b8f['where'],{'$or':_[_0xb824('0x3f')](_0x2d862d,function(_0xe478d0){if(_0xe478d0[_0xb824('0x3d')]!==_0xb824('0x4d')){var _0x2c067b={};_0x2c067b[_0xe478d0[_0xb824('0x3a')]]={'$like':'%'+_0x543142[_0xb824('0x40')]['filter']+'%'};return _0x2c067b;}})});}_0x2e3b8f=_['merge']({},_0x2e3b8f,_0x543142[_0xb824('0x4e')]);var _0x2f29ed={'where':_0x2e3b8f[_0xb824('0x49')]};return db[_0xb824('0x4f')][_0xb824('0x32')](_0x2f29ed)[_0xb824('0x21')](function(_0x5d4679){_0xae0e02[_0xb824('0x32')]=_0x5d4679;if(_0x543142[_0xb824('0x40')][_0xb824('0x50')]){_0x2e3b8f[_0xb824('0x51')]=[{'all':!![]}];}return db[_0xb824('0x4f')]['findAll'](_0x2e3b8f);})[_0xb824('0x21')](function(_0x5a9ec9){_0xae0e02['rows']=_0x5a9ec9;return _0xae0e02;})[_0xb824('0x21')](respondWithFilteredResult(_0x51964b,_0x2e3b8f))[_0xb824('0x2b')](handleError(_0x51964b,null));};exports[_0xb824('0x52')]=function(_0x3d2c8c,_0x5f57d6){var _0x458827={'raw':!![],'where':{'id':_0x3d2c8c[_0xb824('0x53')]['id']}},_0x255f55={};_0x255f55[_0xb824('0x3e')]=_[_0xb824('0x54')](db[_0xb824('0x4f')][_0xb824('0x55')]);_0x255f55[_0xb824('0x40')]=_[_0xb824('0x54')](_0x3d2c8c[_0xb824('0x40')]);_0x255f55[_0xb824('0x41')]=_[_0xb824('0x42')](_0x255f55['model'],_0x255f55[_0xb824('0x40')]);_0x458827[_0xb824('0x43')]=_['intersection'](_0x255f55[_0xb824('0x3e')],qs[_0xb824('0x44')](_0x3d2c8c[_0xb824('0x40')][_0xb824('0x44')]));_0x458827['attributes']=_0x458827[_0xb824('0x43')][_0xb824('0x45')]?_0x458827['attributes']:_0x255f55['model'];if(_0x3d2c8c['query'][_0xb824('0x50')]){_0x458827[_0xb824('0x51')]=[{'all':!![]}];}_0x458827=_[_0xb824('0x4c')]({},_0x458827,_0x3d2c8c[_0xb824('0x4e')]);return db[_0xb824('0x4f')]['find'](_0x458827)['then'](handleEntityNotFound(_0x5f57d6,null))[_0xb824('0x21')](respondWithResult(_0x5f57d6,null))[_0xb824('0x2b')](handleError(_0x5f57d6,null));};exports[_0xb824('0x56')]=function(_0x2958e9,_0x1f1a5f){return db[_0xb824('0x4f')]['create'](_0x2958e9[_0xb824('0x57')],{})['then'](respondWithResult(_0x1f1a5f,0xc9))[_0xb824('0x2b')](handleError(_0x1f1a5f,null));};exports[_0xb824('0x58')]=function(_0x5add32,_0x5f15ba){if(_0x5add32[_0xb824('0x57')]['id']){delete _0x5add32[_0xb824('0x57')]['id'];}return db[_0xb824('0x4f')][_0xb824('0x59')]({'where':{'id':_0x5add32['params']['id']}})['then'](handleEntityNotFound(_0x5f15ba,null))[_0xb824('0x21')](saveUpdates(_0x5add32[_0xb824('0x57')],null))[_0xb824('0x21')](respondWithResult(_0x5f15ba,null))[_0xb824('0x2b')](handleError(_0x5f15ba,null));};exports['destroy']=function(_0x2487df,_0x360762){return db[_0xb824('0x4f')]['find']({'where':{'id':_0x2487df[_0xb824('0x53')]['id']}})['then'](handleEntityNotFound(_0x360762,null))[_0xb824('0x21')](removeEntity(_0x360762,null))['catch'](handleError(_0x360762,null));};exports[_0xb824('0x5a')]=function(_0x21bcc2,_0x485479){return db[_0xb824('0x4f')]['describe']()[_0xb824('0x21')](respondWithResult(_0x485479,null))[_0xb824('0x2b')](handleError(_0x485479,null));};var interaction_log=require('../../config/logger')(_0xb824('0x5b'));exports[_0xb824('0x5c')]=function(_0x20f1b9,_0x282af4,_0x396862){var _0x541328={'agent':{},'channel':_0xb824('0x5d')};if(_0x20f1b9[_0xb824('0x57')]['id']){delete _0x20f1b9['body']['id'];}_0x20f1b9[_0xb824('0x57')][_0xb824('0x5e')]=!![];_0x20f1b9[_0xb824('0x57')][_0xb824('0x5f')]=moment()[_0xb824('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x20f1b9[_0xb824('0x57')]['UserId']=_0x20f1b9[_0xb824('0x57')][_0xb824('0x61')]||_0x20f1b9[_0xb824('0x62')]['id'];_0x541328[_0xb824('0x63')]['id']=_0x20f1b9[_0xb824('0x57')][_0xb824('0x61')];return db[_0xb824('0x4f')][_0xb824('0x59')]({'where':{'id':_0x20f1b9[_0xb824('0x53')]['id'],'UserId':null}})[_0xb824('0x21')](handleEntityNotFound(_0x282af4,null))['then'](saveUpdates(_0x20f1b9[_0xb824('0x57')],null))[_0xb824('0x21')](function(_0x3128de){if(_0x3128de){_0x541328[_0xb824('0x29')]=_0x3128de[_0xb824('0x64')]({'plain':!![]});return db[_0xb824('0x65')][_0xb824('0x59')]({'where':{'id':_0x3128de['WhatsappInteractionId']}});}return null;})[_0xb824('0x21')](handleEntityNotFound(_0x282af4,null))[_0xb824('0x21')](function(_0x2d809d){if(_0x2d809d){return _0x2d809d[_0xb824('0x58')]({'UserId':_0x20f1b9[_0xb824('0x57')][_0xb824('0x61')],'read1stAt':_['isNil'](_0x2d809d['read1stAt'])?moment()[_0xb824('0x60')](_0xb824('0x66')):undefined});}return null;})[_0xb824('0x21')](function(_0x202969){if(_0x202969){_0x541328[_0xb824('0x67')]=_0x202969['get']({'plain':!![]});interaction_log['info'](_0xb824('0x68'),_0x20f1b9['user']['id'],_0x20f1b9[_0xb824('0x62')][_0xb824('0x3a')],_0x20f1b9['user'][_0xb824('0x69')],_0x541328[_0xb824('0x67')]['id'],_0x20f1b9[_0xb824('0x57')]?JSON[_0xb824('0x27')](_0x20f1b9[_0xb824('0x57')]):'null');return respondWithRpcPromise(_0xb824('0x6a'),_0xb824('0x6b'),_0x541328);}return null;})[_0xb824('0x21')](function(_0x3e3130){var _0x3e5603=_0xb824('0x6c')+_0x3e3130[_0xb824('0x29')][_0xb824('0x6d')];return db[_0xb824('0x6e')][_0xb824('0x40')](_0x3e5603,{'type':db[_0xb824('0x6f')][_0xb824('0x70')][_0xb824('0x71')],'raw':!![]})[_0xb824('0x21')](function(_0x149707){return _0x149707;});})[_0xb824('0x21')](function(_0x38e441){if(_0x38e441){_0x541328[_0xb824('0x29')][_0xb824('0x72')]=_0x38e441[0x0];if(!_0x20f1b9[_0xb824('0x57')][_0xb824('0x61')])return;return db[_0xb824('0x73')][_0xb824('0x59')]({'where':{'id':_0x20f1b9[_0xb824('0x57')][_0xb824('0x61')],'role':_0xb824('0x63')},'attributes':['id',_0xb824('0x3a'),_0xb824('0x74'),_0xb824('0x75'),_0xb824('0x76')],'raw':!![]});}return null;})['then'](function(_0x19999a){if(!_0x19999a)return null;_0x541328['message']['agent']=_0x19999a;return _0x541328;})[_0xb824('0x21')](function(_0x186da9){if(_0x186da9){if(_0x20f1b9[_0xb824('0x57')][_0xb824('0x77')]){_0x541328[_0xb824('0x29')][_0xb824('0x78')]=util[_0xb824('0x60')](_0xb824('0x79'),_0x20f1b9['user'][_0xb824('0x3a')]);_0x541328[_0xb824('0x29')][_0xb824('0x7a')]=_0x541328['channel'];_0x541328[_0xb824('0x29')][_0xb824('0x7b')]=_0x541328[_0xb824('0x7a')];_0x541328[_0xb824('0x29')][_0xb824('0x7c')]=_0xb824('0x5c');return respondWithRpcPromise(_0xb824('0x7d'),_0xb824('0x7d'),{'event':'acceptmessage','message':_0x541328[_0xb824('0x29')]},client9002)[_0xb824('0x21')](function(){return _0x541328;});}return _0x541328;}return null;})['then'](respondWithResult(_0x282af4,null))[_0xb824('0x2b')](handleError(_0x282af4,null));};var interaction_log=require(_0xb824('0x15'))(_0xb824('0x5b'));exports[_0xb824('0x36')]=function(_0x161c18,_0x3c8e3a,_0x14831d){var _0x47f986={'agent':{},'channel':_0xb824('0x5d')};if(_0x161c18[_0xb824('0x57')]['id']){delete _0x161c18[_0xb824('0x57')]['id'];}_0x161c18[_0xb824('0x57')]['UserId']=_0x161c18[_0xb824('0x57')][_0xb824('0x61')]||_0x161c18[_0xb824('0x62')]['id'];_0x47f986[_0xb824('0x63')]['id']=_0x161c18[_0xb824('0x57')][_0xb824('0x61')];return db[_0xb824('0x4f')][_0xb824('0x59')]({'where':{'id':_0x161c18[_0xb824('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c8e3a,null))[_0xb824('0x21')](function(_0x4bc4fc){if(_0x4bc4fc){_0x47f986[_0xb824('0x29')]=_0x4bc4fc[_0xb824('0x64')]({'plain':!![]});return db[_0xb824('0x65')][_0xb824('0x59')]({'where':{'id':_0x4bc4fc[_0xb824('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x3c8e3a,null))[_0xb824('0x21')](function(_0x1a8f43){if(_0x1a8f43){_0x47f986['interaction']=_0x1a8f43[_0xb824('0x64')]({'plain':!![]});interaction_log[_0xb824('0x22')](_0xb824('0x7f'),_0x161c18[_0xb824('0x62')]['id'],_0x161c18[_0xb824('0x62')]['name'],_0x161c18[_0xb824('0x62')]['role'],_0x47f986[_0xb824('0x67')]['id'],_0x161c18[_0xb824('0x57')]?JSON[_0xb824('0x27')](_0x161c18[_0xb824('0x57')]):_0xb824('0x80'));return respondWithRpcPromise(_0xb824('0x81'),_0xb824('0x82'),_0x47f986);}return null;})[_0xb824('0x21')](function(_0x20925c){var _0x291a6b=_0xb824('0x6c')+_0x20925c[_0xb824('0x29')][_0xb824('0x6d')];return db[_0xb824('0x6e')][_0xb824('0x40')](_0x291a6b,{'type':db[_0xb824('0x6f')]['QueryTypes'][_0xb824('0x71')],'raw':!![]})[_0xb824('0x21')](function(_0x250021){return _0x250021;});})[_0xb824('0x21')](function(_0x54299b){if(_0x54299b){_0x47f986[_0xb824('0x29')][_0xb824('0x72')]=_0x54299b[0x0];if(!_0x161c18[_0xb824('0x57')]['UserId'])return;return db['User'][_0xb824('0x59')]({'where':{'id':_0x161c18[_0xb824('0x57')][_0xb824('0x61')],'role':_0xb824('0x63')},'attributes':['id',_0xb824('0x3a'),'fullname',_0xb824('0x75'),_0xb824('0x76')],'raw':!![]});}return null;})[_0xb824('0x21')](function(_0x41bc7e){if(!_0x41bc7e)return null;_0x47f986[_0xb824('0x29')][_0xb824('0x63')]=_0x41bc7e;return _0x47f986;})['then'](function(_0x5e23a2){if(_0x5e23a2){_0x5e23a2['message'][_0xb824('0x78')]=util[_0xb824('0x60')](_0xb824('0x79'),_0x161c18['user'][_0xb824('0x3a')]);_0x5e23a2[_0xb824('0x29')][_0xb824('0x7a')]=_0x47f986[_0xb824('0x7a')];_0x5e23a2['message'][_0xb824('0x7b')]=_0x47f986[_0xb824('0x7a')];_0x5e23a2['message']['event']=_0xb824('0x36');respondWithRpcPromise(_0xb824('0x7d'),_0xb824('0x7d'),{'event':_0xb824('0x83'),'message':_0x5e23a2['message']},client9002);return _0x47f986;}return null;})[_0xb824('0x21')](respondWithResult(_0x3c8e3a,null))[_0xb824('0x2b')](handleError(_0x3c8e3a,null));};exports[_0xb824('0x2d')]=function(_0x2d7a7a,_0x48cc23,_0x31e966){if(_0x2d7a7a[_0xb824('0x57')]['id']){delete _0x2d7a7a[_0xb824('0x57')]['id'];}var _0x2dbdbb;return db['WhatsappMessage'][_0xb824('0x59')]({'where':{'id':_0x2d7a7a['params']['id']}})['then'](handleEntityNotFound(_0x48cc23,null))[_0xb824('0x21')](function(_0x361b56){if(_0x361b56){_0x2dbdbb=_0x361b56;return db['WhatsappAccount'][_0xb824('0x59')]({'where':{'id':_0x361b56[_0xb824('0x84')]}});}})['then'](handleEntityNotFound(_0x48cc23,null))[_0xb824('0x21')](function(_0x347f01){if(_0x347f01){logger[_0xb824('0x25')](_0xb824('0x85'),_0xb824('0x2d'),_0xb824('0x86'),_0x347f01[_0xb824('0x3d')],util[_0xb824('0x87')](_0x2d7a7a[_0xb824('0x57')],{'showHidden':![],'depth':null}));switch(_0x347f01[_0xb824('0x3d')]){case _0xb824('0x88'):if(_0x2d7a7a[_0xb824('0x57')]['MessageSid']&&_0x2d7a7a[_0xb824('0x57')][_0xb824('0x89')]===_0x2dbdbb[_0xb824('0x8a')]&&_0x2d7a7a[_0xb824('0x57')][_0xb824('0x8b')]&&_0x2d7a7a[_0xb824('0x57')][_0xb824('0x8b')]===_0xb824('0x5e')){return _0x2dbdbb['update']({'read':!![]});}else{logger['error'](_0xb824('0x8c'),'status','twilio',util['inspect'](_0x2d7a7a[_0xb824('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x2dbdbb;}})[_0xb824('0x21')](respondWithResult(_0x48cc23,null))['catch'](handleError(_0x48cc23,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e676c1e..7f19624 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 _0x2504=['update','remove','emit','hasOwnProperty','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x4bce7d,_0x4003c2){var _0x2297b1=function(_0x41486e){while(--_0x41486e){_0x4bce7d['push'](_0x4bce7d['shift']());}};_0x2297b1(++_0x4003c2);}(_0x2504,0xee));var _0x4250=function(_0x26cf5a,_0x207116){_0x26cf5a=_0x26cf5a-0x0;var _0x31649f=_0x2504[_0x26cf5a];return _0x31649f;};'use strict';var EventEmitter=require(_0x4250('0x0'));var WhatsappMessage=require(_0x4250('0x1'))['db'][_0x4250('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4250('0x3')](0x0);var events={'afterCreate':_0x4250('0x4'),'afterUpdate':_0x4250('0x5'),'afterDestroy':_0x4250('0x6')};function emitEvent(_0x320d79){return function(_0x17d2d8,_0xc31f3a,_0xe5986d){WhatsappMessageEvents[_0x4250('0x7')](_0x320d79+':'+_0x17d2d8['id'],_0x17d2d8);WhatsappMessageEvents['emit'](_0x320d79,_0x17d2d8);_0xe5986d(null);};}for(var e in events){if(events[_0x4250('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x10b3fc,_0x45a68a){var _0x490310=function(_0x5d274b){while(--_0x5d274b){_0x10b3fc['push'](_0x10b3fc['shift']());}};_0x490310(++_0x45a68a);}(_0xb10b,0x12a));var _0xbb10=function(_0x59137b,_0x20880e){_0x59137b=_0x59137b-0x0;var _0x267490=_0xb10b[_0x59137b];return _0x267490;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 257faa3..12662cb 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 _0x51ee=['../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','get','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','direction','catch','error','WhatsappAccount','find','type','twilio','authToken','accountSid','body','whatsapp:','phone','remote','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf'];(function(_0x1ba519,_0x475577){var _0x5bfafa=function(_0x2bcf75){while(--_0x2bcf75){_0x1ba519['push'](_0x1ba519['shift']());}};_0x5bfafa(++_0x475577);}(_0x51ee,0xae));var _0xe51e=function(_0x83fcda,_0x526a36){_0x83fcda=_0x83fcda-0x0;var _0x2b3bc9=_0x51ee[_0x83fcda];return _0x2b3bc9;};'use strict';var _=require(_0xe51e('0x0'));var util=require(_0xe51e('0x1'));var logger=require('../../config/logger')(_0xe51e('0x2'));var moment=require(_0xe51e('0x3'));var BPromise=require(_0xe51e('0x4'));var rp=require(_0xe51e('0x5'));var fetch=require(_0xe51e('0x6'));var fs=require('fs');var path=require(_0xe51e('0x7'));var rimraf=require(_0xe51e('0x8'));var config=require(_0xe51e('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0xe51e('0xa')]=function(_0x25cd70,_0x2141ab){return _0x25cd70[_0xe51e('0xb')](_0xe51e('0xc'),attributes,{'tableName':_0xe51e('0xd'),'paranoid':![],'indexes':[{'name':_0xe51e('0xe'),'fields':[_0xe51e('0xe')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xe51e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x597b1f,_0x4b82af,_0x1336be){var _0x1d678e=_0x25cd70[_0xe51e('0x10')];var _0x6f46c=_0x597b1f[_0xe51e('0x11')]({'plain':!![]});if(_0x6f46c['direction'][_0xe51e('0x12')]()==='in'||_0x6f46c['direction'][_0xe51e('0x12')]()===_0xe51e('0x13')&&!_0x6f46c[_0xe51e('0x14')]&&!_[_0xe51e('0x15')](_0x6f46c['UserId'])){_0x1d678e[_0xe51e('0x16')][_0xe51e('0x17')]({'where':{'id':_0x6f46c[_0xe51e('0x18')]}})[_0xe51e('0x19')](function(_0x5711c7){if(_0x5711c7){_0x5711c7[_0xe51e('0x1a')]({'lastMsgAt':_0x6f46c[_0xe51e('0x1b')],'lastMsgDirection':_0x6f46c[_0xe51e('0x1c')][_0xe51e('0x12')]()});}})[_0xe51e('0x1d')](function(_0x277281){console[_0xe51e('0x1e')](_0x277281);});}if(_0x6f46c[_0xe51e('0x1c')]===_0xe51e('0x13')&&!_0x6f46c[_0xe51e('0x14')]){var _0x15fb8e;_0x1d678e[_0xe51e('0x1f')][_0xe51e('0x20')]({'where':{'id':_0x6f46c['WhatsappAccountId']},'raw':!![]})[_0xe51e('0x19')](function(_0x44566b){_0x15fb8e=_0x44566b;if(_0x15fb8e&&_0x15fb8e[_0xe51e('0x21')]){switch(_0x15fb8e[_0xe51e('0x21')]){case _0xe51e('0x22'):var _0x3b691b=require(_0xe51e('0x22'));if(_0x15fb8e['accountSid']&&_0x15fb8e[_0xe51e('0x23')]&&_0x15fb8e['phone']){var _0x20a3e8=new _0x3b691b(_0x15fb8e[_0xe51e('0x24')],_0x15fb8e[_0xe51e('0x23')]);_0x20a3e8['messages']['create']({'body':_0x6f46c[_0xe51e('0x25')],'to':_0xe51e('0x26')+_0x6f46c[_0xe51e('0x27')],'from':_0xe51e('0x26')+_0x15fb8e['phone'],'statusCallback':_0x15fb8e[_0xe51e('0x28')]+'/api/whatsapp/messages/'+_0x6f46c['id']+_0xe51e('0x29')+_0x15fb8e['token']})['then'](function(_0x42ca59){if(_0x42ca59[_0xe51e('0x2a')]){return _0x597b1f[_0xe51e('0x1a')]({'messageId':_0x42ca59[_0xe51e('0x2a')]});}})[_0xe51e('0x1d')](function(_0x48ae9c){logger['error'](_0xe51e('0x2b'),_0xe51e('0x2c'),'twilio',util[_0xe51e('0x2d')](_0x48ae9c,{'showHidden':![],'depth':null}));});}else{logger[_0xe51e('0x1e')](_0xe51e('0x2b'),_0xe51e('0x2c'),'twilio',_0xe51e('0x2e'));}break;case _0xe51e('0x2f'):var _0x19568d=_0x15fb8e[_0xe51e('0x24')];var _0x1baac4=_0x15fb8e[_0xe51e('0x23')];var _0x11212e=_0x15fb8e[_0xe51e('0x30')]+'/whatsapp/v1/'+_0x19568d+_0xe51e('0x31');var _0x5104ed={'to':[_0x6f46c[_0xe51e('0x27')]],'message':{'type':_0xe51e('0x32'),'text':_0x6f46c[_0xe51e('0x25')]}};var _0x30d4f0={'method':_0xe51e('0x33'),'uri':_0x11212e,'headers':{'Authorization':_0xe51e('0x34')+_0x1baac4,'Content-Type':_0xe51e('0x35')},'body':_0x5104ed,'json':!![]};rp(_0x30d4f0)[_0xe51e('0x19')](function(_0x552d11){if(_0x552d11[_0xe51e('0x36')][0x0][_0xe51e('0x37')]){return _0x597b1f['update']({'messageId':_0x552d11['statuses'][0x0]['message_id']});}})[_0xe51e('0x1d')](function(_0x4f1809){logger[_0xe51e('0x38')](_0xe51e('0x39'),_0x4f1809);});break;}}})[_0xe51e('0x3a')](function(){_0x1336be();});}else{_0x1336be();}}},'charset':_0xe51e('0x3b'),'collate':_0xe51e('0x3c')});}; \ No newline at end of file +var _0xa664=['afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','phone','authToken','create','body','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xa664,0x1f0));var _0x4a66=function(_0x2ddc7d,_0x22949f){_0x2ddc7d=_0x2ddc7d-0x0;var _0x1f6f7d=_0xa664[_0x2ddc7d];return _0x1f6f7d;};'use strict';var _=require(_0x4a66('0x0'));var util=require(_0x4a66('0x1'));var logger=require('../../config/logger')(_0x4a66('0x2'));var moment=require(_0x4a66('0x3'));var BPromise=require(_0x4a66('0x4'));var rp=require('request-promise');var fetch=require(_0x4a66('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a66('0x6'));var config=require(_0x4a66('0x7'));var attributes=require(_0x4a66('0x8'));module['exports']=function(_0x21b4e8,_0x5e2943){return _0x21b4e8[_0x4a66('0x9')]('WhatsappMessage',attributes,{'tableName':_0x4a66('0xa'),'paranoid':![],'indexes':[{'name':_0x4a66('0xb'),'fields':[_0x4a66('0xb')]},{'name':_0x4a66('0xc'),'fields':['body'],'type':_0x4a66('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x17e310,_0x390ed3,_0x245bb0){var _0x59d5c9=_0x21b4e8['models'];var _0x3ca972=_0x17e310[_0x4a66('0xe')]({'plain':!![]});if(_0x3ca972['direction'][_0x4a66('0xf')]()==='in'||_0x3ca972[_0x4a66('0x10')][_0x4a66('0xf')]()===_0x4a66('0x11')&&!_0x3ca972[_0x4a66('0x12')]&&!_[_0x4a66('0x13')](_0x3ca972[_0x4a66('0x14')])){_0x59d5c9[_0x4a66('0x15')]['findOne']({'where':{'id':_0x3ca972[_0x4a66('0x16')]}})['then'](function(_0x4f7c71){if(_0x4f7c71){_0x4f7c71[_0x4a66('0x17')]({'lastMsgAt':_0x3ca972[_0x4a66('0x18')],'lastMsgDirection':_0x3ca972[_0x4a66('0x10')]['toLowerCase']()});}})[_0x4a66('0x19')](function(_0x1044b3){console[_0x4a66('0x1a')](_0x1044b3);});}if(_0x3ca972[_0x4a66('0x10')]===_0x4a66('0x11')&&!_0x3ca972['secret']){var _0x49a40b;_0x59d5c9[_0x4a66('0x1b')][_0x4a66('0x1c')]({'where':{'id':_0x3ca972[_0x4a66('0x1d')]},'raw':!![]})[_0x4a66('0x1e')](function(_0x194ed8){_0x49a40b=_0x194ed8;if(_0x49a40b&&_0x49a40b[_0x4a66('0x1f')]){switch(_0x49a40b[_0x4a66('0x1f')]){case'twilio':var _0x52a047=require(_0x4a66('0x20'));if(_0x49a40b[_0x4a66('0x21')]&&_0x49a40b['authToken']&&_0x49a40b[_0x4a66('0x22')]){var _0x47743d=new _0x52a047(_0x49a40b[_0x4a66('0x21')],_0x49a40b[_0x4a66('0x23')]);_0x47743d['messages'][_0x4a66('0x24')]({'body':_0x3ca972[_0x4a66('0x25')],'to':_0x4a66('0x26')+_0x3ca972[_0x4a66('0x22')],'from':_0x4a66('0x26')+_0x49a40b['phone'],'statusCallback':_0x49a40b[_0x4a66('0x27')]+'/api/whatsapp/messages/'+_0x3ca972['id']+_0x4a66('0x28')+_0x49a40b[_0x4a66('0x29')]})[_0x4a66('0x1e')](function(_0x1c8015){if(_0x1c8015[_0x4a66('0x2a')]){return _0x17e310['update']({'messageId':_0x1c8015[_0x4a66('0x2a')]});}})[_0x4a66('0x19')](function(_0x53b7fb){logger[_0x4a66('0x1a')](_0x4a66('0x2b'),_0x4a66('0x2c'),_0x4a66('0x20'),util[_0x4a66('0x2d')](_0x53b7fb,{'showHidden':![],'depth':null}));});}else{logger[_0x4a66('0x1a')](_0x4a66('0x2b'),_0x4a66('0x2c'),_0x4a66('0x20'),_0x4a66('0x2e'));}break;case _0x4a66('0x2f'):var _0x40b2d2=_0x49a40b[_0x4a66('0x21')];var _0x37cd69=_0x49a40b[_0x4a66('0x23')];var _0x311ff9=_0x49a40b[_0x4a66('0x30')]+'/whatsapp/v1/'+_0x40b2d2+_0x4a66('0x31');var _0x5e3525={'to':[_0x3ca972[_0x4a66('0x22')]],'message':{'type':_0x4a66('0x32'),'text':_0x3ca972[_0x4a66('0x25')]}};var _0x2b5bbd={'method':_0x4a66('0x33'),'uri':_0x311ff9,'headers':{'Authorization':_0x4a66('0x34')+_0x37cd69,'Content-Type':_0x4a66('0x35')},'body':_0x5e3525,'json':!![]};rp(_0x2b5bbd)[_0x4a66('0x1e')](function(_0x2033fd){if(_0x2033fd[_0x4a66('0x36')][0x0]['message_id']){return _0x17e310[_0x4a66('0x17')]({'messageId':_0x2033fd['statuses'][0x0][_0x4a66('0x37')]});}})[_0x4a66('0x19')](function(_0x584e21){logger[_0x4a66('0x38')](_0x4a66('0x39'),_0x584e21);});break;}}})['finally'](function(){_0x245bb0();});}else{_0x245bb0();}}},'charset':_0x4a66('0x3a'),'collate':_0x4a66('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ba10a03..375f576 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 _0xfd7e=['../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x185334,_0x4630ac){var _0xf2e59a=function(_0x3cc497){while(--_0x3cc497){_0x185334['push'](_0x185334['shift']());}};_0xf2e59a(++_0x4630ac);}(_0xfd7e,0xe7));var _0xefd7=function(_0x396b43,_0x24d48a){_0x396b43=_0x396b43-0x0;var _0x34ff94=_0xfd7e[_0x396b43];return _0x34ff94;};'use strict';var _=require(_0xefd7('0x0'));var util=require(_0xefd7('0x1'));var moment=require(_0xefd7('0x2'));var BPromise=require(_0xefd7('0x3'));var rs=require(_0xefd7('0x4'));var fs=require('fs');var Redis=require(_0xefd7('0x5'));var db=require(_0xefd7('0x6'))['db'];var utils=require(_0xefd7('0x7'));var logger=require('../../config/logger')(_0xefd7('0x8'));var config=require('../../config/environment');var jayson=require(_0xefd7('0x9'));var client=jayson[_0xefd7('0xa')][_0xefd7('0xb')]({'port':0x232a});config[_0xefd7('0xc')]=_[_0xefd7('0xd')](config[_0xefd7('0xc')],{'host':_0xefd7('0xe'),'port':0x18eb});var socket=require(_0xefd7('0xf'))(new Redis(config[_0xefd7('0xc')]));require('./whatsappMessage.socket')[_0xefd7('0x10')](socket);function respondWithRpcPromise(_0x4d4521,_0x256928,_0x3621e2){return new BPromise(function(_0x32d6ab,_0x5b3a63){return client[_0xefd7('0x11')](_0x4d4521,_0x3621e2)['then'](function(_0x4a23a6){logger[_0xefd7('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x256928,_0xefd7('0x13'));logger[_0xefd7('0x14')](_0xefd7('0x15'),_0x256928,_0xefd7('0x13'),JSON['stringify'](_0x4a23a6));if(_0x4a23a6['error']){if(_0x4a23a6[_0xefd7('0x16')][_0xefd7('0x17')]===0x1f4){logger['error'](_0xefd7('0x18'),_0x256928,_0x4a23a6[_0xefd7('0x16')][_0xefd7('0x19')]);return _0x5b3a63(_0x4a23a6[_0xefd7('0x16')][_0xefd7('0x19')]);}logger[_0xefd7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x256928,_0x4a23a6[_0xefd7('0x16')][_0xefd7('0x19')]);return _0x32d6ab(_0x4a23a6[_0xefd7('0x16')][_0xefd7('0x19')]);}else{logger[_0xefd7('0x12')](_0xefd7('0x18'),_0x256928,_0xefd7('0x13'));_0x32d6ab(_0x4a23a6[_0xefd7('0x1a')][_0xefd7('0x19')]);}})[_0xefd7('0x1b')](function(_0x20b044){logger[_0xefd7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x256928,_0x20b044);_0x5b3a63(_0x20b044);});});}exports[_0xefd7('0x1c')]=function(_0x539a2e){var _0x2114c4=this;return new Promise(function(_0x47fca2,_0xde5128){return db[_0xefd7('0x1d')][_0xefd7('0x1e')](_0x539a2e[_0xefd7('0x1f')],{'raw':_0x539a2e[_0xefd7('0x20')]?_0x539a2e['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a3b83){logger[_0xefd7('0x12')]('CreateWhatsappMessage',_0x539a2e);logger[_0xefd7('0x14')](_0xefd7('0x1c'),_0x539a2e,JSON[_0xefd7('0x21')](_0x1a3b83));_0x47fca2(_0x1a3b83);})[_0xefd7('0x1b')](function(_0x217061){logger[_0xefd7('0x16')](_0xefd7('0x1c'),_0x217061[_0xefd7('0x19')],_0x539a2e);_0xde5128(_0x2114c4['error'](0x1f4,_0x217061[_0xefd7('0x19')]));});});}; \ No newline at end of file +var _0x7f13=['register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x4e105e,_0x3e77c2){var _0x7701b6=function(_0x6220ae){while(--_0x6220ae){_0x4e105e['push'](_0x4e105e['shift']());}};_0x7701b6(++_0x3e77c2);}(_0x7f13,0x7f));var _0x37f1=function(_0x373a1b,_0x5d97b6){_0x373a1b=_0x373a1b-0x0;var _0x2a754e=_0x7f13[_0x373a1b];return _0x2a754e;};'use strict';var _=require(_0x37f1('0x0'));var util=require(_0x37f1('0x1'));var moment=require(_0x37f1('0x2'));var BPromise=require(_0x37f1('0x3'));var rs=require(_0x37f1('0x4'));var fs=require('fs');var Redis=require(_0x37f1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37f1('0x6'))(_0x37f1('0x7'));var config=require(_0x37f1('0x8'));var jayson=require(_0x37f1('0x9'));var client=jayson[_0x37f1('0xa')][_0x37f1('0xb')]({'port':0x232a});config[_0x37f1('0xc')]=_[_0x37f1('0xd')](config[_0x37f1('0xc')],{'host':_0x37f1('0xe'),'port':0x18eb});var socket=require(_0x37f1('0xf'))(new Redis(config[_0x37f1('0xc')]));require(_0x37f1('0x10'))[_0x37f1('0x11')](socket);function respondWithRpcPromise(_0x4f5c8f,_0xf1058a,_0x3fb236){return new BPromise(function(_0x22a4c9,_0x55ebd3){return client[_0x37f1('0x12')](_0x4f5c8f,_0x3fb236)['then'](function(_0x19819d){logger[_0x37f1('0x13')](_0x37f1('0x14'),_0xf1058a,_0x37f1('0x15'));logger['debug'](_0x37f1('0x16'),_0xf1058a,_0x37f1('0x15'),JSON[_0x37f1('0x17')](_0x19819d));if(_0x19819d['error']){if(_0x19819d[_0x37f1('0x18')][_0x37f1('0x19')]===0x1f4){logger[_0x37f1('0x18')](_0x37f1('0x14'),_0xf1058a,_0x19819d[_0x37f1('0x18')][_0x37f1('0x1a')]);return _0x55ebd3(_0x19819d['error'][_0x37f1('0x1a')]);}logger[_0x37f1('0x18')](_0x37f1('0x14'),_0xf1058a,_0x19819d[_0x37f1('0x18')][_0x37f1('0x1a')]);return _0x22a4c9(_0x19819d[_0x37f1('0x18')][_0x37f1('0x1a')]);}else{logger[_0x37f1('0x13')](_0x37f1('0x14'),_0xf1058a,'request\x20sent');_0x22a4c9(_0x19819d[_0x37f1('0x1b')]['message']);}})[_0x37f1('0x1c')](function(_0x590430){logger[_0x37f1('0x18')](_0x37f1('0x14'),_0xf1058a,_0x590430);_0x55ebd3(_0x590430);});});}exports[_0x37f1('0x1d')]=function(_0x2f14b4){var _0x3e8ca8=this;return new Promise(function(_0x5319cd,_0x55d045){return db[_0x37f1('0x1e')][_0x37f1('0x1f')](_0x2f14b4['body'],{'raw':_0x2f14b4[_0x37f1('0x20')]?_0x2f14b4[_0x37f1('0x20')][_0x37f1('0x21')]===undefined?!![]:![]:!![]})[_0x37f1('0x22')](function(_0x301ceb){logger['info'](_0x37f1('0x1d'),_0x2f14b4);logger[_0x37f1('0x23')](_0x37f1('0x1d'),_0x2f14b4,JSON[_0x37f1('0x17')](_0x301ceb));_0x5319cd(_0x301ceb);})[_0x37f1('0x1c')](function(_0x2c58e3){logger[_0x37f1('0x18')](_0x37f1('0x1d'),_0x2c58e3[_0x37f1('0x1a')],_0x2f14b4);_0x55d045(_0x3e8ca8[_0x37f1('0x18')](0x1f4,_0x2c58e3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 2ffa63e..72bb272 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 _0xe0dc=['whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe0dc,0xe5));var _0xce0d=function(_0x46c9cc,_0xd27dca){_0x46c9cc=_0x46c9cc-0x0;var _0x21b46e=_0xe0dc[_0x46c9cc];return _0x21b46e;};'use strict';var WhatsappMessageEvents=require(_0xce0d('0x0'));var events=[_0xce0d('0x1'),'remove',_0xce0d('0x2')];function createListener(_0x5168de,_0x37a0fd){return function(_0xacc525){_0x37a0fd[_0xce0d('0x3')](_0x5168de,_0xacc525);};}function removeListener(_0x5ae077,_0x1d81f2){return function(){WhatsappMessageEvents[_0xce0d('0x4')](_0x5ae077,_0x1d81f2);};}exports['register']=function(_0x50ab40){for(var _0x2d2e13=0x0,_0x23a67e=events['length'];_0x2d2e13<_0x23a67e;_0x2d2e13++){var _0x2c04e9=events[_0x2d2e13];var _0x46c082=createListener(_0xce0d('0x5')+_0x2c04e9,_0x50ab40);WhatsappMessageEvents['on'](_0x2c04e9,_0x46c082);}}; \ No newline at end of file +var _0xa935=['update','emit','removeListener','register','length','whatsappMessage:','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa935,0x13a));var _0x5a93=function(_0x50811d,_0x17d91c){_0x50811d=_0x50811d-0x0;var _0x4f1582=_0xa935[_0x50811d];return _0x4f1582;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x5a93('0x0'),'remove',_0x5a93('0x1')];function createListener(_0x2c0ac0,_0x3793e9){return function(_0x3aaaaf){_0x3793e9[_0x5a93('0x2')](_0x2c0ac0,_0x3aaaaf);};}function removeListener(_0x387f2f,_0x9c6fa5){return function(){WhatsappMessageEvents[_0x5a93('0x3')](_0x387f2f,_0x9c6fa5);};}exports[_0x5a93('0x4')]=function(_0x28768e){for(var _0x2dff6a=0x0,_0x55ff06=events[_0x5a93('0x5')];_0x2dff6a<_0x55ff06;_0x2dff6a++){var _0x1e8177=events[_0x2dff6a];var _0x166a2e=createListener(_0x5a93('0x6')+_0x1e8177,_0x28768e);WhatsappMessageEvents['on'](_0x1e8177,_0x166a2e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index dcd694f..18a9f06 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 _0xb9d4=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete'];(function(_0x5879de,_0x32cbbd){var _0x44f9bf=function(_0x416345){while(--_0x416345){_0x5879de['push'](_0x5879de['shift']());}};_0x44f9bf(++_0x32cbbd);}(_0xb9d4,0x199));var _0x4b9d=function(_0x14a2e0,_0x309009){_0x14a2e0=_0x14a2e0-0x0;var _0x290b01=_0xb9d4[_0x14a2e0];return _0x290b01;};'use strict';var multer=require(_0x4b9d('0x0'));var util=require(_0x4b9d('0x1'));var path=require(_0x4b9d('0x2'));var timeout=require(_0x4b9d('0x3'));var express=require('express');var router=express[_0x4b9d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4b9d('0x5'));var interaction=require(_0x4b9d('0x6'));var config=require(_0x4b9d('0x7'));var controller=require(_0x4b9d('0x8'));router[_0x4b9d('0x9')]('/',auth[_0x4b9d('0xa')](),controller[_0x4b9d('0xb')]);router[_0x4b9d('0x9')]('/describe',auth[_0x4b9d('0xa')](),controller[_0x4b9d('0xc')]);router[_0x4b9d('0x9')](_0x4b9d('0xd'),auth[_0x4b9d('0xa')](),controller['show']);router[_0x4b9d('0x9')](_0x4b9d('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x4b9d('0x9')](_0x4b9d('0xf'),auth[_0x4b9d('0xa')](),controller[_0x4b9d('0x10')]);router[_0x4b9d('0x9')]('/:id/users',auth[_0x4b9d('0xa')](),controller[_0x4b9d('0x11')]);router[_0x4b9d('0x12')]('/',auth[_0x4b9d('0xa')](),controller[_0x4b9d('0x13')]);router[_0x4b9d('0x12')](_0x4b9d('0xf'),auth[_0x4b9d('0xa')](),controller[_0x4b9d('0x14')]);router['post'](_0x4b9d('0x15'),auth['isAuthenticated'](),controller[_0x4b9d('0x16')]);router[_0x4b9d('0x17')]('/:id',auth[_0x4b9d('0xa')](),controller[_0x4b9d('0x18')]);router[_0x4b9d('0x19')](_0x4b9d('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x4b9d('0x19')](_0x4b9d('0xf'),auth[_0x4b9d('0xa')](),controller[_0x4b9d('0x1a')]);router[_0x4b9d('0x19')](_0x4b9d('0x15'),auth['isAuthenticated'](),controller[_0x4b9d('0x1b')]);module[_0x4b9d('0x1c')]=router; \ No newline at end of file +var _0x6d35=['../../components/auth/service','../../config/environment','isAuthenticated','get','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','express','fs-extra'];(function(_0x5f5df5,_0x2f41c8){var _0x511d12=function(_0x33bbd6){while(--_0x33bbd6){_0x5f5df5['push'](_0x5f5df5['shift']());}};_0x511d12(++_0x2f41c8);}(_0x6d35,0x134));var _0x56d3=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x6d35[_0x11a55c];return _0x26c390;};'use strict';var multer=require(_0x56d3('0x0'));var util=require(_0x56d3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56d3('0x2'));var router=express['Router']();var fs_extra=require(_0x56d3('0x3'));var auth=require(_0x56d3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x56d3('0x5'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x56d3('0x6')](),controller['index']);router[_0x56d3('0x7')]('/describe',auth[_0x56d3('0x6')](),controller[_0x56d3('0x8')]);router[_0x56d3('0x7')]('/:id',auth[_0x56d3('0x6')](),controller[_0x56d3('0x9')]);router[_0x56d3('0x7')](_0x56d3('0xa'),auth['isAuthenticated'](),controller[_0x56d3('0xb')]);router[_0x56d3('0x7')](_0x56d3('0xc'),auth['isAuthenticated'](),controller[_0x56d3('0xd')]);router[_0x56d3('0x7')](_0x56d3('0xe'),auth['isAuthenticated'](),controller[_0x56d3('0xf')]);router['post']('/',auth[_0x56d3('0x6')](),controller[_0x56d3('0x10')]);router[_0x56d3('0x11')](_0x56d3('0xc'),auth[_0x56d3('0x6')](),controller['addTeams']);router['post'](_0x56d3('0xe'),auth[_0x56d3('0x6')](),controller[_0x56d3('0x12')]);router[_0x56d3('0x13')](_0x56d3('0x14'),auth[_0x56d3('0x6')](),controller[_0x56d3('0x15')]);router[_0x56d3('0x16')]('/:id',auth[_0x56d3('0x6')](),controller[_0x56d3('0x17')]);router[_0x56d3('0x16')](_0x56d3('0xc'),auth[_0x56d3('0x6')](),controller[_0x56d3('0x18')]);router['delete'](_0x56d3('0xe'),auth[_0x56d3('0x6')](),controller[_0x56d3('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 eccfa6d..0bf89cd 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 _0x55ea=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0x55ea,0xc9));var _0xa55e=function(_0x17e169,_0x3df8f5){_0x17e169=_0x17e169-0x0;var _0x52ef9c=_0x55ea[_0x17e169];return _0x52ef9c;};'use strict';var Sequelize=require(_0xa55e('0x0'));module[_0xa55e('0x1')]={'name':{'type':Sequelize[_0xa55e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa55e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa55e('0x4')](_0xa55e('0x5'),_0xa55e('0x6'),_0xa55e('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb74d=['sequelize','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb74d,0x16e));var _0xdb74=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0xb74d[_0x1af98d];return _0x3553ea;};'use strict';var Sequelize=require(_0xdb74('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb74('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdb74('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdb74('0x3'),_0xdb74('0x4'),_0xdb74('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index aa8d0e6..e84f45e 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 _0x3e8a=['merge','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','UserWhatsappQueue','hasOwnProperty','nolimit','sort','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','findAll','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','end','status','offset','undefined','limit','count','json','update','then','get','destroy','error','name','send','index','map','WhatsappQueue','rawAttributes','where','include','query','rows','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll'];(function(_0x4ceae7,_0x23eb83){var _0x33eca4=function(_0x191175){while(--_0x191175){_0x4ceae7['push'](_0x4ceae7['shift']());}};_0x33eca4(++_0x23eb83);}(_0x3e8a,0xbd));var _0xa3e8=function(_0x382938,_0xedafd6){_0x382938=_0x382938-0x0;var _0x1a472=_0x3e8a[_0x382938];return _0x1a472;};'use strict';var BPromise=require('bluebird');var util=require(_0xa3e8('0x0'));var _=require(_0xa3e8('0x1'));var squel=require(_0xa3e8('0x2'));var Redis=require(_0xa3e8('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xa3e8('0x4'))(_0xa3e8('0x5'));var config=require('../../config/environment');var db=require(_0xa3e8('0x6'))['db'];config[_0xa3e8('0x7')]=_[_0xa3e8('0x8')](config[_0xa3e8('0x7')],{'host':_0xa3e8('0x9'),'port':0x18eb});var socket=require(_0xa3e8('0xa'))(new Redis(config[_0xa3e8('0x7')]));require(_0xa3e8('0xb'))[_0xa3e8('0xc')](socket);function respondWithStatusCode(_0x5d809f,_0x5a3569){_0x5a3569=_0x5a3569||0xcc;return function(_0x4adeed){if(_0x4adeed){return _0x5d809f['sendStatus'](_0x5a3569);}return _0x5d809f['status'](_0x5a3569)[_0xa3e8('0xd')]();};}function respondWithResult(_0x5dc68b,_0x53edf9){_0x53edf9=_0x53edf9||0xc8;return function(_0x542f38){if(_0x542f38){return _0x5dc68b[_0xa3e8('0xe')](_0x53edf9)['json'](_0x542f38);}};}function respondWithFilteredResult(_0x3acda1,_0x3d0048){return function(_0x5a6dc2){if(_0x5a6dc2){var _0x3caeee=typeof _0x3d0048[_0xa3e8('0xf')]===_0xa3e8('0x10')&&typeof _0x3d0048[_0xa3e8('0x11')]===_0xa3e8('0x10');var _0x4dcad6=_0x5a6dc2[_0xa3e8('0x12')];var _0x52f43d=_0x3caeee?0x0:_0x3d0048[_0xa3e8('0xf')];var _0x29512e=_0x3caeee?_0x5a6dc2[_0xa3e8('0x12')]:_0x3d0048[_0xa3e8('0xf')]+_0x3d0048[_0xa3e8('0x11')];var _0x1f609f;if(_0x29512e>=_0x4dcad6){_0x29512e=_0x4dcad6;_0x1f609f=0xc8;}else{_0x1f609f=0xce;}_0x3acda1['status'](_0x1f609f);return _0x3acda1['set']('Content-Range',_0x52f43d+'-'+_0x29512e+'/'+_0x4dcad6)[_0xa3e8('0x13')](_0x5a6dc2);}return null;};}function saveUpdates(_0x4bea4b){return function(_0x16a485){if(_0x16a485){return _0x16a485[_0xa3e8('0x14')](_0x4bea4b)[_0xa3e8('0x15')](function(_0x420289){return _0x420289;});}return null;};}function removeEntity(_0x4a59b3){return function(_0x5d7bee){if(_0x5d7bee){return _0x5d7bee['destroy']()['then'](function(){var _0x25f60f=_0x5d7bee[_0xa3e8('0x16')]({'plain':!![]});var _0x32f6af='WhatsappQueues';return db['UserProfileResource'][_0xa3e8('0x17')]({'where':{'type':_0x32f6af,'resourceId':_0x25f60f['id']}})['then'](function(){return _0x5d7bee;});})[_0xa3e8('0x15')](function(){_0x4a59b3[_0xa3e8('0xe')](0xcc)[_0xa3e8('0xd')]();});}};}function handleEntityNotFound(_0x575366){return function(_0x493f0d){if(!_0x493f0d){_0x575366['sendStatus'](0x194);}return _0x493f0d;};}function handleError(_0x52174,_0x53f59a){_0x53f59a=_0x53f59a||0x1f4;return function(_0x2f928c){logger[_0xa3e8('0x18')](_0x2f928c['stack']);if(_0x2f928c[_0xa3e8('0x19')]){delete _0x2f928c[_0xa3e8('0x19')];}_0x52174['status'](_0x53f59a)[_0xa3e8('0x1a')](_0x2f928c);};}exports[_0xa3e8('0x1b')]=function(_0x593f52,_0x129f10){var _0x5a8dec={};var _0x1be5ce={'count':0x0,'rows':[]};var _0x38e283=_[_0xa3e8('0x1c')](db[_0xa3e8('0x1d')][_0xa3e8('0x1e')],function(_0x46700a){return{'name':_0x46700a['fieldName'],'type':_0x46700a['type']['key']};});_0x5a8dec=qs['getOptions'](_0x38e283,_0x593f52);var _0x271d92={'where':_0x5a8dec[_0xa3e8('0x1f')]};return db[_0xa3e8('0x1d')]['count'](_0x271d92)['then'](function(_0x3dc7f7){_0x1be5ce[_0xa3e8('0x12')]=_0x3dc7f7;_0x5a8dec[_0xa3e8('0x20')]=qs[_0xa3e8('0x20')](_0x593f52[_0xa3e8('0x21')]);return db['WhatsappQueue']['findAll'](_0x5a8dec);})[_0xa3e8('0x15')](function(_0x5e54c5){_0x1be5ce[_0xa3e8('0x22')]=_0x5e54c5;return _0x1be5ce;})[_0xa3e8('0x15')](respondWithFilteredResult(_0x129f10,_0x5a8dec))['catch'](handleError(_0x129f10,null));};exports[_0xa3e8('0x23')]=function(_0x3cc29d,_0x257b50){var _0x238711={'raw':!![],'where':{'id':_0x3cc29d[_0xa3e8('0x24')]['id']}},_0x189061={};_0x189061[_0xa3e8('0x25')]=_[_0xa3e8('0x26')](db[_0xa3e8('0x1d')][_0xa3e8('0x1e')]);_0x189061[_0xa3e8('0x21')]=_[_0xa3e8('0x26')](_0x3cc29d[_0xa3e8('0x21')]);_0x189061[_0xa3e8('0x27')]=_[_0xa3e8('0x28')](_0x189061['model'],_0x189061[_0xa3e8('0x21')]);_0x238711['attributes']=_['intersection'](_0x189061[_0xa3e8('0x25')],qs[_0xa3e8('0x29')](_0x3cc29d[_0xa3e8('0x21')][_0xa3e8('0x29')]));_0x238711[_0xa3e8('0x2a')]=_0x238711[_0xa3e8('0x2a')][_0xa3e8('0x2b')]?_0x238711[_0xa3e8('0x2a')]:_0x189061['model'];if(_0x3cc29d[_0xa3e8('0x21')][_0xa3e8('0x2c')]){_0x238711[_0xa3e8('0x20')]=[{'all':!![]}];}_0x238711=_[_0xa3e8('0x2d')]({},_0x238711,_0x3cc29d[_0xa3e8('0x2e')]);return db[_0xa3e8('0x1d')][_0xa3e8('0x2f')](_0x238711)['then'](handleEntityNotFound(_0x257b50,null))['then'](respondWithResult(_0x257b50,null))['catch'](handleError(_0x257b50,null));};exports['create']=function(_0x39653b,_0x19e101){return db[_0xa3e8('0x1d')]['create'](_0x39653b[_0xa3e8('0x30')],{})[_0xa3e8('0x15')](function(_0x15184b){var _0x4cbd2e=_0x39653b[_0xa3e8('0x31')][_0xa3e8('0x16')]({'plain':!![]});if(!_0x4cbd2e)throw new Error(_0xa3e8('0x32'));if(_0x4cbd2e[_0xa3e8('0x33')]===_0xa3e8('0x31')){var _0x420f9e=_0x15184b['get']({'plain':!![]});var _0x517d2a='WhatsappQueues';return db[_0xa3e8('0x34')]['find']({'where':{'name':_0x517d2a,'userProfileId':_0x4cbd2e[_0xa3e8('0x35')]},'raw':!![]})[_0xa3e8('0x15')](function(_0x343757){if(_0x343757&&_0x343757['autoAssociation']===0x0){return db[_0xa3e8('0x36')][_0xa3e8('0x37')]({'name':_0x420f9e['name'],'resourceId':_0x420f9e['id'],'type':_0x343757[_0xa3e8('0x19')],'sectionId':_0x343757['id']},{})[_0xa3e8('0x15')](function(){return _0x15184b;});}else{return _0x15184b;}})['catch'](function(_0x20cc47){logger[_0xa3e8('0x18')](_0xa3e8('0x38'),_0x20cc47);throw _0x20cc47;});}return _0x15184b;})[_0xa3e8('0x15')](respondWithResult(_0x19e101,0xc9))[_0xa3e8('0x39')](handleError(_0x19e101,null));};exports['update']=function(_0x5f47e7,_0x5778ad){if(_0x5f47e7[_0xa3e8('0x30')]['id']){delete _0x5f47e7[_0xa3e8('0x30')]['id'];}return db[_0xa3e8('0x1d')][_0xa3e8('0x2f')]({'where':{'id':_0x5f47e7[_0xa3e8('0x24')]['id']}})['then'](handleEntityNotFound(_0x5778ad,null))['then'](saveUpdates(_0x5f47e7['body'],null))[_0xa3e8('0x15')](respondWithResult(_0x5778ad,null))['catch'](handleError(_0x5778ad,null));};exports['destroy']=function(_0x23cae8,_0x47b08f){return db[_0xa3e8('0x1d')][_0xa3e8('0x2f')]({'where':{'id':_0x23cae8['params']['id']}})['then'](handleEntityNotFound(_0x47b08f,null))['then'](removeEntity(_0x47b08f,null))['catch'](handleError(_0x47b08f,null));};exports[_0xa3e8('0x3a')]=function(_0x365246,_0x4a130d){return db[_0xa3e8('0x1d')][_0xa3e8('0x3a')]()[_0xa3e8('0x15')](respondWithResult(_0x4a130d,null))[_0xa3e8('0x39')](handleError(_0x4a130d,null));};exports[_0xa3e8('0x3b')]=function(_0x10afb5,_0x570379){var _0x3a6ee8={'raw':!![],'where':{}},_0x35a8f9={},_0x3f863d;return db[_0xa3e8('0x1d')]['findOne']({'where':{'id':_0x10afb5[_0xa3e8('0x24')]['id']}})['then'](handleEntityNotFound(_0x570379,null))[_0xa3e8('0x15')](function(_0x48c268){if(_0x48c268){_0x3f863d=_0x48c268['get']({'plain':!![]});_0x35a8f9['model']=_[_0xa3e8('0x26')](db[_0xa3e8('0x3c')][_0xa3e8('0x1e')]);_0x35a8f9[_0xa3e8('0x21')]=_[_0xa3e8('0x26')](_0x10afb5[_0xa3e8('0x21')]);_0x35a8f9[_0xa3e8('0x27')]=_[_0xa3e8('0x28')](_0x35a8f9[_0xa3e8('0x25')],_0x35a8f9[_0xa3e8('0x21')]);_0x3a6ee8[_0xa3e8('0x2a')]=_[_0xa3e8('0x28')](_0x35a8f9[_0xa3e8('0x25')],qs[_0xa3e8('0x29')](_0x10afb5[_0xa3e8('0x21')][_0xa3e8('0x29')]));_0x3a6ee8[_0xa3e8('0x2a')]=_0x3a6ee8[_0xa3e8('0x2a')][_0xa3e8('0x2b')]?_0x3a6ee8[_0xa3e8('0x2a')]:_0x35a8f9[_0xa3e8('0x25')];if(!_0x10afb5['query'][_0xa3e8('0x3d')](_0xa3e8('0x3e'))){_0x3a6ee8[_0xa3e8('0x11')]=qs[_0xa3e8('0x11')](_0x10afb5[_0xa3e8('0x21')][_0xa3e8('0x11')]);_0x3a6ee8[_0xa3e8('0xf')]=qs[_0xa3e8('0xf')](_0x10afb5[_0xa3e8('0x21')][_0xa3e8('0xf')]);}_0x3a6ee8['order']=qs[_0xa3e8('0x3f')](_0x10afb5[_0xa3e8('0x21')][_0xa3e8('0x3f')]);_0x3a6ee8[_0xa3e8('0x1f')]=qs[_0xa3e8('0x27')](_['pick'](_0x10afb5[_0xa3e8('0x21')],_0x35a8f9['filters']));_0x3a6ee8[_0xa3e8('0x1f')][_0xa3e8('0x40')]=_0x48c268['id'];if(_0x10afb5[_0xa3e8('0x21')][_0xa3e8('0x41')]){_0x3a6ee8[_0xa3e8('0x1f')]=_[_0xa3e8('0x2d')](_0x3a6ee8[_0xa3e8('0x1f')],{'$or':_[_0xa3e8('0x1c')](_0x3a6ee8['attributes'],function(_0x17ae2f){var _0x498486={};_0x498486[_0x17ae2f]={'$like':'%'+_0x10afb5[_0xa3e8('0x21')][_0xa3e8('0x41')]+'%'};return _0x498486;})});}_0x3a6ee8=_[_0xa3e8('0x2d')]({},_0x3a6ee8,_0x10afb5[_0xa3e8('0x2e')]);return db[_0xa3e8('0x3c')]['findAll'](_0x3a6ee8);}})[_0xa3e8('0x15')](function(_0x3933fb){if(_0x3933fb){return db[_0xa3e8('0x42')][_0xa3e8('0x43')]({'where':{'id':_[_0xa3e8('0x1c')](_0x3933fb,_0xa3e8('0x44')),'role':_0xa3e8('0x45')},'attributes':['id',_0xa3e8('0x19'),_0xa3e8('0x46'),_0xa3e8('0x47'),_0xa3e8('0x48')]});}})['then'](function(_0x18ba4f){if(_0x18ba4f){return{'count':_0x18ba4f[_0xa3e8('0x12')],'rows':_[_0xa3e8('0x1c')](_0x18ba4f[_0xa3e8('0x22')],function(_0x2d61bd){return{'membername':_0x2d61bd[_0xa3e8('0x19')],'UserId':_0x2d61bd['id'],'queue_name':_0x3f863d['name'],'WhatsappQueueId':_0x3f863d['id'],'interface':util[_0xa3e8('0x49')](_0xa3e8('0x4a'),_0xa3e8('0x4b'),_0x2d61bd[_0xa3e8('0x19')]),'penalty':0x0,'paused':_0x2d61bd[_0xa3e8('0x46')],'createdAt':_0x2d61bd[_0xa3e8('0x48')],'updatedAt':_0x2d61bd[_0xa3e8('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa3e8('0x15')](respondWithFilteredResult(_0x570379,_0x3a6ee8))[_0xa3e8('0x39')](handleError(_0x570379,null));};exports[_0xa3e8('0x4c')]=function(_0x1fd907,_0x3ccb79){var _0x3ed920={};var _0x4fc578={};var _0x3ce3f5;var _0x25fcd9;return db[_0xa3e8('0x1d')][_0xa3e8('0x4d')]({'where':{'id':_0x1fd907['params']['id']}})[_0xa3e8('0x15')](handleEntityNotFound(_0x3ccb79,null))[_0xa3e8('0x15')](function(_0x564be0){if(_0x564be0){_0x3ce3f5=_0x564be0;_0x4fc578['model']=_[_0xa3e8('0x26')](db[_0xa3e8('0x4e')]['rawAttributes']);_0x4fc578[_0xa3e8('0x21')]=_['keys'](_0x1fd907[_0xa3e8('0x21')]);_0x4fc578[_0xa3e8('0x27')]=_['intersection'](_0x4fc578[_0xa3e8('0x25')],_0x4fc578[_0xa3e8('0x21')]);_0x3ed920[_0xa3e8('0x2a')]=_[_0xa3e8('0x28')](_0x4fc578[_0xa3e8('0x25')],qs[_0xa3e8('0x29')](_0x1fd907[_0xa3e8('0x21')]['fields']));_0x3ed920['attributes']=_0x3ed920[_0xa3e8('0x2a')][_0xa3e8('0x2b')]?_0x3ed920[_0xa3e8('0x2a')]:_0x4fc578[_0xa3e8('0x25')];_0x3ed920['order']=qs[_0xa3e8('0x3f')](_0x1fd907[_0xa3e8('0x21')][_0xa3e8('0x3f')]);_0x3ed920[_0xa3e8('0x1f')]=qs[_0xa3e8('0x27')](_['pick'](_0x1fd907[_0xa3e8('0x21')],_0x4fc578['filters']));if(_0x1fd907['query'][_0xa3e8('0x41')]){_0x3ed920[_0xa3e8('0x1f')]=_[_0xa3e8('0x2d')](_0x3ed920[_0xa3e8('0x1f')],{'$or':_[_0xa3e8('0x1c')](_0x3ed920['attributes'],function(_0x282c62){var _0x32c76e={};_0x32c76e[_0x282c62]={'$like':'%'+_0x1fd907[_0xa3e8('0x21')]['filter']+'%'};return _0x32c76e;})});}_0x3ed920=_[_0xa3e8('0x2d')]({},_0x3ed920,_0x1fd907[_0xa3e8('0x2e')]);return _0x3ce3f5['getTeams'](_0x3ed920);}})['then'](function(_0x1d4db8){if(_0x1d4db8){_0x25fcd9=_0x1d4db8[_0xa3e8('0x2b')];if(!_0x1fd907[_0xa3e8('0x21')][_0xa3e8('0x3d')]('nolimit')){_0x3ed920[_0xa3e8('0x11')]=qs['limit'](_0x1fd907[_0xa3e8('0x21')][_0xa3e8('0x11')]);_0x3ed920[_0xa3e8('0xf')]=qs['offset'](_0x1fd907[_0xa3e8('0x21')][_0xa3e8('0xf')]);}return _0x3ce3f5[_0xa3e8('0x4c')](_0x3ed920);}})['then'](function(_0x10f315){if(_0x10f315){return _0x10f315?{'count':_0x25fcd9,'rows':_0x10f315}:null;}})[_0xa3e8('0x15')](respondWithResult(_0x3ccb79,null))[_0xa3e8('0x39')](handleError(_0x3ccb79,null));};exports[_0xa3e8('0x4f')]=function(_0x7bd61a,_0x177d91){var _0x204e43=_0x7bd61a['body'][_0xa3e8('0x50')];return db['Team'][_0xa3e8('0x51')]({'where':{'id':_0x204e43},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa3e8('0x19'),'online',_0xa3e8('0x52'),_0xa3e8('0x53')],'raw':!![]}]})[_0xa3e8('0x15')](function(_0xad5ea0){if(_0xad5ea0){var _0x269a69=_[_0xa3e8('0x54')](_0xad5ea0,function(_0x22b0ae){var _0x3c5c2c=_0x22b0ae[_0xa3e8('0x16')]({'plain':!![]});return _0x3c5c2c[_0xa3e8('0x55')];});return db[_0xa3e8('0x1d')]['find']({'where':{'id':_0x7bd61a['params']['id']}})[_0xa3e8('0x15')](function(_0x3bfbf2){return db[_0xa3e8('0x56')][_0xa3e8('0x57')](function(_0x35e21d){return _0x3bfbf2['addTeams'](_0x204e43,{'transaction':_0x35e21d})[_0xa3e8('0x15')](function(){return BPromise['each'](_0x269a69,function(_0x4131fc){return db[_0xa3e8('0x3c')][_0xa3e8('0x58')]({'where':{'UserId':_0x4131fc['id'],'WhatsappQueueId':_0x7bd61a['params']['id']},'transaction':_0x35e21d});});})[_0xa3e8('0x15')](function(){_0x269a69[_0xa3e8('0x59')](function(_0x358e08){socket[_0xa3e8('0x5a')](_0xa3e8('0x5b'),{'UserId':_0x358e08['id'],'WhatsappQueueId':_0x3bfbf2['id']});});});});});}})[_0xa3e8('0x15')](respondWithStatusCode(_0x177d91,null))[_0xa3e8('0x39')](handleError(_0x177d91,null));};exports[_0xa3e8('0x5c')]=function(_0x91e1cf,_0x546675){return db[_0xa3e8('0x4e')]['findAll']({'where':{'id':_0x91e1cf[_0xa3e8('0x21')][_0xa3e8('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa3e8('0x15')](handleEntityNotFound(_0x546675,null))[_0xa3e8('0x15')](function(_0x1871c7){var _0x298ed9=_[_0xa3e8('0x1c')](_0x1871c7,'id');var _0x384555=[];var _0x4fdfd2=[];var _0x174f2c=squel['select']();_0x174f2c[_0xa3e8('0x5d')](_0xa3e8('0x5e'))['from'](_0xa3e8('0x5f'),'tq')['join'](_0xa3e8('0x60'),'ut',_0xa3e8('0x61'))[_0xa3e8('0x1f')](_0xa3e8('0x62'),_0x91e1cf['params']['id']);for(var _0x29889c=0x0;_0x29889c<_0x1871c7[_0xa3e8('0x2b')];_0x29889c+=0x1){let _0x3ddba4=_0x1871c7[_0x29889c];for(var _0x38b121=0x0;_0x38b121<_0x3ddba4[_0xa3e8('0x55')]['length'];_0x38b121+=0x1){let _0x84b4e5=_0x3ddba4[_0xa3e8('0x55')][_0x38b121];var _0x1f739e=_0x174f2c['clone']();_0x1f739e['where'](_0xa3e8('0x63'),_0x84b4e5['id']);_0x4fdfd2[_0xa3e8('0x64')](db[_0xa3e8('0x56')][_0xa3e8('0x21')](_0x1f739e[_0xa3e8('0x65')](),{'type':db[_0xa3e8('0x56')]['QueryTypes'][_0xa3e8('0x66')]})[_0xa3e8('0x15')](function(_0x6a331){if(_0x6a331[_0xa3e8('0x2b')]===0x1){return _0x84b4e5['id'];}else{var _0x1d9231=_[_0xa3e8('0x67')](_[_0xa3e8('0x1c')](_0x6a331,'TeamId'),function(_0x2f1924){return _[_0xa3e8('0x68')](_0x298ed9,_0x2f1924);});if(_0x1d9231){return _0x84b4e5['id'];}}}));}}return BPromise[_0xa3e8('0x69')](_0x4fdfd2)['then'](function(_0x276810){_0x384555=_(_0x384555)[_0xa3e8('0x6a')](_0x276810)[_0xa3e8('0x6b')]()[_0xa3e8('0x6c')]();return db[_0xa3e8('0x1d')][_0xa3e8('0x2f')]({'where':{'id':_0x91e1cf[_0xa3e8('0x24')]['id']}})[_0xa3e8('0x15')](function(_0x174524){return db['sequelize']['transaction'](function(_0x2d3f81){return _0x174524[_0xa3e8('0x5c')](_0x91e1cf[_0xa3e8('0x21')][_0xa3e8('0x50')],{'transaction':_0x2d3f81})[_0xa3e8('0x15')](function(){if(!_[_0xa3e8('0x6d')](_0x384555)){return _0x174524['removeAgents'](_0x384555,{'transaction':_0x2d3f81});}})[_0xa3e8('0x15')](function(){_0x384555[_0xa3e8('0x59')](function(_0x38961e){socket[_0xa3e8('0x5a')](_0xa3e8('0x6e'),{'UserId':_0x38961e,'WhatsappQueueId':_0x174524['id']});});});});});});})['then'](respondWithStatusCode(_0x546675,null))[_0xa3e8('0x39')](handleError(_0x546675,null));};exports[_0xa3e8('0x6f')]=function(_0x52a4ea,_0x368137){return db[_0xa3e8('0x1d')]['find']({'where':{'id':_0x52a4ea[_0xa3e8('0x24')]['id']}})[_0xa3e8('0x15')](handleEntityNotFound(_0x368137,null))[_0xa3e8('0x15')](function(_0x4b39e9){if(_0x4b39e9){return _0x4b39e9[_0xa3e8('0x6f')](_0x52a4ea['body'][_0xa3e8('0x50')],_[_0xa3e8('0x70')](_0x52a4ea[_0xa3e8('0x30')],['ids','id'])||{})[_0xa3e8('0x71')](function(_0x132757){for(var _0x28051b=0x0;_0x28051b<_0x52a4ea[_0xa3e8('0x30')]['ids'][_0xa3e8('0x2b')];_0x28051b+=0x1){socket[_0xa3e8('0x5a')](_0xa3e8('0x5b'),{'UserId':Number(_0x52a4ea['body'][_0xa3e8('0x50')][_0x28051b]),'WhatsappQueueId':Number(_0x52a4ea[_0xa3e8('0x24')]['id'])});}return _0x132757;});}})[_0xa3e8('0x15')](respondWithResult(_0x368137,null))[_0xa3e8('0x39')](handleError(_0x368137,null));};exports[_0xa3e8('0x72')]=function(_0x5d7098,_0x2d867c){return db[_0xa3e8('0x1d')]['find']({'where':{'id':_0x5d7098[_0xa3e8('0x24')]['id']}})[_0xa3e8('0x15')](handleEntityNotFound(_0x2d867c,null))[_0xa3e8('0x15')](function(_0x41145d){if(_0x41145d){return _0x41145d[_0xa3e8('0x72')](_0x5d7098['query']['ids'])[_0xa3e8('0x15')](function(){if(_[_0xa3e8('0x73')](_0x5d7098[_0xa3e8('0x21')]['ids'])){for(var _0x4c0dcf=0x0;_0x4c0dcf<_0x5d7098['query'][_0xa3e8('0x50')][_0xa3e8('0x2b')];_0x4c0dcf+=0x1){socket[_0xa3e8('0x5a')]('userWhatsappQueue:remove',{'UserId':Number(_0x5d7098[_0xa3e8('0x21')][_0xa3e8('0x50')][_0x4c0dcf]),'WhatsappQueueId':Number(_0x5d7098['params']['id'])});}}else{socket[_0xa3e8('0x5a')](_0xa3e8('0x6e'),{'UserId':Number(_0x5d7098['query'][_0xa3e8('0x50')]),'WhatsappQueueId':Number(_0x5d7098['params']['id'])});}});}})[_0xa3e8('0x15')](respondWithStatusCode(_0x2d867c,null))[_0xa3e8('0x39')](handleError(_0x2d867c,null));};exports['getAgents']=function(_0x3219d9,_0x4f0533){var _0x319fc3={};var _0x3e109a={};var _0x3d9e49;var _0x5b6529;return db[_0xa3e8('0x1d')][_0xa3e8('0x4d')]({'where':{'id':_0x3219d9[_0xa3e8('0x24')]['id']}})[_0xa3e8('0x15')](handleEntityNotFound(_0x4f0533,null))[_0xa3e8('0x15')](function(_0x2b6835){if(_0x2b6835){_0x3d9e49=_0x2b6835;_0x3e109a['model']=_[_0xa3e8('0x26')](db[_0xa3e8('0x42')][_0xa3e8('0x1e')]);_0x3e109a[_0xa3e8('0x21')]=_[_0xa3e8('0x26')](_0x3219d9[_0xa3e8('0x21')]);_0x3e109a[_0xa3e8('0x27')]=_['intersection'](_0x3e109a[_0xa3e8('0x25')],_0x3e109a['query']);_0x319fc3[_0xa3e8('0x2a')]=_['intersection'](_0x3e109a[_0xa3e8('0x25')],qs[_0xa3e8('0x29')](_0x3219d9[_0xa3e8('0x21')]['fields']));_0x319fc3[_0xa3e8('0x2a')]=_0x319fc3['attributes'][_0xa3e8('0x2b')]?_0x319fc3[_0xa3e8('0x2a')]:_0x3e109a[_0xa3e8('0x25')];_0x319fc3['order']=qs[_0xa3e8('0x3f')](_0x3219d9['query']['sort']);_0x319fc3[_0xa3e8('0x1f')]=qs['filters'](_['pick'](_0x3219d9['query'],_0x3e109a[_0xa3e8('0x27')]));if(_0x3219d9['query'][_0xa3e8('0x41')]){_0x319fc3['where']=_[_0xa3e8('0x2d')](_0x319fc3[_0xa3e8('0x1f')],{'$or':_[_0xa3e8('0x1c')](_0x319fc3[_0xa3e8('0x2a')],function(_0x77d244){var _0x7b1852={};_0x7b1852[_0x77d244]={'$like':'%'+_0x3219d9['query'][_0xa3e8('0x41')]+'%'};return _0x7b1852;})});}_0x319fc3=_[_0xa3e8('0x2d')]({},_0x319fc3,_0x3219d9['options']);return _0x3d9e49[_0xa3e8('0x74')](_0x319fc3);}})[_0xa3e8('0x15')](function(_0xc9fce8){if(_0xc9fce8){_0x5b6529=_0xc9fce8['length'];if(!_0x3219d9[_0xa3e8('0x21')]['hasOwnProperty']('nolimit')){_0x319fc3[_0xa3e8('0x11')]=qs['limit'](_0x3219d9[_0xa3e8('0x21')][_0xa3e8('0x11')]);_0x319fc3[_0xa3e8('0xf')]=qs[_0xa3e8('0xf')](_0x3219d9[_0xa3e8('0x21')][_0xa3e8('0xf')]);}return _0x3d9e49['getAgents'](_0x319fc3);}})['then'](function(_0x3b1ea3){if(_0x3b1ea3){return _0x3b1ea3?{'count':_0x5b6529,'rows':_0x3b1ea3}:null;}})['then'](respondWithResult(_0x4f0533,null))[_0xa3e8('0x39')](handleError(_0x4f0533,null));}; \ No newline at end of file +var _0x0844=['params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','create','body','user','role','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','sort','WhatsappQueueId','filter','map','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','whatsappPause','getTeams','Team','nolimit','ids','User','Agents','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','sequelize','toString','QueryTypes','every','TeamId','includes','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','pick','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','get','UserProfileResource','destroy','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows'];(function(_0x5395d6,_0x2a8b13){var _0x369bd8=function(_0x188163){while(--_0x188163){_0x5395d6['push'](_0x5395d6['shift']());}};_0x369bd8(++_0x2a8b13);}(_0x0844,0xca));var _0x4084=function(_0x41f1f7,_0x26f656){_0x41f1f7=_0x41f1f7-0x0;var _0x56bd7d=_0x0844[_0x41f1f7];return _0x56bd7d;};'use strict';var BPromise=require(_0x4084('0x0'));var util=require(_0x4084('0x1'));var _=require('lodash');var squel=require(_0x4084('0x2'));var Redis=require(_0x4084('0x3'));var qs=require(_0x4084('0x4'));var logger=require(_0x4084('0x5'))(_0x4084('0x6'));var config=require(_0x4084('0x7'));var db=require('../../mysqldb')['db'];config[_0x4084('0x8')]=_['defaults'](config['redis'],{'host':_0x4084('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4084('0x8')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x3831b9,_0x363d59){_0x363d59=_0x363d59||0xcc;return function(_0x3fbdee){if(_0x3fbdee){return _0x3831b9[_0x4084('0xa')](_0x363d59);}return _0x3831b9[_0x4084('0xb')](_0x363d59)[_0x4084('0xc')]();};}function respondWithResult(_0x313c40,_0x2150e7){_0x2150e7=_0x2150e7||0xc8;return function(_0x5bc862){if(_0x5bc862){return _0x313c40[_0x4084('0xb')](_0x2150e7)[_0x4084('0xd')](_0x5bc862);}};}function respondWithFilteredResult(_0x268db5,_0x3308e6){return function(_0x3cd10e){if(_0x3cd10e){var _0x42875a=typeof _0x3308e6[_0x4084('0xe')]==='undefined'&&typeof _0x3308e6[_0x4084('0xf')]===_0x4084('0x10');var _0x11651e=_0x3cd10e[_0x4084('0x11')];var _0x3d423a=_0x42875a?0x0:_0x3308e6['offset'];var _0x557842=_0x42875a?_0x3cd10e[_0x4084('0x11')]:_0x3308e6[_0x4084('0xe')]+_0x3308e6['limit'];var _0x3c2a44;if(_0x557842>=_0x11651e){_0x557842=_0x11651e;_0x3c2a44=0xc8;}else{_0x3c2a44=0xce;}_0x268db5[_0x4084('0xb')](_0x3c2a44);return _0x268db5[_0x4084('0x12')](_0x4084('0x13'),_0x3d423a+'-'+_0x557842+'/'+_0x11651e)[_0x4084('0xd')](_0x3cd10e);}return null;};}function saveUpdates(_0x17de29){return function(_0x202340){if(_0x202340){return _0x202340['update'](_0x17de29)[_0x4084('0x14')](function(_0xceb68a){return _0xceb68a;});}return null;};}function removeEntity(_0x59fc10){return function(_0x4e6a87){if(_0x4e6a87){return _0x4e6a87['destroy']()[_0x4084('0x14')](function(){var _0x482464=_0x4e6a87[_0x4084('0x15')]({'plain':!![]});var _0x4bf4bd='WhatsappQueues';return db[_0x4084('0x16')][_0x4084('0x17')]({'where':{'type':_0x4bf4bd,'resourceId':_0x482464['id']}})['then'](function(){return _0x4e6a87;});})[_0x4084('0x14')](function(){_0x59fc10[_0x4084('0xb')](0xcc)[_0x4084('0xc')]();});}};}function handleEntityNotFound(_0x2a02a8){return function(_0x481bd1){if(!_0x481bd1){_0x2a02a8[_0x4084('0xa')](0x194);}return _0x481bd1;};}function handleError(_0x3c2e0a,_0x169845){_0x169845=_0x169845||0x1f4;return function(_0x2c71fd){logger[_0x4084('0x18')](_0x2c71fd[_0x4084('0x19')]);if(_0x2c71fd[_0x4084('0x1a')]){delete _0x2c71fd[_0x4084('0x1a')];}_0x3c2e0a[_0x4084('0xb')](_0x169845)[_0x4084('0x1b')](_0x2c71fd);};}exports[_0x4084('0x1c')]=function(_0x4dbc6e,_0x34c830){var _0x58b603={};var _0xf7751c={'count':0x0,'rows':[]};var _0x1d1a87=_['map'](db[_0x4084('0x1d')][_0x4084('0x1e')],function(_0x50530b){return{'name':_0x50530b[_0x4084('0x1f')],'type':_0x50530b[_0x4084('0x20')][_0x4084('0x21')]};});_0x58b603=qs[_0x4084('0x22')](_0x1d1a87,_0x4dbc6e);var _0x2fc498={'where':_0x58b603[_0x4084('0x23')]};return db[_0x4084('0x1d')][_0x4084('0x11')](_0x2fc498)['then'](function(_0x1bef19){_0xf7751c[_0x4084('0x11')]=_0x1bef19;_0x58b603[_0x4084('0x24')]=qs[_0x4084('0x24')](_0x4dbc6e[_0x4084('0x25')]);return db[_0x4084('0x1d')][_0x4084('0x26')](_0x58b603);})[_0x4084('0x14')](function(_0x2d345d){_0xf7751c[_0x4084('0x27')]=_0x2d345d;return _0xf7751c;})['then'](respondWithFilteredResult(_0x34c830,_0x58b603))['catch'](handleError(_0x34c830,null));};exports['show']=function(_0x27e2d9,_0x2c1781){var _0x4375e6={'raw':!![],'where':{'id':_0x27e2d9[_0x4084('0x28')]['id']}},_0x563975={};_0x563975[_0x4084('0x29')]=_[_0x4084('0x2a')](db['WhatsappQueue'][_0x4084('0x1e')]);_0x563975[_0x4084('0x25')]=_[_0x4084('0x2a')](_0x27e2d9[_0x4084('0x25')]);_0x563975[_0x4084('0x2b')]=_['intersection'](_0x563975[_0x4084('0x29')],_0x563975['query']);_0x4375e6[_0x4084('0x2c')]=_[_0x4084('0x2d')](_0x563975[_0x4084('0x29')],qs[_0x4084('0x2e')](_0x27e2d9[_0x4084('0x25')][_0x4084('0x2e')]));_0x4375e6[_0x4084('0x2c')]=_0x4375e6['attributes'][_0x4084('0x2f')]?_0x4375e6[_0x4084('0x2c')]:_0x563975[_0x4084('0x29')];if(_0x27e2d9[_0x4084('0x25')][_0x4084('0x30')]){_0x4375e6[_0x4084('0x24')]=[{'all':!![]}];}_0x4375e6=_[_0x4084('0x31')]({},_0x4375e6,_0x27e2d9[_0x4084('0x32')]);return db[_0x4084('0x1d')]['find'](_0x4375e6)['then'](handleEntityNotFound(_0x2c1781,null))[_0x4084('0x14')](respondWithResult(_0x2c1781,null))['catch'](handleError(_0x2c1781,null));};exports[_0x4084('0x33')]=function(_0xc4a077,_0xc97451){return db['WhatsappQueue']['create'](_0xc4a077[_0x4084('0x34')],{})[_0x4084('0x14')](function(_0x4a453d){var _0x20347a=_0xc4a077[_0x4084('0x35')]['get']({'plain':!![]});if(!_0x20347a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20347a[_0x4084('0x36')]===_0x4084('0x35')){var _0xa67905=_0x4a453d[_0x4084('0x15')]({'plain':!![]});var _0x1c4d8f='WhatsappQueues';return db[_0x4084('0x37')][_0x4084('0x38')]({'where':{'name':_0x1c4d8f,'userProfileId':_0x20347a[_0x4084('0x39')]},'raw':!![]})['then'](function(_0x410d79){if(_0x410d79&&_0x410d79['autoAssociation']===0x0){return db['UserProfileResource'][_0x4084('0x33')]({'name':_0xa67905['name'],'resourceId':_0xa67905['id'],'type':_0x410d79['name'],'sectionId':_0x410d79['id']},{})[_0x4084('0x14')](function(){return _0x4a453d;});}else{return _0x4a453d;}})[_0x4084('0x3a')](function(_0x1f645d){logger[_0x4084('0x18')](_0x4084('0x3b'),_0x1f645d);throw _0x1f645d;});}return _0x4a453d;})['then'](respondWithResult(_0xc97451,0xc9))[_0x4084('0x3a')](handleError(_0xc97451,null));};exports[_0x4084('0x3c')]=function(_0xc1db3b,_0xe5bc46){if(_0xc1db3b[_0x4084('0x34')]['id']){delete _0xc1db3b[_0x4084('0x34')]['id'];}return db[_0x4084('0x1d')][_0x4084('0x38')]({'where':{'id':_0xc1db3b['params']['id']}})['then'](handleEntityNotFound(_0xe5bc46,null))[_0x4084('0x14')](saveUpdates(_0xc1db3b[_0x4084('0x34')],null))[_0x4084('0x14')](respondWithResult(_0xe5bc46,null))['catch'](handleError(_0xe5bc46,null));};exports[_0x4084('0x17')]=function(_0x3e752a,_0x582cf4){return db[_0x4084('0x1d')][_0x4084('0x38')]({'where':{'id':_0x3e752a[_0x4084('0x28')]['id']}})[_0x4084('0x14')](handleEntityNotFound(_0x582cf4,null))[_0x4084('0x14')](removeEntity(_0x582cf4,null))['catch'](handleError(_0x582cf4,null));};exports[_0x4084('0x3d')]=function(_0x232817,_0x33af3b){return db['WhatsappQueue'][_0x4084('0x3d')]()[_0x4084('0x14')](respondWithResult(_0x33af3b,null))[_0x4084('0x3a')](handleError(_0x33af3b,null));};exports[_0x4084('0x3e')]=function(_0x62c3e5,_0x288997){var _0x19646a={'raw':!![],'where':{}},_0x5ed9b2={},_0x3f74a7;return db[_0x4084('0x1d')][_0x4084('0x3f')]({'where':{'id':_0x62c3e5[_0x4084('0x28')]['id']}})[_0x4084('0x14')](handleEntityNotFound(_0x288997,null))['then'](function(_0x19bfdf){if(_0x19bfdf){_0x3f74a7=_0x19bfdf['get']({'plain':!![]});_0x5ed9b2[_0x4084('0x29')]=_[_0x4084('0x2a')](db[_0x4084('0x40')][_0x4084('0x1e')]);_0x5ed9b2[_0x4084('0x25')]=_[_0x4084('0x2a')](_0x62c3e5[_0x4084('0x25')]);_0x5ed9b2[_0x4084('0x2b')]=_[_0x4084('0x2d')](_0x5ed9b2[_0x4084('0x29')],_0x5ed9b2[_0x4084('0x25')]);_0x19646a['attributes']=_[_0x4084('0x2d')](_0x5ed9b2[_0x4084('0x29')],qs['fields'](_0x62c3e5['query']['fields']));_0x19646a[_0x4084('0x2c')]=_0x19646a[_0x4084('0x2c')][_0x4084('0x2f')]?_0x19646a[_0x4084('0x2c')]:_0x5ed9b2[_0x4084('0x29')];if(!_0x62c3e5[_0x4084('0x25')][_0x4084('0x41')]('nolimit')){_0x19646a[_0x4084('0xf')]=qs['limit'](_0x62c3e5[_0x4084('0x25')][_0x4084('0xf')]);_0x19646a[_0x4084('0xe')]=qs[_0x4084('0xe')](_0x62c3e5[_0x4084('0x25')]['offset']);}_0x19646a[_0x4084('0x42')]=qs[_0x4084('0x43')](_0x62c3e5[_0x4084('0x25')][_0x4084('0x43')]);_0x19646a[_0x4084('0x23')]=qs[_0x4084('0x2b')](_['pick'](_0x62c3e5['query'],_0x5ed9b2[_0x4084('0x2b')]));_0x19646a[_0x4084('0x23')][_0x4084('0x44')]=_0x19bfdf['id'];if(_0x62c3e5[_0x4084('0x25')][_0x4084('0x45')]){_0x19646a['where']=_[_0x4084('0x31')](_0x19646a[_0x4084('0x23')],{'$or':_[_0x4084('0x46')](_0x19646a[_0x4084('0x2c')],function(_0x419f6c){var _0x30cb6b={};_0x30cb6b[_0x419f6c]={'$like':'%'+_0x62c3e5[_0x4084('0x25')]['filter']+'%'};return _0x30cb6b;})});}_0x19646a=_[_0x4084('0x31')]({},_0x19646a,_0x62c3e5[_0x4084('0x32')]);return db[_0x4084('0x40')][_0x4084('0x26')](_0x19646a);}})[_0x4084('0x14')](function(_0x42d49f){if(_0x42d49f){return db['User'][_0x4084('0x47')]({'where':{'id':_[_0x4084('0x46')](_0x42d49f,_0x4084('0x48')),'role':_0x4084('0x49')},'attributes':['id',_0x4084('0x1a'),'whatsappPause',_0x4084('0x4a'),_0x4084('0x4b')]});}})[_0x4084('0x14')](function(_0x15abcf){if(_0x15abcf){return{'count':_0x15abcf['count'],'rows':_[_0x4084('0x46')](_0x15abcf[_0x4084('0x27')],function(_0x2f0af3){return{'membername':_0x2f0af3['name'],'UserId':_0x2f0af3['id'],'queue_name':_0x3f74a7[_0x4084('0x1a')],'WhatsappQueueId':_0x3f74a7['id'],'interface':util[_0x4084('0x4c')]('%s/%s',_0x4084('0x4d'),_0x2f0af3['name']),'penalty':0x0,'paused':_0x2f0af3[_0x4084('0x4e')],'createdAt':_0x2f0af3[_0x4084('0x4b')],'updatedAt':_0x2f0af3[_0x4084('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4084('0x14')](respondWithFilteredResult(_0x288997,_0x19646a))[_0x4084('0x3a')](handleError(_0x288997,null));};exports[_0x4084('0x4f')]=function(_0xce3129,_0x80c1af){var _0x374a69={};var _0x2e0af0={};var _0x219f74;var _0xe00a27;return db['WhatsappQueue'][_0x4084('0x3f')]({'where':{'id':_0xce3129[_0x4084('0x28')]['id']}})[_0x4084('0x14')](handleEntityNotFound(_0x80c1af,null))[_0x4084('0x14')](function(_0x50090d){if(_0x50090d){_0x219f74=_0x50090d;_0x2e0af0['model']=_[_0x4084('0x2a')](db[_0x4084('0x50')]['rawAttributes']);_0x2e0af0[_0x4084('0x25')]=_[_0x4084('0x2a')](_0xce3129['query']);_0x2e0af0[_0x4084('0x2b')]=_['intersection'](_0x2e0af0[_0x4084('0x29')],_0x2e0af0[_0x4084('0x25')]);_0x374a69[_0x4084('0x2c')]=_['intersection'](_0x2e0af0[_0x4084('0x29')],qs[_0x4084('0x2e')](_0xce3129[_0x4084('0x25')][_0x4084('0x2e')]));_0x374a69['attributes']=_0x374a69[_0x4084('0x2c')][_0x4084('0x2f')]?_0x374a69['attributes']:_0x2e0af0['model'];_0x374a69['order']=qs[_0x4084('0x43')](_0xce3129[_0x4084('0x25')]['sort']);_0x374a69['where']=qs['filters'](_['pick'](_0xce3129['query'],_0x2e0af0[_0x4084('0x2b')]));if(_0xce3129[_0x4084('0x25')]['filter']){_0x374a69[_0x4084('0x23')]=_[_0x4084('0x31')](_0x374a69[_0x4084('0x23')],{'$or':_[_0x4084('0x46')](_0x374a69[_0x4084('0x2c')],function(_0x55377f){var _0x1d8230={};_0x1d8230[_0x55377f]={'$like':'%'+_0xce3129[_0x4084('0x25')][_0x4084('0x45')]+'%'};return _0x1d8230;})});}_0x374a69=_[_0x4084('0x31')]({},_0x374a69,_0xce3129[_0x4084('0x32')]);return _0x219f74[_0x4084('0x4f')](_0x374a69);}})[_0x4084('0x14')](function(_0x523606){if(_0x523606){_0xe00a27=_0x523606['length'];if(!_0xce3129['query'][_0x4084('0x41')](_0x4084('0x51'))){_0x374a69[_0x4084('0xf')]=qs['limit'](_0xce3129[_0x4084('0x25')][_0x4084('0xf')]);_0x374a69['offset']=qs[_0x4084('0xe')](_0xce3129[_0x4084('0x25')][_0x4084('0xe')]);}return _0x219f74[_0x4084('0x4f')](_0x374a69);}})['then'](function(_0x2b5f4e){if(_0x2b5f4e){return _0x2b5f4e?{'count':_0xe00a27,'rows':_0x2b5f4e}:null;}})['then'](respondWithResult(_0x80c1af,null))[_0x4084('0x3a')](handleError(_0x80c1af,null));};exports['addTeams']=function(_0x532fe9,_0x492b8e){var _0x22c581=_0x532fe9['body'][_0x4084('0x52')];return db[_0x4084('0x50')]['findAll']({'where':{'id':_0x22c581},'attributes':['id'],'include':[{'model':db[_0x4084('0x53')],'as':_0x4084('0x54'),'attributes':['id',_0x4084('0x1a'),'online',_0x4084('0x55'),_0x4084('0x56')],'raw':!![]}]})[_0x4084('0x14')](function(_0x3387ba){if(_0x3387ba){var _0x30fe51=_[_0x4084('0x57')](_0x3387ba,function(_0x57c48c){var _0x271c13=_0x57c48c[_0x4084('0x15')]({'plain':!![]});return _0x271c13[_0x4084('0x54')];});return db[_0x4084('0x1d')][_0x4084('0x38')]({'where':{'id':_0x532fe9[_0x4084('0x28')]['id']}})[_0x4084('0x14')](function(_0x5cae11){return db['sequelize'][_0x4084('0x58')](function(_0x168f1d){return _0x5cae11[_0x4084('0x59')](_0x22c581,{'transaction':_0x168f1d})['then'](function(){return BPromise[_0x4084('0x5a')](_0x30fe51,function(_0x49b7f6){return db[_0x4084('0x40')][_0x4084('0x5b')]({'where':{'UserId':_0x49b7f6['id'],'WhatsappQueueId':_0x532fe9[_0x4084('0x28')]['id']},'transaction':_0x168f1d});});})[_0x4084('0x14')](function(){_0x30fe51[_0x4084('0x5c')](function(_0x306e0a){socket[_0x4084('0x5d')](_0x4084('0x5e'),{'UserId':_0x306e0a['id'],'WhatsappQueueId':_0x5cae11['id']});});});});});}})[_0x4084('0x14')](respondWithStatusCode(_0x492b8e,null))['catch'](handleError(_0x492b8e,null));};exports[_0x4084('0x5f')]=function(_0x11faee,_0x538cf5){return db[_0x4084('0x50')]['findAll']({'where':{'id':_0x11faee[_0x4084('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4084('0x53')],'as':_0x4084('0x54'),'attributes':['id'],'raw':!![]}]})[_0x4084('0x14')](handleEntityNotFound(_0x538cf5,null))[_0x4084('0x14')](function(_0x2de327){var _0x31db0d=_[_0x4084('0x46')](_0x2de327,'id');var _0x3bfc26=[];var _0xab3dc6=[];var _0x393673=squel[_0x4084('0x60')]();_0x393673[_0x4084('0x61')](_0x4084('0x62'))[_0x4084('0x63')]('team_has_whatsapp_queues','tq')[_0x4084('0x64')](_0x4084('0x65'),'ut',_0x4084('0x66'))[_0x4084('0x23')]('WhatsappQueueId\x20=\x20?',_0x11faee['params']['id']);for(var _0x55f16e=0x0;_0x55f16e<_0x2de327['length'];_0x55f16e+=0x1){let _0xa70482=_0x2de327[_0x55f16e];for(var _0x192db0=0x0;_0x192db0<_0xa70482[_0x4084('0x54')][_0x4084('0x2f')];_0x192db0+=0x1){let _0x1a3ebf=_0xa70482[_0x4084('0x54')][_0x192db0];var _0x6c75bd=_0x393673['clone']();_0x6c75bd[_0x4084('0x23')]('ut.UserId\x20=\x20?',_0x1a3ebf['id']);_0xab3dc6[_0x4084('0x67')](db[_0x4084('0x68')][_0x4084('0x25')](_0x6c75bd[_0x4084('0x69')](),{'type':db[_0x4084('0x68')][_0x4084('0x6a')]['SELECT']})[_0x4084('0x14')](function(_0x58adda){if(_0x58adda[_0x4084('0x2f')]===0x1){return _0x1a3ebf['id'];}else{var _0x546691=_[_0x4084('0x6b')](_[_0x4084('0x46')](_0x58adda,_0x4084('0x6c')),function(_0x3a7aa0){return _[_0x4084('0x6d')](_0x31db0d,_0x3a7aa0);});if(_0x546691){return _0x1a3ebf['id'];}}}));}}return BPromise['all'](_0xab3dc6)[_0x4084('0x14')](function(_0x412929){_0x3bfc26=_(_0x3bfc26)[_0x4084('0x6e')](_0x412929)[_0x4084('0x6f')]()[_0x4084('0x70')]();return db[_0x4084('0x1d')][_0x4084('0x38')]({'where':{'id':_0x11faee[_0x4084('0x28')]['id']}})[_0x4084('0x14')](function(_0x34be5d){return db[_0x4084('0x68')]['transaction'](function(_0x1a08ea){return _0x34be5d[_0x4084('0x5f')](_0x11faee[_0x4084('0x25')][_0x4084('0x52')],{'transaction':_0x1a08ea})[_0x4084('0x14')](function(){if(!_[_0x4084('0x71')](_0x3bfc26)){return _0x34be5d['removeAgents'](_0x3bfc26,{'transaction':_0x1a08ea});}})['then'](function(){_0x3bfc26[_0x4084('0x5c')](function(_0x101f8c){socket['emit'](_0x4084('0x72'),{'UserId':_0x101f8c,'WhatsappQueueId':_0x34be5d['id']});});});});});});})[_0x4084('0x14')](respondWithStatusCode(_0x538cf5,null))[_0x4084('0x3a')](handleError(_0x538cf5,null));};exports['addAgents']=function(_0x4d5e06,_0x42345a){return db[_0x4084('0x1d')][_0x4084('0x38')]({'where':{'id':_0x4d5e06[_0x4084('0x28')]['id']}})[_0x4084('0x14')](handleEntityNotFound(_0x42345a,null))[_0x4084('0x14')](function(_0x296435){if(_0x296435){return _0x296435[_0x4084('0x73')](_0x4d5e06[_0x4084('0x34')]['ids'],_['omit'](_0x4d5e06[_0x4084('0x34')],['ids','id'])||{})[_0x4084('0x74')](function(_0x41bc9d){for(var _0xabbd04=0x0;_0xabbd04<_0x4d5e06[_0x4084('0x34')][_0x4084('0x52')][_0x4084('0x2f')];_0xabbd04+=0x1){socket[_0x4084('0x5d')](_0x4084('0x5e'),{'UserId':Number(_0x4d5e06[_0x4084('0x34')][_0x4084('0x52')][_0xabbd04]),'WhatsappQueueId':Number(_0x4d5e06[_0x4084('0x28')]['id'])});}return _0x41bc9d;});}})[_0x4084('0x14')](respondWithResult(_0x42345a,null))['catch'](handleError(_0x42345a,null));};exports[_0x4084('0x75')]=function(_0x156dce,_0x506f25){return db[_0x4084('0x1d')]['find']({'where':{'id':_0x156dce[_0x4084('0x28')]['id']}})[_0x4084('0x14')](handleEntityNotFound(_0x506f25,null))[_0x4084('0x14')](function(_0x168097){if(_0x168097){return _0x168097[_0x4084('0x75')](_0x156dce[_0x4084('0x25')]['ids'])[_0x4084('0x14')](function(){if(_[_0x4084('0x76')](_0x156dce[_0x4084('0x25')][_0x4084('0x52')])){for(var _0x4382a5=0x0;_0x4382a5<_0x156dce[_0x4084('0x25')][_0x4084('0x52')][_0x4084('0x2f')];_0x4382a5+=0x1){socket['emit'](_0x4084('0x72'),{'UserId':Number(_0x156dce[_0x4084('0x25')][_0x4084('0x52')][_0x4382a5]),'WhatsappQueueId':Number(_0x156dce[_0x4084('0x28')]['id'])});}}else{socket[_0x4084('0x5d')]('userWhatsappQueue:remove',{'UserId':Number(_0x156dce[_0x4084('0x25')][_0x4084('0x52')]),'WhatsappQueueId':Number(_0x156dce['params']['id'])});}});}})[_0x4084('0x14')](respondWithStatusCode(_0x506f25,null))['catch'](handleError(_0x506f25,null));};exports[_0x4084('0x77')]=function(_0x18329b,_0x1a7d1c){var _0x3e7d38={};var _0x379efb={};var _0x5565b9;var _0x5e10d9;return db[_0x4084('0x1d')][_0x4084('0x3f')]({'where':{'id':_0x18329b['params']['id']}})[_0x4084('0x14')](handleEntityNotFound(_0x1a7d1c,null))[_0x4084('0x14')](function(_0x2d2155){if(_0x2d2155){_0x5565b9=_0x2d2155;_0x379efb[_0x4084('0x29')]=_[_0x4084('0x2a')](db['User'][_0x4084('0x1e')]);_0x379efb[_0x4084('0x25')]=_['keys'](_0x18329b[_0x4084('0x25')]);_0x379efb[_0x4084('0x2b')]=_[_0x4084('0x2d')](_0x379efb['model'],_0x379efb['query']);_0x3e7d38[_0x4084('0x2c')]=_[_0x4084('0x2d')](_0x379efb[_0x4084('0x29')],qs['fields'](_0x18329b[_0x4084('0x25')][_0x4084('0x2e')]));_0x3e7d38[_0x4084('0x2c')]=_0x3e7d38['attributes'][_0x4084('0x2f')]?_0x3e7d38[_0x4084('0x2c')]:_0x379efb[_0x4084('0x29')];_0x3e7d38[_0x4084('0x42')]=qs[_0x4084('0x43')](_0x18329b[_0x4084('0x25')][_0x4084('0x43')]);_0x3e7d38['where']=qs[_0x4084('0x2b')](_[_0x4084('0x78')](_0x18329b['query'],_0x379efb[_0x4084('0x2b')]));if(_0x18329b[_0x4084('0x25')][_0x4084('0x45')]){_0x3e7d38[_0x4084('0x23')]=_[_0x4084('0x31')](_0x3e7d38[_0x4084('0x23')],{'$or':_[_0x4084('0x46')](_0x3e7d38[_0x4084('0x2c')],function(_0x160a66){var _0x29012a={};_0x29012a[_0x160a66]={'$like':'%'+_0x18329b[_0x4084('0x25')][_0x4084('0x45')]+'%'};return _0x29012a;})});}_0x3e7d38=_['merge']({},_0x3e7d38,_0x18329b[_0x4084('0x32')]);return _0x5565b9[_0x4084('0x77')](_0x3e7d38);}})[_0x4084('0x14')](function(_0x2bbe85){if(_0x2bbe85){_0x5e10d9=_0x2bbe85[_0x4084('0x2f')];if(!_0x18329b[_0x4084('0x25')][_0x4084('0x41')]('nolimit')){_0x3e7d38['limit']=qs[_0x4084('0xf')](_0x18329b[_0x4084('0x25')][_0x4084('0xf')]);_0x3e7d38[_0x4084('0xe')]=qs['offset'](_0x18329b[_0x4084('0x25')][_0x4084('0xe')]);}return _0x5565b9['getAgents'](_0x3e7d38);}})[_0x4084('0x14')](function(_0x345cf2){if(_0x345cf2){return _0x345cf2?{'count':_0x5e10d9,'rows':_0x345cf2}:null;}})[_0x4084('0x14')](respondWithResult(_0x1a7d1c,null))[_0x4084('0x3a')](handleError(_0x1a7d1c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 68f5600..c19c525 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 _0x657a=['events','../../mysqldb','setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x458027,_0x443f2a){var _0x1e5fb1=function(_0x1930ab){while(--_0x1930ab){_0x458027['push'](_0x458027['shift']());}};_0x1e5fb1(++_0x443f2a);}(_0x657a,0x1f0));var _0xa657=function(_0x1f76a4,_0x433129){_0x1f76a4=_0x1f76a4-0x0;var _0x1f515a=_0x657a[_0x1f76a4];return _0x1f515a;};'use strict';var EventEmitter=require(_0xa657('0x0'));var WhatsappQueue=require(_0xa657('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa657('0x2')](0x0);var events={'afterCreate':_0xa657('0x3'),'afterUpdate':_0xa657('0x4'),'afterDestroy':'remove'};function emitEvent(_0x389253){return function(_0x3fdeb7,_0x80d534,_0x6eb254){WhatsappQueueEvents['emit'](_0x389253+':'+_0x3fdeb7['id'],_0x3fdeb7);WhatsappQueueEvents['emit'](_0x389253,_0x3fdeb7);_0x6eb254(null);};}for(var e in events){if(events[_0xa657('0x5')](e)){var event=events[e];WhatsappQueue[_0xa657('0x6')](e,emitEvent(event));}}module[_0xa657('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9936=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','WhatsappQueue'];(function(_0x1e9006,_0x22d216){var _0x435661=function(_0x4ad11c){while(--_0x4ad11c){_0x1e9006['push'](_0x1e9006['shift']());}};_0x435661(++_0x22d216);}(_0x9936,0x85));var _0x6993=function(_0x562f0a,_0x1593f5){_0x562f0a=_0x562f0a-0x0;var _0x1b2cba=_0x9936[_0x562f0a];return _0x1b2cba;};'use strict';var EventEmitter=require(_0x6993('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x6993('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6993('0x2')](0x0);var events={'afterCreate':_0x6993('0x3'),'afterUpdate':_0x6993('0x4'),'afterDestroy':_0x6993('0x5')};function emitEvent(_0x372f3f){return function(_0x30d51f,_0x5853b5,_0x3e27d2){WhatsappQueueEvents[_0x6993('0x6')](_0x372f3f+':'+_0x30d51f['id'],_0x30d51f);WhatsappQueueEvents['emit'](_0x372f3f,_0x30d51f);_0x3e27d2(null);};}for(var e in events){if(events[_0x6993('0x7')](e)){var event=events[e];WhatsappQueue[_0x6993('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index eac637f..417725f 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 _0x900d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue'];(function(_0x39f486,_0x26af07){var _0x546077=function(_0x227994){while(--_0x227994){_0x39f486['push'](_0x39f486['shift']());}};_0x546077(++_0x26af07);}(_0x900d,0x108));var _0xd900=function(_0x5cb945,_0x3ae2f7){_0x5cb945=_0x5cb945-0x0;var _0x53db70=_0x900d[_0x5cb945];return _0x53db70;};'use strict';var _=require(_0xd900('0x0'));var util=require(_0xd900('0x1'));var logger=require(_0xd900('0x2'))(_0xd900('0x3'));var moment=require(_0xd900('0x4'));var BPromise=require(_0xd900('0x5'));var rp=require(_0xd900('0x6'));var fs=require('fs');var path=require(_0xd900('0x7'));var rimraf=require(_0xd900('0x8'));var config=require(_0xd900('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0xd900('0xa')]=function(_0x39c2c2,_0x2b42a3){return _0x39c2c2['define'](_0xd900('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bbf=['WhatsappQueue','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','define'];(function(_0x5e122b,_0x266363){var _0x359e9e=function(_0x2653e5){while(--_0x2653e5){_0x5e122b['push'](_0x5e122b['shift']());}};_0x359e9e(++_0x266363);}(_0x1bbf,0x1da));var _0xf1bb=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x1bbf[_0x482214];return _0x38d0cb;};'use strict';var _=require(_0xf1bb('0x0'));var util=require('util');var logger=require(_0xf1bb('0x1'))(_0xf1bb('0x2'));var moment=require(_0xf1bb('0x3'));var BPromise=require(_0xf1bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1bb('0x5'));var rimraf=require(_0xf1bb('0x6'));var config=require(_0xf1bb('0x7'));var attributes=require(_0xf1bb('0x8'));module['exports']=function(_0x456aa8,_0x257005){return _0x456aa8[_0xf1bb('0x9')](_0xf1bb('0xa'),attributes,{'tableName':'whatsapp_queues','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 5e10cae..8043553 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 _0x5b04=['register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','info','ShowWhatsappQueue','find','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x5b04,0x67));var _0x45b0=function(_0x373ba3,_0x265ccc){_0x373ba3=_0x373ba3-0x0;var _0x151f21=_0x5b04[_0x373ba3];return _0x151f21;};'use strict';var _=require(_0x45b0('0x0'));var util=require('util');var moment=require(_0x45b0('0x1'));var BPromise=require(_0x45b0('0x2'));var rs=require(_0x45b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45b0('0x4'))['db'];var utils=require(_0x45b0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x45b0('0x6'));var jayson=require(_0x45b0('0x7'));var client=jayson[_0x45b0('0x8')][_0x45b0('0x9')]({'port':0x232a});config[_0x45b0('0xa')]=_[_0x45b0('0xb')](config['redis'],{'host':_0x45b0('0xc'),'port':0x18eb});var socket=require(_0x45b0('0xd'))(new Redis(config[_0x45b0('0xa')]));require('./whatsappQueue.socket')[_0x45b0('0xe')](socket);function respondWithRpcPromise(_0x12bc1e,_0x5ac4ef,_0x1b52ed){return new BPromise(function(_0x59a0d8,_0x410773){return client[_0x45b0('0xf')](_0x12bc1e,_0x1b52ed)[_0x45b0('0x10')](function(_0x249613){logger['info'](_0x45b0('0x11'),_0x5ac4ef,_0x45b0('0x12'));logger['debug'](_0x45b0('0x13'),_0x5ac4ef,_0x45b0('0x12'),JSON[_0x45b0('0x14')](_0x249613));if(_0x249613['error']){if(_0x249613['error'][_0x45b0('0x15')]===0x1f4){logger['error'](_0x45b0('0x11'),_0x5ac4ef,_0x249613[_0x45b0('0x16')][_0x45b0('0x17')]);return _0x410773(_0x249613[_0x45b0('0x16')]['message']);}logger['error'](_0x45b0('0x11'),_0x5ac4ef,_0x249613[_0x45b0('0x16')][_0x45b0('0x17')]);return _0x59a0d8(_0x249613[_0x45b0('0x16')][_0x45b0('0x17')]);}else{logger['info'](_0x45b0('0x11'),_0x5ac4ef,_0x45b0('0x12'));_0x59a0d8(_0x249613['result'][_0x45b0('0x17')]);}})[_0x45b0('0x18')](function(_0x524ccb){logger[_0x45b0('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x5ac4ef,_0x524ccb);_0x410773(_0x524ccb);});});}exports[_0x45b0('0x19')]=function(_0x24c3a6){var _0x5030c1=this;return new Promise(function(_0x24ecd0,_0x14eff3){return db[_0x45b0('0x1a')][_0x45b0('0x1b')]({'raw':_0x24c3a6[_0x45b0('0x1c')]?_0x24c3a6[_0x45b0('0x1c')][_0x45b0('0x1d')]===undefined?!![]:![]:!![],'where':_0x24c3a6[_0x45b0('0x1c')]?_0x24c3a6[_0x45b0('0x1c')][_0x45b0('0x1e')]||null:null,'attributes':_0x24c3a6[_0x45b0('0x1c')]?_0x24c3a6[_0x45b0('0x1c')][_0x45b0('0x1f')]||null:null,'limit':_0x24c3a6['options']?_0x24c3a6['options']['limit']||null:null,'include':_0x24c3a6[_0x45b0('0x1c')]?_0x24c3a6['options'][_0x45b0('0x20')]?_['map'](_0x24c3a6[_0x45b0('0x1c')][_0x45b0('0x20')],function(_0x1a3de2){return{'model':db[_0x1a3de2['model']],'as':_0x1a3de2['as'],'attributes':_0x1a3de2[_0x45b0('0x1f')],'include':_0x1a3de2['include']?_[_0x45b0('0x21')](_0x1a3de2['include'],function(_0x13b909){return{'model':db[_0x13b909[_0x45b0('0x22')]],'as':_0x13b909['as'],'attributes':_0x13b909[_0x45b0('0x1f')],'include':_0x13b909[_0x45b0('0x20')]?_['map'](_0x13b909[_0x45b0('0x20')],function(_0x3ede9b){return{'model':db[_0x3ede9b[_0x45b0('0x22')]],'as':_0x3ede9b['as'],'attributes':_0x3ede9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x45b0('0x10')](function(_0x4bf7cb){logger[_0x45b0('0x23')](_0x45b0('0x19'),_0x24c3a6);logger['debug'](_0x45b0('0x19'),_0x24c3a6,JSON[_0x45b0('0x14')](_0x4bf7cb));_0x24ecd0(_0x4bf7cb);})[_0x45b0('0x18')](function(_0x1c4d8b){logger[_0x45b0('0x16')](_0x45b0('0x19'),_0x1c4d8b[_0x45b0('0x17')],_0x24c3a6);_0x14eff3(_0x5030c1[_0x45b0('0x16')](0x1f4,_0x1c4d8b[_0x45b0('0x17')]));});});};exports[_0x45b0('0x24')]=function(_0x17d4aa){var _0x120942=this;return new Promise(function(_0x47df7d,_0x44322e){return db[_0x45b0('0x1a')][_0x45b0('0x25')]({'raw':_0x17d4aa[_0x45b0('0x1c')]?_0x17d4aa[_0x45b0('0x1c')][_0x45b0('0x1d')]===undefined?!![]:![]:!![],'where':_0x17d4aa[_0x45b0('0x1c')]?_0x17d4aa['options']['where']||null:null,'attributes':_0x17d4aa[_0x45b0('0x1c')]?_0x17d4aa[_0x45b0('0x1c')][_0x45b0('0x1f')]||null:null,'include':_0x17d4aa['options']?_0x17d4aa[_0x45b0('0x1c')][_0x45b0('0x20')]?_['map'](_0x17d4aa[_0x45b0('0x1c')][_0x45b0('0x20')],function(_0x8d9d63){return{'model':db[_0x8d9d63[_0x45b0('0x22')]],'as':_0x8d9d63['as'],'attributes':_0x8d9d63[_0x45b0('0x1f')],'include':_0x8d9d63[_0x45b0('0x20')]?_[_0x45b0('0x21')](_0x8d9d63['include'],function(_0x3f0ae0){return{'model':db[_0x3f0ae0['model']],'as':_0x3f0ae0['as'],'attributes':_0x3f0ae0[_0x45b0('0x1f')],'include':_0x3f0ae0['include']?_[_0x45b0('0x21')](_0x3f0ae0[_0x45b0('0x20')],function(_0x4642a2){return{'model':db[_0x4642a2[_0x45b0('0x22')]],'as':_0x4642a2['as'],'attributes':_0x4642a2['attributes']};}):[]};}):[]};}):[]:[]})[_0x45b0('0x10')](function(_0xa52c11){logger[_0x45b0('0x23')](_0x45b0('0x24'),_0x17d4aa);logger[_0x45b0('0x26')](_0x45b0('0x24'),_0x17d4aa,JSON['stringify'](_0xa52c11));_0x47df7d(_0xa52c11);})['catch'](function(_0x55fe90){logger[_0x45b0('0x16')](_0x45b0('0x24'),_0x55fe90['message'],_0x17d4aa);_0x44322e(_0x120942[_0x45b0('0x16')](0x1f4,_0x55fe90[_0x45b0('0x17')]));});});}; \ No newline at end of file +var _0x1501=['ShowWhatsappQueue','WhatsappQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x11097d,_0x1a1ba2){var _0x4b8245=function(_0x4e624f){while(--_0x4e624f){_0x11097d['push'](_0x11097d['shift']());}};_0x4b8245(++_0x1a1ba2);}(_0x1501,0x81));var _0x1150=function(_0x41cfe6,_0x4e66ab){_0x41cfe6=_0x41cfe6-0x0;var _0xc0c6db=_0x1501[_0x41cfe6];return _0xc0c6db;};'use strict';var _=require(_0x1150('0x0'));var util=require(_0x1150('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1150('0x2'));var fs=require('fs');var Redis=require(_0x1150('0x3'));var db=require(_0x1150('0x4'))['db'];var utils=require(_0x1150('0x5'));var logger=require(_0x1150('0x6'))(_0x1150('0x7'));var config=require(_0x1150('0x8'));var jayson=require(_0x1150('0x9'));var client=jayson[_0x1150('0xa')][_0x1150('0xb')]({'port':0x232a});config[_0x1150('0xc')]=_[_0x1150('0xd')](config['redis'],{'host':_0x1150('0xe'),'port':0x18eb});var socket=require(_0x1150('0xf'))(new Redis(config[_0x1150('0xc')]));require(_0x1150('0x10'))[_0x1150('0x11')](socket);function respondWithRpcPromise(_0x11962e,_0x4b8562,_0x2a2c76){return new BPromise(function(_0x2cdec9,_0x2b7c14){return client['request'](_0x11962e,_0x2a2c76)[_0x1150('0x12')](function(_0x32e6ac){logger[_0x1150('0x13')](_0x1150('0x14'),_0x4b8562,'request\x20sent');logger[_0x1150('0x15')](_0x1150('0x16'),_0x4b8562,_0x1150('0x17'),JSON[_0x1150('0x18')](_0x32e6ac));if(_0x32e6ac[_0x1150('0x19')]){if(_0x32e6ac[_0x1150('0x19')][_0x1150('0x1a')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x4b8562,_0x32e6ac['error'][_0x1150('0x1b')]);return _0x2b7c14(_0x32e6ac[_0x1150('0x19')][_0x1150('0x1b')]);}logger[_0x1150('0x19')](_0x1150('0x14'),_0x4b8562,_0x32e6ac['error'][_0x1150('0x1b')]);return _0x2cdec9(_0x32e6ac[_0x1150('0x19')][_0x1150('0x1b')]);}else{logger[_0x1150('0x13')](_0x1150('0x14'),_0x4b8562,'request\x20sent');_0x2cdec9(_0x32e6ac['result'][_0x1150('0x1b')]);}})[_0x1150('0x1c')](function(_0x3e18e0){logger['error'](_0x1150('0x14'),_0x4b8562,_0x3e18e0);_0x2b7c14(_0x3e18e0);});});}exports[_0x1150('0x1d')]=function(_0x3673ed){var _0xf3dc61=this;return new Promise(function(_0x3ec568,_0x5e5269){return db['WhatsappQueue'][_0x1150('0x1e')]({'raw':_0x3673ed[_0x1150('0x1f')]?_0x3673ed[_0x1150('0x1f')][_0x1150('0x20')]===undefined?!![]:![]:!![],'where':_0x3673ed[_0x1150('0x1f')]?_0x3673ed['options'][_0x1150('0x21')]||null:null,'attributes':_0x3673ed[_0x1150('0x1f')]?_0x3673ed[_0x1150('0x1f')][_0x1150('0x22')]||null:null,'limit':_0x3673ed[_0x1150('0x1f')]?_0x3673ed[_0x1150('0x1f')][_0x1150('0x23')]||null:null,'include':_0x3673ed['options']?_0x3673ed[_0x1150('0x1f')][_0x1150('0x24')]?_['map'](_0x3673ed[_0x1150('0x1f')]['include'],function(_0x1bd2e0){return{'model':db[_0x1bd2e0[_0x1150('0x25')]],'as':_0x1bd2e0['as'],'attributes':_0x1bd2e0[_0x1150('0x22')],'include':_0x1bd2e0[_0x1150('0x24')]?_['map'](_0x1bd2e0[_0x1150('0x24')],function(_0x5e6401){return{'model':db[_0x5e6401[_0x1150('0x25')]],'as':_0x5e6401['as'],'attributes':_0x5e6401[_0x1150('0x22')],'include':_0x5e6401[_0x1150('0x24')]?_[_0x1150('0x26')](_0x5e6401[_0x1150('0x24')],function(_0x1c71e0){return{'model':db[_0x1c71e0[_0x1150('0x25')]],'as':_0x1c71e0['as'],'attributes':_0x1c71e0[_0x1150('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1150('0x12')](function(_0x2e5da7){logger['info'](_0x1150('0x1d'),_0x3673ed);logger[_0x1150('0x15')](_0x1150('0x1d'),_0x3673ed,JSON[_0x1150('0x18')](_0x2e5da7));_0x3ec568(_0x2e5da7);})[_0x1150('0x1c')](function(_0x576f48){logger[_0x1150('0x19')]('GetWhatsappQueue',_0x576f48['message'],_0x3673ed);_0x5e5269(_0xf3dc61[_0x1150('0x19')](0x1f4,_0x576f48[_0x1150('0x1b')]));});});};exports[_0x1150('0x27')]=function(_0x2f561b){var _0x5cf0f9=this;return new Promise(function(_0x227770,_0x19ff4e){return db[_0x1150('0x28')][_0x1150('0x29')]({'raw':_0x2f561b[_0x1150('0x1f')]?_0x2f561b['options'][_0x1150('0x20')]===undefined?!![]:![]:!![],'where':_0x2f561b[_0x1150('0x1f')]?_0x2f561b[_0x1150('0x1f')][_0x1150('0x21')]||null:null,'attributes':_0x2f561b[_0x1150('0x1f')]?_0x2f561b[_0x1150('0x1f')][_0x1150('0x22')]||null:null,'include':_0x2f561b[_0x1150('0x1f')]?_0x2f561b['options'][_0x1150('0x24')]?_[_0x1150('0x26')](_0x2f561b[_0x1150('0x1f')][_0x1150('0x24')],function(_0x2d3fa5){return{'model':db[_0x2d3fa5['model']],'as':_0x2d3fa5['as'],'attributes':_0x2d3fa5[_0x1150('0x22')],'include':_0x2d3fa5[_0x1150('0x24')]?_['map'](_0x2d3fa5['include'],function(_0x34b789){return{'model':db[_0x34b789[_0x1150('0x25')]],'as':_0x34b789['as'],'attributes':_0x34b789[_0x1150('0x22')],'include':_0x34b789['include']?_[_0x1150('0x26')](_0x34b789[_0x1150('0x24')],function(_0x9e858a){return{'model':db[_0x9e858a[_0x1150('0x25')]],'as':_0x9e858a['as'],'attributes':_0x9e858a[_0x1150('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1150('0x12')](function(_0x2218de){logger[_0x1150('0x13')]('ShowWhatsappQueue',_0x2f561b);logger['debug'](_0x1150('0x27'),_0x2f561b,JSON['stringify'](_0x2218de));_0x227770(_0x2218de);})[_0x1150('0x1c')](function(_0xd67ee0){logger['error']('ShowWhatsappQueue',_0xd67ee0['message'],_0x2f561b);_0x19ff4e(_0x5cf0f9['error'](0x1f4,_0xd67ee0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d76b745..d975cd7 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 _0x3d2a=['register','length','./whatsappQueue.events','remove','update','removeListener'];(function(_0x23307e,_0x321b04){var _0x1607f8=function(_0x2bdb25){while(--_0x2bdb25){_0x23307e['push'](_0x23307e['shift']());}};_0x1607f8(++_0x321b04);}(_0x3d2a,0xfe));var _0xa3d2=function(_0x40fbee,_0x268f74){_0x40fbee=_0x40fbee-0x0;var _0x1d93e8=_0x3d2a[_0x40fbee];return _0x1d93e8;};'use strict';var WhatsappQueueEvents=require(_0xa3d2('0x0'));var events=['save',_0xa3d2('0x1'),_0xa3d2('0x2')];function createListener(_0x5192ac,_0x447862){return function(_0x5999a0){_0x447862['emit'](_0x5192ac,_0x5999a0);};}function removeListener(_0x4ae7d2,_0x1830da){return function(){WhatsappQueueEvents[_0xa3d2('0x3')](_0x4ae7d2,_0x1830da);};}exports[_0xa3d2('0x4')]=function(_0x3da972){for(var _0x42fafc=0x0,_0xc85b15=events[_0xa3d2('0x5')];_0x42fafc<_0xc85b15;_0x42fafc++){var _0x14b678=events[_0x42fafc];var _0x1ebd9b=createListener('whatsappQueue:'+_0x14b678,_0x3da972);WhatsappQueueEvents['on'](_0x14b678,_0x1ebd9b);}}; \ No newline at end of file +var _0x1665=['length','whatsappQueue:','./whatsappQueue.events','remove','emit','removeListener','register'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0x1665,0xcd));var _0x5166=function(_0x20e1fd,_0x506bf0){_0x20e1fd=_0x20e1fd-0x0;var _0x3be635=_0x1665[_0x20e1fd];return _0x3be635;};'use strict';var WhatsappQueueEvents=require(_0x5166('0x0'));var events=['save',_0x5166('0x1'),'update'];function createListener(_0x5eaab4,_0x5b654f){return function(_0x459cc7){_0x5b654f[_0x5166('0x2')](_0x5eaab4,_0x459cc7);};}function removeListener(_0x2d4c3b,_0x176e7e){return function(){WhatsappQueueEvents[_0x5166('0x3')](_0x2d4c3b,_0x176e7e);};}exports[_0x5166('0x4')]=function(_0x2cbbe5){for(var _0x1861dc=0x0,_0x592787=events[_0x5166('0x5')];_0x1861dc<_0x592787;_0x1861dc++){var _0x3d8564=events[_0x1861dc];var _0x3c8fde=createListener(_0x5166('0x6')+_0x3d8564,_0x2cbbe5);WhatsappQueueEvents['on'](_0x3d8564,_0x3c8fde);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 097d493..7383ebc 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 _0x5ca1=['put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/:id','post'];(function(_0x1f5c44,_0x45d3df){var _0x1fe7de=function(_0x46285f){while(--_0x46285f){_0x1f5c44['push'](_0x1f5c44['shift']());}};_0x1fe7de(++_0x45d3df);}(_0x5ca1,0x85));var _0x15ca=function(_0x509042,_0x541f21){_0x509042=_0x509042-0x0;var _0x1ac556=_0x5ca1[_0x509042];return _0x1ac556;};'use strict';var multer=require(_0x15ca('0x0'));var util=require(_0x15ca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15ca('0x2')]();var fs_extra=require(_0x15ca('0x3'));var auth=require(_0x15ca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x15ca('0x5'));var controller=require(_0x15ca('0x6'));router[_0x15ca('0x7')]('/',auth[_0x15ca('0x8')](),controller['index']);router[_0x15ca('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x15ca('0x7')](_0x15ca('0x9'),auth[_0x15ca('0x8')](),controller['show']);router[_0x15ca('0xa')]('/',auth[_0x15ca('0x8')](),controller['create']);router[_0x15ca('0xb')]('/:id',auth[_0x15ca('0x8')](),controller[_0x15ca('0xc')]);router[_0x15ca('0xd')](_0x15ca('0x9'),auth[_0x15ca('0x8')](),controller[_0x15ca('0xe')]);module[_0x15ca('0xf')]=router; \ No newline at end of file +var _0xbe67=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x2aae31,_0x1014a2){var _0x379006=function(_0x5345ae){while(--_0x5345ae){_0x2aae31['push'](_0x2aae31['shift']());}};_0x379006(++_0x1014a2);}(_0xbe67,0x1b5));var _0x7be6=function(_0x20d40b,_0x5796e7){_0x20d40b=_0x20d40b-0x0;var _0x3c918c=_0xbe67[_0x20d40b];return _0x3c918c;};'use strict';var multer=require(_0x7be6('0x0'));var util=require(_0x7be6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7be6('0x2')]();var fs_extra=require(_0x7be6('0x3'));var auth=require(_0x7be6('0x4'));var interaction=require(_0x7be6('0x5'));var config=require(_0x7be6('0x6'));var controller=require(_0x7be6('0x7'));router['get']('/',auth[_0x7be6('0x8')](),controller[_0x7be6('0x9')]);router[_0x7be6('0xa')](_0x7be6('0xb'),auth[_0x7be6('0x8')](),controller[_0x7be6('0xc')]);router['get'](_0x7be6('0xd'),auth[_0x7be6('0x8')](),controller[_0x7be6('0xe')]);router[_0x7be6('0xf')]('/',auth[_0x7be6('0x8')](),controller[_0x7be6('0x10')]);router[_0x7be6('0x11')]('/:id',auth[_0x7be6('0x8')](),controller[_0x7be6('0x12')]);router[_0x7be6('0x13')](_0x7be6('0xd'),auth[_0x7be6('0x8')](),controller[_0x7be6('0x14')]);module[_0x7be6('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d9abd71..263c0b0 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5940b3,_0x1054f7){var _0x3e1fa5=function(_0xd6a870){while(--_0xd6a870){_0x5940b3['push'](_0x5940b3['shift']());}};_0x3e1fa5(++_0x1054f7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x38b262,_0xc1a875){var _0x4820f6=function(_0x41c0a7){while(--_0x41c0a7){_0x38b262['push'](_0x38b262['shift']());}};_0x4820f6(++_0xc1a875);}(_0x7a54,0x106));var _0x47a5=function(_0xe1a0da,_0x4676cc){_0xe1a0da=_0xe1a0da-0x0;var _0x24c1ee=_0x7a54[_0xe1a0da];return _0x24c1ee;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 96e253c..7d6b5a9 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 _0xb62e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448327,_0x4b0f46){return function(_0xfe3e16){if(!_0xfe3e16){_0x448327['sendStatus'](0x194);}return _0xfe3e16;};}function handleError(_0x3ac28c,_0x6bfbbc){_0x6bfbbc=_0x6bfbbc||0x1f4;return function(_0x46d1bb){logger['error'](_0x46d1bb[_0xeb62('0x27')]);if(_0x46d1bb[_0xeb62('0x28')]){delete _0x46d1bb[_0xeb62('0x28')];}_0x3ac28c[_0xeb62('0x1d')](_0x6bfbbc)[_0xeb62('0x29')](_0x46d1bb);};}exports[_0xeb62('0x2a')]=function(_0x511202,_0x192517){var _0x1616ee={},_0x57169a={},_0x157474={'count':0x0,'rows':[]};var _0x2b51b2=_[_0xeb62('0x2b')](db[_0xeb62('0x2c')][_0xeb62('0x2d')],function(_0x5195bf){return{'name':_0x5195bf['fieldName'],'type':_0x5195bf[_0xeb62('0x2e')][_0xeb62('0x2f')]};});_0x57169a[_0xeb62('0x30')]=_[_0xeb62('0x2b')](_0x2b51b2,_0xeb62('0x28'));_0x57169a[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x511202['query']);_0x57169a[_0xeb62('0x33')]=_['intersection'](_0x57169a['model'],_0x57169a[_0xeb62('0x31')]);_0x1616ee[_0xeb62('0x34')]=_['intersection'](_0x57169a[_0xeb62('0x30')],qs['fields'](_0x511202[_0xeb62('0x31')][_0xeb62('0x35')]));_0x1616ee['attributes']=_0x1616ee[_0xeb62('0x34')][_0xeb62('0x36')]?_0x1616ee['attributes']:_0x57169a[_0xeb62('0x30')];if(!_0x511202[_0xeb62('0x31')][_0xeb62('0x37')](_0xeb62('0x38'))){_0x1616ee['limit']=qs[_0xeb62('0x21')](_0x511202[_0xeb62('0x31')]['limit']);_0x1616ee['offset']=qs[_0xeb62('0x1f')](_0x511202[_0xeb62('0x31')]['offset']);}_0x1616ee[_0xeb62('0x39')]=qs[_0xeb62('0x3a')](_0x511202[_0xeb62('0x31')][_0xeb62('0x3a')]);_0x1616ee[_0xeb62('0x3b')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3c')](_0x511202['query'],_0x57169a['filters']),_0x2b51b2);if(_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]){_0x1616ee[_0xeb62('0x3b')]=_[_0xeb62('0x3e')](_0x1616ee['where'],{'$or':_[_0xeb62('0x2b')](_0x2b51b2,function(_0x510c7d){if(_0x510c7d[_0xeb62('0x2e')]!==_0xeb62('0x3f')){var _0x2dac2f={};_0x2dac2f[_0x510c7d[_0xeb62('0x28')]]={'$like':'%'+_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]+'%'};return _0x2dac2f;}})});}_0x1616ee=_[_0xeb62('0x3e')]({},_0x1616ee,_0x511202[_0xeb62('0x40')]);var _0x5e8ef8={'where':_0x1616ee[_0xeb62('0x3b')]};return db[_0xeb62('0x2c')][_0xeb62('0x22')](_0x5e8ef8)[_0xeb62('0x41')](function(_0x5dd0e3){_0x157474['count']=_0x5dd0e3;if(_0x511202[_0xeb62('0x31')][_0xeb62('0x42')]){_0x1616ee['include']=[{'all':!![]}];}return db[_0xeb62('0x2c')][_0xeb62('0x43')](_0x1616ee);})['then'](function(_0x25e9f0){_0x157474['rows']=_0x25e9f0;return _0x157474;})[_0xeb62('0x41')](respondWithFilteredResult(_0x192517,_0x1616ee))['catch'](handleError(_0x192517,null));};exports[_0xeb62('0x44')]=function(_0x5dde1d,_0x2bf77f){var _0x609b2d={'raw':!![],'where':{'id':_0x5dde1d['params']['id']}},_0x317f50={};_0x317f50['model']=_[_0xeb62('0x32')](db[_0xeb62('0x2c')][_0xeb62('0x2d')]);_0x317f50[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x5dde1d['query']);_0x317f50[_0xeb62('0x33')]=_['intersection'](_0x317f50[_0xeb62('0x30')],_0x317f50['query']);_0x609b2d[_0xeb62('0x34')]=_['intersection'](_0x317f50[_0xeb62('0x30')],qs['fields'](_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x35')]));_0x609b2d[_0xeb62('0x34')]=_0x609b2d[_0xeb62('0x34')][_0xeb62('0x36')]?_0x609b2d[_0xeb62('0x34')]:_0x317f50['model'];if(_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x42')]){_0x609b2d['include']=[{'all':!![]}];}_0x609b2d=_['merge']({},_0x609b2d,_0x5dde1d['options']);return db['WhatsappQueueReport'][_0xeb62('0x45')](_0x609b2d)[_0xeb62('0x41')](handleEntityNotFound(_0x2bf77f,null))['then'](respondWithResult(_0x2bf77f,null))[_0xeb62('0x46')](handleError(_0x2bf77f,null));};exports[_0xeb62('0x47')]=function(_0x412e93,_0x16e262){return db[_0xeb62('0x2c')]['create'](_0x412e93[_0xeb62('0x48')],{})['then'](respondWithResult(_0x16e262,0xc9))[_0xeb62('0x46')](handleError(_0x16e262,null));};exports[_0xeb62('0x49')]=function(_0x7fb53f,_0x18c40d){if(_0x7fb53f[_0xeb62('0x48')]['id']){delete _0x7fb53f[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2c')][_0xeb62('0x45')]({'where':{'id':_0x7fb53f[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x18c40d,null))[_0xeb62('0x41')](saveUpdates(_0x7fb53f[_0xeb62('0x48')],null))['then'](respondWithResult(_0x18c40d,null))[_0xeb62('0x46')](handleError(_0x18c40d,null));};exports['destroy']=function(_0x4edd8c,_0x2dcb2d){return db[_0xeb62('0x2c')]['find']({'where':{'id':_0x4edd8c[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x2dcb2d,null))['then'](removeEntity(_0x2dcb2d,null))[_0xeb62('0x46')](handleError(_0x2dcb2d,null));};exports[_0xeb62('0x4b')]=function(_0x20b73b,_0x60617){return db[_0xeb62('0x2c')][_0xeb62('0x4b')]()[_0xeb62('0x41')](respondWithResult(_0x60617,null))[_0xeb62('0x46')](handleError(_0x60617,null));}; \ No newline at end of file +var _0x1339=['../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','end','sendStatus','error','name','send','index','map','WhatsappQueueReport','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','update','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2b4f14,_0x34886a){var _0x2b30ea=function(_0x7295ae){while(--_0x7295ae){_0x2b4f14['push'](_0x2b4f14['shift']());}};_0x2b30ea(++_0x34886a);}(_0x1339,0x1ed));var _0x9133=function(_0x3e78af,_0x492765){_0x3e78af=_0x3e78af-0x0;var _0x5b9ae5=_0x1339[_0x3e78af];return _0x5b9ae5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x22')]();});}};}function handleEntityNotFound(_0x3f278d,_0x14c1cb){return function(_0x4483ef){if(!_0x4483ef){_0x3f278d[_0x9133('0x23')](0x194);}return _0x4483ef;};}function handleError(_0x294332,_0x313d43){_0x313d43=_0x313d43||0x1f4;return function(_0x1b6b3e){logger[_0x9133('0x24')](_0x1b6b3e['stack']);if(_0x1b6b3e['name']){delete _0x1b6b3e[_0x9133('0x25')];}_0x294332[_0x9133('0x1a')](_0x313d43)[_0x9133('0x26')](_0x1b6b3e);};}exports[_0x9133('0x27')]=function(_0x4de894,_0x4ecd9e){var _0x3e2404={},_0x45966d={},_0x188c49={'count':0x0,'rows':[]};var _0x26d351=_[_0x9133('0x28')](db[_0x9133('0x29')]['rawAttributes'],function(_0x58afe0){return{'name':_0x58afe0['fieldName'],'type':_0x58afe0[_0x9133('0x2a')]['key']};});_0x45966d[_0x9133('0x2b')]=_[_0x9133('0x28')](_0x26d351,'name');_0x45966d[_0x9133('0x2c')]=_['keys'](_0x4de894[_0x9133('0x2c')]);_0x45966d[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x45966d['model'],_0x45966d[_0x9133('0x2c')]);_0x3e2404[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x45966d['model'],qs[_0x9133('0x30')](_0x4de894[_0x9133('0x2c')][_0x9133('0x30')]));_0x3e2404['attributes']=_0x3e2404[_0x9133('0x2f')][_0x9133('0x31')]?_0x3e2404[_0x9133('0x2f')]:_0x45966d[_0x9133('0x2b')];if(!_0x4de894['query'][_0x9133('0x32')](_0x9133('0x33'))){_0x3e2404['limit']=qs[_0x9133('0x1d')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1d')]);_0x3e2404[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1e')]);}_0x3e2404[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4de894[_0x9133('0x2c')][_0x9133('0x35')]);_0x3e2404['where']=qs[_0x9133('0x2d')](_[_0x9133('0x36')](_0x4de894['query'],_0x45966d[_0x9133('0x2d')]),_0x26d351);if(_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]){_0x3e2404[_0x9133('0x38')]=_[_0x9133('0x39')](_0x3e2404[_0x9133('0x38')],{'$or':_['map'](_0x26d351,function(_0x4e16d2){if(_0x4e16d2[_0x9133('0x2a')]!==_0x9133('0x3a')){var _0x156905={};_0x156905[_0x4e16d2[_0x9133('0x25')]]={'$like':'%'+_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]+'%'};return _0x156905;}})});}_0x3e2404=_[_0x9133('0x39')]({},_0x3e2404,_0x4de894[_0x9133('0x3b')]);var _0x720048={'where':_0x3e2404['where']};return db[_0x9133('0x29')][_0x9133('0x3c')](_0x720048)[_0x9133('0x20')](function(_0x199ae9){_0x188c49[_0x9133('0x3c')]=_0x199ae9;if(_0x4de894['query'][_0x9133('0x3d')]){_0x3e2404[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x29')][_0x9133('0x3f')](_0x3e2404);})['then'](function(_0x146734){_0x188c49[_0x9133('0x40')]=_0x146734;return _0x188c49;})[_0x9133('0x20')](respondWithFilteredResult(_0x4ecd9e,_0x3e2404))[_0x9133('0x41')](handleError(_0x4ecd9e,null));};exports[_0x9133('0x42')]=function(_0x338049,_0x3b2287){var _0x4ca1a3={'raw':!![],'where':{'id':_0x338049['params']['id']}},_0x7f6cd9={};_0x7f6cd9['model']=_[_0x9133('0x43')](db[_0x9133('0x29')][_0x9133('0x44')]);_0x7f6cd9[_0x9133('0x2c')]=_[_0x9133('0x43')](_0x338049[_0x9133('0x2c')]);_0x7f6cd9[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],_0x7f6cd9['query']);_0x4ca1a3[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],qs['fields'](_0x338049['query'][_0x9133('0x30')]));_0x4ca1a3[_0x9133('0x2f')]=_0x4ca1a3['attributes'][_0x9133('0x31')]?_0x4ca1a3[_0x9133('0x2f')]:_0x7f6cd9[_0x9133('0x2b')];if(_0x338049[_0x9133('0x2c')][_0x9133('0x3d')]){_0x4ca1a3['include']=[{'all':!![]}];}_0x4ca1a3=_[_0x9133('0x39')]({},_0x4ca1a3,_0x338049[_0x9133('0x3b')]);return db[_0x9133('0x29')]['find'](_0x4ca1a3)[_0x9133('0x20')](handleEntityNotFound(_0x3b2287,null))[_0x9133('0x20')](respondWithResult(_0x3b2287,null))['catch'](handleError(_0x3b2287,null));};exports['create']=function(_0x42c188,_0x2cd935){return db[_0x9133('0x29')][_0x9133('0x45')](_0x42c188[_0x9133('0x46')],{})[_0x9133('0x20')](respondWithResult(_0x2cd935,0xc9))[_0x9133('0x41')](handleError(_0x2cd935,null));};exports[_0x9133('0x47')]=function(_0x23f134,_0xf07fbb){if(_0x23f134[_0x9133('0x46')]['id']){delete _0x23f134[_0x9133('0x46')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x23f134[_0x9133('0x48')]['id']}})['then'](handleEntityNotFound(_0xf07fbb,null))[_0x9133('0x20')](saveUpdates(_0x23f134[_0x9133('0x46')],null))[_0x9133('0x20')](respondWithResult(_0xf07fbb,null))[_0x9133('0x41')](handleError(_0xf07fbb,null));};exports['destroy']=function(_0x2a3848,_0x25750f){return db[_0x9133('0x29')]['find']({'where':{'id':_0x2a3848[_0x9133('0x48')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x25750f,null))[_0x9133('0x20')](removeEntity(_0x25750f,null))['catch'](handleError(_0x25750f,null));};exports[_0x9133('0x49')]=function(_0x4f7b1e,_0x2342f4){return db[_0x9133('0x29')][_0x9133('0x49')]()[_0x9133('0x20')](respondWithResult(_0x2342f4,null))['catch'](handleError(_0x2342f4,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3289b6c..57bf421 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 _0x9406=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2f0af1,_0x384df9){var _0x46b119=function(_0x5576a1){while(--_0x5576a1){_0x2f0af1['push'](_0x2f0af1['shift']());}};_0x46b119(++_0x384df9);}(_0x9406,0x1c2));var _0x6940=function(_0x51ab0a,_0x2c6928){_0x51ab0a=_0x51ab0a-0x0;var _0x35d20e=_0x9406[_0x51ab0a];return _0x35d20e;};'use strict';var _=require(_0x6940('0x0'));var util=require(_0x6940('0x1'));var logger=require(_0x6940('0x2'))(_0x6940('0x3'));var moment=require('moment');var BPromise=require(_0x6940('0x4'));var rp=require(_0x6940('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6940('0x6'));var config=require(_0x6940('0x7'));var attributes=require(_0x6940('0x8'));module[_0x6940('0x9')]=function(_0x138f5b,_0xa2d2c7){return _0x138f5b[_0x6940('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x6940('0xb'),'fields':[_0x6940('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x425b=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x48f51a,_0x5a9c0a){var _0x582911=function(_0x3b7f10){while(--_0x3b7f10){_0x48f51a['push'](_0x48f51a['shift']());}};_0x582911(++_0x5a9c0a);}(_0x425b,0x127));var _0xb425=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x425b[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0xb425('0x0'));var util=require(_0xb425('0x1'));var logger=require(_0xb425('0x2'))(_0xb425('0x3'));var moment=require(_0xb425('0x4'));var BPromise=require(_0xb425('0x5'));var rp=require(_0xb425('0x6'));var fs=require('fs');var path=require(_0xb425('0x7'));var rimraf=require(_0xb425('0x8'));var config=require('../../config/environment');var attributes=require(_0xb425('0x9'));module['exports']=function(_0xb0b584,_0x54aa6f){return _0xb0b584[_0xb425('0xa')](_0xb425('0xb'),attributes,{'tableName':_0xb425('0xc'),'paranoid':![],'indexes':[{'name':_0xb425('0xd'),'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 57567b4..f77dbb1 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 _0x8103=['jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','debug','UpdateWhatsappQueueReport','where','attributes','limit','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x54d2e3,_0x3fc590){var _0x26a918=function(_0x3acc69){while(--_0x3acc69){_0x54d2e3['push'](_0x54d2e3['shift']());}};_0x26a918(++_0x3fc590);}(_0x8103,0x1ae));var _0x3810=function(_0x1a1bcc,_0x4a3c01){_0x1a1bcc=_0x1a1bcc-0x0;var _0xc524f0=_0x8103[_0x1a1bcc];return _0xc524f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3810('0x0'));var BPromise=require(_0x3810('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3810('0x2'))['db'];var utils=require(_0x3810('0x3'));var logger=require(_0x3810('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3810('0x5'));var client=jayson[_0x3810('0x6')][_0x3810('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19ae6b,_0xdaa12c,_0x2cebde){return new BPromise(function(_0x42cae7,_0xc1eda8){return client[_0x3810('0x8')](_0x19ae6b,_0x2cebde)[_0x3810('0x9')](function(_0x3a8235){logger[_0x3810('0xa')](_0x3810('0xb'),_0xdaa12c,'request\x20sent');logger['debug'](_0x3810('0xc'),_0xdaa12c,'request\x20sent',JSON[_0x3810('0xd')](_0x3a8235));if(_0x3a8235['error']){if(_0x3a8235[_0x3810('0xe')][_0x3810('0xf')]===0x1f4){logger[_0x3810('0xe')](_0x3810('0xb'),_0xdaa12c,_0x3a8235['error'][_0x3810('0x10')]);return _0xc1eda8(_0x3a8235['error'][_0x3810('0x10')]);}logger[_0x3810('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0xdaa12c,_0x3a8235['error'][_0x3810('0x10')]);return _0x42cae7(_0x3a8235[_0x3810('0xe')]['message']);}else{logger[_0x3810('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0xdaa12c,_0x3810('0x11'));_0x42cae7(_0x3a8235['result'][_0x3810('0x10')]);}})[_0x3810('0x12')](function(_0x2ce67e){logger[_0x3810('0xe')](_0x3810('0xb'),_0xdaa12c,_0x2ce67e);_0xc1eda8(_0x2ce67e);});});}exports[_0x3810('0x13')]=function(_0xa65919){var _0x675836=this;return new Promise(function(_0x3d46a8,_0x46c23b){return db[_0x3810('0x14')]['create'](_0xa65919[_0x3810('0x15')],{'raw':_0xa65919[_0x3810('0x16')]?_0xa65919[_0x3810('0x16')][_0x3810('0x17')]===undefined?!![]:![]:!![]})[_0x3810('0x9')](function(_0x503e78){logger[_0x3810('0xa')]('CreateWhatsappQueueReport',_0xa65919);logger[_0x3810('0x18')](_0x3810('0x13'),_0xa65919,JSON[_0x3810('0xd')](_0x503e78));_0x3d46a8(_0x503e78);})[_0x3810('0x12')](function(_0x33917e){logger[_0x3810('0xe')](_0x3810('0x13'),_0x33917e['message'],_0xa65919);_0x46c23b(_0x675836[_0x3810('0xe')](0x1f4,_0x33917e[_0x3810('0x10')]));});});};exports[_0x3810('0x19')]=function(_0x2e1f5a){var _0x155eaa=this;return new Promise(function(_0xbe7bc,_0x5bcf05){return db[_0x3810('0x14')]['update'](_0x2e1f5a[_0x3810('0x15')],{'raw':_0x2e1f5a[_0x3810('0x16')]?_0x2e1f5a[_0x3810('0x16')][_0x3810('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1f5a[_0x3810('0x16')]?_0x2e1f5a['options'][_0x3810('0x1a')]||null:null,'attributes':_0x2e1f5a[_0x3810('0x16')]?_0x2e1f5a[_0x3810('0x16')][_0x3810('0x1b')]||null:null,'limit':_0x2e1f5a[_0x3810('0x16')]?_0x2e1f5a[_0x3810('0x16')][_0x3810('0x1c')]||null:null})[_0x3810('0x9')](function(_0x7c0534){logger[_0x3810('0xa')](_0x3810('0x19'),_0x2e1f5a);logger[_0x3810('0x18')](_0x3810('0x19'),_0x2e1f5a,JSON[_0x3810('0xd')](_0x7c0534));_0xbe7bc(_0x7c0534);})[_0x3810('0x12')](function(_0x255157){logger[_0x3810('0xe')]('UpdateWhatsappQueueReport',_0x255157['message'],_0x2e1f5a);_0x5bcf05(_0x155eaa[_0x3810('0xe')](0x1f4,_0x255157[_0x3810('0x10')]));});});}; \ No newline at end of file +var _0xa508=['attributes','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','where'];(function(_0x262f10,_0x13ad26){var _0x25bb90=function(_0x29107b){while(--_0x29107b){_0x262f10['push'](_0x262f10['shift']());}};_0x25bb90(++_0x13ad26);}(_0xa508,0x187));var _0x8a50=function(_0x16c219,_0x4b0e05){_0x16c219=_0x16c219-0x0;var _0x4a07ef=_0xa508[_0x16c219];return _0x4a07ef;};'use strict';var _=require(_0x8a50('0x0'));var util=require(_0x8a50('0x1'));var moment=require('moment');var BPromise=require(_0x8a50('0x2'));var rs=require(_0x8a50('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a50('0x4'));var logger=require(_0x8a50('0x5'))(_0x8a50('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a50('0x7'));var client=jayson[_0x8a50('0x8')][_0x8a50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57164d,_0x17b466,_0x7c6390){return new BPromise(function(_0x3b6fe8,_0x550bb7){return client[_0x8a50('0xa')](_0x57164d,_0x7c6390)[_0x8a50('0xb')](function(_0x21ef6f){logger[_0x8a50('0xc')](_0x8a50('0xd'),_0x17b466,'request\x20sent');logger[_0x8a50('0xe')](_0x8a50('0xf'),_0x17b466,_0x8a50('0x10'),JSON[_0x8a50('0x11')](_0x21ef6f));if(_0x21ef6f[_0x8a50('0x12')]){if(_0x21ef6f['error'][_0x8a50('0x13')]===0x1f4){logger['error'](_0x8a50('0xd'),_0x17b466,_0x21ef6f[_0x8a50('0x12')][_0x8a50('0x14')]);return _0x550bb7(_0x21ef6f[_0x8a50('0x12')]['message']);}logger[_0x8a50('0x12')](_0x8a50('0xd'),_0x17b466,_0x21ef6f[_0x8a50('0x12')]['message']);return _0x3b6fe8(_0x21ef6f[_0x8a50('0x12')][_0x8a50('0x14')]);}else{logger[_0x8a50('0xc')](_0x8a50('0xd'),_0x17b466,_0x8a50('0x10'));_0x3b6fe8(_0x21ef6f[_0x8a50('0x15')][_0x8a50('0x14')]);}})[_0x8a50('0x16')](function(_0x18afad){logger['error'](_0x8a50('0xd'),_0x17b466,_0x18afad);_0x550bb7(_0x18afad);});});}exports['CreateWhatsappQueueReport']=function(_0x35ccf3){var _0x44a802=this;return new Promise(function(_0x23db0c,_0x30364e){return db['WhatsappQueueReport']['create'](_0x35ccf3[_0x8a50('0x17')],{'raw':_0x35ccf3[_0x8a50('0x18')]?_0x35ccf3[_0x8a50('0x18')][_0x8a50('0x19')]===undefined?!![]:![]:!![]})[_0x8a50('0xb')](function(_0x14f0e3){logger['info']('CreateWhatsappQueueReport',_0x35ccf3);logger[_0x8a50('0xe')](_0x8a50('0x1a'),_0x35ccf3,JSON[_0x8a50('0x11')](_0x14f0e3));_0x23db0c(_0x14f0e3);})['catch'](function(_0x1b1a68){logger['error'](_0x8a50('0x1a'),_0x1b1a68['message'],_0x35ccf3);_0x30364e(_0x44a802[_0x8a50('0x12')](0x1f4,_0x1b1a68[_0x8a50('0x14')]));});});};exports[_0x8a50('0x1b')]=function(_0x53e1a7){var _0x1ec8bc=this;return new Promise(function(_0x5424a1,_0x30f0c6){return db['WhatsappQueueReport']['update'](_0x53e1a7[_0x8a50('0x17')],{'raw':_0x53e1a7[_0x8a50('0x18')]?_0x53e1a7['options'][_0x8a50('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53e1a7[_0x8a50('0x18')]?_0x53e1a7[_0x8a50('0x18')][_0x8a50('0x1c')]||null:null,'attributes':_0x53e1a7[_0x8a50('0x18')]?_0x53e1a7[_0x8a50('0x18')][_0x8a50('0x1d')]||null:null,'limit':_0x53e1a7[_0x8a50('0x18')]?_0x53e1a7[_0x8a50('0x18')]['limit']||null:null})[_0x8a50('0xb')](function(_0x19b137){logger[_0x8a50('0xc')](_0x8a50('0x1b'),_0x53e1a7);logger[_0x8a50('0xe')]('UpdateWhatsappQueueReport',_0x53e1a7,JSON[_0x8a50('0x11')](_0x19b137));_0x5424a1(_0x19b137);})['catch'](function(_0x34acf0){logger[_0x8a50('0x12')]('UpdateWhatsappQueueReport',_0x34acf0['message'],_0x53e1a7);_0x30f0c6(_0x1ec8bc['error'](0x1f4,_0x34acf0[_0x8a50('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4b55df7..ade351b 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 _0x4e94=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','delete','destroy'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x4e94,0xf3));var _0x44e9=function(_0x30780e,_0x537b34){_0x30780e=_0x30780e-0x0;var _0x5b9129=_0x4e94[_0x30780e];return _0x5b9129;};'use strict';var multer=require(_0x44e9('0x0'));var util=require('util');var path=require(_0x44e9('0x1'));var timeout=require(_0x44e9('0x2'));var express=require(_0x44e9('0x3'));var router=express[_0x44e9('0x4')]();var fs_extra=require(_0x44e9('0x5'));var auth=require(_0x44e9('0x6'));var interaction=require(_0x44e9('0x7'));var config=require(_0x44e9('0x8'));var controller=require(_0x44e9('0x9'));router[_0x44e9('0xa')]('/',auth[_0x44e9('0xb')](),controller[_0x44e9('0xc')]);router[_0x44e9('0xa')](_0x44e9('0xd'),auth[_0x44e9('0xb')](),controller[_0x44e9('0xe')]);router[_0x44e9('0xa')]('/:id',auth[_0x44e9('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x44e9('0xf')]);router[_0x44e9('0x10')](_0x44e9('0x11'),auth[_0x44e9('0xb')](),controller[_0x44e9('0x12')]);router[_0x44e9('0x13')](_0x44e9('0x11'),auth['isAuthenticated'](),controller[_0x44e9('0x14')]);module[_0x44e9('0x15')]=router; \ No newline at end of file +var _0x0fe4=['isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0x5d2a5b,_0x5ea3a3){var _0x159010=function(_0x402311){while(--_0x402311){_0x5d2a5b['push'](_0x5d2a5b['shift']());}};_0x159010(++_0x5ea3a3);}(_0x0fe4,0x1d9));var _0x40fe=function(_0x51651a,_0x23d6df){_0x51651a=_0x51651a-0x0;var _0x2f100f=_0x0fe4[_0x51651a];return _0x2f100f;};'use strict';var multer=require(_0x40fe('0x0'));var util=require('util');var path=require(_0x40fe('0x1'));var timeout=require(_0x40fe('0x2'));var express=require(_0x40fe('0x3'));var router=express['Router']();var fs_extra=require(_0x40fe('0x4'));var auth=require(_0x40fe('0x5'));var interaction=require(_0x40fe('0x6'));var config=require(_0x40fe('0x7'));var controller=require(_0x40fe('0x8'));router[_0x40fe('0x9')]('/',auth[_0x40fe('0xa')](),controller[_0x40fe('0xb')]);router[_0x40fe('0x9')](_0x40fe('0xc'),auth[_0x40fe('0xa')](),controller['describe']);router[_0x40fe('0x9')](_0x40fe('0xd'),auth[_0x40fe('0xa')](),controller[_0x40fe('0xe')]);router[_0x40fe('0xf')]('/',auth[_0x40fe('0xa')](),controller[_0x40fe('0x10')]);router[_0x40fe('0x11')]('/:id',auth[_0x40fe('0xa')](),controller[_0x40fe('0x12')]);router[_0x40fe('0x13')](_0x40fe('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x40fe('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 286823b..378f448 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 _0xf5b6=['DATE','STRING','ENUM','account','agent'];(function(_0x48ddb4,_0x477340){var _0x4fb1f1=function(_0x296fbf){while(--_0x296fbf){_0x48ddb4['push'](_0x48ddb4['shift']());}};_0x4fb1f1(++_0x477340);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x541a33,_0x74feec){_0x541a33=_0x541a33-0x0;var _0x445f0d=_0xf5b6[_0x541a33];return _0x445f0d;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6f5b('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x6f5b('0x1')](_0x6f5b('0x2'),_0x6f5b('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6f5b('0x4')]}}; \ No newline at end of file +var _0x9db7=['ENUM','agent','DATE','sequelize','exports','STRING'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x9db7,0x1bf));var _0x79db=function(_0x61819f,_0x52524d){_0x61819f=_0x61819f-0x0;var _0x19ebc5=_0x9db7[_0x61819f];return _0x19ebc5;};'use strict';var Sequelize=require(_0x79db('0x0'));module[_0x79db('0x1')]={'uniqueid':{'type':Sequelize[_0x79db('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x79db('0x3')]('account',_0x79db('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x79db('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 559c1aa..ee3094f 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 _0x7162=['fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','status','error','stack','name','map','WhatsappTransferReport','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','length','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','ejs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7162,0x11d));var _0x2716=function(_0xba2d2e,_0x145e38){_0xba2d2e=_0xba2d2e-0x0;var _0x4d52f0=_0x7162[_0xba2d2e];return _0x4d52f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2716('0x0'));var zipdir=require(_0x2716('0x1'));var jsonpatch=require(_0x2716('0x2'));var rp=require(_0x2716('0x3'));var moment=require(_0x2716('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2716('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2716('0x6'));var fs=require('fs');var fs_extra=require(_0x2716('0x7'));var _=require(_0x2716('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2716('0x9'));var toCsv=require(_0x2716('0xa'));var querystring=require(_0x2716('0xb'));var Papa=require(_0x2716('0xc'));var Redis=require(_0x2716('0xd'));var authService=require(_0x2716('0xe'));var qs=require(_0x2716('0xf'));var as=require(_0x2716('0x10'));var hardwareService=require(_0x2716('0x11'));var logger=require(_0x2716('0x12'))(_0x2716('0x13'));var utils=require(_0x2716('0x14'));var config=require(_0x2716('0x15'));var licenseUtil=require(_0x2716('0x16'));var db=require(_0x2716('0x17'))['db'];function respondWithStatusCode(_0x264365,_0x34dce5){_0x34dce5=_0x34dce5||0xcc;return function(_0x152397){if(_0x152397){return _0x264365[_0x2716('0x18')](_0x34dce5);}return _0x264365['status'](_0x34dce5)[_0x2716('0x19')]();};}function respondWithResult(_0x3ac1fd,_0x3f0f7d){_0x3f0f7d=_0x3f0f7d||0xc8;return function(_0x1d042a){if(_0x1d042a){return _0x3ac1fd['status'](_0x3f0f7d)[_0x2716('0x1a')](_0x1d042a);}};}function respondWithFilteredResult(_0x54568c,_0x5421c6){return function(_0x27960c){if(_0x27960c){var _0x4fd9d9=typeof _0x5421c6[_0x2716('0x1b')]===_0x2716('0x1c')&&typeof _0x5421c6[_0x2716('0x1d')]===_0x2716('0x1c');var _0x28b5d9=_0x27960c[_0x2716('0x1e')];var _0x7cb946=_0x4fd9d9?0x0:_0x5421c6[_0x2716('0x1b')];var _0x2bf9cb=_0x4fd9d9?_0x27960c[_0x2716('0x1e')]:_0x5421c6['offset']+_0x5421c6[_0x2716('0x1d')];var _0x2afe79;if(_0x2bf9cb>=_0x28b5d9){_0x2bf9cb=_0x28b5d9;_0x2afe79=0xc8;}else{_0x2afe79=0xce;}_0x54568c['status'](_0x2afe79);return _0x54568c[_0x2716('0x1f')](_0x2716('0x20'),_0x7cb946+'-'+_0x2bf9cb+'/'+_0x28b5d9)[_0x2716('0x1a')](_0x27960c);}return null;};}function patchUpdates(_0x3c2838){return function(_0x5b2545){try{jsonpatch['apply'](_0x5b2545,_0x3c2838,!![]);}catch(_0x5d479a){return BPromise[_0x2716('0x21')](_0x5d479a);}return _0x5b2545['save']();};}function saveUpdates(_0x5da6dc,_0x5b434f){return function(_0x18a88a){if(_0x18a88a){return _0x18a88a[_0x2716('0x22')](_0x5da6dc)[_0x2716('0x23')](function(_0x276fc7){return _0x276fc7;});}return null;};}function removeEntity(_0x3a32f0,_0x4d57ea){return function(_0x5d48c1){if(_0x5d48c1){return _0x5d48c1[_0x2716('0x24')]()[_0x2716('0x23')](function(){_0x3a32f0[_0x2716('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e7b60,_0x3ba3d4){return function(_0xca0e6a){if(!_0xca0e6a){_0x3e7b60['sendStatus'](0x194);}return _0xca0e6a;};}function handleError(_0x27103f,_0x50563a){_0x50563a=_0x50563a||0x1f4;return function(_0x478f8f){logger[_0x2716('0x26')](_0x478f8f[_0x2716('0x27')]);if(_0x478f8f[_0x2716('0x28')]){delete _0x478f8f['name'];}_0x27103f[_0x2716('0x25')](_0x50563a)['send'](_0x478f8f);};}exports['index']=function(_0x381084,_0xb9a381){var _0x16c9a5={},_0x559627={},_0x5d0246={'count':0x0,'rows':[]};var _0x3e306a=_[_0x2716('0x29')](db[_0x2716('0x2a')][_0x2716('0x2b')],function(_0x16a533){return{'name':_0x16a533[_0x2716('0x2c')],'type':_0x16a533['type'][_0x2716('0x2d')]};});_0x559627['model']=_['map'](_0x3e306a,_0x2716('0x28'));_0x559627[_0x2716('0x2e')]=_[_0x2716('0x2f')](_0x381084[_0x2716('0x2e')]);_0x559627['filters']=_['intersection'](_0x559627['model'],_0x559627[_0x2716('0x2e')]);_0x16c9a5[_0x2716('0x30')]=_[_0x2716('0x31')](_0x559627[_0x2716('0x32')],qs[_0x2716('0x33')](_0x381084[_0x2716('0x2e')][_0x2716('0x33')]));_0x16c9a5[_0x2716('0x30')]=_0x16c9a5[_0x2716('0x30')][_0x2716('0x34')]?_0x16c9a5['attributes']:_0x559627[_0x2716('0x32')];if(!_0x381084['query']['hasOwnProperty'](_0x2716('0x35'))){_0x16c9a5[_0x2716('0x1d')]=qs[_0x2716('0x1d')](_0x381084['query'][_0x2716('0x1d')]);_0x16c9a5['offset']=qs[_0x2716('0x1b')](_0x381084[_0x2716('0x2e')][_0x2716('0x1b')]);}_0x16c9a5['order']=qs[_0x2716('0x36')](_0x381084[_0x2716('0x2e')][_0x2716('0x36')]);_0x16c9a5[_0x2716('0x37')]=qs[_0x2716('0x38')](_[_0x2716('0x39')](_0x381084['query'],_0x559627[_0x2716('0x38')]),_0x3e306a);if(_0x381084[_0x2716('0x2e')][_0x2716('0x3a')]){_0x16c9a5[_0x2716('0x37')]=_[_0x2716('0x3b')](_0x16c9a5['where'],{'$or':_[_0x2716('0x29')](_0x3e306a,function(_0x28e895){if(_0x28e895[_0x2716('0x3c')]!==_0x2716('0x3d')){var _0x209aad={};_0x209aad[_0x28e895[_0x2716('0x28')]]={'$like':'%'+_0x381084['query'][_0x2716('0x3a')]+'%'};return _0x209aad;}})});}_0x16c9a5=_[_0x2716('0x3b')]({},_0x16c9a5,_0x381084[_0x2716('0x3e')]);var _0x8d33f0={'where':_0x16c9a5[_0x2716('0x37')]};return db[_0x2716('0x2a')]['count'](_0x8d33f0)[_0x2716('0x23')](function(_0x5858f6){_0x5d0246[_0x2716('0x1e')]=_0x5858f6;if(_0x381084['query'][_0x2716('0x3f')]){_0x16c9a5[_0x2716('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x2716('0x41')](_0x16c9a5);})[_0x2716('0x23')](function(_0x7da07c){_0x5d0246[_0x2716('0x42')]=_0x7da07c;return _0x5d0246;})[_0x2716('0x23')](respondWithFilteredResult(_0xb9a381,_0x16c9a5))[_0x2716('0x43')](handleError(_0xb9a381,null));};exports['show']=function(_0x57751b,_0x51d5cb){var _0xf64614={'raw':!![],'where':{'id':_0x57751b[_0x2716('0x44')]['id']}},_0x1be8b4={};_0x1be8b4[_0x2716('0x32')]=_[_0x2716('0x2f')](db[_0x2716('0x2a')][_0x2716('0x2b')]);_0x1be8b4['query']=_['keys'](_0x57751b[_0x2716('0x2e')]);_0x1be8b4[_0x2716('0x38')]=_[_0x2716('0x31')](_0x1be8b4['model'],_0x1be8b4[_0x2716('0x2e')]);_0xf64614[_0x2716('0x30')]=_['intersection'](_0x1be8b4[_0x2716('0x32')],qs['fields'](_0x57751b[_0x2716('0x2e')][_0x2716('0x33')]));_0xf64614[_0x2716('0x30')]=_0xf64614[_0x2716('0x30')][_0x2716('0x34')]?_0xf64614['attributes']:_0x1be8b4['model'];if(_0x57751b[_0x2716('0x2e')]['includeAll']){_0xf64614[_0x2716('0x40')]=[{'all':!![]}];}_0xf64614=_[_0x2716('0x3b')]({},_0xf64614,_0x57751b[_0x2716('0x3e')]);return db[_0x2716('0x2a')]['find'](_0xf64614)['then'](handleEntityNotFound(_0x51d5cb,null))[_0x2716('0x23')](respondWithResult(_0x51d5cb,null))[_0x2716('0x43')](handleError(_0x51d5cb,null));};exports[_0x2716('0x45')]=function(_0x548535,_0x31ae79){return db[_0x2716('0x2a')][_0x2716('0x45')](_0x548535[_0x2716('0x46')],{})[_0x2716('0x23')](respondWithResult(_0x31ae79,0xc9))[_0x2716('0x43')](handleError(_0x31ae79,null));};exports[_0x2716('0x22')]=function(_0xdc3fe0,_0x2dcd48){if(_0xdc3fe0[_0x2716('0x46')]['id']){delete _0xdc3fe0['body']['id'];}return db[_0x2716('0x2a')][_0x2716('0x47')]({'where':{'id':_0xdc3fe0['params']['id']}})[_0x2716('0x23')](handleEntityNotFound(_0x2dcd48,null))[_0x2716('0x23')](saveUpdates(_0xdc3fe0[_0x2716('0x46')],null))['then'](respondWithResult(_0x2dcd48,null))[_0x2716('0x43')](handleError(_0x2dcd48,null));};exports['destroy']=function(_0x142995,_0x133c4c){return db['WhatsappTransferReport'][_0x2716('0x47')]({'where':{'id':_0x142995['params']['id']}})[_0x2716('0x23')](handleEntityNotFound(_0x133c4c,null))['then'](removeEntity(_0x133c4c,null))['catch'](handleError(_0x133c4c,null));};exports['describe']=function(_0x394293,_0x3c9c33){return db[_0x2716('0x2a')][_0x2716('0x48')]()[_0x2716('0x23')](respondWithResult(_0x3c9c33,null))[_0x2716('0x43')](handleError(_0x3c9c33,null));}; \ No newline at end of file +var _0xeaa5=['../../config/utils','../../config/environment','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','WhatsappTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x2e793a,_0x5b39e3){var _0x34c807=function(_0x2c7594){while(--_0x2c7594){_0x2e793a['push'](_0x2e793a['shift']());}};_0x34c807(++_0x5b39e3);}(_0xeaa5,0x1f0));var _0x5eaa=function(_0x277ad7,_0x2c4fbb){_0x277ad7=_0x277ad7-0x0;var _0x545684=_0xeaa5[_0x277ad7];return _0x545684;};'use strict';var emlformat=require(_0x5eaa('0x0'));var rimraf=require(_0x5eaa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5eaa('0x2'));var rp=require(_0x5eaa('0x3'));var moment=require(_0x5eaa('0x4'));var BPromise=require(_0x5eaa('0x5'));var Mustache=require(_0x5eaa('0x6'));var util=require(_0x5eaa('0x7'));var path=require(_0x5eaa('0x8'));var sox=require(_0x5eaa('0x9'));var csv=require(_0x5eaa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5eaa('0xb'));var squel=require(_0x5eaa('0xc'));var crypto=require('crypto');var jsforce=require(_0x5eaa('0xd'));var deskjs=require(_0x5eaa('0xe'));var toCsv=require(_0x5eaa('0xa'));var querystring=require(_0x5eaa('0xf'));var Papa=require(_0x5eaa('0x10'));var Redis=require(_0x5eaa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5eaa('0x12'));var as=require(_0x5eaa('0x13'));var hardwareService=require(_0x5eaa('0x14'));var logger=require('../../config/logger')(_0x5eaa('0x15'));var utils=require(_0x5eaa('0x16'));var config=require(_0x5eaa('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f3327,_0x4bf1e2){_0x4bf1e2=_0x4bf1e2||0xcc;return function(_0x3f9eda){if(_0x3f9eda){return _0x5f3327['sendStatus'](_0x4bf1e2);}return _0x5f3327[_0x5eaa('0x18')](_0x4bf1e2)[_0x5eaa('0x19')]();};}function respondWithResult(_0x4fdac2,_0x35264e){_0x35264e=_0x35264e||0xc8;return function(_0x3cc665){if(_0x3cc665){return _0x4fdac2[_0x5eaa('0x18')](_0x35264e)[_0x5eaa('0x1a')](_0x3cc665);}};}function respondWithFilteredResult(_0x3deead,_0x178608){return function(_0x681974){if(_0x681974){var _0x9dc127=typeof _0x178608[_0x5eaa('0x1b')]==='undefined'&&typeof _0x178608[_0x5eaa('0x1c')]==='undefined';var _0x48c985=_0x681974[_0x5eaa('0x1d')];var _0x59efc1=_0x9dc127?0x0:_0x178608[_0x5eaa('0x1b')];var _0x4244bc=_0x9dc127?_0x681974[_0x5eaa('0x1d')]:_0x178608['offset']+_0x178608[_0x5eaa('0x1c')];var _0x272220;if(_0x4244bc>=_0x48c985){_0x4244bc=_0x48c985;_0x272220=0xc8;}else{_0x272220=0xce;}_0x3deead[_0x5eaa('0x18')](_0x272220);return _0x3deead[_0x5eaa('0x1e')](_0x5eaa('0x1f'),_0x59efc1+'-'+_0x4244bc+'/'+_0x48c985)[_0x5eaa('0x1a')](_0x681974);}return null;};}function patchUpdates(_0x124b29){return function(_0x3ccd9d){try{jsonpatch['apply'](_0x3ccd9d,_0x124b29,!![]);}catch(_0x383f1c){return BPromise['reject'](_0x383f1c);}return _0x3ccd9d[_0x5eaa('0x20')]();};}function saveUpdates(_0x24caf1,_0x3ccbb5){return function(_0x2fd4a3){if(_0x2fd4a3){return _0x2fd4a3[_0x5eaa('0x21')](_0x24caf1)[_0x5eaa('0x22')](function(_0xa5320){return _0xa5320;});}return null;};}function removeEntity(_0xc8486a,_0x4cb7fe){return function(_0x272558){if(_0x272558){return _0x272558[_0x5eaa('0x23')]()['then'](function(){_0xc8486a['status'](0xcc)[_0x5eaa('0x19')]();});}};}function handleEntityNotFound(_0x38d25e,_0x349347){return function(_0x22749d){if(!_0x22749d){_0x38d25e['sendStatus'](0x194);}return _0x22749d;};}function handleError(_0x208414,_0x46f105){_0x46f105=_0x46f105||0x1f4;return function(_0x1d8c37){logger[_0x5eaa('0x24')](_0x1d8c37[_0x5eaa('0x25')]);if(_0x1d8c37[_0x5eaa('0x26')]){delete _0x1d8c37[_0x5eaa('0x26')];}_0x208414[_0x5eaa('0x18')](_0x46f105)[_0x5eaa('0x27')](_0x1d8c37);};}exports[_0x5eaa('0x28')]=function(_0x14c200,_0x2ab13e){var _0x26c1ba={},_0x32f1b1={},_0x46ddf3={'count':0x0,'rows':[]};var _0x7eba02=_['map'](db['WhatsappTransferReport'][_0x5eaa('0x29')],function(_0x40e73b){return{'name':_0x40e73b[_0x5eaa('0x2a')],'type':_0x40e73b[_0x5eaa('0x2b')][_0x5eaa('0x2c')]};});_0x32f1b1['model']=_['map'](_0x7eba02,'name');_0x32f1b1[_0x5eaa('0x2d')]=_['keys'](_0x14c200[_0x5eaa('0x2d')]);_0x32f1b1[_0x5eaa('0x2e')]=_[_0x5eaa('0x2f')](_0x32f1b1[_0x5eaa('0x30')],_0x32f1b1['query']);_0x26c1ba['attributes']=_[_0x5eaa('0x2f')](_0x32f1b1[_0x5eaa('0x30')],qs[_0x5eaa('0x31')](_0x14c200[_0x5eaa('0x2d')][_0x5eaa('0x31')]));_0x26c1ba[_0x5eaa('0x32')]=_0x26c1ba[_0x5eaa('0x32')][_0x5eaa('0x33')]?_0x26c1ba[_0x5eaa('0x32')]:_0x32f1b1[_0x5eaa('0x30')];if(!_0x14c200[_0x5eaa('0x2d')][_0x5eaa('0x34')]('nolimit')){_0x26c1ba['limit']=qs[_0x5eaa('0x1c')](_0x14c200['query'][_0x5eaa('0x1c')]);_0x26c1ba[_0x5eaa('0x1b')]=qs[_0x5eaa('0x1b')](_0x14c200[_0x5eaa('0x2d')]['offset']);}_0x26c1ba[_0x5eaa('0x35')]=qs[_0x5eaa('0x36')](_0x14c200[_0x5eaa('0x2d')][_0x5eaa('0x36')]);_0x26c1ba[_0x5eaa('0x37')]=qs['filters'](_[_0x5eaa('0x38')](_0x14c200['query'],_0x32f1b1[_0x5eaa('0x2e')]),_0x7eba02);if(_0x14c200['query'][_0x5eaa('0x39')]){_0x26c1ba['where']=_[_0x5eaa('0x3a')](_0x26c1ba[_0x5eaa('0x37')],{'$or':_[_0x5eaa('0x3b')](_0x7eba02,function(_0x4f82c1){if(_0x4f82c1['type']!==_0x5eaa('0x3c')){var _0x3e0868={};_0x3e0868[_0x4f82c1['name']]={'$like':'%'+_0x14c200['query'][_0x5eaa('0x39')]+'%'};return _0x3e0868;}})});}_0x26c1ba=_[_0x5eaa('0x3a')]({},_0x26c1ba,_0x14c200['options']);var _0x10b15b={'where':_0x26c1ba['where']};return db[_0x5eaa('0x3d')][_0x5eaa('0x1d')](_0x10b15b)[_0x5eaa('0x22')](function(_0x34d867){_0x46ddf3[_0x5eaa('0x1d')]=_0x34d867;if(_0x14c200[_0x5eaa('0x2d')][_0x5eaa('0x3e')]){_0x26c1ba[_0x5eaa('0x3f')]=[{'all':!![]}];}return db[_0x5eaa('0x3d')][_0x5eaa('0x40')](_0x26c1ba);})[_0x5eaa('0x22')](function(_0x315a16){_0x46ddf3[_0x5eaa('0x41')]=_0x315a16;return _0x46ddf3;})['then'](respondWithFilteredResult(_0x2ab13e,_0x26c1ba))[_0x5eaa('0x42')](handleError(_0x2ab13e,null));};exports[_0x5eaa('0x43')]=function(_0x3addd4,_0x392b71){var _0x4bdf18={'raw':!![],'where':{'id':_0x3addd4[_0x5eaa('0x44')]['id']}},_0xa5c1d7={};_0xa5c1d7[_0x5eaa('0x30')]=_[_0x5eaa('0x45')](db['WhatsappTransferReport'][_0x5eaa('0x29')]);_0xa5c1d7['query']=_[_0x5eaa('0x45')](_0x3addd4[_0x5eaa('0x2d')]);_0xa5c1d7[_0x5eaa('0x2e')]=_[_0x5eaa('0x2f')](_0xa5c1d7[_0x5eaa('0x30')],_0xa5c1d7[_0x5eaa('0x2d')]);_0x4bdf18[_0x5eaa('0x32')]=_[_0x5eaa('0x2f')](_0xa5c1d7[_0x5eaa('0x30')],qs[_0x5eaa('0x31')](_0x3addd4[_0x5eaa('0x2d')]['fields']));_0x4bdf18[_0x5eaa('0x32')]=_0x4bdf18[_0x5eaa('0x32')]['length']?_0x4bdf18[_0x5eaa('0x32')]:_0xa5c1d7[_0x5eaa('0x30')];if(_0x3addd4[_0x5eaa('0x2d')][_0x5eaa('0x3e')]){_0x4bdf18['include']=[{'all':!![]}];}_0x4bdf18=_[_0x5eaa('0x3a')]({},_0x4bdf18,_0x3addd4['options']);return db[_0x5eaa('0x3d')][_0x5eaa('0x46')](_0x4bdf18)[_0x5eaa('0x22')](handleEntityNotFound(_0x392b71,null))[_0x5eaa('0x22')](respondWithResult(_0x392b71,null))['catch'](handleError(_0x392b71,null));};exports[_0x5eaa('0x47')]=function(_0x4fdf72,_0x4cc073){return db[_0x5eaa('0x3d')][_0x5eaa('0x47')](_0x4fdf72[_0x5eaa('0x48')],{})[_0x5eaa('0x22')](respondWithResult(_0x4cc073,0xc9))[_0x5eaa('0x42')](handleError(_0x4cc073,null));};exports[_0x5eaa('0x21')]=function(_0xd26607,_0x1460ea){if(_0xd26607[_0x5eaa('0x48')]['id']){delete _0xd26607[_0x5eaa('0x48')]['id'];}return db[_0x5eaa('0x3d')]['find']({'where':{'id':_0xd26607[_0x5eaa('0x44')]['id']}})[_0x5eaa('0x22')](handleEntityNotFound(_0x1460ea,null))[_0x5eaa('0x22')](saveUpdates(_0xd26607[_0x5eaa('0x48')],null))[_0x5eaa('0x22')](respondWithResult(_0x1460ea,null))[_0x5eaa('0x42')](handleError(_0x1460ea,null));};exports['destroy']=function(_0x5c62e1,_0x559346){return db['WhatsappTransferReport'][_0x5eaa('0x46')]({'where':{'id':_0x5c62e1[_0x5eaa('0x44')]['id']}})[_0x5eaa('0x22')](handleEntityNotFound(_0x559346,null))[_0x5eaa('0x22')](removeEntity(_0x559346,null))[_0x5eaa('0x42')](handleError(_0x559346,null));};exports[_0x5eaa('0x49')]=function(_0x22b126,_0x29f37d){return db[_0x5eaa('0x3d')][_0x5eaa('0x49')]()[_0x5eaa('0x22')](respondWithResult(_0x29f37d,null))[_0x5eaa('0x42')](handleError(_0x29f37d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d2e1aeb..9176039 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 _0x9f6b=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x762f6f,_0x23da53){var _0x1219f8=function(_0x3e234a){while(--_0x3e234a){_0x762f6f['push'](_0x762f6f['shift']());}};_0x1219f8(++_0x23da53);}(_0x9f6b,0x1b8));var _0xb9f6=function(_0x6c41,_0x1e1a01){_0x6c41=_0x6c41-0x0;var _0x51b408=_0x9f6b[_0x6c41];return _0x51b408;};'use strict';var _=require(_0xb9f6('0x0'));var util=require(_0xb9f6('0x1'));var logger=require(_0xb9f6('0x2'))(_0xb9f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9f6('0x4'));var fs=require('fs');var path=require(_0xb9f6('0x5'));var rimraf=require(_0xb9f6('0x6'));var config=require(_0xb9f6('0x7'));var attributes=require(_0xb9f6('0x8'));module[_0xb9f6('0x9')]=function(_0x8272d5,_0x53382d){return _0x8272d5[_0xb9f6('0xa')](_0xb9f6('0xb'),attributes,{'tableName':_0xb9f6('0xc'),'paranoid':![],'indexes':[{'name':_0xb9f6('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0331=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x41caac,_0x50c421){var _0x28d2ba=function(_0x2a2e12){while(--_0x2a2e12){_0x41caac['push'](_0x41caac['shift']());}};_0x28d2ba(++_0x50c421);}(_0x0331,0x160));var _0x1033=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x0331[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1033('0x0'));var BPromise=require(_0x1033('0x1'));var rp=require(_0x1033('0x2'));var fs=require('fs');var path=require(_0x1033('0x3'));var rimraf=require(_0x1033('0x4'));var config=require(_0x1033('0x5'));var attributes=require(_0x1033('0x6'));module[_0x1033('0x7')]=function(_0x41c16b,_0x3c79d6){return _0x41c16b['define'](_0x1033('0x8'),attributes,{'tableName':_0x1033('0x9'),'paranoid':![],'indexes':[{'name':_0x1033('0xa'),'fields':[_0x1033('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0e2719e..5af0dc1 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 _0xff62=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x7e6e36,_0x3a9e69){var _0x303da6=function(_0x20625f){while(--_0x20625f){_0x7e6e36['push'](_0x7e6e36['shift']());}};_0x303da6(++_0x3a9e69);}(_0xff62,0x9f));var _0x2ff6=function(_0x58eb3c,_0x36557c){_0x58eb3c=_0x58eb3c-0x0;var _0x42d950=_0xff62[_0x58eb3c];return _0x42d950;};'use strict';var _=require(_0x2ff6('0x0'));var util=require('util');var moment=require(_0x2ff6('0x1'));var BPromise=require(_0x2ff6('0x2'));var rs=require(_0x2ff6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ff6('0x4'))['db'];var utils=require(_0x2ff6('0x5'));var logger=require(_0x2ff6('0x6'))(_0x2ff6('0x7'));var config=require('../../config/environment');var jayson=require(_0x2ff6('0x8'));var client=jayson['client'][_0x2ff6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaccad2,_0x5b34ad,_0x4a39ad){return new BPromise(function(_0x6c1978,_0x2fac7a){return client[_0x2ff6('0xa')](_0xaccad2,_0x4a39ad)[_0x2ff6('0xb')](function(_0x2714bb){logger['info'](_0x2ff6('0xc'),_0x5b34ad,_0x2ff6('0xd'));logger[_0x2ff6('0xe')](_0x2ff6('0xf'),_0x5b34ad,_0x2ff6('0xd'),JSON[_0x2ff6('0x10')](_0x2714bb));if(_0x2714bb['error']){if(_0x2714bb[_0x2ff6('0x11')][_0x2ff6('0x12')]===0x1f4){logger[_0x2ff6('0x11')](_0x2ff6('0xc'),_0x5b34ad,_0x2714bb[_0x2ff6('0x11')][_0x2ff6('0x13')]);return _0x2fac7a(_0x2714bb[_0x2ff6('0x11')][_0x2ff6('0x13')]);}logger[_0x2ff6('0x11')](_0x2ff6('0xc'),_0x5b34ad,_0x2714bb[_0x2ff6('0x11')]['message']);return _0x6c1978(_0x2714bb[_0x2ff6('0x11')][_0x2ff6('0x13')]);}else{logger['info'](_0x2ff6('0xc'),_0x5b34ad,_0x2ff6('0xd'));_0x6c1978(_0x2714bb['result'][_0x2ff6('0x13')]);}})['catch'](function(_0x2694cb){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x5b34ad,_0x2694cb);_0x2fac7a(_0x2694cb);});});} \ No newline at end of file +var _0xa2d9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x5ce4e3,_0x42cb9a){var _0x42248f=function(_0x22ab0f){while(--_0x22ab0f){_0x5ce4e3['push'](_0x5ce4e3['shift']());}};_0x42248f(++_0x42cb9a);}(_0xa2d9,0x1a0));var _0x9a2d=function(_0x2c70b4,_0x1e1fab){_0x2c70b4=_0x2c70b4-0x0;var _0x34f08a=_0xa2d9[_0x2c70b4];return _0x34f08a;};'use strict';var _=require(_0x9a2d('0x0'));var util=require(_0x9a2d('0x1'));var moment=require(_0x9a2d('0x2'));var BPromise=require(_0x9a2d('0x3'));var rs=require(_0x9a2d('0x4'));var fs=require('fs');var Redis=require(_0x9a2d('0x5'));var db=require(_0x9a2d('0x6'))['db'];var utils=require(_0x9a2d('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9a2d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a2d('0x9')][_0x9a2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x272dcc,_0x201993,_0x4ce965){return new BPromise(function(_0x5447d9,_0x3d0cd3){return client[_0x9a2d('0xb')](_0x272dcc,_0x4ce965)[_0x9a2d('0xc')](function(_0x241c0d){logger[_0x9a2d('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x201993,_0x9a2d('0xe'));logger['debug'](_0x9a2d('0xf'),_0x201993,_0x9a2d('0xe'),JSON[_0x9a2d('0x10')](_0x241c0d));if(_0x241c0d[_0x9a2d('0x11')]){if(_0x241c0d['error'][_0x9a2d('0x12')]===0x1f4){logger[_0x9a2d('0x11')](_0x9a2d('0x13'),_0x201993,_0x241c0d[_0x9a2d('0x11')][_0x9a2d('0x14')]);return _0x3d0cd3(_0x241c0d[_0x9a2d('0x11')][_0x9a2d('0x14')]);}logger['error'](_0x9a2d('0x13'),_0x201993,_0x241c0d[_0x9a2d('0x11')][_0x9a2d('0x14')]);return _0x5447d9(_0x241c0d[_0x9a2d('0x11')][_0x9a2d('0x14')]);}else{logger['info'](_0x9a2d('0x13'),_0x201993,'request\x20sent');_0x5447d9(_0x241c0d['result']['message']);}})[_0x9a2d('0x15')](function(_0x29943e){logger[_0x9a2d('0x11')](_0x9a2d('0x13'),_0x201993,_0x29943e);_0x3d0cd3(_0x29943e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 9d199a8..7a9ef18 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x535f=['./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','then','seedDB','default','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2/config'];(function(_0x4907a7,_0x50eb8e){var _0x54d335=function(_0x2cab47){while(--_0x2cab47){_0x4907a7['push'](_0x4907a7['shift']());}};_0x54d335(++_0x50eb8e);}(_0x535f,0x111));var _0xf535=function(_0xc58b4d,_0x6dd26a){_0xc58b4d=_0xc58b4d-0x0;var _0x496a98=_0x535f[_0xc58b4d];return _0x496a98;};'use strict';var _=require('lodash');var db=require(_0xf535('0x0'))['db'];var seedDb=require(_0xf535('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xf535('0x2'));var config=require(_0xf535('0x3'));var logger=require(_0xf535('0x4'))(_0xf535('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xf535('0x6'));var schedule=require(_0xf535('0x7'));var chat=require(_0xf535('0x8'));var whatsapp=require(_0xf535('0x9'));var transcribe=require(_0xf535('0xa'));var provider=require(_0xf535('0xb'));function main(){return db['sequelize']['sync']()[_0xf535('0xc')](function(){if(config[_0xf535('0xd')]){return seedDb[_0xf535('0xe')]();}})['then'](function(){return checkLicense[_0xf535('0xe')]();})[_0xf535('0xc')](function(){return rpc['listen']();})['then'](function(_0x56f05d){logger[_0xf535('0xf')](_0x56f05d);return chat['start']();})['then'](function(){return whatsapp[_0xf535('0x10')]();})[_0xf535('0xc')](function(){return schedule[_0xf535('0x10')]();})[_0xf535('0xc')](function(){return transcribe[_0xf535('0x10')]();})['then'](function(){return provider[_0xf535('0x10')]();})[_0xf535('0xc')](function(_0x203d91){logger[_0xf535('0xf')](_0x203d91);return pm2[_0xf535('0x10')](pm2Config);})[_0xf535('0xc')](function(_0x183049){var _0x23df0f=_0x183049[_0xf535('0x11')](function(_0xb52d7f){return typeof _0xb52d7f[_0xf535('0x12')]==='number'&&_0xb52d7f[_0xf535('0x12')]>=0x0;});if(_0x23df0f[_0xf535('0x13')]>0x0){throw new Error(_0x23df0f[_0xf535('0x13')]+_0xf535('0x14')+_[_0xf535('0x15')](_0x23df0f,function(_0x1fb901){return'\x22'+_0x1fb901[_0xf535('0x16')][_0xf535('0x17')]+'\x22';}));}logger[_0xf535('0xf')](_0xf535('0x18'),_['map'](_[_0xf535('0x11')](_0x183049,{'status':_0xf535('0x19')}),_0xf535('0x17'))[_0xf535('0x1a')]());logger['info'](_0xf535('0x1b'),_[_0xf535('0x15')](_['filter'](_0x183049,function(_0x4ff009){return _0x4ff009['status']!==_0xf535('0x19');}),_0xf535('0x17'))[_0xf535('0x1a')]()||'None');console['log'](_0xf535('0x1c'));})[_0xf535('0x1d')](function(_0x946e04){console[_0xf535('0x1e')](_0xf535('0x1f'),_0x946e04);logger[_0xf535('0x20')](_0xf535('0x21'),_0x946e04);process[_0xf535('0x22')](0x1);});}main(); \ No newline at end of file +var _0x92bc=['exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','status','online','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','seedDB','default','then','start','info','filter'];(function(_0x53a207,_0xbca4f8){var _0x45fd8c=function(_0x1ff8fe){while(--_0x1ff8fe){_0x53a207['push'](_0x53a207['shift']());}};_0x45fd8c(++_0xbca4f8);}(_0x92bc,0x106));var _0xc92b=function(_0x40f45c,_0x2aa4ff){_0x40f45c=_0x40f45c-0x0;var _0x6a2965=_0x92bc[_0x40f45c];return _0x6a2965;};'use strict';var _=require(_0xc92b('0x0'));var db=require(_0xc92b('0x1'))['db'];var seedDb=require(_0xc92b('0x2'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0xc92b('0x3'));var logger=require(_0xc92b('0x4'))(_0xc92b('0x5'));var pm2=require(_0xc92b('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xc92b('0x7'));var chat=require(_0xc92b('0x8'));var whatsapp=require(_0xc92b('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xc92b('0xa')][_0xc92b('0xb')]()['then'](function(){if(config[_0xc92b('0xc')]){return seedDb[_0xc92b('0xd')]();}})[_0xc92b('0xe')](function(){return checkLicense['default']();})[_0xc92b('0xe')](function(){return rpc['listen']();})['then'](function(_0x3f288c){logger['info'](_0x3f288c);return chat[_0xc92b('0xf')]();})[_0xc92b('0xe')](function(){return whatsapp[_0xc92b('0xf')]();})[_0xc92b('0xe')](function(){return schedule[_0xc92b('0xf')]();})[_0xc92b('0xe')](function(){return transcribe[_0xc92b('0xf')]();})[_0xc92b('0xe')](function(){return provider[_0xc92b('0xf')]();})[_0xc92b('0xe')](function(_0x276aa9){logger[_0xc92b('0x10')](_0x276aa9);return pm2[_0xc92b('0xf')](pm2Config);})[_0xc92b('0xe')](function(_0x4a8071){var _0x3980f4=_0x4a8071[_0xc92b('0x11')](function(_0x5e6a40){return typeof _0x5e6a40[_0xc92b('0x12')]===_0xc92b('0x13')&&_0x5e6a40[_0xc92b('0x12')]>=0x0;});if(_0x3980f4[_0xc92b('0x14')]>0x0){throw new Error(_0x3980f4[_0xc92b('0x14')]+_0xc92b('0x15')+_[_0xc92b('0x16')](_0x3980f4,function(_0x5d52fc){return'\x22'+_0x5d52fc[_0xc92b('0x17')][_0xc92b('0x18')]+'\x22';}));}logger[_0xc92b('0x10')](_0xc92b('0x19'),_[_0xc92b('0x16')](_[_0xc92b('0x11')](_0x4a8071,{'status':'online'}),_0xc92b('0x18'))[_0xc92b('0x1a')]());logger[_0xc92b('0x10')]('Offline\x20apps:',_[_0xc92b('0x16')](_[_0xc92b('0x11')](_0x4a8071,function(_0x544123){return _0x544123[_0xc92b('0x1b')]!==_0xc92b('0x1c');}),_0xc92b('0x18'))['join']()||_0xc92b('0x1d'));console['log'](_0xc92b('0x1e'));})['catch'](function(_0x2ba166){console[_0xc92b('0x1f')](_0xc92b('0x20'),_0x2ba166);logger[_0xc92b('0x21')](_0xc92b('0x22'),_0x2ba166);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ea1e92f..c8a163a 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 _0x278d=['disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','use','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','composable-middleware','crypto','secrets','session','fullname','name','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','params','closed','disposition','then','forceDownload','status','unmanaged','Forbidden.','catch','headers','authorization','Basic','User','find','authenticate','pass','startsWith','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','json','API\x20access\x20key\x20is\x20not\x20valid\x20anymore'];(function(_0x784d87,_0x4f0284){var _0x22e453=function(_0x20eeea){while(--_0x20eeea){_0x784d87['push'](_0x784d87['shift']());}};_0x22e453(++_0x4f0284);}(_0x278d,0x1c0));var _0xd278=function(_0x56503a,_0x1c4b81){_0x56503a=_0x56503a-0x0;var _0x52e0d4=_0x278d[_0x56503a];return _0x52e0d4;};'use strict';var db=require(_0xd278('0x0'))['db'];var config=require(_0xd278('0x1'));var hardwareConf=require(_0xd278('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xd278('0x3'));var _=require('lodash');var jwt=require(_0xd278('0x4'));var expressJwt=require('express-jwt');var compose=require(_0xd278('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0xd278('0x6'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xd278('0x7')][_0xd278('0x8')]});var userAttributes=['id','role',_0xd278('0x9'),_0xd278('0xa'),_0xd278('0xb'),_0xd278('0xc'),_0xd278('0xd'),'permissions',_0xd278('0xe'),_0xd278('0xf'),_0xd278('0x10'),_0xd278('0x11'),'faxPause',_0xd278('0x12'),_0xd278('0x13'),_0xd278('0x14'),_0xd278('0x15'),_0xd278('0x16'),_0xd278('0x17'),'crudPermissions','allowmessenger',_0xd278('0x18'),_0xd278('0x19'),_0xd278('0x1a'),'phoneBarAutoAnswerDelay',_0xd278('0x1b'),_0xd278('0x1c'),_0xd278('0x1d'),_0xd278('0x1e'),_0xd278('0x1f'),_0xd278('0x20'),_0xd278('0x21'),_0xd278('0x22'),_0xd278('0x23'),_0xd278('0x24'),_0xd278('0x25'),'privacyEnabled','settingsEnabled',_0xd278('0x26'),_0xd278('0x27'),_0xd278('0x28'),'downloadAttachments',_0xd278('0x29'),_0xd278('0x2a'),_0xd278('0x2b'),_0xd278('0x2c'),_0xd278('0x2d'),_0xd278('0x2e'),_0xd278('0x2f'),_0xd278('0x30'),_0xd278('0x31'),_0xd278('0x32'),_0xd278('0x33'),_0xd278('0x34'),_0xd278('0x35'),_0xd278('0x36'),_0xd278('0x37')];exports[_0xd278('0x38')]=function(){return this[_0xd278('0x39')](!![])['use'](function(_0x56a994,_0x5e6321,_0x2e2e86){if(_0x56a994[_0xd278('0x3a')]){_0x2e2e86();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x56a994[_0xd278('0x3b')]['id']},'attributes':['id',_0xd278('0x3c'),_0xd278('0x3d')],'raw':!![]})[_0xd278('0x3e')](function(_0x280c38){if(_0x280c38&&_0x280c38['closed']&&!_0x56a994['query'][_0xd278('0x3f')]){return _0x5e6321[_0xd278('0x40')](_0x280c38[_0xd278('0x3d')]==='unmanaged'?0x195:0x193)['json']({'message':_0x280c38[_0xd278('0x3d')]===_0xd278('0x41')?'Unmanaged.':_0xd278('0x42')});}else{_0x2e2e86();}})[_0xd278('0x43')](function(_0x537f58){_0x2e2e86(_0x537f58);});}});};exports[_0xd278('0x39')]=function isAuthenticated(_0x59078d){return compose()['use'](function(_0x3213f8,_0x26d457,_0x2efb81){var _0x171789;if(_0x3213f8[_0xd278('0x44')]['authorization']){if(_['startsWith'](_0x3213f8['headers'][_0xd278('0x45')],_0xd278('0x46'))){var _0xca1af3=basicAuth(_0x3213f8);db[_0xd278('0x47')][_0xd278('0x48')]({'where':{'name':_0xca1af3[_0xd278('0xa')]}})[_0xd278('0x3e')](function(_0x29644d){if(!_0x29644d||!_0x29644d[_0xd278('0x49')](_0xca1af3[_0xd278('0x4a')])){return _0x26d457[_0xd278('0x40')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x3213f8[_0xd278('0x3a')]={'id':_0x29644d['id']};_0x2efb81();})[_0xd278('0x43')](function(_0x23a0c6){_0x2efb81(_0x23a0c6);});}else if(_[_0xd278('0x4b')](_0x3213f8[_0xd278('0x44')][_0xd278('0x45')],'Bearer')){validateJwt(_0x3213f8,_0x26d457,_0x2efb81);}else{if(_0x59078d){_0x2efb81();}else{return _0x26d457['status'](0x193)['json']({'message':_0xd278('0x4c')});}}}else if(_0x3213f8['query'][_0xd278('0x4d')]){try{var _0x30badd={'audience':hardwareConf[_0xd278('0x4e')](),'issuer':hardwareConf[_0xd278('0x4e')]()};verifyJwt(_0x3213f8['query']['apikey'],_0x30badd)[_0xd278('0x3e')](function(_0x52317d){return db['User'][_0xd278('0x48')]({'where':{'id':_0x52317d[_0xd278('0x4f')]}})[_0xd278('0x3e')](function(_0x4c47d7){_0x171789=_0x4c47d7;return db[_0xd278('0x50')][_0xd278('0x51')]({'where':{'id':0x1},'attributes':[_0xd278('0x52'),_0xd278('0x53')],'raw':!![]});})[_0xd278('0x3e')](function(_0x58688f){if(!_0x171789||!_['isEqual'](_0x171789[_0xd278('0x54')],_0x52317d[_0xd278('0x55')])){return _0x26d457[_0xd278('0x40')](0x191)[_0xd278('0x56')]({'message':_0xd278('0x57')});}if(_0x171789[_0xd278('0x58')]){return _0x26d457['status'](0x191)[_0xd278('0x56')]({'message':_0xd278('0x59')});}if(_0x171789[_0xd278('0x5a')]){if(_0x58688f[_0xd278('0x53')]>0x0){if(moment(_0x171789[_0xd278('0x5b')])['add'](_0x58688f[_0xd278('0x53')],_0xd278('0x5c'))>moment()){return _0x26d457[_0xd278('0x40')](0x191)[_0xd278('0x56')]({'message':_0xd278('0x59')});}}else{return _0x26d457[_0xd278('0x40')](0x191)[_0xd278('0x56')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x3213f8[_0xd278('0x3a')]={'id':_0x171789['id']};_0x2efb81();});})[_0xd278('0x43')](function(){return _0x26d457[_0xd278('0x40')](0x191)['json']({'message':_0xd278('0x59')});});}catch(_0x2b3e05){_0x2efb81(_0x2b3e05);}}else if(_0x59078d){_0x2efb81();}else{return _0x26d457['status'](0x193)[_0xd278('0x56')]({'message':'Unknown\x20authorization\x20format'});}})[_0xd278('0x5d')](function(_0x23d4d4,_0x213555,_0x2c39a9){if(_0x23d4d4[_0xd278('0x3a')]){db[_0xd278('0x47')][_0xd278('0x48')]({'where':{'id':_0x23d4d4[_0xd278('0x3a')]['id']},'attributes':userAttributes})[_0xd278('0x3e')](function(_0xf237b2){if(!_0xf237b2){return _0x213555[_0xd278('0x40')](0x194)[_0xd278('0x56')]({'message':_0xd278('0x5e')});}_0x23d4d4[_0xd278('0x3a')]=_0xf237b2;_0x2c39a9();})[_0xd278('0x43')](function(_0xd68a15){_0x2c39a9(_0xd68a15);});}else if(_0x59078d){_0x2c39a9();}else{return _0x213555['status'](0x194)[_0xd278('0x56')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xd278('0x5f')]=function canUpdate(){return compose()[_0xd278('0x5d')](function(_0xd0e606,_0x51b2d1,_0x2ddf95){return licenseUtil[_0xd278('0x60')]()[_0xd278('0x3e')](function(_0x57cff1){if(_0x57cff1[_0xd278('0x61')]){_0x2ddf95();}else{return _0x51b2d1[_0xd278('0x40')](0x193)[_0xd278('0x56')]({'message':_0xd278('0x62')});}})[_0xd278('0x43')](function(_0x3fe8ad){_0x2ddf95(_0x3fe8ad);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x84ce8e,_0xf94521,_0x318675){return licenseUtil[_0xd278('0x60')]()[_0xd278('0x3e')](function(_0xb46033){if(_0xb46033[_0xd278('0x63')]){_0x318675();}else{return _0xf94521[_0xd278('0x40')](0x193)[_0xd278('0x56')]({'message':_0xd278('0x62')});}})[_0xd278('0x43')](function(_0x469a52){_0x318675(_0x469a52);});});};exports[_0xd278('0x64')]=function(_0x1c3623,_0x5ecba4,_0x59d04b){_0x1c3623['isMiddleware']=!![];return _0x59d04b();};exports['signToken']=function signToken(_0x1dfd0a){return signJwt(_0x1dfd0a);};exports['setTokenCookie']=function(_0x50b453,_0x5c0fa2){if(!_0x50b453[_0xd278('0x3a')]){return _0x5c0fa2[_0xd278('0x40')](0x194)['json']({'message':_0xd278('0x65')});}var _0x22e477={'payload':{'id':_0x50b453[_0xd278('0x3a')]['id'],'role':_0x50b453[_0xd278('0x3a')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x22e477)['then'](function(_0x422870){_0x5c0fa2['cookie'](_0xd278('0x66'),_0x422870);_0x5c0fa2[_0xd278('0x67')](_0xd278('0x68'));})[_0xd278('0x43')](function(_0x16445b){return _0x5c0fa2[_0xd278('0x40')](0x1f4)[_0xd278('0x69')](_0x16445b);});};exports['retrieveApiKey']=function(_0x260198){if(_[_0xd278('0x6a')](_0x260198[_0xd278('0x54')])||_[_0xd278('0x6a')](_0x260198[_0xd278('0x6b')])){return null;}else{return createJwt(_0x260198);}};exports['generateApiKey']=function(_0x166fc8){_0x166fc8[_0xd278('0x54')]=generateNonce();_0x166fc8[_0xd278('0x6b')]=generateIssuedAt();return createJwt(_0x166fc8);};exports['regenerateApiKey']=function(_0x420c6a,_0x55305b){var _0x5cb589=_0x420c6a[_0xd278('0x6c')]['apikey'];if(_0x5cb589){var _0x47049c={'nonce':_0x55305b[_0xd278('0x54')],'iat':_0x55305b[_0xd278('0x6b')],'audience':hardwareConf[_0xd278('0x4e')](),'issuer':hardwareConf[_0xd278('0x4e')]()};return verifyJwt(_0x5cb589,_0x47049c)[_0xd278('0x3e')](function(){return generateApiKey(_0x55305b);});}else{throw{'message':_0xd278('0x6d')};}};exports[_0xd278('0x6e')]=function(_0x19658c){var _0x2d3881=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2d3881[_0xd278('0x6f')](_0x19658c))throw new db[(_0xd278('0x70'))][(_0xd278('0x71'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x391800,_0x59e175,_0x59bc89){var _0x130e55=encryptor[_0xd278('0x72')](_0x59e175)[_0xd278('0x73')](',');for(var _0x388ffb=0x0;_0x388ffb<_0x59bc89;_0x388ffb++){if(!_0x130e55[_0x388ffb])break;if(_0x391800['toLowerCase']()===_0x130e55[_0x388ffb][_0xd278('0x74')]()){var _0x192a08=util[_0xd278('0x75')](_0xd278('0x76'),_0x59bc89);if(_0x59bc89===0x1){_0x192a08=_0xd278('0x77');}throw new db[(_0xd278('0x70'))]['ValidationError'](_0x192a08);}}return;};exports['updatePasswordsHistory']=function(_0x464816,_0x27b3cd){var _0x56ea4e=_0x27b3cd?encryptor[_0xd278('0x72')](_0x27b3cd)[_0xd278('0x73')](','):[];if(_0x56ea4e['length']===0x5){_0x56ea4e[_0xd278('0x78')](-0x1,0x1);}_0x56ea4e[_0xd278('0x79')](_0x464816);return encryptor[_0xd278('0x7a')](_0x56ea4e[_0xd278('0x7b')](','));};function signJwt(_0x143fbc){var _0x322004=BPromise['promisify'](jwt[_0xd278('0x7c')],{'context':jwt});var _0x251bf3=_0x143fbc[_0xd278('0x7d')]||config[_0xd278('0x7')][_0xd278('0x8')];return new BPromise(function(_0x2f5fb0,_0x5d9671){_0x322004(_0x143fbc[_0xd278('0x7e')],_0x251bf3,_0x143fbc[_0xd278('0x7f')])[_0xd278('0x3e')](function(_0x3934a4){_0x2f5fb0(_0x3934a4);})[_0xd278('0x43')](function(_0x4c1d00){_0x5d9671(_0x4c1d00);});});}function verifyJwt(_0x237e39,_0x387855,_0x2296bd){var _0x2e796f=BPromise[_0xd278('0x80')](jwt[_0xd278('0x81')],{'context':jwt});var _0x2d75af=_0x2296bd||config[_0xd278('0x7')]['session'];return new BPromise(function(_0x16582b,_0x1cdb95){_0x2e796f(_0x237e39,_0x2d75af,_0x387855)[_0xd278('0x3e')](function(_0x554292){_0x16582b(_0x554292);})[_0xd278('0x43')](function(_0x287b5d){_0x1cdb95(_0x287b5d);});});}function generateNonce(){return crypto[_0xd278('0x82')](0x10)[_0xd278('0x83')]('hex');}function generateIssuedAt(){return Math[_0xd278('0x84')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x55220d){var _0xf2fc51={'payload':{'iat':_0x55220d['apiKeyIat'],'nonce':_0x55220d['apiKeyNonce']},'options':{'algorithm':_0xd278('0x85'),'subject':_0x55220d['id']['toString'](),'issuer':hardwareConf[_0xd278('0x4e')](),'audience':hardwareConf[_0xd278('0x4e')]()}};return signJwt(_0xf2fc51)[_0xd278('0x3e')](function(_0x259775){return{'iat':_0x55220d[_0xd278('0x6b')],'nonce':_0x55220d['apiKeyNonce'],'token':_0x259775};});} \ No newline at end of file +var _0x9af2=['isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','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','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.','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','sign','secret','session','payload','verify','toString','hex','floor','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','util','secrets','role','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','disposition','then','closed','query','json','unmanaged','Unmanaged.','catch','headers','authorization','pass','status','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','getUuid','sub','findOne','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense'];(function(_0xe99f58,_0x2d19fc){var _0x72fd7a=function(_0x5e1aaa){while(--_0x5e1aaa){_0xe99f58['push'](_0xe99f58['shift']());}};_0x72fd7a(++_0x2d19fc);}(_0x9af2,0xab));var _0x29af=function(_0x1f8516,_0x5b53f3){_0x1f8516=_0x1f8516-0x0;var _0x321a61=_0x9af2[_0x1f8516];return _0x321a61;};'use strict';var db=require(_0x29af('0x0'))['db'];var config=require(_0x29af('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x29af('0x2'));var jwt=require(_0x29af('0x3'));var expressJwt=require(_0x29af('0x4'));var compose=require(_0x29af('0x5'));var basicAuth=require(_0x29af('0x6'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x29af('0x7'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x29af('0x8')]['session']});var userAttributes=['id',_0x29af('0x9'),'fullname',_0x29af('0xa'),_0x29af('0xb'),_0x29af('0xc'),_0x29af('0xd'),_0x29af('0xe'),_0x29af('0xf'),_0x29af('0x10'),_0x29af('0x11'),_0x29af('0x12'),_0x29af('0x13'),_0x29af('0x14'),_0x29af('0x15'),_0x29af('0x16'),_0x29af('0x17'),_0x29af('0x18'),_0x29af('0x19'),_0x29af('0x1a'),_0x29af('0x1b'),'passwordResetAt',_0x29af('0x1c'),_0x29af('0x1d'),_0x29af('0x1e'),_0x29af('0x1f'),_0x29af('0x20'),_0x29af('0x21'),_0x29af('0x22'),_0x29af('0x23'),'phoneBarPrefixRequired',_0x29af('0x24'),_0x29af('0x25'),_0x29af('0x26'),_0x29af('0x27'),_0x29af('0x28'),'privacyEnabled',_0x29af('0x29'),_0x29af('0x2a'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x29af('0x2b'),_0x29af('0x2c'),_0x29af('0x2d'),_0x29af('0x2e'),_0x29af('0x2f'),'emailAutoanswer','emailAutoanswerDelay',_0x29af('0x30'),_0x29af('0x31'),_0x29af('0x32'),_0x29af('0x33'),_0x29af('0x34'),_0x29af('0x35'),_0x29af('0x36'),_0x29af('0x37'),'messengerSoundNotification'];exports[_0x29af('0x38')]=function(){return this[_0x29af('0x39')](!![])[_0x29af('0x3a')](function(_0x437d5e,_0x5668e7,_0x2b14ac){if(_0x437d5e[_0x29af('0x3b')]){_0x2b14ac();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x437d5e['params']['id']},'attributes':['id','closed',_0x29af('0x3c')],'raw':!![]})[_0x29af('0x3d')](function(_0x5df4e5){if(_0x5df4e5&&_0x5df4e5[_0x29af('0x3e')]&&!_0x437d5e[_0x29af('0x3f')]['forceDownload']){return _0x5668e7['status'](_0x5df4e5['disposition']==='unmanaged'?0x195:0x193)[_0x29af('0x40')]({'message':_0x5df4e5['disposition']===_0x29af('0x41')?_0x29af('0x42'):'Forbidden.'});}else{_0x2b14ac();}})[_0x29af('0x43')](function(_0x1cf8ed){_0x2b14ac(_0x1cf8ed);});}});};exports[_0x29af('0x39')]=function isAuthenticated(_0x33fc6d){return compose()[_0x29af('0x3a')](function(_0x11e5f9,_0x53674b,_0x1ec20c){var _0x31b78f;if(_0x11e5f9[_0x29af('0x44')][_0x29af('0x45')]){if(_['startsWith'](_0x11e5f9['headers'][_0x29af('0x45')],'Basic')){var _0x38c85c=basicAuth(_0x11e5f9);db['User']['find']({'where':{'name':_0x38c85c['name']}})[_0x29af('0x3d')](function(_0x3d12bd){if(!_0x3d12bd||!_0x3d12bd['authenticate'](_0x38c85c[_0x29af('0x46')])){return _0x53674b[_0x29af('0x47')](0x191)[_0x29af('0x40')]({'message':_0x29af('0x48')});}_0x11e5f9[_0x29af('0x3b')]={'id':_0x3d12bd['id']};_0x1ec20c();})[_0x29af('0x43')](function(_0x2ab082){_0x1ec20c(_0x2ab082);});}else if(_[_0x29af('0x49')](_0x11e5f9[_0x29af('0x44')][_0x29af('0x45')],_0x29af('0x4a'))){validateJwt(_0x11e5f9,_0x53674b,_0x1ec20c);}else{if(_0x33fc6d){_0x1ec20c();}else{return _0x53674b[_0x29af('0x47')](0x193)['json']({'message':_0x29af('0x4b')});}}}else if(_0x11e5f9[_0x29af('0x3f')]['apikey']){try{var _0x4a3a0f={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x29af('0x4c')]()};verifyJwt(_0x11e5f9[_0x29af('0x3f')]['apikey'],_0x4a3a0f)[_0x29af('0x3d')](function(_0x9ad54c){return db['User']['find']({'where':{'id':_0x9ad54c[_0x29af('0x4d')]}})[_0x29af('0x3d')](function(_0x58c173){_0x31b78f=_0x58c173;return db['Setting'][_0x29af('0x4e')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x29af('0x4f')],'raw':!![]});})[_0x29af('0x3d')](function(_0x371110){if(!_0x31b78f||!_[_0x29af('0x50')](_0x31b78f[_0x29af('0x51')],_0x9ad54c['nonce'])){return _0x53674b['status'](0x191)[_0x29af('0x40')]({'message':_0x29af('0x52')});}if(_0x31b78f[_0x29af('0x53')]){return _0x53674b[_0x29af('0x47')](0x191)[_0x29af('0x40')]({'message':_0x29af('0x54')});}if(_0x31b78f[_0x29af('0x55')]){if(_0x371110[_0x29af('0x4f')]>0x0){if(moment(_0x31b78f[_0x29af('0x56')])[_0x29af('0x57')](_0x371110[_0x29af('0x4f')],_0x29af('0x58'))>moment()){return _0x53674b[_0x29af('0x47')](0x191)[_0x29af('0x40')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x53674b['status'](0x191)[_0x29af('0x40')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x11e5f9[_0x29af('0x3b')]={'id':_0x31b78f['id']};_0x1ec20c();});})[_0x29af('0x43')](function(){return _0x53674b[_0x29af('0x47')](0x191)['json']({'message':_0x29af('0x54')});});}catch(_0x39e295){_0x1ec20c(_0x39e295);}}else if(_0x33fc6d){_0x1ec20c();}else{return _0x53674b[_0x29af('0x47')](0x193)[_0x29af('0x40')]({'message':_0x29af('0x4b')});}})[_0x29af('0x3a')](function(_0x4fc5bd,_0xeb4be8,_0x5c86a3){if(_0x4fc5bd[_0x29af('0x3b')]){db['User']['find']({'where':{'id':_0x4fc5bd[_0x29af('0x3b')]['id']},'attributes':userAttributes})[_0x29af('0x3d')](function(_0x476ec0){if(!_0x476ec0){return _0xeb4be8['status'](0x194)['json']({'message':_0x29af('0x59')});}_0x4fc5bd[_0x29af('0x3b')]=_0x476ec0;_0x5c86a3();})[_0x29af('0x43')](function(_0x19f826){_0x5c86a3(_0x19f826);});}else if(_0x33fc6d){_0x5c86a3();}else{return _0xeb4be8[_0x29af('0x47')](0x194)[_0x29af('0x40')]({'message':_0x29af('0x5a')});}});};exports[_0x29af('0x5b')]=function canUpdate(){return compose()[_0x29af('0x3a')](function(_0x3b22ed,_0x23f749,_0x57eb54){return licenseUtil['getLicense']()[_0x29af('0x3d')](function(_0x5590a3){if(_0x5590a3[_0x29af('0x5c')]){_0x57eb54();}else{return _0x23f749[_0x29af('0x47')](0x193)[_0x29af('0x40')]({'message':'Forbidden'});}})[_0x29af('0x43')](function(_0x381b18){_0x57eb54(_0x381b18);});});};exports[_0x29af('0x5d')]=function isWebrtcLicence(){return compose()['use'](function(_0x2d7bc4,_0x38d2da,_0xfd857f){return licenseUtil[_0x29af('0x5e')]()[_0x29af('0x3d')](function(_0x31b0ee){if(_0x31b0ee['webrtc']){_0xfd857f();}else{return _0x38d2da['status'](0x193)[_0x29af('0x40')]({'message':'Forbidden'});}})['catch'](function(_0x25f08c){_0xfd857f(_0x25f08c);});});};exports[_0x29af('0x5f')]=function(_0x52143d,_0x42b40c,_0x116bff){_0x52143d['isMiddleware']=!![];return _0x116bff();};exports['signToken']=function signToken(_0xa5b092){return signJwt(_0xa5b092);};exports[_0x29af('0x60')]=function(_0x2e1fa5,_0x1f8cb4){if(!_0x2e1fa5[_0x29af('0x3b')]){return _0x1f8cb4['status'](0x194)[_0x29af('0x40')]({'message':_0x29af('0x61')});}var _0xe69487={'payload':{'id':_0x2e1fa5[_0x29af('0x3b')]['id'],'role':_0x2e1fa5[_0x29af('0x3b')][_0x29af('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0xe69487)[_0x29af('0x3d')](function(_0x481192){_0x1f8cb4['cookie'](_0x29af('0x62'),_0x481192);_0x1f8cb4[_0x29af('0x63')](_0x29af('0x64'));})['catch'](function(_0x51b121){return _0x1f8cb4[_0x29af('0x47')](0x1f4)[_0x29af('0x65')](_0x51b121);});};exports[_0x29af('0x66')]=function(_0x2683e6){if(_[_0x29af('0x67')](_0x2683e6[_0x29af('0x51')])||_[_0x29af('0x67')](_0x2683e6[_0x29af('0x68')])){return null;}else{return createJwt(_0x2683e6);}};exports[_0x29af('0x69')]=function(_0x5dab4d){_0x5dab4d[_0x29af('0x51')]=generateNonce();_0x5dab4d['apiKeyIat']=generateIssuedAt();return createJwt(_0x5dab4d);};exports[_0x29af('0x6a')]=function(_0x31bed7,_0x408bfa){var _0x4734aa=_0x31bed7['query']['apikey'];if(_0x4734aa){var _0x510eac={'nonce':_0x408bfa[_0x29af('0x51')],'iat':_0x408bfa['apiKeyIat'],'audience':hardwareConf[_0x29af('0x4c')](),'issuer':hardwareConf[_0x29af('0x4c')]()};return verifyJwt(_0x4734aa,_0x510eac)[_0x29af('0x3d')](function(){return generateApiKey(_0x408bfa);});}else{throw{'message':_0x29af('0x6b')};}};exports['validatePasswordPattern']=function(_0x2dd0d1){var _0x4dbdbe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4dbdbe[_0x29af('0x6c')](_0x2dd0d1))throw new db[(_0x29af('0x6d'))]['ValidationError'](_0x29af('0x6e'));return;};exports['validatePasswordHistory']=function(_0x3b0357,_0x28f485,_0x3e983c){var _0x69fd7d=encryptor[_0x29af('0x6f')](_0x28f485)[_0x29af('0x70')](',');for(var _0x1bde33=0x0;_0x1bde33<_0x3e983c;_0x1bde33++){if(!_0x69fd7d[_0x1bde33])break;if(_0x3b0357[_0x29af('0x71')]()===_0x69fd7d[_0x1bde33][_0x29af('0x71')]()){var _0x58cc62=util[_0x29af('0x72')](_0x29af('0x73'),_0x3e983c);if(_0x3e983c===0x1){_0x58cc62=_0x29af('0x74');}throw new db[(_0x29af('0x6d'))][(_0x29af('0x75'))](_0x58cc62);}}return;};exports[_0x29af('0x76')]=function(_0x1e0d3d,_0x3e4f7e){var _0x1f6223=_0x3e4f7e?encryptor[_0x29af('0x6f')](_0x3e4f7e)[_0x29af('0x70')](','):[];if(_0x1f6223[_0x29af('0x77')]===0x5){_0x1f6223[_0x29af('0x78')](-0x1,0x1);}_0x1f6223[_0x29af('0x79')](_0x1e0d3d);return encryptor[_0x29af('0x7a')](_0x1f6223['join'](','));};function signJwt(_0x445331){var _0x4210f3=BPromise[_0x29af('0x7b')](jwt[_0x29af('0x7c')],{'context':jwt});var _0x166446=_0x445331[_0x29af('0x7d')]||config[_0x29af('0x8')][_0x29af('0x7e')];return new BPromise(function(_0x1a412c,_0x3e8699){_0x4210f3(_0x445331[_0x29af('0x7f')],_0x166446,_0x445331['options'])[_0x29af('0x3d')](function(_0xb16bc9){_0x1a412c(_0xb16bc9);})[_0x29af('0x43')](function(_0x3ebe99){_0x3e8699(_0x3ebe99);});});}function verifyJwt(_0x261f1f,_0x10d591,_0x3c7abc){var _0x206c23=BPromise[_0x29af('0x7b')](jwt[_0x29af('0x80')],{'context':jwt});var _0x1ea758=_0x3c7abc||config[_0x29af('0x8')][_0x29af('0x7e')];return new BPromise(function(_0x9444d7,_0x3de113){_0x206c23(_0x261f1f,_0x1ea758,_0x10d591)[_0x29af('0x3d')](function(_0x4f7985){_0x9444d7(_0x4f7985);})[_0x29af('0x43')](function(_0x27599){_0x3de113(_0x27599);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x29af('0x81')](_0x29af('0x82'));}function generateIssuedAt(){return Math[_0x29af('0x83')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x286a02){var _0x5229a5={'payload':{'iat':_0x286a02[_0x29af('0x68')],'nonce':_0x286a02[_0x29af('0x51')]},'options':{'algorithm':_0x29af('0x84'),'subject':_0x286a02['id'][_0x29af('0x81')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x29af('0x4c')]()}};return signJwt(_0x5229a5)[_0x29af('0x3d')](function(_0x479ff9){return{'iat':_0x286a02[_0x29af('0x68')],'nonce':_0x286a02[_0x29af('0x51')],'token':_0x479ff9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 2333cdf..341cdd4 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 _0x7e18=['describe','CmContact','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','parseQueryParameters','then','where','default','fields','user','clause','skip','checkListsRestrictions','search','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x7e18,0x1ca));var _0x87e1=function(_0xb755e9,_0xb3212f){_0xb755e9=_0xb755e9-0x0;var _0x464533=_0x7e18[_0xb755e9];return _0x464533;};'use strict';var _=require(_0x87e1('0x0'));var sqlUtils=require(_0x87e1('0x1'));var db=require(_0x87e1('0x2'))['db'];exports['findAll']=function(_0x38e71b,_0x385757,_0x219513,_0x5460d1){var _0x47a944={'count':0x0,'rows':[]};var _0x4c0ffa=sqlUtils[_0x87e1('0x3')](_0x385757,_0x38e71b);if(_0x4c0ffa){return Promise[_0x87e1('0x4')](_0x47a944);}var _0x288fda=sqlUtils[_0x87e1('0x5')]();var _0x43a783={};var _0x5dec3d=![];var _0x273a34=![];return Promise['resolve']()['then'](function(){if(_0x38e71b['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x38e71b['search'],_0x5460d1);}else{return sqlUtils[_0x87e1('0x6')](_0x38e71b,_0x5460d1);}})[_0x87e1('0x7')](function(_0x33c270){_0x288fda[_0x87e1('0x8')](_0x33c270[_0x87e1('0x9')]);_0x288fda[_0x87e1('0x8')](_0x33c270[_0x87e1('0xa')]);_0x288fda[_0x87e1('0x8')](_0x33c270['filter']);_0x288fda[_0x87e1('0x8')](_0x33c270[_0x87e1('0xb')][_0x87e1('0xc')]);_0x43a783=_0x33c270['tags'];_0x273a34=_0x33c270['user'][_0x87e1('0xd')];return sqlUtils[_0x87e1('0xe')](_0x385757,_0x38e71b,_0x273a34);})[_0x87e1('0x7')](function(_0x48a476){_0x288fda[_0x87e1('0x8')](_0x48a476);var _0x30e713=_0x38e71b[_0x87e1('0xf')]?_0x43a783['ids']:_0x38e71b['tag'];_0x5dec3d=_0x30e713?!![]:![];return sqlUtils[_0x87e1('0x10')](_0x288fda,_0x30e713);})[_0x87e1('0x7')](function(_0x259c3d){_0x47a944['count']=_0x259c3d;if(_0x47a944[_0x87e1('0x11')]===0x0){return;}if(_0x38e71b[_0x87e1('0x12')]){_0x273a34=!![];}return sqlUtils[_0x87e1('0x13')](_0x288fda,_0x38e71b[_0x87e1('0xa')],_0x219513,_0x5dec3d,_0x43a783['clause'],_0x273a34);})[_0x87e1('0x7')](function(_0x13afd5){if(!_0x13afd5){return[];}return sqlUtils[_0x87e1('0x14')](_0x13afd5,_0x38e71b,_0x219513);})[_0x87e1('0x7')](function(_0x42fd2f){_0x47a944[_0x87e1('0x15')]=_0x42fd2f;return _0x47a944;})[_0x87e1('0x16')](function(_0x18bcb8){throw _0x18bcb8;});};exports[_0x87e1('0x17')]=function(){var _0x5ef5cc={};var _0x32065a=[];return db[_0x87e1('0x18')]['describe']()[_0x87e1('0x7')](function(_0x3bc86b){_0x5ef5cc=_0x3bc86b;var _0xa51980=Object[_0x87e1('0x19')](_0x5ef5cc)[_0x87e1('0x1a')](function(_0xdb8b4){return _[_0x87e1('0x1b')](_0xdb8b4,_0x87e1('0x1c'))?_0xdb8b4:undefined;});var _0x3711aa=_0xa51980[_0x87e1('0x1d')](function(_0x5309c1){return db[_0x87e1('0x1e')][_0x87e1('0x1f')]({'where':{'id':_0x5309c1[_0x87e1('0x20')](0x3)},'raw':!![]});});return Promise[_0x87e1('0x21')](_0x3711aa);})[_0x87e1('0x7')](function(_0x9d10bb){for(var _0x17c8be=0x0;_0x17c8be<_0x9d10bb[_0x87e1('0x22')];_0x17c8be++){if(_0x9d10bb[_0x17c8be]){var _0x1661df=_0x87e1('0x1c')+_0x9d10bb[_0x17c8be]['id'];_0x5ef5cc[_0x1661df][_0x87e1('0x23')]=_0x9d10bb[_0x17c8be][_0x87e1('0x24')];}}_0x32065a=_[_0x87e1('0x1d')](Object[_0x87e1('0x19')](_0x5ef5cc),function(_0xb28800){return{'name':_0xb28800,'type':_0x5ef5cc[_0xb28800][_0x87e1('0x24')]};});return _0x32065a;})[_0x87e1('0x16')](function(_0x3176d9){throw _0x3176d9;});}; \ No newline at end of file +var _0xa798=['../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseQueryParameters','then','where','default','fields','clause','tags','user','skip','checkListsRestrictions','tag','count','User','getFilteredContacts','rows','catch','CmContact','describe','keys','cf_','CmCustomField','slice','all','length','fieldType','type','lodash','./sql-utils'];(function(_0x22564a,_0x351dbb){var _0x54f93e=function(_0x47e471){while(--_0x47e471){_0x22564a['push'](_0x22564a['shift']());}};_0x54f93e(++_0x351dbb);}(_0xa798,0xec));var _0x8a79=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa798[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x8a79('0x0'));var sqlUtils=require(_0x8a79('0x1'));var db=require(_0x8a79('0x2'))['db'];exports[_0x8a79('0x3')]=function(_0x5865b1,_0x587965,_0x5b7e3f,_0x50b573){var _0x20b7d7={'count':0x0,'rows':[]};var _0xad4bde=sqlUtils[_0x8a79('0x4')](_0x587965,_0x5865b1);if(_0xad4bde){return Promise[_0x8a79('0x5')](_0x20b7d7);}var _0x3d85e5=sqlUtils[_0x8a79('0x6')]();var _0x5dead9={};var _0x40ce57=![];var _0x4eb009=![];return Promise[_0x8a79('0x5')]()['then'](function(){if(_0x5865b1[_0x8a79('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0x5865b1[_0x8a79('0x7')],_0x50b573);}else{return sqlUtils[_0x8a79('0x8')](_0x5865b1,_0x50b573);}})[_0x8a79('0x9')](function(_0x515233){_0x3d85e5[_0x8a79('0xa')](_0x515233[_0x8a79('0xb')]);_0x3d85e5[_0x8a79('0xa')](_0x515233[_0x8a79('0xc')]);_0x3d85e5[_0x8a79('0xa')](_0x515233['filter']);_0x3d85e5[_0x8a79('0xa')](_0x515233['user'][_0x8a79('0xd')]);_0x5dead9=_0x515233[_0x8a79('0xe')];_0x4eb009=_0x515233[_0x8a79('0xf')][_0x8a79('0x10')];return sqlUtils[_0x8a79('0x11')](_0x587965,_0x5865b1,_0x4eb009);})[_0x8a79('0x9')](function(_0x201f7d){_0x3d85e5[_0x8a79('0xa')](_0x201f7d);var _0x441960=_0x5865b1[_0x8a79('0x7')]?_0x5dead9['ids']:_0x5865b1[_0x8a79('0x12')];_0x40ce57=_0x441960?!![]:![];return sqlUtils['countFilteredContacts'](_0x3d85e5,_0x441960);})[_0x8a79('0x9')](function(_0xa6cffc){_0x20b7d7[_0x8a79('0x13')]=_0xa6cffc;if(_0x20b7d7[_0x8a79('0x13')]===0x0){return;}if(_0x5865b1[_0x8a79('0x14')]){_0x4eb009=!![];}return sqlUtils['buildContactsQuery'](_0x3d85e5,_0x5865b1[_0x8a79('0xc')],_0x5b7e3f,_0x40ce57,_0x5dead9[_0x8a79('0xd')],_0x4eb009);})[_0x8a79('0x9')](function(_0x41817c){if(!_0x41817c){return[];}return sqlUtils[_0x8a79('0x15')](_0x41817c,_0x5865b1,_0x5b7e3f);})['then'](function(_0x485fb5){_0x20b7d7[_0x8a79('0x16')]=_0x485fb5;return _0x20b7d7;})[_0x8a79('0x17')](function(_0x1161bc){throw _0x1161bc;});};exports['describe']=function(){var _0x3b8bae={};var _0x59a8d0=[];return db[_0x8a79('0x18')][_0x8a79('0x19')]()[_0x8a79('0x9')](function(_0x3454ea){_0x3b8bae=_0x3454ea;var _0x30699e=Object[_0x8a79('0x1a')](_0x3b8bae)['filter'](function(_0x5c12aa){return _['startsWith'](_0x5c12aa,_0x8a79('0x1b'))?_0x5c12aa:undefined;});var _0x1ac4c3=_0x30699e['map'](function(_0x19b5a5){return db[_0x8a79('0x1c')]['findOne']({'where':{'id':_0x19b5a5[_0x8a79('0x1d')](0x3)},'raw':!![]});});return Promise[_0x8a79('0x1e')](_0x1ac4c3);})[_0x8a79('0x9')](function(_0x23a334){for(var _0x320636=0x0;_0x320636<_0x23a334[_0x8a79('0x1f')];_0x320636++){if(_0x23a334[_0x320636]){var _0x1371f9=_0x8a79('0x1b')+_0x23a334[_0x320636]['id'];_0x3b8bae[_0x1371f9][_0x8a79('0x20')]=_0x23a334[_0x320636][_0x8a79('0x21')];}}_0x59a8d0=_['map'](Object[_0x8a79('0x1a')](_0x3b8bae),function(_0x223f0e){return{'name':_0x223f0e,'type':_0x3b8bae[_0x223f0e][_0x8a79('0x21')]};});return _0x59a8d0;})[_0x8a79('0x17')](function(_0x467a34){throw _0x467a34;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 7d05fc3..eb88ed6 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 _0xf8b1=['end','Tag','tags','clause','and','User','user','uc.UserId\x20=\x20?','keys','map','some','Contact','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','agent','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','COUNT(*)','isEmpty','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','select','cm_contacts','where','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','left_join','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','updatedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','castTo','DATE','buildExpression','type','text','value'];(function(_0x8e34d4,_0x52db87){var _0x33b595=function(_0x37300c){while(--_0x37300c){_0x8e34d4['push'](_0x8e34d4['shift']());}};_0x33b595(++_0x52db87);}(_0xf8b1,0x10d));var _0x1f8b=function(_0x1e3bd3,_0x380bf2){_0x1e3bd3=_0x1e3bd3-0x0;var _0x110df1=_0xf8b1[_0x1e3bd3];return _0x110df1;};'use strict';var _=require(_0x1f8b('0x0'));var squel=require(_0x1f8b('0x1'));var as=require(_0x1f8b('0x2'));var qs=require(_0x1f8b('0x3'));var utils=require(_0x1f8b('0x4'));var db=require(_0x1f8b('0x5'))['db'];function skipContactsQuery(_0x190fb9,_0x17037f){var _0x2bdf5e=![];if(_0x190fb9[_0x1f8b('0x6')]==='agent'&&!_0x17037f[_0x1f8b('0x7')]&&!_0x17037f[_0x1f8b('0x8')]&&_0x17037f[_0x1f8b('0x9')]!==_0x1f8b('0xa')){_0x2bdf5e=!![];}return _0x2bdf5e;}function getContactsSubquery(){return squel[_0x1f8b('0xb')]()['from'](_0x1f8b('0xc'),'c')[_0x1f8b('0xd')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x53bdd0,_0x367ad1){var _0x361faa=_0x367ad1?'c':_0x1f8b('0xe');_0x53bdd0['left_join'](_0x1f8b('0xf'),'uc',_0x1f8b('0x10')+_0x361faa+_0x1f8b('0x11'))['left_join']('cm_contact_has_tags','ct',_0x1f8b('0x12')+_0x361faa+_0x1f8b('0x11'))[_0x1f8b('0x13')](_0x1f8b('0x14'),'t',_0x1f8b('0x15'));return _0x53bdd0;}function addFieldsToQuery(_0x5d5a2a,_0x1f8153,_0xc1b3da,_0x2a7632,_0x2ff3c5){var _0x468082=_0x2ff3c5?'c':_0x1f8b('0xe');if(!_0x1f8153){_0x1f8153=['id',_0x1f8b('0x16'),_0x1f8b('0x17'),_0x1f8b('0x18'),_0x1f8b('0x19'),_0x1f8b('0x1a'),'email',_0x1f8b('0x8'),_0x1f8b('0x1b'),'createdAt',_0x1f8b('0x1c'),'deletedAt',_0x1f8b('0x1d')];}else if(!_0x1f8153[_0x1f8b('0x1e')]('id')){_0x1f8153[_0x1f8b('0x1f')]('id');}var _0x1f7255=_0xc1b3da&&_0x2ff3c5||!_0xc1b3da&&!_0x2ff3c5;if(_0x2a7632){_0x1f7255=_0x2a7632&&_0x2ff3c5||!_0x2a7632&&!_0x2ff3c5;}_0x1f8153[_0x1f8b('0x20')](function(_0x4937c7){if(_0x4937c7==='TagIds'){if(_0x1f7255){_0x5d5a2a['field'](_0x1f8b('0x21'),_0x4937c7);}else if(_0xc1b3da||_0x2a7632){_0x5d5a2a['field'](_0x468082+'.'+_0x4937c7);}}else{_0x5d5a2a[_0x1f8b('0x22')](_0x468082+'.'+_0x4937c7);}});return _0x5d5a2a;}function getSqlClauses(){var _0x2daa6a={'default':squel[_0x1f8b('0x23')](),'fields':squel[_0x1f8b('0x23')](),'filter':squel[_0x1f8b('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x2daa6a;}function parseTagParameter(_0x402a42){var _0x13f08d=squel[_0x1f8b('0x23')]();if(_0x402a42){var _0x4277f2=utils[_0x1f8b('0x24')](_0x402a42);_0x4277f2[_0x1f8b('0x20')](function(_0x3638d2){_0x13f08d['or'](_0x1f8b('0x25'),'%,'+_0x3638d2+',%');});}return _0x13f08d;}function parseSearchFilter(_0x23ba8d){var _0x15ace2=squel[_0x1f8b('0x23')]();if(_0x23ba8d){var _0xbb8f4a=_0x23ba8d[_0x1f8b('0x26')]('\x5c','\x5c\x5c')[_0x1f8b('0x26')](/'/g,'\x27\x27');if(_0xbb8f4a[_0x1f8b('0x27')]('\x20')[_0x1f8b('0x28')]>0x1){_0x15ace2['or'](_0x1f8b('0x29'),qs[_0x1f8b('0x2a')](_0xbb8f4a,!![]),null);}else{if(qs[_0x1f8b('0x2b')](_0xbb8f4a)){_0x15ace2['or'](_0x1f8b('0x2c'),_0xbb8f4a+'%');_0x15ace2['or'](_0x1f8b('0x2d'),_0xbb8f4a+'%');_0x15ace2['or'](_0x1f8b('0x2e'),_0xbb8f4a+'%');_0x15ace2['or']('c.fax\x20LIKE\x20?',_0xbb8f4a+'%');}else if(qs[_0x1f8b('0x2f')](_0xbb8f4a)){_0x15ace2['or'](_0x1f8b('0x30'),_0xbb8f4a+'%');}else{_0x15ace2['or'](_0x1f8b('0x31'),'%'+_0xbb8f4a+'%');_0x15ace2['or'](_0x1f8b('0x32'),'%'+_0xbb8f4a+'%');_0x15ace2['or'](_0x1f8b('0x30'),'%'+_0xbb8f4a+'%');}}}return _0x15ace2;}function parseAdvancedSearchFilter(_0x27c078,_0x36537d){var _0x516f56=getSqlClauses();var _0x3bfe93=as[_0x1f8b('0x33')](_0x27c078);var _0x259a5b=_0x3bfe93[_0x1f8b('0x34')];for(var _0x52280e=0x0;_0x52280e<_0x3bfe93[_0x1f8b('0x35')][_0x1f8b('0x28')];_0x52280e++){var _0x5ada0e=_0x3bfe93['conditions'][_0x52280e];var _0x2a4e88='c';var _0x4bf180=_[_0x1f8b('0x36')](_0x36537d,[_0x1f8b('0x37'),_0x5ada0e[_0x1f8b('0x22')]]);if(_0x4bf180){if(_0x5ada0e[_0x1f8b('0x22')]===_0x1f8b('0x38')||_0x4bf180[_0x1f8b('0x39')]==='datetime'){_0x5ada0e[_0x1f8b('0x3a')]=_0x1f8b('0x3b');}var _0x203366=as[_0x1f8b('0x3c')](_0x2a4e88,_0x4bf180[_0x1f8b('0x3d')],_0x5ada0e);_0x516f56['default'][_0x259a5b](_0x203366[_0x1f8b('0x3e')],_0x203366[_0x1f8b('0x3f')]['start'],_0x203366['value'][_0x1f8b('0x40')]);}else{if(_0x5ada0e[_0x1f8b('0x22')]===_0x1f8b('0x41')){var _0x136ad5=_0x5ada0e[_0x1f8b('0x3f')]['split'](',')['map'](function(_0x141a73){return Number(_0x141a73);});var _0x48188b=parseTagParameter(_0x136ad5);_0x516f56[_0x1f8b('0x42')][_0x1f8b('0x43')][_0x1f8b('0x44')](_0x48188b);_0x516f56['tags']['ids']=_0x136ad5;}else if(_0x5ada0e[_0x1f8b('0x22')]===_0x1f8b('0x45')){_0x516f56[_0x1f8b('0x46')]['clause'][_0x1f8b('0x44')](_0x1f8b('0x47'),_0x5ada0e[_0x1f8b('0x3f')]);_0x516f56[_0x1f8b('0x46')]['skip']=!![];}}}return _0x516f56;}function parseModelFields(_0x308da9,_0x3e22e9){var _0xd52aca=squel[_0x1f8b('0x23')]();var _0x1864ab=_(_0x308da9)[_0x1f8b('0x48')]()[_0x1f8b('0x49')](function(_0x223530){return _[_0x1f8b('0x4a')](_0x3e22e9,[_0x1f8b('0x37'),_0x223530])?_0x223530:undefined;})['compact']()['value']();if(_0x308da9[_0x1f8b('0x4b')]){_0x1864ab[_0x1f8b('0x1f')](_0x1f8b('0x4b'));}if(_0x308da9[_0x1f8b('0x45')]){_0x1864ab['push'](_0x1f8b('0x45'));}if(_0x1864ab[_0x1f8b('0x28')]>0x0){_0x1864ab['forEach'](function(_0x2ab2aa){if(_0x2ab2aa===_0x1f8b('0x8')){_0xd52aca['and'](_0x1f8b('0x4c'),[][_0x1f8b('0x4d')](_0x308da9[_0x2ab2aa]));}else if(_0x2ab2aa===_0x1f8b('0x4b')){var _0x441bef='%'+_0x308da9[_0x2ab2aa]+'%';_0xd52aca[_0x1f8b('0x44')](_0x1f8b('0x4e'),_0x441bef);}else if(_0x2ab2aa===_0x1f8b('0x45')){_0xd52aca[_0x1f8b('0x44')](_0x1f8b('0x47'),_0x308da9[_0x2ab2aa]);}else{_0xd52aca[_0x1f8b('0x44')]('c.'+_0x2ab2aa+_0x1f8b('0x4f'),_0x308da9[_0x2ab2aa]);}});}return _0xd52aca;}function parseQueryParameters(_0x1b3928,_0x1b05e0){var _0x21e3b2=getSqlClauses();return Promise[_0x1f8b('0x50')]()[_0x1f8b('0x51')](function(){return parseModelFields(_0x1b3928,_0x1b05e0);})[_0x1f8b('0x51')](function(_0xa915c1){_0x21e3b2[_0x1f8b('0x52')][_0x1f8b('0x44')](_0xa915c1);return parseTagParameter(_0x1b3928[_0x1f8b('0x53')]);})['then'](function(_0x3dee25){_0x21e3b2['tags']['clause'][_0x1f8b('0x44')](_0x3dee25);return parseSearchFilter(_0x1b3928[_0x1f8b('0x54')]);})[_0x1f8b('0x51')](function(_0x539858){_0x21e3b2[_0x1f8b('0x54')]=_0x539858;return _0x21e3b2;});}function checkListsRestrictions(_0x4c02f4,_0xa9de1e,_0x31c34b){var _0x3c965a=squel[_0x1f8b('0x23')]();return Promise[_0x1f8b('0x50')]()[_0x1f8b('0x51')](function(){if(_0xa9de1e['search']&&_0x4c02f4['role']===_0x1f8b('0x55')&&!_0x31c34b){return _0x4c02f4['getLists']({'attributes':['id'],'raw':!![]});}})[_0x1f8b('0x51')](function(_0x29cb7b){if(_0x29cb7b){if(_0x29cb7b[_0x1f8b('0x28')]===0x0){_0x3c965a['and'](_0x1f8b('0x56'));}else{_0x3c965a['and'](_0x1f8b('0x4c'),_[_0x1f8b('0x49')](_0x29cb7b,'id'));}}})[_0x1f8b('0x51')](function(){return _0x3c965a;});}function buildContactsQuery(_0x1ff325,_0x1b8a06,_0x43a79b,_0x2b7780,_0x312780,_0x1ae205){if(_0x1b8a06){_0x1b8a06=_0x43a79b[_0x1f8b('0x57')];}_0x1ff325=addFieldsToQuery(_0x1ff325,_0x1b8a06,_0x2b7780,_0x1ae205,!![]);var _0x97ccc5=squel[_0x1f8b('0xb')]();_0x97ccc5=addFieldsToQuery(_0x97ccc5,_0x1b8a06,_0x2b7780,_0x1ae205,![]);if(_0x2b7780||_0x1ae205){_0x1ff325=applyJoinClauses(_0x1ff325,!![]);_0x1ff325[_0x1f8b('0x58')](_0x1f8b('0x59'));if(_0x43a79b[_0x1f8b('0x5a')]){_0x97ccc5[_0x1f8b('0x5a')](_0x43a79b['limit']);}if(_0x43a79b[_0x1f8b('0x5b')]){_0x97ccc5[_0x1f8b('0x5b')](_0x43a79b[_0x1f8b('0x5b')]);}}else{_0x97ccc5=applyJoinClauses(_0x97ccc5,![]);_0x97ccc5[_0x1f8b('0x58')](_0x1f8b('0x5c'));if(_0x43a79b[_0x1f8b('0x5a')]){_0x1ff325[_0x1f8b('0x5a')](_0x43a79b['limit']);}if(_0x43a79b[_0x1f8b('0x5b')]){_0x1ff325[_0x1f8b('0x5b')](_0x43a79b[_0x1f8b('0x5b')]);}}_0x97ccc5['having'](_0x312780);if(_0x43a79b['order']){_0x43a79b[_0x1f8b('0x5d')][_0x1f8b('0x20')](function(_0x583bb9){_0x1ff325[_0x1f8b('0x5d')]('c.'+_0x583bb9[0x0],_0x583bb9[0x1]===_0x1f8b('0x5e')?![]:!![]);_0x97ccc5['order'](_0x1f8b('0x5f')+_0x583bb9[0x0],_0x583bb9[0x1]===_0x1f8b('0x5e')?![]:!![]);});}_0x97ccc5[_0x1f8b('0x60')](_0x1ff325,'subqry');return _0x97ccc5;}function getFilteredContacts(_0x17ecba){var _0x1c07d5=[];return db['Tag'][_0x1f8b('0x61')]({'attributes':['id',_0x1f8b('0x37'),_0x1f8b('0x62')],'raw':!![]})[_0x1f8b('0x51')](function(_0x39b0cb){_0x1c07d5=_[_0x1f8b('0x63')](_0x39b0cb,'id');var _0x5cd49c={'type':db[_0x1f8b('0x64')][_0x1f8b('0x65')][_0x1f8b('0x66')],'model':db[_0x1f8b('0x67')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x1f8b('0x68')][_0x1f8b('0x69')](_0x17ecba[_0x1f8b('0x6a')](),_0x5cd49c);})['then'](function(_0x34e37d){_0x34e37d[_0x1f8b('0x20')](function(_0x11a545){if(_0x11a545[_0x1f8b('0x1d')]){_0x11a545[_0x1f8b('0x6b')]=[];_0x11a545[_0x1f8b('0x1d')][_0x1f8b('0x27')](',')['forEach'](function(_0x32007e){_0x11a545[_0x1f8b('0x6b')][_0x1f8b('0x1f')](_0x1c07d5[_0x32007e]);});}delete _0x11a545[_0x1f8b('0x1d')];});return _0x34e37d;});}function countFilteredContacts(_0x1efc56,_0xa6279a){var _0x4e1809=_0x1efc56['clone']();_0x4e1809[_0x1f8b('0x22')](_0x1f8b('0x6c'));_0x4e1809=applyJoinClauses(_0x4e1809,!![]);_0x1efc56[_0x1f8b('0x58')]('c.id');var _0x25c367=utils[_0x1f8b('0x24')](_0xa6279a);if(!_[_0x1f8b('0x6d')](_0x25c367)){_0x4e1809[_0x1f8b('0xd')]('t.id\x20IN\x20?',_0x25c367);}var _0x16176f={'type':db[_0x1f8b('0x64')]['QueryTypes'][_0x1f8b('0x66')],'raw':!![]};return db[_0x1f8b('0x68')][_0x1f8b('0x69')](_0x4e1809[_0x1f8b('0x6a')](),_0x16176f)[_0x1f8b('0x51')](function(_0x50b17a){return _0x50b17a[0x0][_0x1f8b('0x6c')];});}module[_0x1f8b('0x6e')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x7a40=['agent','ListId','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','default','text','value','start','end','Tag','tags','clause','ids','User','user','and','uc.UserId\x20=\x20?','skip','keys','some','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','c.ListId\x20IS\x20NULL','map','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','subqry','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','t.id\x20IN\x20?','SELECT','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0x7a40,0xd1));var _0x07a4=function(_0xe9eee3,_0x216e28){_0xe9eee3=_0xe9eee3-0x0;var _0x3136ad=_0x7a40[_0xe9eee3];return _0x3136ad;};'use strict';var _=require('lodash');var squel=require(_0x07a4('0x0'));var as=require(_0x07a4('0x1'));var qs=require(_0x07a4('0x2'));var utils=require(_0x07a4('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x44d4a1,_0x517d89){var _0x49691e=![];if(_0x44d4a1[_0x07a4('0x4')]===_0x07a4('0x5')&&!_0x517d89['search']&&!_0x517d89[_0x07a4('0x6')]&&_0x517d89['autocomplete']!==_0x07a4('0x7')){_0x49691e=!![];}return _0x49691e;}function getContactsSubquery(){return squel[_0x07a4('0x8')]()[_0x07a4('0x9')](_0x07a4('0xa'),'c')[_0x07a4('0xb')](_0x07a4('0xc'));}function applyJoinClauses(_0x152dd8,_0x1a393b){var _0x3488fe=_0x1a393b?'c':'subqry';_0x152dd8[_0x07a4('0xd')](_0x07a4('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x3488fe+_0x07a4('0xf'))[_0x07a4('0xd')](_0x07a4('0x10'),'ct','ct.CmContactId\x20=\x20'+_0x3488fe+_0x07a4('0xf'))[_0x07a4('0xd')](_0x07a4('0x11'),'t',_0x07a4('0x12'));return _0x152dd8;}function addFieldsToQuery(_0x857630,_0x5bedb0,_0x407d25,_0x3dec75,_0x52160a){var _0x473f91=_0x52160a?'c':'subqry';if(!_0x5bedb0){_0x5bedb0=['id','firstName','lastName',_0x07a4('0x13'),_0x07a4('0x14'),'fax',_0x07a4('0x15'),_0x07a4('0x6'),_0x07a4('0x16'),_0x07a4('0x17'),_0x07a4('0x18'),_0x07a4('0x19'),_0x07a4('0x1a')];}else if(!_0x5bedb0['includes']('id')){_0x5bedb0[_0x07a4('0x1b')]('id');}var _0x2acf8c=_0x407d25&&_0x52160a||!_0x407d25&&!_0x52160a;if(_0x3dec75){_0x2acf8c=_0x3dec75&&_0x52160a||!_0x3dec75&&!_0x52160a;}_0x5bedb0[_0x07a4('0x1c')](function(_0x53ef1d){if(_0x53ef1d===_0x07a4('0x1a')){if(_0x2acf8c){_0x857630[_0x07a4('0x1d')](_0x07a4('0x1e'),_0x53ef1d);}else if(_0x407d25||_0x3dec75){_0x857630[_0x07a4('0x1d')](_0x473f91+'.'+_0x53ef1d);}}else{_0x857630['field'](_0x473f91+'.'+_0x53ef1d);}});return _0x857630;}function getSqlClauses(){var _0xcd9d93={'default':squel['expr'](),'fields':squel[_0x07a4('0x1f')](),'filter':squel[_0x07a4('0x1f')](),'tags':{'clause':squel[_0x07a4('0x1f')](),'ids':null},'user':{'clause':squel[_0x07a4('0x1f')](),'skip':![]}};return _0xcd9d93;}function parseTagParameter(_0xacc1b5){var _0x47e39c=squel[_0x07a4('0x1f')]();if(_0xacc1b5){var _0x37a8ca=utils[_0x07a4('0x20')](_0xacc1b5);_0x37a8ca[_0x07a4('0x1c')](function(_0x493ebb){_0x47e39c['or'](_0x07a4('0x21'),'%,'+_0x493ebb+',%');});}return _0x47e39c;}function parseSearchFilter(_0x305e53){var _0x4d4f1d=squel[_0x07a4('0x1f')]();if(_0x305e53){var _0x38daa3=_0x305e53[_0x07a4('0x22')]('\x5c','\x5c\x5c')[_0x07a4('0x22')](/'/g,'\x27\x27');if(_0x38daa3[_0x07a4('0x23')]('\x20')[_0x07a4('0x24')]>0x1){_0x4d4f1d['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x07a4('0x25')](_0x38daa3,!![]),null);}else{if(qs[_0x07a4('0x26')](_0x38daa3)){_0x4d4f1d['or'](_0x07a4('0x27'),_0x38daa3+'%');_0x4d4f1d['or'](_0x07a4('0x28'),_0x38daa3+'%');_0x4d4f1d['or']('c.mobile\x20LIKE\x20?',_0x38daa3+'%');_0x4d4f1d['or'](_0x07a4('0x29'),_0x38daa3+'%');}else if(qs[_0x07a4('0x2a')](_0x38daa3)){_0x4d4f1d['or'](_0x07a4('0x2b'),_0x38daa3+'%');}else{_0x4d4f1d['or']('c.firstName\x20LIKE\x20?','%'+_0x38daa3+'%');_0x4d4f1d['or'](_0x07a4('0x2c'),'%'+_0x38daa3+'%');_0x4d4f1d['or']('c.email\x20LIKE\x20?','%'+_0x38daa3+'%');}}}return _0x4d4f1d;}function parseAdvancedSearchFilter(_0x3070e7,_0x31a456){var _0x409d7f=getSqlClauses();var _0x5c4997=as[_0x07a4('0x2d')](_0x3070e7);var _0x3b6c5d=_0x5c4997[_0x07a4('0x2e')];for(var _0x20ec78=0x0;_0x20ec78<_0x5c4997[_0x07a4('0x2f')]['length'];_0x20ec78++){var _0xfb0228=_0x5c4997['conditions'][_0x20ec78];var _0x15a8da='c';var _0x37d90f=_['find'](_0x31a456,[_0x07a4('0x30'),_0xfb0228[_0x07a4('0x1d')]]);if(_0x37d90f){if(_0xfb0228[_0x07a4('0x1d')]===_0x07a4('0x31')||_0x37d90f[_0x07a4('0x32')]===_0x07a4('0x33')){_0xfb0228[_0x07a4('0x34')]=_0x07a4('0x35');}var _0x7875be=as[_0x07a4('0x36')](_0x15a8da,_0x37d90f['type'],_0xfb0228);_0x409d7f[_0x07a4('0x37')][_0x3b6c5d](_0x7875be[_0x07a4('0x38')],_0x7875be[_0x07a4('0x39')][_0x07a4('0x3a')],_0x7875be[_0x07a4('0x39')][_0x07a4('0x3b')]);}else{if(_0xfb0228[_0x07a4('0x1d')]===_0x07a4('0x3c')){var _0x4ccf38=_0xfb0228[_0x07a4('0x39')]['split'](',')['map'](function(_0x24b92c){return Number(_0x24b92c);});var _0x440267=parseTagParameter(_0x4ccf38);_0x409d7f[_0x07a4('0x3d')][_0x07a4('0x3e')]['and'](_0x440267);_0x409d7f[_0x07a4('0x3d')][_0x07a4('0x3f')]=_0x4ccf38;}else if(_0xfb0228['field']===_0x07a4('0x40')){_0x409d7f[_0x07a4('0x41')][_0x07a4('0x3e')][_0x07a4('0x42')](_0x07a4('0x43'),_0xfb0228[_0x07a4('0x39')]);_0x409d7f[_0x07a4('0x41')][_0x07a4('0x44')]=!![];}}}return _0x409d7f;}function parseModelFields(_0x45fbc7,_0x2aa6a2){var _0x35cba8=squel[_0x07a4('0x1f')]();var _0x4c3a4f=_(_0x45fbc7)[_0x07a4('0x45')]()['map'](function(_0x1ff30b){return _[_0x07a4('0x46')](_0x2aa6a2,[_0x07a4('0x30'),_0x1ff30b])?_0x1ff30b:undefined;})['compact']()[_0x07a4('0x39')]();if(_0x45fbc7[_0x07a4('0x47')]){_0x4c3a4f[_0x07a4('0x1b')](_0x07a4('0x47'));}if(_0x45fbc7[_0x07a4('0x40')]){_0x4c3a4f[_0x07a4('0x1b')](_0x07a4('0x40'));}if(_0x4c3a4f[_0x07a4('0x24')]>0x0){_0x4c3a4f[_0x07a4('0x1c')](function(_0x27e4e8){if(_0x27e4e8==='ListId'){_0x35cba8['and']('c.ListId\x20IN\x20?',[][_0x07a4('0x48')](_0x45fbc7[_0x27e4e8]));}else if(_0x27e4e8===_0x07a4('0x47')){var _0x1ef1a5='%'+_0x45fbc7[_0x27e4e8]+'%';_0x35cba8[_0x07a4('0x42')](_0x07a4('0x49'),_0x1ef1a5);}else if(_0x27e4e8===_0x07a4('0x40')){_0x35cba8['and'](_0x07a4('0x43'),_0x45fbc7[_0x27e4e8]);}else{_0x35cba8[_0x07a4('0x42')]('c.'+_0x27e4e8+_0x07a4('0x4a'),_0x45fbc7[_0x27e4e8]);}});}return _0x35cba8;}function parseQueryParameters(_0x3749b3,_0x2dc7b2){var _0x3f5952=getSqlClauses();return Promise[_0x07a4('0x4b')]()['then'](function(){return parseModelFields(_0x3749b3,_0x2dc7b2);})[_0x07a4('0x4c')](function(_0x52cc88){_0x3f5952[_0x07a4('0x4d')][_0x07a4('0x42')](_0x52cc88);return parseTagParameter(_0x3749b3[_0x07a4('0x4e')]);})[_0x07a4('0x4c')](function(_0x44c73f){_0x3f5952['tags'][_0x07a4('0x3e')][_0x07a4('0x42')](_0x44c73f);return parseSearchFilter(_0x3749b3[_0x07a4('0x4f')]);})[_0x07a4('0x4c')](function(_0x52ab76){_0x3f5952[_0x07a4('0x4f')]=_0x52ab76;return _0x3f5952;});}function checkListsRestrictions(_0x618bec,_0x5add55,_0x58c391){var _0x9f4bc9=squel[_0x07a4('0x1f')]();return Promise[_0x07a4('0x4b')]()[_0x07a4('0x4c')](function(){if(_0x5add55['search']&&_0x618bec[_0x07a4('0x4')]===_0x07a4('0x5')&&!_0x58c391){return _0x618bec['getLists']({'attributes':['id'],'raw':!![]});}})[_0x07a4('0x4c')](function(_0x34d31a){if(_0x34d31a){if(_0x34d31a[_0x07a4('0x24')]===0x0){_0x9f4bc9[_0x07a4('0x42')](_0x07a4('0x50'));}else{_0x9f4bc9[_0x07a4('0x42')]('c.ListId\x20IN\x20?',_[_0x07a4('0x51')](_0x34d31a,'id'));}}})[_0x07a4('0x4c')](function(){return _0x9f4bc9;});}function buildContactsQuery(_0x5a5ba9,_0x25b976,_0xe2f9b6,_0x57ada,_0x4ed5db,_0x9c7382){if(_0x25b976){_0x25b976=_0xe2f9b6[_0x07a4('0x52')];}_0x5a5ba9=addFieldsToQuery(_0x5a5ba9,_0x25b976,_0x57ada,_0x9c7382,!![]);var _0x19e375=squel[_0x07a4('0x8')]();_0x19e375=addFieldsToQuery(_0x19e375,_0x25b976,_0x57ada,_0x9c7382,![]);if(_0x57ada||_0x9c7382){_0x5a5ba9=applyJoinClauses(_0x5a5ba9,!![]);_0x5a5ba9[_0x07a4('0x53')](_0x07a4('0x54'));if(_0xe2f9b6[_0x07a4('0x55')]){_0x19e375[_0x07a4('0x55')](_0xe2f9b6['limit']);}if(_0xe2f9b6[_0x07a4('0x56')]){_0x19e375['offset'](_0xe2f9b6[_0x07a4('0x56')]);}}else{_0x19e375=applyJoinClauses(_0x19e375,![]);_0x19e375['group'](_0x07a4('0x57'));if(_0xe2f9b6[_0x07a4('0x55')]){_0x5a5ba9[_0x07a4('0x55')](_0xe2f9b6[_0x07a4('0x55')]);}if(_0xe2f9b6[_0x07a4('0x56')]){_0x5a5ba9[_0x07a4('0x56')](_0xe2f9b6[_0x07a4('0x56')]);}}_0x19e375[_0x07a4('0x58')](_0x4ed5db);if(_0xe2f9b6['order']){_0xe2f9b6['order'][_0x07a4('0x1c')](function(_0x4178f5){_0x5a5ba9[_0x07a4('0x59')]('c.'+_0x4178f5[0x0],_0x4178f5[0x1]===_0x07a4('0x5a')?![]:!![]);_0x19e375[_0x07a4('0x59')](_0x07a4('0x5b')+_0x4178f5[0x0],_0x4178f5[0x1]===_0x07a4('0x5a')?![]:!![]);});}_0x19e375['from'](_0x5a5ba9,_0x07a4('0x5c'));return _0x19e375;}function getFilteredContacts(_0x190146){var _0x343332=[];return db['Tag']['findAll']({'attributes':['id',_0x07a4('0x30'),_0x07a4('0x5d')],'raw':!![]})[_0x07a4('0x4c')](function(_0x28eba3){_0x343332=_[_0x07a4('0x5e')](_0x28eba3,'id');var _0x384c0e={'type':db[_0x07a4('0x5f')][_0x07a4('0x60')]['SELECT'],'model':db[_0x07a4('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x07a4('0x62')][_0x07a4('0x63')](_0x190146[_0x07a4('0x64')](),_0x384c0e);})[_0x07a4('0x4c')](function(_0x55d314){_0x55d314[_0x07a4('0x1c')](function(_0x5005c9){if(_0x5005c9[_0x07a4('0x1a')]){_0x5005c9[_0x07a4('0x65')]=[];_0x5005c9['TagIds'][_0x07a4('0x23')](',')['forEach'](function(_0x595e2a){_0x5005c9[_0x07a4('0x65')][_0x07a4('0x1b')](_0x343332[_0x595e2a]);});}delete _0x5005c9[_0x07a4('0x1a')];});return _0x55d314;});}function countFilteredContacts(_0x1c8db7,_0x5e67dc){var _0x132e9f=_0x1c8db7[_0x07a4('0x66')]();_0x132e9f[_0x07a4('0x1d')](_0x07a4('0x67'));_0x132e9f=applyJoinClauses(_0x132e9f,!![]);_0x1c8db7['group'](_0x07a4('0x54'));var _0x1fad67=utils[_0x07a4('0x20')](_0x5e67dc);if(!_['isEmpty'](_0x1fad67)){_0x132e9f['where'](_0x07a4('0x68'),_0x1fad67);}var _0x1659eb={'type':db[_0x07a4('0x5f')][_0x07a4('0x60')][_0x07a4('0x69')],'raw':!![]};return db[_0x07a4('0x62')][_0x07a4('0x63')](_0x132e9f[_0x07a4('0x64')](),_0x1659eb)[_0x07a4('0x4c')](function(_0x4e20c8){return _0x4e20c8[0x0]['COUNT(*)'];});}module[_0x07a4('0x6a')]={'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 065358b..c4b8ba0 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 _0x576c=['decryptFile','createDecipher','close','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','unlink'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x576c,0x130));var _0xc576=function(_0x2818a7,_0xb38d51){_0x2818a7=_0x2818a7-0x0;var _0x3d7a89=_0x576c[_0x2818a7];return _0x3d7a89;};'use strict';var crypto=require(_0xc576('0x0'));var fs=require('fs');var BPromise=require(_0xc576('0x1'));var _=require(_0xc576('0x2'));var config=require(_0xc576('0x3'));var logger=require(_0xc576('0x4'))(_0xc576('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc576('0x6')]['session'],'algorithm':_0xc576('0x7')};const fileOptions={'algorithm':_0xc576('0x8')};if(config[_0xc576('0x9')]&&config[_0xc576('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0xc576('0xa')]);if(isSupported){fileOptions[_0xc576('0xa')]=config[_0xc576('0x9')][_0xc576('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc576('0xb')](',\x20');logger[_0xc576('0xc')](config['encrypt']['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4d98e5){return AES_SUPPORTED_RX[_0xc576('0xd')](_0x4d98e5);}function getSupportedCiphers(){return crypto[_0xc576('0xe')]()[_0xc576('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xebbe23){return getSupportedCiphers()[_0xc576('0x10')](_0xebbe23)>-0x1;}function combineOptions(_0x423528){var _0x1e9ea1={};for(var _0x579c79 in fileOptions){if(fileOptions[_0xc576('0x11')](_0x579c79)){_0x1e9ea1[_0x579c79]=fileOptions[_0x579c79];}}if(_0x423528){for(var _0x20d2b8 in _0x423528){if(_0x423528[_0xc576('0x11')](_0x20d2b8)){_0x1e9ea1[_0x20d2b8]=_0x423528[_0x20d2b8];}}}return _0x1e9ea1;}exports[_0xc576('0x12')]=function(_0x2768e9,_0x354f53,_0x4f72cc,_0x3c566e){return new BPromise(function(_0x8177e7,_0x4f27f7){_0x3c566e=combineOptions(_0x3c566e);var _0x17624f=new Buffer(_0x4f72cc);var _0x1b8939=fs[_0xc576('0x13')](_0x2768e9);var _0x2e1c7b=fs[_0xc576('0x14')](_0x354f53);var _0x2ede60=crypto[_0xc576('0x15')](_0x3c566e[_0xc576('0xa')],_0x17624f);_0x1b8939['on'](_0xc576('0x16'),function(_0x2e7fd3){var _0x517614=new Buffer(_0x2ede60[_0xc576('0x17')](_0x2e7fd3),_0xc576('0x18'));_0x2e1c7b[_0xc576('0x19')](_0x517614);});_0x1b8939['on'](_0xc576('0x1a'),function(){try{var _0x10b7cc=new Buffer(_0x2ede60[_0xc576('0x1b')](_0xc576('0x18')),_0xc576('0x18'));_0x2e1c7b[_0xc576('0x19')](_0x10b7cc);_0x2e1c7b[_0xc576('0x1a')]();_0x2e1c7b['on']('close',function(){return _0x8177e7(_0x354f53);});}catch(_0x227717){fs[_0xc576('0x1c')](_0x354f53);return _0x4f27f7(_0x227717);}});});};exports[_0xc576('0x1d')]=function(_0x29874b,_0x294411,_0x33383a,_0x1b214b){return new BPromise(function(_0x3e864e,_0x3eb5c7){_0x1b214b=combineOptions(_0x1b214b);var _0x2c7af6=new Buffer(_0x33383a);var _0x3cd72a=fs['createReadStream'](_0x29874b);var _0x1bb8b2=fs[_0xc576('0x14')](_0x294411);var _0x17d11d=crypto[_0xc576('0x1e')](_0x1b214b['algorithm'],_0x2c7af6);_0x3cd72a['on'](_0xc576('0x16'),function(_0x4ecd74){var _0xa7f2d1=new Buffer(_0x17d11d[_0xc576('0x17')](_0x4ecd74),'binary');_0x1bb8b2[_0xc576('0x19')](_0xa7f2d1);});_0x3cd72a['on'](_0xc576('0x1a'),function(){try{var _0x5dbde7=new Buffer(_0x17d11d[_0xc576('0x1b')](_0xc576('0x18')),_0xc576('0x18'));_0x1bb8b2[_0xc576('0x19')](_0x5dbde7);_0x1bb8b2['end']();_0x1bb8b2['on'](_0xc576('0x1f'),function(){return _0x3e864e(_0x294411);});}catch(_0x48e221){fs[_0xc576('0x1c')](_0x294411);return _0x3eb5c7(_0x48e221);}});});};exports[_0xc576('0x20')]=function(_0x12256b,_0x2ce9e8,_0x176084){var _0xf302=_0x176084||stringOptions[_0xc576('0xa')];var _0x1c51d4=_0x2ce9e8||stringOptions[_0xc576('0x21')];var _0x10e9b1=crypto[_0xc576('0x15')](_0xf302,_0x1c51d4);var _0x5ded4f=_0x10e9b1[_0xc576('0x17')](_0x12256b,_0xc576('0x22'),'base64');_0x5ded4f+=_0x10e9b1[_0xc576('0x1b')](_0xc576('0x23'));return _0x5ded4f;};exports[_0xc576('0x24')]=function(_0x562bb0,_0x3e0c24,_0x429ae0){var _0x502ea6=_0x429ae0||stringOptions[_0xc576('0xa')];var _0x42fb26=_0x3e0c24||stringOptions[_0xc576('0x21')];var _0x52670a=crypto['createDecipher'](_0x502ea6,_0x42fb26);var _0x5ebf78=_0x52670a[_0xc576('0x17')](_0x562bb0,_0xc576('0x23'),_0xc576('0x22'));_0x5ebf78+=_0x52670a[_0xc576('0x1b')](_0xc576('0x22'));return _0x5ebf78;}; \ No newline at end of file +var _0x5dfa=['encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','write','end','final','binary','unlink','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes192'];(function(_0x2aaed6,_0x2ebd88){var _0x35ac2b=function(_0x292fa8){while(--_0x292fa8){_0x2aaed6['push'](_0x2aaed6['shift']());}};_0x35ac2b(++_0x2ebd88);}(_0x5dfa,0x118));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0xa5df('0x0'));var fs=require('fs');var BPromise=require(_0xa5df('0x1'));var _=require(_0xa5df('0x2'));var config=require(_0xa5df('0x3'));var logger=require('../../config/logger')(_0xa5df('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa5df('0x5')][_0xa5df('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xa5df('0x7')};if(config[_0xa5df('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0xa5df('0x9')]);if(isSupported){fileOptions[_0xa5df('0x9')]=config['encrypt'][_0xa5df('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa5df('0xa')](',\x20');logger[_0xa5df('0xb')](config['encrypt'][_0xa5df('0x9')],_0xa5df('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x545e3f){return AES_SUPPORTED_RX['test'](_0x545e3f);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xa5df('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x33c7af){return getSupportedCiphers()['indexOf'](_0x33c7af)>-0x1;}function combineOptions(_0x43e692){var _0x2c8f5d={};for(var _0x4ed294 in fileOptions){if(fileOptions[_0xa5df('0xe')](_0x4ed294)){_0x2c8f5d[_0x4ed294]=fileOptions[_0x4ed294];}}if(_0x43e692){for(var _0x5ee3df in _0x43e692){if(_0x43e692[_0xa5df('0xe')](_0x5ee3df)){_0x2c8f5d[_0x5ee3df]=_0x43e692[_0x5ee3df];}}}return _0x2c8f5d;}exports[_0xa5df('0xf')]=function(_0x32b993,_0xc2ade2,_0x212142,_0x3d14a1){return new BPromise(function(_0x468077,_0x5826b0){_0x3d14a1=combineOptions(_0x3d14a1);var _0x3a77d6=new Buffer(_0x212142);var _0x4a3042=fs[_0xa5df('0x10')](_0x32b993);var _0x4e94d9=fs[_0xa5df('0x11')](_0xc2ade2);var _0x276102=crypto[_0xa5df('0x12')](_0x3d14a1[_0xa5df('0x9')],_0x3a77d6);_0x4a3042['on'](_0xa5df('0x13'),function(_0xdb31b7){var _0x589981=new Buffer(_0x276102[_0xa5df('0x14')](_0xdb31b7),'binary');_0x4e94d9[_0xa5df('0x15')](_0x589981);});_0x4a3042['on'](_0xa5df('0x16'),function(){try{var _0x2edc08=new Buffer(_0x276102[_0xa5df('0x17')]('binary'),_0xa5df('0x18'));_0x4e94d9[_0xa5df('0x15')](_0x2edc08);_0x4e94d9['end']();_0x4e94d9['on']('close',function(){return _0x468077(_0xc2ade2);});}catch(_0x57b1f8){fs[_0xa5df('0x19')](_0xc2ade2);return _0x5826b0(_0x57b1f8);}});});};exports['decryptFile']=function(_0x294007,_0x815786,_0x30fe86,_0x28c848){return new BPromise(function(_0x3dc423,_0x203d84){_0x28c848=combineOptions(_0x28c848);var _0x1c1e9f=new Buffer(_0x30fe86);var _0x821ab1=fs[_0xa5df('0x10')](_0x294007);var _0x36fb84=fs[_0xa5df('0x11')](_0x815786);var _0x3dd472=crypto[_0xa5df('0x1a')](_0x28c848[_0xa5df('0x9')],_0x1c1e9f);_0x821ab1['on'](_0xa5df('0x13'),function(_0x5437af){var _0x151855=new Buffer(_0x3dd472[_0xa5df('0x14')](_0x5437af),_0xa5df('0x18'));_0x36fb84[_0xa5df('0x15')](_0x151855);});_0x821ab1['on'](_0xa5df('0x16'),function(){try{var _0x3e6768=new Buffer(_0x3dd472[_0xa5df('0x17')](_0xa5df('0x18')),_0xa5df('0x18'));_0x36fb84['write'](_0x3e6768);_0x36fb84['end']();_0x36fb84['on']('close',function(){return _0x3dc423(_0x815786);});}catch(_0x129fc4){fs['unlink'](_0x815786);return _0x203d84(_0x129fc4);}});});};exports[_0xa5df('0x1b')]=function(_0x250272,_0x263501,_0x2c9aae){var _0xc15817=_0x2c9aae||stringOptions[_0xa5df('0x9')];var _0x4286d8=_0x263501||stringOptions[_0xa5df('0x1c')];var _0x12e6f6=crypto[_0xa5df('0x12')](_0xc15817,_0x4286d8);var _0x360094=_0x12e6f6[_0xa5df('0x14')](_0x250272,_0xa5df('0x1d'),_0xa5df('0x1e'));_0x360094+=_0x12e6f6[_0xa5df('0x17')](_0xa5df('0x1e'));return _0x360094;};exports[_0xa5df('0x1f')]=function(_0x14fe30,_0x110f66,_0x5715b7){var _0x4c445a=_0x5715b7||stringOptions['algorithm'];var _0xacb057=_0x110f66||stringOptions[_0xa5df('0x1c')];var _0x3b3b6e=crypto[_0xa5df('0x1a')](_0x4c445a,_0xacb057);var _0x5e7043=_0x3b3b6e[_0xa5df('0x14')](_0x14fe30,_0xa5df('0x1e'),'utf8');_0x5e7043+=_0x3b3b6e[_0xa5df('0x17')](_0xa5df('0x1d'));return _0x5e7043;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ce2f010..f2c6259 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 _0x24b1=['split','splitSizeCsv','then','sequelize','query','SELECT','num','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','join','mkdirSync','each','csv','writeFileSync','%s.%s','zip','zip\x20finished','info','CSV','catch','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x24b1,0x19f));var _0x124b=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x24b1[_0x53ccf2];return _0x5a2964;};'use strict';var util=require(_0x124b('0x0'));var path=require(_0x124b('0x1'));var _=require(_0x124b('0x2'));var csv=require(_0x124b('0x3'));var fs=require('fs');var BPromise=require(_0x124b('0x4'));var zipdir=require(_0x124b('0x5'));var rimraf=require(_0x124b('0x6'));var db=require(_0x124b('0x7'))['db'];var dbH=require('../../mysqldb')[_0x124b('0x8')];var logger=require(_0x124b('0x9'))(_0x124b('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x124b('0xb')][0x2]);var QUERY=process[_0x124b('0xb')][0x3];var PATH=process[_0x124b('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x43e29a,_0x3c064b){var _0x2b5819={'status':_0x43e29a};var _0x3b52f4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c064b){_0x2b5819[_0x124b('0xc')]=_0x3c064b;}return db['AnalyticExtractedReport'][_0x124b('0xd')](_0x2b5819,_0x3b52f4);}function main(){var _0x54461a=0x1388;var _0x457a65;logger['info'](util[_0x124b('0xe')](_0x124b('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x124b('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x124b('0x11'),_0x124b('0x12')]})[_0x124b('0x13')](function(_0x736efb){if(_0x736efb){_0x457a65=_0x736efb;_0x54461a=_0x457a65[_0x124b('0x12')]||0x1388;}})[_0x124b('0x13')](function(){return dbH[_0x124b('0x14')][_0x124b('0x15')](util[_0x124b('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x124b('0x16')]});})[_0x124b('0x13')](function(_0x4c577b){if(!_0x4c577b[0x0][_0x124b('0x17')]){return analyticExtractedReport('Empty');}var _0x10495a=[];var _0x238752=0x0;if(_0x457a65[_0x124b('0x11')]){if(_0x4c577b&&_0x4c577b[_0x124b('0x18')]){var _0xf3417d=_[_0x124b('0x19')](_0x4c577b[0x0][_0x124b('0x17')]/_0x54461a);var _0x1601f0=Number[_0x124b('0x1a')](_0x4c577b[0x0][_0x124b('0x17')]/_0x54461a)?_0x4c577b[0x0][_0x124b('0x17')]%_0x54461a:0x0;_0xf3417d['forEach'](function(_0x47b875){if(_0x47b875>0x0){_0x238752+=_0x54461a;}_0x10495a[_0x124b('0x1b')](dbH['sequelize'][_0x124b('0x15')](util[_0x124b('0xe')](_0x124b('0x1c'),QUERY,_0x54461a,_0x238752),{'type':dbH['sequelize']['QueryTypes'][_0x124b('0x16')]}));});if(_0x1601f0>0x0){_0x238752+=_0x54461a;_0x10495a[_0x124b('0x1b')](dbH['sequelize']['query'](util[_0x124b('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1601f0,_0x238752),{'type':dbH['sequelize'][_0x124b('0x1d')][_0x124b('0x16')]}));}}}else{_0x10495a[_0x124b('0x1b')](dbH['sequelize'][_0x124b('0x15')](QUERY,{'type':dbH[_0x124b('0x14')][_0x124b('0x1d')][_0x124b('0x16')]}));}var _0x4af77d=path[_0x124b('0x1e')](PATH);var _0x5f3909=path[_0x124b('0x1f')](PATH,_0x124b('0x20'));var _0x13f7f7=_0x457a65[_0x124b('0x11')]&&_0x10495a[_0x124b('0x18')]>0x1;var _0xd2827c=[];if(!fs['existsSync'](path[_0x124b('0x21')](_0x4af77d,_0x5f3909))&&_0x13f7f7){fs[_0x124b('0x22')](path[_0x124b('0x21')](_0x4af77d,_0x5f3909));}return BPromise[_0x124b('0x23')](_0x10495a,function(_0x504f0a){_0xd2827c[_0x124b('0x1b')](_0x504f0a);})[_0x124b('0x13')](function(){for(var _0x100194=0x0;_0x100194<_0xd2827c[_0x124b('0x18')];_0x100194+=0x1){var _0x44a24e;var _0x362b43=_0xd2827c[_0x100194];if(_0x13f7f7){_0x44a24e=path[_0x124b('0x21')](_0x4af77d,_0x5f3909,util[_0x124b('0xe')]('%s%d.%s',_0x5f3909,_0x100194,_0x124b('0x24')));}else{_0x44a24e=path[_0x124b('0x21')](_0x4af77d,util['format']('%s.%s',_0x5f3909,'csv'));}fs[_0x124b('0x25')](_0x44a24e,csv(_0x362b43));}})[_0x124b('0x13')](function(){if(_0x13f7f7){return new Promise(function(_0x2ec60c){zipdir(path[_0x124b('0x21')](_0x4af77d,_0x5f3909),{'saveTo':path['join'](_0x4af77d,util[_0x124b('0xe')](_0x124b('0x26'),_0x5f3909,_0x124b('0x27')))},function(_0x6b7c19,_0x4ff625){rimraf(path[_0x124b('0x21')](_0x4af77d,_0x5f3909),function(){});_0x2ec60c(_0x124b('0x28'));});});}})['then'](function(){logger[_0x124b('0x29')](util[_0x124b('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x124b('0x2a')));return analyticExtractedReport('Completed',_0x13f7f7?util[_0x124b('0xe')](_0x124b('0x26'),_0x5f3909,_0x13f7f7?_0x124b('0x27'):_0x124b('0x24')):null);});})[_0x124b('0x2b')](function(_0x310be6){logger[_0x124b('0x29')](util[_0x124b('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x124b('0x2c')](_0x310be6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x124b('0x2d'));})[_0x124b('0x2e')](function(){process[_0x124b('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2544=['csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','each'];(function(_0x278a04,_0x294cff){var _0xd89ce6=function(_0x4a00a6){while(--_0x4a00a6){_0x278a04['push'](_0x278a04['shift']());}};_0xd89ce6(++_0x294cff);}(_0x2544,0x1e2));var _0x4254=function(_0x4ec92b,_0x15ad82){_0x4ec92b=_0x4ec92b-0x0;var _0x2b334a=_0x2544[_0x4ec92b];return _0x2b334a;};'use strict';var util=require(_0x4254('0x0'));var path=require('path');var _=require(_0x4254('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x4254('0x2'));var db=require(_0x4254('0x3'))['db'];var dbH=require(_0x4254('0x3'))[_0x4254('0x4')];var logger=require(_0x4254('0x5'))(_0x4254('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x4254('0x7')][0x2]);var QUERY=process[_0x4254('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3cec83,_0x9eb4d5){var _0x42e811={'status':_0x3cec83};var _0x83bbe8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x9eb4d5){_0x42e811[_0x4254('0x8')]=_0x9eb4d5;}return db[_0x4254('0x9')][_0x4254('0xa')](_0x42e811,_0x83bbe8);}function main(){var _0x1276f7=0x1388;var _0x31967b;logger[_0x4254('0xb')](util['format'](_0x4254('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x4254('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4254('0xe'),_0x4254('0xf')]})[_0x4254('0x10')](function(_0x1a27be){if(_0x1a27be){_0x31967b=_0x1a27be;_0x1276f7=_0x31967b[_0x4254('0xf')]||0x1388;}})[_0x4254('0x10')](function(){return dbH['sequelize'][_0x4254('0x11')](util[_0x4254('0x12')](_0x4254('0x13'),QUERY),{'type':dbH[_0x4254('0x14')][_0x4254('0x15')][_0x4254('0x16')]});})[_0x4254('0x10')](function(_0x1c057a){if(!_0x1c057a[0x0][_0x4254('0x17')]){return analyticExtractedReport(_0x4254('0x18'));}var _0x449163=[];var _0x3a453e=0x0;if(_0x31967b[_0x4254('0xe')]){if(_0x1c057a&&_0x1c057a[_0x4254('0x19')]){var _0x3d6de8=_[_0x4254('0x1a')](_0x1c057a[0x0][_0x4254('0x17')]/_0x1276f7);var _0x2ec906=Number[_0x4254('0x1b')](_0x1c057a[0x0]['num']/_0x1276f7)?_0x1c057a[0x0][_0x4254('0x17')]%_0x1276f7:0x0;_0x3d6de8['forEach'](function(_0x52ace2){if(_0x52ace2>0x0){_0x3a453e+=_0x1276f7;}_0x449163[_0x4254('0x1c')](dbH[_0x4254('0x14')][_0x4254('0x11')](util[_0x4254('0x12')](_0x4254('0x1d'),QUERY,_0x1276f7,_0x3a453e),{'type':dbH[_0x4254('0x14')][_0x4254('0x15')][_0x4254('0x16')]}));});if(_0x2ec906>0x0){_0x3a453e+=_0x1276f7;_0x449163[_0x4254('0x1c')](dbH[_0x4254('0x14')][_0x4254('0x11')](util[_0x4254('0x12')](_0x4254('0x1d'),QUERY,_0x2ec906,_0x3a453e),{'type':dbH['sequelize'][_0x4254('0x15')][_0x4254('0x16')]}));}}}else{_0x449163[_0x4254('0x1c')](dbH['sequelize'][_0x4254('0x11')](QUERY,{'type':dbH[_0x4254('0x14')][_0x4254('0x15')]['SELECT']}));}var _0x524890=path[_0x4254('0x1e')](PATH);var _0x260880=path[_0x4254('0x1f')](PATH,'.csv');var _0xf44ae=_0x31967b[_0x4254('0xe')]&&_0x449163[_0x4254('0x19')]>0x1;var _0x462aa4=[];if(!fs['existsSync'](path[_0x4254('0x20')](_0x524890,_0x260880))&&_0xf44ae){fs[_0x4254('0x21')](path[_0x4254('0x20')](_0x524890,_0x260880));}return BPromise[_0x4254('0x22')](_0x449163,function(_0x4d5afc){_0x462aa4[_0x4254('0x1c')](_0x4d5afc);})[_0x4254('0x10')](function(){for(var _0x370ad0=0x0;_0x370ad0<_0x462aa4[_0x4254('0x19')];_0x370ad0+=0x1){var _0x1cab8f;var _0x4e86a7=_0x462aa4[_0x370ad0];if(_0xf44ae){_0x1cab8f=path['join'](_0x524890,_0x260880,util['format']('%s%d.%s',_0x260880,_0x370ad0,_0x4254('0x23')));}else{_0x1cab8f=path[_0x4254('0x20')](_0x524890,util[_0x4254('0x12')]('%s.%s',_0x260880,'csv'));}fs['writeFileSync'](_0x1cab8f,csv(_0x4e86a7));}})[_0x4254('0x10')](function(){if(_0xf44ae){return new Promise(function(_0x2a6927){zipdir(path['join'](_0x524890,_0x260880),{'saveTo':path[_0x4254('0x20')](_0x524890,util[_0x4254('0x12')](_0x4254('0x24'),_0x260880,_0x4254('0x25')))},function(_0x54ec3d,_0x261c5b){rimraf(path[_0x4254('0x20')](_0x524890,_0x260880),function(){});_0x2a6927('zip\x20finished');});});}})[_0x4254('0x10')](function(){logger[_0x4254('0xb')](util['format'](_0x4254('0x26'),EXTRACTED_REPORT_ID,_0x4254('0x27')));return analyticExtractedReport(_0x4254('0x28'),_0xf44ae?util[_0x4254('0x12')](_0x4254('0x24'),_0x260880,_0xf44ae?_0x4254('0x25'):_0x4254('0x23')):null);});})[_0x4254('0x29')](function(_0x37109f){logger[_0x4254('0xb')](util['format'](_0x4254('0x2a'),EXTRACTED_REPORT_ID,'CSV'),util[_0x4254('0x2b')](_0x37109f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4254('0x2c'));})[_0x4254('0x2d')](function(){process[_0x4254('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8dddd43..a007cb1 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 _0x00fb=['endDate','length','header','pageBreak','before','margin','\x20/\x20','footer','black','right','num','Empty','Setting','split','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','toString','value','fill','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x00fb,0x99));var _0xb00f=function(_0x471d6a,_0x56e87c){_0x471d6a=_0x471d6a-0x0;var _0x5e837e=_0x00fb[_0x471d6a];return _0x5e837e;};'use strict';var _=require(_0xb00f('0x0'));var fs=require('fs');var util=require(_0xb00f('0x1'));var path=require(_0xb00f('0x2'));var moment=require(_0xb00f('0x3'));var htmlToPdfmake=require(_0xb00f('0x4'));var PdfPrinter=require(_0xb00f('0x5'));var zipdir=require(_0xb00f('0x6'));var rimraf=require(_0xb00f('0x7'));var JSDOM=require(_0xb00f('0x8'))[_0xb00f('0x9')];var window=new JSDOM('')[_0xb00f('0xa')];var BPromise=require('bluebird');var db=require(_0xb00f('0xb'))['db'];var dbH=require(_0xb00f('0xb'))[_0xb00f('0xc')];var logger=require(_0xb00f('0xd'))(_0xb00f('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xb00f('0xf')][0x2]);var QUERY=process[_0xb00f('0xf')][0x3];var PATH=process[_0xb00f('0xf')][0x4];var NAME=process[_0xb00f('0xf')][0x5];var FORMAT=_0xb00f('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2943bc,_0x58661a){var _0x5c5a16={'status':_0x2943bc};var _0x36d577={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x58661a){_0x5c5a16[_0xb00f('0x11')]=_0x58661a;}return db[_0xb00f('0x12')]['update'](_0x5c5a16,_0x36d577);}function getHeaders(_0x45f035){return _[_0xb00f('0x13')](_0x45f035,function(_0x479377){return{'text':_0x479377,'style':_0xb00f('0x14')};});}function getRows(_0x4af38c,_0x1e72ec){return _['map'](_0x1e72ec,function(_0x4a8cf2){return _(_0x4a8cf2)['pick'](_0x4af38c)[_0xb00f('0x13')](function(_0x43d9e9){return _0x43d9e9?_[_0xb00f('0x15')](_0x43d9e9):'';})[_0xb00f('0x16')]();});}function createTable(_0x3d0243,_0x448c96){var _0x3e8890={'widths':_[_0xb00f('0x17')](Array(_0x3d0243['length']),0x91),'heights':function(_0x5dbae9){return _0x5dbae9===0x0?_0xb00f('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x125ef0=getHeaders(_0x3d0243);_0x3e8890[_0xb00f('0x19')][_0xb00f('0x1a')](_0x125ef0);var _0xc778de=getRows(_0x3d0243,_0x448c96);_0x3e8890[_0xb00f('0x19')]=_0x3e8890[_0xb00f('0x19')][_0xb00f('0x1b')](_0xc778de);return _0x3e8890;}function createTables(_0x4ac3fa){var _0x123252=[];var _0x2aa990=_[_0xb00f('0x1c')](Object[_0xb00f('0x1d')](_0x4ac3fa[0x0]),0x5);_0x2aa990[_0xb00f('0x1e')](function(_0x135ddc){_0x123252[_0xb00f('0x1a')](createTable(_0x135ddc,_0x4ac3fa));});return _0x123252;}function getPDFDocDefinition(_0x5a011b){var _0x53a517=util[_0xb00f('0x1f')](_0xb00f('0x20'),NAME,EXTRACTED_REPORT[_0xb00f('0x21')],moment(EXTRACTED_REPORT[_0xb00f('0x22')])[_0xb00f('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xb00f('0x23')])[_0xb00f('0x1f')](FORMAT));var _0x2cd268=[];for(var _0x378d74=0x0;_0x378d74<_0x5a011b[_0xb00f('0x24')];_0x378d74++){var _0x2ef796=[];if(_0x378d74===0x0){_0x2ef796['push']({'text':_0x53a517,'style':_0xb00f('0x25')});}var _0x31e963={'table':_0x5a011b[_0x378d74]};if(_0x378d74>0x0){_0x31e963[_0xb00f('0x26')]=_0xb00f('0x27');_0x31e963[_0xb00f('0x28')]=[0x0,0x46,0x0,0x0];}_0x2ef796[_0xb00f('0x1a')](_0x31e963);_0x2cd268[_0xb00f('0x1a')](_0x2ef796);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2cd268,'footer':function(_0x50aeda,_0x1c3d71){return{'text':_0x50aeda[_0xb00f('0x15')]()+_0xb00f('0x29')+_0x1c3d71,'style':_0xb00f('0x2a')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb00f('0x2b')},'footer':{'alignment':_0xb00f('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2f1bf9){var _0x1c3663=0x1388;var _0x47787d;if(!_0x2f1bf9[0x0][_0xb00f('0x2d')]){return analyticExtractedReport(_0xb00f('0x2e'));}return db[_0xb00f('0x2f')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb00f('0x30'),'splitSizePdf']})['then'](function(_0x4743d3){if(_0x4743d3){_0x47787d=_0x4743d3;_0x1c3663=_0x47787d['splitSizePdf']||0x3e8;}})[_0xb00f('0x31')](function(){var _0x48ffe6=[];var _0x21fe7c=0x0;if(_0x47787d['split']){if(_0x2f1bf9&&_0x2f1bf9[_0xb00f('0x24')]){var _0x49e2fe=_[_0xb00f('0x32')](_0x2f1bf9[0x0][_0xb00f('0x2d')]/_0x1c3663);var _0x5ea884=Number[_0xb00f('0x33')](_0x2f1bf9[0x0][_0xb00f('0x2d')]/_0x1c3663)?_0x2f1bf9[0x0][_0xb00f('0x2d')]%_0x1c3663:0x0;_0x49e2fe['forEach'](function(_0x523523){if(_0x523523>0x0){_0x21fe7c+=_0x1c3663;}_0x48ffe6[_0xb00f('0x1a')](dbH[_0xb00f('0x34')][_0xb00f('0x35')](util[_0xb00f('0x1f')](_0xb00f('0x36'),QUERY,_0x1c3663,_0x21fe7c),{'type':dbH[_0xb00f('0x34')]['QueryTypes'][_0xb00f('0x37')]}));});if(_0x5ea884>0x0){_0x21fe7c+=_0x1c3663;_0x48ffe6['push'](dbH[_0xb00f('0x34')]['query'](util[_0xb00f('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5ea884,_0x21fe7c),{'type':dbH[_0xb00f('0x34')][_0xb00f('0x38')][_0xb00f('0x37')]}));}}}else{_0x48ffe6[_0xb00f('0x1a')](dbH[_0xb00f('0x34')][_0xb00f('0x35')](QUERY,{'type':dbH[_0xb00f('0x34')][_0xb00f('0x38')][_0xb00f('0x37')]}));}var _0x208435=path['dirname'](PATH);var _0x1e04bf=path[_0xb00f('0x39')](PATH,_0xb00f('0x3a'));var _0x1cb23f=_0x47787d[_0xb00f('0x30')]&&_0x48ffe6[_0xb00f('0x24')]>0x1;var _0x138bf4=[];if(!fs[_0xb00f('0x3b')](path[_0xb00f('0x3c')](_0x208435,_0x1e04bf))&&_0x1cb23f){fs[_0xb00f('0x3d')](path[_0xb00f('0x3c')](_0x208435,_0x1e04bf));}return BPromise['each'](_0x48ffe6,function(_0x30efc2){_0x138bf4[_0xb00f('0x1a')](_0x30efc2);})[_0xb00f('0x31')](function(){var _0x391eed=[];for(var _0x5c7a74=0x0;_0x5c7a74<_0x138bf4[_0xb00f('0x24')];_0x5c7a74+=0x1){var _0x14f604=_0x138bf4[_0x5c7a74];var _0x31effb=createTables(_[_0xb00f('0x3e')](_0x14f604));var _0x4141ea;var _0x1858ed=getPDFDocDefinition(_0x31effb);var _0x4a80cd=getPDFPrinter();var _0x5a0652=_0x4a80cd[_0xb00f('0x3f')](_0x1858ed);if(_0x1cb23f){_0x4141ea=path['join'](_0x208435,_0x1e04bf,util[_0xb00f('0x1f')](_0xb00f('0x40'),_0x1e04bf,_0x5c7a74,_0xb00f('0x41')));}else{_0x4141ea=path[_0xb00f('0x3c')](_0x208435,util[_0xb00f('0x1f')]('%s.%s',_0x1e04bf,_0xb00f('0x41')));}_0x391eed['push'](writePDFDocument(_0x5a0652,_0x4141ea));}return Promise['all'](_0x391eed);})[_0xb00f('0x31')](function(){if(_0x1cb23f){return new Promise(function(_0x16265c){zipdir(path[_0xb00f('0x3c')](_0x208435,_0x1e04bf),{'saveTo':path['join'](_0x208435,util[_0xb00f('0x1f')](_0xb00f('0x42'),_0x1e04bf,_0xb00f('0x43')))},function(){rimraf(path[_0xb00f('0x3c')](_0x208435,_0x1e04bf),function(){});_0x16265c(_0xb00f('0x44'));});});}})[_0xb00f('0x31')](function(){if(!_0x1cb23f)return;rimraf(path['join'](_0x208435,_0x1e04bf),function(){});})['then'](function(){logger['info'](util[_0xb00f('0x1f')](_0xb00f('0x45'),EXTRACTED_REPORT_ID,_0xb00f('0x46')));return analyticExtractedReport('Completed',_0x1cb23f?util[_0xb00f('0x1f')](_0xb00f('0x42'),_0x1e04bf,_0x1cb23f?_0xb00f('0x43'):_0xb00f('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb00f('0x47')](util[_0xb00f('0x1f')](_0xb00f('0x48'),EXTRACTED_REPORT_ID,_0xb00f('0x46')));return db[_0xb00f('0x12')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb00f('0x31')](function(_0x478162){EXTRACTED_REPORT=_0x478162;return dbH[_0xb00f('0x34')][_0xb00f('0x35')](util[_0xb00f('0x1f')](_0xb00f('0x49'),QUERY),{'type':dbH[_0xb00f('0x34')][_0xb00f('0x38')]['SELECT']});})[_0xb00f('0x31')](extractReport)['catch'](function(_0x3335d4){logger[_0xb00f('0x47')](util[_0xb00f('0x1f')](_0xb00f('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0xb00f('0x4b')](_0x3335d4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb00f('0x4c'));})['finally'](function(){process[_0xb00f('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x596e76=new PdfPrinter({'Arial':{'normal':__dirname+_0xb00f('0x4e'),'bold':__dirname+_0xb00f('0x4f'),'italics':__dirname+_0xb00f('0x50'),'bolditalics':__dirname+_0xb00f('0x51')}});return _0x596e76;}function getPDFDocDefinitionFromHTML(_0x24b367,_0xabd6e5){var _0x438a83=util[_0xb00f('0x1f')]('%s\x20#%d',_0xabd6e5['channel'],_0xabd6e5[_0xb00f('0x52')]);var _0xdd0d76=moment()['format'](_0xb00f('0x53'))['toString']();var _0x1e40aa=htmlToPdfmake(_0x24b367,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e40aa],'defaultStyle':{'font':_0xb00f('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb00f('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb00f('0x55')}},'header':function(){return[{'text':_0xb00f('0x56'),'style':_0xb00f('0x25')}];},'footer':function(_0xfc3287,_0x40ada5){return[{'text':util[_0xb00f('0x1f')](_0xb00f('0x57'),_0x438a83,_0xfc3287,_0x40ada5,_0xdd0d76),'style':_0xb00f('0x2a')}];}};}function writePDFDocument(_0x30eda2,_0x287eaf){return new Promise(function(_0x461369,_0x219443){var _0x2c9583=_0x30eda2[_0xb00f('0x58')](fs[_0xb00f('0x59')](_0x287eaf));_0x2c9583['on'](_0xb00f('0x5a'),function(){_0x461369(_0xb00f('0x5a'));});_0x2c9583['on'](_0xb00f('0x5b'),function(_0x442afb){_0x219443(_0x442afb);});_0x30eda2['end']();});}exports[_0xb00f('0x5c')]=function(_0x52eabb,_0x3e8035){var _0x47b569=getPDFPrinter();var _0x330407=getPDFDocDefinitionFromHTML(_0x52eabb,_0x3e8035);var _0x198f53=_0x47b569[_0xb00f('0x3f')](_0x330407);return writePDFDocument(_0x198f53,_0x3e8035[_0xb00f('0x2')])[_0xb00f('0x5d')](function(_0x3d56e7){throw _0x3d56e7;});}; \ No newline at end of file +var _0xc7b3=['length','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','landscape','footer','Arial','Empty','Setting','split','splitSizePdf','then','range','num','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill'];(function(_0x25bd06,_0x32f0eb){var _0x5fbb5f=function(_0x33d32b){while(--_0x33d32b){_0x25bd06['push'](_0x25bd06['shift']());}};_0x5fbb5f(++_0x32f0eb);}(_0xc7b3,0x93));var _0x3c7b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc7b3[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3c7b('0x0'));var fs=require('fs');var util=require(_0x3c7b('0x1'));var path=require(_0x3c7b('0x2'));var moment=require(_0x3c7b('0x3'));var htmlToPdfmake=require(_0x3c7b('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x3c7b('0x5'));var JSDOM=require(_0x3c7b('0x6'))[_0x3c7b('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0x3c7b('0x8'));var db=require(_0x3c7b('0x9'))['db'];var dbH=require('../../mysqldb')[_0x3c7b('0xa')];var logger=require(_0x3c7b('0xb'))(_0x3c7b('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x3c7b('0xd')][0x2]);var QUERY=process[_0x3c7b('0xd')][0x3];var PATH=process[_0x3c7b('0xd')][0x4];var NAME=process[_0x3c7b('0xd')][0x5];var FORMAT=_0x3c7b('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2c9ee1,_0x96b8e6){var _0x2366e4={'status':_0x2c9ee1};var _0x1ade60={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x96b8e6){_0x2366e4[_0x3c7b('0xf')]=_0x96b8e6;}return db[_0x3c7b('0x10')][_0x3c7b('0x11')](_0x2366e4,_0x1ade60);}function getHeaders(_0x4b5960){return _[_0x3c7b('0x12')](_0x4b5960,function(_0x584470){return{'text':_0x584470,'style':'tableHeader'};});}function getRows(_0x45071b,_0x32b8e2){return _[_0x3c7b('0x12')](_0x32b8e2,function(_0x29f915){return _(_0x29f915)[_0x3c7b('0x13')](_0x45071b)[_0x3c7b('0x12')](function(_0x35e211){return _0x35e211?_[_0x3c7b('0x14')](_0x35e211):'';})[_0x3c7b('0x15')]();});}function createTable(_0x4573e3,_0x4d5a65){var _0xcf10db={'widths':_[_0x3c7b('0x16')](Array(_0x4573e3[_0x3c7b('0x17')]),0x91),'heights':function(_0x2011bd){return _0x2011bd===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3b920d=getHeaders(_0x4573e3);_0xcf10db[_0x3c7b('0x18')][_0x3c7b('0x19')](_0x3b920d);var _0xddaf2b=getRows(_0x4573e3,_0x4d5a65);_0xcf10db[_0x3c7b('0x18')]=_0xcf10db['body']['concat'](_0xddaf2b);return _0xcf10db;}function createTables(_0x37eb06){var _0x25a8c7=[];var _0x383b9a=_[_0x3c7b('0x1a')](Object['keys'](_0x37eb06[0x0]),0x5);_0x383b9a[_0x3c7b('0x1b')](function(_0x5d4f5c){_0x25a8c7['push'](createTable(_0x5d4f5c,_0x37eb06));});return _0x25a8c7;}function getPDFDocDefinition(_0x2f55dc){var _0x3e0d27=util[_0x3c7b('0x1c')](_0x3c7b('0x1d'),NAME,EXTRACTED_REPORT[_0x3c7b('0x1e')],moment(EXTRACTED_REPORT['startDate'])[_0x3c7b('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x3c7b('0x1f')])[_0x3c7b('0x1c')](FORMAT));var _0x27b58c=[];for(var _0x83d809=0x0;_0x83d809<_0x2f55dc[_0x3c7b('0x17')];_0x83d809++){var _0x303e0d=[];if(_0x83d809===0x0){_0x303e0d[_0x3c7b('0x19')]({'text':_0x3e0d27,'style':_0x3c7b('0x20')});}var _0x26e94c={'table':_0x2f55dc[_0x83d809]};if(_0x83d809>0x0){_0x26e94c[_0x3c7b('0x21')]=_0x3c7b('0x22');_0x26e94c['margin']=[0x0,0x46,0x0,0x0];}_0x303e0d[_0x3c7b('0x19')](_0x26e94c);_0x27b58c[_0x3c7b('0x19')](_0x303e0d);}return{'pageSize':'A4','pageOrientation':_0x3c7b('0x23'),'content':_0x27b58c,'footer':function(_0x2d811b,_0x262a2f){return{'text':_0x2d811b[_0x3c7b('0x14')]()+'\x20/\x20'+_0x262a2f,'style':_0x3c7b('0x24')};},'defaultStyle':{'font':_0x3c7b('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1815c7){var _0x5f2540=0x1388;var _0x331c09;if(!_0x1815c7[0x0]['num']){return analyticExtractedReport(_0x3c7b('0x26'));}return db[_0x3c7b('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3c7b('0x28'),_0x3c7b('0x29')]})[_0x3c7b('0x2a')](function(_0x385bb1){if(_0x385bb1){_0x331c09=_0x385bb1;_0x5f2540=_0x331c09['splitSizePdf']||0x3e8;}})[_0x3c7b('0x2a')](function(){var _0xac3199=[];var _0x2357a4=0x0;if(_0x331c09['split']){if(_0x1815c7&&_0x1815c7[_0x3c7b('0x17')]){var _0x241d80=_[_0x3c7b('0x2b')](_0x1815c7[0x0][_0x3c7b('0x2c')]/_0x5f2540);var _0xe83294=Number['isInteger'](_0x1815c7[0x0][_0x3c7b('0x2c')]/_0x5f2540)?_0x1815c7[0x0][_0x3c7b('0x2c')]%_0x5f2540:0x0;_0x241d80[_0x3c7b('0x1b')](function(_0x32134c){if(_0x32134c>0x0){_0x2357a4+=_0x5f2540;}_0xac3199[_0x3c7b('0x19')](dbH[_0x3c7b('0x2d')]['query'](util[_0x3c7b('0x1c')](_0x3c7b('0x2e'),QUERY,_0x5f2540,_0x2357a4),{'type':dbH[_0x3c7b('0x2d')][_0x3c7b('0x2f')]['SELECT']}));});if(_0xe83294>0x0){_0x2357a4+=_0x5f2540;_0xac3199['push'](dbH[_0x3c7b('0x2d')]['query'](util['format'](_0x3c7b('0x2e'),QUERY,_0xe83294,_0x2357a4),{'type':dbH[_0x3c7b('0x2d')][_0x3c7b('0x2f')][_0x3c7b('0x30')]}));}}}else{_0xac3199[_0x3c7b('0x19')](dbH['sequelize'][_0x3c7b('0x31')](QUERY,{'type':dbH[_0x3c7b('0x2d')]['QueryTypes'][_0x3c7b('0x30')]}));}var _0x41b2bf=path['dirname'](PATH);var _0x3b69c2=path['basename'](PATH,'.pdf');var _0x40a7d8=_0x331c09[_0x3c7b('0x28')]&&_0xac3199[_0x3c7b('0x17')]>0x1;var _0x175db1=[];if(!fs['existsSync'](path[_0x3c7b('0x32')](_0x41b2bf,_0x3b69c2))&&_0x40a7d8){fs[_0x3c7b('0x33')](path[_0x3c7b('0x32')](_0x41b2bf,_0x3b69c2));}return BPromise[_0x3c7b('0x34')](_0xac3199,function(_0x685eeb){_0x175db1[_0x3c7b('0x19')](_0x685eeb);})['then'](function(){var _0x5c9fff=[];for(var _0x367580=0x0;_0x367580<_0x175db1['length'];_0x367580+=0x1){var _0x2f1855=_0x175db1[_0x367580];var _0x1eb6de=createTables(_[_0x3c7b('0x35')](_0x2f1855));var _0x3c639d;var _0x41a8f9=getPDFDocDefinition(_0x1eb6de);var _0x5eac04=getPDFPrinter();var _0x49d013=_0x5eac04[_0x3c7b('0x36')](_0x41a8f9);if(_0x40a7d8){_0x3c639d=path[_0x3c7b('0x32')](_0x41b2bf,_0x3b69c2,util[_0x3c7b('0x1c')](_0x3c7b('0x37'),_0x3b69c2,_0x367580,_0x3c7b('0x38')));}else{_0x3c639d=path[_0x3c7b('0x32')](_0x41b2bf,util['format'](_0x3c7b('0x39'),_0x3b69c2,_0x3c7b('0x38')));}_0x5c9fff['push'](writePDFDocument(_0x49d013,_0x3c639d));}return Promise[_0x3c7b('0x3a')](_0x5c9fff);})[_0x3c7b('0x2a')](function(){if(_0x40a7d8){return new Promise(function(_0x223b4f){zipdir(path[_0x3c7b('0x32')](_0x41b2bf,_0x3b69c2),{'saveTo':path[_0x3c7b('0x32')](_0x41b2bf,util[_0x3c7b('0x1c')](_0x3c7b('0x39'),_0x3b69c2,'zip'))},function(){rimraf(path[_0x3c7b('0x32')](_0x41b2bf,_0x3b69c2),function(){});_0x223b4f(_0x3c7b('0x3b'));});});}})['then'](function(){if(!_0x40a7d8)return;rimraf(path['join'](_0x41b2bf,_0x3b69c2),function(){});})[_0x3c7b('0x2a')](function(){logger[_0x3c7b('0x3c')](util['format'](_0x3c7b('0x3d'),EXTRACTED_REPORT_ID,_0x3c7b('0x3e')));return analyticExtractedReport(_0x3c7b('0x3f'),_0x40a7d8?util[_0x3c7b('0x1c')](_0x3c7b('0x39'),_0x3b69c2,_0x40a7d8?_0x3c7b('0x40'):_0x3c7b('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3c7b('0x3c')](util[_0x3c7b('0x1c')](_0x3c7b('0x41'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x3c7b('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3c7b('0x2a')](function(_0x29cd01){EXTRACTED_REPORT=_0x29cd01;return dbH[_0x3c7b('0x2d')][_0x3c7b('0x31')](util[_0x3c7b('0x1c')](_0x3c7b('0x42'),QUERY),{'type':dbH[_0x3c7b('0x2d')]['QueryTypes']['SELECT']});})[_0x3c7b('0x2a')](extractReport)[_0x3c7b('0x43')](function(_0x2a82df){logger[_0x3c7b('0x3c')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3c7b('0x3e')),util[_0x3c7b('0x44')](_0x2a82df,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3c7b('0x45'));})[_0x3c7b('0x46')](function(){process[_0x3c7b('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x15c3e4=new PdfPrinter({'Arial':{'normal':__dirname+_0x3c7b('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x3c7b('0x49'),'bolditalics':__dirname+_0x3c7b('0x4a')}});return _0x15c3e4;}function getPDFDocDefinitionFromHTML(_0x1d8358,_0x2d3b67){var _0x15dbeb=util[_0x3c7b('0x1c')]('%s\x20#%d',_0x2d3b67[_0x3c7b('0x4b')],_0x2d3b67[_0x3c7b('0x4c')]);var _0x15e9ff=moment()[_0x3c7b('0x1c')](_0x3c7b('0x4d'))[_0x3c7b('0x14')]();var _0x1da02e=htmlToPdfmake(_0x1d8358,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1da02e],'defaultStyle':{'font':_0x3c7b('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3c7b('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x3c7b('0x4e')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x3c7b('0x20')}];},'footer':function(_0x2bba64,_0x3c71fb){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x15dbeb,_0x2bba64,_0x3c71fb,_0x15e9ff),'style':_0x3c7b('0x24')}];}};}function writePDFDocument(_0x498f91,_0x150e55){return new Promise(function(_0x340606,_0x559609){var _0x43f81f=_0x498f91[_0x3c7b('0x4f')](fs[_0x3c7b('0x50')](_0x150e55));_0x43f81f['on'](_0x3c7b('0x51'),function(){_0x340606(_0x3c7b('0x51'));});_0x43f81f['on'](_0x3c7b('0x52'),function(_0x44c745){_0x559609(_0x44c745);});_0x498f91[_0x3c7b('0x53')]();});}exports[_0x3c7b('0x54')]=function(_0xf75924,_0x3d5c06){var _0x354091=getPDFPrinter();var _0x3588d5=getPDFDocDefinitionFromHTML(_0xf75924,_0x3d5c06);var _0x3fce07=_0x354091[_0x3c7b('0x36')](_0x3588d5);return writePDFDocument(_0x3fce07,_0x3d5c06[_0x3c7b('0x2')])[_0x3c7b('0x43')](function(_0x1bc9e6){throw _0x1bc9e6;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fc8a2fb..6d5e9ff 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 _0xe7a3=['mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','length','existsSync','join'];(function(_0x142394,_0x49495a){var _0x444ead=function(_0x51b79b){while(--_0x51b79b){_0x142394['push'](_0x142394['shift']());}};_0x444ead(++_0x49495a);}(_0xe7a3,0x1bf));var _0x3e7a=function(_0x2755e3,_0x350547){_0x2755e3=_0x2755e3-0x0;var _0x497af6=_0xe7a3[_0x2755e3];return _0x497af6;};'use strict';var util=require('util');var path=require(_0x3e7a('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x3e7a('0x1'));var BPromise=require(_0x3e7a('0x2'));var zipdir=require(_0x3e7a('0x3'));var rimraf=require(_0x3e7a('0x4'));var db=require(_0x3e7a('0x5'))['db'];var dbH=require(_0x3e7a('0x5'))[_0x3e7a('0x6')];var logger=require(_0x3e7a('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3e7a('0x8')][0x2]);var QUERY=process[_0x3e7a('0x8')][0x3];var PATH=process[_0x3e7a('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d914d,_0x243128){var _0x28fe6b={'status':_0x2d914d};var _0x147d6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x243128){_0x28fe6b[_0x3e7a('0x9')]=_0x243128;}return db[_0x3e7a('0xa')][_0x3e7a('0xb')](_0x28fe6b,_0x147d6f);}function main(){var _0xa41db9=0x1388;var _0x753e89;logger[_0x3e7a('0xc')](util[_0x3e7a('0xd')](_0x3e7a('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x3e7a('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3e7a('0x10'),'splitSizeXlsx']})['then'](function(_0x18c3a3){if(_0x18c3a3){_0x753e89=_0x18c3a3;_0xa41db9=_0x753e89[_0x3e7a('0x11')]||0x1388;}})[_0x3e7a('0x12')](function(){return dbH['sequelize'][_0x3e7a('0x13')](util[_0x3e7a('0xd')](_0x3e7a('0x14'),QUERY),{'type':dbH[_0x3e7a('0x15')][_0x3e7a('0x16')][_0x3e7a('0x17')]});})[_0x3e7a('0x12')](function(_0x5a2f58){if(!_0x5a2f58[0x0][_0x3e7a('0x18')]){return analyticExtractedReport(_0x3e7a('0x19'));}var _0x485271=[];var _0x275c23=0x0;if(_0x753e89[_0x3e7a('0x10')]){if(_0x5a2f58&&_0x5a2f58['length']){var _0xee3d89=_['range'](_0x5a2f58[0x0][_0x3e7a('0x18')]/_0xa41db9);var _0x42bddd=Number[_0x3e7a('0x1a')](_0x5a2f58[0x0][_0x3e7a('0x18')]/_0xa41db9)?_0x5a2f58[0x0][_0x3e7a('0x18')]%_0xa41db9:0x0;_0xee3d89['forEach'](function(_0xa34839){if(_0xa34839>0x0){_0x275c23+=_0xa41db9;}_0x485271[_0x3e7a('0x1b')](dbH[_0x3e7a('0x15')][_0x3e7a('0x13')](util[_0x3e7a('0xd')](_0x3e7a('0x1c'),QUERY,_0xa41db9,_0x275c23),{'type':dbH[_0x3e7a('0x15')][_0x3e7a('0x16')][_0x3e7a('0x17')]}));});if(_0x42bddd>0x0){_0x275c23+=_0xa41db9;_0x485271[_0x3e7a('0x1b')](dbH[_0x3e7a('0x15')]['query'](util[_0x3e7a('0xd')](_0x3e7a('0x1c'),QUERY,_0x42bddd,_0x275c23),{'type':dbH[_0x3e7a('0x15')][_0x3e7a('0x16')][_0x3e7a('0x17')]}));}}}else{_0x485271['push'](dbH[_0x3e7a('0x15')][_0x3e7a('0x13')](QUERY,{'type':dbH['sequelize'][_0x3e7a('0x16')][_0x3e7a('0x17')]}));}var _0x13b651=path['dirname'](PATH);var _0x15dbad=path['basename'](PATH,_0x3e7a('0x1d'));var _0x3bb803=_0x753e89['split']&&_0x485271[_0x3e7a('0x1e')]>0x1;var _0x197f20=[];if(!fs[_0x3e7a('0x1f')](path[_0x3e7a('0x20')](_0x13b651,_0x15dbad))&&_0x3bb803){fs[_0x3e7a('0x21')](path[_0x3e7a('0x20')](_0x13b651,_0x15dbad));}return BPromise[_0x3e7a('0x22')](_0x485271,function(_0x26b190){_0x197f20[_0x3e7a('0x1b')](_0x26b190);})[_0x3e7a('0x12')](function(){for(var _0x40193c=0x0;_0x40193c<_0x197f20[_0x3e7a('0x1e')];_0x40193c+=0x1){var _0xf562ac;var _0xa27cac=_0x197f20[_0x40193c];if(_0x3bb803){_0xf562ac=path[_0x3e7a('0x20')](_0x13b651,_0x15dbad,util[_0x3e7a('0xd')](_0x3e7a('0x23'),_0x15dbad,_0x40193c,'xlsx'));}else{_0xf562ac=path[_0x3e7a('0x20')](_0x13b651,util[_0x3e7a('0xd')](_0x3e7a('0x24'),_0x15dbad,_0x3e7a('0x25')));}fs[_0x3e7a('0x26')](_0xf562ac,json2xls(_0xa27cac),'binary');}})['then'](function(){if(_0x3bb803){return new Promise(function(_0x349053){zipdir(path[_0x3e7a('0x20')](_0x13b651,_0x15dbad),{'saveTo':path[_0x3e7a('0x20')](_0x13b651,util['format'](_0x3e7a('0x24'),_0x15dbad,_0x3e7a('0x27')))},function(_0x21e465,_0x4a7893){rimraf(path['join'](_0x13b651,_0x15dbad),function(){});_0x349053(_0x3e7a('0x28'));});});}})[_0x3e7a('0x12')](function(){logger['info'](util[_0x3e7a('0xd')](_0x3e7a('0x29'),EXTRACTED_REPORT_ID,_0x3e7a('0x2a')));return analyticExtractedReport(_0x3e7a('0x2b'),_0x3bb803?util[_0x3e7a('0xd')](_0x3e7a('0x24'),_0x15dbad,_0x3bb803?_0x3e7a('0x27'):_0x3e7a('0x25')):null);});})['catch'](function(_0x3d81a1){logger[_0x3e7a('0xc')](util[_0x3e7a('0xd')](_0x3e7a('0x2c'),EXTRACTED_REPORT_ID,_0x3e7a('0x2a')),util[_0x3e7a('0x2d')](_0x3d81a1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3e7a('0x2e'));})[_0x3e7a('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc6ec=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','format','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','info','Setting','find','split','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','then','num','Empty','length','range','isInteger'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xc6ec,0x151));var _0xcc6e=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xc6ec[_0x29e35f];return _0x266b74;};'use strict';var util=require(_0xcc6e('0x0'));var path=require(_0xcc6e('0x1'));var _=require(_0xcc6e('0x2'));var fs=require('fs');var json2xls=require(_0xcc6e('0x3'));var BPromise=require(_0xcc6e('0x4'));var zipdir=require(_0xcc6e('0x5'));var rimraf=require(_0xcc6e('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xcc6e('0x7'))['dbH'];var logger=require(_0xcc6e('0x8'))(_0xcc6e('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xcc6e('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x875b96,_0x110366){var _0x3110db={'status':_0x875b96};var _0x222242={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x110366){_0x3110db[_0xcc6e('0xb')]=_0x110366;}return db['AnalyticExtractedReport']['update'](_0x3110db,_0x222242);}function main(){var _0x37acc3=0x1388;var _0x46764e;logger[_0xcc6e('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0xcc6e('0xd')][_0xcc6e('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcc6e('0xf'),'splitSizeXlsx']})['then'](function(_0x3b2fca){if(_0x3b2fca){_0x46764e=_0x3b2fca;_0x37acc3=_0x46764e['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH['sequelize'][_0xcc6e('0x10')](util['format'](_0xcc6e('0x11'),QUERY),{'type':dbH[_0xcc6e('0x12')][_0xcc6e('0x13')][_0xcc6e('0x14')]});})[_0xcc6e('0x15')](function(_0x7dc9f){if(!_0x7dc9f[0x0][_0xcc6e('0x16')]){return analyticExtractedReport(_0xcc6e('0x17'));}var _0x45211a=[];var _0x59d670=0x0;if(_0x46764e['split']){if(_0x7dc9f&&_0x7dc9f[_0xcc6e('0x18')]){var _0xbaf203=_[_0xcc6e('0x19')](_0x7dc9f[0x0][_0xcc6e('0x16')]/_0x37acc3);var _0x2891b7=Number[_0xcc6e('0x1a')](_0x7dc9f[0x0][_0xcc6e('0x16')]/_0x37acc3)?_0x7dc9f[0x0][_0xcc6e('0x16')]%_0x37acc3:0x0;_0xbaf203[_0xcc6e('0x1b')](function(_0x2d1036){if(_0x2d1036>0x0){_0x59d670+=_0x37acc3;}_0x45211a[_0xcc6e('0x1c')](dbH[_0xcc6e('0x12')]['query'](util['format'](_0xcc6e('0x1d'),QUERY,_0x37acc3,_0x59d670),{'type':dbH[_0xcc6e('0x12')][_0xcc6e('0x13')][_0xcc6e('0x14')]}));});if(_0x2891b7>0x0){_0x59d670+=_0x37acc3;_0x45211a[_0xcc6e('0x1c')](dbH['sequelize']['query'](util[_0xcc6e('0x1e')](_0xcc6e('0x1d'),QUERY,_0x2891b7,_0x59d670),{'type':dbH[_0xcc6e('0x12')][_0xcc6e('0x13')]['SELECT']}));}}}else{_0x45211a[_0xcc6e('0x1c')](dbH[_0xcc6e('0x12')][_0xcc6e('0x10')](QUERY,{'type':dbH[_0xcc6e('0x12')]['QueryTypes'][_0xcc6e('0x14')]}));}var _0x1eb1d9=path[_0xcc6e('0x1f')](PATH);var _0x2b85a1=path[_0xcc6e('0x20')](PATH,_0xcc6e('0x21'));var _0x3ef078=_0x46764e[_0xcc6e('0xf')]&&_0x45211a[_0xcc6e('0x18')]>0x1;var _0x4b01c0=[];if(!fs[_0xcc6e('0x22')](path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1))&&_0x3ef078){fs[_0xcc6e('0x24')](path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1));}return BPromise[_0xcc6e('0x25')](_0x45211a,function(_0x33a2e3){_0x4b01c0['push'](_0x33a2e3);})[_0xcc6e('0x15')](function(){for(var _0x283d3f=0x0;_0x283d3f<_0x4b01c0['length'];_0x283d3f+=0x1){var _0x56c6c7;var _0x47e34b=_0x4b01c0[_0x283d3f];if(_0x3ef078){_0x56c6c7=path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1,util[_0xcc6e('0x1e')](_0xcc6e('0x26'),_0x2b85a1,_0x283d3f,_0xcc6e('0x27')));}else{_0x56c6c7=path['join'](_0x1eb1d9,util['format'](_0xcc6e('0x28'),_0x2b85a1,'xlsx'));}fs[_0xcc6e('0x29')](_0x56c6c7,json2xls(_0x47e34b),'binary');}})['then'](function(){if(_0x3ef078){return new Promise(function(_0x409f3c){zipdir(path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1),{'saveTo':path[_0xcc6e('0x23')](_0x1eb1d9,util['format'](_0xcc6e('0x28'),_0x2b85a1,_0xcc6e('0x2a')))},function(_0x179244,_0x3da509){rimraf(path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1),function(){});_0x409f3c(_0xcc6e('0x2b'));});});}})[_0xcc6e('0x15')](function(){logger[_0xcc6e('0xc')](util[_0xcc6e('0x1e')](_0xcc6e('0x2c'),EXTRACTED_REPORT_ID,_0xcc6e('0x2d')));return analyticExtractedReport('Completed',_0x3ef078?util[_0xcc6e('0x1e')](_0xcc6e('0x28'),_0x2b85a1,_0x3ef078?_0xcc6e('0x2a'):'xlsx'):null);});})[_0xcc6e('0x2e')](function(_0xd1e45a){logger[_0xcc6e('0xc')](util[_0xcc6e('0x1e')](_0xcc6e('0x2f'),EXTRACTED_REPORT_ID,_0xcc6e('0x2d')),util[_0xcc6e('0x30')](_0xd1e45a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcc6e('0x31'));})[_0xcc6e('0x32')](function(){process[_0xcc6e('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 6fe38f1..f43c612 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 _0x930b=['format','CDR(type)=%s','context','inbound','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','*,*,*,*','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','priority','extensions','extension','push','type','Set'];(function(_0x2f0a57,_0x5b76e0){var _0x1f79cf=function(_0x1bec88){while(--_0x1bec88){_0x2f0a57['push'](_0x2f0a57['shift']());}};_0x1f79cf(++_0x5b76e0);}(_0x930b,0xf5));var _0xb930=function(_0x2822a9,_0xcd114a){_0x2822a9=_0x2822a9-0x0;var _0x5ca5c3=_0x930b[_0x2822a9];return _0x5ca5c3;};'use strict';var _=require(_0xb930('0x0'));var util=require(_0xb930('0x1'));function rewrite(_0xbd8d2d,_0x49982b){var _0x50db69=this;return _0xbd8d2d[_0xb930('0x2')][_0xb930('0x3')][_0xb930('0x4')]({'raw':!![]})[_0xb930('0x5')](function(_0x39e893){_0x50db69[_0xb930('0x6')]=_0x39e893;return _0xbd8d2d[_0xb930('0x2')][_0xb930('0x7')][_0xb930('0x4')]({'where':{'IntervalId':_0x49982b[_0xb930('0x8')]},'raw':!![]});})['then'](function(_0x1fdc32){return _0xbd8d2d[_0xb930('0x2')]['VoiceExtension'][_0xb930('0x4')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x1fdc32,_0xb930('0x9')))}},'order':[{'raw':_0xb930('0xa')}],'raw':!![]});})[_0xb930('0x5')](function(_0x1f9752){var _0x42a390=_[_0xb930('0xb')](_0x1f9752,{'priority':'1'});var _0x46e66f=_[_0xb930('0xb')](_0x1f9752,{'isApp':0x1});var _0x2305d9=_['groupBy'](_0x46e66f,_0xb930('0x9'));var _0x2ad6a3=[_0xb930('0xc'),'playback'];var _0x7aa2dd=[];var _0x3c4397=[];for(var _0x57f6bf in _0x2305d9){if(_0x2305d9['hasOwnProperty'](_0x57f6bf)){_0x50db69[_0xb930('0xd')]=0x2;_0x50db69[_0xb930('0xe')]=[];_0x50db69[_0xb930('0xf')]=_['find'](_0x42a390,{'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')]});_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':util[_0xb930('0x13')](_0xb930('0x14'),_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')]),'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0]['exten'],'priority':_0x50db69[_0xb930('0xd')]++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0]['VoiceExtensionId']});if(_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')]===_0xb930('0x16')){_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':'Set','appdata':'CDR(routeid)='+_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')],'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'priority':_0x50db69[_0xb930('0xd')]++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});}else if(_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')]==='outbound'){if(_0x50db69[_0xb930('0xf')]){_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0]['type'],'app':'Set','appdata':_0xb930('0x18')+(_0x50db69[_0xb930('0xf')][_0xb930('0x19')]?_0xb930('0x1a')+_0x50db69[_0xb930('0xf')]['cutdigits']+'}':_0xb930('0x1b')),'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'priority':_0x50db69[_0xb930('0xd')]++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});}_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':'CDR(routeid)='+_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')],'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0]['exten'],'priority':_0x50db69['priority']++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});var _0x402471=_0x50db69['priority']++;_0x50db69[_0xb930('0xe')]['push']({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x402471+0x2)+_0xb930('0x1d')+(_0x402471+0x1)+')','context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'priority':_0x402471,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0]['VoiceExtensionId']});if(_0x50db69[_0xb930('0xf')]){_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':_0x50db69[_0xb930('0xf')][_0xb930('0x19')]?_0xb930('0x1e')+_0x50db69[_0xb930('0xf')][_0xb930('0x19')]+'}':_0xb930('0x1f'),'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'priority':_0x50db69[_0xb930('0xd')]++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});}_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':_0xb930('0x20')+_0x2305d9[_0x57f6bf][0x0]['VoiceExtensionId'],'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0]['exten'],'priority':_0x50db69[_0xb930('0xd')]++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});if(_0x50db69[_0xb930('0xf')]&&_0x50db69[_0xb930('0xf')][_0xb930('0x21')]('recordingFormat')&&_0x50db69['extension'][_0xb930('0x22')]!==_0xb930('0x23')){_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':_0xb930('0x24'),'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0]['exten'],'priority':_0x50db69[_0xb930('0xd')]++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});_0x50db69[_0xb930('0xe')]['push']({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':_0xb930('0x25')+_0x50db69['extension'][_0xb930('0x22')]||_0xb930('0x26'),'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'priority':_0x50db69[_0xb930('0xd')]++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0]['VoiceExtensionId']});}}_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':_0xb930('0x27'),'context':_0x2305d9[_0x57f6bf][0x0]['context'],'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'priority':_0x50db69[_0xb930('0xd')]++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});_0x50db69['extensions']['push']({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':_0xb930('0x28'),'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'priority':_0x50db69['priority']++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});_0x50db69[_0xb930('0xe')][_0xb930('0x10')]({'type':_0x2305d9[_0x57f6bf][0x0]['type'],'app':_0xb930('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'priority':_0x50db69['priority']++,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});for(var _0x5088a2=0x0,_0x34e7d5=0x0;_0x5088a2<_0x2305d9[_0x57f6bf][_0xb930('0x29')];_0x5088a2+=0x1,_0x34e7d5=0x0){var _0x2aeff2=_0x2305d9[_0x57f6bf][_0x5088a2];if(_0x2aeff2[_0xb930('0x11')]){_0x2aeff2[_0xb930('0x11')]=_0x2aeff2['type'][_0xb930('0x2a')]();}var _0x372fe9=[];var _0x4fed3a=[];delete _0x2aeff2['id'];delete _0x2aeff2[_0xb930('0x2b')];delete _0x2aeff2[_0xb930('0x2c')];var _0x299cf4=_0x2aeff2['interval']!==_0xb930('0x2d')?[_0x2aeff2['interval']]:_0x2aeff2[_0xb930('0x8')]?_[_0xb930('0x2e')](_[_0xb930('0xb')](_0x50db69[_0xb930('0x6')],{'IntervalId':_0x2aeff2[_0xb930('0x8')]}),'interval'):[];if(_0x2aeff2[_0xb930('0x21')](_0xb930('0x2f'))){if(_0x2aeff2[_0xb930('0x2f')]&&_0x2aeff2[_0xb930('0x2f')]!=='--'){_0x372fe9[_0xb930('0x10')]({'type':_0x2aeff2[_0xb930('0x11')],'app':'Set','appdata':_0xb930('0x30')+_0x2aeff2[_0xb930('0x2f')],'context':_0x2aeff2[_0xb930('0x15')],'exten':_0x2aeff2[_0xb930('0x9')],'priority':_0x299cf4[_0xb930('0x29')]+_0x50db69['priority']+_0x34e7d5++,'VoiceExtensionId':_0x2aeff2[_0xb930('0x17')]});}}if(_0x2aeff2[_0xb930('0x11')]==='outbound'&&_0x2aeff2['hasOwnProperty'](_0xb930('0x31'))){if(_0x2aeff2[_0xb930('0x31')]){_0x372fe9[_0xb930('0x10')]({'type':_0x2aeff2[_0xb930('0x11')],'app':_0xb930('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2aeff2[_0xb930('0x31')]+')','context':_0x2aeff2[_0xb930('0x15')],'exten':_0x2aeff2[_0xb930('0x9')],'priority':_0x299cf4[_0xb930('0x29')]+_0x50db69[_0xb930('0xd')]+_0x34e7d5++,'VoiceExtensionId':_0x2aeff2['VoiceExtensionId']});}else{_0x372fe9[_0xb930('0x10')]({'type':_0x2aeff2[_0xb930('0x11')],'app':_0xb930('0x1c'),'appdata':_0xb930('0x32'),'context':_0x2aeff2[_0xb930('0x15')],'exten':_0x2aeff2[_0xb930('0x9')],'priority':_0x299cf4[_0xb930('0x29')]+_0x50db69['priority']+_0x34e7d5++,'VoiceExtensionId':_0x2aeff2[_0xb930('0x17')]});}}if(_0x2aeff2[_0xb930('0x21')]('answer')){if(_0x2ad6a3['indexOf'](_0x2aeff2['app']['toLowerCase']())>=0x0&&_0x2aeff2[_0xb930('0x33')]!==_0xb930('0x34')){if(_0x2aeff2[_0xb930('0x35')]){_0x372fe9[_0xb930('0x10')]({'type':_0x2aeff2[_0xb930('0x11')],'app':_0xb930('0x1c'),'appdata':_0xb930('0x36'),'context':_0x2aeff2[_0xb930('0x15')],'exten':_0x2aeff2['exten'],'priority':_0x299cf4[_0xb930('0x29')]+_0x50db69['priority']+_0x34e7d5++,'VoiceExtensionId':_0x2aeff2[_0xb930('0x17')]});_0x372fe9[_0xb930('0x10')]({'type':_0x2aeff2[_0xb930('0x11')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2aeff2[_0xb930('0x15')],'exten':_0x2aeff2[_0xb930('0x9')],'priority':_0x299cf4['length']+_0x50db69[_0xb930('0xd')]+_0x34e7d5++,'VoiceExtensionId':_0x2aeff2[_0xb930('0x17')]});}else{_0x372fe9[_0xb930('0x10')]({'type':_0x2aeff2[_0xb930('0x11')],'app':_0xb930('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2aeff2['context'],'exten':_0x2aeff2[_0xb930('0x9')],'priority':_0x299cf4['length']+_0x50db69[_0xb930('0xd')]+_0x34e7d5++,'VoiceExtensionId':_0x2aeff2[_0xb930('0x17')]});_0x372fe9[_0xb930('0x10')]({'type':_0x2aeff2[_0xb930('0x11')],'app':_0xb930('0x12'),'appdata':_0xb930('0x37'),'context':_0x2aeff2[_0xb930('0x15')],'exten':_0x2aeff2['exten'],'priority':_0x299cf4['length']+_0x50db69['priority']+_0x34e7d5++,'VoiceExtensionId':_0x2aeff2['VoiceExtensionId']});}}}for(var _0x1d88a0=0x0;_0x1d88a0<_0x299cf4['length'];_0x1d88a0+=0x1){var _0x376425=_0x50db69[_0xb930('0xd')]+_0x299cf4[_0xb930('0x29')];var _0x2ed583=_0x1d88a0===_0x299cf4['length']-0x1?_0x50db69['priority']+_0x372fe9[_0xb930('0x29')]+_0x4fed3a[_0xb930('0x29')]+0x2:_0x50db69[_0xb930('0xd')]+_0x1d88a0+0x1;_0x372fe9['splice'](_0x1d88a0,0x0,{'type':_0x2aeff2[_0xb930('0x11')],'app':_0xb930('0x38'),'appdata':_0x299cf4[_0x1d88a0]+'?'+_0x2aeff2[_0xb930('0x15')]+_0xb930('0x39')+_0x376425+':'+_0x2aeff2[_0xb930('0x15')]+_0xb930('0x39')+_0x2ed583,'exten':_0x2aeff2['exten'],'context':_0x2aeff2[_0xb930('0x15')],'priority':_0x50db69[_0xb930('0xd')]+_0x1d88a0,'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]});}_0x2aeff2['priority']=_0x372fe9['length']?_[_0xb930('0x3a')](_0x372fe9)['priority']+0x1:_0x50db69['priority'];_0x50db69[_0xb930('0xd')]=(_0x4fed3a['length']?_['last'](_0x4fed3a)['priority']:_0x2aeff2[_0xb930('0xd')])+0x1;_0x50db69[_0xb930('0xe')]=_[_0xb930('0x3b')](_0x50db69[_0xb930('0xe')],_0x372fe9,[_0x2aeff2],_0x4fed3a);}_0x50db69[_0xb930('0xe')]['push']({'type':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x11')],'app':_0xb930('0x3c'),'exten':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x9')],'context':_0x2305d9[_0x57f6bf][0x0][_0xb930('0x15')],'priority':_0x50db69[_0xb930('0xd')],'VoiceExtensionId':_0x2305d9[_0x57f6bf][0x0]['VoiceExtensionId']});_0x7aa2dd[_0xb930('0x10')](_0x2305d9[_0x57f6bf][0x0][_0xb930('0x17')]);_0x3c4397=_[_0xb930('0x3b')](_0x3c4397,_0x50db69['extensions']);}}return _0xbd8d2d['transaction'](function(_0x45eec9){return _0xbd8d2d[_0xb930('0x2')][_0xb930('0x7')][_0xb930('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x7aa2dd}},'transaction':_0x45eec9})[_0xb930('0x5')](function(_0x16b26d){return _0xbd8d2d[_0xb930('0x2')]['VoiceExtension'][_0xb930('0x3e')](_['sortBy'](_0x3c4397,_0xb930('0xd')),{'transaction':_0x45eec9});});});})[_0xb930('0x3f')](function(_0x34a7bd){console[_0xb930('0x40')](_0x34a7bd);});}exports[_0xb930('0x41')]=rewrite; \ No newline at end of file +var _0x55b4=['find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','IntervalId','map','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','error','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension'];(function(_0x309e52,_0x26c91b){var _0x2797c6=function(_0x1f333f){while(--_0x1f333f){_0x309e52['push'](_0x309e52['shift']());}};_0x2797c6(++_0x26c91b);}(_0x55b4,0x112));var _0x455b=function(_0x47c59a,_0x1be051){_0x47c59a=_0x47c59a-0x0;var _0xecc5a5=_0x55b4[_0x47c59a];return _0xecc5a5;};'use strict';var _=require('lodash');var util=require(_0x455b('0x0'));function rewrite(_0x28191c,_0x5cfd71){var _0x33b780=this;return _0x28191c[_0x455b('0x1')][_0x455b('0x2')][_0x455b('0x3')]({'raw':!![]})[_0x455b('0x4')](function(_0x22530e){_0x33b780[_0x455b('0x5')]=_0x22530e;return _0x28191c[_0x455b('0x1')][_0x455b('0x6')]['findAll']({'where':{'IntervalId':_0x5cfd71['IntervalId']},'raw':!![]});})[_0x455b('0x4')](function(_0x2ee6e4){return _0x28191c[_0x455b('0x1')][_0x455b('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x455b('0x7')](_['map'](_0x2ee6e4,_0x455b('0x8')))}},'order':[{'raw':_0x455b('0x9')}],'raw':!![]});})['then'](function(_0x30cfbe){var _0x4a402d=_[_0x455b('0xa')](_0x30cfbe,{'priority':'1'});var _0x5b0bd4=_[_0x455b('0xa')](_0x30cfbe,{'isApp':0x1});var _0x1ddd78=_[_0x455b('0xb')](_0x5b0bd4,_0x455b('0x8'));var _0x41ba79=[_0x455b('0xc'),_0x455b('0xd')];var _0x58c8a1=[];var _0x27cb35=[];for(var _0x15c01c in _0x1ddd78){if(_0x1ddd78[_0x455b('0xe')](_0x15c01c)){_0x33b780[_0x455b('0xf')]=0x2;_0x33b780[_0x455b('0x10')]=[];_0x33b780[_0x455b('0x11')]=_[_0x455b('0x12')](_0x4a402d,{'exten':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x8')]});_0x33b780[_0x455b('0x10')][_0x455b('0x13')]({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':_0x455b('0x15'),'appdata':util['format'](_0x455b('0x16'),_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')]),'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x8')],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});if(_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')]===_0x455b('0x19')){_0x33b780[_0x455b('0x10')]['push']({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':_0x455b('0x15'),'appdata':_0x455b('0x1a')+_0x1ddd78[_0x15c01c][0x0]['VoiceExtensionId'],'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x8')],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});}else if(_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')]===_0x455b('0x1b')){if(_0x33b780['extension']){_0x33b780['extensions']['push']({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':'Set','appdata':'CDR(destination)='+(_0x33b780['extension']['cutdigits']?_0x455b('0x1c')+_0x33b780[_0x455b('0x11')][_0x455b('0x1d')]+'}':_0x455b('0x1e')),'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0]['exten'],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});}_0x33b780[_0x455b('0x10')]['push']({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':_0x455b('0x15'),'appdata':_0x455b('0x1a')+_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')],'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0]['exten'],'priority':_0x33b780['priority']++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});var _0x5e0264=_0x33b780[_0x455b('0xf')]++;_0x33b780[_0x455b('0x10')]['push']({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':'ExecIf','appdata':_0x455b('0x1f')+(_0x5e0264+0x2)+_0x455b('0x20')+(_0x5e0264+0x1)+')','context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0]['exten'],'priority':_0x5e0264,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0]['VoiceExtensionId']});if(_0x33b780[_0x455b('0x11')]){_0x33b780[_0x455b('0x10')][_0x455b('0x13')]({'type':_0x1ddd78[_0x15c01c][0x0]['type'],'app':_0x455b('0x15'),'appdata':_0x33b780[_0x455b('0x11')][_0x455b('0x1d')]?_0x455b('0x21')+_0x33b780['extension'][_0x455b('0x1d')]+'}':_0x455b('0x22'),'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x8')],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});}_0x33b780[_0x455b('0x10')]['push']({'type':_0x1ddd78[_0x15c01c][0x0]['type'],'app':_0x455b('0x15'),'appdata':_0x455b('0x23')+_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')],'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0]['exten'],'priority':_0x33b780['priority']++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});if(_0x33b780[_0x455b('0x11')]&&_0x33b780[_0x455b('0x11')][_0x455b('0xe')](_0x455b('0x24'))&&_0x33b780['extension'][_0x455b('0x24')]!==_0x455b('0x25')){_0x33b780[_0x455b('0x10')][_0x455b('0x13')]({'type':_0x1ddd78[_0x15c01c][0x0]['type'],'app':_0x455b('0x15'),'appdata':_0x455b('0x26'),'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x8')],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});_0x33b780[_0x455b('0x10')][_0x455b('0x13')]({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':_0x455b('0x15'),'appdata':_0x455b('0x27')+_0x33b780['extension'][_0x455b('0x24')]||_0x455b('0x28'),'context':_0x1ddd78[_0x15c01c][0x0]['context'],'exten':_0x1ddd78[_0x15c01c][0x0]['exten'],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});}}_0x33b780['extensions'][_0x455b('0x13')]({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':_0x455b('0x15'),'appdata':_0x455b('0x29'),'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x8')],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});_0x33b780['extensions']['push']({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':_0x455b('0x15'),'appdata':_0x455b('0x2a'),'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0]['exten'],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});_0x33b780[_0x455b('0x10')][_0x455b('0x13')]({'type':_0x1ddd78[_0x15c01c][0x0]['type'],'app':_0x455b('0x15'),'appdata':_0x455b('0x2b'),'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'exten':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x8')],'priority':_0x33b780[_0x455b('0xf')]++,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0]['VoiceExtensionId']});for(var _0xe924b=0x0,_0x5664e0=0x0;_0xe924b<_0x1ddd78[_0x15c01c][_0x455b('0x2c')];_0xe924b+=0x1,_0x5664e0=0x0){var _0x118e7a=_0x1ddd78[_0x15c01c][_0xe924b];if(_0x118e7a[_0x455b('0x14')]){_0x118e7a[_0x455b('0x14')]=_0x118e7a[_0x455b('0x14')][_0x455b('0x2d')]();}var _0x1b9658=[];var _0x36096d=[];delete _0x118e7a['id'];delete _0x118e7a['createdAt'];delete _0x118e7a[_0x455b('0x2e')];var _0xc7de36=_0x118e7a[_0x455b('0x2f')]!=='*,*,*,*'?[_0x118e7a['interval']]:_0x118e7a[_0x455b('0x30')]?_[_0x455b('0x31')](_[_0x455b('0xa')](_0x33b780[_0x455b('0x5')],{'IntervalId':_0x118e7a[_0x455b('0x30')]}),_0x455b('0x2f')):[];if(_0x118e7a[_0x455b('0xe')](_0x455b('0x32'))){if(_0x118e7a[_0x455b('0x32')]&&_0x118e7a['tag']!=='--'){_0x1b9658[_0x455b('0x13')]({'type':_0x118e7a['type'],'app':_0x455b('0x15'),'appdata':_0x455b('0x33')+_0x118e7a[_0x455b('0x32')],'context':_0x118e7a[_0x455b('0x17')],'exten':_0x118e7a['exten'],'priority':_0xc7de36[_0x455b('0x2c')]+_0x33b780[_0x455b('0xf')]+_0x5664e0++,'VoiceExtensionId':_0x118e7a[_0x455b('0x18')]});}}if(_0x118e7a['type']===_0x455b('0x1b')&&_0x118e7a[_0x455b('0xe')](_0x455b('0x34'))){if(_0x118e7a[_0x455b('0x34')]){_0x1b9658[_0x455b('0x13')]({'type':_0x118e7a[_0x455b('0x14')],'app':_0x455b('0x35'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x118e7a[_0x455b('0x34')]+')','context':_0x118e7a[_0x455b('0x17')],'exten':_0x118e7a[_0x455b('0x8')],'priority':_0xc7de36['length']+_0x33b780['priority']+_0x5664e0++,'VoiceExtensionId':_0x118e7a['VoiceExtensionId']});}else{_0x1b9658[_0x455b('0x13')]({'type':_0x118e7a[_0x455b('0x14')],'app':'ExecIf','appdata':_0x455b('0x36'),'context':_0x118e7a['context'],'exten':_0x118e7a['exten'],'priority':_0xc7de36[_0x455b('0x2c')]+_0x33b780[_0x455b('0xf')]+_0x5664e0++,'VoiceExtensionId':_0x118e7a['VoiceExtensionId']});}}if(_0x118e7a[_0x455b('0xe')](_0x455b('0x37'))){if(_0x41ba79[_0x455b('0x38')](_0x118e7a[_0x455b('0x39')][_0x455b('0x2d')]())>=0x0&&_0x118e7a[_0x455b('0x3a')]!==_0x455b('0x3b')){if(_0x118e7a[_0x455b('0x37')]){_0x1b9658[_0x455b('0x13')]({'type':_0x118e7a[_0x455b('0x14')],'app':_0x455b('0x35'),'appdata':_0x455b('0x3c'),'context':_0x118e7a[_0x455b('0x17')],'exten':_0x118e7a[_0x455b('0x8')],'priority':_0xc7de36[_0x455b('0x2c')]+_0x33b780[_0x455b('0xf')]+_0x5664e0++,'VoiceExtensionId':_0x118e7a[_0x455b('0x18')]});_0x1b9658[_0x455b('0x13')]({'type':_0x118e7a[_0x455b('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x118e7a[_0x455b('0x17')],'exten':_0x118e7a[_0x455b('0x8')],'priority':_0xc7de36['length']+_0x33b780[_0x455b('0xf')]+_0x5664e0++,'VoiceExtensionId':_0x118e7a[_0x455b('0x18')]});}else{_0x1b9658['push']({'type':_0x118e7a['type'],'app':_0x455b('0x35'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x118e7a[_0x455b('0x17')],'exten':_0x118e7a['exten'],'priority':_0xc7de36[_0x455b('0x2c')]+_0x33b780[_0x455b('0xf')]+_0x5664e0++,'VoiceExtensionId':_0x118e7a[_0x455b('0x18')]});_0x1b9658['push']({'type':_0x118e7a['type'],'app':_0x455b('0x15'),'appdata':_0x455b('0x3d'),'context':_0x118e7a[_0x455b('0x17')],'exten':_0x118e7a[_0x455b('0x8')],'priority':_0xc7de36['length']+_0x33b780[_0x455b('0xf')]+_0x5664e0++,'VoiceExtensionId':_0x118e7a[_0x455b('0x18')]});}}}for(var _0x472c49=0x0;_0x472c49<_0xc7de36['length'];_0x472c49+=0x1){var _0x53490f=_0x33b780[_0x455b('0xf')]+_0xc7de36['length'];var _0x220af4=_0x472c49===_0xc7de36['length']-0x1?_0x33b780[_0x455b('0xf')]+_0x1b9658['length']+_0x36096d[_0x455b('0x2c')]+0x2:_0x33b780[_0x455b('0xf')]+_0x472c49+0x1;_0x1b9658[_0x455b('0x3e')](_0x472c49,0x0,{'type':_0x118e7a[_0x455b('0x14')],'app':_0x455b('0x3f'),'appdata':_0xc7de36[_0x472c49]+'?'+_0x118e7a[_0x455b('0x17')]+_0x455b('0x40')+_0x53490f+':'+_0x118e7a[_0x455b('0x17')]+',${EXTEN},'+_0x220af4,'exten':_0x118e7a[_0x455b('0x8')],'context':_0x118e7a['context'],'priority':_0x33b780[_0x455b('0xf')]+_0x472c49,'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0]['VoiceExtensionId']});}_0x118e7a[_0x455b('0xf')]=_0x1b9658[_0x455b('0x2c')]?_[_0x455b('0x41')](_0x1b9658)[_0x455b('0xf')]+0x1:_0x33b780[_0x455b('0xf')];_0x33b780[_0x455b('0xf')]=(_0x36096d[_0x455b('0x2c')]?_['last'](_0x36096d)[_0x455b('0xf')]:_0x118e7a['priority'])+0x1;_0x33b780[_0x455b('0x10')]=_['concat'](_0x33b780[_0x455b('0x10')],_0x1b9658,[_0x118e7a],_0x36096d);}_0x33b780[_0x455b('0x10')][_0x455b('0x13')]({'type':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x14')],'app':_0x455b('0x42'),'exten':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x8')],'context':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x17')],'priority':_0x33b780[_0x455b('0xf')],'VoiceExtensionId':_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]});_0x58c8a1[_0x455b('0x13')](_0x1ddd78[_0x15c01c][0x0][_0x455b('0x18')]);_0x27cb35=_[_0x455b('0x43')](_0x27cb35,_0x33b780['extensions']);}}return _0x28191c['transaction'](function(_0x3b9d67){return _0x28191c[_0x455b('0x1')][_0x455b('0x6')][_0x455b('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x58c8a1}},'transaction':_0x3b9d67})['then'](function(_0x292241){return _0x28191c[_0x455b('0x1')][_0x455b('0x6')][_0x455b('0x45')](_[_0x455b('0x46')](_0x27cb35,'priority'),{'transaction':_0x3b9d67});});});})[_0x455b('0x47')](function(_0x5cc96d){console[_0x455b('0x48')](_0x5cc96d);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 00b6cc7..e46642e 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 _0x6593=['query','VoiceQueueId','onlyIfOpen','catch','all','Campaign','findAll','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','resolve','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','CmContact','create','keys','push','pick','stringify','cmContact','inspect','insert','into','cm_hopper','scheduledAt','createdAt','updatedAt','field','ContactId','toString','NOW()','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','fromQuery','id\x20IN\x20?','str','cm_hopper_final','\x20=\x20?','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','then','get','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6593,0x1c1));var _0x3659=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x6593[_0x1bfe2b];return _0x1477d4;};'use strict';var BPromise=require(_0x3659('0x0'));var util=require(_0x3659('0x1'));var _=require(_0x3659('0x2'));var fs=require('fs');var squel=require(_0x3659('0x3'));var Papa=require('papaparse');var Redis=require(_0x3659('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3659('0x5'));config[_0x3659('0x6')]=_[_0x3659('0x7')](config[_0x3659('0x6')],{'host':_0x3659('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3659('0x6')]));require(_0x3659('0x9'))[_0x3659('0xa')](socket);try{if(!process[_0x3659('0xb')][0x2]||process[_0x3659('0xb')][0x2]===_0x3659('0xc')||process[_0x3659('0xb')][0x2]===_0x3659('0xd')){throw new Error(_0x3659('0xe'));}var FILEPATH=process[_0x3659('0xb')][0x2];if(!process['argv'][0x3]||process[_0x3659('0xb')][0x3]===_0x3659('0xc')||process[_0x3659('0xb')][0x3]===_0x3659('0xd')||!process[_0x3659('0xb')][0x4]||process[_0x3659('0xb')][0x4]===_0x3659('0xc')||process[_0x3659('0xb')][0x4]===_0x3659('0xd')){throw new Error(_0x3659('0xf'));}var FIELDS=_[_0x3659('0x10')](process[_0x3659('0xb')][0x3]['split'](','),process[_0x3659('0xb')][0x4][_0x3659('0x11')](','));if(!process['argv'][0x5]||process['argv'][0x5]==='undefined'||process[_0x3659('0xb')][0x5]===_0x3659('0xd')){throw new Error(_0x3659('0x12'));}var LISTID=process[_0x3659('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x3659('0xb')][0x6]!==_0x3659('0xc')&&process['argv'][0x6]!==_0x3659('0xd')?process[_0x3659('0xb')][0x6]:null;var DUPLICATES=process[_0x3659('0xb')][0x7]&&process['argv'][0x7]!==_0x3659('0xc')&&process[_0x3659('0xb')][0x7]!==_0x3659('0xd')?process[_0x3659('0xb')][0x7]:null;if(!process[_0x3659('0xb')][0x8]||process[_0x3659('0xb')][0x8]==='undefined'||process[_0x3659('0xb')][0x8]===_0x3659('0xd')){throw new Error(_0x3659('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3e2c44){logger[_0x3659('0x14')](_0x3e2c44);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(_0x4b19fb,_0x3cb1cc,_0x154d79,_0x337ef0){var _0x295b94={'message':_0x3cb1cc};_0x295b94[_0x4b19fb]=!![];if(_0x154d79){_0x295b94['contact']=_0x154d79;}if(_0x337ef0){_0x295b94[_0x3659('0x15')]=_0x337ef0;}return _0x295b94;}function isEmail(_0x30a036){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30a036);}function checkRow(_0x162ea1,_0xbec9e5,_0x56d14f){return new BPromise(function(_0x280695,_0x30f379){if(_['isNil'](_0x162ea1)){return _0x30f379(handleCheckRowError(_0x3659('0x14'),_0x3659('0x16'),null,_0x56d14f));}if(_0x162ea1[_0x3659('0x17')]&&_0x162ea1[_0x3659('0x17')][_0x3659('0x18')]){var _0x5afd79=_[_0x3659('0x19')](_0x162ea1[_0x3659('0x17')],_0x3659('0x1a'))[_0x3659('0x1b')](';');return _0x30f379(handleCheckRowError(_0x3659('0x14'),_0x5afd79,null,_0x56d14f));}var _0x27a1f2={};for(var _0x3d2d94 in FIELDS){if(FIELDS['hasOwnProperty'](_0x3d2d94)&&FIELDS[_0x3d2d94]){_0x27a1f2[_0x3d2d94]=_0x162ea1[_0x3659('0x1c')][0x0][FIELDS[_0x3d2d94]]||_0x162ea1['data'][0x0]['\ufeff'+FIELDS[_0x3d2d94]];}}if(!_0x27a1f2[_0x3659('0x1d')]){return _0x30f379(handleCheckRowError('error',_0x3659('0x1e'),null,_0x56d14f));}if(!_0x27a1f2[_0x3659('0x1f')]){return _0x30f379(handleCheckRowError(_0x3659('0x14'),'phone\x20not\x20specified!',null,_0x56d14f));}if(_0x27a1f2['birthDate']){var _0x569c74=moment(_0x27a1f2[_0x3659('0x20')],_0x3659('0x21'));if(!_0x569c74[_0x3659('0x22')]()){return _0x30f379(handleCheckRowError('error',_0x3659('0x23'),null,_0x56d14f));}}if(_0x27a1f2[_0x3659('0x24')]){if(!isEmail(_0x27a1f2[_0x3659('0x24')])){return _0x30f379(handleCheckRowError(_0x3659('0x14'),_0x3659('0x25'),null,_0x56d14f));}}_0x27a1f2[_0x3659('0x26')]=LISTID;_0x27a1f2[_0x3659('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3659('0x18')]&&_0xbec9e5){var _0x4dc0b2={};for(var _0x252604=0x0,_0x7d34a9=DUPLICATES[_0x3659('0x18')];_0x252604<_0x7d34a9;_0x252604+=0x1){_0x4dc0b2[DUPLICATES[_0x252604]]=_0x27a1f2[DUPLICATES[_0x252604]];}var _0x3849c0=_[_0x3659('0x28')](_0xbec9e5,_0x4dc0b2);if(_0x3849c0){return _0x30f379(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x3849c0,_0x56d14f));}}return db[_0x3659('0x29')][_0x3659('0x2a')](_0x27a1f2,{'raw':!![],'hooks':![],'fields':_[_0x3659('0x2b')](_0x27a1f2)})['then'](function(_0x45a288){if(DUPLICATES&&DUPLICATES[_0x3659('0x18')]&&_0xbec9e5){_0xbec9e5[_0x3659('0x2c')](_[_0x3659('0x2d')](_0x27a1f2,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x45a288['id'];return _0x280695();})['catch'](function(_0x57cdcf){return _0x30f379(handleCheckRowError(_0x3659('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x57cdcf[_0x3659('0x1a')]||JSON[_0x3659('0x2e')](_0x57cdcf)),null,_0x56d14f));});});}function checkHopper(){function _0x29c93d(){return function(_0x45ab54){logger[_0x3659('0x14')](_0x3659('0x2f'),'checkHopper',util[_0x3659('0x30')](_0x45ab54,{'showHidden':![],'depth':null}));};}var _0x4b0d21=function(_0x189208,_0x38e2e6){var _0x32d998=squel[_0x3659('0x31')]()[_0x3659('0x32')](_0x3659('0x33'))['fromQuery']([_0x3659('0x1f'),_0x3659('0x34'),'ContactId','ListId',_0x38e2e6,_0x3659('0x35'),_0x3659('0x36')],squel['select']()[_0x3659('0x37')]('phone','phone')['field']('NOW()',_0x3659('0x34'))[_0x3659('0x37')]('id',_0x3659('0x38'))[_0x3659('0x37')](LISTID[_0x3659('0x39')](),_0x3659('0x26'))[_0x3659('0x37')](_0x189208['id'][_0x3659('0x39')](),_0x38e2e6)[_0x3659('0x37')](_0x3659('0x3a'),_0x3659('0x35'))[_0x3659('0x37')]('NOW()',_0x3659('0x36'))[_0x3659('0x3b')](_0x3659('0x3c'))[_0x3659('0x3d')]('deletedAt\x20IS\x20NULL')[_0x3659('0x3d')](_0x3659('0x3e'),LISTID[_0x3659('0x39')]())[_0x3659('0x3d')](_0x3659('0x3f'))[_0x3659('0x3d')](_0x3659('0x40'),squel[_0x3659('0x41')]()[_0x3659('0x37')](_0x3659('0x1f'))[_0x3659('0x3b')](_0x3659('0x33'))[_0x3659('0x3d')](_0x38e2e6+'\x20=\x20?',_0x189208['id']['toString']())))[_0x3659('0x39')]();return _0x32d998;};var _0x589dc9=function(_0x531f8c,_0x12df78){var _0x49abeb=squel[_0x3659('0x31')]()[_0x3659('0x32')](_0x3659('0x33'))[_0x3659('0x42')]([_0x3659('0x1f'),_0x3659('0x34'),'ContactId',_0x3659('0x26'),_0x12df78,_0x3659('0x35'),'updatedAt'],squel[_0x3659('0x41')]()[_0x3659('0x37')](_0x3659('0x1f'),'phone')['field']('NOW()','scheduledAt')[_0x3659('0x37')]('id',_0x3659('0x38'))[_0x3659('0x37')](LISTID[_0x3659('0x39')](),_0x3659('0x26'))[_0x3659('0x37')](_0x531f8c['id'][_0x3659('0x39')](),_0x12df78)['field']('NOW()',_0x3659('0x35'))[_0x3659('0x37')](_0x3659('0x3a'),_0x3659('0x36'))[_0x3659('0x3b')]('cm_contacts')[_0x3659('0x3d')]('deletedAt\x20IS\x20NULL')[_0x3659('0x3d')](_0x3659('0x3e'),LISTID[_0x3659('0x39')]())[_0x3659('0x3d')](_0x3659('0x43'),squel[_0x3659('0x44')](hopperContacts))[_0x3659('0x3d')](_0x3659('0x3f'))[_0x3659('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3659('0x41')]()[_0x3659('0x37')]('calleridnum')[_0x3659('0x3b')](_0x3659('0x45'))[_0x3659('0x3d')](_0x12df78+_0x3659('0x46'),_0x531f8c['id'][_0x3659('0x39')]()))[_0x3659('0x3d')](_0x3659('0x40'),squel[_0x3659('0x41')]()['field'](_0x3659('0x1f'))[_0x3659('0x3b')]('cm_hopper')[_0x3659('0x3d')](_0x12df78+_0x3659('0x46'),_0x531f8c['id'][_0x3659('0x39')]())))['toString']();return _0x49abeb;};function _0x1d61fe(_0x1da0ff,_0x3857c6){var _0x30ed75=squel[_0x3659('0x31')]()[_0x3659('0x32')]('cm_hopper')[_0x3659('0x42')](['phone','scheduledAt',_0x3659('0x38'),_0x3659('0x26'),_0x3857c6,_0x3659('0x35'),_0x3659('0x36')],squel[_0x3659('0x41')]()['field'](_0x3659('0x1f'),'phone')['field'](_0x3659('0x3a'),'scheduledAt')[_0x3659('0x37')]('id',_0x3659('0x38'))[_0x3659('0x37')](LISTID[_0x3659('0x39')](),_0x3659('0x26'))[_0x3659('0x37')](_0x1da0ff['id']['toString'](),_0x3857c6)[_0x3659('0x37')]('NOW()','createdAt')[_0x3659('0x37')]('NOW()',_0x3659('0x36'))[_0x3659('0x3b')](_0x3659('0x3c'))[_0x3659('0x3d')](_0x3659('0x47'))[_0x3659('0x3d')](_0x3659('0x3e'),LISTID[_0x3659('0x39')]())['where']('id\x20IN\x20?',squel[_0x3659('0x44')](hopperContacts))[_0x3659('0x3d')](_0x3659('0x3f')))['toString']();return _0x30ed75;}function _0x230d02(_0x3cbd38,_0x43e269){var _0x3ca941=squel[_0x3659('0x31')]()[_0x3659('0x32')](_0x3659('0x48'))['fromQuery']([_0x3659('0x1f'),'ContactId','ListId',_0x43e269,'createdAt','updatedAt'],squel[_0x3659('0x41')]()[_0x3659('0x37')](_0x3659('0x1f'),_0x3659('0x1f'))[_0x3659('0x37')]('id','ContactId')['field'](LISTID[_0x3659('0x39')](),'ListId')['field'](_0x3cbd38['id']['toString'](),_0x43e269)[_0x3659('0x37')](_0x3659('0x3a'),_0x3659('0x35'))[_0x3659('0x37')](_0x3659('0x3a'),_0x3659('0x36'))[_0x3659('0x3b')](_0x3659('0x3c'))[_0x3659('0x3d')](_0x3659('0x47'))[_0x3659('0x3d')](_0x3659('0x3e'),LISTID[_0x3659('0x39')]())['where']('id\x20IN\x20?',squel[_0x3659('0x44')](hopperContacts))[_0x3659('0x3d')](_0x3659('0x3f')))[_0x3659('0x39')]();return _0x3ca941;}return db[_0x3659('0x49')]['findAll']({'where':{'type':_0x3659('0x4a')},'attributes':['id',_0x3659('0x4b')],'include':[{'model':db[_0x3659('0x4c')],'as':_0x3659('0x4d'),'where':{'id':LISTID}}]})[_0x3659('0x4e')](function(_0x2f2faf){var _0x46302f=[];if(_0x2f2faf){var _0x5abc39;for(var _0x303954=0x0,_0x196236;_0x303954<_0x2f2faf[_0x3659('0x18')];_0x303954+=0x1){_0x196236=_0x2f2faf[_0x303954][_0x3659('0x4f')]({'plain':!![]});switch(_0x196236[_0x3659('0x4b')]){case'always':_0x46302f[_0x3659('0x2c')](db[_0x3659('0x50')][_0x3659('0x51')](_0x589dc9(_0x196236,_0x3659('0x52')))[_0x3659('0x4e')](function(){})['catch'](_0x29c93d()));break;case _0x3659('0x53'):_0x46302f[_0x3659('0x2c')](db[_0x3659('0x50')][_0x3659('0x51')](_0x4b0d21(_0x196236,_0x3659('0x52')))[_0x3659('0x4e')](function(){})[_0x3659('0x54')](_0x29c93d()));break;default:_0x46302f[_0x3659('0x2c')](db['sequelize']['query'](_0x1d61fe(_0x196236,'VoiceQueueId'))[_0x3659('0x4e')](function(){})[_0x3659('0x54')](_0x29c93d()));}}}return _0x46302f;})[_0x3659('0x55')]()[_0x3659('0x4e')](function(){return db[_0x3659('0x49')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x3659('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3659('0x4e')](function(_0x543873){var _0xd75f5a=[];if(_0x543873){var _0x498325;for(var _0x297d0f=0x0,_0x5c7ca6;_0x297d0f<_0x543873['length'];_0x297d0f+=0x1){_0x5c7ca6=_0x543873[_0x297d0f][_0x3659('0x4f')]({'plain':!![]});_0xd75f5a['push'](db[_0x3659('0x50')][_0x3659('0x51')](_0x230d02(_0x5c7ca6,_0x3659('0x52')))[_0x3659('0x4e')](function(){})[_0x3659('0x54')](_0x29c93d()));}}return _0xd75f5a;})[_0x3659('0x55')]();})[_0x3659('0x4e')](function(){return db[_0x3659('0x56')][_0x3659('0x57')]({'attributes':['id',_0x3659('0x4b')],'include':[{'model':db[_0x3659('0x4c')],'as':_0x3659('0x4d'),'where':{'id':LISTID}}]})[_0x3659('0x4e')](function(_0x44b0e5){var _0x164009=[];if(_0x44b0e5){for(var _0x3d53e9=0x0,_0x481db7;_0x3d53e9<_0x44b0e5[_0x3659('0x18')];_0x3d53e9+=0x1){_0x481db7=_0x44b0e5[_0x3d53e9]['get']({'plain':!![]});switch(_0x481db7[_0x3659('0x4b')]){case _0x3659('0x58'):_0x164009[_0x3659('0x2c')](db[_0x3659('0x50')][_0x3659('0x51')](_0x589dc9(_0x481db7,'CampaignId'))[_0x3659('0x4e')](function(){})[_0x3659('0x54')](_0x29c93d()));break;case _0x3659('0x53'):_0x164009[_0x3659('0x2c')](db[_0x3659('0x50')]['query'](_0x4b0d21(_0x481db7,_0x3659('0x59')))[_0x3659('0x4e')](function(){})['catch'](_0x29c93d()));break;default:_0x164009[_0x3659('0x2c')](db['sequelize'][_0x3659('0x51')](_0x1d61fe(_0x481db7,_0x3659('0x59')))['then'](function(){})[_0x3659('0x54')](_0x29c93d()));}}}return _0x164009;})[_0x3659('0x55')]();})[_0x3659('0x4e')](function(){return db[_0x3659('0x56')][_0x3659('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x3659('0x5a'),'where':{'id':LISTID}}]})[_0x3659('0x4e')](function(_0x3ee57c){var _0x136841=[];if(_0x3ee57c){for(var _0x38db8a=0x0,_0x158969;_0x38db8a<_0x3ee57c[_0x3659('0x18')];_0x38db8a+=0x1){_0x158969=_0x3ee57c[_0x38db8a][_0x3659('0x4f')]({'plain':!![]});_0x136841['push'](db[_0x3659('0x50')]['query'](_0x230d02(_0x158969,_0x3659('0x59')))[_0x3659('0x4e')](function(){})[_0x3659('0x54')](_0x29c93d()));}}return _0x136841;})[_0x3659('0x55')]();})[_0x3659('0x54')](function(_0x18e95d){logger[_0x3659('0x14')](_0x3659('0x5b'),'generalCheckHopper',_0x18e95d[_0x3659('0x1a')]);});}var processPromises=function(_0x413e32){return BPromise['all'](promises)['then'](function(_0x28d09e){})[_0x3659('0x54')](function(_0xaf4791){logger[_0x3659('0x14')](_0x3659('0x5c'),JSON[_0x3659('0x2e')](_0xaf4791));})[_0x3659('0x5d')](function(){socket['emit'](_0x3659('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x413e32){return _0x413e32[_0x3659('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3659('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0x3659('0x4e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3659('0x60')](FILEPATH);}catch(_0x43dd94){logger[_0x3659('0x14')](_0x3659('0x61'),JSON['stringify'](_0x43dd94));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x3659('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3659('0x63')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3659('0x29')][_0x3659('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3659('0x4e')](function(_0x5b4503){var _0x23f7b9=fs[_0x3659('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3659('0x65')](_0x23f7b9,{'header':!![],'skipEmptyLines':!![],'step':function(_0x156f16,_0x46ab1e){total+=0x1;var _0x3f1bfc=total;promises['push'](checkRow(_0x156f16,_0x5b4503,_0x3f1bfc)['then'](function(){success+=0x1;})[_0x3659('0x54')](function(_0x191e4e){if(_0x191e4e[_0x3659('0x14')]){errors+=0x1;delete _0x191e4e['error'];}else if(_0x191e4e['duplicate']){duplicates+=0x1;delete _0x191e4e[_0x3659('0x66')];}rows[_0x3659('0x2c')](_0x191e4e);}));if(total%0xc8===0x0){_0x46ab1e[_0x3659('0x67')]();return processPromises(_0x46ab1e);}},'complete':function(){return processPromises()['then'](function(){logger[_0x3659('0x62')](_0x3659('0x68'));endCsv();});},'error':function(_0x26dcb7,_0x39c4e3){logger[_0x3659('0x62')]('CSV\x20parse\x20error',JSON[_0x3659('0x2e')](_0x26dcb7));endCsv();}});})[_0x3659('0x54')](function(_0x3205f4){logger[_0x3659('0x14')](_0x3659('0x69'),JSON[_0x3659('0x2e')](_0x3205f4));});}main(); \ No newline at end of file +var _0xaee9=['query','VoiceQueueId','catch','onlyIfOpen','all','outbound','BlackLists','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','duplicate','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','Duplicate\x20Contact','CmContact','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','into','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','get','always','sequelize'];(function(_0x391ff4,_0x5a821c){var _0x5437d8=function(_0x302618){while(--_0x302618){_0x391ff4['push'](_0x391ff4['shift']());}};_0x5437d8(++_0x5a821c);}(_0xaee9,0x16b));var _0x9aee=function(_0x5dd9f7,_0x40b41b){_0x5dd9f7=_0x5dd9f7-0x0;var _0x41569c=_0xaee9[_0x5dd9f7];return _0x41569c;};'use strict';var BPromise=require('bluebird');var util=require(_0x9aee('0x0'));var _=require(_0x9aee('0x1'));var fs=require('fs');var squel=require(_0x9aee('0x2'));var Papa=require(_0x9aee('0x3'));var Redis=require(_0x9aee('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x9aee('0x5'));var logger=require(_0x9aee('0x6'))(_0x9aee('0x7'));config[_0x9aee('0x8')]=_[_0x9aee('0x9')](config[_0x9aee('0x8')],{'host':_0x9aee('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9aee('0xb'))['register'](socket);try{if(!process[_0x9aee('0xc')][0x2]||process[_0x9aee('0xc')][0x2]===_0x9aee('0xd')||process[_0x9aee('0xc')][0x2]===_0x9aee('0xe')){throw new Error(_0x9aee('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0x9aee('0xc')][0x3]||process[_0x9aee('0xc')][0x3]===_0x9aee('0xd')||process['argv'][0x3]===_0x9aee('0xe')||!process[_0x9aee('0xc')][0x4]||process['argv'][0x4]==='undefined'||process[_0x9aee('0xc')][0x4]==='null'){throw new Error(_0x9aee('0x10'));}var FIELDS=_[_0x9aee('0x11')](process['argv'][0x3]['split'](','),process[_0x9aee('0xc')][0x4][_0x9aee('0x12')](','));if(!process[_0x9aee('0xc')][0x5]||process['argv'][0x5]===_0x9aee('0xd')||process['argv'][0x5]===_0x9aee('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x9aee('0xc')][0x6]&&process[_0x9aee('0xc')][0x6]!==_0x9aee('0xd')&&process['argv'][0x6]!==_0x9aee('0xe')?process[_0x9aee('0xc')][0x6]:null;var DUPLICATES=process[_0x9aee('0xc')][0x7]&&process['argv'][0x7]!==_0x9aee('0xd')&&process[_0x9aee('0xc')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x9aee('0xc')][0x8]||process[_0x9aee('0xc')][0x8]===_0x9aee('0xd')||process[_0x9aee('0xc')][0x8]===_0x9aee('0xe')){throw new Error(_0x9aee('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x343d32){logger[_0x9aee('0x14')](_0x343d32);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(_0x500a06,_0x80ff22,_0x5315b3,_0x18372c){var _0x266fa1={'message':_0x80ff22};_0x266fa1[_0x500a06]=!![];if(_0x5315b3){_0x266fa1['contact']=_0x5315b3;}if(_0x18372c){_0x266fa1[_0x9aee('0x15')]=_0x18372c;}return _0x266fa1;}function isEmail(_0x8468b5){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))*$/[_0x9aee('0x16')](_0x8468b5);}function checkRow(_0xc8bf29,_0x366f2c,_0x5f34bb){return new BPromise(function(_0x18c8b6,_0x160174){if(_[_0x9aee('0x17')](_0xc8bf29)){return _0x160174(handleCheckRowError('error',_0x9aee('0x18'),null,_0x5f34bb));}if(_0xc8bf29[_0x9aee('0x19')]&&_0xc8bf29[_0x9aee('0x19')][_0x9aee('0x1a')]){var _0x31ff41=_[_0x9aee('0x1b')](_0xc8bf29['errors'],_0x9aee('0x1c'))[_0x9aee('0x1d')](';');return _0x160174(handleCheckRowError(_0x9aee('0x14'),_0x31ff41,null,_0x5f34bb));}var _0x4f9e8b={};for(var _0x37c8d9 in FIELDS){if(FIELDS[_0x9aee('0x1e')](_0x37c8d9)&&FIELDS[_0x37c8d9]){_0x4f9e8b[_0x37c8d9]=_0xc8bf29[_0x9aee('0x1f')][0x0][FIELDS[_0x37c8d9]]||_0xc8bf29[_0x9aee('0x1f')][0x0]['\ufeff'+FIELDS[_0x37c8d9]];}}if(!_0x4f9e8b[_0x9aee('0x20')]){return _0x160174(handleCheckRowError(_0x9aee('0x14'),_0x9aee('0x21'),null,_0x5f34bb));}if(!_0x4f9e8b['phone']){return _0x160174(handleCheckRowError(_0x9aee('0x14'),_0x9aee('0x22'),null,_0x5f34bb));}if(_0x4f9e8b[_0x9aee('0x23')]){var _0x31f53e=moment(_0x4f9e8b['birthDate'],'YYYY-MM-DD');if(!_0x31f53e[_0x9aee('0x24')]()){return _0x160174(handleCheckRowError('error',_0x9aee('0x25'),null,_0x5f34bb));}}if(_0x4f9e8b[_0x9aee('0x26')]){if(!isEmail(_0x4f9e8b[_0x9aee('0x26')])){return _0x160174(handleCheckRowError(_0x9aee('0x14'),_0x9aee('0x27'),null,_0x5f34bb));}}_0x4f9e8b['ListId']=LISTID;_0x4f9e8b[_0x9aee('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9aee('0x1a')]&&_0x366f2c){var _0x3d6d4a={};for(var _0x5a74b0=0x0,_0x3b4324=DUPLICATES['length'];_0x5a74b0<_0x3b4324;_0x5a74b0+=0x1){_0x3d6d4a[DUPLICATES[_0x5a74b0]]=_0x4f9e8b[DUPLICATES[_0x5a74b0]];}var _0x3837ac=_[_0x9aee('0x29')](_0x366f2c,_0x3d6d4a);if(_0x3837ac){return _0x160174(handleCheckRowError('duplicate',_0x9aee('0x2a'),_0x3837ac,_0x5f34bb));}}return db[_0x9aee('0x2b')]['create'](_0x4f9e8b,{'raw':!![],'hooks':![],'fields':_[_0x9aee('0x2c')](_0x4f9e8b)})[_0x9aee('0x2d')](function(_0x57776e){if(DUPLICATES&&DUPLICATES[_0x9aee('0x1a')]&&_0x366f2c){_0x366f2c[_0x9aee('0x2e')](_[_0x9aee('0x2f')](_0x4f9e8b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x57776e['id'];return _0x18c8b6();})['catch'](function(_0x3e9683){return _0x160174(handleCheckRowError(_0x9aee('0x14'),_0x9aee('0x30')+(_0x3e9683[_0x9aee('0x1c')]||JSON[_0x9aee('0x31')](_0x3e9683)),null,_0x5f34bb));});});}function checkHopper(){function _0x3be3e8(){return function(_0x3ba0d1){logger[_0x9aee('0x14')](_0x9aee('0x32'),_0x9aee('0x33'),util[_0x9aee('0x34')](_0x3ba0d1,{'showHidden':![],'depth':null}));};}var _0x29ee1e=function(_0x36e734,_0x4c4d1d){var _0x3ffc30=squel[_0x9aee('0x35')]()['into'](_0x9aee('0x36'))[_0x9aee('0x37')]([_0x9aee('0x38'),_0x9aee('0x39'),_0x9aee('0x3a'),_0x9aee('0x3b'),_0x4c4d1d,_0x9aee('0x3c'),_0x9aee('0x3d')],squel[_0x9aee('0x3e')]()[_0x9aee('0x3f')](_0x9aee('0x38'),_0x9aee('0x38'))[_0x9aee('0x3f')](_0x9aee('0x40'),'scheduledAt')[_0x9aee('0x3f')]('id',_0x9aee('0x3a'))[_0x9aee('0x3f')](LISTID[_0x9aee('0x41')](),'ListId')[_0x9aee('0x3f')](_0x36e734['id']['toString'](),_0x4c4d1d)[_0x9aee('0x3f')](_0x9aee('0x40'),_0x9aee('0x3c'))['field']('NOW()',_0x9aee('0x3d'))[_0x9aee('0x42')]('cm_contacts')[_0x9aee('0x43')](_0x9aee('0x44'))[_0x9aee('0x43')]('ListId\x20=\x20?',LISTID[_0x9aee('0x41')]())[_0x9aee('0x43')](_0x9aee('0x45'))[_0x9aee('0x43')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x9aee('0x3f')](_0x9aee('0x38'))[_0x9aee('0x42')](_0x9aee('0x36'))[_0x9aee('0x43')](_0x4c4d1d+_0x9aee('0x46'),_0x36e734['id']['toString']())))[_0x9aee('0x41')]();return _0x3ffc30;};var _0x950ab3=function(_0x551f79,_0x2fb73a){var _0x53989e=squel[_0x9aee('0x35')]()[_0x9aee('0x47')]('cm_hopper')[_0x9aee('0x37')]([_0x9aee('0x38'),_0x9aee('0x39'),_0x9aee('0x3a'),_0x9aee('0x3b'),_0x2fb73a,_0x9aee('0x3c'),_0x9aee('0x3d')],squel[_0x9aee('0x3e')]()[_0x9aee('0x3f')]('phone',_0x9aee('0x38'))[_0x9aee('0x3f')](_0x9aee('0x40'),_0x9aee('0x39'))[_0x9aee('0x3f')]('id','ContactId')[_0x9aee('0x3f')](LISTID['toString'](),'ListId')[_0x9aee('0x3f')](_0x551f79['id']['toString'](),_0x2fb73a)['field'](_0x9aee('0x40'),_0x9aee('0x3c'))[_0x9aee('0x3f')]('NOW()','updatedAt')[_0x9aee('0x42')](_0x9aee('0x48'))['where'](_0x9aee('0x44'))[_0x9aee('0x43')](_0x9aee('0x49'),LISTID[_0x9aee('0x41')]())[_0x9aee('0x43')](_0x9aee('0x4a'),squel[_0x9aee('0x4b')](hopperContacts))[_0x9aee('0x43')](_0x9aee('0x45'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x9aee('0x3f')]('calleridnum')[_0x9aee('0x42')]('cm_hopper_final')[_0x9aee('0x43')](_0x2fb73a+_0x9aee('0x46'),_0x551f79['id'][_0x9aee('0x41')]()))['where'](_0x9aee('0x4c'),squel[_0x9aee('0x3e')]()[_0x9aee('0x3f')](_0x9aee('0x38'))['from']('cm_hopper')[_0x9aee('0x43')](_0x2fb73a+_0x9aee('0x46'),_0x551f79['id'][_0x9aee('0x41')]())))[_0x9aee('0x41')]();return _0x53989e;};function _0xcbad89(_0x4ab678,_0x248f96){var _0x1fbbbb=squel[_0x9aee('0x35')]()[_0x9aee('0x47')](_0x9aee('0x36'))['fromQuery']([_0x9aee('0x38'),'scheduledAt',_0x9aee('0x3a'),_0x9aee('0x3b'),_0x248f96,'createdAt',_0x9aee('0x3d')],squel[_0x9aee('0x3e')]()[_0x9aee('0x3f')]('phone','phone')[_0x9aee('0x3f')]('NOW()','scheduledAt')[_0x9aee('0x3f')]('id',_0x9aee('0x3a'))['field'](LISTID[_0x9aee('0x41')](),_0x9aee('0x3b'))[_0x9aee('0x3f')](_0x4ab678['id'][_0x9aee('0x41')](),_0x248f96)[_0x9aee('0x3f')](_0x9aee('0x40'),_0x9aee('0x3c'))[_0x9aee('0x3f')](_0x9aee('0x40'),_0x9aee('0x3d'))[_0x9aee('0x42')](_0x9aee('0x48'))[_0x9aee('0x43')](_0x9aee('0x44'))[_0x9aee('0x43')](_0x9aee('0x49'),LISTID[_0x9aee('0x41')]())[_0x9aee('0x43')](_0x9aee('0x4a'),squel[_0x9aee('0x4b')](hopperContacts))[_0x9aee('0x43')](_0x9aee('0x45')))['toString']();return _0x1fbbbb;}function _0x777176(_0x2be528,_0x539467){var _0x15942c=squel['insert']()['into'](_0x9aee('0x4d'))['fromQuery'](['phone',_0x9aee('0x3a'),_0x9aee('0x3b'),_0x539467,_0x9aee('0x3c'),_0x9aee('0x3d')],squel[_0x9aee('0x3e')]()[_0x9aee('0x3f')](_0x9aee('0x38'),'phone')['field']('id',_0x9aee('0x3a'))[_0x9aee('0x3f')](LISTID[_0x9aee('0x41')](),_0x9aee('0x3b'))[_0x9aee('0x3f')](_0x2be528['id'][_0x9aee('0x41')](),_0x539467)[_0x9aee('0x3f')]('NOW()','createdAt')['field'](_0x9aee('0x40'),_0x9aee('0x3d'))[_0x9aee('0x42')](_0x9aee('0x48'))['where']('deletedAt\x20IS\x20NULL')[_0x9aee('0x43')](_0x9aee('0x49'),LISTID[_0x9aee('0x41')]())[_0x9aee('0x43')](_0x9aee('0x4a'),squel['str'](hopperContacts))['where'](_0x9aee('0x45')))[_0x9aee('0x41')]();return _0x15942c;}return db[_0x9aee('0x4e')][_0x9aee('0x4f')]({'where':{'type':'outbound'},'attributes':['id',_0x9aee('0x50')],'include':[{'model':db[_0x9aee('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0x9aee('0x2d')](function(_0x4c10e1){var _0x526301=[];if(_0x4c10e1){var _0x3f5ffe;for(var _0x164572=0x0,_0x490673;_0x164572<_0x4c10e1['length'];_0x164572+=0x1){_0x490673=_0x4c10e1[_0x164572][_0x9aee('0x52')]({'plain':!![]});switch(_0x490673[_0x9aee('0x50')]){case _0x9aee('0x53'):_0x526301['push'](db[_0x9aee('0x54')][_0x9aee('0x55')](_0x950ab3(_0x490673,_0x9aee('0x56')))[_0x9aee('0x2d')](function(){})[_0x9aee('0x57')](_0x3be3e8()));break;case _0x9aee('0x58'):_0x526301['push'](db[_0x9aee('0x54')][_0x9aee('0x55')](_0x29ee1e(_0x490673,'VoiceQueueId'))[_0x9aee('0x2d')](function(){})[_0x9aee('0x57')](_0x3be3e8()));break;default:_0x526301['push'](db['sequelize']['query'](_0xcbad89(_0x490673,_0x9aee('0x56')))[_0x9aee('0x2d')](function(){})[_0x9aee('0x57')](_0x3be3e8()));}}}return _0x526301;})[_0x9aee('0x59')]()[_0x9aee('0x2d')](function(){return db[_0x9aee('0x4e')][_0x9aee('0x4f')]({'where':{'type':_0x9aee('0x5a')},'attributes':['id'],'include':[{'model':db[_0x9aee('0x51')],'as':_0x9aee('0x5b'),'where':{'id':LISTID}}]})[_0x9aee('0x2d')](function(_0x1ba205){var _0x58d65a=[];if(_0x1ba205){var _0x2c8698;for(var _0x596d81=0x0,_0x43d1de;_0x596d81<_0x1ba205[_0x9aee('0x1a')];_0x596d81+=0x1){_0x43d1de=_0x1ba205[_0x596d81][_0x9aee('0x52')]({'plain':!![]});_0x58d65a[_0x9aee('0x2e')](db[_0x9aee('0x54')][_0x9aee('0x55')](_0x777176(_0x43d1de,_0x9aee('0x56')))[_0x9aee('0x2d')](function(){})[_0x9aee('0x57')](_0x3be3e8()));}}return _0x58d65a;})['all']();})[_0x9aee('0x2d')](function(){return db['Campaign'][_0x9aee('0x4f')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x9aee('0x51')],'as':_0x9aee('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x568f85){var _0x51415d=[];if(_0x568f85){for(var _0x1179ff=0x0,_0x23cb0d;_0x1179ff<_0x568f85[_0x9aee('0x1a')];_0x1179ff+=0x1){_0x23cb0d=_0x568f85[_0x1179ff][_0x9aee('0x52')]({'plain':!![]});switch(_0x23cb0d[_0x9aee('0x50')]){case'always':_0x51415d[_0x9aee('0x2e')](db[_0x9aee('0x54')]['query'](_0x950ab3(_0x23cb0d,_0x9aee('0x5d')))[_0x9aee('0x2d')](function(){})[_0x9aee('0x57')](_0x3be3e8()));break;case _0x9aee('0x58'):_0x51415d[_0x9aee('0x2e')](db[_0x9aee('0x54')][_0x9aee('0x55')](_0x29ee1e(_0x23cb0d,_0x9aee('0x5d')))[_0x9aee('0x2d')](function(){})[_0x9aee('0x57')](_0x3be3e8()));break;default:_0x51415d[_0x9aee('0x2e')](db[_0x9aee('0x54')][_0x9aee('0x55')](_0xcbad89(_0x23cb0d,_0x9aee('0x5d')))['then'](function(){})[_0x9aee('0x57')](_0x3be3e8()));}}}return _0x51415d;})[_0x9aee('0x59')]();})[_0x9aee('0x2d')](function(){return db['Campaign'][_0x9aee('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x9aee('0x51')],'as':_0x9aee('0x5b'),'where':{'id':LISTID}}]})[_0x9aee('0x2d')](function(_0x538d83){var _0x388e4d=[];if(_0x538d83){for(var _0x458672=0x0,_0x4e46c8;_0x458672<_0x538d83[_0x9aee('0x1a')];_0x458672+=0x1){_0x4e46c8=_0x538d83[_0x458672][_0x9aee('0x52')]({'plain':!![]});_0x388e4d[_0x9aee('0x2e')](db[_0x9aee('0x54')][_0x9aee('0x55')](_0x777176(_0x4e46c8,_0x9aee('0x5d')))['then'](function(){})[_0x9aee('0x57')](_0x3be3e8()));}}return _0x388e4d;})[_0x9aee('0x59')]();})['catch'](function(_0x59e02c){logger[_0x9aee('0x14')](_0x9aee('0x5e'),_0x9aee('0x5f'),_0x59e02c[_0x9aee('0x1c')]);});}var processPromises=function(_0x3daac7){return BPromise[_0x9aee('0x59')](promises)[_0x9aee('0x2d')](function(_0x4d18ec){})[_0x9aee('0x57')](function(_0x4a0163){logger[_0x9aee('0x14')](_0x9aee('0x60'),JSON[_0x9aee('0x31')](_0x4a0163));})[_0x9aee('0x61')](function(){socket[_0x9aee('0x62')](_0x9aee('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3daac7){return _0x3daac7[_0x9aee('0x64')]();}});};var endCsv=function(){return BPromise[_0x9aee('0x65')]()[_0x9aee('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x9aee('0x2d')](function(){socket[_0x9aee('0x62')](_0x9aee('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x9aee('0x66')](FILEPATH);}catch(_0x3efbf9){logger[_0x9aee('0x14')](_0x9aee('0x67'),JSON[_0x9aee('0x31')](_0x3efbf9));}finally{process[_0x9aee('0x68')](0x0);}});};process['on'](_0x9aee('0x69'),function(){logger[_0x9aee('0x6a')](_0x9aee('0x6b'));endCsv();});function main(){return BPromise['resolve']()[_0x9aee('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x9aee('0x12')](',');return db[_0x9aee('0x2b')][_0x9aee('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x120a2e){var _0x5382d8=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x9aee('0x6c')](_0x5382d8,{'header':!![],'skipEmptyLines':!![],'step':function(_0xe979c5,_0x198ed6){total+=0x1;var _0x27baaa=total;promises[_0x9aee('0x2e')](checkRow(_0xe979c5,_0x120a2e,_0x27baaa)[_0x9aee('0x2d')](function(){success+=0x1;})[_0x9aee('0x57')](function(_0x380645){if(_0x380645[_0x9aee('0x14')]){errors+=0x1;delete _0x380645[_0x9aee('0x14')];}else if(_0x380645['duplicate']){duplicates+=0x1;delete _0x380645[_0x9aee('0x6d')];}rows[_0x9aee('0x2e')](_0x380645);}));if(total%0xc8===0x0){_0x198ed6['pause']();return processPromises(_0x198ed6);}},'complete':function(){return processPromises()[_0x9aee('0x2d')](function(){logger[_0x9aee('0x6a')](_0x9aee('0x6e'));endCsv();});},'error':function(_0x559d96,_0x9c53d){logger['info']('CSV\x20parse\x20error',JSON[_0x9aee('0x31')](_0x559d96));endCsv();}});})[_0x9aee('0x57')](function(_0x5808f0){logger[_0x9aee('0x14')](_0x9aee('0x6f'),JSON[_0x9aee('0x31')](_0x5808f0));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 9044f94..7309ea2 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 _0x385f=['min_id','group','Received\x20SIGINT','error','exit','message','info','sequelize','spread','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','query','catch','timezones','dialTimezone','utcOffset','set','offset','stringify','send','clone','socket_timestamp','root','.csv','keys','findAll','name','_description','header','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','appendFileSync','emit','contact:import:','errors','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','orderBy','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','VoiceQueueId','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','defaults','localhost','socket.io-emitter','redis','YYYY-MM-DD\x20HH:mm:ss','format','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','push','all','length','split','isNil','filter','findOne','CmContactHasItem','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','into','fromQuery','scheduledat','ContactId','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','toString','cm_hopper_black','createdAt','fields','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','cm_contacts.UserId','ListId','\x20=\x20','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)'];(function(_0x7bc63a,_0x26422a){var _0xed898e=function(_0x4a222a){while(--_0x4a222a){_0x7bc63a['push'](_0x7bc63a['shift']());}};_0xed898e(++_0x26422a);}(_0x385f,0x112));var _0xf385=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x385f[_0xdd2bfa];return _0x55397e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf385('0x0'));var Papa=require(_0xf385('0x1'));var util=require(_0xf385('0x2'));var BPromise=require('bluebird');var moment=require(_0xf385('0x3'));var squel=require(_0xf385('0x4'));var Redis=require(_0xf385('0x5'));var db=require(_0xf385('0x6'))['db'];var config=require(_0xf385('0x7'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0xf385('0x8'));config['redis']=_[_0xf385('0x9')](config['redis'],{'host':_0xf385('0xa'),'port':0x18eb});var socket=require(_0xf385('0xb'))(new Redis(config[_0xf385('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xf385('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xf385('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5c4e48){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x5c4e48);}function selectNotIn(_0x37d76a,_0x51285c,_0x1885b2,_0x34db04,_0x3bc8ff){return squel[_0xf385('0xf')]()[_0xf385('0x10')](_0xf385('0x11'))[_0xf385('0x12')](_0x34db04)[_0xf385('0x13')](_0x51285c,null,_0x51285c+_0xf385('0x14')+_0x34db04+'.'+_0x1885b2)[_0xf385('0x15')](_0x34db04+'.'+_0x1885b2+'\x20=\x20'+_0x37d76a+'.'+_0x1885b2)['where'](_0x51285c+_0xf385('0x16')+_0x3bc8ff['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2ccef1,_0x36f3f0){promisesAdditionalPhones=[];return db[_0xf385('0x17')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xf385('0x18')](function(_0x4edce7){if(_0x4edce7!==null){var _0x43219d=[];for(var _0x186ffa=0x0;_0x186ffa<_0x4edce7['length'];_0x186ffa++){var _0xfcb5bb=_0x4edce7[_0x186ffa];_0x43219d[_0xf385('0x19')](insertAdditionalPhones(_0xfcb5bb));}}Promise[_0xf385('0x1a')](_0x43219d)[_0xf385('0x18')](function(){_0x2ccef1({'val':0x1});});});});}function insertAdditionalPhones(_0x3bcf27){return new Promise(function(_0x6ffe7c,_0x49c236){var _0x3d115d=_0x3bcf27['AdditionalPhones'];var _0x4c72c4=_0x3d115d['split'](';');var _0x29bccc=[];orderBy=0x0;for(var _0x321833=0x0;_0x321833<_0x4c72c4[_0xf385('0x1b')];_0x321833++){_0x29bccc['push'](splitAdditionalPhone(_0x3bcf27['id'],_0x4c72c4[_0x321833]));}Promise['all'](_0x29bccc)[_0xf385('0x18')](function(){_0x6ffe7c({'val':_0x4c72c4[_0xf385('0x1b')]});});});}function splitAdditionalPhone(_0x39019a,_0x4105f2){return new Promise(function(_0x16a1d9,_0x54b1b2){var _0x30ffeb=_0x4105f2[_0xf385('0x1c')](':');var _0x1756e5=_0x30ffeb[0x0];var _0x4cc9f5=_0x30ffeb[0x1];if(!_[_0xf385('0x1d')](_0x4cc9f5)){var _0xacaf16=_0x4cc9f5[_0xf385('0x1c')]('|');var _0x3a3385=[];for(var _0x8c8f16=0x0;_0x8c8f16<_0xacaf16[_0xf385('0x1b')];_0x8c8f16++){if(_0xacaf16[_0x8c8f16]!==''){var _0x1d53a0=_[_0xf385('0x1e')](promisesAdditionalPhones,{'contactId':_0x39019a,'phone':_0xacaf16[_0x8c8f16]});if(_0x1d53a0[_0xf385('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xf385('0x19')]({'contactId':_0x39019a,'contactTypeId':_0x1756e5,'phone':_0xacaf16[_0x8c8f16],'orderBy':orderBy});}}}_0x16a1d9({'ok':0x1});}else _0x16a1d9({'res':0x0});});}function createAdditionalPhone(_0x296c73,_0xc67421,_0x140b82,_0x1be206){var _0x5ea1e0='';var _0x2275f5='';var _0x4cf068=_0x140b82[_0xf385('0x1c')]('§');_0x5ea1e0=_0x4cf068[0x0];if(_0x4cf068[_0xf385('0x1b')]==0x2)_0x2275f5=_0x4cf068[0x1];return new Promise(function(_0x3de821,_0x16383b){return db['CmContactHasItem'][_0xf385('0x1f')]({'where':{'CmContactId':_0x296c73,'item':_0x5ea1e0}})['then'](function(_0x4a83f9){if(_0x4a83f9){return db[_0xf385('0x20')]['update']({'ItemTypeId':_0xc67421,'description':_0x2275f5,'OrderBy':_0x1be206},{'where':{'CmContactId':_0x296c73,'item':_0x5ea1e0}})[_0xf385('0x18')](function(_0x4f3f94){_0x3de821({'res':_0xf385('0x21')});});}else{return db[_0xf385('0x20')][_0xf385('0x22')]({'CmContactId':_0x296c73,'item':_0x5ea1e0,'description':_0x2275f5,'ItemTypeId':_0xc67421,'OrderBy':_0x1be206,'ItemClass':_0xf385('0x23')})[_0xf385('0x18')](function(_0x579e61){_0x3de821({'res':'inserted'});});}});});}function insertCmHopper(_0xac2d67,_0x49985b,_0x9f8974,_0x340070,_0x5a1984){var _0x477578=[_0xf385('0x24'),_0xf385('0x25'),_0xf385('0x26'),_0xf385('0x27'),_0x49985b+'.'+_0x340070,_0xf385('0x28'),_0xf385('0x29'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x5a1984+'\x22'];return squel[_0xf385('0x2a')]()[_0xf385('0x2b')]('cm_hopper')[_0xf385('0x2c')]([_0xf385('0x11'),_0xf385('0x2d'),_0xf385('0x2e'),'ListId',_0x340070,'createdAt',_0xf385('0x2f'),_0xf385('0x30'),_0xf385('0x31'),_0xf385('0x32')],squel[_0xf385('0xf')]()['fields'](_0x477578)[_0xf385('0x12')](_0x49985b)['join'](_0xf385('0x33'),null,_0xf385('0x34')+_0x49985b+_0xf385('0x35'))[_0xf385('0x13')](_0x9f8974,null,_0x9f8974+_0xf385('0x14')+_0x49985b+'.'+_0x340070)[_0xf385('0x15')](_0x49985b+_0xf385('0x36'),_0xac2d67)[_0xf385('0x15')](_0xf385('0x37'),NOW)['where'](_0xf385('0x38'),selectNotIn(_0x49985b,_0x9f8974,_0x340070,'cm_hopper',[_0xf385('0x39'),_0xf385('0x3a')]))['where'](_0xf385('0x38'),selectNotIn(_0x49985b,_0x9f8974,_0x340070,_0xf385('0x3b'),[_0xf385('0x39')])))[_0xf385('0x3c')]();}function insertCmHopperBlack(_0x277c88,_0x518be9,_0x137aab,_0x38c48e){var _0x20fb09=[_0xf385('0x24'),_0xf385('0x26'),_0xf385('0x27'),_0x518be9+'.'+_0x38c48e,_0xf385('0x28'),_0xf385('0x29')];return squel[_0xf385('0x2a')]()[_0xf385('0x2b')](_0xf385('0x3d'))['fromQuery']([_0xf385('0x11'),_0xf385('0x2e'),'ListId',_0x38c48e,_0xf385('0x3e'),'updatedAt'],squel[_0xf385('0xf')]()[_0xf385('0x3f')](_0x20fb09)[_0xf385('0x12')](_0x518be9)['join'](_0xf385('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x518be9+_0xf385('0x35'))[_0xf385('0x13')](_0x137aab,null,_0x137aab+_0xf385('0x14')+_0x518be9+'.'+_0x38c48e)[_0xf385('0x15')](_0x518be9+_0xf385('0x36'),_0x277c88)[_0xf385('0x15')](_0xf385('0x37'),NOW)[_0xf385('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf385('0xf')]()[_0xf385('0x10')](_0xf385('0x11'))[_0xf385('0x12')]('cm_hopper_black')['where'](_0xf385('0x40'),_0x277c88)['where'](_0x38c48e+'\x20=\x20'+_0x518be9+'.'+_0x38c48e)))[_0xf385('0x3c')]();}function insertTzCmHopper(_0x4a30cc,_0x21d30f,_0x2c90fe,_0x196e64,_0x4859ac,_0x34edf7){var _0x52a0da=[_0xf385('0x24'),_0xf385('0x41')+_0x34edf7+'.offset-cm_contacts.utcOffset\x20minute)',_0xf385('0x26'),_0xf385('0x27'),_0x21d30f+'.'+_0x196e64,_0xf385('0x28'),_0xf385('0x29'),_0xf385('0x42'),_0xf385('0x43'),'\x22'+_0x4859ac+'\x22'];var _0x3c3a1c=squel[_0xf385('0x2a')]()[_0xf385('0x2b')]('cm_hopper')[_0xf385('0x2c')](['phone',_0xf385('0x2d'),_0xf385('0x2e'),'ListId',_0x196e64,_0xf385('0x3e'),_0xf385('0x2f'),'priority',_0xf385('0x31'),'recallme'],squel[_0xf385('0xf')]()[_0xf385('0x3f')](_0x52a0da)[_0xf385('0x12')](_0x21d30f)[_0xf385('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x21d30f+_0xf385('0x35'))['join'](_0x2c90fe,null,_0x2c90fe+'.id\x20=\x20'+_0x21d30f+'.'+_0x196e64)[_0xf385('0x13')](_0x34edf7,null,_0x34edf7+'.id\x20=\x20'+_0x21d30f+'.'+_0x196e64)[_0xf385('0x15')](_0x21d30f+'.CmListId\x20=\x20?',_0x4a30cc)[_0xf385('0x15')](_0xf385('0x37'),NOW)['where'](_0xf385('0x38'),selectNotIn(_0x21d30f,_0x2c90fe,_0x196e64,_0xf385('0x3b'),['\x22always\x22',_0xf385('0x3a')]))[_0xf385('0x15')](_0xf385('0x38'),selectNotIn(_0x21d30f,_0x2c90fe,_0x196e64,_0xf385('0x3b'),[_0xf385('0x39')])))['toString']();return _0x3c3a1c;}function insertTzCmHopperBlack(_0x1e453d,_0x3323fa,_0x53ade5,_0x2085d4){var _0x522389=[_0xf385('0x24'),'cm_contacts.id',_0xf385('0x27'),_0x3323fa+'.'+_0x2085d4,_0xf385('0x28'),_0xf385('0x29')];return squel[_0xf385('0x2a')]()[_0xf385('0x2b')]('cm_hopper_black')[_0xf385('0x2c')](['phone',_0xf385('0x2e'),_0xf385('0x44'),_0x2085d4,_0xf385('0x3e'),_0xf385('0x2f')],squel[_0xf385('0xf')]()[_0xf385('0x3f')](_0x522389)[_0xf385('0x12')](_0x3323fa)[_0xf385('0x13')]('cm_contacts',null,_0xf385('0x34')+_0x3323fa+_0xf385('0x35'))[_0xf385('0x13')](_0x53ade5,null,_0x53ade5+_0xf385('0x14')+_0x3323fa+'.'+_0x2085d4)[_0xf385('0x15')](_0x3323fa+_0xf385('0x36'),_0x1e453d)[_0xf385('0x15')](_0xf385('0x37'),NOW)[_0xf385('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf385('0xf')]()[_0xf385('0x10')]('phone')['from'](_0xf385('0x3d'))['where']('ListId\x20=\x20?',_0x1e453d)[_0xf385('0x15')](_0x2085d4+_0xf385('0x45')+_0x3323fa+'.'+_0x2085d4)))['toString']();}function insertCmHopperAdditionalPhones(_0x1bad04){var _0x35c463=['cm_hopper.id',_0xf385('0x46'),_0xf385('0x47'),'cm_contact_has_items.createdAt',_0xf385('0x48')];return squel[_0xf385('0x2a')]()['into'](_0xf385('0x49'))[_0xf385('0x2c')]([_0xf385('0x4a'),_0xf385('0x11'),'OrderBy',_0xf385('0x3e'),_0xf385('0x2f')],squel[_0xf385('0xf')]()[_0xf385('0x3f')](_0x35c463)['from'](_0xf385('0x3b'))['join'](_0xf385('0x33'),null,_0xf385('0x4b'))[_0xf385('0x13')]('cm_contact_has_items',null,_0xf385('0x4c'))[_0xf385('0x15')](_0xf385('0x4d'),_0x1bad04)[_0xf385('0x15')](_0xf385('0x37'),NOW))[_0xf385('0x3c')]();}function insertCmContact(_0x14ad07,_0x531cd3,_0x417e7c,_0x1c087c){var _0x58ab74=_[_0xf385('0x4e')](_['keys'](_0x1c087c),[_0xf385('0x44'),_0xf385('0x4f'),'createdAt',_0xf385('0x2f'),'scheduledAt']);return squel[_0xf385('0x2a')]()[_0xf385('0x2b')](_0xf385('0x33'))[_0xf385('0x2c')](_0x58ab74,squel[_0xf385('0xf')]()[_0xf385('0x3f')](_0x58ab74)[_0xf385('0x12')](_0x531cd3)['where']('('+_0x417e7c[_0xf385('0x13')](',')+_0xf385('0x50'),squel['select']()['fields'](_0x417e7c)[_0xf385('0x12')](_0xf385('0x33'))[_0xf385('0x15')](_0xf385('0x40'),_0x14ad07)[_0xf385('0x15')](_0xf385('0x51')))[_0xf385('0x15')](_0xf385('0x52'),squel['select']()[_0xf385('0x10')](_0xf385('0x53'),_0xf385('0x54'))['from'](_0x531cd3)[_0xf385('0x55')](_0x417e7c[_0xf385('0x13')](','))))[_0xf385('0x3c')]();}function handleStop(){logger['info'](_0xf385('0x56'));stopped=!![];}function handleUncaughtException(_0x3f8c7){logger[_0xf385('0x57')](_0x3f8c7['message']);process[_0xf385('0x58')](0x1);}function handleError(_0x12627d,_0x4e8c3b){stats['errors'][_0xf385('0x19')]({'name':_0x4e8c3b['code'],'message':_0x4e8c3b[_0xf385('0x59')],'row':_0x12627d});}function handleQuery(_0x4206c4){logger[_0xf385('0x5a')](_0x4206c4);return db[_0xf385('0x5b')]['query'](_0x4206c4)[_0xf385('0x5c')](function(_0x29e9f4){results[_0xf385('0x19')](_0x29e9f4);})['catch'](function(_0x2a93f5){logger['error'](_0x2a93f5[_0xf385('0x59')]);});}function updateTzCampaigns(_0x31139e){return new Promise(function(_0x2ba205,_0x1f903b){var _0x20cc48=squel[_0xf385('0xf')]()[_0xf385('0x3f')](['campaigns.id','campaigns.dialTimezone'])['from']('campaigns')['join'](_0xf385('0x5d'),null,_0xf385('0x5e'))['where']('campaigns_has_cm_lists.CmListId='+_0x31139e);db[_0xf385('0x5b')]['query'](_0x20cc48[_0xf385('0x3c')]())['spread'](function(_0x27672c){var _0x5c9952=[];for(var _0x457277=0x0;_0x457277<_0x27672c[_0xf385('0x1b')];_0x457277++){_0x5c9952[_0xf385('0x19')](getTimezoneData(_0x27672c[_0x457277],tmp_campaigns));}BPromise[_0xf385('0x1a')](_0x5c9952)[_0xf385('0x18')](function(){_0x2ba205({'val':0x1});});})['catch'](function(_0x5f1434){logger[_0xf385('0x57')](_0x5f1434['message']);_0x2ba205({'val':0x0});});});}function updateTzVoiceQueues(_0x17cdc9){return new Promise(function(_0x17cd40,_0xac3708){var _0x577c08=squel[_0xf385('0xf')]()[_0xf385('0x3f')](['voice_queues.id',_0xf385('0x5f')])[_0xf385('0x12')](_0xf385('0x60'))[_0xf385('0x13')](_0xf385('0x61'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xf385('0x15')](_0xf385('0x62')+_0x17cdc9);db[_0xf385('0x5b')][_0xf385('0x63')](_0x577c08[_0xf385('0x3c')]())[_0xf385('0x5c')](function(_0x44d8f1){var _0x2ee103=[];for(var _0x47f56b=0x0;_0x47f56b<_0x44d8f1[_0xf385('0x1b')];_0x47f56b++){_0x2ee103['push'](getTimezoneData(_0x44d8f1[_0x47f56b],tmp_voice_queues));}BPromise['all'](_0x2ee103)['then'](function(){_0x17cd40({'val':0x1});});})[_0xf385('0x64')](function(_0x2f9e92){logger['error'](_0x2f9e92['message']);_0x17cd40({'val':0x0});});});}function getTimezoneData(_0x37e942,_0x3b38b3){return new Promise(function(_0x328cf5,_0x4cecbe){var _0x414bee=shared[_0xf385('0x65')];var _0x2106b3=_0x414bee[_0x37e942[_0xf385('0x66')]];if(_[_0xf385('0x1d')](_0x2106b3)){_0x328cf5({'ret':0x1});}else{var _0xbe17ed=_0x2106b3[_0xf385('0x67')];var _0x3254c8=squel[_0xf385('0x2a')]()[_0xf385('0x2b')](_0x3b38b3)[_0xf385('0x68')]('id',_0x37e942['id'])[_0xf385('0x68')](_0xf385('0x69'),_0xbe17ed)[_0xf385('0x68')](_0xf385('0x66'),_0x37e942[_0xf385('0x66')])['toString']();return db['sequelize'][_0xf385('0x63')](_0x3254c8)['spread'](function(_0x2a1e08){_0x328cf5({'ret':0x1});})['catch'](function(_0x25ae5d){logger['error'](_0x25ae5d[_0xf385('0x59')]);_0x4cecbe({'ret':0x1});});}});}function handleTZQuery(_0x5bf51c){logger[_0xf385('0x5a')](_0x5bf51c);return db[_0xf385('0x5b')]['query'](_0x5bf51c)['spread'](function(_0xc3be28){})[_0xf385('0x64')](function(_0x521171){logger['error'](_0x521171[_0xf385('0x59')]);});}function main(_0x47b4fe,_0xdfeb8e,_0x5eb07c,_0x3665ea){logger[_0xf385('0x5a')]('main',_0x47b4fe,JSON[_0xf385('0x6a')](_0xdfeb8e));process[_0xf385('0x6b')]('start');var _0x278aca=_0xdfeb8e['binding'];var _0x13c1f3=_[_0xf385('0x6c')](_0x278aca);var _0x59bd5e=_0xdfeb8e[_0xf385('0x6d')];var _0xb6b0d4=path['join'](config[_0xf385('0x6e')],'server/files/tmp',_0x59bd5e+_0xf385('0x6f'));hasTZ=_[_0xf385('0x70')](_0x278aca)['includes'](_0xf385('0x66'));var _0x6fcf16=_['keys'](_0x278aca)[_0xf385('0x13')]();logger['info']('header',_0x6fcf16);db['ContactItemType'][_0xf385('0x71')]({'raw':!![],'attributes':['id',_0xf385('0x72')]})[_0xf385('0x18')](function(_0x1fa1fb){for(var _0x5ec794=0x0;_0x5ec794<_0x1fa1fb[_0xf385('0x1b')];_0x5ec794++){if(_0x1fa1fb[_0x5ec794][_0xf385('0x72')]in _0x278aca){contactItemTypes[_0xf385('0x19')](_0x1fa1fb[_0x5ec794]);delete _0x13c1f3[_0x1fa1fb[_0x5ec794]['name']];hasAdditionalPhones=!![];}for(var _0x36ffc6 in _0x278aca){if(_0x1fa1fb[_0x5ec794][_0xf385('0x72')]+_0xf385('0x73')===_0x36ffc6){phoneDescriptions['push']({'itemTypeId':_0x1fa1fb[_0x5ec794]['id'],'description':_0x36ffc6});delete _0x13c1f3[_0x36ffc6];}}}if(hasAdditionalPhones)_0x13c1f3['AdditionalPhones']='';var _0x3c400e=_[_0xf385('0x70')](_0x13c1f3)[_0xf385('0x13')]();logger[_0xf385('0x5a')](_0xf385('0x74'),_0x3c400e);fs['writeFileSync'](_0xb6b0d4,_0x3c400e+'\x0a');Papa[_0xf385('0x75')](fs[_0xf385('0x76')](_0x47b4fe),{'header':!![],'skipEmptyLines':!![],'step':function(_0x52a601,_0x39add1){try{for(var _0x5a3709=0x0,_0x2d0d15=[];_0x5a3709<_0x52a601[_0xf385('0x77')][_0xf385('0x1b')];_0x5a3709++){stats[_0xf385('0x78')]+=0x1;if(_0x52a601['errors'][_0x5a3709]){handleError(_0x52a601[_0xf385('0x77')][_0x5a3709],_0x52a601['errors'][_0x5a3709]);}else{var _0x6bb4b2=[];var _0x1a4951=[];var _0x38a14b={};for(var _0xc516ca in _0x278aca){let _0x4f128d=contactItemTypes[_0xf385('0x79')](_0x2a2a58=>_0x2a2a58[_0xf385('0x72')]===_0xc516ca);let _0x475881=contactItemTypes[_0xf385('0x79')](_0x30ff42=>_0x30ff42[_0xf385('0x72')]+_0xf385('0x73')===_0xc516ca);if(_[_0xf385('0x1d')](_0x4f128d)&&_[_0xf385('0x1d')](_0x475881)){if(_0x278aca[_0xf385('0x7a')](_0xc516ca)){if(_0x52a601[_0xf385('0x77')][_0x5a3709][_0x278aca[_0xc516ca]]){var _0x23b62f=_[_0xf385('0x7b')](_0x52a601['data'][_0x5a3709][_0x278aca[_0xc516ca]][_0xf385('0x7c')](/"/g,'\x27'));switch(_0xc516ca){case _0xf385('0x2d'):var _0x82f637=moment(_0x23b62f,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x82f637[_0xf385('0x7d')]()){_0x2d0d15[_0xf385('0x19')]('\x22'+_0x23b62f+'\x22');}else{_0x6bb4b2[_0xf385('0x19')](_0xf385('0x7e'));}break;case _0xf385('0x30'):var _0x285b1e=parseInt(_0x23b62f);_0x23b62f=_[_0xf385('0x7f')](_0x285b1e)||_0x285b1e<0x0||_0x285b1e>0x4?_0x3665ea?0x3:0x2:_0x285b1e;_0x2d0d15[_0xf385('0x19')]('\x22'+_0x23b62f+'\x22');break;case _0xf385('0x31'):var _0x118737=parseInt(_0x23b62f);if(_[_0xf385('0x80')](_0x118737)&&_[_0xf385('0x81')](_0x5eb07c,_0x118737)){_0x2d0d15[_0xf385('0x19')]('\x22'+_0x118737+'\x22');}else{_0x6bb4b2['push'](_0xf385('0x82'));}break;case _0xf385('0x83'):if(isEmail(_0x23b62f)){_0x2d0d15['push']('\x22'+_0x23b62f+'\x22');}else{_0x6bb4b2[_0xf385('0x19')](_0xf385('0x84'));}break;case _0xf385('0x85'):var _0xf583c0=moment(_0x23b62f,'YYYY-MM-DD',!![]);if(_0xf583c0['isValid']()){_0x2d0d15[_0xf385('0x19')]('\x22'+_0x23b62f+'\x22');}else{_0x6bb4b2[_0xf385('0x19')](_0xf385('0x86'));}break;case _0xf385('0x66'):var _0x848afe=shared[_0xf385('0x65')];var _0x170b0c=_0x848afe[_0x23b62f];if(!_[_0xf385('0x1d')](_0x170b0c)){var _0x52010e=_0x170b0c[_0xf385('0x67')];_0x2d0d15[_0xf385('0x19')]('\x22'+_0x23b62f+'\x22');_0x2d0d15[_0xf385('0x19')]('\x22'+_0x52010e+'\x22');}break;default:_0x2d0d15[_0xf385('0x19')]('\x22'+_0x23b62f+'\x22');}}else{switch(_0xc516ca){case _0xf385('0x87'):case _0xf385('0x11'):_0x6bb4b2[_0xf385('0x19')](_0xc516ca+_0xf385('0x88'));break;default:_0x2d0d15['push']('\x22\x22');}}}}else{var _0x194683='';if(!_['isNil'](_0x4f128d)){if(!_0x38a14b[_0xf385('0x7a')](_0x4f128d['id'])){if(!_['isNil'](_0x52a601[_0xf385('0x77')][_0x5a3709][_0x278aca[_0xc516ca]])){var _0x23b62f=_[_0xf385('0x7b')](_0x52a601[_0xf385('0x77')][_0x5a3709][_0x278aca[_0xc516ca]][_0xf385('0x7c')](/"/g,'\x27'));var _0x5df830=phoneDescriptions[_0xf385('0x79')](_0x307854=>_0x307854[_0xf385('0x89')]===_0x4f128d['id']);if(!_['isNil'](_0x5df830)){var _0x159fc9=_[_0xf385('0x7b')](_0x52a601[_0xf385('0x77')][_0x5a3709][_0x278aca[_0x5df830['description']]][_0xf385('0x7c')](/"/g,'\x27'));if(!_['isNil'](_0x159fc9))_0x23b62f=_0x23b62f+'§'+_0x159fc9;}if(_0x194683=='')_0x194683=_0x23b62f;else _0x194683+='|'+_0x23b62f;}_0x1a4951['push'](_0x4f128d['id']+':'+_0x194683);_0x38a14b[_0x4f128d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2d0d15['push']('\x22'+_0x1a4951[_0xf385('0x13')](';')+'\x22');}if(_0x6bb4b2['length']){handleError(_0x52a601[_0xf385('0x77')][_0x5a3709],{'code':'SystemRow','message':_0x6bb4b2['join']()});}else{fs[_0xf385('0x8a')](_0xb6b0d4,_0x2d0d15[_0xf385('0x13')]()+'\x0a');}_0x2d0d15=[];}if(!(stats[_0xf385('0x78')]%0xc8)){socket[_0xf385('0x8b')](_0xf385('0x8c')+_0x59bd5e,stats);stats[_0xf385('0x8d')]=[];}}if(stopped){logger['info'](_0xf385('0x8e'));_0x39add1['abort']();}}catch(_0x116edc){handleError(_0x52a601['data'][_0x5a3709],{'code':_0xf385('0x8f'),'message':_0x116edc['message']});logger[_0xf385('0x57')](_0xf385('0x90'),_0x116edc['message']);}},'complete':function(){try{var _0xf2f665=[];var _0xdb92a4=[];var _0x3d014b=_0xf385('0x33');if(_0xdfeb8e[_0xf385('0x91')]&&_0xdfeb8e[_0xf385('0x91')][_0xf385('0x1b')]){_0x3d014b=_0xf385('0x92')+_0x59bd5e;_0xf2f665[_0xf385('0x19')](_0xf385('0x93')+_0x3d014b+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xf385('0x94')+_0x59bd5e;tmp_voice_queues=_0xf385('0x95')+_0x59bd5e;_0xdb92a4[_0xf385('0x19')](_0xf385('0x93')+tmp_campaigns+_0xf385('0x96'));_0xdb92a4[_0xf385('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xf385('0x96'));BPromise[_0xf385('0x97')](_0xdb92a4,handleTZQuery)[_0xf385('0x18')](function(_0x601999){updateTzCampaigns(_0xdfeb8e[_0xf385('0x44')])[_0xf385('0x18')](function(_0x48c9a5){updateTzVoiceQueues(_0xdfeb8e[_0xf385('0x44')])[_0xf385('0x18')](function(_0x45a4dd){if(hasTZ)_0x3c400e=_0x3c400e[_0xf385('0x7c')](_0xf385('0x66'),_0xf385('0x98'));var _0x106123=util[_0xf385('0xe')](_0xf385('0x99'),_0xb6b0d4,_0x3d014b,_0x3c400e,_0xdfeb8e[_0xf385('0x44')],_0xdfeb8e[_0xf385('0x4f')]||null,NOW,NOW);if(_[_0xf385('0x1d')](_0x278aca[_0xf385('0x2d')])){_0x106123+=_0xf385('0x9a');}_0xf2f665['push'](_0x106123);if(_0xdfeb8e[_0xf385('0x91')]&&_0xdfeb8e[_0xf385('0x91')][_0xf385('0x1b')]){_0xf2f665[_0xf385('0x19')](insertCmContact(_0xdfeb8e[_0xf385('0x44')],_0x3d014b,_0xdfeb8e[_0xf385('0x91')],_0x278aca));_0xf2f665[_0xf385('0x19')]('DROP\x20TABLE\x20'+_0x3d014b+';');}BPromise[_0xf385('0x97')](_0xf2f665,handleQuery)['then'](function(_0x3665e1){BPromise[_0xf385('0x1a')]([handleAdditionalPhones()])['then'](function(){_0xf2f665=[];for(var _0x160e65=0x0;_0x160e65\x20\x20');}var _0x160327=path[_0xf385('0x13')](config[_0xf385('0x6e')],'server/files/tmp',process[_0xf385('0xa7')][0x2]);if(!fs[_0xf385('0xa8')](_0x160327)){throw new Error(_0xf385('0xa9'));}var _0x2525cc={};try{_0x2525cc=JSON[_0xf385('0x75')](process[_0xf385('0xa7')][0x3]);if(!_0x2525cc[_0xf385('0xaa')]){throw new Error(_0xf385('0xab'));}if(!_0x2525cc[_0xf385('0xaa')][_0xf385('0x11')]){throw new Error(_0xf385('0xac'));}if(!_0x2525cc[_0xf385('0xaa')]['firstName']){throw new Error(_0xf385('0xad'));}var _0x387c29=0x0;if(_0x2525cc[_0xf385('0xaa')]['UserId']){_0x387c29=0x1;}if(!_0x2525cc[_0xf385('0x44')]){throw new Error(_0xf385('0xae'));}}catch(_0x590355){throw new Error(_0xf385('0xaf'));}var _0xd956e4=[];try{_0xd956e4=_[_0xf385('0xb0')](JSON[_0xf385('0x75')](process[_0xf385('0xa7')][0x4]),'id');}catch(_0x2132ac){logger[_0xf385('0x5a')]('No\x20agent\x20available');}main(_0x160327,_0x2525cc,_0xd956e4,_0x387c29);}validate();process['on'](_0xf385('0xb1'),handleStop);process['on'](_0xf385('0xb2'),handleUncaughtException); \ No newline at end of file +var _0x89f5=['fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','createdAt','cm_contacts.phone\x20NOT\x20IN\x20(?)','field','cm_hopper_black','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','recallme','cm_hopper.id','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','catch','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','isNil','utcOffset','offset','set','stringify','binding','clone','server/files/tmp','.csv','includes','ContactItemType','name','_description','writeFileSync','parse','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','abort','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','campaigns_has_cm_blacklists','CampaignId','contact:import:','unlink','complete','argv','root','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority'];(function(_0x5557ae,_0x270e57){var _0x5ca863=function(_0x5433e0){while(--_0x5433e0){_0x5557ae['push'](_0x5557ae['shift']());}};_0x5ca863(++_0x270e57);}(_0x89f5,0x1d5));var _0x589f=function(_0x111c66,_0x785903){_0x111c66=_0x111c66-0x0;var _0x5db1cc=_0x89f5[_0x111c66];return _0x5db1cc;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x589f('0x0'));var util=require(_0x589f('0x1'));var BPromise=require('bluebird');var moment=require(_0x589f('0x2'));var squel=require(_0x589f('0x3'));var Redis=require(_0x589f('0x4'));var db=require(_0x589f('0x5'))['db'];var config=require(_0x589f('0x6'));var shared=require(_0x589f('0x7'));var logger=require(_0x589f('0x8'))(_0x589f('0x9'));config[_0x589f('0xa')]=_[_0x589f('0xb')](config[_0x589f('0xa')],{'host':_0x589f('0xc'),'port':0x18eb});var socket=require(_0x589f('0xd'))(new Redis(config[_0x589f('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x589f('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x589f('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x1dde9e){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x1dde9e);}function selectNotIn(_0x4c0027,_0x56fe15,_0x8a6733,_0x26695d,_0x111af4){return squel[_0x589f('0x10')]()['field'](_0x589f('0x11'))[_0x589f('0x12')](_0x26695d)[_0x589f('0x13')](_0x56fe15,null,_0x56fe15+_0x589f('0x14')+_0x26695d+'.'+_0x8a6733)[_0x589f('0x15')](_0x26695d+'.'+_0x8a6733+_0x589f('0x16')+_0x4c0027+'.'+_0x8a6733)[_0x589f('0x15')](_0x56fe15+_0x589f('0x17')+_0x111af4['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x26cd0d,_0x15d61c){promisesAdditionalPhones=[];return db['CmContact'][_0x589f('0x18')]({'raw':!![],'attributes':['id',_0x589f('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x589f('0x1a')](function(_0x2dfcd8){if(_0x2dfcd8!==null){var _0x1ed964=[];for(var _0x5973a7=0x0;_0x5973a7<_0x2dfcd8[_0x589f('0x1b')];_0x5973a7++){var _0x535af4=_0x2dfcd8[_0x5973a7];_0x1ed964[_0x589f('0x1c')](insertAdditionalPhones(_0x535af4));}}Promise[_0x589f('0x1d')](_0x1ed964)[_0x589f('0x1a')](function(){_0x26cd0d({'val':0x1});});});});}function insertAdditionalPhones(_0x297380){return new Promise(function(_0x56e21e,_0x363a54){var _0x2c5141=_0x297380[_0x589f('0x19')];var _0x563163=_0x2c5141['split'](';');var _0xde70a5=[];orderBy=0x0;for(var _0x8c39a3=0x0;_0x8c39a3<_0x563163['length'];_0x8c39a3++){_0xde70a5[_0x589f('0x1c')](splitAdditionalPhone(_0x297380['id'],_0x563163[_0x8c39a3]));}Promise[_0x589f('0x1d')](_0xde70a5)[_0x589f('0x1a')](function(){_0x56e21e({'val':_0x563163['length']});});});}function splitAdditionalPhone(_0x7a2e60,_0x6426aa){return new Promise(function(_0x3b4bea,_0x195582){var _0x5550f8=_0x6426aa[_0x589f('0x1e')](':');var _0x182580=_0x5550f8[0x0];var _0x7af16c=_0x5550f8[0x1];if(!_['isNil'](_0x7af16c)){var _0x3e0ba1=_0x7af16c[_0x589f('0x1e')]('|');var _0x1e01e0=[];for(var _0x53f794=0x0;_0x53f794<_0x3e0ba1[_0x589f('0x1b')];_0x53f794++){if(_0x3e0ba1[_0x53f794]!==''){var _0x4ec91b=_[_0x589f('0x1f')](promisesAdditionalPhones,{'contactId':_0x7a2e60,'phone':_0x3e0ba1[_0x53f794]});if(_0x4ec91b[_0x589f('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x7a2e60,'contactTypeId':_0x182580,'phone':_0x3e0ba1[_0x53f794],'orderBy':orderBy});}}}_0x3b4bea({'ok':0x1});}else _0x3b4bea({'res':0x0});});}function createAdditionalPhone(_0x2d8a9f,_0x204877,_0x2f22a3,_0x140b84){var _0x54ae5e='';var _0x36c481='';var _0x4bcd4d=_0x2f22a3[_0x589f('0x1e')]('§');_0x54ae5e=_0x4bcd4d[0x0];if(_0x4bcd4d[_0x589f('0x1b')]==0x2)_0x36c481=_0x4bcd4d[0x1];return new Promise(function(_0x5f138c,_0x10cb71){return db[_0x589f('0x20')]['findOne']({'where':{'CmContactId':_0x2d8a9f,'item':_0x54ae5e}})[_0x589f('0x1a')](function(_0x4b35b3){if(_0x4b35b3){return db[_0x589f('0x20')][_0x589f('0x21')]({'ItemTypeId':_0x204877,'description':_0x36c481,'OrderBy':_0x140b84},{'where':{'CmContactId':_0x2d8a9f,'item':_0x54ae5e}})[_0x589f('0x1a')](function(_0x2a1196){_0x5f138c({'res':_0x589f('0x22')});});}else{return db[_0x589f('0x20')][_0x589f('0x23')]({'CmContactId':_0x2d8a9f,'item':_0x54ae5e,'description':_0x36c481,'ItemTypeId':_0x204877,'OrderBy':_0x140b84,'ItemClass':_0x589f('0x24')})[_0x589f('0x1a')](function(_0x93bd31){_0x5f138c({'res':_0x589f('0x25')});});}});});}function insertCmHopper(_0x3c9164,_0x1aeafb,_0x381572,_0x2480ef,_0x4c5b8d){var _0x29f0fb=[_0x589f('0x26'),'cm_contacts.scheduledat',_0x589f('0x27'),_0x589f('0x28'),_0x1aeafb+'.'+_0x2480ef,_0x589f('0x29'),_0x589f('0x2a'),_0x589f('0x2b'),_0x589f('0x2c'),'\x22'+_0x4c5b8d+'\x22'];return squel['insert']()[_0x589f('0x2d')](_0x589f('0x2e'))[_0x589f('0x2f')]([_0x589f('0x11'),_0x589f('0x30'),_0x589f('0x31'),_0x589f('0x32'),_0x2480ef,'createdAt',_0x589f('0x33'),_0x589f('0x34'),'UserId','recallme'],squel['select']()[_0x589f('0x35')](_0x29f0fb)[_0x589f('0x12')](_0x1aeafb)['join'](_0x589f('0x36'),null,_0x589f('0x37')+_0x1aeafb+_0x589f('0x38'))[_0x589f('0x13')](_0x381572,null,_0x381572+_0x589f('0x14')+_0x1aeafb+'.'+_0x2480ef)[_0x589f('0x15')](_0x1aeafb+_0x589f('0x39'),_0x3c9164)[_0x589f('0x15')](_0x589f('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1aeafb,_0x381572,_0x2480ef,_0x589f('0x2e'),[_0x589f('0x3b'),_0x589f('0x3c')]))[_0x589f('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1aeafb,_0x381572,_0x2480ef,'cm_hopper',[_0x589f('0x3b')])))[_0x589f('0x3d')]();}function insertCmHopperBlack(_0x22dcb0,_0x4776c7,_0x2ec38a,_0x6fb6e0){var _0x2ae278=[_0x589f('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x4776c7+'.'+_0x6fb6e0,_0x589f('0x29'),_0x589f('0x2a')];return squel[_0x589f('0x3e')]()['into']('cm_hopper_black')['fromQuery']([_0x589f('0x11'),'ContactId','ListId',_0x6fb6e0,_0x589f('0x3f'),_0x589f('0x33')],squel[_0x589f('0x10')]()['fields'](_0x2ae278)[_0x589f('0x12')](_0x4776c7)[_0x589f('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4776c7+_0x589f('0x38'))[_0x589f('0x13')](_0x2ec38a,null,_0x2ec38a+_0x589f('0x14')+_0x4776c7+'.'+_0x6fb6e0)['where'](_0x4776c7+_0x589f('0x39'),_0x22dcb0)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x589f('0x15')](_0x589f('0x40'),squel[_0x589f('0x10')]()[_0x589f('0x41')]('phone')[_0x589f('0x12')](_0x589f('0x42'))[_0x589f('0x15')](_0x589f('0x43'),_0x22dcb0)[_0x589f('0x15')](_0x6fb6e0+_0x589f('0x16')+_0x4776c7+'.'+_0x6fb6e0)))['toString']();}function insertTzCmHopper(_0x2fe187,_0x54d10d,_0x470791,_0x18d531,_0x5a9272,_0x4e405f){var _0x357590=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x4e405f+_0x589f('0x44'),_0x589f('0x27'),_0x589f('0x28'),_0x54d10d+'.'+_0x18d531,_0x589f('0x29'),'cm_contacts.updatedAt','cm_contacts.priority',_0x589f('0x2c'),'\x22'+_0x5a9272+'\x22'];var _0x5e6fc4=squel['insert']()[_0x589f('0x2d')](_0x589f('0x2e'))['fromQuery']([_0x589f('0x11'),_0x589f('0x30'),_0x589f('0x31'),_0x589f('0x32'),_0x18d531,_0x589f('0x3f'),_0x589f('0x33'),_0x589f('0x34'),'UserId',_0x589f('0x45')],squel[_0x589f('0x10')]()['fields'](_0x357590)[_0x589f('0x12')](_0x54d10d)[_0x589f('0x13')](_0x589f('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x54d10d+_0x589f('0x38'))[_0x589f('0x13')](_0x470791,null,_0x470791+'.id\x20=\x20'+_0x54d10d+'.'+_0x18d531)[_0x589f('0x13')](_0x4e405f,null,_0x4e405f+_0x589f('0x14')+_0x54d10d+'.'+_0x18d531)[_0x589f('0x15')](_0x54d10d+_0x589f('0x39'),_0x2fe187)[_0x589f('0x15')](_0x589f('0x3a'),NOW)[_0x589f('0x15')](_0x589f('0x40'),selectNotIn(_0x54d10d,_0x470791,_0x18d531,'cm_hopper',[_0x589f('0x3b'),'\x22onlyIfOpen\x22']))[_0x589f('0x15')](_0x589f('0x40'),selectNotIn(_0x54d10d,_0x470791,_0x18d531,'cm_hopper',[_0x589f('0x3b')])))[_0x589f('0x3d')]();return _0x5e6fc4;}function insertTzCmHopperBlack(_0x293fc6,_0x321cf0,_0x1d1729,_0x1fef9b){var _0x2842b8=[_0x589f('0x26'),_0x589f('0x27'),'cm_contacts.ListId',_0x321cf0+'.'+_0x1fef9b,_0x589f('0x29'),_0x589f('0x2a')];return squel[_0x589f('0x3e')]()['into'](_0x589f('0x42'))['fromQuery'](['phone',_0x589f('0x31'),_0x589f('0x32'),_0x1fef9b,_0x589f('0x3f'),_0x589f('0x33')],squel[_0x589f('0x10')]()[_0x589f('0x35')](_0x2842b8)['from'](_0x321cf0)[_0x589f('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x321cf0+_0x589f('0x38'))[_0x589f('0x13')](_0x1d1729,null,_0x1d1729+_0x589f('0x14')+_0x321cf0+'.'+_0x1fef9b)[_0x589f('0x15')](_0x321cf0+_0x589f('0x39'),_0x293fc6)[_0x589f('0x15')](_0x589f('0x3a'),NOW)[_0x589f('0x15')](_0x589f('0x40'),squel[_0x589f('0x10')]()[_0x589f('0x41')]('phone')[_0x589f('0x12')](_0x589f('0x42'))[_0x589f('0x15')](_0x589f('0x43'),_0x293fc6)['where'](_0x1fef9b+_0x589f('0x16')+_0x321cf0+'.'+_0x1fef9b)))[_0x589f('0x3d')]();}function insertCmHopperAdditionalPhones(_0x5d319a){var _0x1112ce=[_0x589f('0x46'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x589f('0x47'),_0x589f('0x48')];return squel[_0x589f('0x3e')]()['into'](_0x589f('0x49'))[_0x589f('0x2f')]([_0x589f('0x4a'),_0x589f('0x11'),_0x589f('0x4b'),_0x589f('0x3f'),_0x589f('0x33')],squel['select']()['fields'](_0x1112ce)[_0x589f('0x12')]('cm_hopper')[_0x589f('0x13')](_0x589f('0x36'),null,_0x589f('0x4c'))[_0x589f('0x13')](_0x589f('0x4d'),null,_0x589f('0x4e'))[_0x589f('0x15')](_0x589f('0x4f'),_0x5d319a)['where'](_0x589f('0x3a'),NOW))[_0x589f('0x3d')]();}function insertCmContact(_0x553a67,_0x54cd0e,_0x212932,_0x6bf2e3){var _0x5e3321=_['concat'](_[_0x589f('0x50')](_0x6bf2e3),[_0x589f('0x32'),'CompanyId',_0x589f('0x3f'),_0x589f('0x33'),_0x589f('0x51')]);return squel[_0x589f('0x3e')]()[_0x589f('0x2d')](_0x589f('0x36'))[_0x589f('0x2f')](_0x5e3321,squel['select']()[_0x589f('0x35')](_0x5e3321)['from'](_0x54cd0e)[_0x589f('0x15')]('('+_0x212932[_0x589f('0x13')](',')+_0x589f('0x52'),squel[_0x589f('0x10')]()['fields'](_0x212932)[_0x589f('0x12')](_0x589f('0x36'))['where']('ListId\x20=\x20?',_0x553a67)['where'](_0x589f('0x53')))['where'](_0x589f('0x54'),squel['select']()[_0x589f('0x41')](_0x589f('0x55'),_0x589f('0x56'))[_0x589f('0x12')](_0x54cd0e)[_0x589f('0x57')](_0x212932[_0x589f('0x13')](','))))[_0x589f('0x3d')]();}function handleStop(){logger[_0x589f('0x58')](_0x589f('0x59'));stopped=!![];}function handleUncaughtException(_0x40e76d){logger[_0x589f('0x5a')](_0x40e76d[_0x589f('0x5b')]);process[_0x589f('0x5c')](0x1);}function handleError(_0x164ee2,_0x31f098){stats[_0x589f('0x5d')][_0x589f('0x1c')]({'name':_0x31f098[_0x589f('0x5e')],'message':_0x31f098['message'],'row':_0x164ee2});}function handleQuery(_0x2a6ddb){logger['info'](_0x2a6ddb);return db[_0x589f('0x5f')][_0x589f('0x60')](_0x2a6ddb)['spread'](function(_0x3ec94c){results[_0x589f('0x1c')](_0x3ec94c);})['catch'](function(_0x8883b4){logger[_0x589f('0x5a')](_0x8883b4['message']);});}function updateTzCampaigns(_0x39255a){return new Promise(function(_0x134d4d,_0x5c0dd1){var _0x132c06=squel['select']()[_0x589f('0x35')]([_0x589f('0x61'),'campaigns.dialTimezone'])[_0x589f('0x12')]('campaigns')['join'](_0x589f('0x62'),null,_0x589f('0x63'))[_0x589f('0x15')](_0x589f('0x64')+_0x39255a);db[_0x589f('0x5f')][_0x589f('0x60')](_0x132c06[_0x589f('0x3d')]())[_0x589f('0x65')](function(_0x77fdfa){var _0x382d89=[];for(var _0x570005=0x0;_0x570005<_0x77fdfa[_0x589f('0x1b')];_0x570005++){_0x382d89[_0x589f('0x1c')](getTimezoneData(_0x77fdfa[_0x570005],tmp_campaigns));}BPromise[_0x589f('0x1d')](_0x382d89)[_0x589f('0x1a')](function(){_0x134d4d({'val':0x1});});})[_0x589f('0x66')](function(_0x5f078d){logger['error'](_0x5f078d[_0x589f('0x5b')]);_0x134d4d({'val':0x0});});});}function updateTzVoiceQueues(_0xbfe739){return new Promise(function(_0x4fa2a0,_0x3553fd){var _0x38bf3c=squel[_0x589f('0x10')]()['fields'](['voice_queues.id',_0x589f('0x67')])['from'](_0x589f('0x68'))[_0x589f('0x13')]('voice_queues_has_cm_lists',null,_0x589f('0x69'))['where']('voice_queues_has_cm_lists.CmListId='+_0xbfe739);db['sequelize'][_0x589f('0x60')](_0x38bf3c[_0x589f('0x3d')]())[_0x589f('0x65')](function(_0x451ec9){var _0x51c271=[];for(var _0x28198f=0x0;_0x28198f<_0x451ec9[_0x589f('0x1b')];_0x28198f++){_0x51c271['push'](getTimezoneData(_0x451ec9[_0x28198f],tmp_voice_queues));}BPromise[_0x589f('0x1d')](_0x51c271)[_0x589f('0x1a')](function(){_0x4fa2a0({'val':0x1});});})['catch'](function(_0x4afe6c){logger[_0x589f('0x5a')](_0x4afe6c[_0x589f('0x5b')]);_0x4fa2a0({'val':0x0});});});}function getTimezoneData(_0x2b0f9c,_0x268697){return new Promise(function(_0x31dc06,_0x49ce01){var _0x387dba=shared[_0x589f('0x6a')];var _0x4c38bf=_0x387dba[_0x2b0f9c[_0x589f('0x6b')]];if(_[_0x589f('0x6c')](_0x4c38bf)){_0x31dc06({'ret':0x1});}else{var _0x2dfb52=_0x4c38bf[_0x589f('0x6d')];var _0x46c9da=squel[_0x589f('0x3e')]()['into'](_0x268697)['set']('id',_0x2b0f9c['id'])['set'](_0x589f('0x6e'),_0x2dfb52)[_0x589f('0x6f')](_0x589f('0x6b'),_0x2b0f9c['dialTimezone'])[_0x589f('0x3d')]();return db[_0x589f('0x5f')][_0x589f('0x60')](_0x46c9da)[_0x589f('0x65')](function(_0x57384f){_0x31dc06({'ret':0x1});})[_0x589f('0x66')](function(_0x472154){logger[_0x589f('0x5a')](_0x472154[_0x589f('0x5b')]);_0x49ce01({'ret':0x1});});}});}function handleTZQuery(_0xf4661){logger['info'](_0xf4661);return db[_0x589f('0x5f')][_0x589f('0x60')](_0xf4661)[_0x589f('0x65')](function(_0x12da5e){})[_0x589f('0x66')](function(_0x3e6635){logger[_0x589f('0x5a')](_0x3e6635[_0x589f('0x5b')]);});}function main(_0x41c42c,_0x4b61f0,_0x3859ff,_0x4f36e1){logger[_0x589f('0x58')]('main',_0x41c42c,JSON[_0x589f('0x70')](_0x4b61f0));process['send']('start');var _0x1f5f66=_0x4b61f0[_0x589f('0x71')];var _0x4bf614=_[_0x589f('0x72')](_0x1f5f66);var _0x1f67c9=_0x4b61f0['socket_timestamp'];var _0x401afe=path[_0x589f('0x13')](config['root'],_0x589f('0x73'),_0x1f67c9+_0x589f('0x74'));hasTZ=_[_0x589f('0x50')](_0x1f5f66)[_0x589f('0x75')]('dialTimezone');var _0x41cebf=_['keys'](_0x1f5f66)[_0x589f('0x13')]();logger[_0x589f('0x58')]('header',_0x41cebf);db[_0x589f('0x76')][_0x589f('0x18')]({'raw':!![],'attributes':['id','name']})[_0x589f('0x1a')](function(_0x62302a){for(var _0x2ac10a=0x0;_0x2ac10a<_0x62302a[_0x589f('0x1b')];_0x2ac10a++){if(_0x62302a[_0x2ac10a][_0x589f('0x77')]in _0x1f5f66){contactItemTypes[_0x589f('0x1c')](_0x62302a[_0x2ac10a]);delete _0x4bf614[_0x62302a[_0x2ac10a][_0x589f('0x77')]];hasAdditionalPhones=!![];}for(var _0x1e3151 in _0x1f5f66){if(_0x62302a[_0x2ac10a]['name']+_0x589f('0x78')===_0x1e3151){phoneDescriptions['push']({'itemTypeId':_0x62302a[_0x2ac10a]['id'],'description':_0x1e3151});delete _0x4bf614[_0x1e3151];}}}if(hasAdditionalPhones)_0x4bf614[_0x589f('0x19')]='';var _0x1263b2=_[_0x589f('0x50')](_0x4bf614)[_0x589f('0x13')]();logger[_0x589f('0x58')]('header',_0x1263b2);fs[_0x589f('0x79')](_0x401afe,_0x1263b2+'\x0a');Papa[_0x589f('0x7a')](fs['createReadStream'](_0x41c42c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x334d44,_0x1e40b1){try{for(var _0x61b24b=0x0,_0xd1d6c2=[];_0x61b24b<_0x334d44[_0x589f('0x7b')][_0x589f('0x1b')];_0x61b24b++){stats[_0x589f('0x7c')]+=0x1;if(_0x334d44['errors'][_0x61b24b]){handleError(_0x334d44[_0x589f('0x7b')][_0x61b24b],_0x334d44[_0x589f('0x5d')][_0x61b24b]);}else{var _0xb208f6=[];var _0x4f4e5b=[];var _0x39ada3={};for(var _0x4cb3e8 in _0x1f5f66){let _0xe0e54d=contactItemTypes[_0x589f('0x7d')](_0x3c65b3=>_0x3c65b3[_0x589f('0x77')]===_0x4cb3e8);let _0x205a80=contactItemTypes[_0x589f('0x7d')](_0x3b9490=>_0x3b9490[_0x589f('0x77')]+_0x589f('0x78')===_0x4cb3e8);if(_[_0x589f('0x6c')](_0xe0e54d)&&_[_0x589f('0x6c')](_0x205a80)){if(_0x1f5f66['hasOwnProperty'](_0x4cb3e8)){if(_0x334d44[_0x589f('0x7b')][_0x61b24b][_0x1f5f66[_0x4cb3e8]]){var _0x1e23b8=_[_0x589f('0x7e')](_0x334d44[_0x589f('0x7b')][_0x61b24b][_0x1f5f66[_0x4cb3e8]][_0x589f('0x7f')](/"/g,'\x27'));switch(_0x4cb3e8){case _0x589f('0x30'):var _0x23b847=moment(_0x1e23b8,_0x589f('0xe'),!![]);if(_0x23b847[_0x589f('0x80')]()){_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x1e23b8+'\x22');}else{_0xb208f6[_0x589f('0x1c')](_0x589f('0x81'));}break;case _0x589f('0x34'):var _0x20672a=parseInt(_0x1e23b8);_0x1e23b8=_['isNaN'](_0x20672a)||_0x20672a<0x0||_0x20672a>0x4?_0x4f36e1?0x3:0x2:_0x20672a;_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x1e23b8+'\x22');break;case'UserId':var _0x1695e8=parseInt(_0x1e23b8);if(_[_0x589f('0x82')](_0x1695e8)&&_['includes'](_0x3859ff,_0x1695e8)){_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x1695e8+'\x22');}else{_0xb208f6[_0x589f('0x1c')](_0x589f('0x83'));}break;case _0x589f('0x84'):if(isEmail(_0x1e23b8)){_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x1e23b8+'\x22');}else{_0xb208f6['push'](_0x589f('0x85'));}break;case _0x589f('0x86'):var _0x33995e=moment(_0x1e23b8,'YYYY-MM-DD',!![]);if(_0x33995e['isValid']()){_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x1e23b8+'\x22');}else{_0xb208f6[_0x589f('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x589f('0x6b'):var _0x5d2b7f=shared[_0x589f('0x6a')];var _0x1eedb5=_0x5d2b7f[_0x1e23b8];if(!_['isNil'](_0x1eedb5)){var _0x3f72c9=_0x1eedb5[_0x589f('0x6d')];_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x1e23b8+'\x22');_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x3f72c9+'\x22');}break;default:_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x1e23b8+'\x22');}}else{switch(_0x4cb3e8){case _0x589f('0x87'):case _0x589f('0x11'):_0xb208f6['push'](_0x4cb3e8+_0x589f('0x88'));break;default:_0xd1d6c2[_0x589f('0x1c')]('\x22\x22');}}}}else{var _0x363512='';if(!_[_0x589f('0x6c')](_0xe0e54d)){if(!_0x39ada3['hasOwnProperty'](_0xe0e54d['id'])){if(!_[_0x589f('0x6c')](_0x334d44[_0x589f('0x7b')][_0x61b24b][_0x1f5f66[_0x4cb3e8]])){var _0x1e23b8=_['trim'](_0x334d44['data'][_0x61b24b][_0x1f5f66[_0x4cb3e8]][_0x589f('0x7f')](/"/g,'\x27'));var _0x250834=phoneDescriptions['find'](_0x47a4c3=>_0x47a4c3[_0x589f('0x89')]===_0xe0e54d['id']);if(!_['isNil'](_0x250834)){var _0xef6854=_[_0x589f('0x7e')](_0x334d44[_0x589f('0x7b')][_0x61b24b][_0x1f5f66[_0x250834[_0x589f('0x8a')]]][_0x589f('0x7f')](/"/g,'\x27'));if(!_[_0x589f('0x6c')](_0xef6854))_0x1e23b8=_0x1e23b8+'§'+_0xef6854;}if(_0x363512=='')_0x363512=_0x1e23b8;else _0x363512+='|'+_0x1e23b8;}_0x4f4e5b[_0x589f('0x1c')](_0xe0e54d['id']+':'+_0x363512);_0x39ada3[_0xe0e54d['id']]=0x1;}}}}if(hasAdditionalPhones){_0xd1d6c2[_0x589f('0x1c')]('\x22'+_0x4f4e5b[_0x589f('0x13')](';')+'\x22');}if(_0xb208f6[_0x589f('0x1b')]){handleError(_0x334d44[_0x589f('0x7b')][_0x61b24b],{'code':_0x589f('0x8b'),'message':_0xb208f6[_0x589f('0x13')]()});}else{fs[_0x589f('0x8c')](_0x401afe,_0xd1d6c2[_0x589f('0x13')]()+'\x0a');}_0xd1d6c2=[];}if(!(stats['rows']%0xc8)){socket[_0x589f('0x8d')]('contact:import:'+_0x1f67c9,stats);stats[_0x589f('0x5d')]=[];}}if(stopped){logger[_0x589f('0x58')]('Abort\x20parser');_0x1e40b1[_0x589f('0x8e')]();}}catch(_0x5c9163){handleError(_0x334d44['data'][_0x61b24b],{'code':'SystemError','message':_0x5c9163[_0x589f('0x5b')]});logger[_0x589f('0x5a')]('step',_0x5c9163[_0x589f('0x5b')]);}},'complete':function(){try{var _0xd1a43b=[];var _0x2dbf6a=[];var _0x3352fd=_0x589f('0x36');if(_0x4b61f0[_0x589f('0x8f')]&&_0x4b61f0[_0x589f('0x8f')][_0x589f('0x1b')]){_0x3352fd=_0x589f('0x90')+_0x1f67c9;_0xd1a43b[_0x589f('0x1c')](_0x589f('0x91')+_0x3352fd+_0x589f('0x92'));}tmp_campaigns='campaigns_'+_0x1f67c9;tmp_voice_queues=_0x589f('0x93')+_0x1f67c9;_0x2dbf6a['push'](_0x589f('0x91')+tmp_campaigns+_0x589f('0x94'));_0x2dbf6a[_0x589f('0x1c')](_0x589f('0x91')+tmp_voice_queues+_0x589f('0x94'));BPromise[_0x589f('0x95')](_0x2dbf6a,handleTZQuery)[_0x589f('0x1a')](function(_0x13ba8e){updateTzCampaigns(_0x4b61f0['ListId'])[_0x589f('0x1a')](function(_0x250ec5){updateTzVoiceQueues(_0x4b61f0['ListId'])[_0x589f('0x1a')](function(_0x4c1157){if(hasTZ)_0x1263b2=_0x1263b2['replace']('dialTimezone',_0x589f('0x96'));var _0x2bc04a=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x401afe,_0x3352fd,_0x1263b2,_0x4b61f0[_0x589f('0x32')],_0x4b61f0[_0x589f('0x97')]||null,NOW,NOW);if(_['isNil'](_0x1f5f66['scheduledat'])){_0x2bc04a+=_0x589f('0x98');}_0xd1a43b[_0x589f('0x1c')](_0x2bc04a);if(_0x4b61f0[_0x589f('0x8f')]&&_0x4b61f0[_0x589f('0x8f')][_0x589f('0x1b')]){_0xd1a43b[_0x589f('0x1c')](insertCmContact(_0x4b61f0[_0x589f('0x32')],_0x3352fd,_0x4b61f0[_0x589f('0x8f')],_0x1f5f66));_0xd1a43b[_0x589f('0x1c')](_0x589f('0x99')+_0x3352fd+';');}BPromise[_0x589f('0x95')](_0xd1a43b,handleQuery)[_0x589f('0x1a')](function(_0x1fda07){BPromise[_0x589f('0x1d')]([handleAdditionalPhones()])[_0x589f('0x1a')](function(){_0xd1a43b=[];for(var _0x5d037c=0x0;_0x5d037c\x20\x20');}var _0x2fa972=path[_0x589f('0x13')](config[_0x589f('0xa6')],_0x589f('0x73'),process['argv'][0x2]);if(!fs[_0x589f('0xa7')](_0x2fa972)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x464201={};try{_0x464201=JSON[_0x589f('0x7a')](process[_0x589f('0xa5')][0x3]);if(!_0x464201[_0x589f('0x71')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x464201['binding'][_0x589f('0x11')]){throw new Error(_0x589f('0xa8'));}if(!_0x464201[_0x589f('0x71')]['firstName']){throw new Error(_0x589f('0xa9'));}var _0x5e0b46=0x0;if(_0x464201['binding'][_0x589f('0xaa')]){_0x5e0b46=0x1;}if(!_0x464201[_0x589f('0x32')]){throw new Error(_0x589f('0xab'));}}catch(_0x506509){throw new Error('body\x20id\x20mandatory');}var _0x7ae413=[];try{_0x7ae413=_['map'](JSON[_0x589f('0x7a')](process[_0x589f('0xa5')][0x4]),'id');}catch(_0x262a2c){logger[_0x589f('0x58')](_0x589f('0xac'));}main(_0x2fa972,_0x464201,_0x7ae413,_0x5e0b46);}validate();process['on'](_0x589f('0xad'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 23d5a7e..54b6f57 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x463f=['hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','description','emit','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','contact:import:','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','then','catch','message','split','all','filter','CmContactHasItem','findOne','updated','create','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','ListId','cm_contacts','.CmListId','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','id\x20IN\x20?','min_id','group','error','errors','code','info','query','spread','stringify','start','clone','socket_timestamp','root','.csv','ContactItemType','findAll','name','_description','header','parse','createReadStream','data','rows','find'];(function(_0x532807,_0x92d7fd){var _0x40b83f=function(_0x1c312c){while(--_0x1c312c){_0x532807['push'](_0x532807['shift']());}};_0x40b83f(++_0x92d7fd);}(_0x463f,0x164));var _0xf463=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x463f[_0x1cc8fe];return _0x230054;};'use strict';var fs=require('fs');var path=require(_0xf463('0x0'));var _=require(_0xf463('0x1'));var Papa=require(_0xf463('0x2'));var util=require(_0xf463('0x3'));var BPromise=require(_0xf463('0x4'));var moment=require(_0xf463('0x5'));var squel=require(_0xf463('0x6'));var Redis=require('ioredis');var db=require(_0xf463('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xf463('0x8'))(_0xf463('0x9'));config['redis']=_['defaults'](config[_0xf463('0xa')],{'host':_0xf463('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf463('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xf463('0xc')](_0xf463('0xd'));var tempTableName=_0xf463('0xe')+moment()[_0xf463('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x365c4f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x365c4f);}function selectNotIn(_0x11673c,_0x5b6b69,_0x18abc9,_0x184d8a,_0x124ffc){return squel[_0xf463('0xf')]()[_0xf463('0x10')](_0xf463('0x11'))[_0xf463('0x12')](_0x184d8a)[_0xf463('0x13')](_0x5b6b69,null,_0x5b6b69+_0xf463('0x14')+_0x184d8a+'.'+_0x18abc9)['where'](_0x184d8a+'.'+_0x18abc9+_0xf463('0x15')+_0x11673c+'.'+_0x18abc9)[_0xf463('0x16')](_0x5b6b69+_0xf463('0x17')+_0x124ffc[_0xf463('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x411de6,_0x354525){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf463('0x18')]['query'](_0xf463('0x19')+tempTableName)['spread'](function(_0x9e4bc4){if(_0x9e4bc4!==null){var _0x1508ad=[];for(var _0x200c86=0x0;_0x200c86<_0x9e4bc4[_0xf463('0x1a')];_0x200c86++){var _0x5e2822=_0x9e4bc4[_0x200c86];if(!_[_0xf463('0x1b')](_0x5e2822[_0xf463('0x11')])){if(!_[_0xf463('0x1b')](_0x5e2822[_0xf463('0x1c')]))_0x1508ad['push'](insertAdditionalPhones(_0x5e2822));promisesContact[_0xf463('0x1d')]({'contact':_0x5e2822});}}}Promise['all'](_0x1508ad)[_0xf463('0x1e')](function(){_0x411de6({'val':0x1});});})[_0xf463('0x1f')](function(_0x4e0fc6){logger['error'](_0x4e0fc6[_0xf463('0x20')]);});});}function insertAdditionalPhones(_0x43d7e4){return new Promise(function(_0x106e47,_0xd55ed9){var _0x806832=_0x43d7e4['AdditionalPhones'];if(_[_0xf463('0x1b')](_0x806832))_0xd55ed9({'val':0x0});else{var _0x38e201=_0x806832[_0xf463('0x21')](';');var _0x442e25=[];orderBy=0x0;for(var _0xf1c2f9=0x0;_0xf1c2f9<_0x38e201[_0xf463('0x1a')];_0xf1c2f9++){_0x442e25[_0xf463('0x1d')](splitAdditionalPhone(_0x43d7e4['id'],_0x38e201[_0xf1c2f9]));}Promise[_0xf463('0x22')](_0x442e25)[_0xf463('0x1e')](function(){_0x106e47({'val':_0x38e201['length']});});}});}function splitAdditionalPhone(_0x259161,_0x558068){return new Promise(function(_0x5259cd,_0x25fb78){var _0x470cb4=_0x558068[_0xf463('0x21')](':');var _0x6aab83=_0x470cb4[0x0];var _0x3216fa=_0x470cb4[0x1];if(_0x3216fa!==''){var _0x17c494=_0x3216fa[_0xf463('0x21')]('|');var _0x39079d=[];for(var _0x7c0e76=0x0;_0x7c0e76<_0x17c494[_0xf463('0x1a')];_0x7c0e76++){if(_0x17c494[_0x7c0e76]!==''){var _0x1ccbcf=_[_0xf463('0x23')](promisesAdditionalPhones,{'contactId':_0x259161,'phone':_0x17c494[_0x7c0e76]});if(_0x1ccbcf[_0xf463('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xf463('0x1d')]({'contactId':_0x259161,'contactTypeId':_0x6aab83,'phone':_0x17c494[_0x7c0e76],'orderBy':orderBy});}}}_0x5259cd({'ok':0x1});}else _0x5259cd({'res':0x0});});}function createAdditionalPhone(_0x576d9d,_0x114fec,_0x2af6c2,_0xe13dce){var _0x9ddf2='';var _0x419aea='';var _0x410a70=_0x2af6c2[_0xf463('0x21')]('§');_0x9ddf2=_0x410a70[0x0];if(_0x410a70[_0xf463('0x1a')]==0x2)_0x419aea=_0x410a70[0x1];return new Promise(function(_0x3b0df9,_0x3c947a){return db[_0xf463('0x24')][_0xf463('0x25')]({'where':{'CmContactId':_0x576d9d,'item':_0x9ddf2}})[_0xf463('0x1e')](function(_0x1cdc9b){if(_0x1cdc9b){return db[_0xf463('0x24')]['update']({'ItemTypeId':_0x114fec,'description':_0x419aea,'OrderBy':_0xe13dce},{'where':{'CmContactId':_0x576d9d,'item':_0x9ddf2}})[_0xf463('0x1e')](function(_0x1b6fc2){_0x3b0df9({'res':_0xf463('0x26')});});}else{return db[_0xf463('0x24')][_0xf463('0x27')]({'CmContactId':_0x576d9d,'item':_0x9ddf2,'ItemTypeId':_0x114fec,'description':_0x419aea,'OrderBy':_0xe13dce,'ItemClass':'PHONE'})[_0xf463('0x1e')](function(_0x9ec0d4){_0x3b0df9({'res':_0xf463('0x28')});});}});});}function updateContact(_0x39e53e){return new Promise(function(_0x2821cb,_0x3eebfd){var _0x5b3f14=_0x39e53e['id'];delete _0x39e53e['id'];return db['CmContact']['update'](_0x39e53e,{'where':{'id':_0x5b3f14}})[_0xf463('0x1e')](function(_0x438ce2){updatedRows+=0x1;return db[_0xf463('0x29')]['update']({'phone':_0x39e53e[_0xf463('0x11')]},{'where':{'ContactId':_0x5b3f14}})[_0xf463('0x1e')](function(_0x5b0552){_0x2821cb({'ret':'OK'});});});});}function insertCmHopper(_0x509888,_0x22abc8,_0x7bcd31,_0xde5532,_0x4c1fbe){var _0x8c3c70=[_0xf463('0x2a'),_0xf463('0x2b'),_0xf463('0x2c'),_0xf463('0x2d'),_0x22abc8+'.'+_0xde5532,_0xf463('0x2e'),_0xf463('0x2f'),'cm_contacts.priority',_0xf463('0x30'),'\x22'+_0x4c1fbe+'\x22'];return squel[_0xf463('0x31')]()[_0xf463('0x32')](_0xf463('0x33'))['fromQuery'](['phone',_0xf463('0x34'),_0xf463('0x35'),'ListId',_0xde5532,_0xf463('0x36'),_0xf463('0x37'),_0xf463('0x38'),_0xf463('0x39'),'recallme'],squel[_0xf463('0xf')]()[_0xf463('0x3a')](_0x8c3c70)[_0xf463('0x12')](_0x22abc8)['join']('cm_contacts',null,_0xf463('0x3b')+_0x22abc8+'.CmListId')[_0xf463('0x13')](_0x7bcd31,null,_0x7bcd31+'.id\x20=\x20'+_0x22abc8+'.'+_0xde5532)['where'](_0x22abc8+_0xf463('0x3c'),_0x509888)[_0xf463('0x16')](_0xf463('0x3d'),NOW)[_0xf463('0x16')](_0xf463('0x3e'),selectNotIn(_0x22abc8,_0x7bcd31,_0xde5532,_0xf463('0x33'),[_0xf463('0x3f'),_0xf463('0x40')]))[_0xf463('0x16')](_0xf463('0x3e'),selectNotIn(_0x22abc8,_0x7bcd31,_0xde5532,_0xf463('0x33'),['\x22always\x22'])))[_0xf463('0x41')]();}function insertCmHopperBlack(_0x2a2ca6,_0x538fd6,_0x4f8428,_0x2f7d48){var _0x525717=[_0xf463('0x2a'),_0xf463('0x2c'),'cm_contacts.ListId',_0x538fd6+'.'+_0x2f7d48,_0xf463('0x2e'),_0xf463('0x2f')];return squel[_0xf463('0x31')]()[_0xf463('0x32')](_0xf463('0x42'))[_0xf463('0x43')](['phone',_0xf463('0x35'),_0xf463('0x44'),_0x2f7d48,'createdAt',_0xf463('0x37')],squel[_0xf463('0xf')]()[_0xf463('0x3a')](_0x525717)[_0xf463('0x12')](_0x538fd6)[_0xf463('0x13')](_0xf463('0x45'),null,_0xf463('0x3b')+_0x538fd6+_0xf463('0x46'))[_0xf463('0x13')](_0x4f8428,null,_0x4f8428+'.id\x20=\x20'+_0x538fd6+'.'+_0x2f7d48)['where'](_0x538fd6+'.CmListId\x20=\x20?',_0x2a2ca6)[_0xf463('0x16')](_0xf463('0x3d'),NOW)[_0xf463('0x16')](_0xf463('0x3e'),squel[_0xf463('0xf')]()['field'](_0xf463('0x11'))['from'](_0xf463('0x42'))[_0xf463('0x16')](_0xf463('0x47'),_0x2a2ca6)[_0xf463('0x16')](_0x2f7d48+_0xf463('0x48'),_0x538fd6+'.'+_0x2f7d48)))['toString']();}function insertCmHopperAdditionalPhones(_0x2a09ee){var _0x29d21c=[_0xf463('0x49'),_0xf463('0x4a'),_0xf463('0x4b'),_0xf463('0x4c'),_0xf463('0x4d')];return squel[_0xf463('0x31')]()[_0xf463('0x32')](_0xf463('0x4e'))[_0xf463('0x43')]([_0xf463('0x4f'),_0xf463('0x11'),_0xf463('0x50'),_0xf463('0x36'),_0xf463('0x37')],squel['select']()['fields'](_0x29d21c)[_0xf463('0x12')](_0xf463('0x33'))[_0xf463('0x13')](_0xf463('0x45'),null,_0xf463('0x51'))[_0xf463('0x13')](_0xf463('0x52'),null,_0xf463('0x53'))[_0xf463('0x16')](_0xf463('0x54'),_0x2a09ee)['where'](_0xf463('0x3d'),NOW))[_0xf463('0x41')]();}function insertCmContact(_0x24ac9a,_0x1a5c8c,_0x3d6451,_0x139c76){var _0x5288e9=_['concat'](_[_0xf463('0x55')](_0x139c76),[_0xf463('0x44'),_0xf463('0x56'),_0xf463('0x36'),'updatedAt']);return squel['insert']()[_0xf463('0x32')]('cm_contacts')[_0xf463('0x43')](_0x5288e9,squel[_0xf463('0xf')]()[_0xf463('0x3a')](_0x5288e9)[_0xf463('0x12')](_0x1a5c8c)[_0xf463('0x16')]('('+_0x3d6451['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xf463('0xf')]()[_0xf463('0x3a')](_0x3d6451)[_0xf463('0x12')](_0xf463('0x45'))[_0xf463('0x16')](_0xf463('0x47'),_0x24ac9a))[_0xf463('0x16')](_0xf463('0x57'),squel[_0xf463('0xf')]()[_0xf463('0x10')]('MIN(id)',_0xf463('0x58'))['from'](_0x1a5c8c)[_0xf463('0x59')](_0x3d6451[_0xf463('0x13')](','))))['toString']();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2e6a4e){logger[_0xf463('0x5a')](_0x2e6a4e[_0xf463('0x20')]);process['exit'](0x1);}function handleError(_0x4e84f4,_0x121123){stats[_0xf463('0x5b')]['push']({'name':_0x121123[_0xf463('0x5c')],'message':_0x121123[_0xf463('0x20')],'row':_0x4e84f4});}function handleQuery(_0x2db304){logger[_0xf463('0x5d')](_0x2db304);return db[_0xf463('0x18')][_0xf463('0x5e')](_0x2db304)[_0xf463('0x5f')](function(_0x39c6e0){results[_0xf463('0x1d')](_0x39c6e0);})[_0xf463('0x1f')](function(_0x30b36a){logger['error'](_0x30b36a[_0xf463('0x20')]);});}function main(_0x2f33e0,_0x4d488f,_0x5569f,_0x5218b5){logger['info']('main',_0x2f33e0,JSON[_0xf463('0x60')](_0x4d488f));process['send'](_0xf463('0x61'));var _0x404610=_0x4d488f['binding'];var _0xd14cab=_[_0xf463('0x62')](_0x404610);var _0x4c88a0=_0x4d488f[_0xf463('0x63')];var _0x85cc20=path[_0xf463('0x13')](config[_0xf463('0x64')],'server/files/tmp',_0x4c88a0+_0xf463('0x65'));logger[_0xf463('0x5d')]('body',_0x4d488f);db[_0xf463('0x66')][_0xf463('0x67')]({'raw':!![],'attributes':['id','name']})[_0xf463('0x1e')](function(_0x205a73){for(var _0x10ad86=0x0;_0x10ad86<_0x205a73[_0xf463('0x1a')];_0x10ad86++){if(_0x205a73[_0x10ad86][_0xf463('0x68')]in _0x404610){contactItemTypes[_0xf463('0x1d')](_0x205a73[_0x10ad86]);delete _0xd14cab[_0x205a73[_0x10ad86][_0xf463('0x68')]];hasAdditionalPhones=!![];}for(var _0x542197 in _0x404610){if(_0x205a73[_0x10ad86]['name']+_0xf463('0x69')===_0x542197){phoneDescriptions['push']({'itemTypeId':_0x205a73[_0x10ad86]['id'],'description':_0x542197});delete _0xd14cab[_0x542197];}}}if(hasAdditionalPhones)_0xd14cab['AdditionalPhones']='';var _0x3acbf5=_['keys'](_0xd14cab)['join']();logger[_0xf463('0x5d')](_0xf463('0x6a'),_0x3acbf5);fs['writeFileSync'](_0x85cc20,_0x3acbf5+'\x0a');Papa[_0xf463('0x6b')](fs[_0xf463('0x6c')](_0x2f33e0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2d32cd,_0x7ac31){try{for(var _0x470dcc=0x0,_0x30a4b4=[];_0x470dcc<_0x2d32cd[_0xf463('0x6d')][_0xf463('0x1a')];_0x470dcc++){stats[_0xf463('0x6e')]+=0x1;if(_0x2d32cd[_0xf463('0x5b')][_0x470dcc]){handleError(_0x2d32cd[_0xf463('0x6d')][_0x470dcc],_0x2d32cd[_0xf463('0x5b')][_0x470dcc]);}else{var _0x3a5b53=[];var _0x5838c9=[];var _0x300133={};for(var _0x52a33b in _0x404610){let _0xfde0de=contactItemTypes[_0xf463('0x6f')](_0x3983bf=>_0x3983bf['name']===_0x52a33b);let _0x2c4790=contactItemTypes[_0xf463('0x6f')](_0xf1fd65=>_0xf1fd65['name']+_0xf463('0x69')===_0x52a33b);if(_[_0xf463('0x1b')](_0xfde0de)&&_[_0xf463('0x1b')](_0x2c4790)){if(_0x404610[_0xf463('0x70')](_0x52a33b)){if(_0x2d32cd['data'][_0x470dcc][_0x404610[_0x52a33b]]){var _0x555c88=_['trim'](_0x2d32cd[_0xf463('0x6d')][_0x470dcc][_0x404610[_0x52a33b]][_0xf463('0x71')](/"/g,'\x27'));switch(_0x52a33b){case _0xf463('0x34'):var _0x5e24c2=moment(_0x555c88,_0xf463('0xd'),!![]);if(_0x5e24c2[_0xf463('0x72')]()){_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x555c88+'\x22');}else{_0x3a5b53[_0xf463('0x1d')](_0xf463('0x73'));}break;case _0xf463('0x38'):var _0x291404=parseInt(_0x555c88);_0x555c88=_[_0xf463('0x74')](_0x291404)||_0x291404<0x0||_0x291404>0x4?_0x5218b5?0x3:0x2:_0x291404;_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x555c88+'\x22');break;case _0xf463('0x39'):var _0x4560cb=parseInt(_0x555c88);if(_['isNumber'](_0x4560cb)&&_[_0xf463('0x75')](_0x5569f,_0x4560cb)){_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x4560cb+'\x22');}else{_0x3a5b53[_0xf463('0x1d')]('agent\x20not\x20exists');}break;case _0xf463('0x76'):if(isEmail(_0x555c88)){_0x30a4b4['push']('\x22'+_0x555c88+'\x22');}else{_0x3a5b53[_0xf463('0x1d')](_0xf463('0x77'));}break;case _0xf463('0x78'):var _0x921ca3=moment(_0x555c88,_0xf463('0x79'),!![]);if(_0x921ca3[_0xf463('0x72')]()){_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x555c88+'\x22');}else{_0x3a5b53[_0xf463('0x1d')](_0xf463('0x7a'));}break;default:_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x555c88+'\x22');}}else{switch(_0x52a33b){case _0xf463('0x7b'):case _0xf463('0x11'):_0x3a5b53['push'](_0x52a33b+_0xf463('0x7c'));break;default:_0x30a4b4[_0xf463('0x1d')]('\x22\x22');}}}}else{var _0x7b1b33='';if(!_[_0xf463('0x1b')](_0xfde0de)){if(!_0x300133['hasOwnProperty'](_0xfde0de['id'])){for(var _0x88740d=0x0;_0x88740d<_0x404610[_0x52a33b]['length'];_0x88740d++){var _0x555c88=_[_0xf463('0x7d')](_0x2d32cd[_0xf463('0x6d')][_0x470dcc][_0x404610[_0x52a33b][_0x88740d]][_0xf463('0x71')](/"/g,'\x27'));var _0x860b5d=phoneDescriptions[_0xf463('0x6f')](_0x2815b7=>_0x2815b7['itemTypeId']===_0xfde0de['id']);if(!_['isNil'](_0x860b5d)){var _0x16b722=_[_0xf463('0x7d')](_0x2d32cd[_0xf463('0x6d')][_0x470dcc][_0x404610[_0x860b5d[_0xf463('0x7e')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x16b722))_0x555c88=_0x555c88+'§'+_0x16b722;}if(_0x7b1b33=='')_0x7b1b33=_0x555c88;else _0x7b1b33+='|'+_0x555c88;}_0x5838c9[_0xf463('0x1d')](_0xfde0de['id']+':'+_0x7b1b33);_0x300133[_0xfde0de['id']]=0x1;}}}}if(hasAdditionalPhones){_0x30a4b4['push']('\x22'+_0x5838c9[_0xf463('0x13')](';')+'\x22');}if(_0x3a5b53[_0xf463('0x1a')]){handleError(_0x2d32cd[_0xf463('0x6d')][_0x470dcc],{'code':'SystemRow','message':_0x3a5b53[_0xf463('0x13')]()});}else{fs['appendFileSync'](_0x85cc20,_0x30a4b4[_0xf463('0x13')]()+'\x0a');}_0x30a4b4=[];}if(!(stats[_0xf463('0x6e')]%0xc8)){socket[_0xf463('0x7f')]('contact:import:'+_0x4c88a0,stats);stats[_0xf463('0x5b')]=[];}}if(stopped){logger['info'](_0xf463('0x80'));_0x7ac31['abort']();}}catch(_0x248ba7){handleError(_0x2d32cd[_0xf463('0x6d')][_0x470dcc],{'code':_0xf463('0x81'),'message':_0x248ba7[_0xf463('0x20')]});logger[_0xf463('0x5a')](_0xf463('0x82'),_0x248ba7[_0xf463('0x20')]);}},'complete':function(){try{var _0x2d0b2c=[];var _0x48821d=tempTableName;_0x2d0b2c[_0xf463('0x1d')](_0xf463('0x83')+_0x48821d+_0xf463('0x84'));logger[_0xf463('0x5d')](_0xf463('0x85'),contactItemTypes[_0xf463('0x1a')]);var _0x45baf4=util[_0xf463('0xc')](_0xf463('0x86'),_0x85cc20,_0x48821d,_0x3acbf5,_0x4d488f['ListId'],_0x4d488f['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x404610[_0xf463('0x34')])){_0x45baf4+=_0xf463('0x87');}_0x2d0b2c[_0xf463('0x1d')](_0x45baf4);BPromise[_0xf463('0x88')](_0x2d0b2c,handleQuery)[_0xf463('0x1e')](function(_0x580d01){BPromise['all']([handleAdditionalPhones()])[_0xf463('0x1e')](function(){_0x2d0b2c=[];for(var _0x278080=0x0;_0x278080\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x58cc,0x7a));var _0xc58c=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x58cc[_0x286726];return _0xcd4fe9;};'use strict';var fs=require('fs');var path=require(_0xc58c('0x0'));var _=require(_0xc58c('0x1'));var Papa=require(_0xc58c('0x2'));var util=require(_0xc58c('0x3'));var BPromise=require(_0xc58c('0x4'));var moment=require(_0xc58c('0x5'));var squel=require('squel');var Redis=require(_0xc58c('0x6'));var db=require(_0xc58c('0x7'))['db'];var config=require(_0xc58c('0x8'));var logger=require(_0xc58c('0x9'))(_0xc58c('0xa'));config[_0xc58c('0xb')]=_['defaults'](config['redis'],{'host':_0xc58c('0xc'),'port':0x18eb});var socket=require(_0xc58c('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xc58c('0xe')](_0xc58c('0xf'));var tempTableName='cm_contacts_temp_'+moment()[_0xc58c('0xe')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xd875c5){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))*$/[_0xc58c('0x10')](_0xd875c5);}function selectNotIn(_0x230863,_0x1a2b6a,_0x1d7e7d,_0x1bd97d,_0x5abb2e){return squel[_0xc58c('0x11')]()[_0xc58c('0x12')](_0xc58c('0x13'))[_0xc58c('0x14')](_0x1bd97d)[_0xc58c('0x15')](_0x1a2b6a,null,_0x1a2b6a+_0xc58c('0x16')+_0x1bd97d+'.'+_0x1d7e7d)[_0xc58c('0x17')](_0x1bd97d+'.'+_0x1d7e7d+_0xc58c('0x18')+_0x230863+'.'+_0x1d7e7d)[_0xc58c('0x17')](_0x1a2b6a+_0xc58c('0x19')+_0x5abb2e['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x233b9c,_0x59b60a){promisesAdditionalPhones=[];promisesContact=[];return db[_0xc58c('0x1a')][_0xc58c('0x1b')](_0xc58c('0x1c')+tempTableName)[_0xc58c('0x1d')](function(_0xa6b37a){if(_0xa6b37a!==null){var _0x3fc914=[];for(var _0x294b48=0x0;_0x294b48<_0xa6b37a[_0xc58c('0x1e')];_0x294b48++){var _0x171110=_0xa6b37a[_0x294b48];if(!_[_0xc58c('0x1f')](_0x171110[_0xc58c('0x13')])){if(!_['isNil'](_0x171110[_0xc58c('0x20')]))_0x3fc914[_0xc58c('0x21')](insertAdditionalPhones(_0x171110));promisesContact[_0xc58c('0x21')]({'contact':_0x171110});}}}Promise[_0xc58c('0x22')](_0x3fc914)['then'](function(){_0x233b9c({'val':0x1});});})[_0xc58c('0x23')](function(_0x36325b){logger[_0xc58c('0x24')](_0x36325b['message']);});});}function insertAdditionalPhones(_0x4ce463){return new Promise(function(_0x545e8e,_0xcf3d26){var _0x234a5b=_0x4ce463[_0xc58c('0x20')];if(_[_0xc58c('0x1f')](_0x234a5b))_0xcf3d26({'val':0x0});else{var _0x58fb07=_0x234a5b['split'](';');var _0x16ba3f=[];orderBy=0x0;for(var _0x284f0e=0x0;_0x284f0e<_0x58fb07['length'];_0x284f0e++){_0x16ba3f[_0xc58c('0x21')](splitAdditionalPhone(_0x4ce463['id'],_0x58fb07[_0x284f0e]));}Promise[_0xc58c('0x22')](_0x16ba3f)[_0xc58c('0x25')](function(){_0x545e8e({'val':_0x58fb07['length']});});}});}function splitAdditionalPhone(_0x4eb13a,_0x4729dd){return new Promise(function(_0x1d2717,_0x2a529e){var _0x1dd1bc=_0x4729dd['split'](':');var _0x293774=_0x1dd1bc[0x0];var _0x407828=_0x1dd1bc[0x1];if(_0x407828!==''){var _0x46e8f7=_0x407828[_0xc58c('0x26')]('|');var _0x36a2e5=[];for(var _0xb1673d=0x0;_0xb1673d<_0x46e8f7[_0xc58c('0x1e')];_0xb1673d++){if(_0x46e8f7[_0xb1673d]!==''){var _0x34bcfb=_['filter'](promisesAdditionalPhones,{'contactId':_0x4eb13a,'phone':_0x46e8f7[_0xb1673d]});if(_0x34bcfb[_0xc58c('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0xc58c('0x21')]({'contactId':_0x4eb13a,'contactTypeId':_0x293774,'phone':_0x46e8f7[_0xb1673d],'orderBy':orderBy});}}}_0x1d2717({'ok':0x1});}else _0x1d2717({'res':0x0});});}function createAdditionalPhone(_0x402e57,_0x585110,_0x3dd9cc,_0x1efc74){var _0xe41cf4='';var _0xf6ba27='';var _0x4fd51d=_0x3dd9cc[_0xc58c('0x26')]('§');_0xe41cf4=_0x4fd51d[0x0];if(_0x4fd51d[_0xc58c('0x1e')]==0x2)_0xf6ba27=_0x4fd51d[0x1];return new Promise(function(_0x4b072a,_0xb62ba5){return db[_0xc58c('0x27')]['findOne']({'where':{'CmContactId':_0x402e57,'item':_0xe41cf4}})[_0xc58c('0x25')](function(_0x424cc8){if(_0x424cc8){return db[_0xc58c('0x27')][_0xc58c('0x28')]({'ItemTypeId':_0x585110,'description':_0xf6ba27,'OrderBy':_0x1efc74},{'where':{'CmContactId':_0x402e57,'item':_0xe41cf4}})[_0xc58c('0x25')](function(_0x3950e6){_0x4b072a({'res':_0xc58c('0x29')});});}else{return db[_0xc58c('0x27')][_0xc58c('0x2a')]({'CmContactId':_0x402e57,'item':_0xe41cf4,'ItemTypeId':_0x585110,'description':_0xf6ba27,'OrderBy':_0x1efc74,'ItemClass':'PHONE'})[_0xc58c('0x25')](function(_0x437bbc){_0x4b072a({'res':_0xc58c('0x2b')});});}});});}function updateContact(_0x4a6af4){return new Promise(function(_0x33015d,_0x19b752){var _0x2a6dab=_0x4a6af4['id'];delete _0x4a6af4['id'];return db[_0xc58c('0x2c')]['update'](_0x4a6af4,{'where':{'id':_0x2a6dab}})[_0xc58c('0x25')](function(_0x388f55){updatedRows+=0x1;return db[_0xc58c('0x2d')][_0xc58c('0x28')]({'phone':_0x4a6af4[_0xc58c('0x13')]},{'where':{'ContactId':_0x2a6dab}})[_0xc58c('0x25')](function(_0x56d7c4){_0x33015d({'ret':'OK'});});});});}function insertCmHopper(_0x2d7f00,_0x46f898,_0x19c397,_0x2a82b9,_0x28b009){var _0x4855a4=[_0xc58c('0x2e'),_0xc58c('0x2f'),_0xc58c('0x30'),_0xc58c('0x31'),_0x46f898+'.'+_0x2a82b9,_0xc58c('0x32'),_0xc58c('0x33'),_0xc58c('0x34'),_0xc58c('0x35'),'\x22'+_0x28b009+'\x22'];return squel[_0xc58c('0x36')]()[_0xc58c('0x37')](_0xc58c('0x38'))[_0xc58c('0x39')]([_0xc58c('0x13'),_0xc58c('0x3a'),_0xc58c('0x3b'),_0xc58c('0x3c'),_0x2a82b9,_0xc58c('0x3d'),_0xc58c('0x3e'),_0xc58c('0x3f'),_0xc58c('0x40'),_0xc58c('0x41')],squel['select']()['fields'](_0x4855a4)['from'](_0x46f898)[_0xc58c('0x15')](_0xc58c('0x42'),null,'cm_contacts.ListId\x20=\x20'+_0x46f898+_0xc58c('0x43'))[_0xc58c('0x15')](_0x19c397,null,_0x19c397+'.id\x20=\x20'+_0x46f898+'.'+_0x2a82b9)[_0xc58c('0x17')](_0x46f898+_0xc58c('0x44'),_0x2d7f00)[_0xc58c('0x17')](_0xc58c('0x45'),NOW)[_0xc58c('0x17')](_0xc58c('0x46'),selectNotIn(_0x46f898,_0x19c397,_0x2a82b9,_0xc58c('0x38'),[_0xc58c('0x47'),_0xc58c('0x48')]))[_0xc58c('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x46f898,_0x19c397,_0x2a82b9,_0xc58c('0x38'),['\x22always\x22'])))[_0xc58c('0x49')]();}function insertCmHopperBlack(_0x1ba69c,_0x408b60,_0x51dc8f,_0x14f66b){var _0x5581f3=[_0xc58c('0x2e'),_0xc58c('0x30'),_0xc58c('0x31'),_0x408b60+'.'+_0x14f66b,_0xc58c('0x32'),'cm_contacts.updatedAt'];return squel['insert']()[_0xc58c('0x37')]('cm_hopper_black')[_0xc58c('0x39')](['phone',_0xc58c('0x3b'),_0xc58c('0x3c'),_0x14f66b,_0xc58c('0x3d'),_0xc58c('0x3e')],squel[_0xc58c('0x11')]()[_0xc58c('0x4a')](_0x5581f3)[_0xc58c('0x14')](_0x408b60)[_0xc58c('0x15')](_0xc58c('0x42'),null,_0xc58c('0x4b')+_0x408b60+_0xc58c('0x43'))[_0xc58c('0x15')](_0x51dc8f,null,_0x51dc8f+_0xc58c('0x16')+_0x408b60+'.'+_0x14f66b)[_0xc58c('0x17')](_0x408b60+'.CmListId\x20=\x20?',_0x1ba69c)['where'](_0xc58c('0x45'),NOW)[_0xc58c('0x17')](_0xc58c('0x46'),squel[_0xc58c('0x11')]()[_0xc58c('0x12')](_0xc58c('0x13'))[_0xc58c('0x14')](_0xc58c('0x4c'))[_0xc58c('0x17')](_0xc58c('0x4d'),_0x1ba69c)[_0xc58c('0x17')](_0x14f66b+_0xc58c('0x4e'),_0x408b60+'.'+_0x14f66b)))[_0xc58c('0x49')]();}function insertCmHopperAdditionalPhones(_0xa80fb1){var _0x5ce0cd=[_0xc58c('0x4f'),_0xc58c('0x50'),_0xc58c('0x51'),_0xc58c('0x52'),_0xc58c('0x53')];return squel[_0xc58c('0x36')]()[_0xc58c('0x37')]('cm_hopper_additional_phones')[_0xc58c('0x39')](['CmHopperId',_0xc58c('0x13'),'OrderBy',_0xc58c('0x3d'),_0xc58c('0x3e')],squel[_0xc58c('0x11')]()['fields'](_0x5ce0cd)['from'](_0xc58c('0x38'))[_0xc58c('0x15')](_0xc58c('0x42'),null,_0xc58c('0x54'))[_0xc58c('0x15')](_0xc58c('0x55'),null,_0xc58c('0x56'))[_0xc58c('0x17')](_0xc58c('0x57'),_0xa80fb1)[_0xc58c('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x4a2e2e,_0x1cc4ec,_0x227c7f,_0x5a4fad){var _0x5ccfa0=_[_0xc58c('0x58')](_[_0xc58c('0x59')](_0x5a4fad),['ListId','CompanyId',_0xc58c('0x3d'),_0xc58c('0x3e')]);return squel['insert']()[_0xc58c('0x37')](_0xc58c('0x42'))[_0xc58c('0x39')](_0x5ccfa0,squel[_0xc58c('0x11')]()[_0xc58c('0x4a')](_0x5ccfa0)[_0xc58c('0x14')](_0x1cc4ec)['where']('('+_0x227c7f['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xc58c('0x4a')](_0x227c7f)['from'](_0xc58c('0x42'))[_0xc58c('0x17')]('ListId\x20=\x20?',_0x4a2e2e))[_0xc58c('0x17')]('id\x20IN\x20?',squel[_0xc58c('0x11')]()[_0xc58c('0x12')](_0xc58c('0x5a'),_0xc58c('0x5b'))['from'](_0x1cc4ec)[_0xc58c('0x5c')](_0x227c7f[_0xc58c('0x15')](','))))[_0xc58c('0x49')]();}function handleStop(){logger[_0xc58c('0x5d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x49b06b){logger[_0xc58c('0x24')](_0x49b06b[_0xc58c('0x5e')]);process['exit'](0x1);}function handleError(_0x4374c4,_0xf14526){stats[_0xc58c('0x5f')]['push']({'name':_0xf14526[_0xc58c('0x60')],'message':_0xf14526[_0xc58c('0x5e')],'row':_0x4374c4});}function handleQuery(_0x34556f){logger[_0xc58c('0x5d')](_0x34556f);return db[_0xc58c('0x1a')][_0xc58c('0x1b')](_0x34556f)[_0xc58c('0x1d')](function(_0x130a14){results['push'](_0x130a14);})[_0xc58c('0x23')](function(_0x1ec541){logger[_0xc58c('0x24')](_0x1ec541[_0xc58c('0x5e')]);});}function main(_0xec1b7e,_0x59b080,_0x5ac00c,_0x53b886){logger[_0xc58c('0x5d')]('main',_0xec1b7e,JSON[_0xc58c('0x61')](_0x59b080));process[_0xc58c('0x62')](_0xc58c('0x63'));var _0x224503=_0x59b080[_0xc58c('0x64')];var _0x264d08=_['clone'](_0x224503);var _0x5a54f7=_0x59b080[_0xc58c('0x65')];var _0x8dd844=path[_0xc58c('0x15')](config[_0xc58c('0x66')],_0xc58c('0x67'),_0x5a54f7+_0xc58c('0x68'));logger['info'](_0xc58c('0x69'),_0x59b080);db[_0xc58c('0x6a')][_0xc58c('0x6b')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x5adc76){for(var _0x38919e=0x0;_0x38919e<_0x5adc76[_0xc58c('0x1e')];_0x38919e++){if(_0x5adc76[_0x38919e]['name']in _0x224503){contactItemTypes[_0xc58c('0x21')](_0x5adc76[_0x38919e]);delete _0x264d08[_0x5adc76[_0x38919e]['name']];hasAdditionalPhones=!![];}for(var _0x4acb7a in _0x224503){if(_0x5adc76[_0x38919e][_0xc58c('0x6c')]+_0xc58c('0x6d')===_0x4acb7a){phoneDescriptions[_0xc58c('0x21')]({'itemTypeId':_0x5adc76[_0x38919e]['id'],'description':_0x4acb7a});delete _0x264d08[_0x4acb7a];}}}if(hasAdditionalPhones)_0x264d08[_0xc58c('0x20')]='';var _0x42fc6b=_[_0xc58c('0x59')](_0x264d08)[_0xc58c('0x15')]();logger['info']('header',_0x42fc6b);fs[_0xc58c('0x6e')](_0x8dd844,_0x42fc6b+'\x0a');Papa[_0xc58c('0x6f')](fs[_0xc58c('0x70')](_0xec1b7e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x269b37,_0x2aa25f){try{for(var _0xd8ffd2=0x0,_0x22e994=[];_0xd8ffd2<_0x269b37[_0xc58c('0x71')][_0xc58c('0x1e')];_0xd8ffd2++){stats[_0xc58c('0x72')]+=0x1;if(_0x269b37[_0xc58c('0x5f')][_0xd8ffd2]){handleError(_0x269b37[_0xc58c('0x71')][_0xd8ffd2],_0x269b37[_0xc58c('0x5f')][_0xd8ffd2]);}else{var _0x37d6b8=[];var _0x2ede7b=[];var _0x1d77f8={};for(var _0x122aa2 in _0x224503){let _0xd71015=contactItemTypes[_0xc58c('0x73')](_0x38b45c=>_0x38b45c['name']===_0x122aa2);let _0x2176f6=contactItemTypes[_0xc58c('0x73')](_0x119b00=>_0x119b00[_0xc58c('0x6c')]+_0xc58c('0x6d')===_0x122aa2);if(_['isNil'](_0xd71015)&&_['isNil'](_0x2176f6)){if(_0x224503[_0xc58c('0x74')](_0x122aa2)){if(_0x269b37[_0xc58c('0x71')][_0xd8ffd2][_0x224503[_0x122aa2]]){var _0x1c9304=_['trim'](_0x269b37['data'][_0xd8ffd2][_0x224503[_0x122aa2]][_0xc58c('0x75')](/"/g,'\x27'));switch(_0x122aa2){case _0xc58c('0x3a'):var _0x32bcb6=moment(_0x1c9304,_0xc58c('0xf'),!![]);if(_0x32bcb6[_0xc58c('0x76')]()){_0x22e994[_0xc58c('0x21')]('\x22'+_0x1c9304+'\x22');}else{_0x37d6b8[_0xc58c('0x21')](_0xc58c('0x77'));}break;case _0xc58c('0x3f'):var _0x39de7d=parseInt(_0x1c9304);_0x1c9304=_[_0xc58c('0x78')](_0x39de7d)||_0x39de7d<0x0||_0x39de7d>0x4?_0x53b886?0x3:0x2:_0x39de7d;_0x22e994['push']('\x22'+_0x1c9304+'\x22');break;case _0xc58c('0x40'):var _0x1bb242=parseInt(_0x1c9304);if(_[_0xc58c('0x79')](_0x1bb242)&&_[_0xc58c('0x7a')](_0x5ac00c,_0x1bb242)){_0x22e994[_0xc58c('0x21')]('\x22'+_0x1bb242+'\x22');}else{_0x37d6b8[_0xc58c('0x21')](_0xc58c('0x7b'));}break;case _0xc58c('0x7c'):if(isEmail(_0x1c9304)){_0x22e994['push']('\x22'+_0x1c9304+'\x22');}else{_0x37d6b8[_0xc58c('0x21')]('email\x20wrong\x20format');}break;case _0xc58c('0x7d'):var _0x34eb5c=moment(_0x1c9304,_0xc58c('0x7e'),!![]);if(_0x34eb5c[_0xc58c('0x76')]()){_0x22e994[_0xc58c('0x21')]('\x22'+_0x1c9304+'\x22');}else{_0x37d6b8['push'](_0xc58c('0x7f'));}break;default:_0x22e994['push']('\x22'+_0x1c9304+'\x22');}}else{switch(_0x122aa2){case _0xc58c('0x80'):case _0xc58c('0x13'):_0x37d6b8[_0xc58c('0x21')](_0x122aa2+_0xc58c('0x81'));break;default:_0x22e994[_0xc58c('0x21')]('\x22\x22');}}}}else{var _0x5ba85e='';if(!_[_0xc58c('0x1f')](_0xd71015)){if(!_0x1d77f8[_0xc58c('0x74')](_0xd71015['id'])){for(var _0x4deb54=0x0;_0x4deb54<_0x224503[_0x122aa2][_0xc58c('0x1e')];_0x4deb54++){var _0x1c9304=_[_0xc58c('0x82')](_0x269b37[_0xc58c('0x71')][_0xd8ffd2][_0x224503[_0x122aa2][_0x4deb54]][_0xc58c('0x75')](/"/g,'\x27'));var _0x46f0ac=phoneDescriptions[_0xc58c('0x73')](_0x5c2bb0=>_0x5c2bb0[_0xc58c('0x83')]===_0xd71015['id']);if(!_[_0xc58c('0x1f')](_0x46f0ac)){var _0x3bdd68=_[_0xc58c('0x82')](_0x269b37[_0xc58c('0x71')][_0xd8ffd2][_0x224503[_0x46f0ac[_0xc58c('0x84')]][0x0]][_0xc58c('0x75')](/"/g,'\x27'));if(!_['isNil'](_0x3bdd68))_0x1c9304=_0x1c9304+'§'+_0x3bdd68;}if(_0x5ba85e=='')_0x5ba85e=_0x1c9304;else _0x5ba85e+='|'+_0x1c9304;}_0x2ede7b['push'](_0xd71015['id']+':'+_0x5ba85e);_0x1d77f8[_0xd71015['id']]=0x1;}}}}if(hasAdditionalPhones){_0x22e994['push']('\x22'+_0x2ede7b[_0xc58c('0x15')](';')+'\x22');}if(_0x37d6b8['length']){handleError(_0x269b37['data'][_0xd8ffd2],{'code':_0xc58c('0x85'),'message':_0x37d6b8[_0xc58c('0x15')]()});}else{fs['appendFileSync'](_0x8dd844,_0x22e994['join']()+'\x0a');}_0x22e994=[];}if(!(stats[_0xc58c('0x72')]%0xc8)){socket['emit'](_0xc58c('0x86')+_0x5a54f7,stats);stats[_0xc58c('0x5f')]=[];}}if(stopped){logger[_0xc58c('0x5d')](_0xc58c('0x87'));_0x2aa25f[_0xc58c('0x88')]();}}catch(_0x3e5a55){handleError(_0x269b37[_0xc58c('0x71')][_0xd8ffd2],{'code':'SystemError','message':_0x3e5a55[_0xc58c('0x5e')]});logger[_0xc58c('0x24')](_0xc58c('0x89'),_0x3e5a55[_0xc58c('0x5e')]);}},'complete':function(){try{var _0x81cc3b=[];var _0x11785c=tempTableName;_0x81cc3b[_0xc58c('0x21')](_0xc58c('0x8a')+_0x11785c+_0xc58c('0x8b'));logger[_0xc58c('0x5d')](_0xc58c('0x8c'),contactItemTypes[_0xc58c('0x1e')]);var _0x541541=util[_0xc58c('0xe')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x8dd844,_0x11785c,_0x42fc6b,_0x59b080[_0xc58c('0x3c')],_0x59b080[_0xc58c('0x8d')]||null,NOW,NOW);if(_[_0xc58c('0x1f')](_0x224503['scheduledat'])){_0x541541+=',\x20scheduledAt\x20=\x20NOW()';}_0x81cc3b[_0xc58c('0x21')](_0x541541);BPromise[_0xc58c('0x8e')](_0x81cc3b,handleQuery)[_0xc58c('0x25')](function(_0x4c9338){BPromise['all']([handleAdditionalPhones()])[_0xc58c('0x25')](function(){_0x81cc3b=[];for(var _0x32eb3a=0x0;_0x32eb3a\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.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','i.UserId','openchannel','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','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','TagIds','limit','offset','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','t.id\x20IN\x20?','exports','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','select','field','name','tools_tags','user_has_','_interactions','u.id','u.fullname','from','users','u.id\x20=\x20ui.UserId','length','where','ui.','map','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','forEach','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','whatsapp'];(function(_0x25d1a6,_0x598512){var _0x329d61=function(_0x11da41){while(--_0x11da41){_0x25d1a6['push'](_0x25d1a6['shift']());}};_0x329d61(++_0x598512);}(_0x00df,0x121));var _0xf00d=function(_0x519124,_0x2b734b){_0x519124=_0x519124-0x0;var _0x5db75e=_0x00df[_0x519124];return _0x5db75e;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0xf00d('0x0'));var qs=require(_0xf00d('0x1'));var updateInteraction=require(_0xf00d('0x2'))[_0xf00d('0x3')];var utils=require(_0xf00d('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0xc10419,_0x58b1a8,_0x3c9d2f){var _0x1e4b70=![];var _0x555259=utils[_0xf00d('0x5')](_0xc10419);if(_0x58b1a8[_0xf00d('0x6')]===_0xf00d('0x7')&&!_0x3c9d2f['search']&&!_0x3c9d2f[_0x555259]){_0x1e4b70=!![];}return _0x1e4b70;}function getTagsQuery(){return squel[_0xf00d('0x8')]()[_0xf00d('0x9')]('id')[_0xf00d('0x9')](_0xf00d('0xa'))['field']('color')['from'](_0xf00d('0xb'));}function getUsersQuery(_0x5282ef,_0x4d8d99){var _0x358443=utils['getInteractionFK'](_0x5282ef);var _0x208889=_0xf00d('0xc')+_0x5282ef+_0xf00d('0xd');var _0x3e446a=squel['select']()['field'](_0xf00d('0xe'))[_0xf00d('0x9')](_0xf00d('0xf'))[_0xf00d('0x9')]('ui.'+_0x358443)[_0xf00d('0x10')](_0x208889,'ui')['left_join'](_0xf00d('0x11'),'u',_0xf00d('0x12'));if(_0x4d8d99[_0xf00d('0x13')]>0x0){_0x3e446a[_0xf00d('0x14')](_0xf00d('0x15')+_0x358443+'\x20IN\x20?',_[_0xf00d('0x16')](_0x4d8d99,'id'));}return _0x3e446a;}function getInteractionsQuery(_0x223222){var _0x4692f4=utils['getInteractionsTables'](_0x223222);var _0x14a304=utils['getAccountFK'](_0x223222);var _0x273054=utils['getInteractionFK'](_0x223222);return squel['select']()[_0xf00d('0x10')](_0x4692f4[_0xf00d('0x17')],'i')[_0xf00d('0x18')](_0xf00d('0x19'),'c',_0xf00d('0x1a'))[_0xf00d('0x18')]('users','o','o.id\x20=\x20i.UserId')[_0xf00d('0x18')](_0x4692f4[_0xf00d('0x1b')],'a',_0xf00d('0x1c')+_0x14a304)[_0xf00d('0x18')](_0x4692f4[_0xf00d('0x1d')],'me','me.'+_0x273054+_0xf00d('0x1e'))['left_join'](_0x4692f4[_0xf00d('0x1f')],'it',_0xf00d('0x20')+_0x273054+_0xf00d('0x1e'))[_0xf00d('0x18')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x5e798e={'body':squel[_0xf00d('0x21')](),'contact':squel[_0xf00d('0x21')](),'default':squel[_0xf00d('0x21')](),'fields':squel[_0xf00d('0x21')](),'filter':squel[_0xf00d('0x21')](),'read':squel[_0xf00d('0x21')](),'tags':{'clause':squel[_0xf00d('0x21')](),'ids':null},'user':squel[_0xf00d('0x21')]()};return _0x5e798e;}function parseTagParameter(_0x1adb47){var _0x19c245=squel[_0xf00d('0x21')]();if(_0x1adb47){var _0x36e178=utils[_0xf00d('0x22')](_0x1adb47);_0x36e178[_0xf00d('0x23')](function(_0x234034){_0x19c245['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x234034+',%');});}return _0x19c245;}function parseReadParameter(_0x30240e){var _0x310080='';if(_0x30240e){_0x310080='unreadMessages\x20{OPERATOR}\x200';if(_0x30240e==='1'){_0x310080=_0x310080[_0xf00d('0x24')](_0xf00d('0x25'),'=');}else{_0x310080=_0x310080['replace'](_0xf00d('0x25'),'>');}}return _0x310080;}function parseSearchFilter(_0x5bb72e,_0x262155){var _0x102f38=squel['expr']();if(_0x262155){var _0x28a4bf=_0x262155[_0xf00d('0x24')]('\x5c','\x5c\x5c')[_0xf00d('0x24')](/'/g,'\x27\x27');if(qs[_0xf00d('0x26')](_0x28a4bf)){_0x102f38['or'](_0xf00d('0x27'),_0x28a4bf+'%');if(['sms',_0xf00d('0x28')][_0xf00d('0x29')](_0x5bb72e)){_0x102f38['or']('i.phone\x20LIKE\x20?',_0x28a4bf+'%');}else if(_0x5bb72e===_0xf00d('0x2a')){_0x102f38['or'](_0xf00d('0x2b'),_0x28a4bf+'%');}else if(_0x5bb72e==='openchannel'){_0x102f38['or'](_0xf00d('0x2c'),_0x28a4bf+'%');}}else if(_0x5bb72e===_0xf00d('0x2d')&&qs[_0xf00d('0x2e')](_0x28a4bf)){_0x102f38['or'](_0xf00d('0x2f'),_0x28a4bf+'%');}else{if(_0x5bb72e===_0xf00d('0x2d')){_0x102f38['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf00d('0x30')](_0x28a4bf,!![]))['or'](_0xf00d('0x31'),qs[_0xf00d('0x30')](_0x28a4bf));}else if(_0x5bb72e!==_0xf00d('0x2a')){_0x102f38['or'](_0xf00d('0x32'),qs['getFullTextValue'](_0x28a4bf));}_0x102f38['or'](_0xf00d('0x33'),qs[_0xf00d('0x30')](_0x28a4bf,!![]),null);}}return _0x102f38;}function parseAdvancedSearchFilter(_0x445473,_0x575e0f){var _0x3ad9a4=getSqlClauses();var _0x7ddfe2=as[_0xf00d('0x34')](_0x445473);var _0xee95cf=_0x7ddfe2['sqlOperator'];for(var _0x1c33d6=0x0;_0x1c33d6<_0x7ddfe2[_0xf00d('0x35')][_0xf00d('0x13')];_0x1c33d6++){var _0x586b7c=_0x7ddfe2[_0xf00d('0x35')][_0x1c33d6];var _0x1519cc='i';var _0x1e63ed=_['find'](_0x575e0f,['name',_0x586b7c[_0xf00d('0x9')]]);if(_0x1e63ed){var _0x65f4d7=as['buildExpression'](_0x1519cc,_0x1e63ed['type'],_0x586b7c);_0x3ad9a4['default'][_0xee95cf](_0x65f4d7[_0xf00d('0x36')],_0x65f4d7[_0xf00d('0x37')][_0xf00d('0x38')],_0x65f4d7[_0xf00d('0x37')]['end']);}else{switch(_0x586b7c[_0xf00d('0x9')]){case _0xf00d('0x39'):var _0x5a4595=parseReadParameter(_0x586b7c[_0xf00d('0x37')]);_0x3ad9a4[_0xf00d('0x3a')][_0xf00d('0x3b')](_0x5a4595);break;case'Contact':if(_0x586b7c[_0xf00d('0x3c')]===_0xf00d('0x3d')){if(_0x586b7c[_0xf00d('0x37')][_0xf00d('0x3e')]('\x20')[_0xf00d('0x13')]>0x1){_0x3ad9a4[_0xf00d('0x3f')][_0xee95cf](_0xf00d('0x33'),qs['getFullTextValue'](_0x586b7c[_0xf00d('0x37')],!![]),null);}else{var _0x11cc2a='%'+_0x586b7c[_0xf00d('0x37')]+'%';_0x3ad9a4['contact'][_0xee95cf](_0xf00d('0x40'),_0x11cc2a,_0x11cc2a,_0x11cc2a);}}else{_0x1e63ed=_[_0xf00d('0x41')](_0x575e0f,[_0xf00d('0xa'),_0xf00d('0x42')]);_0x586b7c['field']=_0xf00d('0x42');_0x65f4d7=as['buildExpression'](_0x1519cc,_0x1e63ed['type'],_0x586b7c);_0x3ad9a4[_0xf00d('0x3f')][_0xee95cf](_0x65f4d7[_0xf00d('0x36')],_0x65f4d7[_0xf00d('0x37')][_0xf00d('0x38')],_0x65f4d7['value'][_0xf00d('0x43')]);}break;case _0xf00d('0x44'):var _0x3c81be=_0x586b7c[_0xf00d('0x37')][_0xf00d('0x3e')](',')[_0xf00d('0x16')](function(_0x122cc6){return Number(_0x122cc6);});var _0x2286ed=parseTagParameter(_0x3c81be);_0x3ad9a4[_0xf00d('0x45')][_0xf00d('0x46')]['and'](_0x2286ed);_0x3ad9a4['tags'][_0xf00d('0x47')]=_0x3c81be;break;case _0xf00d('0x48'):if(_0x586b7c['operator']===_0xf00d('0x3d')){_0x3ad9a4[_0xf00d('0x49')][_0xee95cf](_0xf00d('0x4a'),'%'+_0x586b7c[_0xf00d('0x37')]+'%',null);}else{_0x1e63ed=_[_0xf00d('0x41')](_0x575e0f,['name',_0xf00d('0x4b')]);_0x586b7c['field']=_0xf00d('0x4b');_0x65f4d7=as[_0xf00d('0x4c')](_0x1519cc,_0x1e63ed[_0xf00d('0x4d')],_0x586b7c);_0x3ad9a4[_0xf00d('0x49')][_0xee95cf](_0x65f4d7[_0xf00d('0x36')],_0x65f4d7['value'][_0xf00d('0x38')],_0x65f4d7[_0xf00d('0x37')][_0xf00d('0x43')]);}break;case _0xf00d('0x4e'):case _0xf00d('0x4f'):_0x65f4d7=as[_0xf00d('0x4c')]('me',null,_0x586b7c);_0x3ad9a4[_0xf00d('0x4e')][_0xee95cf](_0x65f4d7[_0xf00d('0x36')],_0x65f4d7[_0xf00d('0x37')]['start'],_0x65f4d7['value'][_0xf00d('0x43')]);break;}}}return _0x3ad9a4;}function parseModelFields(_0x4bf95b,_0x4364a3,_0x37eac4){var _0x72a97a=utils[_0xf00d('0x5')](_0x4bf95b);var _0xece417=squel[_0xf00d('0x21')]();var _0x300997=_(_0x4364a3)[_0xf00d('0x50')]()['map'](function(_0x3885a9){return _[_0xf00d('0x51')](_0x37eac4,[_0xf00d('0xa'),_0x3885a9])?_0x3885a9:undefined;})[_0xf00d('0x52')]()[_0xf00d('0x37')]();if(_0x300997[_0xf00d('0x13')]>0x0){_0x300997['forEach'](function(_0x10f2b7){if(_0x10f2b7===_0x72a97a){_0xece417[_0xf00d('0x3b')]('i.'+_0x72a97a+_0xf00d('0x53'),[][_0xf00d('0x54')](_0x4364a3[_0x10f2b7]));}else if(_0x10f2b7===_0xf00d('0x55')){var _0x286c4f=JSON[_0xf00d('0x56')](_0x4364a3[_0x10f2b7])['$gte'];var _0x3e6a0c=JSON[_0xf00d('0x56')](_0x4364a3[_0x10f2b7])[_0xf00d('0x57')];_0xece417[_0xf00d('0x3b')](_0xf00d('0x58'),_0x286c4f,_0x3e6a0c);}else{if(_0x4364a3[_0x10f2b7]==='null'){_0xece417[_0xf00d('0x3b')]('i.'+_0x10f2b7+_0xf00d('0x59'));}else{_0xece417['and']('i.'+_0x10f2b7+_0xf00d('0x5a'),_0x4364a3[_0x10f2b7]);}}});}return _0xece417;}function parseQueryParameters(_0x3842f7,_0x421ab0,_0x3db4af){var _0x4aa40e=getSqlClauses();return Promise['resolve']()[_0xf00d('0x5b')](function(){return parseModelFields(_0x3842f7,_0x421ab0,_0x3db4af);})[_0xf00d('0x5b')](function(_0x3fa381){_0x4aa40e['fields'][_0xf00d('0x3b')](_0x3fa381);return parseReadParameter(_0x421ab0[_0xf00d('0x3a')]);})[_0xf00d('0x5b')](function(_0x3e976e){_0x4aa40e['read']['and'](_0x3e976e);return parseTagParameter(_0x421ab0[_0xf00d('0x5c')]);})['then'](function(_0x3c7f62){_0x4aa40e[_0xf00d('0x45')][_0xf00d('0x46')][_0xf00d('0x3b')](_0x3c7f62);return parseSearchFilter(_0x3842f7,_0x421ab0['filter']);})[_0xf00d('0x5b')](function(_0x526848){_0x4aa40e[_0xf00d('0x5d')]=_0x526848;return _0x4aa40e;});}function checkAccountsRestrictions(_0x12418f,_0x44669c,_0x2830ed){var _0xdaadc=utils['getAccountFK'](_0x12418f);var _0xb177f4=_0xf00d('0x5e')+_[_0xf00d('0x5f')](_0x12418f)+(_0x12418f===_0xf00d('0x60')?_0xf00d('0x61'):_0xf00d('0x62'));var _0x5e911f=squel[_0xf00d('0x21')]();return Promise[_0xf00d('0x63')]()['then'](function(){if(_0x2830ed[_0xf00d('0x64')]&&_0x44669c[_0xf00d('0x6')]===_0xf00d('0x7')){return _0x44669c[_0xb177f4]({'attributes':['id'],'raw':!![]});}})[_0xf00d('0x5b')](function(_0x548611){if(_0x548611){if(_0x548611['length']===0x0){_0x5e911f[_0xf00d('0x3b')]('i.'+_0xdaadc+_0xf00d('0x59'));}else{_0x5e911f[_0xf00d('0x3b')]('i.'+_0xdaadc+_0xf00d('0x53'),_[_0xf00d('0x16')](_0x548611,'id'));}}else if(!_0x2830ed[_0xdaadc]){_0x5e911f[_0xf00d('0x3b')]('i.'+_0xdaadc+_0xf00d('0x65'));}})[_0xf00d('0x5b')](function(){return _0x5e911f;});}function getClosedOrderClause(_0x1c4df3,_0x124c2c){var _0x43dc79='';var _0x1d2da2=['i.thirdDisposition',_0xf00d('0x66'),_0xf00d('0x67')];if(_0x1c4df3===_0xf00d('0x2d')){_0x1d2da2[_0xf00d('0x68')](_0xf00d('0x69'));}if(_0x124c2c[_0xf00d('0x6a')]==='0'&&_0x1c4df3==='mail'){_0x43dc79='i.substatus';}else{if(_0x124c2c['closed']==='1'){_0x1d2da2[_0xf00d('0x6b')]();}_0x43dc79=_0xf00d('0x6c')+_0x1d2da2['join'](',\x20')+')';}return _0x43dc79;}function getFilteredInteractions(_0x26bb14,_0x233d46,_0x283b35,_0x540826){var _0x27d683=utils['getInteractionFK'](_0x26bb14);var _0x9129ee=_[_0xf00d('0x5f')](_0x26bb14)+'Interaction';var _0x57ad9f=[];var _0x5815ec=getTagsQuery();var _0x4a0538={'type':db[_0xf00d('0x6d')][_0xf00d('0x6e')][_0xf00d('0x6f')],'raw':!![]};var _0x569207=[];var _0x1c25b7=[];return db[_0xf00d('0x70')][_0xf00d('0x71')](_0x5815ec[_0xf00d('0x72')](),_0x4a0538)['then'](function(_0x5df8c1){_0x57ad9f=_[_0xf00d('0x73')](_0x5df8c1,'id');_0x4a0538=_['merge'](_0x4a0538,{'model':db[_0x9129ee],'mapToModel':!![],'nest':!![]});if(_0x283b35[_0xf00d('0x74')]){_0x540826[_0xf00d('0x75')]['forEach'](function(_0x35c378){_0x233d46[_0xf00d('0x9')]('i.'+_0x35c378);});}else{_0x233d46[_0xf00d('0x9')](_0xf00d('0x76'),_0xf00d('0x39'));_0x233d46[_0xf00d('0x9')]('a.key',_0xf00d('0x77'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x78'),_0xf00d('0x79'));if(_0x26bb14===_0xf00d('0x2d')){_0x233d46[_0xf00d('0x9')](_0xf00d('0x7a'),_0xf00d('0x7b'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x7c'),_0xf00d('0x7d'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x7e'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x7f'));_0x233d46['field'](_0xf00d('0x80'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x81'));_0x233d46['field'](_0xf00d('0x82'));_0x233d46[_0xf00d('0x9')]('i.attach');_0x233d46[_0xf00d('0x9')](_0xf00d('0x83'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x84'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x85'));_0x233d46['field'](_0xf00d('0x67'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x66'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x86'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x69'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x87'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x88'));_0x233d46[_0xf00d('0x9')]('i.MailAccountId');_0x233d46[_0xf00d('0x9')](_0xf00d('0x89'));}else if(_0x26bb14===_0xf00d('0x8a')){_0x233d46['field'](_0xf00d('0x8b'),'contactName');}else{_0x233d46[_0xf00d('0x9')](_0xf00d('0x8c'),_0xf00d('0x7d'));}if(_0x26bb14!==_0xf00d('0x2d')){_0x233d46['field']('i.*');}_0x233d46[_0xf00d('0x9')](_0xf00d('0x8d'),'Contact.firstName');_0x233d46[_0xf00d('0x9')](_0xf00d('0x8e'),_0xf00d('0x8f'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x90'),_0xf00d('0x91'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x92'),_0xf00d('0x93'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x94'),_0xf00d('0x95'));_0x233d46[_0xf00d('0x9')](_0xf00d('0x96'),_0xf00d('0x97'));_0x233d46[_0xf00d('0x9')]('o.fullname',_0xf00d('0x98'));_0x233d46['field']('o.internal',_0xf00d('0x99'));_0x233d46[_0xf00d('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf00d('0x9a'));}if(_0x540826['limit']){_0x233d46[_0xf00d('0x9b')](_0x540826['limit']);}if(_0x540826['offset']){_0x233d46[_0xf00d('0x9c')](_0x540826[_0xf00d('0x9c')]);}return db[_0xf00d('0x70')][_0xf00d('0x71')](_0x233d46['toString'](),_0x4a0538);})[_0xf00d('0x5b')](function(_0x469861){_0x569207=_0x469861;var _0x2b90a8=getUsersQuery(_0x26bb14,_0x569207);return db[_0xf00d('0x70')][_0xf00d('0x71')](_0x2b90a8['toString'](),_0x4a0538);})['then'](function(_0x2f3542){_0x1c25b7=_['groupBy'](_0x2f3542,_0x27d683);if(_0x26bb14==='mail'){return db[_0xf00d('0x9d')][_0xf00d('0x9e')]({'attributes':[_0xf00d('0x9f')],'raw':!![]});}})[_0xf00d('0x5b')](function(_0x2f5a02){var _0x561244=_0x2f5a02?_0x2f5a02[_0xf00d('0x9f')]:undefined;var _0x2da2d5=_0x569207[_0xf00d('0x16')](function(_0x569586){return updateInteraction(_0x569586,_0x57ad9f,_0x1c25b7,_0x561244);});return Promise[_0xf00d('0xa0')](_0x2da2d5);});}function countFilteredInteractions(_0x5c1aeb,_0x3e4710){var _0x3e0c1b=_0x5c1aeb[_0xf00d('0xa1')]();_0x3e0c1b['field'](_0xf00d('0xa2'));_0x3e0c1b['field'](_0xf00d('0x76'),'unreadMessages');var _0x5da142=utils[_0xf00d('0x22')](_0x3e4710);if(!_['isEmpty'](_0x5da142)){_0x3e0c1b['where'](_0xf00d('0xa3'),_0x5da142);}var _0x1f422c={'type':db[_0xf00d('0x6d')]['QueryTypes'][_0xf00d('0x6f')],'raw':!![]};return db['sequelize'][_0xf00d('0x71')](_0x3e0c1b['toString'](),_0x1f422c);}module[_0xf00d('0xa4')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xa5dd=['value','start','end','unreadMessages','read','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','clause','and','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','body','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','sequelize','query','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','from','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','ui.','left_join','users','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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'];(function(_0x4fcab3,_0x2f36a2){var _0x5496f4=function(_0x27d08e){while(--_0x27d08e){_0x4fcab3['push'](_0x4fcab3['shift']());}};_0x5496f4(++_0x2f36a2);}(_0xa5dd,0x6a));var _0xda5d=function(_0x5244f2,_0x597f85){_0x5244f2=_0x5244f2-0x0;var _0x1ffda4=_0xa5dd[_0x5244f2];return _0x1ffda4;};'use strict';var _=require(_0xda5d('0x0'));var squel=require(_0xda5d('0x1'));var as=require(_0xda5d('0x2'));var qs=require(_0xda5d('0x3'));var updateInteraction=require(_0xda5d('0x4'))[_0xda5d('0x5')];var utils=require(_0xda5d('0x6'));var db=require(_0xda5d('0x7'))['db'];function skipInteractionsQuery(_0x119aa4,_0x10357d,_0x2a69d2){var _0x1ec3ee=![];var _0x49b629=utils[_0xda5d('0x8')](_0x119aa4);if(_0x10357d[_0xda5d('0x9')]===_0xda5d('0xa')&&!_0x2a69d2[_0xda5d('0xb')]&&!_0x2a69d2[_0x49b629]){_0x1ec3ee=!![];}return _0x1ec3ee;}function getTagsQuery(){return squel[_0xda5d('0xc')]()['field']('id')[_0xda5d('0xd')](_0xda5d('0xe'))[_0xda5d('0xd')]('color')[_0xda5d('0xf')](_0xda5d('0x10'));}function getUsersQuery(_0x22a04a,_0xc3e077){var _0xfe4fef=utils[_0xda5d('0x11')](_0x22a04a);var _0x238447=_0xda5d('0x12')+_0x22a04a+_0xda5d('0x13');var _0x4dcb3a=squel[_0xda5d('0xc')]()[_0xda5d('0xd')]('u.id')[_0xda5d('0xd')](_0xda5d('0x14'))[_0xda5d('0xd')](_0xda5d('0x15')+_0xfe4fef)['from'](_0x238447,'ui')[_0xda5d('0x16')](_0xda5d('0x17'),'u','u.id\x20=\x20ui.UserId');if(_0xc3e077['length']>0x0){_0x4dcb3a[_0xda5d('0x18')](_0xda5d('0x15')+_0xfe4fef+_0xda5d('0x19'),_[_0xda5d('0x1a')](_0xc3e077,'id'));}return _0x4dcb3a;}function getInteractionsQuery(_0x3bce98){var _0x24b359=utils[_0xda5d('0x1b')](_0x3bce98);var _0x1d70d4=utils['getAccountFK'](_0x3bce98);var _0xffba7b=utils[_0xda5d('0x11')](_0x3bce98);return squel[_0xda5d('0xc')]()[_0xda5d('0xf')](_0x24b359[_0xda5d('0x1c')],'i')[_0xda5d('0x16')](_0xda5d('0x1d'),'c',_0xda5d('0x1e'))[_0xda5d('0x16')]('users','o',_0xda5d('0x1f'))[_0xda5d('0x16')](_0x24b359['accounts'],'a',_0xda5d('0x20')+_0x1d70d4)[_0xda5d('0x16')](_0x24b359['messages'],'me',_0xda5d('0x21')+_0xffba7b+_0xda5d('0x22'))[_0xda5d('0x16')](_0x24b359[_0xda5d('0x23')],'it',_0xda5d('0x24')+_0xffba7b+_0xda5d('0x22'))[_0xda5d('0x16')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x1ce8b7={'body':squel[_0xda5d('0x25')](),'contact':squel[_0xda5d('0x25')](),'default':squel['expr'](),'fields':squel[_0xda5d('0x25')](),'filter':squel[_0xda5d('0x25')](),'read':squel[_0xda5d('0x25')](),'tags':{'clause':squel[_0xda5d('0x25')](),'ids':null},'user':squel[_0xda5d('0x25')]()};return _0x1ce8b7;}function parseTagParameter(_0x2f2cdb){var _0x5a97e3=squel[_0xda5d('0x25')]();if(_0x2f2cdb){var _0x5299e7=utils[_0xda5d('0x26')](_0x2f2cdb);_0x5299e7[_0xda5d('0x27')](function(_0x52ac7d){_0x5a97e3['or'](_0xda5d('0x28'),'%,'+_0x52ac7d+',%');});}return _0x5a97e3;}function parseReadParameter(_0x2dcf99){var _0x4591a1='';if(_0x2dcf99){_0x4591a1=_0xda5d('0x29');if(_0x2dcf99==='1'){_0x4591a1=_0x4591a1[_0xda5d('0x2a')]('{OPERATOR}','=');}else{_0x4591a1=_0x4591a1[_0xda5d('0x2a')](_0xda5d('0x2b'),'>');}}return _0x4591a1;}function parseSearchFilter(_0x5313d8,_0x3d2d2d){var _0x2b977d=squel[_0xda5d('0x25')]();if(_0x3d2d2d){var _0x29d11e=_0x3d2d2d[_0xda5d('0x2a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x29d11e)){_0x2b977d['or'](_0xda5d('0x2c'),_0x29d11e+'%');if([_0xda5d('0x2d'),_0xda5d('0x2e')][_0xda5d('0x2f')](_0x5313d8)){_0x2b977d['or']('i.phone\x20LIKE\x20?',_0x29d11e+'%');}else if(_0x5313d8===_0xda5d('0x30')){_0x2b977d['or'](_0xda5d('0x31'),_0x29d11e+'%');}else if(_0x5313d8==='openchannel'){_0x2b977d['or'](_0xda5d('0x32'),_0x29d11e+'%');}}else if(_0x5313d8==='mail'&&qs['isEmail'](_0x29d11e)){_0x2b977d['or'](_0xda5d('0x33'),_0x29d11e+'%');}else{if(_0x5313d8===_0xda5d('0x34')){_0x2b977d['or'](_0xda5d('0x35'),qs[_0xda5d('0x36')](_0x29d11e,!![]))['or'](_0xda5d('0x37'),qs[_0xda5d('0x36')](_0x29d11e));}else if(_0x5313d8!==_0xda5d('0x30')){_0x2b977d['or'](_0xda5d('0x38'),qs['getFullTextValue'](_0x29d11e));}_0x2b977d['or'](_0xda5d('0x39'),qs['getFullTextValue'](_0x29d11e,!![]),null);}}return _0x2b977d;}function parseAdvancedSearchFilter(_0xc81e30,_0x47f0d4){var _0x337d73=getSqlClauses();var _0x92388b=as[_0xda5d('0x3a')](_0xc81e30);var _0x154d41=_0x92388b[_0xda5d('0x3b')];for(var _0x5f2901=0x0;_0x5f2901<_0x92388b[_0xda5d('0x3c')][_0xda5d('0x3d')];_0x5f2901++){var _0x55675c=_0x92388b['conditions'][_0x5f2901];var _0x1d865c='i';var _0x2befd7=_[_0xda5d('0x3e')](_0x47f0d4,['name',_0x55675c[_0xda5d('0xd')]]);if(_0x2befd7){var _0x1d895a=as[_0xda5d('0x3f')](_0x1d865c,_0x2befd7[_0xda5d('0x40')],_0x55675c);_0x337d73[_0xda5d('0x41')][_0x154d41](_0x1d895a[_0xda5d('0x42')],_0x1d895a[_0xda5d('0x43')][_0xda5d('0x44')],_0x1d895a[_0xda5d('0x43')][_0xda5d('0x45')]);}else{switch(_0x55675c[_0xda5d('0xd')]){case _0xda5d('0x46'):var _0x3cbf7f=parseReadParameter(_0x55675c[_0xda5d('0x43')]);_0x337d73[_0xda5d('0x47')]['and'](_0x3cbf7f);break;case _0xda5d('0x48'):if(_0x55675c[_0xda5d('0x49')]===_0xda5d('0x4a')){if(_0x55675c[_0xda5d('0x43')][_0xda5d('0x4b')]('\x20')[_0xda5d('0x3d')]>0x1){_0x337d73[_0xda5d('0x4c')][_0x154d41](_0xda5d('0x39'),qs[_0xda5d('0x36')](_0x55675c['value'],!![]),null);}else{var _0x1e5ee3='%'+_0x55675c['value']+'%';_0x337d73['contact'][_0x154d41](_0xda5d('0x4d'),_0x1e5ee3,_0x1e5ee3,_0x1e5ee3);}}else{_0x2befd7=_[_0xda5d('0x3e')](_0x47f0d4,[_0xda5d('0xe'),_0xda5d('0x4e')]);_0x55675c[_0xda5d('0xd')]='ContactId';_0x1d895a=as[_0xda5d('0x3f')](_0x1d865c,_0x2befd7['type'],_0x55675c);_0x337d73[_0xda5d('0x4c')][_0x154d41](_0x1d895a['text'],_0x1d895a[_0xda5d('0x43')][_0xda5d('0x44')],_0x1d895a[_0xda5d('0x43')][_0xda5d('0x45')]);}break;case _0xda5d('0x4f'):var _0x87af01=_0x55675c[_0xda5d('0x43')][_0xda5d('0x4b')](',')[_0xda5d('0x1a')](function(_0x292c2a){return Number(_0x292c2a);});var _0x34919f=parseTagParameter(_0x87af01);_0x337d73[_0xda5d('0x50')][_0xda5d('0x51')][_0xda5d('0x52')](_0x34919f);_0x337d73[_0xda5d('0x50')]['ids']=_0x87af01;break;case _0xda5d('0x53'):if(_0x55675c[_0xda5d('0x49')]===_0xda5d('0x4a')){_0x337d73[_0xda5d('0x54')][_0x154d41](_0xda5d('0x55'),'%'+_0x55675c['value']+'%',null);}else{_0x2befd7=_[_0xda5d('0x3e')](_0x47f0d4,['name',_0xda5d('0x56')]);_0x55675c['field']='UserId';_0x1d895a=as[_0xda5d('0x3f')](_0x1d865c,_0x2befd7['type'],_0x55675c);_0x337d73[_0xda5d('0x54')][_0x154d41](_0x1d895a[_0xda5d('0x42')],_0x1d895a['value'][_0xda5d('0x44')],_0x1d895a[_0xda5d('0x43')][_0xda5d('0x45')]);}break;case'body':case _0xda5d('0x57'):_0x1d895a=as['buildExpression']('me',null,_0x55675c);_0x337d73[_0xda5d('0x58')][_0x154d41](_0x1d895a[_0xda5d('0x42')],_0x1d895a[_0xda5d('0x43')]['start'],_0x1d895a[_0xda5d('0x43')][_0xda5d('0x45')]);break;}}}return _0x337d73;}function parseModelFields(_0x29dcfd,_0x3ec270,_0x5dd4e1){var _0x3758ea=utils['getAccountFK'](_0x29dcfd);var _0x58fab9=squel[_0xda5d('0x25')]();var _0xc711fe=_(_0x3ec270)[_0xda5d('0x59')]()[_0xda5d('0x1a')](function(_0x379a12){return _['some'](_0x5dd4e1,[_0xda5d('0xe'),_0x379a12])?_0x379a12:undefined;})[_0xda5d('0x5a')]()[_0xda5d('0x43')]();if(_0xc711fe['length']>0x0){_0xc711fe[_0xda5d('0x27')](function(_0xfdbac5){if(_0xfdbac5===_0x3758ea){_0x58fab9[_0xda5d('0x52')]('i.'+_0x3758ea+_0xda5d('0x19'),[][_0xda5d('0x5b')](_0x3ec270[_0xfdbac5]));}else if(_0xfdbac5===_0xda5d('0x5c')){var _0x2f6189=JSON[_0xda5d('0x5d')](_0x3ec270[_0xfdbac5])[_0xda5d('0x5e')];var _0x42bd15=JSON[_0xda5d('0x5d')](_0x3ec270[_0xfdbac5])[_0xda5d('0x5f')];_0x58fab9[_0xda5d('0x52')](_0xda5d('0x60'),_0x2f6189,_0x42bd15);}else{if(_0x3ec270[_0xfdbac5]==='null'){_0x58fab9['and']('i.'+_0xfdbac5+_0xda5d('0x61'));}else{_0x58fab9[_0xda5d('0x52')]('i.'+_0xfdbac5+_0xda5d('0x62'),_0x3ec270[_0xfdbac5]);}}});}return _0x58fab9;}function parseQueryParameters(_0x53f7bb,_0x229e8e,_0x6620a4){var _0x5104b3=getSqlClauses();return Promise[_0xda5d('0x63')]()[_0xda5d('0x64')](function(){return parseModelFields(_0x53f7bb,_0x229e8e,_0x6620a4);})['then'](function(_0x52f1d5){_0x5104b3[_0xda5d('0x65')]['and'](_0x52f1d5);return parseReadParameter(_0x229e8e['read']);})[_0xda5d('0x64')](function(_0x4aa437){_0x5104b3[_0xda5d('0x47')][_0xda5d('0x52')](_0x4aa437);return parseTagParameter(_0x229e8e[_0xda5d('0x66')]);})[_0xda5d('0x64')](function(_0x17c08a){_0x5104b3['tags'][_0xda5d('0x51')][_0xda5d('0x52')](_0x17c08a);return parseSearchFilter(_0x53f7bb,_0x229e8e['filter']);})[_0xda5d('0x64')](function(_0x4253fb){_0x5104b3[_0xda5d('0x67')]=_0x4253fb;return _0x5104b3;});}function checkAccountsRestrictions(_0x477cf6,_0x3fd5b9,_0x58f70e){var _0x277fec=utils[_0xda5d('0x8')](_0x477cf6);var _0x4ea2b6=_0xda5d('0x68')+_[_0xda5d('0x69')](_0x477cf6)+(_0x477cf6===_0xda5d('0x6a')?_0xda5d('0x6b'):'Accounts');var _0x4b5d72=squel[_0xda5d('0x25')]();return Promise['resolve']()[_0xda5d('0x64')](function(){if(_0x58f70e[_0xda5d('0xb')]&&_0x3fd5b9[_0xda5d('0x9')]===_0xda5d('0xa')){return _0x3fd5b9[_0x4ea2b6]({'attributes':['id'],'raw':!![]});}})[_0xda5d('0x64')](function(_0x44c86f){if(_0x44c86f){if(_0x44c86f['length']===0x0){_0x4b5d72['and']('i.'+_0x277fec+_0xda5d('0x61'));}else{_0x4b5d72[_0xda5d('0x52')]('i.'+_0x277fec+_0xda5d('0x19'),_[_0xda5d('0x1a')](_0x44c86f,'id'));}}else if(!_0x58f70e[_0x277fec]){_0x4b5d72[_0xda5d('0x52')]('i.'+_0x277fec+_0xda5d('0x6c'));}})[_0xda5d('0x64')](function(){return _0x4b5d72;});}function getClosedOrderClause(_0x2ddd03,_0x26cc79){var _0x308240='';var _0x11b573=[_0xda5d('0x6d'),_0xda5d('0x6e'),'i.disposition'];if(_0x2ddd03===_0xda5d('0x34')){_0x11b573[_0xda5d('0x6f')](_0xda5d('0x70'));}if(_0x26cc79['closed']==='0'&&_0x2ddd03===_0xda5d('0x34')){_0x308240=_0xda5d('0x70');}else{if(_0x26cc79[_0xda5d('0x71')]==='1'){_0x11b573[_0xda5d('0x72')]();}_0x308240=_0xda5d('0x73')+_0x11b573[_0xda5d('0x74')](',\x20')+')';}return _0x308240;}function getFilteredInteractions(_0x3bb430,_0x374a06,_0x10e00d,_0x3e5f3e){var _0x3efb64=utils['getInteractionFK'](_0x3bb430);var _0x1da164=_['capitalize'](_0x3bb430)+_0xda5d('0x75');var _0x9431e0=[];var _0x26d07b=getTagsQuery();var _0x710600={'type':db[_0xda5d('0x76')][_0xda5d('0x77')]['SELECT'],'raw':!![]};var _0xd68ba6=[];var _0x3fb839=[];return db[_0xda5d('0x78')][_0xda5d('0x79')](_0x26d07b[_0xda5d('0x7a')](),_0x710600)['then'](function(_0x24d701){_0x9431e0=_['keyBy'](_0x24d701,'id');_0x710600=_[_0xda5d('0x7b')](_0x710600,{'model':db[_0x1da164],'mapToModel':!![],'nest':!![]});if(_0x10e00d[_0xda5d('0x65')]){_0x3e5f3e['attributes'][_0xda5d('0x27')](function(_0x5b4368){_0x374a06['field']('i.'+_0x5b4368);});}else{_0x374a06[_0xda5d('0xd')](_0xda5d('0x7c'),_0xda5d('0x46'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x7d'),_0xda5d('0x7e'));_0x374a06[_0xda5d('0xd')]('a.mandatoryDisposition',_0xda5d('0x7f'));if(_0x3bb430==='mail'){_0x374a06[_0xda5d('0xd')](_0xda5d('0x80'),_0xda5d('0x81'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x82'),_0xda5d('0x83'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x84'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x85'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x86'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x87'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x88'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x89'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x8a'));_0x374a06[_0xda5d('0xd')]('i.lastMsgDirection');_0x374a06[_0xda5d('0xd')](_0xda5d('0x8b'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x8c'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x6e'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x6d'));_0x374a06['field'](_0xda5d('0x70'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x8d'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x8e'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x8f'));_0x374a06['field'](_0xda5d('0x90'));}else if(_0x3bb430===_0xda5d('0x91')){_0x374a06[_0xda5d('0xd')](_0xda5d('0x92'),_0xda5d('0x83'));}else{_0x374a06[_0xda5d('0xd')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x3bb430!==_0xda5d('0x34')){_0x374a06['field'](_0xda5d('0x93'));}_0x374a06[_0xda5d('0xd')]('c.firstName',_0xda5d('0x94'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x95'),_0xda5d('0x96'));_0x374a06[_0xda5d('0xd')]('c.email',_0xda5d('0x97'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x98'),_0xda5d('0x99'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x9a'),'Contact.mobile');_0x374a06[_0xda5d('0xd')](_0xda5d('0x9b'),'Contact.fax');_0x374a06[_0xda5d('0xd')](_0xda5d('0x9c'),_0xda5d('0x9d'));_0x374a06[_0xda5d('0xd')](_0xda5d('0x9e'),_0xda5d('0x9f'));_0x374a06[_0xda5d('0xd')](_0xda5d('0xa0'),'TagIds');}if(_0x3e5f3e[_0xda5d('0xa1')]){_0x374a06[_0xda5d('0xa1')](_0x3e5f3e[_0xda5d('0xa1')]);}if(_0x3e5f3e[_0xda5d('0xa2')]){_0x374a06[_0xda5d('0xa2')](_0x3e5f3e['offset']);}return db[_0xda5d('0x78')]['query'](_0x374a06['toString'](),_0x710600);})[_0xda5d('0x64')](function(_0x3eab61){_0xd68ba6=_0x3eab61;var _0x2eda46=getUsersQuery(_0x3bb430,_0xd68ba6);return db[_0xda5d('0x78')]['query'](_0x2eda46['toString'](),_0x710600);})[_0xda5d('0x64')](function(_0xb5e400){_0x3fb839=_[_0xda5d('0xa3')](_0xb5e400,_0x3efb64);if(_0x3bb430==='mail'){return db[_0xda5d('0xa4')][_0xda5d('0xa5')]({'attributes':[_0xda5d('0xa6')],'raw':!![]});}})[_0xda5d('0x64')](function(_0x20d2cd){var _0x4dba4d=_0x20d2cd?_0x20d2cd[_0xda5d('0xa6')]:undefined;var _0x1328b9=_0xd68ba6[_0xda5d('0x1a')](function(_0x241b71){return updateInteraction(_0x241b71,_0x9431e0,_0x3fb839,_0x4dba4d);});return Promise[_0xda5d('0xa7')](_0x1328b9);});}function countFilteredInteractions(_0x59e0b8,_0xb87f87){var _0x3b4da9=_0x59e0b8[_0xda5d('0xa8')]();_0x3b4da9[_0xda5d('0xd')](_0xda5d('0xa9'));_0x3b4da9[_0xda5d('0xd')](_0xda5d('0x7c'),_0xda5d('0x46'));var _0x19c2cd=utils[_0xda5d('0x26')](_0xb87f87);if(!_[_0xda5d('0xaa')](_0x19c2cd)){_0x3b4da9[_0xda5d('0x18')]('t.id\x20IN\x20?',_0x19c2cd);}var _0x5cbcfe={'type':db['Sequelize']['QueryTypes'][_0xda5d('0xab')],'raw':!![]};return db[_0xda5d('0x78')]['query'](_0x3b4da9['toString'](),_0x5cbcfe);}module[_0xda5d('0xac')]={'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 d95f431..30b569b 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 _0x079c=['updateInteraction','then','TagIds','Tags','../../mysqldb','map','fullname','forEach','push','waiting','talking','answered','abandoned','closed','disposition','UserId','total','MailMessage','out','plainBody','-id','lastMsgText','trimStart'];(function(_0x41a491,_0x3c5170){var _0x41f24f=function(_0x47ea7f){while(--_0x47ea7f){_0x41a491['push'](_0x41a491['shift']());}};_0x41f24f(++_0x3c5170);}(_0x079c,0xd3));var _0xc079=function(_0x3819dd,_0x437571){_0x3819dd=_0x3819dd-0x0;var _0x5f0275=_0x079c[_0x3819dd];return _0x5f0275;};'use strict';var _=require('lodash');var db=require(_0xc079('0x0'))['db'];function getInteractionUsers(_0x1a80d6,_0x517b5c){return new Promise(function(_0x5b2f25,_0x23d530){try{var _0x3ca26d=[];if(_0x517b5c[_0x1a80d6]){_0x3ca26d=_0x517b5c[_0x1a80d6][_0xc079('0x1')](function(_0x2f145a){return{'id':_0x2f145a['id'],'fullname':_0x2f145a[_0xc079('0x2')]};});}return _0x5b2f25(_0x3ca26d);}catch(_0x16bcfe){_0x23d530(_0x16bcfe);}});}function getInteractionTags(_0x5c76d0,_0x1ec751){var _0x20f57c=[];if(_0x5c76d0){_0x5c76d0['split'](',')[_0xc079('0x3')](function(_0x1db246){_0x20f57c[_0xc079('0x4')](_0x1ec751[_0x1db246]);});}return _0x20f57c;}function updateWaitingCounter(_0x32d402){if(_0x32d402['waiting']){_0x32d402[_0xc079('0x5')]-=0x1;}}function updateInteractionCounters(_0x4e8696){_0x4e8696[_0xc079('0x5')]=0x0;_0x4e8696[_0xc079('0x6')]=0x0;_0x4e8696[_0xc079('0x7')]=0x0;_0x4e8696['unmanaged']=0x0;_0x4e8696[_0xc079('0x8')]=0x0;_0x4e8696['total']=0x0;if(_0x4e8696[_0xc079('0x9')]){if(_0x4e8696[_0xc079('0xa')]==='abandoned'){_0x4e8696[_0xc079('0x8')]+=0x1;updateWaitingCounter(_0x4e8696);}if(_0x4e8696[_0xc079('0xb')]){_0x4e8696[_0xc079('0x7')]+=0x1;if(_0x4e8696[_0xc079('0x6')]){_0x4e8696[_0xc079('0x6')]-=0x1;}}else{if(_0x4e8696['disposition']){_0x4e8696['unmanaged']+=0x1;updateWaitingCounter(_0x4e8696);}}}else{if(!_0x4e8696[_0xc079('0xb')]){_0x4e8696['waiting']+=0x1;}if(_0x4e8696[_0xc079('0xb')]){_0x4e8696[_0xc079('0x6')]+=0x1;updateWaitingCounter(_0x4e8696);}}_0x4e8696[_0xc079('0xc')]+=0x1;return _0x4e8696;}function getLastMessageText(_0x46ab3c){return db[_0xc079('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x46ab3c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xc079('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc079('0xf')],'order':_0xc079('0x10'),'raw':!![]})['then'](function(_0x4037a2){if(_0x4037a2&&_0x4037a2['plainBody']){_0x46ab3c[_0xc079('0x11')]=_[_0xc079('0x12')](_0x4037a2['plainBody']);}return _0x46ab3c;})['catch'](function(_0x4b8563){throw _0x4b8563;});}exports[_0xc079('0x13')]=function(_0x325eaf,_0x507c93,_0x514e74,_0x471fc0){return new Promise(function(_0x4d5971,_0x140187){return getInteractionUsers(_0x325eaf['id'],_0x514e74)[_0xc079('0x14')](function(_0x946b14){_0x325eaf['Users']=_0x946b14;return getInteractionTags(_0x325eaf[_0xc079('0x15')],_0x507c93);})['then'](function(_0x342463){_0x325eaf[_0xc079('0x16')]=_0x342463;delete _0x325eaf[_0xc079('0x15')];return updateInteractionCounters(_0x325eaf);})[_0xc079('0x14')](function(_0x562840){if(_0x471fc0){return getLastMessageText(_0x562840);}else{return _0x562840;}})[_0xc079('0x14')](function(_0x302aff){_0x4d5971(_0x302aff);})['catch'](function(_0x4829e9){_0x140187(_0x4829e9);});});}; \ No newline at end of file +var _0x2bce=['total','closed','UserId','talking','disposition','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','answered','unmanaged','abandoned'];(function(_0x186297,_0x518894){var _0x3f17d7=function(_0x283b84){while(--_0x283b84){_0x186297['push'](_0x186297['shift']());}};_0x3f17d7(++_0x518894);}(_0x2bce,0x1a5));var _0xe2bc=function(_0x1bb9c7,_0x4259f1){_0x1bb9c7=_0x1bb9c7-0x0;var _0x31bed6=_0x2bce[_0x1bb9c7];return _0x31bed6;};'use strict';var _=require(_0xe2bc('0x0'));var db=require(_0xe2bc('0x1'))['db'];function getInteractionUsers(_0x25080b,_0x465c21){return new Promise(function(_0x578b86,_0x1352e4){try{var _0x4c7d13=[];if(_0x465c21[_0x25080b]){_0x4c7d13=_0x465c21[_0x25080b][_0xe2bc('0x2')](function(_0x91d71d){return{'id':_0x91d71d['id'],'fullname':_0x91d71d[_0xe2bc('0x3')]};});}return _0x578b86(_0x4c7d13);}catch(_0x3ddc66){_0x1352e4(_0x3ddc66);}});}function getInteractionTags(_0x1685ce,_0x3e8e0c){var _0x3db3d6=[];if(_0x1685ce){_0x1685ce[_0xe2bc('0x4')](',')[_0xe2bc('0x5')](function(_0xee133b){_0x3db3d6[_0xe2bc('0x6')](_0x3e8e0c[_0xee133b]);});}return _0x3db3d6;}function updateWaitingCounter(_0x2f4baa){if(_0x2f4baa[_0xe2bc('0x7')]){_0x2f4baa['waiting']-=0x1;}}function updateInteractionCounters(_0x50bef2){_0x50bef2['waiting']=0x0;_0x50bef2['talking']=0x0;_0x50bef2[_0xe2bc('0x8')]=0x0;_0x50bef2[_0xe2bc('0x9')]=0x0;_0x50bef2[_0xe2bc('0xa')]=0x0;_0x50bef2[_0xe2bc('0xb')]=0x0;if(_0x50bef2[_0xe2bc('0xc')]){if(_0x50bef2['disposition']===_0xe2bc('0xa')){_0x50bef2[_0xe2bc('0xa')]+=0x1;updateWaitingCounter(_0x50bef2);}if(_0x50bef2[_0xe2bc('0xd')]){_0x50bef2[_0xe2bc('0x8')]+=0x1;if(_0x50bef2[_0xe2bc('0xe')]){_0x50bef2[_0xe2bc('0xe')]-=0x1;}}else{if(_0x50bef2[_0xe2bc('0xf')]){_0x50bef2['unmanaged']+=0x1;updateWaitingCounter(_0x50bef2);}}}else{if(!_0x50bef2['UserId']){_0x50bef2[_0xe2bc('0x7')]+=0x1;}if(_0x50bef2[_0xe2bc('0xd')]){_0x50bef2['talking']+=0x1;updateWaitingCounter(_0x50bef2);}}_0x50bef2[_0xe2bc('0xb')]+=0x1;return _0x50bef2;}function getLastMessageText(_0x1d1613){return db[_0xe2bc('0x10')][_0xe2bc('0x11')]({'where':{'$and':[{'MailInteractionId':_0x1d1613['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe2bc('0x12')],'order':_0xe2bc('0x13'),'raw':!![]})['then'](function(_0x4566b2){if(_0x4566b2&&_0x4566b2[_0xe2bc('0x12')]){_0x1d1613[_0xe2bc('0x14')]=_[_0xe2bc('0x15')](_0x4566b2[_0xe2bc('0x12')]);}return _0x1d1613;})[_0xe2bc('0x16')](function(_0x2444e8){throw _0x2444e8;});}exports[_0xe2bc('0x17')]=function(_0x39819d,_0x3953ba,_0x1c6a1a,_0x302c5b){return new Promise(function(_0xcf437e,_0x54acbf){return getInteractionUsers(_0x39819d['id'],_0x1c6a1a)[_0xe2bc('0x18')](function(_0x38beae){_0x39819d[_0xe2bc('0x19')]=_0x38beae;return getInteractionTags(_0x39819d['TagIds'],_0x3953ba);})[_0xe2bc('0x18')](function(_0xd39824){_0x39819d['Tags']=_0xd39824;delete _0x39819d[_0xe2bc('0x1a')];return updateInteractionCounters(_0x39819d);})[_0xe2bc('0x18')](function(_0x14ce1e){if(_0x302c5b){return getLastMessageText(_0x14ce1e);}else{return _0x14ce1e;}})[_0xe2bc('0x18')](function(_0x2ec7af){_0xcf437e(_0x2ec7af);})['catch'](function(_0x330e94){_0x54acbf(_0x330e94);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 9bc5e2b..d81347c 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 _0xb6a9=['findOne','update','info','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','null'];(function(_0xec0dc8,_0x29603e){var _0x48b9f3=function(_0x106ef1){while(--_0x106ef1){_0xec0dc8['push'](_0xec0dc8['shift']());}};_0x48b9f3(++_0x29603e);}(_0xb6a9,0x1b8));var _0x9b6a=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb6a9[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x9b6a('0x0'));var db=require(_0x9b6a('0x1'))['db'];var loggers={'openchannel':require(_0x9b6a('0x2'))(_0x9b6a('0x3')),'mail':require(_0x9b6a('0x2'))(_0x9b6a('0x4')),'fax':require(_0x9b6a('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0x9b6a('0x5')),'chat':require(_0x9b6a('0x2'))('chat-interactions'),'whatsapp':require(_0x9b6a('0x2'))(_0x9b6a('0x6'))};function getAccountFK(_0x1bffb5){return _[_0x9b6a('0x7')](_0x1bffb5)+(_0x1bffb5===_0x9b6a('0x8')?_0x9b6a('0x9'):_0x9b6a('0xa'))+'Id';}function getInteractionFK(_0x592a40){return _['capitalize'](_0x592a40)+_0x9b6a('0xb');}function getInteractionId(_0x36b0f4,_0x203fd0,_0x24ecba){if(_0x36b0f4&&_0x36b0f4[_[_0x9b6a('0xc')](_0x24ecba)+_0x9b6a('0xb')]){return _0x36b0f4[_['upperFirst'](_0x24ecba)+_0x9b6a('0xb')];}else if(_0x36b0f4&&_0x36b0f4['id']){return _0x36b0f4['id'];}else if(_0x203fd0&&_0x203fd0['id']){return _0x203fd0['id'];}else{return _0x9b6a('0xd');}}function getInteractionsTables(_0x5754f7){return{'accounts':_0x5754f7+'_'+(_0x5754f7===_0x9b6a('0x8')?_0x9b6a('0xe'):_0x9b6a('0xf')),'interactions':_0x5754f7+_0x9b6a('0x10'),'interactionsTags':_0x5754f7+'_interaction_has_tags','messages':_0x5754f7+_0x9b6a('0x11'),'userInteractions':'user_has_'+_0x5754f7+_0x9b6a('0x10')};}function getSelectedTags(_0x500354){var _0x4397b2=[];if(_0x500354){_0x4397b2=Array[_0x9b6a('0x12')](_0x500354)?_0x500354:[_0x500354];}return _0x4397b2;}function log(_0xc4c4cb,_0x2e2c54,_0x32d940,_0x4f8e55,_0x204623,_0x1e72a8){loggers[_0x204623[_0x9b6a('0x13')]()][_0xc4c4cb](_0x9b6a('0x14'),_0x1e72a8[_0x9b6a('0x15')](),_0x2e2c54?_0x2e2c54['id']:null,_0x2e2c54?_0x2e2c54[_0x9b6a('0x16')]:null,_0x2e2c54?_0x2e2c54['role']:null,getInteractionId(_0x32d940,_0x4f8e55,_0x204623),_0x32d940?JSON['stringify'](_0x32d940):_0x9b6a('0x17'));}function updateUser(_0xb76b12,_0x22a854,_0x134f84,_0x4fac18,_0x5250f9){db[_[_0x9b6a('0xc')](_0x4fac18)+'Interaction'][_0x9b6a('0x18')]({'where':{'id':getInteractionId(_0x22a854,_0x134f84,_0x4fac18)}})['then'](function(_0x1a4c68){if(_0x1a4c68){return _0x1a4c68[_0x9b6a('0x19')]({'UserId':_0xb76b12?_0xb76b12['id']:null});}})['then'](function(_0xd281a0){if(_0xd281a0){log(_0x9b6a('0x1a'),_0xb76b12,_0x22a854,_0x134f84,_0x4fac18,_0x5250f9);}})['catch'](function(){log(_0x9b6a('0x1b'),_0xb76b12,_0x22a854,_0x134f84,_0x4fac18,_0x5250f9);});}module[_0x9b6a('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x658d=['user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','update','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','capitalize','chat','Website','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags'];(function(_0x2e0f51,_0x330c8f){var _0x325637=function(_0x41afc7){while(--_0x41afc7){_0x2e0f51['push'](_0x2e0f51['shift']());}};_0x325637(++_0x330c8f);}(_0x658d,0x163));var _0xd658=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x658d[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0xd658('0x0'));var db=require(_0xd658('0x1'))['db'];var loggers={'openchannel':require(_0xd658('0x2'))(_0xd658('0x3')),'mail':require(_0xd658('0x2'))(_0xd658('0x4')),'fax':require(_0xd658('0x2'))(_0xd658('0x5')),'sms':require(_0xd658('0x2'))(_0xd658('0x6')),'chat':require(_0xd658('0x2'))('chat-interactions'),'whatsapp':require(_0xd658('0x2'))('whatsapp-interactions')};function getAccountFK(_0x34dcf7){return _[_0xd658('0x7')](_0x34dcf7)+(_0x34dcf7===_0xd658('0x8')?_0xd658('0x9'):'Account')+'Id';}function getInteractionFK(_0x42dd38){return _[_0xd658('0x7')](_0x42dd38)+_0xd658('0xa');}function getInteractionId(_0x230545,_0x45d808,_0x2fe363){if(_0x230545&&_0x230545[_[_0xd658('0xb')](_0x2fe363)+'InteractionId']){return _0x230545[_[_0xd658('0xb')](_0x2fe363)+'InteractionId'];}else if(_0x230545&&_0x230545['id']){return _0x230545['id'];}else if(_0x45d808&&_0x45d808['id']){return _0x45d808['id'];}else{return _0xd658('0xc');}}function getInteractionsTables(_0x571abc){return{'accounts':_0x571abc+'_'+(_0x571abc===_0xd658('0x8')?_0xd658('0xd'):_0xd658('0xe')),'interactions':_0x571abc+_0xd658('0xf'),'interactionsTags':_0x571abc+_0xd658('0x10'),'messages':_0x571abc+'_messages','userInteractions':_0xd658('0x11')+_0x571abc+_0xd658('0xf')};}function getSelectedTags(_0x465d68){var _0x299c65=[];if(_0x465d68){_0x299c65=Array[_0xd658('0x12')](_0x465d68)?_0x465d68:[_0x465d68];}return _0x299c65;}function log(_0x49e689,_0xd07868,_0x263c66,_0x41ceda,_0xf17046,_0x561a44){loggers[_0xf17046['toLowerCase']()][_0x49e689](_0xd658('0x13'),_0x561a44[_0xd658('0x14')](),_0xd07868?_0xd07868['id']:null,_0xd07868?_0xd07868[_0xd658('0x15')]:null,_0xd07868?_0xd07868['role']:null,getInteractionId(_0x263c66,_0x41ceda,_0xf17046),_0x263c66?JSON[_0xd658('0x16')](_0x263c66):_0xd658('0x17'));}function updateUser(_0x44f4da,_0x1034e7,_0xb5a753,_0x11d951,_0x201904){db[_[_0xd658('0xb')](_0x11d951)+'Interaction'][_0xd658('0x18')]({'where':{'id':getInteractionId(_0x1034e7,_0xb5a753,_0x11d951)}})['then'](function(_0x98a950){if(_0x98a950){return _0x98a950[_0xd658('0x19')]({'UserId':_0x44f4da?_0x44f4da['id']:null});}})[_0xd658('0x1a')](function(_0x4d5069){if(_0x4d5069){log(_0xd658('0x1b'),_0x44f4da,_0x1034e7,_0xb5a753,_0x11d951,_0x201904);}})[_0xd658('0x1c')](function(){log(_0xd658('0x1d'),_0x44f4da,_0x1034e7,_0xb5a753,_0x11d951,_0x201904);});}module[_0xd658('0x1e')]={'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 126924b..6e346c2 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 _0x5d67=['license','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1'];(function(_0x2e8438,_0x59d54a){var _0x1c5008=function(_0x23f570){while(--_0x23f570){_0x2e8438['push'](_0x2e8438['shift']());}};_0x1c5008(++_0x59d54a);}(_0x5d67,0xa3));var _0x75d6=function(_0x5478ff,_0x2bf423){_0x5478ff=_0x5478ff-0x0;var _0xaed5c=_0x5d67[_0x5478ff];return _0xaed5c;};'use strict';var crypto=require(_0x75d6('0x0'));var util=require('util');var compose=require(_0x75d6('0x1'));var db=require(_0x75d6('0x2'))['db'];var config=require(_0x75d6('0x3'));function getValueFromLicense(_0x35d1ef,_0x110738){if(_0x35d1ef&&_0x110738){if(_0x110738[_0x75d6('0x4')]&&_0x110738[_0x75d6('0x5')]){var _0x13a8ba=_0x110738[_0x75d6('0x4')];var _0x3c109d=_0x110738[_0x75d6('0x5')];var _0x386d63=_0x13a8ba[_0x75d6('0x6')]('-')[0x4];var _0x302816=_0x13a8ba['split']('-')[0x0];var _0x1969e4=crypto[_0x75d6('0x7')](_0x75d6('0x8'),util['format'](_0x75d6('0x9'),_0x386d63,_0x13a8ba,_0x302816));var _0xb9ca9=_0x1969e4['update'](_0x3c109d,_0x75d6('0xa'),'utf8');_0xb9ca9+=_0x1969e4[_0x75d6('0xb')](_0x75d6('0xc'));var _0x515404=JSON[_0x75d6('0xd')](_0xb9ca9);return _0x515404[_0x75d6('0xe')](_0x35d1ef)?_0x515404[_0x35d1ef]:null;}}return null;}function isLimit(_0x595fbe,_0x45f3b9,_0x414ec5,_0x391693){var _0x4de750=_0x45f3b9;return compose()[_0x75d6('0xf')](function(_0xd46658,_0xeffc24,_0x2f3a24){return db[_0x75d6('0x10')][_0x75d6('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x75d6('0x12')](function(_0x2102cd){var _0x54d5d3=getValueFromLicense(_0x595fbe,_0x2102cd);return _0x54d5d3?_0x54d5d3:_0x4de750;})[_0x75d6('0x12')](function(_0x53ca9a){_0x4de750=_0x53ca9a;return _0x414ec5[_0x75d6('0x13')](_0x391693);})['then'](function(_0x566683){if(_0x566683>=_0x4de750){return _0xeffc24[_0x75d6('0x14')](0x193)[_0x75d6('0x15')]({'message':util['format'](_0x75d6('0x16'),_0x595fbe)});}_0x2f3a24();})[_0x75d6('0x17')](function(_0x403390){_0x2f3a24(_0x403390);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x75d6('0x18')],{'where':{'$or':[{'role':_0x75d6('0x19')},{'role':_0x75d6('0x1a')}]}});}exports[_0x75d6('0x1b')]=isUserLimit; \ No newline at end of file +var _0x94a2=['license','data1','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','util','composable-middleware'];(function(_0x20ceae,_0x317c27){var _0x15da0c=function(_0x35a3f9){while(--_0x35a3f9){_0x20ceae['push'](_0x20ceae['shift']());}};_0x15da0c(++_0x317c27);}(_0x94a2,0x111));var _0x294a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x94a2[_0xbd08b4];return _0x314f1e;};'use strict';var crypto=require('crypto');var util=require(_0x294a('0x0'));var compose=require(_0x294a('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x7872f8,_0x339dbe){if(_0x7872f8&&_0x339dbe){if(_0x339dbe['data1']&&_0x339dbe[_0x294a('0x2')]){var _0x3f2993=_0x339dbe[_0x294a('0x3')];var _0x40d06a=_0x339dbe['license'];var _0x415d72=_0x3f2993[_0x294a('0x4')]('-')[0x4];var _0x4cc6ce=_0x3f2993[_0x294a('0x4')]('-')[0x0];var _0x411f1c=crypto[_0x294a('0x5')](_0x294a('0x6'),util[_0x294a('0x7')]('%s:%s:%s',_0x415d72,_0x3f2993,_0x4cc6ce));var _0x240bd=_0x411f1c[_0x294a('0x8')](_0x40d06a,_0x294a('0x9'),_0x294a('0xa'));_0x240bd+=_0x411f1c[_0x294a('0xb')](_0x294a('0xa'));var _0x300d9f=JSON[_0x294a('0xc')](_0x240bd);return _0x300d9f['hasOwnProperty'](_0x7872f8)?_0x300d9f[_0x7872f8]:null;}}return null;}function isLimit(_0x523246,_0x2d0a03,_0x558fc3,_0x474339){var _0x32b96d=_0x2d0a03;return compose()[_0x294a('0xd')](function(_0x5e85ae,_0x32e227,_0x1d9543){return db[_0x294a('0xe')][_0x294a('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x294a('0x10')](function(_0x2c9853){var _0x34d801=getValueFromLicense(_0x523246,_0x2c9853);return _0x34d801?_0x34d801:_0x32b96d;})[_0x294a('0x10')](function(_0x2a3a71){_0x32b96d=_0x2a3a71;return _0x558fc3[_0x294a('0x11')](_0x474339);})['then'](function(_0x512c03){if(_0x512c03>=_0x32b96d){return _0x32e227[_0x294a('0x12')](0x193)[_0x294a('0x13')]({'message':util[_0x294a('0x7')](_0x294a('0x14'),_0x523246)});}_0x1d9543();})[_0x294a('0x15')](function(_0x1caf21){_0x1d9543(_0x1caf21);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x294a('0x16')],{'where':{'$or':[{'role':_0x294a('0x17')},{'role':_0x294a('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2b77f05..13856f5 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 _0xbdcf=['=\x20?','$ne','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','DATE','utcOffset','add','hours','seconds','lodash','parseSearch','sqlOperator','startsWith','replace','[$and]','[$or]','split','length','slice','shift','forEach','filter','indexOf','conditions','buildExpression','operator','$eq','includes','$lte','value','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbdcf,0xe8));var _0xfbdc=function(_0x2eb9a2,_0x529c30){_0x2eb9a2=_0x2eb9a2-0x0;var _0x380333=_0xbdcf[_0x2eb9a2];return _0x380333;};'use strict';var _=require(_0xfbdc('0x0'));var moment=require('moment');exports[_0xfbdc('0x1')]=function(_0x63d0b5){var _0x4ea03d={'conditions':[]};_0x4ea03d[_0xfbdc('0x2')]=_[_0xfbdc('0x3')](_0x63d0b5,'[$or]')?'or':'and';var _0x4087ce=_0x63d0b5[_0xfbdc('0x4')](_0xfbdc('0x5'),'')[_0xfbdc('0x4')](_0xfbdc('0x6'),'')[_0xfbdc('0x7')]('||');for(var _0x510bf5=0x0;_0x510bf5<_0x4087ce[_0xfbdc('0x8')];_0x510bf5++){var _0x15ae06=_0x4087ce[_0x510bf5][_0xfbdc('0x7')](':=');var _0x5b88d9=_0x15ae06[0x0];var _0x3a8c9b=_0x15ae06[_0xfbdc('0x9')](0x1);_0x3a8c9b['forEach'](function(_0xb46aab){var _0x4212e1=_0xb46aab[_0xfbdc('0x7')]('[')[_0xfbdc('0xa')]();var _0x15ec98=_0xb46aab['match'](/\[(.*?)\]/g);_0x15ec98[_0xfbdc('0xb')](function(_0x219d3c){var _0x56d684=_0x219d3c['split']('[')[_0xfbdc('0xc')](function(_0x3e730f){return _0x3e730f[_0xfbdc('0xd')](']')>-0x1;})['map'](function(_0x500f60){return _0x500f60[_0xfbdc('0x7')](']')[0x0];})[0x0];_0x4ea03d[_0xfbdc('0xe')]['push']({'field':_0x5b88d9,'operator':_0x4212e1,'value':_0x56d684});});});}return _0x4ea03d;};exports[_0xfbdc('0xf')]=function(_0x114e5e,_0x4bd666,_0x3ce9b0){var _0x563290={};if(_0x4bd666==='DATE'){if(_0x3ce9b0[_0xfbdc('0x10')]===_0xfbdc('0x11')){_0x3ce9b0[_0xfbdc('0x10')]='$between';_0x3ce9b0['value']+=','+_0x3ce9b0['value'];}else if(_[_0xfbdc('0x12')](['$gt',_0xfbdc('0x13')],_0x3ce9b0[_0xfbdc('0x10')])){_0x3ce9b0['value']=moment(_0x3ce9b0[_0xfbdc('0x14')])['add'](0x1,'days')[_0xfbdc('0x15')](_0xfbdc('0x16'));}}if(_0x3ce9b0[_0xfbdc('0x17')]){_0x4bd666=_0x3ce9b0[_0xfbdc('0x17')];_0x563290[_0xfbdc('0x18')]=_0xfbdc('0x19')+_0x114e5e+'.'+_0x3ce9b0[_0xfbdc('0x1a')]+_0xfbdc('0x1b')+_0x3ce9b0[_0xfbdc('0x17')]+')\x20'+parseOperator(_0x3ce9b0['operator']);}else{_0x563290['text']=_0x114e5e+'.'+_0x3ce9b0['field']+'\x20'+parseOperator(_0x3ce9b0[_0xfbdc('0x10')]);}if(_[_0xfbdc('0x12')](['$ne',_0xfbdc('0x1c')],_0x3ce9b0[_0xfbdc('0x10')]))_0x563290[_0xfbdc('0x18')]='('+_0x563290[_0xfbdc('0x18')]+_0xfbdc('0x1d')+_0x114e5e+'.'+_0x3ce9b0[_0xfbdc('0x1a')]+_0xfbdc('0x1e');_0x563290[_0xfbdc('0x14')]=parseValue(_0x4bd666,_0x3ce9b0['operator'],_0x3ce9b0[_0xfbdc('0x14')]);return _0x563290;};function parseOperator(_0x2b592f){var _0x3342a8;switch(_0x2b592f){case _0xfbdc('0x1f'):_0x3342a8='IN\x20?';break;case _0xfbdc('0x1c'):_0x3342a8=_0xfbdc('0x20');break;case _0xfbdc('0x11'):_0x3342a8=_0xfbdc('0x21');break;case _0xfbdc('0x22'):_0x3342a8='<>\x20?';break;case _0xfbdc('0x23'):case _0xfbdc('0x24'):case'$endsWith':_0x3342a8=_0xfbdc('0x25');break;case _0xfbdc('0x26'):_0x3342a8=_0xfbdc('0x27');break;case _0xfbdc('0x28'):_0x3342a8='>\x20?';break;case _0xfbdc('0x13'):_0x3342a8='<=\x20?';break;case _0xfbdc('0x29'):_0x3342a8=_0xfbdc('0x2a');break;case _0xfbdc('0x2b'):_0x3342a8=_0xfbdc('0x2c');break;}return _0x3342a8;}function parseValue(_0x19f316,_0x4e0949,_0x3668f4){var _0x4b1f77={'start':undefined,'end':undefined};switch(_0x4e0949){case'$in':case _0xfbdc('0x1c'):_0x4b1f77[_0xfbdc('0x2d')]=_0x3668f4[_0xfbdc('0x7')](',');break;case _0xfbdc('0x23'):_0x4b1f77['start']='%'+_0x3668f4+'%';break;case _0xfbdc('0x24'):_0x4b1f77[_0xfbdc('0x2d')]=_0x3668f4+'%';break;case _0xfbdc('0x2e'):_0x4b1f77['start']='%'+_0x3668f4;break;case _0xfbdc('0x2b'):var _0xe7c4f5=_0x3668f4[_0xfbdc('0x7')](',');var _0x3668f4=_0xe7c4f5[_0xfbdc('0xa')]();var _0x303ff9=_0xe7c4f5[_0xfbdc('0x2f')]();if(_0x19f316===_0xfbdc('0x30')){_0x3668f4=moment(_0x3668f4)[_0xfbdc('0x31')](0x0,!![])[_0xfbdc('0x15')]();_0x303ff9=moment(_0x303ff9)[_0xfbdc('0x31')](0x0,!![])[_0xfbdc('0x32')](0x17,_0xfbdc('0x33'))[_0xfbdc('0x32')](0x3b,'minutes')['add'](0x3b,_0xfbdc('0x34'))[_0xfbdc('0x15')]();}_0x4b1f77={'start':_0x3668f4,'end':_0x303ff9};break;default:_0x4b1f77[_0xfbdc('0x2d')]=_0x3668f4;break;}return _0x4b1f77;} \ No newline at end of file +var _0xcb4c=['$eq','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$endsWith','utcOffset','hours','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','filter','indexOf','conditions','buildExpression','DATE','operator'];(function(_0x17a742,_0x19486f){var _0x4804eb=function(_0x784957){while(--_0x784957){_0x17a742['push'](_0x17a742['shift']());}};_0x4804eb(++_0x19486f);}(_0xcb4c,0x131));var _0xccb4=function(_0x5b4490,_0x14af15){_0x5b4490=_0x5b4490-0x0;var _0xb7f865=_0xcb4c[_0x5b4490];return _0xb7f865;};'use strict';var _=require(_0xccb4('0x0'));var moment=require(_0xccb4('0x1'));exports['parseSearch']=function(_0x38b4bc){var _0x348336={'conditions':[]};_0x348336[_0xccb4('0x2')]=_[_0xccb4('0x3')](_0x38b4bc,_0xccb4('0x4'))?'or':_0xccb4('0x5');var _0x294965=_0x38b4bc[_0xccb4('0x6')](_0xccb4('0x7'),'')[_0xccb4('0x6')](_0xccb4('0x4'),'')[_0xccb4('0x8')]('||');for(var _0x23e001=0x0;_0x23e001<_0x294965[_0xccb4('0x9')];_0x23e001++){var _0x544a90=_0x294965[_0x23e001]['split'](':=');var _0x1f3db4=_0x544a90[0x0];var _0x3b4802=_0x544a90[_0xccb4('0xa')](0x1);_0x3b4802[_0xccb4('0xb')](function(_0x4a8830){var _0x498e6c=_0x4a8830[_0xccb4('0x8')]('[')[_0xccb4('0xc')]();var _0x12cbc5=_0x4a8830['match'](/\[(.*?)\]/g);_0x12cbc5[_0xccb4('0xb')](function(_0x58bd00){var _0x457f9b=_0x58bd00[_0xccb4('0x8')]('[')[_0xccb4('0xd')](function(_0x3b87b0){return _0x3b87b0[_0xccb4('0xe')](']')>-0x1;})['map'](function(_0x9bd22f){return _0x9bd22f[_0xccb4('0x8')](']')[0x0];})[0x0];_0x348336[_0xccb4('0xf')]['push']({'field':_0x1f3db4,'operator':_0x498e6c,'value':_0x457f9b});});});}return _0x348336;};exports[_0xccb4('0x10')]=function(_0x35bba2,_0x53a425,_0xe046de){var _0x3fae08={};if(_0x53a425===_0xccb4('0x11')){if(_0xe046de[_0xccb4('0x12')]===_0xccb4('0x13')){_0xe046de[_0xccb4('0x12')]='$between';_0xe046de['value']+=','+_0xe046de[_0xccb4('0x14')];}else if(_[_0xccb4('0x15')]([_0xccb4('0x16'),_0xccb4('0x17')],_0xe046de[_0xccb4('0x12')])){_0xe046de['value']=moment(_0xe046de['value'])[_0xccb4('0x18')](0x1,_0xccb4('0x19'))[_0xccb4('0x1a')]('YYYY-MM-DD');}}if(_0xe046de['castTo']){_0x53a425=_0xe046de[_0xccb4('0x1b')];_0x3fae08[_0xccb4('0x1c')]=_0xccb4('0x1d')+_0x35bba2+'.'+_0xe046de['field']+'\x20AS\x20'+_0xe046de[_0xccb4('0x1b')]+')\x20'+parseOperator(_0xe046de['operator']);}else{_0x3fae08['text']=_0x35bba2+'.'+_0xe046de['field']+'\x20'+parseOperator(_0xe046de[_0xccb4('0x12')]);}if(_[_0xccb4('0x15')]([_0xccb4('0x1e'),_0xccb4('0x1f')],_0xe046de[_0xccb4('0x12')]))_0x3fae08['text']='('+_0x3fae08[_0xccb4('0x1c')]+_0xccb4('0x20')+_0x35bba2+'.'+_0xe046de[_0xccb4('0x21')]+_0xccb4('0x22');_0x3fae08['value']=parseValue(_0x53a425,_0xe046de[_0xccb4('0x12')],_0xe046de[_0xccb4('0x14')]);return _0x3fae08;};function parseOperator(_0x19d377){var _0x439d86;switch(_0x19d377){case _0xccb4('0x23'):_0x439d86=_0xccb4('0x24');break;case'$notIn':_0x439d86='NOT\x20IN\x20?';break;case'$eq':_0x439d86=_0xccb4('0x25');break;case _0xccb4('0x1e'):_0x439d86=_0xccb4('0x26');break;case _0xccb4('0x27'):case _0xccb4('0x28'):case'$endsWith':_0x439d86=_0xccb4('0x29');break;case _0xccb4('0x2a'):_0x439d86=_0xccb4('0x2b');break;case _0xccb4('0x16'):_0x439d86=_0xccb4('0x2c');break;case _0xccb4('0x17'):_0x439d86='<=\x20?';break;case _0xccb4('0x2d'):_0x439d86=_0xccb4('0x2e');break;case _0xccb4('0x2f'):_0x439d86=_0xccb4('0x30');break;}return _0x439d86;}function parseValue(_0x2de6bd,_0x28ec7d,_0x36a08c){var _0x3f2958={'start':undefined,'end':undefined};switch(_0x28ec7d){case _0xccb4('0x23'):case'$notIn':_0x3f2958['start']=_0x36a08c[_0xccb4('0x8')](',');break;case'$substring':_0x3f2958[_0xccb4('0x31')]='%'+_0x36a08c+'%';break;case'$startsWith':_0x3f2958[_0xccb4('0x31')]=_0x36a08c+'%';break;case _0xccb4('0x32'):_0x3f2958['start']='%'+_0x36a08c;break;case _0xccb4('0x2f'):var _0x39f241=_0x36a08c['split'](',');var _0x36a08c=_0x39f241['shift']();var _0x26ac23=_0x39f241['pop']();if(_0x2de6bd==='DATE'){_0x36a08c=moment(_0x36a08c)[_0xccb4('0x33')](0x0,!![])[_0xccb4('0x1a')]();_0x26ac23=moment(_0x26ac23)[_0xccb4('0x33')](0x0,!![])['add'](0x17,_0xccb4('0x34'))[_0xccb4('0x18')](0x3b,'minutes')[_0xccb4('0x18')](0x3b,_0xccb4('0x35'))['format']();}_0x3f2958={'start':_0x36a08c,'end':_0x26ac23};break;default:_0x3f2958['start']=_0x36a08c;break;}return _0x3f2958;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c6adfb5..0598d8f 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 _0xea6c=['unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','{EXPR}','forEach','push','getOptions','$id','query','attributes','intersection','nolimit','order','sort','where','filter','object','merge','VIRTUAL','lower','options','include','includeAll','map','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','format','$lte','utc','subtract','name','uniqueid','isArray','limit','offset','indexOf','priority','col','DESC','cast','unsigned','ASC','omit','length','isObject','isString'];(function(_0x4d57e4,_0x528cc5){var _0x2d1fac=function(_0x598f59){while(--_0x598f59){_0x4d57e4['push'](_0x4d57e4['shift']());}};_0x2d1fac(++_0x528cc5);}(_0xea6c,0x164));var _0xcea6=function(_0x16e9b5,_0x192142){_0x16e9b5=_0x16e9b5-0x0;var _0x206df0=_0xea6c[_0x16e9b5];return _0x206df0;};'use strict';var _=require('lodash');var sequelize=require(_0xcea6('0x0'));var moment=require(_0xcea6('0x1'));var db=require(_0xcea6('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x220ee3){var _0x274194=['ne'];try{var _0x442068=JSON[_0xcea6('0x3')](_0x220ee3);var _0x438fb5=Object[_0xcea6('0x4')](_0x442068)[0x0];return _0x274194[_0xcea6('0x5')](_0x438fb5);}catch(_0x126138){return![];}}function getOperatorValue(_0x5e4ead){var _0x3e4572=JSON['parse'](_0x5e4ead);var _0x39e5d6=Object[_0xcea6('0x4')](_0x3e4572)[0x0];var _0x3c4497=_0x3e4572[_0x39e5d6];return{['$'+_0x39e5d6]:_0x3c4497};}function parseIncludeModel(_0xc595e5){var _0xd6a418=JSON['parse'](_0xc595e5);return{'model':db[_0xd6a418[_0xcea6('0x6')]],'as':_0xd6a418[_0xcea6('0x7')],'attributes':_0xd6a418[_0xcea6('0x8')],'raw':_0xd6a418[_0xcea6('0x9')]};}exports[_0xcea6('0x8')]=function(_0x7fe12c){var _0x8bbf8=null;if(_0x7fe12c){_0x8bbf8=_0x7fe12c[_0xcea6('0xa')](',');}return _0x8bbf8;};exports[_0xcea6('0xb')]=function(_0x3ad8c8,_0x348bf3){var _0x5e8373={};if(!_[_0xcea6('0xc')](_0x3ad8c8)){_[_0xcea6('0xd')](_0x3ad8c8,function(_0x4dd936,_0x252abe){try{if(_0x348bf3){var _0x1ac1ad=_[_0xcea6('0xe')](_0x348bf3,{'name':_0x252abe})||{};if(hasSequelizeOperator(_0x4dd936)){_0x5e8373[_0x252abe]=getOperatorValue(_0x4dd936);}else if(_0x1ac1ad[_0xcea6('0xf')]===_0xcea6('0x10')&&_[_0xcea6('0x11')](_0x4dd936)){var _0x59fcf9=JSON[_0xcea6('0x3')](_0x4dd936);var _0x1bea40={'$gte':moment(moment(_0x59fcf9[_0xcea6('0x12')])['format'](_0xcea6('0x13')))['utc']()[_0xcea6('0x14')](),'$lte':moment(moment(_0x59fcf9[_0xcea6('0x15')])['format'](_0xcea6('0x13')))[_0xcea6('0x16')]()[_0xcea6('0x17')](0x1,'s')[_0xcea6('0x14')]()};_0x5e8373[_0x252abe]=_0x1bea40;}else if(_0x1ac1ad[_0xcea6('0x18')]===_0xcea6('0x19')){_0x5e8373[_0x252abe]=_0x4dd936;}else{_0x5e8373[_0x252abe]=_[_0xcea6('0x1a')](_0x4dd936)?_0x4dd936:JSON[_0xcea6('0x3')](_0x4dd936);}}else{_0x5e8373[_0x252abe]=_[_0xcea6('0x1a')](_0x4dd936)?_0x4dd936:JSON['parse'](_0x4dd936);}}catch(_0x1b520e){_0x5e8373[_0x252abe]=_0x4dd936[_0xcea6('0xa')](',');}});}return _0x5e8373;};exports[_0xcea6('0x1b')]=function(_0x54524c){_0x54524c=parseInt(_0x54524c,0xa);if(!_0x54524c||_0x54524c<0x0){_0x54524c=LIMIT_VALUE;}return _0x54524c;};exports[_0xcea6('0x1c')]=function(_0x17dd0d){_0x17dd0d=parseInt(_0x17dd0d,0xa);if(!_0x17dd0d||_0x17dd0d<0x0){_0x17dd0d=0x0;}return _0x17dd0d;};exports['sort']=function(_0x4ee427){var _0x5564a8,_0x20f063=null;if(_0x4ee427){_0x5564a8=_0x4ee427['split'](',');_0x20f063=_['map'](_0x5564a8,function(_0x527139){if(_0x527139[_0xcea6('0x1d')]('-')===0x0){return[_0x527139===_0xcea6('0x1e')?sequelize['cast'](sequelize[_0xcea6('0x1f')]('priority'),'unsigned'):_0x527139['substr'](0x1),_0xcea6('0x20')];}else{return[_0x527139===_0xcea6('0x1e')?sequelize[_0xcea6('0x21')](sequelize[_0xcea6('0x1f')]('priority'),_0xcea6('0x22')):_0x527139,_0xcea6('0x23')];}});}return _0x20f063;};exports[_0xcea6('0x24')]=function(_0x316539,_0x129592){if(_[_0xcea6('0xc')](_0x316539)){return _0x316539;}if(_[_0xcea6('0x1a')](_0x316539)){for(var _0x2c46ed=0x0;_0x2c46ed<_0x316539[_0xcea6('0x25')];_0x2c46ed+=0x1){_0x316539[_0x2c46ed]=this[_0xcea6('0x24')](_0x316539[_0x2c46ed],_0x129592);}return _0x316539;}if(!_[_0xcea6('0x26')](_0x316539)){return _0x316539;}if(_[_0xcea6('0x27')](_0x129592)){_0x129592=[_0x129592];}if(!_[_0xcea6('0x1a')](_0x129592)){return _0x316539;}for(var _0xd9cdde=0x0;_0xd9cdde<_0x129592[_0xcea6('0x25')];_0xd9cdde+=0x1){_[_0xcea6('0x28')](_0x316539,_0x129592[_0xd9cdde]);}for(var _0x49a451 in _0x316539){if(_0x316539[_0xcea6('0x29')](_0x49a451)){_0x316539[_0x49a451]=this[_0xcea6('0x24')](_0x316539[_0x49a451],_0x129592);}}return _0x316539;};exports['isNumeric']=function(_0x1abec7){return _0x1abec7[_0xcea6('0x2a')](RegExp(_0xcea6('0x2b')))?!![]:![];};exports['isEmail']=function(_0x2f7bf0){return _0x2f7bf0['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xcea6('0x2c')]=function(_0x3b3dd3,_0x435fec){var _0x32c8d1=[];var _0x3edf1e=/[ `!@#$%^&*()_\-?~]/;var _0x2842c0=_0x435fec?'\x22{EXPR}\x22':_0xcea6('0x2d');_0x3b3dd3[_0xcea6('0xa')](/[ ,]+/)[_0xcea6('0x2e')](function(_0x3766ac){_0x3766ac=_0x3766ac['replace'](/([^:]")"+/g,'$1');_0x3766ac='+'+_0x3766ac+'*';var _0x3a6824=_0x3766ac[_0xcea6('0x2a')](_0x3edf1e);if(_0x3a6824){_0x3766ac='\x22'+_0x3766ac+'\x22';}_0x32c8d1[_0xcea6('0x2f')](_0x3766ac);});_0x2842c0=_0x2842c0['replace'](_0xcea6('0x2d'),_0x32c8d1['join']('\x20'));return _0x2842c0;};exports[_0xcea6('0x30')]=function(_0x31d237,_0x4da04a,_0x19e903){var _0x5c0e64={},_0x52da28={};if(_0x4da04a['query']['$id']){_0x4da04a['query']['id']=_0x4da04a['query'][_0xcea6('0x31')];delete _0x4da04a[_0xcea6('0x32')][_0xcea6('0x31')];}_0x5c0e64[_0xcea6('0x6')]=_['map'](_0x31d237,_0xcea6('0x18'));_0x5c0e64[_0xcea6('0x32')]=_[_0xcea6('0x4')](_0x4da04a[_0xcea6('0x32')]);_0x5c0e64['filters']=_['intersection'](_0x5c0e64[_0xcea6('0x6')],_0x5c0e64[_0xcea6('0x32')]);_0x52da28[_0xcea6('0x33')]=_[_0xcea6('0x34')](_0x5c0e64[_0xcea6('0x6')],this[_0xcea6('0x8')](_0x4da04a[_0xcea6('0x32')][_0xcea6('0x8')]));_0x52da28[_0xcea6('0x33')]=_0x52da28[_0xcea6('0x33')]['length']?_0x52da28['attributes']:_0x5c0e64[_0xcea6('0x6')];if(!_0x4da04a[_0xcea6('0x32')][_0xcea6('0x29')](_0xcea6('0x35'))){_0x52da28[_0xcea6('0x1b')]=this['limit'](_0x4da04a[_0xcea6('0x32')][_0xcea6('0x1b')]);_0x52da28['offset']=this[_0xcea6('0x1c')](_0x4da04a[_0xcea6('0x32')]['offset']);}_0x52da28[_0xcea6('0x36')]=this[_0xcea6('0x37')](_0x4da04a[_0xcea6('0x32')][_0xcea6('0x37')]);_0x52da28[_0xcea6('0x38')]=this[_0xcea6('0xb')](_['pick'](_0x4da04a[_0xcea6('0x32')],_0x5c0e64[_0xcea6('0xb')]),_0x31d237);if(_0x4da04a['query'][_0xcea6('0x39')]){var _0x496583=_0x31d237;var _0x3d7eb1=_0x4da04a[_0xcea6('0x32')][_0xcea6('0x39')];if(typeof _0x3d7eb1===_0xcea6('0x3a')){_0x496583=_[_0xcea6('0x39')](_0x31d237,function(_0x4ecdee){return _[_0xcea6('0x5')](_0x3d7eb1['columns'],_0x4ecdee[_0xcea6('0x18')]);});_0x3d7eb1=_0x3d7eb1['value'];}_0x52da28[_0xcea6('0x38')]=_[_0xcea6('0x3b')](_0x52da28[_0xcea6('0x38')],{'$or':_['map'](_0x496583,function(_0x391339){if(_0x391339['type']!==_0xcea6('0x3c')){if(_0x19e903){return sequelize[_0xcea6('0x38')](sequelize['fn'](_0xcea6('0x3d'),sequelize[_0xcea6('0x1f')](_0x391339[_0xcea6('0x18')])),{'$like':sequelize['fn'](_0xcea6('0x3d'),'%'+_0x4da04a[_0xcea6('0x32')]['filter']+'%')});}else{var _0x2c8275={};_0x2c8275[_0x391339['name']]={'$like':'%'+_0x4da04a[_0xcea6('0x32')][_0xcea6('0x39')]+'%'};return _0x2c8275;}}})});}_0x52da28=_[_0xcea6('0x3b')]({},_0x52da28,_0x4da04a[_0xcea6('0x3e')]);return _0x52da28;};exports[_0xcea6('0x3f')]=function(_0x3c4060){var _0x122eee=[];if(_0x3c4060[_0xcea6('0x40')]){_0x122eee[_0xcea6('0x2f')]({'all':!![]});}else if(_0x3c4060[_0xcea6('0x3f')]){if(Array[_0xcea6('0x1a')](_0x3c4060[_0xcea6('0x3f')])){_0x122eee=Object[_0xcea6('0x4')](_0x3c4060[_0xcea6('0x3f')])[_0xcea6('0x41')](function(_0x12a797){return parseIncludeModel(_0x3c4060['include'][_0x12a797]);});}else{var _0xb17814=parseIncludeModel(_0x3c4060['include']);_0x122eee[_0xcea6('0x2f')](_0xb17814);}}return _0x122eee;}; \ No newline at end of file +var _0xdedc=['filters','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','name','isArray','limit','offset','sort','map','priority','cast','col','substr','ASC','isString','length','unset','omit','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','query','$id','model','intersection','attributes','hasOwnProperty','nolimit','where','pick','object','filter','columns','VIRTUAL','lower','merge','options','include','includeAll','push','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','alias','fields','raw','split'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xdedc,0xb8));var _0xcded=function(_0x14dcc5,_0x163ab7){_0x14dcc5=_0x14dcc5-0x0;var _0x35d6cc=_0xdedc[_0x14dcc5];return _0x35d6cc;};'use strict';var _=require(_0xcded('0x0'));var sequelize=require(_0xcded('0x1'));var moment=require(_0xcded('0x2'));var db=require(_0xcded('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x31919f){var _0x58406f=['ne'];try{var _0x9f649a=JSON['parse'](_0x31919f);var _0x46ff39=Object[_0xcded('0x4')](_0x9f649a)[0x0];return _0x58406f[_0xcded('0x5')](_0x46ff39);}catch(_0x33828d){return![];}}function getOperatorValue(_0x4cbe1b){var _0x410b90=JSON[_0xcded('0x6')](_0x4cbe1b);var _0x50d7ae=Object[_0xcded('0x4')](_0x410b90)[0x0];var _0x488df8=_0x410b90[_0x50d7ae];return{['$'+_0x50d7ae]:_0x488df8};}function parseIncludeModel(_0x5a8057){var _0x18e8e1=JSON['parse'](_0x5a8057);return{'model':db[_0x18e8e1['model']],'as':_0x18e8e1[_0xcded('0x7')],'attributes':_0x18e8e1[_0xcded('0x8')],'raw':_0x18e8e1[_0xcded('0x9')]};}exports['fields']=function(_0x1c3bc7){var _0x47390a=null;if(_0x1c3bc7){_0x47390a=_0x1c3bc7[_0xcded('0xa')](',');}return _0x47390a;};exports[_0xcded('0xb')]=function(_0x331d5b,_0x5bd570){var _0x1afbba={};if(!_[_0xcded('0xc')](_0x331d5b)){_[_0xcded('0xd')](_0x331d5b,function(_0x90d985,_0x51eb76){try{if(_0x5bd570){var _0x36ae02=_[_0xcded('0xe')](_0x5bd570,{'name':_0x51eb76})||{};if(hasSequelizeOperator(_0x90d985)){_0x1afbba[_0x51eb76]=getOperatorValue(_0x90d985);}else if(_0x36ae02[_0xcded('0xf')]==='DATE'&&_[_0xcded('0x10')](_0x90d985)){var _0x21adbf=JSON[_0xcded('0x6')](_0x90d985);var _0x505ea2={'$gte':moment(moment(_0x21adbf[_0xcded('0x11')])['format'](_0xcded('0x12')))[_0xcded('0x13')]()[_0xcded('0x14')](),'$lte':moment(moment(_0x21adbf['$lte'])[_0xcded('0x14')](_0xcded('0x12')))['utc']()['subtract'](0x1,'s')[_0xcded('0x14')]()};_0x1afbba[_0x51eb76]=_0x505ea2;}else if(_0x36ae02[_0xcded('0x15')]==='uniqueid'){_0x1afbba[_0x51eb76]=_0x90d985;}else{_0x1afbba[_0x51eb76]=_[_0xcded('0x16')](_0x90d985)?_0x90d985:JSON['parse'](_0x90d985);}}else{_0x1afbba[_0x51eb76]=_[_0xcded('0x16')](_0x90d985)?_0x90d985:JSON[_0xcded('0x6')](_0x90d985);}}catch(_0x22e7fc){_0x1afbba[_0x51eb76]=_0x90d985[_0xcded('0xa')](',');}});}return _0x1afbba;};exports[_0xcded('0x17')]=function(_0x35aa21){_0x35aa21=parseInt(_0x35aa21,0xa);if(!_0x35aa21||_0x35aa21<0x0){_0x35aa21=LIMIT_VALUE;}return _0x35aa21;};exports[_0xcded('0x18')]=function(_0x574f97){_0x574f97=parseInt(_0x574f97,0xa);if(!_0x574f97||_0x574f97<0x0){_0x574f97=0x0;}return _0x574f97;};exports[_0xcded('0x19')]=function(_0x28b1c7){var _0x3b2edb,_0x2f3365=null;if(_0x28b1c7){_0x3b2edb=_0x28b1c7[_0xcded('0xa')](',');_0x2f3365=_[_0xcded('0x1a')](_0x3b2edb,function(_0x23d376){if(_0x23d376['indexOf']('-')===0x0){return[_0x23d376===_0xcded('0x1b')?sequelize[_0xcded('0x1c')](sequelize[_0xcded('0x1d')](_0xcded('0x1b')),'unsigned'):_0x23d376[_0xcded('0x1e')](0x1),'DESC'];}else{return[_0x23d376===_0xcded('0x1b')?sequelize[_0xcded('0x1c')](sequelize[_0xcded('0x1d')](_0xcded('0x1b')),'unsigned'):_0x23d376,_0xcded('0x1f')];}});}return _0x2f3365;};exports['omit']=function(_0x3459e4,_0x49250a){if(_[_0xcded('0xc')](_0x3459e4)){return _0x3459e4;}if(_['isArray'](_0x3459e4)){for(var _0x23dcd7=0x0;_0x23dcd7<_0x3459e4['length'];_0x23dcd7+=0x1){_0x3459e4[_0x23dcd7]=this['omit'](_0x3459e4[_0x23dcd7],_0x49250a);}return _0x3459e4;}if(!_['isObject'](_0x3459e4)){return _0x3459e4;}if(_[_0xcded('0x20')](_0x49250a)){_0x49250a=[_0x49250a];}if(!_[_0xcded('0x16')](_0x49250a)){return _0x3459e4;}for(var _0x1d9f29=0x0;_0x1d9f29<_0x49250a[_0xcded('0x21')];_0x1d9f29+=0x1){_[_0xcded('0x22')](_0x3459e4,_0x49250a[_0x1d9f29]);}for(var _0x2f5e02 in _0x3459e4){if(_0x3459e4['hasOwnProperty'](_0x2f5e02)){_0x3459e4[_0x2f5e02]=this[_0xcded('0x23')](_0x3459e4[_0x2f5e02],_0x49250a);}}return _0x3459e4;};exports['isNumeric']=function(_0x4014d6){return _0x4014d6[_0xcded('0x24')](RegExp(_0xcded('0x25')))?!![]:![];};exports[_0xcded('0x26')]=function(_0x32b3c6){return _0x32b3c6['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xcded('0x27')]=function(_0x14b9c0,_0x143cd7){var _0xa51337=[];var _0x292466=/[ `!@#$%^&*()_\-?~]/;var _0x4a8f77=_0x143cd7?_0xcded('0x28'):_0xcded('0x29');_0x14b9c0[_0xcded('0xa')](/[ ,]+/)[_0xcded('0x2a')](function(_0x4f7707){_0x4f7707=_0x4f7707['replace'](/([^:]")"+/g,'$1');_0x4f7707='+'+_0x4f7707+'*';var _0x13b70c=_0x4f7707[_0xcded('0x24')](_0x292466);if(_0x13b70c){_0x4f7707='\x22'+_0x4f7707+'\x22';}_0xa51337['push'](_0x4f7707);});_0x4a8f77=_0x4a8f77[_0xcded('0x2b')](_0xcded('0x29'),_0xa51337[_0xcded('0x2c')]('\x20'));return _0x4a8f77;};exports[_0xcded('0x2d')]=function(_0x25b6fa,_0x2e3d2f,_0x2acbbb){var _0x5dfc8d={},_0x33c306={};if(_0x2e3d2f[_0xcded('0x2e')][_0xcded('0x2f')]){_0x2e3d2f['query']['id']=_0x2e3d2f[_0xcded('0x2e')][_0xcded('0x2f')];delete _0x2e3d2f[_0xcded('0x2e')][_0xcded('0x2f')];}_0x5dfc8d[_0xcded('0x30')]=_[_0xcded('0x1a')](_0x25b6fa,_0xcded('0x15'));_0x5dfc8d[_0xcded('0x2e')]=_[_0xcded('0x4')](_0x2e3d2f[_0xcded('0x2e')]);_0x5dfc8d['filters']=_[_0xcded('0x31')](_0x5dfc8d[_0xcded('0x30')],_0x5dfc8d['query']);_0x33c306['attributes']=_[_0xcded('0x31')](_0x5dfc8d[_0xcded('0x30')],this[_0xcded('0x8')](_0x2e3d2f[_0xcded('0x2e')][_0xcded('0x8')]));_0x33c306[_0xcded('0x32')]=_0x33c306['attributes'][_0xcded('0x21')]?_0x33c306[_0xcded('0x32')]:_0x5dfc8d[_0xcded('0x30')];if(!_0x2e3d2f[_0xcded('0x2e')][_0xcded('0x33')](_0xcded('0x34'))){_0x33c306[_0xcded('0x17')]=this[_0xcded('0x17')](_0x2e3d2f[_0xcded('0x2e')]['limit']);_0x33c306['offset']=this['offset'](_0x2e3d2f[_0xcded('0x2e')][_0xcded('0x18')]);}_0x33c306['order']=this[_0xcded('0x19')](_0x2e3d2f['query']['sort']);_0x33c306[_0xcded('0x35')]=this[_0xcded('0xb')](_[_0xcded('0x36')](_0x2e3d2f[_0xcded('0x2e')],_0x5dfc8d[_0xcded('0xb')]),_0x25b6fa);if(_0x2e3d2f['query']['filter']){var _0x845c97=_0x25b6fa;var _0x2cd565=_0x2e3d2f[_0xcded('0x2e')]['filter'];if(typeof _0x2cd565===_0xcded('0x37')){_0x845c97=_[_0xcded('0x38')](_0x25b6fa,function(_0x331105){return _[_0xcded('0x5')](_0x2cd565[_0xcded('0x39')],_0x331105[_0xcded('0x15')]);});_0x2cd565=_0x2cd565['value'];}_0x33c306[_0xcded('0x35')]=_['merge'](_0x33c306[_0xcded('0x35')],{'$or':_['map'](_0x845c97,function(_0x13c6e2){if(_0x13c6e2[_0xcded('0xf')]!==_0xcded('0x3a')){if(_0x2acbbb){return sequelize['where'](sequelize['fn'](_0xcded('0x3b'),sequelize[_0xcded('0x1d')](_0x13c6e2[_0xcded('0x15')])),{'$like':sequelize['fn']('lower','%'+_0x2e3d2f[_0xcded('0x2e')][_0xcded('0x38')]+'%')});}else{var _0x5d9ab0={};_0x5d9ab0[_0x13c6e2[_0xcded('0x15')]]={'$like':'%'+_0x2e3d2f[_0xcded('0x2e')]['filter']+'%'};return _0x5d9ab0;}}})});}_0x33c306=_[_0xcded('0x3c')]({},_0x33c306,_0x2e3d2f[_0xcded('0x3d')]);return _0x33c306;};exports[_0xcded('0x3e')]=function(_0xb0ceee){var _0x3061e2=[];if(_0xb0ceee[_0xcded('0x3f')]){_0x3061e2[_0xcded('0x40')]({'all':!![]});}else if(_0xb0ceee[_0xcded('0x3e')]){if(Array['isArray'](_0xb0ceee[_0xcded('0x3e')])){_0x3061e2=Object['keys'](_0xb0ceee[_0xcded('0x3e')])[_0xcded('0x1a')](function(_0x438925){return parseIncludeModel(_0xb0ceee['include'][_0x438925]);});}else{var _0x3ba5d8=parseIncludeModel(_0xb0ceee[_0xcded('0x3e')]);_0x3061e2[_0xcded('0x40')](_0x3ba5d8);}}return _0x3061e2;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index f115c14..8daa5ba 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 _0x1280=['findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','filter','User','findAll','name','openchannelPause','smsPause','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','substring','indexOf','fullname','internal','validateSortParameter','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','online','omit','pick','filterAgentAttributes','role','faxStatus','whatsappStatusTime','mailCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','voicePause','whatsappPause','every','length','idle','unknown','isNil','voiceStatus','pause','chatStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','*pause','busy','getAgentStatus','Queue','map'];(function(_0x3572cb,_0x4149d3){var _0x33a398=function(_0x163e27){while(--_0x163e27){_0x3572cb['push'](_0x3572cb['shift']());}};_0x33a398(++_0x4149d3);}(_0x1280,0xac));var _0x0128=function(_0x34f0fb,_0x3323b2){_0x34f0fb=_0x34f0fb-0x0;var _0x9b7b2b=_0x1280[_0x34f0fb];return _0x9b7b2b;};'use strict';var _=require(_0x0128('0x0'));var jayson=require('jayson/promise');var db=require(_0x0128('0x1'))['db'];var amiClient=jayson[_0x0128('0x2')][_0x0128('0x3')]({'port':0x232a});var routingClient=jayson[_0x0128('0x2')][_0x0128('0x3')]({'port':0x232c});function isAgentPaused(_0x33b978,_0x4bd1f3){var _0x37b58b=[_0x33b978[_0x0128('0x4')],_0x33b978[_0x0128('0x5')],_0x33b978[_0x0128('0x6')],_0x33b978['openchannelPause'],_0x33b978['smsPause'],_0x33b978[_0x0128('0x7')],_0x33b978[_0x0128('0x8')]];if(!_0x4bd1f3)return _[_0x0128('0x9')](_0x37b58b);var _0x43a105=_['filter'](_0x37b58b);return _0x43a105[_0x0128('0xa')]>0x0&&_0x43a105[_0x0128('0xa')]<_0x37b58b['length']?!![]:![];}function isIdle(_0x1ac826){return _0x1ac826===_0x0128('0xb')||_0x1ac826===_0x0128('0xc')||_0x1ac826==='unavailable'||_0x1ac826==='ringing'||_[_0x0128('0xd')](_0x1ac826);}function isAgentIdle(_0x404cb2){if(_0x404cb2[_0x0128('0xe')]!=='idle'&&_0x404cb2[_0x0128('0x7')]){_0x404cb2['voiceStatus']=_0x0128('0xf');return![];}return _['every']([_0x404cb2[_0x0128('0x10')],_0x404cb2['faxStatus'],_0x404cb2[_0x0128('0x11')],_0x404cb2['openchannelStatus'],_0x404cb2[_0x0128('0x12')],_0x404cb2[_0x0128('0xe')],_0x404cb2[_0x0128('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x0128('0x14')](_0x0128('0x15'),{})[_0x0128('0x16')](function(_0x59a472){if(_0x59a472[_0x0128('0x17')]){throw new Error(_0x0128('0x18'));}var _0x3300d4=_0x59a472[_0x0128('0x19')];return routingClient[_0x0128('0x14')](_0x0128('0x15'),{})['then'](function(_0x2524b1){if(_0x2524b1[_0x0128('0x17')]){throw new Error(_0x0128('0x1a'));}var _0x431b13=_0x2524b1[_0x0128('0x19')];return _[_0x0128('0x1b')]({},_0x3300d4,_0x431b13);});})['catch'](function(_0x172c33){throw _0x172c33;});}exports[_0x0128('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x5d946e){var _0x4ad121=_0x0128('0xc');if(isAgentPaused(_0x5d946e))_0x4ad121=_0x0128('0xf');else if(isAgentPaused(_0x5d946e,!![]))_0x4ad121=_0x0128('0x1d');else if(isAgentIdle(_0x5d946e))_0x4ad121=_0x0128('0xb');else _0x4ad121=_0x0128('0x1e');return _0x4ad121;}exports[_0x0128('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x10b436,_0x167c33){var _0x544f5c=_['isArray'](_0x10b436)?_0x10b436:[_0x10b436];var _0x1ce8fc=_['startCase'](_0x167c33)+_0x0128('0x20');var _0x33354b=_[_0x0128('0x21')](_0x544f5c,function(_0x47d79d){return db[_0x1ce8fc][_0x0128('0x22')]({'where':{'id':_0x47d79d}})['then'](function(_0x170f4b){if(!_0x170f4b)return[];return _0x170f4b[_0x0128('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x0128('0x24')](_0x33354b)[_0x0128('0x16')](function(_0x4b0f88){var _0x545a05=_(_0x4b0f88)[_0x0128('0x25')]()[_0x0128('0x21')]('id')['uniq']()[_0x0128('0x26')]();return _0x545a05;});}exports[_0x0128('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4ee634,_0xb6e133,_0x1e98a2){try{if(_0xb6e133[_0x0128('0xa')]>0x0){_0x4ee634=_0x4ee634['filter'](function(_0x5b7ab2){return _0xb6e133[_0x0128('0x28')](_0x5b7ab2['id']);});}var _0x586310=_0x4ee634['filter'](function(_0x5f07c7){var _0x28b27c='busy';if(isAgentIdle(_0x5f07c7)){_0x28b27c=_0x0128('0xb');}return _0x28b27c===_0x1e98a2;});return _[_0x0128('0x21')](_0x586310,'id');}catch(_0x345023){throw _0x345023;}}exports[_0x0128('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5a021f,_0x24dad5,_0x1cc531){return Promise[_0x0128('0x2a')]()[_0x0128('0x16')](function(){if(_0x24dad5['length']>0x0){_0x5a021f=_0x5a021f[_0x0128('0x2b')](function(_0x40b088){return _0x24dad5[_0x0128('0x28')](_0x40b088['id']);});}return _0x5a021f;})[_0x0128('0x16')](function(){return db[_0x0128('0x2c')][_0x0128('0x2d')]({'attributes':['id',_0x0128('0x2e'),'fullname','chatPause','faxPause',_0x0128('0x6'),_0x0128('0x2f'),_0x0128('0x30'),'voicePause',_0x0128('0x8'),'pauseType'],'where':{'id':{'$in':_[_0x0128('0x21')](_0x5a021f,'id')}},'raw':!![]});})[_0x0128('0x16')](function(_0x3aaf39){return _0x3aaf39[_0x0128('0x21')](function(_0x5ab89b){var _0x5b354e=_[_0x0128('0x31')](_0x5a021f,['id',_0x5ab89b['id']]);var _0x15742b=filterAgentAttributes(_0x5b354e);_[_0x0128('0x1b')](_0x5ab89b,_0x15742b);_0x5ab89b[_0x0128('0x32')]=getAgentStatus(_0x5ab89b);return _0x5ab89b;});})['then'](function(_0x4de8dc){var _0x2a534b=sortAgentsByStatus(_0x4de8dc,_0x1cc531);return _[_0x0128('0x21')](_0x2a534b,'id');})[_0x0128('0x33')](function(_0xc7a20){throw _0xc7a20;});}exports[_0x0128('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x478d57){var _0xe72ce4={'fields':[],'order':null};var _0x39f32d=_0x478d57[_0x0128('0x35')](',');_0xe72ce4['fields']=_['filter'](_0x39f32d,function(_0x5d5eba){if(!_0x5d5eba[_0x0128('0x28')](_0x0128('0x32'))){return!![];}_0xe72ce4[_0x0128('0x36')]=_[_0x0128('0x37')](_0x5d5eba,'-')?'DESC':_0x0128('0x38');return![];});return _0xe72ce4;}exports[_0x0128('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x544664){if(!_0x544664){_0x544664=_0x0128('0x3a');}if(_0x544664[_0x0128('0x28')]('fullname')&&!_0x544664[_0x0128('0x28')]('internal')){var _0x1fe8c8=_0x544664[_0x0128('0x3b')](0x0,_0x544664[_0x0128('0x3c')](_0x0128('0x3d')));_0x544664+=','+_0x1fe8c8+_0x0128('0x3e');}return _0x544664;}exports[_0x0128('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x5bf361,_0x57fa59){var _0x41c500=_0x5bf361['sort'](function(_0x4ab4f3,_0x2b9c3b){if(_0x4ab4f3['globalStatus']===_0x2b9c3b[_0x0128('0x32')]){if(_0x4ab4f3[_0x0128('0x32')]===_0x0128('0xf')){if(_0x57fa59===_0x0128('0x40')){return(_0x4ab4f3[_0x0128('0x41')]||'')<(_0x2b9c3b[_0x0128('0x41')]||'')||_0x4ab4f3[_0x0128('0x3d')][_0x0128('0x42')]()>_0x2b9c3b[_0x0128('0x3d')][_0x0128('0x42')]()?0x1:-0x1;}else{return(_0x4ab4f3[_0x0128('0x41')]||'')<(_0x2b9c3b[_0x0128('0x41')]||'')||_0x4ab4f3[_0x0128('0x3d')]['toLowerCase']()>_0x2b9c3b[_0x0128('0x3d')][_0x0128('0x42')]()?-0x1:0x1;}}else{if(_0x57fa59==='DESC'){return _0x4ab4f3[_0x0128('0x3d')][_0x0128('0x42')]()<_0x2b9c3b[_0x0128('0x3d')][_0x0128('0x42')]()?0x1:-0x1;}else{return _0x4ab4f3[_0x0128('0x3d')]['toLowerCase']()<_0x2b9c3b[_0x0128('0x3d')][_0x0128('0x42')]()?-0x1:0x1;}}}else{if(_0x57fa59===_0x0128('0x40')){return _0x4ab4f3[_0x0128('0x32')]<_0x2b9c3b[_0x0128('0x32')]?0x1:-0x1;}else{return _0x4ab4f3[_0x0128('0x32')]<_0x2b9c3b[_0x0128('0x32')]?-0x1:0x1;}}});return _0x41c500;}exports[_0x0128('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x1915a1){var _0x5d4668=[_0x0128('0x44'),'online',_0x0128('0x45'),_0x0128('0x46'),_0x0128('0x41'),_0x0128('0x46'),_0x0128('0x3e'),_0x0128('0x47'),_0x0128('0x4'),_0x0128('0x2f'),'mailPause','smsPause',_0x0128('0x8'),_0x0128('0x5'),'voicePause',_0x0128('0x48'),_0x0128('0x49'),'mailCapacity',_0x0128('0x4a'),_0x0128('0x4b'),_0x0128('0x4c'),_0x0128('0x4d'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x0128('0x4e'),'whatsappCurrentCapacity',_0x0128('0x4f'),'chatStatus',_0x0128('0x50'),_0x0128('0x11'),_0x0128('0x12'),_0x0128('0x13'),'faxStatus',_0x0128('0xe'),_0x0128('0x51'),_0x0128('0x52'),_0x0128('0x53'),_0x0128('0x54'),'whatsappStatusTime',_0x0128('0x55'),_0x0128('0x56'),_0x0128('0x57'),_0x0128('0x58'),_0x0128('0x59'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording'];var _0x7531e=['chatPause',_0x0128('0x2f'),'mailPause',_0x0128('0x30'),_0x0128('0x8'),'faxPause','voicePause',_0x0128('0x5a')];var _0x13aaa3=_(_0x1915a1)[_0x0128('0x5b')](_0x7531e)[_0x0128('0x5c')](_0x5d4668)['value']();return _0x13aaa3;}exports[_0x0128('0x5d')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x0128('0x2e'),_0x0128('0x3d'),_0x0128('0x5e'),_0x0128('0x3e'),'online','globalStatus',_0x0128('0x44'),_0x0128('0x45'),'pauseType',_0x0128('0x46'),_0x0128('0x5'),'chatPause',_0x0128('0x6'),_0x0128('0x2f'),_0x0128('0x30'),_0x0128('0x7'),_0x0128('0x8'),_0x0128('0x10'),_0x0128('0x5f'),'mailStatus','openchannelStatus',_0x0128('0x12'),_0x0128('0xe'),_0x0128('0x13'),_0x0128('0x51'),_0x0128('0x55'),_0x0128('0x53'),_0x0128('0x52'),_0x0128('0x54'),_0x0128('0x56'),_0x0128('0x60'),_0x0128('0x48'),'faxCapacity',_0x0128('0x61'),_0x0128('0x49'),_0x0128('0x4a'),_0x0128('0x4b'),_0x0128('0x4d'),'faxCurrentCapacity','mailCurrentCapacity','openchannelCurrentCapacity',_0x0128('0x4e'),_0x0128('0x62'),_0x0128('0x63'),_0x0128('0x64'),_0x0128('0x58'),_0x0128('0x65'),'queue',_0x0128('0x59')];}exports[_0x0128('0x66')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x72fa=['phoneBarEnableAutomaticScreenRecording','omit','pick','value','filterAgentAttributes','role','online','openchannelStatusTime','chatCurrentCapacity','openchannelCurrentCapacity','whatsappCurrentCapacity','destconnectedlinenum','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','unknown','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','getAgentIdsByQueues','getAgentIdsByStatus','resolve','User','findAll','name','fullname','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','includes','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent'];(function(_0x15f1ae,_0x23754b){var _0x229072=function(_0x601020){while(--_0x601020){_0x15f1ae['push'](_0x15f1ae['shift']());}};_0x229072(++_0x23754b);}(_0x72fa,0x78));var _0xa72f=function(_0x495f0b,_0x499f83){_0x495f0b=_0x495f0b-0x0;var _0xef44be=_0x72fa[_0x495f0b];return _0xef44be;};'use strict';var _=require(_0xa72f('0x0'));var jayson=require(_0xa72f('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xa72f('0x2')][_0xa72f('0x3')]({'port':0x232a});var routingClient=jayson[_0xa72f('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x5759b7,_0x2c392d){var _0x220db5=[_0x5759b7[_0xa72f('0x4')],_0x5759b7[_0xa72f('0x5')],_0x5759b7[_0xa72f('0x6')],_0x5759b7[_0xa72f('0x7')],_0x5759b7[_0xa72f('0x8')],_0x5759b7[_0xa72f('0x9')],_0x5759b7[_0xa72f('0xa')]];if(!_0x2c392d)return _[_0xa72f('0xb')](_0x220db5);var _0x57d4fa=_[_0xa72f('0xc')](_0x220db5);return _0x57d4fa[_0xa72f('0xd')]>0x0&&_0x57d4fa[_0xa72f('0xd')]<_0x220db5['length']?!![]:![];}function isIdle(_0x4691c8){return _0x4691c8===_0xa72f('0xe')||_0x4691c8==='unknown'||_0x4691c8===_0xa72f('0xf')||_0x4691c8===_0xa72f('0x10')||_[_0xa72f('0x11')](_0x4691c8);}function isAgentIdle(_0x2da16b){if(_0x2da16b[_0xa72f('0x12')]!==_0xa72f('0xe')&&_0x2da16b[_0xa72f('0x9')]){_0x2da16b[_0xa72f('0x12')]=_0xa72f('0x13');return![];}return _[_0xa72f('0xb')]([_0x2da16b[_0xa72f('0x14')],_0x2da16b[_0xa72f('0x15')],_0x2da16b['mailStatus'],_0x2da16b[_0xa72f('0x16')],_0x2da16b[_0xa72f('0x17')],_0x2da16b[_0xa72f('0x12')],_0x2da16b['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xa72f('0x18')]('Agents',{})[_0xa72f('0x19')](function(_0x661032){if(_0x661032['error']){throw new Error(_0xa72f('0x1a'));}var _0x23b1ec=_0x661032[_0xa72f('0x1b')];return routingClient[_0xa72f('0x18')]('Agents',{})[_0xa72f('0x19')](function(_0x79d7a){if(_0x79d7a[_0xa72f('0x1c')]){throw new Error(_0xa72f('0x1d'));}var _0x59b62a=_0x79d7a[_0xa72f('0x1b')];return _[_0xa72f('0x1e')]({},_0x23b1ec,_0x59b62a);});})[_0xa72f('0x1f')](function(_0x236a62){throw _0x236a62;});}exports[_0xa72f('0x20')]=getRealtimeAgents;function getAgentStatus(_0x29b16b){var _0x4d1de4=_0xa72f('0x21');if(isAgentPaused(_0x29b16b))_0x4d1de4='pause';else if(isAgentPaused(_0x29b16b,!![]))_0x4d1de4=_0xa72f('0x22');else if(isAgentIdle(_0x29b16b))_0x4d1de4=_0xa72f('0xe');else _0x4d1de4='busy';return _0x4d1de4;}exports[_0xa72f('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x2eaf9c,_0x355740){var _0x284f22=_[_0xa72f('0x24')](_0x2eaf9c)?_0x2eaf9c:[_0x2eaf9c];var _0x19f8f4=_[_0xa72f('0x25')](_0x355740)+_0xa72f('0x26');var _0x1e3af9=_[_0xa72f('0x27')](_0x284f22,function(_0x5bad19){return db[_0x19f8f4][_0xa72f('0x28')]({'where':{'id':_0x5bad19}})[_0xa72f('0x19')](function(_0x382cce){if(!_0x382cce)return[];return _0x382cce[_0xa72f('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xa72f('0x2a')](_0x1e3af9)['then'](function(_0x38d8f9){var _0x1974ea=_(_0x38d8f9)[_0xa72f('0x2b')]()[_0xa72f('0x27')]('id')['uniq']()['value']();return _0x1974ea;});}exports[_0xa72f('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x51e4e4,_0x21f4d9,_0x25a618){try{if(_0x21f4d9[_0xa72f('0xd')]>0x0){_0x51e4e4=_0x51e4e4[_0xa72f('0xc')](function(_0xc99fec){return _0x21f4d9['includes'](_0xc99fec['id']);});}var _0x259a9a=_0x51e4e4[_0xa72f('0xc')](function(_0x9233c9){var _0x50a624='busy';if(isAgentIdle(_0x9233c9)){_0x50a624=_0xa72f('0xe');}return _0x50a624===_0x25a618;});return _[_0xa72f('0x27')](_0x259a9a,'id');}catch(_0x4c1eff){throw _0x4c1eff;}}exports[_0xa72f('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2216ce,_0x3206ab,_0x4e677f){return Promise[_0xa72f('0x2e')]()['then'](function(){if(_0x3206ab[_0xa72f('0xd')]>0x0){_0x2216ce=_0x2216ce['filter'](function(_0x142dfd){return _0x3206ab['includes'](_0x142dfd['id']);});}return _0x2216ce;})[_0xa72f('0x19')](function(){return db[_0xa72f('0x2f')][_0xa72f('0x30')]({'attributes':['id',_0xa72f('0x31'),_0xa72f('0x32'),'chatPause',_0xa72f('0x5'),_0xa72f('0x6'),_0xa72f('0x7'),_0xa72f('0x8'),_0xa72f('0x9'),_0xa72f('0xa'),_0xa72f('0x33')],'where':{'id':{'$in':_[_0xa72f('0x27')](_0x2216ce,'id')}},'raw':!![]});})[_0xa72f('0x19')](function(_0x5061ce){return _0x5061ce[_0xa72f('0x27')](function(_0x4b4069){var _0x5ef6a7=_[_0xa72f('0x34')](_0x2216ce,['id',_0x4b4069['id']]);var _0x465c81=filterAgentAttributes(_0x5ef6a7);_[_0xa72f('0x1e')](_0x4b4069,_0x465c81);_0x4b4069[_0xa72f('0x35')]=getAgentStatus(_0x4b4069);return _0x4b4069;});})[_0xa72f('0x19')](function(_0xeba90b){var _0x558abb=sortAgentsByStatus(_0xeba90b,_0x4e677f);return _[_0xa72f('0x27')](_0x558abb,'id');})[_0xa72f('0x1f')](function(_0x59562b){throw _0x59562b;});}exports[_0xa72f('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x486055){var _0x42a306={'fields':[],'order':null};var _0x3e8ab4=_0x486055[_0xa72f('0x37')](',');_0x42a306[_0xa72f('0x38')]=_[_0xa72f('0xc')](_0x3e8ab4,function(_0x32301b){if(!_0x32301b['includes'](_0xa72f('0x35'))){return!![];}_0x42a306[_0xa72f('0x39')]=_[_0xa72f('0x3a')](_0x32301b,'-')?_0xa72f('0x3b'):_0xa72f('0x3c');return![];});return _0x42a306;}exports[_0xa72f('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0x5cb1f0){if(!_0x5cb1f0){_0x5cb1f0='fullname,internal';}if(_0x5cb1f0[_0xa72f('0x3e')](_0xa72f('0x32'))&&!_0x5cb1f0['includes'](_0xa72f('0x3f'))){var _0x5d2ec0=_0x5cb1f0[_0xa72f('0x40')](0x0,_0x5cb1f0[_0xa72f('0x41')](_0xa72f('0x32')));_0x5cb1f0+=','+_0x5d2ec0+_0xa72f('0x3f');}return _0x5cb1f0;}exports[_0xa72f('0x42')]=validateSortParameter;function sortAgentsByStatus(_0xa53025,_0x29a11f){var _0x3c667e=_0xa53025[_0xa72f('0x43')](function(_0x395154,_0x17c079){if(_0x395154[_0xa72f('0x35')]===_0x17c079['globalStatus']){if(_0x395154['globalStatus']===_0xa72f('0x13')){if(_0x29a11f==='DESC'){return(_0x395154[_0xa72f('0x33')]||'')<(_0x17c079[_0xa72f('0x33')]||'')||_0x395154['fullname']['toLowerCase']()>_0x17c079[_0xa72f('0x32')]['toLowerCase']()?0x1:-0x1;}else{return(_0x395154[_0xa72f('0x33')]||'')<(_0x17c079['pauseType']||'')||_0x395154[_0xa72f('0x32')][_0xa72f('0x44')]()>_0x17c079[_0xa72f('0x32')][_0xa72f('0x44')]()?-0x1:0x1;}}else{if(_0x29a11f===_0xa72f('0x3b')){return _0x395154[_0xa72f('0x32')][_0xa72f('0x44')]()<_0x17c079[_0xa72f('0x32')][_0xa72f('0x44')]()?0x1:-0x1;}else{return _0x395154[_0xa72f('0x32')]['toLowerCase']()<_0x17c079['fullname'][_0xa72f('0x44')]()?-0x1:0x1;}}}else{if(_0x29a11f==='DESC'){return _0x395154[_0xa72f('0x35')]<_0x17c079[_0xa72f('0x35')]?0x1:-0x1;}else{return _0x395154['globalStatus']<_0x17c079[_0xa72f('0x35')]?-0x1:0x1;}}});return _0x3c667e;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x382d22){var _0x5d3a64=[_0xa72f('0x45'),'online',_0xa72f('0x46'),_0xa72f('0x47'),_0xa72f('0x33'),'lastPauseAt',_0xa72f('0x3f'),_0xa72f('0x48'),_0xa72f('0x4'),_0xa72f('0x7'),_0xa72f('0x6'),_0xa72f('0x8'),_0xa72f('0xa'),_0xa72f('0x5'),'voicePause',_0xa72f('0x49'),_0xa72f('0x4a'),_0xa72f('0x4b'),_0xa72f('0x4c'),_0xa72f('0x4d'),_0xa72f('0x4e'),'chatCurrentCapacity','openchannelCurrentCapacity',_0xa72f('0x4f'),_0xa72f('0x50'),'whatsappCurrentCapacity',_0xa72f('0x51'),_0xa72f('0x14'),_0xa72f('0x16'),_0xa72f('0x52'),_0xa72f('0x17'),_0xa72f('0x53'),_0xa72f('0x15'),'voiceStatus',_0xa72f('0x54'),'openchannelStatusTime',_0xa72f('0x55'),_0xa72f('0x56'),_0xa72f('0x57'),_0xa72f('0x58'),'voiceStatusTime',_0xa72f('0x59'),'destconnectedlinenum',_0xa72f('0x5a'),_0xa72f('0x5b'),_0xa72f('0x5c')];var _0x3347bb=[_0xa72f('0x4'),'openchannelPause',_0xa72f('0x6'),_0xa72f('0x8'),_0xa72f('0xa'),_0xa72f('0x5'),_0xa72f('0x9'),'online'];var _0x4e8bf7=_(_0x382d22)[_0xa72f('0x5d')](_0x3347bb)[_0xa72f('0x5e')](_0x5d3a64)[_0xa72f('0x5f')]();return _0x4e8bf7;}exports[_0xa72f('0x60')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xa72f('0x31'),_0xa72f('0x32'),_0xa72f('0x61'),_0xa72f('0x3f'),_0xa72f('0x62'),'globalStatus',_0xa72f('0x45'),'lastLoginAt',_0xa72f('0x33'),_0xa72f('0x47'),'faxPause',_0xa72f('0x4'),_0xa72f('0x6'),_0xa72f('0x7'),_0xa72f('0x8'),'voicePause',_0xa72f('0xa'),_0xa72f('0x14'),_0xa72f('0x15'),'mailStatus',_0xa72f('0x16'),_0xa72f('0x17'),'voiceStatus',_0xa72f('0x53'),_0xa72f('0x54'),_0xa72f('0x58'),_0xa72f('0x55'),_0xa72f('0x63'),'smsStatusTime','voiceStatusTime',_0xa72f('0x57'),_0xa72f('0x49'),_0xa72f('0x4e'),'mailCapacity',_0xa72f('0x4a'),_0xa72f('0x4c'),_0xa72f('0x4d'),_0xa72f('0x64'),_0xa72f('0x51'),_0xa72f('0x4f'),_0xa72f('0x65'),_0xa72f('0x50'),_0xa72f('0x66'),'phoneBarEnableScreenRecordingByAgent',_0xa72f('0x5c'),_0xa72f('0x67'),_0xa72f('0x68'),_0xa72f('0x59'),_0xa72f('0x5a')];}exports[_0xa72f('0x69')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 871a449..ea9714c 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 _0xbe13=['startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','concat','outbound','map','talking','find','merge','pick','lodash','jayson/promise','util','http','available','loggedIn','paused','waiting','busy','inUse','loggedInDb','onHold','ringing','ringInUse','unavailable','pTalking','originated','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbe13,0x1d0));var _0x3be1=function(_0x3b06fc,_0x4203dc){_0x3b06fc=_0x3b06fc-0x0;var _0x2e74f3=_0xbe13[_0x3b06fc];return _0x2e74f3;};'use strict';var _=require(_0x3be1('0x0'));var jayson=require(_0x3be1('0x1'));var util=require(_0x3be1('0x2'));var amiClient=jayson['client'][_0x3be1('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x3be1('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x3be1('0x4'),_0x3be1('0x5'),_0x3be1('0x6'),_0x3be1('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x3be1('0x8'),_0x3be1('0x9'),'invalid',_0x3be1('0xa'),'notInUse',_0x3be1('0xb'),_0x3be1('0xc'),_0x3be1('0xd'),'talking',_0x3be1('0xe'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x3be1('0xf'),_0x3be1('0x10'),'message',_0x3be1('0x11'),_0x3be1('0x12'),_0x3be1('0x13'),_0x3be1('0x14'),'startPredictive',_0x3be1('0x15'),_0x3be1('0x16'),_0x3be1('0x17'),_0x3be1('0x18'),_0x3be1('0x19'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x3be1('0x1a'),_0x3be1('0x1b'),_0x3be1('0x1c'),_0x3be1('0x1d'),_0x3be1('0x1e'),_0x3be1('0x1f'),_0x3be1('0x20'),_0x3be1('0x21')];function getRealtimeQueues(_0xfe574,_0x1f7ab1){var _0x1cc063=_0x1f7ab1===_0x3be1('0x22')?amiClient:routingClient;return _0x1cc063[_0x3be1('0x23')](_[_0x3be1('0x24')](_0x1f7ab1)+_0x3be1('0x25'),_0xfe574)[_0x3be1('0x26')](function(_0x40ccb2){if(_0x40ccb2[_0x3be1('0x27')])throw new Error(util['format'](_0x3be1('0x28'),_0x1f7ab1));return _0x40ccb2[_0x3be1('0x29')];})['catch'](function(_0x1faa4a){throw _0x1faa4a;});}exports[_0x3be1('0x2a')]=getRealtimeQueues;function initializeQueues(_0x11d67e,_0x3c6f1f,_0x3dfa4c,_0x2261f8){var _0x1739f5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3dfa4c==='voice'){if(_0x2261f8==='inbound'){_0x1739f5=_0x1739f5[_0x3be1('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2261f8===_0x3be1('0x2c')){_0x1739f5=_0x1739f5['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x11d67e[_0x3be1('0x2d')](function(_0x426a51){var _0x10b5b5=_0x426a51['get']({'plain':!![]});_0x10b5b5[_0x3be1('0x6')]=0x0;_0x10b5b5[_0x3be1('0xa')]=0x0;_0x10b5b5[_0x3be1('0x5')]=0x0;_0x10b5b5[_0x3be1('0x4')]=0x0;_0x10b5b5[_0x3be1('0x7')]=0x0;if(_0x3dfa4c===_0x3be1('0x22')){_0x10b5b5[_0x3be1('0x2e')]=0x0;_0x10b5b5[_0x3be1('0x8')]=0x0;if(_0x2261f8===_0x3be1('0x2c')){_0x10b5b5[_0x3be1('0xf')]=0x0;_0x10b5b5[_0x3be1('0x10')]=0x0;}}var _0x23a43d=_[_0x3be1('0x2f')](_0x3c6f1f,['id',_0x10b5b5['id']]);if(_0x23a43d){_[_0x3be1('0x30')](_0x10b5b5,_[_0x3be1('0x31')](_0x23a43d,_0x1739f5));}return _0x10b5b5;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x319f=['unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','talking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringInUse','unavailable'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x319f,0x11c));var _0xf319=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x319f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf319('0x0'));var jayson=require(_0xf319('0x1'));var util=require(_0xf319('0x2'));var amiClient=jayson[_0xf319('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xf319('0x3')][_0xf319('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xf319('0x5'),_0xf319('0x6'),_0xf319('0x7'),_0xf319('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xf319('0x9'),_0xf319('0xa'),_0xf319('0xb'),_0xf319('0xc'),'notInUse',_0xf319('0xd'),'ringing',_0xf319('0xe'),'talking',_0xf319('0xf'),_0xf319('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xf319('0x11'),_0xf319('0x12'),_0xf319('0x13'),_0xf319('0x14'),_0xf319('0x15'),_0xf319('0x16'),_0xf319('0x17'),_0xf319('0x18'),_0xf319('0x19'),_0xf319('0x1a'),_0xf319('0x1b'),_0xf319('0x1c'),_0xf319('0x1d'),_0xf319('0x1e'),_0xf319('0x1f'),_0xf319('0x20'),_0xf319('0x21'),'predictiveIntervalTotalCalls',_0xf319('0x22'),_0xf319('0x23'),_0xf319('0x24'),_0xf319('0x25'),_0xf319('0x26')];function getRealtimeQueues(_0x14698e,_0x43007e){var _0x36fe3b=_0x43007e===_0xf319('0x27')?amiClient:routingClient;return _0x36fe3b[_0xf319('0x28')](_[_0xf319('0x29')](_0x43007e)+_0xf319('0x2a'),_0x14698e)[_0xf319('0x2b')](function(_0x3b25d5){if(_0x3b25d5[_0xf319('0x2c')])throw new Error(util[_0xf319('0x2d')](_0xf319('0x2e'),_0x43007e));return _0x3b25d5[_0xf319('0x2f')];})[_0xf319('0x30')](function(_0x36c92e){throw _0x36c92e;});}exports[_0xf319('0x31')]=getRealtimeQueues;function initializeQueues(_0x3162b5,_0x4035ef,_0xc1df5f,_0x31ee48){var _0x1a2bbb=DEFAULT_QUEUE_ATTRIBUTES;if(_0xc1df5f==='voice'){if(_0x31ee48===_0xf319('0x32')){_0x1a2bbb=_0x1a2bbb[_0xf319('0x33')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x31ee48===_0xf319('0x34')){_0x1a2bbb=_0x1a2bbb[_0xf319('0x33')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3162b5[_0xf319('0x35')](function(_0xd4fcc){var _0x40c4ce=_0xd4fcc[_0xf319('0x36')]({'plain':!![]});_0x40c4ce[_0xf319('0x7')]=0x0;_0x40c4ce[_0xf319('0xc')]=0x0;_0x40c4ce['loggedIn']=0x0;_0x40c4ce[_0xf319('0x5')]=0x0;_0x40c4ce['waiting']=0x0;if(_0xc1df5f==='voice'){_0x40c4ce[_0xf319('0x37')]=0x0;_0x40c4ce[_0xf319('0x9')]=0x0;if(_0x31ee48==='outbound'){_0x40c4ce['pTalking']=0x0;_0x40c4ce[_0xf319('0x12')]=0x0;}}var _0xcee356=_[_0xf319('0x38')](_0x4035ef,['id',_0x40c4ce['id']]);if(_0xcee356){_[_0xf319('0x39')](_0x40c4ce,_[_0xf319('0x3a')](_0xcee356,_0x1a2bbb));}return _0x40c4ce;});}exports[_0xf319('0x3b')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b1388e0..4957ac0 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(_0x22ac92,_0x5b15e8){var _0x489cde=function(_0xa927cf){while(--_0xa927cf){_0x22ac92['push'](_0x22ac92['shift']());}};_0x489cde(++_0x5b15e8);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x4a5438,_0x19aa59){var _0x35a70d=function(_0x42b805){while(--_0x42b805){_0x4a5438['push'](_0x4a5438['shift']());}};_0x35a70d(++_0x19aa59);}(_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 c291334..7f9ca05 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 _0x8f83=['update','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','substring','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5'];(function(_0x99549b,_0x37b415){var _0x2f5651=function(_0x481b00){while(--_0x481b00){_0x99549b['push'](_0x99549b['shift']());}};_0x2f5651(++_0x37b415);}(_0x8f83,0x91));var _0x38f8=function(_0x14cade,_0x45759f){_0x14cade=_0x14cade-0x0;var _0x42ad43=_0x8f83[_0x14cade];return _0x42ad43;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x38f8('0x0'));var machine=require(_0x38f8('0x1'));var exec=require('child_process')[_0x38f8('0x2')];var config=require(_0x38f8('0x3'));function getInterfaces(){var _0x4c29a6=[];var _0x297101=os[_0x38f8('0x4')]();var _0x1323a0=_[_0x38f8('0x5')](_[_0x38f8('0x6')](_0x297101));for(var _0x12ca5a=0x0;_0x12ca5a<_0x1323a0['length'];_0x12ca5a++){var _0xb55cf=_0x297101[_0x1323a0[_0x12ca5a]]['filter'](function(_0x3177df){return _0x3177df[_0x38f8('0x7')]===_0x38f8('0x8')&&_0x3177df['internal']===![];});_0x4c29a6=_0x4c29a6[_0x38f8('0x9')](_0xb55cf);}return _0x4c29a6;}function getFirstInterface(){var _0x3dea55=_['head'](getInterfaces());return{'macAddress':_0x3dea55&&_0x3dea55[_0x38f8('0xa')]?_0x3dea55['mac']:_0x38f8('0xb'),'ipAddress':_0x3dea55&&_0x3dea55[_0x38f8('0xc')]?_0x3dea55[_0x38f8('0xc')]:_0x38f8('0xd')};}exports[_0x38f8('0xe')]=getFirstInterface;function getCPUhash(){var _0x2c33ab=_[_0x38f8('0x5')](os[_0x38f8('0xf')]()[_0x38f8('0x10')](function(_0x37c8d1){return _0x37c8d1['model'];}))[_0x38f8('0x11')](':');return crypto[_0x38f8('0x12')](_0x38f8('0x13'))[_0x38f8('0x14')](_0x2c33ab)[_0x38f8('0x15')](_0x38f8('0x16'));}exports[_0x38f8('0x17')]=function(){var _0x5107a2=os[_0x38f8('0x18')]();var _0x3c7507=/[0-9a-f-]{36}/;if(config[_0x38f8('0x19')]&&_0x3c7507[_0x38f8('0x1a')](config[_0x38f8('0x19')])){return config[_0x38f8('0x19')];}else if(_0x5107a2===_0x38f8('0x1b')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x38f8('0x1c')})[_0x38f8('0x1d')]('\x0d\x0a','');}else{var _0x34fee8=getFirstInterface();var _0xd5ccf6=getCPUhash();var _0x439b7f=_0xd5ccf6+'|'+os[_0x38f8('0x1e')]()+'|'+_0x34fee8['macAddress']+'|'+_0x34fee8[_0x38f8('0x1f')];var _0x2de824=crypto[_0x38f8('0x12')](_0x38f8('0x13'))[_0x38f8('0x14')](_0x439b7f)[_0x38f8('0x15')](_0x38f8('0x16'));return _0x2de824['substring'](0x0,0x8)+'-'+_0x2de824[_0x38f8('0x20')](0x8,0xc)+'-'+_0x2de824[_0x38f8('0x20')](0xc,0x10)+'-'+_0x2de824['substring'](0x10,0x14)+'-'+_0x2de824[_0x38f8('0x20')](0x14);}}; \ No newline at end of file +var _0xfa41=['digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring','lodash','crypto','child_process','execSync','../environment','orderBy','keys','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','createHash','md5'];(function(_0x433bf8,_0x323382){var _0x5c8da9=function(_0x50367e){while(--_0x50367e){_0x433bf8['push'](_0x433bf8['shift']());}};_0x5c8da9(++_0x323382);}(_0xfa41,0xfc));var _0x1fa4=function(_0x58bda9,_0x1d7931){_0x58bda9=_0x58bda9-0x0;var _0x9ba053=_0xfa41[_0x58bda9];return _0x9ba053;};'use strict';var _=require(_0x1fa4('0x0'));var os=require('os');var crypto=require(_0x1fa4('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x1fa4('0x2'))[_0x1fa4('0x3')];var config=require(_0x1fa4('0x4'));function getInterfaces(){var _0x44f591=[];var _0x2617fd=os['networkInterfaces']();var _0x588276=_[_0x1fa4('0x5')](_[_0x1fa4('0x6')](_0x2617fd));for(var _0x1738b4=0x0;_0x1738b4<_0x588276['length'];_0x1738b4++){var _0x2776b5=_0x2617fd[_0x588276[_0x1738b4]]['filter'](function(_0x28a80d){return _0x28a80d[_0x1fa4('0x7')]===_0x1fa4('0x8')&&_0x28a80d[_0x1fa4('0x9')]===![];});_0x44f591=_0x44f591[_0x1fa4('0xa')](_0x2776b5);}return _0x44f591;}function getFirstInterface(){var _0x203a35=_['head'](getInterfaces());return{'macAddress':_0x203a35&&_0x203a35[_0x1fa4('0xb')]?_0x203a35[_0x1fa4('0xb')]:_0x1fa4('0xc'),'ipAddress':_0x203a35&&_0x203a35[_0x1fa4('0xd')]?_0x203a35[_0x1fa4('0xd')]:_0x1fa4('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x23b9f1=_['orderBy'](os[_0x1fa4('0xf')]()[_0x1fa4('0x10')](function(_0x2256ed){return _0x2256ed[_0x1fa4('0x11')];}))['join'](':');return crypto[_0x1fa4('0x12')](_0x1fa4('0x13'))['update'](_0x23b9f1)[_0x1fa4('0x14')](_0x1fa4('0x15'));}exports[_0x1fa4('0x16')]=function(){var _0x24c681=os[_0x1fa4('0x17')]();var _0x59a4a4=/[0-9a-f-]{36}/;if(config[_0x1fa4('0x18')]&&_0x59a4a4[_0x1fa4('0x19')](config['licenseToken'])){return config[_0x1fa4('0x18')];}else if(_0x24c681==='win32'){return exec(_0x1fa4('0x1a'),{'encoding':_0x1fa4('0x1b')})[_0x1fa4('0x1c')]('\x0d\x0a','');}else{var _0x2b29ef=getFirstInterface();var _0x228a49=getCPUhash();var _0x29178f=_0x228a49+'|'+os[_0x1fa4('0x1d')]()+'|'+_0x2b29ef[_0x1fa4('0x1e')]+'|'+_0x2b29ef[_0x1fa4('0x1f')];var _0x2b6f85=crypto['createHash'](_0x1fa4('0x13'))[_0x1fa4('0x20')](_0x29178f)[_0x1fa4('0x14')](_0x1fa4('0x15'));return _0x2b6f85[_0x1fa4('0x21')](0x0,0x8)+'-'+_0x2b6f85[_0x1fa4('0x21')](0x8,0xc)+'-'+_0x2b6f85['substring'](0xc,0x10)+'-'+_0x2b6f85[_0x1fa4('0x21')](0x10,0x14)+'-'+_0x2b6f85[_0x1fa4('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 56114f7..0b2a3c5 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 _0xf492=['../../components/encryptor','../logger','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','version'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xf492,0x105));var _0x2f49=function(_0x1021d9,_0x55d7fc){_0x1021d9=_0x1021d9-0x0;var _0xdfd252=_0xf492[_0x1021d9];return _0xdfd252;};'use strict';var util=require(_0x2f49('0x0'));var moment=require(_0x2f49('0x1'));var rp=require(_0x2f49('0x2'));var BPromise=require(_0x2f49('0x3'));var pkginfo=require('pkginfo')(module,_0x2f49('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x2f49('0x5'));var hardware=require('./hardware');var logger=require(_0x2f49('0x6'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x78b8c8){return new BPromise(function(_0xd51099,_0x11c172){var _0x315cf0=util[_0x2f49('0x7')](_0x2f49('0x8'),HOST,_0x78b8c8,module['exports'][_0x2f49('0x4')]);if(oldToken){_0x315cf0=util['format'](_0x2f49('0x9'),HOST,_0x78b8c8,module[_0x2f49('0xa')][_0x2f49('0x4')],oldToken);}var _0x4ee219={'uri':_0x315cf0,'method':_0x2f49('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x4ee219)[_0x2f49('0xc')](function(_0x5aeaa9){_0xd51099(_0x5aeaa9);})[_0x2f49('0xd')](function(_0x595980){_0x11c172(_0x595980);});});}function manageLicense(_0x430461,_0x3bac3e){var _0xb73cc9=_0x3bac3e[_0x2f49('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0xb73cc9[_0x2f49('0xf')]!==_0x430461&&!_0xb73cc9[_0x2f49('0x10')]){oldToken=_0xb73cc9[_0x2f49('0xf')];}httpRequest(_0x430461)[_0x2f49('0xc')](function(_0x5b2f67){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5b2f67[_0x2f49('0x11')]){isOldTokenSent=![];if(!_0xb73cc9[_0x2f49('0x12')]&&_0xb73cc9[_0x2f49('0x12')]!=_0x5b2f67[_0x2f49('0x12')]||_0xb73cc9[_0x2f49('0x12')]&&_0xb73cc9[_0x2f49('0x10')]){logger['info'](_0x2f49('0x13'));}if(_0xb73cc9[_0x2f49('0x12')]&&!_0xb73cc9[_0x2f49('0x10')]&&_0xb73cc9[_0x2f49('0x12')]!=_0x5b2f67[_0x2f49('0x12')]){logger[_0x2f49('0x14')](_0x2f49('0x15'));}if(_0xb73cc9[_0x2f49('0x12')]&&!_0xb73cc9['data2']&&_0xb73cc9[_0x2f49('0x12')]==_0x5b2f67[_0x2f49('0x12')]){return _0x3bac3e;}return _0x3bac3e[_0x2f49('0x16')]({'data1':_0x430461,'data2':null,'license':_0x5b2f67[_0x2f49('0x12')]});}else{if(_0x5b2f67[_0x2f49('0x12')]||_0xb73cc9[_0x2f49('0x12')]){if(!_0xb73cc9['data2']){if(_0xb73cc9[_0x2f49('0xf')]==_0x430461){GRAY_PERIOD_REASON=_0x2f49('0x17');logger[_0x2f49('0x14')](_0x2f49('0x18'));}else{GRAY_PERIOD_REASON=_0x2f49('0x19');logger[_0x2f49('0x14')](_0x2f49('0x1a'),_0xb73cc9[_0x2f49('0xf')],_0x430461);}logger[_0x2f49('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x2f49('0x1b')](),moment()[_0x2f49('0x7')](_0x2f49('0x1c')));return _0x3bac3e['update']({'data2':encryptor[_0x2f49('0x1d')](moment()[_0x2f49('0x7')](_0x2f49('0x1c')))});}else{if(moment()['diff'](encryptor['decryptString'](_0xb73cc9[_0x2f49('0x10')]),_0x2f49('0x1e'))>DAYS){logger[_0x2f49('0x14')](_0x2f49('0x1f'),moment()[_0x2f49('0x7')](_0x2f49('0x1c')));isOldTokenSent=![];return _0x3bac3e[_0x2f49('0x16')]({'data1':_0x430461,'data2':null,'license':null});}}}else{if(_0xb73cc9[_0x2f49('0xf')]!=_0x430461){logger[_0x2f49('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xb73cc9['data1'],_0x430461);return _0x3bac3e[_0x2f49('0x16')]({'data1':_0x430461,'data2':null,'license':null});}}}return _0x3bac3e;})[_0x2f49('0xc')](function(_0x2e1d60){_0x3bac3e=_0x2e1d60;})[_0x2f49('0xd')](function(_0x19bc4d){logger[_0x2f49('0x20')](_0x19bc4d[_0x2f49('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x2f49('0x22')](),_0x3bac3e);},TIME);});}function defaultLicense(){var _0x3c031e=hardware[_0x2f49('0x22')]();if(_0x3c031e){return db[_0x2f49('0x23')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x3c031e}})['spread'](function(_0x47f407,_0x4bc4f2){logger[_0x2f49('0x14')](_0x2f49('0x24'),_0x3c031e);manageLicense(_0x3c031e,_0x47f407);})['catch'](function(_0x3d71e4){logger['error'](_0x3d71e4[_0x2f49('0x21')]);});}}exports[_0x2f49('0x25')]=defaultLicense; \ No newline at end of file +var _0xd6c4=['data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','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','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','active'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xd6c4,0x155));var _0x4d6c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6c4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x4d6c('0x0'));var BPromise=require(_0x4d6c('0x1'));var pkginfo=require('pkginfo')(module,_0x4d6c('0x2'));var db=require(_0x4d6c('0x3'))['db'];var encryptor=require(_0x4d6c('0x4'));var hardware=require(_0x4d6c('0x5'));var logger=require(_0x4d6c('0x6'))(_0x4d6c('0x7'));var HOST=_0x4d6c('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x528076){return new BPromise(function(_0x445673,_0x38a398){var _0xe9428a=util[_0x4d6c('0x9')](_0x4d6c('0xa'),HOST,_0x528076,module['exports'][_0x4d6c('0x2')]);if(oldToken){_0xe9428a=util[_0x4d6c('0x9')](_0x4d6c('0xb'),HOST,_0x528076,module[_0x4d6c('0xc')][_0x4d6c('0x2')],oldToken);}var _0x502dac={'uri':_0xe9428a,'method':_0x4d6c('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x502dac)[_0x4d6c('0xe')](function(_0x40c552){_0x445673(_0x40c552);})[_0x4d6c('0xf')](function(_0x2dcb7b){_0x38a398(_0x2dcb7b);});});}function manageLicense(_0x5f079f,_0x29ab83){var _0x142dc3=_0x29ab83[_0x4d6c('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x142dc3['data1']!==_0x5f079f&&!_0x142dc3['data2']){oldToken=_0x142dc3[_0x4d6c('0x11')];}httpRequest(_0x5f079f)[_0x4d6c('0xe')](function(_0x20046e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x20046e[_0x4d6c('0x12')]){isOldTokenSent=![];if(!_0x142dc3[_0x4d6c('0x7')]&&_0x142dc3['license']!=_0x20046e[_0x4d6c('0x7')]||_0x142dc3[_0x4d6c('0x7')]&&_0x142dc3[_0x4d6c('0x13')]){logger[_0x4d6c('0x14')](_0x4d6c('0x15'));}if(_0x142dc3[_0x4d6c('0x7')]&&!_0x142dc3['data2']&&_0x142dc3['license']!=_0x20046e['license']){logger[_0x4d6c('0x14')](_0x4d6c('0x16'));}if(_0x142dc3[_0x4d6c('0x7')]&&!_0x142dc3[_0x4d6c('0x13')]&&_0x142dc3[_0x4d6c('0x7')]==_0x20046e['license']){return _0x29ab83;}return _0x29ab83[_0x4d6c('0x17')]({'data1':_0x5f079f,'data2':null,'license':_0x20046e[_0x4d6c('0x7')]});}else{if(_0x20046e[_0x4d6c('0x7')]||_0x142dc3[_0x4d6c('0x7')]){if(!_0x142dc3[_0x4d6c('0x13')]){if(_0x142dc3[_0x4d6c('0x11')]==_0x5f079f){GRAY_PERIOD_REASON='Disabled';logger[_0x4d6c('0x14')](_0x4d6c('0x18'));}else{GRAY_PERIOD_REASON=_0x4d6c('0x19');logger[_0x4d6c('0x14')](_0x4d6c('0x1a'),_0x142dc3['data1'],_0x5f079f);}logger[_0x4d6c('0x14')](_0x4d6c('0x1b'),GRAY_PERIOD_REASON[_0x4d6c('0x1c')](),moment()[_0x4d6c('0x9')](_0x4d6c('0x1d')));return _0x29ab83[_0x4d6c('0x17')]({'data2':encryptor[_0x4d6c('0x1e')](moment()['format'](_0x4d6c('0x1d')))});}else{if(moment()['diff'](encryptor[_0x4d6c('0x1f')](_0x142dc3[_0x4d6c('0x13')]),'days')>DAYS){logger[_0x4d6c('0x14')](_0x4d6c('0x20'),moment()[_0x4d6c('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x29ab83[_0x4d6c('0x17')]({'data1':_0x5f079f,'data2':null,'license':null});}}}else{if(_0x142dc3[_0x4d6c('0x11')]!=_0x5f079f){logger[_0x4d6c('0x14')](_0x4d6c('0x1a'),_0x142dc3[_0x4d6c('0x11')],_0x5f079f);return _0x29ab83[_0x4d6c('0x17')]({'data1':_0x5f079f,'data2':null,'license':null});}}}return _0x29ab83;})[_0x4d6c('0xe')](function(_0x22f23b){_0x29ab83=_0x22f23b;})[_0x4d6c('0xf')](function(_0x51a0e3){logger[_0x4d6c('0x21')](_0x51a0e3[_0x4d6c('0x22')]);})[_0x4d6c('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x4d6c('0x24')](),_0x29ab83);},TIME);});}function defaultLicense(){var _0x227daa=hardware['getUuid']();if(_0x227daa){return db[_0x4d6c('0x25')][_0x4d6c('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x227daa}})['spread'](function(_0x52b644,_0x209e64){logger[_0x4d6c('0x14')](_0x4d6c('0x27'),_0x227daa);manageLicense(_0x227daa,_0x52b644);})[_0x4d6c('0xf')](function(_0x3c6fb5){logger[_0x4d6c('0x21')](_0x3c6fb5[_0x4d6c('0x22')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 965a3ee..a1a68fb 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 _0x6649=['users','catch','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','count','role','admin','user','telephone'];(function(_0x3f47b6,_0xd08f31){var _0x57698f=function(_0x33052a){while(--_0x33052a){_0x3f47b6['push'](_0x3f47b6['shift']());}};_0x57698f(++_0xd08f31);}(_0x6649,0xbd));var _0x9664=function(_0x21cbfa,_0x5e6982){_0x21cbfa=_0x21cbfa-0x0;var _0x2eef1b=_0x6649[_0x21cbfa];return _0x2eef1b;};'use strict';var util=require(_0x9664('0x0'));var _=require(_0x9664('0x1'));var moment=require(_0x9664('0x2'));var BPromise=require(_0x9664('0x3'));var hardware=require(_0x9664('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x9664('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9664('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9664('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9664('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x9664('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xe01c57){return new BPromise(function(_0x5e0293,_0x13cfa1){return db['License'][_0x9664('0x9')](_[_0x9664('0xa')](_0xe01c57,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x150ea1){return checkLicense(_0x150ea1,null);})[_0x9664('0xb')](function(_0x55c959){_0x5e0293(_0x55c959);return;})['catch'](function(_0x3386d3){_0x13cfa1(_0x3386d3);});});}function checkLicense(_0x26455d,_0x9eb001){if(!_0x26455d){demoLicense[_0x9664('0xc')]=_0x26455d[_0x9664('0xd')];return demoLicense;}try{var _0x1dad5c=_0x9eb001||_0x26455d[_0x9664('0xe')];if(_[_0x9664('0xf')](_0x1dad5c)){throw new Error(_0x9664('0x10'));}var _0x33d013=_0x26455d[_0x9664('0xd')];var _0x18d222=_0x26455d[_0x9664('0x11')];var _0x54e259=_0x33d013[_0x9664('0x12')]('-')[0x4];var _0x4973c0=_0x33d013[_0x9664('0x12')]('-')[0x0];var _0x413e04=encryptor[_0x9664('0x13')](_0x1dad5c,util[_0x9664('0x14')](_0x9664('0x15'),_0x54e259,_0x33d013,_0x4973c0));var _0x2fc96f=JSON['parse'](_0x413e04);_0x2fc96f[_0x9664('0x16')]=![];_0x2fc96f[_0x9664('0xc')]=_0x33d013;_0x2fc96f[_0x9664('0x17')]=hardware['getUuid']();if(_0x18d222){var _0x2f1c03=encryptor[_0x9664('0x13')](_0x18d222);_0x2fc96f[_0x9664('0x18')]=_0x2f1c03;_0x2fc96f[_0x9664('0x19')]=moment(_0x2f1c03)[_0x9664('0x1a')](0x7,'days')[_0x9664('0x14')]();_0x2fc96f[_0x9664('0x1b')]=_0x2fc96f['uuid']!=_0x2fc96f[_0x9664('0x17')]?_0x9664('0x1c'):_0x9664('0x1d');}return _0x2fc96f;}catch(_0x2f6b60){breakingLicense[_0x9664('0xc')]=_0x26455d['data1'];breakingLicense['message']=_0x2f6b60[_0x9664('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x55cb96,_0x4079a8){getLicense()[_0x9664('0xb')](function(_0x58614c){return db[_0x9664('0x1f')][_0x9664('0x20')]({'attributes':['role',[db[_0x9664('0x21')]['fn'](_0x9664('0x22'),db[_0x9664('0x21')][_0x9664('0x23')]('role')),_0x9664('0x24')]],'group':_0x9664('0x25'),'where':{'role':{'$or':[_0x9664('0x26'),_0x9664('0x27'),_0x9664('0x28')]}},'raw':!![]})[_0x9664('0xb')](function(_0x33d31d){var _0xc30139={'user':_0x58614c[_0x9664('0x29')]||0x0,'telephone':_0x58614c['telephones']||0x0};_0x33d31d['forEach'](function(_0x5d9fb9){var _0x11c3d0=_0x5d9fb9[_0x9664('0x25')]===_0x9664('0x26')?_0x9664('0x27'):_0x5d9fb9['role'];_0xc30139[_0x11c3d0]-=_0x5d9fb9['count'];if(_0xc30139[_0x11c3d0]<0x0)_0xc30139[_0x11c3d0]=0x0;});_0x55cb96(_0xc30139);return;});})[_0x9664('0x2a')](function(_0x1935b0){_0x4079a8(_0x1935b0);});});}function checkUserLimits(_0xa52cb9){return new BPromise(function(_0x12b976,_0x15933a){getLimits()['then'](function(_0xc5878b){var _0x4c8555=_['pick'](_['countBy'](_0xa52cb9,_0x9664('0x25')),[_0x9664('0x26'),_0x9664('0x27'),'telephone']);var _0x422d21=(_0x4c8555[_0x9664('0x26')]||0x0)+(_0x4c8555[_0x9664('0x27')]||0x0);var _0x211347=_0x4c8555[_0x9664('0x28')]||0x0;if(_0x422d21>_0xc5878b[_0x9664('0x27')])return _0x15933a(_0x9664('0x2b'));if(_0x211347>_0xc5878b[_0x9664('0x28')])return _0x15933a(_0x9664('0x2c'));return _0x12b976();})[_0x9664('0x2a')](function(_0x42ebec){_0x15933a(_0x42ebec);});});}module[_0x9664('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x739f=['admin','user','telephone','telephones','count','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','changed','disabled','message','User','role','sequelize','COUNT','col'];(function(_0x55d1a8,_0x4ea61f){var _0x110f40=function(_0x25827b){while(--_0x25827b){_0x55d1a8['push'](_0x55d1a8['shift']());}};_0x110f40(++_0x4ea61f);}(_0x739f,0xf3));var _0xf739=function(_0x419dfb,_0x1e93ae){_0x419dfb=_0x419dfb-0x0;var _0x2db318=_0x739f[_0x419dfb];return _0x2db318;};'use strict';var util=require(_0xf739('0x0'));var _=require(_0xf739('0x1'));var moment=require(_0xf739('0x2'));var BPromise=require(_0xf739('0x3'));var hardware=require(_0xf739('0x4'));var encryptor=require(_0xf739('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf739('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf739('0x7'),'machineUuid':hardware[_0xf739('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf739('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf739('0x9'),'machineUuid':hardware[_0xf739('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1bce30){return new BPromise(function(_0x258797,_0x3d0013){return db[_0xf739('0xa')][_0xf739('0xb')](_[_0xf739('0xc')](_0x1bce30,{'raw':!![],'where':{'id':0x1}}))[_0xf739('0xd')](function(_0x21cdf5){return checkLicense(_0x21cdf5,null);})['then'](function(_0x1b2f6b){_0x258797(_0x1b2f6b);return;})[_0xf739('0xe')](function(_0x2a6394){_0x3d0013(_0x2a6394);});});}function checkLicense(_0x3b3f80,_0x303e73){if(!_0x3b3f80){demoLicense[_0xf739('0xf')]=_0x3b3f80[_0xf739('0x10')];return demoLicense;}try{var _0xe766c=_0x303e73||_0x3b3f80['license'];if(_[_0xf739('0x11')](_0xe766c)){throw new Error(_0xf739('0x12'));}var _0x4ee7f3=_0x3b3f80['data1'];var _0x154d3e=_0x3b3f80[_0xf739('0x13')];var _0x5e29ef=_0x4ee7f3['split']('-')[0x4];var _0x4074d3=_0x4ee7f3[_0xf739('0x14')]('-')[0x0];var _0x4d1059=encryptor[_0xf739('0x15')](_0xe766c,util[_0xf739('0x16')](_0xf739('0x17'),_0x5e29ef,_0x4ee7f3,_0x4074d3));var _0x298d38=JSON[_0xf739('0x18')](_0x4d1059);_0x298d38[_0xf739('0x19')]=![];_0x298d38[_0xf739('0xf')]=_0x4ee7f3;_0x298d38[_0xf739('0x1a')]=hardware[_0xf739('0x8')]();if(_0x154d3e){var _0x3226ee=encryptor['decryptString'](_0x154d3e);_0x298d38['gray']=_0x3226ee;_0x298d38[_0xf739('0x1b')]=moment(_0x3226ee)[_0xf739('0x1c')](0x7,_0xf739('0x1d'))[_0xf739('0x16')]();_0x298d38[_0xf739('0x1e')]=_0x298d38[_0xf739('0xf')]!=_0x298d38[_0xf739('0x1a')]?_0xf739('0x1f'):_0xf739('0x20');}return _0x298d38;}catch(_0xaf7d3a){breakingLicense[_0xf739('0xf')]=_0x3b3f80[_0xf739('0x10')];breakingLicense[_0xf739('0x21')]=_0xaf7d3a[_0xf739('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x360080,_0x8ac512){getLicense()[_0xf739('0xd')](function(_0xb31677){return db[_0xf739('0x22')]['findAll']({'attributes':[_0xf739('0x23'),[db[_0xf739('0x24')]['fn'](_0xf739('0x25'),db[_0xf739('0x24')][_0xf739('0x26')]('role')),'count']],'group':_0xf739('0x23'),'where':{'role':{'$or':[_0xf739('0x27'),_0xf739('0x28'),_0xf739('0x29')]}},'raw':!![]})[_0xf739('0xd')](function(_0x1d2f41){var _0x198d5d={'user':_0xb31677['users']||0x0,'telephone':_0xb31677[_0xf739('0x2a')]||0x0};_0x1d2f41['forEach'](function(_0x58693c){var _0x34992e=_0x58693c['role']==='admin'?_0xf739('0x28'):_0x58693c[_0xf739('0x23')];_0x198d5d[_0x34992e]-=_0x58693c[_0xf739('0x2b')];if(_0x198d5d[_0x34992e]<0x0)_0x198d5d[_0x34992e]=0x0;});_0x360080(_0x198d5d);return;});})['catch'](function(_0x1fac8f){_0x8ac512(_0x1fac8f);});});}function checkUserLimits(_0x5ce08d){return new BPromise(function(_0x31935a,_0x5d8df9){getLimits()[_0xf739('0xd')](function(_0x33a926){var _0x1f3037=_[_0xf739('0x2c')](_[_0xf739('0x2d')](_0x5ce08d,'role'),['admin',_0xf739('0x28'),_0xf739('0x29')]);var _0x289c16=(_0x1f3037['admin']||0x0)+(_0x1f3037[_0xf739('0x28')]||0x0);var _0x40737f=_0x1f3037[_0xf739('0x29')]||0x0;if(_0x289c16>_0x33a926[_0xf739('0x28')])return _0x5d8df9('License\x20limit\x20reached\x20for\x20users');if(_0x40737f>_0x33a926[_0xf739('0x29')])return _0x5d8df9(_0xf739('0x2e'));return _0x31935a();})[_0xf739('0xe')](function(_0x446517){_0x5d8df9(_0x446517);});});}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 c253761..7de284f 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 _0x955f=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x1881ac,_0x57ecf4){var _0x3b966e=function(_0x134036){while(--_0x134036){_0x1881ac['push'](_0x1881ac['shift']());}};_0x3b966e(++_0x57ecf4);}(_0x955f,0x1eb));var _0xf955=function(_0x3a85ca,_0x518d87){_0x3a85ca=_0x3a85ca-0x0;var _0x2876fa=_0x955f[_0x3a85ca];return _0x2876fa;};'use strict';module[_0xf955('0x0')]={'DOMAIN':_0xf955('0x1'),'SESSION_SECRET':_0xf955('0x2'),'GOOGLE_ID':_0xf955('0x3'),'GOOGLE_SECRET':_0xf955('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xf4f4=['http://localhost:9000','app-id','secret','exports'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x319d27,_0x11d391){_0x319d27=_0x319d27-0x0;var _0x33f484=_0xf4f4[_0x319d27];return _0x33f484;};'use strict';module[_0x4f4f('0x0')]={'DOMAIN':_0x4f4f('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4f4f('0x2'),'GOOGLE_SECRET':_0x4f4f('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index c98464f..7c2e14f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2a3=['exports','../utils/loggers'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb2a3,0x14f));var _0x3b2a=function(_0x4e3e61,_0x3ea4ff){_0x4e3e61=_0x4e3e61-0x0;var _0x2d7e30=_0xb2a3[_0x4e3e61];return _0x2d7e30;};'use strict';var fileLogger=require(_0x3b2a('0x0'))['fileLogger'];module[_0x3b2a('0x1')]=fileLogger; \ No newline at end of file +var _0xd5ba=['../utils/loggers'];(function(_0x5ae71a,_0x55425a){var _0x103190=function(_0x10ca47){while(--_0x10ca47){_0x5ae71a['push'](_0x5ae71a['shift']());}};_0x103190(++_0x55425a);}(_0xd5ba,0x160));var _0xad5b=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xd5ba[_0x20a558];return _0x53d3f7;};'use strict';var fileLogger=require(_0xad5b('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 6c11ad4..624302c 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 _0x9d39=['../../services/agi/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x9d39,0xce));var _0x99d3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9d39[_0x19950b];return _0x3c6b41;};'use strict';var path=require(_0x99d3('0x0'));var cfg=require(_0x99d3('0x1'));var env={'NODE_PATH':path[_0x99d3('0x2')](path[_0x99d3('0x3')](cfg[_0x99d3('0x4')],_0x99d3('0x5')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x99d3('0x6')),'env':env},{'name':_0x99d3('0x7'),'script':path[_0x99d3('0x3')](__dirname,_0x99d3('0x8')),'env':env},{'name':_0x99d3('0x9'),'script':path[_0x99d3('0x3')](__dirname,_0x99d3('0xa')),'env':env},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path[_0x99d3('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x99d3('0xb')]=pm2config; \ No newline at end of file +var _0x8d84=['legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','join'];(function(_0x1e946a,_0x268f46){var _0x3695d1=function(_0x3ecf60){while(--_0x3ecf60){_0x1e946a['push'](_0x1e946a['shift']());}};_0x3695d1(++_0x268f46);}(_0x8d84,0x1b9));var _0x48d8=function(_0x4ceef2,_0x4f4173){_0x4ceef2=_0x4ceef2-0x0;var _0x192ec0=_0x8d84[_0x4ceef2];return _0x192ec0;};'use strict';var path=require(_0x48d8('0x0'));var cfg=require(_0x48d8('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x48d8('0x2')](cfg['root'],_0x48d8('0x3')))};var pm2config={'apps':[{'name':_0x48d8('0x4'),'script':path[_0x48d8('0x2')](__dirname,_0x48d8('0x5')),'env':env},{'name':_0x48d8('0x6'),'script':path[_0x48d8('0x2')](__dirname,_0x48d8('0x7')),'env':env},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0x48d8('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x48d8('0x8'),'script':path['join'](__dirname,_0x48d8('0x9')),'env':env},{'name':'xdr','script':path[_0x48d8('0x2')](__dirname,_0x48d8('0xa')),'env':env}]};module[_0x48d8('0xb')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a519b5f..1fa052c 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 _0x89f8=['dump','bluebird','connect','connected','start','stop','then','disconnect','restart','list','describe','delete'];(function(_0x3a539b,_0x1d5b66){var _0x368af=function(_0x5accf8){while(--_0x5accf8){_0x3a539b['push'](_0x3a539b['shift']());}};_0x368af(++_0x1d5b66);}(_0x89f8,0x79));var _0x889f=function(_0x2f32ad,_0x41a394){_0x2f32ad=_0x2f32ad-0x0;var _0xe5e48c=_0x89f8[_0x2f32ad];return _0xe5e48c;};'use strict';var pm2=require('pm2');var BPromise=require(_0x889f('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x42e526,_0x485a49){return pm2[_0x889f('0x1')](function(_0x3b42ff){if(_0x3b42ff){return _0x485a49(_0x3b42ff);}return _0x42e526(_0x889f('0x2'));});});};exports['start']=function(_0x1fb7c0){return connect()['then'](function(){return new BPromise(function(_0xd44b8a,_0x13a3a4){return pm2[_0x889f('0x3')](_0x1fb7c0,function(_0x307bb4,_0xfe2220){if(_0x307bb4){return _0x13a3a4(_0x307bb4);}pm2['disconnect']();return _0xd44b8a(_0xfe2220);});});});};exports[_0x889f('0x4')]=function(_0x564b17){return connect()[_0x889f('0x5')](function(){return new BPromise(function(_0x3e9234,_0x19218f){return pm2[_0x889f('0x4')](_0x564b17,function(_0x1eaaf1,_0x3f2eb9){if(_0x1eaaf1){return _0x19218f(_0x1eaaf1);}pm2[_0x889f('0x6')]();return _0x3e9234(_0x3f2eb9);});});});};exports['restart']=function(_0x33832e){return connect()[_0x889f('0x5')](function(){return new BPromise(function(_0x29ae69,_0x17374f){return pm2[_0x889f('0x7')](_0x33832e,function(_0x5a03a5,_0x18d06a){if(_0x5a03a5){return _0x17374f(_0x5a03a5);}pm2[_0x889f('0x6')]();return _0x29ae69(_0x18d06a);});});});};exports[_0x889f('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x36445e,_0x5abc8e){return pm2[_0x889f('0x8')](function(_0x2217e6,_0x2e0f65){if(_0x2217e6){return _0x5abc8e(_0x2217e6);}pm2[_0x889f('0x6')]();return _0x36445e(_0x2e0f65);});});});};exports['describe']=function(_0x45928f){return connect()[_0x889f('0x5')](function(){return new BPromise(function(_0x5bae14,_0x42a614){return pm2[_0x889f('0x9')](_0x45928f,function(_0xc1e535,_0x136f1e){if(_0xc1e535){return _0x42a614(_0xc1e535);}pm2[_0x889f('0x6')]();return _0x5bae14(_0x136f1e);});});});};exports['delete']=function(_0xa0c7a1){return connect()[_0x889f('0x5')](function(){return new BPromise(function(_0x27cc73,_0x11fd34){return pm2[_0x889f('0xa')](_0xa0c7a1,function(_0x54cfa8,_0x10a8d8){if(_0x54cfa8){return _0x11fd34(_0x54cfa8);}pm2[_0x889f('0x6')]();return _0x27cc73(_0x10a8d8);});});});};exports['dump']=function(){return connect()[_0x889f('0x5')](function(){return new BPromise(function(_0x296877,_0x5e7d3c){return pm2[_0x889f('0xb')](function(_0x2add52){if(_0x2add52){return _0x5e7d3c(_0x2add52);}return _0x296877('saved');});});});}; \ No newline at end of file +var _0xf337=['then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start'];(function(_0x479323,_0x512d47){var _0x18f240=function(_0x58f85f){while(--_0x58f85f){_0x479323['push'](_0x479323['shift']());}};_0x18f240(++_0x512d47);}(_0xf337,0x1d7));var _0x7f33=function(_0x51176e,_0x2e54bb){_0x51176e=_0x51176e-0x0;var _0x168809=_0xf337[_0x51176e];return _0x168809;};'use strict';var pm2=require(_0x7f33('0x0'));var BPromise=require(_0x7f33('0x1'));var config=require(_0x7f33('0x2'));function connect(){return new BPromise(function(_0x3d8466,_0x484e3c){return pm2['connect'](function(_0x152e0c){if(_0x152e0c){return _0x484e3c(_0x152e0c);}return _0x3d8466(_0x7f33('0x3'));});});};exports[_0x7f33('0x4')]=function(_0x3dd2bf){return connect()[_0x7f33('0x5')](function(){return new BPromise(function(_0x271ac7,_0x1dc31d){return pm2['start'](_0x3dd2bf,function(_0x1c7dfa,_0xc7d776){if(_0x1c7dfa){return _0x1dc31d(_0x1c7dfa);}pm2[_0x7f33('0x6')]();return _0x271ac7(_0xc7d776);});});});};exports['stop']=function(_0x16f9a6){return connect()[_0x7f33('0x5')](function(){return new BPromise(function(_0x368a0a,_0x454fa0){return pm2[_0x7f33('0x7')](_0x16f9a6,function(_0x4ac407,_0x2d18d3){if(_0x4ac407){return _0x454fa0(_0x4ac407);}pm2[_0x7f33('0x6')]();return _0x368a0a(_0x2d18d3);});});});};exports[_0x7f33('0x8')]=function(_0x9277ca){return connect()[_0x7f33('0x5')](function(){return new BPromise(function(_0x3d42b7,_0x5bf55c){return pm2[_0x7f33('0x8')](_0x9277ca,function(_0x1df8f8,_0x3f7f49){if(_0x1df8f8){return _0x5bf55c(_0x1df8f8);}pm2['disconnect']();return _0x3d42b7(_0x3f7f49);});});});};exports[_0x7f33('0x9')]=function(){return connect()[_0x7f33('0x5')](function(){return new BPromise(function(_0xedfe01,_0x235cb8){return pm2[_0x7f33('0x9')](function(_0x2bfe14,_0x497381){if(_0x2bfe14){return _0x235cb8(_0x2bfe14);}pm2[_0x7f33('0x6')]();return _0xedfe01(_0x497381);});});});};exports[_0x7f33('0xa')]=function(_0x118794){return connect()['then'](function(){return new BPromise(function(_0x5f6486,_0x26531d){return pm2[_0x7f33('0xa')](_0x118794,function(_0x4553e6,_0x4aaa8b){if(_0x4553e6){return _0x26531d(_0x4553e6);}pm2[_0x7f33('0x6')]();return _0x5f6486(_0x4aaa8b);});});});};exports['delete']=function(_0x5f8a59){return connect()[_0x7f33('0x5')](function(){return new BPromise(function(_0x2e12e5,_0x54a154){return pm2[_0x7f33('0xb')](_0x5f8a59,function(_0x2de474,_0x1643bc){if(_0x2de474){return _0x54a154(_0x2de474);}pm2['disconnect']();return _0x2e12e5(_0x1643bc);});});});};exports['dump']=function(){return connect()[_0x7f33('0x5')](function(){return new BPromise(function(_0x46ae24,_0x57b02b){return pm2[_0x7f33('0xc')](function(_0x1f0c8e){if(_0x1f0c8e){return _0x57b02b(_0x1f0c8e);}return _0x46ae24(_0x7f33('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e762b07..05f4875 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 _0xb2a0=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb2a0,0x11b));var _0x0b2a=function(_0x3cd9ab,_0x3a3f44){_0x3cd9ab=_0x3cd9ab-0x0;var _0x26ccac=_0xb2a0[_0x3cd9ab];return _0x26ccac;};'use strict';var _=require(_0x0b2a('0x0'));var moment=require(_0x0b2a('0x1'));var Redis=require('ioredis');var util=require(_0x0b2a('0x2'));var config=require('../../config/environment');var db=require(_0x0b2a('0x3'))['db'];var logger=require(_0x0b2a('0x4'))(_0x0b2a('0x5'));config[_0x0b2a('0x6')]=_[_0x0b2a('0x7')](config[_0x0b2a('0x6')],{'host':_0x0b2a('0x8'),'port':0x18eb});var io=require(_0x0b2a('0x9'))(new Redis(config[_0x0b2a('0x6')]));function closeInteractions(){var _0x207b6e=0x0;var _0x3606d8=[];return db[_0x0b2a('0xa')]['find']({'raw':!![],'attributes':['id',_0x0b2a('0xb')],'where':{'id':0x1}})[_0x0b2a('0xc')](function(_0x479410){_0x207b6e=_0x479410[_0x0b2a('0xb')];if(_0x207b6e){return db['ChatInteraction'][_0x0b2a('0xd')]({'raw':!![],'attributes':['id',_0x0b2a('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0b2a('0xf')](_0x479410[_0x0b2a('0xb')],_0x0b2a('0x10'))}}});}else{return[];}})[_0x0b2a('0xc')](function(_0x77214b){if(_0x77214b&&_0x77214b[_0x0b2a('0x11')]){_0x3606d8=_[_0x0b2a('0x12')](_0x77214b||[],'id');logger[_0x0b2a('0x13')](_0x0b2a('0x14'),_0x3606d8['join']());return db[_0x0b2a('0x15')][_0x0b2a('0x16')]({'closeReason':'system','disposition':_0x0b2a('0x17'),'closed':!![],'closedAt':moment()[_0x0b2a('0x18')](_0x0b2a('0x19'))},{'where':{'id':_0x3606d8}});}})[_0x0b2a('0xc')](function(){if(_0x3606d8&&_0x3606d8[_0x0b2a('0x11')]){logger['info'](_0x0b2a('0x1a'),_0x3606d8[_0x0b2a('0x1b')]());for(var _0x128ce8=0x0;_0x128ce8<_0x3606d8[_0x0b2a('0x11')];_0x128ce8++){io[_0x0b2a('0x1c')](_0x0b2a('0x1d'),{'id':_0x3606d8[_0x128ce8],'closed':!![]});}}})[_0x0b2a('0x1e')](function(_0xc56d8d){logger[_0x0b2a('0x1f')](_0x0b2a('0x20'),_0xc56d8d?util[_0x0b2a('0x21')](_0xc56d8d,{'showHidden':![],'depth':null}):'');});}exports[_0x0b2a('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x188c=['socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','util','../../mysqldb','../logger','redis','defaults','localhost'];(function(_0x410371,_0xfc6224){var _0x16b10e=function(_0x223453){while(--_0x223453){_0x410371['push'](_0x410371['shift']());}};_0x16b10e(++_0xfc6224);}(_0x188c,0x119));var _0xc188=function(_0x1af91a,_0x308ab2){_0x1af91a=_0x1af91a-0x0;var _0x5c1fa6=_0x188c[_0x1af91a];return _0x5c1fa6;};'use strict';var _=require('lodash');var moment=require(_0xc188('0x0'));var Redis=require('ioredis');var util=require(_0xc188('0x1'));var config=require('../../config/environment');var db=require(_0xc188('0x2'))['db'];var logger=require(_0xc188('0x3'))('schedule');config[_0xc188('0x4')]=_[_0xc188('0x5')](config[_0xc188('0x4')],{'host':_0xc188('0x6'),'port':0x18eb});var io=require(_0xc188('0x7'))(new Redis(config[_0xc188('0x4')]));function closeInteractions(){var _0x429611=0x0;var _0x1d7ee4=[];return db[_0xc188('0x8')][_0xc188('0x9')]({'raw':!![],'attributes':['id',_0xc188('0xa')],'where':{'id':0x1}})['then'](function(_0x704995){_0x429611=_0x704995['chatTimeout'];if(_0x429611){return db[_0xc188('0xb')][_0xc188('0xc')]({'raw':!![],'attributes':['id',_0xc188('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x704995[_0xc188('0xa')],_0xc188('0xe'))}}});}else{return[];}})[_0xc188('0xf')](function(_0x15442f){if(_0x15442f&&_0x15442f[_0xc188('0x10')]){_0x1d7ee4=_[_0xc188('0x11')](_0x15442f||[],'id');logger[_0xc188('0x12')](_0xc188('0x13'),_0x1d7ee4['join']());return db['ChatInteraction'][_0xc188('0x14')]({'closeReason':_0xc188('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xc188('0x16'))},{'where':{'id':_0x1d7ee4}});}})[_0xc188('0xf')](function(){if(_0x1d7ee4&&_0x1d7ee4[_0xc188('0x10')]){logger[_0xc188('0x12')](_0xc188('0x17'),_0x1d7ee4[_0xc188('0x18')]());for(var _0x36d22a=0x0;_0x36d22a<_0x1d7ee4[_0xc188('0x10')];_0x36d22a++){io[_0xc188('0x19')](_0xc188('0x1a'),{'id':_0x1d7ee4[_0x36d22a],'closed':!![]});}}})[_0xc188('0x1b')](function(_0xf3ff3d){logger[_0xc188('0x1c')](_0xc188('0x1d'),_0xf3ff3d?util[_0xc188('0x1e')](_0xf3ff3d,{'showHidden':![],'depth':null}):'');});}exports[_0xc188('0x1f')]=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 c4f3c4e..100699d 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 _0x3615=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x44784c,_0x4498c1){var _0x4bbfb1=function(_0x5d5ef7){while(--_0x5d5ef7){_0x44784c['push'](_0x44784c['shift']());}};_0x4bbfb1(++_0x4498c1);}(_0x3615,0x14d));var _0x5361=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3615[_0x13e741];return _0x3f8bb3;};'use strict';function start(){var _0x5a98a6=require(_0x5361('0x0'));return _0x5a98a6[_0x5361('0x1')]();}module[_0x5361('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xe31f=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x20a987,_0x17b591){var _0xc50d99=function(_0x5f11ed){while(--_0x5f11ed){_0x20a987['push'](_0x20a987['shift']());}};_0xc50d99(++_0x17b591);}(_0xe31f,0x1d2));var _0xfe31=function(_0x250ee4,_0x548133){_0x250ee4=_0x250ee4-0x0;var _0x3e8644=_0xe31f[_0x250ee4];return _0x3e8644;};'use strict';function start(){var _0x2356d4=require(_0xfe31('0x0'));return _0x2356d4['startAllRefreshIntervals']();}module[_0xfe31('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 86807e5..94baa2f 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 _0xf86a=['format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','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','status','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','SendMail','email\x20sent','catch','stringify','currentAttempt','retries','job','data','operation','stop','still\x20loading','case\x20completed','entity','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','subtractNumber','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','toRun','resolve','cron','active','isBetween','endAt','add','add\x20cron','deleteJob','startAt','update','update\x20cron','stop\x20cron','run','start','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','then','error','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions'];(function(_0x4ad935,_0x26e1da){var _0x20a15f=function(_0x2a646d){while(--_0x2a646d){_0x4ad935['push'](_0x4ad935['shift']());}};_0x20a15f(++_0x26e1da);}(_0xf86a,0x138));var _0xaf86=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf86a[_0xa464c9];return _0x3d73c4;};'use strict';var fs=require('fs');var util=require(_0xaf86('0x0'));var path=require(_0xaf86('0x1'));var _=require('lodash');var moment=require(_0xaf86('0x2'));var CronJobManager=require(_0xaf86('0x3'));var jayson=require(_0xaf86('0x4'));var BPromise=require(_0xaf86('0x5'));var logger=require(_0xaf86('0x6'))(_0xaf86('0x7'));var db=require(_0xaf86('0x8'))['db'];const retry=require(_0xaf86('0x9'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xaf86('0xa'));var client=jayson[_0xaf86('0xb')][_0xaf86('0xc')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x2ba868){const _0x2e97f1={};if(typeof _0x2ba868===_0xaf86('0xd')){_0x2e97f1['id']=_0x2ba868;}return db[_0xaf86('0xe')]['findOne']({'where':_0x2e97f1})[_0xaf86('0xf')](function(_0x3eacbf){return _0x3eacbf;})['catch'](function(_0x455012){logger[_0xaf86('0x10')](_0x455012);});}function handleSendEmail(_0x20e949,_0x42b641){logger['info'](_0xaf86('0x11'),_0x20e949[_0xaf86('0x12')]);var _0x3b56bc=!![];var _0x4bb711=_0x20e949[_0xaf86('0x13')][_0xaf86('0x14')]();var _0x4a2a83={'account':_0x4bb711,'message':{'from':util[_0xaf86('0x15')](_0xaf86('0x16'),_0x20e949[_0xaf86('0x13')][_0xaf86('0x17')],_0x20e949[_0xaf86('0x13')][_0xaf86('0x12')]||_0x20e949[_0xaf86('0x13')][_0xaf86('0x18')][_0xaf86('0x19')]),'to':_0x20e949['email'],'cc':_0x20e949['cc'],'bcc':_0x20e949[_0xaf86('0x1a')],'subject':util['format'](_0xaf86('0x1b'),_0x42b641[_0xaf86('0x17')],_0x20e949['subtractNumber'],_0x20e949[_0xaf86('0x1c')])}};var _0x15118d=path[_0xaf86('0x1d')](__dirname,_0xaf86('0x1e'));var _0x713e18=_0x42b641[_0xaf86('0x1f')];var _0x387020=util[_0xaf86('0x15')]('%s.%s',path[_0xaf86('0x20')](_0x42b641[_0xaf86('0x1f')],path[_0xaf86('0x21')](_0x42b641[_0xaf86('0x1f')])),_0xaf86('0x22'));var _0x38191e=path[_0xaf86('0x1d')](_0x15118d,_0x713e18);var _0x6188fa=path[_0xaf86('0x1d')](_0x15118d,_0x387020);if(fs[_0xaf86('0x23')](_0x38191e)){_0x42b641['status']=_0xaf86('0x24');_0x4a2a83[_0xaf86('0x25')][_0xaf86('0x26')]=[{'filename':_0x713e18,'path':_0x38191e}];_0x4a2a83[_0xaf86('0x25')][_0xaf86('0x27')]=util[_0xaf86('0x15')](_0xaf86('0x28'),JSON['stringify'](_0x42b641,null,0x2));}else if(fs[_0xaf86('0x23')](_0x6188fa)){_0x42b641[_0xaf86('0x29')]=_0xaf86('0x24');_0x4a2a83[_0xaf86('0x25')][_0xaf86('0x26')]=[{'filename':_0x387020,'path':_0x6188fa}];}else{if(_0x42b641[_0xaf86('0x29')]===_0xaf86('0x2a')){_0x4a2a83[_0xaf86('0x25')]['text']=_0xaf86('0x2b');if(!_0x20e949[_0xaf86('0x2c')]){_0x3b56bc=![];logger[_0xaf86('0x2d')](_0xaf86('0x2e'));}}else if(_0x42b641['status']===_0xaf86('0x2f')){_0x4a2a83[_0xaf86('0x25')]['text']='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x42b641[_0xaf86('0x29')]==='Completed'){_0x4a2a83[_0xaf86('0x25')][_0xaf86('0x27')]=_0xaf86('0x30');}else if(_0x42b641[_0xaf86('0x29')]===_0xaf86('0x31')){_0x4a2a83[_0xaf86('0x25')][_0xaf86('0x27')]=_0xaf86('0x32');}else{logger[_0xaf86('0x10')](_0xaf86('0x33'),_0x42b641['status']);}}if(_0x3b56bc){return client['request'](_0xaf86('0x34'),_0x4a2a83)[_0xaf86('0xf')](function(_0x5c4c77){if(_0x5c4c77['error']){return logger[_0xaf86('0x10')]('error\x20mail',JSON['stringify'](_0x5c4c77));}return logger[_0xaf86('0x2d')](_0xaf86('0x35'));})[_0xaf86('0x36')](function(_0x956452){return logger[_0xaf86('0x10')]('error\x20mail',JSON[_0xaf86('0x37')](_0x956452));});}}function handleError(){return function(_0x15f6d2){return logger[_0xaf86('0x10')](JSON[_0xaf86('0x37')](_0x15f6d2));};}function loading(_0x288c7d){logger[_0xaf86('0x2d')]('case\x20loading');if(_0x288c7d[_0xaf86('0x38')]===_0x288c7d['retryOptions'][_0xaf86('0x39')]){handleSendEmail(_0x288c7d[_0xaf86('0x3a')],_0x288c7d[_0xaf86('0x3b')]);_0x288c7d[_0xaf86('0x3c')][_0xaf86('0x3d')]();}else{_0x288c7d['operation'][_0xaf86('0x9')](_0xaf86('0x3e'));}}function completed(_0x58e5ff){logger['info'](_0xaf86('0x3f'));handleSendEmail(_0x58e5ff[_0xaf86('0x3a')],_0x58e5ff[_0xaf86('0x3b')]);_0x58e5ff[_0xaf86('0x3c')]['stop']();}function empty(_0x1a144e){logger[_0xaf86('0x2d')]('case\x20empty');handleSendEmail(_0x1a144e[_0xaf86('0x3a')],_0x1a144e['data']);_0x1a144e['operation'][_0xaf86('0x3d')]();}function failed(_0x23239c){logger[_0xaf86('0x2d')]('case\x20failed');handleSendEmail(_0x23239c[_0xaf86('0x3a')],_0x23239c[_0xaf86('0x3b')]);_0x23239c['operation'][_0xaf86('0x3d')]();}function urecognized(_0x16906d){logger[_0xaf86('0x10')]('Unrecognized\x20status:',_0x16906d[_0xaf86('0x40')][_0xaf86('0x41')][_0xaf86('0x29')]);_0x16906d[_0xaf86('0x3c')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1d9d3b,_0x237e07){const _0x1ee85c={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x5d5d54=retry['operation'](_0x1ee85c);_0x5d5d54[_0xaf86('0x42')](_0x1141ed=>{logger['info'](_0xaf86('0x43')+_0x1d9d3b['id']+_0xaf86('0x44')+_0x1141ed);try{getReportData(_0x237e07['id'])['then'](function(_0x419404){_0x237e07=_0x419404;logger[_0xaf86('0x2d')]('report\x20status:',_0x419404['dataValues']['status']);if(!reportStatusStrategies[_0x419404[_0xaf86('0x41')][_0xaf86('0x29')]]){logger[_0xaf86('0x10')](_0xaf86('0x45'),_0x419404[_0xaf86('0x41')][_0xaf86('0x29')]);_0x5d5d54[_0xaf86('0x9')]();}reportStatusStrategies[_0x419404[_0xaf86('0x41')][_0xaf86('0x29')]]({'operation':_0x5d5d54,'currentAttempt':_0x1141ed,'retryOptions':_0x1ee85c,'job':_0x1d9d3b,'data':_0x237e07,'entity':_0x419404});});}catch(_0x467b74){_0x5d5d54[_0xaf86('0x9')](_0x467b74);}});}function handleResult(_0x976668){return function(_0x49f8a2){if(_0x976668['sendMail']&&_0x976668[_0xaf86('0x13')]&&_0x976668['MailAccount'][_0xaf86('0x18')]&&!_['isNil'](_0x976668[_0xaf86('0x12')])){retryer(_0x976668,_0x49f8a2);}};}function handleJob(_0x24a626){return function(){try{if(_['isNil'](_0x24a626[_0xaf86('0x46')])){return logger[_0xaf86('0x2d')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xaf86('0x47')](_0x24a626[_0xaf86('0x1c')])){return logger[_0xaf86('0x2d')](_0xaf86('0x48'));}var _0x5ce563={'startDate':moment()[_0xaf86('0x49')](_0x24a626['subtractNumber'],_0x24a626['subtractUnit'])[_0xaf86('0x15')](_0xaf86('0x4a')),'endDate':moment()['format'](_0xaf86('0x4a')),'type':_0xaf86('0x4b'),'output':_0x24a626[_0xaf86('0x4c')],'name':_0x24a626[_0xaf86('0x17')]};if(!_[_0xaf86('0x47')](_0x24a626['DefaultReportId'])){logger[_0xaf86('0x2d')](_0xaf86('0x4d'),_0x24a626[_0xaf86('0x4e')]);return analyticDefaultReportController[_0xaf86('0x4f')]({'id':_0x24a626['DefaultReportId']},_0x5ce563)[_0xaf86('0xf')](handleResult(_0x24a626))['catch'](handleError());}if(!_[_0xaf86('0x47')](_0x24a626[_0xaf86('0x50')])){logger[_0xaf86('0x2d')](_0xaf86('0x51'),_0x24a626['CustomReportId']);return analyticCustomReportController[_0xaf86('0x4f')]({'id':_0x24a626['CustomReportId']},_0x5ce563)['then'](handleResult(_0x24a626))['catch'](handleError());}}catch(_0x4dd1f9){logger[_0xaf86('0x10')](JSON[_0xaf86('0x37')](_0x4dd1f9));}return logger[_0xaf86('0x2d')](_0xaf86('0x52'));};}function getJobs(_0x1960a4){var _0x30f4fb={};if(_0x1960a4){_0x30f4fb['id']=_0x1960a4;}return db[_0xaf86('0x53')][_0xaf86('0x54')]({'where':_0x30f4fb,'include':[{'model':db[_0xaf86('0x13')],'attributes':['id',_0xaf86('0x17'),'email'],'include':[{'model':db[_0xaf86('0x55')],'as':_0xaf86('0x18'),'include':[{'model':db[_0xaf86('0x56')],'as':_0xaf86('0x56')}]}]}]})[_0xaf86('0xf')](function(_0xb34a8a){var _0x254b3e=_[_0xaf86('0x57')](manager[_0xaf86('0x58')]);var _0x187609=_[_0xaf86('0x59')](_0xb34a8a,function(_0x18fd62){return _0x18fd62['id'][_0xaf86('0x5a')]();});var _0x3ca1e4=_[_0xaf86('0x5b')](_0xb34a8a,function(_0x513bea){return _0x513bea['id'][_0xaf86('0x5a')]();});var _0x3f4ee3=_0x1960a4?_0x187609:_[_0xaf86('0x5c')](_0x187609,_0x254b3e);var _0x25e460=_[_0xaf86('0x5d')](_0x187609,_0x254b3e);var _0xc9091d=_[_0xaf86('0x5c')](_0x254b3e,_0x187609);var _0x27491f;var _0x32ad77;for(_0x27491f=0x0;_0x27491f<_0xc9091d[_0xaf86('0x5e')]&&!_0x1960a4;_0x27491f+=0x1){_0x32ad77=_0xc9091d[_0x27491f][_0xaf86('0x5a')]();if(manager[_0xaf86('0x5f')](_0x32ad77)){manager['stop'](_0x32ad77);manager['deleteJob'](_0x32ad77);logger['info']('delete\x20cron',_0x32ad77);}}logger[_0xaf86('0x2d')](_0xaf86('0x60'),JSON[_0xaf86('0x37')](_0x3f4ee3));for(_0x27491f=0x0;_0x27491f<_0x3f4ee3[_0xaf86('0x5e')];_0x27491f+=0x1){_0x32ad77=_0x3f4ee3[_0x27491f][_0xaf86('0x5a')]();if(_0x1960a4){logger['info'](JSON[_0xaf86('0x37')](_0x3ca1e4[_0x32ad77]));BPromise[_0xaf86('0x61')]()[_0xaf86('0xf')](handleJob(_0x3ca1e4[_0x32ad77]));logger[_0xaf86('0x2d')]('run\x20job',_0x3ca1e4[_0x32ad77][_0xaf86('0x17')],_0x3ca1e4[_0x32ad77][_0xaf86('0x62')]);}else if(_0x3ca1e4[_0x32ad77][_0xaf86('0x62')]&&_0x3ca1e4[_0x32ad77][_0xaf86('0x63')]&&moment()[_0xaf86('0x64')](_0x3ca1e4[_0x32ad77]['startAt'],_0x3ca1e4[_0x32ad77][_0xaf86('0x65')])){manager[_0xaf86('0x66')](_0x32ad77,_0x3ca1e4[_0x32ad77][_0xaf86('0x62')],handleJob(_0x3ca1e4[_0x32ad77]));manager['start'](_0x32ad77);logger['info'](_0xaf86('0x67'),_0x3ca1e4[_0x32ad77][_0xaf86('0x17')],_0x3ca1e4[_0x32ad77][_0xaf86('0x62')]);}else if(manager[_0xaf86('0x5f')](_0x32ad77)){manager[_0xaf86('0x3d')](_0x32ad77);manager[_0xaf86('0x68')](_0x32ad77);logger['info']('stop\x20cron',_0x3ca1e4[_0x32ad77][_0xaf86('0x17')],_0x3ca1e4[_0x32ad77][_0xaf86('0x62')]);}}for(_0x27491f=0x0,_0x32ad77;_0x27491f<_0x25e460[_0xaf86('0x5e')]&&!_0x1960a4;_0x27491f+=0x1){_0x32ad77=_0x25e460[_0x27491f][_0xaf86('0x5a')]();if(manager[_0xaf86('0x5f')](_0x32ad77)){if(_0x3ca1e4[_0x32ad77][_0xaf86('0x62')]&&_0x3ca1e4[_0x32ad77][_0xaf86('0x63')]&&moment()['isBetween'](_0x3ca1e4[_0x32ad77][_0xaf86('0x69')],_0x3ca1e4[_0x32ad77][_0xaf86('0x65')])){manager[_0xaf86('0x6a')](_0x32ad77,_0x3ca1e4[_0x32ad77][_0xaf86('0x62')],handleJob(_0x3ca1e4[_0x32ad77]));logger['info'](_0xaf86('0x6b'),_0x3ca1e4[_0x32ad77][_0xaf86('0x17')],_0x3ca1e4[_0x32ad77]['cron']);}else{manager[_0xaf86('0x3d')](_0x32ad77);manager[_0xaf86('0x68')](_0x32ad77);logger[_0xaf86('0x2d')](_0xaf86('0x6c'),_0x3ca1e4[_0x32ad77][_0xaf86('0x17')],_0x3ca1e4[_0x32ad77][_0xaf86('0x62')]);}}}})[_0xaf86('0x36')](function(_0x52ba19){logger[_0xaf86('0x10')](JSON[_0xaf86('0x37')](_0x52ba19));});}exports[_0xaf86('0x6d')]=function(_0x31396a){return getJobs(_0x31396a);};exports[_0xaf86('0x6e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xbdaa=['subtractNumber\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','CloudProvider','jobs','map','toString','difference','intersection','deleteJob','delete\x20cron','toRun','length','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','client','number','AnalyticExtractedReport','findOne','then','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','subtractNumber','join','../../files/reports','savename','basename','extname','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','error','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','catch','case\x20loading','currentAttempt','retryOptions','retries','job','operation','stop','still\x20loading','case\x20empty','data','case\x20failed','Unrecognized\x20status:','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil'];(function(_0x50b650,_0x7839f9){var _0x5a5ef7=function(_0xaa74d4){while(--_0xaa74d4){_0x50b650['push'](_0x50b650['shift']());}};_0x5a5ef7(++_0x7839f9);}(_0xbdaa,0x1ca));var _0xabda=function(_0x2c0df7,_0x2f3a55){_0x2c0df7=_0x2c0df7-0x0;var _0x411bed=_0xbdaa[_0x2c0df7];return _0x411bed;};'use strict';var fs=require('fs');var util=require(_0xabda('0x0'));var path=require(_0xabda('0x1'));var _=require(_0xabda('0x2'));var moment=require(_0xabda('0x3'));var CronJobManager=require(_0xabda('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0xabda('0x5'));var logger=require(_0xabda('0x6'))(_0xabda('0x7'));var db=require(_0xabda('0x8'))['db'];const retry=require(_0xabda('0x9'));var analyticCustomReportController=require(_0xabda('0xa'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xabda('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x5d258d){const _0x156334={};if(typeof _0x5d258d===_0xabda('0xc')){_0x156334['id']=_0x5d258d;}return db[_0xabda('0xd')][_0xabda('0xe')]({'where':_0x156334})[_0xabda('0xf')](function(_0x259e59){return _0x259e59;})['catch'](function(_0x4eb5bf){logger['error'](_0x4eb5bf);});}function handleSendEmail(_0x3d470a,_0xf4e8a1){logger[_0xabda('0x10')](_0xabda('0x11'),_0x3d470a[_0xabda('0x12')]);var _0x1af84e=!![];var _0x3ce4c4=_0x3d470a[_0xabda('0x13')][_0xabda('0x14')]();var _0x3b4bb2={'account':_0x3ce4c4,'message':{'from':util[_0xabda('0x15')](_0xabda('0x16'),_0x3d470a[_0xabda('0x13')][_0xabda('0x17')],_0x3d470a[_0xabda('0x13')][_0xabda('0x12')]||_0x3d470a['MailAccount'][_0xabda('0x18')][_0xabda('0x19')]),'to':_0x3d470a[_0xabda('0x12')],'cc':_0x3d470a['cc'],'bcc':_0x3d470a[_0xabda('0x1a')],'subject':util[_0xabda('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0xf4e8a1[_0xabda('0x17')],_0x3d470a[_0xabda('0x1b')],_0x3d470a['subtractUnit'])}};var _0x35d06f=path[_0xabda('0x1c')](__dirname,_0xabda('0x1d'));var _0x32a816=_0xf4e8a1[_0xabda('0x1e')];var _0x2db7fe=util[_0xabda('0x15')]('%s.%s',path[_0xabda('0x1f')](_0xf4e8a1['savename'],path[_0xabda('0x20')](_0xf4e8a1[_0xabda('0x1e')])),'zip');var _0x432024=path[_0xabda('0x1c')](_0x35d06f,_0x32a816);var _0x1fef6f=path[_0xabda('0x1c')](_0x35d06f,_0x2db7fe);if(fs[_0xabda('0x21')](_0x432024)){_0xf4e8a1[_0xabda('0x22')]=_0xabda('0x23');_0x3b4bb2[_0xabda('0x24')][_0xabda('0x25')]=[{'filename':_0x32a816,'path':_0x432024}];_0x3b4bb2['message'][_0xabda('0x26')]=util[_0xabda('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xabda('0x27')](_0xf4e8a1,null,0x2));}else if(fs['existsSync'](_0x1fef6f)){_0xf4e8a1[_0xabda('0x22')]=_0xabda('0x23');_0x3b4bb2['message'][_0xabda('0x25')]=[{'filename':_0x2db7fe,'path':_0x1fef6f}];}else{if(_0xf4e8a1[_0xabda('0x22')]==='Empty'){_0x3b4bb2['message'][_0xabda('0x26')]=_0xabda('0x28');if(!_0x3d470a[_0xabda('0x29')]){_0x1af84e=![];logger[_0xabda('0x10')](_0xabda('0x2a'));}}else if(_0xf4e8a1[_0xabda('0x22')]===_0xabda('0x2b')){_0x3b4bb2[_0xabda('0x24')][_0xabda('0x26')]=_0xabda('0x2c');}else if(_0xf4e8a1[_0xabda('0x22')]===_0xabda('0x2d')){_0x3b4bb2[_0xabda('0x24')]['text']='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0xf4e8a1[_0xabda('0x22')]===_0xabda('0x2e')){_0x3b4bb2[_0xabda('0x24')][_0xabda('0x26')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0xabda('0x2f')](_0xabda('0x30'),_0xf4e8a1['status']);}}if(_0x1af84e){return client[_0xabda('0x31')](_0xabda('0x32'),_0x3b4bb2)[_0xabda('0xf')](function(_0x1e2d5a){if(_0x1e2d5a[_0xabda('0x2f')]){return logger['error'](_0xabda('0x33'),JSON[_0xabda('0x27')](_0x1e2d5a));}return logger[_0xabda('0x10')]('email\x20sent');})[_0xabda('0x34')](function(_0x13c4d3){return logger['error'](_0xabda('0x33'),JSON[_0xabda('0x27')](_0x13c4d3));});}}function handleError(){return function(_0x2c8f36){return logger['error'](JSON['stringify'](_0x2c8f36));};}function loading(_0x1daaf3){logger[_0xabda('0x10')](_0xabda('0x35'));if(_0x1daaf3[_0xabda('0x36')]===_0x1daaf3[_0xabda('0x37')][_0xabda('0x38')]){handleSendEmail(_0x1daaf3[_0xabda('0x39')],_0x1daaf3['data']);_0x1daaf3[_0xabda('0x3a')][_0xabda('0x3b')]();}else{_0x1daaf3[_0xabda('0x3a')][_0xabda('0x9')](_0xabda('0x3c'));}}function completed(_0x5c3d74){logger[_0xabda('0x10')]('case\x20completed');handleSendEmail(_0x5c3d74['job'],_0x5c3d74['data']);_0x5c3d74[_0xabda('0x3a')]['stop']();}function empty(_0x2ca057){logger[_0xabda('0x10')](_0xabda('0x3d'));handleSendEmail(_0x2ca057[_0xabda('0x39')],_0x2ca057[_0xabda('0x3e')]);_0x2ca057[_0xabda('0x3a')][_0xabda('0x3b')]();}function failed(_0xa4fe49){logger['info'](_0xabda('0x3f'));handleSendEmail(_0xa4fe49[_0xabda('0x39')],_0xa4fe49[_0xabda('0x3e')]);_0xa4fe49[_0xabda('0x3a')][_0xabda('0x3b')]();}function urecognized(_0x4c476b){logger[_0xabda('0x2f')](_0xabda('0x40'),_0x4c476b[_0xabda('0x41')][_0xabda('0x42')][_0xabda('0x22')]);_0x4c476b[_0xabda('0x3a')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2d3e57,_0x986739){const _0x1b5b42={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x570616=retry[_0xabda('0x3a')](_0x1b5b42);_0x570616['attempt'](_0x1ab349=>{logger['info'](_0xabda('0x43')+_0x2d3e57['id']+_0xabda('0x44')+_0x1ab349);try{getReportData(_0x986739['id'])[_0xabda('0xf')](function(_0x4b79f5){_0x986739=_0x4b79f5;logger['info'](_0xabda('0x45'),_0x4b79f5[_0xabda('0x42')]['status']);if(!reportStatusStrategies[_0x4b79f5[_0xabda('0x42')][_0xabda('0x22')]]){logger['error'](_0xabda('0x45'),_0x4b79f5[_0xabda('0x42')]['status']);_0x570616[_0xabda('0x9')]();}reportStatusStrategies[_0x4b79f5['dataValues'][_0xabda('0x22')]]({'operation':_0x570616,'currentAttempt':_0x1ab349,'retryOptions':_0x1b5b42,'job':_0x2d3e57,'data':_0x986739,'entity':_0x4b79f5});});}catch(_0x3b1b74){_0x570616[_0xabda('0x9')](_0x3b1b74);}});}function handleResult(_0xeda080){return function(_0x4288de){if(_0xeda080[_0xabda('0x46')]&&_0xeda080['MailAccount']&&_0xeda080[_0xabda('0x13')]['Smtp']&&!_['isNil'](_0xeda080['email'])){retryer(_0xeda080,_0x4288de);}};}function handleJob(_0x2239ec){return function(){try{if(_[_0xabda('0x47')](_0x2239ec[_0xabda('0x1b')])){return logger[_0xabda('0x10')](_0xabda('0x48'));}if(_['isNil'](_0x2239ec[_0xabda('0x49')])){return logger[_0xabda('0x10')]('subtractUnit\x20null\x20or\x20undefined');}var _0x115315={'startDate':moment()['subtract'](_0x2239ec[_0xabda('0x1b')],_0x2239ec[_0xabda('0x49')])['format'](_0xabda('0x4a')),'endDate':moment()[_0xabda('0x15')](_0xabda('0x4a')),'type':_0xabda('0x4b'),'output':_0x2239ec['output'],'name':_0x2239ec[_0xabda('0x17')]};if(!_['isNil'](_0x2239ec[_0xabda('0x4c')])){logger[_0xabda('0x10')](_0xabda('0x4d'),_0x2239ec['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x2239ec['DefaultReportId']},_0x115315)['then'](handleResult(_0x2239ec))[_0xabda('0x34')](handleError());}if(!_['isNil'](_0x2239ec[_0xabda('0x4e')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x2239ec[_0xabda('0x4e')]);return analyticCustomReportController[_0xabda('0x4f')]({'id':_0x2239ec['CustomReportId']},_0x115315)[_0xabda('0xf')](handleResult(_0x2239ec))['catch'](handleError());}}catch(_0x4e92b0){logger[_0xabda('0x2f')](JSON['stringify'](_0x4e92b0));}return logger['info'](_0xabda('0x50'));};}function getJobs(_0x27ed83){var _0x530cb3={};if(_0x27ed83){_0x530cb3['id']=_0x27ed83;}return db[_0xabda('0x51')][_0xabda('0x52')]({'where':_0x530cb3,'include':[{'model':db[_0xabda('0x13')],'attributes':['id','name',_0xabda('0x12')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xabda('0x53')],'as':_0xabda('0x53')}]}]}]})['then'](function(_0x1f4c90){var _0x101852=_['keys'](manager[_0xabda('0x54')]);var _0x5dc59a=_[_0xabda('0x55')](_0x1f4c90,function(_0xbccdc6){return _0xbccdc6['id'][_0xabda('0x56')]();});var _0x64d8af=_['keyBy'](_0x1f4c90,function(_0x13fd8c){return _0x13fd8c['id']['toString']();});var _0xeeabf1=_0x27ed83?_0x5dc59a:_[_0xabda('0x57')](_0x5dc59a,_0x101852);var _0x4f93c7=_[_0xabda('0x58')](_0x5dc59a,_0x101852);var _0x44099d=_['difference'](_0x101852,_0x5dc59a);var _0x493716;var _0x3654cd;for(_0x493716=0x0;_0x493716<_0x44099d['length']&&!_0x27ed83;_0x493716+=0x1){_0x3654cd=_0x44099d[_0x493716][_0xabda('0x56')]();if(manager['exists'](_0x3654cd)){manager[_0xabda('0x3b')](_0x3654cd);manager[_0xabda('0x59')](_0x3654cd);logger['info'](_0xabda('0x5a'),_0x3654cd);}}logger[_0xabda('0x10')](_0xabda('0x5b'),JSON[_0xabda('0x27')](_0xeeabf1));for(_0x493716=0x0;_0x493716<_0xeeabf1[_0xabda('0x5c')];_0x493716+=0x1){_0x3654cd=_0xeeabf1[_0x493716][_0xabda('0x56')]();if(_0x27ed83){logger[_0xabda('0x10')](JSON[_0xabda('0x27')](_0x64d8af[_0x3654cd]));BPromise[_0xabda('0x5d')]()[_0xabda('0xf')](handleJob(_0x64d8af[_0x3654cd]));logger[_0xabda('0x10')]('run\x20job',_0x64d8af[_0x3654cd][_0xabda('0x17')],_0x64d8af[_0x3654cd][_0xabda('0x5e')]);}else if(_0x64d8af[_0x3654cd][_0xabda('0x5e')]&&_0x64d8af[_0x3654cd][_0xabda('0x5f')]&&moment()[_0xabda('0x60')](_0x64d8af[_0x3654cd][_0xabda('0x61')],_0x64d8af[_0x3654cd][_0xabda('0x62')])){manager[_0xabda('0x63')](_0x3654cd,_0x64d8af[_0x3654cd]['cron'],handleJob(_0x64d8af[_0x3654cd]));manager[_0xabda('0x64')](_0x3654cd);logger[_0xabda('0x10')](_0xabda('0x65'),_0x64d8af[_0x3654cd][_0xabda('0x17')],_0x64d8af[_0x3654cd][_0xabda('0x5e')]);}else if(manager[_0xabda('0x66')](_0x3654cd)){manager[_0xabda('0x3b')](_0x3654cd);manager[_0xabda('0x59')](_0x3654cd);logger[_0xabda('0x10')]('stop\x20cron',_0x64d8af[_0x3654cd][_0xabda('0x17')],_0x64d8af[_0x3654cd][_0xabda('0x5e')]);}}for(_0x493716=0x0,_0x3654cd;_0x493716<_0x4f93c7['length']&&!_0x27ed83;_0x493716+=0x1){_0x3654cd=_0x4f93c7[_0x493716]['toString']();if(manager[_0xabda('0x66')](_0x3654cd)){if(_0x64d8af[_0x3654cd][_0xabda('0x5e')]&&_0x64d8af[_0x3654cd][_0xabda('0x5f')]&&moment()['isBetween'](_0x64d8af[_0x3654cd][_0xabda('0x61')],_0x64d8af[_0x3654cd][_0xabda('0x62')])){manager[_0xabda('0x67')](_0x3654cd,_0x64d8af[_0x3654cd][_0xabda('0x5e')],handleJob(_0x64d8af[_0x3654cd]));logger[_0xabda('0x10')](_0xabda('0x68'),_0x64d8af[_0x3654cd][_0xabda('0x17')],_0x64d8af[_0x3654cd]['cron']);}else{manager[_0xabda('0x3b')](_0x3654cd);manager['deleteJob'](_0x3654cd);logger[_0xabda('0x10')]('stop\x20cron',_0x64d8af[_0x3654cd]['name'],_0x64d8af[_0x3654cd][_0xabda('0x5e')]);}}}})['catch'](function(_0x239b0c){logger['error'](JSON['stringify'](_0x239b0c));});}exports[_0xabda('0x69')]=function(_0x11d6cf){return getJobs(_0x11d6cf);};exports['start']=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 a9fff15..e8a79a9 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 _0xe9ad=['TranscriptionJob','fileText','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','sentiment','findOne','update','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','bucket','Transcribe\x20not\x20configured','push','all','error','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xe9ad,0x82));var _0xde9a=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0xe9ad[_0x48b5e0];return _0x4287ea;};var _=require(_0xde9a('0x0'));var AWS=require(_0xde9a('0x1'));var rp=require(_0xde9a('0x2'));var util=require(_0xde9a('0x3'));var BPromise=require(_0xde9a('0x4'));var db=require(_0xde9a('0x5'))['db'];var logger=require(_0xde9a('0x6'))('transcribe');function getTranscriptionJob(_0x30a58a,_0x28f94c,_0x1a17f6,_0x3908cd){return new Promise(function(_0x5290c5,_0x27b380){var _0x2bb666=new AWS[(_0xde9a('0x7'))]({'accessKeyId':_0x28f94c,'secretAccessKey':_0x30a58a,'region':_0x1a17f6});_0x2bb666['getTranscriptionJob']({'TranscriptionJobName':_0x3908cd},function(_0x45d4a7,_0x17f89b){if(_0x45d4a7){return _0x27b380(_0x45d4a7);}else{return _0x5290c5(_0x17f89b);}});});}function sentiment(_0x30e166,_0x1fac02,_0x297975,_0x34cd1a,_0x3c34ce){return new Promise(function(_0x2eb2ae,_0x2fe8b2){var _0x5863e0=new AWS[(_0xde9a('0x8'))]({'accessKeyId':_0x1fac02,'secretAccessKey':_0x30e166,'region':_0x297975});_0x5863e0[_0xde9a('0x9')]({'Text':_0x34cd1a,'LanguageCode':_0x3c34ce[_0xde9a('0xa')](0x0,0x2)},function(_0xad9b52,_0x34bbfd){if(_0xad9b52){return _0x2fe8b2(_0xad9b52);}else{return _0x2eb2ae(_0x34bbfd);}});});}function checkTranscribeJob(_0x2f0859,_0x1cb3bd,_0x3a9b1a){var _0xd81956;return new BPromise(function(_0x543346,_0x241bfa){logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0xd'),_0x2f0859['id'],_0x2f0859[_0xde9a('0xe')]));return getTranscriptionJob(_0x3a9b1a[_0xde9a('0xf')],_0x3a9b1a[_0xde9a('0x10')],_0x1cb3bd[_0xde9a('0x11')],_0x2f0859[_0xde9a('0xe')])[_0xde9a('0x12')](function(_0x50ffb8){logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x13'),_0x2f0859['id'],_0x2f0859[_0xde9a('0xe')],_0x50ffb8[_0xde9a('0x14')]['TranscriptionJobStatus']));if(!_0x2f0859[_0xde9a('0x15')]){switch(_0x50ffb8[_0xde9a('0x14')][_0xde9a('0x16')]){case'COMPLETED':var _0x2e96ee={'transcribeStatus':_0x50ffb8['TranscriptionJob'][_0xde9a('0x16')],'fileUri':_0x50ffb8['TranscriptionJob'][_0xde9a('0x17')][_0xde9a('0x18')]};logger[_0xde9a('0xb')](util['format'](_0xde9a('0x19'),_0x2f0859['id']));return rp({'uri':_0x50ffb8[_0xde9a('0x14')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0xde9a('0x12')](function(_0x416b36){logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x1a'),_0x2f0859['id']));if(_0x416b36&&_0x416b36[_0xde9a('0x1b')]&&_0x416b36[_0xde9a('0x1b')][_0xde9a('0x1c')]&&_0x416b36[_0xde9a('0x1b')][_0xde9a('0x1c')][_0xde9a('0x1d')]){_0x2e96ee[_0xde9a('0x15')]='';for(var _0x2fa60c=0x0;_0x2fa60c<_0x416b36[_0xde9a('0x1b')][_0xde9a('0x1c')][_0xde9a('0x1d')];_0x2fa60c++){_0x2e96ee[_0xde9a('0x15')]+=_0x416b36[_0xde9a('0x1b')][_0xde9a('0x1c')][_0x2fa60c]['transcript']+'';}}return _0x2f0859['update'](_0x2e96ee);})[_0xde9a('0x12')](function(){logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x1e'),_0x2f0859['id']));if(!_0x2f0859['tempSentiment']){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x21'));}if(!_0x1cb3bd['sentiment']||!_0x1cb3bd[_0xde9a('0x22')]||!_0x1cb3bd['sentimentRegion']||!_0x1cb3bd[_0xde9a('0x23')]||!_0x1cb3bd['bucket']){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x24'));}if(!_0x2e96ee[_0xde9a('0x15')]){throw new Error(_0xde9a('0x25'));}if(_0x1cb3bd[_0xde9a('0x22')]===_0x3a9b1a['id']){return _0x3a9b1a;}else{return db[_0xde9a('0x26')]['findOne']({'where':{'id':_settings[_0xde9a('0x22')]}});}})[_0xde9a('0x12')](function(_0x25d7f1){if(!_0x25d7f1){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x27'));}if(!_0x25d7f1[_0xde9a('0xf')]||!_0x25d7f1[_0xde9a('0x10')]){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x28'));}_0xd81956=_0x25d7f1;logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x29'),_0x2f0859['id']));return sentiment(_0xd81956['data1'],_0xd81956['data2'],_0x1cb3bd[_0xde9a('0x2a')],_0x2e96ee['fileText'],_0x1cb3bd[_0xde9a('0x23')]);})[_0xde9a('0x12')](function(_0x58e973){logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x2b'),_0x2f0859['id']));return _0x2f0859['update']({'sentiment':_0x58e973['Sentiment'],'sPositive':_0x58e973[_0xde9a('0x2c')][_0xde9a('0x2d')],'sNegative':_0x58e973['SentimentScore'][_0xde9a('0x2e')],'sMixed':_0x58e973[_0xde9a('0x2c')][_0xde9a('0x2f')],'sNeutral':_0x58e973[_0xde9a('0x2c')][_0xde9a('0x30')]});})[_0xde9a('0x12')](function(){logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x1e'),_0x2f0859['id']));_0x543346();});case _0xde9a('0x31'):return _0x2f0859['update']({'transcribeStatus':_0xde9a('0x31'),'failureReason':_0x50ffb8[_0xde9a('0x14')][_0xde9a('0x32')]})[_0xde9a('0x12')](function(){logger['info'](util[_0xde9a('0xc')](_0xde9a('0x1e'),_0x2f0859['id']));_0x543346();});default:logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x33'),_0x2f0859['id']));break;}}else{return BPromise[_0xde9a('0x34')]()['then'](function(){if(!_0x2f0859[_0xde9a('0x35')]){throw new db[(_0xde9a('0x1f'))]['ValidationError'](_0xde9a('0x21'));}if(!_0x1cb3bd[_0xde9a('0x36')]||!_0x1cb3bd[_0xde9a('0x22')]||!_0x1cb3bd[_0xde9a('0x2a')]||!_0x1cb3bd[_0xde9a('0x23')]||!_0x1cb3bd['bucket']){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x24'));}if(!_0x2f0859[_0xde9a('0x15')]){throw new Error(_0xde9a('0x25'));}if(_0x1cb3bd[_0xde9a('0x22')]===_0x3a9b1a['id']){return _0x3a9b1a;}else{return db[_0xde9a('0x26')][_0xde9a('0x37')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xde9a('0x12')](function(_0x990840){if(!_0x990840){throw new db['Sequelize'][(_0xde9a('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x990840[_0xde9a('0xf')]||!_0x990840[_0xde9a('0x10')]){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x28'));}_0xd81956=_0x990840;logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x29'),_0x2f0859['id']));return sentiment(_0xd81956['data1'],_0xd81956['data2'],_0x1cb3bd[_0xde9a('0x2a')],_0x2f0859[_0xde9a('0x15')],_0x1cb3bd['language']);})['then'](function(_0x48fb78){logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x2b'),_0x2f0859['id']));return _0x2f0859[_0xde9a('0x38')]({'sentiment':_0x48fb78['Sentiment'],'sPositive':_0x48fb78[_0xde9a('0x2c')]['Positive'],'sNegative':_0x48fb78['SentimentScore'][_0xde9a('0x2e')],'sMixed':_0x48fb78[_0xde9a('0x2c')]['Mixed'],'sNeutral':_0x48fb78[_0xde9a('0x2c')][_0xde9a('0x30')],'transcribeStatus':'COMPLETED'});})[_0xde9a('0x12')](function(){logger[_0xde9a('0xb')](util[_0xde9a('0xc')](_0xde9a('0x1e'),_0x2f0859['id']));_0x543346();});}})[_0xde9a('0x39')](function(_0x2ae999){if(_0x2ae999){if(!_0x2ae999[_0xde9a('0x3a')]||_0x2ae999['name']!==_0xde9a('0x3b')){logger['error'](util['format'](_0xde9a('0x3c'),_0x2f0859['id']),util[_0xde9a('0x3d')](_0x2ae999,{'showHidden':![],'depth':null}));}}_0x543346();});});}function checkTranscribe(){var _0x37b8d8;var _0x97d560;var _0x31de98;return db[_0xde9a('0x3e')][_0xde9a('0x3f')]({'where':{'transcribeStatus':_0xde9a('0x40')}})[_0xde9a('0x12')](function(_0x3fe19b){if(!_0x3fe19b||!_0x3fe19b[_0xde9a('0x1d')]){throw new db[(_0xde9a('0x1f'))]['ValidationError'](_0xde9a('0x41'));}_0x37b8d8=_0x3fe19b;return db[_0xde9a('0x42')][_0xde9a('0x37')]({'where':{'id':0x1}});})[_0xde9a('0x12')](function(_0xc6d00b){if(!_0xc6d00b){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x43'));}_0x97d560=_0xc6d00b;if(!_0x97d560[_0xde9a('0x44')]||!_0x97d560[_0xde9a('0x45')]||!_0x97d560['transcribeRegion']||!_0x97d560['language']||!_0x97d560[_0xde9a('0x46')]){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x47'));}return db['CloudProvider'][_0xde9a('0x37')]({'where':{'id':_0x97d560[_0xde9a('0x45')]}});})[_0xde9a('0x12')](function(_0x4872f6){if(!_0x4872f6){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4872f6[_0xde9a('0xf')]||!_0x4872f6[_0xde9a('0x10')]){throw new db[(_0xde9a('0x1f'))][(_0xde9a('0x20'))](_0xde9a('0x28'));}_0x31de98=_0x4872f6;var _0x13be60=[];_0x37b8d8['forEach'](function(_0x4f2e61){_0x13be60[_0xde9a('0x48')](checkTranscribeJob(_0x4f2e61,_0x97d560,_0x31de98));});return BPromise[_0xde9a('0x49')](_0x13be60);})['catch'](function(_0x27c68d){if(_0x27c68d){if(!_0x27c68d['name']||_0x27c68d[_0xde9a('0x3a')]!=='SequelizeValidationError'){logger[_0xde9a('0x4a')](util[_0xde9a('0x3d')](_0x27c68d,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xf2a6=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','fileText','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','update','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Neutral','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','start','lodash','bluebird','../../config/logger','transcribe','TranscribeService','detectSentiment','info','format'];(function(_0x117576,_0x1ced1a){var _0x4533f5=function(_0x19bc33){while(--_0x19bc33){_0x117576['push'](_0x117576['shift']());}};_0x4533f5(++_0x1ced1a);}(_0xf2a6,0x13d));var _0x6f2a=function(_0xf051ee,_0x3959e1){_0xf051ee=_0xf051ee-0x0;var _0x3acfd8=_0xf2a6[_0xf051ee];return _0x3acfd8;};var _=require(_0x6f2a('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0x6f2a('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x6f2a('0x2'))(_0x6f2a('0x3'));function getTranscriptionJob(_0x454ff7,_0x32ddb6,_0x1b4af5,_0x21a7db){return new Promise(function(_0x4684f4,_0x19ebe9){var _0x1efd8=new AWS[(_0x6f2a('0x4'))]({'accessKeyId':_0x32ddb6,'secretAccessKey':_0x454ff7,'region':_0x1b4af5});_0x1efd8['getTranscriptionJob']({'TranscriptionJobName':_0x21a7db},function(_0x379b80,_0xda4179){if(_0x379b80){return _0x19ebe9(_0x379b80);}else{return _0x4684f4(_0xda4179);}});});}function sentiment(_0x372663,_0x28ac69,_0x5b1229,_0x2fabc5,_0x5663e2){return new Promise(function(_0x310635,_0x601b21){var _0x396cb9=new AWS['Comprehend']({'accessKeyId':_0x28ac69,'secretAccessKey':_0x372663,'region':_0x5b1229});_0x396cb9[_0x6f2a('0x5')]({'Text':_0x2fabc5,'LanguageCode':_0x5663e2['substring'](0x0,0x2)},function(_0x231691,_0x398822){if(_0x231691){return _0x601b21(_0x231691);}else{return _0x310635(_0x398822);}});});}function checkTranscribeJob(_0x1c2665,_0x59df4e,_0x46a54f){var _0x4f1b32;return new BPromise(function(_0x1df919,_0x45eab9){logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')](_0x6f2a('0x8'),_0x1c2665['id'],_0x1c2665['transcribeName']));return getTranscriptionJob(_0x46a54f[_0x6f2a('0x9')],_0x46a54f[_0x6f2a('0xa')],_0x59df4e[_0x6f2a('0xb')],_0x1c2665[_0x6f2a('0xc')])[_0x6f2a('0xd')](function(_0x3dfc44){logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')](_0x6f2a('0xe'),_0x1c2665['id'],_0x1c2665[_0x6f2a('0xc')],_0x3dfc44[_0x6f2a('0xf')][_0x6f2a('0x10')]));if(!_0x1c2665['fileText']){switch(_0x3dfc44[_0x6f2a('0xf')][_0x6f2a('0x10')]){case _0x6f2a('0x11'):var _0x1ff155={'transcribeStatus':_0x3dfc44[_0x6f2a('0xf')][_0x6f2a('0x10')],'fileUri':_0x3dfc44[_0x6f2a('0xf')][_0x6f2a('0x12')][_0x6f2a('0x13')]};logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')]('[RECORDING:%d]\x20Get\x20transcript',_0x1c2665['id']));return rp({'uri':_0x3dfc44[_0x6f2a('0xf')][_0x6f2a('0x12')][_0x6f2a('0x13')],'json':!![]})[_0x6f2a('0xd')](function(_0x1da29f){logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x1c2665['id']));if(_0x1da29f&&_0x1da29f[_0x6f2a('0x14')]&&_0x1da29f['results'][_0x6f2a('0x15')]&&_0x1da29f[_0x6f2a('0x14')][_0x6f2a('0x15')]['length']){_0x1ff155[_0x6f2a('0x16')]='';for(var _0xb7cd00=0x0;_0xb7cd00<_0x1da29f['results']['transcripts'][_0x6f2a('0x17')];_0xb7cd00++){_0x1ff155[_0x6f2a('0x16')]+=_0x1da29f[_0x6f2a('0x14')][_0x6f2a('0x15')][_0xb7cd00][_0x6f2a('0x18')]+'';}}return _0x1c2665['update'](_0x1ff155);})[_0x6f2a('0xd')](function(){logger['info'](util[_0x6f2a('0x7')](_0x6f2a('0x19'),_0x1c2665['id']));if(!_0x1c2665['tempSentiment']){throw new db[(_0x6f2a('0x1a'))][(_0x6f2a('0x1b'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x59df4e[_0x6f2a('0x1c')]||!_0x59df4e[_0x6f2a('0x1d')]||!_0x59df4e[_0x6f2a('0x1e')]||!_0x59df4e[_0x6f2a('0x1f')]||!_0x59df4e[_0x6f2a('0x20')]){throw new db[(_0x6f2a('0x1a'))][(_0x6f2a('0x1b'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1ff155[_0x6f2a('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x59df4e[_0x6f2a('0x1d')]===_0x46a54f['id']){return _0x46a54f;}else{return db['CloudProvider'][_0x6f2a('0x21')]({'where':{'id':_settings[_0x6f2a('0x1d')]}});}})[_0x6f2a('0xd')](function(_0x53eb10){if(!_0x53eb10){throw new db[(_0x6f2a('0x1a'))]['ValidationError'](_0x6f2a('0x22'));}if(!_0x53eb10[_0x6f2a('0x9')]||!_0x53eb10['data2']){throw new db[(_0x6f2a('0x1a'))][(_0x6f2a('0x1b'))](_0x6f2a('0x23'));}_0x4f1b32=_0x53eb10;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1c2665['id']));return sentiment(_0x4f1b32[_0x6f2a('0x9')],_0x4f1b32['data2'],_0x59df4e[_0x6f2a('0x1e')],_0x1ff155[_0x6f2a('0x16')],_0x59df4e['language']);})[_0x6f2a('0xd')](function(_0x277e8f){logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1c2665['id']));return _0x1c2665[_0x6f2a('0x24')]({'sentiment':_0x277e8f['Sentiment'],'sPositive':_0x277e8f[_0x6f2a('0x25')][_0x6f2a('0x26')],'sNegative':_0x277e8f[_0x6f2a('0x25')][_0x6f2a('0x27')],'sMixed':_0x277e8f[_0x6f2a('0x25')][_0x6f2a('0x28')],'sNeutral':_0x277e8f[_0x6f2a('0x25')]['Neutral']});})[_0x6f2a('0xd')](function(){logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')](_0x6f2a('0x19'),_0x1c2665['id']));_0x1df919();});case _0x6f2a('0x29'):return _0x1c2665[_0x6f2a('0x24')]({'transcribeStatus':_0x6f2a('0x29'),'failureReason':_0x3dfc44[_0x6f2a('0xf')][_0x6f2a('0x2a')]})[_0x6f2a('0xd')](function(){logger[_0x6f2a('0x6')](util['format'](_0x6f2a('0x19'),_0x1c2665['id']));_0x1df919();});default:logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1c2665['id']));break;}}else{return BPromise[_0x6f2a('0x2b')]()[_0x6f2a('0xd')](function(){if(!_0x1c2665[_0x6f2a('0x2c')]){throw new db[(_0x6f2a('0x1a'))][(_0x6f2a('0x1b'))](_0x6f2a('0x2d'));}if(!_0x59df4e[_0x6f2a('0x1c')]||!_0x59df4e[_0x6f2a('0x1d')]||!_0x59df4e[_0x6f2a('0x1e')]||!_0x59df4e[_0x6f2a('0x1f')]||!_0x59df4e[_0x6f2a('0x20')]){throw new db['Sequelize'][(_0x6f2a('0x1b'))](_0x6f2a('0x2e'));}if(!_0x1c2665[_0x6f2a('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x59df4e[_0x6f2a('0x1d')]===_0x46a54f['id']){return _0x46a54f;}else{return db[_0x6f2a('0x2f')][_0x6f2a('0x21')]({'where':{'id':_settings[_0x6f2a('0x1d')]}});}})[_0x6f2a('0xd')](function(_0x2c5fbb){if(!_0x2c5fbb){throw new db[(_0x6f2a('0x1a'))][(_0x6f2a('0x1b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2c5fbb[_0x6f2a('0x9')]||!_0x2c5fbb['data2']){throw new db['Sequelize'][(_0x6f2a('0x1b'))](_0x6f2a('0x23'));}_0x4f1b32=_0x2c5fbb;logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1c2665['id']));return sentiment(_0x4f1b32[_0x6f2a('0x9')],_0x4f1b32[_0x6f2a('0xa')],_0x59df4e[_0x6f2a('0x1e')],_0x1c2665[_0x6f2a('0x16')],_0x59df4e[_0x6f2a('0x1f')]);})[_0x6f2a('0xd')](function(_0x47d221){logger[_0x6f2a('0x6')](util[_0x6f2a('0x7')](_0x6f2a('0x30'),_0x1c2665['id']));return _0x1c2665[_0x6f2a('0x24')]({'sentiment':_0x47d221[_0x6f2a('0x31')],'sPositive':_0x47d221[_0x6f2a('0x25')]['Positive'],'sNegative':_0x47d221['SentimentScore'][_0x6f2a('0x27')],'sMixed':_0x47d221['SentimentScore'][_0x6f2a('0x28')],'sNeutral':_0x47d221['SentimentScore'][_0x6f2a('0x32')],'transcribeStatus':_0x6f2a('0x11')});})['then'](function(){logger['info'](util['format'](_0x6f2a('0x19'),_0x1c2665['id']));_0x1df919();});}})['catch'](function(_0x4e726b){if(_0x4e726b){if(!_0x4e726b[_0x6f2a('0x33')]||_0x4e726b[_0x6f2a('0x33')]!==_0x6f2a('0x34')){logger[_0x6f2a('0x35')](util['format'](_0x6f2a('0x36'),_0x1c2665['id']),util[_0x6f2a('0x37')](_0x4e726b,{'showHidden':![],'depth':null}));}}_0x1df919();});});}function checkTranscribe(){var _0x254233;var _0x364573;var _0x3d8f60;return db[_0x6f2a('0x38')]['findAll']({'where':{'transcribeStatus':_0x6f2a('0x39')}})[_0x6f2a('0xd')](function(_0x2ae19b){if(!_0x2ae19b||!_0x2ae19b[_0x6f2a('0x17')]){throw new db[(_0x6f2a('0x1a'))][(_0x6f2a('0x1b'))]('No\x20transcribe\x20job\x20to\x20check');}_0x254233=_0x2ae19b;return db[_0x6f2a('0x3a')][_0x6f2a('0x21')]({'where':{'id':0x1}});})[_0x6f2a('0xd')](function(_0x5e72fe){if(!_0x5e72fe){throw new db['Sequelize'][(_0x6f2a('0x1b'))](_0x6f2a('0x3b'));}_0x364573=_0x5e72fe;if(!_0x364573[_0x6f2a('0x3')]||!_0x364573[_0x6f2a('0x3c')]||!_0x364573[_0x6f2a('0xb')]||!_0x364573[_0x6f2a('0x1f')]||!_0x364573[_0x6f2a('0x20')]){throw new db[(_0x6f2a('0x1a'))][(_0x6f2a('0x1b'))](_0x6f2a('0x3d'));}return db[_0x6f2a('0x2f')][_0x6f2a('0x21')]({'where':{'id':_0x364573[_0x6f2a('0x3c')]}});})['then'](function(_0x2c26fc){if(!_0x2c26fc){throw new db['Sequelize'][(_0x6f2a('0x1b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2c26fc[_0x6f2a('0x9')]||!_0x2c26fc['data2']){throw new db[(_0x6f2a('0x1a'))][(_0x6f2a('0x1b'))](_0x6f2a('0x23'));}_0x3d8f60=_0x2c26fc;var _0x4a89a3=[];_0x254233[_0x6f2a('0x3e')](function(_0x5314a2){_0x4a89a3[_0x6f2a('0x3f')](checkTranscribeJob(_0x5314a2,_0x364573,_0x3d8f60));});return BPromise['all'](_0x4a89a3);})['catch'](function(_0x2e0078){if(_0x2e0078){if(!_0x2e0078[_0x6f2a('0x33')]||_0x2e0078[_0x6f2a('0x33')]!==_0x6f2a('0x34')){logger[_0x6f2a('0x35')](util[_0x6f2a('0x37')](_0x2e0078,{'showHidden':![],'depth':null}));}}});}exports[_0x6f2a('0x40')]=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 512a3cf..e4698c1 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 _0x45ad=['../../config/environment','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','util'];(function(_0xb8ad82,_0x5b4c8f){var _0x55f0b8=function(_0x16ba28){while(--_0x16ba28){_0xb8ad82['push'](_0xb8ad82['shift']());}};_0x55f0b8(++_0x5b4c8f);}(_0x45ad,0x18a));var _0xd45a=function(_0x69752e,_0x2579f6){_0x69752e=_0x69752e-0x0;var _0x506a36=_0x45ad[_0x69752e];return _0x506a36;};'use strict';var _=require(_0xd45a('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xd45a('0x1'));var config=require(_0xd45a('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xd45a('0x3'))(_0xd45a('0x4'));config[_0xd45a('0x5')]=_[_0xd45a('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd45a('0x7'))(new Redis(config[_0xd45a('0x5')]));function closeInteractions(){var _0x58120e=[];return db[_0xd45a('0x8')][_0xd45a('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd45a('0xa')](0x18,_0xd45a('0xb'))}}})['then'](function(_0x40a64b){if(_0x40a64b&&_0x40a64b['length']){_0x58120e=_['map'](_0x40a64b||[],'id');logger['info'](_0xd45a('0xc'),_0x58120e[_0xd45a('0xd')]());return db[_0xd45a('0x8')][_0xd45a('0xe')]({'closeReason':'system','disposition':_0xd45a('0xf'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x58120e}});}})['then'](function(){if(_0x58120e&&_0x58120e['length']){logger[_0xd45a('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x58120e['join']());for(var _0xdb63c5=0x0;_0xdb63c5<_0x58120e['length'];_0xdb63c5++){io[_0xd45a('0x11')](_0xd45a('0x12'),{'id':_0x58120e[_0xdb63c5],'closed':!![]});}}})[_0xd45a('0x13')](function(_0x3c335a){logger[_0xd45a('0x14')](_0xd45a('0x15'),_0x3c335a?util['inspect'](_0x3c335a,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2a92=['lodash','moment','ioredis','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect'];(function(_0x548a37,_0x5f1aa5){var _0x4ce567=function(_0x58bdd5){while(--_0x58bdd5){_0x548a37['push'](_0x548a37['shift']());}};_0x4ce567(++_0x5f1aa5);}(_0x2a92,0x9c));var _0x22a9=function(_0x20feae,_0x31e753){_0x20feae=_0x20feae-0x0;var _0x5c3dd2=_0x2a92[_0x20feae];return _0x5c3dd2;};'use strict';var _=require(_0x22a9('0x0'));var moment=require(_0x22a9('0x1'));var Redis=require(_0x22a9('0x2'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0x22a9('0x3')]=_[_0x22a9('0x4')](config[_0x22a9('0x3')],{'host':_0x22a9('0x5'),'port':0x18eb});var io=require(_0x22a9('0x6'))(new Redis(config[_0x22a9('0x3')]));function closeInteractions(){var _0x2f4620=[];return db[_0x22a9('0x7')][_0x22a9('0x8')]({'raw':!![],'attributes':['id',_0x22a9('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x22a9('0xa')](0x18,'hours')}}})['then'](function(_0x30ed64){if(_0x30ed64&&_0x30ed64[_0x22a9('0xb')]){_0x2f4620=_[_0x22a9('0xc')](_0x30ed64||[],'id');logger[_0x22a9('0xd')](_0x22a9('0xe'),_0x2f4620[_0x22a9('0xf')]());return db[_0x22a9('0x7')][_0x22a9('0x10')]({'closeReason':_0x22a9('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x22a9('0x12')](_0x22a9('0x13'))},{'where':{'id':_0x2f4620}});}})['then'](function(){if(_0x2f4620&&_0x2f4620[_0x22a9('0xb')]){logger[_0x22a9('0xd')](_0x22a9('0x14'),_0x2f4620[_0x22a9('0xf')]());for(var _0x2a6c84=0x0;_0x2a6c84<_0x2f4620[_0x22a9('0xb')];_0x2a6c84++){io[_0x22a9('0x15')](_0x22a9('0x16'),{'id':_0x2f4620[_0x2a6c84],'closed':!![]});}}})[_0x22a9('0x17')](function(_0x2f9243){logger[_0x22a9('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2f9243?util[_0x22a9('0x19')](_0x2f9243,{'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 803e78e..574af29 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c3e=['log','finished\x20populating','contacts1','CmHopper','then','hopper1','contacts2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate'];(function(_0x1577d6,_0x1db963){var _0x5c2a4f=function(_0x523369){while(--_0x523369){_0x1577d6['push'](_0x1577d6['shift']());}};_0x5c2a4f(++_0x1db963);}(_0x3c3e,0x1a6));var _0xe3c3=function(_0x4c807c,_0x3e41c5){_0x4c807c=_0x4c807c-0x0;var _0xad2435=_0x3c3e[_0x4c807c];return _0xad2435;};'use strict';var util=require(_0xe3c3('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe3c3('0x1')]({'id':i,'firstName':_0xe3c3('0x2')+i,'lastName':_0xe3c3('0x3')+i,'phone':0xf879fb460+i,'email':_0xe3c3('0x4')+i+_0xe3c3('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe3c3('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe3c3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe3c3('0x6')](),'updatedAt':Date[_0xe3c3('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe3c3('0x1')]({'id':i,'firstName':_0xe3c3('0x2')+i,'lastName':_0xe3c3('0x3')+i,'phone':0xf879fb460+i,'email':_0xe3c3('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe3c3('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe3c3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe3c3('0x6')](),'updatedAt':Date[_0xe3c3('0x6')]()});}db[_0xe3c3('0x7')][_0xe3c3('0x8')]({'where':{}})['then'](function(){return db[_0xe3c3('0x7')][_0xe3c3('0x9')](contacts);})['then'](function(){console[_0xe3c3('0xa')](_0xe3c3('0xb'),_0xe3c3('0xc'));return db[_0xe3c3('0xd')][_0xe3c3('0x8')]({'where':{}});})[_0xe3c3('0xe')](function(){return db['CmHopper'][_0xe3c3('0x9')](hopper);})[_0xe3c3('0xe')](function(){console[_0xe3c3('0xa')](_0xe3c3('0xb'),_0xe3c3('0xf'));return db[_0xe3c3('0x7')][_0xe3c3('0x9')](contacts2);})[_0xe3c3('0xe')](function(){console[_0xe3c3('0xa')](_0xe3c3('0xb'),_0xe3c3('0x10'));return db['CmHopper'][_0xe3c3('0x9')](hopper2);})[_0xe3c3('0xe')](function(){console['log'](_0xe3c3('0xb'),'hopper2');})[_0xe3c3('0x11')](function(_0x380d26){console['log'](_0x380d26);}); \ No newline at end of file +var _0xc75d=['finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','contacts1','CmHopper','bulkCreate','hopper1'];(function(_0x38efe1,_0x34a883){var _0x44c9fb=function(_0x3cbfea){while(--_0x3cbfea){_0x38efe1['push'](_0x38efe1['shift']());}};_0x44c9fb(++_0x34a883);}(_0xc75d,0x1e4));var _0xdc75=function(_0x12b6fe,_0x44251f){_0x12b6fe=_0x12b6fe-0x0;var _0x202de2=_0xc75d[_0x12b6fe];return _0x202de2;};'use strict';var util=require(_0xdc75('0x0'));var db=require(_0xdc75('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xdc75('0x2')]({'id':i,'firstName':_0xdc75('0x3')+i,'lastName':_0xdc75('0x4')+i,'phone':0xf879fb460+i,'email':_0xdc75('0x5')+i+_0xdc75('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xdc75('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xdc75('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xdc75('0x7')](),'updatedAt':Date[_0xdc75('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xdc75('0x2')]({'id':i,'firstName':_0xdc75('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xdc75('0x5')+i+_0xdc75('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xdc75('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xdc75('0x7')](),'updatedAt':Date[_0xdc75('0x7')]()});}db[_0xdc75('0x8')][_0xdc75('0x9')]({'where':{}})[_0xdc75('0xa')](function(){return db[_0xdc75('0x8')]['bulkCreate'](contacts);})[_0xdc75('0xa')](function(){console[_0xdc75('0xb')]('finished\x20populating',_0xdc75('0xc'));return db[_0xdc75('0xd')][_0xdc75('0x9')]({'where':{}});})['then'](function(){return db[_0xdc75('0xd')][_0xdc75('0xe')](hopper);})[_0xdc75('0xa')](function(){console['log']('finished\x20populating',_0xdc75('0xf'));return db[_0xdc75('0x8')][_0xdc75('0xe')](contacts2);})[_0xdc75('0xa')](function(){console[_0xdc75('0xb')](_0xdc75('0x10'),_0xdc75('0x11'));return db['CmHopper'][_0xdc75('0xe')](hopper2);})['then'](function(){console['log'](_0xdc75('0x10'),_0xdc75('0x12'));})[_0xdc75('0x13')](function(_0x43f512){console[_0xdc75('0xb')](_0x43f512);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 56b7727..d961dde 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43aa=['agent','%s%s@xcally.com','password','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s'];(function(_0x56b7c1,_0x3ca4ea){var _0x4bc46a=function(_0x84e95c){while(--_0x84e95c){_0x56b7c1['push'](_0x56b7c1['shift']());}};_0x4bc46a(++_0x3ca4ea);}(_0x43aa,0x15b));var _0xa43a=function(_0x2c0750,_0x56f22){_0x2c0750=_0x2c0750-0x0;var _0x1f62d9=_0x43aa[_0x2c0750];return _0x1f62d9;};'use strict';var util=require(_0xa43a('0x0'));var db=require(_0xa43a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa43a('0x2')]({'name':util[_0xa43a('0x3')](_0xa43a('0x4'),_0xa43a('0x5'),i),'fullname':util[_0xa43a('0x3')]('%s%s','agent',i),'email':util[_0xa43a('0x3')](_0xa43a('0x6'),_0xa43a('0x5'),i),'role':_0xa43a('0x5'),'password':_0xa43a('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0xa43a('0x8'),'ws',_0xa43a('0x9')],'disallow':['all'],'allow':[_0xa43a('0xa')],'defaultuser':util[_0xa43a('0x3')]('%s%s',_0xa43a('0x5'),i),'encryption':_0xa43a('0xb'),'avpf':_0xa43a('0xb'),'force_avp':_0xa43a('0xb'),'icesupport':'yes','dtlsenable':_0xa43a('0xb'),'dtlsverify':'no','dtlscertfile':_0xa43a('0xc'),'dtlsprivatekey':_0xa43a('0xd'),'dtlssetup':_0xa43a('0xe'),'callerid':util['format'](_0xa43a('0xf'),util[_0xa43a('0x3')](_0xa43a('0x4'),_0xa43a('0x5'),i),0xfa0+i)});}db[_0xa43a('0x10')][_0xa43a('0x11')](users)[_0xa43a('0x12')](function(){console[_0xa43a('0x13')](_0xa43a('0x14'));})[_0xa43a('0x15')](function(_0x34210c){console[_0xa43a('0x13')](_0x34210c);}); \ No newline at end of file +var _0xf099=['actpass','\x22%s\x22\x20<%s>','bulkCreate','log','catch','util','../mysqldb','push','%s%s','format','agent','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xf099,0xa7));var _0x9f09=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0xf099[_0x4907de];return _0x482054;};'use strict';var util=require(_0x9f09('0x0'));var db=require(_0x9f09('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9f09('0x2')]({'name':util['format'](_0x9f09('0x3'),'agent',i),'fullname':util[_0x9f09('0x4')](_0x9f09('0x3'),_0x9f09('0x5'),i),'email':util[_0x9f09('0x4')]('%s%s@xcally.com','agent',i),'role':_0x9f09('0x5'),'password':_0x9f09('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x9f09('0x7'),'ws',_0x9f09('0x8')],'disallow':[_0x9f09('0x9')],'allow':[_0x9f09('0xa')],'defaultuser':util['format'](_0x9f09('0x3'),_0x9f09('0x5'),i),'encryption':_0x9f09('0xb'),'avpf':_0x9f09('0xb'),'force_avp':_0x9f09('0xb'),'icesupport':_0x9f09('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x9f09('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x9f09('0xd'),'callerid':util['format'](_0x9f09('0xe'),util[_0x9f09('0x4')](_0x9f09('0x3'),'agent',i),0xfa0+i)});}db['User'][_0x9f09('0xf')](users)['then'](function(){console[_0x9f09('0x10')]('add\x20user');})[_0x9f09('0x11')](function(_0x3d5e8a){console[_0x9f09('0x10')](_0x3d5e8a);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 904b7ad..0eeae2a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb875=['push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','SmsQueues','SmsQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','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','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','DISCONNECTED','CONNECTED','lodash','./environment','Agents','User','role','agent','name','telephone','type','ivr','UserProfileSection','findOne','then','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','include'];(function(_0x165480,_0x5c99e7){var _0x37f087=function(_0x19c553){while(--_0x19c553){_0x165480['push'](_0x165480['shift']());}};_0x37f087(++_0x5c99e7);}(_0xb875,0x167));var _0x5b87=function(_0x5bf542,_0x50999){_0x5bf542=_0x5bf542-0x0;var _0x201bf5=_0xb875[_0x5bf542];return _0x201bf5;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x5b87('0x1'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x5b87('0x2'),'model':db[_0x5b87('0x3')],'attributes':['id','name',_0x5b87('0x4')],'raw':!![],'where':{'role':_0x5b87('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5b87('0x6')],'where':{'role':_0x5b87('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5b87('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x5b87('0x6')],'where':{'role':_0x5b87('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5b87('0x6'),_0x5b87('0x8')],'where':{'type':_0x5b87('0x9')}};function getAssociatedResources(_0x493bb2,_0x20fc30,_0x537f81){return db[_0x5b87('0xa')][_0x5b87('0xb')]({'where':{'name':_0x493bb2,'userProfileId':_0x20fc30},'raw':!![]})[_0x5b87('0xc')](function(_0x22af59){if(_0x22af59){if(_0x22af59['autoAssociation']){switch(_0x493bb2){case'VoiceQueues':case _0x5b87('0xd'):case _0x5b87('0xe'):case'SmsQueues':case _0x5b87('0xf'):case _0x5b87('0x10'):case _0x5b87('0x11'):return db[_0x537f81][_0x5b87('0x12')](queryQueues);case _0x5b87('0x13'):return db[_0x537f81][_0x5b87('0x12')](queryTelephones);case _0x5b87('0x14'):return db[_0x537f81][_0x5b87('0x12')](queryTrunks);case _0x5b87('0x15'):return db[_0x537f81]['findAll'](queryCampaigns);}}else{return db[_0x5b87('0x16')]['findAll']({'attributes':[_0x5b87('0x17')],'where':{'sectionId':_0x22af59['id']},'raw':!![]})[_0x5b87('0xc')](function(_0x51ff4c){if(_0x51ff4c){var _0x59bf2b={'where':{'id':_[_0x5b87('0x18')](_0x51ff4c,'resourceId')},'raw':!![]};switch(_0x537f81){case _0x5b87('0x3'):_0x59bf2b[_0x5b87('0x19')][_0x5b87('0x4')]=_0x5b87('0x7');break;case _0x5b87('0x1a'):_0x59bf2b[_0x5b87('0x19')][_0x5b87('0x8')]='ivr';break;}return db[_0x537f81]['findAll'](_0x59bf2b);}else{return[];}});}}else{return[];}})['then'](function(_0x5ebe9f){return _0x5ebe9f;});}function joinOrLeaveQueues(_0x1b0f5a,_0x3b466c,_0x382157,_0x1b46cc){_0x1b0f5a[_0x3b466c](util[_0x5b87('0x1b')]('%s:queue:%s',_0x382157,_0x1b46cc[_0x5b87('0x6')]));if(_0x1b46cc['Agents']){for(var _0x5ac69f=0x0;_0x5ac69f<_0x1b46cc[_0x5b87('0x2')][_0x5b87('0x1c')];_0x5ac69f+=0x1){_0x1b0f5a[_0x3b466c](util['format'](_0x5b87('0x1d'),_0x1b46cc[_0x5b87('0x2')][_0x5ac69f][_0x5b87('0x6')]));}}}function joinOrLeave(_0x28a2a3,_0x360010,_0x2cb48e){var _0x1afe46;if(_0x28a2a3[_0x5b87('0x1e')][_0x5b87('0x1f')]['id']){db[_0x5b87('0x3')]['find']({'attributes':['id',_0x5b87('0x6'),_0x5b87('0x4'),_0x5b87('0x20')],'where':{'id':_0x28a2a3[_0x5b87('0x1e')][_0x5b87('0x1f')]['id']},'include':[{'model':db[_0x5b87('0x21')],'as':_0x5b87('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x5b87('0x23')],'as':_0x5b87('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x5b87('0x25')],'as':_0x5b87('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5b87('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5b87('0x28')],'as':_0x5b87('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x49f639){if(_0x49f639){_0x1afe46=_0x49f639;_0x28a2a3[_0x360010](util[_0x5b87('0x1b')](_0x5b87('0x1d'),_0x49f639[_0x5b87('0x6')]));var _0x2a2143=[];switch(_0x49f639[_0x5b87('0x4')]){case'admin':_0x28a2a3[_0x360010](_0x5b87('0x2a'));_0x28a2a3[_0x360010](_0x5b87('0x2b'));if(queryQueues['hasOwnProperty'](_0x5b87('0x2c'))){delete queryQueues['include'];}_0x2a2143[_0x5b87('0x2d')](db[_0x5b87('0x2e')][_0x5b87('0x12')](queryQueues));_0x2a2143['push'](db[_0x5b87('0x2f')][_0x5b87('0x12')](queryQueues));_0x2a2143[_0x5b87('0x2d')](db[_0x5b87('0x30')]['findAll'](queryQueues));_0x2a2143['push'](db['SmsQueue'][_0x5b87('0x12')](queryQueues));_0x2a2143['push'](db[_0x5b87('0x31')]['findAll'](queryQueues));_0x2a2143[_0x5b87('0x2d')](db[_0x5b87('0x32')]['findAll'](queryQueues));_0x2a2143[_0x5b87('0x2d')](db[_0x5b87('0x33')][_0x5b87('0x12')](queryQueues));_0x2a2143[_0x5b87('0x2d')](db['User'][_0x5b87('0x12')](queryTelephones));_0x2a2143[_0x5b87('0x2d')](db[_0x5b87('0x34')][_0x5b87('0x12')](queryTrunks));_0x2a2143[_0x5b87('0x2d')](db[_0x5b87('0x1a')][_0x5b87('0x12')](queryCampaigns));_0x2a2143[_0x5b87('0x2d')](db[_0x5b87('0x3')][_0x5b87('0x12')](queryAgents));break;case _0x5b87('0x35'):_0x28a2a3[_0x360010]('voice:inbound');_0x28a2a3[_0x360010](_0x5b87('0x2b'));_0x2a2143['push'](getAssociatedResources(_0x5b87('0x36'),_0x49f639[_0x5b87('0x20')],_0x5b87('0x2e')));_0x2a2143[_0x5b87('0x2d')](getAssociatedResources(_0x5b87('0xd'),_0x49f639[_0x5b87('0x20')],_0x5b87('0x2f')));_0x2a2143[_0x5b87('0x2d')](getAssociatedResources(_0x5b87('0xe'),_0x49f639[_0x5b87('0x20')],'FaxQueue'));_0x2a2143[_0x5b87('0x2d')](getAssociatedResources(_0x5b87('0x37'),_0x49f639['userProfileId'],_0x5b87('0x38')));_0x2a2143[_0x5b87('0x2d')](getAssociatedResources(_0x5b87('0xf'),_0x49f639[_0x5b87('0x20')],_0x5b87('0x31')));_0x2a2143['push'](getAssociatedResources(_0x5b87('0x10'),_0x49f639[_0x5b87('0x20')],_0x5b87('0x32')));_0x2a2143['push'](getAssociatedResources(_0x5b87('0x11'),_0x49f639[_0x5b87('0x20')],'WhatsappQueue'));_0x2a2143[_0x5b87('0x2d')](getAssociatedResources(_0x5b87('0x13'),_0x49f639[_0x5b87('0x20')],_0x5b87('0x3')));_0x2a2143['push'](getAssociatedResources(_0x5b87('0x14'),_0x49f639[_0x5b87('0x20')],_0x5b87('0x34')));_0x2a2143[_0x5b87('0x2d')](getAssociatedResources(_0x5b87('0x15'),_0x49f639['userProfileId'],_0x5b87('0x1a')));_0x2a2143[_0x5b87('0x2d')](db[_0x5b87('0x3')][_0x5b87('0x12')](queryAgents));break;case _0x5b87('0x5'):_0x28a2a3[_0x360010](_0x5b87('0x2a'));_0x28a2a3[_0x360010]('voice:outbound');_0x2a2143[_0x5b87('0x2d')](_0x49f639[_0x5b87('0x39')]({'attributes':['id','name']}));_0x2a2143[_0x5b87('0x2d')](_0x49f639[_0x5b87('0x3a')]({'attributes':['id',_0x5b87('0x6')]}));_0x2a2143['push'](_0x49f639[_0x5b87('0x3b')]({'attributes':['id',_0x5b87('0x6')]}));_0x2a2143[_0x5b87('0x2d')](_0x49f639[_0x5b87('0x3c')]({'attributes':['id',_0x5b87('0x6')]}));_0x2a2143['push'](_0x49f639[_0x5b87('0x3d')]({'attributes':['id',_0x5b87('0x6')]}));_0x2a2143[_0x5b87('0x2d')](_0x49f639[_0x5b87('0x3e')]({'attributes':['id',_0x5b87('0x6')]}));_0x2a2143['push'](_0x49f639[_0x5b87('0x3f')]({'attributes':['id',_0x5b87('0x6')]}));break;}return BPromise[_0x5b87('0x40')](_0x2a2143);}})[_0x5b87('0xc')](function(_0x4bda90){if(_0x4bda90&&_0x4bda90[_0x5b87('0x1c')]){for(var _0x394085=0x0;_0x394085<_0x4bda90[_0x5b87('0x1c')];_0x394085+=0x1){for(var _0x4bf627=0x0;_0x4bf627<_0x4bda90[_0x394085]['length'];_0x4bf627+=0x1){switch(_0x394085){case 0x0:joinOrLeaveQueues(_0x28a2a3,_0x360010,_0x5b87('0x41'),_0x4bda90[_0x394085][_0x4bf627]);break;case 0x1:joinOrLeaveQueues(_0x28a2a3,_0x360010,_0x5b87('0x42'),_0x4bda90[_0x394085][_0x4bf627]);break;case 0x2:joinOrLeaveQueues(_0x28a2a3,_0x360010,_0x5b87('0x43'),_0x4bda90[_0x394085][_0x4bf627]);break;case 0x3:joinOrLeaveQueues(_0x28a2a3,_0x360010,'sms',_0x4bda90[_0x394085][_0x4bf627]);break;case 0x4:joinOrLeaveQueues(_0x28a2a3,_0x360010,_0x5b87('0x44'),_0x4bda90[_0x394085][_0x4bf627]);break;case 0x5:joinOrLeaveQueues(_0x28a2a3,_0x360010,_0x5b87('0x45'),_0x4bda90[_0x394085][_0x4bf627]);break;case 0x6:joinOrLeaveQueues(_0x28a2a3,_0x360010,_0x5b87('0x46'),_0x4bda90[_0x394085][_0x4bf627]);break;case 0x7:if(_0x1afe46[_0x5b87('0x4')]!==_0x5b87('0x5'))_0x28a2a3[_0x360010](util[_0x5b87('0x1b')](_0x5b87('0x47'),_0x4bda90[_0x394085][_0x4bf627][_0x5b87('0x6')]));break;case 0x8:if(_0x1afe46[_0x5b87('0x4')]!==_0x5b87('0x5'))_0x28a2a3[_0x360010](util[_0x5b87('0x1b')](_0x5b87('0x48'),_0x4bda90[_0x394085][_0x4bf627]['name']));break;case 0x9:if(_0x1afe46['role']!=='agent')_0x28a2a3[_0x360010](util[_0x5b87('0x1b')](_0x5b87('0x49'),_0x4bda90[_0x394085][_0x4bf627]['type'],_0x4bda90[_0x394085][_0x4bf627]['name']));break;case 0xa:_0x28a2a3[_0x360010](util[_0x5b87('0x1b')](_0x5b87('0x1d'),_0x4bda90[_0x394085][_0x4bf627]['name']));break;}}}}})[_0x5b87('0xc')](function(){if(_0x360010===_0x5b87('0x4a')){var _0xf35b47=_[_0x5b87('0x18')](_0x1afe46[_0x5b87('0x22')],'id');return _0x1afe46[_0x5b87('0x4b')](_0xf35b47)['then'](function(){for(var _0x5cf88b=0x0;_0x5cf88b<_0xf35b47[_0x5b87('0x1c')];_0x5cf88b+=0x1){_0x2cb48e['emit'](_0x5b87('0x4c'),{'ChatInteractionId':Number(_0xf35b47[_0x5cf88b]),'UserId':Number(_0x1afe46['id'])});}});}})[_0x5b87('0xc')](function(){if(_0x360010===_0x5b87('0x4a')){var _0x3420d8=_[_0x5b87('0x18')](_0x1afe46[_0x5b87('0x24')],'id');return _0x1afe46[_0x5b87('0x4d')](_0x3420d8)['then'](function(){for(var _0x446201=0x0;_0x446201<_0x3420d8[_0x5b87('0x1c')];_0x446201+=0x1){_0x2cb48e['emit'](_0x5b87('0x4e'),{'MailInteractionId':Number(_0x3420d8[_0x446201]),'UserId':Number(_0x1afe46['id'])});}});}})[_0x5b87('0xc')](function(){if(_0x360010===_0x5b87('0x4a')){var _0x50fb19=_[_0x5b87('0x18')](_0x1afe46[_0x5b87('0x26')],'id');return _0x1afe46[_0x5b87('0x4f')](_0x50fb19)[_0x5b87('0xc')](function(){for(var _0x360362=0x0;_0x360362<_0x50fb19[_0x5b87('0x1c')];_0x360362+=0x1){_0x2cb48e['emit'](_0x5b87('0x50'),{'FaxInteractionId':Number(_0x50fb19[_0x360362]),'UserId':Number(_0x1afe46['id'])});}});}})['then'](function(){if(_0x360010===_0x5b87('0x4a')){var _0x17b178=_['map'](_0x1afe46[_0x5b87('0x51')],'id');return _0x1afe46[_0x5b87('0x52')](_0x17b178)[_0x5b87('0xc')](function(){for(var _0x5b8ddd=0x0;_0x5b8ddd<_0x17b178[_0x5b87('0x1c')];_0x5b8ddd+=0x1){_0x2cb48e['emit'](_0x5b87('0x53'),{'SmsInteractionId':Number(_0x17b178[_0x5b8ddd]),'UserId':Number(_0x1afe46['id'])});}});}})[_0x5b87('0xc')](function(){if(_0x360010===_0x5b87('0x4a')){var _0x3e117e=_[_0x5b87('0x18')](_0x1afe46['OpenchannelInteractions'],'id');return _0x1afe46[_0x5b87('0x54')](_0x3e117e)[_0x5b87('0xc')](function(){for(var _0x3c9f19=0x0;_0x3c9f19<_0x3e117e[_0x5b87('0x1c')];_0x3c9f19+=0x1){_0x2cb48e['emit'](_0x5b87('0x55'),{'OpenchannelInteractionId':Number(_0x3e117e[_0x3c9f19]),'UserId':Number(_0x1afe46['id'])});}});}})[_0x5b87('0xc')](function(){if(_0x360010===_0x5b87('0x4a')){var _0x3f9f10=_[_0x5b87('0x18')](_0x1afe46[_0x5b87('0x29')],'id');return _0x1afe46[_0x5b87('0x56')](_0x3f9f10)[_0x5b87('0xc')](function(){for(var _0x34c661=0x0;_0x34c661<_0x3f9f10[_0x5b87('0x1c')];_0x34c661+=0x1){_0x2cb48e['emit'](_0x5b87('0x57'),{'WhatsappInteractionId':Number(_0x3f9f10[_0x34c661]),'UserId':Number(_0x1afe46['id'])});}});}})['catch'](function(_0x4c2228){_0x28a2a3[_0x5b87('0x58')](_0x4c2228);});}}function onDisconnect(_0x3603e9,_0x58c4b5){joinOrLeave(_0x3603e9,_0x5b87('0x4a'),_0x58c4b5);}function onConnect(_0x46a56f){joinOrLeave(_0x46a56f,_0x5b87('0x59'));}exports[_0x5b87('0x5a')]=function(_0x4e5626){_0x4e5626['on'](_0x5b87('0x5b'),function(_0x39ff09){_0x39ff09[_0x5b87('0x5c')](0x0);_0x39ff09[_0x5b87('0x5d')]=_0x39ff09[_0x5b87('0x5e')][_0x5b87('0x5b')][_0x5b87('0x5f')]+':'+_0x39ff09['request'][_0x5b87('0x5b')][_0x5b87('0x60')];_0x39ff09[_0x5b87('0x61')]=new Date();_0x39ff09[_0x5b87('0x58')]=function(_0x2bc102){console[_0x5b87('0x58')](_0x5b87('0x62')+_0x39ff09['nsp']['name']+'['+_0x39ff09[_0x5b87('0x5d')]+']',_0x2bc102);};_0x39ff09['on']('disconnect',function(){onDisconnect(_0x39ff09,_0x4e5626);_0x39ff09[_0x5b87('0x58')](_0x5b87('0x63'));});onConnect(_0x39ff09);_0x39ff09['log'](_0x5b87('0x64'));});}; \ No newline at end of file +var _0x29b3=['sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','VoiceQueues','ChatQueue','FaxQueues','MailQueue','WhatsappQueues','Trunk','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','all','voice','fax'];(function(_0x42beb8,_0x25aa6f){var _0x3d6d70=function(_0x19f24b){while(--_0x19f24b){_0x42beb8['push'](_0x42beb8['shift']());}};_0x3d6d70(++_0x25aa6f);}(_0x29b3,0x160));var _0x329b=function(_0x497cdf,_0x3b423c){_0x497cdf=_0x497cdf-0x0;var _0x18c504=_0x29b3[_0x497cdf];return _0x18c504;};'use strict';var _=require(_0x329b('0x0'));var util=require(_0x329b('0x1'));var BPromise=require(_0x329b('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x329b('0x3'));var queryQueues={'attributes':['id',_0x329b('0x4')],'include':[{'as':_0x329b('0x5'),'model':db[_0x329b('0x6')],'attributes':['id',_0x329b('0x4'),_0x329b('0x7')],'raw':!![],'where':{'role':_0x329b('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x329b('0x4')],'where':{'role':_0x329b('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x329b('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x329b('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x329b('0x4'),_0x329b('0xa')],'where':{'type':_0x329b('0xb')}};function getAssociatedResources(_0x5a4f5e,_0x1a98fc,_0x4ea6e1){return db[_0x329b('0xc')]['findOne']({'where':{'name':_0x5a4f5e,'userProfileId':_0x1a98fc},'raw':!![]})[_0x329b('0xd')](function(_0x3951d7){if(_0x3951d7){if(_0x3951d7[_0x329b('0xe')]){switch(_0x5a4f5e){case'VoiceQueues':case _0x329b('0xf'):case'FaxQueues':case _0x329b('0x10'):case _0x329b('0x11'):case _0x329b('0x12'):case'WhatsappQueues':return db[_0x4ea6e1][_0x329b('0x13')](queryQueues);case _0x329b('0x14'):return db[_0x4ea6e1]['findAll'](queryTelephones);case _0x329b('0x15'):return db[_0x4ea6e1][_0x329b('0x13')](queryTrunks);case _0x329b('0x16'):return db[_0x4ea6e1][_0x329b('0x13')](queryCampaigns);}}else{return db[_0x329b('0x17')][_0x329b('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x3951d7['id']},'raw':!![]})[_0x329b('0xd')](function(_0x48e3d0){if(_0x48e3d0){var _0x37bf77={'where':{'id':_[_0x329b('0x18')](_0x48e3d0,_0x329b('0x19'))},'raw':!![]};switch(_0x4ea6e1){case _0x329b('0x6'):_0x37bf77[_0x329b('0x1a')][_0x329b('0x7')]='telephone';break;case'Campaign':_0x37bf77[_0x329b('0x1a')][_0x329b('0xa')]=_0x329b('0xb');break;}return db[_0x4ea6e1]['findAll'](_0x37bf77);}else{return[];}});}}else{return[];}})[_0x329b('0xd')](function(_0x140fdd){return _0x140fdd;});}function joinOrLeaveQueues(_0x30e9db,_0x333d6b,_0x3a79e9,_0xfff5f3){_0x30e9db[_0x333d6b](util[_0x329b('0x1b')](_0x329b('0x1c'),_0x3a79e9,_0xfff5f3[_0x329b('0x4')]));if(_0xfff5f3[_0x329b('0x5')]){for(var _0x150e8b=0x0;_0x150e8b<_0xfff5f3[_0x329b('0x5')][_0x329b('0x1d')];_0x150e8b+=0x1){_0x30e9db[_0x333d6b](util['format'](_0x329b('0x1e'),_0xfff5f3[_0x329b('0x5')][_0x150e8b]['name']));}}}function joinOrLeave(_0x2bc83d,_0x57d2da,_0x270e9f){var _0x49cc02;if(_0x2bc83d[_0x329b('0x1f')]['query']['id']){db['User'][_0x329b('0x20')]({'attributes':['id',_0x329b('0x4'),_0x329b('0x7'),_0x329b('0x21')],'where':{'id':_0x2bc83d[_0x329b('0x1f')]['query']['id']},'include':[{'model':db[_0x329b('0x22')],'as':_0x329b('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x329b('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x329b('0x25')],'as':_0x329b('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x329b('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x329b('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x329b('0x29')],'as':_0x329b('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x329b('0xd')](function(_0xd8f3a9){if(_0xd8f3a9){_0x49cc02=_0xd8f3a9;_0x2bc83d[_0x57d2da](util[_0x329b('0x1b')](_0x329b('0x1e'),_0xd8f3a9[_0x329b('0x4')]));var _0x4feb30=[];switch(_0xd8f3a9['role']){case _0x329b('0x2b'):_0x2bc83d[_0x57d2da](_0x329b('0x2c'));_0x2bc83d[_0x57d2da](_0x329b('0x2d'));if(queryQueues['hasOwnProperty'](_0x329b('0x2e'))){delete queryQueues[_0x329b('0x2e')];}_0x4feb30[_0x329b('0x2f')](db[_0x329b('0x30')][_0x329b('0x13')](queryQueues));_0x4feb30[_0x329b('0x2f')](db['ChatQueue']['findAll'](queryQueues));_0x4feb30[_0x329b('0x2f')](db[_0x329b('0x31')]['findAll'](queryQueues));_0x4feb30[_0x329b('0x2f')](db[_0x329b('0x32')][_0x329b('0x13')](queryQueues));_0x4feb30['push'](db['MailQueue'][_0x329b('0x13')](queryQueues));_0x4feb30[_0x329b('0x2f')](db[_0x329b('0x33')]['findAll'](queryQueues));_0x4feb30[_0x329b('0x2f')](db[_0x329b('0x34')]['findAll'](queryQueues));_0x4feb30[_0x329b('0x2f')](db[_0x329b('0x6')][_0x329b('0x13')](queryTelephones));_0x4feb30[_0x329b('0x2f')](db['Trunk'][_0x329b('0x13')](queryTrunks));_0x4feb30[_0x329b('0x2f')](db[_0x329b('0x35')][_0x329b('0x13')](queryCampaigns));_0x4feb30[_0x329b('0x2f')](db[_0x329b('0x6')][_0x329b('0x13')](queryAgents));break;case _0x329b('0x36'):_0x2bc83d[_0x57d2da](_0x329b('0x2c'));_0x2bc83d[_0x57d2da](_0x329b('0x2d'));_0x4feb30[_0x329b('0x2f')](getAssociatedResources(_0x329b('0x37'),_0xd8f3a9['userProfileId'],'VoiceQueue'));_0x4feb30[_0x329b('0x2f')](getAssociatedResources(_0x329b('0xf'),_0xd8f3a9['userProfileId'],_0x329b('0x38')));_0x4feb30[_0x329b('0x2f')](getAssociatedResources(_0x329b('0x39'),_0xd8f3a9[_0x329b('0x21')],_0x329b('0x31')));_0x4feb30[_0x329b('0x2f')](getAssociatedResources('SmsQueues',_0xd8f3a9['userProfileId'],'SmsQueue'));_0x4feb30[_0x329b('0x2f')](getAssociatedResources('MailQueues',_0xd8f3a9[_0x329b('0x21')],_0x329b('0x3a')));_0x4feb30[_0x329b('0x2f')](getAssociatedResources(_0x329b('0x12'),_0xd8f3a9[_0x329b('0x21')],_0x329b('0x33')));_0x4feb30[_0x329b('0x2f')](getAssociatedResources(_0x329b('0x3b'),_0xd8f3a9[_0x329b('0x21')],_0x329b('0x34')));_0x4feb30[_0x329b('0x2f')](getAssociatedResources(_0x329b('0x14'),_0xd8f3a9[_0x329b('0x21')],_0x329b('0x6')));_0x4feb30[_0x329b('0x2f')](getAssociatedResources(_0x329b('0x15'),_0xd8f3a9[_0x329b('0x21')],_0x329b('0x3c')));_0x4feb30[_0x329b('0x2f')](getAssociatedResources(_0x329b('0x16'),_0xd8f3a9[_0x329b('0x21')],_0x329b('0x35')));_0x4feb30['push'](db[_0x329b('0x6')][_0x329b('0x13')](queryAgents));break;case _0x329b('0x8'):_0x2bc83d[_0x57d2da]('voice:inbound');_0x2bc83d[_0x57d2da](_0x329b('0x2d'));_0x4feb30[_0x329b('0x2f')](_0xd8f3a9['getVoiceQueues']({'attributes':['id',_0x329b('0x4')]}));_0x4feb30[_0x329b('0x2f')](_0xd8f3a9[_0x329b('0x3d')]({'attributes':['id',_0x329b('0x4')]}));_0x4feb30[_0x329b('0x2f')](_0xd8f3a9[_0x329b('0x3e')]({'attributes':['id','name']}));_0x4feb30[_0x329b('0x2f')](_0xd8f3a9[_0x329b('0x3f')]({'attributes':['id',_0x329b('0x4')]}));_0x4feb30[_0x329b('0x2f')](_0xd8f3a9[_0x329b('0x40')]({'attributes':['id','name']}));_0x4feb30[_0x329b('0x2f')](_0xd8f3a9['getOpenchannelQueues']({'attributes':['id',_0x329b('0x4')]}));_0x4feb30[_0x329b('0x2f')](_0xd8f3a9['getWhatsappQueues']({'attributes':['id',_0x329b('0x4')]}));break;}return BPromise[_0x329b('0x41')](_0x4feb30);}})['then'](function(_0x6b4cf1){if(_0x6b4cf1&&_0x6b4cf1[_0x329b('0x1d')]){for(var _0x408641=0x0;_0x408641<_0x6b4cf1[_0x329b('0x1d')];_0x408641+=0x1){for(var _0x45a798=0x0;_0x45a798<_0x6b4cf1[_0x408641][_0x329b('0x1d')];_0x45a798+=0x1){switch(_0x408641){case 0x0:joinOrLeaveQueues(_0x2bc83d,_0x57d2da,_0x329b('0x42'),_0x6b4cf1[_0x408641][_0x45a798]);break;case 0x1:joinOrLeaveQueues(_0x2bc83d,_0x57d2da,'chat',_0x6b4cf1[_0x408641][_0x45a798]);break;case 0x2:joinOrLeaveQueues(_0x2bc83d,_0x57d2da,_0x329b('0x43'),_0x6b4cf1[_0x408641][_0x45a798]);break;case 0x3:joinOrLeaveQueues(_0x2bc83d,_0x57d2da,_0x329b('0x44'),_0x6b4cf1[_0x408641][_0x45a798]);break;case 0x4:joinOrLeaveQueues(_0x2bc83d,_0x57d2da,_0x329b('0x45'),_0x6b4cf1[_0x408641][_0x45a798]);break;case 0x5:joinOrLeaveQueues(_0x2bc83d,_0x57d2da,_0x329b('0x46'),_0x6b4cf1[_0x408641][_0x45a798]);break;case 0x6:joinOrLeaveQueues(_0x2bc83d,_0x57d2da,_0x329b('0x47'),_0x6b4cf1[_0x408641][_0x45a798]);break;case 0x7:if(_0x49cc02['role']!==_0x329b('0x8'))_0x2bc83d[_0x57d2da](util['format'](_0x329b('0x48'),_0x6b4cf1[_0x408641][_0x45a798][_0x329b('0x4')]));break;case 0x8:if(_0x49cc02[_0x329b('0x7')]!==_0x329b('0x8'))_0x2bc83d[_0x57d2da](util[_0x329b('0x1b')](_0x329b('0x49'),_0x6b4cf1[_0x408641][_0x45a798][_0x329b('0x4')]));break;case 0x9:if(_0x49cc02[_0x329b('0x7')]!==_0x329b('0x8'))_0x2bc83d[_0x57d2da](util[_0x329b('0x1b')](_0x329b('0x4a'),_0x6b4cf1[_0x408641][_0x45a798][_0x329b('0xa')],_0x6b4cf1[_0x408641][_0x45a798][_0x329b('0x4')]));break;case 0xa:_0x2bc83d[_0x57d2da](util['format']('user:%s',_0x6b4cf1[_0x408641][_0x45a798][_0x329b('0x4')]));break;}}}}})[_0x329b('0xd')](function(){if(_0x57d2da===_0x329b('0x4b')){var _0x280625=_[_0x329b('0x18')](_0x49cc02[_0x329b('0x23')],'id');return _0x49cc02[_0x329b('0x4c')](_0x280625)['then'](function(){for(var _0x3821a5=0x0;_0x3821a5<_0x280625[_0x329b('0x1d')];_0x3821a5+=0x1){_0x270e9f[_0x329b('0x4d')](_0x329b('0x4e'),{'ChatInteractionId':Number(_0x280625[_0x3821a5]),'UserId':Number(_0x49cc02['id'])});}});}})['then'](function(){if(_0x57d2da===_0x329b('0x4b')){var _0x3836c1=_[_0x329b('0x18')](_0x49cc02[_0x329b('0x4f')],'id');return _0x49cc02[_0x329b('0x50')](_0x3836c1)[_0x329b('0xd')](function(){for(var _0x4c9023=0x0;_0x4c9023<_0x3836c1[_0x329b('0x1d')];_0x4c9023+=0x1){_0x270e9f[_0x329b('0x4d')](_0x329b('0x51'),{'MailInteractionId':Number(_0x3836c1[_0x4c9023]),'UserId':Number(_0x49cc02['id'])});}});}})[_0x329b('0xd')](function(){if(_0x57d2da===_0x329b('0x4b')){var _0x5e8a45=_[_0x329b('0x18')](_0x49cc02[_0x329b('0x26')],'id');return _0x49cc02['removeFaxInteractions'](_0x5e8a45)[_0x329b('0xd')](function(){for(var _0x26dcec=0x0;_0x26dcec<_0x5e8a45[_0x329b('0x1d')];_0x26dcec+=0x1){_0x270e9f[_0x329b('0x4d')](_0x329b('0x52'),{'FaxInteractionId':Number(_0x5e8a45[_0x26dcec]),'UserId':Number(_0x49cc02['id'])});}});}})['then'](function(){if(_0x57d2da===_0x329b('0x4b')){var _0x781882=_[_0x329b('0x18')](_0x49cc02[_0x329b('0x53')],'id');return _0x49cc02[_0x329b('0x54')](_0x781882)['then'](function(){for(var _0x599010=0x0;_0x599010<_0x781882['length'];_0x599010+=0x1){_0x270e9f[_0x329b('0x4d')](_0x329b('0x55'),{'SmsInteractionId':Number(_0x781882[_0x599010]),'UserId':Number(_0x49cc02['id'])});}});}})[_0x329b('0xd')](function(){if(_0x57d2da===_0x329b('0x4b')){var _0x713a85=_[_0x329b('0x18')](_0x49cc02[_0x329b('0x56')],'id');return _0x49cc02[_0x329b('0x57')](_0x713a85)['then'](function(){for(var _0x3394a6=0x0;_0x3394a6<_0x713a85['length'];_0x3394a6+=0x1){_0x270e9f[_0x329b('0x4d')](_0x329b('0x58'),{'OpenchannelInteractionId':Number(_0x713a85[_0x3394a6]),'UserId':Number(_0x49cc02['id'])});}});}})[_0x329b('0xd')](function(){if(_0x57d2da==='leave'){var _0x42d391=_[_0x329b('0x18')](_0x49cc02['WhatsappInteractions'],'id');return _0x49cc02[_0x329b('0x59')](_0x42d391)[_0x329b('0xd')](function(){for(var _0x1c7baf=0x0;_0x1c7baf<_0x42d391[_0x329b('0x1d')];_0x1c7baf+=0x1){_0x270e9f[_0x329b('0x4d')](_0x329b('0x5a'),{'WhatsappInteractionId':Number(_0x42d391[_0x1c7baf]),'UserId':Number(_0x49cc02['id'])});}});}})[_0x329b('0x5b')](function(_0x5b6c77){_0x2bc83d[_0x329b('0x5c')](_0x5b6c77);});}}function onDisconnect(_0x3e275e,_0x1be702){joinOrLeave(_0x3e275e,'leave',_0x1be702);}function onConnect(_0xe1cff2){joinOrLeave(_0xe1cff2,_0x329b('0x5d'));}exports['default']=function(_0x59e947){_0x59e947['on'](_0x329b('0x5e'),function(_0xcba560){_0xcba560[_0x329b('0x5f')](0x0);_0xcba560['address']=_0xcba560[_0x329b('0x60')]['connection'][_0x329b('0x61')]+':'+_0xcba560['request'][_0x329b('0x5e')][_0x329b('0x62')];_0xcba560[_0x329b('0x63')]=new Date();_0xcba560[_0x329b('0x5c')]=function(_0x45cd7c){console['log'](_0x329b('0x64')+_0xcba560['nsp'][_0x329b('0x4')]+'['+_0xcba560[_0x329b('0x65')]+']',_0x45cd7c);};_0xcba560['on'](_0x329b('0x66'),function(){onDisconnect(_0xcba560,_0x59e947);_0xcba560[_0x329b('0x5c')](_0x329b('0x67'));});onConnect(_0xcba560);_0xcba560[_0x329b('0x5c')](_0x329b('0x68'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index be0c8d2..94be0ec 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 _0x9ed4=['AfterCreateMessage','motionChannel','offlineMessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','UserId','interface','SIP/%s','name','changed','closed','substatus','AfterUpdate','User','find','fullname','email','internal','length','model','hook','callback','condition','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','ChatMessage','newmessage','Sms','afterUpdate','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','FaxInteraction','Fax','MailInteraction','Mail','Openchannel','OpenchannelInteraction','OpenchannelMessage','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','event','direction','resolve','then','ContactId','undefined','sequelize','query','QueryTypes','SELECT','contact','format','agent','incomingmessage','outgoingmessage'];(function(_0x1b0a4c,_0x384709){var _0x332501=function(_0x5d9d33){while(--_0x5d9d33){_0x1b0a4c['push'](_0x1b0a4c['shift']());}};_0x332501(++_0x384709);}(_0x9ed4,0xf0));var _0x49ed=function(_0x5374ab,_0x51f496){_0x5374ab=_0x5374ab-0x0;var _0x4e490d=_0x9ed4[_0x5374ab];return _0x4e490d;};'use strict';var util=require(_0x49ed('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x49ed('0x1'));var logger=require(_0x49ed('0x2'))(_0x49ed('0x3'));var client=jayson[_0x49ed('0x4')][_0x49ed('0x5')]({'port':0x232a});var triggers=[{'channel':_0x49ed('0x6'),'model':_0x49ed('0x7'),'event':_0x49ed('0x8'),'condition':_0x49ed('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0x49ed('0x7'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x49ed('0x6'),'model':_0x49ed('0xa'),'event':'afterCreate','condition':_0x49ed('0xb'),'callback':afterCreateMessage},{'channel':_0x49ed('0x6'),'model':'ChatOfflineMessage','event':_0x49ed('0x8'),'condition':_0x49ed('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x49ed('0xc'),'model':'SmsInteraction','event':_0x49ed('0x8'),'condition':_0x49ed('0x9'),'callback':afterCreate},{'channel':_0x49ed('0xc'),'model':'SmsInteraction','event':_0x49ed('0xd'),'condition':_0x49ed('0xe'),'callback':afterUpdate},{'channel':_0x49ed('0xc'),'model':_0x49ed('0xf'),'event':_0x49ed('0x8'),'condition':_0x49ed('0xb'),'callback':afterCreateMessage},{'channel':_0x49ed('0x10'),'model':'WhatsappInteraction','event':_0x49ed('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x49ed('0x10'),'model':_0x49ed('0x11'),'event':_0x49ed('0xd'),'condition':_0x49ed('0xe'),'callback':afterUpdate},{'channel':_0x49ed('0x10'),'model':'WhatsappMessage','event':_0x49ed('0x8'),'condition':_0x49ed('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x49ed('0x12'),'event':_0x49ed('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x49ed('0x13'),'model':_0x49ed('0x12'),'event':_0x49ed('0xd'),'condition':_0x49ed('0xe'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x49ed('0x8'),'condition':_0x49ed('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x49ed('0x14'),'event':_0x49ed('0x8'),'condition':_0x49ed('0x9'),'callback':afterCreate},{'channel':_0x49ed('0x15'),'model':_0x49ed('0x14'),'event':_0x49ed('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x49ed('0x8'),'condition':_0x49ed('0xb'),'callback':afterCreateMessage},{'channel':_0x49ed('0x16'),'model':_0x49ed('0x17'),'event':_0x49ed('0x8'),'condition':_0x49ed('0x9'),'callback':afterCreate},{'channel':_0x49ed('0x16'),'model':_0x49ed('0x17'),'event':_0x49ed('0xd'),'condition':_0x49ed('0xe'),'callback':afterUpdate},{'channel':_0x49ed('0x16'),'model':_0x49ed('0x18'),'event':_0x49ed('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x5e433a){return client['request']('EventManager',_0x5e433a)['then'](function(_0x514076){logger[_0x49ed('0x19')](_0x49ed('0x1a'),_0x49ed('0x1b'),_0x514076);if(_0x514076[_0x49ed('0x1c')]){if(_0x514076[_0x49ed('0x1c')][_0x49ed('0x1d')]===0x1f4){logger[_0x49ed('0x1c')](_0x49ed('0x1a'),_0x49ed('0x1b'),_0x514076[_0x49ed('0x1c')]);}}})[_0x49ed('0x1e')](function(_0x3047e2){logger[_0x49ed('0x1c')](_0x49ed('0x1a'),_0x49ed('0x1b'),_0x3047e2);});}function afterCreateMessage(_0x2cea48){return function(_0x554edb){_0x554edb=_0x554edb[_0x49ed('0x1f')]({'plain':!![]});_0x554edb[_0x49ed('0x20')]=_0x2cea48;_0x554edb['motionChannel']=_0x2cea48;_0x554edb[_0x49ed('0x21')]=_0x554edb[_0x49ed('0x22')];Promise[_0x49ed('0x23')]()[_0x49ed('0x24')](function(){if(typeof _0x554edb[_0x49ed('0x25')]===_0x49ed('0x26'))return null;var _0x2c65bd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x554edb['ContactId'];return db[_0x49ed('0x27')][_0x49ed('0x28')](_0x2c65bd,{'type':db['Sequelize'][_0x49ed('0x29')][_0x49ed('0x2a')],'raw':!![]});})[_0x49ed('0x24')](function(_0x3dab04){if(_0x3dab04){_0x554edb[_0x49ed('0x2b')]=_0x3dab04[0x0];}if(typeof _0x554edb['UserId']===_0x49ed('0x26'))return;return getAgent(_0x554edb['UserId']);})[_0x49ed('0x24')](function(_0xa7f288){if(_0xa7f288){_0x554edb['interface']=util[_0x49ed('0x2c')]('SIP/%s',_0xa7f288['name']);_0x554edb[_0x49ed('0x2d')]=_0xa7f288;_0x554edb[_0x49ed('0x20')]=_0x2cea48;return request({'event':_0x49ed('0x2e'),'message':_0x554edb});}else{return request({'event':_0x49ed('0x2f'),'message':_0x554edb});}})['catch'](function(_0x556836){logger[_0x49ed('0x1c')](_0x49ed('0x1a'),_0x49ed('0x30'),_0x556836);});};}function afterCreateOfflineMessage(_0x1af2ad){return function(_0x5e723a){_0x5e723a=_0x5e723a[_0x49ed('0x1f')]({'plain':!![]});_0x5e723a['channel']=_0x1af2ad;_0x5e723a[_0x49ed('0x31')]=_0x1af2ad;_0x5e723a['event']=_0x49ed('0x32');return request({'event':_0x5e723a['event'],'message':_0x5e723a});};}function afterCreate(_0xc0748c,_0x1fb7dd){return function(_0xcab885){_0xcab885=_0xcab885[_0x49ed('0x1f')]({'plain':!![]});_0xcab885['channel']=_0xc0748c;_0xcab885[_0x49ed('0x31')]=_0xc0748c;_0xcab885['event']=_0x49ed('0x33');Promise[_0x49ed('0x23')]()[_0x49ed('0x24')](function(){var _0x42ed91=_0x49ed('0x34')+_0xcab885[_0x49ed('0x25')];return db[_0x49ed('0x27')][_0x49ed('0x28')](_0x42ed91,{'type':db[_0x49ed('0x35')][_0x49ed('0x29')][_0x49ed('0x2a')],'raw':!![]});})[_0x49ed('0x24')](function(_0xba1ba0){if(_0xba1ba0){_0xcab885['contact']=_0xba1ba0[0x0];}if(typeof _0xcab885[_0x49ed('0x36')]===_0x49ed('0x26'))return;return getAgent(_0xcab885[_0x49ed('0x36')]);})[_0x49ed('0x24')](function(_0x4c1e5c){if(_0x4c1e5c){_0xcab885[_0x49ed('0x37')]=util[_0x49ed('0x2c')](_0x49ed('0x38'),_0x4c1e5c[_0x49ed('0x39')]);_0xcab885['agent']=_0x4c1e5c;}return request({'event':_0x1fb7dd,'message':_0xcab885});})[_0x49ed('0x1e')](function(_0x59d1a1){logger[_0x49ed('0x1c')]('Trigger,\x20%s','AfterCreate',_0x59d1a1);});};}function afterUpdate(_0x4673e2){return function(_0x53dcfa){var _0x16c437=_0x53dcfa[_0x49ed('0x3a')](_0x49ed('0x3b'))&&_0x53dcfa[_0x49ed('0x3b')];var _0x1da75a=_0x53dcfa[_0x49ed('0x3a')](_0x49ed('0x3c'));if(_0x16c437||_0x1da75a){var _0xcd888c=_0x16c437?_0x49ed('0xe'):_0x49ed('0x3c');var _0x54b4d0=_0x53dcfa[_0x49ed('0x1f')]({'plain':!![]});_0x54b4d0[_0x49ed('0x20')]=_0x4673e2;_0x54b4d0['motionChannel']=_0x4673e2;_0x54b4d0[_0x49ed('0x21')]=_0x16c437?_0x49ed('0x3b'):_0x49ed('0x3c');var _0x3573c5=_0x49ed('0x34')+_0x54b4d0['ContactId'];return db[_0x49ed('0x27')]['query'](_0x3573c5,{'type':db[_0x49ed('0x35')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x357e3c){if(_0x357e3c){_0x54b4d0['contact']=_0x357e3c[0x0];}if(typeof _0x54b4d0['UserId']===_0x49ed('0x26'))return;return getAgent(_0x54b4d0[_0x49ed('0x36')]);})[_0x49ed('0x24')](function(_0x1ab06e){if(_0x1ab06e){_0x54b4d0[_0x49ed('0x37')]=util[_0x49ed('0x2c')](_0x49ed('0x38'),_0x1ab06e[_0x49ed('0x39')]);_0x54b4d0['agent']=_0x1ab06e;}return request({'event':_0xcd888c,'message':_0x54b4d0});})[_0x49ed('0x1e')](function(_0x44bb7d){logger[_0x49ed('0x1c')](_0x49ed('0x1a'),_0x49ed('0x3d'),_0x44bb7d);});}};}function getAgent(_0x5ee645){return db[_0x49ed('0x3e')][_0x49ed('0x3f')]({'where':{'id':_0x5ee645},'attributes':['id',_0x49ed('0x39'),_0x49ed('0x40'),_0x49ed('0x41'),_0x49ed('0x42')],'raw':!![]})[_0x49ed('0x24')](function(_0x3c3a3e){return _0x3c3a3e;});}exports['default']=function(){for(var _0xc5a030=0x0;_0xc5a030=_0x3699bd['agents']){throw Error(_0x192c('0x15'));}_0x489f33(_0x38f5ce);})['catch'](function(_0x361cd0){_0x568694(_0x361cd0);});});}; \ No newline at end of file +var _0xeee8=['isUndefined','updateAttributes','getLicense','role','agent','User','count','then','agents','catch','../mysqldb','./license/util','mail','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','clearBlockUser'];(function(_0x2e2c9c,_0x3a2e71){var _0x195b88=function(_0x455ec7){while(--_0x455ec7){_0x2e2c9c['push'](_0x2e2c9c['shift']());}};_0x195b88(++_0x3a2e71);}(_0xeee8,0x19a));var _0x8eee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeee8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x8eee('0x0'))['db'];var util=require(_0x8eee('0x1'));var channels=['voice',_0x8eee('0x2'),_0x8eee('0x3'),'fax',_0x8eee('0x4'),_0x8eee('0x5'),_0x8eee('0x6')];exports[_0x8eee('0x7')]=function(){return channels;};exports[_0x8eee('0x8')]=function(_0x296ce9){_0x296ce9=_0x296ce9['toLowerCase']();return _['includes'](channels,_0x296ce9);};exports[_0x8eee('0x9')]=function(_0x46a1a0,_0x3eb6bb,_0x1aae9d,_0x4984a9){var _0x3be89d={'loginAttempts':_0x3eb6bb,'blocked':_0x1aae9d};if(!_[_0x8eee('0xa')](_0x4984a9)){_0x3be89d['blockedAt']=_0x4984a9;}return _0x46a1a0[_0x8eee('0xb')](_0x3be89d);};exports[_0x8eee('0xc')]=function(_0xc24be3){return new BPromise(function(_0x4f597c,_0x490127){var _0x3fe030=0x0;if(_0xc24be3[_0x8eee('0xd')]!==_0x8eee('0xe')){_0x4f597c(_0xc24be3);}db[_0x8eee('0xf')][_0x8eee('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0xc24be3['id']}}})[_0x8eee('0x11')](function(_0x3d8689){_0x3fe030=_0x3d8689;return util[_0x8eee('0xc')]();})['then'](function(_0x341af3){if(_0x341af3&&_0x341af3[_0x8eee('0x12')]&&_0x3fe030>=_0x341af3[_0x8eee('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4f597c(_0xc24be3);})[_0x8eee('0x13')](function(_0x1c1385){_0x490127(_0x1c1385);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 5832cea..4704c3e 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3198=['details','OutOfInterval','Resource\x20Conflict','Conflict','Not\x20Found','stack','status','send','util','api','message','Internal\x20Server\x20Error','Error','inherits','Bad\x20Request','name','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x3198,0x182));var _0x8319=function(_0x33130d,_0x125fdb){_0x33130d=_0x33130d-0x0;var _0x39cb5b=_0x3198[_0x33130d];return _0x39cb5b;};'use strict';var util=require(_0x8319('0x0'));var logger=require('../config/logger')(_0x8319('0x1'));var APIError=function(_0x178b5f,_0x24d6a4){this[_0x8319('0x2')]=_0x178b5f||_0x8319('0x3');this['name']=_0x24d6a4||_0x8319('0x4');util[_0x8319('0x5')](APIError,Error);};var APIBadRequestError=function(_0x451d1d){this[_0x8319('0x2')]=_0x451d1d||_0x8319('0x6');this[_0x8319('0x7')]=_0x8319('0x6');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x43ebd4){this[_0x8319('0x2')]=_0x43ebd4||_0x8319('0x8');this[_0x8319('0x7')]=_0x8319('0x8');util[_0x8319('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x5e283c){this[_0x8319('0x2')]=_0x5e283c||_0x8319('0x9');this['name']='Not\x20Found';util[_0x8319('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3d2986){this[_0x8319('0x2')]=_0x3d2986||_0x8319('0xa');this[_0x8319('0x7')]=_0x8319('0xb');this[_0x8319('0xc')]=0x193;this[_0x8319('0xd')]={'type':_0x8319('0xe')};util[_0x8319('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x37c57c){this['message']=_0x37c57c||_0x8319('0xf');this['name']=_0x8319('0x10');util[_0x8319('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x23b739){switch(_0x23b739){case _0x8319('0x6'):return 0x190;case _0x8319('0x8'),_0x8319('0xb'):return 0x193;case _0x8319('0x11'):return 0x194;case _0x8319('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x55815b){if(_0x55815b==='Out\x20Of\x20Interval')return _0x55815b;return null;}function handleError(_0x30f908){return function(_0x3d85c6){logger['error'](_0x3d85c6[_0x8319('0x12')]);var _0x1151ed=getStatusCode(_0x3d85c6[_0x8319('0x7')]);var _0x2467a8=getCustomStatusMessage(_0x3d85c6[_0x8319('0x7')]);if(_0x3d85c6[_0x8319('0x7')]){delete _0x3d85c6[_0x8319('0x7')];}if(_0x2467a8){_0x30f908['statusMessage']=_0x2467a8;}return _0x30f908[_0x8319('0x13')](_0x1151ed)[_0x8319('0x14')](_0x3d85c6);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xa49f=['inherits','message','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','Resource\x20Conflict','Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','send','exports','../config/logger','api','Internal\x20Server\x20Error','name'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0xa49f,0x1b4));var _0xfa49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa49f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var logger=require(_0xfa49('0x0'))(_0xfa49('0x1'));var APIError=function(_0x9c1cd3,_0x42ad00){this['message']=_0x9c1cd3||_0xfa49('0x2');this[_0xfa49('0x3')]=_0x42ad00||'Error';util[_0xfa49('0x4')](APIError,Error);};var APIBadRequestError=function(_0x470524){this[_0xfa49('0x5')]=_0x470524||_0xfa49('0x6');this[_0xfa49('0x3')]=_0xfa49('0x6');util[_0xfa49('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x50f5c8){this[_0xfa49('0x5')]=_0x50f5c8||_0xfa49('0x7');this[_0xfa49('0x3')]=_0xfa49('0x7');util[_0xfa49('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x51ca29){this[_0xfa49('0x5')]=_0x51ca29||_0xfa49('0x8');this['name']=_0xfa49('0x9');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xd9921){this[_0xfa49('0x5')]=_0xd9921||_0xfa49('0xa');this[_0xfa49('0x3')]='Out\x20Of\x20Interval';this[_0xfa49('0xb')]=0x193;this['details']={'type':'OutOfInterval'};util[_0xfa49('0x4')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4f0edd){this['message']=_0x4f0edd||_0xfa49('0xc');this[_0xfa49('0x3')]=_0xfa49('0xd');util[_0xfa49('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0xa630ae){switch(_0xa630ae){case _0xfa49('0x6'):return 0x190;case _0xfa49('0x7'),_0xfa49('0xe'):return 0x193;case _0xfa49('0x9'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x34438a){if(_0x34438a==='Out\x20Of\x20Interval')return _0x34438a;return null;}function handleError(_0x51c862){return function(_0x5059b8){logger[_0xfa49('0xf')](_0x5059b8[_0xfa49('0x10')]);var _0x1fc20e=getStatusCode(_0x5059b8[_0xfa49('0x3')]);var _0x3d987b=getCustomStatusMessage(_0x5059b8[_0xfa49('0x3')]);if(_0x5059b8[_0xfa49('0x3')]){delete _0x5059b8[_0xfa49('0x3')];}if(_0x3d987b){_0x51c862[_0xfa49('0x11')]=_0x3d987b;}return _0x51c862['status'](_0x1fc20e)[_0xfa49('0x12')](_0x5059b8);};}module[_0xfa49('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c097acb..a0980c2 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6dc=['render','json','send','exports','404','status'];(function(_0x5d0b5c,_0x431522){var _0x16a360=function(_0xb8f856){while(--_0xb8f856){_0x5d0b5c['push'](_0x5d0b5c['shift']());}};_0x16a360(++_0x431522);}(_0xd6dc,0x1d7));var _0xcd6d=function(_0x129231,_0x14b248){_0x129231=_0x129231-0x0;var _0x3f9e49=_0xd6dc[_0x129231];return _0x3f9e49;};'use strict';module[_0xcd6d('0x0')][0x194]=function pageNotFound(_0x5a887f,_0x46e081){var _0x82e762=_0xcd6d('0x1');var _0x21cd27=0x194;var _0x4f782f={'status':_0x21cd27};_0x46e081[_0xcd6d('0x2')](_0x4f782f[_0xcd6d('0x2')]);_0x46e081[_0xcd6d('0x3')](_0x82e762,{},function(_0x3019be,_0x353411){if(_0x3019be){return _0x46e081[_0xcd6d('0x2')](_0x4f782f[_0xcd6d('0x2')])[_0xcd6d('0x4')](_0x4f782f);}_0x46e081[_0xcd6d('0x5')](_0x353411);});}; \ No newline at end of file +var _0xe293=['exports','status'];(function(_0xf60cd0,_0x34bf81){var _0x32ad56=function(_0x44cf0b){while(--_0x44cf0b){_0xf60cd0['push'](_0xf60cd0['shift']());}};_0x32ad56(++_0x34bf81);}(_0xe293,0x172));var _0x3e29=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xe293[_0x5280f4];return _0xba93e7;};'use strict';module[_0x3e29('0x0')][0x194]=function pageNotFound(_0x28d504,_0x487172){var _0x28df04='404';var _0x30ab83=0x194;var _0x4fdf0c={'status':_0x30ab83};_0x487172['status'](_0x4fdf0c[_0x3e29('0x1')]);_0x487172['render'](_0x28df04,{},function(_0x260fec,_0x1d4061){if(_0x260fec){return _0x487172[_0x3e29('0x1')](_0x4fdf0c[_0x3e29('0x1')])['json'](_0x4fdf0c);}_0x487172['send'](_0x1d4061);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 231f01d..529a73a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eba=['UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','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','Trigger','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/user-setting/user-setting.model','MailInteractionHasTag','cascade','UserId','hasOne','UserSetting','Recordings','hasMany','Extensions','CmHopperFinal','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','chat_group_has_users','CmContact','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','UserFaxQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','mailbox','VoiceQueueReport','uniqueid','AgentReports','Contact','MailAccountId','CloudProviderId','restrict','Imap','Dispositions','Answers','Messages','Interactions','List','ListId','Template','TemplateId','Teams','MailInteractionId','Account','ContactId','Owner','Tags','mail_interaction_has_tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','Items','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','Agent','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Members','Contacts','CompanyId','CmContactHasItem','Phones','CmContactId','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','OwnerId','CampaignId','All','AutomationAllId','Any','OneAny','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticDefaultReport','Fields','DefaultReportId','AnalyticFieldReport','MetricId','Configurations','Subjects','Descriptions','DescriptionId','Subject','SubjectId','Description','Field','VariableId','AccountId','FieldId','DeskConfiguration','int_desk_configuration_has_tags','ZendeskAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','Dynamics365Configuration','FreshsalesAccount','ToId','ProjectId','VoiceQueues','team_has_mail_queues','MailQueues','team_has_chat_queues','ChatQueues','FaxQueues','team_has_sms_queues','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','CmCustomField','CustomFields','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Smtp','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model'];(function(_0x115d97,_0x486ecd){var _0x57ede6=function(_0x525dc4){while(--_0x525dc4){_0x115d97['push'](_0x115d97['shift']());}};_0x57ede6(++_0x486ecd);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x1eba[_0x1aba25];return _0x47d997;};'use strict';var config=require(_0xa1eb('0x0'));var Sequelize=require(_0xa1eb('0x1'));var _=require(_0xa1eb('0x2'));var jstz=require(_0xa1eb('0x3'));var timezone=jstz[_0xa1eb('0x4')]();config['sequelize']=_['defaultsDeep'](config[_0xa1eb('0x1')],{'database':_0xa1eb('0x5'),'username':_0xa1eb('0x6'),'password':_0xa1eb('0x7'),'options':{'host':_0xa1eb('0x8'),'port':0xcea,'dialect':_0xa1eb('0x9'),'dialectOptions':{'charset':_0xa1eb('0xa')},'logging':![],'timezone':timezone[_0xa1eb('0xb')](),'define':{'charset':_0xa1eb('0xc'),'collate':_0xa1eb('0xd')}}});config[_0xa1eb('0xe')]=_[_0xa1eb('0xf')](config['sequelizeHistory'],{'database':_0xa1eb('0x5'),'username':'xcall','password':_0xa1eb('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xa1eb('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xa1eb('0xb')](),'define':{'charset':'utf8','collate':_0xa1eb('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa1eb('0x1')][_0xa1eb('0x10')],config['sequelize'][_0xa1eb('0x11')],config[_0xa1eb('0x1')]['password'],config[_0xa1eb('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xa1eb('0x10')],config['sequelizeHistory'][_0xa1eb('0x11')],config[_0xa1eb('0xe')][_0xa1eb('0x12')],config[_0xa1eb('0xe')][_0xa1eb('0x13')])};db[_0xa1eb('0x14')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x16'));db['VoiceChanSpy']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x17'));db[_0xa1eb('0x18')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/voiceContext/voiceContext.model');db[_0xa1eb('0x19')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x1a'));db[_0xa1eb('0x1b')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x1c'));db['VoiceQueue']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x1d'));db[_0xa1eb('0x1e')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/screenRecording/screenRecording.model');db[_0xa1eb('0x1f')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x20'));db[_0xa1eb('0x21')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x22'));db[_0xa1eb('0x23')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x24'));db['VoiceDialReport']=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0xa1eb('0x25')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x26'));db['VoiceQueueReport']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x27'));db['MemberReport']=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/memberReport/memberReport.model');db[_0xa1eb('0x28')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x29'));db[_0xa1eb('0x2a')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x2b'));db[_0xa1eb('0x2c')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x2d'));db[_0xa1eb('0x2e')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x2f'));db[_0xa1eb('0x30')]=db['sequelize']['import'](_0xa1eb('0x31'));db[_0xa1eb('0x32')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x33'));db['UserFaxQueue']=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x34'));db['UserSmsQueue']=db['sequelize'][_0xa1eb('0x15')]('../api/userSmsQueue/userSmsQueue.model');db[_0xa1eb('0x35')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x36'));db[_0xa1eb('0x37')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x38'));db[_0xa1eb('0x39')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x3a'));db[_0xa1eb('0x3b')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0xa1eb('0x3c')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x3d'));db[_0xa1eb('0x3e')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x3f'));db['MailSubstatus']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x40'));db[_0xa1eb('0x41')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x42'));db[_0xa1eb('0x43')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x44'));db[_0xa1eb('0x45')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x46'));db[_0xa1eb('0x47')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x48'));db[_0xa1eb('0x49')]=db['sequelize'][_0xa1eb('0x15')]('../api/dashboard/dashboard.model');db[_0xa1eb('0x4a')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x4b'));db[_0xa1eb('0x4c')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x4d'));db[_0xa1eb('0x4e')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x4f'));db[_0xa1eb('0x50')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x51'));db['FaxMessage']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x52'));db[_0xa1eb('0x53')]=db['sequelize']['import'](_0xa1eb('0x54'));db[_0xa1eb('0x55')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x56'));db[_0xa1eb('0x57')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x58'));db[_0xa1eb('0x59')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x5a'));db[_0xa1eb('0x5b')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x5c'));db[_0xa1eb('0x5d')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x5e'));db[_0xa1eb('0x5f')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x60'));db[_0xa1eb('0x61')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x62'));db[_0xa1eb('0x63')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x64'));db[_0xa1eb('0x65')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xa1eb('0x66')]=db['sequelize'][_0xa1eb('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0xa1eb('0x67')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0xa1eb('0x68')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x69'));db[_0xa1eb('0x6a')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x6b'));db[_0xa1eb('0x6c')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x6d'));db[_0xa1eb('0x6e')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x6f'));db[_0xa1eb('0x70')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x71'));db['ChatOfflineMessage']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x72'));db[_0xa1eb('0x73')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/chatQueue/chatQueue.model');db[_0xa1eb('0x74')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x75'));db[_0xa1eb('0x76')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xa1eb('0x77')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x78'));db['CmContact']=db['sequelize']['import']('../api/cmContact/cmContact.model');db[_0xa1eb('0x79')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x7a'));db[_0xa1eb('0x7b')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x7c'));db[_0xa1eb('0x7d')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x7e'));db['CmCustomField']=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0xa1eb('0x7f')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x80'));db[_0xa1eb('0x81')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x82'));db[_0xa1eb('0x83')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x84'));db[_0xa1eb('0x85')]=db['sequelize'][_0xa1eb('0x15')]('../api/disposition/disposition.model');db[_0xa1eb('0x86')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x87'));db[_0xa1eb('0x88')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x89'));db[_0xa1eb('0x8a')]=db['sequelize'][_0xa1eb('0x15')]('../api/pause/pause.model');db['Cdr']=db['sequelize']['import'](_0xa1eb('0x8b'));db[_0xa1eb('0x8c')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x8d'));db[_0xa1eb('0x8e')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x8f'));db[_0xa1eb('0x90')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x91'));db[_0xa1eb('0x92')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x93'));db['ContactItemType']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x94'));db['CmContactHasItem']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x95'));db[_0xa1eb('0x96')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x97'));db['Template']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x98'));db[_0xa1eb('0x99')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/trigger/trigger.model');db[_0xa1eb('0x9a')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x9b'));db['Integration']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x9c'));db[_0xa1eb('0x9d')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x9e'));db[_0xa1eb('0x9f')]=db[_0xa1eb('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xa0'));db[_0xa1eb('0xa1')]=db['sequelize']['import'](_0xa1eb('0xa2'));db[_0xa1eb('0xa3')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xa4'));db['AnalyticFieldReport']=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0xa5'));db[_0xa1eb('0xa6')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xa7'));db[_0xa1eb('0xa8')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xa9'));db[_0xa1eb('0xaa')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xab'));db[_0xa1eb('0xac')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xad'));db[_0xa1eb('0xae')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xaf'));db[_0xa1eb('0xb0')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0xb1'));db[_0xa1eb('0xb2')]=db[_0xa1eb('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0xa1eb('0xb3')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0xb4'));db['DeskConfiguration']=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xa1eb('0xb5')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xb6'));db[_0xa1eb('0xb7')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xb8'));db[_0xa1eb('0xb9')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xa1eb('0xba')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xbb'));db['ZendeskAccount']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xbc'));db['ZendeskConfiguration']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xbd'));db['ZendeskField']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xbe'));db[_0xa1eb('0xbf')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xc0'));db[_0xa1eb('0xc1')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xa1eb('0xc2')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xc3'));db[_0xa1eb('0xc4')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0xc5'));db['VtigerConfiguration']=db[_0xa1eb('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xa1eb('0xc6')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xc7'));db[_0xa1eb('0xc8')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0xc9'));db['ServicenowConfiguration']=db['sequelize'][_0xa1eb('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xa1eb('0xca')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xcb'));db[_0xa1eb('0xcc')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xcd'));db['Dynamics365Configuration']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xce'));db[_0xa1eb('0xcf')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xd0'));db['FreshsalesAccount']=db[_0xa1eb('0x1')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xa1eb('0xd1')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xd2'));db[_0xa1eb('0xd3')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xd4'));db['Integration']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x9c'));db[_0xa1eb('0xd5')]=db['sequelize']['import'](_0xa1eb('0xd6'));db[_0xa1eb('0xd7')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xd8'));db[_0xa1eb('0xd9')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xda'));db[_0xa1eb('0xdb')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xdc'));db[_0xa1eb('0xdd')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xde'));db[_0xa1eb('0xdf')]=db['sequelize'][_0xa1eb('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xa1eb('0xe0')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0xa1eb('0xe1')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xe2'));db['SquareDetailsReport']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xe3'));db[_0xa1eb('0xe4')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xe5'));db[_0xa1eb('0xe6')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/setting/setting.model');db[_0xa1eb('0xe7')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xe8'));db[_0xa1eb('0xe9')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xea'));db[_0xa1eb('0xeb')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xec'));db[_0xa1eb('0xed')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xee'));db[_0xa1eb('0xef')]=db['sequelize']['import'](_0xa1eb('0xf0'));db[_0xa1eb('0xf1')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/license/license.model');db[_0xa1eb('0xf2')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0xf3'));db[_0xa1eb('0xf4')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xf5'));db[_0xa1eb('0xf6')]=db['sequelize']['import']('../api/attachment/attachment.model');db['Plugin']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xf7'));db[_0xa1eb('0xf8')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xf9'));db[_0xa1eb('0xfa')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xfb'));db[_0xa1eb('0xfc')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0xfd'));db[_0xa1eb('0xfe')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0xff'));db['SmsTransferReport']=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x100'));db[_0xa1eb('0x101')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0xa1eb('0x102')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x103'));db[_0xa1eb('0x104')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0xa1eb('0x105')]=db[_0xa1eb('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db[_0xa1eb('0x106')]=db['sequelize']['import'](_0xa1eb('0x107'));db['WhatsappAccount']=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0xa1eb('0x108')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x109'));db['WhatsappInteraction']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x10a'));db[_0xa1eb('0x10b')]=db[_0xa1eb('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x10c'));db[_0xa1eb('0x10d')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x10e'));db[_0xa1eb('0x10f')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x110'));db[_0xa1eb('0x111')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')](_0xa1eb('0x112'));db[_0xa1eb('0x113')]=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x114'));db[_0xa1eb('0x115')]=db['sequelize'][_0xa1eb('0x15')](_0xa1eb('0x116'));db[_0xa1eb('0x117')]=db[_0xa1eb('0x1')][_0xa1eb('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0xa1eb('0x1')]['import'](_0xa1eb('0x118'));db[_0xa1eb('0x119')]=db['sequelize']['import']('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0xa1eb('0x14')]['hasOne'](db[_0xa1eb('0x1f')],{'as':_0xa1eb('0x1f'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')][_0xa1eb('0x11c')](db[_0xa1eb('0x11d')],{'as':'userSetting','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')]['hasMany'](db['VoiceRecording'],{'as':_0xa1eb('0x11e'),'foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')][_0xa1eb('0x11f')](db[_0xa1eb('0x2c')],{'as':'VoiceQueuesRt','foreignKey':_0xa1eb('0x11b')});db['User'][_0xa1eb('0x11f')](db[_0xa1eb('0x19')],{'as':_0xa1eb('0x120'),'onDelete':_0xa1eb('0x11a'),'hooks':!![]});db['User'][_0xa1eb('0x11f')](db[_0xa1eb('0x121')],{'as':_0xa1eb('0x122'),'foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')]['hasMany'](db[_0xa1eb('0x7d')],{'as':_0xa1eb('0x123'),'foreignKey':_0xa1eb('0x11b')});db['User'][_0xa1eb('0x11f')](db[_0xa1eb('0x124')],{'as':'ReportAgentPreview','foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')][_0xa1eb('0x11f')](db[_0xa1eb('0x65')],{'as':_0xa1eb('0x125'),'foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')][_0xa1eb('0x11f')](db[_0xa1eb('0x6e')],{'as':'ChatInteractions','foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')][_0xa1eb('0x11f')](db[_0xa1eb('0x5b')],{'as':_0xa1eb('0x126'),'foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')]['hasMany'](db[_0xa1eb('0x50')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0xa1eb('0x14')][_0xa1eb('0x11f')](db[_0xa1eb('0x41')],{'as':_0xa1eb('0x127'),'foreignKey':'UserId'});db['User'][_0xa1eb('0x11f')](db[_0xa1eb('0x128')],{'as':_0xa1eb('0x129'),'foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x14')][_0xa1eb('0x11f')](db[_0xa1eb('0x106')],{'as':'UserNotifications','foreignKey':_0xa1eb('0x12a')});db['User'][_0xa1eb('0x11f')](db['CmHopper'],{'as':_0xa1eb('0x12b'),'foreignKey':_0xa1eb('0x11b'),'onDelete':_0xa1eb('0x12c')});db[_0xa1eb('0x14')][_0xa1eb('0x12d')](db[_0xa1eb('0x102')],{'as':_0xa1eb('0x102'),'foreignKey':_0xa1eb('0x12e')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x74')],{'as':'Groups','through':_0xa1eb('0x130')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x131')],{'as':'Contacts','through':_0xa1eb('0x132')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x134'),'through':_0xa1eb('0x135')});db['User'][_0xa1eb('0x12f')](db[_0xa1eb('0xef')],{'through':_0xa1eb('0x136')});db[_0xa1eb('0x14')]['belongsToMany'](db[_0xa1eb('0x41')],{'as':_0xa1eb('0x127'),'through':_0xa1eb('0x137')});db['User']['belongsToMany'](db[_0xa1eb('0x6e')],{'as':_0xa1eb('0x138'),'through':_0xa1eb('0x139')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x50')],{'as':_0xa1eb('0x13a'),'through':_0xa1eb('0x13b')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db['SmsInteraction'],{'as':_0xa1eb('0x126'),'through':_0xa1eb('0x13c')});db[_0xa1eb('0x14')]['belongsToMany'](db[_0xa1eb('0x65')],{'as':_0xa1eb('0x125'),'through':_0xa1eb('0x13d')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x128')],{'as':_0xa1eb('0x129'),'through':_0xa1eb('0x13e')});db[_0xa1eb('0x14')]['belongsToMany'](db[_0xa1eb('0x13f')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x101')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0xa1eb('0x14')]['belongsToMany'](db['MailQueue'],{'as':'MailQueues','through':_0xa1eb('0x32'),'required':![]});db[_0xa1eb('0x14')]['belongsToMany'](db[_0xa1eb('0x73')],{'as':'ChatQueues','through':_0xa1eb('0x30'),'required':![],'hooks':!![]});db[_0xa1eb('0x14')]['belongsToMany'](db[_0xa1eb('0x53')],{'as':'FaxQueues','through':_0xa1eb('0x140'),'required':![]});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x5f')],{'as':'SmsQueues','through':_0xa1eb('0x141'),'required':![]});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db['OpenchannelQueue'],{'as':_0xa1eb('0x142'),'through':_0xa1eb('0x35'),'required':![]});db['User']['belongsToMany'](db['WhatsappQueue'],{'as':_0xa1eb('0x143'),'through':_0xa1eb('0x37'),'required':![]});db['User'][_0xa1eb('0x12f')](db[_0xa1eb('0x133')],{'through':_0xa1eb('0x135')});db['User'][_0xa1eb('0x12f')](db[_0xa1eb('0x68')],{'as':'ChatWebsites','through':_0xa1eb('0x144')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x4c')],{'as':_0xa1eb('0x145'),'through':_0xa1eb('0x146')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x3c')],{'as':_0xa1eb('0x147'),'through':_0xa1eb('0x148')});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x61')],{'as':_0xa1eb('0x149'),'through':'user_has_openchannel_accounts'});db[_0xa1eb('0x14')][_0xa1eb('0x12f')](db[_0xa1eb('0x57')],{'as':'SmsAccounts','through':_0xa1eb('0x14a')});db[_0xa1eb('0x14')]['belongsToMany'](db[_0xa1eb('0x14b')],{'as':_0xa1eb('0x14c'),'through':_0xa1eb('0x14d')});db[_0xa1eb('0x14e')][_0xa1eb('0x11f')](db[_0xa1eb('0x19')],{'as':_0xa1eb('0x14f'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x150')});db[_0xa1eb('0x18')]['hasMany'](db['VoiceExtension'],{'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x19')][_0xa1eb('0x11f')](db['VoiceExtension'],{'as':_0xa1eb('0x151'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x1b')][_0xa1eb('0x12f')](db[_0xa1eb('0x90')],{'as':_0xa1eb('0x152'),'through':_0xa1eb('0x153')});db[_0xa1eb('0x13f')][_0xa1eb('0x11f')](db[_0xa1eb('0x2c')],{'as':'Members','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xa1eb('0x11f')](db[_0xa1eb('0x79')],{'as':_0xa1eb('0x12b'),'foreignKey':_0xa1eb('0x154')});db[_0xa1eb('0x13f')][_0xa1eb('0x11f')](db[_0xa1eb('0x121')],{'as':_0xa1eb('0x122'),'foreignKey':_0xa1eb('0x154')});db[_0xa1eb('0x13f')][_0xa1eb('0x11f')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xa1eb('0x13f')][_0xa1eb('0x11f')](db[_0xa1eb('0x124')],{'as':'ReportAgentPreview','foreignKey':_0xa1eb('0x154')});db['VoiceQueue']['hasMany'](db[_0xa1eb('0x7b')],{'as':_0xa1eb('0x155'),'foreignKey':_0xa1eb('0x154')});db[_0xa1eb('0x13f')][_0xa1eb('0x11f')](db[_0xa1eb('0xdf')],{'as':_0xa1eb('0x156'),'foreignKey':_0xa1eb('0x154')});db[_0xa1eb('0x13f')][_0xa1eb('0x12d')](db['Trunk'],{'as':'Trunk','foreignKey':_0xa1eb('0x157')});db[_0xa1eb('0x13f')][_0xa1eb('0x12d')](db['Trunk'],{'as':_0xa1eb('0x158'),'foreignKey':_0xa1eb('0x159')});db[_0xa1eb('0x13f')][_0xa1eb('0x12d')](db[_0xa1eb('0x88')],{'as':_0xa1eb('0x88'),'foreignKey':_0xa1eb('0x15a')});db['VoiceQueue'][_0xa1eb('0x12d')](db[_0xa1eb('0x8a')],{'as':_0xa1eb('0x15b'),'foreignKey':_0xa1eb('0x15c')});db['VoiceQueue'][_0xa1eb('0x12f')](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x134'),'through':_0xa1eb('0x15d')});db['VoiceQueue'][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x2e')});db['VoiceQueue']['belongsToMany'](db[_0xa1eb('0xef')],{'as':'Teams','through':_0xa1eb('0x113')});db[_0xa1eb('0x13f')][_0xa1eb('0x12f')](db['CmList'],{'as':_0xa1eb('0x15f'),'through':_0xa1eb('0x160')});db['VoiceRecording']['belongsTo'](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x14'),'foreignKey':'UserId'});db[_0xa1eb('0x161')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x14'),'foreignKey':'UserId'});db[_0xa1eb('0x1f')]['hasMany'](db[_0xa1eb('0x21')],{'as':'Messages','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x162'),'sourceKey':_0xa1eb('0x163')});db[_0xa1eb('0x21')][_0xa1eb('0x12d')](db[_0xa1eb('0x1f')],{'foreignKey':_0xa1eb('0x162'),'targetKey':_0xa1eb('0x163')});db[_0xa1eb('0x23')][_0xa1eb('0x11f')](db[_0xa1eb('0x164')],{'as':'QueueCalls','foreignKey':_0xa1eb('0x165'),'constraints':![]});db[_0xa1eb('0x23')][_0xa1eb('0x11f')](db['VoiceAgentReport'],{'as':_0xa1eb('0x166'),'foreignKey':_0xa1eb('0x165'),'constraints':![]});db[_0xa1eb('0x23')][_0xa1eb('0x12d')](db['User'],{'as':_0xa1eb('0x14'),'foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x23')][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':'ContactId'});db['MailServerIn'][_0xa1eb('0x12d')](db[_0xa1eb('0x3c')],{'as':_0xa1eb('0x3c'),'foreignKey':_0xa1eb('0x168')});db[_0xa1eb('0x39')]['belongsTo'](db[_0xa1eb('0x111')],{'as':'CloudProvider','foreignKey':_0xa1eb('0x169'),'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x3b')][_0xa1eb('0x12d')](db['MailAccount'],{'as':_0xa1eb('0x3c'),'foreignKey':_0xa1eb('0x168')});db[_0xa1eb('0x3b')]['belongsTo'](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0xa1eb('0x169'),'onDelete':_0xa1eb('0x16a')});db['MailAccount'][_0xa1eb('0x11c')](db['MailServerIn'],{'as':_0xa1eb('0x16b'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x3c')][_0xa1eb('0x11c')](db[_0xa1eb('0x3b')],{'as':'Smtp','onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x3c')][_0xa1eb('0x11f')](db[_0xa1eb('0x85')],{'as':_0xa1eb('0x16c'),'foreignKey':_0xa1eb('0x168'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x3c')][_0xa1eb('0x11f')](db['CannedAnswer'],{'as':_0xa1eb('0x16d'),'foreignKey':_0xa1eb('0x168')});db['MailAccount'][_0xa1eb('0x11f')](db[_0xa1eb('0x43')],{'as':_0xa1eb('0x16e'),'foreignKey':'MailAccountId'});db[_0xa1eb('0x3c')]['hasMany'](db[_0xa1eb('0x41')],{'as':_0xa1eb('0x16f')});db[_0xa1eb('0x3c')][_0xa1eb('0x11f')](db[_0xa1eb('0x45')],{'as':_0xa1eb('0x151'),'foreignKey':_0xa1eb('0x168'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x3c')][_0xa1eb('0x12d')](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x170'),'foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0x3c')][_0xa1eb('0x12d')](db[_0xa1eb('0x172')],{'as':'Template','foreignKey':_0xa1eb('0x173')});db[_0xa1eb('0x3c')][_0xa1eb('0x12d')](db[_0xa1eb('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xa1eb('0x3c')][_0xa1eb('0x12f')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x148')});db[_0xa1eb('0x3e')][_0xa1eb('0x12f')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x32')});db[_0xa1eb('0x3e')][_0xa1eb('0x12f')](db['Team'],{'through':'team_has_mail_queues','as':_0xa1eb('0x174')});db['MailInteraction'][_0xa1eb('0x11f')](db[_0xa1eb('0x43')],{'as':_0xa1eb('0x16e'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x175')});db[_0xa1eb('0x41')]['belongsTo'](db[_0xa1eb('0x3c')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x168')});db['MailInteraction'][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x41')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x178'),'foreignKey':'UserId'});db[_0xa1eb('0x41')][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':'mail_interaction_has_tags','as':_0xa1eb('0x179')});db[_0xa1eb('0x41')]['belongsToMany'](db[_0xa1eb('0x92')],{'through':_0xa1eb('0x17a'),'as':_0xa1eb('0x17b')});db[_0xa1eb('0x41')]['belongsToMany'](db[_0xa1eb('0x14')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0xa1eb('0x175')});db[_0xa1eb('0x43')][_0xa1eb('0x11f')](db[_0xa1eb('0xf6')],{'as':_0xa1eb('0x17c'),'onDelete':_0xa1eb('0x11a')});db['MailMessage']['belongsTo'](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x14')});db[_0xa1eb('0x43')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xa1eb('0x167')});db[_0xa1eb('0x43')][_0xa1eb('0x12d')](db[_0xa1eb('0x41')],{'as':_0xa1eb('0x17d'),'foreignKey':_0xa1eb('0x175')});db[_0xa1eb('0x43')][_0xa1eb('0x12d')](db['MailAccount'],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x168')});db['MailMessage']['belongsTo'](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xa1eb('0x17e')});db[_0xa1eb('0x43')][_0xa1eb('0x12d')](db[_0xa1eb('0x17f')],{'as':'ChatOfflineMessage','foreignKey':_0xa1eb('0x180')});db[_0xa1eb('0x45')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x45')][_0xa1eb('0x12d')](db[_0xa1eb('0x3e')],{'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x45')]['belongsTo'](db['MailAccount'],{'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x45')][_0xa1eb('0x12d')](db[_0xa1eb('0x88')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':'IntervalId'});db['MailApplication'][_0xa1eb('0x12d')](db[_0xa1eb('0x92')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':_0xa1eb('0x181')});db[_0xa1eb('0x47')]['belongsTo'](db['MailAccount'],{});db[_0xa1eb('0x47')]['belongsTo'](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x170'),'foreignKey':'ListId'});db['MailQueueReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x47')][_0xa1eb('0x12d')](db[_0xa1eb('0x41')],{});db['MailQueueReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x43')],{});db[_0xa1eb('0x47')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{});db['MailQueueReport'][_0xa1eb('0x12d')](db['MailQueue'],{});db[_0xa1eb('0x49')]['hasMany'](db[_0xa1eb('0x4a')],{'as':_0xa1eb('0x182'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x4c')][_0xa1eb('0x11f')](db[_0xa1eb('0x85')],{'as':_0xa1eb('0x16c'),'foreignKey':_0xa1eb('0x183'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x4c')][_0xa1eb('0x11f')](db[_0xa1eb('0x83')],{'as':_0xa1eb('0x16d'),'foreignKey':_0xa1eb('0x183')});db[_0xa1eb('0x4c')][_0xa1eb('0x11f')](db['FaxInteraction'],{'as':_0xa1eb('0x16f')});db[_0xa1eb('0x4c')][_0xa1eb('0x11f')](db[_0xa1eb('0x4e')],{'as':_0xa1eb('0x151'),'foreignKey':_0xa1eb('0x183'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x4c')][_0xa1eb('0x11f')](db[_0xa1eb('0x19')],{'as':_0xa1eb('0x184'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x4c')][_0xa1eb('0x11f')](db['FaxMessage'],{'as':_0xa1eb('0x16e')});db[_0xa1eb('0x4c')][_0xa1eb('0x12d')](db[_0xa1eb('0x28')],{'as':'Trunk'});db[_0xa1eb('0x4c')]['belongsTo'](db['CmList'],{'as':_0xa1eb('0x170'),'foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0x4c')][_0xa1eb('0x12d')](db[_0xa1eb('0x8a')],{'as':_0xa1eb('0x15b'),'foreignKey':_0xa1eb('0x15c')});db[_0xa1eb('0x4c')][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x146')});db[_0xa1eb('0x4e')]['belongsTo'](db['User'],{'onDelete':_0xa1eb('0x16a')});db['FaxApplication'][_0xa1eb('0x12d')](db[_0xa1eb('0x53')],{'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x4e')][_0xa1eb('0x12d')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xa1eb('0x4e')][_0xa1eb('0x12d')](db[_0xa1eb('0x92')],{'onDelete':'restrict','foreignKey':_0xa1eb('0x181')});db[_0xa1eb('0x50')][_0xa1eb('0x11f')](db[_0xa1eb('0x185')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xa1eb('0x186')});db[_0xa1eb('0x50')]['belongsTo'](db[_0xa1eb('0x4c')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x183')});db['FaxInteraction'][_0xa1eb('0x12d')](db['CmContact'],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x50')]['belongsTo'](db[_0xa1eb('0x14')],{'as':'Owner','foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x50')][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':_0xa1eb('0x187'),'as':_0xa1eb('0x179')});db['FaxInteraction']['belongsToMany'](db[_0xa1eb('0x92')],{'through':_0xa1eb('0x187'),'as':'ThroughTags'});db[_0xa1eb('0x50')][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x188'),'through':_0xa1eb('0x13b'),'foreignKey':'FaxInteractionId'});db[_0xa1eb('0x185')]['belongsTo'](db['User'],{'onDelete':_0xa1eb('0x11a'),'as':'User'});db[_0xa1eb('0x185')][_0xa1eb('0x12d')](db[_0xa1eb('0x50')],{'as':_0xa1eb('0x17d'),'foreignKey':_0xa1eb('0x186')});db[_0xa1eb('0x185')]['belongsTo'](db[_0xa1eb('0x131')],{'onDelete':_0xa1eb('0x11a'),'as':'Contact'});db[_0xa1eb('0x185')][_0xa1eb('0x12d')](db[_0xa1eb('0xf6')],{'as':'Attachment','foreignKey':_0xa1eb('0x189')});db[_0xa1eb('0x185')]['belongsTo'](db[_0xa1eb('0x4c')],{'as':'Account','foreignKey':_0xa1eb('0x183')});db[_0xa1eb('0x53')]['belongsToMany'](db[_0xa1eb('0x14')],{'as':'Agents','through':_0xa1eb('0x140')});db[_0xa1eb('0x53')][_0xa1eb('0x12f')](db[_0xa1eb('0xef')],{'through':_0xa1eb('0x18a'),'as':'Teams'});db[_0xa1eb('0x55')][_0xa1eb('0x12d')](db[_0xa1eb('0x4c')],{});db['FaxQueueReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x170'),'foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0x55')][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x55')]['belongsTo'](db[_0xa1eb('0x50')],{});db['FaxQueueReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x185')],{});db[_0xa1eb('0x55')]['belongsTo'](db[_0xa1eb('0x14')],{});db['FaxQueueReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x53')],{});db[_0xa1eb('0x57')][_0xa1eb('0x11f')](db['Disposition'],{'as':_0xa1eb('0x16c'),'foreignKey':_0xa1eb('0x18b'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x57')][_0xa1eb('0x11f')](db[_0xa1eb('0x83')],{'as':_0xa1eb('0x16d'),'foreignKey':_0xa1eb('0x18b')});db[_0xa1eb('0x57')][_0xa1eb('0x11f')](db[_0xa1eb('0x5d')],{'as':_0xa1eb('0x16e'),'foreignKey':_0xa1eb('0x18b')});db[_0xa1eb('0x57')][_0xa1eb('0x11f')](db[_0xa1eb('0x5b')],{'as':_0xa1eb('0x16f')});db[_0xa1eb('0x57')]['hasMany'](db[_0xa1eb('0x59')],{'as':_0xa1eb('0x151'),'foreignKey':_0xa1eb('0x18b'),'onDelete':_0xa1eb('0x11a')});db['SmsAccount'][_0xa1eb('0x12d')](db[_0xa1eb('0x133')],{'as':'List','foreignKey':_0xa1eb('0x171')});db['SmsAccount']['belongsTo'](db['Pause'],{'as':_0xa1eb('0x15b'),'foreignKey':_0xa1eb('0x15c')});db['SmsAccount'][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x14a')});db[_0xa1eb('0x59')]['belongsTo'](db[_0xa1eb('0x14')],{'onDelete':'restrict'});db['SmsApplication'][_0xa1eb('0x12d')](db[_0xa1eb('0x5f')],{'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x59')][_0xa1eb('0x12d')](db[_0xa1eb('0x57')],{'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x59')][_0xa1eb('0x12d')](db[_0xa1eb('0x88')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':_0xa1eb('0x15a')});db[_0xa1eb('0x59')]['belongsTo'](db[_0xa1eb('0x92')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':'TagId'});db['SmsInteraction'][_0xa1eb('0x11f')](db['SmsMessage'],{'as':'Messages','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x18c')});db['SmsInteraction'][_0xa1eb('0x12d')](db['SmsAccount'],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x18b')});db[_0xa1eb('0x5b')]['belongsTo'](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db['SmsInteraction'][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':'Owner','foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x5b')]['belongsToMany'](db[_0xa1eb('0x92')],{'through':'sms_interaction_has_tags','as':_0xa1eb('0x179')});db[_0xa1eb('0x5b')][_0xa1eb('0x12f')](db['Tag'],{'through':_0xa1eb('0x18d'),'as':_0xa1eb('0x17b')});db[_0xa1eb('0x5b')]['belongsToMany'](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x188'),'through':_0xa1eb('0x13c'),'foreignKey':'SmsInteractionId'});db[_0xa1eb('0x5d')]['belongsTo'](db['User'],{'as':_0xa1eb('0x14')});db[_0xa1eb('0x5d')][_0xa1eb('0x12d')](db['CmContact'],{'onDelete':_0xa1eb('0x11a'),'as':_0xa1eb('0x167')});db[_0xa1eb('0x5d')][_0xa1eb('0x12d')](db['SmsInteraction'],{'onDelete':_0xa1eb('0x11a'),'as':'Interaction','foreignKey':_0xa1eb('0x18c')});db[_0xa1eb('0x5d')][_0xa1eb('0x12d')](db[_0xa1eb('0x57')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x18b')});db[_0xa1eb('0x5f')][_0xa1eb('0x12f')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x141'),'foreignKey':_0xa1eb('0x18e')});db[_0xa1eb('0x5f')][_0xa1eb('0x12f')](db[_0xa1eb('0xef')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xa1eb('0x61')][_0xa1eb('0x11f')](db[_0xa1eb('0x85')],{'as':_0xa1eb('0x16c'),'foreignKey':_0xa1eb('0x18f'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x61')][_0xa1eb('0x11f')](db[_0xa1eb('0x83')],{'as':_0xa1eb('0x16d'),'foreignKey':_0xa1eb('0x18f')});db['OpenchannelAccount']['hasMany'](db[_0xa1eb('0x65')],{'as':_0xa1eb('0x16f'),'foreignKey':_0xa1eb('0x18f')});db[_0xa1eb('0x61')][_0xa1eb('0x11f')](db[_0xa1eb('0x66')],{'as':_0xa1eb('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0xa1eb('0x61')]['hasMany'](db[_0xa1eb('0x63')],{'as':_0xa1eb('0x151'),'foreignKey':_0xa1eb('0x18f'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x61')][_0xa1eb('0x12d')](db['CmList'],{'as':_0xa1eb('0x170'),'foreignKey':'ListId'});db[_0xa1eb('0x61')]['belongsTo'](db['Pause'],{'as':_0xa1eb('0x15b'),'foreignKey':_0xa1eb('0x15c')});db['OpenchannelAccount'][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x190')});db[_0xa1eb('0x63')]['belongsTo'](db[_0xa1eb('0x14')],{'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x63')][_0xa1eb('0x12d')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0xa1eb('0x63')][_0xa1eb('0x12d')](db[_0xa1eb('0x61')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0xa1eb('0x63')][_0xa1eb('0x12d')](db[_0xa1eb('0x88')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':'IntervalId'});db[_0xa1eb('0x63')][_0xa1eb('0x12d')](db[_0xa1eb('0x92')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':_0xa1eb('0x181')});db[_0xa1eb('0x65')][_0xa1eb('0x11f')](db[_0xa1eb('0x66')],{'as':_0xa1eb('0x16e'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x191')});db[_0xa1eb('0x65')][_0xa1eb('0x12d')](db[_0xa1eb('0x61')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x18f')});db[_0xa1eb('0x65')][_0xa1eb('0x12d')](db['CmContact'],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db['OpenchannelInteraction'][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':'Owner','foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x65')][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':_0xa1eb('0x192'),'as':'Tags'});db[_0xa1eb('0x65')][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':_0xa1eb('0x192'),'as':_0xa1eb('0x17b')});db[_0xa1eb('0x65')]['belongsToMany'](db[_0xa1eb('0x14')],{'as':'Users','through':_0xa1eb('0x13d'),'foreignKey':_0xa1eb('0x191')});db[_0xa1eb('0x66')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'onDelete':_0xa1eb('0x11a'),'as':'User'});db[_0xa1eb('0x66')][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'onDelete':_0xa1eb('0x11a'),'as':_0xa1eb('0x167')});db[_0xa1eb('0x66')][_0xa1eb('0x12d')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0xa1eb('0x17d'),'foreignKey':_0xa1eb('0x191')});db[_0xa1eb('0x66')][_0xa1eb('0x12d')](db[_0xa1eb('0xf6')],{'as':_0xa1eb('0xf6'),'foreignKey':_0xa1eb('0x189')});db[_0xa1eb('0x66')][_0xa1eb('0x12d')](db[_0xa1eb('0x61')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x18f')});db[_0xa1eb('0x67')]['belongsToMany'](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x35'),'foreignKey':_0xa1eb('0x193')});db[_0xa1eb('0x67')][_0xa1eb('0x12f')](db[_0xa1eb('0xef')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0xa1eb('0x68')][_0xa1eb('0x11f')](db[_0xa1eb('0x85')],{'as':'Dispositions','foreignKey':_0xa1eb('0x17e'),'onDelete':_0xa1eb('0x11a')});db['ChatWebsite'][_0xa1eb('0x11f')](db[_0xa1eb('0x83')],{'as':_0xa1eb('0x16d'),'foreignKey':_0xa1eb('0x17e')});db[_0xa1eb('0x68')][_0xa1eb('0x11f')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xa1eb('0x68')][_0xa1eb('0x11f')](db[_0xa1eb('0x6e')],{'as':_0xa1eb('0x16f')});db['ChatWebsite'][_0xa1eb('0x11f')](db['ChatApplication'],{'as':_0xa1eb('0x151'),'foreignKey':'ChatWebsiteId','onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x68')][_0xa1eb('0x11f')](db[_0xa1eb('0x70')],{'as':_0xa1eb('0x16e')});db[_0xa1eb('0x68')][_0xa1eb('0x12d')](db[_0xa1eb('0x133')],{'as':'List','foreignKey':_0xa1eb('0x171')});db['ChatWebsite'][_0xa1eb('0x12d')](db[_0xa1eb('0x88')],{'as':_0xa1eb('0x88'),'foreignKey':_0xa1eb('0x15a')});db[_0xa1eb('0x68')]['belongsTo'](db[_0xa1eb('0x3c')],{'as':_0xa1eb('0x3c'),'foreignKey':_0xa1eb('0x168')});db[_0xa1eb('0x68')]['belongsTo'](db[_0xa1eb('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':_0xa1eb('0x15c')});db[_0xa1eb('0x68')][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x144')});db['OpenchannelQueueReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x61')],{});db['OpenchannelQueueReport']['belongsTo'](db['CmList'],{'as':_0xa1eb('0x170'),'foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0x6a')][_0xa1eb('0x12d')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xa1eb('0x6a')]['belongsTo'](db[_0xa1eb('0x65')],{});db[_0xa1eb('0x6a')]['belongsTo'](db[_0xa1eb('0x66')],{});db[_0xa1eb('0x6a')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{});db[_0xa1eb('0x6a')]['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication'][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x194'),'foreignKey':_0xa1eb('0x11b'),'onDelete':'restrict'});db[_0xa1eb('0x6c')]['belongsTo'](db[_0xa1eb('0x73')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x6c')]['belongsTo'](db[_0xa1eb('0x68')],{'as':_0xa1eb('0x195'),'foreignKey':_0xa1eb('0x17e'),'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x6c')]['belongsTo'](db[_0xa1eb('0x92')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':_0xa1eb('0x181')});db[_0xa1eb('0x6e')][_0xa1eb('0x11f')](db[_0xa1eb('0x70')],{'as':'Messages','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x196')});db[_0xa1eb('0x6e')]['belongsTo'](db['ChatWebsite'],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x17e')});db['ChatInteraction'][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x6e')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x178'),'foreignKey':_0xa1eb('0x11b')});db['ChatInteraction'][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':'chat_interaction_has_tags','as':_0xa1eb('0x179')});db['ChatInteraction'][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':_0xa1eb('0x197'),'as':_0xa1eb('0x17b')});db[_0xa1eb('0x6e')][_0xa1eb('0x12f')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x188'),'through':_0xa1eb('0x139'),'foreignKey':'ChatInteractionId'});db[_0xa1eb('0x70')]['belongsTo'](db[_0xa1eb('0x14')],{'onDelete':_0xa1eb('0x11a'),'as':'User'});db['ChatMessage'][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'onDelete':_0xa1eb('0x11a'),'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x70')]['belongsTo'](db[_0xa1eb('0x6e')],{'onDelete':_0xa1eb('0x11a'),'as':'Interaction','foreignKey':_0xa1eb('0x196')});db[_0xa1eb('0x70')][_0xa1eb('0x12d')](db['Attachment'],{'as':'Attachment','foreignKey':_0xa1eb('0x189')});db['ChatMessage'][_0xa1eb('0x12d')](db[_0xa1eb('0x68')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x17e')});db[_0xa1eb('0x17f')]['hasMany'](db['Attachment'],{'as':_0xa1eb('0x17c'),'foreignKey':_0xa1eb('0x180'),'onDelete':_0xa1eb('0x11a'),'hooks':!![]});db[_0xa1eb('0x17f')][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'onDelete':_0xa1eb('0x11a'),'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db['ChatOfflineMessage'][_0xa1eb('0x12d')](db[_0xa1eb('0x68')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x17e')});db['ChatQueue'][_0xa1eb('0x12f')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x15e'),'through':'UserChatQueue','hooks':!![]});db[_0xa1eb('0x73')][_0xa1eb('0x12f')](db[_0xa1eb('0xef')],{'through':'team_has_chat_queues','as':_0xa1eb('0x174')});db[_0xa1eb('0x74')]['hasMany'](db[_0xa1eb('0xd9')],{'as':_0xa1eb('0x16e'),'foreignKey':_0xa1eb('0x198'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x74')][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x199'),'through':_0xa1eb('0x130')});db[_0xa1eb('0x76')][_0xa1eb('0x12d')](db[_0xa1eb('0x68')],{'as':_0xa1eb('0x195'),'foreignKey':'ChatWebsiteId'});db[_0xa1eb('0x77')][_0xa1eb('0x11f')](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x19a'),'foreignKey':_0xa1eb('0x19b')});db[_0xa1eb('0x131')][_0xa1eb('0x11f')](db[_0xa1eb('0x19c')],{'as':_0xa1eb('0x19d'),'foreignKey':_0xa1eb('0x19e')});db[_0xa1eb('0x131')]['hasMany'](db[_0xa1eb('0x79')],{'as':_0xa1eb('0x12b'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x131')][_0xa1eb('0x11f')](db[_0xa1eb('0x121')],{'as':_0xa1eb('0x122'),'foreignKey':_0xa1eb('0x177')});db['CmContact'][_0xa1eb('0x11f')](db[_0xa1eb('0x7d')],{'as':_0xa1eb('0x19f'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x131')]['hasMany'](db['ReportAgentPreview'],{'as':_0xa1eb('0x124'),'foreignKey':'ContactId'});db[_0xa1eb('0x131')][_0xa1eb('0x11f')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x131')][_0xa1eb('0x11f')](db[_0xa1eb('0x65')],{'as':_0xa1eb('0x125'),'foreignKey':_0xa1eb('0x177'),'onDelete':_0xa1eb('0x16a')});db['CmContact'][_0xa1eb('0x11f')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xa1eb('0x177'),'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x131')][_0xa1eb('0x11f')](db['SmsInteraction'],{'as':_0xa1eb('0x126'),'foreignKey':'ContactId','onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x131')]['hasMany'](db[_0xa1eb('0x50')],{'as':_0xa1eb('0x13a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa1eb('0x131')][_0xa1eb('0x11f')](db[_0xa1eb('0x41')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x131')][_0xa1eb('0x12d')](db[_0xa1eb('0x77')],{'as':_0xa1eb('0x1a0'),'foreignKey':'CompanyId'});db[_0xa1eb('0x131')][_0xa1eb('0x12d')](db['CmList'],{'as':_0xa1eb('0x170'),'foreignKey':_0xa1eb('0x171'),'onDelete':'cascade'});db[_0xa1eb('0x131')][_0xa1eb('0x12f')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x188'),'through':_0xa1eb('0x132')});db[_0xa1eb('0x131')][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'as':_0xa1eb('0x179'),'through':_0xa1eb('0x1a1')});db['CmContact'][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0xa1eb('0x79')][_0xa1eb('0x11f')](db[_0xa1eb('0x96')],{'as':_0xa1eb('0x1a2'),'foreignKey':_0xa1eb('0x1a3')});db['CmHopper'][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':'ContactId','onDelete':_0xa1eb('0x11a')});db['CmHopper'][_0xa1eb('0x12d')](db['CmList'],{'as':_0xa1eb('0x170'),'foreignKey':_0xa1eb('0x171'),'onDelete':'cascade'});db[_0xa1eb('0x79')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x194'),'foreignKey':'UserId'});db[_0xa1eb('0x79')]['belongsTo'](db[_0xa1eb('0x13f')],{'as':_0xa1eb('0x1a4'),'foreignKey':_0xa1eb('0x154'),'onDelete':_0xa1eb('0x11a')});db['CmHopper'][_0xa1eb('0x12d')](db[_0xa1eb('0xf2')],{'as':_0xa1eb('0xf2'),'foreignKey':'CampaignId','onDelete':_0xa1eb('0x11a')});db['CmHopper']['belongsTo'](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x178'),'foreignKey':_0xa1eb('0x1a5')});db['CmHopperBlack'][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x7b')][_0xa1eb('0x12d')](db[_0xa1eb('0x133')],{'as':'List','foreignKey':_0xa1eb('0x171'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x7b')][_0xa1eb('0x12d')](db[_0xa1eb('0x13f')],{'as':_0xa1eb('0x1a4'),'foreignKey':_0xa1eb('0x154'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x7b')][_0xa1eb('0x12d')](db[_0xa1eb('0xf2')],{'as':_0xa1eb('0xf2'),'foreignKey':_0xa1eb('0x1a6'),'onDelete':'cascade'});db[_0xa1eb('0x81')]['hasMany'](db[_0xa1eb('0x86')],{'as':{'plural':_0xa1eb('0x1a7'),'singular':'OneAll'},'foreignKey':_0xa1eb('0x1a8'),'onDelete':_0xa1eb('0x11a'),'hooks':!![]});db[_0xa1eb('0x81')][_0xa1eb('0x11f')](db['Condition'],{'as':{'plural':_0xa1eb('0x1a9'),'singular':_0xa1eb('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0xa1eb('0x11a'),'hooks':!![]});db[_0xa1eb('0x81')][_0xa1eb('0x11f')](db[_0xa1eb('0x7f')],{'as':_0xa1eb('0x1ab'),'foreignKey':_0xa1eb('0x1ac'),'onDelete':_0xa1eb('0x11a'),'hooks':!![]});db[_0xa1eb('0x85')]['hasMany'](db[_0xa1eb('0x85')],{'as':_0xa1eb('0x16c'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xa1eb('0x88')]['hasMany'](db[_0xa1eb('0x88')],{'as':'Intervals','foreignKey':_0xa1eb('0x15a'),'onDelete':_0xa1eb('0x11a'),'hooks':!![],'required':![]});db[_0xa1eb('0x88')][_0xa1eb('0x11f')](db['VoiceExtension'],{'as':_0xa1eb('0x120'),'foreignKey':_0xa1eb('0x15a'),'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x88')]['hasMany'](db['MailApplication'],{'as':_0xa1eb('0x1ad'),'foreignKey':'IntervalId'});db[_0xa1eb('0x88')]['hasMany'](db['ChatApplication'],{'as':_0xa1eb('0x1ae'),'foreignKey':_0xa1eb('0x15a')});db[_0xa1eb('0x88')]['hasMany'](db[_0xa1eb('0x4e')],{'as':_0xa1eb('0x1af'),'foreignKey':_0xa1eb('0x15a')});db[_0xa1eb('0x88')][_0xa1eb('0x11f')](db[_0xa1eb('0x59')],{'as':_0xa1eb('0x1b0'),'foreignKey':_0xa1eb('0x15a')});db['Schedule'][_0xa1eb('0x12d')](db[_0xa1eb('0x3c')],{});db[_0xa1eb('0x8e')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xa1eb('0x12d')](db['AnalyticCustomReport'],{'foreignKey':_0xa1eb('0x1b1')});db[_0xa1eb('0x90')][_0xa1eb('0x12f')](db[_0xa1eb('0x1b')],{'as':'Mohs','through':_0xa1eb('0x153'),'onDelete':_0xa1eb('0x16a')});db['Tag']['belongsToMany'](db['CmContact'],{'through':_0xa1eb('0x1a1')});db[_0xa1eb('0x92')]['belongsToMany'](db[_0xa1eb('0x6e')],{'through':'chat_interaction_has_tags'});db[_0xa1eb('0x92')][_0xa1eb('0x12f')](db['MailInteraction'],{'through':_0xa1eb('0x17a')});db[_0xa1eb('0x92')][_0xa1eb('0x12f')](db[_0xa1eb('0x5b')],{'through':_0xa1eb('0x18d')});db[_0xa1eb('0x92')][_0xa1eb('0x12f')](db['FaxInteraction'],{'through':_0xa1eb('0x187')});db[_0xa1eb('0x92')]['belongsToMany'](db[_0xa1eb('0x65')],{'through':_0xa1eb('0x192')});db[_0xa1eb('0x92')]['belongsToMany'](db[_0xa1eb('0x128')],{'through':_0xa1eb('0x1b2')});db[_0xa1eb('0x19c')][_0xa1eb('0x12d')](db[_0xa1eb('0x1b3')],{'as':_0xa1eb('0x1b4'),'foreignKey':_0xa1eb('0x1b5')});db['CmHopperAdditionalPhone']['belongsTo'](db[_0xa1eb('0x79')],{'as':'Hopper','foreignKey':_0xa1eb('0x1a3')});db[_0xa1eb('0x19c')][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':'Contact','foreignKey':_0xa1eb('0x19e')});db[_0xa1eb('0x99')][_0xa1eb('0x11f')](db[_0xa1eb('0x86')],{'as':{'plural':'AllConditions','singular':_0xa1eb('0x1b6')},'foreignKey':_0xa1eb('0x1b7'),'onDelete':_0xa1eb('0x11a'),'hooks':!![]});db[_0xa1eb('0x99')][_0xa1eb('0x11f')](db[_0xa1eb('0x86')],{'as':{'plural':_0xa1eb('0x1b8'),'singular':_0xa1eb('0x1b9')},'foreignKey':_0xa1eb('0x1ba'),'onDelete':_0xa1eb('0x11a'),'hooks':!![]});db[_0xa1eb('0x99')][_0xa1eb('0x11f')](db['Action'],{'as':_0xa1eb('0x1ab'),'foreignKey':_0xa1eb('0x1bb'),'onDelete':_0xa1eb('0x11a'),'hooks':!![]});db['AnalyticCustomReport'][_0xa1eb('0x11f')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1b1'),'hooks':!![]});db[_0xa1eb('0x1bc')][_0xa1eb('0x11f')](db['AnalyticFieldReport'],{'as':_0xa1eb('0x1bd'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1be')});db[_0xa1eb('0xa3')]['hasMany'](db[_0xa1eb('0x1bf')],{'as':_0xa1eb('0x1bd'),'onDelete':'cascade','foreignKey':_0xa1eb('0x1c0')});db[_0xa1eb('0x1bf')][_0xa1eb('0x12d')](db[_0xa1eb('0xa3')],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':_0xa1eb('0x1c1'),'onDelete':_0xa1eb('0x11a'),'foreignKey':'AccountId'});db['SalesforceConfiguration']['hasMany'](db[_0xa1eb('0xac')],{'as':_0xa1eb('0x1c2'),'onDelete':_0xa1eb('0x11a'),'foreignKey':'SubjectId'});db[_0xa1eb('0xaa')][_0xa1eb('0x11f')](db[_0xa1eb('0xac')],{'as':_0xa1eb('0x1c3'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c4')});db['SalesforceConfiguration'][_0xa1eb('0x11f')](db[_0xa1eb('0xac')],{'as':_0xa1eb('0x1bd'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xa1eb('0xaa')]['belongsTo'](db[_0xa1eb('0xa8')],{'as':_0xa1eb('0x176'),'foreignKey':'AccountId'});db['SalesforceField'][_0xa1eb('0x11f')](db['SalesforceField'],{'as':_0xa1eb('0x1c5'),'foreignKey':_0xa1eb('0x1c6')});db['SalesforceField'][_0xa1eb('0x11f')](db[_0xa1eb('0xac')],{'as':_0xa1eb('0x1c7'),'foreignKey':'DescriptionId'});db[_0xa1eb('0xac')][_0xa1eb('0x11f')](db[_0xa1eb('0xac')],{'as':_0xa1eb('0x1c8'),'foreignKey':'FieldId'});db[_0xa1eb('0xac')][_0xa1eb('0x12d')](db[_0xa1eb('0x9a')],{'as':'Variable','foreignKey':_0xa1eb('0x1c9')});db[_0xa1eb('0xae')][_0xa1eb('0x11f')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0xb0')][_0xa1eb('0x11f')](db[_0xa1eb('0xb2')],{'as':'Subjects','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c6')});db['SugarcrmConfiguration'][_0xa1eb('0x11f')](db['SugarcrmField'],{'as':_0xa1eb('0x1c3'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c4')});db['SugarcrmConfiguration'][_0xa1eb('0x11f')](db[_0xa1eb('0xb2')],{'as':_0xa1eb('0x1bd'),'onDelete':'cascade','foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0xb0')][_0xa1eb('0x12d')](db[_0xa1eb('0xae')],{'as':_0xa1eb('0x176'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xa1eb('0x11f')](db['SugarcrmField'],{'as':_0xa1eb('0x1c5'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0xb2')]['hasMany'](db['SugarcrmField'],{'as':_0xa1eb('0x1c7'),'foreignKey':_0xa1eb('0x1c4')});db['SugarcrmField']['hasMany'](db[_0xa1eb('0xb2')],{'as':_0xa1eb('0x1c8'),'foreignKey':'FieldId'});db[_0xa1eb('0xb2')]['belongsTo'](db[_0xa1eb('0x9a')],{'as':_0xa1eb('0x9a'),'foreignKey':'VariableId'});db['DeskAccount']['hasMany'](db[_0xa1eb('0x1cc')],{'as':_0xa1eb('0x1c1'),'onDelete':'cascade','foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0x1cc')][_0xa1eb('0x11f')](db[_0xa1eb('0xb5')],{'as':_0xa1eb('0x1c2'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0x1cc')][_0xa1eb('0x11f')](db['DeskField'],{'as':'Descriptions','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0x1cc')][_0xa1eb('0x11f')](db['DeskField'],{'as':_0xa1eb('0x1bd'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0x1cc')][_0xa1eb('0x12d')](db[_0xa1eb('0xb3')],{'as':'Account','foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0x1cc')][_0xa1eb('0x12f')](db['Tag'],{'through':_0xa1eb('0x1cd')});db['DeskField'][_0xa1eb('0x11f')](db[_0xa1eb('0xb5')],{'as':_0xa1eb('0x1c5'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0xb5')]['hasMany'](db['DeskField'],{'as':_0xa1eb('0x1c7'),'foreignKey':_0xa1eb('0x1c4')});db['DeskField']['hasMany'](db[_0xa1eb('0xb5')],{'as':_0xa1eb('0x1c8'),'foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0xb5')][_0xa1eb('0x12d')](db['Variable'],{'as':_0xa1eb('0x9a'),'foreignKey':'VariableId'});db[_0xa1eb('0xb7')][_0xa1eb('0x11f')](db[_0xa1eb('0xb9')],{'as':_0xa1eb('0x1c1'),'onDelete':_0xa1eb('0x11a'),'foreignKey':'AccountId'});db[_0xa1eb('0xb9')]['hasMany'](db[_0xa1eb('0xba')],{'as':_0xa1eb('0x1c2'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0xb9')][_0xa1eb('0x11f')](db[_0xa1eb('0xba')],{'as':_0xa1eb('0x1c3'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0xb9')][_0xa1eb('0x11f')](db[_0xa1eb('0xba')],{'as':_0xa1eb('0x1bd'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xa1eb('0xb9')][_0xa1eb('0x12d')](db[_0xa1eb('0xb7')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x1ca')});db['ZohoField']['hasMany'](db[_0xa1eb('0xba')],{'as':'Subject','foreignKey':_0xa1eb('0x1c6')});db['ZohoField'][_0xa1eb('0x11f')](db[_0xa1eb('0xba')],{'as':_0xa1eb('0x1c7'),'foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0xba')][_0xa1eb('0x11f')](db['ZohoField'],{'as':_0xa1eb('0x1c8'),'foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0xba')][_0xa1eb('0x12d')](db[_0xa1eb('0x9a')],{'as':_0xa1eb('0x9a'),'foreignKey':_0xa1eb('0x1c9')});db[_0xa1eb('0x1ce')][_0xa1eb('0x11f')](db[_0xa1eb('0x1cf')],{'as':_0xa1eb('0x1c1'),'onDelete':'cascade','foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0x1cf')][_0xa1eb('0x11f')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0x1cf')]['hasMany'](db[_0xa1eb('0x1d0')],{'as':'Descriptions','foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0x1cf')][_0xa1eb('0x11f')](db[_0xa1eb('0x1d0')],{'as':_0xa1eb('0x1bd'),'foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0x1cf')][_0xa1eb('0x12d')](db[_0xa1eb('0x1ce')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0x1cf')][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':_0xa1eb('0x1d1')});db[_0xa1eb('0x1d0')][_0xa1eb('0x11f')](db[_0xa1eb('0x1d0')],{'as':_0xa1eb('0x1c5'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0x1d0')][_0xa1eb('0x11f')](db['ZendeskField'],{'as':_0xa1eb('0x1c7'),'foreignKey':'DescriptionId'});db[_0xa1eb('0x1d0')][_0xa1eb('0x11f')](db[_0xa1eb('0x1d0')],{'as':'Field','foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0x1d0')][_0xa1eb('0x12d')](db[_0xa1eb('0x9a')],{'as':'Variable','foreignKey':_0xa1eb('0x1c9')});db[_0xa1eb('0xbf')][_0xa1eb('0x11f')](db[_0xa1eb('0xc1')],{'as':_0xa1eb('0x1c1'),'onDelete':_0xa1eb('0x11a'),'foreignKey':'AccountId'});db[_0xa1eb('0xc1')][_0xa1eb('0x11f')](db[_0xa1eb('0xc2')],{'as':'Subjects','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0xc1')][_0xa1eb('0x11f')](db[_0xa1eb('0xc2')],{'as':'Descriptions','onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0xc1')][_0xa1eb('0x11f')](db[_0xa1eb('0xc2')],{'as':'Fields','onDelete':_0xa1eb('0x11a'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xa1eb('0x12d')](db[_0xa1eb('0xbf')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0xc1')]['belongsToMany'](db[_0xa1eb('0x92')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xa1eb('0xc2')]['hasMany'](db['FreshdeskField'],{'as':_0xa1eb('0x1c5'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0xc2')][_0xa1eb('0x11f')](db[_0xa1eb('0xc2')],{'as':_0xa1eb('0x1c7'),'foreignKey':_0xa1eb('0x1c4')});db['FreshdeskField'][_0xa1eb('0x11f')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xa1eb('0xc2')]['belongsTo'](db[_0xa1eb('0x9a')],{'as':_0xa1eb('0x9a'),'foreignKey':_0xa1eb('0x1c9')});db[_0xa1eb('0xc4')][_0xa1eb('0x11f')](db[_0xa1eb('0x1d2')],{'as':_0xa1eb('0x1c1'),'onDelete':_0xa1eb('0x11a'),'foreignKey':'AccountId'});db[_0xa1eb('0x1d2')][_0xa1eb('0x11f')](db['VtigerField'],{'as':_0xa1eb('0x1c2'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0x1d2')][_0xa1eb('0x11f')](db[_0xa1eb('0xc6')],{'as':_0xa1eb('0x1c3'),'foreignKey':_0xa1eb('0x1c4')});db['VtigerConfiguration'][_0xa1eb('0x11f')](db[_0xa1eb('0xc6')],{'as':'Fields','foreignKey':_0xa1eb('0x1cb')});db['VtigerConfiguration']['belongsTo'](db[_0xa1eb('0xc4')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0xc6')][_0xa1eb('0x11f')](db['VtigerField'],{'as':_0xa1eb('0x1c5'),'foreignKey':'SubjectId'});db[_0xa1eb('0xc6')][_0xa1eb('0x11f')](db[_0xa1eb('0xc6')],{'as':_0xa1eb('0x1c7'),'foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0xc6')]['hasMany'](db['VtigerField'],{'as':_0xa1eb('0x1c8'),'foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0xc6')][_0xa1eb('0x12d')](db[_0xa1eb('0x9a')],{'as':_0xa1eb('0x9a'),'foreignKey':_0xa1eb('0x1c9')});db[_0xa1eb('0xc8')]['hasMany'](db[_0xa1eb('0x1d3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa1eb('0x1ca')});db['ServicenowConfiguration']['hasMany'](db[_0xa1eb('0xca')],{'as':'Subjects','foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0x1d3')][_0xa1eb('0x11f')](db[_0xa1eb('0xca')],{'as':_0xa1eb('0x1c3'),'foreignKey':_0xa1eb('0x1c4')});db['ServicenowConfiguration'][_0xa1eb('0x11f')](db['ServicenowField'],{'as':_0xa1eb('0x1bd'),'foreignKey':_0xa1eb('0x1cb')});db['ServicenowConfiguration'][_0xa1eb('0x12d')](db[_0xa1eb('0xc8')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x1ca')});db['ServicenowField'][_0xa1eb('0x11f')](db['ServicenowField'],{'as':_0xa1eb('0x1c5'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0xca')][_0xa1eb('0x11f')](db[_0xa1eb('0xca')],{'as':_0xa1eb('0x1c7'),'foreignKey':'DescriptionId'});db[_0xa1eb('0xca')][_0xa1eb('0x11f')](db[_0xa1eb('0xca')],{'as':'Field','foreignKey':'FieldId'});db['ServicenowField'][_0xa1eb('0x12d')](db['Variable'],{'as':'Variable','foreignKey':_0xa1eb('0x1c9')});db[_0xa1eb('0xcc')]['hasMany'](db[_0xa1eb('0x1d4')],{'as':_0xa1eb('0x1c1'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0xcc')]['belongsTo'](db[_0xa1eb('0x111')],{'as':_0xa1eb('0x111'),'foreignKey':_0xa1eb('0x169')});db[_0xa1eb('0x1d4')][_0xa1eb('0x11f')](db[_0xa1eb('0xcf')],{'as':_0xa1eb('0x1c2'),'onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xa1eb('0x11f')](db[_0xa1eb('0xcf')],{'as':_0xa1eb('0x1c3'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1c4')});db['Dynamics365Configuration'][_0xa1eb('0x11f')](db[_0xa1eb('0xcf')],{'as':_0xa1eb('0x1bd'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0x1d4')][_0xa1eb('0x12d')](db[_0xa1eb('0xcc')],{'as':_0xa1eb('0x176'),'foreignKey':'AccountId'});db['Dynamics365Field']['hasMany'](db[_0xa1eb('0xcf')],{'as':_0xa1eb('0x1c5'),'foreignKey':_0xa1eb('0x1c6')});db['Dynamics365Field'][_0xa1eb('0x11f')](db[_0xa1eb('0xcf')],{'as':_0xa1eb('0x1c7'),'foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0xcf')][_0xa1eb('0x11f')](db[_0xa1eb('0xcf')],{'as':_0xa1eb('0x1c8'),'foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0xcf')][_0xa1eb('0x12d')](db['Variable'],{'as':_0xa1eb('0x9a'),'foreignKey':_0xa1eb('0x1c9')});db['FreshsalesAccount'][_0xa1eb('0x11f')](db[_0xa1eb('0xd1')],{'as':_0xa1eb('0x1c1'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1ca')});db['FreshsalesConfiguration'][_0xa1eb('0x11f')](db[_0xa1eb('0xd3')],{'as':_0xa1eb('0x1c2'),'foreignKey':_0xa1eb('0x1c6')});db[_0xa1eb('0xd1')]['hasMany'](db[_0xa1eb('0xd3')],{'as':_0xa1eb('0x1c3'),'foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0xd1')][_0xa1eb('0x11f')](db['FreshsalesField'],{'as':_0xa1eb('0x1bd'),'foreignKey':_0xa1eb('0x1cb')});db[_0xa1eb('0xd1')][_0xa1eb('0x12d')](db[_0xa1eb('0x1d5')],{'as':'Account','foreignKey':_0xa1eb('0x1ca')});db[_0xa1eb('0xd3')][_0xa1eb('0x11f')](db['FreshsalesField'],{'as':_0xa1eb('0x1c5'),'foreignKey':_0xa1eb('0x1c6')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':'Description','foreignKey':_0xa1eb('0x1c4')});db[_0xa1eb('0xd3')]['hasMany'](db[_0xa1eb('0xd3')],{'as':_0xa1eb('0x1c8'),'foreignKey':_0xa1eb('0x1cb')});db['FreshsalesField'][_0xa1eb('0x12d')](db[_0xa1eb('0x9a')],{'as':'Variable','foreignKey':'VariableId'});db[_0xa1eb('0xd7')][_0xa1eb('0x12d')](db[_0xa1eb('0x68')],{});db[_0xa1eb('0xd7')][_0xa1eb('0x12d')](db['CmList'],{'as':'List','foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0xd7')][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':'Contact','foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0xd7')][_0xa1eb('0x12d')](db['ChatInteraction'],{});db[_0xa1eb('0xd7')][_0xa1eb('0x12d')](db[_0xa1eb('0x70')],{});db[_0xa1eb('0xd7')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{});db['ChatQueueReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x73')],{});db[_0xa1eb('0xd9')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'onDelete':_0xa1eb('0x11a'),'foreignKey':'FromId'});db[_0xa1eb('0xd9')]['belongsTo'](db[_0xa1eb('0x14')],{'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1d6')});db[_0xa1eb('0xdf')][_0xa1eb('0x11f')](db[_0xa1eb('0xdd')],{'foreignKey':'SessionId','onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0xdf')]['hasMany'](db[_0xa1eb('0xdb')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xa1eb('0xe0')][_0xa1eb('0x12d')](db[_0xa1eb('0x57')],{});db[_0xa1eb('0xe0')][_0xa1eb('0x12d')](db[_0xa1eb('0x133')],{'as':'List','foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0xe0')]['belongsTo'](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0xe0')][_0xa1eb('0x12d')](db[_0xa1eb('0x5b')],{});db['SmsQueueReport']['belongsTo'](db['SmsMessage'],{});db[_0xa1eb('0xe0')][_0xa1eb('0x12d')](db['User'],{});db[_0xa1eb('0xe0')][_0xa1eb('0x12d')](db[_0xa1eb('0x5f')],{});db[_0xa1eb('0xe4')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0xa1eb('0x1d7')});db['JscriptyProject'][_0xa1eb('0x11f')](db[_0xa1eb('0xdd')],{'foreignKey':'ProjectId'});db[_0xa1eb('0xe4')][_0xa1eb('0x11f')](db[_0xa1eb('0xdb')],{'foreignKey':_0xa1eb('0x1d7')});db['Team'][_0xa1eb('0x12f')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x136')});db[_0xa1eb('0xef')][_0xa1eb('0x12f')](db[_0xa1eb('0x13f')],{'through':'TeamVoiceQueue','as':_0xa1eb('0x1d8')});db[_0xa1eb('0xef')][_0xa1eb('0x12f')](db[_0xa1eb('0x3e')],{'through':_0xa1eb('0x1d9'),'as':_0xa1eb('0x1da')});db[_0xa1eb('0xef')][_0xa1eb('0x12f')](db[_0xa1eb('0x73')],{'through':_0xa1eb('0x1db'),'as':_0xa1eb('0x1dc')});db[_0xa1eb('0xef')][_0xa1eb('0x12f')](db[_0xa1eb('0x53')],{'through':'team_has_fax_queues','as':_0xa1eb('0x1dd')});db[_0xa1eb('0xef')][_0xa1eb('0x12f')](db['SmsQueue'],{'through':_0xa1eb('0x1de'),'as':_0xa1eb('0x1df')});db[_0xa1eb('0xef')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0xa1eb('0x1e0'),'as':'OpenchannelQueues'});db[_0xa1eb('0xef')][_0xa1eb('0x12f')](db['WhatsappQueue'],{'through':_0xa1eb('0x1e1'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':_0xa1eb('0x115'),'as':'VoicePrefixes'});db[_0xa1eb('0xf2')][_0xa1eb('0x11f')](db[_0xa1eb('0x79')],{'as':'Hoppers','foreignKey':_0xa1eb('0x1a6')});db[_0xa1eb('0xf2')][_0xa1eb('0x11f')](db['CmHopperFinal'],{'as':_0xa1eb('0x122'),'foreignKey':'CampaignId'});db[_0xa1eb('0xf2')][_0xa1eb('0x11f')](db[_0xa1eb('0x7d')],{'as':_0xa1eb('0x19f'),'foreignKey':_0xa1eb('0x1a6')});db[_0xa1eb('0xf2')][_0xa1eb('0x11f')](db[_0xa1eb('0x7b')],{'as':_0xa1eb('0x155'),'foreignKey':_0xa1eb('0x1a6')});db[_0xa1eb('0xf2')][_0xa1eb('0x12d')](db[_0xa1eb('0x28')],{'as':_0xa1eb('0x28'),'foreignKey':_0xa1eb('0x157')});db[_0xa1eb('0xf2')][_0xa1eb('0x12d')](db[_0xa1eb('0x28')],{'as':_0xa1eb('0x158'),'foreignKey':_0xa1eb('0x159')});db[_0xa1eb('0xf2')][_0xa1eb('0x12d')](db[_0xa1eb('0x88')],{'as':'Interval','foreignKey':_0xa1eb('0x15a')});db[_0xa1eb('0xf2')][_0xa1eb('0x12d')](db[_0xa1eb('0xe9')],{'as':_0xa1eb('0xe9'),'foreignKey':_0xa1eb('0x1e2')});db['Campaign'][_0xa1eb('0x12f')](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x134'),'through':_0xa1eb('0x1e3')});db[_0xa1eb('0xf2')][_0xa1eb('0x12f')](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x15f'),'through':'campaigns_has_cm_blacklists'});db[_0xa1eb('0xf6')][_0xa1eb('0x12d')](db['ChatOfflineMessage'],{'as':_0xa1eb('0x17f'),'foreignKey':_0xa1eb('0x180')});db[_0xa1eb('0xf8')][_0xa1eb('0x12d')](db[_0xa1eb('0x43')],{});db[_0xa1eb('0xf8')][_0xa1eb('0x12d')](db[_0xa1eb('0x41')],{});db[_0xa1eb('0xf8')][_0xa1eb('0x12d')](db[_0xa1eb('0x3c')],{'foreignKey':_0xa1eb('0x1e4'),'as':_0xa1eb('0x1e5')});db[_0xa1eb('0xf8')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'foreignKey':_0xa1eb('0x1e6'),'as':_0xa1eb('0x1e7')});db[_0xa1eb('0xf8')]['belongsTo'](db[_0xa1eb('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xa1eb('0xf8')][_0xa1eb('0x12d')](db[_0xa1eb('0x3e')],{'foreignKey':_0xa1eb('0x1e8'),'as':'ToQueue'});db[_0xa1eb('0xf8')][_0xa1eb('0x12d')](db[_0xa1eb('0x3c')],{'foreignKey':'ToMailAccountId','as':_0xa1eb('0x1e9')});db['ChatTransferReport']['belongsTo'](db[_0xa1eb('0x70')],{});db[_0xa1eb('0xfa')]['belongsTo'](db['ChatInteraction'],{});db[_0xa1eb('0xfa')][_0xa1eb('0x12d')](db[_0xa1eb('0x68')],{'foreignKey':_0xa1eb('0x1ea'),'as':'FromAccount'});db[_0xa1eb('0xfa')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'foreignKey':_0xa1eb('0x1e6'),'as':_0xa1eb('0x1e7')});db[_0xa1eb('0xfa')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'foreignKey':_0xa1eb('0x1eb'),'as':_0xa1eb('0x1ec')});db[_0xa1eb('0xfa')][_0xa1eb('0x12d')](db[_0xa1eb('0x73')],{'foreignKey':_0xa1eb('0x1ed'),'as':_0xa1eb('0x1ee')});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xa1eb('0x1ef'),'as':_0xa1eb('0x1e9')});db[_0xa1eb('0xfc')][_0xa1eb('0x12d')](db[_0xa1eb('0x185')],{});db[_0xa1eb('0xfc')]['belongsTo'](db[_0xa1eb('0x50')],{});db[_0xa1eb('0xfc')][_0xa1eb('0x12d')](db[_0xa1eb('0x4c')],{'foreignKey':_0xa1eb('0x1f0'),'as':_0xa1eb('0x1e5')});db[_0xa1eb('0xfc')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'foreignKey':'FromUserId','as':_0xa1eb('0x1e7')});db['FaxTransferReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'foreignKey':'ToUserId','as':_0xa1eb('0x1ec')});db[_0xa1eb('0xfc')][_0xa1eb('0x12d')](db[_0xa1eb('0x53')],{'foreignKey':_0xa1eb('0x1f1'),'as':'ToQueue'});db[_0xa1eb('0xfc')][_0xa1eb('0x12d')](db[_0xa1eb('0x4c')],{'foreignKey':_0xa1eb('0x1f2'),'as':_0xa1eb('0x1e9')});db[_0xa1eb('0xfe')][_0xa1eb('0x12d')](db['OpenchannelMessage'],{});db[_0xa1eb('0xfe')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xa1eb('0xfe')][_0xa1eb('0x12d')](db[_0xa1eb('0x61')],{'foreignKey':_0xa1eb('0x1f3'),'as':_0xa1eb('0x1e5')});db[_0xa1eb('0xfe')]['belongsTo'](db[_0xa1eb('0x14')],{'foreignKey':'FromUserId','as':_0xa1eb('0x1e7')});db[_0xa1eb('0xfe')]['belongsTo'](db[_0xa1eb('0x14')],{'foreignKey':_0xa1eb('0x1eb'),'as':_0xa1eb('0x1ec')});db[_0xa1eb('0xfe')][_0xa1eb('0x12d')](db[_0xa1eb('0x67')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0xa1eb('0xfe')]['belongsTo'](db[_0xa1eb('0x61')],{'foreignKey':_0xa1eb('0x1f4'),'as':_0xa1eb('0x1e9')});db['SmsTransferReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x5d')],{});db[_0xa1eb('0x1f5')][_0xa1eb('0x12d')](db[_0xa1eb('0x5b')],{});db[_0xa1eb('0x1f5')][_0xa1eb('0x12d')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0xa1eb('0x1e5')});db[_0xa1eb('0x1f5')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'foreignKey':'FromUserId','as':_0xa1eb('0x1e7')});db[_0xa1eb('0x1f5')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'foreignKey':_0xa1eb('0x1eb'),'as':_0xa1eb('0x1ec')});db['SmsTransferReport'][_0xa1eb('0x12d')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xa1eb('0x1ee')});db['SmsTransferReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x57')],{'foreignKey':'ToSmsAccountId','as':_0xa1eb('0x1e9')});db[_0xa1eb('0x133')][_0xa1eb('0x11f')](db[_0xa1eb('0x85')],{'as':_0xa1eb('0x16c'),'foreignKey':_0xa1eb('0x171'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x133')][_0xa1eb('0x11f')](db[_0xa1eb('0x1f6')],{'as':_0xa1eb('0x1f7'),'foreignKey':'ListId'});db[_0xa1eb('0x133')]['hasMany'](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x19a'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0x133')][_0xa1eb('0x11f')](db[_0xa1eb('0x121')],{'as':_0xa1eb('0x122'),'foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0x133')][_0xa1eb('0x11f')](db['CmHopperHistory'],{'as':_0xa1eb('0x123'),'foreignKey':'ListId'});db[_0xa1eb('0x133')][_0xa1eb('0x11f')](db['ReportAgentPreview'],{'as':_0xa1eb('0x124'),'foreignKey':'ListId'});db[_0xa1eb('0x133')][_0xa1eb('0x12f')](db[_0xa1eb('0x13f')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0xa1eb('0x133')][_0xa1eb('0x12f')](db['User'],{'as':'Agents','through':_0xa1eb('0x135')});db[_0xa1eb('0x101')][_0xa1eb('0x11f')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x101')][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x117')});db['VoicePrefix'][_0xa1eb('0x12f')](db[_0xa1eb('0xef')],{'through':_0xa1eb('0x115'),'as':_0xa1eb('0x174')});db['UserProfile']['hasMany'](db[_0xa1eb('0x14')],{'as':'Users','foreignKey':_0xa1eb('0x12e')});db[_0xa1eb('0x102')][_0xa1eb('0x11f')](db[_0xa1eb('0x104')],{'as':_0xa1eb('0x1f8'),'foreignKey':_0xa1eb('0x12e'),'onDelete':_0xa1eb('0x11a')});db['UserProfileSection']['hasMany'](db[_0xa1eb('0x105')],{'as':_0xa1eb('0x1f9'),'foreignKey':'sectionId','onDelete':_0xa1eb('0x11a')});db['WhatsappAccount'][_0xa1eb('0x11f')](db['Disposition'],{'as':_0xa1eb('0x16c'),'foreignKey':_0xa1eb('0x1fa'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x14b')][_0xa1eb('0x11f')](db[_0xa1eb('0x83')],{'as':_0xa1eb('0x16d'),'foreignKey':_0xa1eb('0x1fa')});db[_0xa1eb('0x14b')][_0xa1eb('0x11f')](db[_0xa1eb('0x10b')],{'as':_0xa1eb('0x16e'),'foreignKey':_0xa1eb('0x1fa')});db[_0xa1eb('0x14b')][_0xa1eb('0x11f')](db[_0xa1eb('0x128')],{'as':'Interactions'});db[_0xa1eb('0x14b')]['hasMany'](db['WhatsappApplication'],{'as':_0xa1eb('0x151'),'foreignKey':_0xa1eb('0x1fa'),'onDelete':_0xa1eb('0x11a')});db[_0xa1eb('0x14b')][_0xa1eb('0x12d')](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x170'),'foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0x14b')][_0xa1eb('0x12d')](db['Pause'],{'as':_0xa1eb('0x15b'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xa1eb('0x12f')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x14d')});db[_0xa1eb('0x108')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x108')][_0xa1eb('0x12d')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xa1eb('0x108')][_0xa1eb('0x12d')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0xa1eb('0x108')][_0xa1eb('0x12d')](db[_0xa1eb('0x88')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':'IntervalId'});db[_0xa1eb('0x108')][_0xa1eb('0x12d')](db[_0xa1eb('0x92')],{'onDelete':_0xa1eb('0x16a'),'foreignKey':_0xa1eb('0x181')});db[_0xa1eb('0x128')][_0xa1eb('0x11f')](db[_0xa1eb('0x10b')],{'as':_0xa1eb('0x16e'),'onDelete':_0xa1eb('0x11a'),'foreignKey':_0xa1eb('0x1fb')});db['WhatsappInteraction'][_0xa1eb('0x12d')](db[_0xa1eb('0x14b')],{'as':'Account','foreignKey':_0xa1eb('0x1fa')});db[_0xa1eb('0x128')]['belongsTo'](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x128')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':'Owner','foreignKey':_0xa1eb('0x11b')});db[_0xa1eb('0x128')][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0xa1eb('0x128')][_0xa1eb('0x12f')](db[_0xa1eb('0x92')],{'through':_0xa1eb('0x1b2'),'as':_0xa1eb('0x17b')});db[_0xa1eb('0x128')]['belongsToMany'](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x188'),'through':_0xa1eb('0x13e'),'foreignKey':_0xa1eb('0x1fb')});db[_0xa1eb('0x10b')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x14')});db['WhatsappMessage'][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'onDelete':'cascade','as':_0xa1eb('0x167')});db['WhatsappMessage'][_0xa1eb('0x12d')](db['WhatsappInteraction'],{'onDelete':_0xa1eb('0x11a'),'as':_0xa1eb('0x17d'),'foreignKey':_0xa1eb('0x1fb')});db['WhatsappMessage'][_0xa1eb('0x12d')](db[_0xa1eb('0x14b')],{'as':_0xa1eb('0x176'),'foreignKey':_0xa1eb('0x1fa')});db[_0xa1eb('0x1fc')][_0xa1eb('0x12d')](db[_0xa1eb('0x14b')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xa1eb('0x133')],{'as':_0xa1eb('0x170'),'foreignKey':_0xa1eb('0x171')});db[_0xa1eb('0x1fc')][_0xa1eb('0x12d')](db[_0xa1eb('0x131')],{'as':_0xa1eb('0x167'),'foreignKey':_0xa1eb('0x177')});db[_0xa1eb('0x1fc')][_0xa1eb('0x12d')](db[_0xa1eb('0x128')],{});db[_0xa1eb('0x1fc')][_0xa1eb('0x12d')](db['WhatsappQueue'],{});db[_0xa1eb('0x1fc')][_0xa1eb('0x12d')](db[_0xa1eb('0x10b')],{});db['WhatsappQueueReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{});db[_0xa1eb('0x10d')][_0xa1eb('0x12d')](db[_0xa1eb('0x10b')],{});db[_0xa1eb('0x10d')]['belongsTo'](db[_0xa1eb('0x128')],{});db[_0xa1eb('0x10d')][_0xa1eb('0x12d')](db['WhatsappAccount'],{'foreignKey':_0xa1eb('0x1fd'),'as':_0xa1eb('0x1e5')});db[_0xa1eb('0x10d')]['belongsTo'](db[_0xa1eb('0x14b')],{'foreignKey':_0xa1eb('0x1fe'),'as':_0xa1eb('0x1e9')});db['WhatsappTransferReport'][_0xa1eb('0x12d')](db[_0xa1eb('0x10f')],{'foreignKey':_0xa1eb('0x1ff'),'as':_0xa1eb('0x1ee')});db[_0xa1eb('0x10d')]['belongsTo'](db[_0xa1eb('0x14')],{'foreignKey':_0xa1eb('0x1e6'),'as':_0xa1eb('0x1e7')});db[_0xa1eb('0x10d')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'foreignKey':_0xa1eb('0x1eb'),'as':_0xa1eb('0x1ec')});db[_0xa1eb('0x10f')][_0xa1eb('0x12f')](db['User'],{'as':_0xa1eb('0x15e'),'through':_0xa1eb('0x37'),'foreignKey':_0xa1eb('0x200')});db[_0xa1eb('0x10f')][_0xa1eb('0x12f')](db[_0xa1eb('0xef')],{'through':_0xa1eb('0x1e1'),'as':_0xa1eb('0x174')});db[_0xa1eb('0x11d')][_0xa1eb('0x12d')](db[_0xa1eb('0x14')],{'as':_0xa1eb('0x201'),'foreignKey':'UserId','onDelete':_0xa1eb('0x11a'),'hooks':!![]});db[_0xa1eb('0x111')][_0xa1eb('0x11c')](db[_0xa1eb('0xcc')],{'as':_0xa1eb('0xcc'),'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x111')][_0xa1eb('0x11c')](db['MailServerIn'],{'as':_0xa1eb('0x16b'),'onDelete':_0xa1eb('0x16a')});db[_0xa1eb('0x111')][_0xa1eb('0x11c')](db[_0xa1eb('0x3b')],{'as':_0xa1eb('0x202'),'onDelete':_0xa1eb('0x16a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3ce9=['AttachmentId','Disposition','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','Tags','team_has_openchannel_queues','user_has_chat_websites','Agent','Queue','Website','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','CompanyId','Phones','CmContactId','HopperHistories','JscriptySessions','MailInteractions','CmCompany','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Automation','Condition','All','OneAll','AutomationAllId','Any','AutomationAnyId','Action','Actions','AutomationId','ParentId','MailApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','chat_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','Descriptions','FieldId','Subject','Description','DescriptionId','Field','VariableId','SubjectId','DeskConfiguration','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','Dynamics365Account','Dynamics365Field','FreshsalesField','FromId','ToId','SessionId','ProjectId','VoiceQueues','team_has_fax_queues','FaxQueues','team_has_whatsapp_queues','WhatsappQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','TeamVoicePrefix','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','user','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','motion2','name','username','password','options','database','sequelizeHistory','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../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','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','../api/cannedAnswer/cannedAnswer.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','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','DeskAccount','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../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','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','TeamVoiceQueue','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','User','hasOne','VoiceMail','cascade','hasMany','UserId','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','UserNotification','UserNotifications','SenderId','Hoppers','belongsTo','userProfileId','belongsToMany','CmContact','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueues','SmsQueue','SmsQueues','ChatWebsites','FaxAccounts','MailAccount','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','HopperBlacks','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Team','Teams','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','MailServerOut','Imap','Dispositions','CannedAnswer','Answers','Interactions','Template','TemplateId','Account','Owner','Tag','mail_interaction_has_tags','ThroughTags','Users','Attachment','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','List','ListId','DashboardItem','Items','FaxAccountId','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3ce9,0x85));var _0x93ce=function(_0x2b27a5,_0x2110d8){_0x2b27a5=_0x2b27a5-0x0;var _0x11d9cb=_0x3ce9[_0x2b27a5];return _0x11d9cb;};'use strict';var config=require(_0x93ce('0x0'));var Sequelize=require('sequelize');var _=require(_0x93ce('0x1'));var jstz=require(_0x93ce('0x2'));var timezone=jstz[_0x93ce('0x3')]();config[_0x93ce('0x4')]=_[_0x93ce('0x5')](config[_0x93ce('0x4')],{'database':'motion2','username':_0x93ce('0x6'),'password':_0x93ce('0x7'),'options':{'host':_0x93ce('0x8'),'port':0xcea,'dialect':_0x93ce('0x9'),'dialectOptions':{'charset':_0x93ce('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x93ce('0xb'),'collate':_0x93ce('0xc')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x93ce('0xd'),'username':'xcall','password':_0x93ce('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x93ce('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x93ce('0xe')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config['sequelize'][_0x93ce('0xf')],config[_0x93ce('0x4')][_0x93ce('0x10')],config['sequelize'][_0x93ce('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x93ce('0x12')],config[_0x93ce('0x13')]['username'],config['sequelizeHistory'][_0x93ce('0x10')],config['sequelizeHistory'][_0x93ce('0x11')])};db['User']=db[_0x93ce('0x4')]['import'](_0x93ce('0x14'));db[_0x93ce('0x15')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x17'));db['VoiceContext']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x18'));db[_0x93ce('0x19')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x1a'));db[_0x93ce('0x1b')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x1c'));db[_0x93ce('0x1d')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x1e'));db[_0x93ce('0x1f')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x20'));db['VoiceMail']=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/voiceMail/voiceMail.model');db[_0x93ce('0x21')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x22'));db[_0x93ce('0x23')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x24'));db['VoiceDialReport']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x25'));db['VoiceAgentReport']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x26'));db[_0x93ce('0x27')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x28'));db[_0x93ce('0x29')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x2a'));db[_0x93ce('0x2b')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/trunk/trunk.model');db[_0x93ce('0x2c')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x2d'));db[_0x93ce('0x2e')]=db['sequelize'][_0x93ce('0x16')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x93ce('0x2f')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x30'));db[_0x93ce('0x31')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x32'));db[_0x93ce('0x33')]=db[_0x93ce('0x4')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x93ce('0x34')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x35'));db[_0x93ce('0x36')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x37'));db[_0x93ce('0x38')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x93ce('0x39')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x3a'));db[_0x93ce('0x3b')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x3c'));db['MailServerOut']=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x3d'));db[_0x93ce('0x3e')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x3f'));db[_0x93ce('0x40')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x41'));db[_0x93ce('0x42')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/mailInteraction/mailInteraction.model');db[_0x93ce('0x43')]=db[_0x93ce('0x4')]['import']('../api/mailMessage/mailMessage.model');db[_0x93ce('0x44')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x45'));db['MailQueueReport']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x46'));db[_0x93ce('0x47')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x48'));db['DashboardItem']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x49'));db[_0x93ce('0x4a')]=db['sequelize'][_0x93ce('0x16')]('../api/faxAccount/faxAccount.model');db[_0x93ce('0x4b')]=db['sequelize'][_0x93ce('0x16')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x4c'));db['FaxMessage']=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x4d'));db[_0x93ce('0x4e')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x4f'));db[_0x93ce('0x50')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x51'));db[_0x93ce('0x52')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/smsAccount/smsAccount.model');db[_0x93ce('0x53')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x54'));db[_0x93ce('0x55')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x56'));db['SmsMessage']=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x57'));db['SmsQueue']=db[_0x93ce('0x4')]['import'](_0x93ce('0x58'));db[_0x93ce('0x59')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x5a'));db[_0x93ce('0x5b')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x5c'));db[_0x93ce('0x5d')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x5e'));db[_0x93ce('0x5f')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x60'));db[_0x93ce('0x61')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x62'));db[_0x93ce('0x63')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/chatWebsite/chatWebsite.model');db[_0x93ce('0x64')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x65'));db[_0x93ce('0x66')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x67'));db[_0x93ce('0x68')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x69'));db[_0x93ce('0x6a')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x6b'));db[_0x93ce('0x6c')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x6d'));db[_0x93ce('0x6e')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x6f'));db[_0x93ce('0x70')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x71'));db[_0x93ce('0x72')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x73'));db['CmHopper']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x74'));db[_0x93ce('0x75')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x76'));db[_0x93ce('0x77')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x78'));db[_0x93ce('0x79')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x93ce('0x7a')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x7b'));db[_0x93ce('0x7c')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/cmCustomField/cmCustomField.model');db['Action']=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x7d'));db['Automation']=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/automation/automation.model');db['CannedAnswer']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x7e'));db['Disposition']=db['sequelize']['import']('../api/disposition/disposition.model');db['Condition']=db[_0x93ce('0x4')]['import'](_0x93ce('0x7f'));db[_0x93ce('0x80')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x81'));db[_0x93ce('0x82')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x83'));db[_0x93ce('0x84')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x85'));db[_0x93ce('0x86')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x93ce('0x87')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x88'));db[_0x93ce('0x89')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x8a'));db['Tag']=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x8b'));db[_0x93ce('0x8c')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x8d'));db[_0x93ce('0x8e')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x8f'));db[_0x93ce('0x90')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x91'));db['Template']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x92'));db[_0x93ce('0x93')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x94'));db[_0x93ce('0x95')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/variable/variable.model');db[_0x93ce('0x96')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x97'));db[_0x93ce('0x98')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x99'));db[_0x93ce('0x9a')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x9b'));db[_0x93ce('0x9c')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x93ce('0x9d')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0x9e'));db[_0x93ce('0x9f')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xa0'));db[_0x93ce('0xa1')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xa2'));db['SalesforceAccount']=db['sequelize'][_0x93ce('0x16')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x93ce('0xa3')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x93ce('0xa4')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xa5'));db[_0x93ce('0xa6')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x93ce('0xa7')]=db[_0x93ce('0x4')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x93ce('0xa8')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x93ce('0xa9')]=db['sequelize']['import']('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x93ce('0xaa')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xab'));db[_0x93ce('0xac')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xad'));db[_0x93ce('0xae')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xaf'));db['ZohoField']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xb0'));db[_0x93ce('0xb1')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xb2'));db[_0x93ce('0xb3')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xb4'));db['ZendeskField']=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x93ce('0x4')]['import'](_0x93ce('0xb5'));db[_0x93ce('0xb6')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xb7'));db[_0x93ce('0xb8')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xb9'));db['VtigerAccount']=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xba'));db[_0x93ce('0xbb')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xbc'));db['VtigerField']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xbd'));db[_0x93ce('0xbe')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xbf'));db[_0x93ce('0xc0')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xc1'));db[_0x93ce('0xc2')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xc3'));db['Dynamics365Account']=db[_0x93ce('0x4')]['import'](_0x93ce('0xc4'));db[_0x93ce('0xc5')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xc6'));db['Dynamics365Field']=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x93ce('0xc7')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xc8'));db[_0x93ce('0xc9')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xca'));db['FreshsalesField']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xcb'));db[_0x93ce('0x96')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x97'));db[_0x93ce('0xcc')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xcd'));db[_0x93ce('0xce')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xcf'));db[_0x93ce('0xd0')]=db[_0x93ce('0x4')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x93ce('0xd1')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xd2'));db[_0x93ce('0xd3')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xd4'));db[_0x93ce('0xd5')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x93ce('0xd6')]=db['sequelize'][_0x93ce('0x16')]('../api/smsQueueReport/smsQueueReport.model');db[_0x93ce('0xd7')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xd8'));db['SquareDetailsReport']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xd9'));db[_0x93ce('0xda')]=db[_0x93ce('0x4')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x93ce('0xdb')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x93ce('0x4')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x93ce('0xdc')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xdd'));db[_0x93ce('0xde')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xdf'));db['SquareMessage']=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xe0'));db[_0x93ce('0xe1')]=db[_0x93ce('0x4')]['import']('../api/license/license.model');db[_0x93ce('0xe2')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xe3'));db[_0x93ce('0xe4')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xe5'));db['Attachment']=db['sequelize'][_0x93ce('0x16')]('../api/attachment/attachment.model');db[_0x93ce('0xe6')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xe7'));db[_0x93ce('0xe8')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xe9'));db[_0x93ce('0xea')]=db['sequelize'][_0x93ce('0x16')]('../api/chatTransferReport/chatTransferReport.model');db[_0x93ce('0xeb')]=db[_0x93ce('0x4')]['import']('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xec'));db[_0x93ce('0xed')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xee'));db[_0x93ce('0xef')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/voicePrefix/voicePrefix.model');db[_0x93ce('0xf0')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xf1'));db['UserProfileSection']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xf2'));db[_0x93ce('0xf3')]=db['sequelize'][_0x93ce('0x16')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xf4'));db[_0x93ce('0xf5')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xf6'));db[_0x93ce('0xf7')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xf8'));db[_0x93ce('0xf9')]=db['sequelize'][_0x93ce('0x16')](_0x93ce('0xfa'));db[_0x93ce('0xfb')]=db['sequelize'][_0x93ce('0x16')]('../api/whatsappMessage/whatsappMessage.model');db[_0x93ce('0xfc')]=db[_0x93ce('0x4')]['import'](_0x93ce('0xfd'));db[_0x93ce('0xfe')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0xff'));db[_0x93ce('0x100')]=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x101'));db['CloudProvider']=db[_0x93ce('0x4')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x93ce('0x102')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x93ce('0x4')][_0x93ce('0x16')](_0x93ce('0x103'));db[_0x93ce('0x104')]=db[_0x93ce('0x4')]['import'](_0x93ce('0x105'));db[_0x93ce('0x106')]=db[_0x93ce('0x4')]['import']('../api/user-setting/user-setting.model');db[_0x93ce('0x107')]=db[_0x93ce('0x4')][_0x93ce('0x16')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x93ce('0x108')][_0x93ce('0x109')](db[_0x93ce('0x10a')],{'as':_0x93ce('0x10a'),'onDelete':_0x93ce('0x10b'),'foreignKey':'UserId'});db[_0x93ce('0x108')][_0x93ce('0x109')](db[_0x93ce('0x106')],{'as':'userSetting','onDelete':_0x93ce('0x10b'),'foreignKey':'UserId'});db[_0x93ce('0x108')][_0x93ce('0x10c')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x108')][_0x93ce('0x10c')](db['UserVoiceQueueRt'],{'as':_0x93ce('0x10e'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x108')]['hasMany'](db[_0x93ce('0x19')],{'as':_0x93ce('0x10f'),'onDelete':_0x93ce('0x10b'),'hooks':!![]});db[_0x93ce('0x108')][_0x93ce('0x10c')](db['CmHopperFinal'],{'as':_0x93ce('0x110'),'foreignKey':'UserId'});db[_0x93ce('0x108')][_0x93ce('0x10c')](db[_0x93ce('0x79')],{'as':_0x93ce('0x111'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x108')][_0x93ce('0x10c')](db['ReportAgentPreview'],{'as':_0x93ce('0x7a'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x108')][_0x93ce('0x10c')](db[_0x93ce('0x5d')],{'as':_0x93ce('0x112'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x108')]['hasMany'](db[_0x93ce('0x68')],{'as':_0x93ce('0x113'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x108')]['hasMany'](db[_0x93ce('0x55')],{'as':_0x93ce('0x114'),'foreignKey':'UserId'});db['User']['hasMany'](db['FaxInteraction'],{'as':_0x93ce('0x115'),'foreignKey':_0x93ce('0x10d')});db['User'][_0x93ce('0x10c')](db[_0x93ce('0x42')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x93ce('0x108')][_0x93ce('0x10c')](db[_0x93ce('0xf9')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x93ce('0x108')]['hasMany'](db[_0x93ce('0x116')],{'as':_0x93ce('0x117'),'foreignKey':_0x93ce('0x118')});db['User'][_0x93ce('0x10c')](db['CmHopper'],{'as':_0x93ce('0x119'),'foreignKey':_0x93ce('0x10d'),'onDelete':'SET\x20NULL'});db[_0x93ce('0x108')][_0x93ce('0x11a')](db[_0x93ce('0xf0')],{'as':_0x93ce('0xf0'),'foreignKey':_0x93ce('0x11b')});db['User'][_0x93ce('0x11c')](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x11d')],{'as':_0x93ce('0x11e'),'through':_0x93ce('0x11f')});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x120')],{'as':_0x93ce('0x121'),'through':_0x93ce('0x122')});db[_0x93ce('0x108')]['belongsToMany'](db['Team'],{'through':_0x93ce('0x123')});db['User'][_0x93ce('0x11c')](db[_0x93ce('0x42')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x93ce('0x108')][_0x93ce('0x11c')](db['ChatInteraction'],{'as':_0x93ce('0x113'),'through':_0x93ce('0x124')});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x125')],{'as':_0x93ce('0x115'),'through':_0x93ce('0x126')});db['User'][_0x93ce('0x11c')](db[_0x93ce('0x55')],{'as':_0x93ce('0x114'),'through':_0x93ce('0x127')});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x5d')],{'as':'OpenchannelInteractions','through':_0x93ce('0x128')});db[_0x93ce('0x108')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x93ce('0x129'),'through':_0x93ce('0x12a')});db[_0x93ce('0x108')][_0x93ce('0x11c')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x93ce('0x2f'),'required':![]});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0xef')],{'as':_0x93ce('0x12b'),'through':_0x93ce('0x104'),'required':![]});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x3e')],{'as':_0x93ce('0x12c'),'through':_0x93ce('0x33'),'required':![]});db[_0x93ce('0x108')][_0x93ce('0x11c')](db['ChatQueue'],{'as':_0x93ce('0x12d'),'through':_0x93ce('0x31'),'required':![],'hooks':!![]});db['User'][_0x93ce('0x11c')](db[_0x93ce('0x4e')],{'as':'FaxQueues','through':_0x93ce('0x34'),'required':![]});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x12e')],{'as':_0x93ce('0x12f'),'through':'UserSmsQueue','required':![]});db['User'][_0x93ce('0x11c')](db[_0x93ce('0x61')],{'as':'OpenchannelQueues','through':_0x93ce('0x38'),'required':![]});db['User'][_0x93ce('0x11c')](db[_0x93ce('0x100')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x93ce('0x108')][_0x93ce('0x11c')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x63')],{'as':_0x93ce('0x130'),'through':'user_has_chat_websites'});db['User'][_0x93ce('0x11c')](db[_0x93ce('0x4a')],{'as':_0x93ce('0x131'),'through':'user_has_fax_accounts'});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x132')],{'as':'MailAccounts','through':_0x93ce('0x133')});db['User'][_0x93ce('0x11c')](db[_0x93ce('0x59')],{'as':_0x93ce('0x134'),'through':_0x93ce('0x135')});db[_0x93ce('0x108')][_0x93ce('0x11c')](db[_0x93ce('0x52')],{'as':'SmsAccounts','through':_0x93ce('0x136')});db['User'][_0x93ce('0x11c')](db[_0x93ce('0xf5')],{'as':_0x93ce('0x137'),'through':'user_has_whatsapp_accounts'});db[_0x93ce('0x15')][_0x93ce('0x10c')](db[_0x93ce('0x19')],{'as':'SpiedAgents','onDelete':_0x93ce('0x10b'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0x93ce('0x10c')](db[_0x93ce('0x19')],{'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x19')][_0x93ce('0x10c')](db[_0x93ce('0x19')],{'as':_0x93ce('0x138'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x139')]['belongsToMany'](db['Sound'],{'as':_0x93ce('0x13a'),'through':_0x93ce('0x13b')});db[_0x93ce('0x1b')]['hasMany'](db[_0x93ce('0x2e')],{'as':'Members','foreignKey':_0x93ce('0x13c')});db[_0x93ce('0x1b')][_0x93ce('0x10c')](db[_0x93ce('0x13d')],{'as':_0x93ce('0x119'),'foreignKey':_0x93ce('0x13c')});db[_0x93ce('0x1b')]['hasMany'](db[_0x93ce('0x77')],{'as':_0x93ce('0x110'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x93ce('0x10c')](db[_0x93ce('0x79')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0x93ce('0x1b')][_0x93ce('0x10c')](db[_0x93ce('0x7a')],{'as':_0x93ce('0x7a'),'foreignKey':_0x93ce('0x13c')});db['VoiceQueue'][_0x93ce('0x10c')](db[_0x93ce('0x75')],{'as':_0x93ce('0x13e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x93ce('0x10c')](db[_0x93ce('0xd5')],{'as':'JscriptySessions','foreignKey':_0x93ce('0x13c')});db['VoiceQueue'][_0x93ce('0x11a')](db[_0x93ce('0x2b')],{'as':'Trunk','foreignKey':_0x93ce('0x13f')});db[_0x93ce('0x1b')][_0x93ce('0x11a')](db[_0x93ce('0x2b')],{'as':_0x93ce('0x140'),'foreignKey':'TrunkBackupId'});db[_0x93ce('0x1b')][_0x93ce('0x11a')](db[_0x93ce('0x80')],{'as':_0x93ce('0x80'),'foreignKey':_0x93ce('0x141')});db['VoiceQueue'][_0x93ce('0x11a')](db['Pause'],{'as':_0x93ce('0x142'),'foreignKey':_0x93ce('0x143')});db[_0x93ce('0x1b')][_0x93ce('0x11c')](db[_0x93ce('0x120')],{'as':'Lists','through':_0x93ce('0x144')});db[_0x93ce('0x1b')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x2f')});db[_0x93ce('0x1b')]['belongsToMany'](db[_0x93ce('0x146')],{'as':_0x93ce('0x147'),'through':_0x93ce('0x102')});db[_0x93ce('0x1b')][_0x93ce('0x11c')](db[_0x93ce('0x120')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x93ce('0x1d')][_0x93ce('0x11a')](db['User'],{'as':_0x93ce('0x108'),'foreignKey':'UserId'});db['ScreenRecording'][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x108'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x10a')][_0x93ce('0x10c')](db[_0x93ce('0x21')],{'as':_0x93ce('0x148'),'onDelete':'cascade','foreignKey':_0x93ce('0x149'),'sourceKey':_0x93ce('0x14a')});db[_0x93ce('0x21')]['belongsTo'](db[_0x93ce('0x10a')],{'foreignKey':'mailboxuser','targetKey':_0x93ce('0x14a')});db[_0x93ce('0x23')][_0x93ce('0x10c')](db[_0x93ce('0x27')],{'as':_0x93ce('0x14b'),'foreignKey':'uniqueid','constraints':![]});db[_0x93ce('0x23')]['hasMany'](db['VoiceAgentReport'],{'as':_0x93ce('0x14c'),'foreignKey':_0x93ce('0x14d'),'constraints':![]});db[_0x93ce('0x23')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x108'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x23')]['belongsTo'](db['CmContact'],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x3b')][_0x93ce('0x11a')](db['MailAccount'],{'as':_0x93ce('0x132'),'foreignKey':_0x93ce('0x150')});db[_0x93ce('0x3b')][_0x93ce('0x11a')](db[_0x93ce('0x151')],{'as':_0x93ce('0x151'),'foreignKey':_0x93ce('0x152'),'onDelete':_0x93ce('0x153')});db['MailServerOut'][_0x93ce('0x11a')](db[_0x93ce('0x132')],{'as':'MailAccount','foreignKey':_0x93ce('0x150')});db[_0x93ce('0x154')][_0x93ce('0x11a')](db['CloudProvider'],{'as':_0x93ce('0x151'),'foreignKey':_0x93ce('0x152'),'onDelete':_0x93ce('0x153')});db[_0x93ce('0x132')][_0x93ce('0x109')](db[_0x93ce('0x3b')],{'as':_0x93ce('0x155'),'onDelete':'cascade'});db['MailAccount'][_0x93ce('0x109')](db[_0x93ce('0x154')],{'as':'Smtp','onDelete':_0x93ce('0x10b')});db[_0x93ce('0x132')]['hasMany'](db['Disposition'],{'as':_0x93ce('0x156'),'foreignKey':_0x93ce('0x150'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x132')][_0x93ce('0x10c')](db[_0x93ce('0x157')],{'as':_0x93ce('0x158'),'foreignKey':_0x93ce('0x150')});db[_0x93ce('0x132')][_0x93ce('0x10c')](db[_0x93ce('0x43')],{'as':_0x93ce('0x148'),'foreignKey':_0x93ce('0x150')});db[_0x93ce('0x132')][_0x93ce('0x10c')](db[_0x93ce('0x42')],{'as':_0x93ce('0x159')});db[_0x93ce('0x132')][_0x93ce('0x10c')](db[_0x93ce('0x44')],{'as':_0x93ce('0x138'),'foreignKey':_0x93ce('0x150'),'onDelete':'cascade'});db[_0x93ce('0x132')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':'List','foreignKey':'ListId'});db['MailAccount'][_0x93ce('0x11a')](db[_0x93ce('0x15a')],{'as':_0x93ce('0x15a'),'foreignKey':_0x93ce('0x15b')});db['MailAccount'][_0x93ce('0x11a')](db[_0x93ce('0x82')],{'as':_0x93ce('0x142'),'foreignKey':_0x93ce('0x143')});db['MailAccount']['belongsToMany'](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x133')});db[_0x93ce('0x3e')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x33')});db[_0x93ce('0x3e')][_0x93ce('0x11c')](db[_0x93ce('0x146')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x93ce('0x42')]['hasMany'](db[_0x93ce('0x43')],{'as':'Messages','onDelete':_0x93ce('0x10b'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x93ce('0x11a')](db[_0x93ce('0x132')],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x150')});db[_0x93ce('0x42')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f')});db['MailInteraction'][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x15d'),'foreignKey':'UserId'});db['MailInteraction'][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':_0x93ce('0x15f'),'as':'Tags'});db[_0x93ce('0x42')]['belongsToMany'](db[_0x93ce('0x15e')],{'through':_0x93ce('0x15f'),'as':_0x93ce('0x160')});db[_0x93ce('0x42')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x161'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x93ce('0x43')][_0x93ce('0x10c')](db[_0x93ce('0x162')],{'as':'Attachments','onDelete':_0x93ce('0x10b')});db[_0x93ce('0x43')][_0x93ce('0x11a')](db['User'],{'as':_0x93ce('0x108')});db[_0x93ce('0x43')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'onDelete':_0x93ce('0x10b'),'as':_0x93ce('0x14e')});db[_0x93ce('0x43')][_0x93ce('0x11a')](db[_0x93ce('0x42')],{'as':_0x93ce('0x163'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x93ce('0x11a')](db['MailAccount'],{'as':'Account','foreignKey':_0x93ce('0x150')});db[_0x93ce('0x43')]['belongsTo'](db['ChatWebsite'],{'as':_0x93ce('0x63'),'foreignKey':_0x93ce('0x164')});db[_0x93ce('0x43')][_0x93ce('0x11a')](db[_0x93ce('0x6c')],{'as':_0x93ce('0x6c'),'foreignKey':_0x93ce('0x165')});db[_0x93ce('0x44')]['belongsTo'](db[_0x93ce('0x108')],{'onDelete':'restrict'});db[_0x93ce('0x44')][_0x93ce('0x11a')](db[_0x93ce('0x3e')],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0x44')]['belongsTo'](db['MailAccount'],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0x44')][_0x93ce('0x11a')](db['Interval'],{'onDelete':_0x93ce('0x153'),'foreignKey':_0x93ce('0x141')});db[_0x93ce('0x44')][_0x93ce('0x11a')](db['Tag'],{'onDelete':_0x93ce('0x153'),'foreignKey':_0x93ce('0x166')});db['MailQueueReport'][_0x93ce('0x11a')](db[_0x93ce('0x132')],{});db[_0x93ce('0x167')]['belongsTo'](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x167')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x167')][_0x93ce('0x11a')](db[_0x93ce('0x42')],{});db[_0x93ce('0x167')][_0x93ce('0x11a')](db[_0x93ce('0x43')],{});db['MailQueueReport'][_0x93ce('0x11a')](db[_0x93ce('0x108')],{});db[_0x93ce('0x167')][_0x93ce('0x11a')](db[_0x93ce('0x3e')],{});db[_0x93ce('0x47')][_0x93ce('0x10c')](db[_0x93ce('0x16a')],{'as':_0x93ce('0x16b'),'onDelete':'cascade'});db[_0x93ce('0x4a')][_0x93ce('0x10c')](db['Disposition'],{'as':_0x93ce('0x156'),'foreignKey':_0x93ce('0x16c'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x4a')][_0x93ce('0x10c')](db[_0x93ce('0x157')],{'as':_0x93ce('0x158'),'foreignKey':_0x93ce('0x16c')});db['FaxAccount']['hasMany'](db[_0x93ce('0x125')],{'as':_0x93ce('0x159')});db[_0x93ce('0x4a')]['hasMany'](db['FaxApplication'],{'as':_0x93ce('0x138'),'foreignKey':_0x93ce('0x16c'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x4a')][_0x93ce('0x10c')](db['VoiceExtension'],{'as':_0x93ce('0x16d'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x4a')][_0x93ce('0x10c')](db[_0x93ce('0x16e')],{'as':'Messages'});db[_0x93ce('0x4a')]['belongsTo'](db[_0x93ce('0x2b')],{'as':_0x93ce('0x2b')});db[_0x93ce('0x4a')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x4a')][_0x93ce('0x11a')](db[_0x93ce('0x82')],{'as':_0x93ce('0x142'),'foreignKey':_0x93ce('0x143')});db[_0x93ce('0x4a')]['belongsToMany'](db[_0x93ce('0x108')],{'as':'Agents','through':_0x93ce('0x16f')});db[_0x93ce('0x4b')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0x4b')]['belongsTo'](db[_0x93ce('0x4e')],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0x4b')]['belongsTo'](db[_0x93ce('0x4a')],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0x4b')]['belongsTo'](db[_0x93ce('0x15e')],{'onDelete':_0x93ce('0x153'),'foreignKey':_0x93ce('0x166')});db[_0x93ce('0x125')][_0x93ce('0x10c')](db['FaxMessage'],{'as':'Messages','onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x170')});db[_0x93ce('0x125')]['belongsTo'](db[_0x93ce('0x4a')],{'as':_0x93ce('0x15c'),'foreignKey':'FaxAccountId'});db[_0x93ce('0x125')]['belongsTo'](db[_0x93ce('0x11d')],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x125')][_0x93ce('0x11a')](db['User'],{'as':'Owner','foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x125')]['belongsToMany'](db[_0x93ce('0x15e')],{'through':_0x93ce('0x171'),'as':'Tags'});db[_0x93ce('0x125')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x93ce('0x125')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':'Users','through':_0x93ce('0x126'),'foreignKey':'FaxInteractionId'});db[_0x93ce('0x16e')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'onDelete':_0x93ce('0x10b'),'as':_0x93ce('0x108')});db[_0x93ce('0x16e')]['belongsTo'](db[_0x93ce('0x125')],{'as':_0x93ce('0x163'),'foreignKey':_0x93ce('0x170')});db[_0x93ce('0x16e')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'onDelete':'cascade','as':'Contact'});db[_0x93ce('0x16e')][_0x93ce('0x11a')](db[_0x93ce('0x162')],{'as':'Attachment','foreignKey':_0x93ce('0x172')});db[_0x93ce('0x16e')][_0x93ce('0x11a')](db[_0x93ce('0x4a')],{'as':'Account','foreignKey':_0x93ce('0x16c')});db[_0x93ce('0x4e')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x34')});db[_0x93ce('0x4e')]['belongsToMany'](db[_0x93ce('0x146')],{'through':'team_has_fax_queues','as':_0x93ce('0x147')});db[_0x93ce('0x50')][_0x93ce('0x11a')](db[_0x93ce('0x4a')],{});db[_0x93ce('0x50')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x50')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':'Contact','foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x50')]['belongsTo'](db[_0x93ce('0x125')],{});db[_0x93ce('0x50')][_0x93ce('0x11a')](db['FaxMessage'],{});db['FaxQueueReport'][_0x93ce('0x11a')](db[_0x93ce('0x108')],{});db[_0x93ce('0x50')][_0x93ce('0x11a')](db[_0x93ce('0x4e')],{});db[_0x93ce('0x52')][_0x93ce('0x10c')](db[_0x93ce('0x173')],{'as':_0x93ce('0x156'),'foreignKey':_0x93ce('0x174'),'onDelete':_0x93ce('0x10b')});db['SmsAccount']['hasMany'](db[_0x93ce('0x157')],{'as':_0x93ce('0x158'),'foreignKey':'SmsAccountId'});db[_0x93ce('0x52')][_0x93ce('0x10c')](db['SmsMessage'],{'as':_0x93ce('0x148'),'foreignKey':'SmsAccountId'});db[_0x93ce('0x52')][_0x93ce('0x10c')](db[_0x93ce('0x55')],{'as':_0x93ce('0x159')});db[_0x93ce('0x52')][_0x93ce('0x10c')](db[_0x93ce('0x53')],{'as':_0x93ce('0x138'),'foreignKey':_0x93ce('0x174'),'onDelete':'cascade'});db[_0x93ce('0x52')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x52')][_0x93ce('0x11a')](db[_0x93ce('0x82')],{'as':_0x93ce('0x142'),'foreignKey':_0x93ce('0x143')});db[_0x93ce('0x52')][_0x93ce('0x11c')](db['User'],{'as':_0x93ce('0x145'),'through':_0x93ce('0x136')});db[_0x93ce('0x53')]['belongsTo'](db[_0x93ce('0x108')],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0x53')]['belongsTo'](db[_0x93ce('0x12e')],{'onDelete':'restrict'});db[_0x93ce('0x53')][_0x93ce('0x11a')](db[_0x93ce('0x52')],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0x53')][_0x93ce('0x11a')](db[_0x93ce('0x80')],{'onDelete':_0x93ce('0x153'),'foreignKey':_0x93ce('0x141')});db[_0x93ce('0x53')][_0x93ce('0x11a')](db['Tag'],{'onDelete':_0x93ce('0x153'),'foreignKey':_0x93ce('0x166')});db['SmsInteraction']['hasMany'](db[_0x93ce('0x175')],{'as':'Messages','onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x176')});db[_0x93ce('0x55')][_0x93ce('0x11a')](db['SmsAccount'],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x174')});db[_0x93ce('0x55')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':'Contact','foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x55')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x15d'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x55')][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':_0x93ce('0x177'),'as':'Tags'});db[_0x93ce('0x55')][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':'sms_interaction_has_tags','as':_0x93ce('0x160')});db[_0x93ce('0x55')]['belongsToMany'](db[_0x93ce('0x108')],{'as':_0x93ce('0x161'),'through':_0x93ce('0x127'),'foreignKey':'SmsInteractionId'});db[_0x93ce('0x175')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x108')});db[_0x93ce('0x175')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'onDelete':_0x93ce('0x10b'),'as':_0x93ce('0x14e')});db[_0x93ce('0x175')][_0x93ce('0x11a')](db[_0x93ce('0x55')],{'onDelete':_0x93ce('0x10b'),'as':_0x93ce('0x163'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x93ce('0x52')],{'as':_0x93ce('0x15c'),'foreignKey':'SmsAccountId'});db[_0x93ce('0x12e')]['belongsToMany'](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x36'),'foreignKey':_0x93ce('0x178')});db['SmsQueue'][_0x93ce('0x11c')](db['Team'],{'through':_0x93ce('0x179'),'as':'Teams'});db[_0x93ce('0x59')]['hasMany'](db[_0x93ce('0x173')],{'as':_0x93ce('0x156'),'foreignKey':_0x93ce('0x17a'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x59')][_0x93ce('0x10c')](db[_0x93ce('0x157')],{'as':_0x93ce('0x158'),'foreignKey':_0x93ce('0x17a')});db[_0x93ce('0x59')]['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0x93ce('0x17a')});db[_0x93ce('0x59')][_0x93ce('0x10c')](db[_0x93ce('0x5f')],{'as':_0x93ce('0x148'),'foreignKey':_0x93ce('0x17a')});db[_0x93ce('0x59')][_0x93ce('0x10c')](db[_0x93ce('0x5b')],{'as':_0x93ce('0x138'),'foreignKey':_0x93ce('0x17a'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x59')]['belongsTo'](db['CmList'],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x59')][_0x93ce('0x11a')](db[_0x93ce('0x82')],{'as':_0x93ce('0x142'),'foreignKey':_0x93ce('0x143')});db[_0x93ce('0x59')]['belongsToMany'](db[_0x93ce('0x108')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x93ce('0x5b')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'onDelete':_0x93ce('0x153')});db['OpenchannelApplication'][_0x93ce('0x11a')](db['OpenchannelQueue'],{'onDelete':_0x93ce('0x153'),'foreignKey':_0x93ce('0x17b')});db['OpenchannelApplication'][_0x93ce('0x11a')](db[_0x93ce('0x59')],{'onDelete':_0x93ce('0x153'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x93ce('0x11a')](db[_0x93ce('0x80')],{'onDelete':_0x93ce('0x153'),'foreignKey':_0x93ce('0x141')});db[_0x93ce('0x5b')]['belongsTo'](db[_0x93ce('0x15e')],{'onDelete':_0x93ce('0x153'),'foreignKey':'TagId'});db[_0x93ce('0x5d')][_0x93ce('0x10c')](db['OpenchannelMessage'],{'as':_0x93ce('0x148'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x17c')});db[_0x93ce('0x5d')][_0x93ce('0x11a')](db[_0x93ce('0x59')],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x17a')});db['OpenchannelInteraction']['belongsTo'](db[_0x93ce('0x11d')],{'as':_0x93ce('0x14e'),'foreignKey':'ContactId'});db[_0x93ce('0x5d')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x15d'),'foreignKey':'UserId'});db[_0x93ce('0x5d')][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':_0x93ce('0x17d'),'as':_0x93ce('0x17e')});db['OpenchannelInteraction'][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':_0x93ce('0x17d'),'as':_0x93ce('0x160')});db[_0x93ce('0x5d')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x161'),'through':_0x93ce('0x128'),'foreignKey':_0x93ce('0x17c')});db[_0x93ce('0x5f')]['belongsTo'](db[_0x93ce('0x108')],{'onDelete':_0x93ce('0x10b'),'as':_0x93ce('0x108')});db['OpenchannelMessage'][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'onDelete':'cascade','as':_0x93ce('0x14e')});db[_0x93ce('0x5f')]['belongsTo'](db[_0x93ce('0x5d')],{'onDelete':_0x93ce('0x10b'),'as':'Interaction','foreignKey':_0x93ce('0x17c')});db[_0x93ce('0x5f')]['belongsTo'](db[_0x93ce('0x162')],{'as':'Attachment','foreignKey':_0x93ce('0x172')});db[_0x93ce('0x5f')][_0x93ce('0x11a')](db[_0x93ce('0x59')],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x17a')});db[_0x93ce('0x61')]['belongsToMany'](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':'UserOpenchannelQueue','foreignKey':_0x93ce('0x17b')});db[_0x93ce('0x61')]['belongsToMany'](db[_0x93ce('0x146')],{'through':_0x93ce('0x17f'),'as':_0x93ce('0x147')});db['ChatWebsite'][_0x93ce('0x10c')](db[_0x93ce('0x173')],{'as':_0x93ce('0x156'),'foreignKey':'ChatWebsiteId','onDelete':_0x93ce('0x10b')});db['ChatWebsite'][_0x93ce('0x10c')](db[_0x93ce('0x157')],{'as':_0x93ce('0x158'),'foreignKey':_0x93ce('0x164')});db[_0x93ce('0x63')][_0x93ce('0x10c')](db[_0x93ce('0x72')],{'as':'ProactiveActions'});db[_0x93ce('0x63')]['hasMany'](db['ChatInteraction'],{'as':_0x93ce('0x159')});db['ChatWebsite'][_0x93ce('0x10c')](db[_0x93ce('0x66')],{'as':_0x93ce('0x138'),'foreignKey':_0x93ce('0x164'),'onDelete':'cascade'});db[_0x93ce('0x63')][_0x93ce('0x10c')](db[_0x93ce('0x6a')],{'as':_0x93ce('0x148')});db[_0x93ce('0x63')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x63')][_0x93ce('0x11a')](db[_0x93ce('0x80')],{'as':_0x93ce('0x80'),'foreignKey':'IntervalId'});db[_0x93ce('0x63')][_0x93ce('0x11a')](db[_0x93ce('0x132')],{'as':_0x93ce('0x132'),'foreignKey':'MailAccountId'});db[_0x93ce('0x63')]['belongsTo'](db[_0x93ce('0x82')],{'as':_0x93ce('0x142'),'foreignKey':_0x93ce('0x143')});db[_0x93ce('0x63')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':'Agents','through':_0x93ce('0x180')});db[_0x93ce('0x64')][_0x93ce('0x11a')](db[_0x93ce('0x59')],{});db[_0x93ce('0x64')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x64')]['belongsTo'](db['CmContact'],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x64')][_0x93ce('0x11a')](db[_0x93ce('0x5d')],{});db[_0x93ce('0x64')][_0x93ce('0x11a')](db[_0x93ce('0x5f')],{});db['OpenchannelQueueReport'][_0x93ce('0x11a')](db['User'],{});db[_0x93ce('0x64')][_0x93ce('0x11a')](db[_0x93ce('0x61')],{});db[_0x93ce('0x66')]['belongsTo'](db[_0x93ce('0x108')],{'as':_0x93ce('0x181'),'foreignKey':'UserId','onDelete':_0x93ce('0x153')});db[_0x93ce('0x66')][_0x93ce('0x11a')](db['ChatQueue'],{'as':_0x93ce('0x182'),'foreignKey':'ChatQueueId','onDelete':_0x93ce('0x153')});db[_0x93ce('0x66')][_0x93ce('0x11a')](db['ChatWebsite'],{'as':_0x93ce('0x183'),'foreignKey':_0x93ce('0x164'),'onDelete':_0x93ce('0x153')});db[_0x93ce('0x66')][_0x93ce('0x11a')](db[_0x93ce('0x15e')],{'onDelete':_0x93ce('0x153'),'foreignKey':'TagId'});db[_0x93ce('0x68')]['hasMany'](db['ChatMessage'],{'as':_0x93ce('0x148'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x184')});db['ChatInteraction'][_0x93ce('0x11a')](db[_0x93ce('0x63')],{'as':'Account','foreignKey':_0x93ce('0x164')});db[_0x93ce('0x68')]['belongsTo'](db['CmContact'],{'as':_0x93ce('0x14e'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x93ce('0x11a')](db['User'],{'as':_0x93ce('0x15d'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x68')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x93ce('0x17e')});db[_0x93ce('0x68')]['belongsToMany'](db[_0x93ce('0x15e')],{'through':'chat_interaction_has_tags','as':_0x93ce('0x160')});db[_0x93ce('0x68')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x161'),'through':_0x93ce('0x124'),'foreignKey':_0x93ce('0x184')});db[_0x93ce('0x6a')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'onDelete':'cascade','as':_0x93ce('0x108')});db[_0x93ce('0x6a')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'onDelete':_0x93ce('0x10b'),'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f')});db['ChatMessage'][_0x93ce('0x11a')](db[_0x93ce('0x68')],{'onDelete':_0x93ce('0x10b'),'as':'Interaction','foreignKey':_0x93ce('0x184')});db[_0x93ce('0x6a')][_0x93ce('0x11a')](db[_0x93ce('0x162')],{'as':_0x93ce('0x162'),'foreignKey':_0x93ce('0x172')});db[_0x93ce('0x6a')][_0x93ce('0x11a')](db[_0x93ce('0x63')],{'as':_0x93ce('0x15c'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x93ce('0x10c')](db[_0x93ce('0x162')],{'as':_0x93ce('0x185'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x93ce('0x10b'),'hooks':!![]});db[_0x93ce('0x6c')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'onDelete':_0x93ce('0x10b'),'as':'Contact','foreignKey':_0x93ce('0x14f')});db['ChatOfflineMessage'][_0x93ce('0x11a')](db[_0x93ce('0x63')],{'as':'Account','foreignKey':_0x93ce('0x164')});db[_0x93ce('0x6e')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x31'),'hooks':!![]});db[_0x93ce('0x6e')][_0x93ce('0x11c')](db[_0x93ce('0x146')],{'through':_0x93ce('0x186'),'as':_0x93ce('0x147')});db[_0x93ce('0x70')][_0x93ce('0x10c')](db[_0x93ce('0xd0')],{'as':'Messages','foreignKey':_0x93ce('0x187'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x70')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x188'),'through':_0x93ce('0x189')});db[_0x93ce('0x72')][_0x93ce('0x11a')](db[_0x93ce('0x63')],{'as':_0x93ce('0x183'),'foreignKey':_0x93ce('0x164')});db['CmCompany'][_0x93ce('0x10c')](db[_0x93ce('0x11d')],{'as':_0x93ce('0x11e'),'foreignKey':_0x93ce('0x18a')});db[_0x93ce('0x11d')][_0x93ce('0x10c')](db[_0x93ce('0x8e')],{'as':_0x93ce('0x18b'),'foreignKey':_0x93ce('0x18c')});db['CmContact'][_0x93ce('0x10c')](db[_0x93ce('0x13d')],{'as':_0x93ce('0x119'),'foreignKey':'ContactId'});db[_0x93ce('0x11d')][_0x93ce('0x10c')](db[_0x93ce('0x77')],{'as':_0x93ce('0x110'),'foreignKey':_0x93ce('0x14f')});db['CmContact'][_0x93ce('0x10c')](db[_0x93ce('0x79')],{'as':_0x93ce('0x18d'),'foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x11d')][_0x93ce('0x10c')](db[_0x93ce('0x7a')],{'as':_0x93ce('0x7a'),'foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x11d')]['hasMany'](db[_0x93ce('0xd5')],{'as':_0x93ce('0x18e'),'foreignKey':_0x93ce('0x14f')});db[_0x93ce('0x11d')][_0x93ce('0x10c')](db['OpenchannelInteraction'],{'as':_0x93ce('0x112'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x93ce('0x11d')][_0x93ce('0x10c')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x93ce('0x14f'),'onDelete':_0x93ce('0x153')});db[_0x93ce('0x11d')]['hasMany'](db['SmsInteraction'],{'as':_0x93ce('0x114'),'foreignKey':_0x93ce('0x14f'),'onDelete':_0x93ce('0x153')});db['CmContact']['hasMany'](db[_0x93ce('0x125')],{'as':_0x93ce('0x115'),'foreignKey':_0x93ce('0x14f'),'onDelete':_0x93ce('0x153')});db[_0x93ce('0x11d')][_0x93ce('0x10c')](db[_0x93ce('0x42')],{'as':_0x93ce('0x18f'),'foreignKey':_0x93ce('0x14f'),'onDelete':_0x93ce('0x153')});db[_0x93ce('0x11d')][_0x93ce('0x11a')](db[_0x93ce('0x190')],{'as':_0x93ce('0x191'),'foreignKey':_0x93ce('0x18a')});db['CmContact']['belongsTo'](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x93ce('0x11d')][_0x93ce('0x11c')](db['User'],{'as':_0x93ce('0x161'),'through':_0x93ce('0x11f')});db[_0x93ce('0x11d')]['belongsToMany'](db[_0x93ce('0x15e')],{'as':'Tags','through':_0x93ce('0x192')});db['CmContact'][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':_0x93ce('0x192'),'as':'ThroughTags'});db[_0x93ce('0x13d')][_0x93ce('0x10c')](db[_0x93ce('0x90')],{'as':_0x93ce('0x193'),'foreignKey':_0x93ce('0x194')});db[_0x93ce('0x13d')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f'),'onDelete':_0x93ce('0x10b')});db['CmHopper']['belongsTo'](db[_0x93ce('0x120')],{'as':'List','foreignKey':_0x93ce('0x169'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x13d')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x181'),'foreignKey':_0x93ce('0x10d')});db[_0x93ce('0x13d')][_0x93ce('0x11a')](db[_0x93ce('0x1b')],{'as':_0x93ce('0x182'),'foreignKey':_0x93ce('0x13c'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x13d')]['belongsTo'](db[_0x93ce('0xe2')],{'as':_0x93ce('0xe2'),'foreignKey':_0x93ce('0x195'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x13d')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x15d'),'foreignKey':_0x93ce('0x196')});db['CmHopperBlack'][_0x93ce('0x11a')](db['CmContact'],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x75')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169'),'onDelete':'cascade'});db[_0x93ce('0x75')][_0x93ce('0x11a')](db[_0x93ce('0x1b')],{'as':_0x93ce('0x182'),'foreignKey':_0x93ce('0x13c'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0x75')][_0x93ce('0x11a')](db['Campaign'],{'as':'Campaign','foreignKey':_0x93ce('0x195'),'onDelete':'cascade'});db[_0x93ce('0x197')][_0x93ce('0x10c')](db[_0x93ce('0x198')],{'as':{'plural':_0x93ce('0x199'),'singular':_0x93ce('0x19a')},'foreignKey':_0x93ce('0x19b'),'onDelete':'cascade','hooks':!![]});db[_0x93ce('0x197')][_0x93ce('0x10c')](db[_0x93ce('0x198')],{'as':{'plural':_0x93ce('0x19c'),'singular':'OneAny'},'foreignKey':_0x93ce('0x19d'),'onDelete':_0x93ce('0x10b'),'hooks':!![]});db[_0x93ce('0x197')]['hasMany'](db[_0x93ce('0x19e')],{'as':_0x93ce('0x19f'),'foreignKey':_0x93ce('0x1a0'),'onDelete':_0x93ce('0x10b'),'hooks':!![]});db[_0x93ce('0x173')][_0x93ce('0x10c')](db[_0x93ce('0x173')],{'as':_0x93ce('0x156'),'foreignKey':_0x93ce('0x1a1'),'onDelete':'cascade'});db['Interval']['hasMany'](db[_0x93ce('0x80')],{'as':'Intervals','foreignKey':_0x93ce('0x141'),'onDelete':_0x93ce('0x10b'),'hooks':!![],'required':![]});db['Interval'][_0x93ce('0x10c')](db[_0x93ce('0x19')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x93ce('0x153')});db[_0x93ce('0x80')][_0x93ce('0x10c')](db[_0x93ce('0x44')],{'as':_0x93ce('0x1a2'),'foreignKey':'IntervalId'});db[_0x93ce('0x80')]['hasMany'](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x93ce('0x141')});db[_0x93ce('0x80')][_0x93ce('0x10c')](db[_0x93ce('0x4b')],{'as':'FaxApplications','foreignKey':_0x93ce('0x141')});db[_0x93ce('0x80')][_0x93ce('0x10c')](db[_0x93ce('0x53')],{'as':'SmsApplications','foreignKey':_0x93ce('0x141')});db[_0x93ce('0x87')][_0x93ce('0x11a')](db[_0x93ce('0x132')],{});db[_0x93ce('0x87')]['belongsTo'](db[_0x93ce('0x1a3')],{'foreignKey':_0x93ce('0x1a4')});db[_0x93ce('0x87')][_0x93ce('0x11a')](db[_0x93ce('0x9a')],{'foreignKey':_0x93ce('0x1a5')});db['Sound']['belongsToMany'](db[_0x93ce('0x139')],{'as':'Mohs','through':_0x93ce('0x13b'),'onDelete':_0x93ce('0x153')});db['Tag'][_0x93ce('0x11c')](db[_0x93ce('0x11d')],{'through':_0x93ce('0x192')});db[_0x93ce('0x15e')][_0x93ce('0x11c')](db[_0x93ce('0x68')],{'through':_0x93ce('0x1a6')});db[_0x93ce('0x15e')][_0x93ce('0x11c')](db[_0x93ce('0x42')],{'through':_0x93ce('0x15f')});db[_0x93ce('0x15e')][_0x93ce('0x11c')](db[_0x93ce('0x55')],{'through':_0x93ce('0x177')});db[_0x93ce('0x15e')]['belongsToMany'](db[_0x93ce('0x125')],{'through':_0x93ce('0x171')});db['Tag'][_0x93ce('0x11c')](db[_0x93ce('0x5d')],{'through':'openchannel_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x93ce('0xf9')],{'through':_0x93ce('0x1a7')});db['CmContactHasItem'][_0x93ce('0x11a')](db['ContactItemType'],{'as':_0x93ce('0x1a8'),'foreignKey':_0x93ce('0x1a9')});db[_0x93ce('0x90')]['belongsTo'](db[_0x93ce('0x13d')],{'as':'Hopper','foreignKey':_0x93ce('0x194')});db[_0x93ce('0x8e')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x18c')});db[_0x93ce('0x93')][_0x93ce('0x10c')](db['Condition'],{'as':{'plural':_0x93ce('0x1aa'),'singular':_0x93ce('0x1ab')},'foreignKey':_0x93ce('0x1ac'),'onDelete':_0x93ce('0x10b'),'hooks':!![]});db[_0x93ce('0x93')][_0x93ce('0x10c')](db['Condition'],{'as':{'plural':_0x93ce('0x1ad'),'singular':_0x93ce('0x1ae')},'foreignKey':_0x93ce('0x1af'),'onDelete':_0x93ce('0x10b'),'hooks':!![]});db[_0x93ce('0x93')][_0x93ce('0x10c')](db[_0x93ce('0x19e')],{'as':'Actions','foreignKey':_0x93ce('0x1b0'),'onDelete':_0x93ce('0x10b'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1a5'),'hooks':!![]});db[_0x93ce('0x1a3')][_0x93ce('0x10c')](db['AnalyticFieldReport'],{'as':_0x93ce('0x1b1'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1a4')});db[_0x93ce('0x9d')][_0x93ce('0x10c')](db[_0x93ce('0x9f')],{'as':_0x93ce('0x1b1'),'onDelete':'cascade','foreignKey':_0x93ce('0x1b2')});db[_0x93ce('0x9f')]['belongsTo'](db[_0x93ce('0x9d')],{'foreignKey':_0x93ce('0x1b2')});db[_0x93ce('0x1b3')][_0x93ce('0x10c')](db[_0x93ce('0xa3')],{'as':_0x93ce('0x1b4'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0xa3')]['hasMany'](db[_0x93ce('0xa4')],{'as':_0x93ce('0x1b6'),'onDelete':_0x93ce('0x10b'),'foreignKey':'SubjectId'});db[_0x93ce('0xa3')]['hasMany'](db['SalesforceField'],{'as':_0x93ce('0x1b7'),'onDelete':_0x93ce('0x10b'),'foreignKey':'DescriptionId'});db[_0x93ce('0xa3')][_0x93ce('0x10c')](db[_0x93ce('0xa4')],{'as':_0x93ce('0x1b1'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xa3')]['belongsTo'](db[_0x93ce('0x1b3')],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0xa4')][_0x93ce('0x10c')](db[_0x93ce('0xa4')],{'as':_0x93ce('0x1b9'),'foreignKey':'SubjectId'});db['SalesforceField'][_0x93ce('0x10c')](db[_0x93ce('0xa4')],{'as':_0x93ce('0x1ba'),'foreignKey':_0x93ce('0x1bb')});db['SalesforceField'][_0x93ce('0x10c')](db['SalesforceField'],{'as':_0x93ce('0x1bc'),'foreignKey':_0x93ce('0x1b8')});db['SalesforceField'][_0x93ce('0x11a')](db[_0x93ce('0x95')],{'as':_0x93ce('0x95'),'foreignKey':_0x93ce('0x1bd')});db[_0x93ce('0xa6')][_0x93ce('0x10c')](db[_0x93ce('0xa7')],{'as':_0x93ce('0x1b4'),'onDelete':'cascade','foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0xa7')][_0x93ce('0x10c')](db[_0x93ce('0xa8')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x93ce('0xa7')][_0x93ce('0x10c')](db[_0x93ce('0xa8')],{'as':_0x93ce('0x1b7'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1bb')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0x93ce('0x1b1'),'onDelete':_0x93ce('0x10b'),'foreignKey':'FieldId'});db[_0x93ce('0xa7')][_0x93ce('0x11a')](db['SugarcrmAccount'],{'as':_0x93ce('0x15c'),'foreignKey':'AccountId'});db[_0x93ce('0xa8')][_0x93ce('0x10c')](db[_0x93ce('0xa8')],{'as':_0x93ce('0x1b9'),'foreignKey':_0x93ce('0x1be')});db[_0x93ce('0xa8')][_0x93ce('0x10c')](db['SugarcrmField'],{'as':_0x93ce('0x1ba'),'foreignKey':_0x93ce('0x1bb')});db['SugarcrmField'][_0x93ce('0x10c')](db[_0x93ce('0xa8')],{'as':_0x93ce('0x1bc'),'foreignKey':'FieldId'});db[_0x93ce('0xa8')][_0x93ce('0x11a')](db[_0x93ce('0x95')],{'as':_0x93ce('0x95'),'foreignKey':'VariableId'});db[_0x93ce('0xa9')]['hasMany'](db[_0x93ce('0x1bf')],{'as':_0x93ce('0x1b4'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b5')});db['DeskConfiguration'][_0x93ce('0x10c')](db['DeskField'],{'as':'Subjects','onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1be')});db[_0x93ce('0x1bf')]['hasMany'](db[_0x93ce('0xaa')],{'as':_0x93ce('0x1b7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x93ce('0x1bf')][_0x93ce('0x10c')](db[_0x93ce('0xaa')],{'as':_0x93ce('0x1b1'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0x1bf')][_0x93ce('0x11a')](db[_0x93ce('0xa9')],{'as':'Account','foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0x1bf')][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':'int_desk_configuration_has_tags'});db[_0x93ce('0xaa')]['hasMany'](db['DeskField'],{'as':_0x93ce('0x1b9'),'foreignKey':_0x93ce('0x1be')});db[_0x93ce('0xaa')][_0x93ce('0x10c')](db[_0x93ce('0xaa')],{'as':_0x93ce('0x1ba'),'foreignKey':_0x93ce('0x1bb')});db[_0x93ce('0xaa')][_0x93ce('0x10c')](db[_0x93ce('0xaa')],{'as':'Field','foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xaa')][_0x93ce('0x11a')](db['Variable'],{'as':'Variable','foreignKey':_0x93ce('0x1bd')});db[_0x93ce('0xac')][_0x93ce('0x10c')](db[_0x93ce('0xae')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0xae')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0x93ce('0x10b'),'foreignKey':'SubjectId'});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':_0x93ce('0x1b7'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1bb')});db[_0x93ce('0xae')][_0x93ce('0x10c')](db[_0x93ce('0x1c0')],{'as':_0x93ce('0x1b1'),'onDelete':'cascade','foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xae')]['belongsTo'](db[_0x93ce('0xac')],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0x1c0')]['hasMany'](db['ZohoField'],{'as':'Subject','foreignKey':_0x93ce('0x1be')});db['ZohoField'][_0x93ce('0x10c')](db['ZohoField'],{'as':'Description','foreignKey':_0x93ce('0x1bb')});db['ZohoField'][_0x93ce('0x10c')](db[_0x93ce('0x1c0')],{'as':_0x93ce('0x1bc'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0x1c0')]['belongsTo'](db[_0x93ce('0x95')],{'as':_0x93ce('0x95'),'foreignKey':_0x93ce('0x1bd')});db[_0x93ce('0xb1')][_0x93ce('0x10c')](db[_0x93ce('0xb3')],{'as':_0x93ce('0x1b4'),'onDelete':_0x93ce('0x10b'),'foreignKey':'AccountId'});db[_0x93ce('0xb3')][_0x93ce('0x10c')](db['ZendeskField'],{'as':_0x93ce('0x1b6'),'foreignKey':_0x93ce('0x1be')});db[_0x93ce('0xb3')][_0x93ce('0x10c')](db[_0x93ce('0x1c1')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0x93ce('0x1c1')],{'as':_0x93ce('0x1b1'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xb3')][_0x93ce('0x11a')](db[_0x93ce('0xb1')],{'as':_0x93ce('0x15c'),'foreignKey':'AccountId'});db[_0x93ce('0xb3')][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':_0x93ce('0x1c2')});db[_0x93ce('0x1c1')][_0x93ce('0x10c')](db[_0x93ce('0x1c1')],{'as':'Subject','foreignKey':'SubjectId'});db['ZendeskField'][_0x93ce('0x10c')](db[_0x93ce('0x1c1')],{'as':'Description','foreignKey':_0x93ce('0x1bb')});db[_0x93ce('0x1c1')]['hasMany'](db[_0x93ce('0x1c1')],{'as':_0x93ce('0x1bc'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0x1c1')]['belongsTo'](db[_0x93ce('0x95')],{'as':'Variable','foreignKey':_0x93ce('0x1bd')});db['FreshdeskAccount']['hasMany'](db[_0x93ce('0xb6')],{'as':_0x93ce('0x1b4'),'onDelete':'cascade','foreignKey':_0x93ce('0x1b5')});db['FreshdeskConfiguration'][_0x93ce('0x10c')](db['FreshdeskField'],{'as':_0x93ce('0x1b6'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1be')});db[_0x93ce('0xb6')][_0x93ce('0x10c')](db[_0x93ce('0xb8')],{'as':_0x93ce('0x1b7'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1bb')});db['FreshdeskConfiguration'][_0x93ce('0x10c')](db[_0x93ce('0xb8')],{'as':_0x93ce('0x1b1'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b8')});db['FreshdeskConfiguration'][_0x93ce('0x11a')](db['FreshdeskAccount'],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0xb6')][_0x93ce('0x11c')](db[_0x93ce('0x15e')],{'through':_0x93ce('0x1c3')});db[_0x93ce('0xb8')][_0x93ce('0x10c')](db[_0x93ce('0xb8')],{'as':_0x93ce('0x1b9'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x93ce('0x10c')](db['FreshdeskField'],{'as':_0x93ce('0x1ba'),'foreignKey':'DescriptionId'});db[_0x93ce('0xb8')]['hasMany'](db['FreshdeskField'],{'as':_0x93ce('0x1bc'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xb8')]['belongsTo'](db['Variable'],{'as':_0x93ce('0x95'),'foreignKey':_0x93ce('0x1bd')});db[_0x93ce('0x1c4')]['hasMany'](db['VtigerConfiguration'],{'as':_0x93ce('0x1b4'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b5')});db['VtigerConfiguration'][_0x93ce('0x10c')](db['VtigerField'],{'as':_0x93ce('0x1b6'),'foreignKey':_0x93ce('0x1be')});db[_0x93ce('0xbb')]['hasMany'](db[_0x93ce('0x1c5')],{'as':_0x93ce('0x1b7'),'foreignKey':_0x93ce('0x1bb')});db[_0x93ce('0xbb')][_0x93ce('0x10c')](db[_0x93ce('0x1c5')],{'as':_0x93ce('0x1b1'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xbb')]['belongsTo'](db[_0x93ce('0x1c4')],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x1b5')});db['VtigerField'][_0x93ce('0x10c')](db[_0x93ce('0x1c5')],{'as':_0x93ce('0x1b9'),'foreignKey':_0x93ce('0x1be')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0x93ce('0x10c')](db['VtigerField'],{'as':_0x93ce('0x1bc'),'foreignKey':'FieldId'});db[_0x93ce('0x1c5')][_0x93ce('0x11a')](db[_0x93ce('0x95')],{'as':_0x93ce('0x95'),'foreignKey':'VariableId'});db[_0x93ce('0xbe')][_0x93ce('0x10c')](db[_0x93ce('0xc0')],{'as':_0x93ce('0x1b4'),'onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x93ce('0x10c')](db[_0x93ce('0xc2')],{'as':_0x93ce('0x1b6'),'foreignKey':_0x93ce('0x1be')});db[_0x93ce('0xc0')]['hasMany'](db[_0x93ce('0xc2')],{'as':_0x93ce('0x1b7'),'foreignKey':'DescriptionId'});db[_0x93ce('0xc0')]['hasMany'](db[_0x93ce('0xc2')],{'as':_0x93ce('0x1b1'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xc0')][_0x93ce('0x11a')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0xc2')][_0x93ce('0x10c')](db[_0x93ce('0xc2')],{'as':_0x93ce('0x1b9'),'foreignKey':'SubjectId'});db[_0x93ce('0xc2')]['hasMany'](db['ServicenowField'],{'as':_0x93ce('0x1ba'),'foreignKey':'DescriptionId'});db[_0x93ce('0xc2')][_0x93ce('0x10c')](db[_0x93ce('0xc2')],{'as':_0x93ce('0x1bc'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xc2')][_0x93ce('0x11a')](db['Variable'],{'as':_0x93ce('0x95'),'foreignKey':'VariableId'});db[_0x93ce('0x1c6')]['hasMany'](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0x1c6')][_0x93ce('0x11a')](db[_0x93ce('0x151')],{'as':_0x93ce('0x151'),'foreignKey':_0x93ce('0x152')});db[_0x93ce('0xc5')]['hasMany'](db[_0x93ce('0x1c7')],{'as':_0x93ce('0x1b6'),'onDelete':_0x93ce('0x10b'),'foreignKey':'SubjectId'});db[_0x93ce('0xc5')][_0x93ce('0x10c')](db[_0x93ce('0x1c7')],{'as':_0x93ce('0x1b7'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1bb')});db[_0x93ce('0xc5')]['hasMany'](db[_0x93ce('0x1c7')],{'as':'Fields','onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0xc5')][_0x93ce('0x11a')](db[_0x93ce('0x1c6')],{'as':_0x93ce('0x15c'),'foreignKey':'AccountId'});db[_0x93ce('0x1c7')][_0x93ce('0x10c')](db[_0x93ce('0x1c7')],{'as':'Subject','foreignKey':_0x93ce('0x1be')});db[_0x93ce('0x1c7')][_0x93ce('0x10c')](db[_0x93ce('0x1c7')],{'as':_0x93ce('0x1ba'),'foreignKey':_0x93ce('0x1bb')});db['Dynamics365Field']['hasMany'](db[_0x93ce('0x1c7')],{'as':_0x93ce('0x1bc'),'foreignKey':_0x93ce('0x1b8')});db[_0x93ce('0x1c7')][_0x93ce('0x11a')](db['Variable'],{'as':'Variable','foreignKey':_0x93ce('0x1bd')});db['FreshsalesAccount']['hasMany'](db[_0x93ce('0xc9')],{'as':_0x93ce('0x1b4'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1b5')});db[_0x93ce('0xc9')][_0x93ce('0x10c')](db[_0x93ce('0x1c8')],{'as':'Subjects','foreignKey':_0x93ce('0x1be')});db['FreshsalesConfiguration'][_0x93ce('0x10c')](db[_0x93ce('0x1c8')],{'as':_0x93ce('0x1b7'),'foreignKey':_0x93ce('0x1bb')});db[_0x93ce('0xc9')][_0x93ce('0x10c')](db[_0x93ce('0x1c8')],{'as':'Fields','foreignKey':_0x93ce('0x1b8')});db['FreshsalesConfiguration']['belongsTo'](db[_0x93ce('0xc7')],{'as':'Account','foreignKey':_0x93ce('0x1b5')});db['FreshsalesField'][_0x93ce('0x10c')](db[_0x93ce('0x1c8')],{'as':_0x93ce('0x1b9'),'foreignKey':'SubjectId'});db[_0x93ce('0x1c8')][_0x93ce('0x10c')](db['FreshsalesField'],{'as':_0x93ce('0x1ba'),'foreignKey':_0x93ce('0x1bb')});db[_0x93ce('0x1c8')][_0x93ce('0x10c')](db[_0x93ce('0x1c8')],{'as':_0x93ce('0x1bc'),'foreignKey':'FieldId'});db[_0x93ce('0x1c8')][_0x93ce('0x11a')](db[_0x93ce('0x95')],{'as':_0x93ce('0x95'),'foreignKey':'VariableId'});db[_0x93ce('0xce')][_0x93ce('0x11a')](db[_0x93ce('0x63')],{});db[_0x93ce('0xce')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0xce')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':_0x93ce('0x14e'),'foreignKey':_0x93ce('0x14f')});db[_0x93ce('0xce')][_0x93ce('0x11a')](db[_0x93ce('0x68')],{});db['ChatQueueReport'][_0x93ce('0x11a')](db[_0x93ce('0x6a')],{});db[_0x93ce('0xce')][_0x93ce('0x11a')](db['User'],{});db[_0x93ce('0xce')]['belongsTo'](db[_0x93ce('0x6e')],{});db[_0x93ce('0xd0')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1c9')});db[_0x93ce('0xd0')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1ca')});db['JscriptySessionReport']['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x93ce('0x1cb'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0xd5')]['hasMany'](db[_0x93ce('0xd1')],{'foreignKey':_0x93ce('0x1cb'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0xd6')][_0x93ce('0x11a')](db[_0x93ce('0x52')],{});db[_0x93ce('0xd6')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':'List','foreignKey':_0x93ce('0x169')});db[_0x93ce('0xd6')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':_0x93ce('0x14e'),'foreignKey':'ContactId'});db[_0x93ce('0xd6')][_0x93ce('0x11a')](db[_0x93ce('0x55')],{});db['SmsQueueReport'][_0x93ce('0x11a')](db[_0x93ce('0x175')],{});db[_0x93ce('0xd6')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{});db[_0x93ce('0xd6')][_0x93ce('0x11a')](db[_0x93ce('0x12e')],{});db[_0x93ce('0xda')][_0x93ce('0x10c')](db[_0x93ce('0xd5')],{'foreignKey':'ProjectId'});db[_0x93ce('0xda')][_0x93ce('0x10c')](db[_0x93ce('0xd3')],{'foreignKey':'ProjectId'});db[_0x93ce('0xda')][_0x93ce('0x10c')](db[_0x93ce('0xd1')],{'foreignKey':_0x93ce('0x1cc')});db[_0x93ce('0x146')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x123')});db[_0x93ce('0x146')][_0x93ce('0x11c')](db[_0x93ce('0x1b')],{'through':_0x93ce('0x102'),'as':_0x93ce('0x1cd')});db[_0x93ce('0x146')]['belongsToMany'](db[_0x93ce('0x3e')],{'through':'team_has_mail_queues','as':_0x93ce('0x12c')});db[_0x93ce('0x146')][_0x93ce('0x11c')](db['ChatQueue'],{'through':_0x93ce('0x186'),'as':_0x93ce('0x12d')});db[_0x93ce('0x146')]['belongsToMany'](db[_0x93ce('0x4e')],{'through':_0x93ce('0x1ce'),'as':_0x93ce('0x1cf')});db[_0x93ce('0x146')][_0x93ce('0x11c')](db['SmsQueue'],{'through':_0x93ce('0x179'),'as':_0x93ce('0x12f')});db[_0x93ce('0x146')]['belongsToMany'](db[_0x93ce('0x61')],{'through':_0x93ce('0x17f'),'as':'OpenchannelQueues'});db[_0x93ce('0x146')][_0x93ce('0x11c')](db[_0x93ce('0x100')],{'through':_0x93ce('0x1d0'),'as':_0x93ce('0x1d1')});db[_0x93ce('0x146')][_0x93ce('0x11c')](db[_0x93ce('0xef')],{'through':'TeamVoicePrefix','as':_0x93ce('0x12b')});db['Campaign'][_0x93ce('0x10c')](db[_0x93ce('0x13d')],{'as':'Hoppers','foreignKey':_0x93ce('0x195')});db[_0x93ce('0xe2')][_0x93ce('0x10c')](db[_0x93ce('0x77')],{'as':_0x93ce('0x110'),'foreignKey':_0x93ce('0x195')});db[_0x93ce('0xe2')][_0x93ce('0x10c')](db['CmHopperHistory'],{'as':_0x93ce('0x18d'),'foreignKey':'CampaignId'});db[_0x93ce('0xe2')][_0x93ce('0x10c')](db[_0x93ce('0x75')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign'][_0x93ce('0x11a')](db[_0x93ce('0x2b')],{'as':_0x93ce('0x2b'),'foreignKey':_0x93ce('0x13f')});db[_0x93ce('0xe2')][_0x93ce('0x11a')](db[_0x93ce('0x2b')],{'as':_0x93ce('0x140'),'foreignKey':_0x93ce('0x1d2')});db[_0x93ce('0xe2')][_0x93ce('0x11a')](db[_0x93ce('0x80')],{'as':'Interval','foreignKey':_0x93ce('0x141')});db[_0x93ce('0xe2')]['belongsTo'](db[_0x93ce('0xdc')],{'as':_0x93ce('0xdc'),'foreignKey':_0x93ce('0x1d3')});db['Campaign'][_0x93ce('0x11c')](db['CmList'],{'as':_0x93ce('0x121'),'through':'campaigns_has_cm_lists'});db[_0x93ce('0xe2')][_0x93ce('0x11c')](db[_0x93ce('0x120')],{'as':'BlackLists','through':_0x93ce('0x1d4')});db[_0x93ce('0x162')][_0x93ce('0x11a')](db[_0x93ce('0x6c')],{'as':_0x93ce('0x6c'),'foreignKey':'ChatOfflineMessageId'});db[_0x93ce('0xe8')]['belongsTo'](db['MailMessage'],{});db[_0x93ce('0xe8')]['belongsTo'](db['MailInteraction'],{});db[_0x93ce('0xe8')][_0x93ce('0x11a')](db[_0x93ce('0x132')],{'foreignKey':_0x93ce('0x1d5'),'as':_0x93ce('0x1d6')});db['MailTransferReport'][_0x93ce('0x11a')](db['User'],{'foreignKey':_0x93ce('0x1d7'),'as':_0x93ce('0x1d8')});db[_0x93ce('0xe8')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'foreignKey':_0x93ce('0x1d9'),'as':'ToAgent'});db[_0x93ce('0xe8')][_0x93ce('0x11a')](db[_0x93ce('0x3e')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x93ce('0xe8')][_0x93ce('0x11a')](db[_0x93ce('0x132')],{'foreignKey':_0x93ce('0x1da'),'as':_0x93ce('0x1db')});db['ChatTransferReport'][_0x93ce('0x11a')](db['ChatMessage'],{});db[_0x93ce('0xea')][_0x93ce('0x11a')](db[_0x93ce('0x68')],{});db[_0x93ce('0xea')][_0x93ce('0x11a')](db['ChatWebsite'],{'foreignKey':_0x93ce('0x1dc'),'as':_0x93ce('0x1d6')});db[_0x93ce('0xea')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'foreignKey':_0x93ce('0x1d7'),'as':_0x93ce('0x1d8')});db[_0x93ce('0xea')]['belongsTo'](db[_0x93ce('0x108')],{'foreignKey':_0x93ce('0x1d9'),'as':_0x93ce('0x1dd')});db[_0x93ce('0xea')]['belongsTo'](db[_0x93ce('0x6e')],{'foreignKey':'ToChatQueueId','as':_0x93ce('0x1de')});db[_0x93ce('0xea')][_0x93ce('0x11a')](db[_0x93ce('0x63')],{'foreignKey':_0x93ce('0x1df'),'as':_0x93ce('0x1db')});db[_0x93ce('0xeb')][_0x93ce('0x11a')](db[_0x93ce('0x16e')],{});db['FaxTransferReport'][_0x93ce('0x11a')](db['FaxInteraction'],{});db['FaxTransferReport']['belongsTo'](db[_0x93ce('0x4a')],{'foreignKey':_0x93ce('0x1e0'),'as':_0x93ce('0x1d6')});db[_0x93ce('0xeb')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'foreignKey':_0x93ce('0x1d7'),'as':_0x93ce('0x1d8')});db[_0x93ce('0xeb')][_0x93ce('0x11a')](db['User'],{'foreignKey':_0x93ce('0x1d9'),'as':_0x93ce('0x1dd')});db[_0x93ce('0xeb')]['belongsTo'](db[_0x93ce('0x4e')],{'foreignKey':_0x93ce('0x1e1'),'as':_0x93ce('0x1de')});db[_0x93ce('0xeb')]['belongsTo'](db[_0x93ce('0x4a')],{'foreignKey':_0x93ce('0x1e2'),'as':_0x93ce('0x1db')});db[_0x93ce('0x1e3')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x93ce('0x1e3')][_0x93ce('0x11a')](db['OpenchannelInteraction'],{});db[_0x93ce('0x1e3')][_0x93ce('0x11a')](db[_0x93ce('0x59')],{'foreignKey':_0x93ce('0x1e4'),'as':_0x93ce('0x1d6')});db[_0x93ce('0x1e3')]['belongsTo'](db[_0x93ce('0x108')],{'foreignKey':_0x93ce('0x1d7'),'as':'FromAgent'});db[_0x93ce('0x1e3')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x93ce('0x1e3')][_0x93ce('0x11a')](db[_0x93ce('0x61')],{'foreignKey':_0x93ce('0x1e5'),'as':_0x93ce('0x1de')});db[_0x93ce('0x1e3')][_0x93ce('0x11a')](db[_0x93ce('0x59')],{'foreignKey':_0x93ce('0x1e6'),'as':_0x93ce('0x1db')});db['SmsTransferReport']['belongsTo'](db[_0x93ce('0x175')],{});db[_0x93ce('0xed')][_0x93ce('0x11a')](db['SmsInteraction'],{});db[_0x93ce('0xed')][_0x93ce('0x11a')](db[_0x93ce('0x52')],{'foreignKey':'FromSmsAccountId','as':_0x93ce('0x1d6')});db[_0x93ce('0xed')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'foreignKey':_0x93ce('0x1d7'),'as':_0x93ce('0x1d8')});db['SmsTransferReport'][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'foreignKey':_0x93ce('0x1d9'),'as':_0x93ce('0x1dd')});db[_0x93ce('0xed')]['belongsTo'](db[_0x93ce('0x12e')],{'foreignKey':_0x93ce('0x1e7'),'as':_0x93ce('0x1de')});db['SmsTransferReport'][_0x93ce('0x11a')](db[_0x93ce('0x52')],{'foreignKey':_0x93ce('0x1e8'),'as':_0x93ce('0x1db')});db[_0x93ce('0x120')][_0x93ce('0x10c')](db['Disposition'],{'as':_0x93ce('0x156'),'foreignKey':_0x93ce('0x169'),'onDelete':_0x93ce('0x10b')});db['CmList'][_0x93ce('0x10c')](db['CmCustomField'],{'as':_0x93ce('0x1e9'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x120')][_0x93ce('0x10c')](db[_0x93ce('0x11d')],{'as':'Contacts','onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x120')][_0x93ce('0x10c')](db['CmHopperFinal'],{'as':_0x93ce('0x110'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x120')][_0x93ce('0x10c')](db[_0x93ce('0x79')],{'as':_0x93ce('0x111'),'foreignKey':'ListId'});db[_0x93ce('0x120')][_0x93ce('0x10c')](db[_0x93ce('0x7a')],{'as':_0x93ce('0x7a'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0x120')][_0x93ce('0x11c')](db['VoiceQueue'],{'as':_0x93ce('0x1ea'),'through':_0x93ce('0x144')});db[_0x93ce('0x120')][_0x93ce('0x11c')](db['User'],{'as':_0x93ce('0x145'),'through':_0x93ce('0x122')});db[_0x93ce('0xef')][_0x93ce('0x10c')](db[_0x93ce('0x19')],{'as':_0x93ce('0x10f'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0xef')][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x104')});db[_0x93ce('0xef')]['belongsToMany'](db[_0x93ce('0x146')],{'through':_0x93ce('0x1eb'),'as':_0x93ce('0x147')});db[_0x93ce('0xf0')]['hasMany'](db['User'],{'as':'Users','foreignKey':'userProfileId'});db[_0x93ce('0xf0')][_0x93ce('0x10c')](db[_0x93ce('0x1ec')],{'as':_0x93ce('0x1ed'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0x93ce('0x1ec')][_0x93ce('0x10c')](db[_0x93ce('0xf3')],{'as':_0x93ce('0x1ee'),'foreignKey':_0x93ce('0x1ef'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0xf5')][_0x93ce('0x10c')](db[_0x93ce('0x173')],{'as':_0x93ce('0x156'),'foreignKey':_0x93ce('0x1f0'),'onDelete':_0x93ce('0x10b')});db[_0x93ce('0xf5')]['hasMany'](db['CannedAnswer'],{'as':_0x93ce('0x158'),'foreignKey':_0x93ce('0x1f0')});db[_0x93ce('0xf5')][_0x93ce('0x10c')](db[_0x93ce('0xfb')],{'as':_0x93ce('0x148'),'foreignKey':_0x93ce('0x1f0')});db['WhatsappAccount']['hasMany'](db[_0x93ce('0xf9')],{'as':_0x93ce('0x159')});db[_0x93ce('0xf5')][_0x93ce('0x10c')](db[_0x93ce('0xf7')],{'as':_0x93ce('0x138'),'foreignKey':_0x93ce('0x1f0'),'onDelete':_0x93ce('0x10b')});db['WhatsappAccount'][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':_0x93ce('0x169')});db[_0x93ce('0xf5')][_0x93ce('0x11a')](db[_0x93ce('0x82')],{'as':_0x93ce('0x142'),'foreignKey':_0x93ce('0x143')});db['WhatsappAccount'][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x1f1')});db[_0x93ce('0xf7')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'onDelete':_0x93ce('0x153')});db['WhatsappApplication'][_0x93ce('0x11a')](db[_0x93ce('0x100')],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0xf7')][_0x93ce('0x11a')](db[_0x93ce('0xf5')],{'onDelete':_0x93ce('0x153')});db[_0x93ce('0xf7')][_0x93ce('0x11a')](db[_0x93ce('0x80')],{'onDelete':_0x93ce('0x153'),'foreignKey':_0x93ce('0x141')});db[_0x93ce('0xf7')][_0x93ce('0x11a')](db[_0x93ce('0x15e')],{'onDelete':'restrict','foreignKey':_0x93ce('0x166')});db[_0x93ce('0xf9')][_0x93ce('0x10c')](db[_0x93ce('0xfb')],{'as':_0x93ce('0x148'),'onDelete':_0x93ce('0x10b'),'foreignKey':_0x93ce('0x1f2')});db[_0x93ce('0xf9')][_0x93ce('0x11a')](db[_0x93ce('0xf5')],{'as':_0x93ce('0x15c'),'foreignKey':_0x93ce('0x1f0')});db[_0x93ce('0xf9')]['belongsTo'](db[_0x93ce('0x11d')],{'as':'Contact','foreignKey':_0x93ce('0x14f')});db[_0x93ce('0xf9')][_0x93ce('0x11a')](db['User'],{'as':_0x93ce('0x15d'),'foreignKey':_0x93ce('0x10d')});db['WhatsappInteraction'][_0x93ce('0x11c')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x93ce('0x17e')});db[_0x93ce('0xf9')]['belongsToMany'](db[_0x93ce('0x15e')],{'through':_0x93ce('0x1a7'),'as':_0x93ce('0x160')});db[_0x93ce('0xf9')][_0x93ce('0x11c')](db['User'],{'as':_0x93ce('0x161'),'through':_0x93ce('0x12a'),'foreignKey':'WhatsappInteractionId'});db[_0x93ce('0xfb')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'as':_0x93ce('0x108')});db[_0x93ce('0xfb')][_0x93ce('0x11a')](db['CmContact'],{'onDelete':_0x93ce('0x10b'),'as':'Contact'});db['WhatsappMessage'][_0x93ce('0x11a')](db[_0x93ce('0xf9')],{'onDelete':_0x93ce('0x10b'),'as':_0x93ce('0x163'),'foreignKey':_0x93ce('0x1f2')});db[_0x93ce('0xfb')][_0x93ce('0x11a')](db['WhatsappAccount'],{'as':_0x93ce('0x15c'),'foreignKey':'WhatsappAccountId'});db[_0x93ce('0xfc')]['belongsTo'](db[_0x93ce('0xf5')],{});db[_0x93ce('0xfc')][_0x93ce('0x11a')](db[_0x93ce('0x120')],{'as':_0x93ce('0x168'),'foreignKey':'ListId'});db[_0x93ce('0xfc')][_0x93ce('0x11a')](db[_0x93ce('0x11d')],{'as':'Contact','foreignKey':_0x93ce('0x14f')});db[_0x93ce('0xfc')][_0x93ce('0x11a')](db['WhatsappInteraction'],{});db[_0x93ce('0xfc')][_0x93ce('0x11a')](db['WhatsappQueue'],{});db[_0x93ce('0xfc')][_0x93ce('0x11a')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x93ce('0x11a')](db[_0x93ce('0x108')],{});db[_0x93ce('0xfe')][_0x93ce('0x11a')](db['WhatsappMessage'],{});db[_0x93ce('0xfe')][_0x93ce('0x11a')](db[_0x93ce('0xf9')],{});db[_0x93ce('0xfe')]['belongsTo'](db[_0x93ce('0xf5')],{'foreignKey':_0x93ce('0x1f3'),'as':'FromAccount'});db[_0x93ce('0xfe')]['belongsTo'](db[_0x93ce('0xf5')],{'foreignKey':_0x93ce('0x1f4'),'as':_0x93ce('0x1db')});db[_0x93ce('0xfe')][_0x93ce('0x11a')](db[_0x93ce('0x100')],{'foreignKey':'ToQueueId','as':_0x93ce('0x1de')});db[_0x93ce('0xfe')][_0x93ce('0x11a')](db[_0x93ce('0x108')],{'foreignKey':_0x93ce('0x1d7'),'as':'FromAgent'});db[_0x93ce('0xfe')][_0x93ce('0x11a')](db['User'],{'foreignKey':_0x93ce('0x1d9'),'as':_0x93ce('0x1dd')});db['WhatsappQueue'][_0x93ce('0x11c')](db[_0x93ce('0x108')],{'as':_0x93ce('0x145'),'through':_0x93ce('0x39'),'foreignKey':'WhatsappQueueId'});db[_0x93ce('0x100')][_0x93ce('0x11c')](db[_0x93ce('0x146')],{'through':_0x93ce('0x1d0'),'as':'Teams'});db[_0x93ce('0x106')]['belongsTo'](db[_0x93ce('0x108')],{'as':_0x93ce('0x1f5'),'foreignKey':_0x93ce('0x10d'),'onDelete':'cascade','hooks':!![]});db[_0x93ce('0x151')]['hasOne'](db[_0x93ce('0x1c6')],{'as':_0x93ce('0x1c6'),'onDelete':'restrict'});db[_0x93ce('0x151')]['hasOne'](db['MailServerIn'],{'as':_0x93ce('0x155'),'onDelete':_0x93ce('0x153')});db[_0x93ce('0x151')][_0x93ce('0x109')](db[_0x93ce('0x154')],{'as':'Smtp','onDelete':_0x93ce('0x153')});module[_0x93ce('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2739aab..360b538 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9547=['./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','/snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/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/mail/out_servers','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards'];(function(_0x2b5fed,_0x42eb9a){var _0x1dd1bd=function(_0x4d15c9){while(--_0x4d15c9){_0x2b5fed['push'](_0x2b5fed['shift']());}};_0x1dd1bd(++_0x42eb9a);}(_0x9547,0xd9));var _0x7954=function(_0xb96e55,_0x30a21c){_0xb96e55=_0xb96e55-0x0;var _0x449150=_0x9547[_0xb96e55];return _0x449150;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x7954('0x0'));var config=require(_0x7954('0x1'));var setupLoggers=require(_0x7954('0x2'))[_0x7954('0x3')];var clientSideLogs=require(_0x7954('0x4'));exports['default']=function(_0x2c7329){return setupLoggers(_0x2c7329)[_0x7954('0x5')](function(){_0x2c7329['use']('/api/users',require(_0x7954('0x6')));_0x2c7329[_0x7954('0x7')](_0x7954('0x8'),require(_0x7954('0x9')));_0x2c7329[_0x7954('0x7')](_0x7954('0xa'),require(_0x7954('0xb')));_0x2c7329[_0x7954('0x7')](_0x7954('0xc'),require('./api/voiceExtension'));_0x2c7329[_0x7954('0x7')]('/api/voice/mohs',require(_0x7954('0xd')));_0x2c7329[_0x7954('0x7')]('/api/voice/queues',require(_0x7954('0xe')));_0x2c7329['use'](_0x7954('0xf'),require('./api/voiceRecording'));_0x2c7329[_0x7954('0x7')](_0x7954('0x10'),require('./api/screenRecording'));_0x2c7329['use'](_0x7954('0x11'),require(_0x7954('0x12')));_0x2c7329[_0x7954('0x7')]('/api/voice/mails/messages',require(_0x7954('0x13')));_0x2c7329[_0x7954('0x7')](_0x7954('0x14'),require('./api/voiceCallReport'));_0x2c7329[_0x7954('0x7')](_0x7954('0x15'),require(_0x7954('0x16')));_0x2c7329[_0x7954('0x7')](_0x7954('0x17'),require('./api/voiceAgentReport'));_0x2c7329[_0x7954('0x7')](_0x7954('0x18'),require(_0x7954('0x19')));_0x2c7329[_0x7954('0x7')](_0x7954('0x1a'),require(_0x7954('0x1b')));_0x2c7329['use'](_0x7954('0x1c'),require(_0x7954('0x1d')));_0x2c7329[_0x7954('0x7')](_0x7954('0x1e'),require('./api/voiceTransferReport'));_0x2c7329[_0x7954('0x7')](_0x7954('0x1f'),require('./api/mailServerOut'));_0x2c7329[_0x7954('0x7')](_0x7954('0x20'),require(_0x7954('0x21')));_0x2c7329[_0x7954('0x7')]('/api/mail/queues',require(_0x7954('0x22')));_0x2c7329[_0x7954('0x7')](_0x7954('0x23'),require(_0x7954('0x24')));_0x2c7329['use'](_0x7954('0x25'),require(_0x7954('0x26')));_0x2c7329[_0x7954('0x7')](_0x7954('0x27'),require(_0x7954('0x28')));_0x2c7329[_0x7954('0x7')](_0x7954('0x29'),require(_0x7954('0x2a')));_0x2c7329[_0x7954('0x7')](_0x7954('0x2b'),require(_0x7954('0x2c')));_0x2c7329[_0x7954('0x7')](_0x7954('0x2d'),require(_0x7954('0x2e')));_0x2c7329['use'](_0x7954('0x2f'),require(_0x7954('0x30')));_0x2c7329['use'](_0x7954('0x31'),require(_0x7954('0x32')));_0x2c7329[_0x7954('0x7')]('/api/fax/applications',require(_0x7954('0x33')));_0x2c7329[_0x7954('0x7')](_0x7954('0x34'),require(_0x7954('0x35')));_0x2c7329[_0x7954('0x7')](_0x7954('0x36'),require('./api/faxMessage'));_0x2c7329[_0x7954('0x7')](_0x7954('0x37'),require('./api/faxQueue'));_0x2c7329[_0x7954('0x7')]('/api/fax/reports/queue',require(_0x7954('0x38')));_0x2c7329[_0x7954('0x7')]('/api/sms/accounts',require('./api/smsAccount'));_0x2c7329[_0x7954('0x7')](_0x7954('0x39'),require(_0x7954('0x3a')));_0x2c7329[_0x7954('0x7')](_0x7954('0x3b'),require('./api/smsInteraction'));_0x2c7329[_0x7954('0x7')]('/api/sms/messages',require(_0x7954('0x3c')));_0x2c7329[_0x7954('0x7')](_0x7954('0x3d'),require(_0x7954('0x3e')));_0x2c7329[_0x7954('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x2c7329[_0x7954('0x7')](_0x7954('0x3f'),require('./api/openchannelApplication'));_0x2c7329[_0x7954('0x7')]('/api/openchannel/interactions',require(_0x7954('0x40')));_0x2c7329[_0x7954('0x7')]('/api/openchannel/messages',require(_0x7954('0x41')));_0x2c7329[_0x7954('0x7')](_0x7954('0x42'),require(_0x7954('0x43')));_0x2c7329[_0x7954('0x7')]('/api/chat/websites',require(_0x7954('0x44')));_0x2c7329[_0x7954('0x7')](_0x7954('0x45'),require(_0x7954('0x46')));_0x2c7329['use']('/api/chat/applications',require(_0x7954('0x47')));_0x2c7329[_0x7954('0x7')](_0x7954('0x48'),require(_0x7954('0x49')));_0x2c7329[_0x7954('0x7')](_0x7954('0x4a'),require(_0x7954('0x4b')));_0x2c7329[_0x7954('0x7')](_0x7954('0x4c'),require(_0x7954('0x4d')));_0x2c7329[_0x7954('0x7')](_0x7954('0x4e'),require(_0x7954('0x4f')));_0x2c7329[_0x7954('0x7')](_0x7954('0x50'),require('./api/chatGroup'));_0x2c7329[_0x7954('0x7')](_0x7954('0x51'),require(_0x7954('0x52')));_0x2c7329[_0x7954('0x7')](_0x7954('0x53'),require(_0x7954('0x54')));_0x2c7329[_0x7954('0x7')](_0x7954('0x55'),require('./api/cmContact'));_0x2c7329[_0x7954('0x7')]('/api/cm/hopper',require(_0x7954('0x56')));_0x2c7329[_0x7954('0x7')](_0x7954('0x57'),require('./api/cmHopperBlack'));_0x2c7329[_0x7954('0x7')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x2c7329[_0x7954('0x7')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x2c7329[_0x7954('0x7')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x2c7329[_0x7954('0x7')]('/api/actions',require(_0x7954('0x58')));_0x2c7329[_0x7954('0x7')](_0x7954('0x59'),require(_0x7954('0x5a')));_0x2c7329[_0x7954('0x7')](_0x7954('0x5b'),require(_0x7954('0x5c')));_0x2c7329[_0x7954('0x7')](_0x7954('0x5d'),require(_0x7954('0x5e')));_0x2c7329[_0x7954('0x7')](_0x7954('0x5f'),require(_0x7954('0x60')));_0x2c7329[_0x7954('0x7')]('/api/intervals',require(_0x7954('0x61')));_0x2c7329['use']('/api/pauses',require(_0x7954('0x62')));_0x2c7329[_0x7954('0x7')]('/api/cdr',require('./api/cdr'));_0x2c7329['use'](_0x7954('0x63'),require('./api/voiceQueuesLog'));_0x2c7329[_0x7954('0x7')](_0x7954('0x64'),require(_0x7954('0x65')));_0x2c7329[_0x7954('0x7')](_0x7954('0x66'),require(_0x7954('0x67')));_0x2c7329[_0x7954('0x7')](_0x7954('0x68'),require(_0x7954('0x69')));_0x2c7329[_0x7954('0x7')](_0x7954('0x6a'),require(_0x7954('0x6b')));_0x2c7329[_0x7954('0x7')](_0x7954('0x6c'),require('./api/cmContactHasItem'));_0x2c7329[_0x7954('0x7')](_0x7954('0x6d'),require(_0x7954('0x6e')));_0x2c7329[_0x7954('0x7')](_0x7954('0x6f'),require('./api/template'));_0x2c7329[_0x7954('0x7')](_0x7954('0x70'),require(_0x7954('0x71')));_0x2c7329[_0x7954('0x7')](_0x7954('0x72'),require(_0x7954('0x73')));_0x2c7329[_0x7954('0x7')](_0x7954('0x74'),require('./api/integration'));_0x2c7329['use'](_0x7954('0x75'),require('./api/integrationReport'));_0x2c7329['use']('/api/analytics/custom_reports',require(_0x7954('0x76')));_0x2c7329['use'](_0x7954('0x77'),require(_0x7954('0x78')));_0x2c7329[_0x7954('0x7')](_0x7954('0x79'),require(_0x7954('0x7a')));_0x2c7329[_0x7954('0x7')](_0x7954('0x7b'),require(_0x7954('0x7c')));_0x2c7329[_0x7954('0x7')](_0x7954('0x7d'),require(_0x7954('0x7e')));_0x2c7329[_0x7954('0x7')](_0x7954('0x7f'),require('./api/analyticTreeReport'));_0x2c7329['use'](_0x7954('0x80'),require(_0x7954('0x81')));_0x2c7329[_0x7954('0x7')](_0x7954('0x82'),require(_0x7954('0x83')));_0x2c7329[_0x7954('0x7')](_0x7954('0x84'),require(_0x7954('0x85')));_0x2c7329['use'](_0x7954('0x86'),require('./api/intSugarcrmAccount'));_0x2c7329['use'](_0x7954('0x87'),require(_0x7954('0x88')));_0x2c7329[_0x7954('0x7')]('/api/integrations/sugarcrm/fields',require(_0x7954('0x89')));_0x2c7329[_0x7954('0x7')](_0x7954('0x8a'),require('./api/intDeskAccount'));_0x2c7329[_0x7954('0x7')](_0x7954('0x8b'),require(_0x7954('0x8c')));_0x2c7329[_0x7954('0x7')](_0x7954('0x8d'),require(_0x7954('0x8e')));_0x2c7329['use']('/api/integrations/zoho/accounts',require(_0x7954('0x8f')));_0x2c7329[_0x7954('0x7')](_0x7954('0x90'),require('./api/intZohoConfiguration'));_0x2c7329[_0x7954('0x7')](_0x7954('0x91'),require(_0x7954('0x92')));_0x2c7329[_0x7954('0x7')](_0x7954('0x93'),require(_0x7954('0x94')));_0x2c7329['use']('/api/integrations/zendesk/configurations',require(_0x7954('0x95')));_0x2c7329[_0x7954('0x7')]('/api/integrations/zendesk/fields',require(_0x7954('0x96')));_0x2c7329['use'](_0x7954('0x97'),require(_0x7954('0x98')));_0x2c7329[_0x7954('0x7')](_0x7954('0x99'),require('./api/intFreshdeskConfiguration'));_0x2c7329['use']('/api/integrations/freshdesk/fields',require(_0x7954('0x9a')));_0x2c7329[_0x7954('0x7')](_0x7954('0x9b'),require('./api/intVtigerAccount'));_0x2c7329['use']('/api/integrations/vtiger/configurations',require(_0x7954('0x9c')));_0x2c7329[_0x7954('0x7')](_0x7954('0x9d'),require(_0x7954('0x9e')));_0x2c7329[_0x7954('0x7')](_0x7954('0x9f'),require(_0x7954('0xa0')));_0x2c7329[_0x7954('0x7')](_0x7954('0xa1'),require(_0x7954('0xa2')));_0x2c7329[_0x7954('0x7')]('/api/integrations/servicenow/fields',require(_0x7954('0xa3')));_0x2c7329[_0x7954('0x7')](_0x7954('0xa4'),require('./api/intDynamics365Account'));_0x2c7329[_0x7954('0x7')](_0x7954('0xa5'),require('./api/intDynamics365Configuration'));_0x2c7329[_0x7954('0x7')](_0x7954('0xa6'),require('./api/intDynamics365Field'));_0x2c7329[_0x7954('0x7')](_0x7954('0xa7'),require(_0x7954('0xa8')));_0x2c7329[_0x7954('0x7')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x2c7329[_0x7954('0x7')](_0x7954('0xa9'),require(_0x7954('0xaa')));_0x2c7329[_0x7954('0x7')](_0x7954('0xab'),require(_0x7954('0xac')));_0x2c7329[_0x7954('0x7')](_0x7954('0xad'),require(_0x7954('0xae')));_0x2c7329['use'](_0x7954('0xaf'),require(_0x7954('0xb0')));_0x2c7329[_0x7954('0x7')](_0x7954('0xb1'),require(_0x7954('0xb2')));_0x2c7329[_0x7954('0x7')]('/api/jscripty/questions/reports',require(_0x7954('0xb3')));_0x2c7329[_0x7954('0x7')](_0x7954('0xb4'),require('./api/jscriptySessionReport'));_0x2c7329[_0x7954('0x7')](_0x7954('0xb5'),require(_0x7954('0xb6')));_0x2c7329[_0x7954('0x7')](_0x7954('0xb7'),require(_0x7954('0xb8')));_0x2c7329['use'](_0x7954('0xb9'),require(_0x7954('0xba')));_0x2c7329[_0x7954('0x7')](_0x7954('0xbb'),require('./api/jscriptyProject'));_0x2c7329[_0x7954('0x7')](_0x7954('0xbc'),require(_0x7954('0xbd')));_0x2c7329[_0x7954('0x7')](_0x7954('0xbe'),require(_0x7954('0xbf')));_0x2c7329[_0x7954('0x7')](_0x7954('0xc0'),require('./api/squareProject'));_0x2c7329[_0x7954('0x7')](_0x7954('0xc1'),require(_0x7954('0xc2')));_0x2c7329[_0x7954('0x7')](_0x7954('0xc3'),require(_0x7954('0xc4')));_0x2c7329[_0x7954('0x7')]('/api/teams',require(_0x7954('0xc5')));_0x2c7329[_0x7954('0x7')]('/api/license',require('./api/license'));_0x2c7329['use']('/api/campaigns',require(_0x7954('0xc6')));_0x2c7329[_0x7954('0x7')](_0x7954('0xc7'),require(_0x7954('0xc8')));_0x2c7329[_0x7954('0x7')](_0x7954('0xc9'),require(_0x7954('0xca')));_0x2c7329[_0x7954('0x7')]('/api/plugins',require(_0x7954('0xcb')));_0x2c7329['use']('/api/mail/reports/transfer',require(_0x7954('0xcc')));_0x2c7329[_0x7954('0x7')](_0x7954('0xcd'),require('./api/chatTransferReport'));_0x2c7329[_0x7954('0x7')]('/api/fax/reports/transfer',require(_0x7954('0xce')));_0x2c7329[_0x7954('0x7')](_0x7954('0xcf'),require(_0x7954('0xd0')));_0x2c7329['use'](_0x7954('0xd1'),require(_0x7954('0xd2')));_0x2c7329[_0x7954('0x7')](_0x7954('0xd3'),require(_0x7954('0xd4')));_0x2c7329[_0x7954('0x7')](_0x7954('0xd5'),require('./api/voicePrefix'));_0x2c7329[_0x7954('0x7')](_0x7954('0xd6'),require('./api/userProfile'));_0x2c7329[_0x7954('0x7')](_0x7954('0xd7'),require('./api/userProfileSection'));_0x2c7329[_0x7954('0x7')](_0x7954('0xd8'),require(_0x7954('0xd9')));_0x2c7329['use'](_0x7954('0xda'),require(_0x7954('0xdb')));_0x2c7329['use'](_0x7954('0xdc'),require(_0x7954('0xdd')));_0x2c7329[_0x7954('0x7')](_0x7954('0xde'),require(_0x7954('0xdf')));_0x2c7329[_0x7954('0x7')]('/api/whatsapp/interactions',require(_0x7954('0xe0')));_0x2c7329['use']('/api/whatsapp/messages',require(_0x7954('0xe1')));_0x2c7329['use'](_0x7954('0xe2'),require(_0x7954('0xe3')));_0x2c7329[_0x7954('0x7')](_0x7954('0xe4'),require('./api/whatsappTransferReport'));_0x2c7329[_0x7954('0x7')](_0x7954('0xe5'),require('./api/whatsappQueue'));_0x2c7329[_0x7954('0x7')](_0x7954('0xe6'),require(_0x7954('0xe7')));_0x2c7329['use'](_0x7954('0xe8'),require('./api/realtime'));_0x2c7329['use']('/api/user-settings',require(_0x7954('0xe9')));_0x2c7329[_0x7954('0x7')](_0x7954('0xea'),require(_0x7954('0xeb')));_0x2c7329[_0x7954('0x7')]('/api/auth/local',require(_0x7954('0xec')));_0x2c7329['use'](_0x7954('0xed'),require(_0x7954('0xee')));_0x2c7329[_0x7954('0x7')](_0x7954('0xef'),require(_0x7954('0xf0')));_0x2c7329['use'](_0x7954('0xf1'),require('./api/jira'));_0x2c7329['use']('/api/rpc',require(_0x7954('0xf2')));_0x2c7329[_0x7954('0x7')](_0x7954('0xf3'),require('./api/version'));_0x2c7329[_0x7954('0x7')](_0x7954('0xf4'),require(_0x7954('0xf5')));_0x2c7329[_0x7954('0x7')]('/api/pm2',require('./api/pm2'));_0x2c7329[_0x7954('0x7')](_0x7954('0xf6'),require(_0x7954('0xf7')));_0x2c7329[_0x7954('0x7')](_0x7954('0xf8'),clientSideLogs);_0x2c7329['use'](_0x7954('0xf9'),express['static'](path[_0x7954('0xfa')](config[_0x7954('0xfb')],_0x7954('0xf9'))));_0x2c7329[_0x7954('0x7')](_0x7954('0xfc'),express[_0x7954('0xfd')](path[_0x7954('0xfa')](config['root'],_0x7954('0xfc'))));_0x2c7329[_0x7954('0x7')](_0x7954('0xfe'),express[_0x7954('0xfd')](path[_0x7954('0xfa')](config['root'],_0x7954('0xfe'))));_0x2c7329[_0x7954('0x7')](_0x7954('0xff'),express[_0x7954('0xfd')](path[_0x7954('0xfa')](config[_0x7954('0xfb')],'snippet','3.9.0')));_0x2c7329['use']('/plugins',express[_0x7954('0xfd')](path[_0x7954('0xfa')](config[_0x7954('0xfb')],_0x7954('0x100'))));_0x2c7329[_0x7954('0x101')](_0x7954('0x102'))[_0x7954('0x103')](errors[0x194]);_0x2c7329[_0x7954('0x101')]('/*')[_0x7954('0x103')](function(_0x1d784c,_0x443650){_0x443650[_0x7954('0x104')](path[_0x7954('0x105')](_0x2c7329[_0x7954('0x103')]('appPath')+_0x7954('0x106')));});return _0x2c7329;});}; \ No newline at end of file +var _0xbc42=['./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/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/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static','join','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express','./config/environment','setupLoggers','default','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbc42,0xa2));var _0x2bc4=function(_0x215c46,_0x26f9db){_0x215c46=_0x215c46-0x0;var _0x4574b4=_0xbc42[_0x215c46];return _0x4574b4;};'use strict';var path=require(_0x2bc4('0x0'));var express=require(_0x2bc4('0x1'));var errors=require('./errors');var config=require(_0x2bc4('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x2bc4('0x3')];var clientSideLogs=require('./api/client-side-logs');exports[_0x2bc4('0x4')]=function(_0x9e43e5){return setupLoggers(_0x9e43e5)['then'](function(){_0x9e43e5[_0x2bc4('0x5')]('/api/users',require(_0x2bc4('0x6')));_0x9e43e5[_0x2bc4('0x5')]('/api/voice/chanspy',require(_0x2bc4('0x7')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x8'),require('./api/voiceContext'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x9'),require('./api/voiceExtension'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xa'),require('./api/voiceMusicOnHold'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xb'),require('./api/voiceQueue'));_0x9e43e5['use'](_0x2bc4('0xc'),require(_0x2bc4('0xd')));_0x9e43e5['use'](_0x2bc4('0xe'),require(_0x2bc4('0xf')));_0x9e43e5['use'](_0x2bc4('0x10'),require(_0x2bc4('0x11')));_0x9e43e5['use'](_0x2bc4('0x12'),require('./api/voiceMailMessage'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x13'),require(_0x2bc4('0x14')));_0x9e43e5['use'](_0x2bc4('0x15'),require(_0x2bc4('0x16')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x17'),require(_0x2bc4('0x18')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x19'),require('./api/voiceQueueReport'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x1a'),require(_0x2bc4('0x1b')));_0x9e43e5['use'](_0x2bc4('0x1c'),require(_0x2bc4('0x1d')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x1e'),require(_0x2bc4('0x1f')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x20'),require('./api/mailServerOut'));_0x9e43e5['use'](_0x2bc4('0x21'),require(_0x2bc4('0x22')));_0x9e43e5['use'](_0x2bc4('0x23'),require(_0x2bc4('0x24')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x25'),require('./api/mailSubstatus'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x26'),require(_0x2bc4('0x27')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x28'),require(_0x2bc4('0x29')));_0x9e43e5[_0x2bc4('0x5')]('/api/mail/applications',require(_0x2bc4('0x2a')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x2b'),require(_0x2bc4('0x2c')));_0x9e43e5[_0x2bc4('0x5')]('/api/dashboards',require(_0x2bc4('0x2d')));_0x9e43e5[_0x2bc4('0x5')]('/api/dashboards/items',require(_0x2bc4('0x2e')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x2f'),require('./api/faxAccount'));_0x9e43e5['use']('/api/fax/applications',require('./api/faxApplication'));_0x9e43e5[_0x2bc4('0x5')]('/api/fax/interactions',require(_0x2bc4('0x30')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x31'),require(_0x2bc4('0x32')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x33'),require(_0x2bc4('0x34')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x35'),require(_0x2bc4('0x36')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x37'),require(_0x2bc4('0x38')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x39'),require(_0x2bc4('0x3a')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x3b'),require(_0x2bc4('0x3c')));_0x9e43e5[_0x2bc4('0x5')]('/api/sms/messages',require(_0x2bc4('0x3d')));_0x9e43e5['use'](_0x2bc4('0x3e'),require(_0x2bc4('0x3f')));_0x9e43e5['use'](_0x2bc4('0x40'),require(_0x2bc4('0x41')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x42'),require(_0x2bc4('0x43')));_0x9e43e5[_0x2bc4('0x5')]('/api/openchannel/interactions',require(_0x2bc4('0x44')));_0x9e43e5['use'](_0x2bc4('0x45'),require('./api/openchannelMessage'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x46'),require('./api/openchannelQueue'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x47'),require(_0x2bc4('0x48')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x49'),require('./api/openchannelQueueReport'));_0x9e43e5['use']('/api/chat/applications',require(_0x2bc4('0x4a')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x4b'),require('./api/chatInteraction'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x4c'),require(_0x2bc4('0x4d')));_0x9e43e5['use']('/api/chat/offline_messages',require(_0x2bc4('0x4e')));_0x9e43e5['use'](_0x2bc4('0x4f'),require('./api/chatQueue'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x50'),require('./api/chatGroup'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x51'),require(_0x2bc4('0x52')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x53'),require(_0x2bc4('0x54')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x55'),require('./api/cmContact'));_0x9e43e5['use'](_0x2bc4('0x56'),require(_0x2bc4('0x57')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x58'),require(_0x2bc4('0x59')));_0x9e43e5['use']('/api/cm/hopper_final',require(_0x2bc4('0x5a')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x5b'),require(_0x2bc4('0x5c')));_0x9e43e5[_0x2bc4('0x5')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x9e43e5['use'](_0x2bc4('0x5d'),require(_0x2bc4('0x5e')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x5f'),require(_0x2bc4('0x60')));_0x9e43e5['use'](_0x2bc4('0x61'),require(_0x2bc4('0x62')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x63'),require(_0x2bc4('0x64')));_0x9e43e5['use'](_0x2bc4('0x65'),require(_0x2bc4('0x66')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x67'),require(_0x2bc4('0x68')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x69'),require('./api/pause'));_0x9e43e5[_0x2bc4('0x5')]('/api/cdr',require(_0x2bc4('0x6a')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x6b'),require(_0x2bc4('0x6c')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x6d'),require(_0x2bc4('0x6e')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x6f'),require(_0x2bc4('0x70')));_0x9e43e5['use'](_0x2bc4('0x71'),require(_0x2bc4('0x72')));_0x9e43e5[_0x2bc4('0x5')]('/api/contact_item_types',require(_0x2bc4('0x73')));_0x9e43e5['use'](_0x2bc4('0x74'),require('./api/cmContactHasItem'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x75'),require(_0x2bc4('0x76')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x77'),require(_0x2bc4('0x78')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x79'),require(_0x2bc4('0x7a')));_0x9e43e5['use'](_0x2bc4('0x7b'),require(_0x2bc4('0x7c')));_0x9e43e5['use']('/api/integrations',require(_0x2bc4('0x7d')));_0x9e43e5['use']('/api/integrations/reports',require(_0x2bc4('0x7e')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x7f'),require(_0x2bc4('0x80')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x81'),require(_0x2bc4('0x82')));_0x9e43e5['use'](_0x2bc4('0x83'),require('./api/analyticExtractedReport'));_0x9e43e5['use']('/api/analytics/metrics',require(_0x2bc4('0x84')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x85'),require('./api/analyticFieldReport'));_0x9e43e5[_0x2bc4('0x5')]('/api/analytics/tree_reports',require(_0x2bc4('0x86')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x87'),require(_0x2bc4('0x88')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x89'),require(_0x2bc4('0x8a')));_0x9e43e5['use']('/api/integrations/salesforce/fields',require(_0x2bc4('0x8b')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x8c'),require('./api/intSugarcrmAccount'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x8d'),require(_0x2bc4('0x8e')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x8f'),require(_0x2bc4('0x90')));_0x9e43e5['use'](_0x2bc4('0x91'),require(_0x2bc4('0x92')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x93'),require(_0x2bc4('0x94')));_0x9e43e5['use'](_0x2bc4('0x95'),require('./api/intDeskField'));_0x9e43e5['use'](_0x2bc4('0x96'),require(_0x2bc4('0x97')));_0x9e43e5['use']('/api/integrations/zoho/configurations',require(_0x2bc4('0x98')));_0x9e43e5['use']('/api/integrations/zoho/fields',require(_0x2bc4('0x99')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x9a'),require('./api/intZendeskAccount'));_0x9e43e5['use'](_0x2bc4('0x9b'),require('./api/intZendeskConfiguration'));_0x9e43e5[_0x2bc4('0x5')]('/api/integrations/zendesk/fields',require(_0x2bc4('0x9c')));_0x9e43e5[_0x2bc4('0x5')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x9d'),require('./api/intFreshdeskConfiguration'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x9e'),require('./api/intFreshdeskField'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x9f'),require('./api/intVtigerAccount'));_0x9e43e5['use'](_0x2bc4('0xa0'),require(_0x2bc4('0xa1')));_0x9e43e5[_0x2bc4('0x5')]('/api/integrations/vtiger/fields',require(_0x2bc4('0xa2')));_0x9e43e5[_0x2bc4('0x5')]('/api/integrations/servicenow/accounts',require(_0x2bc4('0xa3')));_0x9e43e5[_0x2bc4('0x5')]('/api/integrations/servicenow/configurations',require(_0x2bc4('0xa4')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xa5'),require(_0x2bc4('0xa6')));_0x9e43e5[_0x2bc4('0x5')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xa7'),require(_0x2bc4('0xa8')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xa9'),require('./api/intDynamics365Field'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xaa'),require(_0x2bc4('0xab')));_0x9e43e5[_0x2bc4('0x5')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x9e43e5['use'](_0x2bc4('0xac'),require(_0x2bc4('0xad')));_0x9e43e5[_0x2bc4('0x5')]('/api/networks',require(_0x2bc4('0xae')));_0x9e43e5['use']('/api/chat/reports/queue',require(_0x2bc4('0xaf')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xb0'),require('./api/chatInternalMessage'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xb1'),require(_0x2bc4('0xb2')));_0x9e43e5[_0x2bc4('0x5')]('/api/jscripty/questions/reports',require(_0x2bc4('0xb3')));_0x9e43e5['use']('/api/jscripty/sessions/reports',require(_0x2bc4('0xb4')));_0x9e43e5['use']('/api/sms/reports/queue',require(_0x2bc4('0xb5')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xb6'),require(_0x2bc4('0xb7')));_0x9e43e5[_0x2bc4('0x5')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xb8'),require('./api/jscriptyProject'));_0x9e43e5[_0x2bc4('0x5')]('/api/settings',require('./api/setting'));_0x9e43e5[_0x2bc4('0x5')]('/api/square/odbc',require('./api/squareOdbc'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xb9'),require(_0x2bc4('0xba')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xbb'),require('./api/squareRecording'));_0x9e43e5['use'](_0x2bc4('0xbc'),require('./api/squareMessage'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xbd'),require(_0x2bc4('0xbe')));_0x9e43e5['use'](_0x2bc4('0xbf'),require(_0x2bc4('0xc0')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xc1'),require(_0x2bc4('0xc2')));_0x9e43e5[_0x2bc4('0x5')]('/api/migrations',require('./api/migration'));_0x9e43e5[_0x2bc4('0x5')]('/api/attachments',require(_0x2bc4('0xc3')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xc4'),require(_0x2bc4('0xc5')));_0x9e43e5['use'](_0x2bc4('0xc6'),require(_0x2bc4('0xc7')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xc8'),require(_0x2bc4('0xc9')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xca'),require(_0x2bc4('0xcb')));_0x9e43e5['use'](_0x2bc4('0xcc'),require(_0x2bc4('0xcd')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xce'),require(_0x2bc4('0xcf')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xd0'),require('./api/cmList'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xd1'),require(_0x2bc4('0xd2')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xd3'),require(_0x2bc4('0xd4')));_0x9e43e5['use'](_0x2bc4('0xd5'),require(_0x2bc4('0xd6')));_0x9e43e5[_0x2bc4('0x5')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x9e43e5['use'](_0x2bc4('0xd7'),require('./api/userNotification'));_0x9e43e5['use']('/api/whatsapp/accounts',require(_0x2bc4('0xd8')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xd9'),require(_0x2bc4('0xda')));_0x9e43e5[_0x2bc4('0x5')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xdb'),require(_0x2bc4('0xdc')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xdd'),require(_0x2bc4('0xde')));_0x9e43e5[_0x2bc4('0x5')]('/api/whatsapp/reports/transfer',require(_0x2bc4('0xdf')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xe0'),require(_0x2bc4('0xe1')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xe2'),require(_0x2bc4('0xe3')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xe4'),require(_0x2bc4('0xe5')));_0x9e43e5['use']('/api/user-settings',require(_0x2bc4('0xe6')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xe7'),require(_0x2bc4('0xe8')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xe9'),require(_0x2bc4('0xea')));_0x9e43e5['use'](_0x2bc4('0xeb'),require(_0x2bc4('0xec')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xed'),require(_0x2bc4('0xee')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xef'),require(_0x2bc4('0xf0')));_0x9e43e5['use'](_0x2bc4('0xf1'),require(_0x2bc4('0xf2')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xf3'),require(_0x2bc4('0xf4')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xf5'),require('./api/system'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xf6'),require('./api/pm2'));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xf7'),require(_0x2bc4('0xf8')));_0x9e43e5[_0x2bc4('0x5')]('/api/logs',clientSideLogs);_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xf9'),express['static'](path['join'](config[_0x2bc4('0xfa')],'/apidoc')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xfb'),express[_0x2bc4('0xfc')](path[_0x2bc4('0xfd')](config[_0x2bc4('0xfa')],_0x2bc4('0xfb'))));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xfe'),express[_0x2bc4('0xfc')](path[_0x2bc4('0xfd')](config[_0x2bc4('0xfa')],'/demo')));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0xff'),express[_0x2bc4('0xfc')](path[_0x2bc4('0xfd')](config[_0x2bc4('0xfa')],_0x2bc4('0x100'),_0x2bc4('0x101'))));_0x9e43e5[_0x2bc4('0x5')](_0x2bc4('0x102'),express[_0x2bc4('0xfc')](path[_0x2bc4('0xfd')](config['root'],_0x2bc4('0x103'))));_0x9e43e5[_0x2bc4('0x104')](_0x2bc4('0x105'))[_0x2bc4('0x106')](errors[0x194]);_0x9e43e5[_0x2bc4('0x104')]('/*')[_0x2bc4('0x106')](function(_0x28b690,_0x1eef9c){_0x1eef9c[_0x2bc4('0x107')](path['resolve'](_0x9e43e5[_0x2bc4('0x106')](_0x2bc4('0x108'))+_0x2bc4('0x109')));});return _0x9e43e5;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 06fa89f..92227c4 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x873a=['../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','port','rpc','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/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/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc'];(function(_0x337ba3,_0x58a28a){var _0x276036=function(_0x128dd5){while(--_0x128dd5){_0x337ba3['push'](_0x337ba3['shift']());}};_0x276036(++_0x58a28a);}(_0x873a,0x1c2));var _0xa873=function(_0x4c8c37,_0x2dbb46){_0x4c8c37=_0x4c8c37-0x0;var _0x3b1d1a=_0x873a[_0x4c8c37];return _0x3b1d1a;};'use strict';var jayson=require(_0xa873('0x0'));var _=require(_0xa873('0x1'));var config=require(_0xa873('0x2'));exports['listen']=function(){return new Promise(function(_0x1de6be,_0x5733ee){var _0x52c086={};_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x4')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x5')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/voiceQueue/voiceQueue.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/voiceRecording/voiceRecording.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x6')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x7')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x8')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x9')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0xa')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/trunk/trunk.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0xb')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0xc')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/mailQueue/mailQueue.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0xd')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/mailMessage/mailMessage.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0xe')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0xf')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/faxApplication/faxApplication.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/faxInteraction/faxInteraction.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/faxMessage/faxMessage.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x10')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x11')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x12')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x13')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x14')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x15')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x16')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x17')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x18')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x19')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x1a')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/chatInteraction/chatInteraction.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/chatMessage/chatMessage.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x1b')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/cmContact/cmContact.rpc'));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x1c')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x1d')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x1e')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x1f')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x20')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x21')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x22')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x23')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x24')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x25')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x26')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x27')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x28')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x29')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x2a')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x2b')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x2c')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x2d')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x2e')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x2f')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x30')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x31')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x32')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x33')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x34')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/setting/setting.rpc'));_0x52c086=_['merge'](_0x52c086,require('../api/squareOdbc/squareOdbc.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x35')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x36')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x37')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x38')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x39')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x3a')));_0x52c086=_['merge'](_0x52c086,require(_0xa873('0x3b')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x3c')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x52c086=_[_0xa873('0x3')](_0x52c086,require(_0xa873('0x3d')));_0x52c086=_[_0xa873('0x3')](_0x52c086,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x569591=jayson[_0xa873('0x3e')](_0x52c086)[_0xa873('0x3f')]();var _0x3e15d9=config['rpc'][_0xa873('0x40')]||config[_0xa873('0x40')]+0x1;var _0xe2110c=config[_0xa873('0x41')]['ip']||'localhost';_0x569591['on'](_0xa873('0x42'),function(_0x2493e3){return _0x5733ee(_0x2493e3);});_0x569591[_0xa873('0x43')](_0x3e15d9,_0xe2110c,function(){console[_0xa873('0x44')](_0xa873('0x45'),_0xe2110c,_0x3e15d9);require(_0xa873('0x46'))[_0xa873('0x47')]();return _0x1de6be(_0xa873('0x48')+_0xe2110c+':'+_0x3e15d9);});});}; \ No newline at end of file +var _0xf56c=['server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc'];(function(_0x40dbf5,_0x573669){var _0x17905a=function(_0x417707){while(--_0x417707){_0x40dbf5['push'](_0x40dbf5['shift']());}};_0x17905a(++_0x573669);}(_0xf56c,0x86));var _0xcf56=function(_0x154f75,_0xd2b043){_0x154f75=_0x154f75-0x0;var _0x219e66=_0xf56c[_0x154f75];return _0x219e66;};'use strict';var jayson=require('jayson/promise');var _=require(_0xcf56('0x0'));var config=require(_0xcf56('0x1'));exports[_0xcf56('0x2')]=function(){return new Promise(function(_0x1a42c2,_0x22d762){var _0x33e60e={};_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/user/user.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x4')));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x5')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/voiceRecording/voiceRecording.rpc'));_0x33e60e=_['merge'](_0x33e60e,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x6')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x7')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x8')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x9')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/trunk/trunk.rpc'));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0xa')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0xb')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0xc')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0xd')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0xe')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0xf')));_0x33e60e=_['merge'](_0x33e60e,require('../api/mailApplication/mailApplication.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x10')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x11')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x12')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/faxMessage/faxMessage.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/faxQueue/faxQueue.rpc'));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x13')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x14')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/smsInteraction/smsInteraction.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x15')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x16')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x17')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x18')));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x19')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x1a')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x33e60e=_['merge'](_0x33e60e,require('../api/chatInteraction/chatInteraction.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/chatMessage/chatMessage.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x1b')));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x1c')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/cmHopper/cmHopper.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x33e60e=_['merge'](_0x33e60e,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x1d')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x1e')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/interval/interval.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x1f')));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x20')));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x21')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x22')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x23')));_0x33e60e=_['merge'](_0x33e60e,require('../api/variable/variable.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x24')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x25')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x26')));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x27')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x28')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x29')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x2a')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x2b')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x2c')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/setting/setting.rpc'));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x2d')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/squareProject/squareProject.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x2e')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x2f')));_0x33e60e=_['merge'](_0x33e60e,require('../api/campaign/campaign.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x30')));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x31')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require(_0xcf56('0x32')));_0x33e60e=_['merge'](_0x33e60e,require(_0xcf56('0x33')));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x33e60e=_[_0xcf56('0x3')](_0x33e60e,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3fa730=jayson[_0xcf56('0x34')](_0x33e60e)[_0xcf56('0x35')]();var _0x2b0bdb=config[_0xcf56('0x36')][_0xcf56('0x37')]||config['port']+0x1;var _0x103939=config[_0xcf56('0x36')]['ip']||_0xcf56('0x38');_0x3fa730['on'](_0xcf56('0x39'),function(_0x3d08e7){return _0x22d762(_0x3d08e7);});_0x3fa730[_0xcf56('0x2')](_0x2b0bdb,_0x103939,function(){console[_0xcf56('0x3a')](_0xcf56('0x3b'),_0x103939,_0x2b0bdb);require(_0xcf56('0x3c'))['default']();return _0x1a42c2(_0xcf56('0x3d')+_0x103939+':'+_0x2b0bdb);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index cff6342..be18326 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 _0x8991=['prototype','sendRequest','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','format','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits'];(function(_0x137981,_0x5caa53){var _0x4ebc80=function(_0x34660f){while(--_0x34660f){_0x137981['push'](_0x137981['shift']());}};_0x4ebc80(++_0x5caa53);}(_0x8991,0x1b0));var _0x1899=function(_0x3fa04a,_0x1b5d83){_0x3fa04a=_0x3fa04a-0x0;var _0x3008bc=_0x8991[_0x3fa04a];return _0x3008bc;};'use strict';var util=require(_0x1899('0x0'));var _=require(_0x1899('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0x1899('0x2'));var AGIError=require(_0x1899('0x3'));function AGIChannel(_0xd45726){var _0x1183f1=this,_0xdf3e4d=new AGIReply(),_0x32df91=![],_0x2d3712={};EventEmitter[_0x1899('0x4')](_0x1183f1);_0xd45726[_0x1899('0x5')](_0x1899('0x6'));_0xd45726[_0x1899('0x7')](0x8*0x3c*0x3c*0x3e8);_0xdf3e4d[_0x1899('0x5')](_0x1899('0x6'));_0xdf3e4d['on'](_0x1899('0x8'),function(_0x5ae1ca){for(var _0x1259f4 in _0x5ae1ca){_0x1183f1[_0x1259f4]=_0x5ae1ca[_0x1259f4];}_0x1183f1[_0x1899('0x9')]('ready');});_0xdf3e4d['on'](_0x1899('0xa'),function(_0x17b8b){if(_0x17b8b[_0x1899('0xb')]()=='hangup'){_0x1183f1[_0x1899('0x9')](_0x1899('0xc'));return;}if(_0x17b8b[_0x1899('0xd')](0x0,0xb)==_0x1899('0xe')){_0x32df91=!![];}if(_0x32df91){_0x2d3712['rx']+=_0x17b8b+'\x0a';if(_0x17b8b['search']('520\x20End\x20of\x20proper')!=-0x1){_0x32df91=![];}}else{_0x2d3712['rx']=_0x17b8b;}if(_0x32df91){return;}if(typeof _0x2d3712['cb']==_0x1899('0xf')){var _0x5e1353=_0x2d3712['rx']['substring'](0x0,0x3),_0x22ca67=null,_0x308c2b=null;_0x5e1353=parseInt(_0x5e1353);if(isNaN(_0x5e1353)){_0x2d3712['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1899('0x10')});return;}if(_0x5e1353!=0xc8){_0x2d3712['cb'](null,{'code':_0x5e1353,'result':-0x1,'extra':'KO'});return;}_0x22ca67=_0x2d3712['rx'][_0x1899('0xd')](0x4)[_0x1899('0x11')](_0x1899('0x12'),'');if(_0x22ca67['indexOf']('\x20')!=-0x1){_0x22ca67=_0x22ca67[_0x1899('0x13')](0x0,_0x22ca67[_0x1899('0x14')]('\x20'));}if(_[_0x1899('0x15')](_0x22ca67,'-1')){_0x22ca67=parseInt(_0x22ca67);}_0x308c2b=_0x2d3712['rx'][_0x1899('0x16')]('\x20');if(_0x308c2b[_0x1899('0x17')]==0x3){_0x308c2b=_0x308c2b[0x2][_0x1899('0xd')](0x1,_0x308c2b[0x2][_0x1899('0x17')]-0x1);}else if(_0x308c2b['length']>0x3){var _0x5ba31b=/\((.+)\)/;var _0x56e781=_0x2d3712['rx'][_0x1899('0x18')](_0x5ba31b);if(_0x56e781){_0x308c2b=_0x56e781[0x1];}else{_0x308c2b=null;}}else{_0x308c2b=null;}_0x2d3712['cb'](null,{'code':_0x5e1353,'result':_0x22ca67,'extra':_0x308c2b});}});_0xd45726['on']('error',function(_0x2dfca0){_0x1183f1['emit'](_0x1899('0x19'),new AGIError(_0x1899('0x1a'),_0x2dfca0[_0x1899('0x1b')]));});_0xd45726['on'](_0x1899('0x1c'),function(){_0x1183f1[_0x1899('0x9')](_0x1899('0x1c'),new AGIError(_0x1899('0x1d')));});_0xd45726['on'](_0x1899('0x1e'),function(){_0x1183f1[_0x1899('0x9')](_0x1899('0x1e'),new AGIError(_0x1899('0x1f')));_0xd45726['destroy']();});_0xd45726[_0x1899('0x20')](_0xdf3e4d);this[_0x1899('0x21')]=function(_0x4f346c,_0x4a3aad){var _0x4f346c=_0x4f346c||'',_0x4a3aad=typeof _0x4a3aad==_0x1899('0xf')?_0x4a3aad:new Function();_0x2d3712={'tx':_0x4f346c,'rx':'','cb':_0x4a3aad};_0xd45726[_0x1899('0x22')](_0x4f346c+'\x0a');},this[_0x1899('0x1c')]=function(){_0xd45726['destroy']();};}util[_0x1899('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x1899('0x24')][_0x1899('0x25')]=function(_0x11291a){return this[_0x1899('0x21')]['sync'](this,_0x11291a);};AGIChannel['prototype'][_0x1899('0x26')]=function(){return this[_0x1899('0x25')](_0x1899('0x27'));};AGIChannel[_0x1899('0x24')][_0x1899('0x28')]=function(_0xeb41f6,_0x2ba3b2,_0x53b59e){_0xeb41f6=_0xeb41f6===undefined?_0x1899('0x29'):_0xeb41f6;_0x2ba3b2=_0x2ba3b2===undefined?'5':_0x2ba3b2;_0x53b59e=_0x53b59e===undefined?'1':_0x53b59e;return this[_0x1899('0x25')](util['format'](_0x1899('0x2a'),_0xeb41f6,_0x2ba3b2*0x3e8,_0x53b59e));};AGIChannel[_0x1899('0x24')]['noop']=function(_0x55d2f9){_0x55d2f9=_0x55d2f9||_0x1899('0x2b');return this[_0x1899('0x25')](util['format'](_0x1899('0x2c'),_0x55d2f9));};AGIChannel[_0x1899('0x24')][_0x1899('0x2d')]=function(_0x2dddae,_0x17d39d){if(_['isArray'](_0x17d39d)){return this[_0x1899('0x25')](util[_0x1899('0x2e')](_0x1899('0x2f'),_0x2dddae,_0x17d39d[_0x1899('0x30')](',')));}return this['sendRequest'](util[_0x1899('0x2e')]('EXEC\x20%s\x20%s',_0x2dddae,_0x17d39d));};AGIChannel[_0x1899('0x24')][_0x1899('0x31')]=function(_0x11f930){return this[_0x1899('0x25')](util[_0x1899('0x2e')](_0x1899('0x32'),_0x11f930));};AGIChannel[_0x1899('0x24')][_0x1899('0x33')]=function(_0x416de7){return this[_0x1899('0x25')](util[_0x1899('0x2e')](_0x1899('0x34'),_0x416de7));};AGIChannel[_0x1899('0x24')][_0x1899('0x35')]=function(_0x82bf77){return this['sendRequest'](util[_0x1899('0x2e')]('SET\x20PRIORITY\x20%s',_0x82bf77));};AGIChannel[_0x1899('0x24')]['hangup']=function(){return this['sendRequest'](_0x1899('0x36'));};AGIChannel[_0x1899('0x24')][_0x1899('0x37')]=function(_0x56fa5a,_0x504b28){var _0x4bea56=_['isBoolean'](_0x504b28)||_[_0x1899('0x38')](_0x504b28)?_0x504b28[_0x1899('0x39')]():_0x504b28;return this[_0x1899('0x25')](util[_0x1899('0x2e')](_0x1899('0x3a'),_0x56fa5a,_0x4bea56?_0x4bea56['toString']()[_0x1899('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1899('0x24')][_0x1899('0x3b')]=function(_0x3fa881,_0x39045c){return this[_0x1899('0x25')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x3fa881,_0x39045c));};AGIChannel[_0x1899('0x24')]['sayDigits']=function(_0x599c7a,_0x81c10c){return this['sendRequest'](util[_0x1899('0x2e')](_0x1899('0x3c'),_0x599c7a,_0x81c10c));};AGIChannel[_0x1899('0x24')]['sayPhonetic']=function(_0x578f52,_0x1225a1){return this['sendRequest'](util['format'](_0x1899('0x3d'),_0x578f52,_0x1225a1));};AGIChannel[_0x1899('0x24')]['continueAt']=function(_0x425f64,_0x7b1ea7,_0x8da3ce){_0x7b1ea7=_0x7b1ea7||this['extension'];_0x8da3ce=_0x8da3ce||0x1;this[_0x1899('0x31')](_0x425f64);this['setExtension'](_0x7b1ea7);this[_0x1899('0x35')](_0x8da3ce);return this[_0x1899('0x3e')](util[_0x1899('0x2e')](_0x1899('0x3f'),_0x425f64,_0x7b1ea7,_0x8da3ce));};AGIChannel[_0x1899('0x24')][_0x1899('0x40')]=function(_0x3ef404){return this[_0x1899('0x25')](util[_0x1899('0x2e')](_0x1899('0x41'),_0x3ef404));};AGIChannel[_0x1899('0x24')][_0x1899('0x42')]=function(_0x5eeed2,_0x4db4f4,_0x201d6d,_0x3d8ff9,_0x2e1121,_0x5e3e61){_0x4db4f4=_0x4db4f4||_0x1899('0x43');_0x201d6d=_0x201d6d||'';_0x3d8ff9=_0x3d8ff9===undefined?-0x1:_0x3d8ff9==='-1'?-0x1:_0x3d8ff9*0x3e8;_0x2e1121=_0x2e1121===undefined?'':'s='+_0x2e1121;_0x5e3e61=_0x5e3e61?_0x1899('0x44'):'';return this[_0x1899('0x25')](util[_0x1899('0x2e')](_0x1899('0x45'),_0x5eeed2,_0x4db4f4,_0x201d6d,_0x3d8ff9,_0x5e3e61,_0x2e1121));};AGIChannel['prototype'][_0x1899('0x46')]=function(_0x209eb0,_0x482ac6){_0x482ac6=_0x482ac6||'';return this[_0x1899('0x25')](util[_0x1899('0x2e')](_0x1899('0x47'),_0x209eb0,_0x482ac6));};AGIChannel[_0x1899('0x24')][_0x1899('0x48')]=function(_0x1121fe){return this['exec'](_0x1899('0x49'),_0x1121fe);};AGIChannel[_0x1899('0x24')][_0x1899('0x4a')]=function(_0x5cfc50){return this[_0x1899('0x2d')](_0x1899('0x4b'),_0x5cfc50);};AGIChannel[_0x1899('0x24')][_0x1899('0x19')]=function(_0x55324c,_0xa733fb){this[_0x1899('0x3e')](util[_0x1899('0x2e')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x55324c['id'],_0x55324c[_0x1899('0x4c')],_0xa733fb));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1899('0x4d')]=AGIChannel; \ No newline at end of file +var _0x9c51=['timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','sync','sendRequest','ANSWER','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','EventEmitter','./reply','./error','setEncoding','utf8','headers','ready','line','hangup','substring','search','no\x20code','replace','indexOf','substr','startsWith','length','match','error','emit','E_AGI_SOCKET_ERROR','code','close'];(function(_0x4ee2c5,_0x28a0e3){var _0x2b23a7=function(_0x2f0e8c){while(--_0x2f0e8c){_0x4ee2c5['push'](_0x4ee2c5['shift']());}};_0x2b23a7(++_0x28a0e3);}(_0x9c51,0x13c));var _0x19c5=function(_0x120b78,_0x1b727){_0x120b78=_0x120b78-0x0;var _0x2483d8=_0x9c51[_0x120b78];return _0x2483d8;};'use strict';var util=require('util');var _=require(_0x19c5('0x0'));var EventEmitter=require('events')[_0x19c5('0x1')];var AGIReply=require(_0x19c5('0x2'));var AGIError=require(_0x19c5('0x3'));function AGIChannel(_0x485392){var _0x37ae46=this,_0x521694=new AGIReply(),_0x3e626e=![],_0x569d76={};EventEmitter['call'](_0x37ae46);_0x485392[_0x19c5('0x4')](_0x19c5('0x5'));_0x485392['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x521694[_0x19c5('0x4')]('utf8');_0x521694['on'](_0x19c5('0x6'),function(_0x4157fe){for(var _0x29d5df in _0x4157fe){_0x37ae46[_0x29d5df]=_0x4157fe[_0x29d5df];}_0x37ae46['emit'](_0x19c5('0x7'));});_0x521694['on'](_0x19c5('0x8'),function(_0x5994b5){if(_0x5994b5['toLowerCase']()==_0x19c5('0x9')){_0x37ae46['emit']('hangup');return;}if(_0x5994b5[_0x19c5('0xa')](0x0,0xb)=='520-Invalid'){_0x3e626e=!![];}if(_0x3e626e){_0x569d76['rx']+=_0x5994b5+'\x0a';if(_0x5994b5[_0x19c5('0xb')]('520\x20End\x20of\x20proper')!=-0x1){_0x3e626e=![];}}else{_0x569d76['rx']=_0x5994b5;}if(_0x3e626e){return;}if(typeof _0x569d76['cb']=='function'){var _0x2a36e1=_0x569d76['rx'][_0x19c5('0xa')](0x0,0x3),_0x9523b2=null,_0x5ac08f=null;_0x2a36e1=parseInt(_0x2a36e1);if(isNaN(_0x2a36e1)){_0x569d76['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x19c5('0xc')});return;}if(_0x2a36e1!=0xc8){_0x569d76['cb'](null,{'code':_0x2a36e1,'result':-0x1,'extra':'KO'});return;}_0x9523b2=_0x569d76['rx'][_0x19c5('0xa')](0x4)[_0x19c5('0xd')]('result=','');if(_0x9523b2[_0x19c5('0xe')]('\x20')!=-0x1){_0x9523b2=_0x9523b2[_0x19c5('0xf')](0x0,_0x9523b2['indexOf']('\x20'));}if(_[_0x19c5('0x10')](_0x9523b2,'-1')){_0x9523b2=parseInt(_0x9523b2);}_0x5ac08f=_0x569d76['rx']['split']('\x20');if(_0x5ac08f[_0x19c5('0x11')]==0x3){_0x5ac08f=_0x5ac08f[0x2][_0x19c5('0xa')](0x1,_0x5ac08f[0x2][_0x19c5('0x11')]-0x1);}else if(_0x5ac08f[_0x19c5('0x11')]>0x3){var _0x355ea3=/\((.+)\)/;var _0x2c9f3e=_0x569d76['rx'][_0x19c5('0x12')](_0x355ea3);if(_0x2c9f3e){_0x5ac08f=_0x2c9f3e[0x1];}else{_0x5ac08f=null;}}else{_0x5ac08f=null;}_0x569d76['cb'](null,{'code':_0x2a36e1,'result':_0x9523b2,'extra':_0x5ac08f});}});_0x485392['on'](_0x19c5('0x13'),function(_0x51d630){_0x37ae46[_0x19c5('0x14')](_0x19c5('0x13'),new AGIError(_0x19c5('0x15'),_0x51d630[_0x19c5('0x16')]));});_0x485392['on'](_0x19c5('0x17'),function(){_0x37ae46[_0x19c5('0x14')](_0x19c5('0x17'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x485392['on'](_0x19c5('0x18'),function(){_0x37ae46['emit']('timeout',new AGIError(_0x19c5('0x19')));_0x485392[_0x19c5('0x1a')]();});_0x485392['pipe'](_0x521694);this[_0x19c5('0x1b')]=function(_0x354855,_0x197dd3){var _0x354855=_0x354855||'',_0x197dd3=typeof _0x197dd3==_0x19c5('0x1c')?_0x197dd3:new Function();_0x569d76={'tx':_0x354855,'rx':'','cb':_0x197dd3};_0x485392[_0x19c5('0x1d')](_0x354855+'\x0a');},this[_0x19c5('0x17')]=function(){_0x485392['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0xd78ec){return this['command'][_0x19c5('0x1e')](this,_0xd78ec);};AGIChannel['prototype']['answer']=function(){return this[_0x19c5('0x1f')](_0x19c5('0x20'));};AGIChannel[_0x19c5('0x21')][_0x19c5('0x22')]=function(_0x268aac,_0xbb7662,_0x1cf4b0){_0x268aac=_0x268aac===undefined?_0x19c5('0x23'):_0x268aac;_0xbb7662=_0xbb7662===undefined?'5':_0xbb7662;_0x1cf4b0=_0x1cf4b0===undefined?'1':_0x1cf4b0;return this[_0x19c5('0x1f')](util[_0x19c5('0x24')](_0x19c5('0x25'),_0x268aac,_0xbb7662*0x3e8,_0x1cf4b0));};AGIChannel[_0x19c5('0x21')][_0x19c5('0x26')]=function(_0x1bf443){_0x1bf443=_0x1bf443||'NO\x20MESSAGE';return this['sendRequest'](util[_0x19c5('0x24')](_0x19c5('0x27'),_0x1bf443));};AGIChannel['prototype'][_0x19c5('0x28')]=function(_0x497529,_0x3a526d){if(_[_0x19c5('0x29')](_0x3a526d)){return this[_0x19c5('0x1f')](util['format'](_0x19c5('0x2a'),_0x497529,_0x3a526d[_0x19c5('0x2b')](',')));}return this[_0x19c5('0x1f')](util[_0x19c5('0x24')](_0x19c5('0x2a'),_0x497529,_0x3a526d));};AGIChannel[_0x19c5('0x21')][_0x19c5('0x2c')]=function(_0x43ad09){return this['sendRequest'](util['format'](_0x19c5('0x2d'),_0x43ad09));};AGIChannel[_0x19c5('0x21')][_0x19c5('0x2e')]=function(_0x447152){return this[_0x19c5('0x1f')](util[_0x19c5('0x24')](_0x19c5('0x2f'),_0x447152));};AGIChannel['prototype'][_0x19c5('0x30')]=function(_0x5082d4){return this[_0x19c5('0x1f')](util[_0x19c5('0x24')](_0x19c5('0x31'),_0x5082d4));};AGIChannel['prototype'][_0x19c5('0x9')]=function(){return this['sendRequest'](_0x19c5('0x32'));};AGIChannel[_0x19c5('0x21')][_0x19c5('0x33')]=function(_0x43f47e,_0x1be924){var _0x89274d=_[_0x19c5('0x34')](_0x1be924)||_[_0x19c5('0x35')](_0x1be924)?_0x1be924['toString']():_0x1be924;return this[_0x19c5('0x1f')](util[_0x19c5('0x24')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x43f47e,_0x89274d?_0x89274d[_0x19c5('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x19c5('0x21')]['sayNumber']=function(_0x3fe507,_0x4d268b){return this['sendRequest'](util[_0x19c5('0x24')](_0x19c5('0x37'),_0x3fe507,_0x4d268b));};AGIChannel[_0x19c5('0x21')]['sayDigits']=function(_0x5bba61,_0x567c4b){return this[_0x19c5('0x1f')](util[_0x19c5('0x24')](_0x19c5('0x38'),_0x5bba61,_0x567c4b));};AGIChannel[_0x19c5('0x21')]['sayPhonetic']=function(_0x10f5fa,_0x33eb07){return this[_0x19c5('0x1f')](util[_0x19c5('0x24')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x10f5fa,_0x33eb07));};AGIChannel[_0x19c5('0x21')]['continueAt']=function(_0x378fa8,_0x307fe0,_0x122b85){_0x307fe0=_0x307fe0||this[_0x19c5('0x39')];_0x122b85=_0x122b85||0x1;this[_0x19c5('0x2c')](_0x378fa8);this[_0x19c5('0x2e')](_0x307fe0);this['setPriority'](_0x122b85);return this[_0x19c5('0x26')](util[_0x19c5('0x24')]('GOTO\x20%s\x20%s\x20%s',_0x378fa8,_0x307fe0,_0x122b85));};AGIChannel[_0x19c5('0x21')][_0x19c5('0x3a')]=function(_0x16823b){return this[_0x19c5('0x1f')](util[_0x19c5('0x24')](_0x19c5('0x3b'),_0x16823b));};AGIChannel[_0x19c5('0x21')]['recordFile']=function(_0x1a7354,_0x1e5278,_0x1b385c,_0x26d4f4,_0x3b26cf,_0x4ec4c9){_0x1e5278=_0x1e5278||'wav';_0x1b385c=_0x1b385c||'';_0x26d4f4=_0x26d4f4===undefined?-0x1:_0x26d4f4==='-1'?-0x1:_0x26d4f4*0x3e8;_0x3b26cf=_0x3b26cf===undefined?'':'s='+_0x3b26cf;_0x4ec4c9=_0x4ec4c9?_0x19c5('0x3c'):'';return this[_0x19c5('0x1f')](util[_0x19c5('0x24')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1a7354,_0x1e5278,_0x1b385c,_0x26d4f4,_0x4ec4c9,_0x3b26cf));};AGIChannel[_0x19c5('0x21')][_0x19c5('0x3d')]=function(_0x5cc486,_0x1efbbd){_0x1efbbd=_0x1efbbd||'';return this[_0x19c5('0x1f')](util[_0x19c5('0x24')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5cc486,_0x1efbbd));};AGIChannel[_0x19c5('0x21')][_0x19c5('0x3e')]=function(_0x5d946b){return this[_0x19c5('0x28')](_0x19c5('0x3f'),_0x5d946b);};AGIChannel[_0x19c5('0x21')][_0x19c5('0x40')]=function(_0xdc9529){return this[_0x19c5('0x28')](_0x19c5('0x41'),_0xdc9529);};AGIChannel[_0x19c5('0x21')][_0x19c5('0x13')]=function(_0x2a220b,_0x21dee0){this['noop'](util['format'](_0x19c5('0x42'),_0x2a220b['id'],_0x2a220b['label'],_0x21dee0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x19c5('0x43')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 35cf36e..98545c0 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 _0xe7e1=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x5c0dcb,_0x16cd83){var _0x183a0e=function(_0xfb292d){while(--_0xfb292d){_0x5c0dcb['push'](_0x5c0dcb['shift']());}};_0x183a0e(++_0x16cd83);}(_0xe7e1,0x1e5));var _0x1e7e=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xe7e1[_0x31a371];return _0x2a5bd6;};'use strict';var util=require(_0x1e7e('0x0'));var error={'E_AGI_UNDEFINED':_0x1e7e('0x1'),'E_AGI_ARGUMENT_PORT':_0x1e7e('0x2'),'E_AGI_SERVER_ERROR':_0x1e7e('0x3'),'E_AGI_SERVER_CLOSE':_0x1e7e('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x1e7e('0x5'),'E_AGI_SOCKET_ERROR':_0x1e7e('0x6'),'E_AGI_SOCKET_CLOSE':_0x1e7e('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x1e7e('0x8'),'E_AGI_COMMAND_EMPTY':_0x1e7e('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1e7e('0xa'),'E_AGI_IVR_ENTRY':_0x1e7e('0xb')};function AGIError(_0x43f0ae){var _0x43f0ae=_0x43f0ae||null,_0x3f3a64=_0x3f3a64||[],_0x656e56=0x1,_0x401b41='';if(!error[_0x43f0ae]){_0x43f0ae=_0x1e7e('0xc');}_0x3f3a64[_0x1e7e('0xd')](error[_0x43f0ae]);while(arguments[_0x656e56]){_0x3f3a64['push'](arguments[_0x656e56]);_0x656e56++;}_0x401b41=util[_0x1e7e('0xe')][_0x1e7e('0xf')](util,_0x3f3a64);this[_0x1e7e('0x10')]=_0x401b41;this['name']=_0x43f0ae;}module['exports']=AGIError; \ No newline at end of file +var _0x2d83=['Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name','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.','Socket\x20closed.'];(function(_0x107f87,_0x2fc1b3){var _0x1a18fe=function(_0x4d737c){while(--_0x4d737c){_0x107f87['push'](_0x107f87['shift']());}};_0x1a18fe(++_0x2fc1b3);}(_0x2d83,0x70));var _0x32d8=function(_0x1c8cfd,_0x18fc8a){_0x1c8cfd=_0x1c8cfd-0x0;var _0x532e84=_0x2d83[_0x1c8cfd];return _0x532e84;};'use strict';var util=require(_0x32d8('0x0'));var error={'E_AGI_UNDEFINED':_0x32d8('0x1'),'E_AGI_ARGUMENT_PORT':_0x32d8('0x2'),'E_AGI_SERVER_ERROR':_0x32d8('0x3'),'E_AGI_SERVER_CLOSE':_0x32d8('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x32d8('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x32d8('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x32d8('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x32d8('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x32d8('0x9')};function AGIError(_0x445422){var _0x445422=_0x445422||null,_0x20c4b4=_0x20c4b4||[],_0x376558=0x1,_0x5f41e4='';if(!error[_0x445422]){_0x445422=_0x32d8('0xa');}_0x20c4b4[_0x32d8('0xb')](error[_0x445422]);while(arguments[_0x376558]){_0x20c4b4[_0x32d8('0xb')](arguments[_0x376558]);_0x376558++;}_0x5f41e4=util[_0x32d8('0xc')]['apply'](util,_0x20c4b4);this['message']=_0x5f41e4;this[_0x32d8('0xd')]=_0x445422;}module[_0x32d8('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index e3d29ef..fa5c865 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 _0x4d5e=['redis','subscribe','agi','emit','error','message','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','defaults'];(function(_0x33325a,_0x52fbb4){var _0x39d467=function(_0x336bbc){while(--_0x336bbc){_0x33325a['push'](_0x33325a['shift']());}};_0x39d467(++_0x52fbb4);}(_0x4d5e,0x89));var _0xe4d5=function(_0x3e636e,_0xc10fe9){_0x3e636e=_0x3e636e-0x0;var _0x12cac6=_0x4d5e[_0x3e636e];return _0x12cac6;};'use strict';var _=require(_0xe4d5('0x0'));var EventEmitter=require(_0xe4d5('0x1'))[_0xe4d5('0x2')];var Redis=require(_0xe4d5('0x3'));var AGIError=require(_0xe4d5('0x4'));var config=require(_0xe4d5('0x5'));config['redis']=_[_0xe4d5('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe4d5('0x7')]);sub[_0xe4d5('0x8')](_0xe4d5('0x9'),function(_0x42da35){if(_0x42da35)return eventEmitter[_0xe4d5('0xa')](_0xe4d5('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x42da35));});sub['on'](_0xe4d5('0xc'),function(_0x1e358,_0x265dac){if(_0x1e358!=='agi')return;try{var _0xa05d49=JSON['parse'](_0x265dac);eventEmitter[_0xe4d5('0xa')](_0xe4d5('0xd'),_0xa05d49);}catch(_0x325913){eventEmitter['emit']('error',new AGIError(_0xe4d5('0xe'),_0x325913));}});module[_0xe4d5('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xde87=['message','parse','projectUpdate','exports','events','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','E_AGI_SERVER_ERROR'];(function(_0x3b5700,_0x5c0ffb){var _0x47a764=function(_0x19d9e2){while(--_0x19d9e2){_0x3b5700['push'](_0x3b5700['shift']());}};_0x47a764(++_0x5c0ffb);}(_0xde87,0x112));var _0x7de8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde87[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var EventEmitter=require(_0x7de8('0x0'))['EventEmitter'];var Redis=require(_0x7de8('0x1'));var AGIError=require(_0x7de8('0x2'));var config=require(_0x7de8('0x3'));config[_0x7de8('0x4')]=_[_0x7de8('0x5')](config[_0x7de8('0x4')],{'host':_0x7de8('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x7de8('0x4')]);sub[_0x7de8('0x7')](_0x7de8('0x8'),function(_0x523630){if(_0x523630)return eventEmitter[_0x7de8('0x9')]('error',new AGIError(_0x7de8('0xa'),_0x523630));});sub['on'](_0x7de8('0xb'),function(_0x58c09b,_0xc56c40){if(_0x58c09b!=='agi')return;try{var _0x5e4d0c=JSON[_0x7de8('0xc')](_0xc56c40);eventEmitter[_0x7de8('0x9')](_0x7de8('0xd'),_0x5e4d0c);}catch(_0x38b195){eventEmitter[_0x7de8('0x9')]('error',new AGIError(_0x7de8('0xa'),_0x38b195));}});module[_0x7de8('0xe')]={'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 208b982..45fd5a9 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 _0xbb59=['edges','numberOfEdges','addVertex','prototype','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','agicommand','target','default','invalid','vswitch','default\x20on\x20switch\x20not\x20found','exports','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices'];(function(_0x3e3f3f,_0x40b1f3){var _0x48cbc9=function(_0x631150){while(--_0x631150){_0x3e3f3f['push'](_0x3e3f3f['shift']());}};_0x48cbc9(++_0x40b1f3);}(_0xbb59,0x19a));var _0x9bb5=function(_0x3bf7a9,_0x120fd7){_0x3bf7a9=_0x3bf7a9-0x0;var _0x5ce997=_0xbb59[_0x3bf7a9];return _0x5ce997;};'use strict';var _=require('lodash');var logger=require(_0x9bb5('0x0'))(_0x9bb5('0x1'));var verticesWithRetry=[_0x9bb5('0x2'),_0x9bb5('0x3'),_0x9bb5('0x4')];var Graph=function(){this[_0x9bb5('0x5')]={};this[_0x9bb5('0x6')]={};this[_0x9bb5('0x7')]=0x0;};Graph['prototype'][_0x9bb5('0x8')]=function(_0x26c385){this[_0x9bb5('0x5')][_0x26c385['id']]=_0x26c385;this[_0x9bb5('0x6')][_0x26c385['id']]=[];};Graph[_0x9bb5('0x9')]['addEdge']=function(_0x32f72b,_0x4d58b3,_0x381753){this['edges'][_0x32f72b]['push']({'target':_0x4d58b3,'condition':_0x381753});this['numberOfEdges']+=0x1;};Graph[_0x9bb5('0x9')][_0x9bb5('0xa')]=function(){return _['size'](this[_0x9bb5('0x5')]);};Graph[_0x9bb5('0x9')][_0x9bb5('0xb')]=function(){return this['numberOfEdges'];};Graph[_0x9bb5('0x9')][_0x9bb5('0xc')]=function(_0x4e5b54){return this[_0x9bb5('0x5')][_0x4e5b54];};Graph[_0x9bb5('0x9')][_0x9bb5('0xd')]=function(_0x3e44da,_0x4422ea){if(!this[_0x9bb5('0x5')][_0x3e44da]){return logger[_0x9bb5('0xe')](_0x9bb5('0xf'));}var _0x5718fd=_0x4422ea(this[_0x9bb5('0x5')][_0x3e44da]);if(!_0x5718fd){return logger[_0x9bb5('0xe')](_0x9bb5('0x10'));}if(this[_0x9bb5('0x6')][_0x3e44da]['length']===0x0){return logger[_0x9bb5('0xe')]('no\x20edge/s\x20available');}for(var _0x3a5639=0x0,_0xa1f932=[],_0x187dcf=![];_0x3a5639\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','agi_','substring','variables','dnid','close','timeout','find','production','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','[LICENSE]','./server','listening','connection','syncho'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde77,0xa4));var _0x7de7=function(_0x2151a3,_0x133988){_0x2151a3=_0x2151a3-0x0;var _0x3706bb=_0xde77[_0x2151a3];return _0x3706bb;};'use strict';var _=require('lodash');var syncho=require(_0x7de7('0x0'));var util=require(_0x7de7('0x1'));var config=require('../../config/environment');var logger=require(_0x7de7('0x2'))(_0x7de7('0x3'));var utilLicense=require(_0x7de7('0x4'));var rpc=require('./rpc');var Project=require(_0x7de7('0x5'));var AGIEmitter=require(_0x7de7('0x6'))[_0x7de7('0x7')];var projects=[];config[_0x7de7('0x3')]=_[_0x7de7('0x8')](config[_0x7de7('0x3')],{'ip':_0x7de7('0x9'),'port':0x11dd});AGIEmitter['on'](_0x7de7('0xa'),projectUpdateHandler);function connectionHandler(_0x517973){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x517973);agiHandler(_0x517973);}catch(_0x33eb03){logger[_0x7de7('0xb')](_0x33eb03[_0x7de7('0xc')]);}});});}function projectUpdateHandler(_0x2941d7){try{var _0x6a0018=_[_0x7de7('0xd')](projects,['id',_0x2941d7['id']]);if(_0x6a0018>-0x1){if(_0x2941d7[_0x7de7('0xe')]===!![]){projects[_0x7de7('0xf')](_0x6a0018,0x1);}else{projects[_0x6a0018]=_0x2941d7;}}else{projects[_0x7de7('0x10')](_0x2941d7);}}catch(_0x328d5f){logger['error'](_0x328d5f['stack']);}}function listeningHandler(){console[_0x7de7('0x11')](_0x7de7('0x12'),config[_0x7de7('0x3')][_0x7de7('0x13')]);logger[_0x7de7('0x14')](util[_0x7de7('0x15')](_0x7de7('0x16'),config[_0x7de7('0x3')]['ip'],config[_0x7de7('0x3')][_0x7de7('0x13')]));}function errorHandler(_0x1ba07c){if(_0x1ba07c&&_0x1ba07c['name']&&_0x1ba07c[_0x7de7('0x17')]){logger['error'](util[_0x7de7('0x15')]('[%s]\x20%s',_0x1ba07c[_0x7de7('0x18')],_0x1ba07c[_0x7de7('0x17')]));}else{logger[_0x7de7('0xb')](util[_0x7de7('0x15')]('[ERROR]\x20%s',_0x1ba07c[_0x7de7('0xc')]));}}function closeHandler(){logger['info'](util[_0x7de7('0x15')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7de7('0x19')],this['calleridname'],this[_0x7de7('0x1a')],this['dnid'],this[_0x7de7('0x1b')]));try{createSquareReport(this);}catch(_0x393561){logger['error'](_0x393561['stack']);}}function timeoutHandler(){logger[_0x7de7('0x14')](util[_0x7de7('0x15')](_0x7de7('0x1c'),this['arg_1'],this[_0x7de7('0x1d')],this[_0x7de7('0x1a')],this['dnid'],this[_0x7de7('0x1b')]));}function hangupHandler(){logger[_0x7de7('0x14')](util[_0x7de7('0x15')](_0x7de7('0x1e'),this[_0x7de7('0x19')],this[_0x7de7('0x1d')],this[_0x7de7('0x1a')],this['dnid'],this[_0x7de7('0x1b')]));this[_0x7de7('0x1f')]=!![];}function createSquareReport(_0x2b2339,_0x84d7af){rpc[_0x7de7('0x20')](_0x2b2339)['then'](function(_0x14f5d6){if(_0x84d7af){_0x84d7af(null,_0x14f5d6);}})[_0x7de7('0x21')](function(_0x3f724f){if(_0x84d7af){_0x84d7af(null,_0x3f724f);}});}function setChannelVariables(_0x27e72d){for(var _0x5b9770 in _0x27e72d){if(_0x27e72d[_0x7de7('0x22')](_0x5b9770)){if(_0x5b9770['indexOf'](_0x7de7('0x23'))===0x0){_0x27e72d[_0x5b9770[_0x7de7('0x24')](0x4)]=_0x27e72d[_0x5b9770];delete _0x27e72d[_0x5b9770];}}}}function agiHandler(_0x49d077){logger['debug'](_0x7de7('0x25'),JSON['stringify'](_0x49d077,null,0x2));logger[_0x7de7('0x14')](util[_0x7de7('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x49d077[_0x7de7('0x19')],_0x49d077[_0x7de7('0x1d')],_0x49d077[_0x7de7('0x1a')],_0x49d077[_0x7de7('0x26')],_0x49d077[_0x7de7('0x1b')]));_0x49d077['on'](_0x7de7('0xb'),errorHandler);_0x49d077['on'](_0x7de7('0x27'),closeHandler);_0x49d077['on'](_0x7de7('0x28'),timeoutHandler);_0x49d077[_0x7de7('0x1f')]=![];_0x49d077['on']('hangup',hangupHandler);var _0x5dce02=_[_0x7de7('0x29')](projects,[_0x7de7('0x18'),_0x49d077[_0x7de7('0x19')]]);if(!_0x5dce02)return Project['handleNotFound'](_0x49d077);if(!_0x5dce02[_0x7de7('0x2a')])return Project['handleUnpublished'](_0x49d077);return Project['initialize'](_0x5dce02,_0x49d077);}function main(){var _0x1f01da;return utilLicense[_0x7de7('0x2b')]()['then'](function(_0x5cdbb6){if(!_0x5cdbb6)return;if(_0x5cdbb6[_0x7de7('0x2c')]){if(_0x5cdbb6[_0x7de7('0x2d')]&&_0x5cdbb6[_0x7de7('0x2d')]>0x0){logger[_0x7de7('0x14')](util[_0x7de7('0x15')](_0x7de7('0x2e'),_0x5cdbb6['callysquare']));_0x1f01da=_0x5cdbb6[_0x7de7('0x2d')];}else{logger[_0x7de7('0x14')](_0x7de7('0x2f'));}}else{logger[_0x7de7('0x14')](_0x7de7('0x30'));_0x1f01da=-0x1;}})[_0x7de7('0x31')](function(){return Project[_0x7de7('0x32')]();})['then'](function(_0x43eaf8){projects=_0x43eaf8;return;})['catch'](function(_0x52d850){logger[_0x7de7('0xb')](_0x7de7('0x33'),_0x52d850[_0x7de7('0xc')]);})['finally'](function(){var _0x20cd8a=require(_0x7de7('0x34'))(config[_0x7de7('0x3')][_0x7de7('0x13')],config[_0x7de7('0x3')]['ip'],_0x1f01da);_0x20cd8a['on']('error',errorHandler);_0x20cd8a['on'](_0x7de7('0x35'),listeningHandler);_0x20cd8a['on'](_0x7de7('0x36'),connectionHandler);_0x20cd8a['on'](_0x7de7('0x27'),closeHandler);});}main(); \ No newline at end of file +var _0x8dc7=['lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','message','format','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','agi_','debug','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','production','handleUnpublished','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection'];(function(_0x5154ad,_0x58eaa8){var _0x10a840=function(_0x4e36ef){while(--_0x4e36ef){_0x5154ad['push'](_0x5154ad['shift']());}};_0x10a840(++_0x58eaa8);}(_0x8dc7,0xb4));var _0x78dc=function(_0x100dea,_0x51764d){_0x100dea=_0x100dea-0x0;var _0x3a85ee=_0x8dc7[_0x100dea];return _0x3a85ee;};'use strict';var _=require(_0x78dc('0x0'));var syncho=require(_0x78dc('0x1'));var util=require(_0x78dc('0x2'));var config=require(_0x78dc('0x3'));var logger=require(_0x78dc('0x4'))(_0x78dc('0x5'));var utilLicense=require(_0x78dc('0x6'));var rpc=require(_0x78dc('0x7'));var Project=require(_0x78dc('0x8'));var AGIEmitter=require(_0x78dc('0x9'))[_0x78dc('0xa')];var projects=[];config[_0x78dc('0x5')]=_[_0x78dc('0xb')](config[_0x78dc('0x5')],{'ip':_0x78dc('0xc'),'port':0x11dd});AGIEmitter['on'](_0x78dc('0xd'),projectUpdateHandler);function connectionHandler(_0x930781){process[_0x78dc('0xe')](function(){syncho(function(){try{setChannelVariables(_0x930781);agiHandler(_0x930781);}catch(_0x4f9413){logger[_0x78dc('0xf')](_0x4f9413[_0x78dc('0x10')]);}});});}function projectUpdateHandler(_0x57829e){try{var _0x288c69=_[_0x78dc('0x11')](projects,['id',_0x57829e['id']]);if(_0x288c69>-0x1){if(_0x57829e[_0x78dc('0x12')]===!![]){projects['splice'](_0x288c69,0x1);}else{projects[_0x288c69]=_0x57829e;}}else{projects[_0x78dc('0x13')](_0x57829e);}}catch(_0x349abe){logger[_0x78dc('0xf')](_0x349abe['stack']);}}function listeningHandler(){console[_0x78dc('0x14')](_0x78dc('0x15'),config[_0x78dc('0x5')][_0x78dc('0x16')]);logger[_0x78dc('0x17')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x78dc('0x5')]['ip'],config[_0x78dc('0x5')]['port']));}function errorHandler(_0x1b3ba9){if(_0x1b3ba9&&_0x1b3ba9[_0x78dc('0x18')]&&_0x1b3ba9[_0x78dc('0x19')]){logger['error'](util[_0x78dc('0x1a')](_0x78dc('0x1b'),_0x1b3ba9['name'],_0x1b3ba9[_0x78dc('0x19')]));}else{logger['error'](util[_0x78dc('0x1a')](_0x78dc('0x1c'),_0x1b3ba9[_0x78dc('0x10')]));}}function closeHandler(){logger[_0x78dc('0x17')](util[_0x78dc('0x1a')](_0x78dc('0x1d'),this[_0x78dc('0x1e')],this[_0x78dc('0x1f')],this[_0x78dc('0x20')],this[_0x78dc('0x21')],this['uniqueid']));try{createSquareReport(this);}catch(_0x48b4e4){logger[_0x78dc('0xf')](_0x48b4e4[_0x78dc('0x10')]);}}function timeoutHandler(){logger['info'](util['format'](_0x78dc('0x22'),this[_0x78dc('0x1e')],this['calleridname'],this[_0x78dc('0x20')],this[_0x78dc('0x21')],this[_0x78dc('0x23')]));}function hangupHandler(){logger[_0x78dc('0x17')](util[_0x78dc('0x1a')](_0x78dc('0x24'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x78dc('0x21')],this[_0x78dc('0x23')]));this[_0x78dc('0x25')]=!![];}function createSquareReport(_0x44ba24,_0x59af0d){rpc['createSquareReport'](_0x44ba24)[_0x78dc('0x26')](function(_0x1df1f9){if(_0x59af0d){_0x59af0d(null,_0x1df1f9);}})[_0x78dc('0x27')](function(_0x3ff301){if(_0x59af0d){_0x59af0d(null,_0x3ff301);}});}function setChannelVariables(_0xa19947){for(var _0x211548 in _0xa19947){if(_0xa19947[_0x78dc('0x28')](_0x211548)){if(_0x211548[_0x78dc('0x29')](_0x78dc('0x2a'))===0x0){_0xa19947[_0x211548['substring'](0x4)]=_0xa19947[_0x211548];delete _0xa19947[_0x211548];}}}}function agiHandler(_0x57b0c6){logger[_0x78dc('0x2b')]('variables',JSON[_0x78dc('0x2c')](_0x57b0c6,null,0x2));logger[_0x78dc('0x17')](util[_0x78dc('0x1a')](_0x78dc('0x2d'),_0x57b0c6['arg_1'],_0x57b0c6[_0x78dc('0x1f')],_0x57b0c6[_0x78dc('0x20')],_0x57b0c6[_0x78dc('0x21')],_0x57b0c6[_0x78dc('0x23')]));_0x57b0c6['on']('error',errorHandler);_0x57b0c6['on'](_0x78dc('0x2e'),closeHandler);_0x57b0c6['on'](_0x78dc('0x2f'),timeoutHandler);_0x57b0c6[_0x78dc('0x25')]=![];_0x57b0c6['on'](_0x78dc('0x30'),hangupHandler);var _0xed6a13=_[_0x78dc('0x31')](projects,[_0x78dc('0x18'),_0x57b0c6['arg_1']]);if(!_0xed6a13)return Project[_0x78dc('0x32')](_0x57b0c6);if(!_0xed6a13[_0x78dc('0x33')])return Project[_0x78dc('0x34')](_0x57b0c6);return Project['initialize'](_0xed6a13,_0x57b0c6);}function main(){var _0x142382;return utilLicense['getLicense']()[_0x78dc('0x26')](function(_0x4feec2){if(!_0x4feec2)return;if(_0x4feec2['voice']){if(_0x4feec2['callysquare']&&_0x4feec2[_0x78dc('0x35')]>0x0){logger['info'](util[_0x78dc('0x1a')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4feec2['callysquare']));_0x142382=_0x4feec2[_0x78dc('0x35')];}else{logger['info'](_0x78dc('0x36'));}}else{logger['info'](_0x78dc('0x37'));_0x142382=-0x1;}})[_0x78dc('0x26')](function(){return Project['getAll']();})[_0x78dc('0x26')](function(_0x18e2cc){projects=_0x18e2cc;return;})[_0x78dc('0x27')](function(_0x304bbd){logger[_0x78dc('0xf')](_0x78dc('0x38'),_0x304bbd['stack']);})['finally'](function(){var _0x4afc17=require(_0x78dc('0x39'))(config[_0x78dc('0x5')][_0x78dc('0x16')],config[_0x78dc('0x5')]['ip'],_0x142382);_0x4afc17['on']('error',errorHandler);_0x4afc17['on'](_0x78dc('0x3a'),listeningHandler);_0x4afc17['on'](_0x78dc('0x3b'),connectionHandler);_0x4afc17['on'](_0x78dc('0x2e'),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 6da2c74..58e6ad6 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 _0xdc86=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request','then','error'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xdc86,0xc0));var _0x6dc8=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xdc86[_0x178e48];return _0x440d7e;};'use strict';var BPromise=require(_0x6dc8('0x0'));var jayson=require(_0x6dc8('0x1'));var client=jayson['client'][_0x6dc8('0x2')]({'port':0x232b});function request(_0x256726,_0x5b9039){return new BPromise(function(_0x22ae65,_0x22a4a0){return client[_0x6dc8('0x3')](_0x256726,_0x5b9039)[_0x6dc8('0x4')](function(_0x202770){if(_0x202770[_0x6dc8('0x5')]){return _0x22a4a0(_0x202770[_0x6dc8('0x5')][_0x6dc8('0x6')]);}else{return _0x22ae65(_0x202770[_0x6dc8('0x7')]);}})[_0x6dc8('0x8')](function(_0x126d17){return _0x22a4a0(_0x126d17);});});}exports[_0x6dc8('0x9')]=function(_0x3fbe1e,_0x42fcec){return request(_0x6dc8('0xa'),{'account':_0x3fbe1e,'message':_0x42fcec});}; \ No newline at end of file +var _0xf5ff=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','then','error','message'];(function(_0x20d498,_0x1161ec){var _0x13e0bf=function(_0x1fca58){while(--_0x1fca58){_0x20d498['push'](_0x20d498['shift']());}};_0x13e0bf(++_0x1161ec);}(_0xf5ff,0x176));var _0xff5f=function(_0x1a3b60,_0x1bfc60){_0x1a3b60=_0x1a3b60-0x0;var _0x4bd7a2=_0xf5ff[_0x1a3b60];return _0x4bd7a2;};'use strict';var BPromise=require(_0xff5f('0x0'));var jayson=require(_0xff5f('0x1'));var client=jayson[_0xff5f('0x2')]['http']({'port':0x232b});function request(_0xd95440,_0x4bddd5){return new BPromise(function(_0x5bd8ff,_0x4c6ab0){return client['request'](_0xd95440,_0x4bddd5)[_0xff5f('0x3')](function(_0x53a7e7){if(_0x53a7e7[_0xff5f('0x4')]){return _0x4c6ab0(_0x53a7e7[_0xff5f('0x4')][_0xff5f('0x5')]);}else{return _0x5bd8ff(_0x53a7e7[_0xff5f('0x6')]);}})[_0xff5f('0x7')](function(_0x3cccae){return _0x4c6ab0(_0x3cccae);});});}exports[_0xff5f('0x8')]=function(_0x274a89,_0x24cfa7){return request(_0xff5f('0x9'),{'account':_0x274a89,'message':_0x24cfa7});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 6824616..e4bdcb7 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 _0xf24d=['format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','[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\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','hasOwnProperty','isArray','length','source','target','addEdge','inspect','start','debug','stringify','joinAt'];(function(_0x2daab7,_0x377337){var _0x1714da=function(_0x1f6a60){while(--_0x1f6a60){_0x2daab7['push'](_0x2daab7['shift']());}};_0x1714da(++_0x377337);}(_0xf24d,0x182));var _0xdf24=function(_0x13b0bd,_0x4a7ac5){_0x13b0bd=_0x13b0bd-0x0;var _0x16f517=_0xf24d[_0x13b0bd];return _0x16f517;};'use strict';var _=require(_0xdf24('0x0'));var moment=require(_0xdf24('0x1'));var parser=require(_0xdf24('0x2'));var util=require(_0xdf24('0x3'));var logger=require(_0xdf24('0x4'))(_0xdf24('0x5'));var rpc=require(_0xdf24('0x6'));var mailRpc=require(_0xdf24('0x7'));var Graph=require('./graph');var Vertices=require(_0xdf24('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xdf24('0x9')](function(_0x526580){logger[_0xdf24('0xa')](_0xdf24('0xb'),_0x526580[_0xdf24('0xc')]);return[];});}function addVertex(_0x2de5e5,_0x29302f,_0x4c7a4c){_0x29302f[_0xdf24('0xd')]=_0x4c7a4c;if(_0x29302f['hasOwnProperty'](_0xdf24('0xe'))){_0x29302f['maxRetry']=parseInt(_0x29302f[_0xdf24('0xe')],0xa);}_0x2de5e5[_0xdf24('0xf')](_['omit'](_0x29302f,'mxCell'));}function initGraph(_0x59c732,_0x27f146){var _0x29edfc=new Graph();for(var _0x2b2796 in _0x59c732){if(_0x59c732[_0xdf24('0x10')](_0x2b2796)){if(_[_0xdf24('0x11')](_0x59c732[_0x2b2796])){for(var _0x4c1e7c=0x0;_0x4c1e7c<_0x59c732[_0x2b2796][_0xdf24('0x12')];_0x4c1e7c+=0x1){addVertex(_0x29edfc,_0x59c732[_0x2b2796][_0x4c1e7c],_0x2b2796);}}else{addVertex(_0x29edfc,_0x59c732[_0x2b2796],_0x2b2796);}}}for(var _0x21e006=0x0;_0x21e006<_0x27f146[_0xdf24('0x12')];_0x21e006+=0x1){if(_0x27f146[_0x21e006][_0xdf24('0x13')]&&_0x27f146[_0x21e006][_0xdf24('0x14')]){_0x29edfc[_0xdf24('0x15')](_0x27f146[_0x21e006]['source'],_0x27f146[_0x21e006]['target'],_0x27f146[_0x21e006]['value']);}}return _0x29edfc;}function getRoot(_0x2648c5){return parser['toJson'](_0x2648c5,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x5a0139){return util[_0xdf24('0x16')](_0x5a0139,{'showHidden':![],'depth':null});}function initialize(_0x51cff6,_0x3c1d73){var _0x4410b9=getRoot(_0x51cff6['production']);if(!_0x4410b9||!_0x4410b9[_0xdf24('0x17')])return;var _0x2cc37f,_0x1647e8,_0x33f379;logger[_0xdf24('0x18')]('root',JSON[_0xdf24('0x19')](_0x4410b9,null,0x2));_0x3c1d73[_0xdf24('0x1a')]=moment()[_0xdf24('0x1b')](_0xdf24('0x1c'));_0x2cc37f=initGraph(_[_0xdf24('0x1d')](_0x4410b9,_0xdf24('0x1e')),_0x4410b9[_0xdf24('0x1e')]);_0x1647e8=new Vertices(_0x3c1d73,rpc,mailRpc);logger[_0xdf24('0x1f')](util[_0xdf24('0x1b')](_0xdf24('0x20'),_0x3c1d73[_0xdf24('0x21')],_0x3c1d73[_0xdf24('0x22')],_0x3c1d73[_0xdf24('0x23')],_0x3c1d73[_0xdf24('0x24')],_0x3c1d73[_0xdf24('0x25')]));_0x2cc37f[_0xdf24('0x26')](_0x4410b9['start']['id'],function(_0x223a67){try{_0x223a67=_0x1647e8['clear'](_0x223a67);logger[_0xdf24('0x18')](_0xdf24('0x27'),JSON['stringify'](_0x223a67,null,0x2));if(_0x223a67[_0xdf24('0xd')]===_0xdf24('0x28')){logger[_0xdf24('0x1f')](_0xdf24('0x29'));_0x3c1d73['context']=_0x223a67[_0xdf24('0x2a')]||_0x3c1d73['context'];_0x3c1d73[_0xdf24('0x2b')]=_0x223a67['extension'];_0x3c1d73['priority']=_0x223a67['priority']?_0x223a67[_0xdf24('0x2c')]-0x1:0x1;return null;}else if(_0x223a67&&_0x1647e8[_0x223a67[_0xdf24('0xd')]]){_0x33f379=_0x1647e8[_0x223a67[_0xdf24('0xd')]](_0x223a67);logger[_0xdf24('0x1f')](_0xdf24('0x2d'),JSON[_0xdf24('0x19')](_0x33f379,null,0x2));if(_0x33f379&&_0x33f379[_0xdf24('0x2e')]===AGI_CODE_SUCCESS&&_0x33f379[_0xdf24('0x2f')]!==AGI_RESULT_ERROR&&!_0x3c1d73['evtHangup']){logger[_0xdf24('0x18')](_0xdf24('0x2d'),inspect(_0x33f379));return _[_0xdf24('0x30')](_0x33f379['result'])?null:_0x33f379[_0xdf24('0x2f')][_0xdf24('0x31')]();}else{logger[_0xdf24('0xa')](_0xdf24('0x2d'),inspect(_0x33f379));return null;}}else{logger[_0xdf24('0xa')](_0xdf24('0x32'));return null;}}catch(_0x4433a3){logger[_0xdf24('0xa')](_0x4433a3[_0xdf24('0xc')]);return null;}});if(_0x4410b9['finally']){logger[_0xdf24('0x1f')](util['format'](_0xdf24('0x33'),_0x3c1d73[_0xdf24('0x21')],_0x3c1d73[_0xdf24('0x22')],_0x3c1d73['callerid'],_0x3c1d73[_0xdf24('0x24')],_0x3c1d73[_0xdf24('0x25')]));_0x2cc37f['traverseBFS'](_0x4410b9[_0xdf24('0x34')]['id'],function(_0x24c2a9){try{_0x24c2a9=_0x1647e8[_0xdf24('0x35')](_0x24c2a9);logger[_0xdf24('0x18')](_0xdf24('0x27'),JSON[_0xdf24('0x19')](_0x24c2a9,null,0x2));if(_0x24c2a9&&_0x1647e8[_0x24c2a9[_0xdf24('0xd')]]){_0x33f379=_0x1647e8[_0x24c2a9[_0xdf24('0xd')]](_0x24c2a9);if(_0x33f379){logger[_0xdf24('0x18')](_0xdf24('0x2d'),inspect(_0x33f379));return _[_0xdf24('0x30')](_0x33f379[_0xdf24('0x2f')])?null:_0x33f379[_0xdf24('0x2f')]['toString']();}else{logger['error'](_0xdf24('0x2d'),inspect(_0x33f379));return null;}}else{logger['error'](_0xdf24('0x32'));return null;}}catch(_0x498e0f){logger[_0xdf24('0xa')](_0x498e0f[_0xdf24('0xc')]);return null;}});}logger[_0xdf24('0x1f')](util['format'](_0xdf24('0x36'),_0x3c1d73[_0xdf24('0x21')],_0x3c1d73[_0xdf24('0x22')],_0x3c1d73[_0xdf24('0x23')],_0x3c1d73[_0xdf24('0x24')],_0x3c1d73[_0xdf24('0x25')]));logger[_0xdf24('0x1f')](util[_0xdf24('0x1b')](_0xdf24('0x37'),_0x3c1d73[_0xdf24('0x2a')],_0x3c1d73[_0xdf24('0x2b')],parseInt(_0x3c1d73[_0xdf24('0x2c')],0xa)+0x1));_0x3c1d73[_0xdf24('0x38')](_0x3c1d73[_0xdf24('0x2a')],_0x3c1d73['extension'],parseInt(_0x3c1d73['priority'],0xa)+0x1);_0x3c1d73['close']();}function handleNotFound(_0x47a703){logger['error'](util[_0xdf24('0x1b')]('Project\x20%s\x20not\x20found',_0x47a703[_0xdf24('0x21')]));_0x47a703[_0xdf24('0x38')](_0x47a703['context'],_0x47a703[_0xdf24('0x2b')],parseInt(_0x47a703['priority'],0xa)+0x1);_0x47a703[_0xdf24('0x39')]();}function handleUnpublished(_0x31e254){logger[_0xdf24('0xa')](util[_0xdf24('0x1b')](_0xdf24('0x3a'),_0x31e254[_0xdf24('0x21')]));_0x31e254[_0xdf24('0x38')](_0x31e254[_0xdf24('0x2a')],_0x31e254[_0xdf24('0x2b')],parseInt(_0x31e254[_0xdf24('0x2c')],0xa)+0x1);_0x31e254[_0xdf24('0x39')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x412e=['agi','./rpc','./graph','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','maxRetry','mxCell','length','source','target','addEdge','toJson','mxGraphModel','root','inspect','debug','format','YYYY-MM-DD\x20HH:mm:ss','arg_1','calleridname','dnid','uniqueid','clear','stringify','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','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','callerid','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','exports','lodash','moment','xml2json','../../config/logger'];(function(_0xff4274,_0x3ffd75){var _0x21cc3d=function(_0x1f19d3){while(--_0x1f19d3){_0xff4274['push'](_0xff4274['shift']());}};_0x21cc3d(++_0x3ffd75);}(_0x412e,0x1ac));var _0xe412=function(_0x93c13e,_0x51d8c9){_0x93c13e=_0x93c13e-0x0;var _0x43ceae=_0x412e[_0x93c13e];return _0x43ceae;};'use strict';var _=require(_0xe412('0x0'));var moment=require(_0xe412('0x1'));var parser=require(_0xe412('0x2'));var util=require('util');var logger=require(_0xe412('0x3'))(_0xe412('0x4'));var rpc=require(_0xe412('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0xe412('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe412('0x7')]()[_0xe412('0x8')](function(_0x1a7e41){logger[_0xe412('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x1a7e41[_0xe412('0xa')]);return[];});}function addVertex(_0x97d768,_0x30708d,_0x586bcf){_0x30708d[_0xe412('0xb')]=_0x586bcf;if(_0x30708d[_0xe412('0xc')]('retry')){_0x30708d[_0xe412('0xd')]=parseInt(_0x30708d['retry'],0xa);}_0x97d768['addVertex'](_['omit'](_0x30708d,_0xe412('0xe')));}function initGraph(_0x4b37ce,_0x296bad){var _0x27adbe=new Graph();for(var _0x2689fb in _0x4b37ce){if(_0x4b37ce[_0xe412('0xc')](_0x2689fb)){if(_['isArray'](_0x4b37ce[_0x2689fb])){for(var _0x3756d3=0x0;_0x3756d3<_0x4b37ce[_0x2689fb][_0xe412('0xf')];_0x3756d3+=0x1){addVertex(_0x27adbe,_0x4b37ce[_0x2689fb][_0x3756d3],_0x2689fb);}}else{addVertex(_0x27adbe,_0x4b37ce[_0x2689fb],_0x2689fb);}}}for(var _0x1a8b1f=0x0;_0x1a8b1f<_0x296bad[_0xe412('0xf')];_0x1a8b1f+=0x1){if(_0x296bad[_0x1a8b1f][_0xe412('0x10')]&&_0x296bad[_0x1a8b1f][_0xe412('0x11')]){_0x27adbe[_0xe412('0x12')](_0x296bad[_0x1a8b1f][_0xe412('0x10')],_0x296bad[_0x1a8b1f][_0xe412('0x11')],_0x296bad[_0x1a8b1f]['value']);}}return _0x27adbe;}function getRoot(_0x544eaa){return parser[_0xe412('0x13')](_0x544eaa,{'object':!![]})[_0xe412('0x14')][_0xe412('0x15')];}function inspect(_0x121025){return util[_0xe412('0x16')](_0x121025,{'showHidden':![],'depth':null});}function initialize(_0x1b7368,_0x53c2f1){var _0x4f2881=getRoot(_0x1b7368['production']);if(!_0x4f2881||!_0x4f2881['start'])return;var _0xc282a7,_0x42be8e,_0xdeca7d;logger[_0xe412('0x17')](_0xe412('0x15'),JSON['stringify'](_0x4f2881,null,0x2));_0x53c2f1['joinAt']=moment()[_0xe412('0x18')](_0xe412('0x19'));_0xc282a7=initGraph(_['omit'](_0x4f2881,_0xe412('0xe')),_0x4f2881[_0xe412('0xe')]);_0x42be8e=new Vertices(_0x53c2f1,rpc,mailRpc);logger['info'](util[_0xe412('0x18')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x53c2f1[_0xe412('0x1a')],_0x53c2f1[_0xe412('0x1b')],_0x53c2f1['callerid'],_0x53c2f1[_0xe412('0x1c')],_0x53c2f1[_0xe412('0x1d')]));_0xc282a7['traverseBFS'](_0x4f2881['start']['id'],function(_0x320e1c){try{_0x320e1c=_0x42be8e[_0xe412('0x1e')](_0x320e1c);logger[_0xe412('0x17')]('vertex',JSON[_0xe412('0x1f')](_0x320e1c,null,0x2));if(_0x320e1c['agicommand']===_0xe412('0x20')){logger[_0xe412('0x21')](_0xe412('0x22'));_0x53c2f1['context']=_0x320e1c[_0xe412('0x23')]||_0x53c2f1[_0xe412('0x23')];_0x53c2f1[_0xe412('0x24')]=_0x320e1c[_0xe412('0x24')];_0x53c2f1[_0xe412('0x25')]=_0x320e1c[_0xe412('0x25')]?_0x320e1c[_0xe412('0x25')]-0x1:0x1;return null;}else if(_0x320e1c&&_0x42be8e[_0x320e1c[_0xe412('0xb')]]){_0xdeca7d=_0x42be8e[_0x320e1c['agicommand']](_0x320e1c);logger[_0xe412('0x21')](_0xe412('0x26'),JSON[_0xe412('0x1f')](_0xdeca7d,null,0x2));if(_0xdeca7d&&_0xdeca7d['code']===AGI_CODE_SUCCESS&&_0xdeca7d[_0xe412('0x27')]!==AGI_RESULT_ERROR&&!_0x53c2f1[_0xe412('0x28')]){logger[_0xe412('0x17')]('response',inspect(_0xdeca7d));return _[_0xe412('0x29')](_0xdeca7d['result'])?null:_0xdeca7d[_0xe412('0x27')][_0xe412('0x2a')]();}else{logger[_0xe412('0x9')](_0xe412('0x26'),inspect(_0xdeca7d));return null;}}else{logger['error'](_0xe412('0x2b'));return null;}}catch(_0x407319){logger[_0xe412('0x9')](_0x407319[_0xe412('0xa')]);return null;}});if(_0x4f2881[_0xe412('0x2c')]){logger['info'](util[_0xe412('0x18')](_0xe412('0x2d'),_0x53c2f1[_0xe412('0x1a')],_0x53c2f1['calleridname'],_0x53c2f1[_0xe412('0x2e')],_0x53c2f1['dnid'],_0x53c2f1[_0xe412('0x1d')]));_0xc282a7[_0xe412('0x2f')](_0x4f2881[_0xe412('0x2c')]['id'],function(_0x142742){try{_0x142742=_0x42be8e[_0xe412('0x1e')](_0x142742);logger['debug']('vertex',JSON[_0xe412('0x1f')](_0x142742,null,0x2));if(_0x142742&&_0x42be8e[_0x142742['agicommand']]){_0xdeca7d=_0x42be8e[_0x142742['agicommand']](_0x142742);if(_0xdeca7d){logger[_0xe412('0x17')](_0xe412('0x26'),inspect(_0xdeca7d));return _[_0xe412('0x29')](_0xdeca7d[_0xe412('0x27')])?null:_0xdeca7d[_0xe412('0x27')][_0xe412('0x2a')]();}else{logger[_0xe412('0x9')]('response',inspect(_0xdeca7d));return null;}}else{logger[_0xe412('0x9')](_0xe412('0x2b'));return null;}}catch(_0x506dc7){logger['error'](_0x506dc7[_0xe412('0xa')]);return null;}});}logger[_0xe412('0x21')](util[_0xe412('0x18')](_0xe412('0x30'),_0x53c2f1['arg_1'],_0x53c2f1[_0xe412('0x1b')],_0x53c2f1[_0xe412('0x2e')],_0x53c2f1[_0xe412('0x1c')],_0x53c2f1[_0xe412('0x1d')]));logger[_0xe412('0x21')](util['format'](_0xe412('0x31'),_0x53c2f1['context'],_0x53c2f1[_0xe412('0x24')],parseInt(_0x53c2f1[_0xe412('0x25')],0xa)+0x1));_0x53c2f1[_0xe412('0x32')](_0x53c2f1[_0xe412('0x23')],_0x53c2f1[_0xe412('0x24')],parseInt(_0x53c2f1[_0xe412('0x25')],0xa)+0x1);_0x53c2f1['close']();}function handleNotFound(_0xb80dbf){logger[_0xe412('0x9')](util[_0xe412('0x18')](_0xe412('0x33'),_0xb80dbf[_0xe412('0x1a')]));_0xb80dbf[_0xe412('0x32')](_0xb80dbf[_0xe412('0x23')],_0xb80dbf[_0xe412('0x24')],parseInt(_0xb80dbf['priority'],0xa)+0x1);_0xb80dbf[_0xe412('0x34')]();}function handleUnpublished(_0x20e1cd){logger['error'](util[_0xe412('0x18')]('Project\x20%s\x20not\x20published',_0x20e1cd[_0xe412('0x1a')]));_0x20e1cd['continueAt'](_0x20e1cd[_0xe412('0x23')],_0x20e1cd[_0xe412('0x24')],parseInt(_0x20e1cd[_0xe412('0x25')],0xa)+0x1);_0x20e1cd[_0xe412('0x34')]();}module[_0xe412('0x35')]={'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 38d1103..2e8cd1a 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 _0x5ed3=['Transform','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','split','slice','trim','length','emit','headers','indexOf','line','exports','util','stream'];(function(_0x3864fc,_0x14403d){var _0x5c762e=function(_0x31fb26){while(--_0x31fb26){_0x3864fc['push'](_0x3864fc['shift']());}};_0x5c762e(++_0x14403d);}(_0x5ed3,0x9e));var _0x35ed=function(_0x20ff09,_0xe26521){_0x20ff09=_0x20ff09-0x0;var _0x10c2ec=_0x5ed3[_0x20ff09];return _0x10c2ec;};'use strict';var util=require(_0x35ed('0x0'));var Transform=require(_0x35ed('0x1'))[_0x35ed('0x2')];function AGIReply(_0x1b7fd7){Transform[_0x35ed('0x3')](this,_0x1b7fd7);this[_0x35ed('0x4')]='';this[_0x35ed('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x35ed('0x6')][_0x35ed('0x7')]=function(_0x3e9e38,_0x5325d6,_0x592fe2){var _0x1b11ce='\x0a',_0x1fce34=['\x0a\x0a',_0x35ed('0x8')],_0x2dcaa5=-0x1,_0x4e95bf=-0x1,_0x314b27='',_0x869cd3=0x0,_0x3734c4='',_0x1a9908='';this[_0x35ed('0x4')]+=_0x3e9e38[_0x35ed('0x9')]();_0x3734c4=this['_localBuffer'];if(!this[_0x35ed('0x5')]){_0x869cd3=0x0;while(_0x1fce34[_0x869cd3]){while((_0x4e95bf=_0x3734c4['indexOf'](_0x1fce34[_0x869cd3]))!=-0x1){_0x314b27=_0x1fce34[_0x869cd3];_0x1a9908=_0x3734c4[_0x35ed('0xa')](0x0,_0x4e95bf);_0x3734c4=_0x3734c4[_0x35ed('0xa')](_0x4e95bf+_0x314b27['length']);var _0x122c3e=_0x1a9908[_0x35ed('0xb')](_0x1b11ce),_0x8ab735=0x0,_0x30bfd1={},_0x1bf8b8='',_0x4c038a='',_0xf3be1c=-0x1;while(_0x122c3e[_0x8ab735]){_0xf3be1c=_0x122c3e[_0x8ab735]['indexOf'](':');if(_0xf3be1c!=-0x1){_0x1bf8b8=_0x122c3e[_0x8ab735][_0x35ed('0xc')](0x0,_0xf3be1c)[_0x35ed('0xd')]();_0x4c038a=_0x122c3e[_0x8ab735][_0x35ed('0xc')](_0xf3be1c+0x1)['trim']();if(_0x1bf8b8[_0x35ed('0xe')]>0x0){_0x30bfd1[_0x1bf8b8]=_0x4c038a;}}else{}_0x8ab735++;}this[_0x35ed('0xf')](_0x35ed('0x10'),_0x30bfd1);this['_inBody']=!![];}_0x869cd3++;}this[_0x35ed('0x4')]=_0x3734c4;}else{while((_0x2dcaa5=_0x3734c4[_0x35ed('0x11')](_0x1b11ce))!=-0x1){_0x1a9908=_0x3734c4['substring'](0x0,_0x2dcaa5);this[_0x35ed('0xf')](_0x35ed('0x12'),_0x1a9908);_0x3734c4=_0x3734c4[_0x35ed('0xa')](_0x2dcaa5+_0x1b11ce['length']);}this[_0x35ed('0x4')]=_0x3734c4;}_0x592fe2();};module[_0x35ed('0x13')]=AGIReply; \ No newline at end of file +var _0xcb29=['inherits','prototype','\x0d\x0a\x0d\x0a','_localBuffer','indexOf','substring','length','split','trim','slice','emit','line','exports','stream','Transform','_inBody'];(function(_0x2cf196,_0x4fe158){var _0x46c143=function(_0x25a2c4){while(--_0x25a2c4){_0x2cf196['push'](_0x2cf196['shift']());}};_0x46c143(++_0x4fe158);}(_0xcb29,0x12d));var _0x9cb2=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xcb29[_0x3305de];return _0x3b5a84;};'use strict';var util=require('util');var Transform=require(_0x9cb2('0x0'))[_0x9cb2('0x1')];function AGIReply(_0x18f6db){Transform['call'](this,_0x18f6db);this['_localBuffer']='';this[_0x9cb2('0x2')]=![];}util[_0x9cb2('0x3')](AGIReply,Transform);AGIReply[_0x9cb2('0x4')]['_transform']=function(_0x76c94e,_0x43f4fd,_0x594b4e){var _0x5c5f60='\x0a',_0x2463e6=['\x0a\x0a',_0x9cb2('0x5')],_0x2cf9e4=-0x1,_0x3961de=-0x1,_0x4cc03b='',_0xeb2e09=0x0,_0x2acb0e='',_0x5ace56='';this['_localBuffer']+=_0x76c94e['toString']();_0x2acb0e=this[_0x9cb2('0x6')];if(!this['_inBody']){_0xeb2e09=0x0;while(_0x2463e6[_0xeb2e09]){while((_0x3961de=_0x2acb0e[_0x9cb2('0x7')](_0x2463e6[_0xeb2e09]))!=-0x1){_0x4cc03b=_0x2463e6[_0xeb2e09];_0x5ace56=_0x2acb0e['substring'](0x0,_0x3961de);_0x2acb0e=_0x2acb0e[_0x9cb2('0x8')](_0x3961de+_0x4cc03b[_0x9cb2('0x9')]);var _0x401377=_0x5ace56[_0x9cb2('0xa')](_0x5c5f60),_0x2552b9=0x0,_0x4ba755={},_0x363614='',_0x576531='',_0x3e603e=-0x1;while(_0x401377[_0x2552b9]){_0x3e603e=_0x401377[_0x2552b9][_0x9cb2('0x7')](':');if(_0x3e603e!=-0x1){_0x363614=_0x401377[_0x2552b9]['slice'](0x0,_0x3e603e)[_0x9cb2('0xb')]();_0x576531=_0x401377[_0x2552b9][_0x9cb2('0xc')](_0x3e603e+0x1)['trim']();if(_0x363614[_0x9cb2('0x9')]>0x0){_0x4ba755[_0x363614]=_0x576531;}}else{}_0x2552b9++;}this[_0x9cb2('0xd')]('headers',_0x4ba755);this['_inBody']=!![];}_0xeb2e09++;}this['_localBuffer']=_0x2acb0e;}else{while((_0x2cf9e4=_0x2acb0e[_0x9cb2('0x7')](_0x5c5f60))!=-0x1){_0x5ace56=_0x2acb0e['substring'](0x0,_0x2cf9e4);this[_0x9cb2('0xd')](_0x9cb2('0xe'),_0x5ace56);_0x2acb0e=_0x2acb0e[_0x9cb2('0x8')](_0x2cf9e4+_0x5c5f60[_0x9cb2('0x9')]);}this['_localBuffer']=_0x2acb0e;}_0x594b4e();};module[_0x9cb2('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 82d8015..f19489c 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 _0x0cd6=['error','message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','getIntervalById','Interval','getSmsAccountById','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','client','http','then'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x0cd6,0x113));var _0x60cd=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x0cd6[_0x1488cd];return _0x63fa13;};'use strict';var _=require(_0x60cd('0x0'));var moment=require(_0x60cd('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x60cd('0x2')][_0x60cd('0x3')]({'port':0x2329});function request(_0x4d082a,_0x184850){return new Promise(function(_0x2f22ea,_0x519d95){return client['request'](_0x4d082a,_0x184850)[_0x60cd('0x4')](function(_0xefc62d){if(_0xefc62d[_0x60cd('0x5')]){return _0x519d95(_0xefc62d['error'][_0x60cd('0x6')]);}else{return _0x2f22ea(_0xefc62d['result']);}})[_0x60cd('0x7')](function(_0x2c973){return _0x519d95(_0x2c973);});});}exports[_0x60cd('0x8')]=function(){return request(_0x60cd('0x9'),{'options':{'raw':![],'attributes':['id',_0x60cd('0xa'),_0x60cd('0xb')]}});};exports[_0x60cd('0xc')]=function(_0x316912){return request(_0x60cd('0xd'),{'options':{'raw':![],'where':{'name':_0x316912},'attributes':['production']}});};exports[_0x60cd('0xe')]=function(_0x214e75){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x214e75},'include':[{'model':_0x60cd('0xf'),'as':'Smtp','include':[{'model':_0x60cd('0x10'),'as':_0x60cd('0x10')}]}],'attributes':['id','name',_0x60cd('0x11')],'smtp':!![]}});};exports[_0x60cd('0x12')]=function(_0x317275){return request('ShowSquareProject',{'options':{'where':{'id':_0x317275},'attributes':[_0x60cd('0xa')]}});};exports[_0x60cd('0x13')]=function(_0x53e158){return request(_0x60cd('0x14'),{'options':{'where':{'id':_0x53e158},'attributes':['name']}});};exports[_0x60cd('0x15')]=function(_0x41cc6b){return request('ShowVariable',{'options':{'where':{'id':_0x41cc6b},'attributes':['name']}});};exports[_0x60cd('0x16')]=function(_0x209dde){return request(_0x60cd('0x17'),{'options':{'where':{'id':_0x209dde},'attributes':['dsn']}});};exports[_0x60cd('0x18')]=function(_0x3b01bd){return request(_0x60cd('0x19'),{'options':{'where':{'id':_0x3b01bd},'attributes':[_0x60cd('0xa')]}});};exports[_0x60cd('0x1a')]=function(_0x3478d1){return request(_0x60cd('0x1b'),{'options':{'where':{'phone':_0x3478d1[_0x60cd('0x1c')]},'attributes':['id']}});};exports[_0x60cd('0x1d')]=function(_0x585ad8){return request(_0x60cd('0x1e'),{'options':{'where':{'id':_0x585ad8},'attributes':['name']}});};exports['getSoundById']=function(_0x298eeb){return request(_0x60cd('0x1f'),{'options':{'where':{'id':_0x298eeb},'attributes':['save_name']}});};exports[_0x60cd('0x20')]=function(_0x13e5cc){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x13e5cc},'include':[{'model':_0x60cd('0x21'),'as':'Intervals'}]}});};exports[_0x60cd('0x22')]=function(_0x41c290){return request('ShowSmsAccount',{'options':{'where':{'id':_0x41c290},'attributes':['id',_0x60cd('0xa')]}});};exports['createSmsMessage']=function(_0x5a9f30){return request(_0x60cd('0x23'),{'body':_0x5a9f30});};exports['createSquareDetailsReport']=function(_0x204ddb){return request(_0x60cd('0x24'),{'body':_0x204ddb});};exports['createSquareReport']=function(_0x4e3025){return request(_0x60cd('0x25'),{'body':_[_0x60cd('0x26')](_0x4e3025,{'project_name':_0x4e3025[_0x60cd('0x27')],'prev_project_name':_0x4e3025['arg_2']||'','is_subproject':_0x4e3025[_0x60cd('0x28')]?!![]:![],'leaveAt':moment()[_0x60cd('0x29')](_0x60cd('0x2a'))})});};exports[_0x60cd('0x2b')]=function(_0x547932){return request(_0x60cd('0x2c'),{'body':_0x547932});};exports[_0x60cd('0x2d')]=function(_0xd8051a){return request(_0x60cd('0x2e'),{'body':_0xd8051a});};exports[_0x60cd('0x2f')]=function(_0x4173f7){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4173f7[_0x60cd('0x1c')],'ListId':_0x4173f7[_0x60cd('0x30')]}}})[_0x60cd('0x4')](function(_0x55b207){if(_0x55b207){return _0x55b207;}return request(_0x60cd('0x31'),{'body':_0x4173f7});});};exports['getPauseById']=function(_0x379e85){return request(_0x60cd('0x32'),{'options':{'where':{'id':_0x379e85},'attributes':['name']}});};exports['agentLogin']=function(_0x24584a,_0x6afe6d){return request(_0x60cd('0x33'),{'body':{'interface':_0x6afe6d},'options':{'where':_0x24584a}});};exports['agentPause']=function(_0x60f77a,_0x2b4959,_0x320a3f){return request(_0x60cd('0x34'),{'body':{'type':_0x2b4959,'uniqueid':_0x320a3f},'options':{'where':_0x60f77a}});};exports[_0x60cd('0x35')]=function(_0x3aed82){return request(_0x60cd('0x36'),{'body':{},'options':{'where':_0x3aed82}});};exports['agentLogout']=function(_0xf4be4c){return request(_0x60cd('0x37'),{'body':{},'options':{'where':_0xf4be4c}});}; \ No newline at end of file +var _0xd4b6=['createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','lodash','moment','client','http','then','error','message','result','catch','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareReport','merge','arg_2','format'];(function(_0x480856,_0x778226){var _0x1be6f2=function(_0x454360){while(--_0x454360){_0x480856['push'](_0x480856['shift']());}};_0x1be6f2(++_0x778226);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x7afd94,_0x556e19){_0x7afd94=_0x7afd94-0x0;var _0x13f05c=_0xd4b6[_0x7afd94];return _0x13f05c;};'use strict';var _=require(_0x6d4b('0x0'));var moment=require(_0x6d4b('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x6d4b('0x2')][_0x6d4b('0x3')]({'port':0x2329});function request(_0x586af3,_0x270e1e){return new Promise(function(_0x5bba96,_0x56302c){return client['request'](_0x586af3,_0x270e1e)[_0x6d4b('0x4')](function(_0x1e1826){if(_0x1e1826[_0x6d4b('0x5')]){return _0x56302c(_0x1e1826['error'][_0x6d4b('0x6')]);}else{return _0x5bba96(_0x1e1826[_0x6d4b('0x7')]);}})[_0x6d4b('0x8')](function(_0x262eed){return _0x56302c(_0x262eed);});});}exports['getSquareProjects']=function(){return request(_0x6d4b('0x9'),{'options':{'raw':![],'attributes':['id',_0x6d4b('0xa'),_0x6d4b('0xb')]}});};exports[_0x6d4b('0xc')]=function(_0x559134){return request(_0x6d4b('0xd'),{'options':{'raw':![],'where':{'name':_0x559134},'attributes':[_0x6d4b('0xb')]}});};exports[_0x6d4b('0xe')]=function(_0x2006a4){return request(_0x6d4b('0xf'),{'options':{'raw':![],'where':{'id':_0x2006a4},'include':[{'model':_0x6d4b('0x10'),'as':_0x6d4b('0x11'),'include':[{'model':'CloudProvider','as':_0x6d4b('0x12')}]}],'attributes':['id',_0x6d4b('0xa'),_0x6d4b('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x46b1ea){return request(_0x6d4b('0xd'),{'options':{'where':{'id':_0x46b1ea},'attributes':[_0x6d4b('0xa')]}});};exports[_0x6d4b('0x14')]=function(_0x296cc2){return request(_0x6d4b('0x15'),{'options':{'where':{'id':_0x296cc2},'attributes':[_0x6d4b('0xa')]}});};exports[_0x6d4b('0x16')]=function(_0xb0d2a9){return request(_0x6d4b('0x17'),{'options':{'where':{'id':_0xb0d2a9},'attributes':['name']}});};exports[_0x6d4b('0x18')]=function(_0x4d524d){return request(_0x6d4b('0x19'),{'options':{'where':{'id':_0x4d524d},'attributes':[_0x6d4b('0x1a')]}});};exports['getUserById']=function(_0x53c61c){return request(_0x6d4b('0x1b'),{'options':{'where':{'id':_0x53c61c},'attributes':[_0x6d4b('0xa')]}});};exports[_0x6d4b('0x1c')]=function(_0x2694ba){return request(_0x6d4b('0x1d'),{'options':{'where':{'phone':_0x2694ba[_0x6d4b('0x1e')]},'attributes':['id']}});};exports[_0x6d4b('0x1f')]=function(_0x162865){return request(_0x6d4b('0x20'),{'options':{'where':{'id':_0x162865},'attributes':[_0x6d4b('0xa')]}});};exports['getSoundById']=function(_0x5c88a1){return request(_0x6d4b('0x21'),{'options':{'where':{'id':_0x5c88a1},'attributes':[_0x6d4b('0x22')]}});};exports[_0x6d4b('0x23')]=function(_0x5d5b72){return request(_0x6d4b('0x24'),{'options':{'raw':![],'where':{'id':_0x5d5b72},'include':[{'model':_0x6d4b('0x25'),'as':_0x6d4b('0x26')}]}});};exports[_0x6d4b('0x27')]=function(_0x4c46cf){return request(_0x6d4b('0x28'),{'options':{'where':{'id':_0x4c46cf},'attributes':['id',_0x6d4b('0xa')]}});};exports[_0x6d4b('0x29')]=function(_0x4626a6){return request(_0x6d4b('0x2a'),{'body':_0x4626a6});};exports['createSquareDetailsReport']=function(_0x38dc85){return request('CreateSquareDetailsReport',{'body':_0x38dc85});};exports[_0x6d4b('0x2b')]=function(_0x36f046){return request('CreateSquareReport',{'body':_[_0x6d4b('0x2c')](_0x36f046,{'project_name':_0x36f046['arg_1'],'prev_project_name':_0x36f046[_0x6d4b('0x2d')]||'','is_subproject':_0x36f046[_0x6d4b('0x2d')]?!![]:![],'leaveAt':moment()[_0x6d4b('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x6d4b('0x2f')]=function(_0x4a4cb2){return request(_0x6d4b('0x30'),{'body':_0x4a4cb2});};exports[_0x6d4b('0x31')]=function(_0x35f612){return request(_0x6d4b('0x32'),{'body':_0x35f612});};exports[_0x6d4b('0x33')]=function(_0xf053ee){return request(_0x6d4b('0x34'),{'options':{'raw':![],'where':{'phone':_0xf053ee['phone'],'ListId':_0xf053ee[_0x6d4b('0x35')]}}})['then'](function(_0x10825b){if(_0x10825b){return _0x10825b;}return request('CreateCmContact',{'body':_0xf053ee});});};exports[_0x6d4b('0x36')]=function(_0x447ab7){return request(_0x6d4b('0x37'),{'options':{'where':{'id':_0x447ab7},'attributes':[_0x6d4b('0xa')]}});};exports['agentLogin']=function(_0xd3ac49,_0x36fd71){return request(_0x6d4b('0x38'),{'body':{'interface':_0x36fd71},'options':{'where':_0xd3ac49}});};exports[_0x6d4b('0x39')]=function(_0x8dd9ab,_0x18ffc6,_0xfdadd3){return request(_0x6d4b('0x3a'),{'body':{'type':_0x18ffc6,'uniqueid':_0xfdadd3},'options':{'where':_0x8dd9ab}});};exports['agentUnpause']=function(_0x4ab4d8){return request(_0x6d4b('0x3b'),{'body':{},'options':{'where':_0x4ab4d8}});};exports['agentLogout']=function(_0x3a236d){return request(_0x6d4b('0x3c'),{'body':{},'options':{'where':_0x3a236d}});}; \ 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 e4a5112..401b569 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 _0xef96=['./polly','./lex','exports'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xef96,0x162));var _0x6ef9=function(_0xfb053a,_0x1097ce){_0xfb053a=_0xfb053a-0x0;var _0x395ed4=_0xef96[_0xfb053a];return _0x395ed4;};var polly=require(_0x6ef9('0x0'));var lex=require(_0x6ef9('0x1'));module[_0x6ef9('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xfc91=['./lex'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfc91,0xb5));var _0x1fc9=function(_0x9bbbaf,_0x37c258){_0x9bbbaf=_0x9bbbaf-0x0;var _0xefa2bf=_0xfc91[_0x9bbbaf];return _0xefa2bf;};var polly=require('./polly');var lex=require(_0x1fc9('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 64b42d2..d394784 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 _0xa571=['exports','./lib/api'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xa571,0x107));var _0x1a57=function(_0x5dfa90,_0x5e5392){_0x5dfa90=_0x5dfa90-0x0;var _0x2d4781=_0xa571[_0x5dfa90];return _0x2d4781;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file +var _0x2547=['exports'];(function(_0x5f41c9,_0x160beb){var _0xdb7812=function(_0x4575d4){while(--_0x4575d4){_0x5f41c9['push'](_0x5f41c9['shift']());}};_0xdb7812(++_0x160beb);}(_0x2547,0x1cd));var _0x7254=function(_0x42e2a1,_0x291a93){_0x42e2a1=_0x42e2a1-0x0;var _0x5d6b06=_0x2547[_0x42e2a1];return _0x5d6b06;};'use strict';var lex=require('./lib/api');module[_0x7254('0x0')]=function(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435){return lex(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435);}; \ 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 f36aec1..1dabc1b 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(_0x318727,_0x1f024a){var _0x500025=function(_0x31a8c1){while(--_0x31a8c1){_0x318727['push'](_0x318727['shift']());}};_0x500025(++_0x1f024a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x33de39,_0x43715c){var _0x4e8648=function(_0x5080a1){while(--_0x5080a1){_0x33de39['push'](_0x33de39['shift']());}};_0x4e8648(++_0x43715c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 1788df1..f1cab9b 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 _0x193f=['exports','./lib/api'];(function(_0x1afb8f,_0x1f9c04){var _0x48fbdc=function(_0x45b7a2){while(--_0x45b7a2){_0x1afb8f['push'](_0x1afb8f['shift']());}};_0x48fbdc(++_0x1f9c04);}(_0x193f,0xd3));var _0xf193=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x193f[_0x59befa];return _0x1dd63d;};'use strict';var polly=require(_0xf193('0x0'));module[_0xf193('0x1')]=function(_0x28df84,_0x1f3db7,_0x10e09b,_0x4dd99c,_0x192e01,_0x4d73bb,_0x563d11){return polly(_0x28df84,_0x1f3db7,_0x10e09b,_0x4dd99c,_0x192e01,_0x4d73bb,_0x563d11);}; \ No newline at end of file +var _0x4332=['exports'];(function(_0x2150eb,_0x11cb5a){var _0x378efd=function(_0x4eacf2){while(--_0x4eacf2){_0x2150eb['push'](_0x2150eb['shift']());}};_0x378efd(++_0x11cb5a);}(_0x4332,0xb7));var _0x2433=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4332[_0x432682];return _0x463d05;};'use strict';var polly=require('./lib/api');module[_0x2433('0x0')]=function(_0x3e2762,_0x546c07,_0x1d65b5,_0x1feaaf,_0x397ae1,_0x3a05e3,_0x4fbc57){return polly(_0x3e2762,_0x546c07,_0x1d65b5,_0x1feaaf,_0x397ae1,_0x3a05e3,_0x4fbc57);}; \ 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 7ba3ac3..d9a98e5 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 _0xe4e9=['synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','bluebird','randomstring'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xe4e9,0x1be));var _0x9e4e=function(_0x401259,_0x2b7c84){_0x401259=_0x401259-0x0;var _0x490acb=_0xe4e9[_0x401259];return _0x490acb;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9e4e('0x0'));var rs=require(_0x9e4e('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x5e6e2f,_0x38ad6b,_0x39bcf0){return new BPromise(function(_0x3a98f5,_0x13735a){_0x5e6e2f[_0x9e4e('0x2')](_0x38ad6b,function(_0x1bacd3,_0x4f3184){if(_0x1bacd3){_0x13735a(_0x1bacd3);}else if(_0x4f3184){if(_0x4f3184['AudioStream']instanceof Buffer){fs[_0x9e4e('0x3')](_0x39bcf0,_0x4f3184['AudioStream'],function(_0x12dded){if(_0x12dded){_0x13735a(_0x12dded);}else{_0x3a98f5();}});}else{_0x13735a(new Error(_0x9e4e('0x4')));}}else{_0x13735a(new Error(_0x9e4e('0x5')));}});});}module[_0x9e4e('0x6')]=function(_0xb72e04,_0x1c39ab,_0x3180b8,_0x59cfdb,_0x393eb7,_0x51e775,_0x3f06f0){var _0x55293e=new AWS['Polly']({'accessKeyId':_0xb72e04,'secretAccessKey':_0x1c39ab,'region':_0x3180b8});var _0x40e152={'Text':_0x393eb7,'TextType':_0x51e775||_0x9e4e('0x7'),'OutputFormat':'mp3','VoiceId':_0x59cfdb};return pollyResult(_0x55293e,_0x40e152,_0x3f06f0);}; \ No newline at end of file +var _0x7f67=['mp3','path','bluebird','randomstring','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text'];(function(_0xa9859c,_0x50500d){var _0x3e23f9=function(_0x4f242a){while(--_0x4f242a){_0xa9859c['push'](_0xa9859c['shift']());}};_0x3e23f9(++_0x50500d);}(_0x7f67,0xd0));var _0x77f6=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7f67[_0x5ddb1c];return _0x354adc;};'use strict';var fs=require('fs');var path=require(_0x77f6('0x0'));var BPromise=require(_0x77f6('0x1'));var rs=require(_0x77f6('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x31708d,_0x5f22de,_0x2273b7){return new BPromise(function(_0x1910ac,_0x1d07ed){_0x31708d[_0x77f6('0x3')](_0x5f22de,function(_0x418abc,_0x40a963){if(_0x418abc){_0x1d07ed(_0x418abc);}else if(_0x40a963){if(_0x40a963['AudioStream']instanceof Buffer){fs[_0x77f6('0x4')](_0x2273b7,_0x40a963['AudioStream'],function(_0x3d94b7){if(_0x3d94b7){_0x1d07ed(_0x3d94b7);}else{_0x1910ac();}});}else{_0x1d07ed(new Error(_0x77f6('0x5')));}}else{_0x1d07ed(new Error(_0x77f6('0x6')));}});});}module['exports']=function(_0x2c8a59,_0xc77834,_0x5dc544,_0x279dc8,_0x144c22,_0x406a0b,_0xf3597c){var _0x4d2ab2=new AWS['Polly']({'accessKeyId':_0x2c8a59,'secretAccessKey':_0xc77834,'region':_0x5dc544});var _0xa0d877={'Text':_0x144c22,'TextType':_0x406a0b||_0x77f6('0x7'),'OutputFormat':_0x77f6('0x8'),'VoiceId':_0x279dc8};return pollyResult(_0x4d2ab2,_0xa0d877,_0xf3597c);}; \ 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 d8f2618..058b98e 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 _0x61f1=['./lib/api','exports'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x61f1,0x128));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var asr=require(_0x161f('0x0'));module[_0x161f('0x1')]=function(_0x4976d3,_0x5679a2,_0x25676f,_0x32d3e7){return asr(_0x4976d3,_0x5679a2,_0x25676f);}; \ No newline at end of file +var _0x8cd5=['exports','./lib/api'];(function(_0x3b87d2,_0x25e3f6){var _0x168dc9=function(_0x378fff){while(--_0x378fff){_0x3b87d2['push'](_0x3b87d2['shift']());}};_0x168dc9(++_0x25e3f6);}(_0x8cd5,0x1e3));var _0x58cd=function(_0x3cb9c3,_0xa131b1){_0x3cb9c3=_0x3cb9c3-0x0;var _0x4e73f5=_0x8cd5[_0x3cb9c3];return _0x4e73f5;};'use strict';var asr=require(_0x58cd('0x0'));module[_0x58cd('0x1')]=function(_0x3ee97f,_0x5c3632,_0x36657d,_0x9cd0a2){return asr(_0x3ee97f,_0x5c3632,_0x36657d);}; \ 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 2c6597d..e1478ec 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 _0x6f0d=['bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST','LINEAR16','8000'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3f6a8a,_0x391fbc){_0x3f6a8a=_0x3f6a8a-0x0;var _0x8cd316=_0x6f0d[_0x3f6a8a];return _0x8cd316;};'use strict';var url=require('url');var BPromise=require(_0xd6f0('0x0'));var fs=require('fs');var host=_0xd6f0('0x1');module[_0xd6f0('0x2')]=function(_0x107a8c,_0x573473,_0x275230){return new BPromise(function(_0x135a93,_0x2f78fb){var _0x25344b;if(typeof _0x107a8c!==_0xd6f0('0x3')||_0x107a8c['length']===0x0){return _0x2f78fb(_0xd6f0('0x4'));}if(typeof _0x573473!=='string'||_0x573473[_0xd6f0('0x5')]===0x0){return _0x2f78fb(_0xd6f0('0x6'));}if(typeof _0x275230!==_0xd6f0('0x7')&&(typeof _0x275230!==_0xd6f0('0x3')||_0x275230['length']===0x0)){return _0x2f78fb('lang\x20should\x20be\x20a\x20string');}try{_0x25344b=fs[_0xd6f0('0x8')](_0x107a8c)[_0xd6f0('0x9')](_0xd6f0('0xa'));}catch(_0x382a2e){return _0x2f78fb(_0x382a2e);}return _0x135a93({'method':_0xd6f0('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x573473,'body':{'config':{'encoding':_0xd6f0('0xc'),'sampleRateHertz':_0xd6f0('0xd'),'languageCode':_0x275230},'audio':{'content':_0x25344b}},'json':!![]});});}; \ No newline at end of file +var _0x2c54=['undefined','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','length','key\x20should\x20be\x20a\x20string'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2c54,0x136));var _0x42c5=function(_0x46da61,_0x4b812c){_0x46da61=_0x46da61-0x0;var _0x3a0412=_0x2c54[_0x46da61];return _0x3a0412;};'use strict';var url=require(_0x42c5('0x0'));var BPromise=require(_0x42c5('0x1'));var fs=require('fs');var host=_0x42c5('0x2');module['exports']=function(_0xbe3529,_0x46bcc4,_0x3d5e1d){return new BPromise(function(_0x253cc1,_0x2407d0){var _0x17924f;if(typeof _0xbe3529!=='string'||_0xbe3529[_0x42c5('0x3')]===0x0){return _0x2407d0('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x46bcc4!=='string'||_0x46bcc4[_0x42c5('0x3')]===0x0){return _0x2407d0(_0x42c5('0x4'));}if(typeof _0x3d5e1d!==_0x42c5('0x5')&&(typeof _0x3d5e1d!==_0x42c5('0x6')||_0x3d5e1d[_0x42c5('0x3')]===0x0)){return _0x2407d0(_0x42c5('0x7'));}try{_0x17924f=fs[_0x42c5('0x8')](_0xbe3529)[_0x42c5('0x9')](_0x42c5('0xa'));}catch(_0x186f79){return _0x2407d0(_0x186f79);}return _0x253cc1({'method':_0x42c5('0xb'),'uri':host+_0x42c5('0xc')+_0x46bcc4,'body':{'config':{'encoding':_0x42c5('0xd'),'sampleRateHertz':_0x42c5('0xe'),'languageCode':_0x3d5e1d},'audio':{'content':_0x17924f}},'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 f4136d1..197559b 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 _0xe8c3=['exports','./asr'];(function(_0x4c4351,_0x552e18){var _0x41bf16=function(_0x3e801c){while(--_0x3e801c){_0x4c4351['push'](_0x4c4351['shift']());}};_0x41bf16(++_0x552e18);}(_0xe8c3,0x17d));var _0x3e8c=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0xe8c3[_0x1cfe2e];return _0x39233f;};var asr=require(_0x3e8c('0x0'));module[_0x3e8c('0x1')]={'asr':asr}; \ No newline at end of file +var _0x132d=['./asr','exports'];(function(_0x4c24fc,_0x46ba9b){var _0x245c0e=function(_0x10aeba){while(--_0x10aeba){_0x4c24fc['push'](_0x4c24fc['shift']());}};_0x245c0e(++_0x46ba9b);}(_0x132d,0xec));var _0xd132=function(_0xf52342,_0x2e9017){_0xf52342=_0xf52342-0x0;var _0x120899=_0x132d[_0xf52342];return _0x120899;};var asr=require(_0xd132('0x0'));module[_0xd132('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index edcc545..a4628b2 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 _0x1b05=['chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','null','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.wav','goggleTTS\x20path','googleASR','uri','map','alternatives','transcript','results','confidence','join','googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','textRequest','source','result','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','pipe','end','https:','host','data','transcode','error\x20convert','finish\x20to\x20convert','tmp','generate','writeFileSync','base64','then','unlink'];(function(_0xa8f6f0,_0x3c4bb3){var _0x444f8f=function(_0x1d7f02){while(--_0x1d7f02){_0xa8f6f0['push'](_0xa8f6f0['shift']());}};_0x444f8f(++_0x3c4bb3);}(_0x1b05,0x169));var _0x51b0=function(_0xef4a2a,_0x13eedf){_0xef4a2a=_0xef4a2a-0x0;var _0x248318=_0x1b05[_0xef4a2a];return _0x248318;};'use strict';var apiai=require(_0x51b0('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x51b0('0x1'));var fs=require('fs');var http=require(_0x51b0('0x2'));var https=require(_0x51b0('0x3'));var md5=require(_0x51b0('0x4'));var path=require(_0x51b0('0x5'));var querystring=require(_0x51b0('0x6'));var rp=require(_0x51b0('0x7'));var rs=require('randomstring');var sox=require(_0x51b0('0x8'));var tts=require(_0x51b0('0x9'));var urlParse=require(_0x51b0('0xa'))[_0x51b0('0xb')];var util=require('util');var aws=require(_0x51b0('0xc'));var google=require(_0x51b0('0xd'));var sestek=require(_0x51b0('0xe'));var tilde=require('./tilde');var logger=require(_0x51b0('0xf'))(_0x51b0('0x10'));var ISPEECH_API=_0x51b0('0x11');function downloadFile(_0x2f7efb,_0x23222b){return new BPromise(function(_0x5d4603,_0x4df76b){var _0x2b6a20=urlParse(_0x2f7efb);var _0x2a9be8=_0x2b6a20[_0x51b0('0x12')]==='https:'?https:http;var _0x4403e2={'host':_0x2b6a20['host'],'path':_0x2b6a20[_0x51b0('0x5')],'headers':{'user-agent':_0x51b0('0x13')}};_0x2a9be8[_0x51b0('0x14')](_0x4403e2,function(_0x2a5318){if(_0x2a5318['statusCode']!==0xc8){logger[_0x51b0('0x15')](_0x51b0('0x16')+_0x2f7efb+'\x20failed,\x20status\x20code\x20=\x20'+_0x2a5318[_0x51b0('0x17')]+'\x20('+_0x2a5318[_0x51b0('0x18')]+')');_0x4df76b(new Error(_0x51b0('0x16')+_0x2f7efb+_0x51b0('0x19')+_0x2a5318[_0x51b0('0x17')]+'\x20('+_0x2a5318[_0x51b0('0x18')]+')'));return;}var _0x1e6c05=fs[_0x51b0('0x1a')](_0x23222b);_0x1e6c05['on'](_0x51b0('0x1b'),function(){logger[_0x51b0('0x1c')]('finish\x20download\x20file');_0x1e6c05[_0x51b0('0x1d')](_0x5d4603);});_0x1e6c05['on'](_0x51b0('0x15'),function(_0x378917){fs['unlink'](_0x23222b);logger[_0x51b0('0x15')]('download\x20error',_0x378917);_0x4df76b(_0x378917);});_0x2a5318[_0x51b0('0x1e')](_0x1e6c05);})['on'](_0x51b0('0x15'),function(_0x15116b){logger[_0x51b0('0x15')](_0x15116b);_0x4df76b(_0x15116b);})[_0x51b0('0x1f')]();});}function uploadFile(_0x592f0c){return new BPromise(function(_0x30428b,_0x4ccd5b){var _0x11b438=urlParse(_0x592f0c);var _0x5adf4a=_0x11b438['protocol']===_0x51b0('0x20')?https:http;var _0x1d12c4={'host':_0x11b438[_0x51b0('0x21')],'path':_0x11b438[_0x51b0('0x5')],'headers':{'user-agent':_0x51b0('0x13')}};_0x5adf4a['get'](_0x1d12c4,function(_0x44098a){if(_0x44098a[_0x51b0('0x17')]!==0xc8){_0x4ccd5b(new Error(_0x51b0('0x16')+_0x592f0c+_0x51b0('0x19')+_0x44098a['statusCode']+'\x20('+_0x44098a[_0x51b0('0x18')]+')'));return;}var _0x193fa3='';_0x44098a['on'](_0x51b0('0x22'),function(_0x42d161){_0x193fa3+=_0x42d161;});_0x44098a['on'](_0x51b0('0x1f'),function(){_0x30428b(_0x193fa3);});})['on'](_0x51b0('0x15'),function(_0x5551ba){_0x4ccd5b(_0x5551ba);})[_0x51b0('0x1f')]();});}function convertFile(_0x150d98,_0x24d432){return new BPromise(function(_0x1f463a,_0x4f4b97){var _0x44d3d2=sox[_0x51b0('0x23')](_0x150d98,_0x24d432,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44d3d2['on'](_0x51b0('0x15'),function(_0x341bc8){logger[_0x51b0('0x15')](_0x51b0('0x24'),_0x341bc8);_0x4f4b97(_0x341bc8);});_0x44d3d2['on'](_0x51b0('0x1f'),function(){logger[_0x51b0('0x1c')](_0x51b0('0x25'));_0x1f463a();});_0x44d3d2['start']();});}function base64Decode(_0x377526,_0x4ac447){var _0x5df17f=path['resolve'](__dirname,_0x51b0('0x26'),rs[_0x51b0('0x27')](0x4)+'.wav');fs[_0x51b0('0x28')](_0x5df17f,_0x377526,_0x51b0('0x29'));return convertFile(_0x5df17f,_0x4ac447)[_0x51b0('0x2a')](function(){try{fs[_0x51b0('0x2b')](_0x5df17f);fs[_0x51b0('0x2c')](_0x4ac447,_0x51b0('0x2d'));}catch(_0x432afe){logger['error'](_0x432afe);}return _0x4ac447[_0x51b0('0x2e')]('.')[0x0];});}function base64Encode(_0x4c09fe){var _0xe4e585=fs[_0x51b0('0x2f')](_0x4c09fe);return new Buffer(_0xe4e585)['toString']('base64');}exports[_0x51b0('0x30')]=function(_0x1dc924,_0x1a10e1,_0x43129a,_0x575f6f,_0x1c37f3,_0xc950a5){var _0x2c777d,_0x4c14c3;var _0x2a90a5=_0x51b0('0x31');var _0x39d6a2=_0x51b0('0x32')+_0x1dc924;var _0x56744c={};if(_0x1a10e1===_0x51b0('0x33')){_0x56744c[_0x51b0('0x34')]={'ssml':_0x43129a};}else{_0x56744c[_0x51b0('0x34')]={'text':_0x43129a};};_0x56744c[_0x51b0('0x35')]={'languageCode':_0x575f6f,'ssmlGender':_0x1c37f3};_0x56744c[_0x51b0('0x36')]={'audioEncoding':_0x51b0('0x37'),'sampleRateHertz':0x1f40};var _0x5f27c0={'url':_0x2a90a5+_0x51b0('0x38')+_0x39d6a2,'method':'POST','json':!![],'body':_0x56744c};return rp(_0x5f27c0)[_0x51b0('0x2a')](function(_0x24daa9){return new BPromise(function(_0x1041c1,_0xfedd5d){_0x2c777d=path[_0x51b0('0x39')](__dirname,_0x51b0('0x26'),rs[_0x51b0('0x27')](0x4)+_0x51b0('0x3a'));var _0x534e4d=Buffer[_0x51b0('0x3b')](_0x24daa9[_0x51b0('0x3c')],'base64');return fs['writeFile'](_0x2c777d,_0x534e4d,function(_0x64ff3){_0xfedd5d(_0x64ff3);},function(_0x12fc86){fs[_0x51b0('0x2c')](_0x2c777d,_0x51b0('0x2d'));_0x1041c1(_0x12fc86);});});})['then'](function(_0x371ee2){_0x4c14c3=path[_0x51b0('0x39')](__dirname,_0x51b0('0x26'),rs[_0x51b0('0x27')](0x4)+'.wav');return convertFile(_0x2c777d,_0x4c14c3);})[_0x51b0('0x2a')](function(){try{fs['unlink'](_0x2c777d);fs[_0x51b0('0x2c')](_0x4c14c3,_0x51b0('0x2d'));}catch(_0x4dcda5){logger[_0x51b0('0x15')](_0x4dcda5);}logger['info'](_0x51b0('0x3d'),_0x4c14c3[_0x51b0('0x2e')]('.')[0x0]);return _0x4c14c3['split']('.')[0x0];});};exports[_0x51b0('0x3e')]=function(_0x13eeb3,_0x31d5ea){var _0x4b0fb6=_0x51b0('0x3f');var _0x12f32e,_0x489a65;var _0x3d4dff;var _0x5362fe={'encoding':_0x51b0('0x40'),'method':_0x51b0('0x41'),'timeout':0x2710,'url':_0x4b0fb6,'headers':{'Content-Type':_0x51b0('0x42')},'body':'f.req='+encodeURIComponent(JSON[_0x51b0('0x43')]([[['jQ1olc',JSON[_0x51b0('0x43')]([_0x13eeb3,_0x31d5ea||'en',![],_0x51b0('0x44')]),null,'generic']]]))};return rp(_0x5362fe)['then'](function(_0x288d7d){try{_0x3d4dff=eval(_0x288d7d[_0x51b0('0x45')](0x5))[0x0][0x2];}catch(_0x4cf899){throw new Error('parse\x20response\x20failed:\x0a'+_0x288d7d[_0x51b0('0x22')]);}if(!_0x3d4dff){if(_0x13eeb3[_0x51b0('0x46')]>0xc8){throw new Error(_0x51b0('0x47'));}else{throw new Error(_0x51b0('0x48')+_0x31d5ea+_0x51b0('0x49'));}}try{_0x3d4dff=eval(_0x3d4dff)[0x0];}catch(_0x5888ea){throw new Error(_0x51b0('0x4a')+res['data']);}const _0x1a1632=_0x3d4dff;_0x12f32e=path['resolve'](__dirname,'tmp',rs[_0x51b0('0x27')](0x4)+_0x51b0('0x3a'));fs['writeFileSync'](_0x12f32e,_0x3d4dff,{'encoding':_0x51b0('0x29')});_0x489a65=path[_0x51b0('0x39')](__dirname,_0x51b0('0x26'),rs[_0x51b0('0x27')](0x4)+_0x51b0('0x4b'));return convertFile(_0x12f32e,_0x489a65);})[_0x51b0('0x2a')](function(){try{fs[_0x51b0('0x2b')](_0x12f32e);fs[_0x51b0('0x2c')](_0x489a65,_0x51b0('0x2d'));}catch(_0x9202a2){logger['error'](_0x9202a2);}logger[_0x51b0('0x1c')](_0x51b0('0x4c'),_0x489a65[_0x51b0('0x2e')]('.')[0x0]);return _0x489a65[_0x51b0('0x2e')]('.')[0x0];});};exports[_0x51b0('0x4d')]=function(_0x14d4fa,_0x573058,_0x24651b){return google['asr'](_0x14d4fa,_0x573058,_0x24651b)['then'](function(_0x8a49ee){logger[_0x51b0('0x1c')](_0x8a49ee[_0x51b0('0x4e')]);return rp(_0x8a49ee);})[_0x51b0('0x2a')](function(_0x44b2c2){var _0xd6304a='';var _0x5f1d7f=0x0;try{fs[_0x51b0('0x2b')](_0x14d4fa);}catch(_0x516255){logger['error'](_0x516255);}if(_0x44b2c2&&_0x44b2c2['results']){_0xd6304a=_0x44b2c2['results'][_0x51b0('0x4f')](function(_0x8cbe1a){return _0x8cbe1a&&_0x8cbe1a[_0x51b0('0x50')][0x0]&&_0x8cbe1a[_0x51b0('0x50')][0x0][_0x51b0('0x51')]?_0x8cbe1a['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x5f1d7f=_0x44b2c2[_0x51b0('0x52')][_0x51b0('0x4f')](function(_0x20ed8c){return _0x20ed8c&&_0x20ed8c[_0x51b0('0x50')][0x0]&&_0x20ed8c['alternatives'][0x0][_0x51b0('0x53')]?_0x20ed8c[_0x51b0('0x50')][0x0][_0x51b0('0x53')]:0x0;})[_0x51b0('0x54')]('\x0a');}logger[_0x51b0('0x1c')]('googleASR\x20transcription',_0xd6304a);logger['info'](_0x51b0('0x55'),_0x5f1d7f);return{'transcript':_0xd6304a,'confidence':_0x5f1d7f};})['catch'](function(_0x2c546c){logger[_0x51b0('0x15')](_0x51b0('0x56'),_0x2c546c[_0x51b0('0x17')],_0x2c546c[_0x51b0('0x57')],_0x2c546c['message']);});};exports[_0x51b0('0x58')]=function(_0x2afef3,_0x189b6e,_0x2142b1,_0x5bf7f6){var _0x1f9d76=apiai(_0x189b6e,{'language':_0x5bf7f6||'en'});return _0x1f9d76[_0x51b0('0x59')](_0x2142b1,{'sessionId':md5(_0x2afef3)})[_0x51b0('0x2a')](function(_0x488a93){logger[_0x51b0('0x1c')](JSON[_0x51b0('0x43')](_0x488a93));return{'source':_0x488a93['result'][_0x51b0('0x5a')],'resolvedQuery':_0x488a93[_0x51b0('0x5b')]['resolvedQuery'],'action':_0x488a93[_0x51b0('0x5b')][_0x51b0('0x5c')],'actionIncomplete':_0x488a93['result'][_0x51b0('0x5d')],'speech':_0x488a93[_0x51b0('0x5b')][_0x51b0('0x5e')][_0x51b0('0x5f')],'score':_0x488a93[_0x51b0('0x5b')][_0x51b0('0x60')],'statusCode':_0x488a93['status'][_0x51b0('0x61')],'endConversation':_0x488a93[_0x51b0('0x5b')][_0x51b0('0x62')][_0x51b0('0x63')]||![],'isFallbackIntent':_0x488a93[_0x51b0('0x5b')][_0x51b0('0x62')][_0x51b0('0x64')]};});};exports[_0x51b0('0x65')]=function(_0x136247,_0x44722a,_0x1ad504,_0xd5076,_0x4b8a51,_0x4a335b){var _0x14d064=_0xd5076[_0x51b0('0x66')](/\\n/g,'\x0a');var _0x19dc6a={'credentials':{'private_key':_0x14d064,'client_email':_0x1ad504}};var _0x513895=new dialogflow['SessionsClient'](_0x19dc6a);var _0x228466=_0x513895['sessionPath'](_0x44722a,md5(_0x136247));var _0x18f660={'session':_0x228466,'queryInput':{'text':{'text':_0x4b8a51,'languageCode':_0x4a335b}}};return _0x513895[_0x51b0('0x67')](_0x18f660)[_0x51b0('0x2a')](function(_0x2f1fd5){if(_0x2f1fd5&&_0x2f1fd5[_0x51b0('0x46')]){logger[_0x51b0('0x1c')]('Dialogflow\x20V2\x20response:',JSON[_0x51b0('0x43')](_0x2f1fd5));var _0x3c41b4=_0x2f1fd5[0x0];if(_0x3c41b4){var _0x318134={'action':_0x3c41b4[_0x51b0('0x68')][_0x51b0('0x5c')],'allRequiredParamsPresent':_0x3c41b4['queryResult'][_0x51b0('0x69')],'endConversation':_0x3c41b4[_0x51b0('0x68')]['diagnosticInfo']&&_0x3c41b4['queryResult'][_0x51b0('0x6a')][_0x51b0('0x6b')]?_0x3c41b4[_0x51b0('0x68')][_0x51b0('0x6a')][_0x51b0('0x6b')][_0x51b0('0x6c')][_0x51b0('0x6d')]:![],'fulfillmentText':_0x3c41b4[_0x51b0('0x68')][_0x51b0('0x6e')],'intentName':_0x3c41b4[_0x51b0('0x68')]['intent'][_0x51b0('0x57')],'intentDisplayName':_0x3c41b4[_0x51b0('0x68')][_0x51b0('0x6f')]['displayName'],'isFallbackIntent':_0x3c41b4[_0x51b0('0x68')]['intent'][_0x51b0('0x70')],'languageCode':_0x3c41b4[_0x51b0('0x68')][_0x51b0('0x71')],'queryText':_0x3c41b4[_0x51b0('0x68')][_0x51b0('0x72')],'responseId':_0x3c41b4[_0x51b0('0x73')],'score':_0x3c41b4[_0x51b0('0x68')]['intentDetectionConfidence'],'speech':_0x3c41b4[_0x51b0('0x68')][_0x51b0('0x6e')],'providerResponse':JSON[_0x51b0('0x43')](_0x2f1fd5)};return _0x318134;}}});};exports[_0x51b0('0x74')]=function(_0xa8ad9b,_0x9982b7,_0x48b023,_0x23c13e){return tilde['asr'](_0xa8ad9b,_0x9982b7,_0x48b023,_0x23c13e)[_0x51b0('0x2a')](function(_0x41e165){try{fs[_0x51b0('0x2b')](_0xa8ad9b);}catch(_0x43b287){logger[_0x51b0('0x15')](_0x43b287);}logger[_0x51b0('0x1c')](_0x51b0('0x75'),_0x41e165[_0x51b0('0x51')]);logger[_0x51b0('0x1c')](_0x51b0('0x76'),_0x41e165[_0x51b0('0x53')]);return _0x41e165;});};exports[_0x51b0('0x77')]=function(_0x2374f4,_0x29d5f0,_0xd32736,_0x2e8ce2,_0x2ee7d7,_0x3276fd){var _0x236dc1=path[_0x51b0('0x39')](__dirname,_0x51b0('0x26'),rs[_0x51b0('0x27')](0x4)+_0x51b0('0x3a'));var _0x1b77dd;return aws['polly'](_0x2374f4,_0x29d5f0,_0xd32736,_0x2e8ce2,_0x2ee7d7,_0x3276fd,_0x236dc1)[_0x51b0('0x2a')](function(){_0x1b77dd=path[_0x51b0('0x39')](__dirname,_0x51b0('0x26'),rs[_0x51b0('0x27')](0x4)+'.wav');return convertFile(_0x236dc1,_0x1b77dd);})[_0x51b0('0x2a')](function(){try{fs['unlink'](_0x236dc1);fs[_0x51b0('0x2c')](_0x1b77dd,_0x51b0('0x2d'));}catch(_0x17b8a1){logger[_0x51b0('0x15')](_0x17b8a1);}return _0x1b77dd[_0x51b0('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x5b25a7,_0x1aedf4,_0x4142bf,_0x420dab,_0x47d1c7,_0x2c8439){return aws[_0x51b0('0x78')](_0x5b25a7,_0x1aedf4,_0x4142bf,_0x420dab,_0x47d1c7,_0x2c8439)[_0x51b0('0x2a')](function(_0x511b18){logger[_0x51b0('0x1c')](JSON[_0x51b0('0x43')](_0x511b18));return _0x511b18;});};exports[_0x51b0('0x79')]=function(_0x25b436,_0x1b2ba9,_0x5b94f1,_0x5e3d33){var _0x4740cc=util[_0x51b0('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x25b436,encodeURIComponent(_0x1b2ba9),_0x5b94f1,_0x5e3d33);var _0x2cea44=path[_0x51b0('0x39')](__dirname,_0x51b0('0x26'),rs[_0x51b0('0x27')](0x4)+_0x51b0('0x3a'));var _0x4a3abc;return downloadFile(_0x4740cc,_0x2cea44)[_0x51b0('0x2a')](function(){_0x4a3abc=path[_0x51b0('0x39')](__dirname,_0x51b0('0x26'),rs['generate'](0x4)+_0x51b0('0x4b'));return convertFile(_0x2cea44,_0x4a3abc);})[_0x51b0('0x2a')](function(){try{fs[_0x51b0('0x2b')](_0x2cea44);fs[_0x51b0('0x2c')](_0x4a3abc,_0x51b0('0x2d'));}catch(_0x5707c4){logger[_0x51b0('0x15')](_0x5707c4);}return _0x4a3abc['split']('.')[0x0];});};exports[_0x51b0('0x7b')]=function(_0x496877,_0x14fb1c,_0x21170d,_0x9eb66c){var _0x1af6a3=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x14fb1c,_0x21170d,base64Encode(_0x496877),_0x9eb66c?util[_0x51b0('0x7a')](_0x51b0('0x7c'),encodeURIComponent(_0x9eb66c)):_0x51b0('0x7d'));return uploadFile(_0x1af6a3)[_0x51b0('0x2a')](function(_0x20f285){return querystring[_0x51b0('0xb')](_0x20f285);});};exports[_0x51b0('0x7e')]=function(_0xc83b48,_0x553d7d){return sestek[_0x51b0('0x7f')](_0xc83b48,_0x553d7d)[_0x51b0('0x2a')](function(_0x3da5e7){logger[_0x51b0('0x1c')](JSON[_0x51b0('0x43')](_0x3da5e7));var _0x66ae71={'speech':_0x3da5e7[_0x51b0('0x80')],'action':_0x3da5e7[_0x51b0('0x81')]?_0x3da5e7['channelData']['CustomAction']:undefined,'actiondata':_0x3da5e7[_0x51b0('0x81')]?_0x3da5e7[_0x51b0('0x81')][_0x51b0('0x82')]:undefined};if(_0x3da5e7[_0x51b0('0x81')]&&_0x3da5e7[_0x51b0('0x81')][_0x51b0('0x83')]){return base64Decode(_0x3da5e7[_0x51b0('0x81')][_0x51b0('0x83')][_0x51b0('0x84')],path[_0x51b0('0x39')](__dirname,_0x51b0('0x26'),rs['generate'](0x4)+_0x51b0('0x4b')))['then'](function(_0x82bf6c){_0x66ae71[_0x51b0('0x85')]=_0x82bf6c;return _0x66ae71;});}return _0x66ae71;});};exports[_0x51b0('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x948c=['text\x20length\x20limit\x20reached','lang\x20\x22','data','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','resolvedQuery','actionIncomplete','fulfillment','score','code','metadata','endConversation','googleDialogflowV2','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','finish','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','WHAT_EVER','transcode','wav','info','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then','unlink','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','from','audioContent','writeFile','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','length'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x948c,0xbe));var _0xc948=function(_0x2baa5d,_0x42a1cb){_0x2baa5d=_0x2baa5d-0x0;var _0x88bf18=_0x948c[_0x2baa5d];return _0x88bf18;};'use strict';var apiai=require(_0xc948('0x0'));var BPromise=require(_0xc948('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0xc948('0x2'));var md5=require(_0xc948('0x3'));var path=require(_0xc948('0x4'));var querystring=require(_0xc948('0x5'));var rp=require(_0xc948('0x6'));var rs=require(_0xc948('0x7'));var sox=require(_0xc948('0x8'));var tts=require(_0xc948('0x9'));var urlParse=require('url')[_0xc948('0xa')];var util=require(_0xc948('0xb'));var aws=require(_0xc948('0xc'));var google=require('./google');var sestek=require(_0xc948('0xd'));var tilde=require(_0xc948('0xe'));var logger=require(_0xc948('0xf'))(_0xc948('0x10'));var ISPEECH_API=_0xc948('0x11');function downloadFile(_0x45ec7f,_0x796ba6){return new BPromise(function(_0x4a95dc,_0x126199){var _0x1da37e=urlParse(_0x45ec7f);var _0x4f051c=_0x1da37e['protocol']===_0xc948('0x12')?https:http;var _0x26c930={'host':_0x1da37e[_0xc948('0x13')],'path':_0x1da37e[_0xc948('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x4f051c[_0xc948('0x14')](_0x26c930,function(_0x145189){if(_0x145189['statusCode']!==0xc8){logger[_0xc948('0x15')](_0xc948('0x16')+_0x45ec7f+_0xc948('0x17')+_0x145189['statusCode']+'\x20('+_0x145189[_0xc948('0x18')]+')');_0x126199(new Error(_0xc948('0x16')+_0x45ec7f+'\x20failed,\x20status\x20code\x20=\x20'+_0x145189[_0xc948('0x19')]+'\x20('+_0x145189[_0xc948('0x18')]+')'));return;}var _0x4815ed=fs['createWriteStream'](_0x796ba6);_0x4815ed['on'](_0xc948('0x1a'),function(){logger['info'](_0xc948('0x1b'));_0x4815ed[_0xc948('0x1c')](_0x4a95dc);});_0x4815ed['on'](_0xc948('0x15'),function(_0x3049ef){fs['unlink'](_0x796ba6);logger['error'](_0xc948('0x1d'),_0x3049ef);_0x126199(_0x3049ef);});_0x145189[_0xc948('0x1e')](_0x4815ed);})['on'](_0xc948('0x15'),function(_0x1f1df0){logger[_0xc948('0x15')](_0x1f1df0);_0x126199(_0x1f1df0);})[_0xc948('0x1f')]();});}function uploadFile(_0x1b5d88){return new BPromise(function(_0x41f78f,_0x2dab0b){var _0x3d2c24=urlParse(_0x1b5d88);var _0x1917ba=_0x3d2c24[_0xc948('0x20')]===_0xc948('0x12')?https:http;var _0x4781e8={'host':_0x3d2c24['host'],'path':_0x3d2c24[_0xc948('0x4')],'headers':{'user-agent':_0xc948('0x21')}};_0x1917ba[_0xc948('0x14')](_0x4781e8,function(_0xe1a907){if(_0xe1a907[_0xc948('0x19')]!==0xc8){_0x2dab0b(new Error(_0xc948('0x16')+_0x1b5d88+_0xc948('0x17')+_0xe1a907[_0xc948('0x19')]+'\x20('+_0xe1a907[_0xc948('0x18')]+')'));return;}var _0x1dbf68='';_0xe1a907['on']('data',function(_0x292cb8){_0x1dbf68+=_0x292cb8;});_0xe1a907['on']('end',function(){_0x41f78f(_0x1dbf68);});})['on']('error',function(_0x59668d){_0x2dab0b(_0x59668d);})[_0xc948('0x1f')]();});}function convertFile(_0x3b1b2d,_0x3a9201){return new BPromise(function(_0x30f9c4,_0x4f81b3){var _0x392cdf=sox[_0xc948('0x22')](_0x3b1b2d,_0x3a9201,{'sampleRate':0x1f40,'format':_0xc948('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x392cdf['on'](_0xc948('0x15'),function(_0x509b44){logger[_0xc948('0x15')]('error\x20convert',_0x509b44);_0x4f81b3(_0x509b44);});_0x392cdf['on'](_0xc948('0x1f'),function(){logger[_0xc948('0x24')](_0xc948('0x25'));_0x30f9c4();});_0x392cdf[_0xc948('0x26')]();});}function base64Decode(_0xf50f3a,_0xfd2665){var _0x55f813=path[_0xc948('0x27')](__dirname,_0xc948('0x28'),rs['generate'](0x4)+_0xc948('0x29'));fs[_0xc948('0x2a')](_0x55f813,_0xf50f3a,'base64');return convertFile(_0x55f813,_0xfd2665)[_0xc948('0x2b')](function(){try{fs[_0xc948('0x2c')](_0x55f813);fs[_0xc948('0x2d')](_0xfd2665,_0xc948('0x2e'));}catch(_0x5be995){logger[_0xc948('0x15')](_0x5be995);}return _0xfd2665[_0xc948('0x2f')]('.')[0x0];});}function base64Encode(_0x217f0b){var _0x1de336=fs[_0xc948('0x30')](_0x217f0b);return new Buffer(_0x1de336)[_0xc948('0x31')](_0xc948('0x32'));}exports[_0xc948('0x33')]=function(_0x2b3c9a,_0x213f6c,_0x45ed72,_0x2e04dc,_0x222655,_0x368536){var _0x439a9c,_0x37daa0;var _0x3efeb0='https://texttospeech.googleapis.com/v1/';var _0x5d8491='?key='+_0x2b3c9a;var _0x5eafd2={};if(_0x213f6c===_0xc948('0x34')){_0x5eafd2[_0xc948('0x35')]={'ssml':_0x45ed72};}else{_0x5eafd2[_0xc948('0x35')]={'text':_0x45ed72};};_0x5eafd2[_0xc948('0x36')]={'languageCode':_0x2e04dc,'ssmlGender':_0x222655};_0x5eafd2[_0xc948('0x37')]={'audioEncoding':_0xc948('0x38'),'sampleRateHertz':0x1f40};var _0x5e7baa={'url':_0x3efeb0+'text:synthesize'+_0x5d8491,'method':_0xc948('0x39'),'json':!![],'body':_0x5eafd2};return rp(_0x5e7baa)['then'](function(_0x294ec3){return new BPromise(function(_0x5c796b,_0x3a252c){_0x439a9c=path['resolve'](__dirname,_0xc948('0x28'),rs[_0xc948('0x3a')](0x4)+_0xc948('0x3b'));var _0x520b24=Buffer[_0xc948('0x3c')](_0x294ec3[_0xc948('0x3d')],_0xc948('0x32'));return fs[_0xc948('0x3e')](_0x439a9c,_0x520b24,function(_0x313db4){_0x3a252c(_0x313db4);},function(_0x5ecbd9){fs[_0xc948('0x2d')](_0x439a9c,_0xc948('0x2e'));_0x5c796b(_0x5ecbd9);});});})[_0xc948('0x2b')](function(_0xfc4064){_0x37daa0=path[_0xc948('0x27')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x439a9c,_0x37daa0);})[_0xc948('0x2b')](function(){try{fs['unlink'](_0x439a9c);fs[_0xc948('0x2d')](_0x37daa0,_0xc948('0x2e'));}catch(_0x209fd2){logger[_0xc948('0x15')](_0x209fd2);}logger['info']('googleCloudTTS\x20path',_0x37daa0[_0xc948('0x2f')]('.')[0x0]);return _0x37daa0[_0xc948('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x4ebea2,_0x361b59){var _0x436abb=_0xc948('0x3f');var _0x5c6bec,_0x4ff188;var _0x2c0782;var _0x43ca41={'encoding':_0xc948('0x40'),'method':'POST','timeout':0x2710,'url':_0x436abb,'headers':{'Content-Type':_0xc948('0x41')},'body':_0xc948('0x42')+encodeURIComponent(JSON[_0xc948('0x43')]([[['jQ1olc',JSON[_0xc948('0x43')]([_0x4ebea2,_0x361b59||'en',![],_0xc948('0x44')]),null,'generic']]]))};return rp(_0x43ca41)[_0xc948('0x2b')](function(_0x5be9df){try{_0x2c0782=eval(_0x5be9df[_0xc948('0x45')](0x5))[0x0][0x2];}catch(_0xf68fef){throw new Error(_0xc948('0x46')+_0x5be9df['data']);}if(!_0x2c0782){if(_0x4ebea2[_0xc948('0x47')]>0xc8){throw new Error(_0xc948('0x48'));}else{throw new Error(_0xc948('0x49')+_0x361b59+'\x22\x20might\x20not\x20exist');}}try{_0x2c0782=eval(_0x2c0782)[0x0];}catch(_0x787a14){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xc948('0x4a')]);}const _0xf459a1=_0x2c0782;_0x5c6bec=path['resolve'](__dirname,_0xc948('0x28'),rs[_0xc948('0x3a')](0x4)+_0xc948('0x3b'));fs[_0xc948('0x2a')](_0x5c6bec,_0x2c0782,{'encoding':_0xc948('0x32')});_0x4ff188=path[_0xc948('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xc948('0x29'));return convertFile(_0x5c6bec,_0x4ff188);})['then'](function(){try{fs[_0xc948('0x2c')](_0x5c6bec);fs[_0xc948('0x2d')](_0x4ff188,_0xc948('0x2e'));}catch(_0x18f226){logger[_0xc948('0x15')](_0x18f226);}logger[_0xc948('0x24')]('goggleTTS\x20path',_0x4ff188[_0xc948('0x2f')]('.')[0x0]);return _0x4ff188[_0xc948('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x2a0ac6,_0x2f6702,_0x163d60){return google[_0xc948('0x4b')](_0x2a0ac6,_0x2f6702,_0x163d60)[_0xc948('0x2b')](function(_0x3dadc9){logger[_0xc948('0x24')](_0x3dadc9[_0xc948('0x4c')]);return rp(_0x3dadc9);})['then'](function(_0x1ee242){var _0x41963f='';var _0x317967=0x0;try{fs['unlink'](_0x2a0ac6);}catch(_0x21d786){logger['error'](_0x21d786);}if(_0x1ee242&&_0x1ee242['results']){_0x41963f=_0x1ee242[_0xc948('0x4d')]['map'](function(_0x2b1803){return _0x2b1803&&_0x2b1803['alternatives'][0x0]&&_0x2b1803[_0xc948('0x4e')][0x0][_0xc948('0x4f')]?_0x2b1803[_0xc948('0x4e')][0x0]['transcript']:'';})[_0xc948('0x50')]('\x0a');_0x317967=_0x1ee242[_0xc948('0x4d')]['map'](function(_0x324084){return _0x324084&&_0x324084['alternatives'][0x0]&&_0x324084['alternatives'][0x0]['confidence']?_0x324084[_0xc948('0x4e')][0x0][_0xc948('0x51')]:0x0;})[_0xc948('0x50')]('\x0a');}logger['info']('googleASR\x20transcription',_0x41963f);logger[_0xc948('0x24')](_0xc948('0x52'),_0x317967);return{'transcript':_0x41963f,'confidence':_0x317967};})[_0xc948('0x53')](function(_0x34aae1){logger[_0xc948('0x15')](_0xc948('0x54'),_0x34aae1[_0xc948('0x19')],_0x34aae1[_0xc948('0x55')],_0x34aae1['message']);});};exports[_0xc948('0x56')]=function(_0x4cf8d9,_0x5de4e9,_0x1b890b,_0x5d3c03){var _0x220720=apiai(_0x5de4e9,{'language':_0x5d3c03||'en'});return _0x220720[_0xc948('0x57')](_0x1b890b,{'sessionId':md5(_0x4cf8d9)})['then'](function(_0x500d07){logger[_0xc948('0x24')](JSON[_0xc948('0x43')](_0x500d07));return{'source':_0x500d07['result']['source'],'resolvedQuery':_0x500d07[_0xc948('0x58')][_0xc948('0x59')],'action':_0x500d07['result']['action'],'actionIncomplete':_0x500d07[_0xc948('0x58')][_0xc948('0x5a')],'speech':_0x500d07['result'][_0xc948('0x5b')]['speech'],'score':_0x500d07[_0xc948('0x58')][_0xc948('0x5c')],'statusCode':_0x500d07['status'][_0xc948('0x5d')],'endConversation':_0x500d07[_0xc948('0x58')][_0xc948('0x5e')][_0xc948('0x5f')]||![],'isFallbackIntent':_0x500d07[_0xc948('0x58')][_0xc948('0x5e')]['isFallbackIntent']};});};exports[_0xc948('0x60')]=function(_0x42d9a7,_0x27dc04,_0x599609,_0x7bc650,_0x123271,_0xc08414){var _0x5ac953=_0x7bc650[_0xc948('0x61')](/\\n/g,'\x0a');var _0x3ea1fd={'credentials':{'private_key':_0x5ac953,'client_email':_0x599609}};var _0x2eac51=new dialogflow['SessionsClient'](_0x3ea1fd);var _0x242770=_0x2eac51['sessionPath'](_0x27dc04,md5(_0x42d9a7));var _0x5e5667={'session':_0x242770,'queryInput':{'text':{'text':_0x123271,'languageCode':_0xc08414}}};return _0x2eac51[_0xc948('0x62')](_0x5e5667)[_0xc948('0x2b')](function(_0xc191b8){if(_0xc191b8&&_0xc191b8[_0xc948('0x47')]){logger[_0xc948('0x24')](_0xc948('0x63'),JSON[_0xc948('0x43')](_0xc191b8));var _0x18016d=_0xc191b8[0x0];if(_0x18016d){var _0x393253={'action':_0x18016d[_0xc948('0x64')][_0xc948('0x65')],'allRequiredParamsPresent':_0x18016d[_0xc948('0x64')][_0xc948('0x66')],'endConversation':_0x18016d['queryResult']['diagnosticInfo']&&_0x18016d[_0xc948('0x64')][_0xc948('0x67')][_0xc948('0x68')]?_0x18016d[_0xc948('0x64')]['diagnosticInfo'][_0xc948('0x68')]['end_conversation'][_0xc948('0x69')]:![],'fulfillmentText':_0x18016d[_0xc948('0x64')][_0xc948('0x6a')],'intentName':_0x18016d[_0xc948('0x64')][_0xc948('0x6b')][_0xc948('0x55')],'intentDisplayName':_0x18016d['queryResult']['intent']['displayName'],'isFallbackIntent':_0x18016d[_0xc948('0x64')][_0xc948('0x6b')][_0xc948('0x6c')],'languageCode':_0x18016d[_0xc948('0x64')][_0xc948('0x6d')],'queryText':_0x18016d['queryResult']['queryText'],'responseId':_0x18016d[_0xc948('0x6e')],'score':_0x18016d[_0xc948('0x64')][_0xc948('0x6f')],'speech':_0x18016d[_0xc948('0x64')][_0xc948('0x6a')],'providerResponse':JSON[_0xc948('0x43')](_0xc191b8)};return _0x393253;}}});};exports[_0xc948('0x70')]=function(_0x5c5a5b,_0x46a7bd,_0x65402a,_0x390e09){return tilde[_0xc948('0x4b')](_0x5c5a5b,_0x46a7bd,_0x65402a,_0x390e09)['then'](function(_0x4e6649){try{fs['unlink'](_0x5c5a5b);}catch(_0x3a10ac){logger[_0xc948('0x15')](_0x3a10ac);}logger[_0xc948('0x24')]('Tilde\x20ASR\x20transcription',_0x4e6649[_0xc948('0x4f')]);logger['info'](_0xc948('0x71'),_0x4e6649[_0xc948('0x51')]);return _0x4e6649;});};exports[_0xc948('0x72')]=function(_0x3eeda0,_0x57f3ca,_0x183269,_0x21df08,_0x1a4603,_0x2b3416){var _0x195680=path[_0xc948('0x27')](__dirname,_0xc948('0x28'),rs['generate'](0x4)+_0xc948('0x3b'));var _0x7f08a9;return aws[_0xc948('0x73')](_0x3eeda0,_0x57f3ca,_0x183269,_0x21df08,_0x1a4603,_0x2b3416,_0x195680)[_0xc948('0x2b')](function(){_0x7f08a9=path[_0xc948('0x27')](__dirname,_0xc948('0x28'),rs[_0xc948('0x3a')](0x4)+_0xc948('0x29'));return convertFile(_0x195680,_0x7f08a9);})[_0xc948('0x2b')](function(){try{fs['unlink'](_0x195680);fs['chmodSync'](_0x7f08a9,_0xc948('0x2e'));}catch(_0x264f3b){logger['error'](_0x264f3b);}return _0x7f08a9[_0xc948('0x2f')]('.')[0x0];});};exports[_0xc948('0x74')]=function(_0x3fc1b7,_0xfc56d6,_0x3f49fd,_0x200e9e,_0x24b82f,_0x26fbb3){return aws['lex'](_0x3fc1b7,_0xfc56d6,_0x3f49fd,_0x200e9e,_0x24b82f,_0x26fbb3)[_0xc948('0x2b')](function(_0x426c92){logger[_0xc948('0x24')](JSON[_0xc948('0x43')](_0x426c92));return _0x426c92;});};exports[_0xc948('0x75')]=function(_0xd1f63c,_0x3331d6,_0x9e80d9,_0x380228){var _0x21f9c4=util[_0xc948('0x76')](_0xc948('0x77'),ISPEECH_API,_0xd1f63c,encodeURIComponent(_0x3331d6),_0x9e80d9,_0x380228);var _0x1c7e8a=path[_0xc948('0x27')](__dirname,_0xc948('0x28'),rs[_0xc948('0x3a')](0x4)+_0xc948('0x3b'));var _0x35d3d8;return downloadFile(_0x21f9c4,_0x1c7e8a)['then'](function(){_0x35d3d8=path['resolve'](__dirname,_0xc948('0x28'),rs[_0xc948('0x3a')](0x4)+_0xc948('0x29'));return convertFile(_0x1c7e8a,_0x35d3d8);})['then'](function(){try{fs[_0xc948('0x2c')](_0x1c7e8a);fs[_0xc948('0x2d')](_0x35d3d8,_0xc948('0x2e'));}catch(_0xed7380){logger[_0xc948('0x15')](_0xed7380);}return _0x35d3d8[_0xc948('0x2f')]('.')[0x0];});};exports['ispeechASR']=function(_0x419da1,_0x16de56,_0x328413,_0xfebec5){var _0x5d94ac=util[_0xc948('0x76')](_0xc948('0x78'),ISPEECH_API,_0x16de56,_0x328413,base64Encode(_0x419da1),_0xfebec5?util[_0xc948('0x76')]('model=%s',encodeURIComponent(_0xfebec5)):'freeform=3');return uploadFile(_0x5d94ac)[_0xc948('0x2b')](function(_0x2f10d6){return querystring[_0xc948('0xa')](_0x2f10d6);});};exports[_0xc948('0x79')]=function(_0x367498,_0x3e468c){return sestek[_0xc948('0x7a')](_0x367498,_0x3e468c)[_0xc948('0x2b')](function(_0x5d07f0){logger['info'](JSON[_0xc948('0x43')](_0x5d07f0));var _0x63ff05={'speech':_0x5d07f0[_0xc948('0x7b')],'action':_0x5d07f0[_0xc948('0x7c')]?_0x5d07f0[_0xc948('0x7c')][_0xc948('0x7d')]:undefined,'actiondata':_0x5d07f0[_0xc948('0x7c')]?_0x5d07f0[_0xc948('0x7c')][_0xc948('0x7e')]:undefined};if(_0x5d07f0[_0xc948('0x7c')]&&_0x5d07f0[_0xc948('0x7c')][_0xc948('0x7f')]){return base64Decode(_0x5d07f0[_0xc948('0x7c')]['AudioFromTts'][_0xc948('0x80')],path['resolve'](__dirname,_0xc948('0x28'),rs[_0xc948('0x3a')](0x4)+_0xc948('0x29')))[_0xc948('0x2b')](function(_0x3d1978){_0x63ff05[_0xc948('0x81')]=_0x3d1978;return _0x63ff05;});}return _0x63ff05;});};exports[_0xc948('0x82')]=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 8f34e03..59a620f 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0x59bb=['exports'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x59bb,0x168));var _0xb59b=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x59bb[_0x2b4411];return _0x8e41ef;};var nda=require('./nda');module[_0xb59b('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index a8bb69e..9e91d40 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 _0xdadd=['AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','stringify','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio'];(function(_0x407151,_0x5aabd9){var _0x186f51=function(_0x752679){while(--_0x752679){_0x407151['push'](_0x407151['shift']());}};_0x186f51(++_0x5aabd9);}(_0xdadd,0x1c8));var _0xddad=function(_0x139a23,_0x184a3f){_0x139a23=_0x139a23-0x0;var _0x4da424=_0xdadd[_0x139a23];return _0x4da424;};'use strict';var rp=require(_0xddad('0x0'));var url=require('url');var logger=require(_0xddad('0x1'))('agi');module[_0xddad('0x2')]=function(_0x31c5bd,_0x17515e){var _0x484d96={'method':_0xddad('0x3'),'uri':url[_0xddad('0x4')](_0x17515e[_0xddad('0x5')],_0xddad('0x6')),'form':{'grant_type':'password','username':_0x17515e['username'],'password':_0x17515e[_0xddad('0x7')]},'json':!![]};return rp(_0x484d96)[_0xddad('0x8')](function(_0x5b1c3f){var _0x40b75a={'method':_0xddad('0x3'),'uri':url[_0xddad('0x4')](_0x17515e[_0xddad('0x9')],_0xddad('0xa')),'body':{'type':_0x17515e[_0xddad('0xb')]||_0xddad('0xc'),'channelId':_0xddad('0xd'),'conversation':{'id':_0x31c5bd[_0xddad('0xe')]},'from':{'id':_0x31c5bd['callerid'],'name':_0x31c5bd[_0xddad('0xf')]},'recipient':{'id':_0x31c5bd[_0xddad('0x10')],'name':_0x31c5bd[_0xddad('0x11')]},'text':_0x17515e['text'],'channelData':{}},'headers':{'Authorization':_0xddad('0x12')+_0x5b1c3f['access_token']},'json':!![]};if(_0x17515e[_0xddad('0x13')]){_0x40b75a[_0xddad('0x14')][_0xddad('0x15')][_0xddad('0x16')]=_0x17515e[_0xddad('0x13')];}if(_0x17515e[_0xddad('0x17')]=='1'){_0x40b75a['body'][_0xddad('0x15')][_0xddad('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xddad('0x19')};}if(_0x17515e[_0xddad('0x1a')]){_0x40b75a[_0xddad('0x14')][_0xddad('0x15')]['CustomAction']=_0x17515e['custom_action'];if(_0x17515e[_0xddad('0x1b')]){_0x40b75a[_0xddad('0x14')][_0xddad('0x15')][_0xddad('0x1c')]=_0x17515e[_0xddad('0x1b')];}}logger['info'](JSON[_0xddad('0x1d')](_0x40b75a));return rp(_0x40b75a);});}; \ No newline at end of file +var _0x7948=['ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve'];(function(_0x2a35d5,_0x460785){var _0x5741a7=function(_0x2d40e1){while(--_0x2d40e1){_0x2a35d5['push'](_0x2a35d5['shift']());}};_0x5741a7(++_0x460785);}(_0x7948,0x185));var _0x8794=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x7948[_0x2998db];return _0x115fea;};'use strict';var rp=require(_0x8794('0x0'));var url=require(_0x8794('0x1'));var logger=require(_0x8794('0x2'))(_0x8794('0x3'));module[_0x8794('0x4')]=function(_0x1a3805,_0x443e81){var _0x309b22={'method':_0x8794('0x5'),'uri':url[_0x8794('0x6')](_0x443e81[_0x8794('0x7')],_0x8794('0x8')),'form':{'grant_type':_0x8794('0x9'),'username':_0x443e81[_0x8794('0xa')],'password':_0x443e81[_0x8794('0x9')]},'json':!![]};return rp(_0x309b22)[_0x8794('0xb')](function(_0x22b452){var _0x27f31e={'method':_0x8794('0x5'),'uri':url[_0x8794('0x6')](_0x443e81[_0x8794('0xc')],_0x8794('0xd')),'body':{'type':_0x443e81[_0x8794('0xe')]||_0x8794('0xf'),'channelId':_0x8794('0x10'),'conversation':{'id':_0x1a3805[_0x8794('0x11')]},'from':{'id':_0x1a3805[_0x8794('0x12')],'name':_0x1a3805[_0x8794('0x13')]},'recipient':{'id':_0x1a3805[_0x8794('0x14')],'name':_0x1a3805[_0x8794('0x15')]},'text':_0x443e81[_0x8794('0x16')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x22b452[_0x8794('0x17')]},'json':!![]};if(_0x443e81[_0x8794('0x18')]){_0x27f31e[_0x8794('0x19')][_0x8794('0x1a')][_0x8794('0x1b')]=_0x443e81[_0x8794('0x18')];}if(_0x443e81[_0x8794('0x1c')]=='1'){_0x27f31e[_0x8794('0x19')][_0x8794('0x1a')][_0x8794('0x1d')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8794('0x1e')};}if(_0x443e81[_0x8794('0x1f')]){_0x27f31e[_0x8794('0x19')]['channelData'][_0x8794('0x20')]=_0x443e81['custom_action'];if(_0x443e81['custom_action_data']){_0x27f31e[_0x8794('0x19')][_0x8794('0x1a')][_0x8794('0x21')]=_0x443e81['custom_action_data'];}}logger[_0x8794('0x22')](JSON[_0x8794('0x23')](_0x27f31e));return rp(_0x27f31e);});}; \ 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 e16720c..8fc925c 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 _0x4b48=['exports','./lib/api'];(function(_0x41e276,_0x3d3f98){var _0x400b0c=function(_0x30abaf){while(--_0x30abaf){_0x41e276['push'](_0x41e276['shift']());}};_0x400b0c(++_0x3d3f98);}(_0x4b48,0x121));var _0x84b4=function(_0x44b2df,_0x1e2566){_0x44b2df=_0x44b2df-0x0;var _0x2183b7=_0x4b48[_0x44b2df];return _0x2183b7;};'use strict';var asr=require(_0x84b4('0x0'));module[_0x84b4('0x1')]=function(_0xbe6e8a,_0x4216a9,_0x2aec75,_0x869250){return asr(_0xbe6e8a,_0x4216a9,_0x2aec75,_0x869250);}; \ No newline at end of file +var _0x04b7=['./lib/api'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x04b7,0x1ce));var _0x704b=function(_0x18ce30,_0x437d06){_0x18ce30=_0x18ce30-0x0;var _0x4471a3=_0x04b7[_0x18ce30];return _0x4471a3;};'use strict';var asr=require(_0x704b('0x0'));module['exports']=function(_0x5633c2,_0x958c2e,_0x54e2d2,_0x3845c7){return asr(_0x5633c2,_0x958c2e,_0x54e2d2,_0x3845c7);}; \ 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 5abcf49..9691b7d 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 _0x662f=['hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses'];(function(_0x282fdd,_0x537167){var _0x64c3b9=function(_0x3111d6){while(--_0x3111d6){_0x282fdd['push'](_0x282fdd['shift']());}};_0x64c3b9(++_0x537167);}(_0x662f,0xca));var _0xf662=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x662f[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0xf662('0x0'));var _=require(_0xf662('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf662('0x2'));var crypto=require(_0xf662('0x3'));var logger=require(_0xf662('0x4'))(_0xf662('0x5'));module[_0xf662('0x6')]=function(_0x27e69c,_0x606090,_0x1088f8,_0x20decb){return new BPromise(function(_0x52d394,_0x3de077){logger[_0xf662('0x7')](_0xf662('0x8'),_0x20decb||_0xf662('0x9'));var _0xad7484=new WebSocket(_0x20decb||_0xf662('0x9'),{'perMessageDeflate':![]});var _0x22ba49='';var _0x255f26='0';var _0x434046='1';var _0x4a3282=_0xf662('0xa');function _0x7a24b2(_0x2f8b13){var _0x1e4800=crypto['createHash'](_0xf662('0xb'));_0x1e4800['update'](_0x2f8b13);return _0x1e4800['digest'](_0xf662('0xc'));}function _0x366fcd(){try{logger['info'](_0xf662('0xd'));var _0x2990af=moment()[_0xf662('0xe')]();var _0x1b33cb=_0x7a24b2(_0x2990af+_0x606090+_0x1088f8);_0xad7484[_0xf662('0xf')](JSON[_0xf662('0x10')]({'appID':_0x606090,'timestamp':_0x2990af,'appKey':_0x1b33cb}));var _0x213f4c=fs[_0xf662('0x11')](_0x27e69c);_0x213f4c['on'](_0xf662('0x12'),function(_0x4307f8){_0xad7484[_0xf662('0xf')](_0x4307f8);});_0x213f4c['on'](_0xf662('0x13'),function(){_0xad7484[_0xf662('0xf')]('EOS');});}catch(_0x71f581){logger[_0xf662('0x14')](_0xf662('0x15'),JSON['stringify'](_0x71f581));_0xad7484[_0xf662('0x16')]();}}function _0x42b8b8(_0x4434b0){try{if(_0x4434b0){var _0x5b3b2f=JSON['parse'](_0x4434b0);switch(_0x5b3b2f[_0xf662('0x17')]){case 0x0:if(_0x5b3b2f['result']){if(_0x5b3b2f[_0xf662('0x18')]['final']){logger[_0xf662('0x7')](_0xf662('0x19'),JSON[_0xf662('0x10')](_0x5b3b2f[_0xf662('0x18')][_0xf662('0x1a')]));_0x22ba49=_0x5b3b2f[_0xf662('0x18')]['hypotheses'][0x0]['transcript'];_0x255f26=_0x5b3b2f['result']['hypotheses'][0x0][_0xf662('0x1b')];_0x434046='0';_0x4a3282='Success.';_0xad7484['terminate']();}}break;case 0x1:logger[_0xf662('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x434046='1';_0x4a3282='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xf662('0x7')](_0xf662('0x1c'));_0x434046='2';_0x4a3282=_0xf662('0x1c');break;case 0x9:logger[_0xf662('0x7')](_0xf662('0x1d'));_0x434046='9';_0x4a3282='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xf662('0x7')](_0xf662('0x1e'));_0x434046='10';_0x4a3282='Authentication\x20failed.';break;case 0xb:logger[_0xf662('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x434046='11';_0x4a3282=_0xf662('0x1f');}}}catch(_0x13b6e0){logger[_0xf662('0x14')](_0xf662('0x20'),JSON[_0xf662('0x10')](_0x13b6e0));_0xad7484['terminate']();}}function _0x5ac592(){logger[_0xf662('0x7')](_0xf662('0x21'));_0x52d394({'transcript':_0x22ba49,'confidence':_0x255f26,'status':_0x434046,'status_message':_0x4a3282});}function _0x2adc2e(_0x27354e){logger[_0xf662('0x14')](_0xf662('0x22'));if(!_[_0xf662('0x23')](_0x27354e)){logger[_0xf662('0x14')](_[_0xf662('0x24')](_0x27354e)?JSON[_0xf662('0x10')](_0x27354e):_0x27354e);}}_0xad7484['on']('open',_0x366fcd);_0xad7484['on'](_0xf662('0x25'),_0x42b8b8);_0xad7484['on'](_0xf662('0x13'),_0x5ac592);_0xad7484['on'](_0xf662('0x14'),_0x2adc2e);});}; \ No newline at end of file +var _0xdf30=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf30,0x147));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0df3('0x0'));var crypto=require(_0x0df3('0x1'));var logger=require(_0x0df3('0x2'))(_0x0df3('0x3'));module[_0x0df3('0x4')]=function(_0xd9238b,_0x3aad7a,_0x4458f6,_0x31aa31){return new BPromise(function(_0x52425c,_0x30dd57){logger[_0x0df3('0x5')](_0x0df3('0x6'),_0x31aa31||_0x0df3('0x7'));var _0x4ff140=new WebSocket(_0x31aa31||_0x0df3('0x7'),{'perMessageDeflate':![]});var _0x57db96='';var _0x31acd5='0';var _0x2a35a9='1';var _0x124608=_0x0df3('0x8');function _0x571dfc(_0x5d8bcd){var _0x957fea=crypto['createHash'](_0x0df3('0x9'));_0x957fea[_0x0df3('0xa')](_0x5d8bcd);return _0x957fea[_0x0df3('0xb')](_0x0df3('0xc'));}function _0x2fbbab(){try{logger[_0x0df3('0x5')](_0x0df3('0xd'));var _0x25bec5=moment()[_0x0df3('0xe')]();var _0x3f63a7=_0x571dfc(_0x25bec5+_0x3aad7a+_0x4458f6);_0x4ff140[_0x0df3('0xf')](JSON['stringify']({'appID':_0x3aad7a,'timestamp':_0x25bec5,'appKey':_0x3f63a7}));var _0x5836ff=fs['createReadStream'](_0xd9238b);_0x5836ff['on'](_0x0df3('0x10'),function(_0x28c934){_0x4ff140[_0x0df3('0xf')](_0x28c934);});_0x5836ff['on'](_0x0df3('0x11'),function(){_0x4ff140[_0x0df3('0xf')](_0x0df3('0x12'));});}catch(_0x16254d){logger[_0x0df3('0x13')](_0x0df3('0x14'),JSON['stringify'](_0x16254d));_0x4ff140[_0x0df3('0x15')]();}}function _0x82f7c2(_0x57524e){try{if(_0x57524e){var _0x10c097=JSON[_0x0df3('0x16')](_0x57524e);switch(_0x10c097[_0x0df3('0x17')]){case 0x0:if(_0x10c097[_0x0df3('0x18')]){if(_0x10c097[_0x0df3('0x18')]['final']){logger[_0x0df3('0x5')](_0x0df3('0x19'),JSON[_0x0df3('0x1a')](_0x10c097['result']['hypotheses']));_0x57db96=_0x10c097[_0x0df3('0x18')][_0x0df3('0x1b')][0x0][_0x0df3('0x1c')];_0x31acd5=_0x10c097[_0x0df3('0x18')][_0x0df3('0x1b')][0x0]['likelihood'];_0x2a35a9='0';_0x124608=_0x0df3('0x1d');_0x4ff140[_0x0df3('0x15')]();}}break;case 0x1:logger[_0x0df3('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2a35a9='1';_0x124608=_0x0df3('0x8');break;case 0x2:logger[_0x0df3('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2a35a9='2';_0x124608=_0x0df3('0x1e');break;case 0x9:logger[_0x0df3('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2a35a9='9';_0x124608=_0x0df3('0x1f');break;case 0xa:logger[_0x0df3('0x5')]('Authentication\x20failed.');_0x2a35a9='10';_0x124608=_0x0df3('0x20');break;case 0xb:logger[_0x0df3('0x5')](_0x0df3('0x21'));_0x2a35a9='11';_0x124608=_0x0df3('0x21');}}}catch(_0x1cd02c){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x0df3('0x1a')](_0x1cd02c));_0x4ff140[_0x0df3('0x15')]();}}function _0x3a9c4b(){logger[_0x0df3('0x5')](_0x0df3('0x22'));_0x52425c({'transcript':_0x57db96,'confidence':_0x31acd5,'status':_0x2a35a9,'status_message':_0x124608});}function _0x422c1a(_0x474df1){logger['error'](_0x0df3('0x23'));if(!_[_0x0df3('0x24')](_0x474df1)){logger[_0x0df3('0x13')](_[_0x0df3('0x25')](_0x474df1)?JSON[_0x0df3('0x1a')](_0x474df1):_0x474df1);}}_0x4ff140['on'](_0x0df3('0x26'),_0x2fbbab);_0x4ff140['on'](_0x0df3('0x27'),_0x82f7c2);_0x4ff140['on']('close',_0x3a9c4b);_0x4ff140['on'](_0x0df3('0x13'),_0x422c1a);});}; \ 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 ad1dd7a..5c14da9 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 _0xc237=['./asr'];(function(_0x6212c,_0x15aed4){var _0x120c3b=function(_0x5646ce){while(--_0x5646ce){_0x6212c['push'](_0x6212c['shift']());}};_0x120c3b(++_0x15aed4);}(_0xc237,0x194));var _0x7c23=function(_0x210f2d,_0x56734b){_0x210f2d=_0x210f2d-0x0;var _0xab3da6=_0xc237[_0x210f2d];return _0xab3da6;};var asr=require(_0x7c23('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x4ff3=['exports','./asr'];(function(_0x3a1aae,_0x535ee1){var _0x166132=function(_0x488d9e){while(--_0x488d9e){_0x3a1aae['push'](_0x3a1aae['shift']());}};_0x166132(++_0x535ee1);}(_0x4ff3,0x119));var _0x34ff=function(_0x3545dd,_0xb80ec2){_0x3545dd=_0x3545dd-0x0;var _0x336107=_0x4ff3[_0x3545dd];return _0x336107;};var asr=require(_0x34ff('0x0'));module[_0x34ff('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b85c784..316ebc9 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 _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(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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 +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a86d26f..c6327c2 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 _0xaba6=['bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getSound','file_id','response','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','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','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','no\x20variable\x20found','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','toLowerCase','QUEUE','macro','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','shellCommand','command','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','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','mustache','request-promise','agi','../../config/environment','rawBody','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','format','getQueryOdbc','open','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','label','agicommand','channel','arg_1','createSquareRecording','uniqueid','callerid','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','scheduledAt','toString','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','number','POST','PUT','body','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','grammar','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','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'];(function(_0x2212d1,_0x460b4f){var _0x35d279=function(_0x536567){while(--_0x536567){_0x2212d1['push'](_0x2212d1['shift']());}};_0x35d279(++_0x460b4f);}(_0xaba6,0xe2));var _0x6aba=function(_0x42cc1f,_0xe9eb20){_0x42cc1f=_0x42cc1f-0x0;var _0x175df5=_0xaba6[_0x42cc1f];return _0x175df5;};'use strict';var fs=require('fs');var util=require(_0x6aba('0x0'));var _=require(_0x6aba('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x6aba('0x2'));var rp=require(_0x6aba('0x3'));var logger=require('../../config/logger')(_0x6aba('0x4'));var config=require(_0x6aba('0x5'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x6aba('0x6')];var verticesWithRetry=['menu',_0x6aba('0x7'),_0x6aba('0x8')];var AGIVertices=function(_0x508dff,_0x460fe2,_0x27c8ba){this['channel']=_0x508dff;this[_0x6aba('0x9')]=_0x460fe2;this[_0x6aba('0xa')]=_0x27c8ba;};AGIVertices[_0x6aba('0xb')][_0x6aba('0xc')]=function(_0xdbc119,_0x4089c6){this[_0x6aba('0x9')]['getVariableById'](_0xdbc119)[_0x6aba('0xd')](function(_0x158935){_0x4089c6(null,_0x158935?_0x158935[_0x6aba('0xe')]:![]);})[_0x6aba('0xf')](function(_0x53e604){_0x4089c6(_0x53e604);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x10')]=function(_0x4cad26,_0x123575){this[_0x6aba('0x9')][_0x6aba('0x11')](_0x4cad26)['then'](function(_0x1cf9d9){_0x123575(null,_0x1cf9d9?_0x1cf9d9[_0x6aba('0xe')]:![]);})[_0x6aba('0xf')](function(_0x4ae616){_0x123575(_0x4ae616);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x12')]=function(_0xa3cb32,_0x21921d){this[_0x6aba('0x9')][_0x6aba('0x13')](_0xa3cb32)[_0x6aba('0xd')](function(_0x564827){_0x21921d(null,_0x564827?_0x564827[_0x6aba('0xe')]:![]);})[_0x6aba('0xf')](function(_0x1c2efe){_0x21921d(_0x1c2efe);});};AGIVertices['prototype'][_0x6aba('0x14')]=function(_0x4b0ed4,_0x4dd600){this[_0x6aba('0x9')]['getSquareOdbcById'](_0x4b0ed4)[_0x6aba('0xd')](function(_0x1881ae){_0x4dd600(null,_0x1881ae?_0x1881ae[_0x6aba('0x15')]:![]);})[_0x6aba('0xf')](function(_0x110be5){_0x4dd600(_0x110be5);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x16')]=function(_0x5953f2,_0x2e5f65){this[_0x6aba('0x9')][_0x6aba('0x17')](_0x5953f2)[_0x6aba('0xd')](function(_0x3f1412){_0x2e5f65(null,_0x3f1412?_0x3f1412[_0x6aba('0xe')]:![]);})[_0x6aba('0xf')](function(_0x67ba6e){_0x2e5f65(_0x67ba6e);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x18')]=function(_0x31ec71,_0x3e18e3){this[_0x6aba('0x9')][_0x6aba('0x19')](_0x31ec71)[_0x6aba('0xd')](function(_0xb947da){_0x3e18e3(null,_0xb947da?_0xb947da[_0x6aba('0xe')]:![]);})[_0x6aba('0xf')](function(_0x2cbbf7){_0x3e18e3(_0x2cbbf7);});};AGIVertices['prototype']['getSound']=function(_0x335e82,_0x5b0845){var _0x30ecf9=this;this[_0x6aba('0x9')][_0x6aba('0x1a')](_0x335e82)[_0x6aba('0xd')](function(_0x5eef59){_0x5b0845(null,_0x5eef59?_0x30ecf9[_0x6aba('0x1b')](_0x5eef59[_0x6aba('0x1c')]):![]);})[_0x6aba('0xf')](function(_0x660643){_0x5b0845(_0x660643);});};AGIVertices[_0x6aba('0xb')]['getMailAccount']=function(_0x30bb81,_0x5d89aa){this[_0x6aba('0x9')][_0x6aba('0x1d')](_0x30bb81)['then'](function(_0x4d601a){_0x5d89aa(null,_0x4d601a?_0x4d601a:![]);})[_0x6aba('0xf')](function(_0x21c144){_0x5d89aa(_0x21c144);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x1e')]=function(_0x121908,_0x14d25e,_0x39c449){this['mailRpc'][_0x6aba('0x1e')](_0x121908,_0x14d25e)[_0x6aba('0xd')](function(){_0x39c449(null);})[_0x6aba('0xf')](function(_0x586e01){_0x39c449(_0x586e01);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x1f')]=function(_0x31458f,_0x53336b){this[_0x6aba('0x9')][_0x6aba('0x20')](_0x31458f)['then'](function(_0x14a119){if(_0x14a119){if(_0x14a119['IntervalId']){_0x53336b(null,[_0x14a119[_0x6aba('0x21')]]);}else{_0x53336b(null,_['map'](_0x14a119[_0x6aba('0x22')],_0x6aba('0x21')));}}else{_0x53336b(null,![]);}})['catch'](function(_0x5bd745){_0x53336b(_0x5bd745);});};AGIVertices[_0x6aba('0xb')]['getSoundPath']=function(_0x42d3be){return util[_0x6aba('0x23')]('%s/sounds/converted/%s',FILES_PATH,_0x42d3be);};AGIVertices[_0x6aba('0xb')][_0x6aba('0x24')]=function(_0x23d34a,_0x2b00f2,_0x8ca947){odbc[_0x6aba('0x25')](_0x23d34a,function(_0x337694){if(_0x337694){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x337694);_0x8ca947(_0x337694);}else{logger[_0x6aba('0x26')]('ODBC\x20connection\x20successfully');odbc[_0x6aba('0x27')](_0x2b00f2,function(_0x4a34e4,_0x3b6276){if(_0x4a34e4){logger['info'](_0x6aba('0x28'),_0x2b00f2);_0x8ca947(_0x4a34e4);}else{logger[_0x6aba('0x26')](_0x6aba('0x29'),_0x2b00f2);odbc[_0x6aba('0x2a')](function(_0x1bd3f3){if(_0x1bd3f3){logger[_0x6aba('0x2b')](_0x6aba('0x2c'),_0x1bd3f3);}_0x8ca947(null,_0x3b6276);});}});}});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x2d')]=function(_0x550d00,_0x1d041e){this[_0x6aba('0x9')][_0x6aba('0x2e')](_0x550d00)[_0x6aba('0xd')](function(_0x4c485b){_0x1d041e(null,_0x4c485b?_0x4c485b:![]);})[_0x6aba('0xf')](function(_0x4abf0e){_0x1d041e(_0x4abf0e);});};AGIVertices[_0x6aba('0xb')]['createSmsMessage']=function(_0x4af6e2,_0x4fc264){this[_0x6aba('0x9')]['createSmsMessage'](_0x4af6e2)[_0x6aba('0xd')](function(_0x3263a9){_0x4fc264(null,_0x3263a9);})[_0x6aba('0xf')](function(_0xfb89e8){_0x4fc264(_0xfb89e8);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x2f')]=function(_0x29aaa7,_0x5cfea2,_0x46e693){this[_0x6aba('0x9')][_0x6aba('0x2f')]({'uniqueid':this['channel']['uniqueid'],'node':_0x29aaa7[_0x6aba('0x30')],'application':_0x29aaa7[_0x6aba('0x31')],'data':_0x5cfea2||null,'project_name':this[_0x6aba('0x32')][_0x6aba('0x33')],'callerid':this[_0x6aba('0x32')]['callerid']})[_0x6aba('0xd')](function(_0x145279){if(_0x46e693){_0x46e693(null,_0x145279);}})[_0x6aba('0xf')](function(_0x3e233d){if(_0x46e693){_0x46e693(_0x3e233d);}});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x34')]=function(_0x29d1b9,_0x56eca0,_0x3ad708,_0x9ddc9f){this[_0x6aba('0x9')][_0x6aba('0x34')]({'uniqueid':this[_0x6aba('0x32')][_0x6aba('0x35')],'callerid':this['channel'][_0x6aba('0x36')],'calleridname':this['channel']['calleridname'],'context':this[_0x6aba('0x32')][_0x6aba('0x37')],'extension':this[_0x6aba('0x32')][_0x6aba('0x38')],'priority':this[_0x6aba('0x32')][_0x6aba('0x39')],'accountcode':this[_0x6aba('0x32')][_0x6aba('0x3a')],'dnid':this[_0x6aba('0x32')][_0x6aba('0x3b')],'projectName':this['channel'][_0x6aba('0x33')],'saveName':_0x56eca0,'filename':_0x29d1b9[_0x6aba('0x3c')]||_0x56eca0,'savePath':_0x3ad708})[_0x6aba('0xd')](function(_0xee64df){_0x9ddc9f(null,_0xee64df);})[_0x6aba('0xf')](function(_0x123a4c){_0x9ddc9f(_0x123a4c);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x3d')]=function(_0x303c41,_0x2b0963,_0x24f87c,_0xd4afa2,_0x3f7003){this['rpc'][_0x6aba('0x3d')]({'uniqueid':this[_0x6aba('0x32')][_0x6aba('0x35')],'body':_0x303c41,'direction':_0x2b0963,'providerName':_0x24f87c,'providerResponse':_0xd4afa2})['then'](function(_0x12383d){if(_0x3f7003){_0x3f7003(null,_0x12383d);}})['catch'](function(_0x56737e){if(_0x3f7003){_0x3f7003(_0x56737e);}});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x3e')]=function(_0x1b61bb,_0x558089){this[_0x6aba('0x9')][_0x6aba('0x3e')]({'firstName':_[_0x6aba('0x3f')](_0x1b61bb[_0x6aba('0xe')])||_[_0x6aba('0x40')](_0x1b61bb[_0x6aba('0xe')])?'callback_'+Math[_0x6aba('0x41')]():_0x1b61bb[_0x6aba('0xe')],'lastName':_['isEmpty'](_0x1b61bb[_0x6aba('0x42')])||_[_0x6aba('0x40')](_0x1b61bb[_0x6aba('0x42')])?null:_0x1b61bb[_0x6aba('0x42')],'phone':_0x1b61bb[_0x6aba('0x43')],'ListId':_0x1b61bb[_0x6aba('0x44')],'scheduledat':_0x1b61bb['scheduledAt'],'callbackUniqueid':this['channel'][_0x6aba('0x35')],'tags':_0x6aba('0x45'),'description':'Callback\x20scheduled\x20at\x20'+_0x1b61bb[_0x6aba('0x46')][_0x6aba('0x47')](),'priority':_0x1b61bb['callback_priority']})[_0x6aba('0xd')](function(_0x592cc5){_0x558089(null,_0x592cc5);})[_0x6aba('0xf')](function(_0x342b05){_0x558089(_0x342b05);});};AGIVertices[_0x6aba('0xb')]['getPause']=function(_0x20d58e,_0x127f44){this[_0x6aba('0x9')][_0x6aba('0x48')](_0x20d58e)[_0x6aba('0xd')](function(_0x560d5a){_0x127f44(null,_0x560d5a?_0x560d5a['name']:![]);})[_0x6aba('0xf')](function(_0x36449f){_0x127f44(_0x36449f);});};AGIVertices['prototype'][_0x6aba('0x49')]=function(_0x145903,_0x654b72,_0x19bcfb){var _0x3d0c16={'role':_0x6aba('0x4a')};_0x3d0c16[_0x145903]=this['channel'][_0x6aba('0x36')];this[_0x6aba('0x9')][_0x6aba('0x49')](_0x3d0c16,_0x654b72,this[_0x6aba('0x32')][_0x6aba('0x35')])[_0x6aba('0xd')](function(_0x4118d1){_0x19bcfb(null,_[_0x6aba('0x40')](_0x4118d1)?![]:!![]);})[_0x6aba('0xf')](function(_0x112514){logger[_0x6aba('0x2b')](_0x112514);_0x19bcfb(null,![]);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x4b')]=function(_0x2684bb,_0x128027){var _0x4736c9={'role':_0x6aba('0x4a')};_0x4736c9[_0x2684bb]=this[_0x6aba('0x32')]['callerid'];this['rpc'][_0x6aba('0x4b')](_0x4736c9)['then'](function(_0x2ddb61){_0x128027(null,_[_0x6aba('0x40')](_0x2ddb61)?![]:!![]);})[_0x6aba('0xf')](function(_0x1432d3){logger[_0x6aba('0x2b')](_0x1432d3);_0x128027(null,![]);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x4c')]=function(_0x39ee9d,_0x66d89b){var _0x523b4a={'role':_0x6aba('0x4a')};_0x523b4a[_0x39ee9d]=this[_0x6aba('0x32')][_0x6aba('0x36')];this['rpc'][_0x6aba('0x4c')](_0x523b4a)[_0x6aba('0xd')](function(_0x5e9d71){_0x66d89b(null,_[_0x6aba('0x40')](_0x5e9d71)?![]:!![]);})[_0x6aba('0xf')](function(_0xa5c265){logger[_0x6aba('0x2b')](_0xa5c265);_0x66d89b(null,![]);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x4d')]=function(_0x5c095e,_0x15d5cc){var _0x38d502={'role':'agent'};_0x38d502[_0x5c095e]=this[_0x6aba('0x32')][_0x6aba('0x36')];var _0x4f2ec4=_0x5c095e!=_0x6aba('0x4e')?util[_0x6aba('0x23')]('%s/%s@from-sip/n',_0x6aba('0x4f'),this[_0x6aba('0x32')]['callerid']):undefined;this[_0x6aba('0x9')][_0x6aba('0x4d')](_0x38d502,_0x4f2ec4)[_0x6aba('0xd')](function(_0x12a7d9){_0x15d5cc(null,_[_0x6aba('0x40')](_0x12a7d9)?![]:!![]);})[_0x6aba('0xf')](function(_0x24d49f){logger[_0x6aba('0x2b')](_0x24d49f);_0x15d5cc(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0xed849a,_0x357a0d){sh[_0x6aba('0x50')](_[_0x6aba('0x51')](_0xed849a),function(_0x117886,_0x1355e6){var _0x14abe9=_0x1355e6[_0x6aba('0x52')](/(\r\n|\n|\r)/gm,'');_0x357a0d(null,_0x14abe9);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x53')]=function(_0x38e8bb,_0x5351f5){scripts[_0x6aba('0x53')](_0x38e8bb[_0x6aba('0x54')],_0x38e8bb[_0x6aba('0x55')]||_0x6aba('0x56'),_0x38e8bb[_0x6aba('0x56')],_0x38e8bb[_0x6aba('0x57')]||_0x6aba('0x58'),_0x38e8bb[_0x6aba('0x59')]||_0x6aba('0x5a'),_0x38e8bb['audioEncoding']||'MP3')[_0x6aba('0xd')](function(_0x533d3e){_0x5351f5(null,_0x533d3e);})['catch'](function(_0x11f714){_0x5351f5(_0x11f714);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x5b')]=function(_0x3d769f,_0x27fbde){scripts[_0x6aba('0x5b')](_0x3d769f[_0x6aba('0x56')],_0x3d769f[_0x6aba('0x5c')]||'en',0x1)[_0x6aba('0xd')](function(_0x42a7ea){_0x27fbde(null,_0x42a7ea);})[_0x6aba('0xf')](function(_0x24364f){_0x27fbde(_0x24364f);});};AGIVertices['prototype'][_0x6aba('0x5d')]=function(_0x278587,_0x4cb071){var _0x10c913={'uri':_0x278587[_0x6aba('0x5e')],'method':_0x278587[_0x6aba('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x278587['timeout'])===_0x6aba('0x60')&&parseInt(_0x278587['timeout'])>=0x1?parseInt(_0x278587['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x6aba('0x61'),_0x6aba('0x62')],_0x10c913[_0x6aba('0x5f')]['toUpperCase']())){try{_0x10c913[_0x6aba('0x63')]=_0x278587[_0x6aba('0x6')]?JSON[_0x6aba('0x64')](_0x278587[_0x6aba('0x6')]):{};}catch(_0xcd9507){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xcd9507);}}try{_0x10c913[_0x6aba('0x65')]=_0x278587['rawHeaders']?JSON[_0x6aba('0x64')](_0x278587[_0x6aba('0x66')]):{};}catch(_0xe74693){logger[_0x6aba('0x2b')](_0x6aba('0x67'),_0xe74693);}if(_0x278587[_0x6aba('0x68')]){try{var _0xcd997e=require(_0x278587[_0x6aba('0x68')])[_0x6aba('0x69')](this,_0x10c913);_0x10c913['uri']=Mustache[_0x6aba('0x6a')](_0x278587[_0x6aba('0x5e')],_0xcd997e,{},['$$','$$']);if(_0x10c913[_0x6aba('0x65')]){_0x10c913['headers']=JSON[_0x6aba('0x64')](Mustache['render'](JSON[_0x6aba('0x6b')](_0x10c913[_0x6aba('0x65')]),_0xcd997e,{},['$$','$$']));}if(_0x10c913['body']){_0x10c913[_0x6aba('0x63')]=JSON[_0x6aba('0x64')](Mustache[_0x6aba('0x6a')](JSON[_0x6aba('0x6b')](_0x10c913[_0x6aba('0x63')]),_0xcd997e,{},['$$','$$']));}}catch(_0x513c16){logger[_0x6aba('0x2b')](_0x6aba('0x6c'),_0x513c16);}}rp(_0x10c913)[_0x6aba('0xd')](function(_0x6d1543){var _0x4dd2bb={'statusCode':_0x6d1543[_0x6aba('0x6d')]||0xc8,'statusMessage':_0x6d1543[_0x6aba('0x6e')]||'OK','headers':_0x6d1543['headers']||{},'body':_0x6d1543[_0x6aba('0x63')]||{}};_0x4cb071(null,_0x4dd2bb);})[_0x6aba('0xf')](function(_0x41e021){var _0x26342a={'statusCode':_0x41e021[_0x6aba('0x6d')]||0x1f4,'statusMessage':_0x41e021[_0x6aba('0x6f')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x41e021[_0x6aba('0x70')][_0x6aba('0x65')]||{},'body':_0x41e021[_0x6aba('0x70')][_0x6aba('0x63')]||{}};_0x4cb071(null,_0x26342a);});};AGIVertices[_0x6aba('0xb')]['googleDialogflow']=function(_0x2052f4,_0x40fa05){scripts[_0x6aba('0x71')](this[_0x6aba('0x32')][_0x6aba('0x35')],_0x2052f4[_0x6aba('0x72')],_0x2052f4[_0x6aba('0x56')],_0x2052f4[_0x6aba('0x73')]||'en')[_0x6aba('0xd')](function(_0x59e095){_0x40fa05(null,_0x59e095);})[_0x6aba('0xf')](function(_0x66df64){_0x40fa05(_0x66df64);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x74')]=function(_0x261457,_0x4654b3){scripts[_0x6aba('0x74')](this['channel']['uniqueid'],_0x261457[_0x6aba('0x75')],_0x261457[_0x6aba('0x76')],_0x261457[_0x6aba('0x77')],_0x261457[_0x6aba('0x56')],_0x261457[_0x6aba('0x78')]||'en')[_0x6aba('0xd')](function(_0x336d70){_0x4654b3(null,_0x336d70);})[_0x6aba('0xf')](function(_0x38a067){_0x4654b3(_0x38a067);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x79')]=function(_0x23636e,_0x24b50e){scripts[_0x6aba('0x79')](this[_0x6aba('0x32')],_0x23636e)[_0x6aba('0xd')](function(_0x377c28){_0x24b50e(null,_0x377c28);})[_0x6aba('0xf')](function(_0x4c9dcb){_0x24b50e(_0x4c9dcb);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x7a')]=function(_0x18204,_0xa9a737){scripts['ispeechTTS'](_0x18204[_0x6aba('0x72')],_0x18204['text'],_0x18204[_0x6aba('0x7b')]||_0x6aba('0x58'),_0x18204[_0x6aba('0x7c')])['then'](function(_0x19150e){_0xa9a737(null,_0x19150e);})[_0x6aba('0xf')](function(_0x165555){_0xa9a737(_0x165555);});};AGIVertices['prototype'][_0x6aba('0x7d')]=function(_0x282ad3,_0x4bdaf5,_0x8395c1){scripts[_0x6aba('0x7d')](_0x4bdaf5,_0x282ad3[_0x6aba('0x72')],_0x282ad3[_0x6aba('0x7e')]||'en-US',this[_0x6aba('0x7f')](_0x282ad3['model'])?_0x282ad3['model']:undefined)[_0x6aba('0xd')](function(_0xbcbe4d){_0x8395c1(null,_0xbcbe4d);})['catch'](function(_0x30affe){_0x8395c1(_0x30affe);});};AGIVertices['prototype']['awsPolly']=function(_0x27bf0d,_0x5a6494){scripts[_0x6aba('0x80')](_0x27bf0d[_0x6aba('0x81')],_0x27bf0d[_0x6aba('0x82')],_0x27bf0d[_0x6aba('0x83')],_0x27bf0d['aws_polly_voice']||'Amy',_0x27bf0d[_0x6aba('0x56')],_0x27bf0d[_0x6aba('0x84')]||_0x6aba('0x56'))['then'](function(_0x16130b){_0x5a6494(null,_0x16130b);})[_0x6aba('0xf')](function(_0x8c2123){_0x5a6494(_0x8c2123);});};AGIVertices[_0x6aba('0xb')]['awsLex']=function(_0x57dfa3,_0x2cbd40){scripts[_0x6aba('0x85')](this[_0x6aba('0x32')][_0x6aba('0x35')],_0x57dfa3[_0x6aba('0x81')],_0x57dfa3[_0x6aba('0x82')],_0x57dfa3[_0x6aba('0x86')],_0x57dfa3['text'],_0x57dfa3[_0x6aba('0x87')])[_0x6aba('0xd')](function(_0x4e8dc0){_0x2cbd40(null,_0x4e8dc0);})['catch'](function(_0x4d680c){_0x2cbd40(_0x4d680c);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x88')]=function(_0xc73ce5,_0x37d04a,_0x5754ed){scripts['googleASR'](_0x37d04a,_0xc73ce5[_0x6aba('0x72')],_0xc73ce5[_0x6aba('0x89')]||_0x6aba('0x58'))[_0x6aba('0xd')](function(_0x324216){_0x5754ed(null,_0x324216);})[_0x6aba('0xf')](function(_0x14e6b9){_0x5754ed(_0x14e6b9);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x8a')]=function(_0x775670,_0x28eac0,_0x2acfd3){scripts['tildeASR'](_0x28eac0,_0x775670[_0x6aba('0x8b')],_0x775670['appsecret'],_0x775670[_0x6aba('0x8c')])[_0x6aba('0xd')](function(_0x3379f0){_0x2acfd3(null,_0x3379f0);})['catch'](function(_0x2cf899){_0x2acfd3(_0x2cf899);});};AGIVertices[_0x6aba('0xb')][_0x6aba('0x8d')]=function(_0x51806c){var _0x2f9106=_[_0x6aba('0x8e')](verticesWithRetry,_0x51806c[_0x6aba('0x31')])?_0x51806c:_['clone'](_0x51806c);for(var _0x292693 in _0x2f9106){if(_0x2f9106[_0x6aba('0x8f')](_0x292693)){if(_0x2f9106[_0x292693]&&_[_0x6aba('0x90')](_0x2f9106[_0x292693])){if(_[_0x6aba('0x8e')](recursiveMapAttributes,_0x292693)){_0x2f9106[_0x292693]=this[_0x6aba('0x91')](_0x2f9106[_0x292693]);}else{_0x2f9106[_0x292693]=this[_0x6aba('0x92')](_0x2f9106[_0x292693]);}}}}return _0x2f9106;};AGIVertices[_0x6aba('0xb')][_0x6aba('0x93')]=function(_0x5e49d9){for(var _0x3bf775 in _0x5e49d9){if(_0x5e49d9['hasOwnProperty'](_0x3bf775)){if(_[_0x6aba('0x94')](_0x5e49d9[_0x3bf775])){this[_0x6aba('0x93')](_0x5e49d9[_0x3bf775]);}else if(_[_0x6aba('0x95')](_0x5e49d9[_0x3bf775])){for(var _0x336ec5=0x0;_0x336ec5<_0x5e49d9[_0x3bf775][_0x6aba('0x96')];_0x336ec5++){this[_0x6aba('0x93')](_0x5e49d9[_0x3bf775][_0x336ec5]);}}else if(_[_0x6aba('0x90')](_0x5e49d9[_0x3bf775])){_0x5e49d9[_0x3bf775]=this[_0x6aba('0x92')](_0x5e49d9[_0x3bf775]);}}}};AGIVertices[_0x6aba('0xb')][_0x6aba('0x97')]=function(_0xe8be61,_0x50bee3){for(var _0xd00572 in _0xe8be61){if(_0xe8be61[_0x6aba('0x8f')](_0xd00572)){if(_[_0x6aba('0x94')](_0xe8be61[_0xd00572])){if(!_[_0x6aba('0x3f')](_0xe8be61[_0xd00572])){this[_0x6aba('0x97')](_0xe8be61[_0xd00572],util[_0x6aba('0x23')](_0x6aba('0x98'),_0x50bee3,_0xd00572));}}else if(_[_0x6aba('0x95')](_0xe8be61[_0xd00572])){for(var _0x37849f=0x0;_0x37849f<_0xe8be61[_0xd00572][_0x6aba('0x96')];_0x37849f++){this[_0x6aba('0x97')](_0xe8be61[_0xd00572][_0x37849f],util[_0x6aba('0x23')](_0x6aba('0x98'),_0x50bee3,_0xd00572+'['+_0x37849f+']'));}}else{if(!_[_0x6aba('0x40')](_0xe8be61[_0xd00572])){this[_0x6aba('0x32')][_0x6aba('0x99')](util[_0x6aba('0x23')](_0x6aba('0x98'),_0x50bee3,_0xd00572),_0xe8be61[_0xd00572]);}}}}};AGIVertices['prototype'][_0x6aba('0x91')]=function(_0x3c5a45){try{var _0x410358=JSON['parse'](_0x3c5a45);this[_0x6aba('0x93')](_0x410358);return JSON['stringify'](_0x410358);}catch(_0x43fa78){return this['replaceAllVariables'](_0x3c5a45);}};AGIVertices[_0x6aba('0xb')]['replaceAllVariables']=function(_0x5f06a2){var _0x560529=_0x5f06a2[_0x6aba('0x9a')]('{');for(var _0x5b36c7=0x1;_0x5b36c7<_0x560529['length'];_0x5b36c7+=0x1){var _0x2731c0=_0x560529[_0x5b36c7]['split']('}');if(_0x2731c0[_0x6aba('0x96')]>0x1){_0x5f06a2=_0x5f06a2[_0x6aba('0x9b')]('{'+_0x2731c0[0x0]+'}',this['channel'][_0x6aba('0xc')](_0x2731c0[0x0])[_0x6aba('0x9c')]||_0x2731c0[0x0]);}}if(_0x560529['length']===0x1){return _0x5f06a2[_0x6aba('0x47')]();}return this['replaceAllVariables'](_0x5f06a2);};AGIVertices[_0x6aba('0xb')]['getAndSetVariable']=function(_0x5cd5cf,_0x4470ff){var _0x3dcaa4=this['channel'][_0x6aba('0xc')](_0x5cd5cf);if(_0x3dcaa4[_0x6aba('0x9d')]===-0x1){return _0x3dcaa4;}logger[_0x6aba('0x26')](util['format'](_0x6aba('0x9e'),_0x4470ff,_0x3dcaa4[_0x6aba('0x9c')]));return this[_0x6aba('0x32')][_0x6aba('0x99')](_0x4470ff,_0x3dcaa4[_0x6aba('0x9c')]);};AGIVertices[_0x6aba('0xb')][_0x6aba('0x7f')]=function(_0x43181d){return _0x43181d&&_0x43181d!=='0'&&_0x43181d!=='-1'&&_0x43181d!=='';};AGIVertices[_0x6aba('0xb')][_0x6aba('0x9f')]=function(_0x4568f9){this[_0x6aba('0x2f')]['sync'](this,_0x4568f9,'-');_0x4568f9[_0x6aba('0xa0')]=_0x4568f9[_0x6aba('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x6aba('0xa1')]=function(_0x2274f0){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2274f0[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x2274f0[_0x6aba('0x56')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xa3'));}var _0x369e4c='\x22'+_0x2274f0[_0x6aba('0x56')]+'\x22';if(this[_0x6aba('0x7f')](_0x2274f0[_0x6aba('0x70')])){_0x369e4c+=','+_0x2274f0[_0x6aba('0x70')];}var _0x1869aa=this[_0x6aba('0x32')]['exec'](_0x6aba('0xa4'),_0x369e4c);if(_0x1869aa[_0x6aba('0x9d')]===-0x1){return _0x1869aa;}return this[_0x6aba('0x32')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x369e4c));};AGIVertices[_0x6aba('0xb')][_0x6aba('0xa5')]=function(_0x3e2521){logger[_0x6aba('0x26')](util[_0x6aba('0x23')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x3e2521[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x3e2521['grammar'])){return this[_0x6aba('0x32')]['noop'](_0x6aba('0xa6'));}var _0x32fd08=_0x3e2521['grammar'];if(this['isConfigured'](_0x3e2521[_0x6aba('0x70')])){_0x32fd08+=','+_0x3e2521[_0x6aba('0x70')];}var _0x322195=this[_0x6aba('0x32')]['exec'](_0x6aba('0xa7'),_0x32fd08);if(_0x322195[_0x6aba('0x9d')]===-0x1){return _0x322195;}var _0x4954e8=this[_0x6aba('0xa8')](_0x6aba('0xa9'),_0x6aba('0xaa'));if(_0x4954e8[_0x6aba('0x9d')]===-0x1){return _0x4954e8;}var _0x386404=this[_0x6aba('0xa8')](_0x6aba('0xab'),_0x6aba('0xac'));if(_0x386404['result']===-0x1){return _0x386404;}var _0x47035b=this[_0x6aba('0xa8')](_0x6aba('0xad'),_0x6aba('0xae'));if(_0x47035b['result']===-0x1){return _0x47035b;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x32fd08));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x4')]=function(_0x259ef9){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0xaf'),_0x259ef9[_0x6aba('0x30')]));return this[_0x6aba('0x32')]['agi']([_0x259ef9['command'],_0x259ef9[_0x6aba('0xb0')]]);};AGIVertices[_0x6aba('0xb')][_0x6aba('0xb1')]=function(_0x5ad8ba){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0xb2'),_0x5ad8ba[_0x6aba('0x30')]));if(this['isConfigured'](_0x5ad8ba[_0x6aba('0xb3')])){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0xb4'),_0x5ad8ba[_0x6aba('0xb3')]));var _0x3f0971=this['channel'][_0x6aba('0xb5')](_0x5ad8ba['timeout']);if(_0x3f0971[_0x6aba('0x9d')]===-0x1){return _0x3f0971;}}return this['channel'][_0x6aba('0xb1')]();};AGIVertices[_0x6aba('0xb')][_0x6aba('0x45')]=function(_0x6bcdd4){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0xb6'),_0x6bcdd4[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x6bcdd4[_0x6aba('0x44')])){return this[_0x6aba('0x32')]['error'](_0x6bcdd4,_0x6aba('0xb7'));}_0x6bcdd4[_0x6aba('0x46')]=moment();if(this[_0x6aba('0x7f')](_0x6bcdd4[_0x6aba('0xb8')])){_0x6bcdd4[_0x6aba('0x46')]=moment()['add'](_0x6bcdd4['delay'],_0x6aba('0xb9'));}if(!this[_0x6aba('0x7f')](_0x6bcdd4[_0x6aba('0xba')])){_0x6bcdd4[_0x6aba('0xba')]=0x2;}this[_0x6aba('0x3e')][_0x6aba('0x69')](this,_0x6bcdd4);return this[_0x6aba('0x32')]['noop'](util[_0x6aba('0x23')](_0x6aba('0xbb'),_0x6bcdd4[_0x6aba('0x43')],_0x6bcdd4[_0x6aba('0x44')],_0x6bcdd4[_0x6aba('0x46')]));};AGIVertices[_0x6aba('0xb')][_0x6aba('0xbc')]=function(_0x3c873e){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0xbd'),_0x3c873e[_0x6aba('0x30')]));var _0x22c5c8=this[_0x6aba('0x32')][_0x6aba('0x50')](_0x3c873e[_0x6aba('0xbe')],_0x3c873e[_0x6aba('0x70')]);if(_0x22c5c8[_0x6aba('0x9d')]===-0x1){return _0x22c5c8;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')]('Executed\x20command\x20%s\x20%s',_0x3c873e['application'],_0x3c873e[_0x6aba('0x70')]));};AGIVertices[_0x6aba('0xb')][_0x6aba('0xbf')]=function(_0x1051b9){logger['info'](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1051b9[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x1051b9[_0x6aba('0x56')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xa3'));}var _0x40735d='\x22'+_0x1051b9['text']+'\x22';if(this['isConfigured'](_0x1051b9[_0x6aba('0x70')])){_0x40735d+=','+_0x1051b9[_0x6aba('0x70')];}var _0x1997c8=this[_0x6aba('0x32')][_0x6aba('0x50')]('MRCPSynth',_0x40735d);if(_0x1997c8[_0x6aba('0x9d')]===-0x1){return _0x1997c8;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xc0'),_0x40735d));};AGIVertices[_0x6aba('0xb')]['sestektts']=function(_0x506c1f){logger[_0x6aba('0x26')](util[_0x6aba('0x23')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x506c1f[_0x6aba('0x30')]));if(!this['isConfigured'](_0x506c1f[_0x6aba('0x56')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xa3'));}var _0x53594f='\x22'+_0x506c1f['text']+'\x22';if(this[_0x6aba('0x7f')](_0x506c1f[_0x6aba('0x70')])){_0x53594f+=','+_0x506c1f[_0x6aba('0x70')];}var _0x5b90e6=this[_0x6aba('0x32')][_0x6aba('0x50')](_0x6aba('0xa4'),_0x53594f);if(_0x5b90e6[_0x6aba('0x9d')]===-0x1){return _0x5b90e6;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x53594f));};AGIVertices['prototype']['lumenvoxasr']=function(_0x5ee1c9){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0xc1'),_0x5ee1c9[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x5ee1c9['grammar'])){return this['channel'][_0x6aba('0xa2')](_0x6aba('0xa6'));}var _0x8c4c5d=_0x5ee1c9['grammar'];if(this[_0x6aba('0x7f')](_0x5ee1c9[_0x6aba('0x70')])){_0x8c4c5d+=','+_0x5ee1c9['options'];}var _0x429791=this[_0x6aba('0x32')][_0x6aba('0x50')](_0x6aba('0xa7'),_0x8c4c5d);if(_0x429791[_0x6aba('0x9d')]===-0x1){return _0x429791;}var _0x5c5669=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x6aba('0xc2'));if(_0x5c5669[_0x6aba('0x9d')]===-0x1){return _0x5c5669;}var _0x827a9b=this[_0x6aba('0xa8')](_0x6aba('0xab'),_0x6aba('0xc3'));if(_0x827a9b[_0x6aba('0x9d')]===-0x1){return _0x827a9b;}var _0x74fc95=this[_0x6aba('0xa8')]('RECOG_INSTANCE()',_0x6aba('0xc4'));if(_0x74fc95[_0x6aba('0x9d')]===-0x1){return _0x74fc95;}return this['channel'][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xc5'),_0x8c4c5d));};AGIVertices[_0x6aba('0xb')]['sestekasr']=function(_0x59341f){logger[_0x6aba('0x26')](util[_0x6aba('0x23')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x59341f[_0x6aba('0x30')]));if(!this['isConfigured'](_0x59341f[_0x6aba('0xc6')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xa6'));}var _0x48907f=_0x59341f[_0x6aba('0xc6')];if(this[_0x6aba('0x7f')](_0x59341f[_0x6aba('0x70')])){_0x48907f+=','+_0x59341f[_0x6aba('0x70')];}var _0x3ac02f=this['channel'][_0x6aba('0x50')]('MRCPRecog',_0x48907f);if(_0x3ac02f[_0x6aba('0x9d')]===-0x1){return _0x3ac02f;}var _0x1a22eb=this['getAndSetVariable']('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x1a22eb[_0x6aba('0x9d')]===-0x1){return _0x1a22eb;}var _0x5b46bc=this[_0x6aba('0xa8')](_0x6aba('0xab'),_0x6aba('0xc7'));if(_0x5b46bc['result']===-0x1){return _0x5b46bc;}var _0xb71159=this[_0x6aba('0xa8')](_0x6aba('0xad'),_0x6aba('0xc8'));if(_0xb71159[_0x6aba('0x9d')]===-0x1){return _0xb71159;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x48907f));};AGIVertices[_0x6aba('0xb')][_0x6aba('0xc9')]=function(_0x58b185){logger['info'](util[_0x6aba('0x23')](_0x6aba('0xca'),_0x58b185[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x58b185[_0x6aba('0xcb')])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x58b185,_0x6aba('0xcc'));}var _0x262a96=this[_0x6aba('0x14')][_0x6aba('0x69')](this,_0x58b185[_0x6aba('0xcb')]);if(!_0x262a96){return this[_0x6aba('0x32')]['error'](_0x58b185,_0x6aba('0xcd'));}if(!this[_0x6aba('0x7f')](_0x58b185[_0x6aba('0x27')])){return this['channel'][_0x6aba('0x2b')](_0x58b185,_0x6aba('0xce'));}var _0x577958=_0x58b185[_0x6aba('0x27')][_0x6aba('0x52')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xcf'),_0x577958));var _0xc53794=this[_0x6aba('0x24')][_0x6aba('0x69')](this,_0x262a96,_0x577958);this[_0x6aba('0x2f')][_0x6aba('0x69')](this,_0x58b185,_0x577958);if(!this[_0x6aba('0x7f')](_0x58b185['variable_id'])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xd0'));}var _0xb5af0a=this['getVariable']['sync'](this,_0x58b185[_0x6aba('0xd1')]);if(!_0xb5af0a){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x58b185,'no\x20variable\x20found');}var _0x368366=this;_0xc53794[_0x6aba('0xd2')](function(_0x1cfc1b,_0x3a5f74){Object[_0x6aba('0xd3')](_0x1cfc1b)[_0x6aba('0xd2')](function(_0x391d27){_0x368366[_0x6aba('0x32')][_0x6aba('0x99')](util[_0x6aba('0x23')]('%s[%s][%s]',_0xb5af0a,_0x3a5f74,_0x391d27),_0x1cfc1b[_0x391d27]);});});this['channel'][_0x6aba('0x99')](util[_0x6aba('0x23')](_0x6aba('0xd4'),_0xb5af0a),_0xc53794['length']);return this[_0x6aba('0x32')]['noop'](util[_0x6aba('0x23')](_0x6aba('0xd5'),_0xb5af0a));};AGIVertices[_0x6aba('0xb')][_0x6aba('0xd6')]=function(_0x542fc8){logger[_0x6aba('0xd7')](util[_0x6aba('0x23')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x542fc8[_0x6aba('0x30')]));if(!this['isConfigured'](_0x542fc8[_0x6aba('0xd8')])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x542fc8,_0x6aba('0xd9'));}var _0x1f74ad=this[_0x6aba('0x16')][_0x6aba('0x69')](this,_0x542fc8[_0x6aba('0xd8')]);if(!_0x1f74ad){return this['channel']['error'](_0x542fc8,_0x6aba('0xda'));}var _0x565664=this[_0x6aba('0x32')][_0x6aba('0x50')](_0x6aba('0xdb'),[util[_0x6aba('0x23')](_0x6aba('0xdc'),_0x1f74ad),_0x542fc8[_0x6aba('0xb3')],_0x542fc8[_0x6aba('0xdd')],_0x542fc8[_0x6aba('0x5e')]]);if(_0x565664[_0x6aba('0x9d')]===-0x1){return _0x565664;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xde'),_0x6aba('0xdb')));};AGIVertices[_0x6aba('0xb')][_0x6aba('0xdf')]=function(_0x1c3e4c){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0xe0'),_0x1c3e4c[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x1c3e4c['key'])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xe1'));}if(!this[_0x6aba('0x7f')](_0x1c3e4c['text'])){return this[_0x6aba('0x32')]['noop']('no\x20text\x20configured');}this[_0x6aba('0x32')][_0x6aba('0xe2')]=!![];this[_0x6aba('0x2f')](_0x1c3e4c);this[_0x6aba('0x3d')](_0x1c3e4c[_0x6aba('0x56')],'in','','');this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xe3'),_0x1c3e4c[_0x6aba('0x56')]));var _0x59367f=this[_0x6aba('0x71')][_0x6aba('0x69')](this,_0x1c3e4c);if(_0x59367f){for(var _0x23aad4 in _0x59367f){if(_0x59367f[_0x6aba('0x8f')](_0x23aad4)){this[_0x6aba('0x32')]['setVariable'](util[_0x6aba('0x23')](_0x6aba('0xe4'),_0x23aad4[_0x6aba('0xe5')]()),_0x59367f[_0x23aad4]);}}this[_0x6aba('0x3d')](_0x59367f[_0x6aba('0xe6')],'out',_0x6aba('0xdf'),'');return this['channel'][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xe7'),_0x59367f[_0x6aba('0xe6')]));}return this[_0x6aba('0x32')]['error'](_0x1c3e4c,_0x6aba('0xe8'));};AGIVertices['prototype'][_0x6aba('0xe9')]=function(_0x286658){logger['info'](util[_0x6aba('0x23')](_0x6aba('0xea'),_0x286658[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x286658[_0x6aba('0x75')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xeb'));}if(!this['isConfigured'](_0x286658[_0x6aba('0x76')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xec'));}if(!this[_0x6aba('0x7f')](_0x286658['private_key'])){return this['channel']['noop'](_0x6aba('0xed'));}if(!this[_0x6aba('0x7f')](_0x286658[_0x6aba('0x78')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xee'));}if(!this[_0x6aba('0x7f')](_0x286658[_0x6aba('0x56')])){return this['channel'][_0x6aba('0xa2')](_0x6aba('0xa3'));}this[_0x6aba('0x32')][_0x6aba('0xe2')]=!![];this[_0x6aba('0x2f')](_0x286658);this[_0x6aba('0x3d')](_0x286658['text'],'in','','');this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xef'),_0x286658[_0x6aba('0x56')]));var _0x57bd0d=this[_0x6aba('0x74')][_0x6aba('0x69')](this,_0x286658);if(_0x57bd0d){for(var _0x246530 in _0x57bd0d){if(_0x57bd0d[_0x6aba('0x8f')](_0x246530)){if(_0x246530!==_0x6aba('0xf0')){this[_0x6aba('0x32')][_0x6aba('0x99')](util[_0x6aba('0x23')](_0x6aba('0xe4'),_0x246530['toUpperCase']()),_0x57bd0d[_0x246530]);}}}this[_0x6aba('0x3d')](_0x57bd0d[_0x6aba('0xe6')],_0x6aba('0xf1'),_0x6aba('0xe9'),_0x57bd0d[_0x6aba('0xf0')]);return this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format'](_0x6aba('0xf2'),_0x57bd0d[_0x6aba('0xe6')]));}return this[_0x6aba('0x32')]['error'](_0x286658,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x6aba('0xb')][_0x6aba('0xf3')]=function(_0x486ab2){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0xf4'),_0x486ab2['label']));if(!this[_0x6aba('0x7f')](_0x486ab2[_0x6aba('0xf5')])){return this[_0x6aba('0x32')]['noop'](_0x6aba('0xf6'));}if(!this['isConfigured'](_0x486ab2['username'])){return this[_0x6aba('0x32')]['noop'](_0x6aba('0xf7'));}if(!this[_0x6aba('0x7f')](_0x486ab2[_0x6aba('0xf8')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xf9'));}if(!this['isConfigured'](_0x486ab2[_0x6aba('0xfa')])){return this['channel'][_0x6aba('0xa2')](_0x6aba('0xa3'));}this['channel'][_0x6aba('0xe2')]=!![];this['createSquareDetailsReport'](_0x486ab2);this[_0x6aba('0x3d')](_0x486ab2[_0x6aba('0x56')],'in','','');this[_0x6aba('0x32')]['noop'](util['format'](_0x6aba('0xfb'),_0x486ab2[_0x6aba('0x56')]));var _0x504d64=this[_0x6aba('0x79')][_0x6aba('0x69')](this,_0x486ab2);if(_0x504d64){for(var _0x21b9e6 in _0x504d64){if(_0x504d64[_0x6aba('0x8f')](_0x21b9e6)){this[_0x6aba('0x32')][_0x6aba('0x99')](util[_0x6aba('0x23')](_0x6aba('0xfc'),_0x21b9e6['toUpperCase']()),_0x504d64[_0x21b9e6]);}}this[_0x6aba('0x3d')](_0x504d64['speech'],'out',_0x6aba('0xf3'),'');if(_0x504d64[_0x6aba('0xfd')]){this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xfe'),_0x504d64[_0x6aba('0xfd')]));var _0x2bec75=this['channel'][_0x6aba('0xff')](_0x504d64[_0x6aba('0xfd')]);try{fs['unlink'](_0x504d64['audiofile']+_0x6aba('0x100'));}catch(_0x234032){logger[_0x6aba('0x2b')](_0x234032);}return _0x2bec75;}else{return this['channel']['noop'](util[_0x6aba('0x23')](_0x6aba('0x101'),_0x504d64[_0x6aba('0xe6')]));}}return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x486ab2,_0x6aba('0x102'));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x103')]=function(_0x4efe2c){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x104'),_0x4efe2c[_0x6aba('0x30')]));return this[_0x6aba('0x32')][_0x6aba('0xa2')]('end');};AGIVertices['prototype'][_0x6aba('0x105')]=function(_0x2c4987){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x106'),_0x2c4987[_0x6aba('0x30')]));var _0xc0a7b4='';if(_0x2c4987[_0x6aba('0x107')]){if(!this[_0x6aba('0x7f')](_0x2c4987[_0x6aba('0x107')])){return this['channel'][_0x6aba('0x2b')](_0x2c4987,_0x6aba('0x108'));}else{var _0x6221a4=parseInt(_0x2c4987[_0x6aba('0x107')],0xa);if(isNaN(_0x6221a4)){_0xc0a7b4=_0x2c4987[_0x6aba('0x107')];}else{_0xc0a7b4=this[_0x6aba('0x18')][_0x6aba('0x69')](this,_0x2c4987['trunk_id']);if(!_0xc0a7b4){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x2c4987,_0x6aba('0x109'));}}}}else if(_0x2c4987[_0x6aba('0x10a')]){_0xc0a7b4=_0x2c4987[_0x6aba('0x10a')];}else{return this[_0x6aba('0x32')]['error'](_0x2c4987,_0x6aba('0x108'));}var _0x56f219=this[_0x6aba('0x32')][_0x6aba('0x50')](_0x6aba('0xdb'),[util[_0x6aba('0x23')]('SIP/%s/%s',_0xc0a7b4,_0x2c4987['phone']),_0x2c4987['timeout'],_0x2c4987['opts'],_0x2c4987['url']]);if(_0x56f219[_0x6aba('0x9d')]===-0x1){return _0x56f219;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0xde'),_0x6aba('0xdb')));};AGIVertices[_0x6aba('0xb')]['finally']=function(_0x5c7ea5){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x10b'),_0x5c7ea5[_0x6aba('0x30')]));return this[_0x6aba('0x32')]['noop'](_0x6aba('0x10c'));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x7')]=function(_0x527f31){logger[_0x6aba('0x26')](util[_0x6aba('0x23')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x527f31[_0x6aba('0x30')]));if(_0x527f31[_0x6aba('0xa0')]===0x0){return this[_0x6aba('0x9f')](_0x527f31);}_0x527f31[_0x6aba('0xa0')]-=0x1;if(!this[_0x6aba('0x7f')](_0x527f31['file_id'])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x527f31,'no\x20file\x20audio\x20selected');}var _0x27c6f0=this[_0x6aba('0x10d')][_0x6aba('0x69')](this,_0x527f31[_0x6aba('0x10e')]);if(!_0x27c6f0){return this[_0x6aba('0x32')]['error'](_0x527f31,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x527f31[_0x6aba('0xd1')])){return this[_0x6aba('0x32')][_0x6aba('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x15fefc=this['channel']['getData'](_0x27c6f0,_0x527f31[_0x6aba('0x10f')],_0x527f31[_0x6aba('0x110')]);var _0x4a54b8=_0x15fefc[_0x6aba('0x9d')]?_0x15fefc[_0x6aba('0x9d')][_0x6aba('0x47')]():'';logger['info']('test',JSON[_0x6aba('0x6b')](_0x15fefc));if(_0x15fefc[_0x6aba('0x9d')]===-0x1){this['createSquareDetailsReport'][_0x6aba('0x69')](this,_0x527f31,_0x4a54b8);return _0x15fefc;}else if(_0x15fefc['extra']===_0x6aba('0xb3')){_0x15fefc[_0x6aba('0x9d')]=_0x4a54b8[_0x6aba('0x96')]>=parseInt(_0x527f31[_0x6aba('0x111')])?'x':'i';}else{_0x15fefc[_0x6aba('0x9d')]=_0x4a54b8['length']>=parseInt(_0x527f31[_0x6aba('0x111')])&&_0x4a54b8[_0x6aba('0x96')]<=parseInt(_0x527f31[_0x6aba('0x110')])?'x':'i';}var _0x1a284a=this[_0x6aba('0xc')][_0x6aba('0x69')](this,_0x527f31[_0x6aba('0xd1')]);if(!_0x1a284a){return this['channel'][_0x6aba('0x2b')](_0x527f31,'no\x20variable\x20found');}this[_0x6aba('0x32')][_0x6aba('0x99')](_0x1a284a,_0x4a54b8);if(this[_0x6aba('0x7f')](_0x527f31[_0x6aba('0x112')])){var _0x166c78=parseInt(_0x527f31[_0x6aba('0x112')],0xa);var _0x12a8e5=rs['generate']({'charset':'*','length':_0x166c78});var _0x4ca3c8=_0x4a54b8[_0x6aba('0x96')];if(_0x4ca3c8>0x0){if(_0x4ca3c8>_0x166c78){this[_0x6aba('0x2f')][_0x6aba('0x69')](this,_0x527f31,_0x527f31[_0x6aba('0x113')]===_0x6aba('0x114')?_0x12a8e5+_0x4a54b8[_0x6aba('0x115')](_0x166c78):_0x4a54b8[_0x6aba('0x115')](0x0,_0x4ca3c8-_0x166c78)+_0x12a8e5);}else{this[_0x6aba('0x2f')]['sync'](this,_0x527f31,rs[_0x6aba('0x116')]({'charset':'*','length':_0x4ca3c8}));}}else{this[_0x6aba('0x2f')][_0x6aba('0x69')](this,_0x527f31,'');}}else{this[_0x6aba('0x2f')][_0x6aba('0x69')](this,_0x527f31,_0x4a54b8);}return _0x15fefc;};AGIVertices['prototype'][_0x6aba('0x8')]=function(_0x3b5f97){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x117'),_0x3b5f97[_0x6aba('0x30')]));return this['getdigits'](_0x3b5f97);};AGIVertices['prototype'][_0x6aba('0x118')]=function(_0x348586){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x119'),_0x348586[_0x6aba('0x30')]));this[_0x6aba('0x2f')]['sync'](this,_0x348586,_0x348586[_0x6aba('0x11a')]);return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x11b'),_0x348586[_0x6aba('0x11a')]));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x11c')]=function(_0x20e16d){logger[_0x6aba('0x26')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x20e16d[_0x6aba('0x30')]));if(!this['isConfigured'](_0x20e16d['aws_access_key_id'])||!this['isConfigured'](_0x20e16d[_0x6aba('0x82')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x11d'));}if(!this[_0x6aba('0x7f')](_0x20e16d[_0x6aba('0x56')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel']['noop'](util[_0x6aba('0x23')]('Trying\x20aws\x20Polly\x20%s',_0x20e16d[_0x6aba('0x56')]));var _0x4e0684=this['awsPolly']['sync'](this,_0x20e16d);if(_0x4e0684){this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x4e0684));var _0x5f4818=this[_0x6aba('0x32')]['streamFile'](_0x4e0684);try{fs[_0x6aba('0x11e')](_0x4e0684+_0x6aba('0x100'));}catch(_0x327a84){logger['error'](_0x327a84);}return _0x5f4818;}return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x20e16d,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x6aba('0xb')][_0x6aba('0x11f')]=function(_0x5e4978){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x120'),_0x5e4978['label']));if(!this[_0x6aba('0x7f')](_0x5e4978[_0x6aba('0x81')])||!this['isConfigured'](_0x5e4978['aws_secret_access_key'])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x11d'));}if(!this[_0x6aba('0x7f')](_0x5e4978[_0x6aba('0x87')])){return this['channel'][_0x6aba('0xa2')](_0x6aba('0x121'));}if(!this[_0x6aba('0x7f')](_0x5e4978['text'])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xa3'));}this[_0x6aba('0x32')][_0x6aba('0xe2')]=!![];this[_0x6aba('0x2f')](_0x5e4978);this[_0x6aba('0x3d')](_0x5e4978[_0x6aba('0x56')],'in','','');this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x122'),_0x5e4978[_0x6aba('0x56')]));var _0x1526ac=this['awsLex']['sync'](this,_0x5e4978);if(_0x1526ac){for(var _0x1827fd in _0x1526ac){if(_0x1526ac[_0x6aba('0x8f')](_0x1827fd)&&_[_0x6aba('0x90')](_0x1526ac[_0x1827fd])){this['channel'][_0x6aba('0x99')](util[_0x6aba('0x23')](_0x6aba('0x123'),_0x1827fd[_0x6aba('0xe5')]()),_0x1526ac[_0x1827fd]);}}if(_[_0x6aba('0x40')](_0x1526ac[_0x6aba('0x6f')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x124'));}else{this[_0x6aba('0x3d')](_0x1526ac[_0x6aba('0x6f')],'out','amazonlex','');return this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format'](_0x6aba('0x125'),_0x1526ac['message']));}}return this['channel'][_0x6aba('0x2b')](_0x5e4978,_0x6aba('0x126'));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x127')]=function(_0x57352d){logger[_0x6aba('0x26')](util[_0x6aba('0x23')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x57352d[_0x6aba('0x30')],_0x57352d[_0x6aba('0xb3')]));if(!this['isConfigured'](_0x57352d['key'])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xe1'));}var _0x4ccbf5=_0x6aba('0x128');var _0x3e9e25=util['format'](_0x6aba('0x129'),FILES_PATH,rs[_0x6aba('0x116')](0x4));var _0x2d46cf=util[_0x6aba('0x23')]('%s.%s',_0x3e9e25,_0x4ccbf5);var _0x31611d=!![];if(_0x57352d[_0x6aba('0x12a')]===_0x6aba('0x12b')){_0x31611d=![];}var _0x24622a=this[_0x6aba('0x32')]['recordFile'](_0x3e9e25,_0x4ccbf5,_0x57352d[_0x6aba('0x12c')],_0x57352d[_0x6aba('0xb3')],undefined,_0x31611d);if(_0x24622a['result']!==-0x1){this[_0x6aba('0x32')]['noop'](util[_0x6aba('0x23')](_0x6aba('0x12d'),_0x2d46cf));var _0x59f8de=this[_0x6aba('0x88')][_0x6aba('0x69')](this,_0x57352d,_0x2d46cf);if(_0x59f8de){for(var _0x2d92c3 in _0x59f8de){if(_0x59f8de[_0x6aba('0x8f')](_0x2d92c3)){this[_0x6aba('0x32')][_0x6aba('0x99')](util[_0x6aba('0x23')](_0x6aba('0x12e'),_0x2d92c3['toUpperCase']()),_0x59f8de[_0x2d92c3]);}}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x12f'),JSON['stringify'](_0x59f8de)));}}return _0x24622a;};AGIVertices[_0x6aba('0xb')]['tildeasr']=function(_0x2b1ec1){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x130'),_0x2b1ec1[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x2b1ec1['appid'])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x131'));}if(!this[_0x6aba('0x7f')](_0x2b1ec1[_0x6aba('0x132')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x133'));}var _0x1a04dc=_0x6aba('0x128');var _0x11aabc=util[_0x6aba('0x23')](_0x6aba('0x129'),FILES_PATH,rs['generate'](0x4));var _0x42ddee=util[_0x6aba('0x23')](_0x6aba('0x98'),_0x11aabc,_0x1a04dc);var _0x3107f7=!![];if(_0x2b1ec1[_0x6aba('0x12a')]==='NOBEEP'){_0x3107f7=![];}var _0x5d7111=this[_0x6aba('0x32')][_0x6aba('0x134')](_0x11aabc,_0x1a04dc,_0x2b1ec1[_0x6aba('0x12c')],_0x2b1ec1[_0x6aba('0xb3')],undefined,_0x3107f7);if(_0x5d7111['result']!==-0x1){this[_0x6aba('0x32')]['noop'](util['format']('tilde\x20%s\x20file\x20created',_0x42ddee));var _0x4e506a=this[_0x6aba('0x8a')]['sync'](this,_0x2b1ec1,_0x42ddee);if(_0x4e506a){for(var _0x4dc1f4 in _0x4e506a){if(_0x4e506a[_0x6aba('0x8f')](_0x4dc1f4)){this[_0x6aba('0x32')][_0x6aba('0x99')](util['format'](_0x6aba('0x135'),_0x4dc1f4[_0x6aba('0xe5')]()),_0x4e506a[_0x4dc1f4]);}}return this[_0x6aba('0x32')]['noop'](util['format'](_0x6aba('0x136'),JSON['stringify'](_0x4e506a)));}}return _0x5d7111;};AGIVertices['prototype']['gotoc']=function(_0x10c67c){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x137'),_0x10c67c[_0x6aba('0x30')]));return this[_0x6aba('0x32')][_0x6aba('0x138')](_0x10c67c['context'],_0x10c67c['extension'],_0x10c67c[_0x6aba('0x39')]);};AGIVertices[_0x6aba('0xb')][_0x6aba('0x139')]=function(_0x4cad45){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x13a'),_0x4cad45[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x4cad45['condition'])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x4cad45,_0x6aba('0x13b'));}try{var _0x3c66c2=eval(_0x4cad45[_0x6aba('0x13c')])?'true':_0x6aba('0x13d');this['channel']['noop'](util[_0x6aba('0x23')](_0x6aba('0x13e'),_0x4cad45[_0x6aba('0x13c')],_0x3c66c2));return{'code':0xc8,'result':_0x3c66c2};}catch(_0x315f20){return{'code':0xc8,'result':_0x6aba('0x13d')};}};AGIVertices[_0x6aba('0xb')][_0x6aba('0x13f')]=function(_0x2d9b05){logger[_0x6aba('0x26')](util['format'](_0x6aba('0x140'),_0x2d9b05['label']));if(!this[_0x6aba('0x7f')](_0x2d9b05[_0x6aba('0x141')])){return this['channel'][_0x6aba('0x2b')](_0x2d9b05,_0x6aba('0x142'));}var _0x5a55c1=this['getIntervals'][_0x6aba('0x69')](this,_0x2d9b05['interval_id']);if(!_0x5a55c1){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x2d9b05,_0x6aba('0x143'));}for(var _0x23227e=0x0;_0x23227e<_0x5a55c1[_0x6aba('0x96')];_0x23227e+=0x1){var _0x10622c=this[_0x6aba('0x32')][_0x6aba('0xc')](util[_0x6aba('0x23')](_0x6aba('0x144'),_0x5a55c1[_0x23227e]));if(_0x10622c['result']===-0x1){return _0x10622c;}logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x145'),_0x5a55c1[_0x23227e],_0x10622c[_0x6aba('0x9c')]));if(_0x10622c[_0x6aba('0x9c')]===_0x6aba('0x146')){logger['info'](util[_0x6aba('0x23')]('IFTIME\x20%s\x20%s',_0x5a55c1[_0x23227e],_0x6aba('0x146')));this['channel'][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x145'),_0x5a55c1[_0x23227e],_0x6aba('0x146')));return{'code':0xc8,'result':_0x6aba('0x146')};}else{logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x145'),_0x5a55c1[_0x23227e],_0x6aba('0x13d')));this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x145'),_0x5a55c1[_0x23227e],_0x6aba('0x13d')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x6aba('0xb')]['hangup']=function(_0x15e755){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x147'),_0x15e755[_0x6aba('0x30')]));return this[_0x6aba('0x32')][_0x6aba('0x148')]();};AGIVertices[_0x6aba('0xb')]['ispeechasr']=function(_0x3faf67){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3faf67[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x3faf67['key'])){return this[_0x6aba('0x32')]['noop'](_0x6aba('0xe1'));}var _0x250c28=_0x6aba('0x128');var _0x5882ef=util[_0x6aba('0x23')](_0x6aba('0x129'),FILES_PATH,rs['generate'](0x4));var _0x5ed90c=util['format'](_0x6aba('0x98'),_0x5882ef,_0x250c28);var _0x4407f6=!![];if(_0x3faf67[_0x6aba('0x12a')]==='NOBEEP'){_0x4407f6=![];}var _0x1ce883=this[_0x6aba('0x32')]['recordFile'](_0x5882ef,_0x250c28,_0x3faf67[_0x6aba('0x12c')],_0x3faf67[_0x6aba('0xb3')],undefined,_0x4407f6);if(_0x1ce883[_0x6aba('0x9d')]!==-0x1){this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format'](_0x6aba('0x149'),_0x5ed90c));var _0x2993b9=this[_0x6aba('0x7d')]['sync'](this,_0x3faf67,_0x5ed90c);if(_0x2993b9){for(var _0x568b5b in _0x2993b9){if(_0x2993b9['hasOwnProperty'](_0x568b5b)){this[_0x6aba('0x32')][_0x6aba('0x99')](util[_0x6aba('0x23')]('ISPEECH_ASR_%s',_0x568b5b['toUpperCase']()),_0x2993b9[_0x568b5b]);}}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x14a'),JSON[_0x6aba('0x6b')](_0x2993b9)));}}return _0x1ce883;};AGIVertices[_0x6aba('0xb')][_0x6aba('0x14b')]=function(_0x47997b){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x14c'),_0x47997b[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x47997b[_0x6aba('0x72')])){return this['channel'][_0x6aba('0xa2')](_0x6aba('0xe1'));}if(!this['isConfigured'](_0x47997b[_0x6aba('0x56')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xa3'));}this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x14d'),_0x47997b['text']));var _0x1f46bf=this['ispeechTTS'][_0x6aba('0x69')](this,_0x47997b);if(_0x1f46bf){this[_0x6aba('0x32')]['noop'](util[_0x6aba('0x23')](_0x6aba('0x149'),_0x1f46bf));var _0x401dd2=this[_0x6aba('0x32')][_0x6aba('0xff')](_0x1f46bf,_0x47997b[_0x6aba('0x12c')]);try{fs[_0x6aba('0x11e')](_0x1f46bf+_0x6aba('0x100'));}catch(_0x4314bf){logger[_0x6aba('0x2b')](_0x4314bf);}return _0x401dd2;}return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x47997b,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6aba('0xb')][_0x6aba('0x14e')]=function(_0x3b6bb4){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x3b6bb4[_0x6aba('0x30')]));if(!this['isConfigured'](_0x3b6bb4[_0x6aba('0x14f')])){return this['channel']['error'](_0x3b6bb4,_0x6aba('0x150'));}logger['info'](util[_0x6aba('0x23')](_0x6aba('0x151'),this['channel'][_0x6aba('0x36')],_0x3b6bb4[_0x6aba('0x14f')]));var _0x2c896f=this['agentLogin'][_0x6aba('0x69')](this,_0x3b6bb4[_0x6aba('0x14f')]);if(_0x2c896f){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6aba('0x32')]['callerid'],_0x3b6bb4['findBy']));this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x152'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x3b6bb4[_0x6aba('0x14f')]));return{'code':0xc8,'result':_0x6aba('0x153')};}else{logger[_0x6aba('0x26')](util['format'](_0x6aba('0x154'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x3b6bb4[_0x6aba('0x14f')]));this['channel']['noop'](util['format'](_0x6aba('0x154'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x3b6bb4[_0x6aba('0x14f')]));return{'code':0xc8,'result':_0x6aba('0x155')};}};AGIVertices[_0x6aba('0xb')][_0x6aba('0x156')]=function(_0x40a3f1){logger['info'](util[_0x6aba('0x23')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x40a3f1[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x40a3f1[_0x6aba('0x14f')])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x40a3f1,_0x6aba('0x150'));}logger[_0x6aba('0x26')](util[_0x6aba('0x23')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6aba('0x32')][_0x6aba('0x36')],_0x40a3f1[_0x6aba('0x14f')]));var _0x5a5510=this[_0x6aba('0x4c')][_0x6aba('0x69')](this,_0x40a3f1[_0x6aba('0x14f')]);if(_0x5a5510){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x152'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x40a3f1[_0x6aba('0x14f')]));this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format'](_0x6aba('0x152'),this[_0x6aba('0x32')]['callerid'],_0x40a3f1[_0x6aba('0x14f')]));return{'code':0xc8,'result':_0x6aba('0x153')};}else{logger[_0x6aba('0x26')](util['format'](_0x6aba('0x154'),this['channel'][_0x6aba('0x36')],_0x40a3f1['findBy']));this[_0x6aba('0x32')]['noop'](util['format'](_0x6aba('0x154'),this['channel']['callerid'],_0x40a3f1['findBy']));return{'code':0xc8,'result':_0x6aba('0x155')};}};AGIVertices[_0x6aba('0xb')][_0x6aba('0x157')]=function(_0x2f06c6){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x158'),_0x2f06c6[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x2f06c6[_0x6aba('0x159')])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x2f06c6,'no\x20operation\x20configured');}this['channel']['noop'](util[_0x6aba('0x23')](_0x6aba('0x15a'),_0x2f06c6[_0x6aba('0x159')]));var _0x88932=eval(_0x2f06c6[_0x6aba('0x159')]);if(!this['isConfigured'](_0x2f06c6['variable_id'])){return this['channel'][_0x6aba('0xa2')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2a4a1e=this[_0x6aba('0xc')]['sync'](this,_0x2f06c6[_0x6aba('0xd1')]);if(!_0x2a4a1e){return this[_0x6aba('0x32')]['error'](_0x2f06c6,_0x6aba('0x15b'));}if(_['isArray'](_0x88932)){var _0x15e63c=this;_0x88932[_0x6aba('0xd2')](function(_0x31ac2d,_0x2b838f){_0x15e63c[_0x6aba('0x32')][_0x6aba('0x99')](util[_0x6aba('0x23')](_0x6aba('0x15c'),_0x2a4a1e,_0x2b838f),_0x31ac2d);});return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x15d'),_0x2a4a1e));}else{return this[_0x6aba('0x32')]['setVariable'](_0x2a4a1e,_0x88932);}};AGIVertices[_0x6aba('0xb')]['menu']=function(_0x90c38){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x15e'),_0x90c38['label']));if(_0x90c38[_0x6aba('0xa0')]===0x0){return this[_0x6aba('0x9f')](_0x90c38);}_0x90c38[_0x6aba('0xa0')]-=0x1;if(!this[_0x6aba('0x7f')](_0x90c38[_0x6aba('0x10e')])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x90c38,_0x6aba('0x15f'));}var _0x4645f2=this['getSound'][_0x6aba('0x69')](this,_0x90c38[_0x6aba('0x10e')]);if(!_0x4645f2){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x90c38,'no\x20file\x20audio\x20found');}var _0x2f249c=this['channel'][_0x6aba('0x160')](_0x4645f2,_0x90c38[_0x6aba('0x10f')],_0x90c38[_0x6aba('0x161')]);var _0x30c8c9=_0x2f249c[_0x6aba('0x9d')];if(_0x2f249c[_0x6aba('0x9d')]===-0x1){this[_0x6aba('0x2f')][_0x6aba('0x69')](this,_0x90c38,'-1');return _0x2f249c;}else if(_0x2f249c[_0x6aba('0x9c')]===_0x6aba('0xb3')){_0x2f249c[_0x6aba('0x9d')]=_0x2f249c[_0x6aba('0x9d')][_0x6aba('0x96')]>0x0?_0x2f249c[_0x6aba('0x9d')]:'t';}else if(_[_0x6aba('0x3f')](_0x2f249c[_0x6aba('0x9d')])){_0x2f249c['result']='#';_0x30c8c9='#';}if(!this[_0x6aba('0x7f')](_0x90c38[_0x6aba('0xd1')])){this['channel'][_0x6aba('0xa2')](_0x6aba('0xd0'));}else{var _0x471b43=this['getVariable'][_0x6aba('0x69')](this,_0x90c38[_0x6aba('0xd1')]);if(!_0x471b43){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x90c38,_0x6aba('0x15b'));}this['channel'][_0x6aba('0x99')](_0x471b43,_0x30c8c9);}this['createSquareDetailsReport'][_0x6aba('0x69')](this,_0x90c38,_0x30c8c9);return _0x2f249c;};AGIVertices[_0x6aba('0xb')]['noop']=function(_0x5b98a0){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x162'),_0x5b98a0['label']));return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x5b98a0[_0x6aba('0x163')]||_0x5b98a0['label']);};AGIVertices[_0x6aba('0xb')][_0x6aba('0x164')]=function(_0x5ed6b8){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x165'),_0x5ed6b8[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x5ed6b8[_0x6aba('0x14f')])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x5ed6b8,_0x6aba('0x150'));}logger[_0x6aba('0x26')](util['format'](_0x6aba('0x151'),this['channel'][_0x6aba('0x36')],_0x5ed6b8[_0x6aba('0x14f')]));var _0x21921a=this[_0x6aba('0x166')][_0x6aba('0x69')](this,_0x5ed6b8['pause_id']);var _0x19d183=this['agentPause']['sync'](this,_0x5ed6b8[_0x6aba('0x14f')],_0x21921a);if(_0x19d183){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x152'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x5ed6b8[_0x6aba('0x14f')]));this['channel']['noop'](util[_0x6aba('0x23')](_0x6aba('0x152'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x5ed6b8['findBy']));return{'code':0xc8,'result':_0x6aba('0x153')};}else{logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x154'),this[_0x6aba('0x32')]['callerid'],_0x5ed6b8[_0x6aba('0x14f')]));this['channel'][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x152'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x5ed6b8['findBy']));return{'code':0xc8,'result':_0x6aba('0x155')};}};AGIVertices[_0x6aba('0xb')]['playback']=function(_0x2dc449){logger['info'](util[_0x6aba('0x23')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2dc449['label']));if(!this['isConfigured'](_0x2dc449['file_id'])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x2dc449,_0x6aba('0x15f'));}var _0x49f5c2=this[_0x6aba('0x10d')][_0x6aba('0x69')](this,_0x2dc449[_0x6aba('0x10e')]);if(!_0x49f5c2){return this['channel'][_0x6aba('0x2b')](_0x2dc449,_0x6aba('0x167'));}var _0x3b298a=this['channel'][_0x6aba('0x50')](_0x6aba('0x168'),[_0x49f5c2,_0x2dc449[_0x6aba('0xdd')]]);if(_0x3b298a[_0x6aba('0x9d')]===-0x1){return _0x3b298a;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format']('Executed\x20command\x20%s\x20%s',_0x6aba('0x168'),_0x49f5c2));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x169')]=function(_0x520cfe){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x16a'),_0x520cfe[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x520cfe[_0x6aba('0x16b')])){return this['channel'][_0x6aba('0x2b')](_0x520cfe,_0x6aba('0x16c'));}var _0x17b024='';var _0x3e91ad=parseInt(_0x520cfe[_0x6aba('0x16b')],0xa);if(isNaN(_0x3e91ad)){_0x17b024=_0x520cfe[_0x6aba('0x16b')];}else{_0x17b024=this[_0x6aba('0x10')][_0x6aba('0x69')](this,_0x520cfe[_0x6aba('0x16b')]);if(!_0x17b024){return this[_0x6aba('0x32')]['error'](_0x520cfe,_0x6aba('0x16d'));}}var _0x158fe5='';if(this['isConfigured'](_0x520cfe['file_id'])){var _0x2a75ba=this[_0x6aba('0x10d')][_0x6aba('0x69')](this,_0x520cfe[_0x6aba('0x10e')]);if(_0x2a75ba){_0x158fe5=_0x2a75ba;}}this[_0x6aba('0x2f')][_0x6aba('0x69')](this,_0x520cfe,_0x17b024);if(_0x520cfe[_0x6aba('0xdd')]['indexOf']('x')<0x0){_0x520cfe[_0x6aba('0xdd')]+='x';}if(_0x520cfe[_0x6aba('0xdd')]['indexOf']('X')<0x0){_0x520cfe[_0x6aba('0xdd')]+='X';}this[_0x6aba('0x32')][_0x6aba('0x99')]('XMCS-QUEUE',_0x17b024?_0x17b024[_0x6aba('0x16e')]():'');var _0x2dc727=this[_0x6aba('0x32')]['exec'](_0x6aba('0x16f'),[_0x17b024,_0x520cfe[_0x6aba('0xdd')],_0x520cfe[_0x6aba('0x5e')],_0x158fe5,_0x520cfe[_0x6aba('0xb3')],_0x520cfe['agi'],_0x520cfe[_0x6aba('0x170')],_0x520cfe['gosub'],'',_0x520cfe['position']]);if(_0x2dc727['result']===-0x1){return _0x2dc727;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x171'),_0x6aba('0x16f'),_0x17b024));};AGIVertices['prototype'][_0x6aba('0x172')]=function(_0x3afde6){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x173'),_0x3afde6[_0x6aba('0x30')]));var _0xb7bc03=_0x3afde6['recordingFormat']||'wav';var _0x10a8f1=util[_0x6aba('0x23')](_0x6aba('0x174'),this[_0x6aba('0x32')][_0x6aba('0x35')],rs[_0x6aba('0x116')](0x5));var _0x2596ce=util[_0x6aba('0x23')](_0x6aba('0x175'),FILES_PATH,_0x10a8f1,_0xb7bc03);var _0x3a0480=util[_0x6aba('0x23')](_0x6aba('0x129'),FILES_PATH,_0x10a8f1);this[_0x6aba('0x34')]['sync'](this,_0x3afde6,_0x10a8f1,_0x2596ce);this[_0x6aba('0x32')][_0x6aba('0x99')](_0x6aba('0x176'),_0x10a8f1);logger['info'](_0x6aba('0x177'),_0x3a0480,_0xb7bc03,_0x3afde6[_0x6aba('0x178')],_0x3afde6[_0x6aba('0xb3')]);return this['channel'][_0x6aba('0x134')](_0x3a0480,_0xb7bc03,_0x3afde6[_0x6aba('0x178')],_0x3afde6[_0x6aba('0xb3')],undefined,!![]);};AGIVertices[_0x6aba('0xb')][_0x6aba('0x179')]=function(_0x441395){logger[_0x6aba('0x26')](util['format'](_0x6aba('0x17a'),_0x441395[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x441395['url'])){return this[_0x6aba('0x32')]['noop']('no\x20url\x20configured');}var _0x3d6d47=this[_0x6aba('0x5d')][_0x6aba('0x69')](this,_0x441395);logger['info'](util[_0x6aba('0x23')](_0x6aba('0x17b'),util[_0x6aba('0x17c')](_0x3d6d47,{'showHidden':![],'depth':null})));if(!this[_0x6aba('0x7f')](_0x441395[_0x6aba('0xd1')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x17d'));}var _0x596109=this['getVariable']['sync'](this,_0x441395[_0x6aba('0xd1')]);if(!_0x596109){return this['channel'][_0x6aba('0x2b')](_0x441395,_0x6aba('0x15b'));}this[_0x6aba('0x32')][_0x6aba('0x99')](util[_0x6aba('0x23')](_0x6aba('0x17e'),_0x596109),_0x3d6d47[_0x6aba('0x6d')]?_0x3d6d47[_0x6aba('0x6d')]:_0x6aba('0x17f'));this[_0x6aba('0x32')][_0x6aba('0x99')](util['format'](_0x6aba('0x180'),_0x596109),_0x3d6d47[_0x6aba('0x6e')]?_0x3d6d47['statusMessage']:'OK');if(_0x3d6d47[_0x6aba('0x63')]){try{this[_0x6aba('0x97')](_0x3d6d47['body'],_0x596109);}catch(_0x4ca195){logger[_0x6aba('0x2b')](util[_0x6aba('0x23')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x596109));}}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')]('variable\x20%s\x20set',_0x596109));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x181')]=function(_0xe329d6){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x182'),_0xe329d6['label']));return this[_0x6aba('0x32')][_0x6aba('0x183')](_0xe329d6[_0x6aba('0x184')][_0x6aba('0x52')](/\s+/g,''),_0xe329d6[_0x6aba('0x178')]);};AGIVertices[_0x6aba('0xb')][_0x6aba('0x185')]=function(_0x3472c9){logger[_0x6aba('0x26')](util['format'](_0x6aba('0x186'),_0x3472c9[_0x6aba('0x30')]));return this[_0x6aba('0x32')][_0x6aba('0x187')](_0x3472c9[_0x6aba('0x60')]['replace'](/\s+/g,''),_0x3472c9[_0x6aba('0x178')]);};AGIVertices[_0x6aba('0xb')][_0x6aba('0x188')]=function(_0x32bdd1){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x189'),_0x32bdd1[_0x6aba('0x30')]));return this[_0x6aba('0x32')][_0x6aba('0x18a')](_0x32bdd1['text'],_0x32bdd1[_0x6aba('0x178')]);};AGIVertices[_0x6aba('0xb')]['sendMail']=function(_0x36cf41){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x18b'),_0x36cf41[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x36cf41[_0x6aba('0x18c')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x18d'));}var _0x1627fd=this[_0x6aba('0x18e')][_0x6aba('0x69')](this,_0x36cf41[_0x6aba('0x18c')]);if(!_0x1627fd||!_0x1627fd[_0x6aba('0x18f')]){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x36cf41,_0x6aba('0x190'));}var _0x5c50b3={'from':util[_0x6aba('0x23')](_0x6aba('0x191'),_0x1627fd[_0x6aba('0xe')],_0x1627fd['email']||_0x1627fd[_0x6aba('0x18f')]['user']),'to':_0x36cf41['to']||'','cc':_0x36cf41['cc']||'','bcc':_0x36cf41[_0x6aba('0x192')]||'','subject':_0x36cf41['subject'],'html':_0x36cf41[_0x6aba('0x56')],'text':_0x36cf41[_0x6aba('0x56')]};if(this[_0x6aba('0x7f')](_0x36cf41[_0x6aba('0x193')])){}logger[_0x6aba('0xd7')](_0x6aba('0x194'),JSON['stringify'](_0x5c50b3));this['createSquareDetailsReport'][_0x6aba('0x69')](this,_0x36cf41,_0x36cf41['account_id']);this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format'](_0x6aba('0x195'),_0x1627fd[_0x6aba('0xe')]));this['sendMailMessage']['sync'](this,_0x1627fd[_0x6aba('0x196')],_0x5c50b3);return this[_0x6aba('0x32')][_0x6aba('0xa2')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x6aba('0xb')]['sendFax']=function(_0x511afe){logger[_0x6aba('0x26')](util[_0x6aba('0x23')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x511afe['label']));return this[_0x6aba('0x32')][_0x6aba('0xa2')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x6aba('0x197')]=function(_0x18e302){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x198'),_0x18e302['label']));if(!this[_0x6aba('0x7f')](_0x18e302['sms_account_id'])){return this[_0x6aba('0x32')]['noop'](_0x6aba('0x199'));}var _0x38d843=this[_0x6aba('0x2d')][_0x6aba('0x69')](this,_0x18e302['sms_account_id']);if(!_0x38d843){return this['channel'][_0x6aba('0x2b')](_0x18e302,_0x6aba('0x19a'));}var _0x3477ed={'body':_0x18e302[_0x6aba('0x19b')],'phone':_0x18e302['to']||'','SmsAccountId':_0x38d843['id']};logger['debug'](_0x6aba('0x19c'),JSON['stringify'](_0x3477ed));this[_0x6aba('0x2f')]['sync'](this,_0x18e302,_0x18e302[_0x6aba('0x19d')]);this['channel'][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x19e'),_0x38d843[_0x6aba('0xe')]));this[_0x6aba('0x19f')]['sync'](this,_0x3477ed);return this[_0x6aba('0x32')]['noop'](_0x6aba('0x1a0'));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x1a1')]=function(_0x4fff59){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x1a2'),_0x4fff59[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x4fff59['variable_id'])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x4fff59,_0x6aba('0x1a3'));}var _0x1c5648=this['getVariable'][_0x6aba('0x69')](this,_0x4fff59[_0x6aba('0xd1')]);if(!_0x1c5648){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x4fff59,'no\x20variable\x20found');}return this[_0x6aba('0x32')]['setVariable'](_0x1c5648,_0x4fff59['variable_value']);};AGIVertices[_0x6aba('0xb')]['start']=function(_0x30043f){logger['info'](util[_0x6aba('0x23')]('Enter\x20in\x20START\x20(%s)\x20block',_0x30043f[_0x6aba('0x30')]));this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x1a4'));var _0x50f365=this[_0x6aba('0x32')][_0x6aba('0xc')](_0x6aba('0x1a5'));if(!_['isEmpty'](_0x50f365[_0x6aba('0x9c')])){this[_0x6aba('0x32')][_0x6aba('0x35')]=_0x50f365[_0x6aba('0x9c')];}if(_0x30043f['answer']===_0x6aba('0x1a6')){this[_0x6aba('0x32')]['noop'](_0x6aba('0x1a7'));return this['channel'][_0x6aba('0xb1')]();}return this[_0x6aba('0x32')][_0x6aba('0xa2')]('Skipped\x20Answer');};AGIVertices[_0x6aba('0xb')]['subproject']=function(_0x25b54f){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x1a8'),_0x25b54f[_0x6aba('0x30')]));if(!this['isConfigured'](_0x25b54f[_0x6aba('0x1a9')])){return this[_0x6aba('0x32')]['error'](_0x25b54f,_0x6aba('0x1aa'));}var _0x5aa5a0=this['getSquareProject'][_0x6aba('0x69')](this,_0x25b54f[_0x6aba('0x1a9')]);if(!this[_0x6aba('0x7f')](_0x5aa5a0)){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x25b54f,util[_0x6aba('0x23')](_0x6aba('0x1ab'),_0x25b54f['project_id']));}if(_0x5aa5a0===this[_0x6aba('0x32')]['arg_1']){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x25b54f,_0x6aba('0x1ac'));}this[_0x6aba('0x2f')]['sync'](this,_0x25b54f,_0x5aa5a0);var _0x308e33=this['channel']['exec']('AGI',util['format'](_0x6aba('0x1ad'),config[_0x6aba('0x4')]['host']||_0x6aba('0x1ae'),_0x5aa5a0,this[_0x6aba('0x32')]['arg_1']));if(_0x308e33[_0x6aba('0x9d')]===-0x1){return _0x308e33;}return this[_0x6aba('0x32')]['noop'](util[_0x6aba('0x23')](_0x6aba('0x171'),_0x6aba('0x1af'),_0x5aa5a0));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x1b0')]=function(_0x2fe9cf){logger[_0x6aba('0x26')](util[_0x6aba('0x23')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2fe9cf[_0x6aba('0x30')]));var _0x373809=this[_0x6aba('0x1b1')]['sync'](this,_0x2fe9cf[_0x6aba('0x1b2')]);this[_0x6aba('0x2f')][_0x6aba('0x69')](this,_0x2fe9cf,_0x2fe9cf[_0x6aba('0x1b2')]);if(this['isConfigured'](_0x2fe9cf[_0x6aba('0xd1')])){var _0x181094=this[_0x6aba('0xc')]['sync'](this,_0x2fe9cf[_0x6aba('0xd1')]);if(_0x181094){this[_0x6aba('0x32')][_0x6aba('0x99')](_0x181094,_0x373809);return this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format'](_0x6aba('0x1b3'),_0x2fe9cf[_0x6aba('0x1b2')],_0x181094));}}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')](_0x6aba('0x1b4'),_0x2fe9cf[_0x6aba('0x1b2')]));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x1b5')]=function(_0x20ceb3){logger[_0x6aba('0x26')](util['format'](_0x6aba('0x1b6'),_0x20ceb3[_0x6aba('0x30')]));_0x20ceb3['text']=_0x20ceb3[_0x6aba('0x56')][_0x6aba('0x52')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x20ceb3[_0x6aba('0x54')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0x1b7'));}if(!this[_0x6aba('0x7f')](_0x20ceb3[_0x6aba('0x56')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')]('no\x20text\x20configured');}this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x20ceb3['text']));var _0x161bfb=this[_0x6aba('0x53')][_0x6aba('0x69')](this,_0x20ceb3);if(_0x161bfb){this[_0x6aba('0x32')][_0x6aba('0xa2')](util[_0x6aba('0x23')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x161bfb));var _0x8b7603=this[_0x6aba('0x32')][_0x6aba('0xff')](_0x161bfb);try{fs[_0x6aba('0x11e')](_0x161bfb+'.wav');}catch(_0x44cfd8){logger['error'](_0x44cfd8);}return _0x8b7603;}return this['channel'][_0x6aba('0x2b')](_0x20ceb3,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6aba('0xb')]['tts']=function(_0x418e44){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x1b8'),_0x418e44[_0x6aba('0x30')]));_0x418e44[_0x6aba('0x56')]=_0x418e44[_0x6aba('0x56')][_0x6aba('0x52')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6aba('0x7f')](_0x418e44[_0x6aba('0x56')])){return this[_0x6aba('0x32')][_0x6aba('0xa2')](_0x6aba('0xa3'));}this['channel']['noop'](util[_0x6aba('0x23')](_0x6aba('0x1b9'),_0x418e44[_0x6aba('0x56')]));var _0x911697=this['googleTTS'][_0x6aba('0x69')](this,_0x418e44);if(_0x911697){this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x911697));var _0x5469fe=this[_0x6aba('0x32')]['streamFile'](_0x911697);try{fs[_0x6aba('0x11e')](_0x911697+_0x6aba('0x100'));}catch(_0x5143e5){logger[_0x6aba('0x2b')](_0x5143e5);}return _0x5469fe;}return this[_0x6aba('0x32')]['error'](_0x418e44,_0x6aba('0x1ba'));};AGIVertices[_0x6aba('0xb')]['unpause']=function(_0x124768){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x1bb'),_0x124768[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x124768[_0x6aba('0x14f')])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x124768,_0x6aba('0x150'));}logger['info'](util[_0x6aba('0x23')](_0x6aba('0x151'),this['channel'][_0x6aba('0x36')],_0x124768[_0x6aba('0x14f')]));var _0x11cedb=this['agentUnpause'][_0x6aba('0x69')](this,_0x124768[_0x6aba('0x14f')]);if(_0x11cedb){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x152'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x124768[_0x6aba('0x14f')]));this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format'](_0x6aba('0x152'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x124768['findBy']));return{'code':0xc8,'result':_0x6aba('0x153')};}else{logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x154'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x124768[_0x6aba('0x14f')]));this[_0x6aba('0x32')]['noop'](util[_0x6aba('0x23')](_0x6aba('0x154'),this[_0x6aba('0x32')][_0x6aba('0x36')],_0x124768[_0x6aba('0x14f')]));return{'code':0xc8,'result':_0x6aba('0x155')};}};AGIVertices[_0x6aba('0xb')][_0x6aba('0x1bc')]=function(_0xad9a44){logger[_0x6aba('0x26')](util[_0x6aba('0x23')](_0x6aba('0x1bd'),_0xad9a44[_0x6aba('0x30')]));var _0x4f0780=this[_0x6aba('0x32')][_0x6aba('0x50')](_0x6aba('0x1be'),[_0xad9a44[_0x6aba('0x1bf')],_0xad9a44[_0x6aba('0x70')]]);if(_0x4f0780[_0x6aba('0x9d')]===-0x1){return _0x4f0780;}return this[_0x6aba('0x32')][_0x6aba('0xa2')](util['format'](_0x6aba('0x171'),_0x6aba('0x1be'),_0xad9a44[_0x6aba('0x1bf')]));};AGIVertices[_0x6aba('0xb')][_0x6aba('0x1c0')]=function(_0x28c437){logger['info'](util[_0x6aba('0x23')](_0x6aba('0x1c1'),_0x28c437[_0x6aba('0x30')]));if(!this[_0x6aba('0x7f')](_0x28c437['variable_id'])){return this[_0x6aba('0x32')][_0x6aba('0x2b')](_0x28c437,_0x6aba('0x1a3'));}var _0x150461=this[_0x6aba('0xc')][_0x6aba('0x69')](this,_0x28c437[_0x6aba('0xd1')]);if(!_0x150461){return this['channel']['error'](_0x28c437,_0x6aba('0x15b'));}var _0x521bc6=this[_0x6aba('0x32')][_0x6aba('0xc')](_0x150461);return{'code':0xc8,'result':_0x521bc6['extra']?_0x521bc6['extra']:'-'};};String[_0x6aba('0xb')][_0x6aba('0x9b')]=function(_0x2e7745,_0x2c4c31){return this['split'](_0x2e7745)[_0x6aba('0x1c2')](_0x2c4c31);};module[_0x6aba('0x1c3')]=AGIVertices; \ No newline at end of file +var _0x24ca=['getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunk','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','channel','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createCmContact','isEmpty','isNil','callback_','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPauseById','agentPause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','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','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','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','%s/recordings/%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','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','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','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','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject'];(function(_0x21ecc8,_0x2bdead){var _0x510c1d=function(_0x3b6862){while(--_0x3b6862){_0x21ecc8['push'](_0x21ecc8['shift']());}};_0x510c1d(++_0x2bdead);}(_0x24ca,0x1bc));var _0xa24c=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x24ca[_0x137d1d];return _0x485108;};'use strict';var fs=require('fs');var util=require(_0xa24c('0x0'));var _=require('lodash');var sh=require(_0xa24c('0x1'));var odbc=require(_0xa24c('0x2'))();var rs=require(_0xa24c('0x3'));var moment=require('moment');var Mustache=require(_0xa24c('0x4'));var rp=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var scripts=require(_0xa24c('0x9'));var FILES_PATH=_0xa24c('0xa');var recursiveMapAttributes=[_0xa24c('0xb'),_0xa24c('0xc')];var verticesWithRetry=[_0xa24c('0xd'),_0xa24c('0xe'),'getsecretdigits'];var AGIVertices=function(_0x42d89c,_0x3a5727,_0x2d645c){this['channel']=_0x42d89c;this[_0xa24c('0xf')]=_0x3a5727;this[_0xa24c('0x10')]=_0x2d645c;};AGIVertices[_0xa24c('0x11')][_0xa24c('0x12')]=function(_0x169632,_0x43aa5a){this[_0xa24c('0xf')][_0xa24c('0x13')](_0x169632)[_0xa24c('0x14')](function(_0x5aa811){_0x43aa5a(null,_0x5aa811?_0x5aa811[_0xa24c('0x15')]:![]);})[_0xa24c('0x16')](function(_0xcee4fe){_0x43aa5a(_0xcee4fe);});};AGIVertices[_0xa24c('0x11')]['getVoiceQueue']=function(_0x3ad0bf,_0x3c23fc){this[_0xa24c('0xf')][_0xa24c('0x17')](_0x3ad0bf)[_0xa24c('0x14')](function(_0x2d185c){_0x3c23fc(null,_0x2d185c?_0x2d185c[_0xa24c('0x15')]:![]);})['catch'](function(_0x47a063){_0x3c23fc(_0x47a063);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x18')]=function(_0x49ce53,_0x5babb5){this[_0xa24c('0xf')][_0xa24c('0x19')](_0x49ce53)['then'](function(_0x2a64ff){_0x5babb5(null,_0x2a64ff?_0x2a64ff['name']:![]);})[_0xa24c('0x16')](function(_0x2a610a){_0x5babb5(_0x2a610a);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1a')]=function(_0x4ff97c,_0x16d363){this[_0xa24c('0xf')][_0xa24c('0x1b')](_0x4ff97c)['then'](function(_0x48a768){_0x16d363(null,_0x48a768?_0x48a768['dsn']:![]);})['catch'](function(_0x2173f6){_0x16d363(_0x2173f6);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1c')]=function(_0x180297,_0x51a275){this[_0xa24c('0xf')]['getUserById'](_0x180297)[_0xa24c('0x14')](function(_0xb81d97){_0x51a275(null,_0xb81d97?_0xb81d97['name']:![]);})[_0xa24c('0x16')](function(_0x363d52){_0x51a275(_0x363d52);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1d')]=function(_0x14cc65,_0x47e0eb){this[_0xa24c('0xf')]['getTrunkById'](_0x14cc65)[_0xa24c('0x14')](function(_0x3951ae){_0x47e0eb(null,_0x3951ae?_0x3951ae[_0xa24c('0x15')]:![]);})['catch'](function(_0x1beb55){_0x47e0eb(_0x1beb55);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1e')]=function(_0x314121,_0x11e4e0){var _0x3ad0e6=this;this[_0xa24c('0xf')]['getSoundById'](_0x314121)[_0xa24c('0x14')](function(_0x28675f){_0x11e4e0(null,_0x28675f?_0x3ad0e6[_0xa24c('0x1f')](_0x28675f[_0xa24c('0x20')]):![]);})['catch'](function(_0x21d2a8){_0x11e4e0(_0x21d2a8);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x21')]=function(_0x59dbeb,_0x15eaaf){this[_0xa24c('0xf')][_0xa24c('0x22')](_0x59dbeb)['then'](function(_0x245fb2){_0x15eaaf(null,_0x245fb2?_0x245fb2:![]);})['catch'](function(_0x1102ab){_0x15eaaf(_0x1102ab);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x23')]=function(_0x5d025a,_0x1f52f8,_0x53f90){this[_0xa24c('0x10')]['sendMailMessage'](_0x5d025a,_0x1f52f8)[_0xa24c('0x14')](function(){_0x53f90(null);})['catch'](function(_0xa20091){_0x53f90(_0xa20091);});};AGIVertices[_0xa24c('0x11')]['getIntervals']=function(_0x5680f5,_0x20a276){this[_0xa24c('0xf')][_0xa24c('0x24')](_0x5680f5)[_0xa24c('0x14')](function(_0x298dec){if(_0x298dec){if(_0x298dec[_0xa24c('0x25')]){_0x20a276(null,[_0x298dec[_0xa24c('0x26')]]);}else{_0x20a276(null,_['map'](_0x298dec[_0xa24c('0x27')],_0xa24c('0x26')));}}else{_0x20a276(null,![]);}})[_0xa24c('0x16')](function(_0xbd24c0){_0x20a276(_0xbd24c0);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1f')]=function(_0x86902f){return util[_0xa24c('0x28')](_0xa24c('0x29'),FILES_PATH,_0x86902f);};AGIVertices[_0xa24c('0x11')]['getQueryOdbc']=function(_0x70a957,_0x66f5a6,_0x2b362d){odbc[_0xa24c('0x2a')](_0x70a957,function(_0x578b72){if(_0x578b72){logger['error'](_0xa24c('0x2b'),_0x578b72);_0x2b362d(_0x578b72);}else{logger['info'](_0xa24c('0x2c'));odbc[_0xa24c('0x2d')](_0x66f5a6,function(_0x22a316,_0xa10c1){if(_0x22a316){logger[_0xa24c('0x2e')]('Error\x20executing\x20query\x20%s',_0x66f5a6);_0x2b362d(_0x22a316);}else{logger['info'](_0xa24c('0x2f'),_0x66f5a6);odbc[_0xa24c('0x30')](function(_0x3603db){if(_0x3603db){logger[_0xa24c('0x31')](_0xa24c('0x32'),_0x3603db);}_0x2b362d(null,_0xa10c1);});}});}});};AGIVertices[_0xa24c('0x11')]['getSmsAccount']=function(_0x56f392,_0x2a9317){this[_0xa24c('0xf')][_0xa24c('0x33')](_0x56f392)[_0xa24c('0x14')](function(_0x43beff){_0x2a9317(null,_0x43beff?_0x43beff:![]);})['catch'](function(_0x171c51){_0x2a9317(_0x171c51);});};AGIVertices[_0xa24c('0x11')]['createSmsMessage']=function(_0x599627,_0xba7407){this[_0xa24c('0xf')][_0xa24c('0x34')](_0x599627)['then'](function(_0x58ac8b){_0xba7407(null,_0x58ac8b);})[_0xa24c('0x16')](function(_0x32af67){_0xba7407(_0x32af67);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x35')]=function(_0x3f640e,_0x1b7faf,_0x23d1e0){this[_0xa24c('0xf')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0xa24c('0x36')],'node':_0x3f640e[_0xa24c('0x37')],'application':_0x3f640e[_0xa24c('0x38')],'data':_0x1b7faf||null,'project_name':this['channel'][_0xa24c('0x39')],'callerid':this[_0xa24c('0x3a')][_0xa24c('0x3b')]})[_0xa24c('0x14')](function(_0x442ede){if(_0x23d1e0){_0x23d1e0(null,_0x442ede);}})[_0xa24c('0x16')](function(_0x1e7e97){if(_0x23d1e0){_0x23d1e0(_0x1e7e97);}});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x3c')]=function(_0x320582,_0x4bbf93,_0xb8c7a5,_0x183107){this[_0xa24c('0xf')]['createSquareRecording']({'uniqueid':this[_0xa24c('0x3a')][_0xa24c('0x36')],'callerid':this[_0xa24c('0x3a')][_0xa24c('0x3b')],'calleridname':this[_0xa24c('0x3a')][_0xa24c('0x3d')],'context':this[_0xa24c('0x3a')][_0xa24c('0x3e')],'extension':this[_0xa24c('0x3a')][_0xa24c('0x3f')],'priority':this[_0xa24c('0x3a')]['priority'],'accountcode':this[_0xa24c('0x3a')][_0xa24c('0x40')],'dnid':this[_0xa24c('0x3a')][_0xa24c('0x41')],'projectName':this[_0xa24c('0x3a')][_0xa24c('0x39')],'saveName':_0x4bbf93,'filename':_0x320582[_0xa24c('0x42')]||_0x4bbf93,'savePath':_0xb8c7a5})[_0xa24c('0x14')](function(_0x184179){_0x183107(null,_0x184179);})['catch'](function(_0x540da8){_0x183107(_0x540da8);});};AGIVertices[_0xa24c('0x11')]['createSquareMessage']=function(_0xc078ef,_0x1f436c,_0x4ec677,_0x24b3df,_0x2bf401){this[_0xa24c('0xf')]['createSquareMessage']({'uniqueid':this['channel'][_0xa24c('0x36')],'body':_0xc078ef,'direction':_0x1f436c,'providerName':_0x4ec677,'providerResponse':_0x24b3df})['then'](function(_0x4769a1){if(_0x2bf401){_0x2bf401(null,_0x4769a1);}})[_0xa24c('0x16')](function(_0x3c3c8b){if(_0x2bf401){_0x2bf401(_0x3c3c8b);}});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x43')]=function(_0x1fa739,_0x3f3ce6){this[_0xa24c('0xf')][_0xa24c('0x43')]({'firstName':_[_0xa24c('0x44')](_0x1fa739['name'])||_[_0xa24c('0x45')](_0x1fa739[_0xa24c('0x15')])?_0xa24c('0x46')+Math['random']():_0x1fa739['name'],'lastName':_['isEmpty'](_0x1fa739[_0xa24c('0x47')])||_['isNil'](_0x1fa739[_0xa24c('0x47')])?null:_0x1fa739[_0xa24c('0x47')],'phone':_0x1fa739['phone'],'ListId':_0x1fa739[_0xa24c('0x48')],'scheduledat':_0x1fa739[_0xa24c('0x49')],'callbackUniqueid':this[_0xa24c('0x3a')][_0xa24c('0x36')],'tags':_0xa24c('0x4a'),'description':_0xa24c('0x4b')+_0x1fa739[_0xa24c('0x49')][_0xa24c('0x4c')](),'priority':_0x1fa739['callback_priority']})[_0xa24c('0x14')](function(_0x47af80){_0x3f3ce6(null,_0x47af80);})['catch'](function(_0x565f0a){_0x3f3ce6(_0x565f0a);});};AGIVertices['prototype']['getPause']=function(_0x15e21f,_0x4bb0db){this[_0xa24c('0xf')][_0xa24c('0x4d')](_0x15e21f)[_0xa24c('0x14')](function(_0x1a5f17){_0x4bb0db(null,_0x1a5f17?_0x1a5f17[_0xa24c('0x15')]:![]);})[_0xa24c('0x16')](function(_0x6f5aad){_0x4bb0db(_0x6f5aad);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x4e')]=function(_0x3de0e3,_0x303b7d,_0x37dbbd){var _0x358b48={'role':_0xa24c('0x4f')};_0x358b48[_0x3de0e3]=this[_0xa24c('0x3a')]['callerid'];this[_0xa24c('0xf')][_0xa24c('0x4e')](_0x358b48,_0x303b7d,this['channel'][_0xa24c('0x36')])[_0xa24c('0x14')](function(_0x31a208){_0x37dbbd(null,_[_0xa24c('0x45')](_0x31a208)?![]:!![]);})['catch'](function(_0x4ba64a){logger[_0xa24c('0x31')](_0x4ba64a);_0x37dbbd(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x3549fe,_0x2515b1){var _0x120b38={'role':_0xa24c('0x4f')};_0x120b38[_0x3549fe]=this['channel']['callerid'];this[_0xa24c('0xf')]['agentUnpause'](_0x120b38)['then'](function(_0xfcc193){_0x2515b1(null,_[_0xa24c('0x45')](_0xfcc193)?![]:!![]);})[_0xa24c('0x16')](function(_0x54528f){logger[_0xa24c('0x31')](_0x54528f);_0x2515b1(null,![]);});};AGIVertices[_0xa24c('0x11')]['agentLogout']=function(_0x37d4da,_0x3f306d){var _0x3096bf={'role':'agent'};_0x3096bf[_0x37d4da]=this[_0xa24c('0x3a')][_0xa24c('0x3b')];this[_0xa24c('0xf')][_0xa24c('0x50')](_0x3096bf)[_0xa24c('0x14')](function(_0x4e89e4){_0x3f306d(null,_[_0xa24c('0x45')](_0x4e89e4)?![]:!![]);})[_0xa24c('0x16')](function(_0x1e2da8){logger[_0xa24c('0x31')](_0x1e2da8);_0x3f306d(null,![]);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x51')]=function(_0x239c87,_0x4f4ed9){var _0x266a1e={'role':_0xa24c('0x4f')};_0x266a1e[_0x239c87]=this['channel'][_0xa24c('0x3b')];var _0x3e455b=_0x239c87!=_0xa24c('0x52')?util[_0xa24c('0x28')](_0xa24c('0x53'),_0xa24c('0x54'),this[_0xa24c('0x3a')][_0xa24c('0x3b')]):undefined;this[_0xa24c('0xf')][_0xa24c('0x51')](_0x266a1e,_0x3e455b)['then'](function(_0x2771a1){_0x4f4ed9(null,_[_0xa24c('0x45')](_0x2771a1)?![]:!![]);})[_0xa24c('0x16')](function(_0x5e52f4){logger[_0xa24c('0x31')](_0x5e52f4);_0x4f4ed9(null,![]);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x55')]=function(_0x5023e3,_0x3ac3a0){sh[_0xa24c('0x56')](_[_0xa24c('0x57')](_0x5023e3),function(_0xc0f2bc,_0x320901){var _0x2635c0=_0x320901['replace'](/(\r\n|\n|\r)/gm,'');_0x3ac3a0(null,_0x2635c0);});};AGIVertices['prototype'][_0xa24c('0x58')]=function(_0x4b281b,_0x16678e){scripts[_0xa24c('0x58')](_0x4b281b[_0xa24c('0x59')],_0x4b281b[_0xa24c('0x5a')]||_0xa24c('0x5b'),_0x4b281b['text'],_0x4b281b[_0xa24c('0x5c')]||_0xa24c('0x5d'),_0x4b281b[_0xa24c('0x5e')]||_0xa24c('0x5f'),_0x4b281b[_0xa24c('0x60')]||_0xa24c('0x61'))['then'](function(_0x34d8c8){_0x16678e(null,_0x34d8c8);})[_0xa24c('0x16')](function(_0x42b79b){_0x16678e(_0x42b79b);});};AGIVertices[_0xa24c('0x11')]['googleTTS']=function(_0x403bf1,_0x4d8e3a){scripts[_0xa24c('0x62')](_0x403bf1[_0xa24c('0x5b')],_0x403bf1[_0xa24c('0x63')]||'en',0x1)[_0xa24c('0x14')](function(_0x5726e1){_0x4d8e3a(null,_0x5726e1);})[_0xa24c('0x16')](function(_0x2f3afb){_0x4d8e3a(_0x2f3afb);});};AGIVertices['prototype'][_0xa24c('0x64')]=function(_0x168a8b,_0x135cef){var _0x3e0c08={'uri':_0x168a8b[_0xa24c('0x65')],'method':_0x168a8b[_0xa24c('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x168a8b[_0xa24c('0x67')])===_0xa24c('0x68')&&parseInt(_0x168a8b['timeout'])>=0x1?parseInt(_0x168a8b[_0xa24c('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xa24c('0x69')]([_0xa24c('0x6a'),_0xa24c('0x6b')],_0x3e0c08[_0xa24c('0x66')][_0xa24c('0x6c')]())){try{_0x3e0c08[_0xa24c('0x6d')]=_0x168a8b[_0xa24c('0xc')]?JSON[_0xa24c('0x6e')](_0x168a8b[_0xa24c('0xc')]):{};}catch(_0xc4aa48){logger['error'](_0xa24c('0x6f'),_0xc4aa48);}}try{_0x3e0c08[_0xa24c('0x70')]=_0x168a8b['rawHeaders']?JSON[_0xa24c('0x6e')](_0x168a8b[_0xa24c('0xb')]):{};}catch(_0x1f7c59){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1f7c59);}if(_0x168a8b[_0xa24c('0x71')]){try{var _0x4c9b19=require(_0x168a8b['computedVariables'])[_0xa24c('0x72')](this,_0x3e0c08);_0x3e0c08[_0xa24c('0x73')]=Mustache[_0xa24c('0x74')](_0x168a8b[_0xa24c('0x65')],_0x4c9b19,{},['$$','$$']);if(_0x3e0c08[_0xa24c('0x70')]){_0x3e0c08[_0xa24c('0x70')]=JSON['parse'](Mustache['render'](JSON['stringify'](_0x3e0c08[_0xa24c('0x70')]),_0x4c9b19,{},['$$','$$']));}if(_0x3e0c08['body']){_0x3e0c08['body']=JSON[_0xa24c('0x6e')](Mustache[_0xa24c('0x74')](JSON[_0xa24c('0x75')](_0x3e0c08[_0xa24c('0x6d')]),_0x4c9b19,{},['$$','$$']));}}catch(_0x84ddcc){logger[_0xa24c('0x31')](_0xa24c('0x76'),_0x84ddcc);}}rp(_0x3e0c08)[_0xa24c('0x14')](function(_0x2544fc){var _0x4ee10d={'statusCode':_0x2544fc[_0xa24c('0x77')]||0xc8,'statusMessage':_0x2544fc[_0xa24c('0x78')]||'OK','headers':_0x2544fc[_0xa24c('0x70')]||{},'body':_0x2544fc[_0xa24c('0x6d')]||{}};_0x135cef(null,_0x4ee10d);})[_0xa24c('0x16')](function(_0x84aa80){var _0x8aabc1={'statusCode':_0x84aa80[_0xa24c('0x77')]||0x1f4,'statusMessage':_0x84aa80[_0xa24c('0x79')]||_0xa24c('0x7a'),'headers':_0x84aa80[_0xa24c('0x7b')][_0xa24c('0x70')]||{},'body':_0x84aa80['options'][_0xa24c('0x6d')]||{}};_0x135cef(null,_0x8aabc1);});};AGIVertices[_0xa24c('0x11')]['googleDialogflow']=function(_0x257941,_0x1a0afd){scripts[_0xa24c('0x7c')](this['channel'][_0xa24c('0x36')],_0x257941[_0xa24c('0x7d')],_0x257941['text'],_0x257941[_0xa24c('0x7e')]||'en')[_0xa24c('0x14')](function(_0x4c108f){_0x1a0afd(null,_0x4c108f);})['catch'](function(_0x124d52){_0x1a0afd(_0x124d52);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x7f')]=function(_0x10c89f,_0x4a9ec2){scripts[_0xa24c('0x7f')](this[_0xa24c('0x3a')][_0xa24c('0x36')],_0x10c89f['dialogflowV2_project_id'],_0x10c89f['client_email'],_0x10c89f[_0xa24c('0x80')],_0x10c89f[_0xa24c('0x5b')],_0x10c89f[_0xa24c('0x81')]||'en')['then'](function(_0x568cc4){_0x4a9ec2(null,_0x568cc4);})[_0xa24c('0x16')](function(_0x51e48a){_0x4a9ec2(_0x51e48a);});};AGIVertices['prototype']['sestekNDA']=function(_0xdff1eb,_0x2c47bf){scripts[_0xa24c('0x82')](this[_0xa24c('0x3a')],_0xdff1eb)[_0xa24c('0x14')](function(_0x12836d){_0x2c47bf(null,_0x12836d);})[_0xa24c('0x16')](function(_0x2cb601){_0x2c47bf(_0x2cb601);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x83')]=function(_0x1c172c,_0x24b28c){scripts['ispeechTTS'](_0x1c172c[_0xa24c('0x7d')],_0x1c172c[_0xa24c('0x5b')],_0x1c172c['ispeech_tts_language']||_0xa24c('0x5d'),_0x1c172c['speed'])['then'](function(_0x574d37){_0x24b28c(null,_0x574d37);})[_0xa24c('0x16')](function(_0x4831d8){_0x24b28c(_0x4831d8);});};AGIVertices[_0xa24c('0x11')]['ispeechASR']=function(_0x22b445,_0x144c3b,_0x53bd12){scripts[_0xa24c('0x84')](_0x144c3b,_0x22b445['key'],_0x22b445[_0xa24c('0x85')]||_0xa24c('0x5d'),this[_0xa24c('0x86')](_0x22b445[_0xa24c('0x87')])?_0x22b445[_0xa24c('0x87')]:undefined)['then'](function(_0x2e38e6){_0x53bd12(null,_0x2e38e6);})['catch'](function(_0xf26277){_0x53bd12(_0xf26277);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x88')]=function(_0x23eca5,_0x4b848d){scripts[_0xa24c('0x88')](_0x23eca5[_0xa24c('0x89')],_0x23eca5[_0xa24c('0x8a')],_0x23eca5[_0xa24c('0x8b')],_0x23eca5['aws_polly_voice']||_0xa24c('0x8c'),_0x23eca5[_0xa24c('0x5b')],_0x23eca5[_0xa24c('0x8d')]||_0xa24c('0x5b'))[_0xa24c('0x14')](function(_0x35f9bd){_0x4b848d(null,_0x35f9bd);})[_0xa24c('0x16')](function(_0x4654f0){_0x4b848d(_0x4654f0);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x8e')]=function(_0x627114,_0x18f844){scripts[_0xa24c('0x8e')](this['channel'][_0xa24c('0x36')],_0x627114[_0xa24c('0x89')],_0x627114[_0xa24c('0x8a')],_0x627114[_0xa24c('0x8f')],_0x627114[_0xa24c('0x5b')],_0x627114[_0xa24c('0x90')])[_0xa24c('0x14')](function(_0x11be9f){_0x18f844(null,_0x11be9f);})['catch'](function(_0x264bc9){_0x18f844(_0x264bc9);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x91')]=function(_0x29753f,_0x20bc16,_0x8f1f6b){scripts[_0xa24c('0x91')](_0x20bc16,_0x29753f['key'],_0x29753f[_0xa24c('0x92')]||_0xa24c('0x5d'))[_0xa24c('0x14')](function(_0x1ef892){_0x8f1f6b(null,_0x1ef892);})[_0xa24c('0x16')](function(_0xb5a39a){_0x8f1f6b(_0xb5a39a);});};AGIVertices[_0xa24c('0x11')][_0xa24c('0x93')]=function(_0x372811,_0x13f38e,_0x5b3196){scripts[_0xa24c('0x93')](_0x13f38e,_0x372811[_0xa24c('0x94')],_0x372811[_0xa24c('0x95')],_0x372811[_0xa24c('0x73')])[_0xa24c('0x14')](function(_0x462d4a){_0x5b3196(null,_0x462d4a);})[_0xa24c('0x16')](function(_0x406854){_0x5b3196(_0x406854);});};AGIVertices['prototype'][_0xa24c('0x96')]=function(_0x4d7d5e){var _0x5e4d27=_['includes'](verticesWithRetry,_0x4d7d5e['agicommand'])?_0x4d7d5e:_[_0xa24c('0x97')](_0x4d7d5e);for(var _0x3791eb in _0x5e4d27){if(_0x5e4d27[_0xa24c('0x98')](_0x3791eb)){if(_0x5e4d27[_0x3791eb]&&_[_0xa24c('0x99')](_0x5e4d27[_0x3791eb])){if(_[_0xa24c('0x69')](recursiveMapAttributes,_0x3791eb)){_0x5e4d27[_0x3791eb]=this['replaceObjectAllVariables'](_0x5e4d27[_0x3791eb]);}else{_0x5e4d27[_0x3791eb]=this[_0xa24c('0x9a')](_0x5e4d27[_0x3791eb]);}}}}return _0x5e4d27;};AGIVertices[_0xa24c('0x11')][_0xa24c('0x9b')]=function(_0xc9810a){for(var _0xdac03 in _0xc9810a){if(_0xc9810a[_0xa24c('0x98')](_0xdac03)){if(_[_0xa24c('0x9c')](_0xc9810a[_0xdac03])){this[_0xa24c('0x9b')](_0xc9810a[_0xdac03]);}else if(_[_0xa24c('0x9d')](_0xc9810a[_0xdac03])){for(var _0x523ec2=0x0;_0x523ec2<_0xc9810a[_0xdac03][_0xa24c('0x9e')];_0x523ec2++){this[_0xa24c('0x9b')](_0xc9810a[_0xdac03][_0x523ec2]);}}else if(_[_0xa24c('0x99')](_0xc9810a[_0xdac03])){_0xc9810a[_0xdac03]=this[_0xa24c('0x9a')](_0xc9810a[_0xdac03]);}}}};AGIVertices[_0xa24c('0x11')]['saveRestApiResult']=function(_0x35b314,_0x161d6d){for(var _0x410b10 in _0x35b314){if(_0x35b314['hasOwnProperty'](_0x410b10)){if(_[_0xa24c('0x9c')](_0x35b314[_0x410b10])){if(!_[_0xa24c('0x44')](_0x35b314[_0x410b10])){this[_0xa24c('0x9f')](_0x35b314[_0x410b10],util[_0xa24c('0x28')](_0xa24c('0xa0'),_0x161d6d,_0x410b10));}}else if(_['isArray'](_0x35b314[_0x410b10])){for(var _0x56a345=0x0;_0x56a345<_0x35b314[_0x410b10][_0xa24c('0x9e')];_0x56a345++){this['saveRestApiResult'](_0x35b314[_0x410b10][_0x56a345],util[_0xa24c('0x28')](_0xa24c('0xa0'),_0x161d6d,_0x410b10+'['+_0x56a345+']'));}}else{if(!_['isNil'](_0x35b314[_0x410b10])){this[_0xa24c('0x3a')][_0xa24c('0xa1')](util[_0xa24c('0x28')](_0xa24c('0xa0'),_0x161d6d,_0x410b10),_0x35b314[_0x410b10]);}}}}};AGIVertices[_0xa24c('0x11')][_0xa24c('0xa2')]=function(_0x5a0fdb){try{var _0x250509=JSON[_0xa24c('0x6e')](_0x5a0fdb);this[_0xa24c('0x9b')](_0x250509);return JSON[_0xa24c('0x75')](_0x250509);}catch(_0x5583a3){return this[_0xa24c('0x9a')](_0x5a0fdb);}};AGIVertices[_0xa24c('0x11')][_0xa24c('0x9a')]=function(_0x3dfca8){var _0x13cf59=_0x3dfca8[_0xa24c('0xa3')]('{');for(var _0x19bf4e=0x1;_0x19bf4e<_0x13cf59['length'];_0x19bf4e+=0x1){var _0x19cb04=_0x13cf59[_0x19bf4e][_0xa24c('0xa3')]('}');if(_0x19cb04[_0xa24c('0x9e')]>0x1){_0x3dfca8=_0x3dfca8['replaceAll']('{'+_0x19cb04[0x0]+'}',this['channel'][_0xa24c('0x12')](_0x19cb04[0x0])[_0xa24c('0xa4')]||_0x19cb04[0x0]);}}if(_0x13cf59[_0xa24c('0x9e')]===0x1){return _0x3dfca8['toString']();}return this[_0xa24c('0x9a')](_0x3dfca8);};AGIVertices['prototype']['getAndSetVariable']=function(_0x29122e,_0x2463b8){var _0x3d7917=this[_0xa24c('0x3a')][_0xa24c('0x12')](_0x29122e);if(_0x3d7917[_0xa24c('0xa5')]===-0x1){return _0x3d7917;}logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0xa6'),_0x2463b8,_0x3d7917['extra']));return this[_0xa24c('0x3a')][_0xa24c('0xa1')](_0x2463b8,_0x3d7917[_0xa24c('0xa4')]);};AGIVertices[_0xa24c('0x11')][_0xa24c('0x86')]=function(_0x1953ee){return _0x1953ee&&_0x1953ee!=='0'&&_0x1953ee!=='-1'&&_0x1953ee!=='';};AGIVertices['prototype']['maxRetry']=function(_0x1be9b0){this[_0xa24c('0x35')][_0xa24c('0x72')](this,_0x1be9b0,'-');_0x1be9b0[_0xa24c('0xa7')]=_0x1be9b0[_0xa24c('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa24c('0x11')]['mrcpsynth']=function(_0xa1593f){logger['info'](util[_0xa24c('0x28')](_0xa24c('0xa9'),_0xa1593f[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0xa1593f[_0xa24c('0x5b')])){return this['channel'][_0xa24c('0xaa')](_0xa24c('0xab'));}var _0x36521a='\x22'+_0xa1593f['text']+'\x22';if(this[_0xa24c('0x86')](_0xa1593f[_0xa24c('0x7b')])){_0x36521a+=','+_0xa1593f[_0xa24c('0x7b')];}var _0x21596a=this['channel']['exec'](_0xa24c('0xac'),_0x36521a);if(_0x21596a[_0xa24c('0xa5')]===-0x1){return _0x21596a;}return this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xad'),_0x36521a));};AGIVertices['prototype'][_0xa24c('0xae')]=function(_0x15d0c3){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x15d0c3[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x15d0c3[_0xa24c('0xaf')])){return this['channel']['noop'](_0xa24c('0xb0'));}var _0x660dd2=_0x15d0c3[_0xa24c('0xaf')];if(this[_0xa24c('0x86')](_0x15d0c3[_0xa24c('0x7b')])){_0x660dd2+=','+_0x15d0c3['options'];}var _0x4eba7d=this[_0xa24c('0x3a')][_0xa24c('0x56')](_0xa24c('0xb1'),_0x660dd2);if(_0x4eba7d[_0xa24c('0xa5')]===-0x1){return _0x4eba7d;}var _0x25a5da=this['getAndSetVariable'](_0xa24c('0xb2'),_0xa24c('0xb3'));if(_0x25a5da[_0xa24c('0xa5')]===-0x1){return _0x25a5da;}var _0x47c049=this[_0xa24c('0xb4')]('RECOG_INPUT()',_0xa24c('0xb5'));if(_0x47c049[_0xa24c('0xa5')]===-0x1){return _0x47c049;}var _0x54be0a=this[_0xa24c('0xb4')](_0xa24c('0xb6'),_0xa24c('0xb7'));if(_0x54be0a[_0xa24c('0xa5')]===-0x1){return _0x54be0a;}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xb8'),_0x660dd2));};AGIVertices[_0xa24c('0x11')]['agi']=function(_0x1a124f){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0xb9'),_0x1a124f['label']));return this[_0xa24c('0x3a')]['agi']([_0x1a124f[_0xa24c('0xba')],_0x1a124f[_0xa24c('0xbb')]]);};AGIVertices[_0xa24c('0x11')][_0xa24c('0xbc')]=function(_0x3f7f62){logger['info'](util[_0xa24c('0x28')](_0xa24c('0xbd'),_0x3f7f62['label']));if(this[_0xa24c('0x86')](_0x3f7f62[_0xa24c('0x67')])){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0xbe'),_0x3f7f62['timeout']));var _0xe72270=this[_0xa24c('0x3a')][_0xa24c('0xbf')](_0x3f7f62['timeout']);if(_0xe72270[_0xa24c('0xa5')]===-0x1){return _0xe72270;}}return this[_0xa24c('0x3a')][_0xa24c('0xbc')]();};AGIVertices['prototype'][_0xa24c('0x4a')]=function(_0x4c0222){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4c0222['label']));if(!this[_0xa24c('0x86')](_0x4c0222[_0xa24c('0x48')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x4c0222,'no\x20list\x20selected');}_0x4c0222[_0xa24c('0x49')]=moment();if(this[_0xa24c('0x86')](_0x4c0222[_0xa24c('0xc0')])){_0x4c0222[_0xa24c('0x49')]=moment()[_0xa24c('0xc1')](_0x4c0222[_0xa24c('0xc0')],_0xa24c('0xc2'));}if(!this['isConfigured'](_0x4c0222[_0xa24c('0xc3')])){_0x4c0222['callback_priority']=0x2;}this[_0xa24c('0x43')][_0xa24c('0x72')](this,_0x4c0222);return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util['format'](_0xa24c('0xc4'),_0x4c0222[_0xa24c('0xc5')],_0x4c0222[_0xa24c('0x48')],_0x4c0222[_0xa24c('0x49')]));};AGIVertices['prototype']['custom_app']=function(_0x82b59b){logger['info'](util[_0xa24c('0x28')](_0xa24c('0xc6'),_0x82b59b['label']));var _0x1a8800=this[_0xa24c('0x3a')]['exec'](_0x82b59b[_0xa24c('0xc7')],_0x82b59b['options']);if(_0x1a8800[_0xa24c('0xa5')]===-0x1){return _0x1a8800;}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util['format'](_0xa24c('0xc8'),_0x82b59b[_0xa24c('0xc7')],_0x82b59b['options']));};AGIVertices[_0xa24c('0x11')][_0xa24c('0xc9')]=function(_0x4a67c1){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0xca'),_0x4a67c1[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x4a67c1[_0xa24c('0x5b')])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0xab'));}var _0x34c44b='\x22'+_0x4a67c1[_0xa24c('0x5b')]+'\x22';if(this[_0xa24c('0x86')](_0x4a67c1[_0xa24c('0x7b')])){_0x34c44b+=','+_0x4a67c1[_0xa24c('0x7b')];}var _0x2468d5=this[_0xa24c('0x3a')][_0xa24c('0x56')]('MRCPSynth',_0x34c44b);if(_0x2468d5[_0xa24c('0xa5')]===-0x1){return _0x2468d5;}return this['channel'][_0xa24c('0xaa')](util['format'](_0xa24c('0xad'),_0x34c44b));};AGIVertices[_0xa24c('0x11')][_0xa24c('0xcb')]=function(_0x246481){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x246481['label']));if(!this['isConfigured'](_0x246481[_0xa24c('0x5b')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0xab'));}var _0x247f18='\x22'+_0x246481['text']+'\x22';if(this[_0xa24c('0x86')](_0x246481[_0xa24c('0x7b')])){_0x247f18+=','+_0x246481[_0xa24c('0x7b')];}var _0x12c86f=this[_0xa24c('0x3a')]['exec'](_0xa24c('0xac'),_0x247f18);if(_0x12c86f[_0xa24c('0xa5')]===-0x1){return _0x12c86f;}return this[_0xa24c('0x3a')]['noop'](util[_0xa24c('0x28')](_0xa24c('0xad'),_0x247f18));};AGIVertices[_0xa24c('0x11')][_0xa24c('0xcc')]=function(_0x3ff537){logger['info'](util[_0xa24c('0x28')](_0xa24c('0xcd'),_0x3ff537[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x3ff537[_0xa24c('0xaf')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')]('no\x20grammar\x20configured');}var _0x59dbb0=_0x3ff537[_0xa24c('0xaf')];if(this['isConfigured'](_0x3ff537[_0xa24c('0x7b')])){_0x59dbb0+=','+_0x3ff537['options'];}var _0x4ab618=this['channel'][_0xa24c('0x56')]('MRCPRecog',_0x59dbb0);if(_0x4ab618[_0xa24c('0xa5')]===-0x1){return _0x4ab618;}var _0xd5f1c2=this['getAndSetVariable'](_0xa24c('0xb2'),_0xa24c('0xce'));if(_0xd5f1c2['result']===-0x1){return _0xd5f1c2;}var _0x5986c9=this[_0xa24c('0xb4')](_0xa24c('0xcf'),_0xa24c('0xd0'));if(_0x5986c9['result']===-0x1){return _0x5986c9;}var _0x3dbe8f=this[_0xa24c('0xb4')](_0xa24c('0xb6'),_0xa24c('0xd1'));if(_0x3dbe8f[_0xa24c('0xa5')]===-0x1){return _0x3dbe8f;}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xb8'),_0x59dbb0));};AGIVertices['prototype'][_0xa24c('0xd2')]=function(_0x1c3682){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0xd3'),_0x1c3682[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x1c3682[_0xa24c('0xaf')])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0xb0'));}var _0x20ea76=_0x1c3682[_0xa24c('0xaf')];if(this[_0xa24c('0x86')](_0x1c3682[_0xa24c('0x7b')])){_0x20ea76+=','+_0x1c3682['options'];}var _0x352aa6=this[_0xa24c('0x3a')][_0xa24c('0x56')]('MRCPRecog',_0x20ea76);if(_0x352aa6['result']===-0x1){return _0x352aa6;}var _0x4165d3=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xa24c('0xd4'));if(_0x4165d3[_0xa24c('0xa5')]===-0x1){return _0x4165d3;}var _0x37f5a9=this[_0xa24c('0xb4')](_0xa24c('0xcf'),_0xa24c('0xd5'));if(_0x37f5a9[_0xa24c('0xa5')]===-0x1){return _0x37f5a9;}var _0x132ab1=this[_0xa24c('0xb4')](_0xa24c('0xb6'),_0xa24c('0xd6'));if(_0x132ab1[_0xa24c('0xa5')]===-0x1){return _0x132ab1;}return this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xb8'),_0x20ea76));};AGIVertices[_0xa24c('0x11')][_0xa24c('0xd7')]=function(_0x2baf99){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0xd8'),_0x2baf99[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x2baf99['odbc_id'])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x2baf99,_0xa24c('0xd9'));}var _0x44ae9c=this[_0xa24c('0x1a')][_0xa24c('0x72')](this,_0x2baf99[_0xa24c('0xda')]);if(!_0x44ae9c){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x2baf99,'no\x20odbc\x20database\x20found');}if(!this[_0xa24c('0x86')](_0x2baf99[_0xa24c('0x2d')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x2baf99,_0xa24c('0xdb'));}var _0x5aecd0=_0x2baf99[_0xa24c('0x2d')][_0xa24c('0xdc')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xdd'),_0x5aecd0));var _0x1203d3=this['getQueryOdbc']['sync'](this,_0x44ae9c,_0x5aecd0);this['createSquareDetailsReport'][_0xa24c('0x72')](this,_0x2baf99,_0x5aecd0);if(!this[_0xa24c('0x86')](_0x2baf99['variable_id'])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0xde'));}var _0x1f4fd5=this[_0xa24c('0x12')]['sync'](this,_0x2baf99[_0xa24c('0xdf')]);if(!_0x1f4fd5){return this[_0xa24c('0x3a')]['error'](_0x2baf99,_0xa24c('0xe0'));}var _0x46b29e=this;_0x1203d3[_0xa24c('0xe1')](function(_0x2ebb57,_0xbbe647){Object[_0xa24c('0xe2')](_0x2ebb57)[_0xa24c('0xe1')](function(_0x3e0842){_0x46b29e[_0xa24c('0x3a')][_0xa24c('0xa1')](util[_0xa24c('0x28')](_0xa24c('0xe3'),_0x1f4fd5,_0xbbe647,_0x3e0842),_0x2ebb57[_0x3e0842]);});});this[_0xa24c('0x3a')][_0xa24c('0xa1')](util['format']('%s_ROWS_COUNT',_0x1f4fd5),_0x1203d3[_0xa24c('0x9e')]);return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xe4'),_0x1f4fd5));};AGIVertices[_0xa24c('0x11')][_0xa24c('0xe5')]=function(_0x404104){logger[_0xa24c('0xe6')](util['format'](_0xa24c('0xe7'),_0x404104[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x404104[_0xa24c('0xe8')])){return this[_0xa24c('0x3a')]['error'](_0x404104,_0xa24c('0xe9'));}var _0x110371=this['getUser'][_0xa24c('0x72')](this,_0x404104[_0xa24c('0xe8')]);if(!_0x110371){return this[_0xa24c('0x3a')]['error'](_0x404104,_0xa24c('0xea'));}var _0x1cec35=this[_0xa24c('0x3a')][_0xa24c('0x56')](_0xa24c('0xeb'),[util[_0xa24c('0x28')](_0xa24c('0xec'),_0x110371),_0x404104[_0xa24c('0x67')],_0x404104[_0xa24c('0xed')],_0x404104[_0xa24c('0x65')]]);if(_0x1cec35[_0xa24c('0xa5')]===-0x1){return _0x1cec35;}return this[_0xa24c('0x3a')]['noop'](util['format'](_0xa24c('0xee'),_0xa24c('0xeb')));};AGIVertices[_0xa24c('0x11')][_0xa24c('0xef')]=function(_0xba4e20){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0xf0'),_0xba4e20[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0xba4e20[_0xa24c('0x7d')])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0xf1'));}if(!this[_0xa24c('0x86')](_0xba4e20['text'])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0xab'));}this['channel'][_0xa24c('0xf2')]=!![];this['createSquareDetailsReport'](_0xba4e20);this[_0xa24c('0xf3')](_0xba4e20[_0xa24c('0x5b')],'in','','');this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xf4'),_0xba4e20[_0xa24c('0x5b')]));var _0x226c17=this['googleDialogflow']['sync'](this,_0xba4e20);if(_0x226c17){for(var _0x35df53 in _0x226c17){if(_0x226c17['hasOwnProperty'](_0x35df53)){this[_0xa24c('0x3a')][_0xa24c('0xa1')](util[_0xa24c('0x28')](_0xa24c('0xf5'),_0x35df53['toUpperCase']()),_0x226c17[_0x35df53]);}}this['createSquareMessage'](_0x226c17['speech'],_0xa24c('0xf6'),'dialogflow','');return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xf7'),_0x226c17[_0xa24c('0xf8')]));}return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0xba4e20,_0xa24c('0xf9'));};AGIVertices[_0xa24c('0x11')][_0xa24c('0xfa')]=function(_0x59e0a3){logger['info'](util['format'](_0xa24c('0xfb'),_0x59e0a3['label']));if(!this[_0xa24c('0x86')](_0x59e0a3[_0xa24c('0xfc')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0xfd'));}if(!this['isConfigured'](_0x59e0a3[_0xa24c('0xfe')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0xff'));}if(!this[_0xa24c('0x86')](_0x59e0a3['private_key'])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')]('no\x20private_key\x20configured');}if(!this[_0xa24c('0x86')](_0x59e0a3['dialogflowV2_language'])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')]('no\x20anguage\x20configured');}if(!this[_0xa24c('0x86')](_0x59e0a3[_0xa24c('0x5b')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')]('no\x20text\x20configured');}this['channel'][_0xa24c('0xf2')]=!![];this[_0xa24c('0x35')](_0x59e0a3);this[_0xa24c('0xf3')](_0x59e0a3[_0xa24c('0x5b')],'in','','');this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x59e0a3[_0xa24c('0x5b')]));var _0x38e1ff=this[_0xa24c('0x7f')][_0xa24c('0x72')](this,_0x59e0a3);if(_0x38e1ff){for(var _0x21e018 in _0x38e1ff){if(_0x38e1ff[_0xa24c('0x98')](_0x21e018)){if(_0x21e018!==_0xa24c('0x100')){this[_0xa24c('0x3a')][_0xa24c('0xa1')](util[_0xa24c('0x28')]('DIALOGFLOW_%s',_0x21e018['toUpperCase']()),_0x38e1ff[_0x21e018]);}}}this['createSquareMessage'](_0x38e1ff['speech'],_0xa24c('0xf6'),_0xa24c('0xfa'),_0x38e1ff[_0xa24c('0x100')]);return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util['format'](_0xa24c('0x101'),_0x38e1ff['speech']));}return this['channel']['error'](_0x59e0a3,_0xa24c('0x102'));};AGIVertices['prototype'][_0xa24c('0x103')]=function(_0xadb53c){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x104'),_0xadb53c[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0xadb53c[_0xa24c('0x105')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x106'));}if(!this[_0xa24c('0x86')](_0xadb53c['username'])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')]('no\x20username\x20configured');}if(!this[_0xa24c('0x86')](_0xadb53c[_0xa24c('0x107')])){return this['channel'][_0xa24c('0xaa')](_0xa24c('0x108'));}if(!this['isConfigured'](_0xadb53c[_0xa24c('0x109')])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0xab'));}this[_0xa24c('0x3a')][_0xa24c('0xf2')]=!![];this[_0xa24c('0x35')](_0xadb53c);this['createSquareMessage'](_0xadb53c['text'],'in','','');this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')]('Trying\x20SestekNDA:\x20%s',_0xadb53c['text']));var _0x305ee1=this[_0xa24c('0x82')][_0xa24c('0x72')](this,_0xadb53c);if(_0x305ee1){for(var _0x36f8a4 in _0x305ee1){if(_0x305ee1['hasOwnProperty'](_0x36f8a4)){this['channel']['setVariable'](util[_0xa24c('0x28')](_0xa24c('0x10a'),_0x36f8a4[_0xa24c('0x6c')]()),_0x305ee1[_0x36f8a4]);}}this[_0xa24c('0xf3')](_0x305ee1[_0xa24c('0xf8')],_0xa24c('0xf6'),_0xa24c('0x103'),'');if(_0x305ee1[_0xa24c('0x10b')]){this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x10c'),_0x305ee1[_0xa24c('0x10b')]));var _0x12f041=this[_0xa24c('0x3a')][_0xa24c('0x10d')](_0x305ee1[_0xa24c('0x10b')]);try{fs[_0xa24c('0x10e')](_0x305ee1[_0xa24c('0x10b')]+_0xa24c('0x10f'));}catch(_0x17f7af){logger[_0xa24c('0x31')](_0x17f7af);}return _0x12f041;}else{return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x110'),_0x305ee1[_0xa24c('0xf8')]));}}return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0xadb53c,_0xa24c('0x111'));};AGIVertices[_0xa24c('0x11')][_0xa24c('0x112')]=function(_0x249eea){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x113'),_0x249eea['label']));return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x112'));};AGIVertices[_0xa24c('0x11')][_0xa24c('0x114')]=function(_0x466134){logger['info'](util[_0xa24c('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x466134[_0xa24c('0x37')]));var _0x599e0d='';if(_0x466134[_0xa24c('0x115')]){if(!this[_0xa24c('0x86')](_0x466134[_0xa24c('0x115')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x466134,_0xa24c('0x116'));}else{var _0x304fbf=parseInt(_0x466134['trunk_id'],0xa);if(isNaN(_0x304fbf)){_0x599e0d=_0x466134[_0xa24c('0x115')];}else{_0x599e0d=this['getTrunk']['sync'](this,_0x466134[_0xa24c('0x115')]);if(!_0x599e0d){return this[_0xa24c('0x3a')]['error'](_0x466134,_0xa24c('0x117'));}}}}else if(_0x466134[_0xa24c('0x118')]){_0x599e0d=_0x466134[_0xa24c('0x118')];}else{return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x466134,_0xa24c('0x116'));}var _0x7d2199=this[_0xa24c('0x3a')][_0xa24c('0x56')](_0xa24c('0xeb'),[util[_0xa24c('0x28')](_0xa24c('0x119'),_0x599e0d,_0x466134[_0xa24c('0xc5')]),_0x466134['timeout'],_0x466134[_0xa24c('0xed')],_0x466134[_0xa24c('0x65')]]);if(_0x7d2199['result']===-0x1){return _0x7d2199;}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')]('Executed\x20command\x20%s',_0xa24c('0xeb')));};AGIVertices[_0xa24c('0x11')][_0xa24c('0x11a')]=function(_0x1bdc80){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1bdc80[_0xa24c('0x37')]));return this[_0xa24c('0x3a')]['noop'](_0xa24c('0x11a'));};AGIVertices[_0xa24c('0x11')]['getdigits']=function(_0x5f103d){logger[_0xa24c('0x2e')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5f103d['label']));if(_0x5f103d[_0xa24c('0xa7')]===0x0){return this[_0xa24c('0xa8')](_0x5f103d);}_0x5f103d[_0xa24c('0xa7')]-=0x1;if(!this[_0xa24c('0x86')](_0x5f103d[_0xa24c('0x11b')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x5f103d,_0xa24c('0x11c'));}var _0x510e68=this['getSound'][_0xa24c('0x72')](this,_0x5f103d[_0xa24c('0x11b')]);if(!_0x510e68){return this['channel'][_0xa24c('0x31')](_0x5f103d,_0xa24c('0x11d'));}if(!this[_0xa24c('0x86')](_0x5f103d[_0xa24c('0xdf')])){return this['channel'][_0xa24c('0x31')](_0xa24c('0xde'));}var _0x3a5fb4=this[_0xa24c('0x3a')][_0xa24c('0x11e')](_0x510e68,_0x5f103d['response'],_0x5f103d[_0xa24c('0x11f')]);var _0x16d30b=_0x3a5fb4[_0xa24c('0xa5')]?_0x3a5fb4[_0xa24c('0xa5')]['toString']():'';logger['info'](_0xa24c('0x120'),JSON[_0xa24c('0x75')](_0x3a5fb4));if(_0x3a5fb4[_0xa24c('0xa5')]===-0x1){this['createSquareDetailsReport'][_0xa24c('0x72')](this,_0x5f103d,_0x16d30b);return _0x3a5fb4;}else if(_0x3a5fb4[_0xa24c('0xa4')]===_0xa24c('0x67')){_0x3a5fb4[_0xa24c('0xa5')]=_0x16d30b[_0xa24c('0x9e')]>=parseInt(_0x5f103d[_0xa24c('0x121')])?'x':'i';}else{_0x3a5fb4['result']=_0x16d30b[_0xa24c('0x9e')]>=parseInt(_0x5f103d['mindigit'])&&_0x16d30b[_0xa24c('0x9e')]<=parseInt(_0x5f103d[_0xa24c('0x11f')])?'x':'i';}var _0x32d22c=this[_0xa24c('0x12')][_0xa24c('0x72')](this,_0x5f103d[_0xa24c('0xdf')]);if(!_0x32d22c){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x5f103d,_0xa24c('0xe0'));}this[_0xa24c('0x3a')][_0xa24c('0xa1')](_0x32d22c,_0x16d30b);if(this['isConfigured'](_0x5f103d[_0xa24c('0x122')])){var _0x367603=parseInt(_0x5f103d[_0xa24c('0x122')],0xa);var _0x5a7514=rs[_0xa24c('0x123')]({'charset':'*','length':_0x367603});var _0x380ecb=_0x16d30b[_0xa24c('0x9e')];if(_0x380ecb>0x0){if(_0x380ecb>_0x367603){this['createSquareDetailsReport'][_0xa24c('0x72')](this,_0x5f103d,_0x5f103d[_0xa24c('0x124')]===_0xa24c('0x125')?_0x5a7514+_0x16d30b[_0xa24c('0x126')](_0x367603):_0x16d30b[_0xa24c('0x126')](0x0,_0x380ecb-_0x367603)+_0x5a7514);}else{this['createSquareDetailsReport'][_0xa24c('0x72')](this,_0x5f103d,rs[_0xa24c('0x123')]({'charset':'*','length':_0x380ecb}));}}else{this[_0xa24c('0x35')]['sync'](this,_0x5f103d,'');}}else{this[_0xa24c('0x35')][_0xa24c('0x72')](this,_0x5f103d,_0x16d30b);}return _0x3a5fb4;};AGIVertices['prototype'][_0xa24c('0x127')]=function(_0x305e89){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x305e89[_0xa24c('0x37')]));return this[_0xa24c('0xe')](_0x305e89);};AGIVertices[_0xa24c('0x11')][_0xa24c('0x128')]=function(_0x1dda42){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x129'),_0x1dda42[_0xa24c('0x37')]));this['createSquareDetailsReport']['sync'](this,_0x1dda42,_0x1dda42[_0xa24c('0x12a')]);return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')]('GOAL\x20%s',_0x1dda42[_0xa24c('0x12a')]));};AGIVertices[_0xa24c('0x11')][_0xa24c('0x12b')]=function(_0x49b2cc){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x12c'),_0x49b2cc[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x49b2cc[_0xa24c('0x89')])||!this[_0xa24c('0x86')](_0x49b2cc[_0xa24c('0x8a')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x12d'));}if(!this[_0xa24c('0x86')](_0x49b2cc[_0xa24c('0x5b')])){return this['channel']['noop'](_0xa24c('0xab'));}this[_0xa24c('0x3a')][_0xa24c('0xaa')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x49b2cc['text']));var _0x3da2f2=this[_0xa24c('0x88')][_0xa24c('0x72')](this,_0x49b2cc);if(_0x3da2f2){this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x3da2f2));var _0x41b6b7=this[_0xa24c('0x3a')]['streamFile'](_0x3da2f2);try{fs['unlink'](_0x3da2f2+'.wav');}catch(_0x112d97){logger[_0xa24c('0x31')](_0x112d97);}return _0x41b6b7;}return this['channel'][_0xa24c('0x31')](_0x49b2cc,_0xa24c('0x12e'));};AGIVertices[_0xa24c('0x11')][_0xa24c('0x12f')]=function(_0x4b4092){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x130'),_0x4b4092[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x4b4092[_0xa24c('0x89')])||!this[_0xa24c('0x86')](_0x4b4092[_0xa24c('0x8a')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x12d'));}if(!this[_0xa24c('0x86')](_0x4b4092['aws_bot_name'])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x131'));}if(!this[_0xa24c('0x86')](_0x4b4092[_0xa24c('0x5b')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0xab'));}this[_0xa24c('0x3a')]['bot']=!![];this[_0xa24c('0x35')](_0x4b4092);this[_0xa24c('0xf3')](_0x4b4092[_0xa24c('0x5b')],'in','','');this[_0xa24c('0x3a')]['noop'](util[_0xa24c('0x28')](_0xa24c('0x132'),_0x4b4092[_0xa24c('0x5b')]));var _0x1e400e=this[_0xa24c('0x8e')][_0xa24c('0x72')](this,_0x4b4092);if(_0x1e400e){for(var _0x244b0e in _0x1e400e){if(_0x1e400e['hasOwnProperty'](_0x244b0e)&&_[_0xa24c('0x99')](_0x1e400e[_0x244b0e])){this[_0xa24c('0x3a')]['setVariable'](util[_0xa24c('0x28')](_0xa24c('0x133'),_0x244b0e[_0xa24c('0x6c')]()),_0x1e400e[_0x244b0e]);}}if(_[_0xa24c('0x45')](_0x1e400e[_0xa24c('0x79')])){return this['channel'][_0xa24c('0xaa')](_0xa24c('0x134'));}else{this[_0xa24c('0xf3')](_0x1e400e[_0xa24c('0x79')],'out',_0xa24c('0x135'),'');return this['channel'][_0xa24c('0xaa')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x1e400e[_0xa24c('0x79')]));}}return this[_0xa24c('0x3a')]['error'](_0x4b4092,_0xa24c('0x136'));};AGIVertices[_0xa24c('0x11')]['googleasr']=function(_0x4d6a25){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x137'),_0x4d6a25[_0xa24c('0x37')],_0x4d6a25[_0xa24c('0x67')]));if(!this[_0xa24c('0x86')](_0x4d6a25[_0xa24c('0x7d')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0xf1'));}var _0x546384=_0xa24c('0x138');var _0x249b58=util[_0xa24c('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xa24c('0x123')](0x4));var _0x5b466d=util['format']('%s.%s',_0x249b58,_0x546384);var _0x645364=!![];if(_0x4d6a25[_0xa24c('0x139')]===_0xa24c('0x13a')){_0x645364=![];}var _0x35cab1=this['channel'][_0xa24c('0x13b')](_0x249b58,_0x546384,_0x4d6a25[_0xa24c('0x13c')],_0x4d6a25['timeout'],undefined,_0x645364);if(_0x35cab1[_0xa24c('0xa5')]!==-0x1){this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')]('google\x20%s\x20file\x20created',_0x5b466d));var _0x3701e8=this[_0xa24c('0x91')]['sync'](this,_0x4d6a25,_0x5b466d);if(_0x3701e8){for(var _0x26cef in _0x3701e8){if(_0x3701e8[_0xa24c('0x98')](_0x26cef)){this[_0xa24c('0x3a')][_0xa24c('0xa1')](util[_0xa24c('0x28')]('GOOGLE_ASR_%s',_0x26cef['toUpperCase']()),_0x3701e8[_0x26cef]);}}return this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x13d'),JSON[_0xa24c('0x75')](_0x3701e8)));}}return _0x35cab1;};AGIVertices[_0xa24c('0x11')][_0xa24c('0x13e')]=function(_0x14dde6){logger['info'](util[_0xa24c('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x14dde6[_0xa24c('0x37')]));if(!this['isConfigured'](_0x14dde6[_0xa24c('0x94')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x13f'));}if(!this[_0xa24c('0x86')](_0x14dde6[_0xa24c('0x95')])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0x140'));}var _0x241350='wav';var _0x2d1573=util[_0xa24c('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xa24c('0x123')](0x4));var _0x5b5cfb=util[_0xa24c('0x28')](_0xa24c('0xa0'),_0x2d1573,_0x241350);var _0x342742=!![];if(_0x14dde6[_0xa24c('0x139')]===_0xa24c('0x13a')){_0x342742=![];}var _0xcc4be3=this[_0xa24c('0x3a')]['recordFile'](_0x2d1573,_0x241350,_0x14dde6[_0xa24c('0x13c')],_0x14dde6['timeout'],undefined,_0x342742);if(_0xcc4be3[_0xa24c('0xa5')]!==-0x1){this[_0xa24c('0x3a')]['noop'](util[_0xa24c('0x28')](_0xa24c('0x141'),_0x5b5cfb));var _0x144933=this[_0xa24c('0x93')][_0xa24c('0x72')](this,_0x14dde6,_0x5b5cfb);if(_0x144933){for(var _0x40c995 in _0x144933){if(_0x144933[_0xa24c('0x98')](_0x40c995)){this[_0xa24c('0x3a')]['setVariable'](util[_0xa24c('0x28')](_0xa24c('0x142'),_0x40c995[_0xa24c('0x6c')]()),_0x144933[_0x40c995]);}}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')]('TildeASR\x20Result\x20%s',JSON[_0xa24c('0x75')](_0x144933)));}}return _0xcc4be3;};AGIVertices[_0xa24c('0x11')][_0xa24c('0x143')]=function(_0x119ec5){logger['info'](util['format'](_0xa24c('0x144'),_0x119ec5[_0xa24c('0x37')]));return this[_0xa24c('0x3a')]['continueAt'](_0x119ec5[_0xa24c('0x3e')],_0x119ec5[_0xa24c('0x3f')],_0x119ec5[_0xa24c('0x145')]);};AGIVertices[_0xa24c('0x11')][_0xa24c('0x146')]=function(_0x57eedd){logger['info'](util['format'](_0xa24c('0x147'),_0x57eedd[_0xa24c('0x37')]));if(!this['isConfigured'](_0x57eedd[_0xa24c('0x148')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x57eedd,_0xa24c('0x149'));}try{var _0x38ac45=eval(_0x57eedd[_0xa24c('0x148')])?_0xa24c('0x14a'):_0xa24c('0x14b');this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x57eedd[_0xa24c('0x148')],_0x38ac45));return{'code':0xc8,'result':_0x38ac45};}catch(_0x1fdf51){return{'code':0xc8,'result':_0xa24c('0x14b')};}};AGIVertices[_0xa24c('0x11')][_0xa24c('0x14c')]=function(_0x261801){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x14d'),_0x261801['label']));if(!this['isConfigured'](_0x261801[_0xa24c('0x14e')])){return this[_0xa24c('0x3a')]['error'](_0x261801,_0xa24c('0x14f'));}var _0x1ead4e=this[_0xa24c('0x150')][_0xa24c('0x72')](this,_0x261801[_0xa24c('0x14e')]);if(!_0x1ead4e){return this[_0xa24c('0x3a')]['error'](_0x261801,_0xa24c('0x151'));}for(var _0x57a6d0=0x0;_0x57a6d0<_0x1ead4e['length'];_0x57a6d0+=0x1){var _0x58263f=this[_0xa24c('0x3a')][_0xa24c('0x12')](util[_0xa24c('0x28')](_0xa24c('0x152'),_0x1ead4e[_0x57a6d0]));if(_0x58263f[_0xa24c('0xa5')]===-0x1){return _0x58263f;}logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('IFTIME\x20%s\x20%s',_0x1ead4e[_0x57a6d0],_0x58263f['extra']));if(_0x58263f[_0xa24c('0xa4')]===_0xa24c('0x14a')){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x153'),_0x1ead4e[_0x57a6d0],'true'));this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x153'),_0x1ead4e[_0x57a6d0],_0xa24c('0x14a')));return{'code':0xc8,'result':_0xa24c('0x14a')};}else{logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x153'),_0x1ead4e[_0x57a6d0],_0xa24c('0x14b')));this['channel'][_0xa24c('0xaa')](util['format'](_0xa24c('0x153'),_0x1ead4e[_0x57a6d0],_0xa24c('0x14b')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xa24c('0x11')][_0xa24c('0x154')]=function(_0x1ce8f2){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x155'),_0x1ce8f2['label']));return this[_0xa24c('0x3a')][_0xa24c('0x154')]();};AGIVertices[_0xa24c('0x11')][_0xa24c('0x156')]=function(_0x3d67a6){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x157'),_0x3d67a6[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x3d67a6['key'])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0xf1'));}var _0x417a21='wav';var _0x39f1d4=util[_0xa24c('0x28')](_0xa24c('0x158'),FILES_PATH,rs['generate'](0x4));var _0x2bd4fc=util[_0xa24c('0x28')](_0xa24c('0xa0'),_0x39f1d4,_0x417a21);var _0x5bbf19=!![];if(_0x3d67a6[_0xa24c('0x139')]===_0xa24c('0x13a')){_0x5bbf19=![];}var _0x4ace8a=this[_0xa24c('0x3a')][_0xa24c('0x13b')](_0x39f1d4,_0x417a21,_0x3d67a6[_0xa24c('0x13c')],_0x3d67a6[_0xa24c('0x67')],undefined,_0x5bbf19);if(_0x4ace8a['result']!==-0x1){this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x159'),_0x2bd4fc));var _0xcbb655=this[_0xa24c('0x84')][_0xa24c('0x72')](this,_0x3d67a6,_0x2bd4fc);if(_0xcbb655){for(var _0x458add in _0xcbb655){if(_0xcbb655['hasOwnProperty'](_0x458add)){this['channel']['setVariable'](util[_0xa24c('0x28')]('ISPEECH_ASR_%s',_0x458add[_0xa24c('0x6c')]()),_0xcbb655[_0x458add]);}}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x15a'),JSON[_0xa24c('0x75')](_0xcbb655)));}}return _0x4ace8a;};AGIVertices[_0xa24c('0x11')][_0xa24c('0x15b')]=function(_0x43bdd9){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x15c'),_0x43bdd9[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x43bdd9[_0xa24c('0x7d')])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0xf1'));}if(!this[_0xa24c('0x86')](_0x43bdd9[_0xa24c('0x5b')])){return this['channel'][_0xa24c('0xaa')]('no\x20text\x20configured');}this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x43bdd9[_0xa24c('0x5b')]));var _0x1bdbe2=this['ispeechTTS'][_0xa24c('0x72')](this,_0x43bdd9);if(_0x1bdbe2){this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x159'),_0x1bdbe2));var _0x436f89=this[_0xa24c('0x3a')][_0xa24c('0x10d')](_0x1bdbe2,_0x43bdd9['intKey']);try{fs['unlink'](_0x1bdbe2+_0xa24c('0x10f'));}catch(_0x262a2d){logger['error'](_0x262a2d);}return _0x436f89;}return this['channel']['error'](_0x43bdd9,_0xa24c('0x15d'));};AGIVertices['prototype'][_0xa24c('0x15e')]=function(_0x12db3c){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x15f'),_0x12db3c['label']));if(!this[_0xa24c('0x86')](_0x12db3c[_0xa24c('0x160')])){return this['channel'][_0xa24c('0x31')](_0x12db3c,_0xa24c('0x161'));}logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x162'),this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x12db3c[_0xa24c('0x160')]));var _0x5d0ff6=this[_0xa24c('0x51')]['sync'](this,_0x12db3c['findBy']);if(_0x5d0ff6){logger[_0xa24c('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x12db3c[_0xa24c('0x160')]));this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x163'),this['channel']['callerid'],_0x12db3c[_0xa24c('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x164'),this['channel']['callerid'],_0x12db3c['findBy']));this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x164'),this[_0xa24c('0x3a')]['callerid'],_0x12db3c[_0xa24c('0x160')]));return{'code':0xc8,'result':_0xa24c('0x165')};}};AGIVertices[_0xa24c('0x11')][_0xa24c('0x166')]=function(_0x233d3b){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x167'),_0x233d3b[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x233d3b[_0xa24c('0x160')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x233d3b,_0xa24c('0x161'));}logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x162'),this['channel']['callerid'],_0x233d3b[_0xa24c('0x160')]));var _0x10ea95=this['agentLogout']['sync'](this,_0x233d3b[_0xa24c('0x160')]);if(_0x10ea95){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x163'),this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x233d3b[_0xa24c('0x160')]));this['channel']['noop'](util[_0xa24c('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x233d3b['findBy']));return{'code':0xc8,'result':_0xa24c('0x168')};}else{logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x164'),this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x233d3b[_0xa24c('0x160')]));this[_0xa24c('0x3a')]['noop'](util[_0xa24c('0x28')](_0xa24c('0x164'),this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x233d3b[_0xa24c('0x160')]));return{'code':0xc8,'result':_0xa24c('0x165')};}};AGIVertices[_0xa24c('0x11')][_0xa24c('0x169')]=function(_0x444941){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x16a'),_0x444941[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x444941['operation'])){return this[_0xa24c('0x3a')]['error'](_0x444941,'no\x20operation\x20configured');}this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x16b'),_0x444941[_0xa24c('0x16c')]));var _0x1571ce=eval(_0x444941[_0xa24c('0x16c')]);if(!this[_0xa24c('0x86')](_0x444941['variable_id'])){return this['channel'][_0xa24c('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xd8605d=this[_0xa24c('0x12')][_0xa24c('0x72')](this,_0x444941[_0xa24c('0xdf')]);if(!_0xd8605d){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x444941,_0xa24c('0xe0'));}if(_[_0xa24c('0x9d')](_0x1571ce)){var _0x1b2b3f=this;_0x1571ce[_0xa24c('0xe1')](function(_0x25aa79,_0x5c2f60){_0x1b2b3f[_0xa24c('0x3a')][_0xa24c('0xa1')](util[_0xa24c('0x28')](_0xa24c('0x16d'),_0xd8605d,_0x5c2f60),_0x25aa79);});return this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')]('variable\x20%s[key]\x20set',_0xd8605d));}else{return this['channel'][_0xa24c('0xa1')](_0xd8605d,_0x1571ce);}};AGIVertices[_0xa24c('0x11')][_0xa24c('0xd')]=function(_0x538a5b){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x16e'),_0x538a5b[_0xa24c('0x37')]));if(_0x538a5b[_0xa24c('0xa7')]===0x0){return this[_0xa24c('0xa8')](_0x538a5b);}_0x538a5b[_0xa24c('0xa7')]-=0x1;if(!this[_0xa24c('0x86')](_0x538a5b[_0xa24c('0x11b')])){return this['channel']['error'](_0x538a5b,_0xa24c('0x11c'));}var _0x4eb3db=this[_0xa24c('0x1e')]['sync'](this,_0x538a5b[_0xa24c('0x11b')]);if(!_0x4eb3db){return this['channel']['error'](_0x538a5b,'no\x20file\x20audio\x20found');}var _0x465a73=this[_0xa24c('0x3a')][_0xa24c('0x11e')](_0x4eb3db,_0x538a5b[_0xa24c('0x16f')],_0x538a5b['digit']);var _0x134980=_0x465a73[_0xa24c('0xa5')];if(_0x465a73[_0xa24c('0xa5')]===-0x1){this['createSquareDetailsReport'][_0xa24c('0x72')](this,_0x538a5b,'-1');return _0x465a73;}else if(_0x465a73['extra']===_0xa24c('0x67')){_0x465a73[_0xa24c('0xa5')]=_0x465a73[_0xa24c('0xa5')]['length']>0x0?_0x465a73[_0xa24c('0xa5')]:'t';}else if(_['isEmpty'](_0x465a73['result'])){_0x465a73['result']='#';_0x134980='#';}if(!this[_0xa24c('0x86')](_0x538a5b[_0xa24c('0xdf')])){this[_0xa24c('0x3a')][_0xa24c('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x457486=this[_0xa24c('0x12')][_0xa24c('0x72')](this,_0x538a5b[_0xa24c('0xdf')]);if(!_0x457486){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x538a5b,_0xa24c('0xe0'));}this[_0xa24c('0x3a')][_0xa24c('0xa1')](_0x457486,_0x134980);}this[_0xa24c('0x35')]['sync'](this,_0x538a5b,_0x134980);return _0x465a73;};AGIVertices[_0xa24c('0x11')][_0xa24c('0xaa')]=function(_0x44bdb4){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x44bdb4['label']));return this['channel']['noop'](_0x44bdb4['output']||_0x44bdb4['label']);};AGIVertices[_0xa24c('0x11')][_0xa24c('0x170')]=function(_0x64c515){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x171'),_0x64c515[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x64c515[_0xa24c('0x160')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x64c515,_0xa24c('0x161'));}logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x64c515['findBy']));var _0x1ecb91=this[_0xa24c('0x172')]['sync'](this,_0x64c515[_0xa24c('0x173')]);var _0xa57665=this[_0xa24c('0x4e')]['sync'](this,_0x64c515[_0xa24c('0x160')],_0x1ecb91);if(_0xa57665){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x163'),this['channel'][_0xa24c('0x3b')],_0x64c515['findBy']));this[_0xa24c('0x3a')]['noop'](util[_0xa24c('0x28')](_0xa24c('0x163'),this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x64c515['findBy']));return{'code':0xc8,'result':_0xa24c('0x168')};}else{logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa24c('0x3a')]['callerid'],_0x64c515[_0xa24c('0x160')]));this['channel']['noop'](util[_0xa24c('0x28')](_0xa24c('0x163'),this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x64c515[_0xa24c('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa24c('0x11')][_0xa24c('0x174')]=function(_0x1483c0){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x175'),_0x1483c0[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x1483c0[_0xa24c('0x11b')])){return this['channel'][_0xa24c('0x31')](_0x1483c0,_0xa24c('0x11c'));}var _0xb1fdc6=this[_0xa24c('0x1e')][_0xa24c('0x72')](this,_0x1483c0[_0xa24c('0x11b')]);if(!_0xb1fdc6){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x1483c0,_0xa24c('0x11d'));}var _0x2853db=this['channel'][_0xa24c('0x56')](_0xa24c('0x176'),[_0xb1fdc6,_0x1483c0[_0xa24c('0xed')]]);if(_0x2853db['result']===-0x1){return _0x2853db;}return this[_0xa24c('0x3a')]['noop'](util[_0xa24c('0x28')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0xb1fdc6));};AGIVertices['prototype'][_0xa24c('0x177')]=function(_0x268f40){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x178'),_0x268f40[_0xa24c('0x37')]));if(!this['isConfigured'](_0x268f40[_0xa24c('0x179')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x268f40,_0xa24c('0x17a'));}var _0xb53201='';var _0x50335e=parseInt(_0x268f40['queue_id'],0xa);if(isNaN(_0x50335e)){_0xb53201=_0x268f40[_0xa24c('0x179')];}else{_0xb53201=this[_0xa24c('0x17b')][_0xa24c('0x72')](this,_0x268f40[_0xa24c('0x179')]);if(!_0xb53201){return this['channel'][_0xa24c('0x31')](_0x268f40,_0xa24c('0x17c'));}}var _0x1e895b='';if(this[_0xa24c('0x86')](_0x268f40['file_id'])){var _0xa4968e=this[_0xa24c('0x1e')]['sync'](this,_0x268f40[_0xa24c('0x11b')]);if(_0xa4968e){_0x1e895b=_0xa4968e;}}this[_0xa24c('0x35')][_0xa24c('0x72')](this,_0x268f40,_0xb53201);if(_0x268f40[_0xa24c('0xed')][_0xa24c('0x17d')]('x')<0x0){_0x268f40[_0xa24c('0xed')]+='x';}if(_0x268f40[_0xa24c('0xed')][_0xa24c('0x17d')]('X')<0x0){_0x268f40[_0xa24c('0xed')]+='X';}this[_0xa24c('0x3a')][_0xa24c('0xa1')](_0xa24c('0x17e'),_0xb53201?_0xb53201[_0xa24c('0x17f')]():'');var _0x29c8a8=this[_0xa24c('0x3a')]['exec'](_0xa24c('0x180'),[_0xb53201,_0x268f40['opts'],_0x268f40[_0xa24c('0x65')],_0x1e895b,_0x268f40[_0xa24c('0x67')],_0x268f40['agi'],_0x268f40[_0xa24c('0x181')],_0x268f40[_0xa24c('0x182')],'',_0x268f40[_0xa24c('0x183')]]);if(_0x29c8a8[_0xa24c('0xa5')]===-0x1){return _0x29c8a8;}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util['format'](_0xa24c('0xc8'),'QUEUE',_0xb53201));};AGIVertices['prototype'][_0xa24c('0x184')]=function(_0x47049f){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x185'),_0x47049f['label']));var _0x354528=_0x47049f[_0xa24c('0x186')]||'wav';var _0x13e282=util[_0xa24c('0x28')](_0xa24c('0x187'),this['channel']['uniqueid'],rs[_0xa24c('0x123')](0x5));var _0x3bd4b8=util[_0xa24c('0x28')](_0xa24c('0x188'),FILES_PATH,_0x13e282,_0x354528);var _0x28b3d0=util[_0xa24c('0x28')]('%s/recordings/%s',FILES_PATH,_0x13e282);this[_0xa24c('0x3c')][_0xa24c('0x72')](this,_0x47049f,_0x13e282,_0x3bd4b8);this['channel']['setVariable'](_0xa24c('0x189'),_0x13e282);logger['info'](_0xa24c('0x18a'),_0x28b3d0,_0x354528,_0x47049f[_0xa24c('0x18b')],_0x47049f[_0xa24c('0x67')]);return this[_0xa24c('0x3a')][_0xa24c('0x13b')](_0x28b3d0,_0x354528,_0x47049f[_0xa24c('0x18b')],_0x47049f['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xa24c('0x18c')]=function(_0x15e809){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x18d'),_0x15e809[_0xa24c('0x37')]));if(!this['isConfigured'](_0x15e809[_0xa24c('0x65')])){return this[_0xa24c('0x3a')]['noop']('no\x20url\x20configured');}var _0x3061b4=this['restAPI'][_0xa24c('0x72')](this,_0x15e809);logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x18e'),util[_0xa24c('0x18f')](_0x3061b4,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x15e809[_0xa24c('0xdf')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x190'));}var _0x3ee77d=this[_0xa24c('0x12')][_0xa24c('0x72')](this,_0x15e809[_0xa24c('0xdf')]);if(!_0x3ee77d){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x15e809,_0xa24c('0xe0'));}this[_0xa24c('0x3a')][_0xa24c('0xa1')](util['format'](_0xa24c('0x191'),_0x3ee77d),_0x3061b4['statusCode']?_0x3061b4[_0xa24c('0x77')]:'200');this[_0xa24c('0x3a')][_0xa24c('0xa1')](util['format'](_0xa24c('0x192'),_0x3ee77d),_0x3061b4['statusMessage']?_0x3061b4['statusMessage']:'OK');if(_0x3061b4[_0xa24c('0x6d')]){try{this[_0xa24c('0x9f')](_0x3061b4[_0xa24c('0x6d')],_0x3ee77d);}catch(_0xdaaf26){logger[_0xa24c('0x31')](util['format'](_0xa24c('0x193'),_0x3ee77d));}}return this[_0xa24c('0x3a')]['noop'](util[_0xa24c('0x28')](_0xa24c('0xe4'),_0x3ee77d));};AGIVertices['prototype'][_0xa24c('0x194')]=function(_0xdc49ad){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xdc49ad[_0xa24c('0x37')]));return this['channel'][_0xa24c('0x195')](_0xdc49ad[_0xa24c('0x196')]['replace'](/\s+/g,''),_0xdc49ad[_0xa24c('0x18b')]);};AGIVertices[_0xa24c('0x11')]['saynumber']=function(_0x230f29){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x197'),_0x230f29[_0xa24c('0x37')]));return this[_0xa24c('0x3a')][_0xa24c('0x198')](_0x230f29['number'][_0xa24c('0xdc')](/\s+/g,''),_0x230f29[_0xa24c('0x18b')]);};AGIVertices['prototype']['sayphonetic']=function(_0x25743d){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x199'),_0x25743d[_0xa24c('0x37')]));return this[_0xa24c('0x3a')][_0xa24c('0x19a')](_0x25743d['text'],_0x25743d[_0xa24c('0x18b')]);};AGIVertices['prototype']['sendMail']=function(_0x215eb1){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x19b'),_0x215eb1[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x215eb1[_0xa24c('0x19c')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x19d'));}var _0xe39991=this[_0xa24c('0x21')][_0xa24c('0x72')](this,_0x215eb1[_0xa24c('0x19c')]);if(!_0xe39991||!_0xe39991[_0xa24c('0x19e')]){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x215eb1,'no\x20mail\x20account\x20found');}var _0x5413cd={'from':util[_0xa24c('0x28')](_0xa24c('0x19f'),_0xe39991[_0xa24c('0x15')],_0xe39991[_0xa24c('0x1a0')]||_0xe39991[_0xa24c('0x19e')][_0xa24c('0x1a1')]),'to':_0x215eb1['to']||'','cc':_0x215eb1['cc']||'','bcc':_0x215eb1['bcc']||'','subject':_0x215eb1['subject'],'html':_0x215eb1[_0xa24c('0x5b')],'text':_0x215eb1[_0xa24c('0x5b')]};if(this[_0xa24c('0x86')](_0x215eb1[_0xa24c('0x1a2')])){}logger[_0xa24c('0xe6')](_0xa24c('0x1a3'),JSON[_0xa24c('0x75')](_0x5413cd));this[_0xa24c('0x35')][_0xa24c('0x72')](this,_0x215eb1,_0x215eb1[_0xa24c('0x19c')]);this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x1a4'),_0xe39991[_0xa24c('0x15')]));this[_0xa24c('0x23')][_0xa24c('0x72')](this,_0xe39991[_0xa24c('0x1a5')],_0x5413cd);return this['channel'][_0xa24c('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1a6')]=function(_0x391af4){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x391af4['label']));return this[_0xa24c('0x3a')]['noop'](_0xa24c('0x1a7'));};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1a8')]=function(_0x3804b1){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x1a9'),_0x3804b1['label']));if(!this['isConfigured'](_0x3804b1[_0xa24c('0x1aa')])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0x1ab'));}var _0xf0190=this['getSmsAccount']['sync'](this,_0x3804b1[_0xa24c('0x1aa')]);if(!_0xf0190){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x3804b1,_0xa24c('0x1ac'));}var _0x151eb3={'body':_0x3804b1[_0xa24c('0x1ad')],'phone':_0x3804b1['to']||'','SmsAccountId':_0xf0190['id']};logger[_0xa24c('0xe6')]('sendSMS\x20message',JSON[_0xa24c('0x75')](_0x151eb3));this['createSquareDetailsReport'][_0xa24c('0x72')](this,_0x3804b1,_0x3804b1[_0xa24c('0x1aa')]);this[_0xa24c('0x3a')][_0xa24c('0xaa')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0xf0190[_0xa24c('0x15')]));this[_0xa24c('0x34')][_0xa24c('0x72')](this,_0x151eb3);return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x1ae'));};AGIVertices['prototype'][_0xa24c('0x1af')]=function(_0x2381ca){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x1b0'),_0x2381ca[_0xa24c('0x37')]));if(!this['isConfigured'](_0x2381ca['variable_id'])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x2381ca,_0xa24c('0x1b1'));}var _0x397fba=this[_0xa24c('0x12')][_0xa24c('0x72')](this,_0x2381ca['variable_id']);if(!_0x397fba){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x2381ca,_0xa24c('0xe0'));}return this[_0xa24c('0x3a')][_0xa24c('0xa1')](_0x397fba,_0x2381ca[_0xa24c('0x1b2')]);};AGIVertices['prototype'][_0xa24c('0x1b3')]=function(_0x1938ba){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x1b4'),_0x1938ba[_0xa24c('0x37')]));this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x1b5'));var _0xabdc0e=this[_0xa24c('0x3a')][_0xa24c('0x12')]('XMCS-UNIQUEID');if(!_[_0xa24c('0x44')](_0xabdc0e['extra'])){this[_0xa24c('0x3a')]['uniqueid']=_0xabdc0e[_0xa24c('0xa4')];}if(_0x1938ba[_0xa24c('0xbc')]==='yes'){this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0x1b6'));return this[_0xa24c('0x3a')][_0xa24c('0xbc')]();}return this[_0xa24c('0x3a')]['noop'](_0xa24c('0x1b7'));};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1b8')]=function(_0x52ff60){logger['info'](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x52ff60['label']));if(!this[_0xa24c('0x86')](_0x52ff60['project_id'])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x52ff60,'no\x20subproject\x20selected');}var _0xa49e18=this['getSquareProject'][_0xa24c('0x72')](this,_0x52ff60[_0xa24c('0x1b9')]);if(!this['isConfigured'](_0xa49e18)){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x52ff60,util[_0xa24c('0x28')](_0xa24c('0x1ba'),_0x52ff60[_0xa24c('0x1b9')]));}if(_0xa49e18===this[_0xa24c('0x3a')][_0xa24c('0x39')]){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x52ff60,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xa24c('0x35')]['sync'](this,_0x52ff60,_0xa49e18);var _0x516208=this[_0xa24c('0x3a')][_0xa24c('0x56')](_0xa24c('0x1bb'),util[_0xa24c('0x28')](_0xa24c('0x1bc'),config[_0xa24c('0x7')][_0xa24c('0x1bd')]||_0xa24c('0x1be'),_0xa49e18,this['channel']['arg_1']));if(_0x516208[_0xa24c('0xa5')]===-0x1){return _0x516208;}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xc8'),_0xa24c('0x1bb'),_0xa49e18));};AGIVertices['prototype'][_0xa24c('0x1bf')]=function(_0x3beb34){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x1c0'),_0x3beb34[_0xa24c('0x37')]));var _0x165bb5=this['shellCommand'][_0xa24c('0x72')](this,_0x3beb34['command']);this[_0xa24c('0x35')][_0xa24c('0x72')](this,_0x3beb34,_0x3beb34['command']);if(this['isConfigured'](_0x3beb34['variable_id'])){var _0x296dcf=this[_0xa24c('0x12')][_0xa24c('0x72')](this,_0x3beb34[_0xa24c('0xdf')]);if(_0x296dcf){this['channel'][_0xa24c('0xa1')](_0x296dcf,_0x165bb5);return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util['format'](_0xa24c('0x1c1'),_0x3beb34[_0xa24c('0xba')],_0x296dcf));}}return this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x1c2'),_0x3beb34[_0xa24c('0xba')]));};AGIVertices['prototype'][_0xa24c('0x1c3')]=function(_0x1c3805){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1c3805[_0xa24c('0x37')]));_0x1c3805[_0xa24c('0x5b')]=_0x1c3805[_0xa24c('0x5b')][_0xa24c('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa24c('0x86')](_0x1c3805['apiKey'])){return this[_0xa24c('0x3a')]['noop'](_0xa24c('0x1c4'));}if(!this[_0xa24c('0x86')](_0x1c3805['text'])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')]('no\x20text\x20configured');}this['channel'][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x1c5'),_0x1c3805['text']));var _0x1035cc=this[_0xa24c('0x58')][_0xa24c('0x72')](this,_0x1c3805);if(_0x1035cc){this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x1c6'),_0x1035cc));var _0x320b21=this['channel'][_0xa24c('0x10d')](_0x1035cc);try{fs[_0xa24c('0x10e')](_0x1035cc+_0xa24c('0x10f'));}catch(_0x290561){logger[_0xa24c('0x31')](_0x290561);}return _0x320b21;}return this['channel'][_0xa24c('0x31')](_0x1c3805,_0xa24c('0x1c7'));};AGIVertices['prototype']['tts']=function(_0xd80553){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x1c8'),_0xd80553[_0xa24c('0x37')]));_0xd80553['text']=_0xd80553[_0xa24c('0x5b')][_0xa24c('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xd80553[_0xa24c('0x5b')])){return this[_0xa24c('0x3a')][_0xa24c('0xaa')](_0xa24c('0xab'));}this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0x1c9'),_0xd80553[_0xa24c('0x5b')]));var _0x2eb489=this[_0xa24c('0x62')][_0xa24c('0x72')](this,_0xd80553);if(_0x2eb489){this['channel']['noop'](util[_0xa24c('0x28')](_0xa24c('0x1ca'),_0x2eb489));var _0x3c5966=this['channel'][_0xa24c('0x10d')](_0x2eb489);try{fs['unlink'](_0x2eb489+_0xa24c('0x10f'));}catch(_0x5639fd){logger[_0xa24c('0x31')](_0x5639fd);}return _0x3c5966;}return this[_0xa24c('0x3a')]['error'](_0xd80553,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xa24c('0x1cb')]=function(_0x56ad37){logger['info'](util['format'](_0xa24c('0x1cc'),_0x56ad37[_0xa24c('0x37')]));if(!this[_0xa24c('0x86')](_0x56ad37[_0xa24c('0x160')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x56ad37,_0xa24c('0x161'));}logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x162'),this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x56ad37[_0xa24c('0x160')]));var _0xf4b1c9=this[_0xa24c('0x1cd')][_0xa24c('0x72')](this,_0x56ad37[_0xa24c('0x160')]);if(_0xf4b1c9){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x56ad37[_0xa24c('0x160')]));this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa24c('0x3a')][_0xa24c('0x3b')],_0x56ad37[_0xa24c('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa24c('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa24c('0x3b')],_0x56ad37[_0xa24c('0x160')]));this[_0xa24c('0x3a')]['noop'](util[_0xa24c('0x28')](_0xa24c('0x164'),this['channel']['callerid'],_0x56ad37[_0xa24c('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa24c('0x11')]['voicemail']=function(_0x1df7a4){logger[_0xa24c('0x2e')](util[_0xa24c('0x28')](_0xa24c('0x1ce'),_0x1df7a4[_0xa24c('0x37')]));var _0x39635e=this[_0xa24c('0x3a')][_0xa24c('0x56')](_0xa24c('0x1cf'),[_0x1df7a4['mailbox'],_0x1df7a4['options']]);if(_0x39635e['result']===-0x1){return _0x39635e;}return this[_0xa24c('0x3a')][_0xa24c('0xaa')](util[_0xa24c('0x28')](_0xa24c('0xc8'),_0xa24c('0x1cf'),_0x1df7a4[_0xa24c('0x1d0')]));};AGIVertices[_0xa24c('0x11')][_0xa24c('0x1d1')]=function(_0x36c88d){logger['info'](util[_0xa24c('0x28')](_0xa24c('0x1d2'),_0x36c88d['label']));if(!this[_0xa24c('0x86')](_0x36c88d[_0xa24c('0xdf')])){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x36c88d,_0xa24c('0x1b1'));}var _0x3707d9=this[_0xa24c('0x12')][_0xa24c('0x72')](this,_0x36c88d[_0xa24c('0xdf')]);if(!_0x3707d9){return this[_0xa24c('0x3a')][_0xa24c('0x31')](_0x36c88d,_0xa24c('0xe0'));}var _0x2750d9=this['channel']['getVariable'](_0x3707d9);return{'code':0xc8,'result':_0x2750d9[_0xa24c('0xa4')]?_0x2750d9[_0xa24c('0xa4')]:'-'};};String[_0xa24c('0x11')]['replaceAll']=function(_0x2997b5,_0x294c10){return this['split'](_0x2997b5)[_0xa24c('0x1d3')](_0x294c10);};module[_0xa24c('0x1d4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d8a293a..f4b03b3 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 _0x604e=['[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','update','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause'];(function(_0x293b44,_0x38edba){var _0x1c0b48=function(_0x3ebc0c){while(--_0x3ebc0c){_0x293b44['push'](_0x293b44['shift']());}};_0x1c0b48(++_0x38edba);}(_0x604e,0xb0));var _0xe604=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x604e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xe604('0x0'));var ami=require(_0xe604('0x1'));var logger=require(_0xe604('0x2'))('acw');var RpcUser=require(_0xe604('0x3'));var RpcVoiceAgentReport=require(_0xe604('0x4'));function Acw(_0x1df127){this[_0xe604('0x5')]=_0x1df127['voiceQueues'];this[_0xe604('0x6')]=_0x1df127[_0xe604('0x6')];this[_0xe604('0x7')]=_0x1df127[_0xe604('0x7')];this['channels']={};ami['on'](_0xe604('0x8'),this[_0xe604('0x9')][_0xe604('0xa')](this));ami['on'](_0xe604('0xb'),this[_0xe604('0xc')][_0xe604('0xa')](this));ami['on'](_0xe604('0xd'),this['syncHangup']['bind'](this));ami['on'](_0xe604('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xe604('0xf'),this[_0xe604('0x10')][_0xe604('0xa')](this));ami['on'](_0xe604('0x11'),this[_0xe604('0x12')]['bind'](this));ami['on'](_0xe604('0x13'),this[_0xe604('0x14')][_0xe604('0xa')](this));}function getDiff(_0xb55576){var _0x4dd9ed=moment()[_0xe604('0x15')](0x0);var _0x2d896e=moment(_0xb55576)['milliseconds'](0x0);return _0x4dd9ed[_0xe604('0x16')](_0x2d896e,_0xe604('0x17'));}Acw['prototype'][_0xe604('0x18')]=function(_0x4a5ab5,_0x47d18b){var _0xed7899=this;var _0x472cf5=getDiff(_0xed7899[_0xe604('0x7')][_0x4a5ab5]['lastPauseAt']);clearTimeout(_0xed7899[_0xe604('0x7')][_0x4a5ab5]['timer']);_0xed7899[_0xe604('0x7')][_0x4a5ab5]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x472cf5},_0xed7899['timers'][_0x4a5ab5][_0xe604('0x19')],_0x4a5ab5)[_0xe604('0x1a')](function(_0x115032){logger[_0xe604('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x47d18b,_0x472cf5,_0x115032);})[_0xe604('0x1c')](function(_0x182959){logger[_0xe604('0x1d')](_0xe604('0x1e'),_0x47d18b,_0x182959);})[_0xe604('0x1f')](function(){delete _0xed7899[_0xe604('0x7')][_0x4a5ab5];});};Acw[_0xe604('0x20')]['startAcw']=function(_0x43519b){try{var _0x6775a5=this;var _0x2ffcfc=this[_0xe604('0x21')][_0x43519b]['interface'];var _0x3a8be7=this[_0xe604('0x21')][_0x43519b][_0xe604('0x22')];var _0x3bcc69=this['voiceQueues'][_0x3a8be7];var _0x2e7350=![];var _0x4beee8=_0xe604('0x23');if(_0x3bcc69[_0xe604('0x24')]&&_0x3bcc69[_0xe604('0x25')][_0xe604('0x26')]){_0x2e7350=!![];_0x4beee8=_0x3bcc69[_0xe604('0x25')][_0xe604('0x26')];}return ami[_0xe604('0x27')]({'action':_0xe604('0x28'),'interface':_0x2ffcfc,'paused':!![],'reason':_0x4beee8})['then'](function(){if(_0x6775a5[_0xe604('0x6')][_0x2ffcfc]){return RpcUser[_0xe604('0x29')](_0x6775a5[_0xe604('0x6')][_0x2ffcfc]['id'])['then'](function(_0x5dd20e){if(!_0x5dd20e||_0x5dd20e[_0xe604('0x2a')]){logger[_0xe604('0x1b')](_0xe604('0x2b'),_0x43519b,_0x2ffcfc,_0x3a8be7);return;}logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x43519b,_0x2ffcfc,_0x3a8be7);var _0x110cf3=_0x6775a5[_0xe604('0x21')][_0x43519b][_0xe604('0x2c')]&&_0x6775a5[_0xe604('0x21')][_0x43519b][_0xe604('0x2d')]?_0x6775a5[_0xe604('0x21')][_0x43519b][_0xe604('0x2d')]:_0x43519b;return RpcUser[_0xe604('0x2e')](_0x6775a5[_0xe604('0x6')][_0x2ffcfc],_0x4beee8,_0x110cf3)[_0xe604('0x1a')](function(_0x584462){_0x6775a5[_0xe604('0x5')][_0x3a8be7][_0xe604('0x2f')]-=0x1;_0x6775a5[_0xe604('0x5')][_0x3a8be7][_0xe604('0x30')]+=0x1;return _0x584462;});})[_0xe604('0x1a')](function(_0x19923d){if(_0x2e7350||!_0x19923d){return;}_0x6775a5[_0xe604('0x7')][_0x2ffcfc]={};logger[_0xe604('0x1b')](_0xe604('0x31'),_0x43519b,_0x6775a5['voiceQueues'][_0x3a8be7]['acwTimeout'],_0x2ffcfc,_0x3a8be7);_0x6775a5['timers'][_0x2ffcfc]['timer']=setTimeout(_0x6775a5[_0xe604('0x32')]['bind'](_0x6775a5,_0x2ffcfc),_0x6775a5[_0xe604('0x5')][_0x3a8be7][_0xe604('0x33')]*0x3e8);_0x6775a5['timers'][_0x2ffcfc][_0xe604('0x34')]=moment()['format'](_0xe604('0x35'));_0x6775a5['timers'][_0x2ffcfc][_0xe604('0x19')]=_0x43519b;_0x6775a5[_0xe604('0x7')][_0x2ffcfc][_0xe604('0x22')]=_0x3a8be7;_0x6775a5[_0xe604('0x7')][_0x2ffcfc][_0xe604('0x18')]=_0x6775a5[_0xe604('0x18')]['bind'](_0x6775a5,_0x2ffcfc,_0x43519b);});}})[_0xe604('0x1c')](function(){logger[_0xe604('0x1d')](_0xe604('0x31'),_0x43519b,_0x6775a5['voiceQueues'][_0x3a8be7][_0xe604('0x33')],_0x2ffcfc,_0x3a8be7);})[_0xe604('0x1f')](function(){delete _0x6775a5[_0xe604('0x21')][_0x43519b];});}catch(_0x5038e1){logger[_0xe604('0x1d')]('[ACW][START]\x20%s',_0x5038e1[_0xe604('0x36')]);}};Acw[_0xe604('0x20')][_0xe604('0x32')]=function(_0x28ba88){try{var _0x121202=this;if(_0x121202[_0xe604('0x7')][_0x28ba88]){_0x121202[_0xe604('0x7')][_0x28ba88]['timer']=![];var _0x4979a8=_0x121202[_0xe604('0x7')][_0x28ba88][_0xe604('0x19')];var _0x16c44e=_0x121202[_0xe604('0x7')][_0x28ba88][_0xe604('0x22')];var _0x434a3d=_0x121202[_0xe604('0x5')][_0x16c44e][_0xe604('0x33')];logger['info'](_0xe604('0x37'),_0x4979a8,_0x28ba88);RpcUser[_0xe604('0x29')](this[_0xe604('0x6')][_0x28ba88]['id'])[_0xe604('0x1a')](function(_0x3421c3){if(_0x3421c3[_0xe604('0x38')]===_0xe604('0x23')){return RpcUser['saveUnpause'](_0x121202[_0xe604('0x6')][_0x28ba88]);}});RpcVoiceAgentReport[_0xe604('0x39')]({'acwtime':_0x434a3d,'agentacw':!![]},_0x4979a8,_0x28ba88)['then'](function(_0x2143e4){logger[_0xe604('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x4979a8,_0x434a3d,_0x2143e4);})['catch'](function(_0x2714af){logger[_0xe604('0x1d')](_0xe604('0x1e'),_0x4979a8,_0x2714af);});}else{logger[_0xe604('0x1d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x28ba88);if(_0x121202[_0xe604('0x7')]){logger[_0xe604('0x1b')](_0xe604('0x3a'),JSON[_0xe604('0x3b')](_0x121202['timers']));}}}catch(_0x4fcd1c){logger[_0xe604('0x1d')](_0xe604('0x3c'),_0x4fcd1c[_0xe604('0x36')]);}};Acw[_0xe604('0x20')][_0xe604('0x9')]=function(_0x1ca779){try{if(this[_0xe604('0x5')][_0x1ca779['queue']]&&(this[_0xe604('0x5')][_0x1ca779['queue']][_0xe604('0x3d')]||this[_0xe604('0x5')][_0x1ca779[_0xe604('0x22')]][_0xe604('0x24')])){if(this[_0xe604('0x6')][_0x1ca779[_0xe604('0x3e')]]){this[_0xe604('0x21')][_0x1ca779[_0xe604('0x19')]]={'queue':_0x1ca779[_0xe604('0x22')],'interface':_0x1ca779['interface'],'destlinkedid':_0x1ca779[_0xe604('0x2d')]};}}}catch(_0x330b82){logger[_0xe604('0x1d')](_0xe604('0x3f'),_0x330b82[_0xe604('0x36')]);}};Acw[_0xe604('0x20')]['syncAgentConnectPreview']=function(_0x191a77){try{if(this['voiceQueues'][_0x191a77['queue']]&&(this[_0xe604('0x5')][_0x191a77[_0xe604('0x22')]][_0xe604('0x3d')]||this[_0xe604('0x5')][_0x191a77[_0xe604('0x22')]][_0xe604('0x24')])){if(this[_0xe604('0x6')][_0x191a77[_0xe604('0x3e')]]){this[_0xe604('0x21')][_0x191a77['uniqueid']]={'queue':_0x191a77[_0xe604('0x22')],'interface':_0x191a77[_0xe604('0x3e')]};}}}catch(_0x39d5f6){logger['error'](_0xe604('0x40'),_0x39d5f6[_0xe604('0x36')]);}};Acw[_0xe604('0x20')][_0xe604('0xc')]=function(_0x3e8599){try{if(this['channels'][_0x3e8599[_0xe604('0x19')]]&&_[_0xe604('0x41')](this[_0xe604('0x21')][_0x3e8599[_0xe604('0x19')]]['attended'])){logger[_0xe604('0x1b')](_0xe604('0x42'),_0x3e8599[_0xe604('0x19')]);this[_0xe604('0x43')](_0x3e8599[_0xe604('0x19')]);}else if(this[_0xe604('0x21')][_0x3e8599['linkedid']]&&_[_0xe604('0x41')](this['channels'][_0x3e8599[_0xe604('0x44')]][_0xe604('0x2c')])){logger['info'](_0xe604('0x45'),_0x3e8599['linkedid']);this[_0xe604('0x43')](_0x3e8599[_0xe604('0x44')]);}}catch(_0x3e4790){logger[_0xe604('0x1d')]('[ACW][syncHangupRequest]\x20%s',_0x3e4790[_0xe604('0x36')]);}};Acw[_0xe604('0x20')][_0xe604('0x46')]=function(_0x1620d6){try{if(this[_0xe604('0x21')][_0x1620d6['uniqueid']]&&this['channels'][_0x1620d6[_0xe604('0x19')]]['attended']){logger[_0xe604('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1620d6[_0xe604('0x19')]);this[_0xe604('0x43')](_0x1620d6[_0xe604('0x19')]);}else if(this[_0xe604('0x21')][_0x1620d6[_0xe604('0x44')]]&&this[_0xe604('0x21')][_0x1620d6[_0xe604('0x44')]][_0xe604('0x2c')]){logger[_0xe604('0x1b')](_0xe604('0x47'),_0x1620d6[_0xe604('0x44')]);this[_0xe604('0x43')](_0x1620d6[_0xe604('0x44')]);}}catch(_0x2ed6ad){logger[_0xe604('0x1d')](_0xe604('0x48'),_0x2ed6ad[_0xe604('0x36')]);}};Acw['prototype'][_0xe604('0x10')]=function(_0x19ecc5){try{if(!_[_0xe604('0x49')](this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4a')]])){this[_0xe604('0x43')](_0x19ecc5[_0xe604('0x4a')]);if(this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4b')]]){this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4b')]][_0xe604('0x2c')]=!![];this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4c')]]=this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4b')]];delete this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4b')]];}}else if(!_[_0xe604('0x49')](this['channels'][_0x19ecc5['transfertargetuniqueid']])){this[_0xe604('0x43')](_0x19ecc5[_0xe604('0x4c')]);if(this['channels'][_0x19ecc5[_0xe604('0x4d')]]){this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4d')]][_0xe604('0x2c')]=!![];this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4a')]]=this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4d')]];delete this[_0xe604('0x21')][_0x19ecc5[_0xe604('0x4d')]];}}}catch(_0xb31c12){logger[_0xe604('0x1d')](_0xe604('0x4e'),_0xb31c12['message']);}};Acw[_0xe604('0x20')]['syncBlindTransfer']=function(_0xd28525){try{if(this['channels'][_0xd28525[_0xe604('0x4f')]]){logger['info'](_0xe604('0x50'),JSON[_0xe604('0x3b')](_0xd28525[_0xe604('0x4f')]));this[_0xe604('0x43')](_0xd28525['transfereruniqueid']);}else if(this['channels'][_0xd28525[_0xe604('0x51')]]){logger[_0xe604('0x1b')](_0xe604('0x52'),JSON[_0xe604('0x3b')](_0xd28525[_0xe604('0x51')]));this[_0xe604('0x43')](_0xd28525[_0xe604('0x51')]);}}catch(_0x10a4e8){logger[_0xe604('0x1d')](_0xe604('0x53'),_0x10a4e8[_0xe604('0x36')]);}};Acw[_0xe604('0x20')]['syncAgentRingNoAnswer']=function(_0x82eed){try{if(this[_0xe604('0x5')][_0x82eed[_0xe604('0x22')]]&&this['voiceQueues'][_0x82eed[_0xe604('0x22')]][_0xe604('0x54')]==='all'){if(this[_0xe604('0x6')][_0x82eed['interface']]){logger[_0xe604('0x1b')](_0xe604('0x55'),_0x82eed['uniqueid'],_0x82eed['interface'],_0x82eed['queue']);return RpcUser[_0xe604('0x2e')](this[_0xe604('0x6')][_0x82eed['interface']],_0xe604('0x56'),_0x82eed['uniqueid']);}}}catch(_0x2fb3ea){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2fb3ea[_0xe604('0x36')]);}};module['exports']=Acw; \ No newline at end of file +var _0x9413=['updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','prototype','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','queue','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9413,0x1c4));var _0x3941=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x9413[_0x197185];return _0x2c8af1;};'use strict';var _=require(_0x3941('0x0'));var moment=require(_0x3941('0x1'));var ami=require(_0x3941('0x2'));var logger=require(_0x3941('0x3'))(_0x3941('0x4'));var RpcUser=require(_0x3941('0x5'));var RpcVoiceAgentReport=require(_0x3941('0x6'));function Acw(_0x20420a){this[_0x3941('0x7')]=_0x20420a['voiceQueues'];this[_0x3941('0x8')]=_0x20420a[_0x3941('0x8')];this[_0x3941('0x9')]=_0x20420a[_0x3941('0x9')];this[_0x3941('0xa')]={};ami['on'](_0x3941('0xb'),this[_0x3941('0xc')][_0x3941('0xd')](this));ami['on'](_0x3941('0xe'),this[_0x3941('0xf')][_0x3941('0xd')](this));ami['on'](_0x3941('0x10'),this[_0x3941('0x11')][_0x3941('0xd')](this));ami['on'](_0x3941('0x12'),this[_0x3941('0x13')][_0x3941('0xd')](this));ami['on'](_0x3941('0x14'),this['syncAttendedTransfer'][_0x3941('0xd')](this));ami['on'](_0x3941('0x15'),this[_0x3941('0x16')]['bind'](this));ami['on'](_0x3941('0x17'),this[_0x3941('0x18')]['bind'](this));}function getDiff(_0x43a2ab){var _0x1d92fd=moment()[_0x3941('0x19')](0x0);var _0x2cba53=moment(_0x43a2ab)[_0x3941('0x19')](0x0);return _0x1d92fd[_0x3941('0x1a')](_0x2cba53,_0x3941('0x1b'));}Acw['prototype'][_0x3941('0x1c')]=function(_0x4636d8,_0x2d9aee){var _0x53ae75=this;var _0x212aa0=getDiff(_0x53ae75[_0x3941('0x9')][_0x4636d8][_0x3941('0x1d')]);clearTimeout(_0x53ae75['timers'][_0x4636d8][_0x3941('0x1e')]);_0x53ae75[_0x3941('0x9')][_0x4636d8][_0x3941('0x1e')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x212aa0},_0x53ae75[_0x3941('0x9')][_0x4636d8][_0x3941('0x1f')],_0x4636d8)[_0x3941('0x20')](function(_0x11bd6b){logger[_0x3941('0x21')](_0x3941('0x22'),_0x2d9aee,_0x212aa0,_0x11bd6b);})[_0x3941('0x23')](function(_0x45352e){logger['error'](_0x3941('0x24'),_0x2d9aee,_0x45352e);})[_0x3941('0x25')](function(){delete _0x53ae75[_0x3941('0x9')][_0x4636d8];});};Acw[_0x3941('0x26')]['startAcw']=function(_0x347c1a){try{var _0x27c342=this;var _0x2c0dfe=this[_0x3941('0xa')][_0x347c1a][_0x3941('0x27')];var _0x12eeb0=this[_0x3941('0xa')][_0x347c1a]['queue'];var _0x52730d=this['voiceQueues'][_0x12eeb0];var _0x49ad89=![];var _0x2201f6=_0x3941('0x28');if(_0x52730d[_0x3941('0x29')]&&_0x52730d[_0x3941('0x2a')][_0x3941('0x2b')]){_0x49ad89=!![];_0x2201f6=_0x52730d[_0x3941('0x2a')][_0x3941('0x2b')];}return ami[_0x3941('0x2c')]({'action':_0x3941('0x2d'),'interface':_0x2c0dfe,'paused':!![],'reason':_0x2201f6})[_0x3941('0x20')](function(){if(_0x27c342['agents'][_0x2c0dfe]){return RpcUser[_0x3941('0x2e')](_0x27c342[_0x3941('0x8')][_0x2c0dfe]['id'])['then'](function(_0x5eaae2){if(!_0x5eaae2||_0x5eaae2[_0x3941('0x2f')]){logger[_0x3941('0x21')](_0x3941('0x30'),_0x347c1a,_0x2c0dfe,_0x12eeb0);return;}logger[_0x3941('0x21')](_0x3941('0x31'),_0x347c1a,_0x2c0dfe,_0x12eeb0);var _0x2211a8=_0x27c342[_0x3941('0xa')][_0x347c1a][_0x3941('0x32')]&&_0x27c342['channels'][_0x347c1a][_0x3941('0x33')]?_0x27c342[_0x3941('0xa')][_0x347c1a][_0x3941('0x33')]:_0x347c1a;return RpcUser[_0x3941('0x34')](_0x27c342[_0x3941('0x8')][_0x2c0dfe],_0x2201f6,_0x2211a8)[_0x3941('0x20')](function(_0x447e15){_0x27c342[_0x3941('0x7')][_0x12eeb0][_0x3941('0x35')]-=0x1;_0x27c342['voiceQueues'][_0x12eeb0][_0x3941('0x36')]+=0x1;return _0x447e15;});})[_0x3941('0x20')](function(_0x522728){if(_0x49ad89||!_0x522728){return;}_0x27c342['timers'][_0x2c0dfe]={};logger['info'](_0x3941('0x37'),_0x347c1a,_0x27c342[_0x3941('0x7')][_0x12eeb0][_0x3941('0x38')],_0x2c0dfe,_0x12eeb0);_0x27c342['timers'][_0x2c0dfe]['timer']=setTimeout(_0x27c342[_0x3941('0x39')]['bind'](_0x27c342,_0x2c0dfe),_0x27c342[_0x3941('0x7')][_0x12eeb0][_0x3941('0x38')]*0x3e8);_0x27c342[_0x3941('0x9')][_0x2c0dfe][_0x3941('0x1d')]=moment()['format'](_0x3941('0x3a'));_0x27c342[_0x3941('0x9')][_0x2c0dfe][_0x3941('0x1f')]=_0x347c1a;_0x27c342[_0x3941('0x9')][_0x2c0dfe][_0x3941('0x3b')]=_0x12eeb0;_0x27c342[_0x3941('0x9')][_0x2c0dfe][_0x3941('0x1c')]=_0x27c342['updateAcw'][_0x3941('0xd')](_0x27c342,_0x2c0dfe,_0x347c1a);});}})[_0x3941('0x23')](function(){logger[_0x3941('0x3c')](_0x3941('0x37'),_0x347c1a,_0x27c342[_0x3941('0x7')][_0x12eeb0][_0x3941('0x38')],_0x2c0dfe,_0x12eeb0);})[_0x3941('0x25')](function(){delete _0x27c342[_0x3941('0xa')][_0x347c1a];});}catch(_0xb2a08a){logger['error'](_0x3941('0x3d'),_0xb2a08a[_0x3941('0x3e')]);}};Acw[_0x3941('0x26')][_0x3941('0x39')]=function(_0x3e81d0){try{var _0x4fe0c9=this;if(_0x4fe0c9[_0x3941('0x9')][_0x3e81d0]){_0x4fe0c9['timers'][_0x3e81d0]['timer']=![];var _0x16a3aa=_0x4fe0c9['timers'][_0x3e81d0][_0x3941('0x1f')];var _0x702bce=_0x4fe0c9[_0x3941('0x9')][_0x3e81d0][_0x3941('0x3b')];var _0x1191ca=_0x4fe0c9[_0x3941('0x7')][_0x702bce]['acwTimeout'];logger[_0x3941('0x21')](_0x3941('0x3f'),_0x16a3aa,_0x3e81d0);RpcUser[_0x3941('0x2e')](this[_0x3941('0x8')][_0x3e81d0]['id'])[_0x3941('0x20')](function(_0x8f0580){if(_0x8f0580[_0x3941('0x40')]===_0x3941('0x28')){return RpcUser[_0x3941('0x41')](_0x4fe0c9[_0x3941('0x8')][_0x3e81d0]);}});RpcVoiceAgentReport[_0x3941('0x42')]({'acwtime':_0x1191ca,'agentacw':!![]},_0x16a3aa,_0x3e81d0)['then'](function(_0x5d7a12){logger[_0x3941('0x21')](_0x3941('0x22'),_0x16a3aa,_0x1191ca,_0x5d7a12);})[_0x3941('0x23')](function(_0x418fea){logger[_0x3941('0x3c')](_0x3941('0x24'),_0x16a3aa,_0x418fea);});}else{logger[_0x3941('0x3c')](_0x3941('0x43'),_0x3e81d0);if(_0x4fe0c9[_0x3941('0x9')]){logger[_0x3941('0x21')](_0x3941('0x44'),JSON['stringify'](_0x4fe0c9[_0x3941('0x9')]));}}}catch(_0x592d02){logger['error'](_0x3941('0x45'),_0x592d02[_0x3941('0x3e')]);}};Acw[_0x3941('0x26')][_0x3941('0xc')]=function(_0x598d1b){try{if(this[_0x3941('0x7')][_0x598d1b[_0x3941('0x3b')]]&&(this['voiceQueues'][_0x598d1b[_0x3941('0x3b')]][_0x3941('0x4')]||this[_0x3941('0x7')][_0x598d1b[_0x3941('0x3b')]][_0x3941('0x29')])){if(this[_0x3941('0x8')][_0x598d1b[_0x3941('0x27')]]){this[_0x3941('0xa')][_0x598d1b[_0x3941('0x1f')]]={'queue':_0x598d1b[_0x3941('0x3b')],'interface':_0x598d1b[_0x3941('0x27')],'destlinkedid':_0x598d1b[_0x3941('0x33')]};}}}catch(_0x538e3e){logger['error'](_0x3941('0x46'),_0x538e3e['message']);}};Acw[_0x3941('0x26')]['syncAgentConnectPreview']=function(_0x2ea272){try{if(this['voiceQueues'][_0x2ea272[_0x3941('0x3b')]]&&(this[_0x3941('0x7')][_0x2ea272['queue']][_0x3941('0x4')]||this[_0x3941('0x7')][_0x2ea272[_0x3941('0x3b')]][_0x3941('0x29')])){if(this[_0x3941('0x8')][_0x2ea272['interface']]){this[_0x3941('0xa')][_0x2ea272[_0x3941('0x1f')]]={'queue':_0x2ea272[_0x3941('0x3b')],'interface':_0x2ea272[_0x3941('0x27')]};}}}catch(_0x1b363d){logger[_0x3941('0x3c')](_0x3941('0x47'),_0x1b363d[_0x3941('0x3e')]);}};Acw[_0x3941('0x26')][_0x3941('0xf')]=function(_0x25c19f){try{if(this[_0x3941('0xa')][_0x25c19f[_0x3941('0x1f')]]&&_['isUndefined'](this[_0x3941('0xa')][_0x25c19f[_0x3941('0x1f')]][_0x3941('0x32')])){logger[_0x3941('0x21')]('[%s][HANGUP:UNIQUEID]',_0x25c19f['uniqueid']);this[_0x3941('0x48')](_0x25c19f['uniqueid']);}else if(this[_0x3941('0xa')][_0x25c19f[_0x3941('0x49')]]&&_['isUndefined'](this[_0x3941('0xa')][_0x25c19f['linkedid']][_0x3941('0x32')])){logger[_0x3941('0x21')](_0x3941('0x4a'),_0x25c19f[_0x3941('0x49')]);this[_0x3941('0x48')](_0x25c19f[_0x3941('0x49')]);}}catch(_0xc462bb){logger[_0x3941('0x3c')](_0x3941('0x4b'),_0xc462bb[_0x3941('0x3e')]);}};Acw['prototype'][_0x3941('0x11')]=function(_0xe65378){try{if(this[_0x3941('0xa')][_0xe65378['uniqueid']]&&this[_0x3941('0xa')][_0xe65378[_0x3941('0x1f')]][_0x3941('0x32')]){logger[_0x3941('0x21')](_0x3941('0x4c'),_0xe65378[_0x3941('0x1f')]);this[_0x3941('0x48')](_0xe65378[_0x3941('0x1f')]);}else if(this[_0x3941('0xa')][_0xe65378['linkedid']]&&this['channels'][_0xe65378[_0x3941('0x49')]][_0x3941('0x32')]){logger[_0x3941('0x21')](_0x3941('0x4d'),_0xe65378[_0x3941('0x49')]);this[_0x3941('0x48')](_0xe65378['linkedid']);}}catch(_0x92888f){logger[_0x3941('0x3c')](_0x3941('0x4e'),_0x92888f[_0x3941('0x3e')]);}};Acw[_0x3941('0x26')][_0x3941('0x4f')]=function(_0xcce2d1){try{if(!_[_0x3941('0x50')](this[_0x3941('0xa')][_0xcce2d1[_0x3941('0x51')]])){this[_0x3941('0x48')](_0xcce2d1[_0x3941('0x51')]);if(this[_0x3941('0xa')][_0xcce2d1[_0x3941('0x52')]]){this['channels'][_0xcce2d1[_0x3941('0x52')]][_0x3941('0x32')]=!![];this[_0x3941('0xa')][_0xcce2d1['transfertargetuniqueid']]=this['channels'][_0xcce2d1[_0x3941('0x52')]];delete this[_0x3941('0xa')][_0xcce2d1[_0x3941('0x52')]];}}else if(!_[_0x3941('0x50')](this[_0x3941('0xa')][_0xcce2d1[_0x3941('0x53')]])){this[_0x3941('0x48')](_0xcce2d1['transfertargetuniqueid']);if(this[_0x3941('0xa')][_0xcce2d1['origtransfereruniqueid']]){this[_0x3941('0xa')][_0xcce2d1[_0x3941('0x54')]]['attended']=!![];this[_0x3941('0xa')][_0xcce2d1[_0x3941('0x51')]]=this[_0x3941('0xa')][_0xcce2d1[_0x3941('0x54')]];delete this[_0x3941('0xa')][_0xcce2d1['origtransfereruniqueid']];}}}catch(_0x4e89e4){logger[_0x3941('0x3c')](_0x3941('0x55'),_0x4e89e4[_0x3941('0x3e')]);}};Acw['prototype'][_0x3941('0x16')]=function(_0x57a04f){try{if(this[_0x3941('0xa')][_0x57a04f[_0x3941('0x56')]]){logger[_0x3941('0x21')](_0x3941('0x57'),JSON[_0x3941('0x58')](_0x57a04f[_0x3941('0x56')]));this[_0x3941('0x48')](_0x57a04f[_0x3941('0x56')]);}else if(this[_0x3941('0xa')][_0x57a04f[_0x3941('0x59')]]){logger[_0x3941('0x21')](_0x3941('0x5a'),JSON['stringify'](_0x57a04f[_0x3941('0x59')]));this[_0x3941('0x48')](_0x57a04f[_0x3941('0x59')]);}}catch(_0x1760d8){logger[_0x3941('0x3c')]('[ACW][syncBlindTransfer]\x20%s',_0x1760d8['message']);}};Acw[_0x3941('0x26')]['syncAgentRingNoAnswer']=function(_0x3c860b){try{if(this['voiceQueues'][_0x3c860b['queue']]&&this[_0x3941('0x7')][_0x3c860b[_0x3941('0x3b')]]['autopause']===_0x3941('0x5b')){if(this[_0x3941('0x8')][_0x3c860b[_0x3941('0x27')]]){logger['info'](_0x3941('0x5c'),_0x3c860b[_0x3941('0x1f')],_0x3c860b[_0x3941('0x27')],_0x3c860b[_0x3941('0x3b')]);return RpcUser[_0x3941('0x34')](this[_0x3941('0x8')][_0x3c860b[_0x3941('0x27')]],_0x3941('0x5d'),_0x3c860b['uniqueid']);}}}catch(_0xe95d3b){logger[_0x3941('0x3c')](_0x3941('0x5e'),_0xe95d3b[_0x3941('0x3e')]);}};module[_0x3941('0x5f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ff1e02a..9037523 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 _0x18d4=['username','password','keepConnected','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipShowRegistry','[ami.js][fullybooted]','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk'];(function(_0x333448,_0x5df50a){var _0x5491c0=function(_0x46c4da){while(--_0x46c4da){_0x333448['push'](_0x333448['shift']());}};_0x5491c0(++_0x5df50a);}(_0x18d4,0x186));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require(_0x418d('0x0'));var BPromise=require(_0x418d('0x1'));var util=require(_0x418d('0x2'));var logger=require(_0x418d('0x3'))('ami');var config=require(_0x418d('0x4'));var ami=new Manager(config[_0x418d('0x5')]['port'],config[_0x418d('0x5')]['ip'],config[_0x418d('0x5')][_0x418d('0x6')],config[_0x418d('0x5')][_0x418d('0x7')],!![]);ami[_0x418d('0x8')]();ami['Action']=BPromise['promisify'](ami[_0x418d('0x9')]);function error(_0x11fb9e){logger[_0x418d('0xa')](util[_0x418d('0xb')](_0x418d('0xc'),config['asterisk']['username'],config[_0x418d('0x5')]['ip'],config['asterisk'][_0x418d('0xd')],util[_0x418d('0xe')](_0x11fb9e,![],null)));}function close(){logger['error'](util[_0x418d('0xb')](_0x418d('0xf'),config['asterisk'][_0x418d('0x6')],config[_0x418d('0x5')]['ip'],config[_0x418d('0x5')][_0x418d('0xd')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x418d('0x10')]({'action':_0x418d('0x11')});};};ami[_0x418d('0x12')]=function(){return function(){return ami[_0x418d('0x10')]({'action':'devicestatelist'});};};ami[_0x418d('0x13')]=function(){return function(){return ami[_0x418d('0x10')]({'action':_0x418d('0x14')});};};ami[_0x418d('0x15')]=function(){return function(){return ami[_0x418d('0x10')]({'action':_0x418d('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x418d('0x10')]({'action':_0x418d('0x17')});};};function connect(){logger[_0x418d('0x18')](util[_0x418d('0xb')](_0x418d('0x19'),config['asterisk'][_0x418d('0x6')],config[_0x418d('0x5')]['ip'],config[_0x418d('0x5')][_0x418d('0xd')]));ami[_0x418d('0x1a')](_0x418d('0xa'),error);ami['once'](_0x418d('0x1b'),close);}ami['on'](_0x418d('0x1c'),connect);ami['on'](_0x418d('0x1d'),function(_0x57a6dc){logger[_0x418d('0x18')](util['format'](_0x418d('0x1e'),config[_0x418d('0x5')][_0x418d('0x6')],config['asterisk']['ip'],config[_0x418d('0x5')][_0x418d('0xd')],util[_0x418d('0xe')](_0x57a6dc,![],null)));});ami['on'](_0x418d('0x1f'),function(){logger[_0x418d('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x418d('0x5')][_0x418d('0x6')],config[_0x418d('0x5')]['ip'],config[_0x418d('0x5')][_0x418d('0xd')]));return Promise[_0x418d('0x20')]()[_0x418d('0x21')](ami[_0x418d('0x22')]())[_0x418d('0x21')](ami[_0x418d('0x12')]())[_0x418d('0x21')](ami[_0x418d('0x13')]())[_0x418d('0x21')](ami[_0x418d('0x15')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x5e7147){logger[_0x418d('0xa')](_0x418d('0x23'),util[_0x418d('0xe')](_0x5e7147,{'showHidden':![],'depth':null}));});});ami[_0x418d('0x1a')](_0x418d('0xa'),error);ami[_0x418d('0x1a')]('close',close);module['exports']=ami; \ No newline at end of file +var _0x6982=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','port','asterisk','password','keepConnected','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown'];(function(_0x277c36,_0x3941f4){var _0x387e23=function(_0x4fee4c){while(--_0x4fee4c){_0x277c36['push'](_0x277c36['shift']());}};_0x387e23(++_0x3941f4);}(_0x6982,0xd0));var _0x2698=function(_0x3b7e87,_0x27a7c5){_0x3b7e87=_0x3b7e87-0x0;var _0x1cb114=_0x6982[_0x3b7e87];return _0x1cb114;};'use strict';var Manager=require(_0x2698('0x0'));var BPromise=require(_0x2698('0x1'));var util=require(_0x2698('0x2'));var logger=require(_0x2698('0x3'))(_0x2698('0x4'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x2698('0x5')],config[_0x2698('0x6')]['ip'],config[_0x2698('0x6')]['username'],config[_0x2698('0x6')][_0x2698('0x7')],!![]);ami[_0x2698('0x8')]();ami['Action']=BPromise[_0x2698('0x9')](ami[_0x2698('0xa')]);function error(_0x1834a5){logger[_0x2698('0xb')](util['format'](_0x2698('0xc'),config['asterisk'][_0x2698('0xd')],config[_0x2698('0x6')]['ip'],config[_0x2698('0x6')][_0x2698('0x5')],util[_0x2698('0xe')](_0x1834a5,![],null)));}function close(){logger[_0x2698('0xb')](util['format'](_0x2698('0xf'),config['asterisk'][_0x2698('0xd')],config[_0x2698('0x6')]['ip'],config[_0x2698('0x6')][_0x2698('0x5')]));}ami[_0x2698('0x10')]=function(){return function(){return ami[_0x2698('0x11')]({'action':_0x2698('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x2698('0x13')]=function(){return function(){return ami[_0x2698('0x11')]({'action':_0x2698('0x14')});};};ami[_0x2698('0x15')]=function(){return function(){return ami[_0x2698('0x11')]({'action':_0x2698('0x16')});};};ami[_0x2698('0x17')]=function(){return function(){return ami[_0x2698('0x11')]({'action':_0x2698('0x18')});};};function connect(){logger[_0x2698('0x19')](util[_0x2698('0x1a')](_0x2698('0x1b'),config[_0x2698('0x6')][_0x2698('0xd')],config[_0x2698('0x6')]['ip'],config['asterisk'][_0x2698('0x5')]));ami['once']('error',error);ami[_0x2698('0x1c')](_0x2698('0x1d'),close);}ami['on'](_0x2698('0x1e'),connect);ami['on'](_0x2698('0x1f'),function(_0x4f139d){logger[_0x2698('0x19')](util[_0x2698('0x1a')](_0x2698('0x20'),config[_0x2698('0x6')][_0x2698('0xd')],config[_0x2698('0x6')]['ip'],config[_0x2698('0x6')][_0x2698('0x5')],util[_0x2698('0xe')](_0x4f139d,![],null)));});ami['on'](_0x2698('0x21'),function(){logger[_0x2698('0x19')](util[_0x2698('0x1a')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x2698('0xd')],config[_0x2698('0x6')]['ip'],config[_0x2698('0x6')][_0x2698('0x5')]));return Promise[_0x2698('0x22')]()[_0x2698('0x23')](ami[_0x2698('0x10')]())[_0x2698('0x23')](ami[_0x2698('0x24')]())[_0x2698('0x23')](ami[_0x2698('0x13')]())['then'](ami[_0x2698('0x15')]())['then'](ami[_0x2698('0x17')]())[_0x2698('0x25')](function(_0xd2e0d1){logger[_0x2698('0xb')](_0x2698('0x26'),util[_0x2698('0xe')](_0xd2e0d1,{'showHidden':![],'depth':null}));});});ami[_0x2698('0x1c')]('error',error);ami[_0x2698('0x1c')](_0x2698('0x1d'),close);module[_0x2698('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 43fcc05..ff01bba 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0xe706,0xa3));var _0x6e70=function(_0x9fdd53,_0xd7b5c0){_0x9fdd53=_0x9fdd53-0x0;var _0x4ed380=_0xe706[_0x9fdd53];return _0x4ed380;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x59f0ff,_0x2b9d67){var _0x28e782=function(_0x437e09){while(--_0x437e09){_0x59f0ff['push'](_0x59f0ff['shift']());}};_0x28e782(++_0x2b9d67);}(_0xf4eb,0xec));var _0xbf4e=function(_0xda49cb,_0x168ed5){_0xda49cb=_0xda49cb-0x0;var _0x239a7a=_0xf4eb[_0xda49cb];return _0x239a7a;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 4294ff3..74a322b 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 _0xf790=['dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','dialBusyRetryFrequency','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','loggedIn','[CatchErlangB]','check\x20failure','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','scheduledat','dialRecallMeTimeout','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','checkContactEmpty','[getContactCampaign2][Empty]','Contact','emptyContact','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','RUNNING','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\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','startProgressive','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','Error','prototype','isTrunkReachable','active','format','SIP/%s','status','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Intervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','content','indexOf','true','catch','iftime\x20%s,%s','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','predictive','power','handlePower','dialPowerLevel','Voice\x20Queue\x20%s\x20$s','\x20Interval\x20is\x20overtime:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','moveContactManagedDialer','getSeconds','responsetime','dialQueueTimeout','statedesc','Drop','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','add','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','countabandonedretry','minutes','ContactId','[rescheduleContact][Abandoned]','createHistory','[syncAgentComplete][createHistory][11]','actions','channel','actionid','isNil','paused','stateinterface','locked','merge','idHopper','strategy','rrmemory','roundrobin','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','getQueue','response','Success','callProgressDetecting','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HangupInAMD','AMD','emit','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','outboundAnswerAgiCallsDay','Machine','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','HANGUP','[syncHangupInAMDIvr]','MACHINE','membername','countbusyretry','reason\x2019\x20machine....','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','[syncAgentComplete][createHistory]','[syncAgentComplete]','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','pTalking','ACTIVE','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','launchHandleIvr','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDGREETING'];(function(_0xb75d1d,_0x451a91){var _0x160258=function(_0x1fbafd){while(--_0x1fbafd){_0xb75d1d['push'](_0xb75d1d['shift']());}};_0x160258(++_0x451a91);}(_0xf790,0xb6));var _0x0f79=function(_0x3e0076,_0x1e2785){_0x3e0076=_0x3e0076-0x0;var _0x59b46f=_0xf790[_0x3e0076];return _0x59b46f;};'use strict';var util=require(_0x0f79('0x0'));var _=require('lodash');var uuid=require(_0x0f79('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x0f79('0x2'));var utils=require(_0x0f79('0x3'));var hopperUtils=require(_0x0f79('0x4'));var ut=require(_0x0f79('0x5'));var config=require(_0x0f79('0x6'));var logger=require(_0x0f79('0x7'))('dialer');var loggerBooked=require(_0x0f79('0x7'))(_0x0f79('0x8'));var loggerPredictive=require(_0x0f79('0x7'))('predictive');var loggerPredictiveCalls=require(_0x0f79('0x7'))(_0x0f79('0x9'));var loggerSyncQueueSummary=require(_0x0f79('0x7'))(_0x0f79('0xa'));var ami=require('../ami');config[_0x0f79('0xb')]=_['defaults'](config[_0x0f79('0xb')],{'host':_0x0f79('0xc'),'port':0x18eb});var io=require(_0x0f79('0xd'))(new Redis(config[_0x0f79('0xb')]));var cmHopper=require(_0x0f79('0xe'));var voiceQueueRt=require(_0x0f79('0xf'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x0f79('0x10'));var Action=require(_0x0f79('0x11'));var History=require(_0x0f79('0x12'));var Final=require(_0x0f79('0x13'));var AgentComplete=require(_0x0f79('0x14'));var QueueCallerAbandon=require(_0x0f79('0x15'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x0f79('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x0f79('0x17')]=function(_0x48be3c){this[_0x0f79('0x18')]=this[_0x0f79('0x18')]?this[_0x0f79('0x18')][_0x0f79('0x19')](_0x48be3c):_0x48be3c();};function Dialer(_0x5e7809,_0x39f7d1){this[_0x0f79('0x1a')]=new Sequence();this[_0x0f79('0x1b')]=_0x39f7d1;this['voiceQueues']=_0x5e7809[_0x0f79('0x1c')];this['campaigns']=_0x5e7809[_0x0f79('0x1d')];this[_0x0f79('0x1e')]=_0x5e7809['agents'];this[_0x0f79('0x1f')]=_0x5e7809[_0x0f79('0x1f')];this[_0x0f79('0x20')]=config['maxNumberOriginate']||0x2;this[_0x0f79('0x21')]={};this['actions']={};this['contactsId']={};this[_0x0f79('0x22')]={};this[_0x0f79('0x23')]={};this[_0x0f79('0x24')]={};this['startProgressive']={};this[_0x0f79('0x25')]={};this[_0x0f79('0x26')]={};this['queueBookedRR']={};this[_0x0f79('0x27')]={};ami['on'](_0x0f79('0x28'),this[_0x0f79('0x29')][_0x0f79('0x2a')](this));ami['on']('queuecallerabandon',this[_0x0f79('0x2b')]['bind'](this));ami['on'](_0x0f79('0x2c'),this[_0x0f79('0x2d')]['bind'](this));ami['on'](_0x0f79('0x2e'),this[_0x0f79('0x2f')][_0x0f79('0x2a')](this));ami['on']('custom:queuesummary',this[_0x0f79('0xa')][_0x0f79('0x2a')](this));ami['on']('custom:queuesummarycomplete',this[_0x0f79('0x30')][_0x0f79('0x2a')](this));ami['on'](_0x0f79('0x31'),this[_0x0f79('0x32')][_0x0f79('0x2a')](this));ami['on'](_0x0f79('0x33'),this[_0x0f79('0x34')]['bind'](this));ami['on'](_0x0f79('0x35'),this['syncVarSet'][_0x0f79('0x2a')](this));ami['on'](_0x0f79('0x36'),this['syncQueueMember']['bind'](this));ami['on']('queuestatuscomplete',this[_0x0f79('0x37')][_0x0f79('0x2a')](this));this[_0x0f79('0x38')]();this[_0x0f79('0x39')]();RpcSetting[_0x0f79('0x3a')]()[_0x0f79('0x3b')](function(_0x5374d6){previewRecallmeReminderInterval=_0x5374d6['previewRecallmeReminderInterval'];});}function isNotNull(_0xaa1afc){return _0xaa1afc!==null&&!_[_0x0f79('0x3c')](_0xaa1afc);}function msgResponse(_0x5c1695,_0x3cb769,_0x824003){return{'action':_0x5c1695,'response':_0x3cb769,'message':_0x824003,'stack':_0x824003};}function emit(_0x4682a7,_0x1db73e,_0x2d980b){io['to'](_0x4682a7)['emit'](_0x1db73e,_0x2d980b);}function emitOutboundVoiceQueueSummary(_0x58e248){if(_0x58e248['type']===_0x0f79('0x3d')){logger[_0x0f79('0x3e')](_0x0f79('0x3f'),util[_0x0f79('0x40')](_0x58e248,{'showHidden':![],'depth':null}));emit(util['format'](_0x0f79('0x41'),_0x58e248[_0x0f79('0x42')]),_0x0f79('0x43'),_0x58e248);}}function checkGetDataPredictive(_0xa5115){if(isNotNull(_0xa5115)&&!_[_0x0f79('0x44')](_0xa5115)){loggerPredictive['info'](_0x0f79('0x45'));loggerPredictive[_0x0f79('0x46')](_0x0f79('0x47'),_0xa5115[_0x0f79('0x48')]);loggerPredictive['info'](_0x0f79('0x49'),_0xa5115[_0x0f79('0x4a')]);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x4b'),_0xa5115[_0x0f79('0x4c')]);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x4d'),_0xa5115[_0x0f79('0x4e')]);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x4f'),_0xa5115['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x0f79('0x50'),_0xa5115[_0x0f79('0x51')]);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x52'));if(_0xa5115['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0xa5115[_0x0f79('0x51')])&&_0xa5115[_0x0f79('0x51')]>0x0){return!![];}loggerPredictive[_0x0f79('0x46')](_0x0f79('0x53'));if(!_[_0x0f79('0x3c')](_0xa5115[_0x0f79('0x54')])&&_0xa5115[_0x0f79('0x54')]>0x0){return!![];}loggerPredictive[_0x0f79('0x46')](_0x0f79('0x55'));}else{loggerPredictive['info'](_0x0f79('0x56'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5096cc){return function(_0x375daa){loggerPredictive[_0x0f79('0x46')](_0x0f79('0x57'));loggerPredictive[_0x0f79('0x46')](_0x0f79('0x58'),_0x375daa['erlangCalls']);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x375daa[_0x0f79('0x59')]);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x5a'),_0x375daa[_0x0f79('0x5b')]);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x5c'),_0x375daa[_0x0f79('0x5d')]);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x5a'),_0x375daa[_0x0f79('0x5b')]);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x52'));_['merge'](_0x5096cc,_0x375daa);};}function ifInterval(_0x3bf863,_0x39342d){if(_[_0x0f79('0x3c')](_0x39342d)){return![];}return utils['getSeconds'](undefined,_0x39342d)<_0x3bf863*0x3c;}function clearPredictiveAttributes(_0x109b59){if(_0x109b59[_0x0f79('0x5e')]){_0x109b59[_0x0f79('0x5e')]=undefined;loggerPredictive[_0x0f79('0x3e')](_0x109b59[_0x0f79('0x42')],'startProgressive\x20value\x20cleared');}if(_0x109b59[_0x0f79('0x24')]){_0x109b59[_0x0f79('0x24')]=undefined;loggerPredictive['debug'](_0x109b59[_0x0f79('0x42')],'startPredictive\x20value\x20cleared');}if(_0x109b59['handlePredictive']){clearInterval(_0x109b59['handlePredictive']);_0x109b59[_0x0f79('0x5f')]=undefined;loggerPredictive[_0x0f79('0x3e')](_0x109b59['name'],_0x0f79('0x60'));}}function loggerCatchPredictive(_0x22d1e8,_0x51d426){return function(_0x3e58aa){loggerPredictive[_0x0f79('0x61')](_0x51d426[_0x0f79('0x42')],_0x22d1e8);loggerPredictive[_0x0f79('0x61')](_0x3e58aa[_0x0f79('0x62')]);clearPredictiveAttributes(_0x51d426);};}function loggerCatch(_0x1f8af3){return function(_0x5093b4){logger[_0x0f79('0x61')](_0x1f8af3,util[_0x0f79('0x40')](_0x5093b4,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4fbb11,_0x2e5b9d,_0xd23c53){return function(_0x566c19){utils[_0x0f79('0x63')](_0x2e5b9d,_0xd23c53,0x0);_0x2e5b9d[_0x0f79('0x64')]=0x0;logger['error'](_0x4fbb11,util[_0x0f79('0x40')](_0x566c19,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xe2d7c6){return function(_0x269826){if(isNotNull(_0x269826)&&isNotNull(_0x269826[0x0])){if(_0x269826[0x0][_0x0f79('0x65')]>0x0){_0xe2d7c6[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x68')];logger[_0x0f79('0x46')]('[getContactDialer2][ReScheduled]'+_0xe2d7c6[_0x0f79('0x42')],_0x269826[0x0][_0x0f79('0x65')],_0x0f79('0x69'));}else{_0xe2d7c6['message']=utils[_0x0f79('0x67')][_0x0f79('0x6a')];logger[_0x0f79('0x46')](_0x0f79('0x6b')+_0xe2d7c6['name']);}}};}function createObjHistory(_0x2f5550,_0x596706,_0x54115b,_0x2b7620,_0x4f3cb3){_0x2f5550[_0x0f79('0x66')]=_0x54115b;var _0x3088f1=new Action(_0x2f5550,_0x596706);var _0x161afa=new History(_0x3088f1);_0x161afa[_0x0f79('0x6c')]=_0x2b7620;_0x161afa['statedesc']=_0x4f3cb3;_0x161afa['endtime']=_0x3088f1['starttime'];return _0x161afa;}function unlockQueueStatus(_0x4ea740,_0x45342b){setTimeout(function(){if(_['isUndefined'](_0x4ea740[_0x0f79('0x6d')])){loggerBooked[_0x0f79('0x61')](_0x0f79('0x6e'),_0x45342b);}_0x4ea740[_0x0f79('0x6d')]=!![];loggerBooked['info'](_0x0f79('0x6f'),_0x45342b,JSON[_0x0f79('0x70')](_[_0x0f79('0x71')](_0x4ea740,[_0x0f79('0x42'),_0x0f79('0x6d')])));},0x1f3);}function checkInterval(_0x310861){return function(){if(!isNotNull(_0x310861[_0x0f79('0x72')])){_0x310861[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x73')];throw _0x310861[_0x0f79('0x42')]+_0x0f79('0x74');}if(!isNotNull(_0x310861[_0x0f79('0x72')]['Intervals'])){_0x310861[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x73')];throw _0x310861['name']+_0x0f79('0x74');}if(!isNotNull(_[_0x0f79('0x44')](_0x310861[_0x0f79('0x72')]['Intervals']))){_0x310861[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x73')];throw _0x310861[_0x0f79('0x42')]+_0x0f79('0x74');}};}function checkIsIVRCampaignActive(_0xcd3bfc){return function(){if(!utils[_0x0f79('0x75')](_0xcd3bfc)){_0xcd3bfc[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x76')];throw _0xcd3bfc['name']+_0x0f79('0x77');}};}function emitCampaignSummary(_0x3e1de2){if(utils[_0x0f79('0x78')](_0x3e1de2)){emit(util['format'](_0x0f79('0x79'),_0x3e1de2[_0x0f79('0x42')]),'campaign:save',_0x3e1de2);}}function loggerCatchQueueSummary(_0x41fa8d,_0x4070cf){return function(_0x421fd8){clearPredictiveAttributes(_0x4070cf);emitCampaignSummary(_0x4070cf);loggerSyncQueueSummary['debug'](_0x41fa8d,util[_0x0f79('0x40')](_0x421fd8,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1d522e){if(_0x1d522e[_0x0f79('0x7a')]){if(_0x1d522e['originated']===0x0){_0x1d522e[_0x0f79('0x7a')]=![];_0x1d522e[_0x0f79('0x66')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0x0f79('0x3e')](_0x0f79('0x7b'),_0x1d522e[_0x0f79('0x42')],_0x0f79('0x7c'));}else{_0x1d522e[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x7d')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1d522e[_0x0f79('0x42')],'is\x20disactive');}emitCampaignSummary(_0x1d522e);}}function myreject(_0x106ca2){return function(_0x369804){return _0x106ca2(msgResponse('[ifTime][Action]',_0x0f79('0x7e'),JSON[_0x0f79('0x70')](_0x369804)));};}Dialer[_0x0f79('0x7f')][_0x0f79('0x80')]=function(_0x106160){return!_[_0x0f79('0x3c')](_0x106160)&&_0x106160&&!_[_0x0f79('0x3c')](_0x106160['name'])&&!_[_0x0f79('0x3c')](_0x106160[_0x0f79('0x81')])&&_0x106160[_0x0f79('0x81')]&&(this[_0x0f79('0x1f')][util[_0x0f79('0x82')](_0x0f79('0x83'),_0x106160[_0x0f79('0x42')])][_0x0f79('0x84')]==='reachable'||this[_0x0f79('0x1f')][util[_0x0f79('0x82')](_0x0f79('0x83'),_0x106160['name'])]['status']==='unmonitored');};Dialer[_0x0f79('0x7f')]['checkIsTrunkReachable']=function(_0x541cce){var _0x303e2b=this;return function(){if(!_0x303e2b['isTrunkReachable'](_0x541cce[_0x0f79('0x85')])){if(!_0x303e2b[_0x0f79('0x80')](_0x541cce[_0x0f79('0x86')])){_0x541cce['message']=utils[_0x0f79('0x67')]['TRUNK_NOT_REACHABLE'];throw _0x541cce[_0x0f79('0x42')]+_0x0f79('0x87');}}};};Dialer[_0x0f79('0x7f')][_0x0f79('0x88')]=function(_0xb6961e,_0x51da61,_0x30e910,_0x44c614){var _0x53163a=this;return function(){var _0x3d39b7=!![];return _0x53163a[_0x0f79('0x89')](_0xb6961e,_0x51da61,_0x30e910,_0x44c614,_0x3d39b7);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x646ace,_0x14bb31,_0x319068,_0x5f04b1){var _0x84d6c3=this;return function(){var _0x229b18=![];return _0x84d6c3[_0x0f79('0x89')](_0x646ace[_0x0f79('0x8a')],_0x14bb31,_0x319068,_0x5f04b1,_0x229b18);};};Dialer[_0x0f79('0x7f')][_0x0f79('0x89')]=function(_0x2914bf,_0x5a3141,_0x92e51d,_0x31f557,_0x3163c5){var _0x4fb10a=[];return new Promise(function(_0x36ec1b,_0x4f4d77){if(!isNotNull(_0x2914bf)){_0x31f557[_0x0f79('0x66')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x4f4d77(msgResponse(_0x0f79('0x8b'),_0x0f79('0x8c'),_0x92e51d+_0x0f79('0x8d')));}if(_[_0x0f79('0x44')](_0x2914bf)){_0x31f557[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x8e')];return _0x4f4d77(msgResponse(_0x0f79('0x8b'),_0x0f79('0x8c'),_0x92e51d+'\x20Intervals\x20is\x20empty\x20'));}if(_0x5a3141&&_[_0x0f79('0x3c')](config[_0x0f79('0x8f')][_0x5a3141])){_0x31f557['message']=utils['CAMPAIGN_STATUS'][_0x0f79('0x90')];return _0x4f4d77(msgResponse('ifTime',_0x0f79('0x8c'),_0x92e51d+_0x0f79('0x91')+_0x5a3141));}if(_[_0x0f79('0x92')](_0x2914bf)){for(var _0x53a4df=0x0;_0x53a4df<_0x2914bf[_0x0f79('0x93')];_0x53a4df+=0x1){_0x4fb10a[_0x0f79('0x94')](ami[_0x0f79('0x95')]({'action':_0x0f79('0x96'),'command':util[_0x0f79('0x82')]('iftime\x20%s,%s',_0x2914bf[_0x53a4df][_0x0f79('0x97')],!_[_0x0f79('0x3c')](config[_0x0f79('0x8f')][_0x5a3141])?_0x5a3141:'')})[_0x0f79('0x3b')](function(_0x13cc6b){return _0x13cc6b[_0x0f79('0x98')][_0x0f79('0x99')](_0x0f79('0x9a'))>=0x0;})[_0x0f79('0x9b')](myreject(_0x4f4d77)));}}else{_0x4fb10a[_0x0f79('0x94')](ami['Action']({'action':'command','command':util[_0x0f79('0x82')](_0x0f79('0x9c'),_0x2914bf,!_[_0x0f79('0x3c')](config[_0x0f79('0x8f')][_0x5a3141])?_0x5a3141:'')})[_0x0f79('0x3b')](function(_0x445069){return _0x445069[_0x0f79('0x98')]['indexOf'](_0x0f79('0x9a'))>=0x0;})[_0x0f79('0x9b')](myreject(_0x4f4d77)));}Promise['all'](_0x4fb10a)[_0x0f79('0x3b')](function(_0x264db2){var _0x5ad813=_[_0x0f79('0x9d')](_0x264db2);if(_0x5ad813){return _0x36ec1b(_0x5ad813);}else{_0x31f557['message']=_0x3163c5?utils[_0x0f79('0x67')][_0x0f79('0x9e')]:utils[_0x0f79('0x67')][_0x0f79('0x9f')];return _0x4f4d77(msgResponse(_0x0f79('0xa0'),_0x0f79('0x8c'),'Global:\x20'+_0x3163c5+'\x20'+_0x92e51d+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0f79('0x40')](_0x2914bf,{'showHidden':![],'depth':null})+_0x0f79('0xa1')+_0x5a3141));}})[_0x0f79('0x9b')](function(_0xc840c6){return _0x4f4d77(msgResponse('ifTime',_0x0f79('0x8c'),JSON[_0x0f79('0x70')](_0xc840c6)));});});};Dialer[_0x0f79('0x7f')][_0x0f79('0x38')]=function(){var _0x425078=this;return cmHopper[_0x0f79('0xa2')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x425078[_0x0f79('0xa3')]();},0x3e8);});};Dialer['prototype'][_0x0f79('0xa3')]=function(){var _0x456566=this;var _0x20ceb0;for(var _0x44b1fd in this['campaigns']){if(typeof this[_0x0f79('0x1d')][_0x44b1fd]!=='undefined'){_0x20ceb0=this[_0x0f79('0x1d')][_0x44b1fd];if(utils[_0x0f79('0x78')](_0x20ceb0)&&utils[_0x0f79('0x75')](_0x20ceb0)){_0x20ceb0['sendMessageOneNotActive']=!![];Promise['resolve']()[_0x0f79('0x3b')](checkIsIVRCampaignActive(_0x20ceb0))[_0x0f79('0x3b')](checkInterval(_0x20ceb0))[_0x0f79('0x3b')](_0x456566[_0x0f79('0xa4')](_0x20ceb0))[_0x0f79('0x3b')](_0x456566[_0x0f79('0x88')](_0x20ceb0[_0x0f79('0xa5')],_0x20ceb0[_0x0f79('0xa6')],_0x20ceb0['name'],_0x20ceb0))[_0x0f79('0x3b')](_0x456566['checkIfTimeIntervals'](_0x20ceb0[_0x0f79('0x72')],_0x20ceb0[_0x0f79('0xa6')],_0x20ceb0['name'],_0x20ceb0))[_0x0f79('0x3b')](_0x456566['launchHandleIvr'](_0x20ceb0))[_0x0f79('0x9b')](loggerCatchQueueSummary(_0x0f79('0xa7'),_0x20ceb0));}else{notSendMessagesCampaign(_0x20ceb0);}}}};Dialer[_0x0f79('0x7f')][_0x0f79('0xa8')]=function(_0x410351){if(_0x410351[_0x0f79('0xa9')]!==_0x0f79('0xaa')){clearPredictiveAttributes(_0x410351);}switch(_0x410351[_0x0f79('0xa9')]){case'progressive':this['handlePower'](_0x410351,0x1);break;case _0x0f79('0xab'):this[_0x0f79('0xac')](_0x410351,_0x410351[_0x0f79('0xad')]);break;case _0x0f79('0xaa'):this[_0x0f79('0xaa')](_0x410351);break;case _0x0f79('0x8'):this[_0x0f79('0xac')](_0x410351,0x1);break;default:logger['error']('Queue',_0x410351[_0x0f79('0x42')],'method\x20not\x20recognized');}};Dialer[_0x0f79('0x7f')][_0x0f79('0x8b')]=function(_0x55bc75,_0x2f7340){var _0xfc3b22=_0x55bc75[_0x0f79('0xa6')];var _0x34dea4=_0x2f7340?_0x55bc75['dialGlobalInterval']:_0x55bc75[_0x0f79('0x72')][_0x0f79('0x8a')];logger['silly']('Dialer::ifTime()',_0x34dea4,_0xfc3b22,_0x55bc75[_0x0f79('0x42')],util[_0x0f79('0x82')](_0x0f79('0xae'),_0x55bc75[_0x0f79('0x42')],_0x55bc75['id']));var _0x1fbefd=null;return Interval['intervalIftime'](_0x34dea4,_0xfc3b22)[_0x0f79('0x3b')](function(_0x512b2f){if(_0x512b2f===!![]){return _0x512b2f;}else{_0x55bc75['message']=_0x2f7340?utils[_0x0f79('0x67')][_0x0f79('0x9e')]:utils[_0x0f79('0x67')][_0x0f79('0x9f')];_0x1fbefd=msgResponse('[ifTime][promiseAll]',_0x0f79('0x8c'),'Global:\x20'+_0x2f7340+'\x20'+_0x55bc75[_0x0f79('0x42')]+_0x0f79('0xaf')+util[_0x0f79('0x40')](_0x34dea4,{'showHidden':![],'depth':null})+_0x0f79('0xa1')+_0xfc3b22);}if(_0x1fbefd!==null){logger[_0x0f79('0xb0')](_0x0f79('0xb1'),_0x1fbefd);_0x1fbefd[_0x0f79('0xb2')]=_0x2f7340;throw _0x1fbefd;}})[_0x0f79('0x9b')](function(_0x3c4fbd){logger['error'](_0x0f79('0xb3'),_0x3c4fbd);throw msgResponse(_0x0f79('0xb4'),_0x0f79('0x7e'),util[_0x0f79('0x40')](_0x3c4fbd,{'showHidden':![],'depth':null}));});};Dialer[_0x0f79('0x7f')][_0x0f79('0x29')]=function(_0x4a3567){if(this[_0x0f79('0x1c')][_0x4a3567[_0x0f79('0xb5')]]){if(this[_0x0f79('0x22')][_0x4a3567[_0x0f79('0xb6')]]&&this[_0x0f79('0x22')][_0x4a3567['uniqueid']][_0x0f79('0xb7')]!==_0x0f79('0xb8')){this[_0x0f79('0xb9')](this[_0x0f79('0x1c')][_0x4a3567[_0x0f79('0xb5')]]);this[_0x0f79('0x22')][_0x4a3567[_0x0f79('0xb6')]][_0x0f79('0xba')]=moment()[_0x0f79('0x82')](_0x0f79('0xbb'));}}};Dialer['prototype']['syncAgentComplete']=function(_0x20d07d){var _0x57847f=this[_0x0f79('0x22')][_0x20d07d[_0x0f79('0xb6')]];if(this[_0x0f79('0x1c')][_0x20d07d[_0x0f79('0xb5')]]){if(_0x57847f&&_0x57847f[_0x0f79('0xb7')]!==_0x0f79('0xb8')){delete this[_0x0f79('0x22')][_0x20d07d[_0x0f79('0xb6')]];this['voiceQueues'][_0x20d07d[_0x0f79('0xb5')]][_0x0f79('0xbc')]+=0x1;var _0x3632da=new AgentComplete(_0x57847f,_0x20d07d);if(_0x20d07d[_0x0f79('0xbd')]===_0x0f79('0xbe')){_0x3632da[_0x0f79('0xbf')]=this['voiceQueues'][_0x20d07d[_0x0f79('0xb5')]][_0x0f79('0xc0')]&&this[_0x0f79('0x1c')][_0x20d07d['queue']][_0x0f79('0xc1')]?moment()[_0x0f79('0x82')](_0x0f79('0xbb')):undefined;}hopperUtils['createHistory'](_0x3632da)[_0x0f79('0x9b')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x0f79('0xc2')](_0x3632da)[_0x0f79('0x9b')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x0f79('0x7f')][_0x0f79('0x2b')]=function(_0x3295e9){var _0x238880=this[_0x0f79('0x22')][_0x3295e9[_0x0f79('0xb6')]];var _0x3c6d1b=this;var _0x336ba3=![];var _0x64b951;var _0x2337ba;if(this[_0x0f79('0x1c')][_0x3295e9[_0x0f79('0xb5')]]){if(_0x238880&&_0x238880[_0x0f79('0xb7')]!=='ivr'){delete this['uniqueId'][_0x3295e9[_0x0f79('0xb6')]];this[_0x0f79('0xb9')](this['voiceQueues'][_0x3295e9['queue']]);_0x238880['droptime']=moment()[_0x0f79('0x82')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2ab403=new QueueCallerAbandon(_0x238880,_0x3295e9);if(utils[_0x0f79('0xc3')](_0x238880['droptime'],_0x238880[_0x0f79('0xc4')])>=_0x238880[_0x0f79('0xc5')]){this[_0x0f79('0x1c')][_0x3295e9['queue']][_0x0f79('0x4c')]+=0x1;this[_0x0f79('0x1c')][_0x3295e9[_0x0f79('0xb5')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x3295e9[_0x0f79('0xb5')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2ab403[_0x0f79('0x6c')]=0xa;_0x2ab403[_0x0f79('0xc6')]=_0x0f79('0xc7');_0x2ab403[_0x0f79('0xc8')]='TIMEOUT';_0x2ab403[_0x0f79('0xbf')]=this[_0x0f79('0x1c')][_0x3295e9[_0x0f79('0xb5')]]['dialQueueProject2']?moment()[_0x0f79('0x82')](_0x0f79('0xbb')):undefined;_0x2ab403[_0x0f79('0xc9')]+=0x1;_0x2ab403[_0x0f79('0xca')]+=0x1;_0x64b951=this[_0x0f79('0x1c')][_0x3295e9[_0x0f79('0xb5')]][_0x0f79('0xcb')];_0x2337ba=this['voiceQueues'][_0x3295e9[_0x0f79('0xb5')]][_0x0f79('0xcc')];hopperUtils[_0x0f79('0xcd')](_0x2ab403,_0x2ab403[_0x0f79('0x6c')],_0x238880[_0x0f79('0xce')])['then'](function(_0x14dd1a){_0x336ba3=_0x14dd1a[_0x0f79('0xcf')]==0x1;if(_0x2ab403[_0x0f79('0xc9')]>=_0x3c6d1b[_0x0f79('0x1c')][_0x3295e9[_0x0f79('0xb5')]][_0x0f79('0xd0')]){_0x3c6d1b['queueCallerAbandonCreateState'](_0x2ab403,_0x14dd1a[_0x0f79('0xcf')]);}else{hopperUtils[_0x0f79('0xd1')]({'active':![],'countdropretry':_0x2ab403[_0x0f79('0xc9')],'scheduledat':moment()[_0x0f79('0xd2')](_0x3c6d1b[_0x0f79('0x1c')][_0x3295e9['queue']]['dialDropRetryFrequency'],'minutes')['format'](_0x0f79('0xbb')),'ContactId':_0x238880['ContactId'],'ListId':_0x238880[_0x0f79('0xd3')],'VoiceQueueId':_0x238880[_0x0f79('0xd4')]||undefined,'CampaignId':_0x238880[_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch(_0x0f79('0xd6')));var _0x1ceb42=new History(_0x2ab403);_0x1ceb42[_0x0f79('0x6c')]=0xa;_0x1ceb42[_0x0f79('0xc6')]=_0x0f79('0xc7');_0x1ceb42[_0x0f79('0xd7')]=moment()[_0x0f79('0x82')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ceb42[_0x0f79('0xd8')]=_0x1ceb42[_0x0f79('0xd7')];_0x1ceb42['calleridname']=_0x2ab403[_0x0f79('0xd9')];_0x1ceb42[_0x0f79('0xda')]=_0x2ab403['calleridnum'];hopperUtils['createHistory'](_0x1ceb42)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0xdb')));}})[_0x0f79('0x3b')](function(){if(_0x336ba3)hopperUtils[_0x0f79('0xdc')](_0x2ab403,_0x64b951,_0x2337ba)[_0x0f79('0x3b')](function(){return 0x1;});});}else{this['voiceQueues'][_0x3295e9[_0x0f79('0xb5')]][_0x0f79('0x4e')]+=0x1;this[_0x0f79('0x1c')][_0x3295e9[_0x0f79('0xb5')]][_0x0f79('0xdd')]+=0x1;_0x2ab403[_0x0f79('0x6c')]=0xb;_0x2ab403['statedesc']=_0x0f79('0xde');_0x2ab403[_0x0f79('0xc8')]=_0x0f79('0xdf');_0x2ab403['countabandonedretry']+=0x1;_0x2ab403[_0x0f79('0xca')]+=0x1;_0x64b951=this[_0x0f79('0x1c')][_0x3295e9[_0x0f79('0xb5')]][_0x0f79('0xe0')];_0x2337ba=this['voiceQueues'][_0x3295e9[_0x0f79('0xb5')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x0f79('0xcd')](_0x2ab403,_0x2ab403['state'],_0x238880['voiceQueue'])[_0x0f79('0x3b')](function(_0x1a8752){if(_0x2ab403['countabandonedretry']>=_0x3c6d1b[_0x0f79('0x1c')][_0x3295e9[_0x0f79('0xb5')]][_0x0f79('0xe1')]){_0x3c6d1b[_0x0f79('0xe2')](_0x2ab403,_0x1a8752[_0x0f79('0xcf')]);}else{hopperUtils[_0x0f79('0xd1')]({'active':![],'countabandonedretry':_0x2ab403[_0x0f79('0xe3')],'scheduledat':moment()[_0x0f79('0xd2')](_0x3c6d1b['voiceQueues'][_0x3295e9['queue']]['dialAbandonedRetryFrequency'],_0x0f79('0xe4'))[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x238880[_0x0f79('0xe5')],'ListId':_0x238880[_0x0f79('0xd3')],'VoiceQueueId':_0x238880[_0x0f79('0xd4')]||undefined,'CampaignId':_0x238880[_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch(_0x0f79('0xe6')));var _0x242197=new History(_0x2ab403);_0x242197[_0x0f79('0x6c')]=0xb;_0x242197[_0x0f79('0xc6')]='Abandoned';_0x242197[_0x0f79('0xd7')]=moment()[_0x0f79('0x82')](_0x0f79('0xbb'));_0x242197[_0x0f79('0xd8')]=_0x242197[_0x0f79('0xd7')];_0x242197['calleridname']=_0x2ab403[_0x0f79('0xd9')];_0x242197[_0x0f79('0xda')]=_0x2ab403[_0x0f79('0xda')];hopperUtils[_0x0f79('0xe7')](_0x242197)['catch'](loggerCatch(_0x0f79('0xe8')));}})[_0x0f79('0x3b')](function(){if(_0x336ba3)hopperUtils[_0x0f79('0xdc')](_0x2ab403,_0x64b951,_0x2337ba)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x0f79('0x34')]=function(_0x468520){if(this[_0x0f79('0xe9')][_0x468520['uniqueid']]){this[_0x0f79('0xe9')][_0x468520[_0x0f79('0xb6')]][_0x0f79('0xea')]=_0x468520[_0x0f79('0xea')];}if(this[_0x0f79('0x22')][_0x468520['uniqueid']]){this[_0x0f79('0x22')][_0x468520['uniqueid']][_0x0f79('0xea')]=_0x468520['channel'];}};Dialer[_0x0f79('0x7f')]['syncQueueMember']=function(_0x54e364){if(!this[_0x0f79('0xe9')][_0x54e364[_0x0f79('0xeb')]]){return;}var _0x19c217=this[_0x0f79('0x1c')][this['actions'][_0x54e364['actionid']][_0x0f79('0xb5')]]['strategy']||'rrmemory';if(_0x19c217==='roundrobin'){if(this[_0x0f79('0xe9')][_0x54e364[_0x0f79('0xeb')]]&&_[_0x0f79('0xec')](this['actions'][_0x54e364[_0x0f79('0xeb')]]['locked'])&&_0x54e364[_0x0f79('0x84')]==='1'&&_0x54e364[_0x0f79('0xed')]==='0'){if(this[_0x0f79('0x1e')][_0x54e364[_0x0f79('0xee')]]){if(!this[_0x0f79('0x1e')][_0x54e364[_0x0f79('0xee')]][_0x0f79('0xef')]){this[_0x0f79('0x1e')][_0x54e364[_0x0f79('0xee')]][_0x0f79('0xef')]=!![];this[_0x0f79('0xe9')][_0x54e364[_0x0f79('0xeb')]][_0x0f79('0xef')]=!![];this[_0x0f79('0xe9')][_0x54e364[_0x0f79('0xeb')]][_0x0f79('0xee')]=_0x54e364[_0x0f79('0xee')];}}}}else if(_0x19c217==='rrmemory'){if(this[_0x0f79('0xe9')][_0x54e364['actionid']]){if(this[_0x0f79('0x1e')][_0x54e364['stateinterface']]){this[_0x0f79('0xe9')][_0x54e364[_0x0f79('0xeb')]][_0x0f79('0xee')]=_0x54e364[_0x0f79('0xee')];if(_[_0x0f79('0xec')](this[_0x0f79('0x26')][this[_0x0f79('0xe9')][_0x54e364[_0x0f79('0xeb')]]['queue']])){this[_0x0f79('0x26')][this['actions'][_0x54e364[_0x0f79('0xeb')]][_0x0f79('0xb5')]]=[];}this[_0x0f79('0x26')][this['actions'][_0x54e364[_0x0f79('0xeb')]][_0x0f79('0xb5')]][_0x0f79('0x94')](_[_0x0f79('0xf0')](_[_0x0f79('0x71')](this['actions'][_0x54e364[_0x0f79('0xeb')]],[_0x0f79('0xf1'),_0x0f79('0xee')]),{'status':_0x54e364[_0x0f79('0x84')],'paused':_0x54e364[_0x0f79('0xed')]}));}}}};Dialer[_0x0f79('0x7f')][_0x0f79('0x37')]=function(_0x5d0084){if(!this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]]){return;}var _0x5353dd=this;var _0x283ec8=this[_0x0f79('0x1c')][this['actions'][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xb5')]];var _0xec354a=_0x283ec8[_0x0f79('0xf2')]||_0x0f79('0xf3');if(_0xec354a===_0x0f79('0xf4')){if(this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]]&&this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xee')]){this[_0x0f79('0x1b')]['run'](this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xf1')],this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]]['stateinterface'])[_0x0f79('0x9b')](function(_0x514e3a){logger[_0x0f79('0x61')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x514e3a,{'showHidden':![],'depth':null}));})[_0x0f79('0x19')](function(){_0x5353dd['updateOriginated'](_0x5353dd['voiceQueues'][_0x5353dd[_0x0f79('0xe9')][_0x5d0084['actionid']][_0x0f79('0xb5')]]);_0x5353dd[_0x0f79('0x1e')][_0x5353dd[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xee')]][_0x0f79('0xef')]=![];delete _0x5353dd['actions'][_0x5d0084[_0x0f79('0xeb')]];unlockQueueStatus(_0x283ec8);});}else{this['updateOriginated'](this[_0x0f79('0x1c')][this[_0x0f79('0xe9')][_0x5d0084['actionid']][_0x0f79('0xb5')]]);hopperUtils[_0x0f79('0xd1')]({'active':![],'ContactId':this['actions'][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xe5')],'ListId':this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xd3')],'VoiceQueueId':this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x5d0084[_0x0f79('0xeb')]];unlockQueueStatus(_0x283ec8);}}else if(_0xec354a===_0x0f79('0xf3')){var _0x349bfe;if(this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]]&&!_[_0x0f79('0x44')](this[_0x0f79('0x26')][this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xb5')]])){if(this['queueBookedRR'][_0x5353dd['actions'][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xb5')]]){this['queueBookedRR'][_0x5353dd['actions'][_0x5d0084['actionid']]['queue']]=this[_0x0f79('0xf5')][this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xb5')]]?this['queueBookedRR'][this['actions'][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xb5')]]:this['queueBooked'][this['actions'][_0x5d0084['actionid']]['queue']]?this[_0x0f79('0x26')][this[_0x0f79('0xe9')][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xb5')]][_0x0f79('0xf6')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xb5')]][_0x0f79('0xf6')]=this[_0x0f79('0xf5')][this['actions'][_0x5d0084[_0x0f79('0xeb')]][_0x0f79('0xb5')]];for(var _0xf00cf1=0x0;_0xf00cf1=_0x2f3646[_0x0f79('0x11b')]){_0x1af72f[_0x0f79('0x11c')](_0x3fbe3d,_0x2bc736,_0x2e3689,_0x0f79('0x11d'));}else{if(_0x3fbe3d[_0x0f79('0x115')]>=_0x2f3646[_0x0f79('0x11e')]){_0x1af72f[_0x0f79('0x11f')](_0x3fbe3d,_0x2bc736,_0x2e3689,'reason\x2019\x20machine....');}else{hopperUtils[_0x0f79('0xd1')]({'active':![],'countmachineretry':_0x3fbe3d[_0x0f79('0x115')],'scheduledat':moment()[_0x0f79('0xd2')](_0x2f3646[_0x0f79('0x120')],_0x0f79('0xe4'))[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x3fbe3d[_0x0f79('0xe5')],'ListId':_0x3fbe3d[_0x0f79('0xd3')],'VoiceQueueId':_0x3fbe3d['VoiceQueueId']||undefined,'CampaignId':_0x3fbe3d[_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch('[rescheduleContact][Machine]'));_0x2bc736({'reschedule':0x1});}}});}if(_0x1eb2b9[_0x0f79('0xb7')]==='ivr'&&this[_0x0f79('0x1d')][_0x1eb2b9[_0x0f79('0xb5')]][_0x0f79('0x109')]&&_0x23d9cf[_0x0f79('0x10a')]===_0x0f79('0x121')){delete this[_0x0f79('0x22')][_0x23d9cf['uniqueid']];this['updateOriginated'](this[_0x0f79('0x1d')][_0x1eb2b9[_0x0f79('0xb5')]]);_0x8aad9b=new Hangup(_0x1eb2b9,_0x23d9cf);_0x8aad9b['state']=0x12;_0x8aad9b[_0x0f79('0xc6')]=_0x0f79('0x10b');_0x8aad9b['membername']=_0x0f79('0x10c');ami[_0x0f79('0x10d')]('custom:amd',ut[_0x0f79('0x10e')](_0x8aad9b,_0x0f79('0x10f')));this['saveInDb'](_0x8aad9b,'[syncHangupInAMDIvr][createHistory]',_0x0f79('0x122'));}if(_0x1eb2b9[_0x0f79('0xb7')]===_0x0f79('0xb8')&&this['campaigns'][_0x1eb2b9[_0x0f79('0xb5')]]['dialAMDActive']&&_0x23d9cf[_0x0f79('0x10a')]===_0x0f79('0x123')){return new Promise(function(_0x4c9374,_0x1e1b96){delete _0x1af72f[_0x0f79('0x22')][_0x23d9cf[_0x0f79('0xb6')]];_0x1af72f[_0x0f79('0xb9')](_0x1af72f[_0x0f79('0x1d')][_0x1eb2b9['queue']]);_0x1af72f['campaigns'][_0x1eb2b9['queue']][_0x0f79('0xbc')]+=0x1;_0x1af72f[_0x0f79('0x1d')][_0x1eb2b9['queue']][_0x0f79('0x113')]+=0x1;var _0x47dd64=_0x1af72f['campaigns'][_0x1eb2b9['queue']];var _0x4e41c2=new Hangup(_0x1eb2b9,_0x23d9cf);_0x4e41c2[_0x0f79('0x6c')]=0x13;_0x4e41c2[_0x0f79('0xc6')]=_0x0f79('0x114');_0x4e41c2[_0x0f79('0x124')]=_0x0f79('0x10c');_0x4e41c2['countmachineretry']+=0x1;_0x4e41c2[_0x0f79('0xca')]+=0x1;_0x4e41c2['amd']=!![];ami[_0x0f79('0x10d')](_0x0f79('0x116'),ut[_0x0f79('0x10e')](_0x4e41c2,_0x0f79('0x10f')));hopperUtils[_0x0f79('0xe7')](_0x4e41c2)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x117')));if(_0x4e41c2[_0x0f79('0x125')]+_0x4e41c2[_0x0f79('0x118')]+_0x4e41c2['countnoanswerretry']+_0x4e41c2[_0x0f79('0x119')]+_0x4e41c2[_0x0f79('0xc9')]+_0x4e41c2[_0x0f79('0xe3')]+_0x4e41c2[_0x0f79('0x115')]+_0x4e41c2['countagentrejectretry']>=_0x47dd64[_0x0f79('0x11b')]){_0x1af72f[_0x0f79('0x11c')](_0x4e41c2,_0x4c9374,_0x1e1b96,'reason19\x20machine....');}else{if(_0x4e41c2[_0x0f79('0x115')]>=_0x47dd64[_0x0f79('0x11e')]){_0x1af72f[_0x0f79('0x11f')](_0x4e41c2,_0x4c9374,_0x1e1b96,_0x0f79('0x126'));}else{hopperUtils[_0x0f79('0xd1')]({'active':![],'countmachineretry':_0x4e41c2[_0x0f79('0x115')],'scheduledat':moment()[_0x0f79('0xd2')](_0x47dd64['dialMachineRetryFrequency'],_0x0f79('0xe4'))[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x4e41c2[_0x0f79('0xe5')],'ListId':_0x4e41c2['ListId'],'VoiceQueueId':_0x4e41c2[_0x0f79('0xd4')]||undefined,'CampaignId':_0x4e41c2[_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x127')));_0x4c9374({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x47736a){var _0x5ed8ef=this[_0x0f79('0x22')][_0x47736a[_0x0f79('0xb6')]];var _0x22d1e4;if(_0x5ed8ef&&_0x5ed8ef['type']===_0x0f79('0xb8')){delete this[_0x0f79('0x22')][_0x47736a[_0x0f79('0xb6')]];this[_0x0f79('0xb9')](this[_0x0f79('0x1d')][_0x5ed8ef[_0x0f79('0xb5')]]);this[_0x0f79('0x1d')][_0x5ed8ef['queue']][_0x0f79('0x128')]+=0x1;_0x22d1e4=new Hangup(_0x5ed8ef,_0x47736a);hopperUtils[_0x0f79('0xe7')](_0x22d1e4)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x129')));hopperUtils['moveContactManagedDialer'](_0x22d1e4)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x12a')));}if(_0x5ed8ef&&_0x5ed8ef[_0x0f79('0xb7')]!==_0x0f79('0xb8')&&isNotNull(this['voiceQueues'][_0x5ed8ef[_0x0f79('0xb5')]][_0x0f79('0x12b')])){delete this[_0x0f79('0x22')][_0x47736a[_0x0f79('0xb6')]];this[_0x0f79('0xb9')](this[_0x0f79('0x1c')][_0x5ed8ef[_0x0f79('0xb5')]]);this[_0x0f79('0x1c')][_0x5ed8ef[_0x0f79('0xb5')]][_0x0f79('0xbc')]+=0x1;this[_0x0f79('0x1c')][_0x5ed8ef['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x22d1e4=new Hangup(_0x5ed8ef,_0x47736a);_0x22d1e4[_0x0f79('0x6c')]=0x10;_0x22d1e4['statedesc']=_0x0f79('0x12c');_0x22d1e4[_0x0f79('0x124')]=_0x0f79('0x12d');hopperUtils[_0x0f79('0xe7')](_0x22d1e4)['catch'](loggerCatch(_0x0f79('0x129')));hopperUtils[_0x0f79('0xc2')](_0x22d1e4)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x12a')));}if(_0x5ed8ef&&_0x5ed8ef['type']!==_0x0f79('0xb8')&&!isNotNull(this[_0x0f79('0x1c')][_0x5ed8ef[_0x0f79('0xb5')]]['dialQueueProject'])){if(_0x47736a[_0x0f79('0x12e')]===_0x0f79('0x12f')){delete this[_0x0f79('0x22')][_0x47736a['uniqueid']];this[_0x0f79('0x1c')][_0x5ed8ef['queue']][_0x0f79('0xbc')]+=0x1;const _0x29697d=new AgentComplete(_0x5ed8ef,_0x47736a);_0x29697d[_0x0f79('0xd5')]=this[_0x0f79('0x1c')][_0x5ed8ef[_0x0f79('0xb5')]]['id'];hopperUtils[_0x0f79('0xe7')](_0x29697d)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x130')));hopperUtils[_0x0f79('0xc2')](_0x29697d)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x131')));}else{delete this[_0x0f79('0x22')][_0x47736a[_0x0f79('0xb6')]];this[_0x0f79('0xb9')](this[_0x0f79('0x1c')][_0x5ed8ef[_0x0f79('0xb5')]]);this['voiceQueues'][_0x5ed8ef[_0x0f79('0xb5')]][_0x0f79('0x132')]+=0x1;_0x22d1e4=new Hangup(_0x5ed8ef,_0x47736a);_0x22d1e4[_0x0f79('0x6c')]=0xc;_0x22d1e4[_0x0f79('0xc6')]=_0x47736a[_0x0f79('0x12e')];_0x22d1e4[_0x0f79('0x124')]=_0x0f79('0x133');hopperUtils['createHistory'](_0x22d1e4)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x129')));hopperUtils['moveContactManagedDialer'](_0x22d1e4)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x12a')));}}};Dialer[_0x0f79('0x7f')][_0x0f79('0xa')]=function(_0xe2b45){var _0x41505a=this;if(!_0x41505a[_0x0f79('0x27')][_0xe2b45[_0x0f79('0x42')]]){_0x41505a[_0x0f79('0x27')][_0xe2b45[_0x0f79('0x42')]]={'running':![]};}else if(_0x41505a[_0x0f79('0x27')][_0xe2b45[_0x0f79('0x42')]][_0x0f79('0x134')]===!![]){return;}else if(_0x41505a[_0x0f79('0x27')][_0xe2b45['name']][_0x0f79('0x134')]===![]){_0x41505a[_0x0f79('0x27')][_0xe2b45['name']]['running']=!![];}var _0x39858d=_0x41505a[_0x0f79('0x1c')][_0xe2b45['name']];var _0x53111c=_0x39858d[_0x0f79('0x66')]!==utils[_0x0f79('0x67')][_0x0f79('0x76')];var _0x15c95d=utils[_0x0f79('0x135')](_0x39858d);_0x39858d[_0x0f79('0x136')]=utils[_0x0f79('0x137')](_0x39858d,_0x41505a[_0x0f79('0x1f')]);Promise[_0x0f79('0x138')]()[_0x0f79('0x3b')](function(){if(_0x39858d[_0x0f79('0x136')]===utils[_0x0f79('0x67')][_0x0f79('0x76')]){if(_0x53111c){clearPredictiveAttributes(_0x39858d);_0xe2b45[_0x0f79('0x24')]=undefined;_0xe2b45[_0x0f79('0x5e')]=undefined;}if(_0x39858d[_0x0f79('0x136')]===utils[_0x0f79('0x67')][_0x0f79('0x76')]){_0xe2b45[_0x0f79('0x139')]=0x0;_0xe2b45[_0x0f79('0xed')]=0x0;_0xe2b45[_0x0f79('0x13a')]=0x0;_0xe2b45['talking']=0x0;_0xe2b45[_0x0f79('0x13b')]=0x0;}}else if(_0x39858d[_0x0f79('0x136')]===utils[_0x0f79('0x67')][_0x0f79('0x13c')]&&!_0x15c95d){return _0x41505a[_0x0f79('0x8b')](_0x39858d,!![])[_0x0f79('0x3b')](function(){return _0x41505a[_0x0f79('0x8b')](_0x39858d,![]);})['then'](function(){return _0x41505a[_0x0f79('0xa8')](_0x39858d);})[_0x0f79('0x9b')](function(_0x442cfa){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util['inspect'](_0x442cfa,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x39858d);});}else{clearPredictiveAttributes(_0x39858d);}})[_0x0f79('0x3b')](function(){var _0x158d47=_0xe2b45['compareToOutboundQueue'](_0x39858d);if(_0x158d47||_0x39858d['queueSummaryCountersUpdated']){_0x39858d[_0x0f79('0x13d')]=![];_0xe2b45[_0x0f79('0x13e')](_0x39858d);Object[_0x0f79('0x13f')](_0x39858d,_0xe2b45);emitOutboundVoiceQueueSummary(_0xe2b45);}_0x41505a[_0x0f79('0x27')][_0x39858d[_0x0f79('0x42')]]['running']=![];})[_0x0f79('0x9b')](function(_0x16194c){logger[_0x0f79('0x61')](_0x0f79('0x140'),util[_0x0f79('0x40')](_0x16194c,{'showHidden':![],'depth':null}));_0x41505a[_0x0f79('0x27')][_0x39858d[_0x0f79('0x42')]][_0x0f79('0x134')]=![];});};Dialer[_0x0f79('0x7f')][_0x0f79('0x30')]=_[_0x0f79('0x141')](function(){var _0x2130c9=_[_0x0f79('0x142')](this[_0x0f79('0x1c')],function(_0x240652){return _0x240652[_0x0f79('0x143')];});var _0xedc379=_[_0x0f79('0x142')](this[_0x0f79('0x1e')],function(_0x217ab2){return _0x217ab2['online']&&_0x217ab2[_0x0f79('0x84')]===_0x0f79('0x144');});if(_0x2130c9[_0x0f79('0x93')]>0x0&&_0xedc379[_0x0f79('0x93')]>0x0){return Promise[_0x0f79('0x138')]()[_0x0f79('0x3b')](cmHopper[_0x0f79('0x145')](_[_0x0f79('0x146')](_0x2130c9,'id'),previewRecallmeReminderInterval,_[_0x0f79('0x146')](_0xedc379,'id')))[_0x0f79('0x3b')](function(_0x59d51a){for(var _0x572690=0x0;_0x572690<_0x59d51a['length'];_0x572690++){var _0x1884e8=_0x59d51a[_0x572690][_0x0f79('0x147')]['name'];if(_0x1884e8)io['to'](util[_0x0f79('0x82')](_0x0f79('0x148'),_0x1884e8))[_0x0f79('0x10d')](_0x0f79('0x149'),{'hopper':_0x59d51a[_0x572690]});}})[_0x0f79('0x9b')](function(_0x1488dc){logger[_0x0f79('0x61')](_0x0f79('0x14a'),_0x1488dc);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0f79('0x7f')][_0x0f79('0x39')]=function(){var _0x436b9e=this;setInterval(function(){_0x436b9e['clearZombieChannels'](_0x436b9e[_0x0f79('0x22')],_0x0f79('0x14b'));_0x436b9e[_0x0f79('0x14c')](_0x436b9e[_0x0f79('0xe9')],_0x0f79('0x14d'));},0x32c8);};Dialer[_0x0f79('0x7f')][_0x0f79('0x14c')]=function(_0x3e6b85,_0x2b638b){var _0x592594=this;for(var _0x15ca05 in _0x3e6b85){if(typeof _0x3e6b85[_0x15ca05]!==_0x0f79('0x14e')){this[_0x0f79('0x1a')][_0x0f79('0x17')](function(){if(!_[_0x0f79('0xec')](_0x3e6b85[_0x15ca05])){return ami[_0x0f79('0x95')]({'action':_0x0f79('0x84'),'channel':_0x3e6b85[_0x15ca05]['channel']})[_0x0f79('0x9b')](function(_0x5bfa66){if(_0x5bfa66[_0x0f79('0x66')]===_0x0f79('0x14f')){setTimeout(function(){if(_0x3e6b85[_0x15ca05]&&_0x3e6b85[_0x15ca05][_0x0f79('0xb7')]!=='ivr'){_0x592594[_0x0f79('0xb9')](_0x592594[_0x0f79('0x1c')][_0x3e6b85[_0x15ca05]['queue']]);logger[_0x0f79('0x61')](_0x0f79('0x150'),_0x2b638b,_0x15ca05,_0x3e6b85[_0x15ca05][_0x0f79('0xb5')]);delete _0x3e6b85[_0x15ca05];}if(_0x3e6b85[_0x15ca05]&&_0x3e6b85[_0x15ca05][_0x0f79('0xb7')]===_0x0f79('0xb8')){_0x592594[_0x0f79('0xb9')](_0x592594[_0x0f79('0x1d')][_0x3e6b85[_0x15ca05][_0x0f79('0xb5')]]);logger[_0x0f79('0x61')](_0x0f79('0x151'),_0x2b638b,_0x15ca05,_0x3e6b85[_0x15ca05][_0x0f79('0xb5')]);delete _0x3e6b85[_0x15ca05];}},0x2328);}});}});}}};Dialer[_0x0f79('0x7f')][_0x0f79('0x152')]=function(_0x4a3d72){return Promise[_0x0f79('0x138')]()[_0x0f79('0x3b')](voiceQueueRt[_0x0f79('0x152')](_0x4a3d72))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype']['updateOriginated']=function(_0x578d5d){if(!_[_0x0f79('0x3c')](_0x578d5d)&&_0x578d5d!==null){if(typeof _0x578d5d['originated']!==_0x0f79('0x14e')){if(_0x578d5d[_0x0f79('0x153')]>0x0){_0x578d5d[_0x0f79('0x153')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x0f79('0x61')](_0x0f79('0x154'));}};Dialer[_0x0f79('0x7f')]['loggerHandler']=function(_0x709004,_0x8c0fd8){var _0x5a2761=this;return function(_0x9248c7){_0x5a2761[_0x0f79('0xb9')](_0x8c0fd8);logger[_0x0f79('0x61')](_0x709004,util[_0x0f79('0x40')](_0x9248c7,{'showHidden':![],'depth':null}));};};Dialer[_0x0f79('0x7f')]['emptyContact']=function(_0x28a015,_0x516016,_0x5d8bda){var _0x5e89d7={'state':0x19,'statedesc':_0x0f79('0x155')};this[_0x0f79('0xb9')](_0x516016);this[_0x0f79('0x110')](_[_0x0f79('0xf0')](_0x5e89d7,_[_0x0f79('0x71')](_0x5d8bda,['ContactId',_0x0f79('0xd3'),'UserId',_0x0f79('0xd4'),_0x0f79('0xd5')])),_0x0f79('0x156'),_0x0f79('0x157'));logger[_0x0f79('0x61')](_0x28a015);};Dialer[_0x0f79('0x7f')][_0x0f79('0x110')]=function(_0xb337d1,_0x1fa507,_0x163697){hopperUtils[_0x0f79('0xe7')](_0xb337d1)['catch'](loggerCatch(_0x1fa507));hopperUtils[_0x0f79('0xc2')](_0xb337d1)[_0x0f79('0x9b')](loggerCatch(_0x163697));};Dialer['prototype'][_0x0f79('0xe2')]=function(_0x8cc944,_0x3d4174){hopperUtils[_0x0f79('0xe7')](_0x8cc944)[_0x0f79('0x9b')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3d4174==0x0){hopperUtils[_0x0f79('0xc2')](_0x8cc944)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x158')));}};Dialer[_0x0f79('0x7f')][_0x0f79('0x14a')]=function(_0x13fce0){return Promise['resolve']()[_0x0f79('0x3b')](cmHopper['handlePreviewRecallNotifications'](_0x13fce0['id'],previewRecallmeReminderInterval))[_0x0f79('0x3b')](function(_0x22d5a7){for(var _0x2989ed=0x0;_0x2989ed<_0x22d5a7[_0x0f79('0x93')];_0x2989ed++){var _0x270975=_0x22d5a7[_0x2989ed][_0x0f79('0x147')][_0x0f79('0x42')];if(_0x270975)io['to'](util[_0x0f79('0x82')](_0x0f79('0x148'),_0x270975))['emit'](_0x0f79('0x149'),{'hopper':_0x22d5a7[_0x2989ed]});}})['catch'](function(){});};Dialer['prototype'][_0x0f79('0x159')]=function(_0x4c2848){var _0x106298=this;return function(){_0x106298['handleIvr'](_0x4c2848);};};Dialer[_0x0f79('0x7f')]['actionOriginate']=function(_0x552558,_0x574e41){var _0x5dbefe=this;var _0x334e99=uuid['v4']();this[_0x0f79('0xe9')][_0x334e99]=new Action(_0x552558,_0x574e41,_0x334e99);return new Promise(function(_0x450982,_0x524b99){if(_[_0x0f79('0x3c')](_0x552558)&&typeof _0x552558!==_0x0f79('0x15a')){return _0x524b99(msgResponse(_0x0f79('0x15b'),_0x0f79('0x8c'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x574e41[_0x0f79('0x15c')])||_0x574e41['phone']===null){return _0x524b99(msgResponse(_0x0f79('0x15b'),_0x0f79('0x8c'),_0x0f79('0x15d')));}var _0x37c24e={'XMD-CALLERID':_0x5dbefe[_0x0f79('0xe9')][_0x334e99][_0x0f79('0x15e')](),'XMD-AGI':_0x552558[_0x0f79('0x12b')]?util[_0x0f79('0x82')](_0x0f79('0x15f'),ipAgi,_0x552558['dialQueueProject']):_0x0f79('0x160'),'XMD-AGIAFTER':_0x552558[_0x0f79('0xc0')]?util[_0x0f79('0x82')](_0x0f79('0x15f'),ipAgi,_0x552558['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x0f79('0x161')](_0x552558)?util[_0x0f79('0x82')](_0x0f79('0x162'),_0x552558[_0x0f79('0x42')],_0x552558[_0x0f79('0x163')]||'',_0x552558[_0x0f79('0xc1')]?'c':'',_0x552558[_0x0f79('0xc5')]||0x3):_0x0f79('0x160'),'XMD-CONTACTID':_0x574e41[_0x0f79('0xe5')],'XMD-CDRTYPE':_0x0f79('0x164'),'CALLERID(all)':_0x5dbefe[_0x0f79('0xe9')][_0x334e99]['getCaller'](),'XMD-AMD':_0x552558[_0x0f79('0x109')]?_0x0f79('0x13c'):_0x0f79('0x160'),'XMD-DESTINATION':_0x0f79('0x108')};if(_0x552558[_0x0f79('0x109')]){_0x37c24e['XMD-AMDINITIALSILENCE']=_0x552558['dialAMDInitialSilence']||0x9c4;_0x37c24e[_0x0f79('0x165')]=_0x552558[_0x0f79('0x166')]||0x5dc;_0x37c24e[_0x0f79('0x167')]=_0x552558[_0x0f79('0x168')]||0x320;_0x37c24e[_0x0f79('0x169')]=_0x552558[_0x0f79('0x16a')]||0x1388;_0x37c24e[_0x0f79('0x16b')]=_0x552558[_0x0f79('0x16c')]||0x64;_0x37c24e[_0x0f79('0x16d')]=_0x552558[_0x0f79('0x16e')]||0x32;_0x37c24e[_0x0f79('0x16f')]=_0x552558[_0x0f79('0x170')]||0x3;_0x37c24e[_0x0f79('0x171')]=_0x552558['dialAMDSilenceThreshold']||0x100;_0x37c24e[_0x0f79('0x172')]=_0x552558[_0x0f79('0x173')]||0x1388;}if(utils[_0x0f79('0x161')](_0x552558)){_0x37c24e[_0x0f79('0x174')]=_0x574e41[_0x0f79('0xd4')];}else{_0x37c24e['XMD-CAMPAIGNID']=_0x574e41['CampaignId'];}var _0x1ff648=utils['setXMDContactVariables'](_0x574e41['Contact']);Object[_0x0f79('0x13f')](_0x37c24e,_0x1ff648);var _0x3ce415=_0x5dbefe['isTrunkReachable'](_0x552558['Trunk'])?utils[_0x0f79('0x175')](_0x552558['Trunk']['callerid'],_0x552558[_0x0f79('0x176')],_0x552558['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x0f79('0x177')](_0x552558['dialOriginateCallerIdNumber'],_0x552558[_0x0f79('0x178')]):_0x552558['dialOriginateCallerIdNumber']):utils['getCallerId'](_['isNil'](_0x552558[_0x0f79('0x86')])?_0x552558[_0x0f79('0x85')][_0x0f79('0x179')]:_0x552558[_0x0f79('0x86')][_0x0f79('0x179')],_0x552558['dialOriginateCallerIdName'],_0x552558['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x0f79('0x177')](_0x552558['dialOriginateCallerIdNumber'],_0x552558[_0x0f79('0x178')]):_0x552558['dialOriginateCallerIdNumber']);if(_0x3ce415){_0x37c24e[_0x0f79('0x17a')]=_0x5dbefe[_0x0f79('0xe9')][_0x334e99][_0x0f79('0x17b')]=utils['extractCalleridName'](_0x3ce415);_0x37c24e[_0x0f79('0x17c')]=_0x574e41[_0x0f79('0x15c')];}_0x552558['variables']=_0x37c24e;return ami[_0x0f79('0x95')]({'actionid':_0x334e99,'action':_0x0f79('0x15b'),'channel':_0x5dbefe['isTrunkReachable'](_0x552558[_0x0f79('0x85')])?util[_0x0f79('0x82')](_0x0f79('0x17d'),_0x552558[_0x0f79('0x85')][_0x0f79('0x42')],isNotNull(_0x552558[_0x0f79('0x17e')])?_0x552558[_0x0f79('0x17e')]['trim']()||'':'',_0x552558[_0x0f79('0x17f')]>0x0?_0x574e41[_0x0f79('0x15c')]['substring'](_0x552558[_0x0f79('0x17f')]):_0x574e41['phone']):util[_0x0f79('0x82')](_0x0f79('0x17d'),_[_0x0f79('0xec')](_0x552558[_0x0f79('0x86')])?_0x552558['Trunk'][_0x0f79('0x42')]:_0x552558['TrunkBackup']['name'],isNotNull(_0x552558[_0x0f79('0x17e')])?_0x552558[_0x0f79('0x17e')][_0x0f79('0x180')]()||'':'',_0x552558[_0x0f79('0x17f')]>0x0?_0x574e41[_0x0f79('0x15c')]['substring'](_0x552558[_0x0f79('0x17f')]):_0x574e41['phone']),'callerid':_0x3ce415,'Exten':_0x0f79('0x108'),'Context':_0x0f79('0x181'),'Priority':'1','variable':_0x37c24e,'timeout':(_0x552558[_0x0f79('0x182')]||0x1e)*0x3e8,'async':!![],'channelid':_0x334e99})['then'](function(_0x3e6079){return _0x450982(_0x3e6079);})[_0x0f79('0x9b')](function(_0x47e002){_0x552558['outboundOriginateFailureCallsDay']+=0x1;var _0x495742=new History(_0x5dbefe['actions'][_0x334e99]);logger[_0x0f79('0x61')](util[_0x0f79('0x82')](_0x0f79('0x183'),JSON[_0x0f79('0x70')](_0x47e002)));_0x495742[_0x0f79('0x6c')]=0xe;_0x495742['statedesc']=_0x0f79('0x184');_0x495742[_0x0f79('0xd7')]=moment()[_0x0f79('0x82')](_0x0f79('0xbb'));_0x495742[_0x0f79('0xd8')]=_0x495742[_0x0f79('0xd7')];hopperUtils[_0x0f79('0xe7')](_0x495742)['catch'](loggerCatch(_0x0f79('0x185')));_0x5dbefe[_0x0f79('0xc2')](_0x495742)[_0x0f79('0x9b')](loggerCatch('[originate][error]'))[_0x0f79('0x19')](function(){delete _0x5dbefe[_0x0f79('0xe9')][_0x334e99];return _0x524b99(msgResponse(_0x0f79('0x15b'),_0x0f79('0x7e'),_0x0f79('0x186')));});});});};Dialer[_0x0f79('0x7f')][_0x0f79('0x187')]=function(_0x2b513c,_0x5ae068,_0x4102b5){var _0x2b52b8=new History(_0x5ae068);if(_0x2b52b8[_0x0f79('0x125')]+_0x2b52b8[_0x0f79('0x118')]+_0x2b52b8[_0x0f79('0x188')]+_0x2b52b8[_0x0f79('0x119')]+_0x2b52b8[_0x0f79('0xc9')]+_0x2b52b8[_0x0f79('0xe3')]+_0x2b52b8[_0x0f79('0x115')]+_0x2b52b8[_0x0f79('0x11a')]>=_0x4102b5[_0x0f79('0x11b')]-0x1){return!![];}switch(_0x2b513c){case 0x3:if(_0x2b52b8[_0x0f79('0x188')]>=_0x4102b5[_0x0f79('0x189')]-0x1){return!![];}hopperUtils[_0x0f79('0xd1')]({'active':![],'countnoanswerretry':_0x2b52b8[_0x0f79('0x188')]+=0x1,'scheduledat':moment()[_0x0f79('0xd2')](_0x4102b5[_0x0f79('0x18a')],_0x0f79('0xe4'))[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x2b52b8['ContactId'],'ListId':_0x2b52b8['ListId'],'VoiceQueueId':_0x2b52b8[_0x0f79('0xd4')]||undefined,'CampaignId':_0x2b52b8[_0x0f79('0xd5')]||undefined})['catch'](loggerCatch(_0x0f79('0x18b')));break;case 0x5:if(_0x2b52b8['countbusyretry']>=_0x4102b5[_0x0f79('0x18c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x2b52b8['countbusyretry']+=0x1,'scheduledat':moment()[_0x0f79('0xd2')](_0x4102b5['dialBusyRetryFrequency'],_0x0f79('0xe4'))[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x2b52b8[_0x0f79('0xe5')],'ListId':_0x2b52b8[_0x0f79('0xd3')],'VoiceQueueId':_0x2b52b8[_0x0f79('0xd4')]||undefined,'CampaignId':_0x2b52b8['CampaignId']||undefined})['catch'](loggerCatch(_0x0f79('0x18d')));break;case 0x8:if(_0x2b52b8[_0x0f79('0x118')]>=_0x4102b5[_0x0f79('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x2b52b8[_0x0f79('0x118')]+=0x1,'scheduledat':moment()[_0x0f79('0xd2')](_0x4102b5[_0x0f79('0x18f')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b52b8['ContactId'],'ListId':_0x2b52b8[_0x0f79('0xd3')],'VoiceQueueId':_0x2b52b8[_0x0f79('0xd4')]||undefined,'CampaignId':_0x2b52b8[_0x0f79('0xd5')]||undefined})['catch'](loggerCatch(_0x0f79('0x190')));break;case 0x0:if(_0x2b52b8['countnosuchnumberretry']>=_0x4102b5[_0x0f79('0x191')]-0x1){return!![];}else{hopperUtils[_0x0f79('0xd1')]({'active':![],'countnosuchnumberretry':_0x2b52b8['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x4102b5[_0x0f79('0x192')],'minutes')[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x2b52b8[_0x0f79('0xe5')],'ListId':_0x2b52b8[_0x0f79('0xd3')],'VoiceQueueId':_0x2b52b8[_0x0f79('0xd4')]||undefined,'CampaignId':_0x2b52b8['CampaignId']||undefined})[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x193')));}break;case 0xa:if(_0x2b52b8['countdropretry']>=_0x4102b5['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x0f79('0xd1')]({'active':![],'countdropretry':_0x2b52b8['countdropretry']+=0x1,'scheduledat':moment()[_0x0f79('0xd2')](_0x4102b5[_0x0f79('0xcb')],_0x0f79('0xe4'))[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x2b52b8[_0x0f79('0xe5')],'ListId':_0x2b52b8[_0x0f79('0xd3')],'VoiceQueueId':_0x2b52b8['VoiceQueueId']||undefined,'CampaignId':_0x2b52b8[_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch(_0x0f79('0xd6')));break;case 0xb:if(_0x2b52b8[_0x0f79('0xe3')]>=_0x4102b5[_0x0f79('0xe1')]-0x1){return!![];}hopperUtils[_0x0f79('0xd1')]({'active':![],'countabandonedretry':_0x2b52b8[_0x0f79('0xe3')]+=0x1,'scheduledat':moment()[_0x0f79('0xd2')](_0x4102b5['dialAbandonedRetryFrequency'],_0x0f79('0xe4'))[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x2b52b8[_0x0f79('0xe5')],'ListId':_0x2b52b8[_0x0f79('0xd3')],'VoiceQueueId':_0x2b52b8[_0x0f79('0xd4')]||undefined,'CampaignId':_0x2b52b8[_0x0f79('0xd5')]||undefined})['catch'](loggerCatch(_0x0f79('0xe6')));break;case 0x13:if(_0x2b52b8[_0x0f79('0x115')]>=_0x4102b5[_0x0f79('0x11e')]-0x1){return!![];}hopperUtils[_0x0f79('0xd1')]({'active':![],'countmachineretry':_0x2b52b8[_0x0f79('0x115')]+=0x1,'scheduledat':moment()[_0x0f79('0xd2')](_0x4102b5['dialMachineRetryFrequency'],'minutes')[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x2b52b8[_0x0f79('0xe5')],'ListId':_0x2b52b8[_0x0f79('0xd3')],'VoiceQueueId':_0x2b52b8['VoiceQueueId']||undefined,'CampaignId':_0x2b52b8[_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x127')));break;case 0x14:if(_0x2b52b8[_0x0f79('0x11a')]>=_0x4102b5[_0x0f79('0x194')]-0x1){return!![];}hopperUtils[_0x0f79('0xd1')]({'active':![],'countagentrejectretry':_0x2b52b8[_0x0f79('0x11a')]+=0x1,'scheduledat':moment()[_0x0f79('0xd2')](_0x4102b5[_0x0f79('0x195')],_0x0f79('0xe4'))[_0x0f79('0x82')](_0x0f79('0xbb')),'ContactId':_0x2b52b8[_0x0f79('0xe5')],'ListId':_0x2b52b8['ListId'],'VoiceQueueId':_0x2b52b8[_0x0f79('0xd4')]||undefined,'CampaignId':_0x2b52b8[_0x0f79('0xd5')]||undefined})['catch'](loggerCatch(_0x0f79('0x196')));break;default:return!![];}};Dialer['prototype'][_0x0f79('0x103')]=function(_0x2dcc8f,_0x4ab911,_0x1b3ab6){var _0x198cf9=this;var _0x186706=new History(_0x2dcc8f);var _0x1bdedf=![];var _0x67f7c9;var _0x55b8b7;return new Promise(function(_0x2bc8f5,_0x587aec){if(_[_0x0f79('0x3c')](_0x4ab911)&&typeof _0x4ab911!==_0x0f79('0x15a')){return _0x587aec(msgResponse(_0x0f79('0x197'),_0x0f79('0x8c'),'entity\x20is\x20undefine'));}if(_[_0x0f79('0x3c')](_0x1b3ab6)&&typeof _0x1b3ab6!=='object'){return _0x587aec(msgResponse(_0x0f79('0x197'),_0x0f79('0x8c'),'evt\x20is\x20undefine'));}hopperUtils[_0x0f79('0xcd')](_0x186706,_0x1b3ab6[_0x0f79('0xbd')],_0x4ab911)[_0x0f79('0x3b')](function(_0x44e2db){if(_0x44e2db['additional']==0x1)_0x1bdedf=!![];switch(_0x1b3ab6[_0x0f79('0xbd')]){case'0':_0x4ab911[_0x0f79('0x198')]+=0x1;_0x186706[_0x0f79('0x6c')]=0x0;_0x186706['statedesc']=_0x0f79('0x199');_0x186706[_0x0f79('0x119')]+=0x1;_0x186706[_0x0f79('0xca')]+=0x1;ami[_0x0f79('0x10d')](_0x0f79('0x19a'),ut[_0x0f79('0x10e')](_0x2dcc8f,_0x0f79('0x19b')));_0x67f7c9=_0x4ab911[_0x0f79('0x192')];_0x55b8b7=_0x4ab911[_0x0f79('0xcc')];hopperUtils[_0x0f79('0xe7')](_0x186706)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x117')));if(_0x198cf9[_0x0f79('0x187')](0x0,_0x2dcc8f,_0x4ab911)&&!_0x1bdedf){if(_0x186706['countnosuchnumberretry']>=_0x4ab911[_0x0f79('0x191')]){_0x198cf9[_0x0f79('0x11f')](_0x186706,_0x2bc8f5,_0x587aec,'reason\x200\x20no\x20such\x20number....');}else{_0x198cf9[_0x0f79('0x11c')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x19c'));}}break;case'3':_0x4ab911[_0x0f79('0x19d')]+=0x1;_0x186706['state']=0x3;_0x186706[_0x0f79('0xc6')]=_0x0f79('0x19e');_0x186706[_0x0f79('0x188')]+=0x1;_0x186706[_0x0f79('0xca')]+=0x1;var _0x2cdac4=ut['buildNoAnswerEventPayload'](_0x2dcc8f,_0x4ab911);ami['emit'](_0x0f79('0x19f'),_0x2cdac4);_0x67f7c9=_0x4ab911[_0x0f79('0x18a')];_0x55b8b7=_0x4ab911[_0x0f79('0xcc')];hopperUtils[_0x0f79('0xe7')](_0x186706)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x1a0')));if(_0x198cf9[_0x0f79('0x187')](0x3,_0x2dcc8f,_0x4ab911)&&!_0x1bdedf){if(_0x186706[_0x0f79('0x188')]>=_0x4ab911[_0x0f79('0x189')]){_0x198cf9[_0x0f79('0x11f')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x1a1'));}else{_0x198cf9[_0x0f79('0x11c')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x1a1'));}}break;case'5':_0x4ab911[_0x0f79('0x1a2')]+=0x1;_0x186706[_0x0f79('0x6c')]=0x5;_0x186706['statedesc']=_0x0f79('0x1a3');_0x186706['countbusyretry']+=0x1;_0x186706[_0x0f79('0xca')]+=0x1;ami[_0x0f79('0x10d')](_0x0f79('0x1a4'),ut[_0x0f79('0x10e')](_0x2dcc8f,'busy'));_0x67f7c9=_0x4ab911[_0x0f79('0x1a5')];_0x55b8b7=_0x4ab911[_0x0f79('0xcc')];hopperUtils[_0x0f79('0xe7')](_0x186706)[_0x0f79('0x9b')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x198cf9[_0x0f79('0x187')](0x5,_0x2dcc8f,_0x4ab911)&&!_0x1bdedf){if(_0x186706[_0x0f79('0x125')]>=_0x4ab911[_0x0f79('0x18c')]){_0x198cf9[_0x0f79('0x11f')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x1a6'));}else{_0x198cf9['stateGlobal'](_0x186706,_0x2bc8f5,_0x587aec,'reason\x205\x20busy');}}break;case'8':_0x4ab911['outboundCongestionCallsDay']+=0x1;_0x186706[_0x0f79('0x6c')]=0x8;_0x186706[_0x0f79('0xc6')]=_0x0f79('0x1a7');_0x186706[_0x0f79('0x118')]+=0x1;_0x186706[_0x0f79('0xca')]+=0x1;_0x67f7c9=_0x4ab911['dialCongestionRetryFrequency'];_0x55b8b7=_0x4ab911['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0x0f79('0x10e')](_0x2dcc8f,_0x0f79('0x1a8')));hopperUtils['createHistory'](_0x186706)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x1a9')));if(_0x198cf9[_0x0f79('0x187')](0x8,_0x2dcc8f,_0x4ab911)&&!_0x1bdedf){if(_0x186706[_0x0f79('0x118')]>=_0x4ab911['dialCongestionMaxRetry']){_0x198cf9['createStateFinal'](_0x186706,_0x2bc8f5,_0x587aec,'reason\x208\x20congestion');}else{_0x198cf9[_0x0f79('0x11c')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x1aa'));}}break;case'11':_0x4ab911['outboundAbandonedCallsDay']+=0x1;_0x186706[_0x0f79('0x6c')]=0xb;_0x186706[_0x0f79('0xc6')]=_0x0f79('0xde');_0x186706[_0x0f79('0xe3')]+=0x1;_0x186706[_0x0f79('0xca')]+=0x1;_0x67f7c9=_0x4ab911[_0x0f79('0xe0')];_0x55b8b7=_0x4ab911['callAdditionalPhoneAfterMin'];hopperUtils[_0x0f79('0xe7')](_0x186706)[_0x0f79('0x9b')](loggerCatch(_0x0f79('0xe8')));if(_0x198cf9['checkRetriveMax'](0xb,_0x2dcc8f,_0x4ab911)&&!_0x1bdedf){if(_0x186706[_0x0f79('0xe3')]>=_0x4ab911[_0x0f79('0xe1')]){_0x198cf9[_0x0f79('0x11f')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x1ab'));}else{_0x198cf9[_0x0f79('0x11c')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x1ab'));}}break;case'20':_0x4ab911[_0x0f79('0x1ac')]+=0x1;_0x186706[_0x0f79('0x6c')]=0x14;_0x186706[_0x0f79('0xc6')]=_0x0f79('0x1ad');_0x186706[_0x0f79('0x11a')]+=0x1;_0x186706[_0x0f79('0xca')]+=0x1;_0x67f7c9=_0x4ab911[_0x0f79('0x195')];_0x55b8b7=_0x4ab911[_0x0f79('0xcc')];ami[_0x0f79('0x10d')](_0x0f79('0x1ae'),ut['buildObj'](_0x2dcc8f,_0x0f79('0x1af')));hopperUtils[_0x0f79('0xe7')](_0x186706)['catch'](loggerCatch(_0x0f79('0x1b0')));if(_0x198cf9['checkRetriveMax'](0x14,_0x2dcc8f,_0x4ab911)&&!_0x1bdedf){if(_0x186706[_0x0f79('0x11a')]>=_0x4ab911[_0x0f79('0x194')]){_0x198cf9[_0x0f79('0x11f')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x1b1'));}else{_0x198cf9[_0x0f79('0x11c')](_0x186706,_0x2bc8f5,_0x587aec,_0x0f79('0x1b1'));}}break;default:_0x4ab911[_0x0f79('0x132')]+=0x1;_0x186706[_0x0f79('0x6c')]=0xc;_0x186706[_0x0f79('0xc6')]=_0x1b3ab6['reason'];_0x67f7c9=_0x4ab911[_0x0f79('0x195')];_0x55b8b7=_0x4ab911[_0x0f79('0xcc')];hopperUtils[_0x0f79('0xe7')](_0x186706)[_0x0f79('0x9b')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x198cf9[_0x0f79('0x187')](_0x1b3ab6[_0x0f79('0xbd')],_0x2dcc8f,_0x4ab911)&&!_0x1bdedf){if(_0x186706['countbusyretry']+_0x186706['countcongestionretry']+_0x186706[_0x0f79('0x188')]+_0x186706[_0x0f79('0x119')]+_0x186706[_0x0f79('0xc9')]+_0x186706['countabandonedretry']+_0x186706[_0x0f79('0x115')]+_0x186706[_0x0f79('0x11a')]>=_0x4ab911['dialGlobalMaxRetry']){_0x198cf9[_0x0f79('0x11c')](_0x186706,_0x2bc8f5,_0x587aec,_0x1b3ab6[_0x0f79('0xbd')]);}else{_0x198cf9[_0x0f79('0x11f')](_0x186706,_0x2bc8f5,_0x587aec,_0x1b3ab6[_0x0f79('0xbd')]);}}}})[_0x0f79('0x3b')](function(){if(_0x1bdedf){hopperUtils[_0x0f79('0xdc')](_0x186706,_0x67f7c9,_0x55b8b7)[_0x0f79('0x3b')](function(){return _0x2bc8f5(0x1);});}});});};Dialer[_0x0f79('0x7f')][_0x0f79('0x11c')]=function(_0x398816,_0x30203a,_0x5898d4,_0x1ca471){var _0x4f5ea0=new Final(_0x398816);_0x4f5ea0[_0x0f79('0x6c')]=0xf;_0x4f5ea0[_0x0f79('0xc6')]=_0x0f79('0x1b2');this['createStateFinal'](_0x4f5ea0,_0x30203a,_0x5898d4,_0x1ca471);};Dialer[_0x0f79('0x7f')][_0x0f79('0x11f')]=function(_0x4a6ad8,_0x2b4219,_0x33b021,_0xfa8c5){hopperUtils[_0x0f79('0xc2')](_0x4a6ad8)[_0x0f79('0x3b')](function(){return _0x2b4219(msgResponse(_0x0f79('0x197'),'Success',_0xfa8c5));})['catch'](function(){return _0x33b021(msgResponse(_0x0f79('0x1b3'),_0x0f79('0x8c'),_0x0f79('0x1b4')));});};Dialer[_0x0f79('0x7f')][_0x0f79('0xaa')]=function(_0x50eb59){var _0x508c65=_0x50eb59['dialPredictiveOptimizationPercentage']/0x64;var _0x3a8799=_0x50eb59[_0x0f79('0x1b5')]/(_0x50eb59[_0x0f79('0x1b5')]+_0x50eb59[_0x0f79('0xbc')]);var _0x29267f=Math['round'](_0x50eb59[_0x0f79('0x1b6')]*(_0x50eb59[_0x0f79('0x1b7')]/0x64));var _0x2c2f4a=Math[_0x0f79('0x1b8')](_0x50eb59[_0x0f79('0x1b6')]*(_0x50eb59[_0x0f79('0x1b9')]/0x64));var _0x213a00=_0x50eb59[_0x0f79('0x139')]+_0x50eb59['talking'];var _0x2038c0=Math[_0x0f79('0x1ba')](_0x50eb59[_0x0f79('0x1bb')]*_0x50eb59['erlangAbandonmentRate']*_0x50eb59[_0x0f79('0x1bc')]*_0x50eb59['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x50eb59[_0x0f79('0x5e')])){if(!_['isUndefined'](_0x50eb59[_0x0f79('0x24')])){_0x50eb59[_0x0f79('0x24')]=undefined;loggerPredictive[_0x0f79('0x61')](_0x0f79('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x0f79('0x3c')](_0x50eb59[_0x0f79('0x5f')])){loggerPredictive[_0x0f79('0x61')](_0x0f79('0x1bd'),_0x0f79('0x1be'));clearInterval(_0x50eb59['handlePredictive']);_0x50eb59[_0x0f79('0x5f')]=undefined;}_0x50eb59['startProgressive']=moment()[_0x0f79('0x82')](_0x0f79('0xbb'));loggerPredictive[_0x0f79('0x46')](_0x50eb59[_0x0f79('0x42')],_0x0f79('0x1bf'),_0x50eb59[_0x0f79('0x5e')]);this[_0x0f79('0xac')](_0x50eb59,0x1);}else if(ifInterval(_0x50eb59[_0x0f79('0x1c0')],_0x50eb59['startProgressive'])){this['handlePower'](_0x50eb59,0x1);loggerPredictiveCalls[_0x0f79('0x46')]('[startMethodPredictive][StartProgressive][Loop]',_0x50eb59[_0x0f79('0x5e')],_0x50eb59[_0x0f79('0x42')]);_0x50eb59[_0x0f79('0x1bb')]=0x0;_0x50eb59[_0x0f79('0x1c1')]=0x0;}else if(_0x508c65<_0x3a8799&&_0x50eb59[_0x0f79('0x1c2')]===_0x0f79('0x1c3')){clearPredictiveAttributes(_0x50eb59);loggerPredictive['info'](_0x0f79('0x1c4'),_0x0f79('0x1c5'),_0x3a8799,_0x0f79('0x5e'),_0x50eb59[_0x0f79('0x42')]);}else if(_0x2038c0<_0x50eb59['predictiveIntervalErlangCallsDroppedCalls']&&_0x50eb59['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x50eb59);loggerPredictive['info'](_0x0f79('0x1c6'),'Max\x20Drop\x20',_0x2038c0,_0x0f79('0x1c7'),_0x50eb59[_0x0f79('0x1c1')],_0x0f79('0x5e'),_0x50eb59[_0x0f79('0x42')]);}else if(!ifInterval(_0x50eb59[_0x0f79('0x1c0')],_0x50eb59[_0x0f79('0x5e')])&&_[_0x0f79('0x3c')](_0x50eb59[_0x0f79('0x24')])&&!_['isUndefined'](_0x50eb59[_0x0f79('0x5e')])){_0x50eb59[_0x0f79('0x24')]=moment()[_0x0f79('0x82')](_0x0f79('0xbb'));loggerPredictive[_0x0f79('0x46')](_0x50eb59[_0x0f79('0x42')],_0x0f79('0x1c8'),_0x50eb59[_0x0f79('0x24')]);hopperUtils[_0x0f79('0x1c9')](_0x50eb59[_0x0f79('0x1c0')])['then'](this['getDataPredictive'](_0x50eb59))[_0x0f79('0x3b')](mergeDataErlangB(_0x50eb59))[_0x0f79('0x3b')](this[_0x0f79('0x1ca')](_0x50eb59))[_0x0f79('0x9b')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x50eb59));}else if(!ifInterval(_0x50eb59[_0x0f79('0x1c0')],_0x50eb59[_0x0f79('0x24')])){_0x50eb59['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x50eb59[_0x0f79('0x24')]=moment()['format'](_0x0f79('0xbb'));loggerPredictive['info'](_0x50eb59[_0x0f79('0x42')],_0x0f79('0x1cb'),_0x50eb59['startPredictive']);clearInterval(_0x50eb59['handlePredictive']);_0x50eb59[_0x0f79('0x5f')]=undefined;hopperUtils[_0x0f79('0x1c9')](_0x50eb59[_0x0f79('0x1c0')])[_0x0f79('0x3b')](this[_0x0f79('0x1cc')](_0x50eb59))['then'](mergeDataErlangB(_0x50eb59))[_0x0f79('0x3b')](this[_0x0f79('0x1ca')](_0x50eb59))[_0x0f79('0x9b')](loggerCatchPredictive(_0x0f79('0x1cd'),_0x50eb59));}else if(_0x50eb59[_0x0f79('0x1b6')]&&_0x213a00<_0x50eb59[_0x0f79('0x1b6')]-_0x2c2f4a){clearPredictiveAttributes(_0x50eb59);loggerPredictive['info'](_0x50eb59[_0x0f79('0x42')],_0x0f79('0x1ce'),_0x213a00,_0x0f79('0x1cf'),_0x50eb59[_0x0f79('0x1b6')],'-',_0x2c2f4a,'=',_0x50eb59[_0x0f79('0x1b6')]-_0x2c2f4a,')');}else if(_0x50eb59[_0x0f79('0x1b6')]&&_0x213a00>_0x50eb59[_0x0f79('0x1b6')]+_0x29267f){clearPredictiveAttributes(_0x50eb59);loggerPredictive[_0x0f79('0x46')](_0x50eb59[_0x0f79('0x42')],_0x0f79('0x1ce'),_0x213a00,_0x0f79('0x1d0'),_0x50eb59[_0x0f79('0x1b6')],'+',_0x29267f,'=',_0x50eb59[_0x0f79('0x1b6')]+_0x29267f,')');}};Dialer[_0x0f79('0x7f')][_0x0f79('0x1cc')]=function(_0x1bdc0f){var _0x2c478a=this;return function(_0x3ae0e7){return new Promise(function(_0x44b640,_0x939042){_[_0x0f79('0xf0')](_0x1bdc0f,_0x3ae0e7[0x0]);if(checkGetDataPredictive(_0x3ae0e7[0x0])){var _0x17241c=_0x1bdc0f[_0x0f79('0x1b6')]=_0x1bdc0f[_0x0f79('0x1d1')]+_0x1bdc0f[_0x0f79('0x139')];var _0x2cefcd=_0x1bdc0f['dialPredictiveInterval']*0x3c;var _0x33fa61=_0x3ae0e7[0x0]['predictiveIntervalAvgTalktime']+_0x3ae0e7[0x0][_0x0f79('0x54')];var _0x5e7b26=(_0x3ae0e7[0x0][_0x0f79('0x4a')]+_0x3ae0e7[0x0][_0x0f79('0x4c')]+_0x3ae0e7[0x0][_0x0f79('0x4e')])/_0x3ae0e7[0x0][_0x0f79('0x48')];_0x1bdc0f['predictiveIntervalHitRate']=_0x5e7b26>0x0?_0x5e7b26:0x1;switch(_0x1bdc0f[_0x0f79('0x1c2')]){case _0x0f79('0x1c3'):var _0x20b472=_0x1bdc0f[_0x0f79('0x1d2')]/0x64;return _0x2c478a[_0x0f79('0x1d3')](_0x17241c,_0x2cefcd,_0x33fa61,_0x5e7b26,_0x20b472)['then'](function(_0x55e4ba){return _0x44b640(_0x55e4ba);});case _0x0f79('0x1d4'):var _0x282709=_0x1bdc0f['dialPredictiveOptimizationPercentage']/0x64;return _0x2c478a[_0x0f79('0x1d5')](_0x17241c,_0x2cefcd,_0x33fa61,_0x5e7b26,_0x282709)[_0x0f79('0x3b')](function(_0x2429c4){return _0x44b640(_0x2429c4);});default:return _0x939042(msgResponse(_0x0f79('0x1d6'),_0x0f79('0x8c'),_0x0f79('0x1d7')));}}else{return _0x939042(msgResponse('[getDataPredictive]',_0x0f79('0x8c'),'check\x20failure'));}});};};Dialer[_0x0f79('0x7f')][_0x0f79('0x1d8')]=function(_0x295ff9){var _0x273335=this;return function(_0xe09e87){return new Promise(function(_0x472f96,_0x1ba291){_[_0x0f79('0xf0')](_0x295ff9,_0xe09e87[0x0]);if(checkGetDataPredictive(_0xe09e87[0x0])){loggerPredictive[_0x0f79('0x46')](JSON[_0x0f79('0x70')](_0xe09e87[0x0]));if(_0x295ff9[_0x0f79('0x1c2')]===_0x0f79('0x1c3')){return _0x273335[_0x0f79('0x152')](_0x295ff9['id'])[_0x0f79('0x3b')](function(_0x3a3ca4){var _0x501cc6=_0x295ff9['loggedIn']-_0x3a3ca4[0x0][_0x0f79('0x1d9')];var _0x5dfdbf=_0x295ff9[_0x0f79('0x1c0')]*0x3c;var _0x187825=_0xe09e87[0x0][_0x0f79('0x51')]+_0xe09e87[0x0][_0x0f79('0x54')];var _0x526120=(_0xe09e87[0x0][_0x0f79('0x4a')]+_0xe09e87[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xe09e87[0x0][_0x0f79('0x4e')])/_0xe09e87[0x0][_0x0f79('0x48')];var _0x3085d0=_0x295ff9['dialPredictiveOptimizationPercentage']/0x64;_0x295ff9[_0x0f79('0x1da')]=_0x3a3ca4[0x0][_0x0f79('0x1d9')]||0x0;_0x295ff9[_0x0f79('0x1bc')]=_0x526120>0x0?_0x526120:0x1;return _0x273335[_0x0f79('0x1d3')](_0x501cc6,_0x5dfdbf,_0x187825,_0x526120,_0x3085d0);})['then'](function(_0x2eefe9){return _0x472f96(_0x2eefe9);})[_0x0f79('0x9b')](function(_0x48afa9){return _0x1ba291(msgResponse('[CatchErlangB]',_0x0f79('0x8c'),JSON[_0x0f79('0x70')](_0x48afa9)));});}if(_0x295ff9[_0x0f79('0x1c2')]===_0x0f79('0x1d4')){return _0x273335['getVoiceQueueRtPauses'](_0x295ff9['id'])[_0x0f79('0x3b')](function(_0x2e1c39){var _0x452c21=_0x295ff9[_0x0f79('0x1db')]-_0x2e1c39[0x0]['outboundQueuePauses'];var _0x1f60d1=_0x295ff9[_0x0f79('0x1c0')]*0x3c;var _0x16f698=_0xe09e87[0x0][_0x0f79('0x51')]+_0xe09e87[0x0]['predictiveIntervalAvgHoldtime'];var _0x180703=(_0xe09e87[0x0]['predictiveIntervalAnsweredCalls']+_0xe09e87[0x0][_0x0f79('0x4c')]+_0xe09e87[0x0][_0x0f79('0x4e')])/_0xe09e87[0x0][_0x0f79('0x48')];var _0x3b4fed=_0x295ff9[_0x0f79('0x1d2')]/0x64;_0x295ff9[_0x0f79('0x1da')]=_0x2e1c39[0x0][_0x0f79('0x1d9')]||0x0;_0x295ff9[_0x0f79('0x1bc')]=_0x180703>0x0?_0x180703:0x1;return _0x273335['busyFactor'](_0x452c21,_0x1f60d1,_0x16f698,_0x180703,_0x3b4fed);})[_0x0f79('0x3b')](function(_0x593fc8){return _0x472f96(_0x593fc8);})[_0x0f79('0x9b')](function(_0x1fc0a8){return _0x1ba291(msgResponse(_0x0f79('0x1dc'),_0x0f79('0x8c'),JSON[_0x0f79('0x70')](_0x1fc0a8)));});}}else{return _0x1ba291(msgResponse('[getDataPredictive]',_0x0f79('0x8c'),_0x0f79('0x1dd')));}});};};Dialer[_0x0f79('0x7f')][_0x0f79('0x1ca')]=function(_0x1700d2){var _0x3aa3af=this;return function(){var _0x50d6c3=0x0;var _0x501573=Math['floor'](_0x1700d2[_0x0f79('0x59')]*0x3e8);if(_0x501573>0x0){_0x501573=_0x501573<0x64?0x64:_0x501573;loggerPredictive[_0x0f79('0x46')](_0x1700d2['name'],'one\x20call\x20every:',_0x501573,_0x0f79('0x1de'));_0x1700d2[_0x0f79('0x5f')]=setInterval(function(){_0x3aa3af['handlePredictive'](_0x1700d2);loggerPredictiveCalls[_0x0f79('0x46')]('[handlePredictive]',_0x50d6c3+=0x1);},_0x501573);}else{loggerPredictive['info'](_0x1700d2[_0x0f79('0x42')],_0x0f79('0x1df'));}};};Dialer['prototype'][_0x0f79('0x1e0')]=function(_0x5f4820,_0x46ad37){var _0x14fd3e=this;return function(_0x479581){if(_[_0x0f79('0x44')](_0x479581)){if(_[_0x0f79('0xec')](_0x46ad37[_0x0f79('0x1e1')])||!_0x46ad37[_0x0f79('0x1e2')]){if(_0x5f4820[_0x0f79('0xa9')]===_0x0f79('0x8')){_0x5f4820[_0x0f79('0x6d')]=_['isUndefined'](_0x5f4820['queueStatusComplete'])?!![]:_0x5f4820[_0x0f79('0x6d')];var _0x1d6f0c=uuid['v4']();_0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c]=new Action(_0x5f4820,_0x46ad37,_0x1d6f0c);loggerBooked[_0x0f79('0x46')](_0x0f79('0x1e3'),_0x1d6f0c,'queueStatusComplete:\x20',JSON['stringify'](_0x5f4820['queueStatusComplete']),'Queue:\x20',_0x5f4820[_0x0f79('0x42')]);if(_0x5f4820[_0x0f79('0x6d')]){_0x5f4820[_0x0f79('0x6d')]=![];_0x14fd3e[_0x0f79('0x26')][_0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c][_0x0f79('0xb5')]]=[];ami['Action']({'actionid':_0x1d6f0c,'action':_0x0f79('0x1e4'),'queue':_0x5f4820[_0x0f79('0x42')]})['catch'](function(){_0x14fd3e[_0x0f79('0xb9')](_0x5f4820);hopperUtils[_0x0f79('0xd1')]({'active':![],'ContactId':_0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c][_0x0f79('0xe5')],'ListId':_0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c][_0x0f79('0xd3')],'VoiceQueueId':_0x14fd3e['actions'][_0x1d6f0c]['VoiceQueueId']||undefined,'CampaignId':_0x14fd3e['actions'][_0x1d6f0c][_0x0f79('0xd5')]||undefined})['catch'](loggerCatch(_0x0f79('0x1e5')));delete _0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c];});}else{loggerBooked[_0x0f79('0x46')](_0x0f79('0x1e6'),JSON[_0x0f79('0x70')](_0x5f4820['queueStatusComplete']),_0x0f79('0x1e7'),_0x5f4820[_0x0f79('0x42')]);_0x14fd3e['updateOriginated'](_0x5f4820);hopperUtils[_0x0f79('0xd1')]({'active':![],'ContactId':_0x14fd3e['actions'][_0x1d6f0c][_0x0f79('0xe5')],'ListId':_0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c][_0x0f79('0xd3')],'VoiceQueueId':_0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c][_0x0f79('0xd4')]||undefined,'CampaignId':_0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c][_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x14fd3e[_0x0f79('0xe9')][_0x1d6f0c];}}else{return _0x14fd3e[_0x0f79('0x1e8')](_0x5f4820,_0x46ad37);}}else{if(utils[_0x0f79('0xc3')](undefined,_0x46ad37[_0x0f79('0x1e9')])<_0x5f4820[_0x0f79('0x1ea')]*0x3c){if(_0x46ad37[_0x0f79('0x147')]&&!_0x46ad37[_0x0f79('0x147')]['voicePause']){_0x14fd3e['preview']['run'](_0x46ad37['id'])[_0x0f79('0x19')](function(){_0x14fd3e[_0x0f79('0xb9')](_0x5f4820);});}else{hopperUtils[_0x0f79('0x1eb')]({'active':![]},_0x46ad37['id'],0x1)['finally'](function(){_0x14fd3e[_0x0f79('0xb9')](_0x5f4820);});}}else{_0x5f4820['outboundReCallsDay']+=0x1;_0x14fd3e[_0x0f79('0xb9')](_0x5f4820);if(_0x5f4820[_0x0f79('0x1ec')]){hopperUtils[_0x0f79('0xd1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x46ad37[_0x0f79('0xe5')],'ListId':_0x46ad37['ListId'],'VoiceQueueId':_0x46ad37[_0x0f79('0xd4')]||undefined,'CampaignId':_0x46ad37[_0x0f79('0xd5')]||undefined})[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x1ed')));hopperUtils[_0x0f79('0xe7')](createObjHistory(_0x5f4820,_0x46ad37,utils[_0x0f79('0x67')]['QUEUE_RECALL'],0x17,_0x0f79('0x1ee')))[_0x0f79('0x9b')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x14fd3e[_0x0f79('0x110')](createObjHistory(_0x5f4820,_0x46ad37,utils['CAMPAIGN_STATUS'][_0x0f79('0x1ef')],0x16,_0x0f79('0x1f0')),_0x0f79('0x1f1'),_0x0f79('0x1f2'));}}}}else{_0x5f4820['outboundBlacklistCallsDay']+=0x1;_0x14fd3e[_0x0f79('0x110')](createObjHistory(_0x5f4820,_0x46ad37,utils[_0x0f79('0x67')][_0x0f79('0x1f3')],0xd,'Blacklist'),_0x0f79('0x1f4'),_0x0f79('0x1f5'));throw _0x0f79('0x1f6');}};};Dialer[_0x0f79('0x7f')][_0x0f79('0x1f7')]=function(_0x3a06b1){var _0x377aa4=this;var _0x169b2f=_0x3a06b1[_0x0f79('0x1f8')]-_0x3a06b1['originated'];emitCampaignSummary(_0x3a06b1);if(_0x169b2f>0x0&&_0x3a06b1[_0x0f79('0x64')]==0x0){if(_0x169b2f>this[_0x0f79('0x20')]){_0x169b2f=this[_0x0f79('0x20')];}_0x3a06b1[_0x0f79('0x64')]=0x1;hopperUtils['getContactDialerIvr'](_0x3a06b1,_0x169b2f)[_0x0f79('0x3b')](function(_0x18a16b){_0x3a06b1[_0x0f79('0x64')]=0x0;if(_0x18a16b){if(!utils[_0x0f79('0x1f9')](_0x18a16b)){_0x3a06b1[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x6a')];logger[_0x0f79('0x46')](_0x0f79('0x1fa')+_0x3a06b1['name']);}else{_0x3a06b1[_0x0f79('0x153')]+=_0x18a16b[_0x0f79('0x93')];_0x3a06b1[_0x0f79('0x66')]=utils[_0x0f79('0x67')]['RUNNING'];for(var _0x1b8da5=0x0;_0x1b8da5<_0x18a16b[_0x0f79('0x93')];_0x1b8da5+=0x1){_0x3a06b1['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x18a16b[_0x1b8da5])||_[_0x0f79('0xec')](_0x18a16b[_0x1b8da5][_0x0f79('0x1fb')])||_['isNil'](_0x18a16b[_0x1b8da5][_0x0f79('0x15c')])){_0x377aa4[_0x0f79('0x1fc')]('[actionOriginate]\x20',_0x3a06b1,_0x18a16b[_0x1b8da5]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x0f79('0x71')](_0x18a16b[_0x1b8da5],[_0x0f79('0xd5'),_0x0f79('0x15c')]))[_0x0f79('0x3b')](_0x377aa4['checkContactBlack'](_0x3a06b1,_0x18a16b[_0x1b8da5]))[_0x0f79('0x9b')](_0x377aa4[_0x0f79('0x1fd')](_0x0f79('0x1fe'),_0x3a06b1));}}}}})[_0x0f79('0x9b')](loggerGetContactDialer('[getContactCampaign2]',_0x3a06b1,_0x169b2f));}};Dialer[_0x0f79('0x7f')]['handlePower']=function(_0x2cadd8,_0x29c892){var _0x1c624a=this;var _0x2d547d=[];if(_0x29c892<0x1||_0x2cadd8[_0x0f79('0xa9')]===_0x0f79('0x8')){_0x29c892=0x1;}var _0x284ac6=Math[_0x0f79('0x1ba')](_0x2cadd8[_0x0f79('0x139')]*_0x29c892)-_0x2cadd8[_0x0f79('0x153')];if(_0x2cadd8[_0x0f79('0x1ff')]>0x0){var _0x500958=_0x2cadd8[_0x0f79('0x1ff')]-_0x2cadd8[_0x0f79('0x153')]-_0x2cadd8[_0x0f79('0x1d1')]-_0x2cadd8['pTalking'];if(_0x284ac6>_0x500958){_0x284ac6=_0x500958;}}if(_0x284ac6>0x0&&_0x2cadd8[_0x0f79('0x64')]==0x0){if(_0x2cadd8[_0x0f79('0xa9')]===_0x0f79('0x8')){_0x284ac6=0x1;}if(_0x284ac6>this[_0x0f79('0x20')]){_0x284ac6=this[_0x0f79('0x20')];}for(var _0xbf0f62 in this[_0x0f79('0x1e')]){if(typeof this['agents'][_0xbf0f62]!=='undefined'){if(this['agents'][_0xbf0f62][_0x0f79('0x6c')]===_0x0f79('0x200')&&this['agents'][_0xbf0f62][_0x0f79('0x84')]===_0x0f79('0x144')){_0x2d547d[_0x0f79('0x94')](this['agents'][_0xbf0f62]['id']);}}}_0x2cadd8[_0x0f79('0x64')]=0x1;hopperUtils[_0x0f79('0x201')](_0x2cadd8,_0x2d547d,_0x284ac6)[_0x0f79('0x3b')](function(_0x494d8a){_0x2cadd8[_0x0f79('0x64')]=0x0;if(_0x494d8a){if(!utils[_0x0f79('0x1f9')](_0x494d8a)){hopperUtils[_0x0f79('0x202')](_0x2cadd8)['then'](sendMessageReschedule(_0x2cadd8))[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x203')));}else{_0x2cadd8[_0x0f79('0x153')]+=_0x494d8a[_0x0f79('0x93')];_0x2cadd8[_0x0f79('0x66')]=_0x2cadd8[_0x0f79('0xa9')]===_0x0f79('0x8')?utils[_0x0f79('0x67')]['ACTIVE']:utils[_0x0f79('0x67')]['RUNNING'];for(var _0x21e4c0=0x0;_0x21e4c0<_0x494d8a[_0x0f79('0x93')];_0x21e4c0+=0x1){if(_[_0x0f79('0xec')](_0x494d8a[_0x21e4c0])||_['isNil'](_0x494d8a[_0x21e4c0][_0x0f79('0x1fb')])||_[_0x0f79('0xec')](_0x494d8a[_0x21e4c0][_0x0f79('0x15c')])){_0x1c624a[_0x0f79('0x1fc')](_0x0f79('0x204'),_0x2cadd8,_0x494d8a[_0x21e4c0]);}else{hopperUtils[_0x0f79('0x205')](_[_0x0f79('0x71')](_0x494d8a[_0x21e4c0],[_0x0f79('0xd4'),_0x0f79('0x15c')]))['then'](_0x1c624a[_0x0f79('0x1e0')](_0x2cadd8,_0x494d8a[_0x21e4c0]))[_0x0f79('0x9b')](_0x1c624a[_0x0f79('0x1fd')](_0x0f79('0x204'),_0x2cadd8));}}}}})[_0x0f79('0x9b')](loggerGetContactDialer(_0x0f79('0x206'),_0x2cadd8,_0x284ac6));}};Dialer[_0x0f79('0x7f')]['handlePredictive']=function(_0x489ece){if(_0x489ece[_0x0f79('0x1ff')]>0x0){var _0x4a786e=_0x489ece[_0x0f79('0x1ff')]-_0x489ece[_0x0f79('0x153')]-_0x489ece['talking'];if(_0x4a786e>0x0&&_0x489ece['temp']==0x0){this['tryOriginatePredictive'](_0x489ece);}else{loggerPredictiveCalls[_0x0f79('0x46')](_0x0f79('0x207'));}}else{this[_0x0f79('0x208')](_0x489ece);}};Dialer[_0x0f79('0x7f')][_0x0f79('0x208')]=function(_0x2934d2){var _0x460e5c=this;var _0x1b776e=[];_0x2934d2['originated']+=0x1;for(var _0x1a5359 in this['agents']){if(typeof this[_0x0f79('0x1e')][_0x1a5359]!==_0x0f79('0x14e')){if(this[_0x0f79('0x1e')][_0x1a5359][_0x0f79('0x6c')]==='not_inuse'&&this['agents'][_0x1a5359][_0x0f79('0x84')]===_0x0f79('0x144')){_0x1b776e[_0x0f79('0x94')](this[_0x0f79('0x1e')][_0x1a5359]['id']);}}}_0x2934d2[_0x0f79('0x64')]=0x1;return this[_0x0f79('0x201')](_0x2934d2['id'],_0x1b776e,0x1,_0x2934d2['dialOrderByScheduledAt'],_0x2934d2)[_0x0f79('0x3b')](function(_0x239ee1){_0x2934d2[_0x0f79('0x64')]=0x1;if(_0x239ee1){if(!utils[_0x0f79('0x1f9')](_0x239ee1)){utils[_0x0f79('0x63')](_0x2934d2,0x1,0x0);return hopperUtils[_0x0f79('0x202')](_0x2934d2)[_0x0f79('0x3b')](sendMessageReschedule(_0x2934d2))[_0x0f79('0x9b')](loggerCatch(_0x0f79('0x203')));}else{_0x2934d2[_0x0f79('0x66')]=utils[_0x0f79('0x67')][_0x0f79('0x209')];if(_[_0x0f79('0xec')](_0x239ee1[0x0])||_[_0x0f79('0xec')](_0x239ee1[0x0][_0x0f79('0x1fb')])||_[_0x0f79('0xec')](_0x239ee1[0x0][_0x0f79('0x15c')])){_0x460e5c[_0x0f79('0x1fc')](_0x0f79('0x204'),_0x2934d2,_0x239ee1[0x0]);}else{return hopperUtils[_0x0f79('0x205')](_[_0x0f79('0x71')](_0x239ee1[0x0],[_0x0f79('0xd4'),_0x0f79('0x15c')]))['then'](_0x460e5c[_0x0f79('0x1e0')](_0x2934d2,_0x239ee1[0x0]))[_0x0f79('0x9b')](_0x460e5c['loggerHandler'](_0x0f79('0x20a'),_0x2934d2));}}}})[_0x0f79('0x9b')](loggerGetContactDialer(_0x0f79('0x20b'),_0x2934d2,0x1));};Dialer[_0x0f79('0x7f')][_0x0f79('0x1d3')]=function(_0xdbd675,_0x59f570,_0x259592,_0x5c8957,_0x4765ca,_0xc54fc9){loggerPredictive[_0x0f79('0x46')](_0x0f79('0x20c'));loggerPredictive[_0x0f79('0x46')](_0x0f79('0x20d'),_0xdbd675);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x20e'),_0x59f570);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x20f'),_0x259592);loggerPredictive[_0x0f79('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',_0x5c8957);loggerPredictive['info'](_0x0f79('0x210'),_0x4765ca);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x52'));return new Promise(function(_0x50c1d4,_0x58bd55){if(_0xdbd675<=0x0||isNaN(_0xdbd675)){return _0x58bd55(msgResponse(_0x0f79('0x211'),_0x0f79('0x7e'),_0x0f79('0x212')+_0xdbd675));}if(_0x259592<=0x0||isNaN(_0x259592)){return _0x58bd55(msgResponse(_0x0f79('0x211'),'Error',_0x0f79('0x213')+_0x259592));}if(_0x5c8957<=0x0||isNaN(_0x5c8957)){return _0x58bd55(msgResponse(_0x0f79('0x211'),_0x0f79('0x7e'),_0x0f79('0x214')+_0x5c8957));}if(_0x59f570<=0x0||isNaN(_0x59f570)){return _0x58bd55(msgResponse(_0x0f79('0x211'),'Error',_0x0f79('0x215')+_0x59f570));}if(_0x4765ca<=0x0||isNaN(_0x4765ca)){return _0x58bd55(msgResponse(_0x0f79('0x211'),_0x0f79('0x7e'),_0x0f79('0x216')+_0x4765ca));}_0xc54fc9=_0xc54fc9||0x0;var _0x1818d6=0x1/_0x259592;var _0x259cd3=0x0;var _0x1c1cad=0x0;var _0x6a16fa=0x0;var _0x2d54ea=0x0;for(var _0x242017=0x0;_0x6a16fa<_0x4765ca;_0x242017+=0x1){_0x1c1cad=_0x242017/_0x59f570;_0x259cd3=(_0x5c8957*_0x1c1cad+_0xc54fc9)/_0x1818d6;_0x6a16fa=utils[_0x0f79('0x217')](_0x259cd3,_0xdbd675);_0x2d54ea=_0x259cd3/_0xdbd675*(0x1-utils[_0x0f79('0x217')](_0x259cd3,_0xdbd675));}return _0x50c1d4({'erlangCalls':_0x242017,'erlangCallToSecond':_0x59f570/_0x242017,'erlangAbandonmentRate':_0x6a16fa,'erlangBusyFactor':_0x2d54ea});});};Dialer[_0x0f79('0x7f')]['busyFactor']=function(_0xa73956,_0x125c4c,_0x530e8a,_0x3b54ba,_0x4b639e,_0x115f5c){loggerPredictive['info'](_0x0f79('0x218'));loggerPredictive[_0x0f79('0x46')]('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',_0xa73956);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x20e'),_0x125c4c);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x20f'),_0x530e8a);loggerPredictive['info']('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',_0x3b54ba);loggerPredictive[_0x0f79('0x46')](_0x0f79('0x219'),_0x4b639e);loggerPredictive['info'](_0x0f79('0x52'));return new Promise(function(_0x11dae2,_0x2e2870){if(_0xa73956<=0x0||isNaN(_0xa73956)){return _0x2e2870(msgResponse(_0x0f79('0x21a'),_0x0f79('0x7e'),_0x0f79('0x212')+_0xa73956));}if(_0x530e8a<=0x0||isNaN(_0x530e8a)){return _0x2e2870(msgResponse(_0x0f79('0x21a'),_0x0f79('0x7e'),_0x0f79('0x213')+_0x530e8a));}if(_0x3b54ba<=0x0||isNaN(_0x3b54ba)){return _0x2e2870(msgResponse('[busyFactor]',_0x0f79('0x7e'),_0x0f79('0x214')+_0x3b54ba));}if(_0x125c4c<=0x0||isNaN(_0x125c4c)){return _0x2e2870(msgResponse(_0x0f79('0x21a'),_0x0f79('0x7e'),_0x0f79('0x215')+_0x125c4c));}if(_0x4b639e<=0x0||isNaN(_0x4b639e)){return _0x2e2870(msgResponse(_0x0f79('0x21a'),_0x0f79('0x7e'),'Umin\x20=\x20'+_0x4b639e));}_0x115f5c=_0x115f5c||0x0;var _0x5d9e95=0x1/_0x530e8a;var _0x165062=0x0;var _0x1fb394=0x0;var _0x7aa884=0x0;var _0x48b709=0x0;for(var _0x49d8c0=0x0;_0x48b709<_0x4b639e;_0x49d8c0+=0x1){_0x1fb394=_0x49d8c0/_0x125c4c;_0x165062=(_0x3b54ba*_0x1fb394+_0x115f5c)/_0x5d9e95;_0x7aa884=utils[_0x0f79('0x217')](_0x165062,_0xa73956);_0x48b709=_0x165062/_0xa73956*(0x1-utils[_0x0f79('0x217')](_0x165062,_0xa73956));}return _0x11dae2({'erlangCalls':_0x49d8c0,'erlangCallToSecond':_0x125c4c/_0x49d8c0,'erlangAbandonmentRate':_0x7aa884,'erlangBusyFactor':_0x48b709});});};module[_0x0f79('0x21b')]=Dialer; \ No newline at end of file +var _0x4113=['[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','ListId','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','roundrobin','isNil','locked','status','paused','stateinterface','rrmemory','queueBooked','pick','[Catch][Preview][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','run','[booked][RR][finaly]','[booked][unlock]','rescheduleContact','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','custom:amd','saveInDb','MACHINE','Machine','AMD','countmachineretry','amd','buildObj','countbusyretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countagentrejectretry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','outboundUnknownCallsDay','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','talking','pTalking','ACTIVE','checkDialMethod','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','user:%s','clearZombieChannels','[uniqueid]','[actions]','sequence','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','Agent','user:dialPreviewRecallReminder','launchHandleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','outboundRejectCallsDay','AgentReject','agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[countReScheduled]\x20','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','erlangb','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/hangup','env','127.0.0.1','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','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','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','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','temp','message','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','Error','stringify','isTrunkReachable','SIP/%s','unmonitored','checkIsTrunkReachable','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','ifTime','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','catch','push','Action','timezones','content','true','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','undefined','resolve','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueId','uniqueid','ivr','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','updateOriginated','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','statedesc','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','VoiceQueueId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','createHistory'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x4113,0x147));var _0x3411=function(_0x3b86fb,_0xfb2c82){_0x3b86fb=_0x3b86fb-0x0;var _0x169c16=_0x4113[_0x3b86fb];return _0x169c16;};'use strict';var util=require('util');var _=require(_0x3411('0x0'));var uuid=require(_0x3411('0x1'));var moment=require(_0x3411('0x2'));var rr=require('rr');var Redis=require(_0x3411('0x3'));var utils=require(_0x3411('0x4'));var hopperUtils=require(_0x3411('0x5'));var ut=require(_0x3411('0x6'));var config=require('../../../config/environment/');var logger=require(_0x3411('0x7'))(_0x3411('0x8'));var loggerBooked=require(_0x3411('0x7'))(_0x3411('0x9'));var loggerPredictive=require('../../../config/logger')(_0x3411('0xa'));var loggerPredictiveCalls=require(_0x3411('0x7'))(_0x3411('0xb'));var loggerSyncQueueSummary=require(_0x3411('0x7'))(_0x3411('0xc'));var ami=require(_0x3411('0xd'));config[_0x3411('0xe')]=_[_0x3411('0xf')](config['redis'],{'host':_0x3411('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3411('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x3411('0x11'));var RpcSetting=require(_0x3411('0x12'));var Interval=require(_0x3411('0x13'));var Action=require(_0x3411('0x14'));var History=require(_0x3411('0x15'));var Final=require(_0x3411('0x16'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x3411('0x17'));var ipAgi=process[_0x3411('0x18')]['XCALLY_IP_AGI']||_0x3411('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3411('0x1a')]['enqueue']=function(_0x59ff75){this['tail']=this[_0x3411('0x1b')]?this[_0x3411('0x1b')][_0x3411('0x1c')](_0x59ff75):_0x59ff75();};function Dialer(_0x12b2a0,_0x311381){this['sequence']=new Sequence();this[_0x3411('0x1d')]=_0x311381;this[_0x3411('0x1e')]=_0x12b2a0['voiceQueues'];this[_0x3411('0x1f')]=_0x12b2a0['campaigns'];this[_0x3411('0x20')]=_0x12b2a0[_0x3411('0x20')];this['trunks']=_0x12b2a0[_0x3411('0x21')];this[_0x3411('0x22')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x3411('0x23')]={};this[_0x3411('0x24')]={};this['uniqueId']={};this['optionPredictive']={};this[_0x3411('0x25')]={};this[_0x3411('0x26')]={};this[_0x3411('0x27')]={};this['queueBooked']={};this[_0x3411('0x28')]={};this['queuesSummary']={};ami['on'](_0x3411('0x29'),this[_0x3411('0x2a')][_0x3411('0x2b')](this));ami['on'](_0x3411('0x2c'),this['syncQueueCallerAbandon'][_0x3411('0x2b')](this));ami['on'](_0x3411('0x2d'),this[_0x3411('0x2e')][_0x3411('0x2b')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x3411('0x2f'),this[_0x3411('0xc')][_0x3411('0x2b')](this));ami['on'](_0x3411('0x30'),this[_0x3411('0x31')][_0x3411('0x2b')](this));ami['on'](_0x3411('0x32'),this[_0x3411('0x33')][_0x3411('0x2b')](this));ami['on'](_0x3411('0x34'),this[_0x3411('0x35')][_0x3411('0x2b')](this));ami['on'](_0x3411('0x36'),this[_0x3411('0x37')][_0x3411('0x2b')](this));ami['on'](_0x3411('0x38'),this[_0x3411('0x39')][_0x3411('0x2b')](this));ami['on'](_0x3411('0x3a'),this[_0x3411('0x3b')][_0x3411('0x2b')](this));this[_0x3411('0x3c')]();this[_0x3411('0x3d')]();RpcSetting[_0x3411('0x3e')]()[_0x3411('0x3f')](function(_0xa1fd0c){previewRecallmeReminderInterval=_0xa1fd0c[_0x3411('0x40')];});}function isNotNull(_0x367e9c){return _0x367e9c!==null&&!_[_0x3411('0x41')](_0x367e9c);}function msgResponse(_0x3fe398,_0x57aba1,_0x24f710){return{'action':_0x3fe398,'response':_0x57aba1,'message':_0x24f710,'stack':_0x24f710};}function emit(_0x3d8933,_0x3941d7,_0x3fb85d){io['to'](_0x3d8933)[_0x3411('0x42')](_0x3941d7,_0x3fb85d);}function emitOutboundVoiceQueueSummary(_0x9aaf82){if(_0x9aaf82[_0x3411('0x43')]===_0x3411('0x44')){logger[_0x3411('0x45')](_0x3411('0x46'),util[_0x3411('0x47')](_0x9aaf82,{'showHidden':![],'depth':null}));emit(util[_0x3411('0x48')](_0x3411('0x49'),_0x9aaf82[_0x3411('0x4a')]),_0x3411('0x4b'),_0x9aaf82);}}function checkGetDataPredictive(_0x5781a8){if(isNotNull(_0x5781a8)&&!_[_0x3411('0x4c')](_0x5781a8)){loggerPredictive[_0x3411('0x4d')](_0x3411('0x4e'));loggerPredictive[_0x3411('0x4d')](_0x3411('0x4f'),_0x5781a8[_0x3411('0x50')]);loggerPredictive[_0x3411('0x4d')](_0x3411('0x51'),_0x5781a8['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x3411('0x4d')](_0x3411('0x52'),_0x5781a8[_0x3411('0x53')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5781a8[_0x3411('0x54')]);loggerPredictive[_0x3411('0x4d')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5781a8[_0x3411('0x55')]);loggerPredictive[_0x3411('0x4d')](_0x3411('0x56'),_0x5781a8['predictiveIntervalAvgTalktime']);loggerPredictive[_0x3411('0x4d')](_0x3411('0x57'));if(_0x5781a8['predictiveIntervalTotalCalls']>0x0){if(!_[_0x3411('0x41')](_0x5781a8[_0x3411('0x58')])&&_0x5781a8['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x3411('0x4d')](_0x3411('0x59'));if(!_[_0x3411('0x41')](_0x5781a8['predictiveIntervalAvgHoldtime'])&&_0x5781a8[_0x3411('0x55')]>0x0){return!![];}loggerPredictive[_0x3411('0x4d')](_0x3411('0x5a'));}else{loggerPredictive[_0x3411('0x4d')](_0x3411('0x5b'));}}else{loggerPredictive['info'](_0x3411('0x5c'));}return![];}function mergeDataErlangB(_0x5c5781){return function(_0x1624a9){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1624a9[_0x3411('0x5d')]);loggerPredictive[_0x3411('0x4d')](_0x3411('0x5e'),_0x1624a9[_0x3411('0x5f')]);loggerPredictive[_0x3411('0x4d')](_0x3411('0x60'),_0x1624a9['erlangAbandonmentRate']);loggerPredictive[_0x3411('0x4d')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1624a9['erlangBusyFactor']);loggerPredictive[_0x3411('0x4d')](_0x3411('0x60'),_0x1624a9['erlangAbandonmentRate']);loggerPredictive[_0x3411('0x4d')](_0x3411('0x57'));_['merge'](_0x5c5781,_0x1624a9);};}function ifInterval(_0x29c78,_0x4a9e96){if(_[_0x3411('0x41')](_0x4a9e96)){return![];}return utils[_0x3411('0x61')](undefined,_0x4a9e96)<_0x29c78*0x3c;}function clearPredictiveAttributes(_0x2c0746){if(_0x2c0746[_0x3411('0x26')]){_0x2c0746[_0x3411('0x26')]=undefined;loggerPredictive[_0x3411('0x45')](_0x2c0746[_0x3411('0x4a')],_0x3411('0x62'));}if(_0x2c0746['startPredictive']){_0x2c0746[_0x3411('0x25')]=undefined;loggerPredictive['debug'](_0x2c0746['name'],_0x3411('0x63'));}if(_0x2c0746['handlePredictive']){clearInterval(_0x2c0746[_0x3411('0x64')]);_0x2c0746[_0x3411('0x64')]=undefined;loggerPredictive[_0x3411('0x45')](_0x2c0746[_0x3411('0x4a')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x3ced1c,_0x3b6adf){return function(_0x5f523d){loggerPredictive[_0x3411('0x65')](_0x3b6adf[_0x3411('0x4a')],_0x3ced1c);loggerPredictive['error'](_0x5f523d[_0x3411('0x66')]);clearPredictiveAttributes(_0x3b6adf);};}function loggerCatch(_0x2a32d3){return function(_0xb7c2ad){logger['error'](_0x2a32d3,util['inspect'](_0xb7c2ad,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1c3910,_0x5baf66,_0x3f42cd){return function(_0x4d4c70){utils['checkContactLowerLimitOriginate'](_0x5baf66,_0x3f42cd,0x0);_0x5baf66[_0x3411('0x67')]=0x0;logger['error'](_0x1c3910,util['inspect'](_0x4d4c70,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5e7cce){return function(_0x4cbc85){if(isNotNull(_0x4cbc85)&&isNotNull(_0x4cbc85[0x0])){if(_0x4cbc85[0x0]['contactsRescheduled']>0x0){_0x5e7cce[_0x3411('0x68')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger['info'](_0x3411('0x69')+_0x5e7cce[_0x3411('0x4a')],_0x4cbc85[0x0][_0x3411('0x6a')],_0x3411('0x6b'));}else{_0x5e7cce['message']=utils[_0x3411('0x6c')][_0x3411('0x6d')];logger[_0x3411('0x4d')](_0x3411('0x6e')+_0x5e7cce[_0x3411('0x4a')]);}}};}function createObjHistory(_0x44bc4a,_0x3b00c9,_0x414634,_0x722c67,_0x53bd8f){_0x44bc4a[_0x3411('0x68')]=_0x414634;var _0x37f501=new Action(_0x44bc4a,_0x3b00c9);var _0x3741b4=new History(_0x37f501);_0x3741b4['state']=_0x722c67;_0x3741b4['statedesc']=_0x53bd8f;_0x3741b4[_0x3411('0x6f')]=_0x37f501['starttime'];return _0x3741b4;}function unlockQueueStatus(_0x15ad05,_0x1c897e){setTimeout(function(){if(_[_0x3411('0x41')](_0x15ad05[_0x3411('0x70')])){loggerBooked[_0x3411('0x65')](_0x3411('0x71'),_0x1c897e);}_0x15ad05[_0x3411('0x70')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x1c897e,JSON['stringify'](_['pick'](_0x15ad05,[_0x3411('0x4a'),_0x3411('0x70')])));},0x1f3);}function checkInterval(_0x103c4f){return function(){if(!isNotNull(_0x103c4f['Interval'])){_0x103c4f[_0x3411('0x68')]=utils[_0x3411('0x6c')][_0x3411('0x72')];throw _0x103c4f[_0x3411('0x4a')]+_0x3411('0x73');}if(!isNotNull(_0x103c4f[_0x3411('0x74')]['Intervals'])){_0x103c4f[_0x3411('0x68')]=utils[_0x3411('0x6c')][_0x3411('0x72')];throw _0x103c4f[_0x3411('0x4a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x3411('0x4c')](_0x103c4f[_0x3411('0x74')][_0x3411('0x75')]))){_0x103c4f[_0x3411('0x68')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x103c4f[_0x3411('0x4a')]+_0x3411('0x73');}};}function checkIsIVRCampaignActive(_0xb5e3ba){return function(){if(!utils[_0x3411('0x76')](_0xb5e3ba)){_0xb5e3ba[_0x3411('0x68')]=utils[_0x3411('0x6c')][_0x3411('0x77')];throw _0xb5e3ba[_0x3411('0x4a')]+_0x3411('0x78');}};}function emitCampaignSummary(_0x44b991){if(utils[_0x3411('0x79')](_0x44b991)){emit(util[_0x3411('0x48')](_0x3411('0x7a'),_0x44b991[_0x3411('0x4a')]),_0x3411('0x7b'),_0x44b991);}}function loggerCatchQueueSummary(_0x10434e,_0x2d0739){return function(_0x32f78d){clearPredictiveAttributes(_0x2d0739);emitCampaignSummary(_0x2d0739);loggerSyncQueueSummary[_0x3411('0x45')](_0x10434e,util[_0x3411('0x47')](_0x32f78d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4a1193){if(_0x4a1193[_0x3411('0x7c')]){if(_0x4a1193[_0x3411('0x7d')]===0x0){_0x4a1193[_0x3411('0x7c')]=![];_0x4a1193[_0x3411('0x68')]=utils[_0x3411('0x6c')][_0x3411('0x77')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4a1193[_0x3411('0x4a')],_0x3411('0x7e'));}else{_0x4a1193[_0x3411('0x68')]=utils[_0x3411('0x6c')][_0x3411('0x7f')];loggerSyncQueueSummary[_0x3411('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4a1193[_0x3411('0x4a')],'is\x20disactive');}emitCampaignSummary(_0x4a1193);}}function myreject(_0x53f804){return function(_0x5ecc87){return _0x53f804(msgResponse('[ifTime][Action]',_0x3411('0x80'),JSON[_0x3411('0x81')](_0x5ecc87)));};}Dialer[_0x3411('0x1a')][_0x3411('0x82')]=function(_0xac20aa){return!_[_0x3411('0x41')](_0xac20aa)&&_0xac20aa&&!_[_0x3411('0x41')](_0xac20aa[_0x3411('0x4a')])&&!_[_0x3411('0x41')](_0xac20aa['active'])&&_0xac20aa['active']&&(this[_0x3411('0x21')][util['format'](_0x3411('0x83'),_0xac20aa[_0x3411('0x4a')])]['status']==='reachable'||this[_0x3411('0x21')][util[_0x3411('0x48')](_0x3411('0x83'),_0xac20aa[_0x3411('0x4a')])]['status']===_0x3411('0x84'));};Dialer[_0x3411('0x1a')][_0x3411('0x85')]=function(_0xe7f5f3){var _0x3b1203=this;return function(){if(!_0x3b1203['isTrunkReachable'](_0xe7f5f3['Trunk'])){if(!_0x3b1203[_0x3411('0x82')](_0xe7f5f3['TrunkBackup'])){_0xe7f5f3[_0x3411('0x68')]=utils['CAMPAIGN_STATUS'][_0x3411('0x86')];throw _0xe7f5f3[_0x3411('0x4a')]+_0x3411('0x87');}}};};Dialer[_0x3411('0x1a')][_0x3411('0x88')]=function(_0x2504b8,_0x4273cc,_0x16756f,_0x1cba4c){var _0x272946=this;return function(){var _0x3eafbe=!![];return _0x272946[_0x3411('0x89')](_0x2504b8,_0x4273cc,_0x16756f,_0x1cba4c,_0x3eafbe);};};Dialer[_0x3411('0x1a')]['checkIfTimeIntervals']=function(_0x5b11e7,_0x221fe7,_0x588125,_0x233f0f){var _0x2a56a2=this;return function(){var _0xe93cf2=![];return _0x2a56a2[_0x3411('0x89')](_0x5b11e7[_0x3411('0x75')],_0x221fe7,_0x588125,_0x233f0f,_0xe93cf2);};};Dialer[_0x3411('0x1a')][_0x3411('0x89')]=function(_0x1c8300,_0x2d341a,_0x56ac2e,_0x249a25,_0x182bc2){var _0x402465=[];return new Promise(function(_0x32023a,_0x5d39b8){if(!isNotNull(_0x1c8300)){_0x249a25['message']=utils[_0x3411('0x6c')][_0x3411('0x72')];return _0x5d39b8(msgResponse('ifTime',_0x3411('0x8a'),_0x56ac2e+_0x3411('0x8b')));}if(_['isEmpty'](_0x1c8300)){_0x249a25[_0x3411('0x68')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x5d39b8(msgResponse(_0x3411('0x8c'),_0x3411('0x8a'),_0x56ac2e+_0x3411('0x8d')));}if(_0x2d341a&&_[_0x3411('0x41')](config['timezones'][_0x2d341a])){_0x249a25['message']=utils[_0x3411('0x6c')]['UNKNOWN_TIMEZONE'];return _0x5d39b8(msgResponse('ifTime',_0x3411('0x8a'),_0x56ac2e+_0x3411('0x8e')+_0x2d341a));}if(_[_0x3411('0x8f')](_0x1c8300)){for(var _0x6e2a53=0x0;_0x6e2a53<_0x1c8300['length'];_0x6e2a53+=0x1){_0x402465['push'](ami['Action']({'action':_0x3411('0x90'),'command':util[_0x3411('0x48')](_0x3411('0x91'),_0x1c8300[_0x6e2a53][_0x3411('0x92')],!_[_0x3411('0x41')](config['timezones'][_0x2d341a])?_0x2d341a:'')})['then'](function(_0x4b1b3e){return _0x4b1b3e['content'][_0x3411('0x93')]('true')>=0x0;})[_0x3411('0x94')](myreject(_0x5d39b8)));}}else{_0x402465[_0x3411('0x95')](ami[_0x3411('0x96')]({'action':'command','command':util[_0x3411('0x48')](_0x3411('0x91'),_0x1c8300,!_['isUndefined'](config[_0x3411('0x97')][_0x2d341a])?_0x2d341a:'')})[_0x3411('0x3f')](function(_0x3365f1){return _0x3365f1[_0x3411('0x98')][_0x3411('0x93')](_0x3411('0x99'))>=0x0;})[_0x3411('0x94')](myreject(_0x5d39b8)));}Promise[_0x3411('0x9a')](_0x402465)[_0x3411('0x3f')](function(_0x3d7255){var _0x5c4a84=_['some'](_0x3d7255);if(_0x5c4a84){return _0x32023a(_0x5c4a84);}else{_0x249a25['message']=_0x182bc2?utils['CAMPAIGN_STATUS'][_0x3411('0x9b')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x5d39b8(msgResponse(_0x3411('0x9c'),_0x3411('0x8a'),_0x3411('0x9d')+_0x182bc2+'\x20'+_0x56ac2e+_0x3411('0x9e')+util['inspect'](_0x1c8300,{'showHidden':![],'depth':null})+_0x3411('0x9f')+_0x2d341a));}})[_0x3411('0x94')](function(_0x1e8b34){return _0x5d39b8(msgResponse(_0x3411('0x8c'),'Failure',JSON[_0x3411('0x81')](_0x1e8b34)));});});};Dialer[_0x3411('0x1a')][_0x3411('0x3c')]=function(){var _0x9d05a8=this;return cmHopper[_0x3411('0xa0')]({'active':![]},{'where':{'active':!![]}})[_0x3411('0x3f')](function(){setInterval(function(){_0x9d05a8['syncCampaigns']();},0x3e8);});};Dialer[_0x3411('0x1a')]['syncCampaigns']=function(){var _0x9dbaae=this;var _0x1bbb0f;for(var _0x2465b3 in this[_0x3411('0x1f')]){if(typeof this['campaigns'][_0x2465b3]!==_0x3411('0xa1')){_0x1bbb0f=this[_0x3411('0x1f')][_0x2465b3];if(utils['isIVRCampaign'](_0x1bbb0f)&&utils[_0x3411('0x76')](_0x1bbb0f)){_0x1bbb0f['sendMessageOneNotActive']=!![];Promise[_0x3411('0xa2')]()[_0x3411('0x3f')](checkIsIVRCampaignActive(_0x1bbb0f))[_0x3411('0x3f')](checkInterval(_0x1bbb0f))[_0x3411('0x3f')](_0x9dbaae['checkIsTrunkReachable'](_0x1bbb0f))['then'](_0x9dbaae[_0x3411('0x88')](_0x1bbb0f[_0x3411('0xa3')],_0x1bbb0f['dialTimezone'],_0x1bbb0f[_0x3411('0x4a')],_0x1bbb0f))[_0x3411('0x3f')](_0x9dbaae[_0x3411('0xa4')](_0x1bbb0f['Interval'],_0x1bbb0f[_0x3411('0xa5')],_0x1bbb0f[_0x3411('0x4a')],_0x1bbb0f))[_0x3411('0x3f')](_0x9dbaae['launchHandleIvr'](_0x1bbb0f))['catch'](loggerCatchQueueSummary(_0x3411('0xa6'),_0x1bbb0f));}else{notSendMessagesCampaign(_0x1bbb0f);}}}};Dialer[_0x3411('0x1a')]['checkDialMethod']=function(_0x889f27){if(_0x889f27[_0x3411('0xa7')]!==_0x3411('0xa')){clearPredictiveAttributes(_0x889f27);}switch(_0x889f27['dialMethod']){case _0x3411('0xa8'):this[_0x3411('0xa9')](_0x889f27,0x1);break;case _0x3411('0xaa'):this[_0x3411('0xa9')](_0x889f27,_0x889f27[_0x3411('0xab')]);break;case _0x3411('0xa'):this[_0x3411('0xa')](_0x889f27);break;case _0x3411('0x9'):this[_0x3411('0xa9')](_0x889f27,0x1);break;default:logger[_0x3411('0x65')](_0x3411('0xac'),_0x889f27[_0x3411('0x4a')],_0x3411('0xad'));}};Dialer[_0x3411('0x1a')][_0x3411('0x8c')]=function(_0x2c6fe6,_0x78c1c9){var _0x14b594=_0x2c6fe6[_0x3411('0xa5')];var _0x3a1440=_0x78c1c9?_0x2c6fe6[_0x3411('0xa3')]:_0x2c6fe6[_0x3411('0x74')][_0x3411('0x75')];logger[_0x3411('0xae')](_0x3411('0xaf'),_0x3a1440,_0x14b594,_0x2c6fe6[_0x3411('0x4a')],util[_0x3411('0x48')](_0x3411('0xb0'),_0x2c6fe6[_0x3411('0x4a')],_0x2c6fe6['id']));var _0x1092ed=null;return Interval[_0x3411('0xb1')](_0x3a1440,_0x14b594)[_0x3411('0x3f')](function(_0x4103e1){if(_0x4103e1===!![]){return _0x4103e1;}else{_0x2c6fe6['message']=_0x78c1c9?utils['CAMPAIGN_STATUS'][_0x3411('0x9b')]:utils[_0x3411('0x6c')]['OVERTIME_INTERVAL'];_0x1092ed=msgResponse('[ifTime][promiseAll]','Failure',_0x3411('0x9d')+_0x78c1c9+'\x20'+_0x2c6fe6['name']+_0x3411('0x9e')+util[_0x3411('0x47')](_0x3a1440,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x14b594);}if(_0x1092ed!==null){logger[_0x3411('0xae')](_0x3411('0xb2'),_0x1092ed);_0x1092ed[_0x3411('0xb3')]=_0x78c1c9;throw _0x1092ed;}})[_0x3411('0x94')](function(_0x432646){logger[_0x3411('0x65')](_0x3411('0xb4'),_0x432646);throw msgResponse(_0x3411('0xb5'),'Error',util[_0x3411('0x47')](_0x432646,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x11add7){if(this['voiceQueues'][_0x11add7[_0x3411('0xb6')]]){if(this[_0x3411('0xb7')][_0x11add7[_0x3411('0xb8')]]&&this[_0x3411('0xb7')][_0x11add7['uniqueid']][_0x3411('0x43')]!==_0x3411('0xb9')){this['updateOriginated'](this[_0x3411('0x1e')][_0x11add7[_0x3411('0xb6')]]);this['uniqueId'][_0x11add7[_0x3411('0xb8')]]['answertime']=moment()[_0x3411('0x48')](_0x3411('0xba'));}}};Dialer[_0x3411('0x1a')][_0x3411('0xbb')]=function(_0x191328){var _0x5305df=this['uniqueId'][_0x191328[_0x3411('0xb8')]];if(this[_0x3411('0x1e')][_0x191328['queue']]){if(_0x5305df&&_0x5305df[_0x3411('0x43')]!=='ivr'){delete this[_0x3411('0xb7')][_0x191328['uniqueid']];this[_0x3411('0x1e')][_0x191328[_0x3411('0xb6')]][_0x3411('0xbc')]+=0x1;var _0x76dbdf=new AgentComplete(_0x5305df,_0x191328);if(_0x191328[_0x3411('0xbd')]===_0x3411('0xbe')){_0x76dbdf['agiafterat']=this[_0x3411('0x1e')][_0x191328[_0x3411('0xb6')]]['dialQueueProject2']&&this[_0x3411('0x1e')][_0x191328[_0x3411('0xb6')]]['dialAgiAfterHangupAgent']?moment()[_0x3411('0x48')](_0x3411('0xba')):undefined;}hopperUtils['createHistory'](_0x76dbdf)[_0x3411('0x94')](loggerCatch(_0x3411('0xbf')));hopperUtils[_0x3411('0xc0')](_0x76dbdf)['catch'](loggerCatch(_0x3411('0xc1')));}}};Dialer[_0x3411('0x1a')][_0x3411('0xc2')]=function(_0xa82e3a){var _0x508480=this[_0x3411('0xb7')][_0xa82e3a['uniqueid']];var _0x2361bc=this;var _0x855023=![];var _0x4815fa;var _0x3b2381;if(this[_0x3411('0x1e')][_0xa82e3a[_0x3411('0xb6')]]){if(_0x508480&&_0x508480['type']!==_0x3411('0xb9')){delete this['uniqueId'][_0xa82e3a[_0x3411('0xb8')]];this[_0x3411('0xc3')](this['voiceQueues'][_0xa82e3a['queue']]);_0x508480['droptime']=moment()[_0x3411('0x48')](_0x3411('0xba'));var _0x8bf586=new QueueCallerAbandon(_0x508480,_0xa82e3a);if(utils[_0x3411('0x61')](_0x508480[_0x3411('0xc4')],_0x508480[_0x3411('0xc5')])>=_0x508480['dialQueueTimeout']){this[_0x3411('0x1e')][_0xa82e3a[_0x3411('0xb6')]][_0x3411('0x53')]+=0x1;this[_0x3411('0x1e')][_0xa82e3a[_0x3411('0xb6')]][_0x3411('0xc6')]+=0x1;this[_0x3411('0x1e')][_0xa82e3a['queue']][_0x3411('0xc7')]+=0x1;_0x8bf586[_0x3411('0xc8')]=0xa;_0x8bf586[_0x3411('0xc9')]=_0x3411('0xca');_0x8bf586[_0x3411('0xcb')]=_0x3411('0xcc');_0x8bf586['agiafterat']=this[_0x3411('0x1e')][_0xa82e3a[_0x3411('0xb6')]]['dialQueueProject2']?moment()[_0x3411('0x48')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x8bf586[_0x3411('0xcd')]+=0x1;_0x8bf586['countglobal']+=0x1;_0x4815fa=this[_0x3411('0x1e')][_0xa82e3a['queue']][_0x3411('0xce')];_0x3b2381=this[_0x3411('0x1e')][_0xa82e3a[_0x3411('0xb6')]][_0x3411('0xcf')];hopperUtils[_0x3411('0xd0')](_0x8bf586,_0x8bf586[_0x3411('0xc8')],_0x508480[_0x3411('0xd1')])[_0x3411('0x3f')](function(_0x1a82cd){_0x855023=_0x1a82cd[_0x3411('0xd2')]==0x1;if(_0x8bf586['countdropretry']>=_0x2361bc[_0x3411('0x1e')][_0xa82e3a['queue']][_0x3411('0xd3')]){_0x2361bc[_0x3411('0xd4')](_0x8bf586,_0x1a82cd['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x8bf586[_0x3411('0xcd')],'scheduledat':moment()[_0x3411('0xd5')](_0x2361bc['voiceQueues'][_0xa82e3a['queue']][_0x3411('0xce')],_0x3411('0xd6'))[_0x3411('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x508480[_0x3411('0xd7')],'ListId':_0x508480['ListId'],'VoiceQueueId':_0x508480[_0x3411('0xd8')]||undefined,'CampaignId':_0x508480['CampaignId']||undefined})['catch'](loggerCatch(_0x3411('0xd9')));var _0x14453c=new History(_0x8bf586);_0x14453c[_0x3411('0xc8')]=0xa;_0x14453c[_0x3411('0xc9')]=_0x3411('0xca');_0x14453c[_0x3411('0xda')]=moment()[_0x3411('0x48')](_0x3411('0xba'));_0x14453c[_0x3411('0x6f')]=_0x14453c['starttime'];_0x14453c[_0x3411('0xdb')]=_0x8bf586[_0x3411('0xdb')];_0x14453c[_0x3411('0xdc')]=_0x8bf586['calleridnum'];hopperUtils[_0x3411('0xdd')](_0x14453c)['catch'](loggerCatch(_0x3411('0xde')));}})[_0x3411('0x3f')](function(){if(_0x855023)hopperUtils['swapAdditionalPhones'](_0x8bf586,_0x4815fa,_0x3b2381)[_0x3411('0x3f')](function(){return 0x1;});});}else{this['voiceQueues'][_0xa82e3a[_0x3411('0xb6')]][_0x3411('0x54')]+=0x1;this[_0x3411('0x1e')][_0xa82e3a[_0x3411('0xb6')]][_0x3411('0xdf')]+=0x1;_0x8bf586[_0x3411('0xc8')]=0xb;_0x8bf586[_0x3411('0xc9')]='Abandoned';_0x8bf586[_0x3411('0xcb')]=_0x3411('0xe0');_0x8bf586[_0x3411('0xe1')]+=0x1;_0x8bf586[_0x3411('0xe2')]+=0x1;_0x4815fa=this[_0x3411('0x1e')][_0xa82e3a['queue']][_0x3411('0xe3')];_0x3b2381=this['voiceQueues'][_0xa82e3a['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3411('0xd0')](_0x8bf586,_0x8bf586[_0x3411('0xc8')],_0x508480[_0x3411('0xd1')])[_0x3411('0x3f')](function(_0x27c25e){if(_0x8bf586[_0x3411('0xe1')]>=_0x2361bc[_0x3411('0x1e')][_0xa82e3a['queue']]['dialAbandonedMaxRetry']){_0x2361bc['queueCallerAbandonCreateState'](_0x8bf586,_0x27c25e[_0x3411('0xd2')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x8bf586[_0x3411('0xe1')],'scheduledat':moment()[_0x3411('0xd5')](_0x2361bc[_0x3411('0x1e')][_0xa82e3a['queue']][_0x3411('0xe3')],'minutes')[_0x3411('0x48')](_0x3411('0xba')),'ContactId':_0x508480['ContactId'],'ListId':_0x508480[_0x3411('0xe4')],'VoiceQueueId':_0x508480[_0x3411('0xd8')]||undefined,'CampaignId':_0x508480[_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch(_0x3411('0xe6')));var _0xdecfea=new History(_0x8bf586);_0xdecfea[_0x3411('0xc8')]=0xb;_0xdecfea[_0x3411('0xc9')]='Abandoned';_0xdecfea[_0x3411('0xda')]=moment()[_0x3411('0x48')](_0x3411('0xba'));_0xdecfea['endtime']=_0xdecfea[_0x3411('0xda')];_0xdecfea[_0x3411('0xdb')]=_0x8bf586[_0x3411('0xdb')];_0xdecfea['calleridnum']=_0x8bf586['calleridnum'];hopperUtils[_0x3411('0xdd')](_0xdecfea)['catch'](loggerCatch(_0x3411('0xe7')));}})[_0x3411('0x3f')](function(){if(_0x855023)hopperUtils[_0x3411('0xe8')](_0x8bf586,_0x4815fa,_0x3b2381)['then'](function(){return 0x1;});});}}}};Dialer[_0x3411('0x1a')][_0x3411('0x35')]=function(_0x142b67){if(this['actions'][_0x142b67[_0x3411('0xb8')]]){this['actions'][_0x142b67[_0x3411('0xb8')]][_0x3411('0xe9')]=_0x142b67[_0x3411('0xe9')];}if(this[_0x3411('0xb7')][_0x142b67['uniqueid']]){this[_0x3411('0xb7')][_0x142b67['uniqueid']][_0x3411('0xe9')]=_0x142b67['channel'];}};Dialer[_0x3411('0x1a')][_0x3411('0x39')]=function(_0x2e439a){if(!this[_0x3411('0x23')][_0x2e439a[_0x3411('0xea')]]){return;}var _0x19de45=this['voiceQueues'][this[_0x3411('0x23')][_0x2e439a[_0x3411('0xea')]][_0x3411('0xb6')]][_0x3411('0xeb')]||'rrmemory';if(_0x19de45===_0x3411('0xec')){if(this[_0x3411('0x23')][_0x2e439a[_0x3411('0xea')]]&&_[_0x3411('0xed')](this[_0x3411('0x23')][_0x2e439a[_0x3411('0xea')]][_0x3411('0xee')])&&_0x2e439a[_0x3411('0xef')]==='1'&&_0x2e439a[_0x3411('0xf0')]==='0'){if(this['agents'][_0x2e439a[_0x3411('0xf1')]]){if(!this['agents'][_0x2e439a[_0x3411('0xf1')]]['locked']){this[_0x3411('0x20')][_0x2e439a[_0x3411('0xf1')]][_0x3411('0xee')]=!![];this[_0x3411('0x23')][_0x2e439a['actionid']][_0x3411('0xee')]=!![];this['actions'][_0x2e439a[_0x3411('0xea')]][_0x3411('0xf1')]=_0x2e439a['stateinterface'];}}}}else if(_0x19de45===_0x3411('0xf2')){if(this[_0x3411('0x23')][_0x2e439a[_0x3411('0xea')]]){if(this[_0x3411('0x20')][_0x2e439a[_0x3411('0xf1')]]){this[_0x3411('0x23')][_0x2e439a[_0x3411('0xea')]][_0x3411('0xf1')]=_0x2e439a[_0x3411('0xf1')];if(_[_0x3411('0xed')](this[_0x3411('0xf3')][this[_0x3411('0x23')][_0x2e439a['actionid']][_0x3411('0xb6')]])){this['queueBooked'][this['actions'][_0x2e439a[_0x3411('0xea')]]['queue']]=[];}this[_0x3411('0xf3')][this['actions'][_0x2e439a[_0x3411('0xea')]]['queue']][_0x3411('0x95')](_['merge'](_[_0x3411('0xf4')](this[_0x3411('0x23')][_0x2e439a[_0x3411('0xea')]],['idHopper',_0x3411('0xf1')]),{'status':_0x2e439a[_0x3411('0xef')],'paused':_0x2e439a[_0x3411('0xf0')]}));}}}};Dialer['prototype'][_0x3411('0x3b')]=function(_0x2e0b03){if(!this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]]){return;}var _0x48b846=this;var _0x467432=this[_0x3411('0x1e')][this['actions'][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]];var _0xc19ce3=_0x467432[_0x3411('0xeb')]||'rrmemory';if(_0xc19ce3===_0x3411('0xec')){if(this['actions'][_0x2e0b03[_0x3411('0xea')]]&&this['actions'][_0x2e0b03['actionid']]['stateinterface']){this[_0x3411('0x1d')]['run'](this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]]['idHopper'],this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xf1')])[_0x3411('0x94')](function(_0x1dc7a0){logger[_0x3411('0x65')](_0x3411('0xf5'),util[_0x3411('0x47')](_0x1dc7a0,{'showHidden':![],'depth':null}));})['finally'](function(){_0x48b846[_0x3411('0xc3')](_0x48b846['voiceQueues'][_0x48b846[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]]);_0x48b846[_0x3411('0x20')][_0x48b846['actions'][_0x2e0b03['actionid']][_0x3411('0xf1')]][_0x3411('0xee')]=![];delete _0x48b846['actions'][_0x2e0b03[_0x3411('0xea')]];unlockQueueStatus(_0x467432);});}else{this[_0x3411('0xc3')](this[_0x3411('0x1e')][this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xd7')],'ListId':this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xe4')],'VoiceQueueId':this[_0x3411('0x23')][_0x2e0b03['actionid']][_0x3411('0xd8')]||undefined,'CampaignId':this[_0x3411('0x23')][_0x2e0b03['actionid']][_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]];unlockQueueStatus(_0x467432);}}else if(_0xc19ce3==='rrmemory'){var _0x5bafe1;if(this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]]&&!_[_0x3411('0x4c')](this['queueBooked'][this['actions'][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]])){if(this[_0x3411('0x28')][_0x48b846[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]]){this[_0x3411('0x28')][_0x48b846[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]]['queue']]=this[_0x3411('0x28')][this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]]['queue']]?this[_0x3411('0x28')][this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]]:this[_0x3411('0xf3')][this[_0x3411('0x23')][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]]?this[_0x3411('0xf3')][this['actions'][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]][_0x3411('0xf6')]||0x0:0x0;}this[_0x3411('0xf3')][this['actions'][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]]['_rr']=this[_0x3411('0x28')][this['actions'][_0x2e0b03[_0x3411('0xea')]][_0x3411('0xb6')]];for(var _0x3529f0=0x0;_0x3529f0=_0x553385[_0x3411('0x11b')]){_0x382bf4[_0x3411('0x11c')](_0x3cf411,_0x368fdc,_0x13f0f3,'reason19\x20machine....');}else{if(_0x3cf411['countmachineretry']>=_0x553385[_0x3411('0x11d')]){_0x382bf4[_0x3411('0x11e')](_0x3cf411,_0x368fdc,_0x13f0f3,_0x3411('0x11f'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3cf411[_0x3411('0x115')],'scheduledat':moment()[_0x3411('0xd5')](_0x553385['dialMachineRetryFrequency'],'minutes')[_0x3411('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3cf411[_0x3411('0xd7')],'ListId':_0x3cf411[_0x3411('0xe4')],'VoiceQueueId':_0x3cf411[_0x3411('0xd8')]||undefined,'CampaignId':_0x3cf411[_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch('[rescheduleContact][Machine]'));_0x368fdc({'reschedule':0x1});}}});}if(_0x6879df[_0x3411('0x43')]==='ivr'&&this[_0x3411('0x1f')][_0x6879df[_0x3411('0xb6')]][_0x3411('0x10b')]&&_0x4e4510[_0x3411('0x10c')]===_0x3411('0x10d')){delete this[_0x3411('0xb7')][_0x4e4510[_0x3411('0xb8')]];this[_0x3411('0xc3')](this[_0x3411('0x1f')][_0x6879df['queue']]);_0x345ad3=new Hangup(_0x6879df,_0x4e4510);_0x345ad3[_0x3411('0xc8')]=0x12;_0x345ad3[_0x3411('0xc9')]=_0x3411('0x120');_0x345ad3[_0x3411('0x10f')]=_0x3411('0x114');ami[_0x3411('0x42')](_0x3411('0x110'),ut[_0x3411('0x117')](_0x345ad3,_0x3411('0x116')));this[_0x3411('0x111')](_0x345ad3,_0x3411('0x121'),_0x3411('0x122'));}if(_0x6879df[_0x3411('0x43')]===_0x3411('0xb9')&&this[_0x3411('0x1f')][_0x6879df[_0x3411('0xb6')]]['dialAMDActive']&&_0x4e4510[_0x3411('0x10c')]===_0x3411('0x112')){return new Promise(function(_0x42e1ce,_0x22029f){delete _0x382bf4['uniqueId'][_0x4e4510[_0x3411('0xb8')]];_0x382bf4[_0x3411('0xc3')](_0x382bf4[_0x3411('0x1f')][_0x6879df[_0x3411('0xb6')]]);_0x382bf4[_0x3411('0x1f')][_0x6879df[_0x3411('0xb6')]][_0x3411('0xbc')]+=0x1;_0x382bf4[_0x3411('0x1f')][_0x6879df[_0x3411('0xb6')]][_0x3411('0x10e')]+=0x1;var _0x232187=_0x382bf4[_0x3411('0x1f')][_0x6879df[_0x3411('0xb6')]];var _0x3fcd6d=new Hangup(_0x6879df,_0x4e4510);_0x3fcd6d[_0x3411('0xc8')]=0x13;_0x3fcd6d['statedesc']=_0x3411('0x113');_0x3fcd6d[_0x3411('0x10f')]=_0x3411('0x114');_0x3fcd6d[_0x3411('0x115')]+=0x1;_0x3fcd6d[_0x3411('0xe2')]+=0x1;_0x3fcd6d[_0x3411('0x116')]=!![];ami[_0x3411('0x42')](_0x3411('0x110'),ut[_0x3411('0x117')](_0x3fcd6d,_0x3411('0x116')));hopperUtils[_0x3411('0xdd')](_0x3fcd6d)[_0x3411('0x94')](loggerCatch(_0x3411('0x123')));if(_0x3fcd6d[_0x3411('0x118')]+_0x3fcd6d['countcongestionretry']+_0x3fcd6d[_0x3411('0x119')]+_0x3fcd6d[_0x3411('0x11a')]+_0x3fcd6d['countdropretry']+_0x3fcd6d[_0x3411('0xe1')]+_0x3fcd6d['countmachineretry']+_0x3fcd6d[_0x3411('0x124')]>=_0x232187[_0x3411('0x11b')]){_0x382bf4[_0x3411('0x11c')](_0x3fcd6d,_0x42e1ce,_0x22029f,'reason19\x20machine....');}else{if(_0x3fcd6d[_0x3411('0x115')]>=_0x232187[_0x3411('0x11d')]){_0x382bf4[_0x3411('0x11e')](_0x3fcd6d,_0x42e1ce,_0x22029f,'reason\x2019\x20machine....');}else{hopperUtils[_0x3411('0x100')]({'active':![],'countmachineretry':_0x3fcd6d[_0x3411('0x115')],'scheduledat':moment()[_0x3411('0xd5')](_0x232187[_0x3411('0x125')],_0x3411('0xd6'))[_0x3411('0x48')](_0x3411('0xba')),'ContactId':_0x3fcd6d[_0x3411('0xd7')],'ListId':_0x3fcd6d[_0x3411('0xe4')],'VoiceQueueId':_0x3fcd6d['VoiceQueueId']||undefined,'CampaignId':_0x3fcd6d[_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch('[rescheduleContact][Machine]'));_0x42e1ce({'reschedule':0x1});}}});}}};Dialer[_0x3411('0x1a')][_0x3411('0x33')]=function(_0x255dc2){var _0x352cfa=this[_0x3411('0xb7')][_0x255dc2['uniqueid']];var _0x438dad;if(_0x352cfa&&_0x352cfa['type']==='ivr'){delete this[_0x3411('0xb7')][_0x255dc2[_0x3411('0xb8')]];this['updateOriginated'](this[_0x3411('0x1f')][_0x352cfa[_0x3411('0xb6')]]);this[_0x3411('0x1f')][_0x352cfa[_0x3411('0xb6')]][_0x3411('0x126')]+=0x1;_0x438dad=new Hangup(_0x352cfa,_0x255dc2);hopperUtils[_0x3411('0xdd')](_0x438dad)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x3411('0xc0')](_0x438dad)[_0x3411('0x94')](loggerCatch(_0x3411('0x127')));}if(_0x352cfa&&_0x352cfa[_0x3411('0x43')]!==_0x3411('0xb9')&&isNotNull(this[_0x3411('0x1e')][_0x352cfa['queue']][_0x3411('0x128')])){delete this['uniqueId'][_0x255dc2[_0x3411('0xb8')]];this['updateOriginated'](this[_0x3411('0x1e')][_0x352cfa[_0x3411('0xb6')]]);this['voiceQueues'][_0x352cfa[_0x3411('0xb6')]][_0x3411('0xbc')]+=0x1;this[_0x3411('0x1e')][_0x352cfa[_0x3411('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;_0x438dad=new Hangup(_0x352cfa,_0x255dc2);_0x438dad[_0x3411('0xc8')]=0x10;_0x438dad[_0x3411('0xc9')]=_0x3411('0x129');_0x438dad[_0x3411('0x10f')]=_0x3411('0x12a');hopperUtils['createHistory'](_0x438dad)[_0x3411('0x94')](loggerCatch(_0x3411('0x12b')));hopperUtils[_0x3411('0xc0')](_0x438dad)[_0x3411('0x94')](loggerCatch('[syncHangupIvr]'));}if(_0x352cfa&&_0x352cfa['type']!=='ivr'&&!isNotNull(this['voiceQueues'][_0x352cfa['queue']][_0x3411('0x128')])){if(_0x255dc2[_0x3411('0x12c')]==='Normal\x20Clearing'){delete this[_0x3411('0xb7')][_0x255dc2['uniqueid']];this[_0x3411('0x1e')][_0x352cfa[_0x3411('0xb6')]]['outboundAnswerCallsDay']+=0x1;const _0x3f1e86=new AgentComplete(_0x352cfa,_0x255dc2);_0x3f1e86[_0x3411('0xe5')]=this['voiceQueues'][_0x352cfa[_0x3411('0xb6')]]['id'];hopperUtils[_0x3411('0xdd')](_0x3f1e86)[_0x3411('0x94')](loggerCatch(_0x3411('0xbf')));hopperUtils[_0x3411('0xc0')](_0x3f1e86)[_0x3411('0x94')](loggerCatch('[syncAgentComplete]'));}else{delete this['uniqueId'][_0x255dc2[_0x3411('0xb8')]];this[_0x3411('0xc3')](this[_0x3411('0x1e')][_0x352cfa[_0x3411('0xb6')]]);this['voiceQueues'][_0x352cfa[_0x3411('0xb6')]][_0x3411('0x12d')]+=0x1;_0x438dad=new Hangup(_0x352cfa,_0x255dc2);_0x438dad['state']=0xc;_0x438dad[_0x3411('0xc9')]=_0x255dc2[_0x3411('0x12c')];_0x438dad[_0x3411('0x10f')]=_0x3411('0x12e');hopperUtils[_0x3411('0xdd')](_0x438dad)[_0x3411('0x94')](loggerCatch(_0x3411('0x12b')));hopperUtils[_0x3411('0xc0')](_0x438dad)[_0x3411('0x94')](loggerCatch('[syncHangupIvr]'));}}};Dialer['prototype'][_0x3411('0xc')]=function(_0x7476cc){var _0x18da97=this;if(!_0x18da97['queuesSummary'][_0x7476cc[_0x3411('0x4a')]]){_0x18da97[_0x3411('0x12f')][_0x7476cc[_0x3411('0x4a')]]={'running':![]};}else if(_0x18da97['queuesSummary'][_0x7476cc[_0x3411('0x4a')]][_0x3411('0x130')]===!![]){return;}else if(_0x18da97['queuesSummary'][_0x7476cc[_0x3411('0x4a')]][_0x3411('0x130')]===![]){_0x18da97[_0x3411('0x12f')][_0x7476cc[_0x3411('0x4a')]]['running']=!![];}var _0x3ab56d=_0x18da97[_0x3411('0x1e')][_0x7476cc[_0x3411('0x4a')]];var _0x3994c5=_0x3ab56d[_0x3411('0x68')]!==utils[_0x3411('0x6c')][_0x3411('0x77')];var _0x310539=utils[_0x3411('0x131')](_0x3ab56d);_0x3ab56d[_0x3411('0x132')]=utils[_0x3411('0x133')](_0x3ab56d,_0x18da97[_0x3411('0x21')]);Promise[_0x3411('0xa2')]()[_0x3411('0x3f')](function(){if(_0x3ab56d[_0x3411('0x132')]===utils[_0x3411('0x6c')][_0x3411('0x77')]){if(_0x3994c5){clearPredictiveAttributes(_0x3ab56d);_0x7476cc[_0x3411('0x25')]=undefined;_0x7476cc[_0x3411('0x26')]=undefined;}if(_0x3ab56d[_0x3411('0x132')]===utils['CAMPAIGN_STATUS'][_0x3411('0x77')]){_0x7476cc['available']=0x0;_0x7476cc['paused']=0x0;_0x7476cc[_0x3411('0x134')]=0x0;_0x7476cc[_0x3411('0x135')]=0x0;_0x7476cc[_0x3411('0x136')]=0x0;}}else if(_0x3ab56d['statusMessage']===utils[_0x3411('0x6c')][_0x3411('0x137')]&&!_0x310539){return _0x18da97[_0x3411('0x8c')](_0x3ab56d,!![])[_0x3411('0x3f')](function(){return _0x18da97[_0x3411('0x8c')](_0x3ab56d,![]);})[_0x3411('0x3f')](function(){return _0x18da97[_0x3411('0x138')](_0x3ab56d);})[_0x3411('0x94')](function(_0x202edb){loggerSyncQueueSummary[_0x3411('0x45')]('[syncQueueSummary]',util[_0x3411('0x47')](_0x202edb,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3ab56d);});}else{clearPredictiveAttributes(_0x3ab56d);}})[_0x3411('0x3f')](function(){var _0x720583=_0x7476cc[_0x3411('0x139')](_0x3ab56d);if(_0x720583||_0x3ab56d['queueSummaryCountersUpdated']){_0x3ab56d[_0x3411('0x13a')]=![];_0x7476cc[_0x3411('0x13b')](_0x3ab56d);Object[_0x3411('0x13c')](_0x3ab56d,_0x7476cc);emitOutboundVoiceQueueSummary(_0x7476cc);}_0x18da97[_0x3411('0x12f')][_0x3ab56d['name']][_0x3411('0x130')]=![];})[_0x3411('0x94')](function(_0x3ce3d9){logger['error'](_0x3411('0x13d'),util[_0x3411('0x47')](_0x3ce3d9,{'showHidden':![],'depth':null}));_0x18da97['queuesSummary'][_0x3ab56d[_0x3411('0x4a')]]['running']=![];});};Dialer[_0x3411('0x1a')][_0x3411('0x31')]=_[_0x3411('0x13e')](function(){var _0x552448=_[_0x3411('0x13f')](this[_0x3411('0x1e')],function(_0x4d9889){return _0x4d9889[_0x3411('0x140')];});var _0x16ce2e=_[_0x3411('0x13f')](this[_0x3411('0x20')],function(_0xcd4593){return _0xcd4593[_0x3411('0x141')]&&_0xcd4593['status']===_0x3411('0x142');});if(_0x552448[_0x3411('0xf7')]>0x0&&_0x16ce2e[_0x3411('0xf7')]>0x0){return Promise['resolve']()[_0x3411('0x3f')](cmHopper[_0x3411('0x143')](_[_0x3411('0x144')](_0x552448,'id'),previewRecallmeReminderInterval,_[_0x3411('0x144')](_0x16ce2e,'id')))[_0x3411('0x3f')](function(_0x56abc8){for(var _0x4587cf=0x0;_0x4587cf<_0x56abc8['length'];_0x4587cf++){var _0x261b99=_0x56abc8[_0x4587cf]['Agent'][_0x3411('0x4a')];if(_0x261b99)io['to'](util[_0x3411('0x48')](_0x3411('0x145'),_0x261b99))[_0x3411('0x42')]('user:dialPreviewRecallReminder',{'hopper':_0x56abc8[_0x4587cf]});}})['catch'](function(_0x31f4ed){logger[_0x3411('0x65')]('checkPreviewRecallReminder',_0x31f4ed);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3411('0x1a')][_0x3411('0x3d')]=function(){var _0x22ef83=this;setInterval(function(){_0x22ef83[_0x3411('0x146')](_0x22ef83['uniqueId'],_0x3411('0x147'));_0x22ef83[_0x3411('0x146')](_0x22ef83[_0x3411('0x23')],_0x3411('0x148'));},0x32c8);};Dialer[_0x3411('0x1a')]['clearZombieChannels']=function(_0x5e8697,_0x1db7ba){var _0x26d2d1=this;for(var _0x5c7b0e in _0x5e8697){if(typeof _0x5e8697[_0x5c7b0e]!=='undefined'){this[_0x3411('0x149')]['enqueue'](function(){if(!_[_0x3411('0xed')](_0x5e8697[_0x5c7b0e])){return ami['Action']({'action':_0x3411('0xef'),'channel':_0x5e8697[_0x5c7b0e]['channel']})[_0x3411('0x94')](function(_0x17f382){if(_0x17f382['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5e8697[_0x5c7b0e]&&_0x5e8697[_0x5c7b0e][_0x3411('0x43')]!==_0x3411('0xb9')){_0x26d2d1[_0x3411('0xc3')](_0x26d2d1[_0x3411('0x1e')][_0x5e8697[_0x5c7b0e]['queue']]);logger[_0x3411('0x65')]('[Dialer][checkChannel]',_0x1db7ba,_0x5c7b0e,_0x5e8697[_0x5c7b0e][_0x3411('0xb6')]);delete _0x5e8697[_0x5c7b0e];}if(_0x5e8697[_0x5c7b0e]&&_0x5e8697[_0x5c7b0e]['type']===_0x3411('0xb9')){_0x26d2d1[_0x3411('0xc3')](_0x26d2d1['campaigns'][_0x5e8697[_0x5c7b0e]['queue']]);logger[_0x3411('0x65')](_0x3411('0x14a'),_0x1db7ba,_0x5c7b0e,_0x5e8697[_0x5c7b0e][_0x3411('0xb6')]);delete _0x5e8697[_0x5c7b0e];}},0x2328);}});}});}}};Dialer[_0x3411('0x1a')][_0x3411('0x14b')]=function(_0x2fb438){return Promise[_0x3411('0xa2')]()[_0x3411('0x3f')](voiceQueueRt['getVoiceQueueRtPauses'](_0x2fb438))[_0x3411('0x94')](loggerCatch(_0x3411('0x14c')));};Dialer[_0x3411('0x1a')][_0x3411('0xc3')]=function(_0x2bc18a){if(!_['isUndefined'](_0x2bc18a)&&_0x2bc18a!==null){if(typeof _0x2bc18a[_0x3411('0x7d')]!=='undefined'){if(_0x2bc18a[_0x3411('0x7d')]>0x0){_0x2bc18a[_0x3411('0x7d')]-=0x1;}else{logger['error'](_0x3411('0x14d'));}}}else{logger[_0x3411('0x65')](_0x3411('0x14e'));}};Dialer[_0x3411('0x1a')][_0x3411('0x14f')]=function(_0x443d1b,_0x49bfe6){var _0x3afa66=this;return function(_0x4a0f55){_0x3afa66[_0x3411('0xc3')](_0x49bfe6);logger[_0x3411('0x65')](_0x443d1b,util[_0x3411('0x47')](_0x4a0f55,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x3411('0x150')]=function(_0x368707,_0x5c5b4b,_0x1bcbae){var _0x33c480={'state':0x19,'statedesc':_0x3411('0x151')};this['updateOriginated'](_0x5c5b4b);this['saveInDb'](_[_0x3411('0x152')](_0x33c480,_[_0x3411('0xf4')](_0x1bcbae,['ContactId',_0x3411('0xe4'),_0x3411('0x153'),'VoiceQueueId',_0x3411('0xe5')])),'[emptyContact][createHistory]',_0x3411('0x154'));logger[_0x3411('0x65')](_0x368707);};Dialer[_0x3411('0x1a')]['saveInDb']=function(_0x3b8380,_0x11b433,_0x13958d){hopperUtils['createHistory'](_0x3b8380)[_0x3411('0x94')](loggerCatch(_0x11b433));hopperUtils[_0x3411('0xc0')](_0x3b8380)[_0x3411('0x94')](loggerCatch(_0x13958d));};Dialer[_0x3411('0x1a')][_0x3411('0xd4')]=function(_0x216b7c,_0x3da4b2){hopperUtils[_0x3411('0xdd')](_0x216b7c)[_0x3411('0x94')](loggerCatch(_0x3411('0xbf')));if(_0x3da4b2==0x0){hopperUtils['moveContactManagedDialer'](_0x216b7c)[_0x3411('0x94')](loggerCatch(_0x3411('0x155')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x514a70){return Promise[_0x3411('0xa2')]()[_0x3411('0x3f')](cmHopper[_0x3411('0x143')](_0x514a70['id'],previewRecallmeReminderInterval))[_0x3411('0x3f')](function(_0x24a472){for(var _0x288ec7=0x0;_0x288ec7<_0x24a472['length'];_0x288ec7++){var _0x294d36=_0x24a472[_0x288ec7][_0x3411('0x156')]['name'];if(_0x294d36)io['to'](util[_0x3411('0x48')](_0x3411('0x145'),_0x294d36))['emit'](_0x3411('0x157'),{'hopper':_0x24a472[_0x288ec7]});}})['catch'](function(){});};Dialer[_0x3411('0x1a')][_0x3411('0x158')]=function(_0x18dac6){var _0x292caf=this;return function(){_0x292caf['handleIvr'](_0x18dac6);};};Dialer[_0x3411('0x1a')][_0x3411('0x159')]=function(_0x45fada,_0x30cc0d){var _0x1258f6=this;var _0x38fd9c=uuid['v4']();this[_0x3411('0x23')][_0x38fd9c]=new Action(_0x45fada,_0x30cc0d,_0x38fd9c);return new Promise(function(_0x7276c1,_0x1355f0){if(_[_0x3411('0x41')](_0x45fada)&&typeof _0x45fada!==_0x3411('0x15a')){return _0x1355f0(msgResponse(_0x3411('0x15b'),_0x3411('0x8a'),'voiceQueue\x20is\x20undefine'));}if(_[_0x3411('0x41')](_0x30cc0d[_0x3411('0x15c')])||_0x30cc0d[_0x3411('0x15c')]===null){return _0x1355f0(msgResponse(_0x3411('0x15b'),_0x3411('0x8a'),_0x3411('0x15d')));}var _0x31ce80={'XMD-CALLERID':_0x1258f6[_0x3411('0x23')][_0x38fd9c][_0x3411('0x15e')](),'XMD-AGI':_0x45fada[_0x3411('0x128')]?util[_0x3411('0x48')](_0x3411('0x15f'),ipAgi,_0x45fada[_0x3411('0x128')]):_0x3411('0x160'),'XMD-AGIAFTER':_0x45fada[_0x3411('0x161')]?util[_0x3411('0x48')](_0x3411('0x15f'),ipAgi,_0x45fada[_0x3411('0x161')]):'NONE','XMD-QUEUE':utils[_0x3411('0x162')](_0x45fada)?util['format'](_0x3411('0x163'),_0x45fada[_0x3411('0x4a')],_0x45fada['dialQueueOptions']||'',_0x45fada[_0x3411('0x164')]?'c':'',_0x45fada[_0x3411('0x165')]||0x3):_0x3411('0x160'),'XMD-CONTACTID':_0x30cc0d[_0x3411('0xd7')],'XMD-CDRTYPE':_0x3411('0x8'),'CALLERID(all)':_0x1258f6[_0x3411('0x23')][_0x38fd9c]['getCaller'](),'XMD-AMD':_0x45fada[_0x3411('0x10b')]?_0x3411('0x137'):_0x3411('0x160'),'XMD-DESTINATION':_0x3411('0x10a')};if(_0x45fada['dialAMDActive']){_0x31ce80[_0x3411('0x166')]=_0x45fada[_0x3411('0x167')]||0x9c4;_0x31ce80[_0x3411('0x168')]=_0x45fada[_0x3411('0x169')]||0x5dc;_0x31ce80['XMD-AMDAFTERGREETINGSILENCE']=_0x45fada[_0x3411('0x16a')]||0x320;_0x31ce80[_0x3411('0x16b')]=_0x45fada['dialAMDTotalAnalysisTime']||0x1388;_0x31ce80[_0x3411('0x16c')]=_0x45fada['dialAMDMinWordLength']||0x64;_0x31ce80[_0x3411('0x16d')]=_0x45fada[_0x3411('0x16e')]||0x32;_0x31ce80[_0x3411('0x16f')]=_0x45fada[_0x3411('0x170')]||0x3;_0x31ce80['XMD-AMDSILENCETHRESHOLD']=_0x45fada[_0x3411('0x171')]||0x100;_0x31ce80[_0x3411('0x172')]=_0x45fada[_0x3411('0x173')]||0x1388;}if(utils['isOutboundQueue'](_0x45fada)){_0x31ce80[_0x3411('0x174')]=_0x30cc0d[_0x3411('0xd8')];}else{_0x31ce80['XMD-CAMPAIGNID']=_0x30cc0d[_0x3411('0xe5')];}var _0xac3d96=utils[_0x3411('0x175')](_0x30cc0d[_0x3411('0x176')]);Object[_0x3411('0x13c')](_0x31ce80,_0xac3d96);var _0x3933f9=_0x1258f6[_0x3411('0x82')](_0x45fada[_0x3411('0x177')])?utils[_0x3411('0x178')](_0x45fada['Trunk'][_0x3411('0x179')],_0x45fada[_0x3411('0x17a')],_0x45fada[_0x3411('0x17b')]>0x0?utils[_0x3411('0x17c')](_0x45fada[_0x3411('0x17d')],_0x45fada[_0x3411('0x17b')]):_0x45fada[_0x3411('0x17d')]):utils[_0x3411('0x178')](_['isNil'](_0x45fada[_0x3411('0x17e')])?_0x45fada[_0x3411('0x177')]['callerid']:_0x45fada['TrunkBackup'][_0x3411('0x179')],_0x45fada[_0x3411('0x17a')],_0x45fada[_0x3411('0x17b')]>0x0?utils[_0x3411('0x17c')](_0x45fada['dialOriginateCallerIdNumber'],_0x45fada[_0x3411('0x17b')]):_0x45fada[_0x3411('0x17d')]);if(_0x3933f9){_0x31ce80['XMD-ORIGINATECALLERIDNAME']=_0x1258f6['actions'][_0x38fd9c]['originatecalleridname']=utils[_0x3411('0x17f')](_0x3933f9);_0x31ce80[_0x3411('0x180')]=_0x30cc0d[_0x3411('0x15c')];}_0x45fada['variables']=_0x31ce80;return ami[_0x3411('0x96')]({'actionid':_0x38fd9c,'action':_0x3411('0x15b'),'channel':_0x1258f6[_0x3411('0x82')](_0x45fada[_0x3411('0x177')])?util[_0x3411('0x48')](_0x3411('0x181'),_0x45fada['Trunk']['name'],isNotNull(_0x45fada[_0x3411('0x182')])?_0x45fada[_0x3411('0x182')][_0x3411('0x183')]()||'':'',_0x45fada[_0x3411('0x184')]>0x0?_0x30cc0d[_0x3411('0x15c')][_0x3411('0x185')](_0x45fada[_0x3411('0x184')]):_0x30cc0d['phone']):util[_0x3411('0x48')](_0x3411('0x181'),_[_0x3411('0xed')](_0x45fada[_0x3411('0x17e')])?_0x45fada[_0x3411('0x177')][_0x3411('0x4a')]:_0x45fada[_0x3411('0x17e')][_0x3411('0x4a')],isNotNull(_0x45fada[_0x3411('0x182')])?_0x45fada[_0x3411('0x182')][_0x3411('0x183')]()||'':'',_0x45fada['dialCutDigit']>0x0?_0x30cc0d['phone'][_0x3411('0x185')](_0x45fada[_0x3411('0x184')]):_0x30cc0d['phone']),'callerid':_0x3933f9,'Exten':_0x3411('0x10a'),'Context':_0x3411('0x186'),'Priority':'1','variable':_0x31ce80,'timeout':(_0x45fada[_0x3411('0x187')]||0x1e)*0x3e8,'async':!![],'channelid':_0x38fd9c})[_0x3411('0x3f')](function(_0x52cc20){return _0x7276c1(_0x52cc20);})[_0x3411('0x94')](function(_0x717b79){_0x45fada[_0x3411('0x188')]+=0x1;var _0x1331c8=new History(_0x1258f6[_0x3411('0x23')][_0x38fd9c]);logger[_0x3411('0x65')](util[_0x3411('0x48')]('[originateError]:\x20%s',JSON[_0x3411('0x81')](_0x717b79)));_0x1331c8[_0x3411('0xc8')]=0xe;_0x1331c8[_0x3411('0xc9')]=_0x3411('0x189');_0x1331c8[_0x3411('0xda')]=moment()[_0x3411('0x48')](_0x3411('0xba'));_0x1331c8[_0x3411('0x6f')]=_0x1331c8[_0x3411('0xda')];hopperUtils[_0x3411('0xdd')](_0x1331c8)[_0x3411('0x94')](loggerCatch(_0x3411('0x18a')));_0x1258f6[_0x3411('0xc0')](_0x1331c8)['catch'](loggerCatch(_0x3411('0x18a')))[_0x3411('0x1c')](function(){delete _0x1258f6[_0x3411('0x23')][_0x38fd9c];return _0x1355f0(msgResponse(_0x3411('0x15b'),_0x3411('0x80'),_0x3411('0x18b')));});});});};Dialer[_0x3411('0x1a')]['checkRetriveMax']=function(_0x2b7ce9,_0x2f90cc,_0x22ecfc){var _0x16c6bc=new History(_0x2f90cc);if(_0x16c6bc[_0x3411('0x118')]+_0x16c6bc[_0x3411('0x18c')]+_0x16c6bc[_0x3411('0x119')]+_0x16c6bc[_0x3411('0x11a')]+_0x16c6bc[_0x3411('0xcd')]+_0x16c6bc[_0x3411('0xe1')]+_0x16c6bc[_0x3411('0x115')]+_0x16c6bc[_0x3411('0x124')]>=_0x22ecfc[_0x3411('0x11b')]-0x1){return!![];}switch(_0x2b7ce9){case 0x3:if(_0x16c6bc[_0x3411('0x119')]>=_0x22ecfc[_0x3411('0x18d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x16c6bc[_0x3411('0x119')]+=0x1,'scheduledat':moment()[_0x3411('0xd5')](_0x22ecfc[_0x3411('0x18e')],'minutes')['format'](_0x3411('0xba')),'ContactId':_0x16c6bc[_0x3411('0xd7')],'ListId':_0x16c6bc[_0x3411('0xe4')],'VoiceQueueId':_0x16c6bc[_0x3411('0xd8')]||undefined,'CampaignId':_0x16c6bc[_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x16c6bc[_0x3411('0x118')]>=_0x22ecfc[_0x3411('0x18f')]-0x1){return!![];}hopperUtils[_0x3411('0x100')]({'active':![],'countbusyretry':_0x16c6bc[_0x3411('0x118')]+=0x1,'scheduledat':moment()[_0x3411('0xd5')](_0x22ecfc[_0x3411('0x190')],'minutes')[_0x3411('0x48')](_0x3411('0xba')),'ContactId':_0x16c6bc['ContactId'],'ListId':_0x16c6bc[_0x3411('0xe4')],'VoiceQueueId':_0x16c6bc[_0x3411('0xd8')]||undefined,'CampaignId':_0x16c6bc[_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch(_0x3411('0x191')));break;case 0x8:if(_0x16c6bc['countcongestionretry']>=_0x22ecfc['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x16c6bc[_0x3411('0x18c')]+=0x1,'scheduledat':moment()[_0x3411('0xd5')](_0x22ecfc[_0x3411('0x192')],_0x3411('0xd6'))[_0x3411('0x48')](_0x3411('0xba')),'ContactId':_0x16c6bc[_0x3411('0xd7')],'ListId':_0x16c6bc['ListId'],'VoiceQueueId':_0x16c6bc[_0x3411('0xd8')]||undefined,'CampaignId':_0x16c6bc[_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x16c6bc[_0x3411('0x11a')]>=_0x22ecfc[_0x3411('0x193')]-0x1){return!![];}else{hopperUtils[_0x3411('0x100')]({'active':![],'countnosuchnumberretry':_0x16c6bc[_0x3411('0x11a')]+=0x1,'scheduledat':moment()[_0x3411('0xd5')](_0x22ecfc[_0x3411('0x194')],_0x3411('0xd6'))[_0x3411('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16c6bc[_0x3411('0xd7')],'ListId':_0x16c6bc['ListId'],'VoiceQueueId':_0x16c6bc[_0x3411('0xd8')]||undefined,'CampaignId':_0x16c6bc[_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch(_0x3411('0x195')));}break;case 0xa:if(_0x16c6bc[_0x3411('0xcd')]>=_0x22ecfc[_0x3411('0xd3')]-0x1){return!![];}hopperUtils[_0x3411('0x100')]({'active':![],'countdropretry':_0x16c6bc[_0x3411('0xcd')]+=0x1,'scheduledat':moment()['add'](_0x22ecfc[_0x3411('0xce')],_0x3411('0xd6'))[_0x3411('0x48')](_0x3411('0xba')),'ContactId':_0x16c6bc[_0x3411('0xd7')],'ListId':_0x16c6bc[_0x3411('0xe4')],'VoiceQueueId':_0x16c6bc[_0x3411('0xd8')]||undefined,'CampaignId':_0x16c6bc[_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch(_0x3411('0xd9')));break;case 0xb:if(_0x16c6bc[_0x3411('0xe1')]>=_0x22ecfc[_0x3411('0x196')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x16c6bc['countabandonedretry']+=0x1,'scheduledat':moment()[_0x3411('0xd5')](_0x22ecfc[_0x3411('0xe3')],_0x3411('0xd6'))['format'](_0x3411('0xba')),'ContactId':_0x16c6bc['ContactId'],'ListId':_0x16c6bc['ListId'],'VoiceQueueId':_0x16c6bc[_0x3411('0xd8')]||undefined,'CampaignId':_0x16c6bc[_0x3411('0xe5')]||undefined})['catch'](loggerCatch(_0x3411('0xe6')));break;case 0x13:if(_0x16c6bc[_0x3411('0x115')]>=_0x22ecfc['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x3411('0x100')]({'active':![],'countmachineretry':_0x16c6bc[_0x3411('0x115')]+=0x1,'scheduledat':moment()[_0x3411('0xd5')](_0x22ecfc[_0x3411('0x125')],_0x3411('0xd6'))['format'](_0x3411('0xba')),'ContactId':_0x16c6bc['ContactId'],'ListId':_0x16c6bc[_0x3411('0xe4')],'VoiceQueueId':_0x16c6bc['VoiceQueueId']||undefined,'CampaignId':_0x16c6bc[_0x3411('0xe5')]||undefined})['catch'](loggerCatch(_0x3411('0x197')));break;case 0x14:if(_0x16c6bc[_0x3411('0x124')]>=_0x22ecfc[_0x3411('0x198')]-0x1){return!![];}hopperUtils[_0x3411('0x100')]({'active':![],'countagentrejectretry':_0x16c6bc[_0x3411('0x124')]+=0x1,'scheduledat':moment()[_0x3411('0xd5')](_0x22ecfc['dialAgentRejectRetryFrequency'],_0x3411('0xd6'))[_0x3411('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16c6bc['ContactId'],'ListId':_0x16c6bc['ListId'],'VoiceQueueId':_0x16c6bc[_0x3411('0xd8')]||undefined,'CampaignId':_0x16c6bc[_0x3411('0xe5')]||undefined})['catch'](loggerCatch(_0x3411('0x199')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0xfda901,_0x221093,_0x1fd72f){var _0xc1d00e=this;var _0x4d4fcc=new History(_0xfda901);var _0x198788=![];var _0x43e142;var _0x22cc38;return new Promise(function(_0x5923db,_0x57eea6){if(_[_0x3411('0x41')](_0x221093)&&typeof _0x221093!==_0x3411('0x15a')){return _0x57eea6(msgResponse(_0x3411('0x19a'),_0x3411('0x8a'),_0x3411('0x19b')));}if(_[_0x3411('0x41')](_0x1fd72f)&&typeof _0x1fd72f!==_0x3411('0x15a')){return _0x57eea6(msgResponse(_0x3411('0x19a'),_0x3411('0x8a'),_0x3411('0x19c')));}hopperUtils[_0x3411('0xd0')](_0x4d4fcc,_0x1fd72f['reason'],_0x221093)[_0x3411('0x3f')](function(_0x2dab20){if(_0x2dab20[_0x3411('0xd2')]==0x1)_0x198788=!![];switch(_0x1fd72f[_0x3411('0xbd')]){case'0':_0x221093[_0x3411('0x19d')]+=0x1;_0x4d4fcc[_0x3411('0xc8')]=0x0;_0x4d4fcc['statedesc']=_0x3411('0x19e');_0x4d4fcc['countnosuchnumberretry']+=0x1;_0x4d4fcc[_0x3411('0xe2')]+=0x1;ami[_0x3411('0x42')](_0x3411('0x19f'),ut['buildObj'](_0xfda901,'nosuchnumber'));_0x43e142=_0x221093[_0x3411('0x194')];_0x22cc38=_0x221093[_0x3411('0xcf')];hopperUtils[_0x3411('0xdd')](_0x4d4fcc)['catch'](loggerCatch(_0x3411('0x123')));if(_0xc1d00e[_0x3411('0x1a0')](0x0,_0xfda901,_0x221093)&&!_0x198788){if(_0x4d4fcc[_0x3411('0x11a')]>=_0x221093['dialNoSuchNumberMaxRetry']){_0xc1d00e['createStateFinal'](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x200\x20no\x20such\x20number....');}else{_0xc1d00e[_0x3411('0x11c')](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x221093['outboundNoAnswerCallsDay']+=0x1;_0x4d4fcc[_0x3411('0xc8')]=0x3;_0x4d4fcc[_0x3411('0xc9')]=_0x3411('0x1a1');_0x4d4fcc[_0x3411('0x119')]+=0x1;_0x4d4fcc['countglobal']+=0x1;var _0x1099d1=ut[_0x3411('0x1a2')](_0xfda901,_0x221093);ami[_0x3411('0x42')](_0x3411('0x1a3'),_0x1099d1);_0x43e142=_0x221093[_0x3411('0x18e')];_0x22cc38=_0x221093[_0x3411('0xcf')];hopperUtils[_0x3411('0xdd')](_0x4d4fcc)['catch'](loggerCatch(_0x3411('0x1a4')));if(_0xc1d00e[_0x3411('0x1a0')](0x3,_0xfda901,_0x221093)&&!_0x198788){if(_0x4d4fcc[_0x3411('0x119')]>=_0x221093['dialNoAnswerMaxRetry']){_0xc1d00e['createStateFinal'](_0x4d4fcc,_0x5923db,_0x57eea6,_0x3411('0x1a5'));}else{_0xc1d00e[_0x3411('0x11c')](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x221093[_0x3411('0x1a6')]+=0x1;_0x4d4fcc[_0x3411('0xc8')]=0x5;_0x4d4fcc[_0x3411('0xc9')]=_0x3411('0x1a7');_0x4d4fcc[_0x3411('0x118')]+=0x1;_0x4d4fcc[_0x3411('0xe2')]+=0x1;ami[_0x3411('0x42')](_0x3411('0x1a8'),ut[_0x3411('0x117')](_0xfda901,_0x3411('0x1a9')));_0x43e142=_0x221093[_0x3411('0x190')];_0x22cc38=_0x221093[_0x3411('0xcf')];hopperUtils[_0x3411('0xdd')](_0x4d4fcc)['catch'](loggerCatch(_0x3411('0x1aa')));if(_0xc1d00e[_0x3411('0x1a0')](0x5,_0xfda901,_0x221093)&&!_0x198788){if(_0x4d4fcc[_0x3411('0x118')]>=_0x221093[_0x3411('0x18f')]){_0xc1d00e[_0x3411('0x11e')](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x205\x20busy');}else{_0xc1d00e[_0x3411('0x11c')](_0x4d4fcc,_0x5923db,_0x57eea6,_0x3411('0x1ab'));}}break;case'8':_0x221093['outboundCongestionCallsDay']+=0x1;_0x4d4fcc[_0x3411('0xc8')]=0x8;_0x4d4fcc['statedesc']=_0x3411('0x1ac');_0x4d4fcc[_0x3411('0x18c')]+=0x1;_0x4d4fcc[_0x3411('0xe2')]+=0x1;_0x43e142=_0x221093[_0x3411('0x192')];_0x22cc38=_0x221093[_0x3411('0xcf')];ami['emit'](_0x3411('0x1ad'),ut[_0x3411('0x117')](_0xfda901,_0x3411('0x1ae')));hopperUtils[_0x3411('0xdd')](_0x4d4fcc)[_0x3411('0x94')](loggerCatch(_0x3411('0x1af')));if(_0xc1d00e[_0x3411('0x1a0')](0x8,_0xfda901,_0x221093)&&!_0x198788){if(_0x4d4fcc[_0x3411('0x18c')]>=_0x221093['dialCongestionMaxRetry']){_0xc1d00e[_0x3411('0x11e')](_0x4d4fcc,_0x5923db,_0x57eea6,_0x3411('0x1b0'));}else{_0xc1d00e[_0x3411('0x11c')](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x208\x20congestion');}}break;case'11':_0x221093[_0x3411('0x1b1')]+=0x1;_0x4d4fcc['state']=0xb;_0x4d4fcc['statedesc']=_0x3411('0x1b2');_0x4d4fcc[_0x3411('0xe1')]+=0x1;_0x4d4fcc[_0x3411('0xe2')]+=0x1;_0x43e142=_0x221093['dialAbandonedRetryFrequency'];_0x22cc38=_0x221093['callAdditionalPhoneAfterMin'];hopperUtils[_0x3411('0xdd')](_0x4d4fcc)['catch'](loggerCatch(_0x3411('0xe7')));if(_0xc1d00e[_0x3411('0x1a0')](0xb,_0xfda901,_0x221093)&&!_0x198788){if(_0x4d4fcc[_0x3411('0xe1')]>=_0x221093['dialAbandonedMaxRetry']){_0xc1d00e[_0x3411('0x11e')](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x2011\x20abandoned');}else{_0xc1d00e[_0x3411('0x11c')](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x2011\x20abandoned');}}break;case'20':_0x221093[_0x3411('0x1b3')]+=0x1;_0x4d4fcc[_0x3411('0xc8')]=0x14;_0x4d4fcc['statedesc']=_0x3411('0x1b4');_0x4d4fcc['countagentrejectretry']+=0x1;_0x4d4fcc[_0x3411('0xe2')]+=0x1;_0x43e142=_0x221093['dialAgentRejectRetryFrequency'];_0x22cc38=_0x221093['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0x3411('0x117')](_0xfda901,_0x3411('0x1b5')));hopperUtils[_0x3411('0xdd')](_0x4d4fcc)[_0x3411('0x94')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xc1d00e[_0x3411('0x1a0')](0x14,_0xfda901,_0x221093)&&!_0x198788){if(_0x4d4fcc[_0x3411('0x124')]>=_0x221093[_0x3411('0x198')]){_0xc1d00e[_0x3411('0x11e')](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x2020\x20agentreject');}else{_0xc1d00e[_0x3411('0x11c')](_0x4d4fcc,_0x5923db,_0x57eea6,'reason\x2020\x20agentreject');}}break;default:_0x221093[_0x3411('0x12d')]+=0x1;_0x4d4fcc['state']=0xc;_0x4d4fcc[_0x3411('0xc9')]=_0x1fd72f[_0x3411('0xbd')];_0x43e142=_0x221093[_0x3411('0x1b6')];_0x22cc38=_0x221093['callAdditionalPhoneAfterMin'];hopperUtils[_0x3411('0xdd')](_0x4d4fcc)[_0x3411('0x94')](loggerCatch(_0x3411('0x1b7')));if(_0xc1d00e[_0x3411('0x1a0')](_0x1fd72f['reason'],_0xfda901,_0x221093)&&!_0x198788){if(_0x4d4fcc[_0x3411('0x118')]+_0x4d4fcc[_0x3411('0x18c')]+_0x4d4fcc[_0x3411('0x119')]+_0x4d4fcc['countnosuchnumberretry']+_0x4d4fcc[_0x3411('0xcd')]+_0x4d4fcc[_0x3411('0xe1')]+_0x4d4fcc[_0x3411('0x115')]+_0x4d4fcc[_0x3411('0x124')]>=_0x221093[_0x3411('0x11b')]){_0xc1d00e[_0x3411('0x11c')](_0x4d4fcc,_0x5923db,_0x57eea6,_0x1fd72f['reason']);}else{_0xc1d00e[_0x3411('0x11e')](_0x4d4fcc,_0x5923db,_0x57eea6,_0x1fd72f['reason']);}}}})[_0x3411('0x3f')](function(){if(_0x198788){hopperUtils[_0x3411('0xe8')](_0x4d4fcc,_0x43e142,_0x22cc38)[_0x3411('0x3f')](function(){return _0x5923db(0x1);});}});});};Dialer[_0x3411('0x1a')][_0x3411('0x11c')]=function(_0x7c6bcc,_0xf0cf1d,_0x55e2be,_0x2d9591){var _0x38af39=new Final(_0x7c6bcc);_0x38af39[_0x3411('0xc8')]=0xf;_0x38af39[_0x3411('0xc9')]=_0x3411('0x1b8');this[_0x3411('0x11e')](_0x38af39,_0xf0cf1d,_0x55e2be,_0x2d9591);};Dialer[_0x3411('0x1a')]['createStateFinal']=function(_0x443efe,_0x412bc3,_0x243e9b,_0xf22059){hopperUtils[_0x3411('0xc0')](_0x443efe)[_0x3411('0x3f')](function(){return _0x412bc3(msgResponse(_0x3411('0x19a'),_0x3411('0x104'),_0xf22059));})['catch'](function(){return _0x243e9b(msgResponse(_0x3411('0x1b9'),_0x3411('0x8a'),_0x3411('0x1ba')));});};Dialer[_0x3411('0x1a')]['predictive']=function(_0x4aaa1b){var _0x2c1ecc=_0x4aaa1b['dialPredictiveOptimizationPercentage']/0x64;var _0xa195b1=_0x4aaa1b[_0x3411('0xc6')]/(_0x4aaa1b[_0x3411('0xc6')]+_0x4aaa1b[_0x3411('0xbc')]);var _0x56b97f=Math[_0x3411('0x1bb')](_0x4aaa1b[_0x3411('0x1bc')]*(_0x4aaa1b[_0x3411('0x1bd')]/0x64));var _0x86d879=Math[_0x3411('0x1bb')](_0x4aaa1b[_0x3411('0x1bc')]*(_0x4aaa1b[_0x3411('0x1be')]/0x64));var _0x4f5b89=_0x4aaa1b[_0x3411('0x1bf')]+_0x4aaa1b[_0x3411('0x135')];var _0x2e3c54=Math[_0x3411('0x1c0')](_0x4aaa1b[_0x3411('0x5d')]*_0x4aaa1b[_0x3411('0x1c1')]*_0x4aaa1b[_0x3411('0x1c2')]*_0x4aaa1b[_0x3411('0x1c3')]);if(_[_0x3411('0x41')](_0x4aaa1b[_0x3411('0x26')])){if(!_[_0x3411('0x41')](_0x4aaa1b['startPredictive'])){_0x4aaa1b[_0x3411('0x25')]=undefined;loggerPredictive['error'](_0x3411('0x1c4'),_0x3411('0x1c5'));}if(!_['isUndefined'](_0x4aaa1b[_0x3411('0x64')])){loggerPredictive[_0x3411('0x65')](_0x3411('0x1c4'),_0x3411('0x1c6'));clearInterval(_0x4aaa1b['handlePredictive']);_0x4aaa1b[_0x3411('0x64')]=undefined;}_0x4aaa1b[_0x3411('0x26')]=moment()[_0x3411('0x48')](_0x3411('0xba'));loggerPredictive['info'](_0x4aaa1b[_0x3411('0x4a')],_0x3411('0x1c7'),_0x4aaa1b[_0x3411('0x26')]);this[_0x3411('0xa9')](_0x4aaa1b,0x1);}else if(ifInterval(_0x4aaa1b[_0x3411('0x1c8')],_0x4aaa1b[_0x3411('0x26')])){this[_0x3411('0xa9')](_0x4aaa1b,0x1);loggerPredictiveCalls[_0x3411('0x4d')](_0x3411('0x1c9'),_0x4aaa1b['startProgressive'],_0x4aaa1b[_0x3411('0x4a')]);_0x4aaa1b[_0x3411('0x5d')]=0x0;_0x4aaa1b['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2c1ecc<_0xa195b1&&_0x4aaa1b['dialPredictiveOptimization']===_0x3411('0x1ca')){clearPredictiveAttributes(_0x4aaa1b);loggerPredictive[_0x3411('0x4d')](_0x3411('0x1cb'),'Dropped\x20calls\x20day',_0xa195b1,'startProgressive',_0x4aaa1b['name']);}else if(_0x2e3c54<_0x4aaa1b['predictiveIntervalErlangCallsDroppedCalls']&&_0x4aaa1b[_0x3411('0x1cc')]===_0x3411('0x1ca')){clearPredictiveAttributes(_0x4aaa1b);loggerPredictive['info'](_0x3411('0x1cd'),_0x3411('0x1ce'),_0x2e3c54,_0x3411('0x1cf'),_0x4aaa1b[_0x3411('0xc7')],_0x3411('0x26'),_0x4aaa1b[_0x3411('0x4a')]);}else if(!ifInterval(_0x4aaa1b[_0x3411('0x1c8')],_0x4aaa1b[_0x3411('0x26')])&&_[_0x3411('0x41')](_0x4aaa1b[_0x3411('0x25')])&&!_[_0x3411('0x41')](_0x4aaa1b['startProgressive'])){_0x4aaa1b['startPredictive']=moment()['format'](_0x3411('0xba'));loggerPredictive[_0x3411('0x4d')](_0x4aaa1b['name'],'started\x20in\x20predictive\x20at',_0x4aaa1b[_0x3411('0x25')]);hopperUtils[_0x3411('0x1d0')](_0x4aaa1b[_0x3411('0x1c8')])[_0x3411('0x3f')](this[_0x3411('0x1d1')](_0x4aaa1b))[_0x3411('0x3f')](mergeDataErlangB(_0x4aaa1b))[_0x3411('0x3f')](this[_0x3411('0x1d2')](_0x4aaa1b))['catch'](loggerCatchPredictive(_0x3411('0x1d3'),_0x4aaa1b));}else if(!ifInterval(_0x4aaa1b['dialPredictiveInterval'],_0x4aaa1b[_0x3411('0x25')])){_0x4aaa1b[_0x3411('0xc7')]=0x0;_0x4aaa1b[_0x3411('0x25')]=moment()[_0x3411('0x48')](_0x3411('0xba'));loggerPredictive[_0x3411('0x4d')](_0x4aaa1b[_0x3411('0x4a')],_0x3411('0x1d4'),_0x4aaa1b[_0x3411('0x25')]);clearInterval(_0x4aaa1b[_0x3411('0x64')]);_0x4aaa1b[_0x3411('0x64')]=undefined;hopperUtils[_0x3411('0x1d0')](_0x4aaa1b[_0x3411('0x1c8')])[_0x3411('0x3f')](this['getDataPredictive'](_0x4aaa1b))['then'](mergeDataErlangB(_0x4aaa1b))[_0x3411('0x3f')](this[_0x3411('0x1d2')](_0x4aaa1b))[_0x3411('0x94')](loggerCatchPredictive(_0x3411('0x1d5'),_0x4aaa1b));}else if(_0x4aaa1b[_0x3411('0x1bc')]&&_0x4f5b89<_0x4aaa1b[_0x3411('0x1bc')]-_0x86d879){clearPredictiveAttributes(_0x4aaa1b);loggerPredictive[_0x3411('0x4d')](_0x4aaa1b[_0x3411('0x4a')],_0x3411('0x1d6'),_0x4f5b89,_0x3411('0x1d7'),_0x4aaa1b[_0x3411('0x1bc')],'-',_0x86d879,'=',_0x4aaa1b['predictiveIntervalAvailable']-_0x86d879,')');}else if(_0x4aaa1b[_0x3411('0x1bc')]&&_0x4f5b89>_0x4aaa1b[_0x3411('0x1bc')]+_0x56b97f){clearPredictiveAttributes(_0x4aaa1b);loggerPredictive[_0x3411('0x4d')](_0x4aaa1b[_0x3411('0x4a')],_0x3411('0x1d6'),_0x4f5b89,_0x3411('0x1d8'),_0x4aaa1b[_0x3411('0x1bc')],'+',_0x56b97f,'=',_0x4aaa1b[_0x3411('0x1bc')]+_0x56b97f,')');}};Dialer['prototype'][_0x3411('0x1d1')]=function(_0x437425){var _0x42d3ab=this;return function(_0x34132a){return new Promise(function(_0x35d979,_0x34bc96){_[_0x3411('0x152')](_0x437425,_0x34132a[0x0]);if(checkGetDataPredictive(_0x34132a[0x0])){var _0x5081be=_0x437425['predictiveIntervalAvailable']=_0x437425[_0x3411('0x135')]+_0x437425[_0x3411('0x1bf')];var _0xca1ba4=_0x437425[_0x3411('0x1c8')]*0x3c;var _0x2aece5=_0x34132a[0x0][_0x3411('0x58')]+_0x34132a[0x0][_0x3411('0x55')];var _0x2206e8=(_0x34132a[0x0][_0x3411('0x1d9')]+_0x34132a[0x0][_0x3411('0x53')]+_0x34132a[0x0][_0x3411('0x54')])/_0x34132a[0x0][_0x3411('0x50')];_0x437425[_0x3411('0x1c2')]=_0x2206e8>0x0?_0x2206e8:0x1;switch(_0x437425[_0x3411('0x1cc')]){case'dropRate':var _0x129840=_0x437425[_0x3411('0x1da')]/0x64;return _0x42d3ab['abandonmentRate'](_0x5081be,_0xca1ba4,_0x2aece5,_0x2206e8,_0x129840)['then'](function(_0x4461e8){return _0x35d979(_0x4461e8);});case _0x3411('0x1db'):var _0x56b060=_0x437425[_0x3411('0x1da')]/0x64;return _0x42d3ab[_0x3411('0x1dc')](_0x5081be,_0xca1ba4,_0x2aece5,_0x2206e8,_0x56b060)[_0x3411('0x3f')](function(_0x4e22ad){return _0x35d979(_0x4e22ad);});default:return _0x34bc96(msgResponse(_0x3411('0x1dd'),_0x3411('0x8a'),_0x3411('0x1de')));}}else{return _0x34bc96(msgResponse(_0x3411('0x1dd'),_0x3411('0x8a'),_0x3411('0x1df')));}});};};Dialer[_0x3411('0x1a')][_0x3411('0x1e0')]=function(_0x4cba8a){var _0x364beb=this;return function(_0x1f826f){return new Promise(function(_0x42528,_0x5e7785){_[_0x3411('0x152')](_0x4cba8a,_0x1f826f[0x0]);if(checkGetDataPredictive(_0x1f826f[0x0])){loggerPredictive[_0x3411('0x4d')](JSON[_0x3411('0x81')](_0x1f826f[0x0]));if(_0x4cba8a[_0x3411('0x1cc')]===_0x3411('0x1ca')){return _0x364beb[_0x3411('0x14b')](_0x4cba8a['id'])['then'](function(_0x2c8fba){var _0x2dc6d9=_0x4cba8a[_0x3411('0x1e1')]-_0x2c8fba[0x0][_0x3411('0x1e2')];var _0x50fbf7=_0x4cba8a[_0x3411('0x1c8')]*0x3c;var _0x2c249b=_0x1f826f[0x0][_0x3411('0x58')]+_0x1f826f[0x0][_0x3411('0x55')];var _0x4f6f6b=(_0x1f826f[0x0][_0x3411('0x1d9')]+_0x1f826f[0x0][_0x3411('0x53')]+_0x1f826f[0x0][_0x3411('0x54')])/_0x1f826f[0x0][_0x3411('0x50')];var _0x450659=_0x4cba8a[_0x3411('0x1da')]/0x64;_0x4cba8a[_0x3411('0x1e3')]=_0x2c8fba[0x0]['outboundQueuePauses']||0x0;_0x4cba8a[_0x3411('0x1c2')]=_0x4f6f6b>0x0?_0x4f6f6b:0x1;return _0x364beb[_0x3411('0x1e4')](_0x2dc6d9,_0x50fbf7,_0x2c249b,_0x4f6f6b,_0x450659);})['then'](function(_0x31073e){return _0x42528(_0x31073e);})[_0x3411('0x94')](function(_0xa60864){return _0x5e7785(msgResponse(_0x3411('0x1e5'),'Failure',JSON[_0x3411('0x81')](_0xa60864)));});}if(_0x4cba8a[_0x3411('0x1cc')]===_0x3411('0x1db')){return _0x364beb[_0x3411('0x14b')](_0x4cba8a['id'])[_0x3411('0x3f')](function(_0x3d6e9e){var _0x1a46ca=_0x4cba8a[_0x3411('0x1e1')]-_0x3d6e9e[0x0][_0x3411('0x1e2')];var _0x580884=_0x4cba8a['dialPredictiveInterval']*0x3c;var _0x676f83=_0x1f826f[0x0][_0x3411('0x58')]+_0x1f826f[0x0]['predictiveIntervalAvgHoldtime'];var _0x4c6bad=(_0x1f826f[0x0][_0x3411('0x1d9')]+_0x1f826f[0x0][_0x3411('0x53')]+_0x1f826f[0x0][_0x3411('0x54')])/_0x1f826f[0x0][_0x3411('0x50')];var _0x143f57=_0x4cba8a[_0x3411('0x1da')]/0x64;_0x4cba8a[_0x3411('0x1e3')]=_0x3d6e9e[0x0][_0x3411('0x1e2')]||0x0;_0x4cba8a['predictiveIntervalHitRate']=_0x4c6bad>0x0?_0x4c6bad:0x1;return _0x364beb[_0x3411('0x1dc')](_0x1a46ca,_0x580884,_0x676f83,_0x4c6bad,_0x143f57);})[_0x3411('0x3f')](function(_0x519cf8){return _0x42528(_0x519cf8);})['catch'](function(_0x24e894){return _0x5e7785(msgResponse(_0x3411('0x1e5'),_0x3411('0x8a'),JSON[_0x3411('0x81')](_0x24e894)));});}}else{return _0x5e7785(msgResponse('[getDataPredictive]',_0x3411('0x8a'),_0x3411('0x1df')));}});};};Dialer[_0x3411('0x1a')][_0x3411('0x1d2')]=function(_0x3610d5){var _0x1c6235=this;return function(){var _0x31ac46=0x0;var _0x1f66fd=Math[_0x3411('0x1c0')](_0x3610d5[_0x3411('0x5f')]*0x3e8);if(_0x1f66fd>0x0){_0x1f66fd=_0x1f66fd<0x64?0x64:_0x1f66fd;loggerPredictive[_0x3411('0x4d')](_0x3610d5['name'],'one\x20call\x20every:',_0x1f66fd,'milliseconds');_0x3610d5[_0x3411('0x64')]=setInterval(function(){_0x1c6235['handlePredictive'](_0x3610d5);loggerPredictiveCalls[_0x3411('0x4d')](_0x3411('0x1e6'),_0x31ac46+=0x1);},_0x1f66fd);}else{loggerPredictive[_0x3411('0x4d')](_0x3610d5[_0x3411('0x4a')],_0x3411('0x1e7'));}};};Dialer['prototype']['checkContactBlack']=function(_0x5276cc,_0x2544dd){var _0x286663=this;return function(_0xfdb322){if(_['isEmpty'](_0xfdb322)){if(_[_0x3411('0xed')](_0x2544dd[_0x3411('0x153')])||!_0x2544dd[_0x3411('0x1e8')]){if(_0x5276cc['dialMethod']===_0x3411('0x9')){_0x5276cc['queueStatusComplete']=_[_0x3411('0x41')](_0x5276cc[_0x3411('0x70')])?!![]:_0x5276cc['queueStatusComplete'];var _0x27b8d9=uuid['v4']();_0x286663['actions'][_0x27b8d9]=new Action(_0x5276cc,_0x2544dd,_0x27b8d9);loggerBooked[_0x3411('0x4d')](_0x3411('0x1e9'),_0x27b8d9,_0x3411('0x1ea'),JSON[_0x3411('0x81')](_0x5276cc[_0x3411('0x70')]),'Queue:\x20',_0x5276cc[_0x3411('0x4a')]);if(_0x5276cc[_0x3411('0x70')]){_0x5276cc[_0x3411('0x70')]=![];_0x286663[_0x3411('0xf3')][_0x286663['actions'][_0x27b8d9][_0x3411('0xb6')]]=[];ami[_0x3411('0x96')]({'actionid':_0x27b8d9,'action':'queuestatus','queue':_0x5276cc[_0x3411('0x4a')]})['catch'](function(){_0x286663['updateOriginated'](_0x5276cc);hopperUtils[_0x3411('0x100')]({'active':![],'ContactId':_0x286663[_0x3411('0x23')][_0x27b8d9][_0x3411('0xd7')],'ListId':_0x286663[_0x3411('0x23')][_0x27b8d9][_0x3411('0xe4')],'VoiceQueueId':_0x286663[_0x3411('0x23')][_0x27b8d9][_0x3411('0xd8')]||undefined,'CampaignId':_0x286663['actions'][_0x27b8d9][_0x3411('0xe5')]||undefined})[_0x3411('0x94')](loggerCatch(_0x3411('0x1eb')));delete _0x286663[_0x3411('0x23')][_0x27b8d9];});}else{loggerBooked[_0x3411('0x4d')](_0x3411('0x1ec'),JSON['stringify'](_0x5276cc[_0x3411('0x70')]),_0x3411('0x1ed'),_0x5276cc[_0x3411('0x4a')]);_0x286663[_0x3411('0xc3')](_0x5276cc);hopperUtils[_0x3411('0x100')]({'active':![],'ContactId':_0x286663['actions'][_0x27b8d9][_0x3411('0xd7')],'ListId':_0x286663[_0x3411('0x23')][_0x27b8d9][_0x3411('0xe4')],'VoiceQueueId':_0x286663[_0x3411('0x23')][_0x27b8d9][_0x3411('0xd8')]||undefined,'CampaignId':_0x286663[_0x3411('0x23')][_0x27b8d9][_0x3411('0xe5')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x286663[_0x3411('0x23')][_0x27b8d9];}}else{return _0x286663['actionOriginate'](_0x5276cc,_0x2544dd);}}else{if(utils[_0x3411('0x61')](undefined,_0x2544dd[_0x3411('0x1ee')])<_0x5276cc[_0x3411('0x1ef')]*0x3c){if(_0x2544dd[_0x3411('0x156')]&&!_0x2544dd[_0x3411('0x156')][_0x3411('0x1f0')]){_0x286663[_0x3411('0x1d')][_0x3411('0xfd')](_0x2544dd['id'])['finally'](function(){_0x286663[_0x3411('0xc3')](_0x5276cc);});}else{hopperUtils[_0x3411('0x1f1')]({'active':![]},_0x2544dd['id'],0x1)[_0x3411('0x1c')](function(){_0x286663[_0x3411('0xc3')](_0x5276cc);});}}else{_0x5276cc[_0x3411('0x1f2')]+=0x1;_0x286663[_0x3411('0xc3')](_0x5276cc);if(_0x5276cc[_0x3411('0x1f3')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2544dd[_0x3411('0xd7')],'ListId':_0x2544dd[_0x3411('0xe4')],'VoiceQueueId':_0x2544dd[_0x3411('0xd8')]||undefined,'CampaignId':_0x2544dd['CampaignId']||undefined})[_0x3411('0x94')](loggerCatch(_0x3411('0x1f4')));hopperUtils['createHistory'](createObjHistory(_0x5276cc,_0x2544dd,utils[_0x3411('0x6c')][_0x3411('0x1f5')],0x17,_0x3411('0x1f6')))[_0x3411('0x94')](loggerCatch(_0x3411('0x1f7')));}else{_0x286663[_0x3411('0x111')](createObjHistory(_0x5276cc,_0x2544dd,utils['CAMPAIGN_STATUS'][_0x3411('0x1f8')],0x16,_0x3411('0x1f9')),_0x3411('0x1fa'),_0x3411('0x1fb'));}}}}else{_0x5276cc['outboundBlacklistCallsDay']+=0x1;_0x286663[_0x3411('0x111')](createObjHistory(_0x5276cc,_0x2544dd,utils[_0x3411('0x6c')][_0x3411('0x1fc')],0xd,_0x3411('0x1fd')),_0x3411('0x1fe'),_0x3411('0x1ff'));throw _0x3411('0x200');}};};Dialer['prototype'][_0x3411('0x201')]=function(_0x37bf62){var _0x17396b=this;var _0x4c6a55=_0x37bf62[_0x3411('0x202')]-_0x37bf62[_0x3411('0x7d')];emitCampaignSummary(_0x37bf62);if(_0x4c6a55>0x0&&_0x37bf62[_0x3411('0x67')]==0x0){if(_0x4c6a55>this[_0x3411('0x22')]){_0x4c6a55=this['maxNumberOriginate'];}_0x37bf62[_0x3411('0x67')]=0x1;hopperUtils['getContactDialerIvr'](_0x37bf62,_0x4c6a55)[_0x3411('0x3f')](function(_0x32541e){_0x37bf62[_0x3411('0x67')]=0x0;if(_0x32541e){if(!utils[_0x3411('0x203')](_0x32541e)){_0x37bf62[_0x3411('0x68')]=utils['CAMPAIGN_STATUS'][_0x3411('0x6d')];logger['info'](_0x3411('0x204')+_0x37bf62['name']);}else{_0x37bf62[_0x3411('0x7d')]+=_0x32541e[_0x3411('0xf7')];_0x37bf62['message']=utils[_0x3411('0x6c')][_0x3411('0x205')];for(var _0x56802c=0x0;_0x56802c<_0x32541e['length'];_0x56802c+=0x1){_0x37bf62['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x32541e[_0x56802c])||_[_0x3411('0xed')](_0x32541e[_0x56802c][_0x3411('0x176')])||_[_0x3411('0xed')](_0x32541e[_0x56802c]['phone'])){_0x17396b[_0x3411('0x150')](_0x3411('0x206'),_0x37bf62,_0x32541e[_0x56802c]);}else{hopperUtils[_0x3411('0x207')](_[_0x3411('0xf4')](_0x32541e[_0x56802c],[_0x3411('0xe5'),_0x3411('0x15c')]))[_0x3411('0x3f')](_0x17396b[_0x3411('0x208')](_0x37bf62,_0x32541e[_0x56802c]))['catch'](_0x17396b[_0x3411('0x14f')](_0x3411('0x209'),_0x37bf62));}}}}})[_0x3411('0x94')](loggerGetContactDialer(_0x3411('0x20a'),_0x37bf62,_0x4c6a55));}};Dialer['prototype'][_0x3411('0xa9')]=function(_0x2f550a,_0x48cc3b){var _0x32baab=this;var _0x7b1a4a=[];if(_0x48cc3b<0x1||_0x2f550a['dialMethod']==='booked'){_0x48cc3b=0x1;}var _0x9d50ce=Math['floor'](_0x2f550a['available']*_0x48cc3b)-_0x2f550a[_0x3411('0x7d')];if(_0x2f550a[_0x3411('0x20b')]>0x0){var _0x4aba9f=_0x2f550a[_0x3411('0x20b')]-_0x2f550a[_0x3411('0x7d')]-_0x2f550a[_0x3411('0x135')]-_0x2f550a['pTalking'];if(_0x9d50ce>_0x4aba9f){_0x9d50ce=_0x4aba9f;}}if(_0x9d50ce>0x0&&_0x2f550a[_0x3411('0x67')]==0x0){if(_0x2f550a[_0x3411('0xa7')]===_0x3411('0x9')){_0x9d50ce=0x1;}if(_0x9d50ce>this['maxNumberOriginate']){_0x9d50ce=this[_0x3411('0x22')];}for(var _0x1cb25e in this['agents']){if(typeof this['agents'][_0x1cb25e]!==_0x3411('0xa1')){if(this[_0x3411('0x20')][_0x1cb25e][_0x3411('0xc8')]===_0x3411('0x20c')&&this[_0x3411('0x20')][_0x1cb25e]['status']===_0x3411('0x142')){_0x7b1a4a[_0x3411('0x95')](this[_0x3411('0x20')][_0x1cb25e]['id']);}}}_0x2f550a[_0x3411('0x67')]=0x1;hopperUtils[_0x3411('0x20d')](_0x2f550a,_0x7b1a4a,_0x9d50ce)[_0x3411('0x3f')](function(_0x5f01ea){_0x2f550a[_0x3411('0x67')]=0x0;if(_0x5f01ea){if(!utils[_0x3411('0x203')](_0x5f01ea)){hopperUtils[_0x3411('0x20e')](_0x2f550a)['then'](sendMessageReschedule(_0x2f550a))[_0x3411('0x94')](loggerCatch('[countReScheduled]\x20'));}else{_0x2f550a[_0x3411('0x7d')]+=_0x5f01ea[_0x3411('0xf7')];_0x2f550a[_0x3411('0x68')]=_0x2f550a['dialMethod']===_0x3411('0x9')?utils[_0x3411('0x6c')][_0x3411('0x137')]:utils[_0x3411('0x6c')][_0x3411('0x205')];for(var _0x14d120=0x0;_0x14d120<_0x5f01ea[_0x3411('0xf7')];_0x14d120+=0x1){if(_[_0x3411('0xed')](_0x5f01ea[_0x14d120])||_[_0x3411('0xed')](_0x5f01ea[_0x14d120][_0x3411('0x176')])||_[_0x3411('0xed')](_0x5f01ea[_0x14d120][_0x3411('0x15c')])){_0x32baab['emptyContact']('[actionOriginate]\x20',_0x2f550a,_0x5f01ea[_0x14d120]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x5f01ea[_0x14d120],[_0x3411('0xd8'),_0x3411('0x15c')]))['then'](_0x32baab[_0x3411('0x208')](_0x2f550a,_0x5f01ea[_0x14d120]))['catch'](_0x32baab[_0x3411('0x14f')](_0x3411('0x206'),_0x2f550a));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x2f550a,_0x9d50ce));}};Dialer[_0x3411('0x1a')][_0x3411('0x64')]=function(_0x225110){if(_0x225110[_0x3411('0x20b')]>0x0){var _0x1f6120=_0x225110[_0x3411('0x20b')]-_0x225110['originated']-_0x225110[_0x3411('0x135')];if(_0x1f6120>0x0&&_0x225110[_0x3411('0x67')]==0x0){this[_0x3411('0x20f')](_0x225110);}else{loggerPredictiveCalls[_0x3411('0x4d')]('[handlePredictive][limitChannel]');}}else{this[_0x3411('0x20f')](_0x225110);}};Dialer[_0x3411('0x1a')]['tryOriginatePredictive']=function(_0x257dd2){var _0x4b9dba=this;var _0x1bfde7=[];_0x257dd2[_0x3411('0x7d')]+=0x1;for(var _0x31c938 in this['agents']){if(typeof this[_0x3411('0x20')][_0x31c938]!==_0x3411('0xa1')){if(this[_0x3411('0x20')][_0x31c938][_0x3411('0xc8')]==='not_inuse'&&this[_0x3411('0x20')][_0x31c938]['status']===_0x3411('0x142')){_0x1bfde7['push'](this[_0x3411('0x20')][_0x31c938]['id']);}}}_0x257dd2['temp']=0x1;return this[_0x3411('0x20d')](_0x257dd2['id'],_0x1bfde7,0x1,_0x257dd2[_0x3411('0x210')],_0x257dd2)['then'](function(_0x407326){_0x257dd2[_0x3411('0x67')]=0x1;if(_0x407326){if(!utils[_0x3411('0x203')](_0x407326)){utils[_0x3411('0x211')](_0x257dd2,0x1,0x0);return hopperUtils[_0x3411('0x20e')](_0x257dd2)[_0x3411('0x3f')](sendMessageReschedule(_0x257dd2))[_0x3411('0x94')](loggerCatch(_0x3411('0x212')));}else{_0x257dd2[_0x3411('0x68')]=utils[_0x3411('0x6c')][_0x3411('0x205')];if(_[_0x3411('0xed')](_0x407326[0x0])||_[_0x3411('0xed')](_0x407326[0x0][_0x3411('0x176')])||_[_0x3411('0xed')](_0x407326[0x0][_0x3411('0x15c')])){_0x4b9dba[_0x3411('0x150')]('[actionOriginate]\x20',_0x257dd2,_0x407326[0x0]);}else{return hopperUtils[_0x3411('0x213')](_['pick'](_0x407326[0x0],[_0x3411('0xd8'),'phone']))['then'](_0x4b9dba['checkContactBlack'](_0x257dd2,_0x407326[0x0]))[_0x3411('0x94')](_0x4b9dba[_0x3411('0x14f')](_0x3411('0x214'),_0x257dd2));}}}})[_0x3411('0x94')](loggerGetContactDialer(_0x3411('0x215'),_0x257dd2,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x1e101e,_0x2fc1ab,_0x5b5961,_0xea51b5,_0x3f1d65,_0x2017f5){loggerPredictive[_0x3411('0x4d')](_0x3411('0x216'));loggerPredictive['info'](_0x3411('0x217'),_0x1e101e);loggerPredictive['info'](_0x3411('0x218'),_0x2fc1ab);loggerPredictive[_0x3411('0x4d')]('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',_0x5b5961);loggerPredictive[_0x3411('0x4d')](_0x3411('0x219'),_0xea51b5);loggerPredictive[_0x3411('0x4d')](_0x3411('0x21a'),_0x3f1d65);loggerPredictive[_0x3411('0x4d')](_0x3411('0x57'));return new Promise(function(_0x1633c8,_0x44008c){if(_0x1e101e<=0x0||isNaN(_0x1e101e)){return _0x44008c(msgResponse(_0x3411('0x21b'),_0x3411('0x80'),'m\x20=\x20'+_0x1e101e));}if(_0x5b5961<=0x0||isNaN(_0x5b5961)){return _0x44008c(msgResponse(_0x3411('0x21b'),_0x3411('0x80'),_0x3411('0x21c')+_0x5b5961));}if(_0xea51b5<=0x0||isNaN(_0xea51b5)){return _0x44008c(msgResponse('[abandonmentRate]',_0x3411('0x80'),_0x3411('0x21d')+_0xea51b5));}if(_0x2fc1ab<=0x0||isNaN(_0x2fc1ab)){return _0x44008c(msgResponse(_0x3411('0x21b'),_0x3411('0x80'),_0x3411('0x21e')+_0x2fc1ab));}if(_0x3f1d65<=0x0||isNaN(_0x3f1d65)){return _0x44008c(msgResponse(_0x3411('0x21b'),'Error',_0x3411('0x21f')+_0x3f1d65));}_0x2017f5=_0x2017f5||0x0;var _0x56bbb3=0x1/_0x5b5961;var _0x49b4c8=0x0;var _0x264de0=0x0;var _0x3f24ee=0x0;var _0x31417e=0x0;for(var _0xf2da7e=0x0;_0x3f24ee<_0x3f1d65;_0xf2da7e+=0x1){_0x264de0=_0xf2da7e/_0x2fc1ab;_0x49b4c8=(_0xea51b5*_0x264de0+_0x2017f5)/_0x56bbb3;_0x3f24ee=utils['erlangb'](_0x49b4c8,_0x1e101e);_0x31417e=_0x49b4c8/_0x1e101e*(0x1-utils['erlangb'](_0x49b4c8,_0x1e101e));}return _0x1633c8({'erlangCalls':_0xf2da7e,'erlangCallToSecond':_0x2fc1ab/_0xf2da7e,'erlangAbandonmentRate':_0x3f24ee,'erlangBusyFactor':_0x31417e});});};Dialer[_0x3411('0x1a')][_0x3411('0x1dc')]=function(_0x48fcbd,_0x3a1ce9,_0x4c854b,_0x5653ab,_0x882787,_0x4d900d){loggerPredictive[_0x3411('0x4d')](_0x3411('0x220'));loggerPredictive[_0x3411('0x4d')]('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',_0x48fcbd);loggerPredictive[_0x3411('0x4d')](_0x3411('0x218'),_0x3a1ce9);loggerPredictive[_0x3411('0x4d')]('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',_0x4c854b);loggerPredictive['info'](_0x3411('0x219'),_0x5653ab);loggerPredictive[_0x3411('0x4d')](_0x3411('0x221'),_0x882787);loggerPredictive['info'](_0x3411('0x57'));return new Promise(function(_0x3e0f5d,_0x2426e7){if(_0x48fcbd<=0x0||isNaN(_0x48fcbd)){return _0x2426e7(msgResponse(_0x3411('0x222'),_0x3411('0x80'),'m\x20=\x20'+_0x48fcbd));}if(_0x4c854b<=0x0||isNaN(_0x4c854b)){return _0x2426e7(msgResponse('[busyFactor]',_0x3411('0x80'),_0x3411('0x21c')+_0x4c854b));}if(_0x5653ab<=0x0||isNaN(_0x5653ab)){return _0x2426e7(msgResponse(_0x3411('0x222'),_0x3411('0x80'),'p\x20=\x20'+_0x5653ab));}if(_0x3a1ce9<=0x0||isNaN(_0x3a1ce9)){return _0x2426e7(msgResponse('[busyFactor]',_0x3411('0x80'),_0x3411('0x21e')+_0x3a1ce9));}if(_0x882787<=0x0||isNaN(_0x882787)){return _0x2426e7(msgResponse(_0x3411('0x222'),'Error',_0x3411('0x223')+_0x882787));}_0x4d900d=_0x4d900d||0x0;var _0x2d268d=0x1/_0x4c854b;var _0x48db9b=0x0;var _0x11a52f=0x0;var _0x3279bf=0x0;var _0x46be48=0x0;for(var _0x121768=0x0;_0x46be48<_0x882787;_0x121768+=0x1){_0x11a52f=_0x121768/_0x3a1ce9;_0x48db9b=(_0x5653ab*_0x11a52f+_0x4d900d)/_0x2d268d;_0x3279bf=utils[_0x3411('0x224')](_0x48db9b,_0x48fcbd);_0x46be48=_0x48db9b/_0x48fcbd*(0x1-utils[_0x3411('0x224')](_0x48db9b,_0x48fcbd));}return _0x3e0f5d({'erlangCalls':_0x121768,'erlangCallToSecond':_0x3a1ce9/_0x121768,'erlangAbandonmentRate':_0x3279bf,'erlangBusyFactor':_0x46be48});});};module['exports']=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 10ba4d5..ac6439b 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 _0x0cbb=['firstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','CampaignId','idHopper'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x0cbb,0x8b));var _0xb0cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cbb[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xb0cb('0x0'));var _=require(_0xb0cb('0x1'));var moment=require(_0xb0cb('0x2'));function checkNameSurname(_0x2ff4ee,_0x583a6e,_0x31c360){var _0x2272b0='';if(!_[_0xb0cb('0x3')](_0x583a6e)&&_0xb0cb('0x4')===typeof _0x583a6e){_0x2272b0+=_0x583a6e;}if(!_['isNil'](_0x31c360)&&_0xb0cb('0x4')===typeof _0x31c360){_0x2272b0+='\x20'+_0x31c360;}if(_0x2272b0!==''){return _0x2272b0;}return _0x2ff4ee;}function Action(_0x17d2cb,_0x63c134,_0x2508ac){this[_0xb0cb('0x5')]=_0x17d2cb;this[_0xb0cb('0x6')]=_0x2508ac||undefined;this[_0xb0cb('0x7')]=checkNameSurname(_0x63c134['Contact'][_0xb0cb('0x8')],_0x63c134[_0xb0cb('0x9')]['firstName'],_0x63c134['Contact'][_0xb0cb('0xa')]);this[_0xb0cb('0xb')]=_0x63c134[_0xb0cb('0x8')];this[_0xb0cb('0xc')]=_0x17d2cb[_0xb0cb('0x7')];this[_0xb0cb('0xd')]=_0x63c134[_0xb0cb('0xd')]||![];this[_0xb0cb('0xe')]=_0x17d2cb[_0xb0cb('0xe')];this[_0xb0cb('0xf')]=_0x17d2cb[_0xb0cb('0xf')]||0x3;this[_0xb0cb('0x10')]=_0x63c134[_0xb0cb('0x10')];this['countbusyretry']=_0x63c134[_0xb0cb('0x11')];this[_0xb0cb('0x12')]=_0x63c134[_0xb0cb('0x12')];this[_0xb0cb('0x13')]=_0x63c134[_0xb0cb('0x13')];this['countnosuchnumberretry']=_0x63c134[_0xb0cb('0x14')];this[_0xb0cb('0x15')]=_0x63c134[_0xb0cb('0x15')];this[_0xb0cb('0x16')]=_0x63c134[_0xb0cb('0x16')];this[_0xb0cb('0x17')]=_0x63c134[_0xb0cb('0x17')];this[_0xb0cb('0x18')]=_0x63c134[_0xb0cb('0x18')];this['ContactId']=_0x63c134['ContactId'];this['ListId']=_0x63c134[_0xb0cb('0x19')];this[_0xb0cb('0x1a')]=_0x63c134[_0xb0cb('0x1a')];this['VoiceQueueId']=_0x63c134['VoiceQueueId'];this[_0xb0cb('0x1b')]=_0x63c134[_0xb0cb('0x1b')];this[_0xb0cb('0x1c')]=_0x63c134['id'];this['ContactFirstName']=_0x63c134[_0xb0cb('0x9')][_0xb0cb('0x1d')]||'';this['starttime']=moment()['format'](_0xb0cb('0x1e'));this[_0xb0cb('0x1f')]=_0x63c134[_0xb0cb('0x1f')];this['callbackuniqueid']=_0x63c134['callbackuniqueid'];this[_0xb0cb('0x20')]=_0x63c134['callbackat'];this[_0xb0cb('0x21')]=_0x63c134['recallme'];this[_0xb0cb('0x22')]='';this[_0xb0cb('0x23')]='';}Action[_0xb0cb('0x24')][_0xb0cb('0x25')]=function(){return util['format'](_0xb0cb('0x26'),this['name'],this[_0xb0cb('0x5')][_0xb0cb('0x27')]>0x0?this[_0xb0cb('0xb')]['substring'](this[_0xb0cb('0x5')][_0xb0cb('0x27')]):this[_0xb0cb('0xb')]);};Action['prototype'][_0xb0cb('0x28')]=function(){return this[_0xb0cb('0xc')];};module[_0xb0cb('0x29')]=Action; \ No newline at end of file +var _0xcce1=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','string','voiceQueue','uniqueid','Contact','phone','firstName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x4b1c39,_0x57e940){var _0xa5e7e4=function(_0x1a5f53){while(--_0x1a5f53){_0x4b1c39['push'](_0x4b1c39['shift']());}};_0xa5e7e4(++_0x57e940);}(_0xcce1,0x1c1));var _0x1cce=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0xcce1[_0x545a3a];return _0x5a5493;};'use strict';var util=require(_0x1cce('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x50218b,_0x523c11,_0x51a58d){var _0x2001ba='';if(!_['isNil'](_0x523c11)&&_0x1cce('0x1')===typeof _0x523c11){_0x2001ba+=_0x523c11;}if(!_['isNil'](_0x51a58d)&&_0x1cce('0x1')===typeof _0x51a58d){_0x2001ba+='\x20'+_0x51a58d;}if(_0x2001ba!==''){return _0x2001ba;}return _0x50218b;}function Action(_0x26fcc3,_0x281119,_0x5f168e){this[_0x1cce('0x2')]=_0x26fcc3;this[_0x1cce('0x3')]=_0x5f168e||undefined;this['name']=checkNameSurname(_0x281119[_0x1cce('0x4')][_0x1cce('0x5')],_0x281119[_0x1cce('0x4')][_0x1cce('0x6')],_0x281119[_0x1cce('0x4')]['lastName']);this[_0x1cce('0x7')]=_0x281119[_0x1cce('0x5')];this[_0x1cce('0x8')]=_0x26fcc3[_0x1cce('0x9')];this[_0x1cce('0xa')]=_0x281119[_0x1cce('0xa')]||![];this[_0x1cce('0xb')]=_0x26fcc3[_0x1cce('0xb')];this[_0x1cce('0xc')]=_0x26fcc3[_0x1cce('0xc')]||0x3;this[_0x1cce('0xd')]=_0x281119[_0x1cce('0xd')];this[_0x1cce('0xe')]=_0x281119['countbusyretry'];this[_0x1cce('0xf')]=_0x281119[_0x1cce('0xf')];this[_0x1cce('0x10')]=_0x281119[_0x1cce('0x10')];this['countnosuchnumberretry']=_0x281119[_0x1cce('0x11')];this[_0x1cce('0x12')]=_0x281119[_0x1cce('0x12')];this[_0x1cce('0x13')]=_0x281119[_0x1cce('0x13')];this[_0x1cce('0x14')]=_0x281119[_0x1cce('0x14')];this[_0x1cce('0x15')]=_0x281119['countagentrejectretry'];this[_0x1cce('0x16')]=_0x281119['ContactId'];this[_0x1cce('0x17')]=_0x281119[_0x1cce('0x17')];this[_0x1cce('0x18')]=_0x281119[_0x1cce('0x18')];this[_0x1cce('0x19')]=_0x281119[_0x1cce('0x19')];this[_0x1cce('0x1a')]=_0x281119[_0x1cce('0x1a')];this[_0x1cce('0x1b')]=_0x281119['id'];this[_0x1cce('0x1c')]=_0x281119[_0x1cce('0x4')][_0x1cce('0x6')]||'';this[_0x1cce('0x1d')]=moment()[_0x1cce('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1cce('0x1f')]=_0x281119['callback'];this[_0x1cce('0x20')]=_0x281119[_0x1cce('0x20')];this['callbackat']=_0x281119[_0x1cce('0x21')];this['recallme']=_0x281119[_0x1cce('0x22')];this[_0x1cce('0x23')]='';this[_0x1cce('0x24')]='';}Action[_0x1cce('0x25')][_0x1cce('0x26')]=function(){return util['format'](_0x1cce('0x27'),this[_0x1cce('0x9')],this[_0x1cce('0x2')][_0x1cce('0x28')]>0x0?this['number']['substring'](this[_0x1cce('0x2')][_0x1cce('0x28')]):this['number']);};Action[_0x1cce('0x25')][_0x1cce('0x29')]=function(){return this[_0x1cce('0x8')];};module[_0x1cce('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 db16d14..cf83df7 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 _0x886a=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','../utils','state','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime'];(function(_0x461119,_0x4e4aff){var _0x23ad98=function(_0x40e57b){while(--_0x40e57b){_0x461119['push'](_0x461119['shift']());}};_0x23ad98(++_0x4e4aff);}(_0x886a,0x6c));var _0xa886=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0x886a[_0x154983];return _0x3d1243;};'use strict';var moment=require(_0xa886('0x0'));var utils=require(_0xa886('0x1'));function AgentComplete(_0x1642cf,_0x193550){this[_0xa886('0x2')]=0x4;this['statedesc']=_0xa886('0x3');this['scheduledat']=_0x1642cf[_0xa886('0x4')];this['type']=_0x1642cf[_0xa886('0x5')];this['campaigntype']=_0x1642cf[_0xa886('0x5')]===_0xa886('0x6')?'queue':_0x1642cf[_0xa886('0x5')];this[_0xa886('0x7')]=_0x1642cf[_0xa886('0x7')];this[_0xa886('0x8')]=_0x1642cf['countcongestionretry'];this[_0xa886('0x9')]=_0x1642cf[_0xa886('0x9')];this[_0xa886('0xa')]=_0x1642cf[_0xa886('0x7')]+_0x1642cf['countcongestionretry']+_0x1642cf['countnoanswerretry']+_0x1642cf[_0xa886('0xb')]+_0x1642cf[_0xa886('0xc')]+_0x1642cf[_0xa886('0xd')]+_0x1642cf['countmachineretry']+_0x1642cf['countagentrejectretry'];this[_0xa886('0xb')]=_0x1642cf[_0xa886('0xb')];this[_0xa886('0xc')]=_0x1642cf[_0xa886('0xc')];this[_0xa886('0xd')]=_0x1642cf['countabandonedretry'];this[_0xa886('0xe')]=_0x1642cf[_0xa886('0xe')];this[_0xa886('0xf')]=_0x1642cf[_0xa886('0xf')];this[_0xa886('0x10')]=_0x193550[_0xa886('0x10')];this[_0xa886('0x11')]=_0x1642cf[_0xa886('0x12')];this['calleridnum']=_0x1642cf[_0xa886('0x13')];this['starttime']=_0x1642cf[_0xa886('0x14')];this['responsetime']=_0x1642cf[_0xa886('0x15')];this[_0xa886('0x16')]=_0x1642cf['answertime'];this[_0xa886('0x17')]=moment()[_0xa886('0x18')](_0xa886('0x19'));this[_0xa886('0x1a')]=utils[_0xa886('0x1b')](_0x1642cf[_0xa886('0x15')],_0x1642cf['starttime']);this[_0xa886('0x1c')]=utils[_0xa886('0x1b')](_0x1642cf[_0xa886('0x16')],_0x1642cf[_0xa886('0x15')]);this[_0xa886('0x1d')]=utils[_0xa886('0x1b')](this[_0xa886('0x17')],_0x1642cf[_0xa886('0x16')]);this[_0xa886('0x1e')]=_0x193550[_0xa886('0x1e')];this['membername']=_0x193550[_0xa886('0x1f')];this[_0xa886('0x20')]=_0x193550[_0xa886('0x20')];this[_0xa886('0x21')]=_0x1642cf[_0xa886('0x21')];this[_0xa886('0x22')]=_0x1642cf[_0xa886('0x22')];this[_0xa886('0x23')]=_0x1642cf[_0xa886('0x23')];this[_0xa886('0x24')]=_0x1642cf[_0xa886('0x24')];this[_0xa886('0x25')]=_0x1642cf[_0xa886('0x25')];this[_0xa886('0x26')]=_0x1642cf[_0xa886('0x26')];this[_0xa886('0x27')]=_0x1642cf[_0xa886('0x27')];this[_0xa886('0x28')]=_0x1642cf[_0xa886('0x28')];this[_0xa886('0x29')]=_0x1642cf[_0xa886('0x29')];this[_0xa886('0x2a')]=_0x1642cf[_0xa886('0x2a')]||'';this[_0xa886('0x2b')]=_0x1642cf['originatecalleridname']||'';this['agiafterat']=_0x1642cf['agiafterat'];}module['exports']=AgentComplete; \ No newline at end of file +var _0x09be=['talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime'];(function(_0x69634c,_0x18204b){var _0x284c62=function(_0x2f2357){while(--_0x2f2357){_0x69634c['push'](_0x69634c['shift']());}};_0x284c62(++_0x18204b);}(_0x09be,0x12c));var _0xe09b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09be[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xe09b('0x0'));var utils=require(_0xe09b('0x1'));function AgentComplete(_0x333a7f,_0xc45085){this['state']=0x4;this[_0xe09b('0x2')]='Answer';this[_0xe09b('0x3')]=_0x333a7f[_0xe09b('0x3')];this[_0xe09b('0x4')]=_0x333a7f[_0xe09b('0x4')];this['campaigntype']=_0x333a7f[_0xe09b('0x4')]===_0xe09b('0x5')?_0xe09b('0x6'):_0x333a7f['type'];this[_0xe09b('0x7')]=_0x333a7f['countbusyretry'];this[_0xe09b('0x8')]=_0x333a7f[_0xe09b('0x8')];this[_0xe09b('0x9')]=_0x333a7f[_0xe09b('0x9')];this['countglobal']=_0x333a7f[_0xe09b('0x7')]+_0x333a7f['countcongestionretry']+_0x333a7f['countnoanswerretry']+_0x333a7f[_0xe09b('0xa')]+_0x333a7f[_0xe09b('0xb')]+_0x333a7f[_0xe09b('0xc')]+_0x333a7f[_0xe09b('0xd')]+_0x333a7f[_0xe09b('0xe')];this[_0xe09b('0xa')]=_0x333a7f['countnosuchnumberretry'];this['countdropretry']=_0x333a7f[_0xe09b('0xb')];this['countabandonedretry']=_0x333a7f[_0xe09b('0xc')];this[_0xe09b('0xd')]=_0x333a7f['countmachineretry'];this[_0xe09b('0xe')]=_0x333a7f['countagentrejectretry'];this[_0xe09b('0xf')]=_0xc45085['uniqueid'];this[_0xe09b('0x10')]=_0x333a7f['name'];this[_0xe09b('0x11')]=_0x333a7f[_0xe09b('0x12')];this[_0xe09b('0x13')]=_0x333a7f[_0xe09b('0x13')];this[_0xe09b('0x14')]=_0x333a7f['responsetime'];this[_0xe09b('0x15')]=_0x333a7f[_0xe09b('0x15')];this[_0xe09b('0x16')]=moment()[_0xe09b('0x17')](_0xe09b('0x18'));this[_0xe09b('0x19')]=utils[_0xe09b('0x1a')](_0x333a7f[_0xe09b('0x14')],_0x333a7f['starttime']);this[_0xe09b('0x1b')]=utils[_0xe09b('0x1a')](_0x333a7f[_0xe09b('0x15')],_0x333a7f['responsetime']);this[_0xe09b('0x1c')]=utils[_0xe09b('0x1a')](this[_0xe09b('0x16')],_0x333a7f['answertime']);this['queue']=_0xc45085[_0xe09b('0x6')];this[_0xe09b('0x1d')]=_0xc45085[_0xe09b('0x1d')];this['reason']=_0xc45085['reason'];this[_0xe09b('0x1e')]=_0x333a7f['callback'];this[_0xe09b('0x1f')]=_0x333a7f['callbackuniqueid'];this[_0xe09b('0x20')]=_0x333a7f[_0xe09b('0x20')];this[_0xe09b('0x21')]=_0x333a7f[_0xe09b('0x21')];this[_0xe09b('0x22')]=_0x333a7f[_0xe09b('0x22')];this['ListId']=_0x333a7f['ListId'];this[_0xe09b('0x23')]=_0x333a7f[_0xe09b('0x23')];this[_0xe09b('0x24')]=_0x333a7f[_0xe09b('0x24')];this[_0xe09b('0x25')]=_0x333a7f[_0xe09b('0x25')];this['originatecalleridnum']=_0x333a7f[_0xe09b('0x26')]||'';this[_0xe09b('0x27')]=_0x333a7f[_0xe09b('0x27')]||'';this[_0xe09b('0x28')]=_0x333a7f[_0xe09b('0x28')];}module['exports']=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 48973d7..2c63072 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 _0x1521=['type','outbound','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat'];(function(_0x22aee4,_0x3b490d){var _0x4a6815=function(_0x1f60bc){while(--_0x1f60bc){_0x22aee4['push'](_0x22aee4['shift']());}};_0x4a6815(++_0x3b490d);}(_0x1521,0x1de));var _0x1152=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x1521[_0x2b55b5];return _0x103d28;};'use strict';function Final(_0x35ffd7){this[_0x1152('0x0')]=_0x35ffd7[_0x1152('0x0')];this[_0x1152('0x1')]=_0x35ffd7[_0x1152('0x1')];this[_0x1152('0x2')]=_0x35ffd7['type'];this['campaigntype']=_0x35ffd7['type']===_0x1152('0x3')?'queue':_0x35ffd7[_0x1152('0x2')];this['countbusyretry']=_0x35ffd7['countbusyretry'];this[_0x1152('0x4')]=_0x35ffd7[_0x1152('0x4')];this[_0x1152('0x5')]=_0x35ffd7[_0x1152('0x5')];this[_0x1152('0x6')]=_0x35ffd7['countbusyretry']+_0x35ffd7[_0x1152('0x4')]+_0x35ffd7[_0x1152('0x5')]+_0x35ffd7[_0x1152('0x7')]+_0x35ffd7[_0x1152('0x8')]+_0x35ffd7['countabandonedretry']+_0x35ffd7['countmachineretry']+_0x35ffd7['countagentrejectretry'];this[_0x1152('0x7')]=_0x35ffd7[_0x1152('0x7')];this['countdropretry']=_0x35ffd7[_0x1152('0x8')];this[_0x1152('0x9')]=_0x35ffd7[_0x1152('0x9')];this['countmachineretry']=_0x35ffd7[_0x1152('0xa')];this[_0x1152('0xb')]=_0x35ffd7[_0x1152('0xb')];this['queue']=_0x35ffd7['queue'];this[_0x1152('0xc')]=_0x35ffd7[_0x1152('0xc')];this[_0x1152('0xd')]=_0x35ffd7[_0x1152('0xd')];this[_0x1152('0xe')]=_0x35ffd7[_0x1152('0xe')];this['responsetime']=_0x35ffd7[_0x1152('0xf')];this[_0x1152('0x10')]=_0x35ffd7[_0x1152('0xf')];this[_0x1152('0x11')]=_0x35ffd7[_0x1152('0x11')]||0x0;this[_0x1152('0x12')]=_0x35ffd7[_0x1152('0x12')]||0x0;this[_0x1152('0x13')]=_0x35ffd7[_0x1152('0x13')]||0x0;this['callback']=_0x35ffd7[_0x1152('0x14')];this[_0x1152('0x15')]=_0x35ffd7[_0x1152('0x15')];this['callbackat']=_0x35ffd7[_0x1152('0x16')];this[_0x1152('0x17')]=_0x35ffd7['recallme'];this['ContactId']=_0x35ffd7['ContactId'];this['ListId']=_0x35ffd7['ListId'];this[_0x1152('0x18')]=_0x35ffd7[_0x1152('0x18')];this[_0x1152('0x19')]=_0x35ffd7[_0x1152('0x19')];this[_0x1152('0x1a')]=_0x35ffd7[_0x1152('0x1a')];this[_0x1152('0x1b')]=_0x35ffd7[_0x1152('0x1b')]||'';this[_0x1152('0x1c')]=_0x35ffd7['originatecalleridname']||'';this[_0x1152('0x1d')]=_0x35ffd7[_0x1152('0x1d')];this['statedesc']=_0x35ffd7[_0x1152('0x1e')];}module[_0x1152('0x1f')]=Final; \ No newline at end of file +var _0xea68=['countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0x359a7d,_0x696466){var _0x1e7515=function(_0x343461){while(--_0x343461){_0x359a7d['push'](_0x359a7d['shift']());}};_0x1e7515(++_0x696466);}(_0xea68,0x1bc));var _0x8ea6=function(_0x437ba0,_0x30b5dd){_0x437ba0=_0x437ba0-0x0;var _0x6fa2ec=_0xea68[_0x437ba0];return _0x6fa2ec;};'use strict';function Final(_0x12094e){this[_0x8ea6('0x0')]=_0x12094e[_0x8ea6('0x0')];this[_0x8ea6('0x1')]=_0x12094e[_0x8ea6('0x1')];this[_0x8ea6('0x2')]=_0x12094e[_0x8ea6('0x2')];this[_0x8ea6('0x3')]=_0x12094e['type']==='outbound'?'queue':_0x12094e['type'];this[_0x8ea6('0x4')]=_0x12094e['countbusyretry'];this[_0x8ea6('0x5')]=_0x12094e[_0x8ea6('0x5')];this[_0x8ea6('0x6')]=_0x12094e[_0x8ea6('0x6')];this[_0x8ea6('0x7')]=_0x12094e[_0x8ea6('0x4')]+_0x12094e[_0x8ea6('0x5')]+_0x12094e[_0x8ea6('0x6')]+_0x12094e['countnosuchnumberretry']+_0x12094e[_0x8ea6('0x8')]+_0x12094e[_0x8ea6('0x9')]+_0x12094e[_0x8ea6('0xa')]+_0x12094e[_0x8ea6('0xb')];this[_0x8ea6('0xc')]=_0x12094e[_0x8ea6('0xc')];this[_0x8ea6('0x8')]=_0x12094e[_0x8ea6('0x8')];this['countabandonedretry']=_0x12094e[_0x8ea6('0x9')];this['countmachineretry']=_0x12094e[_0x8ea6('0xa')];this[_0x8ea6('0xb')]=_0x12094e['countagentrejectretry'];this[_0x8ea6('0xd')]=_0x12094e[_0x8ea6('0xd')];this[_0x8ea6('0xe')]=_0x12094e['calleridname'];this[_0x8ea6('0xf')]=_0x12094e['calleridnum'];this[_0x8ea6('0x10')]=_0x12094e[_0x8ea6('0x10')];this['responsetime']=_0x12094e[_0x8ea6('0x11')];this[_0x8ea6('0x12')]=_0x12094e['responsetime'];this[_0x8ea6('0x13')]=_0x12094e['ringtime']||0x0;this['holdtime']=_0x12094e['holdtime']||0x0;this[_0x8ea6('0x14')]=_0x12094e[_0x8ea6('0x14')]||0x0;this[_0x8ea6('0x15')]=_0x12094e[_0x8ea6('0x15')];this[_0x8ea6('0x16')]=_0x12094e['callbackuniqueid'];this[_0x8ea6('0x17')]=_0x12094e[_0x8ea6('0x17')];this[_0x8ea6('0x18')]=_0x12094e[_0x8ea6('0x18')];this[_0x8ea6('0x19')]=_0x12094e[_0x8ea6('0x19')];this[_0x8ea6('0x1a')]=_0x12094e['ListId'];this[_0x8ea6('0x1b')]=_0x12094e[_0x8ea6('0x1b')];this[_0x8ea6('0x1c')]=_0x12094e['VoiceQueueId'];this['CampaignId']=_0x12094e[_0x8ea6('0x1d')];this['originatecalleridnum']=_0x12094e[_0x8ea6('0x1e')]||'';this['originatecalleridname']=_0x12094e[_0x8ea6('0x1f')]||'';this[_0x8ea6('0x20')]=_0x12094e[_0x8ea6('0x20')];this[_0x8ea6('0x21')]=_0x12094e['statedesc'];}module[_0x8ea6('0x22')]=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 0bc6ea0..92b931d 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 _0x0d0f=['statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils'];(function(_0x1df213,_0x1035ff){var _0x11edef=function(_0x10e335){while(--_0x10e335){_0x1df213['push'](_0x1df213['shift']());}};_0x11edef(++_0x1035ff);}(_0x0d0f,0x166));var _0xf0d0=function(_0x45fad9,_0x1c5e89){_0x45fad9=_0x45fad9-0x0;var _0x46b64f=_0x0d0f[_0x45fad9];return _0x46b64f;};'use strict';var moment=require(_0xf0d0('0x0'));var utils=require(_0xf0d0('0x1'));function Hangup(_0x493643,_0x3cf9b8){this['state']=0x4;this[_0xf0d0('0x2')]=_0xf0d0('0x3');this[_0xf0d0('0x4')]=_0x493643[_0xf0d0('0x4')];this[_0xf0d0('0x5')]=_0x493643['type'];this[_0xf0d0('0x6')]=_0x493643['type']===_0xf0d0('0x7')?'queue':_0x493643['type'];this[_0xf0d0('0x8')]=_0x493643[_0xf0d0('0x8')]||![];this[_0xf0d0('0x9')]=_0x493643['countbusyretry'];this[_0xf0d0('0xa')]=_0x493643[_0xf0d0('0xa')];this[_0xf0d0('0xb')]=_0x493643[_0xf0d0('0xb')];this[_0xf0d0('0xc')]=_0x493643[_0xf0d0('0x9')]+_0x493643[_0xf0d0('0xa')]+_0x493643[_0xf0d0('0xb')]+_0x493643[_0xf0d0('0xd')]+_0x493643[_0xf0d0('0xe')]+_0x493643[_0xf0d0('0xf')]+_0x493643[_0xf0d0('0x10')]+_0x493643[_0xf0d0('0x11')];this[_0xf0d0('0xd')]=_0x493643[_0xf0d0('0xd')];this[_0xf0d0('0xe')]=_0x493643[_0xf0d0('0xe')];this[_0xf0d0('0xf')]=_0x493643[_0xf0d0('0xf')];this[_0xf0d0('0x10')]=_0x493643[_0xf0d0('0x10')];this['countagentrejectretry']=_0x493643['countagentrejectretry'];this[_0xf0d0('0x12')]=_0x3cf9b8[_0xf0d0('0x12')];this[_0xf0d0('0x13')]=_0x493643[_0xf0d0('0x14')];this[_0xf0d0('0x15')]=_0x493643[_0xf0d0('0x16')];this['starttime']=_0x493643[_0xf0d0('0x17')];this[_0xf0d0('0x18')]=_0x493643[_0xf0d0('0x18')];this[_0xf0d0('0x19')]=moment()[_0xf0d0('0x1a')](_0xf0d0('0x1b'));this[_0xf0d0('0x1c')]=utils[_0xf0d0('0x1d')](_0x493643[_0xf0d0('0x18')],_0x493643[_0xf0d0('0x17')]);this[_0xf0d0('0x1e')]=0x0;this[_0xf0d0('0x1f')]=utils[_0xf0d0('0x1d')](this[_0xf0d0('0x19')],_0x493643['responsetime']);this['queue']=_0x493643[_0xf0d0('0x20')];this[_0xf0d0('0x21')]=_0xf0d0('0x22');this['reason']=_0x3cf9b8['cause-txt'];this[_0xf0d0('0x23')]=_0x493643[_0xf0d0('0x23')];this[_0xf0d0('0x24')]=_0x493643[_0xf0d0('0x24')];this[_0xf0d0('0x25')]=_0x493643[_0xf0d0('0x25')];this[_0xf0d0('0x26')]=_0x493643[_0xf0d0('0x26')];this[_0xf0d0('0x27')]=_0x493643['ContactId'];this['ListId']=_0x493643[_0xf0d0('0x28')];this['UserId']=_0x493643[_0xf0d0('0x29')];this['VoiceQueueId']=_0x493643[_0xf0d0('0x2a')];this[_0xf0d0('0x2b')]=_0x493643[_0xf0d0('0x2b')];}module[_0xf0d0('0x2c')]=Hangup; \ No newline at end of file +var _0xb748=['callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','membername','IVR','reason','cause-txt','callback'];(function(_0x1529b7,_0x8929e9){var _0x9b068d=function(_0x4e3510){while(--_0x4e3510){_0x1529b7['push'](_0x1529b7['shift']());}};_0x9b068d(++_0x8929e9);}(_0xb748,0x7f));var _0x8b74=function(_0x45075b,_0x51b238){_0x45075b=_0x45075b-0x0;var _0x185486=_0xb748[_0x45075b];return _0x185486;};'use strict';var moment=require('moment');var utils=require(_0x8b74('0x0'));function Hangup(_0x3264bf,_0x16d80d){this[_0x8b74('0x1')]=0x4;this['statedesc']=_0x8b74('0x2');this[_0x8b74('0x3')]=_0x3264bf[_0x8b74('0x3')];this[_0x8b74('0x4')]=_0x3264bf[_0x8b74('0x4')];this[_0x8b74('0x5')]=_0x3264bf[_0x8b74('0x4')]===_0x8b74('0x6')?_0x8b74('0x7'):_0x3264bf[_0x8b74('0x4')];this[_0x8b74('0x8')]=_0x3264bf[_0x8b74('0x8')]||![];this['countbusyretry']=_0x3264bf[_0x8b74('0x9')];this[_0x8b74('0xa')]=_0x3264bf[_0x8b74('0xa')];this[_0x8b74('0xb')]=_0x3264bf['countnoanswerretry'];this['countglobal']=_0x3264bf[_0x8b74('0x9')]+_0x3264bf[_0x8b74('0xa')]+_0x3264bf['countnoanswerretry']+_0x3264bf[_0x8b74('0xc')]+_0x3264bf[_0x8b74('0xd')]+_0x3264bf[_0x8b74('0xe')]+_0x3264bf[_0x8b74('0xf')]+_0x3264bf[_0x8b74('0x10')];this[_0x8b74('0xc')]=_0x3264bf[_0x8b74('0xc')];this[_0x8b74('0xd')]=_0x3264bf['countdropretry'];this[_0x8b74('0xe')]=_0x3264bf[_0x8b74('0xe')];this['countmachineretry']=_0x3264bf['countmachineretry'];this['countagentrejectretry']=_0x3264bf['countagentrejectretry'];this[_0x8b74('0x11')]=_0x16d80d[_0x8b74('0x11')];this[_0x8b74('0x12')]=_0x3264bf[_0x8b74('0x13')];this['calleridnum']=_0x3264bf[_0x8b74('0x14')];this[_0x8b74('0x15')]=_0x3264bf[_0x8b74('0x15')];this[_0x8b74('0x16')]=_0x3264bf[_0x8b74('0x16')];this[_0x8b74('0x17')]=moment()[_0x8b74('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8b74('0x19')]=utils[_0x8b74('0x1a')](_0x3264bf[_0x8b74('0x16')],_0x3264bf[_0x8b74('0x15')]);this[_0x8b74('0x1b')]=0x0;this['talktime']=utils[_0x8b74('0x1a')](this[_0x8b74('0x17')],_0x3264bf[_0x8b74('0x16')]);this[_0x8b74('0x7')]=_0x3264bf[_0x8b74('0x7')];this[_0x8b74('0x1c')]=_0x8b74('0x1d');this[_0x8b74('0x1e')]=_0x16d80d[_0x8b74('0x1f')];this[_0x8b74('0x20')]=_0x3264bf[_0x8b74('0x20')];this['callbackuniqueid']=_0x3264bf['callbackuniqueid'];this[_0x8b74('0x21')]=_0x3264bf[_0x8b74('0x21')];this[_0x8b74('0x22')]=_0x3264bf['recallme'];this[_0x8b74('0x23')]=_0x3264bf[_0x8b74('0x23')];this[_0x8b74('0x24')]=_0x3264bf[_0x8b74('0x24')];this['UserId']=_0x3264bf['UserId'];this[_0x8b74('0x25')]=_0x3264bf[_0x8b74('0x25')];this[_0x8b74('0x26')]=_0x3264bf[_0x8b74('0x26')];}module[_0x8b74('0x27')]=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 806ece3..7483c27 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 _0x2f43=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','getSeconds','holdtime'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x2f43,0x15a));var _0x32f4=function(_0xd43c73,_0xa7fdf7){_0xd43c73=_0xd43c73-0x0;var _0x1778a8=_0x2f43[_0xd43c73];return _0x1778a8;};'use strict';var utils=require(_0x32f4('0x0'));function History(_0x59507a){this['uniqueid']=_0x59507a[_0x32f4('0x1')];this[_0x32f4('0x2')]=_0x59507a[_0x32f4('0x2')]||undefined;this[_0x32f4('0x3')]=_0x59507a['type'];this[_0x32f4('0x4')]=_0x59507a[_0x32f4('0x3')]===_0x32f4('0x5')?'queue':_0x59507a['type'];this[_0x32f4('0x6')]=_0x59507a[_0x32f4('0x6')];this[_0x32f4('0x7')]=_0x59507a[_0x32f4('0x7')];this[_0x32f4('0x8')]=_0x59507a[_0x32f4('0x8')];this[_0x32f4('0x9')]=_0x59507a[_0x32f4('0x6')]+_0x59507a[_0x32f4('0x7')]+_0x59507a[_0x32f4('0x8')]+_0x59507a[_0x32f4('0xa')]+_0x59507a['countdropretry']+_0x59507a[_0x32f4('0xb')]+_0x59507a[_0x32f4('0xc')]+_0x59507a[_0x32f4('0xd')];this[_0x32f4('0xa')]=_0x59507a[_0x32f4('0xa')];this[_0x32f4('0xe')]=_0x59507a['countdropretry'];this[_0x32f4('0xb')]=_0x59507a[_0x32f4('0xb')];this[_0x32f4('0xc')]=_0x59507a['countmachineretry'];this[_0x32f4('0xd')]=_0x59507a['countagentrejectretry'];this[_0x32f4('0xf')]=_0x59507a['queue'];this[_0x32f4('0x10')]=_0x59507a[_0x32f4('0x11')];this[_0x32f4('0x12')]=_0x59507a[_0x32f4('0x13')];this['starttime']=_0x59507a[_0x32f4('0x14')];this[_0x32f4('0x15')]=_0x59507a[_0x32f4('0x15')];this['endtime']=_0x59507a['responsetime'];this['ringtime']=utils[_0x32f4('0x16')](_0x59507a[_0x32f4('0x15')],_0x59507a[_0x32f4('0x14')]);this[_0x32f4('0x17')]=0x0;this['talktime']=0x0;this[_0x32f4('0x18')]=_0x59507a['callback'];this[_0x32f4('0x19')]=_0x59507a[_0x32f4('0x19')];this[_0x32f4('0x1a')]=_0x59507a[_0x32f4('0x1a')];this[_0x32f4('0x1b')]=_0x59507a[_0x32f4('0x1b')];this[_0x32f4('0x1c')]=_0x59507a[_0x32f4('0x1c')];this[_0x32f4('0x1d')]=_0x59507a['ListId'];this['UserId']=_0x59507a[_0x32f4('0x1e')];this['VoiceQueueId']=_0x59507a[_0x32f4('0x1f')];this[_0x32f4('0x20')]=_0x59507a[_0x32f4('0x20')];this['originatecalleridnum']=_0x59507a['originatecalleridnum']||'';this[_0x32f4('0x21')]=_0x59507a[_0x32f4('0x21')]||'';this[_0x32f4('0x22')]=_0x59507a[_0x32f4('0x22')];this[_0x32f4('0x23')]=_0x59507a[_0x32f4('0x23')];}module[_0x32f4('0x24')]=History; \ No newline at end of file +var _0xe9ee=['responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','name','number','starttime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9ee,0x1e8));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xee9e('0x0'));function History(_0x262ab3){this[_0xee9e('0x1')]=_0x262ab3[_0xee9e('0x1')];this[_0xee9e('0x2')]=_0x262ab3['scheduledat']||undefined;this['type']=_0x262ab3[_0xee9e('0x3')];this[_0xee9e('0x4')]=_0x262ab3[_0xee9e('0x3')]===_0xee9e('0x5')?_0xee9e('0x6'):_0x262ab3[_0xee9e('0x3')];this['countbusyretry']=_0x262ab3[_0xee9e('0x7')];this[_0xee9e('0x8')]=_0x262ab3['countcongestionretry'];this[_0xee9e('0x9')]=_0x262ab3[_0xee9e('0x9')];this[_0xee9e('0xa')]=_0x262ab3['countbusyretry']+_0x262ab3['countcongestionretry']+_0x262ab3['countnoanswerretry']+_0x262ab3[_0xee9e('0xb')]+_0x262ab3[_0xee9e('0xc')]+_0x262ab3['countabandonedretry']+_0x262ab3[_0xee9e('0xd')]+_0x262ab3['countagentrejectretry'];this[_0xee9e('0xb')]=_0x262ab3[_0xee9e('0xb')];this['countdropretry']=_0x262ab3[_0xee9e('0xc')];this[_0xee9e('0xe')]=_0x262ab3[_0xee9e('0xe')];this[_0xee9e('0xd')]=_0x262ab3['countmachineretry'];this[_0xee9e('0xf')]=_0x262ab3['countagentrejectretry'];this['queue']=_0x262ab3['queue'];this['calleridname']=_0x262ab3[_0xee9e('0x10')];this['calleridnum']=_0x262ab3[_0xee9e('0x11')];this['starttime']=_0x262ab3[_0xee9e('0x12')];this[_0xee9e('0x13')]=_0x262ab3[_0xee9e('0x13')];this[_0xee9e('0x14')]=_0x262ab3[_0xee9e('0x13')];this[_0xee9e('0x15')]=utils[_0xee9e('0x16')](_0x262ab3[_0xee9e('0x13')],_0x262ab3[_0xee9e('0x12')]);this[_0xee9e('0x17')]=0x0;this[_0xee9e('0x18')]=0x0;this[_0xee9e('0x19')]=_0x262ab3[_0xee9e('0x19')];this['callbackuniqueid']=_0x262ab3[_0xee9e('0x1a')];this[_0xee9e('0x1b')]=_0x262ab3['callbackat'];this[_0xee9e('0x1c')]=_0x262ab3['recallme'];this[_0xee9e('0x1d')]=_0x262ab3[_0xee9e('0x1d')];this[_0xee9e('0x1e')]=_0x262ab3[_0xee9e('0x1e')];this['UserId']=_0x262ab3[_0xee9e('0x1f')];this[_0xee9e('0x20')]=_0x262ab3[_0xee9e('0x20')];this[_0xee9e('0x21')]=_0x262ab3[_0xee9e('0x21')];this[_0xee9e('0x22')]=_0x262ab3['originatecalleridnum']||'';this[_0xee9e('0x23')]=_0x262ab3[_0xee9e('0x23')]||'';this[_0xee9e('0x24')]=_0x262ab3[_0xee9e('0x24')];this[_0xee9e('0x25')]=_0x262ab3[_0xee9e('0x25')];}module[_0xee9e('0x26')]=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 90ffdfd..63b21e4 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 _0x13c9=['calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13c9,0x1c1));var _0x913c=function(_0x237d3e,_0x4e0f5b){_0x237d3e=_0x237d3e-0x0;var _0x28ac17=_0x13c9[_0x237d3e];return _0x28ac17;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1bdac5,_0x26a658){this['scheduledat']=_0x1bdac5[_0x913c('0x0')];this[_0x913c('0x1')]=_0x1bdac5[_0x913c('0x1')];this['campaigntype']=_0x1bdac5[_0x913c('0x1')]===_0x913c('0x2')?_0x913c('0x3'):_0x1bdac5['type'];this['countbusyretry']=_0x1bdac5[_0x913c('0x4')];this['countcongestionretry']=_0x1bdac5[_0x913c('0x5')];this[_0x913c('0x6')]=_0x1bdac5[_0x913c('0x6')];this[_0x913c('0x7')]=_0x1bdac5[_0x913c('0x4')]+_0x1bdac5[_0x913c('0x5')]+_0x1bdac5[_0x913c('0x6')]+_0x1bdac5[_0x913c('0x8')]+_0x1bdac5['countdropretry']+_0x1bdac5[_0x913c('0x9')]+_0x1bdac5[_0x913c('0xa')]+_0x1bdac5['countagentrejectretry'];this[_0x913c('0x8')]=_0x1bdac5[_0x913c('0x8')];this['countdropretry']=_0x1bdac5['countdropretry'];this[_0x913c('0x9')]=_0x1bdac5['countabandonedretry'];this['countmachineretry']=_0x1bdac5[_0x913c('0xa')];this[_0x913c('0xb')]=_0x1bdac5[_0x913c('0xb')];this['uniqueid']=_0x26a658[_0x913c('0xc')];this[_0x913c('0xd')]=_0x1bdac5[_0x913c('0xe')];this[_0x913c('0xf')]=_0x1bdac5[_0x913c('0x10')];this['starttime']=_0x1bdac5[_0x913c('0x11')];this['responsetime']=_0x1bdac5[_0x913c('0x12')];this['droptime']=_0x1bdac5[_0x913c('0x13')];this['dropreason']=_0x1bdac5[_0x913c('0x14')];this[_0x913c('0x15')]=this[_0x913c('0x13')];this[_0x913c('0x16')]=utils['getSeconds'](_0x1bdac5['responsetime'],_0x1bdac5['starttime']);this[_0x913c('0x17')]=utils['getSeconds'](this[_0x913c('0x13')],_0x1bdac5['responsetime']);this['talktime']=0x0;this[_0x913c('0x3')]=_0x26a658[_0x913c('0x3')];this[_0x913c('0x18')]=_0x26a658[_0x913c('0x19')];this['reason']=_0x26a658[_0x913c('0x1a')];this[_0x913c('0x1b')]=_0x1bdac5[_0x913c('0x1b')];this[_0x913c('0x1c')]=_0x1bdac5[_0x913c('0x1c')];this['callbackat']=_0x1bdac5[_0x913c('0x1d')];this[_0x913c('0x1e')]=_0x1bdac5[_0x913c('0x1e')];this[_0x913c('0x1f')]=_0x1bdac5[_0x913c('0x1f')];this[_0x913c('0x20')]=_0x1bdac5['ListId'];this[_0x913c('0x21')]=_0x1bdac5['UserId'];this['VoiceQueueId']=_0x1bdac5[_0x913c('0x22')];this['CampaignId']=_0x1bdac5[_0x913c('0x23')];this[_0x913c('0x24')]=_0x1bdac5[_0x913c('0x24')]||'';this[_0x913c('0x25')]=_0x1bdac5[_0x913c('0x25')]||'';this['agiafterat']=_0x1bdac5[_0x913c('0x26')];this['state']=_0x1bdac5[_0x913c('0x27')];this[_0x913c('0x28')]=_0x1bdac5[_0x913c('0x28')];}module[_0x913c('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xabdc=['starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x52d74c,_0x1e39a0){var _0x76b83d=function(_0x27468c){while(--_0x27468c){_0x52d74c['push'](_0x52d74c['shift']());}};_0x76b83d(++_0x1e39a0);}(_0xabdc,0x122));var _0xcabd=function(_0x11977b,_0x358adc){_0x11977b=_0x11977b-0x0;var _0x15ee46=_0xabdc[_0x11977b];return _0x15ee46;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0xed36fe,_0x784046){this[_0xcabd('0x0')]=_0xed36fe[_0xcabd('0x0')];this[_0xcabd('0x1')]=_0xed36fe['type'];this[_0xcabd('0x2')]=_0xed36fe[_0xcabd('0x1')]===_0xcabd('0x3')?_0xcabd('0x4'):_0xed36fe[_0xcabd('0x1')];this['countbusyretry']=_0xed36fe[_0xcabd('0x5')];this[_0xcabd('0x6')]=_0xed36fe[_0xcabd('0x6')];this['countnoanswerretry']=_0xed36fe[_0xcabd('0x7')];this['countglobal']=_0xed36fe['countbusyretry']+_0xed36fe[_0xcabd('0x6')]+_0xed36fe[_0xcabd('0x7')]+_0xed36fe[_0xcabd('0x8')]+_0xed36fe[_0xcabd('0x9')]+_0xed36fe[_0xcabd('0xa')]+_0xed36fe[_0xcabd('0xb')]+_0xed36fe[_0xcabd('0xc')];this['countnosuchnumberretry']=_0xed36fe[_0xcabd('0x8')];this[_0xcabd('0x9')]=_0xed36fe[_0xcabd('0x9')];this[_0xcabd('0xa')]=_0xed36fe['countabandonedretry'];this[_0xcabd('0xb')]=_0xed36fe['countmachineretry'];this[_0xcabd('0xc')]=_0xed36fe[_0xcabd('0xc')];this[_0xcabd('0xd')]=_0x784046['uniqueid'];this[_0xcabd('0xe')]=_0xed36fe[_0xcabd('0xf')];this[_0xcabd('0x10')]=_0xed36fe[_0xcabd('0x11')];this[_0xcabd('0x12')]=_0xed36fe[_0xcabd('0x12')];this[_0xcabd('0x13')]=_0xed36fe[_0xcabd('0x13')];this[_0xcabd('0x14')]=_0xed36fe[_0xcabd('0x14')];this[_0xcabd('0x15')]=_0xed36fe[_0xcabd('0x15')];this[_0xcabd('0x16')]=this[_0xcabd('0x14')];this[_0xcabd('0x17')]=utils[_0xcabd('0x18')](_0xed36fe[_0xcabd('0x13')],_0xed36fe['starttime']);this[_0xcabd('0x19')]=utils[_0xcabd('0x18')](this[_0xcabd('0x14')],_0xed36fe[_0xcabd('0x13')]);this[_0xcabd('0x1a')]=0x0;this['queue']=_0x784046[_0xcabd('0x4')];this[_0xcabd('0x1b')]=_0x784046[_0xcabd('0x1c')];this[_0xcabd('0x1d')]=_0x784046[_0xcabd('0x1d')];this[_0xcabd('0x1e')]=_0xed36fe[_0xcabd('0x1e')];this['callbackuniqueid']=_0xed36fe[_0xcabd('0x1f')];this[_0xcabd('0x20')]=_0xed36fe['callbackat'];this[_0xcabd('0x21')]=_0xed36fe[_0xcabd('0x21')];this[_0xcabd('0x22')]=_0xed36fe['ContactId'];this[_0xcabd('0x23')]=_0xed36fe[_0xcabd('0x23')];this[_0xcabd('0x24')]=_0xed36fe[_0xcabd('0x24')];this[_0xcabd('0x25')]=_0xed36fe[_0xcabd('0x25')];this[_0xcabd('0x26')]=_0xed36fe[_0xcabd('0x26')];this[_0xcabd('0x27')]=_0xed36fe[_0xcabd('0x27')]||'';this[_0xcabd('0x28')]=_0xed36fe['originatecalleridname']||'';this[_0xcabd('0x29')]=_0xed36fe[_0xcabd('0x29')];this[_0xcabd('0x2a')]=_0xed36fe['state'];this[_0xcabd('0x2b')]=_0xed36fe[_0xcabd('0x2b')];}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 cd8be3c..73e7191 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 _0x53ec=['moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','catch','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]','countReScheduled','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact'];(function(_0xd16d77,_0xefe726){var _0x17eca6=function(_0x990574){while(--_0x990574){_0xd16d77['push'](_0xd16d77['shift']());}};_0x17eca6(++_0xefe726);}(_0x53ec,0x192));var _0xc53e=function(_0x730192,_0x531aed){_0x730192=_0x730192-0x0;var _0x24bd5d=_0x53ec[_0x730192];return _0x24bd5d;};'use strict';var util=require(_0xc53e('0x0'));var logger=require(_0xc53e('0x1'))(_0xc53e('0x2'));var cmHopper=require(_0xc53e('0x3'));var cmHopperAdditionalPhone=require(_0xc53e('0x4'));var cmHopperBlack=require(_0xc53e('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x266c42){return util['inspect'](_0x266c42,{'showHidden':![],'depth':null});}function getContactDialer(_0x2b90f6,_0x38033d,_0x4a9c59){return cmHopper[_0xc53e('0x6')](_0x2b90f6['id'],_0x38033d,_0x4a9c59,_0x2b90f6['dialOrderByScheduledAt'])[_0xc53e('0x7')](function(_0x2de88b){_0x2b90f6['temp']=0x0;logger[_0xc53e('0x8')](_0xc53e('0x9'),inspectError(_0x2de88b));});}exports[_0xc53e('0x6')]=getContactDialer;function getContactDialerIvr(_0x2cb51d,_0xd9612){return cmHopper[_0xc53e('0xa')](_0x2cb51d['id'],_0xd9612,_0x2cb51d[_0xc53e('0xb')])[_0xc53e('0x7')](function(_0xa98198){_0x2cb51d['temp']=0x0;logger['error'](_0xc53e('0xc'),inspectError(_0xa98198));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x54e3ba){return cmHopper[_0xc53e('0xd')](_0x54e3ba)[_0xc53e('0x7')](function(_0x863fa){logger[_0xc53e('0x8')]('[countReScheduled]',inspectError(_0x863fa));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x1c06cd){return cmHopper[_0xc53e('0xe')](_0x1c06cd)[_0xc53e('0x7')](function(_0x3d2e17){logger[_0xc53e('0x8')](_0xc53e('0xf'),inspectError(_0x3d2e17));});}exports[_0xc53e('0xe')]=rescheduleContact;function unlockContact(_0x19c0d1,_0x455e4d,_0x2ad6eb){return cmHopper['unlockContact'](_0x19c0d1,_0x455e4d,_0x2ad6eb)[_0xc53e('0x7')](function(_0x191567){logger[_0xc53e('0x8')](_0xc53e('0x10'),inspectError(_0x191567));});}exports[_0xc53e('0x11')]=unlockContact;function moveContactManagedDialer(_0x270c78){return cmHopper[_0xc53e('0x12')](_0x270c78)[_0xc53e('0x7')](function(_0x3b550e){logger['error']('[moveContactManagedDialer]',inspectError(_0x3b550e));});}exports[_0xc53e('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x2a5bac){return cmHopperBlack[_0xc53e('0x13')](_0x2a5bac)[_0xc53e('0x7')](function(_0x20066e){logger[_0xc53e('0x8')](_0xc53e('0x14'),inspectError(_0x20066e));});}exports[_0xc53e('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x364c80){return cmHopperBlack[_0xc53e('0x15')](_0x364c80)[_0xc53e('0x7')](function(_0x44fd93){logger[_0xc53e('0x8')]('[checkIsBlackListIvr]',inspectError(_0x44fd93));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x531ede,_0x4f4304,_0x384218){return cmHopperAdditionalPhone[_0xc53e('0x16')](_0x531ede,_0x4f4304,_0x384218)[_0xc53e('0x7')](function(_0x180811){logger['error']('[verifyAdditionalPhone]',inspectError(_0x180811));});}exports[_0xc53e('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x496167,_0x1ae55e,_0x3a5ce8){return cmHopperAdditionalPhone[_0xc53e('0x17')](_0x496167,_0x1ae55e,_0x3a5ce8)[_0xc53e('0x7')](function(_0x63c5dc){logger['error'](_0xc53e('0x18'),inspectError(_0x63c5dc));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x4d9a68){return cmHopperHistory['avgHandleTime'](_0x4d9a68)[_0xc53e('0x7')](function(_0x57a1f5){logger[_0xc53e('0x8')]('[avgHandleTime]',inspectError(_0x57a1f5));});}exports[_0xc53e('0x19')]=avgHandleTime;function createHistory(_0x5112d2){return cmHopperHistory['createHistory'](_0x5112d2)[_0xc53e('0x7')](function(_0x6a62b0){logger[_0xc53e('0x8')](_0xc53e('0x1a'),inspectError(_0x6a62b0));});}exports[_0xc53e('0x1b')]=createHistory; \ No newline at end of file +var _0xc6ac=['../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','getContactDialerIvr','countReScheduled','[countReScheduled]','catch','[rescheduleContact]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone'];(function(_0x5c2c43,_0x3ded68){var _0xf04d0b=function(_0x322488){while(--_0x322488){_0x5c2c43['push'](_0x5c2c43['shift']());}};_0xf04d0b(++_0x3ded68);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4ec1f1,_0x99b5ee){_0x4ec1f1=_0x4ec1f1-0x0;var _0x43a6fa=_0xc6ac[_0x4ec1f1];return _0x43a6fa;};'use strict';var util=require(_0xcc6a('0x0'));var logger=require(_0xcc6a('0x1'))(_0xcc6a('0x2'));var cmHopper=require(_0xcc6a('0x3'));var cmHopperAdditionalPhone=require(_0xcc6a('0x4'));var cmHopperBlack=require(_0xcc6a('0x5'));var cmHopperHistory=require(_0xcc6a('0x6'));function inspectError(_0x31bbcd){return util[_0xcc6a('0x7')](_0x31bbcd,{'showHidden':![],'depth':null});}function getContactDialer(_0x22ee99,_0x2f26ab,_0x188b05){return cmHopper[_0xcc6a('0x8')](_0x22ee99['id'],_0x2f26ab,_0x188b05,_0x22ee99[_0xcc6a('0x9')])['catch'](function(_0x3dd497){_0x22ee99[_0xcc6a('0xa')]=0x0;logger[_0xcc6a('0xb')]('[getContactDialer]',inspectError(_0x3dd497));});}exports[_0xcc6a('0x8')]=getContactDialer;function getContactDialerIvr(_0x210f63,_0x7806a0){return cmHopper[_0xcc6a('0xc')](_0x210f63['id'],_0x7806a0,_0x210f63[_0xcc6a('0x9')])['catch'](function(_0x30a004){_0x210f63[_0xcc6a('0xa')]=0x0;logger[_0xcc6a('0xb')]('[getContactDialerIvr]',inspectError(_0x30a004));});}exports[_0xcc6a('0xc')]=getContactDialerIvr;function countReScheduled(_0x9e9a63){return cmHopper[_0xcc6a('0xd')](_0x9e9a63)['catch'](function(_0x59ce6d){logger[_0xcc6a('0xb')](_0xcc6a('0xe'),inspectError(_0x59ce6d));});}exports[_0xcc6a('0xd')]=countReScheduled;function rescheduleContact(_0x559a0a){return cmHopper['rescheduleContact'](_0x559a0a)[_0xcc6a('0xf')](function(_0xcb9e2e){logger[_0xcc6a('0xb')](_0xcc6a('0x10'),inspectError(_0xcb9e2e));});}exports[_0xcc6a('0x11')]=rescheduleContact;function unlockContact(_0x337ec5,_0x4133fa,_0x403b18){return cmHopper['unlockContact'](_0x337ec5,_0x4133fa,_0x403b18)['catch'](function(_0x4d021a){logger[_0xcc6a('0xb')](_0xcc6a('0x12'),inspectError(_0x4d021a));});}exports[_0xcc6a('0x13')]=unlockContact;function moveContactManagedDialer(_0x3e63d9){return cmHopper[_0xcc6a('0x14')](_0x3e63d9)[_0xcc6a('0xf')](function(_0x2d9585){logger[_0xcc6a('0xb')](_0xcc6a('0x15'),inspectError(_0x2d9585));});}exports[_0xcc6a('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1d20a3){return cmHopperBlack['checkIsBlackList'](_0x1d20a3)[_0xcc6a('0xf')](function(_0x3e1fda){logger[_0xcc6a('0xb')](_0xcc6a('0x16'),inspectError(_0x3e1fda));});}exports[_0xcc6a('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x30b8ed){return cmHopperBlack[_0xcc6a('0x18')](_0x30b8ed)[_0xcc6a('0xf')](function(_0x2254a8){logger[_0xcc6a('0xb')](_0xcc6a('0x19'),inspectError(_0x2254a8));});}exports[_0xcc6a('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x51be9a,_0x41c4c8,_0x3a081e){return cmHopperAdditionalPhone[_0xcc6a('0x1a')](_0x51be9a,_0x41c4c8,_0x3a081e)['catch'](function(_0x10016a){logger[_0xcc6a('0xb')](_0xcc6a('0x1b'),inspectError(_0x10016a));});}exports[_0xcc6a('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x432c23,_0x5fc697,_0x50abc1){return cmHopperAdditionalPhone[_0xcc6a('0x1c')](_0x432c23,_0x5fc697,_0x50abc1)[_0xcc6a('0xf')](function(_0x3514f3){logger['error'](_0xcc6a('0x1d'),inspectError(_0x3514f3));});}exports[_0xcc6a('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x4da301){return cmHopperHistory[_0xcc6a('0x1e')](_0x4da301)[_0xcc6a('0xf')](function(_0x3233d1){logger[_0xcc6a('0xb')]('[avgHandleTime]',inspectError(_0x3233d1));});}exports[_0xcc6a('0x1e')]=avgHandleTime;function createHistory(_0x3cf14c){return cmHopperHistory[_0xcc6a('0x1f')](_0x3cf14c)['catch'](function(_0x2590a2){logger['error']('[createHistory]',inspectError(_0x2590a2));});}exports[_0xcc6a('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 476fecb..14dbfc7 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 _0x1d14=['originated','Trunk','name','active','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','pow','random','toString','getCallerIdRandom','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','../../../../config/environment/shared','timezones','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','isQueueCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse'];(function(_0xe33e38,_0x8b4992){var _0xe3db22=function(_0x4932c9){while(--_0x4932c9){_0xe33e38['push'](_0xe33e38['shift']());}};_0xe3db22(++_0x8b4992);}(_0x1d14,0xd8));var _0x41d1=function(_0x2ce0a1,_0x533ef8){_0x2ce0a1=_0x2ce0a1-0x0;var _0x516a60=_0x1d14[_0x2ce0a1];return _0x516a60;};'use strict';var _=require(_0x41d1('0x0'));var moment=require(_0x41d1('0x1'));var util=require('util');var logger=require(_0x41d1('0x2'))('dialer');var timezones=require(_0x41d1('0x3'))[_0x41d1('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x41d1('0x5'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x41d1('0x6'),'EMPTY_INTERVAL':_0x41d1('0x7'),'INACTIVE':_0x41d1('0x8'),'NO_AGENTS_LOGGED':_0x41d1('0x9'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x41d1('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x41d1('0xb'),'QUEUE_RECALL':_0x41d1('0xc'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x41d1('0xd'),'UNKNOWN_TIMEZONE':_0x41d1('0xe'),'UNREACHABLE_TRUNK':_0x41d1('0xf')};exports[_0x41d1('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1698fb){return _0x1698fb[_0x41d1('0x11')]===_0x41d1('0x12');}exports[_0x41d1('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x4663ae){return _0x4663ae[_0x41d1('0x14')]===_0x41d1('0x15');}exports[_0x41d1('0x16')]=isIVRCampaign;function isOutboundQueue(_0x31f35d){return _0x31f35d[_0x41d1('0x14')]==='outbound';}exports[_0x41d1('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x317bca){return _0x317bca['dialActive'];}exports[_0x41d1('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2f42f4){return _0x2f42f4['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x1d36cb,_0x15a918){var _0x45b281=moment(_0x1d36cb)['milliseconds'](0x0);var _0x211eb7=moment(_0x15a918)[_0x41d1('0x19')](0x0);return _0x45b281[_0x41d1('0x1a')](_0x211eb7,_0x41d1('0x1b'));}exports[_0x41d1('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x21e668,_0x17d605){var _0x5da573=![];var _0x2649b3=_0x21e668[_0x41d1('0x11')]!==_0x17d605[_0x41d1('0x11')]||_0x21e668[_0x41d1('0x1d')]!==_0x17d605[_0x41d1('0x1d')]||_0x21e668[_0x41d1('0x1e')]!==_0x17d605[_0x41d1('0x1e')];var _0x3d1735=_0x21e668['available']!==_0x17d605[_0x41d1('0x1f')]||_0x21e668[_0x41d1('0x20')]!==_0x17d605[_0x41d1('0x20')]||_0x21e668[_0x41d1('0x21')]!==_0x17d605[_0x41d1('0x21')]||_0x21e668['paused']!==_0x17d605[_0x41d1('0x22')]||_0x21e668[_0x41d1('0x23')]!==_0x17d605['talking']||_0x21e668[_0x41d1('0x24')]!==_0x17d605[_0x41d1('0x24')]||_0x21e668[_0x41d1('0x25')]!==_0x17d605[_0x41d1('0x25')]||_0x21e668[_0x41d1('0x26')]!==_0x17d605[_0x41d1('0x26')]||_0x21e668[_0x41d1('0x27')]!==_0x17d605[_0x41d1('0x27')];if(_0x21e668[_0x41d1('0x28')]&&_0x17d605[_0x41d1('0x28')]){_0x5da573=_0x21e668['Trunk'][_0x41d1('0x29')]!==_0x17d605[_0x41d1('0x28')]['name']||_0x21e668[_0x41d1('0x28')][_0x41d1('0x2a')]!==_0x17d605[_0x41d1('0x28')][_0x41d1('0x2a')];}return _0x2649b3||_0x3d1735||_0x5da573;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4cec36){var _0x124878=null;var _0xbdcfc=_0x4cec36['dialTimezone'];if(_[_0x41d1('0x2b')](_0x4cec36[_0x41d1('0x2c')])||_[_0x41d1('0x2b')](_0x4cec36[_0x41d1('0x2d')])||_[_0x41d1('0x2b')](_0x4cec36[_0x41d1('0x2d')][_0x41d1('0x2e')])){_0x124878=CAMPAIGN_STATUS[_0x41d1('0x2f')];}else if(_[_0x41d1('0x30')](_0x4cec36[_0x41d1('0x2c')])||_[_0x41d1('0x30')](_0x4cec36['Interval'][_0x41d1('0x2e')])){_0x124878=CAMPAIGN_STATUS[_0x41d1('0x31')];}else if(_0xbdcfc&&!timezones[_0xbdcfc]){_0x124878=CAMPAIGN_STATUS[_0x41d1('0x32')];}return _0x124878;}function checkAnyValidTrunk(_0x300b2d,_0x57e9f4){var _0xafa893=null;var _0x5f109f=_0x41d1('0x33');var _0x40f447=['reachable',_0x41d1('0x34')];var _0x5ab0f3=!![];if(_0x300b2d['Trunk']&&_0x300b2d[_0x41d1('0x28')][_0x41d1('0x2a')]){_0x5f109f+=_0x300b2d[_0x41d1('0x28')]['name'];_0xafa893=_0x57e9f4[_0x5f109f];_0x5ab0f3=_0x40f447[_0x41d1('0x35')](_0xafa893[_0x41d1('0x36')]);}else if(_0x300b2d[_0x41d1('0x37')]&&_0x300b2d[_0x41d1('0x37')][_0x41d1('0x2a')]){_0x5f109f+=_0x300b2d['TrunkBackup'][_0x41d1('0x29')];_0xafa893=_0x57e9f4[_0x5f109f];_0x5ab0f3=_0x40f447['includes'](_0xafa893[_0x41d1('0x36')]);}return _0x5ab0f3;}function getQueueCampaignStatusMessage(_0x12e0fc,_0x2a0dbf){var _0x14ad0e=CAMPAIGN_STATUS[_0x41d1('0x38')];var _0xd0349e=isPreviewCampaign(_0x12e0fc);if(!isQueueCampaignActive(_0x12e0fc)){if(_0xd0349e){_0x14ad0e=CAMPAIGN_STATUS[_0x41d1('0x39')];}else{if(_0x12e0fc[_0x41d1('0x27')]===0x0&&_0x12e0fc[_0x41d1('0x23')]===0x0&&_0x12e0fc['waiting']===0x0&&(_0x12e0fc[_0x41d1('0x24')]||0x0)===0x0){_0x14ad0e=CAMPAIGN_STATUS[_0x41d1('0x39')];}else{_0x14ad0e=CAMPAIGN_STATUS[_0x41d1('0x3a')];}}}else if(_0x12e0fc[_0x41d1('0x20')]===0x0){_0x14ad0e=CAMPAIGN_STATUS[_0x41d1('0x3b')];}else if(!checkAnyValidTrunk(_0x12e0fc,_0x2a0dbf)){_0x14ad0e=CAMPAIGN_STATUS[_0x41d1('0x3c')];}else if(!isPreviewCampaign(_0x12e0fc)){var _0x14f9cf=checkAnyValidQueueCampaignInterval(_0x12e0fc);if(_0x14f9cf){_0x14ad0e=_0x14f9cf;}}return _0x14ad0e;}exports[_0x41d1('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x263053){var _0x394f65=CAMPAIGN_STATUS[_0x41d1('0x3a')];if(_0x263053[_0x41d1('0x27')]===0x0&&_0x263053[_0x41d1('0x23')]===0x0&&_0x263053[_0x41d1('0x25')]===0x0&&(_0x263053[_0x41d1('0x24')]||0x0)===0x0){_0x394f65=CAMPAIGN_STATUS[_0x41d1('0x39')];}return _0x394f65;}exports[_0x41d1('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4893f0){var _0x51263d=_0x4893f0[_0x41d1('0x3f')](/"(.*?)"/);return _0x51263d?_0x51263d[0x1]:_0x4893f0;}exports[_0x41d1('0x40')]=extractCalleridName;function getCallerId(_0x4d4d26,_0x207c89,_0x221a12){if(!_[_0x41d1('0x41')](_0x221a12)&&typeof _0x221a12===_0x41d1('0x42')&&!_[_0x41d1('0x30')](_0x221a12)){if(!_[_0x41d1('0x41')](_0x207c89)&&typeof _0x207c89===_0x41d1('0x42')&&!_[_0x41d1('0x30')](_0x207c89)){return util[_0x41d1('0x43')](_0x41d1('0x44'),_0x207c89,_0x221a12);}return util[_0x41d1('0x43')](_0x41d1('0x44'),_0x221a12,_0x221a12);}if(!_['isUndefined'](_0x4d4d26)&&typeof _0x4d4d26===_0x41d1('0x42')&&!_['isEmpty'](_0x4d4d26)){return _0x4d4d26;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x122b25,_0x557dd0){var _0x30d838;var _0xed0f79;var _0x3bc79b;if(_0x557dd0<=0x0){_0x557dd0=0x1;}_0x30d838=new RegExp('\x5cw{0,'+_0x557dd0+'}$');_0xed0f79=Math[_0x41d1('0x45')](0xa,_0x557dd0-0x1);_0x3bc79b=Math[_0x41d1('0x45')](0xa,_0x557dd0)-0x1;return util[_0x41d1('0x43')]('%s',_['replace'](_0x122b25,_0x30d838,_[_0x41d1('0x46')](_0xed0f79,_0x3bc79b)[_0x41d1('0x47')]()));}exports[_0x41d1('0x48')]=getCallerIdRandom;function decrementOriginate(_0x187418){if(_0x187418[_0x41d1('0x27')]&&_0x187418[_0x41d1('0x27')]>0x0){_0x187418['originated']-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x41d1('0x49')]=decrementOriginate;function checkContactEmpty(_0x30d8fe){return _0x30d8fe&&_0x30d8fe[_0x41d1('0x4a')]>0x0;}exports[_0x41d1('0x4b')]=checkContactEmpty;function erlangb(_0x387376,_0x1c2fd2){if(_0x1c2fd2===0x0){return 0x0;}var _0x266518=0x1;for(var _0x50a3b4=0x1;_0x50a3b4<=_0x1c2fd2;_0x50a3b4+=0x1){_0x266518=0x1+_0x266518*_0x50a3b4/_0x387376;}return 0x1/_0x266518;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x3c2957,_0x2bfcee,_0x4a1f21){if(_0x2bfcee>_0x4a1f21){for(var _0x587db3=0x0;_0x587db3<_0x2bfcee-_0x4a1f21;_0x587db3+=0x1){decrementOriginate(_0x3c2957);}}}exports[_0x41d1('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4f424f){var _0x265b37={};var _0x4ffbd4=['id',_0x41d1('0x4d'),_0x41d1('0x4e'),_0x41d1('0x4f')];const _0xe5f63a=0xfa;if(_0x4f424f){for(var _0x473770 in _0x4f424f){if(typeof _0x4f424f[_0x473770]!==_0x41d1('0x50')){if(!_[_0x41d1('0x2b')](_0x4f424f[_0x473770])&&!_0x4ffbd4[_0x41d1('0x35')](_0x473770)){if(_0x473770===_0x41d1('0x51')&&_0x4f424f[_0x473770][_0x41d1('0x4a')]>_0xe5f63a){_0x265b37[_0x41d1('0x52')+_0x473770[_0x41d1('0x53')]()]=_0x4f424f[_0x473770][_0x41d1('0x47')]()['substring'](0x0,_0xe5f63a);}else{_0x265b37['XMD-'+_0x473770[_0x41d1('0x53')]()]=_0x4f424f[_0x473770];}}}}}return _0x265b37;}exports[_0x41d1('0x54')]=setXMDContactVariables; \ No newline at end of file +var _0x4d07=['isIVRCampaignActive','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','inUse','originated','Trunk','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','NULL_INTERVAL','isEmpty','dialGlobalInterval','Intervals','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','name','includes','status','TrunkBackup','ACTIVE','talking','UNREACHABLE_TRUNK','DISACTIVED','INACTIVE','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','\x22%s\x22\x20<%s>','format','getCallerId','\x5cw{0,','pow','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','undefined','description','XMD-','substring','toUpperCase','moment','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','dialMethod','preview','isPreviewCampaign','isIVRCampaign','type','outbound','isOutboundQueue','active'];(function(_0x49bf54,_0x213863){var _0x5c50d4=function(_0x2f746a){while(--_0x2f746a){_0x49bf54['push'](_0x49bf54['shift']());}};_0x5c50d4(++_0x213863);}(_0x4d07,0x135));var _0x74d0=function(_0x2eade5,_0x5593b8){_0x2eade5=_0x2eade5-0x0;var _0x1e9966=_0x4d07[_0x2eade5];return _0x1e9966;};'use strict';var _=require('lodash');var moment=require(_0x74d0('0x0'));var util=require('util');var logger=require('../../../../config/logger')(_0x74d0('0x1'));var timezones=require(_0x74d0('0x2'))[_0x74d0('0x3')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x74d0('0x4'),'CONTACTS_RESCHEDULED':_0x74d0('0x5'),'DEACTIVATED':_0x74d0('0x6'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x74d0('0x7'),'NO_AGENTS_LOGGED':_0x74d0('0x8'),'NO_AVAILABLE_CONTACTS':_0x74d0('0x9'),'NULL_INTERVAL':_0x74d0('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x74d0('0xb'),'QUEUE_RECALL':_0x74d0('0xc'),'RECALL_TIMEOUT':_0x74d0('0xd'),'RUNNING':_0x74d0('0xe'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x399ed5){return _0x399ed5[_0x74d0('0xf')]===_0x74d0('0x10');}exports[_0x74d0('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x5263d0){return _0x5263d0['type']==='ivr';}exports[_0x74d0('0x12')]=isIVRCampaign;function isOutboundQueue(_0x3186b7){return _0x3186b7[_0x74d0('0x13')]===_0x74d0('0x14');}exports[_0x74d0('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x2c8b25){return _0x2c8b25['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x59772d){return _0x59772d[_0x74d0('0x16')];}exports[_0x74d0('0x17')]=isIVRCampaignActive;function getSeconds(_0x3b9a14,_0x5ee1f1){var _0x485dc=moment(_0x3b9a14)['milliseconds'](0x0);var _0x1b93e8=moment(_0x5ee1f1)['milliseconds'](0x0);return _0x485dc[_0x74d0('0x18')](_0x1b93e8,_0x74d0('0x19'));}exports[_0x74d0('0x1a')]=getSeconds;function hasQueueCampaignDataChanged(_0x160c93,_0x405f28){var _0x3fa3a2=![];var _0x17450d=_0x160c93[_0x74d0('0xf')]!==_0x405f28[_0x74d0('0xf')]||_0x160c93[_0x74d0('0x1b')]!==_0x405f28[_0x74d0('0x1b')]||_0x160c93[_0x74d0('0x1c')]!==_0x405f28[_0x74d0('0x1c')];var _0x473750=_0x160c93[_0x74d0('0x1d')]!==_0x405f28[_0x74d0('0x1d')]||_0x160c93[_0x74d0('0x1e')]!==_0x405f28[_0x74d0('0x1e')]||_0x160c93[_0x74d0('0x1f')]!==_0x405f28[_0x74d0('0x1f')]||_0x160c93[_0x74d0('0x20')]!==_0x405f28[_0x74d0('0x20')]||_0x160c93['talking']!==_0x405f28['talking']||_0x160c93[_0x74d0('0x21')]!==_0x405f28[_0x74d0('0x21')]||_0x160c93[_0x74d0('0x22')]!==_0x405f28['waiting']||_0x160c93[_0x74d0('0x23')]!==_0x405f28[_0x74d0('0x23')]||_0x160c93[_0x74d0('0x24')]!==_0x405f28[_0x74d0('0x24')];if(_0x160c93[_0x74d0('0x25')]&&_0x405f28['Trunk']){_0x3fa3a2=_0x160c93[_0x74d0('0x25')]['name']!==_0x405f28[_0x74d0('0x25')]['name']||_0x160c93['Trunk']['active']!==_0x405f28['Trunk'][_0x74d0('0x16')];}return _0x17450d||_0x473750||_0x3fa3a2;}exports[_0x74d0('0x26')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x381b7a){var _0x51f867=null;var _0x222e5f=_0x381b7a[_0x74d0('0x27')];if(_['isNil'](_0x381b7a['dialGlobalInterval'])||_[_0x74d0('0x28')](_0x381b7a[_0x74d0('0x29')])||_['isNil'](_0x381b7a[_0x74d0('0x29')]['Intervals'])){_0x51f867=CAMPAIGN_STATUS[_0x74d0('0x2a')];}else if(_[_0x74d0('0x2b')](_0x381b7a[_0x74d0('0x2c')])||_[_0x74d0('0x2b')](_0x381b7a[_0x74d0('0x29')][_0x74d0('0x2d')])){_0x51f867=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x222e5f&&!timezones[_0x222e5f]){_0x51f867=CAMPAIGN_STATUS[_0x74d0('0x2e')];}return _0x51f867;}function checkAnyValidTrunk(_0x458f38,_0x208749){var _0x10c350=null;var _0x267597=_0x74d0('0x2f');var _0x1f7ea5=[_0x74d0('0x30'),_0x74d0('0x31')];var _0x251083=!![];if(_0x458f38['Trunk']&&_0x458f38['Trunk'][_0x74d0('0x16')]){_0x267597+=_0x458f38['Trunk'][_0x74d0('0x32')];_0x10c350=_0x208749[_0x267597];_0x251083=_0x1f7ea5[_0x74d0('0x33')](_0x10c350[_0x74d0('0x34')]);}else if(_0x458f38[_0x74d0('0x35')]&&_0x458f38[_0x74d0('0x35')][_0x74d0('0x16')]){_0x267597+=_0x458f38[_0x74d0('0x35')]['name'];_0x10c350=_0x208749[_0x267597];_0x251083=_0x1f7ea5[_0x74d0('0x33')](_0x10c350['status']);}return _0x251083;}function getQueueCampaignStatusMessage(_0x5e1109,_0x385e4d){var _0x2b36a3=CAMPAIGN_STATUS[_0x74d0('0x36')];var _0x3e1cc4=isPreviewCampaign(_0x5e1109);if(!isQueueCampaignActive(_0x5e1109)){if(_0x3e1cc4){_0x2b36a3=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x5e1109[_0x74d0('0x24')]===0x0&&_0x5e1109[_0x74d0('0x37')]===0x0&&_0x5e1109[_0x74d0('0x22')]===0x0&&(_0x5e1109['pTalking']||0x0)===0x0){_0x2b36a3=CAMPAIGN_STATUS['INACTIVE'];}else{_0x2b36a3=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x5e1109[_0x74d0('0x1e')]===0x0){_0x2b36a3=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x5e1109,_0x385e4d)){_0x2b36a3=CAMPAIGN_STATUS[_0x74d0('0x38')];}else if(!isPreviewCampaign(_0x5e1109)){var _0x4603cc=checkAnyValidQueueCampaignInterval(_0x5e1109);if(_0x4603cc){_0x2b36a3=_0x4603cc;}}return _0x2b36a3;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x591eb9){var _0x37c9b2=CAMPAIGN_STATUS[_0x74d0('0x39')];if(_0x591eb9['originated']===0x0&&_0x591eb9[_0x74d0('0x37')]===0x0&&_0x591eb9[_0x74d0('0x22')]===0x0&&(_0x591eb9[_0x74d0('0x21')]||0x0)===0x0){_0x37c9b2=CAMPAIGN_STATUS[_0x74d0('0x3a')];}return _0x37c9b2;}exports[_0x74d0('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5f430f){var _0xe3a0d5=_0x5f430f[_0x74d0('0x3c')](/"(.*?)"/);return _0xe3a0d5?_0xe3a0d5[0x1]:_0x5f430f;}exports[_0x74d0('0x3d')]=extractCalleridName;function getCallerId(_0x8ac258,_0x4a2a2a,_0x49eae3){if(!_['isUndefined'](_0x49eae3)&&typeof _0x49eae3==='string'&&!_[_0x74d0('0x2b')](_0x49eae3)){if(!_[_0x74d0('0x3e')](_0x4a2a2a)&&typeof _0x4a2a2a==='string'&&!_[_0x74d0('0x2b')](_0x4a2a2a)){return util['format'](_0x74d0('0x3f'),_0x4a2a2a,_0x49eae3);}return util[_0x74d0('0x40')](_0x74d0('0x3f'),_0x49eae3,_0x49eae3);}if(!_[_0x74d0('0x3e')](_0x8ac258)&&typeof _0x8ac258==='string'&&!_[_0x74d0('0x2b')](_0x8ac258)){return _0x8ac258;}return'\x22\x22\x20<>';}exports[_0x74d0('0x41')]=getCallerId;function getCallerIdRandom(_0x6da823,_0x3ada6f){var _0xc676b5;var _0x7f3311;var _0x4565df;if(_0x3ada6f<=0x0){_0x3ada6f=0x1;}_0xc676b5=new RegExp(_0x74d0('0x42')+_0x3ada6f+'}$');_0x7f3311=Math[_0x74d0('0x43')](0xa,_0x3ada6f-0x1);_0x4565df=Math[_0x74d0('0x43')](0xa,_0x3ada6f)-0x1;return util[_0x74d0('0x40')]('%s',_['replace'](_0x6da823,_0xc676b5,_['random'](_0x7f3311,_0x4565df)[_0x74d0('0x44')]()));}exports[_0x74d0('0x45')]=getCallerIdRandom;function decrementOriginate(_0x1176ec){if(_0x1176ec[_0x74d0('0x24')]&&_0x1176ec[_0x74d0('0x24')]>0x0){_0x1176ec[_0x74d0('0x24')]-=0x1;}else{logger['error'](_0x74d0('0x46'));}}exports[_0x74d0('0x47')]=decrementOriginate;function checkContactEmpty(_0x261725){return _0x261725&&_0x261725[_0x74d0('0x48')]>0x0;}exports[_0x74d0('0x49')]=checkContactEmpty;function erlangb(_0x5da183,_0x16f34e){if(_0x16f34e===0x0){return 0x0;}var _0x9e91bf=0x1;for(var _0x4ed5b1=0x1;_0x4ed5b1<=_0x16f34e;_0x4ed5b1+=0x1){_0x9e91bf=0x1+_0x9e91bf*_0x4ed5b1/_0x5da183;}return 0x1/_0x9e91bf;}exports[_0x74d0('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0xf0ece2,_0x1969a4,_0x1b561a){if(_0x1969a4>_0x1b561a){for(var _0xc6d7d6=0x0;_0xc6d7d6<_0x1969a4-_0x1b561a;_0xc6d7d6+=0x1){decrementOriginate(_0xf0ece2);}}}exports[_0x74d0('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4d9a44){var _0x57ec77={};var _0x3f6aa5=['id',_0x74d0('0x4c'),_0x74d0('0x4d'),'updatedAt'];const _0x3fb4d7=0xfa;if(_0x4d9a44){for(var _0x294265 in _0x4d9a44){if(typeof _0x4d9a44[_0x294265]!==_0x74d0('0x4e')){if(!_[_0x74d0('0x28')](_0x4d9a44[_0x294265])&&!_0x3f6aa5[_0x74d0('0x33')](_0x294265)){if(_0x294265===_0x74d0('0x4f')&&_0x4d9a44[_0x294265][_0x74d0('0x48')]>_0x3fb4d7){_0x57ec77[_0x74d0('0x50')+_0x294265['toUpperCase']()]=_0x4d9a44[_0x294265][_0x74d0('0x44')]()[_0x74d0('0x51')](0x0,_0x3fb4d7);}else{_0x57ec77[_0x74d0('0x50')+_0x294265[_0x74d0('0x52')]()]=_0x4d9a44[_0x294265];}}}}}return _0x57ec77;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1bc15f4..cbe0f33 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(_0x5c4098,_0x32444f){var _0x2acaea=function(_0x3242ab){while(--_0x3242ab){_0x5c4098['push'](_0x5c4098['shift']());}};_0x2acaea(++_0x32444f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x4ea23a,_0x22d249){var _0x7d88a5=function(_0x572fdf){while(--_0x572fdf){_0x4ea23a['push'](_0x4ea23a['shift']());}};_0x7d88a5(++_0x22d249);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 635d59d..8fe01fc 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 _0xb5fb=['variablesAction','addVariables','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','fax','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','moment','path','../../../config/logger','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','newchannel','syncNewchannel','bind','varset','syncNewState','newexten','syncNewExten','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','syncVarSet','variable','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','localstationid','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action'];(function(_0x5dfee3,_0x5e3bbe){var _0x1e1785=function(_0x42b547){while(--_0x42b547){_0x5dfee3['push'](_0x5dfee3['shift']());}};_0x1e1785(++_0x5e3bbe);}(_0xb5fb,0x1de));var _0xbb5f=function(_0xb0acd8,_0x4cac86){_0xb0acd8=_0xb0acd8-0x0;var _0x491d41=_0xb5fb[_0xb0acd8];return _0x491d41;};'use strict';var util=require('util');var _=require(_0xbb5f('0x0'));var BPromise=require(_0xbb5f('0x1'));var uuid=require(_0xbb5f('0x2'));var moment=require(_0xbb5f('0x3'));var path=require(_0xbb5f('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0xbb5f('0x5'))('fax');var ami=require('../ami');var rpcDb=require(_0xbb5f('0x6'));var Channel=require(_0xbb5f('0x7'));var ut=require('./util/util');var Action=require(_0xbb5f('0x8'));var faxAccount=require(_0xbb5f('0x9'));var attachment=require(_0xbb5f('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x56cc04){this[_0xbb5f('0xb')]={};this['faxAccounts']=_0x56cc04[_0xbb5f('0xc')];this['trunks']=_0x56cc04['trunks'];this['actions']={};ami['on'](_0xbb5f('0xd'),this[_0xbb5f('0xe')][_0xbb5f('0xf')](this));ami['on'](_0xbb5f('0x10'),this['syncVarSet'][_0xbb5f('0xf')](this));ami['on']('newstate',this[_0xbb5f('0x11')][_0xbb5f('0xf')](this));ami['on'](_0xbb5f('0x12'),this[_0xbb5f('0x13')]['bind'](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xbb5f('0xf')](this));ami['on'](_0xbb5f('0x14'),this['syncReceiveFax'][_0xbb5f('0xf')](this));ami['on']('hangup',this[_0xbb5f('0x15')][_0xbb5f('0xf')](this));ami['on'](_0xbb5f('0x16'),this[_0xbb5f('0x17')]['bind'](this));}Fax[_0xbb5f('0x18')][_0xbb5f('0xe')]=function(_0x369735){if(_0x369735[_0xbb5f('0x19')]===_0xbb5f('0x1a')){for(var _0x1fdd51 in this['faxAccounts']){if(this[_0xbb5f('0xc')][_0xbb5f('0x1b')](_0x1fdd51)){if(_0x369735['exten']===this['faxAccounts'][_0x1fdd51]['localstationid']){this[_0xbb5f('0xb')][_0x369735['uniqueid']]={};this[_0xbb5f('0xb')][_0x369735[_0xbb5f('0x1c')]][_0xbb5f('0x1d')]=_0x369735[_0xbb5f('0x1d')];this[_0xbb5f('0xb')][_0x369735['uniqueid']]['id']=this[_0xbb5f('0xc')][_0x1fdd51]['id'];this[_0xbb5f('0xb')][_0x369735[_0xbb5f('0x1c')]][_0xbb5f('0x1e')]=this[_0xbb5f('0xc')][_0x1fdd51]['name'];logger[_0xbb5f('0x1f')](_0x369735[_0xbb5f('0x1c')],_0xbb5f('0x20'));}}}}if(this[_0xbb5f('0x21')][_0x369735[_0xbb5f('0x1c')]]){this[_0xbb5f('0xb')][_0x369735[_0xbb5f('0x1c')]]={};this[_0xbb5f('0xb')][_0x369735[_0xbb5f('0x1c')]][_0xbb5f('0x1d')]=_0x369735[_0xbb5f('0x1d')];logger[_0xbb5f('0x1f')](_0x369735[_0xbb5f('0x1c')],'\x20syncNewchannel\x20');}};Fax[_0xbb5f('0x18')][_0xbb5f('0x22')]=function(_0x375c43){if(this['channels'][_0x375c43[_0xbb5f('0x1c')]]){for(var _0xbb956b in _0x375c43['variable']){if(_0x375c43[_0xbb5f('0x23')]['hasOwnProperty'](_0xbb956b)){this[_0xbb5f('0xb')][_0x375c43['uniqueid']][_0xbb956b]=_0x375c43['value'];}}}};Fax[_0xbb5f('0x18')][_0xbb5f('0x11')]=function(_0x5404df){if(this[_0xbb5f('0xb')][_0x5404df[_0xbb5f('0x1c')]]){this[_0xbb5f('0xb')][_0x5404df[_0xbb5f('0x1c')]]['channelstate']=_0x5404df[_0xbb5f('0x24')];this[_0xbb5f('0xb')][_0x5404df[_0xbb5f('0x1c')]][_0xbb5f('0x25')]=_0x5404df['channelstatedesc'];}};Fax[_0xbb5f('0x18')][_0xbb5f('0x13')]=function(_0x4228dd){if(this[_0xbb5f('0xb')][_0x4228dd[_0xbb5f('0x1c')]]){for(var _0x1abc2c in _0x4228dd[_0xbb5f('0x23')]){if(_0x4228dd[_0xbb5f('0x23')][_0xbb5f('0x1b')](_0x1abc2c)){this[_0xbb5f('0xb')][_0x4228dd['uniqueid']][_0x1abc2c]=_0x4228dd['value'];}}}};Fax[_0xbb5f('0x18')][_0xbb5f('0x26')]=function(_0x2ee81f){if(this['channels'][_0x2ee81f[_0xbb5f('0x1c')]]){this[_0xbb5f('0xb')][_0x2ee81f[_0xbb5f('0x1c')]][_0xbb5f('0x27')]=_0x2ee81f[_0xbb5f('0x27')];this[_0xbb5f('0xb')][_0x2ee81f[_0xbb5f('0x1c')]][_0xbb5f('0x28')]=_0x2ee81f[_0xbb5f('0x28')];this[_0xbb5f('0xb')][_0x2ee81f['uniqueid']]['localstationid']=_0x2ee81f['localstationid'];this[_0xbb5f('0xb')][_0x2ee81f[_0xbb5f('0x1c')]][_0xbb5f('0x29')]=_0x2ee81f[_0xbb5f('0x29')];logger[_0xbb5f('0x1f')](_0x2ee81f[_0xbb5f('0x1c')],'\x20syncFaxStatus\x20');}};Fax[_0xbb5f('0x18')]['syncReceiveFax']=function(_0x500791){var _0x2342ce=this;if(this[_0xbb5f('0xb')][_0x500791['uniqueid']]){var _0x340a5c=this[_0xbb5f('0xb')][_0x500791[_0xbb5f('0x1c')]]['id'];this['channels'][_0x500791['uniqueid']][_0xbb5f('0x2a')]=_0x500791[_0xbb5f('0x2a')];this[_0xbb5f('0xb')][_0x500791[_0xbb5f('0x1c')]][_0xbb5f('0x2b')]=_0x500791['pagestransferred'];this['channels'][_0x500791[_0xbb5f('0x1c')]][_0xbb5f('0x2c')]=_0x500791[_0xbb5f('0x2c')];this[_0xbb5f('0xb')][_0x500791[_0xbb5f('0x1c')]][_0xbb5f('0x2d')]=_0x500791[_0xbb5f('0x2d')];this[_0xbb5f('0xb')][_0x500791[_0xbb5f('0x1c')]]['transferrate']=_0x500791['transferrate'];this[_0xbb5f('0xb')][_0x500791[_0xbb5f('0x1c')]][_0xbb5f('0x29')]=_0x500791[_0xbb5f('0x29')];this[_0xbb5f('0xb')][_0x500791['uniqueid']][_0xbb5f('0x2e')]=_0x500791[_0xbb5f('0x2e')];if(this['channels'][_0x500791[_0xbb5f('0x1c')]][_0xbb5f('0x2b')]>0x0){tiff2pdf(_0x500791[_0xbb5f('0x29')],_0xbb5f('0x2f'),function(_0x8d3049){logger[_0xbb5f('0x1f')](_0x500791[_0xbb5f('0x1c')],_0xbb5f('0x30'),_0x8d3049[_0xbb5f('0x31')]);attachment['create']({'name':path['parse'](_0x500791[_0xbb5f('0x29')])['name'],'basename':path[_0xbb5f('0x32')](_0x500791[_0xbb5f('0x29')])[_0xbb5f('0x1e')]+_0xbb5f('0x33'),'type':_0xbb5f('0x34')})[_0xbb5f('0x35')](function(_0x396d23){faxAccount[_0xbb5f('0x36')](_0x340a5c,{'from':_0x500791['calleridnum'],'mapKey':'fax','body':path[_0xbb5f('0x32')](_0x500791['filename'])[_0xbb5f('0x1e')]+_0xbb5f('0x33'),'AttachmentId':_0x396d23['id']})[_0xbb5f('0x37')](function(_0x44a53c){logger[_0xbb5f('0x38')](_0x500791['uniqueid'],_0xbb5f('0x39'),JSON[_0xbb5f('0x3a')](_0x44a53c));});})[_0xbb5f('0x37')](function(_0x21bcd4){logger[_0xbb5f('0x38')](_0x500791['uniqueid'],_0xbb5f('0x3b'),JSON[_0xbb5f('0x3a')](_0x21bcd4));});});}logger[_0xbb5f('0x1f')](_0x500791['uniqueid'],_0xbb5f('0x3b'));}};Fax[_0xbb5f('0x18')][_0xbb5f('0x17')]=function(_0x21b7b3){if(this[_0xbb5f('0x21')][_0x21b7b3[_0xbb5f('0x1c')]]){_['merge'](this['channels'][_0x21b7b3[_0xbb5f('0x1c')]],_[_0xbb5f('0x3c')](_0x21b7b3,[_0xbb5f('0x3d'),'reason']));}};function updateStatus(_0x4dcce7){if(_0x4dcce7[_0xbb5f('0x3e')]){faxMessage[_0xbb5f('0x3f')](_0x4dcce7['AttachmentId'],{'failMessage':_0xbb5f('0x40')})[_0xbb5f('0x35')](function(_0x1fea5b){ut[_0xbb5f('0x41')](_0xbb5f('0x42'),_0x1fea5b);})[_0xbb5f('0x37')](function(_0x44cded){ut[_0xbb5f('0x41')](_0xbb5f('0x43'),_0x44cded);});}else{ut[_0xbb5f('0x41')](_0xbb5f('0x44'));}}Fax[_0xbb5f('0x18')]['updateStatus']=function(_0x53f7fa,_0x2801a4,_0x56b7bd){var _0x516e40=this;var _0x2b2989={};if(_0x2801a4){_0x2b2989={'read':_0x2801a4};}else{_0x2b2989={'failMessage':_0x56b7bd};}if(this[_0xbb5f('0x21')][_0x53f7fa][_0xbb5f('0x3e')]){faxMessage[_0xbb5f('0x3f')](this[_0xbb5f('0x21')][_0x53f7fa]['AttachmentId'],_0x2b2989)['then'](function(_0x1fb5d9){ut[_0xbb5f('0x41')]('[Fax][Message][Updated]',_0x1fb5d9);})[_0xbb5f('0x37')](function(_0x51543e){ut[_0xbb5f('0x41')](_0xbb5f('0x45'),_0x51543e);})[_0xbb5f('0x46')](function(){delete _0x516e40['channels'][_0x53f7fa];delete _0x516e40[_0xbb5f('0x21')][_0x53f7fa];});}else{ut[_0xbb5f('0x41')](_0xbb5f('0x47'));delete this['channels'][_0x53f7fa];delete this[_0xbb5f('0x21')][_0x53f7fa];}};Fax[_0xbb5f('0x18')][_0xbb5f('0x15')]=function(_0xc487d9){var _0x212dbb=this;if(this['channels'][_0xc487d9['uniqueid']]){if(this[_0xbb5f('0x21')][_0xc487d9[_0xbb5f('0x1c')]]){this[_0xbb5f('0xb')][_0xc487d9[_0xbb5f('0x1c')]]['id']=this[_0xbb5f('0x21')][_0xc487d9['uniqueid']]['id'];this[_0xbb5f('0xb')][_0xc487d9[_0xbb5f('0x1c')]]['name']=this['actions'][_0xc487d9['uniqueid']]['name'];}logger[_0xbb5f('0x1f')](_0xc487d9[_0xbb5f('0x1c')],this['actions'][_0xc487d9[_0xbb5f('0x1c')]]?_0xbb5f('0x48'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0xbb5f('0xb')][_0xc487d9[_0xbb5f('0x1c')]]));if(this['actions'][_0xc487d9[_0xbb5f('0x1c')]]){if(this[_0xbb5f('0xb')][_0xc487d9['uniqueid']][_0xbb5f('0x49')]>0x0&&this[_0xbb5f('0xb')][_0xc487d9[_0xbb5f('0x1c')]][_0xbb5f('0x4a')]===_0xbb5f('0x4b')){this['updateStatus'](_0xc487d9[_0xbb5f('0x1c')],!![]);}else{this[_0xbb5f('0x4c')](_0xc487d9[_0xbb5f('0x1c')],![],this[_0xbb5f('0xb')][_0xc487d9[_0xbb5f('0x1c')]][_0xbb5f('0x4d')]?'SENDING\x20FAILED:\x20'+this[_0xbb5f('0xb')][_0xc487d9[_0xbb5f('0x1c')]][_0xbb5f('0x4d')]:_0xbb5f('0x4e'));}}}};Fax[_0xbb5f('0x18')][_0xbb5f('0x4f')]=function(_0xf56944){var _0x54da01=this;return new BPromise(function(_0x4cd62a,_0x7291fe){_0x54da01[_0xbb5f('0x50')](_0xf56944,_0x54da01[_0xbb5f('0xc')][_0xf56944[_0xbb5f('0x51')]])[_0xbb5f('0x35')](function(_0x29b698){ut['logger'](_0xbb5f('0x52'),_0x29b698);_0x4cd62a(ut[_0xbb5f('0x31')](_0xbb5f('0x53')));})[_0xbb5f('0x37')](function(_0x4c82f){ut[_0xbb5f('0x41')]('[Fax][execOriginate][failure]',_0x4c82f);updateStatus(_0xf56944);_0x7291fe(ut[_0xbb5f('0x31')](_0xbb5f('0x54')));});});};Fax[_0xbb5f('0x18')][_0xbb5f('0x55')]=function(_0x96fffe){var _0x232568=this;return new BPromise(function(_0x37a9d9,_0x2505b6){var _0x45165e=_0x232568['checkTrunk'](_0x232568[_0xbb5f('0xc')][_0x96fffe[_0xbb5f('0x51')]][_0xbb5f('0x56')],_0x96fffe);if(_0x45165e[_0xbb5f('0x57')]){_0x37a9d9(ut['message'](_0xbb5f('0x58')));}else{_0x2505b6(ut[_0xbb5f('0x31')](_0x45165e[_0xbb5f('0x31')]));}});};function originate(_0x7d74bd,_0x3c0241,_0x1f4790){return new BPromise(function(_0x5bf1ee,_0x30f1b9){if(_0x1f4790){var _0x324f65=util[_0xbb5f('0x59')](_0xbb5f('0x5a'),path[_0xbb5f('0x32')](_0x7d74bd[_0xbb5f('0x4')])['name'],_0x7d74bd['path']);gs[_0xbb5f('0x5b')](_0x324f65)['then'](function(){_0x7d74bd[_0xbb5f('0x4')]=util['format'](_0xbb5f('0x5c'),path['parse'](_0x7d74bd['path'])[_0xbb5f('0x5d')],path[_0xbb5f('0x32')](_0x7d74bd[_0xbb5f('0x4')])[_0xbb5f('0x1e')]);_0x3c0241[_0xbb5f('0x5e')]=_0x7d74bd[_0xbb5f('0x4')];ut['logger'](_0xbb5f('0x5f'),'');ami['Action'](ut['variablesAction'](_0x7d74bd,_0x3c0241))[_0xbb5f('0x35')](function(_0x20b9b0){_0x5bf1ee(_0x20b9b0);})[_0xbb5f('0x37')](function(_0x45fd9d){_0x30f1b9(_0x45fd9d);});})[_0xbb5f('0x37')](function(_0xb8adbf){_0x30f1b9(_0xb8adbf);});}else{ami[_0xbb5f('0x60')](ut[_0xbb5f('0x61')](_0x7d74bd,_0x3c0241))[_0xbb5f('0x35')](function(_0x1f54b5){_0x5bf1ee(_0x1f54b5);})[_0xbb5f('0x37')](function(_0x46dffb){_0x30f1b9(_0x46dffb);});}});}Fax[_0xbb5f('0x18')][_0xbb5f('0x50')]=function(_0x2c6025,_0x22f899){var _0x11abf2=this;return new BPromise(function(_0x2cad36,_0xad722e){var _0x188c95=uuid['v4']();var _0x23e62a=ut[_0xbb5f('0x62')](_0x2c6025,_0x22f899);_0x11abf2[_0xbb5f('0x21')][_0x188c95]=new Action(_0x188c95,_0x22f899,_0x2c6025);var _0x31af50=_0x11abf2[_0xbb5f('0x21')][_0x188c95];if(path[_0xbb5f('0x32')](_0x2c6025['path'])[_0xbb5f('0x63')]===_0xbb5f('0x33')){originate(_0x31af50,_0x23e62a,!![])[_0xbb5f('0x35')](function(_0x383783){_0x2cad36(_0x383783);})[_0xbb5f('0x37')](function(_0x11cb58){_0xad722e(_0x11cb58);});}else{originate(_0x31af50,_0x23e62a,![])[_0xbb5f('0x35')](function(_0x62b3f){_0x2cad36(_0x62b3f);})['catch'](function(_0x2a1af6){_0xad722e(_0x2a1af6);});}});};Fax[_0xbb5f('0x18')][_0xbb5f('0x64')]=function(_0x3dbd83){return!_[_0xbb5f('0x65')](_0x3dbd83)&&!_['isNil'](_0x3dbd83[_0xbb5f('0x1e')])&&!_['isNil'](_0x3dbd83[_0xbb5f('0x66')])&&_0x3dbd83[_0xbb5f('0x66')]&&!_[_0xbb5f('0x65')](this[_0xbb5f('0x67')][util[_0xbb5f('0x59')](_0xbb5f('0x68'),_0x3dbd83[_0xbb5f('0x1e')])])&&!_[_0xbb5f('0x65')](this[_0xbb5f('0x67')][util[_0xbb5f('0x59')](_0xbb5f('0x68'),_0x3dbd83[_0xbb5f('0x1e')])][_0xbb5f('0x28')])&&(this['trunks'][util['format'](_0xbb5f('0x68'),_0x3dbd83[_0xbb5f('0x1e')])][_0xbb5f('0x28')]===_0xbb5f('0x69')||this['trunks'][util[_0xbb5f('0x59')](_0xbb5f('0x68'),_0x3dbd83['name'])]['status']===_0xbb5f('0x6a'));};Fax['prototype'][_0xbb5f('0x6b')]=function(_0x43bd8b,_0x31036d){if(!this[_0xbb5f('0x64')](_0x43bd8b)){ut['logger'](_0xbb5f('0x6c'),_['isNil'](_0x43bd8b)?'':_0x43bd8b[_0xbb5f('0x1e')]+_0xbb5f('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xbb5f('0x65')](_0x31036d[_0xbb5f('0x6e')])){ut[_0xbb5f('0x41')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xbb5f('0x3a')](_0x31036d));return{'isValid':![],'message':_0xbb5f('0x6f')};}if(_['isNil'](_0x31036d[_0xbb5f('0x4')])){ut[_0xbb5f('0x41')](_0xbb5f('0x70'),JSON['stringify'](_0x31036d));return{'isValid':![],'message':_0xbb5f('0x71')};}return{'isValid':!![],'message':_0xbb5f('0x72')};};module['exports']=Fax; \ No newline at end of file +var _0x3f09=['syncNewchannel','bind','newstate','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','value','syncNewState','channelstate','channelstatedesc','variable','operation','status','filename','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','updateStatus','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','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','path','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','trunks','reachable','SIP/%s','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','newchannel'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0x3f09,0x146));var _0x93f0=function(_0x4e75ed,_0x22a3c6){_0x4e75ed=_0x4e75ed-0x0;var _0x39bfda=_0x3f09[_0x4e75ed];return _0x39bfda;};'use strict';var util=require(_0x93f0('0x0'));var _=require('lodash');var BPromise=require(_0x93f0('0x1'));var uuid=require(_0x93f0('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x93f0('0x3'));var logger=require('../../../config/logger')('fax');var ami=require(_0x93f0('0x4'));var rpcDb=require(_0x93f0('0x5'));var Channel=require(_0x93f0('0x6'));var ut=require(_0x93f0('0x7'));var Action=require(_0x93f0('0x8'));var faxAccount=require(_0x93f0('0x9'));var attachment=require(_0x93f0('0xa'));var faxMessage=require(_0x93f0('0xb'));function Fax(_0x5e315f){this[_0x93f0('0xc')]={};this['faxAccounts']=_0x5e315f[_0x93f0('0xd')];this['trunks']=_0x5e315f['trunks'];this[_0x93f0('0xe')]={};ami['on'](_0x93f0('0xf'),this[_0x93f0('0x10')][_0x93f0('0x11')](this));ami['on']('varset',this['syncVarSet'][_0x93f0('0x11')](this));ami['on'](_0x93f0('0x12'),this['syncNewState'][_0x93f0('0x11')](this));ami['on']('newexten',this[_0x93f0('0x13')][_0x93f0('0x11')](this));ami['on'](_0x93f0('0x14'),this[_0x93f0('0x15')][_0x93f0('0x11')](this));ami['on']('receivefax',this[_0x93f0('0x16')][_0x93f0('0x11')](this));ami['on'](_0x93f0('0x17'),this[_0x93f0('0x18')][_0x93f0('0x11')](this));ami['on'](_0x93f0('0x19'),this[_0x93f0('0x1a')][_0x93f0('0x11')](this));}Fax[_0x93f0('0x1b')][_0x93f0('0x10')]=function(_0x5bde5b){if(_0x5bde5b['context']===_0x93f0('0x1c')){for(var _0x1798ae in this[_0x93f0('0xd')]){if(this[_0x93f0('0xd')][_0x93f0('0x1d')](_0x1798ae)){if(_0x5bde5b[_0x93f0('0x1e')]===this[_0x93f0('0xd')][_0x1798ae][_0x93f0('0x1f')]){this[_0x93f0('0xc')][_0x5bde5b[_0x93f0('0x20')]]={};this['channels'][_0x5bde5b[_0x93f0('0x20')]][_0x93f0('0x21')]=_0x5bde5b[_0x93f0('0x21')];this[_0x93f0('0xc')][_0x5bde5b[_0x93f0('0x20')]]['id']=this[_0x93f0('0xd')][_0x1798ae]['id'];this['channels'][_0x5bde5b[_0x93f0('0x20')]]['name']=this[_0x93f0('0xd')][_0x1798ae][_0x93f0('0x22')];logger['info'](_0x5bde5b[_0x93f0('0x20')],_0x93f0('0x23'));}}}}if(this[_0x93f0('0xe')][_0x5bde5b[_0x93f0('0x20')]]){this[_0x93f0('0xc')][_0x5bde5b[_0x93f0('0x20')]]={};this[_0x93f0('0xc')][_0x5bde5b[_0x93f0('0x20')]]['channel']=_0x5bde5b[_0x93f0('0x21')];logger['info'](_0x5bde5b['uniqueid'],_0x93f0('0x23'));}};Fax[_0x93f0('0x1b')]['syncVarSet']=function(_0x46b09b){if(this[_0x93f0('0xc')][_0x46b09b[_0x93f0('0x20')]]){for(var _0x10fc69 in _0x46b09b['variable']){if(_0x46b09b['variable']['hasOwnProperty'](_0x10fc69)){this['channels'][_0x46b09b['uniqueid']][_0x10fc69]=_0x46b09b[_0x93f0('0x24')];}}}};Fax[_0x93f0('0x1b')][_0x93f0('0x25')]=function(_0x3b4a27){if(this[_0x93f0('0xc')][_0x3b4a27['uniqueid']]){this[_0x93f0('0xc')][_0x3b4a27[_0x93f0('0x20')]]['channelstate']=_0x3b4a27[_0x93f0('0x26')];this[_0x93f0('0xc')][_0x3b4a27[_0x93f0('0x20')]][_0x93f0('0x27')]=_0x3b4a27[_0x93f0('0x27')];}};Fax[_0x93f0('0x1b')]['syncNewExten']=function(_0x603ee2){if(this[_0x93f0('0xc')][_0x603ee2[_0x93f0('0x20')]]){for(var _0x394c21 in _0x603ee2[_0x93f0('0x28')]){if(_0x603ee2[_0x93f0('0x28')][_0x93f0('0x1d')](_0x394c21)){this['channels'][_0x603ee2[_0x93f0('0x20')]][_0x394c21]=_0x603ee2['value'];}}}};Fax[_0x93f0('0x1b')][_0x93f0('0x15')]=function(_0x55192c){if(this[_0x93f0('0xc')][_0x55192c[_0x93f0('0x20')]]){this[_0x93f0('0xc')][_0x55192c[_0x93f0('0x20')]]['operation']=_0x55192c[_0x93f0('0x29')];this[_0x93f0('0xc')][_0x55192c[_0x93f0('0x20')]][_0x93f0('0x2a')]=_0x55192c[_0x93f0('0x2a')];this[_0x93f0('0xc')][_0x55192c[_0x93f0('0x20')]]['localstationid']=_0x55192c['localstationid'];this[_0x93f0('0xc')][_0x55192c[_0x93f0('0x20')]][_0x93f0('0x2b')]=_0x55192c['filename'];logger[_0x93f0('0x2c')](_0x55192c[_0x93f0('0x20')],_0x93f0('0x2d'));}};Fax[_0x93f0('0x1b')][_0x93f0('0x16')]=function(_0x41bd7f){var _0x162e38=this;if(this[_0x93f0('0xc')][_0x41bd7f[_0x93f0('0x20')]]){var _0x51bae5=this[_0x93f0('0xc')][_0x41bd7f[_0x93f0('0x20')]]['id'];this[_0x93f0('0xc')][_0x41bd7f[_0x93f0('0x20')]][_0x93f0('0x2e')]=_0x41bd7f[_0x93f0('0x2e')];this['channels'][_0x41bd7f['uniqueid']][_0x93f0('0x2f')]=_0x41bd7f['pagestransferred'];this[_0x93f0('0xc')][_0x41bd7f[_0x93f0('0x20')]]['localstationid']=_0x41bd7f[_0x93f0('0x1f')];this[_0x93f0('0xc')][_0x41bd7f['uniqueid']][_0x93f0('0x30')]=_0x41bd7f[_0x93f0('0x30')];this[_0x93f0('0xc')][_0x41bd7f[_0x93f0('0x20')]][_0x93f0('0x31')]=_0x41bd7f[_0x93f0('0x31')];this[_0x93f0('0xc')][_0x41bd7f[_0x93f0('0x20')]]['filename']=_0x41bd7f['filename'];this[_0x93f0('0xc')][_0x41bd7f['uniqueid']]['calleridnum']=_0x41bd7f['calleridnum'];if(this[_0x93f0('0xc')][_0x41bd7f['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x41bd7f[_0x93f0('0x2b')],_0x93f0('0x32'),function(_0x294740){logger['info'](_0x41bd7f['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x294740['message']);attachment[_0x93f0('0x33')]({'name':path[_0x93f0('0x34')](_0x41bd7f[_0x93f0('0x2b')])[_0x93f0('0x22')],'basename':path['parse'](_0x41bd7f[_0x93f0('0x2b')])[_0x93f0('0x22')]+_0x93f0('0x35'),'type':_0x93f0('0x36')})['then'](function(_0x49a949){faxAccount[_0x93f0('0x37')](_0x51bae5,{'from':_0x41bd7f['calleridnum'],'mapKey':'fax','body':path[_0x93f0('0x34')](_0x41bd7f[_0x93f0('0x2b')])[_0x93f0('0x22')]+_0x93f0('0x35'),'AttachmentId':_0x49a949['id']})[_0x93f0('0x38')](function(_0x510022){logger[_0x93f0('0x39')](_0x41bd7f[_0x93f0('0x20')],_0x93f0('0x3a'),JSON[_0x93f0('0x3b')](_0x510022));});})['catch'](function(_0x36363e){logger[_0x93f0('0x39')](_0x41bd7f['uniqueid'],_0x93f0('0x3c'),JSON[_0x93f0('0x3b')](_0x36363e));});});}logger[_0x93f0('0x2c')](_0x41bd7f[_0x93f0('0x20')],_0x93f0('0x3c'));}};Fax[_0x93f0('0x1b')][_0x93f0('0x1a')]=function(_0x2839d0){if(this['actions'][_0x2839d0['uniqueid']]){_['merge'](this[_0x93f0('0xc')][_0x2839d0[_0x93f0('0x20')]],_[_0x93f0('0x3d')](_0x2839d0,[_0x93f0('0x3e'),'reason']));}};function updateStatus(_0x5dc00b){if(_0x5dc00b[_0x93f0('0x3f')]){faxMessage['update'](_0x5dc00b[_0x93f0('0x3f')],{'failMessage':_0x93f0('0x40')})[_0x93f0('0x41')](function(_0x41a1b7){ut[_0x93f0('0x42')](_0x93f0('0x43'),_0x41a1b7);})[_0x93f0('0x38')](function(_0x4f1c88){ut[_0x93f0('0x42')]('[Fax][Message][Error][NoUpdate1]',_0x4f1c88);});}else{ut['logger'](_0x93f0('0x44'));}}Fax[_0x93f0('0x1b')]['updateStatus']=function(_0x3c7abb,_0x3ef43e,_0x2a3b4a){var _0x31d49b=this;var _0x54eabc={};if(_0x3ef43e){_0x54eabc={'read':_0x3ef43e};}else{_0x54eabc={'failMessage':_0x2a3b4a};}if(this['actions'][_0x3c7abb]['AttachmentId']){faxMessage[_0x93f0('0x45')](this[_0x93f0('0xe')][_0x3c7abb]['AttachmentId'],_0x54eabc)[_0x93f0('0x41')](function(_0x163cd2){ut[_0x93f0('0x42')](_0x93f0('0x46'),_0x163cd2);})[_0x93f0('0x38')](function(_0x27362c){ut['logger']('[Fax][Message][NoUpdate1]',_0x27362c);})['finally'](function(){delete _0x31d49b[_0x93f0('0xc')][_0x3c7abb];delete _0x31d49b[_0x93f0('0xe')][_0x3c7abb];});}else{ut[_0x93f0('0x42')](_0x93f0('0x47'));delete this[_0x93f0('0xc')][_0x3c7abb];delete this[_0x93f0('0xe')][_0x3c7abb];}};Fax[_0x93f0('0x1b')]['syncHangup']=function(_0x1c72c3){var _0x5d5058=this;if(this[_0x93f0('0xc')][_0x1c72c3[_0x93f0('0x20')]]){if(this[_0x93f0('0xe')][_0x1c72c3[_0x93f0('0x20')]]){this[_0x93f0('0xc')][_0x1c72c3[_0x93f0('0x20')]]['id']=this[_0x93f0('0xe')][_0x1c72c3[_0x93f0('0x20')]]['id'];this[_0x93f0('0xc')][_0x1c72c3['uniqueid']][_0x93f0('0x22')]=this[_0x93f0('0xe')][_0x1c72c3[_0x93f0('0x20')]][_0x93f0('0x22')];}logger[_0x93f0('0x2c')](_0x1c72c3[_0x93f0('0x20')],this[_0x93f0('0xe')][_0x1c72c3[_0x93f0('0x20')]]?_0x93f0('0x48'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x93f0('0xc')][_0x1c72c3['uniqueid']]));if(this[_0x93f0('0xe')][_0x1c72c3['uniqueid']]){if(this[_0x93f0('0xc')][_0x1c72c3['uniqueid']][_0x93f0('0x49')]>0x0&&this[_0x93f0('0xc')][_0x1c72c3[_0x93f0('0x20')]][_0x93f0('0x14')]===_0x93f0('0x4a')){this[_0x93f0('0x4b')](_0x1c72c3[_0x93f0('0x20')],!![]);}else{this[_0x93f0('0x4b')](_0x1c72c3[_0x93f0('0x20')],![],this[_0x93f0('0xc')][_0x1c72c3[_0x93f0('0x20')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x93f0('0xc')][_0x1c72c3[_0x93f0('0x20')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x93f0('0x1b')][_0x93f0('0x4c')]=function(_0x19edb3){var _0x1c2d8b=this;return new BPromise(function(_0x37b6bb,_0x243d57){_0x1c2d8b['execOriginate'](_0x19edb3,_0x1c2d8b['faxAccounts'][_0x19edb3[_0x93f0('0x4d')]])['then'](function(_0x3f6f09){ut[_0x93f0('0x42')](_0x93f0('0x4e'),_0x3f6f09);_0x37b6bb(ut['message'](_0x93f0('0x4f')));})[_0x93f0('0x38')](function(_0x58feb2){ut[_0x93f0('0x42')](_0x93f0('0x50'),_0x58feb2);updateStatus(_0x19edb3);_0x243d57(ut[_0x93f0('0x51')](_0x93f0('0x52')));});});};Fax[_0x93f0('0x1b')][_0x93f0('0x53')]=function(_0xe985e4){var _0x22a764=this;return new BPromise(function(_0x339454,_0x5b40ba){var _0x5326f8=_0x22a764[_0x93f0('0x54')](_0x22a764[_0x93f0('0xd')][_0xe985e4[_0x93f0('0x4d')]][_0x93f0('0x55')],_0xe985e4);if(_0x5326f8[_0x93f0('0x56')]){_0x339454(ut[_0x93f0('0x51')](_0x93f0('0x57')));}else{_0x5b40ba(ut['message'](_0x5326f8[_0x93f0('0x51')]));}});};function originate(_0x2d0154,_0x50b9e6,_0x1ddf86){return new BPromise(function(_0x1dafb0,_0x347ccc){if(_0x1ddf86){var _0xe3427=util[_0x93f0('0x58')](_0x93f0('0x59'),path['parse'](_0x2d0154[_0x93f0('0x5a')])['name'],_0x2d0154[_0x93f0('0x5a')]);gs['execute'](_0xe3427)['then'](function(){_0x2d0154[_0x93f0('0x5a')]=util[_0x93f0('0x58')]('%s/%s.tif',path[_0x93f0('0x34')](_0x2d0154['path'])[_0x93f0('0x5b')],path[_0x93f0('0x34')](_0x2d0154['path'])[_0x93f0('0x22')]);_0x50b9e6[_0x93f0('0x5c')]=_0x2d0154[_0x93f0('0x5a')];ut['logger'](_0x93f0('0x5d'),'');ami[_0x93f0('0x5e')](ut[_0x93f0('0x5f')](_0x2d0154,_0x50b9e6))['then'](function(_0x237739){_0x1dafb0(_0x237739);})[_0x93f0('0x38')](function(_0x44f76b){_0x347ccc(_0x44f76b);});})[_0x93f0('0x38')](function(_0x399866){_0x347ccc(_0x399866);});}else{ami[_0x93f0('0x5e')](ut['variablesAction'](_0x2d0154,_0x50b9e6))[_0x93f0('0x41')](function(_0x5de351){_0x1dafb0(_0x5de351);})['catch'](function(_0x54a02b){_0x347ccc(_0x54a02b);});}});}Fax[_0x93f0('0x1b')][_0x93f0('0x60')]=function(_0x457755,_0x556737){var _0x42c785=this;return new BPromise(function(_0x2cc819,_0x3c5dbd){var _0x3c4146=uuid['v4']();var _0x17d7da=ut[_0x93f0('0x61')](_0x457755,_0x556737);_0x42c785[_0x93f0('0xe')][_0x3c4146]=new Action(_0x3c4146,_0x556737,_0x457755);var _0x1dbb7c=_0x42c785[_0x93f0('0xe')][_0x3c4146];if(path['parse'](_0x457755[_0x93f0('0x5a')])[_0x93f0('0x62')]===_0x93f0('0x35')){originate(_0x1dbb7c,_0x17d7da,!![])[_0x93f0('0x41')](function(_0x3424ff){_0x2cc819(_0x3424ff);})[_0x93f0('0x38')](function(_0x57cbb9){_0x3c5dbd(_0x57cbb9);});}else{originate(_0x1dbb7c,_0x17d7da,![])['then'](function(_0xfaa4ce){_0x2cc819(_0xfaa4ce);})[_0x93f0('0x38')](function(_0x285d41){_0x3c5dbd(_0x285d41);});}});};Fax[_0x93f0('0x1b')]['isTrunkReachable']=function(_0x208f6e){return!_['isNil'](_0x208f6e)&&!_[_0x93f0('0x63')](_0x208f6e['name'])&&!_['isNil'](_0x208f6e[_0x93f0('0x64')])&&_0x208f6e['active']&&!_[_0x93f0('0x63')](this['trunks'][util[_0x93f0('0x58')]('SIP/%s',_0x208f6e[_0x93f0('0x22')])])&&!_['isNil'](this[_0x93f0('0x65')][util[_0x93f0('0x58')]('SIP/%s',_0x208f6e[_0x93f0('0x22')])]['status'])&&(this['trunks'][util[_0x93f0('0x58')]('SIP/%s',_0x208f6e[_0x93f0('0x22')])][_0x93f0('0x2a')]===_0x93f0('0x66')||this[_0x93f0('0x65')][util[_0x93f0('0x58')](_0x93f0('0x67'),_0x208f6e[_0x93f0('0x22')])][_0x93f0('0x2a')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x98a94c,_0x3cd785){if(!this[_0x93f0('0x68')](_0x98a94c)){ut['logger'](_0x93f0('0x69'),_[_0x93f0('0x63')](_0x98a94c)?'':_0x98a94c['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x93f0('0x6a')};}if(_[_0x93f0('0x63')](_0x3cd785[_0x93f0('0x6b')])){ut[_0x93f0('0x42')](_0x93f0('0x6c'),JSON[_0x93f0('0x3b')](_0x3cd785));return{'isValid':![],'message':_0x93f0('0x6d')};}if(_[_0x93f0('0x63')](_0x3cd785[_0x93f0('0x5a')])){ut[_0x93f0('0x42')](_0x93f0('0x6e'),JSON[_0x93f0('0x3b')](_0x3cd785));return{'isValid':![],'message':_0x93f0('0x6f')};}return{'isValid':!![],'message':_0x93f0('0x70')};};module[_0x93f0('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 666d9c5..42fd555 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 _0x9807=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0x9807,0xb4));var _0x7980=function(_0x216791,_0x4249a0){_0x216791=_0x216791-0x0;var _0x2a6e40=_0x9807[_0x216791];return _0x2a6e40;};'use strict';var util=require(_0x7980('0x0'));var BPromise=require(_0x7980('0x1'));var logger=require(_0x7980('0x2'))(_0x7980('0x3'));var _=require(_0x7980('0x4'));var faxAccount=require(_0x7980('0x5'));function loggerCatch(_0x5dac65){return function(_0x573479){logger[_0x7980('0x6')](_0x5dac65,util[_0x7980('0x7')](_0x573479,{'showHidden':![],'depth':null}));};}exports[_0x7980('0x8')]=function(_0x1b9991,_0x5d9dd8){return BPromise[_0x7980('0x9')]()['then'](faxAccount['notify'](_0x1b9991,_0x5d9dd8))[_0x7980('0xa')](loggerCatch(_0x7980('0xb')));}; \ No newline at end of file +var _0x9e01=['../rpc/faxAccount','error','inspect','resolve','then','notify','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x3c6c7c,_0x569b3e){var _0x56c812=function(_0x35d6f3){while(--_0x35d6f3){_0x3c6c7c['push'](_0x3c6c7c['shift']());}};_0x56c812(++_0x569b3e);}(_0x9e01,0x127));var _0x19e0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9e01[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x19e0('0x0'));var BPromise=require(_0x19e0('0x1'));var logger=require(_0x19e0('0x2'))(_0x19e0('0x3'));var _=require(_0x19e0('0x4'));var faxAccount=require(_0x19e0('0x5'));function loggerCatch(_0x978062){return function(_0x222238){logger[_0x19e0('0x6')](_0x978062,util[_0x19e0('0x7')](_0x222238,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x24c371,_0x6955f0){return BPromise[_0x19e0('0x8')]()[_0x19e0('0x9')](faxAccount[_0x19e0('0xa')](_0x24c371,_0x6955f0))['catch'](loggerCatch(_0x19e0('0xb')));}; \ 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 e006a89..1af5dc1 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 _0x67b5=['info','util','fax','child_process','execute','Exec\x20gs'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0x67b5,0x15d));var _0x567b=function(_0x1788f8,_0x1a5c0c){_0x1788f8=_0x1788f8-0x0;var _0x31330d=_0x67b5[_0x1788f8];return _0x31330d;};'use strict';var util=require(_0x567b('0x0'));var logger=require('../../../../config/logger')(_0x567b('0x1'));var BPromise=require('bluebird');var exec=require(_0x567b('0x2'))['exec'];exports[_0x567b('0x3')]=function(_0x232113){return new BPromise(function(_0x5a4608,_0x46fa54){exec(_0x232113,function(_0x55a79a,_0x1e9259,_0x382ed4){logger['info'](_0x567b('0x4'),_0x1e9259);if(_0x55a79a){logger[_0x567b('0x5')](_0x567b('0x4'),'\x20Error\x20:',util['inspect'](_0x55a79a,{'showHidden':![],'depth':null}),_0x1e9259,_0x382ed4);_0x46fa54(_0x55a79a);}_0x5a4608(_0x1e9259);});});}; \ No newline at end of file +var _0x0da1=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info'];(function(_0x5b1aca,_0x493824){var _0x39b3cf=function(_0x21ed83){while(--_0x21ed83){_0x5b1aca['push'](_0x5b1aca['shift']());}};_0x39b3cf(++_0x493824);}(_0x0da1,0x7b));var _0x10da=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x0da1[_0x298ed3];return _0x5aad28;};'use strict';var util=require(_0x10da('0x0'));var logger=require(_0x10da('0x1'))(_0x10da('0x2'));var BPromise=require(_0x10da('0x3'));var exec=require('child_process')[_0x10da('0x4')];exports[_0x10da('0x5')]=function(_0x52f60c){return new BPromise(function(_0x461fa8,_0x1b93fb){exec(_0x52f60c,function(_0x5af5c3,_0x5a2e87,_0x43ccc9){logger[_0x10da('0x6')]('Exec\x20gs',_0x5a2e87);if(_0x5af5c3){logger[_0x10da('0x6')](_0x10da('0x7'),_0x10da('0x8'),util[_0x10da('0x9')](_0x5af5c3,{'showHidden':![],'depth':null}),_0x5a2e87,_0x43ccc9);_0x1b93fb(_0x5af5c3);}_0x461fa8(_0x5a2e87);});});}; \ 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 f204ef8..e06d5af 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 _0x03e8=['../../../../config/logger','fax','message','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment'];(function(_0x1ce924,_0x220d57){var _0x2a8240=function(_0x320eba){while(--_0x320eba){_0x1ce924['push'](_0x1ce924['shift']());}};_0x2a8240(++_0x220d57);}(_0x03e8,0x1a6));var _0x803e=function(_0x53b649,_0x455d04){_0x53b649=_0x53b649-0x0;var _0x510f5e=_0x03e8[_0x53b649];return _0x510f5e;};'use strict';var util=require(_0x803e('0x0'));var _=require(_0x803e('0x1'));var moment=require(_0x803e('0x2'));var logger=require(_0x803e('0x3'))(_0x803e('0x4'));exports[_0x803e('0x5')]=function(_0x49f833){return{'message':_0x49f833};};exports['logger']=function(_0x4a5ff4,_0x4273e5){logger['info'](_0x4a5ff4,util[_0x803e('0x6')](_0x4273e5,{'showHidden':![],'depth':null}));};exports[_0x803e('0x7')]=function(_0x24e735,_0x124dc9){var _0x6192c4={'XMF-ECM':_0x124dc9[_0x803e('0x8')],'XMF-HEADERINFO':_0x124dc9['headerinfo'],'XMF-MINRATE':_0x124dc9[_0x803e('0x9')],'XMF-MAXRATE':_0x124dc9[_0x803e('0xa')],'XMF-MODEM':util[_0x803e('0xb')](_0x803e('0xc'),_0x124dc9[_0x803e('0xd')]),'XMF-GATEWAY':_0x124dc9[_0x803e('0xe')],'XMF-FAXDETECT':_0x124dc9[_0x803e('0xf')],'XMF-T38TIMEOUT':_0x124dc9['t38timeout'],'XMF-LOCALSTATIONID':_0x124dc9[_0x803e('0x10')],'XMF-PATH':_0x24e735[_0x803e('0x11')]};return _0x6192c4;};exports[_0x803e('0x12')]=function(_0x3df644,_0x1bf4ca){return{'actionid':_0x3df644[_0x803e('0x13')],'action':_0x803e('0x14'),'channel':_0x3df644[_0x803e('0x15')],'Exten':'xcally-motion-fax','Context':_0x803e('0x16'),'Priority':'1','callerid':util[_0x803e('0xb')](_0x803e('0x17'),_0x3df644[_0x803e('0x18')]?_0x3df644[_0x803e('0x18')]:'',_0x3df644[_0x803e('0x10')]),'variable':_0x1bf4ca,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3df644['uniqueid']};}; \ No newline at end of file +var _0x27e2=['fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger'];(function(_0x4b28e7,_0x55161d){var _0x49a4d5=function(_0x444cff){while(--_0x444cff){_0x4b28e7['push'](_0x4b28e7['shift']());}};_0x49a4d5(++_0x55161d);}(_0x27e2,0x98));var _0x227e=function(_0x4643e7,_0x1d8883){_0x4643e7=_0x4643e7-0x0;var _0x148487=_0x27e2[_0x4643e7];return _0x148487;};'use strict';var util=require(_0x227e('0x0'));var _=require(_0x227e('0x1'));var moment=require(_0x227e('0x2'));var logger=require(_0x227e('0x3'))(_0x227e('0x4'));exports[_0x227e('0x5')]=function(_0x48e74d){return{'message':_0x48e74d};};exports[_0x227e('0x6')]=function(_0x1b2609,_0xa6265){logger['info'](_0x1b2609,util[_0x227e('0x7')](_0xa6265,{'showHidden':![],'depth':null}));};exports[_0x227e('0x8')]=function(_0x493e71,_0x63dfbf){var _0x461f96={'XMF-ECM':_0x63dfbf[_0x227e('0x9')],'XMF-HEADERINFO':_0x63dfbf[_0x227e('0xa')],'XMF-MINRATE':_0x63dfbf[_0x227e('0xb')],'XMF-MAXRATE':_0x63dfbf[_0x227e('0xc')],'XMF-MODEM':util[_0x227e('0xd')](_0x227e('0xe'),_0x63dfbf[_0x227e('0xf')]),'XMF-GATEWAY':_0x63dfbf[_0x227e('0x10')],'XMF-FAXDETECT':_0x63dfbf[_0x227e('0x11')],'XMF-T38TIMEOUT':_0x63dfbf['t38timeout'],'XMF-LOCALSTATIONID':_0x63dfbf[_0x227e('0x12')],'XMF-PATH':_0x493e71['path']};return _0x461f96;};exports[_0x227e('0x13')]=function(_0x1df70f,_0x3c4e7b){return{'actionid':_0x1df70f[_0x227e('0x14')],'action':_0x227e('0x15'),'channel':_0x1df70f[_0x227e('0x16')],'Exten':_0x227e('0x17'),'Context':_0x227e('0x18'),'Priority':'1','callerid':util[_0x227e('0xd')](_0x227e('0x19'),_0x1df70f[_0x227e('0xa')]?_0x1df70f[_0x227e('0xa')]:'',_0x1df70f[_0x227e('0x12')]),'variable':_0x3c4e7b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1df70f[_0x227e('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6c0e98f..4bf32e1 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 _0x2d2b=['getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','util','moment','./realtime','./report','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','initTrunks','getVoiceQueues','initVoiceQueues'];(function(_0x185f01,_0x3930e3){var _0x330844=function(_0x3aee68){while(--_0x3aee68){_0x185f01['push'](_0x185f01['shift']());}};_0x330844(++_0x3930e3);}(_0x2d2b,0x155));var _0xb2d2=function(_0x5a2d57,_0x545763){_0x5a2d57=_0x5a2d57-0x0;var _0x19c07f=_0x2d2b[_0x5a2d57];return _0x19c07f;};'use strict';var util=require(_0xb2d2('0x0'));var moment=require(_0xb2d2('0x1'));var server=require('./server');var Realtime=require(_0xb2d2('0x2'));var Report=require(_0xb2d2('0x3'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0xb2d2('0x4'));var Preview=require(_0xb2d2('0x5'));var Fax=require(_0xb2d2('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0xb2d2('0x7'));var voiceQueueReport=require(_0xb2d2('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xb2d2('0x9'));var trigger=require(_0xb2d2('0xa'));var template=require(_0xb2d2('0xb'));var cmHopperHistory=require(_0xb2d2('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xb2d2('0xd'));var faxAccount=require(_0xb2d2('0xe'));var zendesk=require(_0xb2d2('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xb2d2('0x10'));var desk=require(_0xb2d2('0x11'));var zoho=require(_0xb2d2('0x12'));var vtiger=require(_0xb2d2('0x13'));var freshsales=require(_0xb2d2('0x14'));var servicenow=require(_0xb2d2('0x15'));var dynamics365=require(_0xb2d2('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xb2d2('0x17')](_0xb2d2('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xb2d2('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xb2d2('0x19')]()[_0xb2d2('0x1a')](user['getAgents']())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x1b')]())[_0xb2d2('0x1a')](user['getTelephones']())[_0xb2d2('0x1a')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x1c')]())[_0xb2d2('0x1a')](voiceQueue[_0xb2d2('0x1d')]())['then'](realtime[_0xb2d2('0x1e')]())[_0xb2d2('0x1a')](trigger[_0xb2d2('0x1f')]())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x20')]())[_0xb2d2('0x1a')](template[_0xb2d2('0x21')]())[_0xb2d2('0x1a')](realtime['initTemplates']())[_0xb2d2('0x1a')](zendesk[_0xb2d2('0x22')]())[_0xb2d2('0x1a')](realtime['initZendeskAccounts']())['then'](salesforce[_0xb2d2('0x23')]())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x24')]())[_0xb2d2('0x1a')](sugarcrm[_0xb2d2('0x25')]())[_0xb2d2('0x1a')](realtime['initSugarcrmAccounts']())[_0xb2d2('0x1a')](freshdesk[_0xb2d2('0x26')]())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x27')]())[_0xb2d2('0x1a')](desk[_0xb2d2('0x28')]())['then'](realtime['initDeskAccounts']())[_0xb2d2('0x1a')](zoho[_0xb2d2('0x29')]())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x2a')]())[_0xb2d2('0x1a')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0xb2d2('0x1a')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xb2d2('0x2b')]())['then'](servicenow[_0xb2d2('0x2c')]())[_0xb2d2('0x1a')](realtime['initServicenowAccounts']())[_0xb2d2('0x1a')](dynamics365[_0xb2d2('0x2d')]())['then'](realtime[_0xb2d2('0x2e')]())[_0xb2d2('0x1a')](campaign[_0xb2d2('0x2f')]())[_0xb2d2('0x1a')](realtime['initCampaigns']())[_0xb2d2('0x1a')](voiceExtension[_0xb2d2('0x30')]())[_0xb2d2('0x1a')](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x31')]())[_0xb2d2('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0xb2d2('0x19')]()[_0xb2d2('0x1a')](voiceQueueReport['getVoiceQueueReports']())[_0xb2d2('0x1a')](realtime['initVoiceQueueReports']())[_0xb2d2('0x1a')](cmHopperHistory[_0xb2d2('0x32')]())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x33')]())[_0xb2d2('0x1a')](cmHopperHistory[_0xb2d2('0x34')]())[_0xb2d2('0x1a')](realtime[_0xb2d2('0x35')]())['then'](voiceCallReport[_0xb2d2('0x36')]())[_0xb2d2('0x1a')](realtime['initVoiceCallReports']())[_0xb2d2('0x37')](function(_0x23843e){logger['error'](_0xb2d2('0x38'),util[_0xb2d2('0x39')](_0x23843e,{'showHidden':![],'depth':null}));});}function main(){return server[_0xb2d2('0x3a')](realtime,preview,fax)[_0xb2d2('0x1a')](function(){return initRealtime();})[_0xb2d2('0x1a')](function(){return initParams();})[_0xb2d2('0x1a')](function(){report[_0xb2d2('0x3b')]();setInterval(initRealtime,0x1388);})[_0xb2d2('0x37')](function(_0x1bfb5d){logger[_0xb2d2('0x3c')](_0xb2d2('0x3d'),util[_0xb2d2('0x39')](_0x1bfb5d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x595e=['getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','[index.js][main]','inspect','util','moment','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts'];(function(_0x30cc37,_0x55e217){var _0x46de38=function(_0x231d78){while(--_0x231d78){_0x30cc37['push'](_0x30cc37['shift']());}};_0x46de38(++_0x55e217);}(_0x595e,0x1d3));var _0xe595=function(_0x37d61d,_0x3a0421){_0x37d61d=_0x37d61d-0x0;var _0x4515cd=_0x595e[_0x37d61d];return _0x4515cd;};'use strict';var util=require(_0xe595('0x0'));var moment=require(_0xe595('0x1'));var server=require('./server');var Realtime=require(_0xe595('0x2'));var Report=require(_0xe595('0x3'));var Acw=require(_0xe595('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xe595('0x5'));var Preview=require(_0xe595('0x6'));var Fax=require(_0xe595('0x7'));var user=require(_0xe595('0x8'));var voiceQueue=require(_0xe595('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xe595('0xa'));var trunk=require(_0xe595('0xb'));var trigger=require(_0xe595('0xc'));var template=require(_0xe595('0xd'));var cmHopperHistory=require(_0xe595('0xe'));var campaign=require(_0xe595('0xf'));var voiceExtension=require(_0xe595('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe595('0x11'));var salesforce=require(_0xe595('0x12'));var sugarcrm=require(_0xe595('0x13'));var freshdesk=require(_0xe595('0x14'));var desk=require(_0xe595('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xe595('0x16'));var servicenow=require(_0xe595('0x17'));var dynamics365=require(_0xe595('0x18'));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(_0xe595('0x19'))(_0xe595('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe595('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe595('0x1b')](_0xe595('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xe595('0x1d')](user[_0xe595('0x1e')]())[_0xe595('0x1d')](realtime['initAgents']())[_0xe595('0x1d')](user[_0xe595('0x1f')]())['then'](realtime[_0xe595('0x20')]())[_0xe595('0x1d')](trunk['getTrunks']())[_0xe595('0x1d')](realtime[_0xe595('0x21')]())[_0xe595('0x1d')](voiceQueue[_0xe595('0x22')]())[_0xe595('0x1d')](realtime[_0xe595('0x23')]())['then'](trigger['getTriggers']())[_0xe595('0x1d')](realtime[_0xe595('0x24')]())[_0xe595('0x1d')](template[_0xe595('0x25')]())[_0xe595('0x1d')](realtime[_0xe595('0x26')]())[_0xe595('0x1d')](zendesk['getZendeskAccounts']())[_0xe595('0x1d')](realtime[_0xe595('0x27')]())[_0xe595('0x1d')](salesforce['getSalesforceAccounts']())[_0xe595('0x1d')](realtime[_0xe595('0x28')]())[_0xe595('0x1d')](sugarcrm[_0xe595('0x29')]())[_0xe595('0x1d')](realtime[_0xe595('0x2a')]())[_0xe595('0x1d')](freshdesk['getFreshdeskAccounts']())[_0xe595('0x1d')](realtime[_0xe595('0x2b')]())['then'](desk[_0xe595('0x2c')]())[_0xe595('0x1d')](realtime[_0xe595('0x2d')]())['then'](zoho[_0xe595('0x2e')]())[_0xe595('0x1d')](realtime[_0xe595('0x2f')]())[_0xe595('0x1d')](vtiger[_0xe595('0x30')]())['then'](realtime[_0xe595('0x31')]())['then'](freshsales['getFreshsalesAccounts']())[_0xe595('0x1d')](realtime[_0xe595('0x32')]())['then'](servicenow['getServicenowAccounts']())['then'](realtime[_0xe595('0x33')]())['then'](dynamics365[_0xe595('0x34')]())['then'](realtime[_0xe595('0x35')]())['then'](campaign[_0xe595('0x36')]())[_0xe595('0x1d')](realtime[_0xe595('0x37')]())[_0xe595('0x1d')](voiceExtension[_0xe595('0x38')]())['then'](realtime[_0xe595('0x39')]())[_0xe595('0x1d')](faxAccount[_0xe595('0x3a')]())[_0xe595('0x1d')](realtime[_0xe595('0x3b')]())[_0xe595('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0xe595('0x3c')]()[_0xe595('0x1d')](voiceQueueReport[_0xe595('0x3d')]())[_0xe595('0x1d')](realtime[_0xe595('0x3e')]())[_0xe595('0x1d')](cmHopperHistory[_0xe595('0x3f')]())[_0xe595('0x1d')](realtime[_0xe595('0x40')]())['then'](cmHopperHistory[_0xe595('0x41')]())['then'](realtime['initCampaignHopperHistory']())[_0xe595('0x1d')](voiceCallReport[_0xe595('0x42')]())[_0xe595('0x1d')](realtime[_0xe595('0x43')]())[_0xe595('0x44')](function(_0x2cacfc){logger[_0xe595('0x45')](_0xe595('0x46'),util['inspect'](_0x2cacfc,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xe595('0x1d')](function(){return initRealtime();})[_0xe595('0x1d')](function(){return initParams();})[_0xe595('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xe595('0x44')](function(_0x105a16){logger[_0xe595('0x45')](_0xe595('0x47'),util[_0xe595('0x48')](_0x105a16,{'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 892228b..9588fa0 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 _0xb768=['interface','online','voiceStatus','unknown','local','prototype','updateStatusRealtime','state','toLowerCase','idle','talking','statePause','voiceStatusTime','format','stateTime','status','voiceStatusCallerIdNumber','onhold','stringify','user:%s','emit','user:ami:update','omit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','address','mobile'];(function(_0x40b43c,_0x269319){var _0x1d31b7=function(_0x424d01){while(--_0x424d01){_0x40b43c['push'](_0x40b43c['shift']());}};_0x1d31b7(++_0x269319);}(_0xb768,0x1ba));var _0x8b76=function(_0x427ea5,_0x33b039){_0x427ea5=_0x427ea5-0x0;var _0xa3c8b7=_0xb768[_0x427ea5];return _0xa3c8b7;};'use strict';var _=require(_0x8b76('0x0'));var util=require('util');var moment=require(_0x8b76('0x1'));var md5=require(_0x8b76('0x2'));var Redis=require(_0x8b76('0x3'));var config=require(_0x8b76('0x4'));config[_0x8b76('0x5')]=_[_0x8b76('0x6')](config[_0x8b76('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8b76('0x7'))(new Redis(config[_0x8b76('0x5')]));function Agent(_0x5b7b9d){this['id']=_0x5b7b9d['id']||0x0;this['name']=_0x5b7b9d[_0x8b76('0x8')]||'';this[_0x8b76('0x9')]=_0x5b7b9d[_0x8b76('0x9')]||'';this[_0x8b76('0xa')]=_0x5b7b9d['accountcode']||'';this[_0x8b76('0xb')]=_0x5b7b9d['fullname']||'';this['state']='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0x8b76('0xc')]='';this['phone']='';this[_0x8b76('0xd')]='';this[_0x8b76('0xe')]='';this[_0x8b76('0xf')]=_0x5b7b9d[_0x8b76('0xf')]||![];this[_0x8b76('0x10')]=_0x8b76('0x11');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x8b76('0x12')]=![];this['md5']='';}Agent[_0x8b76('0x13')][_0x8b76('0x14')]=function(_0x58da63){var _0x40f6ad;if(_0x58da63&&_0x58da63[_0x8b76('0x15')]){_0x40f6ad=_0x58da63['state'][_0x8b76('0x16')]();switch(_0x40f6ad){case'not_inuse':_0x40f6ad=_0x8b76('0x17');break;case'inuse':_0x40f6ad=_0x8b76('0x18');break;}}if(_0x40f6ad&&this[_0x8b76('0x10')]!==_0x40f6ad||_0x58da63[_0x8b76('0x19')]){this[_0x8b76('0x1a')]=_['toNumber'](moment()[_0x8b76('0x1b')]('x'));}if(_0x40f6ad){this[_0x8b76('0x10')]=_0x40f6ad;}var _0x1ffae8={'id':this['id'],'name':this[_0x8b76('0x8')],'email':this[_0x8b76('0x9')],'accountcode':this['accountcode'],'fullname':this[_0x8b76('0xb')],'state':this[_0x8b76('0x15')],'stateTime':this[_0x8b76('0x1c')],'status':this[_0x8b76('0x1d')],'address':this['address'],'online':this[_0x8b76('0xf')],'voiceStatus':this[_0x8b76('0x10')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x8b76('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x8b76('0xe')],'onhold':this[_0x8b76('0x1f')]};var _0x19b75f=md5(JSON[_0x8b76('0x20')](_0x1ffae8));if(this[_0x8b76('0x2')]!==_0x19b75f){this['md5']=_0x19b75f;io['to'](util[_0x8b76('0x1b')](_0x8b76('0x21'),_0x1ffae8['name']))[_0x8b76('0x22')](_0x8b76('0x23'),_[_0x8b76('0x24')](_0x1ffae8,[_0x8b76('0xf')]));io[_0x8b76('0x22')]('user:presence',_0x1ffae8);}};module[_0x8b76('0x25')]=Agent; \ No newline at end of file +var _0xe8a1=['voiceStatus','toNumber','format','address','interface','stringify','user:ami:update','omit','user:presence','util','moment','md5','ioredis','../../../config/environment','redis','defaults','name','email','accountcode','fullname','state','unknown','status','phone','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','idle'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0xe8a1,0x1f3));var _0x1e8a=function(_0x53dba2,_0x37e701){_0x53dba2=_0x53dba2-0x0;var _0x166996=_0xe8a1[_0x53dba2];return _0x166996;};'use strict';var _=require('lodash');var util=require(_0x1e8a('0x0'));var moment=require(_0x1e8a('0x1'));var md5=require(_0x1e8a('0x2'));var Redis=require(_0x1e8a('0x3'));var config=require(_0x1e8a('0x4'));config[_0x1e8a('0x5')]=_[_0x1e8a('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1e8a('0x5')]));function Agent(_0x3728e7){this['id']=_0x3728e7['id']||0x0;this[_0x1e8a('0x7')]=_0x3728e7[_0x1e8a('0x7')]||'';this[_0x1e8a('0x8')]=_0x3728e7['email']||'';this[_0x1e8a('0x9')]=_0x3728e7['accountcode']||'';this[_0x1e8a('0xa')]=_0x3728e7['fullname']||'';this[_0x1e8a('0xb')]=_0x1e8a('0xc');this['stateTime']=0x0;this[_0x1e8a('0xd')]='unknown';this['address']='';this[_0x1e8a('0xe')]='';this[_0x1e8a('0xf')]='';this['interface']='';this[_0x1e8a('0x10')]=_0x3728e7['online']||![];this['voiceStatus']=_0x1e8a('0xc');this[_0x1e8a('0x11')]=0x0;this[_0x1e8a('0x12')]='';this[_0x1e8a('0x13')]='';this[_0x1e8a('0x14')]=![];this[_0x1e8a('0x15')]=![];this[_0x1e8a('0x2')]='';}Agent[_0x1e8a('0x16')][_0x1e8a('0x17')]=function(_0x5c29d2){var _0x486e22;if(_0x5c29d2&&_0x5c29d2[_0x1e8a('0xb')]){_0x486e22=_0x5c29d2[_0x1e8a('0xb')]['toLowerCase']();switch(_0x486e22){case _0x1e8a('0x18'):_0x486e22=_0x1e8a('0x19');break;case'inuse':_0x486e22='talking';break;}}if(_0x486e22&&this[_0x1e8a('0x1a')]!==_0x486e22||_0x5c29d2['statePause']){this[_0x1e8a('0x11')]=_[_0x1e8a('0x1b')](moment()[_0x1e8a('0x1c')]('x'));}if(_0x486e22){this[_0x1e8a('0x1a')]=_0x486e22;}var _0x393dec={'id':this['id'],'name':this[_0x1e8a('0x7')],'email':this[_0x1e8a('0x8')],'accountcode':this[_0x1e8a('0x9')],'fullname':this[_0x1e8a('0xa')],'state':this[_0x1e8a('0xb')],'stateTime':this['stateTime'],'status':this[_0x1e8a('0xd')],'address':this[_0x1e8a('0x1d')],'online':this[_0x1e8a('0x10')],'voiceStatus':this[_0x1e8a('0x1a')],'voiceStatusTime':this[_0x1e8a('0x11')],'voiceStatusCallerIdNumber':this[_0x1e8a('0x12')],'voiceStatusQueue':this[_0x1e8a('0x13')],'interface':this[_0x1e8a('0x1e')],'onhold':this['onhold']};var _0x305221=md5(JSON[_0x1e8a('0x1f')](_0x393dec));if(this[_0x1e8a('0x2')]!==_0x305221){this['md5']=_0x305221;io['to'](util[_0x1e8a('0x1c')]('user:%s',_0x393dec[_0x1e8a('0x7')]))['emit'](_0x1e8a('0x20'),_[_0x1e8a('0x21')](_0x393dec,['online']));io['emit'](_0x1e8a('0x22'),_0x393dec);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 65bfe8a..d72ac84 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 _0xe4be=['active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xe4be,0x8a));var _0xee4b=function(_0x12d363,_0x2a53fd){_0x12d363=_0x12d363-0x0;var _0x32ad85=_0xe4be[_0x12d363];return _0x32ad85;};'use strict';function Campaign(_0x40c0cf){this['id']=_0x40c0cf['id']||0x0;this['name']=_0x40c0cf['name']||'';this[_0xee4b('0x0')]=_0x40c0cf[_0xee4b('0x0')]||'campaign';this[_0xee4b('0x1')]=0x0;this[_0xee4b('0x2')]=0x0;this[_0xee4b('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xee4b('0x4')]='';this[_0xee4b('0x5')]=!![];this[_0xee4b('0x6')]=_0x40c0cf['active'];this[_0xee4b('0x7')]=_0x40c0cf[_0xee4b('0x7')];this['dialTimezone']=_0x40c0cf[_0xee4b('0x8')]||null;this[_0xee4b('0x9')]=_0x40c0cf[_0xee4b('0x9')]?_0x40c0cf[_0xee4b('0x9')]:null;this[_0xee4b('0xa')]=_0x40c0cf['dialOriginateCallerIdName'];this[_0xee4b('0xb')]=_0x40c0cf[_0xee4b('0xb')];this[_0xee4b('0xc')]=_0x40c0cf[_0xee4b('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x40c0cf[_0xee4b('0xd')];this[_0xee4b('0xe')]=_0x40c0cf[_0xee4b('0xe')];this[_0xee4b('0xf')]=_0x40c0cf[_0xee4b('0xf')];this[_0xee4b('0x10')]=_0x40c0cf[_0xee4b('0x10')];this[_0xee4b('0x11')]=_0x40c0cf[_0xee4b('0x11')];this['dialNoAnswerRetryFrequency']=_0x40c0cf['dialNoAnswerRetryFrequency'];this[_0xee4b('0x12')]=_0x40c0cf[_0xee4b('0x12')];this[_0xee4b('0x13')]=_0x40c0cf[_0xee4b('0x13')]||0x3;this[_0xee4b('0x14')]=_0x40c0cf[_0xee4b('0x14')]||0x96;this['dialDropMaxRetry']=_0x40c0cf['dialDropMaxRetry']||0x3;this[_0xee4b('0x15')]=_0x40c0cf['dialDropRetryFrequency']||0x96;this[_0xee4b('0x16')]=_0x40c0cf['dialAbandonedMaxRetry']||0x3;this[_0xee4b('0x17')]=_0x40c0cf[_0xee4b('0x17')]||0x96;this[_0xee4b('0x18')]=_0x40c0cf[_0xee4b('0x18')]||0x3;this[_0xee4b('0x19')]=_0x40c0cf[_0xee4b('0x19')]||0x96;this[_0xee4b('0x1a')]=_0x40c0cf[_0xee4b('0x1a')]||0x3;this[_0xee4b('0x1b')]=_0x40c0cf[_0xee4b('0x1b')]||0x96;this[_0xee4b('0x1c')]=_0x40c0cf[_0xee4b('0x1c')]||_0xee4b('0x1d');this[_0xee4b('0x1e')]=_0x40c0cf[_0xee4b('0x1e')]||undefined;this[_0xee4b('0x1f')]=_0x40c0cf[_0xee4b('0x1f')]||undefined;this[_0xee4b('0x20')]=_0x40c0cf[_0xee4b('0x20')]||undefined;this['TrunkBackup']=_0x40c0cf[_0xee4b('0x21')]?_0x40c0cf[_0xee4b('0x21')]:undefined;this['Trunk']=_0x40c0cf['Trunk']?_0x40c0cf[_0xee4b('0x22')]:undefined;this['Interval']=_0x40c0cf[_0xee4b('0x23')]?_0x40c0cf[_0xee4b('0x23')]:undefined;this[_0xee4b('0x24')]=_0x40c0cf['SquareProject']?_0x40c0cf[_0xee4b('0x24')]:undefined;this['dialQueueProject']=_0x40c0cf[_0xee4b('0x24')]?_0x40c0cf[_0xee4b('0x24')][_0xee4b('0x25')]:undefined;this[_0xee4b('0x26')]=_0x40c0cf[_0xee4b('0x26')]||![];this[_0xee4b('0x27')]=_0x40c0cf['dialAMDInitialSilence'];this[_0xee4b('0x28')]=_0x40c0cf[_0xee4b('0x28')];this['dialAMDAfterGreetingSilence']=_0x40c0cf['dialAMDAfterGreetingSilence'];this[_0xee4b('0x29')]=_0x40c0cf[_0xee4b('0x29')];this[_0xee4b('0x2a')]=_0x40c0cf['dialAMDMinWordLength'];this[_0xee4b('0x2b')]=_0x40c0cf[_0xee4b('0x2b')];this[_0xee4b('0x2c')]=_0x40c0cf[_0xee4b('0x2c')];this[_0xee4b('0x2d')]=_0x40c0cf[_0xee4b('0x2d')];this[_0xee4b('0x2e')]=_0x40c0cf[_0xee4b('0x2e')];}module[_0xee4b('0x2f')]=Campaign; \ No newline at end of file +var _0x2c2c=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency'];(function(_0x14a7fd,_0x2bf7a0){var _0xc45a5=function(_0x455a27){while(--_0x455a27){_0x14a7fd['push'](_0x14a7fd['shift']());}};_0xc45a5(++_0x2bf7a0);}(_0x2c2c,0x159));var _0xc2c2=function(_0x53e2ca,_0x5ac713){_0x53e2ca=_0x53e2ca-0x0;var _0x51189b=_0x2c2c[_0x53e2ca];return _0x51189b;};'use strict';function Campaign(_0xe296ba){this['id']=_0xe296ba['id']||0x0;this[_0xc2c2('0x0')]=_0xe296ba[_0xc2c2('0x0')]||'';this[_0xc2c2('0x1')]=_0xe296ba[_0xc2c2('0x1')]||_0xc2c2('0x2');this['originated']=0x0;this[_0xc2c2('0x3')]=0x0;this[_0xc2c2('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0xc2c2('0x5')]=_0xe296ba[_0xc2c2('0x5')];this[_0xc2c2('0x6')]=_0xe296ba[_0xc2c2('0x6')];this[_0xc2c2('0x7')]=_0xe296ba[_0xc2c2('0x7')]||null;this[_0xc2c2('0x8')]=_0xe296ba[_0xc2c2('0x8')]?_0xe296ba[_0xc2c2('0x8')]:null;this[_0xc2c2('0x9')]=_0xe296ba[_0xc2c2('0x9')];this[_0xc2c2('0xa')]=_0xe296ba['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0xe296ba[_0xc2c2('0xb')]||0x1e;this[_0xc2c2('0xc')]=_0xe296ba[_0xc2c2('0xc')];this[_0xc2c2('0xd')]=_0xe296ba[_0xc2c2('0xd')];this['dialBusyMaxRetry']=_0xe296ba['dialBusyMaxRetry'];this[_0xc2c2('0xe')]=_0xe296ba[_0xc2c2('0xe')];this[_0xc2c2('0xf')]=_0xe296ba[_0xc2c2('0xf')];this[_0xc2c2('0x10')]=_0xe296ba[_0xc2c2('0x10')];this[_0xc2c2('0x11')]=_0xe296ba[_0xc2c2('0x11')];this[_0xc2c2('0x12')]=_0xe296ba['dialNoSuchNumberMaxRetry']||0x3;this[_0xc2c2('0x13')]=_0xe296ba[_0xc2c2('0x13')]||0x96;this[_0xc2c2('0x14')]=_0xe296ba[_0xc2c2('0x14')]||0x3;this[_0xc2c2('0x15')]=_0xe296ba['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0xe296ba[_0xc2c2('0x16')]||0x3;this['dialAbandonedRetryFrequency']=_0xe296ba['dialAbandonedRetryFrequency']||0x96;this[_0xc2c2('0x17')]=_0xe296ba[_0xc2c2('0x17')]||0x3;this['dialMachineRetryFrequency']=_0xe296ba[_0xc2c2('0x18')]||0x96;this['dialAgentRejectMaxRetry']=_0xe296ba[_0xc2c2('0x19')]||0x3;this[_0xc2c2('0x1a')]=_0xe296ba[_0xc2c2('0x1a')]||0x96;this[_0xc2c2('0x1b')]=_0xe296ba[_0xc2c2('0x1b')]||'DESC';this[_0xc2c2('0x1c')]=_0xe296ba[_0xc2c2('0x1c')]||undefined;this[_0xc2c2('0x1d')]=_0xe296ba[_0xc2c2('0x1d')]||undefined;this[_0xc2c2('0x1e')]=_0xe296ba[_0xc2c2('0x1e')]||undefined;this[_0xc2c2('0x1f')]=_0xe296ba[_0xc2c2('0x1f')]?_0xe296ba[_0xc2c2('0x1f')]:undefined;this[_0xc2c2('0x20')]=_0xe296ba[_0xc2c2('0x20')]?_0xe296ba['Trunk']:undefined;this[_0xc2c2('0x21')]=_0xe296ba[_0xc2c2('0x21')]?_0xe296ba['Interval']:undefined;this[_0xc2c2('0x22')]=_0xe296ba['SquareProject']?_0xe296ba[_0xc2c2('0x22')]:undefined;this['dialQueueProject']=_0xe296ba['SquareProject']?_0xe296ba['SquareProject'][_0xc2c2('0x0')]:undefined;this[_0xc2c2('0x23')]=_0xe296ba[_0xc2c2('0x23')]||![];this[_0xc2c2('0x24')]=_0xe296ba['dialAMDInitialSilence'];this[_0xc2c2('0x25')]=_0xe296ba[_0xc2c2('0x25')];this[_0xc2c2('0x26')]=_0xe296ba[_0xc2c2('0x26')];this[_0xc2c2('0x27')]=_0xe296ba[_0xc2c2('0x27')];this[_0xc2c2('0x28')]=_0xe296ba['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0xe296ba[_0xc2c2('0x29')];this['dialAMDMaximumNumberOfWords']=_0xe296ba[_0xc2c2('0x2a')];this['dialAMDSilenceThreshold']=_0xe296ba['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0xe296ba[_0xc2c2('0x2b')];}module[_0xc2c2('0x2c')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index d479179..824af27 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 _0x0bf7=['monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','monitor','queue'];(function(_0x5cb249,_0x18871a){var _0x2249e3=function(_0xb6af08){while(--_0xb6af08){_0x5cb249['push'](_0x5cb249['shift']());}};_0x2249e3(++_0x18871a);}(_0x0bf7,0x14a));var _0x70bf=function(_0x3175e7,_0x33a5df){_0x3175e7=_0x3175e7-0x0;var _0x28e912=_0x0bf7[_0x3175e7];return _0x28e912;};'use strict';function Channel(){this[_0x70bf('0x0')]=null;this['channel']='';this[_0x70bf('0x1')]='';this[_0x70bf('0x2')]=0x0;this[_0x70bf('0x3')]='';this[_0x70bf('0x4')]=undefined;this[_0x70bf('0x5')]=undefined;this[_0x70bf('0x6')]=0x0;this['context']='';this[_0x70bf('0x7')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this['answered']=![];this[_0x70bf('0x8')]=null;this[_0x70bf('0x9')]=null;this[_0x70bf('0xa')]=![];this[_0x70bf('0xb')]=![];this[_0x70bf('0xc')]='';this[_0x70bf('0xd')]='';this[_0x70bf('0xe')]=0x0;this[_0x70bf('0xf')]=0x0;this[_0x70bf('0x10')]=0x0;this[_0x70bf('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0x70bf('0x12')]=![];this['monitorFilename']=null;this[_0x70bf('0x13')]=null;this[_0x70bf('0x14')]=[];this[_0x70bf('0x15')]=undefined;this[_0x70bf('0x16')]=undefined;this[_0x70bf('0x17')]=undefined;this['mohtime']=0x0;}module[_0x70bf('0x18')]=Channel; \ No newline at end of file +var _0x4219=['transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum'];(function(_0x53c3bd,_0x1a5f4b){var _0x44e56e=function(_0x4ec0a2){while(--_0x4ec0a2){_0x53c3bd['push'](_0x53c3bd['shift']());}};_0x44e56e(++_0x1a5f4b);}(_0x4219,0xdc));var _0x9421=function(_0x4fae5e,_0x11215c){_0x4fae5e=_0x4fae5e-0x0;var _0x1b0302=_0x4219[_0x4fae5e];return _0x1b0302;};'use strict';function Channel(){this[_0x9421('0x0')]=null;this[_0x9421('0x1')]='';this[_0x9421('0x2')]='';this[_0x9421('0x3')]=0x0;this[_0x9421('0x4')]='';this[_0x9421('0x5')]=undefined;this[_0x9421('0x6')]=undefined;this[_0x9421('0x7')]=0x0;this[_0x9421('0x8')]='';this[_0x9421('0x9')]=0x0;this[_0x9421('0xa')]=0x0;this[_0x9421('0xb')]=0x0;this[_0x9421('0xc')]=![];this[_0x9421('0xd')]=null;this[_0x9421('0xe')]=null;this[_0x9421('0xf')]=![];this[_0x9421('0x10')]=![];this['lastapplication']='';this[_0x9421('0x11')]='';this[_0x9421('0x12')]=0x0;this[_0x9421('0x13')]=0x0;this[_0x9421('0x14')]=0x0;this[_0x9421('0x15')]=null;this[_0x9421('0x16')]=null;this[_0x9421('0x17')]=null;this[_0x9421('0x18')]=![];this[_0x9421('0x19')]=null;this[_0x9421('0x1a')]=null;this['monitors']=[];this[_0x9421('0x1b')]=undefined;this[_0x9421('0x1c')]=undefined;this[_0x9421('0x1d')]=undefined;this[_0x9421('0x1e')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 05cfedc..59a5918 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 _0x85e9=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','exports','name','remoteUri','authType'];(function(_0x412e07,_0x319b8e){var _0x574263=function(_0x2136db){while(--_0x2136db){_0x412e07['push'](_0x412e07['shift']());}};_0x574263(++_0x319b8e);}(_0x85e9,0x8c));var _0x985e=function(_0x18e5a3,_0x3f1bb0){_0x18e5a3=_0x18e5a3-0x0;var _0x2049f1=_0x85e9[_0x18e5a3];return _0x2049f1;};'use strict';function DeskAccount(_0x1218be){this['id']=_0x1218be['id']||0x0;this[_0x985e('0x0')]=_0x1218be[_0x985e('0x0')]||'';this['username']=_0x1218be['username']||'';this[_0x985e('0x1')]=_0x1218be['remoteUri']||'';this[_0x985e('0x2')]=_0x1218be[_0x985e('0x2')]||'';this[_0x985e('0x3')]=_0x1218be['password']||'';this[_0x985e('0x4')]=_0x1218be[_0x985e('0x4')]||'';this[_0x985e('0x5')]=_0x1218be[_0x985e('0x5')]||'';this['token']=_0x1218be[_0x985e('0x6')]||'';this[_0x985e('0x7')]=_0x1218be[_0x985e('0x7')]||'';this[_0x985e('0x8')]=_0x1218be[_0x985e('0x8')]||'';this['serverUrl']=_0x1218be[_0x985e('0x9')]||'';this['Configurations']=_0x1218be['Configurations']||{};}module[_0x985e('0xa')]=DeskAccount; \ No newline at end of file +var _0xa6b8=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x31a536,_0x3f799e){var _0x949b6d=function(_0xd5fed7){while(--_0xd5fed7){_0x31a536['push'](_0x31a536['shift']());}};_0x949b6d(++_0x3f799e);}(_0xa6b8,0x1c8));var _0x8a6b=function(_0x8e2d4d,_0x310930){_0x8e2d4d=_0x8e2d4d-0x0;var _0x5e3047=_0xa6b8[_0x8e2d4d];return _0x5e3047;};'use strict';function DeskAccount(_0x276128){this['id']=_0x276128['id']||0x0;this[_0x8a6b('0x0')]=_0x276128[_0x8a6b('0x0')]||'';this['username']=_0x276128[_0x8a6b('0x1')]||'';this[_0x8a6b('0x2')]=_0x276128[_0x8a6b('0x2')]||'';this['authType']=_0x276128[_0x8a6b('0x3')]||'';this[_0x8a6b('0x4')]=_0x276128['password']||'';this['consumerKey']=_0x276128[_0x8a6b('0x5')]||'';this['consumerSecret']=_0x276128[_0x8a6b('0x6')]||'';this[_0x8a6b('0x7')]=_0x276128['token']||'';this[_0x8a6b('0x8')]=_0x276128['tokenSecret']||'';this[_0x8a6b('0x9')]=_0x276128[_0x8a6b('0x9')]||'';this[_0x8a6b('0xa')]=_0x276128[_0x8a6b('0xa')]||'';this[_0x8a6b('0xb')]=_0x276128['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 16ad335..2ee52dd 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 _0x54ff=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x2ec222,_0x1b083d){var _0x40457c=function(_0x2a3fe4){while(--_0x2a3fe4){_0x2ec222['push'](_0x2ec222['shift']());}};_0x40457c(++_0x1b083d);}(_0x54ff,0x1ce));var _0xf54f=function(_0x5dfe29,_0x79d945){_0x5dfe29=_0x5dfe29-0x0;var _0x49977d=_0x54ff[_0x5dfe29];return _0x49977d;};'use strict';function Dynamics365Account(_0x472b55){this['id']=_0x472b55['id']||0x0;this[_0xf54f('0x0')]=_0x472b55[_0xf54f('0x0')]||'';this['username']=_0x472b55[_0xf54f('0x1')]||'';this[_0xf54f('0x2')]=_0x472b55['password']||'';this[_0xf54f('0x3')]=_0x472b55[_0xf54f('0x3')]||'';this[_0xf54f('0x4')]=_0x472b55[_0xf54f('0x4')]||'';this[_0xf54f('0x5')]=_0x472b55[_0xf54f('0x5')]||'';this[_0xf54f('0x6')]=_0x472b55[_0xf54f('0x6')]||{};this['serverUrl']=_0x472b55[_0xf54f('0x7')]||'';this[_0xf54f('0x8')]=_0x472b55[_0xf54f('0x8')]||![];this[_0xf54f('0x9')]=_0x472b55[_0xf54f('0x9')]||{};this[_0xf54f('0xa')]=_0x472b55['CloudProvider']||{};}module[_0xf54f('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x0e39=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','password','remoteUri'];(function(_0x305fc4,_0x3a91e4){var _0x242b0e=function(_0x472a24){while(--_0x472a24){_0x305fc4['push'](_0x305fc4['shift']());}};_0x242b0e(++_0x3a91e4);}(_0x0e39,0x1aa));var _0x90e3=function(_0x739b76,_0x2250f8){_0x739b76=_0x739b76-0x0;var _0x3b471f=_0x0e39[_0x739b76];return _0x3b471f;};'use strict';function Dynamics365Account(_0x2beff5){this['id']=_0x2beff5['id']||0x0;this['name']=_0x2beff5[_0x90e3('0x0')]||'';this['username']=_0x2beff5['username']||'';this[_0x90e3('0x1')]=_0x2beff5[_0x90e3('0x1')]||'';this[_0x90e3('0x2')]=_0x2beff5[_0x90e3('0x2')]||'';this[_0x90e3('0x3')]=_0x2beff5[_0x90e3('0x3')]||'';this['clientId']=_0x2beff5[_0x90e3('0x4')]||'';this[_0x90e3('0x5')]=_0x2beff5['clientSecret']||{};this[_0x90e3('0x6')]=_0x2beff5['serverUrl']||'';this[_0x90e3('0x7')]=_0x2beff5[_0x90e3('0x7')]||![];this[_0x90e3('0x8')]=_0x2beff5[_0x90e3('0x8')]||{};this['CloudProvider']=_0x2beff5[_0x90e3('0x9')]||{};}module[_0x90e3('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a90af8f..6a38424 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 _0x4908=['modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x4908,0xea));var _0x8490=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x4908[_0x4e9d3c];return _0x2d0825;};'use strict';function FaxAccount(_0x3e2600){this['id']=_0x3e2600['id']||0x0;this['name']=_0x3e2600[_0x8490('0x0')]||'';this[_0x8490('0x1')]=_0x3e2600[_0x8490('0x1')];this[_0x8490('0x2')]=_0x3e2600[_0x8490('0x2')];this[_0x8490('0x3')]=_0x3e2600[_0x8490('0x3')];this[_0x8490('0x4')]=_0x3e2600[_0x8490('0x4')];this[_0x8490('0x5')]=_0x3e2600['minrate']||0x960;this['maxrate']=_0x3e2600['maxrate']||0x3840;this[_0x8490('0x6')]=_0x3e2600[_0x8490('0x6')]||_0x8490('0x7');this[_0x8490('0x8')]=_0x3e2600['gateway']||'no';this['faxdetect']=_0x3e2600['faxdetect']||'no';this['t38timeout']=_0x3e2600[_0x8490('0x9')]||0x1388;this[_0x8490('0xa')]=_0x3e2600[_0x8490('0xa')]||_0x8490('0xb');this[_0x8490('0xc')]=_0x3e2600[_0x8490('0xc')]?_0x3e2600[_0x8490('0xc')]:undefined;this[_0x8490('0xd')]=_0x3e2600[_0x8490('0xd')];this[_0x8490('0xe')]=_0x3e2600[_0x8490('0xe')];}module[_0x8490('0xf')]=FaxAccount; \ No newline at end of file +var _0x3277=['t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0xf22532,_0x127bd7){var _0x20abac=function(_0x3572f6){while(--_0x3572f6){_0xf22532['push'](_0xf22532['shift']());}};_0x20abac(++_0x127bd7);}(_0x3277,0xd2));var _0x7327=function(_0x146e96,_0x3d8c90){_0x146e96=_0x146e96-0x0;var _0x32b8cb=_0x3277[_0x146e96];return _0x32b8cb;};'use strict';function FaxAccount(_0x590ffe){this['id']=_0x590ffe['id']||0x0;this[_0x7327('0x0')]=_0x590ffe['name']||'';this[_0x7327('0x1')]=_0x590ffe[_0x7327('0x1')];this[_0x7327('0x2')]=_0x590ffe['ecm'];this[_0x7327('0x3')]=_0x590ffe['headerinfo'];this[_0x7327('0x4')]=_0x590ffe[_0x7327('0x4')];this[_0x7327('0x5')]=_0x590ffe[_0x7327('0x5')]||0x960;this['maxrate']=_0x590ffe[_0x7327('0x6')]||0x3840;this['modem']=_0x590ffe[_0x7327('0x7')]||_0x7327('0x8');this[_0x7327('0x9')]=_0x590ffe['gateway']||'no';this[_0x7327('0xa')]=_0x590ffe[_0x7327('0xa')]||'no';this[_0x7327('0xb')]=_0x590ffe[_0x7327('0xb')]||0x1388;this[_0x7327('0xc')]=_0x590ffe['tech']||_0x7327('0xd');this[_0x7327('0xe')]=_0x590ffe[_0x7327('0xe')]?_0x590ffe[_0x7327('0xe')]:undefined;this[_0x7327('0xf')]=_0x590ffe[_0x7327('0xf')];this[_0x7327('0x10')]=_0x590ffe[_0x7327('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 326f2fb..86763d5 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 _0x0866=['name','username','apiKey','serverUrl','Configurations'];(function(_0x13c461,_0x4e6a17){var _0xaa932a=function(_0xf1d63f){while(--_0xf1d63f){_0x13c461['push'](_0x13c461['shift']());}};_0xaa932a(++_0x4e6a17);}(_0x0866,0x19a));var _0x6086=function(_0x85d7ef,_0x1937c7){_0x85d7ef=_0x85d7ef-0x0;var _0x2b9d2c=_0x0866[_0x85d7ef];return _0x2b9d2c;};'use strict';function FreshdeskAccount(_0x5a83b7){this['id']=_0x5a83b7['id']||0x0;this[_0x6086('0x0')]=_0x5a83b7[_0x6086('0x0')]||'';this[_0x6086('0x1')]=_0x5a83b7[_0x6086('0x1')]||'';this[_0x6086('0x2')]=_0x5a83b7['token']||'';this['remoteUri']=_0x5a83b7['remoteUri']||'';this[_0x6086('0x3')]=_0x5a83b7[_0x6086('0x3')]||'';this[_0x6086('0x4')]=_0x5a83b7[_0x6086('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x9295=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x3df6bb,_0x63af3c){var _0x38172e=function(_0x379ac6){while(--_0x379ac6){_0x3df6bb['push'](_0x3df6bb['shift']());}};_0x38172e(++_0x63af3c);}(_0x9295,0x160));var _0x5929=function(_0x338416,_0x4788c4){_0x338416=_0x338416-0x0;var _0x52cf8a=_0x9295[_0x338416];return _0x52cf8a;};'use strict';function FreshdeskAccount(_0x359f4d){this['id']=_0x359f4d['id']||0x0;this[_0x5929('0x0')]=_0x359f4d[_0x5929('0x0')]||'';this[_0x5929('0x1')]=_0x359f4d[_0x5929('0x1')]||'';this[_0x5929('0x2')]=_0x359f4d[_0x5929('0x3')]||'';this['remoteUri']=_0x359f4d[_0x5929('0x4')]||'';this[_0x5929('0x5')]=_0x359f4d[_0x5929('0x5')]||'';this[_0x5929('0x6')]=_0x359f4d[_0x5929('0x6')]||{};}module[_0x5929('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 06df89b..5a4de15 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 _0xb0df=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0xd9c84f,_0x5baa80){var _0x41305c=function(_0x59297d){while(--_0x59297d){_0xd9c84f['push'](_0xd9c84f['shift']());}};_0x41305c(++_0x5baa80);}(_0xb0df,0x85));var _0xfb0d=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xb0df[_0x4e5552];return _0x60a338;};'use strict';function FreshsalesAccount(_0x26aff2){this['id']=_0x26aff2['id']||0x0;this[_0xfb0d('0x0')]=_0x26aff2[_0xfb0d('0x0')]||'';this[_0xfb0d('0x1')]=_0x26aff2[_0xfb0d('0x1')]||'';this[_0xfb0d('0x2')]=_0x26aff2[_0xfb0d('0x3')]||'';this[_0xfb0d('0x4')]=_0x26aff2[_0xfb0d('0x4')]||'';this[_0xfb0d('0x5')]=_0x26aff2['serverUrl']||'';this[_0xfb0d('0x6')]=_0x26aff2[_0xfb0d('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xd7ce=['serverUrl','Configurations','exports','name','username','token'];(function(_0x33d982,_0x49c670){var _0x1c599e=function(_0x1653d6){while(--_0x1653d6){_0x33d982['push'](_0x33d982['shift']());}};_0x1c599e(++_0x49c670);}(_0xd7ce,0x16b));var _0xed7c=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xd7ce[_0x5cc8];return _0x450661;};'use strict';function FreshsalesAccount(_0x9eb2f6){this['id']=_0x9eb2f6['id']||0x0;this[_0xed7c('0x0')]=_0x9eb2f6[_0xed7c('0x0')]||'';this[_0xed7c('0x1')]=_0x9eb2f6['username']||'';this['apiKey']=_0x9eb2f6[_0xed7c('0x2')]||'';this['remoteUri']=_0x9eb2f6['remoteUri']||'';this['serverUrl']=_0x9eb2f6[_0xed7c('0x3')]||'';this[_0xed7c('0x4')]=_0x9eb2f6[_0xed7c('0x4')]||{};}module[_0xed7c('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 2c8a6d9..f61cef1 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 _0x988f=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinename','accountcode','context','lastAssignedTo','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x988f,0x12a));var _0xf988=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x988f[_0x256d6a];return _0x460058;};'use strict';function QueueReport(){this[_0xf988('0x0')]=_0xf988('0x1');this[_0xf988('0x2')]='';this[_0xf988('0x3')]='';this['calleridname']='';this['queue']='';this[_0xf988('0x4')]=null;this[_0xf988('0x5')]=null;this[_0xf988('0x6')]=0x1;this[_0xf988('0x7')]=0x1;this[_0xf988('0x8')]=![];this[_0xf988('0x9')]=null;this[_0xf988('0xa')]=![];this[_0xf988('0xb')]=null;this[_0xf988('0xc')]=![];this['queuecallerexitAt']=null;this[_0xf988('0xd')]=0x1;this[_0xf988('0xe')]='';this['connectedlinenum']='';this[_0xf988('0xf')]='';this[_0xf988('0x10')]='';this[_0xf988('0x11')]='';this['exten']='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0xf988('0x12')]='';this['motionChannel']=_0xf988('0x13');this[_0xf988('0x14')]=0x0;this['variables']={};}module[_0xf988('0x15')]=QueueReport; \ No newline at end of file +var _0xdeea=['channel','connectedlinenum','connectedlinename','accountcode','context','priority','assigned','lastAssignedTo','variables','exports','type','uniqueid','calleridnum','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xdeea,0x136));var _0xadee=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xdeea[_0x2aecb2];return _0x3ebb80;};'use strict';function QueueReport(){this[_0xadee('0x0')]='inbound';this[_0xadee('0x1')]='';this[_0xadee('0x2')]='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xadee('0x3')]=null;this[_0xadee('0x4')]=0x1;this['count']=0x1;this[_0xadee('0x5')]=![];this[_0xadee('0x6')]=null;this[_0xadee('0x7')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xadee('0x8')]=null;this[_0xadee('0x9')]=0x1;this[_0xadee('0xa')]='';this[_0xadee('0xb')]='';this[_0xadee('0xc')]='';this[_0xadee('0xd')]='';this[_0xadee('0xe')]='';this['exten']='';this[_0xadee('0xf')]='';this['holdtime']=0x0;this[_0xadee('0x10')]=![];this[_0xadee('0x11')]='';this['motionChannel']='voice';this['mohtime']=0x0;this[_0xadee('0x12')]={};}module[_0xadee('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 7d38b97..7c853de 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 _0xbef7=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x349465,_0x14206b){var _0x5a7d5f=function(_0x1058fd){while(--_0x1058fd){_0x349465['push'](_0x349465['shift']());}};_0x5a7d5f(++_0x14206b);}(_0xbef7,0x10d));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x47d72c){this['id']=_0x47d72c['id']||0x0;this['name']=_0x47d72c[_0x7bef('0x0')]||'';this['username']=_0x47d72c[_0x7bef('0x1')]||'';this[_0x7bef('0x2')]=_0x47d72c[_0x7bef('0x2')]||'';this[_0x7bef('0x3')]=_0x47d72c[_0x7bef('0x3')]||'';this[_0x7bef('0x4')]=_0x47d72c[_0x7bef('0x4')]||'';this['clientSecret']=_0x47d72c[_0x7bef('0x5')]||'';this[_0x7bef('0x6')]=_0x47d72c['securityToken']||'';this[_0x7bef('0x7')]=_0x47d72c[_0x7bef('0x7')]||'integrationTab';this[_0x7bef('0x8')]=_0x47d72c[_0x7bef('0x8')]||'';this[_0x7bef('0x9')]=_0x47d72c[_0x7bef('0x9')]||{};}module[_0x7bef('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x0a94=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','integrationTab'];(function(_0x308e98,_0x2424e9){var _0x40a878=function(_0xa5834e){while(--_0xa5834e){_0x308e98['push'](_0x308e98['shift']());}};_0x40a878(++_0x2424e9);}(_0x0a94,0xf5));var _0x40a9=function(_0x3241b1,_0x1c93c3){_0x3241b1=_0x3241b1-0x0;var _0x2b6877=_0x0a94[_0x3241b1];return _0x2b6877;};'use strict';function SalesforceAccount(_0x24ebd7){this['id']=_0x24ebd7['id']||0x0;this[_0x40a9('0x0')]=_0x24ebd7[_0x40a9('0x0')]||'';this[_0x40a9('0x1')]=_0x24ebd7[_0x40a9('0x1')]||'';this['remoteUri']=_0x24ebd7[_0x40a9('0x2')]||'';this[_0x40a9('0x3')]=_0x24ebd7['password']||'';this[_0x40a9('0x4')]=_0x24ebd7[_0x40a9('0x4')]||'';this['clientSecret']=_0x24ebd7[_0x40a9('0x5')]||'';this[_0x40a9('0x6')]=_0x24ebd7[_0x40a9('0x6')]||'';this['type']=_0x24ebd7['type']||_0x40a9('0x7');this[_0x40a9('0x8')]=_0x24ebd7['serverUrl']||'';this[_0x40a9('0x9')]=_0x24ebd7[_0x40a9('0x9')]||{};}module[_0x40a9('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 82b1238..c09a330 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 _0xbc07=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3081e1,_0x241403){var _0x291dc7=function(_0x1c7269){while(--_0x1c7269){_0x3081e1['push'](_0x3081e1['shift']());}};_0x291dc7(++_0x241403);}(_0xbc07,0x1f2));var _0x7bc0=function(_0x40df52,_0xf52c0e){_0x40df52=_0x40df52-0x0;var _0x131206=_0xbc07[_0x40df52];return _0x131206;};'use strict';function ServicenowAccount(_0x397dd2){this['id']=_0x397dd2['id']||0x0;this[_0x7bc0('0x0')]=_0x397dd2[_0x7bc0('0x0')]||'';this[_0x7bc0('0x1')]=_0x397dd2[_0x7bc0('0x1')]||'';this[_0x7bc0('0x2')]=_0x397dd2[_0x7bc0('0x2')]||'';this[_0x7bc0('0x3')]=_0x397dd2[_0x7bc0('0x3')]||'';this['serverUrl']=_0x397dd2[_0x7bc0('0x4')]||'';this[_0x7bc0('0x5')]=_0x397dd2[_0x7bc0('0x5')]||{};}module[_0x7bc0('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xc6e2=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2dcf38,_0x33765a){var _0x2295dc=function(_0x1aff4f){while(--_0x1aff4f){_0x2dcf38['push'](_0x2dcf38['shift']());}};_0x2295dc(++_0x33765a);}(_0xc6e2,0x186));var _0x2c6e=function(_0x2dc18,_0x6a46f4){_0x2dc18=_0x2dc18-0x0;var _0x11ae42=_0xc6e2[_0x2dc18];return _0x11ae42;};'use strict';function ServicenowAccount(_0x525e24){this['id']=_0x525e24['id']||0x0;this[_0x2c6e('0x0')]=_0x525e24[_0x2c6e('0x0')]||'';this[_0x2c6e('0x1')]=_0x525e24[_0x2c6e('0x1')]||'';this['password']=_0x525e24[_0x2c6e('0x2')]||'';this[_0x2c6e('0x3')]=_0x525e24[_0x2c6e('0x3')]||'';this[_0x2c6e('0x4')]=_0x525e24[_0x2c6e('0x4')]||'';this[_0x2c6e('0x5')]=_0x525e24[_0x2c6e('0x5')]||{};}module[_0x2c6e('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 e025ea4..673324a 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 _0xf3cd=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x1b2d57,_0x4fccb7){var _0x5d46dd=function(_0x43616b){while(--_0x43616b){_0x1b2d57['push'](_0x1b2d57['shift']());}};_0x5d46dd(++_0x4fccb7);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xf3cd[_0x3e6b2f];return _0x323215;};'use strict';function SugarcrmAccount(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||'';this[_0xdf3c('0x2')]=_0x13cb67['password']||'';this[_0xdf3c('0x3')]=_0x13cb67[_0xdf3c('0x3')]||'';this[_0xdf3c('0x4')]=_0x13cb67['serverUrl']||'';this[_0xdf3c('0x5')]=_0x13cb67[_0xdf3c('0x5')]||{};}module[_0xdf3c('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x6838=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x587b1c,_0x4c3717){var _0x52cb23=function(_0x2890ef){while(--_0x2890ef){_0x587b1c['push'](_0x587b1c['shift']());}};_0x52cb23(++_0x4c3717);}(_0x6838,0x67));var _0x8683=function(_0x4434f7,_0x431595){_0x4434f7=_0x4434f7-0x0;var _0x364db2=_0x6838[_0x4434f7];return _0x364db2;};'use strict';function SugarcrmAccount(_0x397f16){this['id']=_0x397f16['id']||0x0;this[_0x8683('0x0')]=_0x397f16['name']||'';this['username']=_0x397f16[_0x8683('0x1')]||'';this['password']=_0x397f16['password']||'';this[_0x8683('0x2')]=_0x397f16[_0x8683('0x2')]||'';this[_0x8683('0x3')]=_0x397f16[_0x8683('0x3')]||'';this['Configurations']=_0x397f16[_0x8683('0x4')]||{};}module[_0x8683('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 95a0708..9545515 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 _0x2396=['exports','name','accountcode','state','stateTime','status','unknown','address'];(function(_0x3b5d1e,_0xf044d2){var _0x3ceef9=function(_0x5d445b){while(--_0x5d445b){_0x3b5d1e['push'](_0x3b5d1e['shift']());}};_0x3ceef9(++_0xf044d2);}(_0x2396,0xb9));var _0x6239=function(_0x258257,_0x32042d){_0x258257=_0x258257-0x0;var _0xafb58a=_0x2396[_0x258257];return _0xafb58a;};'use strict';function Telephone(_0x1e2fc6){this['id']=_0x1e2fc6['id']||0x0;this['name']=_0x1e2fc6[_0x6239('0x0')]||'';this[_0x6239('0x1')]=_0x1e2fc6[_0x6239('0x1')]||'';this[_0x6239('0x2')]='unknown';this[_0x6239('0x3')]=0x0;this[_0x6239('0x4')]=_0x6239('0x5');this[_0x6239('0x6')]='';}module[_0x6239('0x7')]=Telephone; \ No newline at end of file +var _0x9018=['unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x242397,_0x17fd84){var _0x472d66=function(_0x3301d7){while(--_0x3301d7){_0x242397['push'](_0x242397['shift']());}};_0x472d66(++_0x17fd84);}(_0x9018,0xc2));var _0x8901=function(_0x3bb10b,_0x546bc2){_0x3bb10b=_0x3bb10b-0x0;var _0x19d91b=_0x9018[_0x3bb10b];return _0x19d91b;};'use strict';function Telephone(_0x439e40){this['id']=_0x439e40['id']||0x0;this[_0x8901('0x0')]=_0x439e40[_0x8901('0x0')]||'';this[_0x8901('0x1')]=_0x439e40[_0x8901('0x1')]||'';this['state']=_0x8901('0x2');this[_0x8901('0x3')]=0x0;this[_0x8901('0x4')]=_0x8901('0x2');this[_0x8901('0x5')]='';}module[_0x8901('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 53a3c86..e742b5c 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(_0x4c7761,_0x88e2bd){var _0x4a0281=function(_0x595263){while(--_0x595263){_0x4c7761['push'](_0x4c7761['shift']());}};_0x4a0281(++_0x88e2bd);}(_0xb10b,0x12a));var _0xbb10=function(_0x195a84,_0x37a11b){_0x195a84=_0x195a84-0x0;var _0x35fa94=_0xb10b[_0x195a84];return _0x35fa94;};'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(_0x3e8acf,_0xbd4cb5){var _0x5d89ec=function(_0xf7f2db){while(--_0xf7f2db){_0x3e8acf['push'](_0x3e8acf['shift']());}};_0x5d89ec(++_0xbd4cb5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 8f6b718..d41b444 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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x46f8a7,_0x40aef2){var _0x126dfe=function(_0x267d87){while(--_0x267d87){_0x46f8a7['push'](_0x46f8a7['shift']());}};_0x126dfe(++_0x40aef2);}(_0xb10b,0x12a));var _0xbb10=function(_0x39b07e,_0x33b057){_0x39b07e=_0x39b07e-0x0;var _0x591dae=_0xb10b[_0x39b07e];return _0x591dae;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x35c2fc,_0xabea37){_0x35c2fc=_0x35c2fc-0x0;var _0x4727fd=_0x0b0e[_0x35c2fc];return _0x4727fd;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index e61bfde..6a17726 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 _0x4de3=['defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','domainport','stateRegistry','registrationtime','address'];(function(_0x45786c,_0x30409b){var _0x5075bb=function(_0x5e1af9){while(--_0x5e1af9){_0x45786c['push'](_0x45786c['shift']());}};_0x5075bb(++_0x30409b);}(_0x4de3,0x1b2));var _0x34de=function(_0x4b42c7,_0x48d4e6){_0x4b42c7=_0x4b42c7-0x0;var _0x2eb2a4=_0x4de3[_0x4b42c7];return _0x2eb2a4;};'use strict';function Trunk(_0x3f6ef9){this['id']=_0x3f6ef9['id']||0x0;this[_0x34de('0x0')]=_0x3f6ef9[_0x34de('0x0')]||![];this['name']=_0x3f6ef9[_0x34de('0x1')]||'';this['state']=_0x34de('0x2');this[_0x34de('0x3')]=0x0;this[_0x34de('0x4')]=_0x34de('0x2');this['registry']=_0x3f6ef9[_0x34de('0x5')]&&_0x3f6ef9['registry'][_0x34de('0x6')](':')?_0x3f6ef9[_0x34de('0x5')][_0x34de('0x7')](':')[0x0]:'';this[_0x34de('0x8')]='';this[_0x34de('0x9')]='';this['domain']='';this[_0x34de('0xa')]='';this['refresh']='';this[_0x34de('0xb')]=_0x34de('0x2');this[_0x34de('0xc')]='';this[_0x34de('0xd')]='';this[_0x34de('0xe')]=_0x3f6ef9[_0x34de('0xe')]||'';}module[_0x34de('0xf')]=Trunk; \ No newline at end of file +var _0xfcba=['defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','host','port','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0x3dec07,_0x434bad){var _0x220da0=function(_0x55c1ed){while(--_0x55c1ed){_0x3dec07['push'](_0x3dec07['shift']());}};_0x220da0(++_0x434bad);}(_0xfcba,0x142));var _0xafcb=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xfcba[_0x5f09c5];return _0x426ad9;};'use strict';function Trunk(_0x5c0cf2){this['id']=_0x5c0cf2['id']||0x0;this[_0xafcb('0x0')]=_0x5c0cf2[_0xafcb('0x0')]||![];this[_0xafcb('0x1')]=_0x5c0cf2[_0xafcb('0x1')]||'';this['state']=_0xafcb('0x2');this[_0xafcb('0x3')]=0x0;this[_0xafcb('0x4')]=_0xafcb('0x2');this[_0xafcb('0x5')]=_0x5c0cf2[_0xafcb('0x5')]&&_0x5c0cf2[_0xafcb('0x5')][_0xafcb('0x6')](':')?_0x5c0cf2[_0xafcb('0x5')]['split'](':')[0x0]:'';this[_0xafcb('0x7')]='';this[_0xafcb('0x8')]='';this['domain']='';this[_0xafcb('0x9')]='';this[_0xafcb('0xa')]='';this[_0xafcb('0xb')]=_0xafcb('0x2');this[_0xafcb('0xc')]='';this[_0xafcb('0xd')]='';this[_0xafcb('0xe')]=_0x5c0cf2[_0xafcb('0xe')]||'';}module[_0xafcb('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index df0c388..98bc4ef 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 _0xd6a4=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x506201,_0x2f35e9){var _0x47055f=function(_0x140dc5){while(--_0x140dc5){_0x506201['push'](_0x506201['shift']());}};_0x47055f(++_0x2f35e9);}(_0xd6a4,0xb9));var _0x4d6a=function(_0x57c08e,_0x193d26){_0x57c08e=_0x57c08e-0x0;var _0x1551a2=_0xd6a4[_0x57c08e];return _0x1551a2;};'use strict';function voiceExtension(_0x1967e8){this['id']=_0x1967e8['id']||0x0;this[_0x4d6a('0x0')]=_0x1967e8['exten']||'';this[_0x4d6a('0x1')]=_0x1967e8['recordingFormat']||_0x4d6a('0x2');this['mandatoryDisposition']=_0x1967e8[_0x4d6a('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x2e72=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0xbdc6ac,_0x13ba9e){var _0x3d8a54=function(_0x69655d){while(--_0x69655d){_0xbdc6ac['push'](_0xbdc6ac['shift']());}};_0x3d8a54(++_0x13ba9e);}(_0x2e72,0x68));var _0x22e7=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x2e72[_0x367336];return _0x3423a7;};'use strict';function voiceExtension(_0x272382){this['id']=_0x272382['id']||0x0;this[_0x22e7('0x0')]=_0x272382['exten']||'';this['recordingFormat']=_0x272382[_0x22e7('0x1')]||_0x22e7('0x2');this[_0x22e7('0x3')]=_0x272382['mandatoryDisposition']||![];}module[_0x22e7('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 41b0f22..95c92ca 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 _0xbbd7=['predictiveIntervalHitRate','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','sumDuration','sumHoldTime','unmanaged','abandoned','available','busy','inUse','invalid','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls'];(function(_0x1ae6b0,_0x3e96fe){var _0x28f52c=function(_0xfd3d52){while(--_0xfd3d52){_0x1ae6b0['push'](_0x1ae6b0['shift']());}};_0x28f52c(++_0x3e96fe);}(_0xbbd7,0x8c));var _0x7bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd7[_0x3dd15e];return _0x231fd0;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x7bbd('0x0'),'gsm':_0x7bbd('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':'linear','random':_0x7bbd('0x2'),'ringall':_0x7bbd('0x3'),'rr':_0x7bbd('0x4'),'rrmemory':_0x7bbd('0x5'),'rrordered':_0x7bbd('0x6'),'wrandom':_0x7bbd('0x7')};function VoiceQueue(_0x46e0a5){this['id']=_0x46e0a5['id']||0x0;this['name']=_0x46e0a5[_0x7bbd('0x8')]||'';this[_0x7bbd('0x9')]=_0x46e0a5[_0x7bbd('0x9')]||'';this[_0x7bbd('0xa')]=_0x46e0a5['type']||'inbound';this[_0x7bbd('0xb')]=0x0;this[_0x7bbd('0xc')]=0x0;this['answered']=0x0;this[_0x7bbd('0xd')]=0x0;this[_0x7bbd('0xe')]=0x0;this['sumBillable']=0x0;this[_0x7bbd('0xf')]=0x0;this[_0x7bbd('0x10')]=0x0;this[_0x7bbd('0x11')]=0x0;this[_0x7bbd('0x12')]=0x0;this[_0x7bbd('0x13')]=0x0;this[_0x7bbd('0x14')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0x7bbd('0x15')]=0x0;this[_0x7bbd('0x16')]=0x0;this[_0x7bbd('0x17')]=0x0;this[_0x7bbd('0x18')]=0x0;this[_0x7bbd('0x19')]=0x0;this[_0x7bbd('0x1a')]=0x0;this[_0x7bbd('0x1b')]=0x0;this[_0x7bbd('0x1c')]=_0x46e0a5['acw']||![];this[_0x7bbd('0x1d')]=_0x46e0a5[_0x7bbd('0x1d')]||0xa;this['autopause']=_0x46e0a5[_0x7bbd('0x1e')]||'no';this[_0x7bbd('0x1f')]=!![];this[_0x7bbd('0x20')]='';this[_0x7bbd('0x21')]='';this[_0x7bbd('0x22')]=0x0;this[_0x7bbd('0x23')]=0x0;this['dialTimezone']=_0x46e0a5[_0x7bbd('0x24')]||null;this[_0x7bbd('0x25')]=_0x46e0a5['dialGlobalInterval']?_0x46e0a5[_0x7bbd('0x25')]:null;this[_0x7bbd('0x26')]=_0x46e0a5[_0x7bbd('0x26')];this[_0x7bbd('0x27')]=_0x46e0a5[_0x7bbd('0x27')]||_0x7bbd('0x28');this[_0x7bbd('0x29')]=_0x46e0a5['dialLimitChannel']||0x0;this[_0x7bbd('0x2a')]=_0x46e0a5[_0x7bbd('0x2a')]||0x0;this[_0x7bbd('0x2b')]=_0x46e0a5[_0x7bbd('0x2b')]||0x1;this['dialPredictiveOptimization']=_0x46e0a5['dialPredictiveOptimization']||_0x7bbd('0x2c');this[_0x7bbd('0x2d')]=_0x46e0a5['dialPredictiveOptimizationPercentage']||0.03;this[_0x7bbd('0x2e')]=_0x46e0a5[_0x7bbd('0x2e')]||0x258;this[_0x7bbd('0x2f')]=_0x46e0a5[_0x7bbd('0x2f')]||_0x7bbd('0x30');this[_0x7bbd('0x31')]=_0x46e0a5[_0x7bbd('0x31')]||_0x7bbd('0x30');this['dialOriginateTimeout']=_0x46e0a5[_0x7bbd('0x32')]||0x1e;this[_0x7bbd('0x33')]=_0x46e0a5['dialQueueOptions']||_0x7bbd('0x34');this['dialQueueTimeout']=_0x46e0a5['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x46e0a5[_0x7bbd('0x35')]||undefined;this['dialCongestionMaxRetry']=_0x46e0a5['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x46e0a5[_0x7bbd('0x36')]||0x96;this[_0x7bbd('0x37')]=_0x46e0a5[_0x7bbd('0x37')]||0x3;this[_0x7bbd('0x38')]=_0x46e0a5[_0x7bbd('0x38')]||0x96;this[_0x7bbd('0x39')]=_0x46e0a5[_0x7bbd('0x39')]||0x3;this['dialNoAnswerRetryFrequency']=_0x46e0a5[_0x7bbd('0x3a')]||0x96;this[_0x7bbd('0x3b')]=_0x46e0a5[_0x7bbd('0x3b')]||0x3;this[_0x7bbd('0x3c')]=_0x46e0a5[_0x7bbd('0x3c')]||0x96;this[_0x7bbd('0x3d')]=_0x46e0a5['dialDropMaxRetry']||0x3;this[_0x7bbd('0x3e')]=_0x46e0a5['dialDropRetryFrequency']||0x96;this[_0x7bbd('0x3f')]=_0x46e0a5['dialAbandonedMaxRetry']||0x3;this[_0x7bbd('0x40')]=_0x46e0a5[_0x7bbd('0x40')]||0x96;this[_0x7bbd('0x41')]=_0x46e0a5[_0x7bbd('0x41')]||0x3;this['dialMachineRetryFrequency']=_0x46e0a5['dialMachineRetryFrequency']||0x96;this[_0x7bbd('0x42')]=_0x46e0a5[_0x7bbd('0x42')]||0x3;this[_0x7bbd('0x43')]=_0x46e0a5[_0x7bbd('0x43')]||0x96;this[_0x7bbd('0x44')]=_0x46e0a5[_0x7bbd('0x44')]||0x3;this[_0x7bbd('0x45')]=_0x46e0a5[_0x7bbd('0x45')]||0x4;this['Trunk']=_0x46e0a5['Trunk']?_0x46e0a5[_0x7bbd('0x46')]:undefined;this['TrunkBackup']=_0x46e0a5[_0x7bbd('0x47')]?_0x46e0a5[_0x7bbd('0x47')]:undefined;this[_0x7bbd('0x48')]=_0x46e0a5[_0x7bbd('0x48')]||undefined;this[_0x7bbd('0x49')]=_0x46e0a5[_0x7bbd('0x49')]?_0x46e0a5[_0x7bbd('0x49')]:undefined;this[_0x7bbd('0x4a')]=_0x46e0a5[_0x7bbd('0x4a')]||_0x7bbd('0x4b');this[_0x7bbd('0x4c')]=_0x46e0a5[_0x7bbd('0x4c')]||undefined;this[_0x7bbd('0x4d')]=_0x46e0a5['dialCutDigit']||undefined;this[_0x7bbd('0x4e')]=strategy[_0x46e0a5[_0x7bbd('0x4e')]];this[_0x7bbd('0x4f')]=!![];this[_0x7bbd('0x50')]=_0x46e0a5['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x46e0a5[_0x7bbd('0x51')];this['dialAMDGreeting']=_0x46e0a5['dialAMDGreeting'];this[_0x7bbd('0x52')]=_0x46e0a5[_0x7bbd('0x52')];this[_0x7bbd('0x53')]=_0x46e0a5['dialAMDTotalAnalysisTime'];this[_0x7bbd('0x54')]=_0x46e0a5[_0x7bbd('0x54')];this[_0x7bbd('0x55')]=_0x46e0a5[_0x7bbd('0x55')];this[_0x7bbd('0x56')]=_0x46e0a5['dialAMDMaximumNumberOfWords'];this[_0x7bbd('0x57')]=_0x46e0a5[_0x7bbd('0x57')];this[_0x7bbd('0x58')]=_0x46e0a5[_0x7bbd('0x58')];this['outboundRejectCallsDay']=0x0;this[_0x7bbd('0x59')]=0x0;this[_0x7bbd('0x5a')]=_0x46e0a5['timeout'];this[_0x7bbd('0x5b')]=0x0;this[_0x7bbd('0x5c')]=0x0;this[_0x7bbd('0x5d')]=0x0;this[_0x7bbd('0x5e')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x7bbd('0x5f')]=0x0;this[_0x7bbd('0x60')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x7bbd('0x61')]=0x0;this[_0x7bbd('0x62')]=0x0;this[_0x7bbd('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0x7bbd('0x64')]=0x0;this[_0x7bbd('0x65')]=undefined;this[_0x7bbd('0x66')]=undefined;this['handlePredictive']=undefined;this[_0x7bbd('0x67')]=1.05;this[_0x7bbd('0x68')]=0x0;this[_0x7bbd('0x69')]=0x0;this[_0x7bbd('0x6a')]=0x0;this[_0x7bbd('0x6b')]=0x0;this[_0x7bbd('0x6c')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x7bbd('0x6d')]=0x0;this[_0x7bbd('0x6e')]=0x0;this[_0x7bbd('0x6f')]=_0x46e0a5[_0x7bbd('0x70')]||0x14;this[_0x7bbd('0x71')]=_0x46e0a5['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x7bbd('0x72')]=0x0;this[_0x7bbd('0x73')]=0x0;this[_0x7bbd('0x74')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x7bbd('0x75')]=0x0;this[_0x7bbd('0x76')]=0x0;this[_0x7bbd('0x77')]=_0x46e0a5[_0x7bbd('0x77')]||0x1e;this['dialRecallInQueue']=_0x46e0a5['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x46e0a5[_0x7bbd('0x78')]||![];this[_0x7bbd('0x79')]=!!_0x46e0a5['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x46e0a5[_0x7bbd('0x7a')]||undefined;this['dialAgiAfterHangupClient']=_0x46e0a5['dialAgiAfterHangupClient']||![];this[_0x7bbd('0x7b')]=_0x46e0a5[_0x7bbd('0x7b')]||![];this['monitor_format']=monitorFormat[_0x46e0a5[_0x7bbd('0x9')]]?monitorFormat[_0x46e0a5[_0x7bbd('0x9')]]:undefined;this[_0x7bbd('0x7c')]=_0x46e0a5['mandatoryDisposition']||![];this[_0x7bbd('0x7d')]=_0x46e0a5[_0x7bbd('0x7d')]?_0x46e0a5[_0x7bbd('0x7d')]:undefined;this[_0x7bbd('0x7e')]=![];}module[_0x7bbd('0x7f')]=VoiceQueue; \ No newline at end of file +var _0x9de5=['TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','rrmemory','name','monitor_format','type','inbound','waiting','total','sumDuration','unmanaged','available','busy','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk'];(function(_0xf702fe,_0x344f7f){var _0x49fedb=function(_0xb05db6){while(--_0xb05db6){_0xf702fe['push'](_0xf702fe['shift']());}};_0x49fedb(++_0x344f7f);}(_0x9de5,0xbc));var _0x59de=function(_0x65d6f5,_0x10f5e5){_0x65d6f5=_0x65d6f5-0x0;var _0x584b98=_0x9de5[_0x65d6f5];return _0x584b98;};'use strict';var monitorFormat={'wav':_0x59de('0x0'),'wav49':_0x59de('0x1'),'gsm':_0x59de('0x2')};var strategy={'fewestcalls':_0x59de('0x3'),'leastrecent':_0x59de('0x4'),'linear':_0x59de('0x5'),'random':_0x59de('0x6'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x59de('0x7'),'rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x56f303){this['id']=_0x56f303['id']||0x0;this[_0x59de('0x8')]=_0x56f303['name']||'';this['monitor_format']=_0x56f303[_0x59de('0x9')]||'';this[_0x59de('0xa')]=_0x56f303[_0x59de('0xa')]||_0x59de('0xb');this[_0x59de('0xc')]=0x0;this[_0x59de('0xd')]=0x0;this['answered']=0x0;this[_0x59de('0xe')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x59de('0xf')]=0x0;this['abandoned']=0x0;this[_0x59de('0x10')]=0x0;this[_0x59de('0x11')]=0x0;this['inUse']=0x0;this[_0x59de('0x12')]=0x0;this[_0x59de('0x13')]=0x0;this[_0x59de('0x14')]=0x0;this[_0x59de('0x15')]=0x0;this[_0x59de('0x16')]=0x0;this[_0x59de('0x17')]=0x0;this[_0x59de('0x18')]=0x0;this[_0x59de('0x19')]=0x0;this[_0x59de('0x1a')]=0x0;this[_0x59de('0x1b')]=0x0;this[_0x59de('0x1c')]=_0x56f303['acw']||![];this[_0x59de('0x1d')]=_0x56f303[_0x59de('0x1d')]||0xa;this['autopause']=_0x56f303[_0x59de('0x1e')]||'no';this[_0x59de('0x1f')]=!![];this[_0x59de('0x20')]='';this[_0x59de('0x21')]='';this[_0x59de('0x22')]=0x0;this[_0x59de('0x23')]=0x0;this[_0x59de('0x24')]=_0x56f303[_0x59de('0x24')]||null;this[_0x59de('0x25')]=_0x56f303['dialGlobalInterval']?_0x56f303['dialGlobalInterval']:null;this['dialActive']=_0x56f303[_0x59de('0x26')];this[_0x59de('0x27')]=_0x56f303[_0x59de('0x27')]||'progressive';this[_0x59de('0x28')]=_0x56f303[_0x59de('0x28')]||0x0;this['dialLimitQueue']=_0x56f303[_0x59de('0x29')]||0x0;this[_0x59de('0x2a')]=_0x56f303['dialPowerLevel']||0x1;this[_0x59de('0x2b')]=_0x56f303['dialPredictiveOptimization']||_0x59de('0x2c');this[_0x59de('0x2d')]=_0x56f303['dialPredictiveOptimizationPercentage']||0.03;this[_0x59de('0x2e')]=_0x56f303[_0x59de('0x2e')]||0x258;this[_0x59de('0x2f')]=_0x56f303[_0x59de('0x2f')]||'anonymous';this[_0x59de('0x30')]=_0x56f303[_0x59de('0x30')]||_0x59de('0x31');this[_0x59de('0x32')]=_0x56f303['dialOriginateTimeout']||0x1e;this[_0x59de('0x33')]=_0x56f303['dialQueueOptions']||_0x59de('0x34');this[_0x59de('0x35')]=_0x56f303[_0x59de('0x35')]||0x3;this['dialQueueProject']=_0x56f303[_0x59de('0x36')]||undefined;this[_0x59de('0x37')]=_0x56f303[_0x59de('0x37')]||0x3;this[_0x59de('0x38')]=_0x56f303[_0x59de('0x38')]||0x96;this[_0x59de('0x39')]=_0x56f303[_0x59de('0x39')]||0x3;this['dialBusyRetryFrequency']=_0x56f303['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x56f303[_0x59de('0x3a')]||0x3;this[_0x59de('0x3b')]=_0x56f303['dialNoAnswerRetryFrequency']||0x96;this[_0x59de('0x3c')]=_0x56f303[_0x59de('0x3c')]||0x3;this[_0x59de('0x3d')]=_0x56f303[_0x59de('0x3d')]||0x96;this[_0x59de('0x3e')]=_0x56f303['dialDropMaxRetry']||0x3;this[_0x59de('0x3f')]=_0x56f303[_0x59de('0x3f')]||0x96;this[_0x59de('0x40')]=_0x56f303['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x56f303['dialAbandonedRetryFrequency']||0x96;this[_0x59de('0x41')]=_0x56f303[_0x59de('0x41')]||0x3;this[_0x59de('0x42')]=_0x56f303[_0x59de('0x42')]||0x96;this[_0x59de('0x43')]=_0x56f303['dialAgentRejectMaxRetry']||0x3;this[_0x59de('0x44')]=_0x56f303['dialAgentRejectRetryFrequency']||0x96;this[_0x59de('0x45')]=_0x56f303['callAdditionalPhoneAfterMin']||0x3;this[_0x59de('0x46')]=_0x56f303[_0x59de('0x46')]||0x4;this['Trunk']=_0x56f303['Trunk']?_0x56f303[_0x59de('0x47')]:undefined;this[_0x59de('0x48')]=_0x56f303[_0x59de('0x48')]?_0x56f303[_0x59de('0x48')]:undefined;this[_0x59de('0x49')]=_0x56f303[_0x59de('0x49')]||undefined;this[_0x59de('0x4a')]=_0x56f303[_0x59de('0x4a')]?_0x56f303[_0x59de('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x56f303['dialOrderByScheduledAt']||_0x59de('0x4b');this[_0x59de('0x4c')]=_0x56f303[_0x59de('0x4c')]||undefined;this[_0x59de('0x4d')]=_0x56f303['dialCutDigit']||undefined;this['strategy']=strategy[_0x56f303[_0x59de('0x4e')]];this[_0x59de('0x4f')]=!![];this['dialAMDActive']=_0x56f303[_0x59de('0x50')]||![];this[_0x59de('0x51')]=_0x56f303[_0x59de('0x51')];this['dialAMDGreeting']=_0x56f303[_0x59de('0x52')];this[_0x59de('0x53')]=_0x56f303[_0x59de('0x53')];this[_0x59de('0x54')]=_0x56f303['dialAMDTotalAnalysisTime'];this[_0x59de('0x55')]=_0x56f303[_0x59de('0x55')];this['dialAMDBetweenWordsSilence']=_0x56f303['dialAMDBetweenWordsSilence'];this[_0x59de('0x56')]=_0x56f303[_0x59de('0x56')];this['dialAMDSilenceThreshold']=_0x56f303[_0x59de('0x57')];this[_0x59de('0x58')]=_0x56f303[_0x59de('0x58')];this[_0x59de('0x59')]=0x0;this['pTalking']=0x0;this[_0x59de('0x5a')]=_0x56f303[_0x59de('0x5a')];this[_0x59de('0x5b')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x59de('0x5c')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x59de('0x5d')]=0x0;this[_0x59de('0x5e')]=0x0;this[_0x59de('0x5f')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x59de('0x60')]=0x0;this[_0x59de('0x61')]=0x0;this[_0x59de('0x62')]=0x0;this[_0x59de('0x63')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x59de('0x64')]=undefined;this[_0x59de('0x65')]=undefined;this[_0x59de('0x66')]=undefined;this[_0x59de('0x67')]=1.05;this[_0x59de('0x68')]=0x0;this[_0x59de('0x69')]=0x0;this[_0x59de('0x6a')]=0x0;this[_0x59de('0x6b')]=0x0;this[_0x59de('0x6c')]=0x0;this[_0x59de('0x6d')]=0x0;this[_0x59de('0x6e')]=0x0;this[_0x59de('0x6f')]=0x0;this[_0x59de('0x70')]=_0x56f303['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x59de('0x71')]=_0x56f303[_0x59de('0x72')]||0xa;this[_0x59de('0x73')]=0x0;this[_0x59de('0x74')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x59de('0x75')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x59de('0x76')]=0x0;this[_0x59de('0x77')]=_0x56f303[_0x59de('0x77')]||0x1e;this[_0x59de('0x78')]=_0x56f303[_0x59de('0x78')]||![];this[_0x59de('0x79')]=!!_0x56f303['dialPreviewAutoRecallMe']||![];this[_0x59de('0x7a')]=!!_0x56f303[_0x59de('0x7a')]||![];this[_0x59de('0x7b')]=_0x56f303['dialQueueProject2']||undefined;this[_0x59de('0x7c')]=_0x56f303[_0x59de('0x7c')]||![];this[_0x59de('0x7d')]=_0x56f303[_0x59de('0x7d')]||![];this[_0x59de('0x9')]=monitorFormat[_0x56f303[_0x59de('0x9')]]?monitorFormat[_0x56f303[_0x59de('0x9')]]:undefined;this[_0x59de('0x7e')]=_0x56f303[_0x59de('0x7e')]||![];this[_0x59de('0x7f')]=_0x56f303[_0x59de('0x7f')]?_0x56f303['mandatoryDispositionPause']:undefined;this[_0x59de('0x80')]=![];}module[_0x59de('0x81')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 2f66afa..1525f05 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 _0x0c29=['compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','exports','loggedInDb','ringing','talking','waiting','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','available','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','message','statusMessage','Trunk','callerid','createReport','loggedin','callers','length','SIP/','online','includes','status','booked','keys','exten','xcally-motion-preview','prototype'];(function(_0x5a326d,_0x483bc6){var _0x1742df=function(_0x1162cf){while(--_0x1162cf){_0x5a326d['push'](_0x5a326d['shift']());}};_0x1742df(++_0x483bc6);}(_0x0c29,0xb7));var _0x90c2=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x0c29[_0xbc346f];return _0x9f9260;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0x90c2('0x0'),'paused',_0x90c2('0x1'),_0x90c2('0x2'),_0x90c2('0x3')];var OUTBOUND_COUNTERS=['available','answered',_0x90c2('0x4'),_0x90c2('0x5'),_0x90c2('0x0'),_0x90c2('0x6'),_0x90c2('0x7'),_0x90c2('0x8'),_0x90c2('0x9'),_0x90c2('0xa'),_0x90c2('0xb'),_0x90c2('0xc'),_0x90c2('0xd'),_0x90c2('0xe'),_0x90c2('0xf'),_0x90c2('0x10'),_0x90c2('0x11'),_0x90c2('0x12'),_0x90c2('0x2'),_0x90c2('0x13'),_0x90c2('0x14'),_0x90c2('0x15'),'waiting'];function VoiceQueueSummary(_0x497701){this['id']=_0x497701['id'];this[_0x90c2('0x16')]=_0x497701['name'];this[_0x90c2('0x17')]=_0x497701[_0x90c2('0x17')];this[_0x90c2('0x18')]=_0x497701[_0x90c2('0x18')]||0x0;this[_0x90c2('0x19')]=_0x497701[_0x90c2('0x19')]||0x0;this[_0x90c2('0x1a')]=_0x497701['available']||0x0;this[_0x90c2('0x1b')]=_0x497701[_0x90c2('0x1b')]||0x0;this[_0x90c2('0x4')]=_0x497701[_0x90c2('0x4')]||0x0;this['invalid']=_0x497701[_0x90c2('0x1c')]||0x0;this['loggedIn']=_0x497701[_0x90c2('0x5')]||0x0;this[_0x90c2('0x0')]=_0x497701[_0x90c2('0x0')]||0x0;this[_0x90c2('0x1d')]=_0x497701['onHold']||0x0;this[_0x90c2('0x1e')]=_0x497701[_0x90c2('0x1e')]||0x0;this['paused']=_0x497701[_0x90c2('0x11')]||0x0;this[_0x90c2('0x1')]=_0x497701['ringing']||0x0;this[_0x90c2('0x1f')]=_0x497701[_0x90c2('0x1f')];this[_0x90c2('0x13')]=_0x497701['sumBillable'];this[_0x90c2('0x14')]=_0x497701[_0x90c2('0x14')];this[_0x90c2('0x20')]=_0x497701[_0x90c2('0x20')]||0x0;this['talking']=_0x497701['talking']||0x0;this[_0x90c2('0x15')]=_0x497701[_0x90c2('0x15')]||0x0;this[_0x90c2('0x21')]=_0x497701[_0x90c2('0x21')];this[_0x90c2('0x22')]=_0x497701[_0x90c2('0x22')]||0x0;this[_0x90c2('0x23')]=_0x497701[_0x90c2('0x23')]||0x0;this['unmanaged']=_0x497701['unmanaged']||0x0;this['waiting']=_0x497701[_0x90c2('0x3')]||0x0;if(_0x497701[_0x90c2('0x21')]===_0x90c2('0x24')){this[_0x90c2('0x12')]=_0x497701[_0x90c2('0x12')]||0x0;this[_0x90c2('0x25')]=_0x497701[_0x90c2('0x25')];this[_0x90c2('0x26')]=_0x497701['dialMethod'];this[_0x90c2('0x27')]=_0x497701['dialOriginateCallerIdName'];this[_0x90c2('0x28')]=_0x497701[_0x90c2('0x28')];this[_0x90c2('0x29')]=_0x497701[_0x90c2('0x29')];this['dialPrefix']=_0x497701[_0x90c2('0x2a')];this[_0x90c2('0x2b')]=_0x497701['temp'];this[_0x90c2('0x2c')]=_0x497701[_0x90c2('0x2c')];this[_0x90c2('0x8')]=_0x497701[_0x90c2('0x8')];this['outboundBlacklistCallsDay']=_0x497701[_0x90c2('0x9')];this[_0x90c2('0xa')]=_0x497701['outboundBusyCallsDay'];this[_0x90c2('0xb')]=_0x497701[_0x90c2('0xb')];this[_0x90c2('0x2d')]=_0x497701[_0x90c2('0x2d')];this['outboundDropCallsDayCallersExit']=_0x497701[_0x90c2('0x2e')];this[_0x90c2('0x2f')]=_0x497701[_0x90c2('0x2f')];this['outboundNoAnswerCallsDay']=_0x497701['outboundNoAnswerCallsDay'];this[_0x90c2('0xd')]=_0x497701['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x497701[_0x90c2('0x30')];this[_0x90c2('0xe')]=_0x497701[_0x90c2('0xe')];this[_0x90c2('0xf')]=_0x497701[_0x90c2('0xf')];this[_0x90c2('0x10')]=_0x497701[_0x90c2('0x10')];this[_0x90c2('0x31')]=_0x497701['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x497701[_0x90c2('0x32')];this[_0x90c2('0x33')]=_0x497701[_0x90c2('0x33')];this[_0x90c2('0x34')]=_0x497701['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x497701['predictiveIntervalDroppedCallsTimeout'];this[_0x90c2('0x35')]=_0x497701[_0x90c2('0x35')];this[_0x90c2('0x36')]=_0x497701[_0x90c2('0x36')];this[_0x90c2('0x37')]=_0x497701[_0x90c2('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x497701['predictiveIntervalMultiplicativeFactor'];this[_0x90c2('0x38')]=_0x497701[_0x90c2('0x38')];this['predictiveIntervalAvailable']=_0x497701[_0x90c2('0x39')];this[_0x90c2('0x3a')]=_0x497701[_0x90c2('0x3a')];this['originated']=_0x497701['originated'];this[_0x90c2('0x3b')]=_0x497701['erlangCalls'];this[_0x90c2('0x3c')]=_0x497701['erlangCallToSecond'];this[_0x90c2('0x3d')]=_0x497701['erlangAbandonmentRate'];this[_0x90c2('0x3e')]=_0x497701[_0x90c2('0x3e')];this[_0x90c2('0x3f')]=_0x497701[_0x90c2('0x3f')];this['startProgressive']=_0x497701['startProgressive'];this[_0x90c2('0x40')]=_0x497701['message'];this[_0x90c2('0x41')]=_0x497701['statusMessage'];}if(_0x497701[_0x90c2('0x42')]){this[_0x90c2('0x42')]={'id':_0x497701['Trunk']['id'],'name':_0x497701[_0x90c2('0x42')][_0x90c2('0x16')],'active':_0x497701[_0x90c2('0x42')]['active'],'callerid':_0x497701[_0x90c2('0x42')][_0x90c2('0x43')]};}}VoiceQueueSummary['prototype'][_0x90c2('0x44')]=function(_0x659d99,_0x172cec,_0x2d278b,_0x16b090){this['loggedInDb']=0x0;this[_0x90c2('0x2')]=0x0;this['paused']=0x0;this[_0x90c2('0x23')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0x90c2('0x1b')]=0x0;this[_0x90c2('0x1c')]=0x0;this[_0x90c2('0x22')]=0x0;this[_0x90c2('0x1')]=0x0;this[_0x90c2('0x1f')]=0x0;this[_0x90c2('0x1d')]=0x0;if(_0x2d278b){if(_0x2d278b[_0x90c2('0x1a')]){this[_0x90c2('0x1a')]=Number(_0x2d278b[_0x90c2('0x1a')]);}if(_0x2d278b['loggedin']){this[_0x90c2('0x5')]=Number(_0x2d278b[_0x90c2('0x45')]);}if(_0x2d278b['callers']){this[_0x90c2('0x3')]=Number(_0x2d278b[_0x90c2('0x46')]);}}for(var _0x176188=0x0;_0x176188<_0x659d99[_0x90c2('0x47')];_0x176188++){var _0x34d4d7=_0x172cec[_0x90c2('0x48')+_0x659d99[_0x176188][_0x90c2('0x16')]];if(_0x34d4d7&&_0x34d4d7[_0x90c2('0x49')]){this[_0x90c2('0x0')]+=0x1;}if(_0x659d99[_0x176188]['incall']==='1'){this[_0x90c2('0x2')]+=0x1;}if(_0x659d99[_0x176188]['paused']==='1'&&!['2','7','8'][_0x90c2('0x4a')](_0x659d99[_0x176188][_0x90c2('0x4b')])){this[_0x90c2('0x11')]+=0x1;}switch(_0x659d99[_0x176188][_0x90c2('0x4b')]){case'0':this[_0x90c2('0x23')]+=0x1;break;case'1':this[_0x90c2('0x1e')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x90c2('0x1b')]+=0x1;break;case'4':this[_0x90c2('0x1c')]+=0x1;break;case'5':this[_0x90c2('0x22')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x90c2('0x1f')]+=0x1;break;case'8':this[_0x90c2('0x1d')]+=0x1;break;}}if(this[_0x90c2('0x26')]===_0x90c2('0x4c')){var _0x418f36=Object[_0x90c2('0x4d')](_0x16b090);for(var _0x4c3ea9=0x0;_0x4c3ea9<_0x418f36[_0x90c2('0x47')];_0x4c3ea9++){var _0x3d5031=_0x418f36[_0x4c3ea9];var _0x2669f1=_0x16b090[_0x3d5031];if(_0x2669f1['queue']===this[_0x90c2('0x16')]&&_0x2669f1[_0x90c2('0x21')]==='dialer'&&_0x2669f1[_0x90c2('0x4e')]===_0x90c2('0x4f')){this[_0x90c2('0x2')]+=0x1;}}if(this['talking']>this[_0x90c2('0x4')]){this[_0x90c2('0x2')]=this['inUse'];}this[_0x90c2('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x90c2('0x50')][_0x90c2('0x51')]=function(_0xd0c664){var _0x464e72=![];if(_0xd0c664){_0x464e72=INBOUND_COUNTERS[_0x90c2('0x52')](function(_0x5cddc9){return this[_0x5cddc9]!==_0xd0c664[_0x5cddc9];},this);}return _0x464e72;};VoiceQueueSummary[_0x90c2('0x50')][_0x90c2('0x53')]=function(_0x1ea4ee){var _0x4f9f44=![];var _0x16beab=![];var _0x516843=![];if(_0x1ea4ee){_0x4f9f44=this[_0x90c2('0x26')]!==_0x1ea4ee[_0x90c2('0x26')]||this['dialActive']!==_0x1ea4ee['dialActive']||this['message']!==_0x1ea4ee[_0x90c2('0x40')]||this[_0x90c2('0x41')]!==_0x1ea4ee[_0x90c2('0x41')];_0x16beab=OUTBOUND_COUNTERS[_0x90c2('0x52')](function(_0x389adf){return this[_0x389adf]!==_0x1ea4ee[_0x389adf];},this);if(this[_0x90c2('0x42')]&&_0x1ea4ee[_0x90c2('0x42')]){_0x516843=this[_0x90c2('0x42')][_0x90c2('0x16')]!==_0x1ea4ee[_0x90c2('0x42')][_0x90c2('0x16')]||this['Trunk'][_0x90c2('0x54')]!==_0x1ea4ee[_0x90c2('0x42')][_0x90c2('0x54')];}}return _0x4f9f44||_0x16beab||_0x516843;};VoiceQueueSummary[_0x90c2('0x50')][_0x90c2('0x55')]=function(_0x1bf5a9){this[_0x90c2('0x19')]=_0x1bf5a9[_0x90c2('0x19')];this[_0x90c2('0x40')]=_0x1bf5a9[_0x90c2('0x40')];this[_0x90c2('0x41')]=_0x1bf5a9[_0x90c2('0x41')];this[_0x90c2('0x6')]=_0x1bf5a9[_0x90c2('0x6')];this[_0x90c2('0x7')]=_0x1bf5a9[_0x90c2('0x7')];this['outboundAnswerCallsDay']=_0x1bf5a9['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x1bf5a9[_0x90c2('0x9')];this[_0x90c2('0xa')]=_0x1bf5a9['outboundBusyCallsDay'];this[_0x90c2('0xb')]=_0x1bf5a9[_0x90c2('0xb')];this[_0x90c2('0xc')]=_0x1bf5a9[_0x90c2('0xc')];this[_0x90c2('0xd')]=_0x1bf5a9[_0x90c2('0xd')];this['outboundReCallsDay']=_0x1bf5a9['outboundReCallsDay'];this[_0x90c2('0xf')]=_0x1bf5a9[_0x90c2('0xf')];this[_0x90c2('0x10')]=_0x1bf5a9['outboundUnknownCallsDay'];this[_0x90c2('0x13')]=_0x1bf5a9[_0x90c2('0x13')];this[_0x90c2('0x14')]=_0x1bf5a9[_0x90c2('0x14')];this[_0x90c2('0x15')]=_0x1bf5a9[_0x90c2('0x15')];if(this['dialMethod']===_0x90c2('0x56')){this['pTalking']=_0x1bf5a9[_0x90c2('0x12')];}};module[_0x90c2('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x93bb=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','online','incall','includes','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','total','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay'];(function(_0x53fb21,_0x236fa9){var _0x297d42=function(_0x59ded3){while(--_0x59ded3){_0x53fb21['push'](_0x53fb21['shift']());}};_0x297d42(++_0x236fa9);}(_0x93bb,0x135));var _0xb93b=function(_0x420114,_0x425531){_0x420114=_0x420114-0x0;var _0x4d7672=_0x93bb[_0x420114];return _0x4d7672;};'use strict';var INBOUND_COUNTERS=[_0xb93b('0x0'),_0xb93b('0x1'),_0xb93b('0x2'),_0xb93b('0x3'),_0xb93b('0x4'),_0xb93b('0x5'),_0xb93b('0x6')];var OUTBOUND_COUNTERS=[_0xb93b('0x0'),_0xb93b('0x7'),_0xb93b('0x8'),'loggedIn',_0xb93b('0x2'),_0xb93b('0x9'),'outboundAbandonedCallsDay',_0xb93b('0xa'),_0xb93b('0xb'),'outboundBusyCallsDay',_0xb93b('0xc'),_0xb93b('0xd'),_0xb93b('0xe'),_0xb93b('0xf'),_0xb93b('0x10'),_0xb93b('0x11'),_0xb93b('0x3'),_0xb93b('0x12'),_0xb93b('0x5'),_0xb93b('0x13'),_0xb93b('0x14'),'total',_0xb93b('0x6')];function VoiceQueueSummary(_0xc5385a){this['id']=_0xc5385a['id'];this[_0xb93b('0x15')]=_0xc5385a[_0xb93b('0x15')];this['strategy']=_0xc5385a[_0xb93b('0x16')];this[_0xb93b('0x17')]=_0xc5385a[_0xb93b('0x17')]||0x0;this[_0xb93b('0x7')]=_0xc5385a[_0xb93b('0x7')]||0x0;this[_0xb93b('0x0')]=_0xc5385a[_0xb93b('0x0')]||0x0;this['busy']=_0xc5385a[_0xb93b('0x18')]||0x0;this[_0xb93b('0x8')]=_0xc5385a[_0xb93b('0x8')]||0x0;this[_0xb93b('0x19')]=_0xc5385a[_0xb93b('0x19')]||0x0;this[_0xb93b('0x1')]=_0xc5385a['loggedIn']||0x0;this[_0xb93b('0x2')]=_0xc5385a['loggedInDb']||0x0;this[_0xb93b('0x1a')]=_0xc5385a[_0xb93b('0x1a')]||0x0;this[_0xb93b('0x1b')]=_0xc5385a[_0xb93b('0x1b')]||0x0;this[_0xb93b('0x3')]=_0xc5385a[_0xb93b('0x3')]||0x0;this['ringing']=_0xc5385a[_0xb93b('0x4')]||0x0;this[_0xb93b('0x1c')]=_0xc5385a[_0xb93b('0x1c')];this[_0xb93b('0x13')]=_0xc5385a[_0xb93b('0x13')];this[_0xb93b('0x14')]=_0xc5385a['sumDuration'];this['sumHoldTime']=_0xc5385a['sumHoldTime']||0x0;this['talking']=_0xc5385a[_0xb93b('0x5')]||0x0;this['total']=_0xc5385a['total']||0x0;this[_0xb93b('0x1d')]=_0xc5385a[_0xb93b('0x1d')];this[_0xb93b('0x1e')]=_0xc5385a['unavailable']||0x0;this[_0xb93b('0x1f')]=_0xc5385a[_0xb93b('0x1f')]||0x0;this['unmanaged']=_0xc5385a[_0xb93b('0x20')]||0x0;this[_0xb93b('0x6')]=_0xc5385a[_0xb93b('0x6')]||0x0;if(_0xc5385a[_0xb93b('0x1d')]===_0xb93b('0x21')){this[_0xb93b('0x12')]=_0xc5385a['pTalking']||0x0;this[_0xb93b('0x22')]=_0xc5385a[_0xb93b('0x22')];this[_0xb93b('0x23')]=_0xc5385a[_0xb93b('0x23')];this['dialOriginateCallerIdName']=_0xc5385a[_0xb93b('0x24')];this[_0xb93b('0x25')]=_0xc5385a[_0xb93b('0x25')];this[_0xb93b('0x26')]=_0xc5385a[_0xb93b('0x26')];this[_0xb93b('0x27')]=_0xc5385a[_0xb93b('0x27')];this['temp']=_0xc5385a[_0xb93b('0x28')];this['outboundAnswerAgiCallsDay']=_0xc5385a[_0xb93b('0x29')];this[_0xb93b('0xa')]=_0xc5385a[_0xb93b('0xa')];this[_0xb93b('0xb')]=_0xc5385a[_0xb93b('0xb')];this[_0xb93b('0x2a')]=_0xc5385a[_0xb93b('0x2a')];this[_0xb93b('0xc')]=_0xc5385a[_0xb93b('0xc')];this['outboundDropCallsDayACS']=_0xc5385a['outboundDropCallsDayACS'];this[_0xb93b('0x2b')]=_0xc5385a[_0xb93b('0x2b')];this[_0xb93b('0x2c')]=_0xc5385a['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0xc5385a[_0xb93b('0xd')];this[_0xb93b('0xe')]=_0xc5385a[_0xb93b('0xe')];this['outboundOriginateFailureCallsDay']=_0xc5385a['outboundOriginateFailureCallsDay'];this[_0xb93b('0xf')]=_0xc5385a[_0xb93b('0xf')];this[_0xb93b('0x10')]=_0xc5385a[_0xb93b('0x10')];this[_0xb93b('0x11')]=_0xc5385a[_0xb93b('0x11')];this[_0xb93b('0x2d')]=_0xc5385a['predictiveIntervalAnsweredCalls'];this[_0xb93b('0x2e')]=_0xc5385a[_0xb93b('0x2e')];this[_0xb93b('0x2f')]=_0xc5385a[_0xb93b('0x2f')];this[_0xb93b('0x30')]=_0xc5385a[_0xb93b('0x30')];this[_0xb93b('0x31')]=_0xc5385a['predictiveIntervalDroppedCallsTimeout'];this[_0xb93b('0x32')]=_0xc5385a[_0xb93b('0x32')];this[_0xb93b('0x33')]=_0xc5385a[_0xb93b('0x33')];this[_0xb93b('0x34')]=_0xc5385a[_0xb93b('0x34')];this[_0xb93b('0x35')]=_0xc5385a['predictiveIntervalMultiplicativeFactor'];this[_0xb93b('0x36')]=_0xc5385a[_0xb93b('0x36')];this[_0xb93b('0x37')]=_0xc5385a[_0xb93b('0x37')];this[_0xb93b('0x38')]=_0xc5385a[_0xb93b('0x38')];this[_0xb93b('0x9')]=_0xc5385a[_0xb93b('0x9')];this[_0xb93b('0x39')]=_0xc5385a[_0xb93b('0x39')];this[_0xb93b('0x3a')]=_0xc5385a[_0xb93b('0x3a')];this[_0xb93b('0x3b')]=_0xc5385a[_0xb93b('0x3b')];this['erlangBusyFactor']=_0xc5385a[_0xb93b('0x3c')];this[_0xb93b('0x3d')]=_0xc5385a['startPredictive'];this[_0xb93b('0x3e')]=_0xc5385a[_0xb93b('0x3e')];this[_0xb93b('0x3f')]=_0xc5385a[_0xb93b('0x3f')];this[_0xb93b('0x40')]=_0xc5385a[_0xb93b('0x40')];}if(_0xc5385a['Trunk']){this[_0xb93b('0x41')]={'id':_0xc5385a[_0xb93b('0x41')]['id'],'name':_0xc5385a[_0xb93b('0x41')][_0xb93b('0x15')],'active':_0xc5385a['Trunk']['active'],'callerid':_0xc5385a[_0xb93b('0x41')][_0xb93b('0x42')]};}}VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x44')]=function(_0x53aaaa,_0x3396d7,_0x4b7f03,_0x14cea3){this['loggedInDb']=0x0;this[_0xb93b('0x5')]=0x0;this[_0xb93b('0x3')]=0x0;this[_0xb93b('0x1f')]=0x0;this[_0xb93b('0x1b')]=0x0;this[_0xb93b('0x8')]=0x0;this[_0xb93b('0x18')]=0x0;this[_0xb93b('0x19')]=0x0;this['unavailable']=0x0;this[_0xb93b('0x4')]=0x0;this['ringInUse']=0x0;this[_0xb93b('0x1a')]=0x0;if(_0x4b7f03){if(_0x4b7f03['available']){this['available']=Number(_0x4b7f03[_0xb93b('0x0')]);}if(_0x4b7f03[_0xb93b('0x45')]){this[_0xb93b('0x1')]=Number(_0x4b7f03[_0xb93b('0x45')]);}if(_0x4b7f03[_0xb93b('0x46')]){this['waiting']=Number(_0x4b7f03['callers']);}}for(var _0x321fb0=0x0;_0x321fb0<_0x53aaaa[_0xb93b('0x47')];_0x321fb0++){var _0x1a5560=_0x3396d7['SIP/'+_0x53aaaa[_0x321fb0][_0xb93b('0x15')]];if(_0x1a5560&&_0x1a5560[_0xb93b('0x48')]){this['loggedInDb']+=0x1;}if(_0x53aaaa[_0x321fb0][_0xb93b('0x49')]==='1'){this[_0xb93b('0x5')]+=0x1;}if(_0x53aaaa[_0x321fb0][_0xb93b('0x3')]==='1'&&!['2','7','8'][_0xb93b('0x4a')](_0x53aaaa[_0x321fb0]['status'])){this[_0xb93b('0x3')]+=0x1;}switch(_0x53aaaa[_0x321fb0][_0xb93b('0x4b')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xb93b('0x1b')]+=0x1;break;case'2':this[_0xb93b('0x8')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xb93b('0x1e')]+=0x1;break;case'6':this[_0xb93b('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xb93b('0x1a')]+=0x1;break;}}if(this[_0xb93b('0x23')]===_0xb93b('0x4c')){var _0x2f62be=Object[_0xb93b('0x4d')](_0x14cea3);for(var _0x2b47d4=0x0;_0x2b47d4<_0x2f62be['length'];_0x2b47d4++){var _0x15bd64=_0x2f62be[_0x2b47d4];var _0x456702=_0x14cea3[_0x15bd64];if(_0x456702['queue']===this[_0xb93b('0x15')]&&_0x456702['type']===_0xb93b('0x4e')&&_0x456702[_0xb93b('0x4f')]===_0xb93b('0x50')){this[_0xb93b('0x5')]+=0x1;}}if(this[_0xb93b('0x5')]>this['inUse']){this['talking']=this[_0xb93b('0x8')];}this[_0xb93b('0x12')]=0x0;}return this;};VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x51')]=function(_0x1e667e){var _0x3ae118=![];if(_0x1e667e){_0x3ae118=INBOUND_COUNTERS[_0xb93b('0x52')](function(_0x49797b){return this[_0x49797b]!==_0x1e667e[_0x49797b];},this);}return _0x3ae118;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x88c27e){var _0x4b60bf=![];var _0x56cc48=![];var _0x53cf62=![];if(_0x88c27e){_0x4b60bf=this[_0xb93b('0x23')]!==_0x88c27e[_0xb93b('0x23')]||this[_0xb93b('0x22')]!==_0x88c27e[_0xb93b('0x22')]||this['message']!==_0x88c27e['message']||this[_0xb93b('0x40')]!==_0x88c27e[_0xb93b('0x40')];_0x56cc48=OUTBOUND_COUNTERS[_0xb93b('0x52')](function(_0x1dcfba){return this[_0x1dcfba]!==_0x88c27e[_0x1dcfba];},this);if(this[_0xb93b('0x41')]&&_0x88c27e[_0xb93b('0x41')]){_0x53cf62=this['Trunk'][_0xb93b('0x15')]!==_0x88c27e[_0xb93b('0x41')]['name']||this['Trunk']['active']!==_0x88c27e[_0xb93b('0x41')][_0xb93b('0x53')];}}return _0x4b60bf||_0x56cc48||_0x53cf62;};VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x54')]=function(_0x1b3976){this['answered']=_0x1b3976[_0xb93b('0x7')];this[_0xb93b('0x3f')]=_0x1b3976[_0xb93b('0x3f')];this['statusMessage']=_0x1b3976[_0xb93b('0x40')];this[_0xb93b('0x9')]=_0x1b3976[_0xb93b('0x9')];this['outboundAbandonedCallsDay']=_0x1b3976['outboundAbandonedCallsDay'];this[_0xb93b('0xa')]=_0x1b3976[_0xb93b('0xa')];this[_0xb93b('0xb')]=_0x1b3976[_0xb93b('0xb')];this[_0xb93b('0x2a')]=_0x1b3976['outboundBusyCallsDay'];this[_0xb93b('0xc')]=_0x1b3976[_0xb93b('0xc')];this[_0xb93b('0xd')]=_0x1b3976[_0xb93b('0xd')];this['outboundNoSuchCallsDay']=_0x1b3976[_0xb93b('0xe')];this[_0xb93b('0xf')]=_0x1b3976['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x1b3976[_0xb93b('0x10')];this['outboundUnknownCallsDay']=_0x1b3976[_0xb93b('0x11')];this[_0xb93b('0x13')]=_0x1b3976[_0xb93b('0x13')];this[_0xb93b('0x14')]=_0x1b3976['sumDuration'];this[_0xb93b('0x55')]=_0x1b3976[_0xb93b('0x55')];if(this[_0xb93b('0x23')]===_0xb93b('0x56')){this[_0xb93b('0x12')]=_0x1b3976[_0xb93b('0x12')];}};module[_0xb93b('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 1989834..2045069 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 _0x8836=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x536499,_0x63aee1){var _0x57d6e9=function(_0x430cb1){while(--_0x430cb1){_0x536499['push'](_0x536499['shift']());}};_0x57d6e9(++_0x63aee1);}(_0x8836,0xc8));var _0x6883=function(_0x140f54,_0x4c9a84){_0x140f54=_0x140f54-0x0;var _0x25f11d=_0x8836[_0x140f54];return _0x25f11d;};'use strict';function VtigerAccount(_0x256d00){this['id']=_0x256d00['id']||0x0;this[_0x6883('0x0')]=_0x256d00['name']||'';this[_0x6883('0x1')]=_0x256d00[_0x6883('0x1')]||'';this[_0x6883('0x2')]=_0x256d00[_0x6883('0x2')]||'';this[_0x6883('0x3')]=_0x256d00['remoteUri']||'';this[_0x6883('0x4')]=_0x256d00[_0x6883('0x4')]||'';this[_0x6883('0x5')]=_0x256d00[_0x6883('0x5')]||{};}module[_0x6883('0x6')]=VtigerAccount; \ No newline at end of file +var _0x9fb1=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x485b12,_0x1a4c55){var _0x3891de=function(_0x21d39e){while(--_0x21d39e){_0x485b12['push'](_0x485b12['shift']());}};_0x3891de(++_0x1a4c55);}(_0x9fb1,0xe6));var _0x19fb=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x9fb1[_0x1da04e];return _0xdd8c41;};'use strict';function VtigerAccount(_0x293adf){this['id']=_0x293adf['id']||0x0;this[_0x19fb('0x0')]=_0x293adf[_0x19fb('0x0')]||'';this[_0x19fb('0x1')]=_0x293adf[_0x19fb('0x1')]||'';this[_0x19fb('0x2')]=_0x293adf[_0x19fb('0x2')]||'';this[_0x19fb('0x3')]=_0x293adf[_0x19fb('0x3')]||'';this['serverUrl']=_0x293adf[_0x19fb('0x4')]||'';this[_0x19fb('0x5')]=_0x293adf[_0x19fb('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6239d91..b5b14bc 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 _0xcd5c=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcd5c,0xe0));var _0xccd5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcd5c[_0x122ef9];return _0x42fba0;};'use strict';function ZendeskAccount(_0x44077){this['id']=_0x44077['id']||0x0;this[_0xccd5('0x0')]=_0x44077['name']||'';this[_0xccd5('0x1')]=_0x44077[_0xccd5('0x1')]||'';this[_0xccd5('0x2')]=_0x44077[_0xccd5('0x2')]||'';this[_0xccd5('0x3')]=_0x44077[_0xccd5('0x3')]||'';this[_0xccd5('0x4')]=_0x44077[_0xccd5('0x4')]||'';this[_0xccd5('0x5')]=_0x44077[_0xccd5('0x5')]||'';this[_0xccd5('0x6')]=_0x44077[_0xccd5('0x6')]||_0xccd5('0x7');this['serverUrl']=_0x44077[_0xccd5('0x8')]||'';this[_0xccd5('0x9')]=_0x44077[_0xccd5('0x9')]||{};}module[_0xccd5('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x035f=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x035f,0x9f));var _0xf035=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x035f[_0x55969b];return _0x3d7fc1;};'use strict';function ZendeskAccount(_0x176688){this['id']=_0x176688['id']||0x0;this[_0xf035('0x0')]=_0x176688[_0xf035('0x0')]||'';this[_0xf035('0x1')]=_0x176688[_0xf035('0x1')]||'';this[_0xf035('0x2')]=_0x176688[_0xf035('0x2')]||'';this[_0xf035('0x3')]=_0x176688[_0xf035('0x3')]||'';this['remoteUri']=_0x176688[_0xf035('0x4')]||'';this[_0xf035('0x5')]=_0x176688[_0xf035('0x5')]||'';this[_0xf035('0x6')]=_0x176688[_0xf035('0x6')]||_0xf035('0x7');this[_0xf035('0x8')]=_0x176688[_0xf035('0x8')]||'';this[_0xf035('0x9')]=_0x176688[_0xf035('0x9')]||{};}module[_0xf035('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 63bcca9..134b5ba 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 _0x0b31=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x26c643,_0x2c784a){var _0xb49398=function(_0x4ea624){while(--_0x4ea624){_0x26c643['push'](_0x26c643['shift']());}};_0xb49398(++_0x2c784a);}(_0x0b31,0x1ab));var _0x10b3=function(_0x57bcea,_0x4da0ab){_0x57bcea=_0x57bcea-0x0;var _0x4c3172=_0x0b31[_0x57bcea];return _0x4c3172;};'use strict';function ZohoAccount(_0x485d31){this['id']=_0x485d31['id']||0x0;this[_0x10b3('0x0')]=_0x485d31[_0x10b3('0x0')]||'';this[_0x10b3('0x1')]=_0x485d31[_0x10b3('0x1')]||'';this[_0x10b3('0x2')]=_0x485d31[_0x10b3('0x2')]||'';this[_0x10b3('0x3')]=_0x485d31[_0x10b3('0x3')]||'';this[_0x10b3('0x4')]=_0x485d31[_0x10b3('0x4')]||'';this[_0x10b3('0x5')]=_0x485d31[_0x10b3('0x5')]||'';this[_0x10b3('0x6')]=_0x485d31[_0x10b3('0x6')]||'';this[_0x10b3('0x7')]=_0x485d31[_0x10b3('0x7')]||'';this[_0x10b3('0x8')]=_0x485d31[_0x10b3('0x8')]||'';this[_0x10b3('0x9')]=_0x485d31[_0x10b3('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x9dd3=['host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x5a01b4,_0x1b4059){var _0x53d53c=function(_0x134d6c){while(--_0x134d6c){_0x5a01b4['push'](_0x5a01b4['shift']());}};_0x53d53c(++_0x1b4059);}(_0x9dd3,0x9e));var _0x39dd=function(_0x4d8915,_0x4a46da){_0x4d8915=_0x4d8915-0x0;var _0x4aedfc=_0x9dd3[_0x4d8915];return _0x4aedfc;};'use strict';function ZohoAccount(_0x3e4728){this['id']=_0x3e4728['id']||0x0;this[_0x39dd('0x0')]=_0x3e4728[_0x39dd('0x0')]||'';this[_0x39dd('0x1')]=_0x3e4728['description']||'';this[_0x39dd('0x2')]=_0x3e4728[_0x39dd('0x2')]||'';this['zone']=_0x3e4728['zone']||'';this['clientId']=_0x3e4728[_0x39dd('0x3')]||'';this[_0x39dd('0x4')]=_0x3e4728['clientSecret']||'';this[_0x39dd('0x5')]=_0x3e4728['serverUrl']||'';this[_0x39dd('0x6')]=_0x3e4728[_0x39dd('0x6')]||'';this[_0x39dd('0x7')]=_0x3e4728['refreshToken']||'';this[_0x39dd('0x8')]=_0x3e4728[_0x39dd('0x8')]||{};}module[_0x39dd('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 6010c91..a4038a6 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 _0x6a55=['countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','util','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0x180fcb,_0x208b94){var _0x515f0d=function(_0x1be895){while(--_0x1be895){_0x180fcb['push'](_0x180fcb['shift']());}};_0x515f0d(++_0x208b94);}(_0x6a55,0xdb));var _0x56a5=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x6a55[_0x33fcbb];return _0x2efe40;};'use strict';var util=require(_0x56a5('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x4ec858,_0x173b37,_0x47b337){var _0x561353='';if(!_[_0x56a5('0x1')](_0x173b37)&&'string'===typeof _0x173b37){_0x561353+=_0x173b37;}if(!_[_0x56a5('0x1')](_0x47b337)&&'string'===typeof _0x47b337){_0x561353+='\x20'+_0x47b337;}if(_0x561353!==''){return _0x561353;}return _0x4ec858;}function Action(_0x28bb2b,_0x380b1b,_0x42d164,_0x293ea1,_0x444c65){this[_0x56a5('0x2')]=_0x42d164||undefined;this[_0x56a5('0x3')]=_0x28bb2b['id'];this[_0x56a5('0x4')]=_0x380b1b['name'];this[_0x56a5('0x5')]=_0x380b1b[_0x56a5('0x5')];this[_0x56a5('0x6')]=_0x56a5('0x4');this[_0x56a5('0x7')]=![];this[_0x56a5('0x8')]=_[_0x56a5('0x1')](_0x28bb2b[_0x56a5('0x9')])?undefined:_0x28bb2b[_0x56a5('0x9')]['name'];this['channelAgent']=this[_0x56a5('0x8')]?util[_0x56a5('0xa')](_0x56a5('0xb'),this[_0x56a5('0x8')]):_0x293ea1||undefined;this[_0x56a5('0xc')]=checkNameSurname(_0x28bb2b[_0x56a5('0xd')]['phone'],_0x28bb2b['Contact'][_0x56a5('0xe')],_0x28bb2b[_0x56a5('0xd')][_0x56a5('0xf')]);this[_0x56a5('0x10')]=_0x28bb2b[_0x56a5('0x10')]||![];this[_0x56a5('0x11')]=_0x28bb2b[_0x56a5('0x12')];this['scheduledat']=_0x28bb2b[_0x56a5('0x13')];this['countbusyretry']=_0x28bb2b[_0x56a5('0x14')]||0x0;this['countcongestionretry']=_0x28bb2b[_0x56a5('0x15')]||0x0;this[_0x56a5('0x16')]=_0x28bb2b[_0x56a5('0x16')]||0x0;this[_0x56a5('0x17')]=(_0x28bb2b[_0x56a5('0x14')]||0x0)+(_0x28bb2b[_0x56a5('0x15')]||0x0)+(_0x28bb2b[_0x56a5('0x16')]||0x0)+(_0x28bb2b['countnosuchnumberretry']||0x0)+(_0x28bb2b[_0x56a5('0x18')]||0x0)+(_0x28bb2b[_0x56a5('0x19')]||0x0)+(_0x28bb2b[_0x56a5('0x1a')]||0x0)+(_0x28bb2b[_0x56a5('0x1b')]||0x0);this['countnosuchnumberretry']=_0x28bb2b[_0x56a5('0x1c')]||0x0;this[_0x56a5('0x18')]=_0x28bb2b[_0x56a5('0x18')]||0x0;this[_0x56a5('0x19')]=_0x28bb2b[_0x56a5('0x19')]||0x0;this['countmachineretry']=_0x28bb2b['countmachineretry']||0x0;this[_0x56a5('0x1b')]=_0x28bb2b[_0x56a5('0x1b')]||0x0;this['callback']=_0x28bb2b[_0x56a5('0x1d')];this[_0x56a5('0x1e')]=_0x28bb2b[_0x56a5('0x1e')];this[_0x56a5('0x1f')]=_0x28bb2b[_0x56a5('0x1f')];this[_0x56a5('0x20')]=_0x28bb2b[_0x56a5('0x20')];this[_0x56a5('0x21')]=_0x28bb2b[_0x56a5('0x21')];this[_0x56a5('0x22')]=_0x28bb2b[_0x56a5('0x22')];this[_0x56a5('0x23')]=_[_0x56a5('0x1')](_0x28bb2b['Agent'])?_0x28bb2b[_0x56a5('0x23')]:_0x28bb2b[_0x56a5('0x9')]['id'];this[_0x56a5('0x24')]=_0x28bb2b[_0x56a5('0x24')];this[_0x56a5('0x25')]='';this['originatecalleridname']='';}Action[_0x56a5('0x26')]['getCaller']=function(){return util[_0x56a5('0xa')](_0x56a5('0x27'),this[_0x56a5('0xc')],this[_0x56a5('0x28')]);};module['exports']=Action; \ No newline at end of file +var _0x065e=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','calleridname','number','util','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry'];(function(_0x5a51b5,_0x15118a){var _0x3bd1ff=function(_0x4495e2){while(--_0x4495e2){_0x5a51b5['push'](_0x5a51b5['shift']());}};_0x3bd1ff(++_0x15118a);}(_0x065e,0x1a7));var _0xe065=function(_0x54850d,_0xba6824){_0x54850d=_0x54850d-0x0;var _0x212655=_0x065e[_0x54850d];return _0x212655;};'use strict';var util=require(_0xe065('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x59293c,_0x1c0754,_0x240146){var _0x163f28='';if(!_['isNil'](_0x1c0754)&&'string'===typeof _0x1c0754){_0x163f28+=_0x1c0754;}if(!_[_0xe065('0x1')](_0x240146)&&_0xe065('0x2')===typeof _0x240146){_0x163f28+='\x20'+_0x240146;}if(_0x163f28!==''){return _0x163f28;}return _0x59293c;}function Action(_0x5b099e,_0x10b45f,_0x1e7e69,_0x189d72,_0x52403a){this[_0xe065('0x3')]=_0x1e7e69||undefined;this['idContact']=_0x5b099e['id'];this[_0xe065('0x4')]=_0x10b45f[_0xe065('0x5')];this[_0xe065('0x6')]=_0x10b45f[_0xe065('0x6')];this[_0xe065('0x7')]='queue';this[_0xe065('0x8')]=![];this[_0xe065('0x9')]=_[_0xe065('0x1')](_0x5b099e[_0xe065('0xa')])?undefined:_0x5b099e[_0xe065('0xa')][_0xe065('0x5')];this['channelAgent']=this['membername']?util[_0xe065('0xb')](_0xe065('0xc'),this[_0xe065('0x9')]):_0x189d72||undefined;this['calleridname']=checkNameSurname(_0x5b099e[_0xe065('0xd')][_0xe065('0xe')],_0x5b099e[_0xe065('0xd')][_0xe065('0xf')],_0x5b099e[_0xe065('0xd')]['lastName']);this[_0xe065('0x10')]=_0x5b099e[_0xe065('0x10')]||![];this[_0xe065('0x11')]=_0x5b099e[_0xe065('0xe')];this[_0xe065('0x12')]=_0x5b099e[_0xe065('0x12')];this[_0xe065('0x13')]=_0x5b099e['countbusyretry']||0x0;this[_0xe065('0x14')]=_0x5b099e[_0xe065('0x14')]||0x0;this['countnoanswerretry']=_0x5b099e[_0xe065('0x15')]||0x0;this[_0xe065('0x16')]=(_0x5b099e[_0xe065('0x13')]||0x0)+(_0x5b099e[_0xe065('0x14')]||0x0)+(_0x5b099e[_0xe065('0x15')]||0x0)+(_0x5b099e[_0xe065('0x17')]||0x0)+(_0x5b099e[_0xe065('0x18')]||0x0)+(_0x5b099e['countabandonedretry']||0x0)+(_0x5b099e[_0xe065('0x19')]||0x0)+(_0x5b099e['countagentrejectretry']||0x0);this[_0xe065('0x17')]=_0x5b099e[_0xe065('0x17')]||0x0;this['countdropretry']=_0x5b099e[_0xe065('0x18')]||0x0;this['countabandonedretry']=_0x5b099e[_0xe065('0x1a')]||0x0;this[_0xe065('0x19')]=_0x5b099e[_0xe065('0x19')]||0x0;this[_0xe065('0x1b')]=_0x5b099e[_0xe065('0x1b')]||0x0;this[_0xe065('0x1c')]=_0x5b099e[_0xe065('0x1c')];this[_0xe065('0x1d')]=_0x5b099e[_0xe065('0x1d')];this['callbackat']=_0x5b099e[_0xe065('0x1e')];this[_0xe065('0x1f')]=_0x5b099e[_0xe065('0x1f')];this[_0xe065('0x20')]=_0x5b099e['ContactId'];this['ListId']=_0x5b099e[_0xe065('0x21')];this['UserId']=_[_0xe065('0x1')](_0x5b099e[_0xe065('0xa')])?_0x5b099e[_0xe065('0x22')]:_0x5b099e[_0xe065('0xa')]['id'];this[_0xe065('0x23')]=_0x5b099e[_0xe065('0x23')];this[_0xe065('0x24')]='';this[_0xe065('0x25')]='';}Action['prototype']['getCaller']=function(){return util[_0xe065('0xb')](_0xe065('0x26'),this[_0xe065('0x27')],this[_0xe065('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c5d9bf7..dac474d 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 _0xa9e0=['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','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','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','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','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','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x3a0721,_0x1d2a7b){var _0x4d7afd=function(_0x42d9e3){while(--_0x42d9e3){_0x3a0721['push'](_0x3a0721['shift']());}};_0x4d7afd(++_0x1d2a7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['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','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','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','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','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','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x5e3562,_0x29f747){var _0x15f890=function(_0x3d5e2e){while(--_0x3d5e2e){_0x5e3562['push'](_0x5e3562['shift']());}};_0x15f890(++_0x29f747);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index dccf868..923df47 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 _0xb3dd=['rescheduleContact','UserId','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','getContactRecallMe','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal'];(function(_0x4f88db,_0x3082bf){var _0xca5f6=function(_0x5e4bc8){while(--_0x5e4bc8){_0x4f88db['push'](_0x4f88db['shift']());}};_0xca5f6(++_0x3082bf);}(_0xb3dd,0x1aa));var _0xdb3d=function(_0x21791a,_0x4f8808){_0x21791a=_0x21791a-0x0;var _0x153f8e=_0xb3dd[_0x21791a];return _0x153f8e;};'use strict';var util=require(_0xdb3d('0x0'));var BPromise=require(_0xdb3d('0x1'));var logger=require(_0xdb3d('0x2'))(_0xdb3d('0x3'));var cmHopper=require(_0xdb3d('0x4'));var cmHopperHistory=require(_0xdb3d('0x5'));var cmHopperBlack=require(_0xdb3d('0x6'));var agentReportPreview=require(_0xdb3d('0x7'));var voiceQueueReport=require(_0xdb3d('0x8'));function loggerCatch(_0x304ed7){return function(_0x5ea8fe){logger[_0xdb3d('0x9')](_0x304ed7,util[_0xdb3d('0xa')](_0x5ea8fe,{'showHidden':![],'depth':null}));};}function create(_0xa3ea49){return cmHopperHistory[_0xdb3d('0xb')](_0xa3ea49)[_0xdb3d('0xc')](loggerCatch(_0xdb3d('0xd')));}function createAgent(_0x5bac53){return BPromise[_0xdb3d('0xe')]()[_0xdb3d('0xf')](agentReportPreview[_0xdb3d('0xb')](_0x5bac53))['catch'](loggerCatch(_0xdb3d('0xd')));}function moveContact(_0x38bdc0){return cmHopper[_0xdb3d('0x10')](_0x38bdc0,!![])[_0xdb3d('0xc')](loggerCatch(_0xdb3d('0x11')));}exports[_0xdb3d('0x12')]=function(_0x2f87e9){return cmHopperBlack[_0xdb3d('0x12')](_0x2f87e9)[_0xdb3d('0xc')](loggerCatch(_0xdb3d('0x13')));};exports[_0xdb3d('0x14')]=function(_0x4b2c06){return BPromise[_0xdb3d('0xe')]()[_0xdb3d('0xf')](cmHopper[_0xdb3d('0x14')](_0x4b2c06))[_0xdb3d('0xc')](loggerCatch(_0xdb3d('0x15')));};exports[_0xdb3d('0xb')]=function(_0x3b43f9,_0x133f00){create(_0x3b43f9)[_0xdb3d('0xc')](loggerCatch(_0x133f00));moveContact(_0x3b43f9)['catch'](loggerCatch(_0x133f00));};exports[_0xdb3d('0x16')]=function(_0x1d21ea,_0x85ffe7){createAgent(_0x1d21ea)['catch'](loggerCatch(_0x85ffe7));};exports['createCustomerHistory']=function(_0x9cd68b,_0x2a7fe3){create(_0x9cd68b)[_0xdb3d('0xc')](loggerCatch(_0x2a7fe3));};exports[_0xdb3d('0x17')]=function(_0x5495a3,_0x196fbb){moveContact(_0x5495a3)[_0xdb3d('0xc')](loggerCatch(_0x196fbb));};exports[_0xdb3d('0x18')]=function(_0x452841,_0x5a4ec7,_0x1bf9cf){if(_0x5a4ec7){_0x452841[_0xdb3d('0x19')]=null;}if(_0x1bf9cf){_0x452841['active']=![];}return cmHopper[_0xdb3d('0x18')](_0x452841)[_0xdb3d('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xdb3d('0x1a')]=function(_0x514bb2){return cmHopper[_0xdb3d('0x1a')](_0x514bb2)[_0xdb3d('0xc')](loggerCatch(_0xdb3d('0x1b')));};exports[_0xdb3d('0x1c')]=function(_0x596099){return cmHopper['unlockContact']({'UserId':null},_0x596099,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xdb3d('0x1d')]=function(_0x38faed){return cmHopper[_0xdb3d('0x1c')]({'active':![]},_0x38faed,0x1)[_0xdb3d('0xc')](loggerCatch(_0xdb3d('0x1e')));};exports[_0xdb3d('0x1f')]=function(_0xafe197){var _0x123d77={};_0x123d77[_0xdb3d('0x20')]=_0xafe197[_0xdb3d('0x20')];_0x123d77['uniqueid']=_0xafe197[_0xdb3d('0x21')];_0x123d77['calleridnum']=_0xafe197[_0xdb3d('0x22')];_0x123d77['calleridname']=_0xafe197[_0xdb3d('0x23')];_0x123d77['queue']=_0xafe197[_0xdb3d('0x24')];_0x123d77[_0xdb3d('0x25')]=_0xafe197[_0xdb3d('0x26')];_0x123d77['queuecallerleaveAt']=_0xafe197[_0xdb3d('0x26')];_0x123d77[_0xdb3d('0x27')]=0x1;_0x123d77[_0xdb3d('0x28')]=_0xafe197['endtime'];_0x123d77[_0xdb3d('0x29')]=_0xafe197['membername'];_0x123d77[_0xdb3d('0x2a')]=_0xdb3d('0x2b');_0x123d77['exten']='xcally-motion-preview';_0x123d77[_0xdb3d('0x2c')]=0x0;_0x123d77['assigned']=0x1;_0x123d77[_0xdb3d('0x2d')]=_0xafe197[_0xdb3d('0x2e')];_0x123d77[_0xdb3d('0x2f')]=_0xdb3d('0x30');return BPromise['resolve']()[_0xdb3d('0xf')](voiceQueueReport['create'](_0x123d77))[_0xdb3d('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xdb3d('0x31')]=function(_0x452ad0,_0x30c319){return BPromise[_0xdb3d('0xe')]()[_0xdb3d('0xf')](cmHopper[_0xdb3d('0x31')](_0x452ad0,_0x30c319))[_0xdb3d('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0xccae65){return cmHopper[_0xdb3d('0x18')](_0xccae65,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x4dfa=['type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x5d5b1a,_0xea27e5){var _0x5d35a7=function(_0x3fa8e2){while(--_0x3fa8e2){_0x5d5b1a['push'](_0x5d5b1a['shift']());}};_0x5d35a7(++_0xea27e5);}(_0x4dfa,0xbb));var _0xa4df=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4dfa[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var BPromise=require(_0xa4df('0x0'));var logger=require(_0xa4df('0x1'))(_0xa4df('0x2'));var cmHopper=require(_0xa4df('0x3'));var cmHopperHistory=require(_0xa4df('0x4'));var cmHopperBlack=require(_0xa4df('0x5'));var agentReportPreview=require(_0xa4df('0x6'));var voiceQueueReport=require(_0xa4df('0x7'));function loggerCatch(_0x302698){return function(_0x3e7cdb){logger[_0xa4df('0x8')](_0x302698,util[_0xa4df('0x9')](_0x3e7cdb,{'showHidden':![],'depth':null}));};}function create(_0x52ba1a){return cmHopperHistory[_0xa4df('0xa')](_0x52ba1a)[_0xa4df('0xb')](loggerCatch(_0xa4df('0xc')));}function createAgent(_0x4e1884){return BPromise[_0xa4df('0xd')]()[_0xa4df('0xe')](agentReportPreview[_0xa4df('0xa')](_0x4e1884))[_0xa4df('0xb')](loggerCatch(_0xa4df('0xc')));}function moveContact(_0x2c6556){return cmHopper['moveContactManagedDialer'](_0x2c6556,!![])[_0xa4df('0xb')](loggerCatch(_0xa4df('0xf')));}exports[_0xa4df('0x10')]=function(_0x1f41d6){return cmHopperBlack['checkIsBlackList'](_0x1f41d6)[_0xa4df('0xb')](loggerCatch(_0xa4df('0x11')));};exports[_0xa4df('0x12')]=function(_0xe54bbb){return BPromise[_0xa4df('0xd')]()[_0xa4df('0xe')](cmHopper['getContactPreview'](_0xe54bbb))['catch'](loggerCatch(_0xa4df('0x13')));};exports['createHistory']=function(_0x4561d8,_0x51aa92){create(_0x4561d8)['catch'](loggerCatch(_0x51aa92));moveContact(_0x4561d8)[_0xa4df('0xb')](loggerCatch(_0x51aa92));};exports[_0xa4df('0x14')]=function(_0x103fb3,_0x372da5){createAgent(_0x103fb3)[_0xa4df('0xb')](loggerCatch(_0x372da5));};exports[_0xa4df('0x15')]=function(_0x6d92e3,_0x12337e){create(_0x6d92e3)[_0xa4df('0xb')](loggerCatch(_0x12337e));};exports[_0xa4df('0x16')]=function(_0x9eb59b,_0x251c29){moveContact(_0x9eb59b)['catch'](loggerCatch(_0x251c29));};exports[_0xa4df('0x17')]=function(_0x2d6dc3,_0x4d88a0,_0x502eac){if(_0x4d88a0){_0x2d6dc3[_0xa4df('0x18')]=null;}if(_0x502eac){_0x2d6dc3[_0xa4df('0x19')]=![];}return cmHopper[_0xa4df('0x17')](_0x2d6dc3)[_0xa4df('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xa4df('0x1a')]=function(_0x16a0b3){return cmHopper[_0xa4df('0x1a')](_0x16a0b3)[_0xa4df('0xb')](loggerCatch(_0xa4df('0x1b')));};exports[_0xa4df('0x1c')]=function(_0x13788a){return cmHopper[_0xa4df('0x1c')]({'UserId':null},_0x13788a,0x1)[_0xa4df('0xb')](loggerCatch(_0xa4df('0x1d')));};exports[_0xa4df('0x1e')]=function(_0x3e48ae){return cmHopper[_0xa4df('0x1c')]({'active':![]},_0x3e48ae,0x1)[_0xa4df('0xb')](loggerCatch(_0xa4df('0x1f')));};exports[_0xa4df('0x20')]=function(_0x3fd1c9){var _0x4c8358={};_0x4c8358[_0xa4df('0x21')]=_0x3fd1c9[_0xa4df('0x21')];_0x4c8358[_0xa4df('0x22')]=_0x3fd1c9['uniqueid'];_0x4c8358[_0xa4df('0x23')]=_0x3fd1c9[_0xa4df('0x23')];_0x4c8358[_0xa4df('0x24')]=_0x3fd1c9[_0xa4df('0x24')];_0x4c8358[_0xa4df('0x25')]=_0x3fd1c9[_0xa4df('0x25')];_0x4c8358[_0xa4df('0x26')]=_0x3fd1c9[_0xa4df('0x27')];_0x4c8358['queuecallerleaveAt']=_0x3fd1c9[_0xa4df('0x27')];_0x4c8358[_0xa4df('0x28')]=0x1;_0x4c8358[_0xa4df('0x29')]=_0x3fd1c9[_0xa4df('0x2a')];_0x4c8358['connectedlinename']=_0x3fd1c9[_0xa4df('0x2b')];_0x4c8358[_0xa4df('0x2c')]=_0xa4df('0x2d');_0x4c8358['exten']=_0xa4df('0x2e');_0x4c8358[_0xa4df('0x2f')]=0x0;_0x4c8358['assigned']=0x1;_0x4c8358[_0xa4df('0x30')]=_0x3fd1c9[_0xa4df('0x2b')];_0x4c8358[_0xa4df('0x31')]=_0xa4df('0x32');return BPromise[_0xa4df('0xd')]()['then'](voiceQueueReport[_0xa4df('0x33')](_0x4c8358))['catch'](loggerCatch(_0xa4df('0x34')));};exports[_0xa4df('0x35')]=function(_0x5e9af7,_0x202ad1){return BPromise[_0xa4df('0xd')]()[_0xa4df('0xe')](cmHopper[_0xa4df('0x35')](_0x5e9af7,_0x202ad1))[_0xa4df('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x2ed006){return cmHopper[_0xa4df('0x17')](_0x2ed006,!![],!![])[_0xa4df('0xb')](loggerCatch(_0xa4df('0x36')));}; \ 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 1e8bda7..9ea5de8 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 _0xf5a8=['IsNotLoggedIn','queue','interface','motionChannel','mandatoryDisposition','buildObj','agentReadyId','reachable','push','getDiff','milliseconds','diff','createBody','ListId','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','calleridname','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','127.0.0.1','loggerCatch','error','inspect','loggerError','logger2','info','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','membername','UserId','logCustomer','statedesc','ringtime','talktime','getSeconds','answertime','Failure','RECALL','uniqueid','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf5a8,0x1c4));var _0x8f5a=function(_0x706091,_0x5e07d9){_0x706091=_0x706091-0x0;var _0x4aee6f=_0xf5a8[_0x706091];return _0x4aee6f;};'use strict';var util=require(_0x8f5a('0x0'));var _=require('lodash');var moment=require(_0x8f5a('0x1'));var logger=require(_0x8f5a('0x2'))(_0x8f5a('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x8f5a('0x4');var utils=require('../../dialer/utils');exports[_0x8f5a('0x5')]=function(_0x5c03e7){return function(_0x34487e){logger[_0x8f5a('0x6')](_0x5c03e7,util[_0x8f5a('0x7')](_0x34487e,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1d7da3,_0xa8f4d6){logger['info'](_0x1d7da3,util[_0x8f5a('0x7')](_0xa8f4d6,{'showHidden':![],'depth':null}));};exports[_0x8f5a('0x8')]=function(_0x4f4f7d,_0x548d8c){logger[_0x8f5a('0x6')](_0x4f4f7d,util['inspect'](_0x548d8c,{'showHidden':![],'depth':null}));};exports[_0x8f5a('0x9')]=function(_0x4f4ec3){return function(_0x5dc713){logger[_0x8f5a('0xa')](_0x4f4ec3,util[_0x8f5a('0x7')](_0x5dc713,{'showHidden':![],'depth':null}));};};exports[_0x8f5a('0xb')]=function(_0x27bdf5,_0x47c5c2,_0x50a2cd){return{'message':_0x27bdf5,'unlock':_0x47c5c2,'active':_0x50a2cd};};exports[_0x8f5a('0xc')]=function(_0x4e683f,_0x35de8b,_0x4a8392){if(!_[_0x8f5a('0xd')](_0x4a8392)&&'string'===typeof _0x4a8392&&!_[_0x8f5a('0xe')](_0x4a8392)){if(!_[_0x8f5a('0xd')](_0x35de8b)&&_0x8f5a('0xf')===typeof _0x35de8b&&!_['isEmpty'](_0x35de8b)){return util[_0x8f5a('0x10')](_0x8f5a('0x11'),_0x35de8b,_0x4a8392);}return util[_0x8f5a('0x10')](_0x8f5a('0x11'),_0x4a8392,_0x4a8392);}if(!_[_0x8f5a('0xd')](_0x4e683f)&&'string'===typeof _0x4e683f&&!_[_0x8f5a('0xe')](_0x4e683f)){return _0x4e683f;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x36a93f){if(_[_0x8f5a('0x12')](_0x36a93f)){return![];}return _0x36a93f;};exports[_0x8f5a('0x13')]=function(_0x6ae4ed,_0x13276c,_0x142c95,_0x3cedfc,_0x3b9739,_0x100ac1){var _0x37d547={'XMD-QUEUE':_0x13276c[_0x8f5a('0x14')]?_0x13276c[_0x8f5a('0x14')][_0x8f5a('0x15')]:'','XMD-CALLERID':_0x3cedfc,'XMD-CALLERID-PREVIEW':_0x100ac1?util[_0x8f5a('0x10')](_0x8f5a('0x11'),_0x100ac1['calleridname'],_0x100ac1[_0x8f5a('0x16')]):_0x3cedfc,'XMD-DIALID':_0x3b9739,'XMD-CONTACTID':_0x13276c[_0x8f5a('0x17')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3cedfc,'XMD-VOICEQUEUEID':_0x13276c[_0x8f5a('0x18')],'XMD-DIALCHANNEL':_0x142c95,'XMD-DIALTIMEOUT':_0x6ae4ed[_0x8f5a('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x8f5a('0x10')](_0x8f5a('0x1a'),_0x6ae4ed[_0x8f5a('0x1b')]?'g':'',_[_0x8f5a('0xe')](_0x6ae4ed[_0x8f5a('0x1c')])?'':_0x8f5a('0x1d')),'XMD-DIALURL':_0x6ae4ed['dialPreviewUrl']||'','XMD-AGI':_0x6ae4ed['dialQueueProject']?util[_0x8f5a('0x10')](_0x8f5a('0x1e'),ipAgi,_0x6ae4ed[_0x8f5a('0x1f')]):_0x8f5a('0x20'),'XMD-AGIAFTER':_0x6ae4ed[_0x8f5a('0x1b')]?util['format'](_0x8f5a('0x1e'),ipAgi,_0x6ae4ed[_0x8f5a('0x1b')]):_0x8f5a('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x100ac1?_0x100ac1[_0x8f5a('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x100ac1?_0x100ac1['originatecalleridname']:'','XMD-DESTINATION':_0x8f5a('0x22'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x8f5a('0xe')](_0x6ae4ed[_0x8f5a('0x1c')])){_0x37d547[util[_0x8f5a('0x10')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x6ae4ed[_0x8f5a('0x1c')];_0x37d547[util[_0x8f5a('0x10')]('%s',_0x8f5a('0x23'))]=_0x3b9739;}return _0x37d547;};exports[_0x8f5a('0x24')]=function(_0x13a80d){var _0x2db3ec={};for(var _0x1d6cc7 in _0x13a80d){if(_0x13a80d[_0x8f5a('0x25')](_0x1d6cc7)){_0x2db3ec[util[_0x8f5a('0x10')]('%s',_['toLower'](_0x1d6cc7))]=_0x13a80d[_0x1d6cc7];}}return{'variables':_0x2db3ec};};exports[_0x8f5a('0x26')]=function(_0x2e9559,_0xf6cf7){if(!_[_0x8f5a('0x12')](_0x2e9559)){if(_0x2e9559['hasOwnProperty'](_0x8f5a('0x27'))){if(_0x2e9559[_0x8f5a('0x27')]>0x0){_0x2e9559[_0x8f5a('0x27')]-=0x1;}else{logger[_0x8f5a('0x6')](_0x8f5a('0x28'),_0xf6cf7);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0xf6cf7);}};exports['logBlacklist']=function(_0xbcdd05){var _0x2f2e3f=moment()[_0x8f5a('0x10')](_0x8f5a('0x29'));_0xbcdd05[_0x8f5a('0x2a')]=0xd;_0xbcdd05['statedesc']=_0x8f5a('0x2b');_0xbcdd05[_0x8f5a('0x2c')]=_0x2f2e3f;_0xbcdd05[_0x8f5a('0x2d')]=_0x2f2e3f;_0xbcdd05[_0x8f5a('0x2e')]=_0x2f2e3f;};exports[_0x8f5a('0x2f')]=function(_0x4ed7f5,_0x1817d2,_0x479aa4){var _0x485068=moment()[_0x8f5a('0x10')](_0x8f5a('0x29'));_0x4ed7f5['state']=_0x1817d2;_0x4ed7f5['statedesc']=_0x479aa4;_0x4ed7f5[_0x8f5a('0x2d')]=_0x485068;_0x4ed7f5['ringtime']=utils['getSeconds'](_0x4ed7f5[_0x8f5a('0x2d')],_0x4ed7f5[_0x8f5a('0x2c')]);};exports['logLookAgent']=function(_0x333311,_0x2944aa,_0x1c9a6e){_0x333311[_0x8f5a('0x30')]=_0x2944aa;_0x333311[_0x8f5a('0x31')]=_0x1c9a6e;};exports[_0x8f5a('0x32')]=function(_0x2d81f4,_0x356ca9,_0x335932){var _0x3cf704=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2d81f4[_0x8f5a('0x2a')]=_0x356ca9;_0x2d81f4[_0x8f5a('0x33')]=_0x335932;_0x2d81f4[_0x8f5a('0x2d')]=_0x2d81f4['responsetime']?_0x2d81f4['responsetime']:_0x3cf704;_0x2d81f4[_0x8f5a('0x2e')]=_0x2d81f4['endtime']?_0x2d81f4['endtime']:_0x3cf704;_0x2d81f4[_0x8f5a('0x34')]=utils['getSeconds'](_0x2d81f4[_0x8f5a('0x2d')]||0x0,_0x2d81f4[_0x8f5a('0x2c')]||0x0);_0x2d81f4[_0x8f5a('0x35')]=_0x2d81f4['answertime']?utils[_0x8f5a('0x36')](_0x2d81f4[_0x8f5a('0x2e')],_0x2d81f4[_0x8f5a('0x37')]):0x0;};exports['isFailure']=function(_0x48f94f){return _0x48f94f===_0x8f5a('0x38');};exports['variablesAction']=function(_0x2c6495,_0x9d11be,_0x48b2ae,_0x355c4c,_0x290337){var _0x309eaf=_0x355c4c?_0x8f5a('0x39'):_0x2c6495['calleridname'];_0x309eaf=_0x290337?'BOOKED':_0x309eaf;return{'actionid':_0x2c6495[_0x8f5a('0x3a')],'action':'originate','channel':_0x2c6495[_0x8f5a('0x3b')],'callerid':util[_0x8f5a('0x10')](_0x8f5a('0x11'),_0x309eaf,_0x2c6495[_0x8f5a('0x16')]),'Exten':_0x8f5a('0x22'),'Context':'from-sip','Priority':'1','variable':_0x48b2ae,'timeout':(_0x9d11be[_0x8f5a('0x3c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c6495[_0x8f5a('0x3a')]};};exports[_0x8f5a('0x3d')]=function(_0x1b4c7b){return _0x1b4c7b[_0x8f5a('0x3e')]+_0x1b4c7b[_0x8f5a('0x3f')]+_0x1b4c7b[_0x8f5a('0x40')]+_0x1b4c7b['countagentrejectretry']+_0x1b4c7b['countnosuchnumberretry'];};exports[_0x8f5a('0x41')]=function(_0x29a2ae){var _0x4461f6=_[_0x8f5a('0x42')](_0x29a2ae);_0x4461f6['state']=0xf;_0x4461f6['statedesc']=_0x8f5a('0x43');return _0x4461f6;};exports[_0x8f5a('0x44')]=function(_0x54f22b,_0x2f6b46,_0x206b06){var _0x62385f={};_0x62385f[_0x2f6b46]=_0x54f22b[_0x2f6b46];_0x62385f[_0x8f5a('0x45')]=![];_0x62385f[_0x8f5a('0x46')]=moment()[_0x8f5a('0x47')](_0x206b06,_0x8f5a('0x48'))[_0x8f5a('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x62385f['ContactId']=_0x54f22b[_0x8f5a('0x17')];_0x62385f['ListId']=_0x54f22b['ListId'];_0x62385f[_0x8f5a('0x18')]=_0x54f22b[_0x8f5a('0x18')]||undefined;return _0x62385f;};exports['decrementTalkink']=function(_0x5e2f73,_0x269f54){if(!_['isNil'](_0x5e2f73)){if(_0x5e2f73[_0x8f5a('0x49')]>0x0){_0x5e2f73[_0x8f5a('0x49')]-=0x1;}else{logger[_0x8f5a('0x6')](_0x269f54,_0x8f5a('0x4a'));}}else{logger['error'](_0x269f54,_0x8f5a('0x4b'));}};exports[_0x8f5a('0x4c')]=function(_0x5188c4){if(_0x5188c4<=0x0){return!![];}return![];};function buildObj(_0x21aa9d,_0x5e4359,_0x58bb2d){_0x21aa9d['lastevent']=_0x5e4359;_0x21aa9d[_0x8f5a('0x15')]=_0x21aa9d[_0x8f5a('0x4d')];_0x21aa9d[_0x8f5a('0x4e')]=_0x21aa9d[_0x8f5a('0x3b')];_0x21aa9d[_0x8f5a('0x4f')]='voice';if(_0x58bb2d){_0x21aa9d[_0x8f5a('0x50')]=_0x58bb2d[_0x8f5a('0x50')];}return _0x21aa9d;}exports[_0x8f5a('0x51')]=buildObj;exports[_0x8f5a('0x52')]=function(_0x194212){var _0x348301=[];for(var _0x3578ed in _0x194212){if(_0x194212[_0x8f5a('0x25')](_0x3578ed)){if(!_[_0x8f5a('0x12')](_0x194212[_0x3578ed])&&_0x194212[_0x3578ed]['state']==='not_inuse'&&_0x194212[_0x3578ed]['status']===_0x8f5a('0x53')){_0x348301[_0x8f5a('0x54')](_0x194212[_0x3578ed]['id']);}}}return _0x348301;};exports[_0x8f5a('0x55')]=function(_0x4f89a4){var _0x460879=moment()[_0x8f5a('0x56')](0x0);var _0x2e668f=moment(_0x4f89a4)[_0x8f5a('0x56')](0x0);return _0x460879[_0x8f5a('0x57')](_0x2e668f,'seconds');};exports[_0x8f5a('0x58')]=function(_0x5c66bf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c66bf[_0x8f5a('0x17')],'ListId':_0x5c66bf[_0x8f5a('0x59')],'VoiceQueueId':_0x5c66bf[_0x8f5a('0x18')]||undefined,'CampaignId':_0x5c66bf[_0x8f5a('0x5a')]||undefined};};exports[_0x8f5a('0x5b')]=function(_0x1c7b47){if(_0x1c7b47===_0x8f5a('0x3a')||_0x1c7b47===_0x8f5a('0x5c')||_0x1c7b47==='queue'||_0x1c7b47===_0x8f5a('0x5d')||_0x1c7b47===_0x8f5a('0x5e')||_0x1c7b47===_0x8f5a('0x5f')||_0x1c7b47===_0x8f5a('0x30')||_0x1c7b47==='channelAgent'||_0x1c7b47===_0x8f5a('0x60')||_0x1c7b47===_0x8f5a('0x45')||_0x1c7b47===_0x8f5a('0x16')||_0x1c7b47===_0x8f5a('0x46')||_0x1c7b47==='countbusyretry'||_0x1c7b47===_0x8f5a('0x3f')||_0x1c7b47===_0x8f5a('0x40')||_0x1c7b47===_0x8f5a('0x61')||_0x1c7b47===_0x8f5a('0x62')||_0x1c7b47==='callbackuniqueid'||_0x1c7b47===_0x8f5a('0x63')||_0x1c7b47===_0x8f5a('0x64')||_0x1c7b47==='ContactId'||_0x1c7b47===_0x8f5a('0x59')||_0x1c7b47===_0x8f5a('0x31')||_0x1c7b47===_0x8f5a('0x18')||_0x1c7b47===_0x8f5a('0x65')||_0x1c7b47===_0x8f5a('0x66')||_0x1c7b47===_0x8f5a('0x67')||_0x1c7b47===_0x8f5a('0x68')||_0x1c7b47===_0x8f5a('0x69')||_0x1c7b47==='xmd-dialurl'||_0x1c7b47===_0x8f5a('0x6a')||_0x1c7b47===_0x8f5a('0x6b')||_0x1c7b47===_0x8f5a('0x6c')||_0x1c7b47===_0x8f5a('0x6d')||_0x1c7b47==='xmd-contactid'||_0x1c7b47===_0x8f5a('0x6e')||_0x1c7b47===_0x8f5a('0x6f')||_0x1c7b47==='xmd-agiafter'||_0x1c7b47===_0x8f5a('0x70')||_0x1c7b47===_0x8f5a('0x71')||_0x1c7b47===_0x8f5a('0x72')||_0x1c7b47===_0x8f5a('0x73')||_0x1c7b47==='rtpaudioqosjitterbridged'||_0x1c7b47==='rtpaudioqosloss'||_0x1c7b47===_0x8f5a('0x74')||_0x1c7b47===_0x8f5a('0x75')||_0x1c7b47===_0x8f5a('0x76')||_0x1c7b47===_0x8f5a('0x71')||_0x1c7b47===_0x8f5a('0x72')||_0x1c7b47===_0x8f5a('0x73')||_0x1c7b47==='rtpaudioqosjitterbridged'||_0x1c7b47==='rtpaudioqosloss'||_0x1c7b47==='rtpaudioqoslossbridged'||_0x1c7b47===_0x8f5a('0x75')||_0x1c7b47===_0x8f5a('0x76')||_0x1c7b47===_0x8f5a('0x77')||_0x1c7b47==='bridgepvtcallid'||_0x1c7b47===_0x8f5a('0x2a')||_0x1c7b47===_0x8f5a('0x33')){return![];}return!![];};exports[_0x8f5a('0x78')]=function(_0x110a9c,_0x5f27ab){var _0x516de6,_0x12e14e,_0x29ffbb;if(_0x5f27ab<=0x0){_0x5f27ab=0x1;}_0x516de6=new RegExp('\x5cw{0,'+_0x5f27ab+'}$');_0x12e14e=Math[_0x8f5a('0x79')](0xa,_0x5f27ab-0x1);_0x29ffbb=Math[_0x8f5a('0x79')](0xa,_0x5f27ab)-0x1;return util['format']('%s',_[_0x8f5a('0x7a')](_0x110a9c,_0x516de6,_[_0x8f5a('0x7b')](_0x12e14e,_0x29ffbb)));};exports[_0x8f5a('0x7c')]=function(_0x598712){var _0x26477f=_0x598712[_0x8f5a('0x7d')](/"(.*?)"/);return _0x26477f?_0x26477f[0x1]:_0x598712;};exports['extractCalleridNumber']=function(_0x215eef){var _0x3469d8=_0x215eef[_0x8f5a('0x7d')](/<(.*?)>/);return _0x3469d8?_0x3469d8[0x1]:_0x215eef;};function buildNoAnswerEventPayload(_0x162a96,_0x5dbd4a){var _0x37380a=buildObj(_0x162a96,_0x8f5a('0x7e'));if(!_[_0x8f5a('0xe')](_0x5dbd4a[_0x8f5a('0x7f')])){Object[_0x8f5a('0x80')](_0x5dbd4a[_0x8f5a('0x7f')])[_0x8f5a('0x81')](function(_0x41471b){_0x37380a[_0x41471b[_0x8f5a('0x82')]()]=_0x5dbd4a[_0x8f5a('0x7f')][_0x41471b];});}return _0x37380a;}exports[_0x8f5a('0x83')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x5c0a=['variablesAction','RECALL','calleridname','BOOKED','uniqueid','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','mandatoryDisposition','agentReadyId','hasOwnProperty','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','dialAnswer','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridNumber','match','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x5c0a,0xde));var _0xa5c0=function(_0x1e88eb,_0x4d031e){_0x1e88eb=_0x1e88eb-0x0;var _0x23fe01=_0x5c0a[_0x1e88eb];return _0x23fe01;};'use strict';var util=require(_0xa5c0('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xa5c0('0x1'))(_0xa5c0('0x2'));var ipAgi=process['env'][_0xa5c0('0x3')]||_0xa5c0('0x4');var utils=require(_0xa5c0('0x5'));exports[_0xa5c0('0x6')]=function(_0xe77aaa){return function(_0x36c2e8){logger[_0xa5c0('0x7')](_0xe77aaa,util[_0xa5c0('0x8')](_0x36c2e8,{'showHidden':![],'depth':null}));};};exports[_0xa5c0('0x9')]=function(_0x5849a1,_0x426667){logger[_0xa5c0('0xa')](_0x5849a1,util[_0xa5c0('0x8')](_0x426667,{'showHidden':![],'depth':null}));};exports[_0xa5c0('0xb')]=function(_0x3095e4,_0x439a16){logger[_0xa5c0('0x7')](_0x3095e4,util[_0xa5c0('0x8')](_0x439a16,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3bc08e){return function(_0xa85dec){logger[_0xa5c0('0xa')](_0x3bc08e,util['inspect'](_0xa85dec,{'showHidden':![],'depth':null}));};};exports[_0xa5c0('0xc')]=function(_0x1f7e7a,_0x492271,_0x1e264d){return{'message':_0x1f7e7a,'unlock':_0x492271,'active':_0x1e264d};};exports[_0xa5c0('0xd')]=function(_0x38db98,_0x59fd4a,_0x56e9a7){if(!_[_0xa5c0('0xe')](_0x56e9a7)&&_0xa5c0('0xf')===typeof _0x56e9a7&&!_['isEmpty'](_0x56e9a7)){if(!_['isUndefined'](_0x59fd4a)&&_0xa5c0('0xf')===typeof _0x59fd4a&&!_[_0xa5c0('0x10')](_0x59fd4a)){return util[_0xa5c0('0x11')]('\x22%s\x22\x20<%s>',_0x59fd4a,_0x56e9a7);}return util[_0xa5c0('0x11')](_0xa5c0('0x12'),_0x56e9a7,_0x56e9a7);}if(!_['isUndefined'](_0x38db98)&&_0xa5c0('0xf')===typeof _0x38db98&&!_[_0xa5c0('0x10')](_0x38db98)){return _0x38db98;}return _0xa5c0('0x13');};exports[_0xa5c0('0x14')]=function(_0x297518){if(_[_0xa5c0('0x15')](_0x297518)){return![];}return _0x297518;};exports[_0xa5c0('0x16')]=function(_0x3600eb,_0x4f44da,_0x290f94,_0x163bc5,_0x5bbe31,_0x4815b4){var _0x2772ee={'XMD-QUEUE':_0x4f44da['Queue']?_0x4f44da['Queue'][_0xa5c0('0x17')]:'','XMD-CALLERID':_0x163bc5,'XMD-CALLERID-PREVIEW':_0x4815b4?util[_0xa5c0('0x11')](_0xa5c0('0x12'),_0x4815b4['calleridname'],_0x4815b4[_0xa5c0('0x18')]):_0x163bc5,'XMD-DIALID':_0x5bbe31,'XMD-CONTACTID':_0x4f44da[_0xa5c0('0x19')],'XMD-CDRTYPE':_0xa5c0('0x1a'),'CALLERID(all)':_0x163bc5,'XMD-VOICEQUEUEID':_0x4f44da[_0xa5c0('0x1b')],'XMD-DIALCHANNEL':_0x290f94,'XMD-DIALTIMEOUT':_0x3600eb['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xa5c0('0x1c'),_0x3600eb['dialQueueProject2']?'g':'',_['isEmpty'](_0x3600eb[_0xa5c0('0x1d')])?'':_0xa5c0('0x1e')),'XMD-DIALURL':_0x3600eb[_0xa5c0('0x1f')]||'','XMD-AGI':_0x3600eb['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3600eb[_0xa5c0('0x20')]):_0xa5c0('0x21'),'XMD-AGIAFTER':_0x3600eb[_0xa5c0('0x22')]?util[_0xa5c0('0x11')](_0xa5c0('0x23'),ipAgi,_0x3600eb['dialQueueProject2']):_0xa5c0('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x4815b4?_0x4815b4['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4815b4?_0x4815b4['originatecalleridname']:'','XMD-DESTINATION':_0xa5c0('0x24'),'SIPADDHEADER':_0xa5c0('0x25')};if(!_[_0xa5c0('0x10')](_0x3600eb[_0xa5c0('0x1d')])){_0x2772ee[util['format']('%s',_0xa5c0('0x26'))]=_0x3600eb[_0xa5c0('0x1d')];_0x2772ee[util[_0xa5c0('0x11')]('%s',_0xa5c0('0x27'))]=_0x5bbe31;}return _0x2772ee;};exports[_0xa5c0('0x28')]=function(_0x80596a){var _0x4cacc3={};for(var _0x34c07f in _0x80596a){if(_0x80596a['hasOwnProperty'](_0x34c07f)){_0x4cacc3[util[_0xa5c0('0x11')]('%s',_[_0xa5c0('0x29')](_0x34c07f))]=_0x80596a[_0x34c07f];}}return{'variables':_0x4cacc3};};exports[_0xa5c0('0x2a')]=function(_0x45e5d4,_0x2c1981){if(!_[_0xa5c0('0x15')](_0x45e5d4)){if(_0x45e5d4['hasOwnProperty'](_0xa5c0('0x2b'))){if(_0x45e5d4[_0xa5c0('0x2b')]>0x0){_0x45e5d4['originated']-=0x1;}else{logger[_0xa5c0('0x7')](_0xa5c0('0x2c'),_0x2c1981);}}}else{logger[_0xa5c0('0x7')](_0xa5c0('0x2d'),_0x2c1981);}};exports[_0xa5c0('0x2e')]=function(_0xfd2f26){var _0x234037=moment()[_0xa5c0('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0xfd2f26[_0xa5c0('0x2f')]=0xd;_0xfd2f26[_0xa5c0('0x30')]=_0xa5c0('0x31');_0xfd2f26['starttime']=_0x234037;_0xfd2f26[_0xa5c0('0x32')]=_0x234037;_0xfd2f26[_0xa5c0('0x33')]=_0x234037;};exports['logAgent']=function(_0x2125c5,_0x54855a,_0x477ab3){var _0x3f6ce2=moment()[_0xa5c0('0x11')](_0xa5c0('0x34'));_0x2125c5[_0xa5c0('0x2f')]=_0x54855a;_0x2125c5[_0xa5c0('0x30')]=_0x477ab3;_0x2125c5[_0xa5c0('0x32')]=_0x3f6ce2;_0x2125c5[_0xa5c0('0x35')]=utils[_0xa5c0('0x36')](_0x2125c5['responsetime'],_0x2125c5['starttime']);};exports[_0xa5c0('0x37')]=function(_0x38dca3,_0x596bc3,_0x4475b0){_0x38dca3[_0xa5c0('0x38')]=_0x596bc3;_0x38dca3[_0xa5c0('0x39')]=_0x4475b0;};exports[_0xa5c0('0x3a')]=function(_0x393888,_0x1a72a4,_0x5bf456){var _0x4045f3=moment()[_0xa5c0('0x11')](_0xa5c0('0x34'));_0x393888[_0xa5c0('0x2f')]=_0x1a72a4;_0x393888[_0xa5c0('0x30')]=_0x5bf456;_0x393888['responsetime']=_0x393888[_0xa5c0('0x32')]?_0x393888['responsetime']:_0x4045f3;_0x393888[_0xa5c0('0x33')]=_0x393888[_0xa5c0('0x33')]?_0x393888[_0xa5c0('0x33')]:_0x4045f3;_0x393888[_0xa5c0('0x35')]=utils[_0xa5c0('0x36')](_0x393888['responsetime']||0x0,_0x393888['starttime']||0x0);_0x393888['talktime']=_0x393888['answertime']?utils[_0xa5c0('0x36')](_0x393888[_0xa5c0('0x33')],_0x393888[_0xa5c0('0x3b')]):0x0;};exports[_0xa5c0('0x3c')]=function(_0x3077f6){return _0x3077f6===_0xa5c0('0x3d');};exports[_0xa5c0('0x3e')]=function(_0x21791e,_0x62cbab,_0x58e7d3,_0x4aa0e5,_0x1fb401){var _0x45fb14=_0x4aa0e5?_0xa5c0('0x3f'):_0x21791e[_0xa5c0('0x40')];_0x45fb14=_0x1fb401?_0xa5c0('0x41'):_0x45fb14;return{'actionid':_0x21791e[_0xa5c0('0x42')],'action':'originate','channel':_0x21791e['channelAgent'],'callerid':util[_0xa5c0('0x11')]('\x22%s\x22\x20<%s>',_0x45fb14,_0x21791e[_0xa5c0('0x18')]),'Exten':_0xa5c0('0x24'),'Context':_0xa5c0('0x43'),'Priority':'1','variable':_0x58e7d3,'timeout':(_0x62cbab[_0xa5c0('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x21791e[_0xa5c0('0x42')]};};exports[_0xa5c0('0x45')]=function(_0x146fd1){return _0x146fd1['countbusyretry']+_0x146fd1[_0xa5c0('0x46')]+_0x146fd1[_0xa5c0('0x47')]+_0x146fd1[_0xa5c0('0x48')]+_0x146fd1[_0xa5c0('0x49')];};exports[_0xa5c0('0x4a')]=function(_0x318ea4){var _0xb7ce98=_[_0xa5c0('0x4b')](_0x318ea4);_0xb7ce98[_0xa5c0('0x2f')]=0xf;_0xb7ce98[_0xa5c0('0x30')]=_0xa5c0('0x4c');return _0xb7ce98;};exports[_0xa5c0('0x4d')]=function(_0x12cdf8,_0x5d1468,_0x4e8046){var _0x285553={};_0x285553[_0x5d1468]=_0x12cdf8[_0x5d1468];_0x285553[_0xa5c0('0x4e')]=![];_0x285553[_0xa5c0('0x4f')]=moment()[_0xa5c0('0x50')](_0x4e8046,_0xa5c0('0x51'))[_0xa5c0('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x285553[_0xa5c0('0x19')]=_0x12cdf8[_0xa5c0('0x19')];_0x285553[_0xa5c0('0x52')]=_0x12cdf8[_0xa5c0('0x52')];_0x285553['VoiceQueueId']=_0x12cdf8[_0xa5c0('0x1b')]||undefined;return _0x285553;};exports[_0xa5c0('0x53')]=function(_0x337f79,_0x4c7170){if(!_[_0xa5c0('0x15')](_0x337f79)){if(_0x337f79['pTalking']>0x0){_0x337f79['pTalking']-=0x1;}else{logger[_0xa5c0('0x7')](_0x4c7170,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa5c0('0x7')](_0x4c7170,_0xa5c0('0x54'));}};exports[_0xa5c0('0x55')]=function(_0xc93d02){if(_0xc93d02<=0x0){return!![];}return![];};function buildObj(_0x2bb9f8,_0x5a0a82,_0x2c2f57){_0x2bb9f8[_0xa5c0('0x56')]=_0x5a0a82;_0x2bb9f8[_0xa5c0('0x17')]=_0x2bb9f8[_0xa5c0('0x57')];_0x2bb9f8[_0xa5c0('0x58')]=_0x2bb9f8['channelAgent'];_0x2bb9f8[_0xa5c0('0x59')]='voice';if(_0x2c2f57){_0x2bb9f8[_0xa5c0('0x5a')]=_0x2c2f57[_0xa5c0('0x5a')];}return _0x2bb9f8;}exports['buildObj']=buildObj;exports[_0xa5c0('0x5b')]=function(_0x22969b){var _0xaee3fb=[];for(var _0x104c60 in _0x22969b){if(_0x22969b[_0xa5c0('0x5c')](_0x104c60)){if(!_[_0xa5c0('0x15')](_0x22969b[_0x104c60])&&_0x22969b[_0x104c60][_0xa5c0('0x2f')]==='not_inuse'&&_0x22969b[_0x104c60][_0xa5c0('0x5d')]===_0xa5c0('0x5e')){_0xaee3fb[_0xa5c0('0x5f')](_0x22969b[_0x104c60]['id']);}}}return _0xaee3fb;};exports[_0xa5c0('0x60')]=function(_0x1b2e5f){var _0x3aa715=moment()['milliseconds'](0x0);var _0x403ad7=moment(_0x1b2e5f)['milliseconds'](0x0);return _0x3aa715['diff'](_0x403ad7,_0xa5c0('0x61'));};exports[_0xa5c0('0x62')]=function(_0x229c5f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x229c5f[_0xa5c0('0x19')],'ListId':_0x229c5f['ListId'],'VoiceQueueId':_0x229c5f[_0xa5c0('0x1b')]||undefined,'CampaignId':_0x229c5f[_0xa5c0('0x63')]||undefined};};exports[_0xa5c0('0x64')]=function(_0x416792){if(_0x416792===_0xa5c0('0x42')||_0x416792==='idContact'||_0x416792===_0xa5c0('0x57')||_0x416792==='type'||_0x416792==='campaigntype'||_0x416792===_0xa5c0('0x65')||_0x416792==='membername'||_0x416792==='channelAgent'||_0x416792===_0xa5c0('0x40')||_0x416792==='active'||_0x416792===_0xa5c0('0x18')||_0x416792===_0xa5c0('0x4f')||_0x416792===_0xa5c0('0x66')||_0x416792===_0xa5c0('0x46')||_0x416792===_0xa5c0('0x47')||_0x416792===_0xa5c0('0x67')||_0x416792===_0xa5c0('0x68')||_0x416792===_0xa5c0('0x69')||_0x416792===_0xa5c0('0x6a')||_0x416792===_0xa5c0('0x6b')||_0x416792===_0xa5c0('0x19')||_0x416792==='ListId'||_0x416792===_0xa5c0('0x39')||_0x416792===_0xa5c0('0x1b')||_0x416792===_0xa5c0('0x6c')||_0x416792===_0xa5c0('0x6d')||_0x416792===_0xa5c0('0x6e')||_0x416792===_0xa5c0('0x6f')||_0x416792===_0xa5c0('0x70')||_0x416792===_0xa5c0('0x71')||_0x416792===_0xa5c0('0x72')||_0x416792==='xmd-dialoptions'||_0x416792===_0xa5c0('0x73')||_0x416792===_0xa5c0('0x74')||_0x416792===_0xa5c0('0x75')||_0x416792===_0xa5c0('0x76')||_0x416792===_0xa5c0('0x77')||_0x416792===_0xa5c0('0x78')||_0x416792===_0xa5c0('0x79')||_0x416792===_0xa5c0('0x7a')||_0x416792==='rtpaudioqosbridged'||_0x416792===_0xa5c0('0x7b')||_0x416792===_0xa5c0('0x7c')||_0x416792===_0xa5c0('0x7d')||_0x416792===_0xa5c0('0x7e')||_0x416792===_0xa5c0('0x7f')||_0x416792==='rtpaudioqosrttbridged'||_0x416792==='rtpaudioqos'||_0x416792==='rtpaudioqosbridged'||_0x416792===_0xa5c0('0x7b')||_0x416792==='rtpaudioqosjitterbridged'||_0x416792===_0xa5c0('0x7d')||_0x416792===_0xa5c0('0x7e')||_0x416792===_0xa5c0('0x7f')||_0x416792===_0xa5c0('0x80')||_0x416792===_0xa5c0('0x81')||_0x416792===_0xa5c0('0x82')||_0x416792==='state'||_0x416792==='statedesc'){return![];}return!![];};exports[_0xa5c0('0x83')]=function(_0x53b8d9,_0x4f2e6e){var _0x3f9b7b,_0x5058cc,_0x18dacb;if(_0x4f2e6e<=0x0){_0x4f2e6e=0x1;}_0x3f9b7b=new RegExp('\x5cw{0,'+_0x4f2e6e+'}$');_0x5058cc=Math[_0xa5c0('0x84')](0xa,_0x4f2e6e-0x1);_0x18dacb=Math[_0xa5c0('0x84')](0xa,_0x4f2e6e)-0x1;return util[_0xa5c0('0x11')]('%s',_[_0xa5c0('0x85')](_0x53b8d9,_0x3f9b7b,_[_0xa5c0('0x86')](_0x5058cc,_0x18dacb)));};exports['extractCalleridName']=function(_0x3ae63c){var _0x4cee35=_0x3ae63c['match'](/"(.*?)"/);return _0x4cee35?_0x4cee35[0x1]:_0x3ae63c;};exports[_0xa5c0('0x87')]=function(_0x5d0604){var _0x1faefc=_0x5d0604[_0xa5c0('0x88')](/<(.*?)>/);return _0x1faefc?_0x1faefc[0x1]:_0x5d0604;};function buildNoAnswerEventPayload(_0x3e8314,_0x2a94f8){var _0x4bd07f=buildObj(_0x3e8314,_0xa5c0('0x89'));if(!_[_0xa5c0('0x10')](_0x2a94f8[_0xa5c0('0x8a')])){Object[_0xa5c0('0x8b')](_0x2a94f8[_0xa5c0('0x8a')])[_0xa5c0('0x8c')](function(_0x1ed08a){_0x4bd07f[_0x1ed08a['toLowerCase']()]=_0x2a94f8[_0xa5c0('0x8a')][_0x1ed08a];});}return _0x4bd07f;}exports[_0xa5c0('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4746a99..cef8082 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 _0x60a4=['reload','voicequeuechannel','voicechannel','string','number','queueremove','queuepause','boolean'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x60a4,0x15b));var _0x460a=function(_0x31ce3d,_0x581047){_0x31ce3d=_0x31ce3d-0x0;var _0x203d95=_0x60a4[_0x31ce3d];return _0x203d95;};'use strict';exports['queueadd']={'queue':{'type':_0x460a('0x0'),'required':!![]},'interface':{'type':_0x460a('0x0'),'required':!![]},'membername':{'type':_0x460a('0x0'),'required':!![]},'penalty':{'type':_0x460a('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x460a('0x2')]={'queue':{'type':_0x460a('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x460a('0x3')]={'interface':{'type':_0x460a('0x0'),'required':!![]},'paused':{'type':_0x460a('0x4')},'reason':{'type':_0x460a('0x0'),'required':![]}};exports[_0x460a('0x5')]={'module':{'type':_0x460a('0x0'),'required':![]}};exports[_0x460a('0x6')]={'uniqueid':{'type':_0x460a('0x0'),'required':!![]}};exports[_0x460a('0x7')]={'uniqueid':{'type':_0x460a('0x0'),'required':!![]},'filename':{'type':_0x460a('0x0')},'format':{'type':_0x460a('0x0')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x460a('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x460a('0x0'),'required':!![]},'exten':{'type':_0x460a('0x0'),'required':!![]},'context':{'type':_0x460a('0x0')}}; \ No newline at end of file +var _0x7572=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7572,0xf7));var _0x2757=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x7572[_0x1809c5];return _0x5254a4;};'use strict';exports[_0x2757('0x0')]={'queue':{'type':_0x2757('0x1'),'required':!![]},'interface':{'type':_0x2757('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x2757('0x2'),'required':![]},'paused':{'type':_0x2757('0x3'),'required':![]}};exports[_0x2757('0x4')]={'queue':{'type':_0x2757('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x2757('0x5')]={'interface':{'type':_0x2757('0x1'),'required':!![]},'paused':{'type':_0x2757('0x3')},'reason':{'type':_0x2757('0x1'),'required':![]}};exports[_0x2757('0x6')]={'module':{'type':_0x2757('0x1'),'required':![]}};exports[_0x2757('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2757('0x8')]={'uniqueid':{'type':_0x2757('0x1'),'required':!![]},'filename':{'type':_0x2757('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x2757('0x1')}};exports[_0x2757('0x9')]={'uniqueid':{'type':_0x2757('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x2757('0x1'),'required':!![]},'exten':{'type':_0x2757('0x1'),'required':!![]},'context':{'type':_0x2757('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6dcc6ec..2998528 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0x0b0e[_0x34b6aa];return _0x3ead29;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x4f45b8,_0x5a4d79){var _0x4a97e0=function(_0x487cc5){while(--_0x487cc5){_0x4f45b8['push'](_0x4f45b8['shift']());}};_0x4a97e0(++_0x5a4d79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ce859,_0x2ae1f1){_0x1ce859=_0x1ce859-0x0;var _0x5b2df0=_0x5f2f[_0x1ce859];return _0x5b2df0;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index bf6bf19..2f8fcbd 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 _0x665d=['assign','hasOwnProperty'];(function(_0x1ec1fa,_0x3efb52){var _0x3e00f0=function(_0x5f2489){while(--_0x5f2489){_0x1ec1fa['push'](_0x1ec1fa['shift']());}};_0x3e00f0(++_0x3efb52);}(_0x665d,0x17a));var _0xd665=function(_0xa89c3e,_0x144268){_0xa89c3e=_0xa89c3e-0x0;var _0x48072f=_0x665d[_0xa89c3e];return _0x48072f;};'use strict';function mergeDBDataToRealtime(_0x5d3145,_0x316a5c){var _0x52e40e=Object[_0xd665('0x0')]({},_0x5d3145);for(var _0x202c54 in _0x316a5c){if(_0x52e40e[_0xd665('0x1')](_0x202c54)){_0x52e40e[_0x202c54]=_0x316a5c[_0x202c54];}}return _0x52e40e;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xc5e7=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0xc5e7,0x1a3));var _0x7c5e=function(_0x6e5ca9,_0x581255){_0x6e5ca9=_0x6e5ca9-0x0;var _0x39ecf8=_0xc5e7[_0x6e5ca9];return _0x39ecf8;};'use strict';function mergeDBDataToRealtime(_0x274b51,_0x52c6f2){var _0x433f45=Object['assign']({},_0x274b51);for(var _0x5c0002 in _0x52c6f2){if(_0x433f45[_0x7c5e('0x0')](_0x5c0002)){_0x433f45[_0x5c0002]=_0x52c6f2[_0x5c0002];}}return _0x433f45;}exports[_0x7c5e('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 709fc80..6dbda80 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 _0xaa1f=['lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','calleridnum','outbound','internal','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','channel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','transfereelinkedid','uniqueid','linkedid','type','UserId','length','monitorFilename','createdAt','calleridname','connectedlinename','membername','originatecalleridnum','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','moment','util','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','format','SIP/%s','name','assigned'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0xaa1f,0xf7));var _0xfaa1=function(_0x53cd13,_0xd5355e){_0x53cd13=_0x53cd13-0x0;var _0xc285e2=_0xaa1f[_0x53cd13];return _0xc285e2;};'use strict';var _=require('lodash');var moment=require(_0xfaa1('0x0'));var util=require(_0xfaa1('0x1'));var config=require('../../../config/environment');var ami=require(_0xfaa1('0x2'));var RpcVoiceAgentReport=require(_0xfaa1('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xfaa1('0x4'));var RpcVoiceQueueReport=require(_0xfaa1('0x5'));var RpcVoiceRecording=require(_0xfaa1('0x6'));var RpcVoiceTransferReport=require(_0xfaa1('0x7'));var VoiceQueueReport=require(_0xfaa1('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xfaa1('0x9'));var VoiceDialReport=require(_0xfaa1('0xa'));var UserReport=require('./userReport');function Report(_0x51ca6d){this[_0xfaa1('0xb')]=_0x51ca6d;this[_0xfaa1('0xc')]=_0x51ca6d['agents'];this[_0xfaa1('0xd')]=_0x51ca6d[_0xfaa1('0xd')];}Report[_0xfaa1('0xe')][_0xfaa1('0xf')]=function(_0x377b73){var _0x378da6=new VoiceQueueReport(this[_0xfaa1('0xb')]);var _0x283b3b=new VoiceAgentReport(this['realtime']);var _0x3ac488=new VoiceDialReport(this['realtime']);var _0x22aa64=new VoiceCallReport(this['realtime']);var _0x1ca9cb=new UserReport(this[_0xfaa1('0xb')]);if(config['xdr']&&config['xdr'][_0xfaa1('0x10')]){ami['on'](_0xfaa1('0x11'),this[_0xfaa1('0x12')]['bind'](this));ami['on'](_0xfaa1('0x13'),this[_0xfaa1('0x14')][_0xfaa1('0x15')](this));ami['on'](_0xfaa1('0x16'),this[_0xfaa1('0x17')][_0xfaa1('0x15')](this));ami['on'](_0xfaa1('0x18'),this[_0xfaa1('0x19')][_0xfaa1('0x15')](this));ami['on'](_0xfaa1('0x1a'),this[_0xfaa1('0x1b')]['bind'](this));ami['on'](_0xfaa1('0x1c'),this[_0xfaa1('0x1d')][_0xfaa1('0x15')](this));}};Report[_0xfaa1('0xe')][_0xfaa1('0x1e')]=function(_0x479fe7){var _0x200bb1;_0x200bb1=_[_0xfaa1('0x1f')](this[_0xfaa1('0xc')],function(_0x26713c){return _0x26713c[_0xfaa1('0x20')]==_0x479fe7||_0x26713c['name']==_0x479fe7;});if(_[_0xfaa1('0x21')](_0x200bb1)){var _0x2b8d51=_[_0xfaa1('0x1f')](this[_0xfaa1('0xd')],function(_0x573d5f){return _0x573d5f[_0xfaa1('0x20')]==_0x479fe7||_0x573d5f['name']==_0x479fe7;});if(_0x2b8d51){_0x200bb1=_[_0xfaa1('0x1f')](this[_0xfaa1('0xc')],function(_0x4176ca){return _0x4176ca['interface']==util[_0xfaa1('0x22')](_0xfaa1('0x23'),_0x2b8d51[_0xfaa1('0x24')]);});}}return _0x200bb1;};Report[_0xfaa1('0xe')][_0xfaa1('0x12')]=function(_0x27dbe2){for(var _0x3d4345=0x0;_0x3d4345<_0x27dbe2['length'];_0x3d4345+=0x1){var _0x21bd98=this['findAgent'](_0x27dbe2[_0x3d4345]['connectedlinenum']);if(_0x21bd98){_0x27dbe2[_0x3d4345][_0xfaa1('0x20')]=_0x21bd98[_0xfaa1('0x20')];_0x27dbe2[_0x3d4345][_0xfaa1('0x25')]=!![];_0x27dbe2[_0x3d4345][_0xfaa1('0x26')]=_0x21bd98['name'];_0x27dbe2[_0x3d4345][_0xfaa1('0x27')]=_[_0xfaa1('0x21')](_0x21bd98[_0xfaa1('0x27')])?util[_0xfaa1('0x22')]('SIP/%s',_0x21bd98[_0xfaa1('0x24')]):_0x21bd98['interface'];if(_0x27dbe2[_0x3d4345][_0xfaa1('0x28')]){_0x27dbe2[_0x3d4345][_0xfaa1('0x29')]=moment()['format'](_0xfaa1('0x2a'));}if(_0x27dbe2[_0x3d4345][_0xfaa1('0x2b')]){_0x27dbe2[_0x3d4345][_0xfaa1('0x2c')]=moment()[_0xfaa1('0x22')](_0xfaa1('0x2a'));}RpcMemberReport[_0xfaa1('0x12')](_0x27dbe2[_0x3d4345]);}RpcVoiceQueueReport[_0xfaa1('0x2d')](_0x27dbe2[_0x3d4345]);}};function extractCalleridNumber(_0x4ceddb){var _0x397c2e=_0x4ceddb[_0xfaa1('0x2e')](/<(.*?)>/);return _0x397c2e?_0x397c2e[0x1]:_0x4ceddb;}Report[_0xfaa1('0xe')][_0xfaa1('0x2f')]=function(_0x531582){for(var _0xa18a71=0x0;_0xa18a71','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','create','isArray','forEach'];(function(_0x139485,_0x2d0aac){var _0x221cb9=function(_0x38b8de){while(--_0x38b8de){_0x139485['push'](_0x139485['shift']());}};_0x221cb9(++_0x2d0aac);}(_0xe63e,0x1cc));var _0xee63=function(_0x2d5ed1,_0x577fd7){_0x2d5ed1=_0x2d5ed1-0x0;var _0x2fdc13=_0xe63e[_0x2d5ed1];return _0x2fdc13;};'use strict';var _=require('lodash');var moment=require(_0xee63('0x0'));var util=require(_0xee63('0x1'));var config=require(_0xee63('0x2'));var ami=require(_0xee63('0x3'));var RpcVoiceAgentReport=require(_0xee63('0x4'));var RpcVoiceCallReport=require(_0xee63('0x5'));var RpcVoiceDialReport=require(_0xee63('0x6'));var RpcMemberReport=require(_0xee63('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xee63('0x8'));var RpcVoiceTransferReport=require(_0xee63('0x9'));var VoiceQueueReport=require(_0xee63('0xa'));var VoiceCallReport=require(_0xee63('0xb'));var VoiceAgentReport=require(_0xee63('0xc'));var VoiceDialReport=require(_0xee63('0xd'));var UserReport=require(_0xee63('0xe'));function Report(_0x147be1){this[_0xee63('0xf')]=_0x147be1;this[_0xee63('0x10')]=_0x147be1[_0xee63('0x10')];this[_0xee63('0x11')]=_0x147be1[_0xee63('0x11')];}Report['prototype'][_0xee63('0x12')]=function(_0x5546ce){var _0x36d98a=new VoiceQueueReport(this[_0xee63('0xf')]);var _0x490604=new VoiceAgentReport(this[_0xee63('0xf')]);var _0x459a1f=new VoiceDialReport(this[_0xee63('0xf')]);var _0x5edae8=new VoiceCallReport(this[_0xee63('0xf')]);var _0x3968e1=new UserReport(this['realtime']);if(config[_0xee63('0x13')]&&config['xdr'][_0xee63('0x14')]){ami['on'](_0xee63('0x15'),this['voiceQueueReport'][_0xee63('0x16')](this));ami['on'](_0xee63('0x17'),this['voiceCallReport'][_0xee63('0x16')](this));ami['on'](_0xee63('0x18'),this[_0xee63('0x19')][_0xee63('0x16')](this));ami['on']('custom:voiceDialReport',this[_0xee63('0x1a')][_0xee63('0x16')](this));ami['on'](_0xee63('0x1b'),this[_0xee63('0x1c')][_0xee63('0x16')](this));ami['on']('attendedtransfer',this[_0xee63('0x1d')][_0xee63('0x16')](this));}};Report[_0xee63('0x1e')][_0xee63('0x1f')]=function(_0x418b39){var _0x2bcbfe;_0x2bcbfe=_['find'](this['agents'],function(_0xf06424){return _0xf06424[_0xee63('0x20')]==_0x418b39||_0xf06424[_0xee63('0x21')]==_0x418b39;});if(_['isNil'](_0x2bcbfe)){var _0x449681=_[_0xee63('0x22')](this['telephones'],function(_0x636836){return _0x636836[_0xee63('0x20')]==_0x418b39||_0x636836[_0xee63('0x21')]==_0x418b39;});if(_0x449681){_0x2bcbfe=_[_0xee63('0x22')](this[_0xee63('0x10')],function(_0x37b254){return _0x37b254['interface']==util['format'](_0xee63('0x23'),_0x449681['name']);});}}return _0x2bcbfe;};Report['prototype'][_0xee63('0x24')]=function(_0x5c4ce9){for(var _0x5310ab=0x0;_0x5310ab<_0x5c4ce9['length'];_0x5310ab+=0x1){var _0x29422e=this[_0xee63('0x1f')](_0x5c4ce9[_0x5310ab]['connectedlinenum']);if(_0x29422e){_0x5c4ce9[_0x5310ab][_0xee63('0x20')]=_0x29422e[_0xee63('0x20')];_0x5c4ce9[_0x5310ab][_0xee63('0x25')]=!![];_0x5c4ce9[_0x5310ab][_0xee63('0x26')]=_0x29422e['name'];_0x5c4ce9[_0x5310ab][_0xee63('0x27')]=_[_0xee63('0x28')](_0x29422e[_0xee63('0x27')])?util[_0xee63('0x29')]('SIP/%s',_0x29422e[_0xee63('0x21')]):_0x29422e[_0xee63('0x27')];if(_0x5c4ce9[_0x5310ab]['queuecallercomplete']){_0x5c4ce9[_0x5310ab]['queuecallercompleteAt']=moment()[_0xee63('0x29')](_0xee63('0x2a'));}if(_0x5c4ce9[_0x5310ab][_0xee63('0x2b')]){_0x5c4ce9[_0x5310ab][_0xee63('0x2c')]=moment()[_0xee63('0x29')](_0xee63('0x2a'));}RpcMemberReport[_0xee63('0x24')](_0x5c4ce9[_0x5310ab]);}RpcVoiceQueueReport['create'](_0x5c4ce9[_0x5310ab]);}};function extractCalleridNumber(_0x307e35){var _0x4bce2c=_0x307e35[_0xee63('0x2d')](/<(.*?)>/);return _0x4bce2c?_0x4bce2c[0x1]:_0x307e35;}Report[_0xee63('0x1e')]['getAgentByInternal']=function(_0x19aec2){for(var _0x20007d=0x0;_0x20007d0x0?!![]:![];if(!_0x224e89){return this['syncQueueSummaryComplete'](this[_0x6e57('0x15')][_0x6e57('0x72')]);}};VoiceQueueReport[_0x6e57('0x3c')]['syncQueueMember']=function(_0x1cd1fd){var _0x57be8e=this[_0x6e57('0x15')]['id'];if(this['summary'][_0x6e57('0x64')][_0x57be8e]&&this['summary'][_0x6e57('0x64')][_0x57be8e][_0x1cd1fd['actionid']]){this[_0x6e57('0x15')][_0x6e57('0x64')][_0x57be8e][_0x1cd1fd[_0x6e57('0x63')]][_0x6e57('0x10')]['push'](_0x1cd1fd);}};VoiceQueueReport[_0x6e57('0x3c')][_0x6e57('0x18')]=function(_0x4b13e3){var _0x3d9e9c=this;try{if(this[_0x6e57('0x5e')](_0x4b13e3)&&this[_0x6e57('0x5e')](_0x4b13e3[_0x6e57('0x6c')])){logger[_0x6e57('0x50')](_0x6e57('0x73'),util['inspect'](_0x4b13e3,{'showHidden':![],'depth':null}));var _0x419fe8=this[_0x6e57('0x13')][_0x4b13e3[_0x6e57('0x6c')]];if(_0x419fe8){logger[_0x6e57('0x50')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x419fe8[_0x6e57('0x5c')]);this[_0x6e57('0x15')]['queues'][_0x419fe8[_0x6e57('0x5c')]]={'summaryEvent':_0x4b13e3};this[_0x6e57('0x15')][_0x6e57('0x71')]+=0x1;return ami[_0x6e57('0x40')]({'action':_0x6e57('0x64'),'queue':_0x419fe8[_0x6e57('0x5c')]})[_0x6e57('0x74')](function(_0x343ab2){if(!_0x3d9e9c[_0x6e57('0x15')][_0x6e57('0x64')][_0x4b13e3[_0x6e57('0x63')]]){_0x3d9e9c[_0x6e57('0x15')][_0x6e57('0x64')][_0x4b13e3[_0x6e57('0x63')]]={};}_0x3d9e9c[_0x6e57('0x15')][_0x6e57('0x64')][_0x4b13e3[_0x6e57('0x63')]][_0x343ab2['actionid']]={'queue':_0x419fe8['name'],'agents':[]};})[_0x6e57('0x42')](function(_0x400c75){throw _0x400c75;});}}}catch(_0x3de7c8){logger[_0x6e57('0x45')](_0x6e57('0x65'),util[_0x6e57('0x48')](_0x3de7c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e57('0x3c')]['syncQueueSummaryComplete']=function(_0x900f1a){if(this[_0x6e57('0x15')]['statusRequests']>0x0){this[_0x6e57('0x15')][_0x6e57('0x72')]=_0x900f1a;return;}logger[_0x6e57('0x50')](_0x6e57('0x75'),util[_0x6e57('0x48')](_0x900f1a,{'showHidden':![],'depth':null}));this[_0x6e57('0x15')]=initializeSummary();ami[_0x6e57('0x4e')](_0x6e57('0x76'),{});};VoiceQueueReport[_0x6e57('0x3c')]['syncQueueCallerJoin']=function(_0x1f3355){try{if(this[_0x6e57('0x5e')](_0x1f3355)){logger[_0x6e57('0x50')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1f3355[_0x6e57('0x53')],util[_0x6e57('0x48')](_0x1f3355,{'showHidden':![],'depth':null}));if(_[_0x6e57('0x5f')](this[_0x6e57('0xe')][_0x1f3355[_0x6e57('0x53')]])){this[_0x6e57('0xe')][_0x1f3355['uniqueid']]=[];}if(_[_0x6e57('0x5f')](this[_0x6e57('0x11')][_0x1f3355['uniqueid']])){this[_0x6e57('0x11')][_0x1f3355['uniqueid']]={};}var _0x413979=new QueueReport();_0x413979[_0x6e57('0x6c')]=_0x1f3355[_0x6e57('0x6c')];_0x413979[_0x6e57('0x6f')]=this[_0x6e57('0x13')][_0x413979['queue']]&&this['voiceQueues'][_0x413979[_0x6e57('0x6c')]][_0x6e57('0x6f')]?this[_0x6e57('0x13')][_0x413979[_0x6e57('0x6c')]][_0x6e57('0x6f')]||_0x6e57('0x6d'):_0x6e57('0x6d');_0x413979[_0x6e57('0x77')]=moment()['format'](_0x6e57('0x78'));_0x413979[_0x6e57('0x79')]=_0x1f3355[_0x6e57('0x79')];_0x413979['count']=_0x1f3355[_0x6e57('0x7a')];_0x413979[_0x6e57('0x53')]=_0x1f3355['uniqueid'];logger[_0x6e57('0x7b')](_0x6e57('0x7c'),_0x413979['queue'],_0x413979[_0x6e57('0x6f')]);Object[_0x6e57('0x6a')](_0x413979,_[_0x6e57('0x7d')](_0x1f3355,_[_0x6e57('0x7e')](_0x413979)));this['queueReports'][_0x1f3355['uniqueid']]['push'](_0x413979);this['channels'][_0x1f3355[_0x6e57('0x53')]]=_0x413979;this[_0x6e57('0x4f')](_0x413979,_0x6e57('0x1f'));}}catch(_0x4b191a){logger[_0x6e57('0x45')](_0x6e57('0x7f'),_0x1f3355[_0x6e57('0x53')],util[_0x6e57('0x48')](_0x4b191a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e57('0x3c')][_0x6e57('0x22')]=function(_0x877345){try{if(this[_0x6e57('0x5e')](_0x877345)){logger[_0x6e57('0x50')](_0x6e57('0x80'),_0x877345[_0x6e57('0x53')],util[_0x6e57('0x48')](_0x877345,{'showHidden':![],'depth':null}));if(this[_0x6e57('0xe')][_0x877345[_0x6e57('0x53')]]){var _0x42793e=_['last'](this['queueReports'][_0x877345['uniqueid']]);_0x42793e[_0x6e57('0x3b')]=![];_0x42793e[_0x6e57('0x81')]=null;_0x42793e[_0x6e57('0x82')]=_0x877345[_0x6e57('0x82')];_0x42793e[_0x6e57('0x83')]=_0x877345['originalposition'];_0x42793e['queuecallerabandon']=!![];_0x42793e[_0x6e57('0x84')]=moment()[_0x6e57('0x54')](_0x6e57('0x78'));_0x42793e['queuecallerexitreason']=_0x6e57('0x85');_0x42793e[_0x6e57('0x86')]=null;logger[_0x6e57('0x7b')](_0x6e57('0x87'),_0x42793e[_0x6e57('0x6c')],_0x42793e['type']);this[_0x6e57('0x11')][_0x877345[_0x6e57('0x53')]]=_0x42793e;this['emitVoiceQueueChannelRemove'](_0x42793e,_0x6e57('0x21'));}}}catch(_0x320199){logger[_0x6e57('0x45')](_0x6e57('0x80'),_0x877345[_0x6e57('0x53')],util[_0x6e57('0x48')](_0x320199,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e57('0x3c')][_0x6e57('0x24')]=function(_0x2d9109){try{if(this[_0x6e57('0x5e')](_0x2d9109)){logger[_0x6e57('0x50')](_0x6e57('0x88'),_0x2d9109[_0x6e57('0x53')],util[_0x6e57('0x48')](_0x2d9109,{'showHidden':![],'depth':null}));if(this[_0x6e57('0xe')][_0x2d9109['uniqueid']]){var _0x2d671b=_[_0x6e57('0x89')](this[_0x6e57('0xe')][_0x2d9109[_0x6e57('0x53')]]);_0x2d671b['queuecallerleaveAt']=moment()[_0x6e57('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d671b[_0x6e57('0x8a')]=_0x2d9109[_0x6e57('0x8a')];_0x2d671b['connectedlinename']=_0x2d9109['connectedlinename'];logger[_0x6e57('0x7b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2d671b[_0x6e57('0x6c')],_0x2d671b[_0x6e57('0x6f')],_0x2d9109[_0x6e57('0x8a')],_0x2d9109[_0x6e57('0x8b')]);this[_0x6e57('0x11')][_0x2d9109[_0x6e57('0x53')]]=_0x2d671b;this[_0x6e57('0x4f')](_0x2d671b,'queuecallerleave');}}}catch(_0x2af0a3){logger[_0x6e57('0x45')](_0x6e57('0x88'),_0x2d9109[_0x6e57('0x53')],util[_0x6e57('0x48')](_0x2af0a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e57('0x3c')][_0x6e57('0x28')]=function(_0x4b42a4){try{if(this[_0x6e57('0x5e')](_0x4b42a4)){logger['debug'](_0x6e57('0x8c'),_0x4b42a4[_0x6e57('0x53')],util[_0x6e57('0x48')](_0x4b42a4,{'showHidden':![],'depth':null}));if(this[_0x6e57('0xe')][_0x4b42a4[_0x6e57('0x53')]]){var _0xe2e9e4=_[_0x6e57('0x89')](this[_0x6e57('0xe')][_0x4b42a4[_0x6e57('0x53')]]);_0xe2e9e4[_0x6e57('0x3b')]=!![];_0xe2e9e4[_0x6e57('0x8d')]=_0x6e57('0x8e');logger[_0x6e57('0x7b')](_0x6e57('0x8f'),_0xe2e9e4[_0x6e57('0x6c')],_0xe2e9e4[_0x6e57('0x6f')]);}}}catch(_0xbffa1c){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x4b42a4['uniqueid'],util[_0x6e57('0x48')](_0xbffa1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e57('0x3c')][_0x6e57('0x26')]=function(_0x429399){try{if(this[_0x6e57('0x5e')](_0x429399)){logger[_0x6e57('0x50')](_0x6e57('0x90'),_0x429399['uniqueid'],util[_0x6e57('0x48')](_0x429399,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x429399[_0x6e57('0x53')]]){var _0x267551=_[_0x6e57('0x89')](this[_0x6e57('0xe')][_0x429399['uniqueid']]);_0x267551[_0x6e57('0x21')]=![];_0x267551['queuecallerabandonAt']=null;_0x267551[_0x6e57('0x91')]=!![];_0x267551[_0x6e57('0x86')]=_0x429399['membername'];_0x267551[_0x6e57('0x82')]=_0x429399[_0x6e57('0x82')];_0x267551[_0x6e57('0x3b')]=!![];_0x267551['queuecallerexit']=![];_0x267551['queuecallerexitAt']=null;if(!_0x267551[_0x6e57('0x92')]){if(_0x429399[_0x6e57('0x93')]==_0x6e57('0x92')){_0x267551[_0x6e57('0x8d')]=_0x6e57('0x94');logger[_0x6e57('0x7b')](_0x6e57('0x95'),_0x267551[_0x6e57('0x6c')],_0x267551['type']);}else{if(_[_0x6e57('0x96')](_0x429399[_0x6e57('0x41')]['toLowerCase'](),_0x6e57('0x97'))){if(this[_0x6e57('0xe')][_0x429399[_0x6e57('0x98')]]){var _0x3f7ece=_[_0x6e57('0x89')](this[_0x6e57('0xe')][_0x429399[_0x6e57('0x98')]]);_0x3f7ece[_0x6e57('0x3b')]=![];_0x3f7ece[_0x6e57('0x99')]=!![];_0x3f7ece[_0x6e57('0x9a')]=moment(_0x267551[_0x6e57('0x77')])[_0x6e57('0x9b')](_0x429399['holdtime'],'seconds')[_0x6e57('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f7ece[_0x6e57('0x8d')]='FORWARDTRANSFER';_0x3f7ece[_0x6e57('0x92')]=!![];_0x3f7ece[_0x6e57('0x9c')]=_0x6e57('0x9d');_0x3f7ece['transferexten']=_0x429399['destexten'];_0x3f7ece['transferuniqueid']=_0x429399[_0x6e57('0x53')];logger[_0x6e57('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x3f7ece[_0x6e57('0x6c')],_0x3f7ece['type']);var _0x13150e=this[_0x6e57('0xe')][_0x429399[_0x6e57('0x98')]];this[_0x6e57('0xe')][_0x429399[_0x6e57('0x98')]]=this[_0x6e57('0xe')][_0x429399[_0x6e57('0x53')]];this[_0x6e57('0xe')][_0x429399[_0x6e57('0x53')]]=_0x13150e;}}else{_0x267551[_0x6e57('0x8d')]=_0x6e57('0x9e')+_0x429399[_0x6e57('0x93')][_0x6e57('0x9f')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x267551[_0x6e57('0x6c')],_0x267551['type'],_0x267551[_0x6e57('0x8d')]);}}}this[_0x6e57('0x11')][_0x429399[_0x6e57('0x53')]]=_0x267551;}}}catch(_0x736c84){logger['error'](_0x6e57('0x90'),_0x429399[_0x6e57('0x53')],util[_0x6e57('0x48')](_0x736c84,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6e57('0x2a')]=function(_0x3f9d8f){try{if(this[_0x6e57('0x5e')](_0x3f9d8f)){logger[_0x6e57('0x50')](_0x6e57('0xa0'),_0x3f9d8f[_0x6e57('0x53')],util['inspect'](_0x3f9d8f,{'showHidden':![],'depth':null}));this[_0x6e57('0xa1')](_0x3f9d8f[_0x6e57('0x53')],_[_0x6e57('0x7e')](_0x3f9d8f[_0x6e57('0xa2')])[0x0],_0x3f9d8f['value']);if(this['queueReports'][_0x3f9d8f[_0x6e57('0x53')]]){var _0x54d583=_[_0x6e57('0x89')](this['queueReports'][_0x3f9d8f[_0x6e57('0x53')]]);if(_0x54d583){if(this['isNotNull'](_0x3f9d8f[_0x6e57('0xa2')])&&this[_0x6e57('0x5e')](_0x3f9d8f[_0x6e57('0xa2')][_0x6e57('0x64')])){switch(_0x3f9d8f[_0x6e57('0xa3')]){case _0x6e57('0xa4'):_0x54d583[_0x6e57('0x99')]=![];_0x54d583[_0x6e57('0x9a')]=null;break;case _0x6e57('0xa5'):_0x54d583[_0x6e57('0xa6')]=_0x6e57('0xa7');_0x54d583[_0x6e57('0x99')]=!![];_0x54d583[_0x6e57('0x9a')]=moment()[_0x6e57('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x54d583['queuecallerleaveAt']=moment()[_0x6e57('0x54')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x6e57('0x50')](_0x6e57('0xa8'),_0x3f9d8f['uniqueid'],util[_0x6e57('0x48')](_0x54d583,{'showHidden':![],'depth':null}));ami[_0x6e57('0x4e')](_0x6e57('0xa9'),_0x54d583);break;default:_0x54d583['queuecallerexit']=!![];_0x54d583[_0x6e57('0x9a')]=moment()[_0x6e57('0x54')](_0x6e57('0x78'));_0x54d583[_0x6e57('0xaa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x54d583[_0x6e57('0x21')]=![];_0x54d583[_0x6e57('0x84')]=null;_0x54d583['queuecallerexitreason']=_0x3f9d8f[_0x6e57('0xa3')];this[_0x6e57('0x11')][_0x3f9d8f[_0x6e57('0x53')]]=_0x54d583;this[_0x6e57('0x4c')](_0x54d583,_0x6e57('0x29'));}else if(this[_0x6e57('0x5e')](_0x3f9d8f['variable'])&&this[_0x6e57('0x5e')](_0x3f9d8f[_0x6e57('0xa2')][_0x6e57('0xab')])){if(!_0x54d583[_0x6e57('0x21')]){_0x54d583[_0x6e57('0x99')]=!![];_0x54d583[_0x6e57('0x9a')]=moment()[_0x6e57('0x54')](_0x6e57('0x78'));_0x54d583[_0x6e57('0x8d')]=_0x6e57('0xac');_0x54d583[_0x6e57('0xaa')]=moment()['format'](_0x6e57('0x78'));this[_0x6e57('0x11')][_0x3f9d8f[_0x6e57('0x53')]]=_0x54d583;}}logger['info'](_0x6e57('0xad'),_0x3f9d8f[_0x6e57('0x53')],_0x54d583[_0x6e57('0x6c')],_0x54d583[_0x6e57('0x6f')],_['keys'](_0x3f9d8f[_0x6e57('0xa2')])[0x0],_0x3f9d8f[_0x6e57('0xa3')]);_0x54d583['variables']=this[_0x6e57('0x16')][_0x3f9d8f[_0x6e57('0x53')]];}}}}catch(_0x2fa1f5){logger[_0x6e57('0x45')](_0x6e57('0xa0'),_0x3f9d8f['uniqueid'],util[_0x6e57('0x48')](_0x2fa1f5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e57('0x3c')][_0x6e57('0xa1')]=function(_0x3f9743,_0x409c65,_0xeaa705){var _0x108cbb=['rtpaudioqos',_0x6e57('0xae'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x6e57('0xaf'),_0x6e57('0xb0'),_0x6e57('0xb1'),_0x6e57('0xb2'),_0x6e57('0xb3'),'sipuri',_0x6e57('0xb4'),_0x6e57('0xb5'),_0x6e57('0xb6'),'memberdynamic',_0x6e57('0xb7'),'memberlastcall',_0x6e57('0xb8'),_0x6e57('0xb9'),_0x6e57('0xba')];if(!_[_0x6e57('0x3f')](_0x409c65)&&!_[_0x6e57('0xbb')](_0x108cbb,_0x409c65)){if(_[_0x6e57('0x5f')](this[_0x6e57('0x16')][_0x3f9743])){this[_0x6e57('0x16')][_0x3f9743]={};}this['variables'][_0x3f9743][_0x409c65]=_0xeaa705;}};VoiceQueueReport[_0x6e57('0x3c')][_0x6e57('0xbc')]=function(_0x5110e5,_0x38674d,_0x2c1aea){try{var _0x1601da={};if(this[_0x6e57('0xe')][_0x5110e5]){for(var _0x37ff6c=0x0;_0x37ff6c0x0?!![]:![];if(!_0x303ff2){return this[_0x3feb('0x1d')](this[_0x3feb('0x18')][_0x3feb('0x6f')]);}};VoiceQueueReport[_0x3feb('0xe')][_0x3feb('0x1e')]=function(_0x2fde51){var _0x3aee2f=this[_0x3feb('0x18')]['id'];if(this[_0x3feb('0x18')][_0x3feb('0x64')][_0x3aee2f]&&this[_0x3feb('0x18')][_0x3feb('0x64')][_0x3aee2f][_0x2fde51[_0x3feb('0x70')]]){this['summary'][_0x3feb('0x64')][_0x3aee2f][_0x2fde51[_0x3feb('0x70')]]['agents'][_0x3feb('0x71')](_0x2fde51);}};VoiceQueueReport[_0x3feb('0xe')]['syncQueueSummary']=function(_0x3bf78e){var _0x5ee99e=this;try{if(this['isNotNull'](_0x3bf78e)&&this[_0x3feb('0x5f')](_0x3bf78e[_0x3feb('0x52')])){logger[_0x3feb('0x4e')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x3feb('0x47')](_0x3bf78e,{'showHidden':![],'depth':null}));var _0x41b23c=this[_0x3feb('0x16')][_0x3bf78e['queue']];if(_0x41b23c){logger[_0x3feb('0x4e')](_0x3feb('0x72'),_0x41b23c[_0x3feb('0x5e')]);this[_0x3feb('0x18')][_0x3feb('0x61')][_0x41b23c[_0x3feb('0x5e')]]={'summaryEvent':_0x3bf78e};this['summary'][_0x3feb('0x6e')]+=0x1;return ami[_0x3feb('0x43')]({'action':_0x3feb('0x64'),'queue':_0x41b23c['name']})[_0x3feb('0x63')](function(_0x36976c){if(!_0x5ee99e[_0x3feb('0x18')][_0x3feb('0x64')][_0x3bf78e[_0x3feb('0x70')]]){_0x5ee99e[_0x3feb('0x18')]['queuestatus'][_0x3bf78e[_0x3feb('0x70')]]={};}_0x5ee99e[_0x3feb('0x18')]['queuestatus'][_0x3bf78e[_0x3feb('0x70')]][_0x36976c[_0x3feb('0x70')]]={'queue':_0x41b23c[_0x3feb('0x5e')],'agents':[]};})[_0x3feb('0x45')](function(_0x48e3bc){throw _0x48e3bc;});}}}catch(_0x1f5ac5){logger['error']('[voiceQueueReport][queuesummary]',util[_0x3feb('0x47')](_0x1f5ac5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x2ea497){if(this[_0x3feb('0x18')][_0x3feb('0x6e')]>0x0){this[_0x3feb('0x18')][_0x3feb('0x6f')]=_0x2ea497;return;}logger[_0x3feb('0x4e')](_0x3feb('0x73'),util['inspect'](_0x2ea497,{'showHidden':![],'depth':null}));this[_0x3feb('0x18')]=initializeSummary();ami['emit'](_0x3feb('0x74'),{});};VoiceQueueReport[_0x3feb('0xe')][_0x3feb('0x23')]=function(_0xded976){try{if(this['isNotNull'](_0xded976)){logger[_0x3feb('0x4e')](_0x3feb('0x75'),_0xded976[_0x3feb('0x50')],util[_0x3feb('0x47')](_0xded976,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3feb('0x13')][_0xded976[_0x3feb('0x50')]])){this[_0x3feb('0x13')][_0xded976[_0x3feb('0x50')]]=[];}if(_['isUndefined'](this['channels'][_0xded976['uniqueid']])){this[_0x3feb('0x40')][_0xded976[_0x3feb('0x50')]]={};}var _0x2689a1=new QueueReport();_0x2689a1[_0x3feb('0x52')]=_0xded976['queue'];_0x2689a1[_0x3feb('0x5a')]=this[_0x3feb('0x16')][_0x2689a1[_0x3feb('0x52')]]&&this['voiceQueues'][_0x2689a1[_0x3feb('0x52')]][_0x3feb('0x5a')]?this[_0x3feb('0x16')][_0x2689a1[_0x3feb('0x52')]]['type']||_0x3feb('0x5b'):_0x3feb('0x5b');_0x2689a1[_0x3feb('0x76')]=moment()[_0x3feb('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2689a1[_0x3feb('0x77')]=_0xded976['position'];_0x2689a1[_0x3feb('0x78')]=_0xded976['count'];_0x2689a1['uniqueid']=_0xded976['uniqueid'];logger[_0x3feb('0x79')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2689a1[_0x3feb('0x52')],_0x2689a1[_0x3feb('0x5a')]);Object[_0x3feb('0x6b')](_0x2689a1,_[_0x3feb('0x7a')](_0xded976,_[_0x3feb('0x7b')](_0x2689a1)));this['queueReports'][_0xded976[_0x3feb('0x50')]]['push'](_0x2689a1);this[_0x3feb('0x40')][_0xded976[_0x3feb('0x50')]]=_0x2689a1;this[_0x3feb('0x7c')](_0x2689a1,_0x3feb('0x22'));}}catch(_0x2e2eac){logger[_0x3feb('0x46')](_0x3feb('0x75'),_0xded976[_0x3feb('0x50')],util['inspect'](_0x2e2eac,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3feb('0x25')]=function(_0x3fd9db){try{if(this[_0x3feb('0x5f')](_0x3fd9db)){logger['debug'](_0x3feb('0x7d'),_0x3fd9db[_0x3feb('0x50')],util[_0x3feb('0x47')](_0x3fd9db,{'showHidden':![],'depth':null}));if(this[_0x3feb('0x13')][_0x3fd9db['uniqueid']]){var _0x55fa96=_['last'](this[_0x3feb('0x13')][_0x3fd9db[_0x3feb('0x50')]]);_0x55fa96[_0x3feb('0x3f')]=![];_0x55fa96[_0x3feb('0x7e')]=null;_0x55fa96[_0x3feb('0x7f')]=_0x3fd9db[_0x3feb('0x7f')];_0x55fa96['originalposition']=_0x3fd9db['originalposition'];_0x55fa96['queuecallerabandon']=!![];_0x55fa96[_0x3feb('0x80')]=moment()[_0x3feb('0x5d')](_0x3feb('0x81'));_0x55fa96[_0x3feb('0x57')]=_0x3feb('0x82');_0x55fa96[_0x3feb('0x83')]=null;logger[_0x3feb('0x79')](_0x3feb('0x84'),_0x55fa96[_0x3feb('0x52')],_0x55fa96[_0x3feb('0x5a')]);this['channels'][_0x3fd9db['uniqueid']]=_0x55fa96;this[_0x3feb('0x4b')](_0x55fa96,_0x3feb('0x24'));}}}catch(_0x533fd7){logger[_0x3feb('0x46')](_0x3feb('0x7d'),_0x3fd9db[_0x3feb('0x50')],util['inspect'](_0x533fd7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3feb('0xe')][_0x3feb('0x26')]=function(_0xb98dfd){try{if(this[_0x3feb('0x5f')](_0xb98dfd)){logger[_0x3feb('0x4e')]('[%s][voiceQueueReport][queuecallerleave]',_0xb98dfd['uniqueid'],util[_0x3feb('0x47')](_0xb98dfd,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xb98dfd['uniqueid']]){var _0x484668=_[_0x3feb('0x85')](this[_0x3feb('0x13')][_0xb98dfd[_0x3feb('0x50')]]);_0x484668[_0x3feb('0x86')]=moment()[_0x3feb('0x5d')](_0x3feb('0x81'));_0x484668['connectedlinenum']=_0xb98dfd['connectedlinenum'];_0x484668[_0x3feb('0x87')]=_0xb98dfd['connectedlinename'];logger[_0x3feb('0x79')](_0x3feb('0x88'),_0x484668[_0x3feb('0x52')],_0x484668[_0x3feb('0x5a')],_0xb98dfd['connectedlinenum'],_0xb98dfd[_0x3feb('0x87')]);this['channels'][_0xb98dfd[_0x3feb('0x50')]]=_0x484668;this[_0x3feb('0x7c')](_0x484668,_0x3feb('0x89'));}}}catch(_0x46675f){logger[_0x3feb('0x46')](_0x3feb('0x8a'),_0xb98dfd[_0x3feb('0x50')],util[_0x3feb('0x47')](_0x46675f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3feb('0xe')][_0x3feb('0x2a')]=function(_0xa8679d){try{if(this[_0x3feb('0x5f')](_0xa8679d)){logger[_0x3feb('0x4e')](_0x3feb('0x8b'),_0xa8679d[_0x3feb('0x50')],util[_0x3feb('0x47')](_0xa8679d,{'showHidden':![],'depth':null}));if(this[_0x3feb('0x13')][_0xa8679d[_0x3feb('0x50')]]){var _0x341ce7=_[_0x3feb('0x85')](this[_0x3feb('0x13')][_0xa8679d[_0x3feb('0x50')]]);_0x341ce7[_0x3feb('0x3f')]=!![];_0x341ce7[_0x3feb('0x57')]=_0x3feb('0x8c');logger[_0x3feb('0x79')](_0x3feb('0x8d'),_0x341ce7[_0x3feb('0x52')],_0x341ce7['type']);}}}catch(_0x1c6fde){logger[_0x3feb('0x46')](_0x3feb('0x8b'),_0xa8679d[_0x3feb('0x50')],util[_0x3feb('0x47')](_0x1c6fde,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3feb('0xe')][_0x3feb('0x28')]=function(_0x2411ef){try{if(this[_0x3feb('0x5f')](_0x2411ef)){logger[_0x3feb('0x4e')]('[%s][voiceQueueReport][agentcomplete]',_0x2411ef[_0x3feb('0x50')],util[_0x3feb('0x47')](_0x2411ef,{'showHidden':![],'depth':null}));if(this[_0x3feb('0x13')][_0x2411ef[_0x3feb('0x50')]]){var _0x220ebf=_[_0x3feb('0x85')](this[_0x3feb('0x13')][_0x2411ef[_0x3feb('0x50')]]);_0x220ebf[_0x3feb('0x24')]=![];_0x220ebf[_0x3feb('0x80')]=null;_0x220ebf[_0x3feb('0x8e')]=!![];_0x220ebf[_0x3feb('0x83')]=_0x2411ef['membername'];_0x220ebf['holdtime']=_0x2411ef[_0x3feb('0x7f')];_0x220ebf['queuecallercomplete']=!![];_0x220ebf[_0x3feb('0x3e')]=![];_0x220ebf[_0x3feb('0x8f')]=null;if(!_0x220ebf[_0x3feb('0x90')]){if(_0x2411ef[_0x3feb('0x91')]==_0x3feb('0x90')){_0x220ebf[_0x3feb('0x57')]=_0x3feb('0x92');logger[_0x3feb('0x79')](_0x3feb('0x93'),_0x220ebf[_0x3feb('0x52')],_0x220ebf[_0x3feb('0x5a')]);}else{if(_[_0x3feb('0x94')](_0x2411ef['channel'][_0x3feb('0x95')](),_0x3feb('0x96'))){if(this[_0x3feb('0x13')][_0x2411ef['linkedid']]){var _0xec58ac=_[_0x3feb('0x85')](this[_0x3feb('0x13')][_0x2411ef['linkedid']]);_0xec58ac['queuecallercomplete']=![];_0xec58ac['queuecallerexit']=!![];_0xec58ac[_0x3feb('0x8f')]=moment(_0x220ebf[_0x3feb('0x76')])[_0x3feb('0x97')](_0x2411ef[_0x3feb('0x7f')],_0x3feb('0x98'))[_0x3feb('0x5d')](_0x3feb('0x81'));_0xec58ac[_0x3feb('0x57')]='FORWARDTRANSFER';_0xec58ac[_0x3feb('0x90')]=!![];_0xec58ac['transfertype']=_0x3feb('0x99');_0xec58ac[_0x3feb('0x9a')]=_0x2411ef[_0x3feb('0x9b')];_0xec58ac[_0x3feb('0x9c')]=_0x2411ef['uniqueid'];logger['info'](_0x3feb('0x9d'),_0xec58ac[_0x3feb('0x52')],_0xec58ac[_0x3feb('0x5a')]);var _0xf03cbf=this['queueReports'][_0x2411ef[_0x3feb('0x9e')]];this[_0x3feb('0x13')][_0x2411ef[_0x3feb('0x9e')]]=this[_0x3feb('0x13')][_0x2411ef[_0x3feb('0x50')]];this['queueReports'][_0x2411ef[_0x3feb('0x50')]]=_0xf03cbf;}}else{_0x220ebf[_0x3feb('0x57')]='COMPLETEDBY'+_0x2411ef[_0x3feb('0x91')]['toUpperCase']();logger['info'](_0x3feb('0x9f'),_0x220ebf[_0x3feb('0x52')],_0x220ebf[_0x3feb('0x5a')],_0x220ebf[_0x3feb('0x57')]);}}}this[_0x3feb('0x40')][_0x2411ef[_0x3feb('0x50')]]=_0x220ebf;}}}catch(_0x3d11ff){logger[_0x3feb('0x46')](_0x3feb('0xa0'),_0x2411ef[_0x3feb('0x50')],util[_0x3feb('0x47')](_0x3d11ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3feb('0x2c')]=function(_0xf25e5){try{if(this[_0x3feb('0x5f')](_0xf25e5)){logger[_0x3feb('0x4e')](_0x3feb('0xa1'),_0xf25e5['uniqueid'],util[_0x3feb('0x47')](_0xf25e5,{'showHidden':![],'depth':null}));this[_0x3feb('0xa2')](_0xf25e5['uniqueid'],_[_0x3feb('0x7b')](_0xf25e5[_0x3feb('0xa3')])[0x0],_0xf25e5[_0x3feb('0xa4')]);if(this[_0x3feb('0x13')][_0xf25e5[_0x3feb('0x50')]]){var _0x58e8bc=_[_0x3feb('0x85')](this['queueReports'][_0xf25e5['uniqueid']]);if(_0x58e8bc){if(this[_0x3feb('0x5f')](_0xf25e5['variable'])&&this[_0x3feb('0x5f')](_0xf25e5[_0x3feb('0xa3')][_0x3feb('0x64')])){switch(_0xf25e5[_0x3feb('0xa4')]){case _0x3feb('0xa5'):_0x58e8bc[_0x3feb('0x3e')]=![];_0x58e8bc[_0x3feb('0x8f')]=null;break;case _0x3feb('0xa6'):_0x58e8bc['lastevent']=_0x3feb('0xa7');_0x58e8bc[_0x3feb('0x3e')]=!![];_0x58e8bc[_0x3feb('0x8f')]=moment()[_0x3feb('0x5d')](_0x3feb('0x81'));_0x58e8bc['queuecallerleaveAt']=moment()['format'](_0x3feb('0x81'));logger[_0x3feb('0x4e')](_0x3feb('0xa8'),_0xf25e5[_0x3feb('0x50')],util[_0x3feb('0x47')](_0x58e8bc,{'showHidden':![],'depth':null}));ami['emit'](_0x3feb('0xa9'),_0x58e8bc);break;default:_0x58e8bc[_0x3feb('0x3e')]=!![];_0x58e8bc[_0x3feb('0x8f')]=moment()[_0x3feb('0x5d')](_0x3feb('0x81'));_0x58e8bc[_0x3feb('0x86')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x58e8bc[_0x3feb('0x24')]=![];_0x58e8bc[_0x3feb('0x80')]=null;_0x58e8bc[_0x3feb('0x57')]=_0xf25e5['value'];this[_0x3feb('0x40')][_0xf25e5[_0x3feb('0x50')]]=_0x58e8bc;this[_0x3feb('0x4b')](_0x58e8bc,_0x3feb('0x2b'));}else if(this[_0x3feb('0x5f')](_0xf25e5['variable'])&&this[_0x3feb('0x5f')](_0xf25e5[_0x3feb('0xa3')][_0x3feb('0xaa')])){if(!_0x58e8bc[_0x3feb('0x24')]){_0x58e8bc[_0x3feb('0x3e')]=!![];_0x58e8bc['queuecallerexitAt']=moment()[_0x3feb('0x5d')](_0x3feb('0x81'));_0x58e8bc[_0x3feb('0x57')]=_0x3feb('0xab');_0x58e8bc['queuecallerleaveAt']=moment()[_0x3feb('0x5d')](_0x3feb('0x81'));this[_0x3feb('0x40')][_0xf25e5['uniqueid']]=_0x58e8bc;}}logger[_0x3feb('0x79')](_0x3feb('0xac'),_0xf25e5[_0x3feb('0x50')],_0x58e8bc[_0x3feb('0x52')],_0x58e8bc[_0x3feb('0x5a')],_['keys'](_0xf25e5[_0x3feb('0xa3')])[0x0],_0xf25e5[_0x3feb('0xa4')]);_0x58e8bc[_0x3feb('0x19')]=this[_0x3feb('0x19')][_0xf25e5[_0x3feb('0x50')]];}}}}catch(_0x1792d4){logger[_0x3feb('0x46')](_0x3feb('0xa1'),_0xf25e5[_0x3feb('0x50')],util[_0x3feb('0x47')](_0x1792d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x33ab3d,_0xd1101d,_0x4b5211){var _0x55ec5c=['rtpaudioqos','rtpaudioqosbridged',_0x3feb('0xad'),_0x3feb('0xae'),_0x3feb('0xaf'),_0x3feb('0xb0'),_0x3feb('0xb1'),_0x3feb('0xb2'),_0x3feb('0xb3'),'sipuri',_0x3feb('0xb4'),_0x3feb('0xb5'),_0x3feb('0xb6'),_0x3feb('0xb7'),_0x3feb('0xb8'),_0x3feb('0xb9'),_0x3feb('0xba'),_0x3feb('0xbb'),'memberrealtime'];if(!_['isNil'](_0xd1101d)&&!_[_0x3feb('0xbc')](_0x55ec5c,_0xd1101d)){if(_[_0x3feb('0xbd')](this['variables'][_0x33ab3d])){this['variables'][_0x33ab3d]={};}this[_0x3feb('0x19')][_0x33ab3d][_0xd1101d]=_0x4b5211;}};VoiceQueueReport[_0x3feb('0xe')]['handleHangup']=function(_0x1a7535,_0x29c848,_0x237c9c){try{var _0xa04ee8={};if(this['queueReports'][_0x1a7535]){for(var _0x2d2a73=0x0;_0x2d2a73=0x0?moment(_0x5db685['endtime'])['diff'](_0x5db685['starttime'],_0x208f('0x18')):null,'data1':'outbound','data2':_0x5db685[_0x208f('0x11')],'data3':_0x5db685[_0x208f('0x10')],'data4':_0x5db685['dialstring']||null,'role':_0x208f('0x19'),'internal':_0x5db685[_0x208f('0x11')]?_[_0x208f('0x12')](_0x5db685['accountcode']):undefined,'uniqueid':_0x5db685[_0x208f('0x1a')]},'log':_0x208f('0x13')});}; \ No newline at end of file +var _0xc613=['outbound','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','SIP/%s','lastAssignedTo','interface','TALKING','diff','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','endtime','starttime','seconds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc613,0x161));var _0x3c61=function(_0x332ac1,_0x131914){_0x332ac1=_0x332ac1-0x0;var _0x214b87=_0xc613[_0x332ac1];return _0x214b87;};'use strict';var moment=require('moment');var _=require(_0x3c61('0x0'));var util=require(_0x3c61('0x1'));var client=require(_0x3c61('0x2'));exports[_0x3c61('0x3')]=function(_0x3360d8){var _0xa96b9b=_0x3360d8[_0x3c61('0x4')]||_0x3360d8[_0x3c61('0x5')];return client[_0x3c61('0x6')](_0x3c61('0x7'),{'body':{'channel':_0x3c61('0x8'),'membername':_0x3360d8['lastAssignedTo'],'interface':_['isNil'](_0x3360d8['interface'])?util['format'](_0x3c61('0x9'),_0x3360d8[_0x3c61('0xa')]):_0x3360d8[_0x3c61('0xb')],'type':_0x3c61('0xc'),'enterAt':_0x3360d8['queuecallerleaveAt'],'exitAt':_0xa96b9b,'duration':moment(_0xa96b9b)[_0x3c61('0xd')](_0x3360d8['queuecallerleaveAt'],'seconds'),'data1':_0x3c61('0xe'),'data2':_0x3360d8[_0x3c61('0xf')],'data3':_0x3360d8[_0x3c61('0x10')],'data4':null,'data5':_0x3360d8['queue'],'role':_0x3c61('0x11'),'internal':_0x3360d8[_0x3c61('0x12')]?_[_0x3c61('0x13')](_0x3360d8[_0x3c61('0x12')]):undefined,'uniqueid':_0x3360d8[_0x3c61('0x14')]},'log':_0x3c61('0x7')});};exports[_0x3c61('0x15')]=function(_0x448509){return client['Request'](_0x3c61('0x7'),{'body':{'channel':'voice','membername':_0x448509['membername'],'interface':_0x448509[_0x3c61('0xb')],'type':_0x3c61('0xc'),'enterAt':_0x448509['starttime'],'exitAt':_0x448509[_0x3c61('0x16')],'duration':moment(_0x448509['endtime'])[_0x3c61('0xd')](_0x448509[_0x3c61('0x17')],_0x3c61('0x18'))>=0x0?moment(_0x448509[_0x3c61('0x16')])[_0x3c61('0xd')](_0x448509['starttime'],'seconds'):null,'data1':_0x3c61('0x19'),'data2':_0x448509['accountcode'],'data3':_0x448509['exten'],'data4':_0x448509[_0x3c61('0x1a')]||null,'role':'agent','internal':_0x448509[_0x3c61('0x12')]?_[_0x3c61('0x13')](_0x448509['accountcode']):undefined,'uniqueid':_0x448509[_0x3c61('0x14')]},'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 c2d170a..e854b8e 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 _0x1d0d=['Request','getSettings'];(function(_0x19eb53,_0x217d3c){var _0x43d940=function(_0x3450e7){while(--_0x3450e7){_0x19eb53['push'](_0x19eb53['shift']());}};_0x43d940(++_0x217d3c);}(_0x1d0d,0x183));var _0xd1d0=function(_0x4e7a6f,_0x1ae321){_0x4e7a6f=_0x4e7a6f-0x0;var _0x184fca=_0x1d0d[_0x4e7a6f];return _0x184fca;};'use strict';var client=require('../client');exports[_0xd1d0('0x0')]=function(){return client[_0xd1d0('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x594d=['stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','ShowSetting'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x594d,0x92));var _0xd594=function(_0x159107,_0x3c7fde){_0x159107=_0x159107-0x0;var _0x182f96=_0x594d[_0x159107];return _0x182f96;};'use strict';var client=require(_0xd594('0x0'));exports['getSettings']=function(){return client['Request'](_0xd594('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd594('0x2'),_0xd594('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d2b73b6..07eb887 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 _0xd503=['name','html','../client','getTemplates'];(function(_0x533850,_0x4279ce){var _0x2ab60c=function(_0x144252){while(--_0x144252){_0x533850['push'](_0x533850['shift']());}};_0x2ab60c(++_0x4279ce);}(_0xd503,0x116));var _0x3d50=function(_0xc7de14,_0x4a276c){_0xc7de14=_0xc7de14-0x0;var _0x14c908=_0xd503[_0xc7de14];return _0x14c908;};'use strict';var client=require(_0x3d50('0x0'));exports[_0x3d50('0x1')]=function(_0x2dae69){return function(_0x35be92){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3d50('0x2'),_0x3d50('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xb25b=['getTemplates','Request','name','html'];(function(_0x323f93,_0x400601){var _0x3c24d5=function(_0x387c75){while(--_0x387c75){_0x323f93['push'](_0x323f93['shift']());}};_0x3c24d5(++_0x400601);}(_0xb25b,0x80));var _0xbb25=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb25b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xbb25('0x0')]=function(_0xf4583){return function(_0x461170){return client[_0xbb25('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xbb25('0x2'),_0xbb25('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 040af80..962b064 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 _0x8887=['GetTrigger','name','channel','status','Condition','AllConditions','field','value','operator','Action','Actions','action','data1','data2','data3','data4','data5','data6','getTriggers'];(function(_0x349085,_0x435330){var _0xfe6918=function(_0x523380){while(--_0x523380){_0x349085['push'](_0x349085['shift']());}};_0xfe6918(++_0x435330);}(_0x8887,0x1c7));var _0x7888=function(_0x34e4f1,_0x57b35d){_0x34e4f1=_0x34e4f1-0x0;var _0x1a7e8e=_0x8887[_0x34e4f1];return _0x1a7e8e;};'use strict';var client=require('../client');exports[_0x7888('0x0')]=function(_0x248cc5){return function(_0x6e163c){return client['Request'](_0x7888('0x1'),{'options':{'raw':![],'attributes':['id',_0x7888('0x2'),_0x7888('0x3'),_0x7888('0x4')],'include':[{'model':_0x7888('0x5'),'as':_0x7888('0x6'),'attributes':['id',_0x7888('0x7'),'operator',_0x7888('0x8')]},{'model':_0x7888('0x5'),'as':'AnyConditions','attributes':['id',_0x7888('0x7'),_0x7888('0x9'),_0x7888('0x8')]},{'model':_0x7888('0xa'),'as':_0x7888('0xb'),'attributes':['id',_0x7888('0xc'),_0x7888('0xd'),_0x7888('0xe'),_0x7888('0xf'),_0x7888('0x10'),_0x7888('0x11'),_0x7888('0x12'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xd412=['action','data2','data3','data4','data5','data6','data7','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','Action'];(function(_0x17ac7c,_0x536f26){var _0x22954a=function(_0x521c3b){while(--_0x521c3b){_0x17ac7c['push'](_0x17ac7c['shift']());}};_0x22954a(++_0x536f26);}(_0xd412,0xcd));var _0x2d41=function(_0xf36a76,_0x3967b3){_0xf36a76=_0xf36a76-0x0;var _0x414aa5=_0xd412[_0xf36a76];return _0x414aa5;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x4ccae1){return function(_0x4cc065){return client[_0x2d41('0x0')](_0x2d41('0x1'),{'options':{'raw':![],'attributes':['id',_0x2d41('0x2'),_0x2d41('0x3'),_0x2d41('0x4')],'include':[{'model':_0x2d41('0x5'),'as':_0x2d41('0x6'),'attributes':['id',_0x2d41('0x7'),_0x2d41('0x8'),_0x2d41('0x9')]},{'model':_0x2d41('0x5'),'as':'AnyConditions','attributes':['id',_0x2d41('0x7'),'operator',_0x2d41('0x9')]},{'model':_0x2d41('0xa'),'as':'Actions','attributes':['id',_0x2d41('0xb'),'data1',_0x2d41('0xc'),_0x2d41('0xd'),_0x2d41('0xe'),_0x2d41('0xf'),_0x2d41('0x10'),_0x2d41('0x11')]}]},'log':_0x2d41('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 954a4ca..1cd4bb0 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 _0x8865=['Request','name','registry','defaultuser','GetTrunk','../client'];(function(_0x5131f5,_0x1a0a7b){var _0x255c73=function(_0x1174c0){while(--_0x1174c0){_0x5131f5['push'](_0x5131f5['shift']());}};_0x255c73(++_0x1a0a7b);}(_0x8865,0x173));var _0x5886=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x8865[_0x4a747d];return _0x3a5b5c;};'use strict';var client=require(_0x5886('0x0'));exports['getTrunks']=function(_0x4dc047){return function(_0x1da97e){return client[_0x5886('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5886('0x2'),_0x5886('0x3'),_0x5886('0x4')]},'log':_0x5886('0x5')});};}; \ No newline at end of file +var _0x8fe0=['defaultuser','../client','getTrunks','Request','GetTrunk','registry'];(function(_0x5ac545,_0x2e21a0){var _0x12ce2e=function(_0x470220){while(--_0x470220){_0x5ac545['push'](_0x5ac545['shift']());}};_0x12ce2e(++_0x2e21a0);}(_0x8fe0,0x1ab));var _0x08fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8fe0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x08fe('0x0'));exports[_0x08fe('0x1')]=function(_0x25b304){return function(_0x415267){return client[_0x08fe('0x2')](_0x08fe('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x08fe('0x4'),_0x08fe('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7ede9a5..c7a0273 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe706,0xa3));var _0x6e70=function(_0x168057,_0x18fae0){_0x168057=_0x168057-0x0;var _0x470c2f=_0xe706[_0x168057];return _0x470c2f;};'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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c46b245..e4218da 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 _0x5123=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x249dfe,_0x21f85c){var _0xc7c7be=function(_0x3d0837){while(--_0x3d0837){_0x249dfe['push'](_0x249dfe['shift']());}};_0xc7c7be(++_0x21f85c);}(_0x5123,0xc4));var _0x3512=function(_0x33bc4f,_0x52d3c4){_0x33bc4f=_0x33bc4f-0x0;var _0x4bccfb=_0x5123[_0x33bc4f];return _0x4bccfb;};'use strict';var client=require(_0x3512('0x0'));exports[_0x3512('0x1')]=function(_0x130fb6){return client[_0x3512('0x2')](_0x3512('0x3'),{'body':_0x130fb6,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x3abbe1,_0x3b9a44,_0x3633e7){return client[_0x3512('0x2')]('UpdateVoiceAgentReport',{'body':_0x3abbe1,'options':{'where':{'uniqueid':_0x3b9a44,'interface':_0x3633e7,'agentcomplete':!![]}},'log':_0x3512('0x4')});}; \ No newline at end of file +var _0x39dd=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x14e783,_0x501ccf){var _0x5a1f04=function(_0x984df5){while(--_0x984df5){_0x14e783['push'](_0x14e783['shift']());}};_0x5a1f04(++_0x501ccf);}(_0x39dd,0x1ce));var _0xd39d=function(_0x1a80d5,_0x17c742){_0x1a80d5=_0x1a80d5-0x0;var _0x35b68e=_0x39dd[_0x1a80d5];return _0x35b68e;};'use strict';var client=require(_0xd39d('0x0'));exports[_0xd39d('0x1')]=function(_0x3734c0){return client[_0xd39d('0x2')]('CreateVoiceAgentReport',{'body':_0x3734c0,'log':_0xd39d('0x3')});};exports[_0xd39d('0x4')]=function(_0x117e18,_0x56e00b,_0x52032a){return client[_0xd39d('0x2')](_0xd39d('0x5'),{'body':_0x117e18,'options':{'where':{'uniqueid':_0x56e00b,'interface':_0x52032a,'agentcomplete':!![]}},'log':_0xd39d('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index d9f67f7..7bdf508 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 _0x2d09=['YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','lodash','create','CreateVoiceCallReport','merge','context','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','endOf'];(function(_0x2b3ff1,_0x1024a8){var _0x18cd66=function(_0x512586){while(--_0x512586){_0x2b3ff1['push'](_0x2b3ff1['shift']());}};_0x18cd66(++_0x1024a8);}(_0x2d09,0x126));var _0x92d0=function(_0x851167,_0x4f27d7){_0x851167=_0x851167-0x0;var _0x2c3f7d=_0x2d09[_0x851167];return _0x2c3f7d;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x92d0('0x0'));var client=require('../client');exports[_0x92d0('0x1')]=function(_0x4522ff){return client['Request'](_0x92d0('0x2'),{'body':_[_0x92d0('0x3')](_0x4522ff,{'source':_0x4522ff['calleridnum'],'destinationcontext':_0x4522ff[_0x92d0('0x4')],'callerid':_0x4522ff['callerid'],'amaflags':_0x92d0('0x5')}),'log':_0x92d0('0x2')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x92d0('0x6'),{'options':{'where':{'type':[_0x92d0('0x7')],'createdAt':{'$between':[moment()[_0x92d0('0x8')](_0x92d0('0x9'))[_0x92d0('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x92d0('0xb')](_0x92d0('0x9'))[_0x92d0('0xa')](_0x92d0('0xc'))]}},'attributes':[_0x92d0('0xd'),_0x92d0('0xe'),_0x92d0('0xf'),'billableseconds']},'log':_0x92d0('0x10')});};}; \ No newline at end of file +var _0x9ae6=['YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports','GetVoiceCallReport','day','format','endOf'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x9ae6,0x122));var _0x69ae=function(_0x1bbe17,_0x52a64a){_0x1bbe17=_0x1bbe17-0x0;var _0x4a81b1=_0x9ae6[_0x1bbe17];return _0x4a81b1;};'use strict';var moment=require(_0x69ae('0x0'));var util=require(_0x69ae('0x1'));var _=require(_0x69ae('0x2'));var client=require('../client');exports[_0x69ae('0x3')]=function(_0x4c01a5){return client[_0x69ae('0x4')](_0x69ae('0x5'),{'body':_[_0x69ae('0x6')](_0x4c01a5,{'source':_0x4c01a5['calleridnum'],'destinationcontext':_0x4c01a5[_0x69ae('0x7')],'callerid':_0x4c01a5[_0x69ae('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x69ae('0x5')});};exports[_0x69ae('0x9')]=function(){return function(){return client[_0x69ae('0x4')](_0x69ae('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x69ae('0xb'))[_0x69ae('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x69ae('0xd')]('day')[_0x69ae('0xc')](_0x69ae('0xe'))]}},'attributes':[_0x69ae('0xf'),_0x69ae('0x10'),'duration',_0x69ae('0x11')]},'log':_0x69ae('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d70849f..fd3188d 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 _0xfc38=['Request','CreateVoiceDialReport','../client'];(function(_0x400851,_0x2435b9){var _0x34c9f7=function(_0xf29c0b){while(--_0xf29c0b){_0x400851['push'](_0x400851['shift']());}};_0x34c9f7(++_0x2435b9);}(_0xfc38,0x149));var _0x8fc3=function(_0x579a16,_0x27986b){_0x579a16=_0x579a16-0x0;var _0x489de6=_0xfc38[_0x579a16];return _0x489de6;};'use strict';var client=require(_0x8fc3('0x0'));exports['create']=function(_0x19dc1f){return client[_0x8fc3('0x1')](_0x8fc3('0x2'),{'body':_0x19dc1f,'log':_0x8fc3('0x2')});}; \ No newline at end of file +var _0x5672=['create','CreateVoiceDialReport','../client'];(function(_0x43bb67,_0x53f659){var _0x34260e=function(_0x331df3){while(--_0x331df3){_0x43bb67['push'](_0x43bb67['shift']());}};_0x34260e(++_0x53f659);}(_0x5672,0xb0));var _0x2567=function(_0x22cd0c,_0x4040b6){_0x22cd0c=_0x22cd0c-0x0;var _0x439eba=_0x5672[_0x22cd0c];return _0x439eba;};'use strict';var client=require(_0x2567('0x0'));exports[_0x2567('0x1')]=function(_0x5cb46f){return client['Request'](_0x2567('0x2'),{'body':_0x5cb46f,'log':_0x2567('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 57d453e..416d13e 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 _0x4483=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0x19bdff,_0x7fa5f8){var _0xad5d51=function(_0x592868){while(--_0x592868){_0x19bdff['push'](_0x19bdff['shift']());}};_0xad5d51(++_0x7fa5f8);}(_0x4483,0x1a3));var _0x3448=function(_0x5742e4,_0x48e2d2){_0x5742e4=_0x5742e4-0x0;var _0x59b0cd=_0x4483[_0x5742e4];return _0x59b0cd;};'use strict';var client=require(_0x3448('0x0'));exports[_0x3448('0x1')]=function(){return function(){return client[_0x3448('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3448('0x3'),_0x3448('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x3448('0x1')});};}; \ No newline at end of file +var _0x3667=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x562143,_0x1a5111){var _0x2ac3e1=function(_0x1b77a5){while(--_0x1b77a5){_0x562143['push'](_0x562143['shift']());}};_0x2ac3e1(++_0x1a5111);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7366('0x0'));exports[_0x7366('0x1')]=function(){return function(){return client[_0x7366('0x2')](_0x7366('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7366('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x7366('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 1d39ed2..67f5fe1 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 _0x2071=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive'];(function(_0x167631,_0x58319c){var _0x49ce0a=function(_0x24342a){while(--_0x24342a){_0x167631['push'](_0x167631['shift']());}};_0x49ce0a(++_0x58319c);}(_0x2071,0xa2));var _0x1207=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x2071[_0x2a558d];return _0xa7bc9c;};'use strict';var client=require(_0x1207('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x1207('0x1')](_0x1207('0x2'),{'options':{'raw':![],'attributes':['id',_0x1207('0x3'),'acw',_0x1207('0x4'),_0x1207('0x5'),_0x1207('0x6'),_0x1207('0x7'),'dialActive','dialMethod',_0x1207('0x8'),_0x1207('0x9'),_0x1207('0xa'),_0x1207('0xb'),_0x1207('0xc'),_0x1207('0xd'),_0x1207('0xe'),_0x1207('0xf'),_0x1207('0x10'),_0x1207('0x11'),_0x1207('0x12'),_0x1207('0x13'),'dialCongestionMaxRetry',_0x1207('0x14'),_0x1207('0x15'),_0x1207('0x16'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x1207('0x17'),'dialGlobalInterval',_0x1207('0x18'),_0x1207('0x19'),_0x1207('0x1a'),_0x1207('0x1b'),_0x1207('0x1c'),_0x1207('0x1d'),_0x1207('0x1e'),_0x1207('0x1f'),_0x1207('0x20'),_0x1207('0x21'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x1207('0x22'),_0x1207('0x23'),'dialRecallInQueue',_0x1207('0x24'),_0x1207('0x25'),'dialAgiAfterHangupClient',_0x1207('0x26'),_0x1207('0x6'),_0x1207('0x27'),'dialRandomLastDigitCallerIdNumber',_0x1207('0x28'),_0x1207('0x29'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x1207('0x2a'),_0x1207('0x2b'),_0x1207('0x2c'),_0x1207('0x2d'),_0x1207('0x2e'),_0x1207('0x2f'),_0x1207('0x30'),_0x1207('0x31'),'dialPredictiveIntervalMaxThreshold',_0x1207('0x32'),_0x1207('0x33'),_0x1207('0x34')],'include':[{'model':_0x1207('0x35'),'as':_0x1207('0x35'),'attributes':['id',_0x1207('0x3'),_0x1207('0x36'),_0x1207('0x37')]},{'model':_0x1207('0x38'),'as':_0x1207('0x39'),'attributes':['id',_0x1207('0x3')]},{'model':_0x1207('0x35'),'as':_0x1207('0x3a'),'attributes':['id','name',_0x1207('0x36'),_0x1207('0x37')]},{'model':'Interval','as':_0x1207('0x3b'),'attributes':['id','name'],'include':[{'model':_0x1207('0x3b'),'as':_0x1207('0x3c'),'attributes':['id','name',_0x1207('0x3d')]}]}]},'log':_0x1207('0x3e')});};}; \ No newline at end of file +var _0x6037=['Interval','interval','../client','getVoiceQueues','Request','name','acwTimeout','autopause','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6037,0xe2));var _0x7603=function(_0x408f78,_0x483a0a){_0x408f78=_0x408f78-0x0;var _0x31b82f=_0x6037[_0x408f78];return _0x31b82f;};'use strict';var client=require(_0x7603('0x0'));exports[_0x7603('0x1')]=function(){return function(){return client[_0x7603('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x7603('0x3'),'acw',_0x7603('0x4'),_0x7603('0x5'),'monitor_format',_0x7603('0x6'),_0x7603('0x7'),'dialMethod',_0x7603('0x8'),_0x7603('0x9'),_0x7603('0xa'),_0x7603('0xb'),_0x7603('0xc'),_0x7603('0xd'),_0x7603('0xe'),'dialOriginateCallerIdNumber',_0x7603('0xf'),'dialQueueOptions',_0x7603('0x10'),'dialQueueProject','dialCongestionMaxRetry',_0x7603('0x11'),_0x7603('0x12'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x7603('0x13'),'dialGlobalMaxRetry','dialTimezone',_0x7603('0x14'),_0x7603('0x15'),_0x7603('0x16'),_0x7603('0x17'),_0x7603('0x18'),'dialAMDGreeting',_0x7603('0x19'),_0x7603('0x1a'),_0x7603('0x1b'),_0x7603('0x1c'),'dialAMDMaximumNumberOfWords',_0x7603('0x1d'),'dialAMDMaximumWordLength',_0x7603('0x1e'),_0x7603('0x1f'),_0x7603('0x20'),_0x7603('0x21'),_0x7603('0x22'),'dialAgiAfterHangupClient',_0x7603('0x23'),'monitor_format','strategy',_0x7603('0x24'),_0x7603('0x25'),_0x7603('0x26'),_0x7603('0x27'),_0x7603('0x28'),'dialDropRetryFrequency',_0x7603('0x29'),_0x7603('0x2a'),_0x7603('0x2b'),_0x7603('0x2c'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition',_0x7603('0x2d'),_0x7603('0x2e'),_0x7603('0x2f'),_0x7603('0x30')],'include':[{'model':_0x7603('0x31'),'as':_0x7603('0x31'),'attributes':['id',_0x7603('0x3'),_0x7603('0x32'),_0x7603('0x33')]},{'model':_0x7603('0x34'),'as':'mandatoryDispositionPause','attributes':['id',_0x7603('0x3')]},{'model':_0x7603('0x31'),'as':_0x7603('0x35'),'attributes':['id',_0x7603('0x3'),'callerid',_0x7603('0x33')]},{'model':_0x7603('0x36'),'as':_0x7603('0x36'),'attributes':['id',_0x7603('0x3')],'include':[{'model':_0x7603('0x36'),'as':'Intervals','attributes':['id',_0x7603('0x3'),_0x7603('0x37')]}]}]},'log':_0x7603('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 5c56c41..35e89dc 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(_0x11081c,_0x4820be){var _0xce6903=function(_0x53d7b8){while(--_0x53d7b8){_0x11081c['push'](_0x11081c['shift']());}};_0xce6903(++_0x4820be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x56db75,_0x4c5921){var _0x563ff6=function(_0x51c48a){while(--_0x51c48a){_0x56db75['push'](_0x56db75['shift']());}};_0x563ff6(++_0x4c5921);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 0b56e1f..ed3dab8 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 _0xec6c=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x4b6573,_0x3e77ad){var _0x372c36=function(_0x180e68){while(--_0x180e68){_0x4b6573['push'](_0x4b6573['shift']());}};_0x372c36(++_0x3e77ad);}(_0xec6c,0x94));var _0xcec6=function(_0x101383,_0x5bd543){_0x101383=_0x101383-0x0;var _0x46cfe9=_0xec6c[_0x101383];return _0x46cfe9;};'use strict';var client=require(_0xcec6('0x0'));exports[_0xcec6('0x1')]=function(_0x5b0a40){return function(){return client[_0xcec6('0x2')](_0xcec6('0x3'),{'options':{'where':{'VoiceQueueId':_0x5b0a40,'paused':!![]},'raw':!![]},'log':_0xcec6('0x1')});};}; \ No newline at end of file +var _0x3716=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x1f1170,_0x3b5783){var _0x127b7b=function(_0x30c5ed){while(--_0x30c5ed){_0x1f1170['push'](_0x1f1170['shift']());}};_0x127b7b(++_0x3b5783);}(_0x3716,0x1f1));var _0x6371=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x3716[_0xbc346f];return _0x9f9260;};'use strict';var client=require(_0x6371('0x0'));exports[_0x6371('0x1')]=function(_0x50c676){return function(){return client['Request'](_0x6371('0x2'),{'options':{'where':{'VoiceQueueId':_0x50c676,'paused':!![]},'raw':!![]},'log':_0x6371('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6cd90be..1f97e77 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1c18ae,_0x696723){var _0x19e05e=function(_0x12b7e1){while(--_0x12b7e1){_0x1c18ae['push'](_0x1c18ae['shift']());}};_0x19e05e(++_0x696723);}(_0x7a54,0x106));var _0x47a5=function(_0x3cbc05,_0x2adb02){_0x3cbc05=_0x3cbc05-0x0;var _0x421bac=_0x7a54[_0x3cbc05];return _0x421bac;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x17005f,_0x52a06b){var _0x5cde48=function(_0x338812){while(--_0x338812){_0x17005f['push'](_0x17005f['shift']());}};_0x5cde48(++_0x52a06b);}(_0x7a54,0x106));var _0x47a5=function(_0x1743b0,_0x450414){_0x1743b0=_0x1743b0-0x0;var _0x1a251f=_0x7a54[_0x1743b0];return _0x1a251f;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 808a049..d54ec58 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 _0xb682=['transferercontext','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','extension','CreateVoiceTransferReport','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','blindTransfer','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode'];(function(_0x4eee77,_0x1da6ff){var _0x1051a8=function(_0x5416ad){while(--_0x5416ad){_0x4eee77['push'](_0x4eee77['shift']());}};_0x1051a8(++_0x1da6ff);}(_0xb682,0x118));var _0x2b68=function(_0x44c79f,_0x21f727){_0x44c79f=_0x44c79f-0x0;var _0x4089ef=_0xb682[_0x44c79f];return _0x4089ef;};'use strict';var client=require(_0x2b68('0x0'));exports['transfers']={};exports[_0x2b68('0x1')]=function(_0x9b8103){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x9b8103[_0x2b68('0x2')],'transfererchannel':_0x9b8103['transfererchannel'],'transferercalleridnum':_0x9b8103[_0x2b68('0x3')],'transferercalleridname':_0x9b8103[_0x2b68('0x4')],'transfererconnectedlinenum':_0x9b8103[_0x2b68('0x5')],'transfererconnectedlinename':_0x9b8103[_0x2b68('0x6')],'transfereraccountcode':_0x9b8103[_0x2b68('0x7')],'transferercontext':_0x9b8103[_0x2b68('0x8')],'transfererexten':_0x9b8103['transfererexten'],'transfererlinkedid':_0x9b8103['transfererlinkedid'],'transfereechannel':_0x9b8103['transfereechannel'],'transfereecalleridnum':_0x9b8103['transfereecalleridnum'],'transfereecalleridname':_0x9b8103['transfereecalleridname'],'transfereeconnectedlinenum':_0x9b8103[_0x2b68('0x9')],'transfereeconnectedlinename':_0x9b8103['transfereeconnectedlinename'],'transfereeaccountcode':_0x9b8103[_0x2b68('0xa')],'transfereecontext':_0x9b8103['transfereecontext'],'transfereeexten':_0x9b8103[_0x2b68('0xb')],'transfereelinkedid':_0x9b8103[_0x2b68('0xc')],'isexternal':_0x9b8103[_0x2b68('0xd')],'context':_0x9b8103['context'],'extension':_0x9b8103[_0x2b68('0xe')],'type':'blind'},'log':_0x2b68('0xf')});};exports['attendedTransfer']=function(_0x17e8bb){return client['Request'](_0x2b68('0xf'),{'body':{'result':_0x17e8bb[_0x2b68('0x2')],'transfererchannel':_0x17e8bb['origtransfererchannel'],'transferercalleridnum':_0x17e8bb[_0x2b68('0x10')],'transferercalleridname':_0x17e8bb[_0x2b68('0x11')],'transfererconnectedlinenum':_0x17e8bb['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x17e8bb[_0x2b68('0x12')],'transfereraccountcode':_0x17e8bb['origtransfereraccountcode'],'transferercontext':_0x17e8bb[_0x2b68('0x13')],'transfererexten':_0x17e8bb[_0x2b68('0x14')],'transfererlinkedid':_0x17e8bb[_0x2b68('0x15')],'transfereechannel':_0x17e8bb[_0x2b68('0x16')],'transfereecalleridnum':_0x17e8bb[_0x2b68('0x17')],'transfereecalleridname':_0x17e8bb[_0x2b68('0x18')],'transfereeconnectedlinenum':_0x17e8bb[_0x2b68('0x19')],'transfereeconnectedlinename':_0x17e8bb[_0x2b68('0x1a')],'transfereeaccountcode':_0x17e8bb[_0x2b68('0x1b')],'transfereecontext':_0x17e8bb[_0x2b68('0x1c')],'transfereeexten':_0x17e8bb[_0x2b68('0x1d')],'transfereelinkedid':_0x17e8bb['transfertargetlinkedid'],'isexternal':_0x17e8bb[_0x2b68('0xd')],'context':_0x17e8bb[_0x2b68('0x1e')],'extension':_0x17e8bb[_0x2b68('0x1f')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x8fd6=['transferercontext','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8fd6,0x172));var _0x68fd=function(_0x301bee,_0x91a563){_0x301bee=_0x301bee-0x0;var _0x3fbdbc=_0x8fd6[_0x301bee];return _0x3fbdbc;};'use strict';var client=require(_0x68fd('0x0'));exports[_0x68fd('0x1')]={};exports[_0x68fd('0x2')]=function(_0x26165d){return client['Request'](_0x68fd('0x3'),{'body':{'result':_0x26165d[_0x68fd('0x4')],'transfererchannel':_0x26165d[_0x68fd('0x5')],'transferercalleridnum':_0x26165d[_0x68fd('0x6')],'transferercalleridname':_0x26165d[_0x68fd('0x7')],'transfererconnectedlinenum':_0x26165d['transfererconnectedlinenum'],'transfererconnectedlinename':_0x26165d[_0x68fd('0x8')],'transfereraccountcode':_0x26165d[_0x68fd('0x9')],'transferercontext':_0x26165d[_0x68fd('0xa')],'transfererexten':_0x26165d['transfererexten'],'transfererlinkedid':_0x26165d[_0x68fd('0xb')],'transfereechannel':_0x26165d['transfereechannel'],'transfereecalleridnum':_0x26165d['transfereecalleridnum'],'transfereecalleridname':_0x26165d[_0x68fd('0xc')],'transfereeconnectedlinenum':_0x26165d[_0x68fd('0xd')],'transfereeconnectedlinename':_0x26165d[_0x68fd('0xe')],'transfereeaccountcode':_0x26165d[_0x68fd('0xf')],'transfereecontext':_0x26165d['transfereecontext'],'transfereeexten':_0x26165d[_0x68fd('0x10')],'transfereelinkedid':_0x26165d[_0x68fd('0x11')],'isexternal':_0x26165d[_0x68fd('0x12')],'context':_0x26165d[_0x68fd('0x13')],'extension':_0x26165d['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x68fd('0x14')]=function(_0x5264b1){return client[_0x68fd('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x5264b1[_0x68fd('0x4')],'transfererchannel':_0x5264b1[_0x68fd('0x16')],'transferercalleridnum':_0x5264b1[_0x68fd('0x17')],'transferercalleridname':_0x5264b1[_0x68fd('0x18')],'transfererconnectedlinenum':_0x5264b1[_0x68fd('0x19')],'transfererconnectedlinename':_0x5264b1[_0x68fd('0x1a')],'transfereraccountcode':_0x5264b1[_0x68fd('0x1b')],'transferercontext':_0x5264b1['secondtransferercontext'],'transfererexten':_0x5264b1[_0x68fd('0x1c')],'transfererlinkedid':_0x5264b1['origtransfererlinkedid'],'transfereechannel':_0x5264b1[_0x68fd('0x1d')],'transfereecalleridnum':_0x5264b1[_0x68fd('0x1e')],'transfereecalleridname':_0x5264b1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5264b1[_0x68fd('0x1f')],'transfereeconnectedlinename':_0x5264b1[_0x68fd('0x20')],'transfereeaccountcode':_0x5264b1[_0x68fd('0x21')],'transfereecontext':_0x5264b1['transfertargetcontext'],'transfereeexten':_0x5264b1[_0x68fd('0x22')],'transfereelinkedid':_0x5264b1['transfertargetlinkedid'],'isexternal':_0x5264b1['isexternal'],'context':_0x5264b1[_0x68fd('0x23')],'extension':_0x5264b1[_0x68fd('0x24')],'type':_0x68fd('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index efb4b64..2d8876a 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x27b439,_0x337452){var _0x1c99ef=function(_0x115ff5){while(--_0x115ff5){_0x27b439['push'](_0x27b439['shift']());}};_0x1c99ef(++_0x337452);}(_0xb10b,0x12a));var _0xbb10=function(_0x31fb16,_0x262d15){_0x31fb16=_0x31fb16-0x0;var _0xc1998b=_0xb10b[_0x31fb16];return _0xc1998b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x30455c,_0x4c9676){var _0x32ef29=function(_0x5b3d82){while(--_0x5b3d82){_0x30455c['push'](_0x30455c['shift']());}};_0x32ef29(++_0x4c9676);}(_0x7a54,0x106));var _0x47a5=function(_0x4330f1,_0x904143){_0x4330f1=_0x4330f1-0x0;var _0x1d25d8=_0x7a54[_0x4330f1];return _0x1d25d8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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 74c7306..9bfd5f5 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 _0x437f=['union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','calleridnum','destcalleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x437f,0x14c));var _0xf437=function(_0x43c345,_0x4efb4d){_0x43c345=_0x43c345-0x0;var _0x138bfc=_0x437f[_0x43c345];return _0x138bfc;};'use strict';var _=require(_0xf437('0x0'));var BPromise=require(_0xf437('0x1'));var Redis=require(_0xf437('0x2'));var util=require(_0xf437('0x3'));var config=require(_0xf437('0x4'));var logger=require(_0xf437('0x5'))(_0xf437('0x6'));var cmContactRpc=require(_0xf437('0x7'));config[_0xf437('0x8')]=_[_0xf437('0x9')](config[_0xf437('0x8')],{'host':_0xf437('0xa'),'port':0x18eb});var io=require(_0xf437('0xb'))(new Redis(config[_0xf437('0x8')]));function emit(_0x136740,_0xbe7b5c,_0x49748b,_0x69a7b6,_0x28129f){logger[_0xf437('0xc')](_0xf437('0xd'),_0x136740,_0xbe7b5c['id'],_0x49748b,_0x69a7b6,JSON['stringify'](_0x28129f));io['to'](_0x49748b)['emit'](_0x69a7b6,_0x28129f);}exports[_0xf437('0xe')]=function(_0x29ee8d,_0x56cb1b,_0x1b6534,_0x3cdf50){var _0x2afedb,_0x52331c;var _0x1f2ed7={};var _0x2421ef;var _0x44a3b0=Number(_0x1b6534[_0xf437('0xf')]);var _0x59c576=_0x1b6534[_0xf437('0x10')]?Boolean(Number(_0x1b6534[_0xf437('0x10')])):![];var _0x25e90e;var _0x4e0868=![];if(!_[_0xf437('0x11')](_0x1b6534[_0xf437('0x12')])){if(_0x1b6534['data5']=='1')_0x4e0868=!![];}if(!_0x4e0868){if(_0x3cdf50[_0xf437('0x13')]){_0x1f2ed7['id']=_0x3cdf50[_0xf437('0x13')];}}if(!_0x1f2ed7['id']){_0x1f2ed7[_0xf437('0x14')]=_0x44a3b0;_0x25e90e=_0x1b6534[_0xf437('0x15')]&&_0x1b6534[_0xf437('0x15')]!=='0'?_0x1b6534[_0xf437('0x15')][_0xf437('0x16')](','):[_0xf437('0x17')];_0x1f2ed7[_0xf437('0x18')]=_['map'](_0x25e90e,function(_0x5cce2c){var _0x4917a3={};_0x4917a3[_0x5cce2c]=_0x3cdf50[_0xf437('0x19')]?_0x3cdf50['destcalleridnum']:_0x3cdf50[_0xf437('0x1a')];return _0x4917a3;});_0x2421ef=_0x3cdf50[_0xf437('0x19')]?_0x3cdf50[_0xf437('0x1b')]:_0x3cdf50[_0xf437('0x1a')];}var _0x4f97f3=['id',_0xf437('0x1c'),'lastName',_0xf437('0x17'),_0xf437('0x1d'),_0xf437('0x1e'),_0xf437('0x14'),_0xf437('0x1f'),_0xf437('0x20'),_0xf437('0x21')];var _0x38e957=_[_0xf437('0x22')](_0x4f97f3,_0x25e90e);BPromise[_0xf437('0x23')]()[_0xf437('0x24')](cmContactRpc[_0xf437('0x25')]({'attributes':_0x38e957,'where':_0x1f2ed7,'phone':_0x2421ef}))[_0xf437('0x24')](function(_0x2e67c2){_0x52331c=_0x2e67c2;if(!_[_0xf437('0x26')](_0x52331c)){if(_0x52331c['length']===0x1){_0x2afedb=_0x52331c[0x0];logger[_0xf437('0xc')](_0xf437('0x27'),_0x3cdf50['uniqueid'],_0x56cb1b['id'],_0x2afedb['id']);}else{logger['info'](_0xf437('0x28'),_0x3cdf50[_0xf437('0x29')],_0x56cb1b['id'],_[_0xf437('0x2a')](_0x52331c,'id')[_0xf437('0x2b')](','));}return;}else{logger[_0xf437('0xc')](_0xf437('0x2c'),_0x3cdf50['uniqueid'],_0x56cb1b['id']);var _0x5d45c8={'ListId':_0x44a3b0};var _0x1887d2=_0x1b6534[_0xf437('0x2d')]&&_0x1b6534[_0xf437('0x2d')]!=='0'?_0x1b6534[_0xf437('0x2d')]:_0xf437('0x17');if(_0x59c576){logger[_0xf437('0xc')](_0xf437('0x2e'),_0x3cdf50[_0xf437('0x29')],_0x56cb1b['id']);_0x5d45c8[_0x1887d2]=_[_0xf437('0x11')](_0x3cdf50[_0xf437('0x19')])?_0x3cdf50['calleridnum']:_0x3cdf50[_0xf437('0x1b')];if(_[_0xf437('0x11')](_0x3cdf50['routeId'])){_0x5d45c8[_0xf437('0x1c')]=_0x3cdf50[_0xf437('0x2f')]&&_0x3cdf50['calleridname']!==_0xf437('0x30')?_0x3cdf50['calleridname']:_0xf437('0x31');}else{_0x5d45c8[_0xf437('0x1c')]=_0x3cdf50[_0xf437('0x32')]&&_0x3cdf50['destcalleridname']!==''?_0x3cdf50[_0xf437('0x32')]:_0xf437('0x31');}return BPromise[_0xf437('0x23')]()[_0xf437('0x24')](cmContactRpc['createContact'](_0x5d45c8))[_0xf437('0x24')](function(_0x565c54){_0x2afedb=_0x565c54;_0x52331c['push'](_0x565c54);if(_0x2afedb){logger[_0xf437('0xc')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x3cdf50['uniqueid'],_0x56cb1b['id'],_0x2afedb['id']);}return;});}else{logger[_0xf437('0xc')](_0xf437('0x33'),_0x3cdf50['uniqueid'],_0x56cb1b['id']);_0x5d45c8[_0x1887d2]=_[_0xf437('0x11')](_0x3cdf50[_0xf437('0x19')])?_0x3cdf50[_0xf437('0x1a')]:_0x3cdf50[_0xf437('0x1b')];if(_[_0xf437('0x11')](_0x3cdf50['routeId'])){_0x5d45c8[_0xf437('0x1c')]=_0x3cdf50[_0xf437('0x2f')]&&_0x3cdf50[_0xf437('0x2f')]!==''?_0x3cdf50[_0xf437('0x2f')]:_0xf437('0x31');}else{_0x5d45c8[_0xf437('0x1c')]=_0x3cdf50[_0xf437('0x32')]&&_0x3cdf50['destcalleridname']!==_0xf437('0x30')?_0x3cdf50[_0xf437('0x32')]:_0xf437('0x31');}_0x2afedb=_0x5d45c8;_0x52331c[_0xf437('0x34')](_0x5d45c8);return;}}})[_0xf437('0x24')](function(){if(_0x29ee8d){emit(_0x3cdf50['uniqueid'],_0x56cb1b,util[_0xf437('0x35')](_0xf437('0x36'),_0x29ee8d[_0xf437('0x37')]),util[_0xf437('0x35')](_0xf437('0x38'),_0x1b6534[_0xf437('0x39')][_0xf437('0x3a')]()),{'evt':_[_0xf437('0x3b')](_0x3cdf50,{'autoCreate':_0x59c576}),'contact':_0x2afedb===undefined?{}:_0x2afedb,'contacts':_0x52331c[_0xf437('0x3c')]===0x0?undefined:_0x52331c});}});}; \ No newline at end of file +var _0xdb19=['emit','exec','data2','data5','xmd-contactid','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','ListId','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','merge','lodash','ioredis','util','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify'];(function(_0x487184,_0x12c34e){var _0x42f532=function(_0x31b66d){while(--_0x31b66d){_0x487184['push'](_0x487184['shift']());}};_0x42f532(++_0x12c34e);}(_0xdb19,0x169));var _0x9db1=function(_0x865a12,_0x6fc512){_0x865a12=_0x865a12-0x0;var _0x1dad8c=_0xdb19[_0x865a12];return _0x1dad8c;};'use strict';var _=require(_0x9db1('0x0'));var BPromise=require('bluebird');var Redis=require(_0x9db1('0x1'));var util=require(_0x9db1('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x9db1('0x3'));var cmContactRpc=require(_0x9db1('0x4'));config[_0x9db1('0x5')]=_[_0x9db1('0x6')](config['redis'],{'host':_0x9db1('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9db1('0x5')]));function emit(_0x23f31f,_0x4b2d05,_0x785760,_0x4d9d0e,_0x101b03){logger[_0x9db1('0x8')]('[CM][%s][%s]',_0x23f31f,_0x4b2d05['id'],_0x785760,_0x4d9d0e,JSON[_0x9db1('0x9')](_0x101b03));io['to'](_0x785760)[_0x9db1('0xa')](_0x4d9d0e,_0x101b03);}exports[_0x9db1('0xb')]=function(_0x12d45d,_0x59d8dc,_0x39ba02,_0x119e00){var _0x56a607,_0x105d9d;var _0x549464={};var _0x455d37;var _0xd218bf=Number(_0x39ba02['data1']);var _0x523bcf=_0x39ba02['data2']?Boolean(Number(_0x39ba02[_0x9db1('0xc')])):![];var _0x2c3f61;var _0x517b2c=![];if(!_['isNil'](_0x39ba02[_0x9db1('0xd')])){if(_0x39ba02[_0x9db1('0xd')]=='1')_0x517b2c=!![];}if(!_0x517b2c){if(_0x119e00[_0x9db1('0xe')]){_0x549464['id']=_0x119e00[_0x9db1('0xe')];}}if(!_0x549464['id']){_0x549464['ListId']=_0xd218bf;_0x2c3f61=_0x39ba02[_0x9db1('0xf')]&&_0x39ba02[_0x9db1('0xf')]!=='0'?_0x39ba02[_0x9db1('0xf')]['split'](','):[_0x9db1('0x10')];_0x549464[_0x9db1('0x11')]=_[_0x9db1('0x12')](_0x2c3f61,function(_0x53020c){var _0x5ad3e0={};_0x5ad3e0[_0x53020c]=_0x119e00[_0x9db1('0x13')]?_0x119e00[_0x9db1('0x14')]:_0x119e00['calleridnum'];return _0x5ad3e0;});_0x455d37=_0x119e00[_0x9db1('0x13')]?_0x119e00[_0x9db1('0x14')]:_0x119e00[_0x9db1('0x15')];}var _0x42747a=['id',_0x9db1('0x16'),_0x9db1('0x17'),_0x9db1('0x10'),_0x9db1('0x18'),'fax',_0x9db1('0x19'),'createdAt',_0x9db1('0x1a'),_0x9db1('0x1b')];var _0x1927e7=_['union'](_0x42747a,_0x2c3f61);BPromise[_0x9db1('0x1c')]()[_0x9db1('0x1d')](cmContactRpc[_0x9db1('0x1e')]({'attributes':_0x1927e7,'where':_0x549464,'phone':_0x455d37}))[_0x9db1('0x1d')](function(_0x3d59f2){_0x105d9d=_0x3d59f2;if(!_[_0x9db1('0x1f')](_0x105d9d)){if(_0x105d9d[_0x9db1('0x20')]===0x1){_0x56a607=_0x105d9d[0x0];logger[_0x9db1('0x8')](_0x9db1('0x21'),_0x119e00['uniqueid'],_0x59d8dc['id'],_0x56a607['id']);}else{logger[_0x9db1('0x8')](_0x9db1('0x22'),_0x119e00[_0x9db1('0x23')],_0x59d8dc['id'],_[_0x9db1('0x12')](_0x105d9d,'id')[_0x9db1('0x24')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x119e00[_0x9db1('0x23')],_0x59d8dc['id']);var _0x447479={'ListId':_0xd218bf};var _0x57d7f5=_0x39ba02[_0x9db1('0x25')]&&_0x39ba02[_0x9db1('0x25')]!=='0'?_0x39ba02['data4']:_0x9db1('0x10');if(_0x523bcf){logger[_0x9db1('0x8')](_0x9db1('0x26'),_0x119e00[_0x9db1('0x23')],_0x59d8dc['id']);_0x447479[_0x57d7f5]=_[_0x9db1('0x27')](_0x119e00[_0x9db1('0x13')])?_0x119e00[_0x9db1('0x15')]:_0x119e00[_0x9db1('0x14')];if(_[_0x9db1('0x27')](_0x119e00[_0x9db1('0x13')])){_0x447479[_0x9db1('0x16')]=_0x119e00[_0x9db1('0x28')]&&_0x119e00[_0x9db1('0x28')]!==_0x9db1('0x29')?_0x119e00[_0x9db1('0x28')]:_0x9db1('0x2a');}else{_0x447479[_0x9db1('0x16')]=_0x119e00[_0x9db1('0x2b')]&&_0x119e00[_0x9db1('0x2b')]!==_0x9db1('0x29')?_0x119e00['destcalleridname']:'Unknown';}return BPromise[_0x9db1('0x1c')]()[_0x9db1('0x1d')](cmContactRpc[_0x9db1('0x2c')](_0x447479))['then'](function(_0x25b39b){_0x56a607=_0x25b39b;_0x105d9d[_0x9db1('0x2d')](_0x25b39b);if(_0x56a607){logger[_0x9db1('0x8')](_0x9db1('0x2e'),_0x119e00['uniqueid'],_0x59d8dc['id'],_0x56a607['id']);}return;});}else{logger[_0x9db1('0x8')](_0x9db1('0x2f'),_0x119e00[_0x9db1('0x23')],_0x59d8dc['id']);_0x447479[_0x57d7f5]=_['isNil'](_0x119e00[_0x9db1('0x13')])?_0x119e00[_0x9db1('0x15')]:_0x119e00[_0x9db1('0x14')];if(_['isNil'](_0x119e00['routeId'])){_0x447479[_0x9db1('0x16')]=_0x119e00[_0x9db1('0x28')]&&_0x119e00['calleridname']!==_0x9db1('0x29')?_0x119e00['calleridname']:'Unknown';}else{_0x447479[_0x9db1('0x16')]=_0x119e00[_0x9db1('0x2b')]&&_0x119e00[_0x9db1('0x2b')]!==_0x9db1('0x29')?_0x119e00['destcalleridname']:_0x9db1('0x2a');}_0x56a607=_0x447479;_0x105d9d['push'](_0x447479);return;}}})[_0x9db1('0x1d')](function(){if(_0x12d45d){emit(_0x119e00[_0x9db1('0x23')],_0x59d8dc,util[_0x9db1('0x30')](_0x9db1('0x31'),_0x12d45d[_0x9db1('0x32')]),util[_0x9db1('0x30')](_0x9db1('0x33'),_0x39ba02['action']['toLowerCase']()),{'evt':_[_0x9db1('0x34')](_0x119e00,{'autoCreate':_0x523bcf}),'contact':_0x56a607===undefined?{}:_0x56a607,'contacts':_0x105d9d[_0x9db1('0x20')]===0x0?undefined:_0x105d9d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ff09302..542b663 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 _0x584a=['custom:amd','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:acceptmessage','custom:offlineMessage','info','stringify','prototype','clone','motionChannel','voice','debug','inspect','checkTriggers','hasOwnProperty','status','merge','variables','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','data6','winApplication','winArguments','emit','format','user:%s','name','jscripty','trigger:%s','exec','integration','voiceQueues','routeId','urlforward','script','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','operator','upperFirst','AccountId','value','message','event','queue','agent','membername','lastevent','null','substatus','offlineMessage','created','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','accounts','vtigerAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x584a,0x1d7));var _0xa584=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x584a[_0x2d8d69];return _0x39ae22;};'use strict';var util=require(_0xa584('0x0'));var _=require(_0xa584('0x1'));var url=require(_0xa584('0x2'));var Mustache=require(_0xa584('0x3'));var Redis=require(_0xa584('0x4'));var urlforward=require(_0xa584('0x5'));var integration=require(_0xa584('0x6'));var cmContact=require(_0xa584('0x7'));var script=require(_0xa584('0x8'));var config=require(_0xa584('0x9'));var logger=require(_0xa584('0xa'))('trigger');var ami=require(_0xa584('0xb'));config['redis']=_[_0xa584('0xc')](config[_0xa584('0xd')],{'host':_0xa584('0xe'),'port':0x18eb});var io=require(_0xa584('0xf'))(new Redis(config[_0xa584('0xd')]));var operators={'equals':function(_0x5a61d7,_0xdbd6f){return _0x5a61d7==_0xdbd6f;},'not_equals':function(_0x522b61,_0x109d0d){return _0x522b61!=_0x109d0d;}};var barAndWebActions=[_0xa584('0x10'),_0xa584('0x2'),_0xa584('0x11')];function Trigger(_0x4f96ef){this[_0xa584('0x12')]=_0x4f96ef[_0xa584('0x12')];this[_0xa584('0x13')]=_0x4f96ef[_0xa584('0x13')];this['voiceQueues']=_0x4f96ef['voiceQueues'];this['templates']=_0x4f96ef[_0xa584('0x14')];this[_0xa584('0x15')]=_0x4f96ef['voiceExtensions'];this[_0xa584('0x16')]=_0x4f96ef[_0xa584('0x16')];this[_0xa584('0x17')]=_0x4f96ef[_0xa584('0x17')];this[_0xa584('0x18')]=_0x4f96ef[_0xa584('0x18')];this['sugarcrmAccounts']=_0x4f96ef[_0xa584('0x19')];this[_0xa584('0x1a')]=_0x4f96ef['zohoAccounts'];this[_0xa584('0x1b')]=_0x4f96ef['deskAccounts'];this['vtigerAccounts']=_0x4f96ef['vtigerAccounts'];this[_0xa584('0x1c')]=_0x4f96ef[_0xa584('0x1c')];this[_0xa584('0x1d')]=_0x4f96ef['dynamics365Accounts'];this['freshsalesAccounts']=_0x4f96ef['freshsalesAccounts'];this[_0xa584('0x1e')]={'zendesk':this[_0xa584('0x16')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xa584('0x17')],'sugarcrm':this[_0xa584('0x19')],'zoho':this[_0xa584('0x1a')],'desk':this[_0xa584('0x1b')],'vtiger':this[_0xa584('0x1f')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xa584('0x1c')]};ami['on'](_0xa584('0x20'),this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on'](_0xa584('0x23'),this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on'](_0xa584('0x24'),this['syncCustomEvent'][_0xa584('0x22')](this));ami['on'](_0xa584('0x25'),this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on'](_0xa584('0x26'),this['syncCustomEvent'][_0xa584('0x22')](this));ami['on']('custom:agentnoanswer',this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on'](_0xa584('0x27'),this['syncCustomEvent'][_0xa584('0x22')](this));ami['on'](_0xa584('0x28'),this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on']('custom:agentreject',this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on'](_0xa584('0x29'),this['syncCustomEvent'][_0xa584('0x22')](this));ami['on']('custom:queuecallerabandon',this[_0xa584('0x21')]['bind'](this));ami['on'](_0xa584('0x2a'),this[_0xa584('0x21')]['bind'](this));ami['on'](_0xa584('0x2b'),this['syncAgentDial'][_0xa584('0x22')](this));ami['on'](_0xa584('0x2c'),this[_0xa584('0x2d')][_0xa584('0x22')](this));ami['on'](_0xa584('0x2e'),this[_0xa584('0x2d')][_0xa584('0x22')](this));ami['on'](_0xa584('0x2f'),this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on']('custom:closedinteraction',this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on'](_0xa584('0x30'),this['syncCustomEvent'][_0xa584('0x22')](this));ami['on']('custom:incomingmessage',this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on']('custom:outgoingmessage',this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on'](_0xa584('0x31'),this[_0xa584('0x21')][_0xa584('0x22')](this));ami['on']('custom:rejectmessage',this[_0xa584('0x21')]['bind'](this));ami['on'](_0xa584('0x32'),this[_0xa584('0x21')][_0xa584('0x22')](this));}Trigger['prototype']['emit']=function(_0x1b391d,_0x2469d1,_0x2ff6e9){logger[_0xa584('0x33')](_0x1b391d,_0x2469d1,JSON[_0xa584('0x34')](_0x2ff6e9));io['to'](_0x1b391d)['emit'](_0x2469d1,_0x2ff6e9);};Trigger[_0xa584('0x35')]['syncCustomEvent']=function(_0x3a581f){var _0x506720=_[_0xa584('0x36')](_0x3a581f);if(typeof _0x506720['motionChannel']==='undefined'){_0x506720[_0xa584('0x37')]=_0xa584('0x38');}logger[_0xa584('0x39')]('syncCustomEvent',util[_0xa584('0x3a')](_0x506720,{'showHidden':!![],'depth':null}));this[_0xa584('0x3b')](_0x506720);};Trigger[_0xa584('0x35')][_0xa584('0x2d')]=function(_0x38e7a1){if(this[_0xa584('0x13')][_0x38e7a1['interface']]){this[_0xa584('0x21')](_0x38e7a1);}};Trigger[_0xa584('0x35')][_0xa584('0x3b')]=function(_0x1ef9ed){var _0x15ca9d;for(var _0x58ffa5 in this[_0xa584('0x12')]){if(this['triggers'][_0xa584('0x3c')](_0x58ffa5)){if(this['triggers'][_0x58ffa5][_0xa584('0x3d')]){_0x15ca9d=this['checkTrigger'](this[_0xa584('0x12')][_0x58ffa5],_0x1ef9ed);if(_0x15ca9d){_[_0xa584('0x3e')](_0x1ef9ed,_0x1ef9ed[_0xa584('0x3f')]);for(var _0x41187a=0x0,_0x517764,_0x59323c,_0x32b9a6;_0x41187a0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x34ef17,_0xb05e86){var _0x665d53=function(_0x218381){while(--_0x218381){_0x34ef17['push'](_0x34ef17['shift']());}};_0x665d53(++_0xb05e86);}(_0x3e74,0x175));var _0x43e7=function(_0x567146,_0x2aa65d){_0x567146=_0x567146-0x0;var _0x2792f4=_0x3e74[_0x567146];return _0x2792f4;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 0a3cd1c..5f1c9d4 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 _0x4b21=['incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','modernAuthentication','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','../../../../config/logger','../../../../config/environment','defaults','localhost','redis','remoteUri','CloudProvider','data7','data2','resolve','clientId','username','password','clientSecret','then','access_token','catch',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','email','userEmail','length','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','message','toLowerCase','outbound','POST','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','calleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','picklist','type','nameField','customField','idField','indexOf','ticketType','incident'];(function(_0x14a134,_0x26355f){var _0x327d25=function(_0x2344ea){while(--_0x2344ea){_0x14a134['push'](_0x14a134['shift']());}};_0x327d25(++_0x26355f);}(_0x4b21,0x92));var _0x14b2=function(_0x4949a8,_0x1fb79f){_0x4949a8=_0x4949a8-0x0;var _0x59bfbf=_0x4b21[_0x4949a8];return _0x59bfbf;};'use strict';var _=require(_0x14b2('0x0'));var rp=require(_0x14b2('0x1'));var util=require('util');var intUtil=require(_0x14b2('0x2'));var md5=require('md5');var Redis=require(_0x14b2('0x3'));var logger=require(_0x14b2('0x4'))('dynamics365');var config=require(_0x14b2('0x5'));config['redis']=_[_0x14b2('0x6')](config['redis'],{'host':_0x14b2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x14b2('0x8')]));function getAuthToken(_0x5a8c25,_0x239c62,_0x4a032a){if(_0x5a8c25['modernAuthentication']){_0x5a8c25[_0x14b2('0x9')]=_0x5a8c25[_0x14b2('0xa')][_0x14b2('0xb')];_0x5a8c25['tenantId']=_0x5a8c25['CloudProvider'][_0x14b2('0xc')];return Promise[_0x14b2('0xd')](_0x5a8c25[_0x14b2('0xa')]['data5']);}var _0x2ff5ba={'method':'POST','uri':_0x239c62,'form':{'client_id':_0x5a8c25[_0x14b2('0xe')],'resource':_0x5a8c25[_0x14b2('0x9')],'username':_0x5a8c25[_0x14b2('0xf')],'password':_0x5a8c25['password'],'grant_type':_0x14b2('0x10'),'client_secret':_0x5a8c25[_0x14b2('0x11')]},'json':!![]};return rp(_0x2ff5ba)[_0x14b2('0x12')](function(_0x3f3d41){return _0x3f3d41[_0x14b2('0x13')];})[_0x14b2('0x14')](function(_0xf11ff6){logger['error']('['+[_0x4a032a['toUpperCase']()]+_0x14b2('0x15'));return _0xf11ff6['message'];});}function getUser(_0x2d6dcf,_0x8a97a1,_0x482204,_0x305b8c,_0x275d80,_0x42b523){return new Promise(function(_0x2300ed,_0x2c1ed1){return getAuthToken(_0x8a97a1,_0x305b8c,_0x42b523)['then'](function(_0x34edc3){var _0x128a69={'method':'GET','uri':_0x275d80+_0x14b2('0x16'),'headers':{'Authorization':_0x14b2('0x17')+_0x34edc3,'OData-Version':_0x14b2('0x18')},'json':!![]};return rp(_0x128a69);})[_0x14b2('0x12')](function(_0x17bd7d){var _0x5775f5=_0x17bd7d[_0x14b2('0x19')];var _0x3b5053=![];var _0x50fddf=null;if(!_['isNil'](_0x482204)){if(intUtil['validateEmail'](_0x482204[_0x14b2('0x1a')])){_0x2d6dcf[_0x14b2('0x1b')]=_0x482204[_0x14b2('0x1a')];for(_0x50fddf=0x0;_0x50fddf<_0x5775f5[_0x14b2('0x1c')];_0x50fddf++){if(_0x5775f5[_0x50fddf]['internalemailaddress']===_0x482204[_0x14b2('0x1a')]&&!_0x5775f5[_0x50fddf][_0x14b2('0x1d')]){_0x3b5053=!![];logger[_0x14b2('0x1e')]('['+[_0x42b523[_0x14b2('0x1f')]()]+_0x14b2('0x20')+_0x5775f5[_0x50fddf]['systemuserid']+'!');_0x2d6dcf[_0x14b2('0x21')]=_0x5775f5[_0x50fddf]['systemuserid'];}}}}if(!_0x3b5053){logger[_0x14b2('0x1e')]('['+[_0x42b523[_0x14b2('0x1f')]()]+_0x14b2('0x22'));_0x2d6dcf[_0x14b2('0x1b')]=_0x8a97a1[_0x14b2('0xf')];for(_0x50fddf=0x0;_0x50fddf<_0x5775f5[_0x14b2('0x1c')];_0x50fddf++){if(_0x5775f5[_0x50fddf][_0x14b2('0x23')]===_0x8a97a1['username']){_0x2d6dcf[_0x14b2('0x21')]=_0x5775f5[_0x50fddf]['systemuserid'];}}}_0x2300ed(_0x2d6dcf);})[_0x14b2('0x14')](function(_0x295981){_0x2c1ed1(_0x295981[_0x14b2('0x24')]);});});}function createEndUser(_0x1e998e,_0x3f696a,_0x482838,_0x1a7ac7,_0xa3d5c6,_0x2de64d,_0x40d752){return new Promise(function(_0x131670,_0x5b40d5){return getAuthToken(_0x3f696a,_0x482838,_0x2de64d)['then'](function(_0x4352f7){var _0x57d9ee=_0x2de64d[_0x14b2('0x25')]()===_0x14b2('0x26')?_0xa3d5c6['destcalleridnum']:_0xa3d5c6['calleridnum'];var _0x1ba34d={'method':_0x14b2('0x27'),'uri':_0x1a7ac7+_0x14b2('0x28'),'body':{'fullname':_0x57d9ee,'firstname':_0x57d9ee,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x14b2('0x29')+_0x1e998e[_0x14b2('0x21')]+')'},'headers':{'Authorization':_0x14b2('0x17')+_0x4352f7,'OData-Version':_0x14b2('0x18')},'json':!![],'resolveWithFullResponse':!![]};_0x1ba34d['body'][_0x40d752]=_0x57d9ee;return rp(_0x1ba34d);})[_0x14b2('0x12')](function(_0x1710a7){var _0x7f67cc=_0x1710a7[_0x14b2('0x2a')][_0x14b2('0x2b')];var _0x112c28=_0x7f67cc[_0x14b2('0x2c')](_0x7f67cc[_0x14b2('0x2d')]('(')+0x1,_0x7f67cc[_0x14b2('0x2d')](')'));_0x1e998e[_0x14b2('0x2e')]=_0x112c28;_0x131670(_0x1e998e);})[_0x14b2('0x14')](function(_0x4c6b56){_0x5b40d5(_0x4c6b56[_0x14b2('0x24')]);});});}function getEndUser(_0x415604,_0x576165,_0x1b5c7b,_0x52b223,_0xc0c70e,_0x462689,_0x789da3,_0x16a3bf){var _0xf661d7=_0x462689[_0x14b2('0x25')]()===_0x14b2('0x26')?_0xc0c70e[_0x14b2('0x2f')]:_0xc0c70e[_0x14b2('0x30')];return getAuthToken(_0x576165,_0x1b5c7b,_0x462689)[_0x14b2('0x12')](function(_0x2f1767){_0x16a3bf=_0x16a3bf?_0x16a3bf:_0x14b2('0x31');var _0x42e2d2={'method':_0x14b2('0x32'),'uri':_0x52b223+_0x14b2('0x33')+_0x16a3bf+_0x14b2('0x34')+_0x16a3bf+_0x14b2('0x35')+_0xf661d7[_0x14b2('0x36')]('+',_0x14b2('0x37'))+'\x27','headers':{'Authorization':_0x14b2('0x17')+_0x2f1767,'If-None-Match':null,'OData-Version':_0x14b2('0x18')},'json':!![]};return rp(_0x42e2d2);})[_0x14b2('0x12')](function(_0x473435){var _0x26e674=![];if(!_0x473435)return _0x26e674;var _0x136769=_0x473435['value'];for(var _0x39f391=0x0;_0x39f391<_0x136769[_0x14b2('0x1c')];_0x39f391++){if(_0x136769[_0x39f391][_0x16a3bf]===_0xf661d7){_0x26e674=!![];_0x415604[_0x14b2('0x2e')]=_0x136769[_0x39f391][_0x14b2('0x38')];}}return _0x26e674;})[_0x14b2('0x12')](function(_0x8627bb){if(_0x8627bb)return _0x415604;if(_0x789da3===_0x14b2('0x39')){logger[_0x14b2('0x1e')]('['+[_0x462689['toUpperCase']()]+_0x14b2('0x3a'));return _0x415604;}return createEndUser(_0x415604,_0x576165,_0x1b5c7b,_0x52b223,_0xc0c70e,_0x462689,_0x16a3bf)[_0x14b2('0x12')](function(_0x11e2c6){logger[_0x14b2('0x1e')]('['+[_0x462689['toUpperCase']()]+']\x20Enduser\x20created!',_0x11e2c6[_0x14b2('0x2e')]);return _0x11e2c6;});});}function getCustomFields(_0x4c6957,_0x2aebdb,_0x450084){var _0x3fc225={};if(_0x4c6957[_0x14b2('0x1c')]>0x0){_['forEach'](_0x4c6957,function(_0x58ead9){if(_[_0x14b2('0x3b')](['string',_0x14b2('0x3c')],_0x58ead9[_0x14b2('0x3d')])&&_0x58ead9[_0x14b2('0x3e')]&&!_0x58ead9[_0x14b2('0x3f')]){var _0x2ab2f7=_0x58ead9[_0x14b2('0x40')]['toLowerCase']();var _0x41415e=_0x2ab2f7[_0x14b2('0x2c')](0x0,_0x2ab2f7['indexOf']('_'));var _0x150311=_0x2ab2f7['substring'](_0x2ab2f7[_0x14b2('0x41')]('_')+0x1);if(_0x41415e===_0x450084){_0x3fc225[_0x150311]=_0x58ead9['content'];}}});}return _0x3fc225;}function getTicket(_0x334f62,_0x121d20,_0x9c487f,_0x4b1487,_0xdafc02,_0x3bf6fa,_0x127d33){return new Promise(function(_0x210748,_0x219541){var _0x5270cb;return getAuthToken(_0x121d20,_0x9c487f,_0x127d33)[_0x14b2('0x12')](function(_0x14c8df){if(_0x3bf6fa[_0x14b2('0x42')]===_0x14b2('0x43')){_0x5270cb={'method':_0x14b2('0x27'),'uri':_0x4b1487+_0x14b2('0x44'),'body':Object[_0x14b2('0x45')]({},{'title':intUtil[_0x14b2('0x46')](_0x3bf6fa['Subjects'],_0xdafc02,'\x20'),'description':intUtil['getString'](_0x3bf6fa[_0x14b2('0x47')],_0xdafc02,'\x0a'),'customerid_contact@odata.bind':_0x334f62[_0x14b2('0x2e')]?_0x14b2('0x48')+_0x334f62[_0x14b2('0x2e')]+')':undefined,'ownerid@odata.bind':_0x14b2('0x29')+_0x334f62[_0x14b2('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x3bf6fa[_0x14b2('0x49')],_0xdafc02,_0x3bf6fa[_0x14b2('0x42')])),'headers':{'Authorization':_0x14b2('0x17')+_0x14c8df,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3bf6fa['ticketType']===_0x14b2('0x4a')){var _0x5d3751=_0x334f62[_0x14b2('0x2e')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x334f62[_0x14b2('0x21')]+')','participationtypemask':_0x334f62['callDirection']===_0x14b2('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x334f62[_0x14b2('0x2e')]+')','participationtypemask':_0x334f62[_0x14b2('0x4c')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x14b2('0x29')+_0x334f62[_0x14b2('0x21')]+')','participationtypemask':_0x334f62['callDirection']===_0x14b2('0x4b')?0x2:0x1}];_0x5270cb={'method':_0x14b2('0x27'),'uri':_0x4b1487+'phonecalls','body':Object[_0x14b2('0x45')]({},{'subject':intUtil['getString'](_0x3bf6fa['Subjects'],_0xdafc02,'\x20'),'phonenumber':String(_0xdafc02['calleridnum']),'description':intUtil['getString'](_0x3bf6fa[_0x14b2('0x47')],_0xdafc02,'\x0a'),'regardingobjectid_contact@odata.bind':_0x334f62['enduserId']?'/contacts('+_0x334f62[_0x14b2('0x2e')]+')':undefined,'ownerid@odata.bind':_0x14b2('0x29')+_0x334f62[_0x14b2('0x21')]+')','directioncode':_0x334f62[_0x14b2('0x4c')]===_0x14b2('0x4b')?![]:!![],'phonecall_activity_parties':_0x5d3751},getCustomFields(_0x3bf6fa['Fields'],_0xdafc02,_0x3bf6fa[_0x14b2('0x42')])),'headers':{'Authorization':_0x14b2('0x17')+_0x14c8df,'OData-Version':_0x14b2('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5270cb);})['then'](function(_0x3ea197){var _0xa12291=_0x3ea197[_0x14b2('0x2a')][_0x14b2('0x2b')];var _0xd643d1=_0xa12291[_0x14b2('0x2c')](_0xa12291[_0x14b2('0x2d')]('(')+0x1,_0xa12291[_0x14b2('0x2d')](')'));_0x334f62['ticketId']=_0xd643d1;_0x210748(_0x334f62);})['catch'](function(_0x391938){_0x219541(_0x391938['message']);});});}function emit(_0x50539c,_0x5215a2,_0x291428,_0x2d45b7){var _0x2b66bf={'uri':util[_0x14b2('0x4d')](_0x14b2('0x4e'),_0x50539c,_0x291428,_0x2d45b7)};io['to'](util[_0x14b2('0x4d')]('user:%s',_0x5215a2))[_0x14b2('0x4f')](_0x14b2('0x50'),_0x2b66bf);}exports['cs']=function(_0x23df78,_0x283af1,_0x3a0909,_0xd8df1d,_0x4a0fbe,_0xa578af,_0x4a8258,_0x1e6391){var _0x1f216a={};_0xa578af[_0x14b2('0x9')]=_0xa578af['modernAuthentication']?intUtil[_0x14b2('0x51')](_0xa578af[_0x14b2('0xa')][_0x14b2('0xb')]):intUtil[_0x14b2('0x51')](_0xa578af[_0x14b2('0x9')]);_0xa578af['serverUrl']=intUtil[_0x14b2('0x51')](_0xa578af[_0x14b2('0x52')]);_0x1f216a[_0x14b2('0x4c')]=_0x1e6391===_0x14b2('0x4b')||_0x1e6391==='unmanaged'?_0x14b2('0x4b'):_0x14b2('0x26');var _0x4e2e39=_0xa578af[_0x14b2('0x53')]?util[_0x14b2('0x4d')](_0x14b2('0x54'),_0xa578af[_0x14b2('0xa')][_0x14b2('0xb')]):util[_0x14b2('0x4d')](_0x14b2('0x54'),_0xa578af['remoteUri']);var _0x2c8318=util[_0x14b2('0x4d')](_0x14b2('0x55'),_0xa578af[_0x14b2('0x56')]);var _0x38b872=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa578af['serverUrl'],_0x283af1[_0x14b2('0x57')],md5(_0x283af1[_0x14b2('0x57')]));if(_0x4a0fbe&&_0x4a0fbe[_0x14b2('0x58')]){logger['info'](_0x14b2('0x59'),'Recording\x20is\x20enabled!');_0x283af1['recordingURL']=_0x38b872;}else if(_0x4a8258&&_0x4a8258[_0x14b2('0x5a')]&&_0x4a8258[_0x14b2('0x5a')]!==_0x14b2('0x5b')){logger[_0x14b2('0x1e')]('[OUTBOUND]',_0x14b2('0x5c'));_0x283af1[_0x14b2('0x5d')]=_0x38b872;}else{_0x283af1[_0x14b2('0x5d')]='';}return getUser(_0x1f216a,_0xa578af,_0xd8df1d,_0x2c8318,_0x4e2e39,_0x1e6391)[_0x14b2('0x12')](function(_0x578c24){logger[_0x14b2('0x1e')]('['+_0x1e6391[_0x14b2('0x1f')]()+']\x20The\x20User\x20ID\x20is:',_0x578c24[_0x14b2('0x21')]);logger[_0x14b2('0x1e')]('['+_0x1e6391[_0x14b2('0x1f')]()+_0x14b2('0x5e'),_0x578c24[_0x14b2('0x1b')]);return getEndUser(_0x578c24,_0xa578af,_0x2c8318,_0x4e2e39,_0x283af1,_0x1e6391,_0x3a0909[_0x14b2('0x5f')],_0x3a0909[_0x14b2('0x60')]);})[_0x14b2('0x12')](function(_0x287be7){logger[_0x14b2('0x1e')]('['+_0x1e6391['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x287be7['enduserId']);logger['info']('['+_0x1e6391['toUpperCase']()+_0x14b2('0x61'),_0x283af1['calleridnum']);return getTicket(_0x287be7,_0xa578af,_0x2c8318,_0x4e2e39,_0x283af1,_0x3a0909,_0x1e6391);})[_0x14b2('0x12')](function(_0x564c51){logger[_0x14b2('0x1e')](util[_0x14b2('0x4d')]('['+_0x1e6391[_0x14b2('0x1f')]()+_0x14b2('0x62'),_0x3a0909[_0x14b2('0x42')],_0x564c51[_0x14b2('0x63')]));logger[_0x14b2('0x1e')](util[_0x14b2('0x4d')]('['+_0x1e6391[_0x14b2('0x1f')]()+_0x14b2('0x64'),_0x1e6391));if(_0x1e6391!==_0x14b2('0x65')&&_0x3a0909['openNewTab']){logger['info']('['+_0x1e6391[_0x14b2('0x1f')]()+']',_0x14b2('0x66'));emit(_0xa578af[_0x14b2('0x9')],_0xd8df1d[_0x14b2('0x67')],_0x3a0909[_0x14b2('0x42')],_0x564c51[_0x14b2('0x63')]);}})[_0x14b2('0x14')](function(_0x36af42){logger[_0x14b2('0x68')]('['+_0x1e6391[_0x14b2('0x1f')]()+_0x14b2('0x69'),_0x36af42[_0x14b2('0x24')]);console[_0x14b2('0x68')](_0x14b2('0x6a'),_0x36af42);});}; \ No newline at end of file +var _0xf72f=['info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','internalemailaddress','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','assign','getString','Subjects','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Descriptions','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','modernAuthentication','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','monitor_format','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','../../../../config/logger','redis','localhost','socket.io-emitter','remoteUri','data7','tenantId','data2','CloudProvider','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','validateEmail','email','userEmail','isdisabled'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf72f,0x189));var _0xff72=function(_0x52f654,_0x5f40a6){_0x52f654=_0x52f654-0x0;var _0x52af7c=_0xf72f[_0x52f654];return _0x52af7c;};'use strict';var _=require('lodash');var rp=require(_0xff72('0x0'));var util=require(_0xff72('0x1'));var intUtil=require('./util');var md5=require(_0xff72('0x2'));var Redis=require('ioredis');var logger=require(_0xff72('0x3'))('dynamics365');var config=require('../../../../config/environment');config[_0xff72('0x4')]=_['defaults'](config['redis'],{'host':_0xff72('0x5'),'port':0x18eb});var io=require(_0xff72('0x6'))(new Redis(config[_0xff72('0x4')]));function getAuthToken(_0x41f3b2,_0x571329,_0x2c99cb){if(_0x41f3b2['modernAuthentication']){_0x41f3b2[_0xff72('0x7')]=_0x41f3b2['CloudProvider'][_0xff72('0x8')];_0x41f3b2[_0xff72('0x9')]=_0x41f3b2['CloudProvider'][_0xff72('0xa')];return Promise['resolve'](_0x41f3b2[_0xff72('0xb')]['data5']);}var _0x4882d8={'method':_0xff72('0xc'),'uri':_0x571329,'form':{'client_id':_0x41f3b2[_0xff72('0xd')],'resource':_0x41f3b2[_0xff72('0x7')],'username':_0x41f3b2[_0xff72('0xe')],'password':_0x41f3b2[_0xff72('0xf')],'grant_type':_0xff72('0xf'),'client_secret':_0x41f3b2[_0xff72('0x10')]},'json':!![]};return rp(_0x4882d8)[_0xff72('0x11')](function(_0x31de21){return _0x31de21[_0xff72('0x12')];})[_0xff72('0x13')](function(_0x2c7a3e){logger[_0xff72('0x14')]('['+[_0x2c99cb[_0xff72('0x15')]()]+']\x20Wrong\x20credentials!');return _0x2c7a3e[_0xff72('0x16')];});}function getUser(_0x5940b6,_0x542362,_0xf3269a,_0x282a94,_0x4019a2,_0x537881){return new Promise(function(_0x36df41,_0x50d805){return getAuthToken(_0x542362,_0x282a94,_0x537881)[_0xff72('0x11')](function(_0x36e011){var _0x3eb34f={'method':_0xff72('0x17'),'uri':_0x4019a2+_0xff72('0x18'),'headers':{'Authorization':_0xff72('0x19')+_0x36e011,'OData-Version':_0xff72('0x1a')},'json':!![]};return rp(_0x3eb34f);})['then'](function(_0x117693){var _0x29be94=_0x117693['value'];var _0x3d6a6c=![];var _0x41514b=null;if(!_['isNil'](_0xf3269a)){if(intUtil[_0xff72('0x1b')](_0xf3269a[_0xff72('0x1c')])){_0x5940b6[_0xff72('0x1d')]=_0xf3269a['email'];for(_0x41514b=0x0;_0x41514b<_0x29be94['length'];_0x41514b++){if(_0x29be94[_0x41514b]['internalemailaddress']===_0xf3269a[_0xff72('0x1c')]&&!_0x29be94[_0x41514b][_0xff72('0x1e')]){_0x3d6a6c=!![];logger[_0xff72('0x1f')]('['+[_0x537881[_0xff72('0x15')]()]+_0xff72('0x20')+_0x29be94[_0x41514b][_0xff72('0x21')]+'!');_0x5940b6[_0xff72('0x22')]=_0x29be94[_0x41514b]['systemuserid'];}}}}if(!_0x3d6a6c){logger[_0xff72('0x1f')]('['+[_0x537881['toUpperCase']()]+_0xff72('0x23'));_0x5940b6[_0xff72('0x1d')]=_0x542362['username'];for(_0x41514b=0x0;_0x41514b<_0x29be94[_0xff72('0x24')];_0x41514b++){if(_0x29be94[_0x41514b][_0xff72('0x25')]===_0x542362[_0xff72('0xe')]){_0x5940b6[_0xff72('0x22')]=_0x29be94[_0x41514b][_0xff72('0x21')];}}}_0x36df41(_0x5940b6);})[_0xff72('0x13')](function(_0x344fcb){_0x50d805(_0x344fcb[_0xff72('0x16')]);});});}function createEndUser(_0x5cec3d,_0x3843b3,_0x221649,_0xf5fa6a,_0x1e9482,_0x43ef9a,_0xb0c0b8){return new Promise(function(_0x2c4d78,_0x18169d){return getAuthToken(_0x3843b3,_0x221649,_0x43ef9a)[_0xff72('0x11')](function(_0x1f3bba){var _0x1895e4=_0x43ef9a['toLowerCase']()===_0xff72('0x26')?_0x1e9482[_0xff72('0x27')]:_0x1e9482[_0xff72('0x28')];var _0xb2b288={'method':_0xff72('0xc'),'uri':_0xf5fa6a+'contacts','body':{'fullname':_0x1895e4,'firstname':_0x1895e4,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xff72('0x29')+_0x5cec3d[_0xff72('0x22')]+')'},'headers':{'Authorization':_0xff72('0x19')+_0x1f3bba,'OData-Version':_0xff72('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0xb2b288[_0xff72('0x2a')][_0xb0c0b8]=_0x1895e4;return rp(_0xb2b288);})[_0xff72('0x11')](function(_0x5349fe){var _0x2ba488=_0x5349fe[_0xff72('0x2b')][_0xff72('0x2c')];var _0x59f393=_0x2ba488[_0xff72('0x2d')](_0x2ba488['lastIndexOf']('(')+0x1,_0x2ba488[_0xff72('0x2e')](')'));_0x5cec3d['enduserId']=_0x59f393;_0x2c4d78(_0x5cec3d);})[_0xff72('0x13')](function(_0x4f5c62){_0x18169d(_0x4f5c62[_0xff72('0x16')]);});});}function getEndUser(_0x4c0e7c,_0x485b7c,_0x486874,_0x4320b0,_0x5d88f3,_0x42f99f,_0x6d43a6,_0xaca963){var _0x17bc89=_0x42f99f[_0xff72('0x2f')]()===_0xff72('0x26')?_0x5d88f3[_0xff72('0x27')]:_0x5d88f3['calleridnum'];return getAuthToken(_0x485b7c,_0x486874,_0x42f99f)[_0xff72('0x11')](function(_0x415484){_0xaca963=_0xaca963?_0xaca963:_0xff72('0x30');var _0x3a50ff={'method':_0xff72('0x17'),'uri':_0x4320b0+_0xff72('0x31')+_0xaca963+_0xff72('0x32')+_0xaca963+_0xff72('0x33')+_0x17bc89[_0xff72('0x34')]('+',_0xff72('0x35'))+'\x27','headers':{'Authorization':_0xff72('0x19')+_0x415484,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a50ff);})[_0xff72('0x11')](function(_0x4373aa){var _0x59b7b8=![];if(!_0x4373aa)return _0x59b7b8;var _0x323fbb=_0x4373aa['value'];for(var _0x641269=0x0;_0x641269<_0x323fbb['length'];_0x641269++){if(_0x323fbb[_0x641269][_0xaca963]===_0x17bc89){_0x59b7b8=!![];_0x4c0e7c[_0xff72('0x36')]=_0x323fbb[_0x641269][_0xff72('0x37')];}}return _0x59b7b8;})[_0xff72('0x11')](function(_0x189f21){if(_0x189f21)return _0x4c0e7c;if(_0x6d43a6===_0xff72('0x38')){logger[_0xff72('0x1f')]('['+[_0x42f99f[_0xff72('0x15')]()]+_0xff72('0x39'));return _0x4c0e7c;}return createEndUser(_0x4c0e7c,_0x485b7c,_0x486874,_0x4320b0,_0x5d88f3,_0x42f99f,_0xaca963)[_0xff72('0x11')](function(_0x4e90b5){logger[_0xff72('0x1f')]('['+[_0x42f99f['toUpperCase']()]+_0xff72('0x3a'),_0x4e90b5[_0xff72('0x36')]);return _0x4e90b5;});});}function getCustomFields(_0x39bb5a,_0x2babfc,_0x399693){var _0x49ff19={};if(_0x39bb5a[_0xff72('0x24')]>0x0){_[_0xff72('0x3b')](_0x39bb5a,function(_0x462fa7){if(_['includes']([_0xff72('0x3c'),_0xff72('0x3d')],_0x462fa7[_0xff72('0x3e')])&&_0x462fa7[_0xff72('0x3f')]&&!_0x462fa7[_0xff72('0x40')]){var _0x3daa7b=_0x462fa7[_0xff72('0x41')][_0xff72('0x2f')]();var _0x250240=_0x3daa7b[_0xff72('0x2d')](0x0,_0x3daa7b['indexOf']('_'));var _0x5ef9bc=_0x3daa7b[_0xff72('0x2d')](_0x3daa7b[_0xff72('0x42')]('_')+0x1);if(_0x250240===_0x399693){_0x49ff19[_0x5ef9bc]=_0x462fa7[_0xff72('0x43')];}}});}return _0x49ff19;}function getTicket(_0x542297,_0x1c9501,_0x256a4e,_0xd2a79e,_0x440cdd,_0x1b99ab,_0x9a18ac){return new Promise(function(_0x466a2d,_0x5197a6){var _0x3ac369;return getAuthToken(_0x1c9501,_0x256a4e,_0x9a18ac)['then'](function(_0x4b2247){if(_0x1b99ab[_0xff72('0x44')]==='incident'){_0x3ac369={'method':_0xff72('0xc'),'uri':_0xd2a79e+'incidents','body':Object[_0xff72('0x45')]({},{'title':intUtil[_0xff72('0x46')](_0x1b99ab[_0xff72('0x47')],_0x440cdd,'\x20'),'description':intUtil[_0xff72('0x46')](_0x1b99ab['Descriptions'],_0x440cdd,'\x0a'),'customerid_contact@odata.bind':_0x542297[_0xff72('0x36')]?_0xff72('0x48')+_0x542297[_0xff72('0x36')]+')':undefined,'ownerid@odata.bind':_0xff72('0x29')+_0x542297['userId']+')','caseorigincode':'1'},getCustomFields(_0x1b99ab[_0xff72('0x49')],_0x440cdd,_0x1b99ab[_0xff72('0x44')])),'headers':{'Authorization':_0xff72('0x19')+_0x4b2247,'OData-Version':_0xff72('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1b99ab[_0xff72('0x44')]===_0xff72('0x4a')){var _0x28164b=_0x542297[_0xff72('0x36')]?[{'partyid_systemuser@odata.bind':_0xff72('0x29')+_0x542297[_0xff72('0x22')]+')','participationtypemask':_0x542297[_0xff72('0x4b')]===_0xff72('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0xff72('0x48')+_0x542297[_0xff72('0x36')]+')','participationtypemask':_0x542297['callDirection']===_0xff72('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xff72('0x29')+_0x542297[_0xff72('0x22')]+')','participationtypemask':_0x542297[_0xff72('0x4b')]==='queue'?0x2:0x1}];_0x3ac369={'method':_0xff72('0xc'),'uri':_0xd2a79e+_0xff72('0x4d'),'body':Object[_0xff72('0x45')]({},{'subject':intUtil[_0xff72('0x46')](_0x1b99ab[_0xff72('0x47')],_0x440cdd,'\x20'),'phonenumber':String(_0x440cdd['calleridnum']),'description':intUtil[_0xff72('0x46')](_0x1b99ab[_0xff72('0x4e')],_0x440cdd,'\x0a'),'regardingobjectid_contact@odata.bind':_0x542297[_0xff72('0x36')]?'/contacts('+_0x542297[_0xff72('0x36')]+')':undefined,'ownerid@odata.bind':_0xff72('0x29')+_0x542297[_0xff72('0x22')]+')','directioncode':_0x542297[_0xff72('0x4b')]===_0xff72('0x4c')?![]:!![],'phonecall_activity_parties':_0x28164b},getCustomFields(_0x1b99ab[_0xff72('0x49')],_0x440cdd,_0x1b99ab['ticketType'])),'headers':{'Authorization':_0xff72('0x19')+_0x4b2247,'OData-Version':_0xff72('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3ac369);})['then'](function(_0xe545f7){var _0x21e9bb=_0xe545f7[_0xff72('0x2b')][_0xff72('0x2c')];var _0x46c363=_0x21e9bb[_0xff72('0x2d')](_0x21e9bb[_0xff72('0x2e')]('(')+0x1,_0x21e9bb[_0xff72('0x2e')](')'));_0x542297[_0xff72('0x4f')]=_0x46c363;_0x466a2d(_0x542297);})[_0xff72('0x13')](function(_0x264e9d){_0x5197a6(_0x264e9d[_0xff72('0x16')]);});});}function emit(_0x4c2abd,_0x2bf6e1,_0x1b58df,_0x152fd1){var _0x14b2e0={'uri':util['format'](_0xff72('0x50'),_0x4c2abd,_0x1b58df,_0x152fd1)};io['to'](util[_0xff72('0x51')](_0xff72('0x52'),_0x2bf6e1))[_0xff72('0x53')](_0xff72('0x54'),_0x14b2e0);}exports['cs']=function(_0x119a29,_0x2bbba0,_0x119bf1,_0x533d9b,_0x4724bd,_0x1b6290,_0x51912f,_0x2a903c){var _0x3ee1e8={};_0x1b6290[_0xff72('0x7')]=_0x1b6290[_0xff72('0x55')]?intUtil[_0xff72('0x56')](_0x1b6290['CloudProvider'][_0xff72('0x8')]):intUtil[_0xff72('0x56')](_0x1b6290[_0xff72('0x7')]);_0x1b6290[_0xff72('0x57')]=intUtil[_0xff72('0x56')](_0x1b6290['serverUrl']);_0x3ee1e8[_0xff72('0x4b')]=_0x2a903c==='queue'||_0x2a903c==='unmanaged'?_0xff72('0x4c'):_0xff72('0x26');var _0x6611ee=_0x1b6290['modernAuthentication']?util[_0xff72('0x51')]('%s/api/data/v9.0/',_0x1b6290[_0xff72('0xb')][_0xff72('0x8')]):util[_0xff72('0x51')](_0xff72('0x58'),_0x1b6290['remoteUri']);var _0x2748ad=util[_0xff72('0x51')](_0xff72('0x59'),_0x1b6290[_0xff72('0x9')]);var _0x57244c=util['format'](_0xff72('0x5a'),_0x1b6290['serverUrl'],_0x2bbba0['uniqueid'],md5(_0x2bbba0[_0xff72('0x5b')]));if(_0x4724bd&&_0x4724bd[_0xff72('0x5c')]){logger['info'](_0xff72('0x5d'),'Recording\x20is\x20enabled!');_0x2bbba0['recordingURL']=_0x57244c;}else if(_0x51912f&&_0x51912f[_0xff72('0x5e')]&&_0x51912f[_0xff72('0x5e')]!=='none'){logger[_0xff72('0x1f')](_0xff72('0x5f'),_0xff72('0x60'));_0x2bbba0[_0xff72('0x61')]=_0x57244c;}else{_0x2bbba0[_0xff72('0x61')]='';}return getUser(_0x3ee1e8,_0x1b6290,_0x533d9b,_0x2748ad,_0x6611ee,_0x2a903c)[_0xff72('0x11')](function(_0x4fd2bc){logger['info']('['+_0x2a903c['toUpperCase']()+_0xff72('0x62'),_0x4fd2bc[_0xff72('0x22')]);logger['info']('['+_0x2a903c['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x4fd2bc[_0xff72('0x1d')]);return getEndUser(_0x4fd2bc,_0x1b6290,_0x2748ad,_0x6611ee,_0x2bbba0,_0x2a903c,_0x119bf1[_0xff72('0x63')],_0x119bf1[_0xff72('0x64')]);})[_0xff72('0x11')](function(_0x4945f7){logger['info']('['+_0x2a903c[_0xff72('0x15')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x4945f7[_0xff72('0x36')]);logger[_0xff72('0x1f')]('['+_0x2a903c[_0xff72('0x15')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x2bbba0['calleridnum']);return getTicket(_0x4945f7,_0x1b6290,_0x2748ad,_0x6611ee,_0x2bbba0,_0x119bf1,_0x2a903c);})[_0xff72('0x11')](function(_0x606bff){logger[_0xff72('0x1f')](util[_0xff72('0x51')]('['+_0x2a903c[_0xff72('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x119bf1[_0xff72('0x44')],_0x606bff['ticketId']));logger[_0xff72('0x1f')](util[_0xff72('0x51')]('['+_0x2a903c[_0xff72('0x15')]()+']\x20Call\x20direction:\x20%s',_0x2a903c));if(_0x2a903c!==_0xff72('0x65')&&_0x119bf1[_0xff72('0x66')]){logger[_0xff72('0x1f')]('['+_0x2a903c['toUpperCase']()+']',_0xff72('0x67'));emit(_0x1b6290[_0xff72('0x7')],_0x533d9b[_0xff72('0x68')],_0x119bf1['ticketType'],_0x606bff[_0xff72('0x4f')]);}})[_0xff72('0x13')](function(_0x5f59b3){logger[_0xff72('0x14')]('['+_0x2a903c[_0xff72('0x15')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x5f59b3['message']);console[_0xff72('0x14')](_0xff72('0x69'),_0x5f59b3);});}; \ 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 f83f398..2c7a9ba 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 _0xa4c1=['Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string','customField','toLowerCase','picklist','idField','push','content','type','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','user:%s','trigger:browser:url','catch','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','monitor_format','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','application/json','info','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa4c1,0x14f));var _0x1a4c=function(_0x17ebae,_0x7da3){_0x17ebae=_0x17ebae-0x0;var _0x8cbe7d=_0xa4c1[_0x17ebae];return _0x8cbe7d;};'use strict';var _=require(_0x1a4c('0x0'));var rp=require(_0x1a4c('0x1'));var md5=require(_0x1a4c('0x2'));var util=require(_0x1a4c('0x3'));var Redis=require(_0x1a4c('0x4'));var intUtil=require(_0x1a4c('0x5'));var config=require(_0x1a4c('0x6'));var logger=require(_0x1a4c('0x7'))(_0x1a4c('0x8'));config['redis']=_[_0x1a4c('0x9')](config[_0x1a4c('0xa')],{'host':_0x1a4c('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1a4c('0xa')]));var headers={'Content-Type':_0x1a4c('0xc'),'Accept':_0x1a4c('0xc')};function emit(_0x113a51,_0x225d83,_0x1454c6){io['to'](_0x113a51)['emit'](_0x225d83,_0x1454c6);}function getTicket(_0x409bd4,_0x5d6c97,_0x11e21a,_0x3329a0,_0x277552){logger[_0x1a4c('0xd')]('Creating\x20new\x20ticket...');var _0x46cb6d=_['merge']({'responder_id':_0x5d6c97['id'],'requester_id':_0x11e21a['id'],'name':util['format'](_0x1a4c('0xe'),_0x277552[_0x1a4c('0xf')]),'phone':_0x277552[_0x1a4c('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1a4c('0x11')](_0x3329a0['Subjects'],_0x277552,'\x20'),'description':intUtil['getString'](_0x3329a0['Descriptions'],_0x277552,_0x1a4c('0x12')),'tags':getTags(_0x3329a0[_0x1a4c('0x13')],_0x1a4c('0x14'))},getCustomFields(_0x3329a0[_0x1a4c('0x15')],_0x277552));_0x46cb6d[_0x1a4c('0x16')]=_[_0x1a4c('0x17')](_[_0x1a4c('0x18')](_0x46cb6d[_0x1a4c('0x16')],'id'),_0x1a4c('0x19'));return request({'uri':util[_0x1a4c('0x1a')](_0x1a4c('0x1b'),_0x409bd4[_0x1a4c('0x1c')]),'method':_0x1a4c('0x1d'),'body':_0x46cb6d})[_0x1a4c('0x1e')](function(_0x1fb5ec){logger[_0x1a4c('0xd')]('Ticket\x20created!');return _0x1fb5ec;});}function getUser(_0x4e6df6,_0x4a1c50){if(intUtil['validateEmail'](_0x4a1c50)){return request({'uri':util[_0x1a4c('0x1a')](_0x1a4c('0x1f'),_0x4e6df6[_0x1a4c('0x1c')]),'qs':{'email':_0x4a1c50}})[_0x1a4c('0x1e')](function(_0x551953){if(_0x551953[_0x1a4c('0x20')]){logger[_0x1a4c('0xd')](_0x1a4c('0x21'));return _[_0x1a4c('0x22')](_0x551953,function(_0x5bacfe){return _0x5bacfe[_0x1a4c('0x23')]['email']===_0x4a1c50;});}else{logger[_0x1a4c('0xd')](_0x1a4c('0x24'));return request({'uri':util[_0x1a4c('0x1a')]('%s/api/v2/agents/me',_0x4e6df6[_0x1a4c('0x1c')])})['then'](function(_0x45f1e3){logger[_0x1a4c('0xd')]('Admin\x20account\x20selected.');return _0x45f1e3;});}});}else{logger[_0x1a4c('0xd')](_0x1a4c('0x25'));return request({'uri':util[_0x1a4c('0x1a')](_0x1a4c('0x26'),_0x4e6df6[_0x1a4c('0x1c')])})['then'](function(_0x32ca29){logger[_0x1a4c('0xd')](_0x1a4c('0x27'));return _0x32ca29;});}}function getEndUser(_0x5e5fe2,_0x2f60a5,_0x4ed73b){logger[_0x1a4c('0xd')](_0x1a4c('0x28'),_0x4ed73b);return request({'uri':util[_0x1a4c('0x1a')]('%s/api/v2/contacts',_0x5e5fe2['remoteUri']),'qs':{'phone':_0x4ed73b}})[_0x1a4c('0x1e')](function(_0x1b3fac){if(_0x1b3fac[_0x1a4c('0x20')]){logger['info']('Enduser\x20found!');return _['find'](_0x1b3fac,{'phone':_0x4ed73b});}else{logger['info'](_0x1a4c('0x29'));return request({'uri':util[_0x1a4c('0x1a')]('%s/api/v2/contacts',_0x5e5fe2[_0x1a4c('0x1c')]),'method':'POST','body':{'name':_0x2f60a5,'phone':_0x4ed73b}})[_0x1a4c('0x1e')](function(_0x1d27bf){logger[_0x1a4c('0xd')](_0x1a4c('0x2a'));return _0x1d27bf;});}});}function getAuth(_0x2deeab){return util[_0x1a4c('0x1a')](_0x1a4c('0x2b'),new Buffer(_0x2deeab['apiKey']+':X')[_0x1a4c('0x2c')](_0x1a4c('0x2d')));}function request(_0x7016cb){logger['debug'](_0x1a4c('0x2e'),JSON[_0x1a4c('0x2f')](_0x7016cb));return rp(_['defaults'](_0x7016cb,{'method':_0x1a4c('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x21cb4a,_0x51604f){var _0x4fbfe6=[];if(_0x21cb4a&&_0x21cb4a[_0x1a4c('0x20')]>0x0){_0x4fbfe6=_[_0x1a4c('0x31')](_0x21cb4a,_0x51604f);}return _0x4fbfe6;}function getCustomFields(_0x4e1044,_0x4ea6fc){var _0x55f702=[];var _0x178bfb={'custom_fields':[]};if(_0x4e1044[_0x1a4c('0x20')]>0x0){_[_0x1a4c('0x32')](_0x4e1044,function(_0x215bdf){if(_[_0x1a4c('0x33')]([_0x1a4c('0x34'),'picklist'],_0x215bdf['type'])&&_0x215bdf['nameField']&&!_0x215bdf[_0x1a4c('0x35')]){_0x178bfb[_0x215bdf['nameField'][_0x1a4c('0x36')]()]=_0x215bdf['content'][_0x1a4c('0x2c')]();}else if(_[_0x1a4c('0x33')]([_0x1a4c('0x34'),_0x1a4c('0x37')],_0x215bdf['type'])&&_0x215bdf[_0x1a4c('0x38')]&&_0x215bdf[_0x1a4c('0x35')]){_0x178bfb[_0x1a4c('0x16')][_0x1a4c('0x39')]({'id':_0x215bdf[_0x1a4c('0x38')],'value':_0x215bdf[_0x1a4c('0x3a')][_0x1a4c('0x2c')]()});}else if(_0x215bdf[_0x1a4c('0x3b')]===_0x1a4c('0x3c')&&_0x215bdf[_0x1a4c('0x3d')]&&_0x215bdf['idField']&&_0x215bdf[_0x1a4c('0x35')]){_0x4ea6fc[_0x215bdf['variableName']]&&_0x178bfb[_0x1a4c('0x16')]['push']({'id':_0x215bdf[_0x1a4c('0x38')],'value':_0x4ea6fc[_0x215bdf[_0x1a4c('0x3d')]][_0x1a4c('0x2c')]()});}else if(_0x215bdf[_0x1a4c('0x3b')]==='customVariable'&&_0x215bdf[_0x1a4c('0x3e')]&&_0x215bdf[_0x1a4c('0x3e')][_0x1a4c('0x14')]&&_0x215bdf[_0x1a4c('0x38')]&&_0x215bdf[_0x1a4c('0x35')]){_0x4ea6fc[_0x215bdf[_0x1a4c('0x3e')]['name']['toLowerCase']()]&&_0x178bfb[_0x1a4c('0x16')][_0x1a4c('0x39')]({'id':_0x215bdf[_0x1a4c('0x38')],'value':_0x4ea6fc[_0x215bdf['Variable'][_0x1a4c('0x14')]['toLowerCase']()][_0x1a4c('0x2c')]()});}});}return _0x178bfb;}exports[_0x1a4c('0x3f')]=function(_0x2a6377,_0x2df314,_0x4fa6da,_0x5c55b1,_0x3450e1,_0x2a02f1){var _0x56bd3b,_0x438c8b;_0x2a02f1['remoteUri']=intUtil[_0x1a4c('0x40')](_0x2a02f1['remoteUri']);_0x2a02f1[_0x1a4c('0x41')]=intUtil[_0x1a4c('0x40')](_0x2a02f1[_0x1a4c('0x41')]);if(_0x3450e1&&_0x3450e1['monitor_format']){logger[_0x1a4c('0xd')](_0x1a4c('0x42'),'Recording\x20is\x20enabled!');_0x2df314['recordingURL']=util[_0x1a4c('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a02f1[_0x1a4c('0x41')],_0x2df314['uniqueid'],md5(_0x2df314[_0x1a4c('0x43')]));}else{_0x2df314[_0x1a4c('0x44')]='';}headers[_0x1a4c('0x45')]=getAuth(_0x2a02f1);return getUser(_0x2a02f1,_0x5c55b1[_0x1a4c('0x46')])[_0x1a4c('0x1e')](function(_0x3c914f){_0x56bd3b=_0x3c914f;logger[_0x1a4c('0xd')](_0x1a4c('0x47'),_0x56bd3b['id']);return getEndUser(_0x2a02f1,_0x2df314[_0x1a4c('0xf')],_0x2df314['calleridnum']);})[_0x1a4c('0x1e')](function(_0x4df492){_0x438c8b=_0x4df492;logger[_0x1a4c('0xd')](_0x1a4c('0x48'),_0x438c8b['id']);return getTicket(_0x2a02f1,_0x56bd3b,_0x438c8b,_0x4fa6da,_0x2df314);})[_0x1a4c('0x1e')](function(_0x4bf8e2){if(_0x4bf8e2&&_0x4bf8e2['id']){logger[_0x1a4c('0xd')](_0x1a4c('0x49'));logger[_0x1a4c('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4bf8e2['id']);logger[_0x1a4c('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1a4c('0x4a'),_0x5c55b1[_0x1a4c('0x14')]),_0x1a4c('0x4b'),{'uri':util[_0x1a4c('0x1a')]('%s/helpdesk/tickets/%d',_0x2a02f1[_0x1a4c('0x1c')],_0x4bf8e2['id'])});}})[_0x1a4c('0x4c')](function(_0x4e1d75){logger['error'](_0x1a4c('0x42'),JSON[_0x1a4c('0x2f')](_0x4e1d75));});};exports['outbound']=function(_0x2b0c84,_0x3a1486,_0x5adf1c,_0x4d981f,_0x427819,_0xde97fa,_0x34f9d2){var _0x4da30c,_0x1e68b8;_0xde97fa[_0x1a4c('0x1c')]=intUtil[_0x1a4c('0x40')](_0xde97fa['remoteUri']);_0xde97fa[_0x1a4c('0x41')]=intUtil[_0x1a4c('0x40')](_0xde97fa[_0x1a4c('0x41')]);if(_0x34f9d2&&_0x34f9d2['recordingFormat']&&_0x34f9d2['recordingFormat']!==_0x1a4c('0x4d')){logger[_0x1a4c('0xd')](_0x1a4c('0x4e'),_0x1a4c('0x4f'));_0x3a1486[_0x1a4c('0x44')]=util['format'](_0x1a4c('0x50'),_0xde97fa[_0x1a4c('0x41')],_0x3a1486[_0x1a4c('0x43')],md5(_0x3a1486[_0x1a4c('0x43')]));}headers[_0x1a4c('0x45')]=getAuth(_0xde97fa);return getUser(_0xde97fa,_0x4d981f[_0x1a4c('0x46')])[_0x1a4c('0x1e')](function(_0x1f86ed){_0x4da30c=_0x1f86ed;logger[_0x1a4c('0xd')](_0x1a4c('0x47'),_0x4da30c['id']);return getEndUser(_0xde97fa,_0x3a1486[_0x1a4c('0x51')],_0x3a1486[_0x1a4c('0x52')]);})['then'](function(_0x4bb7db){_0x1e68b8=_0x4bb7db;logger[_0x1a4c('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1e68b8['id']);return getTicket(_0xde97fa,_0x4da30c,_0x1e68b8,_0x5adf1c,_0x3a1486);})[_0x1a4c('0x1e')](function(_0x2c39ec){if(_0x2c39ec&&_0x2c39ec['id']){logger['info'](_0x1a4c('0x49'));logger[_0x1a4c('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2c39ec['id']);logger[_0x1a4c('0xd')](_0x1a4c('0x4e'),_0x1a4c('0x53'));emit(util[_0x1a4c('0x1a')]('user:%s',_0x4d981f['name']),_0x1a4c('0x4b'),{'uri':util[_0x1a4c('0x1a')](_0x1a4c('0x54'),_0xde97fa[_0x1a4c('0x1c')],_0x2c39ec['id'])});}})[_0x1a4c('0x4c')](function(_0x4a2bbe){logger[_0x1a4c('0x55')](_0x1a4c('0x4e'),JSON[_0x1a4c('0x2f')](_0x4a2bbe));});};exports['unmanaged']=function(_0x345e21,_0x268d13,_0x24f42a,_0x3b1f2b,_0x594ff0,_0x54efc7){var _0x5bf58e,_0x5daa54;_0x54efc7[_0x1a4c('0x1c')]=intUtil['stripTrailingSlash'](_0x54efc7[_0x1a4c('0x1c')]);_0x54efc7['serverUrl']=intUtil[_0x1a4c('0x40')](_0x54efc7[_0x1a4c('0x41')]);if(_0x594ff0&&_0x594ff0[_0x1a4c('0x56')]){logger['info']('['+_0x268d13['lastevent'][_0x1a4c('0x57')]()+']',_0x1a4c('0x4f'));_0x268d13['recordingURL']=util[_0x1a4c('0x1a')](_0x1a4c('0x50'),_0x54efc7[_0x1a4c('0x41')],_0x268d13[_0x1a4c('0x43')],md5(_0x268d13['uniqueid']));}else{_0x268d13[_0x1a4c('0x44')]='';}headers[_0x1a4c('0x45')]=getAuth(_0x54efc7);return getUser(_0x54efc7,'')[_0x1a4c('0x1e')](function(_0x58136a){_0x5bf58e=_0x58136a;logger[_0x1a4c('0xd')]('The\x20User\x20ID\x20is:',_0x5bf58e['id']);return getEndUser(_0x54efc7,_0x268d13[_0x1a4c('0xf')],_0x268d13[_0x1a4c('0x10')]);})[_0x1a4c('0x1e')](function(_0x432067){_0x5daa54=_0x432067;logger[_0x1a4c('0xd')](_0x1a4c('0x48'),_0x5daa54['id']);return getTicket(_0x54efc7,_0x5bf58e,_0x5daa54,_0x24f42a,_0x268d13);})[_0x1a4c('0x1e')](function(_0x22a200){if(_0x22a200){logger[_0x1a4c('0xd')](_0x1a4c('0x49'));logger[_0x1a4c('0xd')](_0x1a4c('0x58'),_0x22a200['id']);}})['catch'](function(_0x304163){logger[_0x1a4c('0x55')]('['+_0x268d13['lastevent']['toUpperCase']()+']',JSON[_0x1a4c('0x2f')](_0x304163));});}; \ No newline at end of file +var _0x52d4=['Fields','custom_fields','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','customField','content','idField','variable','variableName','push','customVariable','Variable','name','toLowerCase','toString','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Tags'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x52d4,0x103));var _0x452d=function(_0x4c8f89,_0x318d19){_0x4c8f89=_0x4c8f89-0x0;var _0x5c5685=_0x52d4[_0x4c8f89];return _0x5c5685;};'use strict';var _=require(_0x452d('0x0'));var rp=require(_0x452d('0x1'));var md5=require(_0x452d('0x2'));var util=require(_0x452d('0x3'));var Redis=require(_0x452d('0x4'));var intUtil=require(_0x452d('0x5'));var config=require(_0x452d('0x6'));var logger=require(_0x452d('0x7'))(_0x452d('0x8'));config[_0x452d('0x9')]=_[_0x452d('0xa')](config[_0x452d('0x9')],{'host':_0x452d('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x452d('0xc'),'Accept':_0x452d('0xc')};function emit(_0x92e693,_0x27142f,_0x5e892d){io['to'](_0x92e693)[_0x452d('0xd')](_0x27142f,_0x5e892d);}function getTicket(_0x10a1c5,_0x41881e,_0x1dbc9e,_0x50a57e,_0x399894){logger[_0x452d('0xe')](_0x452d('0xf'));var _0x2d0904=_['merge']({'responder_id':_0x41881e['id'],'requester_id':_0x1dbc9e['id'],'name':util[_0x452d('0x10')](_0x452d('0x11'),_0x399894[_0x452d('0x12')]),'phone':_0x399894[_0x452d('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x452d('0x14')](_0x50a57e[_0x452d('0x15')],_0x399894,'\x20'),'description':intUtil['getString'](_0x50a57e['Descriptions'],_0x399894,'
'),'tags':getTags(_0x50a57e[_0x452d('0x16')],'name')},getCustomFields(_0x50a57e[_0x452d('0x17')],_0x399894));_0x2d0904[_0x452d('0x18')]=_['mapValues'](_[_0x452d('0x19')](_0x2d0904['custom_fields'],'id'),_0x452d('0x1a'));return request({'uri':util['format']('%s/api/v2/tickets',_0x10a1c5[_0x452d('0x1b')]),'method':_0x452d('0x1c'),'body':_0x2d0904})[_0x452d('0x1d')](function(_0x8dbbec){logger[_0x452d('0xe')](_0x452d('0x1e'));return _0x8dbbec;});}function getUser(_0x490dd9,_0x4da448){if(intUtil[_0x452d('0x1f')](_0x4da448)){return request({'uri':util[_0x452d('0x10')](_0x452d('0x20'),_0x490dd9[_0x452d('0x1b')]),'qs':{'email':_0x4da448}})[_0x452d('0x1d')](function(_0x1a03ff){if(_0x1a03ff[_0x452d('0x21')]){logger[_0x452d('0xe')](_0x452d('0x22'));return _[_0x452d('0x23')](_0x1a03ff,function(_0x451195){return _0x451195['contact'][_0x452d('0x24')]===_0x4da448;});}else{logger[_0x452d('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x452d('0x25'),_0x490dd9[_0x452d('0x1b')])})[_0x452d('0x1d')](function(_0x193ed1){logger[_0x452d('0xe')]('Admin\x20account\x20selected.');return _0x193ed1;});}});}else{logger[_0x452d('0xe')](_0x452d('0x26'));return request({'uri':util[_0x452d('0x10')](_0x452d('0x25'),_0x490dd9[_0x452d('0x1b')])})[_0x452d('0x1d')](function(_0x43ebf5){logger[_0x452d('0xe')](_0x452d('0x27'));return _0x43ebf5;});}}function getEndUser(_0x4504e9,_0x570fdf,_0x4b9f81){logger[_0x452d('0xe')](_0x452d('0x28'),_0x4b9f81);return request({'uri':util[_0x452d('0x10')](_0x452d('0x29'),_0x4504e9[_0x452d('0x1b')]),'qs':{'phone':_0x4b9f81}})['then'](function(_0x4d99eb){if(_0x4d99eb['length']){logger[_0x452d('0xe')](_0x452d('0x2a'));return _['find'](_0x4d99eb,{'phone':_0x4b9f81});}else{logger[_0x452d('0xe')](_0x452d('0x2b'));return request({'uri':util[_0x452d('0x10')](_0x452d('0x29'),_0x4504e9['remoteUri']),'method':_0x452d('0x1c'),'body':{'name':_0x570fdf,'phone':_0x4b9f81}})[_0x452d('0x1d')](function(_0x39bc33){logger[_0x452d('0xe')](_0x452d('0x2c'));return _0x39bc33;});}});}function getAuth(_0x912b5a){return util['format']('Basic\x20%s',new Buffer(_0x912b5a['apiKey']+':X')['toString'](_0x452d('0x2d')));}function request(_0xaa5aa){logger[_0x452d('0x2e')](_0x452d('0x2f'),JSON[_0x452d('0x30')](_0xaa5aa));return rp(_['defaults'](_0xaa5aa,{'method':_0x452d('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x75501e,_0x5a9204){var _0x3e8a70=[];if(_0x75501e&&_0x75501e[_0x452d('0x21')]>0x0){_0x3e8a70=_[_0x452d('0x32')](_0x75501e,_0x5a9204);}return _0x3e8a70;}function getCustomFields(_0x29bd55,_0x392225){var _0x29a93e=[];var _0x5a2410={'custom_fields':[]};if(_0x29bd55[_0x452d('0x21')]>0x0){_['forEach'](_0x29bd55,function(_0x2ead90){if(_[_0x452d('0x33')]([_0x452d('0x34'),_0x452d('0x35')],_0x2ead90[_0x452d('0x36')])&&_0x2ead90[_0x452d('0x37')]&&!_0x2ead90[_0x452d('0x38')]){_0x5a2410[_0x2ead90[_0x452d('0x37')]['toLowerCase']()]=_0x2ead90[_0x452d('0x39')]['toString']();}else if(_['includes']([_0x452d('0x34'),_0x452d('0x35')],_0x2ead90[_0x452d('0x36')])&&_0x2ead90['idField']&&_0x2ead90[_0x452d('0x38')]){_0x5a2410[_0x452d('0x18')]['push']({'id':_0x2ead90[_0x452d('0x3a')],'value':_0x2ead90[_0x452d('0x39')]['toString']()});}else if(_0x2ead90[_0x452d('0x36')]===_0x452d('0x3b')&&_0x2ead90[_0x452d('0x3c')]&&_0x2ead90['idField']&&_0x2ead90['customField']){_0x392225[_0x2ead90['variableName']]&&_0x5a2410['custom_fields'][_0x452d('0x3d')]({'id':_0x2ead90[_0x452d('0x3a')],'value':_0x392225[_0x2ead90[_0x452d('0x3c')]]['toString']()});}else if(_0x2ead90[_0x452d('0x36')]===_0x452d('0x3e')&&_0x2ead90['Variable']&&_0x2ead90[_0x452d('0x3f')][_0x452d('0x40')]&&_0x2ead90[_0x452d('0x3a')]&&_0x2ead90[_0x452d('0x38')]){_0x392225[_0x2ead90[_0x452d('0x3f')][_0x452d('0x40')][_0x452d('0x41')]()]&&_0x5a2410['custom_fields']['push']({'id':_0x2ead90[_0x452d('0x3a')],'value':_0x392225[_0x2ead90['Variable'][_0x452d('0x40')][_0x452d('0x41')]()][_0x452d('0x42')]()});}});}return _0x5a2410;}exports['queue']=function(_0x51dcf8,_0x30c33b,_0x198045,_0x42c85a,_0x3ec9cd,_0x4dd023){var _0x1b8c0e,_0x4919b5;_0x4dd023[_0x452d('0x1b')]=intUtil[_0x452d('0x43')](_0x4dd023[_0x452d('0x1b')]);_0x4dd023[_0x452d('0x44')]=intUtil[_0x452d('0x43')](_0x4dd023[_0x452d('0x44')]);if(_0x3ec9cd&&_0x3ec9cd[_0x452d('0x45')]){logger[_0x452d('0xe')](_0x452d('0x46'),_0x452d('0x47'));_0x30c33b[_0x452d('0x48')]=util[_0x452d('0x10')](_0x452d('0x49'),_0x4dd023['serverUrl'],_0x30c33b[_0x452d('0x4a')],md5(_0x30c33b['uniqueid']));}else{_0x30c33b[_0x452d('0x48')]='';}headers[_0x452d('0x4b')]=getAuth(_0x4dd023);return getUser(_0x4dd023,_0x42c85a[_0x452d('0x24')])[_0x452d('0x1d')](function(_0x37f447){_0x1b8c0e=_0x37f447;logger[_0x452d('0xe')]('The\x20User\x20ID\x20is:',_0x1b8c0e['id']);return getEndUser(_0x4dd023,_0x30c33b[_0x452d('0x12')],_0x30c33b['calleridnum']);})[_0x452d('0x1d')](function(_0x55b3d6){_0x4919b5=_0x55b3d6;logger[_0x452d('0xe')]('The\x20Enduser\x20ID\x20is:',_0x4919b5['id']);return getTicket(_0x4dd023,_0x1b8c0e,_0x4919b5,_0x198045,_0x30c33b);})[_0x452d('0x1d')](function(_0x3e8773){if(_0x3e8773&&_0x3e8773['id']){logger['info'](_0x452d('0x1e'));logger[_0x452d('0xe')](_0x452d('0x4c'),_0x3e8773['id']);logger[_0x452d('0xe')](_0x452d('0x46'),_0x452d('0x4d'));emit(util['format'](_0x452d('0x4e'),_0x42c85a[_0x452d('0x40')]),_0x452d('0x4f'),{'uri':util[_0x452d('0x10')](_0x452d('0x50'),_0x4dd023[_0x452d('0x1b')],_0x3e8773['id'])});}})[_0x452d('0x51')](function(_0xc43384){logger[_0x452d('0x52')](_0x452d('0x46'),JSON[_0x452d('0x30')](_0xc43384));});};exports[_0x452d('0x53')]=function(_0x36bb0e,_0x2bd4d1,_0x145683,_0x433166,_0x1d80ea,_0x2b00c6,_0x19969c){var _0x504b3a,_0x1ba178;_0x2b00c6[_0x452d('0x1b')]=intUtil[_0x452d('0x43')](_0x2b00c6['remoteUri']);_0x2b00c6[_0x452d('0x44')]=intUtil['stripTrailingSlash'](_0x2b00c6[_0x452d('0x44')]);if(_0x19969c&&_0x19969c[_0x452d('0x54')]&&_0x19969c[_0x452d('0x54')]!==_0x452d('0x55')){logger[_0x452d('0xe')](_0x452d('0x56'),_0x452d('0x47'));_0x2bd4d1[_0x452d('0x48')]=util[_0x452d('0x10')](_0x452d('0x49'),_0x2b00c6['serverUrl'],_0x2bd4d1['uniqueid'],md5(_0x2bd4d1[_0x452d('0x4a')]));}headers[_0x452d('0x4b')]=getAuth(_0x2b00c6);return getUser(_0x2b00c6,_0x433166[_0x452d('0x24')])[_0x452d('0x1d')](function(_0x2688c0){_0x504b3a=_0x2688c0;logger['info'](_0x452d('0x57'),_0x504b3a['id']);return getEndUser(_0x2b00c6,_0x2bd4d1[_0x452d('0x58')],_0x2bd4d1[_0x452d('0x59')]);})['then'](function(_0x45050f){_0x1ba178=_0x45050f;logger[_0x452d('0xe')](_0x452d('0x5a'),_0x1ba178['id']);return getTicket(_0x2b00c6,_0x504b3a,_0x1ba178,_0x145683,_0x2bd4d1);})[_0x452d('0x1d')](function(_0x31a717){if(_0x31a717&&_0x31a717['id']){logger['info'](_0x452d('0x1e'));logger['info'](_0x452d('0x4c'),_0x31a717['id']);logger[_0x452d('0xe')](_0x452d('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x452d('0x10')](_0x452d('0x4e'),_0x433166[_0x452d('0x40')]),_0x452d('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2b00c6[_0x452d('0x1b')],_0x31a717['id'])});}})[_0x452d('0x51')](function(_0x36cf3a){logger[_0x452d('0x52')](_0x452d('0x56'),JSON[_0x452d('0x30')](_0x36cf3a));});};exports[_0x452d('0x5b')]=function(_0x2c55a6,_0x671d95,_0x1d21a2,_0x4a5de1,_0x14dd41,_0x8713d9){var _0x38eceb,_0x42325f;_0x8713d9['remoteUri']=intUtil[_0x452d('0x43')](_0x8713d9['remoteUri']);_0x8713d9[_0x452d('0x44')]=intUtil['stripTrailingSlash'](_0x8713d9['serverUrl']);if(_0x14dd41&&_0x14dd41[_0x452d('0x45')]){logger[_0x452d('0xe')]('['+_0x671d95[_0x452d('0x5c')][_0x452d('0x5d')]()+']','Recording\x20is\x20enabled!');_0x671d95['recordingURL']=util[_0x452d('0x10')](_0x452d('0x49'),_0x8713d9['serverUrl'],_0x671d95['uniqueid'],md5(_0x671d95[_0x452d('0x4a')]));}else{_0x671d95[_0x452d('0x48')]='';}headers['Authorization']=getAuth(_0x8713d9);return getUser(_0x8713d9,'')[_0x452d('0x1d')](function(_0x40e9b4){_0x38eceb=_0x40e9b4;logger[_0x452d('0xe')]('The\x20User\x20ID\x20is:',_0x38eceb['id']);return getEndUser(_0x8713d9,_0x671d95[_0x452d('0x12')],_0x671d95[_0x452d('0x13')]);})[_0x452d('0x1d')](function(_0x42c1ef){_0x42325f=_0x42c1ef;logger[_0x452d('0xe')](_0x452d('0x5a'),_0x42325f['id']);return getTicket(_0x8713d9,_0x38eceb,_0x42325f,_0x1d21a2,_0x671d95);})['then'](function(_0x27a83b){if(_0x27a83b){logger[_0x452d('0xe')](_0x452d('0x1e'));logger[_0x452d('0xe')]('The\x20Ticket\x20ID\x20is:',_0x27a83b['id']);}})[_0x452d('0x51')](function(_0x189a62){logger[_0x452d('0x52')]('['+_0x671d95[_0x452d('0x5c')]['toUpperCase']()+']',JSON[_0x452d('0x30')](_0x189a62));});}; \ 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 e7cff26..4668bd1 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 _0xc27f=['toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','toLowerCase','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x319ebd,_0xca2c72){var _0x513fda=function(_0x592c6c){while(--_0x592c6c){_0x319ebd['push'](_0x319ebd['shift']());}};_0x513fda(++_0xca2c72);}(_0xc27f,0x17f));var _0xfc27=function(_0x15db35,_0x43ff0e){_0x15db35=_0x15db35-0x0;var _0x39144f=_0xc27f[_0x15db35];return _0x39144f;};'use strict';var _=require(_0xfc27('0x0'));var rp=require(_0xfc27('0x1'));var md5=require(_0xfc27('0x2'));var util=require(_0xfc27('0x3'));var moment=require(_0xfc27('0x4'));var Promise=require(_0xfc27('0x5'));var Redis=require('ioredis');var intUtil=require(_0xfc27('0x6'));var config=require(_0xfc27('0x7'));var logger=require(_0xfc27('0x8'))(_0xfc27('0x9'));config['redis']=_[_0xfc27('0xa')](config[_0xfc27('0xb')],{'host':_0xfc27('0xc'),'port':0x18eb});var io=require(_0xfc27('0xd'))(new Redis(config[_0xfc27('0xb')]));function getAdminId(_0x2ff4f7,_0x47d371,_0x4aa72d,_0x430357){return new Promise(function(_0x599f64,_0x2c0b20){var _0x29df57=![];var _0x2882ee={'method':_0xfc27('0xe'),'uri':_0x430357+_0xfc27('0xf'),'json':!![]};_0x2882ee[_0xfc27('0x10')]=_0x4aa72d;logger[_0xfc27('0x11')](_0xfc27('0x12'));return rp(_0x2882ee)[_0xfc27('0x13')](function(_0x30c2b0){if(_0x30c2b0){var _0xc4c4be=_0x30c2b0[_0xfc27('0x14')];var _0x535004=null;for(_0x535004=0x0;_0x535004<_0xc4c4be[_0xfc27('0x15')];_0x535004++){if(_0xc4c4be[_0x535004][_0xfc27('0x16')]===_0x2ff4f7[_0xfc27('0x17')]){_0x2ff4f7[_0xfc27('0x18')]=_0xc4c4be[_0x535004]['id'];_0x29df57=!![];}}if(_0x29df57){logger[_0xfc27('0x11')]('Admin\x20found:',_0x2ff4f7[_0xfc27('0x18')]);_0x599f64(_0x2ff4f7);}else{_0x2c0b20({'statusCode':0x194,'message':_0xfc27('0x19')});}}else{_0x2c0b20({'statusCode':0x194,'message':_0xfc27('0x19')});}})[_0xfc27('0x1a')](function(_0x1842d6){logger['error']('['+[_0x47d371[_0xfc27('0x1b')]()]+']',_0x1842d6[_0xfc27('0x1c')]);_0x2c0b20(_0x1842d6);});});}function getUser(_0x3ca113,_0x26f9a1,_0x2c0cbc){return function(_0x233485){return new Promise(function(_0x23542b,_0x34c07b){var _0x2383f0={'method':_0xfc27('0xe'),'uri':_0x2c0cbc+_0xfc27('0xf'),'json':!![]};_0x2383f0[_0xfc27('0x10')]=_0x26f9a1;logger['info'](_0xfc27('0x1d'));return rp(_0x2383f0)[_0xfc27('0x13')](function(_0x50cb2c){if(_0x50cb2c){var _0x22f1a6=_0x50cb2c['users'];var _0x4ee043=![];var _0x1b546d=null;if(_0x233485[_0xfc27('0x1e')]!==null){logger[_0xfc27('0x11')](_0xfc27('0x1f'),_0x233485[_0xfc27('0x1e')]);_0x233485['userEmail']=_0x233485[_0xfc27('0x1e')];for(_0x1b546d=0x0;_0x1b546d<_0x22f1a6['length'];_0x1b546d++){if(_0x22f1a6[_0x1b546d]['email']===_0x233485[_0xfc27('0x1e')]){_0x4ee043=!![];_0x233485['userId']=_0x22f1a6[_0x1b546d]['id'];logger[_0xfc27('0x11')](_0xfc27('0x20'),_0x233485[_0xfc27('0x21')]);}}}if(!_0x4ee043){logger[_0xfc27('0x11')]('Admin\x20selected');_0x233485['userEmail']=_0x233485[_0xfc27('0x17')];_0x233485['userId']=_0x233485['adminId'];_0x4ee043=!![];}if(_0x4ee043){_0x23542b(_0x233485);}else{_0x34c07b({'statusCode':0x194,'message':_0xfc27('0x19')});}}else{_0x34c07b({'statusCode':0x194,'message':_0xfc27('0x19')});}})[_0xfc27('0x1a')](function(_0x36b74d){logger[_0xfc27('0x22')]('['+[_0x3ca113[_0xfc27('0x1b')]()]+']',_0x36b74d[_0xfc27('0x1c')]);_0x34c07b(_0x36b74d);});});};}function searchContact(_0x5395f8,_0x355def,_0x3d9f3b,_0xf82b50){return new Promise(function(_0x550314,_0x2689f2){var _0x4798a5={'method':_0xfc27('0xe'),'headers':_0x355def,'uri':_0x5395f8+_0xfc27('0x23')+_0xf82b50+_0xfc27('0x24')+_0x3d9f3b+_0xfc27('0x25'),'json':!![]};rp(_0x4798a5)[_0xfc27('0x13')](function(_0x44191d){var _0x51c399=_[_0xfc27('0x26')](_0x44191d['contacts'][_0xfc27('0x27')],[_0x3d9f3b,_0xf82b50]);_0x550314(_0x51c399);})[_0xfc27('0x1a')](function(_0x56967d){_0x2689f2(_0x56967d);});});}function getEndUser(_0x30142b,_0x529808,_0x35c866){return function(_0x5b98ba){return new Promise(function(_0x28e3eb,_0x4fc149){logger[_0xfc27('0x11')](util[_0xfc27('0x28')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5b98ba[_0xfc27('0x29')]));searchContact(_0x35c866,_0x529808,_0xfc27('0x2a'),_0x5b98ba[_0xfc27('0x29')])[_0xfc27('0x13')](function(_0x4e4d56){if(_0x4e4d56){_0x5b98ba[_0xfc27('0x2b')]=_0x4e4d56['id'];logger[_0xfc27('0x11')](_0xfc27('0x2c'),_0x5b98ba[_0xfc27('0x2b')]);return _0x28e3eb(_0x5b98ba);}searchContact(_0x35c866,_0x529808,'work_number',_0x5b98ba[_0xfc27('0x29')])[_0xfc27('0x13')](function(_0x327ca3){if(_0x327ca3){_0x5b98ba[_0xfc27('0x2b')]=_0x327ca3['id'];logger['info'](_0xfc27('0x2d'),_0x5b98ba[_0xfc27('0x2b')]);return _0x28e3eb(_0x5b98ba);}createEndUser(_0x5b98ba,_0x30142b,_0x529808,_0x35c866)[_0xfc27('0x13')](function(_0x15fa2e){logger['info'](_0xfc27('0x2e'),_0x15fa2e[_0xfc27('0x2b')]);return _0x28e3eb(_0x15fa2e);});});})['catch'](function(_0x77570d){_0x4fc149(_0x77570d);});});};}function createEndUser(_0x49072c,_0x1e38fe,_0x9881ac,_0x530432){return new Promise(function(_0xfca90c,_0x78ff1c){var _0x515b2a=moment();var _0x4e51a0={'method':_0xfc27('0x2f'),'uri':_0x530432+_0xfc27('0x30'),'body':{'contact':{'last_name':_0x49072c[_0xfc27('0x29')],'work_number':_0x49072c[_0xfc27('0x29')],'mobile_number':_0x49072c[_0xfc27('0x29')],'owner_id':_0x49072c[_0xfc27('0x21')],'created_at':_0x515b2a[_0xfc27('0x28')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4e51a0[_0xfc27('0x10')]=_0x9881ac;logger[_0xfc27('0x11')](_0xfc27('0x31'));return rp(_0x4e51a0)[_0xfc27('0x13')](function(_0x229ccc){_0x49072c[_0xfc27('0x2b')]=_0x229ccc['contact']['id'];_0xfca90c(_0x49072c);})[_0xfc27('0x1a')](function(_0x258836){logger[_0xfc27('0x22')]('['+[_0x1e38fe[_0xfc27('0x1b')]()]+']',_0x258836['message']);_0x78ff1c(_0x258836[_0xfc27('0x1c')]);});});}function getTicket(_0x1f8f2f,_0x2ece39,_0x3874e8,_0x1b1560,_0x1c2186){return function(_0x419501){logger[_0xfc27('0x11')]('Creating\x20new\x20task');return new Promise(function(_0x414cd4,_0x355640){var _0x7e7a6a=moment();var _0x246f6f={'method':_0xfc27('0x2f'),'uri':_0x3874e8+_0xfc27('0x32'),'body':{'title':intUtil[_0xfc27('0x33')](_0x1b1560['Subjects'],_0x1c2186,'\x20'),'description':intUtil[_0xfc27('0x33')](_0x1b1560['Descriptions'],_0x1c2186,'\x0a'),'owner_id':_0x419501['userId'],'creater_id':_0x419501[_0xfc27('0x18')],'targetable_id':_0x419501[_0xfc27('0x2b')],'targetable_type':_0xfc27('0x34'),'created_at':_0x7e7a6a['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x7e7a6a[_0xfc27('0x35')](0x1e,'m')[_0xfc27('0x28')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x246f6f['headers']=_0x2ece39;return rp(_0x246f6f)[_0xfc27('0x13')](function(_0xf24bac){_0x419501['ticketId']=_0xf24bac[_0xfc27('0x36')]['id'];logger['info'](_0xfc27('0x37'),_0x419501[_0xfc27('0x38')]);_0x414cd4(_0x419501);})[_0xfc27('0x1a')](function(_0xf821e){logger['error']('['+[_0x1f8f2f[_0xfc27('0x1b')]()]+']',_0xf821e[_0xfc27('0x1c')]);_0x355640(_0xf821e['message']);});});};}function emit(_0x492afe,_0x48effb,_0x161185){var _0xa72497={'uri':_0x492afe+_0xfc27('0x39')+_0x161185};io['to'](util[_0xfc27('0x28')](_0xfc27('0x3a'),_0x48effb))[_0xfc27('0x3b')]('trigger:browser:url',_0xa72497);}exports['cs']=function(_0x43cc20,_0x55dc7b,_0x9fa2a8,_0x558e4c,_0x43db95,_0x49489d,_0x2bc320,_0x3d182e){var _0x5e6aa6={};var _0x3e998b={'Authorization':_0xfc27('0x3c')+_0x49489d[_0xfc27('0x3d')]};_0x49489d[_0xfc27('0x3e')]=intUtil[_0xfc27('0x3f')](_0x49489d[_0xfc27('0x3e')]);_0x49489d['serverUrl']=intUtil[_0xfc27('0x3f')](_0x49489d['serverUrl']);var _0x4fdd3a=_0x49489d[_0xfc27('0x3e')];_0x5e6aa6[_0xfc27('0x17')]=_0x49489d['username'];_0x5e6aa6[_0xfc27('0x29')]=_0x3d182e[_0xfc27('0x40')]()===_0xfc27('0x41')?_0x55dc7b['destcalleridnum']:_0x55dc7b['calleridnum'];_0x5e6aa6[_0xfc27('0x42')]=_0x3d182e===_0xfc27('0x43')||_0x3d182e===_0xfc27('0x44')?_0xfc27('0x43'):_0xfc27('0x41');if(_0x558e4c){_0x5e6aa6[_0xfc27('0x1e')]=_0x558e4c[_0xfc27('0x16')];}var _0x35a6ff=util[_0xfc27('0x28')](_0xfc27('0x45'),_0x49489d[_0xfc27('0x46')],_0x55dc7b[_0xfc27('0x47')],md5(_0x55dc7b[_0xfc27('0x47')]));if(_0x43db95&&_0x43db95[_0xfc27('0x48')]){logger[_0xfc27('0x11')](_0xfc27('0x49'),'Recording\x20is\x20enabled!');_0x55dc7b[_0xfc27('0x4a')]=_0x35a6ff;}else if(_0x2bc320&&_0x2bc320['recordingFormat']&&_0x2bc320[_0xfc27('0x4b')]!==_0xfc27('0x4c')){logger[_0xfc27('0x11')]('[OUTBOUND]',_0xfc27('0x4d'));_0x55dc7b[_0xfc27('0x4a')]=_0x35a6ff;}else{_0x55dc7b[_0xfc27('0x4a')]='';}return getAdminId(_0x5e6aa6,_0x3d182e,_0x3e998b,_0x4fdd3a)['then'](getUser(_0x3d182e,_0x3e998b,_0x4fdd3a))[_0xfc27('0x13')](getEndUser(_0x3d182e,_0x3e998b,_0x4fdd3a))[_0xfc27('0x13')](getTicket(_0x3d182e,_0x3e998b,_0x4fdd3a,_0x9fa2a8,_0x55dc7b))[_0xfc27('0x13')](function(_0x2cd5d0){logger[_0xfc27('0x11')](util[_0xfc27('0x28')](_0xfc27('0x4e'),_0x2cd5d0[_0xfc27('0x38')]));if(_0x3d182e!=='unmanaged'){logger[_0xfc27('0x11')]('['+[_0x3d182e[_0xfc27('0x1b')]()]+']',_0xfc27('0x4f'));emit(_0x4fdd3a,_0x558e4c[_0xfc27('0x50')],_0x2cd5d0[_0xfc27('0x2b')]);}})[_0xfc27('0x1a')](function(_0x2931b8){logger[_0xfc27('0x22')]('['+[_0x3d182e[_0xfc27('0x1b')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xfc27('0x51')](_0x2931b8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc476=['work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','bluebird','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xc476,0x7c));var _0x6c47=function(_0x373b46,_0x3eebe1){_0x373b46=_0x373b46-0x0;var _0xe580cb=_0xc476[_0x373b46];return _0xe580cb;};'use strict';var _=require('lodash');var rp=require(_0x6c47('0x0'));var md5=require(_0x6c47('0x1'));var util=require(_0x6c47('0x2'));var moment=require('moment');var Promise=require(_0x6c47('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x6c47('0x4'));var logger=require(_0x6c47('0x5'))(_0x6c47('0x6'));config[_0x6c47('0x7')]=_[_0x6c47('0x8')](config[_0x6c47('0x7')],{'host':_0x6c47('0x9'),'port':0x18eb});var io=require(_0x6c47('0xa'))(new Redis(config[_0x6c47('0x7')]));function getAdminId(_0x25eb6f,_0x49dccd,_0xa60dc0,_0xa81351){return new Promise(function(_0xd94976,_0x150ebf){var _0x333840=![];var _0x116d0d={'method':_0x6c47('0xb'),'uri':_0xa81351+_0x6c47('0xc'),'json':!![]};_0x116d0d[_0x6c47('0xd')]=_0xa60dc0;logger[_0x6c47('0xe')](_0x6c47('0xf'));return rp(_0x116d0d)['then'](function(_0x3bfd93){if(_0x3bfd93){var _0x3b6272=_0x3bfd93['users'];var _0x42266c=null;for(_0x42266c=0x0;_0x42266c<_0x3b6272[_0x6c47('0x10')];_0x42266c++){if(_0x3b6272[_0x42266c][_0x6c47('0x11')]===_0x25eb6f[_0x6c47('0x12')]){_0x25eb6f[_0x6c47('0x13')]=_0x3b6272[_0x42266c]['id'];_0x333840=!![];}}if(_0x333840){logger[_0x6c47('0xe')](_0x6c47('0x14'),_0x25eb6f[_0x6c47('0x13')]);_0xd94976(_0x25eb6f);}else{_0x150ebf({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x150ebf({'statusCode':0x194,'message':_0x6c47('0x15')});}})[_0x6c47('0x16')](function(_0x612280){logger[_0x6c47('0x17')]('['+[_0x49dccd[_0x6c47('0x18')]()]+']',_0x612280[_0x6c47('0x19')]);_0x150ebf(_0x612280);});});}function getUser(_0x589544,_0x181518,_0x45b9a3){return function(_0x191b6c){return new Promise(function(_0x15fe75,_0x4c6ab3){var _0xf8ad6b={'method':_0x6c47('0xb'),'uri':_0x45b9a3+_0x6c47('0xc'),'json':!![]};_0xf8ad6b[_0x6c47('0xd')]=_0x181518;logger['info'](_0x6c47('0x1a'));return rp(_0xf8ad6b)[_0x6c47('0x1b')](function(_0x386df0){if(_0x386df0){var _0x38d004=_0x386df0['users'];var _0x17eff5=![];var _0x2d90d7=null;if(_0x191b6c[_0x6c47('0x1c')]!==null){logger[_0x6c47('0xe')](_0x6c47('0x1d'),_0x191b6c['agentEmail']);_0x191b6c['userEmail']=_0x191b6c[_0x6c47('0x1c')];for(_0x2d90d7=0x0;_0x2d90d7<_0x38d004['length'];_0x2d90d7++){if(_0x38d004[_0x2d90d7][_0x6c47('0x11')]===_0x191b6c[_0x6c47('0x1c')]){_0x17eff5=!![];_0x191b6c[_0x6c47('0x1e')]=_0x38d004[_0x2d90d7]['id'];logger[_0x6c47('0xe')](_0x6c47('0x1f'),_0x191b6c[_0x6c47('0x1e')]);}}}if(!_0x17eff5){logger[_0x6c47('0xe')](_0x6c47('0x20'));_0x191b6c[_0x6c47('0x21')]=_0x191b6c['adminEmail'];_0x191b6c[_0x6c47('0x1e')]=_0x191b6c['adminId'];_0x17eff5=!![];}if(_0x17eff5){_0x15fe75(_0x191b6c);}else{_0x4c6ab3({'statusCode':0x194,'message':_0x6c47('0x15')});}}else{_0x4c6ab3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6c47('0x16')](function(_0x2eae4b){logger[_0x6c47('0x17')]('['+[_0x589544[_0x6c47('0x18')]()]+']',_0x2eae4b[_0x6c47('0x19')]);_0x4c6ab3(_0x2eae4b);});});};}function searchContact(_0x4e980,_0x41e804,_0x4a6f59,_0x5c9dd4){return new Promise(function(_0x5f2c7d,_0x58bcd9){var _0x78268d={'method':'GET','headers':_0x41e804,'uri':_0x4e980+_0x6c47('0x22')+_0x5c9dd4+_0x6c47('0x23')+_0x4a6f59+_0x6c47('0x24'),'json':!![]};rp(_0x78268d)[_0x6c47('0x1b')](function(_0x1e76c5){var _0x4c43b9=_[_0x6c47('0x25')](_0x1e76c5[_0x6c47('0x26')][_0x6c47('0x26')],[_0x4a6f59,_0x5c9dd4]);_0x5f2c7d(_0x4c43b9);})[_0x6c47('0x16')](function(_0x5bc41d){_0x58bcd9(_0x5bc41d);});});}function getEndUser(_0x57e088,_0x1f2036,_0x240f54){return function(_0x9a2fbe){return new Promise(function(_0xc65baf,_0x19a5d6){logger[_0x6c47('0xe')](util[_0x6c47('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x9a2fbe[_0x6c47('0x28')]));searchContact(_0x240f54,_0x1f2036,_0x6c47('0x29'),_0x9a2fbe[_0x6c47('0x28')])[_0x6c47('0x1b')](function(_0x578eca){if(_0x578eca){_0x9a2fbe['endUserId']=_0x578eca['id'];logger['info'](_0x6c47('0x2a'),_0x9a2fbe[_0x6c47('0x2b')]);return _0xc65baf(_0x9a2fbe);}searchContact(_0x240f54,_0x1f2036,_0x6c47('0x2c'),_0x9a2fbe['contactNumber'])[_0x6c47('0x1b')](function(_0x3a6f37){if(_0x3a6f37){_0x9a2fbe['endUserId']=_0x3a6f37['id'];logger[_0x6c47('0xe')](_0x6c47('0x2d'),_0x9a2fbe[_0x6c47('0x2b')]);return _0xc65baf(_0x9a2fbe);}createEndUser(_0x9a2fbe,_0x57e088,_0x1f2036,_0x240f54)['then'](function(_0x273f58){logger[_0x6c47('0xe')](_0x6c47('0x2e'),_0x273f58['endUserId']);return _0xc65baf(_0x273f58);});});})[_0x6c47('0x16')](function(_0x5c03d8){_0x19a5d6(_0x5c03d8);});});};}function createEndUser(_0x48ab83,_0x490dac,_0x692dc6,_0x2d0871){return new Promise(function(_0x5d94d1,_0x3f349a){var _0x3b7db7=moment();var _0x422a1f={'method':_0x6c47('0x2f'),'uri':_0x2d0871+_0x6c47('0x30'),'body':{'contact':{'last_name':_0x48ab83[_0x6c47('0x28')],'work_number':_0x48ab83[_0x6c47('0x28')],'mobile_number':_0x48ab83['contactNumber'],'owner_id':_0x48ab83[_0x6c47('0x1e')],'created_at':_0x3b7db7[_0x6c47('0x27')](_0x6c47('0x31'))}},'json':!![]};_0x422a1f[_0x6c47('0xd')]=_0x692dc6;logger[_0x6c47('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x422a1f)[_0x6c47('0x1b')](function(_0x1eb70b){_0x48ab83[_0x6c47('0x2b')]=_0x1eb70b[_0x6c47('0x32')]['id'];_0x5d94d1(_0x48ab83);})['catch'](function(_0x27f6a7){logger[_0x6c47('0x17')]('['+[_0x490dac[_0x6c47('0x18')]()]+']',_0x27f6a7[_0x6c47('0x19')]);_0x3f349a(_0x27f6a7[_0x6c47('0x19')]);});});}function getTicket(_0x4d6cae,_0x300b27,_0x4a8aff,_0x3405e2,_0x398a9d){return function(_0x469908){logger[_0x6c47('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x3e2d10,_0x38ec70){var _0x5802ce=moment();var _0x208f7d={'method':_0x6c47('0x2f'),'uri':_0x4a8aff+_0x6c47('0x33'),'body':{'title':intUtil[_0x6c47('0x34')](_0x3405e2[_0x6c47('0x35')],_0x398a9d,'\x20'),'description':intUtil[_0x6c47('0x34')](_0x3405e2[_0x6c47('0x36')],_0x398a9d,'\x0a'),'owner_id':_0x469908[_0x6c47('0x1e')],'creater_id':_0x469908[_0x6c47('0x13')],'targetable_id':_0x469908[_0x6c47('0x2b')],'targetable_type':'Contact','created_at':_0x5802ce['format'](_0x6c47('0x31')),'due_date':_0x5802ce[_0x6c47('0x37')](0x1e,'m')['format'](_0x6c47('0x31'))},'json':!![]};_0x208f7d[_0x6c47('0xd')]=_0x300b27;return rp(_0x208f7d)[_0x6c47('0x1b')](function(_0x2f4b23){_0x469908[_0x6c47('0x38')]=_0x2f4b23[_0x6c47('0x39')]['id'];logger[_0x6c47('0xe')](_0x6c47('0x3a'),_0x469908['ticketId']);_0x3e2d10(_0x469908);})[_0x6c47('0x16')](function(_0x3a376d){logger['error']('['+[_0x4d6cae['toUpperCase']()]+']',_0x3a376d[_0x6c47('0x19')]);_0x38ec70(_0x3a376d[_0x6c47('0x19')]);});});};}function emit(_0x19aab7,_0x4f249e,_0xb2d26f){var _0x1f1cf6={'uri':_0x19aab7+'/contacts/'+_0xb2d26f};io['to'](util[_0x6c47('0x27')](_0x6c47('0x3b'),_0x4f249e))[_0x6c47('0x3c')](_0x6c47('0x3d'),_0x1f1cf6);}exports['cs']=function(_0x136e75,_0x434da5,_0x44b186,_0x566672,_0x172b41,_0x3cc0ea,_0x252295,_0x38763a){var _0x2769f2={};var _0x5f07e9={'Authorization':_0x6c47('0x3e')+_0x3cc0ea[_0x6c47('0x3f')]};_0x3cc0ea['remoteUri']=intUtil[_0x6c47('0x40')](_0x3cc0ea['remoteUri']);_0x3cc0ea['serverUrl']=intUtil[_0x6c47('0x40')](_0x3cc0ea['serverUrl']);var _0x59430c=_0x3cc0ea['remoteUri'];_0x2769f2[_0x6c47('0x12')]=_0x3cc0ea[_0x6c47('0x41')];_0x2769f2[_0x6c47('0x28')]=_0x38763a[_0x6c47('0x42')]()===_0x6c47('0x43')?_0x434da5[_0x6c47('0x44')]:_0x434da5[_0x6c47('0x45')];_0x2769f2['callDirection']=_0x38763a===_0x6c47('0x46')||_0x38763a===_0x6c47('0x47')?_0x6c47('0x46'):_0x6c47('0x43');if(_0x566672){_0x2769f2[_0x6c47('0x1c')]=_0x566672[_0x6c47('0x11')];}var _0x2ac38c=util[_0x6c47('0x27')](_0x6c47('0x48'),_0x3cc0ea[_0x6c47('0x49')],_0x434da5['uniqueid'],md5(_0x434da5[_0x6c47('0x4a')]));if(_0x172b41&&_0x172b41[_0x6c47('0x4b')]){logger[_0x6c47('0xe')]('[QUEUE]',_0x6c47('0x4c'));_0x434da5[_0x6c47('0x4d')]=_0x2ac38c;}else if(_0x252295&&_0x252295[_0x6c47('0x4e')]&&_0x252295[_0x6c47('0x4e')]!==_0x6c47('0x4f')){logger[_0x6c47('0xe')](_0x6c47('0x50'),_0x6c47('0x4c'));_0x434da5[_0x6c47('0x4d')]=_0x2ac38c;}else{_0x434da5[_0x6c47('0x4d')]='';}return getAdminId(_0x2769f2,_0x38763a,_0x5f07e9,_0x59430c)['then'](getUser(_0x38763a,_0x5f07e9,_0x59430c))['then'](getEndUser(_0x38763a,_0x5f07e9,_0x59430c))[_0x6c47('0x1b')](getTicket(_0x38763a,_0x5f07e9,_0x59430c,_0x44b186,_0x434da5))[_0x6c47('0x1b')](function(_0x4c7164){logger[_0x6c47('0xe')](util[_0x6c47('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4c7164[_0x6c47('0x38')]));if(_0x38763a!==_0x6c47('0x47')){logger[_0x6c47('0xe')]('['+[_0x38763a[_0x6c47('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x59430c,_0x566672[_0x6c47('0x51')],_0x4c7164[_0x6c47('0x2b')]);}})[_0x6c47('0x16')](function(_0x24a7b2){logger[_0x6c47('0x17')]('['+[_0x38763a['toUpperCase']()]+_0x6c47('0x52'),util[_0x6c47('0x53')](_0x24a7b2,{'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 657a8de..8678c96 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 _0xbda9=['zoho','vtiger','dynamics365','servicenow','exec','data1','toLowerCase','Configurations','data3','log','unmanaged','desk','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk'];(function(_0x349761,_0x23baaf){var _0x5368c1=function(_0x57cae0){while(--_0x57cae0){_0x349761['push'](_0x349761['shift']());}};_0x5368c1(++_0x23baaf);}(_0xbda9,0x146));var _0x9bda=function(_0x2dbf91,_0x532f4e){_0x2dbf91=_0x2dbf91-0x0;var _0x1807b8=_0xbda9[_0x2dbf91];return _0x1807b8;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var zendesk=require(_0x9bda('0x2'));var salesforce=require(_0x9bda('0x3'));var sugarcrm=require(_0x9bda('0x4'));var freshdesk=require(_0x9bda('0x5'));var zoho=require('./zoho');var desk=require(_0x9bda('0x6'));var vtiger=require(_0x9bda('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x9bda('0x8'));var freshsales=require(_0x9bda('0x9'));var integrations=[_0x9bda('0xa'),_0x9bda('0xb'),_0x9bda('0xc'),_0x9bda('0xd'),_0x9bda('0xe'),'desk',_0x9bda('0xf'),_0x9bda('0x10'),'freshsales',_0x9bda('0x11')];exports[_0x9bda('0x12')]=function(_0x17b03f,_0xe1e7b5,_0x390ccf,_0xfc6de,_0x4763a3,_0x2790dc){if(_0x390ccf){if(_['includes'](integrations,_0x17b03f[_0x9bda('0x13')][_0x9bda('0x14')]())){try{var _0x289fea=null;var _0x209e96='';var _0x548ea7=_0x390ccf[_0x17b03f[_0x9bda('0x13')][_0x9bda('0x14')]()];if(_0x548ea7){var _0x1dfcd0=_0x548ea7[_0x17b03f['data2']];if(_0x1dfcd0){var _0x5716fa=_['find'](_0x1dfcd0[_0x9bda('0x15')],{'id':parseInt(_0x17b03f[_0x9bda('0x16')],0xa)});if(_0x5716fa){if(_0xfc6de){if(_0x4763a3&&_0xe1e7b5['queue']){_0x209e96='queue';}else if(_0xe1e7b5['routeId']){_0x209e96='outbound';}else{console[_0x9bda('0x17')]('EVENT\x20UNKNOWN',_0xe1e7b5);}}else{_0x209e96=_0x9bda('0x18');}switch(_0x17b03f['data1']['toLowerCase']()){case _0x9bda('0xa'):zendesk[_0x209e96](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc);break;case _0x9bda('0xb'):salesforce[_0x209e96](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc);break;case _0x9bda('0xc'):sugarcrm[_0x209e96](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc);break;case'freshdesk':freshdesk[_0x209e96](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc);break;case'zoho':zoho[_0x209e96](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc);break;case _0x9bda('0x19'):desk[_0x209e96](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc);break;case _0x9bda('0xf'):vtiger[_0x209e96](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc);break;case _0x9bda('0x1a'):freshsales['cs'](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc,_0x209e96);break;case _0x9bda('0x11'):servicenow['cs'](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc,_0x209e96);break;case _0x9bda('0x10'):dynamics365['cs'](_0x17b03f,_0xe1e7b5,_0x5716fa,_0xfc6de,_0x4763a3,_0x1dfcd0,_0x2790dc,_0x209e96);break;default:console[_0x9bda('0x17')](_0x9bda('0x1b'));}}else{_0x289fea=require(_0x9bda('0x1c'))(_0x17b03f[_0x9bda('0x13')][_0x9bda('0x14')]());_0x289fea[_0x9bda('0x1d')](_0x9bda('0x1e'),util[_0x9bda('0x1f')](_0x9bda('0x20'),_0x17b03f[_0x9bda('0x13')][_0x9bda('0x14')](),_0x17b03f['data3']));}}else{_0x289fea=require('../../../../config/logger')(_0x17b03f['data1'][_0x9bda('0x14')]());_0x289fea[_0x9bda('0x1d')](_0x9bda('0x1e'),util[_0x9bda('0x1f')]('%s\x20account\x20#%s\x20not\x20found',_0x17b03f['data1'][_0x9bda('0x14')](),_0x17b03f[_0x9bda('0x21')]));}}else{}}catch(_0x4319ea){console[_0x9bda('0x1d')](_0x4319ea);}}}}; \ No newline at end of file +var _0xa5aa=['./freshsales','zendesk','sugarcrm','freshdesk','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','data1','salesforce','zoho','desk','vtiger','unknown\x20integration','error','format','../../../../config/logger','[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x1d369f,_0x5bd62d){var _0x5a87d3=function(_0x387e27){while(--_0x387e27){_0x1d369f['push'](_0x1d369f['shift']());}};_0x5a87d3(++_0x5bd62d);}(_0xa5aa,0x1f2));var _0xaa5a=function(_0x96231c,_0x5a66b1){_0x96231c=_0x96231c-0x0;var _0x5128b6=_0xa5aa[_0x96231c];return _0x5128b6;};'use strict';var _=require('lodash');var util=require(_0xaa5a('0x0'));var zendesk=require(_0xaa5a('0x1'));var salesforce=require(_0xaa5a('0x2'));var sugarcrm=require(_0xaa5a('0x3'));var freshdesk=require(_0xaa5a('0x4'));var zoho=require(_0xaa5a('0x5'));var desk=require(_0xaa5a('0x6'));var vtiger=require(_0xaa5a('0x7'));var servicenow=require(_0xaa5a('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xaa5a('0x9'));var integrations=[_0xaa5a('0xa'),'salesforce',_0xaa5a('0xb'),_0xaa5a('0xc'),'zoho','desk','vtiger',_0xaa5a('0xd'),_0xaa5a('0xe'),_0xaa5a('0xf')];exports[_0xaa5a('0x10')]=function(_0x35664d,_0x15a06f,_0x4743b4,_0x3b62d8,_0x10932e,_0x4ccb81){if(_0x4743b4){if(_[_0xaa5a('0x11')](integrations,_0x35664d['data1'][_0xaa5a('0x12')]())){try{var _0x1fe065=null;var _0x57bca6='';var _0x5aa68b=_0x4743b4[_0x35664d['data1'][_0xaa5a('0x12')]()];if(_0x5aa68b){var _0x4a9025=_0x5aa68b[_0x35664d['data2']];if(_0x4a9025){var _0x135fcc=_[_0xaa5a('0x13')](_0x4a9025[_0xaa5a('0x14')],{'id':parseInt(_0x35664d[_0xaa5a('0x15')],0xa)});if(_0x135fcc){if(_0x3b62d8){if(_0x10932e&&_0x15a06f[_0xaa5a('0x16')]){_0x57bca6=_0xaa5a('0x16');}else if(_0x15a06f[_0xaa5a('0x17')]){_0x57bca6='outbound';}else{console[_0xaa5a('0x18')](_0xaa5a('0x19'),_0x15a06f);}}else{_0x57bca6=_0xaa5a('0x1a');}switch(_0x35664d[_0xaa5a('0x1b')][_0xaa5a('0x12')]()){case _0xaa5a('0xa'):zendesk[_0x57bca6](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81);break;case _0xaa5a('0x1c'):salesforce[_0x57bca6](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81);break;case'sugarcrm':sugarcrm[_0x57bca6](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81);break;case _0xaa5a('0xc'):freshdesk[_0x57bca6](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81);break;case _0xaa5a('0x1d'):zoho[_0x57bca6](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81);break;case _0xaa5a('0x1e'):desk[_0x57bca6](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81);break;case _0xaa5a('0x1f'):vtiger[_0x57bca6](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81);break;case _0xaa5a('0xe'):freshsales['cs'](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81,_0x57bca6);break;case _0xaa5a('0xf'):servicenow['cs'](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81,_0x57bca6);break;case'dynamics365':dynamics365['cs'](_0x35664d,_0x15a06f,_0x135fcc,_0x3b62d8,_0x10932e,_0x4a9025,_0x4ccb81,_0x57bca6);break;default:console['log'](_0xaa5a('0x20'));}}else{_0x1fe065=require('../../../../config/logger')(_0x35664d['data1'][_0xaa5a('0x12')]());_0x1fe065[_0xaa5a('0x21')]('[EXEC]',util[_0xaa5a('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x35664d[_0xaa5a('0x1b')]['toLowerCase'](),_0x35664d['data3']));}}else{_0x1fe065=require(_0xaa5a('0x23'))(_0x35664d[_0xaa5a('0x1b')]['toLowerCase']());_0x1fe065[_0xaa5a('0x21')](_0xaa5a('0x24'),util[_0xaa5a('0x22')](_0xaa5a('0x25'),_0x35664d[_0xaa5a('0x1b')][_0xaa5a('0x12')](),_0x35664d[_0xaa5a('0x26')]));}}else{}}catch(_0x57d0b0){console[_0xaa5a('0x21')](_0x57d0b0);}}}}; \ 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 144d217..749e651 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 _0x7bd2=['customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','Subjects','getString','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x7bd2,0x1b3));var _0x27bd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7bd2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var rp=require(_0x27bd('0x0'));var moment=require(_0x27bd('0x1'));var BPromise=require(_0x27bd('0x2'));var md5=require(_0x27bd('0x3'));var jsforce=require(_0x27bd('0x4'));var util=require(_0x27bd('0x5'));var Redis=require('ioredis');var intUtil=require(_0x27bd('0x6'));var config=require(_0x27bd('0x7'));var logger=require(_0x27bd('0x8'))(_0x27bd('0x9'));config[_0x27bd('0xa')]=_[_0x27bd('0xb')](config[_0x27bd('0xa')],{'host':_0x27bd('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x27bd('0xa')]));function emit(_0x58c15a,_0x11575c,_0x5c6841){io['to'](_0x58c15a)[_0x27bd('0xd')](_0x11575c,_0x5c6841);}function getTicket(_0xf5fc8f,_0x2af257,_0x1474c6,_0x43ba32,_0x125c8f,_0x44f0be,_0x459d9c,_0x25a70d){var _0x4cf940=Object['assign']({},{'OwnerId':_0x2af257['id'],'Subject':intUtil['getString'](_0x43ba32[_0x27bd('0xe')],_0x125c8f,'\x20'),'Description':intUtil[_0x27bd('0xf')](_0x43ba32[_0x27bd('0x10')],_0x125c8f,'\x0a')},getCustomFields(_0x44f0be,_0x125c8f));if(_0x1474c6){if(_0x43ba32[_0x27bd('0x11')]==='Task'){_0x4cf940['ActivityDate']=moment[_0x27bd('0x12')]();_0x4cf940[_0x27bd('0x13')]=![];_0x4cf940[_0x27bd('0x14')]=![];if(_0x1474c6[_0x27bd('0x15')]===_0x27bd('0x16')||_0x1474c6[_0x27bd('0x15')]===_0x27bd('0x17')){_0x4cf940[_0x27bd('0x18')]=_0x1474c6['id'];}else if(_0x1474c6[_0x27bd('0x15')]===_0x27bd('0x19')){_0x4cf940[_0x27bd('0x1a')]=_0x1474c6['id'];}}else if(_0x43ba32[_0x27bd('0x11')]===_0x27bd('0x1b')){if(_0x1474c6[_0x27bd('0x15')]==='contact'){_0x4cf940[_0x27bd('0x1c')]=_0x1474c6['id'];}else if(_0x1474c6['endUserType']===_0x27bd('0x19')){_0x4cf940[_0x27bd('0x1d')]=_0x1474c6['id'];}else if(_0x1474c6[_0x27bd('0x15')]===_0x27bd('0x17')&&_0x43ba32['leadId']){_0x4cf940[_0x43ba32[_0x27bd('0x1e')]]=_0x1474c6['id'];}else{logger[_0x27bd('0x1f')](_0x27bd('0x20'));}}}return _0x459d9c[_0x27bd('0x21')](_0x43ba32['ticketType'])[_0x27bd('0x22')](_0x4cf940);}function getUser(_0x4619bc,_0x3e7c24,_0x58d0f7){if(!_[_0x27bd('0x23')](_0x3e7c24)&&intUtil[_0x27bd('0x24')](_0x3e7c24)){var _0x25da27={'Email':_0x3e7c24};var _0x392395={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x58d0f7[_0x27bd('0x21')](_0x27bd('0x25'))[_0x27bd('0x26')](_0x25da27,_0x392395)[_0x27bd('0x27')]()['then'](function(_0x159fcb){if(_0x159fcb[_0x27bd('0x28')]){var _0x49a8c8=_[_0x27bd('0x26')](_0x159fcb,function(_0x39c9fa){return _0x39c9fa['Email']===_0x3e7c24;});if(_0x49a8c8){logger[_0x27bd('0x1f')](_0x27bd('0x29'),_0x3e7c24);return BPromise[_0x27bd('0x2a')]({'id':_0x49a8c8['Id'],'name':_0x49a8c8[_0x27bd('0x2b')]});}}else{logger[_0x27bd('0x1f')](_0x27bd('0x2c'),_0x3e7c24);return _0x58d0f7[_0x27bd('0x2d')]()[_0x27bd('0x2e')](function(_0x4cf1d9){return BPromise[_0x27bd('0x2a')]({'id':_0x4cf1d9[_0x27bd('0x2f')],'name':_0x4cf1d9[_0x27bd('0x30')]});});}});}else{logger['info'](_0x27bd('0x2c'),_0x3e7c24);return _0x58d0f7['identity']()[_0x27bd('0x2e')](function(_0xe8eef4){return BPromise[_0x27bd('0x2a')]({'id':_0xe8eef4[_0x27bd('0x2f')],'name':_0xe8eef4[_0x27bd('0x30')]});});}}function getEndUser(_0x26943a,_0x15c37a,_0x13379f,_0x3cc156,_0x4d601e){var _0x2afe3f={'$or':{'Phone':_0x3cc156}};var _0x38cdae={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x27bd('0x2a')]()[_0x27bd('0x2e')](function(){logger[_0x27bd('0x1f')](_0x27bd('0x31'),_0x3cc156,_0x15c37a[_0x27bd('0x32')]);switch(_0x15c37a['moduleSearch']){case _0x27bd('0x33'):var _0x3ec961=_[_0x27bd('0x34')](_0x2afe3f);if(_0x15c37a[_0x27bd('0x35')]){var _0x1ffda1={};_0x1ffda1[_0x15c37a['additionalSearchContact']]=_0x3cc156;_['merge'](_0x3ec961[_0x27bd('0x36')],_0x1ffda1);}return _0x4d601e['sobject'](_0x27bd('0x37'))[_0x27bd('0x26')](_0x3ec961,_0x38cdae)[_0x27bd('0x27')]()[_0x27bd('0x2e')](function(_0x312baa){if(_0x312baa&&_0x312baa[_0x27bd('0x28')]){return _0x312baa;}else{var _0x419917=_[_0x27bd('0x34')](_0x2afe3f);if(_0x15c37a[_0x27bd('0x38')]){var _0xf0ed99={};_0xf0ed99[_0x15c37a[_0x27bd('0x38')]]=_0x3cc156;_[_0x27bd('0x39')](_0x419917[_0x27bd('0x36')],_0xf0ed99);}return _0x4d601e[_0x27bd('0x21')](_0x27bd('0x3a'))[_0x27bd('0x26')](_0x419917,_0x38cdae);}});case _0x27bd('0x3b'):var _0xd9c8b6=_[_0x27bd('0x34')](_0x2afe3f);if(_0x15c37a['additionalSearchAccount']){var _0x1ffda1={};_0x1ffda1[_0x15c37a[_0x27bd('0x3c')]]=_0x3cc156;_[_0x27bd('0x39')](_0xd9c8b6[_0x27bd('0x36')],_0x1ffda1);}return _0x4d601e['sobject'](_0x27bd('0x3d'))[_0x27bd('0x26')](_0xd9c8b6,_0x38cdae)[_0x27bd('0x27')]()[_0x27bd('0x2e')](function(_0x205ee3){if(_0x205ee3&&_0x205ee3[_0x27bd('0x28')]){return _0x205ee3;}else{var _0x3c91e5=_[_0x27bd('0x34')](_0x2afe3f);if(_0x15c37a[_0x27bd('0x35')]){var _0x1b4ae8={};_0x1b4ae8[_0x15c37a[_0x27bd('0x35')]]=_0x3cc156;_[_0x27bd('0x39')](_0x3c91e5[_0x27bd('0x36')],_0x1b4ae8);}return _0x4d601e[_0x27bd('0x21')](_0x27bd('0x37'))[_0x27bd('0x26')](_0x3c91e5,_0x38cdae)['then'](function(_0x2c9255){if(_0x2c9255&&_0x2c9255[_0x27bd('0x28')]){return _0x2c9255;}else{var _0x340bf8=_[_0x27bd('0x34')](_0x2afe3f);if(_0x15c37a[_0x27bd('0x38')]){var _0x591860={};_0x591860[_0x15c37a['additionalSearchLead']]=_0x3cc156;_[_0x27bd('0x39')](_0x340bf8[_0x27bd('0x36')],_0x591860);}return _0x4d601e['sobject'](_0x27bd('0x3a'))['find'](_0x340bf8,_0x38cdae);}});}});case'contact':var _0x3ec961=_[_0x27bd('0x34')](_0x2afe3f);if(_0x15c37a[_0x27bd('0x35')]){var _0x1ffda1={};_0x1ffda1[_0x15c37a[_0x27bd('0x35')]]=_0x3cc156;_['merge'](_0x3ec961[_0x27bd('0x36')],_0x1ffda1);}return _0x4d601e[_0x27bd('0x21')](_0x27bd('0x37'))[_0x27bd('0x26')](_0x3ec961,_0x38cdae)['execute']();case _0x27bd('0x17'):var _0x52a921=_[_0x27bd('0x34')](_0x2afe3f);if(_0x15c37a[_0x27bd('0x38')]){var _0x1ffda1={};_0x1ffda1[_0x15c37a[_0x27bd('0x38')]]=_0x3cc156;_['merge'](_0x52a921[_0x27bd('0x36')],_0x1ffda1);}return _0x4d601e[_0x27bd('0x21')]('Lead')[_0x27bd('0x26')](_0x52a921,_0x38cdae);case _0x27bd('0x19'):var _0xd9c8b6=_[_0x27bd('0x34')](_0x2afe3f);if(_0x15c37a[_0x27bd('0x3c')]){var _0x1ffda1={};_0x1ffda1[_0x15c37a[_0x27bd('0x3c')]]=_0x3cc156;_[_0x27bd('0x39')](_0xd9c8b6['$or'],_0x1ffda1);}return _0x4d601e[_0x27bd('0x21')]('Account')[_0x27bd('0x26')](_0xd9c8b6,_0x38cdae);default:return null;}})[_0x27bd('0x2e')](function(_0x15f1a4){if(_0x15f1a4&&_0x15f1a4[_0x27bd('0x28')]){var _0x51e37b=_[_0x27bd('0x3e')](_0x15f1a4);if(_0x51e37b){return BPromise[_0x27bd('0x2a')]({'id':_0x51e37b['Id'],'name':_0x51e37b[_0x27bd('0x2b')],'phone':_0x51e37b[_0x27bd('0x3f')],'endUserType':_0x51e37b[_0x27bd('0x40')][_0x27bd('0x41')][_0x27bd('0x42')]()});}}})[_0x27bd('0x2e')](function(_0x3e2d9c){if(_0x3e2d9c){logger[_0x27bd('0x1f')](_0x27bd('0x43'),_0x3e2d9c[_0x27bd('0x15')],_0x3cc156);return BPromise[_0x27bd('0x2a')](_0x3e2d9c);}else{logger[_0x27bd('0x1f')](_0x27bd('0x44'),_0x3cc156);var _0x14e58f={'Phone':_0x3cc156};if(_0x15c37a[_0x27bd('0x45')]){if(_0x15c37a[_0x27bd('0x45')]===_0x27bd('0x16')){logger[_0x27bd('0x1f')](_0x27bd('0x46'),_0x3cc156,_0x15c37a['moduleCreate']);_0x14e58f[_0x27bd('0x47')]=_0x13379f!==_0x27bd('0x48')?_0x13379f:util[_0x27bd('0x49')]('Caller\x20-\x20%s',_0x3cc156);}else if(_0x15c37a[_0x27bd('0x45')]===_0x27bd('0x17')){logger[_0x27bd('0x1f')](_0x27bd('0x46'),_0x3cc156,_0x15c37a[_0x27bd('0x45')]);_0x14e58f[_0x27bd('0x47')]=_0x13379f!==_0x27bd('0x48')?_0x13379f:util[_0x27bd('0x49')](_0x27bd('0x4a'),_0x3cc156);_0x14e58f['Company']=_0x27bd('0x4b');}else if(_0x15c37a[_0x27bd('0x45')]===_0x27bd('0x19')){logger[_0x27bd('0x1f')](_0x27bd('0x46'),_0x3cc156,_0x15c37a[_0x27bd('0x45')]);_0x14e58f[_0x27bd('0x2b')]=_0x13379f!==_0x27bd('0x48')?_0x13379f:util[_0x27bd('0x49')](_0x27bd('0x4a'),_0x3cc156);}else{return null;}}return _0x4d601e[_0x27bd('0x21')](_[_0x27bd('0x4c')](_0x15c37a[_0x27bd('0x45')]))['create'](_0x14e58f)[_0x27bd('0x2e')](function(_0x27c6f8){return BPromise[_0x27bd('0x2a')]({'id':_0x27c6f8['id'],'endUserType':_0x15c37a[_0x27bd('0x45')]});});}});}function getCustomFields(_0x48750b,_0x3f970d){var _0x3768c8={};if(_0x48750b[_0x27bd('0x28')]>0x0){_[_0x27bd('0x4d')](_0x48750b,function(_0x3fb58c){if(_[_0x27bd('0x4e')]([_0x27bd('0x4f'),'picklist'],_0x3fb58c[_0x27bd('0x41')])&&_0x3fb58c[_0x27bd('0x50')]){_0x3768c8[_0x3fb58c[_0x27bd('0x50')]]=_0x3fb58c[_0x27bd('0x51')][_0x27bd('0x52')]();}else if(_0x3fb58c['type']===_0x27bd('0x53')&&_0x3fb58c['variableName']&&_0x3fb58c['idField']){_0x3f970d[_0x3fb58c[_0x27bd('0x54')]]&&(_0x3768c8[_0x3fb58c[_0x27bd('0x50')]]=_0x3f970d[_0x3fb58c['variableName']][_0x27bd('0x52')]());}else if(_0x3fb58c[_0x27bd('0x41')]===_0x27bd('0x55')&&_0x3fb58c[_0x27bd('0x56')]&&_0x3fb58c[_0x27bd('0x56')][_0x27bd('0x57')]&&_0x3fb58c[_0x27bd('0x50')]){_0x3f970d[_0x3fb58c[_0x27bd('0x56')]['name'][_0x27bd('0x42')]()]&&(_0x3768c8[_0x3fb58c[_0x27bd('0x50')]]=_0x3f970d[_0x3fb58c['Variable'][_0x27bd('0x57')]['toLowerCase']()]['toString']());}});}return _0x3768c8;}function getConnection(_0x3e6e47){var _0x353c6c=_0x3e6e47[_0x27bd('0x58')][_0x27bd('0x59')](_0x3e6e47['securityToken']);var _0x21c8d8=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3e6e47[_0x27bd('0x5a')]||_0x27bd('0x5b'),'clientId':_0x3e6e47[_0x27bd('0x5c')],'clientSecret':_0x3e6e47[_0x27bd('0x5d')]}});return _0x21c8d8[_0x27bd('0x5e')](_0x3e6e47[_0x27bd('0x5f')],_0x353c6c)[_0x27bd('0x2e')](function(){logger['info']('Connection\x20established.');return _0x21c8d8;});}exports[_0x27bd('0x60')]=function(_0x350843,_0x433b1f,_0x168485,_0x162aa4,_0x272779,_0x3731c9){var _0x1a044c,_0x4fdd77,_0x1d1a49,_0x534ae0;_0x3731c9[_0x27bd('0x61')]=intUtil[_0x27bd('0x62')](_0x3731c9[_0x27bd('0x61')]);_0x3731c9[_0x27bd('0x5a')]=intUtil[_0x27bd('0x62')](_0x3731c9[_0x27bd('0x5a')]);if(_0x272779&&_0x272779[_0x27bd('0x63')]){logger['info'](_0x27bd('0x64'),_0x27bd('0x65'));_0x433b1f[_0x27bd('0x66')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3731c9[_0x27bd('0x61')],_0x433b1f[_0x27bd('0x67')],md5(_0x433b1f['uniqueid']));}else{_0x433b1f[_0x27bd('0x66')]='';}return getConnection(_0x3731c9)[_0x27bd('0x2e')](function(_0xbca03b){_0x534ae0=_0xbca03b;return getUser(_0x3731c9,_0x162aa4['email'],_0x534ae0);})[_0x27bd('0x2e')](function(_0x279166){_0x1a044c=_0x279166;return getEndUser(_0x3731c9,_0x168485,_0x433b1f['calleridname'],_0x433b1f['calleridnum'],_0x534ae0);})[_0x27bd('0x2e')](function(_0x5777fd){_0x4fdd77=_0x5777fd;return getTicket(_0x3731c9,_0x1a044c,_0x4fdd77,_0x168485,_0x433b1f,_0x168485['Fields'],_0x534ae0,_0x27bd('0x60'));})[_0x27bd('0x2e')](function(_0x358fcb){_0x1d1a49=_0x358fcb;logger[_0x27bd('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x1d1a49['id']);logger[_0x27bd('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1d1a49['id'],_0x162aa4['name'],_0x3731c9[_0x27bd('0x41')]);switch(_0x3731c9[_0x27bd('0x41')]){case _0x27bd('0x68'):emit(util[_0x27bd('0x49')]('user:%s',_0x162aa4['name']),_0x27bd('0x69'),{'recordId':_0x1d1a49['id']});break;case _0x27bd('0x6a'):emit(util[_0x27bd('0x49')](_0x27bd('0x6b'),_0x162aa4['name']),_0x27bd('0x6c'),{'uri':util[_0x27bd('0x49')]('%s/%s/e',_0x534ae0[_0x27bd('0x6d')],_0x1d1a49['id'])});break;default:logger[_0x27bd('0x6e')](_0x27bd('0x6f'));}})[_0x27bd('0x70')](function(_0x3d3689){logger[_0x27bd('0x6e')](_0x27bd('0x64'),_0x3d3689);});};exports[_0x27bd('0x71')]=function(_0x2363cd,_0x1953b5,_0x1867ff,_0x1e9c55,_0x32d30a,_0x1524e1,_0x2f514c){var _0x295710,_0x44425e,_0x407444,_0x310325;_0x1524e1[_0x27bd('0x61')]=intUtil[_0x27bd('0x62')](_0x1524e1['serverUrl']);_0x1524e1[_0x27bd('0x5a')]=intUtil[_0x27bd('0x62')](_0x1524e1['remoteUri']);if(_0x2f514c&&_0x2f514c[_0x27bd('0x72')]&&_0x2f514c['recordingFormat']!==_0x27bd('0x73')){logger[_0x27bd('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1953b5[_0x27bd('0x66')]=util[_0x27bd('0x49')](_0x27bd('0x74'),_0x1524e1[_0x27bd('0x61')],_0x1953b5[_0x27bd('0x67')],md5(_0x1953b5[_0x27bd('0x67')]));}return getConnection(_0x1524e1)['then'](function(_0x32dba2){_0x310325=_0x32dba2;return getUser(_0x1524e1,_0x1e9c55['email'],_0x310325);})[_0x27bd('0x2e')](function(_0x459971){_0x295710=_0x459971;return getEndUser(_0x1524e1,_0x1867ff,_0x1953b5[_0x27bd('0x75')],_0x1953b5[_0x27bd('0x76')],_0x310325);})[_0x27bd('0x2e')](function(_0x16b61e){_0x44425e=_0x16b61e;return getTicket(_0x1524e1,_0x295710,_0x44425e,_0x1867ff,_0x1953b5,_0x1867ff[_0x27bd('0x77')],_0x310325,_0x27bd('0x71'));})[_0x27bd('0x2e')](function(_0x3d8a49){_0x407444=_0x3d8a49;logger[_0x27bd('0x1f')](_0x27bd('0x78'),_0x407444['id']);logger['info'](_0x27bd('0x79'),_0x407444['id'],_0x1e9c55[_0x27bd('0x57')],_0x1524e1[_0x27bd('0x41')]);switch(_0x1524e1[_0x27bd('0x41')]){case _0x27bd('0x68'):emit(util[_0x27bd('0x49')](_0x27bd('0x6b'),_0x1e9c55['name']),_0x27bd('0x69'),{'recordId':_0x407444['id']});break;case _0x27bd('0x6a'):emit(util[_0x27bd('0x49')](_0x27bd('0x6b'),_0x1e9c55['name']),_0x27bd('0x6c'),{'uri':util['format']('%s/%s/e',_0x310325[_0x27bd('0x6d')],_0x407444['id'])});break;default:logger[_0x27bd('0x6e')]('[OUTBOUND]',_0x27bd('0x7a'));}})[_0x27bd('0x70')](function(_0x4a5e0c){logger[_0x27bd('0x6e')](_0x27bd('0x7b'),_0x4a5e0c);});};exports[_0x27bd('0x7c')]=function(_0x1b727a,_0x418fc3,_0x49cebf,_0x159b28,_0xc2ec4d,_0x369949){var _0x540ea3,_0x3a58a7,_0x1b1bff,_0x303932;_0x369949['serverUrl']=intUtil['stripTrailingSlash'](_0x369949['serverUrl']);_0x369949['remoteUri']=intUtil[_0x27bd('0x62')](_0x369949[_0x27bd('0x5a')]);if(_0xc2ec4d&&_0xc2ec4d[_0x27bd('0x63')]){logger[_0x27bd('0x1f')]('['+_0x418fc3[_0x27bd('0x7d')]['toUpperCase']()+']',_0x27bd('0x65'));_0x418fc3['recordingURL']=util[_0x27bd('0x49')](_0x27bd('0x74'),_0x369949[_0x27bd('0x61')],_0x418fc3[_0x27bd('0x67')],md5(_0x418fc3[_0x27bd('0x67')]));}else{_0x418fc3[_0x27bd('0x66')]='';}return getConnection(_0x369949)[_0x27bd('0x2e')](function(_0x35b75e){_0x303932=_0x35b75e;if(!_[_0x27bd('0x23')](_0x159b28)){return getUser(_0x369949,_0x159b28[_0x27bd('0x57')],_0x303932);}else{return getUser(_0x369949,null,_0x303932);}})[_0x27bd('0x2e')](function(_0x587ce7){_0x540ea3=_0x587ce7;return getEndUser(_0x369949,_0x49cebf,_0x418fc3['calleridname'],_0x418fc3[_0x27bd('0x7e')],_0x303932);})[_0x27bd('0x2e')](function(_0x5392d6){_0x3a58a7=_0x5392d6;return getTicket(_0x369949,_0x540ea3,_0x3a58a7,_0x49cebf,_0x418fc3,_0x49cebf[_0x27bd('0x77')],_0x303932);})[_0x27bd('0x2e')](function(_0x8ed310){_0x1b1bff=_0x8ed310;logger[_0x27bd('0x1f')]('['+_0x418fc3['lastevent'][_0x27bd('0x7f')]()+_0x27bd('0x80'),_0x1b1bff['id']);logger[_0x27bd('0x1f')]('['+_0x418fc3[_0x27bd('0x7d')][_0x27bd('0x7f')]()+_0x27bd('0x81'),_0x369949[_0x27bd('0x41')]);})[_0x27bd('0x70')](function(_0x55266f){logger[_0x27bd('0x6e')]('['+_0x418fc3[_0x27bd('0x7d')]['toUpperCase']()+']',_0x55266f);});}; \ No newline at end of file +var _0x9b6d=['User','execute','then','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','length','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','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','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','name','integrationTab','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','newTab','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','ioredis','./util','salesforce','redis','defaults','localhost','socket.io-emitter','assign','getString','Subjects','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','create','validateEmail','sobject'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0x9b6d,0x1e2));var _0xd9b6=function(_0x5cfae5,_0x3e3405){_0x5cfae5=_0x5cfae5-0x0;var _0x4b3868=_0x9b6d[_0x5cfae5];return _0x4b3868;};'use strict';var _=require(_0xd9b6('0x0'));var rp=require(_0xd9b6('0x1'));var moment=require(_0xd9b6('0x2'));var BPromise=require(_0xd9b6('0x3'));var md5=require('md5');var jsforce=require(_0xd9b6('0x4'));var util=require('util');var Redis=require(_0xd9b6('0x5'));var intUtil=require(_0xd9b6('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd9b6('0x7'));config[_0xd9b6('0x8')]=_[_0xd9b6('0x9')](config['redis'],{'host':_0xd9b6('0xa'),'port':0x18eb});var io=require(_0xd9b6('0xb'))(new Redis(config[_0xd9b6('0x8')]));function emit(_0x389d31,_0x4a1043,_0x5d1414){io['to'](_0x389d31)['emit'](_0x4a1043,_0x5d1414);}function getTicket(_0x204fe8,_0x438166,_0x558815,_0x3057ed,_0x166afa,_0x1d6981,_0x590469,_0x1aeac9){var _0x32e2fb=Object[_0xd9b6('0xc')]({},{'OwnerId':_0x438166['id'],'Subject':intUtil[_0xd9b6('0xd')](_0x3057ed[_0xd9b6('0xe')],_0x166afa,'\x20'),'Description':intUtil[_0xd9b6('0xd')](_0x3057ed['Descriptions'],_0x166afa,'\x0a')},getCustomFields(_0x1d6981,_0x166afa));if(_0x558815){if(_0x3057ed[_0xd9b6('0xf')]===_0xd9b6('0x10')){_0x32e2fb['ActivityDate']=moment[_0xd9b6('0x11')]();_0x32e2fb[_0xd9b6('0x12')]=![];_0x32e2fb[_0xd9b6('0x13')]=![];if(_0x558815[_0xd9b6('0x14')]===_0xd9b6('0x15')||_0x558815['endUserType']===_0xd9b6('0x16')){_0x32e2fb[_0xd9b6('0x17')]=_0x558815['id'];}else if(_0x558815[_0xd9b6('0x14')]===_0xd9b6('0x18')){_0x32e2fb[_0xd9b6('0x19')]=_0x558815['id'];}}else if(_0x3057ed[_0xd9b6('0xf')]===_0xd9b6('0x1a')){if(_0x558815[_0xd9b6('0x14')]===_0xd9b6('0x15')){_0x32e2fb[_0xd9b6('0x1b')]=_0x558815['id'];}else if(_0x558815['endUserType']===_0xd9b6('0x18')){_0x32e2fb[_0xd9b6('0x1c')]=_0x558815['id'];}else if(_0x558815[_0xd9b6('0x14')]==='lead'&&_0x3057ed[_0xd9b6('0x1d')]){_0x32e2fb[_0x3057ed[_0xd9b6('0x1d')]]=_0x558815['id'];}else{logger[_0xd9b6('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x590469['sobject'](_0x3057ed[_0xd9b6('0xf')])[_0xd9b6('0x1f')](_0x32e2fb);}function getUser(_0x23d17b,_0x425b57,_0x1fe622){if(!_['isNil'](_0x425b57)&&intUtil[_0xd9b6('0x20')](_0x425b57)){var _0x2dc01c={'Email':_0x425b57};var _0x405a78={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1fe622[_0xd9b6('0x21')](_0xd9b6('0x22'))['find'](_0x2dc01c,_0x405a78)[_0xd9b6('0x23')]()[_0xd9b6('0x24')](function(_0x278b2f){if(_0x278b2f['length']){var _0x28fd4e=_[_0xd9b6('0x25')](_0x278b2f,function(_0x1d0771){return _0x1d0771[_0xd9b6('0x26')]===_0x425b57;});if(_0x28fd4e){logger[_0xd9b6('0x1e')](_0xd9b6('0x27'),_0x425b57);return BPromise[_0xd9b6('0x28')]({'id':_0x28fd4e['Id'],'name':_0x28fd4e[_0xd9b6('0x29')]});}}else{logger[_0xd9b6('0x1e')](_0xd9b6('0x2a'),_0x425b57);return _0x1fe622[_0xd9b6('0x2b')]()['then'](function(_0x3a4474){return BPromise[_0xd9b6('0x28')]({'id':_0x3a4474[_0xd9b6('0x2c')],'name':_0x3a4474[_0xd9b6('0x2d')]});});}});}else{logger[_0xd9b6('0x1e')](_0xd9b6('0x2a'),_0x425b57);return _0x1fe622[_0xd9b6('0x2b')]()[_0xd9b6('0x24')](function(_0x3f1771){return BPromise[_0xd9b6('0x28')]({'id':_0x3f1771[_0xd9b6('0x2c')],'name':_0x3f1771[_0xd9b6('0x2d')]});});}}function getEndUser(_0x12e023,_0x1d1fb4,_0x1aa7e6,_0x3649ff,_0x3a67e1){var _0x122085={'$or':{'Phone':_0x3649ff}};var _0x484e2e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd9b6('0x28')]()[_0xd9b6('0x24')](function(){logger[_0xd9b6('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3649ff,_0x1d1fb4[_0xd9b6('0x2e')]);switch(_0x1d1fb4[_0xd9b6('0x2e')]){case _0xd9b6('0x2f'):var _0x533012=_[_0xd9b6('0x30')](_0x122085);if(_0x1d1fb4[_0xd9b6('0x31')]){var _0x5a2a08={};_0x5a2a08[_0x1d1fb4['additionalSearchContact']]=_0x3649ff;_[_0xd9b6('0x32')](_0x533012['$or'],_0x5a2a08);}return _0x3a67e1['sobject'](_0xd9b6('0x33'))[_0xd9b6('0x25')](_0x533012,_0x484e2e)[_0xd9b6('0x23')]()[_0xd9b6('0x24')](function(_0x8dce8){if(_0x8dce8&&_0x8dce8[_0xd9b6('0x34')]){return _0x8dce8;}else{var _0x40c437=_[_0xd9b6('0x30')](_0x122085);if(_0x1d1fb4[_0xd9b6('0x35')]){var _0x45fbbe={};_0x45fbbe[_0x1d1fb4[_0xd9b6('0x35')]]=_0x3649ff;_[_0xd9b6('0x32')](_0x40c437[_0xd9b6('0x36')],_0x45fbbe);}return _0x3a67e1[_0xd9b6('0x21')](_0xd9b6('0x37'))[_0xd9b6('0x25')](_0x40c437,_0x484e2e);}});case _0xd9b6('0x38'):var _0x145699=_[_0xd9b6('0x30')](_0x122085);if(_0x1d1fb4[_0xd9b6('0x39')]){var _0x5a2a08={};_0x5a2a08[_0x1d1fb4['additionalSearchAccount']]=_0x3649ff;_[_0xd9b6('0x32')](_0x145699[_0xd9b6('0x36')],_0x5a2a08);}return _0x3a67e1[_0xd9b6('0x21')](_0xd9b6('0x3a'))[_0xd9b6('0x25')](_0x145699,_0x484e2e)[_0xd9b6('0x23')]()[_0xd9b6('0x24')](function(_0x14e827){if(_0x14e827&&_0x14e827[_0xd9b6('0x34')]){return _0x14e827;}else{var _0xcc15ed=_[_0xd9b6('0x30')](_0x122085);if(_0x1d1fb4[_0xd9b6('0x31')]){var _0x10ad24={};_0x10ad24[_0x1d1fb4[_0xd9b6('0x31')]]=_0x3649ff;_[_0xd9b6('0x32')](_0xcc15ed['$or'],_0x10ad24);}return _0x3a67e1[_0xd9b6('0x21')]('Contact')[_0xd9b6('0x25')](_0xcc15ed,_0x484e2e)['then'](function(_0x542ab5){if(_0x542ab5&&_0x542ab5[_0xd9b6('0x34')]){return _0x542ab5;}else{var _0xe03d4e=_['cloneDeep'](_0x122085);if(_0x1d1fb4[_0xd9b6('0x35')]){var _0x4550db={};_0x4550db[_0x1d1fb4['additionalSearchLead']]=_0x3649ff;_[_0xd9b6('0x32')](_0xe03d4e[_0xd9b6('0x36')],_0x4550db);}return _0x3a67e1['sobject'](_0xd9b6('0x37'))[_0xd9b6('0x25')](_0xe03d4e,_0x484e2e);}});}});case'contact':var _0x533012=_[_0xd9b6('0x30')](_0x122085);if(_0x1d1fb4[_0xd9b6('0x31')]){var _0x5a2a08={};_0x5a2a08[_0x1d1fb4[_0xd9b6('0x31')]]=_0x3649ff;_[_0xd9b6('0x32')](_0x533012[_0xd9b6('0x36')],_0x5a2a08);}return _0x3a67e1[_0xd9b6('0x21')]('Contact')[_0xd9b6('0x25')](_0x533012,_0x484e2e)['execute']();case _0xd9b6('0x16'):var _0x4bf6f2=_[_0xd9b6('0x30')](_0x122085);if(_0x1d1fb4[_0xd9b6('0x35')]){var _0x5a2a08={};_0x5a2a08[_0x1d1fb4['additionalSearchLead']]=_0x3649ff;_['merge'](_0x4bf6f2[_0xd9b6('0x36')],_0x5a2a08);}return _0x3a67e1[_0xd9b6('0x21')](_0xd9b6('0x37'))[_0xd9b6('0x25')](_0x4bf6f2,_0x484e2e);case'account':var _0x145699=_['cloneDeep'](_0x122085);if(_0x1d1fb4[_0xd9b6('0x39')]){var _0x5a2a08={};_0x5a2a08[_0x1d1fb4[_0xd9b6('0x39')]]=_0x3649ff;_[_0xd9b6('0x32')](_0x145699[_0xd9b6('0x36')],_0x5a2a08);}return _0x3a67e1['sobject']('Account')[_0xd9b6('0x25')](_0x145699,_0x484e2e);default:return null;}})[_0xd9b6('0x24')](function(_0x5575db){if(_0x5575db&&_0x5575db[_0xd9b6('0x34')]){var _0x1e24d8=_[_0xd9b6('0x3b')](_0x5575db);if(_0x1e24d8){return BPromise[_0xd9b6('0x28')]({'id':_0x1e24d8['Id'],'name':_0x1e24d8['Name'],'phone':_0x1e24d8[_0xd9b6('0x3c')],'endUserType':_0x1e24d8[_0xd9b6('0x3d')][_0xd9b6('0x3e')]['toLowerCase']()});}}})['then'](function(_0x5ba792){if(_0x5ba792){logger[_0xd9b6('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x5ba792[_0xd9b6('0x14')],_0x3649ff);return BPromise[_0xd9b6('0x28')](_0x5ba792);}else{logger[_0xd9b6('0x1e')](_0xd9b6('0x3f'),_0x3649ff);var _0x3b04f9={'Phone':_0x3649ff};if(_0x1d1fb4[_0xd9b6('0x40')]){if(_0x1d1fb4[_0xd9b6('0x40')]===_0xd9b6('0x15')){logger[_0xd9b6('0x1e')](_0xd9b6('0x41'),_0x3649ff,_0x1d1fb4[_0xd9b6('0x40')]);_0x3b04f9['LastName']=_0x1aa7e6!==_0xd9b6('0x42')?_0x1aa7e6:util['format']('Caller\x20-\x20%s',_0x3649ff);}else if(_0x1d1fb4[_0xd9b6('0x40')]===_0xd9b6('0x16')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3649ff,_0x1d1fb4[_0xd9b6('0x40')]);_0x3b04f9[_0xd9b6('0x43')]=_0x1aa7e6!==_0xd9b6('0x42')?_0x1aa7e6:util[_0xd9b6('0x44')](_0xd9b6('0x45'),_0x3649ff);_0x3b04f9[_0xd9b6('0x46')]='No\x20Company';}else if(_0x1d1fb4[_0xd9b6('0x40')]==='account'){logger['info'](_0xd9b6('0x41'),_0x3649ff,_0x1d1fb4['moduleCreate']);_0x3b04f9[_0xd9b6('0x29')]=_0x1aa7e6!==_0xd9b6('0x42')?_0x1aa7e6:util[_0xd9b6('0x44')]('Caller\x20-\x20%s',_0x3649ff);}else{return null;}}return _0x3a67e1['sobject'](_['upperFirst'](_0x1d1fb4[_0xd9b6('0x40')]))[_0xd9b6('0x1f')](_0x3b04f9)[_0xd9b6('0x24')](function(_0x48d28a){return BPromise['resolve']({'id':_0x48d28a['id'],'endUserType':_0x1d1fb4[_0xd9b6('0x40')]});});}});}function getCustomFields(_0x4d0c18,_0x13ee3d){var _0x491589={};if(_0x4d0c18[_0xd9b6('0x34')]>0x0){_['forEach'](_0x4d0c18,function(_0x4bc3f3){if(_[_0xd9b6('0x47')]([_0xd9b6('0x48'),_0xd9b6('0x49')],_0x4bc3f3[_0xd9b6('0x3e')])&&_0x4bc3f3[_0xd9b6('0x4a')]){_0x491589[_0x4bc3f3[_0xd9b6('0x4a')]]=_0x4bc3f3[_0xd9b6('0x4b')][_0xd9b6('0x4c')]();}else if(_0x4bc3f3[_0xd9b6('0x3e')]==='variable'&&_0x4bc3f3[_0xd9b6('0x4d')]&&_0x4bc3f3[_0xd9b6('0x4a')]){_0x13ee3d[_0x4bc3f3[_0xd9b6('0x4d')]]&&(_0x491589[_0x4bc3f3['idField']]=_0x13ee3d[_0x4bc3f3['variableName']]['toString']());}else if(_0x4bc3f3[_0xd9b6('0x3e')]===_0xd9b6('0x4e')&&_0x4bc3f3[_0xd9b6('0x4f')]&&_0x4bc3f3['Variable']['name']&&_0x4bc3f3[_0xd9b6('0x4a')]){_0x13ee3d[_0x4bc3f3[_0xd9b6('0x4f')]['name'][_0xd9b6('0x50')]()]&&(_0x491589[_0x4bc3f3['idField']]=_0x13ee3d[_0x4bc3f3[_0xd9b6('0x4f')]['name']['toLowerCase']()][_0xd9b6('0x4c')]());}});}return _0x491589;}function getConnection(_0x999138){var _0x34af6a=_0x999138[_0xd9b6('0x51')]['concat'](_0x999138[_0xd9b6('0x52')]);var _0x1fbb29=new jsforce[(_0xd9b6('0x53'))]({'oauth2':{'loginUrl':_0x999138[_0xd9b6('0x54')]||_0xd9b6('0x55'),'clientId':_0x999138['clientId'],'clientSecret':_0x999138[_0xd9b6('0x56')]}});return _0x1fbb29[_0xd9b6('0x57')](_0x999138[_0xd9b6('0x58')],_0x34af6a)[_0xd9b6('0x24')](function(){logger[_0xd9b6('0x1e')](_0xd9b6('0x59'));return _0x1fbb29;});}exports['queue']=function(_0x1a9056,_0x3dce84,_0x2a7d1e,_0x4eb93f,_0x19230d,_0x2aca03){var _0x128f63,_0x48f6b7,_0x376cdc,_0x2905e8;_0x2aca03[_0xd9b6('0x5a')]=intUtil['stripTrailingSlash'](_0x2aca03[_0xd9b6('0x5a')]);_0x2aca03[_0xd9b6('0x54')]=intUtil['stripTrailingSlash'](_0x2aca03[_0xd9b6('0x54')]);if(_0x19230d&&_0x19230d[_0xd9b6('0x5b')]){logger['info'](_0xd9b6('0x5c'),_0xd9b6('0x5d'));_0x3dce84[_0xd9b6('0x5e')]=util['format'](_0xd9b6('0x5f'),_0x2aca03[_0xd9b6('0x5a')],_0x3dce84[_0xd9b6('0x60')],md5(_0x3dce84['uniqueid']));}else{_0x3dce84[_0xd9b6('0x5e')]='';}return getConnection(_0x2aca03)[_0xd9b6('0x24')](function(_0x47cc91){_0x2905e8=_0x47cc91;return getUser(_0x2aca03,_0x4eb93f[_0xd9b6('0x61')],_0x2905e8);})[_0xd9b6('0x24')](function(_0x21557d){_0x128f63=_0x21557d;return getEndUser(_0x2aca03,_0x2a7d1e,_0x3dce84[_0xd9b6('0x62')],_0x3dce84[_0xd9b6('0x63')],_0x2905e8);})[_0xd9b6('0x24')](function(_0x18e3e2){_0x48f6b7=_0x18e3e2;return getTicket(_0x2aca03,_0x128f63,_0x48f6b7,_0x2a7d1e,_0x3dce84,_0x2a7d1e[_0xd9b6('0x64')],_0x2905e8,_0xd9b6('0x65'));})[_0xd9b6('0x24')](function(_0x15af8c){_0x376cdc=_0x15af8c;logger[_0xd9b6('0x1e')](_0xd9b6('0x66'),_0x376cdc['id']);logger[_0xd9b6('0x1e')](_0xd9b6('0x67'),_0x376cdc['id'],_0x4eb93f[_0xd9b6('0x68')],_0x2aca03['type']);switch(_0x2aca03['type']){case _0xd9b6('0x69'):emit(util[_0xd9b6('0x44')]('user:%s',_0x4eb93f[_0xd9b6('0x68')]),_0xd9b6('0x6a'),{'recordId':_0x376cdc['id']});break;case'newTab':emit(util['format']('user:%s',_0x4eb93f['name']),_0xd9b6('0x6b'),{'uri':util[_0xd9b6('0x44')](_0xd9b6('0x6c'),_0x2905e8[_0xd9b6('0x6d')],_0x376cdc['id'])});break;default:logger[_0xd9b6('0x6e')](_0xd9b6('0x6f'));}})[_0xd9b6('0x70')](function(_0x3740da){logger[_0xd9b6('0x6e')]('[QUEUE]',_0x3740da);});};exports['outbound']=function(_0x490770,_0x3d923a,_0x2058ce,_0x3102cf,_0x1a4ced,_0x20b450,_0x522fb5){var _0x54a5ba,_0x31b220,_0x285b75,_0x33428f;_0x20b450[_0xd9b6('0x5a')]=intUtil[_0xd9b6('0x71')](_0x20b450[_0xd9b6('0x5a')]);_0x20b450[_0xd9b6('0x54')]=intUtil[_0xd9b6('0x71')](_0x20b450[_0xd9b6('0x54')]);if(_0x522fb5&&_0x522fb5['recordingFormat']&&_0x522fb5[_0xd9b6('0x72')]!==_0xd9b6('0x73')){logger[_0xd9b6('0x1e')](_0xd9b6('0x74'),'Recording\x20is\x20enabled!');_0x3d923a[_0xd9b6('0x5e')]=util[_0xd9b6('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20b450[_0xd9b6('0x5a')],_0x3d923a[_0xd9b6('0x60')],md5(_0x3d923a[_0xd9b6('0x60')]));}return getConnection(_0x20b450)[_0xd9b6('0x24')](function(_0x36d0b1){_0x33428f=_0x36d0b1;return getUser(_0x20b450,_0x3102cf['email'],_0x33428f);})[_0xd9b6('0x24')](function(_0x3488a8){_0x54a5ba=_0x3488a8;return getEndUser(_0x20b450,_0x2058ce,_0x3d923a['destcalleridname'],_0x3d923a[_0xd9b6('0x75')],_0x33428f);})[_0xd9b6('0x24')](function(_0x55ee90){_0x31b220=_0x55ee90;return getTicket(_0x20b450,_0x54a5ba,_0x31b220,_0x2058ce,_0x3d923a,_0x2058ce['Fields'],_0x33428f,_0xd9b6('0x76'));})[_0xd9b6('0x24')](function(_0x219ca0){_0x285b75=_0x219ca0;logger[_0xd9b6('0x1e')](_0xd9b6('0x77'),_0x285b75['id']);logger['info'](_0xd9b6('0x78'),_0x285b75['id'],_0x3102cf['name'],_0x20b450[_0xd9b6('0x3e')]);switch(_0x20b450[_0xd9b6('0x3e')]){case _0xd9b6('0x69'):emit(util[_0xd9b6('0x44')](_0xd9b6('0x79'),_0x3102cf['name']),_0xd9b6('0x6a'),{'recordId':_0x285b75['id']});break;case _0xd9b6('0x7a'):emit(util['format']('user:%s',_0x3102cf[_0xd9b6('0x68')]),_0xd9b6('0x6b'),{'uri':util[_0xd9b6('0x44')](_0xd9b6('0x6c'),_0x33428f[_0xd9b6('0x6d')],_0x285b75['id'])});break;default:logger['error'](_0xd9b6('0x74'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd9b6('0x70')](function(_0x365759){logger[_0xd9b6('0x6e')]('[OUTBOUND]',_0x365759);});};exports[_0xd9b6('0x7b')]=function(_0xd75bf6,_0x49b9c4,_0x1b70c9,_0x343d14,_0xdb038d,_0x48e017){var _0xd62a88,_0x4c0e81,_0x4ee061,_0x3d554c;_0x48e017[_0xd9b6('0x5a')]=intUtil[_0xd9b6('0x71')](_0x48e017[_0xd9b6('0x5a')]);_0x48e017['remoteUri']=intUtil['stripTrailingSlash'](_0x48e017[_0xd9b6('0x54')]);if(_0xdb038d&&_0xdb038d[_0xd9b6('0x5b')]){logger[_0xd9b6('0x1e')]('['+_0x49b9c4[_0xd9b6('0x7c')][_0xd9b6('0x7d')]()+']',_0xd9b6('0x5d'));_0x49b9c4[_0xd9b6('0x5e')]=util[_0xd9b6('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48e017['serverUrl'],_0x49b9c4[_0xd9b6('0x60')],md5(_0x49b9c4[_0xd9b6('0x60')]));}else{_0x49b9c4[_0xd9b6('0x5e')]='';}return getConnection(_0x48e017)['then'](function(_0x5a9027){_0x3d554c=_0x5a9027;if(!_[_0xd9b6('0x7e')](_0x343d14)){return getUser(_0x48e017,_0x343d14['name'],_0x3d554c);}else{return getUser(_0x48e017,null,_0x3d554c);}})[_0xd9b6('0x24')](function(_0x4fc61e){_0xd62a88=_0x4fc61e;return getEndUser(_0x48e017,_0x1b70c9,_0x49b9c4[_0xd9b6('0x62')],_0x49b9c4[_0xd9b6('0x63')],_0x3d554c);})[_0xd9b6('0x24')](function(_0x21432c){_0x4c0e81=_0x21432c;return getTicket(_0x48e017,_0xd62a88,_0x4c0e81,_0x1b70c9,_0x49b9c4,_0x1b70c9[_0xd9b6('0x64')],_0x3d554c);})[_0xd9b6('0x24')](function(_0x290666){_0x4ee061=_0x290666;logger['info']('['+_0x49b9c4[_0xd9b6('0x7c')][_0xd9b6('0x7d')]()+_0xd9b6('0x7f'),_0x4ee061['id']);logger[_0xd9b6('0x1e')]('['+_0x49b9c4[_0xd9b6('0x7c')][_0xd9b6('0x7d')]()+_0xd9b6('0x80'),_0x48e017['type']);})[_0xd9b6('0x70')](function(_0x532e08){logger[_0xd9b6('0x6e')]('['+_0x49b9c4[_0xd9b6('0x7c')]['toUpperCase']()+']',_0x532e08);});}; \ 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 1f3ac3c..da585c7 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 _0xeb42=['remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','GET','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','includes','string','picklist','type','nameField','content','toString','idField','toLowerCase','variable','variableName','customField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','sysparm_limit=1','sysparm_display_value=true'];(function(_0x1f5d72,_0x435b51){var _0xf053b7=function(_0x787104){while(--_0x787104){_0x1f5d72['push'](_0x1f5d72['shift']());}};_0xf053b7(++_0x435b51);}(_0xeb42,0xf5));var _0x2eb4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xeb42[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x2eb4('0x0'));var Promise=require(_0x2eb4('0x1'));var rp=require(_0x2eb4('0x2'));var util=require(_0x2eb4('0x3'));var md5=require(_0x2eb4('0x4'));var Redis=require(_0x2eb4('0x5'));var intUtil=require(_0x2eb4('0x6'));var config=require(_0x2eb4('0x7'));var logger=require(_0x2eb4('0x8'))(_0x2eb4('0x9'));config['redis']=_[_0x2eb4('0xa')](config[_0x2eb4('0xb')],{'host':_0x2eb4('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x4e6b79,_0x4775d2,_0x563718,_0x1189fb,_0x45db3d,_0x2c142b){return new Promise(function(_0x3885c3,_0x1a9819){var _0x413c30={'method':_0x2eb4('0xd'),'uri':_0x1189fb+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x45db3d+'&'+_0x2c142b,'auth':_0x4775d2,'json':!![]};return rp(_0x413c30)[_0x2eb4('0xe')](function(_0xc7aa33){if(_0xc7aa33[_0x2eb4('0xf')][_0x2eb4('0x10')]>0x0){_0x563718[_0x2eb4('0x11')]=_0xc7aa33[_0x2eb4('0xf')][0x0][_0x2eb4('0x12')];}logger[_0x2eb4('0x13')]('['+[_0x4e6b79[_0x2eb4('0x14')]()]+_0x2eb4('0x15'),_0x563718);_0x3885c3(_0x563718);})[_0x2eb4('0x16')](function(_0x23f4b6){logger[_0x2eb4('0x17')]('['+[_0x4e6b79[_0x2eb4('0x14')]()]+']',_0x23f4b6[_0x2eb4('0x18')]);_0x1a9819(_0x23f4b6['message']);});});}function getUser(_0x58fe35,_0x568a09,_0x1a9b80,_0x1c2710,_0x268010){return function(_0x473266){logger[_0x2eb4('0x13')]('['+[_0x58fe35[_0x2eb4('0x14')]()]+_0x2eb4('0x19'),_0x473266);return new Promise(function(_0xa2a42c,_0x506a69){if(intUtil[_0x2eb4('0x1a')](_0x473266[_0x2eb4('0x1b')])){var _0x4fac31={'method':_0x2eb4('0xd'),'uri':_0x1a9b80+_0x2eb4('0x1c')+_0x473266[_0x2eb4('0x1b')]+'&'+_0x1c2710+'&'+_0x268010,'auth':_0x568a09,'json':!![]};logger[_0x2eb4('0x13')]('['+[_0x58fe35[_0x2eb4('0x14')]()]+_0x2eb4('0x1d'),_0x4fac31);return rp(_0x4fac31)['then'](function(_0x246d2c){logger[_0x2eb4('0x13')]('['+[_0x58fe35[_0x2eb4('0x14')]()]+_0x2eb4('0x1e'),_0x246d2c);if(_0x246d2c['result'][_0x2eb4('0x10')]>0x0&&String(_0x246d2c[_0x2eb4('0xf')][0x0][_0x2eb4('0x1f')])===_0x2eb4('0x20')){_0x473266[_0x2eb4('0x21')]=_0x246d2c[_0x2eb4('0xf')][0x0][_0x2eb4('0x12')];}else{_0x473266[_0x2eb4('0x21')]=_0x473266[_0x2eb4('0x11')];_0x473266[_0x2eb4('0x1b')]=_0x473266['adminEmail'];}logger[_0x2eb4('0x13')]('['+[_0x58fe35['toUpperCase']()]+_0x2eb4('0x22'),_0x473266);_0xa2a42c(_0x473266);})['catch'](function(_0x293cf0){logger[_0x2eb4('0x17')]('['+[_0x58fe35[_0x2eb4('0x14')]()]+']',_0x293cf0[_0x2eb4('0x18')]);_0x506a69(_0x293cf0[_0x2eb4('0x18')]);});}else{logger[_0x2eb4('0x13')]('['+[_0x58fe35[_0x2eb4('0x14')]()]+_0x2eb4('0x23'));_0x473266[_0x2eb4('0x21')]=_0x473266[_0x2eb4('0x11')];_0x473266[_0x2eb4('0x1b')]=_0x473266['adminEmail'];_0xa2a42c(_0x473266);}});};}function createEndUser(_0x1819df,_0x277dcc,_0x40739b,_0x528cd6,_0x41ad02){logger['info']('['+[_0x1819df['toUpperCase']()]+_0x2eb4('0x24'),_0x40739b);return new Promise(function(_0x2e40f2,_0x18c3c9){var _0x35f92f={'method':_0x2eb4('0x25'),'uri':_0x528cd6+_0x2eb4('0x26')+_0x41ad02,'body':{'user_name':_0x40739b[_0x2eb4('0x27')],'roles':_0x2eb4('0x28'),'first_name':_0x40739b[_0x2eb4('0x27')],'active':_0x2eb4('0x20'),'date_format':_0x2eb4('0x29'),'phone':_0x40739b[_0x2eb4('0x27')]},'auth':_0x277dcc,'json':!![]};return rp(_0x35f92f)[_0x2eb4('0xe')](function(_0x5f3bd4){logger[_0x2eb4('0x13')]('['+[_0x1819df[_0x2eb4('0x14')]()]+_0x2eb4('0x2a'),_0x5f3bd4[_0x2eb4('0xf')]);_0x40739b['endUserId']=_0x5f3bd4['result'][_0x2eb4('0x12')];_0x2e40f2(_0x40739b);})[_0x2eb4('0x16')](function(_0xdeb83e){logger['error']('['+[_0x1819df[_0x2eb4('0x14')]()]+']',_0xdeb83e[_0x2eb4('0x18')]);_0x18c3c9(_0xdeb83e[_0x2eb4('0x18')]);});});}function getEndUser(_0x1b78f4,_0x26e449,_0x5578f6,_0x2380fa,_0x335fbd){return function(_0x5cbd9f){logger['info']('['+[_0x1b78f4['toUpperCase']()]+_0x2eb4('0x2b'),_0x5cbd9f);return new Promise(function(_0x1b8b2e,_0x51af3f){var _0x48305e={'method':_0x2eb4('0xd'),'uri':_0x5578f6+_0x2eb4('0x2c')+_0x5cbd9f[_0x2eb4('0x27')]+'&'+_0x2380fa+'&'+_0x335fbd,'auth':_0x26e449,'json':!![]};return rp(_0x48305e)[_0x2eb4('0xe')](function(_0x19654d){if(_0x19654d[_0x2eb4('0xf')][_0x2eb4('0x10')]>0x0){_0x5cbd9f[_0x2eb4('0x2d')]=_0x19654d[_0x2eb4('0xf')][0x0][_0x2eb4('0x12')];logger[_0x2eb4('0x13')]('['+[_0x1b78f4[_0x2eb4('0x14')]()]+_0x2eb4('0x2e'),_0x5cbd9f);_0x1b8b2e(_0x5cbd9f);}else{return createEndUser(_0x1b78f4,_0x26e449,_0x5cbd9f,_0x5578f6,_0x2380fa)[_0x2eb4('0xe')](function(_0x5d9c5b){logger[_0x2eb4('0x13')]('['+[_0x1b78f4['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x5d9c5b);_0x1b8b2e(_0x5d9c5b);});}})[_0x2eb4('0x16')](function(_0x20ef98){logger['error']('['+[_0x1b78f4[_0x2eb4('0x14')]()]+']',_0x20ef98['message']);_0x51af3f(_0x20ef98[_0x2eb4('0x18')]);});});};}function getCustomFields(_0x21e281,_0x2f42ee){var _0xf3a85={};if(_0x21e281['length']>0x0){_['forEach'](_0x21e281,function(_0x10c605){if(_[_0x2eb4('0x2f')]([_0x2eb4('0x30'),_0x2eb4('0x31')],_0x10c605[_0x2eb4('0x32')])&&_0x10c605[_0x2eb4('0x33')]&&!_0x10c605['customField']){_0xf3a85[_0x10c605[_0x2eb4('0x33')]['toLowerCase']()]=_0x10c605[_0x2eb4('0x34')][_0x2eb4('0x35')]();}else if(_[_0x2eb4('0x2f')]([_0x2eb4('0x30'),_0x2eb4('0x31')],_0x10c605[_0x2eb4('0x32')])&&_0x10c605['idField']&&_0x10c605['customField']){_0xf3a85[_0x10c605[_0x2eb4('0x36')][_0x2eb4('0x37')]()]=_0x10c605[_0x2eb4('0x34')][_0x2eb4('0x35')]();}else if(_0x10c605[_0x2eb4('0x32')]===_0x2eb4('0x38')&&_0x10c605[_0x2eb4('0x39')]&&_0x10c605[_0x2eb4('0x36')]&&_0x10c605[_0x2eb4('0x3a')]){_0xf3a85[_0x10c605[_0x2eb4('0x36')]['toLowerCase']()]=_0x2f42ee[_0x10c605[_0x2eb4('0x39')]][_0x2eb4('0x35')]();}else if(_0x10c605[_0x2eb4('0x32')]===_0x2eb4('0x3b')&&_0x10c605[_0x2eb4('0x3c')]&&_0x10c605['Variable'][_0x2eb4('0x3d')]&&_0x10c605['idField']&&_0x10c605[_0x2eb4('0x3a')]){_0xf3a85[_0x10c605[_0x2eb4('0x36')][_0x2eb4('0x37')]()]=_0x2f42ee[_0x10c605[_0x2eb4('0x3c')][_0x2eb4('0x3d')][_0x2eb4('0x37')]()]['toString']();}});}return _0xf3a85;}function getTicket(_0x3d8066,_0x320f85,_0x1920d2,_0x13986a,_0x58cf9e,_0x573cd7){return function(_0x2dcba3){logger['info']('['+[_0x3d8066[_0x2eb4('0x14')]()]+_0x2eb4('0x3e'),_0x2dcba3);return new Promise(function(_0x397c0c,_0x3c7210){var _0x165f24=_0x3d8066[_0x2eb4('0x37')]()===_0x2eb4('0x3f')?_0x2dcba3['userId']:_0x2dcba3['endUserId'];var _0x18e069={'method':_0x2eb4('0x25'),'uri':_0x1920d2+_0x2eb4('0x40')+'?'+_0x573cd7,'body':Object['assign']({},{'active':_0x2eb4('0x20'),'caller_id':_0x165f24,'assigned_to':_0x2dcba3[_0x2eb4('0x21')],'short_description':intUtil['getString'](_0x13986a[_0x2eb4('0x41')],_0x58cf9e,'\x20'),'description':intUtil['getString'](_0x13986a[_0x2eb4('0x42')],_0x58cf9e,'\x0a')},getCustomFields(_0x13986a[_0x2eb4('0x43')],_0x58cf9e)),'auth':_0x320f85,'json':!![]};return rp(_0x18e069)[_0x2eb4('0xe')](function(_0x377c99){logger[_0x2eb4('0x13')]('['+[_0x3d8066[_0x2eb4('0x14')]()]+_0x2eb4('0x44'),_0x377c99['result']);_0x2dcba3[_0x2eb4('0x45')]=_0x377c99['result'][_0x2eb4('0x12')];_0x2dcba3[_0x2eb4('0x46')]=_0x377c99['result']['number'];logger['info']('['+[_0x3d8066[_0x2eb4('0x14')]()]+_0x2eb4('0x47'),_0x2dcba3);_0x397c0c(_0x2dcba3);})[_0x2eb4('0x16')](function(_0x403e43){logger[_0x2eb4('0x17')]('['+[_0x3d8066[_0x2eb4('0x14')]()]+']',_0x403e43['message']);_0x3c7210(_0x403e43[_0x2eb4('0x18')]);});});};}function createRemoteTag(_0x32e9d2,_0x436608,_0x367d2f,_0x1bfd57){return new Promise(function(_0x4a245a,_0x1ffc31){var _0x59fb98={'method':_0x2eb4('0x25'),'uri':_0x367d2f+_0x2eb4('0x48')+'?'+_0x1bfd57,'body':{'short_description':_0x32e9d2,'global':!![],'active':!![],'name':_0x32e9d2},'auth':_0x436608,'json':!![]};return rp(_0x59fb98)[_0x2eb4('0xe')](function(_0x84b5){var _0x1740e4=_0x84b5[_0x2eb4('0xf')][_0x2eb4('0x12')];_0x4a245a(_0x1740e4);});});}function getRemoteTag(_0x40bbe8,_0x110edd,_0x4b5212,_0x13950f,_0x593127){return new Promise(function(_0x173118,_0xe27a81){var _0x27ae8f={'method':'GET','uri':_0x4b5212+_0x2eb4('0x48')+_0x2eb4('0x49')+_0x40bbe8+'&'+_0x13950f,'auth':_0x110edd,'json':!![]};return rp(_0x27ae8f)['then'](function(_0x5f379c){if(_0x5f379c[_0x2eb4('0xf')][_0x2eb4('0x10')]>0x0){var _0xc37630=_0x5f379c[_0x2eb4('0xf')][0x0][_0x2eb4('0x12')];_0x173118(_0xc37630);}else{return createRemoteTag(_0x40bbe8,_0x110edd,_0x4b5212,_0x13950f)[_0x2eb4('0xe')](function(_0x3cd710){_0x173118(_0x3cd710);});}});});}function assignTagToIncident(_0x5bf640,_0x4fba01,_0x57e2f8,_0x5f0abf,_0x2da6f4){return new Promise(function(_0x56731b,_0x34c876){var _0x5eacbc={'method':_0x2eb4('0x25'),'uri':_0x57e2f8+_0x2eb4('0x4a')+'?'+_0x2da6f4,'body':{'label':_0x5bf640,'table':_0x2eb4('0x40'),'id_type':_0x2eb4('0x4b'),'table_key':_0x5f0abf[_0x2eb4('0x45')],'title':'Incident\x20-\x20'+_0x5f0abf[_0x2eb4('0x46')],'id_display':_0x5f0abf[_0x2eb4('0x46')]},'auth':_0x4fba01,'json':!![]};return rp(_0x5eacbc)[_0x2eb4('0xe')](function(_0x369ead){_0x56731b();})['catch'](function(){_0x56731b();});});}function manageTags(_0x2fd418,_0x5051b0,_0x181049,_0x1713a7,_0x4ff61c,_0x3c33f0,_0x1851f7){return new Promise(function(_0x598d96,_0x2a00eb){var _0x948772=[];_0x5051b0['forEach'](function(_0x126fbb){_0x948772[_0x2eb4('0x4c')](getRemoteTag(_0x126fbb,_0x181049,_0x1713a7,_0x3c33f0,_0x1851f7));});return Promise[_0x2eb4('0x4d')](_0x948772)[_0x2eb4('0xe')](function(_0x5544d5){if(_0x5544d5[_0x2eb4('0x10')]){logger[_0x2eb4('0x13')]('['+[_0x2fd418[_0x2eb4('0x14')]()]+_0x2eb4('0x4e'),_0x5544d5);var _0x20d251=[];_0x5544d5[_0x2eb4('0x4f')](function(_0x48ac1e){_0x20d251[_0x2eb4('0x4c')](assignTagToIncident(_0x48ac1e,_0x181049,_0x1713a7,_0x4ff61c,_0x3c33f0));});return Promise[_0x2eb4('0x4d')](_0x20d251)['then'](function(){_0x598d96();})[_0x2eb4('0x16')](function(){_0x598d96();});}else{_0x598d96();}});});}function getTags(_0x22e92c,_0x406abc,_0x2c8d9d,_0x19994e,_0x1d53e1,_0x4aed5b){return function(_0x3ca8a0){return new Promise(function(_0x125734,_0x58567b){var _0x215481=[];var _0x27cc0b=_0x19994e[_0x2eb4('0x50')];if(_0x27cc0b&&_0x27cc0b['length']>0x0){_0x215481=_[_0x2eb4('0x51')](_0x27cc0b,'name');}if(_0x215481[_0x2eb4('0x10')]>0x0){return manageTags(_0x22e92c,_0x215481,_0x406abc,_0x2c8d9d,_0x3ca8a0,_0x1d53e1,_0x4aed5b)[_0x2eb4('0xe')](function(){_0x125734(_0x3ca8a0);});}else{_0x125734(_0x3ca8a0);}});};}function emit(_0x4e1c2f,_0x13b386,_0x15253e){var _0x51c283=_0x2eb4('0x52')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x2eb4('0x53')+'%255EORDERBYDESCnumber';var _0x36ed5c={'uri':_0x4e1c2f+_0x2eb4('0x54')+_0x15253e+_0x51c283};io['to'](util[_0x2eb4('0x55')](_0x2eb4('0x56'),_0x13b386))[_0x2eb4('0x57')]('trigger:browser:url',_0x36ed5c);}exports['cs']=function(_0x119d3d,_0x28bbe8,_0x21ecaa,_0x25cded,_0x1aa62a,_0x3d5729,_0x1b7fb5,_0x3b014a){var _0x4dbdc5={};var _0x427b16={'user':_0x3d5729[_0x2eb4('0x58')],'pass':_0x3d5729['password']};var _0x35d335=_0x2eb4('0x59');var _0x102981=_0x2eb4('0x5a');_0x3d5729[_0x2eb4('0x5b')]=intUtil[_0x2eb4('0x5c')](_0x3d5729[_0x2eb4('0x5b')]);_0x3d5729[_0x2eb4('0x5d')]=intUtil[_0x2eb4('0x5c')](_0x3d5729[_0x2eb4('0x5d')]);var _0x26445e=util[_0x2eb4('0x55')](_0x2eb4('0x5e'),_0x3d5729['remoteUri']);_0x4dbdc5['userEmail']=!_[_0x2eb4('0x5f')](_0x25cded)?_0x25cded[_0x2eb4('0x60')]:null;_0x4dbdc5['adminEmail']=_0x3d5729[_0x2eb4('0x60')];_0x4dbdc5['endUserNumber']=_0x3b014a[_0x2eb4('0x37')]()===_0x2eb4('0x3f')?_0x28bbe8['destcalleridnum']:_0x28bbe8[_0x2eb4('0x61')];_0x4dbdc5[_0x2eb4('0x62')]=_0x3b014a===_0x2eb4('0x63')||_0x3b014a==='unmanaged'?_0x2eb4('0x63'):_0x2eb4('0x3f');var _0x1f82ea=util['format'](_0x2eb4('0x64'),_0x3d5729[_0x2eb4('0x5d')],_0x28bbe8[_0x2eb4('0x65')],md5(_0x28bbe8[_0x2eb4('0x65')]));if(_0x1aa62a&&_0x1aa62a['monitor_format']){logger[_0x2eb4('0x13')](_0x2eb4('0x66'),_0x2eb4('0x67'));_0x28bbe8[_0x2eb4('0x68')]=_0x1f82ea;}else if(_0x1b7fb5&&_0x1b7fb5[_0x2eb4('0x69')]&&_0x1b7fb5[_0x2eb4('0x69')]!==_0x2eb4('0x6a')){logger[_0x2eb4('0x13')](_0x2eb4('0x6b'),_0x2eb4('0x67'));_0x28bbe8[_0x2eb4('0x68')]=_0x1f82ea;}else{_0x28bbe8[_0x2eb4('0x68')]='';}return getAdminUser(_0x3b014a,_0x427b16,_0x4dbdc5,_0x26445e,_0x102981,_0x35d335)[_0x2eb4('0xe')](getUser(_0x3b014a,_0x427b16,_0x26445e,_0x102981,_0x35d335))[_0x2eb4('0xe')](getEndUser(_0x3b014a,_0x427b16,_0x26445e,_0x102981,_0x35d335))['then'](getTicket(_0x3b014a,_0x427b16,_0x26445e,_0x21ecaa,_0x28bbe8,_0x102981))[_0x2eb4('0xe')](function(_0x4ecd9f){logger[_0x2eb4('0x13')](util['format'](_0x2eb4('0x6c'),_0x4ecd9f[_0x2eb4('0x45')]));logger[_0x2eb4('0x13')](util[_0x2eb4('0x55')](_0x2eb4('0x6d'),_0x3b014a));if(_0x3b014a!==_0x2eb4('0x6e')){logger[_0x2eb4('0x13')]('['+[_0x3b014a[_0x2eb4('0x14')]()]+']',_0x2eb4('0x6f'));emit(_0x3d5729[_0x2eb4('0x5b')],_0x25cded[_0x2eb4('0x3d')],_0x4ecd9f[_0x2eb4('0x45')]);}})[_0x2eb4('0x16')](function(_0x469299){logger[_0x2eb4('0x17')]('['+[_0x3b014a['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x469299,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9d28=['recordingURL','recordingFormat','none','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','servicenow','defaults','socket.io-emitter','redis','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','active','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','name','Variable',']\x20getTicket\x20input\x20crm','outbound','assign','true','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','POST','label_entry','incident','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x9d28,0xd6));var _0x89d2=function(_0x54f253,_0x13acb1){_0x54f253=_0x54f253-0x0;var _0x207e8d=_0x9d28[_0x54f253];return _0x207e8d;};'use strict';var _=require(_0x89d2('0x0'));var Promise=require(_0x89d2('0x1'));var rp=require(_0x89d2('0x2'));var util=require(_0x89d2('0x3'));var md5=require('md5');var Redis=require(_0x89d2('0x4'));var intUtil=require(_0x89d2('0x5'));var config=require(_0x89d2('0x6'));var logger=require('../../../../config/logger')(_0x89d2('0x7'));config['redis']=_[_0x89d2('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x89d2('0x9'))(new Redis(config[_0x89d2('0xa')]));function getAdminUser(_0x55ee14,_0x3e21d6,_0x211b0a,_0x2cc8fe,_0x6093bc,_0x3495cf){return new Promise(function(_0x4628da,_0x58f22f){var _0x310d2d={'method':'GET','uri':_0x2cc8fe+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x6093bc+'&'+_0x3495cf,'auth':_0x3e21d6,'json':!![]};return rp(_0x310d2d)[_0x89d2('0xb')](function(_0x5de029){if(_0x5de029[_0x89d2('0xc')][_0x89d2('0xd')]>0x0){_0x211b0a[_0x89d2('0xe')]=_0x5de029[_0x89d2('0xc')][0x0][_0x89d2('0xf')];}logger['info']('['+[_0x55ee14[_0x89d2('0x10')]()]+_0x89d2('0x11'),_0x211b0a);_0x4628da(_0x211b0a);})[_0x89d2('0x12')](function(_0x1a129a){logger['error']('['+[_0x55ee14[_0x89d2('0x10')]()]+']',_0x1a129a[_0x89d2('0x13')]);_0x58f22f(_0x1a129a[_0x89d2('0x13')]);});});}function getUser(_0x167e14,_0x4c2c1d,_0x28c16e,_0x50935a,_0x120f31){return function(_0x46012f){logger[_0x89d2('0x14')]('['+[_0x167e14[_0x89d2('0x10')]()]+_0x89d2('0x15'),_0x46012f);return new Promise(function(_0x4ec4d5,_0x1e729b){if(intUtil[_0x89d2('0x16')](_0x46012f[_0x89d2('0x17')])){var _0x9f00d4={'method':_0x89d2('0x18'),'uri':_0x28c16e+_0x89d2('0x19')+_0x46012f[_0x89d2('0x17')]+'&'+_0x50935a+'&'+_0x120f31,'auth':_0x4c2c1d,'json':!![]};logger[_0x89d2('0x14')]('['+[_0x167e14[_0x89d2('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x9f00d4);return rp(_0x9f00d4)['then'](function(_0x1e6ab2){logger[_0x89d2('0x14')]('['+[_0x167e14[_0x89d2('0x10')]()]+'],\x20getUser\x20entity',_0x1e6ab2);if(_0x1e6ab2['result'][_0x89d2('0xd')]>0x0&&String(_0x1e6ab2[_0x89d2('0xc')][0x0][_0x89d2('0x1a')])==='true'){_0x46012f['userId']=_0x1e6ab2['result'][0x0][_0x89d2('0xf')];}else{_0x46012f[_0x89d2('0x1b')]=_0x46012f[_0x89d2('0xe')];_0x46012f['userEmail']=_0x46012f[_0x89d2('0x1c')];}logger[_0x89d2('0x14')]('['+[_0x167e14['toUpperCase']()]+_0x89d2('0x1d'),_0x46012f);_0x4ec4d5(_0x46012f);})[_0x89d2('0x12')](function(_0x502dde){logger[_0x89d2('0x1e')]('['+[_0x167e14[_0x89d2('0x10')]()]+']',_0x502dde[_0x89d2('0x13')]);_0x1e729b(_0x502dde[_0x89d2('0x13')]);});}else{logger['info']('['+[_0x167e14[_0x89d2('0x10')]()]+_0x89d2('0x1f'));_0x46012f['userId']=_0x46012f[_0x89d2('0xe')];_0x46012f[_0x89d2('0x17')]=_0x46012f['adminEmail'];_0x4ec4d5(_0x46012f);}});};}function createEndUser(_0x287a2d,_0x407820,_0x181bcb,_0xfdeaea,_0x34c8bd){logger[_0x89d2('0x14')]('['+[_0x287a2d[_0x89d2('0x10')]()]+_0x89d2('0x20'),_0x181bcb);return new Promise(function(_0x1385b2,_0x27aed9){var _0x18cd2c={'method':'POST','uri':_0xfdeaea+_0x89d2('0x21')+_0x34c8bd,'body':{'user_name':_0x181bcb['endUserNumber'],'roles':_0x89d2('0x22'),'first_name':_0x181bcb['endUserNumber'],'active':'true','date_format':_0x89d2('0x23'),'phone':_0x181bcb[_0x89d2('0x24')]},'auth':_0x407820,'json':!![]};return rp(_0x18cd2c)[_0x89d2('0xb')](function(_0x503c78){logger['info']('['+[_0x287a2d[_0x89d2('0x10')]()]+_0x89d2('0x25'),_0x503c78[_0x89d2('0xc')]);_0x181bcb['endUserId']=_0x503c78[_0x89d2('0xc')][_0x89d2('0xf')];_0x1385b2(_0x181bcb);})[_0x89d2('0x12')](function(_0x4518f4){logger[_0x89d2('0x1e')]('['+[_0x287a2d[_0x89d2('0x10')]()]+']',_0x4518f4['message']);_0x27aed9(_0x4518f4[_0x89d2('0x13')]);});});}function getEndUser(_0x4a7c7,_0x459550,_0xd5f425,_0x341364,_0x40949b){return function(_0x514a62){logger[_0x89d2('0x14')]('['+[_0x4a7c7[_0x89d2('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x514a62);return new Promise(function(_0xa6f4da,_0x2d6b2b){var _0xa12c83={'method':_0x89d2('0x18'),'uri':_0xd5f425+_0x89d2('0x26')+_0x514a62['endUserNumber']+'&'+_0x341364+'&'+_0x40949b,'auth':_0x459550,'json':!![]};return rp(_0xa12c83)[_0x89d2('0xb')](function(_0x2b4376){if(_0x2b4376[_0x89d2('0xc')][_0x89d2('0xd')]>0x0){_0x514a62[_0x89d2('0x27')]=_0x2b4376[_0x89d2('0xc')][0x0][_0x89d2('0xf')];logger[_0x89d2('0x14')]('['+[_0x4a7c7['toUpperCase']()]+_0x89d2('0x28'),_0x514a62);_0xa6f4da(_0x514a62);}else{return createEndUser(_0x4a7c7,_0x459550,_0x514a62,_0xd5f425,_0x341364)[_0x89d2('0xb')](function(_0x2dc877){logger[_0x89d2('0x14')]('['+[_0x4a7c7[_0x89d2('0x10')]()]+'],\x20createEndUser\x20crm',_0x2dc877);_0xa6f4da(_0x2dc877);});}})[_0x89d2('0x12')](function(_0x40ece2){logger[_0x89d2('0x1e')]('['+[_0x4a7c7[_0x89d2('0x10')]()]+']',_0x40ece2[_0x89d2('0x13')]);_0x2d6b2b(_0x40ece2[_0x89d2('0x13')]);});});};}function getCustomFields(_0x4a843b,_0x5c5fe6){var _0xce1261={};if(_0x4a843b[_0x89d2('0xd')]>0x0){_[_0x89d2('0x29')](_0x4a843b,function(_0x5c6b1c){if(_['includes'](['string','picklist'],_0x5c6b1c[_0x89d2('0x2a')])&&_0x5c6b1c[_0x89d2('0x2b')]&&!_0x5c6b1c[_0x89d2('0x2c')]){_0xce1261[_0x5c6b1c[_0x89d2('0x2b')][_0x89d2('0x2d')]()]=_0x5c6b1c[_0x89d2('0x2e')][_0x89d2('0x2f')]();}else if(_['includes']([_0x89d2('0x30'),'picklist'],_0x5c6b1c[_0x89d2('0x2a')])&&_0x5c6b1c[_0x89d2('0x31')]&&_0x5c6b1c[_0x89d2('0x2c')]){_0xce1261[_0x5c6b1c[_0x89d2('0x31')]['toLowerCase']()]=_0x5c6b1c[_0x89d2('0x2e')]['toString']();}else if(_0x5c6b1c[_0x89d2('0x2a')]===_0x89d2('0x32')&&_0x5c6b1c[_0x89d2('0x33')]&&_0x5c6b1c[_0x89d2('0x31')]&&_0x5c6b1c[_0x89d2('0x2c')]){_0xce1261[_0x5c6b1c['idField'][_0x89d2('0x2d')]()]=_0x5c5fe6[_0x5c6b1c[_0x89d2('0x33')]][_0x89d2('0x2f')]();}else if(_0x5c6b1c[_0x89d2('0x2a')]==='customVariable'&&_0x5c6b1c['Variable']&&_0x5c6b1c['Variable'][_0x89d2('0x34')]&&_0x5c6b1c[_0x89d2('0x31')]&&_0x5c6b1c[_0x89d2('0x2c')]){_0xce1261[_0x5c6b1c[_0x89d2('0x31')][_0x89d2('0x2d')]()]=_0x5c5fe6[_0x5c6b1c[_0x89d2('0x35')][_0x89d2('0x34')]['toLowerCase']()]['toString']();}});}return _0xce1261;}function getTicket(_0x11585f,_0x2c9c56,_0x3ca04e,_0x5b59c3,_0x2b4652,_0x552e08){return function(_0x19d44a){logger[_0x89d2('0x14')]('['+[_0x11585f[_0x89d2('0x10')]()]+_0x89d2('0x36'),_0x19d44a);return new Promise(function(_0x174060,_0x3fdbed){var _0x33bfcf=_0x11585f[_0x89d2('0x2d')]()===_0x89d2('0x37')?_0x19d44a[_0x89d2('0x1b')]:_0x19d44a[_0x89d2('0x27')];var _0x54f694={'method':'POST','uri':_0x3ca04e+'incident'+'?'+_0x552e08,'body':Object[_0x89d2('0x38')]({},{'active':_0x89d2('0x39'),'caller_id':_0x33bfcf,'assigned_to':_0x19d44a['userId'],'short_description':intUtil[_0x89d2('0x3a')](_0x5b59c3[_0x89d2('0x3b')],_0x2b4652,'\x20'),'description':intUtil[_0x89d2('0x3a')](_0x5b59c3[_0x89d2('0x3c')],_0x2b4652,'\x0a')},getCustomFields(_0x5b59c3['Fields'],_0x2b4652)),'auth':_0x2c9c56,'json':!![]};return rp(_0x54f694)['then'](function(_0x53d45e){logger[_0x89d2('0x14')]('['+[_0x11585f[_0x89d2('0x10')]()]+_0x89d2('0x3d'),_0x53d45e[_0x89d2('0xc')]);_0x19d44a[_0x89d2('0x3e')]=_0x53d45e[_0x89d2('0xc')][_0x89d2('0xf')];_0x19d44a['ticketNumber']=_0x53d45e[_0x89d2('0xc')][_0x89d2('0x3f')];logger['info']('['+[_0x11585f[_0x89d2('0x10')]()]+_0x89d2('0x40'),_0x19d44a);_0x174060(_0x19d44a);})[_0x89d2('0x12')](function(_0x2b3fb4){logger[_0x89d2('0x1e')]('['+[_0x11585f['toUpperCase']()]+']',_0x2b3fb4[_0x89d2('0x13')]);_0x3fdbed(_0x2b3fb4[_0x89d2('0x13')]);});});};}function createRemoteTag(_0x3d9f2b,_0xed0c50,_0x5c0be1,_0x227dd4){return new Promise(function(_0x4dc68c,_0x34e5fd){var _0x4bad3b={'method':_0x89d2('0x41'),'uri':_0x5c0be1+'label'+'?'+_0x227dd4,'body':{'short_description':_0x3d9f2b,'global':!![],'active':!![],'name':_0x3d9f2b},'auth':_0xed0c50,'json':!![]};return rp(_0x4bad3b)[_0x89d2('0xb')](function(_0x469720){var _0x468748=_0x469720['result'][_0x89d2('0xf')];_0x4dc68c(_0x468748);});});}function getRemoteTag(_0x59aba3,_0x5c81a1,_0x25ae91,_0x1e5f23,_0x1dcb94){return new Promise(function(_0x3fb687,_0x451cd5){var _0x3b6053={'method':_0x89d2('0x18'),'uri':_0x25ae91+'label'+'?sysparm_query=name%3D'+_0x59aba3+'&'+_0x1e5f23,'auth':_0x5c81a1,'json':!![]};return rp(_0x3b6053)[_0x89d2('0xb')](function(_0x4e4b68){if(_0x4e4b68[_0x89d2('0xc')][_0x89d2('0xd')]>0x0){var _0x443718=_0x4e4b68[_0x89d2('0xc')][0x0][_0x89d2('0xf')];_0x3fb687(_0x443718);}else{return createRemoteTag(_0x59aba3,_0x5c81a1,_0x25ae91,_0x1e5f23)[_0x89d2('0xb')](function(_0x1be056){_0x3fb687(_0x1be056);});}});});}function assignTagToIncident(_0x1316bd,_0x1f61c7,_0x3c26ae,_0x33bcc3,_0x2a7a57){return new Promise(function(_0x203dab,_0x9150c0){var _0x2b15ba={'method':_0x89d2('0x41'),'uri':_0x3c26ae+_0x89d2('0x42')+'?'+_0x2a7a57,'body':{'label':_0x1316bd,'table':_0x89d2('0x43'),'id_type':'Incident','table_key':_0x33bcc3[_0x89d2('0x3e')],'title':_0x89d2('0x44')+_0x33bcc3[_0x89d2('0x45')],'id_display':_0x33bcc3[_0x89d2('0x45')]},'auth':_0x1f61c7,'json':!![]};return rp(_0x2b15ba)[_0x89d2('0xb')](function(_0x4a8836){_0x203dab();})[_0x89d2('0x12')](function(){_0x203dab();});});}function manageTags(_0xf8e3fc,_0x363154,_0x96ed26,_0x586663,_0x453bac,_0x444e8f,_0x576d8b){return new Promise(function(_0x480051,_0x2095f5){var _0x2c8d23=[];_0x363154['forEach'](function(_0x3f78d0){_0x2c8d23[_0x89d2('0x46')](getRemoteTag(_0x3f78d0,_0x96ed26,_0x586663,_0x444e8f,_0x576d8b));});return Promise[_0x89d2('0x47')](_0x2c8d23)['then'](function(_0x3c25b1){if(_0x3c25b1[_0x89d2('0xd')]){logger[_0x89d2('0x14')]('['+[_0xf8e3fc[_0x89d2('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x3c25b1);var _0x49e570=[];_0x3c25b1['forEach'](function(_0x3ffb4e){_0x49e570[_0x89d2('0x46')](assignTagToIncident(_0x3ffb4e,_0x96ed26,_0x586663,_0x453bac,_0x444e8f));});return Promise[_0x89d2('0x47')](_0x49e570)['then'](function(){_0x480051();})[_0x89d2('0x12')](function(){_0x480051();});}else{_0x480051();}});});}function getTags(_0x4afc59,_0xb7f8fc,_0x158016,_0x3f8799,_0x5ab447,_0x2b9b19){return function(_0xbcc527){return new Promise(function(_0x3cffec,_0x1da44e){var _0x49837f=[];var _0x1ede22=_0x3f8799[_0x89d2('0x48')];if(_0x1ede22&&_0x1ede22[_0x89d2('0xd')]>0x0){_0x49837f=_[_0x89d2('0x49')](_0x1ede22,_0x89d2('0x34'));}if(_0x49837f[_0x89d2('0xd')]>0x0){return manageTags(_0x4afc59,_0x49837f,_0xb7f8fc,_0x158016,_0xbcc527,_0x5ab447,_0x2b9b19)[_0x89d2('0xb')](function(){_0x3cffec(_0xbcc527);});}else{_0x3cffec(_0xbcc527);}});};}function emit(_0x4f0a08,_0x3548eb,_0x5775aa){var _0x3e65a2='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x89d2('0x4a')+_0x89d2('0x4b');var _0x1a3f43={'uri':_0x4f0a08+_0x89d2('0x4c')+_0x5775aa+_0x3e65a2};io['to'](util[_0x89d2('0x4d')](_0x89d2('0x4e'),_0x3548eb))[_0x89d2('0x4f')]('trigger:browser:url',_0x1a3f43);}exports['cs']=function(_0x1a6b27,_0xb4a31f,_0x51bc76,_0x5a2482,_0x1d3218,_0x363e0d,_0x1ee593,_0x8c11f8){var _0x782e90={};var _0x43f67f={'user':_0x363e0d[_0x89d2('0x50')],'pass':_0x363e0d[_0x89d2('0x51')]};var _0x203480=_0x89d2('0x52');var _0x17b8a3=_0x89d2('0x53');_0x363e0d[_0x89d2('0x54')]=intUtil['stripTrailingSlash'](_0x363e0d['remoteUri']);_0x363e0d[_0x89d2('0x55')]=intUtil[_0x89d2('0x56')](_0x363e0d[_0x89d2('0x55')]);var _0x423025=util['format']('%s/api/now/table/',_0x363e0d[_0x89d2('0x54')]);_0x782e90[_0x89d2('0x17')]=!_[_0x89d2('0x57')](_0x5a2482)?_0x5a2482[_0x89d2('0x58')]:null;_0x782e90[_0x89d2('0x1c')]=_0x363e0d[_0x89d2('0x58')];_0x782e90[_0x89d2('0x24')]=_0x8c11f8[_0x89d2('0x2d')]()===_0x89d2('0x37')?_0xb4a31f[_0x89d2('0x59')]:_0xb4a31f[_0x89d2('0x5a')];_0x782e90['callDirection']=_0x8c11f8===_0x89d2('0x5b')||_0x8c11f8===_0x89d2('0x5c')?_0x89d2('0x5b'):_0x89d2('0x37');var _0x4b5ad6=util[_0x89d2('0x4d')](_0x89d2('0x5d'),_0x363e0d[_0x89d2('0x55')],_0xb4a31f['uniqueid'],md5(_0xb4a31f[_0x89d2('0x5e')]));if(_0x1d3218&&_0x1d3218[_0x89d2('0x5f')]){logger['info'](_0x89d2('0x60'),_0x89d2('0x61'));_0xb4a31f[_0x89d2('0x62')]=_0x4b5ad6;}else if(_0x1ee593&&_0x1ee593[_0x89d2('0x63')]&&_0x1ee593['recordingFormat']!==_0x89d2('0x64')){logger[_0x89d2('0x14')]('[OUTBOUND]',_0x89d2('0x61'));_0xb4a31f['recordingURL']=_0x4b5ad6;}else{_0xb4a31f['recordingURL']='';}return getAdminUser(_0x8c11f8,_0x43f67f,_0x782e90,_0x423025,_0x17b8a3,_0x203480)[_0x89d2('0xb')](getUser(_0x8c11f8,_0x43f67f,_0x423025,_0x17b8a3,_0x203480))[_0x89d2('0xb')](getEndUser(_0x8c11f8,_0x43f67f,_0x423025,_0x17b8a3,_0x203480))[_0x89d2('0xb')](getTicket(_0x8c11f8,_0x43f67f,_0x423025,_0x51bc76,_0xb4a31f,_0x17b8a3))[_0x89d2('0xb')](function(_0xd4907){logger[_0x89d2('0x14')](util[_0x89d2('0x4d')]('The\x20ticket\x20ID\x20is:\x20%s',_0xd4907['ticketId']));logger[_0x89d2('0x14')](util[_0x89d2('0x4d')]('call\x20direction:\x20%s',_0x8c11f8));if(_0x8c11f8!==_0x89d2('0x5c')){logger[_0x89d2('0x14')]('['+[_0x8c11f8[_0x89d2('0x10')]()]+']',_0x89d2('0x65'));emit(_0x363e0d[_0x89d2('0x54')],_0x5a2482[_0x89d2('0x34')],_0xd4907['ticketId']);}})[_0x89d2('0x12')](function(_0x1aa265){logger['error']('['+[_0x8c11f8[_0x89d2('0x10')]()]+_0x89d2('0x66'),util[_0x89d2('0x67')](_0x1aa265,{'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 85c2e2b..1ce94db 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 _0x1718=['name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','merge','map','type','string','nameField','customField','variable','Variable','toLowerCase','custom_fields','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','error','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x1718,0x1c1));var _0x8171=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1718[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8171('0x0'));var rp=require(_0x8171('0x1'));var BPromise=require(_0x8171('0x2'));var md5=require('md5');var util=require(_0x8171('0x3'));var Redis=require(_0x8171('0x4'));var intUtil=require(_0x8171('0x5'));var config=require(_0x8171('0x6'));var logger=require(_0x8171('0x7'))(_0x8171('0x8'));config[_0x8171('0x9')]=_['defaults'](config[_0x8171('0x9')],{'host':_0x8171('0xa'),'port':0x18eb});var io=require(_0x8171('0xb'))(new Redis(config['redis']));var def={'method':_0x8171('0xc'),'json':!![]};function emit(_0x3e6325,_0x3dd864,_0x2ccb21){io['to'](_0x3e6325)[_0x8171('0xd')](_0x3dd864,_0x2ccb21);}function getTicket(_0x26f881,_0x40d72d,_0x9f487e,_0x3ff694,_0x7d565a,_0x5ad6aa,_0x212a79,_0x3c34a7){logger[_0x8171('0xe')](_0x8171('0xf'));var _0x3cd9dd=new Date();var _0xd6f54c=[{'name':_0x8171('0x10'),'value':intUtil[_0x8171('0x11')](_0x3ff694[_0x8171('0x12')],_0x7d565a,'\x20')},{'name':_0x8171('0x13'),'value':_0x40d72d['id']},{'name':_0x8171('0x14'),'value':_0x40d72d['id']},{'name':_0x8171('0x15'),'value':intUtil[_0x8171('0x11')](_0x3ff694['Descriptions'],_0x7d565a,'\x0a')},{'name':_0x8171('0x16'),'value':_0x3cd9dd[_0x8171('0x17')]()[_0x8171('0x18')](0x0,0x13)[_0x8171('0x19')]('T','\x20')},{'name':_0x8171('0x1a'),'value':'0'},{'name':_0x8171('0x1b'),'value':'15'},{'name':'parent_id','value':_0x9f487e['id']},{'name':_0x8171('0x1c'),'value':_0x8171('0x1d')},{'name':_0x8171('0x1e'),'value':_0x9f487e['name']},{'name':_0x8171('0x1f'),'value':_0x3c34a7}];if(_0x5ad6aa[_0x8171('0x20')]){_[_0x8171('0x21')](_0x5ad6aa,function(_0x4800e4){if(_0x7d565a[_0x4800e4[_0x8171('0x22')]]){_0xd6f54c[_0x8171('0x23')]({'name':_0x4800e4[_0x8171('0x24')],'value':_0x7d565a[_0x4800e4[_0x8171('0x22')]]});}});}return request({'form':{'method':_0x8171('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x8171('0x26')]({'session':_0x212a79['id'],'module_name':_0x8171('0x27'),'name_value_list':_0xd6f54c})}});}function getAuth(_0x3ce1dd){return util['format'](_0x8171('0x28'),new Buffer(_0x3ce1dd[_0x8171('0x29')]+':X')[_0x8171('0x2a')](_0x8171('0x2b')));}function getServerInfo(_0x57d10a){return request({'form':{'method':_0x8171('0x2c'),'input_type':_0x8171('0x2d'),'response_type':_0x8171('0x2d'),'rest_data':JSON[_0x8171('0x26')]({'session':_0x57d10a['id']})}});}function getUser(_0x45f033,_0x5eb335,_0x5b3ab4){if(!_[_0x8171('0x2e')](_0x5eb335)){logger[_0x8171('0xe')](_0x8171('0x2f'),_0x5eb335);return request({'form':{'method':_0x8171('0x30'),'input_type':_0x8171('0x2d'),'response_type':_0x8171('0x2d'),'rest_data':JSON[_0x8171('0x26')]({'session':_0x5b3ab4['id'],'module_name':'Employees','query':util[_0x8171('0x31')](_0x8171('0x32'),_0x5eb335),'order_by':'','offset':'0','select_fields':['id',_0x8171('0x10'),_0x8171('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8171('0x34')](function(_0x37a8ef){if(_0x37a8ef[_0x8171('0x35')][_0x8171('0x20')]){var _0x449073=_[_0x8171('0x36')](_0x37a8ef[_0x8171('0x35')],function(_0x3edcc5){return _0x3edcc5[_0x8171('0x37')]['user_name'][_0x8171('0x38')]===_0x5eb335;});if(_0x449073){logger[_0x8171('0xe')](_0x8171('0x39'));return BPromise['resolve']({'id':_0x449073['name_value_list']['id'][_0x8171('0x38')],'name':_0x449073[_0x8171('0x37')][_0x8171('0x10')][_0x8171('0x38')]});}}logger[_0x8171('0xe')](_0x8171('0x3a'));return BPromise[_0x8171('0x3b')]({'id':_0x5b3ab4[_0x8171('0x37')][_0x8171('0x3c')][_0x8171('0x38')],'name':_0x5b3ab4['name_value_list'][_0x8171('0x33')][_0x8171('0x38')]});});}else{logger['info'](_0x8171('0x3d'));return BPromise[_0x8171('0x3b')]({'id':_0x5b3ab4['name_value_list'][_0x8171('0x3c')][_0x8171('0x38')],'name':_0x5b3ab4['name_value_list'][_0x8171('0x33')][_0x8171('0x38')]});}}function getEndUser(_0x22e812,_0x72213,_0x1ec8ab,_0xf89fb9){logger[_0x8171('0xe')](_0x8171('0x3e'),_0x1ec8ab);return request({'form':{'method':_0x8171('0x30'),'input_type':_0x8171('0x2d'),'response_type':'JSON','rest_data':JSON[_0x8171('0x26')]({'session':_0xf89fb9['id'],'module_name':_0x8171('0x1d'),'query':util[_0x8171('0x31')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x1ec8ab),'order_by':'','offset':'0','select_fields':['id',_0x8171('0x10'),_0x8171('0x3f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8171('0x34')](function(_0x2f4017){if(_0x2f4017['entry_list'][_0x8171('0x20')]){var _0x46f4ff=_['find'](_0x2f4017[_0x8171('0x35')],function(_0x15f3c2){return _0x15f3c2[_0x8171('0x37')][_0x8171('0x3f')][_0x8171('0x38')]===_0x1ec8ab;});if(_0x46f4ff){logger[_0x8171('0xe')](_0x8171('0x40'));return BPromise[_0x8171('0x3b')]({'id':_0x46f4ff[_0x8171('0x37')]['id'][_0x8171('0x38')],'name':_0x46f4ff[_0x8171('0x37')][_0x8171('0x10')][_0x8171('0x38')],'phone':_0x46f4ff[_0x8171('0x37')][_0x8171('0x3f')][_0x8171('0x38')]});}}else{logger[_0x8171('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x8171('0x25'),'input_type':'JSON','response_type':_0x8171('0x2d'),'rest_data':JSON[_0x8171('0x26')]({'session':_0xf89fb9['id'],'module_name':_0x8171('0x1d'),'name_value_list':[{'name':_0x8171('0x41'),'value':_0x72213!==_0x8171('0x42')?_0x72213:util[_0x8171('0x31')](_0x8171('0x43'),_0x1ec8ab)},{'name':_0x8171('0x3f'),'value':_0x1ec8ab}]})}})[_0x8171('0x34')](function(_0x4019a4){logger[_0x8171('0xe')]('Enduser\x20created.');return BPromise[_0x8171('0x3b')]({'id':_0x4019a4['id'],'name':_0x4019a4[_0x8171('0x35')][_0x8171('0x41')]['value'],'phone':_0x4019a4[_0x8171('0x35')][_0x8171('0x3f')][_0x8171('0x38')]});});}});}function request(_0x22d557){logger[_0x8171('0x44')]('[HTTP]',JSON[_0x8171('0x26')](_0x22d557));return rp(_[_0x8171('0x45')](def,_0x22d557));}function getTags(_0x5cb651,_0x10dc8a){var _0x251ae3=[];if(_0x5cb651&&_0x5cb651[_0x8171('0x20')]>0x0){_0x251ae3=_[_0x8171('0x46')](_0x5cb651,_0x10dc8a);}return _0x251ae3;}function getCustomFields(_0xdb2b88,_0x575ad1){var _0x156488=[];var _0x1b80bd={'custom_fields':[]};if(_0xdb2b88[_0x8171('0x20')]>0x0){_[_0x8171('0x21')](_0xdb2b88,function(_0x58081f){if(_0x58081f[_0x8171('0x47')]===_0x8171('0x48')&&_0x58081f[_0x8171('0x49')]&&!_0x58081f[_0x8171('0x4a')]){_0x1b80bd[_0x58081f[_0x8171('0x49')]['toLowerCase']()]=_0x58081f['content'][_0x8171('0x2a')]();}else if(_0x58081f['type']===_0x8171('0x48')&&_0x58081f[_0x8171('0x24')]&&_0x58081f[_0x8171('0x4a')]){_0x1b80bd['custom_fields']['push']({'id':_0x58081f[_0x8171('0x24')],'value':_0x58081f['content'][_0x8171('0x2a')]()});}else if(_0x58081f[_0x8171('0x47')]===_0x8171('0x4b')&&_0x58081f[_0x8171('0x22')]&&_0x58081f[_0x8171('0x24')]&&_0x58081f['customField']){_0x575ad1[_0x58081f[_0x8171('0x22')]]&&_0x1b80bd['custom_fields']['push']({'id':_0x58081f[_0x8171('0x24')],'value':_0x575ad1[_0x58081f[_0x8171('0x22')]]['toString']()});}else if(_0x58081f[_0x8171('0x47')]==='customVariable'&&_0x58081f[_0x8171('0x4c')]&&_0x58081f[_0x8171('0x4c')]['name']&&_0x58081f[_0x8171('0x24')]&&_0x58081f[_0x8171('0x4a')]){_0x575ad1[_0x58081f[_0x8171('0x4c')][_0x8171('0x10')][_0x8171('0x4d')]()]&&_0x1b80bd[_0x8171('0x4e')][_0x8171('0x23')]({'id':_0x58081f[_0x8171('0x24')],'value':_0x575ad1[_0x58081f[_0x8171('0x4c')][_0x8171('0x10')]['toLowerCase']()][_0x8171('0x2a')]()});}});}return _0x1b80bd;}function getConnection(_0x55646f){return request({'method':_0x8171('0xc'),'form':{'method':_0x8171('0x4f'),'input_type':_0x8171('0x2d'),'response_type':_0x8171('0x2d'),'rest_data':JSON[_0x8171('0x26')]({'user_auth':{'user_name':_0x55646f[_0x8171('0x50')],'password':_0x55646f[_0x8171('0x51')],'encryption':_0x8171('0x52')},'application':_0x8171('0x53')})}})[_0x8171('0x34')](function(_0xf0ca69){var _0x563cf5=_0xf0ca69;if(_0x563cf5['id']){def[_0x8171('0x54')]=_0x563cf5['id'];return BPromise[_0x8171('0x3b')](_0x563cf5);}else{throw new Error(util[_0x8171('0x31')](_0x8171('0x55'),_0x55646f['id']));}});}function setRelationship(_0x4eaca0,_0x59099e,_0x31d789,_0x37d6ef){return request({'form':{'method':_0x8171('0x56'),'input_type':_0x8171('0x2d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4eaca0['id'],'module_name':_0x8171('0x27'),'module_id':_0x31d789['id'],'link_field_name':_0x37d6ef,'related_ids':[_0x59099e['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3a6b95,_0x3e733f,_0x3b7f97,_0xa2ab01,_0x1c40e9,_0x2744be){var _0x225d93,_0x1d985b,_0x4bd81c,_0x402f1d;_0x2744be[_0x8171('0x57')]=intUtil[_0x8171('0x58')](_0x2744be[_0x8171('0x57')]);_0x2744be[_0x8171('0x59')]=intUtil['stripTrailingSlash'](_0x2744be['serverUrl']);def[_0x8171('0x5a')]=util[_0x8171('0x31')]('%s/service/v4_1/rest.php',_0x2744be[_0x8171('0x57')]);if(_0x1c40e9&&_0x1c40e9['monitor_format']){logger['info'](_0x8171('0x5b'),_0x8171('0x5c'));_0x3e733f[_0x8171('0x5d')]=util[_0x8171('0x31')](_0x8171('0x5e'),_0x2744be['serverUrl'],_0x3e733f[_0x8171('0x5f')],md5(_0x3e733f[_0x8171('0x5f')]));}else{_0x3e733f[_0x8171('0x5d')]='';}return getConnection(_0x2744be)[_0x8171('0x34')](function(_0x1593b2){_0x402f1d=_0x1593b2;return getUser(_0x2744be,_0xa2ab01['name'],_0x402f1d);})['then'](function(_0x3ce429){_0x225d93=_0x3ce429;logger[_0x8171('0xe')]('The\x20User\x20ID\x20is:',_0x225d93['id']);return getEndUser(_0x2744be,_0x3e733f['calleridname'],_0x3e733f['calleridnum'],_0x402f1d);})[_0x8171('0x34')](function(_0x50d40e){_0x1d985b=_0x50d40e;logger[_0x8171('0xe')](_0x8171('0x60'),_0x1d985b['id']);return getTicket(_0x2744be,_0x225d93,_0x1d985b,_0x3b7f97,_0x3e733f,_0x3b7f97[_0x8171('0x61')],_0x402f1d,_0x8171('0x62'));})[_0x8171('0x34')](function(_0x1e27ee){_0x4bd81c=_0x1e27ee;logger['info'](_0x8171('0x63'));logger[_0x8171('0xe')](_0x8171('0x64'),_0x4bd81c['id']);return setRelationship(_0x402f1d,_0x225d93,_0x4bd81c,_0x8171('0x65'));})['then'](function(){return setRelationship(_0x402f1d,_0x1d985b,_0x4bd81c,_0x8171('0x66'));})[_0x8171('0x34')](function(){return getServerInfo(_0x402f1d);})[_0x8171('0x34')](function(_0x106e2c){var _0x50cf73=parseInt(_0x106e2c[_0x8171('0x67')][_0x8171('0x68')](0x0));var _0x24734e=util[_0x8171('0x31')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2744be[_0x8171('0x57')],_0x4bd81c['id']);if(_0x50cf73>0x6){_0x24734e=util[_0x8171('0x31')](_0x8171('0x69'),_0x2744be[_0x8171('0x57')],_0x4bd81c['id']);}logger[_0x8171('0xe')](_0x8171('0x5b'),_0x8171('0x6a'));emit(util[_0x8171('0x31')](_0x8171('0x6b'),_0xa2ab01[_0x8171('0x10')]),_0x8171('0x6c'),{'uri':_0x24734e});})[_0x8171('0x6d')](function(_0x374b20){logger['error']('[QUEUE]',JSON[_0x8171('0x26')](_0x374b20));});};exports[_0x8171('0x6e')]=function(_0x19cbb6,_0x36ca43,_0x516365,_0x552e3f,_0xd64910,_0x1dc181,_0xc8e69e){var _0xbccba0,_0x334a60,_0x19051d,_0x117756;_0x1dc181[_0x8171('0x57')]=intUtil[_0x8171('0x58')](_0x1dc181[_0x8171('0x57')]);_0x1dc181[_0x8171('0x59')]=intUtil[_0x8171('0x58')](_0x1dc181[_0x8171('0x59')]);def[_0x8171('0x5a')]=util['format'](_0x8171('0x6f'),_0x1dc181[_0x8171('0x57')]);if(_0xc8e69e&&_0xc8e69e[_0x8171('0x70')]&&_0xc8e69e[_0x8171('0x70')]!==_0x8171('0x71')){logger[_0x8171('0xe')](_0x8171('0x72'),_0x8171('0x5c'));_0x36ca43[_0x8171('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1dc181['serverUrl'],_0x36ca43[_0x8171('0x5f')],md5(_0x36ca43[_0x8171('0x5f')]));}return getConnection(_0x1dc181)[_0x8171('0x34')](function(_0x271620){_0x117756=_0x271620;return getUser(_0x1dc181,_0x552e3f['name'],_0x117756);})['then'](function(_0x577b6c){_0xbccba0=_0x577b6c;logger[_0x8171('0xe')](_0x8171('0x73'),_0xbccba0['id']);return getEndUser(_0x1dc181,_0x36ca43[_0x8171('0x74')],_0x36ca43[_0x8171('0x75')],_0x117756);})['then'](function(_0x2a72eb){_0x334a60=_0x2a72eb;logger[_0x8171('0xe')]('The\x20Enduser\x20ID\x20is:',_0x334a60['id']);return getTicket(_0x1dc181,_0xbccba0,_0x334a60,_0x516365,_0x36ca43,_0x516365[_0x8171('0x61')],_0x117756,_0x8171('0x76'));})[_0x8171('0x34')](function(_0x4d5196){_0x19051d=_0x4d5196;logger[_0x8171('0xe')](_0x8171('0x63'));logger[_0x8171('0xe')](_0x8171('0x64'),_0x19051d['id']);return setRelationship(_0x117756,_0xbccba0,_0x19051d,'users');})[_0x8171('0x34')](function(){return setRelationship(_0x117756,_0x334a60,_0x19051d,'contacts');})['then'](function(){return getServerInfo(_0x117756);})[_0x8171('0x34')](function(_0xa136ac){var _0x568f96=parseInt(_0xa136ac[_0x8171('0x67')][_0x8171('0x68')](0x0));var _0x34def4=util[_0x8171('0x31')](_0x8171('0x77'),_0x1dc181['remoteUri'],_0x19051d['id']);if(_0x568f96>0x6){_0x34def4=util['format'](_0x8171('0x69'),_0x1dc181['remoteUri'],_0x19051d['id']);}logger[_0x8171('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8171('0x31')](_0x8171('0x6b'),_0x552e3f['name']),_0x8171('0x6c'),{'uri':_0x34def4});})['catch'](function(_0x4c411c){logger[_0x8171('0x78')](_0x8171('0x72'),JSON[_0x8171('0x26')](_0x4c411c));});};exports[_0x8171('0x79')]=function(_0xeb5ba9,_0xff1c53,_0x1a14c6,_0x2e8a45,_0x252076,_0x1bbd0a){var _0x2da4cb,_0x3f9b5f,_0x5ed4e3,_0xd5859f;_0x1bbd0a[_0x8171('0x57')]=intUtil[_0x8171('0x58')](_0x1bbd0a[_0x8171('0x57')]);_0x1bbd0a[_0x8171('0x59')]=intUtil['stripTrailingSlash'](_0x1bbd0a[_0x8171('0x59')]);def[_0x8171('0x5a')]=util[_0x8171('0x31')](_0x8171('0x6f'),_0x1bbd0a['remoteUri']);if(_0x252076&&_0x252076[_0x8171('0x7a')]){logger[_0x8171('0xe')]('['+_0xff1c53[_0x8171('0x7b')][_0x8171('0x7c')]()+']',_0x8171('0x5c'));_0xff1c53[_0x8171('0x5d')]=util['format'](_0x8171('0x5e'),_0x1bbd0a[_0x8171('0x59')],_0xff1c53[_0x8171('0x5f')],md5(_0xff1c53['uniqueid']));}else{_0xff1c53['recordingURL']='';}return getConnection(_0x1bbd0a)[_0x8171('0x34')](function(_0x240cf5){_0xd5859f=_0x240cf5;if(!_['isNil'](_0x2e8a45)){return getUser(_0x1bbd0a,_0x2e8a45[_0x8171('0x10')],_0xd5859f);}else{return getUser(_0x1bbd0a,null,_0xd5859f);}})[_0x8171('0x34')](function(_0x385a71){_0x2da4cb=_0x385a71;logger[_0x8171('0xe')]('The\x20User\x20ID\x20is:',_0x2da4cb['id']);return getEndUser(_0x1bbd0a,_0xff1c53[_0x8171('0x7d')],_0xff1c53['calleridnum'],_0xd5859f);})['then'](function(_0x59bd11){_0x3f9b5f=_0x59bd11;logger[_0x8171('0xe')](_0x8171('0x60'),_0x3f9b5f['id']);return getTicket(_0x1bbd0a,_0x2da4cb,_0x3f9b5f,_0x1a14c6,_0xff1c53,_0x1a14c6['Fields'],_0xd5859f,'Inbound');})[_0x8171('0x34')](function(_0x2b0025){_0x5ed4e3=_0x2b0025;logger[_0x8171('0xe')](_0x8171('0x63'));logger[_0x8171('0xe')](_0x8171('0x64'),_0x5ed4e3['id']);return setRelationship(_0xd5859f,_0x2da4cb,_0x5ed4e3,_0x8171('0x65'));})['then'](function(){return setRelationship(_0xd5859f,_0x3f9b5f,_0x5ed4e3,'contacts');})[_0x8171('0x34')](function(){return getServerInfo(_0xd5859f);})[_0x8171('0x6d')](function(_0x24c21f){logger[_0x8171('0x78')]('['+_0xff1c53[_0x8171('0x7b')][_0x8171('0x7c')]()+']',JSON[_0x8171('0x26')](_0x24c21f));});}; \ No newline at end of file +var _0x467a=['getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','length','forEach','push','idField','variableName','set_entry','JSON','Basic\x20%s','apiKey','toString','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','nameField','content','type','string','customField','variable','custom_fields','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','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','outbound','recordingFormat','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','unmanaged','calleridname','lastevent','toUpperCase','lodash','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','Creating\x20new\x20ticket...','name'];(function(_0x1c31da,_0x54c409){var _0x3b2432=function(_0x306055){while(--_0x306055){_0x1c31da['push'](_0x1c31da['shift']());}};_0x3b2432(++_0x54c409);}(_0x467a,0x1d5));var _0xa467=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x467a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa467('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0xa467('0x1'));var intUtil=require('./util');var config=require(_0xa467('0x2'));var logger=require(_0xa467('0x3'))(_0xa467('0x4'));config[_0xa467('0x5')]=_[_0xa467('0x6')](config[_0xa467('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xa467('0x7'))(new Redis(config['redis']));var def={'method':_0xa467('0x8'),'json':!![]};function emit(_0x2c8420,_0xf31d18,_0x55643a){io['to'](_0x2c8420)['emit'](_0xf31d18,_0x55643a);}function getTicket(_0x39ffc4,_0x106eb6,_0x50aac2,_0x2bffae,_0x1eb639,_0x4cd455,_0x4b3c55,_0x48085f){logger['info'](_0xa467('0x9'));var _0x529142=new Date();var _0x4517e0=[{'name':_0xa467('0xa'),'value':intUtil[_0xa467('0xb')](_0x2bffae[_0xa467('0xc')],_0x1eb639,'\x20')},{'name':_0xa467('0xd'),'value':_0x106eb6['id']},{'name':_0xa467('0xe'),'value':_0x106eb6['id']},{'name':_0xa467('0xf'),'value':intUtil[_0xa467('0xb')](_0x2bffae[_0xa467('0x10')],_0x1eb639,'\x0a')},{'name':_0xa467('0x11'),'value':_0x529142[_0xa467('0x12')]()['slice'](0x0,0x13)[_0xa467('0x13')]('T','\x20')},{'name':_0xa467('0x14'),'value':'0'},{'name':_0xa467('0x15'),'value':'15'},{'name':_0xa467('0x16'),'value':_0x50aac2['id']},{'name':'parent_type','value':_0xa467('0x17')},{'name':_0xa467('0x18'),'value':_0x50aac2[_0xa467('0xa')]},{'name':'direction','value':_0x48085f}];if(_0x4cd455[_0xa467('0x19')]){_[_0xa467('0x1a')](_0x4cd455,function(_0x2ffe1b){if(_0x1eb639[_0x2ffe1b['variableName']]){_0x4517e0[_0xa467('0x1b')]({'name':_0x2ffe1b[_0xa467('0x1c')],'value':_0x1eb639[_0x2ffe1b[_0xa467('0x1d')]]});}});}return request({'form':{'method':_0xa467('0x1e'),'input_type':_0xa467('0x1f'),'response_type':_0xa467('0x1f'),'rest_data':JSON['stringify']({'session':_0x4b3c55['id'],'module_name':'Calls','name_value_list':_0x4517e0})}});}function getAuth(_0x3c344a){return util['format'](_0xa467('0x20'),new Buffer(_0x3c344a[_0xa467('0x21')]+':X')[_0xa467('0x22')]('base64'));}function getServerInfo(_0x497d50){return request({'form':{'method':_0xa467('0x23'),'input_type':_0xa467('0x1f'),'response_type':_0xa467('0x1f'),'rest_data':JSON[_0xa467('0x24')]({'session':_0x497d50['id']})}});}function getUser(_0x2cba74,_0x22e469,_0x39d514){if(!_[_0xa467('0x25')](_0x22e469)){logger['info'](_0xa467('0x26'),_0x22e469);return request({'form':{'method':_0xa467('0x27'),'input_type':_0xa467('0x1f'),'response_type':_0xa467('0x1f'),'rest_data':JSON[_0xa467('0x24')]({'session':_0x39d514['id'],'module_name':_0xa467('0x28'),'query':util[_0xa467('0x29')](_0xa467('0x2a'),_0x22e469),'order_by':'','offset':'0','select_fields':['id',_0xa467('0xa'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa467('0x2b')](function(_0x186bc5){if(_0x186bc5[_0xa467('0x2c')][_0xa467('0x19')]){var _0x1d534a=_[_0xa467('0x2d')](_0x186bc5[_0xa467('0x2c')],function(_0x4b1590){return _0x4b1590[_0xa467('0x2e')][_0xa467('0x2f')][_0xa467('0x30')]===_0x22e469;});if(_0x1d534a){logger[_0xa467('0x31')](_0xa467('0x32'));return BPromise['resolve']({'id':_0x1d534a['name_value_list']['id'][_0xa467('0x30')],'name':_0x1d534a[_0xa467('0x2e')][_0xa467('0xa')][_0xa467('0x30')]});}}logger[_0xa467('0x31')](_0xa467('0x33'));return BPromise['resolve']({'id':_0x39d514[_0xa467('0x2e')][_0xa467('0x34')][_0xa467('0x30')],'name':_0x39d514[_0xa467('0x2e')][_0xa467('0x2f')][_0xa467('0x30')]});});}else{logger[_0xa467('0x31')](_0xa467('0x35'));return BPromise[_0xa467('0x36')]({'id':_0x39d514[_0xa467('0x2e')][_0xa467('0x34')][_0xa467('0x30')],'name':_0x39d514['name_value_list'][_0xa467('0x2f')][_0xa467('0x30')]});}}function getEndUser(_0x1a2b53,_0x111b2a,_0x29e05f,_0x5ef923){logger['info'](_0xa467('0x37'),_0x29e05f);return request({'form':{'method':_0xa467('0x27'),'input_type':'JSON','response_type':_0xa467('0x1f'),'rest_data':JSON[_0xa467('0x24')]({'session':_0x5ef923['id'],'module_name':_0xa467('0x17'),'query':util[_0xa467('0x29')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x29e05f),'order_by':'','offset':'0','select_fields':['id','name',_0xa467('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa467('0x2b')](function(_0x56341d){if(_0x56341d[_0xa467('0x2c')][_0xa467('0x19')]){var _0xacbe0a=_[_0xa467('0x2d')](_0x56341d[_0xa467('0x2c')],function(_0x4682b8){return _0x4682b8[_0xa467('0x2e')][_0xa467('0x38')]['value']===_0x29e05f;});if(_0xacbe0a){logger[_0xa467('0x31')](_0xa467('0x39'));return BPromise[_0xa467('0x36')]({'id':_0xacbe0a[_0xa467('0x2e')]['id'][_0xa467('0x30')],'name':_0xacbe0a['name_value_list']['name'][_0xa467('0x30')],'phone':_0xacbe0a[_0xa467('0x2e')][_0xa467('0x38')][_0xa467('0x30')]});}}else{logger['info'](_0xa467('0x3a'));return request({'form':{'method':_0xa467('0x1e'),'input_type':_0xa467('0x1f'),'response_type':_0xa467('0x1f'),'rest_data':JSON[_0xa467('0x24')]({'session':_0x5ef923['id'],'module_name':_0xa467('0x17'),'name_value_list':[{'name':_0xa467('0x3b'),'value':_0x111b2a!==''?_0x111b2a:util[_0xa467('0x29')](_0xa467('0x3c'),_0x29e05f)},{'name':_0xa467('0x38'),'value':_0x29e05f}]})}})[_0xa467('0x2b')](function(_0x2a5722){logger[_0xa467('0x31')](_0xa467('0x3d'));return BPromise[_0xa467('0x36')]({'id':_0x2a5722['id'],'name':_0x2a5722[_0xa467('0x2c')]['first_name'][_0xa467('0x30')],'phone':_0x2a5722[_0xa467('0x2c')][_0xa467('0x38')][_0xa467('0x30')]});});}});}function request(_0x217b38){logger['debug'](_0xa467('0x3e'),JSON[_0xa467('0x24')](_0x217b38));return rp(_[_0xa467('0x3f')](def,_0x217b38));}function getTags(_0x4c63f3,_0x16d417){var _0x5cf2c5=[];if(_0x4c63f3&&_0x4c63f3[_0xa467('0x19')]>0x0){_0x5cf2c5=_[_0xa467('0x40')](_0x4c63f3,_0x16d417);}return _0x5cf2c5;}function getCustomFields(_0x700d4,_0x5a1359){var _0x527057=[];var _0x4bc095={'custom_fields':[]};if(_0x700d4[_0xa467('0x19')]>0x0){_[_0xa467('0x1a')](_0x700d4,function(_0xf7299f){if(_0xf7299f['type']==='string'&&_0xf7299f['nameField']&&!_0xf7299f['customField']){_0x4bc095[_0xf7299f[_0xa467('0x41')]['toLowerCase']()]=_0xf7299f[_0xa467('0x42')][_0xa467('0x22')]();}else if(_0xf7299f[_0xa467('0x43')]===_0xa467('0x44')&&_0xf7299f[_0xa467('0x1c')]&&_0xf7299f[_0xa467('0x45')]){_0x4bc095['custom_fields'][_0xa467('0x1b')]({'id':_0xf7299f[_0xa467('0x1c')],'value':_0xf7299f['content'][_0xa467('0x22')]()});}else if(_0xf7299f[_0xa467('0x43')]===_0xa467('0x46')&&_0xf7299f[_0xa467('0x1d')]&&_0xf7299f['idField']&&_0xf7299f[_0xa467('0x45')]){_0x5a1359[_0xf7299f[_0xa467('0x1d')]]&&_0x4bc095[_0xa467('0x47')]['push']({'id':_0xf7299f[_0xa467('0x1c')],'value':_0x5a1359[_0xf7299f[_0xa467('0x1d')]]['toString']()});}else if(_0xf7299f['type']===_0xa467('0x48')&&_0xf7299f[_0xa467('0x49')]&&_0xf7299f['Variable'][_0xa467('0xa')]&&_0xf7299f[_0xa467('0x1c')]&&_0xf7299f[_0xa467('0x45')]){_0x5a1359[_0xf7299f['Variable']['name']['toLowerCase']()]&&_0x4bc095['custom_fields'][_0xa467('0x1b')]({'id':_0xf7299f[_0xa467('0x1c')],'value':_0x5a1359[_0xf7299f['Variable'][_0xa467('0xa')]['toLowerCase']()][_0xa467('0x22')]()});}});}return _0x4bc095;}function getConnection(_0x2d817f){return request({'method':'POST','form':{'method':_0xa467('0x4a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa467('0x24')]({'user_auth':{'user_name':_0x2d817f['username'],'password':_0x2d817f[_0xa467('0x4b')],'encryption':_0xa467('0x4c')},'application':_0xa467('0x4d')})}})[_0xa467('0x2b')](function(_0x3b37d7){var _0x529ca2=_0x3b37d7;if(_0x529ca2['id']){def['sessionID']=_0x529ca2['id'];return BPromise[_0xa467('0x36')](_0x529ca2);}else{throw new Error(util[_0xa467('0x29')](_0xa467('0x4e'),_0x2d817f['id']));}});}function setRelationship(_0x4a6f6e,_0x3fd1ba,_0x57a6ff,_0x277d94){return request({'form':{'method':_0xa467('0x4f'),'input_type':_0xa467('0x1f'),'response_type':_0xa467('0x1f'),'rest_data':JSON[_0xa467('0x24')]({'session':_0x4a6f6e['id'],'module_name':_0xa467('0x50'),'module_id':_0x57a6ff['id'],'link_field_name':_0x277d94,'related_ids':[_0x3fd1ba['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x59b687,_0x45d67a,_0x49ba03,_0xa16083,_0x3e7fbb,_0x58ab99){var _0x51ed16,_0x2daa2d,_0x346ce7,_0x4b23f7;_0x58ab99[_0xa467('0x51')]=intUtil[_0xa467('0x52')](_0x58ab99[_0xa467('0x51')]);_0x58ab99[_0xa467('0x53')]=intUtil[_0xa467('0x52')](_0x58ab99[_0xa467('0x53')]);def[_0xa467('0x54')]=util['format'](_0xa467('0x55'),_0x58ab99[_0xa467('0x51')]);if(_0x3e7fbb&&_0x3e7fbb[_0xa467('0x56')]){logger[_0xa467('0x31')](_0xa467('0x57'),_0xa467('0x58'));_0x45d67a[_0xa467('0x59')]=util[_0xa467('0x29')](_0xa467('0x5a'),_0x58ab99[_0xa467('0x53')],_0x45d67a['uniqueid'],md5(_0x45d67a['uniqueid']));}else{_0x45d67a[_0xa467('0x59')]='';}return getConnection(_0x58ab99)[_0xa467('0x2b')](function(_0x2b1c22){_0x4b23f7=_0x2b1c22;return getUser(_0x58ab99,_0xa16083[_0xa467('0xa')],_0x4b23f7);})[_0xa467('0x2b')](function(_0x58bc97){_0x51ed16=_0x58bc97;logger[_0xa467('0x31')](_0xa467('0x5b'),_0x51ed16['id']);return getEndUser(_0x58ab99,_0x45d67a['calleridname'],_0x45d67a[_0xa467('0x5c')],_0x4b23f7);})[_0xa467('0x2b')](function(_0x34071f){_0x2daa2d=_0x34071f;logger['info'](_0xa467('0x5d'),_0x2daa2d['id']);return getTicket(_0x58ab99,_0x51ed16,_0x2daa2d,_0x49ba03,_0x45d67a,_0x49ba03[_0xa467('0x5e')],_0x4b23f7,_0xa467('0x5f'));})[_0xa467('0x2b')](function(_0x20c166){_0x346ce7=_0x20c166;logger[_0xa467('0x31')](_0xa467('0x60'));logger[_0xa467('0x31')]('The\x20Ticket\x20ID\x20is:',_0x346ce7['id']);return setRelationship(_0x4b23f7,_0x51ed16,_0x346ce7,_0xa467('0x61'));})[_0xa467('0x2b')](function(){return setRelationship(_0x4b23f7,_0x2daa2d,_0x346ce7,_0xa467('0x62'));})['then'](function(){return getServerInfo(_0x4b23f7);})[_0xa467('0x2b')](function(_0x27973a){var _0x20ad46=parseInt(_0x27973a[_0xa467('0x63')][_0xa467('0x64')](0x0));var _0x1920f0=util['format'](_0xa467('0x65'),_0x58ab99['remoteUri'],_0x346ce7['id']);if(_0x20ad46>0x6){_0x1920f0=util[_0xa467('0x29')](_0xa467('0x66'),_0x58ab99[_0xa467('0x51')],_0x346ce7['id']);}logger[_0xa467('0x31')](_0xa467('0x57'),_0xa467('0x67'));emit(util['format'](_0xa467('0x68'),_0xa16083[_0xa467('0xa')]),_0xa467('0x69'),{'uri':_0x1920f0});})[_0xa467('0x6a')](function(_0x3abd2c){logger[_0xa467('0x6b')]('[QUEUE]',JSON[_0xa467('0x24')](_0x3abd2c));});};exports[_0xa467('0x6c')]=function(_0x4fcfc6,_0x53b537,_0x5e7c22,_0x94c037,_0x4e252c,_0x4cdd28,_0x175a37){var _0x2a071a,_0x400d92,_0x8a7deb,_0x1fb3a9;_0x4cdd28[_0xa467('0x51')]=intUtil[_0xa467('0x52')](_0x4cdd28['remoteUri']);_0x4cdd28[_0xa467('0x53')]=intUtil[_0xa467('0x52')](_0x4cdd28[_0xa467('0x53')]);def[_0xa467('0x54')]=util['format']('%s/service/v4_1/rest.php',_0x4cdd28['remoteUri']);if(_0x175a37&&_0x175a37[_0xa467('0x6d')]&&_0x175a37['recordingFormat']!=='none'){logger['info'](_0xa467('0x6e'),_0xa467('0x58'));_0x53b537[_0xa467('0x59')]=util['format'](_0xa467('0x5a'),_0x4cdd28[_0xa467('0x53')],_0x53b537[_0xa467('0x6f')],md5(_0x53b537[_0xa467('0x6f')]));}return getConnection(_0x4cdd28)['then'](function(_0x51d173){_0x1fb3a9=_0x51d173;return getUser(_0x4cdd28,_0x94c037['name'],_0x1fb3a9);})[_0xa467('0x2b')](function(_0x189b3c){_0x2a071a=_0x189b3c;logger['info'](_0xa467('0x5b'),_0x2a071a['id']);return getEndUser(_0x4cdd28,_0x53b537[_0xa467('0x70')],_0x53b537[_0xa467('0x71')],_0x1fb3a9);})['then'](function(_0x2547cf){_0x400d92=_0x2547cf;logger['info']('The\x20Enduser\x20ID\x20is:',_0x400d92['id']);return getTicket(_0x4cdd28,_0x2a071a,_0x400d92,_0x5e7c22,_0x53b537,_0x5e7c22[_0xa467('0x5e')],_0x1fb3a9,_0xa467('0x72'));})['then'](function(_0x3ee34f){_0x8a7deb=_0x3ee34f;logger[_0xa467('0x31')](_0xa467('0x60'));logger['info'](_0xa467('0x73'),_0x8a7deb['id']);return setRelationship(_0x1fb3a9,_0x2a071a,_0x8a7deb,'users');})[_0xa467('0x2b')](function(){return setRelationship(_0x1fb3a9,_0x400d92,_0x8a7deb,_0xa467('0x62'));})[_0xa467('0x2b')](function(){return getServerInfo(_0x1fb3a9);})[_0xa467('0x2b')](function(_0xd74ac8){var _0x3f4e34=parseInt(_0xd74ac8['version'][_0xa467('0x64')](0x0));var _0x4f7205=util[_0xa467('0x29')](_0xa467('0x65'),_0x4cdd28['remoteUri'],_0x8a7deb['id']);if(_0x3f4e34>0x6){_0x4f7205=util[_0xa467('0x29')](_0xa467('0x66'),_0x4cdd28[_0xa467('0x51')],_0x8a7deb['id']);}logger[_0xa467('0x31')](_0xa467('0x6e'),_0xa467('0x67'));emit(util[_0xa467('0x29')](_0xa467('0x68'),_0x94c037[_0xa467('0xa')]),_0xa467('0x69'),{'uri':_0x4f7205});})[_0xa467('0x6a')](function(_0x355195){logger[_0xa467('0x6b')](_0xa467('0x6e'),JSON[_0xa467('0x24')](_0x355195));});};exports[_0xa467('0x74')]=function(_0x1f8b69,_0x4e3217,_0x39ee71,_0x4c0be6,_0x58e711,_0x5942c7){var _0x17f9ec,_0x25b110,_0x51a80c,_0x78f61d;_0x5942c7[_0xa467('0x51')]=intUtil[_0xa467('0x52')](_0x5942c7[_0xa467('0x51')]);_0x5942c7[_0xa467('0x53')]=intUtil['stripTrailingSlash'](_0x5942c7['serverUrl']);def['uri']=util[_0xa467('0x29')](_0xa467('0x55'),_0x5942c7[_0xa467('0x51')]);if(_0x58e711&&_0x58e711['monitor_format']){logger[_0xa467('0x31')]('['+_0x4e3217['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4e3217[_0xa467('0x59')]=util[_0xa467('0x29')](_0xa467('0x5a'),_0x5942c7['serverUrl'],_0x4e3217[_0xa467('0x6f')],md5(_0x4e3217[_0xa467('0x6f')]));}else{_0x4e3217[_0xa467('0x59')]='';}return getConnection(_0x5942c7)[_0xa467('0x2b')](function(_0x3d60e1){_0x78f61d=_0x3d60e1;if(!_[_0xa467('0x25')](_0x4c0be6)){return getUser(_0x5942c7,_0x4c0be6[_0xa467('0xa')],_0x78f61d);}else{return getUser(_0x5942c7,null,_0x78f61d);}})['then'](function(_0x30d866){_0x17f9ec=_0x30d866;logger[_0xa467('0x31')]('The\x20User\x20ID\x20is:',_0x17f9ec['id']);return getEndUser(_0x5942c7,_0x4e3217[_0xa467('0x75')],_0x4e3217[_0xa467('0x5c')],_0x78f61d);})['then'](function(_0x133d55){_0x25b110=_0x133d55;logger[_0xa467('0x31')]('The\x20Enduser\x20ID\x20is:',_0x25b110['id']);return getTicket(_0x5942c7,_0x17f9ec,_0x25b110,_0x39ee71,_0x4e3217,_0x39ee71[_0xa467('0x5e')],_0x78f61d,_0xa467('0x5f'));})['then'](function(_0x57cff1){_0x51a80c=_0x57cff1;logger[_0xa467('0x31')]('Ticket\x20created!');logger[_0xa467('0x31')](_0xa467('0x73'),_0x51a80c['id']);return setRelationship(_0x78f61d,_0x17f9ec,_0x51a80c,_0xa467('0x61'));})[_0xa467('0x2b')](function(){return setRelationship(_0x78f61d,_0x25b110,_0x51a80c,_0xa467('0x62'));})[_0xa467('0x2b')](function(){return getServerInfo(_0x78f61d);})[_0xa467('0x6a')](function(_0x45f22f){logger[_0xa467('0x6b')]('['+_0x4e3217[_0xa467('0x76')][_0xa467('0x77')]()+']',JSON[_0xa467('0x24')](_0x45f22f));});}; \ 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 aab7929..96fdc6d 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 _0xe946=['name','toLowerCase','keyType','key','%s:\x20%s','keyContent','format','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','length','string','push','content','variable','variableName','toString','type','customVariable','Variable'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe946,0xb0));var _0x6e94=function(_0x25cee2,_0x1a0b33){_0x25cee2=_0x25cee2-0x0;var _0x3c7d91=_0xe946[_0x25cee2];return _0x3c7d91;};'use strict';var _=require(_0x6e94('0x0'));var util=require(_0x6e94('0x1'));exports['getString']=function(_0x9dea1a,_0x5af2d5,_0x3dd4ae){var _0x35da08=[];if(_0x9dea1a['length']>0x0){var _0x4e0b0b=_[_0x6e94('0x2')](_0x9dea1a,['id']);for(var _0x2211cb=0x0;_0x2211cb<_0x4e0b0b[_0x6e94('0x3')];_0x2211cb++){var _0x3c42f3=_0x4e0b0b[_0x2211cb];if(_0x3c42f3['type']===_0x6e94('0x4')){_0x35da08[_0x6e94('0x5')](_0x3c42f3[_0x6e94('0x6')]);}else if(_0x3c42f3['type']===_0x6e94('0x7')&&_0x3c42f3[_0x6e94('0x8')]){_0x5af2d5[_0x3c42f3['variableName']]&&_0x35da08[_0x6e94('0x5')](_0x5af2d5[_0x3c42f3[_0x6e94('0x8')]][_0x6e94('0x9')]());}else if(_0x3c42f3[_0x6e94('0xa')]===_0x6e94('0xb')&&_0x3c42f3[_0x6e94('0xc')]&&_0x3c42f3['Variable'][_0x6e94('0xd')]){_0x5af2d5[_0x3c42f3[_0x6e94('0xc')][_0x6e94('0xd')][_0x6e94('0xe')]()]&&_0x35da08[_0x6e94('0x5')](_0x5af2d5[_0x3c42f3[_0x6e94('0xc')]['name'][_0x6e94('0xe')]()][_0x6e94('0x9')]());}else if(_0x3c42f3[_0x6e94('0xa')]==='keyValue'){if(_0x3c42f3[_0x6e94('0xf')]===_0x6e94('0x4')&&_0x3c42f3[_0x6e94('0x10')]){_0x35da08[_0x6e94('0x5')](util['format'](_0x6e94('0x11'),_0x3c42f3['key'],_0x3c42f3[_0x6e94('0x12')]));}else if(_0x3c42f3[_0x6e94('0xf')]==='variable'&&_0x3c42f3[_0x6e94('0x8')]&&_0x3c42f3['key']){_0x5af2d5[_0x3c42f3[_0x6e94('0x8')]]&&_0x35da08[_0x6e94('0x5')](util[_0x6e94('0x13')](_0x6e94('0x11'),_0x3c42f3['key'],_0x5af2d5[_0x3c42f3[_0x6e94('0x8')]]));}else if(_0x3c42f3[_0x6e94('0xf')]==='customVariable'&&_0x3c42f3[_0x6e94('0xc')]&&_0x3c42f3[_0x6e94('0xc')][_0x6e94('0xd')]&&_0x3c42f3[_0x6e94('0x10')]){_0x5af2d5[_0x3c42f3[_0x6e94('0xc')]['name'][_0x6e94('0xe')]()]&&_0x35da08[_0x6e94('0x5')](util[_0x6e94('0x13')](_0x6e94('0x11'),_0x3c42f3[_0x6e94('0x10')],_0x5af2d5[_0x3c42f3[_0x6e94('0xc')][_0x6e94('0xd')]['toLowerCase']()]));}}}}return _0x35da08[_0x6e94('0x14')](_0x3dd4ae);};exports[_0x6e94('0x15')]=function(_0x28891d){var _0x170940=_0x28891d[_0x6e94('0x16')](-0x1);if(_0x170940==='/'){_0x28891d=_0x28891d['substring'](0x0,_0x28891d[_0x6e94('0x17')](_0x170940));}return _0x28891d;};exports[_0x6e94('0x18')]=function(_0x5ee65e){if(!_[_0x6e94('0x19')](_0x5ee65e)&&_0x5ee65e!==''){var _0x13c46d=/^(([^<>()\[\]\\.,;:\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 _0x13c46d[_0x6e94('0x1a')](String(_0x5ee65e)[_0x6e94('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xa435=['length','sortBy','string','content','type','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','lodash','util','getString'];(function(_0x3abc2f,_0x156e6c){var _0x3754c2=function(_0x362db5){while(--_0x362db5){_0x3abc2f['push'](_0x3abc2f['shift']());}};_0x3754c2(++_0x156e6c);}(_0xa435,0x141));var _0x5a43=function(_0x91c06c,_0x5e0bcb){_0x91c06c=_0x91c06c-0x0;var _0x46ede3=_0xa435[_0x91c06c];return _0x46ede3;};'use strict';var _=require(_0x5a43('0x0'));var util=require(_0x5a43('0x1'));exports[_0x5a43('0x2')]=function(_0x489dc3,_0x2f6057,_0x3112c5){var _0x3e4420=[];if(_0x489dc3[_0x5a43('0x3')]>0x0){var _0x5196bd=_[_0x5a43('0x4')](_0x489dc3,['id']);for(var _0x134c14=0x0;_0x134c14<_0x5196bd[_0x5a43('0x3')];_0x134c14++){var _0xc59c11=_0x5196bd[_0x134c14];if(_0xc59c11['type']===_0x5a43('0x5')){_0x3e4420['push'](_0xc59c11[_0x5a43('0x6')]);}else if(_0xc59c11[_0x5a43('0x7')]==='variable'&&_0xc59c11[_0x5a43('0x8')]){_0x2f6057[_0xc59c11['variableName']]&&_0x3e4420[_0x5a43('0x9')](_0x2f6057[_0xc59c11['variableName']][_0x5a43('0xa')]());}else if(_0xc59c11[_0x5a43('0x7')]===_0x5a43('0xb')&&_0xc59c11[_0x5a43('0xc')]&&_0xc59c11[_0x5a43('0xc')][_0x5a43('0xd')]){_0x2f6057[_0xc59c11['Variable'][_0x5a43('0xd')]['toLowerCase']()]&&_0x3e4420['push'](_0x2f6057[_0xc59c11['Variable']['name'][_0x5a43('0xe')]()][_0x5a43('0xa')]());}else if(_0xc59c11[_0x5a43('0x7')]===_0x5a43('0xf')){if(_0xc59c11[_0x5a43('0x10')]===_0x5a43('0x5')&&_0xc59c11[_0x5a43('0x11')]){_0x3e4420['push'](util[_0x5a43('0x12')]('%s:\x20%s',_0xc59c11[_0x5a43('0x11')],_0xc59c11['keyContent']));}else if(_0xc59c11[_0x5a43('0x10')]==='variable'&&_0xc59c11[_0x5a43('0x8')]&&_0xc59c11[_0x5a43('0x11')]){_0x2f6057[_0xc59c11[_0x5a43('0x8')]]&&_0x3e4420['push'](util[_0x5a43('0x12')]('%s:\x20%s',_0xc59c11[_0x5a43('0x11')],_0x2f6057[_0xc59c11[_0x5a43('0x8')]]));}else if(_0xc59c11[_0x5a43('0x10')]===_0x5a43('0xb')&&_0xc59c11[_0x5a43('0xc')]&&_0xc59c11[_0x5a43('0xc')][_0x5a43('0xd')]&&_0xc59c11[_0x5a43('0x11')]){_0x2f6057[_0xc59c11[_0x5a43('0xc')]['name'][_0x5a43('0xe')]()]&&_0x3e4420[_0x5a43('0x9')](util[_0x5a43('0x12')](_0x5a43('0x13'),_0xc59c11['key'],_0x2f6057[_0xc59c11[_0x5a43('0xc')]['name'][_0x5a43('0xe')]()]));}}}}return _0x3e4420[_0x5a43('0x14')](_0x3112c5);};exports[_0x5a43('0x15')]=function(_0x4dcd06){var _0x3a5fd5=_0x4dcd06[_0x5a43('0x16')](-0x1);if(_0x3a5fd5==='/'){_0x4dcd06=_0x4dcd06[_0x5a43('0x17')](0x0,_0x4dcd06[_0x5a43('0x18')](_0x3a5fd5));}return _0x4dcd06;};exports['validateEmail']=function(_0x154520){if(!_[_0x5a43('0x19')](_0x154520)&&_0x154520!==''){var _0x8f4b17=/^(([^<>()\[\]\\.,;:\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 _0x8f4b17[_0x5a43('0x1a')](String(_0x154520)[_0x5a43('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 262599d..31f8c82 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3f2198,_0x8bd614){var _0x516590=function(_0x5b92fb){while(--_0x5b92fb){_0x3f2198['push'](_0x3f2198['shift']());}};_0x516590(++_0x8bd614);}(_0xe706,0xa3));var _0x6e70=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xe706[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x1363ee,_0x2812a5){var _0x560062=function(_0x2be6a9){while(--_0x2be6a9){_0x1363ee['push'](_0x1363ee['shift']());}};_0x560062(++_0x2812a5);}(_0xe706,0xa3));var _0x6e70=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0xe706[_0x1488cd];return _0x63fa13;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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 b80682b..f126ce4 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 _0xac9d=['customField','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','/api/v2','catch','inspect','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','username','authType','token','Basic\x20%s','toString','base64','debug','[HTTP]','GET','forEach','string','picklist','nameField','toLowerCase','content','idField','custom_fields','push','type','variable','variableName'];(function(_0x3832cd,_0x11aca2){var _0x4176a2=function(_0x3a06c3){while(--_0x3a06c3){_0x3832cd['push'](_0x3832cd['shift']());}};_0x4176a2(++_0x11aca2);}(_0xac9d,0x182));var _0xdac9=function(_0x405faf,_0x38d0f0){_0x405faf=_0x405faf-0x0;var _0x2308e5=_0xac9d[_0x405faf];return _0x2308e5;};'use strict';var _=require('lodash');var rp=require(_0xdac9('0x0'));var md5=require(_0xdac9('0x1'));var util=require(_0xdac9('0x2'));var Redis=require(_0xdac9('0x3'));var intUtil=require(_0xdac9('0x4'));var config=require(_0xdac9('0x5'));var logger=require(_0xdac9('0x6'))(_0xdac9('0x7'));config[_0xdac9('0x8')]=_[_0xdac9('0x9')](config['redis'],{'host':_0xdac9('0xa'),'port':0x18eb});var io=require(_0xdac9('0xb'))(new Redis(config[_0xdac9('0x8')]));function emit(_0x236b09,_0x349122,_0x16428c){io['to'](_0x236b09)[_0xdac9('0xc')](_0x349122,_0x16428c);}var headers={'Content-Type':_0xdac9('0xd'),'Accept':_0xdac9('0xd')};function getTicket(_0x4915c2,_0x1ce7b9,_0x47ddaa,_0x3d186b,_0x3c28a4){logger[_0xdac9('0xe')](_0xdac9('0xf'));return request({'uri':util[_0xdac9('0x10')](_0xdac9('0x11'),_0x4915c2['remoteUri']),'method':_0xdac9('0x12'),'body':{'ticket':_[_0xdac9('0x13')]({'requester_id':_0x47ddaa['id'],'submitter_id':_0x1ce7b9?_0x1ce7b9['id']:undefined,'assignee_id':_0x1ce7b9?_0x1ce7b9['id']:undefined,'tags':getTags(_0x3d186b[_0xdac9('0x14')],_0xdac9('0x15')),'subject':intUtil[_0xdac9('0x16')](_0x3d186b[_0xdac9('0x17')],_0x3c28a4,'\x20'),'description':intUtil[_0xdac9('0x16')](_0x3d186b[_0xdac9('0x18')],_0x3c28a4,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3d186b[_0xdac9('0x18')],_0x3c28a4,'\x0a')}},getCustomFields(_0x3d186b[_0xdac9('0x19')],_0x3c28a4))}})[_0xdac9('0x1a')](function(_0xd28ef4){logger[_0xdac9('0xe')](_0xdac9('0x1b'));return _0xd28ef4[_0xdac9('0x1c')];});}function getUser(_0x17ce3b,_0x159eef){if(intUtil['validateEmail'](_0x159eef)){logger[_0xdac9('0xe')](_0xdac9('0x1d'),_0x159eef);return request({'uri':util[_0xdac9('0x10')]('%s/search.json',_0x17ce3b[_0xdac9('0x1e')]),'qs':{'query':util[_0xdac9('0x10')](_0xdac9('0x1f'),_0x159eef)}})[_0xdac9('0x1a')](function(_0x204473){if(_0x204473[_0xdac9('0x20')]){logger[_0xdac9('0xe')](_0xdac9('0x21'));return _[_0xdac9('0x22')](_0x204473['results'],{'email':_0x159eef,'role':_0xdac9('0x23')});}else{logger[_0xdac9('0xe')](_0xdac9('0x24'));return request({'uri':util[_0xdac9('0x10')](_0xdac9('0x25'),_0x17ce3b[_0xdac9('0x1e')])})['then'](function(_0x2e4575){logger['info']('Admin\x20account\x20selected.');return _0x2e4575[_0xdac9('0x26')];});}});}else{logger[_0xdac9('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xdac9('0x10')](_0xdac9('0x25'),_0x17ce3b['remoteUri'])})[_0xdac9('0x1a')](function(_0x1bcbe1){logger[_0xdac9('0xe')](_0xdac9('0x27'));return _0x1bcbe1[_0xdac9('0x26')];});}}function getEndUser(_0xcd7f85,_0x239a85,_0x23ebbf){logger['info'](_0xdac9('0x28'),_0x23ebbf);return request({'uri':util[_0xdac9('0x10')](_0xdac9('0x29'),_0xcd7f85[_0xdac9('0x1e')]),'qs':{'query':util[_0xdac9('0x10')](_0xdac9('0x2a'),_0x23ebbf)}})[_0xdac9('0x1a')](function(_0x16249f){var _0x408e04;if(_0x16249f[_0xdac9('0x2b')][_0xdac9('0x2c')]){_0x16249f[_0xdac9('0x2b')]=_[_0xdac9('0x2d')](_0x16249f[_0xdac9('0x2b')],{'suspended':![],'role':_0xdac9('0x2e')});if(_0x16249f[_0xdac9('0x2b')][_0xdac9('0x2c')]){_0x408e04=_[_0xdac9('0x2f')](_0x16249f[_0xdac9('0x2b')]);}}if(_0x408e04){logger['info'](_0xdac9('0x30'));return _0x408e04;}else{logger[_0xdac9('0xe')](_0xdac9('0x31'));return request({'uri':util[_0xdac9('0x10')](_0xdac9('0x32'),_0xcd7f85[_0xdac9('0x1e')]),'method':_0xdac9('0x12'),'body':{'user':{'role':_0xdac9('0x2e'),'name':util[_0xdac9('0x10')]('Caller\x20-\x20%s',_0x239a85||_0x23ebbf),'phone':_0x23ebbf}}})[_0xdac9('0x1a')](function(_0x3228d7){logger[_0xdac9('0xe')](_0xdac9('0x33'));return _0x3228d7[_0xdac9('0x26')];});}});}function getAuth(_0xf8341e){var _0x43270c;if(_0xf8341e['authType']===_0xdac9('0x34')){_0x43270c=util[_0xdac9('0x10')]('%s:%s',_0xf8341e[_0xdac9('0x35')],_0xf8341e[_0xdac9('0x34')]);}else if(_0xf8341e[_0xdac9('0x36')]===_0xdac9('0x37')){_0x43270c=util['format']('%s/token:%s',_0xf8341e[_0xdac9('0x35')],_0xf8341e[_0xdac9('0x37')]);}return util[_0xdac9('0x10')](_0xdac9('0x38'),new Buffer(_0x43270c)[_0xdac9('0x39')](_0xdac9('0x3a')));}function request(_0x59d11d){logger[_0xdac9('0x3b')](_0xdac9('0x3c'),JSON['stringify'](_0x59d11d));return rp(_[_0xdac9('0x9')](_0x59d11d,{'method':_0xdac9('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x3f08f5,_0x4c5a02){var _0x13eb58=[];if(_0x3f08f5&&_0x3f08f5[_0xdac9('0x2c')]>0x0){_0x13eb58=_['map'](_0x3f08f5,_0x4c5a02);}return _0x13eb58;}function getCustomFields(_0x2c04b3,_0x2da343){var _0x1fb5aa=[];var _0x4b6c26={'custom_fields':[]};if(_0x2c04b3[_0xdac9('0x2c')]>0x0){_[_0xdac9('0x3e')](_0x2c04b3,function(_0x3bfbb8){if(_['includes']([_0xdac9('0x3f'),_0xdac9('0x40')],_0x3bfbb8['type'])&&_0x3bfbb8[_0xdac9('0x41')]&&!_0x3bfbb8['customField']){_0x4b6c26[_0x3bfbb8[_0xdac9('0x41')][_0xdac9('0x42')]()]=_0x3bfbb8[_0xdac9('0x43')][_0xdac9('0x39')]();}else if(_['includes']([_0xdac9('0x3f'),_0xdac9('0x40')],_0x3bfbb8['type'])&&_0x3bfbb8[_0xdac9('0x44')]&&_0x3bfbb8['customField']){_0x4b6c26[_0xdac9('0x45')][_0xdac9('0x46')]({'id':_0x3bfbb8['idField'],'value':_0x3bfbb8[_0xdac9('0x43')]['toString']()});}else if(_0x3bfbb8[_0xdac9('0x47')]===_0xdac9('0x48')&&_0x3bfbb8[_0xdac9('0x49')]&&_0x3bfbb8[_0xdac9('0x44')]&&_0x3bfbb8[_0xdac9('0x4a')]){_0x2da343[_0x3bfbb8['variableName']]&&_0x4b6c26[_0xdac9('0x45')][_0xdac9('0x46')]({'id':_0x3bfbb8[_0xdac9('0x44')],'value':_0x2da343[_0x3bfbb8[_0xdac9('0x49')]]['toString']()});}else if(_0x3bfbb8[_0xdac9('0x47')]==='customVariable'&&_0x3bfbb8[_0xdac9('0x4b')]&&_0x3bfbb8[_0xdac9('0x4b')][_0xdac9('0x15')]&&_0x3bfbb8[_0xdac9('0x44')]&&_0x3bfbb8[_0xdac9('0x4a')]){_0x2da343[_0x3bfbb8['Variable'][_0xdac9('0x15')][_0xdac9('0x42')]()]&&_0x4b6c26[_0xdac9('0x45')][_0xdac9('0x46')]({'id':_0x3bfbb8[_0xdac9('0x44')],'value':_0x2da343[_0x3bfbb8[_0xdac9('0x4b')]['name'][_0xdac9('0x42')]()][_0xdac9('0x39')]()});}});}return _0x4b6c26;}exports['queue']=function(_0x578340,_0x19a538,_0x2e510f,_0x3e5cbe,_0x2602dc,_0x246b11){var _0x589416,_0x53b39b;_0x246b11[_0xdac9('0x1e')]=intUtil[_0xdac9('0x4c')](_0x246b11['remoteUri']);_0x246b11[_0xdac9('0x4d')]=intUtil[_0xdac9('0x4c')](_0x246b11[_0xdac9('0x4d')]);if(_0x2602dc&&_0x2602dc[_0xdac9('0x4e')]){logger[_0xdac9('0xe')](_0xdac9('0x4f'),_0xdac9('0x50'));_0x19a538[_0xdac9('0x51')]=util[_0xdac9('0x10')](_0xdac9('0x52'),_0x246b11[_0xdac9('0x4d')],_0x19a538[_0xdac9('0x53')],md5(_0x19a538['uniqueid']));}else{_0x19a538['recordingURL']='';}headers[_0xdac9('0x54')]=getAuth(_0x246b11);return getUser(_0x246b11,_0x3e5cbe['email'])[_0xdac9('0x1a')](function(_0x102cb8){_0x589416=_0x102cb8;logger[_0xdac9('0xe')](_0xdac9('0x55'),_0x589416['id']);return getEndUser(_0x246b11,_0x19a538[_0xdac9('0x56')],_0x19a538[_0xdac9('0x57')]);})[_0xdac9('0x1a')](function(_0x7b09d5){_0x53b39b=_0x7b09d5;logger[_0xdac9('0xe')](_0xdac9('0x58'),_0x53b39b['id']);return getTicket(_0x246b11,_0x589416,_0x53b39b,_0x2e510f,_0x19a538);})[_0xdac9('0x1a')](function(_0x42c40a){if(_0x42c40a){logger['info']('The\x20Ticket\x20ID\x20is:',_0x42c40a['id']);switch(_0x246b11[_0xdac9('0x47')]){case _0xdac9('0x59'):logger['info'](_0xdac9('0x4f'),_0xdac9('0x5a'));return request({'uri':util[_0xdac9('0x10')](_0xdac9('0x5b'),_0x246b11[_0xdac9('0x1e')],_0x589416['id'],_0x42c40a['id']),'method':_0xdac9('0x12')});case _0xdac9('0x5c'):logger['info']('[QUEUE]',_0xdac9('0x5d'));emit(util[_0xdac9('0x10')](_0xdac9('0x5e'),_0x3e5cbe[_0xdac9('0x15')]),_0xdac9('0x5f'),{'uri':util[_0xdac9('0x10')](_0xdac9('0x60'),_0x246b11['remoteUri'][_0xdac9('0x61')]('/api/v2',''),_0x42c40a['id'])});break;default:logger[_0xdac9('0x62')](_0xdac9('0x4f'),_0xdac9('0x63'));}}})['catch'](function(_0x1a93c3){logger[_0xdac9('0x62')](_0xdac9('0x64'),util['inspect'](_0x1a93c3,{'showHidden':!![],'depth':null}));});};exports[_0xdac9('0x65')]=function(_0x400065,_0x3095d5,_0x796b07,_0x320a89,_0x19f733,_0xfb96d,_0x3a3cf0){var _0x5c3bca,_0x12460b;_0xfb96d[_0xdac9('0x1e')]=intUtil['stripTrailingSlash'](_0xfb96d[_0xdac9('0x1e')]);_0xfb96d[_0xdac9('0x4d')]=intUtil[_0xdac9('0x4c')](_0xfb96d['serverUrl']);if(_0x3a3cf0&&_0x3a3cf0[_0xdac9('0x66')]&&_0x3a3cf0['recordingFormat']!==_0xdac9('0x67')){logger[_0xdac9('0xe')](_0xdac9('0x68'),_0xdac9('0x50'));_0x3095d5[_0xdac9('0x51')]=util[_0xdac9('0x10')](_0xdac9('0x52'),_0xfb96d[_0xdac9('0x4d')],_0x3095d5['uniqueid'],md5(_0x3095d5[_0xdac9('0x53')]));}headers[_0xdac9('0x54')]=getAuth(_0xfb96d);return getUser(_0xfb96d,_0x320a89[_0xdac9('0x69')])['then'](function(_0x3d8675){_0x5c3bca=_0x3d8675;logger[_0xdac9('0xe')](_0xdac9('0x55'),_0x5c3bca['id']);return getEndUser(_0xfb96d,_0x3095d5[_0xdac9('0x6a')],_0x3095d5[_0xdac9('0x6b')]);})[_0xdac9('0x1a')](function(_0x1817bb){_0x12460b=_0x1817bb;logger[_0xdac9('0xe')](_0xdac9('0x58'),_0x12460b['id']);return getTicket(_0xfb96d,_0x5c3bca,_0x12460b,_0x796b07,_0x3095d5);})[_0xdac9('0x1a')](function(_0xac0db9){if(_0xac0db9){logger[_0xdac9('0xe')](_0xdac9('0x6c'),_0xac0db9['id']);switch(_0xfb96d[_0xdac9('0x47')]){case _0xdac9('0x59'):logger[_0xdac9('0xe')](_0xdac9('0x68'),_0xdac9('0x5a'));return request({'uri':util['format'](_0xdac9('0x5b'),_0xfb96d[_0xdac9('0x1e')],_0x5c3bca['id'],_0xac0db9['id']),'method':_0xdac9('0x12')});case _0xdac9('0x5c'):logger[_0xdac9('0xe')](_0xdac9('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdac9('0x10')](_0xdac9('0x5e'),_0x320a89[_0xdac9('0x15')]),_0xdac9('0x5f'),{'uri':util[_0xdac9('0x10')](_0xdac9('0x60'),_0xfb96d[_0xdac9('0x1e')]['replace'](_0xdac9('0x6d'),''),_0xac0db9['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xdac9('0x6e')](function(_0x449f8f){logger[_0xdac9('0x62')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xdac9('0x6f')](_0x449f8f,{'showHidden':!![],'depth':null}));});};exports[_0xdac9('0x70')]=function(_0x5c7995,_0x413e1b,_0x2fcc83,_0x16c1c1,_0x42d94d,_0x1627be){var _0x2c1aba,_0x5b8cc1;_0x1627be[_0xdac9('0x1e')]=intUtil[_0xdac9('0x4c')](_0x1627be[_0xdac9('0x1e')]);_0x1627be[_0xdac9('0x4d')]=intUtil[_0xdac9('0x4c')](_0x1627be['serverUrl']);if(_0x42d94d&&_0x42d94d['monitor_format']){logger['info']('['+_0x413e1b[_0xdac9('0x71')][_0xdac9('0x72')]()+']',_0xdac9('0x50'));_0x413e1b[_0xdac9('0x51')]=util[_0xdac9('0x10')](_0xdac9('0x52'),_0x1627be[_0xdac9('0x4d')],_0x413e1b['uniqueid'],md5(_0x413e1b[_0xdac9('0x53')]));}else{_0x413e1b['recordingURL']='';}headers[_0xdac9('0x54')]=getAuth(_0x1627be);return getUser(_0x1627be)[_0xdac9('0x1a')](function(_0x1720e1){_0x2c1aba=_0x1720e1;logger[_0xdac9('0xe')](_0xdac9('0x55'),_0x2c1aba['id']);return getEndUser(_0x1627be,_0x413e1b[_0xdac9('0x56')],_0x413e1b['calleridnum']);})[_0xdac9('0x1a')](function(_0xba1aff){_0x5b8cc1=_0xba1aff;logger['info'](_0xdac9('0x58'),_0x5b8cc1['id']);return getTicket(_0x1627be,_0x2c1aba,_0x5b8cc1,_0x2fcc83,_0x413e1b);})[_0xdac9('0x1a')](function(_0x2f5108){if(_0x2f5108){logger[_0xdac9('0xe')](_0xdac9('0x6c'),_0x2f5108['id']);}})[_0xdac9('0x6e')](function(_0x23b4bd){logger[_0xdac9('0x62')]('['+_0x413e1b[_0xdac9('0x71')][_0xdac9('0x72')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xdac9('0x6f')](_0x23b4bd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe07d=['queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','includes','picklist','type','nameField','string','idField','customField','custom_fields','content','variable','variableName','push','Variable','toLowerCase'];(function(_0x2da2ab,_0x18f381){var _0x47a8a9=function(_0x1a99ed){while(--_0x1a99ed){_0x2da2ab['push'](_0x2da2ab['shift']());}};_0x47a8a9(++_0x18f381);}(_0xe07d,0x17b));var _0xde07=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0xe07d[_0xf34109];return _0x570bfc;};'use strict';var _=require(_0xde07('0x0'));var rp=require(_0xde07('0x1'));var md5=require('md5');var util=require(_0xde07('0x2'));var Redis=require(_0xde07('0x3'));var intUtil=require(_0xde07('0x4'));var config=require(_0xde07('0x5'));var logger=require(_0xde07('0x6'))(_0xde07('0x7'));config[_0xde07('0x8')]=_[_0xde07('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xde07('0xa'))(new Redis(config[_0xde07('0x8')]));function emit(_0x35dbd4,_0x498d78,_0x57e908){io['to'](_0x35dbd4)[_0xde07('0xb')](_0x498d78,_0x57e908);}var headers={'Content-Type':'application/json','Accept':_0xde07('0xc')};function getTicket(_0x2f2b75,_0x4f23c0,_0x55eb0b,_0x4b47e4,_0x2b8775){logger[_0xde07('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xde07('0xe')](_0xde07('0xf'),_0x2f2b75[_0xde07('0x10')]),'method':_0xde07('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x55eb0b['id'],'submitter_id':_0x4f23c0?_0x4f23c0['id']:undefined,'assignee_id':_0x4f23c0?_0x4f23c0['id']:undefined,'tags':getTags(_0x4b47e4[_0xde07('0x12')],_0xde07('0x13')),'subject':intUtil[_0xde07('0x14')](_0x4b47e4[_0xde07('0x15')],_0x2b8775,'\x20'),'description':intUtil[_0xde07('0x14')](_0x4b47e4[_0xde07('0x16')],_0x2b8775,'\x0a'),'comment':{'public':![],'body':intUtil[_0xde07('0x14')](_0x4b47e4[_0xde07('0x16')],_0x2b8775,'\x0a')}},getCustomFields(_0x4b47e4[_0xde07('0x17')],_0x2b8775))}})[_0xde07('0x18')](function(_0x3a8b94){logger['info'](_0xde07('0x19'));return _0x3a8b94['ticket'];});}function getUser(_0x569f97,_0x1eb315){if(intUtil[_0xde07('0x1a')](_0x1eb315)){logger[_0xde07('0xd')](_0xde07('0x1b'),_0x1eb315);return request({'uri':util['format'](_0xde07('0x1c'),_0x569f97[_0xde07('0x10')]),'qs':{'query':util[_0xde07('0xe')](_0xde07('0x1d'),_0x1eb315)}})['then'](function(_0xf8ed1b){if(_0xf8ed1b[_0xde07('0x1e')]){logger[_0xde07('0xd')]('Agent\x20found!');return _[_0xde07('0x1f')](_0xf8ed1b[_0xde07('0x20')],{'email':_0x1eb315,'role':_0xde07('0x21')});}else{logger['info'](_0xde07('0x22'));return request({'uri':util[_0xde07('0xe')](_0xde07('0x23'),_0x569f97['remoteUri'])})[_0xde07('0x18')](function(_0x1bc03b){logger[_0xde07('0xd')](_0xde07('0x24'));return _0x1bc03b['user'];});}});}else{logger[_0xde07('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xde07('0xe')]('%s/users/me.json',_0x569f97[_0xde07('0x10')])})['then'](function(_0x1ca746){logger[_0xde07('0xd')](_0xde07('0x24'));return _0x1ca746[_0xde07('0x25')];});}}function getEndUser(_0x5233cb,_0x26ef5a,_0x4e90b9){logger[_0xde07('0xd')](_0xde07('0x26'),_0x4e90b9);return request({'uri':util[_0xde07('0xe')](_0xde07('0x1c'),_0x5233cb[_0xde07('0x10')]),'qs':{'query':util[_0xde07('0xe')](_0xde07('0x27'),_0x4e90b9)}})['then'](function(_0x5082ea){var _0x33e50d;if(_0x5082ea[_0xde07('0x20')][_0xde07('0x28')]){_0x5082ea[_0xde07('0x20')]=_[_0xde07('0x29')](_0x5082ea['results'],{'suspended':![],'role':_0xde07('0x2a')});if(_0x5082ea[_0xde07('0x20')][_0xde07('0x28')]){_0x33e50d=_[_0xde07('0x2b')](_0x5082ea[_0xde07('0x20')]);}}if(_0x33e50d){logger['info'](_0xde07('0x2c'));return _0x33e50d;}else{logger[_0xde07('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xde07('0xe')](_0xde07('0x2d'),_0x5233cb[_0xde07('0x10')]),'method':_0xde07('0x11'),'body':{'user':{'role':_0xde07('0x2a'),'name':util[_0xde07('0xe')]('Caller\x20-\x20%s',_0x26ef5a||_0x4e90b9),'phone':_0x4e90b9}}})[_0xde07('0x18')](function(_0x43f4e5){logger['info']('Enduser\x20created.');return _0x43f4e5[_0xde07('0x25')];});}});}function getAuth(_0x1c44e0){var _0x3e3f7a;if(_0x1c44e0['authType']===_0xde07('0x2e')){_0x3e3f7a=util[_0xde07('0xe')](_0xde07('0x2f'),_0x1c44e0[_0xde07('0x30')],_0x1c44e0['password']);}else if(_0x1c44e0[_0xde07('0x31')]==='token'){_0x3e3f7a=util[_0xde07('0xe')](_0xde07('0x32'),_0x1c44e0['username'],_0x1c44e0[_0xde07('0x33')]);}return util[_0xde07('0xe')](_0xde07('0x34'),new Buffer(_0x3e3f7a)[_0xde07('0x35')](_0xde07('0x36')));}function request(_0x297e6b){logger[_0xde07('0x37')](_0xde07('0x38'),JSON[_0xde07('0x39')](_0x297e6b));return rp(_['defaults'](_0x297e6b,{'method':_0xde07('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x5d8e1a,_0x48e5d3){var _0x4d8a81=[];if(_0x5d8e1a&&_0x5d8e1a[_0xde07('0x28')]>0x0){_0x4d8a81=_['map'](_0x5d8e1a,_0x48e5d3);}return _0x4d8a81;}function getCustomFields(_0x48cd47,_0x580936){var _0x46ff2d=[];var _0x1322fa={'custom_fields':[]};if(_0x48cd47[_0xde07('0x28')]>0x0){_['forEach'](_0x48cd47,function(_0x5cf882){if(_[_0xde07('0x3b')](['string',_0xde07('0x3c')],_0x5cf882[_0xde07('0x3d')])&&_0x5cf882[_0xde07('0x3e')]&&!_0x5cf882['customField']){_0x1322fa[_0x5cf882['nameField']['toLowerCase']()]=_0x5cf882['content'][_0xde07('0x35')]();}else if(_[_0xde07('0x3b')]([_0xde07('0x3f'),'picklist'],_0x5cf882[_0xde07('0x3d')])&&_0x5cf882[_0xde07('0x40')]&&_0x5cf882[_0xde07('0x41')]){_0x1322fa[_0xde07('0x42')]['push']({'id':_0x5cf882[_0xde07('0x40')],'value':_0x5cf882[_0xde07('0x43')][_0xde07('0x35')]()});}else if(_0x5cf882[_0xde07('0x3d')]===_0xde07('0x44')&&_0x5cf882[_0xde07('0x45')]&&_0x5cf882[_0xde07('0x40')]&&_0x5cf882[_0xde07('0x41')]){_0x580936[_0x5cf882[_0xde07('0x45')]]&&_0x1322fa[_0xde07('0x42')][_0xde07('0x46')]({'id':_0x5cf882[_0xde07('0x40')],'value':_0x580936[_0x5cf882[_0xde07('0x45')]][_0xde07('0x35')]()});}else if(_0x5cf882[_0xde07('0x3d')]==='customVariable'&&_0x5cf882['Variable']&&_0x5cf882[_0xde07('0x47')][_0xde07('0x13')]&&_0x5cf882[_0xde07('0x40')]&&_0x5cf882[_0xde07('0x41')]){_0x580936[_0x5cf882[_0xde07('0x47')]['name'][_0xde07('0x48')]()]&&_0x1322fa['custom_fields'][_0xde07('0x46')]({'id':_0x5cf882[_0xde07('0x40')],'value':_0x580936[_0x5cf882[_0xde07('0x47')][_0xde07('0x13')][_0xde07('0x48')]()][_0xde07('0x35')]()});}});}return _0x1322fa;}exports[_0xde07('0x49')]=function(_0x2144df,_0x5b18b0,_0x2b8253,_0xafc15e,_0x319101,_0x2a576b){var _0x17bbd9,_0x4226ee;_0x2a576b[_0xde07('0x10')]=intUtil[_0xde07('0x4a')](_0x2a576b[_0xde07('0x10')]);_0x2a576b[_0xde07('0x4b')]=intUtil['stripTrailingSlash'](_0x2a576b[_0xde07('0x4b')]);if(_0x319101&&_0x319101[_0xde07('0x4c')]){logger['info'](_0xde07('0x4d'),'Recording\x20is\x20enabled!');_0x5b18b0['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a576b[_0xde07('0x4b')],_0x5b18b0[_0xde07('0x4e')],md5(_0x5b18b0[_0xde07('0x4e')]));}else{_0x5b18b0[_0xde07('0x4f')]='';}headers[_0xde07('0x50')]=getAuth(_0x2a576b);return getUser(_0x2a576b,_0xafc15e[_0xde07('0x51')])[_0xde07('0x18')](function(_0x2341e7){_0x17bbd9=_0x2341e7;logger['info'](_0xde07('0x52'),_0x17bbd9['id']);return getEndUser(_0x2a576b,_0x5b18b0[_0xde07('0x53')],_0x5b18b0[_0xde07('0x54')]);})[_0xde07('0x18')](function(_0x4ef5d9){_0x4226ee=_0x4ef5d9;logger[_0xde07('0xd')](_0xde07('0x55'),_0x4226ee['id']);return getTicket(_0x2a576b,_0x17bbd9,_0x4226ee,_0x2b8253,_0x5b18b0);})[_0xde07('0x18')](function(_0x1f92c1){if(_0x1f92c1){logger['info'](_0xde07('0x56'),_0x1f92c1['id']);switch(_0x2a576b[_0xde07('0x3d')]){case'integrationTab':logger['info'](_0xde07('0x4d'),_0xde07('0x57'));return request({'uri':util[_0xde07('0xe')](_0xde07('0x58'),_0x2a576b[_0xde07('0x10')],_0x17bbd9['id'],_0x1f92c1['id']),'method':_0xde07('0x11')});case _0xde07('0x59'):logger[_0xde07('0xd')](_0xde07('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0xafc15e['name']),'trigger:browser:url',{'uri':util[_0xde07('0xe')]('%s/agent/tickets/%s',_0x2a576b[_0xde07('0x10')][_0xde07('0x5a')](_0xde07('0x5b'),''),_0x1f92c1['id'])});break;default:logger[_0xde07('0x5c')](_0xde07('0x4d'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xde07('0x5d')](function(_0x340f4d){logger[_0xde07('0x5c')](_0xde07('0x5e'),util[_0xde07('0x5f')](_0x340f4d,{'showHidden':!![],'depth':null}));});};exports[_0xde07('0x60')]=function(_0x51f62d,_0x12ea77,_0x158988,_0x588f83,_0x3b15ac,_0x2ba02f,_0x2d346d){var _0xf77371,_0x39ade9;_0x2ba02f[_0xde07('0x10')]=intUtil[_0xde07('0x4a')](_0x2ba02f['remoteUri']);_0x2ba02f[_0xde07('0x4b')]=intUtil[_0xde07('0x4a')](_0x2ba02f[_0xde07('0x4b')]);if(_0x2d346d&&_0x2d346d[_0xde07('0x61')]&&_0x2d346d[_0xde07('0x61')]!==_0xde07('0x62')){logger[_0xde07('0xd')](_0xde07('0x63'),'Recording\x20is\x20enabled!');_0x12ea77[_0xde07('0x4f')]=util[_0xde07('0xe')](_0xde07('0x64'),_0x2ba02f['serverUrl'],_0x12ea77['uniqueid'],md5(_0x12ea77[_0xde07('0x4e')]));}headers['Authorization']=getAuth(_0x2ba02f);return getUser(_0x2ba02f,_0x588f83[_0xde07('0x51')])[_0xde07('0x18')](function(_0x52b60a){_0xf77371=_0x52b60a;logger[_0xde07('0xd')](_0xde07('0x52'),_0xf77371['id']);return getEndUser(_0x2ba02f,_0x12ea77[_0xde07('0x65')],_0x12ea77[_0xde07('0x66')]);})[_0xde07('0x18')](function(_0xabb9bb){_0x39ade9=_0xabb9bb;logger[_0xde07('0xd')](_0xde07('0x55'),_0x39ade9['id']);return getTicket(_0x2ba02f,_0xf77371,_0x39ade9,_0x158988,_0x12ea77);})['then'](function(_0x35037c){if(_0x35037c){logger['info'](_0xde07('0x56'),_0x35037c['id']);switch(_0x2ba02f[_0xde07('0x3d')]){case _0xde07('0x67'):logger[_0xde07('0xd')](_0xde07('0x63'),_0xde07('0x57'));return request({'uri':util[_0xde07('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2ba02f['remoteUri'],_0xf77371['id'],_0x35037c['id']),'method':'POST'});case _0xde07('0x59'):logger[_0xde07('0xd')](_0xde07('0x63'),_0xde07('0x68'));emit(util['format']('user:%s',_0x588f83['name']),_0xde07('0x69'),{'uri':util[_0xde07('0xe')](_0xde07('0x6a'),_0x2ba02f['remoteUri'][_0xde07('0x5a')](_0xde07('0x5b'),''),_0x35037c['id'])});break;default:logger['error'](_0xde07('0x63'),_0xde07('0x6b'));}}})[_0xde07('0x5d')](function(_0x2ef030){logger[_0xde07('0x5c')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2ef030,{'showHidden':!![],'depth':null}));});};exports[_0xde07('0x6c')]=function(_0x2f08e6,_0x28568b,_0x47807d,_0x19b187,_0x293fe4,_0x19c4ef){var _0xbb41af,_0x481128;_0x19c4ef['remoteUri']=intUtil[_0xde07('0x4a')](_0x19c4ef[_0xde07('0x10')]);_0x19c4ef['serverUrl']=intUtil['stripTrailingSlash'](_0x19c4ef[_0xde07('0x4b')]);if(_0x293fe4&&_0x293fe4[_0xde07('0x4c')]){logger[_0xde07('0xd')]('['+_0x28568b[_0xde07('0x6d')][_0xde07('0x6e')]()+']',_0xde07('0x6f'));_0x28568b['recordingURL']=util[_0xde07('0xe')](_0xde07('0x64'),_0x19c4ef[_0xde07('0x4b')],_0x28568b[_0xde07('0x4e')],md5(_0x28568b[_0xde07('0x4e')]));}else{_0x28568b[_0xde07('0x4f')]='';}headers[_0xde07('0x50')]=getAuth(_0x19c4ef);return getUser(_0x19c4ef)[_0xde07('0x18')](function(_0x35fe10){_0xbb41af=_0x35fe10;logger[_0xde07('0xd')](_0xde07('0x52'),_0xbb41af['id']);return getEndUser(_0x19c4ef,_0x28568b[_0xde07('0x53')],_0x28568b[_0xde07('0x54')]);})[_0xde07('0x18')](function(_0x5da2d4){_0x481128=_0x5da2d4;logger['info']('The\x20Enduser\x20ID\x20is:',_0x481128['id']);return getTicket(_0x19c4ef,_0xbb41af,_0x481128,_0x47807d,_0x28568b);})[_0xde07('0x18')](function(_0x56d25f){if(_0x56d25f){logger[_0xde07('0xd')](_0xde07('0x56'),_0x56d25f['id']);}})[_0xde07('0x5d')](function(_0x385234){logger[_0xde07('0x5c')]('['+_0x28568b[_0xde07('0x6d')][_0xde07('0x6e')]()+']'+_0xde07('0x70'),util[_0xde07('0x5f')](_0x385234,{'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 c8b8195..5bd1b1c 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 _0xcbdd=['contact','lead','Creating\x20new\x20call...','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','uniqueid','lodash','md5','util','./util','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','data','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing'];(function(_0x1dcea6,_0x5a24f6){var _0x560c0c=function(_0x282025){while(--_0x282025){_0x1dcea6['push'](_0x1dcea6['shift']());}};_0x560c0c(++_0x5a24f6);}(_0xcbdd,0xec));var _0xdcbd=function(_0x571fbd,_0x19bced){_0x571fbd=_0x571fbd-0x0;var _0xf6152=_0xcbdd[_0x571fbd];return _0xf6152;};'use strict';var _=require(_0xdcbd('0x0'));var rp=require('request-promise');var md5=require(_0xdcbd('0x1'));var util=require(_0xdcbd('0x2'));var intUtil=require(_0xdcbd('0x3'));var moment=require('moment');var Redis=require(_0xdcbd('0x4'));var BPromise=require(_0xdcbd('0x5'));var config=require(_0xdcbd('0x6'));var logger=require('../../../../config/logger')(_0xdcbd('0x7'));config['redis']=_[_0xdcbd('0x8')](config[_0xdcbd('0x9')],{'host':_0xdcbd('0xa'),'port':0x18eb});var io=require(_0xdcbd('0xb'))(new Redis(config[_0xdcbd('0x9')]));function emit(_0x3dcc40,_0x852ee2,_0x915cd6){io['to'](_0x3dcc40)['emit'](_0x852ee2,_0x915cd6);}function request(_0x5ded4a){logger[_0xdcbd('0xc')](_0xdcbd('0xd'),JSON[_0xdcbd('0xe')](_0x5ded4a));return rp(_0x5ded4a);}function getCustomFields(_0x165a4d,_0x272a59){var _0x1c7d77={};if(_0x165a4d[_0xdcbd('0xf')]>0x0){_[_0xdcbd('0x10')](_0x165a4d,function(_0x28d006){if(_[_0xdcbd('0x11')]([_0xdcbd('0x12'),_0xdcbd('0x13')],_0x28d006[_0xdcbd('0x14')])&&_0x28d006[_0xdcbd('0x15')]){_0x1c7d77[_0x28d006[_0xdcbd('0x15')]]=_0x28d006[_0xdcbd('0x16')][_0xdcbd('0x17')]();}else if(_0x28d006[_0xdcbd('0x14')]===_0xdcbd('0x18')&&_0x28d006['variableName']&&_0x28d006[_0xdcbd('0x15')]&&_0x272a59[_0x28d006[_0xdcbd('0x19')]]){_0x1c7d77[_0x28d006[_0xdcbd('0x15')]]=_0x272a59[_0x28d006[_0xdcbd('0x19')]][_0xdcbd('0x17')]();}else if(_0x28d006['type']===_0xdcbd('0x1a')&&_0x28d006['Variable']&&_0x28d006[_0xdcbd('0x1b')]['name']&&_0x28d006[_0xdcbd('0x15')]&&_0x272a59[_0x28d006[_0xdcbd('0x1b')]['name'][_0xdcbd('0x1c')]()]){_0x1c7d77[_0x28d006['idField']]=_0x272a59[_0x28d006[_0xdcbd('0x1b')][_0xdcbd('0x1d')][_0xdcbd('0x1c')]()]['toString']();}});}return _0x1c7d77;}function getName(_0x5c8f6c){if(_0x5c8f6c[_0xdcbd('0x1e')]('\x20')>0x0){var _0x2d4e2d=_0x5c8f6c[_0xdcbd('0x1f')](/ (.+)/);if(_0x2d4e2d[0x1]){return _0x2d4e2d;}}return[_0x5c8f6c,_0x5c8f6c];}var accountsTokens={};function getAccessToken(_0x460b92){return new Promise(function(_0x51f41e,_0x598d4a){if(!_[_0xdcbd('0x20')](accountsTokens[_0x460b92['id']])&&!_[_0xdcbd('0x20')](accountsTokens[_0x460b92['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x460b92['id']][_0xdcbd('0x21')])){_0x51f41e(accountsTokens[_0x460b92['id']][_0xdcbd('0x22')]);}}var _0x508740;switch(_0x460b92[_0xdcbd('0x23')]){case'US':_0x508740=_0xdcbd('0x24');break;case'AU':_0x508740=_0xdcbd('0x25');break;case'EU':_0x508740=_0xdcbd('0x26');break;case'IN':_0x508740=_0xdcbd('0x27');break;case'CN':_0x508740=_0xdcbd('0x28');break;default:_0x508740='https://accounts.zoho.eu';break;}var _0x328da8={'method':_0xdcbd('0x29'),'uri':_0x508740+'/oauth/v2/token','qs':{'refresh_token':_0x460b92[_0xdcbd('0x2a')],'client_id':_0x460b92['clientId'],'client_secret':_0x460b92[_0xdcbd('0x2b')],'grant_type':_0xdcbd('0x2c')},'json':!![]};return rp(_0x328da8)[_0xdcbd('0x2d')](function(_0x3ac9f4){accountsTokens[_0x460b92['id']]={'access_token':_0x3ac9f4[_0xdcbd('0x22')],'expires_in':moment()['add'](_0x3ac9f4['expires_in'],_0xdcbd('0x2e'))};_0x51f41e(_0x3ac9f4[_0xdcbd('0x22')]);})['catch'](function(_0x285100){logger[_0xdcbd('0x2f')](_0xdcbd('0x30'),_0x285100[_0xdcbd('0x31')]);_0x598d4a(_0x285100);});});}function getUser(_0x493311,_0x2d4205,_0x1a4e90,_0xb2c44f){logger[_0xdcbd('0x32')](_0xdcbd('0x33'));return request({'method':'GET','uri':util[_0xdcbd('0x34')](_0xdcbd('0x35'),_0x2d4205),'qs':{'type':_0xdcbd('0x36')},'headers':{'Authorization':_0xdcbd('0x37')+_0x493311},'json':!![]})[_0xdcbd('0x2d')](function(_0x44d665){if(_0x44d665[_0xdcbd('0x38')]){var _0x2ea4d7=-0x1;if(_[_0xdcbd('0x39')](_0x44d665[_0xdcbd('0x38')])){if(!_[_0xdcbd('0x20')](_0xb2c44f)){_0x2ea4d7=_[_0xdcbd('0x3a')](_0x44d665['users'],function(_0x54b5fb){return _0x54b5fb[_0xdcbd('0x3b')]===_0xb2c44f;});}if(_0x2ea4d7>=0x0){logger[_0xdcbd('0x32')]('Agent\x20found!');}else{logger[_0xdcbd('0x32')](_0xdcbd('0x3c'));_0x2ea4d7=_[_0xdcbd('0x3a')](_0x44d665[_0xdcbd('0x38')],function(_0x5de7c9){return _0x5de7c9[_0xdcbd('0x3d')][_0xdcbd('0x1d')]===_0xdcbd('0x3e');});}return _0x44d665[_0xdcbd('0x38')][_0x2ea4d7];}else{if(_0x44d665['user'][_0xdcbd('0x3d')][_0xdcbd('0x1d')]==='Administrator'){logger[_0xdcbd('0x32')](_0xdcbd('0x3c'));user=_0x44d665[_0xdcbd('0x3f')];return user;}else{logger[_0xdcbd('0x2f')](_0xdcbd('0x40'),JSON[_0xdcbd('0xe')](_0x44d665));throw new Error(_0xdcbd('0x41')+JSON[_0xdcbd('0xe')](_0x44d665));}}}else{logger['error'](_0xdcbd('0x40'),JSON[_0xdcbd('0xe')](_0x44d665));throw new Error(_0xdcbd('0x41')+JSON['stringify'](_0x44d665));}})['catch'](function(_0x51e096){console[_0xdcbd('0x2f')](_0x51e096);});}function getZohoUser(_0x37cb8e,_0x4523be){return new BPromise(function(_0x2e2d86,_0x5f0b14){request(_0x37cb8e)[_0xdcbd('0x2d')](function(_0x251ecb){var _0x1410ea=null;if(_0x251ecb){_0x1410ea=_0x251ecb['data'][0x0];_0x1410ea[_0xdcbd('0x42')]=_0x4523be;}_0x2e2d86(_0x1410ea);})[_0xdcbd('0x43')](function(_0x2a6a60){_0x5f0b14(_0x2a6a60);});});}function createEndUser(_0x1ae4c7,_0x374f4b,_0x4bb9d7,_0x130407,_0x207544,_0x409a69){var _0x4bb9d7=getName(_0x4bb9d7);return request({'method':_0xdcbd('0x29'),'uri':_0xdcbd('0x44')+_0x374f4b+_0xdcbd('0x45')+_[_0xdcbd('0x46')](_0x409a69[_0xdcbd('0x47')])+'s','body':{'data':[{'Last_Name':_0x4bb9d7[0x1],'First_Name':_0x4bb9d7[0x0],'Phone':_0x130407,'Owner':{'name':!_[_0xdcbd('0x20')](_0x207544[_0xdcbd('0x48')]['name'])?_0x207544['role'][_0xdcbd('0x1d')]:!_[_0xdcbd('0x20')](_0x207544[_0xdcbd('0x49')])?_0x207544[_0xdcbd('0x49')]+'\x20'+_0x207544[_0xdcbd('0x4a')]:_0x207544[_0xdcbd('0x4a')],'id':_0x207544['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1ae4c7},'json':!![]})[_0xdcbd('0x2d')](function(_0x2c3f30){if(_0x2c3f30&&_0x2c3f30['data'][0x0][_0xdcbd('0x4b')]===_0xdcbd('0x4c')){var _0xb1b23c=_0x2c3f30[_0xdcbd('0x4d')][0x0]['details'];_0xb1b23c[_0xdcbd('0x42')]=_['startCase'](_0x409a69['moduleCreate'])+'s';return _0xb1b23c;}logger[_0xdcbd('0x2f')](_0xdcbd('0x40'),JSON[_0xdcbd('0xe')](data));throw new Error('Error:\x20'+JSON[_0xdcbd('0xe')](data));})[_0xdcbd('0x43')](function(_0x350703){console[_0xdcbd('0x4e')](_0xdcbd('0x4f'),_0x350703);});}function getEndUser(_0x55799c,_0x1e7f35,_0x29c7c7,_0x37995f,_0x2241f9,_0x23ea2b,_0x33e5fc){var _0x277a5a={'method':_0xdcbd('0x50'),'uri':'','headers':{'Authorization':_0xdcbd('0x37')+_0x55799c},'json':!![]};switch(_0x33e5fc[_0xdcbd('0x51')]){case _0xdcbd('0x52'):_0x277a5a[_0xdcbd('0x53')]='https://www.zohoapis.'+_0x1e7f35+_0xdcbd('0x54')+_0x2241f9+'))';return getZohoUser(_0x277a5a,'Contacts')[_0xdcbd('0x2d')](function(_0x27e3fe){if(_0x27e3fe)return _0x27e3fe;_0x277a5a[_0xdcbd('0x53')]=_0xdcbd('0x44')+_0x1e7f35+_0xdcbd('0x55')+_0x2241f9+'))';return getZohoUser(_0x277a5a,_0xdcbd('0x56'))[_0xdcbd('0x2d')](function(_0x5e5fcc){if(_0x5e5fcc)return _0x5e5fcc;if(_0x33e5fc['moduleCreate']!=_0xdcbd('0x57')){return createEndUser(_0x55799c,_0x1e7f35,_0x37995f,_0x2241f9,_0x23ea2b,_0x33e5fc);}else{return{};}});});break;case _0xdcbd('0x58'):_0x277a5a['uri']=_0xdcbd('0x44')+_0x1e7f35+_0xdcbd('0x54')+_0x2241f9+'))';return getZohoUser(_0x277a5a,'Contacts')[_0xdcbd('0x2d')](function(_0x47262f){if(_0x47262f)return _0x47262f;if(_0x33e5fc['moduleCreate']!=_0xdcbd('0x57')){return createEndUser(_0x55799c,_0x1e7f35,_0x37995f,_0x2241f9,_0x23ea2b,_0x33e5fc);}else{return{};}});break;case _0xdcbd('0x59'):_0x277a5a[_0xdcbd('0x53')]=_0xdcbd('0x44')+_0x1e7f35+_0xdcbd('0x55')+_0x2241f9+'))';return getZohoUser(_0x277a5a,_0xdcbd('0x56'))['then'](function(_0x3667e5){if(_0x3667e5)return _0x3667e5;if(_0x33e5fc['moduleCreate']!=_0xdcbd('0x57')){return createEndUser(_0x55799c,_0x1e7f35,_0x37995f,_0x2241f9,_0x23ea2b,_0x33e5fc);}else{return{};}});break;}}function getCall(_0x5998cf,_0x15edbb,_0x3aefc2,_0x1f7e8e,_0x4b2d70,_0x4629f5,_0x39da5b,_0x4fa6eb){logger['info'](_0xdcbd('0x5a'));var _0x2bc19a={};_0x2bc19a['Owner']={'name':!_[_0xdcbd('0x20')](_0x1f7e8e[_0xdcbd('0x48')][_0xdcbd('0x1d')])&&!_[_0xdcbd('0x20')](_0x1f7e8e['profile']['name'])&&_0x1f7e8e[_0xdcbd('0x3d')][_0xdcbd('0x1d')]==='administrator'?_0x1f7e8e[_0xdcbd('0x48')][_0xdcbd('0x1d')]:!_[_0xdcbd('0x20')](_0x1f7e8e[_0xdcbd('0x49')])?_0x1f7e8e[_0xdcbd('0x49')]+'\x20'+_0x1f7e8e[_0xdcbd('0x4a')]:_0x1f7e8e[_0xdcbd('0x4a')],'id':_0x1f7e8e['id']};_0x2bc19a[_0xdcbd('0x5b')]=intUtil[_0xdcbd('0x5c')](_0x4629f5[_0xdcbd('0x5d')],_0x39da5b,'\x20');_0x2bc19a[_0xdcbd('0x5e')]=intUtil[_0xdcbd('0x5c')](_0x4629f5[_0xdcbd('0x5f')],_0x39da5b,'\x0a');if(_0x4b2d70[_0xdcbd('0x42')]==='Contacts'){_0x2bc19a[_0xdcbd('0x60')]={'name':!_[_0xdcbd('0x20')](_0x4b2d70[_0xdcbd('0x61')])?_0x4b2d70[_0xdcbd('0x61')]:!_[_0xdcbd('0x20')](_0x4b2d70['First_Name'])?_0x4b2d70[_0xdcbd('0x62')]+'\x20'+_0x4b2d70[_0xdcbd('0x63')]:_0x4b2d70[_0xdcbd('0x63')],'id':_0x4b2d70['id']};}if(_0x4b2d70[_0xdcbd('0x42')]===_0xdcbd('0x56')){_0x2bc19a[_0xdcbd('0x64')]={'name':!_[_0xdcbd('0x20')](_0x4b2d70[_0xdcbd('0x61')])?_0x4b2d70[_0xdcbd('0x61')]:!_[_0xdcbd('0x20')](_0x4b2d70[_0xdcbd('0x62')])?_0x4b2d70[_0xdcbd('0x62')]+'\x20'+_0x4b2d70[_0xdcbd('0x63')]:_0x4b2d70[_0xdcbd('0x63')],'id':_0x4b2d70['id']};_0x2bc19a[_0xdcbd('0x65')]=_[_0xdcbd('0x46')](_0x4b2d70[_0xdcbd('0x42')]);}if(_0x39da5b[_0xdcbd('0x66')]){_0x2bc19a[_0xdcbd('0x67')]=moment[_0xdcbd('0x68')](parseInt(_0x39da5b[_0xdcbd('0x66')])*0x3e8)[_0xdcbd('0x34')](_0xdcbd('0x69'));}else if(_0x39da5b[_0xdcbd('0x6a')]&&_0x39da5b[_0xdcbd('0x6b')]){_0x2bc19a[_0xdcbd('0x67')]=moment['utc'](moment(_0x39da5b[_0xdcbd('0x6b')],_0xdcbd('0x6c'))[_0xdcbd('0x6d')](moment(_0x39da5b[_0xdcbd('0x6e')],_0xdcbd('0x6c'))))[_0xdcbd('0x34')]('mm:ss');}switch(_0x39da5b[_0xdcbd('0x6f')]){case'called':_0x2bc19a[_0xdcbd('0x70')]=_0xdcbd('0x71');break;case _0xdcbd('0x72'):case _0xdcbd('0x73'):_0x2bc19a[_0xdcbd('0x70')]=_0xdcbd('0x74');break;case _0xdcbd('0x75'):_0x2bc19a[_0xdcbd('0x70')]=_0xdcbd('0x76');break;case _0xdcbd('0x77'):_0x2bc19a['Call_Result']=_0xdcbd('0x78');break;case _0xdcbd('0x79'):_0x2bc19a[_0xdcbd('0x70')]=_0xdcbd('0x7a');default:}_0x2bc19a['Call_Start_Time']=(_0x4fa6eb===_0xdcbd('0x7b')?moment(_0x39da5b[_0xdcbd('0x6e')])[_0xdcbd('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x39da5b[_0xdcbd('0x7c')])['format'](_0xdcbd('0x6c')))||moment()['format'](_0xdcbd('0x6c'));_0x2bc19a[_0xdcbd('0x7d')]=_0x4fa6eb||'Inbound';_0x2bc19a=_[_0xdcbd('0x7e')](_0x2bc19a,getCustomFields(_0x4629f5[_0xdcbd('0x7f')],_0x39da5b));return request({'method':_0xdcbd('0x29'),'uri':_0xdcbd('0x44')+_0x15edbb+_0xdcbd('0x80'),'headers':{'Authorization':_0xdcbd('0x37')+_0x5998cf},'body':{'data':[_0x2bc19a]},'json':!![]})['then'](function(_0x3fcc07){if(_0x3fcc07&&_0x3fcc07[_0xdcbd('0x4d')][0x0][_0xdcbd('0x4b')]==='SUCCESS'){logger[_0xdcbd('0x32')](_0xdcbd('0x81'));return{'id':_0x3fcc07[_0xdcbd('0x4d')][0x0][_0xdcbd('0x82')]['id']};}})[_0xdcbd('0x43')](function(_0x517181){logger[_0xdcbd('0x32')](_0xdcbd('0x83'),_0x517181[_0xdcbd('0x31')]);console[_0xdcbd('0x4e')](_0xdcbd('0x83'),_0x517181);});}exports[_0xdcbd('0x84')]=function(_0x58cbf6,_0x3d7d37,_0x3ceb51,_0x525790,_0x346ca5,_0x7ba76e){var _0x197207,_0x50cdec,_0x4501e5;_0x7ba76e['host']=intUtil[_0xdcbd('0x85')](_0x7ba76e[_0xdcbd('0x86')]);_0x7ba76e[_0xdcbd('0x87')]=intUtil[_0xdcbd('0x85')](_0x7ba76e[_0xdcbd('0x87')]);if(_0x346ca5&&_0x346ca5[_0xdcbd('0x88')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x3d7d37[_0xdcbd('0x89')]=_0x7ba76e[_0xdcbd('0x87')]+_0xdcbd('0x8a')+_0x3d7d37['uniqueid']+_0xdcbd('0x8b')+md5(_0x3d7d37['uniqueid']);}else{_0x3d7d37[_0xdcbd('0x89')]='';}var _0x21c22a=_0x7ba76e[_0xdcbd('0x86')]===_0xdcbd('0x8c')?'eu':_0xdcbd('0x8d');return getAccessToken(_0x7ba76e)['then'](function(_0x5edcab){_0x4501e5=_0x5edcab;return getUser(_0x4501e5,_0x21c22a,_0x7ba76e,_0x525790[_0xdcbd('0x3b')]);})['then'](function(_0x5da084){_0x197207=_0x5da084;logger[_0xdcbd('0x32')](_0xdcbd('0x8e'),_0x197207['id']);return getEndUser(_0x4501e5,_0x21c22a,_0x7ba76e,_0x3d7d37[_0xdcbd('0x8f')],_0x3d7d37[_0xdcbd('0x90')],_0x197207,_0x3ceb51);})[_0xdcbd('0x2d')](function(_0x276c53){_0x50cdec=_0x276c53;return getCall(_0x4501e5,_0x21c22a,_0x7ba76e,_0x197207,_0x50cdec,_0x3ceb51,_0x3d7d37,_0xdcbd('0x91'));})['then'](function(_0x315db8){if(_0x315db8){logger[_0xdcbd('0x32')](_0xdcbd('0x92'),_0x315db8['id']);logger['info'](_0xdcbd('0x93'),_0xdcbd('0x94'));emit(util[_0xdcbd('0x34')](_0xdcbd('0x95'),_0x525790[_0xdcbd('0x1d')]),_0xdcbd('0x96'),{'uri':_0xdcbd('0x97')+_0x7ba76e[_0xdcbd('0x86')]+'/crm/EntityInfo.do?module=Calls&id='+_0x315db8['id']});}})[_0xdcbd('0x43')](function(_0x3795b5){logger['error'](_0xdcbd('0x93'),JSON[_0xdcbd('0xe')](_0x3795b5));});};exports[_0xdcbd('0x7b')]=function(_0x26dfc0,_0x410839,_0x3fd1dd,_0x34554a,_0x231d8a,_0x18d41d,_0x52bb63){var _0xff04d2,_0xa2b16f,_0x4d598d;_0x18d41d[_0xdcbd('0x86')]=intUtil['stripTrailingSlash'](_0x18d41d[_0xdcbd('0x86')]);_0x18d41d[_0xdcbd('0x87')]=intUtil['stripTrailingSlash'](_0x18d41d['serverUrl']);if(_0x52bb63&&_0x52bb63[_0xdcbd('0x98')]&&_0x52bb63[_0xdcbd('0x98')]!==_0xdcbd('0x99')){logger[_0xdcbd('0x32')](_0xdcbd('0x9a'),_0xdcbd('0x9b'));_0x410839[_0xdcbd('0x89')]=_0x18d41d[_0xdcbd('0x87')]+_0xdcbd('0x8a')+_0x410839['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x410839['uniqueid']);}var _0x5a08d9=_0x18d41d[_0xdcbd('0x86')]===_0xdcbd('0x8c')?'eu':'com';return getAccessToken(_0x18d41d)[_0xdcbd('0x2d')](function(_0x34a067){_0x4d598d=_0x34a067;return getUser(_0x4d598d,_0x5a08d9,_0x18d41d,_0x34554a['email']);})[_0xdcbd('0x2d')](function(_0x12d424){_0xff04d2=_0x12d424;logger[_0xdcbd('0x32')]('The\x20User\x20ID\x20is:',_0xff04d2['id']);return getEndUser(_0x4d598d,_0x5a08d9,_0x18d41d,_0x410839[_0xdcbd('0x9c')],_0x410839[_0xdcbd('0x9d')],_0xff04d2,_0x3fd1dd);})[_0xdcbd('0x2d')](function(_0xef0742){_0xa2b16f=_0xef0742;return getCall(_0x4d598d,_0x5a08d9,_0x18d41d,_0xff04d2,_0xa2b16f,_0x3fd1dd,_0x410839,_0xdcbd('0x9e'));})[_0xdcbd('0x2d')](function(_0x1a99e8){if(_0x1a99e8){logger[_0xdcbd('0x32')](_0xdcbd('0x92'),_0x1a99e8['id']);logger['info'](_0xdcbd('0x9a'),_0xdcbd('0x94'));emit(util['format'](_0xdcbd('0x95'),_0x34554a[_0xdcbd('0x1d')]),_0xdcbd('0x96'),{'uri':_0xdcbd('0x97')+_0x18d41d[_0xdcbd('0x86')]+_0xdcbd('0x9f')+_0x1a99e8['id']});}})[_0xdcbd('0x43')](function(_0x93f2ce){logger['error'](_0xdcbd('0x9a'),JSON[_0xdcbd('0xe')](_0x93f2ce));});};exports[_0xdcbd('0xa0')]=function(_0x2ff535,_0x2f2c72,_0x294408,_0x1e87ce,_0x4b7544,_0x4c80bc){var _0x164ef9,_0x5c484d,_0x347107;_0x4c80bc[_0xdcbd('0x86')]=intUtil[_0xdcbd('0x85')](_0x4c80bc[_0xdcbd('0x86')]);_0x4c80bc[_0xdcbd('0x87')]=intUtil[_0xdcbd('0x85')](_0x4c80bc[_0xdcbd('0x87')]);if(_0x4b7544&&_0x4b7544[_0xdcbd('0x88')]){logger['info']('['+_0x2f2c72[_0xdcbd('0x6f')]['toUpperCase']()+']',_0xdcbd('0x9b'));_0x2f2c72[_0xdcbd('0x89')]=_0x4c80bc[_0xdcbd('0x87')]+_0xdcbd('0x8a')+_0x2f2c72[_0xdcbd('0xa1')]+_0xdcbd('0x8b')+md5(_0x2f2c72[_0xdcbd('0xa1')]);}else{_0x2f2c72[_0xdcbd('0x89')]='';}var _0x2f33e7=_0x4c80bc[_0xdcbd('0x86')]==='zoho.eu'?'eu':_0xdcbd('0x8d');return getAccessToken(_0x4c80bc)[_0xdcbd('0x2d')](function(_0x41c9db){_0x347107=_0x41c9db;return getUser(_0x347107,_0x2f33e7,_0x4c80bc);})[_0xdcbd('0x2d')](function(_0xc2c9da){_0x164ef9=_0xc2c9da;logger[_0xdcbd('0x32')](_0xdcbd('0x8e'),_0x164ef9['id']);return getEndUser(_0x347107,_0x2f33e7,_0x4c80bc,_0x2f2c72[_0xdcbd('0x8f')],_0x2f2c72[_0xdcbd('0x90')],_0x164ef9,_0x294408);})[_0xdcbd('0x2d')](function(_0x5af85e){_0x5c484d=_0x5af85e;return getCall(_0x347107,_0x2f33e7,_0x4c80bc,_0x164ef9,_0x5c484d,_0x294408,_0x2f2c72,'Inbound');})['then'](function(_0x11a26d){if(_0x11a26d){logger[_0xdcbd('0x32')](_0xdcbd('0x92'),_0x11a26d['id']);}})[_0xdcbd('0x43')](function(_0x382fe2){logger[_0xdcbd('0x2f')]('['+_0x2f2c72[_0xdcbd('0x6f')]['toUpperCase']()+']',JSON['stringify'](_0x382fe2));});}; \ No newline at end of file +var _0xadd8=['https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','add','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','then','data','enduserType','/crm/v2/','role','first_name','last_name','code','SUCCESS','details','startCase','moduleCreate','Error:\x20','log','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','starttime','agentcalledAt','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridnum','The\x20Call\x20ID\x20is:','unmanaged','The\x20User\x20ID\x20is:','toUpperCase','request-promise','md5','util','./util','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu'];(function(_0x3ff7f6,_0x3c2b31){var _0x36a3b3=function(_0x168fde){while(--_0x168fde){_0x3ff7f6['push'](_0x3ff7f6['shift']());}};_0x36a3b3(++_0x3c2b31);}(_0xadd8,0x19c));var _0x8add=function(_0x2a9246,_0x25bf2f){_0x2a9246=_0x2a9246-0x0;var _0x3600c6=_0xadd8[_0x2a9246];return _0x3600c6;};'use strict';var _=require('lodash');var rp=require(_0x8add('0x0'));var md5=require(_0x8add('0x1'));var util=require(_0x8add('0x2'));var intUtil=require(_0x8add('0x3'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x8add('0x4'));var config=require(_0x8add('0x5'));var logger=require(_0x8add('0x6'))(_0x8add('0x7'));config[_0x8add('0x8')]=_[_0x8add('0x9')](config['redis'],{'host':_0x8add('0xa'),'port':0x18eb});var io=require(_0x8add('0xb'))(new Redis(config[_0x8add('0x8')]));function emit(_0x381d12,_0x474339,_0x5135d9){io['to'](_0x381d12)['emit'](_0x474339,_0x5135d9);}function request(_0x5bfb1c){logger[_0x8add('0xc')](_0x8add('0xd'),JSON[_0x8add('0xe')](_0x5bfb1c));return rp(_0x5bfb1c);}function getCustomFields(_0x28224e,_0x55bfd7){var _0x2827c9={};if(_0x28224e[_0x8add('0xf')]>0x0){_[_0x8add('0x10')](_0x28224e,function(_0x13b2df){if(_[_0x8add('0x11')](['string',_0x8add('0x12')],_0x13b2df[_0x8add('0x13')])&&_0x13b2df['idField']){_0x2827c9[_0x13b2df[_0x8add('0x14')]]=_0x13b2df[_0x8add('0x15')][_0x8add('0x16')]();}else if(_0x13b2df['type']===_0x8add('0x17')&&_0x13b2df['variableName']&&_0x13b2df[_0x8add('0x14')]&&_0x55bfd7[_0x13b2df[_0x8add('0x18')]]){_0x2827c9[_0x13b2df[_0x8add('0x14')]]=_0x55bfd7[_0x13b2df['variableName']]['toString']();}else if(_0x13b2df[_0x8add('0x13')]===_0x8add('0x19')&&_0x13b2df[_0x8add('0x1a')]&&_0x13b2df[_0x8add('0x1a')][_0x8add('0x1b')]&&_0x13b2df['idField']&&_0x55bfd7[_0x13b2df[_0x8add('0x1a')][_0x8add('0x1b')][_0x8add('0x1c')]()]){_0x2827c9[_0x13b2df[_0x8add('0x14')]]=_0x55bfd7[_0x13b2df[_0x8add('0x1a')]['name'][_0x8add('0x1c')]()][_0x8add('0x16')]();}});}return _0x2827c9;}function getName(_0x5dcff3){if(_0x5dcff3['indexOf']('\x20')>0x0){var _0xf175ed=_0x5dcff3[_0x8add('0x1d')](/ (.+)/);if(_0xf175ed[0x1]){return _0xf175ed;}}return[_0x5dcff3,_0x5dcff3];}var accountsTokens={};function getAccessToken(_0x30d1d7){return new Promise(function(_0x1f50d9,_0x5b7e46){if(!_[_0x8add('0x1e')](accountsTokens[_0x30d1d7['id']])&&!_[_0x8add('0x1e')](accountsTokens[_0x30d1d7['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x30d1d7['id']]['expires_in'])){_0x1f50d9(accountsTokens[_0x30d1d7['id']]['access_token']);}}var _0x28ff6e;switch(_0x30d1d7[_0x8add('0x1f')]){case'US':_0x28ff6e=_0x8add('0x20');break;case'AU':_0x28ff6e=_0x8add('0x21');break;case'EU':_0x28ff6e=_0x8add('0x22');break;case'IN':_0x28ff6e=_0x8add('0x23');break;case'CN':_0x28ff6e=_0x8add('0x24');break;default:_0x28ff6e=_0x8add('0x22');break;}var _0x495566={'method':_0x8add('0x25'),'uri':_0x28ff6e+_0x8add('0x26'),'qs':{'refresh_token':_0x30d1d7[_0x8add('0x27')],'client_id':_0x30d1d7['clientId'],'client_secret':_0x30d1d7[_0x8add('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x495566)['then'](function(_0x2db1f9){accountsTokens[_0x30d1d7['id']]={'access_token':_0x2db1f9['access_token'],'expires_in':moment()[_0x8add('0x29')](_0x2db1f9[_0x8add('0x2a')],_0x8add('0x2b'))};_0x1f50d9(_0x2db1f9['access_token']);})['catch'](function(_0x2ae044){logger[_0x8add('0x2c')](_0x8add('0x2d'),_0x2ae044[_0x8add('0x2e')]);_0x5b7e46(_0x2ae044);});});}function getUser(_0x13f4ea,_0x3b974c,_0x4e4a2e,_0x49d897){logger[_0x8add('0x2f')]('Search\x20user');return request({'method':_0x8add('0x30'),'uri':util[_0x8add('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x3b974c),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x8add('0x32')+_0x13f4ea},'json':!![]})['then'](function(_0x37ddc1){if(_0x37ddc1[_0x8add('0x33')]){var _0x53ddf1=-0x1;if(_[_0x8add('0x34')](_0x37ddc1[_0x8add('0x33')])){if(!_[_0x8add('0x1e')](_0x49d897)){_0x53ddf1=_[_0x8add('0x35')](_0x37ddc1[_0x8add('0x33')],function(_0xd04097){return _0xd04097[_0x8add('0x36')]===_0x49d897;});}if(_0x53ddf1>=0x0){logger[_0x8add('0x2f')](_0x8add('0x37'));}else{logger[_0x8add('0x2f')](_0x8add('0x38'));_0x53ddf1=_[_0x8add('0x35')](_0x37ddc1[_0x8add('0x33')],function(_0x230398){return _0x230398[_0x8add('0x39')][_0x8add('0x1b')]===_0x8add('0x3a');});}return _0x37ddc1[_0x8add('0x33')][_0x53ddf1];}else{if(_0x37ddc1['user'][_0x8add('0x39')]['name']===_0x8add('0x3a')){logger['info'](_0x8add('0x38'));user=_0x37ddc1[_0x8add('0x3b')];return user;}else{logger[_0x8add('0x2c')](_0x8add('0x3c'),JSON[_0x8add('0xe')](_0x37ddc1));throw new Error(_0x8add('0x3d')+JSON[_0x8add('0xe')](_0x37ddc1));}}}else{logger[_0x8add('0x2c')](_0x8add('0x3c'),JSON[_0x8add('0xe')](_0x37ddc1));throw new Error(_0x8add('0x3d')+JSON[_0x8add('0xe')](_0x37ddc1));}})[_0x8add('0x3e')](function(_0x160c9a){console[_0x8add('0x2c')](_0x160c9a);});}function getZohoUser(_0x825e2,_0x4ed2df){return new BPromise(function(_0x10e31d,_0x33fe33){request(_0x825e2)[_0x8add('0x3f')](function(_0x1188da){var _0x46b35b=null;if(_0x1188da){_0x46b35b=_0x1188da[_0x8add('0x40')][0x0];_0x46b35b[_0x8add('0x41')]=_0x4ed2df;}_0x10e31d(_0x46b35b);})['catch'](function(_0x5e6211){_0x33fe33(_0x5e6211);});});}function createEndUser(_0x26a617,_0x27b48a,_0x5004c6,_0x4330ae,_0x5efcc5,_0x500819){var _0x5004c6=getName(_0x5004c6);return request({'method':_0x8add('0x25'),'uri':'https://www.zohoapis.'+_0x27b48a+_0x8add('0x42')+_['startCase'](_0x500819['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5004c6[0x1],'First_Name':_0x5004c6[0x0],'Phone':_0x4330ae,'Owner':{'name':!_[_0x8add('0x1e')](_0x5efcc5[_0x8add('0x43')][_0x8add('0x1b')])?_0x5efcc5[_0x8add('0x43')][_0x8add('0x1b')]:!_[_0x8add('0x1e')](_0x5efcc5[_0x8add('0x44')])?_0x5efcc5['first_name']+'\x20'+_0x5efcc5[_0x8add('0x45')]:_0x5efcc5['last_name'],'id':_0x5efcc5['id']}}]},'headers':{'Authorization':_0x8add('0x32')+_0x26a617},'json':!![]})[_0x8add('0x3f')](function(_0x3eb017){if(_0x3eb017&&_0x3eb017['data'][0x0][_0x8add('0x46')]===_0x8add('0x47')){var _0x307edf=_0x3eb017[_0x8add('0x40')][0x0][_0x8add('0x48')];_0x307edf['enduserType']=_[_0x8add('0x49')](_0x500819[_0x8add('0x4a')])+'s';return _0x307edf;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x8add('0xe')](data));throw new Error(_0x8add('0x4b')+JSON[_0x8add('0xe')](data));})[_0x8add('0x3e')](function(_0x53dabd){console[_0x8add('0x4c')]('CREATE\x20ERROR',_0x53dabd);});}function getEndUser(_0x5bae4d,_0x136a77,_0xa13de6,_0x377327,_0xd89c86,_0x2591ca,_0x2df1ec){var _0x1e9874={'method':_0x8add('0x30'),'uri':'','headers':{'Authorization':_0x8add('0x32')+_0x5bae4d},'json':!![]};switch(_0x2df1ec[_0x8add('0x4d')]){case _0x8add('0x4e'):_0x1e9874['uri']=_0x8add('0x4f')+_0x136a77+_0x8add('0x50')+_0xd89c86+'))';return getZohoUser(_0x1e9874,_0x8add('0x51'))[_0x8add('0x3f')](function(_0x152eb0){if(_0x152eb0)return _0x152eb0;_0x1e9874[_0x8add('0x52')]=_0x8add('0x4f')+_0x136a77+_0x8add('0x53')+_0xd89c86+'))';return getZohoUser(_0x1e9874,_0x8add('0x54'))[_0x8add('0x3f')](function(_0x3b4e9d){if(_0x3b4e9d)return _0x3b4e9d;if(_0x2df1ec[_0x8add('0x4a')]!=_0x8add('0x55')){return createEndUser(_0x5bae4d,_0x136a77,_0x377327,_0xd89c86,_0x2591ca,_0x2df1ec);}else{return{};}});});break;case _0x8add('0x56'):_0x1e9874[_0x8add('0x52')]=_0x8add('0x4f')+_0x136a77+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xd89c86+'))';return getZohoUser(_0x1e9874,'Contacts')[_0x8add('0x3f')](function(_0x4e2d0a){if(_0x4e2d0a)return _0x4e2d0a;if(_0x2df1ec[_0x8add('0x4a')]!=_0x8add('0x55')){return createEndUser(_0x5bae4d,_0x136a77,_0x377327,_0xd89c86,_0x2591ca,_0x2df1ec);}else{return{};}});break;case _0x8add('0x57'):_0x1e9874['uri']=_0x8add('0x4f')+_0x136a77+_0x8add('0x53')+_0xd89c86+'))';return getZohoUser(_0x1e9874,'Leads')[_0x8add('0x3f')](function(_0x7546f5){if(_0x7546f5)return _0x7546f5;if(_0x2df1ec[_0x8add('0x4a')]!=_0x8add('0x55')){return createEndUser(_0x5bae4d,_0x136a77,_0x377327,_0xd89c86,_0x2591ca,_0x2df1ec);}else{return{};}});break;}}function getCall(_0x4b1a6f,_0x1ebb13,_0x29b508,_0xd5c934,_0x27474c,_0x49b88d,_0x4b3636,_0x138c9d){logger[_0x8add('0x2f')]('Creating\x20new\x20call...');var _0x19a9d7={};_0x19a9d7[_0x8add('0x58')]={'name':!_[_0x8add('0x1e')](_0xd5c934[_0x8add('0x43')][_0x8add('0x1b')])&&!_[_0x8add('0x1e')](_0xd5c934[_0x8add('0x39')][_0x8add('0x1b')])&&_0xd5c934[_0x8add('0x39')][_0x8add('0x1b')]===_0x8add('0x59')?_0xd5c934[_0x8add('0x43')][_0x8add('0x1b')]:!_[_0x8add('0x1e')](_0xd5c934[_0x8add('0x44')])?_0xd5c934['first_name']+'\x20'+_0xd5c934[_0x8add('0x45')]:_0xd5c934['last_name'],'id':_0xd5c934['id']};_0x19a9d7[_0x8add('0x5a')]=intUtil[_0x8add('0x5b')](_0x49b88d['Subjects'],_0x4b3636,'\x20');_0x19a9d7['Description']=intUtil[_0x8add('0x5b')](_0x49b88d[_0x8add('0x5c')],_0x4b3636,'\x0a');if(_0x27474c[_0x8add('0x41')]===_0x8add('0x51')){_0x19a9d7[_0x8add('0x5d')]={'name':!_[_0x8add('0x1e')](_0x27474c[_0x8add('0x5e')])?_0x27474c[_0x8add('0x5e')]:!_[_0x8add('0x1e')](_0x27474c[_0x8add('0x5f')])?_0x27474c[_0x8add('0x5f')]+'\x20'+_0x27474c[_0x8add('0x60')]:_0x27474c[_0x8add('0x60')],'id':_0x27474c['id']};}if(_0x27474c[_0x8add('0x41')]===_0x8add('0x54')){_0x19a9d7[_0x8add('0x61')]={'name':!_[_0x8add('0x1e')](_0x27474c[_0x8add('0x5e')])?_0x27474c[_0x8add('0x5e')]:!_['isNil'](_0x27474c[_0x8add('0x5f')])?_0x27474c[_0x8add('0x5f')]+'\x20'+_0x27474c[_0x8add('0x60')]:_0x27474c['Last_Name'],'id':_0x27474c['id']};_0x19a9d7['$se_module']=_[_0x8add('0x49')](_0x27474c[_0x8add('0x41')]);}if(_0x4b3636[_0x8add('0x62')]){_0x19a9d7[_0x8add('0x63')]=moment[_0x8add('0x64')](parseInt(_0x4b3636[_0x8add('0x62')])*0x3e8)[_0x8add('0x31')](_0x8add('0x65'));}else if(_0x4b3636['answertime']&&_0x4b3636[_0x8add('0x66')]){_0x19a9d7[_0x8add('0x63')]=moment['utc'](moment(_0x4b3636[_0x8add('0x66')],_0x8add('0x67'))[_0x8add('0x68')](moment(_0x4b3636['starttime'],_0x8add('0x67'))))[_0x8add('0x31')](_0x8add('0x65'));}switch(_0x4b3636[_0x8add('0x69')]){case'called':_0x19a9d7[_0x8add('0x6a')]='Called';break;case _0x8add('0x6b'):case _0x8add('0x6c'):_0x19a9d7[_0x8add('0x6a')]=_0x8add('0x6d');break;case _0x8add('0x6e'):_0x19a9d7[_0x8add('0x6a')]=_0x8add('0x6f');break;case _0x8add('0x70'):_0x19a9d7[_0x8add('0x6a')]=_0x8add('0x71');break;case'timeout':_0x19a9d7['Call_Result']=_0x8add('0x72');default:}_0x19a9d7['Call_Start_Time']=(_0x138c9d===_0x8add('0x73')?moment(_0x4b3636[_0x8add('0x74')])['format'](_0x8add('0x67')):moment(_0x4b3636[_0x8add('0x75')])[_0x8add('0x31')](_0x8add('0x67')))||moment()[_0x8add('0x31')](_0x8add('0x67'));_0x19a9d7['Call_Type']=_0x138c9d||_0x8add('0x76');_0x19a9d7=_[_0x8add('0x77')](_0x19a9d7,getCustomFields(_0x49b88d['Fields'],_0x4b3636));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x1ebb13+_0x8add('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4b1a6f},'body':{'data':[_0x19a9d7]},'json':!![]})['then'](function(_0x604c58){if(_0x604c58&&_0x604c58[_0x8add('0x40')][0x0]['code']===_0x8add('0x47')){logger[_0x8add('0x2f')](_0x8add('0x79'));return{'id':_0x604c58[_0x8add('0x40')][0x0]['details']['id']};}})[_0x8add('0x3e')](function(_0x54cf34){logger[_0x8add('0x2f')](_0x8add('0x7a'),_0x54cf34[_0x8add('0x2e')]);console[_0x8add('0x4c')](_0x8add('0x7a'),_0x54cf34);});}exports['queue']=function(_0xebfebb,_0x4e6a75,_0x2d616b,_0x3b97d5,_0x275aa7,_0x3bf406){var _0x4c61b1,_0x3355be,_0x3c45e7;_0x3bf406[_0x8add('0x7b')]=intUtil[_0x8add('0x7c')](_0x3bf406[_0x8add('0x7b')]);_0x3bf406[_0x8add('0x7d')]=intUtil[_0x8add('0x7c')](_0x3bf406[_0x8add('0x7d')]);if(_0x275aa7&&_0x275aa7[_0x8add('0x7e')]){logger[_0x8add('0x2f')](_0x8add('0x7f'),_0x8add('0x80'));_0x4e6a75[_0x8add('0x81')]=_0x3bf406['serverUrl']+'/api/voice/recordings/'+_0x4e6a75[_0x8add('0x82')]+_0x8add('0x83')+md5(_0x4e6a75[_0x8add('0x82')]);}else{_0x4e6a75[_0x8add('0x81')]='';}var _0x536866=_0x3bf406[_0x8add('0x7b')]===_0x8add('0x84')?'eu':_0x8add('0x85');return getAccessToken(_0x3bf406)['then'](function(_0x4e5811){_0x3c45e7=_0x4e5811;return getUser(_0x3c45e7,_0x536866,_0x3bf406,_0x3b97d5['email']);})[_0x8add('0x3f')](function(_0x5445c8){_0x4c61b1=_0x5445c8;logger[_0x8add('0x2f')]('The\x20User\x20ID\x20is:',_0x4c61b1['id']);return getEndUser(_0x3c45e7,_0x536866,_0x3bf406,_0x4e6a75['calleridname'],_0x4e6a75[_0x8add('0x86')],_0x4c61b1,_0x2d616b);})[_0x8add('0x3f')](function(_0x203af1){_0x3355be=_0x203af1;return getCall(_0x3c45e7,_0x536866,_0x3bf406,_0x4c61b1,_0x3355be,_0x2d616b,_0x4e6a75,_0x8add('0x76'));})[_0x8add('0x3f')](function(_0x34bf67){if(_0x34bf67){logger[_0x8add('0x2f')]('The\x20Call\x20ID\x20is:',_0x34bf67['id']);logger[_0x8add('0x2f')](_0x8add('0x7f'),_0x8add('0x87'));emit(util['format'](_0x8add('0x88'),_0x3b97d5[_0x8add('0x1b')]),_0x8add('0x89'),{'uri':_0x8add('0x8a')+_0x3bf406[_0x8add('0x7b')]+_0x8add('0x8b')+_0x34bf67['id']});}})[_0x8add('0x3e')](function(_0x57d36e){logger[_0x8add('0x2c')](_0x8add('0x7f'),JSON['stringify'](_0x57d36e));});};exports[_0x8add('0x73')]=function(_0x119272,_0x536e0b,_0x3e888f,_0x3b3ba7,_0x2b57c9,_0x4ec6cb,_0xb96c9c){var _0xca282e,_0x3a8d33,_0x96b4f8;_0x4ec6cb[_0x8add('0x7b')]=intUtil['stripTrailingSlash'](_0x4ec6cb['host']);_0x4ec6cb[_0x8add('0x7d')]=intUtil[_0x8add('0x7c')](_0x4ec6cb[_0x8add('0x7d')]);if(_0xb96c9c&&_0xb96c9c[_0x8add('0x8c')]&&_0xb96c9c[_0x8add('0x8c')]!==_0x8add('0x8d')){logger[_0x8add('0x2f')](_0x8add('0x8e'),_0x8add('0x80'));_0x536e0b[_0x8add('0x81')]=_0x4ec6cb[_0x8add('0x7d')]+_0x8add('0x8f')+_0x536e0b['uniqueid']+_0x8add('0x83')+md5(_0x536e0b[_0x8add('0x82')]);}var _0x159213=_0x4ec6cb[_0x8add('0x7b')]==='zoho.eu'?'eu':_0x8add('0x85');return getAccessToken(_0x4ec6cb)[_0x8add('0x3f')](function(_0x517c38){_0x96b4f8=_0x517c38;return getUser(_0x96b4f8,_0x159213,_0x4ec6cb,_0x3b3ba7[_0x8add('0x36')]);})['then'](function(_0xc5439a){_0xca282e=_0xc5439a;logger['info']('The\x20User\x20ID\x20is:',_0xca282e['id']);return getEndUser(_0x96b4f8,_0x159213,_0x4ec6cb,_0x536e0b['destcalleridname'],_0x536e0b[_0x8add('0x90')],_0xca282e,_0x3e888f);})[_0x8add('0x3f')](function(_0x590fc4){_0x3a8d33=_0x590fc4;return getCall(_0x96b4f8,_0x159213,_0x4ec6cb,_0xca282e,_0x3a8d33,_0x3e888f,_0x536e0b,'Outbound');})['then'](function(_0x3d93d6){if(_0x3d93d6){logger[_0x8add('0x2f')](_0x8add('0x91'),_0x3d93d6['id']);logger[_0x8add('0x2f')](_0x8add('0x8e'),_0x8add('0x87'));emit(util[_0x8add('0x31')](_0x8add('0x88'),_0x3b3ba7[_0x8add('0x1b')]),_0x8add('0x89'),{'uri':'https://crm.'+_0x4ec6cb[_0x8add('0x7b')]+_0x8add('0x8b')+_0x3d93d6['id']});}})[_0x8add('0x3e')](function(_0x22e74f){logger['error'](_0x8add('0x8e'),JSON['stringify'](_0x22e74f));});};exports[_0x8add('0x92')]=function(_0x57618e,_0x5aaf37,_0x1dc606,_0x4b67bb,_0x8e645c,_0x50cffe){var _0x52aa19,_0x5f4ea1,_0x571ec3;_0x50cffe[_0x8add('0x7b')]=intUtil[_0x8add('0x7c')](_0x50cffe['host']);_0x50cffe[_0x8add('0x7d')]=intUtil['stripTrailingSlash'](_0x50cffe[_0x8add('0x7d')]);if(_0x8e645c&&_0x8e645c['monitor_format']){logger[_0x8add('0x2f')]('['+_0x5aaf37[_0x8add('0x69')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5aaf37[_0x8add('0x81')]=_0x50cffe[_0x8add('0x7d')]+_0x8add('0x8f')+_0x5aaf37['uniqueid']+_0x8add('0x83')+md5(_0x5aaf37[_0x8add('0x82')]);}else{_0x5aaf37[_0x8add('0x81')]='';}var _0x43669d=_0x50cffe[_0x8add('0x7b')]===_0x8add('0x84')?'eu':_0x8add('0x85');return getAccessToken(_0x50cffe)[_0x8add('0x3f')](function(_0x2b2d70){_0x571ec3=_0x2b2d70;return getUser(_0x571ec3,_0x43669d,_0x50cffe);})[_0x8add('0x3f')](function(_0x5bd877){_0x52aa19=_0x5bd877;logger[_0x8add('0x2f')](_0x8add('0x93'),_0x52aa19['id']);return getEndUser(_0x571ec3,_0x43669d,_0x50cffe,_0x5aaf37['calleridname'],_0x5aaf37[_0x8add('0x86')],_0x52aa19,_0x1dc606);})[_0x8add('0x3f')](function(_0x4170e9){_0x5f4ea1=_0x4170e9;return getCall(_0x571ec3,_0x43669d,_0x50cffe,_0x52aa19,_0x5f4ea1,_0x1dc606,_0x5aaf37,_0x8add('0x76'));})[_0x8add('0x3f')](function(_0x17dee3){if(_0x17dee3){logger[_0x8add('0x2f')](_0x8add('0x91'),_0x17dee3['id']);}})[_0x8add('0x3e')](function(_0xc9b847){logger[_0x8add('0x2c')]('['+_0x5aaf37[_0x8add('0x69')][_0x8add('0x94')]()+']',JSON[_0x8add('0xe')](_0xc9b847));});}; \ 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 b1312b8..186f4b7 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 _0x68ef=['data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script'];(function(_0x7410ec,_0x2dd010){var _0x399d42=function(_0x37fddf){while(--_0x37fddf){_0x7410ec['push'](_0x7410ec['shift']());}};_0x399d42(++_0x2dd010);}(_0x68ef,0x1da));var _0xf68e=function(_0x41fd48,_0x5ca869){_0x41fd48=_0x41fd48-0x0;var _0x1dcf5b=_0x68ef[_0x41fd48];return _0x1dcf5b;};'use strict';var util=require(_0xf68e('0x0'));var sh=require(_0xf68e('0x1'));var Mustache=require(_0xf68e('0x2'));var logger=require(_0xf68e('0x3'))('trigger');exports[_0xf68e('0x4')]=function(_0x7b7951,_0x20f8f6){var _0x31e712=_0x7b7951[_0xf68e('0x5')]?_0x7b7951[_0xf68e('0x5')]:_0xf68e('0x6');var _0x57efc8=_0x7b7951['data3']?Mustache['render'](_0x7b7951[_0xf68e('0x7')],_0x20f8f6):_0x20f8f6;sh[_0xf68e('0x4')](_0x57efc8,function(_0x5bf07c,_0x32156d,_0x4bd6aa){if(_0x5bf07c!==0x0){logger[_0xf68e('0x8')](util[_0xf68e('0x9')](_0xf68e('0xa'),_0x31e712,_0x57efc8,_0x5bf07c,_0x4bd6aa));}else{logger[_0xf68e('0xb')](util['format'](_0xf68e('0xc'),_0x31e712,_0x57efc8,_0x32156d));}});}; \ No newline at end of file +var _0xa86a=['error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script','render','data3'];(function(_0x664ca5,_0x36d89c){var _0x556362=function(_0x169aa6){while(--_0x169aa6){_0x664ca5['push'](_0x664ca5['shift']());}};_0x556362(++_0x36d89c);}(_0xa86a,0x1a9));var _0xaa86=function(_0x23aa96,_0x37c1db){_0x23aa96=_0x23aa96-0x0;var _0x41600a=_0xa86a[_0x23aa96];return _0x41600a;};'use strict';var util=require(_0xaa86('0x0'));var sh=require(_0xaa86('0x1'));var Mustache=require(_0xaa86('0x2'));var logger=require(_0xaa86('0x3'))('trigger');exports[_0xaa86('0x4')]=function(_0x714cb,_0x14fc0c){var _0x42273c=_0x714cb[_0xaa86('0x5')]?_0x714cb[_0xaa86('0x5')]:_0xaa86('0x6');var _0x52a403=_0x714cb['data3']?Mustache[_0xaa86('0x7')](_0x714cb[_0xaa86('0x8')],_0x14fc0c):_0x14fc0c;sh['exec'](_0x52a403,function(_0x361f20,_0x560052,_0x14ee72){if(_0x361f20!==0x0){logger[_0xaa86('0x9')](util[_0xaa86('0xa')](_0xaa86('0xb'),_0x42273c,_0x52a403,_0x361f20,_0x14ee72));}else{logger[_0xaa86('0xc')](util[_0xaa86('0xa')](_0xaa86('0xd'),_0x42273c,_0x52a403,_0x560052));}});}; \ 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 d7b2320..ca7eddd 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 _0xdb48=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','format','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','toUpperCase','data2','data5','number','data6','render','stack','data1','GET','DELETE','PUT','data7','error'];(function(_0x1a1886,_0x1a88eb){var _0xa6b76a=function(_0x3c21d3){while(--_0x3c21d3){_0x1a1886['push'](_0x1a1886['shift']());}};_0xa6b76a(++_0x1a88eb);}(_0xdb48,0x137));var _0x8db4=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xdb48[_0x4fc9e6];return _0x551d28;};'use strict';var rp=require(_0x8db4('0x0'));var util=require(_0x8db4('0x1'));var _=require('lodash');var Mustache=require(_0x8db4('0x2'));var logger=require(_0x8db4('0x3'))(_0x8db4('0x4'));exports[_0x8db4('0x5')]=function(_0x2dbcbf,_0x20893c){var _0x48477b,_0x521bb0;var _0x486f94={'method':_0x2dbcbf['data1'][_0x8db4('0x6')](),'uri':Mustache['render'](_0x2dbcbf[_0x8db4('0x7')],_0x20893c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2dbcbf[_0x8db4('0x8')])===_0x8db4('0x9')&&parseInt(_0x2dbcbf[_0x8db4('0x8')])>=0x1&&parseInt(_0x2dbcbf['data5'])<=0xa?parseInt(_0x2dbcbf[_0x8db4('0x8')])*0x3e8:0x5*0x3e8};try{_0x486f94['headers']=_0x2dbcbf[_0x8db4('0xa')]?JSON['parse'](Mustache[_0x8db4('0xb')](_0x2dbcbf[_0x8db4('0xa')],_0x20893c)):{};}catch(_0x3b4ffa){logger['error'](_0x3b4ffa[_0x8db4('0xc')]);}switch(_0x2dbcbf[_0x8db4('0xd')][_0x8db4('0x6')]()){case _0x8db4('0xe'):case _0x8db4('0xf'):_0x48477b=null;_0x486f94['qs']=_0x20893c;break;case'POST':case _0x8db4('0x10'):if(_0x2dbcbf['data7']){try{_0x48477b=JSON['parse'](Mustache[_0x8db4('0xb')](_0x2dbcbf[_0x8db4('0x11')],_0x20893c));_0x486f94['body']=_0x48477b;}catch(_0x207ceb){logger[_0x8db4('0x12')](_0x207ceb[_0x8db4('0xc')]);logger['error'](_0x8db4('0x13'));}}else{_0x48477b=_0x20893c;_0x486f94[_0x8db4('0x14')]=_0x48477b;}break;}logger['info'](util['format'](_0x8db4('0x15'),_0x2dbcbf[_0x8db4('0xd')],_0x2dbcbf[_0x8db4('0x7')],JSON[_0x8db4('0x16')](_0x486f94)));rp(_0x486f94)[_0x8db4('0x17')](function(_0x20d86c){_0x48477b=!_[_0x8db4('0x18')](_0x48477b)?',\x20request\x20body:\x20'+_0x48477b:'';_0x521bb0=typeof _0x20d86c['body']==='object'?JSON['stringify'](_0x20d86c[_0x8db4('0x14')]):_0x20d86c[_0x8db4('0x14')];logger[_0x8db4('0x19')](util['format'](_0x8db4('0x1a'),_0x2dbcbf[_0x8db4('0xd')],_0x2dbcbf['data2'],_0x20d86c[_0x8db4('0x1b')],_0x521bb0));})[_0x8db4('0x1c')](function(_0x3f6113){logger[_0x8db4('0x12')](util[_0x8db4('0x1d')](_0x8db4('0x1e'),_0x2dbcbf['data1'],_0x2dbcbf[_0x8db4('0x7')],_0x3f6113[_0x8db4('0x1b')],_0x3f6113[_0x8db4('0x1f')],_0x3f6113[_0x8db4('0x20')]));});}; \ No newline at end of file +var _0xf88c=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','error','stack','POST','PUT','data7','body'];(function(_0x5771ae,_0x516f25){var _0x5c0c28=function(_0x660d9d){while(--_0x660d9d){_0x5771ae['push'](_0x5771ae['shift']());}};_0x5c0c28(++_0x516f25);}(_0xf88c,0x184));var _0xcf88=function(_0x1de89d,_0x1cf706){_0x1de89d=_0x1de89d-0x0;var _0x21df4e=_0xf88c[_0x1de89d];return _0x21df4e;};'use strict';var rp=require(_0xcf88('0x0'));var util=require(_0xcf88('0x1'));var _=require(_0xcf88('0x2'));var Mustache=require(_0xcf88('0x3'));var logger=require(_0xcf88('0x4'))('trigger');exports['exec']=function(_0x4653a5,_0x45b2eb){var _0x43665b,_0x3ad131;var _0x70b4fa={'method':_0x4653a5[_0xcf88('0x5')][_0xcf88('0x6')](),'uri':Mustache[_0xcf88('0x7')](_0x4653a5[_0xcf88('0x8')],_0x45b2eb),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4653a5['data5'])===_0xcf88('0x9')&&parseInt(_0x4653a5[_0xcf88('0xa')])>=0x1&&parseInt(_0x4653a5['data5'])<=0xa?parseInt(_0x4653a5[_0xcf88('0xa')])*0x3e8:0x5*0x3e8};try{_0x70b4fa[_0xcf88('0xb')]=_0x4653a5[_0xcf88('0xc')]?JSON[_0xcf88('0xd')](Mustache['render'](_0x4653a5[_0xcf88('0xc')],_0x45b2eb)):{};}catch(_0x18e3d6){logger[_0xcf88('0xe')](_0x18e3d6[_0xcf88('0xf')]);}switch(_0x4653a5['data1'][_0xcf88('0x6')]()){case'GET':case'DELETE':_0x43665b=null;_0x70b4fa['qs']=_0x45b2eb;break;case _0xcf88('0x10'):case _0xcf88('0x11'):if(_0x4653a5[_0xcf88('0x12')]){try{_0x43665b=JSON[_0xcf88('0xd')](Mustache[_0xcf88('0x7')](_0x4653a5['data7'],_0x45b2eb));_0x70b4fa[_0xcf88('0x13')]=_0x43665b;}catch(_0x287243){logger[_0xcf88('0xe')](_0x287243[_0xcf88('0xf')]);logger[_0xcf88('0xe')](_0xcf88('0x14'));}}else{_0x43665b=_0x45b2eb;_0x70b4fa[_0xcf88('0x13')]=_0x43665b;}break;}logger[_0xcf88('0x15')](util[_0xcf88('0x16')](_0xcf88('0x17'),_0x4653a5[_0xcf88('0x5')],_0x4653a5[_0xcf88('0x8')],JSON[_0xcf88('0x18')](_0x70b4fa)));rp(_0x70b4fa)[_0xcf88('0x19')](function(_0xd11cc0){_0x43665b=!_['isNil'](_0x43665b)?_0xcf88('0x1a')+_0x43665b:'';_0x3ad131=typeof _0xd11cc0['body']===_0xcf88('0x1b')?JSON[_0xcf88('0x18')](_0xd11cc0[_0xcf88('0x13')]):_0xd11cc0['body'];logger['info'](util['format'](_0xcf88('0x1c'),_0x4653a5[_0xcf88('0x5')],_0x4653a5[_0xcf88('0x8')],_0xd11cc0[_0xcf88('0x1d')],_0x3ad131));})[_0xcf88('0x1e')](function(_0x38c776){logger['error'](util[_0xcf88('0x16')](_0xcf88('0x1f'),_0x4653a5['data1'],_0x4653a5[_0xcf88('0x8')],_0x38c776[_0xcf88('0x1d')],_0x38c776[_0xcf88('0x20')],_0x38c776[_0xcf88('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1dfe198..fc0919f 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 _0xef5d=['exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','debug','rpc','error','message','result','catch'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xef5d,0x15f));var _0xdef5=function(_0x30d9c2,_0x1b6175){_0x30d9c2=_0x30d9c2-0x0;var _0xfcf4b0=_0xef5d[_0x30d9c2];return _0xfcf4b0;};'use strict';var jayson=require(_0xdef5('0x0'));var BPromise=require(_0xdef5('0x1'));var logger=require(_0xdef5('0x2'))(_0xdef5('0x3'));var client=jayson['client'][_0xdef5('0x4')]({'port':0x2329});client[_0xdef5('0x5')]=function(_0xf7257,_0x27e733){return new BPromise(function(_0x3b23a1,_0x59fbda){return client[_0xdef5('0x6')](_0xf7257,_0x27e733)['then'](function(_0x1c4de3){logger[_0xdef5('0x7')](_0xdef5('0x8'),_0xdef5('0x3'),_0xf7257,_0x27e733,_0x1c4de3);if(_0x1c4de3[_0xdef5('0x9')]){logger[_0xdef5('0x9')](_0xdef5('0x8'),_0xdef5('0x3'),_0xf7257,_0x1c4de3[_0xdef5('0x9')][_0xdef5('0xa')],_0x27e733);return _0x59fbda(_0x1c4de3[_0xdef5('0x9')][_0xdef5('0xa')]);}else{return _0x3b23a1(_0x1c4de3[_0xdef5('0xb')]);}})[_0xdef5('0xc')](function(_0x3d97ca){logger[_0xdef5('0x9')](_0xdef5('0x8'),_0xdef5('0x3'),_0xf7257,_0x3d97ca,_0x27e733);return _0x59fbda(_0x3d97ca);});});};module[_0xdef5('0xd')]=client; \ No newline at end of file +var _0x9ce9=['client','Request','request','then','debug','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x9ce9,0x191));var _0x99ce=function(_0x199973,_0x5b279f){_0x199973=_0x199973-0x0;var _0x1b1646=_0x9ce9[_0x199973];return _0x1b1646;};'use strict';var jayson=require(_0x99ce('0x0'));var BPromise=require(_0x99ce('0x1'));var logger=require(_0x99ce('0x2'))(_0x99ce('0x3'));var client=jayson[_0x99ce('0x4')]['http']({'port':0x2329});client[_0x99ce('0x5')]=function(_0x1113c6,_0x4d898f){return new BPromise(function(_0x5ced42,_0x1b81c9){return client[_0x99ce('0x6')](_0x1113c6,_0x4d898f)[_0x99ce('0x7')](function(_0x430207){logger[_0x99ce('0x8')]('rpc','routing',_0x1113c6,_0x4d898f,_0x430207);if(_0x430207[_0x99ce('0x9')]){logger[_0x99ce('0x9')](_0x99ce('0xa'),_0x99ce('0x3'),_0x1113c6,_0x430207['error'][_0x99ce('0xb')],_0x4d898f);return _0x1b81c9(_0x430207[_0x99ce('0x9')][_0x99ce('0xb')]);}else{return _0x5ced42(_0x430207[_0x99ce('0xc')]);}})[_0x99ce('0xd')](function(_0x18a5d1){logger[_0x99ce('0x9')](_0x99ce('0xa'),_0x99ce('0x3'),_0x1113c6,_0x18a5d1,_0x4d898f);return _0x1b81c9(_0x18a5d1);});});};module[_0x99ce('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 28bb7f8..b908e72 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 _0xcd03=['./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','catch','error','./server','./lib/email'];(function(_0x258d1a,_0x160e0b){var _0xe8613e=function(_0x235988){while(--_0x235988){_0x258d1a['push'](_0x258d1a['shift']());}};_0xe8613e(++_0x160e0b);}(_0xcd03,0x116));var _0x3cd0=function(_0x3f92c7,_0x5792ad){_0x3f92c7=_0x3f92c7-0x0;var _0x240e06=_0xcd03[_0x3f92c7];return _0x240e06;};'use strict';var server=require(_0x3cd0('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x3cd0('0x1'));var mailAccount=require(_0x3cd0('0x2'));var setting=require('./rpc/setting');var logger=require(_0x3cd0('0x3'))(_0x3cd0('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3cd0('0x5')]()[_0x3cd0('0x6')](mailAccount[_0x3cd0('0x7')]())['then'](realtime[_0x3cd0('0x8')]())[_0x3cd0('0x6')](function(){email[_0x3cd0('0x9')](realtime[_0x3cd0('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x3cd0('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0x3cd0('0xb')]();})['then'](function(_0x55a576){return setInterval(initRealtime,_0x55a576['loginMailFrequency']*0x3e8);})[_0x3cd0('0xc')](function(_0x5b90d3){logger[_0x3cd0('0xd')]('Email\x20service\x20initialization',_0x5b90d3);});}main(); \ No newline at end of file +var _0x1476=['../../config/logger','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','./server','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x50016c,_0x523e8e){var _0x322f71=function(_0x3c9b94){while(--_0x3c9b94){_0x50016c['push'](_0x50016c['shift']());}};_0x322f71(++_0x523e8e);}(_0x1476,0x11a));var _0x6147=function(_0x11d182,_0x5b49a7){_0x11d182=_0x11d182-0x0;var _0x440092=_0x1476[_0x11d182];return _0x440092;};'use strict';var server=require(_0x6147('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x6147('0x1'));var mailAccount=require(_0x6147('0x2'));var setting=require(_0x6147('0x3'));var logger=require(_0x6147('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6147('0x5')]()[_0x6147('0x6')](mailAccount[_0x6147('0x7')]())['then'](realtime[_0x6147('0x8')]())['then'](function(){email['refresh'](realtime[_0x6147('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x6147('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0x6147('0xa')]();})[_0x6147('0x6')](function(_0x4a712c){return setInterval(initRealtime,_0x4a712c[_0x6147('0xb')]*0x3e8);})[_0x6147('0xc')](function(_0xa6ca9f){logger['error']('Email\x20service\x20initialization',_0xa6ca9f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 763e1fb..b1183d2 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 _0xbc8b=['info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','prototype','name','messages','firstName','then','catch','lastSync','sendMail','smtp','verifySmtp','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xbc8b,0x167));var _0xbbc8=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0xbc8b[_0x1e3c02];return _0x4d26d7;};'use strict';var _=require('lodash');var moment=require(_0xbbc8('0x0'));var BPromise=require(_0xbbc8('0x1'));var md5=require(_0xbbc8('0x2'));var Redis=require(_0xbbc8('0x3'));var config=require(_0xbbc8('0x4'));var logger=require(_0xbbc8('0x5'))(_0xbbc8('0x6'));config[_0xbbc8('0x7')]=_[_0xbbc8('0x8')](config[_0xbbc8('0x7')],{'host':_0xbbc8('0x9'),'port':0x18eb});var io=require(_0xbbc8('0xa'))(new Redis(config[_0xbbc8('0x7')]));var EmailImap=require(_0xbbc8('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1e0e57){logger[_0xbbc8('0xc')](_0xbbc8('0xd'));this[_0xbbc8('0xe')]=_0x1e0e57[_0xbbc8('0xe')];this[_0xbbc8('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xbbc8('0x10')]=function(_0xfae289){var _0x41dd91=this[_0xbbc8('0xe')][_0xfae289];var _0x38f9f5={'id':_0x41dd91['id'],'name':_0x41dd91['name'],'key':_0x41dd91[_0xbbc8('0x11')],'active':_0x41dd91[_0xbbc8('0x12')],'Imap':{'status':_0x41dd91[_0xbbc8('0x13')][_0xbbc8('0x14')],'messageStatus':_0x41dd91[_0xbbc8('0x13')][_0xbbc8('0x15')],'total':_0x41dd91[_0xbbc8('0x13')][_0xbbc8('0x16')]}};if(_[_0xbbc8('0x17')](md5Accounts[_0xfae289])){md5Accounts[_0xfae289]={};}var _0x460311=md5(JSON[_0xbbc8('0x18')](_0x38f9f5));if(md5Accounts[_0xfae289]['md5']!==_0x460311){md5Accounts[_0xfae289][_0xbbc8('0x2')]=_0x460311;io[_0xbbc8('0x10')](_0xbbc8('0x19'),_0x38f9f5);}};EmailChannel['prototype'][_0xbbc8('0x1a')]=function(_0x22215b){for(var _0x5475ab in _0x22215b){if(_0x22215b[_0xbbc8('0x1b')](_0x5475ab)){if(_0x22215b[_0x5475ab][_0xbbc8('0x13')]&&_0x22215b[_0x5475ab][_0xbbc8('0x12')]){var _0x3b8d35=_0x22215b[_0x5475ab][_0xbbc8('0x13')];if(!_0x3b8d35[_0xbbc8('0x1c')]&&_0x22215b[_0x5475ab][_0xbbc8('0x1d')]!==_0xbbc8('0x1e'))_0x3b8d35[_0xbbc8('0x1c')]=_0x22215b[_0x5475ab][_0xbbc8('0x1d')];if(!this[_0xbbc8('0xf')][_0xbbc8('0x1b')](_0x3b8d35['id'])){this[_0xbbc8('0xf')][_0x3b8d35['id']]=new EmailImap(_0x3b8d35,_0x22215b[_0x5475ab][_0xbbc8('0x6')]);this[_0xbbc8('0xf')][_0x3b8d35['id']]['on'](_0xbbc8('0x1f'),this[_0xbbc8('0x20')]['bind'](this,_0x5475ab));this[_0xbbc8('0xf')][_0x3b8d35['id']]['on'](_0xbbc8('0x6'),this[_0xbbc8('0x21')][_0xbbc8('0x22')](this,_0x5475ab));this['imapAccounts'][_0x3b8d35['id']]['on'](_0xbbc8('0x23'),this[_0xbbc8('0x24')][_0xbbc8('0x22')](this,_0x5475ab));this[_0xbbc8('0xf')][_0x3b8d35['id']]['on'](_0xbbc8('0x25'),this[_0xbbc8('0x26')]['bind'](this,_0x5475ab));}}else{if(_[_0xbbc8('0x17')](this[_0xbbc8('0xe')][_0x5475ab][_0xbbc8('0x13')])){this[_0xbbc8('0xe')][_0x5475ab]['Imap']={};}this[_0xbbc8('0xe')][_0x5475ab][_0xbbc8('0x13')]['status']='disabled';this[_0xbbc8('0xe')][_0x5475ab][_0xbbc8('0x13')]['messageStatus']='';this[_0xbbc8('0x10')](_0x5475ab);}}}};EmailChannel[_0xbbc8('0x27')][_0xbbc8('0x20')]=function(_0x334aec,_0x2a379c){if(this[_0xbbc8('0xe')][_0x334aec]){this[_0xbbc8('0xe')][_0x334aec][_0xbbc8('0x13')]['status']='connected';this[_0xbbc8('0xe')][_0x334aec][_0xbbc8('0x13')][_0xbbc8('0x15')]=_0x2a379c[_0xbbc8('0x28')];if(_0x2a379c[_0xbbc8('0x29')]){this[_0xbbc8('0xe')][_0x334aec][_0xbbc8('0x13')][_0xbbc8('0x16')]=_0x2a379c[_0xbbc8('0x29')][_0xbbc8('0x16')];}return this[_0xbbc8('0x10')](_0x334aec);}};EmailChannel[_0xbbc8('0x27')][_0xbbc8('0x21')]=function(_0x10ad5b,_0x321356){logger[_0xbbc8('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x321356[_0xbbc8('0x2a')],_0x321356['lastName'],_0x321356['from'],_0x10ad5b);if(this[_0xbbc8('0xe')][_0x10ad5b]){return mailAccount['notify'](_0x10ad5b,_0x321356)[_0xbbc8('0x2b')](function(_0x589fe3){if(_0x589fe3){logger[_0xbbc8('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0xbbc8('0x2c')](function(_0x11f7ad){logger[_0xbbc8('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xbbc8('0x18')](_0x11f7ad));});}};EmailChannel[_0xbbc8('0x27')][_0xbbc8('0x24')]=function(_0x16f8d9){if(this[_0xbbc8('0xe')][_0x16f8d9]&&this['mailAccounts'][_0x16f8d9]['Imap']){if(this[_0xbbc8('0xf')][this['mailAccounts'][_0x16f8d9][_0xbbc8('0x13')]['id']]){delete this['imapAccounts'][this[_0xbbc8('0xe')][_0x16f8d9][_0xbbc8('0x13')]['id']];}this[_0xbbc8('0xe')][_0x16f8d9][_0xbbc8('0x13')][_0xbbc8('0x2d')]=moment();this[_0xbbc8('0x10')](_0x16f8d9);}};EmailChannel[_0xbbc8('0x27')]['handleImapError']=function(_0x5ddda0,_0x4c23ca){if(this['mailAccounts'][_0x5ddda0]){this[_0xbbc8('0xe')][_0x5ddda0][_0xbbc8('0x13')][_0xbbc8('0x14')]='error';this[_0xbbc8('0xe')][_0x5ddda0][_0xbbc8('0x13')][_0xbbc8('0x15')]=_0x4c23ca;return this['emit'](_0x5ddda0);}};EmailChannel[_0xbbc8('0x27')][_0xbbc8('0x2e')]=function(_0x135eba,_0x2664fe){return this[_0xbbc8('0x2f')]['send'](_0x135eba,_0x2664fe);};EmailChannel['prototype'][_0xbbc8('0x30')]=function(_0x4ec789){var _0x4542a2=this;if(this[_0xbbc8('0xe')][_0x4ec789['id']]){if(_[_0xbbc8('0x17')](this[_0xbbc8('0xe')][_0x4ec789['id']][_0xbbc8('0x31')])){this['mailAccounts'][_0x4ec789['id']][_0xbbc8('0x31')]={};}this[_0xbbc8('0xe')][_0x4ec789['id']][_0xbbc8('0x31')][_0xbbc8('0x2d')]=moment();return new BPromise(function(_0x1537e4,_0x9d62fe){return _0x4542a2[_0xbbc8('0x2f')][_0xbbc8('0x32')](_0x4ec789)['then'](function(_0x19083f){_0x4542a2[_0xbbc8('0xe')][_0x4ec789['id']][_0xbbc8('0x31')][_0xbbc8('0x14')]=_0xbbc8('0x33');_0x4542a2[_0xbbc8('0xe')][_0x4ec789['id']][_0xbbc8('0x31')]['messageStatus']='';_0x4542a2[_0xbbc8('0x10')](_0x4ec789['id']);_0x1537e4(_0x19083f);})[_0xbbc8('0x2c')](function(_0x546690){_0x4542a2[_0xbbc8('0xe')][_0x4ec789['id']][_0xbbc8('0x31')][_0xbbc8('0x14')]='error';_0x4542a2[_0xbbc8('0xe')][_0x4ec789['id']][_0xbbc8('0x31')]['messageStatus']=_0x546690;_0x4542a2[_0xbbc8('0x10')](_0x4ec789['id']);_0x9d62fe(_0x546690);});});}return this[_0xbbc8('0x2f')]['verify'](_0x4ec789);};module[_0xbbc8('0x34')]=EmailChannel; \ No newline at end of file +var _0x82c8=['error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','isNil','Smtp','verified','verify','exports','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','provider','custom','imapAccounts','handleImapBox','handleImapEmail','bind','end','handleImapEnd','handleImapError','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','Mail\x20accepted\x20from\x20routing','catch'];(function(_0x2a3efe,_0x42c0f5){var _0x45f773=function(_0x2835ef){while(--_0x2835ef){_0x2a3efe['push'](_0x2a3efe['shift']());}};_0x45f773(++_0x42c0f5);}(_0x82c8,0x122));var _0x882c=function(_0x54af6a,_0x48fe6e){_0x54af6a=_0x54af6a-0x0;var _0x2bdb2b=_0x82c8[_0x54af6a];return _0x2bdb2b;};'use strict';var _=require('lodash');var moment=require(_0x882c('0x0'));var BPromise=require('bluebird');var md5=require(_0x882c('0x1'));var Redis=require(_0x882c('0x2'));var config=require(_0x882c('0x3'));var logger=require(_0x882c('0x4'))(_0x882c('0x5'));config[_0x882c('0x6')]=_[_0x882c('0x7')](config[_0x882c('0x6')],{'host':_0x882c('0x8'),'port':0x18eb});var io=require(_0x882c('0x9'))(new Redis(config['redis']));var EmailImap=require(_0x882c('0xa'));var EmailSmtp=require(_0x882c('0xb'));var mailAccount=require(_0x882c('0xc'));var md5Accounts={};function EmailChannel(_0x2d00d6){logger[_0x882c('0xd')]('start\x20email\x20channel');this[_0x882c('0xe')]=_0x2d00d6[_0x882c('0xe')];this['imapAccounts']={};this[_0x882c('0xf')]=new EmailSmtp();}EmailChannel[_0x882c('0x10')][_0x882c('0x11')]=function(_0x37f792){var _0x15bcac=this[_0x882c('0xe')][_0x37f792];var _0x47c740={'id':_0x15bcac['id'],'name':_0x15bcac[_0x882c('0x12')],'key':_0x15bcac[_0x882c('0x13')],'active':_0x15bcac[_0x882c('0x14')],'Imap':{'status':_0x15bcac[_0x882c('0x15')][_0x882c('0x16')],'messageStatus':_0x15bcac[_0x882c('0x15')][_0x882c('0x17')],'total':_0x15bcac[_0x882c('0x15')][_0x882c('0x18')]}};if(_['isNil'](md5Accounts[_0x37f792])){md5Accounts[_0x37f792]={};}var _0x2b0682=md5(JSON[_0x882c('0x19')](_0x47c740));if(md5Accounts[_0x37f792][_0x882c('0x1')]!==_0x2b0682){md5Accounts[_0x37f792][_0x882c('0x1')]=_0x2b0682;io[_0x882c('0x11')](_0x882c('0x1a'),_0x47c740);}};EmailChannel[_0x882c('0x10')][_0x882c('0x1b')]=function(_0x411999){for(var _0x5a1923 in _0x411999){if(_0x411999[_0x882c('0x1c')](_0x5a1923)){if(_0x411999[_0x5a1923]['Imap']&&_0x411999[_0x5a1923]['active']){var _0x33fc64=_0x411999[_0x5a1923]['Imap'];if(!_0x33fc64['service']&&_0x411999[_0x5a1923][_0x882c('0x1d')]!==_0x882c('0x1e'))_0x33fc64['service']=_0x411999[_0x5a1923]['provider'];if(!this[_0x882c('0x1f')]['hasOwnProperty'](_0x33fc64['id'])){this['imapAccounts'][_0x33fc64['id']]=new EmailImap(_0x33fc64,_0x411999[_0x5a1923][_0x882c('0x5')]);this[_0x882c('0x1f')][_0x33fc64['id']]['on']('box',this[_0x882c('0x20')]['bind'](this,_0x5a1923));this['imapAccounts'][_0x33fc64['id']]['on'](_0x882c('0x5'),this[_0x882c('0x21')][_0x882c('0x22')](this,_0x5a1923));this[_0x882c('0x1f')][_0x33fc64['id']]['on'](_0x882c('0x23'),this[_0x882c('0x24')]['bind'](this,_0x5a1923));this['imapAccounts'][_0x33fc64['id']]['on']('error',this[_0x882c('0x25')][_0x882c('0x22')](this,_0x5a1923));}}else{if(_['isNil'](this['mailAccounts'][_0x5a1923]['Imap'])){this[_0x882c('0xe')][_0x5a1923][_0x882c('0x15')]={};}this[_0x882c('0xe')][_0x5a1923]['Imap'][_0x882c('0x16')]=_0x882c('0x26');this[_0x882c('0xe')][_0x5a1923]['Imap'][_0x882c('0x17')]='';this[_0x882c('0x11')](_0x5a1923);}}}};EmailChannel[_0x882c('0x10')][_0x882c('0x20')]=function(_0x4f5076,_0x3fb723){if(this['mailAccounts'][_0x4f5076]){this[_0x882c('0xe')][_0x4f5076][_0x882c('0x15')][_0x882c('0x16')]='connected';this[_0x882c('0xe')][_0x4f5076][_0x882c('0x15')][_0x882c('0x17')]=_0x3fb723['name'];if(_0x3fb723['messages']){this['mailAccounts'][_0x4f5076][_0x882c('0x15')]['total']=_0x3fb723[_0x882c('0x27')][_0x882c('0x18')];}return this['emit'](_0x4f5076);}};EmailChannel[_0x882c('0x10')]['handleImapEmail']=function(_0x5397dd,_0x3a887f){logger['info'](_0x882c('0x28'),_0x3a887f[_0x882c('0x29')],_0x3a887f[_0x882c('0x2a')],_0x3a887f['from'],_0x5397dd);if(this[_0x882c('0xe')][_0x5397dd]){return mailAccount['notify'](_0x5397dd,_0x3a887f)[_0x882c('0x2b')](function(_0x31b838){if(_0x31b838){logger['info'](_0x882c('0x2c'));}})[_0x882c('0x2d')](function(_0x189171){logger[_0x882c('0x2e')](_0x882c('0x2f'),JSON[_0x882c('0x19')](_0x189171));});}};EmailChannel[_0x882c('0x10')][_0x882c('0x24')]=function(_0x51717c){if(this[_0x882c('0xe')][_0x51717c]&&this[_0x882c('0xe')][_0x51717c][_0x882c('0x15')]){if(this[_0x882c('0x1f')][this[_0x882c('0xe')][_0x51717c][_0x882c('0x15')]['id']]){delete this['imapAccounts'][this[_0x882c('0xe')][_0x51717c]['Imap']['id']];}this[_0x882c('0xe')][_0x51717c][_0x882c('0x15')][_0x882c('0x30')]=moment();this[_0x882c('0x11')](_0x51717c);}};EmailChannel['prototype'][_0x882c('0x25')]=function(_0xcc801,_0x4997ce){if(this[_0x882c('0xe')][_0xcc801]){this['mailAccounts'][_0xcc801]['Imap'][_0x882c('0x16')]=_0x882c('0x2e');this['mailAccounts'][_0xcc801][_0x882c('0x15')][_0x882c('0x17')]=_0x4997ce;return this['emit'](_0xcc801);}};EmailChannel['prototype']['sendMail']=function(_0x534dee,_0x264460){return this['smtp'][_0x882c('0x31')](_0x534dee,_0x264460);};EmailChannel[_0x882c('0x10')][_0x882c('0x32')]=function(_0x51748d){var _0x32170d=this;if(this[_0x882c('0xe')][_0x51748d['id']]){if(_[_0x882c('0x33')](this['mailAccounts'][_0x51748d['id']][_0x882c('0x34')])){this[_0x882c('0xe')][_0x51748d['id']][_0x882c('0x34')]={};}this[_0x882c('0xe')][_0x51748d['id']][_0x882c('0x34')][_0x882c('0x30')]=moment();return new BPromise(function(_0x13ec1c,_0x3a016f){return _0x32170d[_0x882c('0xf')]['verify'](_0x51748d)['then'](function(_0x5a4f73){_0x32170d['mailAccounts'][_0x51748d['id']][_0x882c('0x34')][_0x882c('0x16')]=_0x882c('0x35');_0x32170d[_0x882c('0xe')][_0x51748d['id']]['Smtp'][_0x882c('0x17')]='';_0x32170d['emit'](_0x51748d['id']);_0x13ec1c(_0x5a4f73);})[_0x882c('0x2d')](function(_0x55448f){_0x32170d[_0x882c('0xe')][_0x51748d['id']]['Smtp'][_0x882c('0x16')]=_0x882c('0x2e');_0x32170d[_0x882c('0xe')][_0x51748d['id']][_0x882c('0x34')][_0x882c('0x17')]=_0x55448f;_0x32170d[_0x882c('0x11')](_0x51748d['id']);_0x3a016f(_0x55448f);});});}return this[_0x882c('0xf')][_0x882c('0x36')](_0x51748d);};module[_0x882c('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 1327681..6235395 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 _0xcd11=['box','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','fetch','message','error','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','handleError','connect','prototype','connTimeout','authTimeout','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','emit'];(function(_0x10635a,_0x320f30){var _0x2e3b5b=function(_0x51668a){while(--_0x51668a){_0x10635a['push'](_0x10635a['shift']());}};_0x2e3b5b(++_0x320f30);}(_0xcd11,0x102));var _0x1cd1=function(_0x4e265f,_0x34beac){_0x4e265f=_0x4e265f-0x0;var _0x30375f=_0xcd11[_0x4e265f];return _0x30375f;};'use strict';var _=require(_0x1cd1('0x0'));var util=require(_0x1cd1('0x1'));var Imap=require(_0x1cd1('0x2'));var simpleParser=require(_0x1cd1('0x3'))['simpleParser'];var Iconv=require(_0x1cd1('0x4'))[_0x1cd1('0x5')];var EventEmitter=require(_0x1cd1('0x6'))['EventEmitter'];var utils=require(_0x1cd1('0x7'));var logger=require(_0x1cd1('0x8'))(_0x1cd1('0x9'));function EmailImap(_0x27e7f8,_0x1bbe9d){this[_0x1cd1('0xa')]=_0x27e7f8[_0x1cd1('0xa')];this[_0x1cd1('0xb')]=this[_0x1cd1('0xc')](_0x27e7f8,_0x1bbe9d);this[_0x1cd1('0x2')]=new Imap(this['account']);this[_0x1cd1('0x2')][_0x1cd1('0xd')](_0x1cd1('0xe'),this[_0x1cd1('0xf')][_0x1cd1('0x10')](this));this[_0x1cd1('0x2')]['once']('end',this[_0x1cd1('0x11')]['bind'](this));this[_0x1cd1('0x2')]['on']('error',this[_0x1cd1('0x12')][_0x1cd1('0x10')](this));this[_0x1cd1('0x2')][_0x1cd1('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x1cd1('0x14')][_0x1cd1('0xc')]=function(_0x1a71e8,_0x326cec){var _0x3509c5={'connTimeout':_0x1a71e8[_0x1cd1('0x15')]?_0x1a71e8[_0x1cd1('0x15')]*0x3e8:0x2710,'authTimeout':_0x1a71e8[_0x1cd1('0x16')]?_0x1a71e8['authTimeout']*0x3e8:0x1388};if(_0x1a71e8['service']){_0x3509c5[_0x1cd1('0x17')]=_0x1a71e8[_0x1cd1('0x17')];if(_0x1a71e8[_0x1cd1('0x18')]){_0x3509c5['xoauth2']=utils[_0x1cd1('0x19')](_0x1a71e8[_0x1cd1('0x1a')][_0x1cd1('0x1b')],_0x1a71e8[_0x1cd1('0x17')]);}else{_0x3509c5[_0x1cd1('0x1c')]=_0x1a71e8['password'];}}else{if(_0x1a71e8['authentication']){_0x3509c5[_0x1cd1('0x17')]=_0x1a71e8[_0x1cd1('0x17')];_0x3509c5[_0x1cd1('0x1c')]=_0x1a71e8[_0x1cd1('0x1c')];}}_0x3509c5['email']=_0x326cec||_0x1a71e8[_0x1cd1('0x17')]||_0x1cd1('0x1d');_0x3509c5[_0x1cd1('0x1e')]=_0x1a71e8[_0x1cd1('0x1e')];_0x3509c5[_0x1cd1('0x1f')]=_0x1a71e8[_0x1cd1('0x1f')]||0x3e1;if(_0x1a71e8[_0x1cd1('0x20')]){_0x3509c5[_0x1cd1('0x20')]=!![];}else{_0x3509c5[_0x1cd1('0x20')]=![];_0x3509c5['autotls']=_0x1cd1('0x21');}return _0x3509c5;};EmailImap['prototype'][_0x1cd1('0xf')]=function(){this[_0x1cd1('0x2')][_0x1cd1('0x22')](this[_0x1cd1('0xa')],![],this[_0x1cd1('0x23')][_0x1cd1('0x10')](this));};EmailImap[_0x1cd1('0x14')][_0x1cd1('0x23')]=function(_0x4898d5,_0x5e6ee0){if(_0x4898d5){this[_0x1cd1('0x12')](_0x4898d5,!![]);}else{this[_0x1cd1('0x24')](_0x1cd1('0x25'),_0x5e6ee0);this[_0x1cd1('0x26')]();}};EmailImap[_0x1cd1('0x14')][_0x1cd1('0x27')]=function(_0x448ad2){if(_0x448ad2){this[_0x1cd1('0x12')](_0x448ad2,!![]);}else{this[_0x1cd1('0x2')][_0x1cd1('0x28')]();}};EmailImap[_0x1cd1('0x14')][_0x1cd1('0x26')]=function(){this[_0x1cd1('0x2')][_0x1cd1('0x29')](['UNSEEN'],this[_0x1cd1('0x2a')][_0x1cd1('0x10')](this));};EmailImap[_0x1cd1('0x14')][_0x1cd1('0x2a')]=function(_0x1c048e,_0x3a405d){if(_0x1c048e){this[_0x1cd1('0x12')](_0x1c048e,!![]);}else{if(_0x3a405d[_0x1cd1('0x2b')]){try{var _0x2f7620=this[_0x1cd1('0x2')][_0x1cd1('0x2c')](_0x3a405d,{'bodies':'','markSeen':!![]});_0x2f7620['on'](_0x1cd1('0x2d'),this['handleFetchMessage']['bind'](this));_0x2f7620['once'](_0x1cd1('0x2e'),this[_0x1cd1('0x2f')][_0x1cd1('0x10')](this));_0x2f7620[_0x1cd1('0xd')](_0x1cd1('0x28'),this[_0x1cd1('0x30')]['bind'](this));}catch(_0x4b6782){logger[_0x1cd1('0x2e')](_0x4b6782);}}else{this[_0x1cd1('0x2')][_0x1cd1('0x31')](!![],this[_0x1cd1('0x27')][_0x1cd1('0x10')](this));}}};EmailImap[_0x1cd1('0x14')]['handleFetchMessage']=function(_0x2e5ea8){_0x2e5ea8['on']('body',this[_0x1cd1('0x32')][_0x1cd1('0x10')](this));_0x2e5ea8[_0x1cd1('0xd')](_0x1cd1('0x33'),this[_0x1cd1('0x34')][_0x1cd1('0x10')](this));_0x2e5ea8[_0x1cd1('0xd')](_0x1cd1('0x28'),this['handleMessageEnd'][_0x1cd1('0x10')](this));};EmailImap[_0x1cd1('0x14')]['handleMessageBody']=function(_0x231a42){simpleParser(_0x231a42,{'Iconv':Iconv},this[_0x1cd1('0x35')][_0x1cd1('0x10')](this));};EmailImap[_0x1cd1('0x14')]['handleMessageAttributes']=function(){};EmailImap[_0x1cd1('0x14')][_0x1cd1('0x36')]=function(){};EmailImap['prototype'][_0x1cd1('0x35')]=function(_0x2e5b48,_0x2e4645){if(_0x2e5b48){logger['error'](_0x2e5b48);}else{var _0x8fc04f=this;utils['parser'](this[_0x1cd1('0xb')],_0x2e4645,function(_0x15c43c){_0x8fc04f[_0x1cd1('0x24')](_0x1cd1('0x9'),_0x15c43c);});}};EmailImap[_0x1cd1('0x14')]['handleFetchEnd']=function(){this[_0x1cd1('0x2')]['closeBox'](!![],this[_0x1cd1('0x27')][_0x1cd1('0x10')](this));};EmailImap[_0x1cd1('0x14')][_0x1cd1('0x2f')]=function(_0x132fe5){this[_0x1cd1('0x12')](_0x132fe5);this[_0x1cd1('0x2')][_0x1cd1('0x31')](!![],this['handleCloseBox'][_0x1cd1('0x10')](this));};EmailImap[_0x1cd1('0x14')][_0x1cd1('0x11')]=function(){this[_0x1cd1('0x24')]('end');};EmailImap[_0x1cd1('0x14')]['handleError']=function(_0x37217f,_0x399420){logger[_0x1cd1('0x2e')](_0x1cd1('0x12'),this['account'][_0x1cd1('0x9')],JSON[_0x1cd1('0x37')](_0x37217f));var _0x22fcbb='';if(_0x37217f){if(_0x37217f[_0x1cd1('0x38')]){_0x22fcbb=_0x37217f[_0x1cd1('0x38')];}else{for(var _0x2f0963 in _0x37217f){if(_0x37217f[_0x1cd1('0x39')](_0x2f0963)){_0x22fcbb+=_[_0x1cd1('0x3a')](_0x2f0963)+':\x20'+_0x37217f[_0x2f0963]+'\x0a';}}}}if(_0x399420){this[_0x1cd1('0x2')][_0x1cd1('0x28')]();}else{this[_0x1cd1('0x24')]('error',_0x22fcbb);this[_0x1cd1('0x24')](_0x1cd1('0x28'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x78db=['emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','prototype','openBox','handleOpenBox'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x78db,0xcc));var _0xb78d=function(_0x3b45e8,_0x628af6){_0x3b45e8=_0x3b45e8-0x0;var _0x370099=_0x78db[_0x3b45e8];return _0x370099;};'use strict';var _=require(_0xb78d('0x0'));var util=require(_0xb78d('0x1'));var Imap=require(_0xb78d('0x2'));var simpleParser=require(_0xb78d('0x3'))[_0xb78d('0x4')];var Iconv=require(_0xb78d('0x5'))[_0xb78d('0x6')];var EventEmitter=require('events')[_0xb78d('0x7')];var utils=require(_0xb78d('0x8'));var logger=require('../../../config/logger')(_0xb78d('0x9'));function EmailImap(_0x5d7dfe,_0x129afc){this[_0xb78d('0xa')]=_0x5d7dfe[_0xb78d('0xa')];this[_0xb78d('0xb')]=this[_0xb78d('0xc')](_0x5d7dfe,_0x129afc);this[_0xb78d('0x2')]=new Imap(this[_0xb78d('0xb')]);this['imap'][_0xb78d('0xd')](_0xb78d('0xe'),this[_0xb78d('0xf')][_0xb78d('0x10')](this));this[_0xb78d('0x2')][_0xb78d('0xd')](_0xb78d('0x11'),this[_0xb78d('0x12')][_0xb78d('0x10')](this));this['imap']['on'](_0xb78d('0x13'),this[_0xb78d('0x14')][_0xb78d('0x10')](this));this[_0xb78d('0x2')][_0xb78d('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xb78d('0xc')]=function(_0x3cd53b,_0x198f73){var _0x3717d3={'connTimeout':_0x3cd53b[_0xb78d('0x16')]?_0x3cd53b[_0xb78d('0x16')]*0x3e8:0x2710,'authTimeout':_0x3cd53b[_0xb78d('0x17')]?_0x3cd53b[_0xb78d('0x17')]*0x3e8:0x1388};if(_0x3cd53b[_0xb78d('0x18')]){_0x3717d3[_0xb78d('0x19')]=_0x3cd53b[_0xb78d('0x19')];if(_0x3cd53b[_0xb78d('0x1a')]){_0x3717d3['xoauth2']=utils[_0xb78d('0x1b')](_0x3cd53b[_0xb78d('0x1c')][_0xb78d('0x1d')],_0x3cd53b[_0xb78d('0x19')]);}else{_0x3717d3['password']=_0x3cd53b[_0xb78d('0x1e')];}}else{if(_0x3cd53b[_0xb78d('0x1f')]){_0x3717d3[_0xb78d('0x19')]=_0x3cd53b[_0xb78d('0x19')];_0x3717d3['password']=_0x3cd53b[_0xb78d('0x1e')];}}_0x3717d3[_0xb78d('0x9')]=_0x198f73||_0x3cd53b[_0xb78d('0x19')]||'anonymous@xcally.com';_0x3717d3['host']=_0x3cd53b[_0xb78d('0x20')];_0x3717d3['port']=_0x3cd53b[_0xb78d('0x21')]||0x3e1;if(_0x3cd53b[_0xb78d('0x22')]){_0x3717d3['tls']=!![];}else{_0x3717d3[_0xb78d('0x22')]=![];_0x3717d3[_0xb78d('0x23')]=_0xb78d('0x24');}return _0x3717d3;};EmailImap[_0xb78d('0x25')][_0xb78d('0xf')]=function(){this['imap'][_0xb78d('0x26')](this[_0xb78d('0xa')],![],this[_0xb78d('0x27')][_0xb78d('0x10')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x3d6354,_0x6b2d13){if(_0x3d6354){this['handleError'](_0x3d6354,!![]);}else{this[_0xb78d('0x28')](_0xb78d('0x29'),_0x6b2d13);this[_0xb78d('0x2a')]();}};EmailImap[_0xb78d('0x25')][_0xb78d('0x2b')]=function(_0xa5ce5c){if(_0xa5ce5c){this[_0xb78d('0x14')](_0xa5ce5c,!![]);}else{this[_0xb78d('0x2')][_0xb78d('0x11')]();}};EmailImap[_0xb78d('0x25')][_0xb78d('0x2a')]=function(){this[_0xb78d('0x2')][_0xb78d('0x2c')]([_0xb78d('0x2d')],this[_0xb78d('0x2e')][_0xb78d('0x10')](this));};EmailImap['prototype'][_0xb78d('0x2e')]=function(_0x177f58,_0x5d6190){if(_0x177f58){this[_0xb78d('0x14')](_0x177f58,!![]);}else{if(_0x5d6190['length']){try{var _0x4d0d8f=this[_0xb78d('0x2')]['fetch'](_0x5d6190,{'bodies':'','markSeen':!![]});_0x4d0d8f['on']('message',this[_0xb78d('0x2f')][_0xb78d('0x10')](this));_0x4d0d8f[_0xb78d('0xd')](_0xb78d('0x13'),this[_0xb78d('0x30')][_0xb78d('0x10')](this));_0x4d0d8f[_0xb78d('0xd')](_0xb78d('0x11'),this[_0xb78d('0x31')][_0xb78d('0x10')](this));}catch(_0x4b6135){logger[_0xb78d('0x13')](_0x4b6135);}}else{this['imap'][_0xb78d('0x32')](!![],this[_0xb78d('0x2b')][_0xb78d('0x10')](this));}}};EmailImap[_0xb78d('0x25')]['handleFetchMessage']=function(_0x523bc5){_0x523bc5['on'](_0xb78d('0x33'),this[_0xb78d('0x34')][_0xb78d('0x10')](this));_0x523bc5[_0xb78d('0xd')](_0xb78d('0x35'),this[_0xb78d('0x36')][_0xb78d('0x10')](this));_0x523bc5[_0xb78d('0xd')](_0xb78d('0x11'),this[_0xb78d('0x37')][_0xb78d('0x10')](this));};EmailImap[_0xb78d('0x25')][_0xb78d('0x34')]=function(_0x458104){simpleParser(_0x458104,{'Iconv':Iconv},this[_0xb78d('0x38')][_0xb78d('0x10')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0xb78d('0x37')]=function(){};EmailImap[_0xb78d('0x25')][_0xb78d('0x38')]=function(_0xba85c8,_0x5a5fcb){if(_0xba85c8){logger[_0xb78d('0x13')](_0xba85c8);}else{var _0x30b068=this;utils[_0xb78d('0x39')](this[_0xb78d('0xb')],_0x5a5fcb,function(_0x23ddae){_0x30b068[_0xb78d('0x28')](_0xb78d('0x9'),_0x23ddae);});}};EmailImap[_0xb78d('0x25')]['handleFetchEnd']=function(){this[_0xb78d('0x2')][_0xb78d('0x32')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xb78d('0x25')]['handleFetchError']=function(_0xe14f9f){this[_0xb78d('0x14')](_0xe14f9f);this[_0xb78d('0x2')][_0xb78d('0x32')](!![],this[_0xb78d('0x2b')][_0xb78d('0x10')](this));};EmailImap[_0xb78d('0x25')][_0xb78d('0x12')]=function(){this[_0xb78d('0x28')](_0xb78d('0x11'));};EmailImap[_0xb78d('0x25')][_0xb78d('0x14')]=function(_0x166b0b,_0x14fd2e){logger['error']('handleError',this[_0xb78d('0xb')][_0xb78d('0x9')],JSON[_0xb78d('0x3a')](_0x166b0b));var _0x28edc3='';if(_0x166b0b){if(_0x166b0b['textCode']){_0x28edc3=_0x166b0b['textCode'];}else{for(var _0x57eb87 in _0x166b0b){if(_0x166b0b['hasOwnProperty'](_0x57eb87)){_0x28edc3+=_[_0xb78d('0x3b')](_0x57eb87)+':\x20'+_0x166b0b[_0x57eb87]+'\x0a';}}}}if(_0x14fd2e){this['imap']['end']();}else{this[_0xb78d('0x28')](_0xb78d('0x13'),_0x28edc3);this[_0xb78d('0x28')](_0xb78d('0x11'));}};module[_0xb78d('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d81b863..bc0327c 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 _0x7ab4=['createTransport','use','compile','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ab4,0xb1));var _0x47ab=function(_0x589002,_0x1c9c42){_0x589002=_0x589002-0x0;var _0x1ebe5a=_0x7ab4[_0x589002];return _0x1ebe5a;};'use strict';var nodemailer=require(_0x47ab('0x0'));var inlineBase64=require(_0x47ab('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x47ab('0x2')]=function(_0x3c7e83,_0x170431){return new Promise(function(_0x1e21ac,_0x45438f){var _0x835a84=nodemailer[_0x47ab('0x3')](_0x3c7e83);_0x835a84[_0x47ab('0x4')](_0x47ab('0x5'),inlineBase64());_0x835a84[_0x47ab('0x6')](_0x170431,function(_0x4deb0d,_0x1970a6){if(_0x4deb0d){_0x45438f(_0x4deb0d[_0x47ab('0x7')]());}else{_0x1e21ac(_0x1970a6);}});});};EmailSmtp['prototype'][_0x47ab('0x8')]=function(_0x3af829){return new Promise(function(_0x4196ac,_0x7941b3){var _0x2cceff=nodemailer[_0x47ab('0x3')](_0x3af829);_0x2cceff['verify'](function(_0xcf585b,_0x233b51){if(_0xcf585b){_0x7941b3(_0xcf585b['toString']());}else{if(_0x233b51){_0x4196ac(_0x233b51);}else{_0x7941b3('Not\x20verifired');}}});});};module[_0x47ab('0x9')]=EmailSmtp; \ No newline at end of file +var _0x608d=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x608d,0x145));var _0xd608=function(_0x389b0b,_0x14aa6d){_0x389b0b=_0x389b0b-0x0;var _0x454829=_0x608d[_0x389b0b];return _0x454829;};'use strict';var nodemailer=require(_0xd608('0x0'));var inlineBase64=require(_0xd608('0x1'));function EmailSmtp(){}EmailSmtp[_0xd608('0x2')][_0xd608('0x3')]=function(_0x2baac8,_0x490ee4){return new Promise(function(_0xb685bc,_0x1ef2ec){var _0x5e6925=nodemailer[_0xd608('0x4')](_0x2baac8);_0x5e6925[_0xd608('0x5')](_0xd608('0x6'),inlineBase64());_0x5e6925[_0xd608('0x7')](_0x490ee4,function(_0x5bc3bb,_0x334a37){if(_0x5bc3bb){_0x1ef2ec(_0x5bc3bb[_0xd608('0x8')]());}else{_0xb685bc(_0x334a37);}});});};EmailSmtp[_0xd608('0x2')][_0xd608('0x9')]=function(_0x4af056){return new Promise(function(_0x47bf32,_0x6b62a8){var _0x1393b1=nodemailer[_0xd608('0x4')](_0x4af056);_0x1393b1[_0xd608('0x9')](function(_0x64bdcb,_0xb874a5){if(_0x64bdcb){_0x6b62a8(_0x64bdcb['toString']());}else{if(_0xb874a5){_0x47bf32(_0xb874a5);}else{_0x6b62a8(_0xd608('0xa'));}}});});};module[_0xd608('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6356fbb..3ff8619 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 _0x2e90=['split','pop','isEmpty','test','html','includes','','body','textAsHtml','message','originTo','originCc','bcc','attach','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','anonymous','generate','@xcally.com','head','name','address','substring','indexOf','length','slice','join','Anonymous'];(function(_0x5f0af7,_0x1594af){var _0x2c5bce=function(_0x5eda22){while(--_0x5eda22){_0x5f0af7['push'](_0x5f0af7['shift']());}};_0x2c5bce(++_0x1594af);}(_0x2e90,0x88));var _0x02e9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2e90[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x02e9('0x0'));var moment=require(_0x02e9('0x1'));var random=require(_0x02e9('0x2'));var fs=require('fs');var path=require(_0x02e9('0x3'));var util=require(_0x02e9('0x4'));var tnef=require(_0x02e9('0x5'));var logger=require(_0x02e9('0x6'))(_0x02e9('0x7'));var config=require(_0x02e9('0x8'));function getAddress(_0x3e59ce){var _0x596e72=_['head'](_0x3e59ce[_0x02e9('0x9')]);return _0x596e72&&_0x596e72['address']?_0x596e72['address']:_0x02e9('0xa')+random[_0x02e9('0xb')](0x6)+_0x02e9('0xc');}function getFirstName(_0x23ba77){var _0x379254=_[_0x02e9('0xd')](_0x23ba77['value']);if(_0x379254&&_0x379254[_0x02e9('0xe')]){if(_0x379254[_0x02e9('0xe')]==_0x379254[_0x02e9('0xf')]){return _0x379254[_0x02e9('0xe')][_0x02e9('0x10')](0x0,_0x379254['name'][_0x02e9('0x11')]('@'));}var _0x5a5561=_0x379254[_0x02e9('0xe')]['split'](/\s+/);return _0x5a5561[_0x02e9('0x12')]>0x1?_0x5a5561[_0x02e9('0x13')](0x0,-0x1)[_0x02e9('0x14')]('\x20'):_0x379254[_0x02e9('0xe')];}return _0x02e9('0x15');}function getLastName(_0x173e14){var _0x5e2af4=_[_0x02e9('0xd')](_0x173e14[_0x02e9('0x9')]);if(_0x5e2af4&&_0x5e2af4[_0x02e9('0xe')]){var _0x3daa97=_0x5e2af4['name'][_0x02e9('0x16')](/\s+/);return _0x3daa97[_0x02e9('0x12')]>0x1?_0x3daa97[_0x02e9('0x17')]():'';}return'';}function getMails(_0x568633,_0x4d98da){var _0x3b99f0='';for(var _0x2402ec=0x0;_0x2402ec<_0x4d98da[_0x02e9('0x9')][_0x02e9('0x12')];_0x2402ec+=0x1){if(_0x4d98da[_0x02e9('0x9')][_0x2402ec][_0x02e9('0xf')]!==_0x568633){if(!_[_0x02e9('0x18')](_0x3b99f0)){_0x3b99f0+=',';}_0x3b99f0+=_0x4d98da[_0x02e9('0x9')][_0x2402ec][_0x02e9('0xe')]||_0x4d98da[_0x02e9('0x9')][_0x2402ec][_0x02e9('0xf')]||'';_0x3b99f0+='\x20<';_0x3b99f0+=_0x4d98da[_0x02e9('0x9')][_0x2402ec]['address']?_0x4d98da[_0x02e9('0x9')][_0x2402ec][_0x02e9('0xf')]:_0x02e9('0xa')+random[_0x02e9('0xb')](0x6)+'@xcally.com';_0x3b99f0+='>';}}return _0x3b99f0;}function parseEmail(_0x59df70,_0x55ff88,_0x540ec6){if(_0x55ff88['html']){var _0x24c591=/)<[^<]*)*<\/script>/gi;while(_0x24c591[_0x02e9('0x19')](_0x55ff88[_0x02e9('0x1a')])){_0x55ff88[_0x02e9('0x1a')]=_0x55ff88[_0x02e9('0x1a')]['replace'](_0x24c591,'');}if(_0x55ff88[_0x02e9('0x1a')][_0x02e9('0x1b')](_0x02e9('0x1c'))){var _0x6b3853=[];_0x55ff88[_0x02e9('0x1d')][_0x02e9('0x1e')](_0x4f768e=>{_0x6b3853['push'](_0x4f768e[_0x02e9('0x1f')]);});var _0x4be88e=/]+>/g;var _0x26cb0a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5c81a7=_0x55ff88[_0x02e9('0x1a')][_0x02e9('0x20')](_0x26cb0a,'_SRC');var _0x4d8dfb=_0x5c81a7['replace'](_0x4be88e,_0x02e9('0x21'));for(let _0x185a85=0x0;_0x185a85<_0x6b3853[_0x02e9('0x12')];_0x185a85++){var _0x5768db=_0x4d8dfb[_0x02e9('0x20')](_0x02e9('0x21'),'\x20[Attachment:\x20'+_0x6b3853[_0x185a85]+_0x02e9('0x22'));_0x4d8dfb=_0x5768db;}_0x55ff88['html']=_0x4d8dfb;}_0x540ec6[_0x02e9('0x23')]=_0x55ff88[_0x02e9('0x1a')];}else{_0x540ec6[_0x02e9('0x23')]=_0x55ff88[_0x02e9('0x24')];}if(_0x540ec6[_0x02e9('0x23')]){_0x540ec6[_0x02e9('0x23')]=_0x540ec6['body'][_0x02e9('0x20')](/0x0){var _0x217669=[_0x02e9('0x37'),_0x02e9('0x38'),_0x02e9('0x39')];for(var _0x44b05d=0x0;_0x44b05d<_0x55ff88[_0x02e9('0x36')][_0x02e9('0x12')];_0x44b05d++){var _0x3ddce8=_[_0x02e9('0x11')](_0x217669,_0x55ff88[_0x02e9('0x36')][_0x44b05d][_0x02e9('0x3a')]);if(_0x3ddce8>=0x0){_0x540ec6['isAutoreply']=!![];}}}return _0x540ec6;}exports[_0x02e9('0x3b')]=function(_0x1254da,_0x23e4b1,_0x57c508){var _0x4b8959={'from':getAddress(_0x23e4b1['from']),'firstName':getFirstName(_0x23e4b1[_0x02e9('0x3c')]),'lastName':getLastName(_0x23e4b1[_0x02e9('0x3c')]),'mapKey':_0x02e9('0x7'),'message':{'from':getMails(_0x1254da[_0x02e9('0x7')],_0x23e4b1['from']),'to':_0x1254da[_0x02e9('0x7')],'cc':'','subject':_0x23e4b1[_0x02e9('0x3d')]||'','messageId':_0x23e4b1[_0x02e9('0x3e')],'inReplyTo':_0x23e4b1[_0x02e9('0x3f')],'sentAt':moment(_0x23e4b1[_0x02e9('0x40')])[_0x02e9('0x2d')](_0x02e9('0x41')),'attach':![],'attachments':[]}};if(!_0x23e4b1[_0x02e9('0x1a')]&&!_0x23e4b1['textAsHtml']){var _0x5cde04=_['filter'](_0x23e4b1['attachments'],{'contentType':_0x02e9('0x42')});if(_0x5cde04[_0x02e9('0x12')]){logger[_0x02e9('0x43')](util['format'](_0x02e9('0x44'),_0x23e4b1[_0x02e9('0x3e')]));tnef[_0x02e9('0x45')](_['first'](_0x5cde04)[_0x02e9('0x33')],function(_0x29740f,_0x3d155a){if(_0x3d155a){_0x23e4b1['html']=_0x3d155a[_0x02e9('0x46')]||_0x02e9('0x47');if(_0x3d155a['Attachments']){for(var _0x192f25=0x0;_0x192f25<_0x3d155a[_0x02e9('0x48')][_0x02e9('0x12')];_0x192f25++){var _0x473f9b=_0x3d155a[_0x02e9('0x48')][_0x192f25];_0x4b8959['message']['attachments'][_0x02e9('0x34')]({'filename':_0x473f9b[_0x02e9('0x49')],'content':Buffer[_0x02e9('0x3c')](_0x473f9b[_0x02e9('0x4a')])});}}}_0x57c508(parseEmail(_0x1254da,_0x23e4b1,_0x4b8959));});}else{_0x23e4b1[_0x02e9('0x1a')]=_0x02e9('0x47');_0x57c508(parseEmail(_0x1254da,_0x23e4b1,_0x4b8959));}}else{_0x57c508(parseEmail(_0x1254da,_0x23e4b1,_0x4b8959));}};exports['generateXOAuth2Token']=function(_0x393634,_0x5063f4){var _0x21d003=[_0x02e9('0x4b')+(_0x5063f4||''),_0x02e9('0x4c')+_0x393634,'',''];return Buffer[_0x02e9('0x3c')](_0x21d003['join'](''),'utf-8')[_0x02e9('0x4d')](_0x02e9('0x4e'));}; \ No newline at end of file +var _0x1fc5=['attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','user=','toString','lodash','moment','path','node-tnef','../../../config/environment','head','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','value','html','test','replace','includes','attachments','forEach','push','filename','_IMG','textAsHtml','body','0x1?_0x2f23c3[_0x51fc('0xe')](0x0,-0x1)[_0x51fc('0xf')]('\x20'):_0x37cfd3['name'];}return _0x51fc('0x10');}function getLastName(_0x560b5d){var _0x157c8=_['head'](_0x560b5d[_0x51fc('0x11')]);if(_0x157c8&&_0x157c8[_0x51fc('0x9')]){var _0x4342b2=_0x157c8['name'][_0x51fc('0xc')](/\s+/);return _0x4342b2[_0x51fc('0xd')]>0x1?_0x4342b2['pop']():'';}return'';}function getMails(_0x4775e3,_0x20d91b){var _0x13170a='';for(var _0x1eae3d=0x0;_0x1eae3d<_0x20d91b[_0x51fc('0x11')][_0x51fc('0xd')];_0x1eae3d+=0x1){if(_0x20d91b['value'][_0x1eae3d]['address']!==_0x4775e3){if(!_['isEmpty'](_0x13170a)){_0x13170a+=',';}_0x13170a+=_0x20d91b['value'][_0x1eae3d][_0x51fc('0x9')]||_0x20d91b['value'][_0x1eae3d][_0x51fc('0x6')]||'';_0x13170a+='\x20<';_0x13170a+=_0x20d91b[_0x51fc('0x11')][_0x1eae3d][_0x51fc('0x6')]?_0x20d91b[_0x51fc('0x11')][_0x1eae3d][_0x51fc('0x6')]:_0x51fc('0x7')+random['generate'](0x6)+'@xcally.com';_0x13170a+='>';}}return _0x13170a;}function parseEmail(_0x2622c7,_0x3f71a9,_0x309d26){if(_0x3f71a9[_0x51fc('0x12')]){var _0x2d5615=/)<[^<]*)*<\/script>/gi;while(_0x2d5615[_0x51fc('0x13')](_0x3f71a9[_0x51fc('0x12')])){_0x3f71a9['html']=_0x3f71a9[_0x51fc('0x12')][_0x51fc('0x14')](_0x2d5615,'');}if(_0x3f71a9[_0x51fc('0x12')][_0x51fc('0x15')]('{_0x5ba8b7[_0x51fc('0x18')](_0x40e8bb[_0x51fc('0x19')]);});var _0x4eb1bf=/]+>/g;var _0x3e056a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x23bacb=_0x3f71a9[_0x51fc('0x12')]['replace'](_0x3e056a,'_SRC');var _0x3bb79e=_0x23bacb[_0x51fc('0x14')](_0x4eb1bf,_0x51fc('0x1a'));for(let _0x21b09e=0x0;_0x21b09e<_0x5ba8b7[_0x51fc('0xd')];_0x21b09e++){var _0x262cf6=_0x3bb79e[_0x51fc('0x14')](_0x51fc('0x1a'),'\x20[Attachment:\x20'+_0x5ba8b7[_0x21b09e]+'\x20]');_0x3bb79e=_0x262cf6;}_0x3f71a9['html']=_0x3bb79e;}_0x309d26['body']=_0x3f71a9[_0x51fc('0x12')];}else{_0x309d26['body']=_0x3f71a9[_0x51fc('0x1b')];}if(_0x309d26[_0x51fc('0x1c')]){_0x309d26[_0x51fc('0x1c')]=_0x309d26[_0x51fc('0x1c')][_0x51fc('0x14')](/0x0){var _0x1eabed=[_0x51fc('0x2f'),_0x51fc('0x30'),_0x51fc('0x31')];for(var _0x318859=0x0;_0x318859<_0x3f71a9[_0x51fc('0x2e')][_0x51fc('0xd')];_0x318859++){var _0x2cd826=_[_0x51fc('0xb')](_0x1eabed,_0x3f71a9[_0x51fc('0x2e')][_0x318859][_0x51fc('0x32')]);if(_0x2cd826>=0x0){_0x309d26[_0x51fc('0x33')]=!![];}}}return _0x309d26;}exports['parser']=function(_0x49912e,_0x262309,_0x42590c){var _0x58a8e7={'from':getAddress(_0x262309[_0x51fc('0x34')]),'firstName':getFirstName(_0x262309[_0x51fc('0x34')]),'lastName':getLastName(_0x262309[_0x51fc('0x34')]),'mapKey':_0x51fc('0x20'),'message':{'from':getMails(_0x49912e[_0x51fc('0x20')],_0x262309[_0x51fc('0x34')]),'to':_0x49912e[_0x51fc('0x20')],'cc':'','subject':_0x262309['subject']||'','messageId':_0x262309[_0x51fc('0x35')],'inReplyTo':_0x262309[_0x51fc('0x36')],'sentAt':moment(_0x262309[_0x51fc('0x37')])[_0x51fc('0x27')](_0x51fc('0x38')),'attach':![],'attachments':[]}};if(!_0x262309[_0x51fc('0x12')]&&!_0x262309[_0x51fc('0x1b')]){var _0x2a64fd=_[_0x51fc('0x39')](_0x262309[_0x51fc('0x16')],{'contentType':_0x51fc('0x3a')});if(_0x2a64fd['length']){logger[_0x51fc('0x3b')](util['format'](_0x51fc('0x3c'),_0x262309[_0x51fc('0x35')]));tnef['parseBuffer'](_[_0x51fc('0x3d')](_0x2a64fd)['content'],function(_0x315798,_0x22538a){if(_0x22538a){_0x262309[_0x51fc('0x12')]=_0x22538a[_0x51fc('0x3e')]||'

Empty\x20message

';if(_0x22538a[_0x51fc('0x3f')]){for(var _0x4088a6=0x0;_0x4088a6<_0x22538a['Attachments'][_0x51fc('0xd')];_0x4088a6++){var _0x2eb004=_0x22538a['Attachments'][_0x4088a6];_0x58a8e7[_0x51fc('0x1e')]['attachments'][_0x51fc('0x18')]({'filename':_0x2eb004[_0x51fc('0x40')],'content':Buffer[_0x51fc('0x34')](_0x2eb004[_0x51fc('0x41')])});}}}_0x42590c(parseEmail(_0x49912e,_0x262309,_0x58a8e7));});}else{_0x262309[_0x51fc('0x12')]=_0x51fc('0x42');_0x42590c(parseEmail(_0x49912e,_0x262309,_0x58a8e7));}}else{_0x42590c(parseEmail(_0x49912e,_0x262309,_0x58a8e7));}};exports['generateXOAuth2Token']=function(_0x1cd7c5,_0x5c3ea3){var _0x3e3661=[_0x51fc('0x43')+(_0x5c3ea3||''),'auth=Bearer\x20'+_0x1cd7c5,'',''];return Buffer[_0x51fc('0x34')](_0x3e3661[_0x51fc('0xf')](''),'utf-8')[_0x51fc('0x44')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 69d82ef..4c9a0c9 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 _0x4fd7=['key','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x5397bb,_0x22af37){var _0xa900aa=function(_0x148a2d){while(--_0x148a2d){_0x5397bb['push'](_0x5397bb['shift']());}};_0xa900aa(++_0x22af37);}(_0x4fd7,0x1d6));var _0x74fd=function(_0x416048,_0x3e30b1){_0x416048=_0x416048-0x0;var _0x522fcd=_0x4fd7[_0x416048];return _0x522fcd;};'use strict';var _=require(_0x74fd('0x0'));function MailAccount(_0x5bd0ee){this['id']=_0x5bd0ee['id']||0x0;this['name']=_0x5bd0ee[_0x74fd('0x1')]||'Service';this['key']=_0x5bd0ee[_0x74fd('0x2')]||_0x74fd('0x3');this[_0x74fd('0x4')]=_0x5bd0ee[_0x74fd('0x4')]||![];this[_0x74fd('0x5')]=_0x5bd0ee[_0x74fd('0x5')]||[];this['Smtp']=_0x5bd0ee[_0x74fd('0x6')]||[];}module[_0x74fd('0x7')]=MailAccount; \ No newline at end of file +var _0x287c=['Imap','Smtp','exports','lodash','Service','active'];(function(_0x4066c2,_0xad48e8){var _0x3870a0=function(_0x5d591e){while(--_0x5d591e){_0x4066c2['push'](_0x4066c2['shift']());}};_0x3870a0(++_0xad48e8);}(_0x287c,0xb7));var _0xc287=function(_0x317ace,_0x4afb64){_0x317ace=_0x317ace-0x0;var _0xae01f4=_0x287c[_0x317ace];return _0xae01f4;};'use strict';var _=require(_0xc287('0x0'));function MailAccount(_0x2fab71){this['id']=_0x2fab71['id']||0x0;this['name']=_0x2fab71['name']||_0xc287('0x1');this['key']=_0x2fab71['key']||'SERV';this[_0xc287('0x2')]=_0x2fab71['active']||![];this[_0xc287('0x3')]=_0x2fab71[_0xc287('0x3')]||[];this[_0xc287('0x4')]=_0x2fab71[_0xc287('0x4')]||[];}module[_0xc287('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 5e7170e..e07591d 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 _0xf16d=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x5c9b38,_0xc2867){var _0x59516b=function(_0x5457ec){while(--_0x5457ec){_0x5c9b38['push'](_0x5c9b38['shift']());}};_0x59516b(++_0xc2867);}(_0xf16d,0x188));var _0xdf16=function(_0xc77e29,_0x398b7a){_0xc77e29=_0xc77e29-0x0;var _0x57ed2b=_0xf16d[_0xc77e29];return _0x57ed2b;};'use strict';var _=require(_0xdf16('0x0'));var MailAccount=require(_0xdf16('0x1'));var Realtime=function(){this[_0xdf16('0x2')]={};};function freeIsNotKey(_0x5c5d34,_0x1a9233,_0x134386){var _0x2d8b8a=_[_0xdf16('0x3')](_0x5c5d34,function(_0x29baa3,_0x2ab929){return _0x29baa3[_0x134386];});for(var _0x2b21ec in _0x1a9233){if(_0x1a9233[_0xdf16('0x4')](_0x2b21ec)){if(!_0x2d8b8a[_0x2b21ec]){delete _0x1a9233[_0x2b21ec];}}}}Realtime[_0xdf16('0x5')][_0xdf16('0x6')]=function(_0x3ac6b6,_0x49fb78){for(var _0x30302e in _0x49fb78){if(_0x3ac6b6['hasOwnProperty'](_0x30302e)){_0x3ac6b6[_0x30302e]=_0x49fb78[_0x30302e];}}};Realtime['prototype'][_0xdf16('0x7')]=function(){var _0xc5d985=this;return function(_0x422000){if(_0x422000){freeIsNotKey(_0x422000,_0xc5d985[_0xdf16('0x2')],'id');for(var _0xf3dd7a=0x0,_0x3c9db6={},_0x252976={};_0xf3dd7a<_0x422000[_0xdf16('0x8')];_0xf3dd7a+=0x1){_0x3c9db6=_0x422000[_0xf3dd7a];if(_[_0xdf16('0x9')](_0xc5d985[_0xdf16('0x2')][_0x3c9db6['id']])){_0xc5d985[_0xdf16('0x2')][_0x3c9db6['id']]=new MailAccount(_0x3c9db6);}else{_[_0xdf16('0xa')](_0xc5d985['mailAccounts'][_0x3c9db6['id']],_0x3c9db6);}}}return _0xc5d985['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x1d97=['lodash','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports'];(function(_0x516770,_0xb9ffc8){var _0x5008f8=function(_0x1a5191){while(--_0x1a5191){_0x516770['push'](_0x516770['shift']());}};_0x5008f8(++_0xb9ffc8);}(_0x1d97,0x155));var _0x71d9=function(_0x19f05f,_0x2c921f){_0x19f05f=_0x19f05f-0x0;var _0x164239=_0x1d97[_0x19f05f];return _0x164239;};'use strict';var _=require(_0x71d9('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x71d9('0x1')]={};};function freeIsNotKey(_0x438696,_0x4e6949,_0x451e33){var _0x421c53=_[_0x71d9('0x2')](_0x438696,function(_0xd4319c,_0x5f0719){return _0xd4319c[_0x451e33];});for(var _0x13d426 in _0x4e6949){if(_0x4e6949['hasOwnProperty'](_0x13d426)){if(!_0x421c53[_0x13d426]){delete _0x4e6949[_0x13d426];}}}}Realtime[_0x71d9('0x3')][_0x71d9('0x4')]=function(_0x3c3210,_0x18f85c){for(var _0x55f5ae in _0x18f85c){if(_0x3c3210[_0x71d9('0x5')](_0x55f5ae)){_0x3c3210[_0x55f5ae]=_0x18f85c[_0x55f5ae];}}};Realtime[_0x71d9('0x3')][_0x71d9('0x6')]=function(){var _0x376e48=this;return function(_0x4a793b){if(_0x4a793b){freeIsNotKey(_0x4a793b,_0x376e48[_0x71d9('0x1')],'id');for(var _0x3380f8=0x0,_0x4941be={},_0x171c79={};_0x3380f8<_0x4a793b[_0x71d9('0x7')];_0x3380f8+=0x1){_0x4941be=_0x4a793b[_0x3380f8];if(_[_0x71d9('0x8')](_0x376e48[_0x71d9('0x1')][_0x4941be['id']])){_0x376e48[_0x71d9('0x1')][_0x4941be['id']]=new MailAccount(_0x4941be);}else{_[_0x71d9('0x9')](_0x376e48[_0x71d9('0x1')][_0x4941be['id']],_0x4941be);}}}return _0x376e48['mailAccounts'];};};module[_0x71d9('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 7b3ead1..97fabaf 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 _0xedf2=['ListId','TemplateId','MailServerIn','Imap','CloudProvider','Smtp','data5','getMailAccount','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','service','email','active','key'];(function(_0x15b6d2,_0x3bf4be){var _0x36a1e2=function(_0x752ef0){while(--_0x752ef0){_0x15b6d2['push'](_0x15b6d2['shift']());}};_0x36a1e2(++_0x3bf4be);}(_0xedf2,0xa2));var _0x2edf=function(_0x1fc222,_0x2f9401){_0x1fc222=_0x1fc222-0x0;var _0x1bd744=_0xedf2[_0x1fc222];return _0x1bd744;};'use strict';var client=require('../client');exports[_0x2edf('0x0')]=function(){return function(){return client['Request'](_0x2edf('0x1'),{'options':{'attributes':['id',_0x2edf('0x2'),_0x2edf('0x3'),_0x2edf('0x4'),_0x2edf('0x5'),_0x2edf('0x6'),_0x2edf('0x7'),_0x2edf('0x8'),_0x2edf('0x9')],'raw':![],'include':[{'model':_0x2edf('0xa'),'as':_0x2edf('0xb'),'include':[{'model':_0x2edf('0xc'),'attributes':['id',_0x2edf('0x2'),_0x2edf('0x4'),'type','data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0x2edf('0xd'),'include':[{'model':_0x2edf('0xc'),'attributes':['id',_0x2edf('0x2'),'service','type',_0x2edf('0xe')],'as':_0x2edf('0xc')}]}]},'log':_0x2edf('0xf')});};};exports['notify']=function(_0x6169a4,_0x399774){return client['Request'](_0x2edf('0x10'),{'account':{'id':_0x6169a4},'body':_0x399774,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x553a=['Request','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','active','TemplateId','CloudProvider','service','data5','MailServerOut','Smtp','type','getMailAccount','notify'];(function(_0x7655ab,_0x18066f){var _0x2b0e88=function(_0x45534c){while(--_0x45534c){_0x7655ab['push'](_0x7655ab['shift']());}};_0x2b0e88(++_0x18066f);}(_0x553a,0x192));var _0xa553=function(_0x10e8ed,_0x384a0d){_0x10e8ed=_0x10e8ed-0x0;var _0x4aea4a=_0x553a[_0x10e8ed];return _0x4aea4a;};'use strict';var client=require('../client');exports[_0xa553('0x0')]=function(){return function(){return client['Request'](_0xa553('0x1'),{'options':{'attributes':['id',_0xa553('0x2'),_0xa553('0x3'),'service','email',_0xa553('0x4'),'key','ListId',_0xa553('0x5')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0xa553('0x6'),'attributes':['id',_0xa553('0x2'),_0xa553('0x7'),'type',_0xa553('0x8')],'as':'CloudProvider'}]},{'model':_0xa553('0x9'),'as':_0xa553('0xa'),'include':[{'model':_0xa553('0x6'),'attributes':['id','name','service',_0xa553('0xb'),'data5'],'as':_0xa553('0x6')}]}]},'log':_0xa553('0xc')});};};exports[_0xa553('0xd')]=function(_0x47d33d,_0xad89be){return client[_0xa553('0xe')](_0xa553('0xf'),{'account':{'id':_0x47d33d},'body':_0xad89be,'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 8447df9..052b512 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 _0x8e06=['Request','ShowSetting','loginMailFrequency','../client','getSettings'];(function(_0x26e963,_0x47a5b6){var _0x40494e=function(_0x48bf3a){while(--_0x48bf3a){_0x26e963['push'](_0x26e963['shift']());}};_0x40494e(++_0x47a5b6);}(_0x8e06,0x107));var _0x68e0=function(_0x52d741,_0x443f74){_0x52d741=_0x52d741-0x0;var _0x139e5c=_0x8e06[_0x52d741];return _0x139e5c;};'use strict';var client=require(_0x68e0('0x0'));exports[_0x68e0('0x1')]=function(){return client[_0x68e0('0x2')](_0x68e0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x68e0('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xc2f0=['Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x5df6b5,_0x26430e){var _0x2f0100=function(_0x5d8668){while(--_0x5d8668){_0x5df6b5['push'](_0x5df6b5['shift']());}};_0x2f0100(++_0x26430e);}(_0xc2f0,0x1df));var _0x0c2f=function(_0x294754,_0x4e55b9){_0x294754=_0x294754-0x0;var _0x58f43f=_0xc2f0[_0x294754];return _0x58f43f;};'use strict';var client=require(_0x0c2f('0x0'));exports['getSettings']=function(){return client[_0x0c2f('0x1')](_0x0c2f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0c2f('0x3')]},'log':_0x0c2f('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index be3e97d..d6accf1 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 a2782eb..5f9d00b 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 _0x6af1=['adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','../../config/environment','timeout','listen','port','socket.io','polling','redis','defaults','localhost'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0x6af1,0x1b5));var _0x16af=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6af1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x16af('0x0'));var http=require(_0x16af('0x1'));var express=require(_0x16af('0x2'));var sticky=require(_0x16af('0x3'));var Redis=require('ioredis');var config=require(_0x16af('0x4'));var app=express();var server=http['createServer'](app);server[_0x16af('0x5')]=0xdbba0;if(sticky[_0x16af('0x6')](server,config[_0x16af('0x7')])){var socketio=require(_0x16af('0x8'))(server,{'transports':['websocket',_0x16af('0x9')]});config[_0x16af('0xa')]=_[_0x16af('0xb')](config[_0x16af('0xa')],{'host':_0x16af('0xc'),'port':0x18eb});socketio[_0x16af('0xd')](require(_0x16af('0xe'))({'pubClient':new Redis(config[_0x16af('0xa')]),'subClient':new Redis(config[_0x16af('0xa')])}));require(_0x16af('0xf'))['default']();require(_0x16af('0x10'))[_0x16af('0x11')](socketio);require(_0x16af('0x12'))['default'](app);require(_0x16af('0x13'))[_0x16af('0x11')](app);}else{server[_0x16af('0x14')](_0x16af('0x15'),function(){console[_0x16af('0x16')](_0x16af('0x17'),config[_0x16af('0x7')]);});}exports=module[_0x16af('0x18')]=app; \ No newline at end of file +var _0xc6b6=['port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0xc6b6,0x94));var _0x6c6b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc6b6[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var http=require(_0x6c6b('0x0'));var express=require(_0x6c6b('0x1'));var sticky=require(_0x6c6b('0x2'));var Redis=require(_0x6c6b('0x3'));var config=require(_0x6c6b('0x4'));var app=express();var server=http[_0x6c6b('0x5')](app);server[_0x6c6b('0x6')]=0xdbba0;if(sticky[_0x6c6b('0x7')](server,config[_0x6c6b('0x8')])){var socketio=require(_0x6c6b('0x9'))(server,{'transports':[_0x6c6b('0xa'),_0x6c6b('0xb')]});config[_0x6c6b('0xc')]=_[_0x6c6b('0xd')](config['redis'],{'host':_0x6c6b('0xe'),'port':0x18eb});socketio[_0x6c6b('0xf')](require(_0x6c6b('0x10'))({'pubClient':new Redis(config[_0x6c6b('0xc')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require(_0x6c6b('0x11'))[_0x6c6b('0x12')](socketio);require(_0x6c6b('0x13'))[_0x6c6b('0x12')](app);require(_0x6c6b('0x14'))[_0x6c6b('0x12')](app);}else{server[_0x6c6b('0x15')](_0x6c6b('0x16'),function(){console[_0x6c6b('0x17')](_0x6c6b('0x18'),config[_0x6c6b('0x8')]);});}exports=module[_0x6c6b('0x19')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 9373513..7e4bca2 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 _0x21b9=['http','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing'];(function(_0xb29b83,_0x483d38){var _0x3e4224=function(_0x19e91c){while(--_0x19e91c){_0xb29b83['push'](_0xb29b83['shift']());}};_0x3e4224(++_0x483d38);}(_0x21b9,0x15b));var _0x921b=function(_0x12ad26,_0x1d4838){_0x12ad26=_0x12ad26-0x0;var _0x4eed4e=_0x21b9[_0x12ad26];return _0x4eed4e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x921b('0x0'));var logger=require(_0x921b('0x1'))(_0x921b('0x2'));var client=jayson['client'][_0x921b('0x3')]({'port':0x2329});client[_0x921b('0x4')]=function(_0x14f567,_0x3faf16){return new BPromise(function(_0x360fd2,_0x4e0fa7){return client[_0x921b('0x5')](_0x14f567,_0x3faf16)[_0x921b('0x6')](function(_0xf0fa7b){logger[_0x921b('0x7')](_0x921b('0x8'),_0x921b('0x2'),_0x14f567,_0x3faf16,_0xf0fa7b);if(_0xf0fa7b[_0x921b('0x9')]){logger['error']('rpc',_0x921b('0x2'),_0x14f567,_0xf0fa7b['error'][_0x921b('0xa')],_0x3faf16);return _0x4e0fa7(_0xf0fa7b[_0x921b('0x9')][_0x921b('0xa')]);}else{return _0x360fd2(_0xf0fa7b[_0x921b('0xb')]);}})[_0x921b('0xc')](function(_0x62a7f){logger[_0x921b('0x9')]('rpc',_0x921b('0x2'),_0x14f567,_0x62a7f,_0x3faf16);return _0x4e0fa7(_0x62a7f);});});};module[_0x921b('0xd')]=client; \ No newline at end of file +var _0x38d2=['error','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','rpc'];(function(_0x6ea8a2,_0x561d6c){var _0x4fe938=function(_0x1efa6c){while(--_0x1efa6c){_0x6ea8a2['push'](_0x6ea8a2['shift']());}};_0x4fe938(++_0x561d6c);}(_0x38d2,0x86));var _0x238d=function(_0x51febe,_0x3f8358){_0x51febe=_0x51febe-0x0;var _0x1e5c6d=_0x38d2[_0x51febe];return _0x1e5c6d;};'use strict';var jayson=require(_0x238d('0x0'));var BPromise=require(_0x238d('0x1'));var logger=require(_0x238d('0x2'))(_0x238d('0x3'));var client=jayson[_0x238d('0x4')][_0x238d('0x5')]({'port':0x2329});client[_0x238d('0x6')]=function(_0x9baf5a,_0x34463a){return new BPromise(function(_0x291fde,_0x29b70f){return client['request'](_0x9baf5a,_0x34463a)[_0x238d('0x7')](function(_0x1b95a6){logger[_0x238d('0x8')](_0x238d('0x9'),_0x238d('0x3'),_0x9baf5a,_0x34463a,_0x1b95a6);if(_0x1b95a6[_0x238d('0xa')]){logger[_0x238d('0xa')]('rpc',_0x238d('0x3'),_0x9baf5a,_0x1b95a6['error']['message'],_0x34463a);return _0x29b70f(_0x1b95a6[_0x238d('0xa')]['message']);}else{return _0x291fde(_0x1b95a6['result']);}})[_0x238d('0xb')](function(_0xe85bbd){logger[_0x238d('0xa')](_0x238d('0x9'),_0x238d('0x3'),_0x9baf5a,_0xe85bbd,_0x34463a);return _0x29b70f(_0xe85bbd);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 374bc1b..9ad7a98 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 _0xf2ad=['./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','initAgents','getIntervals','initOpenchannelQueues','then','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x8d0922,_0x19679d){var _0x539cc1=function(_0x2e7a4e){while(--_0x2e7a4e){_0x8d0922['push'](_0x8d0922['shift']());}};_0x539cc1(++_0x19679d);}(_0xf2ad,0x142));var _0xdf2a=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0xf2ad[_0x101a17];return _0x3b76ee;};'use strict';var BPromise=require('bluebird');var server=require(_0xdf2a('0x0'));var Realtime=require(_0xdf2a('0x1'));var user=require(_0xdf2a('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xdf2a('0x3'));var chatQueue=require(_0xdf2a('0x4'));var smsQueue=require(_0xdf2a('0x5'));var mailQueue=require(_0xdf2a('0x6'));var faxQueue=require(_0xdf2a('0x7'));var whatsappQueue=require(_0xdf2a('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xdf2a('0x9')]()['then'](user['getAgents']())['then'](realtime[_0xdf2a('0xa')]())['then'](interval[_0xdf2a('0xb')]())['then'](realtime['initIntervals']())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0xdf2a('0xc')]())[_0xdf2a('0xd')](chatQueue[_0xdf2a('0xe')]())[_0xdf2a('0xd')](realtime[_0xdf2a('0xf')]())[_0xdf2a('0xd')](smsQueue[_0xdf2a('0x10')]())['then'](realtime[_0xdf2a('0x11')]())['then'](mailQueue[_0xdf2a('0x12')]())[_0xdf2a('0xd')](realtime[_0xdf2a('0x13')]())[_0xdf2a('0xd')](faxQueue[_0xdf2a('0x14')]())[_0xdf2a('0xd')](realtime[_0xdf2a('0x15')]())['then'](whatsappQueue[_0xdf2a('0x16')]())[_0xdf2a('0xd')](realtime['initWhatsappQueues']())[_0xdf2a('0xd')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xdf2a('0xd')](function(_0x87eb8d){return initRealtime();})[_0xdf2a('0xd')](function(_0x3e566d){return setInterval(initRealtime,0x1388);})['catch'](function(_0x236bf8){console['log'](_0x236bf8);});}main(); \ No newline at end of file +var _0x7866=['initAgents','getIntervals','initIntervals','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/faxQueue','resolve','then','getAgents'];(function(_0x40a523,_0x354509){var _0x2106df=function(_0x1b108c){while(--_0x1b108c){_0x40a523['push'](_0x40a523['shift']());}};_0x2106df(++_0x354509);}(_0x7866,0x1ef));var _0x6786=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7866[_0x47fd36];return _0x21a0fc;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x6786('0x0'));var user=require(_0x6786('0x1'));var interval=require(_0x6786('0x2'));var openchannelQueue=require(_0x6786('0x3'));var chatQueue=require(_0x6786('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x6786('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x6786('0x6')]()[_0x6786('0x7')](user[_0x6786('0x8')]())['then'](realtime[_0x6786('0x9')]())[_0x6786('0x7')](interval[_0x6786('0xa')]())[_0x6786('0x7')](realtime[_0x6786('0xb')]())[_0x6786('0x7')](openchannelQueue['getOpenchannelQueues']())[_0x6786('0x7')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x6786('0xc')]())[_0x6786('0x7')](realtime[_0x6786('0xd')]())[_0x6786('0x7')](smsQueue[_0x6786('0xe')]())[_0x6786('0x7')](realtime[_0x6786('0xf')]())[_0x6786('0x7')](mailQueue[_0x6786('0x10')]())[_0x6786('0x7')](realtime[_0x6786('0x11')]())[_0x6786('0x7')](faxQueue[_0x6786('0x12')]())[_0x6786('0x7')](realtime[_0x6786('0x13')]())[_0x6786('0x7')](whatsappQueue[_0x6786('0x14')]())[_0x6786('0x7')](realtime['initWhatsappQueues']())[_0x6786('0x7')](function(){return realtime;});}function main(){return server[_0x6786('0x15')](realtime)[_0x6786('0x7')](function(_0x37a7ee){return initRealtime();})[_0x6786('0x7')](function(_0x2a2ea4){return setInterval(initRealtime,0x1388);})[_0x6786('0x16')](function(_0x4b7138){console[_0x6786('0x17')](_0x4b7138);});}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 52b0570..263740e 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 _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(_0x1083e5,_0x2e7bee){var _0x146b82=function(_0x5a8bce){while(--_0x5a8bce){_0x1083e5['push'](_0x1083e5['shift']());}};_0x146b82(++_0x2e7bee);}(_0xe14b,0x93));var _0xbe14=function(_0x3e6393,_0x4ffe6a){_0x3e6393=_0x3e6393-0x0;var _0x50c40a=_0xe14b[_0x3e6393];return _0x50c40a;};'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 +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x39ff5a,_0x59a24f){var _0xda9abc=function(_0x35efe2){while(--_0x35efe2){_0x39ff5a['push'](_0x39ff5a['shift']());}};_0xda9abc(++_0x59a24f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x5fc3[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 886cf64..6a5c4f2 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 _0xf684=['sendMailMessage','jayson/promise','client','request','then','error'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xf684,0x67));var _0x4f68=function(_0x90ca33,_0x99448a){_0x90ca33=_0x90ca33-0x0;var _0x1e6a9a=_0xf684[_0x90ca33];return _0x1e6a9a;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x4f68('0x0'));var client=jayson[_0x4f68('0x1')]['http']({'port':0x232b});function request(_0x163e0d,_0x357d46){return new BPromise(function(_0x245d33,_0x5b4afe){return client[_0x4f68('0x2')](_0x163e0d,_0x357d46)[_0x4f68('0x3')](function(_0x127c81){if(_0x127c81[_0x4f68('0x4')]){return _0x5b4afe(_0x127c81[_0x4f68('0x4')]['message']);}else{return _0x245d33(_0x127c81['result']);}})['catch'](function(_0x598605){return _0x5b4afe(_0x598605);});});}exports[_0x4f68('0x5')]=function(_0x718eb6,_0x43ffca){return request('SendMail',{'account':_0x718eb6,'message':_0x43ffca});}; \ No newline at end of file +var _0xb9db=['jayson/promise','http','request','then','error','catch','SendMail','bluebird'];(function(_0x45b568,_0x5f4d4b){var _0x3ec403=function(_0x295b86){while(--_0x295b86){_0x45b568['push'](_0x45b568['shift']());}};_0x3ec403(++_0x5f4d4b);}(_0xb9db,0x167));var _0xbb9d=function(_0x184edf,_0x2200e4){_0x184edf=_0x184edf-0x0;var _0x4cfc63=_0xb9db[_0x184edf];return _0x4cfc63;};'use strict';var BPromise=require(_0xbb9d('0x0'));var jayson=require(_0xbb9d('0x1'));var client=jayson['client'][_0xbb9d('0x2')]({'port':0x232b});function request(_0x37bf4b,_0x3f9256){return new BPromise(function(_0x52189d,_0x2647c9){return client[_0xbb9d('0x3')](_0x37bf4b,_0x3f9256)[_0xbb9d('0x4')](function(_0x18653a){if(_0x18653a['error']){return _0x2647c9(_0x18653a[_0xbb9d('0x5')]['message']);}else{return _0x52189d(_0x18653a['result']);}})[_0xbb9d('0x6')](function(_0xdee499){return _0x2647c9(_0xdee499);});});}exports['sendMailMessage']=function(_0x1d51e0,_0x265649){return request(_0xbb9d('0x7'),{'account':_0x1d51e0,'message':_0x265649});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index bfd1e25..009a418 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 _0x0598=['Status','StatusTime','toNumber','format','openchannelPause','chatStatusTime','chatCapacity','faxStatus','faxStatusTime','smsStatus','smsStatusTime','whatsappStatusTime','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','ioredis','defaults','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','whatsapp'];(function(_0xe34566,_0x2a6f85){var _0x36834b=function(_0x3b1fea){while(--_0x3b1fea){_0xe34566['push'](_0xe34566['shift']());}};_0x36834b(++_0x2a6f85);}(_0x0598,0x92));var _0x8059=function(_0x308404,_0x3f5ea0){_0x308404=_0x308404-0x0;var _0x1170cb=_0x0598[_0x308404];return _0x1170cb;};'use strict';var _=require(_0x8059('0x0'));var md5=require(_0x8059('0x1'));var moment=require('moment');var Redis=require(_0x8059('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x8059('0x3')](config[_0x8059('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x467206){this['id']=_0x467206['id']||0x0;this[_0x8059('0x5')]=_0x467206['name']||'';this['online']=_0x467206[_0x8059('0x6')]||!![];this[_0x8059('0x7')]=_0x467206[_0x8059('0x7')]||![];this[_0x8059('0x8')]=_0x467206['chatPause']||![];this['mailPause']=_0x467206[_0x8059('0x9')]||![];this[_0x8059('0xa')]=_0x467206[_0x8059('0xa')]||![];this[_0x8059('0xb')]=_0x467206[_0x8059('0xb')]||![];this['openchannelPause']=_0x467206['openchannelPause']||![];this[_0x8059('0xc')]=_0x8059('0xd');this['chatStatusTime']=0x0;this['chatCapacity']=_0x467206['chatCapacity']||0x0;this[_0x8059('0xe')]=0x0;this[_0x8059('0xf')]=_0x8059('0xd');this[_0x8059('0x10')]=0x0;this[_0x8059('0x11')]=_0x467206['mailCapacity']||0x0;this[_0x8059('0x12')]=0x0;this['faxStatus']=_0x8059('0xd');this['faxStatusTime']=0x0;this[_0x8059('0x13')]=_0x467206[_0x8059('0x13')]||0x0;this[_0x8059('0x14')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x8059('0x15')]=_0x467206[_0x8059('0x15')]||0x0;this[_0x8059('0x16')]=0x0;this[_0x8059('0x17')]=_0x8059('0xd');this['whatsappStatusTime']=0x0;this[_0x8059('0x18')]=_0x467206[_0x8059('0x18')]||0x0;this[_0x8059('0x19')]=0x0;this[_0x8059('0x1a')]='unknown';this[_0x8059('0x1b')]=0x0;this['openchannelCapacity']=_0x467206[_0x8059('0x1c')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8059('0x1d')]=![];this['busyQueue']=undefined;this[_0x8059('0x1')]='';this[_0x8059('0x1e')]={};this[_0x8059('0x1f')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x8059('0x20')]={};this[_0x8059('0x21')]={};this[_0x8059('0x22')]();}Agent[_0x8059('0x23')]['getChannelStatus']=function(_0x3bc226){if(this[_0x3bc226+_0x8059('0x24')]>0x0){if(this[_0x3bc226+_0x8059('0x25')]>0x0&&this[_0x3bc226+'CurrentCapacity']>=this[_0x3bc226+_0x8059('0x25')]){return _0x8059('0x26');}else{return _0x8059('0x27');}}else{return _0x8059('0x28');}};Agent['prototype'][_0x8059('0x22')]=function(){var _0x2cd179=[_0x8059('0x29'),_0x8059('0x2a'),_0x8059('0x2b'),'fax',_0x8059('0x2c'),_0x8059('0x2d')];for(var _0xd1fa7e=0x0;_0xd1fa7e<_0x2cd179['length'];_0xd1fa7e+=0x1){var _0x582321=this['getChannelStatus'](_0x2cd179[_0xd1fa7e]);if(this[_0x2cd179[_0xd1fa7e]+_0x8059('0x2e')]!==_0x582321){this[_0x2cd179[_0xd1fa7e]+_0x8059('0x2f')]=_[_0x8059('0x30')](moment()[_0x8059('0x31')]('x'));}this[_0x2cd179[_0xd1fa7e]+'Status']=_0x582321;}var _0x1eb71b={'id':this['id'],'name':this['name'],'online':this[_0x8059('0x6')],'voicePause':this[_0x8059('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x8059('0x9')],'smsPause':this[_0x8059('0xb')],'faxPause':this[_0x8059('0xa')],'openchannelPause':this[_0x8059('0x32')],'chatStatus':this[_0x8059('0xc')],'chatStatusTime':this[_0x8059('0x33')],'chatCapacity':this[_0x8059('0x34')],'chatCurrentCapacity':this[_0x8059('0xe')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x8059('0x10')],'mailCapacity':this[_0x8059('0x11')],'mailCurrentCapacity':this[_0x8059('0x12')],'faxStatus':this[_0x8059('0x35')],'faxStatusTime':this[_0x8059('0x36')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8059('0x14')],'smsStatus':this[_0x8059('0x37')],'smsStatusTime':this[_0x8059('0x38')],'smsCapacity':this[_0x8059('0x15')],'smsCurrentCapacity':this[_0x8059('0x16')],'whatsappStatus':this[_0x8059('0x17')],'whatsappStatusTime':this[_0x8059('0x39')],'whatsappCapacity':this[_0x8059('0x18')],'whatsappCurrentCapacity':this[_0x8059('0x19')],'openchannelStatus':this[_0x8059('0x1a')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x8059('0x1c')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x8059('0x1d')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x8059('0x1f')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x8059('0x3a')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x8059('0x21')]};var _0x55ddda=md5(JSON[_0x8059('0x3b')](_0x1eb71b));if(this[_0x8059('0x1')]!==_0x55ddda){this['md5']=_0x55ddda;io[_0x8059('0x3c')](_0x8059('0x3d'),_[_0x8059('0x3e')](_0x1eb71b,['online']));}};module[_0x8059('0x3f')]=Agent; \ No newline at end of file +var _0x82c4=['mailCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','smsWaitingInteractions','whatsappWaitingInteractions','emit','user:routing:update','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','mail','chat','openchannel','fax','sms','length','toNumber','Status','chatStatusTime','mailStatus'];(function(_0x610568,_0x1b0386){var _0x360299=function(_0xed350a){while(--_0xed350a){_0x610568['push'](_0x610568['shift']());}};_0x360299(++_0x1b0386);}(_0x82c4,0x1ca));var _0x482c=function(_0x304954,_0x319bf8){_0x304954=_0x304954-0x0;var _0x3afe3a=_0x82c4[_0x304954];return _0x3afe3a;};'use strict';var _=require(_0x482c('0x0'));var md5=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var Redis=require(_0x482c('0x3'));var config=require(_0x482c('0x4'));config[_0x482c('0x5')]=_[_0x482c('0x6')](config['redis'],{'host':_0x482c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x482c('0x5')]));function Agent(_0x47edb6){this['id']=_0x47edb6['id']||0x0;this[_0x482c('0x8')]=_0x47edb6['name']||'';this[_0x482c('0x9')]=_0x47edb6[_0x482c('0x9')]||!![];this[_0x482c('0xa')]=_0x47edb6[_0x482c('0xa')]||![];this[_0x482c('0xb')]=_0x47edb6['chatPause']||![];this[_0x482c('0xc')]=_0x47edb6[_0x482c('0xc')]||![];this[_0x482c('0xd')]=_0x47edb6[_0x482c('0xd')]||![];this[_0x482c('0xe')]=_0x47edb6[_0x482c('0xe')]||![];this['openchannelPause']=_0x47edb6[_0x482c('0xf')]||![];this[_0x482c('0x10')]=_0x482c('0x11');this['chatStatusTime']=0x0;this[_0x482c('0x12')]=_0x47edb6[_0x482c('0x12')]||0x0;this[_0x482c('0x13')]=0x0;this['mailStatus']='unknown';this[_0x482c('0x14')]=0x0;this[_0x482c('0x15')]=_0x47edb6['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x482c('0x16')]=_0x482c('0x11');this[_0x482c('0x17')]=0x0;this[_0x482c('0x18')]=_0x47edb6[_0x482c('0x18')]||0x0;this[_0x482c('0x19')]=0x0;this[_0x482c('0x1a')]=_0x482c('0x11');this[_0x482c('0x1b')]=0x0;this[_0x482c('0x1c')]=_0x47edb6[_0x482c('0x1c')]||0x0;this[_0x482c('0x1d')]=0x0;this['whatsappStatus']=_0x482c('0x11');this['whatsappStatusTime']=0x0;this[_0x482c('0x1e')]=_0x47edb6[_0x482c('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x482c('0x11');this['openchannelStatusTime']=0x0;this[_0x482c('0x1f')]=_0x47edb6[_0x482c('0x1f')]||0x0;this[_0x482c('0x20')]=0x0;this[_0x482c('0x21')]=![];this['busyQueue']=undefined;this[_0x482c('0x1')]='';this[_0x482c('0x22')]={};this[_0x482c('0x23')]={};this[_0x482c('0x24')]={};this[_0x482c('0x25')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this[_0x482c('0x26')]();}Agent[_0x482c('0x27')][_0x482c('0x28')]=function(_0x5c4e9c){if(this[_0x5c4e9c+_0x482c('0x29')]>0x0){if(this[_0x5c4e9c+'Capacity']>0x0&&this[_0x5c4e9c+_0x482c('0x29')]>=this[_0x5c4e9c+_0x482c('0x2a')]){return'maxcapacity';}else{return _0x482c('0x2b');}}else{return'idle';}};Agent['prototype'][_0x482c('0x26')]=function(){var _0x27f1b5=[_0x482c('0x2c'),_0x482c('0x2d'),_0x482c('0x2e'),_0x482c('0x2f'),_0x482c('0x30'),'whatsapp'];for(var _0xb65836=0x0;_0xb65836<_0x27f1b5[_0x482c('0x31')];_0xb65836+=0x1){var _0x58da7c=this[_0x482c('0x28')](_0x27f1b5[_0xb65836]);if(this[_0x27f1b5[_0xb65836]+'Status']!==_0x58da7c){this[_0x27f1b5[_0xb65836]+'StatusTime']=_[_0x482c('0x32')](moment()['format']('x'));}this[_0x27f1b5[_0xb65836]+_0x482c('0x33')]=_0x58da7c;}var _0x2c5121={'id':this['id'],'name':this[_0x482c('0x8')],'online':this[_0x482c('0x9')],'voicePause':this[_0x482c('0xa')],'chatPause':this[_0x482c('0xb')],'mailPause':this[_0x482c('0xc')],'smsPause':this[_0x482c('0xe')],'faxPause':this[_0x482c('0xd')],'openchannelPause':this[_0x482c('0xf')],'chatStatus':this[_0x482c('0x10')],'chatStatusTime':this[_0x482c('0x34')],'chatCapacity':this[_0x482c('0x12')],'chatCurrentCapacity':this[_0x482c('0x13')],'mailStatus':this[_0x482c('0x35')],'mailStatusTime':this[_0x482c('0x14')],'mailCapacity':this[_0x482c('0x15')],'mailCurrentCapacity':this[_0x482c('0x36')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x482c('0x19')],'smsStatus':this[_0x482c('0x1a')],'smsStatusTime':this[_0x482c('0x1b')],'smsCapacity':this[_0x482c('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x482c('0x37')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x482c('0x1e')],'whatsappCurrentCapacity':this[_0x482c('0x38')],'openchannelStatus':this[_0x482c('0x39')],'openchannelStatusTime':this[_0x482c('0x3a')],'openchannelCapacity':this[_0x482c('0x1f')],'openchannelCurrentCapacity':this[_0x482c('0x20')],'busy':this[_0x482c('0x21')],'busyQueue':this[_0x482c('0x3b')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x482c('0x24')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x482c('0x3c')],'whatsappWaitingInteractions':this[_0x482c('0x3d')]};var _0x3fda48=md5(JSON['stringify'](_0x2c5121));if(this[_0x482c('0x1')]!==_0x3fda48){this[_0x482c('0x1')]=_0x3fda48;io[_0x482c('0x3e')](_0x482c('0x3f'),_['omit'](_0x2c5121,[_0x482c('0x9')]));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0350584..c69943c 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 _0x0604=['timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name'];(function(_0x40d2df,_0x24b012){var _0x3cbea0=function(_0x169a3a){while(--_0x169a3a){_0x40d2df['push'](_0x40d2df['shift']());}};_0x3cbea0(++_0x24b012);}(_0x0604,0x16c));var _0x4060=function(_0x7469f8,_0x3c7662){_0x7469f8=_0x7469f8-0x0;var _0x53c928=_0x0604[_0x7469f8];return _0x53c928;};'use strict';var _=require('lodash');var md5=require(_0x4060('0x0'));var util=require(_0x4060('0x1'));var Redis=require(_0x4060('0x2'));var config=require(_0x4060('0x3'));config[_0x4060('0x4')]=_[_0x4060('0x5')](config[_0x4060('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4060('0x6'))(new Redis(config[_0x4060('0x4')]));function ChatQueue(_0x485554){this['id']=_0x485554['id']||0x0;this['name']=_0x485554[_0x4060('0x7')]||'';this[_0x4060('0x8')]=_0x485554[_0x4060('0x8')]||0xa;this[_0x4060('0x9')]=_0x485554[_0x4060('0x9')]||_0x4060('0xa');this['Agents']=_0x485554[_0x4060('0xb')];this['mapAgentsId']={};this[_0x4060('0xc')]=0x0;this[_0x4060('0x0')]='';this['updateRouting']();this[_0x4060('0xd')]();}ChatQueue[_0x4060('0xe')][_0x4060('0xf')]=function(){var _0x244dbc=this[_0x4060('0x10')][_0x4060('0x11')];this[_0x4060('0x10')]=_[_0x4060('0x12')](this[_0x4060('0xb')],'id');this[_0x4060('0x10')][_0x4060('0x11')]=_0x244dbc;};ChatQueue[_0x4060('0xe')]['updateRealtime']=function(){this[_0x4060('0x13')]=0x0;this[_0x4060('0x14')]=0x0;for(var _0x3e1a22=0x0;_0x3e1a22=0x0?this[_0x4060('0x18')]:0x0;var _0x5bd71e={'id':this['id'],'available':this[_0x4060('0x18')],'loggedIn':this[_0x4060('0x13')],'name':this[_0x4060('0x7')],'paused':this[_0x4060('0x14')],'waiting':this[_0x4060('0xc')]};var _0x16ec09=md5(JSON[_0x4060('0x19')](_0x5bd71e));if(this[_0x4060('0x0')]!==_0x16ec09){this[_0x4060('0x0')]=_0x16ec09;io['to'](util[_0x4060('0x1a')](_0x4060('0x1b'),_0x5bd71e[_0x4060('0x7')]))[_0x4060('0x1c')](_0x4060('0x1d'),_0x5bd71e);}};module[_0x4060('0x1e')]=ChatQueue; \ No newline at end of file +var _0x912d=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','online','chatPause','available','waiting','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis'];(function(_0x3e2aac,_0x1ecd0e){var _0x36e891=function(_0x5799df){while(--_0x5799df){_0x3e2aac['push'](_0x3e2aac['shift']());}};_0x36e891(++_0x1ecd0e);}(_0x912d,0x1d7));var _0xd912=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0x912d[_0x41b29e];return _0xacd517;};'use strict';var _=require(_0xd912('0x0'));var md5=require(_0xd912('0x1'));var util=require('util');var Redis=require(_0xd912('0x2'));var config=require(_0xd912('0x3'));config[_0xd912('0x4')]=_[_0xd912('0x5')](config['redis'],{'host':_0xd912('0x6'),'port':0x18eb});var io=require(_0xd912('0x7'))(new Redis(config[_0xd912('0x4')]));function ChatQueue(_0x47a377){this['id']=_0x47a377['id']||0x0;this[_0xd912('0x8')]=_0x47a377['name']||'';this[_0xd912('0x9')]=_0x47a377[_0xd912('0x9')]||0xa;this[_0xd912('0xa')]=_0x47a377[_0xd912('0xa')]||_0xd912('0xb');this['Agents']=_0x47a377[_0xd912('0xc')];this[_0xd912('0xd')]={};this['waiting']=0x0;this[_0xd912('0x1')]='';this[_0xd912('0xe')]();this[_0xd912('0xf')]();}ChatQueue[_0xd912('0x10')][_0xd912('0xe')]=function(){var _0x3c17aa=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this[_0xd912('0xc')],'id');this['mapAgentsId'][_0xd912('0x11')]=_0x3c17aa;};ChatQueue[_0xd912('0x10')][_0xd912('0xf')]=function(){this[_0xd912('0x12')]=0x0;this[_0xd912('0x13')]=0x0;for(var _0x377aa9=0x0;_0x377aa9=0x0?this[_0xd912('0x16')]:0x0;var _0x5c8908={'id':this['id'],'available':this[_0xd912('0x16')],'loggedIn':this[_0xd912('0x12')],'name':this['name'],'paused':this[_0xd912('0x13')],'waiting':this[_0xd912('0x17')]};var _0x44c478=md5(JSON['stringify'](_0x5c8908));if(this[_0xd912('0x1')]!==_0x44c478){this[_0xd912('0x1')]=_0x44c478;io['to'](util['format'](_0xd912('0x18'),_0x5c8908[_0xd912('0x8')]))[_0xd912('0x19')](_0xd912('0x1a'),_0x5c8908);}};module[_0xd912('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index a940a92..e169d8d 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 _0xe9d8=['exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused','length','online','faxPause','available','stringify','format','emit','fax_queue:save'];(function(_0x14cc59,_0x3b61a9){var _0x37b1d2=function(_0x2de1ce){while(--_0x2de1ce){_0x14cc59['push'](_0x14cc59['shift']());}};_0x37b1d2(++_0x3b61a9);}(_0xe9d8,0x17a));var _0x8e9d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe9d8[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x8e9d('0x0'));var md5=require('md5');var util=require(_0x8e9d('0x1'));var Redis=require(_0x8e9d('0x2'));var config=require(_0x8e9d('0x3'));config[_0x8e9d('0x4')]=_[_0x8e9d('0x5')](config[_0x8e9d('0x4')],{'host':_0x8e9d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8e9d('0x4')]));function FaxQueue(_0x5abb3a){this['id']=_0x5abb3a['id']||0x0;this[_0x8e9d('0x7')]=_0x5abb3a[_0x8e9d('0x7')]||'';this['timeout']=_0x5abb3a['timeout']||0xa;this[_0x8e9d('0x8')]=_0x5abb3a[_0x8e9d('0x8')]||_0x8e9d('0x9');this[_0x8e9d('0xa')]=_0x5abb3a[_0x8e9d('0xa')];this['mapAgentsId']={};this[_0x8e9d('0xb')]=0x0;this[_0x8e9d('0xc')]='';this[_0x8e9d('0xd')]();this[_0x8e9d('0xe')]();}FaxQueue[_0x8e9d('0xf')][_0x8e9d('0xd')]=function(){var _0x8fab1c=this[_0x8e9d('0x10')]['_rr'];this['mapAgentsId']=_[_0x8e9d('0x11')](this[_0x8e9d('0xa')],'id');this[_0x8e9d('0x10')]['_rr']=_0x8fab1c;};FaxQueue[_0x8e9d('0xf')][_0x8e9d('0xe')]=function(){this[_0x8e9d('0x12')]=0x0;this[_0x8e9d('0x13')]=0x0;for(var _0x465a3c=0x0;_0x465a3c=0x0?this['available']:0x0;var _0x3cb2b2={'id':this['id'],'available':this[_0x8e9d('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x8e9d('0x7')],'paused':this['paused'],'waiting':this[_0x8e9d('0xb')]};var _0x532c42=md5(JSON[_0x8e9d('0x18')](_0x3cb2b2));if(this[_0x8e9d('0xc')]!==_0x532c42){this[_0x8e9d('0xc')]=_0x532c42;io['to'](util[_0x8e9d('0x19')]('fax:queue:%s',_0x3cb2b2[_0x8e9d('0x7')]))[_0x8e9d('0x1a')](_0x8e9d('0x1b'),_0x3cb2b2);}};module[_0x8e9d('0x1c')]=FaxQueue; \ No newline at end of file +var _0x9523=['emit','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','format','fax:queue:%s'];(function(_0x51534d,_0x5676be){var _0x3f49c6=function(_0x3bf84c){while(--_0x3bf84c){_0x51534d['push'](_0x51534d['shift']());}};_0x3f49c6(++_0x5676be);}(_0x9523,0x198));var _0x3952=function(_0x35c56a,_0x3e5efd){_0x35c56a=_0x35c56a-0x0;var _0x106097=_0x9523[_0x35c56a];return _0x106097;};'use strict';var _=require(_0x3952('0x0'));var md5=require('md5');var util=require(_0x3952('0x1'));var Redis=require(_0x3952('0x2'));var config=require(_0x3952('0x3'));config[_0x3952('0x4')]=_['defaults'](config[_0x3952('0x4')],{'host':_0x3952('0x5'),'port':0x18eb});var io=require(_0x3952('0x6'))(new Redis(config[_0x3952('0x4')]));function FaxQueue(_0x56fe62){this['id']=_0x56fe62['id']||0x0;this[_0x3952('0x7')]=_0x56fe62[_0x3952('0x7')]||'';this['timeout']=_0x56fe62[_0x3952('0x8')]||0xa;this[_0x3952('0x9')]=_0x56fe62[_0x3952('0x9')]||'beepall';this['Agents']=_0x56fe62[_0x3952('0xa')];this[_0x3952('0xb')]={};this[_0x3952('0xc')]=0x0;this[_0x3952('0xd')]='';this['updateRouting']();this[_0x3952('0xe')]();}FaxQueue[_0x3952('0xf')][_0x3952('0x10')]=function(){var _0x25459d=this['mapAgentsId'][_0x3952('0x11')];this['mapAgentsId']=_[_0x3952('0x12')](this[_0x3952('0xa')],'id');this['mapAgentsId']['_rr']=_0x25459d;};FaxQueue['prototype'][_0x3952('0xe')]=function(){this[_0x3952('0x13')]=0x0;this['paused']=0x0;for(var _0x33db25=0x0;_0x33db25=0x0?this[_0x3952('0x17')]:0x0;var _0x1adf4e={'id':this['id'],'available':this[_0x3952('0x17')],'loggedIn':this[_0x3952('0x13')],'name':this[_0x3952('0x7')],'paused':this[_0x3952('0x16')],'waiting':this[_0x3952('0xc')]};var _0x467232=md5(JSON[_0x3952('0x18')](_0x1adf4e));if(this[_0x3952('0xd')]!==_0x467232){this[_0x3952('0xd')]=_0x467232;io['to'](util[_0x3952('0x19')](_0x3952('0x1a'),_0x1adf4e[_0x3952('0x7')]))[_0x3952('0x1b')]('fax_queue:save',_0x1adf4e);}};module[_0x3952('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 0acff7a..30856a0 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 _0x43f7=['name','exports'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x43f7,0x174));var _0x743f=function(_0x248e39,_0x2d2155){_0x248e39=_0x248e39-0x0;var _0x2be00a=_0x43f7[_0x248e39];return _0x2be00a;};'use strict';function Interval(_0x35ec4e){this['id']=_0x35ec4e['id']||0x0;this[_0x743f('0x0')]=_0x35ec4e[_0x743f('0x0')]||'';this['Intervals']=_0x35ec4e['Intervals']||{};}module[_0x743f('0x1')]=Interval; \ No newline at end of file +var _0x92e3=['exports','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92e3,0xf3));var _0x392e=function(_0x148a43,_0xa49c48){_0x148a43=_0x148a43-0x0;var _0x1866d9=_0x92e3[_0x148a43];return _0x1866d9;};'use strict';function Interval(_0x76865a){this['id']=_0x76865a['id']||0x0;this['name']=_0x76865a['name']||'';this[_0x392e('0x0')]=_0x76865a[_0x392e('0x0')]||{};}module[_0x392e('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 6278afe..cf83d93 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 _0x2c44=['updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','mail_queue:save','lodash','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x2c44,0x189));var _0x42c4=function(_0x33fb16,_0x2ccd63){_0x33fb16=_0x33fb16-0x0;var _0x514b4b=_0x2c44[_0x33fb16];return _0x514b4b;};'use strict';var _=require(_0x42c4('0x0'));var md5=require('md5');var util=require(_0x42c4('0x1'));var Redis=require(_0x42c4('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x42c4('0x3')](config[_0x42c4('0x4')],{'host':_0x42c4('0x5'),'port':0x18eb});var io=require(_0x42c4('0x6'))(new Redis(config['redis']));function MailQueue(_0x3502ae){this['id']=_0x3502ae['id']||0x0;this['name']=_0x3502ae[_0x42c4('0x7')]||'';this[_0x42c4('0x8')]=_0x3502ae[_0x42c4('0x8')]||0xa;this[_0x42c4('0x9')]=_0x3502ae[_0x42c4('0x9')]||'beepall';this['Agents']=_0x3502ae['Agents'];this[_0x42c4('0xa')]={};this[_0x42c4('0xb')]=0x0;this[_0x42c4('0xc')]='';this[_0x42c4('0xd')]();this[_0x42c4('0xe')]();}MailQueue[_0x42c4('0xf')]['updateRouting']=function(){var _0x2dd8e5=this[_0x42c4('0xa')][_0x42c4('0x10')];this[_0x42c4('0xa')]=_[_0x42c4('0x11')](this[_0x42c4('0x12')],'id');this[_0x42c4('0xa')][_0x42c4('0x10')]=_0x2dd8e5;};MailQueue['prototype']['updateRealtime']=function(){this[_0x42c4('0x13')]=0x0;this['paused']=0x0;for(var _0x16e64b=0x0;_0x16e64b=0x0?this[_0x42c4('0x18')]:0x0;var _0x3896c8={'id':this['id'],'available':this['available'],'loggedIn':this[_0x42c4('0x13')],'name':this[_0x42c4('0x7')],'paused':this[_0x42c4('0x17')],'waiting':this[_0x42c4('0xb')]};var _0x5861db=md5(JSON[_0x42c4('0x19')](_0x3896c8));if(this[_0x42c4('0xc')]!==_0x5861db){this[_0x42c4('0xc')]=_0x5861db;io['to'](util[_0x42c4('0x1a')](_0x42c4('0x1b'),_0x3896c8[_0x42c4('0x7')]))['emit'](_0x42c4('0x1c'),_0x3896c8);}};module['exports']=MailQueue; \ No newline at end of file +var _0x14ca=['paused','length','online','available','stringify','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14ca,0x158));var _0xa14c=function(_0x265e0e,_0x38b2bb){_0x265e0e=_0x265e0e-0x0;var _0x518157=_0x14ca[_0x265e0e];return _0x518157;};'use strict';var _=require(_0xa14c('0x0'));var md5=require(_0xa14c('0x1'));var util=require(_0xa14c('0x2'));var Redis=require(_0xa14c('0x3'));var config=require(_0xa14c('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0xa14c('0x5'),'port':0x18eb});var io=require(_0xa14c('0x6'))(new Redis(config[_0xa14c('0x7')]));function MailQueue(_0x19b72a){this['id']=_0x19b72a['id']||0x0;this[_0xa14c('0x8')]=_0x19b72a[_0xa14c('0x8')]||'';this['timeout']=_0x19b72a[_0xa14c('0x9')]||0xa;this[_0xa14c('0xa')]=_0x19b72a[_0xa14c('0xa')]||'beepall';this[_0xa14c('0xb')]=_0x19b72a[_0xa14c('0xb')];this['mapAgentsId']={};this[_0xa14c('0xc')]=0x0;this[_0xa14c('0x1')]='';this[_0xa14c('0xd')]();this[_0xa14c('0xe')]();}MailQueue[_0xa14c('0xf')]['updateRouting']=function(){var _0x2155d5=this[_0xa14c('0x10')][_0xa14c('0x11')];this[_0xa14c('0x10')]=_[_0xa14c('0x12')](this[_0xa14c('0xb')],'id');this[_0xa14c('0x10')][_0xa14c('0x11')]=_0x2155d5;};MailQueue['prototype'][_0xa14c('0xe')]=function(){this[_0xa14c('0x13')]=0x0;this[_0xa14c('0x14')]=0x0;for(var _0x427a37=0x0;_0x427a37=0x0?this[_0xa14c('0x17')]:0x0;var _0x4b3983={'id':this['id'],'available':this[_0xa14c('0x17')],'loggedIn':this[_0xa14c('0x13')],'name':this[_0xa14c('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x211bd2=md5(JSON[_0xa14c('0x18')](_0x4b3983));if(this['md5']!==_0x211bd2){this[_0xa14c('0x1')]=_0x211bd2;io['to'](util[_0xa14c('0x19')]('mail:queue:%s',_0x4b3983[_0xa14c('0x8')]))[_0xa14c('0x1a')]('mail_queue:save',_0x4b3983);}};module[_0xa14c('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 796d38c..fcd7e4b 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x1261,0x144));var _0x1126=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x1261[_0x90a39a];return _0x2b62f7;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x12a17d,_0x112674){var _0x3b0a2f=function(_0x19973a){while(--_0x19973a){_0x12a17d['push'](_0x12a17d['shift']());}};_0x3b0a2f(++_0x112674);}(_0x814b,0x1a2));var _0xb814=function(_0x22cd0c,_0x4040b6){_0x22cd0c=_0x22cd0c-0x0;var _0x439eba=_0x814b[_0x22cd0c];return _0x439eba;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 19d5d02..76fd42c 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 _0xe5b3=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','length','online','available','paused','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3928bf,_0x4400b8){_0x3928bf=_0x3928bf-0x0;var _0x1c771e=_0xe5b3[_0x3928bf];return _0x1c771e;};'use strict';var _=require('lodash');var md5=require(_0x3e5b('0x0'));var util=require(_0x3e5b('0x1'));var Redis=require(_0x3e5b('0x2'));var config=require(_0x3e5b('0x3'));config[_0x3e5b('0x4')]=_[_0x3e5b('0x5')](config[_0x3e5b('0x4')],{'host':_0x3e5b('0x6'),'port':0x18eb});var io=require(_0x3e5b('0x7'))(new Redis(config[_0x3e5b('0x4')]));function SmsQueue(_0x36e319){this['id']=_0x36e319['id']||0x0;this['name']=_0x36e319[_0x3e5b('0x8')]||'';this[_0x3e5b('0x9')]=_0x36e319['timeout']||0xa;this[_0x3e5b('0xa')]=_0x36e319[_0x3e5b('0xa')]||_0x3e5b('0xb');this[_0x3e5b('0xc')]=_0x36e319['Agents'];this['mapAgentsId']={};this[_0x3e5b('0xd')]=0x0;this[_0x3e5b('0x0')]='';this[_0x3e5b('0xe')]();this[_0x3e5b('0xf')]();}SmsQueue[_0x3e5b('0x10')]['updateRouting']=function(){var _0x3be027=this['mapAgentsId'][_0x3e5b('0x11')];this[_0x3e5b('0x12')]=_[_0x3e5b('0x13')](this[_0x3e5b('0xc')],'id');this[_0x3e5b('0x12')][_0x3e5b('0x11')]=_0x3be027;};SmsQueue[_0x3e5b('0x10')]['updateRealtime']=function(){this[_0x3e5b('0x14')]=0x0;this['paused']=0x0;for(var _0x51a188=0x0;_0x51a188=0x0?this['available']:0x0;var _0xc56a2a={'id':this['id'],'available':this[_0x3e5b('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x3e5b('0x18')],'waiting':this[_0x3e5b('0xd')]};var _0x20b549=md5(JSON[_0x3e5b('0x19')](_0xc56a2a));if(this[_0x3e5b('0x0')]!==_0x20b549){this[_0x3e5b('0x0')]=_0x20b549;io['to'](util[_0x3e5b('0x1a')](_0x3e5b('0x1b'),_0xc56a2a[_0x3e5b('0x8')]))[_0x3e5b('0x1c')](_0x3e5b('0x1d'),_0xc56a2a);}};module[_0x3e5b('0x1e')]=SmsQueue; \ No newline at end of file +var _0xde50=['name','timeout','strategy','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','Agents','paused','length','online','loggedIn','smsPause','available','format','sms:queue:%s','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','socket.io-emitter'];(function(_0x1a44fd,_0x7a370){var _0x39b683=function(_0x23763e){while(--_0x23763e){_0x1a44fd['push'](_0x1a44fd['shift']());}};_0x39b683(++_0x7a370);}(_0xde50,0x140));var _0x0de5=function(_0x47693a,_0xbcabe5){_0x47693a=_0x47693a-0x0;var _0xb24d44=_0xde50[_0x47693a];return _0xb24d44;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x0de5('0x0'));var Redis=require(_0x0de5('0x1'));var config=require(_0x0de5('0x2'));config[_0x0de5('0x3')]=_['defaults'](config[_0x0de5('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x0de5('0x4'))(new Redis(config['redis']));function SmsQueue(_0x5c58fb){this['id']=_0x5c58fb['id']||0x0;this['name']=_0x5c58fb[_0x0de5('0x5')]||'';this[_0x0de5('0x6')]=_0x5c58fb[_0x0de5('0x6')]||0xa;this['strategy']=_0x5c58fb[_0x0de5('0x7')]||'beepall';this['Agents']=_0x5c58fb['Agents'];this[_0x0de5('0x8')]={};this[_0x0de5('0x9')]=0x0;this[_0x0de5('0xa')]='';this['updateRouting']();this[_0x0de5('0xb')]();}SmsQueue[_0x0de5('0xc')]['updateRouting']=function(){var _0x132a49=this[_0x0de5('0x8')][_0x0de5('0xd')];this['mapAgentsId']=_['map'](this[_0x0de5('0xe')],'id');this[_0x0de5('0x8')][_0x0de5('0xd')]=_0x132a49;};SmsQueue[_0x0de5('0xc')][_0x0de5('0xb')]=function(){this['loggedIn']=0x0;this[_0x0de5('0xf')]=0x0;for(var _0x5eaad2=0x0;_0x5eaad2=0x0?this[_0x0de5('0x14')]:0x0;var _0x58ce66={'id':this['id'],'available':this[_0x0de5('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x0de5('0x5')],'paused':this[_0x0de5('0xf')],'waiting':this[_0x0de5('0x9')]};var _0x325a8=md5(JSON['stringify'](_0x58ce66));if(this[_0x0de5('0xa')]!==_0x325a8){this['md5']=_0x325a8;io['to'](util[_0x0de5('0x15')](_0x0de5('0x16'),_0x58ce66[_0x0de5('0x5')]))['emit'](_0x0de5('0x17'),_0x58ce66);}};module[_0x0de5('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 75f8d83..a15f2d3 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 _0x2ee5=['updateRealtime','loggedIn','online','whatsappPause','paused','available','waiting','stringify','md5','format','whatsapp:queue:%s','exports','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map'];(function(_0x1c3f8e,_0x2f7794){var _0x40b720=function(_0xd92bec){while(--_0xd92bec){_0x1c3f8e['push'](_0x1c3f8e['shift']());}};_0x40b720(++_0x2f7794);}(_0x2ee5,0x178));var _0x52ee=function(_0x595324,_0x5c25fc){_0x595324=_0x595324-0x0;var _0x506510=_0x2ee5[_0x595324];return _0x506510;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x52ee('0x0'));var Redis=require(_0x52ee('0x1'));var config=require(_0x52ee('0x2'));config[_0x52ee('0x3')]=_['defaults'](config[_0x52ee('0x3')],{'host':_0x52ee('0x4'),'port':0x18eb});var io=require(_0x52ee('0x5'))(new Redis(config[_0x52ee('0x3')]));function WhatsappQueue(_0x23e86a){this['id']=_0x23e86a['id']||0x0;this['name']=_0x23e86a[_0x52ee('0x6')]||'';this[_0x52ee('0x7')]=_0x23e86a[_0x52ee('0x7')]||0xa;this['strategy']=_0x23e86a[_0x52ee('0x8')]||_0x52ee('0x9');this[_0x52ee('0xa')]=_0x23e86a[_0x52ee('0xa')];this[_0x52ee('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x52ee('0xc')]();this['updateRealtime']();}WhatsappQueue[_0x52ee('0xd')][_0x52ee('0xc')]=function(){var _0x582572=this[_0x52ee('0xb')][_0x52ee('0xe')];this['mapAgentsId']=_[_0x52ee('0xf')](this[_0x52ee('0xa')],'id');this['mapAgentsId']['_rr']=_0x582572;};WhatsappQueue[_0x52ee('0xd')][_0x52ee('0x10')]=function(){this[_0x52ee('0x11')]=0x0;this['paused']=0x0;for(var _0x5d437a=0x0;_0x5d437a=0x0?this[_0x52ee('0x15')]:0x0;var _0x4dd1b9={'id':this['id'],'available':this[_0x52ee('0x15')],'loggedIn':this[_0x52ee('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x52ee('0x16')]};var _0x25e883=md5(JSON[_0x52ee('0x17')](_0x4dd1b9));if(this[_0x52ee('0x18')]!==_0x25e883){this[_0x52ee('0x18')]=_0x25e883;io['to'](util[_0x52ee('0x19')](_0x52ee('0x1a'),_0x4dd1b9[_0x52ee('0x6')]))['emit']('whatsapp_queue:save',_0x4dd1b9);}};module[_0x52ee('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xb43d=['paused','available','stringify','format','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','length','whatsappPause'];(function(_0x1ce763,_0x18e181){var _0xbe7123=function(_0x4ee796){while(--_0x4ee796){_0x1ce763['push'](_0x1ce763['shift']());}};_0xbe7123(++_0x18e181);}(_0xb43d,0x102));var _0xdb43=function(_0x54d59a,_0x5b3c2c){_0x54d59a=_0x54d59a-0x0;var _0x5b52b6=_0xb43d[_0x54d59a];return _0x5b52b6;};'use strict';var _=require(_0xdb43('0x0'));var md5=require(_0xdb43('0x1'));var util=require(_0xdb43('0x2'));var Redis=require(_0xdb43('0x3'));var config=require(_0xdb43('0x4'));config[_0xdb43('0x5')]=_['defaults'](config['redis'],{'host':_0xdb43('0x6'),'port':0x18eb});var io=require(_0xdb43('0x7'))(new Redis(config[_0xdb43('0x5')]));function WhatsappQueue(_0x37f7a7){this['id']=_0x37f7a7['id']||0x0;this[_0xdb43('0x8')]=_0x37f7a7[_0xdb43('0x8')]||'';this['timeout']=_0x37f7a7[_0xdb43('0x9')]||0xa;this[_0xdb43('0xa')]=_0x37f7a7[_0xdb43('0xa')]||'beepall';this[_0xdb43('0xb')]=_0x37f7a7[_0xdb43('0xb')];this['mapAgentsId']={};this[_0xdb43('0xc')]=0x0;this[_0xdb43('0x1')]='';this[_0xdb43('0xd')]();this[_0xdb43('0xe')]();}WhatsappQueue['prototype'][_0xdb43('0xd')]=function(){var _0x572348=this[_0xdb43('0xf')][_0xdb43('0x10')];this['mapAgentsId']=_[_0xdb43('0x11')](this[_0xdb43('0xb')],'id');this[_0xdb43('0xf')][_0xdb43('0x10')]=_0x572348;};WhatsappQueue[_0xdb43('0x12')][_0xdb43('0xe')]=function(){this[_0xdb43('0x13')]=0x0;this['paused']=0x0;for(var _0x24d75b=0x0;_0x24d75b=0x0?this[_0xdb43('0x17')]:0x0;var _0x325563={'id':this['id'],'available':this[_0xdb43('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xdb43('0x8')],'paused':this[_0xdb43('0x16')],'waiting':this[_0xdb43('0xc')]};var _0x51dd80=md5(JSON[_0xdb43('0x18')](_0x325563));if(this[_0xdb43('0x1')]!==_0x51dd80){this[_0xdb43('0x1')]=_0x51dd80;io['to'](util[_0xdb43('0x19')]('whatsapp:queue:%s',_0x325563[_0xdb43('0x8')]))[_0xdb43('0x1a')](_0xdb43('0x1b'),_0x325563);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b0c0748..2479ca4 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(_0x923067,_0x45716b){var _0x3f173c=function(_0x1b9a1f){while(--_0x1b9a1f){_0x923067['push'](_0x923067['shift']());}};_0x3f173c(++_0x45716b);}(_0xb10b,0x12a));var _0xbb10=function(_0x53273a,_0x5ed978){_0x53273a=_0x53273a-0x0;var _0x3c41db=_0xb10b[_0x53273a];return _0x3c41db;};'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(_0x5b73ac,_0x279e50){var _0x5d676f=function(_0x2730ef){while(--_0x2730ef){_0x5b73ac['push'](_0x5b73ac['shift']());}};_0x5d676f(++_0x279e50);}(_0xb10b,0x12a));var _0xbb10=function(_0x460264,_0x51ddff){_0x460264=_0x460264-0x0;var _0x2d75a1=_0xb10b[_0x460264];return _0x2d75a1;};'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 449485c..0ba6ab1 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 _0x389b=['UpdateChatInteraction','updateChatInteraction','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x389b,0x11a));var _0xb389=function(_0x540f0d,_0x2a093b){_0x540f0d=_0x540f0d-0x0;var _0x5d2fc3=_0x389b[_0x540f0d];return _0x5d2fc3;};'use strict';var client=require(_0xb389('0x0'));exports['update']=function(_0x404af2,_0x4fa120){return client[_0xb389('0x1')](_0xb389('0x2'),{'body':_0x4fa120,'options':{'where':{'id':_0x404af2}},'log':_0xb389('0x3')});};exports['addTags']=function(_0x22e1bc,_0x867d35){return client[_0xb389('0x1')]('AddTagsToChatInteraction',{'body':_0x867d35,'options':{'where':{'id':_0x22e1bc}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xd368=['addTagsToChatInteraction','Request','updateChatInteraction'];(function(_0x41781a,_0x421dbf){var _0x36b17a=function(_0x8b34e4){while(--_0x8b34e4){_0x41781a['push'](_0x41781a['shift']());}};_0x36b17a(++_0x421dbf);}(_0xd368,0xa0));var _0x8d36=function(_0x2c3a37,_0x49f86a){_0x2c3a37=_0x2c3a37-0x0;var _0x509da8=_0xd368[_0x2c3a37];return _0x509da8;};'use strict';var client=require('../client');exports['update']=function(_0x296dbf,_0x143164){return client[_0x8d36('0x0')]('UpdateChatInteraction',{'body':_0x143164,'options':{'where':{'id':_0x296dbf}},'log':_0x8d36('0x1')});};exports['addTags']=function(_0x336ce8,_0x463722){return client[_0x8d36('0x0')]('AddTagsToChatInteraction',{'body':_0x463722,'options':{'where':{'id':_0x336ce8}},'log':_0x8d36('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 76649b1..8042ddf 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 _0x352a=['create','../client'];(function(_0x211090,_0xbf435f){var _0x571e98=function(_0x45bb1b){while(--_0x45bb1b){_0x211090['push'](_0x211090['shift']());}};_0x571e98(++_0xbf435f);}(_0x352a,0x157));var _0xa352=function(_0x47a03a,_0x1367f9){_0x47a03a=_0x47a03a-0x0;var _0x4aa157=_0x352a[_0x47a03a];return _0x4aa157;};'use strict';var client=require(_0xa352('0x0'));exports[_0xa352('0x1')]=function(_0x44206d){return client['Request']('CreateChatMessage',{'body':_0x44206d,'log':'createChatMessage'});}; \ No newline at end of file +var _0x91b9=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x91b9,0xa6));var _0x991b=function(_0x1ad15c,_0x394acd){_0x1ad15c=_0x1ad15c-0x0;var _0x2925c7=_0x91b9[_0x1ad15c];return _0x2925c7;};'use strict';var client=require(_0x991b('0x0'));exports['create']=function(_0x324690){return client[_0x991b('0x1')](_0x991b('0x2'),{'body':_0x324690,'log':_0x991b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 82d997b..c80f6d7 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 _0x4e00=['name','User','online','chatPause','getChatQueues','GetChatQueue'];(function(_0x10f101,_0x1ad86b){var _0x571f2f=function(_0x414748){while(--_0x414748){_0x10f101['push'](_0x10f101['shift']());}};_0x571f2f(++_0x1ad86b);}(_0x4e00,0xa0));var _0x04e0=function(_0x244d34,_0x455627){_0x244d34=_0x244d34-0x0;var _0x7964fa=_0x4e00[_0x244d34];return _0x7964fa;};'use strict';var client=require('../client');exports[_0x04e0('0x0')]=function(){return function(){return client['Request'](_0x04e0('0x1'),{'options':{'raw':![],'attributes':['id',_0x04e0('0x2'),'timeout','strategy'],'include':[{'model':_0x04e0('0x3'),'as':'Agents','attributes':['id',_0x04e0('0x2'),_0x04e0('0x4'),_0x04e0('0x5')]}]},'log':_0x04e0('0x0')});};}; \ No newline at end of file +var _0xceae=['name','online','chatPause','../client','getChatQueues','timeout','Agents'];(function(_0x7d5365,_0x4f2ff1){var _0x49687d=function(_0x386da0){while(--_0x386da0){_0x7d5365['push'](_0x7d5365['shift']());}};_0x49687d(++_0x4f2ff1);}(_0xceae,0x122));var _0xecea=function(_0x30b145,_0x5b1406){_0x30b145=_0x30b145-0x0;var _0x5acce4=_0xceae[_0x30b145];return _0x5acce4;};'use strict';var client=require(_0xecea('0x0'));exports[_0xecea('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xecea('0x2'),'strategy'],'include':[{'model':'User','as':_0xecea('0x3'),'attributes':['id',_0xecea('0x4'),_0xecea('0x5'),_0xecea('0x6')]}]},'log':_0xecea('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d1106fe..8899025 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 _0xb31a=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xb31a,0xd4));var _0xab31=function(_0x493f75,_0xc38b21){_0x493f75=_0x493f75-0x0;var _0x513d3f=_0xb31a[_0x493f75];return _0x513d3f;};'use strict';var client=require(_0xab31('0x0'));exports[_0xab31('0x1')]=function(_0x16a117){return client[_0xab31('0x2')](_0xab31('0x3'),{'body':_0x16a117,'log':_0xab31('0x3')});};exports[_0xab31('0x4')]=function(_0x20b002,_0x2addad){return client[_0xab31('0x2')](_0xab31('0x5'),{'body':_0x2addad,'options':{'where':{'uniqueid':_0x20b002},'order':[['id',_0xab31('0x6')]],'limit':0x1},'log':_0xab31('0x5')});}; \ No newline at end of file +var _0xa44a=['CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client','Request'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0xa44a,0x9a));var _0xaa44=function(_0x5a829b,_0xc50d5a){_0x5a829b=_0x5a829b-0x0;var _0x165cf5=_0xa44a[_0x5a829b];return _0x165cf5;};'use strict';var client=require(_0xaa44('0x0'));exports['create']=function(_0x48886e){return client[_0xaa44('0x1')](_0xaa44('0x2'),{'body':_0x48886e,'log':_0xaa44('0x2')});};exports[_0xaa44('0x3')]=function(_0x18c8ad,_0x3427a1){return client['Request']('UpdateChatQueueReport',{'body':_0x3427a1,'options':{'where':{'uniqueid':_0x18c8ad},'order':[['id',_0xaa44('0x4')]],'limit':0x1},'log':_0xaa44('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e286a6e..37afb94 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(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x7a54,0x106));var _0x47a5=function(_0x389180,_0x5bf1b6){_0x389180=_0x389180-0x0;var _0x56dca6=_0x7a54[_0x389180];return _0x56dca6;};'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(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x7a54,0x106));var _0x47a5=function(_0xb2a1,_0x255f95){_0xb2a1=_0xb2a1-0x0;var _0x2f3197=_0x7a54[_0xb2a1];return _0x2f3197;};'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 9371385..950f915 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 _0xe24b=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x3b90c8,_0x262e79){var _0x6adff7=function(_0x29c595){while(--_0x29c595){_0x3b90c8['push'](_0x3b90c8['shift']());}};_0x6adff7(++_0x262e79);}(_0xe24b,0x79));var _0xbe24=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xe24b[_0x5a95fa];return _0x1a61b8;};'use strict';var client=require(_0xbe24('0x0'));exports[_0xbe24('0x1')]=function(_0x46f549){return client[_0xbe24('0x2')](_0xbe24('0x3'),{'body':_0x46f549,'log':_0xbe24('0x4')});}; \ No newline at end of file +var _0xd8bb=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x2cc063,_0x3b596d){var _0x20c93b=function(_0x4e7208){while(--_0x4e7208){_0x2cc063['push'](_0x2cc063['shift']());}};_0x20c93b(++_0x3b596d);}(_0xd8bb,0x1d0));var _0xbd8b=function(_0x19a786,_0x2e0d21){_0x19a786=_0x19a786-0x0;var _0x202322=_0xd8bb[_0x19a786];return _0x202322;};'use strict';var client=require(_0xbd8b('0x0'));exports[_0xbd8b('0x1')]=function(_0x2773cf){return client[_0xbd8b('0x2')](_0xbd8b('0x3'),{'body':_0x2773cf,'log':_0xbd8b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8362643..045e1c1 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 _0xea25=['GetFaxQueue','name','timeout','strategy','User','Agents','online','../client','getFaxQueues','Request'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0xea25,0x7f));var _0x5ea2=function(_0x29ba31,_0x12e107){_0x29ba31=_0x29ba31-0x0;var _0x4f7a6b=_0xea25[_0x29ba31];return _0x4f7a6b;};'use strict';var client=require(_0x5ea2('0x0'));exports[_0x5ea2('0x1')]=function(){return function(){return client[_0x5ea2('0x2')](_0x5ea2('0x3'),{'options':{'raw':![],'attributes':['id',_0x5ea2('0x4'),_0x5ea2('0x5'),_0x5ea2('0x6')],'include':[{'model':_0x5ea2('0x7'),'as':_0x5ea2('0x8'),'attributes':['id',_0x5ea2('0x4'),_0x5ea2('0x9'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xcc8f=['Agents','faxPause','../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User'];(function(_0x136088,_0x12cfa9){var _0x551f4c=function(_0x1f9188){while(--_0x1f9188){_0x136088['push'](_0x136088['shift']());}};_0x551f4c(++_0x12cfa9);}(_0xcc8f,0xe3));var _0xfcc8=function(_0x5c7e9a,_0x293190){_0x5c7e9a=_0x5c7e9a-0x0;var _0xb174e9=_0xcc8f[_0x5c7e9a];return _0xb174e9;};'use strict';var client=require(_0xfcc8('0x0'));exports[_0xfcc8('0x1')]=function(){return function(){return client['Request'](_0xfcc8('0x2'),{'options':{'raw':![],'attributes':['id',_0xfcc8('0x3'),_0xfcc8('0x4'),_0xfcc8('0x5')],'include':[{'model':_0xfcc8('0x6'),'as':_0xfcc8('0x7'),'attributes':['id','name','online',_0xfcc8('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 097abfc..086c544 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 _0xd1c4=['create','Request','update','UpdateFaxQueueReport','../client'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xd1c4,0xe0));var _0x4d1c=function(_0x52a7e5,_0x2ad163){_0x52a7e5=_0x52a7e5-0x0;var _0x5e75a5=_0xd1c4[_0x52a7e5];return _0x5e75a5;};'use strict';var client=require(_0x4d1c('0x0'));exports[_0x4d1c('0x1')]=function(_0xe7fe9c){return client[_0x4d1c('0x2')]('CreateFaxQueueReport',{'body':_0xe7fe9c,'log':'CreateFaxQueueReport'});};exports[_0x4d1c('0x3')]=function(_0x573315,_0x1940cf){return client[_0x4d1c('0x2')](_0x4d1c('0x4'),{'body':_0x1940cf,'options':{'where':{'uniqueid':_0x573315},'order':[['id','DESC']],'limit':0x1},'log':_0x4d1c('0x4')});}; \ No newline at end of file +var _0xba12=['DESC','UpdateFaxQueueReport','create','Request','CreateFaxQueueReport','update'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0xba12,0xa4));var _0x2ba1=function(_0x109305,_0x57f99e){_0x109305=_0x109305-0x0;var _0x266d81=_0xba12[_0x109305];return _0x266d81;};'use strict';var client=require('../client');exports[_0x2ba1('0x0')]=function(_0x47a00b){return client[_0x2ba1('0x1')](_0x2ba1('0x2'),{'body':_0x47a00b,'log':_0x2ba1('0x2')});};exports[_0x2ba1('0x3')]=function(_0x25f3f1,_0xa897e3){return client[_0x2ba1('0x1')]('UpdateFaxQueueReport',{'body':_0xa897e3,'options':{'where':{'uniqueid':_0x25f3f1},'order':[['id',_0x2ba1('0x4')]],'limit':0x1},'log':_0x2ba1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 1b1a91d..0f62f43 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 _0x5b2c=['Intervals','interval','../client','getIntervals','GetInterval','name'];(function(_0x148819,_0x179901){var _0x5605fc=function(_0x340d17){while(--_0x340d17){_0x148819['push'](_0x148819['shift']());}};_0x5605fc(++_0x179901);}(_0x5b2c,0xc2));var _0xc5b2=function(_0x5ace6d,_0x5f0c46){_0x5ace6d=_0x5ace6d-0x0;var _0xf20972=_0x5b2c[_0x5ace6d];return _0xf20972;};'use strict';var client=require(_0xc5b2('0x0'));exports[_0xc5b2('0x1')]=function(){return function(){return client['Request'](_0xc5b2('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc5b2('0x3')],'include':[{'model':'Interval','as':_0xc5b2('0x4'),'attributes':['id','name',_0xc5b2('0x5')]}]},'log':_0xc5b2('0x1')});};}; \ No newline at end of file +var _0x42f0=['GetInterval','name','Interval','Intervals','../client','getIntervals','Request'];(function(_0x2a9f51,_0x2234f4){var _0x34e470=function(_0x3c5f92){while(--_0x3c5f92){_0x2a9f51['push'](_0x2a9f51['shift']());}};_0x34e470(++_0x2234f4);}(_0x42f0,0x138));var _0x042f=function(_0x52a538,_0x51754a){_0x52a538=_0x52a538-0x0;var _0x353f32=_0x42f0[_0x52a538];return _0x353f32;};'use strict';var client=require(_0x042f('0x0'));exports[_0x042f('0x1')]=function(){return function(){return client[_0x042f('0x2')](_0x042f('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x042f('0x4')],'include':[{'model':_0x042f('0x5'),'as':_0x042f('0x6'),'attributes':['id',_0x042f('0x4'),'interval']}]},'log':_0x042f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c844774..f2d08c9 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 _0xfff0=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x30fa66,_0x48e393){var _0x345a96=function(_0x25c2d4){while(--_0x25c2d4){_0x30fa66['push'](_0x30fa66['shift']());}};_0x345a96(++_0x48e393);}(_0xfff0,0x139));var _0x0fff=function(_0x450e63,_0x39aa1f){_0x450e63=_0x450e63-0x0;var _0x3fafc0=_0xfff0[_0x450e63];return _0x3fafc0;};'use strict';var client=require('../client');exports[_0x0fff('0x0')]=function(_0x2b95e0,_0x148db8){return client['Request'](_0x0fff('0x1'),{'body':_0x148db8,'options':{'where':{'id':_0x2b95e0}},'log':_0x0fff('0x2')});};exports[_0x0fff('0x3')]=function(_0x4bec60,_0x2cd3d5){return client[_0x0fff('0x4')]('AddTagsToMailInteraction',{'body':_0x2cd3d5,'options':{'where':{'id':_0x4bec60}},'log':_0x0fff('0x5')});}; \ No newline at end of file +var _0xb03e=['addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x18c903,_0x1fc83c){var _0x138d44=function(_0x122d36){while(--_0x122d36){_0x18c903['push'](_0x18c903['shift']());}};_0x138d44(++_0x1fc83c);}(_0xb03e,0x1eb));var _0xeb03=function(_0x999183,_0x26da26){_0x999183=_0x999183-0x0;var _0x511122=_0xb03e[_0x999183];return _0x511122;};'use strict';var client=require('../client');exports[_0xeb03('0x0')]=function(_0x399504,_0x868905){return client[_0xeb03('0x1')](_0xeb03('0x2'),{'body':_0x868905,'options':{'where':{'id':_0x399504}},'log':_0xeb03('0x3')});};exports[_0xeb03('0x4')]=function(_0x1fe650,_0x474450){return client[_0xeb03('0x1')](_0xeb03('0x5'),{'body':_0x474450,'options':{'where':{'id':_0x1fe650}},'log':_0xeb03('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 4675b30..04127f3 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 _0x03e0=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0xa4b8e1,_0x49d30b){var _0x507e42=function(_0xca2abc){while(--_0xca2abc){_0xa4b8e1['push'](_0xa4b8e1['shift']());}};_0x507e42(++_0x49d30b);}(_0x03e0,0xed));var _0x003e=function(_0x401c88,_0x5c9ef9){_0x401c88=_0x401c88-0x0;var _0x3126a0=_0x03e0[_0x401c88];return _0x3126a0;};'use strict';var client=require(_0x003e('0x0'));exports['create']=function(_0x41fc2b){return client[_0x003e('0x1')](_0x003e('0x2'),{'body':_0x41fc2b,'log':_0x003e('0x3')});}; \ No newline at end of file +var _0xc017=['../client','create','Request','CreateMailMessage'];(function(_0xe88ca6,_0x5e07a5){var _0x801702=function(_0x5822d7){while(--_0x5822d7){_0xe88ca6['push'](_0xe88ca6['shift']());}};_0x801702(++_0x5e07a5);}(_0xc017,0xa8));var _0x7c01=function(_0xe37ca8,_0x1c19b6){_0xe37ca8=_0xe37ca8-0x0;var _0xed9211=_0xc017[_0xe37ca8];return _0xed9211;};'use strict';var client=require(_0x7c01('0x0'));exports[_0x7c01('0x1')]=function(_0xd093c3){return client[_0x7c01('0x2')](_0x7c01('0x3'),{'body':_0xd093c3,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 24fd8a8..2edab95 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 _0x00f0=['User','name','mailPause','getMailQueues','Request','timeout','strategy'];(function(_0x1d236a,_0x29b29b){var _0x514fde=function(_0x10db22){while(--_0x10db22){_0x1d236a['push'](_0x1d236a['shift']());}};_0x514fde(++_0x29b29b);}(_0x00f0,0x81));var _0x000f=function(_0x4a8e76,_0x423791){_0x4a8e76=_0x4a8e76-0x0;var _0xf3dfd=_0x00f0[_0x4a8e76];return _0xf3dfd;};'use strict';var client=require('../client');exports[_0x000f('0x0')]=function(){return function(){return client[_0x000f('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x000f('0x2'),_0x000f('0x3')],'include':[{'model':_0x000f('0x4'),'as':'Agents','attributes':['id',_0x000f('0x5'),'online',_0x000f('0x6')]}]},'log':_0x000f('0x0')});};}; \ No newline at end of file +var _0x1ec6=['../client','getMailQueues','Request','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x5a8416,_0x349757){var _0x2185cf=function(_0x4a4876){while(--_0x4a4876){_0x5a8416['push'](_0x5a8416['shift']());}};_0x2185cf(++_0x349757);}(_0x1ec6,0x82));var _0x61ec=function(_0x1f0448,_0xa2865f){_0x1f0448=_0x1f0448-0x0;var _0x16fe78=_0x1ec6[_0x1f0448];return _0x16fe78;};'use strict';var client=require(_0x61ec('0x0'));exports[_0x61ec('0x1')]=function(){return function(){return client[_0x61ec('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x61ec('0x3'),_0x61ec('0x4'),_0x61ec('0x5')],'include':[{'model':_0x61ec('0x6'),'as':_0x61ec('0x7'),'attributes':['id',_0x61ec('0x3'),_0x61ec('0x8'),_0x61ec('0x9')]}]},'log':_0x61ec('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index dc58f88..70ba33f 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 _0x6f16=['DESC','../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x5690ad,_0x4c7156){var _0x45b55e=function(_0x1397a2){while(--_0x1397a2){_0x5690ad['push'](_0x5690ad['shift']());}};_0x45b55e(++_0x4c7156);}(_0x6f16,0xc7));var _0x66f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f16[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x66f1('0x0'));exports[_0x66f1('0x1')]=function(_0x4a4cf7){return client[_0x66f1('0x2')]('CreateMailQueueReport',{'body':_0x4a4cf7,'log':_0x66f1('0x3')});};exports['update']=function(_0xcdfd6c,_0x13abcb){return client[_0x66f1('0x2')](_0x66f1('0x4'),{'body':_0x13abcb,'options':{'where':{'uniqueid':_0xcdfd6c},'order':[['id',_0x66f1('0x5')]],'limit':0x1},'log':_0x66f1('0x4')});}; \ No newline at end of file +var _0x37a6=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x46978b,_0x4377ee){var _0x36535d=function(_0x4e2eb4){while(--_0x4e2eb4){_0x46978b['push'](_0x46978b['shift']());}};_0x36535d(++_0x4377ee);}(_0x37a6,0xa6));var _0x637a=function(_0x5cd4aa,_0x57a6c8){_0x5cd4aa=_0x5cd4aa-0x0;var _0x4d10cf=_0x37a6[_0x5cd4aa];return _0x4d10cf;};'use strict';var client=require(_0x637a('0x0'));exports[_0x637a('0x1')]=function(_0x51bad9){return client[_0x637a('0x2')](_0x637a('0x3'),{'body':_0x51bad9,'log':_0x637a('0x3')});};exports[_0x637a('0x4')]=function(_0x5db04f,_0xf2c8c1){return client[_0x637a('0x2')](_0x637a('0x5'),{'body':_0xf2c8c1,'options':{'where':{'uniqueid':_0x5db04f},'order':[['id',_0x637a('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3c709d1..338d3dc 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 _0x40af=['Request','addTags','../client','update'];(function(_0x763445,_0x255abe){var _0x1dc750=function(_0x328adb){while(--_0x328adb){_0x763445['push'](_0x763445['shift']());}};_0x1dc750(++_0x255abe);}(_0x40af,0x1ae));var _0xf40a=function(_0x51f485,_0x5705f){_0x51f485=_0x51f485-0x0;var _0x2706cf=_0x40af[_0x51f485];return _0x2706cf;};'use strict';var client=require(_0xf40a('0x0'));exports[_0xf40a('0x1')]=function(_0x11c604,_0x1d99b8){return client[_0xf40a('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1d99b8,'options':{'where':{'id':_0x11c604}},'log':'updateOpenchannelInteraction'});};exports[_0xf40a('0x3')]=function(_0x7eb234,_0x522e1e){return client[_0xf40a('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x522e1e,'options':{'where':{'id':_0x7eb234}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x62ad=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','Request'];(function(_0x2f7f86,_0x3a4474){var _0x2e4022=function(_0x33db16){while(--_0x33db16){_0x2f7f86['push'](_0x2f7f86['shift']());}};_0x2e4022(++_0x3a4474);}(_0x62ad,0x139));var _0xd62a=function(_0x4f8a6b,_0x522e3c){_0x4f8a6b=_0x4f8a6b-0x0;var _0x3e1e59=_0x62ad[_0x4f8a6b];return _0x3e1e59;};'use strict';var client=require(_0xd62a('0x0'));exports['update']=function(_0xed52e,_0x127481){return client[_0xd62a('0x1')]('UpdateOpenchannelInteraction',{'body':_0x127481,'options':{'where':{'id':_0xed52e}},'log':_0xd62a('0x2')});};exports[_0xd62a('0x3')]=function(_0x468bf9,_0x564ad9){return client[_0xd62a('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x564ad9,'options':{'where':{'id':_0x468bf9}},'log':_0xd62a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 07a88eb..d0d8bdc 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 _0xcf23=['createOpenchannelMessage','../client','create','Request'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0xcf23,0x1c5));var _0x3cf2=function(_0x35db8e,_0x487872){_0x35db8e=_0x35db8e-0x0;var _0x41f27e=_0xcf23[_0x35db8e];return _0x41f27e;};'use strict';var client=require(_0x3cf2('0x0'));exports[_0x3cf2('0x1')]=function(_0x323c67){return client[_0x3cf2('0x2')]('CreateOpenchannelMessage',{'body':_0x323c67,'log':_0x3cf2('0x3')});}; \ No newline at end of file +var _0xe864=['../client','create','Request','createOpenchannelMessage'];(function(_0x4e3eb5,_0x1c7904){var _0x1ad94c=function(_0x1874be){while(--_0x1874be){_0x4e3eb5['push'](_0x4e3eb5['shift']());}};_0x1ad94c(++_0x1c7904);}(_0xe864,0x74));var _0x4e86=function(_0x1ce08b,_0xb2fc98){_0x1ce08b=_0x1ce08b-0x0;var _0x5d4d04=_0xe864[_0x1ce08b];return _0x5d4d04;};'use strict';var client=require(_0x4e86('0x0'));exports[_0x4e86('0x1')]=function(_0x22585a){return client[_0x4e86('0x2')]('CreateOpenchannelMessage',{'body':_0x22585a,'log':_0x4e86('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index fe19a9d..80220c4 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 _0x9a21=['name','timeout','strategy','User','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x2050f7,_0x3833c6){var _0x219da1=function(_0x554dc1){while(--_0x554dc1){_0x2050f7['push'](_0x2050f7['shift']());}};_0x219da1(++_0x3833c6);}(_0x9a21,0x176));var _0x19a2=function(_0x911353,_0x1648ed){_0x911353=_0x911353-0x0;var _0x2f05fa=_0x9a21[_0x911353];return _0x2f05fa;};'use strict';var client=require(_0x19a2('0x0'));exports[_0x19a2('0x1')]=function(){return function(){return client[_0x19a2('0x2')](_0x19a2('0x3'),{'options':{'raw':![],'attributes':['id',_0x19a2('0x4'),_0x19a2('0x5'),_0x19a2('0x6')],'include':[{'model':_0x19a2('0x7'),'as':'Agents','attributes':['id','name',_0x19a2('0x8'),'openchannelPause']}]},'log':_0x19a2('0x1')});};}; \ No newline at end of file +var _0x3dc4=['strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout'];(function(_0x31d983,_0x46fcca){var _0xaff516=function(_0x13ac6d){while(--_0x13ac6d){_0x31d983['push'](_0x31d983['shift']());}};_0xaff516(++_0x46fcca);}(_0x3dc4,0xc1));var _0x43dc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3dc4[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x43dc('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x43dc('0x1')](_0x43dc('0x2'),{'options':{'raw':![],'attributes':['id',_0x43dc('0x3'),_0x43dc('0x4'),_0x43dc('0x5')],'include':[{'model':_0x43dc('0x6'),'as':_0x43dc('0x7'),'attributes':['id',_0x43dc('0x3'),_0x43dc('0x8'),_0x43dc('0x9')]}]},'log':_0x43dc('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c07c331..08a660f 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 _0x3611=['../client','Request','update','DESC','UpdateOpenchannelQueueReport'];(function(_0xebd018,_0x5a51ec){var _0x3f07=function(_0x532f0b){while(--_0x532f0b){_0xebd018['push'](_0xebd018['shift']());}};_0x3f07(++_0x5a51ec);}(_0x3611,0x136));var _0x1361=function(_0x33a9d5,_0x1efd86){_0x33a9d5=_0x33a9d5-0x0;var _0x117445=_0x3611[_0x33a9d5];return _0x117445;};'use strict';var client=require(_0x1361('0x0'));exports['create']=function(_0x4af7dd){return client[_0x1361('0x1')]('CreateOpenchannelQueueReport',{'body':_0x4af7dd,'log':'CreateOpenchannelQueueReport'});};exports[_0x1361('0x2')]=function(_0x2e0c01,_0x25db42){return client[_0x1361('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x25db42,'options':{'where':{'uniqueid':_0x2e0c01},'order':[['id',_0x1361('0x3')]],'limit':0x1},'log':_0x1361('0x4')});}; \ No newline at end of file +var _0xecbc=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','update'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xecbc,0x86));var _0xcecb=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xecbc[_0x35885a];return _0xe86249;};'use strict';var client=require(_0xcecb('0x0'));exports[_0xcecb('0x1')]=function(_0x3aeaff){return client[_0xcecb('0x2')]('CreateOpenchannelQueueReport',{'body':_0x3aeaff,'log':'CreateOpenchannelQueueReport'});};exports[_0xcecb('0x3')]=function(_0x5d7f86,_0x46b072){return client['Request'](_0xcecb('0x4'),{'body':_0x46b072,'options':{'where':{'uniqueid':_0x5d7f86},'order':[['id',_0xcecb('0x5')]],'limit':0x1},'log':_0xcecb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 90db040..23d2ad7 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 _0x46cb=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','Request','UpdateSmsInteraction'];(function(_0x38ec3b,_0x1a25c5){var _0x199f01=function(_0x3377a3){while(--_0x3377a3){_0x38ec3b['push'](_0x38ec3b['shift']());}};_0x199f01(++_0x1a25c5);}(_0x46cb,0xd6));var _0xb46c=function(_0xd206ce,_0x3031d2){_0xd206ce=_0xd206ce-0x0;var _0x5b3ec6=_0x46cb[_0xd206ce];return _0x5b3ec6;};'use strict';var client=require('../client');exports['update']=function(_0x58bb7b,_0x3d90fc){return client[_0xb46c('0x0')](_0xb46c('0x1'),{'body':_0x3d90fc,'options':{'where':{'id':_0x58bb7b}},'log':_0xb46c('0x2')});};exports[_0xb46c('0x3')]=function(_0x2aab0a,_0x2a6e97){return client[_0xb46c('0x0')](_0xb46c('0x4'),{'body':_0x2a6e97,'options':{'where':{'id':_0x2aab0a}},'log':_0xb46c('0x5')});}; \ No newline at end of file +var _0x383d=['addTags','AddTagsToSmsInteraction','Request','updateSmsInteraction'];(function(_0x14e175,_0x5b31df){var _0xefe61b=function(_0x448bb5){while(--_0x448bb5){_0x14e175['push'](_0x14e175['shift']());}};_0xefe61b(++_0x5b31df);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['update']=function(_0xced345,_0x326371){return client[_0xd383('0x0')]('UpdateSmsInteraction',{'body':_0x326371,'options':{'where':{'id':_0xced345}},'log':_0xd383('0x1')});};exports[_0xd383('0x2')]=function(_0x319f67,_0x3439dd){return client[_0xd383('0x0')](_0xd383('0x3'),{'body':_0x3439dd,'options':{'where':{'id':_0x319f67}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 4ae0f64..b035f63 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 _0x8e58=['CreateSmsMessage','createSmsMessage','Request'];(function(_0x3c1aaa,_0x36e0f8){var _0x12d82b=function(_0x26424b){while(--_0x26424b){_0x3c1aaa['push'](_0x3c1aaa['shift']());}};_0x12d82b(++_0x36e0f8);}(_0x8e58,0x7d));var _0x88e5=function(_0x20a575,_0x33476a){_0x20a575=_0x20a575-0x0;var _0x14ed00=_0x8e58[_0x20a575];return _0x14ed00;};'use strict';var client=require('../client');exports['create']=function(_0x26d73c){return client[_0x88e5('0x0')](_0x88e5('0x1'),{'body':_0x26d73c,'log':_0x88e5('0x2')});}; \ No newline at end of file +var _0x18a0=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x5e4cfd,_0x50f345){var _0x59c628=function(_0x499f93){while(--_0x499f93){_0x5e4cfd['push'](_0x5e4cfd['shift']());}};_0x59c628(++_0x50f345);}(_0x18a0,0x9f));var _0x018a=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x18a0[_0x292f93];return _0x5a94b1;};'use strict';var client=require(_0x018a('0x0'));exports[_0x018a('0x1')]=function(_0x14beae){return client[_0x018a('0x2')](_0x018a('0x3'),{'body':_0x14beae,'log':_0x018a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index bccfae5..f6e5062 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x178bdd,_0x1b0d31){var _0x5b985d=function(_0xf26040){while(--_0xf26040){_0x178bdd['push'](_0x178bdd['shift']());}};_0x5b985d(++_0x1b0d31);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x3de59c,_0x44b266){var _0x57da85=function(_0x40b07d){while(--_0x40b07d){_0x3de59c['push'](_0x3de59c['shift']());}};_0x57da85(++_0x44b266);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 8748497..c7b28af 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x29fb79,_0x474aca){var _0x297f38=function(_0x515ce5){while(--_0x515ce5){_0x29fb79['push'](_0x29fb79['shift']());}};_0x297f38(++_0x474aca);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'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 +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1cd5b1,_0x58dd23){var _0x25b4c7=function(_0x272195){while(--_0x272195){_0x1cd5b1['push'](_0x1cd5b1['shift']());}};_0x25b4c7(++_0x58dd23);}(_0x008c,0x188));var _0xc008=function(_0x37594c,_0x250938){_0x37594c=_0x37594c-0x0;var _0xc6c829=_0x008c[_0x37594c];return _0xc6c829;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index aabb467..b686bc3 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(_0x54c9e2,_0x5ba1b8){var _0x5762a5=function(_0x4127e7){while(--_0x4127e7){_0x54c9e2['push'](_0x54c9e2['shift']());}};_0x5762a5(++_0x5ba1b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x6bd344,_0x2b8603){var _0x126807=function(_0x16fea7){while(--_0x16fea7){_0x6bd344['push'](_0x6bd344['shift']());}};_0x126807(++_0x2b8603);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 4c516fd..249c498 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(_0x42381d,_0x3cbe83){var _0x532e91=function(_0xe4461c){while(--_0xe4461c){_0x42381d['push'](_0x42381d['shift']());}};_0x532e91(++_0x3cbe83);}(_0xee3c,0x14a));var _0xcee3=function(_0x5ed341,_0x1d4e16){_0x5ed341=_0x5ed341-0x0;var _0x33149e=_0xee3c[_0x5ed341];return _0x33149e;};'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 _0x77d4=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x4f2873,_0x4dc0c2){var _0x477c45=function(_0x1981b7){while(--_0x1981b7){_0x4f2873['push'](_0x4f2873['shift']());}};_0x477c45(++_0x4dc0c2);}(_0x77d4,0x108));var _0x477d=function(_0x2003d0,_0x27a2b1){_0x2003d0=_0x2003d0-0x0;var _0xa12f02=_0x77d4[_0x2003d0];return _0xa12f02;};'use strict';var client=require('../client');exports[_0x477d('0x0')]=function(_0x49b615,_0x18c0fe){return client['Request'](_0x477d('0x1'),{'body':_0x18c0fe,'options':{'where':{'id':_0x49b615}},'log':_0x477d('0x2')});};exports['addTags']=function(_0x53e1b8,_0x16213f){return client[_0x477d('0x3')](_0x477d('0x4'),{'body':_0x16213f,'options':{'where':{'id':_0x53e1b8}},'log':_0x477d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2608986..abbe5cc 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 _0x5fa6=['CreateWhatsappMessage','../client','Request'];(function(_0xb19bc6,_0x2dd9b5){var _0x2e3f77=function(_0x51ef45){while(--_0x51ef45){_0xb19bc6['push'](_0xb19bc6['shift']());}};_0x2e3f77(++_0x2dd9b5);}(_0x5fa6,0x15a));var _0x65fa=function(_0x4240f0,_0x2ccabe){_0x4240f0=_0x4240f0-0x0;var _0xa45a32=_0x5fa6[_0x4240f0];return _0xa45a32;};'use strict';var client=require(_0x65fa('0x0'));exports['create']=function(_0x408199){return client[_0x65fa('0x1')](_0x65fa('0x2'),{'body':_0x408199,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x9c01=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0xdf6477,_0x219622){var _0x23c7f=function(_0x5d50f5){while(--_0x5d50f5){_0xdf6477['push'](_0xdf6477['shift']());}};_0x23c7f(++_0x219622);}(_0x9c01,0x107));var _0x19c0=function(_0x395376,_0x308ffb){_0x395376=_0x395376-0x0;var _0x1a304c=_0x9c01[_0x395376];return _0x1a304c;};'use strict';var client=require(_0x19c0('0x0'));exports[_0x19c0('0x1')]=function(_0x4ed50e){return client[_0x19c0('0x2')](_0x19c0('0x3'),{'body':_0x4ed50e,'log':_0x19c0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 265ae49..5608c30 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 _0x6914=['Request','GetWhatsappQueue','name','timeout','Agents','online','whatsappPause','getWhatsappQueues','../client'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6914,0x194));var _0x4691=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x6914[_0x12fc8d];return _0x3f9d04;};'use strict';var client=require(_0x4691('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x4691('0x1')](_0x4691('0x2'),{'options':{'raw':![],'attributes':['id',_0x4691('0x3'),_0x4691('0x4'),'strategy'],'include':[{'model':'User','as':_0x4691('0x5'),'attributes':['id',_0x4691('0x3'),_0x4691('0x6'),_0x4691('0x7')]}]},'log':_0x4691('0x8')});};}; \ No newline at end of file +var _0x8726=['timeout','strategy','User','Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x57966a,_0x477964){var _0x191765=function(_0x106a01){while(--_0x106a01){_0x57966a['push'](_0x57966a['shift']());}};_0x191765(++_0x477964);}(_0x8726,0x1b7));var _0x6872=function(_0x389e80,_0x32cd62){_0x389e80=_0x389e80-0x0;var _0x5882e3=_0x8726[_0x389e80];return _0x5882e3;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x6872('0x0'),{'options':{'raw':![],'attributes':['id',_0x6872('0x1'),_0x6872('0x2'),_0x6872('0x3')],'include':[{'model':_0x6872('0x4'),'as':_0x6872('0x5'),'attributes':['id',_0x6872('0x1'),_0x6872('0x6'),_0x6872('0x7')]}]},'log':_0x6872('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index edeb4f8..f59fdf9 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 _0xf4c3=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x17f33a,_0x43e78a){var _0x1dfecc=function(_0x3bd82b){while(--_0x3bd82b){_0x17f33a['push'](_0x17f33a['shift']());}};_0x1dfecc(++_0x43e78a);}(_0xf4c3,0x1af));var _0x3f4c=function(_0x40efb5,_0x18c786){_0x40efb5=_0x40efb5-0x0;var _0xf10173=_0xf4c3[_0x40efb5];return _0xf10173;};'use strict';var client=require(_0x3f4c('0x0'));exports[_0x3f4c('0x1')]=function(_0x3f8d2c){return client[_0x3f4c('0x2')](_0x3f4c('0x3'),{'body':_0x3f8d2c,'log':_0x3f4c('0x3')});};exports[_0x3f4c('0x4')]=function(_0x3ef689,_0x3fcde0){return client[_0x3f4c('0x2')](_0x3f4c('0x5'),{'body':_0x3fcde0,'options':{'where':{'uniqueid':_0x3ef689},'order':[['id','DESC']],'limit':0x1},'log':_0x3f4c('0x5')});}; \ No newline at end of file +var _0x3d72=['update','Request','UpdateWhatsappQueueReport','../client','CreateWhatsappQueueReport'];(function(_0x5d3510,_0x2b4ca1){var _0xf75c39=function(_0xd03566){while(--_0xd03566){_0x5d3510['push'](_0x5d3510['shift']());}};_0xf75c39(++_0x2b4ca1);}(_0x3d72,0x198));var _0x23d7=function(_0x59b6b6,_0x4534f3){_0x59b6b6=_0x59b6b6-0x0;var _0x5ce5e4=_0x3d72[_0x59b6b6];return _0x5ce5e4;};'use strict';var client=require(_0x23d7('0x0'));exports['create']=function(_0x423783){return client['Request'](_0x23d7('0x1'),{'body':_0x423783,'log':_0x23d7('0x1')});};exports[_0x23d7('0x2')]=function(_0xe75d62,_0xaa5bd6){return client[_0x23d7('0x3')](_0x23d7('0x4'),{'body':_0xaa5bd6,'options':{'where':{'uniqueid':_0xe75d62},'order':[['id','DESC']],'limit':0x1},'log':_0x23d7('0x4')});}; \ 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 27b8e45..5fd4679 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 _0x3688=['atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout'];(function(_0x1aa7b1,_0xe9e31d){var _0x5d4ff4=function(_0x1b3036){while(--_0x1b3036){_0x1aa7b1['push'](_0x1aa7b1['shift']());}};_0x5d4ff4(++_0xe9e31d);}(_0x3688,0x77));var _0x8368=function(_0x1c3db6,_0xa3de01){_0x1c3db6=_0x1c3db6-0x0;var _0x54580e=_0x3688[_0x1c3db6];return _0x54580e;};'use strict';var schema=require(_0x8368('0x0'));var _=require(_0x8368('0x1'));var util=require('util');var seqqueue=require(_0x8368('0x2'));var logger=require(_0x8368('0x3'))(_0x8368('0x4'));var strategy=require(_0x8368('0x5'));var queue=schema({'name':{'type':_0x8368('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x8368('0x7')}});function writeLog(_0x6ef925,_0x230049,_0x50e160){return logger[_0x8368('0x8')](util[_0x8368('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x6ef925,_0x230049[_0x8368('0xa')],_0x50e160));}function handleFindAgent(_0x24c2ce){return function(_0x43dc77){return _0x43dc77[_0x8368('0xa')][_0x8368('0xb')]()===_0x24c2ce[_0x8368('0xb')]();};}exports['consequence']=function(_0x48a6e1,_0x2bb15f,_0xc47fd2,_0x565bd9){return function(_0x545df5){try{var _0x3dd2da={'name':_0x2bb15f[0x0],'timeout':_0x2bb15f[0x1]};var _0x3421d4=queue[_0x8368('0x0')](_0x3dd2da,{'typecast':!![]});if(_0x3421d4[_0x8368('0xc')]){logger[_0x8368('0xd')](_0x8368('0xe'),_0x48a6e1,_[_0x8368('0xf')](_0x3421d4,_0x8368('0x10'))[_0x8368('0x11')](',\x20'));_0x545df5['stop']();}else{var _0x23b77f=_[_0x8368('0x12')](_0xc47fd2[_0x8368('0x13')],handleFindAgent(_0x3dd2da['name']));if(_0x23b77f){var _0x566f79=(_0x3dd2da[_0x8368('0x14')]||0xa)*0x3e8;var _0x498ede,_0x8ab4a0;var _0x54087d=seqqueue['createQueue'](_0x566f79);_0x54087d['id']=_0x48a6e1;_0x54087d[_0x8368('0x15')]=_0x566f79;_0x54087d['channel']=_0x565bd9[_0x8368('0x16')];writeLog(_0x48a6e1,_0x23b77f,util[_0x8368('0x9')](_0x8368('0x17'),_0x566f79));_0xc47fd2[_0x8368('0x18')][_0x48a6e1]['on'](_0x8368('0x19'),function(){logger[_0x8368('0x8')](_0x8368('0x1a'),_0x48a6e1);clearTimeout(_0x8ab4a0);_0x8ab4a0=undefined;_0x54087d[_0x8368('0x1b')]();if(_0xc47fd2['rules'][_0x48a6e1]){delete _0xc47fd2[_0x8368('0x18')][_0x48a6e1];}_0x545df5[_0x8368('0x1c')]();});_0xc47fd2['rules'][_0x48a6e1]['on'](_0x8368('0x1d'),function(){if(_0xc47fd2[_0x8368('0x18')][_0x48a6e1]){delete _0xc47fd2[_0x8368('0x18')][_0x48a6e1];}});_0x8ab4a0=setTimeout(function(){logger[_0x8368('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x48a6e1);clearTimeout(_0x8ab4a0);_0x54087d['close']();_0x545df5[_0x8368('0x1e')]();},_0x566f79);strategy[_0x8368('0x1f')](_0x54087d,_0x23b77f,_0xc47fd2,_0x565bd9);}else{logger['error'](_0x8368('0x20'),_0x48a6e1,_0x3dd2da[_0x8368('0xa')]);_0x545df5[_0x8368('0x1c')]();}}}catch(_0x436ce7){console['log'](_0x436ce7);logger[_0x8368('0xd')](_0x8368('0x21'),_0x48a6e1,_0x436ce7[_0x8368('0x22')]);_0x545df5[_0x8368('0x1c')]();}};}; \ No newline at end of file +var _0x9b51=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','find','timeout','atimeout','channel','START:%s','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','timeout\x20is\x20a\x20number','format'];(function(_0x3aecb1,_0x16bc8a){var _0x27ae91=function(_0x50fd52){while(--_0x50fd52){_0x3aecb1['push'](_0x3aecb1['shift']());}};_0x27ae91(++_0x16bc8a);}(_0x9b51,0x1d7));var _0x19b5=function(_0x25d6c9,_0x8916b0){_0x25d6c9=_0x25d6c9-0x0;var _0x301ab8=_0x9b51[_0x25d6c9];return _0x301ab8;};'use strict';var schema=require(_0x19b5('0x0'));var _=require(_0x19b5('0x1'));var util=require(_0x19b5('0x2'));var seqqueue=require(_0x19b5('0x3'));var logger=require(_0x19b5('0x4'))('routing');var strategy=require(_0x19b5('0x5'));var queue=schema({'name':{'type':_0x19b5('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x19b5('0x7')}});function writeLog(_0x79cf6d,_0x4763bf,_0x47eb6f){return logger['info'](util[_0x19b5('0x8')](_0x19b5('0x9'),_0x79cf6d,_0x4763bf['name'],_0x47eb6f));}function handleFindAgent(_0x243c74){return function(_0x2ee7a6){return _0x2ee7a6[_0x19b5('0xa')][_0x19b5('0xb')]()===_0x243c74[_0x19b5('0xb')]();};}exports[_0x19b5('0xc')]=function(_0x3ab328,_0x4ae792,_0x916dde,_0x3adf33){return function(_0x2bfdee){try{var _0x5a3d04={'name':_0x4ae792[0x0],'timeout':_0x4ae792[0x1]};var _0x2129cb=queue[_0x19b5('0x0')](_0x5a3d04,{'typecast':!![]});if(_0x2129cb[_0x19b5('0xd')]){logger[_0x19b5('0xe')](_0x19b5('0xf'),_0x3ab328,_['map'](_0x2129cb,_0x19b5('0x10'))['join'](',\x20'));_0x2bfdee['stop']();}else{var _0xc25a05=_[_0x19b5('0x11')](_0x916dde['agents'],handleFindAgent(_0x5a3d04['name']));if(_0xc25a05){var _0xb56b96=(_0x5a3d04[_0x19b5('0x12')]||0xa)*0x3e8;var _0x1d6e59,_0x40e697;var _0x55d601=seqqueue['createQueue'](_0xb56b96);_0x55d601['id']=_0x3ab328;_0x55d601[_0x19b5('0x13')]=_0xb56b96;_0x55d601[_0x19b5('0x14')]=_0x3adf33['channel'];writeLog(_0x3ab328,_0xc25a05,util[_0x19b5('0x8')](_0x19b5('0x15'),_0xb56b96));_0x916dde['rules'][_0x3ab328]['on'](_0x19b5('0x16'),function(){logger[_0x19b5('0x17')](_0x19b5('0x18'),_0x3ab328);clearTimeout(_0x40e697);_0x40e697=undefined;_0x55d601[_0x19b5('0x19')]();if(_0x916dde[_0x19b5('0x1a')][_0x3ab328]){delete _0x916dde[_0x19b5('0x1a')][_0x3ab328];}_0x2bfdee[_0x19b5('0x1b')]();});_0x916dde[_0x19b5('0x1a')][_0x3ab328]['on']('complete',function(){if(_0x916dde[_0x19b5('0x1a')][_0x3ab328]){delete _0x916dde['rules'][_0x3ab328];}});_0x40e697=setTimeout(function(){logger['info'](_0x19b5('0x1c'),_0x3ab328);clearTimeout(_0x40e697);_0x55d601['close']();_0x2bfdee['next']();},_0xb56b96);strategy[_0x19b5('0x1d')](_0x55d601,_0xc25a05,_0x916dde,_0x3adf33);}else{logger[_0x19b5('0xe')](_0x19b5('0x1e'),_0x3ab328,_0x5a3d04[_0x19b5('0xa')]);_0x2bfdee[_0x19b5('0x1b')]();}}}catch(_0x10062c){console['log'](_0x10062c);logger['error']('[%s][QUEUE]\x20%s',_0x3ab328,_0x10062c[_0x19b5('0x1f')]);_0x2bfdee['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 b1613a3..9842a3f 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 _0xa586=['created','isEmpty','body','getMustacheRender','Message','create','then','stringify','finally','info','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','providerName','providerResponse','Failed','catch','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0x38ae4f,_0x1d3180){var _0x1e92db=function(_0x1a1cb9){while(--_0x1a1cb9){_0x38ae4f['push'](_0x38ae4f['shift']());}};_0x1e92db(++_0x1d3180);}(_0xa586,0x10c));var _0x6a58=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0xa586[_0x55daf2];return _0x1c8500;};'use strict';var _=require(_0x6a58('0x0'));var moment=require(_0x6a58('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x6a58('0x2'));var rpc={'chatMessage':require(_0x6a58('0x3')),'openchannelMessage':require(_0x6a58('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6a58('0x5')),'faxMessage':require(_0x6a58('0x6')),'whatsappMessage':require(_0x6a58('0x7'))};exports[_0x6a58('0x8')]=function(_0x386747,_0x190dc4){return function(_0x1bdebc){try{if(!_[_0x6a58('0x9')](this[_0x6a58('0xa')][_0x6a58('0xb')])){logger['info'](_0x6a58('0xc'),_0x386747,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1bdebc[_0x6a58('0xd')]();}var _0x323422={'ContactId':this[_0x6a58('0xe')]['id'],'sentAt':moment()[_0x6a58('0xf')](_0x6a58('0x10')),'direction':_0x6a58('0x11')};if(this['channel']===_0x6a58('0x12')||this[_0x6a58('0x13')]==='whatsapp'){_0x323422[_0x6a58('0x14')]=this[_0x6a58('0xa')][_0x6a58('0x14')];}var _0x63ed9a=this[_0x6a58('0x13')];if(_0x63ed9a==='chat'){_0x323422[_0x6a58('0x15')]=this[_0x6a58('0x16')]['id'];}else{_0x323422[_[_0x6a58('0x17')](_0x63ed9a)+_0x6a58('0x18')]=this[_0x6a58('0x16')]['id'];}_0x323422[_[_0x6a58('0x17')](_0x63ed9a)+_0x6a58('0x19')]=this[_0x6a58('0xa')]['id'];if(this[_0x6a58('0xa')][_0x6a58('0x1a')]){var _0x6a9f84=_0x190dc4[0x4];if(!_[_0x6a58('0x1b')](_0x6a9f84)){_0x323422[_0x6a58('0x1c')]=utils[_0x6a58('0x1d')](_0x6a9f84,this);return rpc[_0x63ed9a+_0x6a58('0x1e')][_0x6a58('0x1f')](_0x323422)[_0x6a58('0x20')](function(_0x4af43e){logger['info']('[%s][AMAZONLEX]\x20%s',_0x386747,_0x323422[_0x6a58('0x1c')]);})['catch'](function(_0x2c1fda){logger['error'](_0x6a58('0xc'),_0x386747,JSON[_0x6a58('0x21')](_0x2c1fda));})[_0x6a58('0x22')](function(){logger[_0x6a58('0x23')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x386747);_0x1bdebc[_0x6a58('0x24')]();});}else{logger['info'](_0x6a58('0x25'),_0x386747);_0x1bdebc[_0x6a58('0x24')]();}}else{var _0x283b92=this;var _0x13118d=new AWS[(_0x6a58('0x26'))]({'accessKeyId':_0x190dc4[0x0],'secretAccessKey':_0x190dc4[0x1],'region':_0x190dc4[0x2]});var _0x187227={'botAlias':_0x6a58('0x27'),'botName':_0x190dc4[0x3],'inputText':this[_0x6a58('0x28')][_0x6a58('0x1c')],'userId':this[_0x6a58('0x13')]+':'+this[_0x6a58('0xa')]['id'][_0x6a58('0x29')]()};_0x13118d[_0x6a58('0x2a')](_0x187227,function(_0x279652,_0x1103e9){if(_0x279652){logger[_0x6a58('0x2b')](_0x6a58('0xc'),_0x386747,_0x279652[_0x6a58('0x28')]);_0x1bdebc['next']();}else if(_0x1103e9&&_0x1103e9[_0x6a58('0x28')]){_0x283b92[_0x6a58('0x1c')][_0x6a58('0x2c')]=_0x1103e9;_0x323422['body']=_0x1103e9[_0x6a58('0x28')];_0x323422[_0x6a58('0x2d')]=_0x6a58('0x2c');_0x323422[_0x6a58('0x2e')]=JSON['stringify'](_0x1103e9);return rpc[_0x63ed9a+_0x6a58('0x1e')][_0x6a58('0x1f')](_0x323422)['then'](function(_0x28d2af){logger[_0x6a58('0x23')](_0x6a58('0xc'),_0x386747,_0x323422['body']);if(_0x1103e9['dialogState']==_0x6a58('0x2f')){_0x1bdebc[_0x6a58('0xd')]();}else{_0x1bdebc[_0x6a58('0x24')]();}})[_0x6a58('0x30')](function(_0x5c5d1b){logger[_0x6a58('0x2b')](_0x6a58('0xc'),_0x386747,JSON[_0x6a58('0x21')](_0x5c5d1b));_0x1bdebc[_0x6a58('0xd')]();});}else{_0x1bdebc['next']();}});}}catch(_0x12455d){logger[_0x6a58('0x2b')]('[%s][AMAZONLEX]\x20%s',_0x386747,JSON[_0x6a58('0x21')](_0x12455d));_0x1bdebc[_0x6a58('0x24')]();}};}; \ No newline at end of file +var _0xcb4f=['contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','info','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','toString','message','providerName','amazonlex','providerResponse','stringify','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x56f63f,_0x59b821){var _0x1930b5=function(_0x1c4e31){while(--_0x1c4e31){_0x56f63f['push'](_0x56f63f['shift']());}};_0x1930b5(++_0x59b821);}(_0xcb4f,0x148));var _0xfcb4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xcb4f[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xfcb4('0x0'));var moment=require(_0xfcb4('0x1'));var AWS=require(_0xfcb4('0x2'));var utils=require(_0xfcb4('0x3'));var logger=require('../../../../config/logger')(_0xfcb4('0x4'));var rpc={'chatMessage':require(_0xfcb4('0x5')),'openchannelMessage':require(_0xfcb4('0x6')),'mailMessage':require(_0xfcb4('0x7')),'smsMessage':require(_0xfcb4('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfcb4('0x9'))};exports['consequence']=function(_0x549443,_0x5a7a13){return function(_0x2118c3){try{if(!_['isNil'](this[_0xfcb4('0xa')][_0xfcb4('0xb')])){logger['info'](_0xfcb4('0xc'),_0x549443,_0xfcb4('0xd'));return _0x2118c3[_0xfcb4('0xe')]();}var _0x543607={'ContactId':this[_0xfcb4('0xf')]['id'],'sentAt':moment()[_0xfcb4('0x10')](_0xfcb4('0x11')),'direction':'out'};if(this['channel']===_0xfcb4('0x12')||this['channel']===_0xfcb4('0x13')){_0x543607[_0xfcb4('0x14')]=this[_0xfcb4('0xa')][_0xfcb4('0x14')];}var _0x2e7467=this[_0xfcb4('0x15')];if(_0x2e7467===_0xfcb4('0x16')){_0x543607[_0xfcb4('0x17')]=this[_0xfcb4('0x18')]['id'];}else{_0x543607[_[_0xfcb4('0x19')](_0x2e7467)+_0xfcb4('0x1a')]=this['account']['id'];}_0x543607[_[_0xfcb4('0x19')](_0x2e7467)+_0xfcb4('0x1b')]=this[_0xfcb4('0xa')]['id'];if(this[_0xfcb4('0xa')][_0xfcb4('0x1c')]){var _0x592d37=_0x5a7a13[0x4];if(!_['isEmpty'](_0x592d37)){_0x543607[_0xfcb4('0x1d')]=utils[_0xfcb4('0x1e')](_0x592d37,this);return rpc[_0x2e7467+_0xfcb4('0x1f')][_0xfcb4('0x20')](_0x543607)['then'](function(_0x1c2933){logger[_0xfcb4('0x21')](_0xfcb4('0xc'),_0x549443,_0x543607[_0xfcb4('0x1d')]);})[_0xfcb4('0x22')](function(_0x1c79cd){logger[_0xfcb4('0x23')](_0xfcb4('0xc'),_0x549443,JSON['stringify'](_0x1c79cd));})[_0xfcb4('0x24')](function(){logger['info'](_0xfcb4('0x25'),_0x549443);_0x2118c3[_0xfcb4('0x26')]();});}else{logger[_0xfcb4('0x21')](_0xfcb4('0x27'),_0x549443);_0x2118c3[_0xfcb4('0x26')]();}}else{var _0x2ca489=this;var _0x497fa1=new AWS['LexRuntime']({'accessKeyId':_0x5a7a13[0x0],'secretAccessKey':_0x5a7a13[0x1],'region':_0x5a7a13[0x2]});var _0x4abcf3={'botAlias':_0xfcb4('0x28'),'botName':_0x5a7a13[0x3],'inputText':this['message'][_0xfcb4('0x1d')],'userId':this[_0xfcb4('0x15')]+':'+this[_0xfcb4('0xa')]['id'][_0xfcb4('0x29')]()};_0x497fa1['postText'](_0x4abcf3,function(_0x123f65,_0x5b95cd){if(_0x123f65){logger[_0xfcb4('0x23')](_0xfcb4('0xc'),_0x549443,_0x123f65[_0xfcb4('0x2a')]);_0x2118c3[_0xfcb4('0xe')]();}else if(_0x5b95cd&&_0x5b95cd[_0xfcb4('0x2a')]){_0x2ca489[_0xfcb4('0x1d')]['amazonlex']=_0x5b95cd;_0x543607[_0xfcb4('0x1d')]=_0x5b95cd['message'];_0x543607[_0xfcb4('0x2b')]=_0xfcb4('0x2c');_0x543607[_0xfcb4('0x2d')]=JSON[_0xfcb4('0x2e')](_0x5b95cd);return rpc[_0x2e7467+_0xfcb4('0x1f')][_0xfcb4('0x20')](_0x543607)['then'](function(_0x533a53){logger[_0xfcb4('0x21')]('[%s][AMAZONLEX]\x20%s',_0x549443,_0x543607['body']);if(_0x5b95cd[_0xfcb4('0x2f')]==_0xfcb4('0x30')){_0x2118c3[_0xfcb4('0xe')]();}else{_0x2118c3['stop']();}})[_0xfcb4('0x22')](function(_0x4ef6a8){logger[_0xfcb4('0x23')](_0xfcb4('0xc'),_0x549443,JSON[_0xfcb4('0x2e')](_0x4ef6a8));_0x2118c3[_0xfcb4('0xe')]();});}else{_0x2118c3[_0xfcb4('0xe')]();}});}}catch(_0x58285f){logger[_0xfcb4('0x23')](_0xfcb4('0xc'),_0x549443,JSON[_0xfcb4('0x2e')](_0x58285f));_0x2118c3['stop']();}};}; \ 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 07b1546..310e92c 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 _0x9c73=['ChatWebsiteId','account','upperFirst','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','All','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','update','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat'];(function(_0xd4e47c,_0x2428b8){var _0x935fc7=function(_0x18b2c5){while(--_0x18b2c5){_0xd4e47c['push'](_0xd4e47c['shift']());}};_0x935fc7(++_0x2428b8);}(_0x9c73,0x180));var _0x39c7=function(_0x5a3b37,_0x4fd839){_0x5a3b37=_0x5a3b37-0x0;var _0x334733=_0x9c73[_0x5a3b37];return _0x334733;};'use strict';var _=require(_0x39c7('0x0'));var moment=require('moment');var utils=require(_0x39c7('0x1'));var logger=require('../../../../config/logger')(_0x39c7('0x2'));var rpc={'chatMessage':require(_0x39c7('0x3')),'openchannelMessage':require(_0x39c7('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x39c7('0x5')),'faxMessage':require(_0x39c7('0x6')),'whatsappMessage':require(_0x39c7('0x7')),'chatInteraction':require(_0x39c7('0x8')),'openchannelInteraction':require(_0x39c7('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x39c7('0xa')),'faxInteraction':require(_0x39c7('0xb')),'whatsappInteraction':require(_0x39c7('0xc'))};var mailRpc=require(_0x39c7('0xd'));exports['consequence']=function(_0x42e30c,_0x158f71,_0x25ddc2,_0x817bcb){return function(_0x37e018){try{var _0x161dac=this[_0x39c7('0xe')];if(_0x161dac===_0x39c7('0xf')&&_0x817bcb[_0x39c7('0x10')][_0x39c7('0x11')]){logger[_0x39c7('0x12')]('[%s][AUTOREPLY]\x20%s',_0x42e30c,_0x39c7('0x13'));return _0x37e018['next']();}if(_0x158f71[0x0]==='1'&&(_[_0x39c7('0x14')](this['interaction'][_0x39c7('0x15')])||!this[_0x39c7('0x16')][_0x39c7('0x15')])){logger[_0x39c7('0x12')](_0x39c7('0x17'),_0x42e30c,_0x39c7('0x18'));return _0x37e018[_0x39c7('0x19')]();}if(_0x158f71[0x0]==='2'&&this[_0x39c7('0x16')][_0x39c7('0x1a')]){logger['info'](_0x39c7('0x1b'),_0x42e30c,_0x39c7('0x1c'));return _0x37e018[_0x39c7('0x19')]();}var _0x81c7a5={'ContactId':this[_0x39c7('0x1d')]['id'],'sentAt':moment()[_0x39c7('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x39c7('0x1f')};if(this[_0x39c7('0xe')]==='mail'){_0x81c7a5[_0x39c7('0x10')]=utils[_0x39c7('0x20')](_0x158f71[0x2],this);}else{_0x81c7a5[_0x39c7('0x10')]=utils[_0x39c7('0x20')](_0x158f71[0x1],this);}if(this[_0x39c7('0x21')]){_0x81c7a5['to']=this[_0x39c7('0x21')][_0x39c7('0x22')]||'';if(this[_0x39c7('0xe')]==='mail'&&_0x158f71[0x1]==='1'){_0x81c7a5['cc']=this[_0x39c7('0x21')]['cc']||'';}_0x81c7a5['from']=this['message']['to']||'';_0x81c7a5[_0x39c7('0x23')]=this[_0x39c7('0x21')][_0x39c7('0x23')]||'';_0x81c7a5[_0x39c7('0x24')]=!![];if(this[_0x39c7('0x21')][_0x39c7('0x25')]){_0x81c7a5[_0x39c7('0x25')]='';_0x81c7a5[_0x39c7('0x25')]+=_[_0x39c7('0x26')](this['message'][_0x39c7('0x25')],_0x39c7('0x27'))?'':_0x39c7('0x28');_0x81c7a5['subject']+=this[_0x39c7('0x21')]['subject'];}}if(this[_0x39c7('0xe')]===_0x39c7('0x29')){_0x81c7a5[_0x39c7('0x2a')]=this[_0x39c7('0x2b')]['id'];}else{_0x81c7a5[_[_0x39c7('0x2c')](this['channel'])+'AccountId']=this[_0x39c7('0x2b')]['id'];}_0x81c7a5[_[_0x39c7('0x2c')](this[_0x39c7('0xe')])+_0x39c7('0x2d')]=this[_0x39c7('0x16')]['id'];var _0x191e78=this[_0x39c7('0x16')];if(rpc[this[_0x39c7('0xe')]+_0x39c7('0x2e')]){if(this[_0x39c7('0xe')]===_0x39c7('0xf')){_0x81c7a5[_0x39c7('0x2f')]=this[_0x39c7('0x21')][_0x39c7('0x30')];_0x81c7a5[_0x39c7('0x31')]=_0x39c7('0x32')+_[_0x39c7('0x33')](_0x81c7a5[_0x39c7('0x10')],_0x39c7('0x34'),_0x39c7('0x35'))+_0x39c7('0x36');_0x81c7a5[_0x39c7('0x37')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x39c7('0x38'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x39c7('0x2b')][_0x39c7('0x39')],_0x81c7a5)[_0x39c7('0x3a')](function(_0x4e3b5a){logger['info'](_0x39c7('0x3b'),_0x42e30c);_0x81c7a5[_0x39c7('0x30')]=_0x4e3b5a['message'][_0x39c7('0x30')];return rpc[_0x161dac+_0x39c7('0x2e')]['create'](_0x81c7a5);})['then'](function(_0x40bd7d){logger[_0x39c7('0x12')](_0x39c7('0x17'),_0x42e30c,JSON[_0x39c7('0x3c')](_0x40bd7d));})[_0x39c7('0x3d')](function(_0x56397f){logger['error'](_0x39c7('0x3e'),_0x42e30c,JSON[_0x39c7('0x3c')](_0x56397f));})['finally'](function(){Promise[_0x39c7('0x3f')]()[_0x39c7('0x3a')](function(){if(_0x158f71[0x0]!=='2'||_0x191e78['autoreplyExecuted'])return;return rpc[_0x161dac+_0x39c7('0x40')]['update'](_0x191e78['id'],{'autoreplyExecuted':!![]})[_0x39c7('0x3a')](function(_0x1b9da3){logger['info'](_0x39c7('0x1b'),_0x42e30c,JSON['stringify'](_0x1b9da3));})[_0x39c7('0x3d')](function(_0x50953e){logger[_0x39c7('0x41')](_0x39c7('0x42'),_0x42e30c,JSON[_0x39c7('0x3c')](_0x50953e));});})['then'](function(){_0x37e018[_0x39c7('0x19')]();});});}else{return rpc[this['channel']+_0x39c7('0x2e')][_0x39c7('0x43')](_0x81c7a5)[_0x39c7('0x3a')](function(){logger['info'](_0x39c7('0x17'),_0x42e30c,_0x81c7a5[_0x39c7('0x10')]);})['catch'](function(_0xadf516){logger['error'](_0x39c7('0x17'),_0x42e30c,JSON[_0x39c7('0x3c')](_0xadf516));})[_0x39c7('0x44')](function(){Promise[_0x39c7('0x3f')]()[_0x39c7('0x3a')](function(){if(_0x158f71[0x0]!=='2'||_0x191e78[_0x39c7('0x1a')])return;return rpc[_0x161dac+_0x39c7('0x40')][_0x39c7('0x45')](_0x191e78['id'],{'autoreplyExecuted':!![]})['then'](function(_0x39fd8f){logger['info'](_0x39c7('0x1b'),_0x42e30c,JSON[_0x39c7('0x3c')](_0x39fd8f));})[_0x39c7('0x3d')](function(_0x6b47b1){logger[_0x39c7('0x41')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x42e30c,JSON[_0x39c7('0x3c')](_0x6b47b1));});})[_0x39c7('0x3a')](function(){_0x37e018[_0x39c7('0x19')]();});});}}}catch(_0x477a21){logger['error'](_0x39c7('0x17'),_0x42e30c,JSON['stringify'](_0x477a21));_0x37e018[_0x39c7('0x46')]();}};}; \ No newline at end of file +var _0xd945=['account','upperFirst','AccountId','InteractionId','messageId','html','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','catch','error','Message','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','isNil','created','interaction','info','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId'];(function(_0x101b3f,_0x4634d3){var _0x415df2=function(_0x3fa8cd){while(--_0x3fa8cd){_0x101b3f['push'](_0x101b3f['shift']());}};_0x415df2(++_0x4634d3);}(_0xd945,0x181));var _0x5d94=function(_0x275ad0,_0x57c5cb){_0x275ad0=_0x275ad0-0x0;var _0x1c0340=_0xd945[_0x275ad0];return _0x1c0340;};'use strict';var _=require(_0x5d94('0x0'));var moment=require(_0x5d94('0x1'));var utils=require('./utils');var logger=require(_0x5d94('0x2'))(_0x5d94('0x3'));var rpc={'chatMessage':require(_0x5d94('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5d94('0x5')),'smsMessage':require(_0x5d94('0x6')),'faxMessage':require(_0x5d94('0x7')),'whatsappMessage':require(_0x5d94('0x8')),'chatInteraction':require(_0x5d94('0x9')),'openchannelInteraction':require(_0x5d94('0xa')),'mailInteraction':require(_0x5d94('0xb')),'smsInteraction':require(_0x5d94('0xc')),'faxInteraction':require(_0x5d94('0xd')),'whatsappInteraction':require(_0x5d94('0xe'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0xebe27d,_0x4816f7,_0x379ac9,_0x380df3){return function(_0x17bad0){try{var _0x5cd844=this['channel'];if(_0x5cd844===_0x5d94('0xf')&&_0x380df3[_0x5d94('0x10')][_0x5d94('0x11')]){logger['info'](_0x5d94('0x12'),_0xebe27d,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x17bad0[_0x5d94('0x13')]();}if(_0x4816f7[0x0]==='1'&&(_[_0x5d94('0x14')](this['interaction'][_0x5d94('0x15')])||!this[_0x5d94('0x16')][_0x5d94('0x15')])){logger[_0x5d94('0x17')]('[%s][AUTOREPLY]\x20%s',_0xebe27d,_0x5d94('0x18'));return _0x17bad0['next']();}if(_0x4816f7[0x0]==='2'&&this[_0x5d94('0x16')]['autoreplyExecuted']){logger[_0x5d94('0x17')](_0x5d94('0x19'),_0xebe27d,_0x5d94('0x1a'));return _0x17bad0[_0x5d94('0x13')]();}var _0x4a1d8e={'ContactId':this[_0x5d94('0x1b')]['id'],'sentAt':moment()[_0x5d94('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5d94('0x1d')};if(this[_0x5d94('0x1e')]===_0x5d94('0xf')){_0x4a1d8e[_0x5d94('0x10')]=utils['getMustacheRender'](_0x4816f7[0x2],this);}else{_0x4a1d8e['body']=utils[_0x5d94('0x1f')](_0x4816f7[0x1],this);}if(this[_0x5d94('0x20')]){_0x4a1d8e['to']=this[_0x5d94('0x20')][_0x5d94('0x21')]||'';if(this[_0x5d94('0x1e')]===_0x5d94('0xf')&&_0x4816f7[0x1]==='1'){_0x4a1d8e['cc']=this[_0x5d94('0x20')]['cc']||'';}_0x4a1d8e[_0x5d94('0x21')]=this[_0x5d94('0x20')]['to']||'';_0x4a1d8e['phone']=this[_0x5d94('0x20')][_0x5d94('0x22')]||'';_0x4a1d8e[_0x5d94('0x23')]=!![];if(this[_0x5d94('0x20')]['subject']){_0x4a1d8e[_0x5d94('0x24')]='';_0x4a1d8e[_0x5d94('0x24')]+=_[_0x5d94('0x25')](this['message'][_0x5d94('0x24')],_0x5d94('0x26'))?'':'Re:\x20';_0x4a1d8e[_0x5d94('0x24')]+=this[_0x5d94('0x20')][_0x5d94('0x24')];}}if(this[_0x5d94('0x1e')]===_0x5d94('0x27')){_0x4a1d8e[_0x5d94('0x28')]=this[_0x5d94('0x29')]['id'];}else{_0x4a1d8e[_[_0x5d94('0x2a')](this[_0x5d94('0x1e')])+_0x5d94('0x2b')]=this[_0x5d94('0x29')]['id'];}_0x4a1d8e[_['upperFirst'](this['channel'])+_0x5d94('0x2c')]=this[_0x5d94('0x16')]['id'];var _0x2661fb=this[_0x5d94('0x16')];if(rpc[this[_0x5d94('0x1e')]+'Message']){if(this[_0x5d94('0x1e')]===_0x5d94('0xf')){_0x4a1d8e['inReplyTo']=this[_0x5d94('0x20')][_0x5d94('0x2d')];_0x4a1d8e[_0x5d94('0x2e')]=''+_[_0x5d94('0x2f')](_0x4a1d8e[_0x5d94('0x10')],_0x5d94('0x30'),_0x5d94('0x31'))+_0x5d94('0x32');_0x4a1d8e[_0x5d94('0x33')]={'Auto-Submitted':_0x5d94('0x34'),'X-Auto-Response-Suppress':_0x5d94('0x35'),'Precedence':_0x5d94('0x36')};return mailRpc[_0x5d94('0x37')](this[_0x5d94('0x29')][_0x5d94('0x38')],_0x4a1d8e)[_0x5d94('0x39')](function(_0x31aaec){logger[_0x5d94('0x17')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xebe27d);_0x4a1d8e[_0x5d94('0x2d')]=_0x31aaec[_0x5d94('0x20')][_0x5d94('0x2d')];return rpc[_0x5cd844+'Message'][_0x5d94('0x3a')](_0x4a1d8e);})[_0x5d94('0x39')](function(_0x200c31){logger[_0x5d94('0x17')]('[%s][AUTOREPLY]\x20%s',_0xebe27d,JSON[_0x5d94('0x3b')](_0x200c31));})['catch'](function(_0x103dca){logger['error'](_0x5d94('0x3c'),_0xebe27d,JSON[_0x5d94('0x3b')](_0x103dca));})[_0x5d94('0x3d')](function(){Promise[_0x5d94('0x3e')]()['then'](function(){if(_0x4816f7[0x0]!=='2'||_0x2661fb[_0x5d94('0x3f')])return;return rpc[_0x5cd844+_0x5d94('0x40')][_0x5d94('0x41')](_0x2661fb['id'],{'autoreplyExecuted':!![]})[_0x5d94('0x39')](function(_0x3f55a4){logger[_0x5d94('0x17')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xebe27d,JSON[_0x5d94('0x3b')](_0x3f55a4));})[_0x5d94('0x42')](function(_0x32b083){logger[_0x5d94('0x43')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xebe27d,JSON[_0x5d94('0x3b')](_0x32b083));});})[_0x5d94('0x39')](function(){_0x17bad0['next']();});});}else{return rpc[this[_0x5d94('0x1e')]+_0x5d94('0x44')][_0x5d94('0x3a')](_0x4a1d8e)[_0x5d94('0x39')](function(){logger[_0x5d94('0x17')]('[%s][AUTOREPLY]\x20%s',_0xebe27d,_0x4a1d8e[_0x5d94('0x10')]);})['catch'](function(_0x475770){logger[_0x5d94('0x43')](_0x5d94('0x12'),_0xebe27d,JSON[_0x5d94('0x3b')](_0x475770));})[_0x5d94('0x3d')](function(){Promise[_0x5d94('0x3e')]()[_0x5d94('0x39')](function(){if(_0x4816f7[0x0]!=='2'||_0x2661fb[_0x5d94('0x3f')])return;return rpc[_0x5cd844+_0x5d94('0x40')][_0x5d94('0x41')](_0x2661fb['id'],{'autoreplyExecuted':!![]})[_0x5d94('0x39')](function(_0x4a4201){logger[_0x5d94('0x17')](_0x5d94('0x19'),_0xebe27d,JSON[_0x5d94('0x3b')](_0x4a4201));})[_0x5d94('0x42')](function(_0x41a323){logger[_0x5d94('0x43')](_0x5d94('0x45'),_0xebe27d,JSON[_0x5d94('0x3b')](_0x41a323));});})[_0x5d94('0x39')](function(){_0x17bad0[_0x5d94('0x13')]();});});}}}catch(_0x31b7f9){logger[_0x5d94('0x43')]('[%s][AUTOREPLY]\x20%s',_0xebe27d,JSON[_0x5d94('0x3b')](_0x31b7f9));_0x17bad0[_0x5d94('0x46')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 9306998..ac5ef96 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc8=['then','error','stringify','finally','stop','[%s][CLOSE]\x20%s','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','update','interaction'];(function(_0x46ba37,_0x21456a){var _0x4015b7=function(_0x279c11){while(--_0x279c11){_0x46ba37['push'](_0x46ba37['shift']());}};_0x4015b7(++_0x21456a);}(_0x4fc8,0xa8));var _0x84fc=function(_0x22c11c,_0x3ffba6){_0x22c11c=_0x22c11c-0x0;var _0x45a090=_0x4fc8[_0x22c11c];return _0x45a090;};'use strict';var moment=require('moment');var logger=require(_0x84fc('0x0'))('routing');var rpc={'chatInteraction':require(_0x84fc('0x1')),'openchannelInteraction':require(_0x84fc('0x2')),'smsInteraction':require(_0x84fc('0x3')),'mailInteraction':require(_0x84fc('0x4')),'faxInteraction':require(_0x84fc('0x5')),'whatsappInteraction':require(_0x84fc('0x6'))};exports[_0x84fc('0x7')]=function(_0x12a4f9,_0xc440b7,_0x371fb1,_0x3de28e){return function(_0x1d04bc){try{logger[_0x84fc('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x12a4f9,_0xc440b7[0x0]);var _0x7405a2={'closed':0x1,'closedAt':moment()[_0x84fc('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0xc440b7[0x0]};if(rpc[_0x3de28e['channel']+'Interaction']){rpc[_0x3de28e['channel']+'Interaction'][_0x84fc('0xa')](_0x3de28e[_0x84fc('0xb')]['id'],_0x7405a2)[_0x84fc('0xc')](function(_0x524a8a){logger[_0x84fc('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x12a4f9,_0x3de28e[_0x84fc('0xb')]['id']);})['catch'](function(_0x2da0b1){logger[_0x84fc('0xd')]('[%s][CLOSE]\x20%s',_0x12a4f9,JSON[_0x84fc('0xe')](_0x2da0b1));})[_0x84fc('0xf')](function(){_0x1d04bc[_0x84fc('0x10')]();});}}catch(_0x41bca9){logger[_0x84fc('0xd')](_0x84fc('0x11'),_0x12a4f9,JSON[_0x84fc('0xe')](_0x41bca9));_0x1d04bc[_0x84fc('0x10')]();}};}; \ No newline at end of file +var _0x717a=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x534300,_0x565b8a){var _0x4d281a=function(_0x2e4270){while(--_0x2e4270){_0x534300['push'](_0x534300['shift']());}};_0x4d281a(++_0x565b8a);}(_0x717a,0xb8));var _0xa717=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0x717a[_0x3815c2];return _0x271f88;};'use strict';var moment=require(_0xa717('0x0'));var logger=require(_0xa717('0x1'))(_0xa717('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xa717('0x3')),'smsInteraction':require(_0xa717('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xa717('0x5')),'whatsappInteraction':require(_0xa717('0x6'))};exports['consequence']=function(_0xb66550,_0x51afd0,_0x71b7f9,_0x42aa12){return function(_0x504da0){try{logger[_0xa717('0x7')](_0xa717('0x8'),_0xb66550,_0x51afd0[0x0]);var _0x506ea1={'closed':0x1,'closedAt':moment()['format'](_0xa717('0x9')),'closeReason':_0xa717('0xa'),'disposition':_0x51afd0[0x0]};if(rpc[_0x42aa12[_0xa717('0xb')]+_0xa717('0xc')]){rpc[_0x42aa12[_0xa717('0xb')]+'Interaction']['update'](_0x42aa12['interaction']['id'],_0x506ea1)[_0xa717('0xd')](function(_0x22489e){logger[_0xa717('0x7')](_0xa717('0xe'),_0xb66550,_0x42aa12[_0xa717('0xf')]['id']);})['catch'](function(_0x437c76){logger['error'](_0xa717('0x10'),_0xb66550,JSON[_0xa717('0x11')](_0x437c76));})[_0xa717('0x12')](function(){_0x504da0[_0xa717('0x13')]();});}}catch(_0x3914b7){logger[_0xa717('0x14')](_0xa717('0x10'),_0xb66550,JSON[_0xa717('0x11')](_0x3914b7));_0x504da0[_0xa717('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 3338c66..9197adb 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x018c=['AccountId','InteractionId','created','isEmpty','body','getMustacheRender','then','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','providerName','providerResponse','stringify','create','catch','lodash','moment','apiai-promise','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x018c,0xda));var _0xc018=function(_0x1d88ce,_0x1d3f8e){_0x1d88ce=_0x1d88ce-0x0;var _0x16086b=_0x018c[_0x1d88ce];return _0x16086b;};'use strict';var _=require(_0xc018('0x0'));var moment=require(_0xc018('0x1'));var apiai=require(_0xc018('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0xc018('0x3'))('routing');var rpc={'chatMessage':require(_0xc018('0x4')),'openchannelMessage':require(_0xc018('0x5')),'mailMessage':require(_0xc018('0x6')),'smsMessage':require(_0xc018('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc018('0x8'))};exports[_0xc018('0x9')]=function(_0x46f194,_0x4762ab){return function(_0x29a572){try{if(!_[_0xc018('0xa')](this[_0xc018('0xb')][_0xc018('0xc')])){logger[_0xc018('0xd')](_0xc018('0xe'),_0x46f194,_0xc018('0xf'));return _0x29a572[_0xc018('0x10')]();}var _0x3c135b={'ContactId':this[_0xc018('0x11')]['id'],'sentAt':moment()[_0xc018('0x12')](_0xc018('0x13')),'direction':_0xc018('0x14')};if(this[_0xc018('0x15')]==='sms'||this[_0xc018('0x15')]==='whatsapp'){_0x3c135b[_0xc018('0x16')]=this[_0xc018('0xb')][_0xc018('0x16')];}var _0x36b436=this[_0xc018('0x15')];if(_0x36b436===_0xc018('0x17')){_0x3c135b[_0xc018('0x18')]=this[_0xc018('0x19')]['id'];}else{_0x3c135b[_[_0xc018('0x1a')](_0x36b436)+_0xc018('0x1b')]=this[_0xc018('0x19')]['id'];}_0x3c135b[_['upperFirst'](_0x36b436)+_0xc018('0x1c')]=this[_0xc018('0xb')]['id'];if(this[_0xc018('0xb')][_0xc018('0x1d')]){var _0x70a0fd=_0x4762ab[0x2];if(!_[_0xc018('0x1e')](_0x70a0fd)){_0x3c135b[_0xc018('0x1f')]=utils[_0xc018('0x20')](_0x70a0fd,this);return rpc[_0x36b436+'Message']['create'](_0x3c135b)[_0xc018('0x21')](function(_0x4e388e){logger[_0xc018('0xd')](_0xc018('0xe'),_0x46f194,_0x3c135b[_0xc018('0x1f')]);})['catch'](function(_0x423d21){logger[_0xc018('0x22')](_0xc018('0xe'),_0x46f194,JSON['stringify'](_0x423d21));})[_0xc018('0x23')](function(){logger[_0xc018('0xd')](_0xc018('0x24'),_0x46f194);_0x29a572[_0xc018('0x25')]();});}else{logger[_0xc018('0xd')](_0xc018('0x26'),_0x46f194);_0x29a572[_0xc018('0x25')]();}}else{var _0xfbbc65=this;var _0x991e64=apiai(_0x4762ab[0x0],{'language':_0x4762ab[0x1]||'en'});return _0x991e64[_0xc018('0x27')](this[_0xc018('0x28')][_0xc018('0x1f')],{'sessionId':md5(this[_0xc018('0xb')]['id'])})[_0xc018('0x21')](function(_0x41b7da){_0xfbbc65[_0xc018('0x1f')][_0xc018('0x29')]=_0x41b7da;_0x3c135b[_0xc018('0x1f')]=_0x41b7da[_0xc018('0x2a')][_0xc018('0x2b')]['speech'];_0x3c135b[_0xc018('0x2c')]=_0xc018('0x29');_0x3c135b[_0xc018('0x2d')]=JSON[_0xc018('0x2e')](_0x41b7da);return rpc[_0x36b436+'Message'][_0xc018('0x2f')](_0x3c135b)[_0xc018('0x21')](function(_0x2dc832){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x46f194,_0x3c135b[_0xc018('0x1f')]);if(_0x41b7da[_0xc018('0x2a')]['metadata']['endConversation']){_0x29a572[_0xc018('0x10')]();}else{_0x29a572[_0xc018('0x25')]();}})[_0xc018('0x30')](function(_0x5092a3){logger[_0xc018('0x22')](_0xc018('0xe'),_0x46f194,JSON[_0xc018('0x2e')](_0x5092a3));_0x29a572[_0xc018('0x10')]();});})[_0xc018('0x30')](function(_0x34fdf4){logger[_0xc018('0x22')](_0xc018('0xe'),_0x46f194,_0x34fdf4[_0xc018('0x28')]);_0x29a572[_0xc018('0x10')]();});}}catch(_0x52d076){logger[_0xc018('0x22')](_0xc018('0xe'),_0x46f194,JSON[_0xc018('0x2e')](_0x52d076));_0x29a572['stop']();}};}; \ No newline at end of file +var _0xdedd=['interaction','chat','account','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','fulfillment','speech','providerName','providerResponse','result','metadata','endConversation','message','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone'];(function(_0x55a28f,_0x235a03){var _0x32e87a=function(_0x41fbcc){while(--_0x41fbcc){_0x55a28f['push'](_0x55a28f['shift']());}};_0x32e87a(++_0x235a03);}(_0xdedd,0x197));var _0xdded=function(_0x36d504,_0x20c851){_0x36d504=_0x36d504-0x0;var _0x1b3432=_0xdedd[_0x36d504];return _0x1b3432;};'use strict';var _=require(_0xdded('0x0'));var moment=require(_0xdded('0x1'));var apiai=require(_0xdded('0x2'));var md5=require(_0xdded('0x3'));var utils=require(_0xdded('0x4'));var logger=require('../../../../config/logger')(_0xdded('0x5'));var rpc={'chatMessage':require(_0xdded('0x6')),'openchannelMessage':require(_0xdded('0x7')),'mailMessage':require(_0xdded('0x8')),'smsMessage':require(_0xdded('0x9')),'faxMessage':require(_0xdded('0xa')),'whatsappMessage':require(_0xdded('0xb'))};exports[_0xdded('0xc')]=function(_0x59aa13,_0x5a43e7){return function(_0x558cff){try{if(!_[_0xdded('0xd')](this['interaction']['UserId'])){logger[_0xdded('0xe')](_0xdded('0xf'),_0x59aa13,_0xdded('0x10'));return _0x558cff[_0xdded('0x11')]();}var _0x4e53bb={'ContactId':this[_0xdded('0x12')]['id'],'sentAt':moment()['format'](_0xdded('0x13')),'direction':_0xdded('0x14')};if(this[_0xdded('0x15')]===_0xdded('0x16')||this[_0xdded('0x15')]===_0xdded('0x17')){_0x4e53bb[_0xdded('0x18')]=this[_0xdded('0x19')][_0xdded('0x18')];}var _0x5b3bd5=this[_0xdded('0x15')];if(_0x5b3bd5===_0xdded('0x1a')){_0x4e53bb['ChatWebsiteId']=this[_0xdded('0x1b')]['id'];}else{_0x4e53bb[_['upperFirst'](_0x5b3bd5)+_0xdded('0x1c')]=this['account']['id'];}_0x4e53bb[_[_0xdded('0x1d')](_0x5b3bd5)+_0xdded('0x1e')]=this[_0xdded('0x19')]['id'];if(this['interaction'][_0xdded('0x1f')]){var _0xfb3f67=_0x5a43e7[0x2];if(!_[_0xdded('0x20')](_0xfb3f67)){_0x4e53bb[_0xdded('0x21')]=utils[_0xdded('0x22')](_0xfb3f67,this);return rpc[_0x5b3bd5+_0xdded('0x23')][_0xdded('0x24')](_0x4e53bb)[_0xdded('0x25')](function(_0x4f249e){logger[_0xdded('0xe')](_0xdded('0xf'),_0x59aa13,_0x4e53bb[_0xdded('0x21')]);})[_0xdded('0x26')](function(_0x20b2e5){logger[_0xdded('0x27')](_0xdded('0xf'),_0x59aa13,JSON[_0xdded('0x28')](_0x20b2e5));})[_0xdded('0x29')](function(){logger[_0xdded('0xe')](_0xdded('0x2a'),_0x59aa13);_0x558cff[_0xdded('0x2b')]();});}else{logger[_0xdded('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x59aa13);_0x558cff[_0xdded('0x2b')]();}}else{var _0x4db31b=this;var _0x233776=apiai(_0x5a43e7[0x0],{'language':_0x5a43e7[0x1]||'en'});return _0x233776[_0xdded('0x2c')](this['message'][_0xdded('0x21')],{'sessionId':md5(this['interaction']['id'])})[_0xdded('0x25')](function(_0x1c1473){_0x4db31b[_0xdded('0x21')][_0xdded('0x2d')]=_0x1c1473;_0x4e53bb[_0xdded('0x21')]=_0x1c1473['result'][_0xdded('0x2e')][_0xdded('0x2f')];_0x4e53bb[_0xdded('0x30')]=_0xdded('0x2d');_0x4e53bb[_0xdded('0x31')]=JSON['stringify'](_0x1c1473);return rpc[_0x5b3bd5+'Message'][_0xdded('0x24')](_0x4e53bb)[_0xdded('0x25')](function(_0xfb0379){logger[_0xdded('0xe')](_0xdded('0xf'),_0x59aa13,_0x4e53bb['body']);if(_0x1c1473[_0xdded('0x32')][_0xdded('0x33')][_0xdded('0x34')]){_0x558cff[_0xdded('0x11')]();}else{_0x558cff['stop']();}})[_0xdded('0x26')](function(_0x5f3637){logger[_0xdded('0x27')](_0xdded('0xf'),_0x59aa13,JSON[_0xdded('0x28')](_0x5f3637));_0x558cff[_0xdded('0x11')]();});})[_0xdded('0x26')](function(_0x3459c7){logger[_0xdded('0x27')]('[%s][DIALOGFLOW]\x20%s',_0x59aa13,_0x3459c7[_0xdded('0x35')]);_0x558cff[_0xdded('0x11')]();});}}catch(_0x553860){logger[_0xdded('0x27')](_0xdded('0xf'),_0x59aa13,JSON['stringify'](_0x553860));_0x558cff['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 2b5666f..34a8fcc 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc62=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','queryResult','fields','diagnosticInfo','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','account','upperFirst','AccountId','isEmpty','getMustacheRender','create','then','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x376f9c,_0xa88651){var _0xff0f35=function(_0x6afb21){while(--_0x6afb21){_0x376f9c['push'](_0x376f9c['shift']());}};_0xff0f35(++_0xa88651);}(_0xbc62,0xb0));var _0x2bc6=function(_0x3a4481,_0x1ce87d){_0x3a4481=_0x3a4481-0x0;var _0x594d0e=_0xbc62[_0x3a4481];return _0x594d0e;};'use strict';var _=require(_0x2bc6('0x0'));var dialogflow=require(_0x2bc6('0x1'));var md5=require(_0x2bc6('0x2'));var moment=require(_0x2bc6('0x3'));var Promise=require(_0x2bc6('0x4'));var logger=require(_0x2bc6('0x5'))('routing');var utils=require(_0x2bc6('0x6'));var rpc={'chatMessage':require(_0x2bc6('0x7')),'openchannelMessage':require(_0x2bc6('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2bc6('0x9')),'faxMessage':require(_0x2bc6('0xa')),'whatsappMessage':require(_0x2bc6('0xb'))};function createMessage(_0x430a90,_0x3c985e,_0x240106,_0x2f2bb3){return new Promise(function(_0x5efeee,_0xc55852){var _0xa6670=_[_0x2bc6('0xc')](_0x240106);_0xa6670[_0x2bc6('0xd')]=_0x2f2bb3;return rpc[_0x3c985e+_0x2bc6('0xe')]['create'](_0xa6670)['then'](function(){logger[_0x2bc6('0xf')](_0x2bc6('0x10'),_0x430a90,_0xa6670['body']);_0x5efeee();})['catch'](function(_0x574550){logger[_0x2bc6('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x430a90,JSON[_0x2bc6('0x12')](_0x574550));_0xc55852(_0x574550);});});}exports[_0x2bc6('0x13')]=function(_0x31c4f9,_0x267fe6){return function(_0x5ead00){try{if(!_[_0x2bc6('0x14')](this[_0x2bc6('0x15')][_0x2bc6('0x16')])){logger[_0x2bc6('0xf')](_0x2bc6('0x10'),_0x31c4f9,_0x2bc6('0x17'));return _0x5ead00[_0x2bc6('0x18')]();}var _0x517124={'ContactId':this[_0x2bc6('0x19')]['id'],'sentAt':moment()[_0x2bc6('0x1a')](_0x2bc6('0x1b')),'direction':_0x2bc6('0x1c')};if(this[_0x2bc6('0x1d')]==='sms'||this[_0x2bc6('0x1d')]===_0x2bc6('0x1e')){_0x517124[_0x2bc6('0x1f')]=this[_0x2bc6('0x15')][_0x2bc6('0x1f')];}var _0x292f4c=this[_0x2bc6('0x1d')];if(_0x292f4c==='chat'){_0x517124['ChatWebsiteId']=this[_0x2bc6('0x20')]['id'];}else{_0x517124[_[_0x2bc6('0x21')](_0x292f4c)+_0x2bc6('0x22')]=this[_0x2bc6('0x20')]['id'];}_0x517124[_['upperFirst'](_0x292f4c)+'InteractionId']=this[_0x2bc6('0x15')]['id'];if(this[_0x2bc6('0x15')]['created']){var _0x42e7a2=_0x267fe6[0x4];if(!_[_0x2bc6('0x23')](_0x42e7a2)){_0x517124['body']=utils[_0x2bc6('0x24')](_0x42e7a2,this);return rpc[_0x292f4c+_0x2bc6('0xe')][_0x2bc6('0x25')](_0x517124)[_0x2bc6('0x26')](function(_0x435c77){logger[_0x2bc6('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x31c4f9,_0x517124[_0x2bc6('0xd')]);})[_0x2bc6('0x27')](function(_0x2059d7){logger[_0x2bc6('0x11')](_0x2bc6('0x10'),_0x31c4f9,JSON[_0x2bc6('0x12')](_0x2059d7));})[_0x2bc6('0x28')](function(){logger[_0x2bc6('0xf')](_0x2bc6('0x29'),_0x31c4f9);_0x5ead00[_0x2bc6('0x2a')]();});}else{logger[_0x2bc6('0xf')](_0x2bc6('0x2b'),_0x31c4f9);_0x5ead00[_0x2bc6('0x2a')]();}}else{var _0x174cec=this;var _0x4c2a6f=_0x267fe6[0x2][_0x2bc6('0x2c')](/\\n/g,'\x0a');var _0x957b9={'credentials':{'private_key':_0x4c2a6f,'client_email':_0x267fe6[0x1]}};var _0x5b7dec=new dialogflow[(_0x2bc6('0x2d'))](_0x957b9);var _0x20bddd=_0x5b7dec['sessionPath'](_0x267fe6[0x0],md5(_0x174cec[_0x2bc6('0x15')]['id']));var _0x15e9a6={'session':_0x20bddd,'queryInput':{'text':{'text':_0x174cec[_0x2bc6('0x2e')][_0x2bc6('0xd')],'languageCode':_0x267fe6[0x3]||'en'}}};return _0x5b7dec[_0x2bc6('0x2f')](_0x15e9a6)[_0x2bc6('0x26')](function(_0x214666){if(_0x214666&&_0x214666[_0x2bc6('0x30')]){_0x174cec['body']['dialogflowV2']=_0x214666;var _0x3bd6ab=_0x214666[0x0];var _0x58dc59=_0x3bd6ab['queryResult']['diagnosticInfo']&&_0x3bd6ab[_0x2bc6('0x31')]['diagnosticInfo'][_0x2bc6('0x32')]?_0x3bd6ab[_0x2bc6('0x31')][_0x2bc6('0x33')][_0x2bc6('0x32')]['end_conversation'][_0x2bc6('0x34')]:![];_0x174cec[_0x2bc6('0xd')]['DIALOGFLOWV2_ACTION']=_0x3bd6ab[_0x2bc6('0x31')][_0x2bc6('0x35')];_0x174cec[_0x2bc6('0xd')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x3bd6ab['queryResult'][_0x2bc6('0x36')];_0x174cec[_0x2bc6('0xd')][_0x2bc6('0x37')]=_0x3bd6ab[_0x2bc6('0x31')][_0x2bc6('0x33')]&&_0x3bd6ab['queryResult'][_0x2bc6('0x33')][_0x2bc6('0x32')]?_0x3bd6ab[_0x2bc6('0x31')][_0x2bc6('0x33')][_0x2bc6('0x32')][_0x2bc6('0x38')][_0x2bc6('0x34')]:![];_0x174cec['body'][_0x2bc6('0x39')]=_0x3bd6ab[_0x2bc6('0x31')]['intent'][_0x2bc6('0x3a')];_0x174cec[_0x2bc6('0xd')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3bd6ab[_0x2bc6('0x31')]['intent']['displayName'];_0x174cec[_0x2bc6('0xd')][_0x2bc6('0x3b')]=_0x3bd6ab[_0x2bc6('0x31')][_0x2bc6('0x3c')][_0x2bc6('0x3d')];_0x174cec[_0x2bc6('0xd')][_0x2bc6('0x3e')]=_0x3bd6ab[_0x2bc6('0x31')][_0x2bc6('0x3f')];_0x174cec['body']['DIALOGFLOWV2_QUERYTEXT']=_0x3bd6ab[_0x2bc6('0x31')][_0x2bc6('0x40')];_0x174cec['body'][_0x2bc6('0x41')]=_0x3bd6ab[_0x2bc6('0x31')][_0x2bc6('0x42')];_0x517124[_0x2bc6('0x43')]=_0x2bc6('0x44');_0x517124[_0x2bc6('0x45')]=JSON[_0x2bc6('0x12')](_0x214666);var _0x121fb5=[];for(var _0x196eef=0x0;_0x196eef<_0x214666[_0x2bc6('0x30')];_0x196eef++){var _0x10b278=_0x214666[_0x196eef];if(_0x10b278&&_0x10b278[_0x2bc6('0x31')]&&_0x10b278[_0x2bc6('0x31')][_0x2bc6('0x46')]){_0x121fb5[_0x2bc6('0x47')](createMessage(_0x31c4f9,_0x292f4c,_0x517124,_0x10b278[_0x2bc6('0x31')][_0x2bc6('0x46')]));}}return Promise[_0x2bc6('0x48')](_0x121fb5)['then'](function(){if(_0x58dc59){_0x5ead00[_0x2bc6('0x18')]();}else{_0x5ead00[_0x2bc6('0x2a')]();}})['catch'](function(_0x5b6a8b){logger[_0x2bc6('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x31c4f9,JSON[_0x2bc6('0x12')](_0x5b6a8b));_0x5ead00[_0x2bc6('0x18')]();});}})['catch'](function(_0x31e2c1){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x31c4f9,_0x31e2c1['message'],_0x31e2c1['stack']);_0x5ead00['next']();});}}catch(_0x29a09c){logger[_0x2bc6('0x11')](_0x2bc6('0x10'),_0x31c4f9,JSON[_0x2bc6('0x12')](_0x29a09c));_0x5ead00[_0x2bc6('0x2a')]();}};}; \ No newline at end of file +var _0x9be3=['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','providerName','providerResponse','fulfillmentText','push','all','stack','md5','moment','bluebird','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','next','contact','out','channel','whatsapp','phone','chat','AccountId','account','upperFirst','created','isEmpty','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action'];(function(_0x5a8442,_0x2b3948){var _0x37b32f=function(_0x4a1e1b){while(--_0x4a1e1b){_0x5a8442['push'](_0x5a8442['shift']());}};_0x37b32f(++_0x2b3948);}(_0x9be3,0x1ed));var _0x39be=function(_0x1134fc,_0x49ee8f){_0x1134fc=_0x1134fc-0x0;var _0x53c59a=_0x9be3[_0x1134fc];return _0x53c59a;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x39be('0x0'));var moment=require(_0x39be('0x1'));var Promise=require(_0x39be('0x2'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x39be('0x3'));var rpc={'chatMessage':require(_0x39be('0x4')),'openchannelMessage':require(_0x39be('0x5')),'mailMessage':require(_0x39be('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x39be('0x7')),'whatsappMessage':require(_0x39be('0x8'))};function createMessage(_0x2e22da,_0x2345ec,_0x5d98cb,_0x11a459){return new Promise(function(_0x14bf87,_0x2f7985){var _0x5ad03b=_['clone'](_0x5d98cb);_0x5ad03b[_0x39be('0x9')]=_0x11a459;return rpc[_0x2345ec+'Message'][_0x39be('0xa')](_0x5ad03b)[_0x39be('0xb')](function(){logger[_0x39be('0xc')](_0x39be('0xd'),_0x2e22da,_0x5ad03b[_0x39be('0x9')]);_0x14bf87();})[_0x39be('0xe')](function(_0x5b4992){logger[_0x39be('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x2e22da,JSON[_0x39be('0x10')](_0x5b4992));_0x2f7985(_0x5b4992);});});}exports[_0x39be('0x11')]=function(_0x515d1d,_0x387b45){return function(_0x19e7a7){try{if(!_[_0x39be('0x12')](this[_0x39be('0x13')][_0x39be('0x14')])){logger[_0x39be('0xc')](_0x39be('0xd'),_0x515d1d,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x19e7a7[_0x39be('0x15')]();}var _0x42b401={'ContactId':this[_0x39be('0x16')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x39be('0x17')};if(this[_0x39be('0x18')]==='sms'||this[_0x39be('0x18')]===_0x39be('0x19')){_0x42b401[_0x39be('0x1a')]=this[_0x39be('0x13')]['phone'];}var _0x18d0c1=this[_0x39be('0x18')];if(_0x18d0c1===_0x39be('0x1b')){_0x42b401['ChatWebsiteId']=this['account']['id'];}else{_0x42b401[_['upperFirst'](_0x18d0c1)+_0x39be('0x1c')]=this[_0x39be('0x1d')]['id'];}_0x42b401[_[_0x39be('0x1e')](_0x18d0c1)+'InteractionId']=this['interaction']['id'];if(this[_0x39be('0x13')][_0x39be('0x1f')]){var _0x65a2ff=_0x387b45[0x4];if(!_[_0x39be('0x20')](_0x65a2ff)){_0x42b401['body']=utils[_0x39be('0x21')](_0x65a2ff,this);return rpc[_0x18d0c1+_0x39be('0x22')][_0x39be('0xa')](_0x42b401)[_0x39be('0xb')](function(_0x491bc5){logger[_0x39be('0xc')](_0x39be('0xd'),_0x515d1d,_0x42b401['body']);})['catch'](function(_0x3145d8){logger[_0x39be('0xf')](_0x39be('0xd'),_0x515d1d,JSON[_0x39be('0x10')](_0x3145d8));})[_0x39be('0x23')](function(){logger[_0x39be('0xc')](_0x39be('0x24'),_0x515d1d);_0x19e7a7[_0x39be('0x25')]();});}else{logger[_0x39be('0xc')](_0x39be('0x26'),_0x515d1d);_0x19e7a7[_0x39be('0x25')]();}}else{var _0x3c9e40=this;var _0x247597=_0x387b45[0x2][_0x39be('0x27')](/\\n/g,'\x0a');var _0x3d7cbe={'credentials':{'private_key':_0x247597,'client_email':_0x387b45[0x1]}};var _0x480db0=new dialogflow['SessionsClient'](_0x3d7cbe);var _0xfc1dd=_0x480db0[_0x39be('0x28')](_0x387b45[0x0],md5(_0x3c9e40[_0x39be('0x13')]['id']));var _0x21b8c={'session':_0xfc1dd,'queryInput':{'text':{'text':_0x3c9e40[_0x39be('0x29')]['body'],'languageCode':_0x387b45[0x3]||'en'}}};return _0x480db0[_0x39be('0x2a')](_0x21b8c)[_0x39be('0xb')](function(_0x3d91f9){if(_0x3d91f9&&_0x3d91f9[_0x39be('0x2b')]){_0x3c9e40['body'][_0x39be('0x2c')]=_0x3d91f9;var _0x1ed43c=_0x3d91f9[0x0];var _0x229b77=_0x1ed43c[_0x39be('0x2d')][_0x39be('0x2e')]&&_0x1ed43c[_0x39be('0x2d')][_0x39be('0x2e')][_0x39be('0x2f')]?_0x1ed43c[_0x39be('0x2d')]['diagnosticInfo']['fields']['end_conversation'][_0x39be('0x30')]:![];_0x3c9e40['body'][_0x39be('0x31')]=_0x1ed43c['queryResult'][_0x39be('0x32')];_0x3c9e40[_0x39be('0x9')][_0x39be('0x33')]=_0x1ed43c[_0x39be('0x2d')][_0x39be('0x34')];_0x3c9e40[_0x39be('0x9')][_0x39be('0x35')]=_0x1ed43c[_0x39be('0x2d')][_0x39be('0x2e')]&&_0x1ed43c[_0x39be('0x2d')][_0x39be('0x2e')]['fields']?_0x1ed43c[_0x39be('0x2d')][_0x39be('0x2e')][_0x39be('0x2f')]['end_conversation'][_0x39be('0x30')]:![];_0x3c9e40[_0x39be('0x9')][_0x39be('0x36')]=_0x1ed43c[_0x39be('0x2d')][_0x39be('0x37')]['name'];_0x3c9e40[_0x39be('0x9')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1ed43c[_0x39be('0x2d')][_0x39be('0x37')][_0x39be('0x38')];_0x3c9e40[_0x39be('0x9')][_0x39be('0x39')]=_0x1ed43c[_0x39be('0x2d')][_0x39be('0x37')][_0x39be('0x3a')];_0x3c9e40[_0x39be('0x9')][_0x39be('0x3b')]=_0x1ed43c['queryResult'][_0x39be('0x3c')];_0x3c9e40[_0x39be('0x9')][_0x39be('0x3d')]=_0x1ed43c[_0x39be('0x2d')]['queryText'];_0x3c9e40[_0x39be('0x9')]['DIALOGFLOWV2_SCORE']=_0x1ed43c['queryResult']['intentDetectionConfidence'];_0x42b401[_0x39be('0x3e')]=_0x39be('0x2c');_0x42b401[_0x39be('0x3f')]=JSON[_0x39be('0x10')](_0x3d91f9);var _0x416bf6=[];for(var _0x254575=0x0;_0x254575<_0x3d91f9[_0x39be('0x2b')];_0x254575++){var _0x256ef9=_0x3d91f9[_0x254575];if(_0x256ef9&&_0x256ef9[_0x39be('0x2d')]&&_0x256ef9[_0x39be('0x2d')][_0x39be('0x40')]){_0x416bf6[_0x39be('0x41')](createMessage(_0x515d1d,_0x18d0c1,_0x42b401,_0x256ef9[_0x39be('0x2d')][_0x39be('0x40')]));}}return Promise[_0x39be('0x42')](_0x416bf6)['then'](function(){if(_0x229b77){_0x19e7a7[_0x39be('0x15')]();}else{_0x19e7a7[_0x39be('0x25')]();}})[_0x39be('0xe')](function(_0x3a901a){logger[_0x39be('0xf')](_0x39be('0xd'),_0x515d1d,JSON[_0x39be('0x10')](_0x3a901a));_0x19e7a7[_0x39be('0x15')]();});}})[_0x39be('0xe')](function(_0x40db8a){logger[_0x39be('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x515d1d,_0x40db8a[_0x39be('0x29')],_0x40db8a[_0x39be('0x43')]);_0x19e7a7[_0x39be('0x15')]();});}}catch(_0x25c3d0){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x515d1d,JSON[_0x39be('0x10')](_0x25c3d0));_0x19e7a7[_0x39be('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index c196d53..d9300aa 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3cf=['priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','number'];(function(_0x2188fa,_0x1a1ff9){var _0x32ed58=function(_0x334c52){while(--_0x334c52){_0x2188fa['push'](_0x2188fa['shift']());}};_0x32ed58(++_0x1a1ff9);}(_0xb3cf,0xe3));var _0xfb3c=function(_0x40f095,_0x5ed119){_0x40f095=_0x40f095-0x0;var _0x53c87b=_0xb3cf[_0x40f095];return _0x53c87b;};'use strict';var schema=require(_0xfb3c('0x0'));var _=require(_0xfb3c('0x1'));var htmlToText=require('html-to-text');var utils=require(_0xfb3c('0x2'));var logger=require(_0xfb3c('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xfb3c('0x4'),'message':_0xfb3c('0x5')},'priorityFalse':{'type':'number','message':_0xfb3c('0x6')}});exports[_0xfb3c('0x7')]=function(_0x255e10,_0x3f8fe2){return function(_0x182ead){try{var _0x5ba230={'condition':htmlToText[_0xfb3c('0x8')](utils[_0xfb3c('0x9')](_0x3f8fe2[0x0],this),{'wordwrap':![]})[_0xfb3c('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3f8fe2[0x1],'priorityFalse':_0x3f8fe2[0x2]};var _0x10169d=gotoif[_0xfb3c('0x0')](_0x5ba230,{'typecast':!![]});if(_0x10169d[_0xfb3c('0xb')]){logger[_0xfb3c('0xc')](_0xfb3c('0xd'),_0x255e10,_[_0xfb3c('0xe')](_0x10169d,_0xfb3c('0xf'))[_0xfb3c('0x10')](',\x20'));_0x182ead[_0xfb3c('0x11')]();}else{try{var _0x3464f5=eval('('+_0x5ba230['condition']+')');var _0x4e2124=_0x3464f5?_0x5ba230['priorityTrue']:_0x5ba230[_0xfb3c('0x12')];logger['info'](_0xfb3c('0x13'),_0x255e10,_0x5ba230[_0xfb3c('0x14')],_0x3464f5,_0x4e2124||'next');if(_0x4e2124){var _0x547866=_[_0xfb3c('0x15')](_0x182ead[_0xfb3c('0x16')](),{'p':_0x4e2124});if(_0x547866>=0x0){logger[_0xfb3c('0x17')](_0xfb3c('0x18'),_0x255e10,_0x4e2124||_0xfb3c('0x19'),_0x547866);_0x182ead['next'](_0x547866);}else{logger['info'](_0xfb3c('0x1a'),_0x255e10,_0x4e2124||_0xfb3c('0x19'));_0x182ead['stop']();}}else{_0x182ead[_0xfb3c('0x19')]();}}catch(_0x20ddc0){logger[_0xfb3c('0xc')](_0xfb3c('0x1b'),_0x255e10,_0x20ddc0[_0xfb3c('0xf')]);_0x182ead[_0xfb3c('0x11')]();}}}catch(_0x1dc766){logger[_0xfb3c('0xc')](_0xfb3c('0xd'),_0x255e10,JSON[_0xfb3c('0x1c')](_0x1dc766));_0x182ead[_0xfb3c('0x11')]();}};}; \ No newline at end of file +var _0x0abc=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','lodash','../../../../config/logger','routing','string'];(function(_0x42842c,_0x2df177){var _0x33b8e6=function(_0x3f45e7){while(--_0x3f45e7){_0x42842c['push'](_0x42842c['shift']());}};_0x33b8e6(++_0x2df177);}(_0x0abc,0xa9));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xc0ab('0x0'));var _=require(_0xc0ab('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xc0ab('0x2'))(_0xc0ab('0x3'));var gotoif=schema({'condition':{'type':_0xc0ab('0x4'),'required':!![],'message':_0xc0ab('0x5')},'priorityTrue':{'type':_0xc0ab('0x6'),'message':_0xc0ab('0x7')},'priorityFalse':{'type':_0xc0ab('0x6'),'message':_0xc0ab('0x8')}});exports['consequence']=function(_0x58491e,_0x3ed977){return function(_0x43fd7b){try{var _0x21e649={'condition':htmlToText[_0xc0ab('0x9')](utils[_0xc0ab('0xa')](_0x3ed977[0x0],this),{'wordwrap':![]})[_0xc0ab('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3ed977[0x1],'priorityFalse':_0x3ed977[0x2]};var _0x3cab61=gotoif['validate'](_0x21e649,{'typecast':!![]});if(_0x3cab61[_0xc0ab('0xc')]){logger[_0xc0ab('0xd')](_0xc0ab('0xe'),_0x58491e,_['map'](_0x3cab61,'message')[_0xc0ab('0xf')](',\x20'));_0x43fd7b['stop']();}else{try{var _0xcad136=eval('('+_0x21e649[_0xc0ab('0x10')]+')');var _0x1cebe0=_0xcad136?_0x21e649[_0xc0ab('0x11')]:_0x21e649[_0xc0ab('0x12')];logger[_0xc0ab('0x13')](_0xc0ab('0x14'),_0x58491e,_0x21e649['condition'],_0xcad136,_0x1cebe0||_0xc0ab('0x15'));if(_0x1cebe0){var _0x5cfee4=_[_0xc0ab('0x16')](_0x43fd7b[_0xc0ab('0x17')](),{'p':_0x1cebe0});if(_0x5cfee4>=0x0){logger['info'](_0xc0ab('0x18'),_0x58491e,_0x1cebe0||_0xc0ab('0x15'),_0x5cfee4);_0x43fd7b[_0xc0ab('0x15')](_0x5cfee4);}else{logger[_0xc0ab('0x13')](_0xc0ab('0x19'),_0x58491e,_0x1cebe0||_0xc0ab('0x15'));_0x43fd7b[_0xc0ab('0x1a')]();}}else{_0x43fd7b[_0xc0ab('0x15')]();}}catch(_0x27ae75){logger[_0xc0ab('0xd')](_0xc0ab('0x1b'),_0x58491e,_0x27ae75[_0xc0ab('0x1c')]);_0x43fd7b[_0xc0ab('0x1a')]();}}}catch(_0x110864){logger[_0xc0ab('0xd')](_0xc0ab('0xe'),_0x58491e,JSON['stringify'](_0x110864));_0x43fd7b[_0xc0ab('0x1a')]();}};}; \ 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 97bdda9..af9ba16 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 _0xfbd0=['findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','../../../../config/logger','number','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xfbd0,0x83));var _0x0fbd=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xfbd0[_0x5ac0f0];return _0x4aceec;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x0fbd('0x0'))('routing');var gotop=schema({'priority':{'type':_0x0fbd('0x1'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x0fbd('0x2')]=function(_0x38d22b,_0x519894){return function(_0x5812d8){try{var _0x31b6c0={'priority':_0x519894[0x0]};var _0x249df6=gotop[_0x0fbd('0x3')](_0x31b6c0,{'typecast':!![]});if(_0x249df6[_0x0fbd('0x4')]){logger[_0x0fbd('0x5')](_0x0fbd('0x6'),_0x38d22b,_[_0x0fbd('0x7')](_0x249df6,_0x0fbd('0x8'))['join'](',\x20'));_0x5812d8[_0x0fbd('0x9')]();}else{logger[_0x0fbd('0xa')](_0x0fbd('0xb'),_0x38d22b,_0x31b6c0[_0x0fbd('0xc')]);if(_0x31b6c0[_0x0fbd('0xc')]){var _0x59618d=_[_0x0fbd('0xd')](_0x5812d8['rules'](),{'p':_0x31b6c0[_0x0fbd('0xc')]});if(_0x59618d>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x38d22b,_0x31b6c0[_0x0fbd('0xc')]||'next',_0x59618d);_0x5812d8[_0x0fbd('0xe')](_0x59618d);}else{logger['info'](_0x0fbd('0xf'),_0x38d22b,_0x31b6c0[_0x0fbd('0xc')]||_0x0fbd('0xe'));_0x5812d8[_0x0fbd('0x9')]();}}else{_0x5812d8[_0x0fbd('0xe')]();}}}catch(_0x47ec8c){logger[_0x0fbd('0x5')](_0x0fbd('0x6'),_0x38d22b,JSON['stringify'](_0x47ec8c));_0x5812d8[_0x0fbd('0x9')]();}};}; \ No newline at end of file +var _0x237c=['validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','message','join','stop','priority','findIndex','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0xbd6a78,_0x4e99c2){var _0x3801f5=function(_0x5daba5){while(--_0x5daba5){_0xbd6a78['push'](_0xbd6a78['shift']());}};_0x3801f5(++_0x4e99c2);}(_0x237c,0x110));var _0xc237=function(_0x5c1544,_0xbea4c6){_0x5c1544=_0x5c1544-0x0;var _0x28e266=_0x237c[_0x5c1544];return _0x28e266;};'use strict';var schema=require(_0xc237('0x0'));var _=require(_0xc237('0x1'));var logger=require(_0xc237('0x2'))('routing');var gotop=schema({'priority':{'type':_0xc237('0x3'),'required':!![],'message':_0xc237('0x4')}});exports['consequence']=function(_0x2e7538,_0x4139bf){return function(_0x588e85){try{var _0x5d4060={'priority':_0x4139bf[0x0]};var _0x568c7d=gotop[_0xc237('0x0')](_0x5d4060,{'typecast':!![]});if(_0x568c7d[_0xc237('0x5')]){logger[_0xc237('0x6')](_0xc237('0x7'),_0x2e7538,_['map'](_0x568c7d,_0xc237('0x8'))[_0xc237('0x9')](',\x20'));_0x588e85[_0xc237('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x2e7538,_0x5d4060[_0xc237('0xb')]);if(_0x5d4060[_0xc237('0xb')]){var _0x26e6eb=_[_0xc237('0xc')](_0x588e85['rules'](),{'p':_0x5d4060[_0xc237('0xb')]});if(_0x26e6eb>=0x0){logger[_0xc237('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2e7538,_0x5d4060[_0xc237('0xb')]||_0xc237('0xe'),_0x26e6eb);_0x588e85[_0xc237('0xe')](_0x26e6eb);}else{logger['info'](_0xc237('0xf'),_0x2e7538,_0x5d4060[_0xc237('0xb')]||'next');_0x588e85[_0xc237('0xa')]();}}else{_0x588e85[_0xc237('0xe')]();}}}catch(_0x2845f5){logger['error'](_0xc237('0x7'),_0x2e7538,JSON[_0xc237('0x10')](_0x2845f5));_0x588e85[_0xc237('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 0931f92..68ba946 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 _0x11e9=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','getMustacheRender','channel'];(function(_0x6ad1fa,_0x2b2fe4){var _0x5b74db=function(_0x1fc1d0){while(--_0x1fc1d0){_0x6ad1fa['push'](_0x6ad1fa['shift']());}};_0x5b74db(++_0x2b2fe4);}(_0x11e9,0x169));var _0x911e=function(_0x4d18bd,_0x490362){_0x4d18bd=_0x4d18bd-0x0;var _0x203fda=_0x11e9[_0x4d18bd];return _0x203fda;};'use strict';var _=require('lodash');var utils=require(_0x911e('0x0'));var logger=require('../../../../config/logger')(_0x911e('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x911e('0x2')),'mailMessage':require(_0x911e('0x3')),'smsMessage':require(_0x911e('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x88e318,_0x47feaa){return function(_0x1f73e8){try{var _0x5cdea0={'body':utils[_0x911e('0x5')](_0x47feaa[0x0],this),'ContactId':this['contact']['id']};if(this[_0x911e('0x6')]===_0x911e('0x7')){_0x5cdea0[_0x911e('0x8')]=this[_0x911e('0x9')]['id'];}else{_0x5cdea0[_[_0x911e('0xa')](this[_0x911e('0x6')])+_0x911e('0xb')]=this[_0x911e('0x9')]['id'];}_0x5cdea0[_[_0x911e('0xa')](this['channel'])+_0x911e('0xc')]=this[_0x911e('0xd')]['id'];if(rpc[this['channel']+_0x911e('0xe')]){return rpc[this[_0x911e('0x6')]+'Message'][_0x911e('0xf')](_0x5cdea0)['then'](function(_0x4696db){logger[_0x911e('0x10')]('[%s][MESSAGE]\x20%s',_0x88e318,_0x5cdea0[_0x911e('0x11')]);_0x1f73e8[_0x911e('0x12')]();})[_0x911e('0x13')](function(_0x802e4d){logger['error'](_0x911e('0x14'),_0x88e318,JSON[_0x911e('0x15')](_0x802e4d));_0x1f73e8[_0x911e('0x16')]();});}}catch(_0x4b3bbf){logger['error'](_0x911e('0x14'),_0x88e318,JSON[_0x911e('0x15')](_0x4b3bbf));_0x1f73e8[_0x911e('0x16')]();}};}; \ No newline at end of file +var _0x24a9=['./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','ChatWebsiteId','upperFirst','channel','AccountId','account','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','next','catch','error','stop','stringify','lodash'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0x24a9,0xf9));var _0x924a=function(_0x29fd4b,_0x3a56c2){_0x29fd4b=_0x29fd4b-0x0;var _0x4a3d37=_0x24a9[_0x29fd4b];return _0x4a3d37;};'use strict';var _=require(_0x924a('0x0'));var utils=require(_0x924a('0x1'));var logger=require('../../../../config/logger')(_0x924a('0x2'));var rpc={'chatMessage':require(_0x924a('0x3')),'openchannelMessage':require(_0x924a('0x4')),'mailMessage':require(_0x924a('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x924a('0x6')),'whatsappMessage':require(_0x924a('0x7'))};exports[_0x924a('0x8')]=function(_0x1afa85,_0x63206c){return function(_0x497773){try{var _0x557b12={'body':utils[_0x924a('0x9')](_0x63206c[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x557b12[_0x924a('0xa')]=this['account']['id'];}else{_0x557b12[_[_0x924a('0xb')](this[_0x924a('0xc')])+_0x924a('0xd')]=this[_0x924a('0xe')]['id'];}_0x557b12[_['upperFirst'](this[_0x924a('0xc')])+_0x924a('0xf')]=this[_0x924a('0x10')]['id'];if(rpc[this[_0x924a('0xc')]+_0x924a('0x11')]){return rpc[this['channel']+_0x924a('0x11')][_0x924a('0x12')](_0x557b12)['then'](function(_0x295fbe){logger['info'](_0x924a('0x13'),_0x1afa85,_0x557b12['body']);_0x497773[_0x924a('0x14')]();})[_0x924a('0x15')](function(_0x5a5184){logger[_0x924a('0x16')](_0x924a('0x13'),_0x1afa85,JSON['stringify'](_0x5a5184));_0x497773[_0x924a('0x17')]();});}}catch(_0x894148){logger[_0x924a('0x16')](_0x924a('0x13'),_0x1afa85,JSON[_0x924a('0x18')](_0x894148));_0x497773[_0x924a('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index b39ce73..694c350 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 _0x14f1=['./utils','routing','consequence','info','[%s][NOOP]\x20%s','error'];(function(_0x24a98a,_0x4d88a1){var _0x316ad9=function(_0x34760b){while(--_0x34760b){_0x24a98a['push'](_0x24a98a['shift']());}};_0x316ad9(++_0x4d88a1);}(_0x14f1,0x90));var _0x114f=function(_0x40e358,_0x5b0273){_0x40e358=_0x40e358-0x0;var _0x3a5fb4=_0x14f1[_0x40e358];return _0x3a5fb4;};'use strict';var utils=require(_0x114f('0x0'));var logger=require('../../../../config/logger')(_0x114f('0x1'));exports[_0x114f('0x2')]=function(_0x57b829,_0x42117b){return function(_0x233cd2){try{logger[_0x114f('0x3')](_0x114f('0x4'),_0x57b829,utils['getMustacheRender'](_0x42117b[0x0],this));_0x233cd2['next']();}catch(_0x45991c){logger[_0x114f('0x5')](_0x114f('0x4'),_0x57b829,JSON['stringify'](_0x45991c));_0x233cd2['stop']();}};}; \ No newline at end of file +var _0x40c8=['info','getMustacheRender','next','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x4c7678,_0xb43f93){var _0x52bffa=function(_0x221f4d){while(--_0x221f4d){_0x4c7678['push'](_0x4c7678['shift']());}};_0x52bffa(++_0xb43f93);}(_0x40c8,0x1be));var _0x840c=function(_0x27cd71,_0x440773){_0x27cd71=_0x27cd71-0x0;var _0x536f37=_0x40c8[_0x27cd71];return _0x536f37;};'use strict';var utils=require(_0x840c('0x0'));var logger=require(_0x840c('0x1'))(_0x840c('0x2'));exports[_0x840c('0x3')]=function(_0x16340b,_0x1a1001){return function(_0x4e11a4){try{logger[_0x840c('0x4')]('[%s][NOOP]\x20%s',_0x16340b,utils[_0x840c('0x5')](_0x1a1001[0x0],this));_0x4e11a4[_0x840c('0x6')]();}catch(_0x5e083f){logger['error']('[%s][NOOP]\x20%s',_0x16340b,JSON[_0x840c('0x7')](_0x5e083f));_0x4e11a4[_0x840c('0x8')]();}};}; \ 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 43a62b4..4ee8126 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 _0x5d1a=['validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','queue_id','account','from','joinAt','emit','clone','queue','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack'];(function(_0x4bf793,_0x404922){var _0x55a44b=function(_0xbbc6c0){while(--_0xbbc6c0){_0x4bf793['push'](_0x4bf793['shift']());}};_0x55a44b(++_0x404922);}(_0x5d1a,0xae));var _0xa5d1=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0x5d1a[_0x29aefc];return _0x11be36;};'use strict';var schema=require(_0xa5d1('0x0'));var _=require(_0xa5d1('0x1'));var util=require(_0xa5d1('0x2'));var seqqueue=require(_0xa5d1('0x3'));var moment=require(_0xa5d1('0x4'));var Redis=require(_0xa5d1('0x5'));var config=require(_0xa5d1('0x6'));var logger=require(_0xa5d1('0x7'))(_0xa5d1('0x8'));var strategy=require(_0xa5d1('0x9'));config['redis']=_[_0xa5d1('0xa')](config[_0xa5d1('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa5d1('0xb')]));var attributes=['id',_0xa5d1('0xc'),_0xa5d1('0xd'),'queue',_0xa5d1('0xe'),_0xa5d1('0xf')];function emit(_0x34543c,_0x255952,_0x368a9e){io['to'](_0x34543c)[_0xa5d1('0x10')](_0x255952,_0x368a9e);}function emitChannelQueueInteraction(_0x2d614b,_0x41cdfd,_0x401a66,_0x12bf9a,_0x52aadb,_0x377aed,_0x594519,_0x5a04f4){var _0x4d53e5=_[_0xa5d1('0x11')](_0x401a66);_0x4d53e5[_0xa5d1('0xc')]=_0x5a04f4;_0x4d53e5[_0xa5d1('0x12')]=_0x41cdfd;_0x4d53e5[_0xa5d1('0xd')]=_0x12bf9a;_0x4d53e5['id']=_0x52aadb;if(_0x377aed){attributes[_0xa5d1('0x13')](_[_0xa5d1('0x14')](_0x2d614b)+_0xa5d1('0x15'));_0x594519[util[_0xa5d1('0x16')](_0xa5d1('0x17'),_0x2d614b)][_0x52aadb]=_[_0xa5d1('0x18')](_0x4d53e5,attributes);}else{delete _0x594519[util[_0xa5d1('0x16')](_0xa5d1('0x17'),_0x2d614b)][_0x52aadb];}emit(util[_0xa5d1('0x16')](_0xa5d1('0x19'),_0x2d614b,_0x41cdfd),util[_0xa5d1('0x16')](_0xa5d1('0x1a'),_0x2d614b,_0x377aed?_0xa5d1('0x1b'):_0xa5d1('0x1c')),_[_0xa5d1('0x18')](_0x4d53e5,attributes));}var rpc={'openchannelQueueReport':require(_0xa5d1('0x1d')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xa5d1('0x1e')),'smsQueueReport':require(_0xa5d1('0x1f')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0xa5d1('0x20')),'faxInteraction':require(_0xa5d1('0x21')),'mailInteraction':require(_0xa5d1('0x22')),'openchannelInteraction':require(_0xa5d1('0x23')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xa5d1('0x24'))};var queue=schema({'name':{'type':_0xa5d1('0x25'),'required':!![],'message':_0xa5d1('0x26')},'timeout':{'type':_0xa5d1('0x27'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x1c5b26,_0x14be6c,_0x581e52,_0xaacf5e){if(_0x1c5b26&&_0x14be6c&&_0x581e52){_0x14be6c[_0xa5d1('0x28')]+=0x1;var _0x4efeec={'uniqueid':_0x1c5b26,'from':_0x581e52[_0xa5d1('0x29')]?_0x581e52[_0xa5d1('0x29')][_0xa5d1('0xe')]:'','joinAt':moment()[_0xa5d1('0x16')](_0xa5d1('0x2a')),'ContactId':_0x581e52[_0xa5d1('0x2b')]?_0x581e52['contact']['id']:null,'ListId':_0x581e52[_0xa5d1('0x2c')]?_0x581e52['list']['id']:null};_0x4efeec[_[_0xa5d1('0x2d')](_0x581e52[_0xa5d1('0x2e')])+'QueueId']=_0x14be6c['id']||null;_0x4efeec[_[_0xa5d1('0x2d')](_0x581e52[_0xa5d1('0x2e')])+'InteractionId']=_0x581e52[_0xa5d1('0x2f')]?_0x581e52[_0xa5d1('0x2f')]['id']:null;_0x4efeec[_[_0xa5d1('0x2d')](_0x581e52[_0xa5d1('0x2e')])+_0xa5d1('0x30')]=_0x581e52[_0xa5d1('0x31')]?_0x581e52['message']['id']:null;_0x4efeec[_['upperFirst'](_0x581e52['channel'])+(_0x581e52[_0xa5d1('0x2e')]!==_0xa5d1('0x32')?_0xa5d1('0x33'):_0xa5d1('0x34'))]=_0x581e52[_0xa5d1('0xd')]?_0x581e52[_0xa5d1('0xd')]['id']:null;logger[_0xa5d1('0x35')](util[_0xa5d1('0x16')](_0xa5d1('0x36'),_0x1c5b26,_0x14be6c[_0xa5d1('0x37')]));emitChannelQueueInteraction(_0x581e52['channel'],_0x14be6c[_0xa5d1('0x37')],_0x4efeec,_0x581e52['account'][_0xa5d1('0x37')],_0x581e52[_0xa5d1('0x31')]['id'],!![],_0xaacf5e,_0x14be6c['id']);if(rpc[_0x581e52[_0xa5d1('0x2e')]+_0xa5d1('0x38')]){return rpc[_0x581e52[_0xa5d1('0x2e')]+_0xa5d1('0x38')]['create'](_0x4efeec)[_0xa5d1('0x39')](function(_0x42de27){logger[_0xa5d1('0x3a')]('create\x20queue\x20report',_0x42de27);});}}}function stopRouting(_0x1ebd50,_0x275979,_0x463a09,_0x38d047){if(_0x1ebd50&&_0x275979){_0x275979[_0xa5d1('0x28')]-=0x1;var _0x100e74={'leaveAt':moment()['format'](_0xa5d1('0x2a')),'acceptAt':moment()[_0xa5d1('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa5d1('0x3b')};logger[_0xa5d1('0x35')](util['format'](_0xa5d1('0x3c'),_0x1ebd50,_0x275979[_0xa5d1('0x37')]));emitChannelQueueInteraction(_0x463a09[_0xa5d1('0x2e')],_0x275979[_0xa5d1('0x37')],_0x463a09[_0xa5d1('0x29')],_0x463a09[_0xa5d1('0xd')][_0xa5d1('0x37')],_0x463a09[_0xa5d1('0x31')]['id'],![],_0x38d047,_0x275979['id']);return rpc[_0x463a09['channel']+_0xa5d1('0x3d')][_0xa5d1('0x3e')](_0x463a09['interaction']['id'],{'queueId':_0x275979['id']})['then'](function(){if(rpc[_0x463a09[_0xa5d1('0x2e')]+_0xa5d1('0x38')]){return rpc[_0x463a09[_0xa5d1('0x2e')]+_0xa5d1('0x38')]['update'](_0x1ebd50,_0x100e74)[_0xa5d1('0x39')](function(_0x5ed7ef){logger[_0xa5d1('0x3a')](_0xa5d1('0x3f'),_0x5ed7ef);});}});}}function endRouting(_0xe9b76e,_0x51c0c5,_0x18fae7,_0xccb6bc){if(_0xe9b76e&&_0x51c0c5){_0x51c0c5[_0xa5d1('0x28')]-=0x1;var _0x39dc94={'leaveAt':moment()[_0xa5d1('0x16')](_0xa5d1('0x2a')),'exitAt':moment()['format'](_0xa5d1('0x2a')),'reason':_0xa5d1('0x40')};logger['info'](util['format'](_0xa5d1('0x41'),_0xe9b76e,_0x51c0c5[_0xa5d1('0x37')]));emitChannelQueueInteraction(_0x18fae7[_0xa5d1('0x2e')],_0x51c0c5[_0xa5d1('0x37')],_0x18fae7[_0xa5d1('0x29')],_0x18fae7[_0xa5d1('0xd')][_0xa5d1('0x37')],_0x18fae7[_0xa5d1('0x31')]['id'],![],_0xccb6bc);if(rpc[_0x18fae7[_0xa5d1('0x2e')]+_0xa5d1('0x38')]){return rpc[_0x18fae7[_0xa5d1('0x2e')]+_0xa5d1('0x38')][_0xa5d1('0x3e')](_0xe9b76e,_0x39dc94)['catch'](function(_0x4cc802){logger[_0xa5d1('0x3a')](_0xa5d1('0x3f'),_0x4cc802);});}}}function handleFindQueue(_0x25d870){return function(_0x549737){return _0x549737['name'][_0xa5d1('0x42')]()===_0x25d870[_0xa5d1('0x42')]();};}exports[_0xa5d1('0x43')]=function(_0x4ee25d,_0x43621f,_0x47cc41,_0x268be2){return function(_0x1d8ddc){try{var _0x1b83fc={'name':_0x43621f[0x0],'timeout':_0x43621f[0x1]};var _0x311906=queue[_0xa5d1('0x0')](_0x1b83fc,{'typecast':!![]});if(_0x311906[_0xa5d1('0x44')]){logger[_0xa5d1('0x3a')](_0xa5d1('0x45'),_0x4ee25d,_[_0xa5d1('0x46')](_0x311906,'message')[_0xa5d1('0x47')](',\x20'));_0x1d8ddc[_0xa5d1('0x48')]();}else{var _0x5f2b55=_[_0xa5d1('0x49')](_0x47cc41[_0x268be2[_0xa5d1('0x2e')]+_0xa5d1('0x4a')],handleFindQueue(_0x1b83fc[_0xa5d1('0x37')]));if(_0x5f2b55){startRouting(_0x4ee25d,_0x5f2b55,_0x268be2,_0x47cc41);var _0x3f82be=(_0x5f2b55[_0xa5d1('0x40')]||0xa)*0x3e8;var _0x25b0c9=(_0x1b83fc[_0xa5d1('0x40')]||0x14)*0x3e8;var _0x5c1239;if(_0x3f82be>_0x25b0c9){_0x25b0c9=_0x3f82be;}var _0x1f0b02=seqqueue['createQueue'](_0x3f82be);_0x1f0b02['id']=_0x4ee25d;_0x1f0b02[_0xa5d1('0x4b')]=_0x3f82be;_0x1f0b02[_0xa5d1('0x4c')]=_0x25b0c9;_0x1f0b02[_0xa5d1('0x2e')]=_0x268be2['channel'];_0x47cc41[_0xa5d1('0x4d')][_0x4ee25d]['on']('end',function(){logger[_0xa5d1('0x35')](_0xa5d1('0x4e'),_0x4ee25d);stopRouting(_0x4ee25d,_0x5f2b55,_0x268be2,_0x47cc41);clearTimeout(_0x5c1239);_0x5c1239=undefined;_0x1f0b02[_0xa5d1('0x4f')](!![]);if(_0x47cc41['rules'][_0x4ee25d]){delete _0x47cc41[_0xa5d1('0x4d')][_0x4ee25d];}_0x1d8ddc[_0xa5d1('0x48')]();});_0x47cc41[_0xa5d1('0x4d')][_0x4ee25d]['on'](_0xa5d1('0x50'),function(){if(_0x47cc41[_0xa5d1('0x4d')][_0x4ee25d]){delete _0x47cc41[_0xa5d1('0x4d')][_0x4ee25d];}});_0x5c1239=setTimeout(function(){logger['info'](_0xa5d1('0x51'),_0x4ee25d);endRouting(_0x4ee25d,_0x5f2b55,_0x268be2,_0x47cc41);clearTimeout(_0x5c1239);_0x1f0b02['close'](!![]);_0x1d8ddc[_0xa5d1('0x52')]();},_0x25b0c9);switch(_0x5f2b55[_0xa5d1('0x53')]){case _0xa5d1('0x54'):strategy[_0xa5d1('0x54')](_0x1f0b02,_0x5f2b55,_0x47cc41,_0x268be2);break;default:strategy['beepall'](_0x1f0b02,_0x5f2b55,_0x47cc41,_0x268be2);}}else{logger[_0xa5d1('0x3a')](_0xa5d1('0x55'),_0x4ee25d,_0x1b83fc[_0xa5d1('0x37')]);_0x1d8ddc[_0xa5d1('0x48')]();}}}catch(_0x2b853d){logger[_0xa5d1('0x3a')](_0xa5d1('0x45'),_0x4ee25d,_0x2b853d[_0xa5d1('0x56')]);_0x1d8ddc['stop']();}};}; \ No newline at end of file +var _0x594f=['../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','error','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','timeout','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','emit','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','save','remove'];(function(_0x340540,_0x1c4427){var _0x1403b5=function(_0x57e66c){while(--_0x57e66c){_0x340540['push'](_0x340540['shift']());}};_0x1403b5(++_0x1c4427);}(_0x594f,0xde));var _0xf594=function(_0x2df3b7,_0x1bf896){_0x2df3b7=_0x2df3b7-0x0;var _0x2fbcba=_0x594f[_0x2df3b7];return _0x2fbcba;};'use strict';var schema=require(_0xf594('0x0'));var _=require('lodash');var util=require(_0xf594('0x1'));var seqqueue=require(_0xf594('0x2'));var moment=require(_0xf594('0x3'));var Redis=require(_0xf594('0x4'));var config=require(_0xf594('0x5'));var logger=require(_0xf594('0x6'))(_0xf594('0x7'));var strategy=require(_0xf594('0x8'));config[_0xf594('0x9')]=_[_0xf594('0xa')](config[_0xf594('0x9')],{'host':_0xf594('0xb'),'port':0x18eb});var io=require(_0xf594('0xc'))(new Redis(config[_0xf594('0x9')]));var attributes=['id',_0xf594('0xd'),_0xf594('0xe'),_0xf594('0xf'),'from','joinAt'];function emit(_0x19b9aa,_0x2d0547,_0x51f859){io['to'](_0x19b9aa)[_0xf594('0x10')](_0x2d0547,_0x51f859);}function emitChannelQueueInteraction(_0x47c4f9,_0x278c8c,_0x4474ae,_0x56d876,_0x3fb8fc,_0xb5d726,_0x5d74ed,_0x202341){var _0x378c0c=_['clone'](_0x4474ae);_0x378c0c[_0xf594('0xd')]=_0x202341;_0x378c0c[_0xf594('0xf')]=_0x278c8c;_0x378c0c[_0xf594('0xe')]=_0x56d876;_0x378c0c['id']=_0x3fb8fc;if(_0xb5d726){attributes['push'](_[_0xf594('0x11')](_0x47c4f9)+_0xf594('0x12'));_0x5d74ed[util[_0xf594('0x13')](_0xf594('0x14'),_0x47c4f9)][_0x3fb8fc]=_[_0xf594('0x15')](_0x378c0c,attributes);}else{delete _0x5d74ed[util[_0xf594('0x13')](_0xf594('0x14'),_0x47c4f9)][_0x3fb8fc];}emit(util[_0xf594('0x13')]('%s:queue:%s',_0x47c4f9,_0x278c8c),util[_0xf594('0x13')]('%s_queue_waiting_interaction:%s',_0x47c4f9,_0xb5d726?_0xf594('0x16'):_0xf594('0x17')),_[_0xf594('0x15')](_0x378c0c,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf594('0x18')),'chatQueueReport':require(_0xf594('0x19')),'smsQueueReport':require(_0xf594('0x1a')),'faxQueueReport':require(_0xf594('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0xf594('0x1c')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0xf594('0x1d')),'openchannelInteraction':require(_0xf594('0x1e')),'smsInteraction':require(_0xf594('0x1f')),'whatsappInteraction':require(_0xf594('0x20'))};var queue=schema({'name':{'type':_0xf594('0x21'),'required':!![],'message':_0xf594('0x22')},'timeout':{'type':_0xf594('0x23'),'message':_0xf594('0x24')}});function startRouting(_0x3263a1,_0x1334da,_0x66228a,_0x8a20a6){if(_0x3263a1&&_0x1334da&&_0x66228a){_0x1334da['waiting']+=0x1;var _0x56696f={'uniqueid':_0x3263a1,'from':_0x66228a[_0xf594('0x25')]?_0x66228a[_0xf594('0x25')][_0xf594('0x26')]:'','joinAt':moment()[_0xf594('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66228a['contact']?_0x66228a[_0xf594('0x27')]['id']:null,'ListId':_0x66228a[_0xf594('0x28')]?_0x66228a[_0xf594('0x28')]['id']:null};_0x56696f[_[_0xf594('0x29')](_0x66228a['channel'])+_0xf594('0x2a')]=_0x1334da['id']||null;_0x56696f[_[_0xf594('0x29')](_0x66228a[_0xf594('0x2b')])+_0xf594('0x12')]=_0x66228a['interaction']?_0x66228a[_0xf594('0x2c')]['id']:null;_0x56696f[_[_0xf594('0x29')](_0x66228a[_0xf594('0x2b')])+_0xf594('0x2d')]=_0x66228a[_0xf594('0x2e')]?_0x66228a[_0xf594('0x2e')]['id']:null;_0x56696f[_[_0xf594('0x29')](_0x66228a[_0xf594('0x2b')])+(_0x66228a['channel']!==_0xf594('0x2f')?_0xf594('0x30'):_0xf594('0x31'))]=_0x66228a[_0xf594('0xe')]?_0x66228a[_0xf594('0xe')]['id']:null;logger[_0xf594('0x32')](util[_0xf594('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x3263a1,_0x1334da[_0xf594('0x33')]));emitChannelQueueInteraction(_0x66228a[_0xf594('0x2b')],_0x1334da[_0xf594('0x33')],_0x56696f,_0x66228a['account'][_0xf594('0x33')],_0x66228a[_0xf594('0x2e')]['id'],!![],_0x8a20a6,_0x1334da['id']);if(rpc[_0x66228a[_0xf594('0x2b')]+_0xf594('0x34')]){return rpc[_0x66228a['channel']+_0xf594('0x34')][_0xf594('0x35')](_0x56696f)['catch'](function(_0x5ab1fb){logger[_0xf594('0x36')]('create\x20queue\x20report',_0x5ab1fb);});}}}function stopRouting(_0x357982,_0x4ddd36,_0xdc88a9,_0xc5615a){if(_0x357982&&_0x4ddd36){_0x4ddd36[_0xf594('0x37')]-=0x1;var _0x724ba1={'leaveAt':moment()[_0xf594('0x13')](_0xf594('0x38')),'acceptAt':moment()['format'](_0xf594('0x38')),'reason':_0xf594('0x39')};logger['info'](util['format'](_0xf594('0x3a'),_0x357982,_0x4ddd36[_0xf594('0x33')]));emitChannelQueueInteraction(_0xdc88a9['channel'],_0x4ddd36[_0xf594('0x33')],_0xdc88a9[_0xf594('0x25')],_0xdc88a9[_0xf594('0xe')][_0xf594('0x33')],_0xdc88a9['message']['id'],![],_0xc5615a,_0x4ddd36['id']);return rpc[_0xdc88a9[_0xf594('0x2b')]+_0xf594('0x3b')][_0xf594('0x3c')](_0xdc88a9['interaction']['id'],{'queueId':_0x4ddd36['id']})['then'](function(){if(rpc[_0xdc88a9[_0xf594('0x2b')]+_0xf594('0x34')]){return rpc[_0xdc88a9['channel']+_0xf594('0x34')][_0xf594('0x3c')](_0x357982,_0x724ba1)[_0xf594('0x3d')](function(_0x33026e){logger['error'](_0xf594('0x3e'),_0x33026e);});}});}}function endRouting(_0x521265,_0xd09aed,_0x248269,_0x1dbd6e){if(_0x521265&&_0xd09aed){_0xd09aed['waiting']-=0x1;var _0x4fe891={'leaveAt':moment()[_0xf594('0x13')](_0xf594('0x38')),'exitAt':moment()['format'](_0xf594('0x38')),'reason':'timeout'};logger['info'](util[_0xf594('0x13')](_0xf594('0x3f'),_0x521265,_0xd09aed['name']));emitChannelQueueInteraction(_0x248269[_0xf594('0x2b')],_0xd09aed[_0xf594('0x33')],_0x248269['body'],_0x248269['account'][_0xf594('0x33')],_0x248269[_0xf594('0x2e')]['id'],![],_0x1dbd6e);if(rpc[_0x248269[_0xf594('0x2b')]+_0xf594('0x34')]){return rpc[_0x248269[_0xf594('0x2b')]+_0xf594('0x34')]['update'](_0x521265,_0x4fe891)[_0xf594('0x3d')](function(_0x2abcc4){logger[_0xf594('0x36')](_0xf594('0x3e'),_0x2abcc4);});}}}function handleFindQueue(_0x5b56e4){return function(_0x465370){return _0x465370[_0xf594('0x33')]['toLowerCase']()===_0x5b56e4[_0xf594('0x40')]();};}exports[_0xf594('0x41')]=function(_0x112d11,_0x588650,_0x2e044e,_0x58c053){return function(_0x534462){try{var _0x254486={'name':_0x588650[0x0],'timeout':_0x588650[0x1]};var _0x2606cc=queue[_0xf594('0x0')](_0x254486,{'typecast':!![]});if(_0x2606cc[_0xf594('0x42')]){logger[_0xf594('0x36')](_0xf594('0x43'),_0x112d11,_[_0xf594('0x44')](_0x2606cc,_0xf594('0x2e'))[_0xf594('0x45')](',\x20'));_0x534462['stop']();}else{var _0x381250=_['find'](_0x2e044e[_0x58c053[_0xf594('0x2b')]+'Queues'],handleFindQueue(_0x254486[_0xf594('0x33')]));if(_0x381250){startRouting(_0x112d11,_0x381250,_0x58c053,_0x2e044e);var _0x50c677=(_0x381250[_0xf594('0x46')]||0xa)*0x3e8;var _0x4a09ce=(_0x254486[_0xf594('0x46')]||0x14)*0x3e8;var _0x403877;if(_0x50c677>_0x4a09ce){_0x4a09ce=_0x50c677;}var _0x21c65d=seqqueue['createQueue'](_0x50c677);_0x21c65d['id']=_0x112d11;_0x21c65d[_0xf594('0x47')]=_0x50c677;_0x21c65d[_0xf594('0x48')]=_0x4a09ce;_0x21c65d['channel']=_0x58c053[_0xf594('0x2b')];_0x2e044e['rules'][_0x112d11]['on']('end',function(){logger[_0xf594('0x32')](_0xf594('0x49'),_0x112d11);stopRouting(_0x112d11,_0x381250,_0x58c053,_0x2e044e);clearTimeout(_0x403877);_0x403877=undefined;_0x21c65d['close'](!![]);if(_0x2e044e[_0xf594('0x4a')][_0x112d11]){delete _0x2e044e['rules'][_0x112d11];}_0x534462[_0xf594('0x4b')]();});_0x2e044e[_0xf594('0x4a')][_0x112d11]['on']('complete',function(){if(_0x2e044e['rules'][_0x112d11]){delete _0x2e044e[_0xf594('0x4a')][_0x112d11];}});_0x403877=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x112d11);endRouting(_0x112d11,_0x381250,_0x58c053,_0x2e044e);clearTimeout(_0x403877);_0x21c65d['close'](!![]);_0x534462[_0xf594('0x4c')]();},_0x4a09ce);switch(_0x381250[_0xf594('0x4d')]){case _0xf594('0x4e'):strategy[_0xf594('0x4e')](_0x21c65d,_0x381250,_0x2e044e,_0x58c053);break;default:strategy[_0xf594('0x4f')](_0x21c65d,_0x381250,_0x2e044e,_0x58c053);}}else{logger['error'](_0xf594('0x50'),_0x112d11,_0x254486[_0xf594('0x33')]);_0x534462[_0xf594('0x4b')]();}}}catch(_0x5447ce){logger[_0xf594('0x36')]('[%s][QUEUE]\x20%s',_0x112d11,_0x5447ce[_0xf594('0x51')]);_0x534462[_0xf594('0x4b')]();}};}; \ 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 b23cf0c..885779d 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 _0xf2ca=['channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','handleRun','bind','timeout','drained','handleDrained','push','prototype','handleTimeout','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x48f00c,_0x44df1a){var _0x22db9c=function(_0x428291){while(--_0x428291){_0x48f00c['push'](_0x48f00c['shift']());}};_0x22db9c(++_0x44df1a);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4a2b3c,_0xc69f59){_0x4a2b3c=_0x4a2b3c-0x0;var _0x4b081b=_0xf2ca[_0x4a2b3c];return _0x4b081b;};'use strict';var _=require(_0xaf2c('0x0'));var uuid=require(_0xaf2c('0x1'));var util=require(_0xaf2c('0x2'));var logger=require('../../../../../config/logger')(_0xaf2c('0x3'));var Agent=function(_0x2102e2,_0x1271a9,_0x219511,_0x3a724c){this[_0xaf2c('0x4')]=uuid['v4']();this['squeue']=_0x2102e2;this[_0xaf2c('0x5')]=_0x1271a9;this[_0xaf2c('0x6')]=_0x219511;this[_0xaf2c('0x3')]=_0x3a724c;this[_0xaf2c('0x7')]['push'](this[_0xaf2c('0x8')][_0xaf2c('0x9')](this),this['handleTimeout'][_0xaf2c('0x9')](this));this['squeue']['on'](_0xaf2c('0xa'),this['handleTimeout'][_0xaf2c('0x9')](this));this[_0xaf2c('0x7')]['on'](_0xaf2c('0xb'),this[_0xaf2c('0xc')]['bind'](this));};Agent['prototype'][_0xaf2c('0xd')]=function(){this[_0xaf2c('0x7')][_0xaf2c('0xd')](this[_0xaf2c('0x8')][_0xaf2c('0x9')](this),this['handleTimeout']['bind'](this));};Agent[_0xaf2c('0xe')][_0xaf2c('0xc')]=function(){this[_0xaf2c('0xf')](!![]);};Agent[_0xaf2c('0xe')][_0xaf2c('0x8')]=function(){logger[_0xaf2c('0x10')](_0xaf2c('0x11'),this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);if(_[_0xaf2c('0x12')](this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']])){logger[_0xaf2c('0x10')](_0xaf2c('0x14'),this['squeue']['id'],this[_0xaf2c('0x5')]['id']);setTimeout(this['push'][_0xaf2c('0x9')](this),0x3e8);}else{if(this[_0xaf2c('0x3')][_0xaf2c('0x15')]||util['isAgentAvailable'](this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']],this[_0xaf2c('0x7')][_0xaf2c('0x16')],![])){this['realtime'][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x17')]=!![];this[_0xaf2c('0x6')][_0xaf2c('0x13')][this['agent']['id']][_0xaf2c('0x18')]=undefined;util[_0xaf2c('0x19')](this[_0xaf2c('0x6')],this['routing'],this['agent'],this[_0xaf2c('0x7')][_0xaf2c('0x16')]);util[_0xaf2c('0x1a')](this[_0xaf2c('0x4')],this['squeue']['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']],null,this[_0xaf2c('0x3')]);util[_0xaf2c('0x1b')](this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x6')]['agents'][this[_0xaf2c('0x5')]['id']],_0xaf2c('0x1c')+(this[_0xaf2c('0x3')][_0xaf2c('0x15')]?':FORCED':''));}else{logger[_0xaf2c('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);setTimeout(this[_0xaf2c('0xd')]['bind'](this),0x3e8);}}};Agent[_0xaf2c('0xe')][_0xaf2c('0xf')]=function(_0x3baee2){if(_['isNil'](this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']])){return logger[_0xaf2c('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);}else{logger[_0xaf2c('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xaf2c('0x5')]['id']);util['hideNotification'](this[_0xaf2c('0x4')],this['squeue']['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this['agent']['id']],null,this[_0xaf2c('0x3')]);this[_0xaf2c('0x6')]['agents'][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x17')]=![];this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x18')]=undefined;util['removeWaitingNotification'](this[_0xaf2c('0x6')],this['routing'],this[_0xaf2c('0x5')],this['squeue'][_0xaf2c('0x16')]);util['writeLog'](this[_0xaf2c('0x7')]['id'],this['realtime'][_0xaf2c('0x13')][this['agent']['id']],_0x3baee2?_0xaf2c('0x1d'):_0xaf2c('0x1e'));}if(!_0x3baee2){setTimeout(this[_0xaf2c('0xd')][_0xaf2c('0x9')](this),0x3e8);}};function agent(_0x470aff,_0x598adb,_0x4cba13,_0x6f428d){return new Agent(_0x470aff,_0x598adb,_0x4cba13,_0x6f428d);}module[_0xaf2c('0x1f')]=agent; \ No newline at end of file +var _0xc978=['isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var uuid=require(_0x8c97('0x1'));var util=require(_0x8c97('0x2'));var logger=require(_0x8c97('0x3'))(_0x8c97('0x4'));var Agent=function(_0x44d4ea,_0x5ef47d,_0x23f5e9,_0x23c28d){this[_0x8c97('0x5')]=uuid['v4']();this[_0x8c97('0x6')]=_0x44d4ea;this[_0x8c97('0x7')]=_0x5ef47d;this[_0x8c97('0x8')]=_0x23f5e9;this[_0x8c97('0x4')]=_0x23c28d;this['squeue'][_0x8c97('0x9')](this[_0x8c97('0xa')][_0x8c97('0xb')](this),this[_0x8c97('0xc')][_0x8c97('0xb')](this));this[_0x8c97('0x6')]['on'](_0x8c97('0xd'),this['handleTimeout'][_0x8c97('0xb')](this));this[_0x8c97('0x6')]['on'](_0x8c97('0xe'),this[_0x8c97('0xf')][_0x8c97('0xb')](this));};Agent[_0x8c97('0x10')][_0x8c97('0x9')]=function(){this[_0x8c97('0x6')][_0x8c97('0x9')](this['handleRun'][_0x8c97('0xb')](this),this[_0x8c97('0xc')]['bind'](this));};Agent[_0x8c97('0x10')][_0x8c97('0xf')]=function(){this['handleTimeout'](!![]);};Agent[_0x8c97('0x10')]['handleRun']=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x8c97('0x6')]['id'],this[_0x8c97('0x7')]['id']);if(_[_0x8c97('0x11')](this[_0x8c97('0x8')][_0x8c97('0x12')][this[_0x8c97('0x7')]['id']])){logger[_0x8c97('0x13')](_0x8c97('0x14'),this[_0x8c97('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x8c97('0x9')][_0x8c97('0xb')](this),0x3e8);}else{if(this[_0x8c97('0x4')][_0x8c97('0x15')]||util[_0x8c97('0x16')](this[_0x8c97('0x6')]['id'],this[_0x8c97('0x8')][_0x8c97('0x12')][this[_0x8c97('0x7')]['id']],this[_0x8c97('0x6')][_0x8c97('0x17')],![])){this[_0x8c97('0x8')][_0x8c97('0x12')][this[_0x8c97('0x7')]['id']][_0x8c97('0x18')]=!![];this[_0x8c97('0x8')]['agents'][this[_0x8c97('0x7')]['id']][_0x8c97('0x19')]=undefined;util[_0x8c97('0x1a')](this['realtime'],this['routing'],this[_0x8c97('0x7')],this['squeue'][_0x8c97('0x17')]);util[_0x8c97('0x1b')](this[_0x8c97('0x5')],this[_0x8c97('0x6')]['id'],this[_0x8c97('0x8')][_0x8c97('0x12')][this[_0x8c97('0x7')]['id']],null,this['routing']);util['writeLog'](this[_0x8c97('0x6')]['id'],this[_0x8c97('0x8')][_0x8c97('0x12')][this['agent']['id']],'RINGING'+(this[_0x8c97('0x4')][_0x8c97('0x15')]?_0x8c97('0x1c'):''));}else{logger[_0x8c97('0x13')](_0x8c97('0x1d'),this[_0x8c97('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x8c97('0x9')]['bind'](this),0x3e8);}}};Agent[_0x8c97('0x10')]['handleTimeout']=function(_0x245d15){if(_[_0x8c97('0x11')](this['realtime'][_0x8c97('0x12')][this['agent']['id']])){return logger[_0x8c97('0x13')](_0x8c97('0x14'),this[_0x8c97('0x6')]['id'],this[_0x8c97('0x7')]['id']);}else{logger[_0x8c97('0x13')](_0x8c97('0x1e'),this['squeue']['id'],this['agent']['id']);util[_0x8c97('0x1f')](this[_0x8c97('0x5')],this[_0x8c97('0x6')]['id'],this['realtime'][_0x8c97('0x12')][this['agent']['id']],null,this['routing']);this[_0x8c97('0x8')][_0x8c97('0x12')][this[_0x8c97('0x7')]['id']][_0x8c97('0x18')]=![];this[_0x8c97('0x8')][_0x8c97('0x12')][this['agent']['id']][_0x8c97('0x19')]=undefined;util[_0x8c97('0x20')](this[_0x8c97('0x8')],this[_0x8c97('0x4')],this[_0x8c97('0x7')],this[_0x8c97('0x6')][_0x8c97('0x17')]);util[_0x8c97('0x21')](this['squeue']['id'],this[_0x8c97('0x8')][_0x8c97('0x12')][this[_0x8c97('0x7')]['id']],_0x245d15?_0x8c97('0x22'):_0x8c97('0x23'));}if(!_0x245d15){setTimeout(this[_0x8c97('0x9')]['bind'](this),0x3e8);}};function agent(_0x473d52,_0x441612,_0x2beaaf,_0x38e2e2){return new Agent(_0x473d52,_0x441612,_0x2beaaf,_0x38e2e2);}module[_0x8c97('0x24')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 6b995e0..af27e95 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 _0xb0c9=['[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','uuid','./util','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busyQueue','name','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY'];(function(_0x32f9cd,_0x1e48bd){var _0x25ad1c=function(_0x5f5ba2){while(--_0x5f5ba2){_0x32f9cd['push'](_0x32f9cd['shift']());}};_0x25ad1c(++_0x1e48bd);}(_0xb0c9,0x126));var _0x9b0c=function(_0x2b0275,_0x3fe1fe){_0x2b0275=_0x2b0275-0x0;var _0x43708e=_0xb0c9[_0x2b0275];return _0x43708e;};'use strict';var _=require('lodash');var uuid=require(_0x9b0c('0x0'));var util=require(_0x9b0c('0x1'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x25468e,_0x41e64b,_0x1ec5d3,_0x40c8f5){this[_0x9b0c('0x2')]=uuid['v4']();this[_0x9b0c('0x3')]=_0x25468e;this[_0x9b0c('0x4')]=_0x41e64b;this[_0x9b0c('0x5')]=_0x1ec5d3;this['routing']=_0x40c8f5;this[_0x9b0c('0x3')][_0x9b0c('0x6')](this[_0x9b0c('0x7')][_0x9b0c('0x8')](this),this[_0x9b0c('0x9')][_0x9b0c('0x8')](this));this[_0x9b0c('0x3')]['on']('timeout',this[_0x9b0c('0x9')]['bind'](this));this['squeue']['on']('drained',this[_0x9b0c('0xa')][_0x9b0c('0x8')](this));};Beepall['prototype'][_0x9b0c('0x6')]=function(){this['squeue'][_0x9b0c('0x6')](this[_0x9b0c('0x7')][_0x9b0c('0x8')](this),this[_0x9b0c('0x9')][_0x9b0c('0x8')](this));};Beepall[_0x9b0c('0xb')][_0x9b0c('0xa')]=function(){this[_0x9b0c('0x9')](!![]);};Beepall[_0x9b0c('0xb')][_0x9b0c('0x7')]=function(){var _0x3ec5ae=!![];if(!_[_0x9b0c('0xc')](this[_0x9b0c('0x4')])&&!_['isNil'](this['queue'][_0x9b0c('0xd')])&&this[_0x9b0c('0x4')][_0x9b0c('0xd')]['length']>0x0){for(var _0x5ef1c4=0x0,_0x51e211;_0x5ef1c40x0){for(var _0x8b15f1=0x0,_0xcbb5e5;_0x8b15f10x0&&_0xfa7194[_0xaac9af+_0xbd0b('0x21')]>=_0xfa7194[_0xaac9af+'Capacity']){writeLog(_0x358e4d,_0xfa7194,_0xaac9af[_0xbd0b('0x23')]()+_0xbd0b('0x24'));return![];}}return!![];};exports[_0xbd0b('0x25')]=function(_0xd88c1d,_0xcc0e63,_0x4449c9,_0x511c6d,_0x1295dc){return sendNotification(!![],_0xd88c1d,_0xcc0e63,_0x4449c9,_0x511c6d,_0x1295dc);};exports[_0xbd0b('0x26')]=function(_0x18a7bf,_0xa8fd02,_0x36200c,_0x7df2f9,_0x41ad46){return sendNotification(![],_0x18a7bf,_0xa8fd02,_0x36200c,_0x7df2f9,_0x41ad46);};exports[_0xbd0b('0x27')]=function(_0x1e46c9,_0x5a861f,_0x30b000){var _0x313466=_0x5a861f[_0xbd0b('0x28')][_0xbd0b('0x29')];if(!_0x313466&&_0x30b000){_0x313466=_0x30b000['id'];}var _0x14d3c1=_[_0xbd0b('0x2a')](_0x1e46c9[_0x5a861f[_0xbd0b('0x2b')]+_0xbd0b('0x2c')],function(_0x509979){var _0xb03fb2=_[_0xbd0b('0x2d')](_0x5a861f[_0xbd0b('0x2b')])+_0xbd0b('0x2e');return _0x509979[_0xb03fb2]===_0x5a861f[_0xbd0b('0x28')]['id'];});if(!_0x14d3c1&&_0x313466&&_0x1e46c9[_0xbd0b('0x2f')][_0x313466]){_0x14d3c1=_['some'](_0x1e46c9[_0xbd0b('0x2f')][_0x313466][_0x5a861f[_0xbd0b('0x2b')]+'WaitingInteractions'],function(_0x151d76){return _0x151d76['id']===_0x5a861f['interaction']['id'];});}return _0x14d3c1;};exports['saveWaitingNotification']=function(_0x156a75,_0x296b32,_0x4a6bbe,_0x7368b7){if(_0x4a6bbe&&_0x4a6bbe['id']&&_0x156a75['agents']&&_0x156a75[_0xbd0b('0x2f')][_0x4a6bbe['id']]){_0x156a75[_0xbd0b('0x2f')][_0x4a6bbe['id']][_0x7368b7+_0xbd0b('0x30')][_0x296b32[_0xbd0b('0x31')]['id']]={'id':_0x296b32[_0xbd0b('0x28')]['id']};}};exports['removeWaitingNotification']=function(_0x3ebedf,_0x1e947b,_0x193cd6,_0x29a226){if(_0x193cd6&&_0x193cd6['id']&&_0x3ebedf[_0xbd0b('0x2f')]&&_0x3ebedf[_0xbd0b('0x2f')][_0x193cd6['id']]){delete _0x3ebedf['agents'][_0x193cd6['id']][_0x29a226+_0xbd0b('0x30')][_0x1e947b['message']['id']];}};exports[_0xbd0b('0x32')]=writeLog; \ No newline at end of file +var _0xb0cb=['msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','debug','busy','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','agents','saveWaitingNotification','WaitingInteractions','removeWaitingNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','split','name','account','notificationShake','body','queue'];(function(_0x6b4173,_0x33679b){var _0x39a374=function(_0x183944){while(--_0x183944){_0x6b4173['push'](_0x6b4173['shift']());}};_0x39a374(++_0x33679b);}(_0xb0cb,0x1d0));var _0xbb0c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xb0cb[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0xbb0c('0x0'));var util=require('util');var utils=require(_0xbb0c('0x1'));var Redis=require(_0xbb0c('0x2'));var config=require(_0xbb0c('0x3'));var logger=require(_0xbb0c('0x4'))(_0xbb0c('0x5'));config[_0xbb0c('0x6')]=_[_0xbb0c('0x7')](config[_0xbb0c('0x6')],{'host':_0xbb0c('0x8'),'port':0x18eb});var io=require(_0xbb0c('0x9'))(new Redis(config[_0xbb0c('0x6')]));function sendNotification(_0x10a1f3,_0x2cdeae,_0x3c6062,_0x5c02ad,_0x162ca4,_0x11d046){var _0x4b11a3=_0x11d046||{};var _0x1632a4=_0x3c6062[_0xbb0c('0xa')]('.');var _0x1f15a8={'uniqueid':_0x2cdeae,'channel':_0x1632a4[0x0],'id':_0x1632a4[0x1],'title':_0x1632a4[0x0]+'\x20interaction','interactionId':_0x1632a4[0x2],'queue':_0x162ca4?_0x162ca4[_0xbb0c('0xb')]:null,'sound':_0x4b11a3[_0xbb0c('0xc')]['notificationSound'],'shake':_0x4b11a3[_0xbb0c('0xc')][_0xbb0c('0xd')]};try{if(!_0x4b11a3[_0xbb0c('0xe')]){_0x4b11a3[_0xbb0c('0xe')]={};}if(_0x162ca4){_0x4b11a3['body']['queue']=_0x162ca4;}else if(_0x4b11a3[_0xbb0c('0xe')][_0xbb0c('0xf')]){delete _0x4b11a3[_0xbb0c('0xe')][_0xbb0c('0xf')];}_0x1f15a8[_0xbb0c('0x10')]=utils[_0xbb0c('0x11')](_0x4b11a3[_0xbb0c('0xc')][_0xbb0c('0x12')],_0x4b11a3);}catch(_0x35d0b5){_0x1f15a8[_0xbb0c('0x10')]=_0xbb0c('0x13');logger[_0xbb0c('0x14')](util[_0xbb0c('0x15')](_0xbb0c('0x16'),_0x2cdeae,_0x35d0b5[_0xbb0c('0x17')]));}io['to'](util[_0xbb0c('0x15')](_0xbb0c('0x18'),_0x5c02ad[_0xbb0c('0xb')]))['emit'](util[_0xbb0c('0x15')](_0xbb0c('0x19'),_0x10a1f3?'save':'remove'),_0x1f15a8);}function writeLog(_0x4e19dd,_0x487a5c,_0x19c53c){return logger[_0xbb0c('0x1a')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4e19dd,_0x487a5c[_0xbb0c('0xb')],_0x19c53c));}exports['isAgentAvailable']=function(_0x3a4845,_0x1595ee,_0x1a6b4b,_0x42ba2e){if(_0x1595ee[_0xbb0c('0x1b')]){writeLog(_0x3a4845,_0x1595ee,'BUSY');return![];}if(!_0x1595ee[_0xbb0c('0x1c')]){writeLog(_0x3a4845,_0x1595ee,_0xbb0c('0x1d'));return![];}if(_0x1595ee[_0x1a6b4b+'Pause']){writeLog(_0x3a4845,_0x1595ee,_0xbb0c('0x1e'));return![];}if(_0x42ba2e&&_0x1595ee[_0xbb0c('0x1f')](_0x1a6b4b+_0xbb0c('0x20'))&&_0x1595ee[_0xbb0c('0x1f')](_0x1a6b4b+_0xbb0c('0x21'))){if(_0x1595ee[_0x1a6b4b+'Capacity']>0x0&&_0x1595ee[_0x1a6b4b+'CurrentCapacity']>=_0x1595ee[_0x1a6b4b+'Capacity']){writeLog(_0x3a4845,_0x1595ee,_0x1a6b4b[_0xbb0c('0x22')]()+_0xbb0c('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x5addbd,_0x1c9c1c,_0x1d6524,_0x247073,_0x444dfb){return sendNotification(!![],_0x5addbd,_0x1c9c1c,_0x1d6524,_0x247073,_0x444dfb);};exports[_0xbb0c('0x24')]=function(_0x544faa,_0x366e2a,_0x3210d4,_0x5e51f3,_0x39d607){return sendNotification(![],_0x544faa,_0x366e2a,_0x3210d4,_0x5e51f3,_0x39d607);};exports['checkWaitingNotifications']=function(_0x48e474,_0x3facf7,_0x36c41c){var _0xb1fe66=_0x3facf7[_0xbb0c('0x25')][_0xbb0c('0x26')];if(!_0xb1fe66&&_0x36c41c){_0xb1fe66=_0x36c41c['id'];}var _0x35cf77=_[_0xbb0c('0x27')](_0x48e474[_0x3facf7[_0xbb0c('0x28')]+_0xbb0c('0x29')],function(_0x3315a9){var _0x56cdaa=_[_0xbb0c('0x2a')](_0x3facf7[_0xbb0c('0x28')])+'InteractionId';return _0x3315a9[_0x56cdaa]===_0x3facf7[_0xbb0c('0x25')]['id'];});if(!_0x35cf77&&_0xb1fe66&&_0x48e474[_0xbb0c('0x2b')][_0xb1fe66]){_0x35cf77=_['some'](_0x48e474[_0xbb0c('0x2b')][_0xb1fe66][_0x3facf7[_0xbb0c('0x28')]+'WaitingInteractions'],function(_0x353b11){return _0x353b11['id']===_0x3facf7['interaction']['id'];});}return _0x35cf77;};exports[_0xbb0c('0x2c')]=function(_0x9e935,_0x1ba82f,_0x31b221,_0x2bbbe0){if(_0x31b221&&_0x31b221['id']&&_0x9e935[_0xbb0c('0x2b')]&&_0x9e935[_0xbb0c('0x2b')][_0x31b221['id']]){_0x9e935['agents'][_0x31b221['id']][_0x2bbbe0+_0xbb0c('0x2d')][_0x1ba82f[_0xbb0c('0x17')]['id']]={'id':_0x1ba82f[_0xbb0c('0x25')]['id']};}};exports[_0xbb0c('0x2e')]=function(_0xc1de4b,_0x2ebc5c,_0x74c350,_0x31acc2){if(_0x74c350&&_0x74c350['id']&&_0xc1de4b[_0xbb0c('0x2b')]&&_0xc1de4b[_0xbb0c('0x2b')][_0x74c350['id']]){delete _0xc1de4b[_0xbb0c('0x2b')][_0x74c350['id']][_0x31acc2+'WaitingInteractions'][_0x2ebc5c[_0xbb0c('0x17')]['id']];}};exports[_0xbb0c('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 df714e1..ff301e2 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 _0x3248=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','shelljs','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','message','join'];(function(_0x4bad5f,_0x48eb80){var _0xc030d4=function(_0x3fd149){while(--_0x3fd149){_0x4bad5f['push'](_0x4bad5f['shift']());}};_0xc030d4(++_0x48eb80);}(_0x3248,0x1bc));var _0x8324=function(_0x2bf238,_0x57edeb){_0x2bf238=_0x2bf238-0x0;var _0x83bd1a=_0x3248[_0x2bf238];return _0x83bd1a;};'use strict';var schema=require('validate');var sh=require(_0x8324('0x0'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x8324('0x1'))(_0x8324('0x2'));var system=schema({'command':{'type':_0x8324('0x3'),'required':!![],'message':_0x8324('0x4')}});exports[_0x8324('0x5')]=function(_0x334505,_0x4a92b4){return function(_0x1d1033){try{var _0x1c5c2a={'command':_0x4a92b4[0x0]};var _0x5157f4=system[_0x8324('0x6')](_0x1c5c2a,{'typecast':!![]});if(_0x5157f4[_0x8324('0x7')]){logger[_0x8324('0x8')](_0x8324('0x9'),_0x334505,_['map'](_0x5157f4,_0x8324('0xa'))[_0x8324('0xb')](',\x20'));logger[_0x8324('0xc')](_0x8324('0xd'),_0x334505);_0x1d1033['next']();}else{var _0x33b170=this;var _0x3dd97d=utils['getMustacheRender'](_0x4a92b4[0x0],this);logger[_0x8324('0xc')](_0x8324('0xe'),_0x334505,_0x3dd97d);sh['exec'](_['trim'](_0x3dd97d),function(_0x4790f0,_0x26ffe2){logger[_0x8324('0xc')](_0x8324('0xf'),_0x334505,_0x4790f0);if(_0x4790f0==0x0){var _0x3619ec=_0x26ffe2['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x8324('0x10')](_0x4a92b4[0x1])||_[_0x8324('0x11')](_0x4a92b4[0x1])){logger[_0x8324('0xc')](_0x8324('0x12'),_0x334505);_0x33b170[_0x8324('0x13')][_0x4a92b4[0x1]]=_0x3619ec;}else{logger['info'](_0x8324('0x14'),_0x334505,_0x4a92b4[0x1],_0x3619ec);_0x33b170[_0x8324('0x13')][_0x4a92b4[0x1]]=_0x3619ec;}}_0x1d1033[_0x8324('0x15')]();});}}catch(_0x3b1a18){logger[_0x8324('0x8')]('[%s][SYSTEM]\x20%s',_0x334505,_[_0x8324('0x16')](_0x3b1a18)?JSON[_0x8324('0x17')](_0x3b1a18):_0x3b1a18);logger[_0x8324('0xc')](_0x8324('0xd'),_0x334505);_0x1d1033['next']();}};}; \ No newline at end of file +var _0x2090=['message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map'];(function(_0x149691,_0x234d24){var _0x1b2660=function(_0x2cf743){while(--_0x2cf743){_0x149691['push'](_0x149691['shift']());}};_0x1b2660(++_0x234d24);}(_0x2090,0xae));var _0x0209=function(_0x8659d0,_0x2e0e9f){_0x8659d0=_0x8659d0-0x0;var _0xd3603c=_0x2090[_0x8659d0];return _0xd3603c;};'use strict';var schema=require('validate');var sh=require(_0x0209('0x0'));var _=require(_0x0209('0x1'));var utils=require('./utils');var logger=require(_0x0209('0x2'))(_0x0209('0x3'));var system=schema({'command':{'type':_0x0209('0x4'),'required':!![],'message':_0x0209('0x5')}});exports[_0x0209('0x6')]=function(_0x50f65d,_0x3bed89){return function(_0x4e367a){try{var _0x2aaa17={'command':_0x3bed89[0x0]};var _0x8c2e0b=system['validate'](_0x2aaa17,{'typecast':!![]});if(_0x8c2e0b[_0x0209('0x7')]){logger['error'](_0x0209('0x8'),_0x50f65d,_[_0x0209('0x9')](_0x8c2e0b,_0x0209('0xa'))['join'](',\x20'));logger[_0x0209('0xb')](_0x0209('0xc'),_0x50f65d);_0x4e367a[_0x0209('0xd')]();}else{var _0x233604=this;var _0x2c171c=utils[_0x0209('0xe')](_0x3bed89[0x0],this);logger['info'](_0x0209('0xf'),_0x50f65d,_0x2c171c);sh['exec'](_[_0x0209('0x10')](_0x2c171c),function(_0x5529b6,_0x270b10){logger[_0x0209('0xb')](_0x0209('0x11'),_0x50f65d,_0x5529b6);if(_0x5529b6==0x0){var _0x35b7c3=_0x270b10['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3bed89[0x1])||_[_0x0209('0x12')](_0x3bed89[0x1])){logger[_0x0209('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x50f65d);_0x233604[_0x0209('0x13')][_0x3bed89[0x1]]=_0x35b7c3;}else{logger[_0x0209('0xb')](_0x0209('0x14'),_0x50f65d,_0x3bed89[0x1],_0x35b7c3);_0x233604[_0x0209('0x13')][_0x3bed89[0x1]]=_0x35b7c3;}}_0x4e367a[_0x0209('0xd')]();});}}catch(_0x8e5a6c){logger[_0x0209('0x15')](_0x0209('0x8'),_0x50f65d,_['isObject'](_0x8e5a6c)?JSON[_0x0209('0x16')](_0x8e5a6c):_0x8e5a6c);logger[_0x0209('0xb')](_0x0209('0xc'),_0x50f65d);_0x4e367a[_0x0209('0xd')]();}};}; \ 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 f0d3e81..109b29b 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 _0x8bf5=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','catch','[%s][TAG]\x20%s','stringify','finally','next','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','error','map','message','info'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x8bf5,0x12a));var _0x58bf=function(_0x549752,_0x16fc66){_0x549752=_0x549752-0x0;var _0x508e33=_0x8bf5[_0x549752];return _0x508e33;};'use strict';var schema=require('validate');var _=require(_0x58bf('0x0'));var rpc={'chatInteraction':require(_0x58bf('0x1')),'openchannelInteraction':require(_0x58bf('0x2')),'smsInteraction':require(_0x58bf('0x3')),'mailInteraction':require(_0x58bf('0x4')),'faxInteraction':require(_0x58bf('0x5')),'whatsappInteraction':require(_0x58bf('0x6'))};var logger=require('../../../../config/logger')(_0x58bf('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x58bf('0x8')}});exports['consequence']=function(_0x43e1dd,_0x11b59c,_0x22987e,_0x4bbb18){return function(_0x319116){try{var _0x5c8d02={'tag':_0x11b59c[0x0]};var _0x23796e=tag[_0x58bf('0x9')](_0x5c8d02,{'typecast':!![]});if(_0x23796e['length']){logger[_0x58bf('0xa')]('[%s][TAG]\x20%s',_0x43e1dd,_[_0x58bf('0xb')](_0x23796e,_0x58bf('0xc'))['join'](',\x20'));logger[_0x58bf('0xd')](_0x58bf('0xe'),_0x43e1dd);_0x319116['next']();}else{var _0x2f4c6a={'ids':[_0x11b59c[0x0]]};if(rpc[_0x4bbb18[_0x58bf('0xf')]+_0x58bf('0x10')]){rpc[_0x4bbb18[_0x58bf('0xf')]+'Interaction'][_0x58bf('0x11')](_0x4bbb18[_0x58bf('0x12')]['id'],_0x2f4c6a)[_0x58bf('0x13')](function(_0x45e77e){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x43e1dd,_0x11b59c[0x1],_0x4bbb18[_0x58bf('0xf')],_0x4bbb18[_0x58bf('0x12')]['id']);})[_0x58bf('0x14')](function(_0x299fd0){logger[_0x58bf('0xa')](_0x58bf('0x15'),_0x43e1dd,JSON[_0x58bf('0x16')](_0x299fd0));logger[_0x58bf('0xd')](_0x58bf('0xe'),_0x43e1dd);})[_0x58bf('0x17')](function(){_0x319116[_0x58bf('0x18')]();});}}}catch(_0x3f00f5){logger[_0x58bf('0xa')](_0x58bf('0x15'),_0x43e1dd,_[_0x58bf('0x19')](_0x3f00f5)?JSON[_0x58bf('0x16')](_0x3f00f5):_0x3f00f5);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x43e1dd);_0x319116['next']();}};}; \ No newline at end of file +var _0x34c0=['interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','finally','error','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0x34c0,0x83));var _0x034c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34c0[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x034c('0x0'));var _=require(_0x034c('0x1'));var rpc={'chatInteraction':require(_0x034c('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x034c('0x3')),'mailInteraction':require(_0x034c('0x4')),'faxInteraction':require(_0x034c('0x5')),'whatsappInteraction':require(_0x034c('0x6'))};var logger=require(_0x034c('0x7'))('routing');var tag=schema({'tag':{'type':_0x034c('0x8'),'required':!![],'message':_0x034c('0x9')}});exports[_0x034c('0xa')]=function(_0x258de7,_0x4c10c3,_0x2722c0,_0x2b17e6){return function(_0x57330f){try{var _0x26c33a={'tag':_0x4c10c3[0x0]};var _0x1c1236=tag[_0x034c('0x0')](_0x26c33a,{'typecast':!![]});if(_0x1c1236['length']){logger['error'](_0x034c('0xb'),_0x258de7,_['map'](_0x1c1236,'message')[_0x034c('0xc')](',\x20'));logger[_0x034c('0xd')](_0x034c('0xe'),_0x258de7);_0x57330f[_0x034c('0xf')]();}else{var _0x4deb65={'ids':[_0x4c10c3[0x0]]};if(rpc[_0x2b17e6[_0x034c('0x10')]+_0x034c('0x11')]){rpc[_0x2b17e6['channel']+_0x034c('0x11')][_0x034c('0x12')](_0x2b17e6[_0x034c('0x13')]['id'],_0x4deb65)['then'](function(_0x4a1f21){logger[_0x034c('0xd')](_0x034c('0x14'),_0x258de7,_0x4c10c3[0x1],_0x2b17e6[_0x034c('0x10')],_0x2b17e6[_0x034c('0x13')]['id']);})['catch'](function(_0x2c2e05){logger['error'](_0x034c('0xb'),_0x258de7,JSON['stringify'](_0x2c2e05));logger[_0x034c('0xd')](_0x034c('0xe'),_0x258de7);})[_0x034c('0x15')](function(){_0x57330f[_0x034c('0xf')]();});}}}catch(_0x3c8d0d){logger[_0x034c('0x16')](_0x034c('0xb'),_0x258de7,_[_0x034c('0x17')](_0x3c8d0d)?JSON[_0x034c('0x18')](_0x3c8d0d):_0x3c8d0d);logger['info'](_0x034c('0xe'),_0x258de7);_0x57330f[_0x034c('0xf')]();}};}; \ 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 8954e4b..511eb3f 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 _0x77f7=['\x20-\x20','replace','includes','push','urlOnAnswer','?params=','title','method','login','stringify','application/json-rpc','then','parse','logged','&serviceId=','&sessionId=','&data=','info','catch','error','[%s][TVOX]\x20%s','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','lodash'];(function(_0x822a3f,_0x32fd83){var _0x1053e7=function(_0xf41a09){while(--_0xf41a09){_0x822a3f['push'](_0x822a3f['shift']());}};_0x1053e7(++_0x32fd83);}(_0x77f7,0x1d9));var _0x777f=function(_0x2f00c6,_0xbd4ab){_0x2f00c6=_0x2f00c6-0x0;var _0x1a881c=_0x77f7[_0x2f00c6];return _0x1a881c;};'use strict';var rp=require(_0x777f('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0x777f('0x1'));var arr=[];exports['consequence']=function(_0xfa17c1,_0x1a7b4d){return function(_0x52e256){var _0x2d2c96=_0x1a7b4d[0xa];var _0x175eb3=_0x1a7b4d[0xb];var _0x551e5f=_0x1a7b4d[0xc];var _0x469ee3=_0x1a7b4d[0xd];var _0x48ca4e=_0x1a7b4d[0xe];var _0x277fbf=_0x1a7b4d[0xf]['replace'](/\n/g,_0x777f('0x2'));var _0x25adff=_0x1a7b4d[0x10][_0x777f('0x3')](/\n/g,'\x20');if(!arr[_0x777f('0x4')](_0x175eb3)){arr[_0x777f('0x5')](_0x175eb3);var _0x538590=_0x1a7b4d[0x3];var _0x2b8790=_0x1a7b4d[0x4];var _0x497096=_0x1a7b4d[0x1];var _0x1f2894=_0x1a7b4d[0x0];var _0x2ffad5={};_0x2ffad5[_0x777f('0x6')]=_0x1a7b4d[0x8]+_0x777f('0x7')+_0x551e5f+'|'+_0x2d2c96+'|'+_0x469ee3+'|'+_0x175eb3+'|'+_0x48ca4e;_0x2ffad5['urlOnRing']=_0x1a7b4d[0x7]+'?params='+_0x551e5f+'|'+_0x2d2c96+'|'+_0x469ee3+'|'+_0x175eb3+'|'+_0x48ca4e+'|'+_0x277fbf+'|'+_0x25adff;_0x2ffad5[_0x777f('0x8')]=_0x1a7b4d[0x9];var _0x3d35b2={};_0x3d35b2['jsonrpc']='2.0';_0x3d35b2[_0x777f('0x9')]=_0x777f('0xa');var _0x271596=[];_0x271596[_0x777f('0x5')](_0x1a7b4d[0x2]);_0x271596['push'](_0x1a7b4d[0x5]);_0x271596[_0x777f('0x5')](_0x1a7b4d[0x6]);_0x3d35b2['params']=_0x271596;_0x3d35b2['id']=0x1;var _0x4ed79f=JSON[_0x777f('0xb')](_0x3d35b2);var _0x540d5e={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x538590,'headers':{'Content-Type':_0x777f('0xc')},'body':_0x4ed79f};return rp(_0x540d5e)[_0x777f('0xd')](function(_0x436bfc){const _0x224d27=JSON[_0x777f('0xe')](_0x436bfc);if(!_0x224d27['result'][_0x777f('0xf')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x3ed8a9=_0x175eb3;var _0x144c55='channelId='+_0x497096+_0x777f('0x10')+_0x1f2894+_0x777f('0x11')+_0x3ed8a9+_0x777f('0x12')+JSON[_0x777f('0xb')](_0x2ffad5);var _0x282950=_0x2b8790+'?'+_0x144c55;return rp(_0x282950);})[_0x777f('0xd')](function(_0x4f2011){logger[_0x777f('0x13')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0xfa17c1,_0x4f2011);_0x52e256['stop']();})[_0x777f('0x14')](function(_0x3c2dde){logger[_0x777f('0x15')](_0x777f('0x16'),_0xfa17c1,_['isObject'](_0x3c2dde)?JSON[_0x777f('0xb')](_0x3c2dde):_0x3c2dde);_0x52e256[_0x777f('0x17')]();});}else{logger['info'](_0x777f('0x18'),_0xfa17c1);_0x52e256['next']();}};}; \ No newline at end of file +var _0x1fec=['catch','error','[%s][TVOX]\x20%s','isObject','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse','result','logged','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop'];(function(_0x4147e6,_0x34b084){var _0x1eeef9=function(_0x489a85){while(--_0x489a85){_0x4147e6['push'](_0x4147e6['shift']());}};_0x1eeef9(++_0x34b084);}(_0x1fec,0xbe));var _0xc1fe=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x1fec[_0x341e0f];return _0x59555a;};'use strict';var rp=require(_0xc1fe('0x0'));var logger=require(_0xc1fe('0x1'))(_0xc1fe('0x2'));var _=require('lodash');var arr=[];exports[_0xc1fe('0x3')]=function(_0x36d1cd,_0x216e31){return function(_0x443adc){var _0x36595a=_0x216e31[0xa];var _0x33c8f9=_0x216e31[0xb];var _0x5582fe=_0x216e31[0xc];var _0xe74126=_0x216e31[0xd];var _0x4647c4=_0x216e31[0xe];var _0x1ed872=_0x216e31[0xf][_0xc1fe('0x4')](/\n/g,_0xc1fe('0x5'));var _0x1d784e=_0x216e31[0x10][_0xc1fe('0x4')](/\n/g,'\x20');if(!arr[_0xc1fe('0x6')](_0x33c8f9)){arr[_0xc1fe('0x7')](_0x33c8f9);var _0x5b573e=_0x216e31[0x3];var _0x202589=_0x216e31[0x4];var _0x340f8c=_0x216e31[0x1];var _0x47c48e=_0x216e31[0x0];var _0x6997c0={};_0x6997c0['urlOnAnswer']=_0x216e31[0x8]+_0xc1fe('0x8')+_0x5582fe+'|'+_0x36595a+'|'+_0xe74126+'|'+_0x33c8f9+'|'+_0x4647c4;_0x6997c0[_0xc1fe('0x9')]=_0x216e31[0x7]+_0xc1fe('0x8')+_0x5582fe+'|'+_0x36595a+'|'+_0xe74126+'|'+_0x33c8f9+'|'+_0x4647c4+'|'+_0x1ed872+'|'+_0x1d784e;_0x6997c0[_0xc1fe('0xa')]=_0x216e31[0x9];var _0x8b3e01={};_0x8b3e01['jsonrpc']=_0xc1fe('0xb');_0x8b3e01[_0xc1fe('0xc')]=_0xc1fe('0xd');var _0x5a57fb=[];_0x5a57fb[_0xc1fe('0x7')](_0x216e31[0x2]);_0x5a57fb['push'](_0x216e31[0x5]);_0x5a57fb[_0xc1fe('0x7')](_0x216e31[0x6]);_0x8b3e01[_0xc1fe('0xe')]=_0x5a57fb;_0x8b3e01['id']=0x1;var _0x11013a=JSON[_0xc1fe('0xf')](_0x8b3e01);var _0x543f35={'encoding':'utf8','method':_0xc1fe('0x10'),'timeout':0x2710,'url':_0x5b573e,'headers':{'Content-Type':_0xc1fe('0x11')},'body':_0x11013a};return rp(_0x543f35)[_0xc1fe('0x12')](function(_0x47dc84){const _0x3c6e23=JSON[_0xc1fe('0x13')](_0x47dc84);if(!_0x3c6e23[_0xc1fe('0x14')][_0xc1fe('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x4b61a8=_0x33c8f9;var _0x2ea025='channelId='+_0x340f8c+_0xc1fe('0x16')+_0x47c48e+'&sessionId='+_0x4b61a8+_0xc1fe('0x17')+JSON[_0xc1fe('0xf')](_0x6997c0);var _0x425541=_0x202589+'?'+_0x2ea025;return rp(_0x425541);})['then'](function(_0x4545d5){logger[_0xc1fe('0x18')](_0xc1fe('0x19'),_0x36d1cd,_0x4545d5);_0x443adc[_0xc1fe('0x1a')]();})[_0xc1fe('0x1b')](function(_0x1c862c){logger[_0xc1fe('0x1c')](_0xc1fe('0x1d'),_0x36d1cd,_[_0xc1fe('0x1e')](_0x1c862c)?JSON['stringify'](_0x1c862c):_0x1c862c);_0x443adc[_0xc1fe('0x1a')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x36d1cd);_0x443adc['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 5d644c5..a2206a6 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x389292,_0x28a87b){var _0x1a4edb=function(_0x5ce9a9){while(--_0x5ce9a9){_0x389292['push'](_0x389292['shift']());}};_0x1a4edb(++_0x28a87b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x1f8c39,_0x2ce10e){var _0x23f1d5=function(_0x290f4b){while(--_0x290f4b){_0x1f8c39['push'](_0x1f8c39['shift']());}};_0x23f1d5(++_0x2ce10e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ae2b912..88157e0 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 _0x1893=['tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','condition','intervals','consequence','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','complete','info','No\x20applications\x20to\x20execute','error','stack','agent','agents','busy','channel','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflowv2','tag','TagId'];(function(_0x4cd14a,_0x3c08b4){var _0x59ac6a=function(_0x5d95ec){while(--_0x5d95ec){_0x4cd14a['push'](_0x4cd14a['shift']());}};_0x59ac6a(++_0x3c08b4);}(_0x1893,0xa2));var _0x3189=function(_0x2355a4,_0xc0b80d){_0x2355a4=_0x2355a4-0x0;var _0xe22dd=_0x1893[_0x2355a4];return _0xe22dd;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x3189('0x0'));var fs=require('fs');var jayson=require(_0x3189('0x1'));var BPromise=require(_0x3189('0x2'));var utils=require(_0x3189('0x3'));var sUtils=require(_0x3189('0x4'));var logger=require(_0x3189('0x5'))(_0x3189('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3189('0x7')),'chatQueueReport':require(_0x3189('0x8')),'smsQueueReport':require(_0x3189('0x9')),'faxQueueReport':require(_0x3189('0xa')),'whatsappQueueReport':require(_0x3189('0xb'))};var RuleEngine=require(_0x3189('0xc'));function getId(_0x14d84b,_0x1f6764,_0x5312a3){return util[_0x3189('0xd')]('%s.%s.%s',_0x14d84b,_0x1f6764||0x0,_0x5312a3||0x0);}function getIntervals(_0x127449,_0x4ac683){var _0x3ec9d0=[];if(!_[_0x3189('0xe')](_0x4ac683[_0x3189('0xf')])&&!_[_0x3189('0xe')](_0x127449[_0x4ac683['IntervalId']])&&!_[_0x3189('0xe')](_0x127449[_0x4ac683[_0x3189('0xf')]][_0x3189('0x10')])){_0x3ec9d0=_[_0x3189('0x11')](_0x127449[_0x4ac683[_0x3189('0xf')]]['Intervals'],_0x3189('0x12'));}else if(!_[_0x3189('0xe')](_0x4ac683[_0x3189('0x12')])){_0x3ec9d0=[_0x4ac683[_0x3189('0x12')]];}return _0x3ec9d0;}exports[_0x3189('0x13')]=function(_0x20dcc2){_0x20dcc2[_0x3189('0x14')]={};return new BPromise(function(_0x25a917,_0x5521bb){var _0x220b18={'Start':function(_0xb3e4c2){var _0x1c209b=this;return new Promise(function(_0x2fb62b,_0x486dd2){if(_0xb3e4c2){try{var _0x40195d=[];var _0x5f2e82=getId(_0xb3e4c2['channel'],_0xb3e4c2[_0x3189('0x15')]?_0xb3e4c2['message']['id']:0x0,_0xb3e4c2[_0x3189('0x16')]?_0xb3e4c2[_0x3189('0x16')]['id']:0x0);var _0x22c7ba=sUtils[_0x3189('0x17')](_0x20dcc2,_0xb3e4c2);if(_0xb3e4c2['transfer']||!_0x22c7ba&&_0xb3e4c2[_0x3189('0x18')]&&_[_0x3189('0x19')](_0xb3e4c2[_0x3189('0x18')])&&_0xb3e4c2['applications'][_0x3189('0x1a')]){for(var _0xb0e89b=0x0;_0xb0e89b<_0xb3e4c2[_0x3189('0x18')][_0x3189('0x1a')];_0xb0e89b+=0x1){var _0x29b275=_0xb3e4c2['applications'][_0xb0e89b];if(fs[_0x3189('0x1b')](path[_0x3189('0x1c')](__dirname,_0x3189('0x18'),_0x29b275['app']+_0x3189('0x1d')))){var _0x47abb4=[];switch(_0x29b275[_0x3189('0x1e')][_0x3189('0x1f')]()){case _0x3189('0x20'):var _0x38e56a=_0x29b275[_0x3189('0x21')][_0x3189('0x22')](',');if(_0xb3e4c2['channel']==='mail'){_0x47abb4[_0x3189('0x23')](_0x38e56a[0x0]);_0x47abb4[_0x3189('0x23')](_0x38e56a[0x1]);_0x47abb4[_0x3189('0x23')](_0x38e56a[_0x3189('0x24')](0x2,_0x38e56a[_0x3189('0x1a')])[_0x3189('0x1c')](','));}else{_0x47abb4[_0x3189('0x23')](_0x38e56a[0x0]);_0x47abb4[_0x3189('0x23')](_0x38e56a[_0x3189('0x24')](0x1,_0x38e56a[_0x3189('0x1a')])['join'](','));}break;case'dialogflow':var _0x5aa34a=_0x29b275[_0x3189('0x21')][_0x3189('0x22')](',');_0x47abb4[_0x3189('0x23')](_0x5aa34a[0x0]);_0x47abb4[_0x3189('0x23')](_0x5aa34a[0x1]);_0x47abb4[_0x3189('0x23')](_0x5aa34a[_0x3189('0x24')](0x2,_0x5aa34a['length'])[_0x3189('0x1c')](','));break;case _0x3189('0x25'):var _0x4bd677=_0x29b275[_0x3189('0x21')][_0x3189('0x22')](',');_0x47abb4[_0x3189('0x23')](_0x4bd677[0x0]);_0x47abb4['push'](_0x4bd677[0x1]);_0x47abb4[_0x3189('0x23')](_0x4bd677[0x2]);_0x47abb4[_0x3189('0x23')](_0x4bd677[0x3]);_0x47abb4[_0x3189('0x23')](_0x4bd677['slice'](0x4,_0x4bd677[_0x3189('0x1a')])[_0x3189('0x1c')](','));break;case'amazonlex':var _0x32ca90=_0x29b275[_0x3189('0x21')][_0x3189('0x22')](',');_0x47abb4[_0x3189('0x23')](_0x32ca90[0x0]);_0x47abb4[_0x3189('0x23')](_0x32ca90[0x1]);_0x47abb4['push'](_0x32ca90[0x2]);_0x47abb4['push'](_0x32ca90[0x3]);_0x47abb4[_0x3189('0x23')](_0x32ca90['slice'](0x4,_0x32ca90[_0x3189('0x1a')])[_0x3189('0x1c')](','));break;case _0x3189('0x15'):_0x47abb4[_0x3189('0x23')](_0x29b275[_0x3189('0x21')]);break;case _0x3189('0x26'):_0x47abb4[_0x3189('0x23')](_0x29b275[_0x3189('0x27')]);_0x47abb4[_0x3189('0x23')](_0x29b275['appdata']);break;case _0x3189('0x28'):var _0x21b4fe=utils[_0x3189('0x29')](_0xb3e4c2[_0x3189('0x2a')][_0x3189('0x2b')],_0xb3e4c2);var _0x3a3e01=_0x29b275[_0x3189('0x21')]['split'](',');_0x47abb4['push'](_0x3a3e01[0x0]);_0x47abb4[_0x3189('0x23')](_0x3a3e01[0x1]);_0x47abb4['push'](_0x3a3e01[0x2]);_0x47abb4[_0x3189('0x23')](_0x3a3e01[0x3]);_0x47abb4[_0x3189('0x23')](_0x3a3e01[0x4]);_0x47abb4['push'](_0x3a3e01[0x5]);_0x47abb4[_0x3189('0x23')](_0x3a3e01[0x6]);_0x47abb4[_0x3189('0x23')](_0x3a3e01[0x7]);_0x47abb4[_0x3189('0x23')](_0x3a3e01[0x8]);_0x47abb4[_0x3189('0x23')](_0x3a3e01[0x9]);_0x47abb4['push'](_0x3a3e01[0xa]);_0x47abb4[_0x3189('0x23')](_0xb3e4c2['interaction']['id']);_0x47abb4['push'](_0xb3e4c2[_0x3189('0x15')]['id']);_0x47abb4[_0x3189('0x23')](_0x29b275[_0x3189('0x2c')]);_0x47abb4[_0x3189('0x23')](_0xb3e4c2[_0x3189('0x16')][_0x3189('0x2d')]);_0x47abb4[_0x3189('0x23')](_0xb3e4c2[_0x3189('0x2e')]['body']);_0x47abb4['push'](_0x21b4fe);break;default:_0x47abb4=_[_0x3189('0xe')](_0x29b275[_0x3189('0x21')])?[]:_0x29b275[_0x3189('0x21')][_0x3189('0x22')](',');}var _0x27613f={'id':util[_0x3189('0xd')]('%s:%s:%s',_0x5f2e82,_0x29b275['id'],_0x29b275[_0x3189('0x1e')]),'condition':require(_0x3189('0x2f'))[_0x3189('0x30')](_0x5f2e82,getIntervals(_0x20dcc2[_0x3189('0x31')],_0x29b275),_0x20dcc2),'consequence':require('./applications/'+_0x29b275[_0x3189('0x1e')])[_0x3189('0x32')](_0x5f2e82,_0x47abb4,_0x20dcc2,_0xb3e4c2),'p':_0x29b275['priority']||0x0};logger['info'](_0x3189('0x33'),_0x27613f['id'],'on\x20interval',getIntervals(_0x20dcc2[_0x3189('0x31')],_0x29b275)[_0x3189('0x1c')](_0x3189('0x34')));_0x40195d[_0x3189('0x23')](_0x27613f);}else{logger['error'](_0x3189('0x35'),path[_0x3189('0x1c')](__dirname,'applications',_0x29b275[_0x3189('0x1e')]+_0x3189('0x1d')));}}_0x20dcc2[_0x3189('0x14')][_0x5f2e82]=new RuleEngine(_0x40195d);_0x20dcc2[_0x3189('0x14')][_0x5f2e82][_0x3189('0x36')](_0xb3e4c2,function(_0x596ec3){logger['info'](_0x3189('0x37'),JSON['stringify'](_0x596ec3[_0x3189('0x38')]));if(_0x20dcc2[_0x3189('0x14')][_0x5f2e82]){_0x20dcc2[_0x3189('0x14')][_0x5f2e82]['emit'](_0x3189('0x39'));}});return _0x2fb62b({'code':0xc8,'message':_0xb3e4c2});}else{if(_0x22c7ba){logger[_0x3189('0x3a')](util[_0x3189('0xd')]('Skipped\x20routing\x20for\x20%s',_0x5f2e82));}else{logger[_0x3189('0x3a')](_0x3189('0x3b'));}return _0x2fb62b({'code':0xc8,'message':_0xb3e4c2});}}catch(_0x151ab4){logger[_0x3189('0x3c')](_0x151ab4[_0x3189('0x3d')]);return _0x486dd2(_0x1c209b[_0x3189('0x3c')](0x1f4,_0x151ab4));}}return _0x486dd2('routing\x20is\x20empty');});},'AcceptMessage':function(_0x47d22d){var _0x28d404=this;return new Promise(function(_0x502477,_0x4c6dd5){if(_0x47d22d[_0x3189('0x3e')]&&_0x47d22d['agent']['id']){if(_0x20dcc2[_0x3189('0x3f')][_0x47d22d[_0x3189('0x3e')]['id']]){_0x20dcc2[_0x3189('0x3f')][_0x47d22d['agent']['id']][_0x3189('0x40')]=![];_0x20dcc2['agents'][_0x47d22d[_0x3189('0x3e')]['id']]['busyQueue']=undefined;}}if(_0x47d22d['message']&&_0x47d22d[_0x3189('0x15')]['id']){try{var _0x47a844=getId(_0x47d22d[_0x3189('0x41')],_0x47d22d['message']?_0x47d22d['message']['id']:0x0,_0x47d22d[_0x3189('0x16')]?_0x47d22d[_0x3189('0x16')]['id']:0x0);if(_0x20dcc2[_0x3189('0x14')][_0x47a844]){_0x20dcc2[_0x3189('0x14')][_0x47a844][_0x3189('0x42')](_0x3189('0x43'));if(rpc[_0x47d22d['channel']+_0x3189('0x44')]){rpc[_0x47d22d['channel']+'QueueReport'][_0x3189('0x45')](_0x47a844,{'UserId':_0x47d22d[_0x3189('0x15')][_0x3189('0x46')]})[_0x3189('0x47')](function(){logger[_0x3189('0x3c')](_0x3189('0x48'));});}}return _0x502477({'code':0xc8,'message':_0x47d22d});}catch(_0x556ee5){logger[_0x3189('0x3c')](_0x556ee5['stack']);return _0x4c6dd5(_0x28d404[_0x3189('0x3c')](0x1f4,_0x556ee5));}}logger[_0x3189('0x3c')](_0x3189('0x49'));return _0x4c6dd5(_0x28d404[_0x3189('0x3c')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1d3389){var _0x2ec48d=this;return new Promise(function(_0x5c7451,_0x3f8179){if(_0x1d3389[_0x3189('0x3e')]&&_0x1d3389[_0x3189('0x3e')]['id']){try{if(_0x20dcc2[_0x3189('0x3f')][_0x1d3389['agent']['id']]){_0x20dcc2[_0x3189('0x3f')][_0x1d3389['agent']['id']][_0x3189('0x40')]=![];_0x20dcc2['agents'][_0x1d3389[_0x3189('0x3e')]['id']][_0x3189('0x4a')]=undefined;}return _0x5c7451({'code':0xc8,'message':_0x1d3389});}catch(_0x5e5b11){logger['error'](_0x5e5b11['stack']);return _0x3f8179(_0x2ec48d[_0x3189('0x3c')](0x1f4,_0x5e5b11));}}logger['error'](_0x3189('0x49'));return _0x3f8179(_0x2ec48d[_0x3189('0x3c')](0x1f4,_0x3189('0x49')));});},'AbandonInteraction':function(_0x34e07b){var _0x2d2d77=this;return new Promise(function(_0x40623f,_0x26d15e){if(_0x34e07b[_0x3189('0x41')]&&_0x34e07b[_0x3189('0x16')]&&_0x34e07b['interaction']['id']){try{var _0x1f2f11=getId(_0x34e07b[_0x3189('0x41')],_0x34e07b[_0x3189('0x15')]?_0x34e07b[_0x3189('0x15')]['id']:0x0,_0x34e07b[_0x3189('0x16')]?_0x34e07b[_0x3189('0x16')]['id']:0x0);if(_0x20dcc2[_0x3189('0x14')][_0x1f2f11]){_0x20dcc2[_0x3189('0x14')][_0x1f2f11][_0x3189('0x42')](_0x3189('0x43'));}return _0x40623f({'code':0xc8,'message':_0x34e07b});}catch(_0x187877){logger[_0x3189('0x3c')](_0x187877['stack']);return _0x26d15e(_0x2d2d77['error'](0x1f4,_0x187877));}}logger[_0x3189('0x3c')](_0x3189('0x49'));return _0x26d15e(_0x2d2d77[_0x3189('0x3c')](0x1f4,_0x3189('0x49')));});},'AgentCapacity':function(_0x41ef50){var _0x3b8f96=this;return new Promise(function(_0x27354e,_0x37f95c){if(_0x20dcc2[_0x3189('0x3f')][_0x3189('0x4b')](_0x41ef50['id'])){for(var _0xd45395 in _0x41ef50['capacity']){if(_0x41ef50['capacity']['hasOwnProperty'](_0xd45395)){if(_0x20dcc2[_0x3189('0x3f')][_0x41ef50['id']][_0x3189('0x4b')](_0xd45395+'CurrentCapacity')){_0x20dcc2[_0x3189('0x3f')][_0x41ef50['id']][_0xd45395+_0x3189('0x4c')]=parseInt(_0x41ef50[_0x3189('0x4d')][_0xd45395],0xa);}}}_0x20dcc2[_0x3189('0x3f')][_0x41ef50['id']][_0x3189('0x4e')]();return _0x27354e({'code':0xc8,'message':_0x20dcc2['agents'][_0x41ef50['id']]});}else{return _0x37f95c(_0x3b8f96[_0x3189('0x3c')](0x1f4,_0x3189('0x4f')));}});},'Agents':function(_0x7940f4){return new Promise(function(_0x228dfc){var _0x5d8bf8=_[_0x3189('0x50')](_0x20dcc2[_0x3189('0x3f')]);if(_0x7940f4&&_0x7940f4['id']){var _0x103e3c=_[_0x3189('0x51')](_0x5d8bf8,function(_0x4a7172){return _0x4a7172['id']===_0x7940f4['id'];});_0x228dfc(_0x103e3c);}else{_0x228dfc({'count':_0x5d8bf8[_0x3189('0x1a')],'rows':_0x5d8bf8});}});},'ChatQueues':function(){return new Promise(function(_0x4c4bb9){var _0x1d7a44=[];for(var _0x448635 in _0x20dcc2[_0x3189('0x52')]){if(_0x20dcc2[_0x3189('0x52')][_0x3189('0x4b')](_0x448635)){var _0x271c34=_0x20dcc2[_0x3189('0x52')][_0x448635];var _0x112200={'id':_0x271c34['id'],'available':_0x271c34[_0x3189('0x53')],'loggedIn':_0x271c34[_0x3189('0x54')],'name':_0x271c34[_0x3189('0x55')],'paused':_0x271c34['paused'],'waiting':_0x271c34[_0x3189('0x56')]};_0x1d7a44[_0x3189('0x23')](_0x112200);}}_0x4c4bb9({'count':_0x1d7a44[_0x3189('0x1a')],'rows':_0x1d7a44});});},'MailQueues':function(){return new Promise(function(_0xdf29c3){var _0x141abf=[];for(var _0x512478 in _0x20dcc2[_0x3189('0x57')]){if(_0x20dcc2['mailQueues'][_0x3189('0x4b')](_0x512478)){var _0x7a9bd2=_0x20dcc2[_0x3189('0x57')][_0x512478];var _0x221605={'id':_0x7a9bd2['id'],'available':_0x7a9bd2[_0x3189('0x53')],'loggedIn':_0x7a9bd2[_0x3189('0x54')],'name':_0x7a9bd2[_0x3189('0x55')],'paused':_0x7a9bd2[_0x3189('0x58')],'waiting':_0x7a9bd2['waiting']};_0x141abf[_0x3189('0x23')](_0x221605);}}_0xdf29c3({'count':_0x141abf['length'],'rows':_0x141abf});});},'OpenchannelQueues':function(){return new Promise(function(_0x26e587){var _0x2eedf4=[];for(var _0xf740b0 in _0x20dcc2[_0x3189('0x59')]){if(_0x20dcc2[_0x3189('0x59')][_0x3189('0x4b')](_0xf740b0)){var _0x47fe84=_0x20dcc2[_0x3189('0x59')][_0xf740b0];var _0x265eb5={'id':_0x47fe84['id'],'available':_0x47fe84['available'],'loggedIn':_0x47fe84[_0x3189('0x54')],'name':_0x47fe84['name'],'paused':_0x47fe84[_0x3189('0x58')],'waiting':_0x47fe84[_0x3189('0x56')]};_0x2eedf4[_0x3189('0x23')](_0x265eb5);}}_0x26e587({'count':_0x2eedf4['length'],'rows':_0x2eedf4});});},'SmsQueues':function(){return new Promise(function(_0x5679e9){var _0x15db7d=[];for(var _0x5ae038 in _0x20dcc2[_0x3189('0x5a')]){if(_0x20dcc2['smsQueues'][_0x3189('0x4b')](_0x5ae038)){var _0x285b0d=_0x20dcc2['smsQueues'][_0x5ae038];var _0x3a40d7={'id':_0x285b0d['id'],'available':_0x285b0d[_0x3189('0x53')],'loggedIn':_0x285b0d[_0x3189('0x54')],'name':_0x285b0d['name'],'paused':_0x285b0d[_0x3189('0x58')],'waiting':_0x285b0d[_0x3189('0x56')]};_0x15db7d[_0x3189('0x23')](_0x3a40d7);}}_0x5679e9({'count':_0x15db7d['length'],'rows':_0x15db7d});});},'FaxQueues':function(){return new Promise(function(_0x521230){var _0x212a59=[];for(var _0x25d767 in _0x20dcc2[_0x3189('0x5b')]){if(_0x20dcc2['faxQueues'][_0x3189('0x4b')](_0x25d767)){var _0x3d57e5=_0x20dcc2[_0x3189('0x5b')][_0x25d767];var _0x438d08={'id':_0x3d57e5['id'],'available':_0x3d57e5[_0x3189('0x53')],'loggedIn':_0x3d57e5[_0x3189('0x54')],'name':_0x3d57e5[_0x3189('0x55')],'paused':_0x3d57e5[_0x3189('0x58')],'waiting':_0x3d57e5[_0x3189('0x56')]};_0x212a59[_0x3189('0x23')](_0x438d08);}}_0x521230({'count':_0x212a59['length'],'rows':_0x212a59});});},'WhatsappQueues':function(){return new Promise(function(_0xf0f7a7){var _0x575ede=[];for(var _0x3c82f8 in _0x20dcc2[_0x3189('0x5c')]){if(_0x20dcc2[_0x3189('0x5c')][_0x3189('0x4b')](_0x3c82f8)){var _0xc00abb=_0x20dcc2[_0x3189('0x5c')][_0x3c82f8];var _0x54b7ee={'id':_0xc00abb['id'],'available':_0xc00abb[_0x3189('0x53')],'loggedIn':_0xc00abb['loggedIn'],'name':_0xc00abb[_0x3189('0x55')],'paused':_0xc00abb[_0x3189('0x58')],'waiting':_0xc00abb[_0x3189('0x56')]};_0x575ede[_0x3189('0x23')](_0x54b7ee);}}_0xf0f7a7({'count':_0x575ede['length'],'rows':_0x575ede});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5b4596){var _0x17cb5c=_[_0x3189('0x50')](_0x20dcc2[_0x3189('0x5d')]);_0x5b4596({'count':_0x17cb5c[_0x3189('0x1a')],'rows':_0x17cb5c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4a7908){var _0x4ce3c7=_[_0x3189('0x50')](_0x20dcc2['mailQueuesWaitingInteractions']);_0x4a7908({'count':_0x4ce3c7[_0x3189('0x1a')],'rows':_0x4ce3c7});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x65c13f){var _0x56f3c1=_[_0x3189('0x50')](_0x20dcc2[_0x3189('0x5e')]);_0x65c13f({'count':_0x56f3c1['length'],'rows':_0x56f3c1});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5cabcc){var _0x14b0f7=_['values'](_0x20dcc2[_0x3189('0x5f')]);_0x5cabcc({'count':_0x14b0f7[_0x3189('0x1a')],'rows':_0x14b0f7});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x45a672){var _0x59a625=_[_0x3189('0x50')](_0x20dcc2['faxQueuesWaitingInteractions']);_0x45a672({'count':_0x59a625['length'],'rows':_0x59a625});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1c869a){var _0x51799c=_[_0x3189('0x50')](_0x20dcc2['whatsappQueuesWaitingInteractions']);_0x1c869a({'count':_0x51799c['length'],'rows':_0x51799c});});}};var _0x51303a=jayson[_0x3189('0x60')](_0x220b18)['http']();_0x51303a['on'](_0x3189('0x3c'),function(_0x3db037){logger[_0x3189('0x3c')](JSON[_0x3189('0x61')](_0x3db037));return _0x5521bb(_0x3db037);});_0x51303a[_0x3189('0x13')](0x232c,_0x3189('0x62'),function(){console['log'](_0x3189('0x63'),0x232c);return _0x25a917(_0x3189('0x64')+0x232c);});});}; \ No newline at end of file +var _0x4baa=['\x20|\x20','error','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busy','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','listen','rules','channel','message','interaction','transfer','applications','isArray','existsSync','app','.js','toLowerCase','mail','push','length','join','slice','dialogflow','appdata','split','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info'];(function(_0x103693,_0x55206e){var _0x2fe9f1=function(_0x2e5d24){while(--_0x2e5d24){_0x103693['push'](_0x103693['shift']());}};_0x2fe9f1(++_0x55206e);}(_0x4baa,0x14f));var _0xa4ba=function(_0x5532e1,_0x388cd1){_0x5532e1=_0x5532e1-0x0;var _0x276bb5=_0x4baa[_0x5532e1];return _0x276bb5;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0xa4ba('0x0'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xa4ba('0x1'));var utils=require(_0xa4ba('0x2'));var sUtils=require(_0xa4ba('0x3'));var logger=require(_0xa4ba('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0xa4ba('0x5')),'mailQueueReport':require(_0xa4ba('0x6')),'chatQueueReport':require(_0xa4ba('0x7')),'smsQueueReport':require(_0xa4ba('0x8')),'faxQueueReport':require(_0xa4ba('0x9')),'whatsappQueueReport':require(_0xa4ba('0xa'))};var RuleEngine=require(_0xa4ba('0xb'));function getId(_0x210c7c,_0x7e0ed6,_0x4a83ac){return util[_0xa4ba('0xc')](_0xa4ba('0xd'),_0x210c7c,_0x7e0ed6||0x0,_0x4a83ac||0x0);}function getIntervals(_0x5c930f,_0x39c04b){var _0x54af71=[];if(!_[_0xa4ba('0xe')](_0x39c04b['IntervalId'])&&!_[_0xa4ba('0xe')](_0x5c930f[_0x39c04b[_0xa4ba('0xf')]])&&!_[_0xa4ba('0xe')](_0x5c930f[_0x39c04b[_0xa4ba('0xf')]][_0xa4ba('0x10')])){_0x54af71=_['map'](_0x5c930f[_0x39c04b[_0xa4ba('0xf')]]['Intervals'],'interval');}else if(!_['isNil'](_0x39c04b['interval'])){_0x54af71=[_0x39c04b['interval']];}return _0x54af71;}exports[_0xa4ba('0x11')]=function(_0x57f585){_0x57f585[_0xa4ba('0x12')]={};return new BPromise(function(_0x11eb49,_0xb08c14){var _0x1651be={'Start':function(_0x3e91fa){var _0x8c4857=this;return new Promise(function(_0x26696b,_0x2366bc){if(_0x3e91fa){try{var _0x9a97af=[];var _0x3c82dd=getId(_0x3e91fa[_0xa4ba('0x13')],_0x3e91fa[_0xa4ba('0x14')]?_0x3e91fa[_0xa4ba('0x14')]['id']:0x0,_0x3e91fa[_0xa4ba('0x15')]?_0x3e91fa['interaction']['id']:0x0);var _0x567685=sUtils['checkWaitingNotifications'](_0x57f585,_0x3e91fa);if(_0x3e91fa[_0xa4ba('0x16')]||!_0x567685&&_0x3e91fa[_0xa4ba('0x17')]&&_[_0xa4ba('0x18')](_0x3e91fa[_0xa4ba('0x17')])&&_0x3e91fa[_0xa4ba('0x17')]['length']){for(var _0x44e50d=0x0;_0x44e50d<_0x3e91fa[_0xa4ba('0x17')]['length'];_0x44e50d+=0x1){var _0x14c61e=_0x3e91fa[_0xa4ba('0x17')][_0x44e50d];if(fs[_0xa4ba('0x19')](path['join'](__dirname,'applications',_0x14c61e[_0xa4ba('0x1a')]+_0xa4ba('0x1b')))){var _0x366712=[];switch(_0x14c61e[_0xa4ba('0x1a')][_0xa4ba('0x1c')]()){case'autoreply':var _0x4c117c=_0x14c61e['appdata']['split'](',');if(_0x3e91fa['channel']===_0xa4ba('0x1d')){_0x366712[_0xa4ba('0x1e')](_0x4c117c[0x0]);_0x366712[_0xa4ba('0x1e')](_0x4c117c[0x1]);_0x366712['push'](_0x4c117c['slice'](0x2,_0x4c117c[_0xa4ba('0x1f')])[_0xa4ba('0x20')](','));}else{_0x366712[_0xa4ba('0x1e')](_0x4c117c[0x0]);_0x366712[_0xa4ba('0x1e')](_0x4c117c[_0xa4ba('0x21')](0x1,_0x4c117c[_0xa4ba('0x1f')])[_0xa4ba('0x20')](','));}break;case _0xa4ba('0x22'):var _0x3b4a1d=_0x14c61e[_0xa4ba('0x23')][_0xa4ba('0x24')](',');_0x366712['push'](_0x3b4a1d[0x0]);_0x366712[_0xa4ba('0x1e')](_0x3b4a1d[0x1]);_0x366712['push'](_0x3b4a1d[_0xa4ba('0x21')](0x2,_0x3b4a1d['length'])[_0xa4ba('0x20')](','));break;case _0xa4ba('0x25'):var _0x47592e=_0x14c61e[_0xa4ba('0x23')]['split'](',');_0x366712[_0xa4ba('0x1e')](_0x47592e[0x0]);_0x366712['push'](_0x47592e[0x1]);_0x366712[_0xa4ba('0x1e')](_0x47592e[0x2]);_0x366712[_0xa4ba('0x1e')](_0x47592e[0x3]);_0x366712[_0xa4ba('0x1e')](_0x47592e[_0xa4ba('0x21')](0x4,_0x47592e[_0xa4ba('0x1f')])['join'](','));break;case _0xa4ba('0x26'):var _0x3bf019=_0x14c61e['appdata'][_0xa4ba('0x24')](',');_0x366712['push'](_0x3bf019[0x0]);_0x366712[_0xa4ba('0x1e')](_0x3bf019[0x1]);_0x366712[_0xa4ba('0x1e')](_0x3bf019[0x2]);_0x366712[_0xa4ba('0x1e')](_0x3bf019[0x3]);_0x366712[_0xa4ba('0x1e')](_0x3bf019[_0xa4ba('0x21')](0x4,_0x3bf019['length'])['join'](','));break;case _0xa4ba('0x14'):_0x366712['push'](_0x14c61e[_0xa4ba('0x23')]);break;case _0xa4ba('0x27'):_0x366712[_0xa4ba('0x1e')](_0x14c61e['TagId']);_0x366712[_0xa4ba('0x1e')](_0x14c61e[_0xa4ba('0x23')]);break;case _0xa4ba('0x28'):var _0x3edb2a=utils[_0xa4ba('0x29')](_0x3e91fa[_0xa4ba('0x2a')][_0xa4ba('0x2b')],_0x3e91fa);var _0x1b202e=_0x14c61e[_0xa4ba('0x23')]['split'](',');_0x366712['push'](_0x1b202e[0x0]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x1]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x2]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x3]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x4]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x5]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x6]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x7]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x8]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0x9]);_0x366712[_0xa4ba('0x1e')](_0x1b202e[0xa]);_0x366712[_0xa4ba('0x1e')](_0x3e91fa[_0xa4ba('0x15')]['id']);_0x366712[_0xa4ba('0x1e')](_0x3e91fa[_0xa4ba('0x14')]['id']);_0x366712[_0xa4ba('0x1e')](_0x14c61e['ChatWebsiteId']);_0x366712[_0xa4ba('0x1e')](_0x3e91fa['interaction'][_0xa4ba('0x2c')]);_0x366712['push'](_0x3e91fa[_0xa4ba('0x2d')][_0xa4ba('0x2d')]);_0x366712[_0xa4ba('0x1e')](_0x3edb2a);break;default:_0x366712=_['isNil'](_0x14c61e['appdata'])?[]:_0x14c61e[_0xa4ba('0x23')][_0xa4ba('0x24')](',');}var _0x4dfeba={'id':util[_0xa4ba('0xc')](_0xa4ba('0x2e'),_0x3c82dd,_0x14c61e['id'],_0x14c61e[_0xa4ba('0x1a')]),'condition':require('./interval')[_0xa4ba('0x2f')](_0x3c82dd,getIntervals(_0x57f585[_0xa4ba('0x30')],_0x14c61e),_0x57f585),'consequence':require(_0xa4ba('0x31')+_0x14c61e[_0xa4ba('0x1a')])[_0xa4ba('0x32')](_0x3c82dd,_0x366712,_0x57f585,_0x3e91fa),'p':_0x14c61e[_0xa4ba('0x33')]||0x0};logger[_0xa4ba('0x34')]('Push\x20new\x20rule',_0x4dfeba['id'],'on\x20interval',getIntervals(_0x57f585['intervals'],_0x14c61e)[_0xa4ba('0x20')](_0xa4ba('0x35')));_0x9a97af[_0xa4ba('0x1e')](_0x4dfeba);}else{logger[_0xa4ba('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xa4ba('0x20')](__dirname,'applications',_0x14c61e['app']+_0xa4ba('0x1b')));}}_0x57f585[_0xa4ba('0x12')][_0x3c82dd]=new RuleEngine(_0x9a97af);_0x57f585['rules'][_0x3c82dd]['execute'](_0x3e91fa,function(_0x5a3e61){logger[_0xa4ba('0x34')](_0xa4ba('0x37'),JSON[_0xa4ba('0x38')](_0x5a3e61[_0xa4ba('0x39')]));if(_0x57f585[_0xa4ba('0x12')][_0x3c82dd]){_0x57f585[_0xa4ba('0x12')][_0x3c82dd][_0xa4ba('0x3a')](_0xa4ba('0x3b'));}});return _0x26696b({'code':0xc8,'message':_0x3e91fa});}else{if(_0x567685){logger[_0xa4ba('0x34')](util[_0xa4ba('0xc')](_0xa4ba('0x3c'),_0x3c82dd));}else{logger['info'](_0xa4ba('0x3d'));}return _0x26696b({'code':0xc8,'message':_0x3e91fa});}}catch(_0x594bbd){logger[_0xa4ba('0x36')](_0x594bbd[_0xa4ba('0x3e')]);return _0x2366bc(_0x8c4857[_0xa4ba('0x36')](0x1f4,_0x594bbd));}}return _0x2366bc('routing\x20is\x20empty');});},'AcceptMessage':function(_0x80b9b){var _0x2c793f=this;return new Promise(function(_0x103eea,_0x5bda80){if(_0x80b9b['agent']&&_0x80b9b[_0xa4ba('0x3f')]['id']){if(_0x57f585[_0xa4ba('0x40')][_0x80b9b[_0xa4ba('0x3f')]['id']]){_0x57f585[_0xa4ba('0x40')][_0x80b9b[_0xa4ba('0x3f')]['id']][_0xa4ba('0x41')]=![];_0x57f585['agents'][_0x80b9b['agent']['id']]['busyQueue']=undefined;}}if(_0x80b9b[_0xa4ba('0x14')]&&_0x80b9b[_0xa4ba('0x14')]['id']){try{var _0x4c5c95=getId(_0x80b9b['channel'],_0x80b9b['message']?_0x80b9b['message']['id']:0x0,_0x80b9b['interaction']?_0x80b9b[_0xa4ba('0x15')]['id']:0x0);if(_0x57f585['rules'][_0x4c5c95]){_0x57f585[_0xa4ba('0x12')][_0x4c5c95][_0xa4ba('0x3a')](_0xa4ba('0x42'));if(rpc[_0x80b9b[_0xa4ba('0x13')]+'QueueReport']){rpc[_0x80b9b['channel']+'QueueReport'][_0xa4ba('0x43')](_0x4c5c95,{'UserId':_0x80b9b[_0xa4ba('0x14')][_0xa4ba('0x44')]})[_0xa4ba('0x45')](function(){logger['error'](_0xa4ba('0x46'));});}}return _0x103eea({'code':0xc8,'message':_0x80b9b});}catch(_0x238a57){logger[_0xa4ba('0x36')](_0x238a57[_0xa4ba('0x3e')]);return _0x5bda80(_0x2c793f['error'](0x1f4,_0x238a57));}}logger['error'](_0xa4ba('0x47'));return _0x5bda80(_0x2c793f[_0xa4ba('0x36')](0x1f4,_0xa4ba('0x47')));});},'RejectMessage':function(_0x3ab97e){var _0xed7251=this;return new Promise(function(_0x235361,_0xc3f4f9){if(_0x3ab97e[_0xa4ba('0x3f')]&&_0x3ab97e[_0xa4ba('0x3f')]['id']){try{if(_0x57f585[_0xa4ba('0x40')][_0x3ab97e[_0xa4ba('0x3f')]['id']]){_0x57f585[_0xa4ba('0x40')][_0x3ab97e['agent']['id']][_0xa4ba('0x41')]=![];_0x57f585[_0xa4ba('0x40')][_0x3ab97e['agent']['id']]['busyQueue']=undefined;}return _0x235361({'code':0xc8,'message':_0x3ab97e});}catch(_0x5c06d5){logger['error'](_0x5c06d5[_0xa4ba('0x3e')]);return _0xc3f4f9(_0xed7251[_0xa4ba('0x36')](0x1f4,_0x5c06d5));}}logger[_0xa4ba('0x36')](_0xa4ba('0x47'));return _0xc3f4f9(_0xed7251[_0xa4ba('0x36')](0x1f4,_0xa4ba('0x47')));});},'AbandonInteraction':function(_0x4656fc){var _0x416355=this;return new Promise(function(_0x1c1b4f,_0x4bc651){if(_0x4656fc[_0xa4ba('0x13')]&&_0x4656fc[_0xa4ba('0x15')]&&_0x4656fc[_0xa4ba('0x15')]['id']){try{var _0x25e36c=getId(_0x4656fc[_0xa4ba('0x13')],_0x4656fc[_0xa4ba('0x14')]?_0x4656fc[_0xa4ba('0x14')]['id']:0x0,_0x4656fc[_0xa4ba('0x15')]?_0x4656fc[_0xa4ba('0x15')]['id']:0x0);if(_0x57f585[_0xa4ba('0x12')][_0x25e36c]){_0x57f585['rules'][_0x25e36c][_0xa4ba('0x3a')]('end');}return _0x1c1b4f({'code':0xc8,'message':_0x4656fc});}catch(_0x255fb8){logger[_0xa4ba('0x36')](_0x255fb8['stack']);return _0x4bc651(_0x416355[_0xa4ba('0x36')](0x1f4,_0x255fb8));}}logger['error'](_0xa4ba('0x47'));return _0x4bc651(_0x416355[_0xa4ba('0x36')](0x1f4,_0xa4ba('0x47')));});},'AgentCapacity':function(_0x1aacdb){var _0x46ad54=this;return new Promise(function(_0x2fdbab,_0x56eaf0){if(_0x57f585['agents']['hasOwnProperty'](_0x1aacdb['id'])){for(var _0xee7860 in _0x1aacdb[_0xa4ba('0x48')]){if(_0x1aacdb['capacity'][_0xa4ba('0x49')](_0xee7860)){if(_0x57f585[_0xa4ba('0x40')][_0x1aacdb['id']][_0xa4ba('0x49')](_0xee7860+_0xa4ba('0x4a'))){_0x57f585[_0xa4ba('0x40')][_0x1aacdb['id']][_0xee7860+'CurrentCapacity']=parseInt(_0x1aacdb['capacity'][_0xee7860],0xa);}}}_0x57f585[_0xa4ba('0x40')][_0x1aacdb['id']][_0xa4ba('0x4b')]();return _0x2fdbab({'code':0xc8,'message':_0x57f585[_0xa4ba('0x40')][_0x1aacdb['id']]});}else{return _0x56eaf0(_0x46ad54[_0xa4ba('0x36')](0x1f4,_0xa4ba('0x4c')));}});},'Agents':function(_0x35403e){return new Promise(function(_0x3bdbab){var _0x42d352=_['values'](_0x57f585['agents']);if(_0x35403e&&_0x35403e['id']){var _0x33a9f9=_[_0xa4ba('0x4d')](_0x42d352,function(_0x3fe041){return _0x3fe041['id']===_0x35403e['id'];});_0x3bdbab(_0x33a9f9);}else{_0x3bdbab({'count':_0x42d352['length'],'rows':_0x42d352});}});},'ChatQueues':function(){return new Promise(function(_0x34dfd6){var _0x1715a9=[];for(var _0x38bfd2 in _0x57f585[_0xa4ba('0x4e')]){if(_0x57f585[_0xa4ba('0x4e')][_0xa4ba('0x49')](_0x38bfd2)){var _0x3246f5=_0x57f585['chatQueues'][_0x38bfd2];var _0x2c7d2d={'id':_0x3246f5['id'],'available':_0x3246f5[_0xa4ba('0x4f')],'loggedIn':_0x3246f5[_0xa4ba('0x50')],'name':_0x3246f5[_0xa4ba('0x51')],'paused':_0x3246f5[_0xa4ba('0x52')],'waiting':_0x3246f5[_0xa4ba('0x53')]};_0x1715a9[_0xa4ba('0x1e')](_0x2c7d2d);}}_0x34dfd6({'count':_0x1715a9[_0xa4ba('0x1f')],'rows':_0x1715a9});});},'MailQueues':function(){return new Promise(function(_0x2d6c0b){var _0x58a59e=[];for(var _0x1b1a97 in _0x57f585[_0xa4ba('0x54')]){if(_0x57f585['mailQueues'][_0xa4ba('0x49')](_0x1b1a97)){var _0x5bf0d8=_0x57f585[_0xa4ba('0x54')][_0x1b1a97];var _0x17c1df={'id':_0x5bf0d8['id'],'available':_0x5bf0d8[_0xa4ba('0x4f')],'loggedIn':_0x5bf0d8['loggedIn'],'name':_0x5bf0d8[_0xa4ba('0x51')],'paused':_0x5bf0d8[_0xa4ba('0x52')],'waiting':_0x5bf0d8[_0xa4ba('0x53')]};_0x58a59e[_0xa4ba('0x1e')](_0x17c1df);}}_0x2d6c0b({'count':_0x58a59e[_0xa4ba('0x1f')],'rows':_0x58a59e});});},'OpenchannelQueues':function(){return new Promise(function(_0x3fe078){var _0x55cb4a=[];for(var _0x4b7e9 in _0x57f585[_0xa4ba('0x55')]){if(_0x57f585[_0xa4ba('0x55')][_0xa4ba('0x49')](_0x4b7e9)){var _0x5f3b35=_0x57f585[_0xa4ba('0x55')][_0x4b7e9];var _0x533589={'id':_0x5f3b35['id'],'available':_0x5f3b35['available'],'loggedIn':_0x5f3b35['loggedIn'],'name':_0x5f3b35['name'],'paused':_0x5f3b35[_0xa4ba('0x52')],'waiting':_0x5f3b35[_0xa4ba('0x53')]};_0x55cb4a[_0xa4ba('0x1e')](_0x533589);}}_0x3fe078({'count':_0x55cb4a['length'],'rows':_0x55cb4a});});},'SmsQueues':function(){return new Promise(function(_0x20f8ca){var _0x17ea3c=[];for(var _0x119349 in _0x57f585[_0xa4ba('0x56')]){if(_0x57f585[_0xa4ba('0x56')][_0xa4ba('0x49')](_0x119349)){var _0x7f2aae=_0x57f585['smsQueues'][_0x119349];var _0x45f681={'id':_0x7f2aae['id'],'available':_0x7f2aae[_0xa4ba('0x4f')],'loggedIn':_0x7f2aae['loggedIn'],'name':_0x7f2aae[_0xa4ba('0x51')],'paused':_0x7f2aae[_0xa4ba('0x52')],'waiting':_0x7f2aae[_0xa4ba('0x53')]};_0x17ea3c[_0xa4ba('0x1e')](_0x45f681);}}_0x20f8ca({'count':_0x17ea3c[_0xa4ba('0x1f')],'rows':_0x17ea3c});});},'FaxQueues':function(){return new Promise(function(_0x30d6c0){var _0x19f8b5=[];for(var _0x218097 in _0x57f585[_0xa4ba('0x57')]){if(_0x57f585['faxQueues']['hasOwnProperty'](_0x218097)){var _0x6ecc9c=_0x57f585[_0xa4ba('0x57')][_0x218097];var _0x4d8234={'id':_0x6ecc9c['id'],'available':_0x6ecc9c[_0xa4ba('0x4f')],'loggedIn':_0x6ecc9c[_0xa4ba('0x50')],'name':_0x6ecc9c[_0xa4ba('0x51')],'paused':_0x6ecc9c[_0xa4ba('0x52')],'waiting':_0x6ecc9c['waiting']};_0x19f8b5[_0xa4ba('0x1e')](_0x4d8234);}}_0x30d6c0({'count':_0x19f8b5[_0xa4ba('0x1f')],'rows':_0x19f8b5});});},'WhatsappQueues':function(){return new Promise(function(_0x2ed18a){var _0x2d89dc=[];for(var _0x173ef9 in _0x57f585[_0xa4ba('0x58')]){if(_0x57f585[_0xa4ba('0x58')][_0xa4ba('0x49')](_0x173ef9)){var _0x3f71ca=_0x57f585[_0xa4ba('0x58')][_0x173ef9];var _0x5a670e={'id':_0x3f71ca['id'],'available':_0x3f71ca[_0xa4ba('0x4f')],'loggedIn':_0x3f71ca[_0xa4ba('0x50')],'name':_0x3f71ca[_0xa4ba('0x51')],'paused':_0x3f71ca['paused'],'waiting':_0x3f71ca['waiting']};_0x2d89dc[_0xa4ba('0x1e')](_0x5a670e);}}_0x2ed18a({'count':_0x2d89dc[_0xa4ba('0x1f')],'rows':_0x2d89dc});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xfa6ef5){var _0x341ad5=_[_0xa4ba('0x59')](_0x57f585['chatQueuesWaitingInteractions']);_0xfa6ef5({'count':_0x341ad5[_0xa4ba('0x1f')],'rows':_0x341ad5});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4c9b3c){var _0x3400af=_[_0xa4ba('0x59')](_0x57f585[_0xa4ba('0x5a')]);_0x4c9b3c({'count':_0x3400af[_0xa4ba('0x1f')],'rows':_0x3400af});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2510e0){var _0x3b4107=_[_0xa4ba('0x59')](_0x57f585[_0xa4ba('0x5b')]);_0x2510e0({'count':_0x3b4107[_0xa4ba('0x1f')],'rows':_0x3b4107});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x34711e){var _0x45f28e=_['values'](_0x57f585['smsQueuesWaitingInteractions']);_0x34711e({'count':_0x45f28e[_0xa4ba('0x1f')],'rows':_0x45f28e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x8397e2){var _0x5523fb=_[_0xa4ba('0x59')](_0x57f585[_0xa4ba('0x5c')]);_0x8397e2({'count':_0x5523fb[_0xa4ba('0x1f')],'rows':_0x5523fb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3260ea){var _0xd96037=_[_0xa4ba('0x59')](_0x57f585[_0xa4ba('0x5d')]);_0x3260ea({'count':_0xd96037[_0xa4ba('0x1f')],'rows':_0xd96037});});}};var _0x237107=jayson['server'](_0x1651be)['http']();_0x237107['on'](_0xa4ba('0x36'),function(_0xdd168){logger[_0xa4ba('0x36')](JSON['stringify'](_0xdd168));return _0xb08c14(_0xdd168);});_0x237107[_0xa4ba('0x11')](0x232c,'127.0.0.1',function(){console[_0xa4ba('0x5e')](_0xa4ba('0x5f'),0x232c);return _0x11eb49(_0xa4ba('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 684ee81..4f6b510 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 _0x27a5=['routing','http','request','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','then','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','join','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x27a5,0x1db));var _0x527a=function(_0x1bfc98,_0x58aef5){_0x1bfc98=_0x1bfc98-0x0;var _0x2c2d51=_0x27a5[_0x1bfc98];return _0x2c2d51;};'use strict';var util=require(_0x527a('0x0'));var BPromise=require(_0x527a('0x1'));var jayson=require(_0x527a('0x2'));var _=require(_0x527a('0x3'));var logger=require(_0x527a('0x4'))(_0x527a('0x5'));var client=jayson['client'][_0x527a('0x6')]({'port':0x232a});function request(_0x34b4de,_0x5621af){return new BPromise(function(_0x440cbb,_0x32ef99){return client[_0x527a('0x7')](_0x34b4de,_0x5621af)['then'](function(_0xd17e64){if(_0xd17e64[_0x527a('0x8')]){return _0x32ef99(_0xd17e64[_0x527a('0x8')][_0x527a('0x9')]);}else{return _0x440cbb(_0xd17e64[_0x527a('0xa')]);}})['catch'](function(_0x33b8ba){return _0x32ef99(_0x33b8ba);});});}exports[_0x527a('0xb')]=function(_0x1075c7,_0x2acb1f,_0x39f200){return function(_0x5b6303){if(_0x39f200[_0x527a('0xc')]&&!_0x39f200[_0x527a('0xc')][_0x1075c7]){logger[_0x527a('0xd')](_0x527a('0xe'),_0x1075c7);return _0x5b6303['stop']();}var _0x3ed99b=[];for(var _0x51727e=0x0;_0x51727e<_0x2acb1f[_0x527a('0xf')];_0x51727e+=0x1){_0x3ed99b[_0x527a('0x10')](request(_0x527a('0x11'),{'command':util[_0x527a('0x12')]('iftime\x20%s',_0x2acb1f[_0x51727e])})[_0x527a('0x13')](function(_0x11d264){return _0x11d264&&_0x11d264['message']&&_0x11d264[_0x527a('0x9')][_0x527a('0x14')](_0x527a('0x15'))>=0x0?!![]:![];})[_0x527a('0x16')](function(){logger[_0x527a('0x8')](_0x527a('0x17'),_0x1075c7,_0x2acb1f[_0x51727e]);}));}BPromise[_0x527a('0x18')](_0x3ed99b)['then'](function(_0x45bf98){var _0x3c0ab2=_[_0x527a('0x19')](_0x45bf98);logger[_0x527a('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x1075c7,_0x2acb1f['join'](_0x527a('0x1a')),_0x3c0ab2);_0x5b6303[_0x527a('0x1b')](_0x3c0ab2);})['catch'](function(_0x346d7a){logger['error'](_0x527a('0x1c'),_0x1075c7,_0x2acb1f[_0x527a('0x1d')](_0x527a('0x1a')),_0x346d7a[_0x527a('0x1e')]);_0x5b6303[_0x527a('0x1f')]();});};}; \ No newline at end of file +var _0xe515=['some','join','\x20|\x20','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','error','result','condition','rules','info','stop','length','push','format','iftime\x20%s','message','indexOf','true','catch','[%s][INTERVAL]\x20%s','all'];(function(_0x58d712,_0x1f3248){var _0x28e21c=function(_0x4251bc){while(--_0x4251bc){_0x58d712['push'](_0x58d712['shift']());}};_0x28e21c(++_0x1f3248);}(_0xe515,0x8f));var _0x5e51=function(_0x491298,_0x323c44){_0x491298=_0x491298-0x0;var _0x3d8d1a=_0xe515[_0x491298];return _0x3d8d1a;};'use strict';var util=require(_0x5e51('0x0'));var BPromise=require(_0x5e51('0x1'));var jayson=require(_0x5e51('0x2'));var _=require('lodash');var logger=require(_0x5e51('0x3'))(_0x5e51('0x4'));var client=jayson[_0x5e51('0x5')][_0x5e51('0x6')]({'port':0x232a});function request(_0x11f347,_0x17817d){return new BPromise(function(_0x21a298,_0x21a465){return client[_0x5e51('0x7')](_0x11f347,_0x17817d)[_0x5e51('0x8')](function(_0x393ca0){if(_0x393ca0[_0x5e51('0x9')]){return _0x21a465(_0x393ca0[_0x5e51('0x9')]['message']);}else{return _0x21a298(_0x393ca0[_0x5e51('0xa')]);}})['catch'](function(_0xc1d441){return _0x21a465(_0xc1d441);});});}exports[_0x5e51('0xb')]=function(_0x51cc6d,_0x6d051c,_0x3f946b){return function(_0x3762b9){if(_0x3f946b[_0x5e51('0xc')]&&!_0x3f946b['rules'][_0x51cc6d]){logger[_0x5e51('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x51cc6d);return _0x3762b9[_0x5e51('0xe')]();}var _0x46a172=[];for(var _0x1d4e07=0x0;_0x1d4e07<_0x6d051c[_0x5e51('0xf')];_0x1d4e07+=0x1){_0x46a172[_0x5e51('0x10')](request('Command',{'command':util[_0x5e51('0x11')](_0x5e51('0x12'),_0x6d051c[_0x1d4e07])})[_0x5e51('0x8')](function(_0x2ef814){return _0x2ef814&&_0x2ef814[_0x5e51('0x13')]&&_0x2ef814[_0x5e51('0x13')][_0x5e51('0x14')](_0x5e51('0x15'))>=0x0?!![]:![];})[_0x5e51('0x16')](function(){logger['error'](_0x5e51('0x17'),_0x51cc6d,_0x6d051c[_0x1d4e07]);}));}BPromise[_0x5e51('0x18')](_0x46a172)[_0x5e51('0x8')](function(_0x31d881){var _0x554fee=_[_0x5e51('0x19')](_0x31d881);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x51cc6d,_0x6d051c[_0x5e51('0x1a')](_0x5e51('0x1b')),_0x554fee);_0x3762b9['when'](_0x554fee);})['catch'](function(_0x5a2c01){logger[_0x5e51('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x51cc6d,_0x6d051c[_0x5e51('0x1a')](_0x5e51('0x1b')),_0x5a2c01['stack']);_0x3762b9[_0x5e51('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2e337e4..f028ab1 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 _0xd8b0=['indexOf','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','talktime','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','reason','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentconnect]','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s'];(function(_0x5a42c5,_0x164f03){var _0x591037=function(_0x1e6ae5){while(--_0x1e6ae5){_0x5a42c5['push'](_0x5a42c5['shift']());}};_0x591037(++_0x164f03);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x585166,_0x4b72b0){utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x4'),_0x585166[_0x0d8b('0x5')],_0x585166[_0x0d8b('0x6')],_0x585166['queue'],_0x585166['membername'],_0x585166[_0x0d8b('0x7')],_0x585166[_0x0d8b('0x8')],_0x585166[_0x0d8b('0x9')],_0x585166['lastevent']));if(_0x585166[_0x0d8b('0xa')]){utils[_0x0d8b('0xb')](_0x585166['queue'])[_0x0d8b('0xc')](function(_0x348e65){if(_0x348e65){_0x585166[_0x0d8b('0xd')]=_0x348e65[_0x0d8b('0xd')];_0x585166[_0x0d8b('0xe')]=_0x585166[_0x0d8b('0xf')]?_0x348e65[_0x0d8b('0x10')]:![];_0x585166[_0x0d8b('0x11')]=_0x585166['agentacw']?_0x348e65[_0x0d8b('0x12')]:0x0;}utils['request'](_0x0d8b('0x13'),_0x585166);});}else{utils[_0x0d8b('0x14')](_0x0d8b('0x13'),_0x585166);}if(_0x4b72b0){delete transfers[_0x585166[_0x0d8b('0x5')]];}else{delete agents[_0x585166[_0x0d8b('0x15')]];}}exports[_0x0d8b('0x16')]=function(_0x15dd0f){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')](_0x0d8b('0x18'),_0x15dd0f[_0x0d8b('0x5')]),_0x15dd0f);agents[_0x15dd0f[_0x0d8b('0x15')]]=_0x15dd0f;agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x19')]=utils['now']();agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x1b');agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x9')]=null;agents[_0x15dd0f['destuniqueid']][_0x0d8b('0x1c')]=null;utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x1d'),_0x15dd0f[_0x0d8b('0x5')],agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x1e')],_0x15dd0f[_0x0d8b('0x15')]));}catch(_0x4a15bf){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x18'),_0x15dd0f[_0x0d8b('0x5')]),_0x4a15bf);}};exports[_0x0d8b('0x20')]=function(_0x5b709c){try{if(!_[_0x0d8b('0x21')](agents[_0x5b709c[_0x0d8b('0x15')]])){utils['debug'](util['format'](_0x0d8b('0x22'),_0x5b709c['uniqueid']),_0x5b709c);utils['info'](util['format'](_0x0d8b('0x23'),_0x5b709c[_0x0d8b('0x5')],agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x1e')],_0x5b709c[_0x0d8b('0x15')]));agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x20')]=!![];agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x24')]=utils['now']();agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x1a')]='timeout';agents[_0x5b709c[_0x0d8b('0x15')]]['reason']=_0x0d8b('0x25');agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x26')]=_0x5b709c['ringtime']?parseInt(_0x5b709c['ringtime'])/0x3e8:0x0;agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x27')]=0x0;unanswered['push'](_0x5b709c[_0x0d8b('0x15')]);}}catch(_0x59aa83){utils[_0x0d8b('0x1f')](util['format'](_0x0d8b('0x22'),_0x5b709c['uniqueid']),_0x59aa83);}};exports[_0x0d8b('0x28')]=function(_0x546bf6){try{_[_0x0d8b('0x29')](agents,function(_0x544735,_0x3c8887){if(_0x544735[_0x0d8b('0x5')]==_0x546bf6[_0x0d8b('0x5')]&&!_['includes'](unanswered,_0x544735['destuniqueid'])){utils['debug'](util[_0x0d8b('0x3')]('[%s][agents][queuecallerabandon]',_0x546bf6[_0x0d8b('0x5')]),_0x546bf6);utils['info'](util['format'](_0x0d8b('0x2a'),_0x546bf6[_0x0d8b('0x5')],_0x544735[_0x0d8b('0x1e')],_0x544735[_0x0d8b('0x15')]));_0x544735[_0x0d8b('0x20')]=!![];_0x544735[_0x0d8b('0x24')]=utils[_0x0d8b('0x2b')]();_0x544735[_0x0d8b('0x1a')]='abandoned';_0x544735[_0x0d8b('0x2c')]=_0x0d8b('0x2d');_0x544735['holdtime']=_0x546bf6[_0x0d8b('0x26')];_0x544735[_0x0d8b('0x27')]=0x0;writeDB(_0x544735);}});}catch(_0x18a905){utils['error'](util[_0x0d8b('0x3')](_0x0d8b('0x2e'),_0x546bf6[_0x0d8b('0x5')]),_0x18a905);}};exports[_0x0d8b('0x2f')]=function(_0x933e01){try{if(agents[_0x933e01['destuniqueid']]){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][agentconnect]',_0x933e01[_0x0d8b('0x5')]),_0x933e01);utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x30'),_0x933e01[_0x0d8b('0x5')],agents[_0x933e01['destuniqueid']]['membername'],_0x933e01[_0x0d8b('0x15')]));agents[_0x933e01['destuniqueid']]['agentconnectAt']=utils[_0x0d8b('0x2b')]();agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x9')]=_0x933e01[_0x0d8b('0x9')];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x1c')]=_0x933e01['connectedlinename'];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x26')]=_0x933e01[_0x0d8b('0x31')];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x32');_[_0x0d8b('0x29')](agents,function(_0x5c980b,_0x1d06b6){if(_0x5c980b[_0x0d8b('0x15')]!=_0x933e01[_0x0d8b('0x15')]&&_0x5c980b[_0x0d8b('0x5')]==_0x933e01['uniqueid']){_0x5c980b[_0x0d8b('0x27')]=0x0;_0x5c980b['holdtime']=_0x933e01[_0x0d8b('0x31')];_0x5c980b[_0x0d8b('0x20')]=!![];_0x5c980b[_0x0d8b('0x24')]=utils[_0x0d8b('0x2b')]();_0x5c980b[_0x0d8b('0x1a')]=_0x0d8b('0x33');_0x5c980b[_0x0d8b('0x2c')]=_0x0d8b('0x33');_0x5c980b[_0x0d8b('0x34')]=_0x933e01[_0x0d8b('0x15')];_0x5c980b['answeredelsewheremembername']=_0x933e01['membername'];writeDB(_0x5c980b);}});}}catch(_0x576050){utils['error'](util['format'](_0x0d8b('0x35'),_0x933e01[_0x0d8b('0x5')]),_0x576050);}};exports[_0x0d8b('0xf')]=function(_0x5100cf){try{if(!_['isNil'](agents[_0x5100cf[_0x0d8b('0x15')]])){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][agentcomplete]',_0x5100cf[_0x0d8b('0x5')]),_0x5100cf);utils[_0x0d8b('0x2')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5100cf[_0x0d8b('0x5')],agents[_0x5100cf['destuniqueid']][_0x0d8b('0x1e')],_0x5100cf['destuniqueid']));agents[_0x5100cf['destuniqueid']][_0x0d8b('0xf')]=!![];agents[_0x5100cf[_0x0d8b('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x5100cf['destuniqueid']]['talktime']=utils[_0x0d8b('0x36')](agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x37')],agents[_0x5100cf['destuniqueid']][_0x0d8b('0x38')]);agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x2c')]=_0x5100cf[_0x0d8b('0x2c')];agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x39');writeDB(agents[_0x5100cf[_0x0d8b('0x15')]]);}}catch(_0x384a5e){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x3a'),_0x5100cf[_0x0d8b('0x5')]),_0x384a5e);}};exports[_0x0d8b('0x3b')]=function(_0x570af8){try{if(!_[_0x0d8b('0x21')](agents[_0x570af8[_0x0d8b('0x3c')]])){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][blindtransfer]',_0x570af8[_0x0d8b('0x5')]),_0x570af8);utils['info'](util['format'](_0x0d8b('0x3d'),_0x570af8[_0x0d8b('0x5')],agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x1e')],agents[_0x570af8['transfereruniqueid']][_0x0d8b('0x5')]));agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x3e')]=!![];agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x3f')]='blind';agents[_0x570af8['transfereruniqueid']]['transferexten']=_0x570af8['extension'];agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x40')]=agents[_0x570af8['transfereruniqueid']]['uniqueid'];}}catch(_0x44c5c1){utils[_0x0d8b('0x1f')](util['format']('[%s][agents][blindtransfer]',_0x570af8[_0x0d8b('0x5')]),_0x44c5c1);}};exports[_0x0d8b('0x41')]=function(_0x3cd00a){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][attendedtransfer]',_0x3cd00a[_0x0d8b('0x42')]),_0x3cd00a);if(_0x3cd00a[_0x0d8b('0x42')]==_0x3cd00a['origtransfererlinkedid']){if(!_['isNil'](agents[_0x3cd00a[_0x0d8b('0x43')]])){utils[_0x0d8b('0x2')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x3cd00a[_0x0d8b('0x42')],agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x1e')]));agents[_0x3cd00a[_0x0d8b('0x43')]]['transfer']=!![];agents[_0x3cd00a[_0x0d8b('0x43')]]['transfertype']='ATTENDED';agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x44')]=_0x3cd00a['origtransfererexten'];agents[_0x3cd00a['secondtransfereruniqueid']][_0x0d8b('0x40')]=_0x3cd00a[_0x0d8b('0x42')];}if(_0x3cd00a[_0x0d8b('0x45')]&&agents[_0x3cd00a[_0x0d8b('0x45')]]){agents[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x46')]=0x1;transfers[_0x3cd00a[_0x0d8b('0x45')]]=_[_0x0d8b('0x47')](agents[_0x3cd00a['transfereeuniqueid']]);transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x8')]=agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x8')];transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x48')]=agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x48')];transfers[_0x3cd00a[_0x0d8b('0x45')]]['agentcalledAt']=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x38')]=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x45')]]['holdtime']=0x0;transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x46')]=0x2;}}else if(_0x3cd00a[_0x0d8b('0x43')]==_0x3cd00a[_0x0d8b('0x49')]){if(!_[_0x0d8b('0x21')](agents[_0x3cd00a['origtransfereruniqueid']])){utils['info'](util[_0x0d8b('0x3')](_0x0d8b('0x4a'),_0x3cd00a[_0x0d8b('0x42')],agents[_0x3cd00a[_0x0d8b('0x42')]]['membername']));agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x3e')]=!![];agents[_0x3cd00a[_0x0d8b('0x42')]]['transfertype']=_0x0d8b('0x4b');agents[_0x3cd00a['origtransfereruniqueid']][_0x0d8b('0x44')]=_0x3cd00a[_0x0d8b('0x4c')];agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x40')]=_0x3cd00a[_0x0d8b('0x43')];}if(_0x3cd00a[_0x0d8b('0x4d')]&&agents[_0x3cd00a['transfertargetuniqueid']]){agents[_0x3cd00a[_0x0d8b('0x4d')]]['agententerreason']=0x1;transfers[_0x3cd00a[_0x0d8b('0x4d')]]=_[_0x0d8b('0x47')](agents[_0x3cd00a[_0x0d8b('0x4d')]]);transfers[_0x3cd00a[_0x0d8b('0x4d')]]['calleridnum']=agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x8')];transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x48')]=agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x48')];transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x19')]=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x26')]=0x0;transfers[_0x3cd00a['transfertargetuniqueid']][_0x0d8b('0x46')]=0x2;}}}catch(_0x5ab1f7){utils['error'](util[_0x0d8b('0x3')](_0x0d8b('0x4e'),_0x3cd00a['origtransfereruniqueid']),_0x5ab1f7);}};exports['hangup']=function(_0x1900e3){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')](_0x0d8b('0x4f'),_0x1900e3[_0x0d8b('0x5')]),_0x1900e3);if(agents[_0x1900e3[_0x0d8b('0x5')]]&&agents[_0x1900e3[_0x0d8b('0x5')]]['reason']===_0x0d8b('0x25')){if(_0x1900e3['cause']==='21'){agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]=_0x0d8b('0x50');agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']=_0x0d8b('0x50');}utils['info'](util[_0x0d8b('0x3')](_0x0d8b('0x51'),_0x1900e3[_0x0d8b('0x5')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1a')]));writeDB(agents[_0x1900e3[_0x0d8b('0x5')]]);var _0x4eb07e=unanswered[_0x0d8b('0x52')](_0x1900e3['uniqueid']);if(_0x4eb07e>-0x1){unanswered[_0x0d8b('0x53')](_0x4eb07e,0x1);}}if(transfers[_0x1900e3[_0x0d8b('0x5')]]){transfers[_0x1900e3['uniqueid']][_0x0d8b('0xf')]=!![];transfers[_0x1900e3['uniqueid']][_0x0d8b('0x37')]=utils[_0x0d8b('0x2b')]();transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x27')]=utils[_0x0d8b('0x36')](transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')],transfers[_0x1900e3[_0x0d8b('0x5')]]['agentconnectAt']);transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]='agent';transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1a')]=_0x0d8b('0x39');utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x51'),_0x1900e3[_0x0d8b('0x5')],transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],transfers[_0x1900e3[_0x0d8b('0x5')]]['lastevent']));writeDB(transfers[_0x1900e3[_0x0d8b('0x5')]],!![]);}if(agents[_0x1900e3[_0x0d8b('0x5')]]&&agents[_0x1900e3[_0x0d8b('0x5')]]['agentconnectAt']){agents[_0x1900e3['uniqueid']][_0x0d8b('0xf')]=!![];agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')]=utils['now']();agents[_0x1900e3['uniqueid']][_0x0d8b('0x27')]=utils[_0x0d8b('0x36')](agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x38')]);agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]=agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x3e')]?_0x0d8b('0x3e'):_0x0d8b('0x54');agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']=_0x0d8b('0x39');utils[_0x0d8b('0x2')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1900e3[_0x0d8b('0x5')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']));writeDB(agents[_0x1900e3['uniqueid']]);}}catch(_0x581d8e){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x4f'),_0x1900e3[_0x0d8b('0x5')]),_0x581d8e);}}; \ No newline at end of file +var _0x4e81=['[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfer','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][agentconnect]','agentconnectAt','connect','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete'];(function(_0x145e97,_0x1f8594){var _0x38eca0=function(_0x17e874){while(--_0x17e874){_0x145e97['push'](_0x145e97['shift']());}};_0x38eca0(++_0x1f8594);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0x4e81[_0x2e78e9];return _0x35aad4;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var utils=require(_0x14e8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x533fb3,_0x4b9800){utils['info'](util[_0x14e8('0x3')](_0x14e8('0x4'),_0x533fb3[_0x14e8('0x5')],_0x533fb3[_0x14e8('0x6')],_0x533fb3[_0x14e8('0x7')],_0x533fb3[_0x14e8('0x8')],_0x533fb3['interface'],_0x533fb3['calleridnum'],_0x533fb3[_0x14e8('0x9')],_0x533fb3[_0x14e8('0xa')]));if(_0x533fb3[_0x14e8('0x7')]){utils[_0x14e8('0xb')](_0x533fb3[_0x14e8('0x7')])[_0x14e8('0xc')](function(_0x39127a){if(_0x39127a){_0x533fb3[_0x14e8('0xd')]=_0x39127a[_0x14e8('0xd')];_0x533fb3['agentacw']=_0x533fb3[_0x14e8('0xe')]?_0x39127a[_0x14e8('0xf')]:![];_0x533fb3[_0x14e8('0x10')]=_0x533fb3[_0x14e8('0x11')]?_0x39127a[_0x14e8('0x12')]:0x0;}utils[_0x14e8('0x13')](_0x14e8('0x14'),_0x533fb3);});}else{utils[_0x14e8('0x13')]('CreateVoiceAgentReport',_0x533fb3);}if(_0x4b9800){delete transfers[_0x533fb3[_0x14e8('0x5')]];}else{delete agents[_0x533fb3['destuniqueid']];}}exports[_0x14e8('0x15')]=function(_0x341d40){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x17'),_0x341d40['uniqueid']),_0x341d40);agents[_0x341d40[_0x14e8('0x18')]]=_0x341d40;agents[_0x341d40['destuniqueid']][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0xa')]='called';agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x9')]=null;agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x1b')]=null;utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x1d'),_0x341d40[_0x14e8('0x5')],agents[_0x341d40['destuniqueid']][_0x14e8('0x8')],_0x341d40[_0x14e8('0x18')]));}catch(_0x151f16){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][agentcalled]',_0x341d40[_0x14e8('0x5')]),_0x151f16);}};exports[_0x14e8('0x1f')]=function(_0x2abfec){try{if(!_['isNil'](agents[_0x2abfec[_0x14e8('0x18')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x20'),_0x2abfec[_0x14e8('0x5')]),_0x2abfec);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x2abfec[_0x14e8('0x5')],agents[_0x2abfec['destuniqueid']][_0x14e8('0x8')],_0x2abfec[_0x14e8('0x18')]));agents[_0x2abfec['destuniqueid']]['agentringnoanswer']=!![];agents[_0x2abfec['destuniqueid']][_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x22');agents[_0x2abfec['destuniqueid']][_0x14e8('0x23')]=_0x14e8('0x22');agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0x24')]=_0x2abfec[_0x14e8('0x25')]?parseInt(_0x2abfec[_0x14e8('0x25')])/0x3e8:0x0;agents[_0x2abfec[_0x14e8('0x18')]]['talktime']=0x0;unanswered[_0x14e8('0x26')](_0x2abfec[_0x14e8('0x18')]);}}catch(_0x393ab0){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x2abfec[_0x14e8('0x5')]),_0x393ab0);}};exports[_0x14e8('0x27')]=function(_0x567385){try{_[_0x14e8('0x28')](agents,function(_0x1d71ca,_0x176e8f){if(_0x1d71ca[_0x14e8('0x5')]==_0x567385['uniqueid']&&!_[_0x14e8('0x29')](unanswered,_0x1d71ca[_0x14e8('0x18')])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')](_0x14e8('0x2a'),_0x567385['uniqueid']),_0x567385);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x2b'),_0x567385[_0x14e8('0x5')],_0x1d71ca['membername'],_0x1d71ca[_0x14e8('0x18')]));_0x1d71ca['agentringnoanswer']=!![];_0x1d71ca[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1d71ca[_0x14e8('0xa')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x23')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x24')]=_0x567385[_0x14e8('0x24')];_0x1d71ca[_0x14e8('0x2d')]=0x0;writeDB(_0x1d71ca);}});}catch(_0x2acf6a){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][queuecallerabandon]',_0x567385['uniqueid']),_0x2acf6a);}};exports['agentconnect']=function(_0x16ff09){try{if(agents[_0x16ff09['destuniqueid']]){utils[_0x14e8('0x16')](util['format'](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x16ff09);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ff09[_0x14e8('0x5')],agents[_0x16ff09['destuniqueid']][_0x14e8('0x8')],_0x16ff09[_0x14e8('0x18')]));agents[_0x16ff09[_0x14e8('0x18')]][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();agents[_0x16ff09[_0x14e8('0x18')]]['connectedlinenum']=_0x16ff09[_0x14e8('0x9')];agents[_0x16ff09['destuniqueid']][_0x14e8('0x1b')]=_0x16ff09[_0x14e8('0x1b')];agents[_0x16ff09[_0x14e8('0x18')]]['holdtime']=_0x16ff09[_0x14e8('0x25')];agents[_0x16ff09[_0x14e8('0x18')]]['lastevent']=_0x14e8('0x30');_[_0x14e8('0x28')](agents,function(_0x1f429a,_0x3a7aa7){if(_0x1f429a[_0x14e8('0x18')]!=_0x16ff09[_0x14e8('0x18')]&&_0x1f429a[_0x14e8('0x5')]==_0x16ff09[_0x14e8('0x5')]){_0x1f429a[_0x14e8('0x2d')]=0x0;_0x1f429a[_0x14e8('0x24')]=_0x16ff09[_0x14e8('0x25')];_0x1f429a[_0x14e8('0x1f')]=!![];_0x1f429a[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1f429a[_0x14e8('0xa')]='answered_elsewhere';_0x1f429a[_0x14e8('0x23')]='answered_elsewhere';_0x1f429a['answeredelsewheredestinationuniqueid']=_0x16ff09['destuniqueid'];_0x1f429a[_0x14e8('0x31')]=_0x16ff09['membername'];writeDB(_0x1f429a);}});}}catch(_0x46a3c4){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x46a3c4);}};exports[_0x14e8('0xe')]=function(_0x125af5){try{if(!_[_0x14e8('0x32')](agents[_0x125af5[_0x14e8('0x18')]])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')]('[%s][agents][agentcomplete]',_0x125af5[_0x14e8('0x5')]),_0x125af5);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x33'),_0x125af5['uniqueid'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x8')],_0x125af5['destuniqueid']));agents[_0x125af5['destuniqueid']][_0x14e8('0xe')]=!![];agents[_0x125af5['destuniqueid']]['agentcompleteAt']=utils[_0x14e8('0x1a')]();agents[_0x125af5[_0x14e8('0x18')]]['talktime']=utils[_0x14e8('0x34')](agents[_0x125af5[_0x14e8('0x18')]]['agentcompleteAt'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x2f')]);agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x23')]=_0x125af5[_0x14e8('0x23')];agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x35');writeDB(agents[_0x125af5[_0x14e8('0x18')]]);}}catch(_0x42180d){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x36'),_0x125af5[_0x14e8('0x5')]),_0x42180d);}};exports[_0x14e8('0x37')]=function(_0x1f50bc){try{if(!_['isNil'](agents[_0x1f50bc[_0x14e8('0x38')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x1f50bc);utils[_0x14e8('0x1c')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1f50bc['uniqueid'],agents[_0x1f50bc[_0x14e8('0x38')]]['membername'],agents[_0x1f50bc['transfereruniqueid']][_0x14e8('0x5')]));agents[_0x1f50bc[_0x14e8('0x38')]]['transfer']=!![];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3a')]=_0x14e8('0x3b');agents[_0x1f50bc[_0x14e8('0x38')]]['transferexten']=_0x1f50bc['extension'];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3c')]=agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x5')];}}catch(_0x41b5ab){utils[_0x14e8('0x1e')](util['format'](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x41b5ab);}};exports[_0x14e8('0x3d')]=function(_0xd5adc1){try{utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0xd5adc1);if(_0xd5adc1[_0x14e8('0x3f')]==_0xd5adc1['origtransfererlinkedid']){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x40')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x41'),_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x8')]));agents[_0xd5adc1['secondtransfereruniqueid']]['transfer']=!![];agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x43')]=_0xd5adc1['origtransfererexten'];agents[_0xd5adc1['secondtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x3f')];}if(_0xd5adc1[_0x14e8('0x44')]&&agents[_0xd5adc1[_0x14e8('0x44')]]){agents[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x44')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfereeuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x47')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x48')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x48')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x45')]=0x2;}}else if(_0xd5adc1[_0x14e8('0x40')]==_0xd5adc1[_0x14e8('0x49')]){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x3f')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x3f')]]['membername']));agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x4a')]=!![];agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x43')]=_0xd5adc1['secondtransfererexten'];agents[_0xd5adc1['origtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x40')];}if(_0xd5adc1[_0x14e8('0x4b')]&&agents[_0xd5adc1[_0x14e8('0x4b')]]){agents[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x4b')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfertargetuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x47')]=agents[_0xd5adc1['origtransfereruniqueid']][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x4b')]]['calleridname']=agents[_0xd5adc1['origtransfereruniqueid']]['calleridname'];transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]]['agentconnectAt']=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x2;}}}catch(_0x36d0e5){utils['error'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0x36d0e5);}};exports['hangup']=function(_0x5add74){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x4c'),_0x5add74['uniqueid']),_0x5add74);if(agents[_0x5add74[_0x14e8('0x5')]]&&agents[_0x5add74['uniqueid']][_0x14e8('0x23')]===_0x14e8('0x22')){if(_0x5add74['cause']==='21'){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x4d');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x4d');}utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']]['lastevent']));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);var _0x52f0a7=unanswered[_0x14e8('0x4f')](_0x5add74['uniqueid']);if(_0x52f0a7>-0x1){unanswered[_0x14e8('0x50')](_0x52f0a7,0x1);}}if(transfers[_0x5add74['uniqueid']]){transfers[_0x5add74['uniqueid']]['agentcomplete']=!![];transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();transfers[_0x5add74['uniqueid']][_0x14e8('0x2d')]=utils['diffTime'](transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]);transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x52');transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]='complete';utils[_0x14e8('0x1c')](util['format'](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]));writeDB(transfers[_0x5add74[_0x14e8('0x5')]],!![]);}if(agents[_0x5add74['uniqueid']]&&agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xe')]=!![];agents[_0x5add74['uniqueid']][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2d')]=utils['diffTime'](agents[_0x5add74[_0x14e8('0x5')]]['agentcompleteAt'],agents[_0x5add74[_0x14e8('0x5')]]['agentconnectAt']);agents[_0x5add74['uniqueid']][_0x14e8('0x23')]=agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x4a')]?_0x14e8('0x4a'):_0x14e8('0x52');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x35');utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74['uniqueid'],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']][_0x14e8('0xa')]));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);}}catch(_0xc3ebbc){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x4c'),_0x5add74[_0x14e8('0x5')]),_0xc3ebbc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 7b8a6b7..450039f 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 _0xfaf2=['xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','includes','execif','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xfaf2,0x8b));var _0x2faf=function(_0x3ecce9,_0x35c336){_0x3ecce9=_0x3ecce9-0x0;var _0x89dd90=_0xfaf2[_0x3ecce9];return _0x89dd90;};'use strict';var _=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var utils=require(_0x2faf('0x2'));var dispositions=['NO\x20ANSWER',_0x2faf('0x3'),_0x2faf('0x3'),_0x2faf('0x4'),_0x2faf('0x4'),_0x2faf('0x4'),_0x2faf('0x5'),_0x2faf('0x6'),'FAILED',_0x2faf('0x3'),'FAILED'];var channels={};function writeDB(_0x4cdfc4){utils['info'](util[_0x2faf('0x7')](_0x2faf('0x8'),_0x4cdfc4[_0x2faf('0x9')],_0x4cdfc4[_0x2faf('0xa')],_0x4cdfc4[_0x2faf('0xb')],_0x4cdfc4[_0x2faf('0xc')],_0x4cdfc4['interface'],_0x4cdfc4[_0x2faf('0xd')],_0x4cdfc4[_0x2faf('0xe')],_0x4cdfc4[_0x2faf('0xf')]));if(_0x4cdfc4[_0x2faf('0x10')]){utils[_0x2faf('0x11')](_0x4cdfc4['accountcode'])[_0x2faf('0x12')](function(_0x36aa13){if(_0x36aa13){_0x4cdfc4['UserId']=_0x36aa13['id'];}utils[_0x2faf('0x13')]('CreateVoiceCallReport',_0x4cdfc4);});}else{utils[_0x2faf('0x13')](_0x2faf('0x14'),_0x4cdfc4);}if(channels[_0x4cdfc4[_0x2faf('0x9')]]){delete channels[_0x4cdfc4['uniqueid']];}}exports[_0x2faf('0x15')]=function(_0x189db1){try{utils[_0x2faf('0x16')](util[_0x2faf('0x7')](_0x2faf('0x17'),_0x189db1['uniqueid']),_0x189db1);if(_0x189db1[_0x2faf('0x9')]==_0x189db1[_0x2faf('0x18')]&&_0x189db1[_0x2faf('0xa')]!=_0x2faf('0x19')){utils[_0x2faf('0x1a')](util[_0x2faf('0x7')](_0x2faf('0x1b'),_0x189db1['uniqueid'],_0x189db1[_0x2faf('0x1c')],_0x189db1['exten']));channels[_0x189db1[_0x2faf('0x9')]]={'uniqueid':_0x189db1[_0x2faf('0x9')],'accountcode':_0x189db1[_0x2faf('0x10')],'source':_0x189db1[_0x2faf('0xd')],'destination':_0x189db1[_0x2faf('0x1d')],'destinationcontext':_0x189db1[_0x2faf('0x1c')],'channel':_0x189db1[_0x2faf('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x2faf('0x1e')};}}catch(_0x3eafe4){utils[_0x2faf('0x1f')](util[_0x2faf('0x7')](_0x2faf('0x17'),_0x189db1[_0x2faf('0x9')]),_0x3eafe4);}};exports[_0x2faf('0x20')]=function(_0x1e696b){try{utils['debug'](util[_0x2faf('0x7')](_0x2faf('0x21'),_0x1e696b[_0x2faf('0x9')]),_0x1e696b);if(!_['isNil'](channels[_0x1e696b[_0x2faf('0x9')]])&&_0x1e696b[_0x2faf('0x22')]==0x6){utils[_0x2faf('0x1a')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1e696b['uniqueid'],_0x1e696b[_0x2faf('0x1c')],_0x1e696b[_0x2faf('0xa')]));if(_[_0x2faf('0x23')](channels[_0x1e696b[_0x2faf('0x9')]]['systemanswertime'])){channels[_0x1e696b['uniqueid']][_0x2faf('0x24')]=utils[_0x2faf('0x25')]();}}else if(!_[_0x2faf('0x23')](channels[_0x1e696b[_0x2faf('0x18')]])&&_0x1e696b['channelstate']==0x6&&_0x1e696b[_0x2faf('0x1c')]!=_0x2faf('0x26')){utils['info'](util[_0x2faf('0x7')](_0x2faf('0x27'),_0x1e696b[_0x2faf('0x9')],_0x1e696b['linkedid'],_0x1e696b[_0x2faf('0x1c')],_0x1e696b[_0x2faf('0xa')]));channels[_0x1e696b[_0x2faf('0x18')]][_0x2faf('0x10')]=_0x1e696b[_0x2faf('0x10')];channels[_0x1e696b[_0x2faf('0x18')]]['destinationchannel']=_0x1e696b[_0x2faf('0xa')];if(_[_0x2faf('0x23')](channels[_0x1e696b[_0x2faf('0x18')]][_0x2faf('0x28')])){channels[_0x1e696b[_0x2faf('0x18')]][_0x2faf('0x28')]=utils['now']();}channels[_0x1e696b[_0x2faf('0x18')]][_0x2faf('0x29')]=dispositions[_[_0x2faf('0x2a')](_0x1e696b['channelstate'])]||_0x2faf('0x5');}}catch(_0x60aff0){utils[_0x2faf('0x1f')](util[_0x2faf('0x7')]('[%s][calls][newstate]',_0x1e696b['uniqueid']),_0x60aff0);}};exports[_0x2faf('0x2b')]=function(_0x5e005f){try{if(!_[_0x2faf('0x23')](channels[_0x5e005f['uniqueid']])){utils[_0x2faf('0x16')](util[_0x2faf('0x7')]('[%s][calls][hangup]',_0x5e005f[_0x2faf('0x9')]),_0x5e005f);if(_['isNil'](channels[_0x5e005f[_0x2faf('0x9')]][_0x2faf('0x2c')])){channels[_0x5e005f[_0x2faf('0x9')]][_0x2faf('0x2c')]=_0x5e005f['calleridname']+'\x20<'+_0x5e005f[_0x2faf('0xd')]+'>';}utils[_0x2faf('0x1a')](util[_0x2faf('0x7')](_0x2faf('0x2d'),_0x5e005f[_0x2faf('0x9')],channels[_0x5e005f[_0x2faf('0x9')]][_0x2faf('0x2c')],_0x5e005f[_0x2faf('0x2e')]));channels[_0x5e005f[_0x2faf('0x9')]][_0x2faf('0x2f')]=utils['now']();channels[_0x5e005f[_0x2faf('0x9')]]['duration']=utils[_0x2faf('0x30')](channels[_0x5e005f['uniqueid']][_0x2faf('0x2f')],channels[_0x5e005f[_0x2faf('0x9')]][_0x2faf('0x31')]);channels[_0x5e005f[_0x2faf('0x9')]][_0x2faf('0x32')]=channels[_0x5e005f['uniqueid']]['answertime']?utils['diffTime'](channels[_0x5e005f[_0x2faf('0x9')]][_0x2faf('0x2f')],channels[_0x5e005f[_0x2faf('0x9')]][_0x2faf('0x28')]):0x0;writeDB(channels[_0x5e005f['uniqueid']]);}}catch(_0x214ec3){utils[_0x2faf('0x1f')](util['format']('[%s][calls][hangup]',_0x5e005f[_0x2faf('0x9')]),_0x214ec3);}};exports['attendedtransfer']=function(_0x4745d7){try{if(!_[_0x2faf('0x23')](channels[_0x4745d7[_0x2faf('0x33')]])){utils[_0x2faf('0x16')](util['format'](_0x2faf('0x34'),_0x4745d7['origtransfereruniqueid']),_0x4745d7);if(channels[_0x4745d7[_0x2faf('0x33')]][_0x2faf('0xa')]==_0x4745d7[_0x2faf('0x35')]){utils[_0x2faf('0x1a')](util[_0x2faf('0x7')](_0x2faf('0x36'),_0x4745d7[_0x2faf('0x37')],_0x4745d7[_0x2faf('0x33')],_0x4745d7[_0x2faf('0x38')]));channels[_0x4745d7[_0x2faf('0x33')]][_0x2faf('0x39')]=_0x4745d7[_0x2faf('0x38')];channels[_0x4745d7[_0x2faf('0x33')]][_0x2faf('0x3a')]=_0x2faf('0x3b');}else if(channels[_0x4745d7[_0x2faf('0x33')]][_0x2faf('0xa')]=_0x4745d7[_0x2faf('0x3c')]){utils['info'](util['format'](_0x2faf('0x36'),_0x4745d7[_0x2faf('0x37')],_0x4745d7[_0x2faf('0x33')],_0x4745d7['origtransfererchannel']));channels[_0x4745d7[_0x2faf('0x33')]][_0x2faf('0x39')]=_0x4745d7[_0x2faf('0x3d')];channels[_0x4745d7[_0x2faf('0x33')]][_0x2faf('0x3a')]=_0x2faf('0x3b');}}}catch(_0x1f1742){utils['error'](util[_0x2faf('0x7')](_0x2faf('0x34'),_0x4745d7[_0x2faf('0x37')]),_0x1f1742);}};exports[_0x2faf('0x3e')]=function(_0x460f26){try{if(!_[_0x2faf('0x23')](channels[_0x460f26[_0x2faf('0x9')]])){utils[_0x2faf('0x16')](util[_0x2faf('0x7')](_0x2faf('0x3f'),_0x460f26['uniqueid']),_0x460f26);channels[_0x460f26[_0x2faf('0x9')]][_0x2faf('0x40')]=utils['now']();utils['info'](util[_0x2faf('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x460f26[_0x2faf('0x9')],channels[_0x460f26[_0x2faf('0x9')]][_0x2faf('0x40')]));}}catch(_0x231bf9){utils[_0x2faf('0x1f')](util[_0x2faf('0x7')]('[%s][calls][musiconholdstart]',_0x460f26[_0x2faf('0x9')]),_0x231bf9);}};exports['musiconholdstop']=function(_0x93fcb5){try{if(!_[_0x2faf('0x23')](channels[_0x93fcb5[_0x2faf('0x9')]])){utils['debug'](util[_0x2faf('0x7')](_0x2faf('0x41'),_0x93fcb5[_0x2faf('0x9')]),_0x93fcb5);if(!_[_0x2faf('0x23')](channels[_0x93fcb5[_0x2faf('0x9')]][_0x2faf('0x40')])){channels[_0x93fcb5[_0x2faf('0x9')]][_0x2faf('0x42')]+=utils[_0x2faf('0x30')](utils[_0x2faf('0x25')](),channels[_0x93fcb5['uniqueid']][_0x2faf('0x40')]);utils[_0x2faf('0x1a')](util[_0x2faf('0x7')](_0x2faf('0x43'),_0x93fcb5[_0x2faf('0x9')],channels[_0x93fcb5[_0x2faf('0x9')]][_0x2faf('0x42')]));delete channels[_0x93fcb5[_0x2faf('0x9')]][_0x2faf('0x40')];}}}catch(_0x55dfc3){utils[_0x2faf('0x1f')](util[_0x2faf('0x7')](_0x2faf('0x41'),_0x93fcb5[_0x2faf('0x9')]),_0x55dfc3);}};exports['varset']=function(_0x32a5e2){try{if(!_[_0x2faf('0x23')](channels[_0x32a5e2[_0x2faf('0x9')]])){utils['debug'](util[_0x2faf('0x7')]('[%s][calls][varset]',_0x32a5e2[_0x2faf('0x9')]),_0x32a5e2);if(!_[_0x2faf('0x23')](_0x32a5e2[_0x2faf('0x44')][_0x2faf('0x45')])){utils[_0x2faf('0x1a')](util[_0x2faf('0x7')](_0x2faf('0x46'),_0x32a5e2['uniqueid'],_0x32a5e2[_0x2faf('0x47')]));channels[_0x32a5e2[_0x2faf('0x9')]][_0x2faf('0x48')]=_0x32a5e2[_0x2faf('0x47')];}if(!_[_0x2faf('0x23')](_0x32a5e2['variable'][_0x2faf('0x49')])){utils[_0x2faf('0x1a')](util[_0x2faf('0x7')](_0x2faf('0x4a'),_0x32a5e2[_0x2faf('0x9')],_0x32a5e2[_0x2faf('0x47')]));channels[_0x32a5e2[_0x2faf('0x9')]][_0x2faf('0x4b')]=_0x32a5e2['value'];channels[_0x32a5e2[_0x2faf('0x9')]][_0x2faf('0x2c')]='\x22'+_0x32a5e2[_0x2faf('0x47')]+_0x2faf('0x4c')+_0x32a5e2[_0x2faf('0x47')]+'>';}if(!_['isNil'](_0x32a5e2['variable'][_0x2faf('0x4d')])||!_[_0x2faf('0x23')](_0x32a5e2['variable'][_0x2faf('0x4e')])){utils[_0x2faf('0x1a')](util[_0x2faf('0x7')](_0x2faf('0x4f'),_0x32a5e2[_0x2faf('0x9')],!_[_0x2faf('0x23')](_0x32a5e2[_0x2faf('0x44')][_0x2faf('0x4d')])?_0x2faf('0x4d'):_0x2faf('0x4e'),_0x32a5e2[_0x2faf('0x47')]));channels[_0x32a5e2[_0x2faf('0x9')]][_0x2faf('0x2c')]=_0x32a5e2[_0x2faf('0x47')];}if(!_[_0x2faf('0x23')](_0x32a5e2['variable'][_0x2faf('0x50')])||!_[_0x2faf('0x23')](_0x32a5e2[_0x2faf('0x44')][_0x2faf('0x51')])){utils[_0x2faf('0x1a')](util['format'](_0x2faf('0x4f'),_0x32a5e2[_0x2faf('0x9')],!_[_0x2faf('0x23')](_0x32a5e2[_0x2faf('0x44')]['xmd-queue'])?'xmd-queue':_0x2faf('0x51'),_0x32a5e2['value']));channels[_0x32a5e2['uniqueid']][_0x2faf('0x52')]=_0x2faf('0x53');channels[_0x32a5e2['uniqueid']]['lastdata']=_0x32a5e2['value'];channels[_0x32a5e2[_0x2faf('0x9')]][_0x2faf('0xb')]=!![];}if(!_['isNil'](_0x32a5e2['variable']['xmd-contactid'])){utils[_0x2faf('0x1a')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x32a5e2[_0x2faf('0x9')],_0x32a5e2[_0x2faf('0x47')]));channels[_0x32a5e2[_0x2faf('0x9')]][_0x2faf('0x54')]=_0x32a5e2['value'];}if(!_['isNil'](_0x32a5e2[_0x2faf('0x44')][_0x2faf('0x55')])){utils[_0x2faf('0x1a')](util[_0x2faf('0x7')](_0x2faf('0x56'),_0x32a5e2['uniqueid'],_0x32a5e2['value']));channels[_0x32a5e2[_0x2faf('0x9')]]['type']=_0x32a5e2['value'];}if(!_[_0x2faf('0x23')](_0x32a5e2[_0x2faf('0x44')][_0x2faf('0x57')])){utils['info'](util[_0x2faf('0x7')](_0x2faf('0x58'),_0x32a5e2[_0x2faf('0x9')],_0x32a5e2[_0x2faf('0x47')]));channels[_0x32a5e2[_0x2faf('0x9')]][_0x2faf('0x59')]=_0x32a5e2[_0x2faf('0x47')];}if(!_[_0x2faf('0x23')](_0x32a5e2[_0x2faf('0x44')][_0x2faf('0x5a')])){utils[_0x2faf('0x1a')](util[_0x2faf('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x32a5e2[_0x2faf('0x9')],_0x32a5e2[_0x2faf('0x47')]));channels[_0x32a5e2[_0x2faf('0x9')]][_0x2faf('0x5a')]=_0x32a5e2['value'];}}}catch(_0x2d9cd7){utils[_0x2faf('0x1f')](util[_0x2faf('0x7')](_0x2faf('0x5b'),_0x32a5e2[_0x2faf('0x9')]),_0x2d9cd7);}};exports[_0x2faf('0x5c')]=function(_0x511a9d){try{if(!_['isNil'](channels[_0x511a9d[_0x2faf('0x9')]])){utils['debug'](util[_0x2faf('0x7')](_0x2faf('0x5d'),_0x511a9d[_0x2faf('0x9')]),_0x511a9d);utils['info'](util[_0x2faf('0x7')](_0x2faf('0x5e'),_0x511a9d['uniqueid'],_0x511a9d[_0x2faf('0x5f')],_0x511a9d['appdata']));if(_0x511a9d[_0x2faf('0x5f')][_0x2faf('0x60')]()==_0x2faf('0x61')&&_[_0x2faf('0x62')](_0x511a9d[_0x2faf('0x63')][_0x2faf('0x60')](),'cdr')){var _0x4ae826=_0x511a9d[_0x2faf('0x63')][_0x2faf('0x64')]('=');var _0x23e0b3=_0x4ae826[0x0]['substring'](_0x4ae826[0x0]['lastIndexOf']('(')+0x1,_0x4ae826[0x0]['lastIndexOf'](')'));var _0xf12eeb=_0x4ae826[0x1];channels[_0x511a9d[_0x2faf('0x9')]][_0x23e0b3]=_0xf12eeb;}if(!_[_0x2faf('0x65')]([_0x2faf('0x2b'),'noop',_0x2faf('0x66'),_0x2faf('0x61'),'gotoif'],_0x511a9d[_0x2faf('0x5f')][_0x2faf('0x60')]())){channels[_0x511a9d[_0x2faf('0x9')]][_0x2faf('0x52')]=_0x511a9d[_0x2faf('0x5f')];channels[_0x511a9d[_0x2faf('0x9')]][_0x2faf('0x67')]=_0x511a9d[_0x2faf('0x63')];}}}catch(_0x3494f5){utils['error'](util[_0x2faf('0x7')]('[%s][calls][newexten]',_0x511a9d['uniqueid']),_0x3494f5);}}; \ No newline at end of file +var _0x6be9=['[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','execif','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','localtwolinkedid'];(function(_0x240356,_0x309891){var _0x28152a=function(_0x62468c){while(--_0x62468c){_0x240356['push'](_0x240356['shift']());}};_0x28152a(++_0x309891);}(_0x6be9,0x9d));var _0x96be=function(_0x5adf0c,_0x2e4451){_0x5adf0c=_0x5adf0c-0x0;var _0x19788d=_0x6be9[_0x5adf0c];return _0x19788d;};'use strict';var _=require(_0x96be('0x0'));var util=require(_0x96be('0x1'));var utils=require(_0x96be('0x2'));var dispositions=[_0x96be('0x3'),'FAILED','FAILED',_0x96be('0x3'),_0x96be('0x3'),_0x96be('0x3'),_0x96be('0x4'),_0x96be('0x5'),_0x96be('0x6'),_0x96be('0x6'),_0x96be('0x6')];var channels={};function writeDB(_0x147204){utils[_0x96be('0x7')](util[_0x96be('0x8')](_0x96be('0x9'),_0x147204['uniqueid'],_0x147204['channel'],_0x147204[_0x96be('0xa')],_0x147204[_0x96be('0xb')],_0x147204['interface'],_0x147204[_0x96be('0xc')],_0x147204[_0x96be('0xd')],_0x147204[_0x96be('0xe')]));if(_0x147204[_0x96be('0xf')]){utils[_0x96be('0x10')](_0x147204[_0x96be('0xf')])[_0x96be('0x11')](function(_0x58f578){if(_0x58f578){_0x147204[_0x96be('0x12')]=_0x58f578['id'];}utils[_0x96be('0x13')](_0x96be('0x14'),_0x147204);});}else{utils[_0x96be('0x13')]('CreateVoiceCallReport',_0x147204);}if(channels[_0x147204[_0x96be('0x15')]]){delete channels[_0x147204[_0x96be('0x15')]];}}exports['newchannel']=function(_0x522340){try{utils[_0x96be('0x16')](util[_0x96be('0x8')](_0x96be('0x17'),_0x522340[_0x96be('0x15')]),_0x522340);if(_0x522340[_0x96be('0x15')]==_0x522340[_0x96be('0x18')]&&_0x522340['channel']!=_0x96be('0x19')){utils[_0x96be('0x7')](util[_0x96be('0x8')](_0x96be('0x1a'),_0x522340[_0x96be('0x15')],_0x522340['context'],_0x522340[_0x96be('0x1b')]));channels[_0x522340[_0x96be('0x15')]]={'uniqueid':_0x522340[_0x96be('0x15')],'accountcode':_0x522340['accountcode'],'source':_0x522340[_0x96be('0xc')],'destination':_0x522340['exten'],'destinationcontext':_0x522340[_0x96be('0x1c')],'channel':_0x522340[_0x96be('0x1d')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x96be('0x1e')};}}catch(_0x84ef6d){utils[_0x96be('0x1f')](util['format'](_0x96be('0x17'),_0x522340[_0x96be('0x15')]),_0x84ef6d);}};exports[_0x96be('0x20')]=function(_0xd3c05e){try{utils[_0x96be('0x16')](util[_0x96be('0x8')]('[%s][calls][newstate]',_0xd3c05e['uniqueid']),_0xd3c05e);if(!_[_0x96be('0x21')](channels[_0xd3c05e[_0x96be('0x15')]])&&_0xd3c05e[_0x96be('0x22')]==0x6){utils[_0x96be('0x7')](util[_0x96be('0x8')](_0x96be('0x23'),_0xd3c05e[_0x96be('0x15')],_0xd3c05e[_0x96be('0x1c')],_0xd3c05e[_0x96be('0x1d')]));if(_[_0x96be('0x21')](channels[_0xd3c05e[_0x96be('0x15')]]['systemanswertime'])){channels[_0xd3c05e[_0x96be('0x15')]]['systemanswertime']=utils[_0x96be('0x24')]();}}else if(!_['isNil'](channels[_0xd3c05e['linkedid']])&&_0xd3c05e[_0x96be('0x22')]==0x6&&_0xd3c05e[_0x96be('0x1c')]!=_0x96be('0x25')){utils[_0x96be('0x7')](util['format'](_0x96be('0x26'),_0xd3c05e['uniqueid'],_0xd3c05e[_0x96be('0x18')],_0xd3c05e['context'],_0xd3c05e[_0x96be('0x1d')]));channels[_0xd3c05e['linkedid']][_0x96be('0xf')]=_0xd3c05e[_0x96be('0xf')];channels[_0xd3c05e[_0x96be('0x18')]][_0x96be('0x27')]=_0xd3c05e[_0x96be('0x1d')];if(_[_0x96be('0x21')](channels[_0xd3c05e[_0x96be('0x18')]][_0x96be('0x28')])){channels[_0xd3c05e[_0x96be('0x18')]][_0x96be('0x28')]=utils[_0x96be('0x24')]();}channels[_0xd3c05e[_0x96be('0x18')]][_0x96be('0x29')]=dispositions[_[_0x96be('0x2a')](_0xd3c05e['channelstate'])]||_0x96be('0x4');}}catch(_0x47141f){utils[_0x96be('0x1f')](util[_0x96be('0x8')](_0x96be('0x2b'),_0xd3c05e[_0x96be('0x15')]),_0x47141f);}};exports[_0x96be('0x2c')]=function(_0x471167){try{if(!_[_0x96be('0x21')](channels[_0x471167[_0x96be('0x15')]])){utils[_0x96be('0x16')](util['format'](_0x96be('0x2d'),_0x471167[_0x96be('0x15')]),_0x471167);if(_[_0x96be('0x21')](channels[_0x471167['uniqueid']][_0x96be('0x2e')])){channels[_0x471167[_0x96be('0x15')]][_0x96be('0x2e')]=_0x471167[_0x96be('0x2f')]+'\x20<'+_0x471167[_0x96be('0xc')]+'>';}utils[_0x96be('0x7')](util[_0x96be('0x8')](_0x96be('0x30'),_0x471167[_0x96be('0x15')],channels[_0x471167['uniqueid']][_0x96be('0x2e')],_0x471167['cause-txt']));channels[_0x471167[_0x96be('0x15')]][_0x96be('0x31')]=utils[_0x96be('0x24')]();channels[_0x471167['uniqueid']]['duration']=utils[_0x96be('0x32')](channels[_0x471167['uniqueid']][_0x96be('0x31')],channels[_0x471167['uniqueid']][_0x96be('0x33')]);channels[_0x471167['uniqueid']]['billableseconds']=channels[_0x471167[_0x96be('0x15')]]['answertime']?utils['diffTime'](channels[_0x471167['uniqueid']][_0x96be('0x31')],channels[_0x471167[_0x96be('0x15')]][_0x96be('0x28')]):0x0;writeDB(channels[_0x471167[_0x96be('0x15')]]);}}catch(_0x3ff7cf){utils[_0x96be('0x1f')](util[_0x96be('0x8')](_0x96be('0x2d'),_0x471167[_0x96be('0x15')]),_0x3ff7cf);}};exports['attendedtransfer']=function(_0x4b6a2a){try{if(!_['isNil'](channels[_0x4b6a2a[_0x96be('0x34')]])){utils[_0x96be('0x16')](util['format'](_0x96be('0x35'),_0x4b6a2a[_0x96be('0x36')]),_0x4b6a2a);if(channels[_0x4b6a2a[_0x96be('0x34')]][_0x96be('0x1d')]==_0x4b6a2a[_0x96be('0x37')]){utils['info'](util[_0x96be('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b6a2a[_0x96be('0x36')],_0x4b6a2a[_0x96be('0x34')],_0x4b6a2a[_0x96be('0x38')]));channels[_0x4b6a2a['localtwolinkedid']][_0x96be('0x27')]=_0x4b6a2a[_0x96be('0x38')];channels[_0x4b6a2a[_0x96be('0x34')]][_0x96be('0x39')]=_0x96be('0x3a');}else if(channels[_0x4b6a2a['localtwolinkedid']][_0x96be('0x1d')]=_0x4b6a2a[_0x96be('0x3b')]){utils[_0x96be('0x7')](util[_0x96be('0x8')](_0x96be('0x3c'),_0x4b6a2a['origtransfereruniqueid'],_0x4b6a2a[_0x96be('0x34')],_0x4b6a2a['origtransfererchannel']));channels[_0x4b6a2a['localtwolinkedid']][_0x96be('0x27')]=_0x4b6a2a['origtransfererchannel'];channels[_0x4b6a2a[_0x96be('0x34')]][_0x96be('0x39')]='_attended';}}}catch(_0x4868fa){utils[_0x96be('0x1f')](util[_0x96be('0x8')](_0x96be('0x35'),_0x4b6a2a[_0x96be('0x36')]),_0x4868fa);}};exports[_0x96be('0x3d')]=function(_0x171fed){try{if(!_[_0x96be('0x21')](channels[_0x171fed[_0x96be('0x15')]])){utils[_0x96be('0x16')](util[_0x96be('0x8')](_0x96be('0x3e'),_0x171fed[_0x96be('0x15')]),_0x171fed);channels[_0x171fed[_0x96be('0x15')]][_0x96be('0x3f')]=utils[_0x96be('0x24')]();utils['info'](util[_0x96be('0x8')](_0x96be('0x40'),_0x171fed['uniqueid'],channels[_0x171fed[_0x96be('0x15')]][_0x96be('0x3f')]));}}catch(_0xec2047){utils['error'](util[_0x96be('0x8')](_0x96be('0x3e'),_0x171fed[_0x96be('0x15')]),_0xec2047);}};exports[_0x96be('0x41')]=function(_0x28659a){try{if(!_[_0x96be('0x21')](channels[_0x28659a[_0x96be('0x15')]])){utils['debug'](util[_0x96be('0x8')](_0x96be('0x42'),_0x28659a['uniqueid']),_0x28659a);if(!_[_0x96be('0x21')](channels[_0x28659a[_0x96be('0x15')]][_0x96be('0x3f')])){channels[_0x28659a['uniqueid']][_0x96be('0x43')]+=utils['diffTime'](utils['now'](),channels[_0x28659a[_0x96be('0x15')]]['musiconholdstartAt']);utils[_0x96be('0x7')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x28659a[_0x96be('0x15')],channels[_0x28659a['uniqueid']][_0x96be('0x43')]));delete channels[_0x28659a[_0x96be('0x15')]][_0x96be('0x3f')];}}}catch(_0x4d0925){utils['error'](util[_0x96be('0x8')](_0x96be('0x42'),_0x28659a[_0x96be('0x15')]),_0x4d0925);}};exports['varset']=function(_0x491797){try{if(!_[_0x96be('0x21')](channels[_0x491797['uniqueid']])){utils[_0x96be('0x16')](util['format']('[%s][calls][varset]',_0x491797[_0x96be('0x15')]),_0x491797);if(!_[_0x96be('0x21')](_0x491797[_0x96be('0x44')][_0x96be('0x45')])){utils[_0x96be('0x7')](util[_0x96be('0x8')](_0x96be('0x46'),_0x491797['uniqueid'],_0x491797[_0x96be('0x47')]));channels[_0x491797[_0x96be('0x15')]][_0x96be('0x48')]=_0x491797['value'];}if(!_[_0x96be('0x21')](_0x491797[_0x96be('0x44')][_0x96be('0x49')])){utils[_0x96be('0x7')](util['format'](_0x96be('0x4a'),_0x491797[_0x96be('0x15')],_0x491797['value']));channels[_0x491797['uniqueid']][_0x96be('0x4b')]=_0x491797[_0x96be('0x47')];channels[_0x491797['uniqueid']]['callerid']='\x22'+_0x491797['value']+_0x96be('0x4c')+_0x491797[_0x96be('0x47')]+'>';}if(!_[_0x96be('0x21')](_0x491797[_0x96be('0x44')]['xmd-callerid-preview'])||!_[_0x96be('0x21')](_0x491797['variable'][_0x96be('0x4d')])){utils['info'](util[_0x96be('0x8')](_0x96be('0x4e'),_0x491797[_0x96be('0x15')],!_[_0x96be('0x21')](_0x491797['variable'][_0x96be('0x4f')])?_0x96be('0x4f'):_0x96be('0x4d'),_0x491797[_0x96be('0x47')]));channels[_0x491797[_0x96be('0x15')]][_0x96be('0x2e')]=_0x491797['value'];}if(!_[_0x96be('0x21')](_0x491797[_0x96be('0x44')][_0x96be('0x50')])||!_[_0x96be('0x21')](_0x491797[_0x96be('0x44')][_0x96be('0x51')])){utils[_0x96be('0x7')](util[_0x96be('0x8')](_0x96be('0x4e'),_0x491797[_0x96be('0x15')],!_[_0x96be('0x21')](_0x491797[_0x96be('0x44')][_0x96be('0x50')])?_0x96be('0x50'):_0x96be('0x51'),_0x491797[_0x96be('0x47')]));channels[_0x491797[_0x96be('0x15')]][_0x96be('0x52')]=_0x96be('0x53');channels[_0x491797['uniqueid']][_0x96be('0x54')]=_0x491797['value'];channels[_0x491797[_0x96be('0x15')]][_0x96be('0xa')]=!![];}if(!_[_0x96be('0x21')](_0x491797['variable'][_0x96be('0x55')])){utils[_0x96be('0x7')](util[_0x96be('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x491797[_0x96be('0x15')],_0x491797['value']));channels[_0x491797[_0x96be('0x15')]][_0x96be('0x56')]=_0x491797[_0x96be('0x47')];}if(!_[_0x96be('0x21')](_0x491797[_0x96be('0x44')][_0x96be('0x57')])){utils['info'](util['format'](_0x96be('0x58'),_0x491797['uniqueid'],_0x491797[_0x96be('0x47')]));channels[_0x491797[_0x96be('0x15')]][_0x96be('0x59')]=_0x491797['value'];}if(!_[_0x96be('0x21')](_0x491797[_0x96be('0x44')][_0x96be('0x5a')])){utils['info'](util[_0x96be('0x8')](_0x96be('0x5b'),_0x491797[_0x96be('0x15')],_0x491797['value']));channels[_0x491797[_0x96be('0x15')]]['routeid']=_0x491797[_0x96be('0x47')];}if(!_[_0x96be('0x21')](_0x491797['variable']['sipcallid'])){utils[_0x96be('0x7')](util[_0x96be('0x8')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x491797[_0x96be('0x15')],_0x491797[_0x96be('0x47')]));channels[_0x491797['uniqueid']]['sipcallid']=_0x491797[_0x96be('0x47')];}}}catch(_0x56dfc3){utils[_0x96be('0x1f')](util[_0x96be('0x8')]('[%s][calls][varset]',_0x491797[_0x96be('0x15')]),_0x56dfc3);}};exports[_0x96be('0x5c')]=function(_0x33065b){try{if(!_['isNil'](channels[_0x33065b[_0x96be('0x15')]])){utils['debug'](util['format'](_0x96be('0x5d'),_0x33065b[_0x96be('0x15')]),_0x33065b);utils['info'](util[_0x96be('0x8')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x33065b[_0x96be('0x15')],_0x33065b[_0x96be('0x5e')],_0x33065b[_0x96be('0x5f')]));if(_0x33065b[_0x96be('0x5e')][_0x96be('0x60')]()==_0x96be('0x61')&&_['startsWith'](_0x33065b['appdata'][_0x96be('0x60')](),_0x96be('0x62'))){var _0xedd136=_0x33065b[_0x96be('0x5f')][_0x96be('0x63')]('=');var _0x470af3=_0xedd136[0x0][_0x96be('0x64')](_0xedd136[0x0][_0x96be('0x65')]('(')+0x1,_0xedd136[0x0][_0x96be('0x65')](')'));var _0x1afaf8=_0xedd136[0x1];channels[_0x33065b[_0x96be('0x15')]][_0x470af3]=_0x1afaf8;}if(!_[_0x96be('0x66')](['hangup',_0x96be('0x67'),_0x96be('0x68'),_0x96be('0x61'),'gotoif'],_0x33065b[_0x96be('0x5e')][_0x96be('0x60')]())){channels[_0x33065b[_0x96be('0x15')]][_0x96be('0x52')]=_0x33065b[_0x96be('0x5e')];channels[_0x33065b[_0x96be('0x15')]][_0x96be('0x54')]=_0x33065b[_0x96be('0x5f')];}}}catch(_0x1dfc88){utils[_0x96be('0x1f')](util[_0x96be('0x8')](_0x96be('0x5d'),_0x33065b[_0x96be('0x15')]),_0x1dfc88);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index eaa7286..9a512cc 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 _0x529c=['info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error','close','./utils','connect','[core]\x20connected','shutdown'];(function(_0x33e613,_0x2e55f0){var _0x421c4b=function(_0x414491){while(--_0x414491){_0x33e613['push'](_0x33e613['shift']());}};_0x421c4b(++_0x2e55f0);}(_0x529c,0x132));var _0xc529=function(_0x40ef64,_0x4f3b9d){_0x40ef64=_0x40ef64-0x0;var _0x37fcb8=_0x529c[_0x40ef64];return _0x37fcb8;};'use strict';var utils=require(_0xc529('0x0'));exports[_0xc529('0x1')]=function(){utils['info'](_0xc529('0x2'));};exports[_0xc529('0x3')]=function(){utils[_0xc529('0x4')](_0xc529('0x5'));};exports[_0xc529('0x6')]=function(){utils[_0xc529('0x4')](_0xc529('0x7'));};exports['error']=function(_0x452dda){utils['error'](_0xc529('0x8'),_0x452dda);};exports[_0xc529('0x9')]=function(){utils[_0xc529('0x4')]('[core]\x20close');};exports['managerevent']=function(_0x127b54){}; \ No newline at end of file +var _0xead8=['connect','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x4d8369,_0x34f5e0){var _0x3020b6=function(_0x27804a){while(--_0x27804a){_0x4d8369['push'](_0x4d8369['shift']());}};_0x3020b6(++_0x34f5e0);}(_0xead8,0x8f));var _0x8ead=function(_0x1a547e,_0x5917d3){_0x1a547e=_0x1a547e-0x0;var _0x5ebdaf=_0xead8[_0x1a547e];return _0x5ebdaf;};'use strict';var utils=require('./utils');exports[_0x8ead('0x0')]=function(){utils['info'](_0x8ead('0x1'));};exports[_0x8ead('0x2')]=function(){utils['info'](_0x8ead('0x3'));};exports[_0x8ead('0x4')]=function(){utils[_0x8ead('0x5')](_0x8ead('0x6'));};exports[_0x8ead('0x7')]=function(_0xd758bd){utils[_0x8ead('0x7')](_0x8ead('0x8'),_0xd758bd);};exports[_0x8ead('0x9')]=function(){utils[_0x8ead('0x5')](_0x8ead('0xa'));};exports['managerevent']=function(_0x4f370a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 23b4222..bc45828 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 _0x7f3c=['holdtime','billableseconds','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','connectedlinenum','request','CreateVoiceDialReport','newexten','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','[%s][dials][newexten]','varset','debug','isNil','variable','outboundrouteid','value','[%s][dials][varset]','[%s][dials][dialbegin]','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','error','dialend','dialstatus','ANSWER','assign','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7f3c,0x192));var _0xc7f3=function(_0x26f866,_0x1900bc){_0x26f866=_0x26f866-0x0;var _0x1abef3=_0x7f3c[_0x26f866];return _0x1abef3;};'use strict';var _=require(_0xc7f3('0x0'));var util=require('util');var utils=require(_0xc7f3('0x1'));var dials={};function writeDB(_0x4d4ab4){utils[_0xc7f3('0x2')](util['format'](_0xc7f3('0x3'),_0x4d4ab4[_0xc7f3('0x4')],_0x4d4ab4[_0xc7f3('0x5')],_0x4d4ab4['dialstring'],_0x4d4ab4['calleridnum'],_0x4d4ab4[_0xc7f3('0x6')],_0x4d4ab4['dialstatus']));utils[_0xc7f3('0x7')](_0xc7f3('0x8'),_0x4d4ab4);delete dials[_0x4d4ab4['uniqueid']];}exports[_0xc7f3('0x9')]=function(_0x2f9069){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x2f9069[_0xc7f3('0x4')]),_0x2f9069);utils[_0xc7f3('0x2')](util[_0xc7f3('0xa')](_0xc7f3('0xb'),_0x2f9069[_0xc7f3('0x4')],_0x2f9069[_0xc7f3('0xc')],_0x2f9069[_0xc7f3('0xd')]));if(_0x2f9069['application'][_0xc7f3('0xe')]()==_0xc7f3('0xf')&&_[_0xc7f3('0x10')](_0x2f9069['appdata'][_0xc7f3('0xe')](),_0xc7f3('0x11'))){var _0x3910f5=_0x2f9069['appdata'][_0xc7f3('0x12')]('=');dials[_0x2f9069[_0xc7f3('0x4')]]={'routeId':_0x3910f5[0x1]};}}catch(_0x289127){utils['error'](util[_0xc7f3('0xa')](_0xc7f3('0x13'),_0x2f9069['uniqueid']),_0x289127);}};exports[_0xc7f3('0x14')]=function(_0x3944fb){try{utils[_0xc7f3('0x15')](util[_0xc7f3('0xa')]('[%s][dials][varset]',_0x3944fb[_0xc7f3('0x4')]),_0x3944fb);if(!_[_0xc7f3('0x16')](_0x3944fb[_0xc7f3('0x17')][_0xc7f3('0x18')])){utils[_0xc7f3('0x2')](util[_0xc7f3('0xa')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3944fb[_0xc7f3('0x4')],_0x3944fb[_0xc7f3('0x19')]));dials[_0x3944fb[_0xc7f3('0x4')]]={'routeId':_0x3944fb[_0xc7f3('0x19')]};}}catch(_0xc15db4){utils['error'](util[_0xc7f3('0xa')](_0xc7f3('0x1a'),_0x3944fb[_0xc7f3('0x4')]),_0xc15db4);}};exports['dialbegin']=function(_0x596052){try{if(!_['isNil'](dials[_0x596052[_0xc7f3('0x4')]])){utils['debug'](util[_0xc7f3('0xa')](_0xc7f3('0x1b'),_0x596052[_0xc7f3('0x4')]),_0x596052);dials[_0x596052[_0xc7f3('0x4')]]=_['assign'](dials[_0x596052['uniqueid']],_0x596052);dials[_0x596052[_0xc7f3('0x4')]]['starttime']=utils[_0xc7f3('0x1c')]();dials[_0x596052[_0xc7f3('0x4')]][_0xc7f3('0x1d')]='called';utils[_0xc7f3('0x2')](util[_0xc7f3('0xa')](_0xc7f3('0x1e'),_0x596052[_0xc7f3('0x4')],dials[_0x596052[_0xc7f3('0x4')]][_0xc7f3('0x1f')]));}}catch(_0x26d079){utils[_0xc7f3('0x20')](util[_0xc7f3('0xa')]('[%s][dials][dialbegin]',_0x596052[_0xc7f3('0x4')]),_0x26d079);}};exports[_0xc7f3('0x21')]=function(_0x1c894b){try{if(!_[_0xc7f3('0x16')](dials[_0x1c894b[_0xc7f3('0x4')]])){utils[_0xc7f3('0x15')](util[_0xc7f3('0xa')]('[%s][dials][dialend]',_0x1c894b[_0xc7f3('0x4')]),_0x1c894b);dials[_0x1c894b[_0xc7f3('0x4')]][_0xc7f3('0x22')]=_0x1c894b['dialstatus'];if(_0x1c894b[_0xc7f3('0x22')]==_0xc7f3('0x23')){dials[_0x1c894b[_0xc7f3('0x4')]]=_[_0xc7f3('0x24')](dials[_0x1c894b[_0xc7f3('0x4')]],_0x1c894b);dials[_0x1c894b[_0xc7f3('0x4')]][_0xc7f3('0x25')]=utils[_0xc7f3('0x1c')]();dials[_0x1c894b[_0xc7f3('0x4')]][_0xc7f3('0x1d')]='connect';utils[_0xc7f3('0x2')](util[_0xc7f3('0xa')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1c894b[_0xc7f3('0x4')],_0x1c894b[_0xc7f3('0x22')],dials[_0x1c894b[_0xc7f3('0x4')]][_0xc7f3('0x25')]));}else{utils[_0xc7f3('0x2')](util[_0xc7f3('0xa')](_0xc7f3('0x26'),_0x1c894b[_0xc7f3('0x4')],_0x1c894b['dialstatus']));}}}catch(_0xd2fc12){utils[_0xc7f3('0x20')](util[_0xc7f3('0xa')](_0xc7f3('0x27'),_0x1c894b[_0xc7f3('0x4')]),_0xd2fc12);}};exports[_0xc7f3('0x28')]=function(_0x31a5d3){try{if(!_[_0xc7f3('0x16')](dials[_0x31a5d3['uniqueid']])){utils['debug'](util[_0xc7f3('0xa')](_0xc7f3('0x29'),_0x31a5d3['uniqueid']),_0x31a5d3);utils[_0xc7f3('0x2')](util[_0xc7f3('0xa')](_0xc7f3('0x2a'),_0x31a5d3[_0xc7f3('0x4')],_0x31a5d3['calleridnum'],_0x31a5d3[_0xc7f3('0x2b')],_0x31a5d3[_0xc7f3('0x2c')]));dials[_0x31a5d3[_0xc7f3('0x4')]]=_[_0xc7f3('0x24')](dials[_0x31a5d3['uniqueid']],{'endtime':utils[_0xc7f3('0x1c')](),'lastevent':_0xc7f3('0x2d')});dials[_0x31a5d3['uniqueid']]['duration']=utils[_0xc7f3('0x2e')](dials[_0x31a5d3[_0xc7f3('0x4')]][_0xc7f3('0x2f')],dials[_0x31a5d3[_0xc7f3('0x4')]][_0xc7f3('0x1f')]);dials[_0x31a5d3[_0xc7f3('0x4')]][_0xc7f3('0x30')]=utils[_0xc7f3('0x2e')](dials[_0x31a5d3[_0xc7f3('0x4')]][_0xc7f3('0x25')]||dials[_0x31a5d3[_0xc7f3('0x4')]]['endtime'],dials[_0x31a5d3[_0xc7f3('0x4')]][_0xc7f3('0x1f')]);dials[_0x31a5d3[_0xc7f3('0x4')]][_0xc7f3('0x31')]=dials[_0x31a5d3['uniqueid']][_0xc7f3('0x25')]?utils['diffTime'](dials[_0x31a5d3['uniqueid']][_0xc7f3('0x2f')],dials[_0x31a5d3['uniqueid']][_0xc7f3('0x25')]):0x0;writeDB(dials[_0x31a5d3[_0xc7f3('0x4')]]);}}catch(_0x4dda3e){utils['error'](util[_0xc7f3('0xa')](_0xc7f3('0x29'),_0x31a5d3[_0xc7f3('0x4')]),_0x4dda3e);}}; \ No newline at end of file +var _0x3ffa=['answertime','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','starttime','holdtime','endtime','billableseconds','lodash','util','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','split','error','varset','variable','value','dialbegin','isNil','assign','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','ANSWER'];(function(_0x1df8fa,_0x534f57){var _0x1db6e7=function(_0x567dab){while(--_0x567dab){_0x1df8fa['push'](_0x1df8fa['shift']());}};_0x1db6e7(++_0x534f57);}(_0x3ffa,0xa2));var _0xa3ff=function(_0x13076c,_0x526320){_0x13076c=_0x13076c-0x0;var _0x181576=_0x3ffa[_0x13076c];return _0x181576;};'use strict';var _=require(_0xa3ff('0x0'));var util=require(_0xa3ff('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3a0013){utils[_0xa3ff('0x2')](util[_0xa3ff('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x3a0013[_0xa3ff('0x4')],_0x3a0013[_0xa3ff('0x5')],_0x3a0013[_0xa3ff('0x6')],_0x3a0013[_0xa3ff('0x7')],_0x3a0013[_0xa3ff('0x8')],_0x3a0013[_0xa3ff('0x9')]));utils[_0xa3ff('0xa')](_0xa3ff('0xb'),_0x3a0013);delete dials[_0x3a0013[_0xa3ff('0x4')]];}exports[_0xa3ff('0xc')]=function(_0x44788b){try{utils[_0xa3ff('0xd')](util[_0xa3ff('0x3')](_0xa3ff('0xe'),_0x44788b[_0xa3ff('0x4')]),_0x44788b);utils[_0xa3ff('0x2')](util[_0xa3ff('0x3')](_0xa3ff('0xf'),_0x44788b[_0xa3ff('0x4')],_0x44788b[_0xa3ff('0x10')],_0x44788b[_0xa3ff('0x11')]));if(_0x44788b[_0xa3ff('0x10')]['toLowerCase']()==_0xa3ff('0x12')&&_[_0xa3ff('0x13')](_0x44788b[_0xa3ff('0x11')][_0xa3ff('0x14')](),'cdr(routeid)')){var _0x2cc25f=_0x44788b[_0xa3ff('0x11')][_0xa3ff('0x15')]('=');dials[_0x44788b['uniqueid']]={'routeId':_0x2cc25f[0x1]};}}catch(_0x2d4f60){utils[_0xa3ff('0x16')](util[_0xa3ff('0x3')](_0xa3ff('0xe'),_0x44788b[_0xa3ff('0x4')]),_0x2d4f60);}};exports[_0xa3ff('0x17')]=function(_0x249287){try{utils[_0xa3ff('0xd')](util[_0xa3ff('0x3')]('[%s][dials][varset]',_0x249287['uniqueid']),_0x249287);if(!_['isNil'](_0x249287[_0xa3ff('0x18')]['outboundrouteid'])){utils[_0xa3ff('0x2')](util[_0xa3ff('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x249287[_0xa3ff('0x4')],_0x249287['value']));dials[_0x249287[_0xa3ff('0x4')]]={'routeId':_0x249287[_0xa3ff('0x19')]};}}catch(_0x3439f3){utils[_0xa3ff('0x16')](util[_0xa3ff('0x3')]('[%s][dials][varset]',_0x249287[_0xa3ff('0x4')]),_0x3439f3);}};exports[_0xa3ff('0x1a')]=function(_0x4f7060){try{if(!_[_0xa3ff('0x1b')](dials[_0x4f7060[_0xa3ff('0x4')]])){utils[_0xa3ff('0xd')](util[_0xa3ff('0x3')]('[%s][dials][dialbegin]',_0x4f7060[_0xa3ff('0x4')]),_0x4f7060);dials[_0x4f7060[_0xa3ff('0x4')]]=_[_0xa3ff('0x1c')](dials[_0x4f7060['uniqueid']],_0x4f7060);dials[_0x4f7060[_0xa3ff('0x4')]]['starttime']=utils['now']();dials[_0x4f7060[_0xa3ff('0x4')]]['lastevent']=_0xa3ff('0x1d');utils[_0xa3ff('0x2')](util[_0xa3ff('0x3')](_0xa3ff('0x1e'),_0x4f7060[_0xa3ff('0x4')],dials[_0x4f7060[_0xa3ff('0x4')]]['starttime']));}}catch(_0x384e4a){utils[_0xa3ff('0x16')](util[_0xa3ff('0x3')](_0xa3ff('0x1f'),_0x4f7060[_0xa3ff('0x4')]),_0x384e4a);}};exports['dialend']=function(_0x23b754){try{if(!_[_0xa3ff('0x1b')](dials[_0x23b754['uniqueid']])){utils[_0xa3ff('0xd')](util[_0xa3ff('0x3')](_0xa3ff('0x20'),_0x23b754['uniqueid']),_0x23b754);dials[_0x23b754[_0xa3ff('0x4')]][_0xa3ff('0x9')]=_0x23b754[_0xa3ff('0x9')];if(_0x23b754[_0xa3ff('0x9')]==_0xa3ff('0x21')){dials[_0x23b754['uniqueid']]=_[_0xa3ff('0x1c')](dials[_0x23b754[_0xa3ff('0x4')]],_0x23b754);dials[_0x23b754[_0xa3ff('0x4')]][_0xa3ff('0x22')]=utils[_0xa3ff('0x23')]();dials[_0x23b754[_0xa3ff('0x4')]][_0xa3ff('0x24')]=_0xa3ff('0x25');utils[_0xa3ff('0x2')](util[_0xa3ff('0x3')](_0xa3ff('0x26'),_0x23b754[_0xa3ff('0x4')],_0x23b754[_0xa3ff('0x9')],dials[_0x23b754[_0xa3ff('0x4')]]['answertime']));}else{utils[_0xa3ff('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x23b754[_0xa3ff('0x4')],_0x23b754['dialstatus']));}}}catch(_0x2c13f4){utils[_0xa3ff('0x16')](util[_0xa3ff('0x3')](_0xa3ff('0x20'),_0x23b754[_0xa3ff('0x4')]),_0x2c13f4);}};exports['hangup']=function(_0x57b1ba){try{if(!_['isNil'](dials[_0x57b1ba[_0xa3ff('0x4')]])){utils['debug'](util[_0xa3ff('0x3')]('[%s][dials][hangup]',_0x57b1ba[_0xa3ff('0x4')]),_0x57b1ba);utils[_0xa3ff('0x2')](util[_0xa3ff('0x3')](_0xa3ff('0x27'),_0x57b1ba[_0xa3ff('0x4')],_0x57b1ba[_0xa3ff('0x7')],_0x57b1ba[_0xa3ff('0x28')],_0x57b1ba[_0xa3ff('0x29')]));dials[_0x57b1ba[_0xa3ff('0x4')]]=_[_0xa3ff('0x1c')](dials[_0x57b1ba['uniqueid']],{'endtime':utils[_0xa3ff('0x23')](),'lastevent':_0xa3ff('0x2a')});dials[_0x57b1ba['uniqueid']][_0xa3ff('0x2b')]=utils[_0xa3ff('0x2c')](dials[_0x57b1ba['uniqueid']]['endtime'],dials[_0x57b1ba[_0xa3ff('0x4')]][_0xa3ff('0x2d')]);dials[_0x57b1ba[_0xa3ff('0x4')]][_0xa3ff('0x2e')]=utils['diffTime'](dials[_0x57b1ba[_0xa3ff('0x4')]]['answertime']||dials[_0x57b1ba[_0xa3ff('0x4')]][_0xa3ff('0x2f')],dials[_0x57b1ba['uniqueid']][_0xa3ff('0x2d')]);dials[_0x57b1ba[_0xa3ff('0x4')]][_0xa3ff('0x30')]=dials[_0x57b1ba[_0xa3ff('0x4')]][_0xa3ff('0x22')]?utils['diffTime'](dials[_0x57b1ba[_0xa3ff('0x4')]]['endtime'],dials[_0x57b1ba['uniqueid']]['answertime']):0x0;writeDB(dials[_0x57b1ba[_0xa3ff('0x4')]]);}}catch(_0x4f9f4c){utils[_0xa3ff('0x16')](util[_0xa3ff('0x3')]('[%s][dials][hangup]',_0x57b1ba[_0xa3ff('0x4')]),_0x4f9f4c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 357b116..fa5955d 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 _0x4ad2=['[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','password','info','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','debug','format','device','devicestatechange','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x4ad2,0x91));var _0x24ad=function(_0x339b47,_0x527973){_0x339b47=_0x339b47-0x0;var _0x149499=_0x4ad2[_0x339b47];return _0x149499;};var AsteriskManager=require(_0x24ad('0x0'));var config=require(_0x24ad('0x1'));var utils=require(_0x24ad('0x2'));var util=require(_0x24ad('0x3'));var isXDREnabled=config[_0x24ad('0x4')]&&config['xdr'][_0x24ad('0x5')]?!config[_0x24ad('0x4')][_0x24ad('0x5')]:!![];var isProduction=config['env']===_0x24ad('0x6')||![];var isLocalAsterisk=config[_0x24ad('0x4')]&&config[_0x24ad('0x4')][_0x24ad('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x24ad('0x8')][_0x24ad('0x9')],config[_0x24ad('0x8')]['ip'],config['asterisk']['username'],config['asterisk'][_0x24ad('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x24ad('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x24ad('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x24ad('0xc'));var queues=require(_0x24ad('0xd'));var recordings=require(_0x24ad('0xe'));var members=require('./members.controller');var dials=require(_0x24ad('0xf'));var transfers=require(_0x24ad('0x10'));var core=require('./core.controller');ami['on'](_0x24ad('0x11'),core['connect']);ami['on'](_0x24ad('0x12'),core['shutdown']);ami['on'](_0x24ad('0x13'),core[_0x24ad('0x13')]);ami['on'](_0x24ad('0x14'),core[_0x24ad('0x14')]);ami['on']('close',core[_0x24ad('0x15')]);ami['on']('managerevent',core['managerevent']);ami['on']('devicestatechange',function(_0x206bc6){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')]('[%s][index][devicestatechange]',_0x206bc6[_0x24ad('0x18')]),_0x206bc6);members[_0x24ad('0x19')](_0x206bc6);}catch(_0x8a4ae){utils['error'](util[_0x24ad('0x17')]('[%s][index][devicestatechange]',_0x206bc6[_0x24ad('0x18')]),_0x8a4ae);}});ami['on'](_0x24ad('0x1a'),function(_0x41d509){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')]('[%s][index][agentcalled]',_0x41d509[_0x24ad('0x1b')]),_0x41d509);agents[_0x24ad('0x1a')](_0x41d509);}catch(_0x3db6ae){utils['error'](util[_0x24ad('0x17')](_0x24ad('0x1c'),_0x41d509[_0x24ad('0x1b')]),_0x3db6ae);}});ami['on'](_0x24ad('0x1d'),function(_0x324a8f){try{utils[_0x24ad('0x16')](util['format'](_0x24ad('0x1e'),_0x324a8f['uniqueid']),_0x324a8f);agents[_0x24ad('0x1d')](_0x324a8f);}catch(_0x34cee9){utils[_0x24ad('0x14')](util['format'](_0x24ad('0x1e'),_0x324a8f[_0x24ad('0x1b')]),_0x34cee9);}});ami['on'](_0x24ad('0x1f'),function(_0x4667cb){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')](_0x24ad('0x20'),_0x4667cb[_0x24ad('0x1b')]),_0x4667cb);agents[_0x24ad('0x1f')](_0x4667cb);queues['agentconnect'](_0x4667cb);}catch(_0x594483){utils[_0x24ad('0x14')](util[_0x24ad('0x17')](_0x24ad('0x20'),_0x4667cb[_0x24ad('0x1b')]),_0x594483);}});ami['on'](_0x24ad('0x21'),function(_0x24fbba){try{utils[_0x24ad('0x16')](util['format']('[%s][index][agentcomplete]',_0x24fbba[_0x24ad('0x1b')]),_0x24fbba);agents[_0x24ad('0x21')](_0x24fbba);queues[_0x24ad('0x21')](_0x24fbba);members['agentcomplete'](_0x24fbba);}catch(_0x3a19fe){utils[_0x24ad('0x14')](util['format'](_0x24ad('0x22'),_0x24fbba[_0x24ad('0x1b')]),_0x3a19fe);}});ami['on'](_0x24ad('0x23'),function(_0x29b29e){try{utils[_0x24ad('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x29b29e[_0x24ad('0x1b')]),_0x29b29e);agents['queuecallerabandon'](_0x29b29e);queues['queuecallerabandon'](_0x29b29e);}catch(_0x11a000){utils[_0x24ad('0x14')](util[_0x24ad('0x17')]('[%s][index][queuecallerabandon]',_0x29b29e[_0x24ad('0x1b')]),_0x11a000);}});ami['on']('queuecallerjoin',function(_0x4076fc){try{utils['debug'](util[_0x24ad('0x17')](_0x24ad('0x24'),_0x4076fc[_0x24ad('0x1b')]),_0x4076fc);queues[_0x24ad('0x25')](_0x4076fc);recordings[_0x24ad('0x25')](_0x4076fc);}catch(_0x483082){utils[_0x24ad('0x14')](util[_0x24ad('0x17')](_0x24ad('0x24'),_0x4076fc[_0x24ad('0x1b')]),_0x483082);}});ami['on'](_0x24ad('0x26'),function(_0x556c24){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')](_0x24ad('0x27'),_0x556c24[_0x24ad('0x1b')]),_0x556c24);queues[_0x24ad('0x26')](_0x556c24);}catch(_0x43039d){utils[_0x24ad('0x14')](util[_0x24ad('0x17')](_0x24ad('0x27'),_0x556c24['uniqueid']),_0x43039d);}});ami['on'](_0x24ad('0x28'),function(_0x426486){try{utils['debug'](util[_0x24ad('0x17')]('[%s][index][musiconholdstart]',_0x426486[_0x24ad('0x1b')]),_0x426486);queues[_0x24ad('0x28')](_0x426486);calls[_0x24ad('0x28')](_0x426486);}catch(_0x3a9061){utils['error'](util[_0x24ad('0x17')]('[%s][index][musiconholdstart]',_0x426486['uniqueid']),_0x3a9061);}});ami['on']('musiconholdstop',function(_0x39a1ba){try{utils['debug'](util[_0x24ad('0x17')](_0x24ad('0x29'),_0x39a1ba['uniqueid']),_0x39a1ba);queues[_0x24ad('0x2a')](_0x39a1ba);calls[_0x24ad('0x2a')](_0x39a1ba);}catch(_0x4a2d0c){utils[_0x24ad('0x14')](util[_0x24ad('0x17')](_0x24ad('0x29'),_0x39a1ba[_0x24ad('0x1b')]),_0x4a2d0c);}});ami['on'](_0x24ad('0x2b'),function(_0x228dba){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')](_0x24ad('0x2c'),_0x228dba['uniqueid']),_0x228dba);calls[_0x24ad('0x2b')](_0x228dba);recordings[_0x24ad('0x2b')](_0x228dba);}catch(_0x587eb3){utils[_0x24ad('0x14')](util[_0x24ad('0x17')](_0x24ad('0x2c'),_0x228dba['uniqueid']),_0x587eb3);}});ami['on'](_0x24ad('0x2d'),function(_0x10ad7a){try{utils[_0x24ad('0x16')](util['format'](_0x24ad('0x2e'),_0x10ad7a[_0x24ad('0x1b')]),_0x10ad7a);calls[_0x24ad('0x2d')](_0x10ad7a);recordings[_0x24ad('0x2d')](_0x10ad7a);dials[_0x24ad('0x2d')](_0x10ad7a);agents['hangup'](_0x10ad7a);queues[_0x24ad('0x2d')](_0x10ad7a);}catch(_0x303fb9){utils['error'](util['format'](_0x24ad('0x2e'),_0x10ad7a['uniqueid']),_0x303fb9);}});ami['on'](_0x24ad('0x2f'),function(_0x38dddc){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')](_0x24ad('0x30'),_0x38dddc[_0x24ad('0x1b')]),_0x38dddc);members[_0x24ad('0x2f')](_0x38dddc);}catch(_0x5bca8){utils[_0x24ad('0x14')](util[_0x24ad('0x17')](_0x24ad('0x30'),_0x38dddc[_0x24ad('0x1b')]),_0x5bca8);}});ami['on'](_0x24ad('0x31'),function(_0x4fe3b9){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')]('[%s][index][blindtransfer]',_0x4fe3b9[_0x24ad('0x1b')]),_0x4fe3b9);queues[_0x24ad('0x31')](_0x4fe3b9);agents[_0x24ad('0x31')](_0x4fe3b9);transfers[_0x24ad('0x31')](_0x4fe3b9);}catch(_0x5fa49){utils['error'](util[_0x24ad('0x17')]('[%s][index][blindtransfer]',_0x4fe3b9[_0x24ad('0x1b')]),_0x5fa49);}});ami['on'](_0x24ad('0x32'),function(_0x2eb1a8){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')](_0x24ad('0x33'),_0x2eb1a8[_0x24ad('0x34')]),_0x2eb1a8);queues[_0x24ad('0x32')](_0x2eb1a8);transfers[_0x24ad('0x32')](_0x2eb1a8);agents[_0x24ad('0x32')](_0x2eb1a8);calls['attendedtransfer'](_0x2eb1a8);}catch(_0x1adeeb){utils['error'](util[_0x24ad('0x17')](_0x24ad('0x33'),_0x2eb1a8[_0x24ad('0x34')]),_0x1adeeb);}});ami['on'](_0x24ad('0x35'),function(_0xbd4f33){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')]('[%s][index][varset]',_0xbd4f33[_0x24ad('0x1b')]),_0xbd4f33);queues[_0x24ad('0x35')](_0xbd4f33);recordings[_0x24ad('0x35')](_0xbd4f33);calls[_0x24ad('0x35')](_0xbd4f33);dials[_0x24ad('0x35')](_0xbd4f33);}catch(_0x151380){utils[_0x24ad('0x14')](util['format'](_0x24ad('0x36'),_0xbd4f33[_0x24ad('0x1b')]),_0x151380);}});ami['on'](_0x24ad('0x37'),function(_0x4769e1){try{utils['debug'](util['format']('[%s][index][newexten]',_0x4769e1[_0x24ad('0x1b')]),_0x4769e1);calls['newexten'](_0x4769e1);recordings[_0x24ad('0x37')](_0x4769e1);dials[_0x24ad('0x37')](_0x4769e1);}catch(_0x52952e){utils[_0x24ad('0x14')](util[_0x24ad('0x17')]('[%s][index][newexten]',_0x4769e1[_0x24ad('0x1b')]),_0x52952e);}});ami['on'](_0x24ad('0x38'),function(_0x392757){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')](_0x24ad('0x39'),_0x392757[_0x24ad('0x1b')]),_0x392757);calls['newchannel'](_0x392757);recordings[_0x24ad('0x38')](_0x392757);}catch(_0x1fbc88){utils[_0x24ad('0x14')](util[_0x24ad('0x17')]('[%s][index][newchannel]',_0x392757[_0x24ad('0x1b')]),_0x1fbc88);}});ami['on'](_0x24ad('0x3a'),function(_0x27425e){try{utils[_0x24ad('0x16')](util[_0x24ad('0x17')](_0x24ad('0x3b'),_0x27425e['uniqueid']),_0x27425e);dials[_0x24ad('0x3a')](_0x27425e);}catch(_0x3b61d3){utils[_0x24ad('0x14')](util[_0x24ad('0x17')](_0x24ad('0x3c'),_0x27425e[_0x24ad('0x1b')]),_0x3b61d3);}});ami['on'](_0x24ad('0x3d'),function(_0x1eaa5b){try{utils['debug'](util[_0x24ad('0x17')]('[%s][index][dialend]',_0x1eaa5b[_0x24ad('0x1b')]),_0x1eaa5b);dials['dialend'](_0x1eaa5b);}catch(_0x1afd97){utils[_0x24ad('0x14')](util[_0x24ad('0x17')](_0x24ad('0x3e'),_0x1eaa5b[_0x24ad('0x1b')]),_0x1afd97);}});} \ No newline at end of file +var _0xc4a2=['[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','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]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave'];(function(_0x246a25,_0x2c0c46){var _0x5996f4=function(_0x5ae4bb){while(--_0x5ae4bb){_0x246a25['push'](_0x246a25['shift']());}};_0x5996f4(++_0x2c0c46);}(_0xc4a2,0x131));var _0x2c4a=function(_0x1bad96,_0xde51a2){_0x1bad96=_0x1bad96-0x0;var _0x3f3c57=_0xc4a2[_0x1bad96];return _0x3f3c57;};var AsteriskManager=require(_0x2c4a('0x0'));var config=require(_0x2c4a('0x1'));var utils=require(_0x2c4a('0x2'));var util=require(_0x2c4a('0x3'));var isXDREnabled=config[_0x2c4a('0x4')]&&config['xdr'][_0x2c4a('0x5')]?!config[_0x2c4a('0x4')][_0x2c4a('0x5')]:!![];var isProduction=config[_0x2c4a('0x6')]==='production'||![];var isLocalAsterisk=config[_0x2c4a('0x4')]&&config[_0x2c4a('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x2c4a('0x7')]['port'],config[_0x2c4a('0x7')]['ip'],config[_0x2c4a('0x7')][_0x2c4a('0x8')],config[_0x2c4a('0x7')][_0x2c4a('0x9')],!![]);ami[_0x2c4a('0xa')]();if(!isXDREnabled){utils[_0x2c4a('0xb')](_0x2c4a('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x2c4a('0xb')](_0x2c4a('0xd'));}else{var agents=require(_0x2c4a('0xe'));var calls=require(_0x2c4a('0xf'));var queues=require(_0x2c4a('0x10'));var recordings=require(_0x2c4a('0x11'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x2c4a('0x12'));var core=require(_0x2c4a('0x13'));ami['on'](_0x2c4a('0x14'),core[_0x2c4a('0x14')]);ami['on'](_0x2c4a('0x15'),core['shutdown']);ami['on'](_0x2c4a('0x16'),core['fullybooted']);ami['on']('error',core[_0x2c4a('0x17')]);ami['on']('close',core[_0x2c4a('0x18')]);ami['on'](_0x2c4a('0x19'),core[_0x2c4a('0x19')]);ami['on'](_0x2c4a('0x1a'),function(_0x2f25e1){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')](_0x2c4a('0x1d'),_0x2f25e1[_0x2c4a('0x1e')]),_0x2f25e1);members['devicestatechange'](_0x2f25e1);}catch(_0x29c9d9){utils['error'](util[_0x2c4a('0x1c')]('[%s][index][devicestatechange]',_0x2f25e1['device']),_0x29c9d9);}});ami['on'](_0x2c4a('0x1f'),function(_0xd3ce09){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')](_0x2c4a('0x20'),_0xd3ce09[_0x2c4a('0x21')]),_0xd3ce09);agents[_0x2c4a('0x1f')](_0xd3ce09);}catch(_0x19be46){utils[_0x2c4a('0x17')](util['format'](_0x2c4a('0x20'),_0xd3ce09[_0x2c4a('0x21')]),_0x19be46);}});ami['on'](_0x2c4a('0x22'),function(_0x292bdf){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')]('[%s][index][agentringnoanswer]',_0x292bdf[_0x2c4a('0x21')]),_0x292bdf);agents[_0x2c4a('0x22')](_0x292bdf);}catch(_0xf2d61c){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x23'),_0x292bdf[_0x2c4a('0x21')]),_0xf2d61c);}});ami['on'](_0x2c4a('0x24'),function(_0x3efd){try{utils[_0x2c4a('0x1b')](util['format'](_0x2c4a('0x25'),_0x3efd['uniqueid']),_0x3efd);agents[_0x2c4a('0x24')](_0x3efd);queues[_0x2c4a('0x24')](_0x3efd);}catch(_0x5825f2){utils[_0x2c4a('0x17')](util['format']('[%s][index][agentconnect]',_0x3efd[_0x2c4a('0x21')]),_0x5825f2);}});ami['on'](_0x2c4a('0x26'),function(_0x3b1051){try{utils['debug'](util[_0x2c4a('0x1c')](_0x2c4a('0x27'),_0x3b1051['uniqueid']),_0x3b1051);agents['agentcomplete'](_0x3b1051);queues[_0x2c4a('0x26')](_0x3b1051);members[_0x2c4a('0x26')](_0x3b1051);}catch(_0x26a710){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x27'),_0x3b1051[_0x2c4a('0x21')]),_0x26a710);}});ami['on'](_0x2c4a('0x28'),function(_0xce55e2){try{utils['debug'](util[_0x2c4a('0x1c')](_0x2c4a('0x29'),_0xce55e2[_0x2c4a('0x21')]),_0xce55e2);agents[_0x2c4a('0x28')](_0xce55e2);queues[_0x2c4a('0x28')](_0xce55e2);}catch(_0x4d371b){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x29'),_0xce55e2[_0x2c4a('0x21')]),_0x4d371b);}});ami['on']('queuecallerjoin',function(_0x1ea400){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')](_0x2c4a('0x2a'),_0x1ea400[_0x2c4a('0x21')]),_0x1ea400);queues[_0x2c4a('0x2b')](_0x1ea400);recordings[_0x2c4a('0x2b')](_0x1ea400);}catch(_0x2ae969){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x2a'),_0x1ea400[_0x2c4a('0x21')]),_0x2ae969);}});ami['on'](_0x2c4a('0x2c'),function(_0x24c130){try{utils['debug'](util[_0x2c4a('0x1c')](_0x2c4a('0x2d'),_0x24c130[_0x2c4a('0x21')]),_0x24c130);queues[_0x2c4a('0x2c')](_0x24c130);}catch(_0x110397){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x2d'),_0x24c130['uniqueid']),_0x110397);}});ami['on'](_0x2c4a('0x2e'),function(_0x1aa692){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')](_0x2c4a('0x2f'),_0x1aa692[_0x2c4a('0x21')]),_0x1aa692);queues['musiconholdstart'](_0x1aa692);calls[_0x2c4a('0x2e')](_0x1aa692);}catch(_0x3f901d){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x2f'),_0x1aa692[_0x2c4a('0x21')]),_0x3f901d);}});ami['on'](_0x2c4a('0x30'),function(_0x3ebfe7){try{utils[_0x2c4a('0x1b')](util['format'](_0x2c4a('0x31'),_0x3ebfe7[_0x2c4a('0x21')]),_0x3ebfe7);queues[_0x2c4a('0x30')](_0x3ebfe7);calls[_0x2c4a('0x30')](_0x3ebfe7);}catch(_0x39f201){utils[_0x2c4a('0x17')](util['format'](_0x2c4a('0x31'),_0x3ebfe7[_0x2c4a('0x21')]),_0x39f201);}});ami['on'](_0x2c4a('0x32'),function(_0x2abe63){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')]('[%s][index][newstate]',_0x2abe63['uniqueid']),_0x2abe63);calls[_0x2c4a('0x32')](_0x2abe63);recordings['newstate'](_0x2abe63);}catch(_0x8e73ac){utils[_0x2c4a('0x17')](util['format'](_0x2c4a('0x33'),_0x2abe63['uniqueid']),_0x8e73ac);}});ami['on']('hangup',function(_0xc30820){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')]('[%s][index][hangup]',_0xc30820[_0x2c4a('0x21')]),_0xc30820);calls[_0x2c4a('0x34')](_0xc30820);recordings['hangup'](_0xc30820);dials['hangup'](_0xc30820);agents['hangup'](_0xc30820);queues['hangup'](_0xc30820);}catch(_0x36ecac){utils[_0x2c4a('0x17')](util['format']('[%s][index][hangup]',_0xc30820[_0x2c4a('0x21')]),_0x36ecac);}});ami['on']('cdr',function(_0x5a88f1){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')](_0x2c4a('0x35'),_0x5a88f1[_0x2c4a('0x21')]),_0x5a88f1);members[_0x2c4a('0x36')](_0x5a88f1);}catch(_0x141253){utils['error'](util['format'](_0x2c4a('0x35'),_0x5a88f1['uniqueid']),_0x141253);}});ami['on'](_0x2c4a('0x37'),function(_0x12cd38){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')](_0x2c4a('0x38'),_0x12cd38['uniqueid']),_0x12cd38);queues[_0x2c4a('0x37')](_0x12cd38);agents[_0x2c4a('0x37')](_0x12cd38);transfers[_0x2c4a('0x37')](_0x12cd38);}catch(_0x25bb91){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')]('[%s][index][blindtransfer]',_0x12cd38['uniqueid']),_0x25bb91);}});ami['on']('attendedtransfer',function(_0x18c152){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')](_0x2c4a('0x39'),_0x18c152['origtransfereruniqueid']),_0x18c152);queues[_0x2c4a('0x3a')](_0x18c152);transfers[_0x2c4a('0x3a')](_0x18c152);agents['attendedtransfer'](_0x18c152);calls[_0x2c4a('0x3a')](_0x18c152);}catch(_0x3c5d99){utils[_0x2c4a('0x17')](util['format'](_0x2c4a('0x39'),_0x18c152[_0x2c4a('0x3b')]),_0x3c5d99);}});ami['on']('varset',function(_0x12e3c3){try{utils[_0x2c4a('0x1b')](util[_0x2c4a('0x1c')]('[%s][index][varset]',_0x12e3c3[_0x2c4a('0x21')]),_0x12e3c3);queues['varset'](_0x12e3c3);recordings[_0x2c4a('0x3c')](_0x12e3c3);calls[_0x2c4a('0x3c')](_0x12e3c3);dials[_0x2c4a('0x3c')](_0x12e3c3);}catch(_0x2d04ca){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')]('[%s][index][varset]',_0x12e3c3[_0x2c4a('0x21')]),_0x2d04ca);}});ami['on']('newexten',function(_0x5580cd){try{utils[_0x2c4a('0x1b')](util['format']('[%s][index][newexten]',_0x5580cd[_0x2c4a('0x21')]),_0x5580cd);calls[_0x2c4a('0x3d')](_0x5580cd);recordings[_0x2c4a('0x3d')](_0x5580cd);dials[_0x2c4a('0x3d')](_0x5580cd);}catch(_0x5d78fb){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x3e'),_0x5580cd[_0x2c4a('0x21')]),_0x5d78fb);}});ami['on']('newchannel',function(_0x340294){try{utils[_0x2c4a('0x1b')](util['format']('[%s][index][newchannel]',_0x340294[_0x2c4a('0x21')]),_0x340294);calls['newchannel'](_0x340294);recordings[_0x2c4a('0x3f')](_0x340294);}catch(_0x4cdec0){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x40'),_0x340294[_0x2c4a('0x21')]),_0x4cdec0);}});ami['on'](_0x2c4a('0x41'),function(_0x22f2ad){try{utils['debug'](util[_0x2c4a('0x1c')](_0x2c4a('0x42'),_0x22f2ad['uniqueid']),_0x22f2ad);dials[_0x2c4a('0x41')](_0x22f2ad);}catch(_0x2176eb){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x43'),_0x22f2ad[_0x2c4a('0x21')]),_0x2176eb);}});ami['on'](_0x2c4a('0x44'),function(_0x1e9380){try{utils['debug'](util[_0x2c4a('0x1c')](_0x2c4a('0x45'),_0x1e9380[_0x2c4a('0x21')]),_0x1e9380);dials[_0x2c4a('0x44')](_0x1e9380);}catch(_0x323a54){utils[_0x2c4a('0x17')](util[_0x2c4a('0x1c')](_0x2c4a('0x45'),_0x1e9380[_0x2c4a('0x21')]),_0x323a54);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index d9bc5fb..7211bec 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 _0x51d7=['destinationchannel','lodash','util','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','internal','request','CreateMemberReport','getUserByName','then','catch','error','format','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','enterAt','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','split','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s'];(function(_0x9c5350,_0x3dddec){var _0x4c2e85=function(_0x530218){while(--_0x530218){_0x9c5350['push'](_0x9c5350['shift']());}};_0x4c2e85(++_0x3dddec);}(_0x51d7,0x1e1));var _0x751d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x51d7[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x751d('0x0'));var util=require(_0x751d('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x751d('0x2')];function writeDB(_0x393fba){utils[_0x751d('0x3')](util['format'](_0x751d('0x4'),_0x393fba['uniqueid'],_0x393fba[_0x751d('0x5')],_0x393fba[_0x751d('0x6')],_0x393fba[_0x751d('0x7')],_0x393fba[_0x751d('0x8')],_0x393fba[_0x751d('0x9')]));if(_0x393fba['interface']){utils['getUserByInterface'](_0x393fba[_0x751d('0x5')])['then'](function(_0x12f3a1){if(_0x12f3a1){_0x393fba[_0x751d('0x8')]=_0x12f3a1['name'];_0x393fba['internal']=_0x12f3a1[_0x751d('0xa')];utils[_0x751d('0xb')](_0x751d('0xc'),_0x393fba);}else{utils[_0x751d('0xd')](_0x393fba[_0x751d('0x5')]['split']('/')[0x1])[_0x751d('0xe')](function(_0x5014e1){if(_0x5014e1){_0x393fba['membername']=_0x5014e1['name'];_0x393fba['internal']=_0x5014e1[_0x751d('0xa')];utils[_0x751d('0xb')](_0x751d('0xc'),_0x393fba);}});}})[_0x751d('0xf')](function(_0x2da900){utils[_0x751d('0x10')](util[_0x751d('0x11')](_0x751d('0x12'),_0x393fba[_0x751d('0x13')]),_0x2da900);});}delete members[_0x393fba['interface']];}function startsWith(_0xa55159,_0x3046e9){return _[_0x751d('0x14')](_0xa55159,function(_0x51b90d){return _[_0x751d('0x15')](_0x3046e9,_0x51b90d);});}exports[_0x751d('0x16')]=function(_0x3bfa82){try{utils[_0x751d('0x17')](util[_0x751d('0x11')]('[%s][members][devicestatechange]',members[_0x3bfa82[_0x751d('0x18')]]?members[_0x3bfa82[_0x751d('0x18')]][_0x751d('0x13')]:_0x3bfa82[_0x751d('0x18')]),_0x3bfa82);utils[_0x751d('0x3')](util['format'](_0x751d('0x19'),members[_0x3bfa82['device']]?members[_0x3bfa82[_0x751d('0x18')]][_0x751d('0x13')]:_0x3bfa82[_0x751d('0x18')],_0x3bfa82['state'],_0x3bfa82[_0x751d('0x18')]));switch(_0x3bfa82['state']){case _0x751d('0x1a'):case _0x751d('0x1b'):if(!startsWith(exclude,_0x3bfa82['device'])){members[_0x3bfa82['device']]={'channel':_0x751d('0x1c'),'interface':_0x3bfa82[_0x751d('0x18')],'type':_0x751d('0x1d'),'enterAt':utils[_0x751d('0x1e')](),'role':_0x751d('0x1f')};}break;case _0x751d('0x20'):if(!_['isNil'](members[_0x3bfa82[_0x751d('0x18')]])){members[_0x3bfa82[_0x751d('0x18')]][_0x751d('0x21')]=utils['now']();members[_0x3bfa82[_0x751d('0x18')]]['duration']=utils['diffTime'](members[_0x3bfa82[_0x751d('0x18')]][_0x751d('0x21')],members[_0x3bfa82[_0x751d('0x18')]][_0x751d('0x22')]);if(members[_0x3bfa82[_0x751d('0x18')]][_0x751d('0x13')]){writeDB(members[_0x3bfa82[_0x751d('0x18')]]);}}break;default:break;}}catch(_0x596351){utils['error'](util[_0x751d('0x11')]('[%s][members][devicestatechange]',members[_0x3bfa82['device']]?members[_0x3bfa82[_0x751d('0x18')]][_0x751d('0x13')]:_0x3bfa82['device']),_0x596351);}};exports['agentcomplete']=function(_0x3d7d7a){try{if(!_[_0x751d('0x23')](members[_0x3d7d7a[_0x751d('0x5')]])){utils['debug'](util['format'](_0x751d('0x24'),_0x3d7d7a[_0x751d('0x13')]),_0x3d7d7a);utils['info'](util[_0x751d('0x11')](_0x751d('0x25'),_0x3d7d7a['uniqueid'],_0x3d7d7a['interface'],_0x3d7d7a[_0x751d('0x26')]));members[_0x3d7d7a['interface']]=_[_0x751d('0x27')](members[_0x3d7d7a['interface']],{'data4':_0x3d7d7a[_0x751d('0x26')],'uniqueid':_0x3d7d7a['uniqueid']});}}catch(_0x2f8765){utils[_0x751d('0x10')](util[_0x751d('0x11')](_0x751d('0x24'),_0x3d7d7a[_0x751d('0x13')]),_0x2f8765);}};exports[_0x751d('0x28')]=function(_0x58620c){try{utils['debug'](util[_0x751d('0x11')](_0x751d('0x29'),_0x58620c['uniqueid']),_0x58620c);if(_0x58620c[_0x751d('0x6')]){var _0x155ef5=_0x58620c[_0x751d('0x6')][_0x751d('0x2a')]('-')[0x0];if(!_[_0x751d('0x23')](members[_0x155ef5])){members[_0x155ef5]=_[_0x751d('0x27')](members[_0x155ef5],{'data1':members[_0x155ef5][_0x751d('0x2b')]||_0x58620c[_0x751d('0x9')],'data2':members[_0x155ef5][_0x751d('0x7')]||_0x58620c[_0x751d('0x2c')],'data3':members[_0x155ef5][_0x751d('0x2d')]||_0x58620c['destination'],'uniqueid':members[_0x155ef5][_0x751d('0x13')]||_0x58620c[_0x751d('0x13')]});utils[_0x751d('0x3')](util[_0x751d('0x11')](_0x751d('0x2e'),_0x58620c[_0x751d('0x13')],members[_0x155ef5][_0x751d('0x2b')],members[_0x155ef5]['data2'],members[_0x155ef5]['data3']));if(members[_0x155ef5][_0x751d('0x21')]){writeDB(members[_0x155ef5]);}}}if(_0x58620c[_0x751d('0x2f')]){var _0x24f98f=_0x58620c[_0x751d('0x2f')][_0x751d('0x2a')]('-')[0x0];if(!_[_0x751d('0x23')](members[_0x24f98f])){members[_0x24f98f]=_[_0x751d('0x27')](members[_0x24f98f],{'data1':members[_0x24f98f]['data1']||_0x58620c[_0x751d('0x9')],'data2':members[_0x24f98f][_0x751d('0x7')]||_0x58620c[_0x751d('0x2c')],'data3':members[_0x24f98f][_0x751d('0x2d')]||_0x58620c['destination'],'uniqueid':members[_0x24f98f][_0x751d('0x13')]||_0x58620c[_0x751d('0x13')]});utils[_0x751d('0x3')](util[_0x751d('0x11')](_0x751d('0x2e'),_0x58620c[_0x751d('0x13')],members[_0x24f98f]['data1'],members[_0x24f98f][_0x751d('0x7')],members[_0x24f98f]['data3']));if(members[_0x24f98f][_0x751d('0x21')]){writeDB(members[_0x24f98f]);}}}}catch(_0x7bf6ab){utils[_0x751d('0x10')](util[_0x751d('0x11')](_0x751d('0x29'),_0x58620c[_0x751d('0x13')]),_0x7bf6ab);}}; \ No newline at end of file +var _0x08ce=['TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','channel','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','membername','type','getUserByInterface','then','internal','getUserByName','split','name','request','CreateMemberReport','catch','error','some','startsWith','debug','device','uniqueid','state','INUSE','BUSY','voice'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x08ce,0x86));var _0xe08c=function(_0x5d434f,_0x596a2b){_0x5d434f=_0x5d434f-0x0;var _0x3aca70=_0x08ce[_0x5d434f];return _0x3aca70;};'use strict';var _=require(_0xe08c('0x0'));var util=require(_0xe08c('0x1'));var utils=require(_0xe08c('0x2'));var members={};var exclude=[_0xe08c('0x3'),_0xe08c('0x4')];function writeDB(_0x3c7094){utils[_0xe08c('0x5')](util[_0xe08c('0x6')](_0xe08c('0x7'),_0x3c7094['uniqueid'],_0x3c7094[_0xe08c('0x8')],_0x3c7094['channel'],_0x3c7094[_0xe08c('0x9')],_0x3c7094[_0xe08c('0xa')],_0x3c7094[_0xe08c('0xb')]));if(_0x3c7094['interface']){utils[_0xe08c('0xc')](_0x3c7094['interface'])[_0xe08c('0xd')](function(_0xd9c10){if(_0xd9c10){_0x3c7094[_0xe08c('0xa')]=_0xd9c10['name'];_0x3c7094[_0xe08c('0xe')]=_0xd9c10[_0xe08c('0xe')];utils['request']('CreateMemberReport',_0x3c7094);}else{utils[_0xe08c('0xf')](_0x3c7094[_0xe08c('0x8')][_0xe08c('0x10')]('/')[0x1])[_0xe08c('0xd')](function(_0x48caa8){if(_0x48caa8){_0x3c7094[_0xe08c('0xa')]=_0x48caa8[_0xe08c('0x11')];_0x3c7094['internal']=_0x48caa8[_0xe08c('0xe')];utils[_0xe08c('0x12')](_0xe08c('0x13'),_0x3c7094);}});}})[_0xe08c('0x14')](function(_0x51320d){utils[_0xe08c('0x15')](util[_0xe08c('0x6')]('[%s][members][writeDB]',_0x3c7094['uniqueid']),_0x51320d);});}delete members[_0x3c7094[_0xe08c('0x8')]];}function startsWith(_0x29505d,_0x4ea935){return _[_0xe08c('0x16')](_0x29505d,function(_0x969580){return _[_0xe08c('0x17')](_0x4ea935,_0x969580);});}exports['devicestatechange']=function(_0x53acec){try{utils[_0xe08c('0x18')](util[_0xe08c('0x6')]('[%s][members][devicestatechange]',members[_0x53acec[_0xe08c('0x19')]]?members[_0x53acec[_0xe08c('0x19')]][_0xe08c('0x1a')]:_0x53acec[_0xe08c('0x19')]),_0x53acec);utils['info'](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x53acec[_0xe08c('0x19')]]?members[_0x53acec[_0xe08c('0x19')]]['uniqueid']:_0x53acec[_0xe08c('0x19')],_0x53acec[_0xe08c('0x1b')],_0x53acec[_0xe08c('0x19')]));switch(_0x53acec['state']){case _0xe08c('0x1c'):case _0xe08c('0x1d'):if(!startsWith(exclude,_0x53acec[_0xe08c('0x19')])){members[_0x53acec['device']]={'channel':_0xe08c('0x1e'),'interface':_0x53acec[_0xe08c('0x19')],'type':_0xe08c('0x1f'),'enterAt':utils['now'](),'role':_0xe08c('0x20')};}break;case _0xe08c('0x21'):if(!_[_0xe08c('0x22')](members[_0x53acec['device']])){members[_0x53acec[_0xe08c('0x19')]][_0xe08c('0x23')]=utils[_0xe08c('0x24')]();members[_0x53acec[_0xe08c('0x19')]][_0xe08c('0x25')]=utils[_0xe08c('0x26')](members[_0x53acec[_0xe08c('0x19')]][_0xe08c('0x23')],members[_0x53acec[_0xe08c('0x19')]][_0xe08c('0x27')]);if(members[_0x53acec[_0xe08c('0x19')]][_0xe08c('0x1a')]){writeDB(members[_0x53acec['device']]);}}break;default:break;}}catch(_0x376a64){utils[_0xe08c('0x15')](util[_0xe08c('0x6')](_0xe08c('0x28'),members[_0x53acec['device']]?members[_0x53acec[_0xe08c('0x19')]]['uniqueid']:_0x53acec[_0xe08c('0x19')]),_0x376a64);}};exports[_0xe08c('0x29')]=function(_0x2e3952){try{if(!_['isNil'](members[_0x2e3952['interface']])){utils['debug'](util[_0xe08c('0x6')]('[%s][members][agentcomplete]',_0x2e3952[_0xe08c('0x1a')]),_0x2e3952);utils[_0xe08c('0x5')](util['format'](_0xe08c('0x2a'),_0x2e3952['uniqueid'],_0x2e3952[_0xe08c('0x8')],_0x2e3952[_0xe08c('0x2b')]));members[_0x2e3952['interface']]=_[_0xe08c('0x2c')](members[_0x2e3952[_0xe08c('0x8')]],{'data4':_0x2e3952[_0xe08c('0x2b')],'uniqueid':_0x2e3952[_0xe08c('0x1a')]});}}catch(_0x3f7917){utils[_0xe08c('0x15')](util[_0xe08c('0x6')](_0xe08c('0x2d'),_0x2e3952[_0xe08c('0x1a')]),_0x3f7917);}};exports[_0xe08c('0x2e')]=function(_0x5894a7){try{utils[_0xe08c('0x18')](util[_0xe08c('0x6')]('[%s][members][cdr]',_0x5894a7[_0xe08c('0x1a')]),_0x5894a7);if(_0x5894a7[_0xe08c('0x2f')]){var _0x2da47e=_0x5894a7[_0xe08c('0x2f')][_0xe08c('0x10')]('-')[0x0];if(!_[_0xe08c('0x22')](members[_0x2da47e])){members[_0x2da47e]=_['assign'](members[_0x2da47e],{'data1':members[_0x2da47e][_0xe08c('0x30')]||_0x5894a7[_0xe08c('0xb')],'data2':members[_0x2da47e][_0xe08c('0x9')]||_0x5894a7[_0xe08c('0x31')],'data3':members[_0x2da47e]['data3']||_0x5894a7[_0xe08c('0x32')],'uniqueid':members[_0x2da47e][_0xe08c('0x1a')]||_0x5894a7[_0xe08c('0x1a')]});utils[_0xe08c('0x5')](util[_0xe08c('0x6')](_0xe08c('0x33'),_0x5894a7['uniqueid'],members[_0x2da47e][_0xe08c('0x30')],members[_0x2da47e][_0xe08c('0x9')],members[_0x2da47e][_0xe08c('0x34')]));if(members[_0x2da47e][_0xe08c('0x23')]){writeDB(members[_0x2da47e]);}}}if(_0x5894a7[_0xe08c('0x35')]){var _0x45d6c9=_0x5894a7[_0xe08c('0x35')][_0xe08c('0x10')]('-')[0x0];if(!_[_0xe08c('0x22')](members[_0x45d6c9])){members[_0x45d6c9]=_['assign'](members[_0x45d6c9],{'data1':members[_0x45d6c9]['data1']||_0x5894a7['type'],'data2':members[_0x45d6c9]['data2']||_0x5894a7['source'],'data3':members[_0x45d6c9][_0xe08c('0x34')]||_0x5894a7[_0xe08c('0x32')],'uniqueid':members[_0x45d6c9][_0xe08c('0x1a')]||_0x5894a7['uniqueid']});utils[_0xe08c('0x5')](util['format'](_0xe08c('0x33'),_0x5894a7[_0xe08c('0x1a')],members[_0x45d6c9][_0xe08c('0x30')],members[_0x45d6c9][_0xe08c('0x9')],members[_0x45d6c9]['data3']));if(members[_0x45d6c9][_0xe08c('0x23')]){writeDB(members[_0x45d6c9]);}}}}catch(_0x28a77a){utils[_0xe08c('0x15')](util['format'](_0xe08c('0x36'),_0x5894a7['uniqueid']),_0x28a77a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6226410..a25ce95 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 _0xeea4=['EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','mohtime','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][varset]','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable'];(function(_0x2187c7,_0x10016e){var _0x5281b8=function(_0x45de3c){while(--_0x45de3c){_0x2187c7['push'](_0x2187c7['shift']());}};_0x5281b8(++_0x10016e);}(_0xeea4,0xa1));var _0x4eea=function(_0x260cf1,_0x4baacd){_0x260cf1=_0x260cf1-0x0;var _0x30ac60=_0xeea4[_0x260cf1];return _0x30ac60;};'use strict';var _=require('lodash');var util=require(_0x4eea('0x0'));var utils=require(_0x4eea('0x1'));var queues={};function writeDB(_0x5bc5f4){utils['info'](util[_0x4eea('0x2')](_0x4eea('0x3'),_0x5bc5f4['uniqueid'],_0x5bc5f4[_0x4eea('0x4')],_0x5bc5f4[_0x4eea('0x5')],_0x5bc5f4[_0x4eea('0x6')],_0x5bc5f4[_0x4eea('0x7')],_0x5bc5f4[_0x4eea('0x8')],_0x5bc5f4['queuecallerexitreason']));if(_0x5bc5f4[_0x4eea('0x5')]){utils[_0x4eea('0x9')](_0x5bc5f4[_0x4eea('0x5')])['then'](function(_0x3eec59){if(_0x3eec59){_0x5bc5f4[_0x4eea('0xa')]=_0x3eec59[_0x4eea('0xa')];}utils[_0x4eea('0xb')](_0x4eea('0xc'),_0x5bc5f4);});}else{utils[_0x4eea('0xb')](_0x4eea('0xc'),_0x5bc5f4);}if(_0x5bc5f4[_0x4eea('0xd')]){delete queues[_0x5bc5f4[_0x4eea('0xd')]];}else{delete queues[_0x5bc5f4[_0x4eea('0xe')]];}}exports[_0x4eea('0xf')]=function(_0x3c3b20){try{utils[_0x4eea('0x10')](util[_0x4eea('0x2')](_0x4eea('0x11'),_0x3c3b20['uniqueid']),_0x3c3b20);utils[_0x4eea('0x12')](util[_0x4eea('0x2')](_0x4eea('0x13'),_0x3c3b20[_0x4eea('0xe')],_0x3c3b20['queue'],_0x3c3b20['position']));queues[_0x3c3b20[_0x4eea('0xe')]]=_['assign'](_0x3c3b20,{'originalposition':_0x3c3b20[_0x4eea('0x14')],'queuecallerjoinAt':utils[_0x4eea('0x15')](),'mohtime':0x0});}catch(_0x30d83c){utils[_0x4eea('0x16')](util[_0x4eea('0x2')](_0x4eea('0x11'),_0x3c3b20[_0x4eea('0xe')]),_0x30d83c);}};exports[_0x4eea('0x17')]=function(_0x300d1e){try{if(!_[_0x4eea('0x18')](queues[_0x300d1e[_0x4eea('0xe')]])){utils[_0x4eea('0x10')](util[_0x4eea('0x2')](_0x4eea('0x19'),_0x300d1e[_0x4eea('0xe')]),_0x300d1e);if(queues[_0x300d1e[_0x4eea('0xe')]][_0x4eea('0x1a')]){if(!queues[_0x300d1e[_0x4eea('0xe')]]['queuecallerabandon']&&!queues[_0x300d1e[_0x4eea('0xe')]][_0x4eea('0x1b')]){queues[_0x300d1e[_0x4eea('0xe')]][_0x4eea('0x1c')]=!![];queues[_0x300d1e[_0x4eea('0xe')]][_0x4eea('0x1d')]=utils[_0x4eea('0x15')]();queues[_0x300d1e[_0x4eea('0xe')]][_0x4eea('0x1e')]=_0x4eea('0x1f');}utils[_0x4eea('0x12')](util[_0x4eea('0x2')](_0x4eea('0x20'),_0x300d1e['uniqueid'],queues[_0x300d1e['uniqueid']]['name'],queues[_0x300d1e[_0x4eea('0xe')]][_0x4eea('0x1e')]));writeDB(queues[_0x300d1e['uniqueid']]);}else if(queues[_0x300d1e[_0x4eea('0xe')]]['transfereduniqueid']){utils['info'](util[_0x4eea('0x2')](_0x4eea('0x21'),_0x300d1e['uniqueid'],queues[_0x300d1e[_0x4eea('0xe')]][_0x4eea('0x22')],queues[_0x300d1e[_0x4eea('0xe')]]['transfereduniqueid']));queues[queues[_0x300d1e['uniqueid']]['transfereduniqueid']]=queues[_0x300d1e['uniqueid']];queues[queues[_0x300d1e[_0x4eea('0xe')]]['transfereduniqueid']][_0x4eea('0x23')]=0x2;delete queues[_0x300d1e[_0x4eea('0xe')]];}}}catch(_0x4d8697){utils[_0x4eea('0x16')](util[_0x4eea('0x2')]('[%s][queues][hangup]',_0x300d1e['uniqueid']),_0x4d8697);}};exports['varset']=function(_0x37c363){try{utils[_0x4eea('0x10')](util[_0x4eea('0x2')](_0x4eea('0x24'),_0x37c363[_0x4eea('0xe')]),_0x37c363);if(!_[_0x4eea('0x18')](_0x37c363['variable'][_0x4eea('0x25')])&&_0x37c363[_0x4eea('0x26')][_0x4eea('0x27')]()!=='CONTINUE'){if(!_[_0x4eea('0x18')](queues[_0x37c363[_0x4eea('0xe')]])){queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x28')]=![];queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x29')]=null;queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x1b')]=!![];queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x2a')]=utils['now']();queues[_0x37c363['uniqueid']][_0x4eea('0x1e')]=_0x37c363[_0x4eea('0x26')][_0x4eea('0x27')]();utils['info'](util[_0x4eea('0x2')](_0x4eea('0x2b'),_0x37c363[_0x4eea('0xe')],queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x22')],_0x37c363['value'],queues[_0x37c363[_0x4eea('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x37c363[_0x4eea('0xe')]]);}}else if(!_[_0x4eea('0x18')](_0x37c363[_0x4eea('0x2c')]['queueposition'])){if(!_[_0x4eea('0x18')](queues[_0x37c363[_0x4eea('0xe')]])&&!queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x28')]){queues[_0x37c363['uniqueid']][_0x4eea('0x28')]=![];queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x29')]=null;queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x1b')]=!![];queues[_0x37c363[_0x4eea('0xe')]]['queuecallerexitAt']=utils['now']();queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x1e')]=_0x4eea('0x2d');utils[_0x4eea('0x12')](util[_0x4eea('0x2')](_0x4eea('0x2e'),_0x37c363[_0x4eea('0xe')],queues[_0x37c363[_0x4eea('0xe')]]['name'],_0x37c363[_0x4eea('0x26')],queues[_0x37c363[_0x4eea('0xe')]][_0x4eea('0x1e')]));}}}catch(_0x3bc360){utils[_0x4eea('0x16')](util['format'](_0x4eea('0x24'),_0x37c363[_0x4eea('0xe')]),_0x3bc360);}};exports[_0x4eea('0x28')]=function(_0x1856f4){try{if(!_['isNil'](queues[_0x1856f4['uniqueid']])){utils[_0x4eea('0x10')](util[_0x4eea('0x2')](_0x4eea('0x2f'),_0x1856f4[_0x4eea('0xe')]),_0x1856f4);queues[_0x1856f4[_0x4eea('0xe')]][_0x4eea('0x1b')]=![];queues[_0x1856f4[_0x4eea('0xe')]][_0x4eea('0x2a')]=null;queues[_0x1856f4[_0x4eea('0xe')]][_0x4eea('0x28')]=!![];queues[_0x1856f4['uniqueid']][_0x4eea('0x29')]=utils[_0x4eea('0x15')]();queues[_0x1856f4[_0x4eea('0xe')]][_0x4eea('0x1e')]=_0x4eea('0x30');utils['info'](util['format'](_0x4eea('0x31'),_0x1856f4['uniqueid'],queues[_0x1856f4[_0x4eea('0xe')]][_0x4eea('0x22')],queues[_0x1856f4['uniqueid']]['queuecallerexitreason']));}}catch(_0x14799f){utils[_0x4eea('0x16')](util[_0x4eea('0x2')](_0x4eea('0x2f'),_0x1856f4[_0x4eea('0xe')]),_0x14799f);}};exports['queuecallerleave']=function(_0x246083){try{if(!_['isNil'](queues[_0x246083[_0x4eea('0xe')]])){utils['debug'](util[_0x4eea('0x2')](_0x4eea('0x32'),_0x246083[_0x4eea('0xe')]),_0x246083);utils['info'](util[_0x4eea('0x2')](_0x4eea('0x33'),_0x246083[_0x4eea('0xe')],queues[_0x246083['uniqueid']]['name'],_0x246083[_0x4eea('0x34')],_0x246083[_0x4eea('0x35')]));queues[_0x246083[_0x4eea('0xe')]][_0x4eea('0x36')]=!![];queues[_0x246083[_0x4eea('0xe')]]['queuecallerleaveAt']=utils[_0x4eea('0x15')]();queues[_0x246083[_0x4eea('0xe')]][_0x4eea('0x37')]=utils[_0x4eea('0x38')](queues[_0x246083[_0x4eea('0xe')]][_0x4eea('0x1a')],queues[_0x246083[_0x4eea('0xe')]][_0x4eea('0x39')]);queues[_0x246083[_0x4eea('0xe')]][_0x4eea('0x14')]=_0x246083['position'];queues[_0x246083['uniqueid']][_0x4eea('0x3a')]=_0x246083[_0x4eea('0x3a')];queues[_0x246083[_0x4eea('0xe')]][_0x4eea('0x34')]=_0x246083[_0x4eea('0x34')];queues[_0x246083['uniqueid']][_0x4eea('0x35')]=_0x246083[_0x4eea('0x35')];}}catch(_0x1b7df0){utils[_0x4eea('0x16')](util[_0x4eea('0x2')](_0x4eea('0x32'),_0x246083['uniqueid']),_0x1b7df0);}};exports['agentconnect']=function(_0x28a8c6){try{if(!_[_0x4eea('0x18')](queues[_0x28a8c6[_0x4eea('0xe')]])){utils['debug'](util[_0x4eea('0x2')](_0x4eea('0x3b'),_0x28a8c6[_0x4eea('0xe')]),_0x28a8c6);utils[_0x4eea('0x12')](util[_0x4eea('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x28a8c6[_0x4eea('0xe')],queues[_0x28a8c6[_0x4eea('0xe')]][_0x4eea('0x22')],_0x28a8c6[_0x4eea('0x3c')],_0x28a8c6[_0x4eea('0x3d')]));queues[_0x28a8c6[_0x4eea('0xe')]][_0x4eea('0x28')]=![];queues[_0x28a8c6['uniqueid']][_0x4eea('0x28')]=![];queues[_0x28a8c6[_0x4eea('0xe')]][_0x4eea('0x29')]=null;queues[_0x28a8c6['uniqueid']][_0x4eea('0x1b')]=![];queues[_0x28a8c6[_0x4eea('0xe')]]['queuecallerexitreason']=null;queues[_0x28a8c6['uniqueid']]['queuecallerexitAt']=null;queues[_0x28a8c6[_0x4eea('0xe')]][_0x4eea('0x3e')]=!![];queues[_0x28a8c6[_0x4eea('0xe')]][_0x4eea('0x8')]=_0x28a8c6[_0x4eea('0x3d')];queues[_0x28a8c6[_0x4eea('0xe')]]['lastAssignedTo']=_0x28a8c6[_0x4eea('0x3c')];}}catch(_0x2fd1e7){utils[_0x4eea('0x16')](util[_0x4eea('0x2')](_0x4eea('0x3b'),_0x28a8c6[_0x4eea('0xe')]),_0x2fd1e7);}};exports[_0x4eea('0x3f')]=function(_0x5737e0){try{if(!_[_0x4eea('0x18')](queues[_0x5737e0[_0x4eea('0xe')]])){if(queues[_0x5737e0['uniqueid']][_0x4eea('0x1a')]){utils[_0x4eea('0x10')](util[_0x4eea('0x2')](_0x4eea('0x40'),_0x5737e0['uniqueid']),_0x5737e0);queues[_0x5737e0['uniqueid']]['queuecallerabandon']=![];queues[_0x5737e0[_0x4eea('0xe')]][_0x4eea('0x28')]=![];queues[_0x5737e0[_0x4eea('0xe')]][_0x4eea('0x29')]=null;queues[_0x5737e0[_0x4eea('0xe')]]['queuecallerexit']=![];queues[_0x5737e0[_0x4eea('0xe')]][_0x4eea('0x2a')]=null;queues[_0x5737e0[_0x4eea('0xe')]]['assigned']=!![];queues[_0x5737e0[_0x4eea('0xe')]][_0x4eea('0x6')]=_0x5737e0[_0x4eea('0x3c')];queues[_0x5737e0[_0x4eea('0xe')]][_0x4eea('0x1c')]=!![];queues[_0x5737e0['uniqueid']][_0x4eea('0x1d')]=utils['now']();if(_0x5737e0['reason']==_0x4eea('0x41')){if(!queues[_0x5737e0[_0x4eea('0xe')]][_0x4eea('0x41')]){queues[_0x5737e0[_0x4eea('0xe')]][_0x4eea('0x1e')]=_0x4eea('0x42');}}else{queues[_0x5737e0[_0x4eea('0xe')]][_0x4eea('0x1e')]='COMPLETEDBY'+_0x5737e0[_0x4eea('0x43')][_0x4eea('0x27')]();}utils['info'](util[_0x4eea('0x2')](_0x4eea('0x44'),_0x5737e0['uniqueid'],queues[_0x5737e0[_0x4eea('0xe')]]['name'],_0x5737e0[_0x4eea('0x3c')],queues[_0x5737e0['uniqueid']][_0x4eea('0x1e')]));writeDB(queues[_0x5737e0['uniqueid']]);}}}catch(_0x2f0c93){utils[_0x4eea('0x16')](util[_0x4eea('0x2')](_0x4eea('0x40'),_0x5737e0[_0x4eea('0xe')]),_0x2f0c93);}};exports[_0x4eea('0x45')]=function(_0x20fb13){try{if(!_[_0x4eea('0x18')](queues[_0x20fb13[_0x4eea('0x46')]])){utils[_0x4eea('0x10')](util['format']('[%s][queues][blindtransfer]',_0x20fb13[_0x4eea('0xe')]),_0x20fb13);queues[_0x20fb13[_0x4eea('0x46')]][_0x4eea('0x41')]=!![];queues[_0x20fb13['transfereeuniqueid']]['transfertype']='BLIND';queues[_0x20fb13['transfereeuniqueid']][_0x4eea('0x47')]=_0x20fb13[_0x4eea('0x48')];queues[_0x20fb13['transfereeuniqueid']][_0x4eea('0x49')]=_0x20fb13[_0x4eea('0x46')];queues[_0x20fb13['transfereeuniqueid']][_0x4eea('0x1e')]=_0x4eea('0x4a');utils[_0x4eea('0x12')](util[_0x4eea('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x20fb13[_0x4eea('0xe')],queues[_0x20fb13[_0x4eea('0x46')]][_0x4eea('0x22')],_0x20fb13[_0x4eea('0x46')],_0x20fb13[_0x4eea('0x48')]));}}catch(_0x3fc7a5){utils['error'](util[_0x4eea('0x2')](_0x4eea('0x4b'),_0x20fb13[_0x4eea('0xe')]),_0x3fc7a5);}};exports[_0x4eea('0x4c')]=function(_0x30292f){try{utils[_0x4eea('0x10')](util[_0x4eea('0x2')]('[%s][queues][attendedtransfer]',_0x30292f[_0x4eea('0x4d')]),_0x30292f);if(_0x30292f['origtransfereruniqueid']==_0x30292f[_0x4eea('0x4e')]){if(!_[_0x4eea('0x18')](queues[_0x30292f['secondtransfererlinkedid']])){utils[_0x4eea('0x12')](util[_0x4eea('0x2')](_0x4eea('0x4f'),_0x30292f[_0x4eea('0x4d')],queues[_0x30292f[_0x4eea('0x50')]]['name'],_0x30292f[_0x4eea('0x51')]));queues[_0x30292f['secondtransfererlinkedid']][_0x4eea('0x41')]=!![];queues[_0x30292f[_0x4eea('0x50')]][_0x4eea('0x52')]=_0x4eea('0x53');queues[_0x30292f[_0x4eea('0x50')]][_0x4eea('0x47')]=_0x30292f[_0x4eea('0x51')];queues[_0x30292f['secondtransfererlinkedid']]['transferuniqueid']=_0x30292f[_0x4eea('0x4d')];queues[_0x30292f['secondtransfererlinkedid']][_0x4eea('0x1e')]=_0x4eea('0x54');}if(!_[_0x4eea('0x18')](queues[_0x30292f[_0x4eea('0x4e')]])){if(_0x30292f[_0x4eea('0x55')]&&queues[_0x30292f['transfereelinkedid']]){queues[_0x30292f[_0x4eea('0x55')]][_0x4eea('0x23')]=0x1;queues[_0x30292f['transfereeuniqueid']]=_[_0x4eea('0x56')](queues[_0x30292f[_0x4eea('0x55')]]);queues[_0x30292f['transfereeuniqueid']][_0x4eea('0xd')]=_0x30292f[_0x4eea('0x57')];queues[_0x30292f[_0x4eea('0x46')]][_0x4eea('0x23')]=0x2;queues[_0x30292f['transfereeuniqueid']][_0x4eea('0x7')]=queues[_0x30292f['secondtransfererlinkedid']][_0x4eea('0x7')];queues[_0x30292f[_0x4eea('0x46')]]['calleridname']=queues[_0x30292f[_0x4eea('0x50')]]['calleridname'];queues[_0x30292f[_0x4eea('0x46')]][_0x4eea('0x39')]=utils[_0x4eea('0x15')]();queues[_0x30292f[_0x4eea('0x46')]][_0x4eea('0x1a')]=utils[_0x4eea('0x15')]();queues[_0x30292f['transfereeuniqueid']]['holdtime']=0x0;queues[_0x30292f['transfereeuniqueid']][_0x4eea('0x58')]=0x0;utils[_0x4eea('0x12')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x30292f[_0x4eea('0x4d')],queues[_0x30292f[_0x4eea('0x46')]]['name'],queues[_0x30292f[_0x4eea('0x46')]]['calleridnum'],queues[_0x30292f[_0x4eea('0x46')]][_0x4eea('0x59')]));}else{utils[_0x4eea('0x12')](util['format'](_0x4eea('0x5a'),_0x30292f['origtransfereruniqueid'],queues[_0x30292f[_0x4eea('0x4e')]][_0x4eea('0x22')],_0x30292f[_0x4eea('0x50')]));queues[_0x30292f[_0x4eea('0x4e')]][_0x4eea('0xd')]=_0x30292f[_0x4eea('0x50')];}}}else if(_0x30292f['secondtransfereruniqueid']==_0x30292f['secondtransfererlinkedid']){if(!_[_0x4eea('0x18')](queues[_0x30292f[_0x4eea('0x4e')]])){utils[_0x4eea('0x12')](util[_0x4eea('0x2')](_0x4eea('0x5b'),_0x30292f[_0x4eea('0x4d')],queues[_0x30292f[_0x4eea('0x4e')]][_0x4eea('0x22')],_0x30292f['secondtransfereruniqueid'],_0x30292f[_0x4eea('0x5c')]));queues[_0x30292f[_0x4eea('0x4e')]][_0x4eea('0x41')]=!![];queues[_0x30292f[_0x4eea('0x4e')]][_0x4eea('0x52')]=_0x4eea('0x53');queues[_0x30292f[_0x4eea('0x4e')]]['transferexten']=_0x30292f[_0x4eea('0x5c')];queues[_0x30292f[_0x4eea('0x4e')]][_0x4eea('0x49')]=_0x30292f[_0x4eea('0x5d')];queues[_0x30292f[_0x4eea('0x4e')]][_0x4eea('0x1e')]=_0x4eea('0x54');}if(!_[_0x4eea('0x18')](queues[_0x30292f['secondtransfererlinkedid']])){if(_0x30292f[_0x4eea('0x5e')]&&queues[_0x30292f['transfertargetlinkedid']]){queues[_0x30292f[_0x4eea('0x5e')]][_0x4eea('0x23')]=0x1;queues[_0x30292f[_0x4eea('0x57')]]=_[_0x4eea('0x56')](queues[_0x30292f[_0x4eea('0x5e')]]);queues[_0x30292f[_0x4eea('0x57')]][_0x4eea('0xd')]=_0x30292f[_0x4eea('0x57')];queues[_0x30292f[_0x4eea('0x57')]][_0x4eea('0x23')]=0x2;queues[_0x30292f[_0x4eea('0x57')]][_0x4eea('0x7')]=queues[_0x30292f[_0x4eea('0x4e')]][_0x4eea('0x7')];queues[_0x30292f['transfertargetuniqueid']][_0x4eea('0x59')]=queues[_0x30292f[_0x4eea('0x4e')]]['calleridname'];queues[_0x30292f['transfertargetuniqueid']][_0x4eea('0x39')]=utils[_0x4eea('0x15')]();queues[_0x30292f[_0x4eea('0x57')]][_0x4eea('0x1a')]=utils[_0x4eea('0x15')]();queues[_0x30292f[_0x4eea('0x57')]]['holdtime']=0x0;queues[_0x30292f[_0x4eea('0x57')]]['mohtime']=0x0;utils[_0x4eea('0x12')](util[_0x4eea('0x2')](_0x4eea('0x5f'),_0x30292f[_0x4eea('0x4d')],queues[_0x30292f[_0x4eea('0x57')]][_0x4eea('0x22')],queues[_0x30292f[_0x4eea('0x57')]]['transfereduniqueid'],queues[_0x30292f[_0x4eea('0x57')]]['calleridnum'],queues[_0x30292f[_0x4eea('0x57')]][_0x4eea('0x59')]));}else{utils[_0x4eea('0x12')](util['format'](_0x4eea('0x5a'),_0x30292f[_0x4eea('0x4d')],queues[_0x30292f[_0x4eea('0x50')]]['name'],_0x30292f[_0x4eea('0x4e')]));queues[_0x30292f['secondtransfererlinkedid']]['transfereduniqueid']=_0x30292f[_0x4eea('0x4e')];}}}}catch(_0x1f0996){utils['error'](util[_0x4eea('0x2')](_0x4eea('0x60'),_0x30292f['origtransfereruniqueid']),_0x1f0996);}};exports[_0x4eea('0x61')]=function(_0x5b1c18){try{if(!_[_0x4eea('0x18')](queues[_0x5b1c18[_0x4eea('0xe')]])){utils[_0x4eea('0x10')](util[_0x4eea('0x2')]('[%s][queues][musiconholdstart]',_0x5b1c18[_0x4eea('0xe')]),_0x5b1c18);queues[_0x5b1c18[_0x4eea('0xe')]][_0x4eea('0x62')]=utils[_0x4eea('0x15')]();utils['info'](util['format'](_0x4eea('0x63'),_0x5b1c18[_0x4eea('0xe')],queues[_0x5b1c18[_0x4eea('0xe')]][_0x4eea('0x22')],queues[_0x5b1c18[_0x4eea('0xe')]][_0x4eea('0x62')]));}}catch(_0x244631){utils['error'](util['format'](_0x4eea('0x64'),_0x5b1c18[_0x4eea('0xe')]),_0x244631);}};exports[_0x4eea('0x65')]=function(_0x35ec2f){try{if(!_[_0x4eea('0x18')](queues[_0x35ec2f[_0x4eea('0xe')]])){if(!_['isNil'](queues[_0x35ec2f['uniqueid']]['musiconholdstartAt'])){utils['debug'](util['format'](_0x4eea('0x66'),_0x35ec2f[_0x4eea('0xe')]),_0x35ec2f);queues[_0x35ec2f[_0x4eea('0xe')]][_0x4eea('0x58')]+=utils[_0x4eea('0x38')](utils[_0x4eea('0x15')](),queues[_0x35ec2f[_0x4eea('0xe')]]['musiconholdstartAt']);utils[_0x4eea('0x12')](util[_0x4eea('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x35ec2f['uniqueid'],queues[_0x35ec2f['uniqueid']][_0x4eea('0x22')],queues[_0x35ec2f[_0x4eea('0xe')]]['mohtime']));delete queues[_0x35ec2f[_0x4eea('0xe')]][_0x4eea('0x62')];}}}catch(_0x56fcc3){utils['error'](util[_0x4eea('0x2')](_0x4eea('0x66'),_0x35ec2f[_0x4eea('0xe')]),_0x56fcc3);}}; \ No newline at end of file +var _0x384c=['lodash','util','info','format','channel','queue','calleridnum','accountcode','queuecallerexitreason','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%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','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transferuniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x384c,0x68));var _0xc384=function(_0x4f09fb,_0x354da5){_0x4f09fb=_0x4f09fb-0x0;var _0x4fa937=_0x384c[_0x4f09fb];return _0x4fa937;};'use strict';var _=require(_0xc384('0x0'));var util=require(_0xc384('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x42dd22){utils[_0xc384('0x2')](util[_0xc384('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x42dd22['uniqueid'],_0x42dd22[_0xc384('0x4')],_0x42dd22[_0xc384('0x5')],_0x42dd22['lastAssignedTo'],_0x42dd22[_0xc384('0x6')],_0x42dd22[_0xc384('0x7')],_0x42dd22[_0xc384('0x8')]));if(_0x42dd22[_0xc384('0x5')]){utils['getVoiceQueueByName'](_0x42dd22[_0xc384('0x5')])[_0xc384('0x9')](function(_0x8ee29a){if(_0x8ee29a){_0x42dd22[_0xc384('0xa')]=_0x8ee29a['type'];}utils['request'](_0xc384('0xb'),_0x42dd22);});}else{utils[_0xc384('0xc')](_0xc384('0xb'),_0x42dd22);}if(_0x42dd22['transfereduniqueid']){delete queues[_0x42dd22[_0xc384('0xd')]];}else{delete queues[_0x42dd22[_0xc384('0xe')]];}}exports[_0xc384('0xf')]=function(_0x8a5e8c){try{utils[_0xc384('0x10')](util[_0xc384('0x3')]('[%s][queues][queuecallerjoin]',_0x8a5e8c[_0xc384('0xe')]),_0x8a5e8c);utils[_0xc384('0x2')](util[_0xc384('0x3')](_0xc384('0x11'),_0x8a5e8c[_0xc384('0xe')],_0x8a5e8c[_0xc384('0x5')],_0x8a5e8c['position']));queues[_0x8a5e8c[_0xc384('0xe')]]=_['assign'](_0x8a5e8c,{'originalposition':_0x8a5e8c[_0xc384('0x12')],'queuecallerjoinAt':utils[_0xc384('0x13')](),'mohtime':0x0});}catch(_0x17acd8){utils[_0xc384('0x14')](util[_0xc384('0x3')](_0xc384('0x15'),_0x8a5e8c['uniqueid']),_0x17acd8);}};exports[_0xc384('0x16')]=function(_0x3066c2){try{if(!_[_0xc384('0x17')](queues[_0x3066c2[_0xc384('0xe')]])){utils['debug'](util[_0xc384('0x3')]('[%s][queues][hangup]',_0x3066c2[_0xc384('0xe')]),_0x3066c2);if(queues[_0x3066c2['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0x18')]&&!queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0x19')]){queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0x1a')]=!![];queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0x1b')]=utils['now']();queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0x8')]=_0xc384('0x1c');}utils['info'](util[_0xc384('0x3')](_0xc384('0x1d'),_0x3066c2['uniqueid'],queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0x1e')],queues[_0x3066c2[_0xc384('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x3066c2[_0xc384('0xe')]]);}else if(queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0xd')]){utils[_0xc384('0x2')](util[_0xc384('0x3')](_0xc384('0x1f'),_0x3066c2[_0xc384('0xe')],queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0x1e')],queues[_0x3066c2['uniqueid']][_0xc384('0xd')]));queues[queues[_0x3066c2['uniqueid']]['transfereduniqueid']]=queues[_0x3066c2[_0xc384('0xe')]];queues[queues[_0x3066c2[_0xc384('0xe')]][_0xc384('0xd')]][_0xc384('0x20')]=0x2;delete queues[_0x3066c2[_0xc384('0xe')]];}}}catch(_0x3266b8){utils[_0xc384('0x14')](util[_0xc384('0x3')](_0xc384('0x21'),_0x3066c2[_0xc384('0xe')]),_0x3266b8);}};exports[_0xc384('0x22')]=function(_0x49fe4a){try{utils[_0xc384('0x10')](util[_0xc384('0x3')](_0xc384('0x23'),_0x49fe4a[_0xc384('0xe')]),_0x49fe4a);if(!_[_0xc384('0x17')](_0x49fe4a[_0xc384('0x24')][_0xc384('0x25')])&&_0x49fe4a[_0xc384('0x26')][_0xc384('0x27')]()!==_0xc384('0x28')){if(!_[_0xc384('0x17')](queues[_0x49fe4a['uniqueid']])){queues[_0x49fe4a[_0xc384('0xe')]]['queuecallerabandon']=![];queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x29')]=null;queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x19')]=!![];queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x2a')]=utils['now']();queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x8')]=_0x49fe4a['value'][_0xc384('0x27')]();utils[_0xc384('0x2')](util[_0xc384('0x3')](_0xc384('0x2b'),_0x49fe4a['uniqueid'],queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x1e')],_0x49fe4a['value'],queues[_0x49fe4a[_0xc384('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x49fe4a[_0xc384('0xe')]]);}}else if(!_[_0xc384('0x17')](_0x49fe4a[_0xc384('0x24')][_0xc384('0x2c')])){if(!_[_0xc384('0x17')](queues[_0x49fe4a[_0xc384('0xe')]])&&!queues[_0x49fe4a['uniqueid']][_0xc384('0x18')]){queues[_0x49fe4a[_0xc384('0xe')]]['queuecallerabandon']=![];queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x29')]=null;queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x19')]=!![];queues[_0x49fe4a['uniqueid']][_0xc384('0x2a')]=utils[_0xc384('0x13')]();queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x8')]=_0xc384('0x2d');utils[_0xc384('0x2')](util['format'](_0xc384('0x2e'),_0x49fe4a[_0xc384('0xe')],queues[_0x49fe4a['uniqueid']][_0xc384('0x1e')],_0x49fe4a[_0xc384('0x26')],queues[_0x49fe4a[_0xc384('0xe')]][_0xc384('0x8')]));}}}catch(_0x30ea5f){utils[_0xc384('0x14')](util[_0xc384('0x3')]('[%s][queues][varset]',_0x49fe4a['uniqueid']),_0x30ea5f);}};exports[_0xc384('0x18')]=function(_0x25791d){try{if(!_[_0xc384('0x17')](queues[_0x25791d[_0xc384('0xe')]])){utils[_0xc384('0x10')](util['format']('[%s][queues][queuecallerabandon]',_0x25791d[_0xc384('0xe')]),_0x25791d);queues[_0x25791d[_0xc384('0xe')]][_0xc384('0x19')]=![];queues[_0x25791d[_0xc384('0xe')]][_0xc384('0x2a')]=null;queues[_0x25791d[_0xc384('0xe')]]['queuecallerabandon']=!![];queues[_0x25791d[_0xc384('0xe')]]['queuecallerabandonAt']=utils[_0xc384('0x13')]();queues[_0x25791d[_0xc384('0xe')]][_0xc384('0x8')]=_0xc384('0x2f');utils['info'](util[_0xc384('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x25791d[_0xc384('0xe')],queues[_0x25791d[_0xc384('0xe')]][_0xc384('0x1e')],queues[_0x25791d[_0xc384('0xe')]][_0xc384('0x8')]));}}catch(_0x3f5541){utils[_0xc384('0x14')](util['format'](_0xc384('0x30'),_0x25791d[_0xc384('0xe')]),_0x3f5541);}};exports[_0xc384('0x31')]=function(_0x19aa1b){try{if(!_[_0xc384('0x17')](queues[_0x19aa1b[_0xc384('0xe')]])){utils['debug'](util['format'](_0xc384('0x32'),_0x19aa1b[_0xc384('0xe')]),_0x19aa1b);utils[_0xc384('0x2')](util[_0xc384('0x3')](_0xc384('0x33'),_0x19aa1b['uniqueid'],queues[_0x19aa1b['uniqueid']][_0xc384('0x1e')],_0x19aa1b['connectedlinenum'],_0x19aa1b[_0xc384('0x34')]));queues[_0x19aa1b[_0xc384('0xe')]][_0xc384('0x31')]=!![];queues[_0x19aa1b[_0xc384('0xe')]][_0xc384('0x35')]=utils[_0xc384('0x13')]();queues[_0x19aa1b[_0xc384('0xe')]][_0xc384('0x36')]=utils[_0xc384('0x37')](queues[_0x19aa1b[_0xc384('0xe')]][_0xc384('0x35')],queues[_0x19aa1b['uniqueid']][_0xc384('0x38')]);queues[_0x19aa1b[_0xc384('0xe')]]['position']=_0x19aa1b[_0xc384('0x12')];queues[_0x19aa1b[_0xc384('0xe')]][_0xc384('0x39')]=_0x19aa1b[_0xc384('0x39')];queues[_0x19aa1b['uniqueid']]['connectedlinenum']=_0x19aa1b['connectedlinenum'];queues[_0x19aa1b[_0xc384('0xe')]][_0xc384('0x34')]=_0x19aa1b['connectedlinename'];}}catch(_0x4f491e){utils[_0xc384('0x14')](util['format'](_0xc384('0x32'),_0x19aa1b['uniqueid']),_0x4f491e);}};exports[_0xc384('0x3a')]=function(_0x8fd152){try{if(!_[_0xc384('0x17')](queues[_0x8fd152[_0xc384('0xe')]])){utils[_0xc384('0x10')](util['format'](_0xc384('0x3b'),_0x8fd152[_0xc384('0xe')]),_0x8fd152);utils[_0xc384('0x2')](util[_0xc384('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x8fd152[_0xc384('0xe')],queues[_0x8fd152[_0xc384('0xe')]]['name'],_0x8fd152[_0xc384('0x3c')],_0x8fd152[_0xc384('0x3d')]));queues[_0x8fd152['uniqueid']][_0xc384('0x18')]=![];queues[_0x8fd152[_0xc384('0xe')]][_0xc384('0x18')]=![];queues[_0x8fd152[_0xc384('0xe')]]['queuecallerabandonAt']=null;queues[_0x8fd152[_0xc384('0xe')]][_0xc384('0x19')]=![];queues[_0x8fd152[_0xc384('0xe')]][_0xc384('0x8')]=null;queues[_0x8fd152[_0xc384('0xe')]][_0xc384('0x2a')]=null;queues[_0x8fd152['uniqueid']]['assigned']=!![];queues[_0x8fd152[_0xc384('0xe')]][_0xc384('0x7')]=_0x8fd152[_0xc384('0x3d')];queues[_0x8fd152[_0xc384('0xe')]][_0xc384('0x3e')]=_0x8fd152[_0xc384('0x3c')];}}catch(_0x42aa1a){utils[_0xc384('0x14')](util['format'](_0xc384('0x3b'),_0x8fd152[_0xc384('0xe')]),_0x42aa1a);}};exports[_0xc384('0x3f')]=function(_0x3c22bd){try{if(!_[_0xc384('0x17')](queues[_0x3c22bd['uniqueid']])){if(queues[_0x3c22bd[_0xc384('0xe')]][_0xc384('0x35')]){utils[_0xc384('0x10')](util['format'](_0xc384('0x40'),_0x3c22bd[_0xc384('0xe')]),_0x3c22bd);queues[_0x3c22bd[_0xc384('0xe')]]['queuecallerabandon']=![];queues[_0x3c22bd[_0xc384('0xe')]]['queuecallerabandon']=![];queues[_0x3c22bd[_0xc384('0xe')]][_0xc384('0x29')]=null;queues[_0x3c22bd['uniqueid']][_0xc384('0x19')]=![];queues[_0x3c22bd['uniqueid']]['queuecallerexitAt']=null;queues[_0x3c22bd['uniqueid']][_0xc384('0x41')]=!![];queues[_0x3c22bd[_0xc384('0xe')]]['lastAssignedTo']=_0x3c22bd[_0xc384('0x3c')];queues[_0x3c22bd[_0xc384('0xe')]][_0xc384('0x1a')]=!![];queues[_0x3c22bd[_0xc384('0xe')]][_0xc384('0x1b')]=utils[_0xc384('0x13')]();if(_0x3c22bd[_0xc384('0x42')]==_0xc384('0x43')){if(!queues[_0x3c22bd['uniqueid']][_0xc384('0x43')]){queues[_0x3c22bd['uniqueid']]['queuecallerexitreason']=_0xc384('0x44');}}else{queues[_0x3c22bd[_0xc384('0xe')]][_0xc384('0x8')]='COMPLETEDBY'+_0x3c22bd['reason'][_0xc384('0x27')]();}utils['info'](util['format'](_0xc384('0x45'),_0x3c22bd[_0xc384('0xe')],queues[_0x3c22bd['uniqueid']][_0xc384('0x1e')],_0x3c22bd[_0xc384('0x3c')],queues[_0x3c22bd[_0xc384('0xe')]][_0xc384('0x8')]));writeDB(queues[_0x3c22bd[_0xc384('0xe')]]);}}}catch(_0x15007e){utils[_0xc384('0x14')](util[_0xc384('0x3')](_0xc384('0x40'),_0x3c22bd[_0xc384('0xe')]),_0x15007e);}};exports[_0xc384('0x46')]=function(_0x2b3be5){try{if(!_[_0xc384('0x17')](queues[_0x2b3be5[_0xc384('0x47')]])){utils[_0xc384('0x10')](util[_0xc384('0x3')](_0xc384('0x48'),_0x2b3be5[_0xc384('0xe')]),_0x2b3be5);queues[_0x2b3be5[_0xc384('0x47')]][_0xc384('0x43')]=!![];queues[_0x2b3be5['transfereeuniqueid']][_0xc384('0x49')]=_0xc384('0x4a');queues[_0x2b3be5[_0xc384('0x47')]]['transferexten']=_0x2b3be5['extension'];queues[_0x2b3be5['transfereeuniqueid']]['transferuniqueid']=_0x2b3be5[_0xc384('0x47')];queues[_0x2b3be5[_0xc384('0x47')]][_0xc384('0x8')]='BLINDTRANSFER';utils[_0xc384('0x2')](util[_0xc384('0x3')](_0xc384('0x4b'),_0x2b3be5['uniqueid'],queues[_0x2b3be5[_0xc384('0x47')]][_0xc384('0x1e')],_0x2b3be5['transfereeuniqueid'],_0x2b3be5[_0xc384('0x4c')]));}}catch(_0x52a4e0){utils[_0xc384('0x14')](util[_0xc384('0x3')]('[%s][queues][blindtransfer]',_0x2b3be5[_0xc384('0xe')]),_0x52a4e0);}};exports[_0xc384('0x4d')]=function(_0x4260ad){try{utils[_0xc384('0x10')](util[_0xc384('0x3')]('[%s][queues][attendedtransfer]',_0x4260ad['origtransfereruniqueid']),_0x4260ad);if(_0x4260ad[_0xc384('0x4e')]==_0x4260ad[_0xc384('0x4f')]){if(!_[_0xc384('0x17')](queues[_0x4260ad[_0xc384('0x50')]])){utils[_0xc384('0x2')](util[_0xc384('0x3')](_0xc384('0x51'),_0x4260ad[_0xc384('0x4e')],queues[_0x4260ad[_0xc384('0x50')]][_0xc384('0x1e')],_0x4260ad[_0xc384('0x52')]));queues[_0x4260ad['secondtransfererlinkedid']][_0xc384('0x43')]=!![];queues[_0x4260ad[_0xc384('0x50')]]['transfertype']=_0xc384('0x53');queues[_0x4260ad[_0xc384('0x50')]][_0xc384('0x54')]=_0x4260ad[_0xc384('0x52')];queues[_0x4260ad[_0xc384('0x50')]]['transferuniqueid']=_0x4260ad[_0xc384('0x4e')];queues[_0x4260ad[_0xc384('0x50')]][_0xc384('0x8')]=_0xc384('0x55');}if(!_['isNil'](queues[_0x4260ad[_0xc384('0x4f')]])){if(_0x4260ad[_0xc384('0x56')]&&queues[_0x4260ad[_0xc384('0x56')]]){queues[_0x4260ad[_0xc384('0x56')]]['queuecallerenterreason']=0x1;queues[_0x4260ad[_0xc384('0x47')]]=_[_0xc384('0x57')](queues[_0x4260ad[_0xc384('0x56')]]);queues[_0x4260ad[_0xc384('0x47')]][_0xc384('0xd')]=_0x4260ad['transfertargetuniqueid'];queues[_0x4260ad[_0xc384('0x47')]]['queuecallerenterreason']=0x2;queues[_0x4260ad[_0xc384('0x47')]][_0xc384('0x6')]=queues[_0x4260ad[_0xc384('0x50')]][_0xc384('0x6')];queues[_0x4260ad[_0xc384('0x47')]][_0xc384('0x58')]=queues[_0x4260ad[_0xc384('0x50')]]['calleridname'];queues[_0x4260ad['transfereeuniqueid']][_0xc384('0x38')]=utils['now']();queues[_0x4260ad[_0xc384('0x47')]][_0xc384('0x35')]=utils[_0xc384('0x13')]();queues[_0x4260ad['transfereeuniqueid']]['holdtime']=0x0;queues[_0x4260ad[_0xc384('0x47')]][_0xc384('0x59')]=0x0;utils['info'](util[_0xc384('0x3')](_0xc384('0x5a'),_0x4260ad[_0xc384('0x4e')],queues[_0x4260ad[_0xc384('0x47')]][_0xc384('0x1e')],queues[_0x4260ad[_0xc384('0x47')]][_0xc384('0x6')],queues[_0x4260ad['transfereeuniqueid']][_0xc384('0x58')]));}else{utils[_0xc384('0x2')](util['format'](_0xc384('0x5b'),_0x4260ad['origtransfereruniqueid'],queues[_0x4260ad['origtransfererlinkedid']][_0xc384('0x1e')],_0x4260ad['secondtransfererlinkedid']));queues[_0x4260ad[_0xc384('0x4f')]][_0xc384('0xd')]=_0x4260ad[_0xc384('0x50')];}}}else if(_0x4260ad[_0xc384('0x5c')]==_0x4260ad['secondtransfererlinkedid']){if(!_[_0xc384('0x17')](queues[_0x4260ad['origtransfererlinkedid']])){utils[_0xc384('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4260ad[_0xc384('0x4e')],queues[_0x4260ad['origtransfererlinkedid']][_0xc384('0x1e')],_0x4260ad[_0xc384('0x5c')],_0x4260ad[_0xc384('0x5d')]));queues[_0x4260ad[_0xc384('0x4f')]]['transfer']=!![];queues[_0x4260ad[_0xc384('0x4f')]][_0xc384('0x49')]=_0xc384('0x53');queues[_0x4260ad[_0xc384('0x4f')]][_0xc384('0x54')]=_0x4260ad[_0xc384('0x5d')];queues[_0x4260ad[_0xc384('0x4f')]][_0xc384('0x5e')]=_0x4260ad['secondtransfereruniqueid'];queues[_0x4260ad[_0xc384('0x4f')]][_0xc384('0x8')]=_0xc384('0x55');}if(!_[_0xc384('0x17')](queues[_0x4260ad[_0xc384('0x50')]])){if(_0x4260ad[_0xc384('0x5f')]&&queues[_0x4260ad[_0xc384('0x5f')]]){queues[_0x4260ad[_0xc384('0x5f')]][_0xc384('0x20')]=0x1;queues[_0x4260ad[_0xc384('0x60')]]=_[_0xc384('0x57')](queues[_0x4260ad[_0xc384('0x5f')]]);queues[_0x4260ad['transfertargetuniqueid']][_0xc384('0xd')]=_0x4260ad[_0xc384('0x60')];queues[_0x4260ad[_0xc384('0x60')]][_0xc384('0x20')]=0x2;queues[_0x4260ad[_0xc384('0x60')]][_0xc384('0x6')]=queues[_0x4260ad[_0xc384('0x4f')]][_0xc384('0x6')];queues[_0x4260ad[_0xc384('0x60')]][_0xc384('0x58')]=queues[_0x4260ad[_0xc384('0x4f')]][_0xc384('0x58')];queues[_0x4260ad[_0xc384('0x60')]]['queuecallerjoinAt']=utils['now']();queues[_0x4260ad[_0xc384('0x60')]][_0xc384('0x35')]=utils['now']();queues[_0x4260ad['transfertargetuniqueid']][_0xc384('0x36')]=0x0;queues[_0x4260ad[_0xc384('0x60')]][_0xc384('0x59')]=0x0;utils[_0xc384('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x4260ad['origtransfereruniqueid'],queues[_0x4260ad[_0xc384('0x60')]][_0xc384('0x1e')],queues[_0x4260ad[_0xc384('0x60')]][_0xc384('0xd')],queues[_0x4260ad['transfertargetuniqueid']][_0xc384('0x6')],queues[_0x4260ad[_0xc384('0x60')]][_0xc384('0x58')]));}else{utils[_0xc384('0x2')](util[_0xc384('0x3')](_0xc384('0x5b'),_0x4260ad[_0xc384('0x4e')],queues[_0x4260ad[_0xc384('0x50')]][_0xc384('0x1e')],_0x4260ad[_0xc384('0x4f')]));queues[_0x4260ad[_0xc384('0x50')]][_0xc384('0xd')]=_0x4260ad[_0xc384('0x4f')];}}}}catch(_0x128b1f){utils['error'](util[_0xc384('0x3')](_0xc384('0x61'),_0x4260ad[_0xc384('0x4e')]),_0x128b1f);}};exports[_0xc384('0x62')]=function(_0x8afc11){try{if(!_[_0xc384('0x17')](queues[_0x8afc11[_0xc384('0xe')]])){utils[_0xc384('0x10')](util[_0xc384('0x3')]('[%s][queues][musiconholdstart]',_0x8afc11[_0xc384('0xe')]),_0x8afc11);queues[_0x8afc11[_0xc384('0xe')]][_0xc384('0x63')]=utils[_0xc384('0x13')]();utils[_0xc384('0x2')](util[_0xc384('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x8afc11['uniqueid'],queues[_0x8afc11[_0xc384('0xe')]]['name'],queues[_0x8afc11['uniqueid']][_0xc384('0x63')]));}}catch(_0x336065){utils[_0xc384('0x14')](util[_0xc384('0x3')](_0xc384('0x64'),_0x8afc11[_0xc384('0xe')]),_0x336065);}};exports[_0xc384('0x65')]=function(_0x328956){try{if(!_['isNil'](queues[_0x328956['uniqueid']])){if(!_['isNil'](queues[_0x328956[_0xc384('0xe')]][_0xc384('0x63')])){utils[_0xc384('0x10')](util[_0xc384('0x3')](_0xc384('0x66'),_0x328956['uniqueid']),_0x328956);queues[_0x328956[_0xc384('0xe')]][_0xc384('0x59')]+=utils[_0xc384('0x37')](utils[_0xc384('0x13')](),queues[_0x328956[_0xc384('0xe')]][_0xc384('0x63')]);utils[_0xc384('0x2')](util['format'](_0xc384('0x67'),_0x328956[_0xc384('0xe')],queues[_0x328956[_0xc384('0xe')]][_0xc384('0x1e')],queues[_0x328956['uniqueid']]['mohtime']));delete queues[_0x328956[_0xc384('0xe')]][_0xc384('0x63')];}}}catch(_0x25c5a9){utils[_0xc384('0x14')](util[_0xc384('0x3')]('[%s][queues][musiconholdstop]',_0x328956[_0xc384('0xe')]),_0x25c5a9);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 2aa6f4f..6708b74 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 _0x132d=['CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','error','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','name'];(function(_0x87c25c,_0x31fc34){var _0x2b8c4e=function(_0x42f79f){while(--_0x42f79f){_0x87c25c['push'](_0x87c25c['shift']());}};_0x2b8c4e(++_0x31fc34);}(_0x132d,0x11d));var _0xd132=function(_0x36942e,_0x3956dd){_0x36942e=_0x36942e-0x0;var _0x49843f=_0x132d[_0x36942e];return _0x49843f;};'use strict';var _=require(_0xd132('0x0'));var util=require(_0xd132('0x1'));var utils=require(_0xd132('0x2'));var recordings={};function writeDB(_0x3fdfe6){utils[_0xd132('0x3')](util[_0xd132('0x4')](_0xd132('0x5'),_0x3fdfe6['uniqueid']));if(_0x3fdfe6[_0xd132('0x6')]){utils[_0xd132('0x7')](_0x3fdfe6[_0xd132('0x6')])[_0xd132('0x8')](function(_0x1315f9){if(_0x1315f9){_0x3fdfe6['membername']=_0x1315f9[_0xd132('0x9')];_0x3fdfe6['UserId']=_0x1315f9['id'];}utils['request'](_0xd132('0xa'),_0x3fdfe6);});}else{utils[_0xd132('0xb')]('CreateVoiceRecording',_0x3fdfe6);}}exports['newchannel']=function(_0x56a653){try{utils[_0xd132('0xc')](util['format'](_0xd132('0xd'),_0x56a653[_0xd132('0xe')]),_0x56a653);if(_0x56a653['uniqueid']==_0x56a653[_0xd132('0xf')]){utils[_0xd132('0x3')](util[_0xd132('0x4')](_0xd132('0x10'),_0x56a653['uniqueid'],_0x56a653[_0xd132('0x11')],_0x56a653['exten']));recordings[_0x56a653[_0xd132('0xe')]]={'uniqueid':_0x56a653[_0xd132('0xe')],'accountcode':_0x56a653['accountcode'],'exten':_0x56a653['exten'],'context':_0x56a653[_0xd132('0x11')],'channel':_0x56a653[_0xd132('0x12')],'monitors':[]};}}catch(_0x295462){utils[_0xd132('0x13')](util[_0xd132('0x4')](_0xd132('0xd'),_0x56a653['uniqueid']),_0x295462);}};exports[_0xd132('0x14')]=function(_0x1f0fc2){try{utils[_0xd132('0xc')](util['format']('[%s][recordings][newstate]',_0x1f0fc2[_0xd132('0xe')]),_0x1f0fc2);if(!_['isNil'](recordings[_0x1f0fc2['uniqueid']])&&_0x1f0fc2[_0xd132('0x15')]==0x6){utils[_0xd132('0x3')](util[_0xd132('0x4')](_0xd132('0x16'),_0x1f0fc2[_0xd132('0xe')],_0x1f0fc2[_0xd132('0x11')],_0x1f0fc2[_0xd132('0x12')]));}else if(!_[_0xd132('0x17')](recordings[_0x1f0fc2[_0xd132('0xf')]])&&_0x1f0fc2[_0xd132('0x15')]==0x6&&_0x1f0fc2['context']!=_0xd132('0x18')){utils[_0xd132('0x3')](util[_0xd132('0x4')](_0xd132('0x19'),_0x1f0fc2[_0xd132('0xe')],_0x1f0fc2[_0xd132('0xf')],_0x1f0fc2[_0xd132('0x11')],_0x1f0fc2[_0xd132('0x12')]));recordings[_0x1f0fc2[_0xd132('0xf')]][_0xd132('0x6')]=_0x1f0fc2[_0xd132('0x6')];}}catch(_0x1acbb0){utils[_0xd132('0x13')](util[_0xd132('0x4')]('[%s][recordings][newstate]',_0x1f0fc2[_0xd132('0xe')]),_0x1acbb0);}};exports['varset']=function(_0x20f14e){try{if(!_['isNil'](_0x20f14e[_0xd132('0x1a')])&&!_['isNil'](_0x20f14e[_0xd132('0x1a')][_0xd132('0x1b')])){utils[_0xd132('0xc')](util[_0xd132('0x4')](_0xd132('0x1c'),_0x20f14e[_0xd132('0xe')]),_0x20f14e);utils[_0xd132('0x3')](util['format'](_0xd132('0x1d'),_0x20f14e[_0xd132('0xe')],_0x20f14e[_0xd132('0x1a')],_0x20f14e[_0xd132('0x1e')]));if(_['endsWith'](_0x20f14e['value'],_0xd132('0x1f'))){_0x20f14e[_0xd132('0x1e')]=_0x20f14e[_0xd132('0x1e')]['replace'](_0xd132('0x1f'),_0xd132('0x20'));}if(recordings[_0x20f14e[_0xd132('0xf')]]){var _0x9382f6=_['find'](recordings[_0x20f14e[_0xd132('0xf')]][_0xd132('0x21')],{'value':_0x20f14e[_0xd132('0x1e')]});if(_['isNil'](_0x9382f6)){recordings[_0x20f14e['linkedid']]['monitors'][_0xd132('0x22')]({'value':_0x20f14e[_0xd132('0x1e')]});}}}}catch(_0xb929c3){utils[_0xd132('0x13')](util[_0xd132('0x4')](_0xd132('0x1c'),_0x20f14e[_0xd132('0xe')]),_0xb929c3);}};exports[_0xd132('0x23')]=function(_0x4d6bfd){try{if(!_[_0xd132('0x17')](recordings[_0x4d6bfd['uniqueid']])){utils[_0xd132('0xc')](util[_0xd132('0x4')](_0xd132('0x24'),_0x4d6bfd[_0xd132('0xe')]),_0x4d6bfd);utils[_0xd132('0x3')](util['format'](_0xd132('0x25'),_0x4d6bfd[_0xd132('0xe')],_0x4d6bfd['calleridnum'],_0x4d6bfd[_0xd132('0x26')],_0x4d6bfd['cause-txt']));recordings[_0x4d6bfd[_0xd132('0xe')]][_0xd132('0x27')]=_0x4d6bfd[_0xd132('0x27')];recordings[_0x4d6bfd[_0xd132('0xe')]][_0xd132('0x26')]=_0x4d6bfd[_0xd132('0x26')];recordings[_0x4d6bfd[_0xd132('0xe')]][_0xd132('0x28')]=_0x4d6bfd[_0xd132('0x28')];recordings[_0x4d6bfd['uniqueid']]['connectedlinename']=_0x4d6bfd[_0xd132('0x29')];if(recordings[_0x4d6bfd['uniqueid']][_0xd132('0x2a')]==_0xd132('0x2b')&&recordings[_0x4d6bfd['uniqueid']]['accountcode']){recordings[_0x4d6bfd[_0xd132('0xe')]]['connectedlinenum']=recordings[_0x4d6bfd['uniqueid']]['accountcode'];recordings[_0x4d6bfd[_0xd132('0xe')]]['connectedlinename']='';}recordings[_0x4d6bfd[_0xd132('0xe')]][_0xd132('0x21')][_0xd132('0x2c')](function(_0x332571){var _0x5f5d93=_[_0xd132('0x2d')](recordings[_0x4d6bfd[_0xd132('0xe')]]);_0x5f5d93['value']=_0x332571[_0xd132('0x1e')];writeDB(_0x5f5d93);});delete recordings[_0x4d6bfd[_0xd132('0xe')]];}}catch(_0x21aa2b){utils[_0xd132('0x13')](util[_0xd132('0x4')](_0xd132('0x24'),_0x4d6bfd[_0xd132('0xe')]),_0x21aa2b);}};exports[_0xd132('0x2e')]=function(_0x48f4a6){try{if(!_[_0xd132('0x17')](recordings[_0x48f4a6[_0xd132('0xe')]])){utils[_0xd132('0xc')](util['format'](_0xd132('0x2f'),_0x48f4a6['uniqueid']),_0x48f4a6);utils['info'](util[_0xd132('0x4')](_0xd132('0x30'),_0x48f4a6['uniqueid'],_0x48f4a6[_0xd132('0x31')],_0x48f4a6[_0xd132('0x32')]));if(_0x48f4a6[_0xd132('0x31')]['toLowerCase']()=='set'&&_['startsWith'](_0x48f4a6['appdata'][_0xd132('0x33')](),_0xd132('0x34'))){var _0x495688=_0x48f4a6[_0xd132('0x32')][_0xd132('0x35')]('=');var _0x65f919=_0x495688[0x0][_0xd132('0x36')](_0x495688[0x0][_0xd132('0x37')]('(')+0x1,_0x495688[0x0]['lastIndexOf'](')'));var _0x24c6eb=_0x495688[0x1];recordings[_0x48f4a6[_0xd132('0xe')]][_0x65f919]=_0x24c6eb;}}}catch(_0x27ef05){utils[_0xd132('0x13')](util[_0xd132('0x4')]('[%s][recordings][newexten]',_0x48f4a6[_0xd132('0xe')]),_0x27ef05);}};exports['queuecallerjoin']=function(_0x5cc98d){try{if(!_[_0xd132('0x17')](recordings[_0x5cc98d[_0xd132('0xe')]])){utils[_0xd132('0xc')](util[_0xd132('0x4')](_0xd132('0x38'),_0x5cc98d[_0xd132('0xe')]),_0x5cc98d);utils[_0xd132('0x3')](util[_0xd132('0x4')](_0xd132('0x39'),_0x5cc98d[_0xd132('0xe')],_0x5cc98d[_0xd132('0x3a')]));recordings[_0x5cc98d['uniqueid']][_0xd132('0x3a')]=_0x5cc98d[_0xd132('0x3a')];}}catch(_0x1c5998){utils[_0xd132('0x13')](util[_0xd132('0x4')](_0xd132('0x38'),_0x5cc98d[_0xd132('0xe')]),_0x1c5998);}}; \ No newline at end of file +var _0xe398=['connectedlinename','type','outbound','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','then','membername','UserId','request','CreateVoiceRecording','debug','uniqueid','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','error','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','hangup','calleridnum','calleridname','cause-txt','connectedlinenum'];(function(_0x53c8c4,_0x29097b){var _0x1861be=function(_0x167a97){while(--_0x167a97){_0x53c8c4['push'](_0x53c8c4['shift']());}};_0x1861be(++_0x29097b);}(_0xe398,0x13e));var _0x8e39=function(_0x1b78ab,_0x3bb49f){_0x1b78ab=_0x1b78ab-0x0;var _0x5891d6=_0xe398[_0x1b78ab];return _0x5891d6;};'use strict';var _=require(_0x8e39('0x0'));var util=require(_0x8e39('0x1'));var utils=require(_0x8e39('0x2'));var recordings={};function writeDB(_0x3c176d){utils[_0x8e39('0x3')](util['format'](_0x8e39('0x4'),_0x3c176d['uniqueid']));if(_0x3c176d['accountcode']){utils['getUserByInternal'](_0x3c176d['accountcode'])[_0x8e39('0x5')](function(_0x5cce6d){if(_0x5cce6d){_0x3c176d[_0x8e39('0x6')]=_0x5cce6d['name'];_0x3c176d[_0x8e39('0x7')]=_0x5cce6d['id'];}utils[_0x8e39('0x8')](_0x8e39('0x9'),_0x3c176d);});}else{utils[_0x8e39('0x8')](_0x8e39('0x9'),_0x3c176d);}}exports['newchannel']=function(_0x28f5f0){try{utils[_0x8e39('0xa')](util['format']('[%s][recordings][newchannel]',_0x28f5f0[_0x8e39('0xb')]),_0x28f5f0);if(_0x28f5f0['uniqueid']==_0x28f5f0[_0x8e39('0xc')]){utils['info'](util[_0x8e39('0xd')](_0x8e39('0xe'),_0x28f5f0[_0x8e39('0xb')],_0x28f5f0[_0x8e39('0xf')],_0x28f5f0[_0x8e39('0x10')]));recordings[_0x28f5f0[_0x8e39('0xb')]]={'uniqueid':_0x28f5f0[_0x8e39('0xb')],'accountcode':_0x28f5f0[_0x8e39('0x11')],'exten':_0x28f5f0[_0x8e39('0x10')],'context':_0x28f5f0[_0x8e39('0xf')],'channel':_0x28f5f0[_0x8e39('0x12')],'monitors':[]};}}catch(_0x2e5913){utils[_0x8e39('0x13')](util[_0x8e39('0xd')]('[%s][recordings][newchannel]',_0x28f5f0[_0x8e39('0xb')]),_0x2e5913);}};exports['newstate']=function(_0x12a679){try{utils[_0x8e39('0xa')](util['format']('[%s][recordings][newstate]',_0x12a679[_0x8e39('0xb')]),_0x12a679);if(!_[_0x8e39('0x14')](recordings[_0x12a679[_0x8e39('0xb')]])&&_0x12a679[_0x8e39('0x15')]==0x6){utils[_0x8e39('0x3')](util[_0x8e39('0xd')](_0x8e39('0x16'),_0x12a679[_0x8e39('0xb')],_0x12a679[_0x8e39('0xf')],_0x12a679[_0x8e39('0x12')]));}else if(!_['isNil'](recordings[_0x12a679['linkedid']])&&_0x12a679[_0x8e39('0x15')]==0x6&&_0x12a679[_0x8e39('0xf')]!=_0x8e39('0x17')){utils[_0x8e39('0x3')](util[_0x8e39('0xd')](_0x8e39('0x18'),_0x12a679['uniqueid'],_0x12a679['linkedid'],_0x12a679[_0x8e39('0xf')],_0x12a679[_0x8e39('0x12')]));recordings[_0x12a679[_0x8e39('0xc')]][_0x8e39('0x11')]=_0x12a679[_0x8e39('0x11')];}}catch(_0x235798){utils[_0x8e39('0x13')](util[_0x8e39('0xd')](_0x8e39('0x19'),_0x12a679[_0x8e39('0xb')]),_0x235798);}};exports[_0x8e39('0x1a')]=function(_0x1d30ca){try{if(!_[_0x8e39('0x14')](_0x1d30ca[_0x8e39('0x1b')])&&!_[_0x8e39('0x14')](_0x1d30ca[_0x8e39('0x1b')]['mixmonitor_filename'])){utils[_0x8e39('0xa')](util[_0x8e39('0xd')](_0x8e39('0x1c'),_0x1d30ca['uniqueid']),_0x1d30ca);utils[_0x8e39('0x3')](util[_0x8e39('0xd')](_0x8e39('0x1d'),_0x1d30ca[_0x8e39('0xb')],_0x1d30ca[_0x8e39('0x1b')],_0x1d30ca[_0x8e39('0x1e')]));if(_[_0x8e39('0x1f')](_0x1d30ca['value'],'.wav49')){_0x1d30ca[_0x8e39('0x1e')]=_0x1d30ca[_0x8e39('0x1e')][_0x8e39('0x20')](_0x8e39('0x21'),_0x8e39('0x22'));}if(recordings[_0x1d30ca[_0x8e39('0xc')]]){var _0x23e2c8=_[_0x8e39('0x23')](recordings[_0x1d30ca[_0x8e39('0xc')]][_0x8e39('0x24')],{'value':_0x1d30ca[_0x8e39('0x1e')]});if(_[_0x8e39('0x14')](_0x23e2c8)){recordings[_0x1d30ca[_0x8e39('0xc')]][_0x8e39('0x24')]['push']({'value':_0x1d30ca['value']});}}}}catch(_0x5de5ce){utils[_0x8e39('0x13')](util[_0x8e39('0xd')](_0x8e39('0x1c'),_0x1d30ca[_0x8e39('0xb')]),_0x5de5ce);}};exports[_0x8e39('0x25')]=function(_0xd6dc0b){try{if(!_['isNil'](recordings[_0xd6dc0b[_0x8e39('0xb')]])){utils[_0x8e39('0xa')](util[_0x8e39('0xd')]('[%s][recordings][hangup]',_0xd6dc0b['uniqueid']),_0xd6dc0b);utils['info'](util[_0x8e39('0xd')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xd6dc0b['uniqueid'],_0xd6dc0b[_0x8e39('0x26')],_0xd6dc0b[_0x8e39('0x27')],_0xd6dc0b[_0x8e39('0x28')]));recordings[_0xd6dc0b[_0x8e39('0xb')]]['calleridnum']=_0xd6dc0b[_0x8e39('0x26')];recordings[_0xd6dc0b[_0x8e39('0xb')]]['calleridname']=_0xd6dc0b[_0x8e39('0x27')];recordings[_0xd6dc0b[_0x8e39('0xb')]][_0x8e39('0x29')]=_0xd6dc0b[_0x8e39('0x29')];recordings[_0xd6dc0b[_0x8e39('0xb')]]['connectedlinename']=_0xd6dc0b[_0x8e39('0x2a')];if(recordings[_0xd6dc0b['uniqueid']][_0x8e39('0x2b')]==_0x8e39('0x2c')&&recordings[_0xd6dc0b['uniqueid']][_0x8e39('0x11')]){recordings[_0xd6dc0b[_0x8e39('0xb')]]['connectedlinenum']=recordings[_0xd6dc0b[_0x8e39('0xb')]][_0x8e39('0x11')];recordings[_0xd6dc0b[_0x8e39('0xb')]][_0x8e39('0x2a')]='';}recordings[_0xd6dc0b[_0x8e39('0xb')]][_0x8e39('0x24')]['forEach'](function(_0x28a09b){var _0x46cdfb=_[_0x8e39('0x2d')](recordings[_0xd6dc0b[_0x8e39('0xb')]]);_0x46cdfb[_0x8e39('0x1e')]=_0x28a09b[_0x8e39('0x1e')];writeDB(_0x46cdfb);});delete recordings[_0xd6dc0b['uniqueid']];}}catch(_0x36cda7){utils[_0x8e39('0x13')](util[_0x8e39('0xd')](_0x8e39('0x2e'),_0xd6dc0b[_0x8e39('0xb')]),_0x36cda7);}};exports[_0x8e39('0x2f')]=function(_0x1528ce){try{if(!_[_0x8e39('0x14')](recordings[_0x1528ce[_0x8e39('0xb')]])){utils['debug'](util[_0x8e39('0xd')](_0x8e39('0x30'),_0x1528ce['uniqueid']),_0x1528ce);utils['info'](util[_0x8e39('0xd')](_0x8e39('0x31'),_0x1528ce[_0x8e39('0xb')],_0x1528ce['application'],_0x1528ce[_0x8e39('0x32')]));if(_0x1528ce['application'][_0x8e39('0x33')]()==_0x8e39('0x34')&&_[_0x8e39('0x35')](_0x1528ce['appdata'][_0x8e39('0x33')](),_0x8e39('0x36'))){var _0x71667=_0x1528ce[_0x8e39('0x32')]['split']('=');var _0x217206=_0x71667[0x0][_0x8e39('0x37')](_0x71667[0x0][_0x8e39('0x38')]('(')+0x1,_0x71667[0x0]['lastIndexOf'](')'));var _0x2b3552=_0x71667[0x1];recordings[_0x1528ce[_0x8e39('0xb')]][_0x217206]=_0x2b3552;}}}catch(_0x1b8ce9){utils[_0x8e39('0x13')](util[_0x8e39('0xd')]('[%s][recordings][newexten]',_0x1528ce[_0x8e39('0xb')]),_0x1b8ce9);}};exports[_0x8e39('0x39')]=function(_0x3acdf2){try{if(!_['isNil'](recordings[_0x3acdf2[_0x8e39('0xb')]])){utils[_0x8e39('0xa')](util[_0x8e39('0xd')](_0x8e39('0x3a'),_0x3acdf2[_0x8e39('0xb')]),_0x3acdf2);utils[_0x8e39('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3acdf2[_0x8e39('0xb')],_0x3acdf2[_0x8e39('0x3b')]));recordings[_0x3acdf2['uniqueid']][_0x8e39('0x3b')]=_0x3acdf2['queue'];}}catch(_0x3bcd82){utils['error'](util[_0x8e39('0xd')](_0x8e39('0x3a'),_0x3acdf2[_0x8e39('0xb')]),_0x3bcd82);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index e31f48f..7ffcc78 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 _0xbad9=['error','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','blind','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid'];(function(_0x1eff59,_0x195aa6){var _0xa061cd=function(_0x5daf00){while(--_0x5daf00){_0x1eff59['push'](_0x1eff59['shift']());}};_0xa061cd(++_0x195aa6);}(_0xbad9,0x119));var _0x9bad=function(_0x44ac05,_0x9f3d4b){_0x44ac05=_0x44ac05-0x0;var _0x2bb606=_0xbad9[_0x44ac05];return _0x2bb606;};'use strict';var _=require('lodash');var util=require(_0x9bad('0x0'));var utils=require(_0x9bad('0x1'));function writeDB(_0x3a564e){utils[_0x9bad('0x2')](util[_0x9bad('0x3')](_0x9bad('0x4'),_0x3a564e['type']===_0x9bad('0x5')?_0x3a564e['origtransfereruniqueid']:_0x3a564e[_0x9bad('0x6')],_0x3a564e['type']));utils[_0x9bad('0x7')](_0x9bad('0x8'),_0x3a564e);}exports[_0x9bad('0x9')]=function(_0x412a08){try{utils[_0x9bad('0xa')](util[_0x9bad('0x3')](_0x9bad('0xb'),_0x412a08[_0x9bad('0x6')]),_0x412a08);utils['info'](util['format'](_0x9bad('0xc'),_0x412a08[_0x9bad('0x6')],_0x412a08[_0x9bad('0xd')],_0x412a08[_0x9bad('0xe')],_0x412a08[_0x9bad('0xf')],_0x412a08[_0x9bad('0x10')]));_0x412a08[_0x9bad('0x11')]=_0x9bad('0x12');writeDB(_0x412a08);}catch(_0x3cbdc6){utils['error'](util[_0x9bad('0x3')](_0x9bad('0xb'),_0x412a08['uniqueid']),_0x3cbdc6);}};exports['attendedtransfer']=function(_0x43af89){try{utils[_0x9bad('0xa')](util[_0x9bad('0x3')](_0x9bad('0x13'),_0x43af89[_0x9bad('0x14')]),_0x43af89);utils[_0x9bad('0x2')](util[_0x9bad('0x3')](_0x9bad('0x15'),_0x43af89[_0x9bad('0x14')],_0x43af89[_0x9bad('0x16')],_0x43af89[_0x9bad('0x17')],_0x43af89['transfertargetcalleridnum'],_0x43af89['transfertargetcalleridname']));_0x43af89=_[_0x9bad('0x18')](_0x43af89,{'transfererchannel':_0x43af89[_0x9bad('0x19')],'transferercalleridnum':_0x43af89['origtransferercalleridnum'],'transferercalleridname':_0x43af89[_0x9bad('0x17')],'transfererconnectedlinenum':_0x43af89[_0x9bad('0x1a')],'transfererconnectedlinename':_0x43af89['secondtransfererconnectedlinename'],'transfereraccountcode':_0x43af89['origtransfereraccountcode'],'transferercontext':_0x43af89[_0x9bad('0x1b')],'transfererexten':_0x43af89[_0x9bad('0x1c')],'transfererlinkedid':_0x43af89['origtransfererlinkedid'],'context':_0x43af89[_0x9bad('0x1d')],'extension':_0x43af89[_0x9bad('0x1e')],'type':_0x9bad('0x5')});if(_[_0x9bad('0x1f')](_0x43af89['transfereechannel'])){_0x43af89=_[_0x9bad('0x18')](_0x43af89,{'transfereechannel':_0x43af89[_0x9bad('0x20')],'transfereecalleridnum':_0x43af89[_0x9bad('0x21')],'transfereecalleridname':_0x43af89['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x43af89['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x43af89[_0x9bad('0x22')],'transfereeaccountcode':_0x43af89[_0x9bad('0x23')],'transfereecontext':_0x43af89[_0x9bad('0x24')],'transfereeexten':_0x43af89[_0x9bad('0x25')],'transfereelinkedid':_0x43af89[_0x9bad('0x26')]});}writeDB(_0x43af89);}catch(_0x55a3f1){utils[_0x9bad('0x27')](util[_0x9bad('0x3')](_0x9bad('0x13'),_0x43af89[_0x9bad('0x14')]),_0x55a3f1);}}; \ No newline at end of file +var _0x2bd8=['assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x43926c,_0x4389fe){var _0x5d8e92=function(_0x1e4c49){while(--_0x1e4c49){_0x43926c['push'](_0x43926c['shift']());}};_0x5d8e92(++_0x4389fe);}(_0x2bd8,0x160));var _0x82bd=function(_0x358771,_0x498ae0){_0x358771=_0x358771-0x0;var _0x3ff0b4=_0x2bd8[_0x358771];return _0x3ff0b4;};'use strict';var _=require('lodash');var util=require(_0x82bd('0x0'));var utils=require(_0x82bd('0x1'));function writeDB(_0x4758ad){utils['info'](util[_0x82bd('0x2')](_0x82bd('0x3'),_0x4758ad[_0x82bd('0x4')]===_0x82bd('0x5')?_0x4758ad[_0x82bd('0x6')]:_0x4758ad[_0x82bd('0x7')],_0x4758ad['type']));utils['request'](_0x82bd('0x8'),_0x4758ad);}exports[_0x82bd('0x9')]=function(_0x33a64e){try{utils[_0x82bd('0xa')](util[_0x82bd('0x2')](_0x82bd('0xb'),_0x33a64e['uniqueid']),_0x33a64e);utils[_0x82bd('0xc')](util[_0x82bd('0x2')](_0x82bd('0xd'),_0x33a64e[_0x82bd('0x7')],_0x33a64e[_0x82bd('0xe')],_0x33a64e[_0x82bd('0xf')],_0x33a64e[_0x82bd('0x10')],_0x33a64e[_0x82bd('0x11')]));_0x33a64e[_0x82bd('0x4')]=_0x82bd('0x12');writeDB(_0x33a64e);}catch(_0x4bdb40){utils[_0x82bd('0x13')](util['format'](_0x82bd('0xb'),_0x33a64e['uniqueid']),_0x4bdb40);}};exports[_0x82bd('0x14')]=function(_0xaa4e07){try{utils[_0x82bd('0xa')](util[_0x82bd('0x2')](_0x82bd('0x15'),_0xaa4e07[_0x82bd('0x6')]),_0xaa4e07);utils['info'](util[_0x82bd('0x2')](_0x82bd('0x16'),_0xaa4e07[_0x82bd('0x6')],_0xaa4e07['origtransferercalleridnum'],_0xaa4e07[_0x82bd('0x17')],_0xaa4e07[_0x82bd('0x18')],_0xaa4e07[_0x82bd('0x19')]));_0xaa4e07=_[_0x82bd('0x1a')](_0xaa4e07,{'transfererchannel':_0xaa4e07[_0x82bd('0x1b')],'transferercalleridnum':_0xaa4e07[_0x82bd('0x1c')],'transferercalleridname':_0xaa4e07[_0x82bd('0x17')],'transfererconnectedlinenum':_0xaa4e07[_0x82bd('0x1d')],'transfererconnectedlinename':_0xaa4e07['secondtransfererconnectedlinename'],'transfereraccountcode':_0xaa4e07[_0x82bd('0x1e')],'transferercontext':_0xaa4e07[_0x82bd('0x1f')],'transfererexten':_0xaa4e07[_0x82bd('0x20')],'transfererlinkedid':_0xaa4e07['origtransfererlinkedid'],'context':_0xaa4e07[_0x82bd('0x21')],'extension':_0xaa4e07[_0x82bd('0x22')],'type':_0x82bd('0x5')});if(_[_0x82bd('0x23')](_0xaa4e07[_0x82bd('0x24')])){_0xaa4e07=_[_0x82bd('0x1a')](_0xaa4e07,{'transfereechannel':_0xaa4e07[_0x82bd('0x25')],'transfereecalleridnum':_0xaa4e07['transfertargetcalleridnum'],'transfereecalleridname':_0xaa4e07[_0x82bd('0x19')],'transfereeconnectedlinenum':_0xaa4e07[_0x82bd('0x26')],'transfereeconnectedlinename':_0xaa4e07[_0x82bd('0x27')],'transfereeaccountcode':_0xaa4e07[_0x82bd('0x28')],'transfereecontext':_0xaa4e07['transfertargetcontext'],'transfereeexten':_0xaa4e07[_0x82bd('0x29')],'transfereelinkedid':_0xaa4e07['transfertargetlinkedid']});}writeDB(_0xaa4e07);}catch(_0x383136){utils[_0x82bd('0x13')](util[_0x82bd('0x2')](_0x82bd('0x15'),_0xaa4e07[_0x82bd('0x6')]),_0x383136);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 62e1e02..c866273 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 _0xe6e9=['stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s'];(function(_0x23b214,_0x3ba6f0){var _0x209e5b=function(_0x3561d4){while(--_0x3561d4){_0x23b214['push'](_0x23b214['shift']());}};_0x209e5b(++_0x3ba6f0);}(_0xe6e9,0x182));var _0x9e6e=function(_0x3eae87,_0x214fea){_0x3eae87=_0x3eae87-0x0;var _0x5d5c3f=_0xe6e9[_0x3eae87];return _0x5d5c3f;};'use strict';var BPromise=require(_0x9e6e('0x0'));var jayson=require(_0x9e6e('0x1'));var moment=require(_0x9e6e('0x2'));var util=require('util');var client=jayson[_0x9e6e('0x3')][_0x9e6e('0x4')]({'port':0x2329});var logger=require(_0x9e6e('0x5'))(_0x9e6e('0x6'));exports[_0x9e6e('0x7')]=function(_0x5f4c0b,_0x1f64e8){logger[_0x9e6e('0x7')](_0x5f4c0b,_0x1f64e8?util[_0x9e6e('0x8')](_0x1f64e8,{'showHidden':![],'depth':null}):'');};exports[_0x9e6e('0x9')]=function(_0x174aaa,_0x5eda3e){logger[_0x9e6e('0x9')](_0x174aaa,_0x5eda3e?util[_0x9e6e('0x8')](_0x5eda3e,{'showHidden':![],'depth':null}):'');};exports[_0x9e6e('0xa')]=function(_0x1470be,_0x1ce1b0){logger[_0x9e6e('0xa')](_0x1470be,_0x1ce1b0?util['inspect'](_0x1ce1b0,{'showHidden':![],'depth':null}):'');};exports[_0x9e6e('0xb')]=function(_0x40360d,_0x286351){return client[_0x9e6e('0xb')](_0x40360d,{'body':_0x286351})['then'](function(_0x175ca3){logger[_0x9e6e('0x9')]('[utils][request]\x20name:%s',_0x40360d,_0x175ca3?util[_0x9e6e('0x8')](_0x175ca3,{'showHidden':![],'depth':null}):'');})[_0x9e6e('0xc')](function(_0x1b85f1){logger[_0x9e6e('0xa')]('[utils][request]\x20name:%s',_0x40360d,_0x1b85f1?util[_0x9e6e('0x8')](_0x1b85f1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2bfcc2){return client[_0x9e6e('0xb')](_0x9e6e('0xd'),{'options':{'raw':!![],'attributes':['id',_0x9e6e('0xe'),_0x9e6e('0xf'),_0x9e6e('0x10')],'where':_0x2bfcc2,'limit':0x1}})[_0x9e6e('0x11')](function(_0x3080b1){logger[_0x9e6e('0x9')](_0x9e6e('0x12'),JSON[_0x9e6e('0x13')](_0x2bfcc2),_0x3080b1?util[_0x9e6e('0x8')](_0x3080b1,{'showHidden':![],'depth':null}):'');return _0x3080b1[_0x9e6e('0x14')][_0x9e6e('0x15')]?_0x3080b1[_0x9e6e('0x14')][0x0]:null;});}exports[_0x9e6e('0x16')]=function(_0x269f51){return new BPromise(function(_0xfd921e,_0x42b1aa){if(_0x269f51){return getUser({'internal':_0x269f51})[_0x9e6e('0x11')](function(_0x5a12de){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x269f51,_0x5a12de?_0x9e6e('0x17'):_0x9e6e('0x18'));return _0xfd921e(_0x5a12de);})[_0x9e6e('0xc')](function(_0x351201){logger[_0x9e6e('0xa')](_0x9e6e('0x19'),_0x351201?util[_0x9e6e('0x8')](_0x351201,{'showHidden':![],'depth':null}):'');return _0xfd921e(null);});}return _0xfd921e(null);});};exports[_0x9e6e('0x1a')]=function(_0x4e66e3){return new BPromise(function(_0x434aa3,_0x379da6){if(_0x4e66e3){return getUser({'interface':_0x4e66e3})[_0x9e6e('0x11')](function(_0x28ae35){logger[_0x9e6e('0x7')](_0x9e6e('0x1b'),_0x4e66e3,_0x28ae35?_0x9e6e('0x17'):'notfound');return _0x434aa3(_0x28ae35);})[_0x9e6e('0xc')](function(_0x4202cd){logger[_0x9e6e('0xa')](_0x9e6e('0x1c'),_0x4202cd?util['inspect'](_0x4202cd,{'showHidden':![],'depth':null}):'');return _0x434aa3(null);});}return _0x434aa3(null);});};exports['getUserByName']=function(_0x1e9b87){return new BPromise(function(_0xb7b794,_0x26e0be){if(_0x1e9b87){return getUser({'name':_0x1e9b87})['then'](function(_0x560815){logger[_0x9e6e('0x7')](_0x9e6e('0x1d'),_0x1e9b87,_0x560815?_0x9e6e('0x17'):_0x9e6e('0x18'));return _0xb7b794(_0x560815);})['catch'](function(_0x4d1616){logger[_0x9e6e('0xa')]('[utils][getUserByName]',_0x4d1616?util[_0x9e6e('0x8')](_0x4d1616,{'showHidden':![],'depth':null}):'');return _0xb7b794(null);});}return _0xb7b794(null);});};exports['getVoiceQueueByName']=function(_0x43b1bf){return new BPromise(function(_0x3130b8,_0x4a0c94){if(_0x43b1bf){return client[_0x9e6e('0xb')](_0x9e6e('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x9e6e('0xf'),_0x9e6e('0x1f'),'acw',_0x9e6e('0x20')],'where':{'name':_0x43b1bf},'limit':0x1}})['then'](function(_0x4b21fb){logger[_0x9e6e('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x43b1bf,_0x4b21fb?util[_0x9e6e('0x8')](_0x4b21fb,{'showHidden':![],'depth':null}):'');logger[_0x9e6e('0x7')](_0x9e6e('0x21'),_0x43b1bf,_0x4b21fb?_0x9e6e('0x17'):'notfound');return _0x3130b8(_0x4b21fb[_0x9e6e('0x14')]['length']?_0x4b21fb[_0x9e6e('0x14')][0x0]:null);})['catch'](function(_0x58fae9){logger[_0x9e6e('0xa')](_0x9e6e('0x22'),_0x58fae9?util[_0x9e6e('0x8')](_0x58fae9,{'showHidden':![],'depth':null}):'');return _0x3130b8(null);});}return _0x3130b8(null);});};exports['addTime']=function(_0x3ed6b3,_0x706be5){return moment(_0x3ed6b3)[_0x9e6e('0x23')](_0x706be5,'seconds')[_0x9e6e('0x24')](_0x9e6e('0x25'));};exports[_0x9e6e('0x26')]=function(_0x4d6c5d,_0x5d02fd){return moment(_0x4d6c5d)['subtract'](_0x5d02fd,_0x9e6e('0x27'))[_0x9e6e('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x9e6e('0x28')]=function(_0x5ba0b4,_0x533684){return moment(_0x5ba0b4)[_0x9e6e('0x29')](moment(_0x533684),_0x9e6e('0x27'));};exports[_0x9e6e('0x2a')]=function(_0x47a72d,_0xf16bbd){return parseInt(_0x47a72d,0xa)+parseInt(_0xf16bbd,0xa);};exports['now']=function(){return moment()['format'](_0x9e6e('0x25'));};exports[_0x9e6e('0x2b')]=function(_0x439e0c,_0x4c0e75){if(_0x4c0e75){return moment(_0x439e0c)[_0x9e6e('0x2b')](_0x4c0e75);}return!![];};exports[_0x9e6e('0x2c')]=function(_0x2a7b0a,_0xab8170){if(_0xab8170){return moment(_0x2a7b0a)[_0x9e6e('0x2c')](_0xab8170);}else if(_0x2a7b0a){return!![];}return![];}; \ No newline at end of file +var _0x6182=['xdr','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','[utils][getUserByInternal]','getUserByInterface','notfound','getUserByName','info','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger'];(function(_0x5403ec,_0x372801){var _0x413815=function(_0x2c8f60){while(--_0x2c8f60){_0x5403ec['push'](_0x5403ec['shift']());}};_0x413815(++_0x372801);}(_0x6182,0xc2));var _0x2618=function(_0x3b6fa1,_0x1c6605){_0x3b6fa1=_0x3b6fa1-0x0;var _0x109d05=_0x6182[_0x3b6fa1];return _0x109d05;};'use strict';var BPromise=require(_0x2618('0x0'));var jayson=require('jayson/promise');var moment=require(_0x2618('0x1'));var util=require(_0x2618('0x2'));var client=jayson[_0x2618('0x3')][_0x2618('0x4')]({'port':0x2329});var logger=require(_0x2618('0x5'))(_0x2618('0x6'));exports['info']=function(_0x4297c3,_0xea9d0b){logger['info'](_0x4297c3,_0xea9d0b?util[_0x2618('0x7')](_0xea9d0b,{'showHidden':![],'depth':null}):'');};exports[_0x2618('0x8')]=function(_0x4e943c,_0x681b45){logger[_0x2618('0x8')](_0x4e943c,_0x681b45?util[_0x2618('0x7')](_0x681b45,{'showHidden':![],'depth':null}):'');};exports[_0x2618('0x9')]=function(_0x3f1519,_0x4a13bc){logger[_0x2618('0x9')](_0x3f1519,_0x4a13bc?util[_0x2618('0x7')](_0x4a13bc,{'showHidden':![],'depth':null}):'');};exports[_0x2618('0xa')]=function(_0xeb95fd,_0x455cd1){return client[_0x2618('0xa')](_0xeb95fd,{'body':_0x455cd1})[_0x2618('0xb')](function(_0x4dd596){logger['debug'](_0x2618('0xc'),_0xeb95fd,_0x4dd596?util['inspect'](_0x4dd596,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x54e992){logger[_0x2618('0x9')](_0x2618('0xc'),_0xeb95fd,_0x54e992?util[_0x2618('0x7')](_0x54e992,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4351c3){return client[_0x2618('0xa')](_0x2618('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x2618('0xe'),_0x2618('0xf')],'where':_0x4351c3,'limit':0x1}})[_0x2618('0xb')](function(_0xb5c25){logger['debug'](_0x2618('0x10'),JSON[_0x2618('0x11')](_0x4351c3),_0xb5c25?util['inspect'](_0xb5c25,{'showHidden':![],'depth':null}):'');return _0xb5c25[_0x2618('0x12')]['length']?_0xb5c25[_0x2618('0x12')][0x0]:null;});}exports[_0x2618('0x13')]=function(_0x2cbd20){return new BPromise(function(_0x1ce172,_0x1e736c){if(_0x2cbd20){return getUser({'internal':_0x2cbd20})[_0x2618('0xb')](function(_0x3e22e2){logger['info'](_0x2618('0x14'),_0x2cbd20,_0x3e22e2?_0x2618('0x15'):'notfound');return _0x1ce172(_0x3e22e2);})[_0x2618('0x16')](function(_0x16b3d2){logger[_0x2618('0x9')](_0x2618('0x17'),_0x16b3d2?util[_0x2618('0x7')](_0x16b3d2,{'showHidden':![],'depth':null}):'');return _0x1ce172(null);});}return _0x1ce172(null);});};exports[_0x2618('0x18')]=function(_0x1ec344){return new BPromise(function(_0x506e6d,_0x3ea77b){if(_0x1ec344){return getUser({'interface':_0x1ec344})[_0x2618('0xb')](function(_0x7a6c77){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1ec344,_0x7a6c77?_0x2618('0x15'):_0x2618('0x19'));return _0x506e6d(_0x7a6c77);})[_0x2618('0x16')](function(_0xc27838){logger[_0x2618('0x9')]('[utils][getUserByInterface]',_0xc27838?util[_0x2618('0x7')](_0xc27838,{'showHidden':![],'depth':null}):'');return _0x506e6d(null);});}return _0x506e6d(null);});};exports[_0x2618('0x1a')]=function(_0x39c7b9){return new BPromise(function(_0x3cc51c,_0x358cc1){if(_0x39c7b9){return getUser({'name':_0x39c7b9})[_0x2618('0xb')](function(_0x4d5a75){logger[_0x2618('0x1b')](_0x2618('0x1c'),_0x39c7b9,_0x4d5a75?_0x2618('0x15'):_0x2618('0x19'));return _0x3cc51c(_0x4d5a75);})[_0x2618('0x16')](function(_0x575b20){logger['error'](_0x2618('0x1d'),_0x575b20?util[_0x2618('0x7')](_0x575b20,{'showHidden':![],'depth':null}):'');return _0x3cc51c(null);});}return _0x3cc51c(null);});};exports[_0x2618('0x1e')]=function(_0x1d9296){return new BPromise(function(_0x506fe8,_0x107341){if(_0x1d9296){return client['request'](_0x2618('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x2618('0xe'),'type',_0x2618('0x20'),_0x2618('0x21')],'where':{'name':_0x1d9296},'limit':0x1}})[_0x2618('0xb')](function(_0x1b3ff0){logger['debug'](_0x2618('0x22'),_0x1d9296,_0x1b3ff0?util['inspect'](_0x1b3ff0,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1d9296,_0x1b3ff0?_0x2618('0x15'):_0x2618('0x19'));return _0x506fe8(_0x1b3ff0['result'][_0x2618('0x23')]?_0x1b3ff0[_0x2618('0x12')][0x0]:null);})[_0x2618('0x16')](function(_0x3c071f){logger['error'](_0x2618('0x24'),_0x3c071f?util[_0x2618('0x7')](_0x3c071f,{'showHidden':![],'depth':null}):'');return _0x506fe8(null);});}return _0x506fe8(null);});};exports[_0x2618('0x25')]=function(_0x5ec21e,_0x517eaa){return moment(_0x5ec21e)[_0x2618('0x26')](_0x517eaa,_0x2618('0x27'))[_0x2618('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2618('0x29')]=function(_0x10fb8d,_0x1de2af){return moment(_0x10fb8d)[_0x2618('0x2a')](_0x1de2af,_0x2618('0x27'))[_0x2618('0x28')](_0x2618('0x2b'));};exports[_0x2618('0x2c')]=function(_0x3e7357,_0x54ab30){return moment(_0x3e7357)[_0x2618('0x2d')](moment(_0x54ab30),'seconds');};exports[_0x2618('0x2e')]=function(_0x50dc36,_0x259f99){return parseInt(_0x50dc36,0xa)+parseInt(_0x259f99,0xa);};exports[_0x2618('0x2f')]=function(){return moment()[_0x2618('0x28')](_0x2618('0x2b'));};exports[_0x2618('0x30')]=function(_0x536656,_0x4defaa){if(_0x4defaa){return moment(_0x536656)[_0x2618('0x30')](_0x4defaa);}return!![];};exports[_0x2618('0x31')]=function(_0x266cfc,_0x2fa880){if(_0x2fa880){return moment(_0x266cfc)[_0x2618('0x31')](_0x2fa880);}else if(_0x266cfc){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 2432889..3288d0a 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 _0xc23c=['isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','url','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','statusCode','responseTime','other','agent_name','test','setupLoggers','fs-extra','lodash','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s'];(function(_0x1410ad,_0x3e0c9c){var _0x57faa2=function(_0x25d2dc){while(--_0x25d2dc){_0x1410ad['push'](_0x1410ad['shift']());}};_0x57faa2(++_0x3e0c9c);}(_0xc23c,0xa5));var _0xcc23=function(_0x488bf1,_0x280f12){_0x488bf1=_0x488bf1-0x0;var _0x5839c4=_0xc23c[_0x488bf1];return _0x5839c4;};var fs=require(_0xcc23('0x0'));var _=require(_0xcc23('0x1'));var ewinston=require('express-winston');var path=require(_0xcc23('0x2'));var util=require(_0xcc23('0x3'));var fileLogger=require('./loggers')[_0xcc23('0x4')];var safeTemplate=require(_0xcc23('0x5'))[_0xcc23('0x6')];var maskSensitiveData=require(_0xcc23('0x7'))[_0xcc23('0x8')];function ClientSideLogger(){function _0x196a7f(_0x22af76){var _0x30f52a=path['join']('/var','log','xcally');var _0x59faad=path[_0xcc23('0x9')](_0xcc23('0xa'),_0x22af76[_0xcc23('0xb')]+'-'+_0x22af76[_0xcc23('0xc')]);return fs[_0xcc23('0xd')](path[_0xcc23('0x9')](_0x30f52a,_0x59faad))[_0xcc23('0xe')](function(){var _0x422196=fileLogger('client',path[_0xcc23('0x9')](_0x30f52a,_0x59faad));return _0x422196;})[_0xcc23('0xf')](function(_0x25ec77){throw _0x25ec77;});}this['log']=function(_0x546d8d,_0x1db793,_0x571ced,_0x18f006){return _0x196a7f(_0x546d8d[_0xcc23('0x10')])['then'](function(_0x3f9418){var _0x5c53af=_0x3f9418[_0x1db793];return _0x5c53af;})[_0xcc23('0xe')](function(_0x40190d){var _0x51664f=_0x546d8d[_0xcc23('0x10')]?_0x546d8d['user']['id']:_0xcc23('0x11');var _0x19cf8d=_0x18f006[_0xcc23('0x12')];var _0x76ba13=_0x18f006[_0xcc23('0x13')];var _0x471c10=new Date(Number(_0x76ba13));return _0x40190d(_0x51664f,_0x471c10,_0x571ced,_0x19cf8d);})[_0xcc23('0xf')](function(_0x2b2e18){fileLogger(_0xcc23('0xa'))[_0xcc23('0x14')](_0x2b2e18);});};}function setupLoggers(_0x36e547){return new Promise(function(_0x3b98e0){var _0x365700=new ClientSideLogger();var _0x5e56bc=fileLogger(_0xcc23('0x15'));var _0x47d351=fileLogger(_0xcc23('0x16'));_0x36e547[_0xcc23('0x17')](_0xcc23('0x18'),_0x365700);_0x36e547[_0xcc23('0x19')](ewinston['logger']({'winstonInstance':_0x5e56bc,'meta':![],'statusLevels':!![],'msg':function(_0x2dd25e,_0x43c727){var _0x3cf22c=_0xcc23('0x1a');if(!_[_0xcc23('0x1b')](_0x2dd25e['body'])){_0x3cf22c+='\x20body=%s';var _0x5d3a51=_0x2dd25e[_0xcc23('0x1c')];maskSensitiveData(_0x5d3a51);}return safeTemplate(util[_0xcc23('0x1d')](_0x3cf22c,_0x2dd25e['method'],_0x2dd25e[_0xcc23('0x1e')][_0xcc23('0x1f')]?_0x2dd25e[_0xcc23('0x1e')]['x-forwarded-for']:_0x2dd25e[_0xcc23('0x20')][_0xcc23('0x21')]||_0x2dd25e['ip'],_0x2dd25e[_0xcc23('0x22')],_0x43c727['statusCode'],_0x43c727['responseTime'],_0x2dd25e['user']?_0x2dd25e['user']['id']:null,_0x2dd25e[_0xcc23('0x10')]?_0x2dd25e[_0xcc23('0x10')]['name']:null,_0x2dd25e[_0xcc23('0x10')]?_0x2dd25e[_0xcc23('0x10')][_0xcc23('0xb')]:null,_0x5d3a51?util[_0xcc23('0x23')](_0x5d3a51,![],null):''));}}));_0x36e547['use'](ewinston[_0xcc23('0x24')]({'winstonInstance':_0x47d351,'meta':![],'statusLevels':!![],'msg':function(_0x3694b6,_0x3716c3){var _0x47db96=_0xcc23('0x25');if(_0x3694b6['body']&&_0x3694b6[_0xcc23('0x1c')][_0xcc23('0x26')]&&_0x3694b6[_0xcc23('0x1c')][_0xcc23('0x27')]){_0x47db96=_0xcc23('0x28');}return util[_0xcc23('0x1d')](_0x47db96,_0x3694b6[_0xcc23('0x29')],_0x3694b6[_0xcc23('0x1e')][_0xcc23('0x1f')]?_0x3694b6[_0xcc23('0x1e')][_0xcc23('0x1f')]:_0x3694b6[_0xcc23('0x20')][_0xcc23('0x21')]||_0x3694b6['ip'],_0x3694b6[_0xcc23('0x22')],_0x3716c3[_0xcc23('0x2a')],_0x3716c3[_0xcc23('0x2b')],_0x3694b6[_0xcc23('0x10')]?_0x3694b6[_0xcc23('0x10')]['id']:null,_0x3694b6[_0xcc23('0x10')]?_0x3694b6['user']['name']:null,_0x3694b6[_0xcc23('0x10')]?_0x3694b6['user'][_0xcc23('0xb')]:null,_0x3694b6['body']&&_0x3694b6['body']['device']?_0x3694b6[_0xcc23('0x1c')][_0xcc23('0x26')]:_0xcc23('0x2c'),_0x3694b6[_0xcc23('0x1c')]&&_0x3694b6[_0xcc23('0x1c')][_0xcc23('0x27')]?_0x3694b6[_0xcc23('0x1c')][_0xcc23('0x27')]:'',_0x3694b6[_0xcc23('0x1c')]&&_0x3694b6['body'][_0xcc23('0x2d')]?_0x3694b6[_0xcc23('0x1c')][_0xcc23('0x2d')]:'');},'ignoreRoute':function(_0x3fc607){var _0x2e4f69=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2e4f69[_0xcc23('0x2e')](_0x3fc607[_0xcc23('0x22')]);}}));return _0x3b98e0();});}exports[_0xcc23('0x2f')]=setupLoggers; \ No newline at end of file +var _0xb56d=['format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','logger','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','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','client','role','name','ensureDir','then','user','no-user','data','catch','error','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s'];(function(_0x285fff,_0x4fb54f){var _0x44e78f=function(_0x1b64c8){while(--_0x1b64c8){_0x285fff['push'](_0x285fff['shift']());}};_0x44e78f(++_0x4fb54f);}(_0xb56d,0x94));var _0xdb56=function(_0x33700d,_0x170236){_0x33700d=_0x33700d-0x0;var _0x18ddae=_0xb56d[_0x33700d];return _0x18ddae;};var fs=require('fs-extra');var _=require(_0xdb56('0x0'));var ewinston=require('express-winston');var path=require(_0xdb56('0x1'));var util=require(_0xdb56('0x2'));var fileLogger=require(_0xdb56('0x3'))[_0xdb56('0x4')];var safeTemplate=require(_0xdb56('0x5'))[_0xdb56('0x6')];var maskSensitiveData=require(_0xdb56('0x7'))[_0xdb56('0x8')];function ClientSideLogger(){function _0x50ba9f(_0x3b1fc5){var _0x1b3b13=path[_0xdb56('0x9')](_0xdb56('0xa'),'log','xcally');var _0x19a03b=path[_0xdb56('0x9')](_0xdb56('0xb'),_0x3b1fc5[_0xdb56('0xc')]+'-'+_0x3b1fc5[_0xdb56('0xd')]);return fs[_0xdb56('0xe')](path[_0xdb56('0x9')](_0x1b3b13,_0x19a03b))['then'](function(){var _0x1cec06=fileLogger(_0xdb56('0xb'),path[_0xdb56('0x9')](_0x1b3b13,_0x19a03b));return _0x1cec06;})['catch'](function(_0x358176){throw _0x358176;});}this['log']=function(_0x58210f,_0x4daa23,_0x4fc9b7,_0x30ec17){return _0x50ba9f(_0x58210f['user'])['then'](function(_0x19cc41){var _0xfd5af1=_0x19cc41[_0x4daa23];return _0xfd5af1;})[_0xdb56('0xf')](function(_0x34daaa){var _0x2adc0c=_0x58210f[_0xdb56('0x10')]?_0x58210f[_0xdb56('0x10')]['id']:_0xdb56('0x11');var _0x5ca960=_0x30ec17[_0xdb56('0x12')];var _0x1ffb3e=_0x30ec17['timestamp'];var _0x19ccb2=new Date(Number(_0x1ffb3e));return _0x34daaa(_0x2adc0c,_0x19ccb2,_0x4fc9b7,_0x5ca960);})[_0xdb56('0x13')](function(_0xc5f10f){fileLogger('client')[_0xdb56('0x14')](_0xc5f10f);});};}function setupLoggers(_0x41c52b){return new Promise(function(_0x2a5812){var _0x40925b=new ClientSideLogger();var _0x2ba717=fileLogger('api');var _0x5e2032=fileLogger('auth');_0x41c52b[_0xdb56('0x15')](_0xdb56('0x16'),_0x40925b);_0x41c52b[_0xdb56('0x17')](ewinston['logger']({'winstonInstance':_0x2ba717,'meta':![],'statusLevels':!![],'msg':function(_0xcd7ee4,_0x21663c){var _0x4bd206=_0xdb56('0x18');if(!_[_0xdb56('0x19')](_0xcd7ee4[_0xdb56('0x1a')])){_0x4bd206+=_0xdb56('0x1b');var _0x1b7357=_0xcd7ee4[_0xdb56('0x1a')];maskSensitiveData(_0x1b7357);}return safeTemplate(util[_0xdb56('0x1c')](_0x4bd206,_0xcd7ee4['method'],_0xcd7ee4[_0xdb56('0x1d')]['x-forwarded-for']?_0xcd7ee4['headers'][_0xdb56('0x1e')]:_0xcd7ee4[_0xdb56('0x1f')][_0xdb56('0x20')]||_0xcd7ee4['ip'],_0xcd7ee4[_0xdb56('0x21')],_0x21663c[_0xdb56('0x22')],_0x21663c[_0xdb56('0x23')],_0xcd7ee4['user']?_0xcd7ee4[_0xdb56('0x10')]['id']:null,_0xcd7ee4[_0xdb56('0x10')]?_0xcd7ee4[_0xdb56('0x10')][_0xdb56('0xd')]:null,_0xcd7ee4[_0xdb56('0x10')]?_0xcd7ee4[_0xdb56('0x10')][_0xdb56('0xc')]:null,_0x1b7357?util['inspect'](_0x1b7357,![],null):''));}}));_0x41c52b[_0xdb56('0x17')](ewinston[_0xdb56('0x24')]({'winstonInstance':_0x5e2032,'meta':![],'statusLevels':!![],'msg':function(_0x572f21,_0x11ca8d){var _0x5c9ac1='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x572f21[_0xdb56('0x1a')]&&_0x572f21[_0xdb56('0x1a')]['device']&&_0x572f21[_0xdb56('0x1a')][_0xdb56('0x25')]){_0x5c9ac1=_0xdb56('0x26');}return util[_0xdb56('0x1c')](_0x5c9ac1,_0x572f21['method'],_0x572f21['headers'][_0xdb56('0x1e')]?_0x572f21[_0xdb56('0x1d')]['x-forwarded-for']:_0x572f21[_0xdb56('0x1f')][_0xdb56('0x20')]||_0x572f21['ip'],_0x572f21[_0xdb56('0x21')],_0x11ca8d[_0xdb56('0x22')],_0x11ca8d[_0xdb56('0x23')],_0x572f21['user']?_0x572f21[_0xdb56('0x10')]['id']:null,_0x572f21['user']?_0x572f21[_0xdb56('0x10')][_0xdb56('0xd')]:null,_0x572f21[_0xdb56('0x10')]?_0x572f21[_0xdb56('0x10')]['role']:null,_0x572f21[_0xdb56('0x1a')]&&_0x572f21[_0xdb56('0x1a')][_0xdb56('0x27')]?_0x572f21[_0xdb56('0x1a')][_0xdb56('0x27')]:_0xdb56('0x28'),_0x572f21[_0xdb56('0x1a')]&&_0x572f21[_0xdb56('0x1a')][_0xdb56('0x25')]?_0x572f21['body']['agent_id']:'',_0x572f21[_0xdb56('0x1a')]&&_0x572f21[_0xdb56('0x1a')][_0xdb56('0x29')]?_0x572f21['body'][_0xdb56('0x29')]:'');},'ignoreRoute':function(_0x5a5b40){var _0x5841ea=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5841ea[_0xdb56('0x2a')](_0x5a5b40[_0xdb56('0x21')]);}}));return _0x2a5812();});}exports[_0xdb56('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 1a17a7f..828405a 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d97=['MMM','guess','test','isMoment','split','length','padStart','lodash','map','source','join','Interval\x20string\x20not\x20valid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','circularDoWInterval','exports','circularMonthInterval','clone','hours','minutes','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','daysInMonth','max','min','domCompare'];(function(_0x1c4d62,_0x53488b){var _0x329ee2=function(_0xf37ee7){while(--_0xf37ee7){_0x1c4d62['push'](_0x1c4d62['shift']());}};_0x329ee2(++_0x53488b);}(_0x4d97,0x93));var _0x74d9=function(_0x356f0f,_0x506500){_0x356f0f=_0x356f0f-0x0;var _0x19ac8b=_0x4d97[_0x356f0f];return _0x19ac8b;};var _=require(_0x74d9('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x74d9('0x1')](function(_0x4c5cdc){return _0x4c5cdc[_0x74d9('0x2')];})[_0x74d9('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x74d9('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x2e1bf4){if(!_0x2e1bf4['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x151dda){var _0x76aab9=_0x151dda['split'](':')[_0x74d9('0x1')](function(_0x22d7ac){return parseInt(_0x22d7ac,0xa);});var _0x13ec10=_0x76aab9[0x0];var _0x4638be=_0x76aab9[0x1];if(_0x13ec10<0x0||_0x13ec10>0x17||_0x4638be<0x0||_0x4638be>0x3b){throw new Error(EINVALID_DATE);}return[_0x13ec10,_0x4638be];}function circularDoWInterval(_0x2ec6fb,_0x52b695){if(_0x2ec6fb===_0x52b695){return[_0x2ec6fb];}else{var _0x4a5cca=moment[_0x74d9('0x5')]();moment['locale']('en');var _0x402c9e=moment[_0x74d9('0x6')]()[_0x74d9('0x1')](function(_0x3812cd){return _0x3812cd[_0x74d9('0x7')]();});moment[_0x74d9('0x5')](_0x4a5cca);var _0xbb6e54=_0x402c9e[_0x74d9('0x8')](_0x2ec6fb);var _0x11350a=_0x402c9e[_0x74d9('0x8')](_0x52b695);if(_0x11350a>_0xbb6e54){return _0x402c9e[_0x74d9('0x9')](_0xbb6e54,_0x11350a+0x1);}else{var _0x57a7c4=_0x402c9e['slice'](0x0,_0x11350a+0x1);var _0xc286fb=_0x402c9e[_0x74d9('0x9')](_0xbb6e54);return _0xc286fb[_0x74d9('0xa')](_0x57a7c4);}}}module['exports'][_0x74d9('0xb')]=circularDoWInterval;function circularMonthInterval(_0x12c2e5,_0x5ae9d0){if(_0x12c2e5===_0x5ae9d0){return[_0x12c2e5];}else{var _0x18bcd5=moment[_0x74d9('0x5')]();moment[_0x74d9('0x5')]('en');var _0x5898b7=moment['monthsShort']()[_0x74d9('0x1')](function(_0x5dea52){return _0x5dea52[_0x74d9('0x7')]();});moment[_0x74d9('0x5')](_0x18bcd5);var _0x1e1338=_0x5898b7[_0x74d9('0x8')](_0x12c2e5);var _0x458157=_0x5898b7[_0x74d9('0x8')](_0x5ae9d0);if(_0x458157>_0x1e1338){return _0x5898b7[_0x74d9('0x9')](_0x1e1338,_0x458157+0x1);}else{var _0x19b515=_0x5898b7[_0x74d9('0x9')](0x0,_0x458157+0x1);var _0x1887d7=_0x5898b7['slice'](_0x1e1338);return _0x1887d7[_0x74d9('0xa')](_0x19b515);}}}module[_0x74d9('0xc')][_0x74d9('0xd')]=circularMonthInterval;function parseDom(_0x438608){var _0x3e9586=parseInt(_0x438608,0xa);if(_0x3e9586<0x1||_0x3e9586>0x1f){throw new Error(EINVALID_DATE);}return _0x3e9586;}function timeCompare(_0x55bfd9,_0x5c35a5,_0x3368ed){var _0x56af03=_0x55bfd9[_0x74d9('0xe')]();var _0xfe5375=extractTime(_0x5c35a5);var _0x3961a5=_0xfe5375[0x0];var _0x3df2f4=_0xfe5375[0x1];var _0x95147a=_0x55bfd9[_0x74d9('0xe')]()[_0x74d9('0xf')](_0x3961a5)['minutes'](_0x3df2f4);throwIfDateNotValid(_0x95147a);var _0x142085=extractTime(_0x3368ed);var _0x3684af=_0x142085[0x0];var _0x57bdcf=_0x142085[0x1];var _0x5d78ac=_0x55bfd9['clone']()['hours'](_0x3684af)[_0x74d9('0x10')](_0x57bdcf);throwIfDateNotValid(_0x5d78ac);if(_0x5d78ac['isBefore'](_0x95147a)){var _0x42e556=_0x56af03[_0x74d9('0xe')]()['startOf'](_0x74d9('0x11'));var _0x3a2d3b=_0x56af03['clone']()[_0x74d9('0x12')](_0x74d9('0x11'));return _0x56af03[_0x74d9('0x13')](_0x95147a,_0x3a2d3b,undefined,'[]')||_0x56af03[_0x74d9('0x13')](_0x42e556,_0x5d78ac,undefined,'[]');}else{return _0x56af03[_0x74d9('0x13')](_0x95147a,_0x5d78ac,undefined,'[]');}}module[_0x74d9('0xc')][_0x74d9('0x14')]=timeCompare;function dowCompare(_0x1ddbc4,_0x318553,_0x20ee5d){var _0x208367=_0x1ddbc4[_0x74d9('0x5')]('en')['format'](_0x74d9('0x15'))[_0x74d9('0x7')]();return circularDoWInterval(_0x318553,_0x20ee5d)[_0x74d9('0x16')](_0x208367);}module[_0x74d9('0xc')][_0x74d9('0x17')]=dowCompare;function domCompare(_0x4621f4,_0x3f75ec,_0x2d1d59){var _0x127157=_0x4621f4['date']();if(_0x3f75ec===_0x2d1d59){return _0x127157===_0x3f75ec;}else{var _0x3875f4=_0x4621f4[_0x74d9('0x18')]();var _0x2512e6=_0x3f75ec<_0x2d1d59;let _0x1dd3f6=![];var _0x341de7=0x0;var _0x321766=0x0;if(_0x2512e6){_0x341de7=Math[_0x74d9('0x19')](0x1,_0x3f75ec);_0x321766=Math[_0x74d9('0x1a')](_0x2d1d59,_0x3875f4);_0x1dd3f6=_0x127157>=_0x341de7&&_0x127157<=_0x321766;}else{_0x341de7=Math[_0x74d9('0x1a')](_0x3f75ec,_0x3875f4);_0x321766=Math[_0x74d9('0x19')](0x1,_0x2d1d59);_0x1dd3f6=_0x127157>=_0x341de7||_0x127157<=_0x321766;}return _0x1dd3f6;}}module[_0x74d9('0xc')][_0x74d9('0x1b')]=domCompare;function monthCompare(_0x1fb629,_0x2d8786,_0x1cb100){var _0x269b67=_0x1fb629[_0x74d9('0x5')]('en')['format'](_0x74d9('0x1c'))[_0x74d9('0x7')]();return circularMonthInterval(_0x2d8786,_0x1cb100)[_0x74d9('0x16')](_0x269b67);}module[_0x74d9('0xc')]['monthCompare']=monthCompare;function iftime(_0x631bdb,_0x53f685=moment['tz'][_0x74d9('0x1d')](),_0x1f9748=moment()){if(!validateRx[_0x74d9('0x1e')](_0x631bdb)){throw new Error(EINVALID_STRING);}else{var _0x6fdd3c=(moment[_0x74d9('0x1f')](_0x1f9748)?_0x1f9748[_0x74d9('0xe')]():moment(_0x1f9748))['tz'](_0x53f685)['locale']('en');throwIfDateNotValid(_0x6fdd3c);var _0x5671d0=_0x631bdb[_0x74d9('0x20')](',');var _0x2eb435=_0x5671d0[0x0];var _0x494ba5=_0x5671d0[0x1];var _0x1f15e8=_0x5671d0[0x2];var _0x27e243=_0x5671d0[0x3];let _0x48975e=!![];if(_0x2eb435!=='*'){var _0x145be9=_0x2eb435[_0x74d9('0x20')]('-');var _0x61c4ec=_['padStart'](_0x145be9[0x0],0x5,'0');var _0x23babe=_0x145be9[_0x74d9('0x21')]===0x2?_[_0x74d9('0x22')](_0x145be9[0x1],0x5,'0'):_0x61c4ec;_0x48975e=timeCompare(_0x6fdd3c,_0x61c4ec,_0x23babe);}let _0x21facc=!![];if(_0x494ba5!=='*'){var _0x90be49=_0x494ba5[_0x74d9('0x20')]('-');var _0x4625b3=_0x90be49[0x0];var _0x554fb2=_0x90be49[_0x74d9('0x21')]===0x2?_0x90be49[0x1]:_0x4625b3;_0x21facc=dowCompare(_0x6fdd3c,_0x4625b3,_0x554fb2);}let _0x31454b=!![];if(_0x1f15e8!=='*'){var _0x3dd408=_0x1f15e8['split']('-');var _0x52f8df=parseDom(_0x3dd408[0x0]);var _0x333807=_0x3dd408[_0x74d9('0x21')]===0x2?parseDom(_0x3dd408[0x1]):_0x52f8df;_0x31454b=domCompare(_0x6fdd3c,_0x52f8df,_0x333807);}let _0x4da95c=!![];if(_0x27e243!=='*'){var _0x16699d=_0x27e243[_0x74d9('0x20')]('-');var _0x16a404=_0x16699d[0x0];var _0x96520d=_0x16699d[_0x74d9('0x21')]===0x2?_0x16699d[0x1]:_0x16699d[0x0];_0x4da95c=monthCompare(_0x6fdd3c,_0x16a404,_0x96520d);}return _0x48975e&&_0x21facc&&_0x31454b&&_0x4da95c;}}module[_0x74d9('0xc')]['iftime']=iftime; \ No newline at end of file +var _0x46cf=['hours','startOf','day','isBetween','timeCompare','format','date','daysInMonth','max','min','domCompare','MMM','includes','monthCompare','guess','test','padStart','length','iftime','map','source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone'];(function(_0x41798c,_0x537bad){var _0xebbfc7=function(_0x1d17bb){while(--_0x1d17bb){_0x41798c['push'](_0x41798c['shift']());}};_0xebbfc7(++_0x537bad);}(_0x46cf,0x9f));var _0xf46c=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x46cf[_0xef8146];return _0x5a6cb0;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xf46c('0x0')](function(_0xc4783){return _0xc4783[_0xf46c('0x1')];})[_0xf46c('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xf46c('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x58be9f){if(!_0x58be9f[_0xf46c('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x121a81){var _0x3edd8b=_0x121a81[_0xf46c('0x5')](':')[_0xf46c('0x0')](function(_0x5e5ab2){return parseInt(_0x5e5ab2,0xa);});var _0x47e8da=_0x3edd8b[0x0];var _0x5acb8f=_0x3edd8b[0x1];if(_0x47e8da<0x0||_0x47e8da>0x17||_0x5acb8f<0x0||_0x5acb8f>0x3b){throw new Error(EINVALID_DATE);}return[_0x47e8da,_0x5acb8f];}function circularDoWInterval(_0x214ec4,_0xfbf961){if(_0x214ec4===_0xfbf961){return[_0x214ec4];}else{var _0x7539ab=moment[_0xf46c('0x6')]();moment[_0xf46c('0x6')]('en');var _0x1f6182=moment['weekdaysShort']()['map'](function(_0x5c24e6){return _0x5c24e6[_0xf46c('0x7')]();});moment[_0xf46c('0x6')](_0x7539ab);var _0x30204f=_0x1f6182[_0xf46c('0x8')](_0x214ec4);var _0x57be3c=_0x1f6182[_0xf46c('0x8')](_0xfbf961);if(_0x57be3c>_0x30204f){return _0x1f6182[_0xf46c('0x9')](_0x30204f,_0x57be3c+0x1);}else{var _0x12be2a=_0x1f6182['slice'](0x0,_0x57be3c+0x1);var _0x5053ab=_0x1f6182['slice'](_0x30204f);return _0x5053ab[_0xf46c('0xa')](_0x12be2a);}}}module[_0xf46c('0xb')][_0xf46c('0xc')]=circularDoWInterval;function circularMonthInterval(_0x349caa,_0x283a6b){if(_0x349caa===_0x283a6b){return[_0x349caa];}else{var _0x2d1644=moment['locale']();moment[_0xf46c('0x6')]('en');var _0x2fe35e=moment[_0xf46c('0xd')]()['map'](function(_0x347615){return _0x347615[_0xf46c('0x7')]();});moment[_0xf46c('0x6')](_0x2d1644);var _0x1043f0=_0x2fe35e[_0xf46c('0x8')](_0x349caa);var _0x322a1f=_0x2fe35e[_0xf46c('0x8')](_0x283a6b);if(_0x322a1f>_0x1043f0){return _0x2fe35e['slice'](_0x1043f0,_0x322a1f+0x1);}else{var _0x1a904d=_0x2fe35e[_0xf46c('0x9')](0x0,_0x322a1f+0x1);var _0x3b9946=_0x2fe35e['slice'](_0x1043f0);return _0x3b9946['concat'](_0x1a904d);}}}module[_0xf46c('0xb')][_0xf46c('0xe')]=circularMonthInterval;function parseDom(_0x5d18c4){var _0x559726=parseInt(_0x5d18c4,0xa);if(_0x559726<0x1||_0x559726>0x1f){throw new Error(EINVALID_DATE);}return _0x559726;}function timeCompare(_0x2723c1,_0x32bbbe,_0x4b6bf3){var _0x291ae4=_0x2723c1['clone']();var _0x327629=extractTime(_0x32bbbe);var _0x11f2d2=_0x327629[0x0];var _0x5ec52c=_0x327629[0x1];var _0x56da3e=_0x2723c1[_0xf46c('0xf')]()['hours'](_0x11f2d2)['minutes'](_0x5ec52c);throwIfDateNotValid(_0x56da3e);var _0x19d357=extractTime(_0x4b6bf3);var _0x3f3020=_0x19d357[0x0];var _0x2ab1aa=_0x19d357[0x1];var _0x3a87e4=_0x2723c1[_0xf46c('0xf')]()[_0xf46c('0x10')](_0x3f3020)['minutes'](_0x2ab1aa);throwIfDateNotValid(_0x3a87e4);if(_0x3a87e4['isBefore'](_0x56da3e)){var _0x552f06=_0x291ae4[_0xf46c('0xf')]()[_0xf46c('0x11')](_0xf46c('0x12'));var _0x5cc12c=_0x291ae4[_0xf46c('0xf')]()['endOf'](_0xf46c('0x12'));return _0x291ae4[_0xf46c('0x13')](_0x56da3e,_0x5cc12c,undefined,'[]')||_0x291ae4[_0xf46c('0x13')](_0x552f06,_0x3a87e4,undefined,'[]');}else{return _0x291ae4[_0xf46c('0x13')](_0x56da3e,_0x3a87e4,undefined,'[]');}}module['exports'][_0xf46c('0x14')]=timeCompare;function dowCompare(_0x5f4a06,_0x35651a,_0x4efccf){var _0x11e6fd=_0x5f4a06[_0xf46c('0x6')]('en')[_0xf46c('0x15')]('ddd')[_0xf46c('0x7')]();return circularDoWInterval(_0x35651a,_0x4efccf)['includes'](_0x11e6fd);}module[_0xf46c('0xb')]['dowCompare']=dowCompare;function domCompare(_0x5f5d07,_0x38515a,_0x1c75a9){var _0x59c165=_0x5f5d07[_0xf46c('0x16')]();if(_0x38515a===_0x1c75a9){return _0x59c165===_0x38515a;}else{var _0x508a3b=_0x5f5d07[_0xf46c('0x17')]();var _0x34af63=_0x38515a<_0x1c75a9;let _0x5a08e0=![];var _0x4daed0=0x0;var _0x3cab11=0x0;if(_0x34af63){_0x4daed0=Math[_0xf46c('0x18')](0x1,_0x38515a);_0x3cab11=Math[_0xf46c('0x19')](_0x1c75a9,_0x508a3b);_0x5a08e0=_0x59c165>=_0x4daed0&&_0x59c165<=_0x3cab11;}else{_0x4daed0=Math[_0xf46c('0x19')](_0x38515a,_0x508a3b);_0x3cab11=Math[_0xf46c('0x18')](0x1,_0x1c75a9);_0x5a08e0=_0x59c165>=_0x4daed0||_0x59c165<=_0x3cab11;}return _0x5a08e0;}}module[_0xf46c('0xb')][_0xf46c('0x1a')]=domCompare;function monthCompare(_0x4e02de,_0x2d6d28,_0x494a35){var _0x25726c=_0x4e02de[_0xf46c('0x6')]('en')['format'](_0xf46c('0x1b'))[_0xf46c('0x7')]();return circularMonthInterval(_0x2d6d28,_0x494a35)[_0xf46c('0x1c')](_0x25726c);}module[_0xf46c('0xb')][_0xf46c('0x1d')]=monthCompare;function iftime(_0x20ac9a,_0x1e8bb9=moment['tz'][_0xf46c('0x1e')](),_0x1c6368=moment()){if(!validateRx[_0xf46c('0x1f')](_0x20ac9a)){throw new Error(EINVALID_STRING);}else{var _0x56ceec=(moment['isMoment'](_0x1c6368)?_0x1c6368['clone']():moment(_0x1c6368))['tz'](_0x1e8bb9)[_0xf46c('0x6')]('en');throwIfDateNotValid(_0x56ceec);var _0x41a9cc=_0x20ac9a[_0xf46c('0x5')](',');var _0x191499=_0x41a9cc[0x0];var _0x4fe81f=_0x41a9cc[0x1];var _0x30c43a=_0x41a9cc[0x2];var _0x5766fc=_0x41a9cc[0x3];let _0x105f2d=!![];if(_0x191499!=='*'){var _0xc9e3b4=_0x191499[_0xf46c('0x5')]('-');var _0x4e9d52=_[_0xf46c('0x20')](_0xc9e3b4[0x0],0x5,'0');var _0x117c35=_0xc9e3b4['length']===0x2?_[_0xf46c('0x20')](_0xc9e3b4[0x1],0x5,'0'):_0x4e9d52;_0x105f2d=timeCompare(_0x56ceec,_0x4e9d52,_0x117c35);}let _0x4c0868=!![];if(_0x4fe81f!=='*'){var _0x176a45=_0x4fe81f['split']('-');var _0xa0ad0e=_0x176a45[0x0];var _0x142ddb=_0x176a45[_0xf46c('0x21')]===0x2?_0x176a45[0x1]:_0xa0ad0e;_0x4c0868=dowCompare(_0x56ceec,_0xa0ad0e,_0x142ddb);}let _0x2d1b4c=!![];if(_0x30c43a!=='*'){var _0x27ac1e=_0x30c43a[_0xf46c('0x5')]('-');var _0x46964d=parseDom(_0x27ac1e[0x0]);var _0x23ad73=_0x27ac1e[_0xf46c('0x21')]===0x2?parseDom(_0x27ac1e[0x1]):_0x46964d;_0x2d1b4c=domCompare(_0x56ceec,_0x46964d,_0x23ad73);}let _0x113239=!![];if(_0x5766fc!=='*'){var _0x3c9b5c=_0x5766fc[_0xf46c('0x5')]('-');var _0x21fa3b=_0x3c9b5c[0x0];var _0x4b3aeb=_0x3c9b5c['length']===0x2?_0x3c9b5c[0x1]:_0x3c9b5c[0x0];_0x113239=monthCompare(_0x56ceec,_0x21fa3b,_0x4b3aeb);}return _0x105f2d&&_0x4c0868&&_0x2d1b4c&&_0x113239;}}module[_0xf46c('0xb')][_0xf46c('0x22')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ec2eb93..265f704 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3d2=['info','redBG\x20white','bold\x20yellow','white','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','error','%s-%s','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase'];(function(_0x54ea43,_0x89783f){var _0x40b855=function(_0x494fa9){while(--_0x494fa9){_0x54ea43['push'](_0x54ea43['shift']());}};_0x40b855(++_0x89783f);}(_0xa3d2,0x1cd));var _0x2a3d=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xa3d2[_0x2fbcf6];return _0x3e7265;};'use strict';var path=require(_0x2a3d('0x0'));var util=require(_0x2a3d('0x1'));var moment=require(_0x2a3d('0x2'));var winston=require(_0x2a3d('0x3'));var config=require(_0x2a3d('0x4'));var debugLevel=config[_0x2a3d('0x5')]?config[_0x2a3d('0x5')][_0x2a3d('0x6')]():_0x2a3d('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x2a3d('0x8'),'error':'red','warn':_0x2a3d('0x9'),'info':_0x2a3d('0xa'),'print':'bold\x20white','success':'bold\x20green','http':'gray','verbose':'bold\x20magenta','debug':_0x2a3d('0xb'),'silly':_0x2a3d('0xc')};winston[_0x2a3d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x4a4a93,_0x3daa3c,_0x37c2ef){var _0x4cfd12=_0x4a4a93||_0x2a3d('0xe');return path[_0x2a3d('0xf')](_0x4cfd12,util[_0x2a3d('0x10')](_0x2a3d('0x11'),_0x3daa3c,_0x37c2ef));}function formatter(_0x14c096,_0x149caf){_0x149caf[_0x2a3d('0x12')]=_0x149caf[_0x2a3d('0x12')][_0x2a3d('0x13')](/@@{/g,'{{{')[_0x2a3d('0x13')](/}@@/g,_0x2a3d('0x14'))['replace'](/@{/g,'{{')[_0x2a3d('0x13')](/}@/g,'}}');return util[_0x2a3d('0x10')](_0x2a3d('0x15'),moment()['format'](_0x2a3d('0x16')),_0x149caf[_0x2a3d('0x17')][_0x2a3d('0x18')](),_0x14c096,_0x149caf[_0x2a3d('0x12')]);}function fileFormat(_0x181f4d,_0x4881da){_0x4881da[_0x2a3d('0x12')]=_0x4881da[_0x2a3d('0x12')][_0x2a3d('0x13')](/@@{/g,_0x2a3d('0x19'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x40b803=_0x4881da['meta']&&Object[_0x2a3d('0x1a')](_0x4881da[_0x2a3d('0x1b')])[_0x2a3d('0x1c')]?'\x0a\x09'+JSON[_0x2a3d('0x1d')](_0x4881da[_0x2a3d('0x1b')]):'';return util[_0x2a3d('0x10')](_0x2a3d('0x1e'),moment()['format'](_0x2a3d('0x16')),_0x4881da[_0x2a3d('0x17')]['toUpperCase'](),_0x181f4d,_0x4881da[_0x2a3d('0x12')],_0x40b803);}function consoleLogger(){var _0x5e74f6=new winston[(_0x2a3d('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2a3d('0x20'))][(_0x2a3d('0x21'))]({'level':_0x2a3d('0x22'),'json':![],'formatter':function(_0x18675a){return formatter('',_0x18675a);}})]});return _0x5e74f6;}function fileLogger(_0x3a0e2a,_0x43867a){var _0x41bd57=new winston[(_0x2a3d('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2a3d('0x20'))]['File']({'name':util['format']('%s-%s',_0x3a0e2a,_0x2a3d('0x23')),'filename':getLogFileName(_0x43867a,_0x3a0e2a,_0x2a3d('0x23')),'level':_0x2a3d('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7b1309){return fileFormat(_0x3a0e2a,_0x7b1309);}}),new winston[(_0x2a3d('0x20'))]['File']({'name':util[_0x2a3d('0x10')](_0x2a3d('0x24'),_0x3a0e2a,debugLevel),'filename':getLogFileName(_0x43867a,_0x3a0e2a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x23f57b){return fileFormat(_0x3a0e2a,_0x23f57b);}}),new winston['transports']['Console']({'level':_0x2a3d('0x22'),'json':![],'formatter':function(_0x27fd1a){return fileFormat(_0x3a0e2a,_0x27fd1a);}})]});return _0x41bd57;}exports[_0x2a3d('0x25')]=consoleLogger;exports[_0x2a3d('0x26')]=fileLogger; \ No newline at end of file +var _0x775d=['util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','Console','warn','File','%s-%s','error','transports','consoleLogger','path'];(function(_0xc01fd5,_0x54fdba){var _0x1ecf5e=function(_0x4c17b7){while(--_0x4c17b7){_0xc01fd5['push'](_0xc01fd5['shift']());}};_0x1ecf5e(++_0x54fdba);}(_0x775d,0x137));var _0xd775=function(_0x4ce827,_0x1ecc69){_0x4ce827=_0x4ce827-0x0;var _0x45e251=_0x775d[_0x4ce827];return _0x45e251;};'use strict';var path=require(_0xd775('0x0'));var util=require(_0xd775('0x1'));var moment=require(_0xd775('0x2'));var winston=require(_0xd775('0x3'));var config=require('../config/environment');var debugLevel=config[_0xd775('0x4')]?config['debugLevel'][_0xd775('0x5')]():_0xd775('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':_0xd775('0x7'),'error':_0xd775('0x8'),'warn':'bold\x20yellow','info':_0xd775('0x9'),'print':_0xd775('0xa'),'success':'bold\x20green','http':_0xd775('0xb'),'verbose':_0xd775('0xc'),'debug':_0xd775('0xd'),'silly':_0xd775('0xe')};winston[_0xd775('0xf')](XC_LOG_COLORS);function getLogFileName(_0x34b174,_0x3808b6,_0x1d6a2b){var _0x3d2adf=_0x34b174||_0xd775('0x10');return path[_0xd775('0x11')](_0x3d2adf,util[_0xd775('0x12')](_0xd775('0x13'),_0x3808b6,_0x1d6a2b));}function formatter(_0x1e6b73,_0x2176b0){_0x2176b0[_0xd775('0x14')]=_0x2176b0[_0xd775('0x14')][_0xd775('0x15')](/@@{/g,_0xd775('0x16'))['replace'](/}@@/g,'}}}')[_0xd775('0x15')](/@{/g,'{{')[_0xd775('0x15')](/}@/g,'}}');return util[_0xd775('0x12')](_0xd775('0x17'),moment()[_0xd775('0x12')](_0xd775('0x18')),_0x2176b0[_0xd775('0x19')]['toUpperCase'](),_0x1e6b73,_0x2176b0['message']);}function fileFormat(_0x1fbcac,_0x1ac861){_0x1ac861[_0xd775('0x14')]=_0x1ac861[_0xd775('0x14')][_0xd775('0x15')](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0xd775('0x15')](/@{/g,'{{')[_0xd775('0x15')](/}@/g,'}}');var _0x19d564=_0x1ac861[_0xd775('0x1a')]&&Object['keys'](_0x1ac861[_0xd775('0x1a')])[_0xd775('0x1b')]?'\x0a\x09'+JSON[_0xd775('0x1c')](_0x1ac861[_0xd775('0x1a')]):'';return util[_0xd775('0x12')](_0xd775('0x1d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x1ac861[_0xd775('0x19')][_0xd775('0x1e')](),_0x1fbcac,_0x1ac861['message'],_0x19d564);}function consoleLogger(){var _0x27e1d6=new winston[(_0xd775('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xd775('0x20'))]({'level':_0xd775('0x21'),'json':![],'formatter':function(_0x526c09){return formatter('',_0x526c09);}})]});return _0x27e1d6;}function fileLogger(_0x3b71e3,_0x4c5460){var _0x6d1997=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xd775('0x22'))]({'name':util[_0xd775('0x12')](_0xd775('0x23'),_0x3b71e3,_0xd775('0x24')),'filename':getLogFileName(_0x4c5460,_0x3b71e3,_0xd775('0x24')),'level':_0xd775('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ecf9e){return fileFormat(_0x3b71e3,_0x5ecf9e);}}),new winston[(_0xd775('0x25'))][(_0xd775('0x22'))]({'name':util[_0xd775('0x12')](_0xd775('0x23'),_0x3b71e3,debugLevel),'filename':getLogFileName(_0x4c5460,_0x3b71e3,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28fb39){return fileFormat(_0x3b71e3,_0x28fb39);}}),new winston[(_0xd775('0x25'))][(_0xd775('0x20'))]({'level':_0xd775('0x21'),'json':![],'formatter':function(_0x250e5b){return fileFormat(_0x3b71e3,_0x250e5b);}})]});return _0x6d1997;}exports[_0xd775('0x26')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 54dad78..436de92 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 _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x4975,0x86));var _0x5497=function(_0x10fbd4,_0x39c5b4){_0x10fbd4=_0x10fbd4-0x0;var _0x100b9e=_0x4975[_0x10fbd4];return _0x100b9e;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x0295,0x1f0));var _0x5029=function(_0x28f5cb,_0x37fadc){_0x28f5cb=_0x28f5cb-0x0;var _0x27cd13=_0x0295[_0x28f5cb];return _0x27cd13;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 0e6a7e0..de1b490 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['replace','\x5c$&'];(function(_0x1ffa5f,_0x1901d8){var _0x145c24=function(_0x151112){while(--_0x151112){_0x1ffa5f['push'](_0x1ffa5f['shift']());}};_0x145c24(++_0x1901d8);}(_0x1261,0x144));var _0x1126=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0x1261[_0x19aa84];return _0x536146;};module['exports']={'escapeRegExp'(_0x234ea5,_0x26c6a0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x234ea5[_0x1126('0x0')](_0x26c6a0,_0x1126('0x1'));}}; \ No newline at end of file +var _0xc4aa=['\x5c$&','exports','replace'];(function(_0x497c94,_0x56abb5){var _0x6b3db9=function(_0x13db2a){while(--_0x13db2a){_0x497c94['push'](_0x497c94['shift']());}};_0x6b3db9(++_0x56abb5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};module[_0xac4a('0x0')]={'escapeRegExp'(_0x5a86db,_0x40a0d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x5a86db[_0xac4a('0x1')](_0x40a0d0,_0xac4a('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 970d3fd..f1a7b31 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 _0x0972=['safeTemplate','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x3f7dc4,_0x576779){var _0x23aee2=function(_0x543b4d){while(--_0x543b4d){_0x3f7dc4['push'](_0x3f7dc4['shift']());}};_0x23aee2(++_0x576779);}(_0x0972,0x64));var _0x2097=function(_0x152181,_0x37a7bf){_0x152181=_0x152181-0x0;var _0xc1e93=_0x0972[_0x152181];return _0xc1e93;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1591ae){return _0x1591ae==='{{'?'{\x20{\x20':_0x2097('0x0');}function safeTemplate(_0x4ec7aa){var _0x36912c=_0x4ec7aa;if(typeof _0x4ec7aa===_0x2097('0x1')){_0x36912c=_0x4ec7aa['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2097('0x2')](_0x4ec7aa)){_0x36912c=_0x4ec7aa[_0x2097('0x3')](function(_0xe6fbae){return safeTemplate(_0xe6fbae);});}else if(_[_0x2097('0x4')](_0x4ec7aa)){_0x36912c=Object[_0x2097('0x5')](_0x4ec7aa)[_0x2097('0x6')](function(_0x2b4f21,_0x59739f){_0x2b4f21[_0x59739f]=safeTemplate(_0x4ec7aa[_0x59739f]);return _0x2b4f21;},{});}return _0x36912c;}module[_0x2097('0x7')][_0x2097('0x8')]=safeTemplate; \ No newline at end of file +var _0x5f66=['\x20}\x20}','string','replace','map','isPlainObject','keys','exports','safeTemplate'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x61c60c){return _0x61c60c==='{{'?'{\x20{\x20':_0x65f6('0x0');}function safeTemplate(_0x2f06ae){var _0x3461cd=_0x2f06ae;if(typeof _0x2f06ae===_0x65f6('0x1')){_0x3461cd=_0x2f06ae[_0x65f6('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x2f06ae)){_0x3461cd=_0x2f06ae[_0x65f6('0x3')](function(_0x5150c8){return safeTemplate(_0x5150c8);});}else if(_[_0x65f6('0x4')](_0x2f06ae)){_0x3461cd=Object[_0x65f6('0x5')](_0x2f06ae)['reduce'](function(_0x4ed98f,_0x1c0e12){_0x4ed98f[_0x1c0e12]=safeTemplate(_0x2f06ae[_0x1c0e12]);return _0x4ed98f;},{});}return _0x3461cd;}module[_0x65f6('0x6')][_0x65f6('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 308fdee..a4e186d 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 _0x3614=['apps','findIndex','name','motion2','NODE_PATH','env','pathExists','then','readJSON','updated','info','writeJSON','exports','fs-extra','../config/environment','root','resolve','legacy-libs','isArray'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3614,0xf1));var _0x4361=function(_0x7a953c,_0x2099ec){_0x7a953c=_0x7a953c-0x0;var _0xe0060d=_0x3614[_0x7a953c];return _0xe0060d;};var fs=require(_0x4361('0x0'));var path=require('path');var config=require(_0x4361('0x1'));var root=config[_0x4361('0x2')];var APP_JSON_PATH=path[_0x4361('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x4361('0x4'));function setLegacyLibsNodeEnvPath(_0x25f042){let _0x30a1a5=![];if(Array[_0x4361('0x5')](_0x25f042[_0x4361('0x6')])){var _0x3f802c=_0x25f042[_0x4361('0x6')][_0x4361('0x7')](function(_0x2a787b){return _0x2a787b[_0x4361('0x8')]===_0x4361('0x9');});if(_0x3f802c>-0x1){var _0x5fbe94=_0x25f042[_0x4361('0x6')][_0x3f802c];if(typeof _0x5fbe94['env'][_0x4361('0xa')]!=='string'){_0x5fbe94[_0x4361('0xb')][_0x4361('0xa')]=NODEPATH;_0x30a1a5=!![];}}return{'appConfig':_0x25f042,'updated':_0x30a1a5};}}function updateAppConfig(_0x52ba7e){return fs[_0x4361('0xc')](APP_JSON_PATH)[_0x4361('0xd')](function(_0x49d291){if(_0x49d291){return fs[_0x4361('0xe')](APP_JSON_PATH)[_0x4361('0xd')](function(_0x3a2df9){var _0x3e6e25=setLegacyLibsNodeEnvPath(_0x3a2df9);if(_0x3e6e25[_0x4361('0xf')]){_0x52ba7e[_0x4361('0x10')]('Updating\x20app.json');return fs[_0x4361('0x11')](APP_JSON_PATH,_0x3a2df9,{'spaces':0x2});}else{return Promise[_0x4361('0x3')]();}});}else{return Promise[_0x4361('0x3')]();}});}module[_0x4361('0x12')]=updateAppConfig; \ No newline at end of file +var _0x4cdc=['writeJSON','exports','fs-extra','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','pathExists','readJSON','then','updated','Updating\x20app.json'];(function(_0xb7e87d,_0x3a43f7){var _0x35f5eb=function(_0x1379de){while(--_0x1379de){_0xb7e87d['push'](_0xb7e87d['shift']());}};_0x35f5eb(++_0x3a43f7);}(_0x4cdc,0xfe));var _0xc4cd=function(_0x14792e,_0x3acf98){_0x14792e=_0x14792e-0x0;var _0x24c2ee=_0x4cdc[_0x14792e];return _0x24c2ee;};var fs=require(_0xc4cd('0x0'));var path=require('path');var config=require(_0xc4cd('0x1'));var root=config[_0xc4cd('0x2')];var APP_JSON_PATH=path[_0xc4cd('0x3')](root,_0xc4cd('0x4'));var NODEPATH=path['resolve'](root,_0xc4cd('0x5'));function setLegacyLibsNodeEnvPath(_0x12edba){let _0x15e55a=![];if(Array[_0xc4cd('0x6')](_0x12edba[_0xc4cd('0x7')])){var _0x35bc3f=_0x12edba[_0xc4cd('0x7')][_0xc4cd('0x8')](function(_0x50a178){return _0x50a178[_0xc4cd('0x9')]===_0xc4cd('0xa');});if(_0x35bc3f>-0x1){var _0x256f75=_0x12edba['apps'][_0x35bc3f];if(typeof _0x256f75['env'][_0xc4cd('0xb')]!==_0xc4cd('0xc')){_0x256f75[_0xc4cd('0xd')][_0xc4cd('0xb')]=NODEPATH;_0x15e55a=!![];}}return{'appConfig':_0x12edba,'updated':_0x15e55a};}}function updateAppConfig(_0x1f073a){return fs[_0xc4cd('0xe')](APP_JSON_PATH)['then'](function(_0x194b67){if(_0x194b67){return fs[_0xc4cd('0xf')](APP_JSON_PATH)[_0xc4cd('0x10')](function(_0x2a8efc){var _0x4c8922=setLegacyLibsNodeEnvPath(_0x2a8efc);if(_0x4c8922[_0xc4cd('0x11')]){_0x1f073a['info'](_0xc4cd('0x12'));return fs[_0xc4cd('0x13')](APP_JSON_PATH,_0x2a8efc,{'spaces':0x2});}else{return Promise[_0xc4cd('0x3')]();}});}else{return Promise['resolve']();}});}module[_0xc4cd('0x14')]=updateAppConfig; \ No newline at end of file